@univerjs/ui 0.1.10 → 0.1.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.
- package/lib/cjs/index.js +14 -14
- package/lib/es/index.js +6081 -5836
- package/lib/index.css +1 -1
- package/lib/types/common/component-manager.d.ts +2 -2
- package/lib/types/common/menu-hidden-observable.d.ts +2 -2
- package/lib/types/common/menu-merge-configs.d.ts +3 -0
- package/lib/types/components/custom-label/CustomLabel.d.ts +2 -2
- package/lib/types/components/editor/TextEditor.d.ts +2 -2
- package/lib/types/components/font-family/FontFamily.d.ts +1 -1
- package/lib/types/components/font-family/FontFamilyItem.d.ts +1 -1
- package/lib/types/components/font-size/FontSize.d.ts +1 -1
- package/lib/types/components/font-size/interface.d.ts +1 -1
- package/lib/types/components/hooks/layout.d.ts +14 -0
- package/lib/types/components/hooks/observable.d.ts +2 -2
- package/lib/types/components/menu/Menu.d.ts +6 -1
- package/lib/types/components/notification/Notification.d.ts +6 -6
- package/lib/types/components/notification/Notification.stories.d.ts +2 -2
- package/lib/types/components/progress-bar/ProgressBar.d.ts +4 -1
- package/lib/types/components/range-selector/RangeSelector.d.ts +1 -1
- package/lib/types/controllers/error/error.controller.d.ts +1 -1
- package/lib/types/controllers/menus/menus.d.ts +1 -1
- package/lib/types/controllers/shared-shortcut.controller.d.ts +6 -4
- package/lib/types/controllers/shortcut-display/menu.d.ts +1 -1
- package/lib/types/controllers/shortcut-display/shortcut-panel.controller.d.ts +7 -5
- package/lib/types/controllers/ui/ui-desktop.controller.d.ts +5 -24
- package/lib/types/controllers/ui/ui.controller.d.ts +10 -15
- package/lib/types/index.d.ts +13 -6
- package/lib/types/locale/index.d.ts +1 -0
- package/lib/types/locale/ru-RU.d.ts +4 -0
- package/lib/types/services/before-close/before-close.service.d.ts +1 -1
- package/lib/types/services/clipboard/clipboard-interface.service.d.ts +1 -1
- package/lib/types/services/confirm/confirm.service.d.ts +2 -2
- package/lib/types/services/confirm/desktop-confirm.service.d.ts +10 -4
- package/lib/types/services/contextmenu/contextmenu.service.d.ts +2 -2
- package/lib/types/services/dialog/desktop-dialog.service.d.ts +12 -7
- package/lib/types/services/dialog/dialog.service.d.ts +2 -2
- package/lib/types/services/editor/editor.service.d.ts +4 -4
- package/lib/types/services/global-zone/desktop-global-zone.service.d.ts +4 -4
- package/lib/types/services/global-zone/global-zone.service.d.ts +1 -1
- package/lib/types/services/layout/layout.service.d.ts +4 -2
- package/lib/types/services/menu/menu.d.ts +9 -3
- package/lib/types/services/menu/menu.service.d.ts +11 -6
- package/lib/types/services/message/__testing__/mock-message.service.d.ts +2 -2
- package/lib/types/services/message/desktop-message.service.d.ts +2 -2
- package/lib/types/services/message/message.service.d.ts +1 -1
- package/lib/types/services/notification/desktop-notification.service.d.ts +10 -4
- package/lib/types/services/notification/notification.service.d.ts +2 -2
- package/lib/types/services/parts/parts.service.d.ts +30 -0
- package/lib/types/services/popup/canvas-popup.service.d.ts +10 -11
- package/lib/types/services/progress/progress.service.d.ts +2 -2
- package/lib/types/services/range-selector/range-selector.service.d.ts +2 -2
- package/lib/types/services/shortcut/shortcut.service.d.ts +4 -4
- package/lib/types/services/sidebar/desktop-sidebar.service.d.ts +3 -4
- package/lib/types/services/sidebar/sidebar.service.d.ts +2 -3
- package/lib/types/services/zen-zone/desktop-zen-zone.service.d.ts +6 -4
- package/lib/types/services/zen-zone/zen-zone.service.d.ts +2 -1
- package/lib/types/ui-plugin.d.ts +4 -7
- package/lib/types/views/App.d.ts +1 -6
- package/lib/types/views/components/confirm-part/interface.d.ts +1 -1
- package/lib/types/views/components/dialog-part/interface.d.ts +1 -1
- package/lib/types/views/components/doc-bars/Toolbar.d.ts +3 -2
- package/lib/types/views/components/doc-bars/ToolbarItem.d.ts +1 -1
- package/lib/types/views/components/doc-bars/hook.d.ts +44 -0
- package/lib/types/views/parts.d.ts +1 -1
- package/lib/umd/index.js +14 -14
- package/package.json +18 -18
- package/lib/types/views/hooks/active.d.ts +0 -10
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ContextService, Nullable, Disposable, ILogService, IUniverInstanceService, UniverInstanceType } from '@univerjs/core';
|
|
2
2
|
import { IDisposable } from '@wendellhu/redi';
|
|
3
|
-
import {
|
|
3
|
+
import { IEditorService } from '../editor/editor.service';
|
|
4
4
|
|
|
5
5
|
type FocusHandlerFn = (unitId: string) => void;
|
|
6
6
|
export declare const FOCUSING_UNIVER = "FOCUSING_UNIVER";
|
|
7
7
|
export interface ILayoutService {
|
|
8
8
|
readonly isFocused: boolean;
|
|
9
|
+
get rootContainerElement(): Nullable<HTMLElement>;
|
|
9
10
|
/** Re-focus the currently focused Univer business instance. */
|
|
10
11
|
focus(): void;
|
|
11
12
|
/** Register a focus handler to focus on certain type of Univer unit. */
|
|
@@ -36,6 +37,7 @@ export declare class DesktopLayoutService extends Disposable implements ILayoutS
|
|
|
36
37
|
private _canvasContainers;
|
|
37
38
|
private _allContainers;
|
|
38
39
|
constructor(_contextService: ContextService, _univerInstanceService: IUniverInstanceService, _logService: ILogService, _editorService: IEditorService);
|
|
40
|
+
get rootContainerElement(): Nullable<HTMLElement>;
|
|
39
41
|
focus(): void;
|
|
40
42
|
registerFocusHandler(type: UniverInstanceType, handler: FocusHandlerFn): IDisposable;
|
|
41
43
|
registerCanvasElement(container: HTMLCanvasElement): IDisposable;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Observable } from 'rxjs';
|
|
2
1
|
import { IAccessor } from '@wendellhu/redi';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
3
|
|
|
4
4
|
export type OneOrMany<T> = T | T[];
|
|
5
5
|
export declare enum MenuPosition {
|
|
@@ -94,9 +94,15 @@ export interface IMenuSelectorItem<V = MenuItemDefaultValueType, T = undefined>
|
|
|
94
94
|
}
|
|
95
95
|
export declare function isMenuSelectorItem<T extends MenuItemDefaultValueType>(v: IMenuItem): v is IMenuSelectorItem<T>;
|
|
96
96
|
export type MenuItemDefaultValueType = string | number | undefined;
|
|
97
|
-
export type IMenuItem = IMenuButtonItem | IMenuSelectorItem<MenuItemDefaultValueType>;
|
|
97
|
+
export type IMenuItem = IMenuButtonItem<MenuItemDefaultValueType> | IMenuSelectorItem<MenuItemDefaultValueType>;
|
|
98
98
|
export type IDisplayMenuItem<T extends IMenuItem> = T & {
|
|
99
99
|
shortcut?: string;
|
|
100
100
|
};
|
|
101
|
-
export type
|
|
101
|
+
export type MenuItemConfig<T extends MenuItemDefaultValueType = MenuItemDefaultValueType> = Partial<Omit<IMenuItem, 'id' | 'subId' | 'value$' | 'hidden$' | 'disabled$' | 'activated$' | 'icon$'> & {
|
|
102
|
+
hidden?: boolean;
|
|
103
|
+
disabled?: boolean;
|
|
104
|
+
activated?: boolean;
|
|
105
|
+
}>;
|
|
106
|
+
export type MenuConfig<T extends MenuItemDefaultValueType = MenuItemDefaultValueType> = Record<string, MenuItemConfig<T>>;
|
|
107
|
+
export type IMenuItemFactory = (accessor: IAccessor, menuConfig?: MenuConfig<MenuItemDefaultValueType>) => IMenuItem;
|
|
102
108
|
export {};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { IDisplayMenuItem, IMenuItem, MenuPosition } from './menu';
|
|
2
|
-
import { IShortcutService } from '../shortcut/shortcut.service';
|
|
3
|
-
import { Observable } from 'rxjs';
|
|
4
|
-
import { IDisposable } from '@wendellhu/redi';
|
|
5
1
|
import { Disposable } from '@univerjs/core';
|
|
2
|
+
import { IDisposable } from '@wendellhu/redi';
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
4
|
+
import { IShortcutService } from '../shortcut/shortcut.service';
|
|
5
|
+
import { IDisplayMenuItem, IMenuItem, MenuConfig, MenuPosition } from './menu';
|
|
6
6
|
|
|
7
7
|
export declare const IMenuService: import('@wendellhu/redi').IdentifierDecorator<IMenuService>;
|
|
8
8
|
export interface IMenuService {
|
|
9
9
|
menuChanged$: Observable<void>;
|
|
10
|
-
addMenuItem(item: IMenuItem): IDisposable;
|
|
10
|
+
addMenuItem(item: IMenuItem, config: MenuConfig): IDisposable;
|
|
11
|
+
setMenuItem(item: IMenuItem): void;
|
|
11
12
|
/** Get menu items for display at a given position or a submenu. */
|
|
12
13
|
getMenuItems(position: MenuPosition | string): Array<IDisplayMenuItem<IMenuItem>>;
|
|
13
14
|
getMenuItem(id: string): IMenuItem | null;
|
|
@@ -16,13 +17,17 @@ export declare class DesktopMenuService extends Disposable implements IMenuServi
|
|
|
16
17
|
private readonly _shortcutService;
|
|
17
18
|
private readonly _menuItemMap;
|
|
18
19
|
private readonly _menuByPositions;
|
|
20
|
+
private readonly _menuConfigs;
|
|
19
21
|
private _menuChanged$;
|
|
20
22
|
menuChanged$: Observable<void>;
|
|
21
23
|
constructor(_shortcutService: IShortcutService);
|
|
22
24
|
dispose(): void;
|
|
23
|
-
addMenuItem(item: IMenuItem): IDisposable;
|
|
25
|
+
addMenuItem(item: IMenuItem, config: MenuConfig): IDisposable;
|
|
24
26
|
getMenuItems(positions: MenuPosition | string): Array<IDisplayMenuItem<IMenuItem>>;
|
|
27
|
+
setMenuItem(item: IMenuItem): void;
|
|
25
28
|
getMenuItem(id: string): IMenuItem | null;
|
|
29
|
+
setMenuConfigs(id: string, config: MenuConfig): void;
|
|
30
|
+
getMenuConfig(id: string): MenuConfig | null;
|
|
26
31
|
private _getDisplayMenuItems;
|
|
27
32
|
private _appendMenuToPosition;
|
|
28
33
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { IMessageService } from '../message.service';
|
|
2
|
-
import { IDisposable } from '@wendellhu/redi';
|
|
3
1
|
import { IMessageMethodOptions, IMessageProps } from '@univerjs/design';
|
|
2
|
+
import { IDisposable } from '@wendellhu/redi';
|
|
3
|
+
import { IMessageService } from '../message.service';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* This is a mocked message service for testing purposes.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { IMessageService } from './message.service';
|
|
2
|
-
import { IDisposable } from '@wendellhu/redi';
|
|
3
1
|
import { IMessageMethodOptions, IMessageProps, Message } from '@univerjs/design';
|
|
2
|
+
import { IDisposable } from '@wendellhu/redi';
|
|
3
|
+
import { IMessageService } from './message.service';
|
|
4
4
|
|
|
5
5
|
export declare class DesktopMessageService implements IMessageService {
|
|
6
6
|
portalContainer: HTMLElement;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IDisposable } from '@wendellhu/redi';
|
|
2
1
|
import { IMessageMethodOptions, IMessageProps } from '@univerjs/design';
|
|
2
|
+
import { IDisposable } from '@wendellhu/redi';
|
|
3
3
|
|
|
4
4
|
export declare const IMessageService: import('@wendellhu/redi').IdentifierDecorator<IMessageService>;
|
|
5
5
|
export interface IMessageService {
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
+
import { Disposable } from '@univerjs/core';
|
|
2
|
+
import { IDisposable, Injector } from '@wendellhu/redi';
|
|
3
|
+
import { INotificationOptions } from '../../components/notification/Notification';
|
|
4
|
+
import { IUIPartsService } from '../parts/parts.service';
|
|
1
5
|
import { INotificationService } from './notification.service';
|
|
2
|
-
import { INotificationMethodOptions } from '../../components/notification/Notification';
|
|
3
|
-
import { IDisposable } from '@wendellhu/redi';
|
|
4
6
|
|
|
5
|
-
export declare class DesktopNotificationService implements INotificationService {
|
|
6
|
-
|
|
7
|
+
export declare class DesktopNotificationService extends Disposable implements INotificationService {
|
|
8
|
+
private readonly _injector;
|
|
9
|
+
private readonly _uiPartsService;
|
|
10
|
+
constructor(_injector: Injector, _uiPartsService: IUIPartsService);
|
|
11
|
+
show(params: INotificationOptions): IDisposable;
|
|
12
|
+
protected _initUIPart(): void;
|
|
7
13
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { INotificationMethodOptions } from '../../components/notification/Notification';
|
|
2
1
|
import { IDisposable } from '@wendellhu/redi';
|
|
2
|
+
import { INotificationOptions } from '../../components/notification/Notification';
|
|
3
3
|
|
|
4
4
|
export declare const INotificationService: import('@wendellhu/redi').IdentifierDecorator<INotificationService>;
|
|
5
5
|
export interface INotificationService {
|
|
6
|
-
show(params:
|
|
6
|
+
show(params: INotificationOptions): IDisposable;
|
|
7
7
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { IDisposable } from '@wendellhu/redi';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { Disposable } from '@univerjs/core';
|
|
4
|
+
import { ComponentType } from '../../common/component-manager';
|
|
5
|
+
|
|
6
|
+
type ComponentRenderer = () => ComponentType;
|
|
7
|
+
type ComponentPartKey = BuiltInUIPart | string;
|
|
8
|
+
export declare enum BuiltInUIPart {
|
|
9
|
+
GLOBAL = "global",
|
|
10
|
+
HEADER = "header",
|
|
11
|
+
HEADER_MENU = "header-menu",
|
|
12
|
+
CONTENT = "content",
|
|
13
|
+
FOOTER = "footer",
|
|
14
|
+
LEFT_SIDEBAR = "left-sidebar"
|
|
15
|
+
}
|
|
16
|
+
export interface IUIPartsService {
|
|
17
|
+
componentRegistered$: Observable<ComponentPartKey>;
|
|
18
|
+
registerComponent(part: ComponentPartKey, component: () => ComponentType): IDisposable;
|
|
19
|
+
getComponents(part: ComponentPartKey): Set<ComponentRenderer>;
|
|
20
|
+
}
|
|
21
|
+
export declare const IUIPartsService: import('@wendellhu/redi').IdentifierDecorator<IUIPartsService>;
|
|
22
|
+
export declare class UIPartsService extends Disposable implements IUIPartsService {
|
|
23
|
+
private _componentsByPart;
|
|
24
|
+
private readonly _componentRegistered$;
|
|
25
|
+
readonly componentRegistered$: Observable<string>;
|
|
26
|
+
dispose(): void;
|
|
27
|
+
registerComponent(part: ComponentPartKey, component: () => React.ComponentType): IDisposable;
|
|
28
|
+
getComponents(part: ComponentPartKey): Set<ComponentRenderer>;
|
|
29
|
+
}
|
|
30
|
+
export {};
|
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Disposable } from '@univerjs/core';
|
|
2
|
+
import { IRectPopupProps } from '@univerjs/design';
|
|
2
3
|
import { IBoundRectNoAngle } from '@univerjs/engine-render';
|
|
4
|
+
import { Observable } from 'rxjs';
|
|
3
5
|
|
|
4
|
-
export interface IPopup {
|
|
6
|
+
export interface IPopup extends Pick<IRectPopupProps, 'closeOnSelfTarget' | 'direction' | 'excludeOutside' | 'onClickOutside'> {
|
|
5
7
|
anchorRect: IBoundRectNoAngle;
|
|
6
8
|
anchorRect$: Observable<IBoundRectNoAngle>;
|
|
7
9
|
componentKey: string;
|
|
8
|
-
onClickOutside?: (e: MouseEvent) => void;
|
|
9
|
-
closeOnSelfTarget?: boolean;
|
|
10
|
-
excludeOutside?: HTMLElement[];
|
|
11
10
|
unitId: string;
|
|
12
11
|
subUnitId: string;
|
|
13
|
-
direction?: 'vertical' | 'horizontal';
|
|
14
12
|
offset?: [number, number];
|
|
15
13
|
}
|
|
16
14
|
export interface ICanvasPopupService {
|
|
@@ -21,12 +19,13 @@ export interface ICanvasPopupService {
|
|
|
21
19
|
get popups(): [string, IPopup][];
|
|
22
20
|
}
|
|
23
21
|
export declare const ICanvasPopupService: import('@wendellhu/redi').IdentifierDecorator<ICanvasPopupService>;
|
|
24
|
-
export declare class CanvasPopupService implements ICanvasPopupService {
|
|
25
|
-
private _popupMap;
|
|
26
|
-
private _popups$;
|
|
27
|
-
popups$: Observable<[string, IPopup][]>;
|
|
22
|
+
export declare class CanvasPopupService extends Disposable implements ICanvasPopupService {
|
|
23
|
+
private readonly _popupMap;
|
|
24
|
+
private readonly _popups$;
|
|
25
|
+
readonly popups$: Observable<[string, IPopup][]>;
|
|
28
26
|
get popups(): [string, IPopup][];
|
|
29
|
-
private
|
|
27
|
+
private _update;
|
|
28
|
+
dispose(): void;
|
|
30
29
|
addPopup(item: IPopup): string;
|
|
31
30
|
removePopup(id: string): void;
|
|
32
31
|
removeAll(): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Observable } from 'rxjs';
|
|
2
|
-
import { IDisposable } from '@wendellhu/redi';
|
|
3
1
|
import { Disposable } from '@univerjs/core';
|
|
2
|
+
import { IDisposable } from '@wendellhu/redi';
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
4
4
|
|
|
5
5
|
export interface IProgressCount {
|
|
6
6
|
count: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Observable } from 'rxjs';
|
|
2
|
-
import { IDisposable } from '@wendellhu/redi';
|
|
3
1
|
import { IUnitRange, Nullable, Disposable } from '@univerjs/core';
|
|
2
|
+
import { IDisposable } from '@wendellhu/redi';
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
4
4
|
|
|
5
5
|
export interface IRangeSelectorRange extends IUnitRange {
|
|
6
6
|
sheetName: string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { IPlatformService } from '../platform/platform.service';
|
|
2
|
-
import { ILayoutService } from '../layout/layout.service';
|
|
3
|
-
import { Observable } from 'rxjs';
|
|
4
|
-
import { IDisposable } from '@wendellhu/redi';
|
|
5
1
|
import { Disposable, ICommandService, IContextService } from '@univerjs/core';
|
|
2
|
+
import { IDisposable } from '@wendellhu/redi';
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
4
|
+
import { ILayoutService } from '../layout/layout.service';
|
|
5
|
+
import { IPlatformService } from '../platform/platform.service';
|
|
6
6
|
|
|
7
7
|
export interface IShortcutItem<P extends object = object> {
|
|
8
8
|
/** This should reuse the corresponding command's id. */
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { ISidebarService } from './sidebar.service';
|
|
2
|
-
import { ISidebarMethodOptions } from '../../views/components/sidebar/interface';
|
|
3
|
-
import { Subject } from 'rxjs';
|
|
4
1
|
import { IDisposable } from '@wendellhu/redi';
|
|
2
|
+
import { Subject } from 'rxjs';
|
|
3
|
+
import { ISidebarMethodOptions } from '../../views/components/sidebar/interface';
|
|
4
|
+
import { ISidebarService } from './sidebar.service';
|
|
5
5
|
|
|
6
6
|
export declare class DesktopSidebarService implements ISidebarService {
|
|
7
7
|
private _sidebarOptions;
|
|
8
8
|
readonly sidebarOptions$: Subject<ISidebarMethodOptions>;
|
|
9
9
|
open(params: ISidebarMethodOptions): IDisposable;
|
|
10
|
-
set(params: ISidebarMethodOptions): void;
|
|
11
10
|
close(): void;
|
|
12
11
|
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { ISidebarMethodOptions } from '../../views/components/sidebar/interface';
|
|
2
|
-
import { Subject } from 'rxjs';
|
|
3
1
|
import { IDisposable } from '@wendellhu/redi';
|
|
2
|
+
import { Subject } from 'rxjs';
|
|
3
|
+
import { ISidebarMethodOptions } from '../../views/components/sidebar/interface';
|
|
4
4
|
|
|
5
5
|
export declare const ISidebarService: import('@wendellhu/redi').IdentifierDecorator<ISidebarService>;
|
|
6
6
|
export interface ISidebarService {
|
|
7
7
|
readonly sidebarOptions$: Subject<ISidebarMethodOptions>;
|
|
8
8
|
open(params: ISidebarMethodOptions): IDisposable;
|
|
9
|
-
set(params: ISidebarMethodOptions): void;
|
|
10
9
|
close(): void;
|
|
11
10
|
}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { IZenZoneService } from './zen-zone.service';
|
|
2
|
-
import { ComponentManager } from '../../common/component-manager';
|
|
3
|
-
import { Subject } from 'rxjs';
|
|
4
|
-
import { ForwardRefExoticComponent } from 'react';
|
|
5
1
|
import { IDisposable } from '@wendellhu/redi';
|
|
2
|
+
import { ForwardRefExoticComponent } from 'react';
|
|
3
|
+
import { Subject } from 'rxjs';
|
|
4
|
+
import { ComponentManager } from '../../common/component-manager';
|
|
5
|
+
import { IZenZoneService } from './zen-zone.service';
|
|
6
6
|
|
|
7
7
|
export declare class DesktopZenZoneService implements IZenZoneService {
|
|
8
8
|
private readonly _componentManager;
|
|
9
9
|
readonly visible$: Subject<boolean>;
|
|
10
10
|
readonly componentKey$: Subject<string>;
|
|
11
|
+
private _visible;
|
|
12
|
+
get visible(): boolean;
|
|
11
13
|
constructor(_componentManager: ComponentManager);
|
|
12
14
|
set(key: string, component: ForwardRefExoticComponent<any>): IDisposable;
|
|
13
15
|
open(): void;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { Subject } from 'rxjs';
|
|
2
1
|
import { IDisposable } from '@wendellhu/redi';
|
|
2
|
+
import { Subject } from 'rxjs';
|
|
3
3
|
|
|
4
4
|
export declare const IZenZoneService: import('@wendellhu/redi').IdentifierDecorator<IZenZoneService>;
|
|
5
5
|
export interface IZenZoneService {
|
|
6
6
|
readonly visible$: Subject<boolean>;
|
|
7
7
|
readonly componentKey$: Subject<string>;
|
|
8
|
+
readonly visible: boolean;
|
|
8
9
|
set(key: string, component: any): IDisposable;
|
|
9
10
|
open(): void;
|
|
10
11
|
close(): void;
|
package/lib/types/ui-plugin.d.ts
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IContextService, LocaleService, Plugin } from '@univerjs/core';
|
|
2
2
|
import { Injector } from '@wendellhu/redi';
|
|
3
|
-
import {
|
|
3
|
+
import { IUniverUIConfig } from './controllers/ui/ui.controller';
|
|
4
4
|
|
|
5
|
-
export
|
|
6
|
-
/** Disable auto focus when Univer bootstraps. */
|
|
7
|
-
disableAutoFocus?: true;
|
|
8
|
-
override?: DependencyOverride;
|
|
9
|
-
}
|
|
5
|
+
export declare const DefaultUiConfig: {};
|
|
10
6
|
export declare const DISABLE_AUTO_FOCUS_KEY = "DISABLE_AUTO_FOCUS";
|
|
11
7
|
/**
|
|
12
8
|
* UI plugin provides basic interaction with users. Including workbench (menus, UI parts, notifications etc.), copy paste, shortcut.
|
|
@@ -19,6 +15,7 @@ export declare class UniverUIPlugin extends Plugin {
|
|
|
19
15
|
static pluginName: string;
|
|
20
16
|
constructor(_config: Partial<IUniverUIConfig>, _contextService: IContextService, _injector: Injector, _localeService: LocaleService);
|
|
21
17
|
onStarting(_injector: Injector): void;
|
|
18
|
+
onReady(): void;
|
|
22
19
|
private _initDependencies;
|
|
23
20
|
private _initUI;
|
|
24
21
|
}
|
package/lib/types/views/App.d.ts
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
1
2
|
import { IWorkbenchOptions } from '../controllers/ui/ui.controller';
|
|
2
|
-
import { ComponentType, default as React } from 'react';
|
|
3
3
|
|
|
4
4
|
export interface IUniverAppProps extends IWorkbenchOptions {
|
|
5
5
|
mountContainer: HTMLElement;
|
|
6
|
-
headerComponents?: Set<() => ComponentType>;
|
|
7
|
-
contentComponents?: Set<() => ComponentType>;
|
|
8
|
-
footerComponents?: Set<() => ComponentType>;
|
|
9
|
-
headerMenuComponents?: Set<() => ComponentType>;
|
|
10
|
-
leftSidebarComponents?: Set<() => ComponentType>;
|
|
11
6
|
onRendered?: (container: HTMLElement) => void;
|
|
12
7
|
}
|
|
13
8
|
export declare function App(props: IUniverAppProps): React.JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ICustomLabelProps } from '../../../components/custom-label/CustomLabel';
|
|
2
1
|
import { IConfirmProps } from '@univerjs/design';
|
|
2
|
+
import { ICustomLabelProps } from '../../../components/custom-label/CustomLabel';
|
|
3
3
|
|
|
4
4
|
export type IConfirmPartMethodOptions = {
|
|
5
5
|
id: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ICustomLabelProps } from '../../../components/custom-label/CustomLabel';
|
|
2
1
|
import { IDialogProps } from '@univerjs/design';
|
|
2
|
+
import { ICustomLabelProps } from '../../../components/custom-label/CustomLabel';
|
|
3
3
|
|
|
4
4
|
export type IDialogPartMethodOptions = {
|
|
5
5
|
id: string;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { MenuPosition } from '../../../services/menu/menu';
|
|
2
1
|
import { ComponentType, default as React } from 'react';
|
|
3
2
|
|
|
4
|
-
export declare const positions: MenuPosition[];
|
|
5
3
|
export interface IToolbarProps {
|
|
6
4
|
headerMenuComponents?: Set<() => ComponentType>;
|
|
7
5
|
}
|
|
6
|
+
/**
|
|
7
|
+
* Univer's built in toolbar component.
|
|
8
|
+
*/
|
|
8
9
|
export declare function Toolbar(props: IToolbarProps): React.JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IDisplayMenuItem, IMenuItem } from '../../../services/menu/menu';
|
|
2
1
|
import { default as React } from 'react';
|
|
2
|
+
import { IDisplayMenuItem, IMenuItem } from '../../../services/menu/menu';
|
|
3
3
|
|
|
4
4
|
export declare const ToolbarItem: React.ForwardRefExoticComponent<IDisplayMenuItem<IMenuItem> & React.RefAttributes<any>>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { IDisplayMenuItem, IMenuItem, MenuGroup, MenuPosition } from '../../../services/menu/menu';
|
|
2
|
+
|
|
3
|
+
type MenuPositionWithCustom = MenuPosition | string;
|
|
4
|
+
export interface IMenuGroup {
|
|
5
|
+
name: MenuPositionWithCustom;
|
|
6
|
+
menuItems: Array<IDisplayMenuItem<IMenuItem>>;
|
|
7
|
+
}
|
|
8
|
+
export interface IToolbarRenderHookHandler {
|
|
9
|
+
/** The activated category. */
|
|
10
|
+
category: MenuPositionWithCustom;
|
|
11
|
+
/** Update current activate category. */
|
|
12
|
+
setCategory: (position: MenuPositionWithCustom) => void;
|
|
13
|
+
visibleItems: IDisplayMenuItem<IMenuItem>[];
|
|
14
|
+
/** Menu grouped in this category. */
|
|
15
|
+
groups: IMenuGroup[];
|
|
16
|
+
groupsByKey: Record<MenuGroup, Array<IDisplayMenuItem<IMenuItem>>>;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* If your custom toolbar component need to render menu items by their category,
|
|
20
|
+
* you can use this hook to get the toolbar status.
|
|
21
|
+
* @returns toolbar status
|
|
22
|
+
*/
|
|
23
|
+
export declare function useToolbarGroups(categories: MenuPositionWithCustom[]): IToolbarRenderHookHandler;
|
|
24
|
+
export interface IToolbarItemStatus {
|
|
25
|
+
disabled: boolean;
|
|
26
|
+
value: any;
|
|
27
|
+
activated: boolean;
|
|
28
|
+
hidden: boolean;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Subscribe to a menu item's status change and return the latest status.
|
|
32
|
+
* @param menuItem The menu item
|
|
33
|
+
* @returns The menu item's status
|
|
34
|
+
*/
|
|
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
|
+
export {};
|