This commit is contained in:
dap
2025-06-10 10:51:00 +08:00
9 changed files with 143 additions and 49 deletions

View File

@@ -1,10 +1,16 @@
import type { VxeTableGridOptions } from '@vben/plugins/vxe-table';
import type { Recordable } from '@vben/types';
import type { ComponentType } from './component';
import { h } from 'vue';
import { IconifyIcon } from '@vben/icons';
import { $te } from '@vben/locales';
import { setupVbenVxeTable, useVbenVxeGrid } from '@vben/plugins/vxe-table';
import {
setupVbenVxeTable,
useVbenVxeGrid as useGrid,
} from '@vben/plugins/vxe-table';
import { get, isFunction, isString } from '@vben/utils';
import { objectOmit } from '@vueuse/core';
@@ -42,7 +48,7 @@ setupVbenVxeTable({
round: true,
showOverflow: true,
size: 'small',
},
} as VxeTableGridOptions,
});
/**
@@ -277,7 +283,10 @@ setupVbenVxeTable({
useVbenForm,
});
export { useVbenVxeGrid };
export const useVbenVxeGrid = <T extends Record<string, any>>(
...rest: Parameters<typeof useGrid<T, ComponentType>>
) => useGrid<T, ComponentType>(...rest);
export type OnActionClickParams<T = Recordable<any>> = {
code: string;
row: T;

View File

@@ -43,7 +43,22 @@ const gridEvents: VxeGridListeners<RowType> = {
},
};
const [Grid, gridApi] = useVbenVxeGrid({ gridEvents, gridOptions });
const [Grid, gridApi] = useVbenVxeGrid<RowType>({
// 放开注释查看表单组件的类型
// formOptions: {
// schema: [
// {
// component: 'Switch',
// fieldName: 'name',
// },
// ],
// },
gridEvents,
gridOptions,
});
// 放开注释查看当前表格实例的类型
// gridApi.grid
const showBorder = gridApi.useStore((state) => state.gridOptions?.border);
const showStripe = gridApi.useStore((state) => state.gridOptions?.stripe);

View File

@@ -241,10 +241,10 @@ const schema: VbenFormSchema[] = [
component: 'Input',
dependencies: {
rules: (values) => {
return values.type === 'action' ? 'required' : null;
return values.type === 'button' ? 'required' : null;
},
show: (values) => {
return ['action', 'catalog', 'embedded', 'menu'].includes(values.type);
return ['button', 'catalog', 'embedded', 'menu'].includes(values.type);
},
triggerFields: ['type'],
},
@@ -277,7 +277,7 @@ const schema: VbenFormSchema[] = [
},
dependencies: {
show: (values) => {
return values.type !== 'action';
return values.type !== 'button';
},
triggerFields: ['type'],
},
@@ -295,7 +295,7 @@ const schema: VbenFormSchema[] = [
},
dependencies: {
show: (values) => {
return values.type !== 'action';
return values.type !== 'button';
},
triggerFields: ['type'],
},
@@ -314,7 +314,7 @@ const schema: VbenFormSchema[] = [
},
dependencies: {
show: (values) => {
return values.type !== 'action';
return values.type !== 'button';
},
triggerFields: ['type'],
},
@@ -325,7 +325,7 @@ const schema: VbenFormSchema[] = [
component: 'Divider',
dependencies: {
show: (values) => {
return !['action', 'link'].includes(values.type);
return !['button', 'link'].includes(values.type);
},
triggerFields: ['type'],
},
@@ -372,7 +372,7 @@ const schema: VbenFormSchema[] = [
component: 'Checkbox',
dependencies: {
show: (values) => {
return !['action'].includes(values.type);
return !['button'].includes(values.type);
},
triggerFields: ['type'],
},
@@ -402,7 +402,7 @@ const schema: VbenFormSchema[] = [
component: 'Checkbox',
dependencies: {
show: (values) => {
return !['action', 'link'].includes(values.type);
return !['button', 'link'].includes(values.type);
},
triggerFields: ['type'],
},
@@ -417,7 +417,7 @@ const schema: VbenFormSchema[] = [
component: 'Checkbox',
dependencies: {
show: (values) => {
return !['action', 'link'].includes(values.type);
return !['button', 'link'].includes(values.type);
},
triggerFields: ['type'],
},