Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.
TypeScript boardcollaborationdocdocxexceloffce365officepdfpptpptxpresentationsdksheetslidesspreadsheetuniverwordwordprocessorworkspacexlsx
feat(rangetheme): support a performance cache for consider hide row (#5651)
VicKun25674c21d16d
diff --git a/packages/sheets-filter-ui/src/commands/commands/__tests__/sheets-filter.command.spec.ts b/packages/sheets-filter-ui/src/commands/commands/__tests__/sheets-filter.command.spec.tsindex 006b1d93d2..fedc3b2656 100644--- a/packages/sheets-filter-ui/src/commands/commands/__tests__/sheets-filter.command.spec.ts+++ b/packages/sheets-filter-ui/src/commands/commands/__tests__/sheets-filter.command.spec.ts@@ -20,7 +20,7 @@ import type { FilterModel, ISetSheetsFilterRangeMutationParams } from '@univerjsimport type { ISetSheetsFilterCriteriaCommandParams } from '@univerjs/sheets-filter/commands/commands/sheets-filter.command.js';import { AuthzIoLocalService, IAuthzIoService, ICommandService, Inject, Injector, IUniverInstanceService, LocaleType, Plugin, RANGE_TYPE, RedoCommand, UndoCommand, Univer, UniverInstanceType } from '@univerjs/core';import { ActiveDirtyManagerService, IActiveDirtyManagerService, ISheetRowFilteredService, SheetRowFilteredService } from '@univerjs/engine-formula';-import { RangeProtectionRuleModel, RefRangeService, SetRangeValuesCommand, SetRangeValuesMutation, SheetInterceptorService, SheetsSelectionsService, WorkbookPermissionService, WorksheetPermissionService, WorksheetProtectionPointModel, WorksheetProtectionRuleModel } from '@univerjs/sheets';+import { RangeProtectionRuleModel, RefRangeService, SetRangeValuesCommand, SetRangeValuesMutation, SheetInterceptorService, SheetRangeThemeModel, SheetsSelectionsService, WorkbookPermissionService, WorksheetPermissionService, WorksheetProtectionPointModel, WorksheetProtectionRuleModel, ZebraCrossingCacheController } from '@univerjs/sheets';import { SetSheetsFilterRangeMutation, SheetsFilterService, UniverSheetsFilterPlugin } from '@univerjs/sheets-filter';import { ClearSheetsFilterCriteriaCommand, ReCalcSheetsFilterCommand, RemoveSheetFilterCommand, SetSheetFilterRangeCommand, SetSheetsFilterCriteriaCommand, SmartToggleSheetsFilterCommand } from '@univerjs/sheets-filter/commands/commands/sheets-filter.command.js';import { IMessageService } from '@univerjs/ui';@@ -102,6 +102,8 @@ function createFilterCommandTestBed() {[IMessageService, { useClass: MockMessageService }],[IActiveDirtyManagerService, { useClass: ActiveDirtyManagerService }],[ISheetRowFilteredService, { useClass: SheetRowFilteredService }],+ [SheetRangeThemeModel],+ [ZebraCrossingCacheController],] as Dependency[]).forEach((d) => this._injector.add(d));this._injector.get(SheetInterceptorService);diff --git a/packages/sheets-filter-ui/src/commands/operations/__tests__/sheets-filter.operation.spec.ts b/packages/sheets-filter-ui/src/commands/operations/__tests__/sheets-filter.operation.spec.tsindex 8f276a9541..aeca503e41 100644--- a/packages/sheets-filter-ui/src/commands/operations/__tests__/sheets-filter.operation.spec.ts+++ b/packages/sheets-filter-ui/src/commands/operations/__tests__/sheets-filter.operation.spec.ts@@ -19,7 +19,7 @@ import type { ISetSheetsFilterRangeMutationParams } from '@univerjs/sheets-filteimport type { IEditorBridgeServiceVisibleParam } from '@univerjs/sheets-ui';import { CommandType, ICommandService, IContextService, Inject, Injector, LocaleService, LocaleType, Plugin, Univer, UniverInstanceType } from '@univerjs/core';import { ActiveDirtyManagerService, IActiveDirtyManagerService, ISheetRowFilteredService, SheetRowFilteredService } from '@univerjs/engine-formula';-import { RefRangeService, SheetInterceptorService, SheetsSelectionsService } from '@univerjs/sheets';+import { RefRangeService, SheetInterceptorService, SheetRangeThemeModel, SheetsSelectionsService, ZebraCrossingCacheController } from '@univerjs/sheets';import { SetSheetsFilterRangeMutation, UniverSheetsFilterPlugin } from '@univerjs/sheets-filter';import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';import { SheetsFilterPanelService } from '../../../services/sheets-filter-panel.service';@@ -79,6 +79,8 @@ function createFilterOperationTestBed() {[SheetsFilterPanelService],[RefRangeService],[SheetsSelectionsService],+ [SheetRangeThemeModel],+ [ZebraCrossingCacheController],[IActiveDirtyManagerService, { useClass: ActiveDirtyManagerService }],[ISheetRowFilteredService, { useClass: SheetRowFilteredService }],] as Dependency[]).forEach((d) => this._injector.add(d));diff --git a/packages/sheets-filter-ui/src/controllers/__tests__/sheets-filter.menu.spec.ts b/packages/sheets-filter-ui/src/controllers/__tests__/sheets-filter.menu.spec.tsindex f9ba5ea323..5bb346a93a 100644--- a/packages/sheets-filter-ui/src/controllers/__tests__/sheets-filter.menu.spec.ts+++ b/packages/sheets-filter-ui/src/controllers/__tests__/sheets-filter.menu.spec.ts@@ -18,7 +18,7 @@ import type { IWorkbookData, Workbook } from '@univerjs/core';import type { ISetSheetsFilterCriteriaMutationParams, ISetSheetsFilterRangeMutationParams } from '@univerjs/sheets-filter';import { AuthzIoLocalService, DisposableCollection, IAuthzIoService, ICommandService, Inject, Injector, LocaleType, Plugin, Univer, UniverInstanceType } from '@univerjs/core';import { ActiveDirtyManagerService, IActiveDirtyManagerService, ISheetRowFilteredService, SheetRowFilteredService } from '@univerjs/engine-formula';-import { ExclusiveRangeService, IExclusiveRangeService, RangeProtectionRuleModel, RefRangeService, SetWorksheetActiveOperation, SheetInterceptorService, SheetsSelectionsService, WorkbookPermissionService, WorksheetPermissionService, WorksheetProtectionPointModel, WorksheetProtectionRuleModel } from '@univerjs/sheets';+import { ExclusiveRangeService, IExclusiveRangeService, RangeProtectionRuleModel, RefRangeService, SetWorksheetActiveOperation, SheetInterceptorService, SheetRangeThemeModel, SheetsSelectionsService, WorkbookPermissionService, WorksheetPermissionService, WorksheetProtectionPointModel, WorksheetProtectionRuleModel, ZebraCrossingCacheController } from '@univerjs/sheets';import { RemoveSheetsFilterMutation, SetSheetsFilterCriteriaMutation, SetSheetsFilterRangeMutation, UniverSheetsFilterPlugin } from '@univerjs/sheets-filter';import { ClearSheetsFilterCriteriaCommand, ReCalcSheetsFilterCommand, SmartToggleSheetsFilterCommand } from '@univerjs/sheets-filter/commands/commands/sheets-filter.command.js';import { IMenuManagerService, IPlatformService, IShortcutService, MenuManagerService, PlatformService, ShortcutService } from '@univerjs/ui';@@ -77,6 +77,8 @@ function createSheetsFilterMenuTestBed() {injector.add([WorksheetProtectionRuleModel]);injector.add([SheetInterceptorService]);injector.add([RangeProtectionRuleModel]);+ injector.add([SheetRangeThemeModel]);+ injector.add([ZebraCrossingCacheController]);injector.add([IExclusiveRangeService, { useClass: ExclusiveRangeService, deps: [SheetsSelectionsService] }]);injector.add([IActiveDirtyManagerService, { useClass: ActiveDirtyManagerService }]);injector.add([ISheetRowFilteredService, { useClass: SheetRowFilteredService }]);diff --git a/packages/sheets-filter-ui/src/services/__tests__/sheets-filter-panel.service.spec.ts b/packages/sheets-filter-ui/src/services/__tests__/sheets-filter-panel.service.spec.tsindex 2f4875ab24..524950bae9 100644--- a/packages/sheets-filter-ui/src/services/__tests__/sheets-filter-panel.service.spec.ts+++ b/packages/sheets-filter-ui/src/services/__tests__/sheets-filter-panel.service.spec.ts@@ -21,7 +21,7 @@ import type { IFilterConditionFormParams } from '../../models/conditions';import type { IFilterByValueWithTreeItem } from '../sheets-filter-panel.service';import { CommandType, ICommandService, Inject, Injector, LocaleService, Plugin, Univer, UniverInstanceType } from '@univerjs/core';import { ActiveDirtyManagerService, IActiveDirtyManagerService, ISheetRowFilteredService, SheetRowFilteredService } from '@univerjs/engine-formula';-import { RefRangeService, SheetInterceptorService, SheetsSelectionsService } from '@univerjs/sheets';+import { RefRangeService, SheetInterceptorService, SheetRangeThemeModel, SheetsSelectionsService, ZebraCrossingCacheController } from '@univerjs/sheets';import { CustomFilterOperator, FilterBy, SheetsFilterService, UniverSheetsFilterPlugin } from '@univerjs/sheets-filter';import { SetSheetsFilterCriteriaCommand } from '@univerjs/sheets-filter/commands/commands/sheets-filter.command.js';import { afterEach, beforeEach, describe, expect, it, vitest } from 'vitest';@@ -95,6 +95,8 @@ function createSheetsFilterPanelServiceTestBed(workbookData: IWorkbookData) {[SheetsSelectionsService],[SheetInterceptorService],[SheetsFilterPanelService],+ [SheetRangeThemeModel],+ [ZebraCrossingCacheController],[IActiveDirtyManagerService, { useClass: ActiveDirtyManagerService }],[ISheetRowFilteredService, { useClass: SheetRowFilteredService }],] as Dependency[]).forEach((d) => this._injector.add(d));diff --git a/packages/sheets-filter/src/controllers/__tests__/sheets-filter.controller.spec.ts b/packages/sheets-filter/src/controllers/__tests__/sheets-filter.controller.spec.tsindex fd599b1f61..db1c0c43f9 100644--- a/packages/sheets-filter/src/controllers/__tests__/sheets-filter.controller.spec.ts+++ b/packages/sheets-filter/src/controllers/__tests__/sheets-filter.controller.spec.ts@@ -20,7 +20,7 @@ import type { IWorkbookData, Workbook } from '@univerjs/core';import { ICommandService, Inject, Injector, IUniverInstanceService, LocaleService, LocaleType, Plugin, RANGE_TYPE, UndoCommand, Univer, UniverInstanceType } from '@univerjs/core';import { afterEach, beforeEach, describe, expect, it } from 'vitest';import type { ISetRangeValuesMutationParams } from '@univerjs/sheets';-import { CopySheetCommand, InsertColByRangeCommand, InsertColMutation, InsertRowByRangeCommand, InsertSheetMutation, MoveColsCommand, MoveColsMutation, MoveRangeCommand, MoveRangeMutation, MoveRowsCommand, MoveRowsMutation, RefRangeService, RemoveColByRangeCommand, RemoveColCommand, RemoveColMutation, RemoveRowByRangeCommand, RemoveRowCommand, RemoveRowMutation, SetRangeValuesMutation, SetSelectionsOperation, SheetInterceptorService, SheetsSelectionsService } from '@univerjs/sheets';+import { CopySheetCommand, InsertColByRangeCommand, InsertColMutation, InsertRowByRangeCommand, InsertSheetMutation, MoveColsCommand, MoveColsMutation, MoveRangeCommand, MoveRangeMutation, MoveRowsCommand, MoveRowsMutation, RefRangeService, RemoveColByRangeCommand, RemoveColCommand, RemoveColMutation, RemoveRowByRangeCommand, RemoveRowCommand, RemoveRowMutation, SetRangeValuesMutation, SetSelectionsOperation, SheetInterceptorService, SheetRangeThemeModel, SheetsSelectionsService, ZebraCrossingCacheController } from '@univerjs/sheets';import { SHEET_FILTER_SNAPSHOT_ID, SheetsFilterService } from '../../services/sheet-filter.service';import { SheetsFilterController } from '../sheets-filter.controller';import { SetSheetsFilterCriteriaMutation } from '../../commands/mutations/sheets-filter.mutation';@@ -133,6 +133,8 @@ function createFilterControllerTestBed(workbookData?: IWorkbookData) {override onStarting(): void {this._injector.add([RefRangeService]);this._injector.add([SheetsFilterService]);+ this._injector.add([SheetRangeThemeModel]);+ this._injector.add([ZebraCrossingCacheController]);this._injector.add([SheetsFilterController]);this._injector.add([SheetsSelectionsService]);this._injector.add([SheetInterceptorService]);diff --git a/packages/sheets-filter/src/controllers/sheets-filter.controller.ts b/packages/sheets-filter/src/controllers/sheets-filter.controller.tsindex 3dd5d00338..f9c59620a1 100644--- a/packages/sheets-filter/src/controllers/sheets-filter.controller.ts+++ b/packages/sheets-filter/src/controllers/sheets-filter.controller.ts@@ -21,7 +21,7 @@ import type { FilterColumn } from '../models/filter-model';import { Disposable, DisposableCollection, ICommandService, Inject, IUniverInstanceService, moveMatrixArray, Optional, Rectangle } from '@univerjs/core';import { DataSyncPrimaryController } from '@univerjs/rpc';-import { CopySheetCommand, EffectRefRangId, expandToContinuousRange, getSheetCommandTarget, InsertColCommand, InsertRowCommand, InsertRowMutation, INTERCEPTOR_POINT, MoveRangeCommand, MoveRowsCommand, RefRangeService, RemoveColCommand, RemoveRowCommand, RemoveRowMutation, RemoveSheetCommand, SetRangeValuesMutation, SetWorksheetActiveOperation, SheetInterceptorService } from '@univerjs/sheets';+import { CopySheetCommand, EffectRefRangId, expandToContinuousRange, getSheetCommandTarget, InsertColCommand, InsertRowCommand, InsertRowMutation, INTERCEPTOR_POINT, MoveRangeCommand, MoveRowsCommand, RefRangeService, RemoveColCommand, RemoveRowCommand, RemoveRowMutation, RemoveSheetCommand, SetRangeValuesMutation, SetWorksheetActiveOperation, SheetInterceptorService, ZebraCrossingCacheController } from '@univerjs/sheets';import { ReCalcSheetsFilterMutation, RemoveSheetsFilterMutation, SetSheetsFilterCriteriaMutation, SetSheetsFilterRangeMutation } from '../commands/mutations/sheets-filter.mutation';import { SheetsFilterService } from '../services/sheet-filter.service';import { mergeSetFilterCriteria } from '../utils';@@ -34,7 +34,8 @@ export class SheetsFilterController extends Disposable {@Inject(SheetsFilterService) private readonly _sheetsFilterService: SheetsFilterService,@IUniverInstanceService private readonly _univerInstanceService: IUniverInstanceService,@Inject(RefRangeService) private readonly _refRangeService: RefRangeService,- @Optional(DataSyncPrimaryController) private readonly _dataSyncPrimaryController: DataSyncPrimaryController+ @Optional(DataSyncPrimaryController) private readonly _dataSyncPrimaryController: DataSyncPrimaryController,+ @Inject(ZebraCrossingCacheController) private readonly _zebraCrossingCacheController: ZebraCrossingCacheController) {super();@@ -43,6 +44,21 @@ export class SheetsFilterController extends Disposable {this._initInterceptors();this._commandExecutedListener();this._initErrorHandling();+ this._initZebraCrossingCacheListener();+ }++ private _initZebraCrossingCacheListener() {+ this.disposeWithMe(+ this._sheetsFilterService.activeFilterModel$.subscribe((filterModel) => {+ if (!filterModel) return;++ this.disposeWithMe(+ filterModel.filteredOutRows$.subscribe(() => {+ this._zebraCrossingCacheController.updateZebraCrossingCache(filterModel.unitId, filterModel.subUnitId);+ })+ );+ })+ );}private _initCommands(): void {diff --git a/packages/sheets-filter/src/facade/__tests__/create-test-bed.ts b/packages/sheets-filter/src/facade/__tests__/create-test-bed.tsindex 895adfde04..5abe7ecb73 100644--- a/packages/sheets-filter/src/facade/__tests__/create-test-bed.ts+++ b/packages/sheets-filter/src/facade/__tests__/create-test-bed.ts@@ -35,8 +35,10 @@ import { SheetRowFilteredService } from '@univerjs/engine-formula/services/sheetimport {RefRangeService,SheetInterceptorService,+ SheetRangeThemeModel,SheetSkeletonService,SheetsSelectionsService,+ ZebraCrossingCacheController,} from '@univerjs/sheets';import { UniverSheetsFilterPlugin } from '@univerjs/sheets-filter';import enUS from '@univerjs/sheets/locale/en-US';@@ -121,6 +123,8 @@ export function createFacadeTestBed(workbookData?: IWorkbookData, dependencies?:injector.add([SheetInterceptorService]);injector.add([IFunctionService, { useClass: FunctionService }]);injector.add([SheetSkeletonService]);+ injector.add([SheetRangeThemeModel]);+ injector.add([ZebraCrossingCacheController]);injector.add([FormulaDataModel]);injector.add([LexerTreeBuilder]);injector.add([RefRangeService]);diff --git a/packages/sheets-filter/src/facade/__tests__/create-worksheet-test-bed.ts b/packages/sheets-filter/src/facade/__tests__/create-worksheet-test-bed.tsindex 4c4a4c964e..7b4920d564 100644--- a/packages/sheets-filter/src/facade/__tests__/create-worksheet-test-bed.ts+++ b/packages/sheets-filter/src/facade/__tests__/create-worksheet-test-bed.ts@@ -35,8 +35,10 @@ import { SheetRowFilteredService } from '@univerjs/engine-formula/services/sheetimport {RefRangeService,SheetInterceptorService,+ SheetRangeThemeModel,SheetSkeletonService,SheetsSelectionsService,+ ZebraCrossingCacheController,} from '@univerjs/sheets';import { UniverSheetsFilterPlugin } from '@univerjs/sheets-filter';import enUS from '@univerjs/sheets/locale/en-US';@@ -117,6 +119,8 @@ export function createWorksheetTestBed(workbookData?: IWorkbookData, dependencieinjector.add([SheetSkeletonService]);injector.add([FormulaDataModel]);injector.add([LexerTreeBuilder]);+ injector.add([SheetRangeThemeModel]);+ injector.add([ZebraCrossingCacheController]);injector.add([RefRangeService]);injector.add([IDefinedNamesService, { useClass: DefinedNamesService }]);diff --git a/packages/sheets-filter/src/models/__tests__/filter-interceptor.spec.ts b/packages/sheets-filter/src/models/__tests__/filter-interceptor.spec.tsindex bec468d404..4b92a12738 100644--- a/packages/sheets-filter/src/models/__tests__/filter-interceptor.spec.ts+++ b/packages/sheets-filter/src/models/__tests__/filter-interceptor.spec.ts@@ -47,7 +47,9 @@ import {RemoveSheetMutation,SetSelectionsOperation,SheetInterceptorService,+ SheetRangeThemeModel,SheetsSelectionsService,+ ZebraCrossingCacheController,} from '@univerjs/sheets';import { afterEach, beforeEach, describe, expect, it } from 'vitest';import { SheetsFilterController } from '../../controllers/sheets-filter.controller';@@ -314,6 +316,8 @@ function createFilterTestUniver(dependencies?: Dependency[], workbookData?: IWorinjector.add([SheetsFilterService]);injector.add([SheetsSelectionsService]);injector.add([RefRangeService]);+ injector.add([SheetRangeThemeModel]);+ injector.add([ZebraCrossingCacheController]);injector.add([SheetsFilterController]);}diff --git a/packages/sheets/src/controllers/zebar-crossing.controller.ts b/packages/sheets/src/controllers/zebar-crossing.controller.tsnew file mode 100644index 0000000000..6a557b48c6--- /dev/null+++ b/packages/sheets/src/controllers/zebar-crossing.controller.ts@@ -0,0 +1,118 @@+/**+ * Copyright 2023-present DreamNum Co., Ltd.+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */++import type { IInsertRowMutationParams, IRemoveRowsMutationParams } from '../basics';+import type { ISetRowHiddenMutationParams, ISetRowVisibleMutationParams } from '../commands/mutations/set-row-visible.mutation';+import type { ISetWorksheetRowHeightMutationParams } from '../commands/mutations/set-worksheet-row-height.mutation';+import { Disposable, ICommandService, Inject, IUniverInstanceService } from '@univerjs/core';+import { Subject } from 'rxjs';+import { InsertRowMutation } from '../commands/mutations/insert-row-col.mutation';+import { RemoveRowMutation } from '../commands/mutations/remove-row-col.mutation';+import { SetRowHiddenMutation, SetRowVisibleMutation } from '../commands/mutations/set-row-visible.mutation';+import { SetWorksheetRowHeightMutation } from '../commands/mutations/set-worksheet-row-height.mutation';+import { SheetRangeThemeModel } from '../model/range-theme-model';++export class ZebraCrossingCacheController extends Disposable {+ private _zebraCacheUpdateSubject = new Subject<{+ unitId: string;+ subUnitId: string;+ }>();++ constructor(+ @Inject(ICommandService) private readonly _commandService: ICommandService,+ @Inject(SheetRangeThemeModel) private readonly _sheetRangeThemeModel: SheetRangeThemeModel,+ @Inject(IUniverInstanceService) private readonly _univerInstanceService: IUniverInstanceService+ ) {+ super();+ this._init();+ }++ private _init() {+ this._initializeCommandListener();+ this._initTriggerCacheUpdateListener();+ }++ /**+ * Update the zebra crossing cache for a specific unit and sub-unit.+ * @param {string} unitId - The ID of the unit.+ * @param {string} subUnitId - The ID of the sub-unit.+ */+ public updateZebraCrossingCache(unitId: string, subUnitId: string) {+ this._zebraCacheUpdateSubject.next({ unitId, subUnitId });+ }++ private _initializeCommandListener() {+ this.disposeWithMe(this._commandService.onCommandExecuted((commandInfo) => {+ const { id } = commandInfo;+ let unitId: string | undefined;+ let subUnitId: string | undefined;+ switch (id) {+ case InsertRowMutation.id:+ {+ const params = commandInfo.params as IInsertRowMutationParams;+ unitId = params.unitId;+ subUnitId = params.subUnitId;+ }+ break;+ case SetRowVisibleMutation.id:+ {+ const params = commandInfo.params as ISetRowVisibleMutationParams;+ unitId = params.unitId;+ subUnitId = params.subUnitId;+ }+ break;+ case SetRowHiddenMutation.id:+ {+ const params = commandInfo.params as ISetRowHiddenMutationParams;+ unitId = params.unitId;+ subUnitId = params.subUnitId;+ }+ break;+ case RemoveRowMutation.id:+ {+ const params = commandInfo.params as IRemoveRowsMutationParams;+ unitId = params.unitId;+ subUnitId = params.subUnitId;+ }+ break;+ case SetWorksheetRowHeightMutation.id:+ {+ // only row height change 0 from non-zero or vice versa will trigger the cache update, we can perform in the future+ const params = commandInfo.params as ISetWorksheetRowHeightMutationParams;+ unitId = params.unitId;+ subUnitId = params.subUnitId;+ }+ break;+ default:+ break;+ }++ if (unitId && subUnitId) {+ this._sheetRangeThemeModel.refreshSheetRowVisibleFuncSet(unitId, subUnitId);+ this._sheetRangeThemeModel.refreshZebraCrossingCacheBySheet(unitId, subUnitId);+ }+ }));+ }++ private _initTriggerCacheUpdateListener() {+ this.disposeWithMe(+ this._zebraCacheUpdateSubject.subscribe(({ unitId, subUnitId }) => {+ this._sheetRangeThemeModel.refreshSheetRowVisibleFuncSet(unitId, subUnitId);+ this._sheetRangeThemeModel.refreshZebraCrossingCacheBySheet(unitId, subUnitId);+ })+ );+ }+}diff --git a/packages/sheets/src/index.ts b/packages/sheets/src/index.tsindex dabb186bc4..108f4b4646 100644--- a/packages/sheets/src/index.ts+++ b/packages/sheets/src/index.ts@@ -326,6 +326,7 @@ export { getAddMergeMutationRangeByType } from './controllers/merge-cell.controlexport { MERGE_CELL_INTERCEPTOR_CHECK, MergeCellController } from './controllers/merge-cell.controller';export { SheetPermissionCheckController } from './controllers/permission/sheet-permission-check.controller';export { SheetPermissionInitController } from './controllers/permission/sheet-permission-init.controller';+export { ZebraCrossingCacheController } from './controllers/zebar-crossing.controller';export { type ICellPermission, RangeProtectionRenderModel } from './model/range-protection-render.model';export { EditStateEnum, type IModel, type IObjectModel, type IRangeProtectionRule, RangeProtectionRuleModel, ViewStateEnum } from './model/range-protection-rule.model';export { RangeProtectionCache } from './model/range-protection.cache';diff --git a/packages/sheets/src/model/__tests__/zebra-cache.spec.ts b/packages/sheets/src/model/__tests__/zebra-cache.spec.tsnew file mode 100644index 0000000000..3cb01ae037--- /dev/null+++ b/packages/sheets/src/model/__tests__/zebra-cache.spec.ts@@ -0,0 +1,167 @@+/**+ * Copyright 2023-present DreamNum Co., Ltd.+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */++import { describe, expect, it } from 'vitest';+import { ZebraCrossingCache } from '../zebra-crossing-cache';++describe('ZebraCrossingCache', () => {+ it('should correctly refresh and calculate toggle ranges for odd rows visible', () => {+ const visibleFunc = (row: number) => row !== 3 && row !== 10 && row !== 16; // Rows 3, 10, and 16 are hidden+ const zebraCache = new ZebraCrossingCache();++ zebraCache.refresh({ startRow: 1, endRow: 31, startColumn: 1, endColumn: 1 }, visibleFunc);++ const toggleRanges = zebraCache.getToggleRanges();+ expect(toggleRanges).toEqual([+ [4, 9],+ [17, 31],+ ]);++ expect(zebraCache.getIsToggled(1)).toBe(false);+ expect(zebraCache.getIsToggled(8)).toBe(true);+ expect(zebraCache.getIsToggled(11)).toBe(false);+ });++ it('should return no toggle ranges when all rows are visible', () => {+ const zebraCache = new ZebraCrossingCache();+ zebraCache.refresh({ startRow: 1, endRow: 10, startColumn: 1, endColumn: 1 }, () => true);++ expect(zebraCache.getToggleRanges()).toEqual([]);+ expect(zebraCache.getIsToggled(5)).toBe(false);+ });++ it('should return no toggle ranges when all rows are hidden', () => {+ const zebraCache = new ZebraCrossingCache();+ zebraCache.refresh({ startRow: 1, endRow: 10, startColumn: 1, endColumn: 1 }, () => false);++ expect(zebraCache.getToggleRanges()).toEqual([]);+ });++ it('should toggle after one hidden row in middle', () => {+ const zebraCache = new ZebraCrossingCache();+ const visibleFunc = (row: number) => row !== 5; // Only row 5 hidden+ zebraCache.refresh({ startRow: 1, endRow: 10, startColumn: 1, endColumn: 1 }, visibleFunc);++ expect(zebraCache.getToggleRanges()).toEqual([[6, 10]]);+ expect(zebraCache.getIsToggled(6)).toBe(true);+ expect(zebraCache.getIsToggled(4)).toBe(false);+ });++ it('should not toggle with even number of hidden rows', () => {+ const zebraCache = new ZebraCrossingCache();+ const visibleFunc = (row: number) => row !== 3 && row !== 6;+ zebraCache.refresh({ startRow: 1, endRow: 10, startColumn: 1, endColumn: 1 }, visibleFunc);++ expect(zebraCache.getToggleRanges()).toEqual([[4, 5]]);+ expect(zebraCache.getIsToggled(4)).toBe(true);+ expect(zebraCache.getIsToggled(7)).toBe(false);+ });++ it('should handle hidden rows at start correctly', () => {+ const zebraCache = new ZebraCrossingCache();+ const visibleFunc = (row: number) => row !== 1;+ zebraCache.refresh({ startRow: 1, endRow: 5, startColumn: 1, endColumn: 1 }, visibleFunc);++ expect(zebraCache.getToggleRanges()).toEqual([[2, 5]]);+ expect(zebraCache.getIsToggled(2)).toBe(true);+ });++ it('should handle hidden rows at end correctly', () => {+ const zebraCache = new ZebraCrossingCache();+ const visibleFunc = (row: number) => row !== 5;+ zebraCache.refresh({ startRow: 1, endRow: 5, startColumn: 1, endColumn: 1 }, visibleFunc);++ expect(zebraCache.getToggleRanges()).toEqual([]); // Edge case, should not happen logically+ expect(zebraCache.getIsToggled(4)).toBe(false);+ });++ it('should toggle multiple ranges correctly with alternating hidden rows', () => {+ const hidden = new Set([3, 5, 8, 10]);+ const visibleFunc = (row: number) => !hidden.has(row);++ const zebraCache = new ZebraCrossingCache();+ zebraCache.refresh({ startRow: 1, endRow: 12, startColumn: 1, endColumn: 1 }, visibleFunc);++ expect(zebraCache.getToggleRanges()).toEqual([+ [4, 4],+ [9, 9],+ ]);++ expect(zebraCache.getIsToggled(4)).toBe(true);+ expect(zebraCache.getIsToggled(6)).toBe(false);+ expect(zebraCache.getIsToggled(9)).toBe(true);+ expect(zebraCache.getIsToggled(11)).toBe(false);+ });++ it('should toggle on boundary correctly', () => {+ const zebraCache = new ZebraCrossingCache();+ const visibleFunc = (row: number) => row !== 10; // Hide last row+ zebraCache.refresh({ startRow: 1, endRow: 10, startColumn: 1, endColumn: 1 }, visibleFunc);++ expect(zebraCache.getToggleRanges()).toEqual([]);+ expect(zebraCache.getIsToggled(9)).toBe(false);+ });++ it('should not toggle with even number of hidden rows start', () => {+ const zebraCache = new ZebraCrossingCache();+ const visibleFunc = (row: number) => row !== 1 && row !== 3;+ zebraCache.refresh({ startRow: 1, endRow: 10, startColumn: 1, endColumn: 1 }, visibleFunc);++ expect(zebraCache.getToggleRanges()).toEqual([[2, 2]]);+ expect(zebraCache.getIsToggled(2)).toBe(true);+ expect(zebraCache.getIsToggled(7)).toBe(false);+ });++ it('should not toggle with even number of hidden rows start2', () => {+ const zebraCache = new ZebraCrossingCache();+ const visibleFunc = (row: number) => row !== 1 && row !== 3 && row !== 4;+ zebraCache.refresh({ startRow: 1, endRow: 10, startColumn: 1, endColumn: 1 }, visibleFunc);++ expect(zebraCache.getToggleRanges()).toEqual([[2, 2], [5, 10]]);+ expect(zebraCache.getIsToggled(2)).toBe(true);+ expect(zebraCache.getIsToggled(7)).toBe(true);+ });++ it('should not toggle with even number of start double Hide rows', () => {+ const zebraCache = new ZebraCrossingCache();+ const visibleFunc = (row: number) => row !== 1 && row !== 2 && row !== 4;+ zebraCache.refresh({ startRow: 1, endRow: 10, startColumn: 1, endColumn: 1 }, visibleFunc);++ expect(zebraCache.getToggleRanges()).toEqual([[5, 10]]);+ expect(zebraCache.getIsToggled(2)).toBe(false);+ expect(zebraCache.getIsToggled(7)).toBe(true);+ });++ it('should not toggle with even number of start 3 Hide rows', () => {+ const zebraCache = new ZebraCrossingCache();+ const visibleFunc = (row: number) => row !== 1 && row !== 2 && row !== 3 && row !== 5;+ zebraCache.refresh({ startRow: 1, endRow: 10, startColumn: 1, endColumn: 1 }, visibleFunc);++ expect(zebraCache.getToggleRanges()).toEqual([[4, 4]]);+ expect(zebraCache.getIsToggled(4)).toBe(true);+ expect(zebraCache.getIsToggled(7)).toBe(false);+ });++ it('should not toggle with even number of only start 3 Hide rows', () => {+ const zebraCache = new ZebraCrossingCache();+ const visibleFunc = (row: number) => row !== 2 && row !== 3 && row !== 4;+ zebraCache.refresh({ startRow: 1, endRow: 10, startColumn: 1, endColumn: 1 }, visibleFunc);++ expect(zebraCache.getToggleRanges()).toEqual([[5, 10]]);+ expect(zebraCache.getIsToggled(4)).toBe(false);+ expect(zebraCache.getIsToggled(7)).toBe(true);+ });+});diff --git a/packages/sheets/src/model/range-theme-model.ts b/packages/sheets/src/model/range-theme-model.tsindex 1e61a9f452..c406161704 100644--- a/packages/sheets/src/model/range-theme-model.ts+++ b/packages/sheets/src/model/range-theme-model.ts@@ -14,9 +14,9 @@* limitations under the License.*/-import type { ICellDataForSheetInterceptor, IRange, Nullable } from '@univerjs/core';+import type { ICellDataForSheetInterceptor, IRange, Nullable, Workbook } from '@univerjs/core';import type { IRangeThemeStyleItem, IRangeThemeStyleJSON } from './range-theme-util';-import { Disposable, generateRandomId, Inject, InterceptorEffectEnum, IResourceManagerService, RTree, UniverInstanceType } from '@univerjs/core';+import { Disposable, generateRandomId, Inject, InterceptorEffectEnum, IResourceManagerService, IUniverInstanceService, RTree, UniverInstanceType } from '@univerjs/core';import { Subject } from 'rxjs';import { INTERCEPTOR_POINT, RangeThemeInterceptorId } from '../services/sheet-interceptor/interceptor-const';import { SheetInterceptorService } from '../services/sheet-interceptor/sheet-interceptor.service';@@ -24,6 +24,7 @@ import { SheetInterceptorService } from '../services/sheet-interceptor/sheet-intimport { RangeThemeStyle } from './range-theme-util';import { buildInThemes } from './range-themes/build-in-theme.factory';import { defaultRangeThemeStyle, defaultRangeThemeStyleJSONWithLastRowStyle } from './range-themes/default';+import { ZebraCrossingCache } from './zebra-crossing-cache';export interface IRangeThemeRangeInfo {range: IRange;@@ -48,13 +49,20 @@ export class SheetRangeThemeModel extends Disposable {private _rangeThemeStyleRuleMap: Map<string, Map<string, IRangeThemeStyleRule>> = new Map();private _rTreeCollection: Map<string, RTree> = new Map();private _defaultRangeThemeMap: Map<string, RangeThemeStyle> = new Map();+ /**+ * This map is used to cache zebra crossing toggle ranges for each unitId and subUnitId, IRangeThemeStyleRule id+ */+ private _zebraCrossingCacheMap: Map<string, Map<string, Map<string, ZebraCrossingCache>>> = new Map();++ private _rowVisibleFuncSet: Map<string, Map<string, Set<number>>> = new Map();private _rangeThemeMapChanged$ = new Subject<{ type: 'add' | 'remove'; styleName: string }>();public rangeThemeMapChange$ = this._rangeThemeMapChanged$.asObservable();constructor(@Inject(SheetInterceptorService) private _sheetInterceptorService: SheetInterceptorService,- @Inject(IResourceManagerService) private _resourceManagerService: IResourceManagerService+ @Inject(IResourceManagerService) private _resourceManagerService: IResourceManagerService,+ @Inject(IUniverInstanceService) private readonly _univerInstanceService: IUniverInstanceService) {super();this._registerIntercept();@@ -99,6 +107,59 @@ export class SheetRangeThemeModel extends Disposable {return this._ensureRangeThemeStyleMap(unitId).get(name);}+ private _getSheetRowVisibleFuncSet(unitId: string, subUnitId: string): Set<number> {+ if (!this._rowVisibleFuncSet.has(unitId)) {+ this._rowVisibleFuncSet.set(unitId, new Map());+ }+ const subUnitMap = this._rowVisibleFuncSet.get(unitId)!;+ if (!subUnitMap.has(subUnitId)) {+ subUnitMap.set(subUnitId, new Set());+ }++ return subUnitMap.get(subUnitId)!;+ }++ private _getSheetRowVisibleHasInit(unitId: string, subUnitId: string): boolean {+ return Boolean(this._rowVisibleFuncSet.has(unitId) && this._rowVisibleFuncSet.get(unitId)?.has(subUnitId));+ }++ public refreshSheetRowVisibleFuncSet(unitId: string, subUnitId: string) {+ const set = this._getSheetRowVisibleFuncSet(unitId, subUnitId);+ const workbook = this._univerInstanceService.getUnit<Workbook>(unitId);+ if (workbook) {+ const sheet = workbook.getSheetBySheetId(subUnitId);+ if (sheet) {+ const rowCount = sheet.getRowCount();+ const rowManager = sheet.getRowManager();+ for (let i = 1; i <= rowCount; i++) {+ const visible = sheet.getRowVisible(i);+ if (!visible) {+ set.add(i);+ } else {+ if (rowManager.getRowHeight(i) === 0) {+ set.add(i);+ }+ }+ }+ }+ }+ }++ private _ensureZebraCrossingCache(unitId: string, subUnitId: string, id: string): ZebraCrossingCache {+ if (!this._zebraCrossingCacheMap.has(unitId)) {+ this._zebraCrossingCacheMap.set(unitId, new Map());+ }+ const subUnitMap = this._zebraCrossingCacheMap.get(unitId)!;+ if (!subUnitMap.has(subUnitId)) {+ subUnitMap.set(subUnitId, new Map());+ }+ const cacheMap = subUnitMap.get(subUnitId)!;+ if (!cacheMap.has(id)) {+ cacheMap.set(id, new ZebraCrossingCache());+ }+ return cacheMap.get(id)!;+ }+/*** Register range theme styles* @param {string} themeName@@ -111,6 +172,18 @@ export class SheetRangeThemeModel extends Disposable {const rTreeCollection = this._ensureRTreeCollection(unitId);ruleMap.set(id, { rangeInfo, themeName });rTreeCollection.insert({ unitId, sheetId: subUnitId, range, id });++ // refresh row visible func set+ if (!this._getSheetRowVisibleHasInit(unitId, subUnitId)) {+ this.refreshSheetRowVisibleFuncSet(unitId, subUnitId);+ }++ // update zebra crossing cache+ const zebraCache = this._ensureZebraCrossingCache(unitId, subUnitId, id);+ const sheetRowVisibleFuncSet = this._getSheetRowVisibleFuncSet(unitId, subUnitId);+ zebraCache.refresh(range, (row: number) => {+ return !sheetRowVisibleFuncSet.has(row);+ });}getRegisteredRangeThemeStyle(rangeInfo: IRangeThemeRangeInfo): string | undefined {@@ -127,6 +200,32 @@ export class SheetRangeThemeModel extends Disposable {return undefined;}+ refreshZebraCrossingCacheBySheet(unitId: string, subUnitId: string): void {+ if (!this._zebraCrossingCacheMap.has(unitId)) {+ this._zebraCrossingCacheMap.set(unitId, new Map());+ }+ const subUnitMap = this._zebraCrossingCacheMap.get(unitId)!;+ if (!subUnitMap.has(subUnitId)) {+ subUnitMap.set(subUnitId, new Map());+ }+ const cacheMap = subUnitMap.get(subUnitId);++ if (cacheMap) {+ cacheMap.forEach((zebraCache, id) => {+ const ruleMap = this._ensureRangeThemeStyleRuleMap(unitId);+ const themeRule = ruleMap.get(id);+ if (themeRule) {+ zebraCache.refresh(themeRule.rangeInfo.range, (row: number) => {+ return !this._getSheetRowVisibleFuncSet(unitId, subUnitId).has(row);+ });+ } else {+ // If the theme rule is not found, we can remove the cache+ cacheMap.delete(id);+ }+ });+ }+ }+removeRangeThemeRule(themeName: string, rangeInfo: IRangeThemeRangeInfo): void {const { unitId, subUnitId, range } = rangeInfo;const rTreeCollection = this._ensureRTreeCollection(unitId);@@ -137,6 +236,15 @@ export class SheetRangeThemeModel extends Disposable {if (themeRule && themeRule.themeName === themeName) {themeRuleMap.delete(themes[i] as string);rTreeCollection.remove({ unitId, sheetId: subUnitId, range, id: themes[i] as string });++ // remove zebra crossing cache+ const zebraCacheMap = this._zebraCrossingCacheMap.get(unitId);+ if (zebraCacheMap) {+ const subUnitCacheMap = zebraCacheMap.get(subUnitId);+ if (subUnitCacheMap) {+ subUnitCacheMap.delete(themes[i] as string);+ }+ }break;}}@@ -204,8 +312,11 @@ export class SheetRangeThemeModel extends Disposable {const offsetRow = row - rangeInfo.range.startRow;const offsetCol = col - rangeInfo.range.startColumn;const theme = this.getRangeThemeStyle(unitId, themeName);++ const zebraCache = this._ensureZebraCrossingCache(unitId, subUnitId, themes[0] as string);+ const isToggled = zebraCache.getIsToggled(row);if (theme) {- return theme.getStyle(offsetRow, offsetCol, row === rangeInfo.range.endRow, col === rangeInfo.range.endColumn);+ return theme.getStyle(offsetRow, offsetCol, row === rangeInfo.range.endRow, col === rangeInfo.range.endColumn, isToggled);}}}@@ -324,5 +435,7 @@ export class SheetRangeThemeModel extends Disposable {this._rangeThemeStyleRuleMap.clear();this._defaultRangeThemeMap.clear();this._rTreeCollection.clear();+ this._zebraCrossingCacheMap.clear();+ this._rowVisibleFuncSet.clear();}}diff --git a/packages/sheets/src/model/range-theme-util.ts b/packages/sheets/src/model/range-theme-util.tsindex c525688cff..de6c753639 100644--- a/packages/sheets/src/model/range-theme-util.ts+++ b/packages/sheets/src/model/range-theme-util.ts@@ -253,7 +253,7 @@ export class RangeThemeStyle {this._resetStyleCache();}- public getStyle(offsetRow: number, offsetCol: number, isLastRow: boolean, isLastCol: boolean) {+ public getStyle(offsetRow: number, offsetCol: number, isLastRow: boolean, isLastCol: boolean, isToggled: boolean) {let mergeNumber = 0;if (isLastRow) {@@ -269,11 +269,11 @@ export class RangeThemeStyle {}if (offsetRow % 2 === 1) {- mergeNumber = mergeNumber | STYLE_MAP.firstRowStyle;+ mergeNumber = mergeNumber | (isToggled ? STYLE_MAP.secondRowStyle : STYLE_MAP.firstRowStyle);}if (offsetRow % 2 === 0) {- mergeNumber = mergeNumber | STYLE_MAP.secondRowStyle;+ mergeNumber = mergeNumber | (isToggled ? STYLE_MAP.firstRowStyle : STYLE_MAP.secondRowStyle);}if (offsetRow === 0) {diff --git a/packages/sheets/src/model/zebra-crossing-cache.ts b/packages/sheets/src/model/zebra-crossing-cache.tsnew file mode 100644index 0000000000..22cee26d71--- /dev/null+++ b/packages/sheets/src/model/zebra-crossing-cache.ts@@ -0,0 +1,129 @@+/**+ * Copyright 2023-present DreamNum Co., Ltd.+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */++import type { IRange } from '@univerjs/core';++type IVisibleFunc = (row: number) => boolean;+type IToggleRange = [number, number];++/**+ * This class is used for caching zebra crossing toggle ranges.+ * `toggleRanges` represents the ranges within the visible area where the original odd/even row state is reversed due to hidden rows.+ * Based on the following rules:+ * 1. If there is an odd number of hidden rows before a certain row, the odd/even state of that row will be reversed.+ * 2. If there is an even number of hidden rows before a certain row, the odd/even state of that row will not be reversed.+ * 3. If there are no hidden rows before a certain row, the odd/even state of that row will not be reversed.+ *+ * Example:+ * Given rows 1 to 10, where rows 3 and 7 are hidden:+ * - Rows 1 and 2 remain in their original odd/even state.+ * - Row 4's state is reversed because there is 1 hidden row (odd) before it.+ * - Row 8's state is reversed because there are 2 hidden rows (even) before it.+ * - Rows 9 and 10 remain in their original odd/even state.+ */+export class ZebraCrossingCache {+ private _toggleRanges: IToggleRange[] = [];++ /**+ * Refresh the cache based on the given range and visibility function.+ * This method calculates toggle ranges for rows that are visible within the specified range.+ * Hidden rows are excluded from the toggle calculation.+ * @param range The range of rows to refresh (startRow and endRow are required).+ * @param visibleFunc A function to determine if a row is visible.+ */+ refresh(range: IRange, visibleFunc: IVisibleFunc): void {+ const { startRow, endRow } = range;++ const toggleRanges: IToggleRange[] = [];+ let hiddenCount = 0;+ let inToggle = false;+ let toggleStart = -1;++ for (let row = startRow; row <= endRow; row++) {+ const isVisible = visibleFunc(row);++ if (!isVisible) {+ hiddenCount++;++ if (hiddenCount % 2 === 1) {+ inToggle = true;+ } else {+ inToggle = false;+ if (toggleStart !== -1) {+ toggleRanges.push([toggleStart, row - 1]);+ toggleStart = -1;+ }+ }+ continue;+ }++ if (hiddenCount % 2 === 1) {+ if (!inToggle) {+ inToggle = true;+ toggleStart = row;+ } else if (toggleStart === -1) {+ toggleStart = row;+ }+ } else {+ if (inToggle) {+ toggleRanges.push([toggleStart, row - 2]);+ inToggle = false;+ toggleStart = -1;+ }+ }++ // If it's the last row and still in the toggle range, finalize the range+ if (row === endRow && inToggle) {+ toggleRanges.push([toggleStart, row]);+ }+ }++ this._toggleRanges = toggleRanges;+ }++ /**+ * This function returns the toggle ranges. Only for testing purposes. In production, you should use `getIsToggled` to check if a row is toggled.+ * @returns [IToggleRange[]] The toggle ranges calculated by the last refresh.+ */+ getToggleRanges(): IToggleRange[] {+ return this._toggleRanges.concat();+ }++ /**+ * Check if the given row is toggled (odd/even state).+ * This method uses binary search to efficiently determine if the row is within a toggle range.+ * @param row The row to check.+ * @returns True if the row is toggled (odd), false otherwise (even or hidden).+ */+ getIsToggled(row: number): boolean {+ let left = 0;+ let right = this._toggleRanges.length - 1;++ while (left <= right) {+ const mid = Math.floor((left + right) / 2);+ const [start, end] = this._toggleRanges[mid];++ if (row < start) {+ right = mid - 1;+ } else if (row > end) {+ left = mid + 1;+ } else {+ return true;+ }+ }+ return false;+ }+}diff --git a/packages/sheets/src/plugin.ts b/packages/sheets/src/plugin.tsindex a7f269224f..bc6e410708 100644--- a/packages/sheets/src/plugin.ts+++ b/packages/sheets/src/plugin.ts@@ -29,10 +29,11 @@ import { SheetPermissionCheckController } from './controllers/permission/sheet-pimport { SheetPermissionInitController } from './controllers/permission/sheet-permission-init.controller';import { SheetPermissionViewModelController } from './controllers/permission/sheet-permission-view-model.controller';+import { ZebraCrossingCacheController } from './controllers/zebar-crossing.controller';import { RangeProtectionRenderModel } from './model/range-protection-render.model';import { RangeProtectionRuleModel } from './model/range-protection-rule.model';-import { RangeProtectionCache } from './model/range-protection.cache';+import { RangeProtectionCache } from './model/range-protection.cache';import { SheetRangeThemeModel } from './model/range-theme-model';import { BorderStyleManagerService } from './services/border-style-manager.service';import { ExclusiveRangeService, IExclusiveRangeService } from './services/exclusive-range/exclusive-range-service';@@ -103,6 +104,7 @@ export class UniverSheetsPlugin extends Plugin {[MergeCellController],[NumberCellDisplayController],[DefinedNameDataController],+ [ZebraCrossingCacheController],// permission[WorksheetPermissionService],@@ -162,6 +164,7 @@ export class UniverSheetsPlugin extends Plugin {touchDependencies(this._injector, [[CalculateResultApplyController],[DefinedNameDataController],+ [ZebraCrossingCacheController],[SheetRangeThemeModel],[NumberCellDisplayController],[RangeProtectionRenderModel],