@univerjs/sheets 0.4.1 → 0.4.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.
Files changed (42) hide show
  1. package/lib/cjs/index.js +1 -1
  2. package/lib/es/index.js +487 -227
  3. package/lib/types/basics/row-column-value.d.ts +14 -0
  4. package/lib/types/commands/commands/__tests__/set-col-data.command.spec.d.ts +16 -0
  5. package/lib/types/commands/commands/__tests__/set-row-data.command.spec.d.ts +16 -0
  6. package/lib/types/commands/commands/__tests__/set-worksheet-default-style.command.spec.d.ts +16 -0
  7. package/lib/types/commands/commands/set-col-data.command.d.ts +7 -0
  8. package/lib/types/commands/commands/set-row-data.command.d.ts +7 -0
  9. package/lib/types/commands/commands/set-style.command.d.ts +1 -1
  10. package/lib/types/commands/commands/set-worksheet-col-width.command.d.ts +6 -0
  11. package/lib/types/commands/commands/set-worksheet-default-style.command.d.ts +2 -0
  12. package/lib/types/commands/commands/toggle-gridlines.command.d.ts +7 -0
  13. package/lib/types/commands/mutations/add-range-protection.mutation.d.ts +2 -2
  14. package/lib/types/commands/mutations/delete-range-protection.mutation.d.ts +3 -3
  15. package/lib/types/commands/mutations/set-col-data.mutation.d.ts +8 -0
  16. package/lib/types/commands/mutations/set-frozen.mutation.d.ts +8 -0
  17. package/lib/types/commands/mutations/set-row-data.mutation.d.ts +8 -0
  18. package/lib/types/commands/mutations/set-worksheet-col-width.mutation.d.ts +3 -0
  19. package/lib/types/commands/mutations/set-worksheet-default-style.mutation.d.ts +12 -0
  20. package/lib/types/commands/mutations/toggle-gridlines.mutation.d.ts +7 -0
  21. package/lib/types/controllers/config.schema.d.ts +4 -0
  22. package/lib/types/index.d.ts +16 -4
  23. package/lib/types/model/range-protection.cache.d.ts +5 -2
  24. package/lib/types/services/border-style-manager.service.d.ts +2 -2
  25. package/lib/types/services/permission/permission-point/index.d.ts +2 -0
  26. package/lib/types/services/permission/permission-point/range/delete-protection.d.ts +13 -0
  27. package/lib/types/services/permission/permission-point/range/manage-collaborator.d.ts +13 -0
  28. package/lib/types/services/permission/permission-point/workbook/create-permission.d.ts +11 -0
  29. package/lib/types/services/permission/permission-point/worksheet/delete-protection.d.ts +12 -0
  30. package/lib/types/services/permission/range-permission/range-protection.ref-range.d.ts +3 -3
  31. package/lib/types/services/permission/range-permission/range-protection.service.d.ts +3 -2
  32. package/lib/types/services/permission/range-permission/util.d.ts +1 -0
  33. package/lib/types/services/permission/type.d.ts +1 -1
  34. package/lib/types/services/permission/workbook-permission/workbook-permission.service.d.ts +4 -1
  35. package/lib/types/services/permission/worksheet-permission/utils.d.ts +2 -2
  36. package/lib/types/services/selections/selection-manager.service.d.ts +2 -2
  37. package/lib/umd/index.js +1 -1
  38. package/package.json +7 -7
  39. package/lib/types/basics/cell-custom.d.ts +0 -12
  40. package/lib/types/commands/commands/set-hide-gridlines.command.d.ts +0 -7
  41. package/lib/types/commands/mutations/set-hide-gridlines.mutatiom.d.ts +0 -8
  42. /package/lib/types/basics/__tests__/{cell-custom.spec.d.ts → row-column-value.spec.d.ts} +0 -0
package/lib/es/index.js CHANGED
@@ -2,7 +2,7 @@ var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value;
3
3
  var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
4
4
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value);
5
- import { Tools, CommandType, ICommandService, IUndoRedoService, RxDisposable, UniverInstanceType, Disposable, IUniverInstanceService, createInterceptorKey, InterceptorEffectEnum, toDisposable, remove, composeInterceptors, DisposableCollection, normalizeTextRuns, CellValueType, isRealNum, isBooleanString, isSafeNumeric, ObjectMatrix, sequenceExecute, LocaleService, createIdentifier, IContextService, selectionToArray, Rectangle, RANGE_TYPE, ErrorService, Range, cellToRange, PermissionStatus, IPermissionService, isICellData, Dimension, getArrayLength, insertMatrixArray, spliceArray, sliceMatrixArray, concatMatrixArray, BooleanNumber, Direction, mergeWorksheetSnapshotWithDefault, moveMatrixArray, BorderType, BorderStyleTypes, FontWeight, FontItalic, Inject, Injector, IResourceManagerService, DocumentDataModel, BuildTextUtils, TextX, Optional, IConfigService, queryObjectMatrix, InterceptorManager, LRUMap, ILogService, DependentOn, Plugin, registerDependencies, mergeOverrideWithDependencies, touchDependencies, ColorKit, getCellInfoInMergeData, makeCellRangeToRangeData, createRowColIter } from "@univerjs/core";
5
+ import { Tools, CommandType, ICommandService, IUndoRedoService, RxDisposable, UniverInstanceType, Disposable, IUniverInstanceService, createInterceptorKey, InterceptorEffectEnum, toDisposable, remove, composeInterceptors, DisposableCollection, normalizeTextRuns, CellValueType, isRealNum, isBooleanString, isSafeNumeric, ObjectMatrix, sequenceExecute, LocaleService, createIdentifier, IContextService, selectionToArray, Rectangle, RANGE_TYPE, ErrorService, Range, cellToRange, PermissionStatus, IPermissionService, isICellData, Dimension, getArrayLength, insertMatrixArray, spliceArray, sliceMatrixArray, concatMatrixArray, BooleanNumber, Direction, mergeWorksheetSnapshotWithDefault, moveMatrixArray, BorderType, BorderStyleTypes, FontWeight, FontItalic, Inject, Injector, IResourceManagerService, DocumentDataModel, BuildTextUtils, TextX, Optional, IConfigService, queryObjectMatrix, InterceptorManager, LRUMap, ILogService, DependentOn, Plugin, IS_ROW_STYLE_PRECEDE_COLUMN_STYLE, registerDependencies, mergeOverrideWithDependencies, touchDependencies, ColorKit, getCellInfoInMergeData, makeCellRangeToRangeData, createRowColIter } from "@univerjs/core";
6
6
  import { SetDefinedNameMutation, RemoveDefinedNameMutation, SetDefinedNameMutationFactory, SetFormulaCalculationResultMutation, handleNumfmtInCell, IDefinedNamesService, stripErrorMargin, UniverFormulaEnginePlugin } from "@univerjs/engine-formula";
7
7
  import { DataSyncPrimaryController } from "@univerjs/rpc";
8
8
  import { Subject, BehaviorSubject, shareReplay, takeUntil, switchMap, of, merge, map, first, filter } from "rxjs";
@@ -663,10 +663,6 @@ function checkCellValueType(v, type) {
663
663
  return v === null ? null : typeof v == "string" ? isRealNum(v) ? (+v == 0 || +v == 1) && type === CellValueType.BOOLEAN ? CellValueType.BOOLEAN : CellValueType.NUMBER : isBooleanString(v) ? CellValueType.BOOLEAN : CellValueType.STRING : typeof v == "number" ? (v === 0 || v === 1) && type === CellValueType.BOOLEAN ? CellValueType.BOOLEAN : CellValueType.NUMBER : typeof v == "boolean" ? CellValueType.BOOLEAN : CellValueType.FORCE_STRING;
664
664
  }
665
665
  __name(checkCellValueType, "checkCellValueType");
666
- function getCellTypeByPattern(cell, pattern) {
667
- return cell.t === CellValueType.FORCE_STRING ? CellValueType.FORCE_STRING : pattern === DEFAULT_TEXT_FORMAT ? CellValueType.STRING : checkCellValueType(cell.v, cell.t);
668
- }
669
- __name(getCellTypeByPattern, "getCellTypeByPattern");
670
666
  function getCellValue(type, cell) {
671
667
  return type === CellValueType.NUMBER ? Number(cell.v) : type === CellValueType.BOOLEAN ? extractBooleanValue(cell.v) ? 1 : 0 : type === CellValueType.STRING || type === CellValueType.FORCE_STRING ? `${cell.v}` : cell.v;
672
668
  }
@@ -1265,18 +1261,18 @@ function getMoveRangeUndoRedoMutations(accessor, from, to, ignoreMerge = !1) {
1265
1261
  };
1266
1262
  }
1267
1263
  __name(getMoveRangeUndoRedoMutations, "getMoveRangeUndoRedoMutations");
1268
- var R = /* @__PURE__ */ ((E) => (E[E.UNIVER_UNKNOWN = 0] = "UNIVER_UNKNOWN", E[E.UNIVER_DOC = 1] = "UNIVER_DOC", E[E.UNIVER_SHEET = 2] = "UNIVER_SHEET", E[E.UNIVER_SLIDE = 3] = "UNIVER_SLIDE", E[E.UNIVER_PROJECT = 4] = "UNIVER_PROJECT", E[E.UNRECOGNIZED = -1] = "UNRECOGNIZED", E))(R || {}), D = /* @__PURE__ */ ((E) => (E[E.View = 0] = "View", E[E.Edit = 1] = "Edit", E[E.ManageCollaborator = 2] = "ManageCollaborator", E[E.Print = 3] = "Print", E[E.Duplicate = 4] = "Duplicate", E[E.Comment = 5] = "Comment", E[E.Copy = 6] = "Copy", E[E.Share = 7] = "Share", E[E.Export = 8] = "Export", E[E.MoveWorksheet = 9] = "MoveWorksheet", E[E.DeleteWorksheet = 10] = "DeleteWorksheet", E[E.HideWorksheet = 11] = "HideWorksheet", E[E.RenameWorksheet = 12] = "RenameWorksheet", E[E.CreateWorksheet = 13] = "CreateWorksheet", E[E.SetWorksheetStyle = 14] = "SetWorksheetStyle", E[E.EditWorksheetCell = 15] = "EditWorksheetCell", E[E.InsertHyperlink = 16] = "InsertHyperlink", E[E.Sort = 17] = "Sort", E[E.Filter = 18] = "Filter", E[E.PivotTable = 19] = "PivotTable", E[E.FloatImg = 20] = "FloatImg", E[E.History = 21] = "History", E[E.RwHgtClWdt = 22] = "RwHgtClWdt", E[E.ViemRwHgtClWdt = 23] = "ViemRwHgtClWdt", E[E.ViewFilter = 24] = "ViewFilter", E[E.MoveSheet = 25] = "MoveSheet", E[E.DeleteSheet = 26] = "DeleteSheet", E[E.HideSheet = 27] = "HideSheet", E[E.CopySheet = 28] = "CopySheet", E[E.RenameSheet = 29] = "RenameSheet", E[E.CreateSheet = 30] = "CreateSheet", E[E.SelectProtectedCells = 31] = "SelectProtectedCells", E[E.SelectUnProtectedCells = 32] = "SelectUnProtectedCells", E[E.SetCellStyle = 33] = "SetCellStyle", E[E.SetCellValue = 34] = "SetCellValue", E[E.SetRowStyle = 35] = "SetRowStyle", E[E.SetColumnStyle = 36] = "SetColumnStyle", E[E.InsertRow = 37] = "InsertRow", E[E.InsertColumn = 38] = "InsertColumn", E[E.DeleteRow = 39] = "DeleteRow", E[E.DeleteColumn = 40] = "DeleteColumn", E[E.EditExtraObject = 41] = "EditExtraObject", E[E.Delete = 42] = "Delete", E[E.RecoverHistory = 43] = "RecoverHistory", E[E.ViewHistory = 44] = "ViewHistory", E[E.UNRECOGNIZED = -1] = "UNRECOGNIZED", E))(D || {}), L = /* @__PURE__ */ ((E) => (E[E.Unkonwn = 0] = "Unkonwn", E[E.Workbook = 1] = "Workbook", E[E.Worksheet = 2] = "Worksheet", E[E.SelectRange = 3] = "SelectRange", E[E.Document = 4] = "Document", E[E.Slide = 5] = "Slide", E[E.UNRECOGNIZED = -1] = "UNRECOGNIZED", E))(L || {});
1264
+ var _ = /* @__PURE__ */ ((E) => (E[E.UNIVER_UNKNOWN = 0] = "UNIVER_UNKNOWN", E[E.UNIVER_DOC = 1] = "UNIVER_DOC", E[E.UNIVER_SHEET = 2] = "UNIVER_SHEET", E[E.UNIVER_SLIDE = 3] = "UNIVER_SLIDE", E[E.UNIVER_PROJECT = 4] = "UNIVER_PROJECT", E[E.UNRECOGNIZED = -1] = "UNRECOGNIZED", E))(_ || {}), R = /* @__PURE__ */ ((E) => (E[E.View = 0] = "View", E[E.Edit = 1] = "Edit", E[E.ManageCollaborator = 2] = "ManageCollaborator", E[E.Print = 3] = "Print", E[E.Duplicate = 4] = "Duplicate", E[E.Comment = 5] = "Comment", E[E.Copy = 6] = "Copy", E[E.Share = 7] = "Share", E[E.Export = 8] = "Export", E[E.MoveWorksheet = 9] = "MoveWorksheet", E[E.DeleteWorksheet = 10] = "DeleteWorksheet", E[E.HideWorksheet = 11] = "HideWorksheet", E[E.RenameWorksheet = 12] = "RenameWorksheet", E[E.CreateWorksheet = 13] = "CreateWorksheet", E[E.SetWorksheetStyle = 14] = "SetWorksheetStyle", E[E.EditWorksheetCell = 15] = "EditWorksheetCell", E[E.InsertHyperlink = 16] = "InsertHyperlink", E[E.Sort = 17] = "Sort", E[E.Filter = 18] = "Filter", E[E.PivotTable = 19] = "PivotTable", E[E.FloatImg = 20] = "FloatImg", E[E.History = 21] = "History", E[E.RwHgtClWdt = 22] = "RwHgtClWdt", E[E.ViemRwHgtClWdt = 23] = "ViemRwHgtClWdt", E[E.ViewFilter = 24] = "ViewFilter", E[E.MoveSheet = 25] = "MoveSheet", E[E.DeleteSheet = 26] = "DeleteSheet", E[E.HideSheet = 27] = "HideSheet", E[E.CopySheet = 28] = "CopySheet", E[E.RenameSheet = 29] = "RenameSheet", E[E.CreateSheet = 30] = "CreateSheet", E[E.SelectProtectedCells = 31] = "SelectProtectedCells", E[E.SelectUnProtectedCells = 32] = "SelectUnProtectedCells", E[E.SetCellStyle = 33] = "SetCellStyle", E[E.SetCellValue = 34] = "SetCellValue", E[E.SetRowStyle = 35] = "SetRowStyle", E[E.SetColumnStyle = 36] = "SetColumnStyle", E[E.InsertRow = 37] = "InsertRow", E[E.InsertColumn = 38] = "InsertColumn", E[E.DeleteRow = 39] = "DeleteRow", E[E.DeleteColumn = 40] = "DeleteColumn", E[E.EditExtraObject = 41] = "EditExtraObject", E[E.Delete = 42] = "Delete", E[E.RecoverHistory = 43] = "RecoverHistory", E[E.ViewHistory = 44] = "ViewHistory", E[E.CreatePermissionObject = 45] = "CreatePermissionObject", E[E.UNRECOGNIZED = -1] = "UNRECOGNIZED", E))(R || {}), L = /* @__PURE__ */ ((E) => (E[E.Unkonwn = 0] = "Unkonwn", E[E.Workbook = 1] = "Workbook", E[E.Worksheet = 2] = "Worksheet", E[E.SelectRange = 3] = "SelectRange", E[E.Document = 4] = "Document", E[E.Slide = 5] = "Slide", E[E.UNRECOGNIZED = -1] = "UNRECOGNIZED", E))(L || {});
1269
1265
  const _RangeProtectionPermissionEditPoint = class _RangeProtectionPermissionEditPoint {
1270
1266
  constructor(unitId, subUnitId, permissionId) {
1271
1267
  __publicField(this, "type", L.SelectRange);
1272
- __publicField(this, "subType", D.Edit);
1268
+ __publicField(this, "subType", R.Edit);
1273
1269
  __publicField(this, "status", PermissionStatus.INIT);
1274
1270
  __publicField(this, "value", !0);
1275
1271
  __publicField(this, "id");
1276
1272
  __publicField(this, "unitId");
1277
1273
  __publicField(this, "subUnitId");
1278
1274
  __publicField(this, "permissionId");
1279
- this.unitId = unitId, this.subUnitId = subUnitId, this.permissionId = permissionId, this.id = `${L.SelectRange}.${D.Edit}.${permissionId}`;
1275
+ this.unitId = unitId, this.subUnitId = subUnitId, this.permissionId = permissionId, this.id = `${L.SelectRange}.${R.Edit}.${permissionId}`;
1280
1276
  }
1281
1277
  };
