@univerjs/sheets 0.6.9 → 0.6.10-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/facade.js CHANGED
@@ -1,9 +1,9 @@
1
1
  var Ze = Object.defineProperty;
2
2
  var et = (r, e, t) => e in r ? Ze(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
3
  var E = (r, e, t) => et(r, typeof e != "symbol" ? e + "" : e, t);
4
- import { Inject as u, Injector as x, ICommandService as g, IPermissionService as ue, IAuthzIoService as Be, LocaleService as Ve, generateRandomId as Fe, Rectangle as N, RANGE_TYPE as w, isFormulaString as tt, isCellV as nt, isICellData as rt, HorizontalAlign as T, VerticalAlign as A, ObjectMatrix as V, Tools as st, TextStyleValue as we, RichTextValue as P, BooleanNumber as l, WrapStrategy as G, DEFAULT_STYLES as ke, Dimension as M, isNullCell as D, ILogService as He, Direction as j, IResourceLoaderService as ot, IUniverInstanceService as re, mergeWorksheetSnapshotWithDefault as it, UndoCommand as at, RedoCommand as ht, toDisposable as Oe, UniverInstanceType as U, CanceledError as v } from "@univerjs/core";
4
+ import { Inject as u, Injector as x, ICommandService as g, IPermissionService as ue, IAuthzIoService as Be, LocaleService as Ve, generateRandomId as Fe, Rectangle as N, RANGE_TYPE as w, isFormulaString as tt, isCellV as nt, isICellData as rt, HorizontalAlign as T, VerticalAlign as A, ObjectMatrix as V, Tools as st, TextStyleValue as we, RichTextValue as P, BooleanNumber as l, WrapStrategy as $, DEFAULT_STYLES as ke, Dimension as M, isNullCell as D, ILogService as He, Direction as L, IResourceLoaderService as ot, IUniverInstanceService as se, mergeWorksheetSnapshotWithDefault as it, UndoCommand as at, RedoCommand as ht, toDisposable as Oe, UniverInstanceType as U, CanceledError as v } from "@univerjs/core";
5
5
  import { FBase as le, FBaseInitialable as ge, FUniver as je, FEnum as dt, FEventName as ct } from "@univerjs/core/facade";
6
- import { WorksheetProtectionRuleModel as Le, RangeProtectionRuleModel as ze, WorksheetProtectionPointModel as Ge, SetDefinedNameCommand as se, SCOPE_WORKBOOK_VALUE_DEFINED_NAME as oe, RemoveDefinedNameCommand as ut, PermissionPointsDefinitions as lt, WorkbookEditablePermission as $e, UnitObject as W, AddWorksheetProtectionMutation as gt, DeleteWorksheetProtectionMutation as mt, getAllWorksheetPermissionPoint as _t, getAllWorksheetPermissionPointByPointPanel as Se, SetWorksheetPermissionPointsMutation as wt, AddRangeProtectionMutation as kt, DeleteRangeProtectionMutation as St, SetRangeProtectionMutation as Ct, WorksheetEditPermission as ft, WorksheetViewPermission as vt, SetBorderBasicCommand as It, SetStyleCommand as b, SetTextRotationCommand as Rt, SetRangeValuesCommand as B, SetTextWrapCommand as ie, SetVerticalTextAlignCommand as bt, SetHorizontalTextAlignCommand as pt, addMergeCellsUtil as Q, getAddMergeMutationRangeByType as Ce, RemoveWorksheetMergeCommand as Et, getPrimaryForRange as $, SetSelectionsOperation as me, SplitTextToColumnsCommand as yt, SetWorksheetRangeThemeStyleCommand as Ut, DeleteWorksheetRangeThemeStyleCommand as xt, SheetRangeThemeService as qe, ClearSelectionAllCommand as Ke, ClearSelectionContentCommand as Ye, ClearSelectionFormatCommand as Je, InsertRangeMoveDownCommand as Pt, InsertRangeMoveRightCommand as Mt, DeleteRangeMoveUpCommand as Nt, DeleteRangeMoveLeftCommand as Tt, getNextPrimaryCell as At, SheetsSelectionsService as Qe, SetWorksheetDefaultStyleMutation as Dt, SetColDataCommand as fe, SetRowDataCommand as ve, copyRangeStyles as L, InsertRowByRangeCommand as Ie, RemoveRowByRangeCommand as Wt, MoveRowsCommand as Bt, SetRowHiddenCommand as Re, SetSpecificRowsVisibleCommand as be, SetWorksheetRowIsAutoHeightMutation as Vt, SetRowHeightCommand as pe, SetWorksheetRowIsAutoHeightCommand as X, InsertColByRangeCommand as Ee, RemoveColByRangeCommand as Ft, MoveColsCommand as Ht, SetColHiddenCommand as ye, SetSpecificColsVisibleCommand as Ue, SetColWidthCommand as Ot, SetFrozenCommand as Z, CancelFrozenCommand as jt, ToggleGridlinesCommand as ae, SetGridlinesColorCommand as he, SetTabColorCommand as Lt, SetRangeValuesMutation as xe, SetWorksheetHideCommand as zt, SetWorksheetShowCommand as Gt, SetWorksheetNameCommand as de, AppendRowCommand as $t, InsertSheetCommand as F, SetWorksheetActiveOperation as H, RemoveSheetCommand as ce, CopySheetCommand as qt, SetWorksheetOrderCommand as Kt, RegisterWorksheetRangeThemeStyleCommand as Yt, UnregisterWorksheetRangeThemeStyleCommand as Jt, RangeThemeStyle as Qt, SetWorksheetOrderMutation as Pe, SetTabColorMutation as Me, SetWorksheetHideMutation as Ne, COMMAND_LISTENER_VALUE_CHANGE as Xt, getValueChangedEffectedRange as Zt, SheetValueChangeType as en, SheetSkeletonChangeType as tn, SplitDelimiterEnum as nn } from "@univerjs/sheets";
6
+ import { WorksheetProtectionRuleModel as Le, RangeProtectionRuleModel as ze, WorksheetProtectionPointModel as Ge, SCOPE_WORKBOOK_VALUE_DEFINED_NAME as O, SetDefinedNameCommand as oe, RemoveDefinedNameCommand as ut, PermissionPointsDefinitions as lt, WorkbookEditablePermission as $e, UnitObject as W, AddWorksheetProtectionMutation as gt, DeleteWorksheetProtectionMutation as mt, getAllWorksheetPermissionPoint as _t, getAllWorksheetPermissionPointByPointPanel as Se, SetWorksheetPermissionPointsMutation as wt, AddRangeProtectionMutation as kt, DeleteRangeProtectionMutation as St, SetRangeProtectionMutation as Ct, WorksheetEditPermission as ft, WorksheetViewPermission as vt, SetBorderBasicCommand as It, SetStyleCommand as b, SetTextRotationCommand as Rt, SetRangeValuesCommand as B, SetTextWrapCommand as ie, SetVerticalTextAlignCommand as bt, SetHorizontalTextAlignCommand as pt, addMergeCellsUtil as X, getAddMergeMutationRangeByType as Ce, RemoveWorksheetMergeCommand as Et, getPrimaryForRange as q, SetSelectionsOperation as me, SplitTextToColumnsCommand as yt, SetWorksheetRangeThemeStyleCommand as Ut, DeleteWorksheetRangeThemeStyleCommand as xt, SheetRangeThemeService as qe, ClearSelectionAllCommand as Ke, ClearSelectionContentCommand as Ye, ClearSelectionFormatCommand as Je, InsertRangeMoveDownCommand as Pt, InsertRangeMoveRightCommand as Mt, DeleteRangeMoveUpCommand as Nt, DeleteRangeMoveLeftCommand as Tt, getNextPrimaryCell as At, SheetsSelectionsService as Qe, SetWorksheetDefaultStyleMutation as Dt, SetColDataCommand as fe, SetRowDataCommand as ve, copyRangeStyles as z, InsertRowByRangeCommand as Ie, RemoveRowByRangeCommand as Wt, MoveRowsCommand as Bt, SetRowHiddenCommand as Re, SetSpecificRowsVisibleCommand as be, SetWorksheetRowIsAutoHeightMutation as Vt, SetRowHeightCommand as pe, SetWorksheetRowIsAutoHeightCommand as Z, InsertColByRangeCommand as Ee, RemoveColByRangeCommand as Ft, MoveColsCommand as Ht, SetColHiddenCommand as ye, SetSpecificColsVisibleCommand as Ue, SetColWidthCommand as Ot, SetFrozenCommand as ee, CancelFrozenCommand as jt, ToggleGridlinesCommand as ae, SetGridlinesColorCommand as he, SetTabColorCommand as Lt, SetRangeValuesMutation as xe, SetWorksheetHideCommand as zt, SetWorksheetShowCommand as Gt, SetWorksheetNameCommand as de, AppendRowCommand as $t, InsertSheetCommand as F, SetWorksheetActiveOperation as H, RemoveSheetCommand as ce, CopySheetCommand as qt, SetWorksheetOrderCommand as Kt, RegisterWorksheetRangeThemeStyleCommand as Yt, UnregisterWorksheetRangeThemeStyleCommand as Jt, RangeThemeStyle as Qt, SetWorksheetOrderMutation as Pe, SetTabColorMutation as Me, SetWorksheetHideMutation as Ne, COMMAND_LISTENER_VALUE_CHANGE as Xt, getValueChangedEffectedRange as Zt, SheetValueChangeType as en, SheetSkeletonChangeType as tn, SplitDelimiterEnum as nn } from "@univerjs/sheets";
7
7
  import { IDefinedNamesService as Xe, serializeRange as _e, FormulaDataModel as rn, serializeRangeWithSheet as sn, deserializeRangeWithSheet as on } from "@univerjs/engine-formula";
8
8
  var an = Object.getOwnPropertyDescriptor, hn = (r, e, t, n) => {
9
9
  for (var s = n > 1 ? void 0 : n ? an(e, t) : e, o = r.length - 1, i; o >= 0; o--)
@@ -25,14 +25,15 @@ function dn(r, e, t) {
25
25
  a++;
26
26
  }
27
27
  }
28
- class J {
28
+ class Q {
29
29
  constructor() {
30
30
  E(this, "_definedNameParam");
31
31
  this._definedNameParam = {
32
32
  id: Fe(10),
33
33
  unitId: "",
34
34
  name: "",
35
- formulaOrRefString: ""
35
+ formulaOrRefString: "",
36
+ localSheetId: O
36
37
  };
37
38
  }
38
39
  /**
@@ -41,11 +42,12 @@ class J {
41
42
  * @returns {FDefinedNameBuilder} The instance of `FDefinedNameBuilder` for method chaining.
42
43
  * @example
43
44
  * ```ts
44
- * const workbook = univerAPI.getActiveWorkbook();
45
+ * const fWorkbook = univerAPI.getActiveWorkbook();
45
46
  * const definedNameBuilder = univerAPI.newDefinedName()
46
47
  * .setName('MyDefinedName')
48
+ * .setRef('Sheet1!$A$1')
47
49
  * .build();
48
- * workbook.insertDefinedNameBuilder(definedNameBuilder);
50
+ * fWorkbook.insertDefinedNameBuilder(definedNameBuilder);
49
51
  * ```
50
52
  */
51
53
  setName(e) {
@@ -57,12 +59,12 @@ class J {
57
59
  * @returns {FDefinedNameBuilder} The instance of `FDefinedNameBuilder` for method chaining.
58
60
  * @example
59
61
  * ```ts
60
- * const workbook = univerAPI.getActiveWorkbook();
62
+ * const fWorkbook = univerAPI.getActiveWorkbook();
61
63
  * const definedNameBuilder = univerAPI.newDefinedName()
62
- * .setFormula('SUM(Sheet1!$A$1)')
63
64
  * .setName('MyDefinedName')
65
+ * .setFormula('SUM(Sheet1!$A$1)')
64
66
  * .build();
65
- * workbook.insertDefinedNameBuilder(definedNameBuilder);
67
+ * fWorkbook.insertDefinedNameBuilder(definedNameBuilder);
66
68
  * ```
67
69
  */
68
70
  setFormula(e) {
@@ -74,11 +76,12 @@ class J {
74
76
  * @returns {FDefinedNameBuilder} The instance of `FDefinedNameBuilder` for method chaining.
75
77
  * @example
76
78
  * ```ts
77
- * const workbook = univerAPI.getActiveWorkbook();
79
+ * const fWorkbook = univerAPI.getActiveWorkbook();
78
80
  * const definedNameBuilder = univerAPI.newDefinedName()
81
+ * .setName('MyDefinedName')
79
82
  * .setRef('Sheet1!$A$1')
80
83
  * .build();
81
- * workbook.insertDefinedNameBuilder(definedNameBuilder);
84
+ * fWorkbook.insertDefinedNameBuilder(definedNameBuilder);
82
85
  * ```
83
86
  */
84
87
  setRef(e) {
@@ -86,18 +89,19 @@ class J {
86
89
  }
87
90
  /**
88
91
  * Sets the reference of the defined name builder by range .
89
- * @param {number} row The start row of the range.
90
- * @param {number} column The start column of the range.
92
+ * @param {number} row The start row index of the range. index start at 0.
93
+ * @param {number} column The start column index of the range. index start at 0.
91
94
  * @param {number} numRows The number of rows in the range.
92
95
  * @param {number} numColumns The number of columns in the range.
93
96
  * @returns {FDefinedNameBuilder} The instance of `FDefinedNameBuilder` for method chaining.
94
97
  * @example
95
98
  * ```ts
96
- * const workbook = univerAPI.getActiveWorkbook();
99
+ * const fWorkbook = univerAPI.getActiveWorkbook();
97
100
  * const definedNameBuilder = univerAPI.newDefinedName()
98
- * .setRefByRange(1, 3, 2, 5)
101
+ * .setName('MyDefinedName')
102
+ * .setRefByRange(1, 3, 2, 5) // D2:H3
99
103
  * .build();
100
- * workbook.insertDefinedNameBuilder(definedNameBuilder);
104
+ * fWorkbook.insertDefinedNameBuilder(definedNameBuilder);
101
105
  * ```
102
106
  */
103
107
  setRefByRange(e, t, n, s) {
@@ -114,27 +118,71 @@ class J {
114
118
  * @returns {FDefinedNameBuilder} The instance of `FDefinedNameBuilder` for method chaining.
115
119
  * @example
116
120
  * ```ts
117
- * const workbook = univerAPI.getActiveWorkbook();
121
+ * const fWorkbook = univerAPI.getActiveWorkbook();
118
122
  * const definedNameBuilder = univerAPI.newDefinedName()
119
- * .setComment('This is a comment')
123
+ * .setName('MyDefinedName')
124
+ * .setRef('Sheet1!$A$1')
125
+ * .setComment('A reference to A1 cell in Sheet1')
120
126
  * .build();
121
- * workbook.insertDefinedNameBuilder(definedNameBuilder);
127
+ * fWorkbook.insertDefinedNameBuilder(definedNameBuilder);
122
128
  * ```
123
129
  */
124
130
  setComment(e) {
125
131
  return this._definedNameParam.comment = e, this;
126
132
  }
133
+ /**
134
+ * Sets the scope of the defined name to the worksheet.
135
+ * @param {FWorksheet} worksheet The worksheet to set the scope to.
136
+ * @returns {FDefinedNameBuilder} The instance of `FDefinedNameBuilder` for method chaining.
137
+ * @example
138
+ * ```ts
139
+ * const fWorkbook = univerAPI.getActiveWorkbook();
140
+ * const sheets = fWorkbook.getSheets();
141
+ *
142
+ * // Create a defined name and make it available only in the second worksheet
143
+ * const definedNameBuilder = univerAPI.newDefinedName()
144
+ * .setName('MyDefinedName')
145
+ * .setRef('Sheet1!$A$1')
146
+ * .setScopeToWorksheet(sheets[1])
147
+ * .build();
148
+ * fWorkbook.insertDefinedNameBuilder(definedNameBuilder);
149
+ * ```
150
+ */
151
+ setScopeToWorksheet(e) {
152
+ return this._definedNameParam.localSheetId = e.getSheetId(), this;
153
+ }
154
+ /**
155
+ * Sets the scope of the defined name to the workbook.
156
+ * @returns {FDefinedNameBuilder} The instance of `FDefinedNameBuilder` for method chaining.
157
+ * @example
158
+ * ```ts
159
+ * const fWorkbook = univerAPI.getActiveWorkbook();
160
+ *
161
+ * // Create a defined name and make it available in the entire workbook
162
+ * const definedNameBuilder = univerAPI.newDefinedName()
163
+ * .setName('MyDefinedName')
164
+ * .setRef('Sheet1!$A$1')
165
+ * .setScopeToWorkbook()
166
+ * .build();
167
+ * fWorkbook.insertDefinedNameBuilder(definedNameBuilder);
168
+ * ```
169
+ */
170
+ setScopeToWorkbook() {
171
+ return this._definedNameParam.localSheetId = O, this;
172
+ }
127
173
  /**
128
174
  * Sets the hidden status of the defined name builder.
129
175
  * @param {boolean} hidden The hidden status of the defined name.
130
176
  * @returns {FDefinedNameBuilder} The instance of `FDefinedNameBuilder` for method chaining.
131
177
  * @example
132
178
  * ```ts
133
- * const workbook = univerAPI.getActiveWorkbook();
179
+ * const fWorkbook = univerAPI.getActiveWorkbook();
134
180
  * const definedNameBuilder = univerAPI.newDefinedName()
181
+ * .setName('MyDefinedName')
182
+ * .setRef('Sheet1!$A$1')
135
183
  * .setHidden(true)
136
184
  * .build();
137
- * workbook.insertDefinedNameBuilder(definedNameBuilder);
185
+ * fWorkbook.insertDefinedNameBuilder(definedNameBuilder);
138
186
  * ```
139
187
  */
140
188
  setHidden(e) {
@@ -145,13 +193,13 @@ class J {
145
193
  * @returns {ISetDefinedNameMutationParam} The defined name mutation parameter.
146
194
  * @example
147
195
  * ```ts
148
- * const workbook = univerAPI.getActiveWorkbook();
196
+ * const fWorkbook = univerAPI.getActiveWorkbook();
149
197
  * const definedNameBuilder = univerAPI.newDefinedName()
150
- * .setRef('Sheet1!$A$1')
151
198
  * .setName('MyDefinedName')
152
- * .setComment('This is a comment')
199
+ * .setRef('Sheet1!$A$1')
200
+ * .setComment('A reference to A1 cell in Sheet1')
153
201
  * .build();
154
- * workbook.insertDefinedNameBuilder(definedNameBuilder);
202
+ * fWorkbook.insertDefinedNameBuilder(definedNameBuilder);
155
203
  * ```
156
204
  */
157
205
  build() {
@@ -163,37 +211,37 @@ class J {
163
211
  * @returns {FDefinedNameBuilder} The instance of `FDefinedNameBuilder` for method chaining.
164
212
  * @example
165
213
  * ```ts
166
- * const workbook = univerAPI.getActiveWorkbook();
214
+ * const fWorkbook = univerAPI.getActiveWorkbook();
167
215
  * const definedNameParam = {
168
216
  * id: '4TMPceoqg8',
169
- * unitId: workbook.getId(),
217
+ * unitId: fWorkbook.getId(),
170
218
  * name: 'MyDefinedName',
171
219
  * formulaOrRefString: 'Sheet1!$A$1',
172
220
  * }
173
221
  * const definedNameBuilder = univerAPI.newDefinedName()
174
222
  * .load(definedNameParam)
175
223
  * .build();
176
- * workbook.insertDefinedNameBuilder(definedNameBuilder);
224
+ * fWorkbook.insertDefinedNameBuilder(definedNameBuilder);
177
225
  * ```
178
226
  */
179
227
  load(e) {
180
228
  return this._definedNameParam = e, this;
181
229
  }
182
230
  }
183
- let q = class extends le {
231
+ let K = class extends le {
184
232
  constructor(r, e, t, n, s, o, i, a, h, d) {
185
233
  super(), this._definedNameParam = r, this._injector = e, this._commandService = t, this._permissionService = n, this._worksheetProtectionRuleModel = s, this._rangeProtectionRuleModel = o, this._worksheetProtectionPointRuleModel = i, this._authzIoService = a, this._localeService = h, this._definedNamesService = d;
186
234
  }
187
235
  _apply() {
188
- this._definedNameParam.name === "" && (this._definedNameParam.name = dn(this._definedNameParam.unitId, this._localeService, this._definedNamesService)), this._commandService.syncExecuteCommand(se.id, this._definedNameParam);
236
+ this._definedNameParam.name === "" && (this._definedNameParam.name = dn(this._definedNameParam.unitId, this._localeService, this._definedNamesService)), this._commandService.syncExecuteCommand(oe.id, this._definedNameParam);
189
237
  }
190
238
  /**
191
239
  * Gets the name of the defined name.
192
240
  * @returns {string} The name of the defined name.
193
241
  * @example
194
242
  * ```ts
195
- * const workbook = univerAPI.getActiveWorkbook();
196
- * const definedName = workbook.getDefinedNames()[0];
243
+ * const fWorkbook = univerAPI.getActiveWorkbook();
244
+ * const definedName = fWorkbook.getDefinedNames()[0];
197
245
  * console.log(definedName?.getName());
198
246
  * ```
199
247
  */
@@ -205,8 +253,8 @@ let q = class extends le {
205
253
  * @param {string} name The name of the defined name.
206
254
  * @example
207
255
  * ```ts
208
- * const workbook = univerAPI.getActiveWorkbook();
209
- * const definedName = workbook.getDefinedNames()[0];
256
+ * const fWorkbook = univerAPI.getActiveWorkbook();
257
+ * const definedName = fWorkbook.getDefinedNames()[0];
210
258
  * definedName?.setName('NewDefinedName');
211
259
  * ```
212
260
  */
@@ -218,8 +266,8 @@ let q = class extends le {
218
266
  * @param {string} formula The formula of the defined name.
219
267
  * @example
220
268
  * ```ts
221
- * const workbook = univerAPI.getActiveWorkbook();
222
- * const definedName = workbook.getDefinedNames()[0];
269
+ * const fWorkbook = univerAPI.getActiveWorkbook();
270
+ * const definedName = fWorkbook.getDefinedNames()[0];
223
271
  * definedName?.setFormula('SUM(Sheet1!$A$1)');
224
272
  * ```
225
273
  */
@@ -231,8 +279,8 @@ let q = class extends le {
231
279
  * @param {string} refString The reference of the defined name.
232
280
  * @example
233
281
  * ```ts
234
- * const workbook = univerAPI.getActiveWorkbook();
235
- * const definedName = workbook.getDefinedNames()[0];
282
+ * const fWorkbook = univerAPI.getActiveWorkbook();
283
+ * const definedName = fWorkbook.getDefinedNames()[0];
236
284
  * definedName?.setRef('Sheet1!$A$1');
237
285
  * ```
238
286
  */
@@ -244,8 +292,8 @@ let q = class extends le {
244
292
  * @returns {string} The formula or reference string of the defined name.
245
293
  * @example
246
294
  * ```ts
247
- * const workbook = univerAPI.getActiveWorkbook();
248
- * const definedName = workbook.getDefinedNames()[0];
295
+ * const fWorkbook = univerAPI.getActiveWorkbook();
296
+ * const definedName = fWorkbook.getDefinedNames()[0];
249
297
  * console.log(definedName?.getFormulaOrRefString());
250
298
  * ```
251
299
  */
@@ -260,9 +308,9 @@ let q = class extends le {
260
308
  * @param {number} numColumns The number of columns in the range.
261
309
  * @example
262
310
  * ```ts
263
- * const workbook = univerAPI.getActiveWorkbook();
264
- * const definedName = workbook.getDefinedNames()[0];
265
- * definedName?.setRefByRange(1, 3, 2, 5);
311
+ * const fWorkbook = univerAPI.getActiveWorkbook();
312
+ * const definedName = fWorkbook.getDefinedNames()[0];
313
+ * definedName?.setRefByRange(1, 3, 2, 5); // D2:H3
266
314
  * ```
267
315
  */
268
316
  setRefByRange(r, e, t, n) {
@@ -278,8 +326,8 @@ let q = class extends le {
278
326
  * @returns {string | undefined} The comment of the defined name.
279
327
  * @example
280
328
  * ```ts
281
- * const workbook = univerAPI.getActiveWorkbook();
282
- * const definedName = workbook.getDefinedNames()[0];
329
+ * const fWorkbook = univerAPI.getActiveWorkbook();
330
+ * const definedName = fWorkbook.getDefinedNames()[0];
283
331
  * console.log(definedName?.getComment());
284
332
  * ```
285
333
  */
@@ -291,8 +339,8 @@ let q = class extends le {
291
339
  * @param {string} comment The comment of the defined name.
292
340
  * @example
293
341
  * ```ts
294
- * const workbook = univerAPI.getActiveWorkbook();
295
- * const definedName = workbook.getDefinedNames()[0];
342
+ * const fWorkbook = univerAPI.getActiveWorkbook();
343
+ * const definedName = fWorkbook.getDefinedNames()[0];
296
344
  * definedName?.setComment('This is a comment');
297
345
  * ```
298
346
  */
@@ -304,10 +352,12 @@ let q = class extends le {
304
352
  * @param {FWorksheet} worksheet The worksheet to set the scope to.
305
353
  * @example
306
354
  * ```ts
307
- * const workbook = univerAPI.getActiveWorkbook();
308
- * const worksheet = workbook.getSheets()[0];
309
- * const definedName = workbook.getDefinedNames()[0];
310
- * definedName?.setScopeToWorksheet(worksheet);
355
+ * const fWorkbook = univerAPI.getActiveWorkbook();
356
+ * const sheets = fWorkbook.getSheets();
357
+ *
358
+ * // Get the first defined name and make it available only in the second worksheet
359
+ * const definedName = fWorkbook.getDefinedNames()[0];
360
+ * definedName?.setScopeToWorksheet(sheets[1]);
311
361
  * ```
312
362
  */
313
363
  setScopeToWorksheet(r) {
@@ -317,21 +367,21 @@ let q = class extends le {
317
367
  * Sets the scope of the defined name to the workbook.
318
368
  * @example
319
369
  * ```ts
320
- * const workbook = univerAPI.getActiveWorkbook();
321
- * const definedName = workbook.getDefinedNames()[0];
370
+ * const fWorkbook = univerAPI.getActiveWorkbook();
371
+ * const definedName = fWorkbook.getDefinedNames()[0];
322
372
  * definedName?.setScopeToWorkbook();
323
373
  * ```
324
374
  */
325
375
  setScopeToWorkbook() {
326
- this._definedNameParam.localSheetId = oe, this._apply();
376
+ this._definedNameParam.localSheetId = O, this._apply();
327
377
  }
328
378
  /**
329
379
  * Sets the hidden status of the defined name.
330
380
  * @param {boolean} hidden The hidden status of the defined name.
331
381
  * @example
332
382
  * ```ts
333
- * const workbook = univerAPI.getActiveWorkbook();
334
- * const definedName = workbook.getDefinedNames()[0];
383
+ * const fWorkbook = univerAPI.getActiveWorkbook();
384
+ * const definedName = fWorkbook.getDefinedNames()[0];
335
385
  * definedName?.setHidden(true);
336
386
  * ```
337
387
  */
@@ -342,8 +392,8 @@ let q = class extends le {
342
392
  * Deletes the defined name.
343
393
  * @example
344
394
  * ```ts
345
- * const workbook = univerAPI.getActiveWorkbook();
346
- * const definedName = workbook.getDefinedNames()[0];
395
+ * const fWorkbook = univerAPI.getActiveWorkbook();
396
+ * const definedName = fWorkbook.getDefinedNames()[0];
347
397
  * definedName?.delete();
348
398
  * ```
349
399
  */
@@ -355,8 +405,8 @@ let q = class extends le {
355
405
  * @returns {string | undefined} The local sheet id of the defined name.
356
406
  * @example
357
407
  * ```ts
358
- * const workbook = univerAPI.getActiveWorkbook();
359
- * const definedName = workbook.getDefinedNames()[0];
408
+ * const fWorkbook = univerAPI.getActiveWorkbook();
409
+ * const definedName = fWorkbook.getDefinedNames()[0];
360
410
  * console.log(definedName?.getLocalSheetId());
361
411
  * ```
362
412
  */
@@ -368,36 +418,36 @@ let q = class extends le {
368
418
  * @returns {boolean} True if the defined name is in the workbook scope, false otherwise.
369
419
  * @example
370
420
  * ```ts
371
- * const workbook = univerAPI.getActiveWorkbook();
372
- * const definedName = workbook.getDefinedNames()[0];
421
+ * const fWorkbook = univerAPI.getActiveWorkbook();
422
+ * const definedName = fWorkbook.getDefinedNames()[0];
373
423
  * console.log(definedName?.isWorkbookScope());
374
424
  * ```
375
425
  */
376
426
  isWorkbookScope() {
377
- return this._definedNameParam.localSheetId === oe;
427
+ return this._definedNameParam.localSheetId === O;
378
428
  }
379
429
  /**
380
430
  * Converts the defined name to a defined name builder.
381
431
  * @returns {FDefinedNameBuilder} The defined name builder.
382
432
  * @example
383
433
  * ```ts
384
- * const workbook = univerAPI.getActiveWorkbook();
385
- * const definedName = workbook.getDefinedNames()[0];
434
+ * const fWorkbook = univerAPI.getActiveWorkbook();
435
+ * const definedName = fWorkbook.getDefinedNames()[0];
386
436
  * if (!definedName) return;
387
437
  * const definedNameBuilder = definedName
388
438
  * .toBuilder()
389
439
  * .setName('NewDefinedName')
390
440
  * .setFormula('SUM(Sheet1!$A$1)')
391
441
  * .build();
392
- * workbook.updateDefinedNameBuilder(definedNameBuilder);
442
+ * fWorkbook.updateDefinedNameBuilder(definedNameBuilder);
393
443
  * ```
394
444
  */
395
445
  toBuilder() {
396
- const r = this._injector.createInstance(J);
446
+ const r = this._injector.createInstance(Q);
397
447
  return r.load(this._definedNameParam), r;
398
448
  }
399
449
  };
400
- q = hn([
450
+ K = hn([
401
451
  I(1, u(x)),
402
452
  I(2, g),
403
453
  I(3, ue),
@@ -407,13 +457,13 @@ q = hn([
407
457
  I(7, u(Be)),
408
458
  I(8, u(Ve)),
409
459
  I(9, Xe)
410
- ], q);
460
+ ], K);
411
461
  var cn = Object.getOwnPropertyDescriptor, un = (r, e, t, n) => {
412
462
  for (var s = n > 1 ? void 0 : n ? cn(e, t) : e, o = r.length - 1, i; o >= 0; o--)
413
463
  (i = r[o]) && (s = i(s) || s);
414
464
  return s;
415
465
  }, y = (r, e) => (t, n) => e(t, n, r);
416
- let K = class extends le {
466
+ let Y = class extends le {
417
467
  constructor(e, t, n, s, o, i, a) {
418
468
  super();
419
469
  /**
@@ -749,7 +799,7 @@ let K = class extends le {
749
799
  }
750
800
  }
751
801
  };
752
- K = un([
802
+ Y = un([
753
803
  y(0, u(x)),
754
804
  y(1, g),
755
805
  y(2, ue),
@@ -757,7 +807,7 @@ K = un([
757
807
  y(4, u(ze)),
758
808
  y(5, u(Ge)),
759
809
  y(6, u(Be))
760
- ], K);
810
+ ], Y);
761
811
  function ln(r) {
762
812
  switch (r) {
763
813
  case "left":
@@ -806,7 +856,7 @@ function Ae(r) {
806
856
  return "general";
807
857
  }
808
858
  }
809
- function O(r) {
859
+ function j(r) {
810
860
  return tt(r) ? {
811
861
  f: r,
812
862
  v: null,
@@ -822,14 +872,14 @@ function De(r, e) {
822
872
  if (st.isArray(r))
823
873
  for (let a = 0; a <= o - n; a++)
824
874
  for (let h = 0; h <= i - s; h++)
825
- t.setValue(a + n, h + s, O(r[a][h]));
875
+ t.setValue(a + n, h + s, j(r[a][h]));
826
876
  else
827
877
  new V(r).forValue((h, d, c) => {
828
- t.setValue(h, d, O(c));
878
+ t.setValue(h, d, j(c));
829
879
  });
830
880
  return t.getMatrix();
831
881
  }
832
- function ee(r, e) {
882
+ function te(r, e) {
833
883
  return {
834
884
  startRow: r.startRow,
835
885
  endRow: r.endRow,
@@ -838,7 +888,7 @@ function ee(r, e) {
838
888
  rangeType: w.ROW
839
889
  };
840
890
  }
841
- function te(r, e) {
891
+ function ne(r, e) {
842
892
  return {
843
893
  startRow: 0,
844
894
  endRow: e.getRowCount() - 1,
@@ -851,7 +901,7 @@ var mn = Object.getOwnPropertyDescriptor, _n = (r, e, t, n) => {
851
901
  for (var s = n > 1 ? void 0 : n ? mn(e, t) : e, o = r.length - 1, i; o >= 0; o--)
852
902
  (i = r[o]) && (s = i(s) || s);
853
903
  return s;
854
- }, ne = (r, e) => (t, n) => e(t, n, r);
904
+ }, re = (r, e) => (t, n) => e(t, n, r);
855
905
  let m = class extends ge {
856
906
  constructor(r, e, t, n, s, o) {
857
907
  super(n), this._workbook = r, this._worksheet = e, this._range = t, this._injector = n, this._commandService = s, this._formulaDataModel = o;
@@ -1484,7 +1534,7 @@ let m = class extends ge {
1484
1534
  const r = this.getCellDatas(), e = this._workbook.getStyles();
1485
1535
  return r.map((t) => t.map((n) => {
1486
1536
  var s;
1487
- return ((s = e.getStyleByCell(n)) == null ? void 0 : s.tb) === G.WRAP;
1537
+ return ((s = e.getStyleByCell(n)) == null ? void 0 : s.tb) === $.WRAP;
1488
1538
  }));
1489
1539
  }
1490
1540
  /**
@@ -1761,7 +1811,7 @@ let m = class extends ge {
1761
1811
  * ```
1762
1812
  */
1763
1813
  setValue(r) {
1764
- const e = O(r);
1814
+ const e = j(r);
1765
1815
  if (!e)
1766
1816
  throw new Error("Invalid value");
1767
1817
  return this._commandService.syncExecuteCommand(B.id, {
@@ -1786,7 +1836,7 @@ let m = class extends ge {
1786
1836
  * ```
1787
1837
  */
1788
1838
  setValueForCell(r) {
1789
- const e = O(r);
1839
+ const e = j(r);
1790
1840
  if (!e)
1791
1841
  throw new Error("Invalid value");
1792
1842
  return this._commandService.syncExecuteCommand(B.id, {
@@ -1886,7 +1936,7 @@ let m = class extends ge {
1886
1936
  unitId: this._workbook.getUnitId(),
1887
1937
  subUnitId: this._worksheet.getSheetId(),
1888
1938
  range: this._range,
1889
- value: r ? G.WRAP : G.UNSPECIFIED
1939
+ value: r ? $.WRAP : $.UNSPECIFIED
1890
1940
  }), this;
1891
1941
  }
1892
1942
  /**
@@ -2196,7 +2246,7 @@ let m = class extends ge {
2196
2246
  */
2197
2247
  merge(r = !0) {
2198
2248
  const e = this._workbook.getUnitId(), t = this._worksheet.getSheetId();
2199
- return Q(this._injector, e, t, [this._range], r), this;
2249
+ return X(this._injector, e, t, [this._range], r), this;
2200
2250
  }
2201
2251
  /**
2202
2252
  * Merges cells in a range horizontally.
@@ -2218,7 +2268,7 @@ let m = class extends ge {
2218
2268
  */
2219
2269
  mergeAcross(r = !0) {
2220
2270
  const e = Ce([this._range], M.ROWS), t = this._workbook.getUnitId(), n = this._worksheet.getSheetId();
2221
- return Q(this._injector, t, n, e, r), this;
2271
+ return X(this._injector, t, n, e, r), this;
2222
2272
  }
2223
2273
  /**
2224
2274
  * Merges cells in a range vertically.
@@ -2240,7 +2290,7 @@ let m = class extends ge {
2240
2290
  */
2241
2291
  mergeVertically(r = !0) {
2242
2292
  const e = Ce([this._range], M.COLUMNS), t = this._workbook.getUnitId(), n = this._worksheet.getSheetId();
2243
- return Q(this._injector, t, n, e, r), this;
2293
+ return X(this._injector, t, n, e, r), this;
2244
2294
  }
2245
2295
  /**
2246
2296
  * Returns true if cells in the current range overlap a merged cell.
@@ -2398,7 +2448,7 @@ let m = class extends ge {
2398
2448
  selections: [
2399
2449
  {
2400
2450
  range: n.getRange(),
2401
- primary: $(this.getRange(), this._worksheet),
2451
+ primary: q(this.getRange(), this._worksheet),
2402
2452
  style: null
2403
2453
  }
2404
2454
  ]
@@ -2863,16 +2913,16 @@ let m = class extends ge {
2863
2913
  }
2864
2914
  };
2865
2915
  m = _n([
2866
- ne(3, u(x)),
2867
- ne(4, g),
2868
- ne(5, u(rn))
2916
+ re(3, u(x)),
2917
+ re(4, g),
2918
+ re(5, u(rn))
2869
2919
  ], m);
2870
2920
  var wn = Object.getOwnPropertyDescriptor, kn = (r, e, t, n) => {
2871
2921
  for (var s = n > 1 ? void 0 : n ? wn(e, t) : e, o = r.length - 1, i; o >= 0; o--)
2872
2922
  (i = r[o]) && (s = i(s) || s);
2873
2923
  return s;
2874
2924
  }, Sn = (r, e) => (t, n) => e(t, n, r);
2875
- let Y = class {
2925
+ let J = class {
2876
2926
  constructor(r, e, t, n) {
2877
2927
  this._workbook = r, this._worksheet = e, this._selections = t, this._injector = n;
2878
2928
  }
@@ -2973,7 +3023,7 @@ let Y = class {
2973
3023
  for (const { range: o, style: i } of this._selections)
2974
3024
  N.contains(o, r.getRange()) ? (t.push({
2975
3025
  range: o,
2976
- primary: $(r.getRange(), this._worksheet),
3026
+ primary: q(r.getRange(), this._worksheet),
2977
3027
  style: i
2978
3028
  }), n = !0) : t.push({
2979
3029
  range: o,
@@ -2983,7 +3033,7 @@ let Y = class {
2983
3033
  n || (t = [
2984
3034
  {
2985
3035
  range: r.getRange(),
2986
- primary: $(r.getRange(), this._worksheet)
3036
+ primary: q(r.getRange(), this._worksheet)
2987
3037
  }
2988
3038
  ]);
2989
3039
  const s = {
@@ -2991,7 +3041,7 @@ let Y = class {
2991
3041
  subUnitId: this._worksheet.getSheetId(),
2992
3042
  selections: t
2993
3043
  };
2994
- return e.syncExecuteCommand(me.id, s), new Y(this._workbook, this._worksheet, t, this._injector);
3044
+ return e.syncExecuteCommand(me.id, s), new J(this._workbook, this._worksheet, t, this._injector);
2995
3045
  }
2996
3046
  /**
2997
3047
  * Get the next primary cell in the specified direction. If the primary cell not exists in selections, return null.
@@ -3025,14 +3075,14 @@ let Y = class {
3025
3075
  return t ? this._injector.createInstance(m, this._workbook, this._worksheet, t) : null;
3026
3076
  }
3027
3077
  };
3028
- Y = kn([
3078
+ J = kn([
3029
3079
  Sn(3, u(x))
3030
- ], Y);
3080
+ ], J);
3031
3081
  var Cn = Object.getOwnPropertyDescriptor, fn = (r, e, t, n) => {
3032
3082
  for (var s = n > 1 ? void 0 : n ? Cn(e, t) : e, o = r.length - 1, i; o >= 0; o--)
3033
3083
  (i = r[o]) && (s = i(s) || s);
3034
3084
  return s;
3035
- }, z = (r, e) => (t, n) => e(t, n, r);
3085
+ }, G = (r, e) => (t, n) => e(t, n, r);
3036
3086
  let k = class extends ge {
3037
3087
  /**
3038
3088
  * Creates a new worksheet facade instance
@@ -3136,7 +3186,7 @@ let k = class extends ge {
3136
3186
  */
3137
3187
  getSelection() {
3138
3188
  const e = this._selectionManagerService.getCurrentSelections();
3139
- return e ? this._injector.createInstance(Y, this._workbook, this._worksheet, e) : null;
3189
+ return e ? this._injector.createInstance(J, this._workbook, this._worksheet, e) : null;
3140
3190
  }
3141
3191
  // #region rows
3142
3192
  // #region default style
@@ -3386,7 +3436,7 @@ let k = class extends ge {
3386
3436
  * ```
3387
3437
  */
3388
3438
  insertRowsAfter(e, t) {
3389
- const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), o = j.DOWN, i = e + 1, a = e + t, h = 0, d = this._worksheet.getColumnCount() - 1, c = L(this._worksheet, i, a, h, d, !0, e);
3439
+ const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), o = L.DOWN, i = e + 1, a = e + t, h = 0, d = this._worksheet.getColumnCount() - 1, c = z(this._worksheet, i, a, h, d, !0, e);
3390
3440
  return this._commandService.syncExecuteCommand(Ie.id, {
3391
3441
  unitId: n,
3392
3442
  subUnitId: s,
@@ -3415,7 +3465,7 @@ let k = class extends ge {
3415
3465
  * ```
3416
3466
  */
3417
3467
  insertRowsBefore(e, t) {
3418
- const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), o = j.UP, i = e, a = e + t - 1, h = 0, d = this._worksheet.getColumnCount() - 1, c = L(this._worksheet, i, a, h, d, !0, e - 1);
3468
+ const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), o = L.UP, i = e, a = e + t - 1, h = 0, d = this._worksheet.getColumnCount() - 1, c = z(this._worksheet, i, a, h, d, !0, e - 1);
3419
3469
  return this._commandService.syncExecuteCommand(Ie.id, {
3420
3470
  unitId: n,
3421
3471
  subUnitId: s,
@@ -3489,7 +3539,7 @@ let k = class extends ge {
3489
3539
  * ```
3490
3540
  */
3491
3541
  moveRows(e, t) {
3492
- const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), o = ee(e.getRange(), this._worksheet), i = o, a = {
3542
+ const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), o = te(e.getRange(), this._worksheet), i = o, a = {
3493
3543
  startRow: t,
3494
3544
  endRow: t,
3495
3545
  startColumn: o.startColumn,
@@ -3519,7 +3569,7 @@ let k = class extends ge {
3519
3569
  * ```
3520
3570
  */
3521
3571
  hideRow(e) {
3522
- const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), s = ee(e.getRange(), this._worksheet);
3572
+ const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), s = te(e.getRange(), this._worksheet);
3523
3573
  return this._commandService.syncExecuteCommand(Re.id, {
3524
3574
  unitId: t,
3525
3575
  subUnitId: n,
@@ -3570,7 +3620,7 @@ let k = class extends ge {
3570
3620
  * ```
3571
3621
  */
3572
3622
  unhideRow(e) {
3573
- const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), s = ee(e.getRange(), this._worksheet);
3623
+ const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), s = te(e.getRange(), this._worksheet);
3574
3624
  return this._commandService.syncExecuteCommand(be.id, {
3575
3625
  unitId: t,
3576
3626
  subUnitId: n,
@@ -3644,7 +3694,7 @@ let k = class extends ge {
3644
3694
  unitId: this._workbook.getUnitId(),
3645
3695
  subUnitId: this._worksheet.getSheetId(),
3646
3696
  range: o[0],
3647
- value: G.WRAP
3697
+ value: $.WRAP
3648
3698
  }), this._commandService.syncExecuteCommand(Vt.id, {
3649
3699
  unitId: n,
3650
3700
  subUnitId: s,
@@ -3682,7 +3732,7 @@ let k = class extends ge {
3682
3732
  subUnitId: o,
3683
3733
  ranges: h,
3684
3734
  value: n
3685
- }), a.length > 0 && this._commandService.syncExecuteCommand(X.id, {
3735
+ }), a.length > 0 && this._commandService.syncExecuteCommand(Z.id, {
3686
3736
  unitId: s,
3687
3737
  subUnitId: o,
3688
3738
  ranges: a
@@ -3728,7 +3778,7 @@ let k = class extends ge {
3728
3778
  endColumn: this._worksheet.getColumnCount() - 1
3729
3779
  }
3730
3780
  ];
3731
- return this._commandService.syncExecuteCommand(X.id, {
3781
+ return this._commandService.syncExecuteCommand(Z.id, {
3732
3782
  unitId: n,
3733
3783
  subUnitId: s,
3734
3784
  ranges: o
@@ -3750,7 +3800,7 @@ let k = class extends ge {
3750
3800
  */
3751
3801
  setRangesAutoHeight(e) {
3752
3802
  const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId();
3753
- return this._commandService.syncExecuteCommand(X.id, {
3803
+ return this._commandService.syncExecuteCommand(Z.id, {
3754
3804
  unitId: t,
3755
3805
  subUnitId: n,
3756
3806
  ranges: e
@@ -3873,7 +3923,7 @@ let k = class extends ge {
3873
3923
  * ```
3874
3924
  */
3875
3925
  insertColumnsAfter(e, t) {
3876
- const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), o = j.RIGHT, i = 0, a = this._worksheet.getRowCount() - 1, h = e + 1, d = e + t, c = L(this._worksheet, i, a, h, d, !1, e);
3926
+ const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), o = L.RIGHT, i = 0, a = this._worksheet.getRowCount() - 1, h = e + 1, d = e + t, c = z(this._worksheet, i, a, h, d, !1, e);
3877
3927
  return this._commandService.syncExecuteCommand(Ee.id, {
3878
3928
  unitId: n,
3879
3929
  subUnitId: s,
@@ -3902,7 +3952,7 @@ let k = class extends ge {
3902
3952
  * ```
3903
3953
  */
3904
3954
  insertColumnsBefore(e, t) {
3905
- const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), o = j.LEFT, i = 0, a = this._worksheet.getRowCount() - 1, h = e, d = e + t - 1, c = L(this._worksheet, i, a, h, d, !1, e - 1);
3955
+ const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), o = L.LEFT, i = 0, a = this._worksheet.getRowCount() - 1, h = e, d = e + t - 1, c = z(this._worksheet, i, a, h, d, !1, e - 1);
3906
3956
  return this._commandService.syncExecuteCommand(Ee.id, {
3907
3957
  unitId: n,
3908
3958
  subUnitId: s,
@@ -3976,7 +4026,7 @@ let k = class extends ge {
3976
4026
  * ```
3977
4027
  */
3978
4028
  moveColumns(e, t) {
3979
- const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), o = te(e.getRange(), this._worksheet), i = o, a = {
4029
+ const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), o = ne(e.getRange(), this._worksheet), i = o, a = {
3980
4030
  startRow: 0,
3981
4031
  endRow: this._worksheet.getRowCount() - 1,
3982
4032
  startColumn: t,
@@ -4006,7 +4056,7 @@ let k = class extends ge {
4006
4056
  * ```
4007
4057
  */
4008
4058
  hideColumn(e) {
4009
- const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), s = te(e.getRange(), this._worksheet);
4059
+ const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), s = ne(e.getRange(), this._worksheet);
4010
4060
  return this._commandService.syncExecuteCommand(ye.id, {
4011
4061
  unitId: t,
4012
4062
  subUnitId: n,
@@ -4057,7 +4107,7 @@ let k = class extends ge {
4057
4107
  * ```
4058
4108
  */
4059
4109
  unhideColumn(e) {
4060
- const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), s = te(e.getRange(), this._worksheet);
4110
+ const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), s = ne(e.getRange(), this._worksheet);
4061
4111
  return this._commandService.syncExecuteCommand(Ue.id, {
4062
4112
  unitId: t,
4063
4113
  subUnitId: n,
@@ -4301,7 +4351,7 @@ let k = class extends ge {
4301
4351
  * ```
4302
4352
  */
4303
4353
  setFreeze(e) {
4304
- return this._logService.warn("setFreeze is deprecated, use setFrozenRows and setFrozenColumns instead"), this._commandService.syncExecuteCommand(Z.id, {
4354
+ return this._logService.warn("setFreeze is deprecated, use setFrozenRows and setFrozenColumns instead"), this._commandService.syncExecuteCommand(ee.id, {
4305
4355
  ...e,
4306
4356
  unitId: this._workbook.getUnitId(),
4307
4357
  subUnitId: this.getSheetId()
@@ -4348,7 +4398,7 @@ let k = class extends ge {
4348
4398
  });
4349
4399
  } else if (arguments.length === 2) {
4350
4400
  let [n = 0, s = 0] = e;
4351
- n > s && ([n, s] = [s, n]), this._commandService.syncExecuteCommand(Z.id, {
4401
+ n > s && ([n, s] = [s, n]), this._commandService.syncExecuteCommand(ee.id, {
4352
4402
  startColumn: s + 1,
4353
4403
  xSplit: s - n + 1,
4354
4404
  startRow: t.startRow,
@@ -4370,7 +4420,7 @@ let k = class extends ge {
4370
4420
  });
4371
4421
  } else if (arguments.length === 2) {
4372
4422
  let [n = 0, s = 0] = e;
4373
- n > s && ([n, s] = [s, n]), this._commandService.syncExecuteCommand(Z.id, {
4423
+ n > s && ([n, s] = [s, n]), this._commandService.syncExecuteCommand(ee.id, {
4374
4424
  startRow: s + 1,
4375
4425
  ySplit: s - n + 1,
4376
4426
  startColumn: t.startColumn,
@@ -4840,11 +4890,11 @@ let k = class extends ge {
4840
4890
  * ```ts
4841
4891
  * // The code below inserts a defined name
4842
4892
  * const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet();
4843
- * fWorksheet.insertDefinedName('MyDefinedName', 'Sheet1!A1');
4893
+ * fWorksheet.insertDefinedName('MyDefinedName', 'Sheet1!$A$1');
4844
4894
  * ```
4845
4895
  */
4846
4896
  insertDefinedName(e, t) {
4847
- const s = this._injector.createInstance(J).setName(e).setRef(t).build();
4897
+ const s = this._injector.createInstance(Q).setName(e).setRef(t).build();
4848
4898
  s.localSheetId = this.getSheetId(), this._fWorkbook.insertDefinedNameBuilder(s);
4849
4899
  }
4850
4900
  /**
@@ -4855,7 +4905,7 @@ let k = class extends ge {
4855
4905
  * // The code below gets all the defined names in the worksheet
4856
4906
  * const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet();
4857
4907
  * const definedNames = fWorksheet.getDefinedNames();
4858
- * console.log(definedNames);
4908
+ * console.log(definedNames, definedNames[0]?.getFormulaOrRefString());
4859
4909
  * ```
4860
4910
  */
4861
4911
  getDefinedNames() {
@@ -4965,7 +5015,7 @@ let k = class extends ge {
4965
5015
  appendRow(e) {
4966
5016
  const t = this._worksheet.getCellMatrix().hasValue(), n = this._worksheet.getLastRowWithContent(), s = this._worksheet.getRowCount(), o = this._worksheet.getColumnCount(), i = t ? n + 1 : n, a = new V();
4967
5017
  for (let h = 0; h < e.length; h++)
4968
- a.setValue(i, h, O(e[h]));
5018
+ a.setValue(i, h, j(e[h]));
4969
5019
  return this._commandService.syncExecuteCommand($t.id, {
4970
5020
  unitId: this._workbook.getUnitId(),
4971
5021
  subUnitId: this._worksheet.getSheetId(),
@@ -4978,10 +5028,10 @@ let k = class extends ge {
4978
5028
  }
4979
5029
  };
4980
5030
  k = fn([
4981
- z(3, u(x)),
4982
- z(4, u(Qe)),
4983
- z(5, u(He)),
4984
- z(6, g)
5031
+ G(3, u(x)),
5032
+ G(4, u(Qe)),
5033
+ G(5, u(He)),
5034
+ G(6, g)
4985
5035
  ], k);
4986
5036
  var vn = Object.getOwnPropertyDescriptor, In = (r, e, t, n) => {
4987
5037
  for (var s = n > 1 ? void 0 : n ? vn(e, t) : e, o = r.length - 1, i; o >= 0; o--)
@@ -5369,7 +5419,7 @@ let S = class extends ge {
5369
5419
  const o = {
5370
5420
  unitId: this.getId(),
5371
5421
  subUnitId: n,
5372
- selections: [e].map((i) => ({ range: i.getRange(), primary: $(i.getRange(), s), style: null }))
5422
+ selections: [e].map((i) => ({ range: i.getRange(), primary: q(i.getRange(), s), style: null }))
5373
5423
  };
5374
5424
  return this._commandService.syncExecuteCommand(me.id, o), this;
5375
5425
  }
@@ -5562,7 +5612,7 @@ let S = class extends ge {
5562
5612
  * ```
5563
5613
  */
5564
5614
  getPermission() {
5565
- return this._injector.createInstance(K);
5615
+ return this._injector.createInstance(Y);
5566
5616
  }
5567
5617
  /**
5568
5618
  * Get the defined name by name.
@@ -5573,12 +5623,16 @@ let S = class extends ge {
5573
5623
  * // The code below gets the defined name by name
5574
5624
  * const fWorkbook = univerAPI.getActiveWorkbook();
5575
5625
  * const definedName = fWorkbook.getDefinedName('MyDefinedName');
5576
- * console.log(definedName);
5626
+ * console.log(definedName?.getFormulaOrRefString());
5627
+ *
5628
+ * if (definedName) {
5629
+ * definedName.setName('NewDefinedName');
5630
+ * }
5577
5631
  * ```
5578
5632
  */
5579
5633
  getDefinedName(e) {
5580
5634
  const t = this._definedNamesService.getValueByName(this.id, e);
5581
- return t ? this._injector.createInstance(q, { ...t, unitId: this.id }) : null;
5635
+ return t ? this._injector.createInstance(K, { ...t, unitId: this.id }) : null;
5582
5636
  }
5583
5637
  /**
5584
5638
  * Get all the defined names in the workbook.
@@ -5588,12 +5642,12 @@ let S = class extends ge {
5588
5642
  * // The code below gets all the defined names in the workbook
5589
5643
  * const fWorkbook = univerAPI.getActiveWorkbook();
5590
5644
  * const definedNames = fWorkbook.getDefinedNames();
5591
- * console.log(definedNames);
5645
+ * console.log(definedNames, definedNames[0]?.getFormulaOrRefString());
5592
5646
  * ```
5593
5647
  */
5594
5648
  getDefinedNames() {
5595
5649
  const e = this._definedNamesService.getDefinedNameMap(this.id);
5596
- return e ? Object.values(e).map((t) => this._injector.createInstance(q, { ...t, unitId: this.id })) : [];
5650
+ return e ? Object.values(e).map((t) => this._injector.createInstance(K, { ...t, unitId: this.id })) : [];
5597
5651
  }
5598
5652
  /**
5599
5653
  * Insert a defined name.
@@ -5604,12 +5658,12 @@ let S = class extends ge {
5604
5658
  * ```ts
5605
5659
  * // The code below inserts a defined name
5606
5660
  * const fWorkbook = univerAPI.getActiveWorkbook();
5607
- * fWorkbook.insertDefinedName('MyDefinedName', 'Sheet1!A1');
5661
+ * fWorkbook.insertDefinedName('MyDefinedName', 'Sheet1!$A$1');
5608
5662
  * ```
5609
5663
  */
5610
5664
  insertDefinedName(e, t) {
5611
- const s = this._injector.createInstance(J).setName(e).setRef(t).build();
5612
- return s.localSheetId = oe, this.insertDefinedNameBuilder(s), this;
5665
+ const s = this._injector.createInstance(Q).setName(e).setRef(t).build();
5666
+ return s.localSheetId = O, this.insertDefinedNameBuilder(s), this;
5613
5667
  }
5614
5668
  /**
5615
5669
  * Delete the defined name with the given name.
@@ -5643,7 +5697,7 @@ let S = class extends ge {
5643
5697
  * ```
5644
5698
  */
5645
5699
  insertDefinedNameBuilder(e) {
5646
- e.unitId = this.getId(), this._commandService.syncExecuteCommand(se.id, e);
5700
+ e.unitId = this.getId(), this._commandService.syncExecuteCommand(oe.id, e);
5647
5701
  }
5648
5702
  /**
5649
5703
  * Update the defined name with the given name.
@@ -5653,15 +5707,21 @@ let S = class extends ge {
5653
5707
  * ```ts
5654
5708
  * // The code below updates the defined name with the given name
5655
5709
  * const fWorkbook = univerAPI.getActiveWorkbook();
5656
- * const definedNameBuilder = fWorkbook.getDefinedName('MyDefinedName').toBuilder();
5657
- * const param = definedNameBuilder.setRef('Sheet1!A2')
5658
- * .setName('NewDefinedName')
5659
- * .build();
5660
- * fWorkbook.updateDefinedNameBuilder(param);
5710
+ * const definedName = fWorkbook.getDefinedName('MyDefinedName');
5711
+ * console.log(definedName?.getFormulaOrRefString());
5712
+ *
5713
+ * // Update the defined name
5714
+ * if (definedName) {
5715
+ * const newDefinedNameParam = definedName.toBuilder()
5716
+ * .setName('NewDefinedName')
5717
+ * .setRef('Sheet1!$A$2')
5718
+ * .build();
5719
+ * fWorkbook.updateDefinedNameBuilder(newDefinedNameParam);
5720
+ * }
5661
5721
  * ```
5662
5722
  */
5663
5723
  updateDefinedNameBuilder(e) {
5664
- this._commandService.syncExecuteCommand(se.id, e);
5724
+ this._commandService.syncExecuteCommand(oe.id, e);
5665
5725
  }
5666
5726
  /**
5667
5727
  * Gets the registered range themes.
@@ -5768,7 +5828,7 @@ S = In([
5768
5828
  R(1, u(x)),
5769
5829
  R(2, u(ot)),
5770
5830
  R(3, u(Qe)),
5771
- R(4, re),
5831
+ R(4, se),
5772
5832
  R(5, g),
5773
5833
  R(6, ue),
5774
5834
  R(7, He),
@@ -5796,7 +5856,7 @@ class Rn extends je {
5796
5856
  return { workbook: n, worksheet: s };
5797
5857
  }
5798
5858
  _initWorkbookEvent(e) {
5799
- const t = e.get(re);
5859
+ const t = e.get(se);
5800
5860
  this.registerEventHandler(
5801
5861
  this.Event.WorkbookDisposed,
5802
5862
  () => t.unitDisposed$.subscribe((n) => {
@@ -6080,7 +6140,7 @@ class Rn extends je {
6080
6140
  ), this._initWorkbookEvent(e);
6081
6141
  }
6082
6142
  createUniverSheet(e, t) {
6083
- const s = this._injector.get(re).createUnit(U.UNIVER_SHEET, e, t);
6143
+ const s = this._injector.get(se).createUnit(U.UNIVER_SHEET, e, t);
6084
6144
  return this._injector.createInstance(S, s);
6085
6145
  }
6086
6146
  createWorkbook(e, t) {
@@ -6101,7 +6161,7 @@ class Rn extends je {
6101
6161
  return this.getUniverSheet(e);
6102
6162
  }
6103
6163
  getPermission() {
6104
- return this._injector.createInstance(K);
6164
+ return this._injector.createInstance(Y);
6105
6165
  }
6106
6166
  onUniverSheetCreated(e) {
6107
6167
  const t = this._univerInstanceService.getTypeOfUnitAdded$(U.UNIVER_SHEET).subscribe((n) => {
@@ -6111,7 +6171,7 @@ class Rn extends je {
6111
6171
  return Oe(t);
6112
6172
  }
6113
6173
  newDefinedName() {
6114
- return this._injector.createInstance(J);
6174
+ return this._injector.createInstance(Q);
6115
6175
  }
6116
6176
  getActiveSheet() {
6117
6177
  const e = this.getActiveWorkbook();
@@ -6251,9 +6311,9 @@ We = yn([
6251
6311
  Un(0, u(x))
6252
6312
  ], We);
6253
6313
  export {
6254
- K as FPermission,
6314
+ Y as FPermission,
6255
6315
  m as FRange,
6256
- Y as FSelection,
6316
+ J as FSelection,
6257
6317
  pn as FSheetEventName,
6258
6318
  We as FSheetHooks,
6259
6319
  bn as FSheetsEnum,