@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.
@@ -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
- <BuiTableHead
454
- v-for="(header, index) in tableHeaders"
455
- :key="header.id"
456
- :id="`${header.id}_cell`"
457
- :style="{
458
- ...getPinningStyle(header.column),
459
- cursor: getHeaderCellSortingButton(header) ? 'pointer' : 'auto'
460
- }"
461
- :freeze-header="props.freezeHeader"
462
- :can-resize="header.column.getCanResize() ? true : undefined"
463
- @click="handleHeaderCellSorting(header)"
464
- >
465
- <FlexRender
466
- v-if="!header.isPlaceholder"
467
- :render="header.column.columnDef.header"
468
- :props="header.getContext()"
469
- />
470
- <div
471
- v-if="
472
- enableColumnResizing && index < tableHeaders.length - 1 && header.column.getCanResize()
473
- "
474
- @dblclick="resetCells"
475
- @mousedown.self="
476
- (e: Event) => handleResizeControlMouseDown(e, header.id, props.enableColumnResizing)
477
- "
478
- @click.stop
479
- :className="
480
- cn(
481
- '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',
482
- isResizing && resizingCellId === header.id ? 'bg-primary opacity-50' : ''
483
- )
484
- "
485
- />
486
- <template #actions>
487
- <BuiContextMenuContent v-if="availableHeaderCellActions(header).length > 0">
488
- <BuiContextMenuItem
489
- v-for="(action, idx) in availableHeaderCellActions(header)"
490
- @click="onHeaderCellAction(header, action)"
491
- :key="idx"
492
- >
493
- {{
494
- headerContextMenuTranslations && headerContextMenuTranslations[action]
495
- ? headerContextMenuTranslations[action]
496
- : defaultColumnContextMenuTranslations[action]
497
- }}
498
- </BuiContextMenuItem>
499
- </BuiContextMenuContent>
500
- </template>
501
- </BuiTableHead>
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
- <tr class="h-10">
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
  ])