From f28ef5b1252948f0fc0439433a162611ca6c31da Mon Sep 17 00:00:00 2001 From: "Vincent (Victor) Taglia" Date: Fri, 3 Nov 2023 07:45:48 -0500 Subject: [PATCH] feat(VDataTable): add 'body.prepend', 'body.append' slots (#18472) resolves #17128 Co-authored-by: Kael --- packages/vuetify/src/labs/VDataTable/VDataTable.tsx | 4 ++++ packages/vuetify/src/labs/VDataTable/VDataTableServer.tsx | 2 ++ packages/vuetify/src/labs/VDataTable/VDataTableVirtual.tsx | 6 ++++++ 3 files changed, 12 insertions(+) diff --git a/packages/vuetify/src/labs/VDataTable/VDataTable.tsx b/packages/vuetify/src/labs/VDataTable/VDataTable.tsx index 85612c529c9..b65adeb7596 100644 --- a/packages/vuetify/src/labs/VDataTable/VDataTable.tsx +++ b/packages/vuetify/src/labs/VDataTable/VDataTable.tsx @@ -62,6 +62,8 @@ export type VDataTableSlots = VDataTableRowsSlots & VDataTableHeadersSlots & { thead: VDataTableSlotProps tfoot: VDataTableSlotProps bottom: VDataTableSlotProps + 'body.prepend': VDataTableSlotProps + 'body.append': VDataTableSlotProps 'footer.prepend': never } @@ -214,6 +216,7 @@ export const VDataTable = genericComponent()({ { slots.thead?.(slotProps.value) } + { slots['body.prepend']?.(slotProps.value) } { slots.body ? slots.body(slotProps.value) : ( ()({ v-slots={ slots } /> )} + { slots['body.append']?.(slotProps.value) } { slots.tbody?.(slotProps.value) } { slots.tfoot?.(slotProps.value) } diff --git a/packages/vuetify/src/labs/VDataTable/VDataTableServer.tsx b/packages/vuetify/src/labs/VDataTable/VDataTableServer.tsx index cfb1becdc42..4aff688a4b8 100644 --- a/packages/vuetify/src/labs/VDataTable/VDataTableServer.tsx +++ b/packages/vuetify/src/labs/VDataTable/VDataTableServer.tsx @@ -157,6 +157,7 @@ export const VDataTableServer = genericComponent()({ { slots.thead?.(slotProps.value) } + { slots['body.prepend']?.(slotProps.value) } { slots.body ? slots.body(slotProps.value) : ( ()({ v-slots={ slots } /> )} + { slots['body.append']?.(slotProps.value) } { slots.tbody?.(slotProps.value) } { slots.tfoot?.(slotProps.value) } diff --git a/packages/vuetify/src/labs/VDataTable/VDataTableVirtual.tsx b/packages/vuetify/src/labs/VDataTable/VDataTableVirtual.tsx index 3e8f26c633d..df7934df47b 100644 --- a/packages/vuetify/src/labs/VDataTable/VDataTableVirtual.tsx +++ b/packages/vuetify/src/labs/VDataTable/VDataTableVirtual.tsx @@ -35,6 +35,8 @@ export type VDataTableVirtualSlots = VDataTableRowsSlots & VDataTableHeadersSlot top: VDataTableVirtualSlotProps headers: VDataTableHeadersSlots['headers'] bottom: VDataTableVirtualSlotProps + 'body.prepend': VDataTableVirtualSlotProps + 'body.append': VDataTableVirtualSlotProps item: { itemRef: Ref } @@ -178,6 +180,8 @@ export const VDataTableVirtual = genericComponent()({ + { slots['body.prepend']?.(slotProps.value) } + ()({ }} + { slots['body.append']?.(slotProps.value) } +