@univerjs/ui 0.2.10 → 0.2.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/lib/cjs/index.js +9 -9
  2. package/lib/es/index.js +1036 -757
  3. package/lib/locale/en-US.json +3 -3
  4. package/lib/locale/ru-RU.json +3 -3
  5. package/lib/locale/vi-VN.json +3 -3
  6. package/lib/locale/zh-CN.json +3 -3
  7. package/lib/locale/zh-TW.json +3 -3
  8. package/lib/types/components/menu/desktop/Menu.d.ts +2 -2
  9. package/lib/types/controllers/config.schema.d.ts +12 -0
  10. package/lib/types/controllers/menus/menu.schema.d.ts +2 -0
  11. package/lib/types/controllers/shared-shortcut.controller.d.ts +2 -8
  12. package/lib/types/controllers/shortcut-display/shortcut-panel.controller.d.ts +3 -4
  13. package/lib/types/controllers/ui/ui-desktop.controller.d.ts +7 -4
  14. package/lib/types/controllers/ui/ui-mobile.controller.d.ts +6 -2
  15. package/lib/types/controllers/ui/ui.controller.d.ts +15 -9
  16. package/lib/types/index.d.ts +10 -5
  17. package/lib/types/locale/zh-CN.d.ts +2 -2
  18. package/lib/types/mobile-ui-plugin.d.ts +2 -2
  19. package/lib/types/services/menu/menu-manager.service.d.ts +44 -0
  20. package/lib/types/services/menu/menu.d.ts +11 -9
  21. package/lib/types/services/menu/menu.service.d.ts +8 -2
  22. package/lib/types/services/menu/types.d.ts +64 -0
  23. package/lib/types/ui-plugin.d.ts +5 -4
  24. package/lib/types/views/components/ribbon/Ribbon.d.ts +6 -0
  25. package/lib/types/views/components/{doc-bars → ribbon}/ToolbarItem.d.ts +4 -1
  26. package/lib/types/views/components/ribbon/TooltipButtonWrapper.d.ts +4 -0
  27. package/lib/types/views/components/{doc-bars → ribbon}/hook.d.ts +0 -8
  28. package/lib/umd/index.js +6 -6
  29. package/package.json +14 -14
  30. package/lib/types/views/components/doc-bars/Toolbar.d.ts +0 -8
  31. /package/lib/types/views/components/{doc-bars → ribbon}/Button/ToolbarButton.d.ts +0 -0
