From 33a4d524db0a5a7361771d3f5a8063519f674354 Mon Sep 17 00:00:00 2001 From: RanMaoting <62940878+RanMaoting@users.noreply.github.com> Date: Thu, 3 Jul 2025 18:34:37 +0800 Subject: [PATCH] =?UTF-8?q?feat(@vben/plugins):=20=E6=96=B0=E5=A2=9EVxeGri?= =?UTF-8?q?d=E7=BB=84=E4=BB=B6=E6=8F=92=E6=A7=BD=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=20(#6452)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat(@vben/plugins): 新增VxeGrid组件插槽类型定义 Closes: #6451 * fix(@vben/plugins): 优化vxe-table组件的插槽类型定义 修复Omit导致的类型丢失 --- .../plugins/src/vxe-table/use-vxe-grid.ts | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/packages/effects/plugins/src/vxe-table/use-vxe-grid.ts b/packages/effects/plugins/src/vxe-table/use-vxe-grid.ts index e69ae35b5..6ab876934 100644 --- a/packages/effects/plugins/src/vxe-table/use-vxe-grid.ts +++ b/packages/effects/plugins/src/vxe-table/use-vxe-grid.ts @@ -1,3 +1,7 @@ +import type { VxeGridSlots, VxeGridSlotTypes } from 'vxe-table'; + +import type { SlotsType } from 'vue'; + import type { BaseFormComponentType } from '@vben-core/form-ui'; import type { ExtendedVxeGridApi, VxeGridProps } from './types'; @@ -9,6 +13,12 @@ import { useStore } from '@vben-core/shared/store'; import { VxeGridApi } from './api'; import VxeGrid from './use-vxe-grid.vue'; +type FilteredSlots = { + [K in keyof VxeGridSlots as K extends 'form' + ? never + : K]: VxeGridSlots[K]; +}; + export function useVbenVxeGrid< T extends Record = any, D extends BaseFormComponentType = BaseFormComponentType, @@ -31,6 +41,16 @@ export function useVbenVxeGrid< { name: 'VbenVxeGrid', inheritAttrs: false, + slots: Object as SlotsType< + { + // 表格标题 + 'table-title': undefined; + // 工具栏左侧部分 + 'toolbar-actions': VxeGridSlotTypes.DefaultSlotParams; + // 工具栏右侧部分 + 'toolbar-tools': VxeGridSlotTypes.DefaultSlotParams; + } & FilteredSlots + >, }, ); // Add reactivity support