@univerjs/sheets 0.5.4 → 0.5.5-nightly.202501201336

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/es/facade.js CHANGED
@@ -1,34 +1,34 @@
1
- var Ae = Object.defineProperty;
2
- var Fe = (s, e, t) => e in s ? Ae(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
- var k = (s, e, t) => Fe(s, typeof e != "symbol" ? e + "" : e, t);
4
- import { Inject as u, Injector as b, IAuthzIoService as ve, LocaleService as Re, ICommandService as l, IPermissionService as ee, generateRandomId as be, FBase as te, Rectangle as N, HorizontalAlign as y, VerticalAlign as U, isFormulaString as je, isCellV as Oe, isICellData as Ve, ObjectMatrix as A, Tools as Be, RANGE_TYPE as _, FBaseInitialable as ne, RichTextValue as p, BooleanNumber as m, WrapStrategy as oe, Dimension as ie, ILogService as pe, Registry as ye, toDisposable as F, Direction as D, IResourceLoaderService as Le, FEnum as ze, FEventName as se, mergeWorksheetSnapshotWithDefault as $e, UndoCommand as He, RedoCommand as Ge, UniverInstanceType as R, IUniverInstanceService as J, FUniver as Ue, CanceledError as qe } from "@univerjs/core";
5
- import { WorksheetProtectionRuleModel as Ee, RangeProtectionRuleModel as Pe, WorksheetProtectionPointModel as xe, SetDefinedNameCommand as Q, SCOPE_WORKBOOK_VALUE_DEFINED_NAME as X, RemoveDefinedNameCommand as Ke, PermissionPointsDefinitions as Ye, WorkbookEditablePermission as Ne, UnitObject as E, AddWorksheetProtectionMutation as Je, DeleteWorksheetProtectionMutation as Qe, getAllWorksheetPermissionPoint as Xe, getAllWorksheetPermissionPointByPointPanel as ae, SetWorksheetPermissionPointsMutation as Ze, AddRangeProtectionMutation as et, DeleteRangeProtectionMutation as tt, SetRangeProtectionMutation as nt, WorksheetEditPermission as st, WorksheetViewPermission as rt, SetStyleCommand as f, SetRangeValuesCommand as P, SetTextWrapCommand as he, SetVerticalTextAlignCommand as ot, SetHorizontalTextAlignCommand as it, addMergeCellsUtil as $, getAddMergeMutationRangeByType as ce, RemoveWorksheetMergeCommand as at, SplitTextToColumnsCommand as ht, SetWorksheetRangeThemeStyleCommand as ct, DeleteWorksheetRangeThemeStyleCommand as dt, SheetRangeThemeService as Me, getPrimaryForRange as Z, SetSelectionsOperation as De, getNextPrimaryCell as ut, SheetsSelectionsService as We, SetWorksheetDefaultStyleMutation as mt, SetColDataCommand as de, SetRowDataCommand as ue, copyRangeStyles as W, InsertRowByRangeCommand as me, RemoveRowByRangeCommand as lt, MoveRowsCommand as gt, SetRowHiddenCommand as le, SetSpecificRowsVisibleCommand as ge, SetRowHeightCommand as _e, SetWorksheetRowIsAutoHeightCommand as _t, InsertColByRangeCommand as we, RemoveColByRangeCommand as wt, MoveColsCommand as kt, SetColHiddenCommand as ke, SetSpecificColsVisibleCommand as Se, SetColWidthCommand as St, SetFrozenCommand as H, CancelFrozenCommand as Ct, ToggleGridlinesCommand as It, SetGridlinesColorCommand as ft, SetTabColorCommand as vt, SetRangeValuesMutation as Ce, SetWorksheetHideCommand as Rt, SetWorksheetShowCommand as bt, SetWorksheetNameCommand as pt, ClearSelectionAllCommand as yt, ClearSelectionContentCommand as Ut, ClearSelectionFormatCommand as Et, InsertSheetCommand as x, SetWorksheetActiveOperation as G, RemoveSheetCommand as Pt, CopySheetCommand as xt, SetWorksheetOrderCommand as Nt, RegisterWorksheetRangeThemeStyleCommand as Mt, UnregisterWorksheetRangeThemeStyleCommand as Dt } from "@univerjs/sheets";
6
- import { IDefinedNamesService as Te, serializeRange as re, FormulaDataModel as Wt, serializeRangeWithSheet as Tt, deserializeRangeWithSheet as At } from "@univerjs/engine-formula";
7
- var Ft = Object.defineProperty, jt = Object.getOwnPropertyDescriptor, Ot = (s, e, t, n) => {
8
- for (var r = n > 1 ? void 0 : n ? jt(e, t) : e, o = s.length - 1, i; o >= 0; o--)
9
- (i = s[o]) && (r = (n ? i(e, t, r) : i(r)) || r);
10
- return n && r && Ft(e, t, r), r;
11
- }, S = (s, e) => (t, n) => e(t, n, s);
12
- function Vt(s, e, t) {
13
- const n = t.getDefinedNameMap(s);
1
+ var Ge = Object.defineProperty;
2
+ var qe = (r, e, t) => e in r ? Ge(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
+ var b = (r, e, t) => qe(r, typeof e != "symbol" ? e + "" : e, t);
4
+ import { Inject as u, Injector as y, IAuthzIoService as Ne, LocaleService as Te, ICommandService as l, IPermissionService as ae, generateRandomId as Me, FBase as de, Rectangle as M, HorizontalAlign as U, VerticalAlign as P, isFormulaString as Ke, isCellV as Ye, isICellData as Je, ObjectMatrix as W, Tools as Qe, RANGE_TYPE as _, FBaseInitialable as ce, TextStyleValue as le, RichTextValue as E, BooleanNumber as g, WrapStrategy as Y, Dimension as me, ILogService as De, Direction as D, IResourceLoaderService as Xe, mergeWorksheetSnapshotWithDefault as Ze, UndoCommand as et, RedoCommand as tt, toDisposable as Ae, UniverInstanceType as p, IUniverInstanceService as J, FUniver as Be, CanceledError as nt, FEnum as rt, FEventName as We } from "@univerjs/core";
5
+ import { WorksheetProtectionRuleModel as Fe, RangeProtectionRuleModel as je, WorksheetProtectionPointModel as Oe, SetDefinedNameCommand as Q, SCOPE_WORKBOOK_VALUE_DEFINED_NAME as X, RemoveDefinedNameCommand as st, PermissionPointsDefinitions as it, WorkbookEditablePermission as Le, UnitObject as x, AddWorksheetProtectionMutation as ot, DeleteWorksheetProtectionMutation as ht, getAllWorksheetPermissionPoint as at, getAllWorksheetPermissionPointByPointPanel as _e, SetWorksheetPermissionPointsMutation as dt, AddRangeProtectionMutation as ct, DeleteRangeProtectionMutation as ut, SetRangeProtectionMutation as gt, WorksheetEditPermission as lt, WorksheetViewPermission as mt, SetBorderBasicCommand as _t, SetStyleCommand as I, SetRangeValuesCommand as N, SetTextWrapCommand as Z, SetVerticalTextAlignCommand as kt, SetHorizontalTextAlignCommand as St, addMergeCellsUtil as H, getAddMergeMutationRangeByType as ke, RemoveWorksheetMergeCommand as wt, SplitTextToColumnsCommand as Ct, SetWorksheetRangeThemeStyleCommand as ft, DeleteWorksheetRangeThemeStyleCommand as vt, SheetRangeThemeService as Ve, getPrimaryForRange as ee, SetSelectionsOperation as He, getNextPrimaryCell as It, SheetsSelectionsService as ze, SetWorksheetDefaultStyleMutation as bt, SetColDataCommand as Se, SetRowDataCommand as we, copyRangeStyles as A, InsertRowByRangeCommand as Ce, RemoveRowByRangeCommand as Rt, MoveRowsCommand as pt, SetRowHiddenCommand as fe, SetSpecificRowsVisibleCommand as ve, SetWorksheetRowIsAutoHeightMutation as yt, SetRowHeightCommand as Ie, SetWorksheetRowIsAutoHeightCommand as be, InsertColByRangeCommand as Re, RemoveColByRangeCommand as Et, MoveColsCommand as Ut, SetColHiddenCommand as pe, SetSpecificColsVisibleCommand as ye, SetColWidthCommand as Pt, SetFrozenCommand as z, CancelFrozenCommand as xt, ToggleGridlinesCommand as te, SetGridlinesColorCommand as ne, SetTabColorCommand as re, SetRangeValuesMutation as Ee, SetWorksheetHideCommand as se, SetWorksheetShowCommand as Nt, SetWorksheetNameCommand as ie, ClearSelectionAllCommand as Tt, ClearSelectionContentCommand as Mt, ClearSelectionFormatCommand as Dt, InsertSheetCommand as T, SetWorksheetActiveOperation as $, RemoveSheetCommand as oe, CopySheetCommand as At, SetWorksheetOrderCommand as he, RegisterWorksheetRangeThemeStyleCommand as Bt, UnregisterWorksheetRangeThemeStyleCommand as Wt, SetWorksheetActivateCommand as Ue, COMMAND_LISTENER_VALUE_CHANGE as Ft, getValueChangedEffectedRange as jt, SheetValueChangeType as Ot, SheetSkeletonChangeType as Lt } from "@univerjs/sheets";
6
+ import { IDefinedNamesService as $e, serializeRange as ue, FormulaDataModel as Vt, serializeRangeWithSheet as Ht, deserializeRangeWithSheet as zt } from "@univerjs/engine-formula";
7
+ var $t = Object.defineProperty, Gt = Object.getOwnPropertyDescriptor, qt = (r, e, t, n) => {
8
+ for (var s = n > 1 ? void 0 : n ? Gt(e, t) : e, i = r.length - 1, o; i >= 0; i--)
9
+ (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
10
+ return n && s && $t(e, t, s), s;
11
+ }, w = (r, e) => (t, n) => e(t, n, r);
12
+ function Kt(r, e, t) {
13
+ const n = t.getDefinedNameMap(r);
14
14
  if (n == null)
15
15
  return e.t("definedName.defaultName") + 1;
16
- const o = Array.from(Object.values(n)).length + 1, i = e.t("definedName.defaultName") + o;
17
- if (t.getValueByName(s, i) == null)
18
- return i;
19
- let a = o + 1;
16
+ const i = Array.from(Object.values(n)).length + 1, o = e.t("definedName.defaultName") + i;
17
+ if (t.getValueByName(r, o) == null)
18
+ return o;
19
+ let h = i + 1;
20
20
  for (; ; ) {
21
- const h = e.t("definedName.defaultName") + a;
22
- if (t.getValueByName(s, h) == null)
23
- return h;
24
- a++;
21
+ const a = e.t("definedName.defaultName") + h;
22
+ if (t.getValueByName(r, a) == null)
23
+ return a;
24
+ h++;
25
25
  }
26
26
  }
27
- class L {
27
+ class V {
28
28
  constructor() {
29
- k(this, "_definedNameParam");
29
+ b(this, "_definedNameParam");
30
30
  this._definedNameParam = {
31
- id: be(10),
31
+ id: Me(10),
32
32
  unitId: "",
33
33
  name: "",
34
34
  formulaOrRefString: ""
@@ -99,12 +99,12 @@ class L {
99
99
  * workbook.insertDefinedNameBuilder(definedNameBuilder);
100
100
  * ```
101
101
  */
102
- setRefByRange(e, t, n, r) {
103
- return this._definedNameParam.formulaOrRefString = re({
102
+ setRefByRange(e, t, n, s) {
103
+ return this._definedNameParam.formulaOrRefString = ue({
104
104
  startRow: e,
105
105
  endRow: e + (n != null ? n : 1) - 1,
106
106
  startColumn: t,
107
- endColumn: t + (r != null ? r : 1) - 1
107
+ endColumn: t + (s != null ? s : 1) - 1
108
108
  }), this;
109
109
  }
110
110
  /**
@@ -159,12 +159,12 @@ class L {
159
159
  return this._definedNameParam = e, this;
160
160
  }
161
161
  }
162
- let j = class extends te {
163
- constructor(s, e, t, n, r, o, i, a, h, c) {
164
- super(), this._definedNameParam = s, this._injector = e, this._commandService = t, this._permissionService = n, this._worksheetProtectionRuleModel = r, this._rangeProtectionRuleModel = o, this._worksheetProtectionPointRuleModel = i, this._authzIoService = a, this._localeService = h, this._definedNamesService = c;
162
+ let F = class extends de {
163
+ constructor(r, e, t, n, s, i, o, h, a, d) {
164
+ super(), this._definedNameParam = r, this._injector = e, this._commandService = t, this._permissionService = n, this._worksheetProtectionRuleModel = s, this._rangeProtectionRuleModel = i, this._worksheetProtectionPointRuleModel = o, this._authzIoService = h, this._localeService = a, this._definedNamesService = d;
165
165
  }
166
166
  _apply() {
167
- this._definedNameParam.name === "" && (this._definedNameParam.name = Vt(this._definedNameParam.unitId, this._localeService, this._definedNamesService)), this._commandService.syncExecuteCommand(Q.id, this._definedNameParam);
167
+ this._definedNameParam.name === "" && (this._definedNameParam.name = Kt(this._definedNameParam.unitId, this._localeService, this._definedNamesService)), this._commandService.syncExecuteCommand(Q.id, this._definedNameParam);
168
168
  }
169
169
  /**
170
170
  * Gets the name of the defined name.
@@ -189,8 +189,8 @@ let j = class extends te {
189
189
  * definedName.setName('NewDefinedName');
190
190
  * ```
191
191
  */
192
- setName(s) {
193
- this._definedNameParam.name = s, this._apply();
192
+ setName(r) {
193
+ this._definedNameParam.name = r, this._apply();
194
194
  }
195
195
  /**
196
196
  * Sets the formula of the defined name.
@@ -202,8 +202,8 @@ let j = class extends te {
202
202
  * definedName.setFormula('SUM(Sheet1!$A$1)');
203
203
  * ```
204
204
  */
205
- setFormula(s) {
206
- this._definedNameParam.formulaOrRefString = `=${s}`, this._apply();
205
+ setFormula(r) {
206
+ this._definedNameParam.formulaOrRefString = `=${r}`, this._apply();
207
207
  }
208
208
  /**
209
209
  * Sets the reference of the defined name.
@@ -215,8 +215,8 @@ let j = class extends te {
215
215
  * definedName.setRef('Sheet1!$A$1');
216
216
  * ```
217
217
  */
218
- setRef(s) {
219
- this._definedNameParam.formulaOrRefString = s, this._apply();
218
+ setRef(r) {
219
+ this._definedNameParam.formulaOrRefString = r, this._apply();
220
220
  }
221
221
  /**
222
222
  * Gets the reference of the defined name.
@@ -244,10 +244,10 @@ let j = class extends te {
244
244
  * definedName.setRefByRange(1, 3, 2, 5);
245
245
  * ```
246
246
  */
247
- setRefByRange(s, e, t, n) {
248
- this._definedNameParam.formulaOrRefString = re({
249
- startRow: s,
250
- endRow: s + (t != null ? t : 1) - 1,
247
+ setRefByRange(r, e, t, n) {
248
+ this._definedNameParam.formulaOrRefString = ue({
249
+ startRow: r,
250
+ endRow: r + (t != null ? t : 1) - 1,
251
251
  startColumn: e,
252
252
  endColumn: e + (n != null ? n : 1) - 1
253
253
  }), this._apply();
@@ -275,8 +275,8 @@ let j = class extends te {
275
275
  * definedName.setComment('This is a comment');
276
276
  * ```
277
277
  */
278
- setComment(s) {
279
- this._definedNameParam.comment = s, this._apply();
278
+ setComment(r) {
279
+ this._definedNameParam.comment = r, this._apply();
280
280
  }
281
281
  /**
282
282
  * Sets the scope of the defined name to the worksheet.
@@ -289,8 +289,8 @@ let j = class extends te {
289
289
  * definedName.setScopeToWorksheet(worksheet);
290
290
  * ```
291
291
  */
292
- setScopeToWorksheet(s) {
293
- this._definedNameParam.localSheetId = s.getSheetId(), this._apply();
292
+ setScopeToWorksheet(r) {
293
+ this._definedNameParam.localSheetId = r.getSheetId(), this._apply();
294
294
  }
295
295
  /**
296
296
  * Sets the scope of the defined name to the workbook.
@@ -314,8 +314,8 @@ let j = class extends te {
314
314
  * definedName.setHidden(true);
315
315
  * ```
316
316
  */
317
- setHidden(s) {
318
- this._definedNameParam.hidden = s, this._apply();
317
+ setHidden(r) {
318
+ this._definedNameParam.hidden = r, this._apply();
319
319
  }
320
320
  /**
321
321
  * Deletes the defined name.
@@ -327,7 +327,7 @@ let j = class extends te {
327
327
  * ```
328
328
  */
329
329
  delete() {
330
- this._commandService.syncExecuteCommand(Ke.id, this._definedNameParam);
330
+ this._commandService.syncExecuteCommand(st.id, this._definedNameParam);
331
331
  }
332
332
  /**
333
333
  * Gets the local sheet id of the defined name.
@@ -368,33 +368,33 @@ let j = class extends te {
368
368
  * ```
369
369
  */
370
370
  toBuilder() {
371
- const s = this._injector.createInstance(L);
372
- return s.load(this._definedNameParam), s;
371
+ const r = this._injector.createInstance(V);
372
+ return r.load(this._definedNameParam), r;
373
373
  }
374
374
  };
375
- j = Ot([
376
- S(1, u(b)),
377
- S(2, l),
378
- S(3, ee),
379
- S(4, u(Ee)),
380
- S(5, u(Pe)),
381
- S(6, u(xe)),
382
- S(7, u(ve)),
383
- S(8, u(Re)),
384
- S(9, Te)
385
- ], j);
386
- var Bt = Object.defineProperty, Lt = Object.getOwnPropertyDescriptor, zt = (s, e, t, n) => {
387
- for (var r = n > 1 ? void 0 : n ? Lt(e, t) : e, o = s.length - 1, i; o >= 0; o--)
388
- (i = s[o]) && (r = (n ? i(e, t, r) : i(r)) || r);
389
- return n && r && Bt(e, t, r), r;
390
- }, v = (s, e) => (t, n) => e(t, n, s);
391
- let O = class extends te {
392
- constructor(e, t, n, r, o, i, a) {
375
+ F = qt([
376
+ w(1, u(y)),
377
+ w(2, l),
378
+ w(3, ae),
379
+ w(4, u(Fe)),
380
+ w(5, u(je)),
381
+ w(6, u(Oe)),
382
+ w(7, u(Ne)),
383
+ w(8, u(Te)),
384
+ w(9, $e)
385
+ ], F);
386
+ var Yt = Object.defineProperty, Jt = Object.getOwnPropertyDescriptor, Qt = (r, e, t, n) => {
387
+ for (var s = n > 1 ? void 0 : n ? Jt(e, t) : e, i = r.length - 1, o; i >= 0; i--)
388
+ (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
389
+ return n && s && Yt(e, t, s), s;
390
+ }, R = (r, e) => (t, n) => e(t, n, r);
391
+ let j = class extends de {
392
+ constructor(e, t, n, s, i, o, h) {
393
393
  super();
394
- k(this, "permissionPointsDefinition", Ye);
395
- k(this, "rangeRuleChangedAfterAuth$");
396
- k(this, "sheetRuleChangedAfterAuth$");
397
- this._injector = e, this._commandService = t, this._permissionService = n, this._worksheetProtectionRuleModel = r, this._rangeProtectionRuleModel = o, this._worksheetProtectionPointRuleModel = i, this._authzIoService = a, this.rangeRuleChangedAfterAuth$ = this._rangeProtectionRuleModel.ruleRefresh$, this.sheetRuleChangedAfterAuth$ = this._worksheetProtectionRuleModel.ruleRefresh$;
394
+ b(this, "permissionPointsDefinition", it);
395
+ b(this, "rangeRuleChangedAfterAuth$");
396
+ b(this, "sheetRuleChangedAfterAuth$");
397
+ this._injector = e, this._commandService = t, this._permissionService = n, this._worksheetProtectionRuleModel = s, this._rangeProtectionRuleModel = i, this._worksheetProtectionPointRuleModel = o, this._authzIoService = h, this.rangeRuleChangedAfterAuth$ = this._rangeProtectionRuleModel.ruleRefresh$, this.sheetRuleChangedAfterAuth$ = this._worksheetProtectionRuleModel.ruleRefresh$;
398
398
  }
399
399
  /**
400
400
  * Configures a specific permission point for a workbook.
@@ -406,8 +406,8 @@ let O = class extends te {
406
406
  * @param {boolean} value - The boolean value to determine whether the permission point is enabled or disabled.
407
407
  */
408
408
  setWorkbookPermissionPoint(e, t, n) {
409
- const r = new t(e);
410
- this._permissionService.getPermissionPoint(r.id) || this._permissionService.addPermissionPoint(r), this._permissionService.updatePermissionPoint(r.id, n);
409
+ const s = new t(e);
410
+ this._permissionService.getPermissionPoint(s.id) || this._permissionService.addPermissionPoint(s), this._permissionService.updatePermissionPoint(s.id, n);
411
411
  }
412
412
  /**
413
413
  * This function is used to set whether the workbook can be edited
@@ -415,7 +415,7 @@ let O = class extends te {
415
415
  * @param {boolean} value - A value that controls whether the workbook can be edited
416
416
  */
417
417
  setWorkbookEditPermission(e, t) {
418
- this.setWorkbookPermissionPoint(e, Ne, t);
418
+ this.setWorkbookPermissionPoint(e, Le, t);
419
419
  }
420
420
  /**
421
421
  * This function is used to add a base permission for a worksheet.
@@ -426,8 +426,8 @@ let O = class extends te {
426
426
  async addWorksheetBasePermission(e, t) {
427
427
  if (this._rangeProtectionRuleModel.getSubunitRuleList(e, t).length > 0)
428
428
  throw new Error("sheet protection cannot intersect with range protection");
429
- const r = await this._authzIoService.create({
430
- objectType: E.Worksheet,
429
+ const s = await this._authzIoService.create({
430
+ objectType: x.Worksheet,
431
431
  worksheetObject: {
432
432
  collaborators: [],
433
433
  unitID: e,
@@ -436,17 +436,17 @@ let O = class extends te {
436
436
  scope: void 0
437
437
  }
438
438
  });
439
- if (this._commandService.syncExecuteCommand(Je.id, {
439
+ if (this._commandService.syncExecuteCommand(ot.id, {
440
440
  unitId: e,
441
441
  subUnitId: t,
442
442
  rule: {
443
- permissionId: r,
444
- unitType: E.Worksheet,
443
+ permissionId: s,
444
+ unitType: x.Worksheet,
445
445
  unitId: e,
446
446
  subUnitId: t
447
447
  }
448
448
  }))
449
- return r;
449
+ return s;
450
450
  }
451
451
  /**
452
452
  * Delete the entire table protection set for the worksheet and reset the point permissions of the worksheet to true
@@ -454,12 +454,12 @@ let O = class extends te {
454
454
  * @param {string} subUnitId - The unique identifier of the worksheet for which the permission is being set.
455
455
  */
456
456
  removeWorksheetPermission(e, t) {
457
- this._commandService.syncExecuteCommand(Qe.id, {
457
+ this._commandService.syncExecuteCommand(ht.id, {
458
458
  unitId: e,
459
459
  subUnitId: t
460
- }), [...Xe(), ...ae()].forEach((n) => {
461
- const r = new n(e, t);
462
- this._permissionService.updatePermissionPoint(r.id, !0);
460
+ }), [...at(), ..._e()].forEach((n) => {
461
+ const s = new n(e, t);
462
+ this._permissionService.updatePermissionPoint(s.id, !0);
463
463
  }), this._worksheetProtectionPointRuleModel.deleteRule(e, t);
464
464
  }
465
465
  /**
@@ -472,21 +472,21 @@ let O = class extends te {
472
472
  * @param {boolean} value - The new permission value to be set for the worksheet.
473
473
  * @returns {Promise<string | undefined>} - Returns the `permissionId` if the permission point is successfully set or created. If no permission is set, it resolves to `undefined`.
474
474
  */
475
- async setWorksheetPermissionPoint(e, t, n, r) {
476
- const o = this._worksheetProtectionRuleModel.getRule(e, t);
477
- let i;
478
- if (n === st || n === rt)
479
- if (o)
480
- i = o.permissionId;
475
+ async setWorksheetPermissionPoint(e, t, n, s) {
476
+ const i = this._worksheetProtectionRuleModel.getRule(e, t);
477
+ let o;
478
+ if (n === lt || n === mt)
479
+ if (i)
480
+ o = i.permissionId;
481
481
  else {
482
482
  if (this._rangeProtectionRuleModel.getSubunitRuleList(e, t).length > 0)
483
483
  throw new Error("sheet protection cannot intersect with range protection");
484
- i = await this.addWorksheetBasePermission(e, t);
484
+ o = await this.addWorksheetBasePermission(e, t);
485
485
  }
486
486
  else {
487
- const d = this._worksheetProtectionPointRuleModel.getRule(e, t);
488
- d ? i = d.permissionId : (i = await this._authzIoService.create({
489
- objectType: E.Worksheet,
487
+ const c = this._worksheetProtectionPointRuleModel.getRule(e, t);
488
+ c ? o = c.permissionId : (o = await this._authzIoService.create({
489
+ objectType: x.Worksheet,
490
490
  worksheetObject: {
491
491
  collaborators: [],
492
492
  unitID: e,
@@ -494,10 +494,10 @@ let O = class extends te {
494
494
  name: "",
495
495
  scope: void 0
496
496
  }
497
- }), this._commandService.executeCommand(Ze.id, { unitId: e, subUnitId: t, permissionId: i }));
497
+ }), this._commandService.syncExecuteCommand(dt.id, { unitId: e, subUnitId: t, permissionId: o }));
498
498
  }
499
- const h = new n(e, t);
500
- return this._permissionService.getPermissionPoint(h.id) || this._permissionService.addPermissionPoint(h), this._permissionService.updatePermissionPoint(h.id, r), i;
499
+ const a = new n(e, t);
500
+ return this._permissionService.getPermissionPoint(a.id) || this._permissionService.addPermissionPoint(a), this._permissionService.updatePermissionPoint(a.id, s), o;
501
501
  }
502
502
  /**
503
503
  * Adds a range protection to the worksheet.
@@ -507,34 +507,34 @@ let O = class extends te {
507
507
  * @returns {Promise<{ permissionId: string, ruleId: string } | undefined>} - Returns an object containing the `permissionId` and `ruleId` if the range protection is successfully added. If the operation fails or no result is returned, it resolves to `undefined`. permissionId is used to stitch permission point ID,ruleId is used to store permission rules
508
508
  */
509
509
  async addRangeBaseProtection(e, t, n) {
510
- const r = await this._authzIoService.create({
511
- objectType: E.SelectRange,
510
+ const s = await this._authzIoService.create({
511
+ objectType: x.SelectRange,
512
512
  selectRangeObject: {
513
513
  collaborators: [],
514
514
  unitID: e,
515
515
  name: "",
516
516
  scope: void 0
517
517
  }
518
- }), o = `ruleId_${be(6)}`;
518
+ }), i = `ruleId_${Me(6)}`;
519
519
  if (this._worksheetProtectionRuleModel.getRule(e, t))
520
520
  throw new Error("sheet protection cannot intersect with range protection");
521
- if (this._rangeProtectionRuleModel.getSubunitRuleList(e, t).some((d) => d.ranges.some((z) => n.some((M) => N.intersects(M, z)))))
521
+ if (this._rangeProtectionRuleModel.getSubunitRuleList(e, t).some((c) => c.ranges.some((v) => n.some((k) => M.intersects(k, v)))))
522
522
  throw new Error("range protection cannot intersect");
523
- if (this._commandService.syncExecuteCommand(et.id, {
523
+ if (this._commandService.syncExecuteCommand(ct.id, {
524
524
  unitId: e,
525
525
  subUnitId: t,
526
526
  rules: [{
527
- permissionId: r,
528
- unitType: E.SelectRange,
527
+ permissionId: s,
528
+ unitType: x.SelectRange,
529
529
  unitId: e,
530
530
  subUnitId: t,
531
531
  ranges: n,
532
- id: o
532
+ id: i
533
533
  }]
534
534
  }))
535
535
  return {
536
- permissionId: r,
537
- ruleId: o
536
+ permissionId: s,
537
+ ruleId: i
538
538
  };
539
539
  }
540
540
  /**
@@ -544,13 +544,13 @@ let O = class extends te {
544
544
  * @param {string[]} ruleIds - The rule IDs of the range protection to be removed.
545
545
  */
546
546
  removeRangeProtection(e, t, n) {
547
- this._commandService.syncExecuteCommand(tt.id, {
547
+ this._commandService.syncExecuteCommand(ut.id, {
548
548
  unitId: e,
549
549
  subUnitId: t,
550
550
  ruleIds: n
551
- }) && this._rangeProtectionRuleModel.getSubunitRuleList(e, t).length === 0 && (this._worksheetProtectionPointRuleModel.deleteRule(e, t), [...ae()].forEach((i) => {
552
- const a = new i(e, t);
553
- this._permissionService.updatePermissionPoint(a.id, a.value);
551
+ }) && this._rangeProtectionRuleModel.getSubunitRuleList(e, t).length === 0 && (this._worksheetProtectionPointRuleModel.deleteRule(e, t), [..._e()].forEach((o) => {
552
+ const h = new o(e, t);
553
+ this._permissionService.updatePermissionPoint(h.id, h.value);
554
554
  }));
555
555
  }
556
556
  /**
@@ -562,9 +562,9 @@ let O = class extends te {
562
562
  * See the [permission-point documentation](https://github.com/dream-num/univer/tree/dev/packages/sheets/src/services/permission/permission-point) for more details.
563
563
  * @param {boolean} value - The new permission value to be set for the range (e.g., true for allowing access, false for restricting access).
564
564
  */
565
- setRangeProtectionPermissionPoint(e, t, n, r, o) {
566
- const i = new r(e, t, n);
567
- this._permissionService.getPermissionPoint(i.id) || this._permissionService.addPermissionPoint(i), this._permissionService.updatePermissionPoint(i.id, o);
565
+ setRangeProtectionPermissionPoint(e, t, n, s, i) {
566
+ const o = new s(e, t, n);
567
+ this._permissionService.getPermissionPoint(o.id) || this._permissionService.addPermissionPoint(o), this._permissionService.updatePermissionPoint(o.id, i);
568
568
  }
569
569
  /**
570
570
  * Sets the ranges for range protection in a worksheet.
@@ -577,228 +577,328 @@ let O = class extends te {
577
577
  * @param {string} ruleId - The ruleId of the range protection rule that is being updated.
578
578
  * @param {IRange[]} ranges - The array of new ranges to be set for the range protection rule.
579
579
  */
580
- setRangeProtectionRanges(e, t, n, r) {
581
- const o = this._rangeProtectionRuleModel.getRule(e, t, n);
582
- if (o) {
583
- if (this._rangeProtectionRuleModel.getSubunitRuleList(e, t).filter((h) => h.id !== n).some((h) => h.ranges.some((c) => r.some((d) => N.intersects(d, c)))))
580
+ setRangeProtectionRanges(e, t, n, s) {
581
+ const i = this._rangeProtectionRuleModel.getRule(e, t, n);
582
+ if (i) {
583
+ if (this._rangeProtectionRuleModel.getSubunitRuleList(e, t).filter((a) => a.id !== n).some((a) => a.ranges.some((d) => s.some((c) => M.intersects(c, d)))))
584
584
  throw new Error("range protection cannot intersect");
585
- this._commandService.syncExecuteCommand(nt.id, {
585
+ this._commandService.syncExecuteCommand(gt.id, {
586
586
  unitId: e,
587
587
  subUnitId: t,
588
588
  ruleId: n,
589
589
  rule: {
590
- ...o,
591
- ranges: r
590
+ ...i,
591
+ ranges: s
592
592
  }
593
593
  });
594
594
  }
595
595
  }
596
596
  };
597
- O = zt([
598
- v(0, u(b)),
599
- v(1, l),
600
- v(2, ee),
601
- v(3, u(Ee)),
602
- v(4, u(Pe)),
603
- v(5, u(xe)),
604
- v(6, u(ve))
605
- ], O);
606
- function $t(s) {
607
- switch (s) {
597
+ j = Qt([
598
+ R(0, u(y)),
599
+ R(1, l),
600
+ R(2, ae),
601
+ R(3, u(Fe)),
602
+ R(4, u(je)),
603
+ R(5, u(Oe)),
604
+ R(6, u(Ne))
605
+ ], j);
606
+ function Xt(r) {
607
+ switch (r) {
608
608
  case "left":
609
- return y.LEFT;
609
+ return U.LEFT;
610
610
  case "center":
611
- return y.CENTER;
611
+ return U.CENTER;
612
612
  case "normal":
613
- return y.RIGHT;
613
+ return U.RIGHT;
614
614
  default:
615
- throw new Error(`Invalid horizontal alignment: ${s}`);
615
+ throw new Error(`Invalid horizontal alignment: ${r}`);
616
616
  }
617
617
  }
618
- function Ht(s) {
619
- switch (s) {
620
- case y.LEFT:
618
+ function Zt(r) {
619
+ switch (r) {
620
+ case U.LEFT:
621
621
  return "left";
622
- case y.CENTER:
622
+ case U.CENTER:
623
623
  return "center";
624
- case y.RIGHT:
624
+ case U.RIGHT:
625
625
  return "normal";
626
626
  default:
627
- throw new Error(`Invalid horizontal alignment: ${s}`);
627
+ throw new Error(`Invalid horizontal alignment: ${r}`);
628
628
  }
629
629
  }
630
- function Gt(s) {
631
- switch (s) {
630
+ function en(r) {
631
+ switch (r) {
632
632
  case "top":
633
- return U.TOP;
633
+ return P.TOP;
634
634
  case "middle":
635
- return U.MIDDLE;
635
+ return P.MIDDLE;
636
636
  case "bottom":
637
- return U.BOTTOM;
637
+ return P.BOTTOM;
638
638
  default:
639
- throw new Error(`Invalid vertical alignment: ${s}`);
639
+ throw new Error(`Invalid vertical alignment: ${r}`);
640
640
  }
641
641
  }
642
- function qt(s) {
643
- switch (s) {
644
- case U.TOP:
642
+ function tn(r) {
643
+ switch (r) {
644
+ case P.TOP:
645
645
  return "top";
646
- case U.MIDDLE:
646
+ case P.MIDDLE:
647
647
  return "middle";
648
- case U.BOTTOM:
648
+ case P.BOTTOM:
649
649
  return "bottom";
650
650
  default:
651
- throw new Error(`Invalid vertical alignment: ${s}`);
651
+ throw new Error(`Invalid vertical alignment: ${r}`);
652
652
  }
653
653
  }
654
- function V(s) {
655
- return je(s) ? {
656
- f: s
657
- } : Oe(s) ? {
658
- v: s
659
- } : (Ve(s), s);
654
+ function O(r) {
655
+ return Ke(r) ? {
656
+ f: r,
657
+ v: null,
658
+ p: null
659
+ } : Ye(r) ? {
660
+ v: r,
661
+ p: null,
662
+ f: null
663
+ } : (Je(r), r);
660
664
  }
661
- function Ie(s, e) {
662
- const t = new A(), { startRow: n, startColumn: r, endRow: o, endColumn: i } = e;
663
- if (Be.isArray(s))
664
- for (let a = 0; a <= o - n; a++)
665
- for (let h = 0; h <= i - r; h++)
666
- t.setValue(a + n, h + r, V(s[a][h]));
665
+ function Pe(r, e) {
666
+ const t = new W(), { startRow: n, startColumn: s, endRow: i, endColumn: o } = e;
667
+ if (Qe.isArray(r))
668
+ for (let h = 0; h <= i - n; h++)
669
+ for (let a = 0; a <= o - s; a++)
670
+ t.setValue(h + n, a + s, O(r[h][a]));
667
671
  else
668
- new A(s).forValue((h, c, d) => {
669
- t.setValue(h, c, V(d));
672
+ new W(r).forValue((a, d, c) => {
673
+ t.setValue(a, d, O(c));
670
674
  });
671
675
  return t.getMatrix();
672
676
  }
673
- function q(s, e) {
677
+ function G(r, e) {
674
678
  return {
675
- startRow: s.startRow,
676
- endRow: s.endRow,
679
+ startRow: r.startRow,
680
+ endRow: r.endRow,
677
681
  startColumn: 0,
678
682
  endColumn: e.getColumnCount() - 1,
679
683
  rangeType: _.ROW
680
684
  };
681
685
  }
682
- function K(s, e) {
686
+ function q(r, e) {
683
687
  return {
684
688
  startRow: 0,
685
689
  endRow: e.getRowCount() - 1,
686
- startColumn: s.startColumn,
687
- endColumn: s.endColumn,
690
+ startColumn: r.startColumn,
691
+ endColumn: r.endColumn,
688
692
  rangeType: _.COLUMN
689
693
  };
690
694
  }
691
- var Kt = Object.defineProperty, Yt = Object.getOwnPropertyDescriptor, Jt = (s, e, t, n) => {
692
- for (var r = n > 1 ? void 0 : n ? Yt(e, t) : e, o = s.length - 1, i; o >= 0; o--)
693
- (i = s[o]) && (r = (n ? i(e, t, r) : i(r)) || r);
694
- return n && r && Kt(e, t, r), r;
695
- }, Y = (s, e) => (t, n) => e(t, n, s);
696
- let w = class extends ne {
697
- constructor(s, e, t, n, r, o) {
698
- super(n), this._workbook = s, this._worksheet = e, this._range = t, this._injector = n, this._commandService = r, this._formulaDataModel = o;
695
+ var nn = Object.defineProperty, rn = Object.getOwnPropertyDescriptor, sn = (r, e, t, n) => {
696
+ for (var s = n > 1 ? void 0 : n ? rn(e, t) : e, i = r.length - 1, o; i >= 0; i--)
697
+ (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
698
+ return n && s && nn(e, t, s), s;
699
+ }, K = (r, e) => (t, n) => e(t, n, r);
700
+ let S = class extends ce {
701
+ constructor(r, e, t, n, s, i) {
702
+ super(n), this._workbook = r, this._worksheet = e, this._range = t, this._injector = n, this._commandService = s, this._formulaDataModel = i;
699
703
  }
700
704
  /**
701
705
  * Get the unit ID of the current workbook
702
- * @returns The unit ID of the workbook
706
+ * @returns {string} The unit ID of the workbook
707
+ * @example
708
+ * ```ts
709
+ * univerAPI.getActiveWorkbook()
710
+ * .getActiveSheet()
711
+ * .getActiveRange()
712
+ * .getUnitId()
713
+ * ```
703
714
  */
704
715
  getUnitId() {
705
716
  return this._workbook.getUnitId();
706
717
  }
707
718
  /**
708
719
  * Gets the name of the worksheet
709
- * @returns The name of the worksheet
720
+ * @returns {string} The name of the worksheet
721
+ * @example
722
+ * ```ts
723
+ * univerAPI.getActiveWorkbook()
724
+ * .getActiveSheet()
725
+ * .getActiveRange()
726
+ * .getSheetName()
727
+ * ```
710
728
  */
711
729
  getSheetName() {
712
730
  return this._worksheet.getName();
713
731
  }
714
732
  /**
715
733
  * Gets the ID of the worksheet
716
- * @returns The ID of the worksheet
734
+ * @returns {string} The ID of the worksheet
735
+ * @example
736
+ * ```ts
737
+ * univerAPI.getActiveWorkbook()
738
+ * .getActiveSheet()
739
+ * .getActiveRange()
740
+ * .getSheetId()
741
+ * ```
717
742
  */
718
743
  getSheetId() {
719
744
  return this._worksheet.getSheetId();
720
745
  }
721
746
  /**
722
747
  * Gets the area where the statement is applied
723
- * @returns The area where the statement is applied
748
+ * @returns {IRange} The area where the statement is applied
749
+ * @example
750
+ * ```ts
751
+ * univerAPI.getActiveWorkbook()
752
+ * .getActiveSheet()
753
+ * .getActiveRange()
754
+ * .getRange()
755
+ * ```
724
756
  */
725
757
  getRange() {
726
758
  return this._range;
727
759
  }
728
760
  /**
729
761
  * Gets the starting row number of the applied area
730
- * @returns The starting row number of the area
762
+ * @returns {number} The starting row number of the area
763
+ * @example
764
+ * ```ts
765
+ * univerAPI.getActiveWorkbook()
766
+ * .getActiveSheet()
767
+ * .getActiveRange()
768
+ * .getRow()
769
+ * ```
731
770
  */
732
771
  getRow() {
733
772
  return this._range.startRow;
734
773
  }
735
774
  /**
736
775
  * Gets the starting column number of the applied area
737
- * @returns The starting column number of the area
776
+ * @returns {number} The starting column number of the area
777
+ * @example
778
+ * ```ts
779
+ * univerAPI.getActiveWorkbook()
780
+ * .getActiveSheet()
781
+ * .getActiveRange()
782
+ * .getColumn()
783
+ * ```
738
784
  */
739
785
  getColumn() {
740
786
  return this._range.startColumn;
741
787
  }
742
788
  /**
743
789
  * Gets the width of the applied area
744
- * @returns The width of the area
790
+ * @returns {number} The width of the area
791
+ * @example
792
+ * ```ts
793
+ * univerAPI.getActiveWorkbook()
794
+ * .getActiveSheet()
795
+ * .getActiveRange()
796
+ * .getWidth()
797
+ * ```
745
798
  */
746
799
  getWidth() {
747
800
  return this._range.endColumn - this._range.startColumn + 1;
748
801
  }
749
802
  /**
750
803
  * Gets the height of the applied area
751
- * @returns The height of the area
804
+ * @returns {number} The height of the area
805
+ * @example
806
+ * ```ts
807
+ * univerAPI.getActiveWorkbook()
808
+ * .getActiveSheet()
809
+ * .getActiveRange()
810
+ * .getHeight()
811
+ * ```
752
812
  */
753
813
  getHeight() {
754
814
  return this._range.endRow - this._range.startRow + 1;
755
815
  }
756
816
  /**
757
817
  * Return range whether this range is merged
758
- * @returns if true is merged
818
+ * @returns {boolean} if true is merged
819
+ * @example
820
+ * ```ts
821
+ * univerAPI.getActiveWorkbook()
822
+ * .getActiveSheet()
823
+ * .getActiveRange()
824
+ * .isMerged()
825
+ * ```
759
826
  */
760
827
  isMerged() {
761
- const { startColumn: s, startRow: e, endColumn: t, endRow: n } = this._range;
762
- return this._worksheet.getMergedCellRange(e, s, n, t).some((o) => N.equals(o, this._range));
828
+ const { startColumn: r, startRow: e, endColumn: t, endRow: n } = this._range;
829
+ return this._worksheet.getMergedCellRange(e, r, n, t).some((i) => M.equals(i, this._range));
763
830
  }
764
831
  /**
765
832
  * Return first cell style data in this range
766
833
  * @returns {IStyleData | null} The cell style data
834
+ * @example
835
+ * ```ts
836
+ * univerAPI.getActiveWorkbook()
837
+ * .getActiveSheet()
838
+ * .getActiveRange()
839
+ * .getCellStyleData()
840
+ * ```
767
841
  */
768
842
  getCellStyleData() {
769
843
  var t;
770
- const s = this.getCellData(), e = this._workbook.getStyles();
771
- return s && e && (t = e.getStyleByCell(s)) != null ? t : null;
844
+ const r = this.getCellData(), e = this._workbook.getStyles();
845
+ return r && e && (t = e.getStyleByCell(r)) != null ? t : null;
772
846
  }
773
847
  /**
774
- * Returns the value of the cell at the start of this range.
775
- * @returns {CellValue | null} The value of the cell.
848
+ * Return first cell style in this range
849
+ * @returns {TextStyleValue | null} The cell style
850
+ * @example
851
+ * ```ts
852
+ * univerAPI.getActiveWorkbook()
853
+ * .getActiveSheet()
854
+ * .getActiveRange()
855
+ * .getCellStyle()
856
+ * ```
776
857
  */
777
- getValue() {
778
- var s, e;
779
- return (e = (s = this._worksheet.getCell(this._range.startRow, this._range.startColumn)) == null ? void 0 : s.v) != null ? e : null;
858
+ getCellStyle() {
859
+ const r = this.getCellStyleData();
860
+ return r ? le.create(r) : null;
780
861
  }
781
862
  /**
782
- * Returns the rectangular grid of values for this range.
783
- * Returns a two-dimensional array of values, indexed by row, then by column.
784
- * @returns {Nullable<CellValue>[][]} A two-dimensional array of values.
863
+ * Returns the cell styles for the cells in the range.
864
+ * @returns {Array<Array<TextStyleValue | null>>} A two-dimensional array of cell styles.
865
+ * @example
866
+ * ```ts
867
+ * univerAPI.getActiveWorkbook()
868
+ * .getActiveSheet()
869
+ * .getActiveRange()
870
+ * .getCellStyles()
871
+ * ```
785
872
  */
786
- getValues() {
787
- var o, i;
788
- const { startRow: s, endRow: e, startColumn: t, endColumn: n } = this._range, r = [];
789
- for (let a = s; a <= e; a++) {
790
- const h = [];
791
- for (let c = t; c <= n; c++)
792
- h.push((i = (o = this._worksheet.getCell(a, c)) == null ? void 0 : o.v) != null ? i : null);
793
- r.push(h);
873
+ getCellStyles() {
874
+ const r = this.getCellDatas(), e = this._workbook.getStyles();
875
+ return r.map((t) => t.map((n) => {
876
+ if (!n) return null;
877
+ const s = e.getStyleByCell(n);
878
+ return s ? le.create(s) : null;
879
+ }));
880
+ }
881
+ getValue(r) {
882
+ var e, t;
883
+ return r ? this.getValueAndRichTextValue() : (t = (e = this._worksheet.getCell(this._range.startRow, this._range.startColumn)) == null ? void 0 : e.v) != null ? t : null;
884
+ }
885
+ getValues(r) {
886
+ var o, h;
887
+ r && this.getValueAndRichTextValues();
888
+ const { startRow: e, endRow: t, startColumn: n, endColumn: s } = this._range, i = [];
889
+ for (let a = e; a <= t; a++) {
890
+ const d = [];
891
+ for (let c = n; c <= s; c++)
892
+ d.push((h = (o = this._worksheet.getCell(a, c)) == null ? void 0 : o.v) != null ? h : null);
893
+ i.push(d);
794
894
  }
795
- return r;
895
+ return i;
796
896
  }
797
897
  /**
798
898
  * Return first cell model data in this range
799
899
  * @returns {ICellData | null} The cell model data
800
900
  * @example
801
- * ```
901
+ * ```ts
802
902
  * univerAPI.getActiveWorkbook()
803
903
  * .getActiveSheet()
804
904
  * .getActiveRange()
@@ -806,14 +906,14 @@ let w = class extends ne {
806
906
  * ```
807
907
  */
808
908
  getCellData() {
809
- var s;
810
- return (s = this._worksheet.getCell(this._range.startRow, this._range.startColumn)) != null ? s : null;
909
+ var r;
910
+ return (r = this._worksheet.getCell(this._range.startRow, this._range.startColumn)) != null ? r : null;
811
911
  }
812
912
  /**
813
- * Returns the cell data for the cells in the range.
913
+ * Alias for getCellDataGrid.
814
914
  * @returns {Nullable<ICellData>[][]} A two-dimensional array of cell data.
815
915
  * @example
816
- * ```
916
+ * ```ts
817
917
  * univerAPI.getActiveWorkbook()
818
918
  * .getActiveSheet()
819
919
  * .getActiveRange()
@@ -821,26 +921,36 @@ let w = class extends ne {
821
921
  * ```
822
922
  */
823
923
  getCellDatas() {
824
- const { startRow: s, endRow: e, startColumn: t, endColumn: n } = this._range, r = [];
825
- for (let o = s; o <= e; o++) {
826
- const i = [];
827
- for (let a = t; a <= n; a++)
828
- i.push(this._worksheet.getCellRaw(o, a));
829
- r.push(i);
830
- }
831
- return r;
924
+ return this.getCellDataGrid();
832
925
  }
833
926
  /**
834
- * @deprecated use `getCellDatas` instead.
927
+ * Returns the cell data for the cells in the range.
928
+ * @returns {Nullable<ICellData>[][]} A two-dimensional array of cell data.
929
+ * @example
930
+ * ```ts
931
+ * univerAPI.getActiveWorkbook()
932
+ * .getActiveSheet()
933
+ * .getActiveRange()
934
+ * .getCellDataGrid()
935
+ * ```
835
936
  */
836
937
  getCellDataGrid() {
837
- return this.getCellDatas();
938
+ const { startRow: r, endRow: e, startColumn: t, endColumn: n } = this._range, s = [];
939
+ for (let i = r; i <= e; i++) {
940
+ const o = [];
941
+ for (let h = t; h <= n; h++)
942
+ o.push(this._worksheet.getCellRaw(i, h));
943
+ s.push(o);
944
+ }
945
+ return s;
838
946
  }
839
947
  /**
840
948
  * Returns the rich text value for the cell at the start of this range.
841
949
  * @returns {Nullable<RichTextValue>} The rich text value
950
+ * @internal
951
+ * @beta
842
952
  * @example
843
- * ```
953
+ * ```ts
844
954
  * univerAPI.getActiveWorkbook()
845
955
  * .getActiveSheet()
846
956
  * .getActiveRange()
@@ -848,14 +958,16 @@ let w = class extends ne {
848
958
  * ```
849
959
  */
850
960
  getRichTextValue() {
851
- const s = this.getCellData();
852
- return s != null && s.p ? new p(s.p) : null;
961
+ const r = this.getCellData();
962
+ return r != null && r.p ? new E(r.p) : null;
853
963
  }
854
964
  /**
855
965
  * Returns the rich text value for the cells in the range.
856
966
  * @returns {Nullable<RichTextValue>[][]} A two-dimensional array of RichTextValue objects.
967
+ * @internal
968
+ * @beta
857
969
  * @example
858
- * ```
970
+ * ```ts
859
971
  * univerAPI.getActiveWorkbook()
860
972
  * .getActiveSheet()
861
973
  * .getActiveRange()
@@ -863,13 +975,15 @@ let w = class extends ne {
863
975
  * ```
864
976
  */
865
977
  getRichTextValues() {
866
- return this.getCellDataGrid().map((e) => e.map((t) => t != null && t.p ? new p(t.p) : null));
978
+ return this.getCellDataGrid().map((e) => e.map((t) => t != null && t.p ? new E(t.p) : null));
867
979
  }
868
980
  /**
869
981
  * Returns the value and rich text value for the cell at the start of this range.
870
982
  * @returns {Nullable<CellValue | RichTextValue>} The value and rich text value
983
+ * @internal
984
+ * @beta
871
985
  * @example
872
- * ```
986
+ * ```ts
873
987
  * univerAPI.getActiveWorkbook()
874
988
  * .getActiveSheet()
875
989
  * .getActiveRange()
@@ -877,14 +991,14 @@ let w = class extends ne {
877
991
  * ```
878
992
  */
879
993
  getValueAndRichTextValue() {
880
- const s = this.getCellData();
881
- return s != null && s.p ? new p(s.p) : s == null ? void 0 : s.v;
994
+ const r = this.getCellData();
995
+ return r != null && r.p ? new E(r.p) : r == null ? void 0 : r.v;
882
996
  }
883
997
  /**
884
998
  * Returns the value and rich text value for the cells in the range.
885
999
  * @returns {Nullable<CellValue | RichTextValue>[][]} A two-dimensional array of value and rich text value
886
1000
  * @example
887
- * ```
1001
+ * ```ts
888
1002
  * univerAPI.getActiveWorkbook()
889
1003
  * .getActiveSheet()
890
1004
  * .getActiveRange()
@@ -892,7 +1006,7 @@ let w = class extends ne {
892
1006
  * ```
893
1007
  */
894
1008
  getValueAndRichTextValues() {
895
- return this.getCellDatas().map((e) => e.map((t) => t != null && t.p ? new p(t.p) : t == null ? void 0 : t.v));
1009
+ return this.getCellDatas().map((e) => e.map((t) => t != null && t.p ? new E(t.p) : t == null ? void 0 : t.v));
896
1010
  }
897
1011
  /**
898
1012
  * Returns the formulas (A1 notation) for the cells in the range. Entries in the 2D array are empty strings for cells with no formula.
@@ -906,28 +1020,72 @@ let w = class extends ne {
906
1020
  * ```
907
1021
  */
908
1022
  getFormulas() {
909
- const s = [], { startRow: e, endRow: t, startColumn: n, endColumn: r } = this._range, o = this._worksheet.getSheetId(), i = this._workbook.getUnitId();
910
- for (let a = e; a <= t; a++) {
911
- const h = [];
912
- for (let c = n; c <= r; c++) {
913
- const d = this._formulaDataModel.getFormulaStringByCell(a, c, o, i);
914
- h.push(d || "");
1023
+ const r = [], { startRow: e, endRow: t, startColumn: n, endColumn: s } = this._range, i = this._worksheet.getSheetId(), o = this._workbook.getUnitId();
1024
+ for (let h = e; h <= t; h++) {
1025
+ const a = [];
1026
+ for (let d = n; d <= s; d++) {
1027
+ const c = this._formulaDataModel.getFormulaStringByCell(h, d, i, o);
1028
+ a.push(c || "");
915
1029
  }
916
- s.push(h);
1030
+ r.push(a);
917
1031
  }
918
- return s;
1032
+ return r;
919
1033
  }
1034
+ /**
1035
+ * Returns true if the cell wrap is enabled
1036
+ * @returns {boolean} True if the cell wrap is enabled
1037
+ * @example
1038
+ * ```ts
1039
+ * univerAPI.getActiveWorkbook()
1040
+ * .getActiveSheet()
1041
+ * .getActiveRange()
1042
+ * .getWrap()
1043
+ * ```
1044
+ */
920
1045
  getWrap() {
921
- return this._worksheet.getRange(this._range).getWrap() === m.TRUE;
1046
+ return this._worksheet.getRange(this._range).getWrap() === g.TRUE;
922
1047
  }
1048
+ /**
1049
+ * Returns the text wrapping strategy for the top left cell of the range.
1050
+ * @returns {WrapStrategy} The text wrapping strategy
1051
+ * @example
1052
+ * ```ts
1053
+ * univerAPI.getActiveWorkbook()
1054
+ * .getActiveSheet()
1055
+ * .getActiveRange()
1056
+ * .getWrapStrategy()
1057
+ * ```
1058
+ */
923
1059
  getWrapStrategy() {
924
1060
  return this._worksheet.getRange(this._range).getWrapStrategy();
925
1061
  }
1062
+ /**
1063
+ * Returns the horizontal alignment for the top left cell of the range.
1064
+ * @returns {string} The horizontal alignment
1065
+ * @example
1066
+ * ```ts
1067
+ * univerAPI.getActiveWorkbook()
1068
+ * .getActiveSheet()
1069
+ * .getActiveRange()
1070
+ * .getHorizontalAlignment()
1071
+ * ```
1072
+ */
926
1073
  getHorizontalAlignment() {
927
- return Ht(this._worksheet.getRange(this._range).getHorizontalAlignment());
1074
+ return Zt(this._worksheet.getRange(this._range).getHorizontalAlignment());
928
1075
  }
1076
+ /**
1077
+ * Returns the vertical alignment for the top left cell of the range.
1078
+ * @returns {string} The vertical alignment
1079
+ * @example
1080
+ * ```ts
1081
+ * univerAPI.getActiveWorkbook()
1082
+ * .getActiveSheet()
1083
+ * .getActiveRange()
1084
+ * .getVerticalAlignment()
1085
+ * ```
1086
+ */
929
1087
  getVerticalAlignment() {
930
- return qt(this._worksheet.getRange(this._range).getVerticalAlignment());
1088
+ return tn(this._worksheet.getRange(this._range).getVerticalAlignment());
931
1089
  }
932
1090
  /**
933
1091
  * Set custom meta data for first cell in current range.
@@ -940,9 +1098,9 @@ let w = class extends ne {
940
1098
  * .setCustomMetaData({ key: 'value' });
941
1099
  * ```
942
1100
  */
943
- setCustomMetaData(s) {
1101
+ setCustomMetaData(r) {
944
1102
  return this.setValue({
945
- custom: s
1103
+ custom: r
946
1104
  });
947
1105
  }
948
1106
  /**
@@ -956,8 +1114,8 @@ let w = class extends ne {
956
1114
  * .setCustomMetaDatas([[{ key: 'value' }]]);
957
1115
  * ```
958
1116
  */
959
- setCustomMetaDatas(s) {
960
- return this.setValues(s.map((e) => e.map((t) => ({ custom: t }))));
1117
+ setCustomMetaDatas(r) {
1118
+ return this.setValues(r.map((e) => e.map((t) => ({ custom: t }))));
961
1119
  }
962
1120
  /**
963
1121
  * Returns the custom meta data for the cell at the start of this range.
@@ -972,8 +1130,8 @@ let w = class extends ne {
972
1130
  */
973
1131
  getCustomMetaData() {
974
1132
  var e;
975
- const s = this.getCellData();
976
- return (e = s == null ? void 0 : s.custom) != null ? e : null;
1133
+ const r = this.getCellData();
1134
+ return (e = r == null ? void 0 : r.custom) != null ? e : null;
977
1135
  }
978
1136
  /**
979
1137
  * Returns the custom meta data for the cells in the range.
@@ -992,51 +1150,85 @@ let w = class extends ne {
992
1150
  return (n = t == null ? void 0 : t.custom) != null ? n : null;
993
1151
  }));
994
1152
  }
1153
+ /**
1154
+ * Sets basic border properties for the current range.
1155
+ * @param {BorderType} type The type of border to apply
1156
+ * @param {BorderStyleTypes} style The border style
1157
+ * @param {string} [color] Optional border color in CSS notation
1158
+ * @returns {FRange} This range, for chaining
1159
+ * @example
1160
+ * ```ts
1161
+ * univerAPI.getActiveWorkbook()
1162
+ * .getActiveSheet()
1163
+ * .getActiveRange()
1164
+ * .setBorder(BorderType.ALL, BorderStyleType.THIN, '#ff0000');
1165
+ * ```
1166
+ */
1167
+ setBorder(r, e, t) {
1168
+ return this._commandService.syncExecuteCommand(_t.id, {
1169
+ unitId: this._workbook.getUnitId(),
1170
+ subUnitId: this._worksheet.getSheetId(),
1171
+ value: {
1172
+ type: r,
1173
+ style: e,
1174
+ color: t
1175
+ }
1176
+ }), this;
1177
+ }
995
1178
  // #region editing
996
1179
  /**
997
1180
  * Set background color for current range.
998
- * @param color {string}
1181
+ * @param {string} color The background color
1182
+ * @returns {FRange} This range, for chaining
999
1183
  * @example
1000
- * ```
1184
+ * ```ts
1001
1185
  * univerAPI.getActiveWorkbook()
1002
1186
  * .getActiveSheet()
1003
1187
  * .getActiveRange()
1004
1188
  * .setBackgroundColor('red')
1005
1189
  * ```
1006
1190
  */
1007
- setBackgroundColor(s) {
1008
- return this._commandService.syncExecuteCommand(f.id, {
1191
+ setBackgroundColor(r) {
1192
+ return this._commandService.syncExecuteCommand(I.id, {
1009
1193
  unitId: this._workbook.getUnitId(),
1010
1194
  subUnitId: this._worksheet.getSheetId(),
1011
1195
  range: this._range,
1012
1196
  style: {
1013
1197
  type: "bg",
1014
1198
  value: {
1015
- rgb: s
1199
+ rgb: r
1016
1200
  }
1017
1201
  }
1018
1202
  }), this;
1019
1203
  }
1020
1204
  /**
1021
1205
  * Set background color for current range.
1206
+ * @param {string} color The background color
1207
+ * @returns {FRange} This range, for chaining
1022
1208
  * @example
1023
1209
  * ```typescript
1024
1210
  * univerAPI.getActiveWorkbook().getActiveSheet().getActiveRange().setBackground('red')
1025
1211
  * ```
1026
- * @param color {string}
1027
1212
  */
1028
- setBackground(s) {
1029
- return this.setBackgroundColor(s), this;
1213
+ setBackground(r) {
1214
+ return this.setBackgroundColor(r), this;
1030
1215
  }
1031
1216
  /**
1032
1217
  * Set new value for current cell, first cell in this range.
1033
1218
  * @param {CellValue | ICellData} value The value can be a number, string, boolean, or standard cell format. If it begins with `=`, it is interpreted as a formula. The value is tiled to all cells in the range.
1219
+ * @returns {FRange} This range, for chaining
1220
+ * ```ts
1221
+ * univerAPI.getActiveWorkbook()
1222
+ * .getActiveSheet()
1223
+ * .getActiveRange()
1224
+ * .setValue(1);
1225
+ * ```
1034
1226
  */
1035
- setValue(s) {
1036
- const e = V(s);
1227
+ setValue(r) {
1228
+ const e = O(r);
1037
1229
  if (!e)
1038
1230
  throw new Error("Invalid value");
1039
- return this._commandService.syncExecuteCommand(P.id, {
1231
+ return this._commandService.syncExecuteCommand(N.id, {
1040
1232
  unitId: this._workbook.getUnitId(),
1041
1233
  subUnitId: this._worksheet.getSheetId(),
1042
1234
  range: this._range,
@@ -1046,6 +1238,7 @@ let w = class extends ne {
1046
1238
  /**
1047
1239
  * Set new value for current cell, first cell in this range.
1048
1240
  * @param {CellValue | ICellData} value The value can be a number, string, boolean, or standard cell format. If it begins with `=`, it is interpreted as a formula. The value is tiled to all cells in the range.
1241
+ * @returns {FRange} This range, for chaining
1049
1242
  * ```ts
1050
1243
  * univerAPI.getActiveWorkbook()
1051
1244
  * .getActiveSheet()
@@ -1053,11 +1246,11 @@ let w = class extends ne {
1053
1246
  * .setValueForCell(1);
1054
1247
  * ```
1055
1248
  */
1056
- setValueForCell(s) {
1057
- const e = V(s);
1249
+ setValueForCell(r) {
1250
+ const e = O(r);
1058
1251
  if (!e)
1059
1252
  throw new Error("Invalid value");
1060
- return this._commandService.syncExecuteCommand(P.id, {
1253
+ return this._commandService.syncExecuteCommand(N.id, {
1061
1254
  unitId: this._workbook.getUnitId(),
1062
1255
  subUnitId: this._worksheet.getSheetId(),
1063
1256
  range: {
@@ -1081,8 +1274,8 @@ let w = class extends ne {
1081
1274
  * .setRichTextValueForCell(new RichTextValue().insertText('Hello'));
1082
1275
  * ```
1083
1276
  */
1084
- setRichTextValueForCell(s) {
1085
- const e = s instanceof p ? s.getData() : s, t = {
1277
+ setRichTextValueForCell(r) {
1278
+ const e = r instanceof E ? r.getData() : r, t = {
1086
1279
  unitId: this._workbook.getUnitId(),
1087
1280
  subUnitId: this._worksheet.getSheetId(),
1088
1281
  range: {
@@ -1093,7 +1286,7 @@ let w = class extends ne {
1093
1286
  },
1094
1287
  value: { p: e }
1095
1288
  };
1096
- return this._commandService.syncExecuteCommand(P.id, t), this;
1289
+ return this._commandService.syncExecuteCommand(N.id, t), this;
1097
1290
  }
1098
1291
  /**
1099
1292
  * Set the rich text value for the cells in the range.
@@ -1108,71 +1301,111 @@ let w = class extends ne {
1108
1301
  * .setRichTextValues([[new RichTextValue().insertText('Hello')]]);
1109
1302
  * ```
1110
1303
  */
1111
- setRichTextValues(s) {
1112
- const e = s.map((r) => r.map((o) => o && { p: o instanceof p ? o.getData() : o })), t = Ie(e, this._range), n = {
1304
+ setRichTextValues(r) {
1305
+ const e = r.map((s) => s.map((i) => i && { p: i instanceof E ? i.getData() : i })), t = Pe(e, this._range), n = {
1113
1306
  unitId: this._workbook.getUnitId(),
1114
1307
  subUnitId: this._worksheet.getSheetId(),
1115
1308
  range: this._range,
1116
1309
  value: t
1117
1310
  };
1118
- return this._commandService.syncExecuteCommand(P.id, n), this;
1311
+ return this._commandService.syncExecuteCommand(N.id, n), this;
1119
1312
  }
1120
1313
  /**
1121
1314
  * Set the cell wrap of the given range.
1122
1315
  * 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.
1123
- * @param isWrapEnabled
1316
+ * @param {boolean} isWrapEnabled Whether to enable wrap
1317
+ * @returns {FRange} this range, for chaining
1318
+ * @example
1319
+ * ```ts
1320
+ * univerAPI.getActiveWorkbook()
1321
+ * .getActiveSheet()
1322
+ * .getActiveRange()
1323
+ * .setWrap(true);
1324
+ * ```
1124
1325
  */
1125
- setWrap(s) {
1126
- return this._commandService.syncExecuteCommand(he.id, {
1326
+ setWrap(r) {
1327
+ return this._commandService.syncExecuteCommand(Z.id, {
1127
1328
  unitId: this._workbook.getUnitId(),
1128
1329
  subUnitId: this._worksheet.getSheetId(),
1129
1330
  range: this._range,
1130
- value: s ? oe.WRAP : oe.UNSPECIFIED
1331
+ value: r ? Y.WRAP : Y.UNSPECIFIED
1131
1332
  }), this;
1132
1333
  }
1133
1334
  /**
1134
1335
  * Sets the text wrapping strategy for the cells in the range.
1135
- * @param strategy
1336
+ * @param {WrapStrategy} strategy The text wrapping strategy
1337
+ * @returns {FRange} this range, for chaining
1338
+ * @example
1339
+ * ```ts
1340
+ * univerAPI.getActiveWorkbook()
1341
+ * .getActiveSheet()
1342
+ * .getActiveRange()
1343
+ * .setWrapStrategy(WrapStrategy.WRAP);
1344
+ * ```
1136
1345
  */
1137
- setWrapStrategy(s) {
1138
- return this._commandService.syncExecuteCommand(he.id, {
1346
+ setWrapStrategy(r) {
1347
+ return this._commandService.syncExecuteCommand(Z.id, {
1139
1348
  unitId: this._workbook.getUnitId(),
1140
1349
  subUnitId: this._worksheet.getSheetId(),
1141
1350
  range: this._range,
1142
- value: s
1351
+ value: r
1143
1352
  }), this;
1144
1353
  }
1145
1354
  /**
1146
1355
  * Set the vertical (top to bottom) alignment for the given range (top/middle/bottom).
1147
- * @param alignment
1356
+ * @param {"top" | "middle" | "bottom"} alignment The vertical alignment
1357
+ * @returns {FRange} this range, for chaining
1358
+ * @example
1359
+ * ```ts
1360
+ * univerAPI.getActiveWorkbook()
1361
+ * .getActiveSheet()
1362
+ * .getActiveRange()
1363
+ * .setVerticalAlignment('top');
1364
+ * ```
1148
1365
  */
1149
- setVerticalAlignment(s) {
1150
- return this._commandService.syncExecuteCommand(ot.id, {
1366
+ setVerticalAlignment(r) {
1367
+ return this._commandService.syncExecuteCommand(kt.id, {
1151
1368
  unitId: this._workbook.getUnitId(),
1152
1369
  subUnitId: this._worksheet.getSheetId(),
1153
1370
  range: this._range,
1154
- value: Gt(s)
1371
+ value: en(r)
1155
1372
  }), this;
1156
1373
  }
1157
1374
  /**
1158
1375
  * Set the horizontal (left to right) alignment for the given range (left/center/right).
1159
- * @param alignment
1376
+ * @param {"left" | "center" | "normal"} alignment The horizontal alignment
1377
+ * @returns {FRange} this range, for chaining
1378
+ * @example
1379
+ * ```ts
1380
+ * univerAPI.getActiveWorkbook()
1381
+ * .getActiveSheet()
1382
+ * .getActiveRange()
1383
+ * .setHorizontalAlignment('left');
1384
+ * ```
1160
1385
  */
1161
- setHorizontalAlignment(s) {
1162
- return this._commandService.syncExecuteCommand(it.id, {
1386
+ setHorizontalAlignment(r) {
1387
+ return this._commandService.syncExecuteCommand(St.id, {
1163
1388
  unitId: this._workbook.getUnitId(),
1164
1389
  subUnitId: this._worksheet.getSheetId(),
1165
1390
  range: this._range,
1166
- value: $t(s)
1391
+ value: Xt(r)
1167
1392
  }), this;
1168
1393
  }
1169
1394
  /**
1170
1395
  * 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.
1171
- * @param value
1396
+ * @param {CellValue[][] | IObjectMatrixPrimitiveType<CellValue> | ICellData[][] | IObjectMatrixPrimitiveType<ICellData>} value 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.
1397
+ * @returns {FRange} This range, for chaining
1398
+ * @example
1399
+ * ```ts
1400
+ * univerAPI.getActiveWorkbook()
1401
+ * .getActiveSheet()
1402
+ * .getActiveRange()
1403
+ * .setValues([[1, 2], [3, 4]]);
1404
+ * ```
1172
1405
  */
1173
- setValues(s) {
1174
- const e = Ie(s, this._range);
1175
- return this._commandService.syncExecuteCommand(P.id, {
1406
+ setValues(r) {
1407
+ const e = Pe(r, this._range);
1408
+ return this._commandService.syncExecuteCommand(N.id, {
1176
1409
  unitId: this._workbook.getUnitId(),
1177
1410
  subUnitId: this._worksheet.getSheetId(),
1178
1411
  range: this._range,
@@ -1181,15 +1414,23 @@ let w = class extends ne {
1181
1414
  }
1182
1415
  /**
1183
1416
  * Sets the font weight for the given range (normal/bold),
1184
- * @param fontWeight The font weight, either 'normal' or 'bold'; a null value resets the font weight.
1417
+ * @param {FontWeight|null} fontWeight The font weight, either 'normal' or 'bold'; a null value resets the font weight.
1418
+ * @returns {FRange} This range, for chaining
1419
+ * @example
1420
+ * ```ts
1421
+ * univerAPI.getActiveWorkbook()
1422
+ * .getActiveSheet()
1423
+ * .getActiveRange()
1424
+ * .setFontWeight('bold');
1425
+ * ```
1185
1426
  */
1186
- setFontWeight(s) {
1427
+ setFontWeight(r) {
1187
1428
  let e;
1188
- if (s === "bold")
1189
- e = m.TRUE;
1190
- else if (s === "normal")
1191
- e = m.FALSE;
1192
- else if (s === null)
1429
+ if (r === "bold")
1430
+ e = g.TRUE;
1431
+ else if (r === "normal")
1432
+ e = g.FALSE;
1433
+ else if (r === null)
1193
1434
  e = null;
1194
1435
  else
1195
1436
  throw new Error("Invalid fontWeight");
@@ -1202,19 +1443,27 @@ let w = class extends ne {
1202
1443
  range: this._range,
1203
1444
  style: t
1204
1445
  };
1205
- return this._commandService.executeCommand(f.id, n), this;
1446
+ return this._commandService.syncExecuteCommand(I.id, n), this;
1206
1447
  }
1207
1448
  /**
1208
1449
  * Sets the font style for the given range ('italic' or 'normal').
1209
- * @param fontStyle The font style, either 'italic' or 'normal'; a null value resets the font style.
1450
+ * @param {FontStyle|null} fontStyle The font style, either 'italic' or 'normal'; a null value resets the font style.
1451
+ * @returns {FRange} This range, for chaining
1452
+ * @example
1453
+ * ```ts
1454
+ * univerAPI.getActiveWorkbook()
1455
+ * .getActiveSheet()
1456
+ * .getActiveRange()
1457
+ * .setFontStyle('italic');
1458
+ * ```
1210
1459
  */
1211
- setFontStyle(s) {
1460
+ setFontStyle(r) {
1212
1461
  let e;
1213
- if (s === "italic")
1214
- e = m.TRUE;
1215
- else if (s === "normal")
1216
- e = m.FALSE;
1217
- else if (s === null)
1462
+ if (r === "italic")
1463
+ e = g.TRUE;
1464
+ else if (r === "normal")
1465
+ e = g.FALSE;
1466
+ else if (r === null)
1218
1467
  e = null;
1219
1468
  else
1220
1469
  throw new Error("Invalid fontStyle");
@@ -1227,28 +1476,36 @@ let w = class extends ne {
1227
1476
  range: this._range,
1228
1477
  style: t
1229
1478
  };
1230
- return this._commandService.executeCommand(f.id, n), this;
1479
+ return this._commandService.syncExecuteCommand(I.id, n), this;
1231
1480
  }
1232
1481
  /**
1233
1482
  * Sets the font line style of the given range ('underline', 'line-through', or 'none').
1234
- * @param fontLine The font line style, either 'underline', 'line-through', or 'none'; a null value resets the font line style.
1483
+ * @param {FontLine|null} fontLine The font line style, either 'underline', 'line-through', or 'none'; a null value resets the font line style.
1484
+ * @returns {FRange} This range, for chaining
1485
+ * @example
1486
+ * ```ts
1487
+ * univerAPI.getActiveWorkbook()
1488
+ * .getActiveSheet()
1489
+ * .getActiveRange()
1490
+ * .setFontLine('underline');
1491
+ * ```
1235
1492
  */
1236
- setFontLine(s) {
1237
- if (s === "underline")
1493
+ setFontLine(r) {
1494
+ if (r === "underline")
1238
1495
  this._setFontUnderline({
1239
- s: m.TRUE
1496
+ s: g.TRUE
1240
1497
  });
1241
- else if (s === "line-through")
1498
+ else if (r === "line-through")
1242
1499
  this._setFontStrikethrough({
1243
- s: m.TRUE
1500
+ s: g.TRUE
1244
1501
  });
1245
- else if (s === "none")
1502
+ else if (r === "none")
1246
1503
  this._setFontUnderline({
1247
- s: m.FALSE
1504
+ s: g.FALSE
1248
1505
  }), this._setFontStrikethrough({
1249
- s: m.FALSE
1506
+ s: g.FALSE
1250
1507
  });
1251
- else if (s === null)
1508
+ else if (r === null)
1252
1509
  this._setFontUnderline(null), this._setFontStrikethrough(null);
1253
1510
  else
1254
1511
  throw new Error("Invalid fontLine");
@@ -1256,90 +1513,123 @@ let w = class extends ne {
1256
1513
  }
1257
1514
  /**
1258
1515
  * Sets the font underline style of the given ITextDecoration
1259
- * @param value
1516
+ * @param {ITextDecoration|null} value The font underline style of the given ITextDecoration; a null value resets the font underline style
1517
+ * @returns {void}
1518
+ * @example
1519
+ * ```ts
1520
+ * univerAPI.getActiveWorkbook()
1521
+ * .getActiveSheet()
1522
+ * .getActiveRange()
1523
+ * .setFontLine('underline');
1524
+ * ```
1260
1525
  */
1261
- _setFontUnderline(s) {
1526
+ _setFontUnderline(r) {
1262
1527
  const e = {
1263
1528
  type: "ul",
1264
- value: s
1529
+ value: r
1265
1530
  }, t = {
1266
1531
  unitId: this._workbook.getUnitId(),
1267
1532
  subUnitId: this._worksheet.getSheetId(),
1268
1533
  range: this._range,
1269
1534
  style: e
1270
1535
  };
1271
- this._commandService.executeCommand(f.id, t);
1536
+ this._commandService.syncExecuteCommand(I.id, t);
1272
1537
  }
1273
1538
  /**
1274
1539
  * Sets the font strikethrough style of the given ITextDecoration
1275
- * @param value
1540
+ * @param {ITextDecoration|null} value The font strikethrough style of the given ITextDecoration; a null value resets the font strikethrough style
1541
+ * @returns {void}
1276
1542
  */
1277
- _setFontStrikethrough(s) {
1543
+ _setFontStrikethrough(r) {
1278
1544
  const e = {
1279
1545
  type: "st",
1280
- value: s
1546
+ value: r
1281
1547
  }, t = {
1282
1548
  unitId: this._workbook.getUnitId(),
1283
1549
  subUnitId: this._worksheet.getSheetId(),
1284
1550
  range: this._range,
1285
1551
  style: e
1286
1552
  };
1287
- this._commandService.executeCommand(f.id, t);
1553
+ this._commandService.syncExecuteCommand(I.id, t);
1288
1554
  }
1289
1555
  /**
1290
1556
  * Sets the font family, such as "Arial" or "Helvetica".
1291
- * @param fontFamily The font family to set; a null value resets the font family.
1557
+ * @param {string|null} fontFamily The font family to set; a null value resets the font family.
1558
+ * @returns {FRange} This range, for chaining
1559
+ * @example
1560
+ * ```ts
1561
+ * univerAPI.getActiveWorkbook()
1562
+ * .getActiveSheet()
1563
+ * .getActiveRange()
1564
+ * .setFontFamily('Arial');
1565
+ * ```
1292
1566
  */
1293
- setFontFamily(s) {
1567
+ setFontFamily(r) {
1294
1568
  const e = {
1295
1569
  type: "ff",
1296
- value: s
1570
+ value: r
1297
1571
  }, t = {
1298
1572
  unitId: this._workbook.getUnitId(),
1299
1573
  subUnitId: this._worksheet.getSheetId(),
1300
1574
  range: this._range,
1301
1575
  style: e
1302
1576
  };
1303
- return this._commandService.executeCommand(f.id, t), this;
1577
+ return this._commandService.syncExecuteCommand(I.id, t), this;
1304
1578
  }
1305
1579
  /**
1306
1580
  * Sets the font size, with the size being the point size to use.
1307
- * @param size A font size in point size. A null value resets the font size.
1581
+ * @param {number|null} size A font size in point size. A null value resets the font size.
1582
+ * @returns {FRange} This range, for chaining
1583
+ * @example
1584
+ * ```ts
1585
+ * univerAPI.getActiveWorkbook()
1586
+ * .getActiveSheet()
1587
+ * .getActiveRange()
1588
+ * .setFontSize(12);
1589
+ * ```
1308
1590
  */
1309
- setFontSize(s) {
1591
+ setFontSize(r) {
1310
1592
  const e = {
1311
1593
  type: "fs",
1312
- value: s
1594
+ value: r
1313
1595
  }, t = {
1314
1596
  unitId: this._workbook.getUnitId(),
1315
1597
  subUnitId: this._worksheet.getSheetId(),
1316
1598
  range: this._range,
1317
1599
  style: e
1318
1600
  };
1319
- return this._commandService.executeCommand(f.id, t), this;
1601
+ return this._commandService.syncExecuteCommand(I.id, t), this;
1320
1602
  }
1321
1603
  /**
1322
1604
  * Sets the font color in CSS notation (such as '#ffffff' or 'white').
1323
- * @param color The font color in CSS notation (such as '#ffffff' or 'white'); a null value resets the color.
1605
+ * @param {string|null} color The font color in CSS notation (such as '#ffffff' or 'white'); a null value resets the color.
1606
+ * @returns {FRange} This range, for chaining
1607
+ * @example
1608
+ * ```ts
1609
+ * univerAPI.getActiveWorkbook()
1610
+ * .getActiveSheet()
1611
+ * .getActiveRange()
1612
+ * .setFontColor('#ff0000');
1613
+ * ```
1324
1614
  */
1325
- setFontColor(s) {
1615
+ setFontColor(r) {
1326
1616
  const t = {
1327
1617
  type: "cl",
1328
- value: s === null ? null : { rgb: s }
1618
+ value: r === null ? null : { rgb: r }
1329
1619
  }, n = {
1330
1620
  unitId: this._workbook.getUnitId(),
1331
1621
  subUnitId: this._worksheet.getSheetId(),
1332
1622
  range: this._range,
1333
1623
  style: t
1334
1624
  };
1335
- return this._commandService.executeCommand(f.id, n), this;
1625
+ return this._commandService.syncExecuteCommand(I.id, n), this;
1336
1626
  }
1337
1627
  // #endregion editing
1338
1628
  //#region Merge cell
1339
1629
  /**
1340
1630
  * Merge cells in a range into one merged cell
1341
- * @param [defaultMerge] - If true, only the value in the upper left cell is retained.
1342
- * @returns This range, for chaining
1631
+ * @param {boolean} [defaultMerge] - If true, only the value in the upper left cell is retained.
1632
+ * @returns {FRange} This range, for chaining
1343
1633
  * @example
1344
1634
  * ```ts
1345
1635
  * const workbook = univerAPI.getActiveWorkbook();
@@ -1350,14 +1640,14 @@ let w = class extends ne {
1350
1640
  * console.log('debugger', isMerged);
1351
1641
  * ```
1352
1642
  */
1353
- merge(s = !0) {
1643
+ merge(r = !0) {
1354
1644
  const e = this._workbook.getUnitId(), t = this._worksheet.getSheetId();
1355
- return $(this._injector, e, t, [this._range], s), this;
1645
+ return H(this._injector, e, t, [this._range], r), this;
1356
1646
  }
1357
1647
  /**
1358
1648
  * Merges cells in a range horizontally.
1359
- * @param [defaultMerge] - If true, only the value in the upper left cell is retained.
1360
- * @returns This range, for chaining
1649
+ * @param {boolean} [defaultMerge] - If true, only the value in the upper left cell is retained.
1650
+ * @returns {FRange} This range, for chaining
1361
1651
  * @example
1362
1652
  * ```ts
1363
1653
  * const workbook = univerAPI.getActiveWorkbook();
@@ -1368,14 +1658,14 @@ let w = class extends ne {
1368
1658
  * console.log(allMerge.length); // There will be two merged cells.
1369
1659
  * ```
1370
1660
  */
1371
- mergeAcross(s = !0) {
1372
- const e = ce([this._range], ie.ROWS), t = this._workbook.getUnitId(), n = this._worksheet.getSheetId();
1373
- return $(this._injector, t, n, e, s), this;
1661
+ mergeAcross(r = !0) {
1662
+ const e = ke([this._range], me.ROWS), t = this._workbook.getUnitId(), n = this._worksheet.getSheetId();
1663
+ return H(this._injector, t, n, e, r), this;
1374
1664
  }
1375
1665
  /**
1376
1666
  * Merges cells in a range vertically.
1377
- * @param [defaultMerge] - If true, only the value in the upper left cell is retained.
1378
- * @returns This range, for chaining
1667
+ * @param {boolean} [defaultMerge] - If true, only the value in the upper left cell is retained.
1668
+ * @returns {FRange} This range, for chaining
1379
1669
  * @example
1380
1670
  * ```ts
1381
1671
  * const workbook = univerAPI.getActiveWorkbook();
@@ -1386,9 +1676,9 @@ let w = class extends ne {
1386
1676
  * console.log(allMerge.length); // There will be two merged cells.
1387
1677
  * ```
1388
1678
  */
1389
- mergeVertically(s = !0) {
1390
- const e = ce([this._range], ie.COLUMNS), t = this._workbook.getUnitId(), n = this._worksheet.getSheetId();
1391
- return $(this._injector, t, n, e, s), this;
1679
+ mergeVertically(r = !0) {
1680
+ const e = ke([this._range], me.COLUMNS), t = this._workbook.getUnitId(), n = this._worksheet.getSheetId();
1681
+ return H(this._injector, t, n, e, r), this;
1392
1682
  }
1393
1683
  /**
1394
1684
  * Returns true if cells in the current range overlap a merged cell.
@@ -1405,12 +1695,12 @@ let w = class extends ne {
1405
1695
  * ```
1406
1696
  */
1407
1697
  isPartOfMerge() {
1408
- const { startRow: s, startColumn: e, endRow: t, endColumn: n } = this._range;
1409
- return this._worksheet.getMergedCellRange(s, e, t, n).length > 0;
1698
+ const { startRow: r, startColumn: e, endRow: t, endColumn: n } = this._range;
1699
+ return this._worksheet.getMergedCellRange(r, e, t, n).length > 0;
1410
1700
  }
1411
1701
  /**
1412
1702
  * Break all horizontally- or vertically-merged cells contained within the range list into individual cells again.
1413
- * @returns This range, for chaining
1703
+ * @returns {FRange} This range, for chaining
1414
1704
  * @example
1415
1705
  * ```ts
1416
1706
  * const workbook = univerAPI.getActiveWorkbook();
@@ -1426,12 +1716,12 @@ let w = class extends ne {
1426
1716
  * ```
1427
1717
  */
1428
1718
  breakApart() {
1429
- return this._commandService.executeCommand(at.id, { ranges: [this._range] }), this;
1719
+ return this._commandService.syncExecuteCommand(wt.id, { ranges: [this._range] }), this;
1430
1720
  }
1431
1721
  //#endregion
1432
1722
  /**
1433
1723
  * Iterate cells in this range. Merged cells will be respected.
1434
- * @param callback the callback function to be called for each cell in the range
1724
+ * @param {Function} callback the callback function to be called for each cell in the range
1435
1725
  * @param {number} callback.row the row number of the cell
1436
1726
  * @param {number} callback.col the column number of the cell
1437
1727
  * @param {ICellData} callback.cell the cell data
@@ -1444,15 +1734,15 @@ let w = class extends ne {
1444
1734
  * });
1445
1735
  * ```
1446
1736
  */
1447
- forEach(s) {
1448
- const { startColumn: e, startRow: t, endColumn: n, endRow: r } = this._range;
1449
- this._worksheet.getMatrixWithMergedCells(t, e, r, n).forValue((o, i, a) => {
1450
- s(o, i, a);
1737
+ forEach(r) {
1738
+ const { startColumn: e, startRow: t, endColumn: n, endRow: s } = this._range;
1739
+ this._worksheet.getMatrixWithMergedCells(t, e, s, n).forValue((i, o, h) => {
1740
+ r(i, o, h);
1451
1741
  });
1452
1742
  }
1453
1743
  /**
1454
1744
  * Returns a string description of the range, in A1 notation.
1455
- * @param withSheet
1745
+ * @param {boolean} [withSheet] - If true, the sheet name is included in the A1 notation.
1456
1746
  * @returns {string} The A1 notation of the range.
1457
1747
  * ```ts
1458
1748
  * const fWorkbook = univerAPI.getActiveWorkbook();
@@ -1461,8 +1751,8 @@ let w = class extends ne {
1461
1751
  * console.log(fRange.getA1Notation()); // A1:B2
1462
1752
  * ```
1463
1753
  */
1464
- getA1Notation(s) {
1465
- return s ? Tt(this._worksheet.getName(), this._range) : re(this._range);
1754
+ getA1Notation(r) {
1755
+ return r ? Ht(this._worksheet.getName(), this._range) : ue(this._range);
1466
1756
  }
1467
1757
  /**
1468
1758
  * Sets the specified range as the active range, with the top left cell in the range as the current cell.
@@ -1476,7 +1766,7 @@ let w = class extends ne {
1476
1766
  * ```
1477
1767
  */
1478
1768
  activate() {
1479
- return this._injector.createInstance(I, this._workbook).setActiveRange(this), this;
1769
+ return this._injector.createInstance(f, this._workbook).setActiveRange(this), this;
1480
1770
  }
1481
1771
  /**
1482
1772
  * Sets the specified cell as the current cell.
@@ -1486,8 +1776,8 @@ let w = class extends ne {
1486
1776
  * @description If the range is not a single cell, an error will be thrown.
1487
1777
  */
1488
1778
  activateAsCurrentCell() {
1489
- const s = this._worksheet.getMergedCell(this._range.startRow, this._range.startColumn);
1490
- if (s && N.equals(s, this._range) || !s && this._range.startRow === this._range.endRow && this._range.startColumn === this._range.endColumn)
1779
+ const r = this._worksheet.getMergedCell(this._range.startRow, this._range.startColumn);
1780
+ if (r && M.equals(r, this._range) || !r && this._range.startRow === this._range.endRow && this._range.startColumn === this._range.endColumn)
1491
1781
  return this.activate();
1492
1782
  throw new Error("The range is not a single cell");
1493
1783
  }
@@ -1523,14 +1813,14 @@ let w = class extends ne {
1523
1813
  * // 1 | 2 | 3
1524
1814
  * // 4 | 5 | 6
1525
1815
  */
1526
- splitTextToColumns(s, e, t) {
1527
- this._commandService.executeCommand(ht.id, {
1816
+ splitTextToColumns(r, e, t) {
1817
+ this._commandService.syncExecuteCommand(Ct.id, {
1528
1818
  unitId: this._workbook.getUnitId(),
1529
1819
  subUnitId: this._worksheet.getSheetId(),
1530
1820
  range: this._range,
1531
1821
  delimiter: e,
1532
1822
  customDelimiter: t,
1533
- treatMultipleDelimitersAsOne: s
1823
+ treatMultipleDelimitersAsOne: r
1534
1824
  });
1535
1825
  }
1536
1826
  /**
@@ -1544,16 +1834,16 @@ let w = class extends ne {
1544
1834
  * fRange.useThemeStyle('default');
1545
1835
  * ```
1546
1836
  */
1547
- useThemeStyle(s) {
1548
- if (s == null) {
1837
+ useThemeStyle(r) {
1838
+ if (r == null) {
1549
1839
  const e = this.getUsedThemeStyle();
1550
1840
  e && this.removeThemeStyle(e);
1551
1841
  } else
1552
- this._commandService.executeCommand(ct.id, {
1842
+ this._commandService.syncExecuteCommand(ft.id, {
1553
1843
  unitId: this._workbook.getUnitId(),
1554
1844
  subUnitId: this._worksheet.getSheetId(),
1555
1845
  range: this._range,
1556
- themeName: s
1846
+ themeName: r
1557
1847
  });
1558
1848
  }
1559
1849
  /**
@@ -1567,12 +1857,12 @@ let w = class extends ne {
1567
1857
  * fRange.removeThemeStyle('default');
1568
1858
  * ```
1569
1859
  */
1570
- removeThemeStyle(s) {
1571
- this._commandService.executeCommand(dt.id, {
1860
+ removeThemeStyle(r) {
1861
+ this._commandService.syncExecuteCommand(vt.id, {
1572
1862
  unitId: this._workbook.getUnitId(),
1573
1863
  subUnitId: this._worksheet.getSheetId(),
1574
1864
  range: this._range,
1575
- themeName: s
1865
+ themeName: r
1576
1866
  });
1577
1867
  }
1578
1868
  /**
@@ -1589,49 +1879,73 @@ let w = class extends ne {
1589
1879
  * ```
1590
1880
  */
1591
1881
  getUsedThemeStyle() {
1592
- return this._injector.get(Me).getAppliedRangeThemeStyle({
1882
+ return this._injector.get(Ve).getAppliedRangeThemeStyle({
1593
1883
  unitId: this._workbook.getUnitId(),
1594
1884
  subUnitId: this._worksheet.getSheetId(),
1595
1885
  range: this._range
1596
1886
  });
1597
1887
  }
1598
1888
  };
1599
- w = Jt([
1600
- Y(3, u(b)),
1601
- Y(4, l),
1602
- Y(5, u(Wt))
1603
- ], w);
1604
- var Qt = Object.defineProperty, Xt = Object.getOwnPropertyDescriptor, Zt = (s, e, t, n) => {
1605
- for (var r = n > 1 ? void 0 : n ? Xt(e, t) : e, o = s.length - 1, i; o >= 0; o--)
1606
- (i = s[o]) && (r = (n ? i(e, t, r) : i(r)) || r);
1607
- return n && r && Qt(e, t, r), r;
1608
- }, en = (s, e) => (t, n) => e(t, n, s);
1609
- let B = class {
1610
- constructor(s, e, t, n) {
1611
- this._workbook = s, this._worksheet = e, this._selections = t, this._injector = n;
1889
+ S = sn([
1890
+ K(3, u(y)),
1891
+ K(4, l),
1892
+ K(5, u(Vt))
1893
+ ], S);
1894
+ var on = Object.defineProperty, hn = Object.getOwnPropertyDescriptor, an = (r, e, t, n) => {
1895
+ for (var s = n > 1 ? void 0 : n ? hn(e, t) : e, i = r.length - 1, o; i >= 0; i--)
1896
+ (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
1897
+ return n && s && on(e, t, s), s;
1898
+ }, dn = (r, e) => (t, n) => e(t, n, r);
1899
+ let L = class {
1900
+ constructor(r, e, t, n) {
1901
+ this._workbook = r, this._worksheet = e, this._selections = t, this._injector = n;
1612
1902
  }
1613
1903
  /**
1614
1904
  * Represents the active selection in the sheet. Which means the selection contains the active cell.
1615
1905
  * @returns {FRange | null} The active selection.
1906
+ * @example
1907
+ * ```ts
1908
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1909
+ * const fWorksheet = fWorkbook.getActiveSheet();
1910
+ * const fSelection = fWorksheet.getSelection();
1911
+ * const activeRange = fSelection.getActiveRange();
1912
+ * console.log(activeRange);
1913
+ * ```
1616
1914
  */
1617
1915
  getActiveRange() {
1618
- const s = this._selections.find((e) => !!e.primary);
1619
- return s ? this._injector.createInstance(w, this._workbook, this._worksheet, s.range) : null;
1916
+ const r = this._selections.find((e) => !!e.primary);
1917
+ return r ? this._injector.createInstance(S, this._workbook, this._worksheet, r.range) : null;
1620
1918
  }
1621
1919
  /**
1622
1920
  * Represents the active selection list in the sheet.
1623
1921
  * @returns {FRange[]} The active selection list.
1922
+ * @example
1923
+ * ```ts
1924
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1925
+ * const fWorksheet = fWorkbook.getActiveSheet();
1926
+ * const fSelection = fWorksheet.getSelection();
1927
+ * const activeRangeList = fSelection.getActiveRangeList();
1928
+ * console.log(activeRangeList);
1929
+ * ```
1624
1930
  */
1625
1931
  getActiveRangeList() {
1626
- return this._selections.map((s) => this._injector.createInstance(w, this._workbook, this._worksheet, s.range));
1932
+ return this._selections.map((r) => this._injector.createInstance(S, this._workbook, this._worksheet, r.range));
1627
1933
  }
1628
1934
  /**
1629
1935
  * Represents the current select cell in the sheet.
1630
1936
  * @returns {ISelectionCell} The current select cell info.Pay attention to the type of the return value.
1937
+ * @example
1938
+ * ```ts
1939
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1940
+ * const fWorksheet = fWorkbook.getActiveSheet();
1941
+ * const fSelection = fWorksheet.getSelection();
1942
+ * const currentCell = fSelection.getCurrentCell();
1943
+ * console.log(currentCell);
1944
+ * ```
1631
1945
  */
1632
1946
  getCurrentCell() {
1633
- const s = this._selections.find((e) => !!e.primary);
1634
- return s ? s.primary : null;
1947
+ const r = this._selections.find((e) => !!e.primary);
1948
+ return r ? r.primary : null;
1635
1949
  }
1636
1950
  /**
1637
1951
  * Returns the active sheet in the spreadsheet.
@@ -1646,8 +1960,8 @@ let B = class {
1646
1960
  * ```
1647
1961
  */
1648
1962
  getActiveSheet() {
1649
- const s = this._injector.createInstance(I, this._workbook);
1650
- return this._injector.createInstance(g, s, this._workbook, this._worksheet);
1963
+ const r = this._injector.createInstance(f, this._workbook);
1964
+ return this._injector.createInstance(m, r, this._workbook, this._worksheet);
1651
1965
  }
1652
1966
  /**
1653
1967
  * 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.
@@ -1663,31 +1977,31 @@ let B = class {
1663
1977
  * console.log(newSelection.getActiveRange().getA1Notation()); // A1
1664
1978
  * ```
1665
1979
  */
1666
- updatePrimaryCell(s) {
1980
+ updatePrimaryCell(r) {
1667
1981
  const e = this._injector.get(l);
1668
1982
  let t = [], n = !1;
1669
- for (const { range: o, style: i } of this._selections)
1670
- N.contains(o, s.getRange()) ? (t.push({
1671
- range: o,
1672
- primary: Z(s.getRange(), this._worksheet),
1673
- style: i
1983
+ for (const { range: i, style: o } of this._selections)
1984
+ M.contains(i, r.getRange()) ? (t.push({
1985
+ range: i,
1986
+ primary: ee(r.getRange(), this._worksheet),
1987
+ style: o
1674
1988
  }), n = !0) : t.push({
1675
- range: o,
1989
+ range: i,
1676
1990
  primary: null,
1677
- style: i
1991
+ style: o
1678
1992
  });
1679
1993
  n || (t = [
1680
1994
  {
1681
- range: s.getRange(),
1682
- primary: Z(s.getRange(), this._worksheet)
1995
+ range: r.getRange(),
1996
+ primary: ee(r.getRange(), this._worksheet)
1683
1997
  }
1684
1998
  ]);
1685
- const r = {
1999
+ const s = {
1686
2000
  unitId: this._workbook.getUnitId(),
1687
2001
  subUnitId: this._worksheet.getSheetId(),
1688
2002
  selections: t
1689
2003
  };
1690
- return e.syncExecuteCommand(De.id, r), new B(this._workbook, this._worksheet, t, this._injector);
2004
+ return e.syncExecuteCommand(He.id, s), new L(this._workbook, this._worksheet, t, this._injector);
1691
2005
  }
1692
2006
  /**
1693
2007
  *Get the next primary cell in the specified direction. If the primary cell not exists in selections, return null.
@@ -1704,79 +2018,77 @@ let B = class {
1704
2018
  * console.log(nextCell?.getA1Notation()); // B1
1705
2019
  * ```
1706
2020
  */
1707
- getNextDataRange(s) {
2021
+ getNextDataRange(r) {
1708
2022
  if (!this._selections.find((n) => !!n.primary))
1709
2023
  return null;
1710
- const t = ut(this._selections.concat(), s, this._worksheet);
1711
- return t ? this._injector.createInstance(w, this._workbook, this._worksheet, t) : null;
2024
+ const t = It(this._selections.concat(), r, this._worksheet);
2025
+ return t ? this._injector.createInstance(S, this._workbook, this._worksheet, t) : null;
1712
2026
  }
1713
2027
  };
1714
- B = Zt([
1715
- en(3, u(b))
1716
- ], B);
1717
- var tn = Object.defineProperty, nn = Object.getOwnPropertyDescriptor, sn = (s, e, t, n) => {
1718
- for (var r = n > 1 ? void 0 : n ? nn(e, t) : e, o = s.length - 1, i; o >= 0; o--)
1719
- (i = s[o]) && (r = (n ? i(e, t, r) : i(r)) || r);
1720
- return n && r && tn(e, t, r), r;
1721
- }, T = (s, e) => (t, n) => e(t, n, s);
1722
- let g = class extends ne {
1723
- constructor(e, t, n, r, o, i, a) {
1724
- super(r);
1725
- k(this, "_eventRegistry", /* @__PURE__ */ new Map());
2028
+ L = an([
2029
+ dn(3, u(y))
2030
+ ], L);
2031
+ var cn = Object.defineProperty, un = Object.getOwnPropertyDescriptor, gn = (r, e, t, n) => {
2032
+ for (var s = n > 1 ? void 0 : n ? un(e, t) : e, i = r.length - 1, o; i >= 0; i--)
2033
+ (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
2034
+ return n && s && cn(e, t, s), s;
2035
+ }, B = (r, e) => (t, n) => e(t, n, r);
2036
+ let m = class extends ce {
2037
+ /**
2038
+ * Creates a new worksheet facade instance
2039
+ * @param {FWorkbook} _fWorkbook - The facade workbook instance
2040
+ * @param {Workbook} _workbook - The workbook instance
2041
+ * @param {Worksheet} _worksheet - The worksheet instance
2042
+ * @param {Injector} _injector - The injector instance
2043
+ * @param {SheetsSelectionsService} _selectionManagerService - The selection manager service
2044
+ * @param {ILogService} _logService - The log service
2045
+ * @param {ICommandService} _commandService - The command service
2046
+ */
2047
+ constructor(e, t, n, s, i, o, h) {
2048
+ super(s);
1726
2049
  /**
1727
2050
  * Sets the active selection region for this sheet.
1728
- * @param range The range to set as the active selection.
2051
+ * @param range - The range to set as the active selection
2052
+ * @returns This sheet, for chaining
2053
+ * @example
2054
+ * ```ts
2055
+ * const fWorkbook = univerAPI.getActiveWorkbook();
2056
+ * const fWorkSheet = fWorkbook.getActiveSheet();
2057
+ * fWorkSheet.setActiveRange(fWorkSheet.getRange('A1'));
2058
+ * ```
1729
2059
  */
1730
- k(this, "setActiveSelection", this.setActiveRange);
1731
- this._fWorkbook = e, this._workbook = t, this._worksheet = n, this._injector = r, this._selectionManagerService = o, this._logService = i, this._commandService = a;
1732
- }
1733
- getSheet() {
1734
- return this._worksheet;
1735
- }
1736
- _ensureEventRegistry(e) {
1737
- return this._eventRegistry.has(e) || this._eventRegistry.set(e, new ye()), this._eventRegistry.get(e);
2060
+ b(this, "setActiveSelection", this.setActiveRange);
2061
+ this._fWorkbook = e, this._workbook = t, this._worksheet = n, this._injector = s, this._selectionManagerService = i, this._logService = o, this._commandService = h;
1738
2062
  }
1739
2063
  /**
1740
- * Add an event listener
1741
- * @param event key of event
1742
- * @param callback callback when event triggered
1743
- * @returns {Disposable} The Disposable instance, for remove the listener
2064
+ * Returns the worksheet
2065
+ * @returns {Worksheet} The worksheet instance.
1744
2066
  * @example
1745
- * ```ts
1746
- * univerAPI.addEvent(univerAPI.event.UnitCreated, (params) => {
1747
- * console.log('unit created', params);
1748
- * });
2067
+ * ```typescript
2068
+ * const sheet = univerAPI.getActiveWorkbook().getActiveSheet().getSheet();
1749
2069
  * ```
1750
2070
  */
1751
- addEvent(e, t) {
1752
- return this._ensureEventRegistry(e).add(t), F(() => this._ensureEventRegistry(e).delete(t));
2071
+ getSheet() {
2072
+ return this._worksheet;
1753
2073
  }
1754
2074
  /**
1755
- * Fire an event, used in internal only.
1756
- * @param event {string} key of event
1757
- * @param params {any} params of event
1758
- * @returns {boolean} should cancel
2075
+ * Returns the injector
2076
+ * @returns {Injector} The injector
1759
2077
  * @example
1760
- * ```ts
1761
- * this.fireEvent(univerAPI.event.UnitCreated, params);
2078
+ * ```typescript
2079
+ * const injector = univerAPI.getActiveWorkbook().getActiveSheet().getInject();
1762
2080
  * ```
1763
2081
  */
1764
- fireEvent(e, t) {
1765
- var n;
1766
- return (n = this._eventRegistry.get(e)) == null || n.getData().forEach((r) => {
1767
- r(t);
1768
- }), t.cancel;
1769
- }
1770
- /**
1771
- * Returns the injector
1772
- * @returns The injector
1773
- */
1774
2082
  getInject() {
1775
2083
  return this._injector;
1776
2084
  }
1777
2085
  /**
1778
2086
  * Returns the workbook
1779
2087
  * @returns {Workbook} The workbook instance.
2088
+ * @example
2089
+ * ```typescript
2090
+ * const workbook = univerAPI.getActiveWorkbook().getWorkbook();
2091
+ * ```
1780
2092
  */
1781
2093
  getWorkbook() {
1782
2094
  return this._workbook;
@@ -1784,6 +2096,11 @@ let g = class extends ne {
1784
2096
  /**
1785
2097
  * Returns the worksheet id.
1786
2098
  * @returns {string} The id of the worksheet.
2099
+ * @example
2100
+ * ```typescript
2101
+ * const sheet = univerAPI.getActiveWorkbook().getActiveSheet();
2102
+ * const id = sheet.getSheetId();
2103
+ * ```
1787
2104
  */
1788
2105
  getSheetId() {
1789
2106
  return this._worksheet.getSheetId();
@@ -1791,6 +2108,11 @@ let g = class extends ne {
1791
2108
  /**
1792
2109
  * Returns the worksheet name.
1793
2110
  * @returns {string} The name of the worksheet.
2111
+ * @example
2112
+ * ```typescript
2113
+ * const sheet = univerAPI.getActiveWorkbook().getActiveSheet();
2114
+ * const name = sheet.getSheetName();
2115
+ * ```
1794
2116
  */
1795
2117
  getSheetName() {
1796
2118
  return this._worksheet.getName();
@@ -1798,46 +2120,78 @@ let g = class extends ne {
1798
2120
  /**
1799
2121
  * Represents the selection ranges info of the worksheet.
1800
2122
  * @returns {FSelection} return the current selections of the worksheet or null if there is no selection.
2123
+ * @example
2124
+ * ```typescript
2125
+ * const sheet = univerAPI.getActiveWorkbook().getActiveSheet();
2126
+ * const selections = sheet.getSelection();
2127
+ * ```
1801
2128
  */
1802
2129
  getSelection() {
1803
2130
  const e = this._selectionManagerService.getCurrentSelections();
1804
- return e ? this._injector.createInstance(B, this._workbook, this._worksheet, e) : null;
2131
+ return e ? this._injector.createInstance(L, this._workbook, this._worksheet, e) : null;
1805
2132
  }
1806
2133
  // #region rows
1807
2134
  // #region default style
1808
2135
  /**
1809
2136
  * Get the default style of the worksheet
1810
2137
  * @returns {IStyleData} Default style of the worksheet.
2138
+ * @example
2139
+ * ```typescript
2140
+ * const sheet = workbook.getActiveSheet();
2141
+ * const defaultStyle = sheet.getDefaultStyle();
2142
+ * ```
1811
2143
  */
1812
2144
  getDefaultStyle() {
1813
2145
  return this._worksheet.getDefaultCellStyle();
1814
2146
  }
1815
2147
  /**
1816
2148
  * Get the default style of the worksheet row
1817
- * @param {number} index The row index
1818
- * @param {boolean} [keepRaw] If true, return the raw style data maybe the style name or style data, otherwise return the data from row manager
1819
- * @returns {Nullable<IStyleData> | string} The default style of the worksheet row name or style data
2149
+ * @param {number} index - The row index
2150
+ * @param {boolean} [keepRaw] - If true, return the raw style data maybe the style name or style data, otherwise return the data from row manager
2151
+ * @returns {(Nullable<IStyleData> | string)} The default style of the worksheet row name or style data
2152
+ * @example
2153
+ * ```typescript
2154
+ * const sheet = univerAPI.getActiveWorkbook().getActiveSheet();
2155
+ * // Get default style for row 0 (1)
2156
+ * const rowStyle = sheet.getRowDefaultStyle(0);
2157
+ * // Get raw style data for row 0
2158
+ * const rawRowStyle = sheet.getRowDefaultStyle(0, true);
2159
+ * ```
1820
2160
  */
1821
2161
  getRowDefaultStyle(e, t = !1) {
1822
2162
  return this._worksheet.getRowStyle(e, t);
1823
2163
  }
1824
2164
  /**
1825
2165
  * Get the default style of the worksheet column
1826
- * @param {number} index The column index
1827
- * @param {boolean} [keepRaw] If true, return the raw style data maybe the style name or style data, otherwise return the data from col manager
1828
- * @returns {Nullable<IStyleData> | string} The default style of the worksheet column name or style data
2166
+ * @param {number} index - The column index
2167
+ * @param {boolean} [keepRaw] - If true, return the raw style data maybe the style name or style data, otherwise return the data from col manager
2168
+ * @returns {(Nullable<IStyleData> | string)} The default style of the worksheet column name or style data
2169
+ * @example
2170
+ * ```typescript
2171
+ * const sheet = univerAPI.getActiveWorkbook().getActiveSheet();
2172
+ * // Get default style for column 0 (A)
2173
+ * const colStyle = sheet.getColumnDefaultStyle(0);
2174
+ * // Get raw style data for column 0
2175
+ * const rawColStyle = sheet.getColumnDefaultStyle(0, true);
2176
+ * ```
1829
2177
  */
1830
2178
  getColumnDefaultStyle(e, t = !1) {
1831
2179
  return this._worksheet.getColumnStyle(e, t);
1832
2180
  }
1833
2181
  /**
1834
2182
  * Set the default style of the worksheet
1835
- * @param {StyleDataInfo} style default style
1836
- * @returns {FWorksheet} This sheet, for chaining.
2183
+ * @param {string} style - The style to set
2184
+ * @returns {FWorksheet} This worksheet instance for chaining
2185
+ * @example
2186
+ * ```typescript
2187
+ * const fWorkbook = univerAPI.getActiveWorkbook();
2188
+ * const fWorksheet = fWorkbook.getActiveSheet();
2189
+ * fWorksheet.setDefaultStyle('default');
2190
+ * ```
1837
2191
  */
1838
2192
  setDefaultStyle(e) {
1839
2193
  const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId();
1840
- return this._commandService.syncExecuteCommand(mt.id, {
2194
+ return this._commandService.syncExecuteCommand(bt.id, {
1841
2195
  unitId: t,
1842
2196
  subUnitId: n,
1843
2197
  defaultStyle: e
@@ -1845,74 +2199,94 @@ let g = class extends ne {
1845
2199
  }
1846
2200
  /**
1847
2201
  * Set the default style of the worksheet row
1848
- * @param {number} index The row index
1849
- * @param {string | Nullable<IStyleData>} style The style name or style data
2202
+ * @param {number} index - The row index
2203
+ * @param {string | Nullable<IStyleData>} style - The style name or style data
1850
2204
  * @returns {FWorksheet} This sheet, for chaining.
2205
+ * @example
2206
+ * ```ts
2207
+ * const fWorkbook = univerAPI.getActiveWorkbook();
2208
+ * const fWorksheet = fWorkbook.getActiveSheet();
2209
+ * fWorksheet.setRowDefaultStyle(0, 'default');
2210
+ * ```
1851
2211
  */
1852
2212
  setColumnDefaultStyle(e, t) {
1853
- const n = this._workbook.getUnitId(), r = this._worksheet.getSheetId(), o = {
2213
+ const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), i = {
1854
2214
  unitId: n,
1855
- subUnitId: r,
2215
+ subUnitId: s,
1856
2216
  columnData: {
1857
2217
  [e]: {
1858
2218
  s: t
1859
2219
  }
1860
2220
  }
1861
2221
  };
1862
- return this._commandService.syncExecuteCommand(de.id, o), this;
2222
+ return this._commandService.syncExecuteCommand(Se.id, i), this;
1863
2223
  }
1864
2224
  /**
1865
2225
  * Set the default style of the worksheet column
1866
- * @param {number} index The column index
1867
- * @param {string | Nullable<IStyleData>} style The style name or style data
2226
+ * @param {number} index - The column index
2227
+ * @param {string | Nullable<IStyleData>} style - The style name or style data
1868
2228
  * @returns {FWorksheet} This sheet, for chaining.
2229
+ * @example
2230
+ * ```ts
2231
+ * const fWorkbook = univerAPI.getActiveWorkbook();
2232
+ * const fWorksheet = fWorkbook.getActiveSheet();
2233
+ * fWorksheet.setColumnDefaultStyle(0, 'default');
2234
+ * ```
1869
2235
  */
1870
2236
  setRowDefaultStyle(e, t) {
1871
- const n = this._workbook.getUnitId(), r = this._worksheet.getSheetId(), o = {
2237
+ const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), i = {
1872
2238
  unitId: n,
1873
- subUnitId: r,
2239
+ subUnitId: s,
1874
2240
  rowData: {
1875
2241
  [e]: {
1876
2242
  s: t
1877
2243
  }
1878
2244
  }
1879
2245
  };
1880
- return this._commandService.syncExecuteCommand(ue.id, o), this;
1881
- }
1882
- getRange(e, t, n, r) {
1883
- let o, i;
1884
- if (typeof e == "string") {
1885
- const { range: a, sheetName: h } = At(e), c = h ? this._workbook.getSheetBySheetName(h) : this._worksheet;
1886
- if (!c)
2246
+ return this._commandService.syncExecuteCommand(we.id, i), this;
2247
+ }
2248
+ getRange(e, t, n, s) {
2249
+ let i, o;
2250
+ if (typeof e == "object")
2251
+ i = e, o = this._worksheet;
2252
+ else if (typeof e == "string") {
2253
+ const { range: h, sheetName: a } = zt(e), d = a ? this._workbook.getSheetBySheetName(a) : this._worksheet;
2254
+ if (!d)
1887
2255
  throw new Error("Range not found");
1888
- i = c, o = {
1889
- ...a,
2256
+ o = d, i = {
2257
+ ...h,
1890
2258
  unitId: this._workbook.getUnitId(),
1891
- sheetId: i.getSheetId(),
2259
+ sheetId: o.getSheetId(),
1892
2260
  // Use the current range instead of the future actual range to match Apps Script behavior.
1893
2261
  // Users can create the latest range in real time when needed.
1894
2262
  rangeType: _.NORMAL,
1895
- startRow: a.rangeType === _.COLUMN ? 0 : a.startRow,
1896
- endRow: a.rangeType === _.COLUMN ? i.getMaxRows() - 1 : a.endRow,
1897
- startColumn: a.rangeType === _.ROW ? 0 : a.startColumn,
1898
- endColumn: a.rangeType === _.ROW ? i.getMaxColumns() - 1 : a.endColumn
2263
+ startRow: h.rangeType === _.COLUMN ? 0 : h.startRow,
2264
+ endRow: h.rangeType === _.COLUMN ? o.getMaxRows() - 1 : h.endRow,
2265
+ startColumn: h.rangeType === _.ROW ? 0 : h.startColumn,
2266
+ endColumn: h.rangeType === _.ROW ? o.getMaxColumns() - 1 : h.endColumn
1899
2267
  };
1900
2268
  } else if (typeof e == "number" && t !== void 0)
1901
- i = this._worksheet, o = {
2269
+ o = this._worksheet, i = {
1902
2270
  startRow: e,
1903
2271
  endRow: e + (n != null ? n : 1) - 1,
1904
2272
  startColumn: t,
1905
- endColumn: t + (r != null ? r : 1) - 1,
2273
+ endColumn: t + (s != null ? s : 1) - 1,
1906
2274
  unitId: this._workbook.getUnitId(),
1907
2275
  sheetId: this._worksheet.getSheetId()
1908
2276
  };
1909
2277
  else
1910
2278
  throw new Error("Invalid range specification");
1911
- return this._injector.createInstance(w, this._workbook, i, o);
2279
+ return this._injector.createInstance(S, this._workbook, o, i);
1912
2280
  }
1913
2281
  /**
1914
2282
  * Returns the current number of columns in the sheet, regardless of content.
1915
2283
  * @returns {number} The maximum columns count of the sheet
2284
+ * @example
2285
+ * ```typescript
2286
+ * const sheet = workbook.getActiveSheet();
2287
+ * const totalColumns = sheet.getMaxColumns();
2288
+ * console.log(`Sheet has ${totalColumns} columns`);
2289
+ * ```
1916
2290
  */
1917
2291
  getMaxColumns() {
1918
2292
  return this._worksheet.getMaxColumns();
@@ -1920,90 +2294,152 @@ let g = class extends ne {
1920
2294
  /**
1921
2295
  * Returns the current number of rows in the sheet, regardless of content.
1922
2296
  * @returns {number}The maximum rows count of the sheet
2297
+ * @example
2298
+ * ```typescript
2299
+ * const sheet = workbook.getActiveSheet();
2300
+ * const totalRows = sheet.getMaxRows();
2301
+ * console.log(`Sheet has ${totalRows} rows`);
2302
+ * ```
1923
2303
  */
1924
2304
  getMaxRows() {
1925
2305
  return this._worksheet.getMaxRows();
1926
2306
  }
1927
2307
  /**
1928
2308
  * Inserts a row after the given row position.
1929
- * @param {number} afterPosition The row after which the new row should be added, starting at 0 for the first row.
2309
+ * @param {number} afterPosition - The row after which the new row should be added, starting at 0 for the first row.
1930
2310
  * @returns {FWorksheet} This sheet, for chaining.
2311
+ * @example
2312
+ * ```typescript
2313
+ * const sheet = workbook.getActiveSheet();
2314
+ * // Insert 3 rows at row index 2 (before the third row)
2315
+ * sheet.insertRowAfter(2);
2316
+ * // Insert 1 row at row index 0 (before the first row)
2317
+ * sheet.insertRowAfter(0);
2318
+ * ```
1931
2319
  */
1932
2320
  insertRowAfter(e) {
1933
2321
  return this.insertRowsAfter(e, 1);
1934
2322
  }
1935
2323
  /**
1936
2324
  * Inserts a row before the given row position.
1937
- * @param {number} beforePosition The row before which the new row should be added, starting at 0 for the first row.
2325
+ * @param {number} beforePosition - The row before which the new row should be added, starting at 0 for the first row.
1938
2326
  * @returns {FWorksheet} This sheet, for chaining.
2327
+ * @example
2328
+ * ```typescript
2329
+ * const sheet = workbook.getActiveSheet();
2330
+ * // Insert 3 rows at row index 2 (before the third row)
2331
+ * sheet.insertRowBefore(2);
2332
+ * // Insert 1 row at row index 0 (before the first row)
2333
+ * sheet.insertRowBefore(0);
2334
+ * ```
1939
2335
  */
1940
2336
  insertRowBefore(e) {
1941
2337
  return this.insertRowsBefore(e, 1);
1942
2338
  }
1943
2339
  /**
1944
2340
  * Inserts one or more consecutive blank rows in a sheet starting at the specified location.
1945
- * @param rowIndex The index indicating where to insert a row, starting at 0 for the first row.
1946
- * @param numRows The number of rows to insert.
1947
- * @returns This sheet, for chaining.
2341
+ * @param {number} rowIndex - The index indicating where to insert a row, starting at 0 for the first row.
2342
+ * @param {number} numRows - The number of rows to insert.
2343
+ * @returns {FWorksheet} This sheet, for chaining.
2344
+ * @example
2345
+ * ```typescript
2346
+ * const sheet = workbook.getActiveSheet();
2347
+ * // Insert 3 rows at row index 2 (before the third row)
2348
+ * sheet.insertRows(2, 3);
2349
+ * // Insert 1 row at row index 0 (before the first row)
2350
+ * sheet.insertRows(0);
2351
+ * ```
1948
2352
  */
1949
2353
  insertRows(e, t = 1) {
1950
2354
  return this.insertRowsBefore(e, t);
1951
2355
  }
1952
2356
  /**
1953
2357
  * Inserts a number of rows after the given row position.
1954
- * @param afterPosition The row after which the new rows should be added, starting at 0 for the first row.
1955
- * @param howMany The number of rows to insert.
1956
- * @returns This sheet, for chaining.
2358
+ * @param {number} afterPosition - The row after which the new rows should be added, starting at 0 for the first row.
2359
+ * @param {number} howMany - The number of rows to insert.
2360
+ * @returns {FWorksheet} This sheet, for chaining.
2361
+ * @example
2362
+ * ```typescript
2363
+ * const sheet = workbook.getActiveSheet();
2364
+ * // Insert 3 rows at row index 2 (before the third row)
2365
+ * sheet.insertRowsAfter(2, 3);
2366
+ * // Insert 1 row at row index 0 (before the first row)
2367
+ * sheet.insertRowsAfter(0);
2368
+ * ```
1957
2369
  */
1958
2370
  insertRowsAfter(e, t) {
1959
- const n = this._workbook.getUnitId(), r = this._worksheet.getSheetId(), o = D.DOWN, i = e + 1, a = e + t, h = 0, c = this._worksheet.getColumnCount() - 1, d = W(this._worksheet, i, a, h, c, !0, e);
1960
- return this._commandService.syncExecuteCommand(me.id, {
2371
+ const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), i = D.DOWN, o = e + 1, h = e + t, a = 0, d = this._worksheet.getColumnCount() - 1, c = A(this._worksheet, o, h, a, d, !0, e);
2372
+ return this._commandService.syncExecuteCommand(Ce.id, {
1961
2373
  unitId: n,
1962
- subUnitId: r,
1963
- direction: o,
2374
+ subUnitId: s,
2375
+ direction: i,
1964
2376
  range: {
1965
- startRow: i,
1966
- endRow: a,
1967
- startColumn: h,
1968
- endColumn: c
2377
+ startRow: o,
2378
+ endRow: h,
2379
+ startColumn: a,
2380
+ endColumn: d
1969
2381
  },
1970
- cellValue: d
2382
+ cellValue: c
1971
2383
  }), this;
1972
2384
  }
1973
2385
  /**
1974
2386
  * Inserts a number of rows before the given row position.
1975
- * @param beforePosition The row before which the new rows should be added, starting at 0 for the first row.
1976
- * @param howMany The number of rows to insert.
1977
- * @returns This sheet, for chaining.
2387
+ * @param {number} beforePosition - The row before which the new rows should be added, starting at 0 for the first row.
2388
+ * @param {number} howMany - The number of rows to insert.
2389
+ * @returns {FWorksheet} This sheet, for chaining.
2390
+ * @example
2391
+ * ```typescript
2392
+ * const sheet = workbook.getActiveSheet();
2393
+ * // Insert 3 rows at row index 2 (before the third row)
2394
+ * sheet.insertRowsBefore(2, 3);
2395
+ * // Insert 1 row at row index 0 (before the first row)
2396
+ * sheet.insertRowsBefore(0);
2397
+ * ```
1978
2398
  */
1979
2399
  insertRowsBefore(e, t) {
1980
- const n = this._workbook.getUnitId(), r = this._worksheet.getSheetId(), o = D.UP, i = e, a = e + t - 1, h = 0, c = this._worksheet.getColumnCount() - 1, d = W(this._worksheet, i, a, h, c, !0, e - 1);
1981
- return this._commandService.syncExecuteCommand(me.id, {
2400
+ const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), i = D.UP, o = e, h = e + t - 1, a = 0, d = this._worksheet.getColumnCount() - 1, c = A(this._worksheet, o, h, a, d, !0, e - 1);
2401
+ return this._commandService.syncExecuteCommand(Ce.id, {
1982
2402
  unitId: n,
1983
- subUnitId: r,
1984
- direction: o,
2403
+ subUnitId: s,
2404
+ direction: i,
1985
2405
  range: {
1986
- startRow: i,
1987
- endRow: a,
1988
- startColumn: h,
1989
- endColumn: c
2406
+ startRow: o,
2407
+ endRow: h,
2408
+ startColumn: a,
2409
+ endColumn: d
1990
2410
  },
1991
- cellValue: d
2411
+ cellValue: c
1992
2412
  }), this;
1993
2413
  }
1994
2414
  /**
1995
2415
  * Deletes the row at the given row position.
1996
- * @param rowPosition The position of the row, starting at 0 for the first row.
1997
- * @returns This sheet, for chaining.
2416
+ * @param {number} rowPosition - The position of the row, starting at 0 for the first row.
2417
+ * @returns {FWorksheet} This sheet, for chaining.
2418
+ * @example
2419
+ * ```typescript
2420
+ * const sheet = workbook.getActiveSheet();
2421
+ * // Delete 3 rows at row index 2 (rows 3-5)
2422
+ * sheet.deleteRow(2);
2423
+ * // Delete 1 row at row index 0 (first row)
2424
+ * sheet.deleteRow(0);
2425
+ * ```
1998
2426
  */
1999
2427
  deleteRow(e) {
2000
2428
  return this.deleteRows(e, 1);
2001
2429
  }
2002
2430
  /**
2003
2431
  * Deletes a number of rows starting at the given row position.
2004
- * @param rowPosition The position of the first row to delete, starting at 0 for the first row.
2005
- * @param howMany The number of rows to delete.
2006
- * @returns This sheet, for chaining.
2432
+ * @param {number} rowPosition - The position of the first row to delete, starting at 0 for the first row.
2433
+ * @param {number} howMany - The number of rows to delete.
2434
+ * @returns {FWorksheet} This sheet, for chaining.
2435
+ * @example
2436
+ * ```typescript
2437
+ * const sheet = workbook.getActiveSheet();
2438
+ * // Delete 3 rows at row index 2 (rows 3-5)
2439
+ * sheet.deleteRows(2, 3);
2440
+ * // Delete 1 row at row index 0 (first row)
2441
+ * sheet.deleteRows(0);
2442
+ * ```
2007
2443
  */
2008
2444
  deleteRows(e, t) {
2009
2445
  const n = {
@@ -2012,7 +2448,7 @@ let g = class extends ne {
2012
2448
  startColumn: 0,
2013
2449
  endColumn: this._worksheet.getColumnCount() - 1
2014
2450
  };
2015
- return this._commandService.syncExecuteCommand(lt.id, {
2451
+ return this._commandService.syncExecuteCommand(Rt.id, {
2016
2452
  range: n,
2017
2453
  unitId: this._workbook.getUnitId(),
2018
2454
  subUnitId: this._worksheet.getSheetId()
@@ -2020,140 +2456,258 @@ let g = class extends ne {
2020
2456
  }
2021
2457
  /**
2022
2458
  * Moves the rows selected by the given range to the position indicated by the destinationIndex. The rowSpec itself does not have to exactly represent an entire row or group of rows to move—it selects all rows that the range spans.
2023
- * @param rowSpec A range spanning the rows that should be moved.
2024
- * @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.
2025
- * @returns This sheet, for chaining.
2459
+ * @param {FRange} rowSpec - A range spanning the rows that should be moved.
2460
+ * @param {number} 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.
2461
+ * @returns {FWorksheet} This sheet, for chaining.
2462
+ * @example
2463
+ * ```typescript
2464
+ * const sheet = workbook.getActiveSheet();
2465
+ * // Move 3 rows at row index 2 (rows 3-5) to row index 0
2466
+ * sheet.moveRows(rowSpec, 0);
2467
+ * // Move 1 row at row index 0 (first row) to row index 2
2468
+ * sheet.moveRows(rowSpec, 2);
2469
+ * ```
2026
2470
  */
2027
2471
  moveRows(e, t) {
2028
- const n = this._workbook.getUnitId(), r = this._worksheet.getSheetId(), o = q(e.getRange(), this._worksheet), i = o, a = {
2472
+ const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), i = G(e.getRange(), this._worksheet), o = i, h = {
2029
2473
  startRow: t,
2030
2474
  endRow: t,
2031
- startColumn: o.startColumn,
2032
- endColumn: o.endColumn
2475
+ startColumn: i.startColumn,
2476
+ endColumn: i.endColumn
2033
2477
  };
2034
- return this._commandService.syncExecuteCommand(gt.id, {
2478
+ return this._commandService.syncExecuteCommand(pt.id, {
2035
2479
  unitId: n,
2036
- subUnitId: r,
2037
- range: o,
2038
- fromRange: i,
2039
- toRange: a
2480
+ subUnitId: s,
2481
+ range: i,
2482
+ fromRange: o,
2483
+ toRange: h
2040
2484
  }), this;
2041
2485
  }
2042
2486
  /**
2043
2487
  * Hides the rows in the given range.
2044
- * @param row The row range to hide.
2045
- * @returns This sheet, for chaining.
2488
+ * @param {FRange} row - The row range to hide.
2489
+ * @returns {FWorksheet} This sheet, for chaining.
2490
+ * @example
2491
+ * ```typescript
2492
+ * const sheet = workbook.getActiveSheet();
2493
+ * // Hide 3 rows starting from row index 1 (rows 2-4)
2494
+ * sheet.hideRow(1);
2495
+ * // Hide single row at index 0 (first row)
2496
+ * sheet.hideRow(0);
2497
+ * ```
2046
2498
  */
2047
2499
  hideRow(e) {
2048
- const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), r = q(e.getRange(), this._worksheet);
2049
- return this._commandService.syncExecuteCommand(le.id, {
2500
+ const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), s = G(e.getRange(), this._worksheet);
2501
+ return this._commandService.syncExecuteCommand(fe.id, {
2050
2502
  unitId: t,
2051
2503
  subUnitId: n,
2052
- ranges: [r]
2504
+ ranges: [s]
2053
2505
  }), this;
2054
2506
  }
2055
2507
  /**
2056
- * Hides one or more consecutive rows starting at the given index. Use 0-index for this method.
2057
- * @param {number} rowIndex The starting index of the rows to hide.
2058
- * @param {number} numRows The number of rows to hide.
2508
+ * Hides one or more consecutive rows starting at the given index. Use 0-index for this method
2509
+ * @param {number} rowIndex - The starting index of the rows to hide
2510
+ * @param {number} numRow - The number of rows to hide
2059
2511
  * @returns {FWorksheet} This sheet, for chaining.
2512
+ * @example
2513
+ * ```typescript
2514
+ * const sheet = workbook.getActiveSheet();
2515
+ * // Hide 3 rows starting from row index 1 (rows 2-4)
2516
+ * sheet.hideRows(1, 3);
2517
+ * // Hide single row at index 0 (first row)
2518
+ * sheet.hideRows(0);
2519
+ * ```
2060
2520
  */
2061
2521
  hideRows(e, t = 1) {
2062
- const n = this._workbook.getUnitId(), r = this._worksheet.getSheetId(), o = {
2522
+ const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), i = {
2063
2523
  startRow: e,
2064
2524
  endRow: e + t - 1,
2065
2525
  startColumn: 0,
2066
2526
  endColumn: this._worksheet.getColumnCount() - 1,
2067
2527
  rangeType: _.ROW
2068
2528
  };
2069
- return this._commandService.syncExecuteCommand(le.id, {
2529
+ return this._commandService.syncExecuteCommand(fe.id, {
2070
2530
  unitId: n,
2071
- subUnitId: r,
2072
- ranges: [o]
2531
+ subUnitId: s,
2532
+ ranges: [i]
2073
2533
  }), this;
2074
2534
  }
2075
2535
  /**
2076
2536
  * Make the row in the given range visible.
2077
- * @param {FRange} row The range to unhide, if hidden.
2537
+ * @param {FRange} row - The range to unhide, if hidden.
2078
2538
  * @returns {FWorksheet} This sheet, for chaining.
2539
+ * @example
2540
+ * ```typescript
2541
+ * const sheet = workbook.getActiveSheet();
2542
+ * // Unhide 3 rows starting from row index 1 (rows 2-4)
2543
+ * sheet.unhideRow(1);
2544
+ * // Unhide single row at index 0 (first row)
2545
+ * sheet.unhideRow(0);
2546
+ * ```
2079
2547
  */
2080
2548
  unhideRow(e) {
2081
- const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), r = q(e.getRange(), this._worksheet);
2082
- return this._commandService.syncExecuteCommand(ge.id, {
2549
+ const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), s = G(e.getRange(), this._worksheet);
2550
+ return this._commandService.syncExecuteCommand(ve.id, {
2083
2551
  unitId: t,
2084
2552
  subUnitId: n,
2085
- ranges: [r]
2553
+ ranges: [s]
2086
2554
  }), this;
2087
2555
  }
2088
2556
  /**
2089
2557
  * Scrolling sheet to make specific rows visible.
2090
- * @param {number} rowIndex The starting index of the rows
2091
- * @param {number} numRows The number of rows
2092
- * @returns {FWorksheet} This sheet, for chaining.
2558
+ * @param {number} rowIndex - The starting index of the rows
2559
+ * @param {number} numRow - The number of rows
2560
+ * @returns {FWorksheet} This worksheet instance for chaining
2561
+ * @example
2562
+ * ```typescript
2563
+ * const sheet = workbook.getActiveSheet();
2564
+ * // Show 3 rows starting from row index 1 (rows 2-4)
2565
+ * sheet.showRows(1);
2566
+ * // Show single row at index 0 (first row)
2567
+ * sheet.showRows(0);
2568
+ * ```
2093
2569
  */
2094
2570
  showRows(e, t = 1) {
2095
- const n = this._workbook.getUnitId(), r = this._worksheet.getSheetId(), o = {
2571
+ const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), i = {
2096
2572
  startRow: e,
2097
2573
  endRow: e + t - 1,
2098
2574
  startColumn: 0,
2099
2575
  endColumn: this._worksheet.getColumnCount() - 1,
2100
2576
  rangeType: _.ROW
2101
2577
  };
2102
- return this._commandService.syncExecuteCommand(ge.id, {
2578
+ return this._commandService.syncExecuteCommand(ve.id, {
2103
2579
  unitId: n,
2104
- subUnitId: r,
2105
- ranges: [o]
2580
+ subUnitId: s,
2581
+ ranges: [i]
2106
2582
  }), this;
2107
2583
  }
2108
2584
  /**
2109
2585
  * 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).
2110
- * @param {number} rowPosition The row position to change.
2111
- * @param {number} height The height in pixels to set it to.
2112
- * @returns {FWorksheet} This sheet, for chaining.
2586
+ * @param {number} rowPosition - The row position to change.
2587
+ * @param {number} height - The height in pixels to set it to.
2588
+ * @returns {FWorksheet} This worksheet instance for chaining
2589
+ * @example
2590
+ * ```typescript
2591
+ * const sheet = workbook.getActiveSheet();
2592
+ * // Set the height of the second row to 30 pixels
2593
+ * sheet.setRowHeight(1, 30);
2594
+ * // Set the height of the first row to 20 pixels
2595
+ * sheet.setRowHeight(0, 20);
2596
+ * ```
2113
2597
  */
2114
2598
  setRowHeight(e, t) {
2115
2599
  return this.setRowHeights(e, 1, t);
2116
2600
  }
2601
+ /**
2602
+ * Make certain row wrap and auto height.
2603
+ * @param rowPosition
2604
+ * @param auto
2605
+ * @returns {FWorksheet} this
2606
+ * @example
2607
+ * ```ts
2608
+ const fWorkbook = univerAPI.getActiveWorkbook();
2609
+ const fWorkSheet = fWorkbook.getActiveSheet();
2610
+ fWorkSheet.autoFitRow(24);
2611
+ * ```
2612
+ */
2613
+ autoFitRow(e, t = g.TRUE) {
2614
+ const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), i = [{
2615
+ startRow: e,
2616
+ endRow: e,
2617
+ startColumn: 0,
2618
+ endColumn: this._worksheet.getColumnCount() - 1
2619
+ }];
2620
+ return this._commandService.syncExecuteCommand(Z.id, {
2621
+ unitId: this._workbook.getUnitId(),
2622
+ subUnitId: this._worksheet.getSheetId(),
2623
+ range: i[0],
2624
+ value: Y.WRAP
2625
+ }), this._commandService.syncExecuteCommand(
2626
+ yt.id,
2627
+ {
2628
+ unitId: n,
2629
+ subUnitId: s,
2630
+ ranges: i,
2631
+ autoHeightInfo: t
2632
+ }
2633
+ ), this;
2634
+ }
2117
2635
  /**
2118
2636
  * Sets the height of the given rows in pixels.
2119
2637
  * By default, rows grow to fit cell contents. If you want to force rows to a specified height, use setRowHeightsForced(startRow, numRows, height).
2120
- * @param {number} startRow The starting row position to change.
2121
- * @param {number} numRows The number of rows to change.
2122
- * @param {number} height The height in pixels to set it to.
2123
- * @returns {FWorksheet} This sheet, for chaining.
2638
+ * @param {number} startRow - The starting row position to change
2639
+ * @param {number} numRows - The number of rows to change
2640
+ * @param {number} height - The height in pixels to set it to
2641
+ * @returns {FWorksheet} This worksheet instance for chaining
2642
+ * @example
2643
+ * ```typescript
2644
+ * const sheet = workbook.getActiveSheet();
2645
+ * sheet.setRowHeights(1, 10, 30);
2646
+ * ```
2647
+ */
2648
+ setRowHeights(e, t, n) {
2649
+ var d;
2650
+ const s = this._workbook.getUnitId(), i = this._worksheet.getSheetId(), o = this._worksheet.getRowManager(), h = [], a = [];
2651
+ for (let c = e; c < e + t; c++) {
2652
+ const v = ((d = o.getRow(c)) == null ? void 0 : d.ah) || this._worksheet.getConfig().defaultRowHeight, k = {
2653
+ startRow: c,
2654
+ endRow: c,
2655
+ startColumn: 0,
2656
+ endColumn: this._worksheet.getColumnCount() - 1
2657
+ };
2658
+ n <= v ? h.push(k) : a.push(k);
2659
+ }
2660
+ return a.length > 0 && this._commandService.syncExecuteCommand(Ie.id, {
2661
+ unitId: s,
2662
+ subUnitId: i,
2663
+ ranges: a,
2664
+ value: n
2665
+ }), h.length > 0 && this._commandService.syncExecuteCommand(be.id, {
2666
+ unitId: s,
2667
+ subUnitId: i,
2668
+ ranges: h
2669
+ }), this;
2670
+ }
2671
+ /**
2672
+ * Sets the height of the given rows to auto.
2673
+ * @param {number} startRow - The starting row position to change
2674
+ * @param {number} numRows - The number of rows to change
2675
+ * @returns {FWorksheet} This worksheet instance for chaining
2676
+ * @example
2677
+ * ```typescript
2678
+ * const sheet = workbook.getActiveSheet();
2679
+ * sheet.setRowAutoHeight(1, 10);
2680
+ * ```
2124
2681
  */
2125
- setRowHeights(e, t, n) {
2126
- var c;
2127
- const r = this._workbook.getUnitId(), o = this._worksheet.getSheetId(), i = this._worksheet.getRowManager(), a = [], h = [];
2128
- for (let d = e; d < e + t; d++) {
2129
- const z = ((c = i.getRow(d)) == null ? void 0 : c.ah) || this._worksheet.getConfig().defaultRowHeight, M = {
2130
- startRow: d,
2131
- endRow: d,
2682
+ setRowAutoHeight(e, t) {
2683
+ const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), i = [
2684
+ {
2685
+ startRow: e,
2686
+ endRow: e + t - 1,
2132
2687
  startColumn: 0,
2133
2688
  endColumn: this._worksheet.getColumnCount() - 1
2134
- };
2135
- n <= z ? a.push(M) : h.push(M);
2136
- }
2137
- return h.length > 0 && this._commandService.syncExecuteCommand(_e.id, {
2138
- unitId: r,
2139
- subUnitId: o,
2140
- ranges: h,
2141
- value: n
2142
- }), a.length > 0 && this._commandService.syncExecuteCommand(_t.id, {
2143
- unitId: r,
2144
- subUnitId: o,
2145
- ranges: a
2689
+ }
2690
+ ];
2691
+ return this._commandService.syncExecuteCommand(be.id, {
2692
+ unitId: n,
2693
+ subUnitId: s,
2694
+ ranges: i
2146
2695
  }), this;
2147
2696
  }
2148
2697
  /**
2149
2698
  * 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.
2150
- * @param {number} startRow The starting row position to change.
2151
- * @param {number} numRows The number of rows to change.
2152
- * @param {number} height The height in pixels to set it to.
2153
- * @returns {FWorksheet} This sheet, for chaining.
2699
+ * @param {number} startRow - The starting row position to change
2700
+ * @param {number} numRows - The number of rows to change
2701
+ * @param {number} height - The height in pixels to set it to
2702
+ * @returns {FWorksheet} This worksheet instance for chaining
2703
+ * @example
2704
+ * ```typescript
2705
+ * const sheet = workbook.getActiveSheet();
2706
+ * sheet.setRowHeightsForced(1, 10, 30);
2707
+ * ```
2154
2708
  */
2155
2709
  setRowHeightsForced(e, t, n) {
2156
- const r = this._workbook.getUnitId(), o = this._worksheet.getSheetId(), i = [
2710
+ const s = this._workbook.getUnitId(), i = this._worksheet.getSheetId(), o = [
2157
2711
  {
2158
2712
  startRow: e,
2159
2713
  endRow: e + t - 1,
@@ -2161,113 +2715,175 @@ let g = class extends ne {
2161
2715
  endColumn: this._worksheet.getColumnCount() - 1
2162
2716
  }
2163
2717
  ];
2164
- return this._commandService.syncExecuteCommand(_e.id, {
2165
- unitId: r,
2166
- subUnitId: o,
2167
- ranges: i,
2718
+ return this._commandService.syncExecuteCommand(Ie.id, {
2719
+ unitId: s,
2720
+ subUnitId: i,
2721
+ ranges: o,
2168
2722
  value: n
2169
2723
  }), this;
2170
2724
  }
2171
2725
  // #endregion
2172
2726
  /**
2173
2727
  * Set custom properties for given rows.
2174
- * @param custom The custom properties to set.
2175
- * @returns This sheet, for chaining.
2728
+ * @param {IObjectArrayPrimitiveType<CustomData>} custom - The custom properties to set
2729
+ * @returns {FWorksheet} This worksheet instance for chaining
2730
+ * @example
2731
+ * ```typescript
2732
+ * const fWorkbook = univerAPI.getActiveWorkbook();
2733
+ * const fWorkSheet = fWorkbook.getActiveSheet();
2734
+ * fWorkSheet.setRowCustom({ key: 'value' });
2735
+ * ```
2176
2736
  */
2177
2737
  setRowCustom(e) {
2178
- const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), r = {};
2179
- for (const [i, a] of Object.entries(e))
2180
- r[Number(i)] = {
2181
- custom: a
2738
+ const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), s = {};
2739
+ for (const [o, h] of Object.entries(e))
2740
+ s[Number(o)] = {
2741
+ custom: h
2182
2742
  };
2183
- const o = {
2743
+ const i = {
2184
2744
  unitId: t,
2185
2745
  subUnitId: n,
2186
- rowData: r
2746
+ rowData: s
2187
2747
  };
2188
- return this._commandService.syncExecuteCommand(ue.id, o), this;
2748
+ return this._commandService.syncExecuteCommand(we.id, i), this;
2189
2749
  }
2190
2750
  // #region Column
2191
2751
  /**
2192
2752
  * Inserts a column after the given column position.
2193
- * @param afterPosition The column after which the new column should be added, starting at 0 for the first column.
2194
- * @returns This sheet, for chaining.
2753
+ * @param {number} afterPosition - The column after which the new column should be added, starting at 0 for the first column
2754
+ * @returns {FWorksheet} This worksheet instance for chaining
2755
+ * @example
2756
+ * ```typescript
2757
+ * const sheet = workbook.getActiveSheet();
2758
+ * // Insert 3 columns at column index 2 (before column C)
2759
+ * sheet.insertColumnAfter(2);
2760
+ * // Insert 1 column at column index 0 (before column A)
2761
+ * sheet.insertColumnAfter(0);
2762
+ * ```
2195
2763
  */
2196
2764
  insertColumnAfter(e) {
2197
2765
  return this.insertColumnsAfter(e, 1);
2198
2766
  }
2199
2767
  /**
2200
2768
  * Inserts a column before the given column position.
2201
- * @param beforePosition The column before which the new column should be added, starting at 0 for the first column.
2202
- * @returns This sheet, for chaining.
2769
+ * @param {number} beforePosition - The column before which the new column should be added, starting at 0 for the first column
2770
+ * @returns {FWorksheet} This worksheet instance for chaining
2771
+ * @example
2772
+ * ```typescript
2773
+ * const sheet = workbook.getActiveSheet();
2774
+ * // Insert 3 columns at column index 2 (before column C)
2775
+ * sheet.insertColumnBefore(2);
2776
+ * // Insert 1 column at column index 0 (before column A)
2777
+ * sheet.insertColumnBefore(0);
2778
+ * ```
2203
2779
  */
2204
2780
  insertColumnBefore(e) {
2205
2781
  return this.insertColumnsBefore(e, 1);
2206
2782
  }
2207
2783
  /**
2208
2784
  * Inserts one or more consecutive blank columns in a sheet starting at the specified location.
2209
- * @param columnIndex The index indicating where to insert a column, starting at 0 for the first column.
2210
- * @param numColumns The number of columns to insert.
2211
- * @returns This sheet, for chaining.
2785
+ * @param {number} columnIndex - The index indicating where to insert a column, starting at 0 for the first column
2786
+ * @param {number} numColumns - The number of columns to insert
2787
+ * @returns {FWorksheet} This sheet, for chaining
2788
+ * @example
2789
+ * ```typescript
2790
+ * const sheet = workbook.getActiveSheet();
2791
+ * // Insert 3 columns at column index 2 (before column C)
2792
+ * sheet.insertColumns(2, 3);
2793
+ * // Insert 1 column at column index 0 (before column A)
2794
+ * sheet.insertColumns(0);
2795
+ * ```
2212
2796
  */
2213
2797
  insertColumns(e, t = 1) {
2214
2798
  return this.insertColumnsBefore(e, t);
2215
2799
  }
2216
2800
  /**
2217
2801
  * Inserts a given number of columns after the given column position.
2218
- * @param afterPosition The column after which the new column should be added, starting at 0 for the first column.
2219
- * @param howMany The number of columns to insert.
2220
- * @returns This sheet, for chaining.
2802
+ * @param {number} afterPosition - The column after which the new columns should be added, starting at 0 for the first column
2803
+ * @param {number} howMany - The number of columns to insert
2804
+ * @returns {FWorksheet} This sheet, for chaining
2805
+ * @example
2806
+ * ```typescript
2807
+ * const sheet = workbook.getActiveSheet();
2808
+ * // Insert 3 columns at column index 2 (before column C)
2809
+ * sheet.insertColumnsAfter(2, 3);
2810
+ * // Insert 1 column at column index 0 (before column A)
2811
+ * sheet.insertColumnsAfter(0, 1);
2812
+ * ```
2221
2813
  */
2222
2814
  insertColumnsAfter(e, t) {
2223
- const n = this._workbook.getUnitId(), r = this._worksheet.getSheetId(), o = D.RIGHT, i = 0, a = this._worksheet.getRowCount() - 1, h = e + 1, c = e + t, d = W(this._worksheet, i, a, h, c, !1, e);
2224
- return this._commandService.syncExecuteCommand(we.id, {
2815
+ const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), i = D.RIGHT, o = 0, h = this._worksheet.getRowCount() - 1, a = e + 1, d = e + t, c = A(this._worksheet, o, h, a, d, !1, e);
2816
+ return this._commandService.syncExecuteCommand(Re.id, {
2225
2817
  unitId: n,
2226
- subUnitId: r,
2227
- direction: o,
2818
+ subUnitId: s,
2819
+ direction: i,
2228
2820
  range: {
2229
- startRow: i,
2230
- endRow: a,
2231
- startColumn: h,
2232
- endColumn: c
2821
+ startRow: o,
2822
+ endRow: h,
2823
+ startColumn: a,
2824
+ endColumn: d
2233
2825
  },
2234
- cellValue: d
2826
+ cellValue: c
2235
2827
  }), this;
2236
2828
  }
2237
2829
  /**
2238
2830
  * Inserts a number of columns before the given column position.
2239
- * @param beforePosition The column before which the new column should be added, starting at 0 for the first column.
2240
- * @param howMany The number of columns to insert.
2241
- * @returns This sheet, for chaining.
2831
+ * @param {number} beforePosition - The column before which the new columns should be added, starting at 0 for the first column
2832
+ * @param {number} howMany - The number of columns to insert
2833
+ * @returns {FWorksheet} This sheet, for chaining
2834
+ * @example
2835
+ * ```typescript
2836
+ * const sheet = workbook.getActiveSheet();
2837
+ * // Insert 3 columns at column index 2 (before column C)
2838
+ * sheet.insertColumnsBefore(2, 3);
2839
+ * // Insert 1 column at column index 0 (before column A)
2840
+ * sheet.insertColumnsBefore(0, 1);
2841
+ * ```
2242
2842
  */
2243
2843
  insertColumnsBefore(e, t) {
2244
- const n = this._workbook.getUnitId(), r = this._worksheet.getSheetId(), o = D.LEFT, i = 0, a = this._worksheet.getRowCount() - 1, h = e, c = e + t - 1, d = W(this._worksheet, i, a, h, c, !1, e - 1);
2245
- return this._commandService.syncExecuteCommand(we.id, {
2844
+ const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), i = D.LEFT, o = 0, h = this._worksheet.getRowCount() - 1, a = e, d = e + t - 1, c = A(this._worksheet, o, h, a, d, !1, e - 1);
2845
+ return this._commandService.syncExecuteCommand(Re.id, {
2246
2846
  unitId: n,
2247
- subUnitId: r,
2248
- direction: o,
2847
+ subUnitId: s,
2848
+ direction: i,
2249
2849
  range: {
2250
- startRow: i,
2251
- endRow: a,
2252
- startColumn: h,
2253
- endColumn: c
2850
+ startRow: o,
2851
+ endRow: h,
2852
+ startColumn: a,
2853
+ endColumn: d
2254
2854
  },
2255
- cellValue: d
2855
+ cellValue: c
2256
2856
  }), this;
2257
2857
  }
2258
2858
  /**
2259
2859
  * Deletes the column at the given column position.
2260
- * @param columnPosition The position of the column, starting at 0 for the first column.
2261
- * @returns This sheet, for chaining.
2860
+ * @param {number} columnPosition - The position of the column, starting at 0 for the first column
2861
+ * @returns {FWorksheet} This sheet, for chaining
2862
+ * @example
2863
+ * ```typescript
2864
+ * const sheet = workbook.getActiveSheet();
2865
+ * // Delete column C
2866
+ * sheet.deleteColumn(2);
2867
+ * // Delete column A
2868
+ * sheet.deleteColumn(0);
2869
+ * ```
2262
2870
  */
2263
2871
  deleteColumn(e) {
2264
2872
  return this.deleteColumns(e, 1);
2265
2873
  }
2266
2874
  /**
2267
2875
  * Deletes a number of columns starting at the given column position.
2268
- * @param columnPosition The position of the first column to delete, starting at 0 for the first column.
2269
- * @param howMany The number of columns to delete.
2270
- * @returns This sheet, for chaining.
2876
+ * @param {number} columnPosition - The position of the first column to delete, starting at 0 for the first column
2877
+ * @param {number} howMany - The number of columns to delete
2878
+ * @returns {FWorksheet} This sheet, for chaining
2879
+ * @example
2880
+ * ```typescript
2881
+ * const sheet = workbook.getActiveSheet();
2882
+ * // Delete 3 columns at column index 2 (columns C, D, E)
2883
+ * sheet.deleteColumns(2, 3);
2884
+ * // Delete 1 column at column index 0 (column A)
2885
+ * sheet.deleteColumns(0, 1);
2886
+ * ```
2271
2887
  */
2272
2888
  deleteColumns(e, t) {
2273
2889
  const n = {
@@ -2276,7 +2892,7 @@ let g = class extends ne {
2276
2892
  startColumn: e,
2277
2893
  endColumn: e + t - 1
2278
2894
  };
2279
- return this._commandService.syncExecuteCommand(wt.id, {
2895
+ return this._commandService.syncExecuteCommand(Et.id, {
2280
2896
  range: n,
2281
2897
  unitId: this._workbook.getUnitId(),
2282
2898
  subUnitId: this._worksheet.getSheetId()
@@ -2284,109 +2900,161 @@ let g = class extends ne {
2284
2900
  }
2285
2901
  /**
2286
2902
  * Moves the columns selected by the given range to the position indicated by the destinationIndex. The columnSpec itself does not have to exactly represent an entire column or group of columns to move—it selects all columns that the range spans.
2287
- * @param columnSpec A range spanning the columns that should be moved.
2288
- * @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.
2289
- * @returns This sheet, for chaining.
2903
+ * @param {FRange} columnSpec - A range spanning the columns that should be moved
2904
+ * @param {number} 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
2905
+ * @returns {FWorksheet} This sheet, for chaining
2906
+ * @example
2907
+ * ```typescript
2908
+ * const sheet = workbook.getActiveSheet();
2909
+ * // Move columns C, D, E to column index 2 (columns B, C, D)
2910
+ * sheet.moveColumns({ startColumn: 2, endColumn: 4 }, 1);
2911
+ * // Move column A to column index 0 (column A)
2912
+ * sheet.moveColumns({ startColumn: 0, endColumn: 0 }, 0);
2913
+ * ```
2290
2914
  */
2291
2915
  moveColumns(e, t) {
2292
- const n = this._workbook.getUnitId(), r = this._worksheet.getSheetId(), o = K(e.getRange(), this._worksheet), i = o, a = {
2916
+ const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), i = q(e.getRange(), this._worksheet), o = i, h = {
2293
2917
  startRow: 0,
2294
2918
  endRow: this._worksheet.getRowCount() - 1,
2295
2919
  startColumn: t,
2296
2920
  endColumn: t
2297
2921
  };
2298
- return this._commandService.syncExecuteCommand(kt.id, {
2922
+ return this._commandService.syncExecuteCommand(Ut.id, {
2299
2923
  unitId: n,
2300
- subUnitId: r,
2301
- range: o,
2302
- fromRange: i,
2303
- toRange: a
2924
+ subUnitId: s,
2925
+ range: i,
2926
+ fromRange: o,
2927
+ toRange: h
2304
2928
  }), this;
2305
2929
  }
2306
2930
  /**
2307
2931
  * Hides the column or columns in the given range.
2308
- * @param column The column range to hide.
2309
- * @returns This sheet, for chaining.
2932
+ * @param {FRange} column - The column range to hide
2933
+ * @returns {FWorksheet} This sheet, for chaining
2934
+ * @example
2935
+ * ```typescript
2936
+ * const sheet = workbook.getActiveSheet();
2937
+ * // Hide columns C, D, E
2938
+ * sheet.hideColumn({ startColumn: 2, endColumn: 4 });
2939
+ * // Hide column A
2940
+ * sheet.hideColumn({ startColumn: 0, endColumn: 0 });
2941
+ * ```
2310
2942
  */
2311
2943
  hideColumn(e) {
2312
- const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), r = K(e.getRange(), this._worksheet);
2313
- return this._commandService.syncExecuteCommand(ke.id, {
2944
+ const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), s = q(e.getRange(), this._worksheet);
2945
+ return this._commandService.syncExecuteCommand(pe.id, {
2314
2946
  unitId: t,
2315
2947
  subUnitId: n,
2316
- ranges: [r]
2948
+ ranges: [s]
2317
2949
  }), this;
2318
2950
  }
2319
2951
  /**
2320
- * Hides one or more consecutive columns starting at the given index. Use 0-index for this method.
2321
- * @param columnIndex The starting index of the columns to hide.
2322
- * @param numColumns The number of columns to hide.
2323
- * @returns This sheet, for chaining.
2952
+ * Hides one or more consecutive columns starting at the given index. Use 0-index for this method
2953
+ * @param {number} columnIndex - The starting index of the columns to hide
2954
+ * @param {number} numColumn - The number of columns to hide
2955
+ * @returns {FWorksheet} This sheet, for chaining
2956
+ * @example
2957
+ * ```typescript
2958
+ * const sheet = workbook.getActiveSheet();
2959
+ * // Hide columns C, D, E
2960
+ * sheet.hideColumns(2, 3);
2961
+ * // Hide column A
2962
+ * sheet.hideColumns(0, 1);
2963
+ * ```
2324
2964
  */
2325
2965
  hideColumns(e, t = 1) {
2326
- const n = this._workbook.getUnitId(), r = this._worksheet.getSheetId(), o = {
2966
+ const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), i = {
2327
2967
  startRow: 0,
2328
2968
  endRow: this._worksheet.getRowCount() - 1,
2329
2969
  startColumn: e,
2330
2970
  endColumn: e + t - 1,
2331
2971
  rangeType: _.COLUMN
2332
2972
  };
2333
- return this._commandService.syncExecuteCommand(ke.id, {
2973
+ return this._commandService.syncExecuteCommand(pe.id, {
2334
2974
  unitId: n,
2335
- subUnitId: r,
2336
- ranges: [o]
2975
+ subUnitId: s,
2976
+ ranges: [i]
2337
2977
  }), this;
2338
2978
  }
2339
2979
  /**
2340
2980
  * Show the column in the given range.
2341
- * @param column The range to unhide, if hidden.
2342
- * @returns This sheet, for chaining.
2981
+ * @param {FRange} column - The range to unhide, if hidden
2982
+ * @returns {FWorksheet} This sheet, for chaining
2983
+ * @example
2984
+ * ```typescript
2985
+ * const sheet = workbook.getActiveSheet();
2986
+ * // Unhide columns C, D, E
2987
+ * sheet.unhideColumn({ startColumn: 2, endColumn: 4 });
2988
+ * // Unhide column A
2989
+ * sheet.unhideColumn({ startColumn: 0, endColumn: 0 });
2990
+ * ```
2343
2991
  */
2344
2992
  unhideColumn(e) {
2345
- const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), r = K(e.getRange(), this._worksheet);
2346
- return this._commandService.syncExecuteCommand(Se.id, {
2993
+ const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), s = q(e.getRange(), this._worksheet);
2994
+ return this._commandService.syncExecuteCommand(ye.id, {
2347
2995
  unitId: t,
2348
2996
  subUnitId: n,
2349
- ranges: [r]
2997
+ ranges: [s]
2350
2998
  }), this;
2351
2999
  }
2352
3000
  /**
2353
- * Show one or more consecutive columns starting at the given index. Use 0-index for this method.
2354
- * @param columnIndex The starting index of the columns to unhide.
2355
- * @param numColumns The number of columns to unhide.
2356
- * @returns This sheet, for chaining.
3001
+ * Show one or more consecutive columns starting at the given index. Use 0-index for this method
3002
+ * @param {number} columnIndex - The starting index of the columns to unhide
3003
+ * @param {number} numColumn - The number of columns to unhide
3004
+ * @returns {FWorksheet} This sheet, for chaining
3005
+ * @example
3006
+ * ```typescript
3007
+ * const sheet = workbook.getActiveSheet();
3008
+ * // Unhide columns C, D, E
3009
+ * sheet.unhideColumns(2, 3);
3010
+ * // Unhide column A
3011
+ * sheet.unhideColumns(0, 1);
3012
+ * ```
2357
3013
  */
2358
3014
  showColumns(e, t = 1) {
2359
- const n = this._workbook.getUnitId(), r = this._worksheet.getSheetId(), o = {
3015
+ const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), i = {
2360
3016
  startRow: 0,
2361
3017
  endRow: this._worksheet.getRowCount() - 1,
2362
3018
  startColumn: e,
2363
3019
  endColumn: e + t - 1,
2364
3020
  rangeType: _.COLUMN
2365
3021
  };
2366
- return this._commandService.syncExecuteCommand(Se.id, {
3022
+ return this._commandService.syncExecuteCommand(ye.id, {
2367
3023
  unitId: n,
2368
- subUnitId: r,
2369
- ranges: [o]
3024
+ subUnitId: s,
3025
+ ranges: [i]
2370
3026
  }), this;
2371
3027
  }
2372
3028
  /**
2373
3029
  * Sets the width of the given column in pixels.
2374
- * @param columnPosition The position of the given column to set.
2375
- * @param width The width in pixels to set it to.
2376
- * @returns This sheet, for chaining.
3030
+ * @param {number} columnPosition - The position of the given column to set
3031
+ * @param {number} width - The width in pixels to set it to
3032
+ * @returns {FWorksheet} This sheet, for chaining
3033
+ * @example
3034
+ * ```typescript
3035
+ * const sheet = workbook.getActiveSheet();
3036
+ * // Set width of column B to 100 pixels
3037
+ * sheet.setColumnWidth(1, 100);
3038
+ * ```
2377
3039
  */
2378
3040
  setColumnWidth(e, t) {
2379
3041
  return this.setColumnWidths(e, 1, t);
2380
3042
  }
2381
3043
  /**
2382
3044
  * Sets the width of the given columns in pixels.
2383
- * @param startColumn The starting column position to change.
2384
- * @param numColumns The number of columns to change.
2385
- * @param width The width in pixels to set it to.
2386
- * @returns This sheet, for chaining.
3045
+ * @param {number} startColumn - The starting column position to change
3046
+ * @param {number} numColumn - The number of columns to change
3047
+ * @param {number} width - The width in pixels to set it to
3048
+ * @returns {FWorksheet} This sheet, for chaining
3049
+ * @example
3050
+ * ```typescript
3051
+ * const sheet = workbook.getActiveSheet();
3052
+ * // Set width of columns B-D (index 1-3) to 100 pixels
3053
+ * sheet.setColumnWidths(1, 3, 100);
3054
+ * ```
2387
3055
  */
2388
3056
  setColumnWidths(e, t, n) {
2389
- const r = this._workbook.getUnitId(), o = this._worksheet.getSheetId(), i = [
3057
+ const s = this._workbook.getUnitId(), i = this._worksheet.getSheetId(), o = [
2390
3058
  {
2391
3059
  startColumn: e,
2392
3060
  endColumn: e + t - 1,
@@ -2394,63 +3062,103 @@ let g = class extends ne {
2394
3062
  endRow: this._worksheet.getRowCount() - 1
2395
3063
  }
2396
3064
  ];
2397
- return this._commandService.syncExecuteCommand(St.id, {
2398
- unitId: r,
2399
- subUnitId: o,
2400
- ranges: i,
3065
+ return this._commandService.syncExecuteCommand(Pt.id, {
3066
+ unitId: s,
3067
+ subUnitId: i,
3068
+ ranges: o,
2401
3069
  value: n
2402
3070
  }), this;
2403
3071
  }
2404
3072
  // #endregion
2405
3073
  /**
2406
3074
  * Set custom properties for given columns.
2407
- * @param custom The custom properties to set.
2408
- * @returns This sheet, for chaining.
3075
+ * @param {IObjectArrayPrimitiveType<CustomData>} custom - The custom properties to set
3076
+ * @returns {FWorksheet} This worksheet instance for chaining
3077
+ * @example
3078
+ * ```ts
3079
+ * const fWorkbook = univerAPI.getActiveWorkbook();
3080
+ * const fWorkSheet = fWorkbook.getActiveSheet();
3081
+ * fWorkSheet.setColumnCustom({ 0: { key: 'value' } });
3082
+ * ```
2409
3083
  */
2410
3084
  setColumnCustom(e) {
2411
- const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), r = {};
2412
- for (const [i, a] of Object.entries(e))
2413
- r[Number(i)] = {
2414
- custom: a
3085
+ const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), s = {};
3086
+ for (const [o, h] of Object.entries(e))
3087
+ s[Number(o)] = {
3088
+ custom: h
2415
3089
  };
2416
- const o = {
3090
+ const i = {
2417
3091
  unitId: t,
2418
3092
  subUnitId: n,
2419
- columnData: r
3093
+ columnData: s
2420
3094
  };
2421
- return this._commandService.syncExecuteCommand(de.id, o), this;
3095
+ return this._commandService.syncExecuteCommand(Se.id, i), this;
2422
3096
  }
2423
3097
  // #region merge cells
2424
3098
  /**
2425
3099
  * Get all merged cells in the current sheet
2426
- * @returns all merged cells
3100
+ * @returns {FRange[]} all merged cells
3101
+ * @example
3102
+ * ```typescript
3103
+ * const sheet = workbook.getActiveSheet();
3104
+ * // Get all merged ranges in the sheet
3105
+ * const mergedRanges = sheet.getMergedRanges();
3106
+ * // Process each merged range
3107
+ * mergedRanges.forEach(range => {
3108
+ * console.log(range.getA1Notation());
3109
+ * });
3110
+ * ```
2427
3111
  */
2428
3112
  getMergedRanges() {
2429
- return this._worksheet.getSnapshot().mergeData.map((t) => this._injector.createInstance(w, this._workbook, this._worksheet, t));
3113
+ return this._worksheet.getSnapshot().mergeData.map((t) => this._injector.createInstance(S, this._workbook, this._worksheet, t));
2430
3114
  }
2431
3115
  /**
2432
3116
  * Get the merged cell data of the specified row and column.
2433
- * @param {number} row The row index.
2434
- * @param {number} column The column index.
2435
- * @returns {FRange|undefined} The merged cell data, or undefined if the cell is not merged.
3117
+ * @param {number} row - The row index
3118
+ * @param {number} column - The column index
3119
+ * @returns {FRange|undefined} The merged cell data, or undefined if the cell is not merged
3120
+ * @example
3121
+ * ```ts
3122
+ * const fWorkbook = univerAPI.getActiveWorkbook();
3123
+ * const fWorkSheet = fWorkbook.getActiveSheet();
3124
+ * const merge = fWorkSheet.getCellMergeData(0, 0);
3125
+ * if (merge) {
3126
+ * console.log('Merged range:', merge.getA1Notation());
3127
+ * }
3128
+ * ```
2436
3129
  */
2437
3130
  getCellMergeData(e, t) {
2438
- const r = this._worksheet.getMergedCell(e, t);
2439
- if (r)
2440
- return this._injector.createInstance(w, this._workbook, this._worksheet, r);
3131
+ const s = this._worksheet.getMergedCell(e, t);
3132
+ if (s)
3133
+ return this._injector.createInstance(S, this._workbook, this._worksheet, s);
2441
3134
  }
2442
3135
  // #endregion
2443
3136
  /**
2444
3137
  * Returns the selected range in the active sheet, or null if there is no active range.
2445
- * @returns the active range
3138
+ * @returns {FRange | null} the active range
3139
+ * @example
3140
+ * ```typescript
3141
+ * const sheet = workbook.getActiveSheet();
3142
+ * // Get the currently active range
3143
+ * const activeRange = sheet.getActiveRange();
3144
+ * if (activeRange) {
3145
+ * console.log('Active range:', activeRange.getA1Notation());
3146
+ * }
3147
+ * ```
2446
3148
  */
2447
3149
  getActiveRange() {
2448
3150
  return this._fWorkbook.getActiveRange();
2449
3151
  }
2450
3152
  /**
2451
3153
  * Sets the active selection region for this sheet.
2452
- * @param {FRange} range The range to set as the active selection.
2453
- * @returns {FWorksheet} This sheet, for chaining.
3154
+ * @param {FRange} range - The range to set as the active selection
3155
+ * @returns {FWorksheet} This sheet, for chaining
3156
+ * @example
3157
+ * ```ts
3158
+ * const fWorkbook = univerAPI.getActiveWorkbook();
3159
+ * const fWorkSheet = fWorkbook.getActiveSheet();
3160
+ * fWorkSheet.setActiveRange(fWorkSheet.getRange('A1'));
3161
+ * ```
2454
3162
  */
2455
3163
  setActiveRange(e) {
2456
3164
  const { unitId: t, sheetId: n } = e.getRange();
@@ -2460,13 +3168,24 @@ let g = class extends ne {
2460
3168
  }
2461
3169
  /**
2462
3170
  * Sets the frozen state of the current sheet.
2463
- * @param freeze - the scrolling viewport start range and count of freezed rows and columns.
3171
+ * @param {IFreeze} freeze - the scrolling viewport start range and count of freezed rows and columns.
2464
3172
  * 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 }
2465
3173
  * @deprecated use `setFrozenRows` and `setFrozenColumns` instead.
2466
- * @returns True if the command was successful, false otherwise.
3174
+ * @returns {FWorksheet} This worksheet instance for chaining
3175
+ * @example
3176
+ * ```typescript
3177
+ * const sheet = workbook.getActiveSheet();
3178
+ * // Freeze first 3 rows and 2 columns
3179
+ * sheet.setFreeze({
3180
+ * startRow: 3,
3181
+ * startColumn: 2,
3182
+ * xSplit: 2,
3183
+ * ySplit: 3
3184
+ * });
3185
+ * ```
2467
3186
  */
2468
3187
  setFreeze(e) {
2469
- return this._logService.warn("setFreeze is deprecated, use setFrozenRows and setFrozenColumns instead"), this._commandService.syncExecuteCommand(H.id, {
3188
+ return this._logService.warn("setFreeze is deprecated, use setFrozenRows and setFrozenColumns instead"), this._commandService.syncExecuteCommand(z.id, {
2470
3189
  ...e,
2471
3190
  unitId: this._workbook.getUnitId(),
2472
3191
  subUnitId: this.getSheetId()
@@ -2474,18 +3193,30 @@ let g = class extends ne {
2474
3193
  }
2475
3194
  /**
2476
3195
  * Cancels the frozen state of the current sheet.
2477
- * @returns True if the command was successful, false otherwise.
3196
+ * @returns {FWorksheet} This worksheet instance for chaining
3197
+ * @example
3198
+ * ```typescript
3199
+ * const sheet = workbook.getActiveSheet();
3200
+ * // Cancel freeze
3201
+ * sheet.cancelFreeze();
3202
+ * ```
2478
3203
  */
2479
3204
  cancelFreeze() {
2480
- return this._commandService.syncExecuteCommand(Ct.id, {
3205
+ return this._commandService.syncExecuteCommand(xt.id, {
2481
3206
  unitId: this._workbook.getUnitId(),
2482
3207
  subUnitId: this.getSheetId()
2483
3208
  }), this;
2484
3209
  }
2485
3210
  /**
2486
3211
  * Get the freeze state of the current sheet.
2487
- * @returns The freeze state of the current sheet.
2488
- * @deprecated use `getRowFreezeStatus` and `getColumnFreezeStatus` instead.
3212
+ * @returns {IFreeze} The freeze state of the current sheet
3213
+ * @example
3214
+ * ```typescript
3215
+ * const sheet = workbook.getActiveSheet();
3216
+ * // Get the freeze state of the current sheet
3217
+ * const freeze = sheet.getFreeze();
3218
+ * console.log(freeze);
3219
+ * ```
2489
3220
  */
2490
3221
  getFreeze() {
2491
3222
  return this._worksheet.getFreeze();
@@ -2500,10 +3231,10 @@ let g = class extends ne {
2500
3231
  xSplit: n
2501
3232
  });
2502
3233
  } else if (arguments.length === 2) {
2503
- let [n = 0, r = 0] = e;
2504
- n > r && ([n, r] = [r, n]), this._commandService.syncExecuteCommand(H.id, {
2505
- startColumn: r + 1,
2506
- xSplit: r - n + 1,
3234
+ let [n = 0, s = 0] = e;
3235
+ n > s && ([n, s] = [s, n]), this._commandService.syncExecuteCommand(z.id, {
3236
+ startColumn: s + 1,
3237
+ xSplit: s - n + 1,
2507
3238
  startRow: t.startRow,
2508
3239
  ySplit: t.ySplit,
2509
3240
  unitId: this._workbook.getUnitId(),
@@ -2522,10 +3253,10 @@ let g = class extends ne {
2522
3253
  ySplit: n
2523
3254
  });
2524
3255
  } else if (arguments.length === 2) {
2525
- let [n = 0, r = 0] = e;
2526
- n > r && ([n, r] = [r, n]), this._commandService.syncExecuteCommand(H.id, {
2527
- startRow: r + 1,
2528
- ySplit: r - n + 1,
3256
+ let [n = 0, s = 0] = e;
3257
+ n > s && ([n, s] = [s, n]), this._commandService.syncExecuteCommand(z.id, {
3258
+ startRow: s + 1,
3259
+ ySplit: s - n + 1,
2529
3260
  startColumn: t.startColumn,
2530
3261
  xSplit: t.xSplit,
2531
3262
  unitId: this._workbook.getUnitId(),
@@ -2536,7 +3267,15 @@ let g = class extends ne {
2536
3267
  }
2537
3268
  /**
2538
3269
  * Get the number of frozen columns.
2539
- * @returns The number of frozen columns, returns 0 if no columns are frozen.
3270
+ * @returns {number} The number of frozen columns, returns 0 if no columns are frozen.
3271
+ * @example
3272
+ * ```typescript
3273
+ * const fWorkbook = univerAPI.getActiveWorkbook();
3274
+ * const fWorkSheet = fWorkbook.getActiveSheet();
3275
+ * // Get the number of frozen columns
3276
+ * const frozenColumns = fWorkSheet.getFrozenColumns();
3277
+ * console.log(frozenColumns);
3278
+ * ```
2540
3279
  */
2541
3280
  getFrozenColumns() {
2542
3281
  const e = this.getFreeze();
@@ -2544,7 +3283,15 @@ let g = class extends ne {
2544
3283
  }
2545
3284
  /**
2546
3285
  * Get the number of frozen rows.
2547
- * @returns The number of frozen rows. returns 0 if no rows are frozen.
3286
+ * @returns {number} The number of frozen rows. returns 0 if no rows are frozen.
3287
+ * @example
3288
+ * ```typescript
3289
+ * const fWorkbook = univerAPI.getActiveWorkbook();
3290
+ * const fWorkSheet = fWorkbook.getActiveSheet();
3291
+ * // Get the number of frozen rows
3292
+ * const frozenRows = fWorkSheet.getFrozenRows();
3293
+ * console.log(frozenRows);
3294
+ * ```
2548
3295
  */
2549
3296
  getFrozenRows() {
2550
3297
  const e = this.getFreeze();
@@ -2553,6 +3300,14 @@ let g = class extends ne {
2553
3300
  /**
2554
3301
  * Get freezed rows.
2555
3302
  * @returns {IRowRange} The range of the frozen rows.
3303
+ * @example
3304
+ * ```ts
3305
+ * const fWorkbook = univerAPI.getActiveWorkbook();
3306
+ * const fWorkSheet = fWorkbook.getActiveSheet();
3307
+ * // Get the range of the frozen rows
3308
+ * const frozenRows = fWorkSheet.getFrozenRowRange();
3309
+ * console.log(frozenRows);
3310
+ * ```
2556
3311
  */
2557
3312
  getFrozenRowRange() {
2558
3313
  const e = this._worksheet.getFreeze();
@@ -2564,6 +3319,14 @@ let g = class extends ne {
2564
3319
  /**
2565
3320
  * Get freezed columns
2566
3321
  * @returns {IColumnRange} The range of the frozen columns.
3322
+ * @example
3323
+ * ```ts
3324
+ * const fWorkbook = univerAPI.getActiveWorkbook();
3325
+ * const fWorkSheet = fWorkbook.getActiveSheet();
3326
+ * // Get the range of the frozen columns
3327
+ * const frozenColumns = fWorkSheet.getFrozenColumnRange();
3328
+ * console.log(frozenColumns);
3329
+ * ```
2567
3330
  */
2568
3331
  getFrozenColumnRange() {
2569
3332
  const e = this._worksheet.getFreeze();
@@ -2586,11 +3349,11 @@ let g = class extends ne {
2586
3349
  * ```
2587
3350
  */
2588
3351
  hasHiddenGridLines() {
2589
- return this._worksheet.getConfig().showGridlines === m.FALSE;
3352
+ return this._worksheet.getConfig().showGridlines === g.FALSE;
2590
3353
  }
2591
3354
  /**
2592
3355
  * Hides or reveals the sheet gridlines.
2593
- * @param {boolean} hidden If `true`, hide gridlines in this sheet; otherwise show the gridlines.
3356
+ * @param {boolean} hidden - If `true`, hide gridlines in this sheet; otherwise show the gridlines.
2594
3357
  * @returns {FWorksheet} Returns the current worksheet instance for method chaining
2595
3358
  * @example
2596
3359
  * ``` ts
@@ -2601,15 +3364,15 @@ let g = class extends ne {
2601
3364
  * ```
2602
3365
  */
2603
3366
  setHiddenGridlines(e) {
2604
- return this._commandService.executeCommand(It.id, {
3367
+ return this._commandService.syncExecuteCommand(te.id, {
2605
3368
  unitId: this._workbook.getUnitId(),
2606
3369
  subUnitId: this._worksheet.getSheetId(),
2607
- showGridlines: e ? m.FALSE : m.TRUE
3370
+ showGridlines: e ? g.FALSE : g.TRUE
2608
3371
  }), this;
2609
3372
  }
2610
3373
  /**
2611
3374
  * Set the color of the gridlines in the sheet.
2612
- * @param {string|undefined} color The color to set for the gridlines.Undefined or null to reset to the default color.
3375
+ * @param {string|undefined} color - The color to set for the gridlines.Undefined or null to reset to the default color.
2613
3376
  * @returns {FWorksheet} Returns the current worksheet instance for method chaining
2614
3377
  * @example
2615
3378
  * ```ts
@@ -2620,7 +3383,7 @@ let g = class extends ne {
2620
3383
  * ```
2621
3384
  */
2622
3385
  setGridLinesColor(e) {
2623
- return this._commandService.syncExecuteCommand(ft.id, {
3386
+ return this._commandService.syncExecuteCommand(ne.id, {
2624
3387
  unitId: this._workbook.getUnitId(),
2625
3388
  subUnitId: this._worksheet.getSheetId(),
2626
3389
  color: e
@@ -2629,13 +3392,20 @@ let g = class extends ne {
2629
3392
  /**
2630
3393
  * Get the color of the gridlines in the sheet.
2631
3394
  * @returns {string | undefined} The color of the gridlines in the sheet or undefined. The default color is 'rgb(214, 216, 219)'.
3395
+ * @example
3396
+ * ```ts
3397
+ * const fWorkbook = univerAPI.getActiveWorkbook();
3398
+ * const fWorkSheet = fWorkbook.getActiveSheet();
3399
+ * // get the gridlines color of the sheet
3400
+ * console.log(fWorkSheet.getGridLinesColor());
3401
+ * ```
2632
3402
  */
2633
3403
  getGridLinesColor() {
2634
3404
  return this._worksheet.getGridlinesColor();
2635
3405
  }
2636
3406
  /**
2637
3407
  * Sets the sheet tab color.
2638
- * @param {string|null|undefined} color A color code in CSS notation (like '#ffffff' or 'white'), or null to reset the tab color.
3408
+ * @param {string|null|undefined} color - A color code in CSS notation (like '#ffffff' or 'white'), or null to reset the tab color.
2639
3409
  * @returns {FWorksheet} Returns the current worksheet instance for method chaining
2640
3410
  * @example
2641
3411
  * ```ts
@@ -2646,7 +3416,7 @@ let g = class extends ne {
2646
3416
  * ```
2647
3417
  */
2648
3418
  setTabColor(e) {
2649
- return this._commandService.executeCommand(vt.id, {
3419
+ return this._commandService.syncExecuteCommand(re.id, {
2650
3420
  unitId: this._workbook.getUnitId(),
2651
3421
  subUnitId: this._worksheet.getSheetId(),
2652
3422
  color: e
@@ -2667,51 +3437,27 @@ let g = class extends ne {
2667
3437
  getTabColor() {
2668
3438
  return this._worksheet.getTabColor();
2669
3439
  }
3440
+ // eslint-disable-next-line
2670
3441
  /**
2671
- * Subscribe to the cell data change event.
2672
- * @param callback - The callback function to be executed when the cell data changes.
2673
- * @returns - A disposable object to unsubscribe from the event.
2674
- * @example
2675
- * ```ts
2676
- * const fWorkbook = univerAPI.getActiveWorkbook();
2677
- * const fWorkSheet = fWorkbook.getActiveSheet();
2678
- * // subscribe to the cell data change event
2679
- * const disposable = fWorkSheet.onCellDataChange((cellValue) => {
2680
- * console.log(cellValue.toArray());
2681
- * });
2682
- * // unsubscribe from the event
2683
- * disposable.dispose();
2684
- * ```
3442
+ * @deprecated use `univerAPI.addEvent(univerAPI.Event.SheetValueChanged, callback)` instead
2685
3443
  */
2686
3444
  onCellDataChange(e) {
2687
3445
  return this._injector.get(l).onCommandExecuted((n) => {
2688
- if (n.id === Ce.id) {
2689
- const r = n.params;
2690
- r.unitId === this._workbook.getUnitId() && r.subUnitId === this._worksheet.getSheetId() && r.cellValue && e(new A(r.cellValue));
3446
+ if (n.id === Ee.id) {
3447
+ const s = n.params;
3448
+ s.unitId === this._workbook.getUnitId() && s.subUnitId === this._worksheet.getSheetId() && s.cellValue && e(new W(s.cellValue));
2691
3449
  }
2692
3450
  });
2693
3451
  }
3452
+ // eslint-disable-next-line
2694
3453
  /**
2695
- * Subscribe to the cell data change event.
2696
- * @param callback - The callback function to be executed before the cell data changes.
2697
- * @returns - A disposable object to unsubscribe from the event.
2698
- * @example
2699
- * ```ts
2700
- * const fWorkbook = univerAPI.getActiveWorkbook();
2701
- * const fWorkSheet = fWorkbook.getActiveSheet();
2702
- * // subscribe to the cell data change event
2703
- * const disposable = fWorkSheet.onBeforeCellDataChange((cellValue) => {
2704
- * console.log(cellValue.toArray());
2705
- * });
2706
- * // unsubscribe from the event
2707
- * disposable.dispose();
2708
- * ```
3454
+ * @deprecated use `univerAPI.addEvent(univerAPI.Event.SheetValueChanged, callback)` instead
2709
3455
  */
2710
3456
  onBeforeCellDataChange(e) {
2711
3457
  return this._injector.get(l).beforeCommandExecuted((n) => {
2712
- if (n.id === Ce.id) {
2713
- const r = n.params;
2714
- r.unitId === this._workbook.getUnitId() && r.subUnitId === this._worksheet.getSheetId() && r.cellValue && e(new A(r.cellValue));
3458
+ if (n.id === Ee.id) {
3459
+ const s = n.params;
3460
+ s.unitId === this._workbook.getUnitId() && s.subUnitId === this._worksheet.getSheetId() && s.cellValue && e(new W(s.cellValue));
2715
3461
  }
2716
3462
  });
2717
3463
  }
@@ -2728,9 +3474,9 @@ let g = class extends ne {
2728
3474
  */
2729
3475
  hideSheet() {
2730
3476
  const e = this._injector.get(l);
2731
- if (this._workbook.getSheets().filter((o) => o.isSheetHidden() !== m.TRUE).length <= 1)
3477
+ if (this._workbook.getSheets().filter((i) => i.isSheetHidden() !== g.TRUE).length <= 1)
2732
3478
  throw new Error("Cannot hide the only visible sheet");
2733
- return e.syncExecuteCommand(Rt.id, {
3479
+ return e.syncExecuteCommand(se.id, {
2734
3480
  unitId: this._workbook.getUnitId(),
2735
3481
  subUnitId: this._worksheet.getSheetId()
2736
3482
  }), this;
@@ -2747,7 +3493,7 @@ let g = class extends ne {
2747
3493
  * ```
2748
3494
  */
2749
3495
  showSheet() {
2750
- return this._injector.get(l).syncExecuteCommand(bt.id, {
3496
+ return this._injector.get(l).syncExecuteCommand(Nt.id, {
2751
3497
  unitId: this._workbook.getUnitId(),
2752
3498
  subUnitId: this._worksheet.getSheetId()
2753
3499
  }), this;
@@ -2757,11 +3503,11 @@ let g = class extends ne {
2757
3503
  * @returns {boolean} True if the sheet is hidden; otherwise, false.
2758
3504
  */
2759
3505
  isSheetHidden() {
2760
- return this._worksheet.isSheetHidden() === m.TRUE;
3506
+ return this._worksheet.isSheetHidden() === g.TRUE;
2761
3507
  }
2762
3508
  /**
2763
3509
  * Sets the sheet name.
2764
- * @param {string} name The new name for the sheet.
3510
+ * @param {string} name - The new name for the sheet.
2765
3511
  * @returns {FWorksheet} Returns the current worksheet instance for method chaining
2766
3512
  * @example
2767
3513
  * ```ts
@@ -2772,7 +3518,7 @@ let g = class extends ne {
2772
3518
  * ```
2773
3519
  */
2774
3520
  setName(e) {
2775
- return this._commandService.syncExecuteCommand(pt.id, {
3521
+ return this._commandService.syncExecuteCommand(ie.id, {
2776
3522
  unitId: this._workbook.getUnitId(),
2777
3523
  subUnitId: this._worksheet.getSheetId(),
2778
3524
  name: e
@@ -2780,7 +3526,7 @@ let g = class extends ne {
2780
3526
  }
2781
3527
  /**
2782
3528
  * Activates this sheet. Does not alter the sheet itself, only the parent's notion of the active sheet.
2783
- * @returns Current sheet, for chaining.
3529
+ * @returns {FWorksheet} Current sheet, for chaining.
2784
3530
  */
2785
3531
  activate() {
2786
3532
  return this._fWorkbook.setActiveSheet(this), this;
@@ -2802,9 +3548,9 @@ let g = class extends ne {
2802
3548
  }
2803
3549
  /**
2804
3550
  * Clears the sheet of content and formatting information.Or Optionally clears only the contents or only the formatting.
2805
- * @param {IFacadeClearOptions} [options] Options for clearing the sheet. If not provided, the contents and formatting are cleared both.
2806
- * @param {boolean} [options.contentsOnly] If true, the contents of the sheet are cleared. If false, the contents and formatting are cleared. Default is false.
2807
- * @param {boolean} [options.formatOnly] If true, the formatting of the sheet is cleared. If false, the contents and formatting are cleared. Default is false.
3551
+ * @param {IFacadeClearOptions} [options] - Options for clearing the sheet. If not provided, the contents and formatting are cleared both.
3552
+ * @param {boolean} [options.contentsOnly] - If true, the contents of the sheet are cleared. If false, the contents and formatting are cleared. Default is false.
3553
+ * @param {boolean} [options.formatOnly] - If true, the formatting of the sheet is cleared. If false, the contents and formatting are cleared. Default is false.
2808
3554
  * @returns {FWorksheet} Returns the current worksheet instance for method chaining
2809
3555
  * @example
2810
3556
  * ```ts
@@ -2818,16 +3564,16 @@ let g = class extends ne {
2818
3564
  */
2819
3565
  clear(e) {
2820
3566
  e && e.contentsOnly && !e.formatOnly && this.clearContents(), e && e.formatOnly && !e.contentsOnly && this.clearFormats();
2821
- const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), r = this._injector.get(l), o = {
3567
+ const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), s = this._injector.get(l), i = {
2822
3568
  startRow: 0,
2823
3569
  endRow: this._worksheet.getRowCount() - 1,
2824
3570
  startColumn: 0,
2825
3571
  endColumn: this._worksheet.getColumnCount() - 1
2826
3572
  };
2827
- return r.syncExecuteCommand(yt.id, {
3573
+ return s.syncExecuteCommand(Tt.id, {
2828
3574
  unitId: t,
2829
3575
  subUnitId: n,
2830
- ranges: [o],
3576
+ ranges: [i],
2831
3577
  options: e
2832
3578
  }), this;
2833
3579
  }
@@ -2835,7 +3581,7 @@ let g = class extends ne {
2835
3581
  * Clears the sheet of contents, while preserving formatting information.
2836
3582
  * @returns {FWorksheet} Returns the current worksheet instance for method chaining
2837
3583
  * @example
2838
- * ```ts
3584
+ * ```typescript
2839
3585
  * const fWorkbook = univerAPI.getActiveWorkbook();
2840
3586
  * const fWorkSheet = fWorkbook.getActiveSheet();
2841
3587
  * // clear the sheet of content only
@@ -2843,23 +3589,23 @@ let g = class extends ne {
2843
3589
  * ```
2844
3590
  */
2845
3591
  clearContents() {
2846
- const e = this._workbook.getUnitId(), t = this._worksheet.getSheetId(), n = this._injector.get(l), r = {
3592
+ const e = this._workbook.getUnitId(), t = this._worksheet.getSheetId(), n = this._injector.get(l), s = {
2847
3593
  startRow: 0,
2848
3594
  endRow: this._worksheet.getRowCount() - 1,
2849
3595
  startColumn: 0,
2850
3596
  endColumn: this._worksheet.getColumnCount() - 1
2851
3597
  };
2852
- return n.syncExecuteCommand(Ut.id, {
3598
+ return n.syncExecuteCommand(Mt.id, {
2853
3599
  unitId: e,
2854
3600
  subUnitId: t,
2855
- ranges: [r]
3601
+ ranges: [s]
2856
3602
  }), this;
2857
3603
  }
2858
3604
  /**
2859
3605
  * Clears the sheet of formatting, while preserving contents.
2860
3606
  * @returns {FWorksheet} Returns the current worksheet instance for method chaining
2861
3607
  * @example
2862
- * ```ts
3608
+ * ```typescript
2863
3609
  * const fWorkbook = univerAPI.getActiveWorkbook();
2864
3610
  * const fWorkSheet = fWorkbook.getActiveSheet();
2865
3611
  * // clear the sheet of formatting only
@@ -2867,16 +3613,16 @@ let g = class extends ne {
2867
3613
  * ```
2868
3614
  */
2869
3615
  clearFormats() {
2870
- const e = this._workbook.getUnitId(), t = this._worksheet.getSheetId(), n = this._injector.get(l), r = {
3616
+ const e = this._workbook.getUnitId(), t = this._worksheet.getSheetId(), n = this._injector.get(l), s = {
2871
3617
  startRow: 0,
2872
3618
  endRow: this._worksheet.getRowCount() - 1,
2873
3619
  startColumn: 0,
2874
3620
  endColumn: this._worksheet.getColumnCount() - 1
2875
3621
  };
2876
- return n.syncExecuteCommand(Et.id, {
3622
+ return n.syncExecuteCommand(Dt.id, {
2877
3623
  unitId: e,
2878
3624
  subUnitId: t,
2879
- ranges: [r]
3625
+ ranges: [s]
2880
3626
  }), this;
2881
3627
  }
2882
3628
  /**
@@ -2957,7 +3703,7 @@ let g = class extends ne {
2957
3703
  }
2958
3704
  /**
2959
3705
  * Judge whether provided FWorksheet is equal to current.
2960
- * @param {FWorksheet} other the FWorksheet to compare with.
3706
+ * @param {FWorksheet} other - the FWorksheet to compare with.
2961
3707
  * @returns {boolean} true if the FWorksheet is equal to the current FWorksheet, false otherwise.
2962
3708
  * @example
2963
3709
  * ```ts
@@ -2968,12 +3714,12 @@ let g = class extends ne {
2968
3714
  * ```
2969
3715
  */
2970
3716
  equalTo(e) {
2971
- return e instanceof g ? this._worksheet.getSheetId() === e.getSheetId() && this._workbook.getUnitId() === e.getWorkbook().getUnitId() : !1;
3717
+ return e instanceof m ? this._worksheet.getSheetId() === e.getSheetId() && this._workbook.getUnitId() === e.getWorkbook().getUnitId() : !1;
2972
3718
  }
2973
3719
  /*
2974
3720
  * Insert a defined name for worksheet.
2975
- * @param {string} name The name of the defined name to insert
2976
- * @param {string} formulaOrRefString The formula(=sum(A2:b10)) or reference(A1) string of the defined name to insert
3721
+ * @param {string} name - The name of the defined name to insert
3722
+ * @param {string} formulaOrRefString - The formula(=sum(A2:b10)) or reference(A1) string of the defined name to insert
2977
3723
  * @example
2978
3724
  * ```ts
2979
3725
  * // The code below inserts a defined name
@@ -2983,8 +3729,8 @@ let g = class extends ne {
2983
3729
  * ```
2984
3730
  */
2985
3731
  insertDefinedName(e, t) {
2986
- const r = this._injector.createInstance(L).setName(e).setRef(t).build();
2987
- r.localSheetId = this.getSheetId(), this._fWorkbook.insertDefinedNameBuilder(r);
3732
+ const s = this._injector.createInstance(V).setName(e).setRef(t).build();
3733
+ s.localSheetId = this.getSheetId(), this._fWorkbook.insertDefinedNameBuilder(s);
2988
3734
  }
2989
3735
  /**
2990
3736
  * Get all the defined names in the worksheet.
@@ -3002,7 +3748,8 @@ let g = class extends ne {
3002
3748
  }
3003
3749
  /**
3004
3750
  * Set custom metadata of worksheet
3005
- * @param {CustomData | undefined} custom custom metadata
3751
+ * @param {CustomData | undefined} custom - custom metadata
3752
+ * @returns {FWorksheet}
3006
3753
  * @example
3007
3754
  * ```ts
3008
3755
  * const fWorkbook = univerAPI.getActiveWorkbook();
@@ -3015,8 +3762,9 @@ let g = class extends ne {
3015
3762
  }
3016
3763
  /**
3017
3764
  * Set custom metadata of row
3018
- * @param {number} index row index
3019
- * @param {CustomData | undefined} custom custom metadata
3765
+ * @param {number} index - row index
3766
+ * @param {CustomData | undefined} custom - custom metadata
3767
+ * @returns {FWorksheet} Current worksheet, for chaining.
3020
3768
  * @example
3021
3769
  * ```ts
3022
3770
  * const fWorkbook = univerAPI.getActiveWorkbook();
@@ -3029,8 +3777,9 @@ let g = class extends ne {
3029
3777
  }
3030
3778
  /**
3031
3779
  * Set custom metadata of column
3032
- * @param {number} index column index
3033
- * @param {CustomData | undefined} custom custom metadata
3780
+ * @param {number} index - column index
3781
+ * @param {CustomData | undefined} custom - custom metadata
3782
+ * @returns {FWorksheet} Current worksheet, for chaining.
3034
3783
  * @example
3035
3784
  * ```ts
3036
3785
  * const fWorkbook = univerAPI.getActiveWorkbook();
@@ -3043,7 +3792,7 @@ let g = class extends ne {
3043
3792
  }
3044
3793
  /**
3045
3794
  * Get custom metadata of row
3046
- * @param {number} index row index
3795
+ * @param {number} index - row index
3047
3796
  * @returns {CustomData | undefined} custom metadata
3048
3797
  * @example
3049
3798
  * ```ts
@@ -3057,7 +3806,7 @@ let g = class extends ne {
3057
3806
  }
3058
3807
  /**
3059
3808
  * Get custom metadata of column
3060
- * @param {number} index column index
3809
+ * @param {number} index - column index
3061
3810
  * @returns {CustomData | undefined} custom metadata
3062
3811
  * @example
3063
3812
  * ```ts
@@ -3085,74 +3834,38 @@ let g = class extends ne {
3085
3834
  * ```
3086
3835
  */
3087
3836
  getMergeData() {
3088
- return this._worksheet.getMergeData().map((e) => this._injector.createInstance(w, this._workbook, this._worksheet, e));
3837
+ return this._worksheet.getMergeData().map((e) => this._injector.createInstance(S, this._workbook, this._worksheet, e));
3089
3838
  }
3090
3839
  };
3091
- g = sn([
3092
- T(3, u(b)),
3093
- T(4, u(We)),
3094
- T(5, u(pe)),
3095
- T(6, l)
3096
- ], g);
3097
- var rn = Object.defineProperty, on = Object.getOwnPropertyDescriptor, an = (s, e, t, n) => {
3098
- for (var r = n > 1 ? void 0 : n ? on(e, t) : e, o = s.length - 1, i; o >= 0; o--)
3099
- (i = s[o]) && (r = (n ? i(e, t, r) : i(r)) || r);
3100
- return n && r && rn(e, t, r), r;
3101
- }, C = (s, e) => (t, n) => e(t, n, s);
3102
- let I = class extends ne {
3103
- constructor(e, t, n, r, o, i, a, h, c, d) {
3840
+ m = gn([
3841
+ B(3, u(y)),
3842
+ B(4, u(ze)),
3843
+ B(5, u(De)),
3844
+ B(6, l)
3845
+ ], m);
3846
+ var ln = Object.defineProperty, mn = Object.getOwnPropertyDescriptor, _n = (r, e, t, n) => {
3847
+ for (var s = n > 1 ? void 0 : n ? mn(e, t) : e, i = r.length - 1, o; i >= 0; i--)
3848
+ (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
3849
+ return n && s && ln(e, t, s), s;
3850
+ }, C = (r, e) => (t, n) => e(t, n, r);
3851
+ let f = class extends ce {
3852
+ constructor(e, t, n, s, i, o, h, a, d, c) {
3104
3853
  super(t);
3105
- k(this, "id");
3106
- k(this, "_eventRegistry", /* @__PURE__ */ new Map());
3107
- this._workbook = e, this._injector = t, this._resourceLoaderService = n, this._selectionManagerService = r, this._univerInstanceService = o, this._commandService = i, this._permissionService = a, this._logService = h, this._localeService = c, this._definedNamesService = d, this.id = this._workbook.getUnitId();
3108
- }
3109
- getWorkbook() {
3110
- return this._workbook;
3111
- }
3112
- _ensureEventRegistry(e) {
3113
- return this._eventRegistry.has(e) || this._eventRegistry.set(e, new ye()), this._eventRegistry.get(e);
3854
+ b(this, "id");
3855
+ this._workbook = e, this._injector = t, this._resourceLoaderService = n, this._selectionManagerService = s, this._univerInstanceService = i, this._commandService = o, this._permissionService = h, this._logService = a, this._localeService = d, this._definedNamesService = c, this.id = this._workbook.getUnitId();
3114
3856
  }
3115
3857
  /**
3116
- * Add an event listener
3117
- * @param event key of event
3118
- * @param callback callback when event triggered
3119
- * @returns {Disposable} The Disposable instance, for remove the listener
3858
+ * Get the Workbook instance.
3859
+ * @returns {Workbook} The Workbook instance.
3120
3860
  * @example
3121
3861
  * ```ts
3122
- * univerAPI.addEvent(univerAPI.event.UnitCreated, (params) => {
3123
- * console.log('unit created', params);
3124
- * });
3125
- * ```
3126
- */
3127
- addEvent(e, t) {
3128
- return this._ensureEventRegistry(e).add(t), this.addUIEvent(e, t), F(() => this._ensureEventRegistry(e).delete(t));
3129
- }
3130
- /**
3131
- * Fire an event, used in internal only.
3132
- * @param event {string} key of event
3133
- * @param params {any} params of event
3134
- * @returns {boolean} should cancel
3135
- * @example
3136
- * ```ts
3137
- * this.fireEvent(univerAPI.event.UnitCreated, params);
3862
+ * // The code below gets the Workbook instance
3863
+ * const activeSpreadsheet = univerAPI.getActiveWorkbook();
3864
+ * const workbook = activeSpreadsheet.getWorkbook();
3138
3865
  * ```
3139
3866
  */
3140
- fireEvent(e, t) {
3141
- var n;
3142
- return (n = this._eventRegistry.get(e)) == null || n.getData().forEach((r) => {
3143
- r(t);
3144
- }), t.cancel;
3145
- }
3146
- addUIEvent(e, t) {
3147
- }
3148
- get Enum() {
3149
- return ze.get();
3150
- }
3151
- /**
3152
- * @returns {FEventName} The event name.
3153
- */
3154
- get Event() {
3155
- return se.get();
3867
+ getWorkbook() {
3868
+ return this._workbook;
3156
3869
  }
3157
3870
  /**
3158
3871
  * Get the id of the workbook.
@@ -3183,6 +3896,7 @@ let I = class extends ne {
3183
3896
  /**
3184
3897
  * Set the name of the workbook.
3185
3898
  * @param {string} name The new name of the workbook.
3899
+ * @returns {void}
3186
3900
  * @example
3187
3901
  * ```ts
3188
3902
  * // The code below sets the name of the workbook
@@ -3208,8 +3922,14 @@ let I = class extends ne {
3208
3922
  }
3209
3923
  /**
3210
3924
  * @deprecated use 'save' instead.
3211
- * @returns {*} {IWorkbookData} Workbook snapshot data
3925
+ * @returns {IWorkbookData} Workbook snapshot data
3212
3926
  * @memberof FWorkbook
3927
+ * @example
3928
+ * ```ts
3929
+ * // The code below saves the workbook snapshot data
3930
+ * const activeSpreadsheet = univerAPI.getActiveWorkbook();
3931
+ * const snapshot = activeSpreadsheet.getSnapshot();
3932
+ * ```
3213
3933
  */
3214
3934
  getSnapshot() {
3215
3935
  return this._logService.warn("use 'save' instead of 'getSnapshot'"), this.save();
@@ -3226,7 +3946,7 @@ let I = class extends ne {
3226
3946
  */
3227
3947
  getActiveSheet() {
3228
3948
  const e = this._workbook.getActiveSheet();
3229
- return this._injector.createInstance(g, this, this._workbook, e);
3949
+ return this._injector.createInstance(m, this, this._workbook, e);
3230
3950
  }
3231
3951
  /**
3232
3952
  * Gets all the worksheets in this workbook
@@ -3239,14 +3959,14 @@ let I = class extends ne {
3239
3959
  * ```
3240
3960
  */
3241
3961
  getSheets() {
3242
- return this._workbook.getSheets().map((e) => this._injector.createInstance(g, this, this._workbook, e));
3962
+ return this._workbook.getSheets().map((e) => this._injector.createInstance(m, this, this._workbook, e));
3243
3963
  }
3244
3964
  /**
3245
3965
  * Create a new worksheet and returns a handle to it.
3246
- * @param name Name of the new sheet
3247
- * @param rows How may rows would the new sheet have
3248
- * @param column How many columns would the new sheet have
3249
- * @returns The new created sheet
3966
+ * @param {string} name Name of the new sheet
3967
+ * @param {number} rows How many rows would the new sheet have
3968
+ * @param {number} column How many columns would the new sheet have
3969
+ * @returns {FWorksheet} The new created sheet
3250
3970
  * @example
3251
3971
  * ```ts
3252
3972
  * // The code below creates a new sheet
@@ -3255,24 +3975,24 @@ let I = class extends ne {
3255
3975
  * ```
3256
3976
  */
3257
3977
  create(e, t, n) {
3258
- const r = $e({});
3259
- r.rowCount = t, r.columnCount = n, r.name = e, r.id = e.toLowerCase().replace(/ /g, "-"), this._commandService.syncExecuteCommand(x.id, {
3978
+ const s = Ze({});
3979
+ s.rowCount = t, s.columnCount = n, s.name = e, s.id = e.toLowerCase().replace(/ /g, "-"), this._commandService.syncExecuteCommand(T.id, {
3260
3980
  unitId: this.id,
3261
3981
  index: this._workbook.getSheets().length,
3262
- sheet: r
3263
- }), this._commandService.syncExecuteCommand(G.id, {
3982
+ sheet: s
3983
+ }), this._commandService.syncExecuteCommand($.id, {
3264
3984
  unitId: this.id,
3265
3985
  subUnitId: this._workbook.getSheets()[this._workbook.getSheets().length - 1].getSheetId()
3266
3986
  });
3267
- const o = this._workbook.getActiveSheet();
3268
- if (!o)
3987
+ const i = this._workbook.getActiveSheet();
3988
+ if (!i)
3269
3989
  throw new Error("No active sheet found");
3270
- return this._injector.createInstance(g, this, this._workbook, o);
3990
+ return this._injector.createInstance(m, this, this._workbook, i);
3271
3991
  }
3272
3992
  /**
3273
3993
  * Get a worksheet by sheet id.
3274
- * @param sheetId The id of the sheet to get.
3275
- * @returns The worksheet with given sheet id
3994
+ * @param {string} sheetId The id of the sheet to get.
3995
+ * @returns {FWorksheet | null} The worksheet with given sheet id
3276
3996
  * @example
3277
3997
  * ```ts
3278
3998
  * // The code below gets a worksheet by sheet id
@@ -3282,12 +4002,12 @@ let I = class extends ne {
3282
4002
  */
3283
4003
  getSheetBySheetId(e) {
3284
4004
  const t = this._workbook.getSheetBySheetId(e);
3285
- return t ? this._injector.createInstance(g, this, this._workbook, t) : null;
4005
+ return t ? this._injector.createInstance(m, this, this._workbook, t) : null;
3286
4006
  }
3287
4007
  /**
3288
4008
  * Get a worksheet by sheet name.
3289
- * @param name The name of the sheet to get.
3290
- * @returns The worksheet with given sheet name
4009
+ * @param {string} name The name of the sheet to get.
4010
+ * @returns {FWorksheet | null} The worksheet with given sheet name
3291
4011
  * @example
3292
4012
  * ```ts
3293
4013
  * // The code below gets a worksheet by sheet name
@@ -3297,12 +4017,12 @@ let I = class extends ne {
3297
4017
  */
3298
4018
  getSheetByName(e) {
3299
4019
  const t = this._workbook.getSheetBySheetName(e);
3300
- return t ? this._injector.createInstance(g, this, this._workbook, t) : null;
4020
+ return t ? this._injector.createInstance(m, this, this._workbook, t) : null;
3301
4021
  }
3302
4022
  /**
3303
4023
  * Sets the given worksheet to be the active worksheet in the workbook.
3304
- * @param sheet The worksheet to set as the active worksheet.
3305
- * @returns The active worksheet
4024
+ * @param {FWorksheet | string} sheet The worksheet to set as the active worksheet.
4025
+ * @returns {FWorksheet} The active worksheet
3306
4026
  * @example
3307
4027
  * ```ts
3308
4028
  * // The code below sets the given worksheet to be the active worksheet
@@ -3312,16 +4032,16 @@ let I = class extends ne {
3312
4032
  * ```
3313
4033
  */
3314
4034
  setActiveSheet(e) {
3315
- return this._commandService.syncExecuteCommand(G.id, {
4035
+ return this._commandService.syncExecuteCommand($.id, {
3316
4036
  unitId: this.id,
3317
- subUnitId: e.getSheetId()
3318
- }), e;
4037
+ subUnitId: typeof e == "string" ? e : e.getSheetId()
4038
+ }), typeof e == "string" ? this.getSheetBySheetId(e) : e;
3319
4039
  }
3320
4040
  /**
3321
4041
  * Inserts a new worksheet into the workbook.
3322
4042
  * Using a default sheet name. The new sheet becomes the active sheet
3323
- * @param sheetName - (optional) The name of the new sheet
3324
- * @returns The new sheet
4043
+ * @param {string} [sheetName] The name of the new sheet
4044
+ * @returns {FWorksheet} The new sheet
3325
4045
  * @example
3326
4046
  * ```ts
3327
4047
  * // The code below inserts a new sheet into the workbook
@@ -3334,20 +4054,20 @@ let I = class extends ne {
3334
4054
  * ```
3335
4055
  */
3336
4056
  insertSheet(e) {
3337
- e != null ? this._commandService.syncExecuteCommand(x.id, { sheet: { name: e } }) : this._commandService.syncExecuteCommand(x.id);
4057
+ e != null ? this._commandService.syncExecuteCommand(T.id, { sheet: { name: e } }) : this._commandService.syncExecuteCommand(T.id);
3338
4058
  const t = this.id, n = this._workbook.getSheets()[this._workbook.getSheets().length - 1].getSheetId();
3339
- this._commandService.syncExecuteCommand(G.id, {
4059
+ this._commandService.syncExecuteCommand($.id, {
3340
4060
  unitId: t,
3341
4061
  subUnitId: n
3342
4062
  });
3343
- const r = this._workbook.getActiveSheet();
3344
- if (!r)
4063
+ const s = this._workbook.getActiveSheet();
4064
+ if (!s)
3345
4065
  throw new Error("No active sheet found");
3346
- return this._injector.createInstance(g, this, this._workbook, r);
4066
+ return this._injector.createInstance(m, this, this._workbook, s);
3347
4067
  }
3348
4068
  /**
3349
4069
  * Deletes the specified worksheet.
3350
- * @param sheet The worksheet to delete.
4070
+ * @param {FWorksheet | string} sheet The worksheet to delete.
3351
4071
  * @returns {boolean} True if the worksheet was deleted, false otherwise.
3352
4072
  * @example
3353
4073
  * ```ts
@@ -3358,8 +4078,8 @@ let I = class extends ne {
3358
4078
  * ```
3359
4079
  */
3360
4080
  deleteSheet(e) {
3361
- const t = this.id, n = e.getSheetId();
3362
- return this._commandService.syncExecuteCommand(Pt.id, {
4081
+ const t = this.id, n = typeof e == "string" ? e : e.getSheetId();
4082
+ return this._commandService.syncExecuteCommand(oe.id, {
3363
4083
  unitId: t,
3364
4084
  subUnitId: n
3365
4085
  });
@@ -3376,11 +4096,11 @@ let I = class extends ne {
3376
4096
  * ```
3377
4097
  */
3378
4098
  undo() {
3379
- return this._univerInstanceService.focusUnit(this.id), this._commandService.syncExecuteCommand(He.id), this;
4099
+ return this._univerInstanceService.focusUnit(this.id), this._commandService.syncExecuteCommand(et.id), this;
3380
4100
  }
3381
4101
  /**
3382
4102
  * Redo the last undone action.
3383
- * @returns A promise that resolves to true if the redo was successful, false otherwise.
4103
+ * @returns {FWorkbook} A promise that resolves to true if the redo was successful, false otherwise.
3384
4104
  * @example
3385
4105
  * ```ts
3386
4106
  * // The code below redoes the last undone action
@@ -3389,7 +4109,7 @@ let I = class extends ne {
3389
4109
  * ```
3390
4110
  */
3391
4111
  redo() {
3392
- return this._univerInstanceService.focusUnit(this.id), this._commandService.syncExecuteCommand(Ge.id), this;
4112
+ return this._univerInstanceService.focusUnit(this.id), this._commandService.syncExecuteCommand(tt.id), this;
3393
4113
  }
3394
4114
  /**
3395
4115
  * Callback for command execution.
@@ -3399,7 +4119,7 @@ let I = class extends ne {
3399
4119
  /**
3400
4120
  * Register a callback that will be triggered before invoking a command targeting the Univer sheet.
3401
4121
  * @param {onBeforeCommandExecuteCallback} callback the callback.
3402
- * @returns A function to dispose the listening.
4122
+ * @returns {IDisposable} A function to dispose the listening.
3403
4123
  * @example
3404
4124
  * ```ts
3405
4125
  * // The code below registers a callback that will be triggered before invoking a command targeting the Univer sheet
@@ -3423,7 +4143,7 @@ let I = class extends ne {
3423
4143
  /**
3424
4144
  * Register a callback that will be triggered when a command is invoked targeting the Univer sheet.
3425
4145
  * @param {onCommandExecutedCallback} callback the callback.
3426
- * @returns A function to dispose the listening.
4146
+ * @returns {IDisposable} A function to dispose the listening.
3427
4147
  * @example
3428
4148
  * ```ts
3429
4149
  * // The code below registers a callback that will be triggered when a command is invoked targeting the Univer sheet
@@ -3431,6 +4151,7 @@ let I = class extends ne {
3431
4151
  * activeSpreadsheet.onCommandExecuted((command) => {
3432
4152
  * console.log('Command executed:', command);
3433
4153
  * });
4154
+ * ```
3434
4155
  */
3435
4156
  onCommandExecuted(e) {
3436
4157
  return this._commandService.onCommandExecuted((t) => {
@@ -3446,12 +4167,12 @@ let I = class extends ne {
3446
4167
  /**
3447
4168
  * Register a callback that will be triggered when the selection changes.
3448
4169
  * @param {onSelectionChangeCallback} callback The callback.
3449
- * @returns A function to dispose the listening
4170
+ * @returns {IDisposable} A function to dispose the listening
3450
4171
  */
3451
4172
  onSelectionChange(e) {
3452
- return F(
4173
+ return Ae(
3453
4174
  this._selectionManagerService.selectionMoveEnd$.subscribe((t) => {
3454
- this._univerInstanceService.getCurrentUnitForType(R.UNIVER_SHEET).getUnitId() === this.id && (t != null && t.length ? e(t.map((n) => n.range)) : e([]));
4175
+ this._univerInstanceService.getCurrentUnitForType(p.UNIVER_SHEET).getUnitId() === this.id && (t != null && t.length ? e(t.map((n) => n.range)) : e([]));
3455
4176
  })
3456
4177
  );
3457
4178
  }
@@ -3461,34 +4182,34 @@ let I = class extends ne {
3461
4182
  * @returns {FWorkbook} FWorkbook instance
3462
4183
  */
3463
4184
  setEditable(e) {
3464
- const t = new Ne(this._workbook.getUnitId());
4185
+ const t = new Le(this._workbook.getUnitId());
3465
4186
  return this._permissionService.getPermissionPoint(t.id) || this._permissionService.addPermissionPoint(t), this._permissionService.updatePermissionPoint(t.id, e), this;
3466
4187
  }
3467
4188
  /**
3468
4189
  * Sets the selection region for active sheet.
3469
- * @param range The range to set as the active selection.
4190
+ * @param {FRange} range The range to set as the active selection.
3470
4191
  * @returns {FWorkbook} FWorkbook instance
3471
4192
  */
3472
4193
  setActiveRange(e) {
3473
- const t = this.getActiveSheet(), n = e.getRange().sheetId || t.getSheetId(), r = n ? this._workbook.getSheetBySheetId(n) : this._workbook.getActiveSheet(!0);
3474
- if (!r)
4194
+ const t = this.getActiveSheet(), n = e.getRange().sheetId || t.getSheetId(), s = n ? this._workbook.getSheetBySheetId(n) : this._workbook.getActiveSheet(!0);
4195
+ if (!s)
3475
4196
  throw new Error("No active sheet found");
3476
- r.getSheetId() !== t.getSheetId() && this.setActiveSheet(this._injector.createInstance(g, this, this._workbook, r));
3477
- const o = {
4197
+ s.getSheetId() !== t.getSheetId() && this.setActiveSheet(this._injector.createInstance(m, this, this._workbook, s));
4198
+ const i = {
3478
4199
  unitId: this.getId(),
3479
4200
  subUnitId: n,
3480
- selections: [e].map((i) => ({ range: i.getRange(), primary: Z(i.getRange(), r), style: null }))
4201
+ selections: [e].map((o) => ({ range: o.getRange(), primary: ee(o.getRange(), s), style: null }))
3481
4202
  };
3482
- return this._commandService.syncExecuteCommand(De.id, o), this;
4203
+ return this._commandService.syncExecuteCommand(He.id, i), this;
3483
4204
  }
3484
4205
  /**
3485
4206
  * Returns the selected range in the active sheet, or null if there is no active range.
3486
- * @returns the active range
4207
+ * @returns {FRange | null} The active range
3487
4208
  */
3488
4209
  // could sheet have no active range ?
3489
4210
  getActiveRange() {
3490
- const e = this._workbook.getActiveSheet(), n = this._selectionManagerService.getCurrentSelections().find((r) => !!r.primary);
3491
- return n ? this._injector.createInstance(w, this._workbook, e, n.range) : null;
4211
+ const e = this._workbook.getActiveSheet(), n = this._selectionManagerService.getCurrentSelections().find((s) => !!s.primary);
4212
+ return n ? this._injector.createInstance(S, this._workbook, e, n.range) : null;
3492
4213
  }
3493
4214
  /**
3494
4215
  * Deletes the currently active sheet.
@@ -3517,17 +4238,16 @@ let I = class extends ne {
3517
4238
  * ```
3518
4239
  */
3519
4240
  duplicateSheet(e) {
3520
- return this._commandService.syncExecuteCommand(xt.id, {
4241
+ return this._commandService.syncExecuteCommand(At.id, {
3521
4242
  unitId: e.getWorkbook().getUnitId(),
3522
4243
  subUnitId: e.getSheetId()
3523
- }), this._injector.createInstance(g, this, this._workbook, this._workbook.getActiveSheet());
4244
+ }), this._injector.createInstance(m, this, this._workbook, this._workbook.getActiveSheet());
3524
4245
  }
3525
4246
  /**
3526
4247
  * Duplicates the active sheet.
3527
4248
  * @returns {FWorksheet} The duplicated worksheet
3528
4249
  * @example
3529
4250
  * ```ts
3530
- * // The code below duplicates the active sheet
3531
4251
  * const activeSpreadsheet = univerAPI.getActiveWorkbook();
3532
4252
  * activeSpreadsheet.duplicateActiveSheet();
3533
4253
  * ```
@@ -3538,7 +4258,7 @@ let I = class extends ne {
3538
4258
  }
3539
4259
  /**
3540
4260
  * Get the number of sheets in the workbook.
3541
- * @returns The number of sheets in the workbook
4261
+ * @returns {number} The number of sheets in the workbook
3542
4262
  * @example
3543
4263
  * ```ts
3544
4264
  * // The code below gets the number of sheets in the workbook
@@ -3611,7 +4331,7 @@ let I = class extends ne {
3611
4331
  */
3612
4332
  moveSheet(e, t) {
3613
4333
  let n = t;
3614
- return n < 0 ? n = 0 : n > this._workbook.getSheets().length - 1 && (n = this._workbook.getSheets().length - 1), this._commandService.syncExecuteCommand(Nt.id, {
4334
+ return n < 0 ? n = 0 : n > this._workbook.getSheets().length - 1 && (n = this._workbook.getSheets().length - 1), this._commandService.syncExecuteCommand(he.id, {
3615
4335
  unitId: e.getWorkbook().getUnitId(),
3616
4336
  order: n,
3617
4337
  subUnitId: e.getSheetId()
@@ -3637,7 +4357,7 @@ let I = class extends ne {
3637
4357
  * @returns {FPermission} - The PermissionInstance.
3638
4358
  */
3639
4359
  getPermission() {
3640
- return this._injector.createInstance(O);
4360
+ return this._injector.createInstance(j);
3641
4361
  }
3642
4362
  /**
3643
4363
  * Get the defined name by name.
@@ -3652,7 +4372,7 @@ let I = class extends ne {
3652
4372
  */
3653
4373
  getDefinedName(e) {
3654
4374
  const t = this._definedNamesService.getValueByName(this.id, e);
3655
- return t ? this._injector.createInstance(j, { ...t, unitId: this.id }) : null;
4375
+ return t ? this._injector.createInstance(F, { ...t, unitId: this.id }) : null;
3656
4376
  }
3657
4377
  /**
3658
4378
  * Get all the defined names in the workbook.
@@ -3666,7 +4386,7 @@ let I = class extends ne {
3666
4386
  */
3667
4387
  getDefinedNames() {
3668
4388
  const e = this._definedNamesService.getDefinedNameMap(this.id);
3669
- return e ? Object.values(e).map((t) => this._injector.createInstance(j, { ...t, unitId: this.id })) : [];
4389
+ return e ? Object.values(e).map((t) => this._injector.createInstance(F, { ...t, unitId: this.id })) : [];
3670
4390
  }
3671
4391
  /**
3672
4392
  * Insert a defined name.
@@ -3681,8 +4401,8 @@ let I = class extends ne {
3681
4401
  * ```
3682
4402
  */
3683
4403
  insertDefinedName(e, t) {
3684
- const r = this._injector.createInstance(L).setName(e).setRef(t).build();
3685
- return r.localSheetId = X, this.insertDefinedNameBuilder(r), this;
4404
+ const s = this._injector.createInstance(V).setName(e).setRef(t).build();
4405
+ return s.localSheetId = X, this.insertDefinedNameBuilder(s), this;
3686
4406
  }
3687
4407
  /**
3688
4408
  * Delete the defined name with the given name.
@@ -3702,6 +4422,7 @@ let I = class extends ne {
3702
4422
  /**
3703
4423
  * Insert a defined name by builder param.
3704
4424
  * @param {ISetDefinedNameMutationParam} param The param to insert the defined name
4425
+ * @returns {void}
3705
4426
  * @example
3706
4427
  * ```ts
3707
4428
  * // The code below inserts a defined name by builder param
@@ -3717,6 +4438,7 @@ let I = class extends ne {
3717
4438
  /**
3718
4439
  * Update the defined name with the given name.
3719
4440
  * @param {ISetDefinedNameMutationParam} param The param to insert the defined name
4441
+ * @returns {void}
3720
4442
  * @example
3721
4443
  * ```ts
3722
4444
  * // The code below updates the defined name with the given name
@@ -3741,11 +4463,12 @@ let I = class extends ne {
3741
4463
  * ```
3742
4464
  */
3743
4465
  getRegisteredRangeThemes() {
3744
- return this._injector.get(Me).getRegisteredRangeThemes();
4466
+ return this._injector.get(Ve).getRegisteredRangeThemes();
3745
4467
  }
3746
4468
  /**
3747
4469
  * Register a custom range theme style.
3748
- * @param rangeThemeStyle
4470
+ * @param {RangeThemeStyle} rangeThemeStyle The range theme style to register
4471
+ * @returns {void}
3749
4472
  * @example
3750
4473
  * ```ts
3751
4474
  * // import {RangeThemeStyle} from '@univerjs/sheets';
@@ -3760,14 +4483,15 @@ let I = class extends ne {
3760
4483
  * ```
3761
4484
  */
3762
4485
  registerRangeTheme(e) {
3763
- this._commandService.syncExecuteCommand(Mt.id, {
4486
+ this._commandService.syncExecuteCommand(Bt.id, {
3764
4487
  unitId: this.getId(),
3765
4488
  rangeThemeStyle: e
3766
4489
  });
3767
4490
  }
3768
4491
  /**
3769
4492
  * Unregister a custom range theme style.
3770
- * @param themeName
4493
+ * @param {string} themeName The name of the theme to unregister
4494
+ * @returns {void}
3771
4495
  * @example
3772
4496
  * ```ts
3773
4497
  * const fWorkbook = univerAPI.getActiveWorkbook();
@@ -3775,7 +4499,7 @@ let I = class extends ne {
3775
4499
  * ```
3776
4500
  */
3777
4501
  unregisterRangeTheme(e) {
3778
- this._commandService.syncExecuteCommand(Dt.id, {
4502
+ this._commandService.syncExecuteCommand(Wt.id, {
3779
4503
  unitId: this.getId(),
3780
4504
  themeName: e
3781
4505
  });
@@ -3806,42 +4530,42 @@ let I = class extends ne {
3806
4530
  return this._workbook.getCustomMetadata();
3807
4531
  }
3808
4532
  };
3809
- I = an([
3810
- C(1, u(b)),
3811
- C(2, u(Le)),
3812
- C(3, u(We)),
4533
+ f = _n([
4534
+ C(1, u(y)),
4535
+ C(2, u(Xe)),
4536
+ C(3, u(ze)),
3813
4537
  C(4, J),
3814
4538
  C(5, l),
3815
- C(6, ee),
3816
- C(7, pe),
3817
- C(8, u(Re)),
3818
- C(9, Te)
3819
- ], I);
3820
- class hn extends Ue {
4539
+ C(6, ae),
4540
+ C(7, De),
4541
+ C(8, u(Te)),
4542
+ C(9, $e)
4543
+ ], f);
4544
+ class kn extends Be {
3821
4545
  getCommandSheetTarget(e) {
3822
- var o;
4546
+ var i;
3823
4547
  const t = e.params;
3824
4548
  if (!t) return;
3825
- const n = t.unitId ? this.getUniverSheet(t.unitId) : (o = this.getActiveWorkbook) == null ? void 0 : o.call(this);
4549
+ const n = t.unitId ? this.getUniverSheet(t.unitId) : (i = this.getActiveWorkbook) == null ? void 0 : i.call(this);
3826
4550
  if (!n)
3827
4551
  return;
3828
- const r = n.getSheetBySheetId(t.subUnitId || t.sheetId) || n.getActiveSheet();
3829
- if (r)
3830
- return { workbook: n, worksheet: r };
4552
+ const s = n.getSheetBySheetId(t.subUnitId || t.sheetId) || n.getActiveSheet();
4553
+ if (s)
4554
+ return { workbook: n, worksheet: s };
3831
4555
  }
3832
4556
  getSheetTarget(e, t) {
3833
4557
  const n = this.getUniverSheet(e);
3834
4558
  if (!n)
3835
4559
  return;
3836
- const r = n.getSheetBySheetId(t);
3837
- if (r)
3838
- return { workbook: n, worksheet: r };
4560
+ const s = n.getSheetBySheetId(t);
4561
+ if (s)
4562
+ return { workbook: n, worksheet: s };
3839
4563
  }
3840
4564
  _initWorkbookEvent(e) {
3841
4565
  const t = e.get(J);
3842
4566
  this.disposeWithMe(
3843
4567
  t.unitDisposed$.subscribe((n) => {
3844
- this._eventRegistry.get(this.Event.WorkbookDisposed) && n.type === R.UNIVER_SHEET && this.fireEvent(
4568
+ this._eventRegistry.get(this.Event.WorkbookDisposed) && n.type === p.UNIVER_SHEET && this.fireEvent(
3845
4569
  this.Event.WorkbookDisposed,
3846
4570
  {
3847
4571
  unitId: n.getUnitId(),
@@ -3852,59 +4576,142 @@ class hn extends Ue {
3852
4576
  })
3853
4577
  ), this.disposeWithMe(
3854
4578
  t.unitAdded$.subscribe((n) => {
3855
- if (this._eventRegistry.get(this.Event.WorkbookCreated) && n.type === R.UNIVER_SHEET) {
3856
- const r = n, o = e.createInstance(I, r);
4579
+ if (this._eventRegistry.get(this.Event.WorkbookCreated) && n.type === p.UNIVER_SHEET) {
4580
+ const s = n, i = e.createInstance(f, s);
3857
4581
  this.fireEvent(
3858
4582
  this.Event.WorkbookCreated,
3859
4583
  {
3860
4584
  unitId: n.getUnitId(),
3861
4585
  type: n.type,
3862
- workbook: o,
3863
- unit: o
4586
+ workbook: i,
4587
+ unit: i
3864
4588
  }
3865
4589
  );
3866
4590
  }
3867
4591
  })
3868
4592
  );
3869
4593
  }
4594
+ // eslint-disable-next-line max-lines-per-function
3870
4595
  _initialize(e) {
3871
4596
  const t = e.get(l);
3872
4597
  this.disposeWithMe(
4598
+ // eslint-disable-next-line max-lines-per-function, complexity
3873
4599
  t.beforeCommandExecuted((n) => {
3874
- var r;
4600
+ var s, i, o, h;
3875
4601
  switch (n.id) {
3876
- case x.id: {
3877
- const o = n.params, { unitId: i, index: a, sheet: h } = o || {}, c = i ? this.getUniverSheet(i) : (r = this.getActiveWorkbook) == null ? void 0 : r.call(this);
3878
- if (!c)
4602
+ case T.id: {
4603
+ const a = n.params, { unitId: d, index: c, sheet: v } = a || {}, k = d ? this.getUniverSheet(d) : (s = this.getActiveWorkbook) == null ? void 0 : s.call(this);
4604
+ if (!k)
3879
4605
  return;
3880
- const d = {
3881
- workbook: c,
3882
- index: a,
3883
- sheet: h
4606
+ const ge = {
4607
+ workbook: k,
4608
+ index: c,
4609
+ sheet: v
3884
4610
  };
3885
4611
  if (this.fireEvent(
3886
4612
  this.Event.BeforeSheetCreate,
3887
- d
3888
- ), d.cancel)
3889
- throw new qe();
4613
+ ge
4614
+ ), ge.cancel)
4615
+ throw new nt();
4616
+ break;
4617
+ }
4618
+ case Ue.id: {
4619
+ if (!this._eventListend(this.Event.BeforeActiveSheetChange)) return;
4620
+ const { subUnitId: a, unitId: d } = n.params, c = d ? this.getUniverSheet(d) : (i = this.getActiveWorkbook) == null ? void 0 : i.call(this);
4621
+ if (!c || !a) return;
4622
+ const v = c.getSheetBySheetId(a), k = c.getActiveSheet();
4623
+ if (!v || !k) return;
4624
+ this._fireBeforeActiveSheetChange(c, v, k);
4625
+ break;
4626
+ }
4627
+ case oe.id: {
4628
+ if (!this._eventListend(this.Event.BeforeSheetDelete)) return;
4629
+ const a = this.getCommandSheetTarget(n);
4630
+ if (!a) return;
4631
+ const { workbook: d, worksheet: c } = a;
4632
+ this._fireBeforeSheetDelete(d, c);
4633
+ break;
4634
+ }
4635
+ case he.id: {
4636
+ if (!this._eventListend(this.Event.BeforeSheetMove)) return;
4637
+ const { fromOrder: a, toOrder: d } = n.params, c = this.getCommandSheetTarget(n);
4638
+ if (!c) return;
4639
+ this._fireBeforeSheetMove(c.workbook, c.worksheet, d, a);
4640
+ break;
4641
+ }
4642
+ case ie.id: {
4643
+ if (!this._eventListend(this.Event.BeforeSheetNameChange)) return;
4644
+ const { name: a } = n.params, d = this.getCommandSheetTarget(n);
4645
+ if (!d) return;
4646
+ this._fireBeforeSheetNameChange(d.workbook, d.worksheet, a, d.worksheet.getSheetName());
4647
+ break;
4648
+ }
4649
+ case re.id: {
4650
+ if (!this._eventListend(this.Event.BeforeSheetTabColorChange)) return;
4651
+ const { color: a } = n.params, d = this.getCommandSheetTarget(n);
4652
+ if (!d) return;
4653
+ this._fireBeforeSheetTabColorChange(d.workbook, d.worksheet, a, d.worksheet.getTabColor());
4654
+ break;
4655
+ }
4656
+ case se.id: {
4657
+ if (!this._eventListend(this.Event.BeforeSheetHideChange)) return;
4658
+ const { hidden: a } = n.params, d = this.getCommandSheetTarget(n);
4659
+ if (!d) return;
4660
+ this._fireBeforeSheetHideChange(d.workbook, d.worksheet, !!a);
4661
+ break;
4662
+ }
4663
+ case ne.id: {
4664
+ if (!this._eventListend(this.Event.BeforeGridlineColorChange)) return;
4665
+ const a = this.getCommandSheetTarget(n);
4666
+ if (!a) return;
4667
+ this.fireEvent(this.Event.BeforeGridlineColorChange, {
4668
+ ...a,
4669
+ color: (o = n.params) == null ? void 0 : o.color
4670
+ });
4671
+ break;
4672
+ }
4673
+ case te.id: {
4674
+ if (!this._eventListend(this.Event.BeforeGridlineEnableChange)) return;
4675
+ const a = this.getCommandSheetTarget(n);
4676
+ if (!a) return;
4677
+ this.fireEvent(this.Event.BeforeGridlineEnableChange, {
4678
+ ...a,
4679
+ enabled: !!((h = n.params) != null && h.showGridlines)
4680
+ });
3890
4681
  break;
3891
4682
  }
3892
4683
  }
3893
4684
  })
3894
4685
  ), this.disposeWithMe(
4686
+ // eslint-disable-next-line max-lines-per-function, complexity
3895
4687
  t.onCommandExecuted((n) => {
3896
- var r;
4688
+ var s, i;
4689
+ if (Ft.indexOf(n.id) > -1) {
4690
+ if (!this._eventListend(this.Event.SheetValueChanged) || !this.getActiveSheet()) return;
4691
+ const h = jt(n).map(
4692
+ (a) => {
4693
+ var d, c;
4694
+ return (c = (d = this.getWorkbook(a.unitId)) == null ? void 0 : d.getSheetBySheetId(a.subUnitId)) == null ? void 0 : c.getRange(a.range);
4695
+ }
4696
+ ).filter(Boolean);
4697
+ if (!h.length) return;
4698
+ this.fireEvent(this.Event.SheetValueChanged, {
4699
+ payload: n,
4700
+ effectedRanges: h
4701
+ });
4702
+ return;
4703
+ }
3897
4704
  switch (n.id) {
3898
- case x.id: {
3899
- const o = n.params, { unitId: i } = o || {}, a = i ? this.getUniverSheet(i) : (r = this.getActiveWorkbook) == null ? void 0 : r.call(this);
4705
+ case T.id: {
4706
+ const o = n.params, { unitId: h } = o || {}, a = h ? this.getUniverSheet(h) : (s = this.getActiveWorkbook) == null ? void 0 : s.call(this);
3900
4707
  if (!a)
3901
4708
  return;
3902
- const h = a.getActiveSheet();
3903
- if (!h)
4709
+ const d = a.getActiveSheet();
4710
+ if (!d)
3904
4711
  return;
3905
4712
  const c = {
3906
4713
  workbook: a,
3907
- worksheet: h
4714
+ worksheet: d
3908
4715
  };
3909
4716
  this.fireEvent(
3910
4717
  this.Event.SheetCreated,
@@ -3912,47 +4719,202 @@ class hn extends Ue {
3912
4719
  );
3913
4720
  break;
3914
4721
  }
4722
+ case Ue.id: {
4723
+ if (!this._eventListend(this.Event.ActiveSheetChanged)) return;
4724
+ const o = this.getActiveSheet();
4725
+ if (!o) return;
4726
+ const { workbook: h, worksheet: a } = o;
4727
+ this._fireActiveSheetChanged(h, a);
4728
+ break;
4729
+ }
4730
+ case oe.id: {
4731
+ if (!this._eventListend(this.Event.SheetDeleted)) return;
4732
+ const { subUnitId: o, unitId: h } = n.params, a = h ? this.getUniverSheet(h) : (i = this.getActiveWorkbook) == null ? void 0 : i.call(this);
4733
+ if (!a || !o) return;
4734
+ this._fireSheetDeleted(a, o);
4735
+ break;
4736
+ }
4737
+ case he.id: {
4738
+ if (!this._eventListend(this.Event.SheetMoved)) return;
4739
+ const { toOrder: o } = n.params, h = this.getCommandSheetTarget(n);
4740
+ if (!h) return;
4741
+ this._fireSheetMoved(h.workbook, h.worksheet, o);
4742
+ break;
4743
+ }
4744
+ case ie.id: {
4745
+ if (!this._eventListend(this.Event.SheetNameChanged)) return;
4746
+ const { name: o } = n.params, h = this.getCommandSheetTarget(n);
4747
+ if (!h) return;
4748
+ this._fireSheetNameChanged(h.workbook, h.worksheet, o);
4749
+ break;
4750
+ }
4751
+ case re.id: {
4752
+ if (!this._eventListend(this.Event.SheetTabColorChanged)) return;
4753
+ const { color: o } = n.params, h = this.getCommandSheetTarget(n);
4754
+ if (!h) return;
4755
+ this._fireSheetTabColorChanged(h.workbook, h.worksheet, o);
4756
+ break;
4757
+ }
4758
+ case se.id: {
4759
+ if (!this._eventListend(this.Event.SheetHideChanged)) return;
4760
+ const { hidden: o } = n.params, h = this.getCommandSheetTarget(n);
4761
+ if (!h) return;
4762
+ this._fireSheetHideChanged(h.workbook, h.worksheet, !!o);
4763
+ break;
4764
+ }
4765
+ case ne.id:
4766
+ case te.id: {
4767
+ if (!this._eventListend(this.Event.GridlineChanged)) return;
4768
+ const o = this.getCommandSheetTarget(n);
4769
+ if (!o) return;
4770
+ this.fireEvent(this.Event.GridlineChanged, {
4771
+ ...o,
4772
+ enabled: !o.worksheet.hasHiddenGridLines(),
4773
+ color: o.worksheet.getGridLinesColor()
4774
+ });
4775
+ break;
4776
+ }
3915
4777
  }
3916
4778
  })
3917
4779
  ), this._initWorkbookEvent(e);
3918
4780
  }
3919
4781
  createUniverSheet(e) {
3920
- const n = this._injector.get(J).createUnit(R.UNIVER_SHEET, e);
3921
- return this._injector.createInstance(I, n);
4782
+ const n = this._injector.get(J).createUnit(p.UNIVER_SHEET, e);
4783
+ return this._injector.createInstance(f, n);
3922
4784
  }
3923
4785
  createWorkbook(e) {
3924
4786
  return this.createUniverSheet(e);
3925
4787
  }
3926
4788
  getActiveWorkbook() {
3927
- const e = this._univerInstanceService.getCurrentUnitForType(R.UNIVER_SHEET);
3928
- return e ? this._injector.createInstance(I, e) : null;
4789
+ const e = this._univerInstanceService.getCurrentUnitForType(p.UNIVER_SHEET);
4790
+ return e ? this._injector.createInstance(f, e) : null;
3929
4791
  }
3930
4792
  getActiveUniverSheet() {
3931
4793
  return this.getActiveWorkbook();
3932
4794
  }
3933
4795
  getUniverSheet(e) {
3934
- const t = this._univerInstanceService.getUnit(e, R.UNIVER_SHEET);
3935
- return t ? this._injector.createInstance(I, t) : null;
4796
+ const t = this._univerInstanceService.getUnit(e, p.UNIVER_SHEET);
4797
+ return t ? this._injector.createInstance(f, t) : null;
3936
4798
  }
3937
4799
  getWorkbook(e) {
3938
4800
  return this.getUniverSheet(e);
3939
4801
  }
3940
4802
  getPermission() {
3941
- return this._injector.createInstance(O);
4803
+ return this._injector.createInstance(j);
3942
4804
  }
3943
4805
  onUniverSheetCreated(e) {
3944
- const t = this._univerInstanceService.getTypeOfUnitAdded$(R.UNIVER_SHEET).subscribe((n) => {
3945
- const r = this._injector.createInstance(I, n);
3946
- e(r);
4806
+ const t = this._univerInstanceService.getTypeOfUnitAdded$(p.UNIVER_SHEET).subscribe((n) => {
4807
+ const s = this._injector.createInstance(f, n);
4808
+ e(s);
3947
4809
  });
3948
- return F(t);
4810
+ return Ae(t);
3949
4811
  }
3950
4812
  newDefinedName() {
3951
- return this._injector.createInstance(L);
4813
+ return this._injector.createInstance(V);
4814
+ }
4815
+ getActiveSheet() {
4816
+ const e = this.getActiveWorkbook();
4817
+ if (!e)
4818
+ return null;
4819
+ const t = e.getActiveSheet();
4820
+ return t ? { workbook: e, worksheet: t } : null;
4821
+ }
4822
+ _fireBeforeActiveSheetChange(e, t, n) {
4823
+ this.fireEvent(this.Event.BeforeActiveSheetChange, {
4824
+ workbook: e,
4825
+ activeSheet: t,
4826
+ oldActiveSheet: n
4827
+ });
4828
+ }
4829
+ _fireActiveSheetChanged(e, t) {
4830
+ this.fireEvent(this.Event.ActiveSheetChanged, {
4831
+ workbook: e,
4832
+ activeSheet: t
4833
+ });
4834
+ }
4835
+ _fireBeforeSheetDelete(e, t) {
4836
+ this.fireEvent(this.Event.BeforeSheetDelete, {
4837
+ workbook: e,
4838
+ worksheet: t
4839
+ });
4840
+ }
4841
+ _fireSheetDeleted(e, t) {
4842
+ this.fireEvent(this.Event.SheetDeleted, {
4843
+ workbook: e,
4844
+ sheetId: t
4845
+ });
4846
+ }
4847
+ _fireBeforeSheetMove(e, t, n, s) {
4848
+ this.fireEvent(this.Event.BeforeSheetMove, {
4849
+ workbook: e,
4850
+ worksheet: t,
4851
+ newIndex: n,
4852
+ oldIndex: s
4853
+ });
4854
+ }
4855
+ _fireSheetMoved(e, t, n) {
4856
+ this.fireEvent(this.Event.SheetMoved, {
4857
+ workbook: e,
4858
+ worksheet: t,
4859
+ newIndex: n
4860
+ });
4861
+ }
4862
+ _fireBeforeSheetNameChange(e, t, n, s) {
4863
+ this.fireEvent(this.Event.BeforeSheetNameChange, {
4864
+ workbook: e,
4865
+ worksheet: t,
4866
+ newName: n,
4867
+ oldName: s
4868
+ });
4869
+ }
4870
+ _fireSheetNameChanged(e, t, n) {
4871
+ this.fireEvent(this.Event.SheetNameChanged, {
4872
+ workbook: e,
4873
+ worksheet: t,
4874
+ newName: n
4875
+ });
4876
+ }
4877
+ _fireBeforeSheetTabColorChange(e, t, n, s) {
4878
+ this.fireEvent(this.Event.BeforeSheetTabColorChange, {
4879
+ workbook: e,
4880
+ worksheet: t,
4881
+ newColor: n,
4882
+ oldColor: s
4883
+ });
4884
+ }
4885
+ _fireSheetTabColorChanged(e, t, n) {
4886
+ this.fireEvent(this.Event.SheetTabColorChanged, {
4887
+ workbook: e,
4888
+ worksheet: t,
4889
+ newColor: n
4890
+ });
4891
+ }
4892
+ _fireBeforeSheetHideChange(e, t, n) {
4893
+ this.fireEvent(this.Event.BeforeSheetHideChange, {
4894
+ workbook: e,
4895
+ worksheet: t,
4896
+ hidden: n
4897
+ });
4898
+ }
4899
+ _fireSheetHideChanged(e, t, n) {
4900
+ this.fireEvent(this.Event.SheetHideChanged, {
4901
+ workbook: e,
4902
+ worksheet: t,
4903
+ hidden: n
4904
+ });
4905
+ }
4906
+ }
4907
+ Be.extend(kn);
4908
+ class Sn {
4909
+ get SheetValueChangeType() {
4910
+ return Ot;
4911
+ }
4912
+ get SheetSkeletonChangeType() {
4913
+ return Lt;
3952
4914
  }
3953
4915
  }
3954
- Ue.extend(hn);
3955
- class cn extends se {
4916
+ rt.extend(Sn);
4917
+ class wn extends We {
3956
4918
  get SheetCreated() {
3957
4919
  return "SheetCreated";
3958
4920
  }
@@ -3965,27 +4927,76 @@ class cn extends se {
3965
4927
  get WorkbookDisposed() {
3966
4928
  return "WorkbookDisposed";
3967
4929
  }
4930
+ get GridlineChanged() {
4931
+ return "GridlineChanged";
4932
+ }
4933
+ get BeforeGridlineEnableChange() {
4934
+ return "BeforeGridlineEnableChange";
4935
+ }
4936
+ get BeforeGridlineColorChange() {
4937
+ return "BeforeGridlineColorChange";
4938
+ }
4939
+ get BeforeActiveSheetChange() {
4940
+ return "BeforeActiveSheetChange";
4941
+ }
4942
+ get ActiveSheetChanged() {
4943
+ return "ActiveSheetChanged";
4944
+ }
4945
+ get SheetDeleted() {
4946
+ return "SheetDeleted";
4947
+ }
4948
+ get BeforeSheetDelete() {
4949
+ return "BeforeSheetDelete";
4950
+ }
4951
+ get SheetMoved() {
4952
+ return "SheetMoved";
4953
+ }
4954
+ get BeforeSheetMove() {
4955
+ return "BeforeSheetMove";
4956
+ }
4957
+ get SheetNameChanged() {
4958
+ return "SheetNameChanged";
4959
+ }
4960
+ get BeforeSheetNameChange() {
4961
+ return "BeforeSheetNameChange";
4962
+ }
4963
+ get SheetTabColorChanged() {
4964
+ return "SheetTabColorChanged";
4965
+ }
4966
+ get BeforeSheetTabColorChange() {
4967
+ return "BeforeSheetTabColorChange";
4968
+ }
4969
+ get SheetHideChanged() {
4970
+ return "SheetHideChanged";
4971
+ }
4972
+ get BeforeSheetHideChange() {
4973
+ return "BeforeSheetHideChange";
4974
+ }
4975
+ get SheetValueChanged() {
4976
+ return "SheetValueChanged";
4977
+ }
3968
4978
  }
3969
- se.extend(cn);
3970
- var dn = Object.defineProperty, un = Object.getOwnPropertyDescriptor, mn = (s, e, t, n) => {
3971
- for (var r = n > 1 ? void 0 : n ? un(e, t) : e, o = s.length - 1, i; o >= 0; o--)
3972
- (i = s[o]) && (r = (n ? i(e, t, r) : i(r)) || r);
3973
- return n && r && dn(e, t, r), r;
3974
- }, ln = (s, e) => (t, n) => e(t, n, s);
3975
- let fe = class extends te {
3976
- constructor(s) {
3977
- super(), this._injector = s;
4979
+ We.extend(wn);
4980
+ var Cn = Object.defineProperty, fn = Object.getOwnPropertyDescriptor, vn = (r, e, t, n) => {
4981
+ for (var s = n > 1 ? void 0 : n ? fn(e, t) : e, i = r.length - 1, o; i >= 0; i--)
4982
+ (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
4983
+ return n && s && Cn(e, t, s), s;
4984
+ }, In = (r, e) => (t, n) => e(t, n, r);
4985
+ let xe = class extends de {
4986
+ constructor(r) {
4987
+ super(), this._injector = r;
3978
4988
  }
3979
4989
  };
3980
- fe = mn([
3981
- ln(0, u(b))
3982
- ], fe);
4990
+ xe = vn([
4991
+ In(0, u(y))
4992
+ ], xe);
3983
4993
  export {
3984
- O as FPermission,
3985
- w as FRange,
3986
- B as FSelection,
3987
- cn as FSheetEventName,
3988
- fe as FSheetHooks,
3989
- I as FWorkbook,
3990
- g as FWorksheet
4994
+ j as FPermission,
4995
+ S as FRange,
4996
+ L as FSelection,
4997
+ wn as FSheetEventName,
4998
+ xe as FSheetHooks,
4999
+ Sn as FSheetsEnum,
5000
+ f as FWorkbook,
5001
+ m as FWorksheet
3991
5002
  };