@@ -1,13 +1,13 @@
1
1
  {
2
- "uiToolbar": {
2
+ "ribbon": {
3
3
  "start": "Start",
4
4
  "insert": "Insert",
5
5
  "formulas": "Formulas",
6
6
  "data": "Data",
7
7
  "view": "View",
8
- "others": "Others"
8
+ "others": "Others",
9
+ "more": "More"
9
10
  },
10
- "more": "More",
11
11
  "fontFamily": {
12
12
  "TimesNewRoman": "Times New Roman",
13
13
  "Arial": "Arial",
@@ -1,13 +1,13 @@
1
1
  {
2
- "uiToolbar": {
2
+ "ribbon": {
3
3
  "start": "Начало",
4
4
  "insert": "Вставка",
5
5
  "formulas": "Формулы",
6
6
  "data": "Данные",
7
7
  "view": "Вид",
8
- "others": "Другие"
8
+ "others": "Другие",
9
+ "more": "Больше"
9
10
  },
10
- "more": "Больше",
11
11
  "fontFamily": {
12
12
  "TimesNewRoman": "Times New Roman",
13
13
  "Arial": "Arial",
@@ -1,13 +1,13 @@
1
1
  {
2
- "uiToolbar": {
2
+ "ribbon": {
3
3
  "start": "Bắt đầu",
4
4
  "insert": "Chèn",
5
5
  "formulas": "Công thức",
6
6
  "data": "Dữ liệu",
7
7
  "view": "Xem",
8
- "others": "Khác"
8
+ "others": "Khác",
9
+ "more": "Thêm"
9
10
  },
10
- "more": "Thêm",
11
11
  "fontFamily": {
12
12
  "TimesNewRoman": "Times New Roman",
13
13
  "Arial": "Arial",
@@ -1,13 +1,13 @@
1
1
  {
2
- "uiToolbar": {
2
+ "ribbon": {
3
3
  "start": "开始",
4
4
  "insert": "插入",
5
5
  "formulas": "公式",
6
6
  "data": "数据",
7
7
  "view": "视图",
8
- "others": "其他"
8
+ "others": "其他",
9
+ "more": "更多"
9
10
  },
10
- "more": "更多",
11
11
  "fontFamily": {
12
12
  "TimesNewRoman": "Times New Roman",
13
13
  "Arial": "Arial",
@@ -1,13 +1,13 @@
1
1
  {
2
- "uiToolbar": {
2
+ "ribbon": {
3
3
  "start": "開始",
4
4
  "insert": "插入",
5
5
  "formulas": "公式",
6
6
  "data": "資料",
7
7
  "view": "視圖",
8
- "others": "其他"
8
+ "others": "其他",
9
+ "more": "更多"
9
10
  },
10
- "more": "更多",
11
11
  "fontFamily": {
12
12
  "TimesNewRoman": "Times New Roman",
13
13
  "Arial": "Arial",
@@ -1,8 +1,8 @@
1
1
  import { default as React } from 'react';
2
- import { IValueOption } from '../../../services/menu/menu.ts';
2
+ import { IValueOption } from '../../../services/menu/menu';
3
3
  export interface IBaseMenuProps {
4
4
  parentKey?: string | number;
5
- menuType?: string | string[];
5
+ menuType?: string;
6
6
  value?: string | number;
7
7
  options?: IValueOption[];
8
8
  /**
@@ -0,0 +1,12 @@
1
+ import { DependencyOverride } from '@univerjs/core';
2
+ import { MenuConfig } from '../services/menu/menu';
3
+ import { IWorkbenchOptions } from './ui/ui.controller';
4
+ export declare const PLUGIN_CONFIG_KEY = "ui.config";
5
+ export declare const configSymbol: unique symbol;
6
+ export interface IUniverUIConfig extends IWorkbenchOptions {
7
+ /** Disable auto focus when Univer bootstraps. */
8
+ disableAutoFocus?: true;
9
+ override?: DependencyOverride;
10
+ menu?: MenuConfig;
11
+ }
12
+ export declare const defaultPluginConfig: IUniverUIConfig;
@@ -0,0 +1,2 @@
1
+ import { MenuSchemaType } from '../../services/menu/menu-manager.service';
2
+ export declare const menuSchema: MenuSchemaType;
@@ -1,7 +1,5 @@
1
- import { Disposable, ICommandService, Injector } from '@univerjs/core';
2
- import { IMenuService } from '../services/menu/menu.service';
1
+ import { Disposable, ICommandService } from '@univerjs/core';
3
2
  import { IShortcutItem, IShortcutService } from '../services/shortcut/shortcut.service';
4
- import { IUniverUIConfig } from './ui/ui.controller';
5
3
  export declare const CopyShortcutItem: IShortcutItem;
6
4
  export declare const CutShortcutItem: IShortcutItem;
7
5
  /**
@@ -14,14 +12,10 @@ export declare const RedoShortcutItem: IShortcutItem;
14
12
  * Define shared UI behavior across Univer business. Including undo / redo and clipboard operations.
15
13
  */
16
14
  export declare class SharedController extends Disposable {
17
- private readonly _config;
18
- private readonly _injector;
19
- private readonly _menuService;
20
15
  private readonly _shortcutService;
21
16
  private readonly _commandService;
22
- constructor(_config: Pick<IUniverUIConfig, 'menu'> | undefined, _injector: Injector, _menuService: IMenuService, _shortcutService: IShortcutService, _commandService: ICommandService);
17
+ constructor(_shortcutService: IShortcutService, _commandService: ICommandService);
23
18
  initialize(): void;
24
- private _registerMenus;
25
19
  private _registerCommands;
26
20
  private _registerShortcuts;
27
21
  }
@@ -1,12 +1,11 @@
1
1
  import { Disposable, ICommandService, Injector } from '@univerjs/core';
2
2
  import { ComponentManager } from '../../common/component-manager';
3
- import { IMenuService } from '../../services/menu/menu.service';
4
3
  import { IShortcutService } from '../../services/shortcut/shortcut.service';
5
- import { IUniverUIConfig } from '../ui/ui.controller';
4
+ import { IMenuManagerService } from '../../services/menu/menu-manager.service';
6
5
  /**
7
6
  * This controller add a side panel to the application to display the shortcuts.
8
7
  */
9
8
  export declare class ShortcutPanelController extends Disposable {
10
- private readonly _config;
11
- constructor(_config: Partial<IUniverUIConfig>, injector: Injector, componentManager: ComponentManager, shortcutService: IShortcutService, menuService: IMenuService, commandService: ICommandService);
9
+ private readonly _menuManagerService;
10
+ constructor(injector: Injector, componentManager: ComponentManager, shortcutService: IShortcutService, _menuManagerService: IMenuManagerService, commandService: ICommandService);
12
11
  }
@@ -1,8 +1,9 @@
1
- import { Disposable, IConfigService, Injector, IUniverInstanceService, LifecycleService } from '@univerjs/core';
1
+ import { Disposable, Injector, IUniverInstanceService, LifecycleService } from '@univerjs/core';
2
2
  import { IRenderManagerService } from '@univerjs/engine-render';
3
3
  import { ILayoutService } from '../../services/layout/layout.service';
4
4
  import { IUIPartsService } from '../../services/parts/parts.service';
5
- import { IUniverUIConfig } from './ui.controller';
5
+ import { IUniverUIConfig } from '../config.schema';
6
+ import { IMenuManagerService } from '../../services/menu/menu-manager.service';
6
7
  export declare class DesktopUIController extends Disposable {
7
8
  private readonly _config;
8
9
  private readonly _renderManagerService;
@@ -10,10 +11,12 @@ export declare class DesktopUIController extends Disposable {
10
11
  private readonly _injector;
11
12
  private readonly _lifecycleService;
12
13
  private readonly _uiPartsService;
13
- private readonly _configService;
14
+ private readonly _menuManagerService;
14
15
  private readonly _layoutService?;
15
16
  private _steadyTimeout;
16
- constructor(_config: IUniverUIConfig, _renderManagerService: IRenderManagerService, _instanceSrv: IUniverInstanceService, _injector: Injector, _lifecycleService: LifecycleService, _uiPartsService: IUIPartsService, _configService: IConfigService, _layoutService?: ILayoutService | undefined);
17
+ private _renderTimeout;
18
+ constructor(_config: IUniverUIConfig, _renderManagerService: IRenderManagerService, _instanceSrv: IUniverInstanceService, _injector: Injector, _lifecycleService: LifecycleService, _uiPartsService: IUIPartsService, _menuManagerService: IMenuManagerService, _layoutService?: ILayoutService | undefined);
19
+ private _initMenus;
17
20
  private _bootstrapWorkbench;
18
21
  private _initBuiltinComponents;
19
22
  }
@@ -2,7 +2,9 @@ import { Disposable, Injector, IUniverInstanceService, LifecycleService } from '
2
2
  import { IRenderManagerService } from '@univerjs/engine-render';
3
3
  import { ILayoutService } from '../../services/layout/layout.service';
4
4
  import { IUIPartsService } from '../../services/parts/parts.service';
5
- import { IUIController, IUniverUIConfig } from './ui.controller';
5
+ import { IUniverUIConfig } from '../config.schema';
6
+ import { IMenuManagerService } from '../../services/menu/menu-manager.service';
7
+ import { IUIController } from './ui.controller';
6
8
  export declare class MobileUIController extends Disposable implements IUIController {
7
9
  private readonly _config;
8
10
  private readonly _instanceService;
@@ -10,8 +12,10 @@ export declare class MobileUIController extends Disposable implements IUIControl
10
12
  private readonly _injector;
11
13
  private readonly _lifecycleService;
12
14
  private readonly _uiPartsService;
15
+ private readonly _menuManagerService;
13
16
  private readonly _layoutService?;
14
- constructor(_config: IUniverUIConfig, _instanceService: IUniverInstanceService, _renderManagerService: IRenderManagerService, _injector: Injector, _lifecycleService: LifecycleService, _uiPartsService: IUIPartsService, _layoutService?: ILayoutService | undefined);
17
+ constructor(_config: IUniverUIConfig, _instanceService: IUniverInstanceService, _renderManagerService: IRenderManagerService, _injector: Injector, _lifecycleService: LifecycleService, _uiPartsService: IUIPartsService, _menuManagerService: IMenuManagerService, _layoutService?: ILayoutService | undefined);
18
+ private _initMenus;
15
19
  private _bootstrapWorkbench;
16
20
  private _initBuiltinComponents;
17
21
  }
@@ -1,5 +1,18 @@
1
- import { DependencyOverride } from '@univerjs/core';
2
- import { MenuConfig } from '../../services/menu/menu';
1
+ /**
2
+ * Copyright 2023-present DreamNum Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
3
16
  export interface IWorkbenchOptions {
4
17
  container?: string | HTMLElement;
5
18
  header?: boolean;
@@ -10,10 +23,3 @@ export interface IWorkbenchOptions {
10
23
  export interface IUIController {
11
24
  }
12
25
  export declare const IUIController: import('@univerjs/core').IdentifierDecorator<IUIController>;
13
- export interface IUniverUIConfig extends IWorkbenchOptions {
14
- /** Disable auto focus when Univer bootstraps. */
15
- disableAutoFocus?: true;
16
- override?: DependencyOverride;
17
- menu?: MenuConfig;
18
- }
19
- export declare const UI_CONFIG_KEY = "UNIVER_UI_CONFIG_KEY";
@@ -21,7 +21,8 @@ export { useObservable } from './components/hooks/observable';
21
21
  export { useEvent } from './components/hooks/event';
22
22
  export { useVirtualList } from './components/hooks/virtual-list';
23
23
  export { CopyShortcutItem, CutShortcutItem, RedoShortcutItem, SharedController, UndoShortcutItem, } from './controllers/shared-shortcut.controller';
24
- export { UI_CONFIG_KEY, IUIController, type IWorkbenchOptions, type IUniverUIConfig } from './controllers/ui/ui.controller';
24
+ export { IUIController, type IWorkbenchOptions } from './controllers/ui/ui.controller';
25
+ export { type IUniverUIConfig } from './controllers/config.schema';
25
26
  export { DesktopUIController } from './controllers/ui/ui-desktop.controller';
26
27
  export { IUIPartsService, BuiltInUIPart, UIPartsService } from './services/parts/parts.service';
27
28
  export { DesktopBeforeCloseService, IBeforeCloseService } from './services/before-close/before-close.service';
@@ -59,7 +60,7 @@ export { IEditorService, EditorService, Editor } from './services/editor/editor.
59
60
  export { TextEditor } from './components/editor/TextEditor';
60
61
  export { RangeSelector } from './components/range-selector/RangeSelector';
61
62
  export { ProgressBar } from './components/progress-bar/ProgressBar';
62
- export { type IMenuGroup, useSimpleToolbarGroups, useToolbarGroups, useToolbarItemStatus, useToolbarCollapseObserver } from './views/components/doc-bars/hook';
63
+ export { type IMenuGroup, useSimpleToolbarGroups, useToolbarGroups, useToolbarItemStatus } from './views/components/ribbon/hook';
63
64
  export { mergeMenuConfigs } from './common/menu-merge-configs';
64
65
  export { ShortcutPanelController } from './controllers/shortcut-display/shortcut-panel.controller';
65
66
  export { ShortcutPanelService } from './services/shortcut/shortcut-panel.service';
@@ -71,6 +72,10 @@ export { ErrorController } from './controllers/error/error.controller';
71
72
  export { DesktopZenZoneService } from './services/zen-zone/desktop-zen-zone.service';
72
73
  export { DesktopLocalStorageService } from './services/local-storage/local-storage.service';
73
74
  export { UNI_DISABLE_CHANGING_FOCUS_KEY } from './const';
75
+ export { menuSchema } from './controllers/menus/menu.schema';
76
+ export { IMenuManagerService, type MenuSchemaType, MenuManagerService } from './services/menu/menu-manager.service';
77
+ export { MenuManagerPosition, RibbonPosition, RibbonStartGroup, RibbonInsertGroup, RibbonFormulasGroup, RibbonDataGroup, RibbonViewGroup, RibbonOthersGroup, ContextMenuGroup, ContextMenuPosition, } from './services/menu/types';
78
+ export { type IMenuSchema } from './services/menu/menu-manager.service';
74
79
  export { GlobalZone } from './views/components/global-zone/GlobalZone';
75
80
  export { builtInGlobalComponents } from './views/parts';
76
81
  export { DesktopContextMenu as ContextMenu } from './views/components/context-menu/ContextMenu';
@@ -81,8 +86,8 @@ export { CanvasPopup } from './views/components/popup/CanvasPopup';
81
86
  export { CanvasFloatDomService, type IFloatDomLayout } from './services/dom/canvas-dom-layer.service';
82
87
  export { FloatDom } from './views/components/dom/FloatDom';
83
88
  export { MobileContextMenu } from './views/components/context-menu/MobileContextMenu';
84
- export { Toolbar } from './views/components/doc-bars/Toolbar';
85
- export { ToolbarItem } from './views/components/doc-bars/ToolbarItem';
86
- export { ToolbarButton } from './views/components/doc-bars/Button/ToolbarButton';
89
+ export { Ribbon } from './views/components/ribbon/Ribbon';
90
+ export { ToolbarItem } from './views/components/ribbon/ToolbarItem';
91
+ export { ToolbarButton } from './views/components/ribbon/Button/ToolbarButton';
87
92
  export { ToggleShortcutPanelOperation } from './commands/operations/toggle-shortcut-panel.operation';
88
93
  export { SetEditorResizeOperation } from './commands/operations/editor/set-editor-resize.operation';
@@ -14,15 +14,15 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  declare const locale: {
17
- uiToolbar: {
17
+ ribbon: {
18
18
  start: string;
19
19
  insert: string;
20
20
  formulas: string;
21
21
  data: string;
22
22
  view: string;
23
23
  others: string;
24
+ more: string;
24
25
  };
25
- more: string;
26
26
  fontFamily: {
27
27
  TimesNewRoman: string;
28
28
  Arial: string;
@@ -1,11 +1,11 @@
1
1
  import { Injector, Plugin } from '@univerjs/core';
2
- import { IUniverUIConfig } from './controllers/ui/ui.controller';
2
+ import { IUniverUIConfig } from './controllers/config.schema';
3
3
  export declare const UNIVER_MOBILE_UI_PLUGIN_NAME = "UNIVER_MOBILE_UI_PLUGIN";
4
4
  /**
5
5
  * @ignore
6
6
  */
7
7
  export declare class UniverMobileUIPlugin extends Plugin {
8
- private _config;
8
+ private readonly _config;
9
9
  protected readonly _injector: Injector;
10
10
  static pluginName: string;
11
11
  constructor(_config: IUniverUIConfig, _injector: Injector);
@@ -0,0 +1,44 @@
1
+ import { IAccessor, Disposable, IConfigService, Injector } from '@univerjs/core';
2
+ import { Observable, Subject } from 'rxjs';
3
+ import { IMenuItem } from '../menu/menu';
4
+ export declare const IMenuManagerService: import('@univerjs/core').IdentifierDecorator<IMenuManagerService>;
5
+ export interface IMenuSchema {
6
+ key: string;
7
+ order: number;
8
+ item?: IMenuItem;
9
+ children?: IMenuSchema[];
10
+ }
11
+ export interface IMenuManagerService {
12
+ readonly menuChanged$: Observable<void>;
13
+ mergeMenu(source: MenuSchemaType, target?: MenuSchemaType): void;
14
+ appendRootMenu(source: MenuSchemaType): void;
15
+ getMenuByPositionKey(position: string): IMenuSchema[];
16
+ }
17
+ export type MenuSchemaType = {
18
+ order?: number;
19
+ menuItemFactory?: (accessor: IAccessor) => IMenuItem;
20
+ } | {
21
+ [key: string]: MenuSchemaType;
22
+ };
23
+ export declare class MenuManagerService extends Disposable implements IMenuManagerService {
24
+ private readonly _injector;
25
+ private readonly _configService;
26
+ readonly menuChanged$: Subject<void>;
27
+ private _menu;
28
+ constructor(_injector: Injector, _configService: IConfigService);
29
+ dispose(): void;
30
+ /**
31
+ * Merge source menu to target menu recursively
32
+ * @param source
33
+ * @param target default is root menu
34
+ */
35
+ mergeMenu(source: MenuSchemaType, target?: MenuSchemaType): void;
36
+ appendRootMenu(source: MenuSchemaType): void;
37
+ private _buildMenuSchema;
38
+ /**
39
+ * Get menu schema by position key
40
+ * @param key
41
+ * @returns Menu schema array or empty array if not found
42
+ */
43
+ getMenuByPositionKey(key: string): IMenuSchema[];
44
+ }
@@ -1,17 +1,19 @@
1
1
  import { IAccessor } from '@univerjs/core';
2
2
  import { Observable } from 'rxjs';
3
3
  export type OneOrMany<T> = T | T[];
4
+ /** @deprecated */
4
5
  export declare enum MenuPosition {
5
6
  VOID = "void",
6
- TOOLBAR_START = "uiToolbar.start",
7
- TOOLBAR_INSERT = "uiToolbar.insert",
8
- TOOLBAR_FORMULAS = "uiToolbar.formulas",
9
- TOOLBAR_DATA = "uiToolbar.data",
10
- TOOLBAR_VIEW = "uiToolbar.view",
11
- TOOLBAR_OTHERS = "uiToolbar.others",
12
- CONTEXT_MENU = "contextMenu",
7
+ TOOLBAR_START = "ribbon.start",
8
+ TOOLBAR_INSERT = "ribbon.insert",
9
+ TOOLBAR_FORMULAS = "ribbon.formulas",
10
+ TOOLBAR_DATA = "ribbon.data",
11
+ TOOLBAR_VIEW = "ribbon.view",
12
+ TOOLBAR_OTHERS = "ribbon.others",
13
+ CONTEXT_MENU = "contextMenu.mainArea",
13
14
  FOOTER = "footer"
14
15
  }
16
+ /** @deprecated */
15
17
  export declare enum MenuGroup {
16
18
  TOOLBAR_HISTORY = 0,
17
19
  TOOLBAR_FORMAT = 1,
@@ -53,7 +55,7 @@ interface IMenuItemBase<V> {
53
55
  group?: MenuGroup;
54
56
  /** In what menu should the item display. */
55
57
  /** @deprecated positions will be removed in the future. */
56
- positions: OneOrMany<MenuPosition | string>;
58
+ positions?: OneOrMany<MenuPosition | string>;
57
59
  type: MenuItemType;
58
60
  /**
59
61
  * Custom label component id.
@@ -108,7 +110,7 @@ export interface IMenuSelectorItem<V = MenuItemDefaultValueType, T = undefined>
108
110
  }
109
111
  export declare function isMenuSelectorItem<T extends MenuItemDefaultValueType>(v: IMenuItem): v is IMenuSelectorItem<T>;
110
112
  export type MenuItemDefaultValueType = string | number | undefined;
111
- export type IMenuItem = IMenuButtonItem<MenuItemDefaultValueType> | IMenuSelectorItem<MenuItemDefaultValueType>;
113
+ export type IMenuItem = IMenuButtonItem<MenuItemDefaultValueType> | IMenuSelectorItem<MenuItemDefaultValueType, any>;
112
114
  export type IDisplayMenuItem<T extends IMenuItem> = T & {
113
115
  shortcut?: string;
114
116
  };
@@ -1,10 +1,13 @@
1
- import { Disposable, IDisposable } from '@univerjs/core';
1
+ import { Disposable, ILogService, IDisposable } from '@univerjs/core';
2
2
  import { Observable } from 'rxjs';
3
3
  import { IShortcutService } from '../shortcut/shortcut.service';
4
4
  import { IDisplayMenuItem, IMenuItem, MenuConfig, MenuPosition } from './menu';
5
+ import { IMenuManagerService } from './menu-manager.service';
6
+ /** @deprecated */
5
7
  export declare const IMenuService: import('@univerjs/core').IdentifierDecorator<IMenuService>;
6
8
  /**
7
9
  * Breaking changes to IMenuService are expected in the next version. Use with caution. by @jikkai
10
+ * @deprecated
8
11
  */
9
12
  export interface IMenuService {
10
13
  menuChanged$: Observable<void>;
@@ -18,8 +21,11 @@ export interface IMenuService {
18
21
  /** @deprecated */
19
22
  getMenuItem(id: string): IMenuItem | null;
20
23
  }
24
+ /** @deprecated */
21
25
  export declare class MenuService extends Disposable implements IMenuService {
22
26
  private readonly _shortcutService;
27
+ private readonly _menuManagerService;
28
+ protected readonly _logService: ILogService;
23
29
  /** @deprecated */
24
30
  private readonly _menuItemMap;
25
31
  /** @deprecated */
@@ -28,7 +34,7 @@ export declare class MenuService extends Disposable implements IMenuService {
28
34
  private readonly _menuConfigs;
29
35
  private _menuChanged$;
30
36
  menuChanged$: Observable<void>;
31
- constructor(_shortcutService: IShortcutService);
37
+ constructor(_shortcutService: IShortcutService, _menuManagerService: IMenuManagerService, _logService: ILogService);
32
38
  dispose(): void;
33
39
  /** @deprecated */
34
40
  addMenuItem(item: IMenuItem, config: MenuConfig): IDisposable;
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export declare enum MenuManagerPosition {
17
+ RIBBON = "ribbon",
18
+ CONTEXT_MENU = "contextMenu"
19
+ }
20
+ export declare enum RibbonPosition {
21
+ START = "ribbon.start",
22
+ INSERT = "ribbon.insert",
23
+ FORMULAS = "ribbon.formulas",
24
+ DATA = "ribbon.data",
25
+ VIEW = "ribbon.view",
26
+ OTHERS = "ribbon.others"
27
+ }
28
+ export declare enum RibbonStartGroup {
29
+ HISTORY = "ribbon.start.history",
30
+ FORMAT = "ribbon.start.format",
31
+ LAYOUT = "ribbon.start.layout",
32
+ FORMULAS_INSERT = "ribbon.start.insert",
33
+ FORMULAS_VIEW = "ribbon.start.view",
34
+ FILE = "ribbon.start.file",
35
+ OTHERS = "ribbon.start.others"
36
+ }
37
+ export declare enum RibbonInsertGroup {
38
+ OTHERS = "ribbon.insert.others"
39
+ }
40
+ export declare enum RibbonFormulasGroup {
41
+ OTHERS = "ribbon.formulas.others"
42
+ }
43
+ export declare enum RibbonDataGroup {
44
+ OTHERS = "ribbon.data.others"
45
+ }
46
+ export declare enum RibbonViewGroup {
47
+ OTHERS = "ribbon.view.others"
48
+ }
49
+ export declare enum RibbonOthersGroup {
50
+ OTHERS = "ribbon.others.others"
51
+ }
52
+ export declare enum ContextMenuPosition {
53
+ MAIN_AREA = "contextMenu.mainArea",
54
+ COL_HEADER = "contextMenu.colHeader",
55
+ ROW_HEADER = "contextMenu.rowHeader",
56
+ FOOTER_TABS = "contextMenu.footerTabs",
57
+ FOOTER_MENU = "contextMenu.footerMenu"
58
+ }
59
+ export declare enum ContextMenuGroup {
60
+ FORMAT = "contextMenu.format",
61
+ LAYOUT = "contextMenu.layout",
62
+ DATA = "contextMenu.data",
63
+ OTHERS = "contextMenu.others"
64
+ }
@@ -1,15 +1,16 @@
1
- import { IContextService, Injector, Plugin } from '@univerjs/core';
2
- import { IUniverUIConfig } from './controllers/ui/ui.controller';
1
+ import { IConfigService, IContextService, Injector, Plugin } from '@univerjs/core';
2
+ import { IUniverUIConfig } from './controllers/config.schema';
3
3
  export declare const UNIVER_UI_PLUGIN_NAME = "UNIVER_UI_PLUGIN";
4
4
  export declare const DISABLE_AUTO_FOCUS_KEY = "DISABLE_AUTO_FOCUS";
5
5
  /**
6
6
  * UI plugin provides basic interaction with users. Including workbench (menus, UI parts, notifications etc.), copy paste, shortcut.
7
7
  */
8
8
  export declare class UniverUIPlugin extends Plugin {
9
- private _config;
9
+ private readonly _config;
10
10
  private readonly _contextService;
11
11
  protected readonly _injector: Injector;
12
+ private readonly _configService;
12
13
  static pluginName: string;
13
- constructor(_config: Partial<IUniverUIConfig>, _contextService: IContextService, _injector: Injector);
14
+ constructor(_config: Partial<IUniverUIConfig>, _contextService: IContextService, _injector: Injector, _configService: IConfigService);
14
15
  onStarting(): void;
15
16
  }
@@ -0,0 +1,6 @@
1
+ import { ComponentType, default as React } from 'react';
2
+ interface IRibbonProps {
3
+ headerMenuComponents?: Set<ComponentType>;
4
+ }
5
+ export declare function Ribbon(props: IRibbonProps): React.JSX.Element;
6
+ export {};
@@ -1,3 +1,6 @@
1
+ import { IDropdownProps } from '@univerjs/design';
1
2
  import { default as React } from 'react';
2
3
  import { IDisplayMenuItem, IMenuItem } from '../../../services/menu/menu';
3
- export declare const ToolbarItem: React.ForwardRefExoticComponent<IDisplayMenuItem<IMenuItem> & React.RefAttributes<any>>;
4
+ export declare const ToolbarItem: React.ForwardRefExoticComponent<(IDisplayMenuItem<IMenuItem> & {
5
+ align?: IDropdownProps["align"];
6
+ }) & React.RefAttributes<any>>;
@@ -0,0 +1,4 @@
1
+ import { IDropdownProps, ITooltipProps, NullableTooltipRef } from '@univerjs/design';
2
+ import { default as React } from 'react';
3
+ export declare const TooltipWrapper: React.ForwardRefExoticComponent<ITooltipProps & React.RefAttributes<NullableTooltipRef>>;
4
+ export declare function DropdownWrapper(props: IDropdownProps): React.JSX.Element;
@@ -33,12 +33,4 @@ export interface IToolbarItemStatus {
33
33
  * @returns The menu item's status
34
34
  */
35
35
  export declare function useToolbarItemStatus(menuItem: IDisplayMenuItem<IMenuItem>): IToolbarItemStatus;
36
- export declare function useToolbarCollapseObserver(visibleItems: IToolbarRenderHookHandler['visibleItems']): {
37
- toolbarRef: import('react').RefObject<HTMLDivElement>;
38
- toolbarItemRefs: import('react').MutableRefObject<Record<string, {
39
- el: HTMLDivElement;
40
- key: string;
41
- }>>;
42
- collapsedId: string[];
43
- };
44
36
  export {};