@univerjs/sheets 0.15.5 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/facade.js CHANGED
@@ -231,8 +231,8 @@ class be {
231
231
  }
232
232
  }
233
233
  let Ce = class extends Fe {
234
- constructor(r, e, t, s, n, i, o, a, h, c) {
235
- super(), this._definedNameParam = r, this._injector = e, this._commandService = t, this._permissionService = s, this._worksheetProtectionRuleModel = n, this._rangeProtectionRuleModel = i, this._worksheetProtectionPointRuleModel = o, this._authzIoService = a, this._localeService = h, this._definedNamesService = c;
234
+ constructor(r, e, t, s, n, i, o, a, h, d) {
235
+ super(), this._definedNameParam = r, this._injector = e, this._commandService = t, this._permissionService = s, this._worksheetProtectionRuleModel = n, this._rangeProtectionRuleModel = i, this._worksheetProtectionPointRuleModel = o, this._authzIoService = a, this._localeService = h, this._definedNamesService = d;
236
236
  }
237
237
  _apply() {
238
238
  this._definedNameParam.name === "" && (this._definedNameParam.name = jn(this._definedNameParam.unitId, this._localeService, this._definedNamesService)), this._commandService.syncExecuteCommand(De.id, this._definedNameParam);
@@ -575,20 +575,20 @@ let z = class extends Fe {
575
575
  objectID: e,
576
576
  unitID: e
577
577
  }), h = new Set(s.allowedUsers);
578
- n = a.filter((d) => {
578
+ n = a.filter((c) => {
579
579
  var l;
580
- return h.has(((l = d.subject) == null ? void 0 : l.userID) || d.id);
581
- }).map((d) => ({
582
- id: d.id,
580
+ return h.has(((l = c.subject) == null ? void 0 : l.userID) || c.id);
581
+ }).map((c) => ({
582
+ id: c.id,
583
583
  role: $.Editor,
584
- subject: d.subject
584
+ subject: c.subject
585
585
  }));
586
- const c = new Set(n.map((d) => {
586
+ const d = new Set(n.map((c) => {
587
587
  var l;
588
- return ((l = d.subject) == null ? void 0 : l.userID) || d.id;
588
+ return ((l = c.subject) == null ? void 0 : l.userID) || c.id;
589
589
  }));
590
- s.allowedUsers.forEach((d) => {
591
- c.has(d) || console.error(`User ${d} not found in collaborators list`);
590
+ s.allowedUsers.forEach((c) => {
591
+ d.has(c) || console.error(`User ${c} not found in collaborators list`);
592
592
  });
593
593
  }
594
594
  const i = await this._authzIoService.create({
@@ -665,8 +665,8 @@ let z = class extends Fe {
665
665
  if (s === Pt || s === Ut)
666
666
  i ? o = i.permissionId : o = await this.addWorksheetBasePermission(e, t);
667
667
  else {
668
- const d = this._worksheetProtectionPointRuleModel.getRule(e, t);
669
- d ? o = d.permissionId : (o = await this._authzIoService.create({
668
+ const c = this._worksheetProtectionPointRuleModel.getRule(e, t);
669
+ c ? o = c.permissionId : (o = await this._authzIoService.create({
670
670
  objectType: A.Worksheet,
671
671
  worksheetObject: {
672
672
  collaborators: [],
@@ -679,12 +679,12 @@ let z = class extends Fe {
679
679
  }
680
680
  const h = new s(e, t);
681
681
  if (this._permissionService.getPermissionPoint(h.id) || this._permissionService.addPermissionPoint(h), o) {
682
- const d = h.subType;
682
+ const c = h.subType;
683
683
  await this._authzIoService.update({
684
684
  objectType: A.Worksheet,
685
685
  objectID: o,
686
686
  strategies: [{
687
- action: d,
687
+ action: c,
688
688
  role: n ? $.Owner : $.Reader
689
689
  }],
690
690
  unitID: e,
@@ -794,7 +794,7 @@ let z = class extends Fe {
794
794
  }), a = `ruleId_${It(6)}`;
795
795
  if (this._rangeProtectionRuleModel.getSubunitRuleList(e, t).some((C) => C.ranges.some((f) => s.some((Ie) => B.intersects(Ie.getRange(), f)))))
796
796
  throw new Error("range protection cannot intersect");
797
- const d = this._determineRangeViewState(n), l = this._determineRangeEditState(n), m = {
797
+ const c = this._determineRangeViewState(n), l = this._determineRangeEditState(n), m = {
798
798
  unitId: e,
799
799
  subUnitId: t,
800
800
  rules: [{
@@ -805,7 +805,7 @@ let z = class extends Fe {
805
805
  ranges: s.map((C) => C.getRange()),
806
806
  id: a,
807
807
  description: n == null ? void 0 : n.name,
808
- viewState: d,
808
+ viewState: c,
809
809
  editState: l
810
810
  }]
811
811
  };
@@ -929,7 +929,7 @@ let z = class extends Fe {
929
929
  setRangeProtectionRanges(e, t, s, n) {
930
930
  const i = this._rangeProtectionRuleModel.getRule(e, t, s);
931
931
  if (i) {
932
- if (this._rangeProtectionRuleModel.getSubunitRuleList(e, t).filter((h) => h.id !== s).some((h) => h.ranges.some((c) => n.some((d) => B.intersects(d.getRange(), c)))))
932
+ if (this._rangeProtectionRuleModel.getSubunitRuleList(e, t).filter((h) => h.id !== s).some((h) => h.ranges.some((d) => n.some((c) => B.intersects(c.getRange(), d)))))
933
933
  throw new Error("range protection cannot intersect");
934
934
  this._commandService.syncExecuteCommand(Et.id, {
935
935
  unitId: e,
@@ -980,7 +980,7 @@ let z = class extends Fe {
980
980
  * ```
981
981
  */
982
982
  getPermissionInfoWithCell(e, t, s, n) {
983
- const i = Vt(s, n), o = this._rangeProtectionRuleModel.getSubunitRuleList(e, t).find((a) => a.ranges.some((c) => B.intersects(i, c)));
983
+ const i = Vt(s, n), o = this._rangeProtectionRuleModel.getSubunitRuleList(e, t).find((a) => a.ranges.some((d) => B.intersects(i, d)));
984
984
  if (o)
985
985
  return {
986
986
  permissionId: o.permissionId,
@@ -1849,17 +1849,17 @@ let Ve = class {
1849
1849
  throw new Error("Configs cannot be empty");
1850
1850
  let e = [];
1851
1851
  r.some((a) => {
1852
- var h, c;
1853
- return (c = (h = a.options) == null ? void 0 : h.allowedUsers) == null ? void 0 : c.length;
1852
+ var h, d;
1853
+ return (d = (h = a.options) == null ? void 0 : h.allowedUsers) == null ? void 0 : d.length;
1854
1854
  }) && (e = await this._authzIoService.listCollaborators({
1855
1855
  objectID: this._unitId,
1856
1856
  unitID: this._unitId
1857
1857
  }));
1858
1858
  const s = await Promise.all(
1859
1859
  r.map((a) => {
1860
- var c, d;
1860
+ var d, c;
1861
1861
  let h = [];
1862
- if ((c = a.options) != null && c.allowedUsers) {
1862
+ if ((d = a.options) != null && d.allowedUsers) {
1863
1863
  const l = new Set(a.options.allowedUsers);
1864
1864
  h = e.filter((S) => {
1865
1865
  var C;
@@ -1882,14 +1882,14 @@ let Ve = class {
1882
1882
  selectRangeObject: {
1883
1883
  collaborators: h,
1884
1884
  unitID: this._unitId,
1885
- name: ((d = a.options) == null ? void 0 : d.name) || "",
1885
+ name: ((c = a.options) == null ? void 0 : c.name) || "",
1886
1886
  scope: void 0
1887
1887
  }
1888
1888
  });
1889
1889
  })
1890
1890
  ), n = r.map((a, h) => {
1891
1891
  var l;
1892
- const c = this._determineViewState(a.options), d = this._determineEditState(a.options);
1892
+ const d = this._determineViewState(a.options), c = this._determineEditState(a.options);
1893
1893
  return {
1894
1894
  permissionId: s[h],
1895
1895
  unitType: A.SelectRange,
@@ -1898,8 +1898,8 @@ let Ve = class {
1898
1898
  ranges: a.ranges.map((m) => m.getRange()),
1899
1899
  id: this._rangeProtectionRuleModel.createRuleId(this._unitId, this._subUnitId),
1900
1900
  description: ((l = a.options) == null ? void 0 : l.name) || "",
1901
- viewState: c,
1902
- editState: d
1901
+ viewState: d,
1902
+ editState: c
1903
1903
  };
1904
1904
  });
1905
1905
  if (!await this._commandService.executeCommand(pt.id, {
@@ -2327,10 +2327,10 @@ let v = class extends He {
2327
2327
  if (typeof e == "object")
2328
2328
  i = e, o = this._worksheet;
2329
2329
  else if (typeof e == "string") {
2330
- const { range: a, sheetName: h } = Pn(e), c = h ? this._workbook.getSheetBySheetName(h) : this._worksheet;
2331
- if (!c)
2330
+ const { range: a, sheetName: h } = Pn(e), d = h ? this._workbook.getSheetBySheetName(h) : this._worksheet;
2331
+ if (!d)
2332
2332
  throw new Error("Range not found");
2333
- o = c, i = {
2333
+ o = d, i = {
2334
2334
  ...a,
2335
2335
  unitId: this._workbook.getUnitId(),
2336
2336
  sheetId: o.getSheetId(),
@@ -2445,7 +2445,7 @@ let v = class extends He {
2445
2445
  * ```
2446
2446
  */
2447
2447
  insertRowsAfter(e, t) {
2448
- const s = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), i = oe.DOWN, o = e + 1, a = e + t, h = 0, c = this._worksheet.getColumnCount() - 1, d = ae(this._worksheet, o, a, h, c, !0, e);
2448
+ const s = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), i = oe.DOWN, o = e + 1, a = e + t, h = 0, d = this._worksheet.getColumnCount() - 1, c = ae(this._worksheet, o, a, h, d, !0, e);
2449
2449
  return this._commandService.syncExecuteCommand(rt.id, {
2450
2450
  unitId: s,
2451
2451
  subUnitId: n,
@@ -2454,9 +2454,9 @@ let v = class extends He {
2454
2454
  startRow: o,
2455
2455
  endRow: a,
2456
2456
  startColumn: h,
2457
- endColumn: c
2457
+ endColumn: d
2458
2458
  },
2459
- cellValue: d
2459
+ cellValue: c
2460
2460
  }), this;
2461
2461
  }
2462
2462
  /**
@@ -2474,7 +2474,7 @@ let v = class extends He {
2474
2474
  * ```
2475
2475
  */
2476
2476
  insertRowsBefore(e, t) {
2477
- const s = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), i = oe.UP, o = e, a = e + t - 1, h = 0, c = this._worksheet.getColumnCount() - 1, d = ae(this._worksheet, o, a, h, c, !0, e - 1);
2477
+ const s = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), i = oe.UP, o = e, a = e + t - 1, h = 0, d = this._worksheet.getColumnCount() - 1, c = ae(this._worksheet, o, a, h, d, !0, e - 1);
2478
2478
  return this._commandService.syncExecuteCommand(rt.id, {
2479
2479
  unitId: s,
2480
2480
  subUnitId: n,
@@ -2483,9 +2483,9 @@ let v = class extends He {
2483
2483
  startRow: o,
2484
2484
  endRow: a,
2485
2485
  startColumn: h,
2486
- endColumn: c
2486
+ endColumn: d
2487
2487
  },
2488
- cellValue: d
2488
+ cellValue: c
2489
2489
  }), this;
2490
2490
  }
2491
2491
  /**
@@ -2741,12 +2741,12 @@ let v = class extends He {
2741
2741
  * ```
2742
2742
  */
2743
2743
  setRowHeights(e, t, s) {
2744
- var c;
2744
+ var d;
2745
2745
  const n = this._workbook.getUnitId(), i = this._worksheet.getSheetId(), o = this._worksheet.getRowManager(), a = [], h = [];
2746
- for (let d = e; d < e + t; d++) {
2747
- const l = ((c = o.getRow(d)) == null ? void 0 : c.ah) || this._worksheet.getConfig().defaultRowHeight, m = {
2748
- startRow: d,
2749
- endRow: d,
2746
+ for (let c = e; c < e + t; c++) {
2747
+ const l = ((d = o.getRow(c)) == null ? void 0 : d.ah) || this._worksheet.getConfig().defaultRowHeight, m = {
2748
+ startRow: c,
2749
+ endRow: c,
2750
2750
  startColumn: 0,
2751
2751
  endColumn: this._worksheet.getColumnCount() - 1
2752
2752
  };
@@ -2948,7 +2948,7 @@ let v = class extends He {
2948
2948
  * ```
2949
2949
  */
2950
2950
  insertColumnsAfter(e, t) {
2951
- const s = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), i = oe.RIGHT, o = 0, a = this._worksheet.getRowCount() - 1, h = e + 1, c = e + t, d = ae(this._worksheet, o, a, h, c, !1, e);
2951
+ const s = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), i = oe.RIGHT, o = 0, a = this._worksheet.getRowCount() - 1, h = e + 1, d = e + t, c = ae(this._worksheet, o, a, h, d, !1, e);
2952
2952
  return this._commandService.syncExecuteCommand(ht.id, {
2953
2953
  unitId: s,
2954
2954
  subUnitId: n,
@@ -2957,9 +2957,9 @@ let v = class extends He {
2957
2957
  startRow: o,
2958
2958
  endRow: a,
2959
2959
  startColumn: h,
2960
- endColumn: c
2960
+ endColumn: d
2961
2961
  },
2962
- cellValue: d
2962
+ cellValue: c
2963
2963
  }), this;
2964
2964
  }
2965
2965
  /**
@@ -2977,7 +2977,7 @@ let v = class extends He {
2977
2977
  * ```
2978
2978
  */
2979
2979
  insertColumnsBefore(e, t) {
2980
- const s = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), i = oe.LEFT, o = 0, a = this._worksheet.getRowCount() - 1, h = e, c = e + t - 1, d = ae(this._worksheet, o, a, h, c, !1, e - 1);
2980
+ const s = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), i = oe.LEFT, o = 0, a = this._worksheet.getRowCount() - 1, h = e, d = e + t - 1, c = ae(this._worksheet, o, a, h, d, !1, e - 1);
2981
2981
  return this._commandService.syncExecuteCommand(ht.id, {
2982
2982
  unitId: s,
2983
2983
  subUnitId: n,
@@ -2986,9 +2986,9 @@ let v = class extends He {
2986
2986
  startRow: o,
2987
2987
  endRow: a,
2988
2988
  startColumn: h,
2989
- endColumn: c
2989
+ endColumn: d
2990
2990
  },
2991
- cellValue: d
2991
+ cellValue: c
2992
2992
  }), this;
2993
2993
  }
2994
2994
  /**
@@ -4973,11 +4973,11 @@ let R = (q = class extends He {
4973
4973
  if (e)
4974
4974
  return this.getValueAndRichTextValues();
4975
4975
  const { startRow: t, endRow: s, startColumn: n, endColumn: i } = this._range, o = [];
4976
- for (let c = t; c <= s; c++) {
4977
- const d = [];
4976
+ for (let d = t; d <= s; d++) {
4977
+ const c = [];
4978
4978
  for (let l = n; l <= i; l++)
4979
- d.push((h = (a = this._worksheet.getCell(c, l)) == null ? void 0 : a.v) != null ? h : null);
4980
- o.push(d);
4979
+ c.push((h = (a = this._worksheet.getCell(d, l)) == null ? void 0 : a.v) != null ? h : null);
4980
+ o.push(c);
4981
4981
  }
4982
4982
  return o;
4983
4983
  }
@@ -5026,13 +5026,13 @@ let R = (q = class extends He {
5026
5026
  getRawValues() {
5027
5027
  var a, h;
5028
5028
  const e = this._worksheet.getCellMatrix(), { startRow: t, endRow: s, startColumn: n, endColumn: i } = this._range, o = [];
5029
- for (let c = t; c <= s; c++) {
5030
- const d = [];
5029
+ for (let d = t; d <= s; d++) {
5030
+ const c = [];
5031
5031
  for (let l = n; l <= i; l++) {
5032
- const m = e.getValue(c, l);
5033
- m != null && m.p && ((a = m.p.body) != null && a.dataStream) ? d.push(m.p.body.dataStream) : d.push((h = m == null ? void 0 : m.v) != null ? h : null);
5032
+ const m = e.getValue(d, l);
5033
+ m != null && m.p && ((a = m.p.body) != null && a.dataStream) ? c.push(m.p.body.dataStream) : c.push((h = m == null ? void 0 : m.v) != null ? h : null);
5034
5034
  }
5035
- o.push(d);
5035
+ o.push(c);
5036
5036
  }
5037
5037
  return o;
5038
5038
  }
@@ -5081,13 +5081,13 @@ let R = (q = class extends He {
5081
5081
  getDisplayValues() {
5082
5082
  var o, a, h;
5083
5083
  const { startRow: e, endRow: t, startColumn: s, endColumn: n } = this._range, i = [];
5084
- for (let c = e; c <= t; c++) {
5085
- const d = [];
5084
+ for (let d = e; d <= t; d++) {
5085
+ const c = [];
5086
5086
  for (let l = s; l <= n; l++) {
5087
- const m = this._worksheet.getCell(c, l);
5088
- m != null && m.p && ((o = m.p.body) != null && o.dataStream) ? d.push(m.p.body.dataStream) : d.push((h = (a = m == null ? void 0 : m.v) == null ? void 0 : a.toString()) != null ? h : "");
5087
+ const m = this._worksheet.getCell(d, l);
5088
+ m != null && m.p && ((o = m.p.body) != null && o.dataStream) ? c.push(m.p.body.dataStream) : c.push((h = (a = m == null ? void 0 : m.v) == null ? void 0 : a.toString()) != null ? h : "");
5089
5089
  }
5090
- i.push(d);
5090
+ i.push(c);
5091
5091
  }
5092
5092
  return i;
5093
5093
  }
@@ -5239,12 +5239,12 @@ let R = (q = class extends He {
5239
5239
  getFormulas() {
5240
5240
  const e = [], { startRow: t, endRow: s, startColumn: n, endColumn: i } = this._range, o = this._worksheet.getSheetId(), a = this._workbook.getUnitId();
5241
5241
  for (let h = t; h <= s; h++) {
5242
- const c = [];
5243
- for (let d = n; d <= i; d++) {
5244
- const l = this._formulaDataModel.getFormulaStringByCell(h, d, o, a);
5245
- c.push(l || "");
5242
+ const d = [];
5243
+ for (let c = n; c <= i; c++) {
5244
+ const l = this._formulaDataModel.getFormulaStringByCell(h, c, o, a);
5245
+ d.push(l || "");
5246
5246
  }
5247
- e.push(c);
5247
+ e.push(d);
5248
5248
  }
5249
5249
  return e;
5250
5250
  }
@@ -6582,22 +6582,22 @@ let R = (q = class extends He {
6582
6582
  // eslint-disable-next-line complexity
6583
6583
  getDataRegion(e) {
6584
6584
  const { startRow: t, startColumn: s, endRow: n, endColumn: i } = this._range, o = this._worksheet.getMaxRows(), a = this._worksheet.getMaxColumns(), h = this._worksheet.getCellMatrix();
6585
- let c = t, d = s, l = n, m = i;
6585
+ let d = t, c = s, l = n, m = i;
6586
6586
  if (e !== G.COLUMNS) {
6587
6587
  let S = !1, C = !1;
6588
6588
  for (let f = s; f <= i && (t > 0 && !Q(h.getValue(t - 1, f)) && (S = !0), n < o - 1 && !Q(h.getValue(n + 1, f)) && (C = !0), !(S && C)); f++)
6589
6589
  ;
6590
- S && (c = t - 1), C && (l = n + 1);
6590
+ S && (d = t - 1), C && (l = n + 1);
6591
6591
  }
6592
6592
  if (e !== G.ROWS) {
6593
6593
  let S = !1, C = !1;
6594
6594
  for (let f = t; f <= n && (s > 0 && !Q(h.getValue(f, s - 1)) && (S = !0), i < a - 1 && !Q(h.getValue(f, i + 1)) && (C = !0), !(S && C)); f++)
6595
6595
  ;
6596
- S && (d = s - 1), C && (m = i + 1);
6596
+ S && (c = s - 1), C && (m = i + 1);
6597
6597
  }
6598
6598
  return this._injector.createInstance(R, this._workbook, this._worksheet, {
6599
- startRow: c,
6600
- startColumn: d,
6599
+ startRow: d,
6600
+ startColumn: c,
6601
6601
  endRow: l,
6602
6602
  endColumn: m
6603
6603
  });
@@ -6652,12 +6652,12 @@ let R = (q = class extends He {
6652
6652
  * ```
6653
6653
  */
6654
6654
  offset(e, t, s, n) {
6655
- const { startRow: i, startColumn: o, endRow: a, endColumn: h } = this._range, c = i + e, d = o + t, l = s ? c + s - 1 : a + e, m = n ? d + n - 1 : h + t;
6656
- if (c < 0 || d < 0 || l < 0 || m < 0)
6655
+ const { startRow: i, startColumn: o, endRow: a, endColumn: h } = this._range, d = i + e, c = o + t, l = s ? d + s - 1 : a + e, m = n ? c + n - 1 : h + t;
6656
+ if (d < 0 || c < 0 || l < 0 || m < 0)
6657
6657
  throw new Error("The row or column index is out of range");
6658
6658
  return this._injector.createInstance(R, this._workbook, this._worksheet, {
6659
- startRow: c,
6660
- startColumn: d,
6659
+ startRow: d,
6660
+ startColumn: c,
6661
6661
  endRow: l,
6662
6662
  endColumn: m
6663
6663
  });
@@ -6779,12 +6779,12 @@ let R = (q = class extends He {
6779
6779
  const s = this.getRange(), n = e.getRange();
6780
6780
  if (!B.contains(n, s))
6781
6781
  throw new Error("AutoFill target range must contain source range");
6782
- const { startRow: i, startColumn: o, endRow: a, endColumn: h } = s, { startRow: c, startColumn: d, endRow: l, endColumn: m } = n;
6783
- if (a - i !== l - c && h - o !== m - d)
6782
+ const { startRow: i, startColumn: o, endRow: a, endColumn: h } = s, { startRow: d, startColumn: c, endRow: l, endColumn: m } = n;
6783
+ if (a - i !== l - d && h - o !== m - c)
6784
6784
  throw new Error("AutoFill can only fill in one direction");
6785
- if (a - i === l - c && o !== d && h !== m)
6785
+ if (a - i === l - d && o !== c && h !== m)
6786
6786
  throw new Error("AutoFill can only fill in one direction");
6787
- if (h - o === m - d && i !== c && a !== l)
6787
+ if (h - o === m - c && i !== d && a !== l)
6788
6788
  throw new Error("AutoFill can only fill in one direction");
6789
6789
  return this._commandService.executeCommand(_n.id, {
6790
6790
  sourceRange: s,
@@ -7259,10 +7259,10 @@ var er = Object.getOwnPropertyDescriptor, tr = (r, e, t, s) => {
7259
7259
  return n;
7260
7260
  }, j = (r, e) => (t, s) => e(t, s, r);
7261
7261
  let E = class extends He {
7262
- constructor(e, t, s, n, i, o, a, h, c, d) {
7262
+ constructor(e, t, s, n, i, o, a, h, d, c) {
7263
7263
  super(t);
7264
7264
  w(this, "id");
7265
- this._workbook = e, this._injector = t, this._resourceLoaderService = s, this._selectionManagerService = n, this._univerInstanceService = i, this._commandService = o, this._permissionService = a, this._logService = h, this._localeService = c, this._definedNamesService = d, this.id = this._workbook.getUnitId();
7265
+ this._workbook = e, this._injector = t, this._resourceLoaderService = s, this._selectionManagerService = n, this._univerInstanceService = i, this._commandService = o, this._permissionService = a, this._logService = h, this._localeService = d, this._definedNamesService = c, this.id = this._workbook.getUnitId();
7266
7266
  }
7267
7267
  /**
7268
7268
  * Get the Workbook instance.
@@ -7419,10 +7419,10 @@ let E = class extends He {
7419
7419
  * ```
7420
7420
  */
7421
7421
  create(e, t, s, n) {
7422
- var h, c, d;
7422
+ var h, d, c;
7423
7423
  const i = Xe(et.deepClone((h = n == null ? void 0 : n.sheet) != null ? h : {}));
7424
- i.name = this._workbook.uniqueSheetName(e), i.rowCount = t, i.columnCount = s, i.id = (c = n == null ? void 0 : n.sheet) == null ? void 0 : c.id;
7425
- const o = (d = n == null ? void 0 : n.index) != null ? d : this._workbook.getSheets().length;
7424
+ i.name = this._workbook.uniqueSheetName(e), i.rowCount = t, i.columnCount = s, i.id = (d = n == null ? void 0 : n.sheet) == null ? void 0 : d.id;
7425
+ const o = (c = n == null ? void 0 : n.index) != null ? c : this._workbook.getSheets().length;
7426
7426
  this._commandService.syncExecuteCommand(ge.id, {
7427
7427
  unitId: this.id,
7428
7428
  index: o,
@@ -8282,13 +8282,13 @@ class sr extends Rt {
8282
8282
  () => s.beforeCommandExecuted((n) => {
8283
8283
  var i;
8284
8284
  if (n.id === ge.id) {
8285
- const o = n.params, { unitId: a, index: h, sheet: c } = o || {}, d = a ? this.getUniverSheet(a) : (i = this.getActiveWorkbook) == null ? void 0 : i.call(this);
8286
- if (!d)
8285
+ const o = n.params, { unitId: a, index: h, sheet: d } = o || {}, c = a ? this.getUniverSheet(a) : (i = this.getActiveWorkbook) == null ? void 0 : i.call(this);
8286
+ if (!c)
8287
8287
  return;
8288
8288
  const l = {
8289
- workbook: d,
8289
+ workbook: c,
8290
8290
  index: h,
8291
- sheet: c
8291
+ sheet: d
8292
8292
  };
8293
8293
  if (this.fireEvent(this.Event.BeforeSheetCreate, l), l.cancel)
8294
8294
  throw new D();
@@ -8303,12 +8303,12 @@ class sr extends Rt {
8303
8303
  if (n.id === te.id) {
8304
8304
  const { subUnitId: o, unitId: a } = n.params, h = a ? this.getUniverSheet(a) : (i = this.getActiveWorkbook) == null ? void 0 : i.call(this);
8305
8305
  if (!h || !o) return;
8306
- const c = h.getSheetBySheetId(o), d = h.getActiveSheet();
8307
- if (!c || !d) return;
8306
+ const d = h.getSheetBySheetId(o), c = h.getActiveSheet();
8307
+ if (!d || !c) return;
8308
8308
  const l = {
8309
8309
  workbook: h,
8310
- activeSheet: c,
8311
- oldActiveSheet: d
8310
+ activeSheet: d,
8311
+ oldActiveSheet: c
8312
8312
  };
8313
8313
  if (this.fireEvent(this.Event.BeforeActiveSheetChange, l), l.cancel)
8314
8314
  throw new D();
@@ -8423,15 +8423,15 @@ class sr extends Rt {
8423
8423
  this.registerEventHandler(
8424
8424
  this.Event.BeforeGridlineEnableChange,
8425
8425
  () => s.beforeCommandExecuted((n) => {
8426
- var i;
8426
+ var i, o;
8427
8427
  if (n.id === je.id) {
8428
- const o = this.getCommandSheetTarget(n);
8429
- if (!o) return;
8430
- const a = {
8431
- ...o,
8432
- enabled: !!((i = n.params) != null && i.showGridlines)
8428
+ const a = this.getCommandSheetTarget(n);
8429
+ if (!a) return;
8430
+ const h = (o = (i = n.params) == null ? void 0 : i.showGridlines) != null ? o : !a.worksheet.hasHiddenGridLines(), d = {
8431
+ ...a,
8432
+ enabled: !!h
8433
8433
  };
8434
- if (this.fireEvent(this.Event.BeforeGridlineEnableChange, a), a.cancel)
8434
+ if (this.fireEvent(this.Event.BeforeGridlineEnableChange, d), d.cancel)
8435
8435
  throw new D();
8436
8436
  }
8437
8437
  })
@@ -8444,8 +8444,8 @@ class sr extends Rt {
8444
8444
  if (!this.getActiveSheet()) return;
8445
8445
  const o = vn(t, n).map(
8446
8446
  (a) => {
8447
- var h, c;
8448
- return (c = (h = this.getWorkbook(a.unitId)) == null ? void 0 : h.getSheetBySheetId(a.subUnitId)) == null ? void 0 : c.getRange(a.range);
8447
+ var h, d;
8448
+ return (d = (h = this.getWorkbook(a.unitId)) == null ? void 0 : h.getSheetBySheetId(a.subUnitId)) == null ? void 0 : d.getRange(a.range);
8449
8449
  }
8450
8450
  ).filter(Boolean);
8451
8451
  if (!o.length) return;
@@ -8465,16 +8465,16 @@ class sr extends Rt {
8465
8465
  const o = n.params, { unitId: a } = o || {}, h = a ? this.getUniverSheet(a) : (i = this.getActiveWorkbook) == null ? void 0 : i.call(this);
8466
8466
  if (!h)
8467
8467
  return;
8468
- const c = h.getActiveSheet();
8469
- if (!c)
8468
+ const d = h.getActiveSheet();
8469
+ if (!d)
8470
8470
  return;
8471
- const d = {
8471
+ const c = {
8472
8472
  workbook: h,
8473
- worksheet: c
8473
+ worksheet: d
8474
8474
  };
8475
8475
  this.fireEvent(
8476
8476
  this.Event.SheetCreated,
8477
- d
8477
+ c
8478
8478
  );
8479
8479
  }
8480
8480
  })