Skip to content

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.

refactor: move FormulaAutoFillController from sheets-formula-ui to sheets-formula package (#6641)

wpxp123456206a34885dc7
diff --git a/packages/sheets-formula-ui/src/controllers/__tests__/formula-auto-fill.controller.spec.ts b/packages/sheets-formula-ui/src/controllers/__tests__/formula-auto-fill.controller.spec.ts
index 5ed082fe7e..a5754d0e96 100644
--- a/packages/sheets-formula-ui/src/controllers/__tests__/formula-auto-fill.controller.spec.ts
+++ b/packages/sheets-formula-ui/src/controllers/__tests__/formula-auto-fill.controller.spec.ts
@@ -37,6 +37,7 @@ import {
SetSelectionsOperation,
SheetsSelectionsService,
} from '@univerjs/sheets';
+import { FormulaAutoFillController } from '@univerjs/sheets-formula';
import {
AutoFillUIController,
ISheetSelectionRenderService,
@@ -45,7 +46,6 @@ import {
} from '@univerjs/sheets-ui';
import { IPlatformService, IShortcutService, PlatformService, ShortcutService } from '@univerjs/ui';
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
-import { FormulaAutoFillController } from '../formula-auto-fill.controller';
import { createCommandTestBed } from './create-command-test-bed';
class mockSheetsRenderService {
diff --git a/packages/sheets-formula-ui/src/plugin.ts b/packages/sheets-formula-ui/src/plugin.ts
index 0652bd722a..b13f85ff8b 100644
--- a/packages/sheets-formula-ui/src/plugin.ts
+++ b/packages/sheets-formula-ui/src/plugin.ts
@@ -27,7 +27,6 @@ import {
PLUGIN_CONFIG_KEY_BASE,
} from './controllers/config.schema';
import { FormulaAlertRenderController } from './controllers/formula-alert-render.controller';
-import { FormulaAutoFillController } from './controllers/formula-auto-fill.controller';
import { FormulaClipboardController } from './controllers/formula-clipboard.controller';
import { FormulaEditorShowController } from './controllers/formula-editor-show.controller';
import { FormulaRenderManagerController } from './controllers/formula-render.controller';
@@ -74,7 +73,6 @@ export class UniverSheetsFormulaUIPlugin extends Plugin {
[IFormulaPromptService, { useClass: FormulaPromptService }],
[GlobalRangeSelectorService],
[FormulaUIController],
- [FormulaAutoFillController],
[FormulaClipboardController],
[FormulaEditorShowController],
[FormulaRenderManagerController],
@@ -110,7 +108,6 @@ export class UniverSheetsFormulaUIPlugin extends Plugin {
}
override onSteady(): void {
- this._injector.get(FormulaAutoFillController);
this._injector.get(FormulaReorderController);
}
diff --git a/packages/sheets-formula-ui/src/controllers/formula-auto-fill.controller.ts b/packages/sheets-formula/src/controllers/formula-auto-fill.controller.ts
similarity index 100%
rename from packages/sheets-formula-ui/src/controllers/formula-auto-fill.controller.ts
rename to packages/sheets-formula/src/controllers/formula-auto-fill.controller.ts
diff --git a/packages/sheets-formula/src/index.ts b/packages/sheets-formula/src/index.ts
index e4e4b8e74c..9e58478129 100644
--- a/packages/sheets-formula/src/index.ts
+++ b/packages/sheets-formula/src/index.ts
@@ -16,9 +16,9 @@
export { type IInsertFunction, type IInsertFunctionCommandParams, InsertFunctionCommand } from './commands/commands/insert-function.command';
export { QuickSumCommand } from './commands/commands/quick-sum.command';
-
export { CalculationMode, PLUGIN_CONFIG_KEY_BASE } from './controllers/config.schema';
export type { IUniverSheetsFormulaBaseConfig, IUniverSheetsFormulaRemoteConfig } from './controllers/config.schema';
+export { FormulaAutoFillController } from './controllers/formula-auto-fill.controller';
export { ImageFormulaCellInterceptorController } from './controllers/image-formula-cell-interceptor.controller';
export { TriggerCalculationController } from './controllers/trigger-calculation.controller';
export { UpdateDefinedNameController } from './controllers/update-defined-name.controller';
@@ -26,7 +26,6 @@ export { UpdateFormulaController } from './controllers/update-formula.controller
export { UniverRemoteSheetsFormulaPlugin, UniverSheetsFormulaPlugin } from './plugin';
export { DescriptionService, IDescriptionService } from './services/description.service';
export type { ISearchItem, ISearchItemWithType } from './services/description.service';
-
export { FormulaRefRangeService } from './services/formula-ref-range.service';
export type { IRegisterAsyncFunction, IRegisterFunction, ISingleFunctionRegisterParams } from './services/register-function.service';
export type { IRegisterFunctionParams, IUnregisterFunctionParams } from './services/register-function.service';
diff --git a/packages/sheets-formula/src/plugin.ts b/packages/sheets-formula/src/plugin.ts
index 19972d1cbb..f66df83b02 100644
--- a/packages/sheets-formula/src/plugin.ts
+++ b/packages/sheets-formula/src/plugin.ts
@@ -30,6 +30,7 @@ import {
PLUGIN_CONFIG_KEY_REMOTE,
} from './controllers/config.schema';
import { DefinedNameController } from './controllers/defined-name.controller';
+import { FormulaAutoFillController } from './controllers/formula-auto-fill.controller';
import { FormulaController } from './controllers/formula.controller';
import { ImageFormulaCellInterceptorController } from './controllers/image-formula-cell-interceptor.controller';
import { SuperTableController } from './controllers/super-table.controller';
@@ -107,6 +108,7 @@ export class UniverSheetsFormulaPlugin extends Plugin {
[DefinedNameController],
[UpdateDefinedNameController],
[SuperTableController],
+ [FormulaAutoFillController],
];
// If the plugin do not execute formula, it should delegate a remote proxy.
@@ -143,6 +145,7 @@ export class UniverSheetsFormulaPlugin extends Plugin {
touchDependencies(this._injector, [
[DefinedNameController],
[SuperTableController],
+ [FormulaAutoFillController],
]);
// Wait for rendering to complete before initializing formula calculation