@univerjs/sheets 0.5.2 → 0.5.3
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 +3 -3
- package/lib/es/facade.js +525 -344
- package/lib/es/index.js +4605 -3763
- package/lib/types/basics/interfaces/mutation-interface.d.ts +7 -0
- package/lib/types/commands/commands/__tests__/range-template-command.sepc.d.ts +16 -0
- package/lib/types/commands/commands/add-worksheet-merge.command.d.ts +1 -1
- package/lib/types/commands/commands/add-worksheet-range-theme.command.d.ts +2 -0
- package/lib/types/commands/commands/delete-worksheet-range-theme.command.d.ts +2 -0
- package/lib/types/commands/commands/insert-row-col.command.d.ts +2 -0
- package/lib/types/commands/commands/register-range-theme.command.d.ts +7 -0
- package/lib/types/commands/commands/remove-row-col.command.d.ts +12 -0
- package/lib/types/commands/commands/unregister-range-theme.command.d.ts +6 -0
- package/lib/types/commands/mutations/add-worksheet-range-theme.mutation.d.ts +9 -0
- package/lib/types/commands/mutations/delete-worksheet-range-theme.mutation.d.ts +9 -0
- package/lib/types/commands/mutations/register-range-theme.mutation.d.ts +8 -0
- package/lib/types/commands/mutations/unregister-range-theme-style.mutation.d.ts +6 -0
- package/lib/types/facade/f-event.d.ts +30 -0
- package/lib/types/facade/f-range.d.ts +56 -15
- package/lib/types/facade/f-selection.d.ts +1 -1
- package/lib/types/facade/f-univer.d.ts +22 -6
- package/lib/types/facade/f-workbook.d.ts +52 -16
- package/lib/types/facade/f-worksheet.d.ts +59 -59
- package/lib/types/facade/index.d.ts +2 -1
- package/lib/types/index.d.ts +15 -3
- package/lib/types/model/range-theme-model.d.ts +66 -0
- package/lib/types/model/range-theme-util.d.ts +97 -0
- package/lib/types/model/range-themes/build-in-theme.factory.d.ts +5 -0
- package/lib/types/model/range-themes/default.d.ts +2 -0
- package/lib/types/services/range-theme-service.d.ts +34 -0
- package/lib/types/services/sheet-interceptor/interceptor-const.d.ts +2 -0
- package/lib/types/services/sheet-interceptor/sheet-interceptor.service.d.ts +5 -3
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +3 -3
- package/package.json +8 -31
package/lib/es/facade.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { Inject as m, Injector as v, IAuthzIoService as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
var
|
|
8
|
-
for (var s = n > 1 ? void 0 : n ?
|
|
1
|
+
var We = Object.defineProperty;
|
|
2
|
+
var Te = (o, e, t) => e in o ? We(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
|
|
3
|
+
var p = (o, e, t) => Te(o, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { Inject as m, Injector as v, IAuthzIoService as Se, LocaleService as ke, ICommandService as l, IPermissionService as J, generateRandomId as Ce, FBase as Q, Rectangle as E, HorizontalAlign as R, VerticalAlign as b, isFormulaString as Me, isCellV as je, isICellData as Ae, ObjectMatrix as T, Tools as Fe, RANGE_TYPE as _, FBaseInitialable as X, BooleanNumber as u, WrapStrategy as ee, Dimension as te, ILogService as Ie, Direction as N, IResourceLoaderService as Oe, mergeWorksheetSnapshotWithDefault as Be, UndoCommand as Le, RedoCommand as ze, toDisposable as fe, UniverInstanceType as P, IUniverInstanceService as ve, FUniver as Re, FEventName as be } from "@univerjs/core";
|
|
5
|
+
import { WorksheetProtectionRuleModel as pe, RangeProtectionRuleModel as ye, WorksheetProtectionPointModel as Pe, SetDefinedNameCommand as G, SCOPE_WORKBOOK_VALUE_DEFINED_NAME as q, RemoveDefinedNameCommand as Ve, PermissionPointsDefinitions as He, WorkbookEditablePermission as Ue, UnitObject as y, AddWorksheetProtectionMutation as $e, DeleteWorksheetProtectionMutation as Ge, getAllWorksheetPermissionPoint as qe, getAllWorksheetPermissionPointByPointPanel as ne, SetWorksheetPermissionPointsMutation as Ke, AddRangeProtectionMutation as Ye, DeleteRangeProtectionMutation as Je, SetRangeProtectionMutation as Qe, WorksheetEditPermission as Xe, WorksheetViewPermission as Ze, SetStyleCommand as C, SetRangeValuesCommand as se, SetTextWrapCommand as oe, SetVerticalTextAlignCommand as et, SetHorizontalTextAlignCommand as tt, addMergeCellsUtil as B, getAddMergeMutationRangeByType as re, RemoveWorksheetMergeCommand as nt, SplitTextToColumnsCommand as st, SetWorksheetRangeThemeStyleCommand as ot, DeleteWorksheetRangeThemeStyleCommand as rt, SheetRangeThemeService as Ee, getPrimaryForRange as K, SetSelectionsOperation as xe, getNextPrimaryCell as it, SheetsSelectionsService as Ne, SetWorksheetDefaultStyleMutation as at, SetColDataCommand as ie, SetRowDataCommand as ae, copyRangeStyles as D, InsertRowByRangeCommand as he, RemoveRowByRangeCommand as ht, MoveRowsCommand as ct, SetRowHiddenCommand as ce, SetSpecificRowsVisibleCommand as de, SetRowHeightCommand as me, SetWorksheetRowIsAutoHeightCommand as dt, InsertColByRangeCommand as ue, RemoveColByRangeCommand as mt, MoveColsCommand as ut, SetColHiddenCommand as le, SetSpecificColsVisibleCommand as ge, SetColWidthCommand as lt, SetFrozenCommand as L, CancelFrozenCommand as gt, ToggleGridlinesCommand as _t, SetGridlinesColorCommand as wt, SetTabColorCommand as St, SetRangeValuesMutation as _e, SetWorksheetHideCommand as kt, SetWorksheetShowCommand as Ct, SetWorksheetNameCommand as It, ClearSelectionAllCommand as ft, ClearSelectionContentCommand as vt, ClearSelectionFormatCommand as Rt, InsertSheetCommand as U, SetWorksheetActiveOperation as z, RemoveSheetCommand as bt, CopySheetCommand as pt, SetWorksheetOrderCommand as yt, RegisterWorksheetRangeThemeStyleCommand as Pt, UnregisterWorksheetRangeThemeStyleCommand as Ut } from "@univerjs/sheets";
|
|
6
|
+
import { IDefinedNamesService as De, serializeRange as Z, FormulaDataModel as Et, serializeRangeWithSheet as xt, deserializeRangeWithSheet as Nt } from "@univerjs/engine-formula";
|
|
7
|
+
var Dt = Object.defineProperty, Wt = Object.getOwnPropertyDescriptor, Tt = (o, e, t, n) => {
|
|
8
|
+
for (var s = n > 1 ? void 0 : n ? Wt(e, t) : e, r = o.length - 1, i; r >= 0; r--)
|
|
9
9
|
(i = o[r]) && (s = (n ? i(e, t, s) : i(s)) || s);
|
|
10
|
-
return n && s &&
|
|
10
|
+
return n && s && Dt(e, t, s), s;
|
|
11
11
|
}, w = (o, e) => (t, n) => e(t, n, o);
|
|
12
|
-
function
|
|
12
|
+
function Mt(o, e, t) {
|
|
13
13
|
const n = t.getDefinedNameMap(o);
|
|
14
14
|
if (n == null)
|
|
15
15
|
return e.t("definedName.defaultName") + 1;
|
|
@@ -24,11 +24,11 @@ function Ut(o, e, t) {
|
|
|
24
24
|
a++;
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
class
|
|
27
|
+
class F {
|
|
28
28
|
constructor() {
|
|
29
|
-
|
|
29
|
+
p(this, "_definedNameParam");
|
|
30
30
|
this._definedNameParam = {
|
|
31
|
-
id:
|
|
31
|
+
id: Ce(10),
|
|
32
32
|
unitId: "",
|
|
33
33
|
name: "",
|
|
34
34
|
formulaOrRefString: ""
|
|
@@ -100,7 +100,7 @@ class A {
|
|
|
100
100
|
* ```
|
|
101
101
|
*/
|
|
102
102
|
setRefByRange(e, t, n, s) {
|
|
103
|
-
return this._definedNameParam.formulaOrRefString =
|
|
103
|
+
return this._definedNameParam.formulaOrRefString = Z({
|
|
104
104
|
startRow: e,
|
|
105
105
|
endRow: e + (n != null ? n : 1) - 1,
|
|
106
106
|
startColumn: t,
|
|
@@ -159,12 +159,12 @@ class A {
|
|
|
159
159
|
return this._definedNameParam = e, this;
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
|
-
let
|
|
162
|
+
let M = class extends Q {
|
|
163
163
|
constructor(o, e, t, n, s, r, i, a, h, c) {
|
|
164
164
|
super(), this._definedNameParam = o, this._injector = e, this._commandService = t, this._permissionService = n, this._worksheetProtectionRuleModel = s, this._rangeProtectionRuleModel = r, 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 = Mt(this._definedNameParam.unitId, this._localeService, this._definedNamesService)), this._commandService.syncExecuteCommand(G.id, this._definedNameParam);
|
|
168
168
|
}
|
|
169
169
|
/**
|
|
170
170
|
* Gets the name of the defined name.
|
|
@@ -245,7 +245,7 @@ let W = class extends p {
|
|
|
245
245
|
* ```
|
|
246
246
|
*/
|
|
247
247
|
setRefByRange(o, e, t, n) {
|
|
248
|
-
this._definedNameParam.formulaOrRefString =
|
|
248
|
+
this._definedNameParam.formulaOrRefString = Z({
|
|
249
249
|
startRow: o,
|
|
250
250
|
endRow: o + (t != null ? t : 1) - 1,
|
|
251
251
|
startColumn: e,
|
|
@@ -302,7 +302,7 @@ let W = class extends p {
|
|
|
302
302
|
* ```
|
|
303
303
|
*/
|
|
304
304
|
setScopeToWorkbook() {
|
|
305
|
-
this._definedNameParam.localSheetId =
|
|
305
|
+
this._definedNameParam.localSheetId = q, this._apply();
|
|
306
306
|
}
|
|
307
307
|
/**
|
|
308
308
|
* Sets the hidden status of the defined name.
|
|
@@ -353,7 +353,7 @@ let W = class extends p {
|
|
|
353
353
|
* ```
|
|
354
354
|
*/
|
|
355
355
|
isWorkbookScope() {
|
|
356
|
-
return this._definedNameParam.localSheetId ===
|
|
356
|
+
return this._definedNameParam.localSheetId === q;
|
|
357
357
|
}
|
|
358
358
|
/**
|
|
359
359
|
* Converts the defined name to a defined name builder.
|
|
@@ -368,30 +368,30 @@ let W = class extends p {
|
|
|
368
368
|
* ```
|
|
369
369
|
*/
|
|
370
370
|
toBuilder() {
|
|
371
|
-
const o = this._injector.createInstance(
|
|
371
|
+
const o = this._injector.createInstance(F);
|
|
372
372
|
return o.load(this._definedNameParam), o;
|
|
373
373
|
}
|
|
374
374
|
};
|
|
375
|
-
|
|
375
|
+
M = Tt([
|
|
376
376
|
w(1, m(v)),
|
|
377
377
|
w(2, l),
|
|
378
|
-
w(3,
|
|
379
|
-
w(4, m(
|
|
380
|
-
w(5, m(
|
|
378
|
+
w(3, J),
|
|
379
|
+
w(4, m(pe)),
|
|
380
|
+
w(5, m(ye)),
|
|
381
381
|
w(6, m(Pe)),
|
|
382
|
-
w(7, m(
|
|
382
|
+
w(7, m(Se)),
|
|
383
383
|
w(8, m(ke)),
|
|
384
|
-
w(9,
|
|
385
|
-
],
|
|
386
|
-
var
|
|
387
|
-
for (var s = n > 1 ? void 0 : n ?
|
|
384
|
+
w(9, De)
|
|
385
|
+
], M);
|
|
386
|
+
var jt = Object.defineProperty, At = Object.getOwnPropertyDescriptor, Ft = (o, e, t, n) => {
|
|
387
|
+
for (var s = n > 1 ? void 0 : n ? At(e, t) : e, r = o.length - 1, i; r >= 0; r--)
|
|
388
388
|
(i = o[r]) && (s = (n ? i(e, t, s) : i(s)) || s);
|
|
389
|
-
return n && s &&
|
|
389
|
+
return n && s && jt(e, t, s), s;
|
|
390
390
|
}, f = (o, e) => (t, n) => e(t, n, o);
|
|
391
|
-
let
|
|
391
|
+
let j = class extends Q {
|
|
392
392
|
constructor(e, t, n, s, r, i, a) {
|
|
393
393
|
super();
|
|
394
|
-
|
|
394
|
+
p(this, "permissionPointsDefinition", He);
|
|
395
395
|
this._injector = e, this._commandService = t, this._permissionService = n, this._worksheetProtectionRuleModel = s, this._rangeProtectionRuleModel = r, this._worksheetProtectionPointRuleModel = i, this._authzIoService = a;
|
|
396
396
|
}
|
|
397
397
|
/**
|
|
@@ -417,7 +417,7 @@ let O = class extends p {
|
|
|
417
417
|
*
|
|
418
418
|
*/
|
|
419
419
|
setWorkbookEditPermission(e, t) {
|
|
420
|
-
this.setWorkbookPermissionPoint(e,
|
|
420
|
+
this.setWorkbookPermissionPoint(e, Ue, t);
|
|
421
421
|
}
|
|
422
422
|
/**
|
|
423
423
|
* This function is used to add a base permission for a worksheet.
|
|
@@ -462,7 +462,7 @@ let O = class extends p {
|
|
|
462
462
|
this._commandService.syncExecuteCommand(Ge.id, {
|
|
463
463
|
unitId: e,
|
|
464
464
|
subUnitId: t
|
|
465
|
-
}), [...qe(), ...
|
|
465
|
+
}), [...qe(), ...ne()].forEach((n) => {
|
|
466
466
|
const s = new n(e, t);
|
|
467
467
|
this._permissionService.updatePermissionPoint(s.id, !0);
|
|
468
468
|
}), this._worksheetProtectionPointRuleModel.deleteRule(e, t);
|
|
@@ -524,10 +524,10 @@ let O = class extends p {
|
|
|
524
524
|
name: "",
|
|
525
525
|
scope: void 0
|
|
526
526
|
}
|
|
527
|
-
}), r = `ruleId_${
|
|
527
|
+
}), r = `ruleId_${Ce(6)}`;
|
|
528
528
|
if (this._worksheetProtectionRuleModel.getRule(e, t))
|
|
529
529
|
throw new Error("sheet protection cannot intersect with range protection");
|
|
530
|
-
if (this._rangeProtectionRuleModel.getSubunitRuleList(e, t).some((d) => d.ranges.some((
|
|
530
|
+
if (this._rangeProtectionRuleModel.getSubunitRuleList(e, t).some((d) => d.ranges.some((O) => n.some((x) => E.intersects(x, O)))))
|
|
531
531
|
throw new Error("range protection cannot intersect");
|
|
532
532
|
if (this._commandService.syncExecuteCommand(Ye.id, {
|
|
533
533
|
unitId: e,
|
|
@@ -558,7 +558,7 @@ let O = class extends p {
|
|
|
558
558
|
unitId: e,
|
|
559
559
|
subUnitId: t,
|
|
560
560
|
ruleIds: n
|
|
561
|
-
}) && this._rangeProtectionRuleModel.getSubunitRuleList(e, t).length === 0 && (this._worksheetProtectionPointRuleModel.deleteRule(e, t), [...
|
|
561
|
+
}) && this._rangeProtectionRuleModel.getSubunitRuleList(e, t).length === 0 && (this._worksheetProtectionPointRuleModel.deleteRule(e, t), [...ne()].forEach((i) => {
|
|
562
562
|
const a = new i(e, t);
|
|
563
563
|
this._permissionService.updatePermissionPoint(a.id, a.value);
|
|
564
564
|
}));
|
|
@@ -592,7 +592,7 @@ let O = class extends p {
|
|
|
592
592
|
setRangeProtectionRanges(e, t, n, s) {
|
|
593
593
|
const r = this._rangeProtectionRuleModel.getRule(e, t, n);
|
|
594
594
|
if (r) {
|
|
595
|
-
if (this._rangeProtectionRuleModel.getSubunitRuleList(e, t).filter((h) => h.id !== n).some((h) => h.ranges.some((c) => s.some((d) =>
|
|
595
|
+
if (this._rangeProtectionRuleModel.getSubunitRuleList(e, t).filter((h) => h.id !== n).some((h) => h.ranges.some((c) => s.some((d) => E.intersects(d, c)))))
|
|
596
596
|
throw new Error("range protection cannot intersect");
|
|
597
597
|
this._commandService.syncExecuteCommand(Qe.id, {
|
|
598
598
|
unitId: e,
|
|
@@ -614,16 +614,16 @@ let O = class extends p {
|
|
|
614
614
|
this._permissionService.setShowComponents(e);
|
|
615
615
|
}
|
|
616
616
|
};
|
|
617
|
-
|
|
617
|
+
j = Ft([
|
|
618
618
|
f(0, m(v)),
|
|
619
619
|
f(1, l),
|
|
620
|
-
f(2,
|
|
621
|
-
f(3, m(
|
|
622
|
-
f(4, m(
|
|
620
|
+
f(2, J),
|
|
621
|
+
f(3, m(pe)),
|
|
622
|
+
f(4, m(ye)),
|
|
623
623
|
f(5, m(Pe)),
|
|
624
|
-
f(6, m(
|
|
625
|
-
],
|
|
626
|
-
function
|
|
624
|
+
f(6, m(Se))
|
|
625
|
+
], j);
|
|
626
|
+
function Ot(o) {
|
|
627
627
|
switch (o) {
|
|
628
628
|
case "left":
|
|
629
629
|
return R.LEFT;
|
|
@@ -635,7 +635,7 @@ function Dt(o) {
|
|
|
635
635
|
throw new Error(`Invalid horizontal alignment: ${o}`);
|
|
636
636
|
}
|
|
637
637
|
}
|
|
638
|
-
function
|
|
638
|
+
function Bt(o) {
|
|
639
639
|
switch (o) {
|
|
640
640
|
case R.LEFT:
|
|
641
641
|
return "left";
|
|
@@ -647,7 +647,7 @@ function Mt(o) {
|
|
|
647
647
|
throw new Error(`Invalid horizontal alignment: ${o}`);
|
|
648
648
|
}
|
|
649
649
|
}
|
|
650
|
-
function
|
|
650
|
+
function Lt(o) {
|
|
651
651
|
switch (o) {
|
|
652
652
|
case "top":
|
|
653
653
|
return b.TOP;
|
|
@@ -659,7 +659,7 @@ function jt(o) {
|
|
|
659
659
|
throw new Error(`Invalid vertical alignment: ${o}`);
|
|
660
660
|
}
|
|
661
661
|
}
|
|
662
|
-
function
|
|
662
|
+
function zt(o) {
|
|
663
663
|
switch (o) {
|
|
664
664
|
case b.TOP:
|
|
665
665
|
return "top";
|
|
@@ -671,51 +671,51 @@ function Wt(o) {
|
|
|
671
671
|
throw new Error(`Invalid vertical alignment: ${o}`);
|
|
672
672
|
}
|
|
673
673
|
}
|
|
674
|
-
function
|
|
675
|
-
return
|
|
674
|
+
function Y(o) {
|
|
675
|
+
return Me(o) ? {
|
|
676
676
|
f: o
|
|
677
|
-
} :
|
|
677
|
+
} : je(o) ? {
|
|
678
678
|
v: o
|
|
679
|
-
} : (
|
|
679
|
+
} : (Ae(o), o);
|
|
680
680
|
}
|
|
681
|
-
function
|
|
682
|
-
const t = new
|
|
683
|
-
if (
|
|
681
|
+
function Vt(o, e) {
|
|
682
|
+
const t = new T(), { startRow: n, startColumn: s, endRow: r, endColumn: i } = e;
|
|
683
|
+
if (Fe.isArray(o))
|
|
684
684
|
for (let a = 0; a <= r - n; a++)
|
|
685
685
|
for (let h = 0; h <= i - s; h++)
|
|
686
|
-
t.setValue(a + n, h + s,
|
|
686
|
+
t.setValue(a + n, h + s, Y(o[a][h]));
|
|
687
687
|
else
|
|
688
|
-
new
|
|
689
|
-
t.setValue(h, c,
|
|
688
|
+
new T(o).forValue((h, c, d) => {
|
|
689
|
+
t.setValue(h, c, Y(d));
|
|
690
690
|
});
|
|
691
691
|
return t.getMatrix();
|
|
692
692
|
}
|
|
693
|
-
function
|
|
693
|
+
function V(o, e) {
|
|
694
694
|
return {
|
|
695
695
|
startRow: o.startRow,
|
|
696
696
|
endRow: o.endRow,
|
|
697
697
|
startColumn: 0,
|
|
698
698
|
endColumn: e.getColumnCount() - 1,
|
|
699
|
-
rangeType:
|
|
699
|
+
rangeType: _.ROW
|
|
700
700
|
};
|
|
701
701
|
}
|
|
702
|
-
function
|
|
702
|
+
function H(o, e) {
|
|
703
703
|
return {
|
|
704
704
|
startRow: 0,
|
|
705
705
|
endRow: e.getRowCount() - 1,
|
|
706
706
|
startColumn: o.startColumn,
|
|
707
707
|
endColumn: o.endColumn,
|
|
708
|
-
rangeType:
|
|
708
|
+
rangeType: _.COLUMN
|
|
709
709
|
};
|
|
710
710
|
}
|
|
711
|
-
var
|
|
712
|
-
for (var s = n > 1 ? void 0 : n ?
|
|
711
|
+
var Ht = Object.defineProperty, $t = Object.getOwnPropertyDescriptor, Gt = (o, e, t, n) => {
|
|
712
|
+
for (var s = n > 1 ? void 0 : n ? $t(e, t) : e, r = o.length - 1, i; r >= 0; r--)
|
|
713
713
|
(i = o[r]) && (s = (n ? i(e, t, s) : i(s)) || s);
|
|
714
|
-
return n && s &&
|
|
715
|
-
},
|
|
716
|
-
let
|
|
714
|
+
return n && s && Ht(e, t, s), s;
|
|
715
|
+
}, $ = (o, e) => (t, n) => e(t, n, o);
|
|
716
|
+
let k = class extends X {
|
|
717
717
|
constructor(o, e, t, n, s, r) {
|
|
718
|
-
super(), this._workbook = o, this._worksheet = e, this._range = t, this._injector = n, this._commandService = s, this._formulaDataModel = r;
|
|
718
|
+
super(n), this._workbook = o, this._worksheet = e, this._range = t, this._injector = n, this._commandService = s, this._formulaDataModel = r;
|
|
719
719
|
}
|
|
720
720
|
/**
|
|
721
721
|
* Get the unit ID of the current workbook
|
|
@@ -787,7 +787,7 @@ let S = class extends p {
|
|
|
787
787
|
*/
|
|
788
788
|
isMerged() {
|
|
789
789
|
const { startColumn: o, startRow: e, endColumn: t, endRow: n } = this._range;
|
|
790
|
-
return this._worksheet.getMergedCellRange(e, o, n, t).some((r) =>
|
|
790
|
+
return this._worksheet.getMergedCellRange(e, o, n, t).some((r) => E.equals(r, this._range));
|
|
791
791
|
}
|
|
792
792
|
/**
|
|
793
793
|
* Return first cell style data in this range
|
|
@@ -859,22 +859,22 @@ let S = class extends p {
|
|
|
859
859
|
return this._worksheet.getRange(this._range).getWrapStrategy();
|
|
860
860
|
}
|
|
861
861
|
getHorizontalAlignment() {
|
|
862
|
-
return
|
|
862
|
+
return Bt(this._worksheet.getRange(this._range).getHorizontalAlignment());
|
|
863
863
|
}
|
|
864
864
|
getVerticalAlignment() {
|
|
865
|
-
return
|
|
865
|
+
return zt(this._worksheet.getRange(this._range).getVerticalAlignment());
|
|
866
866
|
}
|
|
867
867
|
// #region editing
|
|
868
868
|
/**
|
|
869
869
|
* Set background color for current range.
|
|
870
|
+
* @param color {string}
|
|
870
871
|
* @example
|
|
871
872
|
* ```
|
|
872
873
|
* univerAPI.getActiveWorkbook().getActiveSheet().getActiveRange().setBackgroundColor('red')
|
|
873
874
|
* ```
|
|
874
|
-
* @param color {string}
|
|
875
875
|
*/
|
|
876
876
|
setBackgroundColor(o) {
|
|
877
|
-
return this._commandService.
|
|
877
|
+
return this._commandService.syncExecuteCommand(C.id, {
|
|
878
878
|
unitId: this._workbook.getUnitId(),
|
|
879
879
|
subUnitId: this._worksheet.getSheetId(),
|
|
880
880
|
range: this._range,
|
|
@@ -884,88 +884,91 @@ let S = class extends p {
|
|
|
884
884
|
rgb: o
|
|
885
885
|
}
|
|
886
886
|
}
|
|
887
|
-
});
|
|
887
|
+
}), this;
|
|
888
888
|
}
|
|
889
889
|
/**
|
|
890
890
|
* Set background color for current range.
|
|
891
|
-
*
|
|
891
|
+
* @example
|
|
892
|
+
* ```
|
|
893
|
+
* univerAPI.getActiveWorkbook().getActiveSheet().getActiveRange().setBackground('red')
|
|
894
|
+
* ```
|
|
892
895
|
* @param color {string}
|
|
893
896
|
*/
|
|
894
897
|
setBackground(o) {
|
|
895
|
-
return this.setBackgroundColor(o);
|
|
898
|
+
return this.setBackgroundColor(o), this;
|
|
896
899
|
}
|
|
897
900
|
/**
|
|
898
901
|
* 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.
|
|
899
902
|
* @param value
|
|
900
903
|
*/
|
|
901
904
|
setValue(o) {
|
|
902
|
-
const e =
|
|
905
|
+
const e = Y(o);
|
|
903
906
|
if (!e)
|
|
904
907
|
throw new Error("Invalid value");
|
|
905
|
-
return this._commandService.
|
|
908
|
+
return this._commandService.syncExecuteCommand(se.id, {
|
|
906
909
|
unitId: this._workbook.getUnitId(),
|
|
907
910
|
subUnitId: this._worksheet.getSheetId(),
|
|
908
911
|
range: this._range,
|
|
909
912
|
value: e
|
|
910
|
-
});
|
|
913
|
+
}), this;
|
|
911
914
|
}
|
|
912
915
|
/**
|
|
913
916
|
* Set the cell wrap of the given range.
|
|
914
917
|
* Cells with wrap enabled (the default) resize to display their full content. Cells with wrap disabled display as much as possible in the cell without resizing or running to multiple lines.
|
|
915
918
|
*/
|
|
916
919
|
setWrap(o) {
|
|
917
|
-
return this._commandService.
|
|
920
|
+
return this._commandService.syncExecuteCommand(oe.id, {
|
|
918
921
|
unitId: this._workbook.getUnitId(),
|
|
919
922
|
subUnitId: this._worksheet.getSheetId(),
|
|
920
923
|
range: this._range,
|
|
921
|
-
value: o ?
|
|
922
|
-
});
|
|
924
|
+
value: o ? ee.WRAP : ee.UNSPECIFIED
|
|
925
|
+
}), this;
|
|
923
926
|
}
|
|
924
927
|
/**
|
|
925
928
|
* Sets the text wrapping strategy for the cells in the range.
|
|
926
929
|
*/
|
|
927
930
|
setWrapStrategy(o) {
|
|
928
|
-
return this._commandService.
|
|
931
|
+
return this._commandService.syncExecuteCommand(oe.id, {
|
|
929
932
|
unitId: this._workbook.getUnitId(),
|
|
930
933
|
subUnitId: this._worksheet.getSheetId(),
|
|
931
934
|
range: this._range,
|
|
932
935
|
value: o
|
|
933
|
-
});
|
|
936
|
+
}), this;
|
|
934
937
|
}
|
|
935
938
|
/**
|
|
936
939
|
* Set the vertical (top to bottom) alignment for the given range (top/middle/bottom).
|
|
937
940
|
*/
|
|
938
941
|
setVerticalAlignment(o) {
|
|
939
|
-
return this._commandService.
|
|
942
|
+
return this._commandService.syncExecuteCommand(et.id, {
|
|
940
943
|
unitId: this._workbook.getUnitId(),
|
|
941
944
|
subUnitId: this._worksheet.getSheetId(),
|
|
942
945
|
range: this._range,
|
|
943
|
-
value:
|
|
944
|
-
});
|
|
946
|
+
value: Lt(o)
|
|
947
|
+
}), this;
|
|
945
948
|
}
|
|
946
949
|
/**
|
|
947
950
|
* Set the horizontal (left to right) alignment for the given range (left/center/right).
|
|
948
951
|
*/
|
|
949
952
|
setHorizontalAlignment(o) {
|
|
950
|
-
return this._commandService.
|
|
953
|
+
return this._commandService.syncExecuteCommand(tt.id, {
|
|
951
954
|
unitId: this._workbook.getUnitId(),
|
|
952
955
|
subUnitId: this._worksheet.getSheetId(),
|
|
953
956
|
range: this._range,
|
|
954
|
-
value:
|
|
955
|
-
});
|
|
957
|
+
value: Ot(o)
|
|
958
|
+
}), this;
|
|
956
959
|
}
|
|
957
960
|
/**
|
|
958
961
|
* Sets a different value for each cell in the range. The value can be a two-dimensional array or a standard range matrix (must match the dimensions of this range), consisting of numbers, strings, Boolean values or Composed of standard cell formats. If a value begins with `=`, it is interpreted as a formula.
|
|
959
962
|
* @param value
|
|
960
963
|
*/
|
|
961
964
|
setValues(o) {
|
|
962
|
-
const e =
|
|
963
|
-
return this._commandService.
|
|
965
|
+
const e = Vt(o, this._range);
|
|
966
|
+
return this._commandService.syncExecuteCommand(se.id, {
|
|
964
967
|
unitId: this._workbook.getUnitId(),
|
|
965
968
|
subUnitId: this._worksheet.getSheetId(),
|
|
966
969
|
range: this._range,
|
|
967
970
|
value: e
|
|
968
|
-
});
|
|
971
|
+
}), this;
|
|
969
972
|
}
|
|
970
973
|
/**
|
|
971
974
|
* Sets the font weight for the given range (normal/bold),
|
|
@@ -1129,9 +1132,9 @@ let S = class extends p {
|
|
|
1129
1132
|
*
|
|
1130
1133
|
* @returns This range, for chaining
|
|
1131
1134
|
*/
|
|
1132
|
-
|
|
1135
|
+
merge(o = !0) {
|
|
1133
1136
|
const e = this._workbook.getUnitId(), t = this._worksheet.getSheetId();
|
|
1134
|
-
return
|
|
1137
|
+
return B(this._injector, e, t, [this._range], o), this;
|
|
1135
1138
|
}
|
|
1136
1139
|
/**
|
|
1137
1140
|
* Merges cells in a range horizontally.
|
|
@@ -1140,9 +1143,9 @@ let S = class extends p {
|
|
|
1140
1143
|
*
|
|
1141
1144
|
* @returns This range, for chaining
|
|
1142
1145
|
*/
|
|
1143
|
-
|
|
1144
|
-
const e =
|
|
1145
|
-
return
|
|
1146
|
+
mergeAcross(o = !0) {
|
|
1147
|
+
const e = re([this._range], te.ROWS), t = this._workbook.getUnitId(), n = this._worksheet.getSheetId();
|
|
1148
|
+
return B(this._injector, t, n, e, o), this;
|
|
1146
1149
|
}
|
|
1147
1150
|
/**
|
|
1148
1151
|
* Merges cells in a range vertically.
|
|
@@ -1151,9 +1154,9 @@ let S = class extends p {
|
|
|
1151
1154
|
*
|
|
1152
1155
|
* @returns This range, for chaining
|
|
1153
1156
|
*/
|
|
1154
|
-
|
|
1155
|
-
const e =
|
|
1156
|
-
return
|
|
1157
|
+
mergeVertically(o = !0) {
|
|
1158
|
+
const e = re([this._range], te.COLUMNS), t = this._workbook.getUnitId(), n = this._worksheet.getSheetId();
|
|
1159
|
+
return B(this._injector, t, n, e, o), this;
|
|
1157
1160
|
}
|
|
1158
1161
|
/**
|
|
1159
1162
|
* Returns true if cells in the current range overlap a merged cell.
|
|
@@ -1203,7 +1206,7 @@ let S = class extends p {
|
|
|
1203
1206
|
* ```
|
|
1204
1207
|
*/
|
|
1205
1208
|
getA1Notation(o) {
|
|
1206
|
-
return o ?
|
|
1209
|
+
return o ? xt(this._worksheet.getName(), this._range) : Z(this._range);
|
|
1207
1210
|
}
|
|
1208
1211
|
/**
|
|
1209
1212
|
* Sets the specified range as the active range, with the top left cell in the range as the current cell.
|
|
@@ -1228,7 +1231,7 @@ let S = class extends p {
|
|
|
1228
1231
|
*/
|
|
1229
1232
|
activateAsCurrentCell() {
|
|
1230
1233
|
const o = this._worksheet.getMergedCell(this._range.startRow, this._range.startColumn);
|
|
1231
|
-
if (o &&
|
|
1234
|
+
if (o && E.equals(o, this._range) || !o && this._range.startRow === this._range.endRow && this._range.startColumn === this._range.endColumn)
|
|
1232
1235
|
return this.activate();
|
|
1233
1236
|
throw new Error("The range is not a single cell");
|
|
1234
1237
|
}
|
|
@@ -1274,18 +1277,80 @@ let S = class extends p {
|
|
|
1274
1277
|
treatMultipleDelimitersAsOne: o
|
|
1275
1278
|
});
|
|
1276
1279
|
}
|
|
1280
|
+
/**
|
|
1281
|
+
* Set the theme style for the range.
|
|
1282
|
+
* @param {string|undefined} themeName The name of the theme style to apply.If a undefined value is passed, the theme style will be removed if it exist.
|
|
1283
|
+
* @example
|
|
1284
|
+
* ```ts
|
|
1285
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
1286
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
1287
|
+
* const fRange = fWorksheet.getRange('A1:E20');
|
|
1288
|
+
* fRange.useThemeStyle('default');
|
|
1289
|
+
* ```
|
|
1290
|
+
*/
|
|
1291
|
+
useThemeStyle(o) {
|
|
1292
|
+
if (o == null) {
|
|
1293
|
+
const e = this.getUsedThemeStyle();
|
|
1294
|
+
e && this.removeThemeStyle(e);
|
|
1295
|
+
} else
|
|
1296
|
+
this._commandService.executeCommand(ot.id, {
|
|
1297
|
+
unitId: this._workbook.getUnitId(),
|
|
1298
|
+
subUnitId: this._worksheet.getSheetId(),
|
|
1299
|
+
range: this._range,
|
|
1300
|
+
themeName: o
|
|
1301
|
+
});
|
|
1302
|
+
}
|
|
1303
|
+
/**
|
|
1304
|
+
* Remove the theme style for the range.
|
|
1305
|
+
* @param {string} themeName The name of the theme style to remove.
|
|
1306
|
+
* @example
|
|
1307
|
+
* ```ts
|
|
1308
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
1309
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
1310
|
+
* const fRange = fWorksheet.getRange('A1:E20');
|
|
1311
|
+
* fRange.removeThemeStyle('default');
|
|
1312
|
+
* ```
|
|
1313
|
+
*/
|
|
1314
|
+
removeThemeStyle(o) {
|
|
1315
|
+
this._commandService.executeCommand(rt.id, {
|
|
1316
|
+
unitId: this._workbook.getUnitId(),
|
|
1317
|
+
subUnitId: this._worksheet.getSheetId(),
|
|
1318
|
+
range: this._range,
|
|
1319
|
+
themeName: o
|
|
1320
|
+
});
|
|
1321
|
+
}
|
|
1322
|
+
/**
|
|
1323
|
+
* Gets the theme style applied to the range.
|
|
1324
|
+
* @returns {string | undefined} The name of the theme style applied to the range or not exist.
|
|
1325
|
+
* @example
|
|
1326
|
+
* ```ts
|
|
1327
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
1328
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
1329
|
+
* const fRange = fWorksheet.getRange('A1:E20');
|
|
1330
|
+
* fRange.useThemeStyle('default');
|
|
1331
|
+
* const themeStyle = fRange.getUsedThemeStyle();
|
|
1332
|
+
* console.log(themeStyle); // 'default'
|
|
1333
|
+
* ```
|
|
1334
|
+
*/
|
|
1335
|
+
getUsedThemeStyle() {
|
|
1336
|
+
return this._injector.get(Ee).getAppliedRangeThemeStyle({
|
|
1337
|
+
unitId: this._workbook.getUnitId(),
|
|
1338
|
+
subUnitId: this._worksheet.getSheetId(),
|
|
1339
|
+
range: this._range
|
|
1340
|
+
});
|
|
1341
|
+
}
|
|
1277
1342
|
};
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
],
|
|
1283
|
-
var
|
|
1284
|
-
for (var s = n > 1 ? void 0 : n ?
|
|
1343
|
+
k = Gt([
|
|
1344
|
+
$(3, m(v)),
|
|
1345
|
+
$(4, l),
|
|
1346
|
+
$(5, m(Et))
|
|
1347
|
+
], k);
|
|
1348
|
+
var qt = Object.defineProperty, Kt = Object.getOwnPropertyDescriptor, Yt = (o, e, t, n) => {
|
|
1349
|
+
for (var s = n > 1 ? void 0 : n ? Kt(e, t) : e, r = o.length - 1, i; r >= 0; r--)
|
|
1285
1350
|
(i = o[r]) && (s = (n ? i(e, t, s) : i(s)) || s);
|
|
1286
|
-
return n && s &&
|
|
1287
|
-
},
|
|
1288
|
-
let
|
|
1351
|
+
return n && s && qt(e, t, s), s;
|
|
1352
|
+
}, Jt = (o, e) => (t, n) => e(t, n, o);
|
|
1353
|
+
let A = class {
|
|
1289
1354
|
constructor(o, e, t, n) {
|
|
1290
1355
|
this._workbook = o, this._worksheet = e, this._selections = t, this._injector = n;
|
|
1291
1356
|
}
|
|
@@ -1295,14 +1360,14 @@ let F = class {
|
|
|
1295
1360
|
*/
|
|
1296
1361
|
getActiveRange() {
|
|
1297
1362
|
const o = this._selections.find((e) => !!e.primary);
|
|
1298
|
-
return o ? this._injector.createInstance(
|
|
1363
|
+
return o ? this._injector.createInstance(k, this._workbook, this._worksheet, o.range) : null;
|
|
1299
1364
|
}
|
|
1300
1365
|
/**
|
|
1301
1366
|
* Represents the active selection list in the sheet.
|
|
1302
1367
|
* @returns {FRange[]} The active selection list.
|
|
1303
1368
|
*/
|
|
1304
1369
|
getActiveRangeList() {
|
|
1305
|
-
return this._selections.map((o) => this._injector.createInstance(
|
|
1370
|
+
return this._selections.map((o) => this._injector.createInstance(k, this._workbook, this._worksheet, o.range));
|
|
1306
1371
|
}
|
|
1307
1372
|
/**
|
|
1308
1373
|
* Represents the current select cell in the sheet.
|
|
@@ -1326,7 +1391,7 @@ let F = class {
|
|
|
1326
1391
|
*/
|
|
1327
1392
|
getActiveSheet() {
|
|
1328
1393
|
const o = this._injector.createInstance(I, this._workbook);
|
|
1329
|
-
return this._injector.createInstance(
|
|
1394
|
+
return this._injector.createInstance(g, o, this._workbook, this._worksheet);
|
|
1330
1395
|
}
|
|
1331
1396
|
/**
|
|
1332
1397
|
* Update the primary cell in the selection. if the primary cell not exists in selections, add it to the selections and clear the old selections.
|
|
@@ -1342,13 +1407,13 @@ let F = class {
|
|
|
1342
1407
|
* console.log(newSelection.getActiveRange().getA1Notation()); // A1
|
|
1343
1408
|
* ```
|
|
1344
1409
|
*/
|
|
1345
|
-
|
|
1410
|
+
updatePrimaryCell(o) {
|
|
1346
1411
|
const e = this._injector.get(l);
|
|
1347
1412
|
let t = [], n = !1;
|
|
1348
1413
|
for (const { range: r, style: i } of this._selections)
|
|
1349
|
-
|
|
1414
|
+
E.contains(r, o.getRange()) ? (t.push({
|
|
1350
1415
|
range: r,
|
|
1351
|
-
primary:
|
|
1416
|
+
primary: K(o.getRange(), this._worksheet),
|
|
1352
1417
|
style: i
|
|
1353
1418
|
}), n = !0) : t.push({
|
|
1354
1419
|
range: r,
|
|
@@ -1358,7 +1423,7 @@ let F = class {
|
|
|
1358
1423
|
n || (t = [
|
|
1359
1424
|
{
|
|
1360
1425
|
range: o.getRange(),
|
|
1361
|
-
primary:
|
|
1426
|
+
primary: K(o.getRange(), this._worksheet)
|
|
1362
1427
|
}
|
|
1363
1428
|
]);
|
|
1364
1429
|
const s = {
|
|
@@ -1366,7 +1431,7 @@ let F = class {
|
|
|
1366
1431
|
subUnitId: this._worksheet.getSheetId(),
|
|
1367
1432
|
selections: t
|
|
1368
1433
|
};
|
|
1369
|
-
return
|
|
1434
|
+
return e.syncExecuteCommand(xe.id, s), new A(this._workbook, this._worksheet, t, this._injector);
|
|
1370
1435
|
}
|
|
1371
1436
|
/**
|
|
1372
1437
|
*Get the next primary cell in the specified direction. If the primary cell not exists in selections, return null.
|
|
@@ -1386,26 +1451,26 @@ let F = class {
|
|
|
1386
1451
|
getNextDataRange(o) {
|
|
1387
1452
|
if (!this._selections.find((n) => !!n.primary))
|
|
1388
1453
|
return null;
|
|
1389
|
-
const t =
|
|
1390
|
-
return t ? this._injector.createInstance(
|
|
1454
|
+
const t = it(this._selections.concat(), o, this._worksheet);
|
|
1455
|
+
return t ? this._injector.createInstance(k, this._workbook, this._worksheet, t) : null;
|
|
1391
1456
|
}
|
|
1392
1457
|
};
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
],
|
|
1396
|
-
var
|
|
1397
|
-
for (var s = n > 1 ? void 0 : n ?
|
|
1458
|
+
A = Yt([
|
|
1459
|
+
Jt(3, m(v))
|
|
1460
|
+
], A);
|
|
1461
|
+
var Qt = Object.defineProperty, Xt = Object.getOwnPropertyDescriptor, Zt = (o, e, t, n) => {
|
|
1462
|
+
for (var s = n > 1 ? void 0 : n ? Xt(e, t) : e, r = o.length - 1, i; r >= 0; r--)
|
|
1398
1463
|
(i = o[r]) && (s = (n ? i(e, t, s) : i(s)) || s);
|
|
1399
|
-
return n && s &&
|
|
1400
|
-
},
|
|
1401
|
-
let
|
|
1464
|
+
return n && s && Qt(e, t, s), s;
|
|
1465
|
+
}, W = (o, e) => (t, n) => e(t, n, o);
|
|
1466
|
+
let g = class extends X {
|
|
1402
1467
|
constructor(e, t, n, s, r, i, a) {
|
|
1403
|
-
super();
|
|
1468
|
+
super(s);
|
|
1404
1469
|
/**
|
|
1405
1470
|
* Sets the active selection region for this sheet.
|
|
1406
1471
|
* @param range The range to set as the active selection.
|
|
1407
1472
|
*/
|
|
1408
|
-
|
|
1473
|
+
p(this, "setActiveSelection", this.setActiveRange);
|
|
1409
1474
|
this._fWorkbook = e, this._workbook = t, this._worksheet = n, this._injector = s, this._selectionManagerService = r, this._logService = i, this._commandService = a;
|
|
1410
1475
|
}
|
|
1411
1476
|
/**
|
|
@@ -1442,7 +1507,7 @@ let _ = class extends p {
|
|
|
1442
1507
|
*/
|
|
1443
1508
|
getSelection() {
|
|
1444
1509
|
const e = this._selectionManagerService.getCurrentSelections();
|
|
1445
|
-
return e ? this._injector.createInstance(
|
|
1510
|
+
return e ? this._injector.createInstance(A, this._workbook, this._worksheet, e) : null;
|
|
1446
1511
|
}
|
|
1447
1512
|
// #region rows
|
|
1448
1513
|
// #region default style
|
|
@@ -1474,11 +1539,11 @@ let _ = class extends p {
|
|
|
1474
1539
|
/**
|
|
1475
1540
|
* Set the default style of the worksheet
|
|
1476
1541
|
* @param {StyleDataInfo} style default style
|
|
1477
|
-
* @returns {
|
|
1542
|
+
* @returns {FWorksheet} This sheet, for chaining.
|
|
1478
1543
|
*/
|
|
1479
|
-
|
|
1544
|
+
setDefaultStyle(e) {
|
|
1480
1545
|
const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId();
|
|
1481
|
-
return
|
|
1546
|
+
return this._commandService.syncExecuteCommand(at.id, {
|
|
1482
1547
|
unitId: t,
|
|
1483
1548
|
subUnitId: n,
|
|
1484
1549
|
defaultStyle: e
|
|
@@ -1488,9 +1553,9 @@ let _ = class extends p {
|
|
|
1488
1553
|
* Set the default style of the worksheet row
|
|
1489
1554
|
* @param {number} index The row index
|
|
1490
1555
|
* @param {string | Nullable<IStyleData>} style The style name or style data
|
|
1491
|
-
* @returns {
|
|
1556
|
+
* @returns {FWorksheet} This sheet, for chaining.
|
|
1492
1557
|
*/
|
|
1493
|
-
|
|
1558
|
+
setColumnDefaultStyle(e, t) {
|
|
1494
1559
|
const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), r = {
|
|
1495
1560
|
unitId: n,
|
|
1496
1561
|
subUnitId: s,
|
|
@@ -1500,15 +1565,15 @@ let _ = class extends p {
|
|
|
1500
1565
|
}
|
|
1501
1566
|
}
|
|
1502
1567
|
};
|
|
1503
|
-
return
|
|
1568
|
+
return this._commandService.syncExecuteCommand(ie.id, r), this;
|
|
1504
1569
|
}
|
|
1505
1570
|
/**
|
|
1506
1571
|
* Set the default style of the worksheet column
|
|
1507
1572
|
* @param {number} index The column index
|
|
1508
1573
|
* @param {string | Nullable<IStyleData>} style The style name or style data
|
|
1509
|
-
* @returns {
|
|
1574
|
+
* @returns {FWorksheet} This sheet, for chaining.
|
|
1510
1575
|
*/
|
|
1511
|
-
|
|
1576
|
+
setRowDefaultStyle(e, t) {
|
|
1512
1577
|
const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), r = {
|
|
1513
1578
|
unitId: n,
|
|
1514
1579
|
subUnitId: s,
|
|
@@ -1518,12 +1583,12 @@ let _ = class extends p {
|
|
|
1518
1583
|
}
|
|
1519
1584
|
}
|
|
1520
1585
|
};
|
|
1521
|
-
return
|
|
1586
|
+
return this._commandService.syncExecuteCommand(ae.id, r), this;
|
|
1522
1587
|
}
|
|
1523
1588
|
getRange(e, t, n, s) {
|
|
1524
1589
|
let r, i;
|
|
1525
1590
|
if (typeof e == "string") {
|
|
1526
|
-
const { range: a, sheetName: h } =
|
|
1591
|
+
const { range: a, sheetName: h } = Nt(e), c = h ? this._workbook.getSheetBySheetName(h) : this._worksheet;
|
|
1527
1592
|
if (!c)
|
|
1528
1593
|
throw new Error("Range not found");
|
|
1529
1594
|
i = c, r = {
|
|
@@ -1532,11 +1597,11 @@ let _ = class extends p {
|
|
|
1532
1597
|
sheetId: i.getSheetId(),
|
|
1533
1598
|
// Use the current range instead of the future actual range to match Apps Script behavior.
|
|
1534
1599
|
// Users can create the latest range in real time when needed.
|
|
1535
|
-
rangeType:
|
|
1536
|
-
startRow: a.rangeType ===
|
|
1537
|
-
endRow: a.rangeType ===
|
|
1538
|
-
startColumn: a.rangeType ===
|
|
1539
|
-
endColumn: a.rangeType ===
|
|
1600
|
+
rangeType: _.NORMAL,
|
|
1601
|
+
startRow: a.rangeType === _.COLUMN ? 0 : a.startRow,
|
|
1602
|
+
endRow: a.rangeType === _.COLUMN ? i.getMaxRows() - 1 : a.endRow,
|
|
1603
|
+
startColumn: a.rangeType === _.ROW ? 0 : a.startColumn,
|
|
1604
|
+
endColumn: a.rangeType === _.ROW ? i.getMaxColumns() - 1 : a.endColumn
|
|
1540
1605
|
};
|
|
1541
1606
|
} else if (typeof e == "number" && t !== void 0)
|
|
1542
1607
|
i = this._worksheet, r = {
|
|
@@ -1549,7 +1614,7 @@ let _ = class extends p {
|
|
|
1549
1614
|
};
|
|
1550
1615
|
else
|
|
1551
1616
|
throw new Error("Invalid range specification");
|
|
1552
|
-
return this._injector.createInstance(
|
|
1617
|
+
return this._injector.createInstance(k, this._workbook, i, r);
|
|
1553
1618
|
}
|
|
1554
1619
|
/**
|
|
1555
1620
|
* Returns the current number of columns in the sheet, regardless of content.
|
|
@@ -1570,7 +1635,7 @@ let _ = class extends p {
|
|
|
1570
1635
|
* @param afterPosition The row after which the new row should be added, starting at 0 for the first row.
|
|
1571
1636
|
* @returns This sheet, for chaining.
|
|
1572
1637
|
*/
|
|
1573
|
-
|
|
1638
|
+
insertRowAfter(e) {
|
|
1574
1639
|
return this.insertRowsAfter(e, 1);
|
|
1575
1640
|
}
|
|
1576
1641
|
/**
|
|
@@ -1578,7 +1643,7 @@ let _ = class extends p {
|
|
|
1578
1643
|
* @param beforePosition The row before which the new row should be added, starting at 0 for the first row.
|
|
1579
1644
|
* @returns This sheet, for chaining.
|
|
1580
1645
|
*/
|
|
1581
|
-
|
|
1646
|
+
insertRowBefore(e) {
|
|
1582
1647
|
return this.insertRowsBefore(e, 1);
|
|
1583
1648
|
}
|
|
1584
1649
|
/**
|
|
@@ -1587,7 +1652,7 @@ let _ = class extends p {
|
|
|
1587
1652
|
* @param numRows The number of rows to insert.
|
|
1588
1653
|
* @returns This sheet, for chaining.
|
|
1589
1654
|
*/
|
|
1590
|
-
|
|
1655
|
+
insertRows(e, t = 1) {
|
|
1591
1656
|
return this.insertRowsBefore(e, t);
|
|
1592
1657
|
}
|
|
1593
1658
|
/**
|
|
@@ -1596,9 +1661,9 @@ let _ = class extends p {
|
|
|
1596
1661
|
* @param howMany The number of rows to insert.
|
|
1597
1662
|
* @returns This sheet, for chaining.
|
|
1598
1663
|
*/
|
|
1599
|
-
|
|
1600
|
-
const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), r =
|
|
1601
|
-
return
|
|
1664
|
+
insertRowsAfter(e, t) {
|
|
1665
|
+
const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), r = N.DOWN, i = e + 1, a = e + t, h = 0, c = this._worksheet.getColumnCount() - 1, d = D(this._worksheet, i, a, h, c, !0, e);
|
|
1666
|
+
return this._commandService.syncExecuteCommand(he.id, {
|
|
1602
1667
|
unitId: n,
|
|
1603
1668
|
subUnitId: s,
|
|
1604
1669
|
direction: r,
|
|
@@ -1617,9 +1682,9 @@ let _ = class extends p {
|
|
|
1617
1682
|
* @param howMany The number of rows to insert.
|
|
1618
1683
|
* @returns This sheet, for chaining.
|
|
1619
1684
|
*/
|
|
1620
|
-
|
|
1621
|
-
const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), r =
|
|
1622
|
-
return
|
|
1685
|
+
insertRowsBefore(e, t) {
|
|
1686
|
+
const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), r = N.UP, i = e, a = e + t - 1, h = 0, c = this._worksheet.getColumnCount() - 1, d = D(this._worksheet, i, a, h, c, !0, e - 1);
|
|
1687
|
+
return this._commandService.syncExecuteCommand(he.id, {
|
|
1623
1688
|
unitId: n,
|
|
1624
1689
|
subUnitId: s,
|
|
1625
1690
|
direction: r,
|
|
@@ -1637,7 +1702,7 @@ let _ = class extends p {
|
|
|
1637
1702
|
* @param rowPosition The position of the row, starting at 0 for the first row.
|
|
1638
1703
|
* @returns This sheet, for chaining.
|
|
1639
1704
|
*/
|
|
1640
|
-
|
|
1705
|
+
deleteRow(e) {
|
|
1641
1706
|
return this.deleteRows(e, 1);
|
|
1642
1707
|
}
|
|
1643
1708
|
/**
|
|
@@ -1646,15 +1711,17 @@ let _ = class extends p {
|
|
|
1646
1711
|
* @param howMany The number of rows to delete.
|
|
1647
1712
|
* @returns This sheet, for chaining.
|
|
1648
1713
|
*/
|
|
1649
|
-
|
|
1714
|
+
deleteRows(e, t) {
|
|
1650
1715
|
const n = {
|
|
1651
1716
|
startRow: e,
|
|
1652
1717
|
endRow: e + t - 1,
|
|
1653
1718
|
startColumn: 0,
|
|
1654
1719
|
endColumn: this._worksheet.getColumnCount() - 1
|
|
1655
1720
|
};
|
|
1656
|
-
return
|
|
1657
|
-
range: n
|
|
1721
|
+
return this._commandService.syncExecuteCommand(ht.id, {
|
|
1722
|
+
range: n,
|
|
1723
|
+
unitId: this._workbook.getUnitId(),
|
|
1724
|
+
subUnitId: this._worksheet.getSheetId()
|
|
1658
1725
|
}), this;
|
|
1659
1726
|
}
|
|
1660
1727
|
/**
|
|
@@ -1663,14 +1730,14 @@ let _ = class extends p {
|
|
|
1663
1730
|
* @param destinationIndex The index that the rows should be moved to. Note that this index is based on the coordinates before the rows are moved. Existing data is shifted down to make room for the moved rows while the source rows are removed from the grid. Therefore, the data may end up at a different index than originally specified. Use 0-index for this method.
|
|
1664
1731
|
* @returns This sheet, for chaining.
|
|
1665
1732
|
*/
|
|
1666
|
-
|
|
1667
|
-
const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), r =
|
|
1733
|
+
moveRows(e, t) {
|
|
1734
|
+
const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), r = V(e.getRange(), this._worksheet), i = r, a = {
|
|
1668
1735
|
startRow: t,
|
|
1669
1736
|
endRow: t,
|
|
1670
1737
|
startColumn: r.startColumn,
|
|
1671
1738
|
endColumn: r.endColumn
|
|
1672
1739
|
};
|
|
1673
|
-
return
|
|
1740
|
+
return this._commandService.syncExecuteCommand(ct.id, {
|
|
1674
1741
|
unitId: n,
|
|
1675
1742
|
subUnitId: s,
|
|
1676
1743
|
range: r,
|
|
@@ -1683,9 +1750,9 @@ let _ = class extends p {
|
|
|
1683
1750
|
* @param row The row range to hide.
|
|
1684
1751
|
* @returns This sheet, for chaining.
|
|
1685
1752
|
*/
|
|
1686
|
-
|
|
1687
|
-
const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), s =
|
|
1688
|
-
return
|
|
1753
|
+
hideRow(e) {
|
|
1754
|
+
const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), s = V(e.getRange(), this._worksheet);
|
|
1755
|
+
return this._commandService.syncExecuteCommand(ce.id, {
|
|
1689
1756
|
unitId: t,
|
|
1690
1757
|
subUnitId: n,
|
|
1691
1758
|
ranges: [s]
|
|
@@ -1697,15 +1764,15 @@ let _ = class extends p {
|
|
|
1697
1764
|
* @param numRows The number of rows to hide.
|
|
1698
1765
|
* @returns This sheet, for chaining.
|
|
1699
1766
|
*/
|
|
1700
|
-
|
|
1767
|
+
hideRows(e, t = 1) {
|
|
1701
1768
|
const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), r = {
|
|
1702
1769
|
startRow: e,
|
|
1703
1770
|
endRow: e + t - 1,
|
|
1704
1771
|
startColumn: 0,
|
|
1705
1772
|
endColumn: this._worksheet.getColumnCount() - 1,
|
|
1706
|
-
rangeType:
|
|
1773
|
+
rangeType: _.ROW
|
|
1707
1774
|
};
|
|
1708
|
-
return
|
|
1775
|
+
return this._commandService.syncExecuteCommand(ce.id, {
|
|
1709
1776
|
unitId: n,
|
|
1710
1777
|
subUnitId: s,
|
|
1711
1778
|
ranges: [r]
|
|
@@ -1716,9 +1783,9 @@ let _ = class extends p {
|
|
|
1716
1783
|
* @param row The range to unhide, if hidden.
|
|
1717
1784
|
* @returns This sheet, for chaining.
|
|
1718
1785
|
*/
|
|
1719
|
-
|
|
1720
|
-
const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), s =
|
|
1721
|
-
return
|
|
1786
|
+
unhideRow(e) {
|
|
1787
|
+
const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), s = V(e.getRange(), this._worksheet);
|
|
1788
|
+
return this._commandService.syncExecuteCommand(de.id, {
|
|
1722
1789
|
unitId: t,
|
|
1723
1790
|
subUnitId: n,
|
|
1724
1791
|
ranges: [s]
|
|
@@ -1730,15 +1797,15 @@ let _ = class extends p {
|
|
|
1730
1797
|
* @param numRows The number of rows to unhide.
|
|
1731
1798
|
* @returns This sheet, for chaining.
|
|
1732
1799
|
*/
|
|
1733
|
-
|
|
1800
|
+
showRows(e, t = 1) {
|
|
1734
1801
|
const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), r = {
|
|
1735
1802
|
startRow: e,
|
|
1736
1803
|
endRow: e + t - 1,
|
|
1737
1804
|
startColumn: 0,
|
|
1738
1805
|
endColumn: this._worksheet.getColumnCount() - 1,
|
|
1739
|
-
rangeType:
|
|
1806
|
+
rangeType: _.ROW
|
|
1740
1807
|
};
|
|
1741
|
-
return
|
|
1808
|
+
return this._commandService.syncExecuteCommand(de.id, {
|
|
1742
1809
|
unitId: n,
|
|
1743
1810
|
subUnitId: s,
|
|
1744
1811
|
ranges: [r]
|
|
@@ -1750,7 +1817,7 @@ let _ = class extends p {
|
|
|
1750
1817
|
* @param height The height in pixels to set it to.
|
|
1751
1818
|
* @returns This sheet, for chaining.
|
|
1752
1819
|
*/
|
|
1753
|
-
|
|
1820
|
+
setRowHeight(e, t) {
|
|
1754
1821
|
return this.setRowHeights(e, 1, t);
|
|
1755
1822
|
}
|
|
1756
1823
|
/**
|
|
@@ -1760,24 +1827,24 @@ let _ = class extends p {
|
|
|
1760
1827
|
* @param height The height in pixels to set it to.
|
|
1761
1828
|
* @returns This sheet, for chaining.
|
|
1762
1829
|
*/
|
|
1763
|
-
|
|
1830
|
+
setRowHeights(e, t, n) {
|
|
1764
1831
|
var c;
|
|
1765
1832
|
const s = this._workbook.getUnitId(), r = this._worksheet.getSheetId(), i = this._worksheet.getRowManager(), a = [], h = [];
|
|
1766
1833
|
for (let d = e; d < e + t; d++) {
|
|
1767
|
-
const
|
|
1834
|
+
const O = ((c = i.getRow(d)) == null ? void 0 : c.ah) || this._worksheet.getConfig().defaultRowHeight, x = {
|
|
1768
1835
|
startRow: d,
|
|
1769
1836
|
endRow: d,
|
|
1770
1837
|
startColumn: 0,
|
|
1771
1838
|
endColumn: this._worksheet.getColumnCount() - 1
|
|
1772
1839
|
};
|
|
1773
|
-
n <=
|
|
1840
|
+
n <= O ? a.push(x) : h.push(x);
|
|
1774
1841
|
}
|
|
1775
|
-
return h.length > 0 &&
|
|
1842
|
+
return h.length > 0 && this._commandService.syncExecuteCommand(me.id, {
|
|
1776
1843
|
unitId: s,
|
|
1777
1844
|
subUnitId: r,
|
|
1778
1845
|
ranges: h,
|
|
1779
1846
|
value: n
|
|
1780
|
-
}), a.length > 0 &&
|
|
1847
|
+
}), a.length > 0 && this._commandService.syncExecuteCommand(dt.id, {
|
|
1781
1848
|
unitId: s,
|
|
1782
1849
|
subUnitId: r,
|
|
1783
1850
|
ranges: a
|
|
@@ -1790,7 +1857,7 @@ let _ = class extends p {
|
|
|
1790
1857
|
* @param height The height in pixels to set it to.
|
|
1791
1858
|
* @returns This sheet, for chaining.
|
|
1792
1859
|
*/
|
|
1793
|
-
|
|
1860
|
+
setRowHeightsForced(e, t, n) {
|
|
1794
1861
|
const s = this._workbook.getUnitId(), r = this._worksheet.getSheetId(), i = [
|
|
1795
1862
|
{
|
|
1796
1863
|
startRow: e,
|
|
@@ -1799,7 +1866,7 @@ let _ = class extends p {
|
|
|
1799
1866
|
endColumn: this._worksheet.getColumnCount() - 1
|
|
1800
1867
|
}
|
|
1801
1868
|
];
|
|
1802
|
-
return
|
|
1869
|
+
return this._commandService.syncExecuteCommand(me.id, {
|
|
1803
1870
|
unitId: s,
|
|
1804
1871
|
subUnitId: r,
|
|
1805
1872
|
ranges: i,
|
|
@@ -1812,7 +1879,7 @@ let _ = class extends p {
|
|
|
1812
1879
|
* @param custom The custom properties to set.
|
|
1813
1880
|
* @returns This sheet, for chaining.
|
|
1814
1881
|
*/
|
|
1815
|
-
|
|
1882
|
+
setRowCustom(e) {
|
|
1816
1883
|
const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), s = {};
|
|
1817
1884
|
for (const [i, a] of Object.entries(e))
|
|
1818
1885
|
s[Number(i)] = {
|
|
@@ -1823,7 +1890,7 @@ let _ = class extends p {
|
|
|
1823
1890
|
subUnitId: n,
|
|
1824
1891
|
rowData: s
|
|
1825
1892
|
};
|
|
1826
|
-
return
|
|
1893
|
+
return this._commandService.syncExecuteCommand(ae.id, r), this;
|
|
1827
1894
|
}
|
|
1828
1895
|
// #region Column
|
|
1829
1896
|
/**
|
|
@@ -1831,7 +1898,7 @@ let _ = class extends p {
|
|
|
1831
1898
|
* @param afterPosition The column after which the new column should be added, starting at 0 for the first column.
|
|
1832
1899
|
* @returns This sheet, for chaining.
|
|
1833
1900
|
*/
|
|
1834
|
-
|
|
1901
|
+
insertColumnAfter(e) {
|
|
1835
1902
|
return this.insertColumnsAfter(e, 1);
|
|
1836
1903
|
}
|
|
1837
1904
|
/**
|
|
@@ -1839,7 +1906,7 @@ let _ = class extends p {
|
|
|
1839
1906
|
* @param beforePosition The column before which the new column should be added, starting at 0 for the first column.
|
|
1840
1907
|
* @returns This sheet, for chaining.
|
|
1841
1908
|
*/
|
|
1842
|
-
|
|
1909
|
+
insertColumnBefore(e) {
|
|
1843
1910
|
return this.insertColumnsBefore(e, 1);
|
|
1844
1911
|
}
|
|
1845
1912
|
/**
|
|
@@ -1848,7 +1915,7 @@ let _ = class extends p {
|
|
|
1848
1915
|
* @param numColumns The number of columns to insert.
|
|
1849
1916
|
* @returns This sheet, for chaining.
|
|
1850
1917
|
*/
|
|
1851
|
-
|
|
1918
|
+
insertColumns(e, t = 1) {
|
|
1852
1919
|
return this.insertColumnsBefore(e, t);
|
|
1853
1920
|
}
|
|
1854
1921
|
/**
|
|
@@ -1857,9 +1924,9 @@ let _ = class extends p {
|
|
|
1857
1924
|
* @param howMany The number of columns to insert.
|
|
1858
1925
|
* @returns This sheet, for chaining.
|
|
1859
1926
|
*/
|
|
1860
|
-
|
|
1861
|
-
const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), r =
|
|
1862
|
-
return
|
|
1927
|
+
insertColumnsAfter(e, t) {
|
|
1928
|
+
const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), r = N.RIGHT, i = 0, a = this._worksheet.getRowCount() - 1, h = e + 1, c = e + t, d = D(this._worksheet, i, a, h, c, !1, e);
|
|
1929
|
+
return this._commandService.syncExecuteCommand(ue.id, {
|
|
1863
1930
|
unitId: n,
|
|
1864
1931
|
subUnitId: s,
|
|
1865
1932
|
direction: r,
|
|
@@ -1878,9 +1945,9 @@ let _ = class extends p {
|
|
|
1878
1945
|
* @param howMany The number of columns to insert.
|
|
1879
1946
|
* @returns This sheet, for chaining.
|
|
1880
1947
|
*/
|
|
1881
|
-
|
|
1882
|
-
const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), r =
|
|
1883
|
-
return
|
|
1948
|
+
insertColumnsBefore(e, t) {
|
|
1949
|
+
const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), r = N.LEFT, i = 0, a = this._worksheet.getRowCount() - 1, h = e, c = e + t - 1, d = D(this._worksheet, i, a, h, c, !1, e - 1);
|
|
1950
|
+
return this._commandService.syncExecuteCommand(ue.id, {
|
|
1884
1951
|
unitId: n,
|
|
1885
1952
|
subUnitId: s,
|
|
1886
1953
|
direction: r,
|
|
@@ -1898,7 +1965,7 @@ let _ = class extends p {
|
|
|
1898
1965
|
* @param columnPosition The position of the column, starting at 0 for the first column.
|
|
1899
1966
|
* @returns This sheet, for chaining.
|
|
1900
1967
|
*/
|
|
1901
|
-
|
|
1968
|
+
deleteColumn(e) {
|
|
1902
1969
|
return this.deleteColumns(e, 1);
|
|
1903
1970
|
}
|
|
1904
1971
|
/**
|
|
@@ -1907,15 +1974,17 @@ let _ = class extends p {
|
|
|
1907
1974
|
* @param howMany The number of columns to delete.
|
|
1908
1975
|
* @returns This sheet, for chaining.
|
|
1909
1976
|
*/
|
|
1910
|
-
|
|
1977
|
+
deleteColumns(e, t) {
|
|
1911
1978
|
const n = {
|
|
1912
1979
|
startRow: 0,
|
|
1913
1980
|
endRow: this._worksheet.getRowCount() - 1,
|
|
1914
1981
|
startColumn: e,
|
|
1915
1982
|
endColumn: e + t - 1
|
|
1916
1983
|
};
|
|
1917
|
-
return
|
|
1918
|
-
range: n
|
|
1984
|
+
return this._commandService.syncExecuteCommand(mt.id, {
|
|
1985
|
+
range: n,
|
|
1986
|
+
unitId: this._workbook.getUnitId(),
|
|
1987
|
+
subUnitId: this._worksheet.getSheetId()
|
|
1919
1988
|
}), this;
|
|
1920
1989
|
}
|
|
1921
1990
|
/**
|
|
@@ -1924,14 +1993,14 @@ let _ = class extends p {
|
|
|
1924
1993
|
* @param destinationIndex The index that the columns should be moved to. Note that this index is based on the coordinates before the columns are moved. Existing data is shifted right to make room for the moved columns while the source columns are removed from the grid. Therefore, the data may end up at a different index than originally specified. Use 0-index for this method.
|
|
1925
1994
|
* @returns This sheet, for chaining.
|
|
1926
1995
|
*/
|
|
1927
|
-
|
|
1928
|
-
const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), r =
|
|
1996
|
+
moveColumns(e, t) {
|
|
1997
|
+
const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), r = H(e.getRange(), this._worksheet), i = r, a = {
|
|
1929
1998
|
startRow: 0,
|
|
1930
1999
|
endRow: this._worksheet.getRowCount() - 1,
|
|
1931
2000
|
startColumn: t,
|
|
1932
2001
|
endColumn: t
|
|
1933
2002
|
};
|
|
1934
|
-
return
|
|
2003
|
+
return this._commandService.syncExecuteCommand(ut.id, {
|
|
1935
2004
|
unitId: n,
|
|
1936
2005
|
subUnitId: s,
|
|
1937
2006
|
range: r,
|
|
@@ -1944,9 +2013,9 @@ let _ = class extends p {
|
|
|
1944
2013
|
* @param column The column range to hide.
|
|
1945
2014
|
* @returns This sheet, for chaining.
|
|
1946
2015
|
*/
|
|
1947
|
-
|
|
1948
|
-
const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), s =
|
|
1949
|
-
return
|
|
2016
|
+
hideColumn(e) {
|
|
2017
|
+
const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), s = H(e.getRange(), this._worksheet);
|
|
2018
|
+
return this._commandService.syncExecuteCommand(le.id, {
|
|
1950
2019
|
unitId: t,
|
|
1951
2020
|
subUnitId: n,
|
|
1952
2021
|
ranges: [s]
|
|
@@ -1958,15 +2027,15 @@ let _ = class extends p {
|
|
|
1958
2027
|
* @param numColumns The number of columns to hide.
|
|
1959
2028
|
* @returns This sheet, for chaining.
|
|
1960
2029
|
*/
|
|
1961
|
-
|
|
2030
|
+
hideColumns(e, t = 1) {
|
|
1962
2031
|
const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), r = {
|
|
1963
2032
|
startRow: 0,
|
|
1964
2033
|
endRow: this._worksheet.getRowCount() - 1,
|
|
1965
2034
|
startColumn: e,
|
|
1966
2035
|
endColumn: e + t - 1,
|
|
1967
|
-
rangeType:
|
|
2036
|
+
rangeType: _.COLUMN
|
|
1968
2037
|
};
|
|
1969
|
-
return
|
|
2038
|
+
return this._commandService.syncExecuteCommand(le.id, {
|
|
1970
2039
|
unitId: n,
|
|
1971
2040
|
subUnitId: s,
|
|
1972
2041
|
ranges: [r]
|
|
@@ -1977,9 +2046,9 @@ let _ = class extends p {
|
|
|
1977
2046
|
* @param column The range to unhide, if hidden.
|
|
1978
2047
|
* @returns This sheet, for chaining.
|
|
1979
2048
|
*/
|
|
1980
|
-
|
|
1981
|
-
const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), s =
|
|
1982
|
-
return
|
|
2049
|
+
unhideColumn(e) {
|
|
2050
|
+
const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), s = H(e.getRange(), this._worksheet);
|
|
2051
|
+
return this._commandService.syncExecuteCommand(ge.id, {
|
|
1983
2052
|
unitId: t,
|
|
1984
2053
|
subUnitId: n,
|
|
1985
2054
|
ranges: [s]
|
|
@@ -1991,15 +2060,15 @@ let _ = class extends p {
|
|
|
1991
2060
|
* @param numColumns The number of columns to unhide.
|
|
1992
2061
|
* @returns This sheet, for chaining.
|
|
1993
2062
|
*/
|
|
1994
|
-
|
|
2063
|
+
showColumns(e, t = 1) {
|
|
1995
2064
|
const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), r = {
|
|
1996
2065
|
startRow: 0,
|
|
1997
2066
|
endRow: this._worksheet.getRowCount() - 1,
|
|
1998
2067
|
startColumn: e,
|
|
1999
2068
|
endColumn: e + t - 1,
|
|
2000
|
-
rangeType:
|
|
2069
|
+
rangeType: _.COLUMN
|
|
2001
2070
|
};
|
|
2002
|
-
return
|
|
2071
|
+
return this._commandService.syncExecuteCommand(ge.id, {
|
|
2003
2072
|
unitId: n,
|
|
2004
2073
|
subUnitId: s,
|
|
2005
2074
|
ranges: [r]
|
|
@@ -2011,7 +2080,7 @@ let _ = class extends p {
|
|
|
2011
2080
|
* @param width The width in pixels to set it to.
|
|
2012
2081
|
* @returns This sheet, for chaining.
|
|
2013
2082
|
*/
|
|
2014
|
-
|
|
2083
|
+
setColumnWidth(e, t) {
|
|
2015
2084
|
return this.setColumnWidths(e, 1, t);
|
|
2016
2085
|
}
|
|
2017
2086
|
/**
|
|
@@ -2021,7 +2090,7 @@ let _ = class extends p {
|
|
|
2021
2090
|
* @param width The width in pixels to set it to.
|
|
2022
2091
|
* @returns This sheet, for chaining.
|
|
2023
2092
|
*/
|
|
2024
|
-
|
|
2093
|
+
setColumnWidths(e, t, n) {
|
|
2025
2094
|
const s = this._workbook.getUnitId(), r = this._worksheet.getSheetId(), i = [
|
|
2026
2095
|
{
|
|
2027
2096
|
startColumn: e,
|
|
@@ -2030,7 +2099,7 @@ let _ = class extends p {
|
|
|
2030
2099
|
endRow: this._worksheet.getRowCount() - 1
|
|
2031
2100
|
}
|
|
2032
2101
|
];
|
|
2033
|
-
return
|
|
2102
|
+
return this._commandService.syncExecuteCommand(lt.id, {
|
|
2034
2103
|
unitId: s,
|
|
2035
2104
|
subUnitId: r,
|
|
2036
2105
|
ranges: i,
|
|
@@ -2043,7 +2112,7 @@ let _ = class extends p {
|
|
|
2043
2112
|
* @param custom The custom properties to set.
|
|
2044
2113
|
* @returns This sheet, for chaining.
|
|
2045
2114
|
*/
|
|
2046
|
-
|
|
2115
|
+
setColumnCustom(e) {
|
|
2047
2116
|
const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), s = {};
|
|
2048
2117
|
for (const [i, a] of Object.entries(e))
|
|
2049
2118
|
s[Number(i)] = {
|
|
@@ -2054,7 +2123,7 @@ let _ = class extends p {
|
|
|
2054
2123
|
subUnitId: n,
|
|
2055
2124
|
columnData: s
|
|
2056
2125
|
};
|
|
2057
|
-
return
|
|
2126
|
+
return this._commandService.syncExecuteCommand(ie.id, r), this;
|
|
2058
2127
|
}
|
|
2059
2128
|
// #region merge cells
|
|
2060
2129
|
/**
|
|
@@ -2062,7 +2131,7 @@ let _ = class extends p {
|
|
|
2062
2131
|
* @returns all merged cells
|
|
2063
2132
|
*/
|
|
2064
2133
|
getMergedRanges() {
|
|
2065
|
-
return this._worksheet.getSnapshot().mergeData.map((t) => this._injector.createInstance(
|
|
2134
|
+
return this._worksheet.getSnapshot().mergeData.map((t) => this._injector.createInstance(k, this._workbook, this._worksheet, t));
|
|
2066
2135
|
}
|
|
2067
2136
|
/**
|
|
2068
2137
|
* Get the merged cell data of the specified row and column.
|
|
@@ -2073,7 +2142,7 @@ let _ = class extends p {
|
|
|
2073
2142
|
getCellMergeData(e, t) {
|
|
2074
2143
|
const s = this._worksheet.getMergedCell(e, t);
|
|
2075
2144
|
if (s)
|
|
2076
|
-
return this._injector.createInstance(
|
|
2145
|
+
return this._injector.createInstance(k, this._workbook, this._worksheet, s);
|
|
2077
2146
|
}
|
|
2078
2147
|
// #endregion
|
|
2079
2148
|
/**
|
|
@@ -2102,21 +2171,21 @@ let _ = class extends p {
|
|
|
2102
2171
|
* @returns True if the command was successful, false otherwise.
|
|
2103
2172
|
*/
|
|
2104
2173
|
setFreeze(e) {
|
|
2105
|
-
return this._logService.warn("setFreeze is deprecated, use setFrozenRows and setFrozenColumns instead"), this._commandService.syncExecuteCommand(
|
|
2174
|
+
return this._logService.warn("setFreeze is deprecated, use setFrozenRows and setFrozenColumns instead"), this._commandService.syncExecuteCommand(L.id, {
|
|
2106
2175
|
...e,
|
|
2107
2176
|
unitId: this._workbook.getUnitId(),
|
|
2108
2177
|
subUnitId: this.getSheetId()
|
|
2109
|
-
});
|
|
2178
|
+
}), this;
|
|
2110
2179
|
}
|
|
2111
2180
|
/**
|
|
2112
2181
|
* Cancels the frozen state of the current sheet.
|
|
2113
2182
|
* @returns True if the command was successful, false otherwise.
|
|
2114
2183
|
*/
|
|
2115
2184
|
cancelFreeze() {
|
|
2116
|
-
return this._commandService.syncExecuteCommand(
|
|
2185
|
+
return this._commandService.syncExecuteCommand(gt.id, {
|
|
2117
2186
|
unitId: this._workbook.getUnitId(),
|
|
2118
2187
|
subUnitId: this.getSheetId()
|
|
2119
|
-
});
|
|
2188
|
+
}), this;
|
|
2120
2189
|
}
|
|
2121
2190
|
/**
|
|
2122
2191
|
* Get the freeze state of the current sheet.
|
|
@@ -2138,7 +2207,7 @@ let _ = class extends p {
|
|
|
2138
2207
|
});
|
|
2139
2208
|
} else if (arguments.length === 2) {
|
|
2140
2209
|
let [n = 0, s = 0] = e;
|
|
2141
|
-
n > s && ([n, s] = [s, n]), this._commandService.syncExecuteCommand(
|
|
2210
|
+
n > s && ([n, s] = [s, n]), this._commandService.syncExecuteCommand(L.id, {
|
|
2142
2211
|
startColumn: s + 1,
|
|
2143
2212
|
xSplit: s - n + 1,
|
|
2144
2213
|
startRow: t.startRow,
|
|
@@ -2147,6 +2216,7 @@ let _ = class extends p {
|
|
|
2147
2216
|
subUnitId: this.getSheetId()
|
|
2148
2217
|
});
|
|
2149
2218
|
}
|
|
2219
|
+
return this;
|
|
2150
2220
|
}
|
|
2151
2221
|
setFrozenRows(...e) {
|
|
2152
2222
|
const t = this.getFreeze();
|
|
@@ -2159,7 +2229,7 @@ let _ = class extends p {
|
|
|
2159
2229
|
});
|
|
2160
2230
|
} else if (arguments.length === 2) {
|
|
2161
2231
|
let [n = 0, s = 0] = e;
|
|
2162
|
-
n > s && ([n, s] = [s, n]), this._commandService.syncExecuteCommand
|
|
2232
|
+
n > s && ([n, s] = [s, n]), this._commandService.syncExecuteCommand(L.id, {
|
|
2163
2233
|
startRow: s + 1,
|
|
2164
2234
|
ySplit: s - n + 1,
|
|
2165
2235
|
startColumn: t.startColumn,
|
|
@@ -2168,6 +2238,7 @@ let _ = class extends p {
|
|
|
2168
2238
|
subUnitId: this.getSheetId()
|
|
2169
2239
|
});
|
|
2170
2240
|
}
|
|
2241
|
+
return this;
|
|
2171
2242
|
}
|
|
2172
2243
|
/**
|
|
2173
2244
|
* Get the number of frozen columns.
|
|
@@ -2235,16 +2306,16 @@ let _ = class extends p {
|
|
|
2235
2306
|
* ```
|
|
2236
2307
|
*/
|
|
2237
2308
|
setHiddenGridlines(e) {
|
|
2238
|
-
return this._commandService.executeCommand(
|
|
2309
|
+
return this._commandService.executeCommand(_t.id, {
|
|
2239
2310
|
unitId: this._workbook.getUnitId(),
|
|
2240
2311
|
subUnitId: this._worksheet.getSheetId(),
|
|
2241
2312
|
showGridlines: e ? u.FALSE : u.TRUE
|
|
2242
|
-
});
|
|
2313
|
+
}), this;
|
|
2243
2314
|
}
|
|
2244
2315
|
/**
|
|
2245
2316
|
* Set the color of the gridlines in the sheet.
|
|
2246
2317
|
* @param {string|undefined} color The color to set for the gridlines.Undefined or null to reset to the default color.
|
|
2247
|
-
* @returns {
|
|
2318
|
+
* @returns {FWorksheet} Returns the current worksheet instance for method chaining
|
|
2248
2319
|
* @example
|
|
2249
2320
|
* ```ts
|
|
2250
2321
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
@@ -2254,11 +2325,11 @@ let _ = class extends p {
|
|
|
2254
2325
|
* ```
|
|
2255
2326
|
*/
|
|
2256
2327
|
setGridLinesColor(e) {
|
|
2257
|
-
return this._commandService.
|
|
2328
|
+
return this._commandService.syncExecuteCommand(wt.id, {
|
|
2258
2329
|
unitId: this._workbook.getUnitId(),
|
|
2259
2330
|
subUnitId: this._worksheet.getSheetId(),
|
|
2260
2331
|
color: e
|
|
2261
|
-
});
|
|
2332
|
+
}), this;
|
|
2262
2333
|
}
|
|
2263
2334
|
/**
|
|
2264
2335
|
* Get the color of the gridlines in the sheet.
|
|
@@ -2270,7 +2341,7 @@ let _ = class extends p {
|
|
|
2270
2341
|
/**
|
|
2271
2342
|
* Sets the sheet tab color.
|
|
2272
2343
|
* @param {string|null|undefined} color A color code in CSS notation (like '#ffffff' or 'white'), or null to reset the tab color.
|
|
2273
|
-
* @returns {
|
|
2344
|
+
* @returns {FWorksheet} Returns the current worksheet instance for method chaining
|
|
2274
2345
|
* @example
|
|
2275
2346
|
* ```ts
|
|
2276
2347
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
@@ -2280,11 +2351,11 @@ let _ = class extends p {
|
|
|
2280
2351
|
* ```
|
|
2281
2352
|
*/
|
|
2282
2353
|
setTabColor(e) {
|
|
2283
|
-
return this._commandService.executeCommand(
|
|
2354
|
+
return this._commandService.executeCommand(St.id, {
|
|
2284
2355
|
unitId: this._workbook.getUnitId(),
|
|
2285
2356
|
subUnitId: this._worksheet.getSheetId(),
|
|
2286
2357
|
color: e
|
|
2287
|
-
});
|
|
2358
|
+
}), this;
|
|
2288
2359
|
}
|
|
2289
2360
|
/**
|
|
2290
2361
|
* Get the tab color of the sheet.
|
|
@@ -2319,9 +2390,9 @@ let _ = class extends p {
|
|
|
2319
2390
|
*/
|
|
2320
2391
|
onCellDataChange(e) {
|
|
2321
2392
|
return this._injector.get(l).onCommandExecuted((n) => {
|
|
2322
|
-
if (n.id ===
|
|
2393
|
+
if (n.id === _e.id) {
|
|
2323
2394
|
const s = n.params;
|
|
2324
|
-
s.unitId === this._workbook.getUnitId() && s.subUnitId === this._worksheet.getSheetId() && s.cellValue && e(new
|
|
2395
|
+
s.unitId === this._workbook.getUnitId() && s.subUnitId === this._worksheet.getSheetId() && s.cellValue && e(new T(s.cellValue));
|
|
2325
2396
|
}
|
|
2326
2397
|
});
|
|
2327
2398
|
}
|
|
@@ -2343,9 +2414,9 @@ let _ = class extends p {
|
|
|
2343
2414
|
*/
|
|
2344
2415
|
onBeforeCellDataChange(e) {
|
|
2345
2416
|
return this._injector.get(l).beforeCommandExecuted((n) => {
|
|
2346
|
-
if (n.id ===
|
|
2417
|
+
if (n.id === _e.id) {
|
|
2347
2418
|
const s = n.params;
|
|
2348
|
-
s.unitId === this._workbook.getUnitId() && s.subUnitId === this._worksheet.getSheetId() && s.cellValue && e(new
|
|
2419
|
+
s.unitId === this._workbook.getUnitId() && s.subUnitId === this._worksheet.getSheetId() && s.cellValue && e(new T(s.cellValue));
|
|
2349
2420
|
}
|
|
2350
2421
|
});
|
|
2351
2422
|
}
|
|
@@ -2363,14 +2434,14 @@ let _ = class extends p {
|
|
|
2363
2434
|
const e = this._injector.get(l);
|
|
2364
2435
|
if (this._workbook.getSheets().filter((r) => r.isSheetHidden() !== u.TRUE).length <= 1)
|
|
2365
2436
|
throw new Error("Cannot hide the only visible sheet");
|
|
2366
|
-
e.
|
|
2437
|
+
return e.syncExecuteCommand(kt.id, {
|
|
2367
2438
|
unitId: this._workbook.getUnitId(),
|
|
2368
2439
|
subUnitId: this._worksheet.getSheetId()
|
|
2369
|
-
});
|
|
2440
|
+
}), this;
|
|
2370
2441
|
}
|
|
2371
2442
|
/**
|
|
2372
2443
|
* Shows this sheet. Has no effect if the sheet is already visible.
|
|
2373
|
-
* @returns {
|
|
2444
|
+
* @returns {FWorksheet} Returns the current worksheet instance for method chaining
|
|
2374
2445
|
* @example
|
|
2375
2446
|
* ```ts
|
|
2376
2447
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
@@ -2380,10 +2451,10 @@ let _ = class extends p {
|
|
|
2380
2451
|
* ```
|
|
2381
2452
|
*/
|
|
2382
2453
|
showSheet() {
|
|
2383
|
-
return this._injector.get(l).
|
|
2454
|
+
return this._injector.get(l).syncExecuteCommand(Ct.id, {
|
|
2384
2455
|
unitId: this._workbook.getUnitId(),
|
|
2385
2456
|
subUnitId: this._worksheet.getSheetId()
|
|
2386
|
-
});
|
|
2457
|
+
}), this;
|
|
2387
2458
|
}
|
|
2388
2459
|
/**
|
|
2389
2460
|
* Returns true if the sheet is currently hidden.
|
|
@@ -2395,7 +2466,7 @@ let _ = class extends p {
|
|
|
2395
2466
|
/**
|
|
2396
2467
|
* Sets the sheet name.
|
|
2397
2468
|
* @param {string} name The new name for the sheet.
|
|
2398
|
-
* @returns {
|
|
2469
|
+
* @returns {FWorksheet} Returns the current worksheet instance for method chaining
|
|
2399
2470
|
* @example
|
|
2400
2471
|
* ```ts
|
|
2401
2472
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
@@ -2405,11 +2476,11 @@ let _ = class extends p {
|
|
|
2405
2476
|
* ```
|
|
2406
2477
|
*/
|
|
2407
2478
|
setName(e) {
|
|
2408
|
-
return this._commandService.
|
|
2479
|
+
return this._commandService.syncExecuteCommand(It.id, {
|
|
2409
2480
|
unitId: this._workbook.getUnitId(),
|
|
2410
2481
|
subUnitId: this._worksheet.getSheetId(),
|
|
2411
2482
|
name: e
|
|
2412
|
-
});
|
|
2483
|
+
}), this;
|
|
2413
2484
|
}
|
|
2414
2485
|
/**
|
|
2415
2486
|
* Activates this sheet. Does not alter the sheet itself, only the parent's notion of the active sheet.
|
|
@@ -2438,7 +2509,7 @@ let _ = class extends p {
|
|
|
2438
2509
|
* @param {IFacadeClearOptions} [options] Options for clearing the sheet. If not provided, the contents and formatting are cleared both.
|
|
2439
2510
|
* @param {boolean} [options.contentsOnly] If true, the contents of the sheet are cleared. If false, the contents and formatting are cleared. Default is false.
|
|
2440
2511
|
* @param {boolean} [options.formatOnly] If true, the formatting of the sheet is cleared. If false, the contents and formatting are cleared. Default is false.
|
|
2441
|
-
* @returns
|
|
2512
|
+
* @returns {FWorksheet} Returns the current worksheet instance for method chaining
|
|
2442
2513
|
* @example
|
|
2443
2514
|
* ```ts
|
|
2444
2515
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
@@ -2460,16 +2531,16 @@ let _ = class extends p {
|
|
|
2460
2531
|
startColumn: 0,
|
|
2461
2532
|
endColumn: this._worksheet.getColumnCount() - 1
|
|
2462
2533
|
};
|
|
2463
|
-
return s.
|
|
2534
|
+
return s.syncExecuteCommand(ft.id, {
|
|
2464
2535
|
unitId: t,
|
|
2465
2536
|
subUnitId: n,
|
|
2466
2537
|
ranges: [r],
|
|
2467
2538
|
options: e
|
|
2468
|
-
});
|
|
2539
|
+
}), this;
|
|
2469
2540
|
}
|
|
2470
2541
|
/**
|
|
2471
2542
|
* Clears the sheet of contents, while preserving formatting information.
|
|
2472
|
-
* @returns {
|
|
2543
|
+
* @returns {FWorksheet} Returns the current worksheet instance for method chaining
|
|
2473
2544
|
* @example
|
|
2474
2545
|
* ```ts
|
|
2475
2546
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
@@ -2485,15 +2556,15 @@ let _ = class extends p {
|
|
|
2485
2556
|
startColumn: 0,
|
|
2486
2557
|
endColumn: this._worksheet.getColumnCount() - 1
|
|
2487
2558
|
};
|
|
2488
|
-
return n.
|
|
2559
|
+
return n.syncExecuteCommand(vt.id, {
|
|
2489
2560
|
unitId: e,
|
|
2490
2561
|
subUnitId: t,
|
|
2491
2562
|
ranges: [s]
|
|
2492
|
-
});
|
|
2563
|
+
}), this;
|
|
2493
2564
|
}
|
|
2494
2565
|
/**
|
|
2495
2566
|
* Clears the sheet of formatting, while preserving contents.
|
|
2496
|
-
* @returns {
|
|
2567
|
+
* @returns {FWorksheet} Returns the current worksheet instance for method chaining
|
|
2497
2568
|
* @example
|
|
2498
2569
|
* ```ts
|
|
2499
2570
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
@@ -2509,11 +2580,11 @@ let _ = class extends p {
|
|
|
2509
2580
|
startColumn: 0,
|
|
2510
2581
|
endColumn: this._worksheet.getColumnCount() - 1
|
|
2511
2582
|
};
|
|
2512
|
-
return n.
|
|
2583
|
+
return n.syncExecuteCommand(Rt.id, {
|
|
2513
2584
|
unitId: e,
|
|
2514
2585
|
subUnitId: t,
|
|
2515
2586
|
ranges: [s]
|
|
2516
|
-
});
|
|
2587
|
+
}), this;
|
|
2517
2588
|
}
|
|
2518
2589
|
/**
|
|
2519
2590
|
* Returns a Range corresponding to the dimensions in which data is present.
|
|
@@ -2602,7 +2673,7 @@ let _ = class extends p {
|
|
|
2602
2673
|
* ```
|
|
2603
2674
|
*/
|
|
2604
2675
|
equalTo(e) {
|
|
2605
|
-
return e instanceof
|
|
2676
|
+
return e instanceof g ? this._worksheet.getSheetId() === e.getSheetId() && this._workbook.getUnitId() === e.getWorkbook().getUnitId() : !1;
|
|
2606
2677
|
}
|
|
2607
2678
|
/*
|
|
2608
2679
|
* Insert a defined name for worksheet.
|
|
@@ -2617,7 +2688,7 @@ let _ = class extends p {
|
|
|
2617
2688
|
* ```
|
|
2618
2689
|
*/
|
|
2619
2690
|
insertDefinedName(e, t) {
|
|
2620
|
-
const s = this._injector.createInstance(
|
|
2691
|
+
const s = this._injector.createInstance(F).setName(e).setRef(t).build();
|
|
2621
2692
|
s.localSheetId = this.getSheetId(), this._fWorkbook.insertDefinedNameBuilder(s);
|
|
2622
2693
|
}
|
|
2623
2694
|
/**
|
|
@@ -2635,21 +2706,21 @@ let _ = class extends p {
|
|
|
2635
2706
|
return this._fWorkbook.getDefinedNames().filter((t) => t.getLocalSheetId() === this.getSheetId());
|
|
2636
2707
|
}
|
|
2637
2708
|
};
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
],
|
|
2644
|
-
var
|
|
2645
|
-
for (var s = n > 1 ? void 0 : n ?
|
|
2709
|
+
g = Zt([
|
|
2710
|
+
W(3, m(v)),
|
|
2711
|
+
W(4, m(Ne)),
|
|
2712
|
+
W(5, m(Ie)),
|
|
2713
|
+
W(6, l)
|
|
2714
|
+
], g);
|
|
2715
|
+
var en = Object.defineProperty, tn = Object.getOwnPropertyDescriptor, nn = (o, e, t, n) => {
|
|
2716
|
+
for (var s = n > 1 ? void 0 : n ? tn(e, t) : e, r = o.length - 1, i; r >= 0; r--)
|
|
2646
2717
|
(i = o[r]) && (s = (n ? i(e, t, s) : i(s)) || s);
|
|
2647
|
-
return n && s &&
|
|
2648
|
-
},
|
|
2649
|
-
let I = class extends
|
|
2718
|
+
return n && s && en(e, t, s), s;
|
|
2719
|
+
}, S = (o, e) => (t, n) => e(t, n, o);
|
|
2720
|
+
let I = class extends X {
|
|
2650
2721
|
constructor(e, t, n, s, r, i, a, h, c, d) {
|
|
2651
|
-
super();
|
|
2652
|
-
|
|
2722
|
+
super(t);
|
|
2723
|
+
p(this, "id");
|
|
2653
2724
|
this._workbook = e, this._injector = t, this._resourceLoaderService = n, this._selectionManagerService = s, this._univerInstanceService = r, this._commandService = i, this._permissionService = a, this._logService = h, this._localeService = c, this._definedNamesService = d, this.id = this._workbook.getUnitId();
|
|
2654
2725
|
}
|
|
2655
2726
|
/**
|
|
@@ -2724,7 +2795,7 @@ let I = class extends p {
|
|
|
2724
2795
|
*/
|
|
2725
2796
|
getActiveSheet() {
|
|
2726
2797
|
const e = this._workbook.getActiveSheet();
|
|
2727
|
-
return this._injector.createInstance(
|
|
2798
|
+
return this._injector.createInstance(g, this, this._workbook, e);
|
|
2728
2799
|
}
|
|
2729
2800
|
/**
|
|
2730
2801
|
* Gets all the worksheets in this workbook
|
|
@@ -2737,7 +2808,7 @@ let I = class extends p {
|
|
|
2737
2808
|
* ```
|
|
2738
2809
|
*/
|
|
2739
2810
|
getSheets() {
|
|
2740
|
-
return this._workbook.getSheets().map((e) => this._injector.createInstance(
|
|
2811
|
+
return this._workbook.getSheets().map((e) => this._injector.createInstance(g, this, this._workbook, e));
|
|
2741
2812
|
}
|
|
2742
2813
|
/**
|
|
2743
2814
|
* Create a new worksheet and returns a handle to it.
|
|
@@ -2753,19 +2824,19 @@ let I = class extends p {
|
|
|
2753
2824
|
* ```
|
|
2754
2825
|
*/
|
|
2755
2826
|
create(e, t, n) {
|
|
2756
|
-
const s =
|
|
2757
|
-
s.rowCount = t, s.columnCount = n, s.name = e, s.id = e.toLowerCase().replace(/ /g, "-"), this._commandService.syncExecuteCommand(
|
|
2827
|
+
const s = Be({});
|
|
2828
|
+
s.rowCount = t, s.columnCount = n, s.name = e, s.id = e.toLowerCase().replace(/ /g, "-"), this._commandService.syncExecuteCommand(U.id, {
|
|
2758
2829
|
unitId: this.id,
|
|
2759
2830
|
index: this._workbook.getSheets().length,
|
|
2760
2831
|
sheet: s
|
|
2761
|
-
}), this._commandService.syncExecuteCommand(
|
|
2832
|
+
}), this._commandService.syncExecuteCommand(z.id, {
|
|
2762
2833
|
unitId: this.id,
|
|
2763
2834
|
subUnitId: this._workbook.getSheets()[this._workbook.getSheets().length - 1].getSheetId()
|
|
2764
2835
|
});
|
|
2765
2836
|
const r = this._workbook.getActiveSheet();
|
|
2766
2837
|
if (!r)
|
|
2767
2838
|
throw new Error("No active sheet found");
|
|
2768
|
-
return this._injector.createInstance(
|
|
2839
|
+
return this._injector.createInstance(g, this, this._workbook, r);
|
|
2769
2840
|
}
|
|
2770
2841
|
/**
|
|
2771
2842
|
* Get a worksheet by sheet id.
|
|
@@ -2780,7 +2851,7 @@ let I = class extends p {
|
|
|
2780
2851
|
*/
|
|
2781
2852
|
getSheetBySheetId(e) {
|
|
2782
2853
|
const t = this._workbook.getSheetBySheetId(e);
|
|
2783
|
-
return t ? this._injector.createInstance(
|
|
2854
|
+
return t ? this._injector.createInstance(g, this, this._workbook, t) : null;
|
|
2784
2855
|
}
|
|
2785
2856
|
/**
|
|
2786
2857
|
* Get a worksheet by sheet name.
|
|
@@ -2795,7 +2866,7 @@ let I = class extends p {
|
|
|
2795
2866
|
*/
|
|
2796
2867
|
getSheetByName(e) {
|
|
2797
2868
|
const t = this._workbook.getSheetBySheetName(e);
|
|
2798
|
-
return t ? this._injector.createInstance(
|
|
2869
|
+
return t ? this._injector.createInstance(g, this, this._workbook, t) : null;
|
|
2799
2870
|
}
|
|
2800
2871
|
/**
|
|
2801
2872
|
* Sets the given worksheet to be the active worksheet in the workbook.
|
|
@@ -2810,7 +2881,7 @@ let I = class extends p {
|
|
|
2810
2881
|
* ```
|
|
2811
2882
|
*/
|
|
2812
2883
|
setActiveSheet(e) {
|
|
2813
|
-
return this._commandService.syncExecuteCommand(
|
|
2884
|
+
return this._commandService.syncExecuteCommand(z.id, {
|
|
2814
2885
|
unitId: this.id,
|
|
2815
2886
|
subUnitId: e.getSheetId()
|
|
2816
2887
|
}), e;
|
|
@@ -2832,16 +2903,16 @@ let I = class extends p {
|
|
|
2832
2903
|
* ```
|
|
2833
2904
|
*/
|
|
2834
2905
|
insertSheet(e) {
|
|
2835
|
-
e != null ? this._commandService.syncExecuteCommand(
|
|
2906
|
+
e != null ? this._commandService.syncExecuteCommand(U.id, { sheet: { name: e } }) : this._commandService.syncExecuteCommand(U.id);
|
|
2836
2907
|
const t = this.id, n = this._workbook.getSheets()[this._workbook.getSheets().length - 1].getSheetId();
|
|
2837
|
-
this._commandService.syncExecuteCommand(
|
|
2908
|
+
this._commandService.syncExecuteCommand(z.id, {
|
|
2838
2909
|
unitId: t,
|
|
2839
2910
|
subUnitId: n
|
|
2840
2911
|
});
|
|
2841
2912
|
const s = this._workbook.getActiveSheet();
|
|
2842
2913
|
if (!s)
|
|
2843
2914
|
throw new Error("No active sheet found");
|
|
2844
|
-
return this._injector.createInstance(
|
|
2915
|
+
return this._injector.createInstance(g, this, this._workbook, s);
|
|
2845
2916
|
}
|
|
2846
2917
|
/**
|
|
2847
2918
|
* Deletes the specified worksheet.
|
|
@@ -2856,7 +2927,7 @@ let I = class extends p {
|
|
|
2856
2927
|
*/
|
|
2857
2928
|
deleteSheet(e) {
|
|
2858
2929
|
const t = this.id, n = e.getSheetId();
|
|
2859
|
-
return this._commandService.
|
|
2930
|
+
return this._commandService.syncExecuteCommand(bt.id, {
|
|
2860
2931
|
unitId: t,
|
|
2861
2932
|
subUnitId: n
|
|
2862
2933
|
});
|
|
@@ -2873,7 +2944,7 @@ let I = class extends p {
|
|
|
2873
2944
|
* ```
|
|
2874
2945
|
*/
|
|
2875
2946
|
undo() {
|
|
2876
|
-
return this._univerInstanceService.focusUnit(this.id), this._commandService.
|
|
2947
|
+
return this._univerInstanceService.focusUnit(this.id), this._commandService.syncExecuteCommand(Le.id), this;
|
|
2877
2948
|
}
|
|
2878
2949
|
/**
|
|
2879
2950
|
* Redo the last undone action.
|
|
@@ -2886,7 +2957,7 @@ let I = class extends p {
|
|
|
2886
2957
|
* ```
|
|
2887
2958
|
*/
|
|
2888
2959
|
redo() {
|
|
2889
|
-
return this._univerInstanceService.focusUnit(this.id), this._commandService.
|
|
2960
|
+
return this._univerInstanceService.focusUnit(this.id), this._commandService.syncExecuteCommand(ze.id), this;
|
|
2890
2961
|
}
|
|
2891
2962
|
/**
|
|
2892
2963
|
* Callback for command execution.
|
|
@@ -2947,9 +3018,9 @@ let I = class extends p {
|
|
|
2947
3018
|
* @returns A function to dispose the listening
|
|
2948
3019
|
*/
|
|
2949
3020
|
onSelectionChange(e) {
|
|
2950
|
-
return
|
|
3021
|
+
return fe(
|
|
2951
3022
|
this._selectionManagerService.selectionMoveEnd$.subscribe((t) => {
|
|
2952
|
-
this._univerInstanceService.getCurrentUnitForType(
|
|
3023
|
+
this._univerInstanceService.getCurrentUnitForType(P.UNIVER_SHEET).getUnitId() === this.id && (t != null && t.length ? e(t.map((n) => n.range)) : e([]));
|
|
2953
3024
|
})
|
|
2954
3025
|
);
|
|
2955
3026
|
}
|
|
@@ -2958,7 +3029,7 @@ let I = class extends p {
|
|
|
2958
3029
|
* @param {boolean} value editable value want to set
|
|
2959
3030
|
*/
|
|
2960
3031
|
setEditable(e) {
|
|
2961
|
-
const t = new
|
|
3032
|
+
const t = new Ue(this._workbook.getUnitId());
|
|
2962
3033
|
this._permissionService.getPermissionPoint(t.id) || this._permissionService.addPermissionPoint(t), this._permissionService.updatePermissionPoint(t.id, e);
|
|
2963
3034
|
}
|
|
2964
3035
|
/**
|
|
@@ -2969,13 +3040,13 @@ let I = class extends p {
|
|
|
2969
3040
|
const t = this.getActiveSheet(), n = e.getRange().sheetId || t.getSheetId(), s = n ? this._workbook.getSheetBySheetId(n) : this._workbook.getActiveSheet(!0);
|
|
2970
3041
|
if (!s)
|
|
2971
3042
|
throw new Error("No active sheet found");
|
|
2972
|
-
s.getSheetId() !== t.getSheetId() && this.setActiveSheet(this._injector.createInstance(
|
|
3043
|
+
s.getSheetId() !== t.getSheetId() && this.setActiveSheet(this._injector.createInstance(g, this, this._workbook, s));
|
|
2973
3044
|
const r = {
|
|
2974
3045
|
unitId: this.getId(),
|
|
2975
3046
|
subUnitId: n,
|
|
2976
|
-
selections: [e].map((i) => ({ range: i.getRange(), primary:
|
|
3047
|
+
selections: [e].map((i) => ({ range: i.getRange(), primary: K(i.getRange(), s), style: null }))
|
|
2977
3048
|
};
|
|
2978
|
-
this._commandService.syncExecuteCommand(
|
|
3049
|
+
this._commandService.syncExecuteCommand(xe.id, r);
|
|
2979
3050
|
}
|
|
2980
3051
|
/**
|
|
2981
3052
|
* Returns the selected range in the active sheet, or null if there is no active range.
|
|
@@ -2983,7 +3054,7 @@ let I = class extends p {
|
|
|
2983
3054
|
*/
|
|
2984
3055
|
getActiveRange() {
|
|
2985
3056
|
const e = this._workbook.getActiveSheet(), n = this._selectionManagerService.getCurrentSelections().find((s) => !!s.primary);
|
|
2986
|
-
return n ? this._injector.createInstance(
|
|
3057
|
+
return n ? this._injector.createInstance(k, this._workbook, e, n.range) : null;
|
|
2987
3058
|
}
|
|
2988
3059
|
/**
|
|
2989
3060
|
* Deletes the currently active sheet.
|
|
@@ -3001,7 +3072,7 @@ let I = class extends p {
|
|
|
3001
3072
|
/**
|
|
3002
3073
|
* Duplicates the given worksheet.
|
|
3003
3074
|
* @param {FWorksheet} sheet The worksheet to duplicate.
|
|
3004
|
-
* @returns {
|
|
3075
|
+
* @returns {FWorksheet} The duplicated worksheet
|
|
3005
3076
|
* @example
|
|
3006
3077
|
* ```ts
|
|
3007
3078
|
* // The code below duplicates the given worksheet
|
|
@@ -3011,14 +3082,14 @@ let I = class extends p {
|
|
|
3011
3082
|
* ```
|
|
3012
3083
|
*/
|
|
3013
3084
|
duplicateSheet(e) {
|
|
3014
|
-
return this._commandService.
|
|
3085
|
+
return this._commandService.syncExecuteCommand(pt.id, {
|
|
3015
3086
|
unitId: e.getWorkbook().getUnitId(),
|
|
3016
3087
|
subUnitId: e.getSheetId()
|
|
3017
|
-
});
|
|
3088
|
+
}), this._injector.createInstance(g, this, this._workbook, this._workbook.getActiveSheet());
|
|
3018
3089
|
}
|
|
3019
3090
|
/**
|
|
3020
3091
|
* Duplicates the active sheet.
|
|
3021
|
-
* @returns {
|
|
3092
|
+
* @returns {FWorksheet} The duplicated worksheet
|
|
3022
3093
|
* @example
|
|
3023
3094
|
* ```ts
|
|
3024
3095
|
* // The code below duplicates the active sheet
|
|
@@ -3086,7 +3157,7 @@ let I = class extends p {
|
|
|
3086
3157
|
* Move the sheet to the specified index.
|
|
3087
3158
|
* @param {FWorksheet} sheet The sheet to move
|
|
3088
3159
|
* @param {number} index The index to move the sheet to
|
|
3089
|
-
* @returns {
|
|
3160
|
+
* @returns {FWorkbook} This workbook, for chaining
|
|
3090
3161
|
* @example
|
|
3091
3162
|
* ```ts
|
|
3092
3163
|
* // The code below moves the sheet to the specified index
|
|
@@ -3097,16 +3168,16 @@ let I = class extends p {
|
|
|
3097
3168
|
*/
|
|
3098
3169
|
moveSheet(e, t) {
|
|
3099
3170
|
let n = t;
|
|
3100
|
-
return n < 0 ? n = 0 : n > this._workbook.getSheets().length - 1 && (n = this._workbook.getSheets().length - 1), this._commandService.
|
|
3171
|
+
return n < 0 ? n = 0 : n > this._workbook.getSheets().length - 1 && (n = this._workbook.getSheets().length - 1), this._commandService.syncExecuteCommand(yt.id, {
|
|
3101
3172
|
unitId: e.getWorkbook().getUnitId(),
|
|
3102
3173
|
order: n,
|
|
3103
3174
|
subUnitId: e.getSheetId()
|
|
3104
|
-
});
|
|
3175
|
+
}), this;
|
|
3105
3176
|
}
|
|
3106
3177
|
/**
|
|
3107
3178
|
* Move the active sheet to the specified index.
|
|
3108
3179
|
* @param {number} index The index to move the active sheet to
|
|
3109
|
-
* @returns {
|
|
3180
|
+
* @returns {FWorkbook} This workbook, for chaining
|
|
3110
3181
|
* @example
|
|
3111
3182
|
* ```ts
|
|
3112
3183
|
* // The code below moves the active sheet to the specified index
|
|
@@ -3124,7 +3195,7 @@ let I = class extends p {
|
|
|
3124
3195
|
* @returns {FPermission} - The PermissionInstance.
|
|
3125
3196
|
*/
|
|
3126
3197
|
getPermission() {
|
|
3127
|
-
return this._injector.createInstance(
|
|
3198
|
+
return this._injector.createInstance(j);
|
|
3128
3199
|
}
|
|
3129
3200
|
/**
|
|
3130
3201
|
* Get the defined name by name.
|
|
@@ -3139,7 +3210,7 @@ let I = class extends p {
|
|
|
3139
3210
|
*/
|
|
3140
3211
|
getDefinedName(e) {
|
|
3141
3212
|
const t = this._definedNamesService.getValueByName(this.id, e);
|
|
3142
|
-
return t ? this._injector.createInstance(
|
|
3213
|
+
return t ? this._injector.createInstance(M, { ...t, unitId: this.id }) : null;
|
|
3143
3214
|
}
|
|
3144
3215
|
/**
|
|
3145
3216
|
* Get all the defined names in the workbook.
|
|
@@ -3153,7 +3224,7 @@ let I = class extends p {
|
|
|
3153
3224
|
*/
|
|
3154
3225
|
getDefinedNames() {
|
|
3155
3226
|
const e = this._definedNamesService.getDefinedNameMap(this.id);
|
|
3156
|
-
return e ? Object.values(e).map((t) => this._injector.createInstance(
|
|
3227
|
+
return e ? Object.values(e).map((t) => this._injector.createInstance(M, { ...t, unitId: this.id })) : [];
|
|
3157
3228
|
}
|
|
3158
3229
|
/**
|
|
3159
3230
|
* Insert a defined name.
|
|
@@ -3167,8 +3238,8 @@ let I = class extends p {
|
|
|
3167
3238
|
* ```
|
|
3168
3239
|
*/
|
|
3169
3240
|
insertDefinedName(e, t) {
|
|
3170
|
-
const s = this._injector.createInstance(
|
|
3171
|
-
s.localSheetId =
|
|
3241
|
+
const s = this._injector.createInstance(F).setName(e).setRef(t).build();
|
|
3242
|
+
s.localSheetId = q, this.insertDefinedNameBuilder(s);
|
|
3172
3243
|
}
|
|
3173
3244
|
/**
|
|
3174
3245
|
* Delete the defined name with the given name.
|
|
@@ -3198,7 +3269,7 @@ let I = class extends p {
|
|
|
3198
3269
|
* ```
|
|
3199
3270
|
*/
|
|
3200
3271
|
insertDefinedNameBuilder(e) {
|
|
3201
|
-
e.unitId = this.getId(), this._commandService.syncExecuteCommand(
|
|
3272
|
+
e.unitId = this.getId(), this._commandService.syncExecuteCommand(G.id, e);
|
|
3202
3273
|
}
|
|
3203
3274
|
/**
|
|
3204
3275
|
* Update the defined name with the given name.
|
|
@@ -3210,70 +3281,180 @@ let I = class extends p {
|
|
|
3210
3281
|
* const builder = activeSpreadsheet.getDefinedName('MyDefinedName').toBuilder();
|
|
3211
3282
|
* builder.setRef('Sheet1!A2').setName('MyDefinedName1').build();
|
|
3212
3283
|
* activeSpreadsheet.updateDefinedNameBuilder(param);
|
|
3213
|
-
*
|
|
3214
3284
|
* ```
|
|
3215
3285
|
*/
|
|
3216
3286
|
updateDefinedNameBuilder(e) {
|
|
3217
|
-
this._commandService.syncExecuteCommand(
|
|
3287
|
+
this._commandService.syncExecuteCommand(G.id, e);
|
|
3288
|
+
}
|
|
3289
|
+
/**
|
|
3290
|
+
* Gets the registered range themes.
|
|
3291
|
+
* @returns {string[]} The name list of registered range themes.
|
|
3292
|
+
* @example
|
|
3293
|
+
* ```ts
|
|
3294
|
+
* // The code below gets the registered range themes
|
|
3295
|
+
* const activeSpreadsheet = univerAPI.getActiveWorkbook();
|
|
3296
|
+
* const themes = activeSpreadsheet.getRegisteredRangeThemes();
|
|
3297
|
+
* console.log(themes);
|
|
3298
|
+
* ```
|
|
3299
|
+
*/
|
|
3300
|
+
getRegisteredRangeThemes() {
|
|
3301
|
+
return this._injector.get(Ee).getRegisteredRangeThemes();
|
|
3302
|
+
}
|
|
3303
|
+
/**
|
|
3304
|
+
* Register a custom range theme style.
|
|
3305
|
+
* @example
|
|
3306
|
+
* ```ts
|
|
3307
|
+
* // import {RangeThemeStyle} from '@univerjs/sheets';
|
|
3308
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
3309
|
+
* const rangeThemeStyle = new RangeThemeStyle('MyTheme');
|
|
3310
|
+
* rangeThemeStyle.setSecondRowStyle({
|
|
3311
|
+
* bg: {
|
|
3312
|
+
* rgb: 'rgb(214,231,241)',
|
|
3313
|
+
* },
|
|
3314
|
+
* });
|
|
3315
|
+
* fWorkbook.registerRangeTheme(rangeThemeStyle);
|
|
3316
|
+
* ```
|
|
3317
|
+
*/
|
|
3318
|
+
registerRangeTheme(e) {
|
|
3319
|
+
this._commandService.syncExecuteCommand(Pt.id, {
|
|
3320
|
+
unitId: this.getId(),
|
|
3321
|
+
rangeThemeStyle: e
|
|
3322
|
+
});
|
|
3323
|
+
}
|
|
3324
|
+
/**
|
|
3325
|
+
* Unregister a custom range theme style.
|
|
3326
|
+
* @example
|
|
3327
|
+
* ```ts
|
|
3328
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
3329
|
+
* fWorkbook.unregisterRangeTheme('MyTheme');
|
|
3330
|
+
* ```
|
|
3331
|
+
*/
|
|
3332
|
+
unregisterRangeTheme(e) {
|
|
3333
|
+
this._commandService.syncExecuteCommand(Ut.id, {
|
|
3334
|
+
unitId: this.getId(),
|
|
3335
|
+
themeName: e
|
|
3336
|
+
});
|
|
3218
3337
|
}
|
|
3219
3338
|
};
|
|
3220
|
-
I =
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3339
|
+
I = nn([
|
|
3340
|
+
S(1, m(v)),
|
|
3341
|
+
S(2, m(Oe)),
|
|
3342
|
+
S(3, m(Ne)),
|
|
3343
|
+
S(4, ve),
|
|
3344
|
+
S(5, l),
|
|
3345
|
+
S(6, J),
|
|
3346
|
+
S(7, Ie),
|
|
3347
|
+
S(8, m(ke)),
|
|
3348
|
+
S(9, De)
|
|
3230
3349
|
], I);
|
|
3231
|
-
class
|
|
3350
|
+
class sn extends Re {
|
|
3351
|
+
_initialize(e) {
|
|
3352
|
+
const t = e.get(l);
|
|
3353
|
+
this.disposeWithMe(
|
|
3354
|
+
t.beforeCommandExecuted((n) => {
|
|
3355
|
+
var s;
|
|
3356
|
+
switch (n.id) {
|
|
3357
|
+
case U.id: {
|
|
3358
|
+
const r = n.params, { unitId: i, index: a, sheet: h } = r || {}, c = i ? this.getUniverSheet(i) : (s = this.getActiveWorkbook) == null ? void 0 : s.call(this);
|
|
3359
|
+
if (!c)
|
|
3360
|
+
return;
|
|
3361
|
+
const d = {
|
|
3362
|
+
workbook: c,
|
|
3363
|
+
index: a,
|
|
3364
|
+
sheet: h
|
|
3365
|
+
};
|
|
3366
|
+
if (this.fireEvent(
|
|
3367
|
+
this.Event.BeforeSheetCreate,
|
|
3368
|
+
d
|
|
3369
|
+
), d.cancel)
|
|
3370
|
+
throw new Error("Sheet create canceled by facade api.");
|
|
3371
|
+
break;
|
|
3372
|
+
}
|
|
3373
|
+
}
|
|
3374
|
+
})
|
|
3375
|
+
), this.disposeWithMe(
|
|
3376
|
+
t.onCommandExecuted((n) => {
|
|
3377
|
+
var s;
|
|
3378
|
+
switch (n.id) {
|
|
3379
|
+
case U.id: {
|
|
3380
|
+
const r = n.params, { unitId: i } = r || {}, a = i ? this.getUniverSheet(i) : (s = this.getActiveWorkbook) == null ? void 0 : s.call(this);
|
|
3381
|
+
if (!a)
|
|
3382
|
+
return;
|
|
3383
|
+
const h = a.getActiveSheet();
|
|
3384
|
+
if (!h)
|
|
3385
|
+
return;
|
|
3386
|
+
const c = {
|
|
3387
|
+
workbook: a,
|
|
3388
|
+
worksheet: h
|
|
3389
|
+
};
|
|
3390
|
+
this.fireEvent(
|
|
3391
|
+
this.Event.SheetCreated,
|
|
3392
|
+
c
|
|
3393
|
+
);
|
|
3394
|
+
break;
|
|
3395
|
+
}
|
|
3396
|
+
}
|
|
3397
|
+
})
|
|
3398
|
+
);
|
|
3399
|
+
}
|
|
3232
3400
|
createUniverSheet(e) {
|
|
3233
|
-
const n = this._injector.get(
|
|
3401
|
+
const n = this._injector.get(ve).createUnit(P.UNIVER_SHEET, e);
|
|
3234
3402
|
return this._injector.createInstance(I, n);
|
|
3235
3403
|
}
|
|
3236
|
-
|
|
3237
|
-
const e = this._univerInstanceService.getCurrentUnitForType(
|
|
3404
|
+
getActiveUniverSheet() {
|
|
3405
|
+
const e = this._univerInstanceService.getCurrentUnitForType(P.UNIVER_SHEET);
|
|
3238
3406
|
return e ? this._injector.createInstance(I, e) : null;
|
|
3239
3407
|
}
|
|
3408
|
+
getActiveWorkbook() {
|
|
3409
|
+
return this.getActiveUniverSheet();
|
|
3410
|
+
}
|
|
3240
3411
|
getUniverSheet(e) {
|
|
3241
|
-
const t = this._univerInstanceService.getUnit(e,
|
|
3412
|
+
const t = this._univerInstanceService.getUnit(e, P.UNIVER_SHEET);
|
|
3242
3413
|
return t ? this._injector.createInstance(I, t) : null;
|
|
3243
3414
|
}
|
|
3244
3415
|
getPermission() {
|
|
3245
|
-
return this._injector.createInstance(
|
|
3416
|
+
return this._injector.createInstance(j);
|
|
3246
3417
|
}
|
|
3247
3418
|
onUniverSheetCreated(e) {
|
|
3248
|
-
const t = this._univerInstanceService.getTypeOfUnitAdded$(
|
|
3419
|
+
const t = this._univerInstanceService.getTypeOfUnitAdded$(P.UNIVER_SHEET).subscribe((n) => {
|
|
3249
3420
|
const s = this._injector.createInstance(I, n);
|
|
3250
3421
|
e(s);
|
|
3251
3422
|
});
|
|
3252
|
-
return
|
|
3423
|
+
return fe(t);
|
|
3253
3424
|
}
|
|
3254
3425
|
newDefinedName() {
|
|
3255
|
-
return this._injector.createInstance(
|
|
3426
|
+
return this._injector.createInstance(F);
|
|
3256
3427
|
}
|
|
3257
3428
|
}
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3429
|
+
Re.extend(sn);
|
|
3430
|
+
class on extends be {
|
|
3431
|
+
get SheetCreated() {
|
|
3432
|
+
return "SheetCreated";
|
|
3433
|
+
}
|
|
3434
|
+
get BeforeSheetCreate() {
|
|
3435
|
+
return "BeforeSheetCreate";
|
|
3436
|
+
}
|
|
3437
|
+
}
|
|
3438
|
+
be.extend(on);
|
|
3439
|
+
var rn = Object.defineProperty, an = Object.getOwnPropertyDescriptor, hn = (o, e, t, n) => {
|
|
3440
|
+
for (var s = n > 1 ? void 0 : n ? an(e, t) : e, r = o.length - 1, i; r >= 0; r--)
|
|
3261
3441
|
(i = o[r]) && (s = (n ? i(e, t, s) : i(s)) || s);
|
|
3262
|
-
return n && s &&
|
|
3263
|
-
},
|
|
3264
|
-
let
|
|
3442
|
+
return n && s && rn(e, t, s), s;
|
|
3443
|
+
}, cn = (o, e) => (t, n) => e(t, n, o);
|
|
3444
|
+
let we = class extends Q {
|
|
3265
3445
|
constructor(o) {
|
|
3266
3446
|
super(), this._injector = o;
|
|
3267
3447
|
}
|
|
3268
3448
|
};
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
],
|
|
3449
|
+
we = hn([
|
|
3450
|
+
cn(0, m(v))
|
|
3451
|
+
], we);
|
|
3272
3452
|
export {
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3453
|
+
j as FPermission,
|
|
3454
|
+
k as FRange,
|
|
3455
|
+
A as FSelection,
|
|
3456
|
+
on as FSheetEventName,
|
|
3457
|
+
we as FSheetHooks,
|
|
3277
3458
|
I as FWorkbook,
|
|
3278
|
-
|
|
3459
|
+
g as FWorksheet
|
|
3279
3460
|
};
|