File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed
packages/vue-labs/src/components/FTable Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change 11<script setup lang="ts">
22import { computed , useTemplateRef } from " vue" ;
3+ import { assertRef } from " @fkui/logic" ;
34import { useTranslate } from " @fkui/vue" ;
5+ import { activateCell } from " ./FTable.logic" ;
46import { type FTableCellApi } from " ./f-table-api" ;
57
68const { selectable, state } = defineProps <{ selectable: " single" | " multi" ; state: boolean | " indeterminate" }>();
@@ -20,16 +22,25 @@ const ariaLabel = computed(() => {
2022 ? $t (" fkui.ftable.select-all.aria-label" , " Välj alla rader" )
2123 : $t (" fkui.ftable.unselect-all.aria-label" , " Avmarkera alla rader" );
2224});
25+ const inputRef = useTemplateRef (" input" );
2326if (selectable === " multi" ) {
24- const inputRef = useTemplateRef (" input" );
2527 expose .tabstopEl = inputRef ;
2628}
2729
30+ function onClick(e : Event ): void {
31+ if (selectable !== " multi" ) {
32+ return ;
33+ }
34+ e .stopPropagation ();
35+ assertRef (inputRef );
36+ activateCell (inputRef .value , { focus: true });
37+ emit (" toggle" );
38+ }
2839defineExpose (expose );
2940 </script >
3041
3142<template >
32- <th scope =" col" class =" table-ng__column table-ng__column--selectable" >
43+ <th scope =" col" class =" table-ng__column table-ng__column--selectable" @click = " onClick " >
3344 <input
3445 v-if =" selectable === 'multi'"
3546 ref =" input"
@@ -38,7 +49,7 @@ defineExpose(expose);
3849 type =" checkbox"
3950 :aria-label
4051 tabindex =" -1"
41- @change = " emit('toggle') "
52+ @click = " onClick "
4253 />
4354 </th >
4455</template >
You can’t perform that action at this time.
0 commit comments