Skip to content

Commit

Permalink
fix(Table): override of sortButton and emptyState props
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamincanac committed Jun 1, 2023
1 parent 71edb91 commit 192b0e6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/content/4.data/1.table.md
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ props:
color: 'primary'
variant: 'outline'
size: '2xs'
square: false
ui:
rounded: 'rounded-full'
excludedProps:
Expand Down
6 changes: 5 additions & 1 deletion src/runtime/components/data/Table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<slot :name="`${column.key}-header`" :column="column" :sort="sort" :on-sort="onSort">
<UButton
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"
:label="column[columnAttribute]"
@click="onSort(column)"
Expand Down Expand Up @@ -145,6 +145,8 @@ export default defineComponent({
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) {
if (typeof props.by === 'string') {
const property = props.by as unknown as any
Expand Down Expand Up @@ -180,6 +182,8 @@ export default defineComponent({
rows,
selected,
indeterminate,
// eslint-disable-next-line vue/no-dupe-keys
emptyState,
isSelected,
onSort
}
Expand Down

0 comments on commit 192b0e6

Please sign in to comment.