@univerjs/ui 0.2.8 → 0.2.9

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.
@@ -59,7 +59,7 @@ export { IEditorService, EditorService, Editor } from './services/editor/editor.
59
59
  export { TextEditor } from './components/editor/TextEditor';
60
60
  export { RangeSelector } from './components/range-selector/RangeSelector';
61
61
  export { ProgressBar } from './components/progress-bar/ProgressBar';
62
- export { type IMenuGroup, useToolbarGroups, useToolbarItemStatus, useToolbarCollapseObserver } from './views/components/doc-bars/hook';
62
+ export { type IMenuGroup, useSimpleToolbarGroups, useToolbarGroups, useToolbarItemStatus, useToolbarCollapseObserver } from './views/components/doc-bars/hook';
63
63
  export { mergeMenuConfigs } from './common/menu-merge-configs';
64
64
  export { ShortcutPanelController } from './controllers/shortcut-display/shortcut-panel.controller';
65
65
  export { ShortcutPanelService } from './services/shortcut/shortcut-panel.service';
@@ -19,6 +19,7 @@ export interface IFloatDom {
19
19
  onWheel: (evt: WheelEvent) => void;
20
20
  props?: Record<string, any>;
21
21
  data?: Serializable;
22
+ unitId: string;
22
23
  }
