Skip to content

Commit 33a4d52

Browse files
authored
feat(@vben/plugins): 新增VxeGrid组件插槽类型定义 (#6452)
* feat(@vben/plugins): 新增VxeGrid组件插槽类型定义 Closes: #6451 * fix(@vben/plugins): 优化vxe-table组件的插槽类型定义 修复Omit导致的类型丢失
1 parent fee811d commit 33a4d52

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

packages/effects/plugins/src/vxe-table/use-vxe-grid.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
import type { VxeGridSlots, VxeGridSlotTypes } from 'vxe-table';
2+
3+
import type { SlotsType } from 'vue';
4+
15
import type { BaseFormComponentType } from '@vben-core/form-ui';
26

37
import type { ExtendedVxeGridApi, VxeGridProps } from './types';
@@ -9,6 +13,12 @@ import { useStore } from '@vben-core/shared/store';
913
import { VxeGridApi } from './api';
1014
import VxeGrid from './use-vxe-grid.vue';
1115

16+
type FilteredSlots<T> = {
17+
[K in keyof VxeGridSlots<T> as K extends 'form'
18+
? never
19+
: K]: VxeGridSlots<T>[K];
20+
};
21+
1222
export function useVbenVxeGrid<
1323
T extends Record<string, any> = any,
1424
D extends BaseFormComponentType = BaseFormComponentType,
@@ -31,6 +41,16 @@ export function useVbenVxeGrid<
3141
{
3242
name: 'VbenVxeGrid',
3343
inheritAttrs: false,
44+
slots: Object as SlotsType<
45+
{
46+
// 表格标题
47+
'table-title': undefined;
48+
// 工具栏左侧部分
49+
'toolbar-actions': VxeGridSlotTypes.DefaultSlotParams<T>;
50+
// 工具栏右侧部分
51+
'toolbar-tools': VxeGridSlotTypes.DefaultSlotParams<T>;
52+
} & FilteredSlots<T>
53+
>,
3454
},
3555
);
3656
// Add reactivity support

0 commit comments

Comments
 (0)