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
fix(formula): align new packages with conventions (#7308)
Univer19b3c942c507
diff --git a/packages/formula-ui/README.md b/packages/formula-ui/README.mdnew file mode 100644index 0000000000..258e7fbd5d--- /dev/null+++ b/packages/formula-ui/README.md@@ -0,0 +1,5 @@+# @univerjs/formula-ui++`@univerjs/formula-ui` provides shared formula search and syntax-highlighting helpers for Univer editors.++Keep this package on the same version as the other `@univerjs/*` packages in your application.diff --git a/packages/formula-ui/package.json b/packages/formula-ui/package.jsonindex 69a6794778..08f73d038c 100644--- a/packages/formula-ui/package.json+++ b/packages/formula-ui/package.json@@ -1,6 +1,6 @@{"name": "@univerjs/formula-ui",- "version": "1.0.0-alpha.4",+ "version": "1.0.0-alpha.6","private": false,"description": "Shared formula search and highlighting helpers for Univer editors.","author": "DreamNum Co., Ltd. <[email protected]>",diff --git a/packages/formula/README.md b/packages/formula/README.mdnew file mode 100644index 0000000000..e72b74ca0a--- /dev/null+++ b/packages/formula/README.md@@ -0,0 +1,5 @@+# @univerjs/formula++`@univerjs/formula` provides shared formula function registration, descriptions, and calculation-session services for Univer editors.++Keep this package on the same version as the other `@univerjs/*` packages in your application.diff --git a/packages/formula/package.json b/packages/formula/package.jsonindex e75a28bad4..055546004f 100644--- a/packages/formula/package.json+++ b/packages/formula/package.json@@ -1,6 +1,6 @@{"name": "@univerjs/formula",- "version": "1.0.0-alpha.4",+ "version": "1.0.0-alpha.6","private": false,"description": "Shared formula function catalog and registration services for Univer.","author": "DreamNum Co., Ltd. <[email protected]>",diff --git a/packages/formula/src/config/config.ts b/packages/formula/src/config/config.tsnew file mode 100644index 0000000000..14508fea18--- /dev/null+++ b/packages/formula/src/config/config.ts@@ -0,0 +1,23 @@+/**+ * 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.+ */++export const FORMULA_PLUGIN_CONFIG_KEY = 'formula.config';++export const configSymbol = Symbol(FORMULA_PLUGIN_CONFIG_KEY);++export interface IUniverFormulaConfig {}++export const defaultPluginConfig: IUniverFormulaConfig = {};diff --git a/packages/formula/src/index.ts b/packages/formula/src/index.tsindex c7cbf1b6a1..10845a74e0 100644--- a/packages/formula/src/index.ts+++ b/packages/formula/src/index.ts@@ -14,6 +14,8 @@* limitations under the License.*/+export { FORMULA_PLUGIN_CONFIG_KEY } from './config/config';+export type { IUniverFormulaConfig } from './config/config';export { FormulaCalculationSessionController } from './controllers/formula-calculation-session.controller';export { UniverFormulaPlugin } from './plugin';export { DescriptionService, IDescriptionService } from './services/description.service';diff --git a/packages/formula/src/plugin.ts b/packages/formula/src/plugin.tsindex 7d97fa320e..7c07afbaa4 100644--- a/packages/formula/src/plugin.ts+++ b/packages/formula/src/plugin.ts@@ -14,9 +14,11 @@* limitations under the License.*/-import { DependentOn, Inject, Injector, Plugin, touchDependencies, UniverInstanceType } from '@univerjs/core';+import type { IUniverFormulaConfig } from './config/config';+import { DependentOn, IConfigService, Inject, Injector, merge, Plugin, touchDependencies, UniverInstanceType } from '@univerjs/core';import { UniverFormulaEnginePlugin } from '@univerjs/engine-formula';import pkg from '../package.json';+import { defaultPluginConfig, FORMULA_PLUGIN_CONFIG_KEY } from './config/config';import { FormulaCalculationSessionController } from './controllers/formula-calculation-session.controller';import { DescriptionService, IDescriptionService } from './services/description.service';import { FormulaCalculationSessionService } from './services/formula-calculation-session.service';@@ -29,8 +31,15 @@ export class UniverFormulaPlugin extends Plugin {static override version = pkg.version;static override type = UniverInstanceType.UNIVER_UNKNOWN;- constructor(@Inject(Injector) protected readonly _injector: Injector) {+ constructor(+ private readonly _config: IUniverFormulaConfig = defaultPluginConfig,+ @Inject(Injector) protected readonly _injector: Injector,+ @IConfigService private readonly _configService: IConfigService+ ) {super();++ const { ...rest } = merge({}, defaultPluginConfig, this._config);+ this._configService.setConfig(FORMULA_PLUGIN_CONFIG_KEY, rest);}override onStarting(): void {