Skip to content

Commit 9b34fc2

Browse files
committed
feat(table)!: no results prop & slot is renamed to no data
1 parent c7c084e commit 9b34fc2

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

packages/anu-vue/src/components/table/ATable.tsx

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ const tableProps = {
6868
/**
6969
* Text to render when no row is available
7070
*/
71-
noResultsText: {
71+
noDataText: {
7272
type: String,
7373
default: 'No matching results found!!',
7474
},
@@ -348,17 +348,16 @@ export const ATable = defineComponent({
348348
})
349349

350350
return () => {
351-
// TODO: There should be no data as well and it should be rendered only when data is filtered and there's no resulting rows
352-
// 👉 No results
353-
const noResultsTr = <tr>
351+
// 👉 No Data
352+
const noDataTr = <tr>
354353
<td
355354
class="em:px-[1.15rem] em:h-14 whitespace-nowrap text-center font-medium"
356355
colspan={_columns.value.length}
357356
>
358-
{slots.noResults
359-
? slots.noResults()
357+
{slots['no-data']
358+
? slots['no-data']()
360359
: <span>
361-
{props.noResultsText}
360+
{props.noDataText}
362361
</span>}
363362
</td>
364363
</tr>
@@ -368,8 +367,6 @@ export const ATable = defineComponent({
368367
text via default text just above the table
369368
370369
Later on, we will merge both default slots and will pass as single slot content to card
371-
372-
TODO(refactor): Use variant group here
373370
*/
374371
const table = <div class="overflow-x-auto">
375372
<table class="a-table-table overflow-x-auto w-full max-w-full">
@@ -432,7 +429,7 @@ export const ATable = defineComponent({
432429
}
433430
</tr>
434431
})
435-
: noResultsTr
432+
: noDataTr
436433
}
437434
</tbody>
438435
</table>

0 commit comments

Comments
 (0)