@univerjs/core 0.6.9 → 0.6.10-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/facade.js +1 -1
- package/lib/cjs/index.js +8 -8
- package/lib/es/facade.js +166 -156
- package/lib/es/index.js +2575 -2565
- package/lib/facade.js +166 -156
- package/lib/index.js +2575 -2565
- package/lib/types/docs/data-model/text-x/build-utils/selection.d.ts +3 -3
- package/lib/types/facade/f-event.d.ts +5 -3
- package/lib/types/index.d.ts +1 -1
- package/lib/types/shared/rxjs.d.ts +2 -1
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +8 -8
- package/package.json +2 -2
package/lib/es/facade.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var d = (n, e, t) =>
|
|
4
|
-
import { Disposable as
|
|
5
|
-
import { filter as
|
|
6
|
-
class
|
|
1
|
+
var L = Object.defineProperty;
|
|
2
|
+
var F = (n, e, t) => e in n ? L(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
3
|
+
var d = (n, e, t) => F(n, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { Disposable as I, Inject as p, Injector as m, AbsoluteRefType as W, UniverInstanceType as R, LifecycleStages as f, DataValidationType as q, DataValidationErrorStyle as G, DataValidationRenderMode as J, DataValidationOperator as K, DataValidationStatus as Q, CommandType as X, BaselineOffset as Y, BooleanNumber as Z, HorizontalAlign as k, TextDecoration as ee, TextDirection as te, VerticalAlign as re, WrapStrategy as ne, BorderType as ie, BorderStyleTypes as oe, AutoFillSeries as se, ColorType as ce, CommonHideTypes as ae, CopyPasteType as de, DeleteDirection as le, DeveloperMetadataVisibility as pe, Dimension as he, Direction as ue, InterpolationPointType as ye, LocaleType as ge, MentionType as ve, ProtectionType as fe, RelativeDate as me, SheetTypes as _e, ThemeColorType as Ee, LifecycleService as $, toDisposable as l, ICommandService as y, UndoCommand as h, IUndoRedoService as E, RedoCommand as u, Registry as be, UserManagerService as Se, Rectangle as Ce, numfmt as De, Tools as xe, IUniverInstanceService as N, Univer as Te, CanceledError as x, ColorBuilder as we, RichTextBuilder as Re, RichTextValue as Pe, ParagraphStyleBuilder as Oe, ParagraphStyleValue as je, TextStyleBuilder as Be, TextStyleValue as Ue, TextDecorationBuilder as He } from "@univerjs/core";
|
|
5
|
+
import { filter as b } from "rxjs";
|
|
6
|
+
class M extends I {
|
|
7
7
|
/**
|
|
8
8
|
* @ignore
|
|
9
9
|
*/
|
|
@@ -15,11 +15,11 @@ class $ extends V {
|
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
-
const
|
|
19
|
-
class
|
|
18
|
+
const T = Symbol("initializers");
|
|
19
|
+
class Ve extends I {
|
|
20
20
|
constructor(e) {
|
|
21
21
|
super(), this._injector = e;
|
|
22
|
-
const t = this, r = Object.getPrototypeOf(this)[
|
|
22
|
+
const t = this, r = Object.getPrototypeOf(this)[T];
|
|
23
23
|
r && r.forEach(function(i) {
|
|
24
24
|
i.apply(t, [e]);
|
|
25
25
|
});
|
|
@@ -35,20 +35,20 @@ class Ue extends V {
|
|
|
35
35
|
static extend(e) {
|
|
36
36
|
Object.getOwnPropertyNames(e.prototype).forEach((t) => {
|
|
37
37
|
if (t === "_initialize") {
|
|
38
|
-
let r = this.prototype[
|
|
39
|
-
r || (r = [], this.prototype[
|
|
38
|
+
let r = this.prototype[T];
|
|
39
|
+
r || (r = [], this.prototype[T] = r), r.push(e.prototype._initialize);
|
|
40
40
|
} else t !== "constructor" && (this.prototype[t] = e.prototype[t]);
|
|
41
41
|
}), Object.getOwnPropertyNames(e).forEach((t) => {
|
|
42
42
|
t !== "prototype" && t !== "name" && t !== "length" && (this[t] = e[t]);
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
var
|
|
47
|
-
for (var i = r > 1 ? void 0 : r ?
|
|
46
|
+
var Ie = Object.getOwnPropertyDescriptor, $e = (n, e, t, r) => {
|
|
47
|
+
for (var i = r > 1 ? void 0 : r ? Ie(e, t) : e, o = n.length - 1, s; o >= 0; o--)
|
|
48
48
|
(s = n[o]) && (i = s(i) || i);
|
|
49
49
|
return i;
|
|
50
|
-
},
|
|
51
|
-
let
|
|
50
|
+
}, Me = (n, e) => (t, r) => e(t, r, n);
|
|
51
|
+
let C = class extends M {
|
|
52
52
|
constructor(n, e) {
|
|
53
53
|
super(), this._blob = n, this._injector = e;
|
|
54
54
|
}
|
|
@@ -63,7 +63,7 @@ let S = class extends $ {
|
|
|
63
63
|
* ```
|
|
64
64
|
*/
|
|
65
65
|
copyBlob() {
|
|
66
|
-
return this._injector.createInstance(
|
|
66
|
+
return this._injector.createInstance(C, this._blob);
|
|
67
67
|
}
|
|
68
68
|
/**
|
|
69
69
|
* Return the data inside this object as a blob converted to the specified content type.
|
|
@@ -150,9 +150,9 @@ let S = class extends $ {
|
|
|
150
150
|
return this._blob = (e = this._blob) == null ? void 0 : e.slice(0, this._blob.size, n), this;
|
|
151
151
|
}
|
|
152
152
|
};
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
],
|
|
153
|
+
C = $e([
|
|
154
|
+
Me(1, p(m))
|
|
155
|
+
], C);
|
|
156
156
|
const g = class g {
|
|
157
157
|
static get() {
|
|
158
158
|
if (this._instance)
|
|
@@ -183,7 +183,7 @@ const g = class g {
|
|
|
183
183
|
* ```
|
|
184
184
|
*/
|
|
185
185
|
get AbsoluteRefType() {
|
|
186
|
-
return
|
|
186
|
+
return W;
|
|
187
187
|
}
|
|
188
188
|
/**
|
|
189
189
|
* Defines different types of Univer instances
|
|
@@ -194,7 +194,7 @@ const g = class g {
|
|
|
194
194
|
* ```
|
|
195
195
|
*/
|
|
196
196
|
get UniverInstanceType() {
|
|
197
|
-
return
|
|
197
|
+
return R;
|
|
198
198
|
}
|
|
199
199
|
/**
|
|
200
200
|
* Represents different stages in the lifecycle
|
|
@@ -216,7 +216,7 @@ const g = class g {
|
|
|
216
216
|
* ```
|
|
217
217
|
*/
|
|
218
218
|
get DataValidationType() {
|
|
219
|
-
return
|
|
219
|
+
return q;
|
|
220
220
|
}
|
|
221
221
|
/**
|
|
222
222
|
* Different error display styles
|
|
@@ -227,7 +227,7 @@ const g = class g {
|
|
|
227
227
|
* ```
|
|
228
228
|
*/
|
|
229
229
|
get DataValidationErrorStyle() {
|
|
230
|
-
return
|
|
230
|
+
return G;
|
|
231
231
|
}
|
|
232
232
|
/**
|
|
233
233
|
* Different validation rendering modes
|
|
@@ -238,7 +238,7 @@ const g = class g {
|
|
|
238
238
|
* ```
|
|
239
239
|
*/
|
|
240
240
|
get DataValidationRenderMode() {
|
|
241
|
-
return
|
|
241
|
+
return J;
|
|
242
242
|
}
|
|
243
243
|
/**
|
|
244
244
|
* Different validation operators
|
|
@@ -249,7 +249,7 @@ const g = class g {
|
|
|
249
249
|
* ```
|
|
250
250
|
*/
|
|
251
251
|
get DataValidationOperator() {
|
|
252
|
-
return
|
|
252
|
+
return K;
|
|
253
253
|
}
|
|
254
254
|
/**
|
|
255
255
|
* Different validation states
|
|
@@ -260,7 +260,7 @@ const g = class g {
|
|
|
260
260
|
* ```
|
|
261
261
|
*/
|
|
262
262
|
get DataValidationStatus() {
|
|
263
|
-
return
|
|
263
|
+
return Q;
|
|
264
264
|
}
|
|
265
265
|
/**
|
|
266
266
|
* Different types of commands
|
|
@@ -271,7 +271,7 @@ const g = class g {
|
|
|
271
271
|
* ```
|
|
272
272
|
*/
|
|
273
273
|
get CommandType() {
|
|
274
|
-
return
|
|
274
|
+
return X;
|
|
275
275
|
}
|
|
276
276
|
/**
|
|
277
277
|
* Different baseline offsets for text baseline positioning
|
|
@@ -282,7 +282,7 @@ const g = class g {
|
|
|
282
282
|
* ```
|
|
283
283
|
*/
|
|
284
284
|
get BaselineOffset() {
|
|
285
|
-
return
|
|
285
|
+
return Y;
|
|
286
286
|
}
|
|
287
287
|
/**
|
|
288
288
|
* Boolean number representations
|
|
@@ -293,7 +293,7 @@ const g = class g {
|
|
|
293
293
|
* ```
|
|
294
294
|
*/
|
|
295
295
|
get BooleanNumber() {
|
|
296
|
-
return
|
|
296
|
+
return Z;
|
|
297
297
|
}
|
|
298
298
|
/**
|
|
299
299
|
* Different horizontal text alignment options
|
|
@@ -304,7 +304,7 @@ const g = class g {
|
|
|
304
304
|
* ```
|
|
305
305
|
*/
|
|
306
306
|
get HorizontalAlign() {
|
|
307
|
-
return
|
|
307
|
+
return k;
|
|
308
308
|
}
|
|
309
309
|
/**
|
|
310
310
|
* Different text decoration styles
|
|
@@ -315,7 +315,7 @@ const g = class g {
|
|
|
315
315
|
* ```
|
|
316
316
|
*/
|
|
317
317
|
get TextDecoration() {
|
|
318
|
-
return
|
|
318
|
+
return ee;
|
|
319
319
|
}
|
|
320
320
|
/**
|
|
321
321
|
* Different text direction options
|
|
@@ -326,7 +326,7 @@ const g = class g {
|
|
|
326
326
|
* ```
|
|
327
327
|
*/
|
|
328
328
|
get TextDirection() {
|
|
329
|
-
return
|
|
329
|
+
return te;
|
|
330
330
|
}
|
|
331
331
|
/**
|
|
332
332
|
* Different vertical text alignment options
|
|
@@ -337,7 +337,7 @@ const g = class g {
|
|
|
337
337
|
* ```
|
|
338
338
|
*/
|
|
339
339
|
get VerticalAlign() {
|
|
340
|
-
return
|
|
340
|
+
return re;
|
|
341
341
|
}
|
|
342
342
|
/**
|
|
343
343
|
* Different wrap strategy options
|
|
@@ -348,7 +348,7 @@ const g = class g {
|
|
|
348
348
|
* ```
|
|
349
349
|
*/
|
|
350
350
|
get WrapStrategy() {
|
|
351
|
-
return
|
|
351
|
+
return ne;
|
|
352
352
|
}
|
|
353
353
|
/**
|
|
354
354
|
* Different border types
|
|
@@ -359,7 +359,7 @@ const g = class g {
|
|
|
359
359
|
* ```
|
|
360
360
|
*/
|
|
361
361
|
get BorderType() {
|
|
362
|
-
return
|
|
362
|
+
return ie;
|
|
363
363
|
}
|
|
364
364
|
/**
|
|
365
365
|
* Different border style types
|
|
@@ -370,7 +370,7 @@ const g = class g {
|
|
|
370
370
|
* ```
|
|
371
371
|
*/
|
|
372
372
|
get BorderStyleTypes() {
|
|
373
|
-
return
|
|
373
|
+
return oe;
|
|
374
374
|
}
|
|
375
375
|
/**
|
|
376
376
|
* Auto fill series types
|
|
@@ -381,7 +381,7 @@ const g = class g {
|
|
|
381
381
|
* ```
|
|
382
382
|
*/
|
|
383
383
|
get AutoFillSeries() {
|
|
384
|
-
return
|
|
384
|
+
return se;
|
|
385
385
|
}
|
|
386
386
|
/**
|
|
387
387
|
* Color types
|
|
@@ -392,7 +392,7 @@ const g = class g {
|
|
|
392
392
|
* ```
|
|
393
393
|
*/
|
|
394
394
|
get ColorType() {
|
|
395
|
-
return
|
|
395
|
+
return ce;
|
|
396
396
|
}
|
|
397
397
|
/**
|
|
398
398
|
* Common hide types
|
|
@@ -403,7 +403,7 @@ const g = class g {
|
|
|
403
403
|
* ```
|
|
404
404
|
*/
|
|
405
405
|
get CommonHideTypes() {
|
|
406
|
-
return
|
|
406
|
+
return ae;
|
|
407
407
|
}
|
|
408
408
|
/**
|
|
409
409
|
* Copy paste types
|
|
@@ -414,7 +414,7 @@ const g = class g {
|
|
|
414
414
|
* ```
|
|
415
415
|
*/
|
|
416
416
|
get CopyPasteType() {
|
|
417
|
-
return
|
|
417
|
+
return de;
|
|
418
418
|
}
|
|
419
419
|
/**
|
|
420
420
|
* Delete direction types
|
|
@@ -425,7 +425,7 @@ const g = class g {
|
|
|
425
425
|
* ```
|
|
426
426
|
*/
|
|
427
427
|
get DeleteDirection() {
|
|
428
|
-
return
|
|
428
|
+
return le;
|
|
429
429
|
}
|
|
430
430
|
/**
|
|
431
431
|
* Developer metadata visibility types
|
|
@@ -447,7 +447,7 @@ const g = class g {
|
|
|
447
447
|
* ```
|
|
448
448
|
*/
|
|
449
449
|
get Dimension() {
|
|
450
|
-
return
|
|
450
|
+
return he;
|
|
451
451
|
}
|
|
452
452
|
/**
|
|
453
453
|
* Direction types
|
|
@@ -458,7 +458,7 @@ const g = class g {
|
|
|
458
458
|
* ```
|
|
459
459
|
*/
|
|
460
460
|
get Direction() {
|
|
461
|
-
return
|
|
461
|
+
return ue;
|
|
462
462
|
}
|
|
463
463
|
/**
|
|
464
464
|
* Interpolation point types
|
|
@@ -469,7 +469,7 @@ const g = class g {
|
|
|
469
469
|
* ```
|
|
470
470
|
*/
|
|
471
471
|
get InterpolationPointType() {
|
|
472
|
-
return
|
|
472
|
+
return ye;
|
|
473
473
|
}
|
|
474
474
|
/**
|
|
475
475
|
* Locale types
|
|
@@ -480,7 +480,7 @@ const g = class g {
|
|
|
480
480
|
* ```
|
|
481
481
|
*/
|
|
482
482
|
get LocaleType() {
|
|
483
|
-
return
|
|
483
|
+
return ge;
|
|
484
484
|
}
|
|
485
485
|
/**
|
|
486
486
|
* Mention types
|
|
@@ -491,7 +491,7 @@ const g = class g {
|
|
|
491
491
|
* ```
|
|
492
492
|
*/
|
|
493
493
|
get MentionType() {
|
|
494
|
-
return
|
|
494
|
+
return ve;
|
|
495
495
|
}
|
|
496
496
|
/**
|
|
497
497
|
* Protection types
|
|
@@ -502,7 +502,7 @@ const g = class g {
|
|
|
502
502
|
* ```
|
|
503
503
|
*/
|
|
504
504
|
get ProtectionType() {
|
|
505
|
-
return
|
|
505
|
+
return fe;
|
|
506
506
|
}
|
|
507
507
|
/**
|
|
508
508
|
* Relative date types
|
|
@@ -513,7 +513,7 @@ const g = class g {
|
|
|
513
513
|
* ```
|
|
514
514
|
*/
|
|
515
515
|
get RelativeDate() {
|
|
516
|
-
return
|
|
516
|
+
return me;
|
|
517
517
|
}
|
|
518
518
|
/**
|
|
519
519
|
* Sheet types
|
|
@@ -535,14 +535,14 @@ const g = class g {
|
|
|
535
535
|
* ```
|
|
536
536
|
*/
|
|
537
537
|
get ThemeColorType() {
|
|
538
|
-
return
|
|
538
|
+
return Ee;
|
|
539
539
|
}
|
|
540
540
|
};
|
|
541
541
|
/**
|
|
542
542
|
* @ignore
|
|
543
543
|
*/
|
|
544
544
|
d(g, "_instance");
|
|
545
|
-
let
|
|
545
|
+
let P = g;
|
|
546
546
|
const v = class v {
|
|
547
547
|
static get() {
|
|
548
548
|
if (this._instance)
|
|
@@ -688,7 +688,7 @@ const v = class v {
|
|
|
688
688
|
* @example
|
|
689
689
|
* ```ts
|
|
690
690
|
* const disposable = univerAPI.addEvent(univerAPI.Event.CommandExecuted, (event) => {
|
|
691
|
-
* const { params, id, type } = event;
|
|
691
|
+
* const { params, id, type, options } = event;
|
|
692
692
|
* console.log('command executed', event);
|
|
693
693
|
* });
|
|
694
694
|
*
|
|
@@ -704,7 +704,7 @@ const v = class v {
|
|
|
704
704
|
* @example
|
|
705
705
|
* ```ts
|
|
706
706
|
* const disposable = univerAPI.addEvent(univerAPI.Event.BeforeCommandExecute, (event) => {
|
|
707
|
-
* const { params, id, type } = event;
|
|
707
|
+
* const { params, id, type, options } = event;
|
|
708
708
|
* console.log('before command executed', event);
|
|
709
709
|
*
|
|
710
710
|
* // Cancel the command execution
|
|
@@ -723,12 +723,12 @@ const v = class v {
|
|
|
723
723
|
*/
|
|
724
724
|
d(v, "_instance");
|
|
725
725
|
let O = v;
|
|
726
|
-
var
|
|
727
|
-
for (var i = r > 1 ? void 0 : r ?
|
|
726
|
+
var ze = Object.getOwnPropertyDescriptor, Ae = (n, e, t, r) => {
|
|
727
|
+
for (var i = r > 1 ? void 0 : r ? ze(e, t) : e, o = n.length - 1, s; o >= 0; o--)
|
|
728
728
|
(s = n[o]) && (i = s(i) || i);
|
|
729
729
|
return i;
|
|
730
|
-
},
|
|
731
|
-
let
|
|
730
|
+
}, z = (n, e) => (t, r) => e(t, r, n);
|
|
731
|
+
let j = class extends M {
|
|
732
732
|
constructor(n, e) {
|
|
733
733
|
super(), this._injector = n, this._lifecycleService = e;
|
|
734
734
|
}
|
|
@@ -737,28 +737,28 @@ let P = class extends $ {
|
|
|
737
737
|
* @deprecated use `univerAPI.addEvent(univerAPI.Event.LifeCycleChanged, ({ stage }) => {})` as instead
|
|
738
738
|
*/
|
|
739
739
|
onStarting(n) {
|
|
740
|
-
return
|
|
740
|
+
return l(this._lifecycleService.lifecycle$.pipe(b((e) => e === f.Starting)).subscribe(n));
|
|
741
741
|
}
|
|
742
742
|
/**
|
|
743
743
|
* @param callback
|
|
744
744
|
* @deprecated use `univerAPI.addEvent(univerAPI.Event.LifeCycleChanged, ({ stage }) => {})` as instead
|
|
745
745
|
*/
|
|
746
746
|
onReady(n) {
|
|
747
|
-
return
|
|
747
|
+
return l(this._lifecycleService.lifecycle$.pipe(b((e) => e === f.Ready)).subscribe(n));
|
|
748
748
|
}
|
|
749
749
|
/**
|
|
750
750
|
* @param callback
|
|
751
751
|
* @deprecated use `univerAPI.addEvent(univerAPI.Event.LifeCycleChanged, ({ stage }) => {})` as instead
|
|
752
752
|
*/
|
|
753
753
|
onRendered(n) {
|
|
754
|
-
return
|
|
754
|
+
return l(this._lifecycleService.lifecycle$.pipe(b((e) => e === f.Rendered)).subscribe(n));
|
|
755
755
|
}
|
|
756
756
|
/**
|
|
757
757
|
* @param callback
|
|
758
758
|
* @deprecated use `univerAPI.addEvent(univerAPI.Event.LifeCycleChanged, ({ stage }) => {})` as instead
|
|
759
759
|
*/
|
|
760
760
|
onSteady(n) {
|
|
761
|
-
return
|
|
761
|
+
return l(this._lifecycleService.lifecycle$.pipe(b((e) => e === f.Steady)).subscribe(n));
|
|
762
762
|
}
|
|
763
763
|
/**
|
|
764
764
|
* @param callback
|
|
@@ -767,7 +767,7 @@ let P = class extends $ {
|
|
|
767
767
|
onBeforeUndo(n) {
|
|
768
768
|
return this._injector.get(y).beforeCommandExecuted((t) => {
|
|
769
769
|
if (t.id === h.id) {
|
|
770
|
-
const i = this._injector.get(
|
|
770
|
+
const i = this._injector.get(E).pitchTopUndoElement();
|
|
771
771
|
i && n(i);
|
|
772
772
|
}
|
|
773
773
|
});
|
|
@@ -779,7 +779,7 @@ let P = class extends $ {
|
|
|
779
779
|
onUndo(n) {
|
|
780
780
|
return this._injector.get(y).onCommandExecuted((t) => {
|
|
781
781
|
if (t.id === h.id) {
|
|
782
|
-
const i = this._injector.get(
|
|
782
|
+
const i = this._injector.get(E).pitchTopUndoElement();
|
|
783
783
|
i && n(i);
|
|
784
784
|
}
|
|
785
785
|
});
|
|
@@ -791,7 +791,7 @@ let P = class extends $ {
|
|
|
791
791
|
onBeforeRedo(n) {
|
|
792
792
|
return this._injector.get(y).beforeCommandExecuted((t) => {
|
|
793
793
|
if (t.id === u.id) {
|
|
794
|
-
const i = this._injector.get(
|
|
794
|
+
const i = this._injector.get(E).pitchTopRedoElement();
|
|
795
795
|
i && n(i);
|
|
796
796
|
}
|
|
797
797
|
});
|
|
@@ -803,43 +803,43 @@ let P = class extends $ {
|
|
|
803
803
|
onRedo(n) {
|
|
804
804
|
return this._injector.get(y).onCommandExecuted((t) => {
|
|
805
805
|
if (t.id === u.id) {
|
|
806
|
-
const i = this._injector.get(
|
|
806
|
+
const i = this._injector.get(E).pitchTopRedoElement();
|
|
807
807
|
i && n(i);
|
|
808
808
|
}
|
|
809
809
|
});
|
|
810
810
|
}
|
|
811
811
|
};
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
],
|
|
816
|
-
var
|
|
817
|
-
for (var i = r > 1 ? void 0 : r ?
|
|
812
|
+
j = Ae([
|
|
813
|
+
z(0, p(m)),
|
|
814
|
+
z(1, p($))
|
|
815
|
+
], j);
|
|
816
|
+
var Ne = Object.getOwnPropertyDescriptor, Le = (n, e, t, r) => {
|
|
817
|
+
for (var i = r > 1 ? void 0 : r ? Ne(e, t) : e, o = n.length - 1, s; o >= 0; o--)
|
|
818
818
|
(s = n[o]) && (i = s(i) || i);
|
|
819
819
|
return i;
|
|
820
|
-
},
|
|
821
|
-
let
|
|
820
|
+
}, Fe = (n, e) => (t, r) => e(t, r, n);
|
|
821
|
+
let B = class extends Ve {
|
|
822
822
|
constructor(n, e) {
|
|
823
823
|
super(e), this.doc = n;
|
|
824
824
|
}
|
|
825
825
|
};
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
],
|
|
829
|
-
class
|
|
826
|
+
B = Le([
|
|
827
|
+
Fe(1, p(m))
|
|
828
|
+
], B);
|
|
829
|
+
class We {
|
|
830
830
|
constructor() {
|
|
831
831
|
d(this, "_eventRegistry", /* @__PURE__ */ new Map());
|
|
832
832
|
d(this, "_eventHandlerMap", /* @__PURE__ */ new Map());
|
|
833
833
|
d(this, "_eventHandlerRegisted", /* @__PURE__ */ new Map());
|
|
834
834
|
}
|
|
835
835
|
_ensureEventRegistry(e) {
|
|
836
|
-
return this._eventRegistry.has(e) || this._eventRegistry.set(e, new
|
|
836
|
+
return this._eventRegistry.has(e) || this._eventRegistry.set(e, new be()), this._eventRegistry.get(e);
|
|
837
837
|
}
|
|
838
838
|
registerEventHandler(e, t) {
|
|
839
839
|
const r = this._eventHandlerMap.get(e);
|
|
840
|
-
return r ? r.add(t) : this._eventHandlerMap.set(e, /* @__PURE__ */ new Set([t])), this._ensureEventRegistry(e).getData().length && this._initEventHandler(e),
|
|
841
|
-
var i, o, s,
|
|
842
|
-
(i = this._eventHandlerMap.get(e)) == null || i.delete(t), (s = (o = this._eventHandlerRegisted.get(e)) == null ? void 0 : o.get(t)) == null || s.dispose(), (
|
|
840
|
+
return r ? r.add(t) : this._eventHandlerMap.set(e, /* @__PURE__ */ new Set([t])), this._ensureEventRegistry(e).getData().length && this._initEventHandler(e), l(() => {
|
|
841
|
+
var i, o, s, c;
|
|
842
|
+
(i = this._eventHandlerMap.get(e)) == null || i.delete(t), (s = (o = this._eventHandlerRegisted.get(e)) == null ? void 0 : o.get(t)) == null || s.dispose(), (c = this._eventHandlerRegisted.get(e)) == null || c.delete(t);
|
|
843
843
|
});
|
|
844
844
|
}
|
|
845
845
|
removeEvent(e, t) {
|
|
@@ -853,7 +853,7 @@ class Fe {
|
|
|
853
853
|
let t = this._eventHandlerRegisted.get(e);
|
|
854
854
|
const r = this._eventHandlerMap.get(e);
|
|
855
855
|
r && (t || (t = /* @__PURE__ */ new Map(), this._eventHandlerRegisted.set(e, t), r == null || r.forEach((i) => {
|
|
856
|
-
t == null || t.set(i,
|
|
856
|
+
t == null || t.set(i, l(i()));
|
|
857
857
|
})));
|
|
858
858
|
}
|
|
859
859
|
/**
|
|
@@ -870,7 +870,7 @@ class Fe {
|
|
|
870
870
|
* ```
|
|
871
871
|
*/
|
|
872
872
|
addEvent(e, t) {
|
|
873
|
-
return this._ensureEventRegistry(e).add(t), this._initEventHandler(e),
|
|
873
|
+
return this._ensureEventRegistry(e).add(t), this._initEventHandler(e), l(() => this.removeEvent(e, t));
|
|
874
874
|
}
|
|
875
875
|
/**
|
|
876
876
|
* Fire an event, used in internal only.
|
|
@@ -889,12 +889,12 @@ class Fe {
|
|
|
889
889
|
}), t.cancel;
|
|
890
890
|
}
|
|
891
891
|
}
|
|
892
|
-
var
|
|
893
|
-
for (var i = r > 1 ? void 0 : r ?
|
|
892
|
+
var qe = Object.getOwnPropertyDescriptor, Ge = (n, e, t, r) => {
|
|
893
|
+
for (var i = r > 1 ? void 0 : r ? qe(e, t) : e, o = n.length - 1, s; o >= 0; o--)
|
|
894
894
|
(s = n[o]) && (i = s(i) || i);
|
|
895
895
|
return i;
|
|
896
|
-
},
|
|
897
|
-
let
|
|
896
|
+
}, A = (n, e) => (t, r) => e(t, r, n);
|
|
897
|
+
let U = class extends M {
|
|
898
898
|
constructor(n, e) {
|
|
899
899
|
super(), this._injector = n, this._userManagerService = e;
|
|
900
900
|
}
|
|
@@ -910,15 +910,15 @@ let B = class extends $ {
|
|
|
910
910
|
return this._userManagerService.getCurrentUser();
|
|
911
911
|
}
|
|
912
912
|
};
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
],
|
|
917
|
-
const
|
|
913
|
+
U = Ge([
|
|
914
|
+
A(0, p(m)),
|
|
915
|
+
A(1, p(Se))
|
|
916
|
+
], U);
|
|
917
|
+
const D = class D {
|
|
918
918
|
static get() {
|
|
919
919
|
if (this._instance)
|
|
920
920
|
return this._instance;
|
|
921
|
-
const e = new
|
|
921
|
+
const e = new D();
|
|
922
922
|
return this._instance = e, e;
|
|
923
923
|
}
|
|
924
924
|
/**
|
|
@@ -945,7 +945,7 @@ const C = class C {
|
|
|
945
945
|
* ```
|
|
946
946
|
*/
|
|
947
947
|
get rectangle() {
|
|
948
|
-
return
|
|
948
|
+
return Ce;
|
|
949
949
|
}
|
|
950
950
|
/**
|
|
951
951
|
* Number format utils, including parse and strigify about date, price, etc
|
|
@@ -957,7 +957,7 @@ const C = class C {
|
|
|
957
957
|
* ```
|
|
958
958
|
*/
|
|
959
959
|
get numfmt() {
|
|
960
|
-
return
|
|
960
|
+
return De;
|
|
961
961
|
}
|
|
962
962
|
/**
|
|
963
963
|
* common tools
|
|
@@ -969,28 +969,28 @@ const C = class C {
|
|
|
969
969
|
* ```
|
|
970
970
|
*/
|
|
971
971
|
get tools() {
|
|
972
|
-
return
|
|
972
|
+
return xe;
|
|
973
973
|
}
|
|
974
974
|
};
|
|
975
975
|
/**
|
|
976
976
|
* @ignore
|
|
977
977
|
*/
|
|
978
|
-
d(
|
|
979
|
-
let H =
|
|
980
|
-
var
|
|
981
|
-
for (var i = r > 1 ? void 0 : r ?
|
|
978
|
+
d(D, "_instance");
|
|
979
|
+
let H = D;
|
|
980
|
+
var Je = Object.getOwnPropertyDescriptor, Ke = (n, e, t, r) => {
|
|
981
|
+
for (var i = r > 1 ? void 0 : r ? Je(e, t) : e, o = n.length - 1, s; o >= 0; o--)
|
|
982
982
|
(s = n[o]) && (i = s(i) || i);
|
|
983
983
|
return i;
|
|
984
|
-
},
|
|
985
|
-
const
|
|
986
|
-
let
|
|
984
|
+
}, S = (n, e) => (t, r) => e(t, r, n);
|
|
985
|
+
const w = Symbol("initializers");
|
|
986
|
+
let V = class extends I {
|
|
987
987
|
constructor(e, t, r, i) {
|
|
988
988
|
super();
|
|
989
|
-
d(this, "_eventRegistry", new
|
|
989
|
+
d(this, "_eventRegistry", new We());
|
|
990
990
|
d(this, "registerEventHandler", (e, t) => this._eventRegistry.registerEventHandler(e, t));
|
|
991
991
|
this._injector = e, this._commandService = t, this._univerInstanceService = r, this._lifecycleService = i, this.registerEventHandler(
|
|
992
992
|
this.Event.LifeCycleChanged,
|
|
993
|
-
() =>
|
|
993
|
+
() => l(
|
|
994
994
|
this._lifecycleService.lifecycle$.subscribe((s) => {
|
|
995
995
|
this.fireEvent(this.Event.LifeCycleChanged, { stage: s });
|
|
996
996
|
})
|
|
@@ -998,11 +998,11 @@ let U = class extends V {
|
|
|
998
998
|
), this._initUnitEvent(this._injector), this._initBeforeCommandEvent(this._injector), this._initCommandEvent(this._injector), this._injector.onDispose(() => {
|
|
999
999
|
this.dispose();
|
|
1000
1000
|
});
|
|
1001
|
-
const o = Object.getPrototypeOf(this)[
|
|
1001
|
+
const o = Object.getPrototypeOf(this)[w];
|
|
1002
1002
|
if (o) {
|
|
1003
1003
|
const s = this;
|
|
1004
|
-
o.forEach(function(
|
|
1005
|
-
|
|
1004
|
+
o.forEach(function(c) {
|
|
1005
|
+
c.apply(s, [e]);
|
|
1006
1006
|
});
|
|
1007
1007
|
}
|
|
1008
1008
|
}
|
|
@@ -1018,7 +1018,17 @@ let U = class extends V {
|
|
|
1018
1018
|
* ```
|
|
1019
1019
|
*/
|
|
1020
1020
|
static newAPI(e) {
|
|
1021
|
-
|
|
1021
|
+
const r = (e instanceof Te ? e.__getInjector() : e).createInstance(V);
|
|
1022
|
+
return new Proxy(r, {
|
|
1023
|
+
get(i, o, s) {
|
|
1024
|
+
const c = Reflect.get(i, o, s);
|
|
1025
|
+
if (typeof c < "u")
|
|
1026
|
+
return c;
|
|
1027
|
+
throw new TypeError(
|
|
1028
|
+
`[FUniver]: The method '${String(o)}' does not exist on the FUniver instance. This may occur if you haven't imported the required facade package or if you're calling an incorrect method. Please verify the method name and ensure all necessary modules are imported.`
|
|
1029
|
+
);
|
|
1030
|
+
}
|
|
1031
|
+
});
|
|
1022
1032
|
}
|
|
1023
1033
|
/**
|
|
1024
1034
|
* @ignore
|
|
@@ -1031,8 +1041,8 @@ let U = class extends V {
|
|
|
1031
1041
|
static extend(e) {
|
|
1032
1042
|
Object.getOwnPropertyNames(e.prototype).forEach((t) => {
|
|
1033
1043
|
if (t === "_initialize") {
|
|
1034
|
-
let r = this.prototype[
|
|
1035
|
-
r || (r = [], this.prototype[
|
|
1044
|
+
let r = this.prototype[w];
|
|
1045
|
+
r || (r = [], this.prototype[w] = r), r.push(e.prototype._initialize);
|
|
1036
1046
|
} else t !== "constructor" && (this.prototype[t] = e.prototype[t]);
|
|
1037
1047
|
}), Object.getOwnPropertyNames(e).forEach((t) => {
|
|
1038
1048
|
t !== "prototype" && t !== "name" && t !== "length" && (this[t] = e[t]);
|
|
@@ -1045,8 +1055,8 @@ let U = class extends V {
|
|
|
1045
1055
|
() => t.onCommandExecuted((r) => {
|
|
1046
1056
|
const { id: i, type: o, params: s } = r;
|
|
1047
1057
|
if (r.id === u.id) {
|
|
1048
|
-
const
|
|
1049
|
-
this.fireEvent(this.Event.Redo,
|
|
1058
|
+
const a = { id: i, type: o, params: s };
|
|
1059
|
+
this.fireEvent(this.Event.Redo, a);
|
|
1050
1060
|
}
|
|
1051
1061
|
})
|
|
1052
1062
|
), this.registerEventHandler(
|
|
@@ -1054,17 +1064,17 @@ let U = class extends V {
|
|
|
1054
1064
|
() => t.onCommandExecuted((r) => {
|
|
1055
1065
|
const { id: i, type: o, params: s } = r;
|
|
1056
1066
|
if (r.id === h.id) {
|
|
1057
|
-
const
|
|
1058
|
-
this.fireEvent(this.Event.Undo,
|
|
1067
|
+
const a = { id: i, type: o, params: s };
|
|
1068
|
+
this.fireEvent(this.Event.Undo, a);
|
|
1059
1069
|
}
|
|
1060
1070
|
})
|
|
1061
1071
|
), this.registerEventHandler(
|
|
1062
1072
|
this.Event.CommandExecuted,
|
|
1063
|
-
() => t.onCommandExecuted((r) => {
|
|
1064
|
-
const { id:
|
|
1073
|
+
() => t.onCommandExecuted((r, i) => {
|
|
1074
|
+
const { id: o, type: s, params: c } = r;
|
|
1065
1075
|
if (r.id !== u.id && r.id !== h.id) {
|
|
1066
|
-
const
|
|
1067
|
-
this.fireEvent(this.Event.CommandExecuted,
|
|
1076
|
+
const _ = { id: o, type: s, params: c, options: i };
|
|
1077
|
+
this.fireEvent(this.Event.CommandExecuted, _);
|
|
1068
1078
|
}
|
|
1069
1079
|
})
|
|
1070
1080
|
);
|
|
@@ -1076,9 +1086,9 @@ let U = class extends V {
|
|
|
1076
1086
|
() => t.beforeCommandExecuted((r) => {
|
|
1077
1087
|
const { id: i, type: o, params: s } = r;
|
|
1078
1088
|
if (r.id === u.id) {
|
|
1079
|
-
const
|
|
1080
|
-
if (this.fireEvent(this.Event.BeforeRedo,
|
|
1081
|
-
throw new
|
|
1089
|
+
const a = { id: i, type: o, params: s };
|
|
1090
|
+
if (this.fireEvent(this.Event.BeforeRedo, a), a.cancel)
|
|
1091
|
+
throw new x();
|
|
1082
1092
|
}
|
|
1083
1093
|
})
|
|
1084
1094
|
), this.registerEventHandler(
|
|
@@ -1086,29 +1096,29 @@ let U = class extends V {
|
|
|
1086
1096
|
() => t.beforeCommandExecuted((r) => {
|
|
1087
1097
|
const { id: i, type: o, params: s } = r;
|
|
1088
1098
|
if (r.id === h.id) {
|
|
1089
|
-
const
|
|
1090
|
-
if (this.fireEvent(this.Event.BeforeUndo,
|
|
1091
|
-
throw new
|
|
1099
|
+
const a = { id: i, type: o, params: s };
|
|
1100
|
+
if (this.fireEvent(this.Event.BeforeUndo, a), a.cancel)
|
|
1101
|
+
throw new x();
|
|
1092
1102
|
}
|
|
1093
1103
|
})
|
|
1094
1104
|
), this.registerEventHandler(
|
|
1095
1105
|
this.Event.BeforeCommandExecute,
|
|
1096
|
-
() => t.beforeCommandExecuted((r) => {
|
|
1097
|
-
const { id:
|
|
1106
|
+
() => t.beforeCommandExecuted((r, i) => {
|
|
1107
|
+
const { id: o, type: s, params: c } = r;
|
|
1098
1108
|
if (r.id !== u.id && r.id !== h.id) {
|
|
1099
|
-
const
|
|
1100
|
-
if (this.fireEvent(this.Event.BeforeCommandExecute,
|
|
1101
|
-
throw new
|
|
1109
|
+
const _ = { id: o, type: s, params: c, options: i };
|
|
1110
|
+
if (this.fireEvent(this.Event.BeforeCommandExecute, _), _.cancel)
|
|
1111
|
+
throw new x();
|
|
1102
1112
|
}
|
|
1103
1113
|
})
|
|
1104
1114
|
);
|
|
1105
1115
|
}
|
|
1106
1116
|
_initUnitEvent(e) {
|
|
1107
|
-
const t = e.get(
|
|
1117
|
+
const t = e.get(N);
|
|
1108
1118
|
this.registerEventHandler(
|
|
1109
1119
|
this.Event.DocDisposed,
|
|
1110
1120
|
() => t.unitDisposed$.subscribe((r) => {
|
|
1111
|
-
r.type ===
|
|
1121
|
+
r.type === R.UNIVER_DOC && this.fireEvent(this.Event.DocDisposed, {
|
|
1112
1122
|
unitId: r.getUnitId(),
|
|
1113
1123
|
unitType: r.type,
|
|
1114
1124
|
snapshot: r.getSnapshot()
|
|
@@ -1117,8 +1127,8 @@ let U = class extends V {
|
|
|
1117
1127
|
), this.registerEventHandler(
|
|
1118
1128
|
this.Event.DocCreated,
|
|
1119
1129
|
() => t.unitAdded$.subscribe((r) => {
|
|
1120
|
-
if (r.type ===
|
|
1121
|
-
const i = r, o = e.createInstance(
|
|
1130
|
+
if (r.type === R.UNIVER_DOC) {
|
|
1131
|
+
const i = r, o = e.createInstance(B, i);
|
|
1122
1132
|
this.fireEvent(this.Event.DocCreated, {
|
|
1123
1133
|
unitId: r.getUnitId(),
|
|
1124
1134
|
type: r.type,
|
|
@@ -1158,7 +1168,7 @@ let U = class extends V {
|
|
|
1158
1168
|
* ```
|
|
1159
1169
|
*/
|
|
1160
1170
|
getCurrentLifecycleStage() {
|
|
1161
|
-
return this._injector.get(
|
|
1171
|
+
return this._injector.get($).stage;
|
|
1162
1172
|
}
|
|
1163
1173
|
/**
|
|
1164
1174
|
* Undo an editing on the currently focused document.
|
|
@@ -1248,10 +1258,10 @@ let U = class extends V {
|
|
|
1248
1258
|
* @returns {FHooks} FHooks instance
|
|
1249
1259
|
*/
|
|
1250
1260
|
getHooks() {
|
|
1251
|
-
return this._injector.createInstance(
|
|
1261
|
+
return this._injector.createInstance(j);
|
|
1252
1262
|
}
|
|
1253
1263
|
get Enum() {
|
|
1254
|
-
return
|
|
1264
|
+
return P.get();
|
|
1255
1265
|
}
|
|
1256
1266
|
get Event() {
|
|
1257
1267
|
return O.get();
|
|
@@ -1293,7 +1303,7 @@ let U = class extends V {
|
|
|
1293
1303
|
return this._eventRegistry.fireEvent(e, t);
|
|
1294
1304
|
}
|
|
1295
1305
|
getUserManager() {
|
|
1296
|
-
return this._injector.createInstance(
|
|
1306
|
+
return this._injector.createInstance(U);
|
|
1297
1307
|
}
|
|
1298
1308
|
/**
|
|
1299
1309
|
* Create a new blob.
|
|
@@ -1304,7 +1314,7 @@ let U = class extends V {
|
|
|
1304
1314
|
* ```
|
|
1305
1315
|
*/
|
|
1306
1316
|
newBlob() {
|
|
1307
|
-
return this._injector.createInstance(
|
|
1317
|
+
return this._injector.createInstance(C);
|
|
1308
1318
|
}
|
|
1309
1319
|
/**
|
|
1310
1320
|
* Create a new color.
|
|
@@ -1315,7 +1325,7 @@ let U = class extends V {
|
|
|
1315
1325
|
* ```
|
|
1316
1326
|
*/
|
|
1317
1327
|
newColor() {
|
|
1318
|
-
return new
|
|
1328
|
+
return new we();
|
|
1319
1329
|
}
|
|
1320
1330
|
/**
|
|
1321
1331
|
* Create a new rich text.
|
|
@@ -1329,7 +1339,7 @@ let U = class extends V {
|
|
|
1329
1339
|
* ```
|
|
1330
1340
|
*/
|
|
1331
1341
|
newRichText(e) {
|
|
1332
|
-
return
|
|
1342
|
+
return Re.create(e);
|
|
1333
1343
|
}
|
|
1334
1344
|
/**
|
|
1335
1345
|
* Create a new rich text value.
|
|
@@ -1343,7 +1353,7 @@ let U = class extends V {
|
|
|
1343
1353
|
* ```
|
|
1344
1354
|
*/
|
|
1345
1355
|
newRichTextValue(e) {
|
|
1346
|
-
return
|
|
1356
|
+
return Pe.create(e);
|
|
1347
1357
|
}
|
|
1348
1358
|
/**
|
|
1349
1359
|
* Create a new paragraph style.
|
|
@@ -1371,7 +1381,7 @@ let U = class extends V {
|
|
|
1371
1381
|
* ```
|
|
1372
1382
|
*/
|
|
1373
1383
|
newParagraphStyleValue(e) {
|
|
1374
|
-
return
|
|
1384
|
+
return je.create(e);
|
|
1375
1385
|
}
|
|
1376
1386
|
/**
|
|
1377
1387
|
* Create a new text style.
|
|
@@ -1383,7 +1393,7 @@ let U = class extends V {
|
|
|
1383
1393
|
* ```
|
|
1384
1394
|
*/
|
|
1385
1395
|
newTextStyle(e) {
|
|
1386
|
-
return
|
|
1396
|
+
return Be.create(e);
|
|
1387
1397
|
}
|
|
1388
1398
|
/**
|
|
1389
1399
|
* Create a new text style value.
|
|
@@ -1395,7 +1405,7 @@ let U = class extends V {
|
|
|
1395
1405
|
* ```
|
|
1396
1406
|
*/
|
|
1397
1407
|
newTextStyleValue(e) {
|
|
1398
|
-
return
|
|
1408
|
+
return Ue.create(e);
|
|
1399
1409
|
}
|
|
1400
1410
|
/**
|
|
1401
1411
|
* Create a new text decoration.
|
|
@@ -1410,19 +1420,19 @@ let U = class extends V {
|
|
|
1410
1420
|
return new He(e);
|
|
1411
1421
|
}
|
|
1412
1422
|
};
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
],
|
|
1423
|
+
V = Ke([
|
|
1424
|
+
S(0, p(m)),
|
|
1425
|
+
S(1, y),
|
|
1426
|
+
S(2, N),
|
|
1427
|
+
S(3, p($))
|
|
1428
|
+
], V);
|
|
1419
1429
|
export {
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1430
|
+
M as FBase,
|
|
1431
|
+
Ve as FBaseInitialable,
|
|
1432
|
+
C as FBlob,
|
|
1433
|
+
P as FEnum,
|
|
1424
1434
|
O as FEventName,
|
|
1425
|
-
|
|
1426
|
-
|
|
1435
|
+
j as FHooks,
|
|
1436
|
+
V as FUniver,
|
|
1427
1437
|
H as FUtil
|
|
1428
1438
|
};
|