Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.
TypeScript boardcollaborationdocdocxexceloffce365officepdfpptpptxpresentationsdksheetslidesspreadsheetuniverwordwordprocessorworkspacexlsx
feat(sheet): add user header part (#4333)
Univer35c55d3e9230
diff --git a/packages/ui/src/services/parts/parts.service.ts b/packages/ui/src/services/parts/parts.service.tsindex a0b078488f..b4d9089190 100644--- a/packages/ui/src/services/parts/parts.service.ts+++ b/packages/ui/src/services/parts/parts.service.ts@@ -31,6 +31,7 @@ export enum BuiltInUIPart {LEFT_SIDEBAR = 'left-sidebar',FLOATING = 'floating',UNIT = 'unit',+ CUSTOM_HEADER = 'custom-header',}export interface IUIPartsService {diff --git a/packages/ui/src/views/mobile-app.module.less b/packages/ui/src/views/mobile-app.module.lessindex f726b571e8..9d50686747 100644--- a/packages/ui/src/views/mobile-app.module.less+++ b/packages/ui/src/views/mobile-app.module.less@@ -8,6 +8,14 @@position: relative;}+ &-custom-header {+ position: relative;+ display: flex;+ flex-direction: column;+ min-height: 0;+ background-color: rgb(var(--color-white));+ }+&-header {width: 100vw;}diff --git a/packages/ui/src/views/workbench/Workbench.tsx b/packages/ui/src/views/workbench/Workbench.tsxindex 0537d8448e..fe6bae5001 100644--- a/packages/ui/src/views/workbench/Workbench.tsx+++ b/packages/ui/src/views/workbench/Workbench.tsx@@ -57,6 +57,7 @@ export function DesktopWorkbench(props: IUniverWorkbenchProps) {const instanceService = useDependency(IUniverInstanceService);const contentRef = useRef<HTMLDivElement>(null);+ const customHeaderComponents = useComponentsOfPart(BuiltInUIPart.CUSTOM_HEADER);const footerComponents = useComponentsOfPart(BuiltInUIPart.FOOTER);const headerComponents = useComponentsOfPart(BuiltInUIPart.HEADER);const headerMenuComponents = useComponentsOfPart(BuiltInUIPart.HEADER_MENU);@@ -138,6 +139,11 @@ export function DesktopWorkbench(props: IUniverWorkbenchProps) {* bubbled to this element and refocus the input element.*/}<div className={styles.workbenchLayout} tabIndex={-1} onBlur={(e) => e.stopPropagation()}>+ {/* user header */}+ <div className={styles.workbenchCustomHeader}>+ <ComponentContainer key="custom-header" components={customHeaderComponents} />+ </div>+{/* header */}{header && toolbar && (<header className={styles.workbenchContainerHeader}>diff --git a/packages/ui/src/views/workbench/workbench.module.less b/packages/ui/src/views/workbench/workbench.module.lessindex 03b360ff3a..2b5dc507ae 100644--- a/packages/ui/src/views/workbench/workbench.module.less+++ b/packages/ui/src/views/workbench/workbench.module.less@@ -8,6 +8,14 @@position: relative;}+ &-custom-header {+ position: relative;+ display: flex;+ flex-direction: column;+ min-height: 0;+ background-color: rgb(var(--color-white));+ }+&-header {// height: 32px;}