23
24
  export declare class CanvasFloatDomService {
24
25
  private _domLayerMap;
@@ -9,7 +9,8 @@ export declare enum MenuPosition {
9
9
  TOOLBAR_DATA = "uiToolbar.data",
10
10
  TOOLBAR_VIEW = "uiToolbar.view",
11
11
  TOOLBAR_OTHERS = "uiToolbar.others",
12
- CONTEXT_MENU = "contextMenu"
12
+ CONTEXT_MENU = "contextMenu",
13
+ FOOTER = "footer"
13
14
  }
14
15
  export declare enum MenuGroup {
15
16
  TOOLBAR_HISTORY = 0,
@@ -48,8 +49,10 @@ interface IMenuItemBase<V> {
48
49
  icon?: string | Observable<string>;
49
50
  tooltip?: string;
50
51
  /** The group that the item belongs to. */
52
+ /** @deprecated group will be removed in the future. */
51
53
  group?: MenuGroup;
52
54
  /** In what menu should the item display. */
55
+ /** @deprecated positions will be removed in the future. */
53
56
  positions: OneOrMany<MenuPosition | string>;
54
57
  type: MenuItemType;
55
58
  /**
@@ -92,6 +95,12 @@ export interface ICustomComponentProps<T> {
92
95
  }
93
96
  export interface IMenuSelectorItem<V = MenuItemDefaultValueType, T = undefined> extends IMenuItemBase<V> {
94
97
  type: MenuItemType.SELECTOR | MenuItemType.BUTTON_SELECTOR | MenuItemType.SUBITEMS;
98
+ /**
99
+ * If this property is set, changing the value of the selection will trigger the command with this id,
100
+ * instead of {@link IMenuItemBase.id} or {@link IMenuItemBase.commandId}. At the same title,
101
+ * clicking the button will trigger IMenuItemBase.id or IMenuItemBase.commandId.
102
+ */
103
+ selectionsCommandId?: string;
95
104
  /** Options or IDs of registered components. */
96
105
  selections?: Array<IValueOption<T>> | Observable<Array<IValueOption<T>>>;
97
106
  /** If `type` is `MenuItemType.BUTTON_SELECTOR`, this determines if the button is activated. */
@@ -3,30 +3,49 @@ import { Observable } from 'rxjs';
3
3
  import { IShortcutService } from '../shortcut/shortcut.service';
4
4
  import { IDisplayMenuItem, IMenuItem, MenuConfig, MenuPosition } from './menu';
5
5
  export declare const IMenuService: import('@univerjs/core').IdentifierDecorator<IMenuService>;
6
+ /**
7
+ * Breaking changes to IMenuService are expected in the next version. Use with caution. by @jikkai
8
+ */
6
9
  export interface IMenuService {
7
10
  menuChanged$: Observable<void>;
11
+ /** @deprecated */
8
12
  addMenuItem(item: IMenuItem, config: MenuConfig): IDisposable;
13
+ /** @deprecated */
9
14
  setMenuItem(item: IMenuItem): void;
10
15
  /** Get menu items for display at a given position or a submenu. */
16
+ /** @deprecated */
11
17
  getMenuItems(position: MenuPosition | string): Array<IDisplayMenuItem<IMenuItem>>;
18
+ /** @deprecated */
12
19
  getMenuItem(id: string): IMenuItem | null;
13
20
  }
14
21
  export declare class MenuService extends Disposable implements IMenuService {
15
22
  private readonly _shortcutService;
23
+ /** @deprecated */
16
24
  private readonly _menuItemMap;
25
+ /** @deprecated */
17
26
  private readonly _menuByPositions;
27
+ /** @deprecated */
18
28
  private readonly _menuConfigs;
19
29
  private _menuChanged$;
20
30
  menuChanged$: Observable<void>;
21
31
  constructor(_shortcutService: IShortcutService);
22
32
  dispose(): void;
33
+ /** @deprecated */
23
34
  addMenuItem(item: IMenuItem, config: MenuConfig): IDisposable;
35
+ /** @deprecated */
24
36
  getMenuItems(positions: MenuPosition | string): Array<IDisplayMenuItem<IMenuItem>>;
37
+ /** @deprecated */
25
38
  setMenuItem(item: IMenuItem): void;
39
+ /** @deprecated */
26
40
  getMenuItem(id: string): IMenuItem | null;
41
+ /** @deprecated */
27
42
  setMenuConfigs(id: string, config: MenuConfig): void;
43
+ /** @deprecated */
28
44
  getMenuConfig(id: string): MenuConfig | null;
45
+ /** @deprecated */
29
46
  private _getDisplayMenuItems;
47
+ /** @deprecated */
30
48
  private _appendMenuToPosition;
49
+ /** @deprecated */
31
50
  private _updateMenuItems;
32
51
  }
@@ -10,7 +10,8 @@ export declare enum BuiltInUIPart {
10
10
  CONTENT = "content",
11
11
  FOOTER = "footer",
12
12
  LEFT_SIDEBAR = "left-sidebar",
13
- FLOATING = "floating"
13
+ FLOATING = "floating",
14
+ UNIT = "unit"
14
15
  }
15
16
  export interface IUIPartsService {
16
17
  componentRegistered$: Observable<ComponentPartKey>;
@@ -1,9 +1,9 @@
1
- import { Disposable } from '@univerjs/core';
1
+ import { Nullable, Disposable } from '@univerjs/core';
2
2
  import { IRectPopupProps } from '@univerjs/design';
3
3
  import { IBoundRectNoAngle } from '@univerjs/engine-render';
4
4
  import { Observable } from 'rxjs';
5
5
  export interface IPopup extends Pick<IRectPopupProps, 'closeOnSelfTarget' | 'direction' | 'excludeOutside' | 'onClickOutside'> {
6
- anchorRect: IBoundRectNoAngle;
6
+ anchorRect: Nullable<IBoundRectNoAngle>;
7
7
  anchorRect$: Observable<IBoundRectNoAngle>;
8
8
  excludeRects?: IBoundRectNoAngle[];
9
9
  excludeRects$?: Observable<IBoundRectNoAngle[]>;
@@ -14,6 +14,7 @@ export interface IToolbarRenderHookHandler {
14
14
  groups: IMenuGroup[];
15
15
  groupsByKey: Record<MenuGroup, Array<IDisplayMenuItem<IMenuItem>>>;
16
16
  }
17
+ export declare function useSimpleToolbarGroups(category: MenuPositionWithCustom): IDisplayMenuItem<IMenuItem>[];
17
18
  /**
18
19
  * If your custom toolbar component need to render menu items by their category,
19
20
  * you can use this hook to get the toolbar status.
@@ -1,2 +1,4 @@
1
1
  import { default as React } from 'react';
2
- export declare const FloatDom: () => React.JSX.Element;
2
+ export declare const FloatDom: ({ unitId }: {
3
+ unitId?: string;
4
+ }) => React.JSX.Element[] | undefined;