@univerjs/ui 0.25.0 → 1.0.0-alpha.0
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 +6 -6
- package/lib/cjs/index.js +4546 -3688
- package/lib/es/facade.js +6 -6
- package/lib/es/index.js +5820 -4942
- package/lib/facade.js +6 -6
- package/lib/index.css +172 -46
- package/lib/index.js +5820 -4942
- package/lib/types/common/component-manager.d.ts +3 -4
- package/lib/types/common/icon-manager.d.ts +86 -0
- package/lib/types/common/index.d.ts +1 -0
- package/lib/types/controllers/components.controller.d.ts +24 -0
- package/lib/types/controllers/menus/menus.d.ts +3 -2
- package/lib/types/controllers/shortcut-display/menu.d.ts +2 -1
- package/lib/types/controllers/shortcut-display/shortcut-panel.controller.d.ts +2 -3
- package/lib/types/controllers/ui/ui-desktop.controller.d.ts +0 -1
- package/lib/types/controllers/ui/ui-mobile.controller.d.ts +0 -1
- package/lib/types/index.d.ts +41 -29
- package/lib/types/locale/types.d.ts +18 -0
- package/lib/types/services/menu/menu-manager.service.d.ts +8 -0
- package/lib/types/services/menu/menu.d.ts +25 -31
- package/lib/types/services/notification/desktop-notification.service.d.ts +1 -1
- package/lib/types/services/notification/notification.service.d.ts +1 -1
- package/lib/types/services/shortcut/keycode.d.ts +2 -0
- package/lib/types/utils/storage-driver.d.ts +26 -0
- package/lib/types/{components/common-label/index.d.ts → views/CommonLabel.d.ts} +1 -1
- package/lib/types/{components/heading-item/index.d.ts → views/HeadingItem.d.ts} +1 -1
- package/lib/types/views/components/confirm-part/ConfirmPart.d.ts +1 -1
- package/lib/types/views/components/confirm-part/interface.d.ts +1 -1
- package/lib/types/views/components/context-menu/AnchoredContextMenu.d.ts +1 -1
- package/lib/types/views/components/context-menu/ContextMenu.d.ts +1 -1
- package/lib/types/views/components/context-menu/ContextMenuPanel.d.ts +19 -1
- package/lib/types/views/components/dialog-part/DialogPart.d.ts +1 -1
- package/lib/types/views/components/dialog-part/interface.d.ts +1 -1
- package/lib/types/views/components/dom/FloatDom.d.ts +2 -2
- package/lib/types/views/components/dom/Print.d.ts +1 -1
- package/lib/types/views/components/gallery-part/GalleryPart.d.ts +1 -1
- package/lib/types/views/components/popup/CanvasPopup.d.ts +2 -2
- package/lib/types/views/components/popup/RectPopup.d.ts +1 -1
- package/lib/types/views/components/ribbon/MobileRibbon.d.ts +1 -1
- package/lib/types/views/components/ribbon/Ribbon.d.ts +1 -1
- package/lib/types/views/components/ribbon/ToolbarButton.d.ts +5 -1
- package/lib/types/views/components/ribbon/TooltipButtonWrapper.d.ts +9 -3
- package/lib/types/views/components/ribbon/hook.d.ts +1 -0
- package/lib/types/views/components/ribbon/ribbon-menu/ClassicMenu.d.ts +1 -1
- package/lib/types/views/components/ribbon/ribbon-menu/DefaultMenu.d.ts +1 -1
- package/lib/types/views/components/shortcut-panel/ShortcutPanel.d.ts +1 -1
- package/lib/types/views/components/sidebar/Sidebar.d.ts +2 -2
- package/lib/types/{components → views}/custom-label/CustomLabel.d.ts +2 -2
- package/lib/types/{components → views}/font-family/FontFamily.d.ts +1 -1
- package/lib/types/{components → views}/font-family/FontFamilyItem.d.ts +1 -1
- package/lib/types/{components → views}/font-size/FontSize.d.ts +1 -1
- package/lib/types/{components → views}/hooks/layout.d.ts +1 -1
- package/lib/types/{components → views}/index.d.ts +4 -4
- package/lib/types/{components → views}/menu/desktop/DesignTinyMenuGroup.d.ts +11 -7
- package/lib/types/{components → views}/menu/desktop/TinyMenuGroup.d.ts +7 -2
- package/lib/types/{components → views}/menu/mobile/MobileMenu.d.ts +1 -1
- package/lib/types/{components → views}/menu/mobile/MobileMenu.stories.d.ts +1 -1
- package/lib/types/views/{components/zen-zone/ZenZone.d.ts → message/MessageContainer.d.ts} +1 -1
- package/lib/types/views/mobile-workbench/MobileWorkbench.d.ts +3 -1
- package/lib/types/{components → views}/notification/Notification.d.ts +1 -1
- package/lib/types/{components → views}/notification/Notification.stories.d.ts +5 -5
- package/lib/types/{components → views}/progress-bar/ProgressBar.d.ts +1 -1
- package/lib/types/{components → views}/slider/Slider.d.ts +1 -1
- package/lib/types/{components → views}/slider/Slider.stories.d.ts +1 -1
- package/lib/types/views/workbench/Workbench.d.ts +4 -2
- package/lib/umd/index.js +25 -131
- package/package.json +9 -10
- package/lib/types/components/message/MessageContainer.d.ts +0 -16
- package/lib/types/services/zen-zone/desktop-zen-zone.service.d.ts +0 -37
- package/lib/types/services/zen-zone/zen-zone.service.d.ts +0 -37
- /package/lib/types/services/message/{__testing__ → __tests__}/mock-message.service.d.ts +0 -0
- /package/lib/types/{components → views}/color-picker/interface.d.ts +0 -0
- /package/lib/types/{components → views}/custom-label/index.d.ts +0 -0
- /package/lib/types/{components → views}/font-family/index.d.ts +0 -0
- /package/lib/types/{components → views}/font-family/interface.d.ts +0 -0
- /package/lib/types/{components → views}/font-size/interface.d.ts +0 -0
- /package/lib/types/{components → views}/hooks/event.d.ts +0 -0
- /package/lib/types/{components → views}/hooks/index.d.ts +0 -0
- /package/lib/types/{components → views}/hooks/update-effect.d.ts +0 -0
- /package/lib/types/{components → views}/hooks/use-click-out-side.d.ts +0 -0
- /package/lib/types/{components → views}/hooks/use-debounce.d.ts +0 -0
- /package/lib/types/{components → views}/hooks/virtual-list.d.ts +0 -0
- /package/lib/types/{components → views}/menu/common/hook.d.ts +0 -0
- /package/lib/types/{components → views}/menu/types.d.ts +0 -0
- /package/lib/types/{components → views}/slider/index.d.ts +0 -0
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import type { IDisposable } from '@univerjs/core';
|
|
17
|
-
import { Disposable } from '@univerjs/core';
|
|
17
|
+
import { Disposable, ILogService } from '@univerjs/core';
|
|
18
18
|
import { createElement, useEffect, useRef } from 'react';
|
|
19
19
|
type ComponentFramework = string;
|
|
20
20
|
export interface IComponentOptions {
|
|
@@ -27,11 +27,10 @@ export interface IComponent<T = any> {
|
|
|
27
27
|
export type ComponentType<T = any> = any;
|
|
28
28
|
export type ComponentList = Map<string, IComponent>;
|
|
29
29
|
export declare class ComponentManager extends Disposable {
|
|
30
|
+
private readonly _logService?;
|
|
30
31
|
private _components;
|
|
31
|
-
|
|
32
|
-
constructor();
|
|
32
|
+
constructor(_logService?: ILogService | undefined);
|
|
33
33
|
register(name: string, component: ComponentType, options?: IComponentOptions): IDisposable;
|
|
34
|
-
getKey(component: ComponentType): string | undefined;
|
|
35
34
|
reactUtils: {
|
|
36
35
|
createElement: typeof createElement;
|
|
37
36
|
useEffect: typeof useEffect;
|
|
@@ -0,0 +1,86 @@
|
|
|
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 { ComponentType, CSSProperties, ForwardRefExoticComponent, MouseEventHandler, RefAttributes } from 'react';
|
|
18
|
+
import { Disposable, ILogService } from '@univerjs/core';
|
|
19
|
+
/**
|
|
20
|
+
* Extra color channels consumed by Univer icon components.
|
|
21
|
+
*/
|
|
22
|
+
export interface IIconExtendProps {
|
|
23
|
+
colorChannel1: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Common props that IconManager-managed icons receive when rendered by UI components.
|
|
27
|
+
*/
|
|
28
|
+
export interface IIconProps {
|
|
29
|
+
className?: string;
|
|
30
|
+
style?: CSSProperties;
|
|
31
|
+
extend?: IIconExtendProps;
|
|
32
|
+
onClick?: MouseEventHandler<SVGSVGElement>;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* React component type accepted by IconManager.
|
|
36
|
+
*/
|
|
37
|
+
export type IconType = ComponentType<IIconProps> | ForwardRefExoticComponent<IIconProps & RefAttributes<SVGElement>>;
|
|
38
|
+
/**
|
|
39
|
+
* Icon name to icon component map used for batch registration.
|
|
40
|
+
*/
|
|
41
|
+
export type IconMap = Record<string, IconType>;
|
|
42
|
+
/**
|
|
43
|
+
* Runtime icon registry storage.
|
|
44
|
+
*/
|
|
45
|
+
export type IconList = Map<string, IconType>;
|
|
46
|
+
/**
|
|
47
|
+
* Registers and resolves toolbar/menu icons by name.
|
|
48
|
+
*
|
|
49
|
+
* `get()` is render-safe and returns an empty icon when the name is missing. Use `has()`
|
|
50
|
+
* when the caller needs to know whether an icon was actually registered.
|
|
51
|
+
*/
|
|
52
|
+
export declare class IconManager extends Disposable {
|
|
53
|
+
private readonly _logService;
|
|
54
|
+
private _icons;
|
|
55
|
+
constructor(_logService: ILogService);
|
|
56
|
+
/**
|
|
57
|
+
* Check whether an icon name is currently registered.
|
|
58
|
+
*
|
|
59
|
+
* Prefer this for existence checks because `get()` always returns a renderable icon.
|
|
60
|
+
*/
|
|
61
|
+
has(name: string): boolean;
|
|
62
|
+
private _register;
|
|
63
|
+
/**
|
|
64
|
+
* Register one icon by name.
|
|
65
|
+
*
|
|
66
|
+
* The returned disposable removes this registration when disposed.
|
|
67
|
+
*/
|
|
68
|
+
register(name: string, icon: IconType): IDisposable;
|
|
69
|
+
/**
|
|
70
|
+
* Register a batch of icons.
|
|
71
|
+
*
|
|
72
|
+
* The returned disposable removes every icon registered by this call when disposed.
|
|
73
|
+
*/
|
|
74
|
+
register(icons: IconMap): IDisposable;
|
|
75
|
+
/**
|
|
76
|
+
* Resolve an icon by name.
|
|
77
|
+
*
|
|
78
|
+
* Missing names are reported through the log service and return an empty component so
|
|
79
|
+
* render paths can safely use the result as `<Icon />`.
|
|
80
|
+
*/
|
|
81
|
+
get(name: string): IconType;
|
|
82
|
+
/**
|
|
83
|
+
* Remove an icon registration if it exists.
|
|
84
|
+
*/
|
|
85
|
+
delete(name: string): void;
|
|
86
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
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 { Disposable } from '@univerjs/core';
|
|
17
|
+
import { ComponentManager, IconManager } from '../common';
|
|
18
|
+
export declare class ComponentsController extends Disposable {
|
|
19
|
+
private readonly _componentManager;
|
|
20
|
+
private readonly _iconManager;
|
|
21
|
+
constructor(_componentManager: ComponentManager, _iconManager: IconManager);
|
|
22
|
+
private _registerIcons;
|
|
23
|
+
private _registerComponents;
|
|
24
|
+
}
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import type { IAccessor } from '@univerjs/core';
|
|
17
|
+
import type { LocaleKey } from '../../locale/types';
|
|
17
18
|
import type { IMenuButtonItem } from '../../services/menu/menu';
|
|
18
|
-
export declare function UndoMenuItemFactory(accessor: IAccessor): IMenuButtonItem
|
|
19
|
-
export declare function RedoMenuItemFactory(accessor: IAccessor): IMenuButtonItem
|
|
19
|
+
export declare function UndoMenuItemFactory(accessor: IAccessor): IMenuButtonItem<LocaleKey>;
|
|
20
|
+
export declare function RedoMenuItemFactory(accessor: IAccessor): IMenuButtonItem<LocaleKey>;
|
|
@@ -13,5 +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 '../../locale/types';
|
|
16
17
|
import type { IMenuButtonItem } from '../../services/menu/menu';
|
|
17
|
-
export declare function ShortcutPanelMenuItemFactory(): IMenuButtonItem
|
|
18
|
+
export declare function ShortcutPanelMenuItemFactory(): IMenuButtonItem<LocaleKey>;
|
|
@@ -13,8 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { Disposable, ICommandService
|
|
17
|
-
import { ComponentManager } from '../../common/component-manager';
|
|
16
|
+
import { Disposable, ICommandService } from '@univerjs/core';
|
|
18
17
|
import { IMenuManagerService } from '../../services/menu/menu-manager.service';
|
|
19
18
|
import { IShortcutService } from '../../services/shortcut/shortcut.service';
|
|
20
19
|
/**
|
|
@@ -22,5 +21,5 @@ import { IShortcutService } from '../../services/shortcut/shortcut.service';
|
|
|
22
21
|
*/
|
|
23
22
|
export declare class ShortcutPanelController extends Disposable {
|
|
24
23
|
private readonly _menuManagerService;
|
|
25
|
-
constructor(
|
|
24
|
+
constructor(shortcutService: IShortcutService, _menuManagerService: IMenuManagerService, commandService: ICommandService);
|
|
26
25
|
}
|
|
@@ -26,7 +26,6 @@ export declare class DesktopUIController extends SingleUnitUIController {
|
|
|
26
26
|
private readonly _config;
|
|
27
27
|
private readonly _componentManager;
|
|
28
28
|
constructor(_config: IUniverUIConfig, injector: Injector, lifecycleService: LifecycleService, renderManagerService: IRenderManagerService, layoutService: ILayoutService, instanceService: IUniverInstanceService, menuManagerService: IMenuManagerService, uiPartsService: IUIPartsService, _componentManager: ComponentManager);
|
|
29
|
-
private _registerComponents;
|
|
30
29
|
dispose(): void;
|
|
31
30
|
bootstrap(callback: (contentElement: HTMLElement, containerElement: HTMLElement) => void): IDisposable;
|
|
32
31
|
private _initBuiltinComponents;
|
|
@@ -29,6 +29,5 @@ export declare class MobileUIController extends SingleUnitUIController implement
|
|
|
29
29
|
constructor(_config: IUniverUIConfig, injector: Injector, lifecycleService: LifecycleService, renderManagerService: IRenderManagerService, layoutService: ILayoutService, instanceService: IUniverInstanceService, menuManagerService: IMenuManagerService, uiPartsService: IUIPartsService, _componentManager: ComponentManager);
|
|
30
30
|
dispose(): void;
|
|
31
31
|
bootstrap(callback: (contentElement: HTMLElement, containerElement: HTMLElement) => void): IDisposable;
|
|
32
|
-
private _registerComponents;
|
|
33
32
|
private _initBuiltinComponents;
|
|
34
33
|
}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -18,71 +18,72 @@ export { ToggleShortcutPanelOperation } from './commands/operations/toggle-short
|
|
|
18
18
|
export * from './common';
|
|
19
19
|
export { getHeaderFooterMenuHiddenObservable, getMenuHiddenObservable } from './common/menu-hidden-observable';
|
|
20
20
|
export { mergeMenuConfigs } from './common/menu-merge-configs';
|
|
21
|
-
export
|
|
22
|
-
export {
|
|
23
|
-
export { FontFamily } from './components/font-family/FontFamily';
|
|
24
|
-
export { FontFamilyItem } from './components/font-family/FontFamilyItem';
|
|
25
|
-
export { FONT_FAMILY_COMPONENT, FONT_FAMILY_ITEM_COMPONENT, type IFontFamilyProps } from './components/font-family/interface';
|
|
26
|
-
export { FontSize } from './components/font-size/FontSize';
|
|
27
|
-
export { FONT_SIZE_COMPONENT, FONT_SIZE_LIST, HEADING_LIST } from './components/font-size/interface';
|
|
28
|
-
export * from './components/hooks';
|
|
29
|
-
export { type INotificationOptions } from './components/notification/Notification';
|
|
30
|
-
export { ProgressBar } from './components/progress-bar/ProgressBar';
|
|
31
|
-
export { type IUniverUIConfig, UI_PLUGIN_CONFIG_KEY } from './config/config';
|
|
21
|
+
export { UI_PLUGIN_CONFIG_KEY } from './config/config';
|
|
22
|
+
export type { IUniverUIConfig } from './config/config';
|
|
32
23
|
export { UNI_DISABLE_CHANGING_FOCUS_KEY } from './const';
|
|
33
24
|
export { ErrorController } from './controllers/error/error.controller';
|
|
34
25
|
export { CopyShortcutItem, CutShortcutItem, RedoShortcutItem, SharedController, UndoShortcutItem, } from './controllers/shared-shortcut.controller';
|
|
35
26
|
export { ShortcutPanelController } from './controllers/shortcut-display/shortcut-panel.controller';
|
|
36
27
|
export { DesktopUIController } from './controllers/ui/ui-desktop.controller';
|
|
37
28
|
export { SingleUnitUIController } from './controllers/ui/ui-shared.controller';
|
|
38
|
-
export { IUIController
|
|
29
|
+
export { IUIController } from './controllers/ui/ui.controller';
|
|
30
|
+
export type { IWorkbenchOptions } from './controllers/ui/ui.controller';
|
|
39
31
|
export { menuSchema as UIMenuSchema } from './menu/schema';
|
|
40
32
|
export { UniverMobileUIPlugin } from './mobile-plugin';
|
|
41
33
|
export { DISABLE_AUTO_FOCUS_KEY, UniverUIPlugin } from './plugin';
|
|
42
34
|
export { DesktopBeforeCloseService, IBeforeCloseService } from './services/before-close/before-close.service';
|
|
43
35
|
export { BrowserClipboardService, FILE__BMP_CLIPBOARD_MIME_TYPE, FILE__JPEG_CLIPBOARD_MIME_TYPE, FILE__WEBP_CLIPBOARD_MIME_TYPE, FILE_PNG_CLIPBOARD_MIME_TYPE, FILE_SVG_XML_CLIPBOARD_MIME_TYPE, HTML_CLIPBOARD_MIME_TYPE, IClipboardInterfaceService, imageMimeTypeSet, PLAIN_TEXT_CLIPBOARD_MIME_TYPE, } from './services/clipboard/clipboard-interface.service';
|
|
44
36
|
export { supportClipboardAPI } from './services/clipboard/clipboard-utils';
|
|
45
|
-
export { CopyCommand, CutCommand, PasteCommand, SheetPasteShortKeyCommandName } from './services/clipboard/clipboard.command';
|
|
37
|
+
export { CopyCommand, CutCommand, PasteCommand, SheetPasteShortKeyCommandName, } from './services/clipboard/clipboard.command';
|
|
46
38
|
export { DesktopConfirmService } from './services/confirm/desktop-confirm.service';
|
|
47
39
|
export { ContextMenuHostService, IContextMenuHostService } from './services/contextmenu/contextmenu-host.service';
|
|
48
|
-
export { ContextMenuService,
|
|
40
|
+
export { ContextMenuService, IContextMenuService } from './services/contextmenu/contextmenu.service';
|
|
41
|
+
export type { IContextMenuHandler } from './services/contextmenu/contextmenu.service';
|
|
49
42
|
export { DesktopDialogService } from './services/dialog/desktop-dialog.service';
|
|
50
43
|
export { IDialogService } from './services/dialog/dialog.service';
|
|
51
|
-
export { CanvasFloatDomService
|
|
52
|
-
export {
|
|
44
|
+
export { CanvasFloatDomService } from './services/dom/canvas-dom-layer.service';
|
|
45
|
+
export type { IFloatDom, IFloatDomLayout } from './services/dom/canvas-dom-layer.service';
|
|
46
|
+
export { FontService, IFontService } from './services/font.service';
|
|
47
|
+
export type { IFontConfig } from './services/font.service';
|
|
53
48
|
export { DesktopGalleryService } from './services/gallery/desktop-gallery.service';
|
|
54
49
|
export { IGalleryService } from './services/gallery/gallery.service';
|
|
55
50
|
export { DesktopLayoutService, ILayoutService } from './services/layout/layout.service';
|
|
56
51
|
export { DesktopLocalFileService } from './services/local-file/desktop-local-file.service';
|
|
57
|
-
export { ILocalFileService
|
|
52
|
+
export { ILocalFileService } from './services/local-file/local-file.service';
|
|
53
|
+
export type { IOpenFileOptions } from './services/local-file/local-file.service';
|
|
58
54
|
export { DesktopLocalStorageService } from './services/local-storage/local-storage.service';
|
|
59
|
-
export {
|
|
60
|
-
export {
|
|
55
|
+
export { MenuItemType } from './services/menu/menu';
|
|
56
|
+
export type { ICustomComponentProps, IDisplayMenuItem, IMenuButtonItem, IMenuItem, IMenuItemFactory, IMenuSelectorItem, IValueOption, MenuConfig, MenuItemConfig, MenuItemDefaultValueType, } from './services/menu/menu';
|
|
57
|
+
export { IMenuManagerService, MenuManagerService } from './services/menu/menu-manager.service';
|
|
58
|
+
export type { MenuSchemaType } from './services/menu/menu-manager.service';
|
|
61
59
|
export { type IMenuSchema } from './services/menu/menu-manager.service';
|
|
62
60
|
export { ContextMenuGroup, ContextMenuPosition, MenuManagerPosition, RibbonDataGroup, RibbonFormulasGroup, RibbonInsertGroup, RibbonOthersGroup, RibbonPosition, RibbonStartGroup, RibbonViewGroup, } from './services/menu/types';
|
|
63
|
-
export { MockMessageService } from './services/message/
|
|
61
|
+
export { MockMessageService } from './services/message/__tests__/mock-message.service';
|
|
64
62
|
export { DesktopMessageService } from './services/message/desktop-message.service';
|
|
65
63
|
export { IMessageService } from './services/message/message.service';
|
|
66
64
|
export { DesktopNotificationService } from './services/notification/desktop-notification.service';
|
|
67
65
|
export { INotificationService } from './services/notification/notification.service';
|
|
68
66
|
export { BuiltInUIPart, IUIPartsService, UIPartsService } from './services/parts/parts.service';
|
|
69
67
|
export { IPlatformService, PlatformService } from './services/platform/platform.service';
|
|
70
|
-
export { CanvasPopupService, ICanvasPopupService
|
|
68
|
+
export { CanvasPopupService, ICanvasPopupService } from './services/popup/canvas-popup.service';
|
|
69
|
+
export type { IPopup } from './services/popup/canvas-popup.service';
|
|
71
70
|
export { DesktopRibbonService, IRibbonService } from './services/ribbon/ribbon.service';
|
|
72
71
|
export { KeyCode, MetaKeys } from './services/shortcut/keycode';
|
|
73
72
|
export { ShortcutPanelService } from './services/shortcut/shortcut-panel.service';
|
|
74
|
-
export {
|
|
73
|
+
export { IShortcutService, ShortcutService } from './services/shortcut/shortcut.service';
|
|
74
|
+
export type { IShortcutItem } from './services/shortcut/shortcut.service';
|
|
75
75
|
export { DesktopSidebarService } from './services/sidebar/desktop-sidebar.service';
|
|
76
76
|
export { useSidebarClick } from './services/sidebar/hooks/use-sidebar-click';
|
|
77
77
|
export { ILeftSidebarService, ISidebarService } from './services/sidebar/sidebar.service';
|
|
78
78
|
export { ThemeSwitcherService } from './services/theme-switcher/theme-switcher.service';
|
|
79
|
-
export { DesktopZenZoneService } from './services/zen-zone/desktop-zen-zone.service';
|
|
80
|
-
export { IZenZoneService } from './services/zen-zone/zen-zone.service';
|
|
81
79
|
export * from './utils';
|
|
82
|
-
export {
|
|
80
|
+
export { COLOR_PICKER_COMPONENT } from './views/color-picker/interface';
|
|
81
|
+
export { ComponentContainer, useComponentsOfPart } from './views/components/ComponentContainer';
|
|
82
|
+
export type { IComponentContainerProps } from './views/components/ComponentContainer';
|
|
83
83
|
export type { IConfirmChildrenProps } from './views/components/confirm-part/interface';
|
|
84
84
|
export { type IConfirmPartMethodOptions } from './views/components/confirm-part/interface';
|
|
85
|
-
export { AnchoredContextMenu
|
|
85
|
+
export { AnchoredContextMenu } from './views/components/context-menu/AnchoredContextMenu';
|
|
86
|
+
export type { IContextMenuAnchorRect } from './views/components/context-menu/AnchoredContextMenu';
|
|
86
87
|
export { DesktopContextMenu as ContextMenu } from './views/components/context-menu/ContextMenu';
|
|
87
88
|
export { ContextMenuPanel } from './views/components/context-menu/ContextMenuPanel';
|
|
88
89
|
export { MobileContextMenu } from './views/components/context-menu/MobileContextMenu';
|
|
@@ -91,10 +92,21 @@ export { FloatDomSingle } from './views/components/dom/FloatDom';
|
|
|
91
92
|
export { FloatDom } from './views/components/dom/FloatDom';
|
|
92
93
|
export { PrintFloatDomSingle } from './views/components/dom/Print';
|
|
93
94
|
export { CanvasPopup, SingleCanvasPopup } from './views/components/popup/CanvasPopup';
|
|
94
|
-
export { RectPopup
|
|
95
|
+
export { RectPopup } from './views/components/popup/RectPopup';
|
|
96
|
+
export type { RectPopupDirection } from './views/components/popup/RectPopup';
|
|
95
97
|
export { useToolbarItemStatus } from './views/components/ribbon/hook';
|
|
96
98
|
export { Ribbon } from './views/components/ribbon/Ribbon';
|
|
97
99
|
export { ToolbarButton } from './views/components/ribbon/ToolbarButton';
|
|
98
100
|
export { ToolbarItem } from './views/components/ribbon/ToolbarItem';
|
|
99
|
-
export {
|
|
100
|
-
export {
|
|
101
|
+
export { Sidebar } from './views/components/sidebar/Sidebar';
|
|
102
|
+
export type { ISidebarMethodOptions } from './views/components/sidebar/Sidebar';
|
|
103
|
+
export { FontFamily } from './views/font-family/FontFamily';
|
|
104
|
+
export { FontFamilyItem } from './views/font-family/FontFamilyItem';
|
|
105
|
+
export { FONT_FAMILY_COMPONENT, FONT_FAMILY_ITEM_COMPONENT } from './views/font-family/interface';
|
|
106
|
+
export type { IFontFamilyProps } from './views/font-family/interface';
|
|
107
|
+
export { FontSize } from './views/font-size/FontSize';
|
|
108
|
+
export { FONT_SIZE_COMPONENT, FONT_SIZE_LIST, HEADING_LIST } from './views/font-size/interface';
|
|
109
|
+
export * from './views/hooks/index';
|
|
110
|
+
export * from './views/index';
|
|
111
|
+
export { type INotificationOptions } from './views/notification/Notification';
|
|
112
|
+
export { ProgressBar } from './views/progress-bar/ProgressBar';
|
|
@@ -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
|
+
import type { LocaleLeafKeys } from '@univerjs/core';
|
|
17
|
+
import type enUS from './en-US';
|
|
18
|
+
export type LocaleKey = LocaleLeafKeys<typeof enUS>;
|
|
@@ -20,14 +20,18 @@ import { Disposable, IConfigService, Injector } from '@univerjs/core';
|
|
|
20
20
|
import { Subject } from 'rxjs';
|
|
21
21
|
export declare const IMenuManagerService: import("@wendellhu/redi").IdentifierDecorator<IMenuManagerService>;
|
|
22
22
|
export type ContextMenuQuickLayout = 'icon' | 'tile';
|
|
23
|
+
export type ContextMenuQuickLayoutVariant = 'default' | 'compact';
|
|
23
24
|
export interface IMenuSchema {
|
|
24
25
|
key: string;
|
|
25
26
|
order: number;
|
|
26
27
|
title?: string;
|
|
27
28
|
contextual?: boolean;
|
|
28
29
|
item?: IMenuItem;
|
|
30
|
+
headerActionItem?: IMenuItem;
|
|
29
31
|
children?: IMenuSchema[];
|
|
30
32
|
quickLayout?: ContextMenuQuickLayout;
|
|
33
|
+
quickColumns?: number;
|
|
34
|
+
quickLayoutVariant?: ContextMenuQuickLayoutVariant;
|
|
31
35
|
tiny?: boolean;
|
|
32
36
|
}
|
|
33
37
|
export interface IMenuManagerService {
|
|
@@ -39,10 +43,14 @@ export interface IMenuManagerService {
|
|
|
39
43
|
}
|
|
40
44
|
export type MenuSchemaType = {
|
|
41
45
|
order?: number;
|
|
46
|
+
replace?: boolean;
|
|
42
47
|
menuItemFactory?: (accessor: IAccessor) => IMenuItem;
|
|
48
|
+
headerActionMenuItemFactory?: (accessor: IAccessor) => IMenuItem;
|
|
43
49
|
title?: string;
|
|
44
50
|
contextual?: boolean;
|
|
45
51
|
quickLayout?: ContextMenuQuickLayout;
|
|
52
|
+
quickColumns?: number;
|
|
53
|
+
quickLayoutVariant?: ContextMenuQuickLayoutVariant;
|
|
46
54
|
tiny?: boolean;
|
|
47
55
|
} | {
|
|
48
56
|
[key: string]: MenuSchemaType;
|
|
@@ -26,7 +26,13 @@ export declare enum MenuItemType {
|
|
|
26
26
|
/** Submenus have to specific features and do not invoke commands. */
|
|
27
27
|
SUBITEMS = 3
|
|
28
28
|
}
|
|
29
|
-
|
|
29
|
+
type MenuLabel = string | {
|
|
30
|
+
name: string;
|
|
31
|
+
hoverable?: boolean;
|
|
32
|
+
selectable?: boolean;
|
|
33
|
+
props?: Record<string, any>;
|
|
34
|
+
};
|
|
35
|
+
interface IMenuItemBase<TLocaleKey extends string, TValue> {
|
|
30
36
|
/** ID of the menu item. Normally it should be the same as the ID of the command that it would invoke. */
|
|
31
37
|
id: string;
|
|
32
38
|
/**
|
|
@@ -35,47 +41,35 @@ interface IMenuItemBase<V> {
|
|
|
35
41
|
*/
|
|
36
42
|
commandId?: string;
|
|
37
43
|
subId?: string;
|
|
38
|
-
title?:
|
|
44
|
+
title?: TLocaleKey;
|
|
39
45
|
description?: string;
|
|
40
46
|
icon?: string | Observable<string>;
|
|
41
|
-
tooltip?:
|
|
47
|
+
tooltip?: TLocaleKey;
|
|
42
48
|
slot?: boolean;
|
|
43
49
|
type: MenuItemType;
|
|
44
50
|
/**
|
|
45
51
|
* Custom label component id.
|
|
46
52
|
*/
|
|
47
|
-
label?:
|
|
48
|
-
name: string;
|
|
49
|
-
hoverable?: boolean;
|
|
50
|
-
selectable?: boolean;
|
|
51
|
-
props?: Record<string, any>;
|
|
52
|
-
};
|
|
53
|
+
label?: MenuLabel;
|
|
53
54
|
hidden$?: Observable<boolean>;
|
|
54
55
|
disabled$?: Observable<boolean>;
|
|
55
56
|
params?: any | Function;
|
|
56
57
|
/** On observable value that should emit the value of the corresponding selection component. */
|
|
57
|
-
value$?: Observable<
|
|
58
|
+
value$?: Observable<TValue>;
|
|
58
59
|
}
|
|
59
|
-
export interface IMenuButtonItem<
|
|
60
|
+
export interface IMenuButtonItem<TLocaleKey extends string = string, TValue = undefined> extends IMenuItemBase<TLocaleKey, TValue> {
|
|
60
61
|
type: MenuItemType.BUTTON;
|
|
61
62
|
activated$?: Observable<boolean>;
|
|
62
63
|
}
|
|
63
|
-
export interface IValueOption<
|
|
64
|
+
export interface IValueOption<TLocaleKey extends string = string, TValue = undefined> {
|
|
64
65
|
id?: string;
|
|
65
66
|
value?: string | number;
|
|
66
|
-
value$?: Observable<
|
|
67
|
+
value$?: Observable<TValue>;
|
|
67
68
|
params?: any;
|
|
68
69
|
slot?: boolean;
|
|
69
|
-
label?:
|
|
70
|
-
name: string;
|
|
71
|
-
hoverable?: boolean;
|
|
72
|
-
selectable?: boolean;
|
|
73
|
-
props?: Record<string, string | number | Array<{
|
|
74
|
-
[x: string | number]: string;
|
|
75
|
-
}>>;
|
|
76
|
-
};
|
|
70
|
+
label?: MenuLabel;
|
|
77
71
|
icon?: string;
|
|
78
|
-
tooltip?:
|
|
72
|
+
tooltip?: TLocaleKey;
|
|
79
73
|
style?: object;
|
|
80
74
|
disabled?: boolean;
|
|
81
75
|
commandId?: string;
|
|
@@ -84,7 +78,7 @@ export interface ICustomComponentProps<T> {
|
|
|
84
78
|
value: T;
|
|
85
79
|
onChange: (v: T) => void;
|
|
86
80
|
}
|
|
87
|
-
export interface IMenuSelectorItem<
|
|
81
|
+
export interface IMenuSelectorItem<TLocaleKey extends string = string, TValue = MenuItemDefaultValueType, TOptionValue = undefined> extends IMenuItemBase<TLocaleKey, TValue> {
|
|
88
82
|
type: MenuItemType.SELECTOR | MenuItemType.BUTTON_SELECTOR | MenuItemType.SUBITEMS;
|
|
89
83
|
/**
|
|
90
84
|
* If this property is set, changing the value of the selection will trigger the command with this id,
|
|
@@ -93,22 +87,22 @@ export interface IMenuSelectorItem<V = MenuItemDefaultValueType, T = undefined>
|
|
|
93
87
|
*/
|
|
94
88
|
selectionsCommandId?: string;
|
|
95
89
|
/** Options or IDs of registered components. */
|
|
96
|
-
selections?: Array<IValueOption<
|
|
90
|
+
selections?: Array<IValueOption<TLocaleKey, TOptionValue>> | Observable<Array<IValueOption<TLocaleKey, TOptionValue>>>;
|
|
97
91
|
/** If `type` is `MenuItemType.BUTTON_SELECTOR`, this determines if the button is activated. */
|
|
98
92
|
activated$?: Observable<boolean>;
|
|
99
93
|
}
|
|
100
|
-
export declare function isMenuSelectorItem<T extends MenuItemDefaultValueType>(v: IMenuItem): v is IMenuSelectorItem<T>;
|
|
101
|
-
export declare function isMenuButtonSelectorItem<T extends MenuItemDefaultValueType>(v: IMenuItem): v is IMenuSelectorItem<T>;
|
|
102
94
|
export type MenuItemDefaultValueType = string | number | undefined;
|
|
103
|
-
export type IMenuItem = IMenuButtonItem<MenuItemDefaultValueType> | IMenuSelectorItem<MenuItemDefaultValueType, any>;
|
|
104
|
-
export
|
|
95
|
+
export type IMenuItem<TLocaleKey extends string = string> = IMenuButtonItem<TLocaleKey, MenuItemDefaultValueType> | IMenuSelectorItem<TLocaleKey, MenuItemDefaultValueType, any>;
|
|
96
|
+
export declare function isMenuSelectorItem<T extends MenuItemDefaultValueType, TLocaleKey extends string = string>(v: IMenuItem<TLocaleKey>): v is IMenuSelectorItem<TLocaleKey, T, any>;
|
|
97
|
+
export declare function isMenuButtonSelectorItem<T extends MenuItemDefaultValueType, TLocaleKey extends string = string>(v: IMenuItem<TLocaleKey>): v is IMenuSelectorItem<TLocaleKey, T, any>;
|
|
98
|
+
export type IDisplayMenuItem<T extends IMenuItem = IMenuItem> = T & {
|
|
105
99
|
shortcut?: string;
|
|
106
100
|
};
|
|
107
|
-
export type MenuItemConfig = Partial<Omit<IMenuItem
|
|
101
|
+
export type MenuItemConfig<TLocaleKey extends string = string> = Partial<Omit<IMenuItem<TLocaleKey>, 'id' | 'subId' | 'value$' | 'hidden$' | 'disabled$' | 'activated$' | 'icon$'> & {
|
|
108
102
|
hidden?: boolean;
|
|
109
103
|
disabled?: boolean;
|
|
110
104
|
activated?: boolean;
|
|
111
105
|
}>;
|
|
112
|
-
export type MenuConfig = Record<string, MenuItemConfig
|
|
113
|
-
export type IMenuItemFactory = (accessor: IAccessor, menuConfig?: MenuConfig) => IMenuItem
|
|
106
|
+
export type MenuConfig<TLocaleKey extends string = string> = Record<string, MenuItemConfig<TLocaleKey>>;
|
|
107
|
+
export type IMenuItemFactory<TLocaleKey extends string = string> = (accessor: IAccessor, menuConfig?: MenuConfig<TLocaleKey>) => IMenuItem<TLocaleKey>;
|
|
114
108
|
export {};
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import type { IDisposable } from '@univerjs/core';
|
|
17
|
-
import type { INotificationOptions } from '../../
|
|
17
|
+
import type { INotificationOptions } from '../../views/notification/Notification';
|
|
18
18
|
import type { INotificationService } from './notification.service';
|
|
19
19
|
import { Disposable, Injector } from '@univerjs/core';
|
|
20
20
|
import { IUIPartsService } from '../parts/parts.service';
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import type { IDisposable } from '@univerjs/core';
|
|
17
|
-
import type { INotificationOptions } from '../../
|
|
17
|
+
import type { INotificationOptions } from '../../views/notification/Notification';
|
|
18
18
|
export declare const INotificationService: import("@wendellhu/redi").IdentifierDecorator<INotificationService>;
|
|
19
19
|
export interface INotificationService {
|
|
20
20
|
show(params: INotificationOptions): IDisposable;
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
interface IStorageDriver {
|
|
17
|
+
getItem<T>(key: string): Promise<T | null>;
|
|
18
|
+
setItem<T>(key: string, value: T): Promise<T>;
|
|
19
|
+
removeItem(key: string): Promise<void>;
|
|
20
|
+
clear(): Promise<void>;
|
|
21
|
+
key(index: number): Promise<string | null>;
|
|
22
|
+
keys(): Promise<string[]>;
|
|
23
|
+
iterate<T, U>(iteratee: (value: T, key: string, iterationNumber: number) => U): Promise<U>;
|
|
24
|
+
}
|
|
25
|
+
export declare const browserStorage: IStorageDriver;
|
|
26
|
+
export {};
|
|
@@ -20,5 +20,5 @@ export interface ICommonLabelProps {
|
|
|
20
20
|
label: string;
|
|
21
21
|
}[];
|
|
22
22
|
}
|
|
23
|
-
export declare const CommonLabel: (props: ICommonLabelProps) => import("react
|
|
23
|
+
export declare const CommonLabel: (props: ICommonLabelProps) => import("react").JSX.Element;
|
|
24
24
|
export declare const COMMON_LABEL_COMPONENT = "UI_PLUGIN_COMMON_LABEL_COMPONENT";
|
|
@@ -17,5 +17,5 @@ import type { NamedStyleType } from '@univerjs/core';
|
|
|
17
17
|
export declare const HeadingItem: (props: {
|
|
18
18
|
value: NamedStyleType;
|
|
19
19
|
text: string;
|
|
20
|
-
}) => import("react
|
|
20
|
+
}) => import("react").JSX.Element;
|
|
21
21
|
export declare const HEADING_ITEM_COMPONENT = "UI_COMPONENT_HEADING_ITEM";
|
|
@@ -13,4 +13,4 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
export declare function ConfirmPart(): import("react
|
|
16
|
+
export declare function ConfirmPart(): import("react").JSX.Element[];
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import type { IConfirmProps } from '@univerjs/design';
|
|
17
|
-
import type { ICustomLabelProps } from '
|
|
17
|
+
import type { ICustomLabelProps } from '../../custom-label/CustomLabel';
|
|
18
18
|
export interface IConfirmChildrenProps {
|
|
19
19
|
hooks: {
|
|
20
20
|
beforeConfirm?: () => Record<string, any>;
|
|
@@ -29,4 +29,4 @@ export interface IAnchoredContextMenuProps {
|
|
|
29
29
|
onRequestClose: () => void;
|
|
30
30
|
onOptionSelect?: (option: IValueOption) => void;
|
|
31
31
|
}
|
|
32
|
-
export declare function AnchoredContextMenu(props: IAnchoredContextMenuProps): import("react
|
|
32
|
+
export declare function AnchoredContextMenu(props: IAnchoredContextMenuProps): import("react").JSX.Element;
|
|
@@ -13,4 +13,4 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
export declare function DesktopContextMenu(): import("react
|
|
16
|
+
export declare function DesktopContextMenu(): import("react").JSX.Element;
|