@univerjs/sheets-ui 0.5.3 → 0.5.4
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 +1 -1
- package/lib/cjs/index.js +30 -28
- package/lib/es/facade.js +490 -117
- package/lib/es/index.js +10728 -11062
- package/lib/index.css +1 -1
- package/lib/types/commands/commands/clipboard.command.d.ts +1 -0
- package/lib/types/components/hook.d.ts +2 -0
- package/lib/types/controllers/clipboard/clipboard.controller.d.ts +4 -2
- package/lib/types/controllers/clipboard/const.d.ts +16 -0
- package/lib/types/controllers/clipboard/utils.d.ts +63 -0
- package/lib/types/controllers/config.schema.d.ts +3 -0
- package/lib/types/controllers/force-string-alert-render.controller.d.ts +5 -1
- package/lib/types/controllers/permission/sheet-permission-check-ui.controller.d.ts +24 -0
- package/lib/types/controllers/permission/sheet-permission-interceptor-canvas-render.controller.d.ts +0 -1
- package/lib/types/controllers/permission/sheet-permission-interceptor-clipboard.controller.d.ts +3 -4
- package/lib/types/controllers/permission/sheet-permission-interceptor-formula-render.controller.d.ts +0 -1
- package/lib/types/controllers/render-controllers/scroll.render-controller.d.ts +7 -4
- package/lib/types/facade/f-event.d.ts +389 -0
- package/lib/types/facade/f-permission.d.ts +4 -1
- package/lib/types/facade/f-range.d.ts +48 -5
- package/lib/types/facade/f-sheet-hooks.d.ts +50 -12
- package/lib/types/facade/f-univer.d.ts +15 -16
- package/lib/types/facade/f-workbook.d.ts +43 -28
- package/lib/types/facade/f-worksheet.d.ts +24 -11
- package/lib/types/facade/index.d.ts +3 -1
- package/lib/types/index.d.ts +13 -14
- package/lib/types/services/clipboard/clipboard.service.d.ts +25 -10
- package/lib/types/services/clipboard/type.d.ts +18 -2
- package/lib/types/services/hover-manager.service.d.ts +6 -0
- package/lib/types/services/scroll-manager.service.d.ts +10 -2
- package/lib/types/services/selection/base-selection-render.service.d.ts +3 -3
- package/lib/types/services/selection/selection-render.service.d.ts +4 -0
- package/lib/types/views/cell-alert/CellAlertPopup.d.ts +6 -1
- package/lib/types/views/clipboard/ClipboardPopupMenu.d.ts +2 -0
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +28 -26
- package/package.json +15 -14
- package/lib/types/controllers/permission/sheet-permission-init.controller.d.ts +0 -26
- package/lib/types/controllers/permission/sheet-permission-interceptor-base.controller.d.ts +0 -36
- package/lib/types/controllers/permission/sheet-permission-view-model.controller.d.ts +0 -11
|
@@ -0,0 +1,389 @@
|
|
|
1
|
+
import { DeviceInputEventType } from '@univerjs/engine-render';
|
|
2
|
+
import { FRange, FWorkbook, FWorksheet } from '@univerjs/sheets/facade';
|
|
3
|
+
import { KeyCode } from '@univerjs/ui';
|
|
4
|
+
import { FEventName, IEventBase, RichTextValue } from '@univerjs/core';
|
|
5
|
+
/**
|
|
6
|
+
* Event interface triggered when cell editing starts
|
|
7
|
+
* @interface ISheetEditStartedEventParams
|
|
8
|
+
* @augments {IEventBase}
|
|
9
|
+
*/
|
|
10
|
+
export interface ISheetEditStartedEventParams extends IEventBase {
|
|
11
|
+
/** The workbook instance */
|
|
12
|
+
workbook: FWorkbook;
|
|
13
|
+
/** The worksheet being edited */
|
|
14
|
+
worksheet: FWorksheet;
|
|
15
|
+
/** Row index of the editing cell */
|
|
16
|
+
row: number;
|
|
17
|
+
/** Column index of the editing cell */
|
|
18
|
+
column: number;
|
|
19
|
+
/** Type of input device event that triggered the edit */
|
|
20
|
+
eventType: DeviceInputEventType;
|
|
21
|
+
/** Optional keycode that triggered the edit */
|
|
22
|
+
keycode?: KeyCode;
|
|
23
|
+
/** Whether the edit is happening in zen editor mode */
|
|
24
|
+
isZenEditor: boolean;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Event interface triggered when cell editing ends
|
|
28
|
+
* @interface ISheetEditEndedEventParams
|
|
29
|
+
* @augments {IEventBase}
|
|
30
|
+
*/
|
|
31
|
+
export interface ISheetEditEndedEventParams extends IEventBase {
|
|
32
|
+
/** The workbook instance */
|
|
33
|
+
workbook: FWorkbook;
|
|
34
|
+
/** The worksheet being edited */
|
|
35
|
+
worksheet: FWorksheet;
|
|
36
|
+
/** Row index of the edited cell */
|
|
37
|
+
row: number;
|
|
38
|
+
/** Column index of the edited cell */
|
|
39
|
+
column: number;
|
|
40
|
+
/** Type of input device event that triggered the edit end */
|
|
41
|
+
eventType: DeviceInputEventType;
|
|
42
|
+
/** Optional keycode that triggered the edit end */
|
|
43
|
+
keycode?: KeyCode;
|
|
44
|
+
/** Whether the edit happened in zen editor mode */
|
|
45
|
+
isZenEditor: boolean;
|
|
46
|
+
/** Whether the edit was confirmed or cancelled */
|
|
47
|
+
isConfirm: boolean;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Event interface triggered while cell content is being changed
|
|
51
|
+
* @interface ISheetEditChangingEventParams
|
|
52
|
+
* @augments {IEventBase}
|
|
53
|
+
*/
|
|
54
|
+
export interface ISheetEditChangingEventParams extends IEventBase {
|
|
55
|
+
/** The workbook instance */
|
|
56
|
+
workbook: FWorkbook;
|
|
57
|
+
/** The worksheet being edited */
|
|
58
|
+
worksheet: FWorksheet;
|
|
59
|
+
/** Row index of the editing cell */
|
|
60
|
+
row: number;
|
|
61
|
+
/** Column index of the editing cell */
|
|
62
|
+
column: number;
|
|
63
|
+
/** Current value being edited */
|
|
64
|
+
value: RichTextValue;
|
|
65
|
+
/** Whether the edit is happening in zen editor mode */
|
|
66
|
+
isZenEditor: boolean;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Event interface triggered before cell editing starts
|
|
70
|
+
* @interface IBeforeSheetEditStartEventParams
|
|
71
|
+
* @augments {IEventBase}
|
|
72
|
+
*/
|
|
73
|
+
export interface IBeforeSheetEditStartEventParams extends IEventBase {
|
|
74
|
+
/** The workbook instance */
|
|
75
|
+
workbook: FWorkbook;
|
|
76
|
+
/** The worksheet to be edited */
|
|
77
|
+
worksheet: FWorksheet;
|
|
78
|
+
/** Row index of the cell to be edited */
|
|
79
|
+
row: number;
|
|
80
|
+
/** Column index of the cell to be edited */
|
|
81
|
+
column: number;
|
|
82
|
+
/** Type of input device event triggering the edit */
|
|
83
|
+
eventType: DeviceInputEventType;
|
|
84
|
+
/** Optional keycode triggering the edit */
|
|
85
|
+
keycode?: KeyCode;
|
|
86
|
+
/** Whether the edit will happen in zen editor mode */
|
|
87
|
+
isZenEditor: boolean;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Event interface triggered before cell editing ends
|
|
91
|
+
* @interface IBeforeSheetEditEndEventParams
|
|
92
|
+
* @augments {IEventBase}
|
|
93
|
+
*/
|
|
94
|
+
export interface IBeforeSheetEditEndEventParams extends IEventBase {
|
|
95
|
+
/** The workbook instance */
|
|
96
|
+
workbook: FWorkbook;
|
|
97
|
+
/** The worksheet being edited */
|
|
98
|
+
worksheet: FWorksheet;
|
|
99
|
+
/** Row index of the editing cell */
|
|
100
|
+
row: number;
|
|
101
|
+
/** Column index of the editing cell */
|
|
102
|
+
column: number;
|
|
103
|
+
/** Current value being edited */
|
|
104
|
+
value: RichTextValue;
|
|
105
|
+
/** Type of input device event triggering the edit end */
|
|
106
|
+
eventType: DeviceInputEventType;
|
|
107
|
+
/** Optional keycode triggering the edit end */
|
|
108
|
+
keycode?: KeyCode;
|
|
109
|
+
/** Whether the edit is happening in zen editor mode */
|
|
110
|
+
isZenEditor: boolean;
|
|
111
|
+
/** Whether the edit will be confirmed or cancelled */
|
|
112
|
+
isConfirm: boolean;
|
|
113
|
+
}
|
|
114
|
+
export declare const CellFEventName: {
|
|
115
|
+
readonly CellClicked: "CellClicked";
|
|
116
|
+
readonly CellPointerDown: "CellPointerDown";
|
|
117
|
+
readonly CellPointerUp: "CellPointerUp";
|
|
118
|
+
readonly CellPointerMove: "CellPointerMove";
|
|
119
|
+
readonly CellHover: "CellHover";
|
|
120
|
+
readonly DragOver: "DragOver";
|
|
121
|
+
readonly Drop: "Drop";
|
|
122
|
+
};
|
|
123
|
+
export interface IFSheetsUIEventNameMixin {
|
|
124
|
+
/**
|
|
125
|
+
* Trigger this event before the clipboard content changes.
|
|
126
|
+
* Type of the event parameter is {@link IBeforeClipboardChangeParam}
|
|
127
|
+
* @example
|
|
128
|
+
* ```ts
|
|
129
|
+
* univerAPI.addEvent(univerAPI.Event.BeforeClipboardChange, (param) => {
|
|
130
|
+
* const {text, html} = param;
|
|
131
|
+
* console.log('debugger', text, html); // {text: '...', html: '...'}
|
|
132
|
+
* // if want to cancel the clipboard change
|
|
133
|
+
* param.cancel = true;
|
|
134
|
+
* })
|
|
135
|
+
* ```
|
|
136
|
+
*/
|
|
137
|
+
readonly BeforeClipboardChange: 'BeforeClipboardChange';
|
|
138
|
+
/**
|
|
139
|
+
* Trigger this event after the clipboard content changes.
|
|
140
|
+
* Type of the event parameter is {@link IClipboardChangedParam}
|
|
141
|
+
* @example
|
|
142
|
+
* ```ts
|
|
143
|
+
* univerAPI.addEvent(univerAPI.Event.ClipboardChanged, (param) => {
|
|
144
|
+
* const {text, html} = param;
|
|
145
|
+
* console.log('debugger', text, html); // {text: '...', html: '...'}
|
|
146
|
+
* })
|
|
147
|
+
* ```
|
|
148
|
+
*/
|
|
149
|
+
readonly ClipboardChanged: 'ClipboardChanged';
|
|
150
|
+
/**
|
|
151
|
+
* Trigger this event before pasting.
|
|
152
|
+
* Type of the event parameter is {@link IBeforeClipboardPasteParam}
|
|
153
|
+
* @example
|
|
154
|
+
* ```ts
|
|
155
|
+
* univerAPI.addEvent(univerAPI.Event.BeforeClipboardPaste, (param) => {
|
|
156
|
+
* const {text, html} = param;
|
|
157
|
+
* console.log('debugger', text, html);
|
|
158
|
+
* // if want to cancel the clipboard paste
|
|
159
|
+
* param.cancel = true;
|
|
160
|
+
* })
|
|
161
|
+
* ```
|
|
162
|
+
*/
|
|
163
|
+
readonly BeforeClipboardPaste: 'BeforeClipboardPaste';
|
|
164
|
+
/**
|
|
165
|
+
* Trigger this event after pasting.
|
|
166
|
+
* Type of the event parameter is {@link IClipboardPastedParam}
|
|
167
|
+
* @example
|
|
168
|
+
* ```ts
|
|
169
|
+
* univerAPI.addEvent(univerAPI.Event.ClipboardPasted, (param) => {
|
|
170
|
+
* const {text, html} = param;
|
|
171
|
+
* console.log('debugger', text, html); // {text: '...', html: '...'}
|
|
172
|
+
* })
|
|
173
|
+
* ```
|
|
174
|
+
*/
|
|
175
|
+
readonly ClipboardPasted: 'ClipboardPasted';
|
|
176
|
+
/**
|
|
177
|
+
* Event fired before a cell is edited
|
|
178
|
+
* @see {@link IBeforeSheetEditStartEventParams}
|
|
179
|
+
* @example
|
|
180
|
+
* ```ts
|
|
181
|
+
* univerAPI.addEvent(univerAPI.Event.BeforeSheetEditStart, (params) => {
|
|
182
|
+
* const { worksheet, workbook, row, column, eventType, keycode, isZenEditor } = params;
|
|
183
|
+
* });
|
|
184
|
+
* ```
|
|
185
|
+
*/
|
|
186
|
+
readonly BeforeSheetEditStart: 'BeforeSheetEditStart';
|
|
187
|
+
/**
|
|
188
|
+
* Event fired after a cell is edited
|
|
189
|
+
* @see {@link ISheetEditEndedEventParams}
|
|
190
|
+
* @example
|
|
191
|
+
* ```ts
|
|
192
|
+
* univerAPI.addEvent(univerAPI.Event.SheetEditStarted, (params) => {
|
|
193
|
+
* const { worksheet, workbook, row, column, eventType, keycode, isZenEditor } = params;
|
|
194
|
+
* });
|
|
195
|
+
* ```
|
|
196
|
+
*/
|
|
197
|
+
readonly SheetEditStarted: 'SheetEditStarted';
|
|
198
|
+
/**
|
|
199
|
+
* Event fired when a cell is being edited
|
|
200
|
+
* @see {@link ISheetEditChangingEventParams}
|
|
201
|
+
* @example
|
|
202
|
+
* ```ts
|
|
203
|
+
* univerAPI.addEvent(univerAPI.Event.SheetEditChanging, (params) => {
|
|
204
|
+
* const { worksheet, workbook, row, column, value, isZenEditor } = params;
|
|
205
|
+
* });
|
|
206
|
+
* ```
|
|
207
|
+
*/
|
|
208
|
+
readonly SheetEditChanging: 'SheetEditChanging';
|
|
209
|
+
/**
|
|
210
|
+
* Event fired before a cell edit ends
|
|
211
|
+
* @see {@link IBeforeSheetEditEndEventParams}
|
|
212
|
+
* @example
|
|
213
|
+
* ```ts
|
|
214
|
+
* univerAPI.addEvent(univerAPI.Event.BeforeSheetEditEnd, (params) => {
|
|
215
|
+
* const { worksheet, workbook, row, column, value, eventType, keycode, isZenEditor } = params;
|
|
216
|
+
* });
|
|
217
|
+
* ```
|
|
218
|
+
*/
|
|
219
|
+
readonly BeforeSheetEditEnd: 'BeforeSheetEditEnd';
|
|
220
|
+
/**
|
|
221
|
+
* Event fired after a cell edit ends
|
|
222
|
+
* @see {@link ISheetEditEndedEventParams}
|
|
223
|
+
* @example
|
|
224
|
+
* ```ts
|
|
225
|
+
* univerAPI.addEvent(univerAPI.Event.SheetEditEnded, (params) => {
|
|
226
|
+
* const { worksheet, workbook, row, column, eventType, keycode, isZenEditor } = params;
|
|
227
|
+
* });
|
|
228
|
+
* ```
|
|
229
|
+
*/
|
|
230
|
+
readonly SheetEditEnded: 'SheetEditEnded';
|
|
231
|
+
/**
|
|
232
|
+
* Event fired when a cell is clicked
|
|
233
|
+
* @example
|
|
234
|
+
* ```ts
|
|
235
|
+
* univerAPI.getActiveWorkbook().addEvent('CellClicked', (p)=> console.log(p));
|
|
236
|
+
* ```
|
|
237
|
+
*/
|
|
238
|
+
readonly CellClicked: 'CellClicked';
|
|
239
|
+
/**
|
|
240
|
+
* Event fired when a cell is pointer down
|
|
241
|
+
* @example
|
|
242
|
+
* ```ts
|
|
243
|
+
* univerAPI.getActiveWorkbook().addEvent('CellPointerDown', (p)=> console.log(p));
|
|
244
|
+
* ```
|
|
245
|
+
*/
|
|
246
|
+
readonly CellPointerDown: 'CellPointerDown';
|
|
247
|
+
/**
|
|
248
|
+
* Event fired when a cell is pointer up
|
|
249
|
+
* @example
|
|
250
|
+
* ```ts
|
|
251
|
+
* univerAPI.getActiveWorkbook().addEvent('CellPointerUp', (p)=> console.log(p));
|
|
252
|
+
* ```
|
|
253
|
+
*/
|
|
254
|
+
readonly CellPointerUp: 'CellPointerUp';
|
|
255
|
+
/**
|
|
256
|
+
* Event fired when a cell is hovered
|
|
257
|
+
* @example
|
|
258
|
+
* ```ts
|
|
259
|
+
* univerAPI.getActiveWorkbook().addEvent('CellHover', (p)=> console.log(p));
|
|
260
|
+
* ```
|
|
261
|
+
*/
|
|
262
|
+
readonly CellHover: 'CellHover';
|
|
263
|
+
/**
|
|
264
|
+
* Event fired when move on spreadsheet cells
|
|
265
|
+
* @example
|
|
266
|
+
* ```ts
|
|
267
|
+
* univerAPI.getActiveWorkbook().addEvent('CellPointerMove', (p)=> console.log(p));
|
|
268
|
+
* ```
|
|
269
|
+
*/
|
|
270
|
+
readonly CellPointerMove: 'CellPointerMove';
|
|
271
|
+
/**
|
|
272
|
+
* Event fired when drag over spreadsheet cells
|
|
273
|
+
* @example
|
|
274
|
+
* ```ts
|
|
275
|
+
* univerAPI.getActiveWorkbook().addEvent('DragOver', (p)=> console.log(p));
|
|
276
|
+
* ```
|
|
277
|
+
*/
|
|
278
|
+
readonly DragOver: 'DragOver';
|
|
279
|
+
/**
|
|
280
|
+
* Event fired when drop on spreadsheet cells
|
|
281
|
+
* @example
|
|
282
|
+
* ```ts
|
|
283
|
+
* univerAPI.getActiveWorkbook().addEvent('Drop', (p)=> console.log(p));
|
|
284
|
+
* ```
|
|
285
|
+
*/
|
|
286
|
+
readonly Drop: 'Drop';
|
|
287
|
+
}
|
|
288
|
+
export declare class FSheetsUIEventName extends FEventName implements IFSheetsUIEventNameMixin {
|
|
289
|
+
get BeforeClipboardChange(): 'BeforeClipboardChange';
|
|
290
|
+
get ClipboardChanged(): 'ClipboardChanged';
|
|
291
|
+
get BeforeClipboardPaste(): 'BeforeClipboardPaste';
|
|
292
|
+
get ClipboardPasted(): 'ClipboardPasted';
|
|
293
|
+
get BeforeSheetEditStart(): 'BeforeSheetEditStart';
|
|
294
|
+
get SheetEditStarted(): 'SheetEditStarted';
|
|
295
|
+
get SheetEditChanging(): 'SheetEditChanging';
|
|
296
|
+
get BeforeSheetEditEnd(): 'BeforeSheetEditEnd';
|
|
297
|
+
get SheetEditEnded(): 'SheetEditEnded';
|
|
298
|
+
get CellClicked(): 'CellClicked';
|
|
299
|
+
get CellHover(): 'CellHover';
|
|
300
|
+
get CellPointerDown(): 'CellPointerDown';
|
|
301
|
+
get CellPointerUp(): 'CellPointerUp';
|
|
302
|
+
get CellPointerMove(): 'CellPointerMove';
|
|
303
|
+
get DragOver(): 'DragOver';
|
|
304
|
+
get Drop(): 'Drop';
|
|
305
|
+
}
|
|
306
|
+
export interface IUIEventBase extends IEventBase {
|
|
307
|
+
/**
|
|
308
|
+
* The workbook instance currently being operated on. {@link FWorkbook}
|
|
309
|
+
*/
|
|
310
|
+
workbook: FWorkbook;
|
|
311
|
+
/**
|
|
312
|
+
* The worksheet instance currently being operated on. {@link FWorksheet}
|
|
313
|
+
*/
|
|
314
|
+
worksheet: FWorksheet;
|
|
315
|
+
}
|
|
316
|
+
export interface IBeforeClipboardChangeParam extends IEventBase {
|
|
317
|
+
/**
|
|
318
|
+
* The workbook instance currently being operated on. {@link FWorkbook}
|
|
319
|
+
*/
|
|
320
|
+
workbook: FWorkbook;
|
|
321
|
+
/**
|
|
322
|
+
* The worksheet instance currently being operated on. {@link FWorksheet}
|
|
323
|
+
*/
|
|
324
|
+
worksheet: FWorksheet;
|
|
325
|
+
/**
|
|
326
|
+
* Clipboard Text String
|
|
327
|
+
*/
|
|
328
|
+
text: string;
|
|
329
|
+
/**
|
|
330
|
+
* Clipboard HTML String
|
|
331
|
+
*/
|
|
332
|
+
html: string;
|
|
333
|
+
/**
|
|
334
|
+
* The sheet containing the content that was (copied/cut)
|
|
335
|
+
*/
|
|
336
|
+
fromSheet: FWorksheet;
|
|
337
|
+
/**
|
|
338
|
+
* The range containing the content that was (copied/cut)
|
|
339
|
+
*/
|
|
340
|
+
fromRange: FRange;
|
|
341
|
+
}
|
|
342
|
+
export type IClipboardChangedParam = IBeforeClipboardChangeParam;
|
|
343
|
+
export interface IBeforeClipboardPasteParam extends IEventBase {
|
|
344
|
+
/**
|
|
345
|
+
* The workbook instance currently being operated on. {@link FWorkbook}
|
|
346
|
+
*/
|
|
347
|
+
workbook: FWorkbook;
|
|
348
|
+
/**
|
|
349
|
+
* The worksheet instance currently being operated on. {@link FWorkbook}
|
|
350
|
+
*/
|
|
351
|
+
worksheet: FWorksheet;
|
|
352
|
+
/**
|
|
353
|
+
* Clipboard Text String
|
|
354
|
+
*/
|
|
355
|
+
text?: string;
|
|
356
|
+
/**
|
|
357
|
+
* Clipboard HTML String
|
|
358
|
+
*/
|
|
359
|
+
html?: string;
|
|
360
|
+
}
|
|
361
|
+
export type IClipboardPastedParam = IBeforeClipboardPasteParam;
|
|
362
|
+
export interface ICellEventParam extends IUIEventBase {
|
|
363
|
+
row: number;
|
|
364
|
+
column: number;
|
|
365
|
+
}
|
|
366
|
+
export interface IFSheetsUIEventParamConfig {
|
|
367
|
+
BeforeClipboardChange: IBeforeClipboardChangeParam;
|
|
368
|
+
ClipboardChanged: IClipboardChangedParam;
|
|
369
|
+
BeforeClipboardPaste: IBeforeClipboardPasteParam;
|
|
370
|
+
ClipboardPasted: IClipboardPastedParam;
|
|
371
|
+
BeforeSheetEditStart: IBeforeSheetEditStartEventParams;
|
|
372
|
+
SheetEditStarted: ISheetEditStartedEventParams;
|
|
373
|
+
SheetEditChanging: ISheetEditChangingEventParams;
|
|
374
|
+
BeforeSheetEditEnd: IBeforeSheetEditEndEventParams;
|
|
375
|
+
SheetEditEnded: ISheetEditEndedEventParams;
|
|
376
|
+
CellClicked: ICellEventParam;
|
|
377
|
+
CellHover: ICellEventParam;
|
|
378
|
+
CellPointerDown: ICellEventParam;
|
|
379
|
+
CellPointerUp: ICellEventParam;
|
|
380
|
+
CellPointerMove: ICellEventParam;
|
|
381
|
+
Drop: ICellEventParam;
|
|
382
|
+
DragOver: ICellEventParam;
|
|
383
|
+
}
|
|
384
|
+
declare module '@univerjs/core' {
|
|
385
|
+
interface FEventName extends IFSheetsUIEventNameMixin {
|
|
386
|
+
}
|
|
387
|
+
interface IEventParamConfig extends IFSheetsUIEventParamConfig {
|
|
388
|
+
}
|
|
389
|
+
}
|
|
@@ -2,8 +2,11 @@ import { FPermission } from '@univerjs/sheets/facade';
|
|
|
2
2
|
export interface IFPermissionSheetsUIMixin {
|
|
3
3
|
/**
|
|
4
4
|
* Set visibility of unauthorized pop-up window
|
|
5
|
-
*
|
|
6
5
|
* @param {boolean} visible
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* univerAPI.getPermission().setPermissionDialogVisible(false);
|
|
9
|
+
* ```
|
|
7
10
|
*/
|
|
8
11
|
setPermissionDialogVisible(visible: boolean): void;
|
|
9
12
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ICellWithCoord, IDisposable, ISelectionCell, Nullable, DisposableCollection } from '@univerjs/core';
|
|
2
2
|
import { ISelectionStyle } from '@univerjs/sheets';
|
|
3
3
|
import { ComponentType, ComponentManager } from '@univerjs/ui';
|
|
4
|
-
import { FRange } from '@univerjs/sheets/facade';
|
|
5
4
|
import { ICanvasPopup, ICellAlert } from '@univerjs/sheets-ui';
|
|
5
|
+
import { FRange } from '@univerjs/sheets/facade';
|
|
6
6
|
export interface IFComponentKey {
|
|
7
7
|
/**
|
|
8
8
|
* The key of the component to be rendered in the popup.
|
|
@@ -20,16 +20,31 @@ export interface IFCanvasPopup extends Omit<ICanvasPopup, 'componentKey'>, IFCom
|
|
|
20
20
|
interface IFRangeSheetsUIMixin {
|
|
21
21
|
/**
|
|
22
22
|
* Return this cell information, including whether it is merged and cell coordinates
|
|
23
|
-
* @returns
|
|
23
|
+
* @returns {ICellWithCoord} cell location and coordinate.
|
|
24
|
+
* @example
|
|
25
|
+
* ``` ts
|
|
26
|
+
* let sheet = univerAPI.getActiveWorkbook().getActiveSheet();
|
|
27
|
+
* sheet.getRange(5, 7).getCell();
|
|
28
|
+
* ```
|
|
24
29
|
*/
|
|
25
|
-
getCell(): ICellWithCoord;
|
|
30
|
+
getCell(this: FRange): ICellWithCoord;
|
|
26
31
|
/**
|
|
27
32
|
* Returns the coordinates of this cell,does not include units
|
|
28
33
|
* @returns coordinates of the cell, top, right, bottom, left
|
|
34
|
+
* @example
|
|
35
|
+
* ``` ts
|
|
36
|
+
* let sheet = univerAPI.getActiveWorkbook().getActiveSheet();
|
|
37
|
+
* sheet.getRange(5, 7).getCellRect();
|
|
38
|
+
* ```
|
|
29
39
|
*/
|
|
30
|
-
getCellRect(): DOMRect;
|
|
40
|
+
getCellRect(this: FRange): DOMRect;
|
|
31
41
|
/**
|
|
32
42
|
* Generate HTML content for the range.
|
|
43
|
+
* @example
|
|
44
|
+
* ``` ts
|
|
45
|
+
* let sheet = univerAPI.getActiveWorkbook().getActiveSheet();
|
|
46
|
+
* sheet.getRange(5, 7).generateHTML();
|
|
47
|
+
* ```
|
|
33
48
|
*/
|
|
34
49
|
generateHTML(this: FRange): string;
|
|
35
50
|
/**
|
|
@@ -38,16 +53,39 @@ interface IFRangeSheetsUIMixin {
|
|
|
38
53
|
* Be careful to manager the detach disposable object, if not dispose correctly, it might memory leaks.
|
|
39
54
|
* @param popup The popup to attach
|
|
40
55
|
* @returns The disposable object to detach the popup, if the popup is not attached, return `null`.
|
|
56
|
+
* @example
|
|
57
|
+
```
|
|
58
|
+
let sheet = univerAPI.getActiveWorkbook().getActiveSheet();
|
|
59
|
+
let range = sheet.getRange(2, 2, 3, 3);
|
|
60
|
+
let disposable = range.attachPopup({
|
|
61
|
+
componentKey: 'univer.sheet.cell-alert',
|
|
62
|
+
extraProps: { alert: { type: 0, title: 'This is an Info', message: 'This is an info message' } },
|
|
63
|
+
});
|
|
64
|
+
```
|
|
41
65
|
*/
|
|
42
66
|
attachPopup(popup: IFCanvasPopup): Nullable<IDisposable>;
|
|
43
67
|
/**
|
|
44
68
|
* Attach an alert popup to the start cell of current range.
|
|
45
69
|
* @param alert The alert to attach
|
|
46
70
|
* @returns The disposable object to detach the alert.
|
|
71
|
+
* @example
|
|
72
|
+
* ```ts
|
|
73
|
+
* let sheet = univerAPI.getActiveWorkbook().getActiveSheet();
|
|
74
|
+
* let range = sheet.getRange(2, 2, 3, 3);
|
|
75
|
+
* range.attachAlertPopup({ message: 'This is an alert', type: 'warning' });
|
|
76
|
+
* ```
|
|
47
77
|
*/
|
|
48
78
|
attachAlertPopup(alert: Omit<ICellAlert, 'location'>): IDisposable;
|
|
49
79
|
/**
|
|
50
|
-
*
|
|
80
|
+
* Highlight the range with the specified style and primary cell.
|
|
81
|
+
* @param style - style for highlight range.
|
|
82
|
+
* @param primary - primary cell for highlight range.
|
|
83
|
+
* @example
|
|
84
|
+
* ```ts
|
|
85
|
+
* let sheet = univerAPI.getActiveWorkbook().getActiveSheet();
|
|
86
|
+
* let range = sheet.getRange(2, 2, 3, 3);
|
|
87
|
+
* range.highlight({ stroke: 'red' }, { startRow: 2, startColumn: 2 });
|
|
88
|
+
* ```
|
|
51
89
|
*/
|
|
52
90
|
highlight(style?: Nullable<Partial<ISelectionStyle>>, primary?: Nullable<ISelectionCell>): IDisposable;
|
|
53
91
|
}
|
|
@@ -55,6 +93,11 @@ declare module '@univerjs/sheets/facade' {
|
|
|
55
93
|
interface FRange extends IFRangeSheetsUIMixin {
|
|
56
94
|
}
|
|
57
95
|
}
|
|
96
|
+
/**
|
|
97
|
+
* Transform component key
|
|
98
|
+
* @param {IFComponentKey} component - The component key to transform.
|
|
99
|
+
* @param {ComponentManager} componentManager - The component manager to use for registration.
|
|
100
|
+
*/
|
|
58
101
|
export declare function transformComponentKey(component: IFComponentKey, componentManager: ComponentManager): {
|
|
59
102
|
key: string;
|
|
60
103
|
disposableCollection: DisposableCollection;
|
|
@@ -4,46 +4,84 @@ import { FSheetHooks } from '@univerjs/sheets/facade';
|
|
|
4
4
|
export interface IFSheetHooksUIMixin {
|
|
5
5
|
/**
|
|
6
6
|
* The onCellPointerMove event is fired when a pointer changes coordinates.
|
|
7
|
-
* @param callback
|
|
8
|
-
* @returns A disposable object that can be used to unsubscribe from the event
|
|
7
|
+
* @param {function(Nullable<IHoverCellPosition>): void} callback - function that will be called when the event is fired
|
|
8
|
+
* @returns {IDisposable} A disposable object that can be used to unsubscribe from the event
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* univerAPI.getSheetHooks().onCellPointerMove((cellPos) => { console.log(cellPos)});
|
|
12
|
+
* ```
|
|
9
13
|
*/
|
|
10
14
|
onCellPointerMove(callback: (cellPos: Nullable<IHoverCellPosition>) => void): IDisposable;
|
|
11
15
|
/**
|
|
12
16
|
* The onCellPointerOver event is fired when a pointer is moved into a cell's hit test boundaries.
|
|
13
|
-
* @param callback
|
|
14
|
-
* @returns A disposable object that can be used to unsubscribe from the event
|
|
17
|
+
* @param {function(Nullable<IHoverCellPosition>): void} callback - function that will be called when the event is fired
|
|
18
|
+
* @returns {IDisposable} A disposable object that can be used to unsubscribe from the event
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* univerAPI.getSheetHooks().onCellPointerOver((cellPos) => { console.log(cellPos)});
|
|
22
|
+
* ```
|
|
15
23
|
*/
|
|
16
24
|
onCellPointerOver(callback: (cellPos: Nullable<IHoverCellPosition>) => void): IDisposable;
|
|
17
25
|
/**
|
|
18
26
|
* The onCellDragOver event is fired when an element or text selection is being dragged into a cell's hit test boundaries.
|
|
19
|
-
* @param callback Callback function that will be called when the event is fired
|
|
20
|
-
* @returns A disposable object that can be used to unsubscribe from the event
|
|
27
|
+
* @param {function (Nullable<IDragCellPosition>): void} callback Callback function that will be called when the event is fired
|
|
28
|
+
* @returns {IDisposable} A disposable object that can be used to unsubscribe from the event
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* univerAPI.getSheetHooks().onCellDragOver((cellPos) => { console.log(cellPos)});
|
|
32
|
+
* ```
|
|
21
33
|
*/
|
|
22
34
|
onCellDragOver(callback: (cellPos: Nullable<IDragCellPosition>) => void): IDisposable;
|
|
23
35
|
/**
|
|
24
36
|
* The onCellDrop event is fired when an element or text selection is being dropped on the cell.
|
|
25
|
-
* @param callback Callback function that will be called when the event is fired
|
|
26
|
-
* @returns A disposable object that can be used to unsubscribe from the event
|
|
37
|
+
* @param {function(Nullable<IDragCellPosition>): void} callback Callback function that will be called when the event is fired
|
|
38
|
+
* @returns {IDisposable} A disposable object that can be used to unsubscribe from the event
|
|
39
|
+
* @example
|
|
40
|
+
* ```ts
|
|
41
|
+
* univerAPI.getSheetHooks().onCellDrop((cellPos) => { console.log(cellPos)});
|
|
42
|
+
* ```
|
|
27
43
|
*/
|
|
28
44
|
onCellDrop(callback: (cellPos: Nullable<IDragCellPosition>) => void): IDisposable;
|
|
29
45
|
/**
|
|
30
46
|
* The onCellRender event is fired when a cell is rendered.
|
|
31
|
-
* @param customRender Custom render function
|
|
32
|
-
* @param effect The effect of the interceptor
|
|
33
|
-
* @param priority The priority of the interceptor
|
|
34
|
-
* @returns A disposable object that can be used to unsubscribe from the event
|
|
47
|
+
* @param {Nullable<ICellCustomRender[]>} customRender Custom render function
|
|
48
|
+
* @param {InterceptorEffectEnum} [effect] The effect of the interceptor
|
|
49
|
+
* @param {number} priority The priority of the interceptor
|
|
50
|
+
* @returns {IDisposable} A disposable object that can be used to unsubscribe from the event
|
|
51
|
+
* @example
|
|
52
|
+
* ```ts
|
|
53
|
+
univerAPI.getSheetHooks().onCellRender([{
|
|
54
|
+
drawWith: (ctx, info) => {
|
|
55
|
+
const { row, col } = info;
|
|
56
|
+
// Update to any cell location you want
|
|
57
|
+
if (row === 1 && col === 2) {
|
|
58
|
+
const { primaryWithCoord } = info;
|
|
59
|
+
const { startX, startY } = primaryWithCoord;
|
|
60
|
+
ctx.fillText('Univer', startX, startY + 10);
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
}])
|
|
64
|
+
* ```
|
|
35
65
|
*/
|
|
36
66
|
onCellRender(customRender: Nullable<ICellCustomRender[]>, effect?: InterceptorEffectEnum, priority?: number): IDisposable;
|
|
37
67
|
/**
|
|
38
68
|
* The onBeforeCellEdit event is fired before a cell is edited.
|
|
39
69
|
* @param callback Callback function that will be called when the event is fired
|
|
40
70
|
* @returns A disposable object that can be used to unsubscribe from the event
|
|
71
|
+
* @example
|
|
72
|
+
* ```ts
|
|
73
|
+
* univerAPI.getSheetHooks().onBeforeCellEdit((params) => {console.log(params)})
|
|
74
|
+
* ```
|
|
41
75
|
*/
|
|
42
76
|
onBeforeCellEdit(callback: (params: IEditorBridgeServiceVisibleParam) => void): IDisposable;
|
|
43
77
|
/**
|
|
44
78
|
* The onAfterCellEdit event is fired after a cell is edited.
|
|
45
79
|
* @param callback Callback function that will be called when the event is fired
|
|
46
80
|
* @returns A disposable object that can be used to unsubscribe from the event
|
|
81
|
+
* @example
|
|
82
|
+
* ```ts
|
|
83
|
+
* univerAPI.getSheetHooks().onAfterCellEdit((params) => {console.log(params)})
|
|
84
|
+
* ```
|
|
47
85
|
*/
|
|
48
86
|
onAfterCellEdit(callback: (params: IEditorBridgeServiceVisibleParam) => void): IDisposable;
|
|
49
87
|
}
|
|
@@ -1,32 +1,27 @@
|
|
|
1
|
-
import { IDisposable, FUniver } from '@univerjs/core';
|
|
1
|
+
import { IDisposable, Injector, FUniver } from '@univerjs/core';
|
|
2
2
|
import { IColumnsHeaderCfgParam, IRowsHeaderCfgParam, SheetExtension } from '@univerjs/engine-render';
|
|
3
3
|
import { FSheetHooks } from '@univerjs/sheets/facade';
|
|
4
4
|
export interface IFUniverSheetsUIMixin {
|
|
5
5
|
/**
|
|
6
6
|
* Customize the column header of the spreadsheet.
|
|
7
|
-
*
|
|
8
7
|
* @param {IColumnsHeaderCfgParam} cfg The configuration of the column header.
|
|
9
|
-
*
|
|
10
8
|
* @example
|
|
11
9
|
* ```typescript
|
|
12
|
-
* customizeColumnHeader({ headerStyle: { backgroundColor: 'pink', fontSize: 9 }, columnsCfg: ['MokaII', undefined, null, { text: 'Size', textAlign: 'left' }] });
|
|
10
|
+
* univerAPI.customizeColumnHeader({ headerStyle: { backgroundColor: 'pink', fontSize: 9 }, columnsCfg: ['MokaII', undefined, null, { text: 'Size', textAlign: 'left' }] });
|
|
13
11
|
* ```
|
|
14
12
|
*/
|
|
15
13
|
customizeColumnHeader(cfg: IColumnsHeaderCfgParam): void;
|
|
16
14
|
/**
|
|
17
15
|
* Customize the row header of the spreadsheet.
|
|
18
|
-
*
|
|
19
16
|
* @param {IRowsHeaderCfgParam} cfg The configuration of the row header.
|
|
20
|
-
*
|
|
21
17
|
* @example
|
|
22
18
|
* ```typescript
|
|
23
|
-
* customizeRowHeader({ headerStyle: { backgroundColor: 'pink', fontSize: 9 }, rowsCfg: ['MokaII', undefined, null, { text: 'Size', textAlign: 'left' }] });
|
|
19
|
+
* univerAPI.customizeRowHeader({ headerStyle: { backgroundColor: 'pink', fontSize: 9 }, rowsCfg: ['MokaII', undefined, null, { text: 'Size', textAlign: 'left' }] });
|
|
24
20
|
* ```
|
|
25
21
|
*/
|
|
26
22
|
customizeRowHeader(cfg: IRowsHeaderCfgParam): void;
|
|
27
23
|
/**
|
|
28
24
|
* Register sheet row header render extensions.
|
|
29
|
-
*
|
|
30
25
|
* @param {string} unitId The unit id of the spreadsheet.
|
|
31
26
|
* @param {SheetExtension[]} extensions The extensions to register.
|
|
32
27
|
* @returns {IDisposable} The disposable instance.
|
|
@@ -34,7 +29,6 @@ export interface IFUniverSheetsUIMixin {
|
|
|
34
29
|
registerSheetRowHeaderExtension(unitId: string, ...extensions: SheetExtension[]): IDisposable;
|
|
35
30
|
/**
|
|
36
31
|
* Register sheet column header render extensions.
|
|
37
|
-
*
|
|
38
32
|
* @param {string} unitId The unit id of the spreadsheet.
|
|
39
33
|
* @param {SheetExtension[]} extensions The extensions to register.
|
|
40
34
|
* @returns {IDisposable} The disposable instance.
|
|
@@ -42,20 +36,28 @@ export interface IFUniverSheetsUIMixin {
|
|
|
42
36
|
registerSheetColumnHeaderExtension(unitId: string, ...extensions: SheetExtension[]): IDisposable;
|
|
43
37
|
/**
|
|
44
38
|
* Register sheet main render extensions.
|
|
45
|
-
*
|
|
46
39
|
* @param {string} unitId The unit id of the spreadsheet.
|
|
47
40
|
* @param {SheetExtension[]} extensions The extensions to register.
|
|
48
41
|
* @returns {IDisposable} The disposable instance.
|
|
49
42
|
*/
|
|
50
43
|
registerSheetMainExtension(unitId: string, ...extensions: SheetExtension[]): IDisposable;
|
|
51
44
|
/**
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
* @returns {FSheetHooks} FSheetHooks instance
|
|
45
|
+
* @deprecated use `univerAPI.addEvent` as instead.
|
|
55
46
|
*/
|
|
56
47
|
getSheetHooks(): FSheetHooks;
|
|
57
48
|
}
|
|
58
49
|
export declare class FUniverSheetsUIMixin extends FUniver implements IFUniverSheetsUIMixin {
|
|
50
|
+
private _initSheetUIEvent;
|
|
51
|
+
_initialize(injector: Injector): void;
|
|
52
|
+
private _generateClipboardCopyParam;
|
|
53
|
+
private _beforeClipboardChange;
|
|
54
|
+
private _clipboardChanged;
|
|
55
|
+
private _generateClipboardPasteParam;
|
|
56
|
+
private _generateClipboardPasteParamAsync;
|
|
57
|
+
private _beforeClipboardPaste;
|
|
58
|
+
private _clipboardPaste;
|
|
59
|
+
private _beforeClipboardPasteAsync;
|
|
60
|
+
private _clipboardPasteAsync;
|
|
59
61
|
customizeColumnHeader(cfg: IColumnsHeaderCfgParam): void;
|
|
60
62
|
customizeRowHeader(cfg: IRowsHeaderCfgParam): void;
|
|
61
63
|
registerSheetRowHeaderExtension(unitId: string, ...extensions: SheetExtension[]): IDisposable;
|
|
@@ -63,9 +65,7 @@ export declare class FUniverSheetsUIMixin extends FUniver implements IFUniverShe
|
|
|
63
65
|
registerSheetMainExtension(unitId: string, ...extensions: SheetExtension[]): IDisposable;
|
|
64
66
|
/**
|
|
65
67
|
* Get sheet render component from render by unitId and view key.
|
|
66
|
-
*
|
|
67
68
|
* @private
|
|
68
|
-
*
|
|
69
69
|
* @param {string} unitId The unit id of the spreadsheet.
|
|
70
70
|
* @param {SHEET_VIEW_KEY} viewKey The view key of the spreadsheet.
|
|
71
71
|
* @returns {Nullable<RenderComponentType>} The render component.
|
|
@@ -73,7 +73,6 @@ export declare class FUniverSheetsUIMixin extends FUniver implements IFUniverShe
|
|
|
73
73
|
private _getSheetRenderComponent;
|
|
74
74
|
/**
|
|
75
75
|
* Get sheet hooks.
|
|
76
|
-
*
|
|
77
76
|
* @returns {FSheetHooks} FSheetHooks instance
|
|
78
77
|
*/
|
|
79
78
|
getSheetHooks(): FSheetHooks;
|