Skip to content

Commit

Permalink
feat(data-table): add no-data slot
Browse files Browse the repository at this point in the history
  • Loading branch information
m0ksem committed May 22, 2024
1 parent 13f786b commit 4fc7833
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 4 deletions.
31 changes: 31 additions & 0 deletions packages/ui/src/components/va-data-table/VaDataTable.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,3 +197,34 @@ export const ExpandableRow = () => ({
</VaDataTable>
`,
})

export const NoDataText = () => ({
components: { VaDataTable, VaPagination },
data: () => ({ columns, items }),

template: `
<VaDataTable :items="[]" :columns="columns" no-data-html="Test no data" />
`,
})

export const NoDataTextSlot = () => ({
components: { VaDataTable, VaPagination },
data: () => ({ columns, items }),

template: `
<VaDataTable :items="[]" :columns="columns">
<template #no-data>
<div class="text-center">No data Test</div>
</template>
</VaDataTable>
`,
})

export const NoFilteredDataText = () => ({
components: { VaDataTable, VaPagination },
data: () => ({ columns, items }),

template: `
<VaDataTable :items="[]" :columns="columns" filter="Aaa" no-data-filtered-html="Test no filtered data" />
`,
})
16 changes: 12 additions & 4 deletions packages/ui/src/components/va-data-table/VaDataTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,11 @@
<td
class="va-data-table__table-td no-data"
colspan="99999"
v-html="noDataHtml"
/>
>
<slot name="no-data">
<div v-html="noDataHtml" />
</slot>
</td>
</tr>

<tr
Expand All @@ -88,8 +91,13 @@
<td
class="va-data-table__table-td no-data"
colspan="99999"
v-html="noDataFilteredHtml"
/>
>
<slot name="no-filtered-data">
<slot name="no-data">
<div v-html="noDataFilteredHtml" />
</slot>
</slot>
</td>
</tr>

<template
Expand Down

0 comments on commit 4fc7833

Please sign in to comment.