@univerjs/sheets 0.5.2 → 0.5.3-experimental.20250106-e3b7a39

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.
Files changed (42) hide show
  1. package/lib/cjs/facade.js +1 -1
  2. package/lib/cjs/index.js +3 -3
  3. package/lib/es/facade.js +747 -497
  4. package/lib/es/index.js +5559 -4090
  5. package/lib/types/basics/interfaces/mutation-interface.d.ts +7 -0
  6. package/lib/types/commands/commands/__tests__/range-template-command.sepc.d.ts +16 -0
  7. package/lib/types/commands/commands/add-worksheet-merge.command.d.ts +1 -1
  8. package/lib/types/commands/commands/add-worksheet-range-theme.command.d.ts +2 -0
  9. package/lib/types/commands/commands/delete-worksheet-range-theme.command.d.ts +2 -0
  10. package/lib/types/commands/commands/insert-row-col.command.d.ts +2 -0
  11. package/lib/types/commands/commands/register-range-theme.command.d.ts +7 -0
  12. package/lib/types/commands/commands/remove-row-col.command.d.ts +12 -0
  13. package/lib/types/commands/commands/unregister-range-theme.command.d.ts +6 -0
  14. package/lib/types/commands/mutations/add-worksheet-range-theme.mutation.d.ts +9 -0
  15. package/lib/types/commands/mutations/delete-worksheet-range-theme.mutation.d.ts +9 -0
  16. package/lib/types/commands/mutations/register-range-theme.mutation.d.ts +8 -0
  17. package/lib/types/commands/mutations/unregister-range-theme-style.mutation.d.ts +6 -0
  18. package/lib/types/controllers/permission/sheet-permission-check.controller.d.ts +33 -0
  19. package/lib/types/controllers/permission/sheet-permission-init.controller.d.ts +29 -0
  20. package/lib/types/controllers/permission/sheet-permission-view-model.controller.d.ts +13 -0
  21. package/lib/types/facade/f-defined-name.d.ts +61 -61
  22. package/lib/types/facade/f-event.d.ts +30 -0
  23. package/lib/types/facade/f-permission.d.ts +0 -6
  24. package/lib/types/facade/f-range.d.ts +121 -36
  25. package/lib/types/facade/f-selection.d.ts +1 -1
  26. package/lib/types/facade/f-univer.d.ts +22 -6
  27. package/lib/types/facade/f-workbook.d.ts +78 -31
  28. package/lib/types/facade/f-worksheet.d.ts +130 -117
  29. package/lib/types/facade/index.d.ts +2 -1
  30. package/lib/types/facade/utils.d.ts +38 -2
  31. package/lib/types/index.d.ts +17 -3
  32. package/lib/types/model/range-theme-model.d.ts +66 -0
  33. package/lib/types/model/range-theme-util.d.ts +97 -0
  34. package/lib/types/model/range-themes/build-in-theme.factory.d.ts +5 -0
  35. package/lib/types/model/range-themes/default.d.ts +2 -0
  36. package/lib/types/services/range-theme-service.d.ts +34 -0
  37. package/lib/types/services/sheet-interceptor/interceptor-const.d.ts +2 -0
  38. package/lib/types/services/sheet-interceptor/sheet-interceptor.service.d.ts +5 -3
  39. package/lib/umd/facade.js +1 -1
  40. package/lib/umd/index.js +3 -3
  41. package/package.json +8 -31
  42. package/LICENSE +0 -176
