@univerjs/sheets 0.22.1 → 0.23.0-insiders.20260522-e8f2a3b

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/facade.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { BooleanNumber, CanceledError, DEFAULT_STYLES, Dimension, Direction, HorizontalAlign, IAuthzIoService, ICommandService, ILogService, IPermissionService, IResourceLoaderService, IUniverInstanceService, Inject, Injector, LocaleService, ObjectMatrix, RANGE_TYPE, Rectangle, RedoCommand, RichTextValue, TextStyleValue, Tools, UndoCommand, UniverInstanceType, VerticalAlign, WrapStrategy, cellToRange, covertCellValue, covertCellValues, generateIntervalsByPoints, generateRandomId, isNullCell, mergeWorksheetSnapshotWithDefault, toDisposable } from "@univerjs/core";
2
2
  import { FBase, FBaseInitialable, FEnum, FEventName, FUniver } from "@univerjs/core/facade";
3
- import { AddRangeProtectionMutation, AddWorksheetProtectionMutation, AppendRowCommand, AutoFillCommand, COMMAND_LISTENER_VALUE_CHANGE, CancelFrozenCommand, ClearSelectionAllCommand, ClearSelectionContentCommand, ClearSelectionFormatCommand, CopySheetCommand, DeleteRangeMoveLeftCommand, DeleteRangeMoveUpCommand, DeleteRangeProtectionMutation, DeleteWorksheetProtectionMutation, DeleteWorksheetRangeThemeStyleCommand, EditStateEnum, InsertColByRangeCommand, InsertRangeMoveDownCommand, InsertRangeMoveRightCommand, InsertRowByRangeCommand, InsertSheetCommand, MoveColsCommand, MoveRowsCommand, RangeProtectionPermissionDeleteProtectionPoint, RangeProtectionPermissionEditPoint, RangeProtectionPermissionManageCollaPoint, RangeProtectionPermissionViewPoint, RangeProtectionRuleModel, RangeThemeStyle, RegisterWorksheetRangeThemeStyleCommand, RemoveColByRangeCommand, RemoveDefinedNameCommand, RemoveRowByRangeCommand, RemoveSheetCommand, RemoveWorksheetMergeCommand, SCOPE_WORKBOOK_VALUE_DEFINED_NAME, SetBorderBasicCommand, SetColDataCommand, SetColHiddenCommand, SetColWidthCommand, SetDefinedNameCommand, SetFrozenCommand, SetGridlinesColorCommand, SetHorizontalTextAlignCommand, SetRangeCustomMetadataCommand, SetRangeProtectionMutation, SetRangeValuesCommand, SetRangeValuesMutation, SetRowDataCommand, SetRowHeightCommand, SetRowHiddenCommand, SetSelectionsOperation, SetSpecificColsVisibleCommand, SetSpecificRowsVisibleCommand, SetStyleCommand, SetTabColorCommand, SetTabColorMutation, SetTextRotationCommand, SetTextWrapCommand, SetVerticalTextAlignCommand, SetWorkbookNameCommand, SetWorksheetActiveOperation, SetWorksheetColumnCountCommand, SetWorksheetDefaultStyleMutation, SetWorksheetHideCommand, SetWorksheetHideMutation, SetWorksheetNameCommand, SetWorksheetOrderCommand, SetWorksheetOrderMutation, SetWorksheetRangeThemeStyleCommand, SetWorksheetRowCountCommand, SetWorksheetRowIsAutoHeightCommand, SetWorksheetRowIsAutoHeightMutation, SetWorksheetShowCommand, SheetRangeThemeService, SheetSkeletonChangeType, SheetValueChangeType, SheetsFreezeSyncController, SheetsSelectionsService, SplitDelimiterEnum, SplitTextToColumnsCommand, ToggleGridlinesCommand, UnitObject, UnregisterWorksheetRangeThemeStyleCommand, ViewStateEnum, WorkbookCommentPermission, WorkbookCopyPermission, WorkbookCopySheetPermission, WorkbookCreateProtectPermission, WorkbookCreateSheetPermission, WorkbookDeleteColumnPermission, WorkbookDeleteRowPermission, WorkbookDeleteSheetPermission, WorkbookDuplicatePermission, WorkbookEditablePermission, WorkbookExportPermission, WorkbookHideSheetPermission, WorkbookInsertColumnPermission, WorkbookInsertRowPermission, WorkbookManageCollaboratorPermission, WorkbookMoveSheetPermission, WorkbookPrintPermission, WorkbookRecoverHistoryPermission, WorkbookRenameSheetPermission, WorkbookSharePermission, WorkbookViewHistoryPermission, WorkbookViewPermission, WorksheetCopyPermission, WorksheetDeleteColumnPermission, WorksheetDeleteProtectionPermission, WorksheetDeleteRowPermission, WorksheetEditExtraObjectPermission, WorksheetEditPermission, WorksheetFilterPermission, WorksheetInsertColumnPermission, WorksheetInsertHyperlinkPermission, WorksheetInsertRowPermission, WorksheetManageCollaboratorPermission, WorksheetPivotTablePermission, WorksheetProtectionPointModel, WorksheetProtectionRuleModel, WorksheetSelectProtectedCellsPermission, WorksheetSelectUnProtectedCellsPermission, WorksheetSetCellStylePermission, WorksheetSetCellValuePermission, WorksheetSetColumnStylePermission, WorksheetSetRowStylePermission, WorksheetSortPermission, WorksheetViewPermission, addMergeCellsUtil, copyRangeStyles, getAddMergeMutationRangeByType, getAllWorksheetPermissionPoint, getAllWorksheetPermissionPointByPointPanel, getNextPrimaryCell, getPrimaryForRange, getValueChangedEffectedRange, validateDefinedName } from "@univerjs/sheets";
3
+ import { AddRangeProtectionMutation, AddWorksheetProtectionMutation, AppendRowCommand, AutoFillCommand, COMMAND_LISTENER_VALUE_CHANGE, CancelFrozenCommand, ClearSelectionAllCommand, ClearSelectionContentCommand, ClearSelectionFormatCommand, CopySheetCommand, DeleteRangeMoveLeftCommand, DeleteRangeMoveUpCommand, DeleteRangeProtectionMutation, DeleteWorksheetProtectionMutation, DeleteWorksheetRangeThemeStyleCommand, EditStateEnum, InsertColByRangeCommand, InsertRangeMoveDownCommand, InsertRangeMoveRightCommand, InsertRowByRangeCommand, InsertSheetCommand, MoveColsCommand, MoveRowsCommand, RangeProtectionPermissionDeleteProtectionPoint, RangeProtectionPermissionEditPoint, RangeProtectionPermissionManageCollaPoint, RangeProtectionPermissionViewPoint, RangeProtectionRuleModel, RangeThemeStyle, RegisterWorksheetRangeThemeStyleCommand, RemoveColByRangeCommand, RemoveDefinedNameCommand, RemoveRowByRangeCommand, RemoveSheetCommand, RemoveWorksheetMergeCommand, SCOPE_WORKBOOK_VALUE_DEFINED_NAME, SetBorderBasicCommand, SetColDataCommand, SetColHiddenCommand, SetColWidthCommand, SetDefinedNameCommand, SetFrozenCommand, SetGridlinesColorCommand, SetHorizontalTextAlignCommand, SetRangeCustomMetadataCommand, SetRangeProtectionMutation, SetRangeValuesCommand, SetRowDataCommand, SetRowHeightCommand, SetRowHiddenCommand, SetSelectionsOperation, SetSpecificColsVisibleCommand, SetSpecificRowsVisibleCommand, SetStyleCommand, SetTabColorCommand, SetTabColorMutation, SetTextRotationCommand, SetTextWrapCommand, SetVerticalTextAlignCommand, SetWorkbookNameCommand, SetWorksheetActiveOperation, SetWorksheetColumnCountCommand, SetWorksheetDefaultStyleMutation, SetWorksheetHideCommand, SetWorksheetHideMutation, SetWorksheetNameCommand, SetWorksheetOrderCommand, SetWorksheetOrderMutation, SetWorksheetRangeThemeStyleCommand, SetWorksheetRowCountCommand, SetWorksheetRowIsAutoHeightCommand, SetWorksheetRowIsAutoHeightMutation, SetWorksheetShowCommand, SheetRangeThemeService, SheetSkeletonChangeType, SheetValueChangeType, SheetsFreezeSyncController, SheetsSelectionsService, SplitDelimiterEnum, SplitTextToColumnsCommand, ToggleGridlinesCommand, UnitObject, UnregisterWorksheetRangeThemeStyleCommand, ViewStateEnum, WorkbookCommentPermission, WorkbookCopyPermission, WorkbookCopySheetPermission, WorkbookCreateProtectPermission, WorkbookCreateSheetPermission, WorkbookDeleteColumnPermission, WorkbookDeleteRowPermission, WorkbookDeleteSheetPermission, WorkbookDuplicatePermission, WorkbookEditablePermission, WorkbookExportPermission, WorkbookHideSheetPermission, WorkbookInsertColumnPermission, WorkbookInsertRowPermission, WorkbookManageCollaboratorPermission, WorkbookMoveSheetPermission, WorkbookPrintPermission, WorkbookRecoverHistoryPermission, WorkbookRenameSheetPermission, WorkbookSharePermission, WorkbookViewHistoryPermission, WorkbookViewPermission, WorksheetCopyPermission, WorksheetDeleteColumnPermission, WorksheetDeleteProtectionPermission, WorksheetDeleteRowPermission, WorksheetEditExtraObjectPermission, WorksheetEditPermission, WorksheetFilterPermission, WorksheetInsertColumnPermission, WorksheetInsertHyperlinkPermission, WorksheetInsertRowPermission, WorksheetManageCollaboratorPermission, WorksheetPivotTablePermission, WorksheetProtectionPointModel, WorksheetProtectionRuleModel, WorksheetSelectProtectedCellsPermission, WorksheetSelectUnProtectedCellsPermission, WorksheetSetCellStylePermission, WorksheetSetCellValuePermission, WorksheetSetColumnStylePermission, WorksheetSetRowStylePermission, WorksheetSortPermission, WorksheetViewPermission, addMergeCellsUtil, copyRangeStyles, getAddMergeMutationRangeByType, getAllWorksheetPermissionPoint, getAllWorksheetPermissionPointByPointPanel, getNextPrimaryCell, getPrimaryForRange, getValueChangedEffectedRange, validateDefinedName } from "@univerjs/sheets";
4
4
  import { FormulaDataModel, IDefinedNamesService, IFunctionService, ISuperTableService, deserializeRangeWithSheet, serializeRange, serializeRangeWithSheet } from "@univerjs/engine-formula";
