refactor(effects): 扩展 echarts 类型定义并优化插件配置合并逻辑
- 添加 PieSeriesOption 和 RadarSeriesOption 到 echarts 类型定义 - 添加 LegendComponentOption 和 ToolboxComponentOption 组件选项 - 重构 providePluginsOptions 函数实现深合并逻辑 - 优化 vxe-table 初始化中的表单工厂优先级处理 - 调整 playground 中的 import 语句顺序和格式pull/340/MERGE
parent
6da3017dcf
commit
87d1593a1f
|
|
@ -1,9 +1,16 @@
|
||||||
import type { BarSeriesOption, LineSeriesOption } from 'echarts/charts';
|
import type {
|
||||||
|
BarSeriesOption,
|
||||||
|
LineSeriesOption,
|
||||||
|
PieSeriesOption,
|
||||||
|
RadarSeriesOption,
|
||||||
|
} from 'echarts/charts';
|
||||||
import type {
|
import type {
|
||||||
DatasetComponentOption,
|
DatasetComponentOption,
|
||||||
GridComponentOption,
|
GridComponentOption,
|
||||||
|
LegendComponentOption,
|
||||||
TitleComponentOption,
|
TitleComponentOption,
|
||||||
TooltipComponentOption,
|
TooltipComponentOption,
|
||||||
|
ToolboxComponentOption,
|
||||||
} from 'echarts/components';
|
} from 'echarts/components';
|
||||||
import type { ComposeOption } from 'echarts/core';
|
import type { ComposeOption } from 'echarts/core';
|
||||||
|
|
||||||
|
|
@ -11,7 +18,11 @@ export type ECOption = ComposeOption<
|
||||||
| BarSeriesOption
|
| BarSeriesOption
|
||||||
| DatasetComponentOption
|
| DatasetComponentOption
|
||||||
| GridComponentOption
|
| GridComponentOption
|
||||||
|
| LegendComponentOption
|
||||||
| LineSeriesOption
|
| LineSeriesOption
|
||||||
|
| PieSeriesOption
|
||||||
|
| RadarSeriesOption
|
||||||
| TitleComponentOption
|
| TitleComponentOption
|
||||||
| TooltipComponentOption
|
| TooltipComponentOption
|
||||||
|
| ToolboxComponentOption
|
||||||
>;
|
>;
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,28 @@ import type { VbenPluginsOptions } from "./types";
|
||||||
let globalPluginsOptions: VbenPluginsOptions | null = null;
|
let globalPluginsOptions: VbenPluginsOptions | null = null;
|
||||||
|
|
||||||
export function providePluginsOptions(options: VbenPluginsOptions) {
|
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() {
|
export function injectPluginsOptions() {
|
||||||
|
|
|
||||||
|
|
@ -21,12 +21,11 @@ import {
|
||||||
VxeUI,
|
VxeUI,
|
||||||
VxeUpload
|
VxeUpload
|
||||||
} from "vxe-pc-ui";
|
} 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 zhCN from "vxe-pc-ui/lib/language/zh-CN";
|
||||||
import { VxeColgroup, VxeColumn, VxeGrid, VxeTable, VxeToolbar } from "vxe-table";
|
import { VxeColgroup, VxeColumn, VxeGrid, VxeTable, VxeToolbar } from "vxe-table";
|
||||||
|
|
||||||
import { extendsDefaultFormatter } from "./extends";
|
import { extendsDefaultFormatter } from "./extends"; // 是否加载过
|
||||||
|
|
||||||
// 是否加载过
|
// 是否加载过
|
||||||
let isInit = false;
|
let isInit = false;
|
||||||
|
|
@ -109,7 +108,7 @@ export function setupVbenVxeTable(setupOptions: SetupVxeTable) {
|
||||||
|
|
||||||
initVxeTable();
|
initVxeTable();
|
||||||
|
|
||||||
// 优先使用参数传入的 useVbenForm,context 注入在 useTableForm 中获取
|
// 优先使用参数传入的 useVbenForm,否则清空让 context 注入生效
|
||||||
if (useVbenFormFromParam) {
|
if (useVbenFormFromParam) {
|
||||||
tableFormFactory = useVbenFormFromParam;
|
tableFormFactory = useVbenFormFromParam;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,20 +1,22 @@
|
||||||
import type { VxeTableGridOptions } from "@vben/plugins/vxe-table";
|
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 { 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 { IconifyIcon } from '@vben/icons';
|
||||||
import { $te } from "@vben/locales";
|
import { $te } from '@vben/locales';
|
||||||
import { get, isFunction, isString } from "@vben/utils";
|
import {
|
||||||
|
setupVbenVxeTable,
|
||||||
|
useVbenVxeGrid as useGrid,
|
||||||
|
} from '@vben/plugins/vxe-table';
|
||||||
|
import { get, isFunction, isString } from '@vben/utils';
|
||||||
|
|
||||||
import { objectOmit } from "@vueuse/core";
|
import { objectOmit } from '@vueuse/core';
|
||||||
import { Button, Image, Popconfirm, Switch, Tag } from "ant-design-vue";
|
import { Button, Image, Popconfirm, Switch, Tag } from 'ant-design-vue';
|
||||||
|
|
||||||
|
import { $t } from '#/locales';
|
||||||
import { $t } from "#/locales";
|
|
||||||
|
|
||||||
setupVbenVxeTable({
|
setupVbenVxeTable({
|
||||||
configVxeTable: (vxeUI) => {
|
configVxeTable: (vxeUI) => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue