@univerjs/sheets 0.10.6 → 0.10.7

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,9 +1,9 @@
1
1
  var tt = Object.defineProperty;
2
2
  var nt = (r, e, t) => e in r ? tt(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
- var p = (r, e, t) => nt(r, typeof e != "symbol" ? e + "" : e, t);
4
- import { Inject as g, Injector as P, ICommandService as m, IPermissionService as ue, IAuthzIoService as Fe, LocaleService as He, generateRandomId as Oe, Rectangle as x, cellToRange as rt, RANGE_TYPE as k, HorizontalAlign as T, VerticalAlign as A, TextStyleValue as we, RichTextValue as M, BooleanNumber as l, WrapStrategy as L, DEFAULT_STYLES as ke, covertCellValue as re, covertCellValues as Se, Dimension as N, isNullCell as D, ILogService as je, Direction as H, ObjectMatrix as J, IResourceLoaderService as st, IUniverInstanceService as se, mergeWorksheetSnapshotWithDefault as Ce, Tools as ve, UndoCommand as ot, RedoCommand as it, toDisposable as Le, UniverInstanceType as U, CanceledError as f } from "@univerjs/core";
3
+ var E = (r, e, t) => nt(r, typeof e != "symbol" ? e + "" : e, t);
4
+ import { Inject as g, Injector as x, ICommandService as m, IPermissionService as ue, IAuthzIoService as Fe, LocaleService as He, generateRandomId as Oe, Rectangle as P, cellToRange as rt, RANGE_TYPE as k, HorizontalAlign as T, VerticalAlign as A, TextStyleValue as we, RichTextValue as M, BooleanNumber as l, WrapStrategy as L, DEFAULT_STYLES as ke, covertCellValue as re, covertCellValues as Se, Dimension as N, isNullCell as D, ILogService as je, Direction as H, ObjectMatrix as J, IResourceLoaderService as st, IUniverInstanceService as se, mergeWorksheetSnapshotWithDefault as Ce, Tools as ve, UndoCommand as ot, RedoCommand as it, toDisposable as Le, UniverInstanceType as U, CanceledError as f } from "@univerjs/core";
5
5
  import { FBase as ge, FBaseInitialable as le, FUniver as ze, FEnum as at, FEventName as ht } from "@univerjs/core/facade";
6
- import { WorksheetProtectionRuleModel as Ge, RangeProtectionRuleModel as $e, WorksheetProtectionPointModel as qe, SCOPE_WORKBOOK_VALUE_DEFINED_NAME as F, SetDefinedNameCommand as oe, RemoveDefinedNameCommand as dt, PermissionPointsDefinitions as ct, WorkbookEditablePermission as Ke, UnitObject as W, AddWorksheetProtectionMutation as ut, DeleteWorksheetProtectionMutation as gt, getAllWorksheetPermissionPoint as lt, getAllWorksheetPermissionPointByPointPanel as fe, SetWorksheetPermissionPointsMutation as mt, AddRangeProtectionMutation as _t, DeleteRangeProtectionMutation as wt, SetRangeProtectionMutation as kt, WorksheetEditPermission as St, WorksheetViewPermission as Ct, SetBorderBasicCommand as vt, SetStyleCommand as b, SetTextRotationCommand as ft, SetRangeValuesCommand as B, SetTextWrapCommand as ie, SetVerticalTextAlignCommand as It, SetHorizontalTextAlignCommand as Rt, addMergeCellsUtil as Q, getAddMergeMutationRangeByType as Ie, RemoveWorksheetMergeCommand as bt, getPrimaryForRange as z, SetSelectionsOperation as me, SplitTextToColumnsCommand as Et, SetWorksheetRangeThemeStyleCommand as pt, DeleteWorksheetRangeThemeStyleCommand as yt, SheetRangeThemeService as Ye, ClearSelectionAllCommand as Je, ClearSelectionContentCommand as Qe, ClearSelectionFormatCommand as Xe, InsertRangeMoveDownCommand as Ut, InsertRangeMoveRightCommand as xt, DeleteRangeMoveUpCommand as Pt, DeleteRangeMoveLeftCommand as Mt, getNextPrimaryCell as Nt, SheetsSelectionsService as Ze, SetWorksheetDefaultStyleMutation as Tt, SetColDataCommand as Re, SetRowDataCommand as be, copyRangeStyles as O, InsertRowByRangeCommand as Ee, RemoveRowByRangeCommand as At, MoveRowsCommand as Dt, SetRowHiddenCommand as pe, SetSpecificRowsVisibleCommand as ye, SetWorksheetRowIsAutoHeightMutation as Wt, SetRowHeightCommand as Ue, SetWorksheetRowIsAutoHeightCommand as X, InsertColByRangeCommand as xe, RemoveColByRangeCommand as Bt, MoveColsCommand as Vt, SetColHiddenCommand as Pe, SetSpecificColsVisibleCommand as Me, SetColWidthCommand as Ft, SetFrozenCommand as Z, CancelFrozenCommand as Ht, ToggleGridlinesCommand as ae, SetGridlinesColorCommand as he, SetTabColorCommand as Ot, SetRangeValuesMutation as Ne, SetWorksheetHideCommand as jt, SetWorksheetShowCommand as Lt, SetWorksheetNameCommand as de, AppendRowCommand as zt, SetWorksheetRowCountCommand as Gt, SetWorksheetColumnCountCommand as $t, SetWorkbookNameCommand as qt, InsertSheetCommand as G, SetWorksheetActiveOperation as V, RemoveSheetCommand as ce, CopySheetCommand as Kt, SetWorksheetOrderCommand as Yt, RegisterWorksheetRangeThemeStyleCommand as Jt, UnregisterWorksheetRangeThemeStyleCommand as Qt, RangeThemeStyle as Xt, SetWorksheetOrderMutation as Te, SetTabColorMutation as Ae, SetWorksheetHideMutation as De, COMMAND_LISTENER_VALUE_CHANGE as Zt, getValueChangedEffectedRange as en, SheetValueChangeType as tn, SheetSkeletonChangeType as nn, SplitDelimiterEnum as rn } from "@univerjs/sheets";
6
+ import { WorksheetProtectionRuleModel as Ge, RangeProtectionRuleModel as $e, WorksheetProtectionPointModel as qe, SCOPE_WORKBOOK_VALUE_DEFINED_NAME as F, SetDefinedNameCommand as oe, RemoveDefinedNameCommand as dt, PermissionPointsDefinitions as ct, WorkbookEditablePermission as Ke, UnitObject as W, AddWorksheetProtectionMutation as ut, DeleteWorksheetProtectionMutation as gt, getAllWorksheetPermissionPoint as lt, getAllWorksheetPermissionPointByPointPanel as fe, SetWorksheetPermissionPointsMutation as mt, AddRangeProtectionMutation as _t, DeleteRangeProtectionMutation as wt, SetRangeProtectionMutation as kt, WorksheetEditPermission as St, WorksheetViewPermission as Ct, SetBorderBasicCommand as vt, SetStyleCommand as b, SetTextRotationCommand as ft, SetRangeValuesCommand as B, SetTextWrapCommand as ie, SetVerticalTextAlignCommand as It, SetHorizontalTextAlignCommand as Rt, addMergeCellsUtil as Q, getAddMergeMutationRangeByType as Ie, RemoveWorksheetMergeCommand as bt, getPrimaryForRange as z, SetSelectionsOperation as me, SplitTextToColumnsCommand as pt, SetWorksheetRangeThemeStyleCommand as Et, DeleteWorksheetRangeThemeStyleCommand as yt, SheetRangeThemeService as Ye, ClearSelectionAllCommand as Je, ClearSelectionContentCommand as Qe, ClearSelectionFormatCommand as Xe, InsertRangeMoveDownCommand as Ut, InsertRangeMoveRightCommand as Pt, DeleteRangeMoveUpCommand as xt, DeleteRangeMoveLeftCommand as Mt, getNextPrimaryCell as Nt, SheetsSelectionsService as Ze, SetWorksheetDefaultStyleMutation as Tt, SetColDataCommand as Re, SetRowDataCommand as be, copyRangeStyles as O, InsertRowByRangeCommand as pe, RemoveRowByRangeCommand as At, MoveRowsCommand as Dt, SetRowHiddenCommand as Ee, SetSpecificRowsVisibleCommand as ye, SetWorksheetRowIsAutoHeightMutation as Wt, SetRowHeightCommand as Ue, SetWorksheetRowIsAutoHeightCommand as X, InsertColByRangeCommand as Pe, RemoveColByRangeCommand as Bt, MoveColsCommand as Vt, SetColHiddenCommand as xe, SetSpecificColsVisibleCommand as Me, SetColWidthCommand as Ft, SetFrozenCommand as Z, CancelFrozenCommand as Ht, ToggleGridlinesCommand as ae, SetGridlinesColorCommand as he, SetTabColorCommand as Ot, SetRangeValuesMutation as Ne, SetWorksheetHideCommand as jt, SetWorksheetShowCommand as Lt, SetWorksheetNameCommand as de, AppendRowCommand as zt, SetWorksheetRowCountCommand as Gt, SetWorksheetColumnCountCommand as $t, SetWorkbookNameCommand as qt, InsertSheetCommand as G, SetWorksheetActiveOperation as V, RemoveSheetCommand as ce, CopySheetCommand as Kt, SetWorksheetOrderCommand as Yt, RegisterWorksheetRangeThemeStyleCommand as Jt, UnregisterWorksheetRangeThemeStyleCommand as Qt, RangeThemeStyle as Xt, SetWorksheetOrderMutation as Te, SetTabColorMutation as Ae, SetWorksheetHideMutation as De, COMMAND_LISTENER_VALUE_CHANGE as Zt, getValueChangedEffectedRange as en, SheetValueChangeType as tn, SheetSkeletonChangeType as nn, SplitDelimiterEnum as rn } from "@univerjs/sheets";
7
7
  import { IDefinedNamesService as et, serializeRange as _e, FormulaDataModel as sn, serializeRangeWithSheet as on, deserializeRangeWithSheet as an } from "@univerjs/engine-formula";
8
8
  var hn = Object.getOwnPropertyDescriptor, dn = (r, e, t, n) => {
9
9
  for (var s = n > 1 ? void 0 : n ? hn(e, t) : e, o = r.length - 1, i; o >= 0; o--)
@@ -27,7 +27,7 @@ function cn(r, e, t) {
27
27
  }
28
28
  class Y {
29
29
  constructor() {
30
- p(this, "_definedNameParam");
30
+ E(this, "_definedNameParam");
31
31
  this._definedNameParam = {
32
32
  id: Oe(10),
33
33
  unitId: "",
@@ -448,7 +448,7 @@ let $ = class extends ge {
448
448
  }
449
449
  };
450
450
  $ = dn([
451
- I(1, g(P)),
451
+ I(1, g(x)),
452
452
  I(2, m),
453
453
  I(3, ue),
454
454
  I(4, g(Ge)),
@@ -469,15 +469,15 @@ let q = class extends ge {
469
469
  /**
470
470
  * Permission point definition, can read the point constructor want to modify from here
471
471
  */
472
- p(this, "permissionPointsDefinition", ct);
472
+ E(this, "permissionPointsDefinition", ct);
473
473
  /**
474
474
  * An observable object used to monitor permission change events within a range, thereby triggering corresponding subsequent processing.
475
475
  */
476
- p(this, "rangeRuleChangedAfterAuth$");
476
+ E(this, "rangeRuleChangedAfterAuth$");
477
477
  /**
478
478
  * An observable object used to monitor permission change events within a worksheet, thereby triggering corresponding subsequent processing.
479
479
  */
480
- p(this, "sheetRuleChangedAfterAuth$");
480
+ E(this, "sheetRuleChangedAfterAuth$");
481
481
  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$;
482
482
  }
483
483
  /**
@@ -500,6 +500,26 @@ let q = class extends ge {
500
500
  const s = new t(e);
501
501
  this._permissionService.getPermissionPoint(s.id) || this._permissionService.addPermissionPoint(s), this._permissionService.updatePermissionPoint(s.id, n);
502
502
  }
503
+ /**
504
+ * Check if a specific permission point is enabled for a workbook.
505
+ * @param unitId - The unique identifier of the workbook.
506
+ * @param FPointClass - The constructor for the permission point class.
507
+ * See the [permission-point documentation](https://github.com/dream-num/univer/tree/dev/packages/sheets/src/services/permission/permission-point) for more details.
508
+ * @example
509
+ * ```typescript
510
+ * const workbook = univerAPI.getActiveWorkbook();
511
+ * const permission = workbook.getPermission();
512
+ * const unitId = workbook.getId();
513
+ * // Check if the workbook is editable
514
+ * const isEditable = permission.checkWorkbookPermissionPoint(unitId, permission.permissionPointsDefinition.WorkbookEditablePermission);
515
+ * console.log('Workbook is editable:', isEditable);
516
+ * ```
517
+ */
518
+ checkWorkbookPermissionPoint(e, t) {
519
+ const n = new t(e), s = this._permissionService.getPermissionPoint(n.id);
520
+ if (s)
521
+ return s.value;
522
+ }
503
523
  /**
504
524
  * This function is used to set whether the workbook can be edited
505
525
  * @param {string} unitId - The unique identifier of the workbook for which the permission is being set.
@@ -636,6 +656,30 @@ let q = class extends ge {
636
656
  const h = new n(e, t);
637
657
  return this._permissionService.getPermissionPoint(h.id) || this._permissionService.addPermissionPoint(h), this._permissionService.updatePermissionPoint(h.id, s), i;
638
658
  }
659
+ /**
660
+ * Check if a specific permission point is enabled for a worksheet.
661
+ * @param unitId - The unique identifier of the workbook.
662
+ * @param subUnitId - The unique identifier of the worksheet.
663
+ * @param FPointClass - The constructor for the permission point class.
664
+ * See the [permission-point documentation](https://github.com/dream-num/univer/tree/dev/packages/sheets/src/services/permission/permission-point) for more details.
665
+ * @returns {boolean | undefined} - Returns true if the permission point is enabled, false if it is disabled, or undefined if the permission point does not exist.
666
+ * @example
667
+ * ```typescript
668
+ * const workbook = univerAPI.getActiveWorkbook();
669
+ * const permission = workbook.getPermission();
670
+ * const unitId = workbook.getId();
671
+ * const worksheet = workbook.getActiveSheet();
672
+ * const subUnitId = worksheet.getSheetId();
673
+ * // Check if the worksheet is editable
674
+ * const isEditable = permission.checkWorksheetPermissionPoint(unitId, subUnitId, permission.permissionPointsDefinition.WorksheetEditPermission);
675
+ * console.log('Worksheet is editable:', isEditable);
676
+ * ```
677
+ */
678
+ checkWorksheetPermissionPoint(e, t, n) {
679
+ const s = new n(e, t), o = this._permissionService.getPermissionPoint(s.id);
680
+ if (o)
681
+ return o.value;
682
+ }
639
683
  /**
640
684
  * Adds a range protection to the worksheet.
641
685
  * Note that after adding, only the background mask of the permission module will be rendered. If you want to modify the function permissions,
@@ -674,7 +718,7 @@ let q = class extends ge {
674
718
  }), o = `ruleId_${Oe(6)}`;
675
719
  if (this._worksheetProtectionRuleModel.getRule(e, t))
676
720
  throw new Error("sheet protection cannot intersect with range protection");
677
- if (this._rangeProtectionRuleModel.getSubunitRuleList(e, t).some((c) => c.ranges.some((u) => n.some((w) => x.intersects(w.getRange(), u)))))
721
+ if (this._rangeProtectionRuleModel.getSubunitRuleList(e, t).some((c) => c.ranges.some((u) => n.some((w) => P.intersects(w.getRange(), u)))))
678
722
  throw new Error("range protection cannot intersect");
679
723
  if (this._commandService.syncExecuteCommand(_t.id, {
680
724
  unitId: e,
@@ -785,7 +829,7 @@ let q = class extends ge {
785
829
  setRangeProtectionRanges(e, t, n, s) {
786
830
  const o = this._rangeProtectionRuleModel.getRule(e, t, n);
787
831
  if (o) {
788
- if (this._rangeProtectionRuleModel.getSubunitRuleList(e, t).filter((h) => h.id !== n).some((h) => h.ranges.some((d) => s.some((c) => x.intersects(c.getRange(), d)))))
832
+ if (this._rangeProtectionRuleModel.getSubunitRuleList(e, t).filter((h) => h.id !== n).some((h) => h.ranges.some((d) => s.some((c) => P.intersects(c.getRange(), d)))))
789
833
  throw new Error("range protection cannot intersect");
790
834
  this._commandService.syncExecuteCommand(kt.id, {
791
835
  unitId: e,
@@ -836,7 +880,7 @@ let q = class extends ge {
836
880
  * ```
837
881
  */
838
882
  getPermissionInfoWithCell(e, t, n, s) {
839
- const o = rt(n, s), i = this._rangeProtectionRuleModel.getSubunitRuleList(e, t).find((a) => a.ranges.some((d) => x.intersects(o, d)));
883
+ const o = rt(n, s), i = this._rangeProtectionRuleModel.getSubunitRuleList(e, t).find((a) => a.ranges.some((d) => P.intersects(o, d)));
840
884
  if (i)
841
885
  return {
842
886
  permissionId: i.permissionId,
@@ -845,7 +889,7 @@ let q = class extends ge {
845
889
  }
846
890
  };
847
891
  q = gn([
848
- y(0, g(P)),
892
+ y(0, g(x)),
849
893
  y(1, m),
850
894
  y(2, ue),
851
895
  y(3, g(Ge)),
@@ -1086,7 +1130,7 @@ let _ = class extends le {
1086
1130
  */
1087
1131
  isMerged() {
1088
1132
  const { startColumn: r, startRow: e, endColumn: t, endRow: n } = this._range;
1089
- return this._worksheet.getMergedCellRange(e, r, n, t).some((o) => x.equals(o, this._range));
1133
+ return this._worksheet.getMergedCellRange(e, r, n, t).some((o) => P.equals(o, this._range));
1090
1134
  }
1091
1135
  /**
1092
1136
  * Return first cell style data in this range. Please note that if there are row styles, col styles and (or)
@@ -2459,11 +2503,11 @@ let _ = class extends le {
2459
2503
  */
2460
2504
  activateAsCurrentCell() {
2461
2505
  const r = this._worksheet.getMergedCell(this._range.startRow, this._range.startColumn);
2462
- if (r && x.equals(r, this._range) || !r && this._range.startRow === this._range.endRow && this._range.startColumn === this._range.endColumn) {
2506
+ if (r && P.equals(r, this._range) || !r && this._range.startRow === this._range.endRow && this._range.startColumn === this._range.endColumn) {
2463
2507
  const n = this._injector.createInstance(C, this._workbook).getActiveRange();
2464
2508
  if (!n || n.getUnitId() !== this.getUnitId() || n.getSheetId() !== this.getSheetId())
2465
2509
  return this.activate();
2466
- if (x.contains(n.getRange(), this._range)) {
2510
+ if (P.contains(n.getRange(), this._range)) {
2467
2511
  const s = {
2468
2512
  unitId: this.getUnitId(),
2469
2513
  subUnitId: this.getSheetId(),
@@ -2516,7 +2560,7 @@ let _ = class extends le {
2516
2560
  * ```
2517
2561
  */
2518
2562
  splitTextToColumns(r, e, t) {
2519
- this._commandService.syncExecuteCommand(Et.id, {
2563
+ this._commandService.syncExecuteCommand(pt.id, {
2520
2564
  unitId: this._workbook.getUnitId(),
2521
2565
  subUnitId: this._worksheet.getSheetId(),
2522
2566
  range: this._range,
@@ -2541,7 +2585,7 @@ let _ = class extends le {
2541
2585
  const e = this.getUsedThemeStyle();
2542
2586
  e && this.removeThemeStyle(e);
2543
2587
  } else
2544
- this._commandService.syncExecuteCommand(pt.id, {
2588
+ this._commandService.syncExecuteCommand(Et.id, {
2545
2589
  unitId: this._workbook.getUnitId(),
2546
2590
  subUnitId: this._worksheet.getSheetId(),
2547
2591
  range: this._range,
@@ -2711,7 +2755,7 @@ let _ = class extends le {
2711
2755
  insertCells(r) {
2712
2756
  r === N.ROWS ? this._commandService.executeCommand(Ut.id, {
2713
2757
  range: this._range
2714
- }) : this._commandService.executeCommand(xt.id, {
2758
+ }) : this._commandService.executeCommand(Pt.id, {
2715
2759
  range: this._range
2716
2760
  });
2717
2761
  }
@@ -2771,7 +2815,7 @@ let _ = class extends le {
2771
2815
  * ```
2772
2816
  */
2773
2817
  deleteCells(r) {
2774
- r === N.ROWS ? this._commandService.executeCommand(Pt.id, {
2818
+ r === N.ROWS ? this._commandService.executeCommand(xt.id, {
2775
2819
  range: this._range
2776
2820
  }) : this._commandService.executeCommand(Mt.id, {
2777
2821
  range: this._range
@@ -2818,16 +2862,16 @@ let _ = class extends le {
2818
2862
  const { startRow: e, startColumn: t, endRow: n, endColumn: s } = this._range, o = this._worksheet.getMaxRows(), i = this._worksheet.getMaxColumns(), a = this._worksheet.getCellMatrix();
2819
2863
  let h = e, d = t, c = n, u = s;
2820
2864
  if (r !== N.COLUMNS) {
2821
- let w = !1, E = !1;
2822
- for (let v = t; v <= s && (e > 0 && !D(a.getValue(e - 1, v)) && (w = !0), n < o - 1 && !D(a.getValue(n + 1, v)) && (E = !0), !(w && E)); v++)
2865
+ let w = !1, p = !1;
2866
+ for (let v = t; v <= s && (e > 0 && !D(a.getValue(e - 1, v)) && (w = !0), n < o - 1 && !D(a.getValue(n + 1, v)) && (p = !0), !(w && p)); v++)
2823
2867
  ;
2824
- w && (h = e - 1), E && (c = n + 1);
2868
+ w && (h = e - 1), p && (c = n + 1);
2825
2869
  }
2826
2870
  if (r !== N.ROWS) {
2827
- let w = !1, E = !1;
2828
- for (let v = e; v <= n && (t > 0 && !D(a.getValue(v, t - 1)) && (w = !0), s < i - 1 && !D(a.getValue(v, s + 1)) && (E = !0), !(w && E)); v++)
2871
+ let w = !1, p = !1;
2872
+ for (let v = e; v <= n && (t > 0 && !D(a.getValue(v, t - 1)) && (w = !0), s < i - 1 && !D(a.getValue(v, s + 1)) && (p = !0), !(w && p)); v++)
2829
2873
  ;
2830
- w && (d = t - 1), E && (u = s + 1);
2874
+ w && (d = t - 1), p && (u = s + 1);
2831
2875
  }
2832
2876
  return this._injector.createInstance(_, this._workbook, this._worksheet, {
2833
2877
  startRow: h,
@@ -2935,7 +2979,7 @@ let _ = class extends le {
2935
2979
  }
2936
2980
  };
2937
2981
  _ = wn([
2938
- ne(3, g(P)),
2982
+ ne(3, g(x)),
2939
2983
  ne(4, m),
2940
2984
  ne(5, g(sn))
2941
2985
  ], _);
@@ -3043,7 +3087,7 @@ let K = class {
3043
3087
  const e = this._injector.get(m);
3044
3088
  let t = [], n = !1;
3045
3089
  for (const { range: o, style: i } of this._selections)
3046
- x.contains(o, r.getRange()) ? (t.push({
3090
+ P.contains(o, r.getRange()) ? (t.push({
3047
3091
  range: o,
3048
3092
  primary: z(r.getRange(), this._worksheet),
3049
3093
  style: i
@@ -3098,7 +3142,7 @@ let K = class {
3098
3142
  }
3099
3143
  };
3100
3144
  K = Sn([
3101
- Cn(3, g(P))
3145
+ Cn(3, g(x))
3102
3146
  ], K);
3103
3147
  var vn = Object.getOwnPropertyDescriptor, fn = (r, e, t, n) => {
3104
3148
  for (var s = n > 1 ? void 0 : n ? vn(e, t) : e, o = r.length - 1, i; o >= 0; o--)
@@ -3128,7 +3172,7 @@ let S = class extends le {
3128
3172
  * fWorkSheet.setActiveSelection(fWorkSheet.getRange('A10:B10'));
3129
3173
  * ```
3130
3174
  */
3131
- p(this, "setActiveSelection", this.setActiveRange);
3175
+ E(this, "setActiveSelection", this.setActiveRange);
3132
3176
  this._fWorkbook = e, this._workbook = t, this._worksheet = n, this._injector = s, this._selectionManagerService = o, this._logService = i, this._commandService = a;
3133
3177
  }
3134
3178
  /**
@@ -3459,7 +3503,7 @@ let S = class extends le {
3459
3503
  */
3460
3504
  insertRowsAfter(e, t) {
3461
3505
  const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), o = H.DOWN, i = e + 1, a = e + t, h = 0, d = this._worksheet.getColumnCount() - 1, c = O(this._worksheet, i, a, h, d, !0, e);
3462
- return this._commandService.syncExecuteCommand(Ee.id, {
3506
+ return this._commandService.syncExecuteCommand(pe.id, {
3463
3507
  unitId: n,
3464
3508
  subUnitId: s,
3465
3509
  direction: o,
@@ -3488,7 +3532,7 @@ let S = class extends le {
3488
3532
  */
3489
3533
  insertRowsBefore(e, t) {
3490
3534
  const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), o = H.UP, i = e, a = e + t - 1, h = 0, d = this._worksheet.getColumnCount() - 1, c = O(this._worksheet, i, a, h, d, !0, e - 1);
3491
- return this._commandService.syncExecuteCommand(Ee.id, {
3535
+ return this._commandService.syncExecuteCommand(pe.id, {
3492
3536
  unitId: n,
3493
3537
  subUnitId: s,
3494
3538
  direction: o,
@@ -3592,7 +3636,7 @@ let S = class extends le {
3592
3636
  */
3593
3637
  hideRow(e) {
3594
3638
  const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), s = ee(e.getRange(), this._worksheet);
3595
- return this._commandService.syncExecuteCommand(pe.id, {
3639
+ return this._commandService.syncExecuteCommand(Ee.id, {
3596
3640
  unitId: t,
3597
3641
  subUnitId: n,
3598
3642
  ranges: [s]
@@ -3620,7 +3664,7 @@ let S = class extends le {
3620
3664
  endColumn: this._worksheet.getColumnCount() - 1,
3621
3665
  rangeType: k.ROW
3622
3666
  };
3623
- return this._commandService.syncExecuteCommand(pe.id, {
3667
+ return this._commandService.syncExecuteCommand(Ee.id, {
3624
3668
  unitId: n,
3625
3669
  subUnitId: s,
3626
3670
  ranges: [o]
@@ -3946,7 +3990,7 @@ let S = class extends le {
3946
3990
  */
3947
3991
  insertColumnsAfter(e, t) {
3948
3992
  const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), o = H.RIGHT, i = 0, a = this._worksheet.getRowCount() - 1, h = e + 1, d = e + t, c = O(this._worksheet, i, a, h, d, !1, e);
3949
- return this._commandService.syncExecuteCommand(xe.id, {
3993
+ return this._commandService.syncExecuteCommand(Pe.id, {
3950
3994
  unitId: n,
3951
3995
  subUnitId: s,
3952
3996
  direction: o,
@@ -3975,7 +4019,7 @@ let S = class extends le {
3975
4019
  */
3976
4020
  insertColumnsBefore(e, t) {
3977
4021
  const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), o = H.LEFT, i = 0, a = this._worksheet.getRowCount() - 1, h = e, d = e + t - 1, c = O(this._worksheet, i, a, h, d, !1, e - 1);
3978
- return this._commandService.syncExecuteCommand(xe.id, {
4022
+ return this._commandService.syncExecuteCommand(Pe.id, {
3979
4023
  unitId: n,
3980
4024
  subUnitId: s,
3981
4025
  direction: o,
@@ -4079,7 +4123,7 @@ let S = class extends le {
4079
4123
  */
4080
4124
  hideColumn(e) {
4081
4125
  const t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), s = te(e.getRange(), this._worksheet);
4082
- return this._commandService.syncExecuteCommand(Pe.id, {
4126
+ return this._commandService.syncExecuteCommand(xe.id, {
4083
4127
  unitId: t,
4084
4128
  subUnitId: n,
4085
4129
  ranges: [s]
@@ -4107,7 +4151,7 @@ let S = class extends le {
4107
4151
  endColumn: e + t - 1,
4108
4152
  rangeType: k.COLUMN
4109
4153
  };
4110
- return this._commandService.syncExecuteCommand(Pe.id, {
4154
+ return this._commandService.syncExecuteCommand(xe.id, {
4111
4155
  unitId: n,
4112
4156
  subUnitId: s,
4113
4157
  ranges: [o]
@@ -5090,7 +5134,7 @@ let S = class extends le {
5090
5134
  }
5091
5135
  };
5092
5136
  S = fn([
5093
- j(3, g(P)),
5137
+ j(3, g(x)),
5094
5138
  j(4, g(Ze)),
5095
5139
  j(5, g(je)),
5096
5140
  j(6, m)
@@ -5103,7 +5147,7 @@ var In = Object.getOwnPropertyDescriptor, Rn = (r, e, t, n) => {
5103
5147
  let C = class extends le {
5104
5148
  constructor(e, t, n, s, o, i, a, h, d, c) {
5105
5149
  super(t);
5106
- p(this, "id");
5150
+ E(this, "id");
5107
5151
  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();
5108
5152
  }
5109
5153
  /**
@@ -6020,7 +6064,7 @@ let C = class extends le {
6020
6064
  }
6021
6065
  };
6022
6066
  C = Rn([
6023
- R(1, g(P)),
6067
+ R(1, g(x)),
6024
6068
  R(2, g(st)),
6025
6069
  R(3, g(Ze)),
6026
6070
  R(4, se),
@@ -6417,7 +6461,7 @@ class bn extends ze {
6417
6461
  }
6418
6462
  }
6419
6463
  ze.extend(bn);
6420
- class En {
6464
+ class pn {
6421
6465
  get SheetValueChangeType() {
6422
6466
  return tn;
6423
6467
  }
@@ -6428,8 +6472,8 @@ class En {
6428
6472
  return rn;
6429
6473
  }
6430
6474
  }
6431
- at.extend(En);
6432
- class pn {
6475
+ at.extend(pn);
6476
+ class En {
6433
6477
  get SheetCreated() {
6434
6478
  return "SheetCreated";
6435
6479
  }
@@ -6491,27 +6535,27 @@ class pn {
6491
6535
  return "SheetValueChanged";
6492
6536
  }
6493
6537
  }
6494
- ht.extend(pn);
6538
+ ht.extend(En);
6495
6539
  var yn = Object.getOwnPropertyDescriptor, Un = (r, e, t, n) => {
6496
6540
  for (var s = n > 1 ? void 0 : n ? yn(e, t) : e, o = r.length - 1, i; o >= 0; o--)
6497
6541
  (i = r[o]) && (s = i(s) || s);
6498
6542
  return s;
6499
- }, xn = (r, e) => (t, n) => e(t, n, r);
6543
+ }, Pn = (r, e) => (t, n) => e(t, n, r);
6500
6544
  let Ve = class extends ge {
6501
6545
  constructor(r) {
6502
6546
  super(), this._injector = r;
6503
6547
  }
6504
6548
  };
6505
6549
  Ve = Un([
6506
- xn(0, g(P))
6550
+ Pn(0, g(x))
6507
6551
  ], Ve);
6508
6552
  export {
6509
6553
  q as FPermission,
6510
6554
  _ as FRange,
6511
6555
  K as FSelection,
6512
- pn as FSheetEventName,
6556
+ En as FSheetEventName,
6513
6557
  Ve as FSheetHooks,
6514
- En as FSheetsEnum,
6558
+ pn as FSheetsEnum,
6515
6559
  C as FWorkbook,
6516
6560
  S as FWorksheet
6517
6561
  };
package/lib/es/index.js CHANGED
@@ -30,7 +30,7 @@ function ia(n) {
30
30
  return !!((e = n == null ? void 0 : n.n) != null && e.pattern);
31
31
  }
32
32
  function ns(n, e) {
33
- return n === null ? null : typeof n == "string" ? Mo(n) ? (+n == 0 || +n == 1) && e === re.BOOLEAN ? re.BOOLEAN : fi(n) ? re.FORCE_STRING : re.NUMBER : bs(n) ? re.BOOLEAN : re.STRING : typeof n == "number" ? (n === 0 || n === 1) && e === re.BOOLEAN ? re.BOOLEAN : re.NUMBER : typeof n == "boolean" ? re.BOOLEAN : re.FORCE_STRING;
33
+ return n === null ? null : typeof n == "string" ? Mo(n) ? (+n == 0 || +n == 1) && e === re.BOOLEAN ? re.BOOLEAN : e !== re.STRING && e !== re.FORCE_STRING && fi(n) ? re.FORCE_STRING : re.NUMBER : bs(n) ? re.BOOLEAN : re.STRING : typeof n == "number" ? (n === 0 || n === 1) && e === re.BOOLEAN ? re.BOOLEAN : re.NUMBER : typeof n == "boolean" ? re.BOOLEAN : re.FORCE_STRING;
34
34
  }
35
35
  const De = (n, e) => {
36
36
  if (n.get(M).getUniverSheetInstance(e.unitId) == null)
@@ -10596,6 +10596,9 @@ let $n = class extends le {
10596
10596
  initPermission() {
10597
10597
  this._initRangePermissionFromSnapshot(), this._initRangePermissionChange(), this._initWorksheetPermissionFromSnapshot(), this._initWorksheetPermissionChange(), this._initWorksheetPermissionPointsChange(), this._initWorkbookPermissionFromSnapshot(), this._initUserChange(), this._refreshPermissionByCollaCreate();
10598
10598
  }
10599
+ refreshRangeProtectPermission() {
10600
+ this._initRangePermissionFromSnapshot();
10601
+ }
10599
10602
  async _initRangePermissionFromSnapshot() {
10600
10603
  const n = async (e) => {
10601
10604
  const t = [], o = e.getUnitId(), s = e.getSheets(), r = /* @__PURE__ */ new Map();