package/lib/es/facade.js CHANGED
@@ -1,15 +1,15 @@
1
- var xe = Object.defineProperty;
2
- var Ee = (o, e, t) => e in o ? xe(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
- var P = (o, e, t) => Ee(o, typeof e != "symbol" ? e + "" : e, t);
4
- import { Inject as m, Injector as v, IAuthzIoService as we, LocaleService as ke, ICommandService as l, IPermissionService as Q, generateRandomId as Se, FBase as p, Rectangle as N, HorizontalAlign as R, VerticalAlign as b, isFormulaString as De, isCellV as Me, isICellData as je, ObjectMatrix as j, Tools as We, RANGE_TYPE as g, BooleanNumber as u, WrapStrategy as Z, Dimension as ee, ILogService as Ce, Direction as E, IResourceLoaderService as Oe, mergeWorksheetSnapshotWithDefault as Fe, UndoCommand as Ae, RedoCommand as Te, toDisposable as Ie, UniverInstanceType as U, IUniverInstanceService as fe, FUniver as ve } from "@univerjs/core";
5
- import { IDefinedNamesService as Re, serializeRange as X, FormulaDataModel as Le, serializeRangeWithSheet as Be, deserializeRangeWithSheet as ze } from "@univerjs/engine-formula";
6
- import { WorksheetProtectionRuleModel as be, RangeProtectionRuleModel as pe, WorksheetProtectionPointModel as Pe, SetDefinedNameCommand as q, SCOPE_WORKBOOK_VALUE_DEFINED_NAME as K, RemoveDefinedNameCommand as Ve, PermissionPointsDefinitions as He, WorkbookEditablePermission as ye, UnitObject as y, AddWorksheetProtectionMutation as $e, DeleteWorksheetProtectionMutation as Ge, getAllWorksheetPermissionPoint as qe, getAllWorksheetPermissionPointByPointPanel as te, SetWorksheetPermissionPointsMutation as Ke, AddRangeProtectionMutation as Ye, DeleteRangeProtectionMutation as Je, SetRangeProtectionMutation as Qe, WorksheetEditPermission as Xe, WorksheetViewPermission as Ze, SetStyleCommand as C, SetRangeValuesCommand as ne, SetTextWrapCommand as se, SetVerticalTextAlignCommand as et, SetHorizontalTextAlignCommand as tt, addMergeCellsUtil as L, getAddMergeMutationRangeByType as oe, RemoveWorksheetMergeCommand as nt, SplitTextToColumnsCommand as st, getPrimaryForRange as Y, SetSelectionsOperation as Ue, getNextPrimaryCell as ot, SheetsSelectionsService as Ne, SetWorksheetDefaultStyleMutation as rt, SetColDataCommand as re, SetRowDataCommand as ie, copyRangeStyles as D, InsertRowCommand as ae, RemoveRowCommand as it, MoveRowsCommand as at, SetRowHiddenCommand as he, SetSpecificRowsVisibleCommand as ce, SetRowHeightCommand as de, SetWorksheetRowIsAutoHeightCommand as ht, InsertColCommand as me, RemoveColCommand as ct, MoveColsCommand as dt, SetColHiddenCommand as ue, SetSpecificColsVisibleCommand as le, SetColWidthCommand as mt, SetFrozenCommand as B, CancelFrozenCommand as ut, ToggleGridlinesCommand as lt, SetGridlinesColorCommand as gt, SetTabColorCommand as _t, SetRangeValuesMutation as ge, SetWorksheetHideCommand as wt, SetWorksheetShowCommand as kt, SetWorksheetNameCommand as St, ClearSelectionAllCommand as Ct, ClearSelectionContentCommand as It, ClearSelectionFormatCommand as ft, InsertSheetCommand as z, SetWorksheetActiveOperation as V, RemoveSheetCommand as vt, CopySheetCommand as Rt, SetWorksheetOrderCommand as bt } from "@univerjs/sheets";
7
- var pt = Object.defineProperty, Pt = Object.getOwnPropertyDescriptor, yt = (o, e, t, n) => {
8
- for (var s = n > 1 ? void 0 : n ? Pt(e, t) : e, r = o.length - 1, i; r >= 0; r--)
1
+ var We = Object.defineProperty;
2
+ var Me = (o, e, t) => e in o ? We(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
+ var p = (o, e, t) => Me(o, typeof e != "symbol" ? e + "" : e, t);
4
+ import { Inject as m, Injector as v, IAuthzIoService as ke, LocaleService as Se, ICommandService as l, IPermissionService as J, generateRandomId as Ce, FBase as Q, Rectangle as E, HorizontalAlign as R, VerticalAlign as b, isFormulaString as Te, isCellV as je, isICellData as Ae, ObjectMatrix as M, Tools as Fe, RANGE_TYPE as _, FBaseInitialable as X, BooleanNumber as u, WrapStrategy as ee, Dimension as te, ILogService as Ie, Direction as N, IResourceLoaderService as Oe, mergeWorksheetSnapshotWithDefault as Be, UndoCommand as Le, RedoCommand as ze, toDisposable as fe, UniverInstanceType as P, IUniverInstanceService as ve, FUniver as Re, FEventName as be } from "@univerjs/core";
5
+ import { WorksheetProtectionRuleModel as pe, RangeProtectionRuleModel as ye, WorksheetProtectionPointModel as Pe, SetDefinedNameCommand as G, SCOPE_WORKBOOK_VALUE_DEFINED_NAME as q, RemoveDefinedNameCommand as Ve, PermissionPointsDefinitions as He, WorkbookEditablePermission as Ue, UnitObject as y, AddWorksheetProtectionMutation as $e, DeleteWorksheetProtectionMutation as Ge, getAllWorksheetPermissionPoint as qe, getAllWorksheetPermissionPointByPointPanel as ne, SetWorksheetPermissionPointsMutation as Ke, AddRangeProtectionMutation as Ye, DeleteRangeProtectionMutation as Je, SetRangeProtectionMutation as Qe, WorksheetEditPermission as Xe, WorksheetViewPermission as Ze, SetStyleCommand as C, SetRangeValuesCommand as se, SetTextWrapCommand as oe, SetVerticalTextAlignCommand as et, SetHorizontalTextAlignCommand as tt, addMergeCellsUtil as B, getAddMergeMutationRangeByType as re, RemoveWorksheetMergeCommand as nt, SplitTextToColumnsCommand as st, SetWorksheetRangeThemeStyleCommand as ot, DeleteWorksheetRangeThemeStyleCommand as rt, SheetRangeThemeService as Ee, getPrimaryForRange as K, SetSelectionsOperation as xe, getNextPrimaryCell as it, SheetsSelectionsService as Ne, SetWorksheetDefaultStyleMutation as at, SetColDataCommand as ie, SetRowDataCommand as ae, copyRangeStyles as D, InsertRowByRangeCommand as he, RemoveRowByRangeCommand as ht, MoveRowsCommand as ct, SetRowHiddenCommand as ce, SetSpecificRowsVisibleCommand as de, SetRowHeightCommand as me, SetWorksheetRowIsAutoHeightCommand as dt, InsertColByRangeCommand as ue, RemoveColByRangeCommand as mt, MoveColsCommand as ut, SetColHiddenCommand as le, SetSpecificColsVisibleCommand as ge, SetColWidthCommand as lt, SetFrozenCommand as L, CancelFrozenCommand as gt, ToggleGridlinesCommand as _t, SetGridlinesColorCommand as wt, SetTabColorCommand as kt, SetRangeValuesMutation as _e, SetWorksheetHideCommand as St, SetWorksheetShowCommand as Ct, SetWorksheetNameCommand as It, ClearSelectionAllCommand as ft, ClearSelectionContentCommand as vt, ClearSelectionFormatCommand as Rt, InsertSheetCommand as U, SetWorksheetActiveOperation as z, RemoveSheetCommand as bt, CopySheetCommand as pt, SetWorksheetOrderCommand as yt, RegisterWorksheetRangeThemeStyleCommand as Pt, UnregisterWorksheetRangeThemeStyleCommand as Ut } from "@univerjs/sheets";
6
+ import { IDefinedNamesService as De, serializeRange as Z, FormulaDataModel as Et, serializeRangeWithSheet as xt, deserializeRangeWithSheet as Nt } from "@univerjs/engine-formula";
7
+ var Dt = Object.defineProperty, Wt = Object.getOwnPropertyDescriptor, Mt = (o, e, t, n) => {
8
+ for (var s = n > 1 ? void 0 : n ? Wt(e, t) : e, r = o.length - 1, i; r >= 0; r--)
9
9
  (i = o[r]) && (s = (n ? i(e, t, s) : i(s)) || s);
10
- return n && s && pt(e, t, s), s;
11
- }, w = (o, e) => (t, n) => e(t, n, o);
12
- function Ut(o, e, t) {
10
+ return n && s && Dt(e, t, s), s;
11
+ }, k = (o, e) => (t, n) => e(t, n, o);
12
+ function Tt(o, e, t) {
13
13
  const n = t.getDefinedNameMap(o);
14
14
  if (n == null)
15
15
  return e.t("definedName.defaultName") + 1;
@@ -24,11 +24,11 @@ function Ut(o, e, t) {
24
24
  a++;
25
25
  }
26
26
  }
27
- class A {
27
+ class F {
28
28
  constructor() {
29
- P(this, "_definedNameParam");
29
+ p(this, "_definedNameParam");
30
30
  this._definedNameParam = {
31
- id: Se(10),
31
+ id: Ce(10),
32
32
  unitId: "",
33
33
  name: "",
34
34
  formulaOrRefString: ""
@@ -36,12 +36,12 @@ class A {
36
36
  }
37
37
  /**
38
38
  * Sets the name of the defined name builder.
39
- * @param name The name of the defined name.
40
- * @returns The defined name builder.
39
+ * @param {string} name The name of the defined name.
40
+ * @returns {FDefinedNameBuilder} The defined name builder.
41
41
  * @example
42
42
  * ```ts
43
- * const workbook = UniverAPI.getActiveWorkbook();
44
- * const definedNameBuilder = UniverAPI.newDefinedName()
43
+ * const workbook = univerAPI.getActiveWorkbook();
44
+ * const definedNameBuilder = univerAPI.newDefinedName()
45
45
  * .setName('MyDefinedName')
46
46
  * .build();
47
47
  * workbook.insertDefinedNameBuilder(definedNameBuilder);
@@ -52,12 +52,12 @@ class A {
52
52
  }
53
53
  /**
54
54
  * Sets the formula of the defined name builder.
55
- * @param formula The formula of the defined name.
56
- * @returns The defined name builder.
55
+ * @param {string }formula The formula of the defined name.
56
+ * @returns {FDefinedNameBuilder} The defined name builder.
57
57
  * @example
58
58
  * ```ts
59
- * const workbook = UniverAPI.getActiveWorkbook();
60
- * const definedNameBuilder = UniverAPI.newDefinedName()
59
+ * const workbook = univerAPI.getActiveWorkbook();
60
+ * const definedNameBuilder = univerAPI.newDefinedName()
61
61
  * .setFormula('SUM(Sheet1!$A$1)')
62
62
  * .setName('MyDefinedName')
63
63
  * .build();
@@ -69,12 +69,12 @@ class A {
69
69
  }
70
70
  /**
71
71
  * Sets the reference of the defined name builder.
72
- * @param refString The reference of the defined name.
73
- * @returns The defined name builder.
72
+ * @param {string} a1Notation The reference of the defined name.
73
+ * @returns {FDefinedNameBuilder} The defined name builder.
74
74
  * @example
75
75
  * ```ts
76
- * const workbook = UniverAPI.getActiveWorkbook();
77
- * const definedNameBuilder = UniverAPI.newDefinedName()
76
+ * const workbook = univerAPI.getActiveWorkbook();
77
+ * const definedNameBuilder = univerAPI.newDefinedName()
78
78
  * .setRef('Sheet1!$A$1')
79
79
  * .build();
80
80
  * workbook.insertDefinedNameBuilder(definedNameBuilder);
@@ -85,22 +85,22 @@ class A {
85
85
  }
86
86
  /**
87
87
  * Sets the reference of the defined name builder by range .
88
- * @param row The start row of the range.
89
- * @param column The start column of the range.
90
- * @param numRows The number of rows in the range.
91
- * @param numColumns The number of columns in the range.
92
- * @returns The defined name builder.
88
+ * @param {number} row The start row of the range.
89
+ * @param {number} column The start column of the range.
90
+ * @param {number} numRows The number of rows in the range.
91
+ * @param {number} numColumns The number of columns in the range.
92
+ * @returns {FDefinedNameBuilder} The defined name builder.
93
93
  * @example
94
94
  * ```ts
95
- * const workbook = UniverAPI.getActiveWorkbook();
96
- * const definedNameBuilder = UniverAPI.newDefinedName()
95
+ * const workbook = univerAPI.getActiveWorkbook();
96
+ * const definedNameBuilder = univerAPI.newDefinedName()
97
97
  * .setRefByRange(1, 3, 2, 5)
98
98
  * .build();
99
99
  * workbook.insertDefinedNameBuilder(definedNameBuilder);
100
100
  * ```
101
101
  */
102
102
  setRefByRange(e, t, n, s) {
103
- return this._definedNameParam.formulaOrRefString = X({
103
+ return this._definedNameParam.formulaOrRefString = Z({
104
104
  startRow: e,
105
105
  endRow: e + (n != null ? n : 1) - 1,
106
106
  startColumn: t,
@@ -109,12 +109,12 @@ class A {
109
109
  }
110
110
  /**
111
111
  * Sets the comment of the defined name builder.
112
- * @param comment The comment of the defined name.
113
- * @returns The defined name builder.
112
+ * @param {string} comment The comment of the defined name.
113
+ * @returns {FDefinedNameBuilder} The defined name builder.
114
114
  * @example
115
115
  * ```ts
116
- * const workbook = UniverAPI.getActiveWorkbook();
117
- * const definedNameBuilder = UniverAPI.newDefinedName()
116
+ * const workbook = univerAPI.getActiveWorkbook();
117
+ * const definedNameBuilder = univerAPI.newDefinedName()
118
118
  * .setComment('This is a comment')
119
119
  * .build();
120
120
  * workbook.insertDefinedNameBuilder(definedNameBuilder);
@@ -125,12 +125,12 @@ class A {
125
125
  }
126
126
  /**
127
127
  * Sets the hidden status of the defined name builder.
128
- * @param hidden The hidden status of the defined name.
129
- * @returns The defined name builder.
128
+ * @param {boolean} hidden The hidden status of the defined name.
129
+ * @returns {FDefinedNameBuilder} The defined name builder.
130
130
  * @example
131
131
  * ```ts
132
- * const workbook = UniverAPI.getActiveWorkbook();
133
- * const definedNameBuilder = UniverAPI.newDefinedName()
132
+ * const workbook = univerAPI.getActiveWorkbook();
133
+ * const definedNameBuilder = univerAPI.newDefinedName()
134
134
  * .setHidden(true)
135
135
  * .build();
136
136
  * workbook.insertDefinedNameBuilder(definedNameBuilder);
@@ -141,11 +141,11 @@ class A {
141
141
  }
142
142
  /**
143
143
  * Builds the defined name.
144
- * @returns The defined name mutation parameter.
144
+ * @returns {FDefinedNameBuilder} The defined name mutation parameter.
145
145
  * @example
146
146
  * ```ts
147
- * const workbook = UniverAPI.getActiveWorkbook();
148
- * const definedNameBuilder = UniverAPI.newDefinedName()
147
+ * const workbook = univerAPI.getActiveWorkbook();
148
+ * const definedNameBuilder = univerAPI.newDefinedName()
149
149
  * .setRef('Sheet1!$A$1')
150
150
  * .setName('MyDefinedName')
151
151
  * .build();
@@ -159,19 +159,19 @@ class A {
159
159
  return this._definedNameParam = e, this;
160
160
  }
161
161
  }
162
- let W = class extends p {
162
+ let T = class extends Q {
163
163
  constructor(o, e, t, n, s, r, i, a, h, c) {
164
164
  super(), this._definedNameParam = o, this._injector = e, this._commandService = t, this._permissionService = n, this._worksheetProtectionRuleModel = s, this._rangeProtectionRuleModel = r, this._worksheetProtectionPointRuleModel = i, this._authzIoService = a, this._localeService = h, this._definedNamesService = c;
165
165
  }
166
166
  _apply() {
167
- this._definedNameParam.name === "" && (this._definedNameParam.name = Ut(this._definedNameParam.unitId, this._localeService, this._definedNamesService)), this._commandService.syncExecuteCommand(q.id, this._definedNameParam);
167
+ this._definedNameParam.name === "" && (this._definedNameParam.name = Tt(this._definedNameParam.unitId, this._localeService, this._definedNamesService)), this._commandService.syncExecuteCommand(G.id, this._definedNameParam);
168
168
  }
169
169
  /**
170
170
  * Gets the name of the defined name.
171
- * @returns The name of the defined name.
171
+ * @returns {string} The name of the defined name.
172
172
  * @example
173
173
  * ```ts
174
- * const workbook = UniverAPI.getActiveWorkbook();
174
+ * const workbook = univerAPI.getActiveWorkbook();
175
175
  * const definedName = workbook.getDefinedNames[0];
176
176
  * console.log(definedName.getName());
177
177
  * ```
@@ -181,10 +181,10 @@ let W = class extends p {
181
181
  }
182
182
  /**
183
183
  * Sets the name of the defined name.
184
- * @param name The name of the defined name.
184
+ * @param {string} name The name of the defined name.
185
185
  * @example
186
186
  * ```ts
187
- * const workbook = UniverAPI.getActiveWorkbook();
187
+ * const workbook = univerAPI.getActiveWorkbook();
188
188
  * const definedName = workbook.getDefinedName('MyDefinedName');
189
189
  * definedName.setName('NewDefinedName');
190
190
  * ```
@@ -194,10 +194,10 @@ let W = class extends p {
194
194
  }
195
195
  /**
196
196
  * Sets the formula of the defined name.
197
- * @param formula The formula of the defined name.
197
+ * @param {string} formula The formula of the defined name.
198
198
  * @example
199
199
  * ```ts
200
- * const workbook = UniverAPI.getActiveWorkbook();
200
+ * const workbook = univerAPI.getActiveWorkbook();
201
201
  * const definedName = workbook.getDefinedName('MyDefinedName');
202
202
  * definedName.setFormula('SUM(Sheet1!$A$1)');
203
203
  * ```
@@ -207,10 +207,10 @@ let W = class extends p {
207
207
  }
208
208
  /**
209
209
  * Sets the reference of the defined name.
210
- * @param refString The reference of the defined name.
210
+ * @param {string} refString The reference of the defined name.
211
211
  * @example
212
212
  * ```ts
213
- * const workbook = UniverAPI.getActiveWorkbook();
213
+ * const workbook = univerAPI.getActiveWorkbook();
214
214
  * const definedName = workbook.getDefinedNames[0];
215
215
  * definedName.setRef('Sheet1!$A$1');
216
216
  * ```
@@ -220,10 +220,10 @@ let W = class extends p {
220
220
  }
221
221
  /**
222
222
  * Gets the reference of the defined name.
223
- * @returns The reference of the defined name.
223
+ * @returns {string} The reference of the defined name.
224
224
  * @example
225
225
  * ```ts
226
- * const workbook = UniverAPI.getActiveWorkbook();
226
+ * const workbook = univerAPI.getActiveWorkbook();
227
227
  * const definedName = workbook.getDefinedNames[0];
228
228
  * console.log(definedName.getFormulaOrRefString());
229
229
  * ```
@@ -233,19 +233,19 @@ let W = class extends p {
233
233
  }
234
234
  /**
235
235
  * Sets the reference of the defined name by range.
236
- * @param row The start row of the range.
237
- * @param column The start column of the range.
238
- * @param numRows The number of rows in the range.
239
- * @param numColumns The number of columns in the range.
236
+ * @param {number} row The start row of the range.
237
+ * @param {number} column The start column of the range.
238
+ * @param {number} numRows The number of rows in the range.
239
+ * @param {number} numColumns The number of columns in the range.
240
240
  * @example
241
241
  * ```ts
242
- * const workbook = UniverAPI.getActiveWorkbook();
242
+ * const workbook = univerAPI.getActiveWorkbook();
243
243
  * const definedName = workbook.getDefinedNames[0];
244
244
  * definedName.setRefByRange(1, 3, 2, 5);
245
245
  * ```
246
246
  */
247
247
  setRefByRange(o, e, t, n) {
248
- this._definedNameParam.formulaOrRefString = X({
248
+ this._definedNameParam.formulaOrRefString = Z({
249
249
  startRow: o,
250
250
  endRow: o + (t != null ? t : 1) - 1,
251
251
  startColumn: e,
@@ -254,10 +254,10 @@ let W = class extends p {
254
254
  }
255
255
  /**
256
256
  * Gets the comment of the defined name.
257
- * @returns The comment of the defined name.
257
+ * @returns {string | undefined} The comment of the defined name.
258
258
  * @example
259
259
  * ```ts
260
- * const workbook = UniverAPI.getActiveWorkbook();
260
+ * const workbook = univerAPI.getActiveWorkbook();
261
261
  * const definedName = workbook.getDefinedNames[0];
262
262
  * console.log(definedName.getComment());
263
263
  * ```
@@ -267,10 +267,10 @@ let W = class extends p {
267
267
  }
268
268
  /**
269
269
  * Sets the comment of the defined name.
270
- * @param comment The comment of the defined name.
270
+ * @param {string} comment The comment of the defined name.
271
271
  * @example
272
272
  * ```ts
273
- * const workbook = UniverAPI.getActiveWorkbook();
273
+ * const workbook = univerAPI.getActiveWorkbook();
274
274
  * const definedName = workbook.getDefinedNames[0];
275
275
  * definedName.setComment('This is a comment');
276
276
  * ```
@@ -280,10 +280,10 @@ let W = class extends p {
280
280
  }
281
281
  /**
282
282
  * Sets the scope of the defined name to the worksheet.
283
- * @param worksheet The worksheet to set the scope to.
283
+ * @param {FWorksheet} worksheet The worksheet to set the scope to.
284
284
  * @example
285
285
  * ```ts
286
- * const workbook = UniverAPI.getActiveWorkbook();
286
+ * const workbook = univerAPI.getActiveWorkbook();
287
287
  * const worksheet = workbook.getWorksheets[0];
288
288
  * const definedName = workbook.getDefinedNames[0];
289
289
  * definedName.setScopeToWorksheet(worksheet);
@@ -296,20 +296,20 @@ let W = class extends p {
296
296
  * Sets the scope of the defined name to the workbook.
297
297
  * @example
298
298
  * ```ts
299
- * const workbook = UniverAPI.getActiveWorkbook();
299
+ * const workbook = univerAPI.getActiveWorkbook();
300
300
  * const definedName = workbook.getDefinedNames[0];
301
301
  * definedName.setScopeToWorkbook();
302
302
  * ```
303
303
  */
304
304
  setScopeToWorkbook() {
305
- this._definedNameParam.localSheetId = K, this._apply();
305
+ this._definedNameParam.localSheetId = q, this._apply();
306
306
  }
307
307
  /**
308
308
  * Sets the hidden status of the defined name.
309
- * @param hidden The hidden status of the defined name.
309
+ * @param {boolean} hidden The hidden status of the defined name.
310
310
  * @example
311
311
  * ```ts
312
- * const workbook = UniverAPI.getActiveWorkbook();
312
+ * const workbook = univerAPI.getActiveWorkbook();
313
313
  * const definedName = workbook.getDefinedNames[0];
314
314
  * definedName.setHidden(true);
315
315
  * ```
@@ -321,7 +321,7 @@ let W = class extends p {
321
321
  * Deletes the defined name.
322
322
  * @example
323
323
  * ```ts
324
- * const workbook = UniverAPI.getActiveWorkbook();
324
+ * const workbook = univerAPI.getActiveWorkbook();
325
325
  * const definedName = workbook.getDefinedNames[0];
326
326
  * definedName.delete();
327
327
  * ```
@@ -331,10 +331,10 @@ let W = class extends p {
331
331
  }
332
332
  /**
333
333
  * Gets the local sheet id of the defined name.
334
- * @returns The local sheet id of the defined name.
334
+ * @returns {string | undefined} The local sheet id of the defined name.
335
335
  * @example
336
336
  * ```ts
337
- * const workbook = UniverAPI.getActiveWorkbook();
337
+ * const workbook = univerAPI.getActiveWorkbook();
338
338
  * const definedName = workbook.getDefinedNames[0];
339
339
  * console.log(definedName.getLocalSheetId());
340
340
  * ```
@@ -344,23 +344,23 @@ let W = class extends p {
344
344
  }
345
345
  /**
346
346
  * Checks if the defined name is in the workbook scope.
347
- * @returns True if the defined name is in the workbook scope, false otherwise.
347
+ * @returns {boolean} True if the defined name is in the workbook scope, false otherwise.
348
348
  * @example
349
349
  * ```ts
350
- * const workbook = UniverAPI.getActiveWorkbook();
350
+ * const workbook = univerAPI.getActiveWorkbook();
351
351
  * const definedName = workbook.getDefinedNames[0];
352
352
  * console.log(definedName.isWorkbookScope());
353
353
  * ```
354
354
  */
355
355
  isWorkbookScope() {
356
- return this._definedNameParam.localSheetId === K;
356
+ return this._definedNameParam.localSheetId === q;
357
357
  }
358
358
  /**
359
359
  * Converts the defined name to a defined name builder.
360
- * @returns The defined name builder.
360
+ * @returns {FDefinedNameBuilder} The defined name builder.
361
361
  * @example
362
362
  * ```ts
363
- * const workbook = UniverAPI.getActiveWorkbook();
363
+ * const workbook = univerAPI.getActiveWorkbook();
364
364
  * const definedName = workbook.getDefinedNames[0];
365
365
  * const definedNameBuilder = definedName.toBuilder();
366
366
  * const param definedNameBuilder.setName('NewDefinedName').setFormula('SUM(Sheet1!$A$1)').build();
@@ -368,30 +368,30 @@ let W = class extends p {
368
368
  * ```
369
369
  */
370
370
  toBuilder() {
371
- const o = this._injector.createInstance(A);
371
+ const o = this._injector.createInstance(F);
372
372
  return o.load(this._definedNameParam), o;
373
373
  }
374
374
  };
375
- W = yt([
376
- w(1, m(v)),
377
- w(2, l),
378
- w(3, Q),
379
- w(4, m(be)),
380
- w(5, m(pe)),
381
- w(6, m(Pe)),
382
- w(7, m(we)),
383
- w(8, m(ke)),
384
- w(9, Re)
385
- ], W);
386
- var Nt = Object.defineProperty, xt = Object.getOwnPropertyDescriptor, Et = (o, e, t, n) => {
387
- for (var s = n > 1 ? void 0 : n ? xt(e, t) : e, r = o.length - 1, i; r >= 0; r--)
375
+ T = Mt([
376
+ k(1, m(v)),
377
+ k(2, l),
378
+ k(3, J),
379
+ k(4, m(pe)),
380
+ k(5, m(ye)),
381
+ k(6, m(Pe)),
382
+ k(7, m(ke)),
383
+ k(8, m(Se)),
384
+ k(9, De)
385
+ ], T);
386
+ var jt = Object.defineProperty, At = Object.getOwnPropertyDescriptor, Ft = (o, e, t, n) => {
387
+ for (var s = n > 1 ? void 0 : n ? At(e, t) : e, r = o.length - 1, i; r >= 0; r--)
388
388
  (i = o[r]) && (s = (n ? i(e, t, s) : i(s)) || s);
389
- return n && s && Nt(e, t, s), s;
389
+ return n && s && jt(e, t, s), s;
390
390
  }, f = (o, e) => (t, n) => e(t, n, o);
391
- let O = class extends p {
391
+ let j = class extends Q {
392
392
  constructor(e, t, n, s, r, i, a) {
393
393
  super();
394
- P(this, "permissionPointsDefinition", He);
394
+ p(this, "permissionPointsDefinition", He);
395
395
  this._injector = e, this._commandService = t, this._permissionService = n, this._worksheetProtectionRuleModel = s, this._rangeProtectionRuleModel = r, this._worksheetProtectionPointRuleModel = i, this._authzIoService = a;
396
396
  }
397
397
  /**
@@ -417,7 +417,7 @@ let O = class extends p {
417
417
  *
418
418
  */
419
419
  setWorkbookEditPermission(e, t) {
420
- this.setWorkbookPermissionPoint(e, ye, t);
420
+ this.setWorkbookPermissionPoint(e, Ue, t);
421
421
  }
422
422
  /**
423
423
  * This function is used to add a base permission for a worksheet.
@@ -462,7 +462,7 @@ let O = class extends p {
462
462
  this._commandService.syncExecuteCommand(Ge.id, {
463
463
  unitId: e,
464
464
  subUnitId: t
465
- }), [...qe(), ...te()].forEach((n) => {
465
+ }), [...qe(), ...ne()].forEach((n) => {
466
466
  const s = new n(e, t);
467
467
  this._permissionService.updatePermissionPoint(s.id, !0);
468
468
  }), this._worksheetProtectionPointRuleModel.deleteRule(e, t);
@@ -524,10 +524,10 @@ let O = class extends p {
524
524
  name: "",
525
525
  scope: void 0
526
526
  }
527
- }), r = `ruleId_${Se(6)}`;
527
+ }), r = `ruleId_${Ce(6)}`;
528
528
  if (this._worksheetProtectionRuleModel.getRule(e, t))
529
529
  throw new Error("sheet protection cannot intersect with range protection");
530
- if (this._rangeProtectionRuleModel.getSubunitRuleList(e, t).some((d) => d.ranges.some((T) => n.some((x) => N.intersects(x, T)))))
530
+ if (this._rangeProtectionRuleModel.getSubunitRuleList(e, t).some((d) => d.ranges.some((O) => n.some((x) => E.intersects(x, O)))))
531
531
  throw new Error("range protection cannot intersect");
532
532
  if (this._commandService.syncExecuteCommand(Ye.id, {
533
533
  unitId: e,
@@ -558,7 +558,7 @@ let O = class extends p {
558
558
  unitId: e,
559
559
  subUnitId: t,
560
560
  ruleIds: n
561
- }) && this._rangeProtectionRuleModel.getSubunitRuleList(e, t).length === 0 && (this._worksheetProtectionPointRuleModel.deleteRule(e, t), [...te()].forEach((i) => {
561
+ }) && this._rangeProtectionRuleModel.getSubunitRuleList(e, t).length === 0 && (this._worksheetProtectionPointRuleModel.deleteRule(e, t), [...ne()].forEach((i) => {
562
562
  const a = new i(e, t);
563
563
  this._permissionService.updatePermissionPoint(a.id, a.value);
564
564
  }));
@@ -592,7 +592,7 @@ let O = class extends p {
592
592
  setRangeProtectionRanges(e, t, n, s) {
593
593
  const r = this._rangeProtectionRuleModel.getRule(e, t, n);
594
594
  if (r) {
595
- if (this._rangeProtectionRuleModel.getSubunitRuleList(e, t).filter((h) => h.id !== n).some((h) => h.ranges.some((c) => s.some((d) => N.intersects(d, c)))))
595
+ if (this._rangeProtectionRuleModel.getSubunitRuleList(e, t).filter((h) => h.id !== n).some((h) => h.ranges.some((c) => s.some((d) => E.intersects(d, c)))))
596
596
  throw new Error("range protection cannot intersect");
597
597
  this._commandService.syncExecuteCommand(Qe.id, {
598
598
  unitId: e,
@@ -605,25 +605,17 @@ let O = class extends p {
605
605
  });
606
606
  }
607
607
  }
608
- /**
609
- * Set visibility of unauthorized pop-up window
610
- *
611
- * @param {boolean} visible
612
- */
613
- setPermissionDialogVisible(e) {
614
- this._permissionService.setShowComponents(e);
615
- }
616
608
  };
617
- O = Et([
609
+ j = Ft([
618
610
  f(0, m(v)),
619
611
  f(1, l),
620
- f(2, Q),
621
- f(3, m(be)),
622
- f(4, m(pe)),
612
+ f(2, J),
613
+ f(3, m(pe)),
614
+ f(4, m(ye)),
623
615
  f(5, m(Pe)),
624
- f(6, m(we))
625
- ], O);
626
- function Dt(o) {
616
+ f(6, m(ke))
617
+ ], j);
618
+ function Ot(o) {
627
619
  switch (o) {
628
620
  case "left":
629
621
  return R.LEFT;
@@ -635,7 +627,7 @@ function Dt(o) {
635
627
  throw new Error(`Invalid horizontal alignment: ${o}`);
636
628
  }
637
629
  }
638
- function Mt(o) {
630
+ function Bt(o) {
639
631
  switch (o) {
640
632
  case R.LEFT:
641
633
  return "left";
@@ -647,7 +639,7 @@ function Mt(o) {
647
639
  throw new Error(`Invalid horizontal alignment: ${o}`);
648
640
  }
649
641
  }
650
- function jt(o) {
642
+ function Lt(o) {
651
643
  switch (o) {
652
644
  case "top":
653
645
  return b.TOP;
@@ -659,7 +651,7 @@ function jt(o) {
659
651
  throw new Error(`Invalid vertical alignment: ${o}`);
660
652
  }
661
653
  }
662
- function Wt(o) {
654
+ function zt(o) {
663
655
  switch (o) {
664
656
  case b.TOP:
665
657
  return "top";
@@ -671,104 +663,97 @@ function Wt(o) {
671
663
  throw new Error(`Invalid vertical alignment: ${o}`);
672
664
  }
673
665
  }
674
- function J(o) {
675
- return De(o) ? {
666
+ function Y(o) {
667
+ return Te(o) ? {
676
668
  f: o
677
- } : Me(o) ? {
669
+ } : je(o) ? {
678
670
  v: o
679
- } : (je(o), o);
671
+ } : (Ae(o), o);
680
672
  }
681
- function Ot(o, e) {
682
- const t = new j(), { startRow: n, startColumn: s, endRow: r, endColumn: i } = e;
683
- if (We.isArray(o))
673
+ function Vt(o, e) {
674
+ const t = new M(), { startRow: n, startColumn: s, endRow: r, endColumn: i } = e;
675
+ if (Fe.isArray(o))
684
676
  for (let a = 0; a <= r - n; a++)
685
677
  for (let h = 0; h <= i - s; h++)
686
- t.setValue(a + n, h + s, J(o[a][h]));
678
+ t.setValue(a + n, h + s, Y(o[a][h]));
687
679
  else
688
- new j(o).forValue((h, c, d) => {
689
- t.setValue(h, c, J(d));
680
+ new M(o).forValue((h, c, d) => {
681
+ t.setValue(h, c, Y(d));
690
682
  });
691
683
  return t.getMatrix();
692
684
  }
693
- function H(o, e) {
685
+ function V(o, e) {
694
686
  return {
695
687
  startRow: o.startRow,
696
688
  endRow: o.endRow,
697
689
  startColumn: 0,
698
690
  endColumn: e.getColumnCount() - 1,
699
- rangeType: g.ROW
691
+ rangeType: _.ROW
700
692
  };
701
693
  }
702
- function $(o, e) {
694
+ function H(o, e) {
703
695
  return {
704
696
  startRow: 0,
705
697
  endRow: e.getRowCount() - 1,
706
698
  startColumn: o.startColumn,
707
699
  endColumn: o.endColumn,
708
- rangeType: g.COLUMN
700
+ rangeType: _.COLUMN
709
701
  };
710
702
  }
711
- var Ft = Object.defineProperty, At = Object.getOwnPropertyDescriptor, Tt = (o, e, t, n) => {
712
- for (var s = n > 1 ? void 0 : n ? At(e, t) : e, r = o.length - 1, i; r >= 0; r--)
703
+ var Ht = Object.defineProperty, $t = Object.getOwnPropertyDescriptor, Gt = (o, e, t, n) => {
704
+ for (var s = n > 1 ? void 0 : n ? $t(e, t) : e, r = o.length - 1, i; r >= 0; r--)
713
705
  (i = o[r]) && (s = (n ? i(e, t, s) : i(s)) || s);
714
- return n && s && Ft(e, t, s), s;
715
- }, G = (o, e) => (t, n) => e(t, n, o);
716
- let S = class extends p {
706
+ return n && s && Ht(e, t, s), s;
707
+ }, $ = (o, e) => (t, n) => e(t, n, o);
708
+ let w = class extends X {
717
709
  constructor(o, e, t, n, s, r) {
718
- super(), this._workbook = o, this._worksheet = e, this._range = t, this._injector = n, this._commandService = s, this._formulaDataModel = r;
710
+ super(n), this._workbook = o, this._worksheet = e, this._range = t, this._injector = n, this._commandService = s, this._formulaDataModel = r;
719
711
  }
720
712
  /**
721
713
  * Get the unit ID of the current workbook
722
- *
723
- * @return The unit ID of the workbook
714
+ * @returns The unit ID of the workbook
724
715
  */
725
716
  getUnitId() {
726
717
  return this._workbook.getUnitId();
727
718
  }
728
719
  /**
729
720
  * Gets the name of the worksheet
730
- *
731
- * @return The name of the worksheet
721
+ * @returns The name of the worksheet
732
722
  */
733
723
  getSheetName() {
734
724
  return this._worksheet.getName();
735
725
  }
736
726
  /**
737
727
  * Gets the area where the statement is applied
738
- *
739
- * @return The area where the statement is applied
728
+ * @returns The area where the statement is applied
740
729
  */
741
730
  getRange() {
742
731
  return this._range;
743
732
  }
744
733
  /**
745
734
  * Gets the starting row number of the applied area
746
- *
747
- * @return The starting row number of the area
735
+ * @returns The starting row number of the area
748
736
  */
749
737
  getRow() {
750
738
  return this._range.startRow;
751
739
  }
752
740
  /**
753
741
  * Gets the starting column number of the applied area
754
- *
755
- * @return The starting column number of the area
742
+ * @returns The starting column number of the area
756
743
  */
757
744
  getColumn() {
758
745
  return this._range.startColumn;
759
746
  }
760
747
  /**
761
748
  * Gets the width of the applied area
762
- *
763
- * @return The width of the area
749
+ * @returns The width of the area
764
750
  */
765
751
  getWidth() {
766
752
  return this._range.endColumn - this._range.startColumn + 1;
767
753
  }
768
754
  /**
769
755
  * Gets the height of the applied area
770
- *
771
- * @return The height of the area
756
+ * @returns The height of the area
772
757
  */
773
758
  getHeight() {
774
759
  return this._range.endRow - this._range.startRow + 1;
@@ -787,7 +772,7 @@ let S = class extends p {
787
772
  */
788
773
  isMerged() {
789
774
  const { startColumn: o, startRow: e, endColumn: t, endRow: n } = this._range;
790
- return this._worksheet.getMergedCellRange(e, o, n, t).some((r) => N.equals(r, this._range));
775
+ return this._worksheet.getMergedCellRange(e, o, n, t).some((r) => E.equals(r, this._range));
791
776
  }
792
777
  /**
793
778
  * Return first cell style data in this range
@@ -859,22 +844,22 @@ let S = class extends p {
859
844
  return this._worksheet.getRange(this._range).getWrapStrategy();
860
845
  }
861
846
  getHorizontalAlignment() {
862
- return Mt(this._worksheet.getRange(this._range).getHorizontalAlignment());
847
+ return Bt(this._worksheet.getRange(this._range).getHorizontalAlignment());
863
848
  }
864
849
  getVerticalAlignment() {
865
- return Wt(this._worksheet.getRange(this._range).getVerticalAlignment());
850
+ return zt(this._worksheet.getRange(this._range).getVerticalAlignment());
866
851
  }
867
852
  // #region editing
868
853
  /**
869
854
  * Set background color for current range.
855
+ * @param color {string}
870
856
  * @example
871
- * ```
857
+ * ```typescript
872
858
  * univerAPI.getActiveWorkbook().getActiveSheet().getActiveRange().setBackgroundColor('red')
873
859
  * ```
874
- * @param color {string}
875
860
  */
876
861
  setBackgroundColor(o) {
877
- return this._commandService.executeCommand(C.id, {
862
+ return this._commandService.syncExecuteCommand(C.id, {
878
863
  unitId: this._workbook.getUnitId(),
879
864
  subUnitId: this._worksheet.getSheetId(),
880
865
  range: this._range,
@@ -884,88 +869,95 @@ let S = class extends p {
884
869
  rgb: o
885
870
  }
886
871
  }
887
- });
872
+ }), this;
888
873
  }
889
874
  /**
890
875
  * Set background color for current range.
891
- * e.g. `univerAPI.getActiveWorkbook().getActiveSheet().getActiveRange().setBackground('red')`
876
+ * @example
877
+ * ```typescript
878
+ * univerAPI.getActiveWorkbook().getActiveSheet().getActiveRange().setBackground('red')
879
+ * ```
892
880
  * @param color {string}
893
881
  */
894
882
  setBackground(o) {
895
- return this.setBackgroundColor(o);
883
+ return this.setBackgroundColor(o), this;
896
884
  }
897
885
  /**
898
886
  * The value can be a number, string, boolean, or standard cell format. If it begins with `=`, it is interpreted as a formula. The value is tiled to all cells in the range.
899
887
  * @param value
900
888
  */
901
889
  setValue(o) {
902
- const e = J(o);
890
+ const e = Y(o);
903
891
  if (!e)
904
892
  throw new Error("Invalid value");
905
- return this._commandService.executeCommand(ne.id, {
893
+ return this._commandService.syncExecuteCommand(se.id, {
906
894
  unitId: this._workbook.getUnitId(),
907
895
  subUnitId: this._worksheet.getSheetId(),
908
896
  range: this._range,
909
897
  value: e
910
- });
898
+ }), this;
911
899
  }
912
900
  /**
913
901
  * Set the cell wrap of the given range.
914
902
  * Cells with wrap enabled (the default) resize to display their full content. Cells with wrap disabled display as much as possible in the cell without resizing or running to multiple lines.
903
+ * @param isWrapEnabled
915
904
  */
916
905
  setWrap(o) {
917
- return this._commandService.executeCommand(se.id, {
906
+ return this._commandService.syncExecuteCommand(oe.id, {
918
907
  unitId: this._workbook.getUnitId(),
919
908
  subUnitId: this._worksheet.getSheetId(),
920
909
  range: this._range,
921
- value: o ? Z.WRAP : Z.UNSPECIFIED
922
- });
910
+ value: o ? ee.WRAP : ee.UNSPECIFIED
911
+ }), this;
923
912
  }
924
913
  /**
925
914
  * Sets the text wrapping strategy for the cells in the range.
915
+ * @param strategy
926
916
  */
927
917
  setWrapStrategy(o) {
928
- return this._commandService.executeCommand(se.id, {
918
+ return this._commandService.syncExecuteCommand(oe.id, {
929
919
  unitId: this._workbook.getUnitId(),
930
920
  subUnitId: this._worksheet.getSheetId(),
931
921
  range: this._range,
932
922
  value: o
933
- });
923
+ }), this;
934
924
  }
935
925
  /**
936
926
  * Set the vertical (top to bottom) alignment for the given range (top/middle/bottom).
927
+ * @param alignment
937
928
  */
938
929
  setVerticalAlignment(o) {
939
- return this._commandService.executeCommand(et.id, {
930
+ return this._commandService.syncExecuteCommand(et.id, {
940
931
  unitId: this._workbook.getUnitId(),
941
932
  subUnitId: this._worksheet.getSheetId(),
942
933
  range: this._range,
943
- value: jt(o)
944
- });
934
+ value: Lt(o)
935
+ }), this;
945
936
  }
946
937
  /**
947
938
  * Set the horizontal (left to right) alignment for the given range (left/center/right).
939
+ * @param alignment
948
940
  */
949
941
  setHorizontalAlignment(o) {
950
- return this._commandService.executeCommand(tt.id, {
942
+ return this._commandService.syncExecuteCommand(tt.id, {
951
943
  unitId: this._workbook.getUnitId(),
952
944
  subUnitId: this._worksheet.getSheetId(),
953
945
  range: this._range,
954
- value: Dt(o)
955
- });
946
+ value: Ot(o)
947
+ }), this;
956
948
  }
957
949
  /**
958
950
  * Sets a different value for each cell in the range. The value can be a two-dimensional array or a standard range matrix (must match the dimensions of this range), consisting of numbers, strings, Boolean values or Composed of standard cell formats. If a value begins with `=`, it is interpreted as a formula.
959
951
  * @param value
960
952
  */
961
953
  setValues(o) {
962
- const e = Ot(o, this._range);
963
- return this._commandService.executeCommand(ne.id, {
954
+ const e = Vt(o, this._range);
955
+ return this._commandService.syncExecuteCommand(se.id, {
964
956
  unitId: this._workbook.getUnitId(),
965
957
  subUnitId: this._worksheet.getSheetId(),
966
958
  range: this._range,
967
959
  value: e
968
- });
960
+ }), this;
969
961
  }
970
962
  /**
971
963
  * Sets the font weight for the given range (normal/bold),
@@ -1044,6 +1036,7 @@ let S = class extends p {
1044
1036
  }
1045
1037
  /**
1046
1038
  * Sets the font underline style of the given ITextDecoration
1039
+ * @param value
1047
1040
  */
1048
1041
  _setFontUnderline(o) {
1049
1042
  const e = {
@@ -1059,6 +1052,7 @@ let S = class extends p {
1059
1052
  }
1060
1053
  /**
1061
1054
  * Sets the font strikethrough style of the given ITextDecoration
1055
+ * @param value
1062
1056
  */
1063
1057
  _setFontStrikethrough(o) {
1064
1058
  const e = {
@@ -1124,40 +1118,71 @@ let S = class extends p {
1124
1118
  //#region Merge cell
1125
1119
  /**
1126
1120
  * Merge cells in a range into one merged cell
1127
- *
1128
1121
  * @param [defaultMerge] - If true, only the value in the upper left cell is retained.
1129
- *
1130
1122
  * @returns This range, for chaining
1123
+ * @example
1124
+ * ```ts
1125
+ * const workbook = univerAPI.getActiveWorkbook();
1126
+ * const worksheet = workbook.getActiveSheet();
1127
+ * const range = worksheet.getRange(0, 0, 2, 2);
1128
+ * const merge = range.merge();
1129
+ * const isMerged = merge.isMerged();
1130
+ * console.log('debugger', isMerged);
1131
+ * ```
1131
1132
  */
1132
- async merge(o = !0) {
1133
+ merge(o = !0) {
1133
1134
  const e = this._workbook.getUnitId(), t = this._worksheet.getSheetId();
1134
- return await L(this._injector, e, t, [this._range], o), this;
1135
+ return B(this._injector, e, t, [this._range], o), this;
1135
1136
  }
1136
1137
  /**
1137
1138
  * Merges cells in a range horizontally.
1138
- *
1139
1139
  * @param [defaultMerge] - If true, only the value in the upper left cell is retained.
1140
- *
1141
1140
  * @returns This range, for chaining
1141
+ * @example
1142
+ * ```ts
1143
+ * const workbook = univerAPI.getActiveWorkbook();
1144
+ * const worksheet = workbook.getActiveSheet();
1145
+ * const range = worksheet.getRange(2, 2, 2, 2);
1146
+ * const merge = range.mergeAcross();
1147
+ * const allMerge = worksheet.getMergeData();
1148
+ * console.log(allMerge.length); // There will be two merged cells.
1149
+ * ```
1142
1150
  */
1143
- async mergeAcross(o = !0) {
1144
- const e = oe([this._range], ee.ROWS), t = this._workbook.getUnitId(), n = this._worksheet.getSheetId();
1145
- return await L(this._injector, t, n, e, o), this;
1151
+ mergeAcross(o = !0) {
1152
+ const e = re([this._range], te.ROWS), t = this._workbook.getUnitId(), n = this._worksheet.getSheetId();
1153
+ return B(this._injector, t, n, e, o), this;
1146
1154
  }
1147
1155
  /**
1148
1156
  * Merges cells in a range vertically.
1149
- *
1150
1157
  * @param [defaultMerge] - If true, only the value in the upper left cell is retained.
1151
- *
1152
1158
  * @returns This range, for chaining
1159
+ * @example
1160
+ * ```ts
1161
+ * const workbook = univerAPI.getActiveWorkbook();
1162
+ * const worksheet = workbook.getActiveSheet();
1163
+ * const range = worksheet.getRange(4, 4, 2, 2);
1164
+ * const merge = range.mergeVertically();
1165
+ * const allMerge = worksheet.getMergeData();
1166
+ * console.log(allMerge.length); // There will be two merged cells.
1167
+ * ```
1153
1168
  */
1154
- async mergeVertically(o = !0) {
1155
- const e = oe([this._range], ee.COLUMNS), t = this._workbook.getUnitId(), n = this._worksheet.getSheetId();
1156
- return await L(this._injector, t, n, e, o), this;
1169
+ mergeVertically(o = !0) {
1170
+ const e = re([this._range], te.COLUMNS), t = this._workbook.getUnitId(), n = this._worksheet.getSheetId();
1171
+ return B(this._injector, t, n, e, o), this;
1157
1172
  }
1158
1173
  /**
1159
1174
  * Returns true if cells in the current range overlap a merged cell.
1160
1175
  * @returns {boolean} is overlap with a merged cell
1176
+ * @example
1177
+ * ```ts
1178
+ * const workbook = univerAPI.getActiveWorkbook();
1179
+ * const worksheet = workbook.getActiveSheet();
1180
+ * const range = worksheet.getRange(0,0,2,2);
1181
+ * const merge = range.merge();
1182
+ * const anchor = worksheet.getRange(0,0);
1183
+ * const isPartOfMerge = anchor.isPartOfMerge();
1184
+ * console.log('debugger, isPartOfMerge) // true
1185
+ * ```
1161
1186
  */
1162
1187
  isPartOfMerge() {
1163
1188
  const { startRow: o, startColumn: e, endRow: t, endColumn: n } = this._range;
@@ -1166,6 +1191,19 @@ let S = class extends p {
1166
1191
  /**
1167
1192
  * Break all horizontally- or vertically-merged cells contained within the range list into individual cells again.
1168
1193
  * @returns This range, for chaining
1194
+ * @example
1195
+ * ```ts
1196
+ * const workbook = univerAPI.getActiveWorkbook();
1197
+ * const worksheet = workbook.getActiveSheet();
1198
+ * const range = worksheet.getRange(0,0,2,2);
1199
+ * const merge = range.merge();
1200
+ * const anchor = worksheet.getRange(0,0);
1201
+ * const isPartOfMergeFirst = anchor.isPartOfMerge();
1202
+ * console.log('debugger' isPartOfMergeFirst) // true
1203
+ * range.breakApart();
1204
+ * const isPartOfMergeSecond = anchor.isPartOfMerge();
1205
+ * console.log('debugger' isPartOfMergeSecond) // false
1206
+ * ```
1169
1207
  */
1170
1208
  breakApart() {
1171
1209
  return this._commandService.executeCommand(nt.id, { ranges: [this._range] }), this;
@@ -1194,6 +1232,7 @@ let S = class extends p {
1194
1232
  }
1195
1233
  /**
1196
1234
  * Returns a string description of the range, in A1 notation.
1235
+ * @param withSheet
1197
1236
  * @returns {string} The A1 notation of the range.
1198
1237
  * ```ts
1199
1238
  * const fWorkbook = univerAPI.getActiveWorkbook();
@@ -1203,7 +1242,7 @@ let S = class extends p {
1203
1242
  * ```
1204
1243
  */
1205
1244
  getA1Notation(o) {
1206
- return o ? Be(this._worksheet.getName(), this._range) : X(this._range);
1245
+ return o ? xt(this._worksheet.getName(), this._range) : Z(this._range);
1207
1246
  }
1208
1247
  /**
1209
1248
  * Sets the specified range as the active range, with the top left cell in the range as the current cell.
@@ -1228,7 +1267,7 @@ let S = class extends p {
1228
1267
  */
1229
1268
  activateAsCurrentCell() {
1230
1269
  const o = this._worksheet.getMergedCell(this._range.startRow, this._range.startColumn);
1231
- if (o && N.equals(o, this._range) || !o && this._range.startRow === this._range.endRow && this._range.startColumn === this._range.endColumn)
1270
+ if (o && E.equals(o, this._range) || !o && this._range.startRow === this._range.endRow && this._range.startColumn === this._range.endColumn)
1232
1271
  return this.activate();
1233
1272
  throw new Error("The range is not a single cell");
1234
1273
  }
@@ -1274,18 +1313,80 @@ let S = class extends p {
1274
1313
  treatMultipleDelimitersAsOne: o
1275
1314
  });
1276
1315
  }
1316
+ /**
1317
+ * Set the theme style for the range.
1318
+ * @param {string|undefined} themeName The name of the theme style to apply.If a undefined value is passed, the theme style will be removed if it exist.
1319
+ * @example
1320
+ * ```ts
1321
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1322
+ * const fWorksheet = fWorkbook.getActiveSheet();
1323
+ * const fRange = fWorksheet.getRange('A1:E20');
1324
+ * fRange.useThemeStyle('default');
1325
+ * ```
1326
+ */
1327
+ useThemeStyle(o) {
1328
+ if (o == null) {
1329
+ const e = this.getUsedThemeStyle();
1330
+ e && this.removeThemeStyle(e);
1331
+ } else
1332
+ this._commandService.executeCommand(ot.id, {
1333
+ unitId: this._workbook.getUnitId(),
1334
+ subUnitId: this._worksheet.getSheetId(),
1335
+ range: this._range,
1336
+ themeName: o
1337
+ });
1338
+ }
1339
+ /**
1340
+ * Remove the theme style for the range.
1341
+ * @param {string} themeName The name of the theme style to remove.
1342
+ * @example
1343
+ * ```ts
1344
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1345
+ * const fWorksheet = fWorkbook.getActiveSheet();
1346
+ * const fRange = fWorksheet.getRange('A1:E20');
1347
+ * fRange.removeThemeStyle('default');
1348
+ * ```
1349
+ */
1350
+ removeThemeStyle(o) {
1351
+ this._commandService.executeCommand(rt.id, {
1352
+ unitId: this._workbook.getUnitId(),
1353
+ subUnitId: this._worksheet.getSheetId(),
1354
+ range: this._range,
1355
+ themeName: o
1356
+ });
1357
+ }
1358
+ /**
1359
+ * Gets the theme style applied to the range.
1360
+ * @returns {string | undefined} The name of the theme style applied to the range or not exist.
1361
+ * @example
1362
+ * ```ts
1363
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1364
+ * const fWorksheet = fWorkbook.getActiveSheet();
1365
+ * const fRange = fWorksheet.getRange('A1:E20');
1366
+ * fRange.useThemeStyle('default');
1367
+ * const themeStyle = fRange.getUsedThemeStyle();
1368
+ * console.log(themeStyle); // 'default'
1369
+ * ```
1370
+ */
1371
+ getUsedThemeStyle() {
1372
+ return this._injector.get(Ee).getAppliedRangeThemeStyle({
1373
+ unitId: this._workbook.getUnitId(),
1374
+ subUnitId: this._worksheet.getSheetId(),
1375
+ range: this._range
1376
+ });
1377
+ }
1277
1378
  };
1278
- S = Tt([
1279
- G(3, m(v)),
1280
- G(4, l),
1281
- G(5, m(Le))
1282
- ], S);
1283
- var Lt = Object.defineProperty, Bt = Object.getOwnPropertyDescriptor, zt = (o, e, t, n) => {
1284
- for (var s = n > 1 ? void 0 : n ? Bt(e, t) : e, r = o.length - 1, i; r >= 0; r--)
1379
+ w = Gt([
1380
+ $(3, m(v)),
1381
+ $(4, l),
1382
+ $(5, m(Et))
1383
+ ], w);
1384
+ var qt = Object.defineProperty, Kt = Object.getOwnPropertyDescriptor, Yt = (o, e, t, n) => {
1385
+ for (var s = n > 1 ? void 0 : n ? Kt(e, t) : e, r = o.length - 1, i; r >= 0; r--)
1285
1386
  (i = o[r]) && (s = (n ? i(e, t, s) : i(s)) || s);
1286
- return n && s && Lt(e, t, s), s;
1287
- }, Vt = (o, e) => (t, n) => e(t, n, o);
1288
- let F = class {
1387
+ return n && s && qt(e, t, s), s;
1388
+ }, Jt = (o, e) => (t, n) => e(t, n, o);
1389
+ let A = class {
1289
1390
  constructor(o, e, t, n) {
1290
1391
  this._workbook = o, this._worksheet = e, this._selections = t, this._injector = n;
1291
1392
  }
@@ -1295,14 +1396,14 @@ let F = class {
1295
1396
  */
1296
1397
  getActiveRange() {
1297
1398
  const o = this._selections.find((e) => !!e.primary);
1298
- return o ? this._injector.createInstance(S, this._workbook, this._worksheet, o.range) : null;
1399
+ return o ? this._injector.createInstance(w, this._workbook, this._worksheet, o.range) : null;
1299
1400
  }
1300
1401
  /**
1301
1402
  * Represents the active selection list in the sheet.
1302
1403
  * @returns {FRange[]} The active selection list.
1303
1404
  */
1304
1405
  getActiveRangeList() {
1305
- return this._selections.map((o) => this._injector.createInstance(S, this._workbook, this._worksheet, o.range));
1406
+ return this._selections.map((o) => this._injector.createInstance(w, this._workbook, this._worksheet, o.range));
1306
1407
  }
1307
1408
  /**
1308
1409
  * Represents the current select cell in the sheet.
@@ -1326,7 +1427,7 @@ let F = class {
1326
1427
  */
1327
1428
  getActiveSheet() {
1328
1429
  const o = this._injector.createInstance(I, this._workbook);
1329
- return this._injector.createInstance(_, o, this._workbook, this._worksheet);
1430
+ return this._injector.createInstance(g, o, this._workbook, this._worksheet);
1330
1431
  }
1331
1432
  /**
1332
1433
  * Update the primary cell in the selection. if the primary cell not exists in selections, add it to the selections and clear the old selections.
@@ -1342,13 +1443,13 @@ let F = class {
1342
1443
  * console.log(newSelection.getActiveRange().getA1Notation()); // A1
1343
1444
  * ```
1344
1445
  */
1345
- async updatePrimaryCell(o) {
1446
+ updatePrimaryCell(o) {
1346
1447
  const e = this._injector.get(l);
1347
1448
  let t = [], n = !1;
1348
1449
  for (const { range: r, style: i } of this._selections)
1349
- N.contains(r, o.getRange()) ? (t.push({
1450
+ E.contains(r, o.getRange()) ? (t.push({
1350
1451
  range: r,
1351
- primary: Y(o.getRange(), this._worksheet),
1452
+ primary: K(o.getRange(), this._worksheet),
1352
1453
  style: i
1353
1454
  }), n = !0) : t.push({
1354
1455
  range: r,
@@ -1358,7 +1459,7 @@ let F = class {
1358
1459
  n || (t = [
1359
1460
  {
1360
1461
  range: o.getRange(),
1361
- primary: Y(o.getRange(), this._worksheet)
1462
+ primary: K(o.getRange(), this._worksheet)
1362
1463
  }
1363
1464
  ]);
1364
1465
  const s = {
@@ -1366,7 +1467,7 @@ let F = class {
1366
1467
  subUnitId: this._worksheet.getSheetId(),
1367
1468
  selections: t
1368
1469
  };
1369
- return await e.syncExecuteCommand(Ue.id, s), new F(this._workbook, this._worksheet, t, this._injector);
1470
+ return e.syncExecuteCommand(xe.id, s), new A(this._workbook, this._worksheet, t, this._injector);
1370
1471
  }
1371
1472
  /**
1372
1473
  *Get the next primary cell in the specified direction. If the primary cell not exists in selections, return null.
@@ -1386,26 +1487,26 @@ let F = class {
1386
1487
  getNextDataRange(o) {
1387
1488
  if (!this._selections.find((n) => !!n.primary))
1388
1489
  return null;
1389
- const t = ot(this._selections.concat(), o, this._worksheet);
1390
- return t ? this._injector.createInstance(S, this._workbook, this._worksheet, t) : null;
1490
+ const t = it(this._selections.concat(), o, this._worksheet);
1491
+ return t ? this._injector.createInstance(w, this._workbook, this._worksheet, t) : null;
1391
1492
  }
1392
1493
  };
1393
- F = zt([
1394
- Vt(3, m(v))
1395
- ], F);
1396
- var Ht = Object.defineProperty, $t = Object.getOwnPropertyDescriptor, Gt = (o, e, t, n) => {
1397
- for (var s = n > 1 ? void 0 : n ? $t(e, t) : e, r = o.length - 1, i; r >= 0; r--)
1494
+ A = Yt([
1495
+ Jt(3, m(v))
1496
+ ], A);
1497
+ var Qt = Object.defineProperty, Xt = Object.getOwnPropertyDescriptor, Zt = (o, e, t, n) => {
1498
+ for (var s = n > 1 ? void 0 : n ? Xt(e, t) : e, r = o.length - 1, i; r >= 0; r--)
1398
1499
  (i = o[r]) && (s = (n ? i(e, t, s) : i(s)) || s);
1399
- return n && s && Ht(e, t, s), s;
1400
- }, M = (o, e) => (t, n) => e(t, n, o);
1401
- let _ = class extends p {
1500
+ return n && s && Qt(e, t, s), s;
1501
+ }, W = (o, e) => (t, n) => e(t, n, o);
1502
+ let g = class extends X {
1402
1503
  constructor(e, t, n, s, r, i, a) {
1403
- super();
1504
+ super(s);
1404
1505
  /**
1405
1506
  * Sets the active selection region for this sheet.
1406
1507
  * @param range The range to set as the active selection.
1407
1508
  */
1408
- P(this, "setActiveSelection", this.setActiveRange);
1509
+ p(this, "setActiveSelection", this.setActiveRange);
1409
1510
  this._fWorkbook = e, this._workbook = t, this._worksheet = n, this._injector = s, this._selectionManagerService = r, this._logService = i, this._commandService = a;
1410
1511
  }
1411
1512
  /**
@@ -1442,7 +1543,7 @@ let _ = class extends p {
1442
1543
  */
1443
1544
  getSelection() {
1444
1545
  const e = this._selectionManagerService.getCurrentSelections();
1445
- return e ? this._injector.createInstance(F, this._workbook, this._worksheet, e) : null;
1546
+ return e ? this._injector.createInstance(A, this._workbook, this._worksheet, e) : null;
1446
1547
  }
1447
1548
  // #region rows
1448
1549
  // #region default style
@@ -1465,7 +1566,7 @@ let _ = class extends p {
1465
1566
  /**
1466
1567
  * Get the default style of the worksheet column
1467
1568
  * @param {number} index The column index
1468
- * @param {boolean} [keepRaw] If true, return the raw style data maybe the style name or style data, otherwise return the data from col manager
1569
+ * @param {boolean} [keepRaw] If true, return the raw style data maybe the style name or style data, otherwise return the data from col manager
1469
1570
  * @returns {Nullable<IStyleData> | string} The default style of the worksheet column name or style data
1470
1571
  */
1471
1572
  getColumnDefaultStyle(e, t = !1) {
@@ -1474,11 +1575,11 @@ let _ = class extends p {
1474
1575
  /**
1475
1576
  * Set the default style of the worksheet
1476
1577
  * @param {StyleDataInfo} style default style
1477
- * @returns {Promise<FWorksheet>} This sheet, for chaining.
1578
+ * @returns {FWorksheet} This sheet, for chaining.
1478
1579
  */
1479
- async setDefaultStyle(e) {
1580
+ setDefaultStyle(e) {
1480
1581
  const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId();
1481
- return await this._commandService.executeCommand(rt.id, {
1582
+ return this._commandService.syncExecuteCommand(at.id, {
1482
1583
  unitId: t,
1483
1584
  subUnitId: n,
1484
1585
  defaultStyle: e
@@ -1488,9 +1589,9 @@ let _ = class extends p {
1488
1589
  * Set the default style of the worksheet row
1489
1590
  * @param {number} index The row index
1490
1591
  * @param {string | Nullable<IStyleData>} style The style name or style data
1491
- * @returns {Promise<FWorksheet>} This sheet, for chaining.
1592
+ * @returns {FWorksheet} This sheet, for chaining.
1492
1593
  */
1493
- async setColumnDefaultStyle(e, t) {
1594
+ setColumnDefaultStyle(e, t) {
1494
1595
  const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), r = {
1495
1596
  unitId: n,
1496
1597
  subUnitId: s,
@@ -1500,15 +1601,15 @@ let _ = class extends p {
1500
1601
  }
1501
1602
  }
1502
1603
  };
1503
- return await this._commandService.executeCommand(re.id, r), this;
1604
+ return this._commandService.syncExecuteCommand(ie.id, r), this;
1504
1605
  }
1505
1606
  /**
1506
1607
  * Set the default style of the worksheet column
1507
1608
  * @param {number} index The column index
1508
1609
  * @param {string | Nullable<IStyleData>} style The style name or style data
1509
- * @returns {Promise<FWorksheet>} This sheet, for chaining.
1610
+ * @returns {FWorksheet} This sheet, for chaining.
1510
1611
  */
1511
- async setRowDefaultStyle(e, t) {
1612
+ setRowDefaultStyle(e, t) {
1512
1613
  const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), r = {
1513
1614
  unitId: n,
1514
1615
  subUnitId: s,
@@ -1518,12 +1619,12 @@ let _ = class extends p {
1518
1619
  }
1519
1620
  }
1520
1621
  };
1521
- return await this._commandService.executeCommand(ie.id, r), this;
1622
+ return this._commandService.syncExecuteCommand(ae.id, r), this;
1522
1623
  }
1523
1624
  getRange(e, t, n, s) {
1524
1625
  let r, i;
1525
1626
  if (typeof e == "string") {
1526
- const { range: a, sheetName: h } = ze(e), c = h ? this._workbook.getSheetBySheetName(h) : this._worksheet;
1627
+ const { range: a, sheetName: h } = Nt(e), c = h ? this._workbook.getSheetBySheetName(h) : this._worksheet;
1527
1628
  if (!c)
1528
1629
  throw new Error("Range not found");
1529
1630
  i = c, r = {
@@ -1532,11 +1633,11 @@ let _ = class extends p {
1532
1633
  sheetId: i.getSheetId(),
1533
1634
  // Use the current range instead of the future actual range to match Apps Script behavior.
1534
1635
  // Users can create the latest range in real time when needed.
1535
- rangeType: g.NORMAL,
1536
- startRow: a.rangeType === g.COLUMN ? 0 : a.startRow,
1537
- endRow: a.rangeType === g.COLUMN ? i.getMaxRows() - 1 : a.endRow,
1538
- startColumn: a.rangeType === g.ROW ? 0 : a.startColumn,
1539
- endColumn: a.rangeType === g.ROW ? i.getMaxColumns() - 1 : a.endColumn
1636
+ rangeType: _.NORMAL,
1637
+ startRow: a.rangeType === _.COLUMN ? 0 : a.startRow,
1638
+ endRow: a.rangeType === _.COLUMN ? i.getMaxRows() - 1 : a.endRow,
1639
+ startColumn: a.rangeType === _.ROW ? 0 : a.startColumn,
1640
+ endColumn: a.rangeType === _.ROW ? i.getMaxColumns() - 1 : a.endColumn
1540
1641
  };
1541
1642
  } else if (typeof e == "number" && t !== void 0)
1542
1643
  i = this._worksheet, r = {
@@ -1549,36 +1650,36 @@ let _ = class extends p {
1549
1650
  };
1550
1651
  else
1551
1652
  throw new Error("Invalid range specification");
1552
- return this._injector.createInstance(S, this._workbook, i, r);
1653
+ return this._injector.createInstance(w, this._workbook, i, r);
1553
1654
  }
1554
1655
  /**
1555
1656
  * Returns the current number of columns in the sheet, regardless of content.
1556
- * @return The maximum columns count of the sheet
1657
+ * @returns {number} The maximum columns count of the sheet
1557
1658
  */
1558
1659
  getMaxColumns() {
1559
1660
  return this._worksheet.getMaxColumns();
1560
1661
  }
1561
1662
  /**
1562
1663
  * Returns the current number of rows in the sheet, regardless of content.
1563
- * @return The maximum rows count of the sheet
1664
+ * @returns {number}The maximum rows count of the sheet
1564
1665
  */
1565
1666
  getMaxRows() {
1566
1667
  return this._worksheet.getMaxRows();
1567
1668
  }
1568
1669
  /**
1569
1670
  * Inserts a row after the given row position.
1570
- * @param afterPosition The row after which the new row should be added, starting at 0 for the first row.
1571
- * @returns This sheet, for chaining.
1671
+ * @param {number} afterPosition The row after which the new row should be added, starting at 0 for the first row.
1672
+ * @returns {FWorksheet} This sheet, for chaining.
1572
1673
  */
1573
- async insertRowAfter(e) {
1674
+ insertRowAfter(e) {
1574
1675
  return this.insertRowsAfter(e, 1);
1575
1676
  }
1576
1677
  /**
1577
1678
  * Inserts a row before the given row position.
1578
- * @param beforePosition The row before which the new row should be added, starting at 0 for the first row.
1579
- * @returns This sheet, for chaining.
1679
+ * @param {number} beforePosition The row before which the new row should be added, starting at 0 for the first row.
1680
+ * @returns {FWorksheet} This sheet, for chaining.
1580
1681
  */
1581
- async insertRowBefore(e) {
1682
+ insertRowBefore(e) {
1582
1683
  return this.insertRowsBefore(e, 1);
1583
1684
  }
1584
1685
  /**
@@ -1587,7 +1688,7 @@ let _ = class extends p {
1587
1688
  * @param numRows The number of rows to insert.
1588
1689
  * @returns This sheet, for chaining.
1589
1690
  */
1590
- async insertRows(e, t = 1) {
1691
+ insertRows(e, t = 1) {
1591
1692
  return this.insertRowsBefore(e, t);
1592
1693
  }
1593
1694
  /**
@@ -1596,9 +1697,9 @@ let _ = class extends p {
1596
1697
  * @param howMany The number of rows to insert.
1597
1698
  * @returns This sheet, for chaining.
1598
1699
  */
1599
- async insertRowsAfter(e, t) {
1600
- const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), r = E.DOWN, i = e + 1, a = e + t, h = 0, c = this._worksheet.getColumnCount() - 1, d = D(this._worksheet, i, a, h, c, !0, e);
1601
- return await this._commandService.executeCommand(ae.id, {
1700
+ insertRowsAfter(e, t) {
1701
+ const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), r = N.DOWN, i = e + 1, a = e + t, h = 0, c = this._worksheet.getColumnCount() - 1, d = D(this._worksheet, i, a, h, c, !0, e);
1702
+ return this._commandService.syncExecuteCommand(he.id, {
1602
1703
  unitId: n,
1603
1704
  subUnitId: s,
1604
1705
  direction: r,
@@ -1617,9 +1718,9 @@ let _ = class extends p {
1617
1718
  * @param howMany The number of rows to insert.
1618
1719
  * @returns This sheet, for chaining.
1619
1720
  */
1620
- async insertRowsBefore(e, t) {
1621
- const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), r = E.UP, i = e, a = e + t - 1, h = 0, c = this._worksheet.getColumnCount() - 1, d = D(this._worksheet, i, a, h, c, !0, e - 1);
1622
- return await this._commandService.executeCommand(ae.id, {
1721
+ insertRowsBefore(e, t) {
1722
+ const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), r = N.UP, i = e, a = e + t - 1, h = 0, c = this._worksheet.getColumnCount() - 1, d = D(this._worksheet, i, a, h, c, !0, e - 1);
1723
+ return this._commandService.syncExecuteCommand(he.id, {
1623
1724
  unitId: n,
1624
1725
  subUnitId: s,
1625
1726
  direction: r,
@@ -1637,7 +1738,7 @@ let _ = class extends p {
1637
1738
  * @param rowPosition The position of the row, starting at 0 for the first row.
1638
1739
  * @returns This sheet, for chaining.
1639
1740
  */
1640
- async deleteRow(e) {
1741
+ deleteRow(e) {
1641
1742
  return this.deleteRows(e, 1);
1642
1743
  }
1643
1744
  /**
@@ -1646,15 +1747,17 @@ let _ = class extends p {
1646
1747
  * @param howMany The number of rows to delete.
1647
1748
  * @returns This sheet, for chaining.
1648
1749
  */
1649
- async deleteRows(e, t) {
1750
+ deleteRows(e, t) {
1650
1751
  const n = {
1651
1752
  startRow: e,
1652
1753
  endRow: e + t - 1,
1653
1754
  startColumn: 0,
1654
1755
  endColumn: this._worksheet.getColumnCount() - 1
1655
1756
  };
1656
- return await this._commandService.executeCommand(it.id, {
1657
- range: n
1757
+ return this._commandService.syncExecuteCommand(ht.id, {
1758
+ range: n,
1759
+ unitId: this._workbook.getUnitId(),
1760
+ subUnitId: this._worksheet.getSheetId()
1658
1761
  }), this;
1659
1762
  }
1660
1763
  /**
@@ -1663,14 +1766,14 @@ let _ = class extends p {
1663
1766
  * @param destinationIndex The index that the rows should be moved to. Note that this index is based on the coordinates before the rows are moved. Existing data is shifted down to make room for the moved rows while the source rows are removed from the grid. Therefore, the data may end up at a different index than originally specified. Use 0-index for this method.
1664
1767
  * @returns This sheet, for chaining.
1665
1768
  */
1666
- async moveRows(e, t) {
1667
- const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), r = H(e.getRange(), this._worksheet), i = r, a = {
1769
+ moveRows(e, t) {
1770
+ const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), r = V(e.getRange(), this._worksheet), i = r, a = {
1668
1771
  startRow: t,
1669
1772
  endRow: t,
1670
1773
  startColumn: r.startColumn,
1671
1774
  endColumn: r.endColumn
1672
1775
  };
1673
- return await this._commandService.executeCommand(at.id, {
1776
+ return this._commandService.syncExecuteCommand(ct.id, {
1674
1777
  unitId: n,
1675
1778
  subUnitId: s,
1676
1779
  range: r,
@@ -1683,9 +1786,9 @@ let _ = class extends p {
1683
1786
  * @param row The row range to hide.
1684
1787
  * @returns This sheet, for chaining.
1685
1788
  */
1686
- async hideRow(e) {
1687
- const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), s = H(e.getRange(), this._worksheet);
1688
- return await this._commandService.executeCommand(he.id, {
1789
+ hideRow(e) {
1790
+ const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), s = V(e.getRange(), this._worksheet);
1791
+ return this._commandService.syncExecuteCommand(ce.id, {
1689
1792
  unitId: t,
1690
1793
  subUnitId: n,
1691
1794
  ranges: [s]
@@ -1693,52 +1796,52 @@ let _ = class extends p {
1693
1796
  }
1694
1797
  /**
1695
1798
  * Hides one or more consecutive rows starting at the given index. Use 0-index for this method.
1696
- * @param rowIndex The starting index of the rows to hide.
1697
- * @param numRows The number of rows to hide.
1698
- * @returns This sheet, for chaining.
1799
+ * @param {number} rowIndex The starting index of the rows to hide.
1800
+ * @param {number} numRows The number of rows to hide.
1801
+ * @returns {FWorksheet} This sheet, for chaining.
1699
1802
  */
1700
- async hideRows(e, t = 1) {
1803
+ hideRows(e, t = 1) {
1701
1804
  const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), r = {
1702
1805
  startRow: e,
1703
1806
  endRow: e + t - 1,
1704
1807
  startColumn: 0,
1705
1808
  endColumn: this._worksheet.getColumnCount() - 1,
1706
- rangeType: g.ROW
1809
+ rangeType: _.ROW
1707
1810
  };
1708
- return await this._commandService.executeCommand(he.id, {
1811
+ return this._commandService.syncExecuteCommand(ce.id, {
1709
1812
  unitId: n,
1710
1813
  subUnitId: s,
1711
1814
  ranges: [r]
1712
1815
  }), this;
1713
1816
  }
1714
1817
  /**
1715
- * Unhides the row in the given range.
1716
- * @param row The range to unhide, if hidden.
1717
- * @returns This sheet, for chaining.
1818
+ * Make the row in the given range visible.
1819
+ * @param {FRange} row The range to unhide, if hidden.
1820
+ * @returns {FWorksheet} This sheet, for chaining.
1718
1821
  */
1719
- async unhideRow(e) {
1720
- const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), s = H(e.getRange(), this._worksheet);
1721
- return await this._commandService.executeCommand(ce.id, {
1822
+ unhideRow(e) {
1823
+ const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), s = V(e.getRange(), this._worksheet);
1824
+ return this._commandService.syncExecuteCommand(de.id, {
1722
1825
  unitId: t,
1723
1826
  subUnitId: n,
1724
1827
  ranges: [s]
1725
1828
  }), this;
1726
1829
  }
1727
1830
  /**
1728
- * Unhides one or more consecutive rows starting at the given index. Use 0-index for this method.
1729
- * @param rowIndex The starting index of the rows to unhide.
1730
- * @param numRows The number of rows to unhide.
1731
- * @returns This sheet, for chaining.
1831
+ * Scrolling sheet to make specific rows visible.
1832
+ * @param {number} rowIndex The starting index of the rows
1833
+ * @param {number} numRows The number of rows
1834
+ * @returns {FWorksheet} This sheet, for chaining.
1732
1835
  */
1733
- async showRows(e, t = 1) {
1836
+ showRows(e, t = 1) {
1734
1837
  const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), r = {
1735
1838
  startRow: e,
1736
1839
  endRow: e + t - 1,
1737
1840
  startColumn: 0,
1738
1841
  endColumn: this._worksheet.getColumnCount() - 1,
1739
- rangeType: g.ROW
1842
+ rangeType: _.ROW
1740
1843
  };
1741
- return await this._commandService.executeCommand(ce.id, {
1844
+ return this._commandService.syncExecuteCommand(de.id, {
1742
1845
  unitId: n,
1743
1846
  subUnitId: s,
1744
1847
  ranges: [r]
@@ -1746,38 +1849,39 @@ let _ = class extends p {
1746
1849
  }
1747
1850
  /**
1748
1851
  * Sets the row height of the given row in pixels. By default, rows grow to fit cell contents. If you want to force rows to a specified height, use setRowHeightsForced(startRow, numRows, height).
1749
- * @param rowPosition The row position to change.
1750
- * @param height The height in pixels to set it to.
1751
- * @returns This sheet, for chaining.
1852
+ * @param {number} rowPosition The row position to change.
1853
+ * @param {number} height The height in pixels to set it to.
1854
+ * @returns {FWorksheet} This sheet, for chaining.
1752
1855
  */
1753
- async setRowHeight(e, t) {
1856
+ setRowHeight(e, t) {
1754
1857
  return this.setRowHeights(e, 1, t);
1755
1858
  }
1756
1859
  /**
1757
- * Sets the height of the given rows in pixels. By default, rows grow to fit cell contents. If you want to force rows to a specified height, use setRowHeightsForced(startRow, numRows, height).
1758
- * @param startRow The starting row position to change.
1759
- * @param numRows The number of rows to change.
1760
- * @param height The height in pixels to set it to.
1761
- * @returns This sheet, for chaining.
1860
+ * Sets the height of the given rows in pixels.
1861
+ * By default, rows grow to fit cell contents. If you want to force rows to a specified height, use setRowHeightsForced(startRow, numRows, height).
1862
+ * @param {number} startRow The starting row position to change.
1863
+ * @param {number} numRows The number of rows to change.
1864
+ * @param {number} height The height in pixels to set it to.
1865
+ * @returns {FWorksheet} This sheet, for chaining.
1762
1866
  */
1763
- async setRowHeights(e, t, n) {
1867
+ setRowHeights(e, t, n) {
1764
1868
  var c;
1765
1869
  const s = this._workbook.getUnitId(), r = this._worksheet.getSheetId(), i = this._worksheet.getRowManager(), a = [], h = [];
1766
1870
  for (let d = e; d < e + t; d++) {
1767
- const T = ((c = i.getRow(d)) == null ? void 0 : c.ah) || this._worksheet.getConfig().defaultRowHeight, x = {
1871
+ const O = ((c = i.getRow(d)) == null ? void 0 : c.ah) || this._worksheet.getConfig().defaultRowHeight, x = {
1768
1872
  startRow: d,
1769
1873
  endRow: d,
1770
1874
  startColumn: 0,
1771
1875
  endColumn: this._worksheet.getColumnCount() - 1
1772
1876
  };
1773
- n <= T ? a.push(x) : h.push(x);
1877
+ n <= O ? a.push(x) : h.push(x);
1774
1878
  }
1775
- return h.length > 0 && await this._commandService.executeCommand(de.id, {
1879
+ return h.length > 0 && this._commandService.syncExecuteCommand(me.id, {
1776
1880
  unitId: s,
1777
1881
  subUnitId: r,
1778
1882
  ranges: h,
1779
1883
  value: n
1780
- }), a.length > 0 && await this._commandService.executeCommand(ht.id, {
1884
+ }), a.length > 0 && this._commandService.syncExecuteCommand(dt.id, {
1781
1885
  unitId: s,
1782
1886
  subUnitId: r,
1783
1887
  ranges: a
@@ -1785,12 +1889,12 @@ let _ = class extends p {
1785
1889
  }
1786
1890
  /**
1787
1891
  * Sets the height of the given rows in pixels. By default, rows grow to fit cell contents. When you use setRowHeightsForced, rows are forced to the specified height even if the cell contents are taller than the row height.
1788
- * @param startRow The starting row position to change.
1789
- * @param numRows The number of rows to change.
1790
- * @param height The height in pixels to set it to.
1791
- * @returns This sheet, for chaining.
1892
+ * @param {number} startRow The starting row position to change.
1893
+ * @param {number} numRows The number of rows to change.
1894
+ * @param {number} height The height in pixels to set it to.
1895
+ * @returns {FWorksheet} This sheet, for chaining.
1792
1896
  */
1793
- async setRowHeightsForced(e, t, n) {
1897
+ setRowHeightsForced(e, t, n) {
1794
1898
  const s = this._workbook.getUnitId(), r = this._worksheet.getSheetId(), i = [
1795
1899
  {
1796
1900
  startRow: e,
@@ -1799,7 +1903,7 @@ let _ = class extends p {
1799
1903
  endColumn: this._worksheet.getColumnCount() - 1
1800
1904
  }
1801
1905
  ];
1802
- return await this._commandService.executeCommand(de.id, {
1906
+ return this._commandService.syncExecuteCommand(me.id, {
1803
1907
  unitId: s,
1804
1908
  subUnitId: r,
1805
1909
  ranges: i,
@@ -1812,7 +1916,7 @@ let _ = class extends p {
1812
1916
  * @param custom The custom properties to set.
1813
1917
  * @returns This sheet, for chaining.
1814
1918
  */
1815
- async setRowCustom(e) {
1919
+ setRowCustom(e) {
1816
1920
  const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), s = {};
1817
1921
  for (const [i, a] of Object.entries(e))
1818
1922
  s[Number(i)] = {
@@ -1823,7 +1927,7 @@ let _ = class extends p {
1823
1927
  subUnitId: n,
1824
1928
  rowData: s
1825
1929
  };
1826
- return await this._commandService.executeCommand(ie.id, r), this;
1930
+ return this._commandService.syncExecuteCommand(ae.id, r), this;
1827
1931
  }
1828
1932
  // #region Column
1829
1933
  /**
@@ -1831,7 +1935,7 @@ let _ = class extends p {
1831
1935
  * @param afterPosition The column after which the new column should be added, starting at 0 for the first column.
1832
1936
  * @returns This sheet, for chaining.
1833
1937
  */
1834
- async insertColumnAfter(e) {
1938
+ insertColumnAfter(e) {
1835
1939
  return this.insertColumnsAfter(e, 1);
1836
1940
  }
1837
1941
  /**
@@ -1839,7 +1943,7 @@ let _ = class extends p {
1839
1943
  * @param beforePosition The column before which the new column should be added, starting at 0 for the first column.
1840
1944
  * @returns This sheet, for chaining.
1841
1945
  */
1842
- async insertColumnBefore(e) {
1946
+ insertColumnBefore(e) {
1843
1947
  return this.insertColumnsBefore(e, 1);
1844
1948
  }
1845
1949
  /**
@@ -1848,7 +1952,7 @@ let _ = class extends p {
1848
1952
  * @param numColumns The number of columns to insert.
1849
1953
  * @returns This sheet, for chaining.
1850
1954
  */
1851
- async insertColumns(e, t = 1) {
1955
+ insertColumns(e, t = 1) {
1852
1956
  return this.insertColumnsBefore(e, t);
1853
1957
  }
1854
1958
  /**
@@ -1857,9 +1961,9 @@ let _ = class extends p {
1857
1961
  * @param howMany The number of columns to insert.
1858
1962
  * @returns This sheet, for chaining.
1859
1963
  */
1860
- async insertColumnsAfter(e, t) {
1861
- const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), r = E.RIGHT, i = 0, a = this._worksheet.getRowCount() - 1, h = e + 1, c = e + t, d = D(this._worksheet, i, a, h, c, !1, e);
1862
- return await this._commandService.executeCommand(me.id, {
1964
+ insertColumnsAfter(e, t) {
1965
+ const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), r = N.RIGHT, i = 0, a = this._worksheet.getRowCount() - 1, h = e + 1, c = e + t, d = D(this._worksheet, i, a, h, c, !1, e);
1966
+ return this._commandService.syncExecuteCommand(ue.id, {
1863
1967
  unitId: n,
1864
1968
  subUnitId: s,
1865
1969
  direction: r,
@@ -1878,9 +1982,9 @@ let _ = class extends p {
1878
1982
  * @param howMany The number of columns to insert.
1879
1983
  * @returns This sheet, for chaining.
1880
1984
  */
1881
- async insertColumnsBefore(e, t) {
1882
- const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), r = E.LEFT, i = 0, a = this._worksheet.getRowCount() - 1, h = e, c = e + t - 1, d = D(this._worksheet, i, a, h, c, !1, e - 1);
1883
- return await this._commandService.executeCommand(me.id, {
1985
+ insertColumnsBefore(e, t) {
1986
+ const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), r = N.LEFT, i = 0, a = this._worksheet.getRowCount() - 1, h = e, c = e + t - 1, d = D(this._worksheet, i, a, h, c, !1, e - 1);
1987
+ return this._commandService.syncExecuteCommand(ue.id, {
1884
1988
  unitId: n,
1885
1989
  subUnitId: s,
1886
1990
  direction: r,
@@ -1898,7 +2002,7 @@ let _ = class extends p {
1898
2002
  * @param columnPosition The position of the column, starting at 0 for the first column.
1899
2003
  * @returns This sheet, for chaining.
1900
2004
  */
1901
- async deleteColumn(e) {
2005
+ deleteColumn(e) {
1902
2006
  return this.deleteColumns(e, 1);
1903
2007
  }
1904
2008
  /**
@@ -1907,15 +2011,17 @@ let _ = class extends p {
1907
2011
  * @param howMany The number of columns to delete.
1908
2012
  * @returns This sheet, for chaining.
1909
2013
  */
1910
- async deleteColumns(e, t) {
2014
+ deleteColumns(e, t) {
1911
2015
  const n = {
1912
2016
  startRow: 0,
1913
2017
  endRow: this._worksheet.getRowCount() - 1,
1914
2018
  startColumn: e,
1915
2019
  endColumn: e + t - 1
1916
2020
  };
1917
- return await this._commandService.executeCommand(ct.id, {
1918
- range: n
2021
+ return this._commandService.syncExecuteCommand(mt.id, {
2022
+ range: n,
2023
+ unitId: this._workbook.getUnitId(),
2024
+ subUnitId: this._worksheet.getSheetId()
1919
2025
  }), this;
1920
2026
  }
1921
2027
  /**
@@ -1924,14 +2030,14 @@ let _ = class extends p {
1924
2030
  * @param destinationIndex The index that the columns should be moved to. Note that this index is based on the coordinates before the columns are moved. Existing data is shifted right to make room for the moved columns while the source columns are removed from the grid. Therefore, the data may end up at a different index than originally specified. Use 0-index for this method.
1925
2031
  * @returns This sheet, for chaining.
1926
2032
  */
1927
- async moveColumns(e, t) {
1928
- const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), r = $(e.getRange(), this._worksheet), i = r, a = {
2033
+ moveColumns(e, t) {
2034
+ const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), r = H(e.getRange(), this._worksheet), i = r, a = {
1929
2035
  startRow: 0,
1930
2036
  endRow: this._worksheet.getRowCount() - 1,
1931
2037
  startColumn: t,
1932
2038
  endColumn: t
1933
2039
  };
1934
- return await this._commandService.executeCommand(dt.id, {
2040
+ return this._commandService.syncExecuteCommand(ut.id, {
1935
2041
  unitId: n,
1936
2042
  subUnitId: s,
1937
2043
  range: r,
@@ -1944,9 +2050,9 @@ let _ = class extends p {
1944
2050
  * @param column The column range to hide.
1945
2051
  * @returns This sheet, for chaining.
1946
2052
  */
1947
- async hideColumn(e) {
1948
- const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), s = $(e.getRange(), this._worksheet);
1949
- return await this._commandService.executeCommand(ue.id, {
2053
+ hideColumn(e) {
2054
+ const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), s = H(e.getRange(), this._worksheet);
2055
+ return this._commandService.syncExecuteCommand(le.id, {
1950
2056
  unitId: t,
1951
2057
  subUnitId: n,
1952
2058
  ranges: [s]
@@ -1958,48 +2064,48 @@ let _ = class extends p {
1958
2064
  * @param numColumns The number of columns to hide.
1959
2065
  * @returns This sheet, for chaining.
1960
2066
  */
1961
- async hideColumns(e, t = 1) {
2067
+ hideColumns(e, t = 1) {
1962
2068
  const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), r = {
1963
2069
  startRow: 0,
1964
2070
  endRow: this._worksheet.getRowCount() - 1,
1965
2071
  startColumn: e,
1966
2072
  endColumn: e + t - 1,
1967
- rangeType: g.COLUMN
2073
+ rangeType: _.COLUMN
1968
2074
  };
1969
- return await this._commandService.executeCommand(ue.id, {
2075
+ return this._commandService.syncExecuteCommand(le.id, {
1970
2076
  unitId: n,
1971
2077
  subUnitId: s,
1972
2078
  ranges: [r]
1973
2079
  }), this;
1974
2080
  }
1975
2081
  /**
1976
- * Unhides the column in the given range.
2082
+ * Show the column in the given range.
1977
2083
  * @param column The range to unhide, if hidden.
1978
2084
  * @returns This sheet, for chaining.
1979
2085
  */
1980
- async unhideColumn(e) {
1981
- const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), s = $(e.getRange(), this._worksheet);
1982
- return await this._commandService.executeCommand(le.id, {
2086
+ unhideColumn(e) {
2087
+ const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), s = H(e.getRange(), this._worksheet);
2088
+ return this._commandService.syncExecuteCommand(ge.id, {
1983
2089
  unitId: t,
1984
2090
  subUnitId: n,
1985
2091
  ranges: [s]
1986
2092
  }), this;
1987
2093
  }
1988
2094
  /**
1989
- * Unhides one or more consecutive columns starting at the given index. Use 0-index for this method.
2095
+ * Show one or more consecutive columns starting at the given index. Use 0-index for this method.
1990
2096
  * @param columnIndex The starting index of the columns to unhide.
1991
2097
  * @param numColumns The number of columns to unhide.
1992
2098
  * @returns This sheet, for chaining.
1993
2099
  */
1994
- async showColumns(e, t = 1) {
2100
+ showColumns(e, t = 1) {
1995
2101
  const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), r = {
1996
2102
  startRow: 0,
1997
2103
  endRow: this._worksheet.getRowCount() - 1,
1998
2104
  startColumn: e,
1999
2105
  endColumn: e + t - 1,
2000
- rangeType: g.COLUMN
2106
+ rangeType: _.COLUMN
2001
2107
  };
2002
- return await this._commandService.executeCommand(le.id, {
2108
+ return this._commandService.syncExecuteCommand(ge.id, {
2003
2109
  unitId: n,
2004
2110
  subUnitId: s,
2005
2111
  ranges: [r]
@@ -2011,7 +2117,7 @@ let _ = class extends p {
2011
2117
  * @param width The width in pixels to set it to.
2012
2118
  * @returns This sheet, for chaining.
2013
2119
  */
2014
- async setColumnWidth(e, t) {
2120
+ setColumnWidth(e, t) {
2015
2121
  return this.setColumnWidths(e, 1, t);
2016
2122
  }
2017
2123
  /**
@@ -2021,7 +2127,7 @@ let _ = class extends p {
2021
2127
  * @param width The width in pixels to set it to.
2022
2128
  * @returns This sheet, for chaining.
2023
2129
  */
2024
- async setColumnWidths(e, t, n) {
2130
+ setColumnWidths(e, t, n) {
2025
2131
  const s = this._workbook.getUnitId(), r = this._worksheet.getSheetId(), i = [
2026
2132
  {
2027
2133
  startColumn: e,
@@ -2030,7 +2136,7 @@ let _ = class extends p {
2030
2136
  endRow: this._worksheet.getRowCount() - 1
2031
2137
  }
2032
2138
  ];
2033
- return await this._commandService.executeCommand(mt.id, {
2139
+ return this._commandService.syncExecuteCommand(lt.id, {
2034
2140
  unitId: s,
2035
2141
  subUnitId: r,
2036
2142
  ranges: i,
@@ -2043,7 +2149,7 @@ let _ = class extends p {
2043
2149
  * @param custom The custom properties to set.
2044
2150
  * @returns This sheet, for chaining.
2045
2151
  */
2046
- async setColumnCustom(e) {
2152
+ setColumnCustom(e) {
2047
2153
  const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), s = {};
2048
2154
  for (const [i, a] of Object.entries(e))
2049
2155
  s[Number(i)] = {
@@ -2054,7 +2160,7 @@ let _ = class extends p {
2054
2160
  subUnitId: n,
2055
2161
  columnData: s
2056
2162
  };
2057
- return await this._commandService.executeCommand(re.id, r), this;
2163
+ return this._commandService.syncExecuteCommand(ie.id, r), this;
2058
2164
  }
2059
2165
  // #region merge cells
2060
2166
  /**
@@ -2062,7 +2168,7 @@ let _ = class extends p {
2062
2168
  * @returns all merged cells
2063
2169
  */
2064
2170
  getMergedRanges() {
2065
- return this._worksheet.getSnapshot().mergeData.map((t) => this._injector.createInstance(S, this._workbook, this._worksheet, t));
2171
+ return this._worksheet.getSnapshot().mergeData.map((t) => this._injector.createInstance(w, this._workbook, this._worksheet, t));
2066
2172
  }
2067
2173
  /**
2068
2174
  * Get the merged cell data of the specified row and column.
@@ -2073,7 +2179,7 @@ let _ = class extends p {
2073
2179
  getCellMergeData(e, t) {
2074
2180
  const s = this._worksheet.getMergedCell(e, t);
2075
2181
  if (s)
2076
- return this._injector.createInstance(S, this._workbook, this._worksheet, s);
2182
+ return this._injector.createInstance(w, this._workbook, this._worksheet, s);
2077
2183
  }
2078
2184
  // #endregion
2079
2185
  /**
@@ -2085,43 +2191,42 @@ let _ = class extends p {
2085
2191
  }
2086
2192
  /**
2087
2193
  * Sets the active selection region for this sheet.
2088
- * @param range The range to set as the active selection.
2194
+ * @param {FRange} range The range to set as the active selection.
2195
+ * @returns {FWorksheet} This sheet, for chaining.
2089
2196
  */
2090
2197
  setActiveRange(e) {
2091
2198
  const { unitId: t, sheetId: n } = e.getRange();
2092
2199
  if (t !== this._workbook.getUnitId() || n !== this._worksheet.getSheetId())
2093
2200
  throw new Error("Specified range must be part of the sheet.");
2094
- this._fWorkbook.setActiveRange(e);
2201
+ return this._fWorkbook.setActiveRange(e), this;
2095
2202
  }
2096
2203
  /**
2097
2204
  * Sets the frozen state of the current sheet.
2098
2205
  * @param freeze - the scrolling viewport start range and count of freezed rows and columns.
2099
2206
  * that means if you want to freeze the first 3 rows and 2 columns, you should set freeze as { startRow: 3, startColumn: 2, xSplit: 2, ySplit: 3 }
2100
- *
2101
2207
  * @deprecated use `setFrozenRows` and `setFrozenColumns` instead.
2102
2208
  * @returns True if the command was successful, false otherwise.
2103
2209
  */
2104
2210
  setFreeze(e) {
2105
- return this._logService.warn("setFreeze is deprecated, use setFrozenRows and setFrozenColumns instead"), this._commandService.syncExecuteCommand(B.id, {
2211
+ return this._logService.warn("setFreeze is deprecated, use setFrozenRows and setFrozenColumns instead"), this._commandService.syncExecuteCommand(L.id, {
2106
2212
  ...e,
2107
2213
  unitId: this._workbook.getUnitId(),
2108
2214
  subUnitId: this.getSheetId()
2109
- });
2215
+ }), this;
2110
2216
  }
2111
2217
  /**
2112
2218
  * Cancels the frozen state of the current sheet.
2113
2219
  * @returns True if the command was successful, false otherwise.
2114
2220
  */
2115
2221
  cancelFreeze() {
2116
- return this._commandService.syncExecuteCommand(ut.id, {
2222
+ return this._commandService.syncExecuteCommand(gt.id, {
2117
2223
  unitId: this._workbook.getUnitId(),
2118
2224
  subUnitId: this.getSheetId()
2119
- });
2225
+ }), this;
2120
2226
  }
2121
2227
  /**
2122
2228
  * Get the freeze state of the current sheet.
2123
2229
  * @returns The freeze state of the current sheet.
2124
- *
2125
2230
  * @deprecated use `getRowFreezeStatus` and `getColumnFreezeStatus` instead.
2126
2231
  */
2127
2232
  getFreeze() {
@@ -2138,7 +2243,7 @@ let _ = class extends p {
2138
2243
  });
2139
2244
  } else if (arguments.length === 2) {
2140
2245
  let [n = 0, s = 0] = e;
2141
- n > s && ([n, s] = [s, n]), this._commandService.syncExecuteCommand(B.id, {
2246
+ n > s && ([n, s] = [s, n]), this._commandService.syncExecuteCommand(L.id, {
2142
2247
  startColumn: s + 1,
2143
2248
  xSplit: s - n + 1,
2144
2249
  startRow: t.startRow,
@@ -2147,6 +2252,7 @@ let _ = class extends p {
2147
2252
  subUnitId: this.getSheetId()
2148
2253
  });
2149
2254
  }
2255
+ return this;
2150
2256
  }
2151
2257
  setFrozenRows(...e) {
2152
2258
  const t = this.getFreeze();
@@ -2159,7 +2265,7 @@ let _ = class extends p {
2159
2265
  });
2160
2266
  } else if (arguments.length === 2) {
2161
2267
  let [n = 0, s = 0] = e;
2162
- n > s && ([n, s] = [s, n]), this._commandService.syncExecuteCommand, this._commandService.syncExecuteCommand(B.id, {
2268
+ n > s && ([n, s] = [s, n]), this._commandService.syncExecuteCommand(L.id, {
2163
2269
  startRow: s + 1,
2164
2270
  ySplit: s - n + 1,
2165
2271
  startColumn: t.startColumn,
@@ -2168,11 +2274,11 @@ let _ = class extends p {
2168
2274
  subUnitId: this.getSheetId()
2169
2275
  });
2170
2276
  }
2277
+ return this;
2171
2278
  }
2172
2279
  /**
2173
2280
  * Get the number of frozen columns.
2174
- * @returns The number of frozen columns.
2175
- * Returns 0 if no columns are frozen.
2281
+ * @returns The number of frozen columns, returns 0 if no columns are frozen.
2176
2282
  */
2177
2283
  getFrozenColumns() {
2178
2284
  const e = this.getFreeze();
@@ -2180,8 +2286,7 @@ let _ = class extends p {
2180
2286
  }
2181
2287
  /**
2182
2288
  * Get the number of frozen rows.
2183
- * @returns The number of frozen rows.
2184
- * Returns 0 if no rows are frozen.
2289
+ * @returns The number of frozen rows. returns 0 if no rows are frozen.
2185
2290
  */
2186
2291
  getFrozenRows() {
2187
2292
  const e = this.getFreeze();
@@ -2189,6 +2294,7 @@ let _ = class extends p {
2189
2294
  }
2190
2295
  /**
2191
2296
  * Get freezed rows.
2297
+ * @returns {IRowRange} The range of the frozen rows.
2192
2298
  */
2193
2299
  getFrozenRowRange() {
2194
2300
  const e = this._worksheet.getFreeze();
@@ -2199,6 +2305,7 @@ let _ = class extends p {
2199
2305
  }
2200
2306
  /**
2201
2307
  * Get freezed columns
2308
+ * @returns {IColumnRange} The range of the frozen columns.
2202
2309
  */
2203
2310
  getFrozenColumnRange() {
2204
2311
  const e = this._worksheet.getFreeze();
@@ -2226,6 +2333,7 @@ let _ = class extends p {
2226
2333
  /**
2227
2334
  * Hides or reveals the sheet gridlines.
2228
2335
  * @param {boolean} hidden If `true`, hide gridlines in this sheet; otherwise show the gridlines.
2336
+ * @returns {FWorksheet} Returns the current worksheet instance for method chaining
2229
2337
  * @example
2230
2338
  * ``` ts
2231
2339
  * const fWorkbook = univerAPI.getActiveWorkbook();
@@ -2235,16 +2343,16 @@ let _ = class extends p {
2235
2343
  * ```
2236
2344
  */
2237
2345
  setHiddenGridlines(e) {
2238
- return this._commandService.executeCommand(lt.id, {
2346
+ return this._commandService.executeCommand(_t.id, {
2239
2347
  unitId: this._workbook.getUnitId(),
2240
2348
  subUnitId: this._worksheet.getSheetId(),
2241
2349
  showGridlines: e ? u.FALSE : u.TRUE
2242
- });
2350
+ }), this;
2243
2351
  }
2244
2352
  /**
2245
2353
  * Set the color of the gridlines in the sheet.
2246
2354
  * @param {string|undefined} color The color to set for the gridlines.Undefined or null to reset to the default color.
2247
- * @returns {Promise<boolean>} True if the command was successful, false otherwise.
2355
+ * @returns {FWorksheet} Returns the current worksheet instance for method chaining
2248
2356
  * @example
2249
2357
  * ```ts
2250
2358
  * const fWorkbook = univerAPI.getActiveWorkbook();
@@ -2254,11 +2362,11 @@ let _ = class extends p {
2254
2362
  * ```
2255
2363
  */
2256
2364
  setGridLinesColor(e) {
2257
- return this._commandService.executeCommand(gt.id, {
2365
+ return this._commandService.syncExecuteCommand(wt.id, {
2258
2366
  unitId: this._workbook.getUnitId(),
2259
2367
  subUnitId: this._worksheet.getSheetId(),
2260
2368
  color: e
2261
- });
2369
+ }), this;
2262
2370
  }
2263
2371
  /**
2264
2372
  * Get the color of the gridlines in the sheet.
@@ -2270,7 +2378,7 @@ let _ = class extends p {
2270
2378
  /**
2271
2379
  * Sets the sheet tab color.
2272
2380
  * @param {string|null|undefined} color A color code in CSS notation (like '#ffffff' or 'white'), or null to reset the tab color.
2273
- * @returns {Promise<boolean>} True if the command was successful, false otherwise.
2381
+ * @returns {FWorksheet} Returns the current worksheet instance for method chaining
2274
2382
  * @example
2275
2383
  * ```ts
2276
2384
  * const fWorkbook = univerAPI.getActiveWorkbook();
@@ -2280,11 +2388,11 @@ let _ = class extends p {
2280
2388
  * ```
2281
2389
  */
2282
2390
  setTabColor(e) {
2283
- return this._commandService.executeCommand(_t.id, {
2391
+ return this._commandService.executeCommand(kt.id, {
2284
2392
  unitId: this._workbook.getUnitId(),
2285
2393
  subUnitId: this._worksheet.getSheetId(),
2286
2394
  color: e
2287
- });
2395
+ }), this;
2288
2396
  }
2289
2397
  /**
2290
2398
  * Get the tab color of the sheet.
@@ -2319,9 +2427,9 @@ let _ = class extends p {
2319
2427
  */
2320
2428
  onCellDataChange(e) {
2321
2429
  return this._injector.get(l).onCommandExecuted((n) => {
2322
- if (n.id === ge.id) {
2430
+ if (n.id === _e.id) {
2323
2431
  const s = n.params;
2324
- s.unitId === this._workbook.getUnitId() && s.subUnitId === this._worksheet.getSheetId() && s.cellValue && e(new j(s.cellValue));
2432
+ s.unitId === this._workbook.getUnitId() && s.subUnitId === this._worksheet.getSheetId() && s.cellValue && e(new M(s.cellValue));
2325
2433
  }
2326
2434
  });
2327
2435
  }
@@ -2343,34 +2451,35 @@ let _ = class extends p {
2343
2451
  */
2344
2452
  onBeforeCellDataChange(e) {
2345
2453
  return this._injector.get(l).beforeCommandExecuted((n) => {
2346
- if (n.id === ge.id) {
2454
+ if (n.id === _e.id) {
2347
2455
  const s = n.params;
2348
- s.unitId === this._workbook.getUnitId() && s.subUnitId === this._worksheet.getSheetId() && s.cellValue && e(new j(s.cellValue));
2456
+ s.unitId === this._workbook.getUnitId() && s.subUnitId === this._worksheet.getSheetId() && s.cellValue && e(new M(s.cellValue));
2349
2457
  }
2350
2458
  });
2351
2459
  }
2352
2460
  /**
2353
2461
  * Hides this sheet. Has no effect if the sheet is already hidden. If this method is called on the only visible sheet, it throws an exception.
2462
+ * @returns {FWorksheet} Returns the current worksheet instance for method chaining
2354
2463
  * @example
2355
2464
  * ```ts
2356
2465
  * const fWorkbook = univerAPI.getActiveWorkbook();
2357
2466
  * const fWorkSheet = fWorkbook.getActiveSheet();
2358
2467
  * // hide the active sheet
2359
2468
  * fWorkSheet.hideSheet();
2360
- * ``
2469
+ * ```
2361
2470
  */
2362
2471
  hideSheet() {
2363
2472
  const e = this._injector.get(l);
2364
2473
  if (this._workbook.getSheets().filter((r) => r.isSheetHidden() !== u.TRUE).length <= 1)
2365
2474
  throw new Error("Cannot hide the only visible sheet");
2366
- e.executeCommand(wt.id, {
2475
+ return e.syncExecuteCommand(St.id, {
2367
2476
  unitId: this._workbook.getUnitId(),
2368
2477
  subUnitId: this._worksheet.getSheetId()
2369
- });
2478
+ }), this;
2370
2479
  }
2371
2480
  /**
2372
2481
  * Shows this sheet. Has no effect if the sheet is already visible.
2373
- * @returns {Promise<boolean>} True if the command was successful, false otherwise.
2482
+ * @returns {FWorksheet} Returns the current worksheet instance for method chaining
2374
2483
  * @example
2375
2484
  * ```ts
2376
2485
  * const fWorkbook = univerAPI.getActiveWorkbook();
@@ -2380,10 +2489,10 @@ let _ = class extends p {
2380
2489
  * ```
2381
2490
  */
2382
2491
  showSheet() {
2383
- return this._injector.get(l).executeCommand(kt.id, {
2492
+ return this._injector.get(l).syncExecuteCommand(Ct.id, {
2384
2493
  unitId: this._workbook.getUnitId(),
2385
2494
  subUnitId: this._worksheet.getSheetId()
2386
- });
2495
+ }), this;
2387
2496
  }
2388
2497
  /**
2389
2498
  * Returns true if the sheet is currently hidden.
@@ -2395,7 +2504,7 @@ let _ = class extends p {
2395
2504
  /**
2396
2505
  * Sets the sheet name.
2397
2506
  * @param {string} name The new name for the sheet.
2398
- * @returns {Promise<boolean>} True if the command was successful, false otherwise.
2507
+ * @returns {FWorksheet} Returns the current worksheet instance for method chaining
2399
2508
  * @example
2400
2509
  * ```ts
2401
2510
  * const fWorkbook = univerAPI.getActiveWorkbook();
@@ -2405,11 +2514,11 @@ let _ = class extends p {
2405
2514
  * ```
2406
2515
  */
2407
2516
  setName(e) {
2408
- return this._commandService.executeCommand(St.id, {
2517
+ return this._commandService.syncExecuteCommand(It.id, {
2409
2518
  unitId: this._workbook.getUnitId(),
2410
2519
  subUnitId: this._worksheet.getSheetId(),
2411
2520
  name: e
2412
- });
2521
+ }), this;
2413
2522
  }
2414
2523
  /**
2415
2524
  * Activates this sheet. Does not alter the sheet itself, only the parent's notion of the active sheet.
@@ -2438,7 +2547,7 @@ let _ = class extends p {
2438
2547
  * @param {IFacadeClearOptions} [options] Options for clearing the sheet. If not provided, the contents and formatting are cleared both.
2439
2548
  * @param {boolean} [options.contentsOnly] If true, the contents of the sheet are cleared. If false, the contents and formatting are cleared. Default is false.
2440
2549
  * @param {boolean} [options.formatOnly] If true, the formatting of the sheet is cleared. If false, the contents and formatting are cleared. Default is false.
2441
- * @returns {Promise<boolean>} True if the command was successful, false otherwise.
2550
+ * @returns {FWorksheet} Returns the current worksheet instance for method chaining
2442
2551
  * @example
2443
2552
  * ```ts
2444
2553
  * const fWorkbook = univerAPI.getActiveWorkbook();
@@ -2450,26 +2559,23 @@ let _ = class extends p {
2450
2559
  * ```
2451
2560
  */
2452
2561
  clear(e) {
2453
- if (e && e.contentsOnly && !e.formatOnly)
2454
- return this.clearContents();
2455
- if (e && e.formatOnly && !e.contentsOnly)
2456
- return this.clearFormats();
2562
+ e && e.contentsOnly && !e.formatOnly && this.clearContents(), e && e.formatOnly && !e.contentsOnly && this.clearFormats();
2457
2563
  const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), s = this._injector.get(l), r = {
2458
2564
  startRow: 0,
2459
2565
  endRow: this._worksheet.getRowCount() - 1,
2460
2566
  startColumn: 0,
2461
2567
  endColumn: this._worksheet.getColumnCount() - 1
2462
2568
  };
2463
- return s.executeCommand(Ct.id, {
2569
+ return s.syncExecuteCommand(ft.id, {
2464
2570
  unitId: t,
2465
2571
  subUnitId: n,
2466
2572
  ranges: [r],
2467
2573
  options: e
2468
- });
2574
+ }), this;
2469
2575
  }
2470
2576
  /**
2471
2577
  * Clears the sheet of contents, while preserving formatting information.
2472
- * @returns {Promise<boolean>} True if the command was successful, false otherwise.
2578
+ * @returns {FWorksheet} Returns the current worksheet instance for method chaining
2473
2579
  * @example
2474
2580
  * ```ts
2475
2581
  * const fWorkbook = univerAPI.getActiveWorkbook();
@@ -2485,15 +2591,15 @@ let _ = class extends p {
2485
2591
  startColumn: 0,
2486
2592
  endColumn: this._worksheet.getColumnCount() - 1
2487
2593
  };
2488
- return n.executeCommand(It.id, {
2594
+ return n.syncExecuteCommand(vt.id, {
2489
2595
  unitId: e,
2490
2596
  subUnitId: t,
2491
2597
  ranges: [s]
2492
- });
2598
+ }), this;
2493
2599
  }
2494
2600
  /**
2495
2601
  * Clears the sheet of formatting, while preserving contents.
2496
- * @returns {Promise<boolean>} True if the command was successful, false otherwise.
2602
+ * @returns {FWorksheet} Returns the current worksheet instance for method chaining
2497
2603
  * @example
2498
2604
  * ```ts
2499
2605
  * const fWorkbook = univerAPI.getActiveWorkbook();
@@ -2509,11 +2615,11 @@ let _ = class extends p {
2509
2615
  startColumn: 0,
2510
2616
  endColumn: this._worksheet.getColumnCount() - 1
2511
2617
  };
2512
- return n.executeCommand(ft.id, {
2618
+ return n.syncExecuteCommand(Rt.id, {
2513
2619
  unitId: e,
2514
2620
  subUnitId: t,
2515
2621
  ranges: [s]
2516
- });
2622
+ }), this;
2517
2623
  }
2518
2624
  /**
2519
2625
  * Returns a Range corresponding to the dimensions in which data is present.
@@ -2548,6 +2654,7 @@ let _ = class extends p {
2548
2654
  return this._worksheet.getLastColumnWithContent();
2549
2655
  }
2550
2656
  /**
2657
+ * @deprecated use getLastColumn instead.
2551
2658
  * Returns the position of the last column that has content. Same as getLastColumns.
2552
2659
  * @returns {number} the last column of the sheet that contains content.
2553
2660
  * @example
@@ -2562,6 +2669,7 @@ let _ = class extends p {
2562
2669
  return this._worksheet.getLastColumnWithContent();
2563
2670
  }
2564
2671
  /**
2672
+ * @deprecated use getLastRow instead.
2565
2673
  * Returns the position of the last row that has content.
2566
2674
  * @returns {number} the last row of the sheet that contains content.
2567
2675
  * @example
@@ -2602,7 +2710,7 @@ let _ = class extends p {
2602
2710
  * ```
2603
2711
  */
2604
2712
  equalTo(e) {
2605
- return e instanceof _ ? this._worksheet.getSheetId() === e.getSheetId() && this._workbook.getUnitId() === e.getWorkbook().getUnitId() : !1;
2713
+ return e instanceof g ? this._worksheet.getSheetId() === e.getSheetId() && this._workbook.getUnitId() === e.getWorkbook().getUnitId() : !1;
2606
2714
  }
2607
2715
  /*
2608
2716
  * Insert a defined name for worksheet.
@@ -2617,7 +2725,7 @@ let _ = class extends p {
2617
2725
  * ```
2618
2726
  */
2619
2727
  insertDefinedName(e, t) {
2620
- const s = this._injector.createInstance(A).setName(e).setRef(t).build();
2728
+ const s = this._injector.createInstance(F).setName(e).setRef(t).build();
2621
2729
  s.localSheetId = this.getSheetId(), this._fWorkbook.insertDefinedNameBuilder(s);
2622
2730
  }
2623
2731
  /**
@@ -2634,22 +2742,40 @@ let _ = class extends p {
2634
2742
  getDefinedNames() {
2635
2743
  return this._fWorkbook.getDefinedNames().filter((t) => t.getLocalSheetId() === this.getSheetId());
2636
2744
  }
2745
+ /**
2746
+ * Get all merged cells in the current worksheet
2747
+ * @returns {FRange[]} All the merged cells in the worksheet
2748
+ * @example
2749
+ * ```ts
2750
+ * const workbook = univerAPI.getActiveWorkbook();
2751
+ * const worksheet = workbook.getActiveSheet();
2752
+ * const rangeFirst = worksheet.getRange(0, 0, 2, 2);
2753
+ * const mergeFirst = rangeFirst.merge();
2754
+ * const rangeSecond = worksheet.getRange(5, 0, 2, 2);
2755
+ * const mergeSecond = rangeSecond.merge();
2756
+ * const mergeData = worksheet.getMergeData();
2757
+ * console.log('debugger', mergeData);
2758
+ * ```
2759
+ */
2760
+ getMergeData() {
2761
+ return this._worksheet.getMergeData().map((e) => this._injector.createInstance(w, this._workbook, this._worksheet, e));
2762
+ }
2637
2763
  };
2638
- _ = Gt([
2639
- M(3, m(v)),
2640
- M(4, m(Ne)),
2641
- M(5, m(Ce)),
2642
- M(6, l)
2643
- ], _);
2644
- var qt = Object.defineProperty, Kt = Object.getOwnPropertyDescriptor, Yt = (o, e, t, n) => {
2645
- for (var s = n > 1 ? void 0 : n ? Kt(e, t) : e, r = o.length - 1, i; r >= 0; r--)
2764
+ g = Zt([
2765
+ W(3, m(v)),
2766
+ W(4, m(Ne)),
2767
+ W(5, m(Ie)),
2768
+ W(6, l)
2769
+ ], g);
2770
+ var en = Object.defineProperty, tn = Object.getOwnPropertyDescriptor, nn = (o, e, t, n) => {
2771
+ for (var s = n > 1 ? void 0 : n ? tn(e, t) : e, r = o.length - 1, i; r >= 0; r--)
2646
2772
  (i = o[r]) && (s = (n ? i(e, t, s) : i(s)) || s);
2647
- return n && s && qt(e, t, s), s;
2648
- }, k = (o, e) => (t, n) => e(t, n, o);
2649
- let I = class extends p {
2773
+ return n && s && en(e, t, s), s;
2774
+ }, S = (o, e) => (t, n) => e(t, n, o);
2775
+ let I = class extends X {
2650
2776
  constructor(e, t, n, s, r, i, a, h, c, d) {
2651
- super();
2652
- P(this, "id");
2777
+ super(t);
2778
+ p(this, "id");
2653
2779
  this._workbook = e, this._injector = t, this._resourceLoaderService = n, this._selectionManagerService = s, this._univerInstanceService = r, this._commandService = i, this._permissionService = a, this._logService = h, this._localeService = c, this._definedNamesService = d, this.id = this._workbook.getUnitId();
2654
2780
  }
2655
2781
  /**
@@ -2692,8 +2818,8 @@ let I = class extends p {
2692
2818
  this._workbook.setName(e);
2693
2819
  }
2694
2820
  /**
2695
- * save workbook snapshot data, including conditional formatting, data validation, and other plugin data.
2696
- * @return Workbook snapshot data
2821
+ * Save workbook snapshot data, including conditional formatting, data validation, and other plugin data.
2822
+ * @returns {IWorkbookData} Workbook snapshot data
2697
2823
  * @example
2698
2824
  * ```ts
2699
2825
  * // The code below saves the workbook snapshot data
@@ -2706,7 +2832,7 @@ let I = class extends p {
2706
2832
  }
2707
2833
  /**
2708
2834
  * @deprecated use 'save' instead.
2709
- * @return {*} {IWorkbookData} Workbook snapshot data
2835
+ * @returns {*} {IWorkbookData} Workbook snapshot data
2710
2836
  * @memberof FWorkbook
2711
2837
  */
2712
2838
  getSnapshot() {
@@ -2714,7 +2840,7 @@ let I = class extends p {
2714
2840
  }
2715
2841
  /**
2716
2842
  * Get the active sheet of the workbook.
2717
- * @returns The active sheet of the workbook
2843
+ * @returns {FWorksheet} The active sheet of the workbook
2718
2844
  * @example
2719
2845
  * ```ts
2720
2846
  * // The code below gets the active sheet of the workbook
@@ -2724,11 +2850,11 @@ let I = class extends p {
2724
2850
  */
2725
2851
  getActiveSheet() {
2726
2852
  const e = this._workbook.getActiveSheet();
2727
- return this._injector.createInstance(_, this, this._workbook, e);
2853
+ return this._injector.createInstance(g, this, this._workbook, e);
2728
2854
  }
2729
2855
  /**
2730
2856
  * Gets all the worksheets in this workbook
2731
- * @returns An array of all the worksheets in the workbook
2857
+ * @returns {FWorksheet[]} An array of all the worksheets in the workbook
2732
2858
  * @example
2733
2859
  * ```ts
2734
2860
  * // The code below gets all the worksheets in the workbook
@@ -2737,7 +2863,7 @@ let I = class extends p {
2737
2863
  * ```
2738
2864
  */
2739
2865
  getSheets() {
2740
- return this._workbook.getSheets().map((e) => this._injector.createInstance(_, this, this._workbook, e));
2866
+ return this._workbook.getSheets().map((e) => this._injector.createInstance(g, this, this._workbook, e));
2741
2867
  }
2742
2868
  /**
2743
2869
  * Create a new worksheet and returns a handle to it.
@@ -2753,24 +2879,24 @@ let I = class extends p {
2753
2879
  * ```
2754
2880
  */
2755
2881
  create(e, t, n) {
2756
- const s = Fe({});
2757
- s.rowCount = t, s.columnCount = n, s.name = e, s.id = e.toLowerCase().replace(/ /g, "-"), this._commandService.syncExecuteCommand(z.id, {
2882
+ const s = Be({});
2883
+ s.rowCount = t, s.columnCount = n, s.name = e, s.id = e.toLowerCase().replace(/ /g, "-"), this._commandService.syncExecuteCommand(U.id, {
2758
2884
  unitId: this.id,
2759
2885
  index: this._workbook.getSheets().length,
2760
2886
  sheet: s
2761
- }), this._commandService.syncExecuteCommand(V.id, {
2887
+ }), this._commandService.syncExecuteCommand(z.id, {
2762
2888
  unitId: this.id,
2763
2889
  subUnitId: this._workbook.getSheets()[this._workbook.getSheets().length - 1].getSheetId()
2764
2890
  });
2765
2891
  const r = this._workbook.getActiveSheet();
2766
2892
  if (!r)
2767
2893
  throw new Error("No active sheet found");
2768
- return this._injector.createInstance(_, this, this._workbook, r);
2894
+ return this._injector.createInstance(g, this, this._workbook, r);
2769
2895
  }
2770
2896
  /**
2771
2897
  * Get a worksheet by sheet id.
2772
2898
  * @param sheetId The id of the sheet to get.
2773
- * @return The worksheet with given sheet id
2899
+ * @returns The worksheet with given sheet id
2774
2900
  * @example
2775
2901
  * ```ts
2776
2902
  * // The code below gets a worksheet by sheet id
@@ -2780,7 +2906,7 @@ let I = class extends p {
2780
2906
  */
2781
2907
  getSheetBySheetId(e) {
2782
2908
  const t = this._workbook.getSheetBySheetId(e);
2783
- return t ? this._injector.createInstance(_, this, this._workbook, t) : null;
2909
+ return t ? this._injector.createInstance(g, this, this._workbook, t) : null;
2784
2910
  }
2785
2911
  /**
2786
2912
  * Get a worksheet by sheet name.
@@ -2795,7 +2921,7 @@ let I = class extends p {
2795
2921
  */
2796
2922
  getSheetByName(e) {
2797
2923
  const t = this._workbook.getSheetBySheetName(e);
2798
- return t ? this._injector.createInstance(_, this, this._workbook, t) : null;
2924
+ return t ? this._injector.createInstance(g, this, this._workbook, t) : null;
2799
2925
  }
2800
2926
  /**
2801
2927
  * Sets the given worksheet to be the active worksheet in the workbook.
@@ -2810,7 +2936,7 @@ let I = class extends p {
2810
2936
  * ```
2811
2937
  */
2812
2938
  setActiveSheet(e) {
2813
- return this._commandService.syncExecuteCommand(V.id, {
2939
+ return this._commandService.syncExecuteCommand(z.id, {
2814
2940
  unitId: this.id,
2815
2941
  subUnitId: e.getSheetId()
2816
2942
  }), e;
@@ -2832,20 +2958,21 @@ let I = class extends p {
2832
2958
  * ```
2833
2959
  */
2834
2960
  insertSheet(e) {
2835
- e != null ? this._commandService.syncExecuteCommand(z.id, { sheet: { name: e } }) : this._commandService.syncExecuteCommand(z.id);
2961
+ e != null ? this._commandService.syncExecuteCommand(U.id, { sheet: { name: e } }) : this._commandService.syncExecuteCommand(U.id);
2836
2962
  const t = this.id, n = this._workbook.getSheets()[this._workbook.getSheets().length - 1].getSheetId();
2837
- this._commandService.syncExecuteCommand(V.id, {
2963
+ this._commandService.syncExecuteCommand(z.id, {
2838
2964
  unitId: t,
2839
2965
  subUnitId: n
2840
2966
  });
2841
2967
  const s = this._workbook.getActiveSheet();
2842
2968
  if (!s)
2843
2969
  throw new Error("No active sheet found");
2844
- return this._injector.createInstance(_, this, this._workbook, s);
2970
+ return this._injector.createInstance(g, this, this._workbook, s);
2845
2971
  }
2846
2972
  /**
2847
2973
  * Deletes the specified worksheet.
2848
2974
  * @param sheet The worksheet to delete.
2975
+ * @returns {boolean} True if the worksheet was deleted, false otherwise.
2849
2976
  * @example
2850
2977
  * ```ts
2851
2978
  * // The code below deletes the specified worksheet
@@ -2856,7 +2983,7 @@ let I = class extends p {
2856
2983
  */
2857
2984
  deleteSheet(e) {
2858
2985
  const t = this.id, n = e.getSheetId();
2859
- return this._commandService.executeCommand(vt.id, {
2986
+ return this._commandService.syncExecuteCommand(bt.id, {
2860
2987
  unitId: t,
2861
2988
  subUnitId: n
2862
2989
  });
@@ -2864,7 +2991,7 @@ let I = class extends p {
2864
2991
  // #region editing
2865
2992
  /**
2866
2993
  * Undo the last action.
2867
- * @returns A promise that resolves to true if the undo was successful, false otherwise.
2994
+ * @returns {FWorkbook} A promise that resolves to true if the undo was successful, false otherwise.
2868
2995
  * @example
2869
2996
  * ```ts
2870
2997
  * // The code below undoes the last action
@@ -2873,7 +3000,7 @@ let I = class extends p {
2873
3000
  * ```
2874
3001
  */
2875
3002
  undo() {
2876
- return this._univerInstanceService.focusUnit(this.id), this._commandService.executeCommand(Ae.id);
3003
+ return this._univerInstanceService.focusUnit(this.id), this._commandService.syncExecuteCommand(Le.id), this;
2877
3004
  }
2878
3005
  /**
2879
3006
  * Redo the last undone action.
@@ -2886,7 +3013,7 @@ let I = class extends p {
2886
3013
  * ```
2887
3014
  */
2888
3015
  redo() {
2889
- return this._univerInstanceService.focusUnit(this.id), this._commandService.executeCommand(Te.id);
3016
+ return this._univerInstanceService.focusUnit(this.id), this._commandService.syncExecuteCommand(ze.id), this;
2890
3017
  }
2891
3018
  /**
2892
3019
  * Callback for command execution.
@@ -2937,7 +3064,6 @@ let I = class extends p {
2937
3064
  }
2938
3065
  /**
2939
3066
  * Callback for selection changes.
2940
- *
2941
3067
  * @callback onSelectionChangeCallback
2942
3068
  * @param {IRange[]} selections The new selection.
2943
3069
  */
@@ -2947,46 +3073,50 @@ let I = class extends p {
2947
3073
  * @returns A function to dispose the listening
2948
3074
  */
2949
3075
  onSelectionChange(e) {
2950
- return Ie(
3076
+ return fe(
2951
3077
  this._selectionManagerService.selectionMoveEnd$.subscribe((t) => {
2952
- this._univerInstanceService.getCurrentUnitForType(U.UNIVER_SHEET).getUnitId() === this.id && (t != null && t.length ? e(t.map((n) => n.range)) : e([]));
3078
+ this._univerInstanceService.getCurrentUnitForType(P.UNIVER_SHEET).getUnitId() === this.id && (t != null && t.length ? e(t.map((n) => n.range)) : e([]));
2953
3079
  })
2954
3080
  );
2955
3081
  }
2956
3082
  /**
2957
3083
  * Used to modify the editing permissions of the workbook. When the value is false, editing is not allowed.
2958
3084
  * @param {boolean} value editable value want to set
3085
+ * @returns {FWorkbook} FWorkbook instance
2959
3086
  */
2960
3087
  setEditable(e) {
2961
- const t = new ye(this._workbook.getUnitId());
2962
- this._permissionService.getPermissionPoint(t.id) || this._permissionService.addPermissionPoint(t), this._permissionService.updatePermissionPoint(t.id, e);
3088
+ const t = new Ue(this._workbook.getUnitId());
3089
+ return this._permissionService.getPermissionPoint(t.id) || this._permissionService.addPermissionPoint(t), this._permissionService.updatePermissionPoint(t.id, e), this;
2963
3090
  }
2964
3091
  /**
2965
- * Sets the active selection region for this sheet.
3092
+ * Sets the selection region for active sheet.
2966
3093
  * @param range The range to set as the active selection.
3094
+ * @returns {FWorkbook} FWorkbook instance
2967
3095
  */
2968
3096
  setActiveRange(e) {
2969
3097
  const t = this.getActiveSheet(), n = e.getRange().sheetId || t.getSheetId(), s = n ? this._workbook.getSheetBySheetId(n) : this._workbook.getActiveSheet(!0);
2970
3098
  if (!s)
2971
3099
  throw new Error("No active sheet found");
2972
- s.getSheetId() !== t.getSheetId() && this.setActiveSheet(this._injector.createInstance(_, this, this._workbook, s));
3100
+ s.getSheetId() !== t.getSheetId() && this.setActiveSheet(this._injector.createInstance(g, this, this._workbook, s));
2973
3101
  const r = {
2974
3102
  unitId: this.getId(),
2975
3103
  subUnitId: n,
2976
- selections: [e].map((i) => ({ range: i.getRange(), primary: Y(i.getRange(), s), style: null }))
3104
+ selections: [e].map((i) => ({ range: i.getRange(), primary: K(i.getRange(), s), style: null }))
2977
3105
  };
2978
- this._commandService.syncExecuteCommand(Ue.id, r);
3106
+ return this._commandService.syncExecuteCommand(xe.id, r), this;
2979
3107
  }
2980
3108
  /**
2981
3109
  * Returns the selected range in the active sheet, or null if there is no active range.
2982
3110
  * @returns the active range
2983
3111
  */
3112
+ // could sheet have no active range ?
2984
3113
  getActiveRange() {
2985
3114
  const e = this._workbook.getActiveSheet(), n = this._selectionManagerService.getCurrentSelections().find((s) => !!s.primary);
2986
- return n ? this._injector.createInstance(S, this._workbook, e, n.range) : null;
3115
+ return n ? this._injector.createInstance(w, this._workbook, e, n.range) : null;
2987
3116
  }
2988
3117
  /**
2989
3118
  * Deletes the currently active sheet.
3119
+ * @returns {boolean} true if the sheet was deleted, false otherwise
2990
3120
  * @example
2991
3121
  * ```ts
2992
3122
  * // The code below deletes the currently active sheet and stores the new active
@@ -3001,7 +3131,7 @@ let I = class extends p {
3001
3131
  /**
3002
3132
  * Duplicates the given worksheet.
3003
3133
  * @param {FWorksheet} sheet The worksheet to duplicate.
3004
- * @returns {Promise<boolean>} true if the sheet was duplicated, false otherwise
3134
+ * @returns {FWorksheet} The duplicated worksheet
3005
3135
  * @example
3006
3136
  * ```ts
3007
3137
  * // The code below duplicates the given worksheet
@@ -3011,14 +3141,14 @@ let I = class extends p {
3011
3141
  * ```
3012
3142
  */
3013
3143
  duplicateSheet(e) {
3014
- return this._commandService.executeCommand(Rt.id, {
3144
+ return this._commandService.syncExecuteCommand(pt.id, {
3015
3145
  unitId: e.getWorkbook().getUnitId(),
3016
3146
  subUnitId: e.getSheetId()
3017
- });
3147
+ }), this._injector.createInstance(g, this, this._workbook, this._workbook.getActiveSheet());
3018
3148
  }
3019
3149
  /**
3020
3150
  * Duplicates the active sheet.
3021
- * @returns {Promise<boolean>} true if the sheet was duplicated, false otherwise
3151
+ * @returns {FWorksheet} The duplicated worksheet
3022
3152
  * @example
3023
3153
  * ```ts
3024
3154
  * // The code below duplicates the active sheet
@@ -3056,9 +3186,17 @@ let I = class extends p {
3056
3186
  getLocale() {
3057
3187
  return this._localeService.getCurrentLocale();
3058
3188
  }
3189
+ /**
3190
+ * @deprecated use setSpreadsheetLocale instead.
3191
+ * @param {LocaleType} locale - The locale to set
3192
+ */
3193
+ setLocale(e) {
3194
+ this._localeService.setLocale(e);
3195
+ }
3059
3196
  /**
3060
3197
  * Set the locale of the workbook.
3061
3198
  * @param {LocaleType} locale The locale to set
3199
+ * @returns {FWorkbook} This workbook, for chaining
3062
3200
  * @example
3063
3201
  * ```ts
3064
3202
  * // The code below sets the locale of the workbook
@@ -3066,8 +3204,8 @@ let I = class extends p {
3066
3204
  * activeSpreadsheet.setLocale(LocaleType.EN_US);
3067
3205
  * ```
3068
3206
  */
3069
- setLocale(e) {
3070
- this._localeService.setLocale(e);
3207
+ setSpreadsheetLocale(e) {
3208
+ return this._localeService.setLocale(e), this;
3071
3209
  }
3072
3210
  /**
3073
3211
  * Get the URL of the workbook.
@@ -3086,7 +3224,7 @@ let I = class extends p {
3086
3224
  * Move the sheet to the specified index.
3087
3225
  * @param {FWorksheet} sheet The sheet to move
3088
3226
  * @param {number} index The index to move the sheet to
3089
- * @returns {Promise<boolean>} true if the sheet was moved, false otherwise
3227
+ * @returns {FWorkbook} This workbook, for chaining
3090
3228
  * @example
3091
3229
  * ```ts
3092
3230
  * // The code below moves the sheet to the specified index
@@ -3097,16 +3235,16 @@ let I = class extends p {
3097
3235
  */
3098
3236
  moveSheet(e, t) {
3099
3237
  let n = t;
3100
- return n < 0 ? n = 0 : n > this._workbook.getSheets().length - 1 && (n = this._workbook.getSheets().length - 1), this._commandService.executeCommand(bt.id, {
3238
+ return n < 0 ? n = 0 : n > this._workbook.getSheets().length - 1 && (n = this._workbook.getSheets().length - 1), this._commandService.syncExecuteCommand(yt.id, {
3101
3239
  unitId: e.getWorkbook().getUnitId(),
3102
3240
  order: n,
3103
3241
  subUnitId: e.getSheetId()
3104
- });
3242
+ }), this;
3105
3243
  }
3106
3244
  /**
3107
3245
  * Move the active sheet to the specified index.
3108
3246
  * @param {number} index The index to move the active sheet to
3109
- * @returns {Promise<boolean>} true if the sheet was moved, false otherwise
3247
+ * @returns {FWorkbook} This workbook, for chaining
3110
3248
  * @example
3111
3249
  * ```ts
3112
3250
  * // The code below moves the active sheet to the specified index
@@ -3120,11 +3258,10 @@ let I = class extends p {
3120
3258
  }
3121
3259
  /**
3122
3260
  * Get the PermissionInstance.
3123
- *
3124
3261
  * @returns {FPermission} - The PermissionInstance.
3125
3262
  */
3126
3263
  getPermission() {
3127
- return this._injector.createInstance(O);
3264
+ return this._injector.createInstance(j);
3128
3265
  }
3129
3266
  /**
3130
3267
  * Get the defined name by name.
@@ -3139,7 +3276,7 @@ let I = class extends p {
3139
3276
  */
3140
3277
  getDefinedName(e) {
3141
3278
  const t = this._definedNamesService.getValueByName(this.id, e);
3142
- return t ? this._injector.createInstance(W, { ...t, unitId: this.id }) : null;
3279
+ return t ? this._injector.createInstance(T, { ...t, unitId: this.id }) : null;
3143
3280
  }
3144
3281
  /**
3145
3282
  * Get all the defined names in the workbook.
@@ -3153,12 +3290,13 @@ let I = class extends p {
3153
3290
  */
3154
3291
  getDefinedNames() {
3155
3292
  const e = this._definedNamesService.getDefinedNameMap(this.id);
3156
- return e ? Object.values(e).map((t) => this._injector.createInstance(W, { ...t, unitId: this.id })) : [];
3293
+ return e ? Object.values(e).map((t) => this._injector.createInstance(T, { ...t, unitId: this.id })) : [];
3157
3294
  }
3158
3295
  /**
3159
3296
  * Insert a defined name.
3160
3297
  * @param {string} name The name of the defined name to insert
3161
3298
  * @param {string} formulaOrRefString The formula(=sum(A2:b10)) or reference(A1) string of the defined name to insert
3299
+ * @returns {FWorkbook} The current FWorkbook instance
3162
3300
  * @example
3163
3301
  * ```ts
3164
3302
  * // The code below inserts a defined name
@@ -3167,8 +3305,8 @@ let I = class extends p {
3167
3305
  * ```
3168
3306
  */
3169
3307
  insertDefinedName(e, t) {
3170
- const s = this._injector.createInstance(A).setName(e).setRef(t).build();
3171
- s.localSheetId = K, this.insertDefinedNameBuilder(s);
3308
+ const s = this._injector.createInstance(F).setName(e).setRef(t).build();
3309
+ return s.localSheetId = q, this.insertDefinedNameBuilder(s), this;
3172
3310
  }
3173
3311
  /**
3174
3312
  * Delete the defined name with the given name.
@@ -3186,7 +3324,7 @@ let I = class extends p {
3186
3324
  return t ? (t.delete(), !0) : !1;
3187
3325
  }
3188
3326
  /**
3189
- * insert a defined name by builder param
3327
+ * Insert a defined name by builder param.
3190
3328
  * @param {ISetDefinedNameMutationParam} param The param to insert the defined name
3191
3329
  * @example
3192
3330
  * ```ts
@@ -3198,7 +3336,7 @@ let I = class extends p {
3198
3336
  * ```
3199
3337
  */
3200
3338
  insertDefinedNameBuilder(e) {
3201
- e.unitId = this.getId(), this._commandService.syncExecuteCommand(q.id, e);
3339
+ e.unitId = this.getId(), this._commandService.syncExecuteCommand(G.id, e);
3202
3340
  }
3203
3341
  /**
3204
3342
  * Update the defined name with the given name.
@@ -3210,70 +3348,182 @@ let I = class extends p {
3210
3348
  * const builder = activeSpreadsheet.getDefinedName('MyDefinedName').toBuilder();
3211
3349
  * builder.setRef('Sheet1!A2').setName('MyDefinedName1').build();
3212
3350
  * activeSpreadsheet.updateDefinedNameBuilder(param);
3213
- *
3214
3351
  * ```
3215
3352
  */
3216
3353
  updateDefinedNameBuilder(e) {
3217
- this._commandService.syncExecuteCommand(q.id, e);
3354
+ this._commandService.syncExecuteCommand(G.id, e);
3355
+ }
3356
+ /**
3357
+ * Gets the registered range themes.
3358
+ * @returns {string[]} The name list of registered range themes.
3359
+ * @example
3360
+ * ```ts
3361
+ * // The code below gets the registered range themes
3362
+ * const activeSpreadsheet = univerAPI.getActiveWorkbook();
3363
+ * const themes = activeSpreadsheet.getRegisteredRangeThemes();
3364
+ * console.log(themes);
3365
+ * ```
3366
+ */
3367
+ getRegisteredRangeThemes() {
3368
+ return this._injector.get(Ee).getRegisteredRangeThemes();
3369
+ }
3370
+ /**
3371
+ * Register a custom range theme style.
3372
+ * @param rangeThemeStyle
3373
+ * @example
3374
+ * ```ts
3375
+ * // import {RangeThemeStyle} from '@univerjs/sheets';
3376
+ * const fWorkbook = univerAPI.getActiveWorkbook();
3377
+ * const rangeThemeStyle = new RangeThemeStyle('MyTheme');
3378
+ * rangeThemeStyle.setSecondRowStyle({
3379
+ * bg: {
3380
+ * rgb: 'rgb(214,231,241)',
3381
+ * },
3382
+ * });
3383
+ * fWorkbook.registerRangeTheme(rangeThemeStyle);
3384
+ * ```
3385
+ */
3386
+ registerRangeTheme(e) {
3387
+ this._commandService.syncExecuteCommand(Pt.id, {
3388
+ unitId: this.getId(),
3389
+ rangeThemeStyle: e
3390
+ });
3391
+ }
3392
+ /**
3393
+ * Unregister a custom range theme style.
3394
+ * @param themeName
3395
+ * @example
3396
+ * ```ts
3397
+ * const fWorkbook = univerAPI.getActiveWorkbook();
3398
+ * fWorkbook.unregisterRangeTheme('MyTheme');
3399
+ * ```
3400
+ */
3401
+ unregisterRangeTheme(e) {
3402
+ this._commandService.syncExecuteCommand(Ut.id, {
3403
+ unitId: this.getId(),
3404
+ themeName: e
3405
+ });
3218
3406
  }
3219
3407
  };
3220
- I = Yt([
3221
- k(1, m(v)),
3222
- k(2, m(Oe)),
3223
- k(3, m(Ne)),
3224
- k(4, fe),
3225
- k(5, l),
3226
- k(6, Q),
3227
- k(7, Ce),
3228
- k(8, m(ke)),
3229
- k(9, Re)
3408
+ I = nn([
3409
+ S(1, m(v)),
3410
+ S(2, m(Oe)),
3411
+ S(3, m(Ne)),
3412
+ S(4, ve),
3413
+ S(5, l),
3414
+ S(6, J),
3415
+ S(7, Ie),
3416
+ S(8, m(Se)),
3417
+ S(9, De)
3230
3418
  ], I);
3231
- class Jt extends ve {
3419
+ class sn extends Re {
3420
+ _initialize(e) {
3421
+ const t = e.get(l);
3422
+ this.disposeWithMe(
3423
+ t.beforeCommandExecuted((n) => {
3424
+ var s;
3425
+ switch (n.id) {
3426
+ case U.id: {
3427
+ const r = n.params, { unitId: i, index: a, sheet: h } = r || {}, c = i ? this.getUniverSheet(i) : (s = this.getActiveWorkbook) == null ? void 0 : s.call(this);
3428
+ if (!c)
3429
+ return;
3430
+ const d = {
3431
+ workbook: c,
3432
+ index: a,
3433
+ sheet: h
3434
+ };
3435
+ if (this.fireEvent(
3436
+ this.Event.BeforeSheetCreate,
3437
+ d
3438
+ ), d.cancel)
3439
+ throw new Error("Sheet create canceled by facade api.");
3440
+ break;
3441
+ }
3442
+ }
3443
+ })
3444
+ ), this.disposeWithMe(
3445
+ t.onCommandExecuted((n) => {
3446
+ var s;
3447
+ switch (n.id) {
3448
+ case U.id: {
3449
+ const r = n.params, { unitId: i } = r || {}, a = i ? this.getUniverSheet(i) : (s = this.getActiveWorkbook) == null ? void 0 : s.call(this);
3450
+ if (!a)
3451
+ return;
3452
+ const h = a.getActiveSheet();
3453
+ if (!h)
3454
+ return;
3455
+ const c = {
3456
+ workbook: a,
3457
+ worksheet: h
3458
+ };
3459
+ this.fireEvent(
3460
+ this.Event.SheetCreated,
3461
+ c
3462
+ );
3463
+ break;
3464
+ }
3465
+ }
3466
+ })
3467
+ );
3468
+ }
3232
3469
  createUniverSheet(e) {
3233
- const n = this._injector.get(fe).createUnit(U.UNIVER_SHEET, e);
3470
+ const n = this._injector.get(ve).createUnit(P.UNIVER_SHEET, e);
3234
3471
  return this._injector.createInstance(I, n);
3235
3472
  }
3236
- getActiveWorkbook() {
3237
- const e = this._univerInstanceService.getCurrentUnitForType(U.UNIVER_SHEET);
3473
+ getActiveUniverSheet() {
3474
+ const e = this._univerInstanceService.getCurrentUnitForType(P.UNIVER_SHEET);
3238
3475
  return e ? this._injector.createInstance(I, e) : null;
3239
3476
  }
3477
+ getActiveWorkbook() {
3478
+ return this.getActiveUniverSheet();
3479
+ }
3240
3480
  getUniverSheet(e) {
3241
- const t = this._univerInstanceService.getUnit(e, U.UNIVER_SHEET);
3481
+ const t = this._univerInstanceService.getUnit(e, P.UNIVER_SHEET);
3242
3482
  return t ? this._injector.createInstance(I, t) : null;
3243
3483
  }
3244
3484
  getPermission() {
3245
- return this._injector.createInstance(O);
3485
+ return this._injector.createInstance(j);
3246
3486
  }
3247
3487
  onUniverSheetCreated(e) {
3248
- const t = this._univerInstanceService.getTypeOfUnitAdded$(U.UNIVER_SHEET).subscribe((n) => {
3488
+ const t = this._univerInstanceService.getTypeOfUnitAdded$(P.UNIVER_SHEET).subscribe((n) => {
3249
3489
  const s = this._injector.createInstance(I, n);
3250
3490
  e(s);
3251
3491
  });
3252
- return Ie(t);
3492
+ return fe(t);
3253
3493
  }
3254
3494
  newDefinedName() {
3255
- return this._injector.createInstance(A);
3495
+ return this._injector.createInstance(F);
3256
3496
  }
3257
3497
  }
3258
- ve.extend(Jt);
3259
- var Qt = Object.defineProperty, Xt = Object.getOwnPropertyDescriptor, Zt = (o, e, t, n) => {
3260
- for (var s = n > 1 ? void 0 : n ? Xt(e, t) : e, r = o.length - 1, i; r >= 0; r--)
3498
+ Re.extend(sn);
3499
+ class on extends be {
3500
+ get SheetCreated() {
3501
+ return "SheetCreated";
3502
+ }
3503
+ get BeforeSheetCreate() {
3504
+ return "BeforeSheetCreate";
3505
+ }
3506
+ }
3507
+ be.extend(on);
3508
+ var rn = Object.defineProperty, an = Object.getOwnPropertyDescriptor, hn = (o, e, t, n) => {
3509
+ for (var s = n > 1 ? void 0 : n ? an(e, t) : e, r = o.length - 1, i; r >= 0; r--)
3261
3510
  (i = o[r]) && (s = (n ? i(e, t, s) : i(s)) || s);
3262
- return n && s && Qt(e, t, s), s;
3263
- }, en = (o, e) => (t, n) => e(t, n, o);
3264
- let _e = class extends p {
3511
+ return n && s && rn(e, t, s), s;
3512
+ }, cn = (o, e) => (t, n) => e(t, n, o);
3513
+ let we = class extends Q {
3265
3514
  constructor(o) {
3266
3515
  super(), this._injector = o;
3267
3516
  }
3268
3517
  };
3269
- _e = Zt([
3270
- en(0, m(v))
3271
- ], _e);
3518
+ we = hn([
3519
+ cn(0, m(v))
3520
+ ], we);
3272
3521
  export {
3273
- O as FPermission,
3274
- S as FRange,
3275
- F as FSelection,
3276
- _e as FSheetHooks,
3522
+ j as FPermission,
3523
+ w as FRange,
3524
+ A as FSelection,
3525
+ on as FSheetEventName,
3526
+ we as FSheetHooks,
3277
3527
  I as FWorkbook,
3278
- _ as FWorksheet
3528
+ g as FWorksheet
3279
3529
  };