@univerjs/sheets 0.5.3-nightly.202501121605 → 0.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +176 -0
- package/lib/cjs/facade.js +1 -1
- package/lib/es/facade.js +346 -264
- package/lib/types/facade/f-workbook.d.ts +40 -2
- package/lib/types/facade/f-worksheet.d.ts +27 -1
- package/lib/types/facade/index.d.ts +0 -1
- package/lib/umd/facade.js +1 -1
- package/package.json +6 -6
package/lib/es/facade.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { Inject as u, Injector as b, IAuthzIoService as
|
|
5
|
-
import { WorksheetProtectionRuleModel as
|
|
6
|
-
import { IDefinedNamesService as
|
|
7
|
-
var
|
|
8
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
1
|
+
var Ae = Object.defineProperty;
|
|
2
|
+
var Fe = (s, e, t) => e in s ? Ae(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
|
|
3
|
+
var k = (s, e, t) => Fe(s, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { Inject as u, Injector as b, IAuthzIoService as ve, LocaleService as Re, ICommandService as l, IPermissionService as ee, generateRandomId as be, FBase as te, Rectangle as N, HorizontalAlign as y, VerticalAlign as U, isFormulaString as je, isCellV as Oe, isICellData as Ve, ObjectMatrix as A, Tools as Be, RANGE_TYPE as _, FBaseInitialable as ne, RichTextValue as p, BooleanNumber as m, WrapStrategy as oe, Dimension as ie, ILogService as pe, Registry as ye, toDisposable as F, Direction as D, IResourceLoaderService as Le, FEnum as ze, FEventName as se, mergeWorksheetSnapshotWithDefault as $e, UndoCommand as He, RedoCommand as Ge, UniverInstanceType as R, IUniverInstanceService as J, FUniver as Ue, CanceledError as qe } from "@univerjs/core";
|
|
5
|
+
import { WorksheetProtectionRuleModel as Ee, RangeProtectionRuleModel as Pe, WorksheetProtectionPointModel as xe, SetDefinedNameCommand as Q, SCOPE_WORKBOOK_VALUE_DEFINED_NAME as X, RemoveDefinedNameCommand as Ke, PermissionPointsDefinitions as Ye, WorkbookEditablePermission as Ne, UnitObject as E, AddWorksheetProtectionMutation as Je, DeleteWorksheetProtectionMutation as Qe, getAllWorksheetPermissionPoint as Xe, getAllWorksheetPermissionPointByPointPanel as ae, SetWorksheetPermissionPointsMutation as Ze, AddRangeProtectionMutation as et, DeleteRangeProtectionMutation as tt, SetRangeProtectionMutation as nt, WorksheetEditPermission as st, WorksheetViewPermission as rt, SetStyleCommand as f, SetRangeValuesCommand as P, SetTextWrapCommand as he, SetVerticalTextAlignCommand as ot, SetHorizontalTextAlignCommand as it, addMergeCellsUtil as $, getAddMergeMutationRangeByType as ce, RemoveWorksheetMergeCommand as at, SplitTextToColumnsCommand as ht, SetWorksheetRangeThemeStyleCommand as ct, DeleteWorksheetRangeThemeStyleCommand as dt, SheetRangeThemeService as Me, getPrimaryForRange as Z, SetSelectionsOperation as De, getNextPrimaryCell as ut, SheetsSelectionsService as We, SetWorksheetDefaultStyleMutation as mt, SetColDataCommand as de, SetRowDataCommand as ue, copyRangeStyles as W, InsertRowByRangeCommand as me, RemoveRowByRangeCommand as lt, MoveRowsCommand as gt, SetRowHiddenCommand as le, SetSpecificRowsVisibleCommand as ge, SetRowHeightCommand as _e, SetWorksheetRowIsAutoHeightCommand as _t, InsertColByRangeCommand as we, RemoveColByRangeCommand as wt, MoveColsCommand as kt, SetColHiddenCommand as ke, SetSpecificColsVisibleCommand as Se, SetColWidthCommand as St, SetFrozenCommand as H, CancelFrozenCommand as Ct, ToggleGridlinesCommand as It, SetGridlinesColorCommand as ft, SetTabColorCommand as vt, SetRangeValuesMutation as Ce, SetWorksheetHideCommand as Rt, SetWorksheetShowCommand as bt, SetWorksheetNameCommand as pt, ClearSelectionAllCommand as yt, ClearSelectionContentCommand as Ut, ClearSelectionFormatCommand as Et, InsertSheetCommand as x, SetWorksheetActiveOperation as G, RemoveSheetCommand as Pt, CopySheetCommand as xt, SetWorksheetOrderCommand as Nt, RegisterWorksheetRangeThemeStyleCommand as Mt, UnregisterWorksheetRangeThemeStyleCommand as Dt } from "@univerjs/sheets";
|
|
6
|
+
import { IDefinedNamesService as Te, serializeRange as re, FormulaDataModel as Wt, serializeRangeWithSheet as Tt, deserializeRangeWithSheet as At } from "@univerjs/engine-formula";
|
|
7
|
+
var Ft = Object.defineProperty, jt = Object.getOwnPropertyDescriptor, Ot = (s, e, t, n) => {
|
|
8
|
+
for (var r = n > 1 ? void 0 : n ? jt(e, t) : e, o = s.length - 1, i; o >= 0; o--)
|
|
9
9
|
(i = s[o]) && (r = (n ? i(e, t, r) : i(r)) || r);
|
|
10
|
-
return n && r &&
|
|
11
|
-
},
|
|
12
|
-
function
|
|
10
|
+
return n && r && Ft(e, t, r), r;
|
|
11
|
+
}, S = (s, e) => (t, n) => e(t, n, s);
|
|
12
|
+
function Vt(s, e, t) {
|
|
13
13
|
const n = t.getDefinedNameMap(s);
|
|
14
14
|
if (n == null)
|
|
15
15
|
return e.t("definedName.defaultName") + 1;
|
|
@@ -24,11 +24,11 @@ function jt(s, e, t) {
|
|
|
24
24
|
a++;
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
class
|
|
27
|
+
class L {
|
|
28
28
|
constructor() {
|
|
29
|
-
|
|
29
|
+
k(this, "_definedNameParam");
|
|
30
30
|
this._definedNameParam = {
|
|
31
|
-
id:
|
|
31
|
+
id: be(10),
|
|
32
32
|
unitId: "",
|
|
33
33
|
name: "",
|
|
34
34
|
formulaOrRefString: ""
|
|
@@ -100,7 +100,7 @@ class B {
|
|
|
100
100
|
* ```
|
|
101
101
|
*/
|
|
102
102
|
setRefByRange(e, t, n, r) {
|
|
103
|
-
return this._definedNameParam.formulaOrRefString =
|
|
103
|
+
return this._definedNameParam.formulaOrRefString = re({
|
|
104
104
|
startRow: e,
|
|
105
105
|
endRow: e + (n != null ? n : 1) - 1,
|
|
106
106
|
startColumn: t,
|
|
@@ -159,12 +159,12 @@ class B {
|
|
|
159
159
|
return this._definedNameParam = e, this;
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
|
-
let
|
|
162
|
+
let j = class extends te {
|
|
163
163
|
constructor(s, e, t, n, r, o, i, a, h, c) {
|
|
164
164
|
super(), this._definedNameParam = s, this._injector = e, this._commandService = t, this._permissionService = n, this._worksheetProtectionRuleModel = r, this._rangeProtectionRuleModel = o, this._worksheetProtectionPointRuleModel = i, this._authzIoService = a, this._localeService = h, this._definedNamesService = c;
|
|
165
165
|
}
|
|
166
166
|
_apply() {
|
|
167
|
-
this._definedNameParam.name === "" && (this._definedNameParam.name =
|
|
167
|
+
this._definedNameParam.name === "" && (this._definedNameParam.name = Vt(this._definedNameParam.unitId, this._localeService, this._definedNamesService)), this._commandService.syncExecuteCommand(Q.id, this._definedNameParam);
|
|
168
168
|
}
|
|
169
169
|
/**
|
|
170
170
|
* Gets the name of the defined name.
|
|
@@ -245,7 +245,7 @@ let F = class extends ee {
|
|
|
245
245
|
* ```
|
|
246
246
|
*/
|
|
247
247
|
setRefByRange(s, e, t, n) {
|
|
248
|
-
this._definedNameParam.formulaOrRefString =
|
|
248
|
+
this._definedNameParam.formulaOrRefString = re({
|
|
249
249
|
startRow: s,
|
|
250
250
|
endRow: s + (t != null ? t : 1) - 1,
|
|
251
251
|
startColumn: e,
|
|
@@ -302,7 +302,7 @@ let F = class extends ee {
|
|
|
302
302
|
* ```
|
|
303
303
|
*/
|
|
304
304
|
setScopeToWorkbook() {
|
|
305
|
-
this._definedNameParam.localSheetId =
|
|
305
|
+
this._definedNameParam.localSheetId = X, this._apply();
|
|
306
306
|
}
|
|
307
307
|
/**
|
|
308
308
|
* Sets the hidden status of the defined name.
|
|
@@ -327,7 +327,7 @@ let F = class extends ee {
|
|
|
327
327
|
* ```
|
|
328
328
|
*/
|
|
329
329
|
delete() {
|
|
330
|
-
this._commandService.syncExecuteCommand(
|
|
330
|
+
this._commandService.syncExecuteCommand(Ke.id, this._definedNameParam);
|
|
331
331
|
}
|
|
332
332
|
/**
|
|
333
333
|
* Gets the local sheet id of the defined name.
|
|
@@ -353,7 +353,7 @@ let F = class extends ee {
|
|
|
353
353
|
* ```
|
|
354
354
|
*/
|
|
355
355
|
isWorkbookScope() {
|
|
356
|
-
return this._definedNameParam.localSheetId ===
|
|
356
|
+
return this._definedNameParam.localSheetId === X;
|
|
357
357
|
}
|
|
358
358
|
/**
|
|
359
359
|
* Converts the defined name to a defined name builder.
|
|
@@ -368,32 +368,32 @@ let F = class extends ee {
|
|
|
368
368
|
* ```
|
|
369
369
|
*/
|
|
370
370
|
toBuilder() {
|
|
371
|
-
const s = this._injector.createInstance(
|
|
371
|
+
const s = this._injector.createInstance(L);
|
|
372
372
|
return s.load(this._definedNameParam), s;
|
|
373
373
|
}
|
|
374
374
|
};
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
],
|
|
386
|
-
var
|
|
387
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
375
|
+
j = Ot([
|
|
376
|
+
S(1, u(b)),
|
|
377
|
+
S(2, l),
|
|
378
|
+
S(3, ee),
|
|
379
|
+
S(4, u(Ee)),
|
|
380
|
+
S(5, u(Pe)),
|
|
381
|
+
S(6, u(xe)),
|
|
382
|
+
S(7, u(ve)),
|
|
383
|
+
S(8, u(Re)),
|
|
384
|
+
S(9, Te)
|
|
385
|
+
], j);
|
|
386
|
+
var Bt = Object.defineProperty, Lt = Object.getOwnPropertyDescriptor, zt = (s, e, t, n) => {
|
|
387
|
+
for (var r = n > 1 ? void 0 : n ? Lt(e, t) : e, o = s.length - 1, i; o >= 0; o--)
|
|
388
388
|
(i = s[o]) && (r = (n ? i(e, t, r) : i(r)) || r);
|
|
389
|
-
return n && r &&
|
|
389
|
+
return n && r && Bt(e, t, r), r;
|
|
390
390
|
}, v = (s, e) => (t, n) => e(t, n, s);
|
|
391
|
-
let
|
|
391
|
+
let O = class extends te {
|
|
392
392
|
constructor(e, t, n, r, o, i, a) {
|
|
393
393
|
super();
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
394
|
+
k(this, "permissionPointsDefinition", Ye);
|
|
395
|
+
k(this, "rangeRuleChangedAfterAuth$");
|
|
396
|
+
k(this, "sheetRuleChangedAfterAuth$");
|
|
397
397
|
this._injector = e, this._commandService = t, this._permissionService = n, this._worksheetProtectionRuleModel = r, this._rangeProtectionRuleModel = o, this._worksheetProtectionPointRuleModel = i, this._authzIoService = a, this.rangeRuleChangedAfterAuth$ = this._rangeProtectionRuleModel.ruleRefresh$, this.sheetRuleChangedAfterAuth$ = this._worksheetProtectionRuleModel.ruleRefresh$;
|
|
398
398
|
}
|
|
399
399
|
/**
|
|
@@ -415,7 +415,7 @@ let j = class extends ee {
|
|
|
415
415
|
* @param {boolean} value - A value that controls whether the workbook can be edited
|
|
416
416
|
*/
|
|
417
417
|
setWorkbookEditPermission(e, t) {
|
|
418
|
-
this.setWorkbookPermissionPoint(e,
|
|
418
|
+
this.setWorkbookPermissionPoint(e, Ne, t);
|
|
419
419
|
}
|
|
420
420
|
/**
|
|
421
421
|
* This function is used to add a base permission for a worksheet.
|
|
@@ -427,7 +427,7 @@ let j = class extends ee {
|
|
|
427
427
|
if (this._rangeProtectionRuleModel.getSubunitRuleList(e, t).length > 0)
|
|
428
428
|
throw new Error("sheet protection cannot intersect with range protection");
|
|
429
429
|
const r = await this._authzIoService.create({
|
|
430
|
-
objectType:
|
|
430
|
+
objectType: E.Worksheet,
|
|
431
431
|
worksheetObject: {
|
|
432
432
|
collaborators: [],
|
|
433
433
|
unitID: e,
|
|
@@ -436,12 +436,12 @@ let j = class extends ee {
|
|
|
436
436
|
scope: void 0
|
|
437
437
|
}
|
|
438
438
|
});
|
|
439
|
-
if (this._commandService.syncExecuteCommand(
|
|
439
|
+
if (this._commandService.syncExecuteCommand(Je.id, {
|
|
440
440
|
unitId: e,
|
|
441
441
|
subUnitId: t,
|
|
442
442
|
rule: {
|
|
443
443
|
permissionId: r,
|
|
444
|
-
unitType:
|
|
444
|
+
unitType: E.Worksheet,
|
|
445
445
|
unitId: e,
|
|
446
446
|
subUnitId: t
|
|
447
447
|
}
|
|
@@ -454,10 +454,10 @@ let j = class extends ee {
|
|
|
454
454
|
* @param {string} subUnitId - The unique identifier of the worksheet for which the permission is being set.
|
|
455
455
|
*/
|
|
456
456
|
removeWorksheetPermission(e, t) {
|
|
457
|
-
this._commandService.syncExecuteCommand(
|
|
457
|
+
this._commandService.syncExecuteCommand(Qe.id, {
|
|
458
458
|
unitId: e,
|
|
459
459
|
subUnitId: t
|
|
460
|
-
}), [...
|
|
460
|
+
}), [...Xe(), ...ae()].forEach((n) => {
|
|
461
461
|
const r = new n(e, t);
|
|
462
462
|
this._permissionService.updatePermissionPoint(r.id, !0);
|
|
463
463
|
}), this._worksheetProtectionPointRuleModel.deleteRule(e, t);
|
|
@@ -475,7 +475,7 @@ let j = class extends ee {
|
|
|
475
475
|
async setWorksheetPermissionPoint(e, t, n, r) {
|
|
476
476
|
const o = this._worksheetProtectionRuleModel.getRule(e, t);
|
|
477
477
|
let i;
|
|
478
|
-
if (n ===
|
|
478
|
+
if (n === st || n === rt)
|
|
479
479
|
if (o)
|
|
480
480
|
i = o.permissionId;
|
|
481
481
|
else {
|
|
@@ -486,7 +486,7 @@ let j = class extends ee {
|
|
|
486
486
|
else {
|
|
487
487
|
const d = this._worksheetProtectionPointRuleModel.getRule(e, t);
|
|
488
488
|
d ? i = d.permissionId : (i = await this._authzIoService.create({
|
|
489
|
-
objectType:
|
|
489
|
+
objectType: E.Worksheet,
|
|
490
490
|
worksheetObject: {
|
|
491
491
|
collaborators: [],
|
|
492
492
|
unitID: e,
|
|
@@ -494,7 +494,7 @@ let j = class extends ee {
|
|
|
494
494
|
name: "",
|
|
495
495
|
scope: void 0
|
|
496
496
|
}
|
|
497
|
-
}), this._commandService.executeCommand(
|
|
497
|
+
}), this._commandService.executeCommand(Ze.id, { unitId: e, subUnitId: t, permissionId: i }));
|
|
498
498
|
}
|
|
499
499
|
const h = new n(e, t);
|
|
500
500
|
return this._permissionService.getPermissionPoint(h.id) || this._permissionService.addPermissionPoint(h), this._permissionService.updatePermissionPoint(h.id, r), i;
|
|
@@ -508,24 +508,24 @@ let j = class extends ee {
|
|
|
508
508
|
*/
|
|
509
509
|
async addRangeBaseProtection(e, t, n) {
|
|
510
510
|
const r = await this._authzIoService.create({
|
|
511
|
-
objectType:
|
|
511
|
+
objectType: E.SelectRange,
|
|
512
512
|
selectRangeObject: {
|
|
513
513
|
collaborators: [],
|
|
514
514
|
unitID: e,
|
|
515
515
|
name: "",
|
|
516
516
|
scope: void 0
|
|
517
517
|
}
|
|
518
|
-
}), o = `ruleId_${
|
|
518
|
+
}), o = `ruleId_${be(6)}`;
|
|
519
519
|
if (this._worksheetProtectionRuleModel.getRule(e, t))
|
|
520
520
|
throw new Error("sheet protection cannot intersect with range protection");
|
|
521
|
-
if (this._rangeProtectionRuleModel.getSubunitRuleList(e, t).some((d) => d.ranges.some((
|
|
521
|
+
if (this._rangeProtectionRuleModel.getSubunitRuleList(e, t).some((d) => d.ranges.some((z) => n.some((M) => N.intersects(M, z)))))
|
|
522
522
|
throw new Error("range protection cannot intersect");
|
|
523
|
-
if (this._commandService.syncExecuteCommand(
|
|
523
|
+
if (this._commandService.syncExecuteCommand(et.id, {
|
|
524
524
|
unitId: e,
|
|
525
525
|
subUnitId: t,
|
|
526
526
|
rules: [{
|
|
527
527
|
permissionId: r,
|
|
528
|
-
unitType:
|
|
528
|
+
unitType: E.SelectRange,
|
|
529
529
|
unitId: e,
|
|
530
530
|
subUnitId: t,
|
|
531
531
|
ranges: n,
|
|
@@ -544,11 +544,11 @@ let j = class extends ee {
|
|
|
544
544
|
* @param {string[]} ruleIds - The rule IDs of the range protection to be removed.
|
|
545
545
|
*/
|
|
546
546
|
removeRangeProtection(e, t, n) {
|
|
547
|
-
this._commandService.syncExecuteCommand(
|
|
547
|
+
this._commandService.syncExecuteCommand(tt.id, {
|
|
548
548
|
unitId: e,
|
|
549
549
|
subUnitId: t,
|
|
550
550
|
ruleIds: n
|
|
551
|
-
}) && this._rangeProtectionRuleModel.getSubunitRuleList(e, t).length === 0 && (this._worksheetProtectionPointRuleModel.deleteRule(e, t), [...
|
|
551
|
+
}) && this._rangeProtectionRuleModel.getSubunitRuleList(e, t).length === 0 && (this._worksheetProtectionPointRuleModel.deleteRule(e, t), [...ae()].forEach((i) => {
|
|
552
552
|
const a = new i(e, t);
|
|
553
553
|
this._permissionService.updatePermissionPoint(a.id, a.value);
|
|
554
554
|
}));
|
|
@@ -582,7 +582,7 @@ let j = class extends ee {
|
|
|
582
582
|
if (o) {
|
|
583
583
|
if (this._rangeProtectionRuleModel.getSubunitRuleList(e, t).filter((h) => h.id !== n).some((h) => h.ranges.some((c) => r.some((d) => N.intersects(d, c)))))
|
|
584
584
|
throw new Error("range protection cannot intersect");
|
|
585
|
-
this._commandService.syncExecuteCommand(
|
|
585
|
+
this._commandService.syncExecuteCommand(nt.id, {
|
|
586
586
|
unitId: e,
|
|
587
587
|
subUnitId: t,
|
|
588
588
|
ruleId: n,
|
|
@@ -594,16 +594,16 @@ let j = class extends ee {
|
|
|
594
594
|
}
|
|
595
595
|
}
|
|
596
596
|
};
|
|
597
|
-
|
|
597
|
+
O = zt([
|
|
598
598
|
v(0, u(b)),
|
|
599
599
|
v(1, l),
|
|
600
|
-
v(2,
|
|
601
|
-
v(3, u(
|
|
600
|
+
v(2, ee),
|
|
601
|
+
v(3, u(Ee)),
|
|
602
602
|
v(4, u(Pe)),
|
|
603
|
-
v(5, u(
|
|
604
|
-
v(6, u(
|
|
605
|
-
],
|
|
606
|
-
function
|
|
603
|
+
v(5, u(xe)),
|
|
604
|
+
v(6, u(ve))
|
|
605
|
+
], O);
|
|
606
|
+
function $t(s) {
|
|
607
607
|
switch (s) {
|
|
608
608
|
case "left":
|
|
609
609
|
return y.LEFT;
|
|
@@ -615,7 +615,7 @@ function Lt(s) {
|
|
|
615
615
|
throw new Error(`Invalid horizontal alignment: ${s}`);
|
|
616
616
|
}
|
|
617
617
|
}
|
|
618
|
-
function
|
|
618
|
+
function Ht(s) {
|
|
619
619
|
switch (s) {
|
|
620
620
|
case y.LEFT:
|
|
621
621
|
return "left";
|
|
@@ -627,7 +627,7 @@ function zt(s) {
|
|
|
627
627
|
throw new Error(`Invalid horizontal alignment: ${s}`);
|
|
628
628
|
}
|
|
629
629
|
}
|
|
630
|
-
function
|
|
630
|
+
function Gt(s) {
|
|
631
631
|
switch (s) {
|
|
632
632
|
case "top":
|
|
633
633
|
return U.TOP;
|
|
@@ -639,7 +639,7 @@ function $t(s) {
|
|
|
639
639
|
throw new Error(`Invalid vertical alignment: ${s}`);
|
|
640
640
|
}
|
|
641
641
|
}
|
|
642
|
-
function
|
|
642
|
+
function qt(s) {
|
|
643
643
|
switch (s) {
|
|
644
644
|
case U.TOP:
|
|
645
645
|
return "top";
|
|
@@ -651,26 +651,26 @@ function Ht(s) {
|
|
|
651
651
|
throw new Error(`Invalid vertical alignment: ${s}`);
|
|
652
652
|
}
|
|
653
653
|
}
|
|
654
|
-
function
|
|
655
|
-
return
|
|
654
|
+
function V(s) {
|
|
655
|
+
return je(s) ? {
|
|
656
656
|
f: s
|
|
657
|
-
} :
|
|
657
|
+
} : Oe(s) ? {
|
|
658
658
|
v: s
|
|
659
|
-
} : (
|
|
659
|
+
} : (Ve(s), s);
|
|
660
660
|
}
|
|
661
|
-
function
|
|
661
|
+
function Ie(s, e) {
|
|
662
662
|
const t = new A(), { startRow: n, startColumn: r, endRow: o, endColumn: i } = e;
|
|
663
|
-
if (
|
|
663
|
+
if (Be.isArray(s))
|
|
664
664
|
for (let a = 0; a <= o - n; a++)
|
|
665
665
|
for (let h = 0; h <= i - r; h++)
|
|
666
|
-
t.setValue(a + n, h + r,
|
|
666
|
+
t.setValue(a + n, h + r, V(s[a][h]));
|
|
667
667
|
else
|
|
668
668
|
new A(s).forValue((h, c, d) => {
|
|
669
|
-
t.setValue(h, c,
|
|
669
|
+
t.setValue(h, c, V(d));
|
|
670
670
|
});
|
|
671
671
|
return t.getMatrix();
|
|
672
672
|
}
|
|
673
|
-
function
|
|
673
|
+
function q(s, e) {
|
|
674
674
|
return {
|
|
675
675
|
startRow: s.startRow,
|
|
676
676
|
endRow: s.endRow,
|
|
@@ -679,7 +679,7 @@ function G(s, e) {
|
|
|
679
679
|
rangeType: _.ROW
|
|
680
680
|
};
|
|
681
681
|
}
|
|
682
|
-
function
|
|
682
|
+
function K(s, e) {
|
|
683
683
|
return {
|
|
684
684
|
startRow: 0,
|
|
685
685
|
endRow: e.getRowCount() - 1,
|
|
@@ -688,12 +688,12 @@ function q(s, e) {
|
|
|
688
688
|
rangeType: _.COLUMN
|
|
689
689
|
};
|
|
690
690
|
}
|
|
691
|
-
var
|
|
692
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
691
|
+
var Kt = Object.defineProperty, Yt = Object.getOwnPropertyDescriptor, Jt = (s, e, t, n) => {
|
|
692
|
+
for (var r = n > 1 ? void 0 : n ? Yt(e, t) : e, o = s.length - 1, i; o >= 0; o--)
|
|
693
693
|
(i = s[o]) && (r = (n ? i(e, t, r) : i(r)) || r);
|
|
694
|
-
return n && r &&
|
|
695
|
-
},
|
|
696
|
-
let w = class extends
|
|
694
|
+
return n && r && Kt(e, t, r), r;
|
|
695
|
+
}, Y = (s, e) => (t, n) => e(t, n, s);
|
|
696
|
+
let w = class extends ne {
|
|
697
697
|
constructor(s, e, t, n, r, o) {
|
|
698
698
|
super(n), this._workbook = s, this._worksheet = e, this._range = t, this._injector = n, this._commandService = r, this._formulaDataModel = o;
|
|
699
699
|
}
|
|
@@ -924,10 +924,10 @@ let w = class extends te {
|
|
|
924
924
|
return this._worksheet.getRange(this._range).getWrapStrategy();
|
|
925
925
|
}
|
|
926
926
|
getHorizontalAlignment() {
|
|
927
|
-
return
|
|
927
|
+
return Ht(this._worksheet.getRange(this._range).getHorizontalAlignment());
|
|
928
928
|
}
|
|
929
929
|
getVerticalAlignment() {
|
|
930
|
-
return
|
|
930
|
+
return qt(this._worksheet.getRange(this._range).getVerticalAlignment());
|
|
931
931
|
}
|
|
932
932
|
/**
|
|
933
933
|
* Set custom meta data for first cell in current range.
|
|
@@ -1005,7 +1005,7 @@ let w = class extends te {
|
|
|
1005
1005
|
* ```
|
|
1006
1006
|
*/
|
|
1007
1007
|
setBackgroundColor(s) {
|
|
1008
|
-
return this._commandService.syncExecuteCommand(
|
|
1008
|
+
return this._commandService.syncExecuteCommand(f.id, {
|
|
1009
1009
|
unitId: this._workbook.getUnitId(),
|
|
1010
1010
|
subUnitId: this._worksheet.getSheetId(),
|
|
1011
1011
|
range: this._range,
|
|
@@ -1033,10 +1033,10 @@ let w = class extends te {
|
|
|
1033
1033
|
* @param {CellValue | ICellData} value The value can be a number, string, boolean, or standard cell format. If it begins with `=`, it is interpreted as a formula. The value is tiled to all cells in the range.
|
|
1034
1034
|
*/
|
|
1035
1035
|
setValue(s) {
|
|
1036
|
-
const e =
|
|
1036
|
+
const e = V(s);
|
|
1037
1037
|
if (!e)
|
|
1038
1038
|
throw new Error("Invalid value");
|
|
1039
|
-
return this._commandService.syncExecuteCommand(
|
|
1039
|
+
return this._commandService.syncExecuteCommand(P.id, {
|
|
1040
1040
|
unitId: this._workbook.getUnitId(),
|
|
1041
1041
|
subUnitId: this._worksheet.getSheetId(),
|
|
1042
1042
|
range: this._range,
|
|
@@ -1054,10 +1054,10 @@ let w = class extends te {
|
|
|
1054
1054
|
* ```
|
|
1055
1055
|
*/
|
|
1056
1056
|
setValueForCell(s) {
|
|
1057
|
-
const e =
|
|
1057
|
+
const e = V(s);
|
|
1058
1058
|
if (!e)
|
|
1059
1059
|
throw new Error("Invalid value");
|
|
1060
|
-
return this._commandService.syncExecuteCommand(
|
|
1060
|
+
return this._commandService.syncExecuteCommand(P.id, {
|
|
1061
1061
|
unitId: this._workbook.getUnitId(),
|
|
1062
1062
|
subUnitId: this._worksheet.getSheetId(),
|
|
1063
1063
|
range: {
|
|
@@ -1093,7 +1093,7 @@ let w = class extends te {
|
|
|
1093
1093
|
},
|
|
1094
1094
|
value: { p: e }
|
|
1095
1095
|
};
|
|
1096
|
-
return this._commandService.syncExecuteCommand(
|
|
1096
|
+
return this._commandService.syncExecuteCommand(P.id, t), this;
|
|
1097
1097
|
}
|
|
1098
1098
|
/**
|
|
1099
1099
|
* Set the rich text value for the cells in the range.
|
|
@@ -1109,13 +1109,13 @@ let w = class extends te {
|
|
|
1109
1109
|
* ```
|
|
1110
1110
|
*/
|
|
1111
1111
|
setRichTextValues(s) {
|
|
1112
|
-
const e = s.map((r) => r.map((o) => o && { p: o instanceof p ? o.getData() : o })), t =
|
|
1112
|
+
const e = s.map((r) => r.map((o) => o && { p: o instanceof p ? o.getData() : o })), t = Ie(e, this._range), n = {
|
|
1113
1113
|
unitId: this._workbook.getUnitId(),
|
|
1114
1114
|
subUnitId: this._worksheet.getSheetId(),
|
|
1115
1115
|
range: this._range,
|
|
1116
1116
|
value: t
|
|
1117
1117
|
};
|
|
1118
|
-
return this._commandService.syncExecuteCommand(
|
|
1118
|
+
return this._commandService.syncExecuteCommand(P.id, n), this;
|
|
1119
1119
|
}
|
|
1120
1120
|
/**
|
|
1121
1121
|
* Set the cell wrap of the given range.
|
|
@@ -1123,11 +1123,11 @@ let w = class extends te {
|
|
|
1123
1123
|
* @param isWrapEnabled
|
|
1124
1124
|
*/
|
|
1125
1125
|
setWrap(s) {
|
|
1126
|
-
return this._commandService.syncExecuteCommand(
|
|
1126
|
+
return this._commandService.syncExecuteCommand(he.id, {
|
|
1127
1127
|
unitId: this._workbook.getUnitId(),
|
|
1128
1128
|
subUnitId: this._worksheet.getSheetId(),
|
|
1129
1129
|
range: this._range,
|
|
1130
|
-
value: s ?
|
|
1130
|
+
value: s ? oe.WRAP : oe.UNSPECIFIED
|
|
1131
1131
|
}), this;
|
|
1132
1132
|
}
|
|
1133
1133
|
/**
|
|
@@ -1135,7 +1135,7 @@ let w = class extends te {
|
|
|
1135
1135
|
* @param strategy
|
|
1136
1136
|
*/
|
|
1137
1137
|
setWrapStrategy(s) {
|
|
1138
|
-
return this._commandService.syncExecuteCommand(
|
|
1138
|
+
return this._commandService.syncExecuteCommand(he.id, {
|
|
1139
1139
|
unitId: this._workbook.getUnitId(),
|
|
1140
1140
|
subUnitId: this._worksheet.getSheetId(),
|
|
1141
1141
|
range: this._range,
|
|
@@ -1147,11 +1147,11 @@ let w = class extends te {
|
|
|
1147
1147
|
* @param alignment
|
|
1148
1148
|
*/
|
|
1149
1149
|
setVerticalAlignment(s) {
|
|
1150
|
-
return this._commandService.syncExecuteCommand(
|
|
1150
|
+
return this._commandService.syncExecuteCommand(ot.id, {
|
|
1151
1151
|
unitId: this._workbook.getUnitId(),
|
|
1152
1152
|
subUnitId: this._worksheet.getSheetId(),
|
|
1153
1153
|
range: this._range,
|
|
1154
|
-
value:
|
|
1154
|
+
value: Gt(s)
|
|
1155
1155
|
}), this;
|
|
1156
1156
|
}
|
|
1157
1157
|
/**
|
|
@@ -1159,11 +1159,11 @@ let w = class extends te {
|
|
|
1159
1159
|
* @param alignment
|
|
1160
1160
|
*/
|
|
1161
1161
|
setHorizontalAlignment(s) {
|
|
1162
|
-
return this._commandService.syncExecuteCommand(
|
|
1162
|
+
return this._commandService.syncExecuteCommand(it.id, {
|
|
1163
1163
|
unitId: this._workbook.getUnitId(),
|
|
1164
1164
|
subUnitId: this._worksheet.getSheetId(),
|
|
1165
1165
|
range: this._range,
|
|
1166
|
-
value:
|
|
1166
|
+
value: $t(s)
|
|
1167
1167
|
}), this;
|
|
1168
1168
|
}
|
|
1169
1169
|
/**
|
|
@@ -1171,8 +1171,8 @@ let w = class extends te {
|
|
|
1171
1171
|
* @param value
|
|
1172
1172
|
*/
|
|
1173
1173
|
setValues(s) {
|
|
1174
|
-
const e =
|
|
1175
|
-
return this._commandService.syncExecuteCommand(
|
|
1174
|
+
const e = Ie(s, this._range);
|
|
1175
|
+
return this._commandService.syncExecuteCommand(P.id, {
|
|
1176
1176
|
unitId: this._workbook.getUnitId(),
|
|
1177
1177
|
subUnitId: this._worksheet.getSheetId(),
|
|
1178
1178
|
range: this._range,
|
|
@@ -1202,7 +1202,7 @@ let w = class extends te {
|
|
|
1202
1202
|
range: this._range,
|
|
1203
1203
|
style: t
|
|
1204
1204
|
};
|
|
1205
|
-
return this._commandService.executeCommand(
|
|
1205
|
+
return this._commandService.executeCommand(f.id, n), this;
|
|
1206
1206
|
}
|
|
1207
1207
|
/**
|
|
1208
1208
|
* Sets the font style for the given range ('italic' or 'normal').
|
|
@@ -1227,7 +1227,7 @@ let w = class extends te {
|
|
|
1227
1227
|
range: this._range,
|
|
1228
1228
|
style: t
|
|
1229
1229
|
};
|
|
1230
|
-
return this._commandService.executeCommand(
|
|
1230
|
+
return this._commandService.executeCommand(f.id, n), this;
|
|
1231
1231
|
}
|
|
1232
1232
|
/**
|
|
1233
1233
|
* Sets the font line style of the given range ('underline', 'line-through', or 'none').
|
|
@@ -1268,7 +1268,7 @@ let w = class extends te {
|
|
|
1268
1268
|
range: this._range,
|
|
1269
1269
|
style: e
|
|
1270
1270
|
};
|
|
1271
|
-
this._commandService.executeCommand(
|
|
1271
|
+
this._commandService.executeCommand(f.id, t);
|
|
1272
1272
|
}
|
|
1273
1273
|
/**
|
|
1274
1274
|
* Sets the font strikethrough style of the given ITextDecoration
|
|
@@ -1284,7 +1284,7 @@ let w = class extends te {
|
|
|
1284
1284
|
range: this._range,
|
|
1285
1285
|
style: e
|
|
1286
1286
|
};
|
|
1287
|
-
this._commandService.executeCommand(
|
|
1287
|
+
this._commandService.executeCommand(f.id, t);
|
|
1288
1288
|
}
|
|
1289
1289
|
/**
|
|
1290
1290
|
* Sets the font family, such as "Arial" or "Helvetica".
|
|
@@ -1300,7 +1300,7 @@ let w = class extends te {
|
|
|
1300
1300
|
range: this._range,
|
|
1301
1301
|
style: e
|
|
1302
1302
|
};
|
|
1303
|
-
return this._commandService.executeCommand(
|
|
1303
|
+
return this._commandService.executeCommand(f.id, t), this;
|
|
1304
1304
|
}
|
|
1305
1305
|
/**
|
|
1306
1306
|
* Sets the font size, with the size being the point size to use.
|
|
@@ -1316,7 +1316,7 @@ let w = class extends te {
|
|
|
1316
1316
|
range: this._range,
|
|
1317
1317
|
style: e
|
|
1318
1318
|
};
|
|
1319
|
-
return this._commandService.executeCommand(
|
|
1319
|
+
return this._commandService.executeCommand(f.id, t), this;
|
|
1320
1320
|
}
|
|
1321
1321
|
/**
|
|
1322
1322
|
* Sets the font color in CSS notation (such as '#ffffff' or 'white').
|
|
@@ -1332,7 +1332,7 @@ let w = class extends te {
|
|
|
1332
1332
|
range: this._range,
|
|
1333
1333
|
style: t
|
|
1334
1334
|
};
|
|
1335
|
-
return this._commandService.executeCommand(
|
|
1335
|
+
return this._commandService.executeCommand(f.id, n), this;
|
|
1336
1336
|
}
|
|
1337
1337
|
// #endregion editing
|
|
1338
1338
|
//#region Merge cell
|
|
@@ -1352,7 +1352,7 @@ let w = class extends te {
|
|
|
1352
1352
|
*/
|
|
1353
1353
|
merge(s = !0) {
|
|
1354
1354
|
const e = this._workbook.getUnitId(), t = this._worksheet.getSheetId();
|
|
1355
|
-
return
|
|
1355
|
+
return $(this._injector, e, t, [this._range], s), this;
|
|
1356
1356
|
}
|
|
1357
1357
|
/**
|
|
1358
1358
|
* Merges cells in a range horizontally.
|
|
@@ -1369,8 +1369,8 @@ let w = class extends te {
|
|
|
1369
1369
|
* ```
|
|
1370
1370
|
*/
|
|
1371
1371
|
mergeAcross(s = !0) {
|
|
1372
|
-
const e =
|
|
1373
|
-
return
|
|
1372
|
+
const e = ce([this._range], ie.ROWS), t = this._workbook.getUnitId(), n = this._worksheet.getSheetId();
|
|
1373
|
+
return $(this._injector, t, n, e, s), this;
|
|
1374
1374
|
}
|
|
1375
1375
|
/**
|
|
1376
1376
|
* Merges cells in a range vertically.
|
|
@@ -1387,8 +1387,8 @@ let w = class extends te {
|
|
|
1387
1387
|
* ```
|
|
1388
1388
|
*/
|
|
1389
1389
|
mergeVertically(s = !0) {
|
|
1390
|
-
const e =
|
|
1391
|
-
return
|
|
1390
|
+
const e = ce([this._range], ie.COLUMNS), t = this._workbook.getUnitId(), n = this._worksheet.getSheetId();
|
|
1391
|
+
return $(this._injector, t, n, e, s), this;
|
|
1392
1392
|
}
|
|
1393
1393
|
/**
|
|
1394
1394
|
* Returns true if cells in the current range overlap a merged cell.
|
|
@@ -1426,7 +1426,7 @@ let w = class extends te {
|
|
|
1426
1426
|
* ```
|
|
1427
1427
|
*/
|
|
1428
1428
|
breakApart() {
|
|
1429
|
-
return this._commandService.executeCommand(
|
|
1429
|
+
return this._commandService.executeCommand(at.id, { ranges: [this._range] }), this;
|
|
1430
1430
|
}
|
|
1431
1431
|
//#endregion
|
|
1432
1432
|
/**
|
|
@@ -1462,7 +1462,7 @@ let w = class extends te {
|
|
|
1462
1462
|
* ```
|
|
1463
1463
|
*/
|
|
1464
1464
|
getA1Notation(s) {
|
|
1465
|
-
return s ?
|
|
1465
|
+
return s ? Tt(this._worksheet.getName(), this._range) : re(this._range);
|
|
1466
1466
|
}
|
|
1467
1467
|
/**
|
|
1468
1468
|
* Sets the specified range as the active range, with the top left cell in the range as the current cell.
|
|
@@ -1476,7 +1476,7 @@ let w = class extends te {
|
|
|
1476
1476
|
* ```
|
|
1477
1477
|
*/
|
|
1478
1478
|
activate() {
|
|
1479
|
-
return this._injector.createInstance(
|
|
1479
|
+
return this._injector.createInstance(I, this._workbook).setActiveRange(this), this;
|
|
1480
1480
|
}
|
|
1481
1481
|
/**
|
|
1482
1482
|
* Sets the specified cell as the current cell.
|
|
@@ -1524,7 +1524,7 @@ let w = class extends te {
|
|
|
1524
1524
|
* // 4 | 5 | 6
|
|
1525
1525
|
*/
|
|
1526
1526
|
splitTextToColumns(s, e, t) {
|
|
1527
|
-
this._commandService.executeCommand(
|
|
1527
|
+
this._commandService.executeCommand(ht.id, {
|
|
1528
1528
|
unitId: this._workbook.getUnitId(),
|
|
1529
1529
|
subUnitId: this._worksheet.getSheetId(),
|
|
1530
1530
|
range: this._range,
|
|
@@ -1549,7 +1549,7 @@ let w = class extends te {
|
|
|
1549
1549
|
const e = this.getUsedThemeStyle();
|
|
1550
1550
|
e && this.removeThemeStyle(e);
|
|
1551
1551
|
} else
|
|
1552
|
-
this._commandService.executeCommand(
|
|
1552
|
+
this._commandService.executeCommand(ct.id, {
|
|
1553
1553
|
unitId: this._workbook.getUnitId(),
|
|
1554
1554
|
subUnitId: this._worksheet.getSheetId(),
|
|
1555
1555
|
range: this._range,
|
|
@@ -1568,7 +1568,7 @@ let w = class extends te {
|
|
|
1568
1568
|
* ```
|
|
1569
1569
|
*/
|
|
1570
1570
|
removeThemeStyle(s) {
|
|
1571
|
-
this._commandService.executeCommand(
|
|
1571
|
+
this._commandService.executeCommand(dt.id, {
|
|
1572
1572
|
unitId: this._workbook.getUnitId(),
|
|
1573
1573
|
subUnitId: this._worksheet.getSheetId(),
|
|
1574
1574
|
range: this._range,
|
|
@@ -1589,24 +1589,24 @@ let w = class extends te {
|
|
|
1589
1589
|
* ```
|
|
1590
1590
|
*/
|
|
1591
1591
|
getUsedThemeStyle() {
|
|
1592
|
-
return this._injector.get(
|
|
1592
|
+
return this._injector.get(Me).getAppliedRangeThemeStyle({
|
|
1593
1593
|
unitId: this._workbook.getUnitId(),
|
|
1594
1594
|
subUnitId: this._worksheet.getSheetId(),
|
|
1595
1595
|
range: this._range
|
|
1596
1596
|
});
|
|
1597
1597
|
}
|
|
1598
1598
|
};
|
|
1599
|
-
w =
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1599
|
+
w = Jt([
|
|
1600
|
+
Y(3, u(b)),
|
|
1601
|
+
Y(4, l),
|
|
1602
|
+
Y(5, u(Wt))
|
|
1603
1603
|
], w);
|
|
1604
|
-
var
|
|
1605
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
1604
|
+
var Qt = Object.defineProperty, Xt = Object.getOwnPropertyDescriptor, Zt = (s, e, t, n) => {
|
|
1605
|
+
for (var r = n > 1 ? void 0 : n ? Xt(e, t) : e, o = s.length - 1, i; o >= 0; o--)
|
|
1606
1606
|
(i = s[o]) && (r = (n ? i(e, t, r) : i(r)) || r);
|
|
1607
|
-
return n && r &&
|
|
1608
|
-
},
|
|
1609
|
-
let
|
|
1607
|
+
return n && r && Qt(e, t, r), r;
|
|
1608
|
+
}, en = (s, e) => (t, n) => e(t, n, s);
|
|
1609
|
+
let B = class {
|
|
1610
1610
|
constructor(s, e, t, n) {
|
|
1611
1611
|
this._workbook = s, this._worksheet = e, this._selections = t, this._injector = n;
|
|
1612
1612
|
}
|
|
@@ -1646,7 +1646,7 @@ let V = class {
|
|
|
1646
1646
|
* ```
|
|
1647
1647
|
*/
|
|
1648
1648
|
getActiveSheet() {
|
|
1649
|
-
const s = this._injector.createInstance(
|
|
1649
|
+
const s = this._injector.createInstance(I, this._workbook);
|
|
1650
1650
|
return this._injector.createInstance(g, s, this._workbook, this._worksheet);
|
|
1651
1651
|
}
|
|
1652
1652
|
/**
|
|
@@ -1669,7 +1669,7 @@ let V = class {
|
|
|
1669
1669
|
for (const { range: o, style: i } of this._selections)
|
|
1670
1670
|
N.contains(o, s.getRange()) ? (t.push({
|
|
1671
1671
|
range: o,
|
|
1672
|
-
primary:
|
|
1672
|
+
primary: Z(s.getRange(), this._worksheet),
|
|
1673
1673
|
style: i
|
|
1674
1674
|
}), n = !0) : t.push({
|
|
1675
1675
|
range: o,
|
|
@@ -1679,7 +1679,7 @@ let V = class {
|
|
|
1679
1679
|
n || (t = [
|
|
1680
1680
|
{
|
|
1681
1681
|
range: s.getRange(),
|
|
1682
|
-
primary:
|
|
1682
|
+
primary: Z(s.getRange(), this._worksheet)
|
|
1683
1683
|
}
|
|
1684
1684
|
]);
|
|
1685
1685
|
const r = {
|
|
@@ -1687,7 +1687,7 @@ let V = class {
|
|
|
1687
1687
|
subUnitId: this._worksheet.getSheetId(),
|
|
1688
1688
|
selections: t
|
|
1689
1689
|
};
|
|
1690
|
-
return e.syncExecuteCommand(
|
|
1690
|
+
return e.syncExecuteCommand(De.id, r), new B(this._workbook, this._worksheet, t, this._injector);
|
|
1691
1691
|
}
|
|
1692
1692
|
/**
|
|
1693
1693
|
*Get the next primary cell in the specified direction. If the primary cell not exists in selections, return null.
|
|
@@ -1707,31 +1707,66 @@ let V = class {
|
|
|
1707
1707
|
getNextDataRange(s) {
|
|
1708
1708
|
if (!this._selections.find((n) => !!n.primary))
|
|
1709
1709
|
return null;
|
|
1710
|
-
const t =
|
|
1710
|
+
const t = ut(this._selections.concat(), s, this._worksheet);
|
|
1711
1711
|
return t ? this._injector.createInstance(w, this._workbook, this._worksheet, t) : null;
|
|
1712
1712
|
}
|
|
1713
1713
|
};
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
],
|
|
1717
|
-
var
|
|
1718
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
1714
|
+
B = Zt([
|
|
1715
|
+
en(3, u(b))
|
|
1716
|
+
], B);
|
|
1717
|
+
var tn = Object.defineProperty, nn = Object.getOwnPropertyDescriptor, sn = (s, e, t, n) => {
|
|
1718
|
+
for (var r = n > 1 ? void 0 : n ? nn(e, t) : e, o = s.length - 1, i; o >= 0; o--)
|
|
1719
1719
|
(i = s[o]) && (r = (n ? i(e, t, r) : i(r)) || r);
|
|
1720
|
-
return n && r &&
|
|
1720
|
+
return n && r && tn(e, t, r), r;
|
|
1721
1721
|
}, T = (s, e) => (t, n) => e(t, n, s);
|
|
1722
|
-
let g = class extends
|
|
1722
|
+
let g = class extends ne {
|
|
1723
1723
|
constructor(e, t, n, r, o, i, a) {
|
|
1724
1724
|
super(r);
|
|
1725
|
+
k(this, "_eventRegistry", /* @__PURE__ */ new Map());
|
|
1725
1726
|
/**
|
|
1726
1727
|
* Sets the active selection region for this sheet.
|
|
1727
1728
|
* @param range The range to set as the active selection.
|
|
1728
1729
|
*/
|
|
1729
|
-
|
|
1730
|
+
k(this, "setActiveSelection", this.setActiveRange);
|
|
1730
1731
|
this._fWorkbook = e, this._workbook = t, this._worksheet = n, this._injector = r, this._selectionManagerService = o, this._logService = i, this._commandService = a;
|
|
1731
1732
|
}
|
|
1732
1733
|
getSheet() {
|
|
1733
1734
|
return this._worksheet;
|
|
1734
1735
|
}
|
|
1736
|
+
_ensureEventRegistry(e) {
|
|
1737
|
+
return this._eventRegistry.has(e) || this._eventRegistry.set(e, new ye()), this._eventRegistry.get(e);
|
|
1738
|
+
}
|
|
1739
|
+
/**
|
|
1740
|
+
* Add an event listener
|
|
1741
|
+
* @param event key of event
|
|
1742
|
+
* @param callback callback when event triggered
|
|
1743
|
+
* @returns {Disposable} The Disposable instance, for remove the listener
|
|
1744
|
+
* @example
|
|
1745
|
+
* ```ts
|
|
1746
|
+
* univerAPI.addEvent(univerAPI.event.UnitCreated, (params) => {
|
|
1747
|
+
* console.log('unit created', params);
|
|
1748
|
+
* });
|
|
1749
|
+
* ```
|
|
1750
|
+
*/
|
|
1751
|
+
addEvent(e, t) {
|
|
1752
|
+
return this._ensureEventRegistry(e).add(t), F(() => this._ensureEventRegistry(e).delete(t));
|
|
1753
|
+
}
|
|
1754
|
+
/**
|
|
1755
|
+
* Fire an event, used in internal only.
|
|
1756
|
+
* @param event {string} key of event
|
|
1757
|
+
* @param params {any} params of event
|
|
1758
|
+
* @returns {boolean} should cancel
|
|
1759
|
+
* @example
|
|
1760
|
+
* ```ts
|
|
1761
|
+
* this.fireEvent(univerAPI.event.UnitCreated, params);
|
|
1762
|
+
* ```
|
|
1763
|
+
*/
|
|
1764
|
+
fireEvent(e, t) {
|
|
1765
|
+
var n;
|
|
1766
|
+
return (n = this._eventRegistry.get(e)) == null || n.getData().forEach((r) => {
|
|
1767
|
+
r(t);
|
|
1768
|
+
}), t.cancel;
|
|
1769
|
+
}
|
|
1735
1770
|
/**
|
|
1736
1771
|
* Returns the injector
|
|
1737
1772
|
* @returns The injector
|
|
@@ -1766,7 +1801,7 @@ let g = class extends te {
|
|
|
1766
1801
|
*/
|
|
1767
1802
|
getSelection() {
|
|
1768
1803
|
const e = this._selectionManagerService.getCurrentSelections();
|
|
1769
|
-
return e ? this._injector.createInstance(
|
|
1804
|
+
return e ? this._injector.createInstance(B, this._workbook, this._worksheet, e) : null;
|
|
1770
1805
|
}
|
|
1771
1806
|
// #region rows
|
|
1772
1807
|
// #region default style
|
|
@@ -1802,7 +1837,7 @@ let g = class extends te {
|
|
|
1802
1837
|
*/
|
|
1803
1838
|
setDefaultStyle(e) {
|
|
1804
1839
|
const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId();
|
|
1805
|
-
return this._commandService.syncExecuteCommand(
|
|
1840
|
+
return this._commandService.syncExecuteCommand(mt.id, {
|
|
1806
1841
|
unitId: t,
|
|
1807
1842
|
subUnitId: n,
|
|
1808
1843
|
defaultStyle: e
|
|
@@ -1824,7 +1859,7 @@ let g = class extends te {
|
|
|
1824
1859
|
}
|
|
1825
1860
|
}
|
|
1826
1861
|
};
|
|
1827
|
-
return this._commandService.syncExecuteCommand(
|
|
1862
|
+
return this._commandService.syncExecuteCommand(de.id, o), this;
|
|
1828
1863
|
}
|
|
1829
1864
|
/**
|
|
1830
1865
|
* Set the default style of the worksheet column
|
|
@@ -1842,12 +1877,12 @@ let g = class extends te {
|
|
|
1842
1877
|
}
|
|
1843
1878
|
}
|
|
1844
1879
|
};
|
|
1845
|
-
return this._commandService.syncExecuteCommand(
|
|
1880
|
+
return this._commandService.syncExecuteCommand(ue.id, o), this;
|
|
1846
1881
|
}
|
|
1847
1882
|
getRange(e, t, n, r) {
|
|
1848
1883
|
let o, i;
|
|
1849
1884
|
if (typeof e == "string") {
|
|
1850
|
-
const { range: a, sheetName: h } =
|
|
1885
|
+
const { range: a, sheetName: h } = At(e), c = h ? this._workbook.getSheetBySheetName(h) : this._worksheet;
|
|
1851
1886
|
if (!c)
|
|
1852
1887
|
throw new Error("Range not found");
|
|
1853
1888
|
i = c, o = {
|
|
@@ -1922,7 +1957,7 @@ let g = class extends te {
|
|
|
1922
1957
|
*/
|
|
1923
1958
|
insertRowsAfter(e, t) {
|
|
1924
1959
|
const n = this._workbook.getUnitId(), r = this._worksheet.getSheetId(), o = D.DOWN, i = e + 1, a = e + t, h = 0, c = this._worksheet.getColumnCount() - 1, d = W(this._worksheet, i, a, h, c, !0, e);
|
|
1925
|
-
return this._commandService.syncExecuteCommand(
|
|
1960
|
+
return this._commandService.syncExecuteCommand(me.id, {
|
|
1926
1961
|
unitId: n,
|
|
1927
1962
|
subUnitId: r,
|
|
1928
1963
|
direction: o,
|
|
@@ -1943,7 +1978,7 @@ let g = class extends te {
|
|
|
1943
1978
|
*/
|
|
1944
1979
|
insertRowsBefore(e, t) {
|
|
1945
1980
|
const n = this._workbook.getUnitId(), r = this._worksheet.getSheetId(), o = D.UP, i = e, a = e + t - 1, h = 0, c = this._worksheet.getColumnCount() - 1, d = W(this._worksheet, i, a, h, c, !0, e - 1);
|
|
1946
|
-
return this._commandService.syncExecuteCommand(
|
|
1981
|
+
return this._commandService.syncExecuteCommand(me.id, {
|
|
1947
1982
|
unitId: n,
|
|
1948
1983
|
subUnitId: r,
|
|
1949
1984
|
direction: o,
|
|
@@ -1977,7 +2012,7 @@ let g = class extends te {
|
|
|
1977
2012
|
startColumn: 0,
|
|
1978
2013
|
endColumn: this._worksheet.getColumnCount() - 1
|
|
1979
2014
|
};
|
|
1980
|
-
return this._commandService.syncExecuteCommand(
|
|
2015
|
+
return this._commandService.syncExecuteCommand(lt.id, {
|
|
1981
2016
|
range: n,
|
|
1982
2017
|
unitId: this._workbook.getUnitId(),
|
|
1983
2018
|
subUnitId: this._worksheet.getSheetId()
|
|
@@ -1990,13 +2025,13 @@ let g = class extends te {
|
|
|
1990
2025
|
* @returns This sheet, for chaining.
|
|
1991
2026
|
*/
|
|
1992
2027
|
moveRows(e, t) {
|
|
1993
|
-
const n = this._workbook.getUnitId(), r = this._worksheet.getSheetId(), o =
|
|
2028
|
+
const n = this._workbook.getUnitId(), r = this._worksheet.getSheetId(), o = q(e.getRange(), this._worksheet), i = o, a = {
|
|
1994
2029
|
startRow: t,
|
|
1995
2030
|
endRow: t,
|
|
1996
2031
|
startColumn: o.startColumn,
|
|
1997
2032
|
endColumn: o.endColumn
|
|
1998
2033
|
};
|
|
1999
|
-
return this._commandService.syncExecuteCommand(
|
|
2034
|
+
return this._commandService.syncExecuteCommand(gt.id, {
|
|
2000
2035
|
unitId: n,
|
|
2001
2036
|
subUnitId: r,
|
|
2002
2037
|
range: o,
|
|
@@ -2010,8 +2045,8 @@ let g = class extends te {
|
|
|
2010
2045
|
* @returns This sheet, for chaining.
|
|
2011
2046
|
*/
|
|
2012
2047
|
hideRow(e) {
|
|
2013
|
-
const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), r =
|
|
2014
|
-
return this._commandService.syncExecuteCommand(
|
|
2048
|
+
const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), r = q(e.getRange(), this._worksheet);
|
|
2049
|
+
return this._commandService.syncExecuteCommand(le.id, {
|
|
2015
2050
|
unitId: t,
|
|
2016
2051
|
subUnitId: n,
|
|
2017
2052
|
ranges: [r]
|
|
@@ -2031,7 +2066,7 @@ let g = class extends te {
|
|
|
2031
2066
|
endColumn: this._worksheet.getColumnCount() - 1,
|
|
2032
2067
|
rangeType: _.ROW
|
|
2033
2068
|
};
|
|
2034
|
-
return this._commandService.syncExecuteCommand(
|
|
2069
|
+
return this._commandService.syncExecuteCommand(le.id, {
|
|
2035
2070
|
unitId: n,
|
|
2036
2071
|
subUnitId: r,
|
|
2037
2072
|
ranges: [o]
|
|
@@ -2043,8 +2078,8 @@ let g = class extends te {
|
|
|
2043
2078
|
* @returns {FWorksheet} This sheet, for chaining.
|
|
2044
2079
|
*/
|
|
2045
2080
|
unhideRow(e) {
|
|
2046
|
-
const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), r =
|
|
2047
|
-
return this._commandService.syncExecuteCommand(
|
|
2081
|
+
const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), r = q(e.getRange(), this._worksheet);
|
|
2082
|
+
return this._commandService.syncExecuteCommand(ge.id, {
|
|
2048
2083
|
unitId: t,
|
|
2049
2084
|
subUnitId: n,
|
|
2050
2085
|
ranges: [r]
|
|
@@ -2064,7 +2099,7 @@ let g = class extends te {
|
|
|
2064
2099
|
endColumn: this._worksheet.getColumnCount() - 1,
|
|
2065
2100
|
rangeType: _.ROW
|
|
2066
2101
|
};
|
|
2067
|
-
return this._commandService.syncExecuteCommand(
|
|
2102
|
+
return this._commandService.syncExecuteCommand(ge.id, {
|
|
2068
2103
|
unitId: n,
|
|
2069
2104
|
subUnitId: r,
|
|
2070
2105
|
ranges: [o]
|
|
@@ -2091,20 +2126,20 @@ let g = class extends te {
|
|
|
2091
2126
|
var c;
|
|
2092
2127
|
const r = this._workbook.getUnitId(), o = this._worksheet.getSheetId(), i = this._worksheet.getRowManager(), a = [], h = [];
|
|
2093
2128
|
for (let d = e; d < e + t; d++) {
|
|
2094
|
-
const
|
|
2129
|
+
const z = ((c = i.getRow(d)) == null ? void 0 : c.ah) || this._worksheet.getConfig().defaultRowHeight, M = {
|
|
2095
2130
|
startRow: d,
|
|
2096
2131
|
endRow: d,
|
|
2097
2132
|
startColumn: 0,
|
|
2098
2133
|
endColumn: this._worksheet.getColumnCount() - 1
|
|
2099
2134
|
};
|
|
2100
|
-
n <=
|
|
2135
|
+
n <= z ? a.push(M) : h.push(M);
|
|
2101
2136
|
}
|
|
2102
|
-
return h.length > 0 && this._commandService.syncExecuteCommand(
|
|
2137
|
+
return h.length > 0 && this._commandService.syncExecuteCommand(_e.id, {
|
|
2103
2138
|
unitId: r,
|
|
2104
2139
|
subUnitId: o,
|
|
2105
2140
|
ranges: h,
|
|
2106
2141
|
value: n
|
|
2107
|
-
}), a.length > 0 && this._commandService.syncExecuteCommand(
|
|
2142
|
+
}), a.length > 0 && this._commandService.syncExecuteCommand(_t.id, {
|
|
2108
2143
|
unitId: r,
|
|
2109
2144
|
subUnitId: o,
|
|
2110
2145
|
ranges: a
|
|
@@ -2126,7 +2161,7 @@ let g = class extends te {
|
|
|
2126
2161
|
endColumn: this._worksheet.getColumnCount() - 1
|
|
2127
2162
|
}
|
|
2128
2163
|
];
|
|
2129
|
-
return this._commandService.syncExecuteCommand(
|
|
2164
|
+
return this._commandService.syncExecuteCommand(_e.id, {
|
|
2130
2165
|
unitId: r,
|
|
2131
2166
|
subUnitId: o,
|
|
2132
2167
|
ranges: i,
|
|
@@ -2150,7 +2185,7 @@ let g = class extends te {
|
|
|
2150
2185
|
subUnitId: n,
|
|
2151
2186
|
rowData: r
|
|
2152
2187
|
};
|
|
2153
|
-
return this._commandService.syncExecuteCommand(
|
|
2188
|
+
return this._commandService.syncExecuteCommand(ue.id, o), this;
|
|
2154
2189
|
}
|
|
2155
2190
|
// #region Column
|
|
2156
2191
|
/**
|
|
@@ -2186,7 +2221,7 @@ let g = class extends te {
|
|
|
2186
2221
|
*/
|
|
2187
2222
|
insertColumnsAfter(e, t) {
|
|
2188
2223
|
const n = this._workbook.getUnitId(), r = this._worksheet.getSheetId(), o = D.RIGHT, i = 0, a = this._worksheet.getRowCount() - 1, h = e + 1, c = e + t, d = W(this._worksheet, i, a, h, c, !1, e);
|
|
2189
|
-
return this._commandService.syncExecuteCommand(
|
|
2224
|
+
return this._commandService.syncExecuteCommand(we.id, {
|
|
2190
2225
|
unitId: n,
|
|
2191
2226
|
subUnitId: r,
|
|
2192
2227
|
direction: o,
|
|
@@ -2207,7 +2242,7 @@ let g = class extends te {
|
|
|
2207
2242
|
*/
|
|
2208
2243
|
insertColumnsBefore(e, t) {
|
|
2209
2244
|
const n = this._workbook.getUnitId(), r = this._worksheet.getSheetId(), o = D.LEFT, i = 0, a = this._worksheet.getRowCount() - 1, h = e, c = e + t - 1, d = W(this._worksheet, i, a, h, c, !1, e - 1);
|
|
2210
|
-
return this._commandService.syncExecuteCommand(
|
|
2245
|
+
return this._commandService.syncExecuteCommand(we.id, {
|
|
2211
2246
|
unitId: n,
|
|
2212
2247
|
subUnitId: r,
|
|
2213
2248
|
direction: o,
|
|
@@ -2241,7 +2276,7 @@ let g = class extends te {
|
|
|
2241
2276
|
startColumn: e,
|
|
2242
2277
|
endColumn: e + t - 1
|
|
2243
2278
|
};
|
|
2244
|
-
return this._commandService.syncExecuteCommand(
|
|
2279
|
+
return this._commandService.syncExecuteCommand(wt.id, {
|
|
2245
2280
|
range: n,
|
|
2246
2281
|
unitId: this._workbook.getUnitId(),
|
|
2247
2282
|
subUnitId: this._worksheet.getSheetId()
|
|
@@ -2254,13 +2289,13 @@ let g = class extends te {
|
|
|
2254
2289
|
* @returns This sheet, for chaining.
|
|
2255
2290
|
*/
|
|
2256
2291
|
moveColumns(e, t) {
|
|
2257
|
-
const n = this._workbook.getUnitId(), r = this._worksheet.getSheetId(), o =
|
|
2292
|
+
const n = this._workbook.getUnitId(), r = this._worksheet.getSheetId(), o = K(e.getRange(), this._worksheet), i = o, a = {
|
|
2258
2293
|
startRow: 0,
|
|
2259
2294
|
endRow: this._worksheet.getRowCount() - 1,
|
|
2260
2295
|
startColumn: t,
|
|
2261
2296
|
endColumn: t
|
|
2262
2297
|
};
|
|
2263
|
-
return this._commandService.syncExecuteCommand(
|
|
2298
|
+
return this._commandService.syncExecuteCommand(kt.id, {
|
|
2264
2299
|
unitId: n,
|
|
2265
2300
|
subUnitId: r,
|
|
2266
2301
|
range: o,
|
|
@@ -2274,8 +2309,8 @@ let g = class extends te {
|
|
|
2274
2309
|
* @returns This sheet, for chaining.
|
|
2275
2310
|
*/
|
|
2276
2311
|
hideColumn(e) {
|
|
2277
|
-
const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), r =
|
|
2278
|
-
return this._commandService.syncExecuteCommand(
|
|
2312
|
+
const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), r = K(e.getRange(), this._worksheet);
|
|
2313
|
+
return this._commandService.syncExecuteCommand(ke.id, {
|
|
2279
2314
|
unitId: t,
|
|
2280
2315
|
subUnitId: n,
|
|
2281
2316
|
ranges: [r]
|
|
@@ -2295,7 +2330,7 @@ let g = class extends te {
|
|
|
2295
2330
|
endColumn: e + t - 1,
|
|
2296
2331
|
rangeType: _.COLUMN
|
|
2297
2332
|
};
|
|
2298
|
-
return this._commandService.syncExecuteCommand(
|
|
2333
|
+
return this._commandService.syncExecuteCommand(ke.id, {
|
|
2299
2334
|
unitId: n,
|
|
2300
2335
|
subUnitId: r,
|
|
2301
2336
|
ranges: [o]
|
|
@@ -2307,8 +2342,8 @@ let g = class extends te {
|
|
|
2307
2342
|
* @returns This sheet, for chaining.
|
|
2308
2343
|
*/
|
|
2309
2344
|
unhideColumn(e) {
|
|
2310
|
-
const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), r =
|
|
2311
|
-
return this._commandService.syncExecuteCommand(
|
|
2345
|
+
const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), r = K(e.getRange(), this._worksheet);
|
|
2346
|
+
return this._commandService.syncExecuteCommand(Se.id, {
|
|
2312
2347
|
unitId: t,
|
|
2313
2348
|
subUnitId: n,
|
|
2314
2349
|
ranges: [r]
|
|
@@ -2328,7 +2363,7 @@ let g = class extends te {
|
|
|
2328
2363
|
endColumn: e + t - 1,
|
|
2329
2364
|
rangeType: _.COLUMN
|
|
2330
2365
|
};
|
|
2331
|
-
return this._commandService.syncExecuteCommand(
|
|
2366
|
+
return this._commandService.syncExecuteCommand(Se.id, {
|
|
2332
2367
|
unitId: n,
|
|
2333
2368
|
subUnitId: r,
|
|
2334
2369
|
ranges: [o]
|
|
@@ -2359,7 +2394,7 @@ let g = class extends te {
|
|
|
2359
2394
|
endRow: this._worksheet.getRowCount() - 1
|
|
2360
2395
|
}
|
|
2361
2396
|
];
|
|
2362
|
-
return this._commandService.syncExecuteCommand(
|
|
2397
|
+
return this._commandService.syncExecuteCommand(St.id, {
|
|
2363
2398
|
unitId: r,
|
|
2364
2399
|
subUnitId: o,
|
|
2365
2400
|
ranges: i,
|
|
@@ -2383,7 +2418,7 @@ let g = class extends te {
|
|
|
2383
2418
|
subUnitId: n,
|
|
2384
2419
|
columnData: r
|
|
2385
2420
|
};
|
|
2386
|
-
return this._commandService.syncExecuteCommand(
|
|
2421
|
+
return this._commandService.syncExecuteCommand(de.id, o), this;
|
|
2387
2422
|
}
|
|
2388
2423
|
// #region merge cells
|
|
2389
2424
|
/**
|
|
@@ -2431,7 +2466,7 @@ let g = class extends te {
|
|
|
2431
2466
|
* @returns True if the command was successful, false otherwise.
|
|
2432
2467
|
*/
|
|
2433
2468
|
setFreeze(e) {
|
|
2434
|
-
return this._logService.warn("setFreeze is deprecated, use setFrozenRows and setFrozenColumns instead"), this._commandService.syncExecuteCommand(
|
|
2469
|
+
return this._logService.warn("setFreeze is deprecated, use setFrozenRows and setFrozenColumns instead"), this._commandService.syncExecuteCommand(H.id, {
|
|
2435
2470
|
...e,
|
|
2436
2471
|
unitId: this._workbook.getUnitId(),
|
|
2437
2472
|
subUnitId: this.getSheetId()
|
|
@@ -2442,7 +2477,7 @@ let g = class extends te {
|
|
|
2442
2477
|
* @returns True if the command was successful, false otherwise.
|
|
2443
2478
|
*/
|
|
2444
2479
|
cancelFreeze() {
|
|
2445
|
-
return this._commandService.syncExecuteCommand(
|
|
2480
|
+
return this._commandService.syncExecuteCommand(Ct.id, {
|
|
2446
2481
|
unitId: this._workbook.getUnitId(),
|
|
2447
2482
|
subUnitId: this.getSheetId()
|
|
2448
2483
|
}), this;
|
|
@@ -2466,7 +2501,7 @@ let g = class extends te {
|
|
|
2466
2501
|
});
|
|
2467
2502
|
} else if (arguments.length === 2) {
|
|
2468
2503
|
let [n = 0, r = 0] = e;
|
|
2469
|
-
n > r && ([n, r] = [r, n]), this._commandService.syncExecuteCommand(
|
|
2504
|
+
n > r && ([n, r] = [r, n]), this._commandService.syncExecuteCommand(H.id, {
|
|
2470
2505
|
startColumn: r + 1,
|
|
2471
2506
|
xSplit: r - n + 1,
|
|
2472
2507
|
startRow: t.startRow,
|
|
@@ -2488,7 +2523,7 @@ let g = class extends te {
|
|
|
2488
2523
|
});
|
|
2489
2524
|
} else if (arguments.length === 2) {
|
|
2490
2525
|
let [n = 0, r = 0] = e;
|
|
2491
|
-
n > r && ([n, r] = [r, n]), this._commandService.syncExecuteCommand(
|
|
2526
|
+
n > r && ([n, r] = [r, n]), this._commandService.syncExecuteCommand(H.id, {
|
|
2492
2527
|
startRow: r + 1,
|
|
2493
2528
|
ySplit: r - n + 1,
|
|
2494
2529
|
startColumn: t.startColumn,
|
|
@@ -2566,7 +2601,7 @@ let g = class extends te {
|
|
|
2566
2601
|
* ```
|
|
2567
2602
|
*/
|
|
2568
2603
|
setHiddenGridlines(e) {
|
|
2569
|
-
return this._commandService.executeCommand(
|
|
2604
|
+
return this._commandService.executeCommand(It.id, {
|
|
2570
2605
|
unitId: this._workbook.getUnitId(),
|
|
2571
2606
|
subUnitId: this._worksheet.getSheetId(),
|
|
2572
2607
|
showGridlines: e ? m.FALSE : m.TRUE
|
|
@@ -2585,7 +2620,7 @@ let g = class extends te {
|
|
|
2585
2620
|
* ```
|
|
2586
2621
|
*/
|
|
2587
2622
|
setGridLinesColor(e) {
|
|
2588
|
-
return this._commandService.syncExecuteCommand(
|
|
2623
|
+
return this._commandService.syncExecuteCommand(ft.id, {
|
|
2589
2624
|
unitId: this._workbook.getUnitId(),
|
|
2590
2625
|
subUnitId: this._worksheet.getSheetId(),
|
|
2591
2626
|
color: e
|
|
@@ -2611,7 +2646,7 @@ let g = class extends te {
|
|
|
2611
2646
|
* ```
|
|
2612
2647
|
*/
|
|
2613
2648
|
setTabColor(e) {
|
|
2614
|
-
return this._commandService.executeCommand(
|
|
2649
|
+
return this._commandService.executeCommand(vt.id, {
|
|
2615
2650
|
unitId: this._workbook.getUnitId(),
|
|
2616
2651
|
subUnitId: this._worksheet.getSheetId(),
|
|
2617
2652
|
color: e
|
|
@@ -2650,7 +2685,7 @@ let g = class extends te {
|
|
|
2650
2685
|
*/
|
|
2651
2686
|
onCellDataChange(e) {
|
|
2652
2687
|
return this._injector.get(l).onCommandExecuted((n) => {
|
|
2653
|
-
if (n.id ===
|
|
2688
|
+
if (n.id === Ce.id) {
|
|
2654
2689
|
const r = n.params;
|
|
2655
2690
|
r.unitId === this._workbook.getUnitId() && r.subUnitId === this._worksheet.getSheetId() && r.cellValue && e(new A(r.cellValue));
|
|
2656
2691
|
}
|
|
@@ -2674,7 +2709,7 @@ let g = class extends te {
|
|
|
2674
2709
|
*/
|
|
2675
2710
|
onBeforeCellDataChange(e) {
|
|
2676
2711
|
return this._injector.get(l).beforeCommandExecuted((n) => {
|
|
2677
|
-
if (n.id ===
|
|
2712
|
+
if (n.id === Ce.id) {
|
|
2678
2713
|
const r = n.params;
|
|
2679
2714
|
r.unitId === this._workbook.getUnitId() && r.subUnitId === this._worksheet.getSheetId() && r.cellValue && e(new A(r.cellValue));
|
|
2680
2715
|
}
|
|
@@ -2695,7 +2730,7 @@ let g = class extends te {
|
|
|
2695
2730
|
const e = this._injector.get(l);
|
|
2696
2731
|
if (this._workbook.getSheets().filter((o) => o.isSheetHidden() !== m.TRUE).length <= 1)
|
|
2697
2732
|
throw new Error("Cannot hide the only visible sheet");
|
|
2698
|
-
return e.syncExecuteCommand(
|
|
2733
|
+
return e.syncExecuteCommand(Rt.id, {
|
|
2699
2734
|
unitId: this._workbook.getUnitId(),
|
|
2700
2735
|
subUnitId: this._worksheet.getSheetId()
|
|
2701
2736
|
}), this;
|
|
@@ -2712,7 +2747,7 @@ let g = class extends te {
|
|
|
2712
2747
|
* ```
|
|
2713
2748
|
*/
|
|
2714
2749
|
showSheet() {
|
|
2715
|
-
return this._injector.get(l).syncExecuteCommand(
|
|
2750
|
+
return this._injector.get(l).syncExecuteCommand(bt.id, {
|
|
2716
2751
|
unitId: this._workbook.getUnitId(),
|
|
2717
2752
|
subUnitId: this._worksheet.getSheetId()
|
|
2718
2753
|
}), this;
|
|
@@ -2737,7 +2772,7 @@ let g = class extends te {
|
|
|
2737
2772
|
* ```
|
|
2738
2773
|
*/
|
|
2739
2774
|
setName(e) {
|
|
2740
|
-
return this._commandService.syncExecuteCommand(
|
|
2775
|
+
return this._commandService.syncExecuteCommand(pt.id, {
|
|
2741
2776
|
unitId: this._workbook.getUnitId(),
|
|
2742
2777
|
subUnitId: this._worksheet.getSheetId(),
|
|
2743
2778
|
name: e
|
|
@@ -2789,7 +2824,7 @@ let g = class extends te {
|
|
|
2789
2824
|
startColumn: 0,
|
|
2790
2825
|
endColumn: this._worksheet.getColumnCount() - 1
|
|
2791
2826
|
};
|
|
2792
|
-
return r.syncExecuteCommand(
|
|
2827
|
+
return r.syncExecuteCommand(yt.id, {
|
|
2793
2828
|
unitId: t,
|
|
2794
2829
|
subUnitId: n,
|
|
2795
2830
|
ranges: [o],
|
|
@@ -2814,7 +2849,7 @@ let g = class extends te {
|
|
|
2814
2849
|
startColumn: 0,
|
|
2815
2850
|
endColumn: this._worksheet.getColumnCount() - 1
|
|
2816
2851
|
};
|
|
2817
|
-
return n.syncExecuteCommand(
|
|
2852
|
+
return n.syncExecuteCommand(Ut.id, {
|
|
2818
2853
|
unitId: e,
|
|
2819
2854
|
subUnitId: t,
|
|
2820
2855
|
ranges: [r]
|
|
@@ -2838,7 +2873,7 @@ let g = class extends te {
|
|
|
2838
2873
|
startColumn: 0,
|
|
2839
2874
|
endColumn: this._worksheet.getColumnCount() - 1
|
|
2840
2875
|
};
|
|
2841
|
-
return n.syncExecuteCommand(
|
|
2876
|
+
return n.syncExecuteCommand(Et.id, {
|
|
2842
2877
|
unitId: e,
|
|
2843
2878
|
subUnitId: t,
|
|
2844
2879
|
ranges: [r]
|
|
@@ -2948,7 +2983,7 @@ let g = class extends te {
|
|
|
2948
2983
|
* ```
|
|
2949
2984
|
*/
|
|
2950
2985
|
insertDefinedName(e, t) {
|
|
2951
|
-
const r = this._injector.createInstance(
|
|
2986
|
+
const r = this._injector.createInstance(L).setName(e).setRef(t).build();
|
|
2952
2987
|
r.localSheetId = this.getSheetId(), this._fWorkbook.insertDefinedNameBuilder(r);
|
|
2953
2988
|
}
|
|
2954
2989
|
/**
|
|
@@ -3053,26 +3088,72 @@ let g = class extends te {
|
|
|
3053
3088
|
return this._worksheet.getMergeData().map((e) => this._injector.createInstance(w, this._workbook, this._worksheet, e));
|
|
3054
3089
|
}
|
|
3055
3090
|
};
|
|
3056
|
-
g =
|
|
3091
|
+
g = sn([
|
|
3057
3092
|
T(3, u(b)),
|
|
3058
|
-
T(4, u(
|
|
3059
|
-
T(5, u(
|
|
3093
|
+
T(4, u(We)),
|
|
3094
|
+
T(5, u(pe)),
|
|
3060
3095
|
T(6, l)
|
|
3061
3096
|
], g);
|
|
3062
|
-
var
|
|
3063
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
3097
|
+
var rn = Object.defineProperty, on = Object.getOwnPropertyDescriptor, an = (s, e, t, n) => {
|
|
3098
|
+
for (var r = n > 1 ? void 0 : n ? on(e, t) : e, o = s.length - 1, i; o >= 0; o--)
|
|
3064
3099
|
(i = s[o]) && (r = (n ? i(e, t, r) : i(r)) || r);
|
|
3065
|
-
return n && r &&
|
|
3066
|
-
},
|
|
3067
|
-
let
|
|
3100
|
+
return n && r && rn(e, t, r), r;
|
|
3101
|
+
}, C = (s, e) => (t, n) => e(t, n, s);
|
|
3102
|
+
let I = class extends ne {
|
|
3068
3103
|
constructor(e, t, n, r, o, i, a, h, c, d) {
|
|
3069
3104
|
super(t);
|
|
3070
|
-
|
|
3105
|
+
k(this, "id");
|
|
3106
|
+
k(this, "_eventRegistry", /* @__PURE__ */ new Map());
|
|
3071
3107
|
this._workbook = e, this._injector = t, this._resourceLoaderService = n, this._selectionManagerService = r, this._univerInstanceService = o, this._commandService = i, this._permissionService = a, this._logService = h, this._localeService = c, this._definedNamesService = d, this.id = this._workbook.getUnitId();
|
|
3072
3108
|
}
|
|
3073
3109
|
getWorkbook() {
|
|
3074
3110
|
return this._workbook;
|
|
3075
3111
|
}
|
|
3112
|
+
_ensureEventRegistry(e) {
|
|
3113
|
+
return this._eventRegistry.has(e) || this._eventRegistry.set(e, new ye()), this._eventRegistry.get(e);
|
|
3114
|
+
}
|
|
3115
|
+
/**
|
|
3116
|
+
* Add an event listener
|
|
3117
|
+
* @param event key of event
|
|
3118
|
+
* @param callback callback when event triggered
|
|
3119
|
+
* @returns {Disposable} The Disposable instance, for remove the listener
|
|
3120
|
+
* @example
|
|
3121
|
+
* ```ts
|
|
3122
|
+
* univerAPI.addEvent(univerAPI.event.UnitCreated, (params) => {
|
|
3123
|
+
* console.log('unit created', params);
|
|
3124
|
+
* });
|
|
3125
|
+
* ```
|
|
3126
|
+
*/
|
|
3127
|
+
addEvent(e, t) {
|
|
3128
|
+
return this._ensureEventRegistry(e).add(t), this.addUIEvent(e, t), F(() => this._ensureEventRegistry(e).delete(t));
|
|
3129
|
+
}
|
|
3130
|
+
/**
|
|
3131
|
+
* Fire an event, used in internal only.
|
|
3132
|
+
* @param event {string} key of event
|
|
3133
|
+
* @param params {any} params of event
|
|
3134
|
+
* @returns {boolean} should cancel
|
|
3135
|
+
* @example
|
|
3136
|
+
* ```ts
|
|
3137
|
+
* this.fireEvent(univerAPI.event.UnitCreated, params);
|
|
3138
|
+
* ```
|
|
3139
|
+
*/
|
|
3140
|
+
fireEvent(e, t) {
|
|
3141
|
+
var n;
|
|
3142
|
+
return (n = this._eventRegistry.get(e)) == null || n.getData().forEach((r) => {
|
|
3143
|
+
r(t);
|
|
3144
|
+
}), t.cancel;
|
|
3145
|
+
}
|
|
3146
|
+
addUIEvent(e, t) {
|
|
3147
|
+
}
|
|
3148
|
+
get Enum() {
|
|
3149
|
+
return ze.get();
|
|
3150
|
+
}
|
|
3151
|
+
/**
|
|
3152
|
+
* @returns {FEventName} The event name.
|
|
3153
|
+
*/
|
|
3154
|
+
get Event() {
|
|
3155
|
+
return se.get();
|
|
3156
|
+
}
|
|
3076
3157
|
/**
|
|
3077
3158
|
* Get the id of the workbook.
|
|
3078
3159
|
* @returns {string} The id of the workbook.
|
|
@@ -3174,12 +3255,12 @@ let C = class extends te {
|
|
|
3174
3255
|
* ```
|
|
3175
3256
|
*/
|
|
3176
3257
|
create(e, t, n) {
|
|
3177
|
-
const r =
|
|
3258
|
+
const r = $e({});
|
|
3178
3259
|
r.rowCount = t, r.columnCount = n, r.name = e, r.id = e.toLowerCase().replace(/ /g, "-"), this._commandService.syncExecuteCommand(x.id, {
|
|
3179
3260
|
unitId: this.id,
|
|
3180
3261
|
index: this._workbook.getSheets().length,
|
|
3181
3262
|
sheet: r
|
|
3182
|
-
}), this._commandService.syncExecuteCommand(
|
|
3263
|
+
}), this._commandService.syncExecuteCommand(G.id, {
|
|
3183
3264
|
unitId: this.id,
|
|
3184
3265
|
subUnitId: this._workbook.getSheets()[this._workbook.getSheets().length - 1].getSheetId()
|
|
3185
3266
|
});
|
|
@@ -3231,7 +3312,7 @@ let C = class extends te {
|
|
|
3231
3312
|
* ```
|
|
3232
3313
|
*/
|
|
3233
3314
|
setActiveSheet(e) {
|
|
3234
|
-
return this._commandService.syncExecuteCommand(
|
|
3315
|
+
return this._commandService.syncExecuteCommand(G.id, {
|
|
3235
3316
|
unitId: this.id,
|
|
3236
3317
|
subUnitId: e.getSheetId()
|
|
3237
3318
|
}), e;
|
|
@@ -3255,7 +3336,7 @@ let C = class extends te {
|
|
|
3255
3336
|
insertSheet(e) {
|
|
3256
3337
|
e != null ? this._commandService.syncExecuteCommand(x.id, { sheet: { name: e } }) : this._commandService.syncExecuteCommand(x.id);
|
|
3257
3338
|
const t = this.id, n = this._workbook.getSheets()[this._workbook.getSheets().length - 1].getSheetId();
|
|
3258
|
-
this._commandService.syncExecuteCommand(
|
|
3339
|
+
this._commandService.syncExecuteCommand(G.id, {
|
|
3259
3340
|
unitId: t,
|
|
3260
3341
|
subUnitId: n
|
|
3261
3342
|
});
|
|
@@ -3278,7 +3359,7 @@ let C = class extends te {
|
|
|
3278
3359
|
*/
|
|
3279
3360
|
deleteSheet(e) {
|
|
3280
3361
|
const t = this.id, n = e.getSheetId();
|
|
3281
|
-
return this._commandService.syncExecuteCommand(
|
|
3362
|
+
return this._commandService.syncExecuteCommand(Pt.id, {
|
|
3282
3363
|
unitId: t,
|
|
3283
3364
|
subUnitId: n
|
|
3284
3365
|
});
|
|
@@ -3295,7 +3376,7 @@ let C = class extends te {
|
|
|
3295
3376
|
* ```
|
|
3296
3377
|
*/
|
|
3297
3378
|
undo() {
|
|
3298
|
-
return this._univerInstanceService.focusUnit(this.id), this._commandService.syncExecuteCommand(
|
|
3379
|
+
return this._univerInstanceService.focusUnit(this.id), this._commandService.syncExecuteCommand(He.id), this;
|
|
3299
3380
|
}
|
|
3300
3381
|
/**
|
|
3301
3382
|
* Redo the last undone action.
|
|
@@ -3308,7 +3389,7 @@ let C = class extends te {
|
|
|
3308
3389
|
* ```
|
|
3309
3390
|
*/
|
|
3310
3391
|
redo() {
|
|
3311
|
-
return this._univerInstanceService.focusUnit(this.id), this._commandService.syncExecuteCommand(
|
|
3392
|
+
return this._univerInstanceService.focusUnit(this.id), this._commandService.syncExecuteCommand(Ge.id), this;
|
|
3312
3393
|
}
|
|
3313
3394
|
/**
|
|
3314
3395
|
* Callback for command execution.
|
|
@@ -3368,7 +3449,7 @@ let C = class extends te {
|
|
|
3368
3449
|
* @returns A function to dispose the listening
|
|
3369
3450
|
*/
|
|
3370
3451
|
onSelectionChange(e) {
|
|
3371
|
-
return
|
|
3452
|
+
return F(
|
|
3372
3453
|
this._selectionManagerService.selectionMoveEnd$.subscribe((t) => {
|
|
3373
3454
|
this._univerInstanceService.getCurrentUnitForType(R.UNIVER_SHEET).getUnitId() === this.id && (t != null && t.length ? e(t.map((n) => n.range)) : e([]));
|
|
3374
3455
|
})
|
|
@@ -3380,7 +3461,7 @@ let C = class extends te {
|
|
|
3380
3461
|
* @returns {FWorkbook} FWorkbook instance
|
|
3381
3462
|
*/
|
|
3382
3463
|
setEditable(e) {
|
|
3383
|
-
const t = new
|
|
3464
|
+
const t = new Ne(this._workbook.getUnitId());
|
|
3384
3465
|
return this._permissionService.getPermissionPoint(t.id) || this._permissionService.addPermissionPoint(t), this._permissionService.updatePermissionPoint(t.id, e), this;
|
|
3385
3466
|
}
|
|
3386
3467
|
/**
|
|
@@ -3396,9 +3477,9 @@ let C = class extends te {
|
|
|
3396
3477
|
const o = {
|
|
3397
3478
|
unitId: this.getId(),
|
|
3398
3479
|
subUnitId: n,
|
|
3399
|
-
selections: [e].map((i) => ({ range: i.getRange(), primary:
|
|
3480
|
+
selections: [e].map((i) => ({ range: i.getRange(), primary: Z(i.getRange(), r), style: null }))
|
|
3400
3481
|
};
|
|
3401
|
-
return this._commandService.syncExecuteCommand(
|
|
3482
|
+
return this._commandService.syncExecuteCommand(De.id, o), this;
|
|
3402
3483
|
}
|
|
3403
3484
|
/**
|
|
3404
3485
|
* Returns the selected range in the active sheet, or null if there is no active range.
|
|
@@ -3436,7 +3517,7 @@ let C = class extends te {
|
|
|
3436
3517
|
* ```
|
|
3437
3518
|
*/
|
|
3438
3519
|
duplicateSheet(e) {
|
|
3439
|
-
return this._commandService.syncExecuteCommand(
|
|
3520
|
+
return this._commandService.syncExecuteCommand(xt.id, {
|
|
3440
3521
|
unitId: e.getWorkbook().getUnitId(),
|
|
3441
3522
|
subUnitId: e.getSheetId()
|
|
3442
3523
|
}), this._injector.createInstance(g, this, this._workbook, this._workbook.getActiveSheet());
|
|
@@ -3530,7 +3611,7 @@ let C = class extends te {
|
|
|
3530
3611
|
*/
|
|
3531
3612
|
moveSheet(e, t) {
|
|
3532
3613
|
let n = t;
|
|
3533
|
-
return n < 0 ? n = 0 : n > this._workbook.getSheets().length - 1 && (n = this._workbook.getSheets().length - 1), this._commandService.syncExecuteCommand(
|
|
3614
|
+
return n < 0 ? n = 0 : n > this._workbook.getSheets().length - 1 && (n = this._workbook.getSheets().length - 1), this._commandService.syncExecuteCommand(Nt.id, {
|
|
3534
3615
|
unitId: e.getWorkbook().getUnitId(),
|
|
3535
3616
|
order: n,
|
|
3536
3617
|
subUnitId: e.getSheetId()
|
|
@@ -3556,7 +3637,7 @@ let C = class extends te {
|
|
|
3556
3637
|
* @returns {FPermission} - The PermissionInstance.
|
|
3557
3638
|
*/
|
|
3558
3639
|
getPermission() {
|
|
3559
|
-
return this._injector.createInstance(
|
|
3640
|
+
return this._injector.createInstance(O);
|
|
3560
3641
|
}
|
|
3561
3642
|
/**
|
|
3562
3643
|
* Get the defined name by name.
|
|
@@ -3571,7 +3652,7 @@ let C = class extends te {
|
|
|
3571
3652
|
*/
|
|
3572
3653
|
getDefinedName(e) {
|
|
3573
3654
|
const t = this._definedNamesService.getValueByName(this.id, e);
|
|
3574
|
-
return t ? this._injector.createInstance(
|
|
3655
|
+
return t ? this._injector.createInstance(j, { ...t, unitId: this.id }) : null;
|
|
3575
3656
|
}
|
|
3576
3657
|
/**
|
|
3577
3658
|
* Get all the defined names in the workbook.
|
|
@@ -3585,7 +3666,7 @@ let C = class extends te {
|
|
|
3585
3666
|
*/
|
|
3586
3667
|
getDefinedNames() {
|
|
3587
3668
|
const e = this._definedNamesService.getDefinedNameMap(this.id);
|
|
3588
|
-
return e ? Object.values(e).map((t) => this._injector.createInstance(
|
|
3669
|
+
return e ? Object.values(e).map((t) => this._injector.createInstance(j, { ...t, unitId: this.id })) : [];
|
|
3589
3670
|
}
|
|
3590
3671
|
/**
|
|
3591
3672
|
* Insert a defined name.
|
|
@@ -3600,8 +3681,8 @@ let C = class extends te {
|
|
|
3600
3681
|
* ```
|
|
3601
3682
|
*/
|
|
3602
3683
|
insertDefinedName(e, t) {
|
|
3603
|
-
const r = this._injector.createInstance(
|
|
3604
|
-
return r.localSheetId =
|
|
3684
|
+
const r = this._injector.createInstance(L).setName(e).setRef(t).build();
|
|
3685
|
+
return r.localSheetId = X, this.insertDefinedNameBuilder(r), this;
|
|
3605
3686
|
}
|
|
3606
3687
|
/**
|
|
3607
3688
|
* Delete the defined name with the given name.
|
|
@@ -3631,7 +3712,7 @@ let C = class extends te {
|
|
|
3631
3712
|
* ```
|
|
3632
3713
|
*/
|
|
3633
3714
|
insertDefinedNameBuilder(e) {
|
|
3634
|
-
e.unitId = this.getId(), this._commandService.syncExecuteCommand(
|
|
3715
|
+
e.unitId = this.getId(), this._commandService.syncExecuteCommand(Q.id, e);
|
|
3635
3716
|
}
|
|
3636
3717
|
/**
|
|
3637
3718
|
* Update the defined name with the given name.
|
|
@@ -3646,7 +3727,7 @@ let C = class extends te {
|
|
|
3646
3727
|
* ```
|
|
3647
3728
|
*/
|
|
3648
3729
|
updateDefinedNameBuilder(e) {
|
|
3649
|
-
this._commandService.syncExecuteCommand(
|
|
3730
|
+
this._commandService.syncExecuteCommand(Q.id, e);
|
|
3650
3731
|
}
|
|
3651
3732
|
/**
|
|
3652
3733
|
* Gets the registered range themes.
|
|
@@ -3660,7 +3741,7 @@ let C = class extends te {
|
|
|
3660
3741
|
* ```
|
|
3661
3742
|
*/
|
|
3662
3743
|
getRegisteredRangeThemes() {
|
|
3663
|
-
return this._injector.get(
|
|
3744
|
+
return this._injector.get(Me).getRegisteredRangeThemes();
|
|
3664
3745
|
}
|
|
3665
3746
|
/**
|
|
3666
3747
|
* Register a custom range theme style.
|
|
@@ -3679,7 +3760,7 @@ let C = class extends te {
|
|
|
3679
3760
|
* ```
|
|
3680
3761
|
*/
|
|
3681
3762
|
registerRangeTheme(e) {
|
|
3682
|
-
this._commandService.syncExecuteCommand(
|
|
3763
|
+
this._commandService.syncExecuteCommand(Mt.id, {
|
|
3683
3764
|
unitId: this.getId(),
|
|
3684
3765
|
rangeThemeStyle: e
|
|
3685
3766
|
});
|
|
@@ -3694,7 +3775,7 @@ let C = class extends te {
|
|
|
3694
3775
|
* ```
|
|
3695
3776
|
*/
|
|
3696
3777
|
unregisterRangeTheme(e) {
|
|
3697
|
-
this._commandService.syncExecuteCommand(
|
|
3778
|
+
this._commandService.syncExecuteCommand(Dt.id, {
|
|
3698
3779
|
unitId: this.getId(),
|
|
3699
3780
|
themeName: e
|
|
3700
3781
|
});
|
|
@@ -3702,6 +3783,7 @@ let C = class extends te {
|
|
|
3702
3783
|
/**
|
|
3703
3784
|
* Set custom metadata of workbook
|
|
3704
3785
|
* @param {CustomData | undefined} custom custom metadata
|
|
3786
|
+
* @returns {FWorkbook} FWorkbook
|
|
3705
3787
|
* @example
|
|
3706
3788
|
* ```ts
|
|
3707
3789
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
@@ -3724,18 +3806,18 @@ let C = class extends te {
|
|
|
3724
3806
|
return this._workbook.getCustomMetadata();
|
|
3725
3807
|
}
|
|
3726
3808
|
};
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
],
|
|
3738
|
-
class
|
|
3809
|
+
I = an([
|
|
3810
|
+
C(1, u(b)),
|
|
3811
|
+
C(2, u(Le)),
|
|
3812
|
+
C(3, u(We)),
|
|
3813
|
+
C(4, J),
|
|
3814
|
+
C(5, l),
|
|
3815
|
+
C(6, ee),
|
|
3816
|
+
C(7, pe),
|
|
3817
|
+
C(8, u(Re)),
|
|
3818
|
+
C(9, Te)
|
|
3819
|
+
], I);
|
|
3820
|
+
class hn extends Ue {
|
|
3739
3821
|
getCommandSheetTarget(e) {
|
|
3740
3822
|
var o;
|
|
3741
3823
|
const t = e.params;
|
|
@@ -3756,7 +3838,7 @@ class on extends pe {
|
|
|
3756
3838
|
return { workbook: n, worksheet: r };
|
|
3757
3839
|
}
|
|
3758
3840
|
_initWorkbookEvent(e) {
|
|
3759
|
-
const t = e.get(
|
|
3841
|
+
const t = e.get(J);
|
|
3760
3842
|
this.disposeWithMe(
|
|
3761
3843
|
t.unitDisposed$.subscribe((n) => {
|
|
3762
3844
|
this._eventRegistry.get(this.Event.WorkbookDisposed) && n.type === R.UNIVER_SHEET && this.fireEvent(
|
|
@@ -3771,7 +3853,7 @@ class on extends pe {
|
|
|
3771
3853
|
), this.disposeWithMe(
|
|
3772
3854
|
t.unitAdded$.subscribe((n) => {
|
|
3773
3855
|
if (this._eventRegistry.get(this.Event.WorkbookCreated) && n.type === R.UNIVER_SHEET) {
|
|
3774
|
-
const r = n, o = e.createInstance(
|
|
3856
|
+
const r = n, o = e.createInstance(I, r);
|
|
3775
3857
|
this.fireEvent(
|
|
3776
3858
|
this.Event.WorkbookCreated,
|
|
3777
3859
|
{
|
|
@@ -3804,7 +3886,7 @@ class on extends pe {
|
|
|
3804
3886
|
this.Event.BeforeSheetCreate,
|
|
3805
3887
|
d
|
|
3806
3888
|
), d.cancel)
|
|
3807
|
-
throw new
|
|
3889
|
+
throw new qe();
|
|
3808
3890
|
break;
|
|
3809
3891
|
}
|
|
3810
3892
|
}
|
|
@@ -3835,42 +3917,42 @@ class on extends pe {
|
|
|
3835
3917
|
), this._initWorkbookEvent(e);
|
|
3836
3918
|
}
|
|
3837
3919
|
createUniverSheet(e) {
|
|
3838
|
-
const n = this._injector.get(
|
|
3839
|
-
return this._injector.createInstance(
|
|
3920
|
+
const n = this._injector.get(J).createUnit(R.UNIVER_SHEET, e);
|
|
3921
|
+
return this._injector.createInstance(I, n);
|
|
3840
3922
|
}
|
|
3841
3923
|
createWorkbook(e) {
|
|
3842
3924
|
return this.createUniverSheet(e);
|
|
3843
3925
|
}
|
|
3844
3926
|
getActiveWorkbook() {
|
|
3845
3927
|
const e = this._univerInstanceService.getCurrentUnitForType(R.UNIVER_SHEET);
|
|
3846
|
-
return e ? this._injector.createInstance(
|
|
3928
|
+
return e ? this._injector.createInstance(I, e) : null;
|
|
3847
3929
|
}
|
|
3848
3930
|
getActiveUniverSheet() {
|
|
3849
3931
|
return this.getActiveWorkbook();
|
|
3850
3932
|
}
|
|
3851
3933
|
getUniverSheet(e) {
|
|
3852
3934
|
const t = this._univerInstanceService.getUnit(e, R.UNIVER_SHEET);
|
|
3853
|
-
return t ? this._injector.createInstance(
|
|
3935
|
+
return t ? this._injector.createInstance(I, t) : null;
|
|
3854
3936
|
}
|
|
3855
3937
|
getWorkbook(e) {
|
|
3856
3938
|
return this.getUniverSheet(e);
|
|
3857
3939
|
}
|
|
3858
3940
|
getPermission() {
|
|
3859
|
-
return this._injector.createInstance(
|
|
3941
|
+
return this._injector.createInstance(O);
|
|
3860
3942
|
}
|
|
3861
3943
|
onUniverSheetCreated(e) {
|
|
3862
3944
|
const t = this._univerInstanceService.getTypeOfUnitAdded$(R.UNIVER_SHEET).subscribe((n) => {
|
|
3863
|
-
const r = this._injector.createInstance(
|
|
3945
|
+
const r = this._injector.createInstance(I, n);
|
|
3864
3946
|
e(r);
|
|
3865
3947
|
});
|
|
3866
|
-
return
|
|
3948
|
+
return F(t);
|
|
3867
3949
|
}
|
|
3868
3950
|
newDefinedName() {
|
|
3869
|
-
return this._injector.createInstance(
|
|
3951
|
+
return this._injector.createInstance(L);
|
|
3870
3952
|
}
|
|
3871
3953
|
}
|
|
3872
|
-
|
|
3873
|
-
class
|
|
3954
|
+
Ue.extend(hn);
|
|
3955
|
+
class cn extends se {
|
|
3874
3956
|
get SheetCreated() {
|
|
3875
3957
|
return "SheetCreated";
|
|
3876
3958
|
}
|
|
@@ -3884,26 +3966,26 @@ class an extends ye {
|
|
|
3884
3966
|
return "WorkbookDisposed";
|
|
3885
3967
|
}
|
|
3886
3968
|
}
|
|
3887
|
-
|
|
3888
|
-
var
|
|
3889
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
3969
|
+
se.extend(cn);
|
|
3970
|
+
var dn = Object.defineProperty, un = Object.getOwnPropertyDescriptor, mn = (s, e, t, n) => {
|
|
3971
|
+
for (var r = n > 1 ? void 0 : n ? un(e, t) : e, o = s.length - 1, i; o >= 0; o--)
|
|
3890
3972
|
(i = s[o]) && (r = (n ? i(e, t, r) : i(r)) || r);
|
|
3891
|
-
return n && r &&
|
|
3892
|
-
},
|
|
3893
|
-
let
|
|
3973
|
+
return n && r && dn(e, t, r), r;
|
|
3974
|
+
}, ln = (s, e) => (t, n) => e(t, n, s);
|
|
3975
|
+
let fe = class extends te {
|
|
3894
3976
|
constructor(s) {
|
|
3895
3977
|
super(), this._injector = s;
|
|
3896
3978
|
}
|
|
3897
3979
|
};
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
],
|
|
3980
|
+
fe = mn([
|
|
3981
|
+
ln(0, u(b))
|
|
3982
|
+
], fe);
|
|
3901
3983
|
export {
|
|
3902
|
-
|
|
3984
|
+
O as FPermission,
|
|
3903
3985
|
w as FRange,
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3986
|
+
B as FSelection,
|
|
3987
|
+
cn as FSheetEventName,
|
|
3988
|
+
fe as FSheetHooks,
|
|
3989
|
+
I as FWorkbook,
|
|
3908
3990
|
g as FWorksheet
|
|
3909
3991
|
};
|