5
5
  import { ObjectScope, UnitAction, UnitObject as UnitObject$1, UnitRole } from "@univerjs/protocol";
6
6
 
@@ -3333,7 +3333,6 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
3333
3333
  * Sets the frozen state of the current sheet.
3334
3334
  * @param {IFreeze} freeze - the scrolling viewport start range and count of freezed rows and columns.
3335
3335
  * that means if you want to freeze the first 3 rows and 2 columns, you should set freeze as { startRow: 3, startColumn: 2, xSplit: 2, ySplit: 3 }
3336
- * @deprecated use `setFrozenRows` and `setFrozenColumns` instead.
3337
3336
  * @returns {FWorksheet} This worksheet instance for chaining
3338
3337
  * @example
3339
3338
  * ```typescript
@@ -3348,7 +3347,6 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
3348
3347
  * ```
3349
3348
  */
3350
3349
  setFreeze(freeze) {
3351
- this._logService.warn("setFreeze is deprecated, use setFrozenRows and setFrozenColumns instead");
3352
3350
  this._commandService.syncExecuteCommand(SetFrozenCommand.id, {
3353
3351
  ...freeze,
3354
3352
  unitId: this._workbook.getUnitId(),
@@ -3604,28 +3602,6 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
3604
3602
  return this._worksheet.getTabColor();
3605
3603
  }
3606
3604
  /**
3607
- * @deprecated use `univerAPI.addEvent(univerAPI.Event.SheetValueChanged, (params) => {})` instead
3608
- */
3609
- onCellDataChange(callback) {
3610
- return this._injector.get(ICommandService).onCommandExecuted((command) => {
3611
- if (command.id === SetRangeValuesMutation.id) {
3612
- const params = command.params;
3613
- if (params.unitId === this._workbook.getUnitId() && params.subUnitId === this._worksheet.getSheetId() && params.cellValue) callback(new ObjectMatrix(params.cellValue));
3614
- }
3615
- });
3616
- }
3617
- /**
3618
- * @deprecated use `univerAPI.addEvent(univerAPI.Event.BeforeSheetEditEnd, (params) => {})` instead
3619
- */
3620
- onBeforeCellDataChange(callback) {
3621
- return this._injector.get(ICommandService).beforeCommandExecuted((command) => {
3622
- if (command.id === SetRangeValuesMutation.id) {
3623
- const params = command.params;
3624
- if (params.unitId === this._workbook.getUnitId() && params.subUnitId === this._worksheet.getSheetId() && params.cellValue) callback(new ObjectMatrix(params.cellValue));
3625
- }
3626
- });
3627
- }
3628
- /**
3629
3605
  * Hides this sheet. Has no effect if the sheet is already hidden. If this method is called on the only visible sheet, it throws an exception.
3630
3606
  * @returns {FWorksheet} Returns the current worksheet instance for method chaining
3631
3607
  * @example
@@ -3821,7 +3797,7 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
3821
3797
  }
3822
3798
  /**
3823
3799
  * Returns a Range corresponding to the dimensions in which data is present.
3824
- * This is functionally equivalent to creating a Range bounded by A1 and (Sheet.getLastColumn(), Sheet.getLastRow()).
3800
+ * Empty cells with style or formatting will also be included in the data range. If there is no data on the sheet, returns a Range corresponding to the top-left cell of the sheet (A1).
3825
3801
  * @returns {FRange} The range of the data in the sheet.
3826
3802
  * @example
3827
3803
  * ```ts
@@ -3838,14 +3814,6 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
3838
3814
  return this.getRange(startRow, startColumn, endRow - startRow + 1, endColumn - startColumn + 1);
3839
3815
  }
3840
3816
  /**
3841
- * @deprecated use `getLastColumn` instead.
3842
- * Returns the column index of the last column that contains content.
3843
- * @returns {number} the column index of the last column that contains content.
3844
- */
3845
- getLastColumns() {
3846
- return this._worksheet.getLastColumnWithContent();
3847
- }
3848
- /**
3849
3817
  * Returns the column index of the last column that contains content.
3850
3818
  * @returns {number} the column index of the last column that contains content.
3851
3819
  * @example
@@ -3862,14 +3830,6 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
3862
3830
  return this._worksheet.getLastColumnWithContent();
3863
3831
  }
3864
3832
  /**
3865
- * @deprecated use `getLastRow` instead.
3866
- * Returns the row index of the last row that contains content.
3867
- * @returns {number} the row index of the last row that contains content.
3868
- */
3869
- getLastRows() {
3870
- return this._worksheet.getLastRowWithContent();
3871
- }
3872
- /**
3873
3833
  * Returns the row index of the last row that contains content.
3874
3834
  * @returns {number} the row index of the last row that contains content.
3875
3835
  * @example
package/lib/index.js CHANGED
@@ -234,9 +234,8 @@ let SheetInterceptorService = class SheetInterceptorService extends Disposable {
234
234
  _defineProperty(this, "_afterCommandInterceptors", []);
235
235
  _defineProperty(this, "_workbookDisposables", /* @__PURE__ */ new Map());
236
236
  _defineProperty(this, "_worksheetDisposables", /* @__PURE__ */ new Map());
237
- _defineProperty(this, "_interceptorsDirty", false);
238
237
  _defineProperty(this, "_composedInterceptorByKey", /* @__PURE__ */ new Map());
239
- _defineProperty(this, "_composedInterceptorsLengthByKey", /* @__PURE__ */ new Map());
238
+ _defineProperty(this, "_composedInterceptorVersion", 0);
240
239
  _defineProperty(this, "writeCellInterceptor", new InterceptorManager({
241
240
  BEFORE_CELL_EDIT,
242
241
  AFTER_CELL_EDIT,
@@ -271,6 +270,7 @@ let SheetInterceptorService = class SheetInterceptorService extends Disposable {
271
270
  this._worksheetDisposables.forEach((disposable) => disposable.dispose());
272
271
  this._worksheetDisposables.clear();
273
272
  this._interceptorsByName.clear();
273
+ this._composedInterceptorByKey.clear();
274
274
  }
275
275
  /**
276
276
  * Add a listener function to a specific command to add affiliated mutations. It should be called in controllers.
@@ -436,7 +436,7 @@ let SheetInterceptorService = class SheetInterceptorService extends Disposable {
436
436
  var _b$priority6, _a$priority6;
437
437
  return ((_b$priority6 = b.priority) !== null && _b$priority6 !== void 0 ? _b$priority6 : 0) - ((_a$priority6 = a.priority) !== null && _a$priority6 !== void 0 ? _a$priority6 : 0);
438
438
  });
439
- this._interceptorsDirty = true;
439
+ this._invalidateComposedInterceptors();
440
440
  if (key === INTERCEPTOR_POINT.CELL_CONTENT) {
441
441
  const JOINED_EFFECT = InterceptorEffectEnum.Style | InterceptorEffectEnum.Value;
442
442
  this._interceptorsByName.set(`${key}-${JOINED_EFFECT}`, sortedInterceptors);
@@ -448,27 +448,44 @@ let SheetInterceptorService = class SheetInterceptorService extends Disposable {
448
448
  remove(this._interceptorsByName.get(`${key}-${JOINED_EFFECT}`), interceptor);
449
449
  remove(this._interceptorsByName.get(`${key}-${InterceptorEffectEnum.Style}`), interceptor);
450
450
  remove(this._interceptorsByName.get(`${key}-${InterceptorEffectEnum.Value}`), interceptor);
451
+ this._invalidateComposedInterceptors();
451
452
  }));
452
453
  } else {
453
454
  this._interceptorsByName.set(key, sortedInterceptors);
454
- return this.disposeWithMe(toDisposable(() => remove(this._interceptorsByName.get(key), interceptor)));
455
+ return this.disposeWithMe(toDisposable(() => {
456
+ remove(this._interceptorsByName.get(key), interceptor);
457
+ this._invalidateComposedInterceptors();
458
+ }));
455
459
  }
456
460
  }
457
461
  fetchThroughInterceptors(name, effect, _key, filter) {
458
- var _this$_interceptorsBy;
459
462
  const byNamesKey = effect === void 0 ? name : `${name}-${effect}`;
460
463
  const key = _key !== null && _key !== void 0 ? _key : byNamesKey;
461
464
  let composed = this._composedInterceptorByKey.get(key);
462
- const composedInterceptorsLength = this._composedInterceptorsLengthByKey.get(key) || 0;
463
- if (!composed || !this._interceptorsDirty || composedInterceptorsLength !== (((_this$_interceptorsBy = this._interceptorsByName.get(byNamesKey)) === null || _this$_interceptorsBy === void 0 ? void 0 : _this$_interceptorsBy.length) || 0)) {
465
+ if (!composed) {
464
466
  let interceptors = this._interceptorsByName.get(byNamesKey);
465
467
  if (interceptors && filter) interceptors = interceptors.filter(filter);
466
468
  composed = composeInterceptors(interceptors || []);
467
469
  this._composedInterceptorByKey.set(key, composed);
468
- this._composedInterceptorsLengthByKey.set(key, (interceptors === null || interceptors === void 0 ? void 0 : interceptors.length) || 0);
469
470
  }
470
471
  return composed;
471
472
  }
473
+ _invalidateComposedInterceptors() {
474
+ this._composedInterceptorVersion += 1;
475
+ this._composedInterceptorByKey.clear();
476
+ }
477
+ _getCommonCellContentInterceptor(effect, cache) {
478
+ let composed = cache.get(effect);
479
+ if (!composed) {
480
+ composed = this.fetchThroughInterceptors(INTERCEPTOR_POINT.CELL_CONTENT, effect);
481
+ cache.set(effect, composed);
482
+ }
483
+ return composed;
484
+ }
485
+ _getCommonRowFilteredInterceptor(cache) {
486
+ if (!cache.interceptor) cache.interceptor = this.fetchThroughInterceptors(INTERCEPTOR_POINT.ROW_FILTERED);
487
+ return cache.interceptor;
488
+ }
472
489
  _interceptWorkbook(workbook) {
473
490
  const disposables = new DisposableCollection();
474
491
  const unitId = workbook.getUnitId();
@@ -477,10 +494,14 @@ let SheetInterceptorService = class SheetInterceptorService extends Disposable {
477
494
  const subUnitId = worksheet.getSheetId();
478
495
  worksheet.__interceptViewModel((viewModel) => {
479
496
  const sheetDisposables = new DisposableCollection();
497
+ const commonCellContentInterceptors = /* @__PURE__ */ new Map();
498
+ const commonRowFilteredInterceptor = { interceptor: null };
499
+ let commonCellContentInterceptorsVersion = -1;
500
+ let commonRowFilteredInterceptorVersion = -1;
480
501
  sheetInterceptorService._worksheetDisposables.set(getWorksheetDisposableID(unitId, worksheet), sheetDisposables);
481
502
  sheetDisposables.add(viewModel.registerCellContentInterceptor({ getCell(row, col, effect, key, filter) {
482
503
  const rawData = worksheet.getCellRaw(row, col);
483
- return sheetInterceptorService.fetchThroughInterceptors(INTERCEPTOR_POINT.CELL_CONTENT, effect, key, filter)(rawData, {
504
+ const context = {
484
505
  unitId,
485
506
  subUnitId,
486
507
  row,
@@ -488,10 +509,22 @@ let SheetInterceptorService = class SheetInterceptorService extends Disposable {
488
509
  worksheet,
489
510
  workbook,
490
511
  rawData
491
- });
512
+ };
513
+ if (key === void 0 && filter === void 0) {
514
+ if (commonCellContentInterceptorsVersion !== sheetInterceptorService._composedInterceptorVersion) {
515
+ commonCellContentInterceptors.clear();
516
+ commonCellContentInterceptorsVersion = sheetInterceptorService._composedInterceptorVersion;
517
+ }
518
+ return sheetInterceptorService._getCommonCellContentInterceptor(effect, commonCellContentInterceptors)(rawData, context);
519
+ }
520
+ return sheetInterceptorService.fetchThroughInterceptors(INTERCEPTOR_POINT.CELL_CONTENT, effect, key, filter)(rawData, context);
492
521
  } }));
493
522
  sheetDisposables.add(viewModel.registerRowFilteredInterceptor({ getRowFiltered(row) {
494
- return !!sheetInterceptorService.fetchThroughInterceptors(INTERCEPTOR_POINT.ROW_FILTERED)(false, {
523
+ if (commonRowFilteredInterceptorVersion !== sheetInterceptorService._composedInterceptorVersion) {
524
+ commonRowFilteredInterceptor.interceptor = null;
525
+ commonRowFilteredInterceptorVersion = sheetInterceptorService._composedInterceptorVersion;
526
+ }
527
+ return !!sheetInterceptorService._getCommonRowFilteredInterceptor(commonRowFilteredInterceptor)(false, {
495
528
  unitId,
496
529
  subUnitId,
497
530
  row,
@@ -18931,7 +18964,7 @@ let RangeProtectionCache = class RangeProtectionCache extends Disposable {
18931
18964
  });
18932
18965
  }
18933
18966
  _initUpdateCellInfoCache() {
18934
- this._permissionService.permissionPointUpdate$.pipe(filter((permission) => permission.type === UnitObject$1.SelectRange), map((permission) => permission)).subscribe((permission) => {
18967
+ this.disposeWithMe(this._permissionService.permissionPointUpdate$.pipe(filter((permission) => permission.type === UnitObject$1.SelectRange), map((permission) => permission)).subscribe((permission) => {
18935
18968
  const { subUnitId, unitId, permissionId } = permission;
18936
18969
  const ruleId = this._permissionIdCache.get(permissionId);
18937
18970
  if (!ruleId) return;
@@ -18942,8 +18975,8 @@ let RangeProtectionCache = class RangeProtectionCache extends Disposable {
18942
18975
  const { startRow, endRow, startColumn, endColumn } = range;
18943
18976
  for (let i = startRow; i <= endRow; i++) for (let j = startColumn; j <= endColumn; j++) cellInfoMap.delete(`${i}-${j}`);
18944
18977
  });
18945
- });
18946
- this._ruleModel.ruleChange$.subscribe((info) => {
18978
+ }));
18979
+ this.disposeWithMe(this._ruleModel.ruleChange$.subscribe((info) => {
18947
18980
  const { unitId, subUnitId } = info;
18948
18981
  const cellInfoMap = this._ensureCellInfoMap(unitId, subUnitId);
18949
18982
  info.rule.ranges.forEach((range) => {
@@ -18959,10 +18992,10 @@ let RangeProtectionCache = class RangeProtectionCache extends Disposable {
18959
18992
  });
18960
18993
  });
18961
18994
  }
18962
- });
18995
+ }));
18963
18996
  }
18964
18997
  _initUpdateCellRuleCache() {
18965
- this._ruleModel.ruleChange$.subscribe((ruleChange) => {
18998
+ this.disposeWithMe(this._ruleModel.ruleChange$.subscribe((ruleChange) => {
18966
18999
  const { type } = ruleChange;
18967
19000
  if (type === "add") this._addCellRuleCache(ruleChange);
18968
19001
  else if (type === "delete") this._deleteCellRuleCache(ruleChange);
@@ -18973,7 +19006,7 @@ let RangeProtectionCache = class RangeProtectionCache extends Disposable {
18973
19006
  });
18974
19007
  this._addCellRuleCache(ruleChange);
18975
19008
  }
18976
- });
19009
+ }));
18977
19010
  }
18978
19011
  _ensureRuleMap(unitId, subUnitId) {
18979
19012
  let subUnitMap = this._cellRuleCache.get(unitId);
@@ -19106,7 +19139,7 @@ let RangeProtectionCache = class RangeProtectionCache extends Disposable {
19106
19139
  });
19107
19140
  }
19108
19141
  _initUpdateRowColInfoCache() {
19109
- this._permissionService.permissionPointUpdate$.pipe(filter((permission) => permission.type === UnitObject$1.SelectRange), map((permission) => permission)).subscribe({ next: (permission) => {
19142
+ this.disposeWithMe(this._permissionService.permissionPointUpdate$.pipe(filter((permission) => permission.type === UnitObject$1.SelectRange), map((permission) => permission)).subscribe({ next: (permission) => {
19110
19143
  const { subUnitId, unitId, permissionId } = permission;
19111
19144
  const ruleId = this._permissionIdCache.get(permissionId);
19112
19145
  if (!ruleId) return;
@@ -19128,8 +19161,8 @@ let RangeProtectionCache = class RangeProtectionCache extends Disposable {
19128
19161
  }
19129
19162
  }
19130
19163
  });
19131
- } });
19132
- this._ruleModel.ruleChange$.subscribe((info) => {
19164
+ } }));
19165
+ this.disposeWithMe(this._ruleModel.ruleChange$.subscribe((info) => {
19133
19166
  if (info.type === "delete") {
19134
19167
  const { unitId, subUnitId, rule } = info;
19135
19168
  const rowInfoMap = this._ensureRowColInfoMap(unitId, subUnitId, "row");
@@ -19146,7 +19179,7 @@ let RangeProtectionCache = class RangeProtectionCache extends Disposable {
19146
19179
  }
19147
19180
  });
19148
19181
  }
19149
- });
19182
+ }));
19150
19183
  }
