@soft-stech/bootsman-ui-shadcn 2.0.15 → 2.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{BuiTableHeader.vue_vue_type_script_setup_true_lang-B6wyr0bg.js → BuiTableHeader.vue_vue_type_script_setup_true_lang-BwsxaQdP.js} +12 -13
- package/dist/components/table/BuiTableHeader.js +1 -1
- package/dist/components/table/index.js +422 -416
- package/dist/index.js +1 -1
- package/dist/lib/useResizeColumns.d.ts +1 -1
- package/dist/lib/useResizeColumns.js +42 -43
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/table/BuiDataTable.vue +58 -49
- package/src/components/table/BuiTableHeader.vue +3 -4
- package/src/lib/useResizeColumns.ts +1 -9
- package/src/stories/components/BuiDataTableStory.vue +3 -2
|
@@ -393,6 +393,12 @@ const handleHeaderCellSorting = (header: Header<TData, unknown>) => {
|
|
|
393
393
|
header.column.toggleSorting(header.column.getIsSorted() === 'asc')
|
|
394
394
|
}
|
|
395
395
|
}
|
|
396
|
+
|
|
397
|
+
const handleHeaderCellMouseDown = (e: Event) => {
|
|
398
|
+
const targetHTMLElement = e.target as HTMLElement
|
|
399
|
+
isMouseDownOnHandler.value =
|
|
400
|
+
targetHTMLElement.className.includes && targetHTMLElement.className.includes('resize-handler')
|
|
401
|
+
}
|
|
396
402
|
</script>
|
|
397
403
|
|
|
398
404
|
<template>
|
|
@@ -450,55 +456,58 @@ const handleHeaderCellSorting = (header: Header<TData, unknown>) => {
|
|
|
450
456
|
</BuiPopover>
|
|
451
457
|
</template>
|
|
452
458
|
<BuiTableHeader v-if="tableHeaders" :freeze-header="props.freezeHeader" ref="tableHeaderRef">
|
|
453
|
-
<
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
459
|
+
<BuiTableRow class="border-0">
|
|
460
|
+
<BuiTableHead
|
|
461
|
+
v-for="(header, index) in tableHeaders"
|
|
462
|
+
:key="header.id"
|
|
463
|
+
:id="`${header.id}_cell`"
|
|
464
|
+
:style="{
|
|
465
|
+
...getPinningStyle(header.column),
|
|
466
|
+
cursor: getHeaderCellSortingButton(header) ? 'pointer' : 'auto'
|
|
467
|
+
}"
|
|
468
|
+
:freeze-header="props.freezeHeader"
|
|
469
|
+
:can-resize="header.column.getCanResize() ? true : undefined"
|
|
470
|
+
@click="handleHeaderCellSorting(header)"
|
|
471
|
+
@mousedown="handleHeaderCellMouseDown"
|
|
472
|
+
>
|
|
473
|
+
<FlexRender
|
|
474
|
+
v-if="!header.isPlaceholder"
|
|
475
|
+
:render="header.column.columnDef.header"
|
|
476
|
+
:props="header.getContext()"
|
|
477
|
+
/>
|
|
478
|
+
<div
|
|
479
|
+
v-if="
|
|
480
|
+
enableColumnResizing &&
|
|
481
|
+
index < tableHeaders.length - 1 &&
|
|
482
|
+
header.column.getCanResize()
|
|
483
|
+
"
|
|
484
|
+
@dblclick="resetCells"
|
|
485
|
+
@mousedown.self="handleResizeControlMouseDown(header.id, props.enableColumnResizing)"
|
|
486
|
+
@click.stop
|
|
487
|
+
:className="
|
|
488
|
+
cn(
|
|
489
|
+
'resize-handler absolute top-0 right-0 h-full w-1 bg-muted-foreground opacity-0 cursor-col-resize select-none touch-none hover:opacity-50',
|
|
490
|
+
isResizing && resizingCellId === header.id ? 'bg-primary opacity-50' : ''
|
|
491
|
+
)
|
|
492
|
+
"
|
|
493
|
+
/>
|
|
494
|
+
<template #actions>
|
|
495
|
+
<BuiContextMenuContent v-if="availableHeaderCellActions(header).length > 0">
|
|
496
|
+
<BuiContextMenuItem
|
|
497
|
+
v-for="(action, idx) in availableHeaderCellActions(header)"
|
|
498
|
+
@click="onHeaderCellAction(header, action)"
|
|
499
|
+
:key="idx"
|
|
500
|
+
>
|
|
501
|
+
{{
|
|
502
|
+
headerContextMenuTranslations && headerContextMenuTranslations[action]
|
|
503
|
+
? headerContextMenuTranslations[action]
|
|
504
|
+
: defaultColumnContextMenuTranslations[action]
|
|
505
|
+
}}
|
|
506
|
+
</BuiContextMenuItem>
|
|
507
|
+
</BuiContextMenuContent>
|
|
508
|
+
</template>
|
|
509
|
+
</BuiTableHead>
|
|
510
|
+
</BuiTableRow>
|
|
502
511
|
</BuiTableHeader>
|
|
503
512
|
<BuiTableBody>
|
|
504
513
|
<template v-if="table.getRowModel().rows?.length">
|
|
@@ -20,12 +20,11 @@ const props = defineProps<{
|
|
|
20
20
|
props.class,
|
|
21
21
|
props.freezeHeader
|
|
22
22
|
? 'sticky top-0 z-1 [&_th:first-child>div>div]:pl-3 [&_th:last-child>div>div]:border-r-0 [&_th:last-child>div>div]:pr-14 [&_tr:last-child]:border-b-0'
|
|
23
|
-
: '[&_th:first-child>div]:pl-3 [&_th:last-child>div]:border-0 [&_th:last-child>div]:pr-14'
|
|
23
|
+
: '[&_th:first-child>div]:pl-3 [&_th:last-child>div]:border-0 [&_th:last-child>div]:pr-14',
|
|
24
|
+
'[&>tr]:h-10'
|
|
24
25
|
)
|
|
25
26
|
"
|
|
26
27
|
>
|
|
27
|
-
<
|
|
28
|
-
<slot />
|
|
29
|
-
</tr>
|
|
28
|
+
<slot />
|
|
30
29
|
</thead>
|
|
31
30
|
</template>
|
|
@@ -59,15 +59,7 @@ export function useResizeColumns() {
|
|
|
59
59
|
const isMouseDownOnHandler = ref<boolean>(false)
|
|
60
60
|
const isMouseUpOnHandler = ref<boolean>(false)
|
|
61
61
|
|
|
62
|
-
const handleResizeControlMouseDown = (
|
|
63
|
-
e: Event,
|
|
64
|
-
cellId: string,
|
|
65
|
-
enableColumnResizing: boolean
|
|
66
|
-
) => {
|
|
67
|
-
const targetHTMLElement = e.target as HTMLElement
|
|
68
|
-
isMouseDownOnHandler.value =
|
|
69
|
-
targetHTMLElement.className.includes && targetHTMLElement.className.includes('resize-handler')
|
|
70
|
-
|
|
62
|
+
const handleResizeControlMouseDown = (cellId: string, enableColumnResizing: boolean) => {
|
|
71
63
|
if (!enableColumnResizing) return
|
|
72
64
|
|
|
73
65
|
isResizing.value = true
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
SignalMediumIcon,
|
|
19
19
|
SignalLowIcon
|
|
20
20
|
} from 'lucide-vue-next'
|
|
21
|
-
import { computed, h, ref } from 'vue'
|
|
21
|
+
import { computed, h, ref, withModifiers } from 'vue'
|
|
22
22
|
import { z } from 'zod'
|
|
23
23
|
import tasks from '@/stories/data/tasks.json'
|
|
24
24
|
import { BuiCheckbox } from '@/components/checkbox'
|
|
@@ -51,7 +51,8 @@ const columns: ColumnDef<Task>[] = [
|
|
|
51
51
|
table.getIsSomePageRowsSelected()
|
|
52
52
|
? table.toggleAllPageRowsSelected(false)
|
|
53
53
|
: table.toggleAllPageRowsSelected(!!value),
|
|
54
|
-
ariaLabel: 'Select row'
|
|
54
|
+
ariaLabel: 'Select row',
|
|
55
|
+
onClick: withModifiers(() => {}, ['stop'])
|
|
55
56
|
}),
|
|
56
57
|
tableColumnSortCommon(column, 'ID')
|
|
57
58
|
])
|