@univerjs/sheets 0.6.1 → 0.6.2

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,35 +1,35 @@
1
- var ze = Object.defineProperty;
2
- var Ge = (s, e, t) => e in s ? ze(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
- var I = (s, e, t) => Ge(s, typeof e != "symbol" ? e + "" : e, t);
4
- import { Inject as u, Injector as p, ICommandService as m, IPermissionService as ie, IAuthzIoService as xe, LocaleService as Ne, generateRandomId as Te, Rectangle as D, RANGE_TYPE as _, HorizontalAlign as y, VerticalAlign as U, isFormulaString as $e, isCellV as qe, isICellData as Ke, ObjectMatrix as F, Tools as Ye, TextStyleValue as ce, RichTextValue as E, BooleanNumber as g, WrapStrategy as J, Dimension as ue, ILogService as De, Direction as A, IResourceLoaderService as Je, IUniverInstanceService as Q, mergeWorksheetSnapshotWithDefault as Qe, UndoCommand as Xe, RedoCommand as Ze, toDisposable as Me, UniverInstanceType as b, CanceledError as w } from "@univerjs/core";
5
- import { FBase as ae, FBaseInitialable as he, FUniver as Ae, FEnum as et, FEventName as tt } from "@univerjs/core/facade";
6
- import { WorksheetProtectionRuleModel as We, RangeProtectionRuleModel as Be, WorksheetProtectionPointModel as Fe, SetDefinedNameCommand as X, SCOPE_WORKBOOK_VALUE_DEFINED_NAME as Z, RemoveDefinedNameCommand as nt, PermissionPointsDefinitions as rt, WorkbookEditablePermission as He, UnitObject as P, AddWorksheetProtectionMutation as st, DeleteWorksheetProtectionMutation as ot, getAllWorksheetPermissionPoint as it, getAllWorksheetPermissionPointByPointPanel as ge, SetWorksheetPermissionPointsMutation as at, AddRangeProtectionMutation as ht, DeleteRangeProtectionMutation as dt, SetRangeProtectionMutation as ct, WorksheetEditPermission as ut, WorksheetViewPermission as gt, SetBorderBasicCommand as mt, SetStyleCommand as f, SetRangeValuesCommand as x, SetTextWrapCommand as ee, SetVerticalTextAlignCommand as lt, SetHorizontalTextAlignCommand as _t, addMergeCellsUtil as G, getAddMergeMutationRangeByType as me, RemoveWorksheetMergeCommand as kt, SplitTextToColumnsCommand as wt, SetWorksheetRangeThemeStyleCommand as St, DeleteWorksheetRangeThemeStyleCommand as Ct, SheetRangeThemeService as Oe, getPrimaryForRange as te, SetSelectionsOperation as Ve, getNextPrimaryCell as vt, SheetsSelectionsService as je, SetWorksheetDefaultStyleMutation as ft, SetColDataCommand as le, SetRowDataCommand as _e, copyRangeStyles as W, InsertRowByRangeCommand as ke, RemoveRowByRangeCommand as It, MoveRowsCommand as Rt, SetRowHiddenCommand as we, SetSpecificRowsVisibleCommand as Se, SetWorksheetRowIsAutoHeightMutation as bt, SetRowHeightCommand as Ce, SetWorksheetRowIsAutoHeightCommand as ve, InsertColByRangeCommand as fe, RemoveColByRangeCommand as pt, MoveColsCommand as Et, SetColHiddenCommand as Ie, SetSpecificColsVisibleCommand as Re, SetColWidthCommand as yt, SetFrozenCommand as $, CancelFrozenCommand as Ut, ToggleGridlinesCommand as ne, SetGridlinesColorCommand as re, SetTabColorCommand as Pt, SetRangeValuesMutation as be, SetWorksheetHideCommand as xt, SetWorksheetShowCommand as Nt, SetWorksheetNameCommand as se, ClearSelectionAllCommand as Tt, ClearSelectionContentCommand as Dt, ClearSelectionFormatCommand as Mt, InsertSheetCommand as N, SetWorksheetActiveOperation as T, RemoveSheetCommand as oe, CopySheetCommand as At, SetWorksheetOrderCommand as Wt, RegisterWorksheetRangeThemeStyleCommand as Bt, UnregisterWorksheetRangeThemeStyleCommand as Ft, RangeThemeStyle as Ht, SetWorksheetOrderMutation as pe, SetTabColorMutation as Ee, SetWorksheetHideMutation as ye, COMMAND_LISTENER_VALUE_CHANGE as Ot, getValueChangedEffectedRange as Vt, SheetValueChangeType as jt, SheetSkeletonChangeType as Lt, SplitDelimiterEnum as zt } from "@univerjs/sheets";
7
- import { IDefinedNamesService as Le, serializeRange as de, FormulaDataModel as Gt, serializeRangeWithSheet as $t, deserializeRangeWithSheet as qt } from "@univerjs/engine-formula";
8
- var Kt = Object.getOwnPropertyDescriptor, Yt = (s, e, t, n) => {
9
- for (var r = n > 1 ? void 0 : n ? Kt(e, t) : e, o = s.length - 1, i; o >= 0; o--)
10
- (i = s[o]) && (r = i(r) || r);
11
- return r;
12
- }, S = (s, e) => (t, n) => e(t, n, s);
13
- function Jt(s, e, t) {
14
- const n = t.getDefinedNameMap(s);
1
+ var Ze = Object.defineProperty;
2
+ var et = (r, e, t) => e in r ? Ze(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
+ var E = (r, e, t) => et(r, typeof e != "symbol" ? e + "" : e, t);
4
+ import { Inject as u, Injector as x, ICommandService as l, IPermissionService as ue, IAuthzIoService as Be, LocaleService as Ve, generateRandomId as Fe, Rectangle as N, RANGE_TYPE as w, isFormulaString as tt, isCellV as nt, isICellData as rt, HorizontalAlign as T, VerticalAlign as A, ObjectMatrix as V, Tools as st, TextStyleValue as we, RichTextValue as P, BooleanNumber as g, WrapStrategy as G, DEFAULT_STYLES as ke, Dimension as M, isNullCell as D, ILogService as He, Direction as j, IResourceLoaderService as ot, IUniverInstanceService as re, mergeWorksheetSnapshotWithDefault as it, UndoCommand as at, RedoCommand as ht, toDisposable as Oe, UniverInstanceType as U, CanceledError as v } from "@univerjs/core";
5
+ import { FBase as ge, FBaseInitialable as le, FUniver as je, FEnum as dt, FEventName as ct } from "@univerjs/core/facade";
6
+ import { WorksheetProtectionRuleModel as Le, RangeProtectionRuleModel as ze, WorksheetProtectionPointModel as Ge, SetDefinedNameCommand as se, SCOPE_WORKBOOK_VALUE_DEFINED_NAME as oe, RemoveDefinedNameCommand as ut, PermissionPointsDefinitions as gt, WorkbookEditablePermission as $e, UnitObject as W, AddWorksheetProtectionMutation as lt, DeleteWorksheetProtectionMutation as mt, getAllWorksheetPermissionPoint as _t, getAllWorksheetPermissionPointByPointPanel as Se, SetWorksheetPermissionPointsMutation as wt, AddRangeProtectionMutation as kt, DeleteRangeProtectionMutation as St, SetRangeProtectionMutation as Ct, WorksheetEditPermission as ft, WorksheetViewPermission as vt, SetBorderBasicCommand as It, SetStyleCommand as b, SetTextRotationCommand as Rt, SetRangeValuesCommand as B, SetTextWrapCommand as ie, SetVerticalTextAlignCommand as bt, SetHorizontalTextAlignCommand as pt, addMergeCellsUtil as Q, getAddMergeMutationRangeByType as Ce, RemoveWorksheetMergeCommand as Et, getPrimaryForRange as $, SetSelectionsOperation as me, SplitTextToColumnsCommand as yt, SetWorksheetRangeThemeStyleCommand as Ut, DeleteWorksheetRangeThemeStyleCommand as xt, SheetRangeThemeService as qe, ClearSelectionAllCommand as Ke, ClearSelectionContentCommand as Ye, ClearSelectionFormatCommand as Je, InsertRangeMoveDownCommand as Pt, InsertRangeMoveRightCommand as Mt, DeleteRangeMoveUpCommand as Nt, DeleteRangeMoveLeftCommand as Tt, getNextPrimaryCell as At, SheetsSelectionsService as Qe, SetWorksheetDefaultStyleMutation as Dt, SetColDataCommand as fe, SetRowDataCommand as ve, copyRangeStyles as L, InsertRowByRangeCommand as Ie, RemoveRowByRangeCommand as Wt, MoveRowsCommand as Bt, SetRowHiddenCommand as Re, SetSpecificRowsVisibleCommand as be, SetWorksheetRowIsAutoHeightMutation as Vt, SetRowHeightCommand as pe, SetWorksheetRowIsAutoHeightCommand as X, InsertColByRangeCommand as Ee, RemoveColByRangeCommand as Ft, MoveColsCommand as Ht, SetColHiddenCommand as ye, SetSpecificColsVisibleCommand as Ue, SetColWidthCommand as Ot, SetFrozenCommand as Z, CancelFrozenCommand as jt, ToggleGridlinesCommand as ae, SetGridlinesColorCommand as he, SetTabColorCommand as Lt, SetRangeValuesMutation as xe, SetWorksheetHideCommand as zt, SetWorksheetShowCommand as Gt, SetWorksheetNameCommand as de, AppendRowCommand as $t, InsertSheetCommand as F, SetWorksheetActiveOperation as H, RemoveSheetCommand as ce, CopySheetCommand as qt, SetWorksheetOrderCommand as Kt, RegisterWorksheetRangeThemeStyleCommand as Yt, UnregisterWorksheetRangeThemeStyleCommand as Jt, RangeThemeStyle as Qt, SetWorksheetOrderMutation as Pe, SetTabColorMutation as Me, SetWorksheetHideMutation as Ne, COMMAND_LISTENER_VALUE_CHANGE as Xt, getValueChangedEffectedRange as Zt, SheetValueChangeType as en, SheetSkeletonChangeType as tn, SplitDelimiterEnum as nn } from "@univerjs/sheets";
7
+ import { IDefinedNamesService as Xe, serializeRange as _e, FormulaDataModel as rn, serializeRangeWithSheet as sn, deserializeRangeWithSheet as on } from "@univerjs/engine-formula";
8
+ var an = Object.getOwnPropertyDescriptor, hn = (r, e, t, n) => {
9
+ for (var s = n > 1 ? void 0 : n ? an(e, t) : e, o = r.length - 1, i; o >= 0; o--)
10
+ (i = r[o]) && (s = i(s) || s);
11
+ return s;
12
+ }, I = (r, e) => (t, n) => e(t, n, r);
13
+ function dn(r, e, t) {
14
+ const n = t.getDefinedNameMap(r);
15
15
  if (n == null)
16
16
  return e.t("definedName.defaultName") + 1;
17
17
  const o = Array.from(Object.values(n)).length + 1, i = e.t("definedName.defaultName") + o;
18
- if (t.getValueByName(s, i) == null)
18
+ if (t.getValueByName(r, i) == null)
19
19
  return i;
20
20
  let a = o + 1;
21
21
  for (; ; ) {
22
22
  const h = e.t("definedName.defaultName") + a;
23
- if (t.getValueByName(s, h) == null)
23
+ if (t.getValueByName(r, h) == null)
24
24
  return h;
25
25
  a++;
26
26
  }
27
27
  }
28
- class L {
28
+ class J {
29
29
  constructor() {
30
- I(this, "_definedNameParam");
30
+ E(this, "_definedNameParam");
31
31
  this._definedNameParam = {
32
- id: Te(10),
32
+ id: Fe(10),
33
33
  unitId: "",
34
34
  name: "",
35
35
  formulaOrRefString: ""
@@ -100,12 +100,12 @@ class L {
100
100
  * workbook.insertDefinedNameBuilder(definedNameBuilder);
101
101
  * ```
102
102
  */
103
- setRefByRange(e, t, n, r) {
104
- return this._definedNameParam.formulaOrRefString = de({
103
+ setRefByRange(e, t, n, s) {
104
+ return this._definedNameParam.formulaOrRefString = _e({
105
105
  startRow: e,
106
106
  endRow: e + (n != null ? n : 1) - 1,
107
107
  startColumn: t,
108
- endColumn: t + (r != null ? r : 1) - 1
108
+ endColumn: t + (s != null ? s : 1) - 1
109
109
  }), this;
110
110
  }
111
111
  /**
@@ -180,12 +180,12 @@ class L {
180
180
  return this._definedNameParam = e, this;
181
181
  }
182
182
  }
183
- let H = class extends ae {
184
- constructor(s, e, t, n, r, o, i, a, h, d) {
185
- 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 = d;
183
+ let q = class extends ge {
184
+ constructor(r, e, t, n, s, o, i, a, h, d) {
185
+ super(), this._definedNameParam = r, this._injector = e, this._commandService = t, this._permissionService = n, this._worksheetProtectionRuleModel = s, this._rangeProtectionRuleModel = o, this._worksheetProtectionPointRuleModel = i, this._authzIoService = a, this._localeService = h, this._definedNamesService = d;
186
186
  }
187
187
  _apply() {
188
- this._definedNameParam.name === "" && (this._definedNameParam.name = Jt(this._definedNameParam.unitId, this._localeService, this._definedNamesService)), this._commandService.syncExecuteCommand(X.id, this._definedNameParam);
188
+ this._definedNameParam.name === "" && (this._definedNameParam.name = dn(this._definedNameParam.unitId, this._localeService, this._definedNamesService)), this._commandService.syncExecuteCommand(se.id, this._definedNameParam);
189
189
  }
190
190
  /**
191
191
  * Gets the name of the defined name.
@@ -210,8 +210,8 @@ let H = class extends ae {
210
210
  * definedName?.setName('NewDefinedName');
211
211
  * ```
212
212
  */
213
- setName(s) {
214
- this._definedNameParam.name = s, this._apply();
213
+ setName(r) {
214
+ this._definedNameParam.name = r, this._apply();
215
215
  }
216
216
  /**
217
217
  * Sets the formula of the defined name.
@@ -223,8 +223,8 @@ let H = class extends ae {
223
223
  * definedName?.setFormula('SUM(Sheet1!$A$1)');
224
224
  * ```
225
225
  */
226
- setFormula(s) {
227
- this._definedNameParam.formulaOrRefString = `=${s}`, this._apply();
226
+ setFormula(r) {
227
+ this._definedNameParam.formulaOrRefString = `=${r}`, this._apply();
228
228
  }
229
229
  /**
230
230
  * Sets the reference of the defined name.
@@ -236,8 +236,8 @@ let H = class extends ae {
236
236
  * definedName?.setRef('Sheet1!$A$1');
237
237
  * ```
238
238
  */
239
- setRef(s) {
240
- this._definedNameParam.formulaOrRefString = s, this._apply();
239
+ setRef(r) {
240
+ this._definedNameParam.formulaOrRefString = r, this._apply();
241
241
  }
242
242
  /**
243
243
  * Gets the formula or reference string of the defined name.
@@ -265,10 +265,10 @@ let H = class extends ae {
265
265
  * definedName?.setRefByRange(1, 3, 2, 5);
266
266
  * ```
267
267
  */
268
- setRefByRange(s, e, t, n) {
269
- this._definedNameParam.formulaOrRefString = de({
270
- startRow: s,
271
- endRow: s + (t != null ? t : 1) - 1,
268
+ setRefByRange(r, e, t, n) {
269
+ this._definedNameParam.formulaOrRefString = _e({
270
+ startRow: r,
271
+ endRow: r + (t != null ? t : 1) - 1,
272
272
  startColumn: e,
273
273
  endColumn: e + (n != null ? n : 1) - 1
274
274
  }), this._apply();
@@ -296,8 +296,8 @@ let H = class extends ae {
296
296
  * definedName?.setComment('This is a comment');
297
297
  * ```
298
298
  */
299
- setComment(s) {
300
- this._definedNameParam.comment = s, this._apply();
299
+ setComment(r) {
300
+ this._definedNameParam.comment = r, this._apply();
301
301
  }
302
302
  /**
303
303
  * Sets the scope of the defined name to the worksheet.
@@ -310,8 +310,8 @@ let H = class extends ae {
310
310
  * definedName?.setScopeToWorksheet(worksheet);
311
311
  * ```
312
312
  */
313
- setScopeToWorksheet(s) {
314
- this._definedNameParam.localSheetId = s.getSheetId(), this._apply();
313
+ setScopeToWorksheet(r) {
314
+ this._definedNameParam.localSheetId = r.getSheetId(), this._apply();
315
315
  }
316
316
  /**
317
317
  * Sets the scope of the defined name to the workbook.
@@ -323,7 +323,7 @@ let H = class extends ae {
323
323
  * ```
324
324
  */
325
325
  setScopeToWorkbook() {
326
- this._definedNameParam.localSheetId = Z, this._apply();
326
+ this._definedNameParam.localSheetId = oe, this._apply();
327
327
  }
328
328
  /**
329
329
  * Sets the hidden status of the defined name.
@@ -335,8 +335,8 @@ let H = class extends ae {
335
335
  * definedName?.setHidden(true);
336
336
  * ```
337
337
  */
338
- setHidden(s) {
339
- this._definedNameParam.hidden = s, this._apply();
338
+ setHidden(r) {
339
+ this._definedNameParam.hidden = r, this._apply();
340
340
  }
341
341
  /**
342
342
  * Deletes the defined name.
@@ -348,7 +348,7 @@ let H = class extends ae {
348
348
  * ```
349
349
  */
350
350
  delete() {
351
- this._commandService.syncExecuteCommand(nt.id, this._definedNameParam);
351
+ this._commandService.syncExecuteCommand(ut.id, this._definedNameParam);
352
352
  }
353
353
  /**
354
354
  * Gets the local sheet id of the defined name.
@@ -374,7 +374,7 @@ let H = class extends ae {
374
374
  * ```
375
375
  */
376
376
  isWorkbookScope() {
377
- return this._definedNameParam.localSheetId === Z;
377
+ return this._definedNameParam.localSheetId === oe;
378
378
  }
379
379
  /**
380
380
  * Converts the defined name to a defined name builder.
@@ -393,42 +393,42 @@ let H = class extends ae {
393
393
  * ```
394
394
  */
395
395
  toBuilder() {
396
- const s = this._injector.createInstance(L);
397
- return s.load(this._definedNameParam), s;
396
+ const r = this._injector.createInstance(J);
397
+ return r.load(this._definedNameParam), r;
398
398
  }
399
399
  };
400
- H = Yt([
401
- S(1, u(p)),
402
- S(2, m),
403
- S(3, ie),
404
- S(4, u(We)),
405
- S(5, u(Be)),
406
- S(6, u(Fe)),
407
- S(7, u(xe)),
408
- S(8, u(Ne)),
409
- S(9, Le)
410
- ], H);
411
- var Qt = Object.getOwnPropertyDescriptor, Xt = (s, e, t, n) => {
412
- for (var r = n > 1 ? void 0 : n ? Qt(e, t) : e, o = s.length - 1, i; o >= 0; o--)
413
- (i = s[o]) && (r = i(r) || r);
414
- return r;
415
- }, R = (s, e) => (t, n) => e(t, n, s);
416
- let O = class extends ae {
417
- constructor(e, t, n, r, o, i, a) {
400
+ q = hn([
401
+ I(1, u(x)),
402
+ I(2, l),
403
+ I(3, ue),
404
+ I(4, u(Le)),
405
+ I(5, u(ze)),
406
+ I(6, u(Ge)),
407
+ I(7, u(Be)),
408
+ I(8, u(Ve)),
409
+ I(9, Xe)
410
+ ], q);
411
+ var cn = Object.getOwnPropertyDescriptor, un = (r, e, t, n) => {
412
+ for (var s = n > 1 ? void 0 : n ? cn(e, t) : e, o = r.length - 1, i; o >= 0; o--)
413
+ (i = r[o]) && (s = i(s) || s);
414
+ return s;
415
+ }, y = (r, e) => (t, n) => e(t, n, r);
416
+ let K = class extends ge {
417
+ constructor(e, t, n, s, o, i, a) {
418
418
  super();
419
419
  /**
420
420
  * Permission point definition, can read the point constructor want to modify from here
421
421
  */
422
- I(this, "permissionPointsDefinition", rt);
422
+ E(this, "permissionPointsDefinition", gt);
423
423
  /**
424
424
  * An observable object used to monitor permission change events within a range, thereby triggering corresponding subsequent processing.
425
425
  */
426
- I(this, "rangeRuleChangedAfterAuth$");
426
+ E(this, "rangeRuleChangedAfterAuth$");
427
427
  /**
428
428
  * An observable object used to monitor permission change events within a worksheet, thereby triggering corresponding subsequent processing.
429
429
  */
430
- I(this, "sheetRuleChangedAfterAuth$");
431
- 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$;
430
+ E(this, "sheetRuleChangedAfterAuth$");
431
+ this._injector = e, this._commandService = t, this._permissionService = n, this._worksheetProtectionRuleModel = s, this._rangeProtectionRuleModel = o, this._worksheetProtectionPointRuleModel = i, this._authzIoService = a, this.rangeRuleChangedAfterAuth$ = this._rangeProtectionRuleModel.ruleRefresh$, this.sheetRuleChangedAfterAuth$ = this._worksheetProtectionRuleModel.ruleRefresh$;
432
432
  }
433
433
  /**
434
434
  * Configures a specific permission point for a workbook.
@@ -447,8 +447,8 @@ let O = class extends ae {
447
447
  * ```
448
448
  */
449
449
  setWorkbookPermissionPoint(e, t, n) {
450
- const r = new t(e);
451
- this._permissionService.getPermissionPoint(r.id) || this._permissionService.addPermissionPoint(r), this._permissionService.updatePermissionPoint(r.id, n);
450
+ const s = new t(e);
451
+ this._permissionService.getPermissionPoint(s.id) || this._permissionService.addPermissionPoint(s), this._permissionService.updatePermissionPoint(s.id, n);
452
452
  }
453
453
  /**
454
454
  * This function is used to set whether the workbook can be edited
@@ -464,7 +464,7 @@ let O = class extends ae {
464
464
  * ```
465
465
  */
466
466
  setWorkbookEditPermission(e, t) {
467
- this.setWorkbookPermissionPoint(e, He, t);
467
+ this.setWorkbookPermissionPoint(e, $e, t);
468
468
  }
469
469
  /**
470
470
  * This function is used to add a base permission for a worksheet.
@@ -491,8 +491,8 @@ let O = class extends ae {
491
491
  async addWorksheetBasePermission(e, t) {
492
492
  if (this._rangeProtectionRuleModel.getSubunitRuleList(e, t).length > 0)
493
493
  throw new Error("sheet protection cannot intersect with range protection");
494
- const r = await this._authzIoService.create({
495
- objectType: P.Worksheet,
494
+ const s = await this._authzIoService.create({
495
+ objectType: W.Worksheet,
496
496
  worksheetObject: {
497
497
  collaborators: [],
498
498
  unitID: e,
@@ -501,17 +501,17 @@ let O = class extends ae {
501
501
  scope: void 0
502
502
  }
503
503
  });
504
- if (this._commandService.syncExecuteCommand(st.id, {
504
+ if (this._commandService.syncExecuteCommand(lt.id, {
505
505
  unitId: e,
506
506
  subUnitId: t,
507
507
  rule: {
508
- permissionId: r,
509
- unitType: P.Worksheet,
508
+ permissionId: s,
509
+ unitType: W.Worksheet,
510
510
  unitId: e,
511
511
  subUnitId: t
512
512
  }
513
513
  }))
514
- return r;
514
+ return s;
515
515
  }
516
516
  /**
517
517
  * Delete the entire table protection set for the worksheet and reset the point permissions of the worksheet to true
@@ -529,12 +529,12 @@ let O = class extends ae {
529
529
  * ```
530
530
  */
531
531
  removeWorksheetPermission(e, t) {
532
- this._commandService.syncExecuteCommand(ot.id, {
532
+ this._commandService.syncExecuteCommand(mt.id, {
533
533
  unitId: e,
534
534
  subUnitId: t
535
- }), [...it(), ...ge()].forEach((n) => {
536
- const r = new n(e, t);
537
- this._permissionService.updatePermissionPoint(r.id, !0);
535
+ }), [..._t(), ...Se()].forEach((n) => {
536
+ const s = new n(e, t);
537
+ this._permissionService.updatePermissionPoint(s.id, !0);
538
538
  }), this._worksheetProtectionPointRuleModel.deleteRule(e, t);
539
539
  }
540
540
  /**
@@ -559,10 +559,10 @@ let O = class extends ae {
559
559
  * permission.setWorksheetPermissionPoint(unitId, subUnitId, permission.permissionPointsDefinition.WorksheetEditPermission, false);
560
560
  * ```
561
561
  */
562
- async setWorksheetPermissionPoint(e, t, n, r) {
562
+ async setWorksheetPermissionPoint(e, t, n, s) {
563
563
  const o = this._worksheetProtectionRuleModel.getRule(e, t);
564
564
  let i;
565
- if (n === ut || n === gt)
565
+ if (n === ft || n === vt)
566
566
  if (o)
567
567
  i = o.permissionId;
568
568
  else {
@@ -573,7 +573,7 @@ let O = class extends ae {
573
573
  else {
574
574
  const c = this._worksheetProtectionPointRuleModel.getRule(e, t);
575
575
  c ? i = c.permissionId : (i = await this._authzIoService.create({
576
- objectType: P.Worksheet,
576
+ objectType: W.Worksheet,
577
577
  worksheetObject: {
578
578
  collaborators: [],
579
579
  unitID: e,
@@ -581,10 +581,10 @@ let O = class extends ae {
581
581
  name: "",
582
582
  scope: void 0
583
583
  }
584
- }), this._commandService.syncExecuteCommand(at.id, { unitId: e, subUnitId: t, rule: { unitId: e, subUnitId: t, permissionId: i } }));
584
+ }), this._commandService.syncExecuteCommand(wt.id, { unitId: e, subUnitId: t, rule: { unitId: e, subUnitId: t, permissionId: i } }));
585
585
  }
586
586
  const h = new n(e, t);
587
- return this._permissionService.getPermissionPoint(h.id) || this._permissionService.addPermissionPoint(h), this._permissionService.updatePermissionPoint(h.id, r), i;
587
+ return this._permissionService.getPermissionPoint(h.id) || this._permissionService.addPermissionPoint(h), this._permissionService.updatePermissionPoint(h.id, s), i;
588
588
  }
589
589
  /**
590
590
  * Adds a range protection to the worksheet.
@@ -613,25 +613,25 @@ let O = class extends ae {
613
613
  * ```
614
614
  */
615
615
  async addRangeBaseProtection(e, t, n) {
616
- const r = await this._authzIoService.create({
617
- objectType: P.SelectRange,
616
+ const s = await this._authzIoService.create({
617
+ objectType: W.SelectRange,
618
618
  selectRangeObject: {
619
619
  collaborators: [],
620
620
  unitID: e,
621
621
  name: "",
622
622
  scope: void 0
623
623
  }
624
- }), o = `ruleId_${Te(6)}`;
624
+ }), o = `ruleId_${Fe(6)}`;
625
625
  if (this._worksheetProtectionRuleModel.getRule(e, t))
626
626
  throw new Error("sheet protection cannot intersect with range protection");
627
- if (this._rangeProtectionRuleModel.getSubunitRuleList(e, t).some((c) => c.ranges.some((z) => n.some((M) => D.intersects(M.getRange(), z)))))
627
+ if (this._rangeProtectionRuleModel.getSubunitRuleList(e, t).some((c) => c.ranges.some((C) => n.some((_) => N.intersects(_.getRange(), C)))))
628
628
  throw new Error("range protection cannot intersect");
629
- if (this._commandService.syncExecuteCommand(ht.id, {
629
+ if (this._commandService.syncExecuteCommand(kt.id, {
630
630
  unitId: e,
631
631
  subUnitId: t,
632
632
  rules: [{
633
- permissionId: r,
634
- unitType: P.SelectRange,
633
+ permissionId: s,
634
+ unitType: W.SelectRange,
635
635
  unitId: e,
636
636
  subUnitId: t,
637
637
  ranges: n.map((c) => c.getRange()),
@@ -639,7 +639,7 @@ let O = class extends ae {
639
639
  }]
640
640
  }))
641
641
  return {
642
- permissionId: r,
642
+ permissionId: s,
643
643
  ruleId: o
644
644
  };
645
645
  }
@@ -665,11 +665,11 @@ let O = class extends ae {
665
665
  * ```
666
666
  */
667
667
  removeRangeProtection(e, t, n) {
668
- this._commandService.syncExecuteCommand(dt.id, {
668
+ this._commandService.syncExecuteCommand(St.id, {
669
669
  unitId: e,
670
670
  subUnitId: t,
671
671
  ruleIds: n
672
- }) && this._rangeProtectionRuleModel.getSubunitRuleList(e, t).length === 0 && (this._worksheetProtectionPointRuleModel.deleteRule(e, t), [...ge()].forEach((i) => {
672
+ }) && this._rangeProtectionRuleModel.getSubunitRuleList(e, t).length === 0 && (this._worksheetProtectionPointRuleModel.deleteRule(e, t), [...Se()].forEach((i) => {
673
673
  const a = new i(e, t);
674
674
  this._permissionService.updatePermissionPoint(a.id, a.value);
675
675
  }));
@@ -701,8 +701,8 @@ let O = class extends ae {
701
701
  * permission.setRangeProtectionPermissionPoint(unitId,subUnitId,permissionId, permission.permissionPointsDefinition.RangeProtectionPermissionEditPoint, false);
702
702
  * ```
703
703
  */
704
- setRangeProtectionPermissionPoint(e, t, n, r, o) {
705
- const i = new r(e, t, n);
704
+ setRangeProtectionPermissionPoint(e, t, n, s, o) {
705
+ const i = new s(e, t, n);
706
706
  this._permissionService.getPermissionPoint(i.id) || this._permissionService.addPermissionPoint(i), this._permissionService.updatePermissionPoint(i.id, o);
707
707
  }
708
708
  /**
@@ -732,129 +732,129 @@ let O = class extends ae {
732
732
  * permission.setRangeProtectionRanges(unitId, subUnitId, ruleId, [newRange]);
733
733
  * ```
734
734
  */
735
- setRangeProtectionRanges(e, t, n, r) {
735
+ setRangeProtectionRanges(e, t, n, s) {
736
736
  const o = this._rangeProtectionRuleModel.getRule(e, t, n);
737
737
  if (o) {
738
- if (this._rangeProtectionRuleModel.getSubunitRuleList(e, t).filter((h) => h.id !== n).some((h) => h.ranges.some((d) => r.some((c) => D.intersects(c.getRange(), d)))))
738
+ if (this._rangeProtectionRuleModel.getSubunitRuleList(e, t).filter((h) => h.id !== n).some((h) => h.ranges.some((d) => s.some((c) => N.intersects(c.getRange(), d)))))
739
739
  throw new Error("range protection cannot intersect");
740
- this._commandService.syncExecuteCommand(ct.id, {
740
+ this._commandService.syncExecuteCommand(Ct.id, {
741
741
  unitId: e,
742
742
  subUnitId: t,
743
743
  ruleId: n,
744
744
  rule: {
745
745
  ...o,
746
- ranges: r.map((h) => h.getRange())
746
+ ranges: s.map((h) => h.getRange())
747
747
  }
748
748
  });
749
749
  }
750
750
  }
751
751
  };
752
- O = Xt([
753
- R(0, u(p)),
754
- R(1, m),
755
- R(2, ie),
756
- R(3, u(We)),
757
- R(4, u(Be)),
758
- R(5, u(Fe)),
759
- R(6, u(xe))
760
- ], O);
761
- function Zt(s) {
762
- switch (s) {
752
+ K = un([
753
+ y(0, u(x)),
754
+ y(1, l),
755
+ y(2, ue),
756
+ y(3, u(Le)),
757
+ y(4, u(ze)),
758
+ y(5, u(Ge)),
759
+ y(6, u(Be))
760
+ ], K);
761
+ function gn(r) {
762
+ switch (r) {
763
763
  case "left":
764
- return y.LEFT;
764
+ return T.LEFT;
765
765
  case "center":
766
- return y.CENTER;
766
+ return T.CENTER;
767
767
  case "normal":
768
- return y.RIGHT;
768
+ return T.RIGHT;
769
769
  default:
770
- throw new Error(`Invalid horizontal alignment: ${s}`);
770
+ throw new Error(`Invalid horizontal alignment: ${r}`);
771
771
  }
772
772
  }
773
- function en(s) {
774
- switch (s) {
775
- case y.LEFT:
773
+ function Te(r) {
774
+ switch (r) {
775
+ case T.LEFT:
776
776
  return "left";
777
- case y.CENTER:
777
+ case T.CENTER:
778
778
  return "center";
779
- case y.RIGHT:
779
+ case T.RIGHT:
780
780
  return "normal";
781
781
  default:
782
- throw new Error(`Invalid horizontal alignment: ${s}`);
782
+ return "general";
783
783
  }
784
784
  }
785
- function tn(s) {
786
- switch (s) {
785
+ function ln(r) {
786
+ switch (r) {
787
787
  case "top":
788
- return U.TOP;
788
+ return A.TOP;
789
789
  case "middle":
790
- return U.MIDDLE;
790
+ return A.MIDDLE;
791
791
  case "bottom":
792
- return U.BOTTOM;
792
+ return A.BOTTOM;
793
793
  default:
794
- throw new Error(`Invalid vertical alignment: ${s}`);
794
+ throw new Error(`Invalid vertical alignment: ${r}`);
795
795
  }
796
796
  }
797
- function nn(s) {
798
- switch (s) {
799
- case U.TOP:
797
+ function Ae(r) {
798
+ switch (r) {
799
+ case A.TOP:
800
800
  return "top";
801
- case U.MIDDLE:
801
+ case A.MIDDLE:
802
802
  return "middle";
803
- case U.BOTTOM:
803
+ case A.BOTTOM:
804
804
  return "bottom";
805
805
  default:
806
- throw new Error(`Invalid vertical alignment: ${s}`);
806
+ return "general";
807
807
  }
808
808
  }
809
- function V(s) {
810
- return $e(s) ? {
811
- f: s,
809
+ function O(r) {
810
+ return tt(r) ? {
811
+ f: r,
812
812
  v: null,
813
813
  p: null
814
- } : qe(s) ? {
815
- v: s,
814
+ } : nt(r) ? {
815
+ v: r,
816
816
  p: null,
817
817
  f: null
818
- } : (Ke(s), s);
818
+ } : (rt(r), r);
819
819
  }
820
- function Ue(s, e) {
821
- const t = new F(), { startRow: n, startColumn: r, endRow: o, endColumn: i } = e;
822
- if (Ye.isArray(s))
820
+ function De(r, e) {
821
+ const t = new V(), { startRow: n, startColumn: s, endRow: o, endColumn: i } = e;
822
+ if (st.isArray(r))
823
823
  for (let a = 0; a <= o - n; a++)
824
- for (let h = 0; h <= i - r; h++)
825
- t.setValue(a + n, h + r, V(s[a][h]));
824
+ for (let h = 0; h <= i - s; h++)
825
+ t.setValue(a + n, h + s, O(r[a][h]));
826
826
  else
827
- new F(s).forValue((h, d, c) => {
828
- t.setValue(h, d, V(c));
827
+ new V(r).forValue((h, d, c) => {
828
+ t.setValue(h, d, O(c));
829
829
  });
830
830
  return t.getMatrix();
831
831
  }
832
- function q(s, e) {
832
+ function ee(r, e) {
833
833
  return {
834
- startRow: s.startRow,
835
- endRow: s.endRow,
834
+ startRow: r.startRow,
835
+ endRow: r.endRow,
836
836
  startColumn: 0,
837
837
  endColumn: e.getColumnCount() - 1,
838
- rangeType: _.ROW
838
+ rangeType: w.ROW
839
839
  };
840
840
  }
841
- function K(s, e) {
841
+ function te(r, e) {
842
842
  return {
843
843
  startRow: 0,
844
844
  endRow: e.getRowCount() - 1,
845
- startColumn: s.startColumn,
846
- endColumn: s.endColumn,
847
- rangeType: _.COLUMN
845
+ startColumn: r.startColumn,
846
+ endColumn: r.endColumn,
847
+ rangeType: w.COLUMN
848
848
  };
849
849
  }
850
- var rn = Object.getOwnPropertyDescriptor, sn = (s, e, t, n) => {
851
- for (var r = n > 1 ? void 0 : n ? rn(e, t) : e, o = s.length - 1, i; o >= 0; o--)
852
- (i = s[o]) && (r = i(r) || r);
853
- return r;
854
- }, Y = (s, e) => (t, n) => e(t, n, s);
855
- let k = class extends he {
856
- constructor(s, e, t, n, r, o) {
857
- super(n), this._workbook = s, this._worksheet = e, this._range = t, this._injector = n, this._commandService = r, this._formulaDataModel = o;
850
+ var mn = Object.getOwnPropertyDescriptor, _n = (r, e, t, n) => {
851
+ for (var s = n > 1 ? void 0 : n ? mn(e, t) : e, o = r.length - 1, i; o >= 0; o--)
852
+ (i = r[o]) && (s = i(s) || s);
853
+ return s;
854
+ }, ne = (r, e) => (t, n) => e(t, n, r);
855
+ let m = class extends le {
856
+ constructor(r, e, t, n, s, o) {
857
+ super(n), this._workbook = r, this._worksheet = e, this._range = t, this._injector = n, this._commandService = s, this._formulaDataModel = o;
858
858
  }
859
859
  /**
860
860
  * Get the unit ID of the current workbook
@@ -915,33 +915,61 @@ let k = class extends he {
915
915
  return this._range;
916
916
  }
917
917
  /**
918
- * Gets the starting row number of the applied area
919
- * @returns {number} The starting row number of the area
918
+ * Gets the starting row index of the range. index starts at 0.
919
+ * @returns {number} The starting row index of the range.
920
920
  * @example
921
921
  * ```ts
922
922
  * const fWorkbook = univerAPI.getActiveWorkbook();
923
923
  * const fWorksheet = fWorkbook.getActiveSheet();
924
924
  * const fRange = fWorksheet.getRange('A1:B2');
925
- * console.log(fRange.getRow());
925
+ * console.log(fRange.getRow()); // 0
926
926
  * ```
927
927
  */
928
928
  getRow() {
929
929
  return this._range.startRow;
930
930
  }
931
931
  /**
932
- * Gets the starting column number of the applied area
933
- * @returns {number} The starting column number of the area
932
+ * Gets the ending row index of the range. index starts at 0.
933
+ * @returns {number} The ending row index of the range.
934
934
  * @example
935
935
  * ```ts
936
936
  * const fWorkbook = univerAPI.getActiveWorkbook();
937
937
  * const fWorksheet = fWorkbook.getActiveSheet();
938
938
  * const fRange = fWorksheet.getRange('A1:B2');
939
- * console.log(fRange.getColumn());
939
+ * console.log(fRange.getLastRow()); // 1
940
+ * ```
941
+ */
942
+ getLastRow() {
943
+ return this._range.endRow;
944
+ }
945
+ /**
946
+ * Gets the starting column index of the range. index starts at 0.
947
+ * @returns {number} The starting column index of the range.
948
+ * @example
949
+ * ```ts
950
+ * const fWorkbook = univerAPI.getActiveWorkbook();
951
+ * const fWorksheet = fWorkbook.getActiveSheet();
952
+ * const fRange = fWorksheet.getRange('A1:B2');
953
+ * console.log(fRange.getColumn()); // 0
940
954
  * ```
941
955
  */
942
956
  getColumn() {
943
957
  return this._range.startColumn;
944
958
  }
959
+ /**
960
+ * Gets the ending column index of the range. index starts at 0.
961
+ * @returns {number} The ending column index of the range.
962
+ * @example
963
+ * ```ts
964
+ * const fWorkbook = univerAPI.getActiveWorkbook();
965
+ * const fWorksheet = fWorkbook.getActiveSheet();
966
+ * const fRange = fWorksheet.getRange('A1:B2');
967
+ * console.log(fRange.getLastColumn()); // 1
968
+ * ```
969
+ */
970
+ getLastColumn() {
971
+ return this._range.endColumn;
972
+ }
945
973
  /**
946
974
  * Gets the width of the applied area
947
975
  * @returns {number} The width of the area
@@ -985,8 +1013,8 @@ let k = class extends he {
985
1013
  * ```
986
1014
  */
987
1015
  isMerged() {
988
- const { startColumn: s, startRow: e, endColumn: t, endRow: n } = this._range;
989
- return this._worksheet.getMergedCellRange(e, s, n, t).some((o) => D.equals(o, this._range));
1016
+ const { startColumn: r, startRow: e, endColumn: t, endRow: n } = this._range;
1017
+ return this._worksheet.getMergedCellRange(e, r, n, t).some((o) => N.equals(o, this._range));
990
1018
  }
991
1019
  /**
992
1020
  * Return first cell style data in this range
@@ -1001,8 +1029,8 @@ let k = class extends he {
1001
1029
  */
1002
1030
  getCellStyleData() {
1003
1031
  var t;
1004
- const s = this.getCellData(), e = this._workbook.getStyles();
1005
- return s && e && (t = e.getStyleByCell(s)) != null ? t : null;
1032
+ const r = this.getCellData(), e = this._workbook.getStyles();
1033
+ return r && e && (t = e.getStyleByCell(r)) != null ? t : null;
1006
1034
  }
1007
1035
  /**
1008
1036
  * Return first cell style in this range
@@ -1016,8 +1044,8 @@ let k = class extends he {
1016
1044
  * ```
1017
1045
  */
1018
1046
  getCellStyle() {
1019
- const s = this.getCellStyleData();
1020
- return s ? ce.create(s) : null;
1047
+ const r = this.getCellStyleData();
1048
+ return r ? we.create(r) : null;
1021
1049
  }
1022
1050
  /**
1023
1051
  * Returns the cell styles for the cells in the range.
@@ -1031,30 +1059,188 @@ let k = class extends he {
1031
1059
  * ```
1032
1060
  */
1033
1061
  getCellStyles() {
1034
- const s = this.getCellDatas(), e = this._workbook.getStyles();
1035
- return s.map((t) => t.map((n) => {
1062
+ const r = this.getCellDatas(), e = this._workbook.getStyles();
1063
+ return r.map((t) => t.map((n) => {
1036
1064
  if (!n) return null;
1037
- const r = e.getStyleByCell(n);
1038
- return r ? ce.create(r) : null;
1065
+ const s = e.getStyleByCell(n);
1066
+ return s ? we.create(s) : null;
1039
1067
  }));
1040
1068
  }
1041
- getValue(s) {
1069
+ getValue(r) {
1042
1070
  var e, t;
1043
- return s ? this.getValueAndRichTextValue() : (t = (e = this._worksheet.getCell(this._range.startRow, this._range.startColumn)) == null ? void 0 : e.v) != null ? t : null;
1071
+ return r ? this.getValueAndRichTextValue() : (t = (e = this._worksheet.getCell(this._range.startRow, this._range.startColumn)) == null ? void 0 : e.v) != null ? t : null;
1072
+ }
1073
+ /**
1074
+ * Returns the raw value of the top-left cell in the range. Empty cells return `null`.
1075
+ * @returns {Nullable<CellValue>} The raw value of the cell. Returns `null` if the cell is empty.
1076
+ * @example
1077
+ * ```ts
1078
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1079
+ * const fWorksheet = fWorkbook.getActiveSheet();
1080
+ * const fRange = fWorksheet.getRange('A1:B2');
1081
+ * fRange.setValueForCell({
1082
+ * v: 0.2,
1083
+ * s: {
1084
+ * n: {
1085
+ * pattern: '0%',
1086
+ * },
1087
+ * },
1088
+ * });
1089
+ * console.log(fRange.getRawValue()); // 0.2
1090
+ * ```
1091
+ */
1092
+ getRawValue() {
1093
+ var e;
1094
+ const r = this._worksheet.getCellMatrix().getValue(this._range.startRow, this._range.startColumn);
1095
+ return r != null && r.p && ((e = r.p.body) != null && e.dataStream) ? r.p.body.dataStream : r != null && r.v ? r.v : null;
1096
+ }
1097
+ /**
1098
+ * Returns the displayed value of the top-left cell in the range. The value is a String. Empty cells return an empty string.
1099
+ * @returns {string} The displayed value of the cell. Returns an empty string if the cell is empty.
1100
+ * @example
1101
+ * ```ts
1102
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1103
+ * const fWorksheet = fWorkbook.getActiveSheet();
1104
+ * const fRange = fWorksheet.getRange('A1:B2');
1105
+ * fRange.setValueForCell({
1106
+ * v: 0.2,
1107
+ * s: {
1108
+ * n: {
1109
+ * pattern: '0%',
1110
+ * },
1111
+ * },
1112
+ * });
1113
+ * console.log(fRange.getDisplayValue()); // 20%
1114
+ * ```
1115
+ */
1116
+ getDisplayValue() {
1117
+ var e;
1118
+ const r = this._worksheet.getCell(this._range.startRow, this._range.startColumn);
1119
+ return r != null && r.p && ((e = r.p.body) != null && e.dataStream) ? r.p.body.dataStream : r != null && r.v ? String(r.v) : "";
1044
1120
  }
1045
- getValues(s) {
1121
+ getValues(r) {
1046
1122
  var i, a;
1047
- if (s)
1123
+ if (r)
1048
1124
  return this.getValueAndRichTextValues();
1049
- const { startRow: e, endRow: t, startColumn: n, endColumn: r } = this._range, o = [];
1125
+ const { startRow: e, endRow: t, startColumn: n, endColumn: s } = this._range, o = [];
1050
1126
  for (let h = e; h <= t; h++) {
1051
1127
  const d = [];
1052
- for (let c = n; c <= r; c++)
1128
+ for (let c = n; c <= s; c++)
1053
1129
  d.push((a = (i = this._worksheet.getCell(h, c)) == null ? void 0 : i.v) != null ? a : null);
1054
1130
  o.push(d);
1055
1131
  }
1056
1132
  return o;
1057
1133
  }
1134
+ /**
1135
+ * Returns a two-dimensional array of the range raw values. Empty cells return `null`.
1136
+ * @returns {Array<Array<Nullable<CellValue>>>} The raw value of the cell. Returns `null` if the cell is empty.
1137
+ * @example
1138
+ * ```ts
1139
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1140
+ * const fWorksheet = fWorkbook.getActiveSheet();
1141
+ * const fRange = fWorksheet.getRange('A1:B2');
1142
+ * fRange.setValues([
1143
+ * [
1144
+ * {
1145
+ * v: 0.2,
1146
+ * s: {
1147
+ * n: {
1148
+ * pattern: '0%',
1149
+ * },
1150
+ * },
1151
+ * },
1152
+ * {
1153
+ * v: 45658,
1154
+ * s: {
1155
+ * n: {
1156
+ * pattern: 'yyyy-mm-dd',
1157
+ * },
1158
+ * },
1159
+ * }
1160
+ * ],
1161
+ * [
1162
+ * {
1163
+ * v: 1234.567,
1164
+ * s: {
1165
+ * n: {
1166
+ * pattern: '#,##0.00',
1167
+ * }
1168
+ * }
1169
+ * },
1170
+ * null,
1171
+ * ],
1172
+ * ]);
1173
+ * console.log(fRange.getRawValues()); // [[0.2, 45658], [1234.567, null]]
1174
+ * ```
1175
+ */
1176
+ getRawValues() {
1177
+ var i;
1178
+ const r = this._worksheet.getCellMatrix(), { startRow: e, endRow: t, startColumn: n, endColumn: s } = this._range, o = [];
1179
+ for (let a = e; a <= t; a++) {
1180
+ const h = [];
1181
+ for (let d = n; d <= s; d++) {
1182
+ const c = r.getValue(a, d);
1183
+ c != null && c.p && ((i = c.p.body) != null && i.dataStream) ? h.push(c.p.body.dataStream) : c != null && c.v ? h.push(c.v) : h.push(null);
1184
+ }
1185
+ o.push(h);
1186
+ }
1187
+ return o;
1188
+ }
1189
+ /**
1190
+ * Returns a two-dimensional array of the range displayed values. Empty cells return an empty string.
1191
+ * @returns {string[][]} A two-dimensional array of values.
1192
+ * @example
1193
+ * ```ts
1194
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1195
+ * const fWorksheet = fWorkbook.getActiveSheet();
1196
+ * const fRange = fWorksheet.getRange('A1:B2');
1197
+ * fRange.setValues([
1198
+ * [
1199
+ * {
1200
+ * v: 0.2,
1201
+ * s: {
1202
+ * n: {
1203
+ * pattern: '0%',
1204
+ * },
1205
+ * },
1206
+ * },
1207
+ * {
1208
+ * v: 45658,
1209
+ * s: {
1210
+ * n: {
1211
+ * pattern: 'yyyy-mm-dd',
1212
+ * },
1213
+ * },
1214
+ * }
1215
+ * ],
1216
+ * [
1217
+ * {
1218
+ * v: 1234.567,
1219
+ * s: {
1220
+ * n: {
1221
+ * pattern: '#,##0.00',
1222
+ * }
1223
+ * }
1224
+ * },
1225
+ * null,
1226
+ * ],
1227
+ * ]);
1228
+ * console.log(fRange.getDisplayValues()); // [['20%', '2025-01-01'], ['1,234.57', '']]
1229
+ * ```
1230
+ */
1231
+ getDisplayValues() {
1232
+ var o;
1233
+ const { startRow: r, endRow: e, startColumn: t, endColumn: n } = this._range, s = [];
1234
+ for (let i = r; i <= e; i++) {
1235
+ const a = [];
1236
+ for (let h = t; h <= n; h++) {
1237
+ const d = this._worksheet.getCell(i, h);
1238
+ d != null && d.p && ((o = d.p.body) != null && o.dataStream) ? a.push(d.p.body.dataStream) : d != null && d.v ? a.push(String(d.v)) : a.push("");
1239
+ }
1240
+ s.push(a);
1241
+ }
1242
+ return s;
1243
+ }
1058
1244
  /**
1059
1245
  * Return first cell model data in this range
1060
1246
  * @returns {ICellData | null} The cell model data
@@ -1067,8 +1253,8 @@ let k = class extends he {
1067
1253
  * ```
1068
1254
  */
1069
1255
  getCellData() {
1070
- var s;
1071
- return (s = this._worksheet.getCell(this._range.startRow, this._range.startColumn)) != null ? s : null;
1256
+ var r;
1257
+ return (r = this._worksheet.getCell(this._range.startRow, this._range.startColumn)) != null ? r : null;
1072
1258
  }
1073
1259
  /**
1074
1260
  * Alias for getCellDataGrid.
@@ -1096,14 +1282,14 @@ let k = class extends he {
1096
1282
  * ```
1097
1283
  */
1098
1284
  getCellDataGrid() {
1099
- const { startRow: s, endRow: e, startColumn: t, endColumn: n } = this._range, r = [];
1100
- for (let o = s; o <= e; o++) {
1285
+ const { startRow: r, endRow: e, startColumn: t, endColumn: n } = this._range, s = [];
1286
+ for (let o = r; o <= e; o++) {
1101
1287
  const i = [];
1102
1288
  for (let a = t; a <= n; a++)
1103
1289
  i.push(this._worksheet.getCellRaw(o, a));
1104
- r.push(i);
1290
+ s.push(i);
1105
1291
  }
1106
- return r;
1292
+ return s;
1107
1293
  }
1108
1294
  /**
1109
1295
  * Returns the rich text value for the cell at the start of this range.
@@ -1119,8 +1305,8 @@ let k = class extends he {
1119
1305
  * ```
1120
1306
  */
1121
1307
  getRichTextValue() {
1122
- const s = this.getCellData();
1123
- return s != null && s.p ? new E(s.p) : null;
1308
+ const r = this.getCellData();
1309
+ return r != null && r.p ? new P(r.p) : null;
1124
1310
  }
1125
1311
  /**
1126
1312
  * Returns the rich text value for the cells in the range.
@@ -1136,7 +1322,7 @@ let k = class extends he {
1136
1322
  * ```
1137
1323
  */
1138
1324
  getRichTextValues() {
1139
- return this.getCellDataGrid().map((e) => e.map((t) => t != null && t.p ? new E(t.p) : null));
1325
+ return this.getCellDataGrid().map((e) => e.map((t) => t != null && t.p ? new P(t.p) : null));
1140
1326
  }
1141
1327
  /**
1142
1328
  * Returns the value and rich text value for the cell at the start of this range.
@@ -1152,8 +1338,8 @@ let k = class extends he {
1152
1338
  * ```
1153
1339
  */
1154
1340
  getValueAndRichTextValue() {
1155
- const s = this.getCellData();
1156
- return s != null && s.p ? new E(s.p) : s == null ? void 0 : s.v;
1341
+ const r = this.getCellData();
1342
+ return r != null && r.p ? new P(r.p) : r == null ? void 0 : r.v;
1157
1343
  }
1158
1344
  /**
1159
1345
  * Returns the value and rich text value for the cells in the range.
@@ -1167,7 +1353,27 @@ let k = class extends he {
1167
1353
  * ```
1168
1354
  */
1169
1355
  getValueAndRichTextValues() {
1170
- return this.getCellDatas().map((e) => e.map((t) => t != null && t.p ? new E(t.p) : t == null ? void 0 : t.v));
1356
+ return this.getCellDatas().map((e) => e.map((t) => t != null && t.p ? new P(t.p) : t == null ? void 0 : t.v));
1357
+ }
1358
+ /**
1359
+ * Returns the formula (A1 notation) of the top-left cell in the range, or an empty string if the cell is empty or doesn't contain a formula.
1360
+ * @returns {string} The formula for the cell.
1361
+ * @example
1362
+ * ```ts
1363
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1364
+ * const fWorksheet = fWorkbook.getActiveSheet();
1365
+ * const fRange = fWorksheet.getRange('A1:B2');
1366
+ * console.log(fRange.getFormula());
1367
+ * ```
1368
+ */
1369
+ getFormula() {
1370
+ var r;
1371
+ return (r = this._formulaDataModel.getFormulaStringByCell(
1372
+ this._range.startRow,
1373
+ this._range.startColumn,
1374
+ this._worksheet.getSheetId(),
1375
+ this._workbook.getUnitId()
1376
+ )) != null ? r : "";
1171
1377
  }
1172
1378
  /**
1173
1379
  * Returns the formulas (A1 notation) for the cells in the range. Entries in the 2D array are empty strings for cells with no formula.
@@ -1181,20 +1387,20 @@ let k = class extends he {
1181
1387
  * ```
1182
1388
  */
1183
1389
  getFormulas() {
1184
- const s = [], { startRow: e, endRow: t, startColumn: n, endColumn: r } = this._range, o = this._worksheet.getSheetId(), i = this._workbook.getUnitId();
1390
+ const r = [], { startRow: e, endRow: t, startColumn: n, endColumn: s } = this._range, o = this._worksheet.getSheetId(), i = this._workbook.getUnitId();
1185
1391
  for (let a = e; a <= t; a++) {
1186
1392
  const h = [];
1187
- for (let d = n; d <= r; d++) {
1393
+ for (let d = n; d <= s; d++) {
1188
1394
  const c = this._formulaDataModel.getFormulaStringByCell(a, d, o, i);
1189
1395
  h.push(c || "");
1190
1396
  }
1191
- s.push(h);
1397
+ r.push(h);
1192
1398
  }
1193
- return s;
1399
+ return r;
1194
1400
  }
1195
1401
  /**
1196
- * Returns true if the cell wrap is enabled for the top left cell of the range.
1197
- * @returns {boolean} True if the cell wrap is enabled
1402
+ * Gets whether text wrapping is enabled for top-left cell in the range.
1403
+ * @returns {boolean} whether text wrapping is enabled for the cell.
1198
1404
  * @example
1199
1405
  * ```ts
1200
1406
  * const fWorkbook = univerAPI.getActiveWorkbook();
@@ -1206,6 +1412,23 @@ let k = class extends he {
1206
1412
  getWrap() {
1207
1413
  return this._worksheet.getRange(this._range).getWrap() === g.TRUE;
1208
1414
  }
1415
+ /**
1416
+ * Gets whether text wrapping is enabled for cells in the range.
1417
+ * @returns {boolean[][]} A two-dimensional array of whether text wrapping is enabled for each cell in the range.
1418
+ * @example
1419
+ * ```ts
1420
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1421
+ * const fWorksheet = fWorkbook.getActiveSheet();
1422
+ * const fRange = fWorksheet.getRange('A1:B2');
1423
+ * console.log(fRange.getWraps());
1424
+ */
1425
+ getWraps() {
1426
+ const r = this.getCellDatas(), e = this._workbook.getStyles();
1427
+ return r.map((t) => t.map((n) => {
1428
+ var s;
1429
+ return ((s = e.getStyleByCell(n)) == null ? void 0 : s.tb) === G.WRAP;
1430
+ }));
1431
+ }
1209
1432
  /**
1210
1433
  * Returns the text wrapping strategy for the top left cell of the range.
1211
1434
  * @returns {WrapStrategy} The text wrapping strategy
@@ -1221,8 +1444,8 @@ let k = class extends he {
1221
1444
  return this._worksheet.getRange(this._range).getWrapStrategy();
1222
1445
  }
1223
1446
  /**
1224
- * Returns the horizontal alignment for the top left cell of the range.
1225
- * @returns {string} The horizontal alignment
1447
+ * Returns the horizontal alignment of the text (left/center/right) of the top-left cell in the range.
1448
+ * @returns {string} The horizontal alignment of the text in the cell.
1226
1449
  * @example
1227
1450
  * ```ts
1228
1451
  * const fWorkbook = univerAPI.getActiveWorkbook();
@@ -1232,11 +1455,26 @@ let k = class extends he {
1232
1455
  * ```
1233
1456
  */
1234
1457
  getHorizontalAlignment() {
1235
- return en(this._worksheet.getRange(this._range).getHorizontalAlignment());
1458
+ const r = this._worksheet.getRange(this._range).getHorizontalAlignment();
1459
+ return Te(r);
1236
1460
  }
1237
1461
  /**
1238
- * Returns the vertical alignment for the top left cell of the range.
1239
- * @returns {string} The vertical alignment
1462
+ * Returns the horizontal alignments of the cells in the range.
1463
+ * @returns {string[][]} A two-dimensional array of horizontal alignments of text associated with cells in the range.
1464
+ * @example
1465
+ * ```ts
1466
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1467
+ * const fWorksheet = fWorkbook.getActiveSheet();
1468
+ * const fRange = fWorksheet.getRange('A1:B2');
1469
+ * console.log(fRange.getHorizontalAlignments());
1470
+ * ```
1471
+ */
1472
+ getHorizontalAlignments() {
1473
+ return this._worksheet.getRange(this._range).getHorizontalAlignments().map((e) => e.map((t) => Te(t)));
1474
+ }
1475
+ /**
1476
+ * Returns the vertical alignment (top/middle/bottom) of the top-left cell in the range.
1477
+ * @returns {string} The vertical alignment of the text in the cell.
1240
1478
  * @example
1241
1479
  * ```ts
1242
1480
  * const fWorkbook = univerAPI.getActiveWorkbook();
@@ -1246,7 +1484,21 @@ let k = class extends he {
1246
1484
  * ```
1247
1485
  */
1248
1486
  getVerticalAlignment() {
1249
- return nn(this._worksheet.getRange(this._range).getVerticalAlignment());
1487
+ return Ae(this._worksheet.getRange(this._range).getVerticalAlignment());
1488
+ }
1489
+ /**
1490
+ * Returns the vertical alignments of the cells in the range.
1491
+ * @returns {string[][]} A two-dimensional array of vertical alignments of text associated with cells in the range.
1492
+ * @example
1493
+ * ```ts
1494
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1495
+ * const fWorksheet = fWorkbook.getActiveSheet();
1496
+ * const fRange = fWorksheet.getRange('A1:B2');
1497
+ * console.log(fRange.getVerticalAlignments());
1498
+ * ```
1499
+ */
1500
+ getVerticalAlignments() {
1501
+ return this._worksheet.getRange(this._range).getVerticalAlignments().map((e) => e.map((t) => Ae(t)));
1250
1502
  }
1251
1503
  /**
1252
1504
  * Set custom meta data for first cell in current range.
@@ -1260,9 +1512,9 @@ let k = class extends he {
1260
1512
  * console.log(fRange.getCustomMetaData());
1261
1513
  * ```
1262
1514
  */
1263
- setCustomMetaData(s) {
1515
+ setCustomMetaData(r) {
1264
1516
  return this.setValue({
1265
- custom: s
1517
+ custom: r
1266
1518
  });
1267
1519
  }
1268
1520
  /**
@@ -1280,8 +1532,8 @@ let k = class extends he {
1280
1532
  * console.log(fRange.getCustomMetaDatas());
1281
1533
  * ```
1282
1534
  */
1283
- setCustomMetaDatas(s) {
1284
- return this.setValues(s.map((e) => e.map((t) => ({ custom: t }))));
1535
+ setCustomMetaDatas(r) {
1536
+ return this.setValues(r.map((e) => e.map((t) => ({ custom: t }))));
1285
1537
  }
1286
1538
  /**
1287
1539
  * Returns the custom meta data for the cell at the start of this range.
@@ -1296,8 +1548,8 @@ let k = class extends he {
1296
1548
  */
1297
1549
  getCustomMetaData() {
1298
1550
  var e;
1299
- const s = this.getCellData();
1300
- return (e = s == null ? void 0 : s.custom) != null ? e : null;
1551
+ const r = this.getCellData();
1552
+ return (e = r == null ? void 0 : r.custom) != null ? e : null;
1301
1553
  }
1302
1554
  /**
1303
1555
  * Returns the custom meta data for the cells in the range.
@@ -1330,19 +1582,52 @@ let k = class extends he {
1330
1582
  * fRange.setBorder(univerAPI.Enum.BorderType.ALL, univerAPI.Enum.BorderStyleTypes.THIN, '#ff0000');
1331
1583
  * ```
1332
1584
  */
1333
- setBorder(s, e, t) {
1334
- return this._commandService.syncExecuteCommand(mt.id, {
1585
+ setBorder(r, e, t) {
1586
+ return this._commandService.syncExecuteCommand(It.id, {
1335
1587
  unitId: this._workbook.getUnitId(),
1336
1588
  subUnitId: this._worksheet.getSheetId(),
1337
1589
  ranges: [this._range],
1338
1590
  value: {
1339
- type: s,
1591
+ type: r,
1340
1592
  style: e,
1341
1593
  color: t
1342
1594
  }
1343
1595
  }), this;
1344
1596
  }
1345
1597
  // #region editing
1598
+ /**
1599
+ * Returns the background color of the top-left cell in the range.
1600
+ * @returns {string} The color code of the background.
1601
+ * @example
1602
+ * ```ts
1603
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1604
+ * const fWorksheet = fWorkbook.getActiveSheet();
1605
+ * const fRange = fWorksheet.getRange('A1:B2');
1606
+ * console.log(fRange.getBackground());
1607
+ * ```
1608
+ */
1609
+ getBackground() {
1610
+ var e, t;
1611
+ const r = this.getCellStyle();
1612
+ return (t = (e = r == null ? void 0 : r.background) == null ? void 0 : e.rgb) != null ? t : ke.bg.rgb;
1613
+ }
1614
+ /**
1615
+ * Returns the background colors of the cells in the range.
1616
+ * @returns {string[][]} A two-dimensional array of color codes of the backgrounds.
1617
+ * @example
1618
+ * ```ts
1619
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1620
+ * const fWorksheet = fWorkbook.getActiveSheet();
1621
+ * const fRange = fWorksheet.getRange('A1:B2');
1622
+ * console.log(fRange.getBackgrounds());
1623
+ * ```
1624
+ */
1625
+ getBackgrounds() {
1626
+ return this.getCellStyles().map((e) => e.map((t) => {
1627
+ var n, s;
1628
+ return (s = (n = t == null ? void 0 : t.background) == null ? void 0 : n.rgb) != null ? s : ke.bg.rgb;
1629
+ }));
1630
+ }
1346
1631
  /**
1347
1632
  * Set background color for current range.
1348
1633
  * @param {string} color The background color
@@ -1355,15 +1640,15 @@ let k = class extends he {
1355
1640
  * fRange.setBackgroundColor('red');
1356
1641
  * ```
1357
1642
  */
1358
- setBackgroundColor(s) {
1359
- return this._commandService.syncExecuteCommand(f.id, {
1643
+ setBackgroundColor(r) {
1644
+ return this._commandService.syncExecuteCommand(b.id, {
1360
1645
  unitId: this._workbook.getUnitId(),
1361
1646
  subUnitId: this._worksheet.getSheetId(),
1362
1647
  range: this._range,
1363
1648
  style: {
1364
1649
  type: "bg",
1365
1650
  value: {
1366
- rgb: s
1651
+ rgb: r
1367
1652
  }
1368
1653
  }
1369
1654
  }), this;
@@ -1380,8 +1665,28 @@ let k = class extends he {
1380
1665
  * fRange.setBackground('red');
1381
1666
  * ```
1382
1667
  */
1383
- setBackground(s) {
1384
- return this.setBackgroundColor(s), this;
1668
+ setBackground(r) {
1669
+ return this.setBackgroundColor(r), this;
1670
+ }
1671
+ /**
1672
+ * Set rotation for text in current range.
1673
+ * @param {number} rotation - The rotation angle in degrees
1674
+ * @returns This range, for chaining
1675
+ * @example
1676
+ * ```typescript
1677
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1678
+ * const fWorksheet = fWorkbook.getActiveSheet();
1679
+ * const fRange = fWorksheet.getRange('A1:B2');
1680
+ * fRange.setTextRotation(45);
1681
+ * ```
1682
+ */
1683
+ setTextRotation(r) {
1684
+ return this._commandService.syncExecuteCommand(Rt.id, {
1685
+ unitId: this._workbook.getUnitId(),
1686
+ subUnitId: this._worksheet.getSheetId(),
1687
+ range: this._range,
1688
+ value: r
1689
+ }), this;
1385
1690
  }
1386
1691
  /**
1387
1692
  * Sets the value of the range.
@@ -1397,11 +1702,11 @@ let k = class extends he {
1397
1702
  * fRange.setValue({ v: 234, s: { bg: { rgb: '#ff0000' } } });
1398
1703
  * ```
1399
1704
  */
1400
- setValue(s) {
1401
- const e = V(s);
1705
+ setValue(r) {
1706
+ const e = O(r);
1402
1707
  if (!e)
1403
1708
  throw new Error("Invalid value");
1404
- return this._commandService.syncExecuteCommand(x.id, {
1709
+ return this._commandService.syncExecuteCommand(B.id, {
1405
1710
  unitId: this._workbook.getUnitId(),
1406
1711
  subUnitId: this._worksheet.getSheetId(),
1407
1712
  range: this._range,
@@ -1422,11 +1727,11 @@ let k = class extends he {
1422
1727
  * fRange.setValueForCell({ v: 234, s: { bg: { rgb: '#ff0000' } } });
1423
1728
  * ```
1424
1729
  */
1425
- setValueForCell(s) {
1426
- const e = V(s);
1730
+ setValueForCell(r) {
1731
+ const e = O(r);
1427
1732
  if (!e)
1428
1733
  throw new Error("Invalid value");
1429
- return this._commandService.syncExecuteCommand(x.id, {
1734
+ return this._commandService.syncExecuteCommand(B.id, {
1430
1735
  unitId: this._workbook.getUnitId(),
1431
1736
  subUnitId: this._worksheet.getSheetId(),
1432
1737
  range: {
@@ -1457,8 +1762,8 @@ let k = class extends he {
1457
1762
  * console.log(fRange.getValue(true).toPlainText()); // Hello World
1458
1763
  * ```
1459
1764
  */
1460
- setRichTextValueForCell(s) {
1461
- const e = s instanceof E ? s.getData() : s, t = {
1765
+ setRichTextValueForCell(r) {
1766
+ const e = r instanceof P ? r.getData() : r, t = {
1462
1767
  unitId: this._workbook.getUnitId(),
1463
1768
  subUnitId: this._worksheet.getSheetId(),
1464
1769
  range: {
@@ -1469,7 +1774,7 @@ let k = class extends he {
1469
1774
  },
1470
1775
  value: { p: e }
1471
1776
  };
1472
- return this._commandService.syncExecuteCommand(x.id, t), this;
1777
+ return this._commandService.syncExecuteCommand(B.id, t), this;
1473
1778
  }
1474
1779
  /**
1475
1780
  * Set the rich text value for the cells in the range.
@@ -1493,14 +1798,14 @@ let k = class extends he {
1493
1798
  * console.log(fRange.getValue(true).toPlainText()); // Hello World
1494
1799
  * ```
1495
1800
  */
1496
- setRichTextValues(s) {
1497
- const e = s.map((r) => r.map((o) => o && { p: o instanceof E ? o.getData() : o })), t = Ue(e, this._range), n = {
1801
+ setRichTextValues(r) {
1802
+ const e = r.map((s) => s.map((o) => o && { p: o instanceof P ? o.getData() : o })), t = De(e, this._range), n = {
1498
1803
  unitId: this._workbook.getUnitId(),
1499
1804
  subUnitId: this._worksheet.getSheetId(),
1500
1805
  range: this._range,
1501
1806
  value: t
1502
1807
  };
1503
- return this._commandService.syncExecuteCommand(x.id, n), this;
1808
+ return this._commandService.syncExecuteCommand(B.id, n), this;
1504
1809
  }
1505
1810
  /**
1506
1811
  * Set the cell wrap of the given range.
@@ -1516,12 +1821,12 @@ let k = class extends he {
1516
1821
  * console.log(fRange.getWrap());
1517
1822
  * ```
1518
1823
  */
1519
- setWrap(s) {
1520
- return this._commandService.syncExecuteCommand(ee.id, {
1824
+ setWrap(r) {
1825
+ return this._commandService.syncExecuteCommand(ie.id, {
1521
1826
  unitId: this._workbook.getUnitId(),
1522
1827
  subUnitId: this._worksheet.getSheetId(),
1523
1828
  range: this._range,
1524
- value: s ? J.WRAP : J.UNSPECIFIED
1829
+ value: r ? G.WRAP : G.UNSPECIFIED
1525
1830
  }), this;
1526
1831
  }
1527
1832
  /**
@@ -1537,12 +1842,12 @@ let k = class extends he {
1537
1842
  * console.log(fRange.getWrapStrategy());
1538
1843
  * ```
1539
1844
  */
1540
- setWrapStrategy(s) {
1541
- return this._commandService.syncExecuteCommand(ee.id, {
1845
+ setWrapStrategy(r) {
1846
+ return this._commandService.syncExecuteCommand(ie.id, {
1542
1847
  unitId: this._workbook.getUnitId(),
1543
1848
  subUnitId: this._worksheet.getSheetId(),
1544
1849
  range: this._range,
1545
- value: s
1850
+ value: r
1546
1851
  }), this;
1547
1852
  }
1548
1853
  /**
@@ -1557,12 +1862,12 @@ let k = class extends he {
1557
1862
  * fRange.setVerticalAlignment('top');
1558
1863
  * ```
1559
1864
  */
1560
- setVerticalAlignment(s) {
1561
- return this._commandService.syncExecuteCommand(lt.id, {
1865
+ setVerticalAlignment(r) {
1866
+ return this._commandService.syncExecuteCommand(bt.id, {
1562
1867
  unitId: this._workbook.getUnitId(),
1563
1868
  subUnitId: this._worksheet.getSheetId(),
1564
1869
  range: this._range,
1565
- value: tn(s)
1870
+ value: ln(r)
1566
1871
  }), this;
1567
1872
  }
1568
1873
  /**
@@ -1577,12 +1882,12 @@ let k = class extends he {
1577
1882
  * fRange.setHorizontalAlignment('left');
1578
1883
  * ```
1579
1884
  */
1580
- setHorizontalAlignment(s) {
1581
- return this._commandService.syncExecuteCommand(_t.id, {
1885
+ setHorizontalAlignment(r) {
1886
+ return this._commandService.syncExecuteCommand(pt.id, {
1582
1887
  unitId: this._workbook.getUnitId(),
1583
1888
  subUnitId: this._worksheet.getSheetId(),
1584
1889
  range: this._range,
1585
- value: Zt(s)
1890
+ value: gn(r)
1586
1891
  }), this;
1587
1892
  }
1588
1893
  /**
@@ -1600,9 +1905,9 @@ let k = class extends he {
1600
1905
  * ]);
1601
1906
  * ```
1602
1907
  */
1603
- setValues(s) {
1604
- const e = Ue(s, this._range);
1605
- return this._commandService.syncExecuteCommand(x.id, {
1908
+ setValues(r) {
1909
+ const e = De(r, this._range);
1910
+ return this._commandService.syncExecuteCommand(B.id, {
1606
1911
  unitId: this._workbook.getUnitId(),
1607
1912
  subUnitId: this._worksheet.getSheetId(),
1608
1913
  range: this._range,
@@ -1621,13 +1926,13 @@ let k = class extends he {
1621
1926
  * fRange.setFontWeight('bold');
1622
1927
  * ```
1623
1928
  */
1624
- setFontWeight(s) {
1929
+ setFontWeight(r) {
1625
1930
  let e;
1626
- if (s === "bold")
1931
+ if (r === "bold")
1627
1932
  e = g.TRUE;
1628
- else if (s === "normal")
1933
+ else if (r === "normal")
1629
1934
  e = g.FALSE;
1630
- else if (s === null)
1935
+ else if (r === null)
1631
1936
  e = null;
1632
1937
  else
1633
1938
  throw new Error("Invalid fontWeight");
@@ -1640,7 +1945,7 @@ let k = class extends he {
1640
1945
  range: this._range,
1641
1946
  style: t
1642
1947
  };
1643
- return this._commandService.syncExecuteCommand(f.id, n), this;
1948
+ return this._commandService.syncExecuteCommand(b.id, n), this;
1644
1949
  }
1645
1950
  /**
1646
1951
  * Sets the font style for the given range ('italic' or 'normal').
@@ -1654,13 +1959,13 @@ let k = class extends he {
1654
1959
  * fRange.setFontStyle('italic');
1655
1960
  * ```
1656
1961
  */
1657
- setFontStyle(s) {
1962
+ setFontStyle(r) {
1658
1963
  let e;
1659
- if (s === "italic")
1964
+ if (r === "italic")
1660
1965
  e = g.TRUE;
1661
- else if (s === "normal")
1966
+ else if (r === "normal")
1662
1967
  e = g.FALSE;
1663
- else if (s === null)
1968
+ else if (r === null)
1664
1969
  e = null;
1665
1970
  else
1666
1971
  throw new Error("Invalid fontStyle");
@@ -1673,7 +1978,7 @@ let k = class extends he {
1673
1978
  range: this._range,
1674
1979
  style: t
1675
1980
  };
1676
- return this._commandService.syncExecuteCommand(f.id, n), this;
1981
+ return this._commandService.syncExecuteCommand(b.id, n), this;
1677
1982
  }
1678
1983
  /**
1679
1984
  * Sets the font line style of the given range ('underline', 'line-through', or 'none').
@@ -1687,22 +1992,22 @@ let k = class extends he {
1687
1992
  * fRange.setFontLine('underline');
1688
1993
  * ```
1689
1994
  */
1690
- setFontLine(s) {
1691
- if (s === "underline")
1995
+ setFontLine(r) {
1996
+ if (r === "underline")
1692
1997
  this._setFontUnderline({
1693
1998
  s: g.TRUE
1694
1999
  });
1695
- else if (s === "line-through")
2000
+ else if (r === "line-through")
1696
2001
  this._setFontStrikethrough({
1697
2002
  s: g.TRUE
1698
2003
  });
1699
- else if (s === "none")
2004
+ else if (r === "none")
1700
2005
  this._setFontUnderline({
1701
2006
  s: g.FALSE
1702
2007
  }), this._setFontStrikethrough({
1703
2008
  s: g.FALSE
1704
2009
  });
1705
- else if (s === null)
2010
+ else if (r === null)
1706
2011
  this._setFontUnderline(null), this._setFontStrikethrough(null);
1707
2012
  else
1708
2013
  throw new Error("Invalid fontLine");
@@ -1713,34 +2018,34 @@ let k = class extends he {
1713
2018
  * @param {ITextDecoration|null} value The font underline style of the given ITextDecoration; a null value resets the font underline style
1714
2019
  * @returns {void}
1715
2020
  */
1716
- _setFontUnderline(s) {
2021
+ _setFontUnderline(r) {
1717
2022
  const e = {
1718
2023
  type: "ul",
1719
- value: s
2024
+ value: r
1720
2025
  }, t = {
1721
2026
  unitId: this._workbook.getUnitId(),
1722
2027
  subUnitId: this._worksheet.getSheetId(),
1723
2028
  range: this._range,
1724
2029
  style: e
1725
2030
  };
1726
- this._commandService.syncExecuteCommand(f.id, t);
2031
+ this._commandService.syncExecuteCommand(b.id, t);
1727
2032
  }
1728
2033
  /**
1729
2034
  * Sets the font strikethrough style of the given ITextDecoration
1730
2035
  * @param {ITextDecoration|null} value The font strikethrough style of the given ITextDecoration; a null value resets the font strikethrough style
1731
2036
  * @returns {void}
1732
2037
  */
1733
- _setFontStrikethrough(s) {
2038
+ _setFontStrikethrough(r) {
1734
2039
  const e = {
1735
2040
  type: "st",
1736
- value: s
2041
+ value: r
1737
2042
  }, t = {
1738
2043
  unitId: this._workbook.getUnitId(),
1739
2044
  subUnitId: this._worksheet.getSheetId(),
1740
2045
  range: this._range,
1741
2046
  style: e
1742
2047
  };
1743
- this._commandService.syncExecuteCommand(f.id, t);
2048
+ this._commandService.syncExecuteCommand(b.id, t);
1744
2049
  }
1745
2050
  /**
1746
2051
  * Sets the font family, such as "Arial" or "Helvetica".
@@ -1754,17 +2059,17 @@ let k = class extends he {
1754
2059
  * fRange.setFontFamily('Arial');
1755
2060
  * ```
1756
2061
  */
1757
- setFontFamily(s) {
2062
+ setFontFamily(r) {
1758
2063
  const e = {
1759
2064
  type: "ff",
1760
- value: s
2065
+ value: r
1761
2066
  }, t = {
1762
2067
  unitId: this._workbook.getUnitId(),
1763
2068
  subUnitId: this._worksheet.getSheetId(),
1764
2069
  range: this._range,
1765
2070
  style: e
1766
2071
  };
1767
- return this._commandService.syncExecuteCommand(f.id, t), this;
2072
+ return this._commandService.syncExecuteCommand(b.id, t), this;
1768
2073
  }
1769
2074
  /**
1770
2075
  * Sets the font size, with the size being the point size to use.
@@ -1778,17 +2083,17 @@ let k = class extends he {
1778
2083
  * fRange.setFontSize(24);
1779
2084
  * ```
1780
2085
  */
1781
- setFontSize(s) {
2086
+ setFontSize(r) {
1782
2087
  const e = {
1783
2088
  type: "fs",
1784
- value: s
2089
+ value: r
1785
2090
  }, t = {
1786
2091
  unitId: this._workbook.getUnitId(),
1787
2092
  subUnitId: this._worksheet.getSheetId(),
1788
2093
  range: this._range,
1789
2094
  style: e
1790
2095
  };
1791
- return this._commandService.syncExecuteCommand(f.id, t), this;
2096
+ return this._commandService.syncExecuteCommand(b.id, t), this;
1792
2097
  }
1793
2098
  /**
1794
2099
  * Sets the font color in CSS notation (such as '#ffffff' or 'white').
@@ -1802,17 +2107,17 @@ let k = class extends he {
1802
2107
  * fRange.setFontColor('#ff0000');
1803
2108
  * ```
1804
2109
  */
1805
- setFontColor(s) {
2110
+ setFontColor(r) {
1806
2111
  const t = {
1807
2112
  type: "cl",
1808
- value: s === null ? null : { rgb: s }
2113
+ value: r === null ? null : { rgb: r }
1809
2114
  }, n = {
1810
2115
  unitId: this._workbook.getUnitId(),
1811
2116
  subUnitId: this._worksheet.getSheetId(),
1812
2117
  range: this._range,
1813
2118
  style: t
1814
2119
  };
1815
- return this._commandService.syncExecuteCommand(f.id, n), this;
2120
+ return this._commandService.syncExecuteCommand(b.id, n), this;
1816
2121
  }
1817
2122
  // #endregion editing
1818
2123
  //#region Merge cell
@@ -1829,9 +2134,9 @@ let k = class extends he {
1829
2134
  * console.log(fRange.isMerged());
1830
2135
  * ```
1831
2136
  */
1832
- merge(s = !0) {
2137
+ merge(r = !0) {
1833
2138
  const e = this._workbook.getUnitId(), t = this._worksheet.getSheetId();
1834
- return G(this._injector, e, t, [this._range], s), this;
2139
+ return Q(this._injector, e, t, [this._range], r), this;
1835
2140
  }
1836
2141
  /**
1837
2142
  * Merges cells in a range horizontally.
@@ -1851,9 +2156,9 @@ let k = class extends he {
1851
2156
  * });
1852
2157
  * ```
1853
2158
  */
1854
- mergeAcross(s = !0) {
1855
- const e = me([this._range], ue.ROWS), t = this._workbook.getUnitId(), n = this._worksheet.getSheetId();
1856
- return G(this._injector, t, n, e, s), this;
2159
+ mergeAcross(r = !0) {
2160
+ const e = Ce([this._range], M.ROWS), t = this._workbook.getUnitId(), n = this._worksheet.getSheetId();
2161
+ return Q(this._injector, t, n, e, r), this;
1857
2162
  }
1858
2163
  /**
1859
2164
  * Merges cells in a range vertically.
@@ -1873,9 +2178,9 @@ let k = class extends he {
1873
2178
  * });
1874
2179
  * ```
1875
2180
  */
1876
- mergeVertically(s = !0) {
1877
- const e = me([this._range], ue.COLUMNS), t = this._workbook.getUnitId(), n = this._worksheet.getSheetId();
1878
- return G(this._injector, t, n, e, s), this;
2181
+ mergeVertically(r = !0) {
2182
+ const e = Ce([this._range], M.COLUMNS), t = this._workbook.getUnitId(), n = this._worksheet.getSheetId();
2183
+ return Q(this._injector, t, n, e, r), this;
1879
2184
  }
1880
2185
  /**
1881
2186
  * Returns true if cells in the current range overlap a merged cell.
@@ -1891,8 +2196,8 @@ let k = class extends he {
1891
2196
  * ```
1892
2197
  */
1893
2198
  isPartOfMerge() {
1894
- const { startRow: s, startColumn: e, endRow: t, endColumn: n } = this._range;
1895
- return this._worksheet.getMergedCellRange(s, e, t, n).length > 0;
2199
+ const { startRow: r, startColumn: e, endRow: t, endColumn: n } = this._range;
2200
+ return this._worksheet.getMergedCellRange(r, e, t, n).length > 0;
1896
2201
  }
1897
2202
  /**
1898
2203
  * Break all horizontally- or vertically-merged cells contained within the range list into individual cells again.
@@ -1910,7 +2215,7 @@ let k = class extends he {
1910
2215
  * ```
1911
2216
  */
1912
2217
  breakApart() {
1913
- return this._commandService.syncExecuteCommand(kt.id, { ranges: [this._range] }), this;
2218
+ return this._commandService.syncExecuteCommand(Et.id, { ranges: [this._range] }), this;
1914
2219
  }
1915
2220
  //#endregion
1916
2221
  /**
@@ -1928,10 +2233,10 @@ let k = class extends he {
1928
2233
  * });
1929
2234
  * ```
1930
2235
  */
1931
- forEach(s) {
1932
- const { startColumn: e, startRow: t, endColumn: n, endRow: r } = this._range;
1933
- this._worksheet.getMatrixWithMergedCells(t, e, r, n).forValue((o, i, a) => {
1934
- s(o, i, a);
2236
+ forEach(r) {
2237
+ const { startColumn: e, startRow: t, endColumn: n, endRow: s } = this._range;
2238
+ this._worksheet.getMatrixWithMergedCells(t, e, s, n).forValue((o, i, a) => {
2239
+ r(o, i, a);
1935
2240
  });
1936
2241
  }
1937
2242
  /**
@@ -1945,8 +2250,8 @@ let k = class extends he {
1945
2250
  * console.log(fRange.getA1Notation()); // A1:B2
1946
2251
  * ```
1947
2252
  */
1948
- getA1Notation(s) {
1949
- return s ? $t(this._worksheet.getName(), this._range) : de(this._range);
2253
+ getA1Notation(r) {
2254
+ return r ? sn(this._worksheet.getName(), this._range) : _e(this._range);
1950
2255
  }
1951
2256
  /**
1952
2257
  * Sets the specified range as the active range, with the top left cell in the range as the current cell.
@@ -1960,7 +2265,7 @@ let k = class extends he {
1960
2265
  * ```
1961
2266
  */
1962
2267
  activate() {
1963
- return this._injector.createInstance(v, this._workbook).setActiveRange(this), this;
2268
+ return this._injector.createInstance(S, this._workbook).setActiveRange(this), this;
1964
2269
  }
1965
2270
  /**
1966
2271
  * Sets the specified cell as the current cell.
@@ -1972,18 +2277,51 @@ let k = class extends he {
1972
2277
  * ```ts
1973
2278
  * const fWorkbook = univerAPI.getActiveWorkbook();
1974
2279
  * const fWorksheet = fWorkbook.getActiveSheet();
2280
+ *
2281
+ * // Set the range A1:B2 as the active range, default active cell is A1
1975
2282
  * const fRange = fWorksheet.getRange('A1:B2');
1976
2283
  * fRange.activate();
2284
+ * console.log(fWorksheet.getActiveRange().getA1Notation()); // A1:B2
2285
+ * console.log(fWorksheet.getActiveCell().getA1Notation()); // A1
2286
+ *
2287
+ * // Set the cell B2 as the active cell
2288
+ * // Because B2 is in the active range A1:B2, the active range will not change, and the active cell will be changed to B2
1977
2289
  * const cell = fWorksheet.getRange('B2');
1978
- * cell.activateAsCurrentCell(); // the active cell will be B2
1979
- * console.log(fWorksheet.getActiveRange().getA1Notation()); // B2
2290
+ * cell.activateAsCurrentCell();
2291
+ * console.log(fWorksheet.getActiveRange().getA1Notation()); // A1:B2
2292
+ * console.log(fWorksheet.getActiveCell().getA1Notation()); // B2
2293
+ *
2294
+ * // Set the cell C3 as the active cell
2295
+ * // Because C3 is not in the active range A1:B2, a new active range C3:C3 will be created, and the active cell will be changed to C3
2296
+ * const cell2 = fWorksheet.getRange('C3');
2297
+ * cell2.activateAsCurrentCell();
2298
+ * console.log(fWorksheet.getActiveRange().getA1Notation()); // C3:C3
2299
+ * console.log(fWorksheet.getActiveCell().getA1Notation()); // C3
1980
2300
  * ```
1981
2301
  */
1982
2302
  activateAsCurrentCell() {
1983
- const s = this._worksheet.getMergedCell(this._range.startRow, this._range.startColumn);
1984
- if (s && D.equals(s, this._range) || !s && this._range.startRow === this._range.endRow && this._range.startColumn === this._range.endColumn)
2303
+ const r = this._worksheet.getMergedCell(this._range.startRow, this._range.startColumn);
2304
+ if (r && N.equals(r, this._range) || !r && this._range.startRow === this._range.endRow && this._range.startColumn === this._range.endColumn) {
2305
+ const n = this._injector.createInstance(S, this._workbook).getActiveRange();
2306
+ if (!n || n.getUnitId() !== this.getUnitId() || n.getSheetId() !== this.getSheetId())
2307
+ return this.activate();
2308
+ if (N.contains(n.getRange(), this._range)) {
2309
+ const s = {
2310
+ unitId: this.getUnitId(),
2311
+ subUnitId: this.getSheetId(),
2312
+ selections: [
2313
+ {
2314
+ range: n.getRange(),
2315
+ primary: $(this.getRange(), this._worksheet),
2316
+ style: null
2317
+ }
2318
+ ]
2319
+ };
2320
+ return this._commandService.syncExecuteCommand(me.id, s), this;
2321
+ }
1985
2322
  return this.activate();
1986
- throw new Error("The range is not a single cell");
2323
+ } else
2324
+ throw new Error("The range is not a single cell");
1987
2325
  }
1988
2326
  /**
1989
2327
  * Splits a column of text into multiple columns based on a custom specified delimiter.
@@ -2019,14 +2357,14 @@ let k = class extends he {
2019
2357
  * fRange.splitTextToColumns(true, univerAPI.Enum.SplitDelimiterType.Custom, '#');
2020
2358
  * ```
2021
2359
  */
2022
- splitTextToColumns(s, e, t) {
2023
- this._commandService.syncExecuteCommand(wt.id, {
2360
+ splitTextToColumns(r, e, t) {
2361
+ this._commandService.syncExecuteCommand(yt.id, {
2024
2362
  unitId: this._workbook.getUnitId(),
2025
2363
  subUnitId: this._worksheet.getSheetId(),
2026
2364
  range: this._range,
2027
2365
  delimiter: e,
2028
2366
  customDelimiter: t,
2029
- treatMultipleDelimitersAsOne: s
2367
+ treatMultipleDelimitersAsOne: r
2030
2368
  });
2031
2369
  }
2032
2370
  /**
@@ -2040,16 +2378,16 @@ let k = class extends he {
2040
2378
  * fRange.useThemeStyle('default');
2041
2379
  * ```
2042
2380
  */
2043
- useThemeStyle(s) {
2044
- if (s == null) {
2381
+ useThemeStyle(r) {
2382
+ if (r == null) {
2045
2383
  const e = this.getUsedThemeStyle();
2046
2384
  e && this.removeThemeStyle(e);
2047
2385
  } else
2048
- this._commandService.syncExecuteCommand(St.id, {
2386
+ this._commandService.syncExecuteCommand(Ut.id, {
2049
2387
  unitId: this._workbook.getUnitId(),
2050
2388
  subUnitId: this._worksheet.getSheetId(),
2051
2389
  range: this._range,
2052
- themeName: s
2390
+ themeName: r
2053
2391
  });
2054
2392
  }
2055
2393
  /**
@@ -2063,12 +2401,12 @@ let k = class extends he {
2063
2401
  * fRange.removeThemeStyle('default');
2064
2402
  * ```
2065
2403
  */
2066
- removeThemeStyle(s) {
2067
- this._commandService.syncExecuteCommand(Ct.id, {
2404
+ removeThemeStyle(r) {
2405
+ this._commandService.syncExecuteCommand(xt.id, {
2068
2406
  unitId: this._workbook.getUnitId(),
2069
2407
  subUnitId: this._worksheet.getSheetId(),
2070
2408
  range: this._range,
2071
- themeName: s
2409
+ themeName: r
2072
2410
  });
2073
2411
  }
2074
2412
  /**
@@ -2085,26 +2423,372 @@ let k = class extends he {
2085
2423
  * ```
2086
2424
  */
2087
2425
  getUsedThemeStyle() {
2088
- return this._injector.get(Oe).getAppliedRangeThemeStyle({
2426
+ return this._injector.get(qe).getAppliedRangeThemeStyle({
2427
+ unitId: this._workbook.getUnitId(),
2428
+ subUnitId: this._worksheet.getSheetId(),
2429
+ range: this._range
2430
+ });
2431
+ }
2432
+ /**
2433
+ * Clears content and formatting information of the range. Or Optionally clears only the contents or only the formatting.
2434
+ * @param {IFacadeClearOptions} [options] - Options for clearing the range. If not provided, the contents and formatting are cleared both.
2435
+ * @param {boolean} [options.contentsOnly] - If true, the contents of the range are cleared. If false, the contents and formatting are cleared. Default is false.
2436
+ * @param {boolean} [options.formatOnly] - If true, the formatting of the range is cleared. If false, the contents and formatting are cleared. Default is false.
2437
+ * @returns {FWorksheet} Returns the current worksheet instance for method chaining
2438
+ * @example
2439
+ * ```ts
2440
+ * const fWorkbook = univerAPI.getActiveWorkbook();
2441
+ * const fWorkSheet = fWorkbook.getActiveSheet();
2442
+ * const fRange = fWorkSheet.getRange('A1:D10');
2443
+ *
2444
+ * // clear the content and format of the range A1:D10
2445
+ * fRange.clear();
2446
+ *
2447
+ * // clear the content only of the range A1:D10
2448
+ * fRange.clear({ contentsOnly: true });
2449
+ * ```
2450
+ */
2451
+ clear(r) {
2452
+ return r && r.contentsOnly && !r.formatOnly ? this.clearContent() : r && r.formatOnly && !r.contentsOnly ? this.clearFormat() : (this._commandService.syncExecuteCommand(Ke.id, {
2453
+ unitId: this._workbook.getUnitId(),
2454
+ subUnitId: this._worksheet.getSheetId(),
2455
+ ranges: [this._range],
2456
+ options: r
2457
+ }), this);
2458
+ }
2459
+ /**
2460
+ * Clears content of the range, while preserving formatting information.
2461
+ * @returns {FWorksheet} Returns the current worksheet instance for method chaining
2462
+ * @example
2463
+ * ```typescript
2464
+ * const fWorkbook = univerAPI.getActiveWorkbook();
2465
+ * const fWorkSheet = fWorkbook.getActiveSheet();
2466
+ * const fRange = fWorkSheet.getRange('A1:D10');
2467
+ *
2468
+ * // clear the content only of the range A1:D10
2469
+ * fRange.clearContent();
2470
+ * ```
2471
+ */
2472
+ clearContent() {
2473
+ return this._commandService.syncExecuteCommand(Ye.id, {
2089
2474
  unitId: this._workbook.getUnitId(),
2090
2475
  subUnitId: this._worksheet.getSheetId(),
2476
+ ranges: [this._range]
2477
+ }), this;
2478
+ }
2479
+ /**
2480
+ * Clears formatting information of the range, while preserving contents.
2481
+ * @returns {FWorksheet} Returns the current worksheet instance for method chaining
2482
+ * @example
2483
+ * ```typescript
2484
+ * const fWorkbook = univerAPI.getActiveWorkbook();
2485
+ * const fWorkSheet = fWorkbook.getActiveSheet();
2486
+ * const fRange = fWorkSheet.getRange('A1:D10');
2487
+ * // clear the format only of the range A1:D10
2488
+ * fRange.clearFormat();
2489
+ * ```
2490
+ */
2491
+ clearFormat() {
2492
+ return this._commandService.syncExecuteCommand(Je.id, {
2493
+ unitId: this._workbook.getUnitId(),
2494
+ subUnitId: this._worksheet.getSheetId(),
2495
+ ranges: [this._range]
2496
+ }), this;
2497
+ }
2498
+ /**
2499
+ * Inserts empty cells into this range. Existing data in the sheet along the provided dimension is shifted away from the inserted range.
2500
+ * @param {Dimension} shiftDimension - The dimension along which to shift existing data.
2501
+ * @example
2502
+ * ```ts
2503
+ * // Assume the active sheet empty sheet.
2504
+ * const fWorkbook = univerAPI.getActiveWorkbook();
2505
+ * const fWorksheet = fWorkbook.getActiveSheet();
2506
+ * const values = [
2507
+ * [1, 2, 3, 4],
2508
+ * [2, 3, 4, 5],
2509
+ * [3, 4, 5, 6],
2510
+ * [4, 5, 6, 7],
2511
+ * [5, 6, 7, 8],
2512
+ * ];
2513
+ *
2514
+ * // Set the range A1:D5 with some values, the range A1:D5 will be:
2515
+ * // 1 | 2 | 3 | 4
2516
+ * // 2 | 3 | 4 | 5
2517
+ * // 3 | 4 | 5 | 6
2518
+ * // 4 | 5 | 6 | 7
2519
+ * // 5 | 6 | 7 | 8
2520
+ * const fRange = fWorksheet.getRange('A1:D5');
2521
+ * fRange.setValues(values);
2522
+ * console.log(fWorksheet.getRange('A1:D5').getValues()); // [[1, 2, 3, 4], [2, 3, 4, 5], [3, 4, 5, 6], [4, 5, 6, 7], [5, 6, 7, 8]]
2523
+ *
2524
+ * // Insert the empty cells into the range A1:B2 along the columns dimension, the range A1:D5 will be:
2525
+ * // | | 1 | 2
2526
+ * // | | 2 | 3
2527
+ * // 3 | 4 | 5 | 6
2528
+ * // 4 | 5 | 6 | 7
2529
+ * // 5 | 6 | 7 | 8
2530
+ * const fRange2 = fWorksheet.getRange('A1:B2');
2531
+ * fRange2.insertCells(univerAPI.Enum.Dimension.COLUMNS);
2532
+ * console.log(fWorksheet.getRange('A1:D5').getValues()); // [[null, null, 1, 2], [null, null, 2, 3], [3, 4, 5, 6], [4, 5, 6, 7], [5, 6, 7, 8]]
2533
+ *
2534
+ * // Set the range A1:D5 values again, the range A1:D5 will be:
2535
+ * // 1 | 2 | 3 | 4
2536
+ * // 2 | 3 | 4 | 5
2537
+ * // 3 | 4 | 5 | 6
2538
+ * // 4 | 5 | 6 | 7
2539
+ * // 5 | 6 | 7 | 8
2540
+ * fRange.setValues(values);
2541
+ *
2542
+ * // Insert the empty cells into the range A1:B2 along the rows dimension, the range A1:D5 will be:
2543
+ * // | | 3 | 4
2544
+ * // | | 4 | 5
2545
+ * // 1 | 2 | 5 | 6
2546
+ * // 2 | 3 | 6 | 7
2547
+ * // 3 | 4 | 7 | 8
2548
+ * const fRange3 = fWorksheet.getRange('A1:B2');
2549
+ * fRange3.insertCells(univerAPI.Enum.Dimension.ROWS);
2550
+ * console.log(fWorksheet.getRange('A1:D5').getValues()); // [[null, null, 3, 4], [null, null, 4, 5], [1, 2, 5, 6], [2, 3, 6, 7], [3, 4, 7, 8]]
2551
+ * ```
2552
+ */
2553
+ insertCells(r) {
2554
+ r === M.ROWS ? this._commandService.executeCommand(Pt.id, {
2555
+ range: this._range
2556
+ }) : this._commandService.executeCommand(Mt.id, {
2557
+ range: this._range
2558
+ });
2559
+ }
2560
+ /**
2561
+ * Deletes this range of cells. Existing data in the sheet along the provided dimension is shifted towards the deleted range.
2562
+ * @param {Dimension} shiftDimension - The dimension along which to shift existing data.
2563
+ * @example
2564
+ * ```ts
2565
+ * // Assume the active sheet empty sheet.
2566
+ * const fWorkbook = univerAPI.getActiveWorkbook();
2567
+ * const fWorksheet = fWorkbook.getActiveSheet();
2568
+ * const values = [
2569
+ * [1, 2, 3, 4],
2570
+ * [2, 3, 4, 5],
2571
+ * [3, 4, 5, 6],
2572
+ * [4, 5, 6, 7],
2573
+ * [5, 6, 7, 8],
2574
+ * ];
2575
+ *
2576
+ * // Set the range A1:D5 with some values, the range A1:D5 will be:
2577
+ * // 1 | 2 | 3 | 4
2578
+ * // 2 | 3 | 4 | 5
2579
+ * // 3 | 4 | 5 | 6
2580
+ * // 4 | 5 | 6 | 7
2581
+ * // 5 | 6 | 7 | 8
2582
+ * const fRange = fWorksheet.getRange('A1:D5');
2583
+ * fRange.setValues(values);
2584
+ * console.log(fWorksheet.getRange('A1:D5').getValues()); // [[1, 2, 3, 4], [2, 3, 4, 5], [3, 4, 5, 6], [4, 5, 6, 7], [5, 6, 7, 8]]
2585
+ *
2586
+ * // Delete the range A1:B2 along the columns dimension, the range A1:D5 will be:
2587
+ * // 3 | 4 | |
2588
+ * // 4 | 5 | |
2589
+ * // 3 | 4 | 5 | 6
2590
+ * // 4 | 5 | 6 | 7
2591
+ * // 5 | 6 | 7 | 8
2592
+ * const fRange2 = fWorksheet.getRange('A1:B2');
2593
+ * fRange2.deleteCells(univerAPI.Enum.Dimension.COLUMNS);
2594
+ * console.log(fWorksheet.getRange('A1:D5').getValues()); // [[3, 4, null, null], [4, 5, null, null], [3, 4, 5, 6], [4, 5, 6, 7], [5, 6, 7, 8]]
2595
+ *
2596
+ * // Set the range A1:D5 values again, the range A1:D5 will be:
2597
+ * // 1 | 2 | 3 | 4
2598
+ * // 2 | 3 | 4 | 5
2599
+ * // 3 | 4 | 5 | 6
2600
+ * // 4 | 5 | 6 | 7
2601
+ * // 5 | 6 | 7 | 8
2602
+ * fRange.setValues(values);
2603
+ *
2604
+ * // Delete the range A1:B2 along the rows dimension, the range A1:D5 will be:
2605
+ * // 3 | 4 | 3 | 4
2606
+ * // 4 | 5 | 4 | 5
2607
+ * // 5 | 6 | 5 | 6
2608
+ * // | | 6 | 7
2609
+ * // | | 7 | 8
2610
+ * const fRange3 = fWorksheet.getRange('A1:B2');
2611
+ * fRange3.deleteCells(univerAPI.Enum.Dimension.ROWS);
2612
+ * console.log(fWorksheet.getRange('A1:D5').getValues()); // [[3, 4, 3, 4], [4, 5, 4, 5], [5, 6, 5, 6], [null, null, 6, 7], [null, null, 7, 8]]
2613
+ * ```
2614
+ */
2615
+ deleteCells(r) {
2616
+ r === M.ROWS ? this._commandService.executeCommand(Nt.id, {
2091
2617
  range: this._range
2618
+ }) : this._commandService.executeCommand(Tt.id, {
2619
+ range: this._range
2620
+ });
2621
+ }
2622
+ /**
2623
+ * Returns a copy of the range expanded `Direction.UP` and `Direction.DOWN` if the specified dimension is `Dimension.ROWS`, or `Direction.NEXT` and `Direction.PREVIOUS` if the dimension is `Dimension.COLUMNS`.
2624
+ * The expansion of the range is based on detecting data next to the range that is organized like a table.
2625
+ * The expanded range covers all adjacent cells with data in them along the specified dimension including the table boundaries.
2626
+ * If the original range is surrounded by empty cells along the specified dimension, the range itself is returned.
2627
+ * @param {Dimension} [dimension] - The dimension along which to expand the range. If not provided, the range will be expanded in both dimensions.
2628
+ * @returns {FRange} The range's data region or a range covering each column or each row spanned by the original range.
2629
+ * @example
2630
+ * ```ts
2631
+ * // Assume the active sheet is a new sheet with no data.
2632
+ * const fWorkbook = univerAPI.getActiveWorkbook();
2633
+ * const fWorksheet = fWorkbook.getActiveSheet();
2634
+ *
2635
+ * // Set the range A1:D4 with some values, the range A1:D4 will be:
2636
+ * // | | |
2637
+ * // | | 100 |
2638
+ * // | 100 | | 100
2639
+ * // | | 100 |
2640
+ * fWorksheet.getRange('C2').setValue(100);
2641
+ * fWorksheet.getRange('B3').setValue(100);
2642
+ * fWorksheet.getRange('D3').setValue(100);
2643
+ * fWorksheet.getRange('C4').setValue(100);
2644
+ *
2645
+ * // Get C3 data region along the rows dimension, the range will be C2:D4
2646
+ * const range = fWorksheet.getRange('C3').getDataRegion(univerAPI.Enum.Dimension.ROWS);
2647
+ * console.log(range.getA1Notation()); // C2:C4
2648
+ *
2649
+ * // Get C3 data region along the columns dimension, the range will be B3:D3
2650
+ * const range2 = fWorksheet.getRange('C3').getDataRegion(univerAPI.Enum.Dimension.COLUMNS);
2651
+ * console.log(range2.getA1Notation()); // B3:D3
2652
+ *
2653
+ * // Get C3 data region along the both dimension, the range will be B2:D4
2654
+ * const range3 = fWorksheet.getRange('C3').getDataRegion();
2655
+ * console.log(range3.getA1Notation()); // B2:D4
2656
+ * ```
2657
+ */
2658
+ // eslint-disable-next-line complexity
2659
+ getDataRegion(r) {
2660
+ const { startRow: e, startColumn: t, endRow: n, endColumn: s } = this._range, o = this._worksheet.getMaxRows(), i = this._worksheet.getMaxColumns(), a = this._worksheet.getCellMatrix();
2661
+ let h = e, d = t, c = n, C = s;
2662
+ if (r !== M.COLUMNS) {
2663
+ let _ = !1, p = !1;
2664
+ for (let f = t; f <= s && (e > 0 && !D(a.getValue(e - 1, f)) && (_ = !0), n < o - 1 && !D(a.getValue(n + 1, f)) && (p = !0), !(_ && p)); f++)
2665
+ ;
2666
+ _ && (h = e - 1), p && (c = n + 1);
2667
+ }
2668
+ if (r !== M.ROWS) {
2669
+ let _ = !1, p = !1;
2670
+ for (let f = e; f <= n && (t > 0 && !D(a.getValue(f, t - 1)) && (_ = !0), s < i - 1 && !D(a.getValue(f, s + 1)) && (p = !0), !(_ && p)); f++)
2671
+ ;
2672
+ _ && (d = t - 1), p && (C = s + 1);
2673
+ }
2674
+ return this._injector.createInstance(m, this._workbook, this._worksheet, {
2675
+ startRow: h,
2676
+ startColumn: d,
2677
+ endRow: c,
2678
+ endColumn: C
2679
+ });
2680
+ }
2681
+ /**
2682
+ * Returns true if the range is totally blank.
2683
+ * @returns {boolean} true if the range is blank; false otherwise.
2684
+ * @example
2685
+ * ```ts
2686
+ * // Assume the active sheet is a new sheet with no data.
2687
+ * const fWorkbook = univerAPI.getActiveWorkbook();
2688
+ * const fWorksheet = fWorkbook.getActiveSheet();
2689
+ * const fRange = fWorksheet.getRange('A1:B2');
2690
+ * console.log(fRange.isBlank()); // true
2691
+ *
2692
+ * // Set the range A1:B2 with some values
2693
+ * fRange.setValueForCell(123);
2694
+ * console.log(fRange.isBlank()); // false
2695
+ * ```
2696
+ */
2697
+ isBlank() {
2698
+ const r = this._worksheet.getCellMatrix(), { startRow: e, startColumn: t, endRow: n, endColumn: s } = this._range;
2699
+ let o = !0;
2700
+ for (let i = e; i <= n; i++) {
2701
+ for (let a = t; a <= s; a++)
2702
+ if (!D(r.getValue(i, a))) {
2703
+ o = !1;
2704
+ break;
2705
+ }
2706
+ if (!o)
2707
+ break;
2708
+ }
2709
+ return o;
2710
+ }
2711
+ /**
2712
+ * Returns a new range that is relative to the current range, whose upper left point is offset from the current range by the given rows and columns, and with the given height and width in cells.
2713
+ * @param {number} rowOffset - The number of rows down from the range's top-left cell; negative values represent rows up from the range's top-left cell.
2714
+ * @param {number} columnOffset - The number of columns right from the range's top-left cell; negative values represent columns left from the range's top-left cell.
2715
+ * @param {number} numRows - The height in rows of the new range.
2716
+ * @param {number} numColumns - The width in columns of the new range.
2717
+ * @returns {FRange} The new range.
2718
+ * @example
2719
+ * ```ts
2720
+ * const fWorkbook = univerAPI.getActiveWorkbook();
2721
+ * const fWorksheet = fWorkbook.getActiveSheet();
2722
+ * const fRange = fWorksheet.getRange('A1:B2');
2723
+ * console.log(fRange.getA1Notation()); // A1:B2
2724
+ *
2725
+ * // Offset the range by 1 row and 1 column, and set the height of the new range to 3 and the width to 3
2726
+ * const newRange = fRange.offset(1, 1, 3, 3);
2727
+ * console.log(newRange.getA1Notation()); // B2:D4
2728
+ * ```
2729
+ */
2730
+ offset(r, e, t, n) {
2731
+ const { startRow: s, startColumn: o, endRow: i, endColumn: a } = this._range, h = s + r, d = o + e, c = t ? h + t - 1 : i + r, C = n ? d + n - 1 : a + e;
2732
+ if (h < 0 || d < 0 || c < 0 || C < 0)
2733
+ throw new Error("The row or column index is out of range");
2734
+ return this._injector.createInstance(m, this._workbook, this._worksheet, {
2735
+ startRow: h,
2736
+ startColumn: d,
2737
+ endRow: c,
2738
+ endColumn: C
2739
+ });
2740
+ }
2741
+ /**
2742
+ * Updates the formula for this range. The given formula must be in A1 notation.
2743
+ * @param {string} formula - A string representing the formula to set for the cell.
2744
+ * @returns {FRange} This range instance for chaining.
2745
+ * @example
2746
+ * ```ts
2747
+ * const fWorkbook = univerAPI.getActiveWorkbook();
2748
+ * const fWorksheet = fWorkbook.getActiveSheet();
2749
+ * const fRange = fWorksheet.getRange('A1');
2750
+ * fRange.setFormula('=SUM(A2:A5)');
2751
+ * console.log(fRange.getFormula()); // '=SUM(A2:A5)'
2752
+ * ```
2753
+ */
2754
+ setFormula(r) {
2755
+ return this.setValue({
2756
+ f: r
2092
2757
  });
2093
2758
  }
2759
+ /**
2760
+ * Sets a rectangular grid of formulas (must match dimensions of this range). The given formulas must be in A1 notation.
2761
+ * @param {string[][]} formulas - A two-dimensional string array of formulas.
2762
+ * @returns {FRange} This range instance for chaining.
2763
+ * @example
2764
+ * ```ts
2765
+ * const fWorkbook = univerAPI.getActiveWorkbook();
2766
+ * const fWorksheet = fWorkbook.getActiveSheet();
2767
+ * const fRange = fWorksheet.getRange('A1:B2');
2768
+ * fRange.setFormulas([
2769
+ * ['=SUM(A2:A5)', '=SUM(B2:B5)'],
2770
+ * ['=SUM(A6:A9)', '=SUM(B6:B9)'],
2771
+ * ]);
2772
+ * console.log(fRange.getFormulas()); // [['=SUM(A2:A5)', '=SUM(B2:B5)'], ['=SUM(A6:A9)', '=SUM(B6:B9)']]
2773
+ * ```
2774
+ */
2775
+ setFormulas(r) {
2776
+ return this.setValues(r.map((e) => e.map((t) => ({ f: t }))));
2777
+ }
2094
2778
  };
2095
- k = sn([
2096
- Y(3, u(p)),
2097
- Y(4, m),
2098
- Y(5, u(Gt))
2099
- ], k);
2100
- var on = Object.getOwnPropertyDescriptor, an = (s, e, t, n) => {
2101
- for (var r = n > 1 ? void 0 : n ? on(e, t) : e, o = s.length - 1, i; o >= 0; o--)
2102
- (i = s[o]) && (r = i(r) || r);
2103
- return r;
2104
- }, hn = (s, e) => (t, n) => e(t, n, s);
2105
- let j = class {
2106
- constructor(s, e, t, n) {
2107
- this._workbook = s, this._worksheet = e, this._selections = t, this._injector = n;
2779
+ m = _n([
2780
+ ne(3, u(x)),
2781
+ ne(4, l),
2782
+ ne(5, u(rn))
2783
+ ], m);
2784
+ var wn = Object.getOwnPropertyDescriptor, kn = (r, e, t, n) => {
2785
+ for (var s = n > 1 ? void 0 : n ? wn(e, t) : e, o = r.length - 1, i; o >= 0; o--)
2786
+ (i = r[o]) && (s = i(s) || s);
2787
+ return s;
2788
+ }, Sn = (r, e) => (t, n) => e(t, n, r);
2789
+ let Y = class {
2790
+ constructor(r, e, t, n) {
2791
+ this._workbook = r, this._worksheet = e, this._selections = t, this._injector = n;
2108
2792
  }
2109
2793
  /**
2110
2794
  * Represents the active selection in the sheet. Which means the selection contains the active cell.
@@ -2120,8 +2804,8 @@ let j = class {
2120
2804
  * ```
2121
2805
  */
2122
2806
  getActiveRange() {
2123
- const s = this._selections.find((e) => !!e.primary);
2124
- return s ? this._injector.createInstance(k, this._workbook, this._worksheet, s.range) : null;
2807
+ const r = this._selections.find((e) => !!e.primary);
2808
+ return r ? this._injector.createInstance(m, this._workbook, this._worksheet, r.range) : null;
2125
2809
  }
2126
2810
  /**
2127
2811
  * Represents the active selection list in the sheet.
@@ -2138,7 +2822,7 @@ let j = class {
2138
2822
  * ```
2139
2823
  */
2140
2824
  getActiveRangeList() {
2141
- return this._selections.map((s) => this._injector.createInstance(k, this._workbook, this._worksheet, s.range));
2825
+ return this._selections.map((r) => this._injector.createInstance(m, this._workbook, this._worksheet, r.range));
2142
2826
  }
2143
2827
  /**
2144
2828
  * Represents the current select cell in the sheet.
@@ -2157,8 +2841,8 @@ let j = class {
2157
2841
  * ```
2158
2842
  */
2159
2843
  getCurrentCell() {
2160
- const s = this._selections.find((e) => !!e.primary);
2161
- return s ? s.primary : null;
2844
+ const r = this._selections.find((e) => !!e.primary);
2845
+ return r ? r.primary : null;
2162
2846
  }
2163
2847
  /**
2164
2848
  * Returns the active sheet in the spreadsheet.
@@ -2173,8 +2857,8 @@ let j = class {
2173
2857
  * ```
2174
2858
  */
2175
2859
  getActiveSheet() {
2176
- const s = this._injector.createInstance(v, this._workbook);
2177
- return this._injector.createInstance(l, s, this._workbook, this._worksheet);
2860
+ const r = this._injector.createInstance(S, this._workbook);
2861
+ return this._injector.createInstance(k, r, this._workbook, this._worksheet);
2178
2862
  }
2179
2863
  /**
2180
2864
  * 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.
@@ -2198,13 +2882,13 @@ let j = class {
2198
2882
  * console.log(`actualRow: ${actualRow}, actualColumn: ${actualColumn}`); // actualRow: 10, actualColumn: 1
2199
2883
  * ```
2200
2884
  */
2201
- updatePrimaryCell(s) {
2202
- const e = this._injector.get(m);
2885
+ updatePrimaryCell(r) {
2886
+ const e = this._injector.get(l);
2203
2887
  let t = [], n = !1;
2204
2888
  for (const { range: o, style: i } of this._selections)
2205
- D.contains(o, s.getRange()) ? (t.push({
2889
+ N.contains(o, r.getRange()) ? (t.push({
2206
2890
  range: o,
2207
- primary: te(s.getRange(), this._worksheet),
2891
+ primary: $(r.getRange(), this._worksheet),
2208
2892
  style: i
2209
2893
  }), n = !0) : t.push({
2210
2894
  range: o,
@@ -2213,16 +2897,16 @@ let j = class {
2213
2897
  });
2214
2898
  n || (t = [
2215
2899
  {
2216
- range: s.getRange(),
2217
- primary: te(s.getRange(), this._worksheet)
2900
+ range: r.getRange(),
2901
+ primary: $(r.getRange(), this._worksheet)
2218
2902
  }
2219
2903
  ]);
2220
- const r = {
2904
+ const s = {
2221
2905
  unitId: this._workbook.getUnitId(),
2222
2906
  subUnitId: this._worksheet.getSheetId(),
2223
2907
  selections: t
2224
2908
  };
2225
- return e.syncExecuteCommand(Ve.id, r), new j(this._workbook, this._worksheet, t, this._injector);
2909
+ return e.syncExecuteCommand(me.id, s), new Y(this._workbook, this._worksheet, t, this._injector);
2226
2910
  }
2227
2911
  /**
2228
2912
  * Get the next primary cell in the specified direction. If the primary cell not exists in selections, return null.
@@ -2249,22 +2933,22 @@ let j = class {
2249
2933
  * console.log(nextCell2?.getA1Notation()); // A2
2250
2934
  * ```
2251
2935
  */
2252
- getNextDataRange(s) {
2936
+ getNextDataRange(r) {
2253
2937
  if (!this._selections.find((n) => !!n.primary))
2254
2938
  return null;
2255
- const t = vt(this._selections.concat(), s, this._worksheet);
2256
- return t ? this._injector.createInstance(k, this._workbook, this._worksheet, t) : null;
2939
+ const t = At(this._selections.concat(), r, this._worksheet);
2940
+ return t ? this._injector.createInstance(m, this._workbook, this._worksheet, t) : null;
2257
2941
  }
2258
2942
  };
2259
- j = an([
2260
- hn(3, u(p))
2261
- ], j);
2262
- var dn = Object.getOwnPropertyDescriptor, cn = (s, e, t, n) => {
2263
- for (var r = n > 1 ? void 0 : n ? dn(e, t) : e, o = s.length - 1, i; o >= 0; o--)
2264
- (i = s[o]) && (r = i(r) || r);
2265
- return r;
2266
- }, B = (s, e) => (t, n) => e(t, n, s);
2267
- let l = class extends he {
2943
+ Y = kn([
2944
+ Sn(3, u(x))
2945
+ ], Y);
2946
+ var Cn = Object.getOwnPropertyDescriptor, fn = (r, e, t, n) => {
2947
+ for (var s = n > 1 ? void 0 : n ? Cn(e, t) : e, o = r.length - 1, i; o >= 0; o--)
2948
+ (i = r[o]) && (s = i(s) || s);
2949
+ return s;
2950
+ }, z = (r, e) => (t, n) => e(t, n, r);
2951
+ let k = class extends le {
2268
2952
  /**
2269
2953
  * Creates a new worksheet facade instance
2270
2954
  * @param {FWorkbook} _fWorkbook - The facade workbook instance
@@ -2275,8 +2959,8 @@ let l = class extends he {
2275
2959
  * @param {ILogService} _logService - The log service
2276
2960
  * @param {ICommandService} _commandService - The command service
2277
2961
  */
2278
- constructor(e, t, n, r, o, i, a) {
2279
- super(r);
2962
+ constructor(e, t, n, s, o, i, a) {
2963
+ super(s);
2280
2964
  /**
2281
2965
  * Sets the active selection region for this sheet.
2282
2966
  * @param range - The range to set as the active selection
@@ -2287,8 +2971,8 @@ let l = class extends he {
2287
2971
  * fWorkSheet.setActiveSelection(fWorkSheet.getRange('A10:B10'));
2288
2972
  * ```
2289
2973
  */
2290
- I(this, "setActiveSelection", this.setActiveRange);
2291
- this._fWorkbook = e, this._workbook = t, this._worksheet = n, this._injector = r, this._selectionManagerService = o, this._logService = i, this._commandService = a;
2974
+ E(this, "setActiveSelection", this.setActiveRange);
2975
+ this._fWorkbook = e, this._workbook = t, this._worksheet = n, this._injector = s, this._selectionManagerService = o, this._logService = i, this._commandService = a;
2292
2976
  }
2293
2977
  /**
2294
2978
  * Get the worksheet instance.
@@ -2367,7 +3051,7 @@ let l = class extends he {
2367
3051
  */
2368
3052
  getSelection() {
2369
3053
  const e = this._selectionManagerService.getCurrentSelections();
2370
- return e ? this._injector.createInstance(j, this._workbook, this._worksheet, e) : null;
3054
+ return e ? this._injector.createInstance(Y, this._workbook, this._worksheet, e) : null;
2371
3055
  }
2372
3056
  // #region rows
2373
3057
  // #region default style
@@ -2436,7 +3120,7 @@ let l = class extends he {
2436
3120
  */
2437
3121
  setDefaultStyle(e) {
2438
3122
  const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId();
2439
- return this._commandService.syncExecuteCommand(ft.id, {
3123
+ return this._commandService.syncExecuteCommand(Dt.id, {
2440
3124
  unitId: t,
2441
3125
  subUnitId: n,
2442
3126
  defaultStyle: e
@@ -2457,16 +3141,16 @@ let l = class extends he {
2457
3141
  * ```
2458
3142
  */
2459
3143
  setColumnDefaultStyle(e, t) {
2460
- const n = this._workbook.getUnitId(), r = this._worksheet.getSheetId(), o = {
3144
+ const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), o = {
2461
3145
  unitId: n,
2462
- subUnitId: r,
3146
+ subUnitId: s,
2463
3147
  columnData: {
2464
3148
  [e]: {
2465
3149
  s: t
2466
3150
  }
2467
3151
  }
2468
3152
  };
2469
- return this._commandService.syncExecuteCommand(le.id, o), this;
3153
+ return this._commandService.syncExecuteCommand(fe.id, o), this;
2470
3154
  }
2471
3155
  /**
2472
3156
  * Set the default style of the worksheet column
@@ -2483,23 +3167,23 @@ let l = class extends he {
2483
3167
  * ```
2484
3168
  */
2485
3169
  setRowDefaultStyle(e, t) {
2486
- const n = this._workbook.getUnitId(), r = this._worksheet.getSheetId(), o = {
3170
+ const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), o = {
2487
3171
  unitId: n,
2488
- subUnitId: r,
3172
+ subUnitId: s,
2489
3173
  rowData: {
2490
3174
  [e]: {
2491
3175
  s: t
2492
3176
  }
2493
3177
  }
2494
3178
  };
2495
- return this._commandService.syncExecuteCommand(_e.id, o), this;
3179
+ return this._commandService.syncExecuteCommand(ve.id, o), this;
2496
3180
  }
2497
- getRange(e, t, n, r) {
3181
+ getRange(e, t, n, s) {
2498
3182
  let o, i;
2499
3183
  if (typeof e == "object")
2500
3184
  o = e, i = this._worksheet;
2501
3185
  else if (typeof e == "string") {
2502
- const { range: a, sheetName: h } = qt(e), d = h ? this._workbook.getSheetBySheetName(h) : this._worksheet;
3186
+ const { range: a, sheetName: h } = on(e), d = h ? this._workbook.getSheetBySheetName(h) : this._worksheet;
2503
3187
  if (!d)
2504
3188
  throw new Error("Range not found");
2505
3189
  i = d, o = {
@@ -2508,24 +3192,24 @@ let l = class extends he {
2508
3192
  sheetId: i.getSheetId(),
2509
3193
  // Use the current range instead of the future actual range to match Apps Script behavior.
2510
3194
  // Users can create the latest range in real time when needed.
2511
- rangeType: _.NORMAL,
2512
- startRow: a.rangeType === _.COLUMN ? 0 : a.startRow,
2513
- endRow: a.rangeType === _.COLUMN ? i.getMaxRows() - 1 : a.endRow,
2514
- startColumn: a.rangeType === _.ROW ? 0 : a.startColumn,
2515
- endColumn: a.rangeType === _.ROW ? i.getMaxColumns() - 1 : a.endColumn
3195
+ rangeType: w.NORMAL,
3196
+ startRow: a.rangeType === w.COLUMN ? 0 : a.startRow,
3197
+ endRow: a.rangeType === w.COLUMN ? i.getMaxRows() - 1 : a.endRow,
3198
+ startColumn: a.rangeType === w.ROW ? 0 : a.startColumn,
3199
+ endColumn: a.rangeType === w.ROW ? i.getMaxColumns() - 1 : a.endColumn
2516
3200
  };
2517
3201
  } else if (typeof e == "number" && t !== void 0)
2518
3202
  i = this._worksheet, o = {
2519
3203
  startRow: e,
2520
3204
  endRow: e + (n != null ? n : 1) - 1,
2521
3205
  startColumn: t,
2522
- endColumn: t + (r != null ? r : 1) - 1,
3206
+ endColumn: t + (s != null ? s : 1) - 1,
2523
3207
  unitId: this._workbook.getUnitId(),
2524
3208
  sheetId: this._worksheet.getSheetId()
2525
3209
  };
2526
3210
  else
2527
3211
  throw new Error("Invalid range specification");
2528
- return this._injector.createInstance(k, this._workbook, i, o);
3212
+ return this._injector.createInstance(m, this._workbook, i, o);
2529
3213
  }
2530
3214
  /**
2531
3215
  * Returns the current number of columns in the sheet, regardless of content.
@@ -2617,10 +3301,10 @@ let l = class extends he {
2617
3301
  * ```
2618
3302
  */
2619
3303
  insertRowsAfter(e, t) {
2620
- const n = this._workbook.getUnitId(), r = this._worksheet.getSheetId(), o = A.DOWN, i = e + 1, a = e + t, h = 0, d = this._worksheet.getColumnCount() - 1, c = W(this._worksheet, i, a, h, d, !0, e);
2621
- return this._commandService.syncExecuteCommand(ke.id, {
3304
+ const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), o = j.DOWN, i = e + 1, a = e + t, h = 0, d = this._worksheet.getColumnCount() - 1, c = L(this._worksheet, i, a, h, d, !0, e);
3305
+ return this._commandService.syncExecuteCommand(Ie.id, {
2622
3306
  unitId: n,
2623
- subUnitId: r,
3307
+ subUnitId: s,
2624
3308
  direction: o,
2625
3309
  range: {
2626
3310
  startRow: i,
@@ -2646,10 +3330,10 @@ let l = class extends he {
2646
3330
  * ```
2647
3331
  */
2648
3332
  insertRowsBefore(e, t) {
2649
- const n = this._workbook.getUnitId(), r = this._worksheet.getSheetId(), o = A.UP, i = e, a = e + t - 1, h = 0, d = this._worksheet.getColumnCount() - 1, c = W(this._worksheet, i, a, h, d, !0, e - 1);
2650
- return this._commandService.syncExecuteCommand(ke.id, {
3333
+ const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), o = j.UP, i = e, a = e + t - 1, h = 0, d = this._worksheet.getColumnCount() - 1, c = L(this._worksheet, i, a, h, d, !0, e - 1);
3334
+ return this._commandService.syncExecuteCommand(Ie.id, {
2651
3335
  unitId: n,
2652
- subUnitId: r,
3336
+ subUnitId: s,
2653
3337
  direction: o,
2654
3338
  range: {
2655
3339
  startRow: i,
@@ -2697,7 +3381,7 @@ let l = class extends he {
2697
3381
  startColumn: 0,
2698
3382
  endColumn: this._worksheet.getColumnCount() - 1
2699
3383
  };
2700
- return this._commandService.syncExecuteCommand(It.id, {
3384
+ return this._commandService.syncExecuteCommand(Wt.id, {
2701
3385
  range: n,
2702
3386
  unitId: this._workbook.getUnitId(),
2703
3387
  subUnitId: this._worksheet.getSheetId()
@@ -2720,15 +3404,15 @@ let l = class extends he {
2720
3404
  * ```
2721
3405
  */
2722
3406
  moveRows(e, t) {
2723
- const n = this._workbook.getUnitId(), r = this._worksheet.getSheetId(), o = q(e.getRange(), this._worksheet), i = o, a = {
3407
+ const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), o = ee(e.getRange(), this._worksheet), i = o, a = {
2724
3408
  startRow: t,
2725
3409
  endRow: t,
2726
3410
  startColumn: o.startColumn,
2727
3411
  endColumn: o.endColumn
2728
3412
  };
2729
- return this._commandService.syncExecuteCommand(Rt.id, {
3413
+ return this._commandService.syncExecuteCommand(Bt.id, {
2730
3414
  unitId: n,
2731
- subUnitId: r,
3415
+ subUnitId: s,
2732
3416
  range: o,
2733
3417
  fromRange: i,
2734
3418
  toRange: a
@@ -2750,11 +3434,11 @@ let l = class extends he {
2750
3434
  * ```
2751
3435
  */
2752
3436
  hideRow(e) {
2753
- const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), r = q(e.getRange(), this._worksheet);
2754
- return this._commandService.syncExecuteCommand(we.id, {
3437
+ const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), s = ee(e.getRange(), this._worksheet);
3438
+ return this._commandService.syncExecuteCommand(Re.id, {
2755
3439
  unitId: t,
2756
3440
  subUnitId: n,
2757
- ranges: [r]
3441
+ ranges: [s]
2758
3442
  }), this;
2759
3443
  }
2760
3444
  /**
@@ -2772,16 +3456,16 @@ let l = class extends he {
2772
3456
  * ```
2773
3457
  */
2774
3458
  hideRows(e, t = 1) {
2775
- const n = this._workbook.getUnitId(), r = this._worksheet.getSheetId(), o = {
3459
+ const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), o = {
2776
3460
  startRow: e,
2777
3461
  endRow: e + t - 1,
2778
3462
  startColumn: 0,
2779
3463
  endColumn: this._worksheet.getColumnCount() - 1,
2780
- rangeType: _.ROW
3464
+ rangeType: w.ROW
2781
3465
  };
2782
- return this._commandService.syncExecuteCommand(we.id, {
3466
+ return this._commandService.syncExecuteCommand(Re.id, {
2783
3467
  unitId: n,
2784
- subUnitId: r,
3468
+ subUnitId: s,
2785
3469
  ranges: [o]
2786
3470
  }), this;
2787
3471
  }
@@ -2801,17 +3485,17 @@ let l = class extends he {
2801
3485
  * ```
2802
3486
  */
2803
3487
  unhideRow(e) {
2804
- const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), r = q(e.getRange(), this._worksheet);
2805
- return this._commandService.syncExecuteCommand(Se.id, {
3488
+ const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), s = ee(e.getRange(), this._worksheet);
3489
+ return this._commandService.syncExecuteCommand(be.id, {
2806
3490
  unitId: t,
2807
3491
  subUnitId: n,
2808
- ranges: [r]
3492
+ ranges: [s]
2809
3493
  }), this;
2810
3494
  }
2811
3495
  /**
2812
3496
  * Scrolling sheet to make specific rows visible.
2813
3497
  * @param {number} rowIndex - The starting index of the rows
2814
- * @param {number} numRow - The number of rows
3498
+ * @param {number} numRows - The number of rows
2815
3499
  * @returns {FWorksheet} This worksheet instance for chaining
2816
3500
  * @example
2817
3501
  * ```typescript
@@ -2823,16 +3507,16 @@ let l = class extends he {
2823
3507
  * ```
2824
3508
  */
2825
3509
  showRows(e, t = 1) {
2826
- const n = this._workbook.getUnitId(), r = this._worksheet.getSheetId(), o = {
3510
+ const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), o = {
2827
3511
  startRow: e,
2828
3512
  endRow: e + t - 1,
2829
3513
  startColumn: 0,
2830
3514
  endColumn: this._worksheet.getColumnCount() - 1,
2831
- rangeType: _.ROW
3515
+ rangeType: w.ROW
2832
3516
  };
2833
- return this._commandService.syncExecuteCommand(Se.id, {
3517
+ return this._commandService.syncExecuteCommand(be.id, {
2834
3518
  unitId: n,
2835
- subUnitId: r,
3519
+ subUnitId: s,
2836
3520
  ranges: [o]
2837
3521
  }), this;
2838
3522
  }
@@ -2865,22 +3549,22 @@ let l = class extends he {
2865
3549
  * ```
2866
3550
  */
2867
3551
  autoFitRow(e, t = g.TRUE) {
2868
- const n = this._workbook.getUnitId(), r = this._worksheet.getSheetId(), o = [{
3552
+ const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), o = [{
2869
3553
  startRow: e,
2870
3554
  endRow: e,
2871
3555
  startColumn: 0,
2872
3556
  endColumn: this._worksheet.getColumnCount() - 1
2873
3557
  }];
2874
- return this._commandService.syncExecuteCommand(ee.id, {
3558
+ return this._commandService.syncExecuteCommand(ie.id, {
2875
3559
  unitId: this._workbook.getUnitId(),
2876
3560
  subUnitId: this._worksheet.getSheetId(),
2877
3561
  range: o[0],
2878
- value: J.WRAP
3562
+ value: G.WRAP
2879
3563
  }), this._commandService.syncExecuteCommand(
2880
- bt.id,
3564
+ Vt.id,
2881
3565
  {
2882
3566
  unitId: n,
2883
- subUnitId: r,
3567
+ subUnitId: s,
2884
3568
  ranges: o,
2885
3569
  autoHeightInfo: t
2886
3570
  }
@@ -2901,27 +3585,47 @@ let l = class extends he {
2901
3585
  */
2902
3586
  setRowHeights(e, t, n) {
2903
3587
  var d;
2904
- const r = this._workbook.getUnitId(), o = this._worksheet.getSheetId(), i = this._worksheet.getRowManager(), a = [], h = [];
3588
+ const s = this._workbook.getUnitId(), o = this._worksheet.getSheetId(), i = this._worksheet.getRowManager(), a = [], h = [];
2905
3589
  for (let c = e; c < e + t; c++) {
2906
- const z = ((d = i.getRow(c)) == null ? void 0 : d.ah) || this._worksheet.getConfig().defaultRowHeight, M = {
3590
+ const C = ((d = i.getRow(c)) == null ? void 0 : d.ah) || this._worksheet.getConfig().defaultRowHeight, _ = {
2907
3591
  startRow: c,
2908
3592
  endRow: c,
2909
3593
  startColumn: 0,
2910
3594
  endColumn: this._worksheet.getColumnCount() - 1
2911
3595
  };
2912
- n <= z ? a.push(M) : h.push(M);
3596
+ n <= C ? a.push(_) : h.push(_);
2913
3597
  }
2914
- return h.length > 0 && this._commandService.syncExecuteCommand(Ce.id, {
2915
- unitId: r,
3598
+ return h.length > 0 && this._commandService.syncExecuteCommand(pe.id, {
3599
+ unitId: s,
2916
3600
  subUnitId: o,
2917
3601
  ranges: h,
2918
3602
  value: n
2919
- }), a.length > 0 && this._commandService.syncExecuteCommand(ve.id, {
2920
- unitId: r,
3603
+ }), a.length > 0 && this._commandService.syncExecuteCommand(X.id, {
3604
+ unitId: s,
2921
3605
  subUnitId: o,
2922
3606
  ranges: a
2923
3607
  }), this;
2924
3608
  }
3609
+ /**
3610
+ * Gets the height in pixels of the given row.
3611
+ * @param {number} rowPosition - The position of the row to examine. index starts at 0.
3612
+ * @returns {number} The height in pixels of the given row.
3613
+ * @example
3614
+ * ```typescript
3615
+ * const fWorkbook = univerAPI.getActiveWorkbook();
3616
+ * const fWorksheet = fWorkbook.getActiveSheet();
3617
+ *
3618
+ * // Set the value of the cell A1 to 'Hello, Univer!', set the font size to 30 and font weight to bold
3619
+ * const fRange = fWorksheet.getRange('A1');
3620
+ * fRange.setValue('Hello, Univer!').setFontSize(30).setFontWeight('bold');
3621
+ *
3622
+ * // Get the height of the first row
3623
+ * console.log(fWorksheet.getRowHeight(0));
3624
+ * ```
3625
+ */
3626
+ getRowHeight(e) {
3627
+ return this._worksheet.getRowHeight(e);
3628
+ }
2925
3629
  /**
2926
3630
  * Sets the height of the given rows to auto.
2927
3631
  * @param {number} startRow - The starting row position to change
@@ -2934,7 +3638,7 @@ let l = class extends he {
2934
3638
  * ```
2935
3639
  */
2936
3640
  setRowAutoHeight(e, t) {
2937
- const n = this._workbook.getUnitId(), r = this._worksheet.getSheetId(), o = [
3641
+ const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), o = [
2938
3642
  {
2939
3643
  startRow: e,
2940
3644
  endRow: e + t - 1,
@@ -2942,12 +3646,34 @@ let l = class extends he {
2942
3646
  endColumn: this._worksheet.getColumnCount() - 1
2943
3647
  }
2944
3648
  ];
2945
- return this._commandService.syncExecuteCommand(ve.id, {
3649
+ return this._commandService.syncExecuteCommand(X.id, {
2946
3650
  unitId: n,
2947
- subUnitId: r,
3651
+ subUnitId: s,
2948
3652
  ranges: o
2949
3653
  }), this;
2950
3654
  }
3655
+ /**
3656
+ * Sets the height of the given ranges to auto.
3657
+ * @param {IRange[]} ranges - The ranges to change
3658
+ * @returns {FWorksheet} This worksheet instance for chaining
3659
+ * @example
3660
+ * ```typescript
3661
+ * const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet();
3662
+ * const ranges = [
3663
+ * { startRow: 1, endRow: 10, startColumn: 0, endColumn: 10 },
3664
+ * { startRow: 11, endRow: 20, startColumn: 0, endColumn: 10 },
3665
+ * ]
3666
+ * fWorksheet.setRangesAutoHeight(ranges);
3667
+ * ```
3668
+ */
3669
+ setRangesAutoHeight(e) {
3670
+ const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId();
3671
+ return this._commandService.syncExecuteCommand(X.id, {
3672
+ unitId: t,
3673
+ subUnitId: n,
3674
+ ranges: e
3675
+ }), this;
3676
+ }
2951
3677
  /**
2952
3678
  * 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.
2953
3679
  * @param {number} startRow - The starting row position to change
@@ -2961,7 +3687,7 @@ let l = class extends he {
2961
3687
  * ```
2962
3688
  */
2963
3689
  setRowHeightsForced(e, t, n) {
2964
- const r = this._workbook.getUnitId(), o = this._worksheet.getSheetId(), i = [
3690
+ const s = this._workbook.getUnitId(), o = this._worksheet.getSheetId(), i = [
2965
3691
  {
2966
3692
  startRow: e,
2967
3693
  endRow: e + t - 1,
@@ -2969,8 +3695,8 @@ let l = class extends he {
2969
3695
  endColumn: this._worksheet.getColumnCount() - 1
2970
3696
  }
2971
3697
  ];
2972
- return this._commandService.syncExecuteCommand(Ce.id, {
2973
- unitId: r,
3698
+ return this._commandService.syncExecuteCommand(pe.id, {
3699
+ unitId: s,
2974
3700
  subUnitId: o,
2975
3701
  ranges: i,
2976
3702
  value: n
@@ -2988,17 +3714,17 @@ let l = class extends he {
2988
3714
  * ```
2989
3715
  */
2990
3716
  setRowCustom(e) {
2991
- const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), r = {};
3717
+ const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), s = {};
2992
3718
  for (const [i, a] of Object.entries(e))
2993
- r[Number(i)] = {
3719
+ s[Number(i)] = {
2994
3720
  custom: a
2995
3721
  };
2996
3722
  const o = {
2997
3723
  unitId: t,
2998
3724
  subUnitId: n,
2999
- rowData: r
3725
+ rowData: s
3000
3726
  };
3001
- return this._commandService.syncExecuteCommand(_e.id, o), this;
3727
+ return this._commandService.syncExecuteCommand(ve.id, o), this;
3002
3728
  }
3003
3729
  // #region Column
3004
3730
  /**
@@ -3065,10 +3791,10 @@ let l = class extends he {
3065
3791
  * ```
3066
3792
  */
3067
3793
  insertColumnsAfter(e, t) {
3068
- const n = this._workbook.getUnitId(), r = this._worksheet.getSheetId(), o = A.RIGHT, i = 0, a = this._worksheet.getRowCount() - 1, h = e + 1, d = e + t, c = W(this._worksheet, i, a, h, d, !1, e);
3069
- return this._commandService.syncExecuteCommand(fe.id, {
3794
+ const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), o = j.RIGHT, i = 0, a = this._worksheet.getRowCount() - 1, h = e + 1, d = e + t, c = L(this._worksheet, i, a, h, d, !1, e);
3795
+ return this._commandService.syncExecuteCommand(Ee.id, {
3070
3796
  unitId: n,
3071
- subUnitId: r,
3797
+ subUnitId: s,
3072
3798
  direction: o,
3073
3799
  range: {
3074
3800
  startRow: i,
@@ -3094,10 +3820,10 @@ let l = class extends he {
3094
3820
  * ```
3095
3821
  */
3096
3822
  insertColumnsBefore(e, t) {
3097
- const n = this._workbook.getUnitId(), r = this._worksheet.getSheetId(), o = A.LEFT, i = 0, a = this._worksheet.getRowCount() - 1, h = e, d = e + t - 1, c = W(this._worksheet, i, a, h, d, !1, e - 1);
3098
- return this._commandService.syncExecuteCommand(fe.id, {
3823
+ const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), o = j.LEFT, i = 0, a = this._worksheet.getRowCount() - 1, h = e, d = e + t - 1, c = L(this._worksheet, i, a, h, d, !1, e - 1);
3824
+ return this._commandService.syncExecuteCommand(Ee.id, {
3099
3825
  unitId: n,
3100
- subUnitId: r,
3826
+ subUnitId: s,
3101
3827
  direction: o,
3102
3828
  range: {
3103
3829
  startRow: i,
@@ -3145,7 +3871,7 @@ let l = class extends he {
3145
3871
  startColumn: e,
3146
3872
  endColumn: e + t - 1
3147
3873
  };
3148
- return this._commandService.syncExecuteCommand(pt.id, {
3874
+ return this._commandService.syncExecuteCommand(Ft.id, {
3149
3875
  range: n,
3150
3876
  unitId: this._workbook.getUnitId(),
3151
3877
  subUnitId: this._worksheet.getSheetId()
@@ -3168,15 +3894,15 @@ let l = class extends he {
3168
3894
  * ```
3169
3895
  */
3170
3896
  moveColumns(e, t) {
3171
- const n = this._workbook.getUnitId(), r = this._worksheet.getSheetId(), o = K(e.getRange(), this._worksheet), i = o, a = {
3897
+ const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), o = te(e.getRange(), this._worksheet), i = o, a = {
3172
3898
  startRow: 0,
3173
3899
  endRow: this._worksheet.getRowCount() - 1,
3174
3900
  startColumn: t,
3175
3901
  endColumn: t
3176
3902
  };
3177
- return this._commandService.syncExecuteCommand(Et.id, {
3903
+ return this._commandService.syncExecuteCommand(Ht.id, {
3178
3904
  unitId: n,
3179
- subUnitId: r,
3905
+ subUnitId: s,
3180
3906
  range: o,
3181
3907
  fromRange: i,
3182
3908
  toRange: a
@@ -3198,11 +3924,11 @@ let l = class extends he {
3198
3924
  * ```
3199
3925
  */
3200
3926
  hideColumn(e) {
3201
- const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), r = K(e.getRange(), this._worksheet);
3202
- return this._commandService.syncExecuteCommand(Ie.id, {
3927
+ const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), s = te(e.getRange(), this._worksheet);
3928
+ return this._commandService.syncExecuteCommand(ye.id, {
3203
3929
  unitId: t,
3204
3930
  subUnitId: n,
3205
- ranges: [r]
3931
+ ranges: [s]
3206
3932
  }), this;
3207
3933
  }
3208
3934
  /**
@@ -3220,16 +3946,16 @@ let l = class extends he {
3220
3946
  * ```
3221
3947
  */
3222
3948
  hideColumns(e, t = 1) {
3223
- const n = this._workbook.getUnitId(), r = this._worksheet.getSheetId(), o = {
3949
+ const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), o = {
3224
3950
  startRow: 0,
3225
3951
  endRow: this._worksheet.getRowCount() - 1,
3226
3952
  startColumn: e,
3227
3953
  endColumn: e + t - 1,
3228
- rangeType: _.COLUMN
3954
+ rangeType: w.COLUMN
3229
3955
  };
3230
- return this._commandService.syncExecuteCommand(Ie.id, {
3956
+ return this._commandService.syncExecuteCommand(ye.id, {
3231
3957
  unitId: n,
3232
- subUnitId: r,
3958
+ subUnitId: s,
3233
3959
  ranges: [o]
3234
3960
  }), this;
3235
3961
  }
@@ -3249,17 +3975,17 @@ let l = class extends he {
3249
3975
  * ```
3250
3976
  */
3251
3977
  unhideColumn(e) {
3252
- const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), r = K(e.getRange(), this._worksheet);
3253
- return this._commandService.syncExecuteCommand(Re.id, {
3978
+ const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), s = te(e.getRange(), this._worksheet);
3979
+ return this._commandService.syncExecuteCommand(Ue.id, {
3254
3980
  unitId: t,
3255
3981
  subUnitId: n,
3256
- ranges: [r]
3982
+ ranges: [s]
3257
3983
  }), this;
3258
3984
  }
3259
3985
  /**
3260
3986
  * Show one or more consecutive columns starting at the given index. Use 0-index for this method
3261
3987
  * @param {number} columnIndex - The starting index of the columns to unhide
3262
- * @param {number} numColumn - The number of columns to unhide
3988
+ * @param {number} numColumns - The number of columns to unhide
3263
3989
  * @returns {FWorksheet} This sheet, for chaining
3264
3990
  * @example
3265
3991
  * ```typescript
@@ -3271,16 +3997,16 @@ let l = class extends he {
3271
3997
  * ```
3272
3998
  */
3273
3999
  showColumns(e, t = 1) {
3274
- const n = this._workbook.getUnitId(), r = this._worksheet.getSheetId(), o = {
4000
+ const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), o = {
3275
4001
  startRow: 0,
3276
4002
  endRow: this._worksheet.getRowCount() - 1,
3277
4003
  startColumn: e,
3278
4004
  endColumn: e + t - 1,
3279
- rangeType: _.COLUMN
4005
+ rangeType: w.COLUMN
3280
4006
  };
3281
- return this._commandService.syncExecuteCommand(Re.id, {
4007
+ return this._commandService.syncExecuteCommand(Ue.id, {
3282
4008
  unitId: n,
3283
- subUnitId: r,
4009
+ subUnitId: s,
3284
4010
  ranges: [o]
3285
4011
  }), this;
3286
4012
  }
@@ -3313,7 +4039,7 @@ let l = class extends he {
3313
4039
  * ```
3314
4040
  */
3315
4041
  setColumnWidths(e, t, n) {
3316
- const r = this._workbook.getUnitId(), o = this._worksheet.getSheetId(), i = [
4042
+ const s = this._workbook.getUnitId(), o = this._worksheet.getSheetId(), i = [
3317
4043
  {
3318
4044
  startColumn: e,
3319
4045
  endColumn: e + t - 1,
@@ -3321,13 +4047,36 @@ let l = class extends he {
3321
4047
  endRow: this._worksheet.getRowCount() - 1
3322
4048
  }
3323
4049
  ];
3324
- return this._commandService.syncExecuteCommand(yt.id, {
3325
- unitId: r,
4050
+ return this._commandService.syncExecuteCommand(Ot.id, {
4051
+ unitId: s,
3326
4052
  subUnitId: o,
3327
4053
  ranges: i,
3328
4054
  value: n
3329
4055
  }), this;
3330
4056
  }
4057
+ /**
4058
+ * Gets the width in pixels of the given column.
4059
+ * @param {number} columnPosition - The position of the column to examine. index starts at 0.
4060
+ * @returns {number} The width of the column in pixels
4061
+ * @example
4062
+ * ```typescript
4063
+ * const fWorkbook = univerAPI.getActiveWorkbook();
4064
+ * const fWorksheet = fWorkbook.getActiveSheet();
4065
+ *
4066
+ * // Set the long text value in cell A1
4067
+ * const fRange = fWorksheet.getRange('A1');
4068
+ * fRange.setValue('Whenever it is a damp, drizzly November in my soul...');
4069
+ *
4070
+ * // Set the column A to a width which fits the text
4071
+ * fWorksheet.autoResizeColumn(0);
4072
+ *
4073
+ * // Get the width of the column A
4074
+ * console.log(fWorksheet.getColumnWidth(0));
4075
+ * ```
4076
+ */
4077
+ getColumnWidth(e) {
4078
+ return this._worksheet.getColumnWidth(e);
4079
+ }
3331
4080
  // #endregion
3332
4081
  /**
3333
4082
  * Set custom properties for given columns.
@@ -3340,17 +4089,17 @@ let l = class extends he {
3340
4089
  * ```
3341
4090
  */
3342
4091
  setColumnCustom(e) {
3343
- const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), r = {};
4092
+ const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), s = {};
3344
4093
  for (const [i, a] of Object.entries(e))
3345
- r[Number(i)] = {
4094
+ s[Number(i)] = {
3346
4095
  custom: a
3347
4096
  };
3348
4097
  const o = {
3349
4098
  unitId: t,
3350
4099
  subUnitId: n,
3351
- columnData: r
4100
+ columnData: s
3352
4101
  };
3353
- return this._commandService.syncExecuteCommand(le.id, o), this;
4102
+ return this._commandService.syncExecuteCommand(fe.id, o), this;
3354
4103
  }
3355
4104
  // #region merge cells
3356
4105
  /**
@@ -3368,7 +4117,7 @@ let l = class extends he {
3368
4117
  * ```
3369
4118
  */
3370
4119
  getMergeData() {
3371
- return this._worksheet.getMergeData().map((e) => this._injector.createInstance(k, this._workbook, this._worksheet, e));
4120
+ return this._worksheet.getMergeData().map((e) => this._injector.createInstance(m, this._workbook, this._worksheet, e));
3372
4121
  }
3373
4122
  /**
3374
4123
  * Get all merged cells in the current sheet
@@ -3385,7 +4134,7 @@ let l = class extends he {
3385
4134
  * ```
3386
4135
  */
3387
4136
  getMergedRanges() {
3388
- return this._worksheet.getSnapshot().mergeData.map((t) => this._injector.createInstance(k, this._workbook, this._worksheet, t));
4137
+ return this._worksheet.getSnapshot().mergeData.map((t) => this._injector.createInstance(m, this._workbook, this._worksheet, t));
3389
4138
  }
3390
4139
  /**
3391
4140
  * Get the merged cell data of the specified row and column.
@@ -3402,9 +4151,9 @@ let l = class extends he {
3402
4151
  * ```
3403
4152
  */
3404
4153
  getCellMergeData(e, t) {
3405
- const r = this._worksheet.getMergedCell(e, t);
3406
- if (r)
3407
- return this._injector.createInstance(k, this._workbook, this._worksheet, r);
4154
+ const s = this._worksheet.getMergedCell(e, t);
4155
+ if (s)
4156
+ return this._injector.createInstance(m, this._workbook, this._worksheet, s);
3408
4157
  }
3409
4158
  // #endregion
3410
4159
  /**
@@ -3439,6 +4188,18 @@ let l = class extends he {
3439
4188
  throw new Error("Specified range must be part of the sheet.");
3440
4189
  return this._fWorkbook.setActiveRange(e), this;
3441
4190
  }
4191
+ /**
4192
+ * Returns the active cell in this sheet.
4193
+ * @returns {FRange | null} The active cell
4194
+ * @example
4195
+ * ```typescript
4196
+ * const fWorkSheet = univerAPI.getActiveWorkbook().getActiveSheet();
4197
+ * console.log(fWorkSheet.getActiveCell().getA1Notation());
4198
+ * ```
4199
+ */
4200
+ getActiveCell() {
4201
+ return this._fWorkbook.getActiveCell();
4202
+ }
3442
4203
  /**
3443
4204
  * Sets the frozen state of the current sheet.
3444
4205
  * @param {IFreeze} freeze - the scrolling viewport start range and count of freezed rows and columns.
@@ -3458,7 +4219,7 @@ let l = class extends he {
3458
4219
  * ```
3459
4220
  */
3460
4221
  setFreeze(e) {
3461
- return this._logService.warn("setFreeze is deprecated, use setFrozenRows and setFrozenColumns instead"), this._commandService.syncExecuteCommand($.id, {
4222
+ return this._logService.warn("setFreeze is deprecated, use setFrozenRows and setFrozenColumns instead"), this._commandService.syncExecuteCommand(Z.id, {
3462
4223
  ...e,
3463
4224
  unitId: this._workbook.getUnitId(),
3464
4225
  subUnitId: this.getSheetId()
@@ -3475,7 +4236,7 @@ let l = class extends he {
3475
4236
  * ```
3476
4237
  */
3477
4238
  cancelFreeze() {
3478
- return this._commandService.syncExecuteCommand(Ut.id, {
4239
+ return this._commandService.syncExecuteCommand(jt.id, {
3479
4240
  unitId: this._workbook.getUnitId(),
3480
4241
  subUnitId: this.getSheetId()
3481
4242
  }), this;
@@ -3504,10 +4265,10 @@ let l = class extends he {
3504
4265
  xSplit: n
3505
4266
  });
3506
4267
  } else if (arguments.length === 2) {
3507
- let [n = 0, r = 0] = e;
3508
- n > r && ([n, r] = [r, n]), this._commandService.syncExecuteCommand($.id, {
3509
- startColumn: r + 1,
3510
- xSplit: r - n + 1,
4268
+ let [n = 0, s = 0] = e;
4269
+ n > s && ([n, s] = [s, n]), this._commandService.syncExecuteCommand(Z.id, {
4270
+ startColumn: s + 1,
4271
+ xSplit: s - n + 1,
3511
4272
  startRow: t.startRow,
3512
4273
  ySplit: t.ySplit,
3513
4274
  unitId: this._workbook.getUnitId(),
@@ -3526,10 +4287,10 @@ let l = class extends he {
3526
4287
  ySplit: n
3527
4288
  });
3528
4289
  } else if (arguments.length === 2) {
3529
- let [n = 0, r = 0] = e;
3530
- n > r && ([n, r] = [r, n]), this._commandService.syncExecuteCommand($.id, {
3531
- startRow: r + 1,
3532
- ySplit: r - n + 1,
4290
+ let [n = 0, s = 0] = e;
4291
+ n > s && ([n, s] = [s, n]), this._commandService.syncExecuteCommand(Z.id, {
4292
+ startRow: s + 1,
4293
+ ySplit: s - n + 1,
3533
4294
  startColumn: t.startColumn,
3534
4295
  xSplit: t.xSplit,
3535
4296
  unitId: this._workbook.getUnitId(),
@@ -3631,7 +4392,7 @@ let l = class extends he {
3631
4392
  * ```
3632
4393
  */
3633
4394
  setHiddenGridlines(e) {
3634
- return this._commandService.syncExecuteCommand(ne.id, {
4395
+ return this._commandService.syncExecuteCommand(ae.id, {
3635
4396
  unitId: this._workbook.getUnitId(),
3636
4397
  subUnitId: this._worksheet.getSheetId(),
3637
4398
  showGridlines: e ? g.FALSE : g.TRUE
@@ -3649,7 +4410,7 @@ let l = class extends he {
3649
4410
  * ```
3650
4411
  */
3651
4412
  setGridLinesColor(e) {
3652
- return this._commandService.syncExecuteCommand(re.id, {
4413
+ return this._commandService.syncExecuteCommand(he.id, {
3653
4414
  unitId: this._workbook.getUnitId(),
3654
4415
  subUnitId: this._worksheet.getSheetId(),
3655
4416
  color: e
@@ -3682,7 +4443,7 @@ let l = class extends he {
3682
4443
  * ```
3683
4444
  */
3684
4445
  setTabColor(e) {
3685
- return this._commandService.syncExecuteCommand(Pt.id, {
4446
+ return this._commandService.syncExecuteCommand(Lt.id, {
3686
4447
  unitId: this._workbook.getUnitId(),
3687
4448
  subUnitId: this._worksheet.getSheetId(),
3688
4449
  value: e
@@ -3708,10 +4469,10 @@ let l = class extends he {
3708
4469
  * @deprecated use `univerAPI.addEvent(univerAPI.Event.SheetValueChanged, (params) => {})` instead
3709
4470
  */
3710
4471
  onCellDataChange(e) {
3711
- return this._injector.get(m).onCommandExecuted((n) => {
3712
- if (n.id === be.id) {
3713
- const r = n.params;
3714
- r.unitId === this._workbook.getUnitId() && r.subUnitId === this._worksheet.getSheetId() && r.cellValue && e(new F(r.cellValue));
4472
+ return this._injector.get(l).onCommandExecuted((n) => {
4473
+ if (n.id === xe.id) {
4474
+ const s = n.params;
4475
+ s.unitId === this._workbook.getUnitId() && s.subUnitId === this._worksheet.getSheetId() && s.cellValue && e(new V(s.cellValue));
3715
4476
  }
3716
4477
  });
3717
4478
  }
@@ -3720,10 +4481,10 @@ let l = class extends he {
3720
4481
  * @deprecated use `univerAPI.addEvent(univerAPI.Event.SheetValueChanged, (params) => {})` instead
3721
4482
  */
3722
4483
  onBeforeCellDataChange(e) {
3723
- return this._injector.get(m).beforeCommandExecuted((n) => {
3724
- if (n.id === be.id) {
3725
- const r = n.params;
3726
- r.unitId === this._workbook.getUnitId() && r.subUnitId === this._worksheet.getSheetId() && r.cellValue && e(new F(r.cellValue));
4484
+ return this._injector.get(l).beforeCommandExecuted((n) => {
4485
+ if (n.id === xe.id) {
4486
+ const s = n.params;
4487
+ s.unitId === this._workbook.getUnitId() && s.subUnitId === this._worksheet.getSheetId() && s.cellValue && e(new V(s.cellValue));
3727
4488
  }
3728
4489
  });
3729
4490
  }
@@ -3739,10 +4500,10 @@ let l = class extends he {
3739
4500
  * ```
3740
4501
  */
3741
4502
  hideSheet() {
3742
- const e = this._injector.get(m);
4503
+ const e = this._injector.get(l);
3743
4504
  if (this._workbook.getSheets().filter((o) => o.isSheetHidden() !== g.TRUE).length <= 1)
3744
4505
  throw new Error("Cannot hide the only visible sheet");
3745
- return e.syncExecuteCommand(xt.id, {
4506
+ return e.syncExecuteCommand(zt.id, {
3746
4507
  unitId: this._workbook.getUnitId(),
3747
4508
  subUnitId: this._worksheet.getSheetId()
3748
4509
  }), this;
@@ -3759,7 +4520,7 @@ let l = class extends he {
3759
4520
  * ```
3760
4521
  */
3761
4522
  showSheet() {
3762
- return this._injector.get(m).syncExecuteCommand(Nt.id, {
4523
+ return this._injector.get(l).syncExecuteCommand(Gt.id, {
3763
4524
  unitId: this._workbook.getUnitId(),
3764
4525
  subUnitId: this._worksheet.getSheetId()
3765
4526
  }), this;
@@ -3791,7 +4552,7 @@ let l = class extends he {
3791
4552
  * ```
3792
4553
  */
3793
4554
  setName(e) {
3794
- return this._commandService.syncExecuteCommand(se.id, {
4555
+ return this._commandService.syncExecuteCommand(de.id, {
3795
4556
  unitId: this._workbook.getUnitId(),
3796
4557
  subUnitId: this._worksheet.getSheetId(),
3797
4558
  name: e
@@ -3847,13 +4608,13 @@ let l = class extends he {
3847
4608
  return this.clearContents();
3848
4609
  if (e && e.formatOnly && !e.contentsOnly)
3849
4610
  return this.clearFormats();
3850
- const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), r = this._injector.get(m), o = {
4611
+ const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), s = this._injector.get(l), o = {
3851
4612
  startRow: 0,
3852
4613
  endRow: this._worksheet.getRowCount() - 1,
3853
4614
  startColumn: 0,
3854
4615
  endColumn: this._worksheet.getColumnCount() - 1
3855
4616
  };
3856
- return r.syncExecuteCommand(Tt.id, {
4617
+ return s.syncExecuteCommand(Ke.id, {
3857
4618
  unitId: t,
3858
4619
  subUnitId: n,
3859
4620
  ranges: [o],
@@ -3872,16 +4633,16 @@ let l = class extends he {
3872
4633
  * ```
3873
4634
  */
3874
4635
  clearContents() {
3875
- const e = this._workbook.getUnitId(), t = this._worksheet.getSheetId(), n = this._injector.get(m), r = {
4636
+ const e = this._workbook.getUnitId(), t = this._worksheet.getSheetId(), n = this._injector.get(l), s = {
3876
4637
  startRow: 0,
3877
4638
  endRow: this._worksheet.getRowCount() - 1,
3878
4639
  startColumn: 0,
3879
4640
  endColumn: this._worksheet.getColumnCount() - 1
3880
4641
  };
3881
- return n.syncExecuteCommand(Dt.id, {
4642
+ return n.syncExecuteCommand(Ye.id, {
3882
4643
  unitId: e,
3883
4644
  subUnitId: t,
3884
- ranges: [r]
4645
+ ranges: [s]
3885
4646
  }), this;
3886
4647
  }
3887
4648
  /**
@@ -3896,16 +4657,16 @@ let l = class extends he {
3896
4657
  * ```
3897
4658
  */
3898
4659
  clearFormats() {
3899
- const e = this._workbook.getUnitId(), t = this._worksheet.getSheetId(), n = this._injector.get(m), r = {
4660
+ const e = this._workbook.getUnitId(), t = this._worksheet.getSheetId(), n = this._injector.get(l), s = {
3900
4661
  startRow: 0,
3901
4662
  endRow: this._worksheet.getRowCount() - 1,
3902
4663
  startColumn: 0,
3903
4664
  endColumn: this._worksheet.getColumnCount() - 1
3904
4665
  };
3905
- return n.syncExecuteCommand(Mt.id, {
4666
+ return n.syncExecuteCommand(Je.id, {
3906
4667
  unitId: e,
3907
4668
  subUnitId: t,
3908
- ranges: [r]
4669
+ ranges: [s]
3909
4670
  }), this;
3910
4671
  }
3911
4672
  /**
@@ -3987,7 +4748,7 @@ let l = class extends he {
3987
4748
  * ```
3988
4749
  */
3989
4750
  equalTo(e) {
3990
- return e instanceof l ? this._worksheet.getSheetId() === e.getSheetId() && this._workbook.getUnitId() === e.getWorkbook().getUnitId() : !1;
4751
+ return e instanceof k ? this._worksheet.getSheetId() === e.getSheetId() && this._workbook.getUnitId() === e.getWorkbook().getUnitId() : !1;
3991
4752
  }
3992
4753
  /**
3993
4754
  * Insert a defined name for worksheet.
@@ -4001,8 +4762,8 @@ let l = class extends he {
4001
4762
  * ```
4002
4763
  */
4003
4764
  insertDefinedName(e, t) {
4004
- const r = this._injector.createInstance(L).setName(e).setRef(t).build();
4005
- r.localSheetId = this.getSheetId(), this._fWorkbook.insertDefinedNameBuilder(r);
4765
+ const s = this._injector.createInstance(J).setName(e).setRef(t).build();
4766
+ s.localSheetId = this.getSheetId(), this._fWorkbook.insertDefinedNameBuilder(s);
4006
4767
  }
4007
4768
  /**
4008
4769
  * Get all the defined names in the worksheet.
@@ -4092,23 +4853,50 @@ let l = class extends he {
4092
4853
  getColumnCustomMetadata(e) {
4093
4854
  return this._worksheet.getColumnManager().getCustomMetadata(e);
4094
4855
  }
4856
+ /**
4857
+ * Appends a row to the bottom of the current data region in the sheet. If a cell's content begins with =, it's interpreted as a formula.
4858
+ * @param {CellValue[]} rowContents - An array of values for the new row.
4859
+ * @returns {FWorksheet} Returns the current worksheet instance for method chaining.
4860
+ * @example
4861
+ * ```ts
4862
+ * // Appends a new row with 4 columns to the bottom of the current
4863
+ * // data region in the sheet containing the values in the array.
4864
+ * const fWorkbook = univerAPI.getActiveWorkbook();
4865
+ * const fWorkSheet = fWorkbook.getActiveSheet();
4866
+ * fWorkSheet.appendRow([1, 'Hello Univer', true, '=A1']);
4867
+ * ```
4868
+ */
4869
+ appendRow(e) {
4870
+ const t = this._worksheet.getCellMatrix().hasValue(), n = this._worksheet.getLastRowWithContent(), s = this._worksheet.getRowCount(), o = this._worksheet.getColumnCount(), i = t ? n + 1 : n, a = new V();
4871
+ for (let h = 0; h < e.length; h++)
4872
+ a.setValue(i, h, O(e[h]));
4873
+ return this._commandService.syncExecuteCommand($t.id, {
4874
+ unitId: this._workbook.getUnitId(),
4875
+ subUnitId: this._worksheet.getSheetId(),
4876
+ cellValue: a.getMatrix(),
4877
+ insertRowNums: i > s - 1 ? 1 : 0,
4878
+ insertColumnNums: e.length > o ? e.length - o : 0,
4879
+ maxRows: s,
4880
+ maxColumns: o
4881
+ }), this;
4882
+ }
4095
4883
  };
4096
- l = cn([
4097
- B(3, u(p)),
4098
- B(4, u(je)),
4099
- B(5, u(De)),
4100
- B(6, m)
4101
- ], l);
4102
- var un = Object.getOwnPropertyDescriptor, gn = (s, e, t, n) => {
4103
- for (var r = n > 1 ? void 0 : n ? un(e, t) : e, o = s.length - 1, i; o >= 0; o--)
4104
- (i = s[o]) && (r = i(r) || r);
4105
- return r;
4106
- }, C = (s, e) => (t, n) => e(t, n, s);
4107
- let v = class extends he {
4108
- constructor(e, t, n, r, o, i, a, h, d, c) {
4884
+ k = fn([
4885
+ z(3, u(x)),
4886
+ z(4, u(Qe)),
4887
+ z(5, u(He)),
4888
+ z(6, l)
4889
+ ], k);
4890
+ var vn = Object.getOwnPropertyDescriptor, In = (r, e, t, n) => {
4891
+ for (var s = n > 1 ? void 0 : n ? vn(e, t) : e, o = r.length - 1, i; o >= 0; o--)
4892
+ (i = r[o]) && (s = i(s) || s);
4893
+ return s;
4894
+ }, R = (r, e) => (t, n) => e(t, n, r);
4895
+ let S = class extends le {
4896
+ constructor(e, t, n, s, o, i, a, h, d, c) {
4109
4897
  super(t);
4110
- I(this, "id");
4111
- 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 = d, this._definedNamesService = c, this.id = this._workbook.getUnitId();
4898
+ E(this, "id");
4899
+ this._workbook = e, this._injector = t, this._resourceLoaderService = n, this._selectionManagerService = s, this._univerInstanceService = o, this._commandService = i, this._permissionService = a, this._logService = h, this._localeService = d, this._definedNamesService = c, this.id = this._workbook.getUnitId();
4112
4900
  }
4113
4901
  /**
4114
4902
  * Get the Workbook instance.
@@ -4206,7 +4994,7 @@ let v = class extends he {
4206
4994
  */
4207
4995
  getActiveSheet() {
4208
4996
  const e = this._workbook.getActiveSheet();
4209
- return this._injector.createInstance(l, this, this._workbook, e);
4997
+ return this._injector.createInstance(k, this, this._workbook, e);
4210
4998
  }
4211
4999
  /**
4212
5000
  * Gets all the worksheets in this workbook
@@ -4220,7 +5008,7 @@ let v = class extends he {
4220
5008
  * ```
4221
5009
  */
4222
5010
  getSheets() {
4223
- return this._workbook.getSheets().map((e) => this._injector.createInstance(l, this, this._workbook, e));
5011
+ return this._workbook.getSheets().map((e) => this._injector.createInstance(k, this, this._workbook, e));
4224
5012
  }
4225
5013
  /**
4226
5014
  * Create a new worksheet and returns a handle to it.
@@ -4237,19 +5025,19 @@ let v = class extends he {
4237
5025
  * ```
4238
5026
  */
4239
5027
  create(e, t, n) {
4240
- const r = Qe({});
4241
- r.rowCount = t, r.columnCount = n, r.name = e, r.id = e.toLowerCase().replace(/ /g, "-"), this._commandService.syncExecuteCommand(N.id, {
5028
+ const s = it({});
5029
+ s.rowCount = t, s.columnCount = n, s.name = e, s.id = e.toLowerCase().replace(/ /g, "-"), this._commandService.syncExecuteCommand(F.id, {
4242
5030
  unitId: this.id,
4243
5031
  index: this._workbook.getSheets().length,
4244
- sheet: r
4245
- }), this._commandService.syncExecuteCommand(T.id, {
5032
+ sheet: s
5033
+ }), this._commandService.syncExecuteCommand(H.id, {
4246
5034
  unitId: this.id,
4247
5035
  subUnitId: this._workbook.getSheets()[this._workbook.getSheets().length - 1].getSheetId()
4248
5036
  });
4249
5037
  const o = this._workbook.getActiveSheet();
4250
5038
  if (!o)
4251
5039
  throw new Error("No active sheet found");
4252
- return this._injector.createInstance(l, this, this._workbook, o);
5040
+ return this._injector.createInstance(k, this, this._workbook, o);
4253
5041
  }
4254
5042
  /**
4255
5043
  * Get a worksheet by sheet id.
@@ -4265,7 +5053,7 @@ let v = class extends he {
4265
5053
  */
4266
5054
  getSheetBySheetId(e) {
4267
5055
  const t = this._workbook.getSheetBySheetId(e);
4268
- return t ? this._injector.createInstance(l, this, this._workbook, t) : null;
5056
+ return t ? this._injector.createInstance(k, this, this._workbook, t) : null;
4269
5057
  }
4270
5058
  /**
4271
5059
  * Get a worksheet by sheet name.
@@ -4281,7 +5069,7 @@ let v = class extends he {
4281
5069
  */
4282
5070
  getSheetByName(e) {
4283
5071
  const t = this._workbook.getSheetBySheetName(e);
4284
- return t ? this._injector.createInstance(l, this, this._workbook, t) : null;
5072
+ return t ? this._injector.createInstance(k, this, this._workbook, t) : null;
4285
5073
  }
4286
5074
  /**
4287
5075
  * Sets the given worksheet to be the active worksheet in the workbook.
@@ -4296,7 +5084,7 @@ let v = class extends he {
4296
5084
  * ```
4297
5085
  */
4298
5086
  setActiveSheet(e) {
4299
- return this._commandService.syncExecuteCommand(T.id, {
5087
+ return this._commandService.syncExecuteCommand(H.id, {
4300
5088
  unitId: this.id,
4301
5089
  subUnitId: typeof e == "string" ? e : e.getSheetId()
4302
5090
  }), typeof e == "string" ? this.getSheetBySheetId(e) : e;
@@ -4318,16 +5106,16 @@ let v = class extends he {
4318
5106
  * ```
4319
5107
  */
4320
5108
  insertSheet(e) {
4321
- e != null ? this._commandService.syncExecuteCommand(N.id, { sheet: { name: e } }) : this._commandService.syncExecuteCommand(N.id);
5109
+ e != null ? this._commandService.syncExecuteCommand(F.id, { sheet: { name: e } }) : this._commandService.syncExecuteCommand(F.id);
4322
5110
  const t = this.id, n = this._workbook.getSheets()[this._workbook.getSheets().length - 1].getSheetId();
4323
- this._commandService.syncExecuteCommand(T.id, {
5111
+ this._commandService.syncExecuteCommand(H.id, {
4324
5112
  unitId: t,
4325
5113
  subUnitId: n
4326
5114
  });
4327
- const r = this._workbook.getActiveSheet();
4328
- if (!r)
5115
+ const s = this._workbook.getActiveSheet();
5116
+ if (!s)
4329
5117
  throw new Error("No active sheet found");
4330
- return this._injector.createInstance(l, this, this._workbook, r);
5118
+ return this._injector.createInstance(k, this, this._workbook, s);
4331
5119
  }
4332
5120
  /**
4333
5121
  * Deletes the specified worksheet.
@@ -4343,7 +5131,7 @@ let v = class extends he {
4343
5131
  */
4344
5132
  deleteSheet(e) {
4345
5133
  const t = this.id, n = typeof e == "string" ? e : e.getSheetId();
4346
- return this._commandService.syncExecuteCommand(oe.id, {
5134
+ return this._commandService.syncExecuteCommand(ce.id, {
4347
5135
  unitId: t,
4348
5136
  subUnitId: n
4349
5137
  });
@@ -4360,7 +5148,7 @@ let v = class extends he {
4360
5148
  * ```
4361
5149
  */
4362
5150
  undo() {
4363
- return this._univerInstanceService.focusUnit(this.id), this._commandService.syncExecuteCommand(Xe.id), this;
5151
+ return this._univerInstanceService.focusUnit(this.id), this._commandService.syncExecuteCommand(at.id), this;
4364
5152
  }
4365
5153
  /**
4366
5154
  * Redo the last undone action.
@@ -4373,7 +5161,7 @@ let v = class extends he {
4373
5161
  * ```
4374
5162
  */
4375
5163
  redo() {
4376
- return this._univerInstanceService.focusUnit(this.id), this._commandService.syncExecuteCommand(Ze.id), this;
5164
+ return this._univerInstanceService.focusUnit(this.id), this._commandService.syncExecuteCommand(ht.id), this;
4377
5165
  }
4378
5166
  /**
4379
5167
  * Callback for command execution.
@@ -4442,9 +5230,9 @@ let v = class extends he {
4442
5230
  * ```
4443
5231
  */
4444
5232
  onSelectionChange(e) {
4445
- return Me(
5233
+ return Oe(
4446
5234
  this._selectionManagerService.selectionMoveEnd$.subscribe((t) => {
4447
- this._univerInstanceService.getCurrentUnitForType(b.UNIVER_SHEET).getUnitId() === this.id && (t != null && t.length ? e(t.map((n) => n.range)) : e([]));
5235
+ this._univerInstanceService.getCurrentUnitForType(U.UNIVER_SHEET).getUnitId() === this.id && (t != null && t.length ? e(t.map((n) => n.range)) : e([]));
4448
5236
  })
4449
5237
  );
4450
5238
  }
@@ -4460,7 +5248,7 @@ let v = class extends he {
4460
5248
  * ```
4461
5249
  */
4462
5250
  setEditable(e) {
4463
- const t = new He(this._workbook.getUnitId());
5251
+ const t = new $e(this._workbook.getUnitId());
4464
5252
  return this._permissionService.getPermissionPoint(t.id) || this._permissionService.addPermissionPoint(t), this._permissionService.updatePermissionPoint(t.id, e), this;
4465
5253
  }
4466
5254
  /**
@@ -4475,16 +5263,16 @@ let v = class extends he {
4475
5263
  * ```
4476
5264
  */
4477
5265
  setActiveRange(e) {
4478
- const t = this.getActiveSheet(), n = e.getRange().sheetId || t.getSheetId(), r = n ? this._workbook.getSheetBySheetId(n) : this._workbook.getActiveSheet(!0);
4479
- if (!r)
5266
+ const t = this.getActiveSheet(), n = e.getRange().sheetId || t.getSheetId(), s = n ? this._workbook.getSheetBySheetId(n) : this._workbook.getActiveSheet(!0);
5267
+ if (!s)
4480
5268
  throw new Error("No active sheet found");
4481
- r.getSheetId() !== t.getSheetId() && this.setActiveSheet(this._injector.createInstance(l, this, this._workbook, r));
5269
+ s.getSheetId() !== t.getSheetId() && this.setActiveSheet(this._injector.createInstance(k, this, this._workbook, s));
4482
5270
  const o = {
4483
5271
  unitId: this.getId(),
4484
5272
  subUnitId: n,
4485
- selections: [e].map((i) => ({ range: i.getRange(), primary: te(i.getRange(), r), style: null }))
5273
+ selections: [e].map((i) => ({ range: i.getRange(), primary: $(i.getRange(), s), style: null }))
4486
5274
  };
4487
- return this._commandService.syncExecuteCommand(Ve.id, o), this;
5275
+ return this._commandService.syncExecuteCommand(me.id, o), this;
4488
5276
  }
4489
5277
  /**
4490
5278
  * Returns the selected range in the active sheet, or null if there is no active range.
@@ -4498,8 +5286,27 @@ let v = class extends he {
4498
5286
  */
4499
5287
  // could sheet have no active range ?
4500
5288
  getActiveRange() {
4501
- const e = this._workbook.getActiveSheet(), n = this._selectionManagerService.getCurrentSelections().find((r) => !!r.primary);
4502
- return n ? this._injector.createInstance(k, this._workbook, e, n.range) : null;
5289
+ const e = this._workbook.getActiveSheet(), n = this._selectionManagerService.getCurrentSelections().find((s) => !!s.primary);
5290
+ return n ? this._injector.createInstance(m, this._workbook, e, n.range) : null;
5291
+ }
5292
+ /**
5293
+ * Returns the active cell in this spreadsheet.
5294
+ * @returns {FRange | null} The active cell
5295
+ * @example
5296
+ * ```ts
5297
+ * const fWorkbook = univerAPI.getActiveWorkbook();
5298
+ * console.log(fWorkbook.getActiveCell().getA1Notation());
5299
+ * ```
5300
+ */
5301
+ getActiveCell() {
5302
+ const e = this._workbook.getActiveSheet(), n = this._selectionManagerService.getCurrentSelections().find((o) => !!o.primary);
5303
+ if (!n)
5304
+ return null;
5305
+ const s = {
5306
+ ...n.primary,
5307
+ rangeType: w.NORMAL
5308
+ };
5309
+ return this._injector.createInstance(m, this._workbook, e, s);
4503
5310
  }
4504
5311
  /**
4505
5312
  * Deletes the currently active sheet.
@@ -4528,10 +5335,10 @@ let v = class extends he {
4528
5335
  * ```
4529
5336
  */
4530
5337
  duplicateSheet(e) {
4531
- return this._commandService.syncExecuteCommand(At.id, {
5338
+ return this._commandService.syncExecuteCommand(qt.id, {
4532
5339
  unitId: e.getWorkbook().getUnitId(),
4533
5340
  subUnitId: e.getSheetId()
4534
- }), this._injector.createInstance(l, this, this._workbook, this._workbook.getActiveSheet());
5341
+ }), this._injector.createInstance(k, this, this._workbook, this._workbook.getActiveSheet());
4535
5342
  }
4536
5343
  /**
4537
5344
  * Duplicates the active sheet.
@@ -4624,7 +5431,7 @@ let v = class extends he {
4624
5431
  */
4625
5432
  moveSheet(e, t) {
4626
5433
  let n = t;
4627
- return n < 0 ? n = 0 : n > this._workbook.getSheets().length - 1 && (n = this._workbook.getSheets().length - 1), this._commandService.syncExecuteCommand(Wt.id, {
5434
+ return n < 0 ? n = 0 : n > this._workbook.getSheets().length - 1 && (n = this._workbook.getSheets().length - 1), this._commandService.syncExecuteCommand(Kt.id, {
4628
5435
  unitId: e.getWorkbook().getUnitId(),
4629
5436
  order: n,
4630
5437
  subUnitId: e.getSheetId()
@@ -4656,7 +5463,7 @@ let v = class extends he {
4656
5463
  * ```
4657
5464
  */
4658
5465
  getPermission() {
4659
- return this._injector.createInstance(O);
5466
+ return this._injector.createInstance(K);
4660
5467
  }
4661
5468
  /**
4662
5469
  * Get the defined name by name.
@@ -4672,7 +5479,7 @@ let v = class extends he {
4672
5479
  */
4673
5480
  getDefinedName(e) {
4674
5481
  const t = this._definedNamesService.getValueByName(this.id, e);
4675
- return t ? this._injector.createInstance(H, { ...t, unitId: this.id }) : null;
5482
+ return t ? this._injector.createInstance(q, { ...t, unitId: this.id }) : null;
4676
5483
  }
4677
5484
  /**
4678
5485
  * Get all the defined names in the workbook.
@@ -4687,7 +5494,7 @@ let v = class extends he {
4687
5494
  */
4688
5495
  getDefinedNames() {
4689
5496
  const e = this._definedNamesService.getDefinedNameMap(this.id);
4690
- return e ? Object.values(e).map((t) => this._injector.createInstance(H, { ...t, unitId: this.id })) : [];
5497
+ return e ? Object.values(e).map((t) => this._injector.createInstance(q, { ...t, unitId: this.id })) : [];
4691
5498
  }
4692
5499
  /**
4693
5500
  * Insert a defined name.
@@ -4702,8 +5509,8 @@ let v = class extends he {
4702
5509
  * ```
4703
5510
  */
4704
5511
  insertDefinedName(e, t) {
4705
- const r = this._injector.createInstance(L).setName(e).setRef(t).build();
4706
- return r.localSheetId = Z, this.insertDefinedNameBuilder(r), this;
5512
+ const s = this._injector.createInstance(J).setName(e).setRef(t).build();
5513
+ return s.localSheetId = oe, this.insertDefinedNameBuilder(s), this;
4707
5514
  }
4708
5515
  /**
4709
5516
  * Delete the defined name with the given name.
@@ -4737,7 +5544,7 @@ let v = class extends he {
4737
5544
  * ```
4738
5545
  */
4739
5546
  insertDefinedNameBuilder(e) {
4740
- e.unitId = this.getId(), this._commandService.syncExecuteCommand(X.id, e);
5547
+ e.unitId = this.getId(), this._commandService.syncExecuteCommand(se.id, e);
4741
5548
  }
4742
5549
  /**
4743
5550
  * Update the defined name with the given name.
@@ -4755,7 +5562,7 @@ let v = class extends he {
4755
5562
  * ```
4756
5563
  */
4757
5564
  updateDefinedNameBuilder(e) {
4758
- this._commandService.syncExecuteCommand(X.id, e);
5565
+ this._commandService.syncExecuteCommand(se.id, e);
4759
5566
  }
4760
5567
  /**
4761
5568
  * Gets the registered range themes.
@@ -4769,7 +5576,7 @@ let v = class extends he {
4769
5576
  * ```
4770
5577
  */
4771
5578
  getRegisteredRangeThemes() {
4772
- return this._injector.get(Oe).getRegisteredRangeThemes();
5579
+ return this._injector.get(qe).getRegisteredRangeThemes();
4773
5580
  }
4774
5581
  /**
4775
5582
  * Register a custom range theme style.
@@ -4790,7 +5597,7 @@ let v = class extends he {
4790
5597
  * ```
4791
5598
  */
4792
5599
  registerRangeTheme(e) {
4793
- this._commandService.syncExecuteCommand(Bt.id, {
5600
+ this._commandService.syncExecuteCommand(Yt.id, {
4794
5601
  unitId: this.getId(),
4795
5602
  rangeThemeStyle: e
4796
5603
  });
@@ -4806,7 +5613,7 @@ let v = class extends he {
4806
5613
  * ```
4807
5614
  */
4808
5615
  unregisterRangeTheme(e) {
4809
- this._commandService.syncExecuteCommand(Ft.id, {
5616
+ this._commandService.syncExecuteCommand(Jt.id, {
4810
5617
  unitId: this.getId(),
4811
5618
  themeName: e
4812
5619
  });
@@ -4830,7 +5637,7 @@ let v = class extends he {
4830
5637
  * ```
4831
5638
  */
4832
5639
  createRangeThemeStyle(e, t) {
4833
- return new Ht(e, t);
5640
+ return new Qt(e, t);
4834
5641
  }
4835
5642
  /**
4836
5643
  * Set custom metadata of workbook
@@ -4859,18 +5666,18 @@ let v = class extends he {
4859
5666
  return this._workbook.getCustomMetadata();
4860
5667
  }
4861
5668
  };
4862
- v = gn([
4863
- C(1, u(p)),
4864
- C(2, u(Je)),
4865
- C(3, u(je)),
4866
- C(4, Q),
4867
- C(5, m),
4868
- C(6, ie),
4869
- C(7, De),
4870
- C(8, u(Ne)),
4871
- C(9, Le)
4872
- ], v);
4873
- class mn extends Ae {
5669
+ S = In([
5670
+ R(1, u(x)),
5671
+ R(2, u(ot)),
5672
+ R(3, u(Qe)),
5673
+ R(4, re),
5674
+ R(5, l),
5675
+ R(6, ue),
5676
+ R(7, He),
5677
+ R(8, u(Ve)),
5678
+ R(9, Xe)
5679
+ ], S);
5680
+ class Rn extends je {
4874
5681
  getCommandSheetTarget(e) {
4875
5682
  var o;
4876
5683
  const t = e.params;
@@ -4878,24 +5685,24 @@ class mn extends Ae {
4878
5685
  const n = t.unitId ? this.getUniverSheet(t.unitId) : (o = this.getActiveWorkbook) == null ? void 0 : o.call(this);
4879
5686
  if (!n)
4880
5687
  return;
4881
- const r = n.getSheetBySheetId(t.subUnitId || t.sheetId) || n.getActiveSheet();
4882
- if (r)
4883
- return { workbook: n, worksheet: r };
5688
+ const s = n.getSheetBySheetId(t.subUnitId || t.sheetId) || n.getActiveSheet();
5689
+ if (s)
5690
+ return { workbook: n, worksheet: s };
4884
5691
  }
4885
5692
  getSheetTarget(e, t) {
4886
5693
  const n = this.getUniverSheet(e);
4887
5694
  if (!n)
4888
5695
  return;
4889
- const r = n.getSheetBySheetId(t);
4890
- if (r)
4891
- return { workbook: n, worksheet: r };
5696
+ const s = n.getSheetBySheetId(t);
5697
+ if (s)
5698
+ return { workbook: n, worksheet: s };
4892
5699
  }
4893
5700
  _initWorkbookEvent(e) {
4894
- const t = e.get(Q);
5701
+ const t = e.get(re);
4895
5702
  this.registerEventHandler(
4896
5703
  this.Event.WorkbookDisposed,
4897
5704
  () => t.unitDisposed$.subscribe((n) => {
4898
- n.type === b.UNIVER_SHEET && this.fireEvent(
5705
+ n.type === U.UNIVER_SHEET && this.fireEvent(
4899
5706
  this.Event.WorkbookDisposed,
4900
5707
  {
4901
5708
  unitId: n.getUnitId(),
@@ -4907,8 +5714,8 @@ class mn extends Ae {
4907
5714
  ), this.registerEventHandler(
4908
5715
  this.Event.WorkbookCreated,
4909
5716
  () => t.unitAdded$.subscribe((n) => {
4910
- if (n.type === b.UNIVER_SHEET) {
4911
- const r = n, o = e.createInstance(v, r);
5717
+ if (n.type === U.UNIVER_SHEET) {
5718
+ const s = n, o = e.createInstance(S, s);
4912
5719
  this.fireEvent(
4913
5720
  this.Event.WorkbookCreated,
4914
5721
  {
@@ -4927,13 +5734,13 @@ class mn extends Ae {
4927
5734
  */
4928
5735
  // eslint-disable-next-line max-lines-per-function
4929
5736
  _initialize(e) {
4930
- const t = e.get(m);
5737
+ const t = e.get(l);
4931
5738
  this.registerEventHandler(
4932
5739
  this.Event.BeforeSheetCreate,
4933
5740
  () => t.beforeCommandExecuted((n) => {
4934
- var r;
4935
- if (n.id === N.id) {
4936
- const o = n.params, { unitId: i, index: a, sheet: h } = o || {}, d = i ? this.getUniverSheet(i) : (r = this.getActiveWorkbook) == null ? void 0 : r.call(this);
5741
+ var s;
5742
+ if (n.id === F.id) {
5743
+ const o = n.params, { unitId: i, index: a, sheet: h } = o || {}, d = i ? this.getUniverSheet(i) : (s = this.getActiveWorkbook) == null ? void 0 : s.call(this);
4937
5744
  if (!d)
4938
5745
  return;
4939
5746
  const c = {
@@ -4942,15 +5749,15 @@ class mn extends Ae {
4942
5749
  sheet: h
4943
5750
  };
4944
5751
  if (this.fireEvent(this.Event.BeforeSheetCreate, c), c.cancel)
4945
- throw new w();
5752
+ throw new v();
4946
5753
  }
4947
5754
  })
4948
5755
  ), this.registerEventHandler(
4949
5756
  this.Event.BeforeActiveSheetChange,
4950
5757
  () => t.beforeCommandExecuted((n) => {
4951
- var r;
4952
- if (n.id === T.id) {
4953
- const { subUnitId: o, unitId: i } = n.params, a = i ? this.getUniverSheet(i) : (r = this.getActiveWorkbook) == null ? void 0 : r.call(this);
5758
+ var s;
5759
+ if (n.id === H.id) {
5760
+ const { subUnitId: o, unitId: i } = n.params, a = i ? this.getUniverSheet(i) : (s = this.getActiveWorkbook) == null ? void 0 : s.call(this);
4954
5761
  if (!a || !o) return;
4955
5762
  const h = a.getSheetBySheetId(o), d = a.getActiveSheet();
4956
5763
  if (!h || !d) return;
@@ -4960,122 +5767,122 @@ class mn extends Ae {
4960
5767
  oldActiveSheet: d
4961
5768
  };
4962
5769
  if (this.fireEvent(this.Event.BeforeActiveSheetChange, c), c.cancel)
4963
- throw new w();
5770
+ throw new v();
4964
5771
  }
4965
5772
  })
4966
5773
  ), this.registerEventHandler(
4967
5774
  this.Event.BeforeSheetDelete,
4968
5775
  () => t.beforeCommandExecuted((n) => {
4969
- if (n.id === oe.id) {
4970
- const r = this.getCommandSheetTarget(n);
4971
- if (!r) return;
4972
- const { workbook: o, worksheet: i } = r, a = {
5776
+ if (n.id === ce.id) {
5777
+ const s = this.getCommandSheetTarget(n);
5778
+ if (!s) return;
5779
+ const { workbook: o, worksheet: i } = s, a = {
4973
5780
  workbook: o,
4974
5781
  worksheet: i
4975
5782
  };
4976
5783
  if (this.fireEvent(this.Event.BeforeSheetDelete, a), a.cancel)
4977
- throw new w();
5784
+ throw new v();
4978
5785
  }
4979
5786
  })
4980
5787
  ), this.registerEventHandler(
4981
5788
  this.Event.BeforeSheetMove,
4982
5789
  () => t.beforeCommandExecuted((n) => {
4983
- if (n.id === pe.id) {
4984
- const { fromOrder: r, toOrder: o } = n.params, i = this.getCommandSheetTarget(n);
5790
+ if (n.id === Pe.id) {
5791
+ const { fromOrder: s, toOrder: o } = n.params, i = this.getCommandSheetTarget(n);
4985
5792
  if (!i) return;
4986
5793
  const a = {
4987
5794
  workbook: i.workbook,
4988
5795
  worksheet: i.worksheet,
4989
5796
  newIndex: o,
4990
- oldIndex: r
5797
+ oldIndex: s
4991
5798
  };
4992
5799
  if (this.fireEvent(this.Event.BeforeSheetMove, a), a.cancel)
4993
- throw new w();
5800
+ throw new v();
4994
5801
  }
4995
5802
  })
4996
5803
  ), this.registerEventHandler(
4997
5804
  this.Event.BeforeSheetNameChange,
4998
5805
  () => t.beforeCommandExecuted((n) => {
4999
- if (n.id === se.id) {
5000
- const { name: r } = n.params, o = this.getCommandSheetTarget(n);
5806
+ if (n.id === de.id) {
5807
+ const { name: s } = n.params, o = this.getCommandSheetTarget(n);
5001
5808
  if (!o) return;
5002
5809
  const i = {
5003
5810
  workbook: o.workbook,
5004
5811
  worksheet: o.worksheet,
5005
- newName: r,
5812
+ newName: s,
5006
5813
  oldName: o.worksheet.getSheetName()
5007
5814
  };
5008
5815
  if (this.fireEvent(this.Event.BeforeSheetNameChange, i), i.cancel)
5009
- throw new w();
5816
+ throw new v();
5010
5817
  }
5011
5818
  })
5012
5819
  ), this.registerEventHandler(
5013
5820
  this.Event.BeforeSheetTabColorChange,
5014
5821
  () => t.beforeCommandExecuted((n) => {
5015
- if (n.id === Ee.id) {
5016
- const { color: r } = n.params, o = this.getCommandSheetTarget(n);
5822
+ if (n.id === Me.id) {
5823
+ const { color: s } = n.params, o = this.getCommandSheetTarget(n);
5017
5824
  if (!o) return;
5018
5825
  const i = {
5019
5826
  workbook: o.workbook,
5020
5827
  worksheet: o.worksheet,
5021
- newColor: r,
5828
+ newColor: s,
5022
5829
  oldColor: o.worksheet.getTabColor()
5023
5830
  };
5024
5831
  if (this.fireEvent(this.Event.BeforeSheetTabColorChange, i), i.cancel)
5025
- throw new w();
5832
+ throw new v();
5026
5833
  }
5027
5834
  })
5028
5835
  ), this.registerEventHandler(
5029
5836
  this.Event.BeforeSheetHideChange,
5030
5837
  () => t.beforeCommandExecuted((n) => {
5031
- if (n.id === ye.id) {
5032
- const { hidden: r } = n.params, o = this.getCommandSheetTarget(n);
5838
+ if (n.id === Ne.id) {
5839
+ const { hidden: s } = n.params, o = this.getCommandSheetTarget(n);
5033
5840
  if (!o) return;
5034
5841
  const i = {
5035
5842
  workbook: o.workbook,
5036
5843
  worksheet: o.worksheet,
5037
- hidden: !!r
5844
+ hidden: !!s
5038
5845
  };
5039
5846
  if (this.fireEvent(this.Event.BeforeSheetHideChange, i), i.cancel)
5040
- throw new w();
5847
+ throw new v();
5041
5848
  }
5042
5849
  })
5043
5850
  ), this.registerEventHandler(
5044
5851
  this.Event.BeforeGridlineColorChange,
5045
5852
  () => t.beforeCommandExecuted((n) => {
5046
- var r;
5047
- if (n.id === re.id) {
5853
+ var s;
5854
+ if (n.id === he.id) {
5048
5855
  const o = this.getCommandSheetTarget(n);
5049
5856
  if (!o) return;
5050
5857
  const i = {
5051
5858
  ...o,
5052
- color: (r = n.params) == null ? void 0 : r.color
5859
+ color: (s = n.params) == null ? void 0 : s.color
5053
5860
  };
5054
5861
  if (this.fireEvent(this.Event.BeforeGridlineColorChange, i), i.cancel)
5055
- throw new w();
5862
+ throw new v();
5056
5863
  }
5057
5864
  })
5058
5865
  ), this.registerEventHandler(
5059
5866
  this.Event.BeforeGridlineEnableChange,
5060
5867
  () => t.beforeCommandExecuted((n) => {
5061
- var r;
5062
- if (n.id === ne.id) {
5868
+ var s;
5869
+ if (n.id === ae.id) {
5063
5870
  const o = this.getCommandSheetTarget(n);
5064
5871
  if (!o) return;
5065
5872
  const i = {
5066
5873
  ...o,
5067
- enabled: !!((r = n.params) != null && r.showGridlines)
5874
+ enabled: !!((s = n.params) != null && s.showGridlines)
5068
5875
  };
5069
5876
  if (this.fireEvent(this.Event.BeforeGridlineEnableChange, i), i.cancel)
5070
- throw new w();
5877
+ throw new v();
5071
5878
  }
5072
5879
  })
5073
5880
  ), this.registerEventHandler(
5074
5881
  this.Event.SheetValueChanged,
5075
5882
  () => t.onCommandExecuted((n) => {
5076
- if (Ot.indexOf(n.id) > -1) {
5883
+ if (Xt.indexOf(n.id) > -1) {
5077
5884
  if (!this.getActiveSheet()) return;
5078
- const o = Vt(n).map(
5885
+ const o = Zt(n).map(
5079
5886
  (i) => {
5080
5887
  var a, h;
5081
5888
  return (h = (a = this.getWorkbook(i.unitId)) == null ? void 0 : a.getSheetBySheetId(i.subUnitId)) == null ? void 0 : h.getRange(i.range);
@@ -5091,9 +5898,9 @@ class mn extends Ae {
5091
5898
  ), this.registerEventHandler(
5092
5899
  this.Event.SheetCreated,
5093
5900
  () => t.onCommandExecuted((n) => {
5094
- var r;
5095
- if (n.id === N.id) {
5096
- const o = n.params, { unitId: i } = o || {}, a = i ? this.getUniverSheet(i) : (r = this.getActiveWorkbook) == null ? void 0 : r.call(this);
5901
+ var s;
5902
+ if (n.id === F.id) {
5903
+ const o = n.params, { unitId: i } = o || {}, a = i ? this.getUniverSheet(i) : (s = this.getActiveWorkbook) == null ? void 0 : s.call(this);
5097
5904
  if (!a)
5098
5905
  return;
5099
5906
  const h = a.getActiveSheet();
@@ -5112,19 +5919,19 @@ class mn extends Ae {
5112
5919
  ), this.registerEventHandler(
5113
5920
  this.Event.ActiveSheetChanged,
5114
5921
  () => t.onCommandExecuted((n) => {
5115
- if (n.id === T.id) {
5116
- const r = this.getActiveSheet();
5117
- if (!r) return;
5118
- const { workbook: o, worksheet: i } = r;
5922
+ if (n.id === H.id) {
5923
+ const s = this.getActiveSheet();
5924
+ if (!s) return;
5925
+ const { workbook: o, worksheet: i } = s;
5119
5926
  this._fireActiveSheetChanged(o, i);
5120
5927
  }
5121
5928
  })
5122
5929
  ), this.registerEventHandler(
5123
5930
  this.Event.SheetDeleted,
5124
5931
  () => t.onCommandExecuted((n) => {
5125
- var r;
5126
- if (n.id === oe.id) {
5127
- const { subUnitId: o, unitId: i } = n.params, a = i ? this.getUniverSheet(i) : (r = this.getActiveWorkbook) == null ? void 0 : r.call(this);
5932
+ var s;
5933
+ if (n.id === ce.id) {
5934
+ const { subUnitId: o, unitId: i } = n.params, a = i ? this.getUniverSheet(i) : (s = this.getActiveWorkbook) == null ? void 0 : s.call(this);
5128
5935
  if (!a || !o) return;
5129
5936
  this._fireSheetDeleted(a, o);
5130
5937
  }
@@ -5132,87 +5939,87 @@ class mn extends Ae {
5132
5939
  ), this.registerEventHandler(
5133
5940
  this.Event.SheetMoved,
5134
5941
  () => t.onCommandExecuted((n) => {
5135
- if (n.id === pe.id) {
5136
- const { toOrder: r } = n.params, o = this.getCommandSheetTarget(n);
5942
+ if (n.id === Pe.id) {
5943
+ const { toOrder: s } = n.params, o = this.getCommandSheetTarget(n);
5137
5944
  if (!o) return;
5138
- this._fireSheetMoved(o.workbook, o.worksheet, r);
5945
+ this._fireSheetMoved(o.workbook, o.worksheet, s);
5139
5946
  }
5140
5947
  })
5141
5948
  ), this.registerEventHandler(
5142
5949
  this.Event.SheetNameChanged,
5143
5950
  () => t.onCommandExecuted((n) => {
5144
- if (n.id === se.id) {
5145
- const { name: r } = n.params, o = this.getCommandSheetTarget(n);
5951
+ if (n.id === de.id) {
5952
+ const { name: s } = n.params, o = this.getCommandSheetTarget(n);
5146
5953
  if (!o) return;
5147
- this._fireSheetNameChanged(o.workbook, o.worksheet, r);
5954
+ this._fireSheetNameChanged(o.workbook, o.worksheet, s);
5148
5955
  }
5149
5956
  })
5150
5957
  ), this.registerEventHandler(
5151
5958
  this.Event.SheetTabColorChanged,
5152
5959
  () => t.onCommandExecuted((n) => {
5153
- if (n.id === Ee.id) {
5154
- const { color: r } = n.params, o = this.getCommandSheetTarget(n);
5960
+ if (n.id === Me.id) {
5961
+ const { color: s } = n.params, o = this.getCommandSheetTarget(n);
5155
5962
  if (!o) return;
5156
- this._fireSheetTabColorChanged(o.workbook, o.worksheet, r);
5963
+ this._fireSheetTabColorChanged(o.workbook, o.worksheet, s);
5157
5964
  }
5158
5965
  })
5159
5966
  ), this.registerEventHandler(
5160
5967
  this.Event.SheetHideChanged,
5161
5968
  () => t.onCommandExecuted((n) => {
5162
- if (n.id === ye.id) {
5163
- const { hidden: r } = n.params, o = this.getCommandSheetTarget(n);
5969
+ if (n.id === Ne.id) {
5970
+ const { hidden: s } = n.params, o = this.getCommandSheetTarget(n);
5164
5971
  if (!o) return;
5165
- this._fireSheetHideChanged(o.workbook, o.worksheet, !!r);
5972
+ this._fireSheetHideChanged(o.workbook, o.worksheet, !!s);
5166
5973
  }
5167
5974
  })
5168
5975
  ), this.registerEventHandler(
5169
5976
  this.Event.GridlineChanged,
5170
5977
  () => t.onCommandExecuted((n) => {
5171
- if (n.id === re.id || n.id === ne.id) {
5172
- const r = this.getCommandSheetTarget(n);
5173
- if (!r) return;
5978
+ if (n.id === he.id || n.id === ae.id) {
5979
+ const s = this.getCommandSheetTarget(n);
5980
+ if (!s) return;
5174
5981
  this.fireEvent(this.Event.GridlineChanged, {
5175
- ...r,
5176
- enabled: !r.worksheet.hasHiddenGridLines(),
5177
- color: r.worksheet.getGridLinesColor()
5982
+ ...s,
5983
+ enabled: !s.worksheet.hasHiddenGridLines(),
5984
+ color: s.worksheet.getGridLinesColor()
5178
5985
  });
5179
5986
  }
5180
5987
  })
5181
5988
  ), this._initWorkbookEvent(e);
5182
5989
  }
5183
5990
  createUniverSheet(e, t) {
5184
- const r = this._injector.get(Q).createUnit(b.UNIVER_SHEET, e, t);
5185
- return this._injector.createInstance(v, r);
5991
+ const s = this._injector.get(re).createUnit(U.UNIVER_SHEET, e, t);
5992
+ return this._injector.createInstance(S, s);
5186
5993
  }
5187
5994
  createWorkbook(e, t) {
5188
5995
  return this.createUniverSheet(e, t);
5189
5996
  }
5190
5997
  getActiveWorkbook() {
5191
- const e = this._univerInstanceService.getCurrentUnitForType(b.UNIVER_SHEET);
5192
- return e ? this._injector.createInstance(v, e) : null;
5998
+ const e = this._univerInstanceService.getCurrentUnitForType(U.UNIVER_SHEET);
5999
+ return e ? this._injector.createInstance(S, e) : null;
5193
6000
  }
5194
6001
  getActiveUniverSheet() {
5195
6002
  return this.getActiveWorkbook();
5196
6003
  }
5197
6004
  getUniverSheet(e) {
5198
- const t = this._univerInstanceService.getUnit(e, b.UNIVER_SHEET);
5199
- return t ? this._injector.createInstance(v, t) : null;
6005
+ const t = this._univerInstanceService.getUnit(e, U.UNIVER_SHEET);
6006
+ return t ? this._injector.createInstance(S, t) : null;
5200
6007
  }
5201
6008
  getWorkbook(e) {
5202
6009
  return this.getUniverSheet(e);
5203
6010
  }
5204
6011
  getPermission() {
5205
- return this._injector.createInstance(O);
6012
+ return this._injector.createInstance(K);
5206
6013
  }
5207
6014
  onUniverSheetCreated(e) {
5208
- const t = this._univerInstanceService.getTypeOfUnitAdded$(b.UNIVER_SHEET).subscribe((n) => {
5209
- const r = this._injector.createInstance(v, n);
5210
- e(r);
6015
+ const t = this._univerInstanceService.getTypeOfUnitAdded$(U.UNIVER_SHEET).subscribe((n) => {
6016
+ const s = this._injector.createInstance(S, n);
6017
+ e(s);
5211
6018
  });
5212
- return Me(t);
6019
+ return Oe(t);
5213
6020
  }
5214
6021
  newDefinedName() {
5215
- return this._injector.createInstance(L);
6022
+ return this._injector.createInstance(J);
5216
6023
  }
5217
6024
  getActiveSheet() {
5218
6025
  const e = this.getActiveWorkbook();
@@ -5262,20 +6069,20 @@ class mn extends Ae {
5262
6069
  });
5263
6070
  }
5264
6071
  }
5265
- Ae.extend(mn);
5266
- class ln {
6072
+ je.extend(Rn);
6073
+ class bn {
5267
6074
  get SheetValueChangeType() {
5268
- return jt;
6075
+ return en;
5269
6076
  }
5270
6077
  get SheetSkeletonChangeType() {
5271
- return Lt;
6078
+ return tn;
5272
6079
  }
5273
6080
  get SplitDelimiterType() {
5274
- return zt;
6081
+ return nn;
5275
6082
  }
5276
6083
  }
5277
- et.extend(ln);
5278
- class _n {
6084
+ dt.extend(bn);
6085
+ class pn {
5279
6086
  get SheetCreated() {
5280
6087
  return "SheetCreated";
5281
6088
  }
@@ -5337,27 +6144,27 @@ class _n {
5337
6144
  return "SheetValueChanged";
5338
6145
  }
5339
6146
  }
5340
- tt.extend(_n);
5341
- var kn = Object.getOwnPropertyDescriptor, wn = (s, e, t, n) => {
5342
- for (var r = n > 1 ? void 0 : n ? kn(e, t) : e, o = s.length - 1, i; o >= 0; o--)
5343
- (i = s[o]) && (r = i(r) || r);
5344
- return r;
5345
- }, Sn = (s, e) => (t, n) => e(t, n, s);
5346
- let Pe = class extends ae {
5347
- constructor(s) {
5348
- super(), this._injector = s;
6147
+ ct.extend(pn);
6148
+ var En = Object.getOwnPropertyDescriptor, yn = (r, e, t, n) => {
6149
+ for (var s = n > 1 ? void 0 : n ? En(e, t) : e, o = r.length - 1, i; o >= 0; o--)
6150
+ (i = r[o]) && (s = i(s) || s);
6151
+ return s;
6152
+ }, Un = (r, e) => (t, n) => e(t, n, r);
6153
+ let We = class extends ge {
6154
+ constructor(r) {
6155
+ super(), this._injector = r;
5349
6156
  }
5350
6157
  };
5351
- Pe = wn([
5352
- Sn(0, u(p))
5353
- ], Pe);
6158
+ We = yn([
6159
+ Un(0, u(x))
6160
+ ], We);
5354
6161
  export {
5355
- O as FPermission,
5356
- k as FRange,
5357
- j as FSelection,
5358
- _n as FSheetEventName,
5359
- Pe as FSheetHooks,
5360
- ln as FSheetsEnum,
5361
- v as FWorkbook,
5362
- l as FWorksheet
6162
+ K as FPermission,
6163
+ m as FRange,
6164
+ Y as FSelection,
6165
+ pn as FSheetEventName,
6166
+ We as FSheetHooks,
6167
+ bn as FSheetsEnum,
6168
+ S as FWorkbook,
6169
+ k as FWorksheet
5363
6170
  };