feat(Table): add style to table and column meta (#4513)

Co-authored-by: Benjamin Canac <canacb1@gmail.com>
This commit is contained in:
J-Michalek
2025-07-14 10:56:28 +02:00
committed by GitHub
parent 6f2ce5c610
commit 1db21d1b00
5 changed files with 565 additions and 4 deletions

View File

@@ -165,6 +165,8 @@ describe('Table', () => {
['with loading', { props: { ...props, loading: true } }],
...loadingColors.map((loadingColor: string) => [`with loading color ${loadingColor}`, { props: { ...props, loading: true, loadingColor } }]),
...loadingAnimations.map((loadingAnimation: string) => [`with loading animation ${loadingAnimation}`, { props: { ...props, loading: true, loadingAnimation } }]),
['with meta prop', { props: { ...props, meta: { class: { tr: 'custom-row-class' }, style: { tr: { backgroundColor: 'lightgray' } } } } }],
['with meta field on columns', { props: { ...props, columns: columns.map(c => ({ ...c, meta: { class: { th: 'custom-heading-class', td: 'custom-cell-class' }, style: { th: { backgroundColor: 'black' }, td: { backgroundColor: 'lightgray' } } } })) } }],
['with as', { props: { ...props, as: 'section' } }],
['with class', { props: { ...props, class: 'absolute' } }],
['with ui', { props: { ...props, ui: { base: 'table-auto' } } }],
@@ -194,10 +196,10 @@ describe('Table', () => {
},
...(filter.value === 2
? [
{
accessorKey: 'amount',
header: () => h('div', { ['data-test-th']: 'amount' }, 'Amount')
} satisfies TableColumn<typeof data[number]>
{
accessorKey: 'amount',
header: () => h('div', { ['data-test-th']: 'amount' }, 'Amount')
} satisfies TableColumn<typeof data[number]>
]
: [])
])