19151
19184
  getCellInfo(unitId, subUnitId, row, col) {
19152
19185
  var _this$_cellRuleCache$;
@@ -19189,7 +19222,7 @@ RangeProtectionCache = __decorate([
19189
19222
  //#endregion
19190
19223
  //#region package.json
19191
19224
  var name = "@univerjs/sheets";
19192
- var version = "0.22.1";
19225
+ var version = "0.23.0-insiders.20260522-e8f2a3b";
19193
19226
 
19194
19227
  //#endregion
19195
19228
  //#region src/controllers/active-worksheet.controller.ts
@@ -13,10 +13,10 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import type { CellValue, CustomData, ICellData, IColumnRange, IDisposable, IFreeze, IObjectArrayPrimitiveType, IRange, IRowRange, IStyleData, Nullable, Workbook, Worksheet } from '@univerjs/core';
16
+ import type { CellValue, CustomData, IColumnRange, IFreeze, IObjectArrayPrimitiveType, IRange, IRowRange, IStyleData, Nullable, Workbook, Worksheet } from '@univerjs/core';
17
17
  import type { FDefinedName } from './f-defined-name';
18
18
  import type { FWorkbook } from './f-workbook';
19
- import { BooleanNumber, ICommandService, ILogService, Injector, ObjectMatrix } from '@univerjs/core';
19
+ import { BooleanNumber, ICommandService, ILogService, Injector } from '@univerjs/core';
20
20
  import { FBaseInitialable } from '@univerjs/core/facade';
21
21
  import { SheetsSelectionsService } from '@univerjs/sheets';
22
22
  import { FRange } from './f-range';
@@ -940,7 +940,6 @@ export declare class FWorksheet extends FBaseInitialable {
940
940
  * Sets the frozen state of the current sheet.
941
941
  * @param {IFreeze} freeze - the scrolling viewport start range and count of freezed rows and columns.
942
942
  * that means if you want to freeze the first 3 rows and 2 columns, you should set freeze as { startRow: 3, startColumn: 2, xSplit: 2, ySplit: 3 }
943
- * @deprecated use `setFrozenRows` and `setFrozenColumns` instead.
944
943
  * @returns {FWorksheet} This worksheet instance for chaining
945
944
  * @example
946
945
  * ```typescript
@@ -1157,14 +1156,6 @@ export declare class FWorksheet extends FBaseInitialable {
1157
1156
  * ```
1158
1157
  */
1159
1158
  getTabColor(): string | undefined;
1160
- /**
1161
- * @deprecated use `univerAPI.addEvent(univerAPI.Event.SheetValueChanged, (params) => {})` instead
1162
- */
1163
- onCellDataChange(callback: (cellValue: ObjectMatrix<Nullable<ICellData>>) => void): IDisposable;
1164
- /**
1165
- * @deprecated use `univerAPI.addEvent(univerAPI.Event.BeforeSheetEditEnd, (params) => {})` instead
1166
- */
1167
- onBeforeCellDataChange(callback: (cellValue: ObjectMatrix<Nullable<ICellData>>) => void): IDisposable;
1168
1159
  /**
1169
1160
  * Hides this sheet. Has no effect if the sheet is already hidden. If this method is called on the only visible sheet, it throws an exception.
1170
1161
  * @returns {FWorksheet} Returns the current worksheet instance for method chaining
@@ -1282,7 +1273,7 @@ export declare class FWorksheet extends FBaseInitialable {
1282
1273
  clearFormats(): FWorksheet;
1283
1274
  /**
1284
1275
  * Returns a Range corresponding to the dimensions in which data is present.
1285
- * This is functionally equivalent to creating a Range bounded by A1 and (Sheet.getLastColumn(), Sheet.getLastRow()).
1276
+ * Empty cells with style or formatting will also be included in the data range. If there is no data on the sheet, returns a Range corresponding to the top-left cell of the sheet (A1).
1286
1277
  * @returns {FRange} The range of the data in the sheet.
1287
1278
  * @example
1288
1279
  * ```ts
@@ -1295,12 +1286,6 @@ export declare class FWorksheet extends FBaseInitialable {
1295
1286
  * ```
1296
1287
  */
1297
1288
  getDataRange(): FRange;
1298
- /**
1299
- * @deprecated use `getLastColumn` instead.
1300
- * Returns the column index of the last column that contains content.
1301
- * @returns {number} the column index of the last column that contains content.
1302
- */
1303
- getLastColumns(): number;
1304
1289
  /**
1305
1290
  * Returns the column index of the last column that contains content.
1306
1291
  * @returns {number} the column index of the last column that contains content.
@@ -1315,12 +1300,6 @@ export declare class FWorksheet extends FBaseInitialable {
1315
1300
  * ```
1316
1301
  */
1317
1302
  getLastColumn(): number;
1318
- /**
1319
- * @deprecated use `getLastRow` instead.
1320
- * Returns the row index of the last row that contains content.
1321
- * @returns {number} the row index of the last row that contains content.
1322
- */
1323
- getLastRows(): number;
1324
1303
  /**
1325
1304
  * Returns the row index of the last row that contains content.
1326
1305
  * @returns {number} the row index of the last row that contains content.
@@ -64,9 +64,8 @@ export declare class SheetInterceptorService extends Disposable {
64
64
  private _afterCommandInterceptors;
65
65
  private readonly _workbookDisposables;
66
66
  private readonly _worksheetDisposables;
67
- private _interceptorsDirty;
68
67
  private _composedInterceptorByKey;
69
- private _composedInterceptorsLengthByKey;
68
+ private _composedInterceptorVersion;
70
69
  readonly writeCellInterceptor: InterceptorManager<{
71
70
  BEFORE_CELL_EDIT: IInterceptor<ICellDataForSheetInterceptor, ISheetLocationForEditor>;
72
71
  AFTER_CELL_EDIT: IInterceptor<ICellDataForSheetInterceptor, ISheetLocationForEditor>;
@@ -121,6 +120,9 @@ export declare class SheetInterceptorService extends Disposable {
121
120
  onValidateCell(workbook: Workbook, worksheet: Worksheet, row: number, col: number): Nullable<Promise<boolean>>;
122
121
  intercept<T extends IInterceptor<any, any>>(name: T, interceptor: T): IDisposable;
123
122
  fetchThroughInterceptors<T, C>(name: IInterceptor<T, C>, effect?: InterceptorEffectEnum, _key?: string, filter?: (interceptor: IInterceptor<any, any>) => boolean): ReturnType<IComposeInterceptors<T, C>>;
123
+ private _invalidateComposedInterceptors;
124
+ private _getCommonCellContentInterceptor;
125
+ private _getCommonRowFilteredInterceptor;
124
126
  private _interceptWorkbook;
125
127
  private _disposeWorkbookInterceptor;
126
128
  private _disposeSheetInterceptor;