1282
1278
  __name(_RangeProtectionPermissionEditPoint, "RangeProtectionPermissionEditPoint");
@@ -1284,14 +1280,14 @@ let RangeProtectionPermissionEditPoint = _RangeProtectionPermissionEditPoint;
1284
1280
  const _RangeProtectionPermissionViewPoint = class _RangeProtectionPermissionViewPoint {
1285
1281
  constructor(unitId, subUnitId, permissionId) {
1286
1282
  __publicField(this, "type", L.SelectRange);
1287
- __publicField(this, "subType", D.View);
1283
+ __publicField(this, "subType", R.View);
1288
1284
  __publicField(this, "status", PermissionStatus.INIT);
1289
1285
  __publicField(this, "value", !0);
1290
1286
  __publicField(this, "id");
1291
1287
  __publicField(this, "unitId");
1292
1288
  __publicField(this, "subUnitId");
1293
1289
  __publicField(this, "permissionId");
1294
- this.unitId = unitId, this.subUnitId = subUnitId, this.permissionId = permissionId, this.id = `${L.SelectRange}.${D.View}.${permissionId}`;
1290
+ this.unitId = unitId, this.subUnitId = subUnitId, this.permissionId = permissionId, this.id = `${L.SelectRange}.${R.View}.${permissionId}`;
1295
1291
  }
1296
1292
  };
1297
1293
  __name(_RangeProtectionPermissionViewPoint, "RangeProtectionPermissionViewPoint");
@@ -1302,8 +1298,8 @@ const _WorkbookCommentPermission = class _WorkbookCommentPermission {
1302
1298
  __publicField(this, "value", !0);
1303
1299
  __publicField(this, "type", L.Workbook);
1304
1300
  __publicField(this, "status", PermissionStatus.INIT);
1305
- __publicField(this, "subType", D.Comment);
1306
- this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${D.Comment}_${unitId}`;
1301
+ __publicField(this, "subType", R.Comment);
1302
+ this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${R.Comment}_${unitId}`;
1307
1303
  }
1308
1304
  };
1309
1305
  __name(_WorkbookCommentPermission, "WorkbookCommentPermission");
@@ -1314,8 +1310,8 @@ const _WorkbookCopyPermission = class _WorkbookCopyPermission {
1314
1310
  __publicField(this, "value", !0);
1315
1311
  __publicField(this, "type", L.Workbook);
1316
1312
  __publicField(this, "status", PermissionStatus.INIT);
1317
- __publicField(this, "subType", D.Copy);
1318
- this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${D.Copy}_${unitId}`;
1313
+ __publicField(this, "subType", R.Copy);
1314
+ this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${R.Copy}_${unitId}`;
1319
1315
  }
1320
1316
  };
1321
1317
  __name(_WorkbookCopyPermission, "WorkbookCopyPermission");
@@ -1325,21 +1321,33 @@ const _WorkbookCopySheetPermission = class _WorkbookCopySheetPermission {
1325
1321
  __publicField(this, "id");
1326
1322
  __publicField(this, "value", !0);
1327
1323
  __publicField(this, "type", L.Workbook);
1328
- __publicField(this, "subType", D.CopySheet);
1324
+ __publicField(this, "subType", R.CopySheet);
1329
1325
  __publicField(this, "status", PermissionStatus.INIT);
1330
- this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${D.CopySheet}_${unitId}`;
1326
+ this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${R.CopySheet}_${unitId}`;
1331
1327
  }
1332
1328
  };
1333
1329
  __name(_WorkbookCopySheetPermission, "WorkbookCopySheetPermission");
1334
1330
  let WorkbookCopySheetPermission = _WorkbookCopySheetPermission;
1331
+ const _WorkbookCreateProtectPermission = class _WorkbookCreateProtectPermission {
1332
+ constructor(unitId) {
1333
+ __publicField(this, "id");
1334
+ __publicField(this, "value", !0);
1335
+ __publicField(this, "type", L.Workbook);
1336
+ __publicField(this, "status", PermissionStatus.INIT);
1337
+ __publicField(this, "subType", R.CreatePermissionObject);
1338
+ this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${R.CreatePermissionObject}_${unitId}`;
1339
+ }
1340
+ };
1341
+ __name(_WorkbookCreateProtectPermission, "WorkbookCreateProtectPermission");
1342
+ let WorkbookCreateProtectPermission = _WorkbookCreateProtectPermission;
1335
1343
  const _WorkbookCreateSheetPermission = class _WorkbookCreateSheetPermission {
1336
1344
  constructor(unitId) {
1337
1345
  __publicField(this, "id");
1338
1346
  __publicField(this, "value", !0);
1339
1347
  __publicField(this, "type", L.Workbook);
1340
1348
  __publicField(this, "status", PermissionStatus.INIT);
1341
- __publicField(this, "subType", D.CreateSheet);
1342
- this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${D.CreateSheet}_${unitId}`;
1349
+ __publicField(this, "subType", R.CreateSheet);
1350
+ this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${R.CreateSheet}_${unitId}`;
1343
1351
  }
1344
1352
  };
1345
1353
  __name(_WorkbookCreateSheetPermission, "WorkbookCreateSheetPermission");
@@ -1350,8 +1358,8 @@ const _WorkbookDeleteSheetPermission = class _WorkbookDeleteSheetPermission {
1350
1358
  __publicField(this, "value", !0);
1351
1359
  __publicField(this, "type", L.Workbook);
1352
1360
  __publicField(this, "status", PermissionStatus.INIT);
1353
- __publicField(this, "subType", D.DeleteSheet);
1354
- this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${D.DeleteSheet}_${unitId}`;
1361
+ __publicField(this, "subType", R.DeleteSheet);
1362
+ this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${R.DeleteSheet}_${unitId}`;
1355
1363
  }
1356
1364
  };
1357
1365
  __name(_WorkbookDeleteSheetPermission, "WorkbookDeleteSheetPermission");
@@ -1362,8 +1370,8 @@ const _WorkbookDuplicatePermission = class _WorkbookDuplicatePermission {
1362
1370
  __publicField(this, "value", !0);
1363
1371
  __publicField(this, "type", L.Workbook);
1364
1372
  __publicField(this, "status", PermissionStatus.INIT);
1365
- __publicField(this, "subType", D.Duplicate);
1366
- this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${D.Duplicate}_${unitId}`;
1373
+ __publicField(this, "subType", R.Duplicate);
1374
+ this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${R.Duplicate}_${unitId}`;
1367
1375
  }
1368
1376
  };
1369
1377
  __name(_WorkbookDuplicatePermission, "WorkbookDuplicatePermission");
@@ -1374,8 +1382,8 @@ const _WorkbookEditablePermission = class _WorkbookEditablePermission {
1374
1382
  __publicField(this, "value", !0);
1375
1383
  __publicField(this, "type", L.Workbook);
1376
1384
  __publicField(this, "status", PermissionStatus.INIT);
1377
- __publicField(this, "subType", D.Edit);
1378
- this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${D.Edit}_${unitId}`;
1385
+ __publicField(this, "subType", R.Edit);
1386
+ this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${R.Edit}_${unitId}`;
1379
1387
  }
1380
1388
  };
1381
1389
  __name(_WorkbookEditablePermission, "WorkbookEditablePermission");
@@ -1386,8 +1394,8 @@ const _WorkbookExportPermission = class _WorkbookExportPermission {
1386
1394
  __publicField(this, "value", !0);
1387
1395
  __publicField(this, "type", L.Workbook);
1388
1396
  __publicField(this, "status", PermissionStatus.INIT);
1389
- __publicField(this, "subType", D.Export);
1390
- this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${D.Export}_${unitId}`;
1397
+ __publicField(this, "subType", R.Export);
1398
+ this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${R.Export}_${unitId}`;
1391
1399
  }
1392
1400
  };
1393
1401
  __name(_WorkbookExportPermission, "WorkbookExportPermission");
@@ -1398,8 +1406,8 @@ const _WorkbookHideSheetPermission = class _WorkbookHideSheetPermission {
1398
1406
  __publicField(this, "value", !0);
1399
1407
  __publicField(this, "type", L.Workbook);
1400
1408
  __publicField(this, "status", PermissionStatus.INIT);
1401
- __publicField(this, "subType", D.HideSheet);
1402
- this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${D.HideSheet}_${unitId}`;
1409
+ __publicField(this, "subType", R.HideSheet);
1410
+ this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${R.HideSheet}_${unitId}`;
1403
1411
  }
1404
1412
  };
1405
1413
  __name(_WorkbookHideSheetPermission, "WorkbookHideSheetPermission");
@@ -1410,8 +1418,8 @@ const _WorkbookHistoryPermission = class _WorkbookHistoryPermission {
1410
1418
  __publicField(this, "value", !0);
1411
1419
  __publicField(this, "type", L.Workbook);
1412
1420
  __publicField(this, "status", PermissionStatus.INIT);
1413
- __publicField(this, "subType", D.History);
1414
- this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${D.History}_${unitId}`;
1421
+ __publicField(this, "subType", R.History);
1422
+ this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${R.History}_${unitId}`;
1415
1423
  }
1416
1424
  };
1417
1425
  __name(_WorkbookHistoryPermission, "WorkbookHistoryPermission");
@@ -1422,8 +1430,8 @@ const _WorkbookManageCollaboratorPermission = class _WorkbookManageCollaboratorP
1422
1430
  __publicField(this, "value", !0);
1423
1431
  __publicField(this, "type", L.Workbook);
1424
1432
  __publicField(this, "status", PermissionStatus.INIT);
1425
- __publicField(this, "subType", D.ManageCollaborator);
1426
- this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${D.ManageCollaborator}_${unitId}`;
1433
+ __publicField(this, "subType", R.ManageCollaborator);
1434
+ this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${R.ManageCollaborator}_${unitId}`;
1427
1435
  }
1428
1436
  };
1429
1437
  __name(_WorkbookManageCollaboratorPermission, "WorkbookManageCollaboratorPermission");
@@ -1434,8 +1442,8 @@ const _WorkbookMoveSheetPermission = class _WorkbookMoveSheetPermission {
1434
1442
  __publicField(this, "value", !0);
1435
1443
  __publicField(this, "type", L.Workbook);
1436
1444
  __publicField(this, "status", PermissionStatus.INIT);
1437
- __publicField(this, "subType", D.MoveSheet);
1438
- this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${D.MoveSheet}_${unitId}`;
1445
+ __publicField(this, "subType", R.MoveSheet);
1446
+ this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${R.MoveSheet}_${unitId}`;
1439
1447
  }
1440
1448
  };
1441
1449
  __name(_WorkbookMoveSheetPermission, "WorkbookMoveSheetPermission");
@@ -1446,8 +1454,8 @@ const _WorkbookPrintPermission = class _WorkbookPrintPermission {
1446
1454
  __publicField(this, "value", !0);
1447
1455
  __publicField(this, "type", L.Workbook);
1448
1456
  __publicField(this, "status", PermissionStatus.INIT);
1449
- __publicField(this, "subType", D.Print);
1450
- this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${D.Print}_${unitId}`;
1457
+ __publicField(this, "subType", R.Print);
1458
+ this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${R.Print}_${unitId}`;
1451
1459
  }
1452
1460
  };
1453
1461
  __name(_WorkbookPrintPermission, "WorkbookPrintPermission");
@@ -1458,8 +1466,8 @@ const _WorkbookRecoverHistoryPermission = class _WorkbookRecoverHistoryPermissio
1458
1466
  __publicField(this, "value", !0);
1459
1467
  __publicField(this, "type", L.Workbook);
1460
1468
  __publicField(this, "status", PermissionStatus.INIT);
1461
- __publicField(this, "subType", D.RecoverHistory);
1462
- this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${D.RecoverHistory}_${unitId}`;
1469
+ __publicField(this, "subType", R.RecoverHistory);
1470
+ this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${R.RecoverHistory}_${unitId}`;
1463
1471
  }
1464
1472
  };
1465
1473
  __name(_WorkbookRecoverHistoryPermission, "WorkbookRecoverHistoryPermission");
@@ -1470,8 +1478,8 @@ const _WorkbookRenameSheetPermission = class _WorkbookRenameSheetPermission {
1470
1478
  __publicField(this, "value", !0);
1471
1479
  __publicField(this, "type", L.Workbook);
1472
1480
  __publicField(this, "status", PermissionStatus.INIT);
1473
- __publicField(this, "subType", D.RenameSheet);
1474
- this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${D.RenameSheet}_${unitId}`;
1481
+ __publicField(this, "subType", R.RenameSheet);
1482
+ this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${R.RenameSheet}_${unitId}`;
1475
1483
  }
1476
1484
  };
1477
1485
  __name(_WorkbookRenameSheetPermission, "WorkbookRenameSheetPermission");
@@ -1482,8 +1490,8 @@ const _WorkbookSharePermission = class _WorkbookSharePermission {
1482
1490
  __publicField(this, "value", !0);
1483
1491
  __publicField(this, "type", L.Workbook);
1484
1492
  __publicField(this, "status", PermissionStatus.INIT);
1485
- __publicField(this, "subType", D.Share);
1486
- this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${D.Share}_${unitId}`;
1493
+ __publicField(this, "subType", R.Share);
1494
+ this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${R.Share}_${unitId}`;
1487
1495
  }
1488
1496
  };
1489
1497
  __name(_WorkbookSharePermission, "WorkbookSharePermission");
@@ -1494,8 +1502,8 @@ const _WorkbookViewPermission = class _WorkbookViewPermission {
1494
1502
  __publicField(this, "value", !0);
1495
1503
  __publicField(this, "type", L.Workbook);
1496
1504
  __publicField(this, "status", PermissionStatus.INIT);
1497
- __publicField(this, "subType", D.View);
1498
- this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${D.View}_${unitId}`;
1505
+ __publicField(this, "subType", R.View);
1506
+ this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${R.View}_${unitId}`;
1499
1507
  }
1500
1508
  };
1501
1509
  __name(_WorkbookViewPermission, "WorkbookViewPermission");
@@ -1506,8 +1514,8 @@ const _WorkbookViewHistoryPermission = class _WorkbookViewHistoryPermission {
1506
1514
  __publicField(this, "value", !0);
1507
1515
  __publicField(this, "type", L.Workbook);
1508
1516
  __publicField(this, "status", PermissionStatus.INIT);
1509
- __publicField(this, "subType", D.ViewHistory);
1510
- this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${D.ViewHistory}_${unitId}`;
1517
+ __publicField(this, "subType", R.ViewHistory);
1518
+ this.unitId = unitId, this.unitId = unitId, this.id = `${this.type}.${R.ViewHistory}_${unitId}`;
1511
1519
  }
1512
1520
  };
