mirror of
https://github.com/imdap/ruoyi-plus-vben5.git
synced 2026-04-23 00:38:34 +08:00
refactor(effects): 扩展 echarts 类型定义并优化插件配置合并逻辑
- 添加 PieSeriesOption 和 RadarSeriesOption 到 echarts 类型定义 - 添加 LegendComponentOption 和 ToolboxComponentOption 组件选项 - 重构 providePluginsOptions 函数实现深合并逻辑 - 优化 vxe-table 初始化中的表单工厂优先级处理 - 调整 playground 中的 import 语句顺序和格式
This commit is contained in:
@@ -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
|
||||
>;
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user