@univerjs/core 0.6.6 → 0.6.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/facade.js +1 -1
- package/lib/cjs/index.js +2 -2
- package/lib/es/facade.js +170 -159
- package/lib/es/index.js +16 -13
- package/lib/types/docs/data-model/document-data-model.d.ts +2 -0
- package/lib/types/docs/data-model/text-x/build-utils/text-x-utils.d.ts +1 -1
- package/lib/types/facade/f-enum.d.ts +10 -1
- package/lib/types/sheets/worksheet.d.ts +5 -2
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +2 -2
- package/package.json +6 -6
package/lib/es/facade.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var
|
|
2
|
-
var L = (
|
|
3
|
-
var d = (
|
|
4
|
-
import { Disposable as V, Inject as l, Injector as _, UniverInstanceType as
|
|
1
|
+
var N = Object.defineProperty;
|
|
2
|
+
var L = (n, e, t) => e in n ? N(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
3
|
+
var d = (n, e, t) => L(n, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { Disposable as V, Inject as l, Injector as _, AbsoluteRefType as F, UniverInstanceType as w, LifecycleStages as f, DataValidationType as W, DataValidationErrorStyle as q, DataValidationRenderMode as G, DataValidationOperator as J, DataValidationStatus as K, CommandType as Q, BaselineOffset as X, BooleanNumber as Y, HorizontalAlign as Z, TextDecoration as k, TextDirection as ee, VerticalAlign as te, WrapStrategy as re, BorderType as ne, BorderStyleTypes as ie, AutoFillSeries as oe, ColorType as se, CommonHideTypes as ce, CopyPasteType as ae, DeleteDirection as de, DeveloperMetadataVisibility as pe, Dimension as le, Direction as he, InterpolationPointType as ue, LocaleType as ye, MentionType as ge, ProtectionType as ve, RelativeDate as fe, SheetTypes as _e, ThemeColorType as me, LifecycleService as I, toDisposable as p, ICommandService as y, UndoCommand as h, IUndoRedoService as m, RedoCommand as u, Registry as Ee, UserManagerService as be, Rectangle as Se, numfmt as Ce, Tools as De, IUniverInstanceService as A, Univer as xe, CanceledError as D, ColorBuilder as Te, RichTextBuilder as we, RichTextValue as Re, ParagraphStyleBuilder as Oe, ParagraphStyleValue as Pe, TextStyleBuilder as je, TextStyleValue as Be, TextDecorationBuilder as He } from "@univerjs/core";
|
|
5
5
|
import { filter as E } from "rxjs";
|
|
6
6
|
class $ extends V {
|
|
7
7
|
/**
|
|
@@ -16,12 +16,12 @@ class $ extends V {
|
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
const x = Symbol("initializers");
|
|
19
|
-
class
|
|
19
|
+
class Ue extends V {
|
|
20
20
|
constructor(e) {
|
|
21
21
|
super(), this._injector = e;
|
|
22
22
|
const t = this, r = Object.getPrototypeOf(this)[x];
|
|
23
|
-
r && r.forEach(function(
|
|
24
|
-
|
|
23
|
+
r && r.forEach(function(i) {
|
|
24
|
+
i.apply(t, [e]);
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
@@ -43,14 +43,14 @@ class He extends V {
|
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
var
|
|
47
|
-
for (var
|
|
48
|
-
(s =
|
|
49
|
-
return
|
|
50
|
-
},
|
|
46
|
+
var Ve = Object.getOwnPropertyDescriptor, Ie = (n, e, t, r) => {
|
|
47
|
+
for (var i = r > 1 ? void 0 : r ? Ve(e, t) : e, o = n.length - 1, s; o >= 0; o--)
|
|
48
|
+
(s = n[o]) && (i = s(i) || i);
|
|
49
|
+
return i;
|
|
50
|
+
}, $e = (n, e) => (t, r) => e(t, r, n);
|
|
51
51
|
let S = class extends $ {
|
|
52
|
-
constructor(
|
|
53
|
-
super(), this._blob =
|
|
52
|
+
constructor(n, e) {
|
|
53
|
+
super(), this._blob = n, this._injector = e;
|
|
54
54
|
}
|
|
55
55
|
/**
|
|
56
56
|
* Returns a copy of this blob.
|
|
@@ -76,15 +76,15 @@ let S = class extends $ {
|
|
|
76
76
|
* console.log(newBlob);
|
|
77
77
|
* ```
|
|
78
78
|
*/
|
|
79
|
-
getAs(
|
|
79
|
+
getAs(n) {
|
|
80
80
|
const e = this.copyBlob();
|
|
81
|
-
return e.setContentType(
|
|
81
|
+
return e.setContentType(n), e;
|
|
82
82
|
}
|
|
83
|
-
getDataAsString(
|
|
84
|
-
return this._blob === null ? Promise.resolve("") :
|
|
83
|
+
getDataAsString(n) {
|
|
84
|
+
return this._blob === null ? Promise.resolve("") : n === void 0 ? this._blob.text() : new Promise((e, t) => {
|
|
85
85
|
this._blob.arrayBuffer().then((r) => {
|
|
86
|
-
const
|
|
87
|
-
e(
|
|
86
|
+
const i = new TextDecoder(n).decode(r);
|
|
87
|
+
e(i);
|
|
88
88
|
}).catch((r) => {
|
|
89
89
|
t(new Error(`Failed to read Blob as ArrayBuffer: ${r.message}`));
|
|
90
90
|
});
|
|
@@ -101,7 +101,7 @@ let S = class extends $ {
|
|
|
101
101
|
* ```
|
|
102
102
|
*/
|
|
103
103
|
getBytes() {
|
|
104
|
-
return this._blob ? this._blob.arrayBuffer().then((
|
|
104
|
+
return this._blob ? this._blob.arrayBuffer().then((n) => new Uint8Array(n)) : Promise.reject(new Error("Blob is undefined or null."));
|
|
105
105
|
}
|
|
106
106
|
/**
|
|
107
107
|
* Sets the data stored in this blob.
|
|
@@ -114,11 +114,11 @@ let S = class extends $ {
|
|
|
114
114
|
* blob.setBytes(bytes);
|
|
115
115
|
* ```
|
|
116
116
|
*/
|
|
117
|
-
setBytes(
|
|
118
|
-
return this._blob = new Blob([
|
|
117
|
+
setBytes(n) {
|
|
118
|
+
return this._blob = new Blob([n]), this;
|
|
119
119
|
}
|
|
120
|
-
setDataFromString(
|
|
121
|
-
const t = e != null ? e : "text/plain", r = new Blob([
|
|
120
|
+
setDataFromString(n, e) {
|
|
121
|
+
const t = e != null ? e : "text/plain", r = new Blob([n], { type: t });
|
|
122
122
|
return this._blob = r, this;
|
|
123
123
|
}
|
|
124
124
|
/**
|
|
@@ -132,8 +132,8 @@ let S = class extends $ {
|
|
|
132
132
|
* ```
|
|
133
133
|
*/
|
|
134
134
|
getContentType() {
|
|
135
|
-
var
|
|
136
|
-
return (
|
|
135
|
+
var n;
|
|
136
|
+
return (n = this._blob) == null ? void 0 : n.type;
|
|
137
137
|
}
|
|
138
138
|
/**
|
|
139
139
|
* Sets the content type of the data stored in this blob.
|
|
@@ -145,13 +145,13 @@ let S = class extends $ {
|
|
|
145
145
|
* blob.setContentType('text/plain');
|
|
146
146
|
* ```
|
|
147
147
|
*/
|
|
148
|
-
setContentType(
|
|
148
|
+
setContentType(n) {
|
|
149
149
|
var e;
|
|
150
|
-
return this._blob = (e = this._blob) == null ? void 0 : e.slice(0, this._blob.size,
|
|
150
|
+
return this._blob = (e = this._blob) == null ? void 0 : e.slice(0, this._blob.size, n), this;
|
|
151
151
|
}
|
|
152
152
|
};
|
|
153
|
-
S =
|
|
154
|
-
|
|
153
|
+
S = Ie([
|
|
154
|
+
$e(1, l(_))
|
|
155
155
|
], S);
|
|
156
156
|
const g = class g {
|
|
157
157
|
static get() {
|
|
@@ -174,6 +174,17 @@ const g = class g {
|
|
|
174
174
|
for (const e in g.prototype)
|
|
175
175
|
this[e] = g.prototype[e];
|
|
176
176
|
}
|
|
177
|
+
/**
|
|
178
|
+
* Defines different types of absolute references
|
|
179
|
+
*
|
|
180
|
+
* @example
|
|
181
|
+
* ```ts
|
|
182
|
+
* console.log(univerAPI.Enum.AbsoluteRefType);
|
|
183
|
+
* ```
|
|
184
|
+
*/
|
|
185
|
+
get AbsoluteRefType() {
|
|
186
|
+
return F;
|
|
187
|
+
}
|
|
177
188
|
/**
|
|
178
189
|
* Defines different types of Univer instances
|
|
179
190
|
*
|
|
@@ -183,7 +194,7 @@ const g = class g {
|
|
|
183
194
|
* ```
|
|
184
195
|
*/
|
|
185
196
|
get UniverInstanceType() {
|
|
186
|
-
return
|
|
197
|
+
return w;
|
|
187
198
|
}
|
|
188
199
|
/**
|
|
189
200
|
* Represents different stages in the lifecycle
|
|
@@ -205,7 +216,7 @@ const g = class g {
|
|
|
205
216
|
* ```
|
|
206
217
|
*/
|
|
207
218
|
get DataValidationType() {
|
|
208
|
-
return
|
|
219
|
+
return W;
|
|
209
220
|
}
|
|
210
221
|
/**
|
|
211
222
|
* Different error display styles
|
|
@@ -216,7 +227,7 @@ const g = class g {
|
|
|
216
227
|
* ```
|
|
217
228
|
*/
|
|
218
229
|
get DataValidationErrorStyle() {
|
|
219
|
-
return
|
|
230
|
+
return q;
|
|
220
231
|
}
|
|
221
232
|
/**
|
|
222
233
|
* Different validation rendering modes
|
|
@@ -227,7 +238,7 @@ const g = class g {
|
|
|
227
238
|
* ```
|
|
228
239
|
*/
|
|
229
240
|
get DataValidationRenderMode() {
|
|
230
|
-
return
|
|
241
|
+
return G;
|
|
231
242
|
}
|
|
232
243
|
/**
|
|
233
244
|
* Different validation operators
|
|
@@ -238,7 +249,7 @@ const g = class g {
|
|
|
238
249
|
* ```
|
|
239
250
|
*/
|
|
240
251
|
get DataValidationOperator() {
|
|
241
|
-
return
|
|
252
|
+
return J;
|
|
242
253
|
}
|
|
243
254
|
/**
|
|
244
255
|
* Different validation states
|
|
@@ -249,7 +260,7 @@ const g = class g {
|
|
|
249
260
|
* ```
|
|
250
261
|
*/
|
|
251
262
|
get DataValidationStatus() {
|
|
252
|
-
return
|
|
263
|
+
return K;
|
|
253
264
|
}
|
|
254
265
|
/**
|
|
255
266
|
* Different types of commands
|
|
@@ -260,7 +271,7 @@ const g = class g {
|
|
|
260
271
|
* ```
|
|
261
272
|
*/
|
|
262
273
|
get CommandType() {
|
|
263
|
-
return
|
|
274
|
+
return Q;
|
|
264
275
|
}
|
|
265
276
|
/**
|
|
266
277
|
* Different baseline offsets for text baseline positioning
|
|
@@ -271,7 +282,7 @@ const g = class g {
|
|
|
271
282
|
* ```
|
|
272
283
|
*/
|
|
273
284
|
get BaselineOffset() {
|
|
274
|
-
return
|
|
285
|
+
return X;
|
|
275
286
|
}
|
|
276
287
|
/**
|
|
277
288
|
* Boolean number representations
|
|
@@ -282,7 +293,7 @@ const g = class g {
|
|
|
282
293
|
* ```
|
|
283
294
|
*/
|
|
284
295
|
get BooleanNumber() {
|
|
285
|
-
return
|
|
296
|
+
return Y;
|
|
286
297
|
}
|
|
287
298
|
/**
|
|
288
299
|
* Different horizontal text alignment options
|
|
@@ -293,7 +304,7 @@ const g = class g {
|
|
|
293
304
|
* ```
|
|
294
305
|
*/
|
|
295
306
|
get HorizontalAlign() {
|
|
296
|
-
return
|
|
307
|
+
return Z;
|
|
297
308
|
}
|
|
298
309
|
/**
|
|
299
310
|
* Different text decoration styles
|
|
@@ -304,7 +315,7 @@ const g = class g {
|
|
|
304
315
|
* ```
|
|
305
316
|
*/
|
|
306
317
|
get TextDecoration() {
|
|
307
|
-
return
|
|
318
|
+
return k;
|
|
308
319
|
}
|
|
309
320
|
/**
|
|
310
321
|
* Different text direction options
|
|
@@ -315,7 +326,7 @@ const g = class g {
|
|
|
315
326
|
* ```
|
|
316
327
|
*/
|
|
317
328
|
get TextDirection() {
|
|
318
|
-
return
|
|
329
|
+
return ee;
|
|
319
330
|
}
|
|
320
331
|
/**
|
|
321
332
|
* Different vertical text alignment options
|
|
@@ -326,7 +337,7 @@ const g = class g {
|
|
|
326
337
|
* ```
|
|
327
338
|
*/
|
|
328
339
|
get VerticalAlign() {
|
|
329
|
-
return
|
|
340
|
+
return te;
|
|
330
341
|
}
|
|
331
342
|
/**
|
|
332
343
|
* Different wrap strategy options
|
|
@@ -337,7 +348,7 @@ const g = class g {
|
|
|
337
348
|
* ```
|
|
338
349
|
*/
|
|
339
350
|
get WrapStrategy() {
|
|
340
|
-
return
|
|
351
|
+
return re;
|
|
341
352
|
}
|
|
342
353
|
/**
|
|
343
354
|
* Different border types
|
|
@@ -348,7 +359,7 @@ const g = class g {
|
|
|
348
359
|
* ```
|
|
349
360
|
*/
|
|
350
361
|
get BorderType() {
|
|
351
|
-
return
|
|
362
|
+
return ne;
|
|
352
363
|
}
|
|
353
364
|
/**
|
|
354
365
|
* Different border style types
|
|
@@ -370,7 +381,7 @@ const g = class g {
|
|
|
370
381
|
* ```
|
|
371
382
|
*/
|
|
372
383
|
get AutoFillSeries() {
|
|
373
|
-
return
|
|
384
|
+
return oe;
|
|
374
385
|
}
|
|
375
386
|
/**
|
|
376
387
|
* Color types
|
|
@@ -381,7 +392,7 @@ const g = class g {
|
|
|
381
392
|
* ```
|
|
382
393
|
*/
|
|
383
394
|
get ColorType() {
|
|
384
|
-
return
|
|
395
|
+
return se;
|
|
385
396
|
}
|
|
386
397
|
/**
|
|
387
398
|
* Common hide types
|
|
@@ -392,7 +403,7 @@ const g = class g {
|
|
|
392
403
|
* ```
|
|
393
404
|
*/
|
|
394
405
|
get CommonHideTypes() {
|
|
395
|
-
return
|
|
406
|
+
return ce;
|
|
396
407
|
}
|
|
397
408
|
/**
|
|
398
409
|
* Copy paste types
|
|
@@ -403,7 +414,7 @@ const g = class g {
|
|
|
403
414
|
* ```
|
|
404
415
|
*/
|
|
405
416
|
get CopyPasteType() {
|
|
406
|
-
return
|
|
417
|
+
return ae;
|
|
407
418
|
}
|
|
408
419
|
/**
|
|
409
420
|
* Delete direction types
|
|
@@ -414,7 +425,7 @@ const g = class g {
|
|
|
414
425
|
* ```
|
|
415
426
|
*/
|
|
416
427
|
get DeleteDirection() {
|
|
417
|
-
return
|
|
428
|
+
return de;
|
|
418
429
|
}
|
|
419
430
|
/**
|
|
420
431
|
* Developer metadata visibility types
|
|
@@ -425,7 +436,7 @@ const g = class g {
|
|
|
425
436
|
* ```
|
|
426
437
|
*/
|
|
427
438
|
get DeveloperMetadataVisibility() {
|
|
428
|
-
return
|
|
439
|
+
return pe;
|
|
429
440
|
}
|
|
430
441
|
/**
|
|
431
442
|
* Dimension types
|
|
@@ -436,7 +447,7 @@ const g = class g {
|
|
|
436
447
|
* ```
|
|
437
448
|
*/
|
|
438
449
|
get Dimension() {
|
|
439
|
-
return
|
|
450
|
+
return le;
|
|
440
451
|
}
|
|
441
452
|
/**
|
|
442
453
|
* Direction types
|
|
@@ -447,7 +458,7 @@ const g = class g {
|
|
|
447
458
|
* ```
|
|
448
459
|
*/
|
|
449
460
|
get Direction() {
|
|
450
|
-
return
|
|
461
|
+
return he;
|
|
451
462
|
}
|
|
452
463
|
/**
|
|
453
464
|
* Interpolation point types
|
|
@@ -458,7 +469,7 @@ const g = class g {
|
|
|
458
469
|
* ```
|
|
459
470
|
*/
|
|
460
471
|
get InterpolationPointType() {
|
|
461
|
-
return
|
|
472
|
+
return ue;
|
|
462
473
|
}
|
|
463
474
|
/**
|
|
464
475
|
* Locale types
|
|
@@ -469,7 +480,7 @@ const g = class g {
|
|
|
469
480
|
* ```
|
|
470
481
|
*/
|
|
471
482
|
get LocaleType() {
|
|
472
|
-
return
|
|
483
|
+
return ye;
|
|
473
484
|
}
|
|
474
485
|
/**
|
|
475
486
|
* Mention types
|
|
@@ -480,7 +491,7 @@ const g = class g {
|
|
|
480
491
|
* ```
|
|
481
492
|
*/
|
|
482
493
|
get MentionType() {
|
|
483
|
-
return
|
|
494
|
+
return ge;
|
|
484
495
|
}
|
|
485
496
|
/**
|
|
486
497
|
* Protection types
|
|
@@ -491,7 +502,7 @@ const g = class g {
|
|
|
491
502
|
* ```
|
|
492
503
|
*/
|
|
493
504
|
get ProtectionType() {
|
|
494
|
-
return
|
|
505
|
+
return ve;
|
|
495
506
|
}
|
|
496
507
|
/**
|
|
497
508
|
* Relative date types
|
|
@@ -502,7 +513,7 @@ const g = class g {
|
|
|
502
513
|
* ```
|
|
503
514
|
*/
|
|
504
515
|
get RelativeDate() {
|
|
505
|
-
return
|
|
516
|
+
return fe;
|
|
506
517
|
}
|
|
507
518
|
/**
|
|
508
519
|
* Sheet types
|
|
@@ -513,7 +524,7 @@ const g = class g {
|
|
|
513
524
|
* ```
|
|
514
525
|
*/
|
|
515
526
|
get SheetTypes() {
|
|
516
|
-
return
|
|
527
|
+
return _e;
|
|
517
528
|
}
|
|
518
529
|
/**
|
|
519
530
|
* Theme color types
|
|
@@ -524,7 +535,7 @@ const g = class g {
|
|
|
524
535
|
* ```
|
|
525
536
|
*/
|
|
526
537
|
get ThemeColorType() {
|
|
527
|
-
return
|
|
538
|
+
return me;
|
|
528
539
|
}
|
|
529
540
|
};
|
|
530
541
|
/**
|
|
@@ -712,52 +723,52 @@ const v = class v {
|
|
|
712
723
|
*/
|
|
713
724
|
d(v, "_instance");
|
|
714
725
|
let O = v;
|
|
715
|
-
var
|
|
716
|
-
for (var
|
|
717
|
-
(s =
|
|
718
|
-
return
|
|
719
|
-
}, M = (
|
|
726
|
+
var Me = Object.getOwnPropertyDescriptor, ze = (n, e, t, r) => {
|
|
727
|
+
for (var i = r > 1 ? void 0 : r ? Me(e, t) : e, o = n.length - 1, s; o >= 0; o--)
|
|
728
|
+
(s = n[o]) && (i = s(i) || i);
|
|
729
|
+
return i;
|
|
730
|
+
}, M = (n, e) => (t, r) => e(t, r, n);
|
|
720
731
|
let P = class extends $ {
|
|
721
|
-
constructor(
|
|
722
|
-
super(), this._injector =
|
|
732
|
+
constructor(n, e) {
|
|
733
|
+
super(), this._injector = n, this._lifecycleService = e;
|
|
723
734
|
}
|
|
724
735
|
/**
|
|
725
736
|
* @param callback
|
|
726
737
|
* @deprecated use `univerAPI.addEvent(univerAPI.Event.LifeCycleChanged, ({ stage }) => {})` as instead
|
|
727
738
|
*/
|
|
728
|
-
onStarting(
|
|
729
|
-
return p(this._lifecycleService.lifecycle$.pipe(E((e) => e === f.Starting)).subscribe(
|
|
739
|
+
onStarting(n) {
|
|
740
|
+
return p(this._lifecycleService.lifecycle$.pipe(E((e) => e === f.Starting)).subscribe(n));
|
|
730
741
|
}
|
|
731
742
|
/**
|
|
732
743
|
* @param callback
|
|
733
744
|
* @deprecated use `univerAPI.addEvent(univerAPI.Event.LifeCycleChanged, ({ stage }) => {})` as instead
|
|
734
745
|
*/
|
|
735
|
-
onReady(
|
|
736
|
-
return p(this._lifecycleService.lifecycle$.pipe(E((e) => e === f.Ready)).subscribe(
|
|
746
|
+
onReady(n) {
|
|
747
|
+
return p(this._lifecycleService.lifecycle$.pipe(E((e) => e === f.Ready)).subscribe(n));
|
|
737
748
|
}
|
|
738
749
|
/**
|
|
739
750
|
* @param callback
|
|
740
751
|
* @deprecated use `univerAPI.addEvent(univerAPI.Event.LifeCycleChanged, ({ stage }) => {})` as instead
|
|
741
752
|
*/
|
|
742
|
-
onRendered(
|
|
743
|
-
return p(this._lifecycleService.lifecycle$.pipe(E((e) => e === f.Rendered)).subscribe(
|
|
753
|
+
onRendered(n) {
|
|
754
|
+
return p(this._lifecycleService.lifecycle$.pipe(E((e) => e === f.Rendered)).subscribe(n));
|
|
744
755
|
}
|
|
745
756
|
/**
|
|
746
757
|
* @param callback
|
|
747
758
|
* @deprecated use `univerAPI.addEvent(univerAPI.Event.LifeCycleChanged, ({ stage }) => {})` as instead
|
|
748
759
|
*/
|
|
749
|
-
onSteady(
|
|
750
|
-
return p(this._lifecycleService.lifecycle$.pipe(E((e) => e === f.Steady)).subscribe(
|
|
760
|
+
onSteady(n) {
|
|
761
|
+
return p(this._lifecycleService.lifecycle$.pipe(E((e) => e === f.Steady)).subscribe(n));
|
|
751
762
|
}
|
|
752
763
|
/**
|
|
753
764
|
* @param callback
|
|
754
765
|
* @deprecated use `univerAPI.addEvent(univerAPI.Event.BeforeUndo, (event) => {})` as instead
|
|
755
766
|
*/
|
|
756
|
-
onBeforeUndo(
|
|
767
|
+
onBeforeUndo(n) {
|
|
757
768
|
return this._injector.get(y).beforeCommandExecuted((t) => {
|
|
758
769
|
if (t.id === h.id) {
|
|
759
|
-
const
|
|
760
|
-
|
|
770
|
+
const i = this._injector.get(m).pitchTopUndoElement();
|
|
771
|
+
i && n(i);
|
|
761
772
|
}
|
|
762
773
|
});
|
|
763
774
|
}
|
|
@@ -765,11 +776,11 @@ let P = class extends $ {
|
|
|
765
776
|
* @param callback
|
|
766
777
|
* @deprecated use `univerAPI.addEvent(univerAPI.Event.Undo, (event) => {})` as instead
|
|
767
778
|
*/
|
|
768
|
-
onUndo(
|
|
779
|
+
onUndo(n) {
|
|
769
780
|
return this._injector.get(y).onCommandExecuted((t) => {
|
|
770
781
|
if (t.id === h.id) {
|
|
771
|
-
const
|
|
772
|
-
|
|
782
|
+
const i = this._injector.get(m).pitchTopUndoElement();
|
|
783
|
+
i && n(i);
|
|
773
784
|
}
|
|
774
785
|
});
|
|
775
786
|
}
|
|
@@ -777,11 +788,11 @@ let P = class extends $ {
|
|
|
777
788
|
* @param callback
|
|
778
789
|
* @deprecated use `univerAPI.addEvent(univerAPI.Event.BeforeRedo, (event) => {})` as instead
|
|
779
790
|
*/
|
|
780
|
-
onBeforeRedo(
|
|
791
|
+
onBeforeRedo(n) {
|
|
781
792
|
return this._injector.get(y).beforeCommandExecuted((t) => {
|
|
782
793
|
if (t.id === u.id) {
|
|
783
|
-
const
|
|
784
|
-
|
|
794
|
+
const i = this._injector.get(m).pitchTopRedoElement();
|
|
795
|
+
i && n(i);
|
|
785
796
|
}
|
|
786
797
|
});
|
|
787
798
|
}
|
|
@@ -789,60 +800,60 @@ let P = class extends $ {
|
|
|
789
800
|
* @param callback
|
|
790
801
|
* @deprecated use `univerAPI.addEvent(univerAPI.Event.Redo, (event) => {})` as instead
|
|
791
802
|
*/
|
|
792
|
-
onRedo(
|
|
803
|
+
onRedo(n) {
|
|
793
804
|
return this._injector.get(y).onCommandExecuted((t) => {
|
|
794
805
|
if (t.id === u.id) {
|
|
795
|
-
const
|
|
796
|
-
|
|
806
|
+
const i = this._injector.get(m).pitchTopRedoElement();
|
|
807
|
+
i && n(i);
|
|
797
808
|
}
|
|
798
809
|
});
|
|
799
810
|
}
|
|
800
811
|
};
|
|
801
|
-
P =
|
|
812
|
+
P = ze([
|
|
802
813
|
M(0, l(_)),
|
|
803
814
|
M(1, l(I))
|
|
804
815
|
], P);
|
|
805
|
-
var
|
|
806
|
-
for (var
|
|
807
|
-
(s =
|
|
808
|
-
return
|
|
809
|
-
},
|
|
810
|
-
let j = class extends
|
|
811
|
-
constructor(
|
|
812
|
-
super(e), this.doc =
|
|
816
|
+
var Ae = Object.getOwnPropertyDescriptor, Ne = (n, e, t, r) => {
|
|
817
|
+
for (var i = r > 1 ? void 0 : r ? Ae(e, t) : e, o = n.length - 1, s; o >= 0; o--)
|
|
818
|
+
(s = n[o]) && (i = s(i) || i);
|
|
819
|
+
return i;
|
|
820
|
+
}, Le = (n, e) => (t, r) => e(t, r, n);
|
|
821
|
+
let j = class extends Ue {
|
|
822
|
+
constructor(n, e) {
|
|
823
|
+
super(e), this.doc = n;
|
|
813
824
|
}
|
|
814
825
|
};
|
|
815
826
|
j = Ne([
|
|
816
|
-
|
|
827
|
+
Le(1, l(_))
|
|
817
828
|
], j);
|
|
818
|
-
class
|
|
829
|
+
class Fe {
|
|
819
830
|
constructor() {
|
|
820
831
|
d(this, "_eventRegistry", /* @__PURE__ */ new Map());
|
|
821
832
|
d(this, "_eventHandlerMap", /* @__PURE__ */ new Map());
|
|
822
833
|
d(this, "_eventHandlerRegisted", /* @__PURE__ */ new Map());
|
|
823
834
|
}
|
|
824
835
|
_ensureEventRegistry(e) {
|
|
825
|
-
return this._eventRegistry.has(e) || this._eventRegistry.set(e, new
|
|
836
|
+
return this._eventRegistry.has(e) || this._eventRegistry.set(e, new Ee()), this._eventRegistry.get(e);
|
|
826
837
|
}
|
|
827
838
|
registerEventHandler(e, t) {
|
|
828
839
|
const r = this._eventHandlerMap.get(e);
|
|
829
840
|
return r ? r.add(t) : this._eventHandlerMap.set(e, /* @__PURE__ */ new Set([t])), this._ensureEventRegistry(e).getData().length && this._initEventHandler(e), p(() => {
|
|
830
|
-
var
|
|
831
|
-
(
|
|
841
|
+
var i, o, s, a;
|
|
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(), (a = this._eventHandlerRegisted.get(e)) == null || a.delete(t);
|
|
832
843
|
});
|
|
833
844
|
}
|
|
834
845
|
removeEvent(e, t) {
|
|
835
846
|
const r = this._ensureEventRegistry(e);
|
|
836
847
|
if (r.delete(t), r.getData().length === 0) {
|
|
837
|
-
const
|
|
838
|
-
|
|
848
|
+
const i = this._eventHandlerRegisted.get(e);
|
|
849
|
+
i == null || i.forEach((o) => o.dispose()), this._eventHandlerRegisted.delete(e);
|
|
839
850
|
}
|
|
840
851
|
}
|
|
841
852
|
_initEventHandler(e) {
|
|
842
853
|
let t = this._eventHandlerRegisted.get(e);
|
|
843
854
|
const r = this._eventHandlerMap.get(e);
|
|
844
|
-
r && (t || (t = /* @__PURE__ */ new Map(), this._eventHandlerRegisted.set(e, t), r == null || r.forEach((
|
|
845
|
-
t == null || t.set(
|
|
855
|
+
r && (t || (t = /* @__PURE__ */ new Map(), this._eventHandlerRegisted.set(e, t), r == null || r.forEach((i) => {
|
|
856
|
+
t == null || t.set(i, p(i()));
|
|
846
857
|
})));
|
|
847
858
|
}
|
|
848
859
|
/**
|
|
@@ -873,19 +884,19 @@ class Le {
|
|
|
873
884
|
*/
|
|
874
885
|
fireEvent(e, t) {
|
|
875
886
|
var r;
|
|
876
|
-
return (r = this._eventRegistry.get(e)) == null || r.getData().forEach((
|
|
877
|
-
|
|
887
|
+
return (r = this._eventRegistry.get(e)) == null || r.getData().forEach((i) => {
|
|
888
|
+
i(t);
|
|
878
889
|
}), t.cancel;
|
|
879
890
|
}
|
|
880
891
|
}
|
|
881
|
-
var
|
|
882
|
-
for (var
|
|
883
|
-
(s =
|
|
884
|
-
return
|
|
885
|
-
}, z = (
|
|
892
|
+
var We = Object.getOwnPropertyDescriptor, qe = (n, e, t, r) => {
|
|
893
|
+
for (var i = r > 1 ? void 0 : r ? We(e, t) : e, o = n.length - 1, s; o >= 0; o--)
|
|
894
|
+
(s = n[o]) && (i = s(i) || i);
|
|
895
|
+
return i;
|
|
896
|
+
}, z = (n, e) => (t, r) => e(t, r, n);
|
|
886
897
|
let B = class extends $ {
|
|
887
|
-
constructor(
|
|
888
|
-
super(), this._injector =
|
|
898
|
+
constructor(n, e) {
|
|
899
|
+
super(), this._injector = n, this._userManagerService = e;
|
|
889
900
|
}
|
|
890
901
|
/**
|
|
891
902
|
* Get current user info.
|
|
@@ -899,9 +910,9 @@ let B = class extends $ {
|
|
|
899
910
|
return this._userManagerService.getCurrentUser();
|
|
900
911
|
}
|
|
901
912
|
};
|
|
902
|
-
B =
|
|
913
|
+
B = qe([
|
|
903
914
|
z(0, l(_)),
|
|
904
|
-
z(1, l(
|
|
915
|
+
z(1, l(be))
|
|
905
916
|
], B);
|
|
906
917
|
const C = class C {
|
|
907
918
|
static get() {
|
|
@@ -934,7 +945,7 @@ const C = class C {
|
|
|
934
945
|
* ```
|
|
935
946
|
*/
|
|
936
947
|
get rectangle() {
|
|
937
|
-
return
|
|
948
|
+
return Se;
|
|
938
949
|
}
|
|
939
950
|
/**
|
|
940
951
|
* Number format utils, including parse and strigify about date, price, etc
|
|
@@ -946,7 +957,7 @@ const C = class C {
|
|
|
946
957
|
* ```
|
|
947
958
|
*/
|
|
948
959
|
get numfmt() {
|
|
949
|
-
return
|
|
960
|
+
return Ce;
|
|
950
961
|
}
|
|
951
962
|
/**
|
|
952
963
|
* common tools
|
|
@@ -958,7 +969,7 @@ const C = class C {
|
|
|
958
969
|
* ```
|
|
959
970
|
*/
|
|
960
971
|
get tools() {
|
|
961
|
-
return
|
|
972
|
+
return De;
|
|
962
973
|
}
|
|
963
974
|
};
|
|
964
975
|
/**
|
|
@@ -966,18 +977,18 @@ const C = class C {
|
|
|
966
977
|
*/
|
|
967
978
|
d(C, "_instance");
|
|
968
979
|
let H = C;
|
|
969
|
-
var
|
|
970
|
-
for (var
|
|
971
|
-
(s =
|
|
972
|
-
return
|
|
973
|
-
}, b = (
|
|
974
|
-
const
|
|
980
|
+
var Ge = Object.getOwnPropertyDescriptor, Je = (n, e, t, r) => {
|
|
981
|
+
for (var i = r > 1 ? void 0 : r ? Ge(e, t) : e, o = n.length - 1, s; o >= 0; o--)
|
|
982
|
+
(s = n[o]) && (i = s(i) || i);
|
|
983
|
+
return i;
|
|
984
|
+
}, b = (n, e) => (t, r) => e(t, r, n);
|
|
985
|
+
const T = Symbol("initializers");
|
|
975
986
|
let U = class extends V {
|
|
976
|
-
constructor(e, t, r,
|
|
987
|
+
constructor(e, t, r, i) {
|
|
977
988
|
super();
|
|
978
|
-
d(this, "_eventRegistry", new
|
|
989
|
+
d(this, "_eventRegistry", new Fe());
|
|
979
990
|
d(this, "registerEventHandler", (e, t) => this._eventRegistry.registerEventHandler(e, t));
|
|
980
|
-
this._injector = e, this._commandService = t, this._univerInstanceService = r, this._lifecycleService =
|
|
991
|
+
this._injector = e, this._commandService = t, this._univerInstanceService = r, this._lifecycleService = i, this.registerEventHandler(
|
|
981
992
|
this.Event.LifeCycleChanged,
|
|
982
993
|
() => p(
|
|
983
994
|
this._lifecycleService.lifecycle$.subscribe((s) => {
|
|
@@ -987,7 +998,7 @@ let U = class extends V {
|
|
|
987
998
|
), this._initUnitEvent(this._injector), this._initBeforeCommandEvent(this._injector), this._initCommandEvent(this._injector), this._injector.onDispose(() => {
|
|
988
999
|
this.dispose();
|
|
989
1000
|
});
|
|
990
|
-
const o = Object.getPrototypeOf(this)[
|
|
1001
|
+
const o = Object.getPrototypeOf(this)[T];
|
|
991
1002
|
if (o) {
|
|
992
1003
|
const s = this;
|
|
993
1004
|
o.forEach(function(a) {
|
|
@@ -1007,7 +1018,7 @@ let U = class extends V {
|
|
|
1007
1018
|
* ```
|
|
1008
1019
|
*/
|
|
1009
1020
|
static newAPI(e) {
|
|
1010
|
-
return (e instanceof
|
|
1021
|
+
return (e instanceof xe ? e.__getInjector() : e).createInstance(U);
|
|
1011
1022
|
}
|
|
1012
1023
|
/**
|
|
1013
1024
|
* @ignore
|
|
@@ -1020,8 +1031,8 @@ let U = class extends V {
|
|
|
1020
1031
|
static extend(e) {
|
|
1021
1032
|
Object.getOwnPropertyNames(e.prototype).forEach((t) => {
|
|
1022
1033
|
if (t === "_initialize") {
|
|
1023
|
-
let r = this.prototype[
|
|
1024
|
-
r || (r = [], this.prototype[
|
|
1034
|
+
let r = this.prototype[T];
|
|
1035
|
+
r || (r = [], this.prototype[T] = r), r.push(e.prototype._initialize);
|
|
1025
1036
|
} else t !== "constructor" && (this.prototype[t] = e.prototype[t]);
|
|
1026
1037
|
}), Object.getOwnPropertyNames(e).forEach((t) => {
|
|
1027
1038
|
t !== "prototype" && t !== "name" && t !== "length" && (this[t] = e[t]);
|
|
@@ -1032,27 +1043,27 @@ let U = class extends V {
|
|
|
1032
1043
|
this.registerEventHandler(
|
|
1033
1044
|
this.Event.Redo,
|
|
1034
1045
|
() => t.onCommandExecuted((r) => {
|
|
1035
|
-
const { id:
|
|
1046
|
+
const { id: i, type: o, params: s } = r;
|
|
1036
1047
|
if (r.id === u.id) {
|
|
1037
|
-
const c = { id:
|
|
1048
|
+
const c = { id: i, type: o, params: s };
|
|
1038
1049
|
this.fireEvent(this.Event.Redo, c);
|
|
1039
1050
|
}
|
|
1040
1051
|
})
|
|
1041
1052
|
), this.registerEventHandler(
|
|
1042
1053
|
this.Event.Undo,
|
|
1043
1054
|
() => t.onCommandExecuted((r) => {
|
|
1044
|
-
const { id:
|
|
1055
|
+
const { id: i, type: o, params: s } = r;
|
|
1045
1056
|
if (r.id === h.id) {
|
|
1046
|
-
const c = { id:
|
|
1057
|
+
const c = { id: i, type: o, params: s };
|
|
1047
1058
|
this.fireEvent(this.Event.Undo, c);
|
|
1048
1059
|
}
|
|
1049
1060
|
})
|
|
1050
1061
|
), this.registerEventHandler(
|
|
1051
1062
|
this.Event.CommandExecuted,
|
|
1052
1063
|
() => t.onCommandExecuted((r) => {
|
|
1053
|
-
const { id:
|
|
1064
|
+
const { id: i, type: o, params: s } = r;
|
|
1054
1065
|
if (r.id !== u.id && r.id !== h.id) {
|
|
1055
|
-
const c = { id:
|
|
1066
|
+
const c = { id: i, type: o, params: s };
|
|
1056
1067
|
this.fireEvent(this.Event.CommandExecuted, c);
|
|
1057
1068
|
}
|
|
1058
1069
|
})
|
|
@@ -1063,9 +1074,9 @@ let U = class extends V {
|
|
|
1063
1074
|
this.registerEventHandler(
|
|
1064
1075
|
this.Event.BeforeRedo,
|
|
1065
1076
|
() => t.beforeCommandExecuted((r) => {
|
|
1066
|
-
const { id:
|
|
1077
|
+
const { id: i, type: o, params: s } = r;
|
|
1067
1078
|
if (r.id === u.id) {
|
|
1068
|
-
const c = { id:
|
|
1079
|
+
const c = { id: i, type: o, params: s };
|
|
1069
1080
|
if (this.fireEvent(this.Event.BeforeRedo, c), c.cancel)
|
|
1070
1081
|
throw new D();
|
|
1071
1082
|
}
|
|
@@ -1073,9 +1084,9 @@ let U = class extends V {
|
|
|
1073
1084
|
), this.registerEventHandler(
|
|
1074
1085
|
this.Event.BeforeUndo,
|
|
1075
1086
|
() => t.beforeCommandExecuted((r) => {
|
|
1076
|
-
const { id:
|
|
1087
|
+
const { id: i, type: o, params: s } = r;
|
|
1077
1088
|
if (r.id === h.id) {
|
|
1078
|
-
const c = { id:
|
|
1089
|
+
const c = { id: i, type: o, params: s };
|
|
1079
1090
|
if (this.fireEvent(this.Event.BeforeUndo, c), c.cancel)
|
|
1080
1091
|
throw new D();
|
|
1081
1092
|
}
|
|
@@ -1083,9 +1094,9 @@ let U = class extends V {
|
|
|
1083
1094
|
), this.registerEventHandler(
|
|
1084
1095
|
this.Event.BeforeCommandExecute,
|
|
1085
1096
|
() => t.beforeCommandExecuted((r) => {
|
|
1086
|
-
const { id:
|
|
1097
|
+
const { id: i, type: o, params: s } = r;
|
|
1087
1098
|
if (r.id !== u.id && r.id !== h.id) {
|
|
1088
|
-
const c = { id:
|
|
1099
|
+
const c = { id: i, type: o, params: s };
|
|
1089
1100
|
if (this.fireEvent(this.Event.BeforeCommandExecute, c), c.cancel)
|
|
1090
1101
|
throw new D();
|
|
1091
1102
|
}
|
|
@@ -1093,11 +1104,11 @@ let U = class extends V {
|
|
|
1093
1104
|
);
|
|
1094
1105
|
}
|
|
1095
1106
|
_initUnitEvent(e) {
|
|
1096
|
-
const t = e.get(
|
|
1107
|
+
const t = e.get(A);
|
|
1097
1108
|
this.registerEventHandler(
|
|
1098
1109
|
this.Event.DocDisposed,
|
|
1099
1110
|
() => t.unitDisposed$.subscribe((r) => {
|
|
1100
|
-
r.type ===
|
|
1111
|
+
r.type === w.UNIVER_DOC && this.fireEvent(this.Event.DocDisposed, {
|
|
1101
1112
|
unitId: r.getUnitId(),
|
|
1102
1113
|
unitType: r.type,
|
|
1103
1114
|
snapshot: r.getSnapshot()
|
|
@@ -1106,8 +1117,8 @@ let U = class extends V {
|
|
|
1106
1117
|
), this.registerEventHandler(
|
|
1107
1118
|
this.Event.DocCreated,
|
|
1108
1119
|
() => t.unitAdded$.subscribe((r) => {
|
|
1109
|
-
if (r.type ===
|
|
1110
|
-
const
|
|
1120
|
+
if (r.type === w.UNIVER_DOC) {
|
|
1121
|
+
const i = r, o = e.createInstance(j, i);
|
|
1111
1122
|
this.fireEvent(this.Event.DocCreated, {
|
|
1112
1123
|
unitId: r.getUnitId(),
|
|
1113
1124
|
type: r.type,
|
|
@@ -1304,7 +1315,7 @@ let U = class extends V {
|
|
|
1304
1315
|
* ```
|
|
1305
1316
|
*/
|
|
1306
1317
|
newColor() {
|
|
1307
|
-
return new
|
|
1318
|
+
return new Te();
|
|
1308
1319
|
}
|
|
1309
1320
|
/**
|
|
1310
1321
|
* Create a new rich text.
|
|
@@ -1332,7 +1343,7 @@ let U = class extends V {
|
|
|
1332
1343
|
* ```
|
|
1333
1344
|
*/
|
|
1334
1345
|
newRichTextValue(e) {
|
|
1335
|
-
return
|
|
1346
|
+
return Re.create(e);
|
|
1336
1347
|
}
|
|
1337
1348
|
/**
|
|
1338
1349
|
* Create a new paragraph style.
|
|
@@ -1348,7 +1359,7 @@ let U = class extends V {
|
|
|
1348
1359
|
* ```
|
|
1349
1360
|
*/
|
|
1350
1361
|
newParagraphStyle(e) {
|
|
1351
|
-
return
|
|
1362
|
+
return Oe.create(e);
|
|
1352
1363
|
}
|
|
1353
1364
|
/**
|
|
1354
1365
|
* Create a new paragraph style value.
|
|
@@ -1360,7 +1371,7 @@ let U = class extends V {
|
|
|
1360
1371
|
* ```
|
|
1361
1372
|
*/
|
|
1362
1373
|
newParagraphStyleValue(e) {
|
|
1363
|
-
return
|
|
1374
|
+
return Pe.create(e);
|
|
1364
1375
|
}
|
|
1365
1376
|
/**
|
|
1366
1377
|
* Create a new text style.
|
|
@@ -1372,7 +1383,7 @@ let U = class extends V {
|
|
|
1372
1383
|
* ```
|
|
1373
1384
|
*/
|
|
1374
1385
|
newTextStyle(e) {
|
|
1375
|
-
return
|
|
1386
|
+
return je.create(e);
|
|
1376
1387
|
}
|
|
1377
1388
|
/**
|
|
1378
1389
|
* Create a new text style value.
|
|
@@ -1384,7 +1395,7 @@ let U = class extends V {
|
|
|
1384
1395
|
* ```
|
|
1385
1396
|
*/
|
|
1386
1397
|
newTextStyleValue(e) {
|
|
1387
|
-
return
|
|
1398
|
+
return Be.create(e);
|
|
1388
1399
|
}
|
|
1389
1400
|
/**
|
|
1390
1401
|
* Create a new text decoration.
|
|
@@ -1396,18 +1407,18 @@ let U = class extends V {
|
|
|
1396
1407
|
* ```
|
|
1397
1408
|
*/
|
|
1398
1409
|
newTextDecoration(e) {
|
|
1399
|
-
return new
|
|
1410
|
+
return new He(e);
|
|
1400
1411
|
}
|
|
1401
1412
|
};
|
|
1402
|
-
U =
|
|
1413
|
+
U = Je([
|
|
1403
1414
|
b(0, l(_)),
|
|
1404
1415
|
b(1, y),
|
|
1405
|
-
b(2,
|
|
1416
|
+
b(2, A),
|
|
1406
1417
|
b(3, l(I))
|
|
1407
1418
|
], U);
|
|
1408
1419
|
export {
|
|
1409
1420
|
$ as FBase,
|
|
1410
|
-
|
|
1421
|
+
Ue as FBaseInitialable,
|
|
1411
1422
|
S as FBlob,
|
|
1412
1423
|
R as FEnum,
|
|
1413
1424
|
O as FEventName,
|