1513
1521
  __name(_WorkbookViewHistoryPermission, "WorkbookViewHistoryPermission");
@@ -1518,8 +1526,8 @@ const _WorksheetCopyPermission = class _WorksheetCopyPermission {
1518
1526
  __publicField(this, "type", L.Worksheet);
1519
1527
  __publicField(this, "status", PermissionStatus.INIT);
1520
1528
  __publicField(this, "id");
1521
- __publicField(this, "subType", D.Copy);
1522
- this.unitId = unitId, this.subUnitId = subUnitId, this.id = `${this.type}.${D.Copy}_${unitId}_${subUnitId}`;
1529
+ __publicField(this, "subType", R.Copy);
1530
+ this.unitId = unitId, this.subUnitId = subUnitId, this.id = `${this.type}.${R.Copy}_${unitId}_${subUnitId}`;
1523
1531
  }
1524
1532
  };
1525
1533
  __name(_WorksheetCopyPermission, "WorksheetCopyPermission");
@@ -1530,20 +1538,32 @@ const _WorksheetDeleteColumnPermission = class _WorksheetDeleteColumnPermission
1530
1538
  __publicField(this, "type", L.Worksheet);
1531
1539
  __publicField(this, "status", PermissionStatus.INIT);
1532
1540
  __publicField(this, "id");
1533
- __publicField(this, "subType", D.DeleteColumn);
1534
- this.unitId = unitId, this.subUnitId = subUnitId, this.id = `${this.type}.${D.DeleteColumn}_${unitId}_${subUnitId}`;
1541
+ __publicField(this, "subType", R.DeleteColumn);
1542
+ this.unitId = unitId, this.subUnitId = subUnitId, this.id = `${this.type}.${R.DeleteColumn}_${unitId}_${subUnitId}`;
1535
1543
  }
1536
1544
  };
1537
1545
  __name(_WorksheetDeleteColumnPermission, "WorksheetDeleteColumnPermission");
1538
1546
  let WorksheetDeleteColumnPermission = _WorksheetDeleteColumnPermission;
1547
+ const _WorksheetDeleteProtectionPermission = class _WorksheetDeleteProtectionPermission {
1548
+ constructor(unitId, subUnitId) {
1549
+ __publicField(this, "value", !0);
1550
+ __publicField(this, "type", L.Worksheet);
1551
+ __publicField(this, "status", PermissionStatus.INIT);
1552
+ __publicField(this, "id");
1553
+ __publicField(this, "subType", R.Delete);
1554
+ this.unitId = unitId, this.subUnitId = subUnitId, this.id = `${this.type}.${R.Delete}_${unitId}_${subUnitId}`;
1555
+ }
1556
+ };
1557
+ __name(_WorksheetDeleteProtectionPermission, "WorksheetDeleteProtectionPermission");
1558
+ let WorksheetDeleteProtectionPermission = _WorksheetDeleteProtectionPermission;
1539
1559
  const _WorksheetDeleteRowPermission = class _WorksheetDeleteRowPermission {
1540
1560
  constructor(unitId, subUnitId) {
1541
1561
  __publicField(this, "value", !0);
1542
1562
  __publicField(this, "type", L.Worksheet);
1543
1563
  __publicField(this, "status", PermissionStatus.INIT);
1544
1564
  __publicField(this, "id");
1545
- __publicField(this, "subType", D.DeleteRow);
1546
- this.unitId = unitId, this.subUnitId = subUnitId, this.id = `${this.type}.${D.DeleteRow}_${unitId}_${subUnitId}`;
1565
+ __publicField(this, "subType", R.DeleteRow);
1566
+ this.unitId = unitId, this.subUnitId = subUnitId, this.id = `${this.type}.${R.DeleteRow}_${unitId}_${subUnitId}`;
1547
1567
  }
1548
1568
  };
1549
1569
  __name(_WorksheetDeleteRowPermission, "WorksheetDeleteRowPermission");
@@ -1554,8 +1574,8 @@ const _WorksheetEditPermission = class _WorksheetEditPermission {
1554
1574
  __publicField(this, "type", L.Worksheet);
1555
1575
  __publicField(this, "status", PermissionStatus.INIT);
1556
1576
  __publicField(this, "id");
1557
- __publicField(this, "subType", D.Edit);
1558
- this.unitId = unitId, this.subUnitId = subUnitId, this.id = `${this.type}.${D.Edit}_${unitId}_${subUnitId}`;
1577
+ __publicField(this, "subType", R.Edit);
1578
+ this.unitId = unitId, this.subUnitId = subUnitId, this.id = `${this.type}.${R.Edit}_${unitId}_${subUnitId}`;
1559
1579
  }
1560
1580
  };
1561
1581
  __name(_WorksheetEditPermission, "WorksheetEditPermission");
@@ -1566,8 +1586,8 @@ const _WorksheetEditExtraObjectPermission = class _WorksheetEditExtraObjectPermi
1566
1586
  __publicField(this, "type", L.Worksheet);
1567
1587
  __publicField(this, "status", PermissionStatus.INIT);
1568
1588
  __publicField(this, "id");
1569
- __publicField(this, "subType", D.EditExtraObject);
1570
- this.unitId = unitId, this.subUnitId = subUnitId, this.id = `${this.type}.${D.EditExtraObject}_${unitId}_${subUnitId}`;
1589
+ __publicField(this, "subType", R.EditExtraObject);
1590
+ this.unitId = unitId, this.subUnitId = subUnitId, this.id = `${this.type}.${R.EditExtraObject}_${unitId}_${subUnitId}`;
1571
1591
  }
1572
1592
  };
1573
1593
  __name(_WorksheetEditExtraObjectPermission, "WorksheetEditExtraObjectPermission");
@@ -1578,8 +1598,8 @@ const _WorksheetFilterPermission = class _WorksheetFilterPermission {
1578
1598
  __publicField(this, "type", L.Worksheet);
1579
1599
  __publicField(this, "status", PermissionStatus.INIT);
1580
1600
  __publicField(this, "id");
1581
- __publicField(this, "subType", D.Filter);
1582
- this.unitId = unitId, this.subUnitId = subUnitId, this.id = `${this.type}.${D.Filter}_${unitId}_${subUnitId}`;
1601
+ __publicField(this, "subType", R.Filter);
1602
+ this.unitId = unitId, this.subUnitId = subUnitId, this.id = `${this.type}.${R.Filter}_${unitId}_${subUnitId}`;
1583
1603
  }
1584
1604
  };
1585
1605
  __name(_WorksheetFilterPermission, "WorksheetFilterPermission");
@@ -1590,8 +1610,8 @@ const _WorksheetInsertColumnPermission = class _WorksheetInsertColumnPermission
1590
1610
  __publicField(this, "type", L.Worksheet);
1591
1611
  __publicField(this, "status", PermissionStatus.INIT);
1592
1612
  __publicField(this, "id");
1593
- __publicField(this, "subType", D.InsertColumn);
1594
- this.unitId = unitId, this.subUnitId = subUnitId, this.id = `${this.type}.${D.InsertColumn}_${unitId}_${subUnitId}`;
1613
+ __publicField(this, "subType", R.InsertColumn);
1614
+ this.unitId = unitId, this.subUnitId = subUnitId, this.id = `${this.type}.${R.InsertColumn}_${unitId}_${subUnitId}`;
1595
1615
  }
1596
1616
  };
1597
1617
  __name(_WorksheetInsertColumnPermission, "WorksheetInsertColumnPermission");
@@ -1602,8 +1622,8 @@ const _WorksheetInsertHyperlinkPermission = class _WorksheetInsertHyperlinkPermi
1602
1622
  __publicField(this, "type", L.Worksheet);
1603
1623
  __publicField(this, "status", PermissionStatus.INIT);
1604
1624
  __publicField(this, "id");
1605
- __publicField(this, "subType", D.InsertHyperlink);
1606
- this.unitId = unitId, this.subUnitId = subUnitId, this.id = `${this.type}.${D.InsertHyperlink}_${unitId}_${subUnitId}`;
1625
+ __publicField(this, "subType", R.InsertHyperlink);
1626
+ this.unitId = unitId, this.subUnitId = subUnitId, this.id = `${this.type}.${R.InsertHyperlink}_${unitId}_${subUnitId}`;
1607
1627
  }
1608
1628
  };
1609
1629
  __name(_WorksheetInsertHyperlinkPermission, "WorksheetInsertHyperlinkPermission");
@@ -1614,8 +1634,8 @@ const _WorksheetInsertRowPermission = class _WorksheetInsertRowPermission {
1614
1634
  __publicField(this, "type", L.Worksheet);
1615
1635
  __publicField(this, "status", PermissionStatus.INIT);
1616
1636
  __publicField(this, "id");
1617
- __publicField(this, "subType", D.InsertRow);
1618
- this.unitId = unitId, this.subUnitId = subUnitId, this.id = `${this.type}.${D.InsertRow}_${unitId}_${subUnitId}`;
1637
+ __publicField(this, "subType", R.InsertRow);
1638
+ this.unitId = unitId, this.subUnitId = subUnitId, this.id = `${this.type}.${R.InsertRow}_${unitId}_${subUnitId}`;
1619
1639
  }
1620
1640
  };
1621
1641
  __name(_WorksheetInsertRowPermission, "WorksheetInsertRowPermission");
@@ -1626,8 +1646,8 @@ const _WorksheetManageCollaboratorPermission = class _WorksheetManageCollaborato
1626
1646
  __publicField(this, "type", L.Worksheet);
1627
1647
  __publicField(this, "status", PermissionStatus.INIT);
1628
1648
  __publicField(this, "id");
1629
- __publicField(this, "subType", D.ManageCollaborator);
1630
- this.unitId = unitId, this.subUnitId = subUnitId, this.id = `${this.type}.${D.ManageCollaborator}_${unitId}_${subUnitId}`;
1649
+ __publicField(this, "subType", R.ManageCollaborator);
1650
+ this.unitId = unitId, this.subUnitId = subUnitId, this.id = `${this.type}.${R.ManageCollaborator}_${unitId}_${subUnitId}`;
1631
1651
  }
1632
1652
  };
1633
1653
  __name(_WorksheetManageCollaboratorPermission, "WorksheetManageCollaboratorPermission");
