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
chore: move active worksheet controller to sheets package (#6354)
wpxp1234560f4c26ae5664
diff --git a/packages/sheets-ui/src/mobile-plugin.ts b/packages/sheets-ui/src/mobile-plugin.tsindex 2e0fb92596..d774a2428d 100644--- a/packages/sheets-ui/src/mobile-plugin.ts+++ b/packages/sheets-ui/src/mobile-plugin.ts@@ -23,7 +23,6 @@ import { IRefSelectionsService, RefSelectionsService, UniverSheetsPlugin } fromimport { ComponentManager, UI_PLUGIN_CONFIG_KEY, UniverMobileUIPlugin } from '@univerjs/ui';import { filter } from 'rxjs/operators';import { UNIVER_SHEET_PERMISSION_USER_PART } from './consts/permission';-import { ActiveWorksheetController } from './controllers/active-worksheet/active-worksheet.controller';import { AutoFillController } from './controllers/auto-fill.controller';import { AutoHeightController } from './controllers/auto-height.controller';import { AutoWidthController } from './controllers/auto-width.controller';@@ -162,7 +161,6 @@ export class UniverSheetsMobileUIPlugin extends Plugin {[SheetCellEditorResizeService],// controllers- [ActiveWorksheetController],[AutoHeightController],[AutoWidthController],[FormulaEditorController],@@ -200,7 +198,6 @@ export class UniverSheetsMobileUIPlugin extends Plugin {touchDependencies(this._injector, [[SheetUIMobileController],[SheetsRenderService],- [ActiveWorksheetController],[SheetPermissionCheckUIController],[SheetPermissionInitUIController],]);diff --git a/packages/sheets-ui/src/plugin.ts b/packages/sheets-ui/src/plugin.tsindex 7fc136b28f..11b0e515d6 100644--- a/packages/sheets-ui/src/plugin.ts+++ b/packages/sheets-ui/src/plugin.ts@@ -23,7 +23,6 @@ import { IRefSelectionsService, RefSelectionsService, UniverSheetsPlugin } fromimport { ComponentManager, UI_PLUGIN_CONFIG_KEY } from '@univerjs/ui';import { filter } from 'rxjs/operators';import { UNIVER_SHEET_PERMISSION_USER_PART } from './consts/permission';-import { ActiveWorksheetController } from './controllers/active-worksheet/active-worksheet.controller';import { AutoFillController } from './controllers/auto-fill.controller';import { AutoHeightController } from './controllers/auto-height.controller';import { AutoWidthController } from './controllers/auto-width.controller';@@ -165,7 +164,6 @@ export class UniverSheetsUIPlugin extends Plugin {[SheetCellEditorResizeService],// controllers- [ActiveWorksheetController],[AutoHeightController],[AutoWidthController],[FormulaEditorController],@@ -204,7 +202,6 @@ export class UniverSheetsUIPlugin extends Plugin {touchDependencies(this._injector, [[SheetUIController],[SheetsRenderService],- [ActiveWorksheetController],[SheetPermissionCheckUIController],[SheetPermissionInitUIController],]);diff --git a/packages/sheets-ui/src/controllers/active-worksheet/active-worksheet.controller.ts b/packages/sheets/src/controllers/active-worksheet.controller.tssimilarity index 89%rename from packages/sheets-ui/src/controllers/active-worksheet/active-worksheet.controller.tsrename to packages/sheets/src/controllers/active-worksheet.controller.tsindex bbec674d19..44430ed151 100644--- a/packages/sheets-ui/src/controllers/active-worksheet/active-worksheet.controller.ts+++ b/packages/sheets/src/controllers/active-worksheet.controller.ts@@ -15,21 +15,16 @@*/import type { IMutationInfo, IOperationInfo, Workbook } from '@univerjs/core';-import type {- IInsertSheetMutationParams,- IRemoveSheetMutationParams,- ISetSelectionsOperationParams,- ISetWorksheetActiveOperationParams,- ISetWorksheetHideMutationParams,-} from '@univerjs/sheets';+import type { IInsertSheetMutationParams, IRemoveSheetMutationParams } from '../basics';+import type { ISetWorksheetHideMutationParams } from '../commands/mutations/set-worksheet-hide.mutation';+import type { ISetSelectionsOperationParams } from '../commands/operations/selection.operation';+import type { ISetWorksheetActiveOperationParams } from '../commands/operations/set-worksheet-active.operation';import { Disposable, ICommandService, IUniverInstanceService } from '@univerjs/core';-import {- InsertSheetMutation,- RemoveSheetMutation,- SetSelectionsOperation,- SetWorksheetActiveOperation,- SetWorksheetHideMutation,-} from '@univerjs/sheets';+import { InsertSheetMutation } from '../commands/mutations/insert-sheet.mutation';+import { RemoveSheetMutation } from '../commands/mutations/remove-sheet.mutation';+import { SetWorksheetHideMutation } from '../commands/mutations/set-worksheet-hide.mutation';+import { SetSelectionsOperation } from '../commands/operations/selection.operation';+import { SetWorksheetActiveOperation } from '../commands/operations/set-worksheet-active.operation';/*** This controller is responsible for changing the active worksheet whendiff --git a/packages/sheets/src/plugin.ts b/packages/sheets/src/plugin.tsindex 0373a48560..f4a3d35dc9 100644--- a/packages/sheets/src/plugin.ts+++ b/packages/sheets/src/plugin.ts@@ -18,6 +18,7 @@ import type { Dependency } from '@univerjs/core';import type { IUniverSheetsConfig } from './controllers/config.schema';import { AUTO_HEIGHT_FOR_MERGED_CELLS, DependentOn, IConfigService, Inject, Injector, IS_ROW_STYLE_PRECEDE_COLUMN_STYLE, merge, mergeOverrideWithDependencies, Plugin, registerDependencies, touchDependencies, UniverInstanceType } from '@univerjs/core';import { UniverFormulaEnginePlugin } from '@univerjs/engine-formula';+import { ActiveWorksheetController } from './controllers/active-worksheet.controller';import { BasicWorksheetController } from './controllers/basic-worksheet.controller';import { CalculateResultApplyController } from './controllers/calculate-result-apply.controller';import { ONLY_REGISTER_FORMULA_RELATED_MUTATIONS_KEY } from './controllers/config';@@ -155,6 +156,10 @@ export class UniverSheetsPlugin extends Plugin {[SheetPermissionViewModelController],[SheetSkeletonService],]);++ if (!this._config?.onlyRegisterFormulaRelatedMutations) {+ this._injector.add([ActiveWorksheetController]);+ }}override onRendered(): void {@@ -165,6 +170,7 @@ export class UniverSheetsPlugin extends Plugin {override onReady(): void {touchDependencies(this._injector, [+ [ActiveWorksheetController],[CalculateResultApplyController],[DefinedNameDataController],[ZebraCrossingCacheController],