Skip to content

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.

feat: reorganize component imports and update component registration in UI controllers (#5235)

白熱4ae5482fed3a
diff --git a/packages-experimental/uniui/src/controllers/menu.ts b/packages-experimental/uniui/src/controllers/menu.ts
index 2ded6b9b97..7182dc2c5a 100644
--- a/packages-experimental/uniui/src/controllers/menu.ts
+++ b/packages-experimental/uniui/src/controllers/menu.ts
@@ -14,8 +14,10 @@
* limitations under the License.
*/
-import { type IAccessor, IUniverInstanceService, UniverInstanceType } from '@univerjs/core';
-import { type IMenuButtonItem, type IMenuItem, type IMenuSelectorItem, MenuItemType } from '@univerjs/ui';
+import type { IAccessor } from '@univerjs/core';
+import type { IMenuButtonItem, IMenuItem, IMenuSelectorItem } from '@univerjs/ui';
+import { IUniverInstanceService, UniverInstanceType } from '@univerjs/core';
+import { MenuItemType } from '@univerjs/ui';
import { Observable } from 'rxjs';
import { DisposeUnitOperation } from '../commands/operations/uni.operation';
@@ -50,7 +52,7 @@ export function FakeFontFamilySelectorMenuItemFactory(accessor: IAccessor): IMen
id: FAKE_FONT_FAMILY_MENU_ID,
tooltip: 'toolbar.font',
type: MenuItemType.SELECTOR,
- label: 'UI_PLUGIN_DOCS_FONT_FAMILY_COMPONENT',
+ label: 'UI_PLUGIN_DOCS_FONT_SIZE_COMPONENT',
selections: [],
disabled$: new Observable((subscriber) => { subscriber.next(true); }),
};
diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts
index fb45de1efd..a14a031061 100644
--- a/packages/core/src/index.ts
+++ b/packages/core/src/index.ts
@@ -117,7 +117,7 @@ export type { IPermissionParam } from './services/permission/type';
export type { IPermissionPoint } from './services/permission/type';
export type { IPermissionTypes, RangePermissionPointConstructor, WorkbookPermissionPointConstructor, WorkSheetPermissionPointConstructor } from './services/permission/type';
-export type { PluginCtor } from './services/plugin/plugin.service.ts';
+export type { PluginCtor } from './services/plugin/plugin.service';
export { DependentOn, Plugin, PluginService } from './services/plugin/plugin.service';
export { type DependencyOverride, mergeOverrideWithDependencies } from './services/plugin/plugin-override';
export { IResourceLoaderService } from './services/resource-loader/type';
@@ -197,7 +197,7 @@ export { type IUniverConfig, Univer } from './univer';
export { isNodeEnv } from './shared/tools';
export { Skeleton } from './skeleton';
export type { IGetRowColByPosOptions } from './sheets/sheet-skeleton';
-export type { IPosition } from './sheets/typedef.ts';
+export type { IPosition } from './sheets/typedef';
export * from './sheets/sheet-skeleton';
// invert color utils
diff --git a/packages/docs-ui/src/components/color-picker/index.ts b/packages/docs-ui/src/components/color-picker/index.ts
deleted file mode 100644
index f18db320d4..0000000000
--- a/packages/docs-ui/src/components/color-picker/index.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-/**
- * Copyright 2023-present DreamNum Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export { COLOR_PICKER_COMPONENT } from './interface';
-export { ColorPicker } from '@univerjs/design';
diff --git a/packages/docs-ui/src/components/color-picker/interface.ts b/packages/docs-ui/src/components/color-picker/interface.ts
deleted file mode 100644
index 081e09bf66..0000000000
--- a/packages/docs-ui/src/components/color-picker/interface.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * Copyright 2023-present DreamNum Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { COMPONENT_PREFIX } from '../const';
-
-export const COLOR_PICKER_COMPONENT = `${COMPONENT_PREFIX}_COLOR_PICKER_COMPONENT`;
diff --git a/packages/docs-ui/src/components/float-toolbar/FloatToolbar.stories.tsx b/packages/docs-ui/src/components/float-toolbar/FloatToolbar.stories.tsx
index c4a8ee418d..d1f603e170 100644
--- a/packages/docs-ui/src/components/float-toolbar/FloatToolbar.stories.tsx
+++ b/packages/docs-ui/src/components/float-toolbar/FloatToolbar.stories.tsx
@@ -21,7 +21,7 @@ import { LocaleService, LocaleType } from '@univerjs/core';
import { ColorPicker } from '@univerjs/design';
import { DocSelectionManagerService } from '@univerjs/docs';
import { IRenderManagerService, RenderManagerService } from '@univerjs/engine-render';
-import { ComponentManager, DesktopLayoutService, FontFamily, FontFamilyItem, FontSize, ILayoutService, IMenuManagerService, MenuManagerService, RediContext } from '@univerjs/ui';
+import { COLOR_PICKER_COMPONENT, ComponentManager, DesktopLayoutService, FONT_FAMILY_COMPONENT, FONT_FAMILY_ITEM_COMPONENT, FONT_SIZE_COMPONENT, FontFamily, FontFamilyItem, FontSize, ILayoutService, IMenuManagerService, MenuManagerService, RediContext } from '@univerjs/ui';
import { useContext, useEffect, useState } from 'react';
import {
SetInlineFormatBoldCommand,
@@ -39,9 +39,6 @@ import { menuSchema } from '../../controllers/menu.schema';
import enUS from '../../locale/en-US';
import ruRU from '../../locale/ru-RU';
import zhCN from '../../locale/zh-CN';
-import { COLOR_PICKER_COMPONENT } from '../color-picker';
-import { FONT_FAMILY_COMPONENT, FONT_FAMILY_ITEM_COMPONENT } from '../font-family';
-import { FONT_SIZE_COMPONENT } from '../font-size';
import { FloatToolbar } from './FloatToolbar';
const meta: Meta<typeof FloatToolbar> = {
diff --git a/packages/docs-ui/src/components/font-family/index.ts b/packages/docs-ui/src/components/font-family/index.ts
deleted file mode 100644
index 349c5eeeb6..0000000000
--- a/packages/docs-ui/src/components/font-family/index.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * Copyright 2023-present DreamNum Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export { FONT_FAMILY_COMPONENT, FONT_FAMILY_ITEM_COMPONENT } from './interface';
-export { FontFamily } from '@univerjs/ui';
-export { FontFamilyItem } from '@univerjs/ui';
diff --git a/packages/docs-ui/src/components/font-family/interface.ts b/packages/docs-ui/src/components/font-family/interface.ts
deleted file mode 100644
index bd3fb49dcf..0000000000
--- a/packages/docs-ui/src/components/font-family/interface.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-/**
- * Copyright 2023-present DreamNum Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { COMPONENT_PREFIX } from '../const';
-
-export const FONT_FAMILY_COMPONENT = `${COMPONENT_PREFIX}_FONT_FAMILY_COMPONENT`;
-
-export const FONT_FAMILY_ITEM_COMPONENT = `${COMPONENT_PREFIX}_FONT_FAMILY_ITEM_COMPONENT`;
diff --git a/packages/docs-ui/src/components/font-size/index.ts b/packages/docs-ui/src/components/font-size/index.ts
deleted file mode 100644
index e4a4d81c79..0000000000
--- a/packages/docs-ui/src/components/font-size/index.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-/**
- * Copyright 2023-present DreamNum Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export { FONT_SIZE_COMPONENT } from './interface';
-export { FontSize } from '@univerjs/ui';
diff --git a/packages/docs-ui/src/components/font-size/interface.ts b/packages/docs-ui/src/components/font-size/interface.ts
deleted file mode 100644
index d78b387c32..0000000000
--- a/packages/docs-ui/src/components/font-size/interface.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * Copyright 2023-present DreamNum Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { COMPONENT_PREFIX } from '../const';
-
-export const FONT_SIZE_COMPONENT = `${COMPONENT_PREFIX}_FONT_SIZE_COMPONENT`;
diff --git a/packages/docs-ui/src/controllers/doc-ui.controller.ts b/packages/docs-ui/src/controllers/doc-ui.controller.ts
index 14e91ab32a..b5412ae8ae 100644
--- a/packages/docs-ui/src/controllers/doc-ui.controller.ts
+++ b/packages/docs-ui/src/controllers/doc-ui.controller.ts
@@ -23,20 +23,11 @@ import {
IUniverInstanceService,
UniverInstanceType,
} from '@univerjs/core';
-
import { IRenderManagerService } from '@univerjs/engine-render';
import { CutSingle, DeleteSingle, DocSettingSingle, TodoList } from '@univerjs/icons';
import { BuiltInUIPart, ComponentManager, connectInjector, ILayoutService, IMenuManagerService, IShortcutService, IUIPartsService } from '@univerjs/ui';
import { CoreHeaderFooterCommand, OpenHeaderFooterPanelCommand } from '../commands/commands/doc-header-footer.command';
import { SidebarDocHeaderFooterPanelOperation } from '../commands/operations/doc-header-footer-panel.operation';
-import { COLOR_PICKER_COMPONENT, ColorPicker } from '../components/color-picker';
-import {
- FONT_FAMILY_COMPONENT,
- FONT_FAMILY_ITEM_COMPONENT,
- FontFamily,
- FontFamilyItem,
-} from '../components/font-family';
-import { FONT_SIZE_COMPONENT, FontSize } from '../components/font-size';
import { BULLET_LIST_TYPE_COMPONENT, BulletListTypePicker, ORDER_LIST_TYPE_COMPONENT, OrderListTypePicker } from '../components/list-type-picker';
import { ParagraphMenu } from '../components/paragraph-menu';
import { DocSelectionRenderService } from '../services/selection/doc-selection-render.service';
@@ -79,10 +70,6 @@ export class DocUIController extends Disposable {
private _initCustomComponents(): void {
const componentManager = this._componentManager;
- this.disposeWithMe(componentManager.register(COLOR_PICKER_COMPONENT, ColorPicker));
- this.disposeWithMe(componentManager.register(FONT_FAMILY_COMPONENT, FontFamily));
- this.disposeWithMe(componentManager.register(FONT_FAMILY_ITEM_COMPONENT, FontFamilyItem));
- this.disposeWithMe(componentManager.register(FONT_SIZE_COMPONENT, FontSize));
this.disposeWithMe(componentManager.register(BULLET_LIST_TYPE_COMPONENT, BulletListTypePicker));
this.disposeWithMe(componentManager.register(ORDER_LIST_TYPE_COMPONENT, OrderListTypePicker));
this.disposeWithMe(componentManager.register('TodoList', TodoList));
diff --git a/packages/docs-ui/src/controllers/menu/menu.ts b/packages/docs-ui/src/controllers/menu/menu.ts
index 56bc338c05..a47ff70118 100644
--- a/packages/docs-ui/src/controllers/menu/menu.ts
+++ b/packages/docs-ui/src/controllers/menu/menu.ts
@@ -42,8 +42,12 @@ import {
} from '@univerjs/docs';
import { DocumentEditArea, IRenderManagerService } from '@univerjs/engine-render';
import {
+ COLOR_PICKER_COMPONENT,
COMMON_LABEL_COMPONENT,
+ FONT_FAMILY_COMPONENT,
+ FONT_FAMILY_ITEM_COMPONENT,
FONT_FAMILY_LIST,
+ FONT_SIZE_COMPONENT,
FONT_SIZE_LIST,
getMenuHiddenObservable,
HEADING_ITEM_COMPONENT,
@@ -62,9 +66,6 @@ import { SwitchDocModeCommand } from '../../commands/commands/switch-doc-mode.co
import { DocCreateTableOperation } from '../../commands/operations/doc-create-table.operation';
import { DocOpenPageSettingCommand } from '../../commands/operations/open-page-setting.operation';
import { getCommandSkeleton } from '../../commands/util';
-import { COLOR_PICKER_COMPONENT } from '../../components/color-picker';
-import { FONT_FAMILY_COMPONENT, FONT_FAMILY_ITEM_COMPONENT } from '../../components/font-family';
-import { FONT_SIZE_COMPONENT } from '../../components/font-size';
import { BULLET_LIST_TYPE_COMPONENT, ORDER_LIST_TYPE_COMPONENT } from '../../components/list-type-picker';
import { DocMenuStyleService } from '../../services/doc-menu-style.service';
diff --git a/packages/sheets-formula-ui/src/views/formula-editor/search-function/SearchFunction.tsx b/packages/sheets-formula-ui/src/views/formula-editor/search-function/SearchFunction.tsx
index 05727d52ec..5486bfe50c 100644
--- a/packages/sheets-formula-ui/src/views/formula-editor/search-function/SearchFunction.tsx
+++ b/packages/sheets-formula-ui/src/views/formula-editor/search-function/SearchFunction.tsx
@@ -201,7 +201,7 @@ function SearchFunctionFactory(props: ISearchFunctionProps, ref: any) {
univer-m-0 univer-box-border univer-max-h-[400px] univer-w-[250px] univer-list-none
univer-overflow-y-auto univer-rounded-lg univer-bg-white univer-p-2 univer-leading-5 univer-shadow-md
univer-outline-none
- dark:univer-bg-gray-900
+ dark:!univer-bg-gray-900
`, borderClassName, scrollbarClassName)}
>
{searchList.map((item, index) => (
diff --git a/packages/sheets-ui/src/components/border-panel/BorderPanel.tsx b/packages/sheets-ui/src/components/border-panel/BorderPanel.tsx
index b63be58703..4b0ccadad3 100644
--- a/packages/sheets-ui/src/components/border-panel/BorderPanel.tsx
+++ b/packages/sheets-ui/src/components/border-panel/BorderPanel.tsx
@@ -146,7 +146,7 @@ export function BorderPanel(props: IBorderPanelProps) {
`}
extend={{ colorChannel1: value?.color ?? '' }}
/>
- <MoreDownSingle />
+ <MoreDownSingle className="dark:!univer-text-white" />
</button>
</Dropdown>
</div>
@@ -196,7 +196,7 @@ export function BorderPanel(props: IBorderPanelProps) {
`}
type={BorderStyleTypes.THIN}
/>
- <MoreDownSingle />
+ <MoreDownSingle className="dark:!univer-text-white" />
</button>
</Dropdown>
</div>
diff --git a/packages/sheets-ui/src/components/color-picker/index.ts b/packages/sheets-ui/src/components/color-picker/index.ts
deleted file mode 100644
index f18db320d4..0000000000
--- a/packages/sheets-ui/src/components/color-picker/index.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-/**
- * Copyright 2023-present DreamNum Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export { COLOR_PICKER_COMPONENT } from './interface';
-export { ColorPicker } from '@univerjs/design';
diff --git a/packages/sheets-ui/src/components/color-picker/interface.ts b/packages/sheets-ui/src/components/color-picker/interface.ts
deleted file mode 100644
index 081e09bf66..0000000000
--- a/packages/sheets-ui/src/components/color-picker/interface.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * Copyright 2023-present DreamNum Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { COMPONENT_PREFIX } from '../const';
-
-export const COLOR_PICKER_COMPONENT = `${COMPONENT_PREFIX}_COLOR_PICKER_COMPONENT`;
diff --git a/packages/sheets-ui/src/components/font-family/index.ts b/packages/sheets-ui/src/components/font-family/index.ts
deleted file mode 100644
index 349c5eeeb6..0000000000
--- a/packages/sheets-ui/src/components/font-family/index.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * Copyright 2023-present DreamNum Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export { FONT_FAMILY_COMPONENT, FONT_FAMILY_ITEM_COMPONENT } from './interface';
-export { FontFamily } from '@univerjs/ui';
-export { FontFamilyItem } from '@univerjs/ui';
diff --git a/packages/sheets-ui/src/components/font-family/interface.ts b/packages/sheets-ui/src/components/font-family/interface.ts
deleted file mode 100644
index bd3fb49dcf..0000000000
--- a/packages/sheets-ui/src/components/font-family/interface.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-/**
- * Copyright 2023-present DreamNum Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { COMPONENT_PREFIX } from '../const';
-
-export const FONT_FAMILY_COMPONENT = `${COMPONENT_PREFIX}_FONT_FAMILY_COMPONENT`;
-
-export const FONT_FAMILY_ITEM_COMPONENT = `${COMPONENT_PREFIX}_FONT_FAMILY_ITEM_COMPONENT`;
diff --git a/packages/sheets-ui/src/components/font-size/interface.ts b/packages/sheets-ui/src/components/font-size/interface.ts
deleted file mode 100644
index d78b387c32..0000000000
--- a/packages/sheets-ui/src/components/font-size/interface.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * Copyright 2023-present DreamNum Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { COMPONENT_PREFIX } from '../const';
-
-export const FONT_SIZE_COMPONENT = `${COMPONENT_PREFIX}_FONT_SIZE_COMPONENT`;
diff --git a/packages/sheets-ui/src/components/menu-item-input/MenuItemInput.tsx b/packages/sheets-ui/src/components/menu-item-input/MenuItemInput.tsx
index 36f58a5407..67712a13d5 100644
--- a/packages/sheets-ui/src/components/menu-item-input/MenuItemInput.tsx
+++ b/packages/sheets-ui/src/components/menu-item-input/MenuItemInput.tsx
@@ -33,7 +33,10 @@ export const MenuItemInput = (props: IMenuItemInputProps) => {
setInputValue(min.toString());
return;
}
- setInputValue(value?.toString());
+
+ const inputValue = value.toString();
+ setInputValue(inputValue);
+ onChange(inputValue);
};
useEffect(() => {
diff --git a/packages/sheets-ui/src/controllers/menu/menu.ts b/packages/sheets-ui/src/controllers/menu/menu.ts
index 704e639148..865f308e38 100644
--- a/packages/sheets-ui/src/controllers/menu/menu.ts
+++ b/packages/sheets-ui/src/controllers/menu/menu.ts
@@ -72,8 +72,12 @@ import {
WorksheetSetRowStylePermission,
} from '@univerjs/sheets';
import {
+ COLOR_PICKER_COMPONENT,
CutCommand,
+ FONT_FAMILY_COMPONENT,
+ FONT_FAMILY_ITEM_COMPONENT,
FONT_FAMILY_LIST,
+ FONT_SIZE_COMPONENT,
FONT_SIZE_LIST,
getMenuHiddenObservable,
IClipboardInterfaceService,
@@ -103,9 +107,6 @@ import {
import { SetInfiniteFormatPainterCommand, SetOnceFormatPainterCommand } from '../../commands/commands/set-format-painter.command';
import { SetColumnFrozenCommand, SetRowFrozenCommand, SetSelectionFrozenCommand } from '../../commands/commands/set-frozen.command';
import { SetWorksheetColAutoWidthCommand } from '../../commands/commands/set-worksheet-auto-col-width.command';
-import { COLOR_PICKER_COMPONENT } from '../../components/color-picker';
-import { FONT_FAMILY_COMPONENT, FONT_FAMILY_ITEM_COMPONENT } from '../../components/font-family';
-import { FONT_SIZE_COMPONENT } from '../../components/font-size';
import { MENU_ITEM_INPUT_COMPONENT } from '../../components/menu-item-input';
import { FormatPainterStatus, IFormatPainterService } from '../../services/format-painter/format-painter.service';
import { deriveStateFromActiveSheet$, getCurrentRangeDisable$, getObservableWithExclusiveRange$ } from './menu-util';
diff --git a/packages/sheets-ui/src/controllers/menu/sheet.menu.ts b/packages/sheets-ui/src/controllers/menu/sheet.menu.ts
index 9c555521aa..41692cc8e1 100644
--- a/packages/sheets-ui/src/controllers/menu/sheet.menu.ts
+++ b/packages/sheets-ui/src/controllers/menu/sheet.menu.ts
@@ -32,13 +32,12 @@ import {
WorkbookHideSheetPermission,
WorkbookRenameSheetPermission,
} from '@univerjs/sheets';
-import { getMenuHiddenObservable, MenuItemType } from '@univerjs/ui';
+import { COLOR_PICKER_COMPONENT, getMenuHiddenObservable, MenuItemType } from '@univerjs/ui';
import { combineLatest, combineLatestWith, map, Observable } from 'rxjs';
import { RemoveSheetConfirmCommand } from '../../commands/commands/remove-sheet-confirm.command';
import { ShowMenuListCommand } from '../../commands/commands/unhide.command';
import { RenameSheetOperation } from '../../commands/operations/rename-sheet.operation';
-import { COLOR_PICKER_COMPONENT } from '../../components/color-picker';
import { getWorkbookPermissionDisable$ } from './menu-util';
export function DeleteSheetMenuItemFactory(accessor: IAccessor): IMenuButtonItem {
diff --git a/packages/sheets-ui/src/controllers/mobile/mobile-sheet-ui.controller.ts b/packages/sheets-ui/src/controllers/mobile/mobile-sheet-ui.controller.ts
index 72973214a1..88cbca2a76 100644
--- a/packages/sheets-ui/src/controllers/mobile/mobile-sheet-ui.controller.ts
+++ b/packages/sheets-ui/src/controllers/mobile/mobile-sheet-ui.controller.ts
@@ -87,19 +87,9 @@ import { SheetPermissionOpenPanelOperation } from '../../commands/operations/she
import { SidebarDefinedNameOperation } from '../../commands/operations/sidebar-defined-name.operation';
import { BorderPanel } from '../../components/border-panel/BorderPanel';
import { BORDER_PANEL_COMPONENT } from '../../components/border-panel/interface';
-import { COLOR_PICKER_COMPONENT, ColorPicker } from '../../components/color-picker';
-import {
- FONT_FAMILY_COMPONENT,
- FONT_FAMILY_ITEM_COMPONENT,
- FontFamily,
- FontFamilyItem,
-} from '../../components/font-family';
-
-import { FONT_SIZE_COMPONENT, FontSize } from '../../components/font-size';
import { MENU_ITEM_INPUT_COMPONENT, MenuItemInput } from '../../components/menu-item-input';
import { DEFINED_NAME_CONTAINER } from '../../views/defined-name/component-name';
import { DefinedNameContainer } from '../../views/defined-name/DefinedNameContainer';
-
import { MobileSheetBar } from '../../views/mobile/sheet-bar/MobileSheetBar';
import {
EditorBreakLineShortcut,
@@ -181,10 +171,6 @@ export class SheetUIMobileController extends Disposable {
const componentManager = this._componentManager;
this.disposeWithMe(componentManager.register(MENU_ITEM_INPUT_COMPONENT, MenuItemInput));
this.disposeWithMe(componentManager.register(BORDER_PANEL_COMPONENT, BorderPanel));
- this.disposeWithMe(componentManager.register(COLOR_PICKER_COMPONENT, ColorPicker));
- this.disposeWithMe(componentManager.register(FONT_FAMILY_COMPONENT, FontFamily));
- this.disposeWithMe(componentManager.register(FONT_FAMILY_ITEM_COMPONENT, FontFamilyItem));
- this.disposeWithMe(componentManager.register(FONT_SIZE_COMPONENT, FontSize));
this.disposeWithMe(componentManager.register(DEFINED_NAME_CONTAINER, DefinedNameContainer));
}
diff --git a/packages/sheets-ui/src/controllers/sheet-ui.controller.ts b/packages/sheets-ui/src/controllers/sheet-ui.controller.ts
index 00c4b209dc..bd442a3a69 100644
--- a/packages/sheets-ui/src/controllers/sheet-ui.controller.ts
+++ b/packages/sheets-ui/src/controllers/sheet-ui.controller.ts
@@ -92,17 +92,8 @@ import { SetZoomRatioOperation } from '../commands/operations/set-zoom-ratio.ope
import { SheetPermissionOpenDialogOperation } from '../commands/operations/sheet-permission-open-dialog.operation';
import { SheetPermissionOpenPanelOperation } from '../commands/operations/sheet-permission-open-panel.operation';
import { SidebarDefinedNameOperation } from '../commands/operations/sidebar-defined-name.operation';
-
import { BorderPanel } from '../components/border-panel/BorderPanel';
import { BORDER_PANEL_COMPONENT } from '../components/border-panel/interface';
-import { COLOR_PICKER_COMPONENT, ColorPicker } from '../components/color-picker';
-import {
- FONT_FAMILY_COMPONENT,
- FONT_FAMILY_ITEM_COMPONENT,
- FontFamily,
- FontFamilyItem,
-} from '../components/font-family';
-import { FONT_SIZE_COMPONENT, FontSize } from '../components/font-size';
import { MENU_ITEM_INPUT_COMPONENT, MenuItemInput } from '../components/menu-item-input';
import { CellPopup } from '../views/cell-popup';
import { CELL_POPUP_COMPONENT_KEY } from '../views/cell-popup/config';
@@ -195,10 +186,6 @@ export class SheetUIController extends Disposable {
// init custom components
this.disposeWithMe(componentManager.register(MENU_ITEM_INPUT_COMPONENT, MenuItemInput));
this.disposeWithMe(componentManager.register(BORDER_PANEL_COMPONENT, BorderPanel));
- this.disposeWithMe(componentManager.register(COLOR_PICKER_COMPONENT, ColorPicker));
- this.disposeWithMe(componentManager.register(FONT_FAMILY_COMPONENT, FontFamily));
- this.disposeWithMe(componentManager.register(FONT_FAMILY_ITEM_COMPONENT, FontFamilyItem));
- this.disposeWithMe(componentManager.register(FONT_SIZE_COMPONENT, FontSize));
this.disposeWithMe(componentManager.register(DEFINED_NAME_CONTAINER, DefinedNameContainer));
this.disposeWithMe(componentManager.register(CELL_POPUP_COMPONENT_KEY, CellPopup));
diff --git a/packages/sheets-ui/src/index.ts b/packages/sheets-ui/src/index.ts
index ed8906e704..1c0f358f59 100644
--- a/packages/sheets-ui/src/index.ts
+++ b/packages/sheets-ui/src/index.ts
@@ -83,10 +83,7 @@ export type { IRangeProtectionRenderCellData } from './views/permission/extensio
export { SheetBar } from './views/sheet-bar/SheetBar';
export { RenderSheetContent, RenderSheetFooter, RenderSheetHeader } from './views/sheet-container/SheetContainer';
export { type IUniverSheetsUIConfig } from './controllers/config.schema';
-
export { getCellRealRange } from './common/utils';
-export { FONT_FAMILY_COMPONENT, FONT_FAMILY_ITEM_COMPONENT } from './components/font-family/interface';
-export { FONT_SIZE_COMPONENT } from './components/font-size/interface';
export { EMBEDDING_FORMULA_EDITOR, isEmbeddingFormulaEditor } from './controllers/editor/utils/is-embedding-formula-editor';
export { isRangeSelector, RANGE_SELECTOR_SYMBOLS } from './controllers/editor/utils/is-range-selector';
export { menuSchema as SheetsUIMenuSchema } from './controllers/menu.schema';
diff --git a/packages/sheets-ui/src/components/font-size/index.ts b/packages/ui/src/components/color-picker/interface.ts
similarity index 86%
rename from packages/sheets-ui/src/components/font-size/index.ts
rename to packages/ui/src/components/color-picker/interface.ts
index e4a4d81c79..8982fa9357 100644
--- a/packages/sheets-ui/src/components/font-size/index.ts
+++ b/packages/ui/src/components/color-picker/interface.ts
@@ -14,5 +14,4 @@
* limitations under the License.
*/
-export { FONT_SIZE_COMPONENT } from './interface';
-export { FontSize } from '@univerjs/ui';
+export const COLOR_PICKER_COMPONENT = 'UI_COLOR_PICKER_COMPONENT';
diff --git a/packages/ui/src/components/font-family/interface.ts b/packages/ui/src/components/font-family/interface.ts
index d143c9d018..b220b522af 100644
--- a/packages/ui/src/components/font-family/interface.ts
+++ b/packages/ui/src/components/font-family/interface.ts
@@ -20,10 +20,14 @@ export interface IFontFamilyProps extends ICustomComponentProps<string> {
value: string;
}
+export const FONT_FAMILY_COMPONENT = 'UI_FONT_FAMILY_COMPONENT';
+
export interface IFontFamilyItemProps extends ICustomComponentProps<string> {
value: string;
}
+export const FONT_FAMILY_ITEM_COMPONENT = 'UI_FONT_FAMILY_ITEM_COMPONENT';
+
export const FONT_FAMILY_LIST = [
{
value: 'Arial',
diff --git a/packages/ui/src/components/font-size/index.ts b/packages/ui/src/components/font-size/index.ts
deleted file mode 100644
index 8d17dd4302..0000000000
--- a/packages/ui/src/components/font-size/index.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-/**
- * Copyright 2023-present DreamNum Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export { FontSize } from './FontSize';
-export { FONT_SIZE_LIST, HEADING_LIST } from './interface';
diff --git a/packages/ui/src/components/font-size/interface.ts b/packages/ui/src/components/font-size/interface.ts
index 388e19845c..5ee7dbf3d1 100644
--- a/packages/ui/src/components/font-size/interface.ts
+++ b/packages/ui/src/components/font-size/interface.ts
@@ -128,3 +128,5 @@ export const HEADING_LIST = [
value: NamedStyleType.HEADING_5,
},
];
+
+export const FONT_SIZE_COMPONENT = 'UI_FONT_SIZE_COMPONENT';
diff --git a/packages/ui/src/components/index.ts b/packages/ui/src/components/index.ts
index 3b24503efa..488c7f1fdd 100644
--- a/packages/ui/src/components/index.ts
+++ b/packages/ui/src/components/index.ts
@@ -16,8 +16,8 @@
export * from './common-label';
export * from './custom-label';
-export * from './font-family';
-export * from './font-size';
export * from './heading-item';
+
export { useScrollYOverContainer } from './hooks/layout';
+
export { type ISliderProps, Slider } from './slider';
diff --git a/packages/ui/src/controllers/ui/ui-desktop.controller.tsx b/packages/ui/src/controllers/ui/ui-desktop.controller.tsx
index 3e6abe874c..142040a90c 100644
--- a/packages/ui/src/controllers/ui/ui-desktop.controller.tsx
+++ b/packages/ui/src/controllers/ui/ui-desktop.controller.tsx
@@ -19,12 +19,17 @@ import type { IUniverWorkbenchProps } from '../../views/workbench/Workbench';
import type { IUniverUIConfig } from '../config.schema';
import type { IWorkbenchOptions } from './ui.controller';
import { Inject, Injector, IUniverInstanceService, LifecycleService, toDisposable } from '@univerjs/core';
-import { render as createRoot, unmount } from '@univerjs/design';
+import { ColorPicker, render as createRoot, unmount } from '@univerjs/design';
import { IRenderManagerService } from '@univerjs/engine-render';
import React from 'react';
import { ComponentManager } from '../../common';
import { HEADING_ITEM_COMPONENT, HeadingItem } from '../../components';
+import { COLOR_PICKER_COMPONENT } from '../../components/color-picker/interface';
import { COMMON_LABEL_COMPONENT, CommonLabel } from '../../components/common-label';
+import { FontFamily, FontFamilyItem } from '../../components/font-family';
+import { FONT_FAMILY_COMPONENT, FONT_FAMILY_ITEM_COMPONENT } from '../../components/font-family/interface';
+import { FontSize } from '../../components/font-size/FontSize';
+import { FONT_SIZE_COMPONENT } from '../../components/font-size/interface';
import { ILayoutService } from '../../services/layout/layout.service';
import { IMenuManagerService } from '../../services/menu/menu-manager.service';
import { BuiltInUIPart, IUIPartsService } from '../../services/parts/parts.service';
@@ -70,6 +75,30 @@ export class DesktopUIController extends SingleUnitUIController {
HeadingItem
)
);
+ this.disposeWithMe(
+ this._componentManager.register(
+ FONT_FAMILY_COMPONENT,
+ FontFamily
+ )
+ );
+ this.disposeWithMe(
+ this._componentManager.register(
+ FONT_FAMILY_ITEM_COMPONENT,
+ FontFamilyItem
+ )
+ );
+ this.disposeWithMe(
+ this._componentManager.register(
+ FONT_SIZE_COMPONENT,
+ FontSize
+ )
+ );
+ this.disposeWithMe(
+ this._componentManager.register(
+ COLOR_PICKER_COMPONENT,
+ ColorPicker
+ )
+ );
}
override bootstrap(callback: (contentElement: HTMLElement, containerElement: HTMLElement) => void): IDisposable {
diff --git a/packages/ui/src/index.ts b/packages/ui/src/index.ts
index fc941e1b3c..b460a5cc9a 100644
--- a/packages/ui/src/index.ts
+++ b/packages/ui/src/index.ts
@@ -20,6 +20,12 @@ export * from './common';
export { getHeaderFooterMenuHiddenObservable, getMenuHiddenObservable } from './common/menu-hidden-observable';
export { mergeMenuConfigs } from './common/menu-merge-configs';
export * from './components';
+export { COLOR_PICKER_COMPONENT } from './components/color-picker/interface';
+export { FontSize } from './components/font-size/FontSize';
+export { FontFamily } from './components/font-family/FontFamily';
+export { FontFamilyItem } from './components/font-family/FontFamilyItem';
+export { FONT_SIZE_COMPONENT, FONT_SIZE_LIST, HEADING_LIST } from './components/font-size/interface';
+export { FONT_FAMILY_COMPONENT, FONT_FAMILY_ITEM_COMPONENT, FONT_FAMILY_LIST, type IFontFamilyItemProps, type IFontFamilyProps } from './components/font-family/interface';
export { t } from './components/hooks/locale';
export * from './components/hooks';
export { RectPopup, type RectPopupDirection } from './views/components/popup/RectPopup';
diff --git a/packages/ui/src/views/workbench/Workbench.tsx b/packages/ui/src/views/workbench/Workbench.tsx
index c285c26444..20cec24ce5 100644
--- a/packages/ui/src/views/workbench/Workbench.tsx
+++ b/packages/ui/src/views/workbench/Workbench.tsx
@@ -144,6 +144,7 @@ export function DesktopWorkbenchContent(props: IUniverWorkbenchProps) {
})}
tabIndex={-1}
onBlur={(e) => e.stopPropagation()}
+ onContextMenu={(e) => e.preventDefault()}
>
{/* user header */}
<div className="univer-relative univer-flex univer-min-h-0 univer-flex-col univer-bg-white">