@@ -1638,8 +1658,8 @@ const _WorksheetPivotTablePermission = class _WorksheetPivotTablePermission {
1638
1658
  __publicField(this, "type", L.Worksheet);
1639
1659
  __publicField(this, "status", PermissionStatus.INIT);
1640
1660
  __publicField(this, "id");
1641
- __publicField(this, "subType", D.PivotTable);
1642
- this.unitId = unitId, this.subUnitId = subUnitId, this.id = `${this.type}.${D.PivotTable}_${unitId}_${subUnitId}`;
1661
+ __publicField(this, "subType", R.PivotTable);
1662
+ this.unitId = unitId, this.subUnitId = subUnitId, this.id = `${this.type}.${R.PivotTable}_${unitId}_${subUnitId}`;
1643
1663
  }
1644
1664
  };
1645
1665
  __name(_WorksheetPivotTablePermission, "WorksheetPivotTablePermission");
@@ -1650,8 +1670,8 @@ const _WorksheetSelectProtectedCellsPermission = class _WorksheetSelectProtected
1650
1670
  __publicField(this, "type", L.Worksheet);
1651
1671
  __publicField(this, "status", PermissionStatus.INIT);
1652
1672
  __publicField(this, "id");
1653
- __publicField(this, "subType", D.SelectProtectedCells);
1654
- this.unitId = unitId, this.subUnitId = subUnitId, this.id = `${this.type}.${D.SelectProtectedCells}_${unitId}_${subUnitId}`;
1673
+ __publicField(this, "subType", R.SelectProtectedCells);
1674
+ this.unitId = unitId, this.subUnitId = subUnitId, this.id = `${this.type}.${R.SelectProtectedCells}_${unitId}_${subUnitId}`;
1655
1675
  }
1656
1676
  };
1657
1677
  __name(_WorksheetSelectProtectedCellsPermission, "WorksheetSelectProtectedCellsPermission");
@@ -1662,8 +1682,8 @@ const _WorksheetSelectUnProtectedCellsPermission = class _WorksheetSelectUnProte
1662
1682
  __publicField(this, "type", L.Worksheet);
1663
1683
  __publicField(this, "status", PermissionStatus.INIT);
1664
1684
  __publicField(this, "id");
1665
- __publicField(this, "subType", D.SelectUnProtectedCells);
1666
- this.unitId = unitId, this.subUnitId = subUnitId, this.id = `${this.type}.${D.SelectUnProtectedCells}_${unitId}_${subUnitId}`;
1685
+ __publicField(this, "subType", R.SelectUnProtectedCells);
1686
+ this.unitId = unitId, this.subUnitId = subUnitId, this.id = `${this.type}.${R.SelectUnProtectedCells}_${unitId}_${subUnitId}`;
1667
1687
  }
1668
1688
  };
1669
1689
  __name(_WorksheetSelectUnProtectedCellsPermission, "WorksheetSelectUnProtectedCellsPermission");
@@ -1674,8 +1694,8 @@ const _WorksheetSetCellStylePermission = class _WorksheetSetCellStylePermission
1674
1694
  __publicField(this, "type", L.Worksheet);
1675
1695
  __publicField(this, "status", PermissionStatus.INIT);
1676
1696
  __publicField(this, "id");
1677
- __publicField(this, "subType", D.SetCellStyle);
1678
- this.unitId = unitId, this.subUnitId = subUnitId, this.id = `${this.type}.${D.SetCellStyle}_${unitId}_${subUnitId}`;
1697
+ __publicField(this, "subType", R.SetCellStyle);
1698
+ this.unitId = unitId, this.subUnitId = subUnitId, this.id = `${this.type}.${R.SetCellStyle}_${unitId}_${subUnitId}`;
1679
1699
  }
1680
1700
  };
1681
1701
  __name(_WorksheetSetCellStylePermission, "WorksheetSetCellStylePermission");
@@ -1686,8 +1706,8 @@ const _WorksheetSetCellValuePermission = class _WorksheetSetCellValuePermission
1686
1706
  __publicField(this, "type", L.Worksheet);
1687
1707
  __publicField(this, "status", PermissionStatus.INIT);
1688
1708
  __publicField(this, "id");
1689
- __publicField(this, "subType", D.SetCellValue);
1690
- this.unitId = unitId, this.subUnitId = subUnitId, this.id = `${this.type}.${D.SetCellValue}_${unitId}_${subUnitId}`;
1709
+ __publicField(this, "subType", R.SetCellValue);
1710
+ this.unitId = unitId, this.subUnitId = subUnitId, this.id = `${this.type}.${R.SetCellValue}_${unitId}_${subUnitId}`;
1691
1711
  }
1692
1712
  };
1693
1713
  __name(_WorksheetSetCellValuePermission, "WorksheetSetCellValuePermission");
@@ -1698,8 +1718,8 @@ const _WorksheetSetColumnStylePermission = class _WorksheetSetColumnStylePermiss
1698
1718
  __publicField(this, "type", L.Worksheet);
1699
1719
  __publicField(this, "status", PermissionStatus.INIT);
1700
1720
  __publicField(this, "id");
1701
- __publicField(this, "subType", D.SetColumnStyle);
1702
- this.unitId = unitId, this.subUnitId = subUnitId, this.id = `${this.type}.${D.SetColumnStyle}_${unitId}_${subUnitId}`;
1721
+ __publicField(this, "subType", R.SetColumnStyle);
1722
+ this.unitId = unitId, this.subUnitId = subUnitId, this.id = `${this.type}.${R.SetColumnStyle}_${unitId}_${subUnitId}`;
1703
1723
  }
1704
1724
  };
1705
1725
  __name(_WorksheetSetColumnStylePermission, "WorksheetSetColumnStylePermission");
@@ -1710,8 +1730,8 @@ const _WorksheetSetRowStylePermission = class _WorksheetSetRowStylePermission {
1710
1730
  __publicField(this, "type", L.Worksheet);
1711
1731
  __publicField(this, "status", PermissionStatus.INIT);
1712
1732
  __publicField(this, "id");
1713
- __publicField(this, "subType", D.SetRowStyle);
1714
- this.unitId = unitId, this.subUnitId = subUnitId, this.id = `${this.type}.${D.SetRowStyle}_${unitId}_${subUnitId}`;
1733
+ __publicField(this, "subType", R.SetRowStyle);
1734
+ this.unitId = unitId, this.subUnitId = subUnitId, this.id = `${this.type}.${R.SetRowStyle}_${unitId}_${subUnitId}`;
1715
1735
  }
1716
1736
  };
1717
1737
  __name(_WorksheetSetRowStylePermission, "WorksheetSetRowStylePermission");
@@ -1722,8 +1742,8 @@ const _WorksheetSortPermission = class _WorksheetSortPermission {
1722
1742
  __publicField(this, "type", L.Worksheet);
1723
1743
  __publicField(this, "status", PermissionStatus.INIT);
1724
1744
  __publicField(this, "id");
1725
- __publicField(this, "subType", D.Sort);
1726
- this.unitId = unitId, this.subUnitId = subUnitId, this.id = `${this.type}.${D.Sort}_${unitId}_${subUnitId}`;
1745
+ __publicField(this, "subType", R.Sort);
1746
+ this.unitId = unitId, this.subUnitId = subUnitId, this.id = `${this.type}.${R.Sort}_${unitId}_${subUnitId}`;
1727
1747
  }
1728
1748
  };
1729
1749
  __name(_WorksheetSortPermission, "WorksheetSortPermission");
@@ -1734,8 +1754,8 @@ const _WorksheetViewPermission = class _WorksheetViewPermission {
1734
1754
  __publicField(this, "type", L.Worksheet);
1735
1755
  __publicField(this, "status", PermissionStatus.INIT);
1736
1756
  __publicField(this, "id");
1737
- __publicField(this, "subType", D.View);
1738
- this.unitId = unitId, this.subUnitId = subUnitId, this.id = `${this.type}.${D.View}_${unitId}_${subUnitId}`;
1757
+ __publicField(this, "subType", R.View);
1758
+ this.unitId = unitId, this.subUnitId = subUnitId, this.id = `${this.type}.${R.View}_${unitId}_${subUnitId}`;
1739
1759
  }
1740
1760
  };
1741
1761
  __name(_WorksheetViewPermission, "WorksheetViewPermission");
