diff --git a/packages/effects/plugins/src/echarts/types.ts b/packages/effects/plugins/src/echarts/types.ts index 9276e0194..56813754d 100644 --- a/packages/effects/plugins/src/echarts/types.ts +++ b/packages/effects/plugins/src/echarts/types.ts @@ -1,9 +1,16 @@ -import type { BarSeriesOption, LineSeriesOption } from 'echarts/charts'; +import type { + BarSeriesOption, + LineSeriesOption, + PieSeriesOption, + RadarSeriesOption, +} from 'echarts/charts'; import type { DatasetComponentOption, GridComponentOption, + LegendComponentOption, TitleComponentOption, TooltipComponentOption, + ToolboxComponentOption, } from 'echarts/components'; import type { ComposeOption } from 'echarts/core'; @@ -11,7 +18,11 @@ export type ECOption = ComposeOption< | BarSeriesOption | DatasetComponentOption | GridComponentOption + | LegendComponentOption | LineSeriesOption + | PieSeriesOption + | RadarSeriesOption | TitleComponentOption | TooltipComponentOption + | ToolboxComponentOption >; diff --git a/packages/effects/plugins/src/plugins-context.ts b/packages/effects/plugins/src/plugins-context.ts index ae8b26717..a8d07e744 100644 --- a/packages/effects/plugins/src/plugins-context.ts +++ b/packages/effects/plugins/src/plugins-context.ts @@ -3,7 +3,28 @@ import type { VbenPluginsOptions } from "./types"; let globalPluginsOptions: VbenPluginsOptions | null = null; export function providePluginsOptions(options: VbenPluginsOptions) { - globalPluginsOptions = options; + if (!globalPluginsOptions) { + globalPluginsOptions = options; + return; + } + + globalPluginsOptions = { + ...globalPluginsOptions, + ...options, + form: globalPluginsOptions.form && options.form + ? { ...globalPluginsOptions.form, ...options.form } + : globalPluginsOptions.form || options.form, + modal: globalPluginsOptions.modal && options.modal + ? { ...globalPluginsOptions.modal, ...options.modal } + : globalPluginsOptions.modal || options.modal, + message: globalPluginsOptions.message && options.message + ? { ...globalPluginsOptions.message, ...options.message } + : globalPluginsOptions.message || options.message, + components: { + ...globalPluginsOptions.components, + ...options.components, + }, + }; } export function injectPluginsOptions() { diff --git a/packages/effects/plugins/src/vxe-table/init.ts b/packages/effects/plugins/src/vxe-table/init.ts index d92136ec6..d0915dd59 100644 --- a/packages/effects/plugins/src/vxe-table/init.ts +++ b/packages/effects/plugins/src/vxe-table/init.ts @@ -21,12 +21,11 @@ import { VxeUI, VxeUpload } from "vxe-pc-ui"; -import enUS from "vxe-pc-ui/lib/language/en-US"; -// 导入默认的语言 +import enUS from "vxe-pc-ui/lib/language/en-US"; // 导入默认的语言 import zhCN from "vxe-pc-ui/lib/language/zh-CN"; import { VxeColgroup, VxeColumn, VxeGrid, VxeTable, VxeToolbar } from "vxe-table"; -import { extendsDefaultFormatter } from "./extends"; +import { extendsDefaultFormatter } from "./extends"; // 是否加载过 // 是否加载过 let isInit = false; @@ -109,7 +108,7 @@ export function setupVbenVxeTable(setupOptions: SetupVxeTable) { initVxeTable(); - // 优先使用参数传入的 useVbenForm,context 注入在 useTableForm 中获取 + // 优先使用参数传入的 useVbenForm,否则清空让 context 注入生效 if (useVbenFormFromParam) { tableFormFactory = useVbenFormFromParam; } diff --git a/playground/src/adapter/vxe-table.ts b/playground/src/adapter/vxe-table.ts index ec5711ebe..07e9a8d1c 100644 --- a/playground/src/adapter/vxe-table.ts +++ b/playground/src/adapter/vxe-table.ts @@ -1,20 +1,22 @@ -import type { VxeTableGridOptions } from "@vben/plugins/vxe-table"; -import { setupVbenVxeTable, useVbenVxeGrid as useGrid } from "@vben/plugins/vxe-table"; -import type { Recordable } from "@vben/types"; +import type { VxeTableGridOptions } from '@vben/plugins/vxe-table'; +import type { Recordable } from '@vben/types'; -import type { ComponentType } from "./component"; +import type { ComponentType } from './component'; -import { h } from "vue"; +import { h } from 'vue'; -import { IconifyIcon } from "@vben/icons"; -import { $te } from "@vben/locales"; -import { get, isFunction, isString } from "@vben/utils"; +import { IconifyIcon } from '@vben/icons'; +import { $te } from '@vben/locales'; +import { + setupVbenVxeTable, + useVbenVxeGrid as useGrid, +} from '@vben/plugins/vxe-table'; +import { get, isFunction, isString } from '@vben/utils'; -import { objectOmit } from "@vueuse/core"; -import { Button, Image, Popconfirm, Switch, Tag } from "ant-design-vue"; +import { objectOmit } from '@vueuse/core'; +import { Button, Image, Popconfirm, Switch, Tag } from 'ant-design-vue'; - -import { $t } from "#/locales"; +import { $t } from '#/locales'; setupVbenVxeTable({ configVxeTable: (vxeUI) => {