mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-25 17:30:37 +01:00
fix(Table): override of sortButton and emptyState props
This commit is contained in:
@@ -274,6 +274,7 @@ props:
|
|||||||
color: 'primary'
|
color: 'primary'
|
||||||
variant: 'outline'
|
variant: 'outline'
|
||||||
size: '2xs'
|
size: '2xs'
|
||||||
|
square: false
|
||||||
ui:
|
ui:
|
||||||
rounded: 'rounded-full'
|
rounded: 'rounded-full'
|
||||||
excludedProps:
|
excludedProps:
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
<slot :name="`${column.key}-header`" :column="column" :sort="sort" :on-sort="onSort">
|
<slot :name="`${column.key}-header`" :column="column" :sort="sort" :on-sort="onSort">
|
||||||
<UButton
|
<UButton
|
||||||
v-if="column.sortable"
|
v-if="column.sortable"
|
||||||
v-bind="sortButton"
|
v-bind="{ ...ui.default.sortButton, ...sortButton }"
|
||||||
:icon="(!sort.column || sort.column !== column.key) ? sortButton.icon : sort.direction === 'asc' ? sortAscIcon : sortDescIcon"
|
:icon="(!sort.column || sort.column !== column.key) ? sortButton.icon : sort.direction === 'asc' ? sortAscIcon : sortDescIcon"
|
||||||
:label="column[columnAttribute]"
|
:label="column[columnAttribute]"
|
||||||
@click="onSort(column)"
|
@click="onSort(column)"
|
||||||
@@ -145,6 +145,8 @@ export default defineComponent({
|
|||||||
|
|
||||||
const indeterminate = computed(() => selected.value && selected.value.length > 0 && selected.value.length < props.rows.length)
|
const indeterminate = computed(() => selected.value && selected.value.length > 0 && selected.value.length < props.rows.length)
|
||||||
|
|
||||||
|
const emptyState = computed(() => ({ ...ui.value.default.emptyState, ...props.emptyState }))
|
||||||
|
|
||||||
function compare (a: any, z: any) {
|
function compare (a: any, z: any) {
|
||||||
if (typeof props.by === 'string') {
|
if (typeof props.by === 'string') {
|
||||||
const property = props.by as unknown as any
|
const property = props.by as unknown as any
|
||||||
@@ -180,6 +182,8 @@ export default defineComponent({
|
|||||||
rows,
|
rows,
|
||||||
selected,
|
selected,
|
||||||
indeterminate,
|
indeterminate,
|
||||||
|
// eslint-disable-next-line vue/no-dupe-keys
|
||||||
|
emptyState,
|
||||||
isSelected,
|
isSelected,
|
||||||
onSort
|
onSort
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user