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: standardize plugin naming and update configurations across multiple packages (#5192)

白熱b29028160b08
diff --git a/examples/src/sheets/lazy.ts b/examples/src/sheets/lazy.ts
index 9d309e25d7..cb19aa0fc4 100644
--- a/examples/src/sheets/lazy.ts
+++ b/examples/src/sheets/lazy.ts
@@ -23,7 +23,7 @@ import { UniverSheetsDrawingUIPlugin } from '@univerjs/sheets-drawing-ui';
import { UniverSheetsFilterUIPlugin } from '@univerjs/sheets-filter-ui';
import { UniverSheetsFormulaUIPlugin } from '@univerjs/sheets-formula-ui';
import { UniverSheetsNumfmtUIPlugin } from '@univerjs/sheets-numfmt-ui';
-import { UniverSheetTableUIPlugin } from '@univerjs/sheets-table-ui';
+import { UniverSheetsTableUIPlugin } from '@univerjs/sheets-table-ui';
import { UniverSheetsThreadCommentUIPlugin } from '@univerjs/sheets-thread-comment-ui';
import { UniverThreadCommentUIPlugin } from '@univerjs/thread-comment-ui';
@@ -34,7 +34,7 @@ export default function getLazyPlugins(): Array<[PluginCtor<Plugin>] | [PluginCt
[UniverSheetsNumfmtUIPlugin],
[UniverThreadCommentUIPlugin],
[UniverSheetsThreadCommentUIPlugin],
- [UniverSheetTableUIPlugin],
+ [UniverSheetsTableUIPlugin],
[UniverSheetsFormulaUIPlugin],
[UniverSheetsDataValidationUIPlugin],
[UniverSheetsConditionalFormattingUIPlugin],
diff --git a/examples/src/sheets/main.ts b/examples/src/sheets/main.ts
index ddf81b6591..e7b4e9d4be 100644
--- a/examples/src/sheets/main.ts
+++ b/examples/src/sheets/main.ts
@@ -34,7 +34,7 @@ import { UniverSheetsNotePlugin } from '@univerjs/sheets-note';
import { UniverSheetsNoteUIPlugin } from '@univerjs/sheets-note-ui';
import { UniverSheetsNumfmtPlugin } from '@univerjs/sheets-numfmt';
import { UniverSheetsSortPlugin } from '@univerjs/sheets-sort';
-import { UniverSheetTablePlugin } from '@univerjs/sheets-table';
+import { UniverSheetsTablePlugin } from '@univerjs/sheets-table';
import { UniverSheetsThreadCommentPlugin } from '@univerjs/sheets-thread-comment';
import { UniverSheetsUIPlugin } from '@univerjs/sheets-ui';
import { UniverSheetsZenEditorPlugin } from '@univerjs/sheets-zen-editor';
@@ -125,7 +125,7 @@ function createNewInstance() {
univer.registerPlugin(UniverSheetsThreadCommentPlugin);
univer.registerPlugin(UniverSheetsCustomMenuPlugin);
- univer.registerPlugin(UniverSheetTablePlugin);
+ univer.registerPlugin(UniverSheetsTablePlugin);
univer.registerPlugin(UniverNetworkPlugin);
univer.registerPlugin(UniverSheetsNotePlugin);
univer.registerPlugin(UniverSheetsNoteUIPlugin);
diff --git a/package.json b/package.json
index eddab1b7ed..f3706e30ad 100644
--- a/package.json
+++ b/package.json
@@ -55,7 +55,7 @@
"@storybook/react": "8.6.12",
"@types/fs-extra": "^11.0.4",
"@types/node": "^22.15.17",
- "@types/react": "^19.1.3",
+ "@types/react": "^19.1.4",
"@types/react-dom": "^19.1.4",
"@univerjs-infra/shared": "workspace:*",
"@univerjs/design": "workspace:*",
@@ -71,7 +71,7 @@
"eslint-plugin-react-refresh": "^0.4.20",
"fs-extra": "^11.3.0",
"husky": "^9.1.7",
- "lint-staged": "^15.5.2",
+ "lint-staged": "^16.0.0",
"posthog-node": "^4.17.1",
"react": "^19.1.0",
"react-dom": "^19.1.0",
diff --git a/packages-experimental/uni-formula-ui/src/index.ts b/packages-experimental/uni-formula-ui/src/index.ts
index aee44a6039..bdde3d6a5f 100644
--- a/packages-experimental/uni-formula-ui/src/index.ts
+++ b/packages-experimental/uni-formula-ui/src/index.ts
@@ -16,5 +16,5 @@
import './global.css';
-export { UniverDocUniFormulaUIPlugin } from './uni-formula-ui.plugin';
+export { UniverDocUniFormulaUIPlugin } from './plugin';
export { UniFormulaService } from './services/uni-formula.service';
diff --git a/packages-experimental/uni-formula-ui/src/uni-formula-ui.plugin.ts b/packages-experimental/uni-formula-ui/src/plugin.ts
similarity index 100%
rename from packages-experimental/uni-formula-ui/src/uni-formula-ui.plugin.ts
rename to packages-experimental/uni-formula-ui/src/plugin.ts
diff --git a/packages-experimental/uni-formula/src/index.ts b/packages-experimental/uni-formula/src/index.ts
index dff196cffa..20581932b0 100644
--- a/packages-experimental/uni-formula/src/index.ts
+++ b/packages-experimental/uni-formula/src/index.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-export { UniverDocUniFormulaPlugin } from './uni-formula.plugin';
+export { UniverDocUniFormulaPlugin } from './plugin';
export { DumbUniFormulaService, IUniFormulaService } from './services/uni-formula.service';
export { UNI_FORMULA_PLUGIN_NAME as DOC_FORMULA_PLUGIN_NAME } from './const';
export type { IDocFormulaCache, IDocFormulaData, IDocFormulaReference } from './models/doc-formula';
diff --git a/packages-experimental/uni-formula/src/uni-formula.plugin.ts b/packages-experimental/uni-formula/src/plugin.ts
similarity index 100%
rename from packages-experimental/uni-formula/src/uni-formula.plugin.ts
rename to packages-experimental/uni-formula/src/plugin.ts
diff --git a/packages/docs-ui/src/index.ts b/packages/docs-ui/src/index.ts
index 0dfdf573a6..5e09de1c03 100644
--- a/packages/docs-ui/src/index.ts
+++ b/packages/docs-ui/src/index.ts
@@ -34,7 +34,7 @@ export { menuSchema as DocsUIMenuSchema } from './controllers/menu.schema';
export { DocBackScrollRenderController } from './controllers/render-controllers/back-scroll.render-controller';
export { DocRenderController } from './controllers/render-controllers/doc.render-controller';
export type { IUniverDocsUIConfig } from './controllers/config.schema';
-export * from './docs-ui-plugin';
+export { UniverDocsUIPlugin } from './plugin';
export * from './services';
export { IDocClipboardService } from './services/clipboard/clipboard.service';
export { DocEventManagerService } from './services/doc-event-manager.service';
diff --git a/packages/docs-ui/src/docs-ui-plugin.ts b/packages/docs-ui/src/plugin.ts
similarity index 100%
rename from packages/docs-ui/src/docs-ui-plugin.ts
rename to packages/docs-ui/src/plugin.ts
diff --git a/packages/docs/src/index.ts b/packages/docs/src/index.ts
index 72c55bcc76..17ba265b01 100644
--- a/packages/docs/src/index.ts
+++ b/packages/docs/src/index.ts
@@ -15,7 +15,7 @@
*/
export type { IUniverDocsConfig } from './controllers/config.schema';
-export { UniverDocsPlugin } from './doc-plugin';
+export { UniverDocsPlugin } from './plugin';
export { DocInterceptorService } from './services/doc-interceptor/doc-interceptor.service';
export { DOC_INTERCEPTOR_POINT } from './services/doc-interceptor/interceptor-const';
export { DocSelectionManagerService } from './services/doc-selection-manager.service';
diff --git a/packages/docs/src/doc-plugin.ts b/packages/docs/src/plugin.ts
similarity index 100%
rename from packages/docs/src/doc-plugin.ts
rename to packages/docs/src/plugin.ts
diff --git a/packages/sheets-filter-ui/src/index.ts b/packages/sheets-filter-ui/src/index.ts
index 3cfb435f6d..17c005143e 100644
--- a/packages/sheets-filter-ui/src/index.ts
+++ b/packages/sheets-filter-ui/src/index.ts
@@ -16,8 +16,8 @@
import './global.css';
-export { UniverSheetsFilterUIPlugin } from './filter-ui-desktop.plugin';
-export { UniverSheetsFilterMobileUIPlugin } from './filter-ui-mobile.plugin';
+export { UniverSheetsFilterUIPlugin } from './plugin';
+export { UniverSheetsFilterMobileUIPlugin } from './mobile-plugin';
export { UniverSheetsFilterUIWorkerPlugin } from './worker/plugin';
// #region - all commands
diff --git a/packages/sheets-filter-ui/src/filter-ui-mobile.plugin.ts b/packages/sheets-filter-ui/src/mobile-plugin.ts
similarity index 100%
rename from packages/sheets-filter-ui/src/filter-ui-mobile.plugin.ts
rename to packages/sheets-filter-ui/src/mobile-plugin.ts
diff --git a/packages/sheets-filter-ui/src/filter-ui-desktop.plugin.ts b/packages/sheets-filter-ui/src/plugin.ts
similarity index 100%
rename from packages/sheets-filter-ui/src/filter-ui-desktop.plugin.ts
rename to packages/sheets-filter-ui/src/plugin.ts
diff --git a/packages/sheets-formula-ui/src/index.ts b/packages/sheets-formula-ui/src/index.ts
index 11f0006ce5..1e0c8a60b9 100644
--- a/packages/sheets-formula-ui/src/index.ts
+++ b/packages/sheets-formula-ui/src/index.ts
@@ -32,6 +32,6 @@ export { GlobalRangeSelectorService, type IShowRangeSelectorDialogOptions } from
export { FormulaReorderController } from './controllers/formula-reorder.controller';
export { FORMULA_PROMPT_ACTIVATED } from './services/prompt.service';
-export { UniverSheetsFormulaUIPlugin } from './sheets-formula-ui.plugin';
+export { UniverSheetsFormulaUIPlugin } from './plugin';
// #endregion
diff --git a/packages/sheets-formula-ui/src/sheets-formula-ui.plugin.ts b/packages/sheets-formula-ui/src/plugin.ts
similarity index 100%
rename from packages/sheets-formula-ui/src/sheets-formula-ui.plugin.ts
rename to packages/sheets-formula-ui/src/plugin.ts
diff --git a/packages/sheets-formula/src/index.ts b/packages/sheets-formula/src/index.ts
index 7c2407a196..6ea568599e 100644
--- a/packages/sheets-formula/src/index.ts
+++ b/packages/sheets-formula/src/index.ts
@@ -32,6 +32,6 @@ export { RegisterFunctionService } from './services/register-function.service';
export { IRegisterFunctionService } from './services/register-function.service';
export { RegisterOtherFormulaService } from './services/register-other-formula.service';
export { IRemoteRegisterFunctionService, RemoteRegisterFunctionService } from './services/remote/remote-register-function.service';
-export { UniverRemoteSheetsFormulaPlugin, UniverSheetsFormulaPlugin } from './sheets-formula.plugin';
+export { UniverRemoteSheetsFormulaPlugin, UniverSheetsFormulaPlugin } from './plugin';
// #endregion
diff --git a/packages/sheets-formula/src/sheets-formula.plugin.ts b/packages/sheets-formula/src/plugin.ts
similarity index 100%
rename from packages/sheets-formula/src/sheets-formula.plugin.ts
rename to packages/sheets-formula/src/plugin.ts
diff --git a/packages/sheets-graphics/src/controllers/config.schema.ts b/packages/sheets-graphics/src/controllers/config.schema.ts
index 95a7cc68c5..9a06fed28a 100644
--- a/packages/sheets-graphics/src/controllers/config.schema.ts
+++ b/packages/sheets-graphics/src/controllers/config.schema.ts
@@ -20,8 +20,8 @@ export const PLUGIN_CONFIG_KEY = 'graphics.config';
export const configSymbol = Symbol(PLUGIN_CONFIG_KEY);
-export interface IUniverSheetGraphicsConfig {
+export interface IUniverSheetsGraphicsConfig {
override?: DependencyOverride;
}
-export const defaultPluginConfig: IUniverSheetGraphicsConfig = {};
+export const defaultPluginConfig: IUniverSheetsGraphicsConfig = {};
diff --git a/packages/sheets-graphics/src/index.ts b/packages/sheets-graphics/src/index.ts
index 52bc669120..6da24c132d 100644
--- a/packages/sheets-graphics/src/index.ts
+++ b/packages/sheets-graphics/src/index.ts
@@ -14,5 +14,5 @@
* limitations under the License.
*/
-export { UniverSheetGraphicsPlugin } from './plugin';
+export { UniverSheetsGraphicsPlugin } from './plugin';
export { SheetGraphicsRenderController } from './controllers/graphics-render.controller';
diff --git a/packages/sheets-graphics/src/plugin.ts b/packages/sheets-graphics/src/plugin.ts
index b33cdca515..ff33b30aa2 100644
--- a/packages/sheets-graphics/src/plugin.ts
+++ b/packages/sheets-graphics/src/plugin.ts
@@ -15,7 +15,7 @@
*/
import type { Dependency } from '@univerjs/core';
-import type { IUniverSheetGraphicsConfig } from './controllers/config.schema';
+import type { IUniverSheetsGraphicsConfig } from './controllers/config.schema';
import { IConfigService, Inject, Injector, merge, Plugin, UniverInstanceType } from '@univerjs/core';
import { IRenderManagerService } from '@univerjs/engine-render';
@@ -24,11 +24,11 @@ import { SheetGraphicsRenderController } from './controllers/graphics-render.con
const PLUGIN_NAME = 'UNIVER_SHEET_DRAWING_PLUGIN';
-export class UniverSheetGraphicsPlugin extends Plugin {
+export class UniverSheetsGraphicsPlugin extends Plugin {
static override pluginName = PLUGIN_NAME;
constructor(
- private readonly _config: Partial<IUniverSheetGraphicsConfig> = defaultPluginConfig,
+ private readonly _config: Partial<IUniverSheetsGraphicsConfig> = defaultPluginConfig,
@Inject(Injector) protected _injector: Injector,
@IConfigService private readonly _configService: IConfigService,
@IRenderManagerService private readonly _renderManagerService: IRenderManagerService
diff --git a/packages/sheets-note-ui/src/controllers/config.schema.ts b/packages/sheets-note-ui/src/controllers/config.schema.ts
new file mode 100644
index 0000000000..52bbace80f
--- /dev/null
+++ b/packages/sheets-note-ui/src/controllers/config.schema.ts
@@ -0,0 +1,32 @@
+/**
+ * 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 { MenuConfig } from '@univerjs/ui';
+
+export const SHEETS_NOTE_UI_PLUGIN_CONFIG_KEY = 'sheets-note-ui.config';
+
+export const configSymbol = Symbol(SHEETS_NOTE_UI_PLUGIN_CONFIG_KEY);
+
+export interface IUniverSheetsNoteUIPluginConfig {
+ menu?: MenuConfig;
+
+ defaultNoteSize?: {
+ width: number;
+ height: number;
+ };
+}
+
+export const defaultPluginConfig: IUniverSheetsNoteUIPluginConfig = {};
diff --git a/packages/sheets-note-ui/src/index.ts b/packages/sheets-note-ui/src/index.ts
index 716749626d..cdf499f086 100644
--- a/packages/sheets-note-ui/src/index.ts
+++ b/packages/sheets-note-ui/src/index.ts
@@ -16,8 +16,9 @@
import './global.css';
-export { type IUniverSheetsNoteUIPluginConfig, UniverSheetsNoteUIPlugin } from './plugin';
-export * from './services/sheets-note-popup.service';
-export * from './views/note';
-export * from './controllers/sheets-note-popup.controller';
-export * from './controllers/sheets-cell-content.controller';
+export { UniverSheetsNoteUIPlugin } from './plugin';
+export { type IUniverSheetsNoteUIPluginConfig } from './controllers/config.schema';
+export { SheetsNotePopupService } from './services/sheets-note-popup.service';
+export { SheetsNote } from './views/note';
+export { SheetsNotePopupController } from './controllers/sheets-note-popup.controller';
+export { SheetsCellContentController } from './controllers/sheets-cell-content.controller';
diff --git a/packages/sheets-note-ui/src/plugin.ts b/packages/sheets-note-ui/src/plugin.ts
index c966874be0..13885c7024 100644
--- a/packages/sheets-note-ui/src/plugin.ts
+++ b/packages/sheets-note-ui/src/plugin.ts
@@ -15,9 +15,10 @@
*/
import type { Dependency } from '@univerjs/core';
+import type { IUniverSheetsNoteUIPluginConfig } from './controllers/config.schema';
import { DependentOn, IConfigService, Inject, Injector, merge, Plugin, touchDependencies, UniverInstanceType } from '@univerjs/core';
import { UniverSheetsNotePlugin } from '@univerjs/sheets-note';
-import { menuSchema } from './controllers/menu.schema';
+import { defaultPluginConfig, SHEETS_NOTE_UI_PLUGIN_CONFIG_KEY } from './controllers/config.schema';
import { SheetsCellContentController } from './controllers/sheets-cell-content.controller';
import { SheetsNoteAttachmentController } from './controllers/sheets-note-attachment.controller';
import { SheetsNotePopupController } from './controllers/sheets-note-popup.controller';
@@ -25,21 +26,6 @@ import { SheetsNoteUIController } from './controllers/sheets-note-ui.controller'
import { SheetsNotePopupService } from './services/sheets-note-popup.service';
export const PLUGIN_NAME = 'SHEET_NOTE_UI_PLUGIN';
-export const SHEETS_NOTE_UI_PLUGIN_CONFIG_KEY = 'sheets-note-ui';
-
-export interface IUniverSheetsNoteUIPluginConfig {
- menu?: {
- [key: string]: unknown;
- };
- defaultNoteSize?: {
- width: number;
- height: number;
- };
-}
-
-const defaultPluginConfig: IUniverSheetsNoteUIPluginConfig = {
- menu: menuSchema,
-};
@DependentOn(UniverSheetsNotePlugin)
export class UniverSheetsNoteUIPlugin extends Plugin {
diff --git a/packages/sheets-note-ui/src/services/sheets-note-popup.service.ts b/packages/sheets-note-ui/src/services/sheets-note-popup.service.ts
index 956e1d3eef..665023d99b 100644
--- a/packages/sheets-note-ui/src/services/sheets-note-popup.service.ts
+++ b/packages/sheets-note-ui/src/services/sheets-note-popup.service.ts
@@ -22,7 +22,7 @@ import { IZenZoneService } from '@univerjs/ui';
import { BehaviorSubject } from 'rxjs';
import { SHEET_NOTE_COMPONENT } from '../views/config';
-export interface INotePopup extends ISheetLocationBase {
+interface INotePopup extends ISheetLocationBase {
noteId?: string;
temp?: boolean;
trigger?: string;
diff --git a/packages/sheets-note-ui/src/views/note.tsx b/packages/sheets-note-ui/src/views/note.tsx
index 71bdfea2e1..e4605e8db6 100644
--- a/packages/sheets-note-ui/src/views/note.tsx
+++ b/packages/sheets-note-ui/src/views/note.tsx
@@ -17,14 +17,14 @@
import type { ISheetLocationBase } from '@univerjs/sheets';
import type { ISheetNote } from '@univerjs/sheets-note';
import type { IPopup } from '@univerjs/ui';
-import type { IUniverSheetsNoteUIPluginConfig } from '../plugin';
+import type { IUniverSheetsNoteUIPluginConfig } from '../controllers/config.schema';
import { ICommandService, LocaleService } from '@univerjs/core';
import { borderClassName, clsx, scrollbarClassName } from '@univerjs/design';
import { SheetDeleteNoteCommand, SheetsNoteModel, SheetUpdateNoteCommand } from '@univerjs/sheets-note';
import { useConfigValue, useDebounceFn, useDependency } from '@univerjs/ui';
import { useEffect, useMemo, useRef, useState } from 'react';
import { of } from 'rxjs';
-import { SHEETS_NOTE_UI_PLUGIN_CONFIG_KEY } from '../plugin';
+import { SHEETS_NOTE_UI_PLUGIN_CONFIG_KEY } from '../controllers/config.schema';
export const SheetsNote = (props: { popup: IPopup<{ location: ISheetLocationBase }> }) => {
const noteModel = useDependency(SheetsNoteModel);
diff --git a/packages/sheets-note/src/const.ts b/packages/sheets-note/src/const.ts
new file mode 100644
index 0000000000..3f93ffe471
--- /dev/null
+++ b/packages/sheets-note/src/const.ts
@@ -0,0 +1,17 @@
+/**
+ * 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 PLUGIN_NAME = 'SHEET_NOTE_PLUGIN';
diff --git a/packages/sheets-note/src/controllers/config.schema.ts b/packages/sheets-note/src/controllers/config.schema.ts
new file mode 100644
index 0000000000..110a3dc13c
--- /dev/null
+++ b/packages/sheets-note/src/controllers/config.schema.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 SHEETS_NOTE_PLUGIN_CONFIG_KEY = 'sheets-note.config';
+
+export const configSymbol = Symbol(SHEETS_NOTE_PLUGIN_CONFIG_KEY);
+
+export interface IUniverSheetsNoteConfig {}
+
+export const defaultPluginConfig: IUniverSheetsNoteConfig = {};
diff --git a/packages/sheets-note/src/controllers/sheets-note-resource.controller.ts b/packages/sheets-note/src/controllers/sheets-note-resource.controller.ts
index 9fffd8d782..d2179a692a 100644
--- a/packages/sheets-note/src/controllers/sheets-note-resource.controller.ts
+++ b/packages/sheets-note/src/controllers/sheets-note-resource.controller.ts
@@ -16,8 +16,8 @@
import type { ISheetNote } from '../models/sheets-note.model';
import { Disposable, Inject, IResourceManagerService, IUniverInstanceService, UniverInstanceType } from '@univerjs/core';
+import { PLUGIN_NAME } from '../const';
import { SheetsNoteModel } from '../models/sheets-note.model';
-import { PLUGIN_NAME } from '../plugin';
interface INoteData {
[sheetId: string]: {
diff --git a/packages/sheets-note/src/plugin.ts b/packages/sheets-note/src/plugin.ts
index 9c079dcd51..2ff585f4a2 100644
--- a/packages/sheets-note/src/plugin.ts
+++ b/packages/sheets-note/src/plugin.ts
@@ -15,25 +15,35 @@
*/
import type { Dependency } from '@univerjs/core';
-import { DependentOn, IConfigService, Inject, Injector, Plugin, touchDependencies, UniverInstanceType } from '@univerjs/core';
+import type { IUniverSheetsNoteConfig } from './controllers/config.schema';
+import { DependentOn, IConfigService, Inject, Injector, merge, Plugin, touchDependencies, UniverInstanceType } from '@univerjs/core';
import { UniverSheetsPlugin } from '@univerjs/sheets';
+import { PLUGIN_NAME } from './const';
+import { defaultPluginConfig, SHEETS_NOTE_PLUGIN_CONFIG_KEY } from './controllers/config.schema';
import { SheetsNoteRefRangeController } from './controllers/sheets-note-ref-range.controller';
import { SheetsNoteResourceController } from './controllers/sheets-note-resource.controller';
import { SheetsNoteController } from './controllers/sheets.note.controller';
import { SheetsNoteModel } from './models/sheets-note.model';
-export const PLUGIN_NAME = 'SHEET_NOTE_PLUGIN';
-
@DependentOn(UniverSheetsPlugin)
export class UniverSheetsNotePlugin extends Plugin {
static override pluginName = PLUGIN_NAME;
static override type = UniverInstanceType.UNIVER_SHEET;
constructor(
+ private readonly _config: IUniverSheetsNoteConfig = defaultPluginConfig,
@IConfigService private readonly _configService: IConfigService,
@Inject(Injector) protected override readonly _injector: Injector
) {
super();
+ // Manage the plugin configuration.
+ const { ...rest } = merge(
+ {},
+ defaultPluginConfig,
+ this._config
+ );
+
+ this._configService.setConfig(SHEETS_NOTE_PLUGIN_CONFIG_KEY, rest);
}
override onStarting(): void {
diff --git a/packages/sheets-numfmt/src/index.ts b/packages/sheets-numfmt/src/index.ts
index ce05dea421..c8dd3c7d64 100644
--- a/packages/sheets-numfmt/src/index.ts
+++ b/packages/sheets-numfmt/src/index.ts
@@ -16,7 +16,7 @@
export { countryCurrencyMap } from './base/const/currency-symbols';
export { CURRENCYFORMAT, DATEFMTLISG, NUMBERFORMAT } from './base/const/formatdetail';
-export { UniverSheetsNumfmtPlugin } from './numfmt-plugin';
+export { UniverSheetsNumfmtPlugin } from './plugin';
export { MenuCurrencyService } from './service/menu.currency.service';
export { getPatternPreview, getPatternPreviewIgnoreGeneral, getPatternType } from './utils/pattern';
export { getDecimalFromPattern, getDecimalString, isPatternEqualWithoutDecimal, isPatternHasDecimal, setPatternDecimal } from './utils/decimal';
diff --git a/packages/sheets-numfmt/src/numfmt-plugin.ts b/packages/sheets-numfmt/src/plugin.ts
similarity index 100%
rename from packages/sheets-numfmt/src/numfmt-plugin.ts
rename to packages/sheets-numfmt/src/plugin.ts
diff --git a/packages/sheets-table-ui/README.md b/packages/sheets-table-ui/README.md
index ce33d7531c..13162147c7 100644
--- a/packages/sheets-table-ui/README.md
+++ b/packages/sheets-table-ui/README.md
@@ -9,9 +9,9 @@ npm i @univerjs/sheets-table-ui
### Import
```ts
-import { UniverSheetTableUIPlugin } from '@univerjs/sheets-table-ui'
+import { UniverSheetsTableUIPlugin } from '@univerjs/sheets-table-ui'
-univer.registerPlugin(UniverSheetTableUIPlugin);
+univer.registerPlugin(UniverSheetsTableUIPlugin);
```
<!-- Links -->
diff --git a/packages/sheets-table-ui/src/controllers/config.schema.ts b/packages/sheets-table-ui/src/controllers/config.schema.ts
index 8fe4054696..ead8bbb4dd 100644
--- a/packages/sheets-table-ui/src/controllers/config.schema.ts
+++ b/packages/sheets-table-ui/src/controllers/config.schema.ts
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+import type { MenuConfig } from '@univerjs/ui';
+
export const SHEETS_TABLE_UI_PLUGIN_CONFIG_KEY = 'sheets-table-ui.config';
export const configSymbol = Symbol(SHEETS_TABLE_UI_PLUGIN_CONFIG_KEY);
@@ -22,6 +24,8 @@ export interface IUniverSheetsTableUIConfig {
anchorHeight?: number;
anchorBackgroundColor?: string;
hideAnchor?: boolean;
+
+ menu?: MenuConfig;
}
export const defaultPluginConfig: IUniverSheetsTableUIConfig = {
diff --git a/packages/sheets-table-ui/src/index.ts b/packages/sheets-table-ui/src/index.ts
index 7bfe7498b0..0c6b8b0eb3 100644
--- a/packages/sheets-table-ui/src/index.ts
+++ b/packages/sheets-table-ui/src/index.ts
@@ -16,4 +16,4 @@
import './global.css';
-export { UniverSheetTableUIPlugin } from './plugin';
+export { UniverSheetsTableUIPlugin } from './plugin';
diff --git a/packages/sheets-table-ui/src/plugin.ts b/packages/sheets-table-ui/src/plugin.ts
index 300cc0fabf..94ae9b70c0 100644
--- a/packages/sheets-table-ui/src/plugin.ts
+++ b/packages/sheets-table-ui/src/plugin.ts
@@ -16,13 +16,13 @@
import type { Dependency } from '@univerjs/core';
import type { IUniverSheetsTableUIConfig } from './controllers/config.schema';
-import { DependentOn, ICommandService, IConfigService, Inject, Injector, Plugin, registerDependencies, touchDependencies, UniverInstanceType } from '@univerjs/core';
+import { DependentOn, ICommandService, IConfigService, Inject, Injector, merge, Plugin, registerDependencies, touchDependencies, UniverInstanceType } from '@univerjs/core';
import { IRenderManagerService } from '@univerjs/engine-render';
-import { UniverSheetTablePlugin } from '@univerjs/sheets-table';
+import { UniverSheetsTablePlugin } from '@univerjs/sheets-table';
import { OpenTableFilterPanelOperation } from './commands/operations/open-table-filter-dialog.opration';
import { OpenTableSelectorOperation } from './commands/operations/open-table-selector.operation';
import { PLUGIN_NAME } from './const';
-import { SHEETS_TABLE_UI_PLUGIN_CONFIG_KEY } from './controllers/config.schema';
+import { defaultPluginConfig, SHEETS_TABLE_UI_PLUGIN_CONFIG_KEY } from './controllers/config.schema';
import { SheetTableAnchorController } from './controllers/sheet-table-anchor.controller';
import { SheetsTableComponentController } from './controllers/sheet-table-component.controller';
import { SheetsTableFilterButtonRenderController } from './controllers/sheet-table-filter-button-render.controller';
@@ -32,22 +32,31 @@ import { SheetTableSelectionController } from './controllers/sheet-table-selecti
import { SheetTableThemeUIController } from './controllers/sheet-table-theme-ui.controller';
import { SheetsTableUiService } from './services/sheets-table-ui-service';
-@DependentOn(UniverSheetTablePlugin)
-export class UniverSheetTableUIPlugin extends Plugin {
+@DependentOn(UniverSheetsTablePlugin)
+export class UniverSheetsTableUIPlugin extends Plugin {
static override pluginName = PLUGIN_NAME;
static override type = UniverInstanceType.UNIVER_SHEET;
constructor(
- private readonly _config: Partial<IUniverSheetsTableUIConfig> = {},
+ private readonly _config: Partial<IUniverSheetsTableUIConfig> = defaultPluginConfig,
@Inject(Injector) protected override _injector: Injector,
@Inject(ICommandService) private _commandService: ICommandService,
@IConfigService private readonly _configService: IConfigService,
@IRenderManagerService private readonly _renderManagerService: IRenderManagerService
) {
super();
- this._initRegisterCommand();
+ // Manage the plugin configuration.
+ const { menu, ...rest } = merge(
+ {},
+ defaultPluginConfig,
+ this._config
+ );
+ if (menu) {
+ this._configService.setConfig('menu', menu, { merge: true });
+ }
+ this._configService.setConfig(SHEETS_TABLE_UI_PLUGIN_CONFIG_KEY, rest);
- this._configService.setConfig(SHEETS_TABLE_UI_PLUGIN_CONFIG_KEY, this._config);
+ this._initRegisterCommand();
}
override onStarting(): void {
diff --git a/packages/sheets-table/README.md b/packages/sheets-table/README.md
index c927469b6c..a32b4b40c0 100644
--- a/packages/sheets-table/README.md
+++ b/packages/sheets-table/README.md
@@ -9,9 +9,9 @@ npm i @univerjs/sheets-table
### Import
```ts
-import { UniverSheetTablePlugin } from '@univerjs/sheets-table';
+import { UniverSheetsTablePlugin } from '@univerjs/sheets-table';
-univer.registerPlugin(UniverSheetTablePlugin);
+univer.registerPlugin(UniverSheetsTablePlugin);
```
<!-- Links -->
diff --git a/packages/sheets-table/src/controllers/config.schema.ts b/packages/sheets-table/src/controllers/config.schema.ts
new file mode 100644
index 0000000000..af04cbf028
--- /dev/null
+++ b/packages/sheets-table/src/controllers/config.schema.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 SHEETS_TABLE_PLUGIN_CONFIG_KEY = 'sheets-table.config';
+
+export const configSymbol = Symbol(SHEETS_TABLE_PLUGIN_CONFIG_KEY);
+
+export interface IUniverSheetsTableConfig {}
+
+export const defaultPluginConfig: IUniverSheetsTableConfig = {};
diff --git a/packages/sheets-table/src/index.ts b/packages/sheets-table/src/index.ts
index 5eb6270d6b..33758fd37d 100644
--- a/packages/sheets-table/src/index.ts
+++ b/packages/sheets-table/src/index.ts
@@ -15,7 +15,7 @@
*/
export { SheetsTableButtonStateEnum, SheetsTableSortStateEnum, TableColumnDataTypeEnum, TableColumnFilterTypeEnum, TableConditionTypeEnum, TableDateCompareTypeEnum, TableNumberCompareTypeEnum, TableStringCompareTypeEnum } from './types/enum';
-export { UniverSheetTablePlugin } from './plugin';
+export { UniverSheetsTablePlugin } from './plugin';
export type { ITableColumnJson, ITableConditionFilterItem, ITableData, ITableFilterItem, ITableInfo, ITableInfoWithUnitId, ITableManualFilterItem, ITableOptions, ITableRange, ITableRangeWithState, TableMetaType, TableRelationTupleType } from './types/type';
export { SheetTableService } from '../src/services/table-service';
export { TableManager } from '../src/model/table-manager';
diff --git a/packages/sheets-table/src/plugin.ts b/packages/sheets-table/src/plugin.ts
index 0039d453cd..db22707434 100644
--- a/packages/sheets-table/src/plugin.ts
+++ b/packages/sheets-table/src/plugin.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import { ICommandService, Inject, Injector, Plugin, registerDependencies, touchDependencies, UniverInstanceType } from '@univerjs/core';
+import { ICommandService, IConfigService, Inject, Injector, merge, Plugin, registerDependencies, touchDependencies, UniverInstanceType } from '@univerjs/core';
import { AddSheetTableCommand } from './commands/commands/add-sheet-table.command';
import { AddTableThemeCommand } from './commands/commands/add-table-theme.command';
import { DeleteSheetTableCommand } from './commands/commands/delete-sheet-table.command';
@@ -27,6 +27,7 @@ import { DeleteSheetTableMutation } from './commands/mutations/delete-sheet-tabl
import { SetSheetTableMutation } from './commands/mutations/set-sheet-table.mutation';
import { SetSheetTableFilterMutation } from './commands/mutations/set-table-filter.mutation';
import { PLUGIN_NAME } from './const';
+import { defaultPluginConfig, SHEETS_TABLE_PLUGIN_CONFIG_KEY } from './controllers/config.schema';
import { SheetTableRangeController } from './controllers/sheet-table-range.controller';
import { SheetTableRefRangeController } from './controllers/sheet-table-ref-range.controller';
import { SheetsTableThemeController } from './controllers/sheet-table-theme.controller';
@@ -35,16 +36,25 @@ import { TableFilterController } from './controllers/table-filter.controller';
import { TableManager } from './model/table-manager';
import { SheetTableService } from './services/table-service';
-export class UniverSheetTablePlugin extends Plugin {
+export class UniverSheetsTablePlugin extends Plugin {
static override pluginName = PLUGIN_NAME;
static override type = UniverInstanceType.UNIVER_SHEET;
constructor(
- private readonly _config = {},
+ private readonly _config = defaultPluginConfig,
@Inject(Injector) protected override _injector: Injector,
+ @IConfigService private readonly _configService: IConfigService,
@Inject(ICommandService) private _commandService: ICommandService
) {
super();
+ // Manage the plugin configuration.
+ const { ...rest } = merge(
+ {},
+ defaultPluginConfig,
+ this._config
+ );
+ this._configService.setConfig(SHEETS_TABLE_PLUGIN_CONFIG_KEY, rest);
+
this._initRegisterCommand();
}
diff --git a/packages/sheets/src/index.ts b/packages/sheets/src/index.ts
index d0685e856e..fc40c719ab 100644
--- a/packages/sheets/src/index.ts
+++ b/packages/sheets/src/index.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-export { UniverSheetsPlugin } from './sheets-plugin';
+export { UniverSheetsPlugin } from './plugin';
// #region services
export {
diff --git a/packages/sheets/src/sheets-plugin.ts b/packages/sheets/src/plugin.ts
similarity index 100%
rename from packages/sheets/src/sheets-plugin.ts
rename to packages/sheets/src/plugin.ts
diff --git a/packages/slides-ui/src/index.ts b/packages/slides-ui/src/index.ts
index 878429f02c..fabb0b206e 100644
--- a/packages/slides-ui/src/index.ts
+++ b/packages/slides-ui/src/index.ts
@@ -16,7 +16,7 @@
import './global.css';
-export { UniverSlidesUIPlugin } from './slides-ui-plugin';
+export { UniverSlidesUIPlugin } from './plugin';
export { SlidesUIController } from './controllers/slide-ui.controller';
export { SlideSideBar } from './components/slide-bar/SlideBar';
diff --git a/packages/slides-ui/src/slides-ui-plugin.ts b/packages/slides-ui/src/plugin.ts
similarity index 100%
rename from packages/slides-ui/src/slides-ui-plugin.ts
rename to packages/slides-ui/src/plugin.ts
diff --git a/packages/slides/src/index.ts b/packages/slides/src/index.ts
index de9fc2c950..7781548393 100644
--- a/packages/slides/src/index.ts
+++ b/packages/slides/src/index.ts
@@ -14,5 +14,5 @@
* limitations under the License.
*/
-export { UniverSlidesPlugin } from './slides-plugin';
+export { UniverSlidesPlugin } from './plugin';
export * from './views/render';
diff --git a/packages/slides/src/slides-plugin.ts b/packages/slides/src/plugin.ts
similarity index 100%
rename from packages/slides/src/slides-plugin.ts
rename to packages/slides/src/plugin.ts
diff --git a/packages/ui/src/index.ts b/packages/ui/src/index.ts
index 197c9e01bc..aa2be3deb9 100644
--- a/packages/ui/src/index.ts
+++ b/packages/ui/src/index.ts
@@ -42,7 +42,7 @@ export { ShortcutPanelController } from './controllers/shortcut-display/shortcut
export { IUIController, type IWorkbenchOptions } from './controllers/ui/ui.controller';
export { DesktopUIController } from './controllers/ui/ui-desktop.controller';
export { SingleUnitUIController } from './controllers/ui/ui-shared.controller';
-export { UniverMobileUIPlugin } from './mobile-ui-plugin';
+export { UniverMobileUIPlugin } from './mobile-plugin';
export { DesktopBeforeCloseService, IBeforeCloseService } from './services/before-close/before-close.service';
export { CopyCommand, CutCommand, PasteCommand, SheetPasteShortKeyCommandName } from './services/clipboard/clipboard.command';
export { supportClipboardAPI } from './services/clipboard/clipboard-utils';
@@ -115,7 +115,7 @@ export { DesktopZenZoneService } from './services/zen-zone/desktop-zen-zone.serv
export { IZenZoneService } from './services/zen-zone/zen-zone.service';
export { FloatDomSingle } from './views/components/dom/FloatDom';
export { PrintFloatDomSingle } from './views/components/dom/print';
-export { DISABLE_AUTO_FOCUS_KEY, UNIVER_UI_PLUGIN_NAME, UniverUIPlugin } from './ui-plugin';
+export { DISABLE_AUTO_FOCUS_KEY, UNIVER_UI_PLUGIN_NAME, UniverUIPlugin } from './plugin';
export * from './utils';
export { ComponentContainer, type IComponentContainerProps, useComponentsOfPart } from './views/components/ComponentContainer';
export { ZenZone } from './views/components/zen-zone/ZenZone';
diff --git a/packages/ui/src/mobile-ui-plugin.ts b/packages/ui/src/mobile-plugin.ts
similarity index 100%
rename from packages/ui/src/mobile-ui-plugin.ts
rename to packages/ui/src/mobile-plugin.ts
diff --git a/packages/ui/src/ui-plugin.ts b/packages/ui/src/plugin.ts
similarity index 100%
rename from packages/ui/src/ui-plugin.ts
rename to packages/ui/src/plugin.ts
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index e43fee8942..535cb15571 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -93,8 +93,8 @@ importers:
specifier: ^9.1.7
version: 9.1.7
lint-staged:
- specifier: ^15.5.2
- version: 15.5.2
+ specifier: ^16.0.0
+ version: 16.0.0
posthog-node:
specifier: ^4.17.1
version: 4.17.1
@@ -7655,10 +7655,6 @@ packages:
resolution: {integrity: sha512-CTNS0BcKBcoOsawKBlpcKNmK4Kjuyz5jVLhf+PUsHGMqiKMVTa4cN3U7r7bRY8KTpfOGpXMo27fdy0dYVg2pqA==}
engines: {node: '>=16.17'}
- resolution: {integrity: sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg==}
- engines: {node: '>=16.17'}
-
resolution: {integrity: sha512-/kP8CAwxzLVEeFrMm4kMmy4CCDlpipyA7MYLVrdJIkV0fYF0UaigQHRsxHiuY/GEea+bh4KSv3TIlgr+2UL6bw==}
engines: {node: '>=12.0.0'}
@@ -8588,9 +8584,9 @@ packages:
resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==}
- resolution: {integrity: sha512-YUSOLq9VeRNAo/CTaVmhGDKG+LBtA8KF1X4K5+ykMSwWST1vDxJRB2kv2COgLb1fvpCo+A/y9A0G0znNVmdx4w==}
- engines: {node: '>=18.12.0'}
+ resolution: {integrity: sha512-sUCprePs6/rbx4vKC60Hez6X10HPkpDJaGcy3D1NdwR7g1RcNkWL8q9mJMreOqmHBTs+1sNFp+wOiX9fr+hoOQ==}
+ engines: {node: '>=20.18'}
hasBin: true
@@ -9005,6 +9001,10 @@ packages:
resolution: {integrity: sha512-S24aGsn+HLBxUGVAUFOwGpKs7LBcG4RudKU//eWzt/mQ97/NMKQxDWHyHx63UNWk/OOdihgmzoETn1tf5nQDzQ==}
+ resolution: {integrity: sha512-BfcvzBlUTxSDWfT+oH7vd6CbUV+rThLLHCIym/QO6GGLBsyVXleZs00fto2i2jzC/wPiBYk5jyOmpXWg4YopiA==}
+ engines: {node: '>=20.18'}
+
resolution: {integrity: sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==}
engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
@@ -15924,18 +15924,6 @@ snapshots:
signal-exit: 4.1.0
strip-final-newline: 3.0.0
- dependencies:
- cross-spawn: 7.0.6
- get-stream: 8.0.1
- human-signals: 5.0.0
- is-stream: 3.0.0
- merge-stream: 2.0.0
- npm-run-path: 5.3.0
- onetime: 6.0.0
- signal-exit: 4.1.0
- strip-final-newline: 3.0.0
-
@@ -16926,15 +16914,15 @@ snapshots:
dependencies:
chalk: 5.4.1
commander: 13.1.0
debug: 4.4.0
- execa: 8.0.1
lilconfig: 3.1.3
listr2: 8.3.3
micromatch: 4.0.8
+ nano-spawn: 1.0.1
pidtree: 0.6.0
string-argv: 0.3.2
yaml: 2.7.1
@@ -17510,6 +17498,8 @@ snapshots:
+