From c4d24260a7d01a37739e55bb5b78e6f88b9daedd Mon Sep 17 00:00:00 2001 From: Konrad Mohrfeldt <km@roko.li> Date: Thu, 30 May 2024 11:06:24 +0200 Subject: [PATCH] refactor: add more slots to ATable component --- src/components/generic/ATable.vue | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/components/generic/ATable.vue b/src/components/generic/ATable.vue index d6ea9b30..975ea1b5 100644 --- a/src/components/generic/ATable.vue +++ b/src/components/generic/ATable.vue @@ -2,6 +2,7 @@ <div class="aura-table-scroller"> <div ref="tableWrapperEl" class="aura-table-wrapper" v-bind="attrs"> <table class="aura-table"> + <slot name="tableStart" /> <thead> <slot name="thead"> <tr> @@ -11,13 +12,14 @@ </thead> <tbody> <slot name="body"> - <template v-if="items"> + <slot v-if="items" name="items" :items="items"> <tr v-for="(item, index) in items" :key="index"> <slot :obj="item" :index="index" /> </tr> - </template> + </slot> </slot> </tbody> + <slot name="tableEnd" /> </table> <slot name="footer"> @@ -70,10 +72,13 @@ defineOptions({ }) defineSlots<{ default(props: { obj: T; index: number }): any + items(props: { items: T[] }): any thead(): any header(): any body(): any footer(): any + tableStart(): any + tableEnd(): any }>() const attrs = useAttrs() -- GitLab