@@ -3136,13 +3156,13 @@ const ReorderRangeUndoMutationFactory = /* @__PURE__ */ __name((params) => {
3136
3156
  this._borderInfo$.complete();
3137
3157
  }
3138
3158
  setType(type) {
3139
- this._borderInfo.type = type, this.setActiveBorderType(!0), this.refresh();
3159
+ this._borderInfo.type = type, this.setActiveBorderType(!0), this._refresh();
3140
3160
  }
3141
3161
  setColor(color) {
3142
- this._borderInfo.color = color, this.refresh();
3162
+ this._borderInfo.color = color, this._refresh();
3143
3163
  }
3144
3164
  setStyle(style) {
3145
- this._borderInfo.style = style, this.refresh();
3165
+ this._borderInfo.style = style, this._refresh();
3146
3166
  }
3147
3167
  setActiveBorderType(status) {
3148
3168
  this._borderInfo.activeBorderType = status;
@@ -3150,7 +3170,7 @@ const ReorderRangeUndoMutationFactory = /* @__PURE__ */ __name((params) => {
3150
3170
  getBorderInfo() {
3151
3171
  return this._borderInfo;
3152
3172
  }
3153
- refresh() {
3173
+ _refresh() {
3154
3174
  this._borderInfo$.next(this._borderInfo);
3155
3175
  }
3156
3176
  };
@@ -3498,6 +3518,73 @@ const outlineBorder = /* @__PURE__ */ __name((borderContext) => {
3498
3518
  subUnitId
3499
3519
  });
3500
3520
  }, "handler")
3521
+ };
3522
+ function getOldRowData(currentRow, newRow) {
3523
+ if (currentRow == null)
3524
+ return currentRow;
3525
+ const row = Tools.deepClone(currentRow);
3526
+ if (newRow == null)
3527
+ return row;
3528
+ const oldRow = {};
3529
+ return "h" in newRow && (oldRow.h = row.h), "ia" in newRow && (oldRow.ia = row.ia), "ah" in newRow && (oldRow.ah = row.ah), "hd" in newRow && (oldRow.hd = row.hd), "s" in newRow && (oldRow.s = row.s), "custom" in newRow && (oldRow.custom = row.custom), oldRow;
3530
+ }
3531
+ __name(getOldRowData, "getOldRowData");
3532
+ function getOldColumnData(currenColumn, newColumn) {
3533
+ if (currenColumn == null)
3534
+ return currenColumn;
3535
+ const column = Tools.deepClone(currenColumn);
3536
+ if (newColumn == null)
3537
+ return column;
3538
+ const oldColumn = {};
3539
+ return "w" in newColumn && (oldColumn.w = column.w), "hd" in newColumn && (oldColumn.hd = column.hd), "s" in newColumn && (oldColumn.s = column.s), "custom" in newColumn && (oldColumn.custom = column.custom), oldColumn;
3540
+ }
3541
+ __name(getOldColumnData, "getOldColumnData");
3542
+ const SetColDataMutationFactory = /* @__PURE__ */ __name((params, worksheet) => {
3543
+ const { unitId, subUnitId, columnData } = params, oldColData = {}, manager = worksheet.getColumnManager();
3544
+ for (const colIndex in columnData) {
3545
+ const newCol = columnData[colIndex], currentCol = manager.getColumn(Number(colIndex));
3546
+ oldColData[colIndex] = getOldColumnData(currentCol, newCol);
3547
+ }
3548
+ return {
3549
+ unitId,
3550
+ subUnitId,
3551
+ columnData: oldColData
3552
+ };
3553
+ }, "SetColDataMutationFactory"), SetColDataMutation = {
3554
+ id: "sheet.mutation.set-col-data",
3555
+ type: CommandType.MUTATION,
3556
+ handler: /* @__PURE__ */ __name((accessor, params) => {
3557
+ const { columnData } = params, univerInstanceService = accessor.get(IUniverInstanceService), target = getSheetCommandTarget(univerInstanceService, params);
3558
+ if (!target) return !1;
3559
+ const { worksheet } = target, manager = worksheet.getColumnManager();
3560
+ for (const colIndex in columnData) {
3561
+ const col = columnData[colIndex];
3562
+ if (col == null) {
3563
+ manager.removeColumn(Number(colIndex));
3564
+ continue;
3565
+ }
3566
+ const currentCol = manager.getColumnOrCreate(Number(colIndex));
3567
+ Object.assign(currentCol, col);
3568
+ }
3569
+ return !0;
3570
+ }, "handler")
3571
+ }, SetColDataCommand = {
3572
+ type: CommandType.COMMAND,
3573
+ id: "sheet.command.set-col-data",
3574
+ handler: /* @__PURE__ */ __name((accessor, params) => {
3575
+ const commandService = accessor.get(ICommandService), undoRedoService = accessor.get(IUndoRedoService), univerInstanceService = accessor.get(IUniverInstanceService), target = getSheetCommandTarget(univerInstanceService, params);
3576
+ if (!target) return !1;
3577
+ const { columnData } = params, { unitId, subUnitId, worksheet } = target, redoMutationParams = {
3578
+ subUnitId,
3579
+ unitId,
3580
+ columnData
3581
+ }, undoMutationParams = SetColDataMutationFactory(redoMutationParams, worksheet);
3582
+ return commandService.syncExecuteCommand(SetColDataMutation.id, redoMutationParams) ? (undoRedoService.pushUndoRedo({
3583
+ unitID: unitId,
3584
+ undoMutations: [{ id: SetColDataMutation.id, params: undoMutationParams }],
3585
+ redoMutations: [{ id: SetColDataMutation.id, params: redoMutationParams }]
3586
+ }), !0) : !1;
3587
+ }, "handler")
3501
3588
  }, SetColHiddenUndoMutationFactory = /* @__PURE__ */ __name((accessor, params) => {
3502
3589
  if (accessor.get(IUniverInstanceService).getUniverSheetInstance(params.unitId) == null)
3503
3590
  throw new Error("universheet is null error!");
@@ -3848,6 +3935,52 @@ const SetDefinedNameCommand = {
3848
3935
  }
3849
3936
  return !0;
3850
3937
  }
3938
+ }, SetRowDataMutationFactory = /* @__PURE__ */ __name((params, worksheet) => {
3939
+ const { unitId, subUnitId, rowData } = params, oldRowData = {}, manager = worksheet.getRowManager();
3940
+ for (const rowIndex in rowData) {
3941
+ const newRow = rowData[rowIndex], currentRow = manager.getRow(Number(rowIndex));
3942
+ oldRowData[rowIndex] = getOldRowData(currentRow, newRow);
3943
+ }
3944
+ return {
3945
+ unitId,
3946
+ subUnitId,
3947
+ rowData: oldRowData
3948
+ };
3949
+ }, "SetRowDataMutationFactory"), SetRowDataMutation = {
3950
+ id: "sheet.mutation.set-row-data",
3951
+ type: CommandType.MUTATION,
3952
+ handler: /* @__PURE__ */ __name((accessor, params) => {
3953
+ const { rowData } = params, univerInstanceService = accessor.get(IUniverInstanceService), target = getSheetCommandTarget(univerInstanceService, params);
3954
+ if (!target) return !1;
3955
+ const { worksheet } = target, manager = worksheet.getRowManager();
3956
+ for (const rowIndex in rowData) {
3957
+ const row = rowData[rowIndex];
3958
+ if (row == null) {
3959
+ manager.removeRow(Number(rowIndex));
3960
+ continue;
3961
+ }
3962
+ const currentRow = manager.getRowOrCreate(Number(rowIndex));
3963
+ Object.assign(currentRow, row);
3964
+ }
3965
+ return !0;
3966
+ }, "handler")
3967
+ }, SetRowDataCommand = {
3968
+ type: CommandType.COMMAND,
3969
+ id: "sheet.command.set-row-data",
3970
+ handler: /* @__PURE__ */ __name((accessor, params) => {
3971
+ const commandService = accessor.get(ICommandService), undoRedoService = accessor.get(IUndoRedoService), univerInstanceService = accessor.get(IUniverInstanceService), target = getSheetCommandTarget(univerInstanceService, params);
3972
+ if (!target) return !1;
3973
+ const { rowData } = params, { unitId, subUnitId, worksheet } = target, redoMutationParams = {
3974
+ subUnitId,
3975
+ unitId,
3976
+ rowData
3977
+ }, undoMutationParams = SetRowDataMutationFactory(redoMutationParams, worksheet);
3978
+ return commandService.syncExecuteCommand(SetRowDataMutation.id, redoMutationParams) ? (undoRedoService.pushUndoRedo({
3979
+ unitID: unitId,
3980
+ undoMutations: [{ id: SetRowDataMutation.id, params: undoMutationParams }],
3981
+ redoMutations: [{ id: SetRowDataMutation.id, params: redoMutationParams }]
3982
+ }), !0) : !1;
3983
+ }, "handler")
3851
3984
  }, SetRowVisibleUndoMutationFactory = /* @__PURE__ */ __name((accessor, params) => {
3852
3985
  if (accessor.get(IUniverInstanceService).getUniverSheetInstance(params.unitId) == null)
3853
3986
  throw new Error("universheet is null error!");
@@ -4468,6 +4601,7 @@ const SetStyleCommand = {
4468
4601
  for (let i = 0; i < ranges.length; i++) {
4469
4602
  const range = ranges[i];
4470
4603
  for (let j = range.startColumn; j < range.endColumn + 1; j++) {
4604
+ if (!worksheet.getColVisible(j)) continue;
4471
4605
  const column = manager.getColumnOrCreate(j);
4472
4606
  typeof params.colWidth == "number" ? column.w = params.colWidth : column.w = (_a18 = params.colWidth[j]) != null ? _a18 : defaultColumnWidth;
4473
4607
  }
@@ -4491,7 +4625,7 @@ const SetStyleCommand = {
4491
4625
  let redoMutationParams;
4492
4626
  if (rangeType === RANGE_TYPE.ALL) {
4493
4627
  const rowCount = worksheet.getRowCount(), allColRanges = new Array(worksheet.getColumnCount()).fill(void 0).map(
4494
- (_, index) => ({ startRow: 0, endRow: rowCount - 1, startColumn: index, endColumn: index })
4628
+ (_2, index) => ({ startRow: 0, endRow: rowCount - 1, startColumn: index, endColumn: index })
4495
4629
  );
4496
4630
  redoMutationParams = {
4497
4631
  subUnitId,
@@ -4560,6 +4694,37 @@ const SetStyleCommand = {
4560
4694
  redoMutations: [...(_d = intercepted.preRedos) != null ? _d : [], { id: SetWorksheetColWidthMutation.id, params: redoMutationParams }, ...redos]
4561
4695
  }), !0) : !1;
4562
4696
  }, "handler")
4697
+ }, SetWorksheetColIsAutoWidthCommand = {
4698
+ type: CommandType.COMMAND,
4699
+ id: "sheet.command.set-col-is-auto-width",
4700
+ handler: /* @__PURE__ */ __name(async (accessor, params) => {
4701
+ const commandService = accessor.get(ICommandService), undoRedoService = accessor.get(IUndoRedoService), selectionManagerService = accessor.get(SheetsSelectionsService), univerInstanceService = accessor.get(IUniverInstanceService), target = getSheetCommandTarget(univerInstanceService, params);
4702
+ if (!target) return !1;
4703
+ const { unitId, subUnitId } = target;
4704
+ let ranges = [];
4705
+ if (params != null && params.ranges)
4706
+ ranges = [...params.ranges];
4707
+ else {
4708
+ const selections = selectionManagerService.getCurrentSelections();
4709
+ for (let i = 0; i < selections.length; i++)
4710
+ ranges.push(selections[i].range);
4711
+ }
4712
+ if (!(ranges != null && ranges.length))
4713
+ return !1;
4714
+ const redoMutationParams = {
4715
+ unitId,
4716
+ subUnitId,
4717
+ ranges
4718
+ }, { undos, redos } = accessor.get(SheetInterceptorService).onCommandExecute({
4719
+ id: SetWorksheetColIsAutoWidthCommand.id,
4720
+ params: redoMutationParams
4721
+ });
4722
+ return sequenceExecute([...redos], commandService).result ? (undoRedoService.pushUndoRedo({
4723
+ unitID: unitId,
4724
+ undoMutations: [...undos],
4725
+ redoMutations: [...redos]
4726
+ }), !0) : !1;
4727
+ }, "handler")
4563
4728
  }, SetWorksheetHideMutationFactory = /* @__PURE__ */ __name((accessor, params) => {
4564
4729
  const target = getSheetMutationTarget(accessor.get(IUniverInstanceService), params);
4565
4730
  if (!target)
@@ -4682,9 +4847,82 @@ const SetStyleCommand = {
4682
4847
  redoMutations: [{ id: SetWorksheetOrderMutation.id, params: setWorksheetOrderMutationParams }]
4683
4848
  }), !0) : !1;
4684
4849
  }, "handler")
4685
- }, getAllWorksheetPermissionPoint = /* @__PURE__ */ __name(() => [
4850
+ }, _RangeProtectionPermissionDeleteProtectionPoint = class _RangeProtectionPermissionDeleteProtectionPoint {
4851
+ constructor(unitId, subUnitId, permissionId) {
4852
+ __publicField(this, "type", L.SelectRange);
4853
+ __publicField(this, "subType", R.Delete);
4854
+ __publicField(this, "status", PermissionStatus.INIT);
4855
+ __publicField(this, "value", !0);
4856
+ __publicField(this, "id");
4857
+ __publicField(this, "unitId");
4858
+ __publicField(this, "subUnitId");
4859
+ __publicField(this, "permissionId");
4860
+ this.unitId = unitId, this.subUnitId = subUnitId, this.permissionId = permissionId, this.id = `${L.SelectRange}.${R.Delete}.${permissionId}`;
4861
+ }
4862
+ };
4863
+ __name(_RangeProtectionPermissionDeleteProtectionPoint, "RangeProtectionPermissionDeleteProtectionPoint");
4864
+ let RangeProtectionPermissionDeleteProtectionPoint = _RangeProtectionPermissionDeleteProtectionPoint;
4865
+ const _RangeProtectionPermissionManageCollaPoint = class _RangeProtectionPermissionManageCollaPoint {
4866
+ constructor(unitId, subUnitId, permissionId) {
4867
+ __publicField(this, "type", L.SelectRange);
4868
+ __publicField(this, "subType", R.ManageCollaborator);
4869
+ __publicField(this, "status", PermissionStatus.INIT);
4870
+ __publicField(this, "value", !0);
4871
+ __publicField(this, "id");
4872
+ __publicField(this, "unitId");
4873
+ __publicField(this, "subUnitId");
4874
+ __publicField(this, "permissionId");
4875
+ this.unitId = unitId, this.subUnitId = subUnitId, this.permissionId = permissionId, this.id = `${L.SelectRange}.${R.ManageCollaborator}.${permissionId}`;
4876
+ }
4877
+ };
4878
+ __name(_RangeProtectionPermissionManageCollaPoint, "RangeProtectionPermissionManageCollaPoint");
4879
+ let RangeProtectionPermissionManageCollaPoint = _RangeProtectionPermissionManageCollaPoint;
4880
+ const getAllRangePermissionPoint = /* @__PURE__ */ __name(() => [RangeProtectionPermissionViewPoint, RangeProtectionPermissionEditPoint, RangeProtectionPermissionManageCollaPoint, RangeProtectionPermissionDeleteProtectionPoint], "getAllRangePermissionPoint"), baseProtectionActions = [R.Edit, R.View, R.ManageCollaborator, R.Delete], getDefaultRangePermission = /* @__PURE__ */ __name((unitId = "unitId", subUnitId = "subUnitId", permissionId = "permissionId") => getAllRangePermissionPoint().reduce((r, F) => {
4881
+ const i = new F(unitId, subUnitId, permissionId);
4882
+ return r[i.subType] = i.value, r;
4883
+ }, {}), "getDefaultRangePermission"), getAllWorkbookPermissionPoint = /* @__PURE__ */ __name(() => [
4884
+ WorkbookEditablePermission,
4885
+ WorkbookPrintPermission,
4886
+ WorkbookCommentPermission,
4887
+ WorkbookViewPermission,
4888
+ WorkbookCopyPermission,
4889
+ WorkbookExportPermission,
4890
+ WorkbookManageCollaboratorPermission,
4891
+ WorkbookCreateSheetPermission,
4892
+ WorkbookDeleteSheetPermission,
4893
+ WorkbookRenameSheetPermission,
4894
+ WorkbookHideSheetPermission,
4895
+ WorkbookDuplicatePermission,
4896
+ WorkbookSharePermission,
4897
+ WorkbookMoveSheetPermission,
4898
+ WorkbookCopySheetPermission,
4899
+ WorkbookViewHistoryPermission,
4900
+ WorkbookRecoverHistoryPermission,
4901
+ WorkbookCreateProtectPermission
4902
+ ], "getAllWorkbookPermissionPoint"), defaultWorkbookPermissionPoints = [
4903
+ R.Edit,
4904
+ R.Print,
4905
+ R.Comment,
4906
+ R.View,
4907
+ R.Copy,
4908
+ R.Export,
4909
+ R.ManageCollaborator,
4910
+ R.CreateSheet,
4911
+ R.DeleteSheet,
4912
+ R.RenameSheet,
4913
+ R.HideSheet,
4914
+ R.Duplicate,
4915
+ R.Share,
4916
+ R.MoveSheet,
4917
+ R.CopySheet,
4918
+ R.RecoverHistory,
4919
+ R.ViewHistory,
4920
+ R.CreatePermissionObject
4921
+ ], getAllWorksheetPermissionPoint = /* @__PURE__ */ __name(() => [
4686
4922
  WorksheetEditPermission,
4687
- WorksheetViewPermission
4923
+ WorksheetViewPermission,
4924
+ WorksheetManageCollaboratorPermission,
4925
+ WorksheetDeleteProtectionPermission
4688
4926
  ], "getAllWorksheetPermissionPoint"), getAllWorksheetPermissionPointByPointPanel = /* @__PURE__ */ __name(() => [
4689
4927
  WorksheetCopyPermission,
4690
4928
  WorksheetDeleteColumnPermission,
@@ -4701,20 +4939,20 @@ const SetStyleCommand = {
4701
4939
  WorksheetSetRowStylePermission,
4702
4940
  WorksheetSortPermission
4703
4941
  ], "getAllWorksheetPermissionPointByPointPanel"), defaultWorksheetPermissionPoint = [
4704
- D.Copy,
4705
- D.DeleteColumn,
4706
- D.DeleteRow,
4707
- D.EditExtraObject,
4708
- D.Filter,
4709
- D.InsertColumn,
4710
- D.InsertRow,
4711
- D.InsertHyperlink,
4712
- D.PivotTable,
4713
- D.SetCellStyle,
4714
- D.SetCellValue,
4715
- D.SetColumnStyle,
4716
- D.SetRowStyle,
4717
- D.Sort
4942
+ R.Copy,
4943
+ R.DeleteColumn,
4944
+ R.DeleteRow,
4945
+ R.EditExtraObject,
4946
+ R.Filter,
4947
+ R.InsertColumn,
4948
+ R.InsertRow,
4949
+ R.InsertHyperlink,
4950
+ R.PivotTable,
4951
+ R.SetCellStyle,
4952
+ R.SetCellValue,
4953
+ R.SetColumnStyle,
4954
+ R.SetRowStyle,
4955
+ R.Sort
4718
4956
  ], _WorksheetProtectionPointModel = class _WorksheetProtectionPointModel {
4719
4957
  constructor() {
4720
4958
  __publicField(this, "_model", /* @__PURE__ */ new Map());
@@ -4883,7 +5121,7 @@ let WorksheetPermissionService = (_a4 = class extends RxDisposable {
4883
5121
  }), workbook.sheetDisposed$.subscribe((worksheet) => {
4884
5122
  const subUnitId = worksheet.getSheetId();
4885
5123
  this._rangeProtectionRuleModel.getSubunitRuleList(unitId, subUnitId).forEach((rule) => {
4886
- [RangeProtectionPermissionEditPoint, RangeProtectionPermissionViewPoint].forEach((F) => {
5124
+ [...getAllRangePermissionPoint()].forEach((F) => {
4887
5125
  const instance = new F(unitId, subUnitId, rule.permissionId);
4888
5126
  this._permissionService.deletePermissionPoint(instance.id);
4889
5127
  });
@@ -4947,7 +5185,7 @@ let WorksheetPermissionService = (_a4 = class extends RxDisposable {
4947
5185
  toJson,
4948
5186
  parseJson,
4949
5187
  pluginName: RULE_MODEL_PLUGIN_NAME,
4950
- businesses: [R.UNIVER_SHEET],
5188
+ businesses: [_.UNIVER_SHEET],
4951
5189
  onLoad: /* @__PURE__ */ __name((unitId, resources) => {
4952
5190
  this._worksheetProtectionRuleModel.fromObject(resources), Object.keys(resources).forEach((subUnitId) => {
4953
5191
  getAllWorksheetPermissionPoint().forEach((F) => {
@@ -4957,7 +5195,17 @@ let WorksheetPermissionService = (_a4 = class extends RxDisposable {
4957
5195
  }), this._worksheetProtectionRuleModel.changeRuleInitState(!0);
4958
5196
  }, "onLoad"),
4959
5197
  onUnLoad: /* @__PURE__ */ __name((unitId) => {
4960
- this._worksheetProtectionRuleModel.deleteUnitModel(unitId);
5198
+ const workbook = this._univerInstanceService.getUnit(unitId);
5199
+ workbook && (workbook.getSheets().forEach((worksheet) => {
5200
+ const subUnitId = worksheet.getSheetId();
5201
+ [...getAllWorksheetPermissionPoint(), ...getAllWorksheetPermissionPointByPointPanel()].forEach((F) => {
5202
+ const instance = new F(unitId, subUnitId);
5203
+ this._permissionService.deletePermissionPoint(instance.id);
5204
+ });
5205
+ }), getAllWorkbookPermissionPoint().forEach((F) => {
5206
+ const instance = new F(unitId);
5207
+ this._permissionService.deletePermissionPoint(instance.id);
5208
+ })), this._worksheetProtectionRuleModel.deleteUnitModel(unitId);
4961
5209
  }, "onUnLoad")
4962
5210
  })
4963
5211
  );
@@ -4980,7 +5228,7 @@ let WorksheetPermissionService = (_a4 = class extends RxDisposable {
4980
5228
  toJson,
4981
5229
  parseJson,
4982
5230
  pluginName: POINT_MODEL_PLUGIN_NAME,
4983
- businesses: [R.UNIVER_SHEET],
5231
+ businesses: [_.UNIVER_SHEET],
4984
5232
  onLoad: /* @__PURE__ */ __name((unitId, resources) => {
4985
5233
  this._worksheetProtectionPointRuleModel.fromObject(resources), Object.keys(resources).forEach((subUnitId) => {
4986
5234
  getAllWorksheetPermissionPointByPointPanel().forEach((F) => {
@@ -5123,7 +5371,7 @@ const SetWorksheetPermissionPointsMutation = {
5123
5371
  let redoMutationParams;
5124
5372
  if (rangeType === RANGE_TYPE.ALL) {
5125
5373
  const colCount = worksheet.getRowCount(), allRowRanges = new Array(worksheet.getColumnCount()).fill(void 0).map(
5126
- (_, index) => ({ startRow: index, endRow: index, startColumn: 0, endColumn: colCount - 1 })
5374
+ (_2, index) => ({ startRow: index, endRow: index, startColumn: 0, endColumn: colCount - 1 })
5127
5375
  );
5128
5376
  redoMutationParams = {
5129
5377
  subUnitId,
@@ -5362,6 +5610,38 @@ const SetWorksheetPermissionPointsMutation = {
5362
5610
  unitID: unitId
5363
5611
  }), commandService.syncExecuteCommand(redo.id, redo.params);
5364
5612
  }, "handler")
5613
+ }, ToggleGridlinesMutation = {
5614
+ id: "sheet.mutation.toggle-gridlines",
5615
+ type: CommandType.MUTATION,
5616
+ handler: /* @__PURE__ */ __name((accessor, params) => {
5617
+ const target = getSheetCommandTarget(accessor.get(IUniverInstanceService), params);
5618
+ if (!target) return !1;
5619
+ const { worksheet } = target, config = worksheet.getConfig();
5620
+ return config.showGridlines = params.showGridlines, !0;
5621
+ }, "handler")
5622
+ }, ToggleGridlinesCommand = {
5623
+ type: CommandType.COMMAND,
5624
+ id: "sheet.command.toggle-gridlines",
5625
+ handler: /* @__PURE__ */ __name(async (accessor, params) => {
5626
+ const commandService = accessor.get(ICommandService), undoRedoService = accessor.get(IUndoRedoService), univerInstanceService = accessor.get(IUniverInstanceService), target = getSheetCommandTarget(univerInstanceService);
5627
+ if (!target) return !1;
5628
+ const { worksheet } = target, currentlyShow = worksheet.getConfig().showGridlines;
5629
+ if (currentlyShow === (params == null ? void 0 : params.showGridlines)) return !1;
5630
+ const { unitId, subUnitId } = target, doParams = {
5631
+ showGridlines: currentlyShow === BooleanNumber.TRUE ? BooleanNumber.FALSE : BooleanNumber.TRUE,
5632
+ unitId,
5633
+ subUnitId
5634
+ }, undoMutationParams = {
5635
+ showGridlines: currentlyShow,
5636
+ unitId,
5637
+ subUnitId
5638
+ };
5639
+ return commandService.syncExecuteCommand(ToggleGridlinesMutation.id, doParams) ? (undoRedoService.pushUndoRedo({
5640
+ unitID: unitId,
5641
+ undoMutations: [{ id: ToggleGridlinesMutation.id, params: undoMutationParams }],
5642
+ redoMutations: [{ id: ToggleGridlinesMutation.id, params: doParams }]
5643
+ }), !0) : !1;
5644
+ }, "handler")
5365
5645
  }, AddWorksheetProtectionMutation = {
5366
5646
  id: "sheet.mutation.add-worksheet-protection",
5367
5647
  type: CommandType.MUTATION,
@@ -5556,7 +5836,26 @@ const INumfmtService = createIdentifier("INumfmtService"), factorySetNumfmtUndoM
5556
5836
  values[key] || (values[key] = { ranges: [] }), values[key].ranges.push(cellToRange(item.row, item.col));
5557
5837
  });
5558
5838
  }), { unitId, subUnitId, refMap, values };
5559
- }, "transformCellsToRange"), SetWorksheetProtectionMutation = {
5839
+ }, "transformCellsToRange"), SetWorksheetDefaultStyleMutation = {
5840
+ id: "sheet.mutation.set-worksheet-default-style",
5841
+ type: CommandType.MUTATION,
5842
+ handler: /* @__PURE__ */ __name((accessor, params) => {
5843
+ const { defaultStyle } = params, univerInstanceService = accessor.get(IUniverInstanceService), target = getSheetCommandTarget(univerInstanceService);
5844
+ if (!target) return !1;
5845
+ const { worksheet } = target;
5846
+ return worksheet ? (worksheet.setDefaultCellStyle(defaultStyle), !0) : !1;
5847
+ }, "handler")
5848
+ }, SetWorksheetDefaultStyleMutationFactory = /* @__PURE__ */ __name((accessor, params) => {
5849
+ const target = getSheetMutationTarget(accessor.get(IUniverInstanceService), params);
5850
+ if (!target)
5851
+ throw new Error("[SetWorksheetDefaultStyleMutationFactory]: worksheet is null error!");
5852
+ const { worksheet } = target;
5853
+ return {
5854
+ unitId: params.unitId,
5855
+ subUnitId: worksheet.getSheetId(),
5856
+ defaultStyle: worksheet.getDefaultCellStyle()
5857
+ };
5858
+ }, "SetWorksheetDefaultStyleMutationFactory"), SetWorksheetProtectionMutation = {
5560
5859
  id: "sheet.mutation.set-worksheet-protection",
5561
5860
  type: CommandType.MUTATION,
5562
5861
  handler: /* @__PURE__ */ __name((accessor, params) => {
@@ -5595,8 +5894,7 @@ let BasicWorksheetController = (_a5 = class extends Disposable {
5595
5894
  SetWorksheetNameMutation,
5596
5895
  SetNumfmtMutation,
5597
5896
  ReorderRangeMutation,
5598
- EmptyMutation,
5599
- SetWorksheetColWidthMutation
5897
+ EmptyMutation
5600
5898
  ].forEach((mutation) => {
5601
5899
  var _a19;
5602
5900
  this._commandService.registerCommand(mutation), (_a19 = this._dataSyncPrimaryController) == null || _a19.registerSyncingMutations(mutation);
@@ -5638,6 +5936,8 @@ let BasicWorksheetController = (_a5 = class extends Disposable {
5638
5936
  SetColHiddenMutation,
5639
5937
  SetColVisibleMutation,
5640
5938
  SetColWidthCommand,
5939
+ SetColDataCommand,
5940
+ SetColDataMutation,
5641
5941
  SetFrozenCancelCommand,
5642
5942
  SetFrozenCommand,
5643
5943
  SetFrozenMutation,
@@ -5647,6 +5947,8 @@ let BasicWorksheetController = (_a5 = class extends Disposable {
5647
5947
  SetRowHiddenCommand,
5648
5948
  SetRowHiddenMutation,
5649
5949
  SetRowVisibleMutation,
5950
+ SetRowDataCommand,
5951
+ SetRowDataMutation,
5650
5952
  SetSelectedColsVisibleCommand,
5651
5953
  SetSelectedRowsVisibleCommand,
5652
5954
  SetSpecificColsVisibleCommand,
@@ -5670,12 +5972,16 @@ let BasicWorksheetController = (_a5 = class extends Disposable {
5670
5972
  SetWorksheetRowHeightMutation,
5671
5973
  SetWorksheetRowIsAutoHeightCommand,
5672
5974
  SetWorksheetRowIsAutoHeightMutation,
5975
+ SetWorksheetColWidthMutation,
5976
+ // SetWorksheetColIsAutoWidthCommand,
5673
5977
  SetSelectionsOperation,
5674
5978
  ScrollToCellOperation,
5675
5979
  InsertDefinedNameCommand,
5676
5980
  RemoveDefinedNameCommand,
5677
5981
  SetDefinedNameCommand,
5678
5982
  SetWorksheetShowCommand,
5983
+ ToggleGridlinesCommand,
5984
+ ToggleGridlinesMutation,
5679
5985
  // permissions range protection
5680
5986
  SetWorksheetPermissionPointsCommand,
5681
5987
  AddWorksheetProtectionMutation,
@@ -5688,7 +5994,8 @@ let BasicWorksheetController = (_a5 = class extends Disposable {
5688
5994
  AddRangeProtectionMutation,
5689
5995
  DeleteRangeProtectionMutation,
5690
5996
  SetRangeProtectionMutation,
5691
- ToggleCellCheckboxCommand
5997
+ ToggleCellCheckboxCommand,
5998
+ SetWorksheetDefaultStyleMutation
5692
5999
  ].forEach((command) => this.disposeWithMe(this._commandService.registerCommand(command))), this._configService.setConfig(MAX_CELL_PER_SHEET_KEY, MAX_CELL_PER_SHEET_DEFAULT);
5693
6000
  }
5694
6001
  }, __name(_a5, "BasicWorksheetController"), _a5);
@@ -7768,15 +8075,23 @@ let RangeProtectionCache = (_a11 = class extends Disposable {
7768
8075
  cellMap.delete(`${i}-${j}`), cellInfoMap.delete(`${i}-${j}`);
7769
8076
  }), this._permissionIdCache.delete(rule.permissionId);
7770
8077
  }
8078
+ _getSelectionActions(unitId, subUnitId, rule) {
8079
+ var _a18, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
8080
+ const edit = (_c = (_b = this._permissionService.getPermissionPoint((_a18 = new RangeProtectionPermissionEditPoint(unitId, subUnitId, rule.permissionId)) == null ? void 0 : _a18.id)) == null ? void 0 : _b.value) != null ? _c : !0, view = (_f = (_e = this._permissionService.getPermissionPoint((_d = new RangeProtectionPermissionViewPoint(unitId, subUnitId, rule.permissionId)) == null ? void 0 : _d.id)) == null ? void 0 : _e.value) != null ? _f : !0, manageProtection = (_i = (_h = this._permissionService.getPermissionPoint((_g = new RangeProtectionPermissionManageCollaPoint(unitId, subUnitId, rule.permissionId)) == null ? void 0 : _g.id)) == null ? void 0 : _h.value) != null ? _i : !1, deleteProtection = (_l = (_k = this._permissionService.getPermissionPoint((_j = new RangeProtectionPermissionDeleteProtectionPoint(unitId, subUnitId, rule.permissionId)) == null ? void 0 : _j.id)) == null ? void 0 : _k.value) != null ? _l : !1;
8081
+ return {
8082
+ [R.Edit]: edit,
8083
+ [R.View]: view,
8084
+ [R.ManageCollaborator]: manageProtection,
8085
+ [R.Delete]: deleteProtection
8086
+ };
8087
+ }
7771
8088
  reBuildCache(unitId, subUnitId) {
7772
8089
  const cellRuleMap = this._ensureRuleMap(unitId, subUnitId), cellInfoMap = this._ensureCellInfoMap(unitId, subUnitId);
7773
8090
  cellRuleMap.clear(), cellInfoMap.clear();
7774
8091
  const rowInfoMap = this._ensureRowColInfoMap(unitId, subUnitId, "row"), colInfoMap = this._ensureRowColInfoMap(unitId, subUnitId, "col");
7775
8092
  rowInfoMap.clear(), colInfoMap.clear(), this._ruleModel.getSubunitRuleList(unitId, subUnitId).forEach((rule) => {
7776
- var _a18, _b, _c, _d, _e, _f;
7777
- const edit = (_c = (_b = this._permissionService.getPermissionPoint((_a18 = new RangeProtectionPermissionEditPoint(unitId, subUnitId, rule.permissionId)) == null ? void 0 : _a18.id)) == null ? void 0 : _b.value) != null ? _c : !0, view = (_f = (_e = this._permissionService.getPermissionPoint((_d = new RangeProtectionPermissionViewPoint(unitId, subUnitId, rule.permissionId)) == null ? void 0 : _d.id)) == null ? void 0 : _e.value) != null ? _f : !0, selectionProtection = {
7778
- [D.Edit]: edit,
7779
- [D.View]: view,
8093
+ const selectionActions = this._getSelectionActions(unitId, subUnitId, rule), selectionProtection = {
8094
+ ...selectionActions,
7780
8095
  ruleId: rule.id,
7781
8096
  ranges: rule.ranges
7782
8097
  };
@@ -7784,11 +8099,11 @@ let RangeProtectionCache = (_a11 = class extends Disposable {
7784
8099
  const { startRow, endRow, startColumn, endColumn } = range;
7785
8100
  for (let i = startRow; i <= endRow; i++) {
7786
8101
  const rowInfo = rowInfoMap.get(`${i}`);
7787
- rowInfo ? rowInfo.set(rule.id, { [D.Edit]: edit, [D.View]: view }) : rowInfoMap.set(`${i}`, /* @__PURE__ */ new Map([[rule.id, { [D.Edit]: edit, [D.View]: view }]]));
8102
+ rowInfo ? rowInfo.set(rule.id, selectionActions) : rowInfoMap.set(`${i}`, /* @__PURE__ */ new Map([[rule.id, selectionActions]]));
7788
8103
  for (let j = startColumn; j <= endColumn; j++) {
7789
8104
  cellRuleMap.set(`${i}-${j}`, rule.id), cellInfoMap.set(`${i}-${j}`, selectionProtection);
7790
8105
  const colInfo = colInfoMap.get(`${j}`);
7791
- colInfo ? colInfo.set(rule.id, { [D.Edit]: edit, [D.View]: view }) : colInfoMap.set(`${j}`, /* @__PURE__ */ new Map([[rule.id, { [D.Edit]: edit, [D.View]: view }]]));
8106
+ colInfo ? colInfo.set(rule.id, selectionActions) : colInfoMap.set(`${j}`, /* @__PURE__ */ new Map([[rule.id, selectionActions]]));
7792
8107
  }
7793
8108
  }
7794
8109
  }), this._permissionIdCache.set(rule.permissionId, rule.id);
@@ -7826,22 +8141,21 @@ let RangeProtectionCache = (_a11 = class extends Disposable {
7826
8141
  map((permission) => permission)
7827
8142
  ).subscribe({
7828
8143
  next: /* @__PURE__ */ __name((permission) => {
7829
- var _a18, _b, _c, _d, _e, _f;
7830
8144
  const { subUnitId, unitId, permissionId } = permission, ruleId = this._permissionIdCache.get(permissionId);
7831
8145
  if (!ruleId)
7832
8146
  return;
7833
8147
  const ruleInstance = this._ruleModel.getRule(unitId, subUnitId, ruleId);
7834
8148
  if (!ruleInstance)
7835
8149
  return;
7836
- const rowInfoMap = this._ensureRowColInfoMap(unitId, subUnitId, "row"), colInfoMap = this._ensureRowColInfoMap(unitId, subUnitId, "col"), edit = (_c = (_b = this._permissionService.getPermissionPoint((_a18 = new RangeProtectionPermissionEditPoint(unitId, subUnitId, ruleInstance.permissionId)) == null ? void 0 : _a18.id)) == null ? void 0 : _b.value) != null ? _c : !0, view = (_f = (_e = this._permissionService.getPermissionPoint((_d = new RangeProtectionPermissionViewPoint(unitId, subUnitId, ruleInstance.permissionId)) == null ? void 0 : _d.id)) == null ? void 0 : _e.value) != null ? _f : !0;
8150
+ const rowInfoMap = this._ensureRowColInfoMap(unitId, subUnitId, "row"), colInfoMap = this._ensureRowColInfoMap(unitId, subUnitId, "col"), selectionActions = this._getSelectionActions(unitId, subUnitId, ruleInstance);
7837
8151
  ruleInstance.ranges.forEach((range) => {
7838
8152
  const { startRow, endRow, startColumn, endColumn } = range;
7839
8153
  for (let i = startRow; i <= endRow; i++) {
7840
8154
  const rowInfo = rowInfoMap.get(`${i}`);
7841
- rowInfo ? rowInfo.set(ruleId, { [D.Edit]: edit, [D.View]: view }) : rowInfoMap.set(`${i}`, /* @__PURE__ */ new Map([[ruleId, { [D.Edit]: edit, [D.View]: view }]]));
8155
+ rowInfo ? rowInfo.set(ruleId, selectionActions) : rowInfoMap.set(`${i}`, /* @__PURE__ */ new Map([[ruleId, selectionActions]]));
7842
8156
  for (let j = startColumn; j <= endColumn; j++) {
7843
8157
  const colInfo = colInfoMap.get(`${j}`);
7844
- colInfo ? colInfo.set(ruleId, { [D.Edit]: edit, [D.View]: view }) : colInfoMap.set(`${j}`, /* @__PURE__ */ new Map([[ruleId, { [D.Edit]: edit, [D.View]: view }]]));
8158
+ colInfo ? colInfo.set(ruleId, selectionActions) : colInfoMap.set(`${j}`, /* @__PURE__ */ new Map([[ruleId, selectionActions]]));
7845
8159
  }
7846
8160
  }
7847
8161
  });
@@ -7864,20 +8178,17 @@ let RangeProtectionCache = (_a11 = class extends Disposable {
7864
8178
  });
7865
8179
  }
7866
8180
  getCellInfo(unitId, subUnitId, row, col) {
7867
- var _a18, _b, _c, _d, _e, _f, _g, _h;
8181
+ var _a18, _b;
7868
8182
  const cellMap = this._ensureCellInfoMap(unitId, subUnitId), cacheValue = cellMap.get(`${row}-${col}`);
7869
8183
  if (cacheValue)
7870
8184
  return cacheValue;
7871
- let view = !0, edit = !0;
7872
8185
  const ruleId = (_b = (_a18 = this._cellRuleCache.get(unitId)) == null ? void 0 : _a18.get(subUnitId)) == null ? void 0 : _b.get(`${row}-${col}`);
7873
8186
  if (!ruleId)
7874
8187
  return;
7875
8188
  const rule = this._ruleModel.getRule(unitId, subUnitId, ruleId);
7876
8189
  if (rule) {
7877
- view = (_e = (_d = this._permissionService.getPermissionPoint((_c = new RangeProtectionPermissionViewPoint(unitId, subUnitId, rule.permissionId)) == null ? void 0 : _c.id)) == null ? void 0 : _d.value) != null ? _e : !0, edit = (_h = (_g = this._permissionService.getPermissionPoint((_f = new RangeProtectionPermissionEditPoint(unitId, subUnitId, rule.permissionId)) == null ? void 0 : _f.id)) == null ? void 0 : _g.value) != null ? _h : !0;
7878
8190
  const selectionProtection = {
7879
- [D.Edit]: edit,
7880
- [D.View]: view,
8191
+ ...this._getSelectionActions(unitId, subUnitId, rule),
7881
8192
  ruleId,
7882
8193
  ranges: rule.ranges
7883
8194
  };
@@ -7900,10 +8211,6 @@ RangeProtectionCache = __decorateClass$6([
7900
8211
  __decorateParam$6(1, Inject(IPermissionService)),
7901
8212
  __decorateParam$6(2, Inject(IUniverInstanceService))
7902
8213
  ], RangeProtectionCache);
7903
- const getAllRangePermissionPoint = /* @__PURE__ */ __name(() => [RangeProtectionPermissionViewPoint, RangeProtectionPermissionEditPoint], "getAllRangePermissionPoint"), getDefaultRangePermission = /* @__PURE__ */ __name((unitId = "unitId", subUnitId = "subUnitId", permissionId = "permissionId") => getAllRangePermissionPoint().reduce((r, F) => {
7904
- const i = new F(unitId, subUnitId, permissionId);
7905
- return r[i.subType] = i.value, r;
7906
- }, {}), "getDefaultRangePermission");
7907
8214
  var __defProp$5 = Object.defineProperty, __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor, __decorateClass$5 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
7908
8215
  for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
7909
8216
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
@@ -8090,9 +8397,7 @@ let NumfmtService = (_a13 = class extends Disposable {
8090
8397
  const cell = worksheet.getCellRaw(row, col);
8091
8398
  if (cell) {
8092
8399
  const newStyle = { ...styles.getStyleByCell(cell) || {}, n: { pattern: value.pattern } }, styleId = styles.setValue(newStyle);
8093
- cell.s = styleId;
8094
- const type = getCellTypeByPattern(cell, value.pattern);
8095
- cell.v !== void 0 && (cell.t = type, cell.v = getCellValue(type, cell));
8400
+ cell.s = styleId, value.pattern === DEFAULT_TEXT_FORMAT && (cell.t = CellValueType.STRING);
8096
8401
  } else {
8097
8402
  const style = { n: { pattern: value.pattern } }, styleId = styles.setValue(style);
8098
8403
  styleId && matrix.setValue(row, col, { s: styleId });
@@ -8357,8 +8662,8 @@ var __defProp$2 = Object.defineProperty, __getOwnPropDesc$2 = Object.getOwnPrope
8357
8662
  const PLUGIN_NAME$1 = "SHEET_RANGE_PROTECTION_PLUGIN";
8358
8663
  var _a15;
8359
8664
  let RangeProtectionService = (_a15 = class extends Disposable {
8360
- constructor(_selectionProtectionRuleModel, _permissionService, _resourceManagerService, _selectionProtectionCache) {
8361
- super(), this._selectionProtectionRuleModel = _selectionProtectionRuleModel, this._permissionService = _permissionService, this._resourceManagerService = _resourceManagerService, this._selectionProtectionCache = _selectionProtectionCache, this._initSnapshot(), this._initRuleChange();
8665
+ constructor(_selectionProtectionRuleModel, _permissionService, _resourceManagerService, _selectionProtectionCache, _univerInstanceService) {
8666
+ super(), this._selectionProtectionRuleModel = _selectionProtectionRuleModel, this._permissionService = _permissionService, this._resourceManagerService = _resourceManagerService, this._selectionProtectionCache = _selectionProtectionCache, this._univerInstanceService = _univerInstanceService, this._initSnapshot(), this._initRuleChange();
8362
8667
  }
8363
8668
  _initRuleChange() {
8364
8669
  this.disposeWithMe(
@@ -8409,7 +8714,7 @@ let RangeProtectionService = (_a15 = class extends Disposable {
8409
8714
  toJson,
8410
8715
  parseJson,
8411
8716
  pluginName: PLUGIN_NAME$1,
8412
- businesses: [R.UNIVER_SHEET],
8717
+ businesses: [_.UNIVER_SHEET],
8413
8718
  onLoad: /* @__PURE__ */ __name((unitId, resources) => {
8414
8719
  const result = this._selectionProtectionRuleModel.toObject();
8415
8720
  result[unitId] = resources, this._selectionProtectionRuleModel.fromObject(result);
@@ -8421,7 +8726,7 @@ let RangeProtectionService = (_a15 = class extends Disposable {
8421
8726
  objectID: rule.permissionId,
8422
8727
  unitID: unitId,
8423
8728
  objectType: L.SelectRange,
8424
- actions: [D.View, D.Edit]
8729
+ actions: baseProtectionActions
8425
8730
  });
8426
8731
  }), list.forEach((rule) => {
8427
8732
  getAllRangePermissionPoint().forEach((Factor) => {
@@ -8432,7 +8737,7 @@ let RangeProtectionService = (_a15 = class extends Disposable {
8432
8737
  });
8433
8738
  }, "onLoad"),
8434
8739
  onUnLoad: /* @__PURE__ */ __name((unitId) => {
8435
- this._selectionProtectionRuleModel.deleteUnitModel(unitId), this._selectionProtectionCache.deleteUnit(unitId);
8740
+ this._selectionProtectionCache.deleteUnit(unitId);
8436
8741
  }, "onUnLoad")
8437
8742
  })
8438
8743
  );
@@ -8442,53 +8747,17 @@ RangeProtectionService = __decorateClass$2([
8442
8747
  __decorateParam$2(0, Inject(RangeProtectionRuleModel)),
8443
8748
  __decorateParam$2(1, Inject(IPermissionService)),
8444
8749
  __decorateParam$2(2, Inject(IResourceManagerService)),
8445
- __decorateParam$2(3, Inject(RangeProtectionCache))
8750
+ __decorateParam$2(3, Inject(RangeProtectionCache)),
8751
+ __decorateParam$2(4, Inject(IUniverInstanceService))
8446
8752
  ], RangeProtectionService);
8447
- const getAllWorkbookPermissionPoint = /* @__PURE__ */ __name(() => [
8448
- WorkbookEditablePermission,
8449
- WorkbookPrintPermission,
8450
- WorkbookCommentPermission,
8451
- WorkbookViewPermission,
8452
- WorkbookCopyPermission,
8453
- WorkbookExportPermission,
8454
- WorkbookManageCollaboratorPermission,
8455
- WorkbookCreateSheetPermission,
8456
- WorkbookDeleteSheetPermission,
8457
- WorkbookRenameSheetPermission,
8458
- WorkbookHideSheetPermission,
8459
- WorkbookDuplicatePermission,
8460
- WorkbookSharePermission,
8461
- WorkbookMoveSheetPermission,
8462
- WorkbookCopySheetPermission,
8463
- WorkbookViewHistoryPermission,
8464
- WorkbookRecoverHistoryPermission
8465
- ], "getAllWorkbookPermissionPoint"), defaultWorkbookPermissionPoints = [
8466
- D.Edit,
8467
- D.Print,
8468
- D.Comment,
8469
- D.View,
8470
- D.Copy,
8471
- D.Export,
8472
- D.ManageCollaborator,
8473
- D.CreateSheet,
8474
- D.DeleteSheet,
8475
- D.RenameSheet,
8476
- D.HideSheet,
8477
- D.Duplicate,
8478
- D.Share,
8479
- D.MoveSheet,
8480
- D.CopySheet,
8481
- D.RecoverHistory,
8482
- D.ViewHistory
8483
- ];
8484
8753
  var __defProp$1 = Object.defineProperty, __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor, __decorateClass$1 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
8485
8754
  for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
8486
8755
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
8487
8756
  return kind && result && __defProp$1(target, key, result), result;
8488
8757
  }, "__decorateClass$1"), __decorateParam$1 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$1"), _a16;
8489
8758
  let WorkbookPermissionService = (_a16 = class extends Disposable {
8490
- constructor(_permissionService, _univerInstanceService, _rangeProtectionRuleModel) {
8491
- super(), this._permissionService = _permissionService, this._univerInstanceService = _univerInstanceService, this._rangeProtectionRuleModel = _rangeProtectionRuleModel, this._init();
8759
+ constructor(_permissionService, _univerInstanceService, _rangeProtectionRuleModel, _worksheetProtectionRuleModel, _worksheetProtectionPointModel) {
8760
+ super(), this._permissionService = _permissionService, this._univerInstanceService = _univerInstanceService, this._rangeProtectionRuleModel = _rangeProtectionRuleModel, this._worksheetProtectionRuleModel = _worksheetProtectionRuleModel, this._worksheetProtectionPointModel = _worksheetProtectionPointModel, this._init();
8492
8761
  }
8493
8762
  _init() {
8494
8763
  const handleWorkbook = /* @__PURE__ */ __name((workbook) => {
@@ -8507,7 +8776,7 @@ let WorkbookPermissionService = (_a16 = class extends Disposable {
8507
8776
  workbook.getSheets().forEach((worksheet) => {
8508
8777
  const subUnitId = worksheet.getSheetId();
8509
8778
  this._rangeProtectionRuleModel.getSubunitRuleList(unitId, subUnitId).forEach((rule) => {
8510
- [RangeProtectionPermissionEditPoint, RangeProtectionPermissionViewPoint].forEach((F) => {
8779
+ [...getAllRangePermissionPoint()].forEach((F) => {
8511
8780
  const instance = new F(unitId, subUnitId, rule.permissionId);
8512
8781
  this._permissionService.deletePermissionPoint(instance.id);
8513
8782
  });
@@ -8518,14 +8787,16 @@ let WorkbookPermissionService = (_a16 = class extends Disposable {
8518
8787
  }), getAllWorkbookPermissionPoint().forEach((F) => {
8519
8788
  const instance = new F(unitId);
8520
8789
  this._permissionService.deletePermissionPoint(instance.id);
8521
- });
8790
+ }), this._rangeProtectionRuleModel.deleteUnitModel(unitId), this._worksheetProtectionPointModel.deleteUnitModel(unitId), this._worksheetProtectionRuleModel.deleteUnitModel(unitId);
8522
8791
  }));
8523
8792
  }
8524
8793
  }, __name(_a16, "WorkbookPermissionService"), _a16);
8525
8794
  WorkbookPermissionService = __decorateClass$1([
8526
8795
  __decorateParam$1(0, Inject(IPermissionService)),
8527
8796
  __decorateParam$1(1, Inject(IUniverInstanceService)),
8528
- __decorateParam$1(2, Inject(RangeProtectionRuleModel))
8797
+ __decorateParam$1(2, Inject(RangeProtectionRuleModel)),
8798
+ __decorateParam$1(3, Inject(WorksheetProtectionRuleModel)),
8799
+ __decorateParam$1(4, Inject(WorksheetProtectionPointModel))
8529
8800
  ], WorkbookPermissionService);
8530
8801
  var __defProp2 = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyDescriptor, __defNormalProp2 = /* @__PURE__ */ __name((obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, "__defNormalProp"), __decorateClass = /* @__PURE__ */ __name((decorators, target, key, kind) => {
8531
8802
  for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
@@ -8541,8 +8812,8 @@ let UniverSheetsPlugin = (_a17 = class extends Plugin {
8541
8812
  this._configService.setConfig(PLUGIN_CONFIG_KEY, rest), this._initConfig(), this._initDependencies();
8542
8813
  }
8543
8814
  _initConfig() {
8544
- var _a18;
8545
- (_a18 = this._config) != null && _a18.onlyRegisterFormulaRelatedMutations && this._configService.setConfig(ONLY_REGISTER_FORMULA_RELATED_MUTATIONS_KEY, !0);
8815
+ var _a18, _b;
8816
+ (_a18 = this._config) != null && _a18.onlyRegisterFormulaRelatedMutations && this._configService.setConfig(ONLY_REGISTER_FORMULA_RELATED_MUTATIONS_KEY, !0), (_b = this._config) != null && _b.isRowStylePrecedeColumnStyle && this._configService.setConfig(IS_ROW_STYLE_PRECEDE_COLUMN_STYLE, !0);
8546
8817
  }
8547
8818
  _initDependencies() {
8548
8819
  var _a18;
@@ -8626,13 +8897,17 @@ const COMMAND_LISTENER_SKELETON_CHANGE = [
8626
8897
  InsertColMutation.id,
8627
8898
  InsertRowMutation.id,
8628
8899
  RemoveColMutation.id,
8629
- RemoveRowMutation.id
8900
+ RemoveRowMutation.id,
8901
+ ToggleGridlinesMutation.id
8630
8902
  ], COMMAND_LISTENER_VALUE_CHANGE = [
8631
8903
  SetRangeValuesMutation.id,
8632
8904
  MoveRangeMutation.id,
8633
8905
  RemoveWorksheetMergeMutation.id,
8634
8906
  AddWorksheetMergeMutation.id,
8635
- ReorderRangeMutation.id
8907
+ ReorderRangeMutation.id,
8908
+ SetWorksheetDefaultStyleMutation.id,
8909
+ SetRowDataMutation.id,
8910
+ SetColDataMutation.id
8636
8911
  ], SELECTION_CONTROL_BORDER_BUFFER_WIDTH = 1.5, SELECTION_CONTROL_BORDER_BUFFER_COLOR = "rgba(255, 255, 255, 0.01)";
8637
8912
  function getNormalSelectionStyle(themeService) {
8638
8913
  const styleSheet = themeService.getCurrentTheme(), fill = new ColorKit(styleSheet.primaryColor).setAlpha(0.07).toRgbString();
@@ -9089,44 +9364,15 @@ async function addMergeCellsUtil(injector, unitId, subUnitId, ranges) {
9089
9364
  });
9090
9365
  }
9091
9366
  __name(addMergeCellsUtil, "addMergeCellsUtil");
9092
- const SetHideGridlinesUndoMutationFactory = /* @__PURE__ */ __name((accessor, params) => {
9093
- const oldStatus = accessor.get(IUniverInstanceService).getUniverSheetInstance(params.unitId).getSheetBySheetId(params.subUnitId).getConfig().showGridlines;
9094
- return {
9095
- ...Tools.deepClone(params),
9096
- hideGridlines: oldStatus
9097
- };
9098
- }, "SetHideGridlinesUndoMutationFactory"), SetHideGridlinesMutation = {
9099
- id: "sheet.mutation.set-hide-gridlines",
9100
- type: CommandType.MUTATION,
9101
- handler: /* @__PURE__ */ __name((accessor, params) => {
9102
- const workbook = accessor.get(IUniverInstanceService).getUniverSheetInstance(params.unitId);
9103
- if (!workbook) return !1;
9104
- const worksheet = workbook.getSheetBySheetId(params.subUnitId);
9105
- if (!worksheet) return !1;
9106
- const config = worksheet.getConfig();
9107
- return config.showGridlines = params.hideGridlines, !0;
9108
- }, "handler")
9109
- }, SetHideGridlinesCommand = {
9367
+ const SetWorksheetDefaultStyleCommand = {
9110
9368
  type: CommandType.COMMAND,
9111
- id: "sheet.command.set-hide-gridlines",
9112
- handler: /* @__PURE__ */ __name(async (accessor, params) => {
9113
- var _a18;
9114
- const commandService = accessor.get(ICommandService), undoRedoService = accessor.get(IUndoRedoService), univerInstanceService = accessor.get(IUniverInstanceService), target = getSheetCommandTarget(univerInstanceService);
9115
- if (!target) return !1;
9116
- const { unitId, subUnitId } = target;
9117
- let hideGridlines = BooleanNumber.FALSE;
9118
- params && (hideGridlines = (_a18 = params.hideGridlines) != null ? _a18 : BooleanNumber.FALSE);
9119
- const workbook = univerInstanceService.getUniverSheetInstance(unitId);
9120
- if (!workbook || !workbook.getSheetBySheetId(subUnitId)) return !1;
9121
- const setHideGridlinesMutationParams = {
9122
- hideGridlines,
9123
- unitId,
9124
- subUnitId
9125
- }, undoMutationParams = SetHideGridlinesUndoMutationFactory(accessor, setHideGridlinesMutationParams);
9126
- return commandService.syncExecuteCommand(SetHideGridlinesMutation.id, setHideGridlinesMutationParams) ? (undoRedoService.pushUndoRedo({
9369
+ id: "sheet.command.set-worksheet-default-style",
9370
+ handler: /* @__PURE__ */ __name((accessor, params) => {
9371
+ const commandService = accessor.get(ICommandService), undoRedoService = accessor.get(IUndoRedoService), { unitId } = params, undoMutationParams = SetWorksheetDefaultStyleMutationFactory(accessor, params);
9372
+ return commandService.syncExecuteCommand(SetWorksheetDefaultStyleMutation.id, params) ? (undoRedoService.pushUndoRedo({
9127
9373
  unitID: unitId,
9128
- undoMutations: [{ id: SetHideGridlinesMutation.id, params: undoMutationParams }],
9129
- redoMutations: [{ id: SetHideGridlinesMutation.id, params: setHideGridlinesMutationParams }]
9374
+ undoMutations: [{ id: SetWorksheetDefaultStyleMutation.id, params: undoMutationParams }],
9375
+ redoMutations: [{ id: SetWorksheetDefaultStyleMutation.id, params }]
9130
9376
  }), !0) : !1;
9131
9377
  }, "handler")
9132
9378
  }, SetWorksheetRightToLeftUndoMutationFactory = /* @__PURE__ */ __name((accessor, params) => {
@@ -9246,7 +9492,9 @@ export {
9246
9492
  OperatorType,
9247
9493
  RangeMergeUtil,
9248
9494
  RangeProtectionCache,
9495
+ RangeProtectionPermissionDeleteProtectionPoint,
9249
9496
  RangeProtectionPermissionEditPoint,
9497
+ RangeProtectionPermissionManageCollaPoint,
9250
9498
  RangeProtectionPermissionViewPoint,
9251
9499
  RangeProtectionRefRangeService,
9252
9500
  RangeProtectionRenderModel,
@@ -9282,6 +9530,9 @@ export {
9282
9530
  SetBorderCommand,
9283
9531
  SetBorderPositionCommand,
9284
9532
  SetBorderStyleCommand,
9533
+ SetColDataCommand,
9534
+ SetColDataMutation,
9535
+ SetColDataMutationFactory,
9285
9536
  SetColHiddenCommand,
9286
9537
  SetColHiddenMutation,
9287
9538
  SetColVisibleMutation,
@@ -9293,8 +9544,6 @@ export {
9293
9544
  SetFrozenCommand,
9294
9545
  SetFrozenMutation,
9295
9546
  SetFrozenMutationFactory,
9296
- SetHideGridlinesCommand,
9297
- SetHideGridlinesMutation,
9298
9547
  SetHorizontalTextAlignCommand,
9299
9548
  SetItalicCommand,
9300
9549
  SetNumfmtMutation,
@@ -9304,6 +9553,9 @@ export {
9304
9553
  SetRangeValuesCommand,
9305
9554
  SetRangeValuesMutation,
9306
9555
  SetRangeValuesUndoMutationFactory,
9556
+ SetRowDataCommand,
9557
+ SetRowDataMutation,
9558
+ SetRowDataMutationFactory,
9307
9559
  SetRowHeightCommand,
9308
9560
  SetRowHiddenCommand,
9309
9561
  SetRowHiddenMutation,
@@ -9328,6 +9580,9 @@ export {
9328
9580
  SetWorksheetActiveOperation,
9329
9581
  SetWorksheetColWidthMutation,
9330
9582
  SetWorksheetColWidthMutationFactory,
9583
+ SetWorksheetDefaultStyleCommand,
9584
+ SetWorksheetDefaultStyleMutation,
9585
+ SetWorksheetDefaultStyleMutationFactory,
9331
9586
  SetWorksheetHideCommand,
9332
9587
  SetWorksheetHideMutation,
9333
9588
  SetWorksheetNameCommand,
@@ -9348,12 +9603,15 @@ export {
9348
9603
  SheetInterceptorService,
9349
9604
  SheetsSelectionsService,
9350
9605
  ToggleCellCheckboxCommand,
9351
- D as UnitAction,
9606
+ ToggleGridlinesCommand,
9607
+ ToggleGridlinesMutation,
9608
+ R as UnitAction,
9352
9609
  L as UnitObject,
9353
9610
  UniverSheetsPlugin,
9354
9611
  WorkbookCommentPermission,
9355
9612
  WorkbookCopyPermission,
9356
9613
  WorkbookCopySheetPermission,
9614
+ WorkbookCreateProtectPermission,
9357
9615
  WorkbookCreateSheetPermission,
9358
9616
  WorkbookDeleteSheetPermission,
9359
9617
  WorkbookDuplicatePermission,
@@ -9373,6 +9631,7 @@ export {
9373
9631
  WorkbookViewPermission,
9374
9632
  WorksheetCopyPermission,
9375
9633
  WorksheetDeleteColumnPermission,
9634
+ WorksheetDeleteProtectionPermission,
9376
9635
  WorksheetDeleteRowPermission,
9377
9636
  WorksheetEditExtraObjectPermission,
9378
9637
  WorksheetEditPermission,
@@ -9395,6 +9654,7 @@ export {
9395
9654
  WorksheetViewPermission,
9396
9655
  addMergeCellsUtil,
9397
9656
  alignToMergedCellsBorders,
9657
+ baseProtectionActions,
9398
9658
  checkRangesEditablePermission,
9399
9659
  convertPrimaryWithCoordToPrimary,
9400
9660
  convertSelectionDataToRange,