@@ -8,7 +8,6 @@ import type { DeepPartial } from '~/types'
8
8
interface Sort { column? : string ; direction? : ' asc' | ' desc' }
9
9
10
10
const props = withDefaults (defineProps <{
11
- modelValue? : any []
12
11
sortBy? : string | ((a : unknown , b : unknown ) => void )
13
12
rows? : { [key : string ]: any }[]
14
13
columns? : { key: string ; sortable? : boolean ; class? : string ; [key : string ]: any }[]
@@ -30,7 +29,7 @@ const props = withDefaults(defineProps<{
30
29
emptyState : () => useAppUi ().table .default .emptyState ,
31
30
ui : () => useAppUi ().table ,
32
31
})
33
- const selected = defineModel <any []>({ default: [] } )
32
+ const selected = defineModel <any []>()
34
33
35
34
const sort = ref <Sort >(merge ({}, { column: null , direction: ' asc' }, props .sort ))
36
35
@@ -70,7 +69,7 @@ function onSort(column: { key: string; direction?: 'asc' | 'desc' }) {
70
69
<table :class =" [config.base, config.divide]" >
71
70
<thead :class =" config.thead" >
72
71
<tr :class =" config.tr.base" >
73
- <th v-if =" modelValue " scope =" col" class =" pl-4" >
72
+ <th v-if =" selected " scope =" col" class =" pl-4" >
74
73
<UCheckbox :is-checked =" isIndeterminate || selected?.length === rows.length" :is-indeterminate =" isIndeterminate" @change =" selected = $event.target.checked ? rows : []" />
75
74
</th >
76
75
<th v-for =" (column, index) in columns" :key =" index" scope =" col" :class =" [config.th.base, config.th.padding, config.th.color, config.th.font, config.th.size, column.class]" >
@@ -95,7 +94,7 @@ function onSort(column: { key: string; direction?: 'asc' | 'desc' }) {
95
94
</thead >
96
95
<tbody :class =" config.tbody" >
97
96
<tr v-for =" (row, index) in rows" :key =" index" :class =" [config.tr.base, isSelected(row) && config.tr.selected]" >
98
- <td v-if =" modelValue " class =" pl-4" >
97
+ <td v-if =" selected " class =" pl-4" >
99
98
<UCheckbox v-model =" selected" :value =" row" />
100
99
</td >
101
100
<td v-for =" (column, subIndex) in columns" :key =" subIndex" :class =" [config.td.base, config.td.padding, config.td.color, config.td.font, config.td.size]" >
0 commit comments