@univerjs/ui 0.2.15 → 0.3.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +14 -13
- package/lib/es/index.js +987 -1575
- package/lib/index.css +1 -1
- package/lib/types/components/custom-label/CustomLabel.d.ts +1 -2
- package/lib/types/index.d.ts +4 -8
- package/lib/types/services/layout/layout.service.d.ts +2 -5
- package/lib/types/utils/util.d.ts +0 -1
- package/lib/umd/index.js +14 -13
- package/package.json +15 -19
- package/lib/types/components/editor/TextEditor.d.ts +0 -35
- package/lib/types/components/range-selector/RangeSelector.d.ts +0 -21
- package/lib/types/services/editor/editor.service.d.ts +0 -198
- package/lib/types/services/range-selector/range-selector.service.d.ts +0 -32
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0-alpha.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "UniverSheet normal plugin UI manager",
|
|
6
6
|
"author": "DreamNum <developer@univer.ai>",
|
|
@@ -20,9 +20,6 @@
|
|
|
20
20
|
"keywords": [
|
|
21
21
|
"univer"
|
|
22
22
|
],
|
|
23
|
-
"sideEffects": [
|
|
24
|
-
"**/*.css"
|
|
25
|
-
],
|
|
26
23
|
"exports": {
|
|
27
24
|
".": {
|
|
28
25
|
"import": "./lib/es/index.js",
|
|
@@ -54,22 +51,21 @@
|
|
|
54
51
|
"react": "^16.9.0 || ^17.0.0 || ^18.0.0",
|
|
55
52
|
"react-dom": "^16.9.0 || ^17.0.0 || ^18.0.0",
|
|
56
53
|
"rxjs": ">=7.0.0",
|
|
57
|
-
"@univerjs/core": "0.
|
|
58
|
-
"@univerjs/
|
|
59
|
-
"@univerjs/engine-
|
|
60
|
-
"@univerjs/ui": "0.
|
|
61
|
-
"@univerjs/design": "0.2.15"
|
|
54
|
+
"@univerjs/core": "0.3.0-alpha.1",
|
|
55
|
+
"@univerjs/design": "0.3.0-alpha.1",
|
|
56
|
+
"@univerjs/engine-render": "0.3.0-alpha.1",
|
|
57
|
+
"@univerjs/ui": "0.3.0-alpha.1"
|
|
62
58
|
},
|
|
63
59
|
"dependencies": {
|
|
64
60
|
"@univerjs/icons": "^0.1.78",
|
|
65
61
|
"clsx": "^2.1.1",
|
|
66
62
|
"localforage": "^1.10.0",
|
|
67
|
-
"rc-notification": "^5.6.
|
|
63
|
+
"rc-notification": "^5.6.1",
|
|
68
64
|
"rc-util": "^5.43.0",
|
|
69
|
-
"@univerjs/core": "0.
|
|
70
|
-
"@univerjs/design": "0.
|
|
71
|
-
"@univerjs/engine-
|
|
72
|
-
"@univerjs/engine-
|
|
65
|
+
"@univerjs/core": "0.3.0-alpha.1",
|
|
66
|
+
"@univerjs/design": "0.3.0-alpha.1",
|
|
67
|
+
"@univerjs/engine-formula": "0.3.0-alpha.1",
|
|
68
|
+
"@univerjs/engine-render": "0.3.0-alpha.1"
|
|
73
69
|
},
|
|
74
70
|
"optionalDependencies": {
|
|
75
71
|
"vue": ">=3.0.0"
|
|
@@ -77,7 +73,7 @@
|
|
|
77
73
|
"devDependencies": {
|
|
78
74
|
"@testing-library/react": "^16.0.1",
|
|
79
75
|
"@testing-library/react-hooks": "^8.0.1",
|
|
80
|
-
"@types/react": "^18.3.
|
|
76
|
+
"@types/react": "^18.3.9",
|
|
81
77
|
"@types/react-dom": "^18.3.0",
|
|
82
78
|
"@types/react-transition-group": "^4.4.11",
|
|
83
79
|
"less": "^4.2.0",
|
|
@@ -85,10 +81,10 @@
|
|
|
85
81
|
"react-dom": "18.3.1",
|
|
86
82
|
"rxjs": "^7.8.1",
|
|
87
83
|
"typescript": "^5.6.2",
|
|
88
|
-
"vite": "^5.4.
|
|
89
|
-
"vitest": "^2.
|
|
90
|
-
"vue": "^3.5.
|
|
91
|
-
"@univerjs-infra/shared": "0.
|
|
84
|
+
"vite": "^5.4.8",
|
|
85
|
+
"vitest": "^2.1.1",
|
|
86
|
+
"vue": "^3.5.9",
|
|
87
|
+
"@univerjs-infra/shared": "0.3.0-alpha.1"
|
|
92
88
|
},
|
|
93
89
|
"univerSpace": {
|
|
94
90
|
".": {
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { default as React } from 'react';
|
|
2
|
-
import { IDocumentData, Nullable } from '@univerjs/core';
|
|
3
|
-
import { IEditorCanvasStyle } from '../../services/editor/editor.service';
|
|
4
|
-
type MyComponentProps = React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
|
|
5
|
-
export interface ITextEditorProps {
|
|
6
|
-
id: string;
|
|
7
|
-
className?: string;
|
|
8
|
-
snapshot?: IDocumentData;
|
|
9
|
-
value?: string;
|
|
10
|
-
resizeCallBack?: (editor: Nullable<HTMLDivElement>) => void;
|
|
11
|
-
cancelDefaultResizeListener?: boolean;
|
|
12
|
-
canvasStyle?: IEditorCanvasStyle;
|
|
13
|
-
isSheetEditor?: boolean;
|
|
14
|
-
isFormulaEditor?: boolean;
|
|
15
|
-
isSingle?: boolean;
|
|
16
|
-
isReadonly?: boolean;
|
|
17
|
-
onlyInputFormula?: boolean;
|
|
18
|
-
onlyInputRange?: boolean;
|
|
19
|
-
onlyInputContent?: boolean;
|
|
20
|
-
isSingleChoice?: boolean;
|
|
21
|
-
openForSheetUnitId?: Nullable<string>;
|
|
22
|
-
openForSheetSubUnitId?: Nullable<string>;
|
|
23
|
-
onChange?: (value: Nullable<string>) => void;
|
|
24
|
-
onActive?: (state: boolean) => void;
|
|
25
|
-
onValid?: (state: boolean) => void;
|
|
26
|
-
placeholder?: string;
|
|
27
|
-
isValueValid?: boolean;
|
|
28
|
-
disbaled?: boolean;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* The component to render toolbar item label and menu item label.
|
|
32
|
-
* @param props
|
|
33
|
-
*/
|
|
34
|
-
export declare function TextEditor(props: ITextEditorProps & Omit<MyComponentProps, 'onChange' | 'onActive'>): JSX.Element | null;
|
|
35
|
-
export {};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { default as React } from 'react';
|
|
2
|
-
import { IUnitRangeWithName, Nullable } from '@univerjs/core';
|
|
3
|
-
export interface IRangeSelectorProps {
|
|
4
|
-
id: string;
|
|
5
|
-
value?: string;
|
|
6
|
-
onChange?: (ranges: IUnitRangeWithName[]) => void;
|
|
7
|
-
onActive?: (state: boolean) => void;
|
|
8
|
-
onValid?: (state: boolean) => void;
|
|
9
|
-
isSingleChoice?: boolean;
|
|
10
|
-
isReadonly?: boolean;
|
|
11
|
-
openForSheetUnitId?: Nullable<string>;
|
|
12
|
-
openForSheetSubUnitId?: Nullable<string>;
|
|
13
|
-
width?: number | string;
|
|
14
|
-
size?: 'mini' | 'small' | 'middle' | 'large';
|
|
15
|
-
placeholder?: string;
|
|
16
|
-
className?: string;
|
|
17
|
-
textEditorClassName?: string;
|
|
18
|
-
onSelectorVisibleChange?: (visible: boolean) => void;
|
|
19
|
-
disableInput?: boolean;
|
|
20
|
-
}
|
|
21
|
-
export declare function RangeSelector(props: IRangeSelectorProps): React.JSX.Element;
|
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
import { Disposable, IContextService, IUniverInstanceService, DocumentDataModel, IDisposable, IDocumentBody, IDocumentData, IPosition, Nullable } from '@univerjs/core';
|
|
2
|
-
import { LexerTreeBuilder } from '@univerjs/engine-formula';
|
|
3
|
-
import { IRenderManagerService, IRender, ISuccinctDocRangeParam } from '@univerjs/engine-render';
|
|
4
|
-
import { Observable } from 'rxjs';
|
|
5
|
-
export interface IEditorStateParam extends Partial<IPosition> {
|
|
6
|
-
visible?: boolean;
|
|
7
|
-
}
|
|
8
|
-
export interface IEditorCanvasStyle {
|
|
9
|
-
fontSize?: number;
|
|
10
|
-
}
|
|
11
|
-
export interface IEditorConfigParam {
|
|
12
|
-
editorUnitId: string;
|
|
13
|
-
initialSnapshot?: IDocumentData;
|
|
14
|
-
cancelDefaultResizeListener?: boolean;
|
|
15
|
-
canvasStyle?: IEditorCanvasStyle;
|
|
16
|
-
isSheetEditor: boolean;
|
|
17
|
-
/**
|
|
18
|
-
* If the editor is for formula editing.
|
|
19
|
-
* @deprecated this is a temp fix before refactoring editor.
|
|
20
|
-
*/
|
|
21
|
-
isFormulaEditor: boolean;
|
|
22
|
-
isSingle: boolean;
|
|
23
|
-
isReadonly: boolean;
|
|
24
|
-
onlyInputFormula: boolean;
|
|
25
|
-
onlyInputRange: boolean;
|
|
26
|
-
onlyInputContent: boolean;
|
|
27
|
-
isSingleChoice: boolean;
|
|
28
|
-
openForSheetUnitId: Nullable<string>;
|
|
29
|
-
openForSheetSubUnitId: Nullable<string>;
|
|
30
|
-
}
|
|
31
|
-
export interface IEditorSetParam extends IEditorConfigParam, IEditorStateParam {
|
|
32
|
-
render: IRender;
|
|
33
|
-
documentDataModel: DocumentDataModel;
|
|
34
|
-
editorDom: HTMLDivElement;
|
|
35
|
-
}
|
|
36
|
-
export interface IEditorSetValueParam {
|
|
37
|
-
editorUnitId: string;
|
|
38
|
-
body: IDocumentBody;
|
|
39
|
-
}
|
|
40
|
-
export interface IEditorInputFormulaParam {
|
|
41
|
-
editorUnitId: string;
|
|
42
|
-
formulaString: string;
|
|
43
|
-
}
|
|
44
|
-
export declare class Editor {
|
|
45
|
-
private _param;
|
|
46
|
-
private _focus;
|
|
47
|
-
private _valueLegality;
|
|
48
|
-
private _openForSheetUnitId;
|
|
49
|
-
private _openForSheetSubUnitId;
|
|
50
|
-
constructor(_param: IEditorSetParam);
|
|
51
|
-
get documentDataModel(): DocumentDataModel;
|
|
52
|
-
get editorUnitId(): string;
|
|
53
|
-
get cancelDefaultResizeListener(): boolean | undefined;
|
|
54
|
-
get render(): IRender;
|
|
55
|
-
isSingleChoice(): boolean;
|
|
56
|
-
setOpenForSheetUnitId(unitId: Nullable<string>): void;
|
|
57
|
-
getOpenForSheetUnitId(): Nullable<string>;
|
|
58
|
-
setOpenForSheetSubUnitId(subUnitId: Nullable<string>): void;
|
|
59
|
-
getOpenForSheetSubUnitId(): Nullable<string>;
|
|
60
|
-
isValueLegality(): boolean;
|
|
61
|
-
setValueLegality(state?: boolean): void;
|
|
62
|
-
isFocus(): boolean;
|
|
63
|
-
setFocus(state?: boolean): void;
|
|
64
|
-
isSingle(): boolean;
|
|
65
|
-
isReadOnly(): boolean;
|
|
66
|
-
onlyInputContent(): boolean;
|
|
67
|
-
onlyInputFormula(): boolean;
|
|
68
|
-
onlyInputRange(): boolean;
|
|
69
|
-
getBoundingClientRect(): DOMRect;
|
|
70
|
-
isVisible(): boolean | undefined;
|
|
71
|
-
isSheetEditor(): boolean;
|
|
72
|
-
/** @deprecated */
|
|
73
|
-
isFormulaEditor(): boolean;
|
|
74
|
-
getValue(): string;
|
|
75
|
-
getBody(): IDocumentBody | undefined;
|
|
76
|
-
update(param: Partial<IEditorSetParam>): void;
|
|
77
|
-
verticalAlign(): void;
|
|
78
|
-
updateCanvasStyle(): void;
|
|
79
|
-
}
|
|
80
|
-
export interface IEditorService {
|
|
81
|
-
getEditor(id?: string): Readonly<Nullable<Editor>>;
|
|
82
|
-
register(config: IEditorConfigParam, container: HTMLDivElement): IDisposable;
|
|
83
|
-
isVisible(id: string): Nullable<boolean>;
|
|
84
|
-
inputFormula$: Observable<IEditorInputFormulaParam>;
|
|
85
|
-
setFormula(formulaString: string): void;
|
|
86
|
-
resize$: Observable<string>;
|
|
87
|
-
resize(id: string): void;
|
|
88
|
-
getAllEditor(): Map<string, Editor>;
|
|
89
|
-
/**
|
|
90
|
-
* The sheet currently being operated on will determine
|
|
91
|
-
* whether to include unitId information in the ref.
|
|
92
|
-
*/
|
|
93
|
-
setOperationSheetUnitId(unitId: Nullable<string>): void;
|
|
94
|
-
getOperationSheetUnitId(): Nullable<string>;
|
|
95
|
-
/**
|
|
96
|
-
* The sub-table within the sheet currently being operated on
|
|
97
|
-
* will determine whether to include subUnitId information in the ref.
|
|
98
|
-
*/
|
|
99
|
-
setOperationSheetSubUnitId(sheetId: Nullable<string>): void;
|
|
100
|
-
getOperationSheetSubUnitId(): Nullable<string>;
|
|
101
|
-
isEditor(editorUnitId: string): boolean;
|
|
102
|
-
isSheetEditor(editorUnitId: string): boolean;
|
|
103
|
-
closeRangePrompt$: Observable<unknown>;
|
|
104
|
-
closeRangePrompt(): void;
|
|
105
|
-
blur$: Observable<unknown>;
|
|
106
|
-
blur(): void;
|
|
107
|
-
focus$: Observable<ISuccinctDocRangeParam>;
|
|
108
|
-
focus(editorUnitId?: string): void;
|
|
109
|
-
setValue$: Observable<IEditorSetValueParam>;
|
|
110
|
-
valueChange$: Observable<Readonly<Editor>>;
|
|
111
|
-
setValue(val: string, editorUnitId?: string): void;
|
|
112
|
-
setValueNoRefresh(val: string, editorUnitId?: string): void;
|
|
113
|
-
setRichValue(body: IDocumentBody, editorUnitId?: string): void;
|
|
114
|
-
getFirstEditor(): Editor;
|
|
115
|
-
focusStyle$: Observable<Nullable<string>>;
|
|
116
|
-
focusStyle(editorUnitId: Nullable<string>): void;
|
|
117
|
-
refreshValueChange(editorId: string): void;
|
|
118
|
-
checkValueLegality(editorId: string): boolean;
|
|
119
|
-
getValue(id: string): Nullable<string>;
|
|
120
|
-
getRichValue(id: string): Nullable<IDocumentBody>;
|
|
121
|
-
changeSpreadsheetFocusState(state: boolean): void;
|
|
122
|
-
getSpreadsheetFocusState(): boolean;
|
|
123
|
-
selectionChangingState(): boolean;
|
|
124
|
-
singleSelection$: Observable<boolean>;
|
|
125
|
-
singleSelection(state: boolean): void;
|
|
126
|
-
setFocusId(id: Nullable<string>): void;
|
|
127
|
-
getFocusId(): Nullable<string>;
|
|
128
|
-
getFocusEditor(): Readonly<Nullable<Editor>>;
|
|
129
|
-
}
|
|
130
|
-
export declare class EditorService extends Disposable implements IEditorService, IDisposable {
|
|
131
|
-
private readonly _univerInstanceService;
|
|
132
|
-
private readonly _renderManagerService;
|
|
133
|
-
private readonly _lexerTreeBuilder;
|
|
134
|
-
private readonly _contextService;
|
|
135
|
-
private _editors;
|
|
136
|
-
private _focusEditorUnitId;
|
|
137
|
-
private readonly _state$;
|
|
138
|
-
readonly state$: Observable<Nullable<IEditorStateParam>>;
|
|
139
|
-
private _currentSheetUnitId;
|
|
140
|
-
private _currentSheetSubUnitId;
|
|
141
|
-
private readonly _inputFormula$;
|
|
142
|
-
readonly inputFormula$: Observable<IEditorInputFormulaParam>;
|
|
143
|
-
private readonly _resize$;
|
|
144
|
-
readonly resize$: Observable<string>;
|
|
145
|
-
private readonly _closeRangePrompt$;
|
|
146
|
-
readonly closeRangePrompt$: Observable<unknown>;
|
|
147
|
-
private readonly _blur$;
|
|
148
|
-
readonly blur$: Observable<unknown>;
|
|
149
|
-
private readonly _focus$;
|
|
150
|
-
readonly focus$: Observable<ISuccinctDocRangeParam>;
|
|
151
|
-
private readonly _setValue$;
|
|
152
|
-
readonly setValue$: Observable<IEditorSetValueParam>;
|
|
153
|
-
private readonly _valueChange$;
|
|
154
|
-
readonly valueChange$: Observable<Readonly<Editor>>;
|
|
155
|
-
private readonly _focusStyle$;
|
|
156
|
-
readonly focusStyle$: Observable<Nullable<string>>;
|
|
157
|
-
private readonly _singleSelection$;
|
|
158
|
-
readonly singleSelection$: Observable<boolean>;
|
|
159
|
-
private _spreadsheetFocusState;
|
|
160
|
-
constructor(_univerInstanceService: IUniverInstanceService, _renderManagerService: IRenderManagerService, _lexerTreeBuilder: LexerTreeBuilder, _contextService: IContextService);
|
|
161
|
-
setFocusId(id: Nullable<string>): void;
|
|
162
|
-
getFocusId(): Nullable<string>;
|
|
163
|
-
getFocusEditor(): Readonly<Nullable<Editor>>;
|
|
164
|
-
isEditor(editorUnitId: string): boolean;
|
|
165
|
-
isSheetEditor(editorUnitId: string): boolean;
|
|
166
|
-
closeRangePrompt(): void;
|
|
167
|
-
changeSpreadsheetFocusState(state: boolean): void;
|
|
168
|
-
getSpreadsheetFocusState(): boolean;
|
|
169
|
-
focusStyle(editorUnitId: string): false | undefined;
|
|
170
|
-
singleSelection(state: boolean): void;
|
|
171
|
-
selectionChangingState(): boolean;
|
|
172
|
-
blur(): void;
|
|
173
|
-
focus(editorUnitId?: string | undefined): void;
|
|
174
|
-
setFormula(formulaString: string, editorUnitId?: string): void;
|
|
175
|
-
setValue(val: string, editorUnitId?: string): void;
|
|
176
|
-
setValueNoRefresh(val: string, editorUnitId: string): void;
|
|
177
|
-
getValue(id: string): string | undefined;
|
|
178
|
-
setRichValue(body: IDocumentBody, editorUnitId?: string): void;
|
|
179
|
-
getRichValue(id: string): IDocumentBody | undefined;
|
|
180
|
-
dispose(): void;
|
|
181
|
-
getEditor(id?: string): Readonly<Nullable<Editor>>;
|
|
182
|
-
getAllEditor(): Map<string, Editor>;
|
|
183
|
-
getFirstEditor(): Editor;
|
|
184
|
-
resize(unitId: string): void;
|
|
185
|
-
isVisible(id: string): boolean | undefined;
|
|
186
|
-
setOperationSheetUnitId(unitId: Nullable<string>): void;
|
|
187
|
-
getOperationSheetUnitId(): Nullable<string>;
|
|
188
|
-
setOperationSheetSubUnitId(sheetId: Nullable<string>): void;
|
|
189
|
-
getOperationSheetSubUnitId(): Nullable<string>;
|
|
190
|
-
register(config: IEditorConfigParam, container: HTMLDivElement): IDisposable;
|
|
191
|
-
private _unRegister;
|
|
192
|
-
refreshValueChange(editorUnitId: string): void;
|
|
193
|
-
checkValueLegality(editorUnitId: string): boolean;
|
|
194
|
-
private _refreshValueChange;
|
|
195
|
-
private _getCurrentEditorUnitId;
|
|
196
|
-
private _getBlank;
|
|
197
|
-
}
|
|
198
|
-
export declare const IEditorService: import('@wendellhu/redi').IdentifierDecorator<IEditorService>;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { IDisposable, IUnitRange, Nullable, Disposable } from '@univerjs/core';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
export interface IRangeSelectorRange extends IUnitRange {
|
|
4
|
-
sheetName: string;
|
|
5
|
-
}
|
|
6
|
-
export interface IRangeSelectorService {
|
|
7
|
-
selectionChange$: Observable<IRangeSelectorRange[]>;
|
|
8
|
-
selectionChange(ranges: IRangeSelectorRange[]): void;
|
|
9
|
-
setCurrentSelectorId(id: Nullable<string>): void;
|
|
10
|
-
getCurrentSelectorId(): Nullable<string>;
|
|
11
|
-
openSelector$: Observable<unknown>;
|
|
12
|
-
openSelector(): void;
|
|
13
|
-
selectorModalVisible$: Observable<boolean>;
|
|
14
|
-
get selectorModalVisible(): boolean;
|
|
15
|
-
triggerModalVisibleChange(visible: boolean): void;
|
|
16
|
-
}
|
|
17
|
-
export declare class RangeSelectorService extends Disposable implements IRangeSelectorService, IDisposable {
|
|
18
|
-
private _currentSelectorId;
|
|
19
|
-
private readonly _selectionChange$;
|
|
20
|
-
readonly selectionChange$: Observable<IRangeSelectorRange[]>;
|
|
21
|
-
private readonly _openSelector$;
|
|
22
|
-
readonly openSelector$: Observable<unknown>;
|
|
23
|
-
private readonly _selectorModalVisible$;
|
|
24
|
-
readonly selectorModalVisible$: Observable<boolean>;
|
|
25
|
-
get selectorModalVisible(): boolean;
|
|
26
|
-
setCurrentSelectorId(id: Nullable<string>): void;
|
|
27
|
-
getCurrentSelectorId(): Nullable<string>;
|
|
28
|
-
selectionChange(range: IRangeSelectorRange[]): void;
|
|
29
|
-
openSelector(): void;
|
|
30
|
-
triggerModalVisibleChange(visible: boolean): void;
|
|
31
|
-
}
|
|
32
|
-
export declare const IRangeSelectorService: import('@wendellhu/redi').IdentifierDecorator<IRangeSelectorService>;
|