@univerjs/ui 0.2.6 → 0.2.7
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 +6 -6
- package/lib/es/index.js +216 -175
- package/lib/types/components/editor/TextEditor.d.ts +3 -2
- package/lib/types/components/hooks/observable.d.ts +1 -0
- package/lib/types/index.d.ts +5 -2
- package/lib/types/services/editor/editor.service.d.ts +10 -4
- package/lib/types/services/layout/layout.service.d.ts +8 -8
- package/lib/types/services/menu/menu.d.ts +7 -1
- package/lib/types/services/shortcut/shortcut.service.d.ts +2 -1
- package/lib/types/services/sidebar/desktop-sidebar.service.d.ts +3 -1
- package/lib/types/services/sidebar/sidebar.service.d.ts +5 -2
- package/lib/types/views/components/doc-bars/hook.d.ts +1 -1
- package/lib/types/views/components/sidebar/interface.d.ts +1 -0
- package/lib/types/views/workbench/Workbench.d.ts +1 -1
- package/lib/umd/index.js +6 -6
- package/package.json +14 -14
|
@@ -7,11 +7,12 @@ export interface ITextEditorProps {
|
|
|
7
7
|
id: string;
|
|
8
8
|
className?: string;
|
|
9
9
|
snapshot?: IDocumentData;
|
|
10
|
+
value?: string;
|
|
10
11
|
resizeCallBack?: (editor: Nullable<HTMLDivElement>) => void;
|
|
11
12
|
cancelDefaultResizeListener?: boolean;
|
|
12
|
-
isSheetEditor?: boolean;
|
|
13
13
|
canvasStyle?: IEditorCanvasStyle;
|
|
14
|
-
|
|
14
|
+
isSheetEditor?: boolean;
|
|
15
|
+
isFormulaEditor?: boolean;
|
|
15
16
|
isSingle?: boolean;
|
|
16
17
|
isReadonly?: boolean;
|
|
17
18
|
onlyInputFormula?: boolean;
|
|
@@ -5,6 +5,7 @@ type ObservableOrFn<T> = Observable<T> | (() => Observable<T>);
|
|
|
5
5
|
export declare function useObservable<T>(observable: ObservableOrFn<T>, defaultValue: T | undefined, shouldHaveSyncValue?: true): T;
|
|
6
6
|
export declare function useObservable<T>(observable: Nullable<ObservableOrFn<T>>, defaultValue: T): T;
|
|
7
7
|
export declare function useObservable<T>(observable: Nullable<ObservableOrFn<T>>, defaultValue?: undefined): T | undefined;
|
|
8
|
+
export declare function useObservable<T>(observable: Nullable<ObservableOrFn<T>>, defaultValue: T, shouldHaveSyncValue?: boolean, deps?: any[]): T;
|
|
8
9
|
export declare function useObservable<T>(observable: Nullable<ObservableOrFn<T>>, defaultValue: undefined, shouldHaveSyncValue: true, deps?: any[]): T;
|
|
9
10
|
export declare function useObservable<T>(observable: Nullable<ObservableOrFn<T>>, defaultValue?: T, shouldHaveSyncValue?: boolean, deps?: any[]): T | undefined;
|
|
10
11
|
export {};
|
package/lib/types/index.d.ts
CHANGED
|
@@ -46,7 +46,7 @@ export { IGlobalZoneService } from './services/global-zone/global-zone.service';
|
|
|
46
46
|
export { KeyCode, MetaKeys } from './services/shortcut/keycode';
|
|
47
47
|
export { ShortcutService, type IShortcutItem, IShortcutService } from './services/shortcut/shortcut.service';
|
|
48
48
|
export { DesktopSidebarService } from './services/sidebar/desktop-sidebar.service';
|
|
49
|
-
export { ISidebarService } from './services/sidebar/sidebar.service';
|
|
49
|
+
export { ISidebarService, ILeftSidebarService } from './services/sidebar/sidebar.service';
|
|
50
50
|
export { IZenZoneService } from './services/zen-zone/zen-zone.service';
|
|
51
51
|
export { UniverUIPlugin, DISABLE_AUTO_FOCUS_KEY } from './ui-plugin';
|
|
52
52
|
export { UniverMobileUIPlugin } from './mobile-ui-plugin';
|
|
@@ -54,7 +54,7 @@ export * from './utils';
|
|
|
54
54
|
export { Menu } from './components/menu/desktop/Menu';
|
|
55
55
|
export { type IConfirmPartMethodOptions } from './views/components/confirm-part/interface';
|
|
56
56
|
export { ComponentContainer, useComponentsOfPart, type IComponentContainerProps } from './views/components/ComponentContainer';
|
|
57
|
-
export { IEditorService, EditorService } from './services/editor/editor.service';
|
|
57
|
+
export { IEditorService, EditorService, Editor } from './services/editor/editor.service';
|
|
58
58
|
export { TextEditor } from './components/editor/TextEditor';
|
|
59
59
|
export { RangeSelector } from './components/range-selector/RangeSelector';
|
|
60
60
|
export { ProgressBar } from './components/progress-bar/ProgressBar';
|
|
@@ -74,11 +74,14 @@ export { GlobalZone } from './views/components/global-zone/GlobalZone';
|
|
|
74
74
|
export { builtInGlobalComponents } from './views/parts';
|
|
75
75
|
export { DesktopContextMenu as ContextMenu } from './views/components/context-menu/ContextMenu';
|
|
76
76
|
export { Sidebar } from './views/components/sidebar/Sidebar';
|
|
77
|
+
export { type ISidebarMethodOptions } from './views/components/sidebar/interface';
|
|
77
78
|
export { ZenZone } from './views/components/zen-zone/ZenZone';
|
|
78
79
|
export { CanvasPopup } from './views/components/popup/CanvasPopup';
|
|
79
80
|
export { CanvasFloatDomService, type IFloatDomLayout } from './services/dom/canvas-dom-layer.service';
|
|
80
81
|
export { FloatDom } from './views/components/dom/FloatDom';
|
|
81
82
|
export { MobileContextMenu } from './views/components/context-menu/MobileContextMenu';
|
|
82
83
|
export { Toolbar } from './views/components/doc-bars/Toolbar';
|
|
84
|
+
export { ToolbarItem } from './views/components/doc-bars/ToolbarItem';
|
|
85
|
+
export { ToolbarButton } from './views/components/doc-bars/Button/ToolbarButton';
|
|
83
86
|
export { ToggleShortcutPanelOperation } from './commands/operations/toggle-shortcut-panel.operation';
|
|
84
87
|
export { SetEditorResizeOperation } from './commands/operations/editor/set-editor-resize.operation';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DocumentDataModel, IDisposable, IDocumentBody, IDocumentData, IPosition, Nullable, Disposable, IContextService, IUniverInstanceService } from '@univerjs/core';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
|
-
import { IRender,
|
|
3
|
+
import { IRender, ISuccinctDocRangeParam, IRenderManagerService } from '@univerjs/engine-render';
|
|
4
4
|
import { LexerTreeBuilder } from '@univerjs/engine-formula';
|
|
5
5
|
|
|
6
6
|
export interface IEditorStateParam extends Partial<IPosition> {
|
|
@@ -15,6 +15,11 @@ export interface IEditorConfigParam {
|
|
|
15
15
|
cancelDefaultResizeListener?: boolean;
|
|
16
16
|
canvasStyle?: IEditorCanvasStyle;
|
|
17
17
|
isSheetEditor: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* If the editor is for formula editing.
|
|
20
|
+
* @deprecated this is a temp fix before refactoring editor.
|
|
21
|
+
*/
|
|
22
|
+
isFormulaEditor: boolean;
|
|
18
23
|
isSingle: boolean;
|
|
19
24
|
isReadonly: boolean;
|
|
20
25
|
onlyInputFormula: boolean;
|
|
@@ -65,6 +70,8 @@ export declare class Editor {
|
|
|
65
70
|
getBoundingClientRect(): DOMRect;
|
|
66
71
|
isVisible(): boolean | undefined;
|
|
67
72
|
isSheetEditor(): boolean;
|
|
73
|
+
/** @deprecated */
|
|
74
|
+
isFormulaEditor(): boolean;
|
|
68
75
|
getValue(): string;
|
|
69
76
|
getBody(): IDocumentBody | undefined;
|
|
70
77
|
update(param: Partial<IEditorSetParam>): void;
|
|
@@ -98,7 +105,7 @@ export interface IEditorService {
|
|
|
98
105
|
closeRangePrompt(): void;
|
|
99
106
|
blur$: Observable<unknown>;
|
|
100
107
|
blur(): void;
|
|
101
|
-
focus$: Observable<
|
|
108
|
+
focus$: Observable<ISuccinctDocRangeParam>;
|
|
102
109
|
focus(editorUnitId?: string): void;
|
|
103
110
|
setValue$: Observable<IEditorSetValueParam>;
|
|
104
111
|
valueChange$: Observable<Readonly<Editor>>;
|
|
@@ -141,7 +148,7 @@ export declare class EditorService extends Disposable implements IEditorService,
|
|
|
141
148
|
private readonly _blur$;
|
|
142
149
|
readonly blur$: Observable<unknown>;
|
|
143
150
|
private readonly _focus$;
|
|
144
|
-
readonly focus$: Observable<
|
|
151
|
+
readonly focus$: Observable<ISuccinctDocRangeParam>;
|
|
145
152
|
private readonly _setValue$;
|
|
146
153
|
readonly setValue$: Observable<IEditorSetValueParam>;
|
|
147
154
|
private readonly _valueChange$;
|
|
@@ -187,7 +194,6 @@ export declare class EditorService extends Disposable implements IEditorService,
|
|
|
187
194
|
checkValueLegality(editorUnitId: string): boolean;
|
|
188
195
|
private _refreshValueChange;
|
|
189
196
|
private _getCurrentEditorUnitId;
|
|
190
|
-
private _refresh;
|
|
191
197
|
private _getBlank;
|
|
192
198
|
}
|
|
193
199
|
export declare const IEditorService: import('@univerjs/core').IdentifierDecorator<IEditorService>;
|
|
@@ -12,13 +12,13 @@ export interface ILayoutService {
|
|
|
12
12
|
registerFocusHandler(type: UniverInstanceType, handler: FocusHandlerFn): IDisposable;
|
|
13
13
|
/** Register the root container element. */
|
|
14
14
|
registerRootContainerElement(container: HTMLElement): IDisposable;
|
|
15
|
-
/** Register a
|
|
16
|
-
|
|
15
|
+
/** Register a content element. */
|
|
16
|
+
registerContentElement(container: HTMLElement): IDisposable;
|
|
17
17
|
/** Register an element as a container, especially floating components like Dialogs and Notifications. */
|
|
18
18
|
registerContainerElement(container: HTMLElement): IDisposable;
|
|
19
|
-
|
|
19
|
+
getContentElement(): HTMLElement;
|
|
20
20
|
checkElementInCurrentContainers(element: HTMLElement): boolean;
|
|
21
|
-
|
|
21
|
+
checkContentIsFocused(): boolean;
|
|
22
22
|
}
|
|
23
23
|
export declare const ILayoutService: import('@univerjs/core').IdentifierDecorator<ILayoutService>;
|
|
24
24
|
/**
|
|
@@ -33,18 +33,18 @@ export declare class DesktopLayoutService extends Disposable implements ILayoutS
|
|
|
33
33
|
private _isFocused;
|
|
34
34
|
get isFocused(): boolean;
|
|
35
35
|
private readonly _focusHandlers;
|
|
36
|
-
private
|
|
36
|
+
private _contentElements;
|
|
37
37
|
private _allContainers;
|
|
38
38
|
constructor(_contextService: ContextService, _univerInstanceService: IUniverInstanceService, _editorService: IEditorService);
|
|
39
39
|
get rootContainerElement(): Nullable<HTMLElement>;
|
|
40
40
|
focus(): void;
|
|
41
41
|
registerFocusHandler(type: UniverInstanceType, handler: FocusHandlerFn): IDisposable;
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
registerContentElement(container: HTMLElement): IDisposable;
|
|
43
|
+
getContentElement(): HTMLElement;
|
|
44
44
|
registerRootContainerElement(container: HTMLElement): IDisposable;
|
|
45
45
|
registerContainerElement(container: HTMLElement): IDisposable;
|
|
46
46
|
checkElementInCurrentContainers(element: HTMLElement): boolean;
|
|
47
|
-
|
|
47
|
+
checkContentIsFocused(): boolean;
|
|
48
48
|
private _initUniverFocusListener;
|
|
49
49
|
private _initEditorStatus;
|
|
50
50
|
private _blurSheetEditor;
|
|
@@ -38,6 +38,11 @@ export declare enum MenuItemType {
|
|
|
38
38
|
interface IMenuItemBase<V> {
|
|
39
39
|
/** ID of the menu item. Normally it should be the same as the ID of the command that it would invoke. */
|
|
40
40
|
id: string;
|
|
41
|
+
/**
|
|
42
|
+
* If two menus reuse the same command (e.g. copy & paste command). They should have the same command
|
|
43
|
+
* id and different ids.
|
|
44
|
+
*/
|
|
45
|
+
commandId?: string;
|
|
41
46
|
subId?: string;
|
|
42
47
|
title?: string;
|
|
43
48
|
description?: string;
|
|
@@ -66,6 +71,7 @@ export interface IMenuButtonItem<V = undefined> extends IMenuItemBase<V> {
|
|
|
66
71
|
activated$?: Observable<boolean>;
|
|
67
72
|
}
|
|
68
73
|
export interface IValueOption<T = undefined> {
|
|
74
|
+
id?: string;
|
|
69
75
|
value?: string | number;
|
|
70
76
|
value$?: Observable<T>;
|
|
71
77
|
label?: string | {
|
|
@@ -79,7 +85,7 @@ export interface IValueOption<T = undefined> {
|
|
|
79
85
|
tooltip?: string;
|
|
80
86
|
style?: object;
|
|
81
87
|
disabled?: boolean;
|
|
82
|
-
|
|
88
|
+
commandId?: string;
|
|
83
89
|
}
|
|
84
90
|
export interface ICustomComponentProps<T> {
|
|
85
91
|
value: T;
|
|
@@ -2,6 +2,7 @@ import { Disposable, ICommandService, IContextService, IDisposable } from '@univ
|
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
import { ILayoutService } from '../layout/layout.service';
|
|
4
4
|
import { IPlatformService } from '../platform/platform.service';
|
|
5
|
+
import { KeyCode } from './keycode';
|
|
5
6
|
|
|
6
7
|
export interface IShortcutItem<P extends object = object> {
|
|
7
8
|
/** This should reuse the corresponding command's id. */
|
|
@@ -13,7 +14,7 @@ export interface IShortcutItem<P extends object = object> {
|
|
|
13
14
|
/** A callback that will be triggered to examine if the shortcut should be invoked. */
|
|
14
15
|
preconditions?: (contextService: IContextService) => boolean;
|
|
15
16
|
/** A command can be bound to several bindings, with different static parameters perhaps. */
|
|
16
|
-
binding: number;
|
|
17
|
+
binding: KeyCode | number;
|
|
17
18
|
mac?: number;
|
|
18
19
|
win?: number;
|
|
19
20
|
linux?: number;
|
|
@@ -7,6 +7,8 @@ export declare class DesktopSidebarService implements ISidebarService {
|
|
|
7
7
|
private _sidebarOptions;
|
|
8
8
|
readonly sidebarOptions$: Subject<ISidebarMethodOptions>;
|
|
9
9
|
readonly scrollEvent$: Subject<Event>;
|
|
10
|
+
get visible(): boolean;
|
|
11
|
+
get options(): ISidebarMethodOptions;
|
|
10
12
|
open(params: ISidebarMethodOptions): IDisposable;
|
|
11
|
-
close(): void;
|
|
13
|
+
close(id?: string): void;
|
|
12
14
|
}
|
|
@@ -2,10 +2,13 @@ import { IDisposable } from '@univerjs/core';
|
|
|
2
2
|
import { Subject } from 'rxjs';
|
|
3
3
|
import { ISidebarMethodOptions } from '../../views/components/sidebar/interface';
|
|
4
4
|
|
|
5
|
-
export declare const ISidebarService: import('@univerjs/core').IdentifierDecorator<ISidebarService>;
|
|
6
5
|
export interface ISidebarService {
|
|
7
6
|
readonly sidebarOptions$: Subject<ISidebarMethodOptions>;
|
|
8
7
|
readonly scrollEvent$: Subject<Event>;
|
|
9
8
|
open(params: ISidebarMethodOptions): IDisposable;
|
|
10
|
-
close(): void;
|
|
9
|
+
close(id?: string): void;
|
|
10
|
+
get visible(): boolean;
|
|
11
|
+
get options(): ISidebarMethodOptions;
|
|
11
12
|
}
|
|
13
|
+
export declare const ILeftSidebarService: import('@univerjs/core').IdentifierDecorator<ISidebarService>;
|
|
14
|
+
export declare const ISidebarService: import('@univerjs/core').IdentifierDecorator<ISidebarService>;
|
|
@@ -20,7 +20,7 @@ export interface IToolbarRenderHookHandler {
|
|
|
20
20
|
* you can use this hook to get the toolbar status.
|
|
21
21
|
* @returns toolbar status
|
|
22
22
|
*/
|
|
23
|
-
export declare function useToolbarGroups(categories: MenuPositionWithCustom[]): IToolbarRenderHookHandler;
|
|
23
|
+
export declare function useToolbarGroups(categories: MenuPositionWithCustom[], initCategory?: string): IToolbarRenderHookHandler;
|
|
24
24
|
export interface IToolbarItemStatus {
|
|
25
25
|
disabled: boolean;
|
|
26
26
|
value: any;
|
|
@@ -3,6 +3,6 @@ import { IWorkbenchOptions } from '../../controllers/ui/ui.controller';
|
|
|
3
3
|
|
|
4
4
|
export interface IUniverWorkbenchProps extends IWorkbenchOptions {
|
|
5
5
|
mountContainer: HTMLElement;
|
|
6
|
-
onRendered?: (
|
|
6
|
+
onRendered?: (containerElement: HTMLElement) => void;
|
|
7
7
|
}
|
|
8
8
|
export declare function DesktopWorkbench(props: IUniverWorkbenchProps): React.JSX.Element;
|