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.

feat(formula): add formula plugin folder (#370)

Dushusir10e3ce018eab
diff --git a/examples/univer-sheet-ts/package.json b/examples/univer-sheet-ts/package.json
index 43894b2c2d..3cedf1edb3 100644
--- a/examples/univer-sheet-ts/package.json
+++ b/examples/univer-sheet-ts/package.json
@@ -24,8 +24,6 @@
"@univerjs/design": "workspace:*",
"@univerjs/sheets-plugin-debugger": "workspace:*",
"@univerjs/sheets-plugin-find": "workspace:*",
- "@univerjs/sheets-plugin-formula": "workspace:*",
- "@univerjs/sheets-plugin-image": "workspace:*",
"@univerjs/sheets-plugin-import-xlsx": "workspace:*",
"@univerjs/sheets-plugin-numfmt": "workspace:*",
"@univerjs/ui-plugin-docs": "workspace:*",
diff --git a/packages/sheets-plugin-formula/README.md b/packages/sheets-plugin-formula/README.md
new file mode 100644
index 0000000000..bbb3a39557
--- /dev/null
+++ b/packages/sheets-plugin-formula/README.md
@@ -0,0 +1,14 @@
+# @univerjs/sheets-plugin-formula
+
+## Introduction
+
+Univer sheets-plugin-formula
+
+## Usage
+### Installation
+```shell
+npm i @univerjs/sheets-plugin-formula
+```
+
+### API
+Check [Univer](https://github.com/dream-num/univer/)
diff --git a/packages/sheets-plugin-formula/package.json b/packages/sheets-plugin-formula/package.json
new file mode 100644
index 0000000000..8c79c12eb1
--- /dev/null
+++ b/packages/sheets-plugin-formula/package.json
@@ -0,0 +1,14 @@
+{
+ "name": "@univerjs/sheets-plugin-formula",
+ "dependencies": {
+ "@univerjs/base-render": "workspace:*",
+ "@univerjs/base-sheets": "workspace:*",
+ "@univerjs/base-ui": "workspace:*",
+ "@univerjs/core": "workspace:*",
+ "@univerjs/design": "workspace:*",
+ "@univerjs/ui-plugin-sheets": "workspace:*",
+ "@wendellhu/redi": "^0.12.10",
+ "react": "^18.2.0",
+ "react-dom": "^18.2.0"
+ }
+}
diff --git a/packages/sheets-plugin-formula/src/common/PLUGIN_NAME.ts b/packages/sheets-plugin-formula/src/common/PLUGIN_NAME.ts
new file mode 100644
index 0000000000..272dbd75b8
--- /dev/null
+++ b/packages/sheets-plugin-formula/src/common/PLUGIN_NAME.ts
@@ -0,0 +1 @@
+export const FORMULA_PLUGIN_NAME = 'formula';
diff --git a/packages/sheets-plugin-formula/src/formula-plugin.ts b/packages/sheets-plugin-formula/src/formula-plugin.ts
new file mode 100644
index 0000000000..cc3df09988
--- /dev/null
+++ b/packages/sheets-plugin-formula/src/formula-plugin.ts
@@ -0,0 +1,21 @@
+import { IUniverInstanceService, LocaleService, Plugin, PluginType } from '@univerjs/core';
+import { Inject, Injector } from '@wendellhu/redi';
+
+import { FORMULA_PLUGIN_NAME } from './common/PLUGIN_NAME';
+import { enUS } from './locale';
+
+export class FormulaPlugin extends Plugin {
+ static override type = PluginType.Sheet;
+ constructor(
+ config: undefined,
+ @Inject(Injector) override readonly _injector: Injector,
+ @Inject(LocaleService) private readonly _localeService: LocaleService,
+ @IUniverInstanceService private readonly _currentUniverService: IUniverInstanceService
+ ) {
+ super(FORMULA_PLUGIN_NAME);
+
+ this._localeService.getLocale().load({
+ enUS,
+ });
+ }
+}
diff --git a/packages/sheets-plugin-formula/src/index.ts b/packages/sheets-plugin-formula/src/index.ts
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/packages/sheets-plugin-formula/src/locale/en-US.ts b/packages/sheets-plugin-formula/src/locale/en-US.ts
new file mode 100644
index 0000000000..ff8b4c5632
--- /dev/null
+++ b/packages/sheets-plugin-formula/src/locale/en-US.ts
@@ -0,0 +1 @@
+export default {};
diff --git a/packages/sheets-plugin-formula/src/locale/index.ts b/packages/sheets-plugin-formula/src/locale/index.ts
new file mode 100644
index 0000000000..b0b1d48d5d
--- /dev/null
+++ b/packages/sheets-plugin-formula/src/locale/index.ts
@@ -0,0 +1,2 @@
+export { default as enUS } from './en-US';
+export { default as zhCN } from './zh-CN';
diff --git a/packages/sheets-plugin-formula/src/locale/zh-CN.ts b/packages/sheets-plugin-formula/src/locale/zh-CN.ts
new file mode 100644
index 0000000000..ff8b4c5632
--- /dev/null
+++ b/packages/sheets-plugin-formula/src/locale/zh-CN.ts
@@ -0,0 +1 @@
+export default {};
diff --git a/packages/sheets-plugin-formula/src/views/prompt/help-function/HelpFunction.tsx b/packages/sheets-plugin-formula/src/views/prompt/help-function/HelpFunction.tsx
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/packages/sheets-plugin-formula/src/views/prompt/search-function/SearchFunction.tsx b/packages/sheets-plugin-formula/src/views/prompt/search-function/SearchFunction.tsx
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index ab8999f15e..ef3b3b23c8 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -177,12 +177,6 @@ importers:
'@univerjs/sheets-plugin-find':
specifier: workspace:*
version: link:../../packages/sheets-plugin-find
- '@univerjs/sheets-plugin-formula':
- specifier: workspace:*
- version: link:../../packages/sheets-plugin-formula
- '@univerjs/sheets-plugin-image':
- specifier: workspace:*
- version: link:../../packages/sheets-plugin-image
'@univerjs/sheets-plugin-import-xlsx':
specifier: workspace:*
version: link:../../packages/sheets-plugin-import-xlsx
@@ -853,9 +847,6 @@ importers:
packages/sheets-plugin-formula:
dependencies:
- '@univerjs/base-formula-engine':
- specifier: workspace:*
- version: link:../base-formula-engine
'@univerjs/base-render':
specifier: workspace:*
version: link:../base-render
@@ -883,89 +874,6 @@ importers:
react-dom:
specifier: ^18.2.0
version: 18.2.0([email protected])
- devDependencies:
- '@types/node':
- specifier: ^20.8.9
- version: 20.8.9
- '@types/react':
- specifier: ^18.2.33
- version: 18.2.33
- '@types/react-dom':
- specifier: ^18.2.14
- version: 18.2.14
- '@vitest/coverage-v8':
- specifier: ^0.34.6
- version: 0.34.6([email protected])
- esbuild:
- specifier: ^0.19.5
- version: 0.19.5
- less:
- specifier: ^4.2.0
- version: 4.2.0
- ts-node:
- specifier: ^10.9.1
- version: 10.9.1(@types/[email protected])([email protected])
- vitest:
- specifier: ^0.34.6
-
- packages/sheets-plugin-image:
- dependencies:
- '@univerjs/base-render':
- specifier: workspace:*
- version: link:../base-render
- '@univerjs/base-sheets':
- specifier: workspace:*
- version: link:../base-sheets
- '@univerjs/base-ui':
- specifier: workspace:*
- version: link:../base-ui
- '@univerjs/common-plugin-data':
- specifier: workspace:*
- version: link:../common-plugin-data
- '@univerjs/core':
- specifier: workspace:*
- version: link:../core
- '@univerjs/design':
- specifier: workspace:*
- version: link:../design
- '@univerjs/ui-plugin-sheets':
- specifier: workspace:*
- version: link:../ui-plugin-sheets
- '@wendellhu/redi':
- specifier: ^0.12.10
- version: 0.12.10
- react:
- specifier: ^18.2.0
- version: 18.2.0
- react-dom:
- specifier: ^18.2.0
- version: 18.2.0([email protected])
- devDependencies:
- '@types/node':
- specifier: ^20.8.9
- version: 20.8.9
- '@types/react':
- specifier: ^18.2.33
- version: 18.2.33
- '@types/react-dom':
- specifier: ^18.2.14
- version: 18.2.14
- '@vitest/coverage-v8':
- specifier: ^0.34.6
- version: 0.34.6([email protected])
- esbuild:
- specifier: ^0.19.5
- version: 0.19.5
- less:
- specifier: ^4.2.0
- version: 4.2.0
- ts-node:
- specifier: ^10.9.1
- version: 10.9.1(@types/[email protected])([email protected])
- vitest:
- specifier: ^0.34.6
packages/sheets-plugin-import-xlsx:
dependencies: