@univerjs/ui 1.0.0-alpha.6 → 1.0.0-alpha.8
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/facade.js +9 -41
- package/lib/cjs/index.js +1434 -470
- package/lib/cjs/locale/ar-SA.js +12 -0
- package/lib/cjs/locale/ca-ES.js +12 -0
- package/lib/cjs/locale/de-DE.js +12 -0
- package/lib/cjs/locale/en-US.js +12 -0
- package/lib/cjs/locale/es-ES.js +12 -0
- package/lib/cjs/locale/fa-IR.js +12 -0
- package/lib/cjs/locale/fr-FR.js +12 -0
- package/lib/cjs/locale/id-ID.js +12 -0
- package/lib/cjs/locale/it-IT.js +12 -0
- package/lib/cjs/locale/ja-JP.js +12 -0
- package/lib/cjs/locale/ko-KR.js +12 -0
- package/lib/cjs/locale/pl-PL.js +12 -0
- package/lib/cjs/locale/pt-BR.js +12 -0
- package/lib/cjs/locale/ru-RU.js +12 -0
- package/lib/cjs/locale/sk-SK.js +12 -0
- package/lib/cjs/locale/vi-VN.js +12 -0
- package/lib/cjs/locale/zh-CN.js +12 -0
- package/lib/cjs/locale/zh-HK.js +12 -0
- package/lib/cjs/locale/zh-TW.js +12 -0
- package/lib/es/facade.js +11 -43
- package/lib/es/index.js +1431 -475
- package/lib/es/locale/ar-SA.js +12 -0
- package/lib/es/locale/ca-ES.js +12 -0
- package/lib/es/locale/de-DE.js +12 -0
- package/lib/es/locale/en-US.js +12 -0
- package/lib/es/locale/es-ES.js +12 -0
- package/lib/es/locale/fa-IR.js +12 -0
- package/lib/es/locale/fr-FR.js +12 -0
- package/lib/es/locale/id-ID.js +12 -0
- package/lib/es/locale/it-IT.js +12 -0
- package/lib/es/locale/ja-JP.js +12 -0
- package/lib/es/locale/ko-KR.js +12 -0
- package/lib/es/locale/pl-PL.js +12 -0
- package/lib/es/locale/pt-BR.js +12 -0
- package/lib/es/locale/ru-RU.js +12 -0
- package/lib/es/locale/sk-SK.js +12 -0
- package/lib/es/locale/vi-VN.js +12 -0
- package/lib/es/locale/zh-CN.js +12 -0
- package/lib/es/locale/zh-HK.js +12 -0
- package/lib/es/locale/zh-TW.js +12 -0
- package/lib/facade.js +11 -43
- package/lib/index.css +224 -6
- package/lib/index.js +1431 -475
- package/lib/locale/ar-SA.js +12 -0
- package/lib/locale/ca-ES.js +12 -0
- package/lib/locale/de-DE.js +12 -0
- package/lib/locale/en-US.js +12 -0
- package/lib/locale/es-ES.js +12 -0
- package/lib/locale/fa-IR.js +12 -0
- package/lib/locale/fr-FR.js +12 -0
- package/lib/locale/id-ID.js +12 -0
- package/lib/locale/it-IT.js +12 -0
- package/lib/locale/ja-JP.js +12 -0
- package/lib/locale/ko-KR.js +12 -0
- package/lib/locale/pl-PL.js +12 -0
- package/lib/locale/pt-BR.js +12 -0
- package/lib/locale/ru-RU.js +12 -0
- package/lib/locale/sk-SK.js +12 -0
- package/lib/locale/vi-VN.js +12 -0
- package/lib/locale/zh-CN.js +12 -0
- package/lib/locale/zh-HK.js +12 -0
- package/lib/locale/zh-TW.js +12 -0
- package/lib/types/commands/operations/open-feature-search.operation.d.ts +17 -0
- package/lib/types/controllers/feature-search/feature-search.controller.d.ts +20 -0
- package/lib/types/controllers/ui/ui.controller.d.ts +1 -1
- package/lib/types/facade/f-univer.d.ts +0 -8
- package/lib/types/facade/index.d.ts +0 -2
- package/lib/types/index.d.ts +4 -4
- package/lib/types/locale/en-US.d.ts +12 -0
- package/lib/types/menu/feature-search.menu.d.ts +18 -0
- package/lib/types/{controllers/menus/menus.d.ts → menu/history.menu.d.ts} +2 -2
- package/lib/types/{controllers/shortcut-display/menu.d.ts → menu/shortcut-panel.menu.d.ts} +2 -2
- package/lib/types/services/contextmenu/contextmenu-host.service.d.ts +5 -1
- package/lib/types/services/menu/menu-manager.service.d.ts +11 -0
- package/lib/types/services/menu/types.d.ts +1 -0
- package/lib/types/services/parts/parts.service.d.ts +3 -0
- package/lib/types/services/shortcut/shortcut.service.d.ts +21 -1
- package/lib/types/services/workbench/workbench.service.d.ts +30 -0
- package/lib/types/utils/embed-boundary.d.ts +2 -0
- package/lib/types/views/components/feature-search/FeatureSearch.d.ts +29 -0
- package/lib/types/views/components/ribbon/RibbonGrid.d.ts +23 -0
- package/lib/types/views/components/ribbon/ToolbarItem.d.ts +10 -1
- package/lib/types/views/components/ribbon/ribbon-grid-layout.d.ts +27 -0
- package/lib/types/views/components/ribbon/ribbon-menu/RibbonGridMenu.d.ts +21 -0
- package/lib/types/views/components/sidebar/Sidebar.d.ts +0 -2
- package/lib/types/views/components/workbench-skeleton/WorkbenchSkeleton.d.ts +22 -0
- package/lib/types/views/custom-label/CustomLabel.d.ts +1 -0
- package/lib/types/views/emoji-picker/EmojiPicker.d.ts +7 -3
- package/lib/types/views/emoji-picker/emoji-picker-utils.d.ts +1 -1
- package/lib/types/views/emoji-picker/index.d.ts +0 -1
- package/lib/types/views/index.d.ts +1 -0
- package/lib/types/views/symbol-picker/SymbolPicker.d.ts +31 -0
- package/lib/types/views/symbol-picker/index.d.ts +18 -0
- package/lib/types/views/symbol-picker/symbols.d.ts +23 -0
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +16 -13
- package/lib/umd/locale/ar-SA.js +1 -1
- package/lib/umd/locale/ca-ES.js +1 -1
- package/lib/umd/locale/de-DE.js +1 -1
- package/lib/umd/locale/en-US.js +1 -1
- package/lib/umd/locale/es-ES.js +1 -1
- package/lib/umd/locale/fa-IR.js +1 -1
- package/lib/umd/locale/fr-FR.js +1 -1
- package/lib/umd/locale/id-ID.js +1 -1
- package/lib/umd/locale/it-IT.js +1 -1
- package/lib/umd/locale/ja-JP.js +1 -1
- package/lib/umd/locale/ko-KR.js +1 -1
- package/lib/umd/locale/pl-PL.js +1 -1
- package/lib/umd/locale/pt-BR.js +1 -1
- package/lib/umd/locale/ru-RU.js +1 -1
- package/lib/umd/locale/sk-SK.js +1 -1
- package/lib/umd/locale/vi-VN.js +1 -1
- package/lib/umd/locale/zh-CN.js +1 -1
- package/lib/umd/locale/zh-HK.js +1 -1
- package/lib/umd/locale/zh-TW.js +1 -1
- package/package.json +8 -8
- package/lib/types/facade/f-hooks.d.ts +0 -63
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import type { IAccessor } from '@univerjs/core';
|
|
17
|
-
import type { LocaleKey } from '
|
|
18
|
-
import type { IMenuButtonItem } from '
|
|
17
|
+
import type { LocaleKey } from '../locale/types';
|
|
18
|
+
import type { IMenuButtonItem } from '../services/menu/menu';
|
|
19
19
|
export declare function UndoMenuItemFactory(accessor: IAccessor): IMenuButtonItem<LocaleKey>;
|
|
20
20
|
export declare function RedoMenuItemFactory(accessor: IAccessor): IMenuButtonItem<LocaleKey>;
|
|
@@ -13,6 +13,6 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import type { LocaleKey } from '
|
|
17
|
-
import type { IMenuButtonItem } from '
|
|
16
|
+
import type { LocaleKey } from '../locale/types';
|
|
17
|
+
import type { IMenuButtonItem } from '../services/menu/menu';
|
|
18
18
|
export declare function ShortcutPanelMenuItemFactory(): IMenuButtonItem<LocaleKey>;
|
|
@@ -14,9 +14,11 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import type { IDisposable } from '@univerjs/core';
|
|
17
|
+
import type { Observable } from 'rxjs';
|
|
17
18
|
import { Disposable } from '@univerjs/core';
|
|
18
19
|
export interface IContextMenuHostService {
|
|
19
20
|
readonly activeMenuId: string | null;
|
|
21
|
+
readonly activeMenuId$: Observable<string | null>;
|
|
20
22
|
registerMenu(menuId: string, hide: () => void): IDisposable;
|
|
21
23
|
activateMenu(menuId: string): void;
|
|
22
24
|
deactivateMenu(menuId: string): void;
|
|
@@ -25,10 +27,12 @@ export interface IContextMenuHostService {
|
|
|
25
27
|
export declare const IContextMenuHostService: import("@wendellhu/redi").IdentifierDecorator<IContextMenuHostService>;
|
|
26
28
|
export declare class ContextMenuHostService extends Disposable implements IContextMenuHostService {
|
|
27
29
|
private readonly _menuMap;
|
|
28
|
-
private _activeMenuId
|
|
30
|
+
private readonly _activeMenuId$;
|
|
31
|
+
readonly activeMenuId$: Observable<string | null>;
|
|
29
32
|
get activeMenuId(): string | null;
|
|
30
33
|
registerMenu(menuId: string, hide: () => void): IDisposable;
|
|
31
34
|
activateMenu(menuId: string): void;
|
|
32
35
|
deactivateMenu(menuId: string): void;
|
|
33
36
|
hideActiveMenu(exceptMenuId?: string): void;
|
|
37
|
+
dispose(): void;
|
|
34
38
|
}
|
|
@@ -21,6 +21,15 @@ import { Subject } from 'rxjs';
|
|
|
21
21
|
export declare const IMenuManagerService: import("@wendellhu/redi").IdentifierDecorator<IMenuManagerService>;
|
|
22
22
|
export type ContextMenuQuickLayout = 'icon' | 'tile';
|
|
23
23
|
export type ContextMenuQuickLayoutVariant = 'default' | 'compact';
|
|
24
|
+
export interface IRibbonGridLayout {
|
|
25
|
+
row: number;
|
|
26
|
+
column: number;
|
|
27
|
+
rowSpan?: number;
|
|
28
|
+
columnSpan?: number;
|
|
29
|
+
showLabel?: boolean;
|
|
30
|
+
width?: number;
|
|
31
|
+
iconSize?: number;
|
|
32
|
+
}
|
|
24
33
|
export interface IMenuSchema {
|
|
25
34
|
key: string;
|
|
26
35
|
order: number;
|
|
@@ -33,6 +42,7 @@ export interface IMenuSchema {
|
|
|
33
42
|
quickColumns?: number;
|
|
34
43
|
quickLayoutVariant?: ContextMenuQuickLayoutVariant;
|
|
35
44
|
tiny?: boolean;
|
|
45
|
+
gridLayout?: IRibbonGridLayout;
|
|
36
46
|
}
|
|
37
47
|
export interface IMenuManagerService {
|
|
38
48
|
readonly menuChanged$: Observable<void>;
|
|
@@ -52,6 +62,7 @@ export type MenuSchemaType = {
|
|
|
52
62
|
quickColumns?: number;
|
|
53
63
|
quickLayoutVariant?: ContextMenuQuickLayoutVariant;
|
|
54
64
|
tiny?: boolean;
|
|
65
|
+
gridLayout?: IRibbonGridLayout;
|
|
55
66
|
} | {
|
|
56
67
|
[key: string]: MenuSchemaType;
|
|
57
68
|
};
|
|
@@ -29,6 +29,7 @@ export declare enum RibbonStartGroup {
|
|
|
29
29
|
HISTORY = "ribbon.start.history",
|
|
30
30
|
FORMAT = "ribbon.start.format",
|
|
31
31
|
LAYOUT = "ribbon.start.layout",
|
|
32
|
+
NUMBER = "ribbon.start.number",
|
|
32
33
|
OTHERS = "ribbon.start.others"
|
|
33
34
|
}
|
|
34
35
|
export declare enum RibbonInsertGroup {
|
|
@@ -41,6 +41,7 @@ export interface IUIPartsService {
|
|
|
41
41
|
visible: boolean;
|
|
42
42
|
}>;
|
|
43
43
|
registerComponent(part: ComponentPartKey, componentFactory: () => ComponentType): IDisposable;
|
|
44
|
+
registerDisabledUIParts(parts: readonly ComponentPartKey[], disabled$: Observable<boolean>): IDisposable;
|
|
44
45
|
getComponents(part: ComponentPartKey): Set<ComponentRenderer>;
|
|
45
46
|
setUIVisible(part: ComponentPartKey, visible: boolean): void;
|
|
46
47
|
isUIVisible(part: ComponentPartKey): boolean;
|
|
@@ -48,6 +49,7 @@ export interface IUIPartsService {
|
|
|
48
49
|
export declare const IUIPartsService: import("@wendellhu/redi").IdentifierDecorator<IUIPartsService>;
|
|
49
50
|
export declare class UIPartsService extends Disposable implements IUIPartsService {
|
|
50
51
|
private _componentsByPart;
|
|
52
|
+
private _disabledUIParts;
|
|
51
53
|
private readonly _componentRegistered$;
|
|
52
54
|
readonly componentRegistered$: Observable<string>;
|
|
53
55
|
private readonly _uiVisible;
|
|
@@ -59,6 +61,7 @@ export declare class UIPartsService extends Disposable implements IUIPartsServic
|
|
|
59
61
|
dispose(): void;
|
|
60
62
|
setUIVisible(part: ComponentPartKey, visible: boolean): void;
|
|
61
63
|
isUIVisible(part: ComponentPartKey): boolean;
|
|
64
|
+
registerDisabledUIParts(parts: readonly ComponentPartKey[], disabled$: Observable<boolean>): IDisposable;
|
|
62
65
|
registerComponent<T>(part: ComponentPartKey, componentFactory: () => React.ComponentType<T>): IDisposable;
|
|
63
66
|
getComponents(part: ComponentPartKey): Set<ComponentType>;
|
|
64
67
|
}
|
|
@@ -18,7 +18,16 @@ import type { Observable } from 'rxjs';
|
|
|
18
18
|
import { Disposable, ICommandService, IContextService } from '@univerjs/core';
|
|
19
19
|
import { ILayoutService } from '../layout/layout.service';
|
|
20
20
|
import { IPlatformService } from '../platform/platform.service';
|
|
21
|
+
import { IUIRuntimeScopeService } from '../runtime-scope/ui-runtime-scope.service';
|
|
21
22
|
import { KeyCode } from './keycode';
|
|
23
|
+
/**
|
|
24
|
+
* Defines whether a Univer shortcut should yield to the browser's native behavior
|
|
25
|
+
* when the keyboard event originates from an editable text element.
|
|
26
|
+
*/
|
|
27
|
+
export declare enum NativeTextEditorShortcutBehavior {
|
|
28
|
+
ALLOW_NATIVE = 0,
|
|
29
|
+
OVERRIDE_NATIVE = 1
|
|
30
|
+
}
|
|
22
31
|
/**
|
|
23
32
|
* A shortcut item that could be registered to the {@link IShortcutService}.
|
|
24
33
|
*/
|
|
@@ -34,6 +43,10 @@ export interface IShortcutItem<P extends object = object> {
|
|
|
34
43
|
* would be passed to the callback.
|
|
35
44
|
*/
|
|
36
45
|
preconditions?: (contextService: IContextService) => boolean;
|
|
46
|
+
/**
|
|
47
|
+
* A callback that examines the keyboard event before this shortcut is selected.
|
|
48
|
+
*/
|
|
49
|
+
eventPreconditions?: (event: KeyboardEvent) => boolean;
|
|
37
50
|
/**
|
|
38
51
|
* The binding of the shortcut. It should be a combination of {@link KeyCode} and {@link MetaKeys}.
|
|
39
52
|
*
|
|
@@ -54,6 +67,11 @@ export interface IShortcutItem<P extends object = object> {
|
|
|
54
67
|
* The binding of the shortcut for Linux. If the property is not specified, the default binding would be used.
|
|
55
68
|
*/
|
|
56
69
|
linux?: number;
|
|
70
|
+
/**
|
|
71
|
+
* Controls whether this shortcut can override the browser's native behavior
|
|
72
|
+
* for editable text elements. Native behavior is preserved by default.
|
|
73
|
+
*/
|
|
74
|
+
nativeTextEditorBehavior?: NativeTextEditorShortcutBehavior;
|
|
57
75
|
/**
|
|
58
76
|
* The group of the menu item should belong to. The shortcut item would be rendered in the
|
|
59
77
|
* panel if this is set.
|
|
@@ -135,6 +153,7 @@ export declare class ShortcutService extends Disposable implements IShortcutServ
|
|
|
135
153
|
private readonly _commandService;
|
|
136
154
|
private readonly _platformService;
|
|
137
155
|
private readonly _contextService;
|
|
156
|
+
private readonly _runtimeScopeService;
|
|
138
157
|
private readonly _layoutService?;
|
|
139
158
|
private readonly _shortCutMapping;
|
|
140
159
|
private readonly _commandIDMapping;
|
|
@@ -142,7 +161,7 @@ export declare class ShortcutService extends Disposable implements IShortcutServ
|
|
|
142
161
|
readonly shortcutChanged$: Observable<void>;
|
|
143
162
|
private _forceEscaped;
|
|
144
163
|
private _forceDisabled;
|
|
145
|
-
constructor(_commandService: ICommandService, _platformService: IPlatformService, _contextService: IContextService, _layoutService?: ILayoutService | undefined);
|
|
164
|
+
constructor(_commandService: ICommandService, _platformService: IPlatformService, _contextService: IContextService, _runtimeScopeService: IUIRuntimeScopeService, _layoutService?: ILayoutService | undefined);
|
|
146
165
|
getAllShortcuts(): IShortcutItem[];
|
|
147
166
|
registerShortcut(shortcut: IShortcutItem): IDisposable;
|
|
148
167
|
getShortcutDisplayOfCommand(id: string): string | null;
|
|
@@ -155,4 +174,5 @@ export declare class ShortcutService extends Disposable implements IShortcutServ
|
|
|
155
174
|
private _getBindingFromItem;
|
|
156
175
|
private _deriveBindingFromEvent;
|
|
157
176
|
private _shouldLetEmbedTextEditorHandleNativeShortcut;
|
|
177
|
+
private _getRuntimeService;
|
|
158
178
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
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
|
+
import type { IDisposable } from '@univerjs/core';
|
|
17
|
+
import type { Observable } from 'rxjs';
|
|
18
|
+
import { Disposable } from '@univerjs/core';
|
|
19
|
+
export interface IWorkbenchService {
|
|
20
|
+
readonly skeletonVisible$: Observable<boolean>;
|
|
21
|
+
acquireSkeleton(): IDisposable;
|
|
22
|
+
}
|
|
23
|
+
export declare const IWorkbenchService: import("@wendellhu/redi").IdentifierDecorator<IWorkbenchService>;
|
|
24
|
+
export declare class WorkbenchService extends Disposable implements IWorkbenchService {
|
|
25
|
+
private readonly _tokens;
|
|
26
|
+
private readonly _skeletonVisible$;
|
|
27
|
+
readonly skeletonVisible$: Observable<boolean>;
|
|
28
|
+
acquireSkeleton(): IDisposable;
|
|
29
|
+
dispose(): void;
|
|
30
|
+
}
|
|
@@ -14,8 +14,10 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
export declare const EMBED_INTERACTION_BOUNDARY_OWNER_ATTRIBUTE = "data-embed-interaction-boundary-owner";
|
|
17
|
+
export declare const EMBED_CHILD_UNIT_ID_ATTRIBUTE = "data-embed-child-unit-id";
|
|
17
18
|
export declare function getEmbedBoundaryOwner(target: EventTarget | null): string | undefined;
|
|
18
19
|
export declare function isEmbedBoundaryTarget(target: EventTarget | null): boolean;
|
|
20
|
+
export declare function getEmbedChildUnitId(target: EventTarget | null): string | undefined;
|
|
19
21
|
export declare function keepInteractionInsideSameEmbedBoundary(event: {
|
|
20
22
|
currentTarget: EventTarget | null;
|
|
21
23
|
target: EventTarget | null;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
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
|
+
import type { IMenuCommandParams } from '../../../services/menu/menu';
|
|
17
|
+
export declare const FEATURE_SEARCH_COMPONENT = "FeatureSearch";
|
|
18
|
+
export declare const FEATURE_SEARCH_DIALOG_ID = "FEATURE_SEARCH_DIALOG";
|
|
19
|
+
export interface IFeatureSearchItem {
|
|
20
|
+
key: string;
|
|
21
|
+
title: string;
|
|
22
|
+
parentTitle?: string;
|
|
23
|
+
description: string;
|
|
24
|
+
path: string;
|
|
25
|
+
commandId: string;
|
|
26
|
+
params?: IMenuCommandParams;
|
|
27
|
+
getParams: () => IMenuCommandParams | undefined;
|
|
28
|
+
}
|
|
29
|
+
export declare function FeatureSearch(): import("react").JSX.Element;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
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
|
+
import type { HTMLAttributes } from 'react';
|
|
17
|
+
import type { IMenuSchema } from '../../../services/menu/menu-manager.service';
|
|
18
|
+
interface IRibbonGridProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
19
|
+
groups: IMenuSchema[];
|
|
20
|
+
title: string;
|
|
21
|
+
}
|
|
22
|
+
export declare function RibbonGrid({ groups, title, className, ...props }: IRibbonGridProps): import("react").JSX.Element;
|
|
23
|
+
export {};
|
|
@@ -15,4 +15,13 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import type { IDisplayMenuItem, IMenuItem } from '../../../services/menu/menu';
|
|
17
17
|
import type { ITooltipWrapperRef } from './TooltipButtonWrapper';
|
|
18
|
-
|
|
18
|
+
type IToolbarItemProps = IDisplayMenuItem<IMenuItem> & {
|
|
19
|
+
grid?: boolean;
|
|
20
|
+
large?: boolean;
|
|
21
|
+
showLabel?: boolean;
|
|
22
|
+
iconSize?: number;
|
|
23
|
+
iconColor?: string;
|
|
24
|
+
fullWidth?: boolean;
|
|
25
|
+
};
|
|
26
|
+
export declare const ToolbarItem: import("react").ForwardRefExoticComponent<IToolbarItemProps & import("react").RefAttributes<ITooltipWrapperRef>>;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
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
|
+
import type { IMenuSchema } from '../../../services/menu/menu-manager.service';
|
|
17
|
+
export interface IRibbonGridPlacement {
|
|
18
|
+
item: IMenuSchema;
|
|
19
|
+
row: number;
|
|
20
|
+
column: number;
|
|
21
|
+
rowSpan: number;
|
|
22
|
+
columnSpan: number;
|
|
23
|
+
showLabel: boolean;
|
|
24
|
+
width?: number;
|
|
25
|
+
iconSize?: number;
|
|
26
|
+
}
|
|
27
|
+
export declare function placeRibbonGridItems(items: IMenuSchema[]): IRibbonGridPlacement[];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
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
|
+
import type { IMenuSchema } from '../../../../services/menu/menu-manager.service';
|
|
17
|
+
export declare function RibbonGridMenu({ ribbon, activatedTab, onSelectTab, }: {
|
|
18
|
+
ribbon: IMenuSchema[];
|
|
19
|
+
activatedTab: string;
|
|
20
|
+
onSelectTab: (tab: IMenuSchema) => void;
|
|
21
|
+
}): import("react").JSX.Element;
|
|
@@ -13,13 +13,11 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import type { CSSProperties } from 'react';
|
|
17
16
|
import type { ICustomLabelProps } from '../../custom-label/CustomLabel';
|
|
18
17
|
export interface ISidebarMethodOptions {
|
|
19
18
|
id?: string;
|
|
20
19
|
header?: ICustomLabelProps;
|
|
21
20
|
children?: ICustomLabelProps;
|
|
22
|
-
bodyStyle?: CSSProperties;
|
|
23
21
|
footer?: ICustomLabelProps;
|
|
24
22
|
visible?: boolean;
|
|
25
23
|
width?: number | string;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
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
|
+
import type { LocaleService } from '@univerjs/core';
|
|
17
|
+
export interface IWorkbenchSkeletonProps {
|
|
18
|
+
darkMode: boolean;
|
|
19
|
+
direction: ReturnType<LocaleService['getDirection']>;
|
|
20
|
+
overlay?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export declare function WorkbenchSkeleton({ darkMode, direction, overlay }: IWorkbenchSkeletonProps): import("react").JSX.Element;
|
|
@@ -18,6 +18,7 @@ import type { Observable } from 'rxjs';
|
|
|
18
18
|
import type { IMenuSelectorItem } from '../../services/menu/menu';
|
|
19
19
|
export type ICustomLabelProps<T = undefined> = {
|
|
20
20
|
className?: string;
|
|
21
|
+
iconSize?: number;
|
|
21
22
|
value?: string | number | undefined;
|
|
22
23
|
value$?: Observable<T>;
|
|
23
24
|
onChange?(v: string | number): void;
|
|
@@ -15,13 +15,17 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import type { IPopup } from '../../services/popup/canvas-popup.service';
|
|
17
17
|
export declare const EMOJI_PICKER_COMPONENT = "ui.emoji-picker";
|
|
18
|
-
|
|
18
|
+
interface IEmojiPickerPopupProps {
|
|
19
19
|
activeEmoji?: string;
|
|
20
20
|
onSelect?: (emoji: string, options?: {
|
|
21
21
|
keepOpen?: boolean;
|
|
22
22
|
}) => void;
|
|
23
23
|
recentStorageKey?: string;
|
|
24
24
|
}
|
|
25
|
-
|
|
25
|
+
interface IEmojiPickerProps {
|
|
26
|
+
embedded?: boolean;
|
|
27
|
+
onChange?: (emoji: string) => void;
|
|
26
28
|
popup?: IPopup<IEmojiPickerPopupProps>;
|
|
27
|
-
}
|
|
29
|
+
}
|
|
30
|
+
export declare function EmojiPicker(props: IEmojiPickerProps): import("react").JSX.Element;
|
|
31
|
+
export {};
|
|
@@ -27,7 +27,7 @@ export type EmojiCategory = Exclude<keyof typeof emojis, 'frequent'>;
|
|
|
27
27
|
export declare const EMOJI_RECENT_LIMIT = 11;
|
|
28
28
|
export declare const EMOJI_CATEGORIES: {
|
|
29
29
|
key: EmojiCategory;
|
|
30
|
-
titleKey: "ui.
|
|
30
|
+
titleKey: "ui.column" | "ui.row" | "ui.common-edit" | "ui.toggle-shortcut-panel" | "ui.global-shortcut" | "ui.fontFamily.not-supported" | "ui.fontFamily.arial" | "ui.fontFamily.times-new-roman" | "ui.fontFamily.tahoma" | "ui.fontFamily.verdana" | "ui.fontFamily.microsoft-yahei" | "ui.fontFamily.simsun" | "ui.fontFamily.simhei" | "ui.fontFamily.kaiti" | "ui.fontFamily.fangsong" | "ui.fontFamily.nsimsun" | "ui.fontFamily.stxinwei" | "ui.fontFamily.stxingkai" | "ui.fontFamily.stliti" | "ui.ribbon.start" | "ui.ribbon.view" | "ui.ribbon.insert" | "ui.ribbon.data" | "ui.ribbon.startDesc" | "ui.ribbon.insertDesc" | "ui.ribbon.formulas" | "ui.ribbon.formulasDesc" | "ui.ribbon.dataDesc" | "ui.ribbon.viewDesc" | "ui.ribbon.others" | "ui.ribbon.othersDesc" | "ui.ribbon.more" | "ui.clipboard.authentication.title" | "ui.clipboard.authentication.content" | "ui.featureSearch.title" | "ui.featureSearch.empty" | "ui.featureSearch.placeholder" | "ui.featureSearch.ribbon" | "ui.featureSearch.contextMenu" | "ui.emojiPicker.search" | "ui.emojiPicker.objects" | "ui.emojiPicker.random" | "ui.emojiPicker.recents" | "ui.emojiPicker.emojis" | "ui.emojiPicker.animals" | "ui.emojiPicker.food" | "ui.emojiPicker.activities" | "ui.emojiPicker.places" | "ui.emojiPicker.symbols" | "ui.emojiPicker.searchResults" | "ui.emojiPicker.noResults" | `ui.emojiPicker.emojiSearchIndex.${string}` | `ui.emojiPicker.emojiTitles.${string}` | "ui.symbolPicker.mathematics" | "ui.symbolPicker.greek" | "ui.symbolPicker.common" | "ui.toolbar.heading.title" | "ui.toolbar.heading.normal" | "ui.toolbar.heading.subTitle" | "ui.toolbar.heading.tooltip" | "ui.shortcut-panel.title" | "ui.shortcut.copy" | "ui.shortcut.cut" | "ui.shortcut.paste" | "ui.shortcut.shortcut-panel" | "ui.shortcut.undo" | "ui.shortcut.redo" | "ui.navigation.next" | "ui.navigation.back" | "ui.navigation.previous" | "ui.sidebar.close" | "ui.sidebar.resize" | "ui.sidebar.panel" | "ui.beforeClose.title" | "ui.textEditor.formulaError" | "ui.textEditor.rangeError" | "ui.rangeSelector.title" | "ui.rangeSelector.cancel" | "ui.rangeSelector.addAnotherRange" | "ui.rangeSelector.buttonTooltip" | "ui.rangeSelector.placeHolder" | "ui.rangeSelector.confirm" | "ui.zoom-slider.resetTo";
|
|
31
31
|
}[];
|
|
32
32
|
export declare function getDefaultRecentEmojis(): IEmojiItem[];
|
|
33
33
|
export declare function getAllEmojis(): IEmojiItem[];
|
|
@@ -16,4 +16,3 @@
|
|
|
16
16
|
export { EMOJI_CATEGORIES, EMOJI_RECENT_LIMIT, getAllEmojis, getDefaultRecentEmojis, getEmojiLocaleData, getLocalizedEmojiTitle, getRandomEmoji, parseStoredRecentEmojis, promoteRecentEmoji, searchEmojis, } from './emoji-picker-utils';
|
|
17
17
|
export type { EmojiCategory, IEmojiItem, IEmojiLocaleData } from './emoji-picker-utils';
|
|
18
18
|
export { EMOJI_PICKER_COMPONENT, EmojiPicker } from './EmojiPicker';
|
|
19
|
-
export type { IEmojiPickerPopupProps } from './EmojiPicker';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
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
|
+
import type { IPopup } from '../../services/popup/canvas-popup.service';
|
|
17
|
+
export declare const SYMBOL_PICKER_COMPONENT = "ui.symbol-picker";
|
|
18
|
+
interface ISymbolPickerPopupProps {
|
|
19
|
+
activeSymbol?: string;
|
|
20
|
+
onSelect?: (symbol: string, options?: {
|
|
21
|
+
keepOpen?: boolean;
|
|
22
|
+
}) => void;
|
|
23
|
+
}
|
|
24
|
+
interface ISymbolPickerProps {
|
|
25
|
+
className?: string;
|
|
26
|
+
embedded?: boolean;
|
|
27
|
+
onChange?: (symbol: string) => void;
|
|
28
|
+
popup?: IPopup<ISymbolPickerPopupProps>;
|
|
29
|
+
}
|
|
30
|
+
export declare function SymbolPicker(props: ISymbolPickerProps): import("react").JSX.Element;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
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 { SYMBOL_PICKER_COMPONENT, SymbolPicker } from './SymbolPicker';
|
|
17
|
+
export { SYMBOL_CATEGORIES } from './symbols';
|
|
18
|
+
export type { ISymbolCategory, SymbolCategory } from './symbols';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
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
|
+
import type { LocaleKey } from '../../locale/types';
|
|
17
|
+
export type SymbolCategory = 'mathematics' | 'greek' | 'common';
|
|
18
|
+
export interface ISymbolCategory {
|
|
19
|
+
key: SymbolCategory;
|
|
20
|
+
symbols: string[];
|
|
21
|
+
titleKey: LocaleKey;
|
|
22
|
+
}
|
|
23
|
+
export declare const SYMBOL_CATEGORIES: ISymbolCategory[];
|
package/lib/umd/facade.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(require("@univerjs/core/facade"),require("@univerjs/engine-render"),require("@univerjs/ui"),require("@univerjs/core")):typeof define==`function`&&define.amd?define([`@univerjs/core/facade`,`@univerjs/engine-render`,`@univerjs/ui`,`@univerjs/core`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverCoreFacade,e.UniverEngineRender,e.UniverUi,e.UniverCore))})(this,function(e,t,n,r){function i(e){"@babel/helpers - typeof";return i=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},i(e)}function a(e,t){if(i(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(i(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function o(e){var t=a(e,`string`);return i(t)==`symbol`?t:t+``}function s(e,t,n){return(t=o(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e,t){return function(n,r){t(n,r,e)}}function l(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}var u=class extends e.FBase{appendTo(e){let t=typeof e==`string`?e.split(`|`):e,n=t.length,r={},i=r,a=this.__getSchema();t.forEach((e,t)=>{t===n-1?i[e]=a:i[e]={},i=i[e]}),this._menuManagerService.mergeMenu(r)}};let d=class extends u{constructor(e,t,i,a){super(),this._item=e,this._injector=t,this._commandService=i,this._menuManagerService=a,s(this,`_commandToRegister`,new Map),s(this,`_buildingSchema`,void 0);let o=typeof e.action==`string`?e.action:(0,r.generateRandomId)(12);o!==e.action&&this._commandToRegister.set(o,e.action),this._buildingSchema={menuItemFactory:()=>({id:e.id,type:n.MenuItemType.BUTTON,icon:e.icon,title:e.title,tooltip:e.tooltip,commandId:o})},e.order!==void 0&&(this._buildingSchema.order=e.order)}__getSchema(){return this._commandToRegister.forEach((e,t)=>{this._commandService.hasCommand(t)||this._commandService.registerCommand({id:t,type:r.CommandType.COMMAND,handler:e})}),{[this._item.id]:this._buildingSchema}}};s(d,`RibbonStartGroup`,n.RibbonStartGroup),s(d,`RibbonPosition`,n.RibbonPosition),s(d,`MenuManagerPosition`,n.MenuManagerPosition),d=l([c(1,(0,r.Inject)(r.Injector)),c(2,r.ICommandService),c(3,n.IMenuManagerService)],d);let f=class extends u{constructor(e,t,r){super(),this._item=e,this._injector=t,this._menuManagerService=r,s(this,`_menuByGroups`,[]),s(this,`_submenus`,[]),s(this,`_buildingSchema`,void 0),this._buildingSchema={menuItemFactory:()=>({id:e.id,type:n.MenuItemType.SUBITEMS,icon:e.icon,title:e.title,tooltip:e.tooltip})},e.order!==void 0&&(this._buildingSchema.order=e.order)}addSubmenu(e){return this._submenus.push(e),this}addSeparator(){return this._menuByGroups.push(this._submenus),this._submenus=[],this}__getSchema(){let e={};return this.addSeparator(),this._menuByGroups.forEach((t,n)=>{let r={};t.forEach(e=>{Object.assign(r,e.__getSchema())}),e[`${this._item.id}-group-${n}`]=r}),{[this._item.id]:Object.assign(this._buildingSchema,e)}}};f=l([c(1,(0,r.Inject)(r.Injector)),c(2,n.IMenuManagerService)],f);let p=class extends e.FBase{constructor(e,t,n,r){super(),this._injector=e,this._renderManagerService=t,this._univerInstanceService=n,this._shortcutService=r,s(this,`_forceDisableDisposable`,null)}enableShortcut(){var e;return(e=this._forceDisableDisposable)==null||e.dispose(),this._forceDisableDisposable=null,this}disableShortcut(){return this._forceDisableDisposable||(this._forceDisableDisposable=this._shortcutService.forceDisable()),this}triggerShortcut(e){let t=this._univerInstanceService.getCurrentUnitOfType(r.UniverInstanceType.UNIVER_SHEET);if(!t)return;let n=this._renderManagerService.
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(require("@univerjs/core/facade"),require("@univerjs/engine-render"),require("@univerjs/ui"),require("@univerjs/core")):typeof define==`function`&&define.amd?define([`@univerjs/core/facade`,`@univerjs/engine-render`,`@univerjs/ui`,`@univerjs/core`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverCoreFacade,e.UniverEngineRender,e.UniverUi,e.UniverCore))})(this,function(e,t,n,r){function i(e){"@babel/helpers - typeof";return i=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},i(e)}function a(e,t){if(i(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(i(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function o(e){var t=a(e,`string`);return i(t)==`symbol`?t:t+``}function s(e,t,n){return(t=o(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e,t){return function(n,r){t(n,r,e)}}function l(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}var u=class extends e.FBase{appendTo(e){let t=typeof e==`string`?e.split(`|`):e,n=t.length,r={},i=r,a=this.__getSchema();t.forEach((e,t)=>{t===n-1?i[e]=a:i[e]={},i=i[e]}),this._menuManagerService.mergeMenu(r)}};let d=class extends u{constructor(e,t,i,a){super(),this._item=e,this._injector=t,this._commandService=i,this._menuManagerService=a,s(this,`_commandToRegister`,new Map),s(this,`_buildingSchema`,void 0);let o=typeof e.action==`string`?e.action:(0,r.generateRandomId)(12);o!==e.action&&this._commandToRegister.set(o,e.action),this._buildingSchema={menuItemFactory:()=>({id:e.id,type:n.MenuItemType.BUTTON,icon:e.icon,title:e.title,tooltip:e.tooltip,commandId:o})},e.order!==void 0&&(this._buildingSchema.order=e.order)}__getSchema(){return this._commandToRegister.forEach((e,t)=>{this._commandService.hasCommand(t)||this._commandService.registerCommand({id:t,type:r.CommandType.COMMAND,handler:e})}),{[this._item.id]:this._buildingSchema}}};s(d,`RibbonStartGroup`,n.RibbonStartGroup),s(d,`RibbonPosition`,n.RibbonPosition),s(d,`MenuManagerPosition`,n.MenuManagerPosition),d=l([c(1,(0,r.Inject)(r.Injector)),c(2,r.ICommandService),c(3,n.IMenuManagerService)],d);let f=class extends u{constructor(e,t,r){super(),this._item=e,this._injector=t,this._menuManagerService=r,s(this,`_menuByGroups`,[]),s(this,`_submenus`,[]),s(this,`_buildingSchema`,void 0),this._buildingSchema={menuItemFactory:()=>({id:e.id,type:n.MenuItemType.SUBITEMS,icon:e.icon,title:e.title,tooltip:e.tooltip})},e.order!==void 0&&(this._buildingSchema.order=e.order)}addSubmenu(e){return this._submenus.push(e),this}addSeparator(){return this._menuByGroups.push(this._submenus),this._submenus=[],this}__getSchema(){let e={};return this.addSeparator(),this._menuByGroups.forEach((t,n)=>{let r={};t.forEach(e=>{Object.assign(r,e.__getSchema())}),e[`${this._item.id}-group-${n}`]=r}),{[this._item.id]:Object.assign(this._buildingSchema,e)}}};f=l([c(1,(0,r.Inject)(r.Injector)),c(2,n.IMenuManagerService)],f);let p=class extends e.FBase{constructor(e,t,n,r){super(),this._injector=e,this._renderManagerService=t,this._univerInstanceService=n,this._shortcutService=r,s(this,`_forceDisableDisposable`,null)}enableShortcut(){var e;return(e=this._forceDisableDisposable)==null||e.dispose(),this._forceDisableDisposable=null,this}disableShortcut(){return this._forceDisableDisposable||(this._forceDisableDisposable=this._shortcutService.forceDisable()),this}triggerShortcut(e){let t=this._univerInstanceService.getCurrentUnitOfType(r.UniverInstanceType.UNIVER_SHEET);if(!t)return;let n=this._renderManagerService.getRenderUnitById(t.getUnitId());if(n)return n.engine.getCanvasElement().dispatchEvent(e),this._shortcutService.dispatch(e)}dispatchShortcutEvent(e){return this._shortcutService.dispatch(e)}};p=l([c(0,(0,r.Inject)(r.Injector)),c(1,(0,r.Inject)(t.IRenderManagerService)),c(2,r.IUniverInstanceService),c(3,n.IShortcutService)],p);var m=class extends e.FUniver{getURL(){return new URL(window.location.href)}getShortcut(){return this._injector.createInstance(p)}copy(){return this._commandService.executeCommand(n.CopyCommand.id)}paste(){return this._commandService.executeCommand(n.PasteCommand.id)}createMenu(e){return this._injector.createInstance(d,e)}createSubmenu(e){return this._injector.createInstance(f,e)}openSidebar(e){return this._injector.get(n.ISidebarService).open(e)}openDialog(e){let t=this._injector.get(n.IDialogService).open({...e,onClose:()=>{t.dispose()}});return t}getComponentManager(){return this._injector.get(n.ComponentManager)}showMessage(e){return this._injector.get(n.IMessageService).show(e),this}setUIVisible(e,t){return this._injector.get(n.IUIPartsService).setUIVisible(e,t),this}isUIVisible(e){return this._injector.get(n.IUIPartsService).isUIVisible(e)}registerUIPart(e,t){return this._injector.get(n.IUIPartsService).registerComponent(e,()=>(0,n.connectInjector)(t,this._injector))}registerComponent(e,t,r){let i=this._injector.get(n.ComponentManager);return this.disposeWithMe(i.register(e,t,r))}setCurrent(e){if(!this._injector.get(t.IRenderManagerService).getRenderUnitById(e))throw Error(`Unit not found`);this._univerInstanceService.setCurrentUnitForType(e)}addFonts(e){let t=this._injector.get(n.IFontService);e.forEach(e=>{t.addFont(e)})}};e.FUniver.extend(m);var h=class extends e.FEnum{get BuiltInUIPart(){return n.BuiltInUIPart}get KeyCode(){return n.KeyCode}};e.FEnum.extend(h)});
|