@univerjs/core 0.6.0 → 0.6.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/facade.js +1 -1
- package/lib/cjs/index.js +9 -9
- package/lib/es/facade.js +380 -105
- package/lib/es/index.js +2509 -2556
- package/lib/types/facade/f-blob.d.ts +18 -18
- package/lib/types/facade/f-enum.d.ts +166 -2
- package/lib/types/facade/f-event-registry.d.ts +4 -3
- package/lib/types/facade/f-event.d.ts +41 -14
- package/lib/types/facade/f-hooks.d.ts +8 -8
- package/lib/types/facade/f-univer.d.ts +67 -8
- package/lib/types/facade/f-util.d.ts +22 -0
- package/lib/types/index.d.ts +2 -3
- package/lib/types/services/plugin/plugin.service.d.ts +49 -38
- package/lib/types/shared/generate.d.ts +5 -0
- package/lib/types/shared/rectangle.d.ts +1 -1
- package/lib/types/univer.d.ts +2 -2
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +9 -9
- package/package.json +4 -4
- package/lib/types/services/plugin/plugin.d.ts +0 -46
package/lib/es/facade.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var A = Object.defineProperty;
|
|
2
2
|
var L = (i, e, t) => e in i ? A(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
|
|
3
3
|
var d = (i, e, t) => L(i, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
import { Disposable as V, Inject as l, Injector as _, UniverInstanceType as T, LifecycleStages as f, DataValidationType as F, DataValidationErrorStyle as
|
|
4
|
+
import { Disposable as V, Inject as l, Injector as _, UniverInstanceType as T, LifecycleStages as f, DataValidationType as F, DataValidationErrorStyle as W, DataValidationRenderMode as q, DataValidationOperator as G, DataValidationStatus as J, CommandType as K, BaselineOffset as Q, BooleanNumber as X, HorizontalAlign as Y, TextDecoration as Z, TextDirection as k, VerticalAlign as ee, WrapStrategy as te, BorderType as re, BorderStyleTypes as ie, AutoFillSeries as ne, ColorType as oe, CommonHideTypes as se, CopyPasteType as ce, DeleteDirection as ae, DeveloperMetadataVisibility as de, Dimension as pe, Direction as le, InterpolationPointType as he, LocaleType as ue, MentionType as ye, ProtectionType as ge, RelativeDate as ve, SheetTypes as fe, ThemeColorType as _e, LifecycleService as I, toDisposable as p, ICommandService as y, UndoCommand as h, IUndoRedoService as m, RedoCommand as u, Registry as me, UserManagerService as Ee, Rectangle as be, numfmt as Se, Tools as Ce, IUniverInstanceService as N, Univer as De, CanceledError as D, ColorBuilder as xe, RichTextBuilder as we, RichTextValue as Te, ParagraphStyleBuilder as Re, ParagraphStyleValue as Oe, TextStyleBuilder as Pe, TextStyleValue as je, TextDecorationBuilder as Be } from "@univerjs/core";
|
|
5
5
|
import { filter as E } from "rxjs";
|
|
6
6
|
class $ extends V {
|
|
7
7
|
/**
|
|
@@ -16,7 +16,7 @@ class $ extends V {
|
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
const x = Symbol("initializers");
|
|
19
|
-
class
|
|
19
|
+
class He extends V {
|
|
20
20
|
constructor(e) {
|
|
21
21
|
super(), this._injector = e;
|
|
22
22
|
const t = this, r = Object.getPrototypeOf(this)[x];
|
|
@@ -43,11 +43,11 @@ class Be extends V {
|
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
var
|
|
47
|
-
for (var n = r > 1 ? void 0 : r ?
|
|
46
|
+
var Ue = Object.getOwnPropertyDescriptor, Ve = (i, e, t, r) => {
|
|
47
|
+
for (var n = r > 1 ? void 0 : r ? Ue(e, t) : e, o = i.length - 1, s; o >= 0; o--)
|
|
48
48
|
(s = i[o]) && (n = s(n) || n);
|
|
49
49
|
return n;
|
|
50
|
-
},
|
|
50
|
+
}, Ie = (i, e) => (t, r) => e(t, r, i);
|
|
51
51
|
let S = class extends $ {
|
|
52
52
|
constructor(i, e) {
|
|
53
53
|
super(), this._blob = i, this._injector = e;
|
|
@@ -57,7 +57,7 @@ let S = class extends $ {
|
|
|
57
57
|
* @returns a new blob by copying the current blob
|
|
58
58
|
* @example
|
|
59
59
|
* ```ts
|
|
60
|
-
* const blob = univerAPI.newBlob(
|
|
60
|
+
* const blob = univerAPI.newBlob();
|
|
61
61
|
* const newBlob = blob.copyBlob();
|
|
62
62
|
* console.log(newBlob);
|
|
63
63
|
* ```
|
|
@@ -71,8 +71,9 @@ let S = class extends $ {
|
|
|
71
71
|
* @returns a new blob by converting the current blob to the specified content type
|
|
72
72
|
* @example
|
|
73
73
|
* ```ts
|
|
74
|
-
* const blob = univerAPI.newBlob(
|
|
75
|
-
* const newBlob = blob.
|
|
74
|
+
* const blob = univerAPI.newBlob();
|
|
75
|
+
* const newBlob = blob.getAs('text/plain');
|
|
76
|
+
* console.log(newBlob);
|
|
76
77
|
* ```
|
|
77
78
|
*/
|
|
78
79
|
getAs(i) {
|
|
@@ -94,9 +95,9 @@ let S = class extends $ {
|
|
|
94
95
|
* @returns the blob content as a byte array
|
|
95
96
|
* @example
|
|
96
97
|
* ```ts
|
|
97
|
-
* const blob = univerAPI.newBlob(
|
|
98
|
-
* const
|
|
99
|
-
* console.log(
|
|
98
|
+
* const blob = univerAPI.newBlob();
|
|
99
|
+
* const bytes = await blob.getBytes();
|
|
100
|
+
* console.log(bytes);
|
|
100
101
|
* ```
|
|
101
102
|
*/
|
|
102
103
|
getBytes() {
|
|
@@ -125,9 +126,9 @@ let S = class extends $ {
|
|
|
125
126
|
* @returns the content type
|
|
126
127
|
* @example
|
|
127
128
|
* ```ts
|
|
128
|
-
* const blob = univerAPI.newBlob(
|
|
129
|
-
* const
|
|
130
|
-
* console.log(
|
|
129
|
+
* const blob = univerAPI.newBlob();
|
|
130
|
+
* const contentType = blob.getContentType();
|
|
131
|
+
* console.log(contentType);
|
|
131
132
|
* ```
|
|
132
133
|
*/
|
|
133
134
|
getContentType() {
|
|
@@ -140,9 +141,8 @@ let S = class extends $ {
|
|
|
140
141
|
* @returns the blob object
|
|
141
142
|
* @example
|
|
142
143
|
* ```ts
|
|
143
|
-
* const blob = univerAPI.newBlob(
|
|
144
|
-
*
|
|
145
|
-
* console.log(newBlob);
|
|
144
|
+
* const blob = univerAPI.newBlob();
|
|
145
|
+
* blob.setContentType('text/plain');
|
|
146
146
|
* ```
|
|
147
147
|
*/
|
|
148
148
|
setContentType(i) {
|
|
@@ -150,8 +150,8 @@ let S = class extends $ {
|
|
|
150
150
|
return this._blob = (e = this._blob) == null ? void 0 : e.slice(0, this._blob.size, i), this;
|
|
151
151
|
}
|
|
152
152
|
};
|
|
153
|
-
S =
|
|
154
|
-
|
|
153
|
+
S = Ve([
|
|
154
|
+
Ie(1, l(_))
|
|
155
155
|
], S);
|
|
156
156
|
const g = class g {
|
|
157
157
|
static get() {
|
|
@@ -175,190 +175,356 @@ const g = class g {
|
|
|
175
175
|
this[e] = g.prototype[e];
|
|
176
176
|
}
|
|
177
177
|
/**
|
|
178
|
-
*
|
|
178
|
+
* Defines different types of Univer instances
|
|
179
|
+
*
|
|
180
|
+
* @example
|
|
181
|
+
* ```ts
|
|
182
|
+
* console.log(univerAPI.Enum.UniverInstanceType.UNIVER_SHEET);
|
|
183
|
+
* ```
|
|
179
184
|
*/
|
|
180
185
|
get UniverInstanceType() {
|
|
181
186
|
return T;
|
|
182
187
|
}
|
|
183
188
|
/**
|
|
184
189
|
* Represents different stages in the lifecycle
|
|
190
|
+
*
|
|
191
|
+
* @example
|
|
192
|
+
* ```ts
|
|
193
|
+
* console.log(univerAPI.Enum.LifecycleStages.Rendered);
|
|
194
|
+
* ```
|
|
185
195
|
*/
|
|
186
196
|
get LifecycleStages() {
|
|
187
197
|
return f;
|
|
188
198
|
}
|
|
189
199
|
/**
|
|
190
200
|
* Different types of data validation
|
|
201
|
+
*
|
|
202
|
+
* @example
|
|
203
|
+
* ```ts
|
|
204
|
+
* console.log(univerAPI.Enum.DataValidationType.LIST);
|
|
205
|
+
* ```
|
|
191
206
|
*/
|
|
192
207
|
get DataValidationType() {
|
|
193
208
|
return F;
|
|
194
209
|
}
|
|
195
210
|
/**
|
|
196
211
|
* Different error display styles
|
|
212
|
+
*
|
|
213
|
+
* @example
|
|
214
|
+
* ```ts
|
|
215
|
+
* console.log(univerAPI.Enum.DataValidationErrorStyle.WARNING);
|
|
216
|
+
* ```
|
|
197
217
|
*/
|
|
198
218
|
get DataValidationErrorStyle() {
|
|
199
|
-
return
|
|
219
|
+
return W;
|
|
200
220
|
}
|
|
201
221
|
/**
|
|
202
222
|
* Different validation rendering modes
|
|
223
|
+
*
|
|
224
|
+
* @example
|
|
225
|
+
* ```ts
|
|
226
|
+
* console.log(univerAPI.Enum.DataValidationRenderMode.TEXT);
|
|
227
|
+
* ```
|
|
203
228
|
*/
|
|
204
229
|
get DataValidationRenderMode() {
|
|
205
|
-
return
|
|
230
|
+
return q;
|
|
206
231
|
}
|
|
207
232
|
/**
|
|
208
233
|
* Different validation operators
|
|
234
|
+
*
|
|
235
|
+
* @example
|
|
236
|
+
* ```ts
|
|
237
|
+
* console.log(univerAPI.Enum.DataValidationOperator.BETWEEN);
|
|
238
|
+
* ```
|
|
209
239
|
*/
|
|
210
240
|
get DataValidationOperator() {
|
|
211
|
-
return
|
|
241
|
+
return G;
|
|
212
242
|
}
|
|
213
243
|
/**
|
|
214
244
|
* Different validation states
|
|
245
|
+
*
|
|
246
|
+
* @example
|
|
247
|
+
* ```ts
|
|
248
|
+
* console.log(univerAPI.Enum.DataValidationStatus.VALID);
|
|
249
|
+
* ```
|
|
215
250
|
*/
|
|
216
251
|
get DataValidationStatus() {
|
|
217
|
-
return
|
|
252
|
+
return J;
|
|
218
253
|
}
|
|
219
254
|
/**
|
|
220
255
|
* Different types of commands
|
|
256
|
+
*
|
|
257
|
+
* @example
|
|
258
|
+
* ```ts
|
|
259
|
+
* console.log(univerAPI.Enum.CommandType.COMMAND);
|
|
260
|
+
* ```
|
|
221
261
|
*/
|
|
222
262
|
get CommandType() {
|
|
223
|
-
return
|
|
263
|
+
return K;
|
|
224
264
|
}
|
|
225
265
|
/**
|
|
226
266
|
* Different baseline offsets for text baseline positioning
|
|
267
|
+
*
|
|
268
|
+
* @example
|
|
269
|
+
* ```ts
|
|
270
|
+
* console.log(univerAPI.Enum.BaselineOffset.SUPERSCRIPT);
|
|
271
|
+
* ```
|
|
227
272
|
*/
|
|
228
273
|
get BaselineOffset() {
|
|
229
|
-
return
|
|
274
|
+
return Q;
|
|
230
275
|
}
|
|
231
276
|
/**
|
|
232
277
|
* Boolean number representations
|
|
278
|
+
*
|
|
279
|
+
* @example
|
|
280
|
+
* ```ts
|
|
281
|
+
* console.log(univerAPI.Enum.BooleanNumber.TRUE);
|
|
282
|
+
* ```
|
|
233
283
|
*/
|
|
234
284
|
get BooleanNumber() {
|
|
235
285
|
return X;
|
|
236
286
|
}
|
|
237
287
|
/**
|
|
238
288
|
* Different horizontal text alignment options
|
|
289
|
+
*
|
|
290
|
+
* @example
|
|
291
|
+
* ```ts
|
|
292
|
+
* console.log(univerAPI.Enum.HorizontalAlign.CENTER);
|
|
293
|
+
* ```
|
|
239
294
|
*/
|
|
240
295
|
get HorizontalAlign() {
|
|
241
296
|
return Y;
|
|
242
297
|
}
|
|
243
298
|
/**
|
|
244
299
|
* Different text decoration styles
|
|
300
|
+
*
|
|
301
|
+
* @example
|
|
302
|
+
* ```ts
|
|
303
|
+
* console.log(univerAPI.Enum.TextDecoration.DOUBLE);
|
|
304
|
+
* ```
|
|
245
305
|
*/
|
|
246
306
|
get TextDecoration() {
|
|
247
307
|
return Z;
|
|
248
308
|
}
|
|
249
309
|
/**
|
|
250
310
|
* Different text direction options
|
|
311
|
+
*
|
|
312
|
+
* @example
|
|
313
|
+
* ```ts
|
|
314
|
+
* console.log(univerAPI.Enum.TextDirection.LEFT_TO_RIGHT);
|
|
315
|
+
* ```
|
|
251
316
|
*/
|
|
252
317
|
get TextDirection() {
|
|
253
318
|
return k;
|
|
254
319
|
}
|
|
255
320
|
/**
|
|
256
321
|
* Different vertical text alignment options
|
|
322
|
+
*
|
|
323
|
+
* @example
|
|
324
|
+
* ```ts
|
|
325
|
+
* console.log(univerAPI.Enum.VerticalAlign.MIDDLE);
|
|
326
|
+
* ```
|
|
257
327
|
*/
|
|
258
328
|
get VerticalAlign() {
|
|
259
329
|
return ee;
|
|
260
330
|
}
|
|
331
|
+
/**
|
|
332
|
+
* Different wrap strategy options
|
|
333
|
+
*
|
|
334
|
+
* @example
|
|
335
|
+
* ```ts
|
|
336
|
+
* console.log(univerAPI.Enum.WrapStrategy.WRAP);
|
|
337
|
+
* ```
|
|
338
|
+
*/
|
|
339
|
+
get WrapStrategy() {
|
|
340
|
+
return te;
|
|
341
|
+
}
|
|
261
342
|
/**
|
|
262
343
|
* Different border types
|
|
344
|
+
*
|
|
345
|
+
* @example
|
|
346
|
+
* ```ts
|
|
347
|
+
* console.log(univerAPI.Enum.BorderType.OUTSIDE);
|
|
348
|
+
* ```
|
|
263
349
|
*/
|
|
264
350
|
get BorderType() {
|
|
265
|
-
return
|
|
351
|
+
return re;
|
|
266
352
|
}
|
|
267
353
|
/**
|
|
268
354
|
* Different border style types
|
|
355
|
+
*
|
|
356
|
+
* @example
|
|
357
|
+
* ```ts
|
|
358
|
+
* console.log(univerAPI.Enum.BorderStyleTypes.NONE);
|
|
359
|
+
* ```
|
|
269
360
|
*/
|
|
270
361
|
get BorderStyleTypes() {
|
|
271
|
-
return
|
|
362
|
+
return ie;
|
|
272
363
|
}
|
|
273
364
|
/**
|
|
274
365
|
* Auto fill series types
|
|
366
|
+
*
|
|
367
|
+
* @example
|
|
368
|
+
* ```ts
|
|
369
|
+
* console.log(univerAPI.Enum.AutoFillSeries.ALTERNATE_SERIES);
|
|
370
|
+
* ```
|
|
275
371
|
*/
|
|
276
372
|
get AutoFillSeries() {
|
|
277
|
-
return
|
|
373
|
+
return ne;
|
|
278
374
|
}
|
|
279
375
|
/**
|
|
280
376
|
* Color types
|
|
377
|
+
*
|
|
378
|
+
* @example
|
|
379
|
+
* ```ts
|
|
380
|
+
* console.log(univerAPI.Enum.ColorType.RGB);
|
|
381
|
+
* ```
|
|
281
382
|
*/
|
|
282
383
|
get ColorType() {
|
|
283
|
-
return
|
|
384
|
+
return oe;
|
|
284
385
|
}
|
|
285
386
|
/**
|
|
286
387
|
* Common hide types
|
|
388
|
+
*
|
|
389
|
+
* @example
|
|
390
|
+
* ```ts
|
|
391
|
+
* console.log(univerAPI.Enum.CommonHideTypes.ON);
|
|
392
|
+
* ```
|
|
287
393
|
*/
|
|
288
394
|
get CommonHideTypes() {
|
|
289
|
-
return
|
|
395
|
+
return se;
|
|
290
396
|
}
|
|
291
397
|
/**
|
|
292
398
|
* Copy paste types
|
|
399
|
+
*
|
|
400
|
+
* @example
|
|
401
|
+
* ```ts
|
|
402
|
+
* console.log(univerAPI.Enum.CopyPasteType.PASTE_VALUES);
|
|
403
|
+
* ```
|
|
293
404
|
*/
|
|
294
405
|
get CopyPasteType() {
|
|
295
|
-
return
|
|
406
|
+
return ce;
|
|
296
407
|
}
|
|
297
408
|
/**
|
|
298
409
|
* Delete direction types
|
|
410
|
+
*
|
|
411
|
+
* @example
|
|
412
|
+
* ```ts
|
|
413
|
+
* console.log(univerAPI.Enum.DeleteDirection.LEFT);
|
|
414
|
+
* ```
|
|
299
415
|
*/
|
|
300
416
|
get DeleteDirection() {
|
|
301
|
-
return
|
|
417
|
+
return ae;
|
|
302
418
|
}
|
|
303
419
|
/**
|
|
304
420
|
* Developer metadata visibility types
|
|
421
|
+
*
|
|
422
|
+
* @example
|
|
423
|
+
* ```ts
|
|
424
|
+
* console.log(univerAPI.Enum.DeveloperMetadataVisibility.DOCUMENT);
|
|
425
|
+
* ```
|
|
305
426
|
*/
|
|
306
427
|
get DeveloperMetadataVisibility() {
|
|
307
|
-
return
|
|
428
|
+
return de;
|
|
308
429
|
}
|
|
309
430
|
/**
|
|
310
431
|
* Dimension types
|
|
432
|
+
*
|
|
433
|
+
* @example
|
|
434
|
+
* ```ts
|
|
435
|
+
* console.log(univerAPI.Enum.Dimension.ROWS);
|
|
436
|
+
* ```
|
|
311
437
|
*/
|
|
312
438
|
get Dimension() {
|
|
313
|
-
return
|
|
439
|
+
return pe;
|
|
314
440
|
}
|
|
315
441
|
/**
|
|
316
442
|
* Direction types
|
|
443
|
+
*
|
|
444
|
+
* @example
|
|
445
|
+
* ```ts
|
|
446
|
+
* console.log(univerAPI.Enum.Direction.UP);
|
|
447
|
+
* ```
|
|
317
448
|
*/
|
|
318
449
|
get Direction() {
|
|
319
|
-
return
|
|
450
|
+
return le;
|
|
320
451
|
}
|
|
321
452
|
/**
|
|
322
453
|
* Interpolation point types
|
|
454
|
+
*
|
|
455
|
+
* @example
|
|
456
|
+
* ```ts
|
|
457
|
+
* console.log(univerAPI.Enum.InterpolationPointType.NUMBER);
|
|
458
|
+
* ```
|
|
323
459
|
*/
|
|
324
460
|
get InterpolationPointType() {
|
|
325
|
-
return
|
|
461
|
+
return he;
|
|
326
462
|
}
|
|
327
463
|
/**
|
|
328
464
|
* Locale types
|
|
465
|
+
*
|
|
466
|
+
* @example
|
|
467
|
+
* ```ts
|
|
468
|
+
* console.log(univerAPI.Enum.LocaleType.EN_US);
|
|
469
|
+
* ```
|
|
329
470
|
*/
|
|
330
471
|
get LocaleType() {
|
|
331
|
-
return
|
|
472
|
+
return ue;
|
|
332
473
|
}
|
|
333
474
|
/**
|
|
334
475
|
* Mention types
|
|
476
|
+
*
|
|
477
|
+
* @example
|
|
478
|
+
* ```ts
|
|
479
|
+
* console.log(univerAPI.Enum.MentionType.PERSON);
|
|
480
|
+
* ```
|
|
335
481
|
*/
|
|
336
482
|
get MentionType() {
|
|
337
|
-
return
|
|
483
|
+
return ye;
|
|
338
484
|
}
|
|
339
485
|
/**
|
|
340
486
|
* Protection types
|
|
487
|
+
*
|
|
488
|
+
* @example
|
|
489
|
+
* ```ts
|
|
490
|
+
* console.log(univerAPI.Enum.ProtectionType.RANGE);
|
|
491
|
+
* ```
|
|
341
492
|
*/
|
|
342
493
|
get ProtectionType() {
|
|
343
|
-
return
|
|
494
|
+
return ge;
|
|
344
495
|
}
|
|
345
496
|
/**
|
|
346
497
|
* Relative date types
|
|
498
|
+
*
|
|
499
|
+
* @example
|
|
500
|
+
* ```ts
|
|
501
|
+
* console.log(univerAPI.Enum.RelativeDate.TODAY);
|
|
502
|
+
* ```
|
|
347
503
|
*/
|
|
348
504
|
get RelativeDate() {
|
|
349
|
-
return
|
|
505
|
+
return ve;
|
|
350
506
|
}
|
|
351
507
|
/**
|
|
352
508
|
* Sheet types
|
|
509
|
+
*
|
|
510
|
+
* @example
|
|
511
|
+
* ```ts
|
|
512
|
+
* console.log(univerAPI.Enum.SheetTypes.GRID);
|
|
513
|
+
* ```
|
|
353
514
|
*/
|
|
354
515
|
get SheetTypes() {
|
|
355
|
-
return
|
|
516
|
+
return fe;
|
|
356
517
|
}
|
|
357
518
|
/**
|
|
358
519
|
* Theme color types
|
|
520
|
+
*
|
|
521
|
+
* @example
|
|
522
|
+
* ```ts
|
|
523
|
+
* console.log(univerAPI.Enum.ThemeColorType.ACCENT1);
|
|
524
|
+
* ```
|
|
359
525
|
*/
|
|
360
526
|
get ThemeColorType() {
|
|
361
|
-
return
|
|
527
|
+
return _e;
|
|
362
528
|
}
|
|
363
529
|
};
|
|
364
530
|
/**
|
|
@@ -392,10 +558,12 @@ const v = class v {
|
|
|
392
558
|
* @see {@link IDocCreatedParam}
|
|
393
559
|
* @example
|
|
394
560
|
* ```ts
|
|
395
|
-
* univerAPI.addEvent(univerAPI.
|
|
561
|
+
* const disposable = univerAPI.addEvent(univerAPI.Event.DocCreated, (params) => {
|
|
396
562
|
* const { unitId, type, doc, unit } = params;
|
|
397
563
|
* console.log('doc created', params);
|
|
398
564
|
* });
|
|
565
|
+
*
|
|
566
|
+
* // Remove the event listener, use `disposable.dispose()`
|
|
399
567
|
* ```
|
|
400
568
|
*/
|
|
401
569
|
get DocCreated() {
|
|
@@ -406,10 +574,12 @@ const v = class v {
|
|
|
406
574
|
* @see {@link IDocDisposedEvent}
|
|
407
575
|
* @example
|
|
408
576
|
* ```ts
|
|
409
|
-
* univerAPI.addEvent(univerAPI.
|
|
577
|
+
* const disposable = univerAPI.addEvent(univerAPI.Event.DocDisposed, (params) => {
|
|
410
578
|
* const { unitId, unitType, snapshot } = params;
|
|
411
579
|
* console.log('doc disposed', params);
|
|
412
580
|
* });
|
|
581
|
+
*
|
|
582
|
+
* // Remove the event listener, use `disposable.dispose()`
|
|
413
583
|
* ```
|
|
414
584
|
*/
|
|
415
585
|
get DocDisposed() {
|
|
@@ -420,10 +590,12 @@ const v = class v {
|
|
|
420
590
|
* @see {@link ILifeCycleChangedEvent}
|
|
421
591
|
* @example
|
|
422
592
|
* ```ts
|
|
423
|
-
* univerAPI.addEvent(univerAPI.
|
|
593
|
+
* const disposable = univerAPI.addEvent(univerAPI.Event.LifeCycleChanged, (params) => {
|
|
424
594
|
* const { stage } = params;
|
|
425
595
|
* console.log('life cycle changed', params);
|
|
426
596
|
* });
|
|
597
|
+
*
|
|
598
|
+
* // Remove the event listener, use `disposable.dispose()`
|
|
427
599
|
* ```
|
|
428
600
|
*/
|
|
429
601
|
get LifeCycleChanged() {
|
|
@@ -434,10 +606,12 @@ const v = class v {
|
|
|
434
606
|
* @see {@link ICommandEvent}
|
|
435
607
|
* @example
|
|
436
608
|
* ```ts
|
|
437
|
-
* univerAPI.addEvent(univerAPI.
|
|
609
|
+
* const disposable = univerAPI.addEvent(univerAPI.Event.Redo, (event) => {
|
|
438
610
|
* const { params, id, type } = event;
|
|
439
|
-
* console.log('command executed', event);
|
|
611
|
+
* console.log('redo command executed', event);
|
|
440
612
|
* });
|
|
613
|
+
*
|
|
614
|
+
* // Remove the event listener, use `disposable.dispose()`
|
|
441
615
|
* ```
|
|
442
616
|
*/
|
|
443
617
|
get Redo() {
|
|
@@ -448,10 +622,12 @@ const v = class v {
|
|
|
448
622
|
* @see {@link ICommandEvent}
|
|
449
623
|
* @example
|
|
450
624
|
* ```ts
|
|
451
|
-
* univerAPI.addEvent(univerAPI.
|
|
625
|
+
* const disposable = univerAPI.addEvent(univerAPI.Event.Undo, (event) => {
|
|
452
626
|
* const { params, id, type } = event;
|
|
453
|
-
* console.log('command executed', event);
|
|
627
|
+
* console.log('undo command executed', event);
|
|
454
628
|
* });
|
|
629
|
+
*
|
|
630
|
+
* // Remove the event listener, use `disposable.dispose()`
|
|
455
631
|
* ```
|
|
456
632
|
*/
|
|
457
633
|
get Undo() {
|
|
@@ -462,10 +638,15 @@ const v = class v {
|
|
|
462
638
|
* @see {@link ICommandEvent}
|
|
463
639
|
* @example
|
|
464
640
|
* ```ts
|
|
465
|
-
* univerAPI.addEvent(univerAPI.
|
|
641
|
+
* const disposable = univerAPI.addEvent(univerAPI.Event.BeforeRedo, (event) => {
|
|
466
642
|
* const { params, id, type } = event;
|
|
467
|
-
* console.log('command executed', event);
|
|
643
|
+
* console.log('before redo command executed', event);
|
|
644
|
+
*
|
|
645
|
+
* // Cancel the redo operation
|
|
646
|
+
* event.cancel = true;
|
|
468
647
|
* });
|
|
648
|
+
*
|
|
649
|
+
* // Remove the event listener, use `disposable.dispose()`
|
|
469
650
|
* ```
|
|
470
651
|
*/
|
|
471
652
|
get BeforeRedo() {
|
|
@@ -476,10 +657,15 @@ const v = class v {
|
|
|
476
657
|
* @see {@link ICommandEvent}
|
|
477
658
|
* @example
|
|
478
659
|
* ```ts
|
|
479
|
-
* univerAPI.addEvent(univerAPI.
|
|
660
|
+
* const disposable = univerAPI.addEvent(univerAPI.Event.BeforeUndo, (event) => {
|
|
480
661
|
* const { params, id, type } = event;
|
|
481
|
-
* console.log('command executed', event);
|
|
662
|
+
* console.log('before undo command executed', event);
|
|
663
|
+
*
|
|
664
|
+
* // Cancel the undo operation
|
|
665
|
+
* event.cancel = true;
|
|
482
666
|
* });
|
|
667
|
+
*
|
|
668
|
+
* // Remove the event listener, use `disposable.dispose()`
|
|
483
669
|
* ```
|
|
484
670
|
*/
|
|
485
671
|
get BeforeUndo() {
|
|
@@ -490,10 +676,12 @@ const v = class v {
|
|
|
490
676
|
* @see {@link ICommandEvent}
|
|
491
677
|
* @example
|
|
492
678
|
* ```ts
|
|
493
|
-
* univerAPI.addEvent(univerAPI.
|
|
679
|
+
* const disposable = univerAPI.addEvent(univerAPI.Event.CommandExecuted, (event) => {
|
|
494
680
|
* const { params, id, type } = event;
|
|
495
681
|
* console.log('command executed', event);
|
|
496
682
|
* });
|
|
683
|
+
*
|
|
684
|
+
* // Remove the event listener, use `disposable.dispose()`
|
|
497
685
|
* ```
|
|
498
686
|
*/
|
|
499
687
|
get CommandExecuted() {
|
|
@@ -504,10 +692,15 @@ const v = class v {
|
|
|
504
692
|
* @see {@link ICommandEvent}
|
|
505
693
|
* @example
|
|
506
694
|
* ```ts
|
|
507
|
-
* univerAPI.addEvent(univerAPI.
|
|
695
|
+
* const disposable = univerAPI.addEvent(univerAPI.Event.BeforeCommandExecute, (event) => {
|
|
508
696
|
* const { params, id, type } = event;
|
|
509
|
-
* console.log('command executed', event);
|
|
697
|
+
* console.log('before command executed', event);
|
|
698
|
+
*
|
|
699
|
+
* // Cancel the command execution
|
|
700
|
+
* event.cancel = true;
|
|
510
701
|
* });
|
|
702
|
+
*
|
|
703
|
+
* // Remove the event listener, use `disposable.dispose()`
|
|
511
704
|
* ```
|
|
512
705
|
*/
|
|
513
706
|
get BeforeCommandExecute() {
|
|
@@ -519,8 +712,8 @@ const v = class v {
|
|
|
519
712
|
*/
|
|
520
713
|
d(v, "_instance");
|
|
521
714
|
let O = v;
|
|
522
|
-
var
|
|
523
|
-
for (var n = r > 1 ? void 0 : r ?
|
|
715
|
+
var $e = Object.getOwnPropertyDescriptor, Me = (i, e, t, r) => {
|
|
716
|
+
for (var n = r > 1 ? void 0 : r ? $e(e, t) : e, o = i.length - 1, s; o >= 0; o--)
|
|
524
717
|
(s = i[o]) && (n = s(n) || n);
|
|
525
718
|
return n;
|
|
526
719
|
}, M = (i, e) => (t, r) => e(t, r, i);
|
|
@@ -530,35 +723,35 @@ let P = class extends $ {
|
|
|
530
723
|
}
|
|
531
724
|
/**
|
|
532
725
|
* @param callback
|
|
533
|
-
* @deprecated use `univerAPI.addEvent(univerAPI.Event.
|
|
726
|
+
* @deprecated use `univerAPI.addEvent(univerAPI.Event.LifeCycleChanged, ({ stage }) => {})` as instead
|
|
534
727
|
*/
|
|
535
728
|
onStarting(i) {
|
|
536
729
|
return p(this._lifecycleService.lifecycle$.pipe(E((e) => e === f.Starting)).subscribe(i));
|
|
537
730
|
}
|
|
538
731
|
/**
|
|
539
732
|
* @param callback
|
|
540
|
-
* @deprecated use `univerAPI.addEvent(univerAPI.Event.
|
|
733
|
+
* @deprecated use `univerAPI.addEvent(univerAPI.Event.LifeCycleChanged, ({ stage }) => {})` as instead
|
|
541
734
|
*/
|
|
542
735
|
onReady(i) {
|
|
543
736
|
return p(this._lifecycleService.lifecycle$.pipe(E((e) => e === f.Ready)).subscribe(i));
|
|
544
737
|
}
|
|
545
738
|
/**
|
|
546
739
|
* @param callback
|
|
547
|
-
* @deprecated use `univerAPI.addEvent(univerAPI.Event.
|
|
740
|
+
* @deprecated use `univerAPI.addEvent(univerAPI.Event.LifeCycleChanged, ({ stage }) => {})` as instead
|
|
548
741
|
*/
|
|
549
742
|
onRendered(i) {
|
|
550
743
|
return p(this._lifecycleService.lifecycle$.pipe(E((e) => e === f.Rendered)).subscribe(i));
|
|
551
744
|
}
|
|
552
745
|
/**
|
|
553
746
|
* @param callback
|
|
554
|
-
* @deprecated use `univerAPI.addEvent(univerAPI.Event.
|
|
747
|
+
* @deprecated use `univerAPI.addEvent(univerAPI.Event.LifeCycleChanged, ({ stage }) => {})` as instead
|
|
555
748
|
*/
|
|
556
749
|
onSteady(i) {
|
|
557
750
|
return p(this._lifecycleService.lifecycle$.pipe(E((e) => e === f.Steady)).subscribe(i));
|
|
558
751
|
}
|
|
559
752
|
/**
|
|
560
753
|
* @param callback
|
|
561
|
-
* @deprecated use `univerAPI.addEvent(univerAPI.Event.BeforeUndo, () => {})` as instead
|
|
754
|
+
* @deprecated use `univerAPI.addEvent(univerAPI.Event.BeforeUndo, (event) => {})` as instead
|
|
562
755
|
*/
|
|
563
756
|
onBeforeUndo(i) {
|
|
564
757
|
return this._injector.get(y).beforeCommandExecuted((t) => {
|
|
@@ -570,7 +763,7 @@ let P = class extends $ {
|
|
|
570
763
|
}
|
|
571
764
|
/**
|
|
572
765
|
* @param callback
|
|
573
|
-
* @deprecated use `univerAPI.addEvent(univerAPI.Event.Undo, () => {})` as instead
|
|
766
|
+
* @deprecated use `univerAPI.addEvent(univerAPI.Event.Undo, (event) => {})` as instead
|
|
574
767
|
*/
|
|
575
768
|
onUndo(i) {
|
|
576
769
|
return this._injector.get(y).onCommandExecuted((t) => {
|
|
@@ -582,7 +775,7 @@ let P = class extends $ {
|
|
|
582
775
|
}
|
|
583
776
|
/**
|
|
584
777
|
* @param callback
|
|
585
|
-
* @deprecated use `univerAPI.addEvent(univerAPI.Event.BeforeRedo, () => {})` as instead
|
|
778
|
+
* @deprecated use `univerAPI.addEvent(univerAPI.Event.BeforeRedo, (event) => {})` as instead
|
|
586
779
|
*/
|
|
587
780
|
onBeforeRedo(i) {
|
|
588
781
|
return this._injector.get(y).beforeCommandExecuted((t) => {
|
|
@@ -594,7 +787,7 @@ let P = class extends $ {
|
|
|
594
787
|
}
|
|
595
788
|
/**
|
|
596
789
|
* @param callback
|
|
597
|
-
* @deprecated use `univerAPI.addEvent(univerAPI.Event.Redo, () => {})` as instead
|
|
790
|
+
* @deprecated use `univerAPI.addEvent(univerAPI.Event.Redo, (event) => {})` as instead
|
|
598
791
|
*/
|
|
599
792
|
onRedo(i) {
|
|
600
793
|
return this._injector.get(y).onCommandExecuted((t) => {
|
|
@@ -605,31 +798,31 @@ let P = class extends $ {
|
|
|
605
798
|
});
|
|
606
799
|
}
|
|
607
800
|
};
|
|
608
|
-
P =
|
|
801
|
+
P = Me([
|
|
609
802
|
M(0, l(_)),
|
|
610
803
|
M(1, l(I))
|
|
611
804
|
], P);
|
|
612
|
-
var
|
|
613
|
-
for (var n = r > 1 ? void 0 : r ?
|
|
805
|
+
var ze = Object.getOwnPropertyDescriptor, Ne = (i, e, t, r) => {
|
|
806
|
+
for (var n = r > 1 ? void 0 : r ? ze(e, t) : e, o = i.length - 1, s; o >= 0; o--)
|
|
614
807
|
(s = i[o]) && (n = s(n) || n);
|
|
615
808
|
return n;
|
|
616
|
-
},
|
|
617
|
-
let j = class extends
|
|
809
|
+
}, Ae = (i, e) => (t, r) => e(t, r, i);
|
|
810
|
+
let j = class extends He {
|
|
618
811
|
constructor(i, e) {
|
|
619
812
|
super(e), this.doc = i;
|
|
620
813
|
}
|
|
621
814
|
};
|
|
622
|
-
j =
|
|
623
|
-
|
|
815
|
+
j = Ne([
|
|
816
|
+
Ae(1, l(_))
|
|
624
817
|
], j);
|
|
625
|
-
class
|
|
818
|
+
class Le {
|
|
626
819
|
constructor() {
|
|
627
820
|
d(this, "_eventRegistry", /* @__PURE__ */ new Map());
|
|
628
821
|
d(this, "_eventHandlerMap", /* @__PURE__ */ new Map());
|
|
629
822
|
d(this, "_eventHandlerRegisted", /* @__PURE__ */ new Map());
|
|
630
823
|
}
|
|
631
824
|
_ensureEventRegistry(e) {
|
|
632
|
-
return this._eventRegistry.has(e) || this._eventRegistry.set(e, new
|
|
825
|
+
return this._eventRegistry.has(e) || this._eventRegistry.set(e, new me()), this._eventRegistry.get(e);
|
|
633
826
|
}
|
|
634
827
|
registerEventHandler(e, t) {
|
|
635
828
|
const r = this._eventHandlerMap.get(e);
|
|
@@ -659,8 +852,9 @@ class Ae {
|
|
|
659
852
|
* @returns {Disposable} The Disposable instance, for remove the listener
|
|
660
853
|
* @example
|
|
661
854
|
* ```ts
|
|
662
|
-
* univerAPI.addEvent(univerAPI.
|
|
663
|
-
*
|
|
855
|
+
* univerAPI.addEvent(univerAPI.Event.LifeCycleChanged, (params) => {
|
|
856
|
+
* const { stage } = params;
|
|
857
|
+
* console.log('life cycle changed', params);
|
|
664
858
|
* });
|
|
665
859
|
* ```
|
|
666
860
|
*/
|
|
@@ -674,7 +868,7 @@ class Ae {
|
|
|
674
868
|
* @returns {boolean} should cancel
|
|
675
869
|
* @example
|
|
676
870
|
* ```ts
|
|
677
|
-
* this.fireEvent(univerAPI.
|
|
871
|
+
* this.fireEvent(univerAPI.Event.LifeCycleChanged, params);
|
|
678
872
|
* ```
|
|
679
873
|
*/
|
|
680
874
|
fireEvent(e, t) {
|
|
@@ -684,8 +878,8 @@ class Ae {
|
|
|
684
878
|
}), t.cancel;
|
|
685
879
|
}
|
|
686
880
|
}
|
|
687
|
-
var
|
|
688
|
-
for (var n = r > 1 ? void 0 : r ?
|
|
881
|
+
var Fe = Object.getOwnPropertyDescriptor, We = (i, e, t, r) => {
|
|
882
|
+
for (var n = r > 1 ? void 0 : r ? Fe(e, t) : e, o = i.length - 1, s; o >= 0; o--)
|
|
689
883
|
(s = i[o]) && (n = s(n) || n);
|
|
690
884
|
return n;
|
|
691
885
|
}, z = (i, e) => (t, r) => e(t, r, i);
|
|
@@ -705,9 +899,9 @@ let B = class extends $ {
|
|
|
705
899
|
return this._userManagerService.getCurrentUser();
|
|
706
900
|
}
|
|
707
901
|
};
|
|
708
|
-
B =
|
|
902
|
+
B = We([
|
|
709
903
|
z(0, l(_)),
|
|
710
|
-
z(1, l(
|
|
904
|
+
z(1, l(Ee))
|
|
711
905
|
], B);
|
|
712
906
|
const C = class C {
|
|
713
907
|
static get() {
|
|
@@ -728,21 +922,43 @@ const C = class C {
|
|
|
728
922
|
}
|
|
729
923
|
/**
|
|
730
924
|
* Rectangle utils, including range operations likes merge, subtract, split
|
|
925
|
+
*
|
|
926
|
+
* @example
|
|
927
|
+
* ```ts
|
|
928
|
+
* const ranges = [
|
|
929
|
+
* { startRow: 0, startColumn: 0, endRow: 1, endColumn: 1 },
|
|
930
|
+
* { startRow: 1, startColumn: 1, endRow: 2, endColumn: 2 }
|
|
931
|
+
* ];
|
|
932
|
+
* const merged = univerAPI.Util.rectangle.mergeRanges(ranges);
|
|
933
|
+
* console.log(merged);
|
|
934
|
+
* ```
|
|
731
935
|
*/
|
|
732
936
|
get rectangle() {
|
|
733
|
-
return
|
|
937
|
+
return be;
|
|
734
938
|
}
|
|
735
939
|
/**
|
|
736
940
|
* Number format utils, including parse and strigify about date, price, etc
|
|
941
|
+
*
|
|
942
|
+
* @example
|
|
943
|
+
* ```ts
|
|
944
|
+
* const text = univerAPI.Util.numfmt.format('#,##0.00', 1234.567);
|
|
945
|
+
* console.log(text);
|
|
946
|
+
* ```
|
|
737
947
|
*/
|
|
738
948
|
get numfmt() {
|
|
739
|
-
return
|
|
949
|
+
return Se;
|
|
740
950
|
}
|
|
741
951
|
/**
|
|
742
952
|
* common tools
|
|
953
|
+
*
|
|
954
|
+
* @example
|
|
955
|
+
* ```ts
|
|
956
|
+
* const key = univerAPI.Util.tools.generateRandomId(6);
|
|
957
|
+
* console.log(key);
|
|
958
|
+
* ```
|
|
743
959
|
*/
|
|
744
960
|
get tools() {
|
|
745
|
-
return
|
|
961
|
+
return Ce;
|
|
746
962
|
}
|
|
747
963
|
};
|
|
748
964
|
/**
|
|
@@ -759,7 +975,7 @@ const w = Symbol("initializers");
|
|
|
759
975
|
let U = class extends V {
|
|
760
976
|
constructor(e, t, r, n) {
|
|
761
977
|
super();
|
|
762
|
-
d(this, "_eventRegistry", new
|
|
978
|
+
d(this, "_eventRegistry", new Le());
|
|
763
979
|
d(this, "registerEventHandler", (e, t) => this._eventRegistry.registerEventHandler(e, t));
|
|
764
980
|
this._injector = e, this._commandService = t, this._univerInstanceService = r, this._lifecycleService = n, this.registerEventHandler(
|
|
765
981
|
this.Event.LifeCycleChanged,
|
|
@@ -784,9 +1000,14 @@ let U = class extends V {
|
|
|
784
1000
|
* @static
|
|
785
1001
|
* @param {Univer | Injector} wrapped - The Univer instance or injector instance.
|
|
786
1002
|
* @returns {FUniver} - The FUniver instance.
|
|
1003
|
+
*
|
|
1004
|
+
* @example
|
|
1005
|
+
* ```ts
|
|
1006
|
+
* const univerAPI = FUniver.newAPI(univer);
|
|
1007
|
+
* ```
|
|
787
1008
|
*/
|
|
788
1009
|
static newAPI(e) {
|
|
789
|
-
return (e instanceof
|
|
1010
|
+
return (e instanceof De ? e.__getInjector() : e).createInstance(U);
|
|
790
1011
|
}
|
|
791
1012
|
/**
|
|
792
1013
|
* @ignore
|
|
@@ -907,6 +1128,16 @@ let U = class extends V {
|
|
|
907
1128
|
* Dispose the UniverSheet by the `unitId`. The UniverSheet would be unload from the application.
|
|
908
1129
|
* @param unitId The unit id of the UniverSheet.
|
|
909
1130
|
* @returns Whether the Univer instance is disposed successfully.
|
|
1131
|
+
*
|
|
1132
|
+
* @example
|
|
1133
|
+
* ```ts
|
|
1134
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
1135
|
+
* const unitId = fWorkbook?.getId();
|
|
1136
|
+
*
|
|
1137
|
+
* if (unitId) {
|
|
1138
|
+
* univerAPI.disposeUnit(unitId);
|
|
1139
|
+
* }
|
|
1140
|
+
* ```
|
|
910
1141
|
*/
|
|
911
1142
|
disposeUnit(e) {
|
|
912
1143
|
return this._univerInstanceService.disposeUnit(e);
|
|
@@ -914,6 +1145,12 @@ let U = class extends V {
|
|
|
914
1145
|
/**
|
|
915
1146
|
* Get the current lifecycle stage.
|
|
916
1147
|
* @returns {LifecycleStages} - The current lifecycle stage.
|
|
1148
|
+
*
|
|
1149
|
+
* @example
|
|
1150
|
+
* ```ts
|
|
1151
|
+
* const stage = univerAPI.getCurrentLifecycleStage();
|
|
1152
|
+
* console.log(stage);
|
|
1153
|
+
* ```
|
|
917
1154
|
*/
|
|
918
1155
|
getCurrentLifecycleStage() {
|
|
919
1156
|
return this._injector.get(I).stage;
|
|
@@ -921,6 +1158,11 @@ let U = class extends V {
|
|
|
921
1158
|
/**
|
|
922
1159
|
* Undo an editing on the currently focused document.
|
|
923
1160
|
* @returns {Promise<boolean>} undo result
|
|
1161
|
+
*
|
|
1162
|
+
* @example
|
|
1163
|
+
* ```ts
|
|
1164
|
+
* univerAPI.undo();
|
|
1165
|
+
* ```
|
|
924
1166
|
*/
|
|
925
1167
|
undo() {
|
|
926
1168
|
return this._commandService.executeCommand(h.id);
|
|
@@ -928,13 +1170,18 @@ let U = class extends V {
|
|
|
928
1170
|
/**
|
|
929
1171
|
* Redo an editing on the currently focused document.
|
|
930
1172
|
* @returns {Promise<boolean>} redo result
|
|
1173
|
+
*
|
|
1174
|
+
* @example
|
|
1175
|
+
* ```ts
|
|
1176
|
+
* univerAPI.redo();
|
|
1177
|
+
* ```
|
|
931
1178
|
*/
|
|
932
1179
|
redo() {
|
|
933
1180
|
return this._commandService.executeCommand(u.id);
|
|
934
1181
|
}
|
|
935
1182
|
/**
|
|
936
1183
|
* Register a callback that will be triggered before invoking a command.
|
|
937
|
-
* @deprecated use `addEvent(univerAPI.
|
|
1184
|
+
* @deprecated use `univerAPI.addEvent(univerAPI.Event.BeforeCommandExecute, (event) => {})` instead.
|
|
938
1185
|
* @param {CommandListener} callback The callback.
|
|
939
1186
|
* @returns {IDisposable} The disposable instance.
|
|
940
1187
|
*/
|
|
@@ -945,7 +1192,7 @@ let U = class extends V {
|
|
|
945
1192
|
}
|
|
946
1193
|
/**
|
|
947
1194
|
* Register a callback that will be triggered when a command is invoked.
|
|
948
|
-
* @deprecated use `addEvent(univerAPI.
|
|
1195
|
+
* @deprecated use `univerAPI.addEvent(univerAPI.Event.CommandExecuted, (event) => {})` instead.
|
|
949
1196
|
* @param {CommandListener} callback The callback.
|
|
950
1197
|
* @returns {IDisposable} The disposable instance.
|
|
951
1198
|
*/
|
|
@@ -960,6 +1207,14 @@ let U = class extends V {
|
|
|
960
1207
|
* @param params Parameters of this execution.
|
|
961
1208
|
* @param options Options of this execution.
|
|
962
1209
|
* @returns The result of the execution. It is a boolean value by default which indicates the command is executed.
|
|
1210
|
+
*
|
|
1211
|
+
* @example
|
|
1212
|
+
* ```ts
|
|
1213
|
+
* univerAPI.executeCommand('sheet.command.set-range-values', {
|
|
1214
|
+
* value: { v: "Hello, Univer!" },
|
|
1215
|
+
* range: { startRow: 0, startColumn: 0, endRow: 0, endColumn: 0 }
|
|
1216
|
+
* });
|
|
1217
|
+
* ```
|
|
963
1218
|
*/
|
|
964
1219
|
executeCommand(e, t, r) {
|
|
965
1220
|
return this._commandService.executeCommand(e, t, r);
|
|
@@ -970,6 +1225,14 @@ let U = class extends V {
|
|
|
970
1225
|
* @param params Parameters of this execution.
|
|
971
1226
|
* @param options Options of this execution.
|
|
972
1227
|
* @returns The result of the execution. It is a boolean value by default which indicates the command is executed.
|
|
1228
|
+
*
|
|
1229
|
+
* @example
|
|
1230
|
+
* ```ts
|
|
1231
|
+
* univerAPI.syncExecuteCommand('sheet.command.set-range-values', {
|
|
1232
|
+
* value: { v: "Hello, Univer!" },
|
|
1233
|
+
* range: { startRow: 0, startColumn: 0, endRow: 0, endColumn: 0 }
|
|
1234
|
+
* });
|
|
1235
|
+
* ```
|
|
973
1236
|
*/
|
|
974
1237
|
syncExecuteCommand(e, t, r) {
|
|
975
1238
|
return this._commandService.syncExecuteCommand(e, t, r);
|
|
@@ -998,9 +1261,13 @@ let U = class extends V {
|
|
|
998
1261
|
* @returns {Disposable} The Disposable instance, for remove the listener
|
|
999
1262
|
* @example
|
|
1000
1263
|
* ```ts
|
|
1001
|
-
*
|
|
1002
|
-
*
|
|
1264
|
+
* // Add life cycle changed event listener
|
|
1265
|
+
* const disposable = univerAPI.addEvent(univerAPI.Event.LifeCycleChanged, (params) => {
|
|
1266
|
+
* const { stage } = params;
|
|
1267
|
+
* console.log('life cycle changed', params);
|
|
1003
1268
|
* });
|
|
1269
|
+
*
|
|
1270
|
+
* // Remove the event listener, use `disposable.dispose()`
|
|
1004
1271
|
* ```
|
|
1005
1272
|
*/
|
|
1006
1273
|
addEvent(e, t) {
|
|
@@ -1014,7 +1281,7 @@ let U = class extends V {
|
|
|
1014
1281
|
* @returns {boolean} should cancel
|
|
1015
1282
|
* @example
|
|
1016
1283
|
* ```ts
|
|
1017
|
-
* this.fireEvent(univerAPI.
|
|
1284
|
+
* this.fireEvent(univerAPI.Event.LifeCycleChanged, params);
|
|
1018
1285
|
* ```
|
|
1019
1286
|
*/
|
|
1020
1287
|
fireEvent(e, t) {
|
|
@@ -1043,7 +1310,7 @@ let U = class extends V {
|
|
|
1043
1310
|
* ```
|
|
1044
1311
|
*/
|
|
1045
1312
|
newColor() {
|
|
1046
|
-
return new
|
|
1313
|
+
return new xe();
|
|
1047
1314
|
}
|
|
1048
1315
|
/**
|
|
1049
1316
|
* Create a new rich text.
|
|
@@ -1051,11 +1318,13 @@ let U = class extends V {
|
|
|
1051
1318
|
* @returns {RichTextBuilder} The new rich text instance
|
|
1052
1319
|
* @example
|
|
1053
1320
|
* ```ts
|
|
1054
|
-
* const richText = univerAPI.newRichText();
|
|
1321
|
+
* const richText = univerAPI.newRichText({ body: { dataStream: 'Hello World\r\n' } });
|
|
1322
|
+
* const range = univerAPI.getActiveWorkbook().getActiveSheet().getRange('A1');
|
|
1323
|
+
* range.setRichTextValueForCell(richText);
|
|
1055
1324
|
* ```
|
|
1056
1325
|
*/
|
|
1057
1326
|
newRichText(e) {
|
|
1058
|
-
return
|
|
1327
|
+
return we.create(e);
|
|
1059
1328
|
}
|
|
1060
1329
|
/**
|
|
1061
1330
|
* Create a new rich text value.
|
|
@@ -1063,11 +1332,13 @@ let U = class extends V {
|
|
|
1063
1332
|
* @returns {RichTextValue} The new rich text value instance
|
|
1064
1333
|
* @example
|
|
1065
1334
|
* ```ts
|
|
1066
|
-
* const richTextValue = univerAPI.newRichTextValue();
|
|
1335
|
+
* const richTextValue = univerAPI.newRichTextValue({ body: { dataStream: 'Hello World\r\n' } });
|
|
1336
|
+
* const range = univerAPI.getActiveWorkbook().getActiveSheet().getRange('A1');
|
|
1337
|
+
* range.setRichTextValueForCell(richTextValue);
|
|
1067
1338
|
* ```
|
|
1068
1339
|
*/
|
|
1069
1340
|
newRichTextValue(e) {
|
|
1070
|
-
return
|
|
1341
|
+
return Te.create(e);
|
|
1071
1342
|
}
|
|
1072
1343
|
/**
|
|
1073
1344
|
* Create a new paragraph style.
|
|
@@ -1075,11 +1346,15 @@ let U = class extends V {
|
|
|
1075
1346
|
* @returns {ParagraphStyleBuilder} The new paragraph style instance
|
|
1076
1347
|
* @example
|
|
1077
1348
|
* ```ts
|
|
1078
|
-
* const
|
|
1349
|
+
* const richText = univerAPI.newRichText({ body: { dataStream: 'Hello World\r\n' } });
|
|
1350
|
+
* const paragraphStyle = univerAPI.newParagraphStyle({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
|
|
1351
|
+
* richText.insertParagraph(paragraphStyle);
|
|
1352
|
+
* const range = univerAPI.getActiveWorkbook().getActiveSheet().getRange('A1');
|
|
1353
|
+
* range.setRichTextValueForCell(richText);
|
|
1079
1354
|
* ```
|
|
1080
1355
|
*/
|
|
1081
1356
|
newParagraphStyle(e) {
|
|
1082
|
-
return
|
|
1357
|
+
return Re.create(e);
|
|
1083
1358
|
}
|
|
1084
1359
|
/**
|
|
1085
1360
|
* Create a new paragraph style value.
|
|
@@ -1091,7 +1366,7 @@ let U = class extends V {
|
|
|
1091
1366
|
* ```
|
|
1092
1367
|
*/
|
|
1093
1368
|
newParagraphStyleValue(e) {
|
|
1094
|
-
return
|
|
1369
|
+
return Oe.create(e);
|
|
1095
1370
|
}
|
|
1096
1371
|
/**
|
|
1097
1372
|
* Create a new text style.
|
|
@@ -1103,7 +1378,7 @@ let U = class extends V {
|
|
|
1103
1378
|
* ```
|
|
1104
1379
|
*/
|
|
1105
1380
|
newTextStyle(e) {
|
|
1106
|
-
return
|
|
1381
|
+
return Pe.create(e);
|
|
1107
1382
|
}
|
|
1108
1383
|
/**
|
|
1109
1384
|
* Create a new text style value.
|
|
@@ -1115,7 +1390,7 @@ let U = class extends V {
|
|
|
1115
1390
|
* ```
|
|
1116
1391
|
*/
|
|
1117
1392
|
newTextStyleValue(e) {
|
|
1118
|
-
return
|
|
1393
|
+
return je.create(e);
|
|
1119
1394
|
}
|
|
1120
1395
|
/**
|
|
1121
1396
|
* Create a new text decoration.
|
|
@@ -1127,7 +1402,7 @@ let U = class extends V {
|
|
|
1127
1402
|
* ```
|
|
1128
1403
|
*/
|
|
1129
1404
|
newTextDecoration(e) {
|
|
1130
|
-
return new
|
|
1405
|
+
return new Be(e);
|
|
1131
1406
|
}
|
|
1132
1407
|
};
|
|
1133
1408
|
U = Ge([
|
|
@@ -1138,7 +1413,7 @@ U = Ge([
|
|
|
1138
1413
|
], U);
|
|
1139
1414
|
export {
|
|
1140
1415
|
$ as FBase,
|
|
1141
|
-
|
|
1416
|
+
He as FBaseInitialable,
|
|
1142
1417
|
S as FBlob,
|
|
1143
1418
|
R as FEnum,
|
|
1144
1419
|
O as FEventName,
|