Line data Source code
1 16 : <template>
2 : <TableHead :class="className" :aria-sort="direction ?? 'none'">
3 : <Button variant="link" size="link" @click="toggle">
4 : <slot />
5 : <i
6 : v-if="direction"
7 : :class="
8 : direction === 'ascending'
9 : ? 'icon-[lucide--arrow-up]'
10 : : 'icon-[lucide--arrow-down]'
11 : "
12 : aria-hidden="true"
13 : />
14 : </Button>
15 : </TableHead>
16 : </template>
17 :
18 : <script setup lang="ts">
19 : import type { HTMLAttributes } from 'vue'
20 :
21 : import Button from '@comfyorg/design-system/button/Button'
22 :
23 : import TableHead from './TableHead.vue'
24 : import type { TableSortDirection } from './tableUtils'
25 :
26 : const { class: className } = defineProps<{ class?: HTMLAttributes['class'] }>()
27 :
28 48 : const direction = defineModel<TableSortDirection | null>('direction', {
29 : default: null
30 : })
31 :
32 0 : function toggle() {
33 0 : direction.value = direction.value === 'ascending' ? 'descending' : 'ascending'
34 : }
35 : </script>
|