@univerjs/sheets 0.5.5 → 0.6.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/facade.js +1 -1
- package/lib/cjs/index.js +3 -3
- package/lib/es/facade.js +531 -396
- package/lib/es/index.js +537 -425
- package/lib/types/facade/f-defined-name.d.ts +22 -16
- package/lib/types/facade/f-enum.d.ts +3 -0
- package/lib/types/facade/f-event.d.ts +43 -41
- package/lib/types/facade/f-permission.d.ts +141 -9
- package/lib/types/facade/f-range.d.ts +155 -149
- package/lib/types/facade/f-selection.d.ts +3 -1
- package/lib/types/facade/f-sheet-hooks.d.ts +3 -0
- package/lib/types/facade/f-univer.d.ts +9 -3
- package/lib/types/facade/f-workbook.d.ts +13 -5
- package/lib/types/facade/f-worksheet.d.ts +2 -1
- package/lib/types/index.d.ts +1 -0
- package/lib/types/model/range-protection-rule.model.d.ts +1 -1
- package/lib/types/services/permission/permission-point/const.d.ts +117 -4
- package/lib/types/services/permission/range-permission/range-protection.ref-range.d.ts +1 -1
- package/lib/types/services/permission/range-permission/range-protection.service.d.ts +1 -1
- package/lib/types/services/permission/worksheet-permission/worksheet-permission-rule.model.d.ts +1 -1
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +3 -3
- package/package.json +8 -8
- package/lib/types/basics/__tests__/cell-type.spec.d.ts +0 -16
- package/lib/types/basics/__tests__/cell-value.spec.d.ts +0 -16
- package/lib/types/basics/__tests__/expand.data.d.ts +0 -2
- package/lib/types/basics/__tests__/expand.spec.d.ts +0 -16
- package/lib/types/basics/__tests__/rangeMerge.spec.d.ts +0 -16
- package/lib/types/basics/__tests__/row-column-value.spec.d.ts +0 -16
- package/lib/types/basics/__tests__/utils.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/add-merge-command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/clear-selection.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/copy-worksheet.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/create-command-test-bed.d.ts +0 -7
- package/lib/types/commands/commands/__tests__/delete-range.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/insert-range.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/insert-remove-rows-cols.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/move-range-commands.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/move-rows-cols.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/range-template-command.sepc.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/remove-rows-cols.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/remove-sheet.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-border.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-col-data.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-col-width.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-frozen.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-gridlines-command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-range-values.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-row-col-visible.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-row-data.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-row-height.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-style.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-tab-color.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-worksheet-default-style.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-worksheet-hide.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-worksheet-name.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-worksheet-order.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-worksheet-show.command.spec.d.ts +0 -16
- package/lib/types/commands/mutations/__tests__/create-command-test-bed.d.ts +0 -8
- package/lib/types/commands/mutations/__tests__/move-rows-cols.mutation.spec.d.ts +0 -16
- package/lib/types/commands/mutations/__tests__/remove-row-col.mutation.spec.d.ts +0 -16
- package/lib/types/controllers/__tests__/util.d.ts +0 -13
- package/lib/types/facade/__tests__/utils.spec.d.ts +0 -16
- package/lib/types/services/__tests__/move-active-cell.spec.d.ts +0 -16
- package/lib/types/services/__tests__/numfmt.service.test.d.ts +0 -16
- package/lib/types/services/__tests__/ref-range.setvice.spec.d.ts +0 -16
- package/lib/types/services/__tests__/util.d.ts +0 -14
- package/lib/types/services/ref-range/__tests__/__testing__.d.ts +0 -14
- package/lib/types/services/ref-range/__tests__/ref-range.service.spec.d.ts +0 -13
- package/lib/types/services/ref-range/__tests__/utils.spec.d.ts +0 -16
- package/lib/types/services/ref-range/__tests__/watch-range.spec.d.ts +0 -16
- package/lib/types/services/sheet-interceptor/__tests__/create-core-test-bed.d.ts +0 -13
- package/lib/types/services/sheet-interceptor/__tests__/sheet-interceptor.service.spec.d.ts +0 -16
package/lib/es/facade.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
var Ge = Object.defineProperty;
|
|
2
2
|
var qe = (r, e, t) => e in r ? Ge(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
3
|
var b = (r, e, t) => qe(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
import { Inject as u, Injector as y, IAuthzIoService as Ne, LocaleService as Te, ICommandService as
|
|
5
|
-
import { WorksheetProtectionRuleModel as Fe, RangeProtectionRuleModel as je, WorksheetProtectionPointModel as Oe, SetDefinedNameCommand as Q, SCOPE_WORKBOOK_VALUE_DEFINED_NAME as X, RemoveDefinedNameCommand as st, PermissionPointsDefinitions as it, WorkbookEditablePermission as Le, UnitObject as x, AddWorksheetProtectionMutation as ot, DeleteWorksheetProtectionMutation as
|
|
6
|
-
import { IDefinedNamesService as $e, serializeRange as ue, FormulaDataModel as
|
|
7
|
-
var
|
|
8
|
-
for (var s = n > 1 ? void 0 : n ?
|
|
4
|
+
import { Inject as u, Injector as y, IAuthzIoService as Ne, LocaleService as Te, ICommandService as m, IPermissionService as he, generateRandomId as Me, FBase as de, Rectangle as M, HorizontalAlign as U, VerticalAlign as P, isFormulaString as Ke, isCellV as Ye, isICellData as Je, ObjectMatrix as W, Tools as Qe, RANGE_TYPE as _, FBaseInitialable as ce, TextStyleValue as me, RichTextValue as E, BooleanNumber as g, WrapStrategy as Y, Dimension as le, ILogService as De, Direction as D, IResourceLoaderService as Xe, mergeWorksheetSnapshotWithDefault as Ze, UndoCommand as et, RedoCommand as tt, toDisposable as Ae, UniverInstanceType as p, IUniverInstanceService as J, FUniver as Be, CanceledError as nt, FEnum as rt, FEventName as We } from "@univerjs/core";
|
|
5
|
+
import { WorksheetProtectionRuleModel as Fe, RangeProtectionRuleModel as je, WorksheetProtectionPointModel as Oe, SetDefinedNameCommand as Q, SCOPE_WORKBOOK_VALUE_DEFINED_NAME as X, RemoveDefinedNameCommand as st, PermissionPointsDefinitions as it, WorkbookEditablePermission as Le, UnitObject as x, AddWorksheetProtectionMutation as ot, DeleteWorksheetProtectionMutation as at, getAllWorksheetPermissionPoint as ht, getAllWorksheetPermissionPointByPointPanel as _e, SetWorksheetPermissionPointsMutation as dt, AddRangeProtectionMutation as ct, DeleteRangeProtectionMutation as ut, SetRangeProtectionMutation as gt, WorksheetEditPermission as mt, WorksheetViewPermission as lt, SetBorderBasicCommand as _t, SetStyleCommand as I, SetRangeValuesCommand as N, SetTextWrapCommand as Z, SetVerticalTextAlignCommand as St, SetHorizontalTextAlignCommand as kt, addMergeCellsUtil as H, getAddMergeMutationRangeByType as Se, RemoveWorksheetMergeCommand as wt, SplitTextToColumnsCommand as Ct, SetWorksheetRangeThemeStyleCommand as ft, DeleteWorksheetRangeThemeStyleCommand as vt, SheetRangeThemeService as Ve, getPrimaryForRange as ee, SetSelectionsOperation as He, getNextPrimaryCell as It, SheetsSelectionsService as ze, SetWorksheetDefaultStyleMutation as bt, SetColDataCommand as ke, SetRowDataCommand as we, copyRangeStyles as A, InsertRowByRangeCommand as Ce, RemoveRowByRangeCommand as Rt, MoveRowsCommand as pt, SetRowHiddenCommand as fe, SetSpecificRowsVisibleCommand as ve, SetWorksheetRowIsAutoHeightMutation as yt, SetRowHeightCommand as Ie, SetWorksheetRowIsAutoHeightCommand as be, InsertColByRangeCommand as Re, RemoveColByRangeCommand as Et, MoveColsCommand as Ut, SetColHiddenCommand as pe, SetSpecificColsVisibleCommand as ye, SetColWidthCommand as Pt, SetFrozenCommand as z, CancelFrozenCommand as xt, ToggleGridlinesCommand as te, SetGridlinesColorCommand as ne, SetTabColorCommand as re, SetRangeValuesMutation as Ee, SetWorksheetHideCommand as se, SetWorksheetShowCommand as Nt, SetWorksheetNameCommand as ie, ClearSelectionAllCommand as Tt, ClearSelectionContentCommand as Mt, ClearSelectionFormatCommand as Dt, InsertSheetCommand as T, SetWorksheetActiveOperation as $, RemoveSheetCommand as oe, CopySheetCommand as At, SetWorksheetOrderCommand as ae, RegisterWorksheetRangeThemeStyleCommand as Bt, UnregisterWorksheetRangeThemeStyleCommand as Wt, RangeThemeStyle as Ft, SetWorksheetActivateCommand as Ue, COMMAND_LISTENER_VALUE_CHANGE as jt, getValueChangedEffectedRange as Ot, SheetValueChangeType as Lt, SheetSkeletonChangeType as Vt } from "@univerjs/sheets";
|
|
6
|
+
import { IDefinedNamesService as $e, serializeRange as ue, FormulaDataModel as Ht, serializeRangeWithSheet as zt, deserializeRangeWithSheet as $t } from "@univerjs/engine-formula";
|
|
7
|
+
var Gt = Object.defineProperty, qt = Object.getOwnPropertyDescriptor, Kt = (r, e, t, n) => {
|
|
8
|
+
for (var s = n > 1 ? void 0 : n ? qt(e, t) : e, i = r.length - 1, o; i >= 0; i--)
|
|
9
9
|
(o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
|
|
10
|
-
return n && s &&
|
|
10
|
+
return n && s && Gt(e, t, s), s;
|
|
11
11
|
}, w = (r, e) => (t, n) => e(t, n, r);
|
|
12
|
-
function
|
|
12
|
+
function Yt(r, e, t) {
|
|
13
13
|
const n = t.getDefinedNameMap(r);
|
|
14
14
|
if (n == null)
|
|
15
15
|
return e.t("definedName.defaultName") + 1;
|
|
16
16
|
const i = Array.from(Object.values(n)).length + 1, o = e.t("definedName.defaultName") + i;
|
|
17
17
|
if (t.getValueByName(r, o) == null)
|
|
18
18
|
return o;
|
|
19
|
-
let
|
|
19
|
+
let a = i + 1;
|
|
20
20
|
for (; ; ) {
|
|
21
|
-
const
|
|
22
|
-
if (t.getValueByName(r,
|
|
23
|
-
return
|
|
24
|
-
|
|
21
|
+
const h = e.t("definedName.defaultName") + a;
|
|
22
|
+
if (t.getValueByName(r, h) == null)
|
|
23
|
+
return h;
|
|
24
|
+
a++;
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
class V {
|
|
@@ -42,8 +42,8 @@ class V {
|
|
|
42
42
|
* ```ts
|
|
43
43
|
* const workbook = univerAPI.getActiveWorkbook();
|
|
44
44
|
* const definedNameBuilder = univerAPI.newDefinedName()
|
|
45
|
-
*
|
|
46
|
-
*
|
|
45
|
+
* .setName('MyDefinedName')
|
|
46
|
+
* .build();
|
|
47
47
|
* workbook.insertDefinedNameBuilder(definedNameBuilder);
|
|
48
48
|
* ```
|
|
49
49
|
*/
|
|
@@ -58,9 +58,9 @@ class V {
|
|
|
58
58
|
* ```ts
|
|
59
59
|
* const workbook = univerAPI.getActiveWorkbook();
|
|
60
60
|
* const definedNameBuilder = univerAPI.newDefinedName()
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
61
|
+
* .setFormula('SUM(Sheet1!$A$1)')
|
|
62
|
+
* .setName('MyDefinedName')
|
|
63
|
+
* .build();
|
|
64
64
|
* workbook.insertDefinedNameBuilder(definedNameBuilder);
|
|
65
65
|
* ```
|
|
66
66
|
*/
|
|
@@ -75,8 +75,8 @@ class V {
|
|
|
75
75
|
* ```ts
|
|
76
76
|
* const workbook = univerAPI.getActiveWorkbook();
|
|
77
77
|
* const definedNameBuilder = univerAPI.newDefinedName()
|
|
78
|
-
*
|
|
79
|
-
*
|
|
78
|
+
* .setRef('Sheet1!$A$1')
|
|
79
|
+
* .build();
|
|
80
80
|
* workbook.insertDefinedNameBuilder(definedNameBuilder);
|
|
81
81
|
* ```
|
|
82
82
|
*/
|
|
@@ -94,8 +94,8 @@ class V {
|
|
|
94
94
|
* ```ts
|
|
95
95
|
* const workbook = univerAPI.getActiveWorkbook();
|
|
96
96
|
* const definedNameBuilder = univerAPI.newDefinedName()
|
|
97
|
-
*
|
|
98
|
-
*
|
|
97
|
+
* .setRefByRange(1, 3, 2, 5)
|
|
98
|
+
* .build();
|
|
99
99
|
* workbook.insertDefinedNameBuilder(definedNameBuilder);
|
|
100
100
|
* ```
|
|
101
101
|
*/
|
|
@@ -115,8 +115,8 @@ class V {
|
|
|
115
115
|
* ```ts
|
|
116
116
|
* const workbook = univerAPI.getActiveWorkbook();
|
|
117
117
|
* const definedNameBuilder = univerAPI.newDefinedName()
|
|
118
|
-
*
|
|
119
|
-
*
|
|
118
|
+
* .setComment('This is a comment')
|
|
119
|
+
* .build();
|
|
120
120
|
* workbook.insertDefinedNameBuilder(definedNameBuilder);
|
|
121
121
|
* ```
|
|
122
122
|
*/
|
|
@@ -131,8 +131,8 @@ class V {
|
|
|
131
131
|
* ```ts
|
|
132
132
|
* const workbook = univerAPI.getActiveWorkbook();
|
|
133
133
|
* const definedNameBuilder = univerAPI.newDefinedName()
|
|
134
|
-
*
|
|
135
|
-
*
|
|
134
|
+
* .setHidden(true)
|
|
135
|
+
* .build();
|
|
136
136
|
* workbook.insertDefinedNameBuilder(definedNameBuilder);
|
|
137
137
|
* ```
|
|
138
138
|
*/
|
|
@@ -146,9 +146,9 @@ class V {
|
|
|
146
146
|
* ```ts
|
|
147
147
|
* const workbook = univerAPI.getActiveWorkbook();
|
|
148
148
|
* const definedNameBuilder = univerAPI.newDefinedName()
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
*
|
|
149
|
+
* .setRef('Sheet1!$A$1')
|
|
150
|
+
* .setName('MyDefinedName')
|
|
151
|
+
* .build();
|
|
152
152
|
* workbook.insertDefinedNameBuilder(definedNameBuilder);
|
|
153
153
|
* ```
|
|
154
154
|
*/
|
|
@@ -160,11 +160,11 @@ class V {
|
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
162
|
let F = class extends de {
|
|
163
|
-
constructor(r, e, t, n, s, i, o,
|
|
164
|
-
super(), this._definedNameParam = r, this._injector = e, this._commandService = t, this._permissionService = n, this._worksheetProtectionRuleModel = s, this._rangeProtectionRuleModel = i, this._worksheetProtectionPointRuleModel = o, this._authzIoService =
|
|
163
|
+
constructor(r, e, t, n, s, i, o, a, h, d) {
|
|
164
|
+
super(), this._definedNameParam = r, this._injector = e, this._commandService = t, this._permissionService = n, this._worksheetProtectionRuleModel = s, this._rangeProtectionRuleModel = i, this._worksheetProtectionPointRuleModel = o, this._authzIoService = a, this._localeService = h, this._definedNamesService = d;
|
|
165
165
|
}
|
|
166
166
|
_apply() {
|
|
167
|
-
this._definedNameParam.name === "" && (this._definedNameParam.name =
|
|
167
|
+
this._definedNameParam.name === "" && (this._definedNameParam.name = Yt(this._definedNameParam.unitId, this._localeService, this._definedNamesService)), this._commandService.syncExecuteCommand(Q.id, this._definedNameParam);
|
|
168
168
|
}
|
|
169
169
|
/**
|
|
170
170
|
* Gets the name of the defined name.
|
|
@@ -372,10 +372,10 @@ let F = class extends de {
|
|
|
372
372
|
return r.load(this._definedNameParam), r;
|
|
373
373
|
}
|
|
374
374
|
};
|
|
375
|
-
F =
|
|
375
|
+
F = Kt([
|
|
376
376
|
w(1, u(y)),
|
|
377
|
-
w(2,
|
|
378
|
-
w(3,
|
|
377
|
+
w(2, m),
|
|
378
|
+
w(3, he),
|
|
379
379
|
w(4, u(Fe)),
|
|
380
380
|
w(5, u(je)),
|
|
381
381
|
w(6, u(Oe)),
|
|
@@ -383,27 +383,43 @@ F = qt([
|
|
|
383
383
|
w(8, u(Te)),
|
|
384
384
|
w(9, $e)
|
|
385
385
|
], F);
|
|
386
|
-
var
|
|
387
|
-
for (var s = n > 1 ? void 0 : n ?
|
|
386
|
+
var Jt = Object.defineProperty, Qt = Object.getOwnPropertyDescriptor, Xt = (r, e, t, n) => {
|
|
387
|
+
for (var s = n > 1 ? void 0 : n ? Qt(e, t) : e, i = r.length - 1, o; i >= 0; i--)
|
|
388
388
|
(o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
|
|
389
|
-
return n && s &&
|
|
389
|
+
return n && s && Jt(e, t, s), s;
|
|
390
390
|
}, R = (r, e) => (t, n) => e(t, n, r);
|
|
391
391
|
let j = class extends de {
|
|
392
|
-
constructor(e, t, n, s, i, o,
|
|
392
|
+
constructor(e, t, n, s, i, o, a) {
|
|
393
393
|
super();
|
|
394
|
+
/**
|
|
395
|
+
* Permission point definition, can read the point constructor want to modify from here
|
|
396
|
+
*/
|
|
394
397
|
b(this, "permissionPointsDefinition", it);
|
|
398
|
+
/**
|
|
399
|
+
* An observable object used to monitor permission change events within a range, thereby triggering corresponding subsequent processing.
|
|
400
|
+
*/
|
|
395
401
|
b(this, "rangeRuleChangedAfterAuth$");
|
|
402
|
+
/**
|
|
403
|
+
* An observable object used to monitor permission change events within a worksheet, thereby triggering corresponding subsequent processing.
|
|
404
|
+
*/
|
|
396
405
|
b(this, "sheetRuleChangedAfterAuth$");
|
|
397
|
-
this._injector = e, this._commandService = t, this._permissionService = n, this._worksheetProtectionRuleModel = s, this._rangeProtectionRuleModel = i, this._worksheetProtectionPointRuleModel = o, this._authzIoService =
|
|
406
|
+
this._injector = e, this._commandService = t, this._permissionService = n, this._worksheetProtectionRuleModel = s, this._rangeProtectionRuleModel = i, this._worksheetProtectionPointRuleModel = o, this._authzIoService = a, this.rangeRuleChangedAfterAuth$ = this._rangeProtectionRuleModel.ruleRefresh$, this.sheetRuleChangedAfterAuth$ = this._worksheetProtectionRuleModel.ruleRefresh$;
|
|
398
407
|
}
|
|
399
408
|
/**
|
|
400
409
|
* Configures a specific permission point for a workbook.
|
|
401
|
-
*
|
|
402
410
|
* This function sets or updates a permission point for a workbook identified by `unitId`.
|
|
403
411
|
* It creates a new permission point if it does not already exist, and updates the point with the provided value.
|
|
404
412
|
* @param {string} unitId - The unique identifier of the workbook for which the permission is being set.
|
|
405
413
|
* @param {WorkbookPermissionPointConstructor} FPointClass - The constructor function for creating a permission point instance. Other point constructors can See the [permission-point documentation](https://github.com/dream-num/univer/tree/dev/packages/sheets/src/services/permission/permission-point) for more details.
|
|
406
414
|
* @param {boolean} value - The boolean value to determine whether the permission point is enabled or disabled.
|
|
415
|
+
*
|
|
416
|
+
* @example
|
|
417
|
+
* ```typescript
|
|
418
|
+
* const workbook = univerAPI.getActiveWorkbook();
|
|
419
|
+
* const permission = workbook.getPermission();
|
|
420
|
+
* const unitId = workbook.getId();
|
|
421
|
+
* permission.setWorkbookPermissionPoint(unitId, permission.permissionPointsDefinition.WorkbookEditablePermission, false)
|
|
422
|
+
* ```
|
|
407
423
|
*/
|
|
408
424
|
setWorkbookPermissionPoint(e, t, n) {
|
|
409
425
|
const s = new t(e);
|
|
@@ -413,15 +429,39 @@ let j = class extends de {
|
|
|
413
429
|
* This function is used to set whether the workbook can be edited
|
|
414
430
|
* @param {string} unitId - The unique identifier of the workbook for which the permission is being set.
|
|
415
431
|
* @param {boolean} value - A value that controls whether the workbook can be edited
|
|
432
|
+
*
|
|
433
|
+
* @example
|
|
434
|
+
* ```typescript
|
|
435
|
+
* const workbook = univerAPI.getActiveWorkbook();
|
|
436
|
+
* const permission = workbook.getPermission();
|
|
437
|
+
* const unitId = workbook.getId();
|
|
438
|
+
* permission.setWorkbookEditPermission(unitId, false);
|
|
439
|
+
* ```
|
|
416
440
|
*/
|
|
417
441
|
setWorkbookEditPermission(e, t) {
|
|
418
442
|
this.setWorkbookPermissionPoint(e, Le, t);
|
|
419
443
|
}
|
|
420
444
|
/**
|
|
421
445
|
* This function is used to add a base permission for a worksheet.
|
|
446
|
+
* Note that after adding, only the background mask of the permission module will be rendered. If you want to modify the function permissions,
|
|
447
|
+
* you need to modify the permission points with the permissionId returned by this function.
|
|
422
448
|
* @param {string} unitId - The unique identifier of the workbook for which the permission is being set.
|
|
423
449
|
* @param {string} subUnitId - The unique identifier of the worksheet for which the permission is being set.
|
|
424
450
|
* @returns {Promise<string | undefined>} - Returns the `permissionId` if the permission is successfully added. If the operation fails or no result is returned, it resolves to `undefined`.
|
|
451
|
+
*
|
|
452
|
+
* @example
|
|
453
|
+
* ```typescript
|
|
454
|
+
* const workbook = univerAPI.getActiveWorkbook();
|
|
455
|
+
* const permission = workbook.getPermission();
|
|
456
|
+
* const unitId = workbook.getId();
|
|
457
|
+
* const worksheet = workbook.getActiveSheet();
|
|
458
|
+
* const subUnitId = worksheet.getSheetId();
|
|
459
|
+
* // Note that there will be no permission changes after this step is completed. It only returns an ID for subsequent permission changes.
|
|
460
|
+
* // For details, please see the example of the **`setWorksheetPermissionPoint`** API.
|
|
461
|
+
* const permissionId = await permission.addWorksheetBasePermission(unitId, subUnitId)
|
|
462
|
+
* // Can still edit and read it.
|
|
463
|
+
* console.log('debugger', permissionId)
|
|
464
|
+
* ```
|
|
425
465
|
*/
|
|
426
466
|
async addWorksheetBasePermission(e, t) {
|
|
427
467
|
if (this._rangeProtectionRuleModel.getSubunitRuleList(e, t).length > 0)
|
|
@@ -452,12 +492,22 @@ let j = class extends de {
|
|
|
452
492
|
* Delete the entire table protection set for the worksheet and reset the point permissions of the worksheet to true
|
|
453
493
|
* @param {string} unitId - The unique identifier of the workbook for which the permission is being set.
|
|
454
494
|
* @param {string} subUnitId - The unique identifier of the worksheet for which the permission is being set.
|
|
495
|
+
*
|
|
496
|
+
* @example
|
|
497
|
+
* ```typescript
|
|
498
|
+
* const workbook = univerAPI.getActiveWorkbook();
|
|
499
|
+
* const permission = workbook.getPermission();
|
|
500
|
+
* const unitId = workbook.getId();
|
|
501
|
+
* const worksheet = workbook.getActiveSheet();
|
|
502
|
+
* const subUnitId = worksheet.getSheetId();
|
|
503
|
+
* permission.removeWorksheetPermission(unitId, subUnitId);
|
|
504
|
+
* ```
|
|
455
505
|
*/
|
|
456
506
|
removeWorksheetPermission(e, t) {
|
|
457
|
-
this._commandService.syncExecuteCommand(
|
|
507
|
+
this._commandService.syncExecuteCommand(at.id, {
|
|
458
508
|
unitId: e,
|
|
459
509
|
subUnitId: t
|
|
460
|
-
}), [...
|
|
510
|
+
}), [...ht(), ..._e()].forEach((n) => {
|
|
461
511
|
const s = new n(e, t);
|
|
462
512
|
this._permissionService.updatePermissionPoint(s.id, !0);
|
|
463
513
|
}), this._worksheetProtectionPointRuleModel.deleteRule(e, t);
|
|
@@ -471,11 +521,22 @@ let j = class extends de {
|
|
|
471
521
|
* See the [permission-point documentation](https://github.com/dream-num/univer/tree/dev/packages/sheets/src/services/permission/permission-point) for more details.
|
|
472
522
|
* @param {boolean} value - The new permission value to be set for the worksheet.
|
|
473
523
|
* @returns {Promise<string | undefined>} - Returns the `permissionId` if the permission point is successfully set or created. If no permission is set, it resolves to `undefined`.
|
|
524
|
+
*
|
|
525
|
+
* @example
|
|
526
|
+
* ```typescript
|
|
527
|
+
* const workbook = univerAPI.getActiveWorkbook();
|
|
528
|
+
* const permission = workbook.getPermission();
|
|
529
|
+
* const unitId = workbook.getId();
|
|
530
|
+
* const worksheet = workbook.getActiveSheet();
|
|
531
|
+
* const subUnitId = worksheet.getSheetId();
|
|
532
|
+
* const permissionId = await permission.addWorksheetBasePermission(unitId, subUnitId)
|
|
533
|
+
* // After this line of code , the worksheet will no longer be editable
|
|
534
|
+
* permission.setWorksheetPermissionPoint(unitId, subUnitId, permission.permissionPointsDefinition.WorksheetEditPermission, false);
|
|
474
535
|
*/
|
|
475
536
|
async setWorksheetPermissionPoint(e, t, n, s) {
|
|
476
537
|
const i = this._worksheetProtectionRuleModel.getRule(e, t);
|
|
477
538
|
let o;
|
|
478
|
-
if (n ===
|
|
539
|
+
if (n === mt || n === lt)
|
|
479
540
|
if (i)
|
|
480
541
|
o = i.permissionId;
|
|
481
542
|
else {
|
|
@@ -494,17 +555,36 @@ let j = class extends de {
|
|
|
494
555
|
name: "",
|
|
495
556
|
scope: void 0
|
|
496
557
|
}
|
|
497
|
-
}), this._commandService.syncExecuteCommand(dt.id, { unitId: e, subUnitId: t, permissionId: o }));
|
|
558
|
+
}), this._commandService.syncExecuteCommand(dt.id, { unitId: e, subUnitId: t, rule: { unitId: e, subUnitId: t, permissionId: o } }));
|
|
498
559
|
}
|
|
499
|
-
const
|
|
500
|
-
return this._permissionService.getPermissionPoint(
|
|
560
|
+
const h = new n(e, t);
|
|
561
|
+
return this._permissionService.getPermissionPoint(h.id) || this._permissionService.addPermissionPoint(h), this._permissionService.updatePermissionPoint(h.id, s), o;
|
|
501
562
|
}
|
|
502
563
|
/**
|
|
503
564
|
* Adds a range protection to the worksheet.
|
|
565
|
+
* Note that after adding, only the background mask of the permission module will be rendered. If you want to modify the function permissions,
|
|
566
|
+
* you need to modify the permission points with the permissionId returned by this function.
|
|
504
567
|
* @param {string} unitId - The unique identifier of the workbook.
|
|
505
568
|
* @param {string} subUnitId - The unique identifier of the worksheet.
|
|
506
|
-
* @param {
|
|
569
|
+
* @param {FRange[]} ranges - The ranges to be protected.
|
|
507
570
|
* @returns {Promise<{ permissionId: string, ruleId: string } | undefined>} - Returns an object containing the `permissionId` and `ruleId` if the range protection is successfully added. If the operation fails or no result is returned, it resolves to `undefined`. permissionId is used to stitch permission point ID,ruleId is used to store permission rules
|
|
571
|
+
*
|
|
572
|
+
* @example
|
|
573
|
+
* ```typescript
|
|
574
|
+
*const workbook = univerAPI.getActiveWorkbook();
|
|
575
|
+
* const permission = workbook.getPermission();
|
|
576
|
+
* const unitId = workbook.getId();
|
|
577
|
+
* const worksheet = workbook.getActiveSheet();
|
|
578
|
+
* const subUnitId = worksheet.getSheetId();
|
|
579
|
+
* const range = worksheet.getRange(0,0,2,2);
|
|
580
|
+
* const ranges = [];
|
|
581
|
+
* ranges.push(range);
|
|
582
|
+
* // Note that there will be no permission changes after this step is completed. It only returns an ID for subsequent permission changes.
|
|
583
|
+
* // For details, please see the example of the **`setRangeProtectionPermissionPoint`** API.
|
|
584
|
+
* const res = await permission.addRangeBaseProtection(unitId, subUnitId, ranges);
|
|
585
|
+
* const {permissionId, ruleId} = res;
|
|
586
|
+
* console.log('debugger', permissionId, ruleId);
|
|
587
|
+
* ```
|
|
508
588
|
*/
|
|
509
589
|
async addRangeBaseProtection(e, t, n) {
|
|
510
590
|
const s = await this._authzIoService.create({
|
|
@@ -518,7 +598,7 @@ let j = class extends de {
|
|
|
518
598
|
}), i = `ruleId_${Me(6)}`;
|
|
519
599
|
if (this._worksheetProtectionRuleModel.getRule(e, t))
|
|
520
600
|
throw new Error("sheet protection cannot intersect with range protection");
|
|
521
|
-
if (this._rangeProtectionRuleModel.getSubunitRuleList(e, t).some((c) => c.ranges.some((v) => n.some((
|
|
601
|
+
if (this._rangeProtectionRuleModel.getSubunitRuleList(e, t).some((c) => c.ranges.some((v) => n.some((S) => M.intersects(S.getRange(), v)))))
|
|
522
602
|
throw new Error("range protection cannot intersect");
|
|
523
603
|
if (this._commandService.syncExecuteCommand(ct.id, {
|
|
524
604
|
unitId: e,
|
|
@@ -528,7 +608,7 @@ let j = class extends de {
|
|
|
528
608
|
unitType: x.SelectRange,
|
|
529
609
|
unitId: e,
|
|
530
610
|
subUnitId: t,
|
|
531
|
-
ranges: n,
|
|
611
|
+
ranges: n.map((c) => c.getRange()),
|
|
532
612
|
id: i
|
|
533
613
|
}]
|
|
534
614
|
}))
|
|
@@ -542,6 +622,21 @@ let j = class extends de {
|
|
|
542
622
|
* @param {string} unitId - The unique identifier of the workbook.
|
|
543
623
|
* @param {string} subUnitId - The unique identifier of the worksheet.
|
|
544
624
|
* @param {string[]} ruleIds - The rule IDs of the range protection to be removed.
|
|
625
|
+
*
|
|
626
|
+
* @example
|
|
627
|
+
* ```typescript
|
|
628
|
+
* const workbook = univerAPI.getActiveWorkbook();
|
|
629
|
+
* const permission = workbook.getPermission();
|
|
630
|
+
* const unitId = workbook.getId();
|
|
631
|
+
* const worksheet = workbook.getActiveSheet();
|
|
632
|
+
* const subUnitId = worksheet.getSheetId();
|
|
633
|
+
* const range = worksheet.getRange(0,0,2,2);
|
|
634
|
+
* const ranges = [];
|
|
635
|
+
* ranges.push(range);
|
|
636
|
+
* const res = await permission.addRangeBaseProtection(unitId, subUnitId, ranges);
|
|
637
|
+
* const ruleId = res.ruleId;
|
|
638
|
+
* permission.removeRangeProtection(unitId, subUnitId, [ruleId]);
|
|
639
|
+
* ```
|
|
545
640
|
*/
|
|
546
641
|
removeRangeProtection(e, t, n) {
|
|
547
642
|
this._commandService.syncExecuteCommand(ut.id, {
|
|
@@ -549,8 +644,8 @@ let j = class extends de {
|
|
|
549
644
|
subUnitId: t,
|
|
550
645
|
ruleIds: n
|
|
551
646
|
}) && this._rangeProtectionRuleModel.getSubunitRuleList(e, t).length === 0 && (this._worksheetProtectionPointRuleModel.deleteRule(e, t), [..._e()].forEach((o) => {
|
|
552
|
-
const
|
|
553
|
-
this._permissionService.updatePermissionPoint(
|
|
647
|
+
const a = new o(e, t);
|
|
648
|
+
this._permissionService.updatePermissionPoint(a.id, a.value);
|
|
554
649
|
}));
|
|
555
650
|
}
|
|
556
651
|
/**
|
|
@@ -561,6 +656,24 @@ let j = class extends de {
|
|
|
561
656
|
* @param {RangePermissionPointConstructor} FPointClass - The constructor for the range permission point class.
|
|
562
657
|
* See the [permission-point documentation](https://github.com/dream-num/univer/tree/dev/packages/sheets/src/services/permission/permission-point) for more details.
|
|
563
658
|
* @param {boolean} value - The new permission value to be set for the range (e.g., true for allowing access, false for restricting access).
|
|
659
|
+
*
|
|
660
|
+
* @example
|
|
661
|
+
* ```typescript
|
|
662
|
+
* const workbook = univerAPI.getActiveWorkbook();
|
|
663
|
+
* const permission = workbook.getPermission();
|
|
664
|
+
* const unitId = workbook.getId();
|
|
665
|
+
* const worksheet = workbook.getActiveSheet();
|
|
666
|
+
* const subUnitId = worksheet.getSheetId();
|
|
667
|
+
* const range = worksheet.getRange(0, 0, 2, 2);
|
|
668
|
+
* const ranges = [];
|
|
669
|
+
* ranges.push(range);
|
|
670
|
+
* // Note that there will be no permission changes after this step is completed. It only returns an ID for subsequent permission changes.
|
|
671
|
+
* // For details, please see the example of the **`setRangeProtectionPermissionPoint`** API.
|
|
672
|
+
* const res = await permission.addRangeBaseProtection(unitId, subUnitId, ranges);
|
|
673
|
+
* const {permissionId, ruleId} = res;
|
|
674
|
+
* // After passing the following line of code, the range set above will become uneditable
|
|
675
|
+
* permission.setRangeProtectionPermissionPoint(unitId,subUnitId,permissionId, permission.permissionPointsDefinition.RangeProtectionPermissionEditPoint, false);
|
|
676
|
+
* ```
|
|
564
677
|
*/
|
|
565
678
|
setRangeProtectionPermissionPoint(e, t, n, s, i) {
|
|
566
679
|
const o = new s(e, t, n);
|
|
@@ -576,11 +689,27 @@ let j = class extends de {
|
|
|
576
689
|
* @param {string} subUnitId - The unique identifier of the worksheet within the workbook.
|
|
577
690
|
* @param {string} ruleId - The ruleId of the range protection rule that is being updated.
|
|
578
691
|
* @param {IRange[]} ranges - The array of new ranges to be set for the range protection rule.
|
|
692
|
+
*
|
|
693
|
+
* @example
|
|
694
|
+
* ```typescript
|
|
695
|
+
* const workbook = univerAPI.getActiveWorkbook();
|
|
696
|
+
* const permission = workbook.getPermission();
|
|
697
|
+
* const unitId = workbook.getId();
|
|
698
|
+
* const worksheet = workbook.getActiveSheet();
|
|
699
|
+
* const subUnitId = worksheet.getSheetId();
|
|
700
|
+
* const range = worksheet.getRange(0, 0, 2, 2);
|
|
701
|
+
* const ranges = [];
|
|
702
|
+
* ranges.push(range);
|
|
703
|
+
* const res = await permission.addRangeBaseProtection(unitId, subUnitId, ranges);
|
|
704
|
+
* const {permissionId, ruleId} = res;
|
|
705
|
+
* const newRange = worksheet.getRange(3, 3, 2, 2);
|
|
706
|
+
* permission.setRangeProtectionRanges(unitId, subUnitId, ruleId, [newRange]);
|
|
707
|
+
* ```
|
|
579
708
|
*/
|
|
580
709
|
setRangeProtectionRanges(e, t, n, s) {
|
|
581
710
|
const i = this._rangeProtectionRuleModel.getRule(e, t, n);
|
|
582
711
|
if (i) {
|
|
583
|
-
if (this._rangeProtectionRuleModel.getSubunitRuleList(e, t).filter((
|
|
712
|
+
if (this._rangeProtectionRuleModel.getSubunitRuleList(e, t).filter((h) => h.id !== n).some((h) => h.ranges.some((d) => s.some((c) => M.intersects(c.getRange(), d)))))
|
|
584
713
|
throw new Error("range protection cannot intersect");
|
|
585
714
|
this._commandService.syncExecuteCommand(gt.id, {
|
|
586
715
|
unitId: e,
|
|
@@ -588,22 +717,22 @@ let j = class extends de {
|
|
|
588
717
|
ruleId: n,
|
|
589
718
|
rule: {
|
|
590
719
|
...i,
|
|
591
|
-
ranges: s
|
|
720
|
+
ranges: s.map((h) => h.getRange())
|
|
592
721
|
}
|
|
593
722
|
});
|
|
594
723
|
}
|
|
595
724
|
}
|
|
596
725
|
};
|
|
597
|
-
j =
|
|
726
|
+
j = Xt([
|
|
598
727
|
R(0, u(y)),
|
|
599
|
-
R(1,
|
|
600
|
-
R(2,
|
|
728
|
+
R(1, m),
|
|
729
|
+
R(2, he),
|
|
601
730
|
R(3, u(Fe)),
|
|
602
731
|
R(4, u(je)),
|
|
603
732
|
R(5, u(Oe)),
|
|
604
733
|
R(6, u(Ne))
|
|
605
734
|
], j);
|
|
606
|
-
function
|
|
735
|
+
function Zt(r) {
|
|
607
736
|
switch (r) {
|
|
608
737
|
case "left":
|
|
609
738
|
return U.LEFT;
|
|
@@ -615,7 +744,7 @@ function Xt(r) {
|
|
|
615
744
|
throw new Error(`Invalid horizontal alignment: ${r}`);
|
|
616
745
|
}
|
|
617
746
|
}
|
|
618
|
-
function
|
|
747
|
+
function en(r) {
|
|
619
748
|
switch (r) {
|
|
620
749
|
case U.LEFT:
|
|
621
750
|
return "left";
|
|
@@ -627,7 +756,7 @@ function Zt(r) {
|
|
|
627
756
|
throw new Error(`Invalid horizontal alignment: ${r}`);
|
|
628
757
|
}
|
|
629
758
|
}
|
|
630
|
-
function
|
|
759
|
+
function tn(r) {
|
|
631
760
|
switch (r) {
|
|
632
761
|
case "top":
|
|
633
762
|
return P.TOP;
|
|
@@ -639,7 +768,7 @@ function en(r) {
|
|
|
639
768
|
throw new Error(`Invalid vertical alignment: ${r}`);
|
|
640
769
|
}
|
|
641
770
|
}
|
|
642
|
-
function
|
|
771
|
+
function nn(r) {
|
|
643
772
|
switch (r) {
|
|
644
773
|
case P.TOP:
|
|
645
774
|
return "top";
|
|
@@ -665,12 +794,12 @@ function O(r) {
|
|
|
665
794
|
function Pe(r, e) {
|
|
666
795
|
const t = new W(), { startRow: n, startColumn: s, endRow: i, endColumn: o } = e;
|
|
667
796
|
if (Qe.isArray(r))
|
|
668
|
-
for (let
|
|
669
|
-
for (let
|
|
670
|
-
t.setValue(
|
|
797
|
+
for (let a = 0; a <= i - n; a++)
|
|
798
|
+
for (let h = 0; h <= o - s; h++)
|
|
799
|
+
t.setValue(a + n, h + s, O(r[a][h]));
|
|
671
800
|
else
|
|
672
|
-
new W(r).forValue((
|
|
673
|
-
t.setValue(
|
|
801
|
+
new W(r).forValue((h, d, c) => {
|
|
802
|
+
t.setValue(h, d, O(c));
|
|
674
803
|
});
|
|
675
804
|
return t.getMatrix();
|
|
676
805
|
}
|
|
@@ -692,12 +821,12 @@ function q(r, e) {
|
|
|
692
821
|
rangeType: _.COLUMN
|
|
693
822
|
};
|
|
694
823
|
}
|
|
695
|
-
var
|
|
696
|
-
for (var s = n > 1 ? void 0 : n ?
|
|
824
|
+
var rn = Object.defineProperty, sn = Object.getOwnPropertyDescriptor, on = (r, e, t, n) => {
|
|
825
|
+
for (var s = n > 1 ? void 0 : n ? sn(e, t) : e, i = r.length - 1, o; i >= 0; i--)
|
|
697
826
|
(o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
|
|
698
|
-
return n && s &&
|
|
827
|
+
return n && s && rn(e, t, s), s;
|
|
699
828
|
}, K = (r, e) => (t, n) => e(t, n, r);
|
|
700
|
-
let
|
|
829
|
+
let k = class extends ce {
|
|
701
830
|
constructor(r, e, t, n, s, i) {
|
|
702
831
|
super(n), this._workbook = r, this._worksheet = e, this._range = t, this._injector = n, this._commandService = s, this._formulaDataModel = i;
|
|
703
832
|
}
|
|
@@ -707,9 +836,9 @@ let S = class extends ce {
|
|
|
707
836
|
* @example
|
|
708
837
|
* ```ts
|
|
709
838
|
* univerAPI.getActiveWorkbook()
|
|
710
|
-
*
|
|
711
|
-
*
|
|
712
|
-
*
|
|
839
|
+
* .getActiveSheet()
|
|
840
|
+
* .getActiveRange()
|
|
841
|
+
* .getUnitId()
|
|
713
842
|
* ```
|
|
714
843
|
*/
|
|
715
844
|
getUnitId() {
|
|
@@ -721,9 +850,9 @@ let S = class extends ce {
|
|
|
721
850
|
* @example
|
|
722
851
|
* ```ts
|
|
723
852
|
* univerAPI.getActiveWorkbook()
|
|
724
|
-
*
|
|
725
|
-
*
|
|
726
|
-
*
|
|
853
|
+
* .getActiveSheet()
|
|
854
|
+
* .getActiveRange()
|
|
855
|
+
* .getSheetName()
|
|
727
856
|
* ```
|
|
728
857
|
*/
|
|
729
858
|
getSheetName() {
|
|
@@ -735,9 +864,9 @@ let S = class extends ce {
|
|
|
735
864
|
* @example
|
|
736
865
|
* ```ts
|
|
737
866
|
* univerAPI.getActiveWorkbook()
|
|
738
|
-
*
|
|
739
|
-
*
|
|
740
|
-
*
|
|
867
|
+
* .getActiveSheet()
|
|
868
|
+
* .getActiveRange()
|
|
869
|
+
* .getSheetId()
|
|
741
870
|
* ```
|
|
742
871
|
*/
|
|
743
872
|
getSheetId() {
|
|
@@ -749,9 +878,9 @@ let S = class extends ce {
|
|
|
749
878
|
* @example
|
|
750
879
|
* ```ts
|
|
751
880
|
* univerAPI.getActiveWorkbook()
|
|
752
|
-
*
|
|
753
|
-
*
|
|
754
|
-
*
|
|
881
|
+
* .getActiveSheet()
|
|
882
|
+
* .getActiveRange()
|
|
883
|
+
* .getRange()
|
|
755
884
|
* ```
|
|
756
885
|
*/
|
|
757
886
|
getRange() {
|
|
@@ -763,9 +892,9 @@ let S = class extends ce {
|
|
|
763
892
|
* @example
|
|
764
893
|
* ```ts
|
|
765
894
|
* univerAPI.getActiveWorkbook()
|
|
766
|
-
*
|
|
767
|
-
*
|
|
768
|
-
*
|
|
895
|
+
* .getActiveSheet()
|
|
896
|
+
* .getActiveRange()
|
|
897
|
+
* .getRow()
|
|
769
898
|
* ```
|
|
770
899
|
*/
|
|
771
900
|
getRow() {
|
|
@@ -777,9 +906,9 @@ let S = class extends ce {
|
|
|
777
906
|
* @example
|
|
778
907
|
* ```ts
|
|
779
908
|
* univerAPI.getActiveWorkbook()
|
|
780
|
-
*
|
|
781
|
-
*
|
|
782
|
-
*
|
|
909
|
+
* .getActiveSheet()
|
|
910
|
+
* .getActiveRange()
|
|
911
|
+
* .getColumn()
|
|
783
912
|
* ```
|
|
784
913
|
*/
|
|
785
914
|
getColumn() {
|
|
@@ -791,9 +920,9 @@ let S = class extends ce {
|
|
|
791
920
|
* @example
|
|
792
921
|
* ```ts
|
|
793
922
|
* univerAPI.getActiveWorkbook()
|
|
794
|
-
*
|
|
795
|
-
*
|
|
796
|
-
*
|
|
923
|
+
* .getActiveSheet()
|
|
924
|
+
* .getActiveRange()
|
|
925
|
+
* .getWidth()
|
|
797
926
|
* ```
|
|
798
927
|
*/
|
|
799
928
|
getWidth() {
|
|
@@ -805,9 +934,9 @@ let S = class extends ce {
|
|
|
805
934
|
* @example
|
|
806
935
|
* ```ts
|
|
807
936
|
* univerAPI.getActiveWorkbook()
|
|
808
|
-
*
|
|
809
|
-
*
|
|
810
|
-
*
|
|
937
|
+
* .getActiveSheet()
|
|
938
|
+
* .getActiveRange()
|
|
939
|
+
* .getHeight()
|
|
811
940
|
* ```
|
|
812
941
|
*/
|
|
813
942
|
getHeight() {
|
|
@@ -819,9 +948,9 @@ let S = class extends ce {
|
|
|
819
948
|
* @example
|
|
820
949
|
* ```ts
|
|
821
950
|
* univerAPI.getActiveWorkbook()
|
|
822
|
-
*
|
|
823
|
-
*
|
|
824
|
-
*
|
|
951
|
+
* .getActiveSheet()
|
|
952
|
+
* .getActiveRange()
|
|
953
|
+
* .isMerged()
|
|
825
954
|
* ```
|
|
826
955
|
*/
|
|
827
956
|
isMerged() {
|
|
@@ -834,9 +963,9 @@ let S = class extends ce {
|
|
|
834
963
|
* @example
|
|
835
964
|
* ```ts
|
|
836
965
|
* univerAPI.getActiveWorkbook()
|
|
837
|
-
*
|
|
838
|
-
*
|
|
839
|
-
*
|
|
966
|
+
* .getActiveSheet()
|
|
967
|
+
* .getActiveRange()
|
|
968
|
+
* .getCellStyleData()
|
|
840
969
|
* ```
|
|
841
970
|
*/
|
|
842
971
|
getCellStyleData() {
|
|
@@ -850,14 +979,14 @@ let S = class extends ce {
|
|
|
850
979
|
* @example
|
|
851
980
|
* ```ts
|
|
852
981
|
* univerAPI.getActiveWorkbook()
|
|
853
|
-
*
|
|
854
|
-
*
|
|
855
|
-
*
|
|
982
|
+
* .getActiveSheet()
|
|
983
|
+
* .getActiveRange()
|
|
984
|
+
* .getCellStyle()
|
|
856
985
|
* ```
|
|
857
986
|
*/
|
|
858
987
|
getCellStyle() {
|
|
859
988
|
const r = this.getCellStyleData();
|
|
860
|
-
return r ?
|
|
989
|
+
return r ? me.create(r) : null;
|
|
861
990
|
}
|
|
862
991
|
/**
|
|
863
992
|
* Returns the cell styles for the cells in the range.
|
|
@@ -865,9 +994,9 @@ let S = class extends ce {
|
|
|
865
994
|
* @example
|
|
866
995
|
* ```ts
|
|
867
996
|
* univerAPI.getActiveWorkbook()
|
|
868
|
-
*
|
|
869
|
-
*
|
|
870
|
-
*
|
|
997
|
+
* .getActiveSheet()
|
|
998
|
+
* .getActiveRange()
|
|
999
|
+
* .getCellStyles()
|
|
871
1000
|
* ```
|
|
872
1001
|
*/
|
|
873
1002
|
getCellStyles() {
|
|
@@ -875,7 +1004,7 @@ let S = class extends ce {
|
|
|
875
1004
|
return r.map((t) => t.map((n) => {
|
|
876
1005
|
if (!n) return null;
|
|
877
1006
|
const s = e.getStyleByCell(n);
|
|
878
|
-
return s ?
|
|
1007
|
+
return s ? me.create(s) : null;
|
|
879
1008
|
}));
|
|
880
1009
|
}
|
|
881
1010
|
getValue(r) {
|
|
@@ -883,13 +1012,13 @@ let S = class extends ce {
|
|
|
883
1012
|
return r ? this.getValueAndRichTextValue() : (t = (e = this._worksheet.getCell(this._range.startRow, this._range.startColumn)) == null ? void 0 : e.v) != null ? t : null;
|
|
884
1013
|
}
|
|
885
1014
|
getValues(r) {
|
|
886
|
-
var o,
|
|
1015
|
+
var o, a;
|
|
887
1016
|
r && this.getValueAndRichTextValues();
|
|
888
1017
|
const { startRow: e, endRow: t, startColumn: n, endColumn: s } = this._range, i = [];
|
|
889
|
-
for (let
|
|
1018
|
+
for (let h = e; h <= t; h++) {
|
|
890
1019
|
const d = [];
|
|
891
1020
|
for (let c = n; c <= s; c++)
|
|
892
|
-
d.push((
|
|
1021
|
+
d.push((a = (o = this._worksheet.getCell(h, c)) == null ? void 0 : o.v) != null ? a : null);
|
|
893
1022
|
i.push(d);
|
|
894
1023
|
}
|
|
895
1024
|
return i;
|
|
@@ -900,9 +1029,9 @@ let S = class extends ce {
|
|
|
900
1029
|
* @example
|
|
901
1030
|
* ```ts
|
|
902
1031
|
* univerAPI.getActiveWorkbook()
|
|
903
|
-
*
|
|
904
|
-
*
|
|
905
|
-
*
|
|
1032
|
+
* .getActiveSheet()
|
|
1033
|
+
* .getActiveRange()
|
|
1034
|
+
* .getCellData()
|
|
906
1035
|
* ```
|
|
907
1036
|
*/
|
|
908
1037
|
getCellData() {
|
|
@@ -915,9 +1044,9 @@ let S = class extends ce {
|
|
|
915
1044
|
* @example
|
|
916
1045
|
* ```ts
|
|
917
1046
|
* univerAPI.getActiveWorkbook()
|
|
918
|
-
*
|
|
919
|
-
*
|
|
920
|
-
*
|
|
1047
|
+
* .getActiveSheet()
|
|
1048
|
+
* .getActiveRange()
|
|
1049
|
+
* .getCellDatas()
|
|
921
1050
|
* ```
|
|
922
1051
|
*/
|
|
923
1052
|
getCellDatas() {
|
|
@@ -929,17 +1058,17 @@ let S = class extends ce {
|
|
|
929
1058
|
* @example
|
|
930
1059
|
* ```ts
|
|
931
1060
|
* univerAPI.getActiveWorkbook()
|
|
932
|
-
*
|
|
933
|
-
*
|
|
934
|
-
*
|
|
1061
|
+
* .getActiveSheet()
|
|
1062
|
+
* .getActiveRange()
|
|
1063
|
+
* .getCellDataGrid()
|
|
935
1064
|
* ```
|
|
936
1065
|
*/
|
|
937
1066
|
getCellDataGrid() {
|
|
938
1067
|
const { startRow: r, endRow: e, startColumn: t, endColumn: n } = this._range, s = [];
|
|
939
1068
|
for (let i = r; i <= e; i++) {
|
|
940
1069
|
const o = [];
|
|
941
|
-
for (let
|
|
942
|
-
o.push(this._worksheet.getCellRaw(i,
|
|
1070
|
+
for (let a = t; a <= n; a++)
|
|
1071
|
+
o.push(this._worksheet.getCellRaw(i, a));
|
|
943
1072
|
s.push(o);
|
|
944
1073
|
}
|
|
945
1074
|
return s;
|
|
@@ -952,9 +1081,9 @@ let S = class extends ce {
|
|
|
952
1081
|
* @example
|
|
953
1082
|
* ```ts
|
|
954
1083
|
* univerAPI.getActiveWorkbook()
|
|
955
|
-
*
|
|
956
|
-
*
|
|
957
|
-
*
|
|
1084
|
+
* .getActiveSheet()
|
|
1085
|
+
* .getActiveRange()
|
|
1086
|
+
* .getRichTextValue()
|
|
958
1087
|
* ```
|
|
959
1088
|
*/
|
|
960
1089
|
getRichTextValue() {
|
|
@@ -969,9 +1098,9 @@ let S = class extends ce {
|
|
|
969
1098
|
* @example
|
|
970
1099
|
* ```ts
|
|
971
1100
|
* univerAPI.getActiveWorkbook()
|
|
972
|
-
*
|
|
973
|
-
*
|
|
974
|
-
*
|
|
1101
|
+
* .getActiveSheet()
|
|
1102
|
+
* .getActiveRange()
|
|
1103
|
+
* .getRichTextValues()
|
|
975
1104
|
* ```
|
|
976
1105
|
*/
|
|
977
1106
|
getRichTextValues() {
|
|
@@ -985,9 +1114,9 @@ let S = class extends ce {
|
|
|
985
1114
|
* @example
|
|
986
1115
|
* ```ts
|
|
987
1116
|
* univerAPI.getActiveWorkbook()
|
|
988
|
-
*
|
|
989
|
-
*
|
|
990
|
-
*
|
|
1117
|
+
* .getActiveSheet()
|
|
1118
|
+
* .getActiveRange()
|
|
1119
|
+
* .getValueAndRichTextValue()
|
|
991
1120
|
* ```
|
|
992
1121
|
*/
|
|
993
1122
|
getValueAndRichTextValue() {
|
|
@@ -1000,9 +1129,9 @@ let S = class extends ce {
|
|
|
1000
1129
|
* @example
|
|
1001
1130
|
* ```ts
|
|
1002
1131
|
* univerAPI.getActiveWorkbook()
|
|
1003
|
-
*
|
|
1004
|
-
*
|
|
1005
|
-
*
|
|
1132
|
+
* .getActiveSheet()
|
|
1133
|
+
* .getActiveRange()
|
|
1134
|
+
* .getValueAndRichTextValues()
|
|
1006
1135
|
* ```
|
|
1007
1136
|
*/
|
|
1008
1137
|
getValueAndRichTextValues() {
|
|
@@ -1014,20 +1143,20 @@ let S = class extends ce {
|
|
|
1014
1143
|
* @example
|
|
1015
1144
|
* ```ts
|
|
1016
1145
|
* univerAPI.getActiveWorkbook()
|
|
1017
|
-
*
|
|
1018
|
-
*
|
|
1019
|
-
*
|
|
1146
|
+
* .getActiveSheet()
|
|
1147
|
+
* .getActiveRange()
|
|
1148
|
+
* .getFormulas()
|
|
1020
1149
|
* ```
|
|
1021
1150
|
*/
|
|
1022
1151
|
getFormulas() {
|
|
1023
1152
|
const r = [], { startRow: e, endRow: t, startColumn: n, endColumn: s } = this._range, i = this._worksheet.getSheetId(), o = this._workbook.getUnitId();
|
|
1024
|
-
for (let
|
|
1025
|
-
const
|
|
1153
|
+
for (let a = e; a <= t; a++) {
|
|
1154
|
+
const h = [];
|
|
1026
1155
|
for (let d = n; d <= s; d++) {
|
|
1027
|
-
const c = this._formulaDataModel.getFormulaStringByCell(
|
|
1028
|
-
|
|
1156
|
+
const c = this._formulaDataModel.getFormulaStringByCell(a, d, i, o);
|
|
1157
|
+
h.push(c || "");
|
|
1029
1158
|
}
|
|
1030
|
-
r.push(
|
|
1159
|
+
r.push(h);
|
|
1031
1160
|
}
|
|
1032
1161
|
return r;
|
|
1033
1162
|
}
|
|
@@ -1037,9 +1166,9 @@ let S = class extends ce {
|
|
|
1037
1166
|
* @example
|
|
1038
1167
|
* ```ts
|
|
1039
1168
|
* univerAPI.getActiveWorkbook()
|
|
1040
|
-
*
|
|
1041
|
-
*
|
|
1042
|
-
*
|
|
1169
|
+
* .getActiveSheet()
|
|
1170
|
+
* .getActiveRange()
|
|
1171
|
+
* .getWrap()
|
|
1043
1172
|
* ```
|
|
1044
1173
|
*/
|
|
1045
1174
|
getWrap() {
|
|
@@ -1051,9 +1180,9 @@ let S = class extends ce {
|
|
|
1051
1180
|
* @example
|
|
1052
1181
|
* ```ts
|
|
1053
1182
|
* univerAPI.getActiveWorkbook()
|
|
1054
|
-
*
|
|
1055
|
-
*
|
|
1056
|
-
*
|
|
1183
|
+
* .getActiveSheet()
|
|
1184
|
+
* .getActiveRange()
|
|
1185
|
+
* .getWrapStrategy()
|
|
1057
1186
|
* ```
|
|
1058
1187
|
*/
|
|
1059
1188
|
getWrapStrategy() {
|
|
@@ -1065,13 +1194,13 @@ let S = class extends ce {
|
|
|
1065
1194
|
* @example
|
|
1066
1195
|
* ```ts
|
|
1067
1196
|
* univerAPI.getActiveWorkbook()
|
|
1068
|
-
*
|
|
1069
|
-
*
|
|
1070
|
-
*
|
|
1197
|
+
* .getActiveSheet()
|
|
1198
|
+
* .getActiveRange()
|
|
1199
|
+
* .getHorizontalAlignment()
|
|
1071
1200
|
* ```
|
|
1072
1201
|
*/
|
|
1073
1202
|
getHorizontalAlignment() {
|
|
1074
|
-
return
|
|
1203
|
+
return en(this._worksheet.getRange(this._range).getHorizontalAlignment());
|
|
1075
1204
|
}
|
|
1076
1205
|
/**
|
|
1077
1206
|
* Returns the vertical alignment for the top left cell of the range.
|
|
@@ -1079,13 +1208,13 @@ let S = class extends ce {
|
|
|
1079
1208
|
* @example
|
|
1080
1209
|
* ```ts
|
|
1081
1210
|
* univerAPI.getActiveWorkbook()
|
|
1082
|
-
*
|
|
1083
|
-
*
|
|
1084
|
-
*
|
|
1211
|
+
* .getActiveSheet()
|
|
1212
|
+
* .getActiveRange()
|
|
1213
|
+
* .getVerticalAlignment()
|
|
1085
1214
|
* ```
|
|
1086
1215
|
*/
|
|
1087
1216
|
getVerticalAlignment() {
|
|
1088
|
-
return
|
|
1217
|
+
return nn(this._worksheet.getRange(this._range).getVerticalAlignment());
|
|
1089
1218
|
}
|
|
1090
1219
|
/**
|
|
1091
1220
|
* Set custom meta data for first cell in current range.
|
|
@@ -1093,9 +1222,9 @@ let S = class extends ce {
|
|
|
1093
1222
|
* @returns {FRange} This range, for chaining
|
|
1094
1223
|
* ```ts
|
|
1095
1224
|
* univerAPI.getActiveWorkbook()
|
|
1096
|
-
*
|
|
1097
|
-
*
|
|
1098
|
-
*
|
|
1225
|
+
* .getActiveSheet()
|
|
1226
|
+
* .getActiveRange()
|
|
1227
|
+
* .setCustomMetaData({ key: 'value' });
|
|
1099
1228
|
* ```
|
|
1100
1229
|
*/
|
|
1101
1230
|
setCustomMetaData(r) {
|
|
@@ -1109,9 +1238,9 @@ let S = class extends ce {
|
|
|
1109
1238
|
* @returns {FRange} This range, for chaining
|
|
1110
1239
|
* ```ts
|
|
1111
1240
|
* univerAPI.getActiveWorkbook()
|
|
1112
|
-
*
|
|
1113
|
-
*
|
|
1114
|
-
*
|
|
1241
|
+
* .getActiveSheet()
|
|
1242
|
+
* .getActiveRange()
|
|
1243
|
+
* .setCustomMetaDatas([[{ key: 'value' }]]);
|
|
1115
1244
|
* ```
|
|
1116
1245
|
*/
|
|
1117
1246
|
setCustomMetaDatas(r) {
|
|
@@ -1123,9 +1252,9 @@ let S = class extends ce {
|
|
|
1123
1252
|
* @example
|
|
1124
1253
|
* ```
|
|
1125
1254
|
* univerAPI.getActiveWorkbook()
|
|
1126
|
-
*
|
|
1127
|
-
*
|
|
1128
|
-
*
|
|
1255
|
+
* .getActiveSheet()
|
|
1256
|
+
* .getActiveRange()
|
|
1257
|
+
* .getCustomMetaData()
|
|
1129
1258
|
* ```
|
|
1130
1259
|
*/
|
|
1131
1260
|
getCustomMetaData() {
|
|
@@ -1139,9 +1268,9 @@ let S = class extends ce {
|
|
|
1139
1268
|
* @example
|
|
1140
1269
|
* ```
|
|
1141
1270
|
* univerAPI.getActiveWorkbook()
|
|
1142
|
-
*
|
|
1143
|
-
*
|
|
1144
|
-
*
|
|
1271
|
+
* .getActiveSheet()
|
|
1272
|
+
* .getActiveRange()
|
|
1273
|
+
* .getCustomMetaDatas()
|
|
1145
1274
|
* ```
|
|
1146
1275
|
*/
|
|
1147
1276
|
getCustomMetaDatas() {
|
|
@@ -1159,9 +1288,9 @@ let S = class extends ce {
|
|
|
1159
1288
|
* @example
|
|
1160
1289
|
* ```ts
|
|
1161
1290
|
* univerAPI.getActiveWorkbook()
|
|
1162
|
-
*
|
|
1163
|
-
*
|
|
1164
|
-
*
|
|
1291
|
+
* .getActiveSheet()
|
|
1292
|
+
* .getActiveRange()
|
|
1293
|
+
* .setBorder(BorderType.ALL, BorderStyleType.THIN, '#ff0000');
|
|
1165
1294
|
* ```
|
|
1166
1295
|
*/
|
|
1167
1296
|
setBorder(r, e, t) {
|
|
@@ -1183,9 +1312,9 @@ let S = class extends ce {
|
|
|
1183
1312
|
* @example
|
|
1184
1313
|
* ```ts
|
|
1185
1314
|
* univerAPI.getActiveWorkbook()
|
|
1186
|
-
*
|
|
1187
|
-
*
|
|
1188
|
-
*
|
|
1315
|
+
* .getActiveSheet()
|
|
1316
|
+
* .getActiveRange()
|
|
1317
|
+
* .setBackgroundColor('red')
|
|
1189
1318
|
* ```
|
|
1190
1319
|
*/
|
|
1191
1320
|
setBackgroundColor(r) {
|
|
@@ -1219,9 +1348,9 @@ let S = class extends ce {
|
|
|
1219
1348
|
* @returns {FRange} This range, for chaining
|
|
1220
1349
|
* ```ts
|
|
1221
1350
|
* univerAPI.getActiveWorkbook()
|
|
1222
|
-
*
|
|
1223
|
-
*
|
|
1224
|
-
*
|
|
1351
|
+
* .getActiveSheet()
|
|
1352
|
+
* .getActiveRange()
|
|
1353
|
+
* .setValue(1);
|
|
1225
1354
|
* ```
|
|
1226
1355
|
*/
|
|
1227
1356
|
setValue(r) {
|
|
@@ -1241,9 +1370,9 @@ let S = class extends ce {
|
|
|
1241
1370
|
* @returns {FRange} This range, for chaining
|
|
1242
1371
|
* ```ts
|
|
1243
1372
|
* univerAPI.getActiveWorkbook()
|
|
1244
|
-
*
|
|
1245
|
-
*
|
|
1246
|
-
*
|
|
1373
|
+
* .getActiveSheet()
|
|
1374
|
+
* .getActiveRange()
|
|
1375
|
+
* .setValueForCell(1);
|
|
1247
1376
|
* ```
|
|
1248
1377
|
*/
|
|
1249
1378
|
setValueForCell(r) {
|
|
@@ -1269,9 +1398,9 @@ let S = class extends ce {
|
|
|
1269
1398
|
* @example
|
|
1270
1399
|
* ```
|
|
1271
1400
|
* univerAPI.getActiveWorkbook()
|
|
1272
|
-
*
|
|
1273
|
-
*
|
|
1274
|
-
*
|
|
1401
|
+
* .getActiveSheet()
|
|
1402
|
+
* .getActiveRange()
|
|
1403
|
+
* .setRichTextValueForCell(new RichTextValue().insertText('Hello'));
|
|
1275
1404
|
* ```
|
|
1276
1405
|
*/
|
|
1277
1406
|
setRichTextValueForCell(r) {
|
|
@@ -1295,10 +1424,10 @@ let S = class extends ce {
|
|
|
1295
1424
|
* @example
|
|
1296
1425
|
* ```ts
|
|
1297
1426
|
* univerAPI
|
|
1298
|
-
*
|
|
1299
|
-
*
|
|
1300
|
-
*
|
|
1301
|
-
*
|
|
1427
|
+
* .getActiveWorkbook()
|
|
1428
|
+
* .getActiveSheet()
|
|
1429
|
+
* .getActiveRange()
|
|
1430
|
+
* .setRichTextValues([[new RichTextValue().insertText('Hello')]]);
|
|
1302
1431
|
* ```
|
|
1303
1432
|
*/
|
|
1304
1433
|
setRichTextValues(r) {
|
|
@@ -1318,9 +1447,9 @@ let S = class extends ce {
|
|
|
1318
1447
|
* @example
|
|
1319
1448
|
* ```ts
|
|
1320
1449
|
* univerAPI.getActiveWorkbook()
|
|
1321
|
-
*
|
|
1322
|
-
*
|
|
1323
|
-
*
|
|
1450
|
+
* .getActiveSheet()
|
|
1451
|
+
* .getActiveRange()
|
|
1452
|
+
* .setWrap(true);
|
|
1324
1453
|
* ```
|
|
1325
1454
|
*/
|
|
1326
1455
|
setWrap(r) {
|
|
@@ -1338,9 +1467,9 @@ let S = class extends ce {
|
|
|
1338
1467
|
* @example
|
|
1339
1468
|
* ```ts
|
|
1340
1469
|
* univerAPI.getActiveWorkbook()
|
|
1341
|
-
*
|
|
1342
|
-
*
|
|
1343
|
-
*
|
|
1470
|
+
* .getActiveSheet()
|
|
1471
|
+
* .getActiveRange()
|
|
1472
|
+
* .setWrapStrategy(WrapStrategy.WRAP);
|
|
1344
1473
|
* ```
|
|
1345
1474
|
*/
|
|
1346
1475
|
setWrapStrategy(r) {
|
|
@@ -1358,17 +1487,17 @@ let S = class extends ce {
|
|
|
1358
1487
|
* @example
|
|
1359
1488
|
* ```ts
|
|
1360
1489
|
* univerAPI.getActiveWorkbook()
|
|
1361
|
-
*
|
|
1362
|
-
*
|
|
1363
|
-
*
|
|
1490
|
+
* .getActiveSheet()
|
|
1491
|
+
* .getActiveRange()
|
|
1492
|
+
* .setVerticalAlignment('top');
|
|
1364
1493
|
* ```
|
|
1365
1494
|
*/
|
|
1366
1495
|
setVerticalAlignment(r) {
|
|
1367
|
-
return this._commandService.syncExecuteCommand(
|
|
1496
|
+
return this._commandService.syncExecuteCommand(St.id, {
|
|
1368
1497
|
unitId: this._workbook.getUnitId(),
|
|
1369
1498
|
subUnitId: this._worksheet.getSheetId(),
|
|
1370
1499
|
range: this._range,
|
|
1371
|
-
value:
|
|
1500
|
+
value: tn(r)
|
|
1372
1501
|
}), this;
|
|
1373
1502
|
}
|
|
1374
1503
|
/**
|
|
@@ -1378,17 +1507,17 @@ let S = class extends ce {
|
|
|
1378
1507
|
* @example
|
|
1379
1508
|
* ```ts
|
|
1380
1509
|
* univerAPI.getActiveWorkbook()
|
|
1381
|
-
*
|
|
1382
|
-
*
|
|
1383
|
-
*
|
|
1510
|
+
* .getActiveSheet()
|
|
1511
|
+
* .getActiveRange()
|
|
1512
|
+
* .setHorizontalAlignment('left');
|
|
1384
1513
|
* ```
|
|
1385
1514
|
*/
|
|
1386
1515
|
setHorizontalAlignment(r) {
|
|
1387
|
-
return this._commandService.syncExecuteCommand(
|
|
1516
|
+
return this._commandService.syncExecuteCommand(kt.id, {
|
|
1388
1517
|
unitId: this._workbook.getUnitId(),
|
|
1389
1518
|
subUnitId: this._worksheet.getSheetId(),
|
|
1390
1519
|
range: this._range,
|
|
1391
|
-
value:
|
|
1520
|
+
value: Zt(r)
|
|
1392
1521
|
}), this;
|
|
1393
1522
|
}
|
|
1394
1523
|
/**
|
|
@@ -1398,9 +1527,9 @@ let S = class extends ce {
|
|
|
1398
1527
|
* @example
|
|
1399
1528
|
* ```ts
|
|
1400
1529
|
* univerAPI.getActiveWorkbook()
|
|
1401
|
-
*
|
|
1402
|
-
*
|
|
1403
|
-
*
|
|
1530
|
+
* .getActiveSheet()
|
|
1531
|
+
* .getActiveRange()
|
|
1532
|
+
* .setValues([[1, 2], [3, 4]]);
|
|
1404
1533
|
* ```
|
|
1405
1534
|
*/
|
|
1406
1535
|
setValues(r) {
|
|
@@ -1419,9 +1548,9 @@ let S = class extends ce {
|
|
|
1419
1548
|
* @example
|
|
1420
1549
|
* ```ts
|
|
1421
1550
|
* univerAPI.getActiveWorkbook()
|
|
1422
|
-
*
|
|
1423
|
-
*
|
|
1424
|
-
*
|
|
1551
|
+
* .getActiveSheet()
|
|
1552
|
+
* .getActiveRange()
|
|
1553
|
+
* .setFontWeight('bold');
|
|
1425
1554
|
* ```
|
|
1426
1555
|
*/
|
|
1427
1556
|
setFontWeight(r) {
|
|
@@ -1452,9 +1581,9 @@ let S = class extends ce {
|
|
|
1452
1581
|
* @example
|
|
1453
1582
|
* ```ts
|
|
1454
1583
|
* univerAPI.getActiveWorkbook()
|
|
1455
|
-
*
|
|
1456
|
-
*
|
|
1457
|
-
*
|
|
1584
|
+
* .getActiveSheet()
|
|
1585
|
+
* .getActiveRange()
|
|
1586
|
+
* .setFontStyle('italic');
|
|
1458
1587
|
* ```
|
|
1459
1588
|
*/
|
|
1460
1589
|
setFontStyle(r) {
|
|
@@ -1485,9 +1614,9 @@ let S = class extends ce {
|
|
|
1485
1614
|
* @example
|
|
1486
1615
|
* ```ts
|
|
1487
1616
|
* univerAPI.getActiveWorkbook()
|
|
1488
|
-
*
|
|
1489
|
-
*
|
|
1490
|
-
*
|
|
1617
|
+
* .getActiveSheet()
|
|
1618
|
+
* .getActiveRange()
|
|
1619
|
+
* .setFontLine('underline');
|
|
1491
1620
|
* ```
|
|
1492
1621
|
*/
|
|
1493
1622
|
setFontLine(r) {
|
|
@@ -1518,9 +1647,9 @@ let S = class extends ce {
|
|
|
1518
1647
|
* @example
|
|
1519
1648
|
* ```ts
|
|
1520
1649
|
* univerAPI.getActiveWorkbook()
|
|
1521
|
-
*
|
|
1522
|
-
*
|
|
1523
|
-
*
|
|
1650
|
+
* .getActiveSheet()
|
|
1651
|
+
* .getActiveRange()
|
|
1652
|
+
* .setFontLine('underline');
|
|
1524
1653
|
* ```
|
|
1525
1654
|
*/
|
|
1526
1655
|
_setFontUnderline(r) {
|
|
@@ -1559,9 +1688,9 @@ let S = class extends ce {
|
|
|
1559
1688
|
* @example
|
|
1560
1689
|
* ```ts
|
|
1561
1690
|
* univerAPI.getActiveWorkbook()
|
|
1562
|
-
*
|
|
1563
|
-
*
|
|
1564
|
-
*
|
|
1691
|
+
* .getActiveSheet()
|
|
1692
|
+
* .getActiveRange()
|
|
1693
|
+
* .setFontFamily('Arial');
|
|
1565
1694
|
* ```
|
|
1566
1695
|
*/
|
|
1567
1696
|
setFontFamily(r) {
|
|
@@ -1583,9 +1712,9 @@ let S = class extends ce {
|
|
|
1583
1712
|
* @example
|
|
1584
1713
|
* ```ts
|
|
1585
1714
|
* univerAPI.getActiveWorkbook()
|
|
1586
|
-
*
|
|
1587
|
-
*
|
|
1588
|
-
*
|
|
1715
|
+
* .getActiveSheet()
|
|
1716
|
+
* .getActiveRange()
|
|
1717
|
+
* .setFontSize(12);
|
|
1589
1718
|
* ```
|
|
1590
1719
|
*/
|
|
1591
1720
|
setFontSize(r) {
|
|
@@ -1607,9 +1736,9 @@ let S = class extends ce {
|
|
|
1607
1736
|
* @example
|
|
1608
1737
|
* ```ts
|
|
1609
1738
|
* univerAPI.getActiveWorkbook()
|
|
1610
|
-
*
|
|
1611
|
-
*
|
|
1612
|
-
*
|
|
1739
|
+
* .getActiveSheet()
|
|
1740
|
+
* .getActiveRange()
|
|
1741
|
+
* .setFontColor('#ff0000');
|
|
1613
1742
|
* ```
|
|
1614
1743
|
*/
|
|
1615
1744
|
setFontColor(r) {
|
|
@@ -1659,7 +1788,7 @@ let S = class extends ce {
|
|
|
1659
1788
|
* ```
|
|
1660
1789
|
*/
|
|
1661
1790
|
mergeAcross(r = !0) {
|
|
1662
|
-
const e =
|
|
1791
|
+
const e = Se([this._range], le.ROWS), t = this._workbook.getUnitId(), n = this._worksheet.getSheetId();
|
|
1663
1792
|
return H(this._injector, t, n, e, r), this;
|
|
1664
1793
|
}
|
|
1665
1794
|
/**
|
|
@@ -1677,7 +1806,7 @@ let S = class extends ce {
|
|
|
1677
1806
|
* ```
|
|
1678
1807
|
*/
|
|
1679
1808
|
mergeVertically(r = !0) {
|
|
1680
|
-
const e =
|
|
1809
|
+
const e = Se([this._range], le.COLUMNS), t = this._workbook.getUnitId(), n = this._worksheet.getSheetId();
|
|
1681
1810
|
return H(this._injector, t, n, e, r), this;
|
|
1682
1811
|
}
|
|
1683
1812
|
/**
|
|
@@ -1730,14 +1859,14 @@ let S = class extends ce {
|
|
|
1730
1859
|
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
1731
1860
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
1732
1861
|
* fRange.forEach((row, col, cell) => {
|
|
1733
|
-
*
|
|
1862
|
+
* console.log(row, col, cell);
|
|
1734
1863
|
* });
|
|
1735
1864
|
* ```
|
|
1736
1865
|
*/
|
|
1737
1866
|
forEach(r) {
|
|
1738
1867
|
const { startColumn: e, startRow: t, endColumn: n, endRow: s } = this._range;
|
|
1739
|
-
this._worksheet.getMatrixWithMergedCells(t, e, s, n).forValue((i, o,
|
|
1740
|
-
r(i, o,
|
|
1868
|
+
this._worksheet.getMatrixWithMergedCells(t, e, s, n).forValue((i, o, a) => {
|
|
1869
|
+
r(i, o, a);
|
|
1741
1870
|
});
|
|
1742
1871
|
}
|
|
1743
1872
|
/**
|
|
@@ -1752,7 +1881,7 @@ let S = class extends ce {
|
|
|
1752
1881
|
* ```
|
|
1753
1882
|
*/
|
|
1754
1883
|
getA1Notation(r) {
|
|
1755
|
-
return r ?
|
|
1884
|
+
return r ? zt(this._worksheet.getName(), this._range) : ue(this._range);
|
|
1756
1885
|
}
|
|
1757
1886
|
/**
|
|
1758
1887
|
* Sets the specified range as the active range, with the top left cell in the range as the current cell.
|
|
@@ -1886,16 +2015,16 @@ let S = class extends ce {
|
|
|
1886
2015
|
});
|
|
1887
2016
|
}
|
|
1888
2017
|
};
|
|
1889
|
-
|
|
2018
|
+
k = on([
|
|
1890
2019
|
K(3, u(y)),
|
|
1891
|
-
K(4,
|
|
1892
|
-
K(5, u(
|
|
1893
|
-
],
|
|
1894
|
-
var
|
|
2020
|
+
K(4, m),
|
|
2021
|
+
K(5, u(Ht))
|
|
2022
|
+
], k);
|
|
2023
|
+
var an = Object.defineProperty, hn = Object.getOwnPropertyDescriptor, dn = (r, e, t, n) => {
|
|
1895
2024
|
for (var s = n > 1 ? void 0 : n ? hn(e, t) : e, i = r.length - 1, o; i >= 0; i--)
|
|
1896
2025
|
(o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
|
|
1897
|
-
return n && s &&
|
|
1898
|
-
},
|
|
2026
|
+
return n && s && an(e, t, s), s;
|
|
2027
|
+
}, cn = (r, e) => (t, n) => e(t, n, r);
|
|
1899
2028
|
let L = class {
|
|
1900
2029
|
constructor(r, e, t, n) {
|
|
1901
2030
|
this._workbook = r, this._worksheet = e, this._selections = t, this._injector = n;
|
|
@@ -1914,7 +2043,7 @@ let L = class {
|
|
|
1914
2043
|
*/
|
|
1915
2044
|
getActiveRange() {
|
|
1916
2045
|
const r = this._selections.find((e) => !!e.primary);
|
|
1917
|
-
return r ? this._injector.createInstance(
|
|
2046
|
+
return r ? this._injector.createInstance(k, this._workbook, this._worksheet, r.range) : null;
|
|
1918
2047
|
}
|
|
1919
2048
|
/**
|
|
1920
2049
|
* Represents the active selection list in the sheet.
|
|
@@ -1929,7 +2058,7 @@ let L = class {
|
|
|
1929
2058
|
* ```
|
|
1930
2059
|
*/
|
|
1931
2060
|
getActiveRangeList() {
|
|
1932
|
-
return this._selections.map((r) => this._injector.createInstance(
|
|
2061
|
+
return this._selections.map((r) => this._injector.createInstance(k, this._workbook, this._worksheet, r.range));
|
|
1933
2062
|
}
|
|
1934
2063
|
/**
|
|
1935
2064
|
* Represents the current select cell in the sheet.
|
|
@@ -1961,7 +2090,7 @@ let L = class {
|
|
|
1961
2090
|
*/
|
|
1962
2091
|
getActiveSheet() {
|
|
1963
2092
|
const r = this._injector.createInstance(f, this._workbook);
|
|
1964
|
-
return this._injector.createInstance(
|
|
2093
|
+
return this._injector.createInstance(l, r, this._workbook, this._worksheet);
|
|
1965
2094
|
}
|
|
1966
2095
|
/**
|
|
1967
2096
|
* 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.
|
|
@@ -1978,7 +2107,7 @@ let L = class {
|
|
|
1978
2107
|
* ```
|
|
1979
2108
|
*/
|
|
1980
2109
|
updatePrimaryCell(r) {
|
|
1981
|
-
const e = this._injector.get(
|
|
2110
|
+
const e = this._injector.get(m);
|
|
1982
2111
|
let t = [], n = !1;
|
|
1983
2112
|
for (const { range: i, style: o } of this._selections)
|
|
1984
2113
|
M.contains(i, r.getRange()) ? (t.push({
|
|
@@ -2022,18 +2151,18 @@ let L = class {
|
|
|
2022
2151
|
if (!this._selections.find((n) => !!n.primary))
|
|
2023
2152
|
return null;
|
|
2024
2153
|
const t = It(this._selections.concat(), r, this._worksheet);
|
|
2025
|
-
return t ? this._injector.createInstance(
|
|
2154
|
+
return t ? this._injector.createInstance(k, this._workbook, this._worksheet, t) : null;
|
|
2026
2155
|
}
|
|
2027
2156
|
};
|
|
2028
|
-
L =
|
|
2029
|
-
|
|
2157
|
+
L = dn([
|
|
2158
|
+
cn(3, u(y))
|
|
2030
2159
|
], L);
|
|
2031
|
-
var
|
|
2032
|
-
for (var s = n > 1 ? void 0 : n ?
|
|
2160
|
+
var un = Object.defineProperty, gn = Object.getOwnPropertyDescriptor, mn = (r, e, t, n) => {
|
|
2161
|
+
for (var s = n > 1 ? void 0 : n ? gn(e, t) : e, i = r.length - 1, o; i >= 0; i--)
|
|
2033
2162
|
(o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
|
|
2034
|
-
return n && s &&
|
|
2163
|
+
return n && s && un(e, t, s), s;
|
|
2035
2164
|
}, B = (r, e) => (t, n) => e(t, n, r);
|
|
2036
|
-
let
|
|
2165
|
+
let l = class extends ce {
|
|
2037
2166
|
/**
|
|
2038
2167
|
* Creates a new worksheet facade instance
|
|
2039
2168
|
* @param {FWorkbook} _fWorkbook - The facade workbook instance
|
|
@@ -2044,7 +2173,7 @@ let m = class extends ce {
|
|
|
2044
2173
|
* @param {ILogService} _logService - The log service
|
|
2045
2174
|
* @param {ICommandService} _commandService - The command service
|
|
2046
2175
|
*/
|
|
2047
|
-
constructor(e, t, n, s, i, o,
|
|
2176
|
+
constructor(e, t, n, s, i, o, a) {
|
|
2048
2177
|
super(s);
|
|
2049
2178
|
/**
|
|
2050
2179
|
* Sets the active selection region for this sheet.
|
|
@@ -2058,7 +2187,7 @@ let m = class extends ce {
|
|
|
2058
2187
|
* ```
|
|
2059
2188
|
*/
|
|
2060
2189
|
b(this, "setActiveSelection", this.setActiveRange);
|
|
2061
|
-
this._fWorkbook = e, this._workbook = t, this._worksheet = n, this._injector = s, this._selectionManagerService = i, this._logService = o, this._commandService =
|
|
2190
|
+
this._fWorkbook = e, this._workbook = t, this._worksheet = n, this._injector = s, this._selectionManagerService = i, this._logService = o, this._commandService = a;
|
|
2062
2191
|
}
|
|
2063
2192
|
/**
|
|
2064
2193
|
* Returns the worksheet
|
|
@@ -2219,7 +2348,7 @@ let m = class extends ce {
|
|
|
2219
2348
|
}
|
|
2220
2349
|
}
|
|
2221
2350
|
};
|
|
2222
|
-
return this._commandService.syncExecuteCommand(
|
|
2351
|
+
return this._commandService.syncExecuteCommand(ke.id, i), this;
|
|
2223
2352
|
}
|
|
2224
2353
|
/**
|
|
2225
2354
|
* Set the default style of the worksheet column
|
|
@@ -2250,20 +2379,20 @@ let m = class extends ce {
|
|
|
2250
2379
|
if (typeof e == "object")
|
|
2251
2380
|
i = e, o = this._worksheet;
|
|
2252
2381
|
else if (typeof e == "string") {
|
|
2253
|
-
const { range:
|
|
2382
|
+
const { range: a, sheetName: h } = $t(e), d = h ? this._workbook.getSheetBySheetName(h) : this._worksheet;
|
|
2254
2383
|
if (!d)
|
|
2255
2384
|
throw new Error("Range not found");
|
|
2256
2385
|
o = d, i = {
|
|
2257
|
-
...
|
|
2386
|
+
...a,
|
|
2258
2387
|
unitId: this._workbook.getUnitId(),
|
|
2259
2388
|
sheetId: o.getSheetId(),
|
|
2260
2389
|
// Use the current range instead of the future actual range to match Apps Script behavior.
|
|
2261
2390
|
// Users can create the latest range in real time when needed.
|
|
2262
2391
|
rangeType: _.NORMAL,
|
|
2263
|
-
startRow:
|
|
2264
|
-
endRow:
|
|
2265
|
-
startColumn:
|
|
2266
|
-
endColumn:
|
|
2392
|
+
startRow: a.rangeType === _.COLUMN ? 0 : a.startRow,
|
|
2393
|
+
endRow: a.rangeType === _.COLUMN ? o.getMaxRows() - 1 : a.endRow,
|
|
2394
|
+
startColumn: a.rangeType === _.ROW ? 0 : a.startColumn,
|
|
2395
|
+
endColumn: a.rangeType === _.ROW ? o.getMaxColumns() - 1 : a.endColumn
|
|
2267
2396
|
};
|
|
2268
2397
|
} else if (typeof e == "number" && t !== void 0)
|
|
2269
2398
|
o = this._worksheet, i = {
|
|
@@ -2276,7 +2405,7 @@ let m = class extends ce {
|
|
|
2276
2405
|
};
|
|
2277
2406
|
else
|
|
2278
2407
|
throw new Error("Invalid range specification");
|
|
2279
|
-
return this._injector.createInstance(
|
|
2408
|
+
return this._injector.createInstance(k, this._workbook, o, i);
|
|
2280
2409
|
}
|
|
2281
2410
|
/**
|
|
2282
2411
|
* Returns the current number of columns in the sheet, regardless of content.
|
|
@@ -2368,15 +2497,15 @@ let m = class extends ce {
|
|
|
2368
2497
|
* ```
|
|
2369
2498
|
*/
|
|
2370
2499
|
insertRowsAfter(e, t) {
|
|
2371
|
-
const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), i = D.DOWN, o = e + 1,
|
|
2500
|
+
const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), i = D.DOWN, o = e + 1, a = e + t, h = 0, d = this._worksheet.getColumnCount() - 1, c = A(this._worksheet, o, a, h, d, !0, e);
|
|
2372
2501
|
return this._commandService.syncExecuteCommand(Ce.id, {
|
|
2373
2502
|
unitId: n,
|
|
2374
2503
|
subUnitId: s,
|
|
2375
2504
|
direction: i,
|
|
2376
2505
|
range: {
|
|
2377
2506
|
startRow: o,
|
|
2378
|
-
endRow:
|
|
2379
|
-
startColumn:
|
|
2507
|
+
endRow: a,
|
|
2508
|
+
startColumn: h,
|
|
2380
2509
|
endColumn: d
|
|
2381
2510
|
},
|
|
2382
2511
|
cellValue: c
|
|
@@ -2397,15 +2526,15 @@ let m = class extends ce {
|
|
|
2397
2526
|
* ```
|
|
2398
2527
|
*/
|
|
2399
2528
|
insertRowsBefore(e, t) {
|
|
2400
|
-
const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), i = D.UP, o = e,
|
|
2529
|
+
const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), i = D.UP, o = e, a = e + t - 1, h = 0, d = this._worksheet.getColumnCount() - 1, c = A(this._worksheet, o, a, h, d, !0, e - 1);
|
|
2401
2530
|
return this._commandService.syncExecuteCommand(Ce.id, {
|
|
2402
2531
|
unitId: n,
|
|
2403
2532
|
subUnitId: s,
|
|
2404
2533
|
direction: i,
|
|
2405
2534
|
range: {
|
|
2406
2535
|
startRow: o,
|
|
2407
|
-
endRow:
|
|
2408
|
-
startColumn:
|
|
2536
|
+
endRow: a,
|
|
2537
|
+
startColumn: h,
|
|
2409
2538
|
endColumn: d
|
|
2410
2539
|
},
|
|
2411
2540
|
cellValue: c
|
|
@@ -2469,7 +2598,7 @@ let m = class extends ce {
|
|
|
2469
2598
|
* ```
|
|
2470
2599
|
*/
|
|
2471
2600
|
moveRows(e, t) {
|
|
2472
|
-
const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), i = G(e.getRange(), this._worksheet), o = i,
|
|
2601
|
+
const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), i = G(e.getRange(), this._worksheet), o = i, a = {
|
|
2473
2602
|
startRow: t,
|
|
2474
2603
|
endRow: t,
|
|
2475
2604
|
startColumn: i.startColumn,
|
|
@@ -2480,7 +2609,7 @@ let m = class extends ce {
|
|
|
2480
2609
|
subUnitId: s,
|
|
2481
2610
|
range: i,
|
|
2482
2611
|
fromRange: o,
|
|
2483
|
-
toRange:
|
|
2612
|
+
toRange: a
|
|
2484
2613
|
}), this;
|
|
2485
2614
|
}
|
|
2486
2615
|
/**
|
|
@@ -2647,25 +2776,25 @@ let m = class extends ce {
|
|
|
2647
2776
|
*/
|
|
2648
2777
|
setRowHeights(e, t, n) {
|
|
2649
2778
|
var d;
|
|
2650
|
-
const s = this._workbook.getUnitId(), i = this._worksheet.getSheetId(), o = this._worksheet.getRowManager(),
|
|
2779
|
+
const s = this._workbook.getUnitId(), i = this._worksheet.getSheetId(), o = this._worksheet.getRowManager(), a = [], h = [];
|
|
2651
2780
|
for (let c = e; c < e + t; c++) {
|
|
2652
|
-
const v = ((d = o.getRow(c)) == null ? void 0 : d.ah) || this._worksheet.getConfig().defaultRowHeight,
|
|
2781
|
+
const v = ((d = o.getRow(c)) == null ? void 0 : d.ah) || this._worksheet.getConfig().defaultRowHeight, S = {
|
|
2653
2782
|
startRow: c,
|
|
2654
2783
|
endRow: c,
|
|
2655
2784
|
startColumn: 0,
|
|
2656
2785
|
endColumn: this._worksheet.getColumnCount() - 1
|
|
2657
2786
|
};
|
|
2658
|
-
n <= v ?
|
|
2787
|
+
n <= v ? a.push(S) : h.push(S);
|
|
2659
2788
|
}
|
|
2660
|
-
return
|
|
2789
|
+
return h.length > 0 && this._commandService.syncExecuteCommand(Ie.id, {
|
|
2661
2790
|
unitId: s,
|
|
2662
2791
|
subUnitId: i,
|
|
2663
|
-
ranges:
|
|
2792
|
+
ranges: h,
|
|
2664
2793
|
value: n
|
|
2665
|
-
}),
|
|
2794
|
+
}), a.length > 0 && this._commandService.syncExecuteCommand(be.id, {
|
|
2666
2795
|
unitId: s,
|
|
2667
2796
|
subUnitId: i,
|
|
2668
|
-
ranges:
|
|
2797
|
+
ranges: a
|
|
2669
2798
|
}), this;
|
|
2670
2799
|
}
|
|
2671
2800
|
/**
|
|
@@ -2736,9 +2865,9 @@ let m = class extends ce {
|
|
|
2736
2865
|
*/
|
|
2737
2866
|
setRowCustom(e) {
|
|
2738
2867
|
const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), s = {};
|
|
2739
|
-
for (const [o,
|
|
2868
|
+
for (const [o, a] of Object.entries(e))
|
|
2740
2869
|
s[Number(o)] = {
|
|
2741
|
-
custom:
|
|
2870
|
+
custom: a
|
|
2742
2871
|
};
|
|
2743
2872
|
const i = {
|
|
2744
2873
|
unitId: t,
|
|
@@ -2812,15 +2941,15 @@ let m = class extends ce {
|
|
|
2812
2941
|
* ```
|
|
2813
2942
|
*/
|
|
2814
2943
|
insertColumnsAfter(e, t) {
|
|
2815
|
-
const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), i = D.RIGHT, o = 0,
|
|
2944
|
+
const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), i = D.RIGHT, o = 0, a = this._worksheet.getRowCount() - 1, h = e + 1, d = e + t, c = A(this._worksheet, o, a, h, d, !1, e);
|
|
2816
2945
|
return this._commandService.syncExecuteCommand(Re.id, {
|
|
2817
2946
|
unitId: n,
|
|
2818
2947
|
subUnitId: s,
|
|
2819
2948
|
direction: i,
|
|
2820
2949
|
range: {
|
|
2821
2950
|
startRow: o,
|
|
2822
|
-
endRow:
|
|
2823
|
-
startColumn:
|
|
2951
|
+
endRow: a,
|
|
2952
|
+
startColumn: h,
|
|
2824
2953
|
endColumn: d
|
|
2825
2954
|
},
|
|
2826
2955
|
cellValue: c
|
|
@@ -2841,15 +2970,15 @@ let m = class extends ce {
|
|
|
2841
2970
|
* ```
|
|
2842
2971
|
*/
|
|
2843
2972
|
insertColumnsBefore(e, t) {
|
|
2844
|
-
const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), i = D.LEFT, o = 0,
|
|
2973
|
+
const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), i = D.LEFT, o = 0, a = this._worksheet.getRowCount() - 1, h = e, d = e + t - 1, c = A(this._worksheet, o, a, h, d, !1, e - 1);
|
|
2845
2974
|
return this._commandService.syncExecuteCommand(Re.id, {
|
|
2846
2975
|
unitId: n,
|
|
2847
2976
|
subUnitId: s,
|
|
2848
2977
|
direction: i,
|
|
2849
2978
|
range: {
|
|
2850
2979
|
startRow: o,
|
|
2851
|
-
endRow:
|
|
2852
|
-
startColumn:
|
|
2980
|
+
endRow: a,
|
|
2981
|
+
startColumn: h,
|
|
2853
2982
|
endColumn: d
|
|
2854
2983
|
},
|
|
2855
2984
|
cellValue: c
|
|
@@ -2913,7 +3042,7 @@ let m = class extends ce {
|
|
|
2913
3042
|
* ```
|
|
2914
3043
|
*/
|
|
2915
3044
|
moveColumns(e, t) {
|
|
2916
|
-
const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), i = q(e.getRange(), this._worksheet), o = i,
|
|
3045
|
+
const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), i = q(e.getRange(), this._worksheet), o = i, a = {
|
|
2917
3046
|
startRow: 0,
|
|
2918
3047
|
endRow: this._worksheet.getRowCount() - 1,
|
|
2919
3048
|
startColumn: t,
|
|
@@ -2924,7 +3053,7 @@ let m = class extends ce {
|
|
|
2924
3053
|
subUnitId: s,
|
|
2925
3054
|
range: i,
|
|
2926
3055
|
fromRange: o,
|
|
2927
|
-
toRange:
|
|
3056
|
+
toRange: a
|
|
2928
3057
|
}), this;
|
|
2929
3058
|
}
|
|
2930
3059
|
/**
|
|
@@ -3083,16 +3212,16 @@ let m = class extends ce {
|
|
|
3083
3212
|
*/
|
|
3084
3213
|
setColumnCustom(e) {
|
|
3085
3214
|
const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), s = {};
|
|
3086
|
-
for (const [o,
|
|
3215
|
+
for (const [o, a] of Object.entries(e))
|
|
3087
3216
|
s[Number(o)] = {
|
|
3088
|
-
custom:
|
|
3217
|
+
custom: a
|
|
3089
3218
|
};
|
|
3090
3219
|
const i = {
|
|
3091
3220
|
unitId: t,
|
|
3092
3221
|
subUnitId: n,
|
|
3093
3222
|
columnData: s
|
|
3094
3223
|
};
|
|
3095
|
-
return this._commandService.syncExecuteCommand(
|
|
3224
|
+
return this._commandService.syncExecuteCommand(ke.id, i), this;
|
|
3096
3225
|
}
|
|
3097
3226
|
// #region merge cells
|
|
3098
3227
|
/**
|
|
@@ -3110,7 +3239,7 @@ let m = class extends ce {
|
|
|
3110
3239
|
* ```
|
|
3111
3240
|
*/
|
|
3112
3241
|
getMergedRanges() {
|
|
3113
|
-
return this._worksheet.getSnapshot().mergeData.map((t) => this._injector.createInstance(
|
|
3242
|
+
return this._worksheet.getSnapshot().mergeData.map((t) => this._injector.createInstance(k, this._workbook, this._worksheet, t));
|
|
3114
3243
|
}
|
|
3115
3244
|
/**
|
|
3116
3245
|
* Get the merged cell data of the specified row and column.
|
|
@@ -3130,7 +3259,7 @@ let m = class extends ce {
|
|
|
3130
3259
|
getCellMergeData(e, t) {
|
|
3131
3260
|
const s = this._worksheet.getMergedCell(e, t);
|
|
3132
3261
|
if (s)
|
|
3133
|
-
return this._injector.createInstance(
|
|
3262
|
+
return this._injector.createInstance(k, this._workbook, this._worksheet, s);
|
|
3134
3263
|
}
|
|
3135
3264
|
// #endregion
|
|
3136
3265
|
/**
|
|
@@ -3442,7 +3571,7 @@ let m = class extends ce {
|
|
|
3442
3571
|
* @deprecated use `univerAPI.addEvent(univerAPI.Event.SheetValueChanged, callback)` instead
|
|
3443
3572
|
*/
|
|
3444
3573
|
onCellDataChange(e) {
|
|
3445
|
-
return this._injector.get(
|
|
3574
|
+
return this._injector.get(m).onCommandExecuted((n) => {
|
|
3446
3575
|
if (n.id === Ee.id) {
|
|
3447
3576
|
const s = n.params;
|
|
3448
3577
|
s.unitId === this._workbook.getUnitId() && s.subUnitId === this._worksheet.getSheetId() && s.cellValue && e(new W(s.cellValue));
|
|
@@ -3454,7 +3583,7 @@ let m = class extends ce {
|
|
|
3454
3583
|
* @deprecated use `univerAPI.addEvent(univerAPI.Event.SheetValueChanged, callback)` instead
|
|
3455
3584
|
*/
|
|
3456
3585
|
onBeforeCellDataChange(e) {
|
|
3457
|
-
return this._injector.get(
|
|
3586
|
+
return this._injector.get(m).beforeCommandExecuted((n) => {
|
|
3458
3587
|
if (n.id === Ee.id) {
|
|
3459
3588
|
const s = n.params;
|
|
3460
3589
|
s.unitId === this._workbook.getUnitId() && s.subUnitId === this._worksheet.getSheetId() && s.cellValue && e(new W(s.cellValue));
|
|
@@ -3473,7 +3602,7 @@ let m = class extends ce {
|
|
|
3473
3602
|
* ```
|
|
3474
3603
|
*/
|
|
3475
3604
|
hideSheet() {
|
|
3476
|
-
const e = this._injector.get(
|
|
3605
|
+
const e = this._injector.get(m);
|
|
3477
3606
|
if (this._workbook.getSheets().filter((i) => i.isSheetHidden() !== g.TRUE).length <= 1)
|
|
3478
3607
|
throw new Error("Cannot hide the only visible sheet");
|
|
3479
3608
|
return e.syncExecuteCommand(se.id, {
|
|
@@ -3493,7 +3622,7 @@ let m = class extends ce {
|
|
|
3493
3622
|
* ```
|
|
3494
3623
|
*/
|
|
3495
3624
|
showSheet() {
|
|
3496
|
-
return this._injector.get(
|
|
3625
|
+
return this._injector.get(m).syncExecuteCommand(Nt.id, {
|
|
3497
3626
|
unitId: this._workbook.getUnitId(),
|
|
3498
3627
|
subUnitId: this._worksheet.getSheetId()
|
|
3499
3628
|
}), this;
|
|
@@ -3564,7 +3693,7 @@ let m = class extends ce {
|
|
|
3564
3693
|
*/
|
|
3565
3694
|
clear(e) {
|
|
3566
3695
|
e && e.contentsOnly && !e.formatOnly && this.clearContents(), e && e.formatOnly && !e.contentsOnly && this.clearFormats();
|
|
3567
|
-
const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), s = this._injector.get(
|
|
3696
|
+
const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), s = this._injector.get(m), i = {
|
|
3568
3697
|
startRow: 0,
|
|
3569
3698
|
endRow: this._worksheet.getRowCount() - 1,
|
|
3570
3699
|
startColumn: 0,
|
|
@@ -3589,7 +3718,7 @@ let m = class extends ce {
|
|
|
3589
3718
|
* ```
|
|
3590
3719
|
*/
|
|
3591
3720
|
clearContents() {
|
|
3592
|
-
const e = this._workbook.getUnitId(), t = this._worksheet.getSheetId(), n = this._injector.get(
|
|
3721
|
+
const e = this._workbook.getUnitId(), t = this._worksheet.getSheetId(), n = this._injector.get(m), s = {
|
|
3593
3722
|
startRow: 0,
|
|
3594
3723
|
endRow: this._worksheet.getRowCount() - 1,
|
|
3595
3724
|
startColumn: 0,
|
|
@@ -3613,7 +3742,7 @@ let m = class extends ce {
|
|
|
3613
3742
|
* ```
|
|
3614
3743
|
*/
|
|
3615
3744
|
clearFormats() {
|
|
3616
|
-
const e = this._workbook.getUnitId(), t = this._worksheet.getSheetId(), n = this._injector.get(
|
|
3745
|
+
const e = this._workbook.getUnitId(), t = this._worksheet.getSheetId(), n = this._injector.get(m), s = {
|
|
3617
3746
|
startRow: 0,
|
|
3618
3747
|
endRow: this._worksheet.getRowCount() - 1,
|
|
3619
3748
|
startColumn: 0,
|
|
@@ -3714,7 +3843,7 @@ let m = class extends ce {
|
|
|
3714
3843
|
* ```
|
|
3715
3844
|
*/
|
|
3716
3845
|
equalTo(e) {
|
|
3717
|
-
return e instanceof
|
|
3846
|
+
return e instanceof l ? this._worksheet.getSheetId() === e.getSheetId() && this._workbook.getUnitId() === e.getWorkbook().getUnitId() : !1;
|
|
3718
3847
|
}
|
|
3719
3848
|
/*
|
|
3720
3849
|
* Insert a defined name for worksheet.
|
|
@@ -3834,25 +3963,25 @@ let m = class extends ce {
|
|
|
3834
3963
|
* ```
|
|
3835
3964
|
*/
|
|
3836
3965
|
getMergeData() {
|
|
3837
|
-
return this._worksheet.getMergeData().map((e) => this._injector.createInstance(
|
|
3966
|
+
return this._worksheet.getMergeData().map((e) => this._injector.createInstance(k, this._workbook, this._worksheet, e));
|
|
3838
3967
|
}
|
|
3839
3968
|
};
|
|
3840
|
-
|
|
3969
|
+
l = mn([
|
|
3841
3970
|
B(3, u(y)),
|
|
3842
3971
|
B(4, u(ze)),
|
|
3843
3972
|
B(5, u(De)),
|
|
3844
|
-
B(6,
|
|
3845
|
-
],
|
|
3846
|
-
var ln = Object.defineProperty,
|
|
3847
|
-
for (var s = n > 1 ? void 0 : n ?
|
|
3973
|
+
B(6, m)
|
|
3974
|
+
], l);
|
|
3975
|
+
var ln = Object.defineProperty, _n = Object.getOwnPropertyDescriptor, Sn = (r, e, t, n) => {
|
|
3976
|
+
for (var s = n > 1 ? void 0 : n ? _n(e, t) : e, i = r.length - 1, o; i >= 0; i--)
|
|
3848
3977
|
(o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
|
|
3849
3978
|
return n && s && ln(e, t, s), s;
|
|
3850
3979
|
}, C = (r, e) => (t, n) => e(t, n, r);
|
|
3851
3980
|
let f = class extends ce {
|
|
3852
|
-
constructor(e, t, n, s, i, o,
|
|
3981
|
+
constructor(e, t, n, s, i, o, a, h, d, c) {
|
|
3853
3982
|
super(t);
|
|
3854
3983
|
b(this, "id");
|
|
3855
|
-
this._workbook = e, this._injector = t, this._resourceLoaderService = n, this._selectionManagerService = s, this._univerInstanceService = i, this._commandService = o, this._permissionService =
|
|
3984
|
+
this._workbook = e, this._injector = t, this._resourceLoaderService = n, this._selectionManagerService = s, this._univerInstanceService = i, this._commandService = o, this._permissionService = a, this._logService = h, this._localeService = d, this._definedNamesService = c, this.id = this._workbook.getUnitId();
|
|
3856
3985
|
}
|
|
3857
3986
|
/**
|
|
3858
3987
|
* Get the Workbook instance.
|
|
@@ -3946,7 +4075,7 @@ let f = class extends ce {
|
|
|
3946
4075
|
*/
|
|
3947
4076
|
getActiveSheet() {
|
|
3948
4077
|
const e = this._workbook.getActiveSheet();
|
|
3949
|
-
return this._injector.createInstance(
|
|
4078
|
+
return this._injector.createInstance(l, this, this._workbook, e);
|
|
3950
4079
|
}
|
|
3951
4080
|
/**
|
|
3952
4081
|
* Gets all the worksheets in this workbook
|
|
@@ -3959,7 +4088,7 @@ let f = class extends ce {
|
|
|
3959
4088
|
* ```
|
|
3960
4089
|
*/
|
|
3961
4090
|
getSheets() {
|
|
3962
|
-
return this._workbook.getSheets().map((e) => this._injector.createInstance(
|
|
4091
|
+
return this._workbook.getSheets().map((e) => this._injector.createInstance(l, this, this._workbook, e));
|
|
3963
4092
|
}
|
|
3964
4093
|
/**
|
|
3965
4094
|
* Create a new worksheet and returns a handle to it.
|
|
@@ -3987,7 +4116,7 @@ let f = class extends ce {
|
|
|
3987
4116
|
const i = this._workbook.getActiveSheet();
|
|
3988
4117
|
if (!i)
|
|
3989
4118
|
throw new Error("No active sheet found");
|
|
3990
|
-
return this._injector.createInstance(
|
|
4119
|
+
return this._injector.createInstance(l, this, this._workbook, i);
|
|
3991
4120
|
}
|
|
3992
4121
|
/**
|
|
3993
4122
|
* Get a worksheet by sheet id.
|
|
@@ -4002,7 +4131,7 @@ let f = class extends ce {
|
|
|
4002
4131
|
*/
|
|
4003
4132
|
getSheetBySheetId(e) {
|
|
4004
4133
|
const t = this._workbook.getSheetBySheetId(e);
|
|
4005
|
-
return t ? this._injector.createInstance(
|
|
4134
|
+
return t ? this._injector.createInstance(l, this, this._workbook, t) : null;
|
|
4006
4135
|
}
|
|
4007
4136
|
/**
|
|
4008
4137
|
* Get a worksheet by sheet name.
|
|
@@ -4017,7 +4146,7 @@ let f = class extends ce {
|
|
|
4017
4146
|
*/
|
|
4018
4147
|
getSheetByName(e) {
|
|
4019
4148
|
const t = this._workbook.getSheetBySheetName(e);
|
|
4020
|
-
return t ? this._injector.createInstance(
|
|
4149
|
+
return t ? this._injector.createInstance(l, this, this._workbook, t) : null;
|
|
4021
4150
|
}
|
|
4022
4151
|
/**
|
|
4023
4152
|
* Sets the given worksheet to be the active worksheet in the workbook.
|
|
@@ -4063,7 +4192,7 @@ let f = class extends ce {
|
|
|
4063
4192
|
const s = this._workbook.getActiveSheet();
|
|
4064
4193
|
if (!s)
|
|
4065
4194
|
throw new Error("No active sheet found");
|
|
4066
|
-
return this._injector.createInstance(
|
|
4195
|
+
return this._injector.createInstance(l, this, this._workbook, s);
|
|
4067
4196
|
}
|
|
4068
4197
|
/**
|
|
4069
4198
|
* Deletes the specified worksheet.
|
|
@@ -4125,7 +4254,7 @@ let f = class extends ce {
|
|
|
4125
4254
|
* // The code below registers a callback that will be triggered before invoking a command targeting the Univer sheet
|
|
4126
4255
|
* const activeSpreadsheet = univerAPI.getActiveWorkbook();
|
|
4127
4256
|
* activeSpreadsheet.onBeforeCommandExecute((command) => {
|
|
4128
|
-
*
|
|
4257
|
+
* console.log('Command executed:', command);
|
|
4129
4258
|
* });
|
|
4130
4259
|
* ```
|
|
4131
4260
|
*/
|
|
@@ -4194,7 +4323,7 @@ let f = class extends ce {
|
|
|
4194
4323
|
const t = this.getActiveSheet(), n = e.getRange().sheetId || t.getSheetId(), s = n ? this._workbook.getSheetBySheetId(n) : this._workbook.getActiveSheet(!0);
|
|
4195
4324
|
if (!s)
|
|
4196
4325
|
throw new Error("No active sheet found");
|
|
4197
|
-
s.getSheetId() !== t.getSheetId() && this.setActiveSheet(this._injector.createInstance(
|
|
4326
|
+
s.getSheetId() !== t.getSheetId() && this.setActiveSheet(this._injector.createInstance(l, this, this._workbook, s));
|
|
4198
4327
|
const i = {
|
|
4199
4328
|
unitId: this.getId(),
|
|
4200
4329
|
subUnitId: n,
|
|
@@ -4209,7 +4338,7 @@ let f = class extends ce {
|
|
|
4209
4338
|
// could sheet have no active range ?
|
|
4210
4339
|
getActiveRange() {
|
|
4211
4340
|
const e = this._workbook.getActiveSheet(), n = this._selectionManagerService.getCurrentSelections().find((s) => !!s.primary);
|
|
4212
|
-
return n ? this._injector.createInstance(
|
|
4341
|
+
return n ? this._injector.createInstance(k, this._workbook, e, n.range) : null;
|
|
4213
4342
|
}
|
|
4214
4343
|
/**
|
|
4215
4344
|
* Deletes the currently active sheet.
|
|
@@ -4241,7 +4370,7 @@ let f = class extends ce {
|
|
|
4241
4370
|
return this._commandService.syncExecuteCommand(At.id, {
|
|
4242
4371
|
unitId: e.getWorkbook().getUnitId(),
|
|
4243
4372
|
subUnitId: e.getSheetId()
|
|
4244
|
-
}), this._injector.createInstance(
|
|
4373
|
+
}), this._injector.createInstance(l, this, this._workbook, this._workbook.getActiveSheet());
|
|
4245
4374
|
}
|
|
4246
4375
|
/**
|
|
4247
4376
|
* Duplicates the active sheet.
|
|
@@ -4331,7 +4460,7 @@ let f = class extends ce {
|
|
|
4331
4460
|
*/
|
|
4332
4461
|
moveSheet(e, t) {
|
|
4333
4462
|
let n = t;
|
|
4334
|
-
return n < 0 ? n = 0 : n > this._workbook.getSheets().length - 1 && (n = this._workbook.getSheets().length - 1), this._commandService.syncExecuteCommand(
|
|
4463
|
+
return n < 0 ? n = 0 : n > this._workbook.getSheets().length - 1 && (n = this._workbook.getSheets().length - 1), this._commandService.syncExecuteCommand(ae.id, {
|
|
4335
4464
|
unitId: e.getWorkbook().getUnitId(),
|
|
4336
4465
|
order: n,
|
|
4337
4466
|
subUnitId: e.getSheetId()
|
|
@@ -4475,9 +4604,9 @@ let f = class extends ce {
|
|
|
4475
4604
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
4476
4605
|
* const rangeThemeStyle = new RangeThemeStyle('MyTheme');
|
|
4477
4606
|
* rangeThemeStyle.setSecondRowStyle({
|
|
4478
|
-
*
|
|
4479
|
-
*
|
|
4480
|
-
*
|
|
4607
|
+
* bg: {
|
|
4608
|
+
* rgb: 'rgb(214,231,241)',
|
|
4609
|
+
* },
|
|
4481
4610
|
* });
|
|
4482
4611
|
* fWorkbook.registerRangeTheme(rangeThemeStyle);
|
|
4483
4612
|
* ```
|
|
@@ -4504,6 +4633,9 @@ let f = class extends ce {
|
|
|
4504
4633
|
themeName: e
|
|
4505
4634
|
});
|
|
4506
4635
|
}
|
|
4636
|
+
createRangeThemeStyle(e, t) {
|
|
4637
|
+
return new Ft(e, t);
|
|
4638
|
+
}
|
|
4507
4639
|
/**
|
|
4508
4640
|
* Set custom metadata of workbook
|
|
4509
4641
|
* @param {CustomData | undefined} custom custom metadata
|
|
@@ -4530,13 +4662,13 @@ let f = class extends ce {
|
|
|
4530
4662
|
return this._workbook.getCustomMetadata();
|
|
4531
4663
|
}
|
|
4532
4664
|
};
|
|
4533
|
-
f =
|
|
4665
|
+
f = Sn([
|
|
4534
4666
|
C(1, u(y)),
|
|
4535
4667
|
C(2, u(Xe)),
|
|
4536
4668
|
C(3, u(ze)),
|
|
4537
4669
|
C(4, J),
|
|
4538
|
-
C(5,
|
|
4539
|
-
C(6,
|
|
4670
|
+
C(5, m),
|
|
4671
|
+
C(6, he),
|
|
4540
4672
|
C(7, De),
|
|
4541
4673
|
C(8, u(Te)),
|
|
4542
4674
|
C(9, $e)
|
|
@@ -4591,20 +4723,23 @@ class kn extends Be {
|
|
|
4591
4723
|
})
|
|
4592
4724
|
);
|
|
4593
4725
|
}
|
|
4726
|
+
/**
|
|
4727
|
+
* @ignore
|
|
4728
|
+
*/
|
|
4594
4729
|
// eslint-disable-next-line max-lines-per-function
|
|
4595
4730
|
_initialize(e) {
|
|
4596
|
-
const t = e.get(
|
|
4731
|
+
const t = e.get(m);
|
|
4597
4732
|
this.disposeWithMe(
|
|
4598
4733
|
// eslint-disable-next-line max-lines-per-function, complexity
|
|
4599
4734
|
t.beforeCommandExecuted((n) => {
|
|
4600
|
-
var s, i, o,
|
|
4735
|
+
var s, i, o, a;
|
|
4601
4736
|
switch (n.id) {
|
|
4602
4737
|
case T.id: {
|
|
4603
|
-
const
|
|
4604
|
-
if (!
|
|
4738
|
+
const h = n.params, { unitId: d, index: c, sheet: v } = h || {}, S = d ? this.getUniverSheet(d) : (s = this.getActiveWorkbook) == null ? void 0 : s.call(this);
|
|
4739
|
+
if (!S)
|
|
4605
4740
|
return;
|
|
4606
4741
|
const ge = {
|
|
4607
|
-
workbook:
|
|
4742
|
+
workbook: S,
|
|
4608
4743
|
index: c,
|
|
4609
4744
|
sheet: v
|
|
4610
4745
|
};
|
|
@@ -4617,66 +4752,66 @@ class kn extends Be {
|
|
|
4617
4752
|
}
|
|
4618
4753
|
case Ue.id: {
|
|
4619
4754
|
if (!this._eventListend(this.Event.BeforeActiveSheetChange)) return;
|
|
4620
|
-
const { subUnitId:
|
|
4621
|
-
if (!c || !
|
|
4622
|
-
const v = c.getSheetBySheetId(
|
|
4623
|
-
if (!v || !
|
|
4624
|
-
this._fireBeforeActiveSheetChange(c, v,
|
|
4755
|
+
const { subUnitId: h, unitId: d } = n.params, c = d ? this.getUniverSheet(d) : (i = this.getActiveWorkbook) == null ? void 0 : i.call(this);
|
|
4756
|
+
if (!c || !h) return;
|
|
4757
|
+
const v = c.getSheetBySheetId(h), S = c.getActiveSheet();
|
|
4758
|
+
if (!v || !S) return;
|
|
4759
|
+
this._fireBeforeActiveSheetChange(c, v, S);
|
|
4625
4760
|
break;
|
|
4626
4761
|
}
|
|
4627
4762
|
case oe.id: {
|
|
4628
4763
|
if (!this._eventListend(this.Event.BeforeSheetDelete)) return;
|
|
4629
|
-
const
|
|
4630
|
-
if (!
|
|
4631
|
-
const { workbook: d, worksheet: c } =
|
|
4764
|
+
const h = this.getCommandSheetTarget(n);
|
|
4765
|
+
if (!h) return;
|
|
4766
|
+
const { workbook: d, worksheet: c } = h;
|
|
4632
4767
|
this._fireBeforeSheetDelete(d, c);
|
|
4633
4768
|
break;
|
|
4634
4769
|
}
|
|
4635
|
-
case
|
|
4770
|
+
case ae.id: {
|
|
4636
4771
|
if (!this._eventListend(this.Event.BeforeSheetMove)) return;
|
|
4637
|
-
const { fromOrder:
|
|
4772
|
+
const { fromOrder: h, toOrder: d } = n.params, c = this.getCommandSheetTarget(n);
|
|
4638
4773
|
if (!c) return;
|
|
4639
|
-
this._fireBeforeSheetMove(c.workbook, c.worksheet, d,
|
|
4774
|
+
this._fireBeforeSheetMove(c.workbook, c.worksheet, d, h);
|
|
4640
4775
|
break;
|
|
4641
4776
|
}
|
|
4642
4777
|
case ie.id: {
|
|
4643
4778
|
if (!this._eventListend(this.Event.BeforeSheetNameChange)) return;
|
|
4644
|
-
const { name:
|
|
4779
|
+
const { name: h } = n.params, d = this.getCommandSheetTarget(n);
|
|
4645
4780
|
if (!d) return;
|
|
4646
|
-
this._fireBeforeSheetNameChange(d.workbook, d.worksheet,
|
|
4781
|
+
this._fireBeforeSheetNameChange(d.workbook, d.worksheet, h, d.worksheet.getSheetName());
|
|
4647
4782
|
break;
|
|
4648
4783
|
}
|
|
4649
4784
|
case re.id: {
|
|
4650
4785
|
if (!this._eventListend(this.Event.BeforeSheetTabColorChange)) return;
|
|
4651
|
-
const { color:
|
|
4786
|
+
const { color: h } = n.params, d = this.getCommandSheetTarget(n);
|
|
4652
4787
|
if (!d) return;
|
|
4653
|
-
this._fireBeforeSheetTabColorChange(d.workbook, d.worksheet,
|
|
4788
|
+
this._fireBeforeSheetTabColorChange(d.workbook, d.worksheet, h, d.worksheet.getTabColor());
|
|
4654
4789
|
break;
|
|
4655
4790
|
}
|
|
4656
4791
|
case se.id: {
|
|
4657
4792
|
if (!this._eventListend(this.Event.BeforeSheetHideChange)) return;
|
|
4658
|
-
const { hidden:
|
|
4793
|
+
const { hidden: h } = n.params, d = this.getCommandSheetTarget(n);
|
|
4659
4794
|
if (!d) return;
|
|
4660
|
-
this._fireBeforeSheetHideChange(d.workbook, d.worksheet, !!
|
|
4795
|
+
this._fireBeforeSheetHideChange(d.workbook, d.worksheet, !!h);
|
|
4661
4796
|
break;
|
|
4662
4797
|
}
|
|
4663
4798
|
case ne.id: {
|
|
4664
4799
|
if (!this._eventListend(this.Event.BeforeGridlineColorChange)) return;
|
|
4665
|
-
const
|
|
4666
|
-
if (!
|
|
4800
|
+
const h = this.getCommandSheetTarget(n);
|
|
4801
|
+
if (!h) return;
|
|
4667
4802
|
this.fireEvent(this.Event.BeforeGridlineColorChange, {
|
|
4668
|
-
...
|
|
4803
|
+
...h,
|
|
4669
4804
|
color: (o = n.params) == null ? void 0 : o.color
|
|
4670
4805
|
});
|
|
4671
4806
|
break;
|
|
4672
4807
|
}
|
|
4673
4808
|
case te.id: {
|
|
4674
4809
|
if (!this._eventListend(this.Event.BeforeGridlineEnableChange)) return;
|
|
4675
|
-
const
|
|
4676
|
-
if (!
|
|
4810
|
+
const h = this.getCommandSheetTarget(n);
|
|
4811
|
+
if (!h) return;
|
|
4677
4812
|
this.fireEvent(this.Event.BeforeGridlineEnableChange, {
|
|
4678
|
-
...
|
|
4679
|
-
enabled: !!((
|
|
4813
|
+
...h,
|
|
4814
|
+
enabled: !!((a = n.params) != null && a.showGridlines)
|
|
4680
4815
|
});
|
|
4681
4816
|
break;
|
|
4682
4817
|
}
|
|
@@ -4686,31 +4821,31 @@ class kn extends Be {
|
|
|
4686
4821
|
// eslint-disable-next-line max-lines-per-function, complexity
|
|
4687
4822
|
t.onCommandExecuted((n) => {
|
|
4688
4823
|
var s, i;
|
|
4689
|
-
if (
|
|
4824
|
+
if (jt.indexOf(n.id) > -1) {
|
|
4690
4825
|
if (!this._eventListend(this.Event.SheetValueChanged) || !this.getActiveSheet()) return;
|
|
4691
|
-
const
|
|
4692
|
-
(
|
|
4826
|
+
const a = Ot(n).map(
|
|
4827
|
+
(h) => {
|
|
4693
4828
|
var d, c;
|
|
4694
|
-
return (c = (d = this.getWorkbook(
|
|
4829
|
+
return (c = (d = this.getWorkbook(h.unitId)) == null ? void 0 : d.getSheetBySheetId(h.subUnitId)) == null ? void 0 : c.getRange(h.range);
|
|
4695
4830
|
}
|
|
4696
4831
|
).filter(Boolean);
|
|
4697
|
-
if (!
|
|
4832
|
+
if (!a.length) return;
|
|
4698
4833
|
this.fireEvent(this.Event.SheetValueChanged, {
|
|
4699
4834
|
payload: n,
|
|
4700
|
-
effectedRanges:
|
|
4835
|
+
effectedRanges: a
|
|
4701
4836
|
});
|
|
4702
4837
|
return;
|
|
4703
4838
|
}
|
|
4704
4839
|
switch (n.id) {
|
|
4705
4840
|
case T.id: {
|
|
4706
|
-
const o = n.params, { unitId:
|
|
4707
|
-
if (!
|
|
4841
|
+
const o = n.params, { unitId: a } = o || {}, h = a ? this.getUniverSheet(a) : (s = this.getActiveWorkbook) == null ? void 0 : s.call(this);
|
|
4842
|
+
if (!h)
|
|
4708
4843
|
return;
|
|
4709
|
-
const d =
|
|
4844
|
+
const d = h.getActiveSheet();
|
|
4710
4845
|
if (!d)
|
|
4711
4846
|
return;
|
|
4712
4847
|
const c = {
|
|
4713
|
-
workbook:
|
|
4848
|
+
workbook: h,
|
|
4714
4849
|
worksheet: d
|
|
4715
4850
|
};
|
|
4716
4851
|
this.fireEvent(
|
|
@@ -4723,43 +4858,43 @@ class kn extends Be {
|
|
|
4723
4858
|
if (!this._eventListend(this.Event.ActiveSheetChanged)) return;
|
|
4724
4859
|
const o = this.getActiveSheet();
|
|
4725
4860
|
if (!o) return;
|
|
4726
|
-
const { workbook:
|
|
4727
|
-
this._fireActiveSheetChanged(
|
|
4861
|
+
const { workbook: a, worksheet: h } = o;
|
|
4862
|
+
this._fireActiveSheetChanged(a, h);
|
|
4728
4863
|
break;
|
|
4729
4864
|
}
|
|
4730
4865
|
case oe.id: {
|
|
4731
4866
|
if (!this._eventListend(this.Event.SheetDeleted)) return;
|
|
4732
|
-
const { subUnitId: o, unitId:
|
|
4733
|
-
if (!
|
|
4734
|
-
this._fireSheetDeleted(
|
|
4867
|
+
const { subUnitId: o, unitId: a } = n.params, h = a ? this.getUniverSheet(a) : (i = this.getActiveWorkbook) == null ? void 0 : i.call(this);
|
|
4868
|
+
if (!h || !o) return;
|
|
4869
|
+
this._fireSheetDeleted(h, o);
|
|
4735
4870
|
break;
|
|
4736
4871
|
}
|
|
4737
|
-
case
|
|
4872
|
+
case ae.id: {
|
|
4738
4873
|
if (!this._eventListend(this.Event.SheetMoved)) return;
|
|
4739
|
-
const { toOrder: o } = n.params,
|
|
4740
|
-
if (!
|
|
4741
|
-
this._fireSheetMoved(
|
|
4874
|
+
const { toOrder: o } = n.params, a = this.getCommandSheetTarget(n);
|
|
4875
|
+
if (!a) return;
|
|
4876
|
+
this._fireSheetMoved(a.workbook, a.worksheet, o);
|
|
4742
4877
|
break;
|
|
4743
4878
|
}
|
|
4744
4879
|
case ie.id: {
|
|
4745
4880
|
if (!this._eventListend(this.Event.SheetNameChanged)) return;
|
|
4746
|
-
const { name: o } = n.params,
|
|
4747
|
-
if (!
|
|
4748
|
-
this._fireSheetNameChanged(
|
|
4881
|
+
const { name: o } = n.params, a = this.getCommandSheetTarget(n);
|
|
4882
|
+
if (!a) return;
|
|
4883
|
+
this._fireSheetNameChanged(a.workbook, a.worksheet, o);
|
|
4749
4884
|
break;
|
|
4750
4885
|
}
|
|
4751
4886
|
case re.id: {
|
|
4752
4887
|
if (!this._eventListend(this.Event.SheetTabColorChanged)) return;
|
|
4753
|
-
const { color: o } = n.params,
|
|
4754
|
-
if (!
|
|
4755
|
-
this._fireSheetTabColorChanged(
|
|
4888
|
+
const { color: o } = n.params, a = this.getCommandSheetTarget(n);
|
|
4889
|
+
if (!a) return;
|
|
4890
|
+
this._fireSheetTabColorChanged(a.workbook, a.worksheet, o);
|
|
4756
4891
|
break;
|
|
4757
4892
|
}
|
|
4758
4893
|
case se.id: {
|
|
4759
4894
|
if (!this._eventListend(this.Event.SheetHideChanged)) return;
|
|
4760
|
-
const { hidden: o } = n.params,
|
|
4761
|
-
if (!
|
|
4762
|
-
this._fireSheetHideChanged(
|
|
4895
|
+
const { hidden: o } = n.params, a = this.getCommandSheetTarget(n);
|
|
4896
|
+
if (!a) return;
|
|
4897
|
+
this._fireSheetHideChanged(a.workbook, a.worksheet, !!o);
|
|
4763
4898
|
break;
|
|
4764
4899
|
}
|
|
4765
4900
|
case ne.id:
|
|
@@ -4905,16 +5040,16 @@ class kn extends Be {
|
|
|
4905
5040
|
}
|
|
4906
5041
|
}
|
|
4907
5042
|
Be.extend(kn);
|
|
4908
|
-
class
|
|
5043
|
+
class wn {
|
|
4909
5044
|
get SheetValueChangeType() {
|
|
4910
|
-
return
|
|
5045
|
+
return Lt;
|
|
4911
5046
|
}
|
|
4912
5047
|
get SheetSkeletonChangeType() {
|
|
4913
|
-
return
|
|
5048
|
+
return Vt;
|
|
4914
5049
|
}
|
|
4915
5050
|
}
|
|
4916
|
-
rt.extend(
|
|
4917
|
-
class
|
|
5051
|
+
rt.extend(wn);
|
|
5052
|
+
class Cn extends We {
|
|
4918
5053
|
get SheetCreated() {
|
|
4919
5054
|
return "SheetCreated";
|
|
4920
5055
|
}
|
|
@@ -4976,27 +5111,27 @@ class wn extends We {
|
|
|
4976
5111
|
return "SheetValueChanged";
|
|
4977
5112
|
}
|
|
4978
5113
|
}
|
|
4979
|
-
We.extend(
|
|
4980
|
-
var
|
|
4981
|
-
for (var s = n > 1 ? void 0 : n ?
|
|
5114
|
+
We.extend(Cn);
|
|
5115
|
+
var fn = Object.defineProperty, vn = Object.getOwnPropertyDescriptor, In = (r, e, t, n) => {
|
|
5116
|
+
for (var s = n > 1 ? void 0 : n ? vn(e, t) : e, i = r.length - 1, o; i >= 0; i--)
|
|
4982
5117
|
(o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
|
|
4983
|
-
return n && s &&
|
|
4984
|
-
},
|
|
5118
|
+
return n && s && fn(e, t, s), s;
|
|
5119
|
+
}, bn = (r, e) => (t, n) => e(t, n, r);
|
|
4985
5120
|
let xe = class extends de {
|
|
4986
5121
|
constructor(r) {
|
|
4987
5122
|
super(), this._injector = r;
|
|
4988
5123
|
}
|
|
4989
5124
|
};
|
|
4990
|
-
xe =
|
|
4991
|
-
|
|
5125
|
+
xe = In([
|
|
5126
|
+
bn(0, u(y))
|
|
4992
5127
|
], xe);
|
|
4993
5128
|
export {
|
|
4994
5129
|
j as FPermission,
|
|
4995
|
-
|
|
5130
|
+
k as FRange,
|
|
4996
5131
|
L as FSelection,
|
|
4997
|
-
|
|
5132
|
+
Cn as FSheetEventName,
|
|
4998
5133
|
xe as FSheetHooks,
|
|
4999
|
-
|
|
5134
|
+
wn as FSheetsEnum,
|
|
5000
5135
|
f as FWorkbook,
|
|
5001
|
-
|
|
5136
|
+
l as FWorksheet
|
|
5002
5137
|
};
|