@kumix/ui 0.4.0 → 0.4.1
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/README.md +15 -15
- package/dist/components/agents/approval-card/index.d.ts +2 -0
- package/dist/components/agents/approval-card/index.d.ts.map +1 -1
- package/dist/components/agents/approval-card/index.js +2 -0
- package/dist/components/agents/approval-card/index.js.map +1 -1
- package/dist/components/agents/citations.d.ts +14 -2
- package/dist/components/agents/citations.d.ts.map +1 -1
- package/dist/components/agents/citations.js +11 -7
- package/dist/components/agents/citations.js.map +1 -1
- package/dist/components/agents/loading-states/reasoning-text.d.ts.map +1 -1
- package/dist/components/agents/loading-states/reasoning-text.js +3 -0
- package/dist/components/agents/loading-states/reasoning-text.js.map +1 -1
- package/dist/components/charts/bump-chart/context.js +1 -2
- package/dist/components/charts/bump-chart/plot.js +1 -2
- package/dist/components/charts/bump-chart/point.js +1 -1
- package/dist/components/charts/bump-chart/series.d.ts +1 -0
- package/dist/components/charts/candlestick-chart/context.d.ts +79 -0
- package/dist/components/charts/candlestick-chart/context.d.ts.map +1 -0
- package/dist/components/charts/candlestick-chart/context.js +69 -0
- package/dist/components/charts/candlestick-chart/context.js.map +1 -0
- package/dist/components/charts/candlestick-chart/legend.d.ts +12 -0
- package/dist/components/charts/candlestick-chart/legend.d.ts.map +1 -0
- package/dist/components/charts/candlestick-chart/legend.js +56 -0
- package/dist/components/charts/candlestick-chart/legend.js.map +1 -0
- package/dist/components/charts/candlestick-chart/plot.d.ts +9 -0
- package/dist/components/charts/candlestick-chart/plot.d.ts.map +1 -0
- package/dist/components/charts/candlestick-chart/plot.js +218 -0
- package/dist/components/charts/candlestick-chart/plot.js.map +1 -0
- package/dist/components/charts/candlestick-chart.d.ts +18 -0
- package/dist/components/charts/candlestick-chart.d.ts.map +1 -0
- package/dist/components/charts/candlestick-chart.js +34 -0
- package/dist/components/charts/candlestick-chart.js.map +1 -0
- package/dist/components/charts/composition-chart/context.js +1 -2
- package/dist/components/charts/composition-chart/plot.js +1 -1
- package/dist/components/charts/donut-chart/center.d.ts +16 -0
- package/dist/components/charts/donut-chart/center.d.ts.map +1 -0
- package/dist/components/charts/donut-chart/center.js +78 -0
- package/dist/components/charts/donut-chart/center.js.map +1 -0
- package/dist/components/charts/donut-chart/context.d.ts +68 -0
- package/dist/components/charts/donut-chart/context.d.ts.map +1 -0
- package/dist/components/charts/donut-chart/context.js +2 -0
- package/dist/components/charts/donut-chart/legend.d.ts +17 -0
- package/dist/components/charts/donut-chart/legend.d.ts.map +1 -0
- package/dist/components/charts/donut-chart/legend.js +85 -0
- package/dist/components/charts/donut-chart/legend.js.map +1 -0
- package/dist/components/charts/donut-chart/plot.d.ts +10 -0
- package/dist/components/charts/donut-chart/plot.d.ts.map +1 -0
- package/dist/components/charts/donut-chart/plot.js +108 -0
- package/dist/components/charts/donut-chart/plot.js.map +1 -0
- package/dist/components/charts/donut-chart.d.ts +22 -0
- package/dist/components/charts/donut-chart.d.ts.map +1 -0
- package/dist/components/charts/donut-chart.js +37 -0
- package/dist/components/charts/donut-chart.js.map +1 -0
- package/dist/components/charts/funnel-chart.d.ts.map +1 -1
- package/dist/components/charts/funnel-chart.js +1 -2
- package/dist/components/charts/funnel-chart.js.map +1 -1
- package/dist/components/charts/heat-calendar/tooltip.js +1 -1
- package/dist/components/charts/liquidity-heatmap.js +1 -1
- package/dist/components/charts/order-book/depth-row.d.ts +8 -2
- package/dist/components/charts/order-book/depth-row.d.ts.map +1 -1
- package/dist/components/charts/order-book/depth-row.js +11 -3
- package/dist/components/charts/order-book/depth-row.js.map +1 -1
- package/dist/components/charts/order-book.d.ts +33 -1
- package/dist/components/charts/order-book.d.ts.map +1 -1
- package/dist/components/charts/order-book.js +92 -17
- package/dist/components/charts/order-book.js.map +1 -1
- package/dist/components/charts/price-target-fan/tooltip.js +1 -1
- package/dist/components/charts/returns-calendar/tooltip.js +1 -1
- package/dist/components/charts/status-bar/tooltip.js +1 -1
- package/dist/components/charts/treemap/tooltip.js +1 -1
- package/dist/components/charts/volume-profile/tooltip.js +1 -1
- package/dist/components/custom/confirm-dialog.d.ts +1 -0
- package/dist/components/custom/toast.d.ts +1 -0
- package/dist/components/motion/action-swap.d.ts.map +1 -1
- package/dist/components/motion/action-swap.js +3 -0
- package/dist/components/motion/action-swap.js.map +1 -1
- package/dist/components/motion/animated-sidebar.d.ts +1 -0
- package/dist/components/motion/attachment-upload.d.ts.map +1 -1
- package/dist/components/motion/attachment-upload.js +1 -2
- package/dist/components/motion/attachment-upload.js.map +1 -1
- package/dist/components/motion/availability-scheduler/copy-menu.js +1 -2
- package/dist/components/motion/availability-scheduler/day-row.js +2 -2
- package/dist/components/motion/availability-scheduler/index.js +1 -1
- package/dist/components/motion/bloom-menu.d.ts +1 -0
- package/dist/components/motion/bounce-sidebar.d.ts.map +1 -1
- package/dist/components/motion/bounce-sidebar.js +34 -42
- package/dist/components/motion/bounce-sidebar.js.map +1 -1
- package/dist/components/motion/button/stateful.d.ts.map +1 -1
- package/dist/components/motion/button/stateful.js +3 -0
- package/dist/components/motion/button/stateful.js.map +1 -1
- package/dist/components/motion/card.d.ts +44 -0
- package/dist/components/motion/card.d.ts.map +1 -0
- package/dist/components/motion/card.js +122 -0
- package/dist/components/motion/card.js.map +1 -0
- package/dist/components/motion/checkbox.d.ts +3 -1
- package/dist/components/motion/checkbox.d.ts.map +1 -1
- package/dist/components/motion/checkbox.js +18 -6
- package/dist/components/motion/checkbox.js.map +1 -1
- package/dist/components/motion/color-picker.d.ts +110 -0
- package/dist/components/motion/color-picker.d.ts.map +1 -0
- package/dist/components/motion/color-picker.js +1053 -0
- package/dist/components/motion/color-picker.js.map +1 -0
- package/dist/components/motion/color-selector.d.ts.map +1 -1
- package/dist/components/motion/color-selector.js +9 -2
- package/dist/components/motion/color-selector.js.map +1 -1
- package/dist/components/motion/combobox/content.d.ts +1 -0
- package/dist/components/motion/command-palette.js +2 -2
- package/dist/components/motion/command-palette.js.map +1 -1
- package/dist/components/motion/context-menu.d.ts +1 -0
- package/dist/components/motion/digit-swap.d.ts +9 -1
- package/dist/components/motion/digit-swap.d.ts.map +1 -1
- package/dist/components/motion/digit-swap.js +18 -7
- package/dist/components/motion/digit-swap.js.map +1 -1
- package/dist/components/motion/expandable-control.d.ts +1 -0
- package/dist/components/motion/knockout-wheel.d.ts.map +1 -1
- package/dist/components/motion/knockout-wheel.js +1 -2
- package/dist/components/motion/knockout-wheel.js.map +1 -1
- package/dist/components/motion/morphing-search-chips.d.ts +54 -0
- package/dist/components/motion/morphing-search-chips.d.ts.map +1 -0
- package/dist/components/motion/morphing-search-chips.js +599 -0
- package/dist/components/motion/morphing-search-chips.js.map +1 -0
- package/dist/components/motion/multi-select/content.d.ts +1 -0
- package/dist/components/motion/not-found/shared.d.ts +1 -0
- package/dist/components/motion/number-ticker.d.ts +6 -1
- package/dist/components/motion/number-ticker.d.ts.map +1 -1
- package/dist/components/motion/number-ticker.js +19 -9
- package/dist/components/motion/number-ticker.js.map +1 -1
- package/dist/components/motion/parallax.js.map +1 -1
- package/dist/components/motion/popover-morph.d.ts +1 -0
- package/dist/components/motion/popover-morph.js +3 -0
- package/dist/components/motion/popover-morph.js.map +1 -1
- package/dist/components/motion/popover.d.ts +1 -0
- package/dist/components/motion/prediction-market-card.js +2 -3
- package/dist/components/motion/prediction-market-card.js.map +1 -1
- package/dist/components/motion/radio.d.ts +3 -1
- package/dist/components/motion/radio.d.ts.map +1 -1
- package/dist/components/motion/radio.js +17 -5
- package/dist/components/motion/radio.js.map +1 -1
- package/dist/components/motion/scroll-progress.d.ts +1 -0
- package/dist/components/motion/shader-background.d.ts +1 -0
- package/dist/components/motion/sortable-list.d.ts +1 -0
- package/dist/components/motion/sortable-stack.js +1 -2
- package/dist/components/motion/tabs.d.ts +1 -0
- package/dist/components/motion/text-reveal.d.ts +1 -0
- package/dist/components/motion/tooltip/positioner.d.ts +8 -26
- package/dist/components/motion/tooltip/positioner.d.ts.map +1 -1
- package/dist/components/motion/tooltip/positioner.js +1 -2
- package/dist/components/motion/tooltip.d.ts +62 -20
- package/dist/components/motion/tooltip.d.ts.map +1 -1
- package/dist/components/motion/tooltip.js +1 -135
- package/dist/components/motion/wallet-card/account-avatar.js +1 -2
- package/dist/components/reui/alert.d.ts +1 -1
- package/dist/components/reui/autocomplete.d.ts +1 -1
- package/dist/components/reui/autocomplete.d.ts.map +1 -1
- package/dist/components/reui/autocomplete.js.map +1 -1
- package/dist/components/reui/badge.d.ts +2 -2
- package/dist/components/reui/color-picker.d.ts +280 -0
- package/dist/components/reui/color-picker.d.ts.map +1 -0
- package/dist/components/reui/color-picker.js +2013 -0
- package/dist/components/reui/color-picker.js.map +1 -0
- package/dist/components/reui/data-grid/data-grid-cell-selection.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-column-header.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-column-header.js +43 -21
- package/dist/components/reui/data-grid/data-grid-column-header.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-pagination.js +1 -1
- package/dist/components/reui/data-grid/data-grid-scroll-area.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-scroll-area.js +9 -3
- package/dist/components/reui/data-grid/data-grid-scroll-area.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-dnd-rows.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-dnd-rows.js +12 -8
- package/dist/components/reui/data-grid/data-grid-table-dnd-rows.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-dnd.d.ts +1 -1
- package/dist/components/reui/data-grid/data-grid-table-dnd.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-dnd.js +52 -13
- package/dist/components/reui/data-grid/data-grid-table-dnd.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-virtual.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-virtual.js +35 -41
- package/dist/components/reui/data-grid/data-grid-table-virtual.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table.d.ts +168 -5
- package/dist/components/reui/data-grid/data-grid-table.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table.js +203 -69
- package/dist/components/reui/data-grid/data-grid-table.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid.d.ts +39 -0
- package/dist/components/reui/data-grid/data-grid.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid.js +33 -1
- package/dist/components/reui/data-grid/data-grid.js.map +1 -1
- package/dist/components/reui/date-selector.d.ts +1 -0
- package/dist/components/reui/date-selector.js +1 -1
- package/dist/components/reui/emoji-picker.d.ts +367 -0
- package/dist/components/reui/emoji-picker.d.ts.map +1 -0
- package/dist/components/reui/emoji-picker.js +1768 -0
- package/dist/components/reui/emoji-picker.js.map +1 -0
- package/dist/components/reui/event-calendar/event-calendar-i18n.d.ts.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-nav.js +2 -2
- package/dist/components/reui/file-type.d.ts +496 -0
- package/dist/components/reui/file-type.d.ts.map +1 -0
- package/dist/components/reui/file-type.js +964 -0
- package/dist/components/reui/file-type.js.map +1 -0
- package/dist/components/reui/filters/filters-advanced.d.ts +1 -0
- package/dist/components/reui/filters/filters-advanced.js +1 -1
- package/dist/components/reui/filters/filters-advanced.js.map +1 -1
- package/dist/components/reui/filters/filters-chip.d.ts +5 -1
- package/dist/components/reui/filters/filters-chip.d.ts.map +1 -1
- package/dist/components/reui/filters/filters-chip.js +1 -1
- package/dist/components/reui/filters/filters-lib.d.ts.map +1 -1
- package/dist/components/reui/frame.d.ts +1 -1
- package/dist/components/reui/frame.d.ts.map +1 -1
- package/dist/components/reui/frame.js.map +1 -1
- package/dist/components/reui/gantt/gantt-nav.js +2 -2
- package/dist/components/reui/icon-tile.d.ts +2 -2
- package/dist/components/reui/icon-tile.js +8 -7
- package/dist/components/reui/icon-tile.js.map +1 -1
- package/dist/components/reui/kanban.d.ts.map +1 -1
- package/dist/components/reui/kanban.js +1 -1
- package/dist/components/reui/kanban.js.map +1 -1
- package/dist/components/reui/number-field.d.ts +3 -3
- package/dist/components/reui/number-field.d.ts.map +1 -1
- package/dist/components/reui/number-field.js.map +1 -1
- package/dist/components/reui/rating.d.ts +1 -1
- package/dist/components/reui/scrollspy.d.ts +1 -0
- package/dist/components/reui/time-picker.js.map +1 -1
- package/dist/components/ui/attachment.d.ts +3 -3
- package/dist/components/ui/badge.d.ts +1 -1
- package/dist/components/ui/bubble.d.ts +1 -1
- package/dist/components/ui/button-group.d.ts +1 -1
- package/dist/components/ui/button.d.ts +2 -2
- package/dist/components/ui/command.d.ts.map +1 -1
- package/dist/components/ui/direction.js +1 -2
- package/dist/components/ui/empty.d.ts +1 -1
- package/dist/components/ui/field.d.ts +1 -1
- package/dist/components/ui/field.js +1 -1
- package/dist/components/ui/input-group.d.ts +1 -1
- package/dist/components/ui/item.d.ts +2 -2
- package/dist/components/ui/marker.d.ts +1 -1
- package/dist/components/ui/message-scroller.d.ts.map +1 -1
- package/dist/components/ui/questionnaire.d.ts.map +1 -1
- package/dist/components/ui/sidebar.d.ts +1 -1
- package/dist/components/ui/sidebar.js +1 -1
- package/dist/components/ui/toggle.d.ts +1 -1
- package/dist/context-tTdLKYNf.js +99 -0
- package/dist/context-tTdLKYNf.js.map +1 -0
- package/dist/{copy-menu-C5GaT4Z-.js → copy-menu-BXUh52bu.js} +2 -2
- package/dist/{copy-menu-C5GaT4Z-.js.map → copy-menu-BXUh52bu.js.map} +1 -1
- package/dist/hooks/use-copy-to-clipboard.d.ts +1 -0
- package/dist/hooks/use-hover-gesture.d.ts +1 -0
- package/dist/hooks/use-intersection-observer.d.ts +1 -0
- package/dist/hooks/use-scroll-position.d.ts +1 -0
- package/dist/hooks/use-slider-input.d.ts +1 -0
- package/dist/hooks/use-viewport.d.ts +1 -0
- package/dist/lib/tick-sound.d.ts +1 -0
- package/dist/model-NSIg2p7a.d.ts +20 -0
- package/dist/model-NSIg2p7a.d.ts.map +1 -0
- package/dist/model-_mRyI6V9.d.ts +18 -0
- package/dist/model-_mRyI6V9.d.ts.map +1 -0
- package/dist/{positioner-3mCqiebN.js → positioner-3r3cfkqT.js} +97 -33
- package/dist/positioner-3r3cfkqT.js.map +1 -0
- package/dist/tooltip-Bam5KeYe.js +535 -0
- package/dist/tooltip-Bam5KeYe.js.map +1 -0
- package/dist/use-position-DOi1gVL0.d.ts +32 -0
- package/dist/use-position-DOi1gVL0.d.ts.map +1 -0
- package/package.json +8 -8
- package/dist/components/motion/tooltip.js.map +0 -1
- package/dist/model-DfeFradZ.d.ts +0 -9
- package/dist/model-DfeFradZ.d.ts.map +0 -1
- package/dist/positioner-3mCqiebN.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-grid-column-header.js","names":[],"sources":["../../../../src/components/reui/data-grid/data-grid-column-header.tsx"],"sourcesContent":["\"use client\";\n\nimport type { HTMLAttributes, ReactNode } from \"react\";\nimport { memo, useMemo } from \"react\";\nimport type { Column } from \"@tanstack/react-table\";\nimport { Subscribe } from \"@tanstack/react-table\";\nimport {\n ArrowDownIcon,\n ArrowLeftIcon,\n ArrowLeftToLineIcon,\n ArrowRightIcon,\n ArrowRightToLineIcon,\n ArrowUpIcon,\n CheckIcon,\n ChevronsUpDownIcon,\n PinOffIcon,\n Settings2Icon,\n} from \"lucide-react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { Button } from \"../../ui/button\";\nimport {\n DropdownMenu,\n DropdownMenuCheckboxItem,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuTrigger,\n} from \"../../ui/dropdown-menu\";\nimport type { DataGridFeatures } from \"./data-grid\";\nimport { getColumnHeaderLabel, useDataGrid } from \"./data-grid\";\n\ninterface DataGridColumnHeaderProps<TData extends object, TValue>\n extends HTMLAttributes<HTMLDivElement> {\n column: Column<DataGridFeatures, TData, TValue>;\n /** When omitted, uses `column.columnDef.meta.headerTitle`, then a string `columnDef.header`, then `column.id`. */\n title?: string;\n icon?: ReactNode;\n /** Reserved; pin controls are gated by tableLayout.columnsPinnable + column.getCanPin(). */\n pinnable?: boolean;\n filter?: ReactNode;\n visibility?: boolean;\n}\n\nfunction DataGridColumnHeaderInner<TData extends object, TValue>({\n column,\n title,\n icon,\n className,\n filter,\n visibility = false,\n}: DataGridColumnHeaderProps<TData, TValue>) {\n const { i18n, isLoading, table, props } = useDataGrid();\n const resolvedTitle = title ?? getColumnHeaderLabel(column);\n\n // The order a move rewrites: the consumer's columnOrder (TanStack defaults it\n // to []), then every leaf it leaves out, in definition order - the same\n // completion TanStack applies when rendering, so a rendered neighbour is\n // always present to re-seat beside, even after columns are added later.\n const columnOrderState = table.state.columnOrder;\n const definitionOrder = table\n .getAllColumns()\n .flatMap((topColumn) => topColumn.getLeafColumns())\n .map((leafColumn) => leafColumn.id);\n const columnOrder = [\n ...columnOrderState,\n ...definitionOrder.filter((id) => !columnOrderState.includes(id)),\n ];\n const isSorted = column.getIsSorted();\n const isPinned = column.getIsPinned();\n const canSort = column.getCanSort();\n const canPin = column.getCanPin();\n const canResize = column.getCanResize();\n\n // Move neighbours come from what is RENDERED: the column's own pin bucket,\n // visible columns only. Stepping through the raw columnOrder would trade\n // places with a hidden or pinned column - an enabled click that moves nothing.\n // With grouping in TanStack's default \"reorder\" mode, grouped columns render\n // first whatever columnOrder says: they neither move nor serve as a target.\n const groupedColumnMode = (table.options as { groupedColumnMode?: false | \"reorder\" | \"remove\" })\n .groupedColumnMode;\n const isHoistedByGrouping = (target: object) =>\n groupedColumnMode !== false &&\n typeof (target as { getIsGrouped?: unknown }).getIsGrouped === \"function\" &&\n (target as { getIsGrouped: () => boolean }).getIsGrouped();\n const renderedPeers = (\n isPinned === \"start\"\n ? table.getStartVisibleLeafColumns()\n : isPinned === \"end\"\n ? table.getEndVisibleLeafColumns()\n : table.getCenterVisibleLeafColumns()\n )\n .filter((leafColumn) => !isHoistedByGrouping(leafColumn))\n .map((leafColumn) => leafColumn.id);\n const renderedIndex = renderedPeers.indexOf(column.id);\n const leftNeighbour = renderedIndex > 0 ? renderedPeers[renderedIndex - 1] : undefined;\n const rightNeighbour =\n renderedIndex !== -1 && renderedIndex < renderedPeers.length - 1\n ? renderedPeers[renderedIndex + 1]\n : undefined;\n const canMoveLeft = leftNeighbour !== undefined;\n const canMoveRight = rightNeighbour !== undefined;\n\n /** Re-seats this column beside a rendered neighbour; every other column,\n * hidden or pinned ones included, keeps its place in the full order. */\n const moveBeside = (neighbourId: string, side: \"before\" | \"after\") => {\n const newOrder = columnOrder.filter((id) => id !== column.id);\n const at = newOrder.indexOf(neighbourId);\n if (at === -1) return;\n newOrder.splice(side === \"before\" ? at : at + 1, 0, column.id);\n table.setColumnOrder(newOrder);\n };\n\n // column.toggleSorting has no getCanSort() guard of its own, and the\n // direct button also renders for columns that are only resizable.\n const handleSort = () => {\n if (!canSort) return;\n if (isSorted === \"asc\") {\n column.toggleSorting(true);\n } else if (isSorted === \"desc\") {\n column.clearSorting();\n } else {\n column.toggleSorting(false);\n }\n };\n\n const headerLabelClassName = cn(\n \"inline-flex h-full items-center gap-1.5 font-normal text-[0.8125rem] text-secondary-foreground/80 leading-[calc(1.125/0.8125)] [&_svg]:size-3.5 [&_svg]:opacity-60\",\n className,\n );\n\n const headerButtonClassName = cn(\n \"h-6 rounded-lg px-2 font-normal text-secondary-foreground/80 hover:bg-secondary hover:text-foreground data-[state=open]:bg-secondary data-[state=open]:text-foreground\",\n className,\n );\n\n const sortIcon =\n canSort &&\n (isSorted === \"desc\" ? (\n <ArrowDownIcon className=\"size-3.25\" aria-hidden=\"true\" />\n ) : isSorted === \"asc\" ? (\n <ArrowUpIcon className=\"size-3.25\" aria-hidden=\"true\" />\n ) : (\n <ChevronsUpDownIcon className=\"mt-px size-3.25\" aria-hidden=\"true\" />\n ));\n\n // A start-pinned column's resize handle covers the last 20px of its cell\n // (the column that renders last already reserves it with pe-8, and a\n // start-pinned one renders last only when nothing follows its group), so\n // the unpin button steps in until it clears the handle in both densities.\n // The step is padding on a wrapper that shrinks first: a column too narrow\n // for label, button and clearance gives the clearance back, never the label.\n const unpinClearsResizeHandle =\n props.tableLayout?.columnsResizable &&\n canResize &&\n isPinned === \"start\" &&\n !(\n column.getIsLastColumn(\"start\") &&\n table.getCenterVisibleLeafColumns().length === 0 &&\n table.getEndVisibleLeafColumns().length === 0\n );\n\n const hasControls =\n props.tableLayout?.columnsMovable ||\n (props.tableLayout?.columnsVisibility && visibility) ||\n (props.tableLayout?.columnsPinnable && canPin) ||\n filter;\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: <>\n const menuItems = useMemo(() => {\n const items: ReactNode[] = [];\n let hasPreviousSection = false;\n\n // Filter section\n if (filter) {\n items.push(\n <DropdownMenuGroup key=\"group-filter\">\n <DropdownMenuLabel key=\"filter\">{filter}</DropdownMenuLabel>\n </DropdownMenuGroup>,\n );\n hasPreviousSection = true;\n }\n\n // Sort section\n if (canSort) {\n if (hasPreviousSection) {\n items.push(<DropdownMenuSeparator key=\"sep-sort\" />);\n }\n items.push(\n <DropdownMenuItem\n key=\"sort-asc\"\n onClick={() => {\n if (isSorted === \"asc\") {\n column.clearSorting();\n } else {\n column.toggleSorting(false);\n }\n }}\n disabled={!canSort}\n >\n <ArrowUpIcon className=\"size-3.5!\" />\n <span className=\"grow\">{i18n.labels.sortAscending}</span>\n {isSorted === \"asc\" && <CheckIcon className=\"size-4 text-primary opacity-100!\" />}\n </DropdownMenuItem>,\n <DropdownMenuItem\n key=\"sort-desc\"\n onClick={() => {\n if (isSorted === \"desc\") {\n column.clearSorting();\n } else {\n column.toggleSorting(true);\n }\n }}\n disabled={!canSort}\n >\n <ArrowDownIcon className=\"size-3.5!\" />\n <span className=\"grow\">{i18n.labels.sortDescending}</span>\n {isSorted === \"desc\" && <CheckIcon className=\"size-4 text-primary opacity-100!\" />}\n </DropdownMenuItem>,\n );\n hasPreviousSection = true;\n }\n\n // Pin section\n if (props.tableLayout?.columnsPinnable && canPin) {\n if (hasPreviousSection) {\n items.push(<DropdownMenuSeparator key=\"sep-pin\" />);\n }\n items.push(\n <DropdownMenuItem\n key=\"pin-left\"\n onClick={() => column.pin(isPinned === \"start\" ? false : \"start\")}\n >\n <ArrowLeftToLineIcon className=\"size-3.5!\" aria-hidden=\"true\" />\n <span className=\"grow\">{i18n.labels.pinColumnStart}</span>\n {isPinned === \"start\" && <CheckIcon className=\"size-4 text-primary opacity-100!\" />}\n </DropdownMenuItem>,\n <DropdownMenuItem\n key=\"pin-right\"\n onClick={() => column.pin(isPinned === \"end\" ? false : \"end\")}\n >\n <ArrowRightToLineIcon className=\"size-3.5!\" aria-hidden=\"true\" />\n <span className=\"grow\">{i18n.labels.pinColumnEnd}</span>\n {isPinned === \"end\" && <CheckIcon className=\"size-4 text-primary opacity-100!\" />}\n </DropdownMenuItem>,\n );\n hasPreviousSection = true;\n }\n\n // Move section\n if (props.tableLayout?.columnsMovable) {\n if (hasPreviousSection) {\n items.push(<DropdownMenuSeparator key=\"sep-move\" />);\n }\n items.push(\n <DropdownMenuItem\n key=\"move-left\"\n onClick={() => {\n if (leftNeighbour) moveBeside(leftNeighbour, \"before\");\n }}\n disabled={!canMoveLeft || isPinned !== false}\n >\n <ArrowLeftIcon className=\"size-3.5!\" aria-hidden=\"true\" />\n <span>{i18n.labels.moveColumnStart}</span>\n </DropdownMenuItem>,\n <DropdownMenuItem\n key=\"move-right\"\n onClick={() => {\n if (rightNeighbour) moveBeside(rightNeighbour, \"after\");\n }}\n disabled={!canMoveRight || isPinned !== false}\n >\n <ArrowRightIcon className=\"size-3.5!\" aria-hidden=\"true\" />\n <span>{i18n.labels.moveColumnEnd}</span>\n </DropdownMenuItem>,\n );\n hasPreviousSection = true;\n }\n\n // Visibility section\n if (props.tableLayout?.columnsVisibility && visibility) {\n if (hasPreviousSection) {\n items.push(<DropdownMenuSeparator key=\"sep-visibility\" />);\n }\n items.push(\n <DropdownMenuSub key=\"visibility\">\n <DropdownMenuSubTrigger>\n <Settings2Icon className=\"size-3.5!\" />\n <span>{i18n.labels.columnsMenu}</span>\n </DropdownMenuSubTrigger>\n <DropdownMenuSubContent side=\"right\">\n {table\n .getAllColumns()\n .filter((col) => col.getCanHide())\n .map((col) => (\n <DropdownMenuCheckboxItem\n key={col.id}\n checked={col.getIsVisible()}\n onSelect={(event) => event.preventDefault()}\n onCheckedChange={(value) => col.toggleVisibility(!!value)}\n className={getColumnHeaderLabel(col) === col.id ? \"capitalize\" : undefined}\n >\n {getColumnHeaderLabel(col)}\n </DropdownMenuCheckboxItem>\n ))}\n </DropdownMenuSubContent>\n </DropdownMenuSub>,\n );\n }\n\n return items;\n }, [\n filter,\n canSort,\n isSorted,\n column,\n props.tableLayout?.columnsPinnable,\n props.tableLayout?.columnsMovable,\n props.tableLayout?.columnsVisibility,\n canPin,\n isPinned,\n canMoveLeft,\n canMoveRight,\n visibility,\n table,\n leftNeighbour,\n rightNeighbour,\n i18n.labels.sortAscending,\n i18n.labels.moveColumnEnd,\n i18n.labels.pinColumnStart,\n i18n.labels.sortDescending,\n i18n.labels.moveColumnStart,\n i18n.labels.pinColumnEnd,\n i18n.labels.columnsMenu,\n ]);\n\n if (hasControls) {\n return (\n <div className=\"-ms-2 flex h-full items-center justify-between gap-1.5\">\n <DropdownMenu>\n <DropdownMenuTrigger\n render={\n <Button variant=\"ghost\" className={headerButtonClassName} disabled={isLoading}>\n {icon && icon}\n {resolvedTitle}\n {sortIcon}\n </Button>\n }\n />\n <DropdownMenuContent className=\"w-40\" align=\"start\">\n {menuItems}\n </DropdownMenuContent>\n </DropdownMenu>\n {props.tableLayout?.columnsPinnable && canPin && isPinned && (\n <span className={cn(\"-me-1 flex min-w-7 shrink-999\", unpinClearsResizeHandle && \"pe-4\")}>\n <Button\n size=\"icon-sm\"\n variant=\"ghost\"\n className=\"size-7 rounded-lg\"\n onClick={() => column.pin(false)}\n aria-label={i18n.labels.unpinColumn(resolvedTitle)}\n title={i18n.labels.unpinColumn(resolvedTitle)}\n >\n <PinOffIcon className=\"size-3.5! opacity-50!\" aria-hidden=\"true\" />\n </Button>\n </span>\n )}\n </div>\n );\n }\n\n if (canSort || (props.tableLayout?.columnsResizable && canResize)) {\n return (\n <div className=\"-ms-2 flex h-full items-center\">\n <Button\n variant=\"ghost\"\n className={headerButtonClassName}\n disabled={isLoading}\n onClick={handleSort}\n >\n {icon && icon}\n {resolvedTitle}\n {sortIcon}\n </Button>\n </div>\n );\n }\n\n return (\n <div className={headerLabelClassName}>\n {icon && icon}\n {resolvedTitle}\n </div>\n );\n}\n\nconst DataGridColumnHeaderMemo = memo(DataGridColumnHeaderInner) as <TData extends object, TValue>(\n props: DataGridColumnHeaderProps<TData, TValue> & {\n /** Internal: the state slices the header re-renders on. Not part of the public API. */\n subscribedState?: unknown;\n },\n) => ReactNode;\n\n/**\n * Sort and pin state reaches this header through builder calls on `column`\n * (`getIsSorted()`, `getIsPinned()`), and `column` is a stable reference. That\n * combination is the one v9's fresh-table-per-state-change does NOT cover:\n * React Compiler is free to memoize against the stable column and never\n * re-evaluate those reads, which shows up as frozen sort arrows and pin\n * controls. The `Subscribe` below turns the slices this header actually reads\n * into a real reactive dependency, and threading the selection through as a\n * prop is what lets it past the `memo` - which would otherwise see unchanged\n * props and skip the render anyway.\n */\nfunction DataGridColumnHeader<TData extends object, TValue>(\n props: DataGridColumnHeaderProps<TData, TValue>,\n) {\n const { table } = useDataGrid();\n\n return (\n <Subscribe\n source={table.store}\n selector={(state) => ({\n sorting: state.sorting,\n columnPinning: state.columnPinning,\n columnOrder: state.columnOrder,\n columnVisibility: state.columnVisibility,\n })}\n >\n {(subscribed) => <DataGridColumnHeaderMemo {...props} subscribedState={subscribed} />}\n </Subscribe>\n );\n}\n\nexport { DataGridColumnHeader, type DataGridColumnHeaderProps };\n"],"mappings":";;;;;;;;;;AAiDA,SAAS,0BAAwD,EAC/D,QACA,OACA,MACA,WACA,QACA,aAAa,SAC8B;CAC3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R,WAAW;GACX,UAAU;GACV,SAAS;GAJX,UAAA;IAMG,QAAQ;IACR;IACA;GACK;;CACL,CAAA;CAIT,OACE,qBAAC,OAAD;EAAK,WAAW;EAAhB,UAAA,CACG,QAAQ,MACR,aACE;;AAET;AAEA,MAAM,2BAA2B,KAAK,yBAAyB;;;;;;;;;;;;AAkB/D,SAAS,qBACP,OACA;CACA,MAAM,EAAE,UAAU,YAAY;CAE9B,OACE,oBAAC,WAAD;EACE,QAAQ,MAAM;EACd,WAAW,WAAW;GACpB,SAAS,MAAM;GACf,eAAe,MAAM;GACrB,aAAa,MAAM;GACnB,kBAAkB,MAAM;EAC1B;EAEE,WAAA,eAAe,oBAAC,0BAAD;GAA0B,GAAI;GAAO,iBAAiB;EAAa,CAAA;CAC3E,CAAA;AAEf"}
|
|
1
|
+
{"version":3,"file":"data-grid-column-header.js","names":[],"sources":["../../../../src/components/reui/data-grid/data-grid-column-header.tsx"],"sourcesContent":["\"use client\";\n\nimport type { HTMLAttributes, ReactNode } from \"react\";\nimport { memo, useLayoutEffect, useMemo, useRef } from \"react\";\nimport type { Column } from \"@tanstack/react-table\";\nimport { Subscribe } from \"@tanstack/react-table\";\nimport {\n ArrowDownIcon,\n ArrowLeftIcon,\n ArrowLeftToLineIcon,\n ArrowRightIcon,\n ArrowRightToLineIcon,\n ArrowUpIcon,\n CheckIcon,\n ChevronsUpDownIcon,\n PinOffIcon,\n Settings2Icon,\n} from \"lucide-react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { Button } from \"../../ui/button\";\nimport {\n DropdownMenu,\n DropdownMenuCheckboxItem,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuTrigger,\n} from \"../../ui/dropdown-menu\";\nimport type { DataGridFeatures } from \"./data-grid\";\nimport { getColumnHeaderLabel, getDataGridHeaderSpans, useDataGrid } from \"./data-grid\";\n\ninterface DataGridColumnHeaderProps<TData extends object, TValue>\n extends HTMLAttributes<HTMLDivElement> {\n column: Column<DataGridFeatures, TData, TValue>;\n /** When omitted, uses `column.columnDef.meta.headerTitle`, then a string `columnDef.header`, then `column.id`. */\n title?: string;\n icon?: ReactNode;\n /** Reserved; pin controls are gated by tableLayout.columnsPinnable + column.getCanPin(). */\n pinnable?: boolean;\n filter?: ReactNode;\n visibility?: boolean;\n}\n\n// Unpinning moves a column into another header list (pinned, windowed center),\n// which remounts its header, so the focus request outlives the button: the next\n// header rendered for that column takes it. `column` is a stable reference.\nconst pendingUnpinFocus = new WeakSet<object>();\n\nfunction DataGridColumnHeaderInner<TData extends object, TValue>({\n column,\n title,\n icon,\n className,\n filter,\n visibility = false,\n}: DataGridColumnHeaderProps<TData, TValue>) {\n const { i18n, isLoading, table, props } = useDataGrid();\n const resolvedTitle = title ?? getColumnHeaderLabel(column);\n\n // The order a move rewrites: the consumer's columnOrder (TanStack defaults it\n // to []), then every leaf it leaves out, in definition order - the same\n // completion TanStack applies when rendering, so a rendered neighbour is\n // always present to re-seat beside, even after columns are added later.\n const columnOrderState = table.state.columnOrder;\n const definitionOrder = table\n .getAllColumns()\n .flatMap((topColumn) => topColumn.getLeafColumns())\n .map((leafColumn) => leafColumn.id);\n const columnOrder = [\n ...columnOrderState,\n ...definitionOrder.filter((id) => !columnOrderState.includes(id)),\n ];\n const isSorted = column.getIsSorted();\n const isPinned = column.getIsPinned();\n const menuTriggerRef = useRef<HTMLButtonElement>(null);\n useLayoutEffect(() => {\n if (pendingUnpinFocus.delete(column)) menuTriggerRef.current?.focus();\n });\n const canSort = column.getCanSort();\n const canPin = column.getCanPin();\n const canResize = column.getCanResize();\n\n // Move neighbours come from what is RENDERED: the column's own pin bucket,\n // visible columns only. Stepping through the raw columnOrder would trade\n // places with a hidden or pinned column - an enabled click that moves nothing.\n // With grouping in TanStack's default \"reorder\" mode, grouped columns render\n // first whatever columnOrder says: they neither move nor serve as a target.\n const groupedColumnMode = (table.options as { groupedColumnMode?: false | \"reorder\" | \"remove\" })\n .groupedColumnMode;\n const isHoistedByGrouping = (target: object) =>\n groupedColumnMode !== false &&\n typeof (target as { getIsGrouped?: unknown }).getIsGrouped === \"function\" &&\n (target as { getIsGrouped: () => boolean }).getIsGrouped();\n const renderedLeaves = (\n isPinned === \"start\"\n ? table.getStartVisibleLeafColumns()\n : isPinned === \"end\"\n ? table.getEndVisibleLeafColumns()\n : table.getCenterVisibleLeafColumns()\n )\n .filter((leafColumn) => !isHoistedByGrouping(leafColumn))\n .map((leafColumn) => leafColumn.id);\n const renderedOrder = new Map(renderedLeaves.map((id, index) => [id, index]));\n const byRenderedOrder = (a: string, b: string) => renderedOrder.get(a)! - renderedOrder.get(b)!;\n // A peer is a sibling at this column's header level with its rendered\n // leaves, so a group or a meta.headerColSpan span moves as one.\n const headerSpans = getDataGridHeaderSpans(table);\n const coveredIds = new Set([...headerSpans.values()].flat().map((leafColumn) => leafColumn.id));\n // Siblings only: a leaf stepping out of its group would split its header.\n const renderedPeers = (column.parent?.columns ?? table.getAllColumns())\n .filter((sibling) => !coveredIds.has(sibling.id))\n .map((sibling) =>\n [...sibling.getLeafColumns(), ...(headerSpans.get(sibling.id) ?? [])]\n .map((leafColumn) => leafColumn.id)\n .filter((id) => renderedOrder.has(id))\n .sort(byRenderedOrder),\n )\n .filter((leaves) => leaves.length > 0)\n .sort((a, b) => byRenderedOrder(a[0]!, b[0]!));\n const renderedIndex = column.columns.length\n ? -1\n : renderedPeers.findIndex((leaves) => leaves[0] === column.id);\n const leftNeighbour = renderedIndex > 0 ? renderedPeers[renderedIndex - 1] : undefined;\n const rightNeighbour =\n renderedIndex !== -1 && renderedIndex < renderedPeers.length - 1\n ? renderedPeers[renderedIndex + 1]\n : undefined;\n const canMoveLeft = leftNeighbour !== undefined;\n const canMoveRight = rightNeighbour !== undefined;\n\n /** Re-seats this column, with the leaves its header spans, beside a rendered\n * neighbour; every other column, hidden or pinned, keeps its place. */\n const moveBeside = (neighbour: string[], side: \"before\" | \"after\") => {\n const moving = renderedPeers[renderedIndex] ?? [column.id];\n const newOrder = columnOrder.filter((id) => !moving.includes(id));\n const anchor = side === \"before\" ? neighbour[0] : neighbour[neighbour.length - 1];\n const at = anchor === undefined ? -1 : newOrder.indexOf(anchor);\n if (at === -1) return;\n newOrder.splice(side === \"before\" ? at : at + 1, 0, ...moving);\n table.setColumnOrder(newOrder);\n };\n\n // column.toggleSorting has no getCanSort() guard of its own, and the\n // direct button also renders for columns that are only resizable.\n const handleSort = () => {\n if (!canSort) return;\n if (isSorted === \"asc\") {\n column.toggleSorting(true);\n } else if (isSorted === \"desc\") {\n column.clearSorting();\n } else {\n column.toggleSorting(false);\n }\n };\n\n const headerLabelClassName = cn(\n \"inline-flex h-full items-center gap-1.5 font-normal text-[0.8125rem] text-secondary-foreground/80 leading-[calc(1.125/0.8125)] [&_svg]:size-3.5 [&_svg]:opacity-60\",\n className,\n );\n\n const headerButtonClassName = cn(\n \"h-6 rounded-lg px-2 font-normal text-secondary-foreground/80 hover:bg-secondary hover:text-foreground data-[state=open]:bg-secondary data-[state=open]:text-foreground\",\n className,\n );\n\n const sortIcon =\n canSort &&\n (isSorted === \"desc\" ? (\n <ArrowDownIcon className=\"size-3.25\" aria-hidden=\"true\" />\n ) : isSorted === \"asc\" ? (\n <ArrowUpIcon className=\"size-3.25\" aria-hidden=\"true\" />\n ) : (\n <ChevronsUpDownIcon className=\"mt-px size-3.25\" aria-hidden=\"true\" />\n ));\n\n // A start-pinned column's resize handle covers the last 20px of its cell\n // (the column that renders last already reserves it with pe-8, and a\n // start-pinned one renders last only when nothing follows its group), so\n // the unpin button steps in until it clears the handle in both densities.\n // The step is padding on a wrapper that shrinks first: a column too narrow\n // for label, button and clearance gives the clearance back, never the label.\n const unpinClearsResizeHandle =\n props.tableLayout?.columnsResizable &&\n canResize &&\n isPinned === \"start\" &&\n !(\n column.getIsLastColumn(\"start\") &&\n table.getCenterVisibleLeafColumns().length === 0 &&\n table.getEndVisibleLeafColumns().length === 0\n );\n\n const hasControls =\n props.tableLayout?.columnsMovable ||\n (props.tableLayout?.columnsVisibility && visibility) ||\n (props.tableLayout?.columnsPinnable && canPin) ||\n filter;\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: <>\n const menuItems = useMemo(() => {\n const items: ReactNode[] = [];\n let hasPreviousSection = false;\n\n // Filter section\n if (filter) {\n items.push(\n <DropdownMenuGroup key=\"group-filter\">\n <DropdownMenuLabel key=\"filter\">{filter}</DropdownMenuLabel>\n </DropdownMenuGroup>,\n );\n hasPreviousSection = true;\n }\n\n // Sort section\n if (canSort) {\n if (hasPreviousSection) {\n items.push(<DropdownMenuSeparator key=\"sep-sort\" />);\n }\n items.push(\n <DropdownMenuItem\n key=\"sort-asc\"\n onClick={() => {\n if (isSorted === \"asc\") {\n column.clearSorting();\n } else {\n column.toggleSorting(false);\n }\n }}\n disabled={!canSort}\n >\n <ArrowUpIcon className=\"size-3.5!\" />\n <span className=\"grow\">{i18n.labels.sortAscending}</span>\n {isSorted === \"asc\" && <CheckIcon className=\"size-4 text-primary opacity-100!\" />}\n </DropdownMenuItem>,\n <DropdownMenuItem\n key=\"sort-desc\"\n onClick={() => {\n if (isSorted === \"desc\") {\n column.clearSorting();\n } else {\n column.toggleSorting(true);\n }\n }}\n disabled={!canSort}\n >\n <ArrowDownIcon className=\"size-3.5!\" />\n <span className=\"grow\">{i18n.labels.sortDescending}</span>\n {isSorted === \"desc\" && <CheckIcon className=\"size-4 text-primary opacity-100!\" />}\n </DropdownMenuItem>,\n );\n hasPreviousSection = true;\n }\n\n // Pin section\n if (props.tableLayout?.columnsPinnable && canPin) {\n if (hasPreviousSection) {\n items.push(<DropdownMenuSeparator key=\"sep-pin\" />);\n }\n items.push(\n <DropdownMenuItem\n key=\"pin-left\"\n onClick={() => column.pin(isPinned === \"start\" ? false : \"start\")}\n >\n <ArrowLeftToLineIcon className=\"size-3.5!\" aria-hidden=\"true\" />\n <span className=\"grow\">{i18n.labels.pinColumnStart}</span>\n {isPinned === \"start\" && <CheckIcon className=\"size-4 text-primary opacity-100!\" />}\n </DropdownMenuItem>,\n <DropdownMenuItem\n key=\"pin-right\"\n onClick={() => column.pin(isPinned === \"end\" ? false : \"end\")}\n >\n <ArrowRightToLineIcon className=\"size-3.5!\" aria-hidden=\"true\" />\n <span className=\"grow\">{i18n.labels.pinColumnEnd}</span>\n {isPinned === \"end\" && <CheckIcon className=\"size-4 text-primary opacity-100!\" />}\n </DropdownMenuItem>,\n );\n hasPreviousSection = true;\n }\n\n // Move section\n if (props.tableLayout?.columnsMovable) {\n if (hasPreviousSection) {\n items.push(<DropdownMenuSeparator key=\"sep-move\" />);\n }\n items.push(\n <DropdownMenuItem\n key=\"move-left\"\n onClick={() => {\n if (leftNeighbour) moveBeside(leftNeighbour, \"before\");\n }}\n disabled={!canMoveLeft || isPinned !== false}\n >\n <ArrowLeftIcon className=\"size-3.5!\" aria-hidden=\"true\" />\n <span>{i18n.labels.moveColumnStart}</span>\n </DropdownMenuItem>,\n <DropdownMenuItem\n key=\"move-right\"\n onClick={() => {\n if (rightNeighbour) moveBeside(rightNeighbour, \"after\");\n }}\n disabled={!canMoveRight || isPinned !== false}\n >\n <ArrowRightIcon className=\"size-3.5!\" aria-hidden=\"true\" />\n <span>{i18n.labels.moveColumnEnd}</span>\n </DropdownMenuItem>,\n );\n hasPreviousSection = true;\n }\n\n // Visibility section\n if (props.tableLayout?.columnsVisibility && visibility) {\n if (hasPreviousSection) {\n items.push(<DropdownMenuSeparator key=\"sep-visibility\" />);\n }\n items.push(\n <DropdownMenuSub key=\"visibility\">\n <DropdownMenuSubTrigger>\n <Settings2Icon className=\"size-3.5!\" />\n <span>{i18n.labels.columnsMenu}</span>\n </DropdownMenuSubTrigger>\n <DropdownMenuSubContent side=\"right\">\n {table\n .getAllColumns()\n .filter((col) => col.getCanHide())\n .map((col) => (\n <DropdownMenuCheckboxItem\n key={col.id}\n checked={col.getIsVisible()}\n onSelect={(event) => event.preventDefault()}\n onCheckedChange={(value) => col.toggleVisibility(!!value)}\n className={getColumnHeaderLabel(col) === col.id ? \"capitalize\" : undefined}\n >\n {getColumnHeaderLabel(col)}\n </DropdownMenuCheckboxItem>\n ))}\n </DropdownMenuSubContent>\n </DropdownMenuSub>,\n );\n }\n\n return items;\n }, [\n filter,\n canSort,\n isSorted,\n column,\n props.tableLayout?.columnsPinnable,\n props.tableLayout?.columnsMovable,\n props.tableLayout?.columnsVisibility,\n canPin,\n isPinned,\n canMoveLeft,\n canMoveRight,\n visibility,\n table,\n leftNeighbour,\n rightNeighbour,\n i18n.labels.sortAscending,\n i18n.labels.moveColumnEnd,\n i18n.labels.pinColumnStart,\n i18n.labels.sortDescending,\n i18n.labels.moveColumnStart,\n i18n.labels.pinColumnEnd,\n i18n.labels.columnsMenu,\n ]);\n\n if (hasControls) {\n return (\n <div className=\"-ms-2 flex h-full items-center justify-between gap-1.5\">\n <DropdownMenu>\n <DropdownMenuTrigger\n ref={menuTriggerRef}\n render={\n <Button variant=\"ghost\" className={headerButtonClassName} disabled={isLoading}>\n {icon && icon}\n {resolvedTitle}\n {sortIcon}\n </Button>\n }\n />\n <DropdownMenuContent className=\"w-40\" align=\"start\">\n {menuItems}\n </DropdownMenuContent>\n </DropdownMenu>\n {props.tableLayout?.columnsPinnable && canPin && isPinned && (\n <span className={cn(\"-me-1 flex min-w-7 shrink-999\", unpinClearsResizeHandle && \"pe-4\")}>\n <Button\n size=\"icon-sm\"\n variant=\"ghost\"\n className=\"size-7 rounded-lg\"\n onClick={(event) => {\n const scrollArea = event.currentTarget.closest<HTMLElement>(\n '[data-slot=\"scroll-area-viewport\"]',\n );\n pendingUnpinFocus.add(column);\n column.pin(false);\n // A column the virtual window leaves unmounted claims nothing,\n // so the grid's scroll area takes focus instead of the page.\n requestAnimationFrame(() => {\n if (pendingUnpinFocus.delete(column)) scrollArea?.focus();\n });\n }}\n aria-label={i18n.labels.unpinColumn(resolvedTitle)}\n title={i18n.labels.unpinColumn(resolvedTitle)}\n >\n <PinOffIcon className=\"size-3.5! opacity-50!\" aria-hidden=\"true\" />\n </Button>\n </span>\n )}\n </div>\n );\n }\n\n if (canSort || (props.tableLayout?.columnsResizable && canResize)) {\n return (\n <div className=\"-ms-2 flex h-full items-center\">\n <Button\n variant=\"ghost\"\n className={headerButtonClassName}\n disabled={isLoading}\n onClick={handleSort}\n >\n {icon && icon}\n {resolvedTitle}\n {sortIcon}\n </Button>\n </div>\n );\n }\n\n return (\n <div className={headerLabelClassName}>\n {icon && icon}\n {resolvedTitle}\n </div>\n );\n}\n\nconst DataGridColumnHeaderMemo = memo(DataGridColumnHeaderInner) as <TData extends object, TValue>(\n props: DataGridColumnHeaderProps<TData, TValue> & {\n /** Internal: the state slices the header re-renders on. Not part of the public API. */\n subscribedState?: unknown;\n },\n) => ReactNode;\n\n/**\n * Sort and pin state reaches this header through builder calls on `column`\n * (`getIsSorted()`, `getIsPinned()`), and `column` is a stable reference. That\n * combination is the one v9's fresh-table-per-state-change does NOT cover:\n * React Compiler is free to memoize against the stable column and never\n * re-evaluate those reads, which shows up as frozen sort arrows and pin\n * controls. The `Subscribe` below turns the slices this header actually reads\n * into a real reactive dependency, and threading the selection through as a\n * prop is what lets it past the `memo` - which would otherwise see unchanged\n * props and skip the render anyway.\n */\nfunction DataGridColumnHeader<TData extends object, TValue>(\n props: DataGridColumnHeaderProps<TData, TValue>,\n) {\n const { table } = useDataGrid();\n\n return (\n <Subscribe\n source={table.store}\n selector={(state) => ({\n sorting: state.sorting,\n columnPinning: state.columnPinning,\n columnOrder: state.columnOrder,\n columnVisibility: state.columnVisibility,\n })}\n >\n {(subscribed) => <DataGridColumnHeaderMemo {...props} subscribedState={subscribed} />}\n </Subscribe>\n );\n}\n\nexport { DataGridColumnHeader, type DataGridColumnHeaderProps };\n"],"mappings":";;;;;;;;;;AAoDA,MAAM,oCAAoB,IAAI,QAAgB;AAE9C,SAAS,0BAAwD,EAC/D,QACA,OACA,MACA,WACA,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AC,QAAD;GACE,SAAQ;GACR,WAAW;GACX,UAAU;GACV,SAAS;GAJX,UAAA;IAMG,QAAQ;IACR;IACA;GACK;;CACL,CAAA;CAIT,OACE,qBAAC,OAAD;EAAK,WAAW;EAAhB,UAAA,CACG,QAAQ,MACR,aACE;;AAET;AAEA,MAAM,2BAA2B,KAAK,yBAAyB;;;;;;;;;;;;AAkB/D,SAAS,qBACP,OACA;CACA,MAAM,EAAE,UAAU,YAAY;CAE9B,OACE,oBAAC,WAAD;EACE,QAAQ,MAAM;EACd,WAAW,WAAW;GACpB,SAAS,MAAM;GACf,eAAe,MAAM;GACrB,aAAa,MAAM;GACnB,kBAAkB,MAAM;EAC1B;EAEE,WAAA,eAAe,oBAAC,0BAAD;GAA0B,GAAI;GAAO,iBAAiB;EAAa,CAAA;CAC3E,CAAA;AAEf"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Button } from "../../ui/button.js";
|
|
3
|
-
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../../ui/select.js";
|
|
4
3
|
import { Skeleton } from "../../ui/skeleton.js";
|
|
4
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../../ui/select.js";
|
|
5
5
|
import { useDataGrid } from "./data-grid.js";
|
|
6
6
|
import { cn } from "@kumix/utils";
|
|
7
7
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-grid-scroll-area.d.ts","names":["ScrollAreaPrimitive"],"sources":["../../../../src/components/reui/data-grid/data-grid-scroll-area.tsx"],"mappings":";;;KAsCK;KAkBA,0BAA0B,KAAKA,WAAoB,KAAK;EAC3D,UAAU;EACV,cAAc;;
|
|
1
|
+
{"version":3,"file":"data-grid-scroll-area.d.ts","names":["ScrollAreaPrimitive"],"sources":["../../../../src/components/reui/data-grid/data-grid-scroll-area.tsx"],"mappings":";;;KAsCK;KAkBA,0BAA0B,KAAKA,WAAoB,KAAK;EAC3D,UAAU;EACV,cAAc;;iBAsCP,qBACP,UACA,WACA,gBACG,SACF,0CAAuB,IAAA"}
|
|
@@ -25,6 +25,11 @@ function clamp(value, min, max) {
|
|
|
25
25
|
function areMetricsEqual(next, prev) {
|
|
26
26
|
return next.hasVerticalOverflow === prev.hasVerticalOverflow && next.headerHeight === prev.headerHeight && next.horizontalScrollbarSize === prev.horizontalScrollbarSize && next.thumbHeight === prev.thumbHeight && next.thumbTop === prev.thumbTop && next.trackHeight === prev.trackHeight;
|
|
27
27
|
}
|
|
28
|
+
function getStickyFooterHeight(table) {
|
|
29
|
+
const footer = table instanceof HTMLTableElement ? table.tFoot : null;
|
|
30
|
+
if (!footer) return 0;
|
|
31
|
+
return [footer, footer.rows[0]?.cells[0]].some((element) => element && getComputedStyle(element).position === "sticky") ? footer.getBoundingClientRect().height : 0;
|
|
32
|
+
}
|
|
28
33
|
function applyMetrics(element, metrics) {
|
|
29
34
|
element.style.setProperty("--data-grid-scrollbar-header-height", `${metrics.headerHeight}px`);
|
|
30
35
|
element.style.setProperty("--data-grid-scrollbar-thumb-height", `${metrics.thumbHeight}px`);
|
|
@@ -93,14 +98,15 @@ function DataGridScrollArea({ children, className, orientation = "both", ...prop
|
|
|
93
98
|
resetMetrics();
|
|
94
99
|
return;
|
|
95
100
|
}
|
|
96
|
-
const { header, horizontalScrollbar } = observedElementsRef.current;
|
|
101
|
+
const { header, horizontalScrollbar, table } = observedElementsRef.current;
|
|
97
102
|
const headerHeight = header?.getBoundingClientRect().height ?? 0;
|
|
103
|
+
const footerHeight = getStickyFooterHeight(table);
|
|
98
104
|
const viewportHeight = viewport.clientHeight;
|
|
99
105
|
const viewportWidth = viewport.clientWidth;
|
|
100
106
|
const scrollHeight = viewport.scrollHeight;
|
|
101
107
|
const scrollWidth = viewport.scrollWidth;
|
|
102
108
|
const horizontalScrollbarSize = showHorizontal && scrollWidth > viewportWidth + .5 ? (horizontalScrollbar?.offsetHeight || FALLBACK_SCROLLBAR_SIZE) + SCROLLBAR_EDGE_GAP : 0;
|
|
103
|
-
const trackHeight = Math.max(0, viewportHeight - headerHeight - horizontalScrollbarSize);
|
|
109
|
+
const trackHeight = Math.max(0, viewportHeight - headerHeight - Math.max(footerHeight, horizontalScrollbarSize));
|
|
104
110
|
const maxScroll = Math.max(0, scrollHeight - viewportHeight);
|
|
105
111
|
let nextMetrics;
|
|
106
112
|
if (trackHeight === 0 || maxScroll === 0) nextMetrics = {
|
|
@@ -112,7 +118,7 @@ function DataGridScrollArea({ children, className, orientation = "both", ...prop
|
|
|
112
118
|
trackHeight
|
|
113
119
|
};
|
|
114
120
|
else {
|
|
115
|
-
const thumbHeight = clamp(trackHeight * (trackHeight / Math.max(trackHeight, scrollHeight - headerHeight)), MIN_THUMB_SIZE, trackHeight);
|
|
121
|
+
const thumbHeight = clamp(trackHeight * (trackHeight / Math.max(trackHeight, scrollHeight - headerHeight - footerHeight)), MIN_THUMB_SIZE, trackHeight);
|
|
116
122
|
const maxThumbTop = Math.max(0, trackHeight - thumbHeight);
|
|
117
123
|
nextMetrics = {
|
|
118
124
|
hasVerticalOverflow: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-grid-scroll-area.js","names":["ScrollAreaPrimitive"],"sources":["../../../../src/components/reui/data-grid/data-grid-scroll-area.tsx"],"sourcesContent":["\"use client\";\n\nimport type { PointerEvent, ReactNode } from \"react\";\nimport { useCallback, useEffect, useLayoutEffect, useRef, useState } from \"react\";\nimport { DirectionProvider, useDirection } from \"@base-ui/react/direction-provider\";\nimport { ScrollArea as ScrollAreaPrimitive } from \"@base-ui/react/scroll-area\";\n\nimport { cn } from \"@kumix/utils\";\nimport { useDataGrid } from \"./data-grid\";\n\nconst MIN_THUMB_SIZE = 24;\nconst FALLBACK_SCROLLBAR_SIZE = 12;\n// Gap between each track and the grid edge: the mb-px / me-px on the tracks and\n// the overlay's inset-e-px. The overlay's height math adds it below the bar.\nconst SCROLLBAR_EDGE_GAP = 1;\n\nconst INITIAL_METRICS = {\n hasVerticalOverflow: false,\n headerHeight: 0,\n horizontalScrollbarSize: 0,\n thumbHeight: 0,\n thumbTop: 0,\n trackHeight: 0,\n} as const;\n\n// Track footprint: --data-grid-scrollbar-size (10px by default) in both\n// orientations, less 1px for the transparent border and 2px for p-px, so every\n// thumb lands at that size less 3px (7px), held 1px off the grid edge. Thinner\n// was hard to grab; the tracks overlay the last row and column, so the default\n// stays under 12px. The sticky-header overlay below follows the same variable.\nconst SCROLLBAR_CLASSNAME =\n \"flex touch-none p-px transition-colors select-none data-[orientation=horizontal]:mb-px data-[orientation=horizontal]:h-[var(--data-grid-scrollbar-size,0.625rem)] data-[orientation=horizontal]:flex-col data-[orientation=horizontal]:border-t data-[orientation=horizontal]:border-t-transparent data-[orientation=vertical]:me-px data-[orientation=vertical]:h-full data-[orientation=vertical]:w-[var(--data-grid-scrollbar-size,0.625rem)] data-[orientation=vertical]:border-s data-[orientation=vertical]:border-s-transparent\";\n\n// The ::before reaches the track's outer edge, so the whole track thickness\n// grabs the thumb rather than only its painted 7px.\nconst SCROLLBAR_THUMB_CLASSNAME =\n \"bg-border rounded-full relative flex-1 before:absolute before:-inset-0.5\";\n\ntype DataGridScrollAreaOrientation = \"horizontal\" | \"vertical\" | \"both\";\n\ntype ScrollbarMetrics = {\n hasVerticalOverflow: boolean;\n headerHeight: number;\n horizontalScrollbarSize: number;\n thumbHeight: number;\n thumbTop: number;\n trackHeight: number;\n};\n\ntype ObservedElements = {\n header: HTMLElement | null;\n horizontalScrollbar: HTMLElement | null;\n table: HTMLElement | null;\n tableViewport: HTMLElement | null;\n};\n\ntype DataGridScrollAreaProps = Omit<ScrollAreaPrimitive.Root.Props, \"children\"> & {\n children: ReactNode;\n orientation?: DataGridScrollAreaOrientation;\n};\n\nfunction clamp(value: number, min: number, max: number) {\n return Math.min(max, Math.max(min, value));\n}\n\nfunction areMetricsEqual(next: ScrollbarMetrics, prev: ScrollbarMetrics) {\n return (\n next.hasVerticalOverflow === prev.hasVerticalOverflow &&\n next.headerHeight === prev.headerHeight &&\n next.horizontalScrollbarSize === prev.horizontalScrollbarSize &&\n next.thumbHeight === prev.thumbHeight &&\n next.thumbTop === prev.thumbTop &&\n next.trackHeight === prev.trackHeight\n );\n}\n\nfunction applyMetrics(element: HTMLElement, metrics: ScrollbarMetrics) {\n element.style.setProperty(\"--data-grid-scrollbar-header-height\", `${metrics.headerHeight}px`);\n element.style.setProperty(\"--data-grid-scrollbar-thumb-height\", `${metrics.thumbHeight}px`);\n element.style.setProperty(\"--data-grid-scrollbar-thumb-top\", `${metrics.thumbTop}px`);\n element.style.setProperty(\"--data-grid-scrollbar-track-height\", `${metrics.trackHeight}px`);\n}\n\nfunction DataGridScrollArea({\n children,\n className,\n orientation = \"both\",\n ...props\n}: DataGridScrollAreaProps) {\n const { props: dataGridProps, table } = useDataGrid();\n const containerRef = useRef<HTMLDivElement>(null);\n const overlayRef = useRef<HTMLDivElement | null>(null);\n const viewportRef = useRef<HTMLDivElement | null>(null);\n const dragRef = useRef<{\n pointerId: number;\n startScrollTop: number;\n startY: number;\n } | null>(null);\n const metricsRef = useRef<ScrollbarMetrics>(INITIAL_METRICS);\n const observedElementsRef = useRef<ObservedElements>({\n header: null,\n horizontalScrollbar: null,\n table: null,\n tableViewport: null,\n });\n\n const showHorizontal = orientation !== \"vertical\";\n const showVertical = orientation !== \"horizontal\";\n const usesCustomVerticalScrollbar = showVertical && !!dataGridProps.tableLayout?.headerSticky;\n // Pinned columns are sticky and never scroll, so the horizontal scrollbar\n // track is inset to span only the scrollable center region between them.\n const isColumnsPinnable = !!dataGridProps.tableLayout?.columnsPinnable;\n const scrollbarInsetStart = isColumnsPinnable ? table.getStartTotalSize() : 0;\n const scrollbarInsetEnd = isColumnsPinnable ? table.getEndTotalSize() : 0;\n const [hasCustomVerticalOverflow, setHasCustomVerticalOverflow] = useState(false);\n\n // Base UI's thumb math reads direction from its own context, which a Radix\n // app or a bare dir=\"rtl\" page never provides, so RTL scrolled with LTR math\n // and the thumb froze. RTL is read off the layout instead, so no provider of\n // any kind is needed. LTR passes the inherited value through untouched: no\n // state change and no extra render, exactly as before this existed.\n const inheritedDirection = useDirection();\n const [isLayoutRtl, setIsLayoutRtl] = useState(false);\n\n useLayoutEffect(() => {\n const container = containerRef.current;\n if (!container) return;\n\n const readDirection = () => {\n const next = getComputedStyle(container).direction === \"rtl\";\n setIsLayoutRtl((prev) => (prev === next ? prev : next));\n };\n\n readDirection();\n if (typeof MutationObserver === \"undefined\") return;\n\n // Only a dir attribute flips it at runtime (an RTL toggle on <html>).\n const observer = new MutationObserver(readDirection);\n observer.observe(document.documentElement, {\n attributes: true,\n attributeFilter: [\"dir\"],\n subtree: true,\n });\n return () => observer.disconnect();\n }, []);\n\n const clearDragState = useCallback(() => {\n dragRef.current = null;\n document.body.style.userSelect = \"\";\n document.body.style.webkitUserSelect = \"\";\n }, []);\n\n // The overlay is mounted one commit after the sync that detected overflow,\n // so it misses that sync's write. Seeding it from the ref callback lands the\n // geometry during commit, before the browser paints the track.\n const setOverlayRef = useCallback((node: HTMLDivElement | null) => {\n overlayRef.current = node;\n\n if (node) applyMetrics(node, metricsRef.current);\n }, []);\n\n const resetMetrics = useCallback(() => {\n if (!areMetricsEqual(INITIAL_METRICS, metricsRef.current)) {\n metricsRef.current = INITIAL_METRICS;\n if (overlayRef.current) applyMetrics(overlayRef.current, INITIAL_METRICS);\n }\n\n setHasCustomVerticalOverflow((prev) => (prev ? false : prev));\n }, []);\n\n const syncCustomVerticalScrollbar = useCallback(() => {\n const container = containerRef.current;\n const viewport = viewportRef.current;\n\n if (!container || !viewport || !usesCustomVerticalScrollbar) {\n resetMetrics();\n return;\n }\n\n const { header, horizontalScrollbar } = observedElementsRef.current;\n const headerHeight = header?.getBoundingClientRect().height ?? 0;\n const viewportHeight = viewport.clientHeight;\n const viewportWidth = viewport.clientWidth;\n const scrollHeight = viewport.scrollHeight;\n const scrollWidth = viewport.scrollWidth;\n const hasHorizontalOverflow = showHorizontal && scrollWidth > viewportWidth + 0.5;\n const horizontalScrollbarSize = hasHorizontalOverflow\n ? (horizontalScrollbar?.offsetHeight || FALLBACK_SCROLLBAR_SIZE) + SCROLLBAR_EDGE_GAP\n : 0;\n const trackHeight = Math.max(0, viewportHeight - headerHeight - horizontalScrollbarSize);\n const maxScroll = Math.max(0, scrollHeight - viewportHeight);\n\n let nextMetrics: ScrollbarMetrics;\n\n if (trackHeight === 0 || maxScroll === 0) {\n nextMetrics = {\n hasVerticalOverflow: false,\n headerHeight,\n horizontalScrollbarSize,\n thumbHeight: trackHeight,\n thumbTop: 0,\n trackHeight,\n };\n } else {\n const bodyContentHeight = Math.max(trackHeight, scrollHeight - headerHeight);\n const thumbHeight = clamp(\n trackHeight * (trackHeight / bodyContentHeight),\n MIN_THUMB_SIZE,\n trackHeight,\n );\n const maxThumbTop = Math.max(0, trackHeight - thumbHeight);\n const thumbTop = maxThumbTop > 0 ? (viewport.scrollTop / maxScroll) * maxThumbTop : 0;\n\n nextMetrics = {\n hasVerticalOverflow: true,\n headerHeight,\n horizontalScrollbarSize,\n thumbHeight,\n thumbTop,\n trackHeight,\n };\n }\n\n if (!areMetricsEqual(nextMetrics, metricsRef.current)) {\n metricsRef.current = nextMetrics;\n // Scoped to the overlay, never to the container. These four properties\n // inherit, and thumbTop changes on essentially every scroll frame, so\n // writing them on the element that wraps the whole grid invalidates\n // computed style for every row and cell each frame. The overlay subtree\n // is their only reader.\n if (overlayRef.current) applyMetrics(overlayRef.current, nextMetrics);\n }\n\n setHasCustomVerticalOverflow((prev) =>\n prev === nextMetrics.hasVerticalOverflow ? prev : nextMetrics.hasVerticalOverflow,\n );\n }, [resetMetrics, showHorizontal, usesCustomVerticalScrollbar]);\n\n useEffect(() => {\n const container = containerRef.current;\n const viewport = viewportRef.current;\n\n if (!container || !viewport) return;\n\n if (!usesCustomVerticalScrollbar) {\n resetMetrics();\n return;\n }\n\n let frame = 0;\n\n const scheduleSync = () => {\n cancelAnimationFrame(frame);\n frame = window.requestAnimationFrame(syncCustomVerticalScrollbar);\n };\n\n const observer =\n typeof ResizeObserver === \"undefined\" ? null : new ResizeObserver(scheduleSync);\n const observed = new Set<HTMLElement>();\n\n const observeElement = (element: HTMLElement | null) => {\n if (element && observer && !observed.has(element)) {\n observer.observe(element);\n observed.add(element);\n }\n };\n\n const resolveObservedElements = () => {\n observedElementsRef.current = {\n header: container.querySelector(\n '[data-slot=\"data-grid-table\"] thead',\n ) as HTMLElement | null,\n horizontalScrollbar: container.querySelector(\n '[data-slot=\"data-grid-scrollbar\"][data-orientation=\"horizontal\"]',\n ) as HTMLElement | null,\n table: container.querySelector('[data-slot=\"data-grid-table\"]') as HTMLElement | null,\n tableViewport: container.querySelector(\n '[data-slot=\"data-grid-table-viewport\"]',\n ) as HTMLElement | null,\n };\n\n observeElement(observedElementsRef.current.header);\n observeElement(observedElementsRef.current.table);\n observeElement(observedElementsRef.current.tableViewport);\n\n return !!(observedElementsRef.current.header && observedElementsRef.current.table);\n };\n\n observeElement(viewport);\n const resolvedOnMount = resolveObservedElements();\n\n scheduleSync();\n viewport.addEventListener(\"scroll\", scheduleSync, { passive: true });\n\n // A table that mounts after this effect (empty state swapped for data)\n // would otherwise never be observed and the custom scrollbar would\n // overlap the sticky header. One-shot: disconnects once resolved.\n let mutationObserver: MutationObserver | null = null;\n if (!resolvedOnMount && typeof MutationObserver !== \"undefined\") {\n mutationObserver = new MutationObserver(() => {\n if (resolveObservedElements()) {\n mutationObserver?.disconnect();\n mutationObserver = null;\n scheduleSync();\n }\n });\n mutationObserver.observe(container, { childList: true, subtree: true });\n }\n\n return () => {\n cancelAnimationFrame(frame);\n observer?.disconnect();\n mutationObserver?.disconnect();\n viewport.removeEventListener(\"scroll\", scheduleSync);\n clearDragState();\n };\n }, [clearDragState, resetMetrics, syncCustomVerticalScrollbar, usesCustomVerticalScrollbar]);\n\n const scrollToThumbOffset = (nextThumbTop: number) => {\n const viewport = viewportRef.current;\n const { thumbHeight, trackHeight } = metricsRef.current;\n\n if (!viewport) return;\n\n const maxScroll = Math.max(0, viewport.scrollHeight - viewport.clientHeight);\n const maxThumbTop = Math.max(0, trackHeight - thumbHeight);\n\n if (maxScroll === 0 || maxThumbTop === 0) {\n viewport.scrollTop = 0;\n return;\n }\n\n const ratio = clamp(nextThumbTop, 0, maxThumbTop) / maxThumbTop;\n viewport.scrollTop = ratio * maxScroll;\n };\n\n const handleThumbPointerDown = (event: PointerEvent<HTMLDivElement>) => {\n const viewport = viewportRef.current;\n\n if (!viewport) return;\n\n event.preventDefault();\n event.stopPropagation();\n event.currentTarget.setPointerCapture(event.pointerId);\n\n dragRef.current = {\n pointerId: event.pointerId,\n startScrollTop: viewport.scrollTop,\n startY: event.clientY,\n };\n\n document.body.style.userSelect = \"none\";\n document.body.style.webkitUserSelect = \"none\";\n };\n\n const handleThumbPointerMove = (event: PointerEvent<HTMLDivElement>) => {\n const viewport = viewportRef.current;\n const dragState = dragRef.current;\n const { thumbHeight, trackHeight } = metricsRef.current;\n\n if (!viewport || !dragState || dragState.pointerId !== event.pointerId) {\n return;\n }\n\n const maxThumbTop = Math.max(0, trackHeight - thumbHeight);\n const maxScroll = Math.max(0, viewport.scrollHeight - viewport.clientHeight);\n\n if (maxThumbTop === 0 || maxScroll === 0) return;\n\n const deltaY = event.clientY - dragState.startY;\n const nextScrollTop = dragState.startScrollTop + (deltaY / maxThumbTop) * maxScroll;\n\n viewport.scrollTop = clamp(nextScrollTop, 0, maxScroll);\n };\n\n const handleThumbPointerUp = (event: PointerEvent<HTMLDivElement>) => {\n if (dragRef.current?.pointerId !== event.pointerId) return;\n clearDragState();\n };\n\n const handleTrackPointerDown = (event: PointerEvent<HTMLDivElement>) => {\n const { thumbHeight } = metricsRef.current;\n\n if (event.target !== event.currentTarget) return;\n\n event.preventDefault();\n event.stopPropagation();\n\n const rect = event.currentTarget.getBoundingClientRect();\n const offsetY = event.clientY - rect.top - thumbHeight / 2;\n\n scrollToThumbOffset(offsetY);\n };\n\n return (\n <DirectionProvider direction={isLayoutRtl ? \"rtl\" : inheritedDirection}>\n <div ref={containerRef} className=\"relative\">\n <ScrollAreaPrimitive.Root\n data-slot=\"data-grid-scroll-area\"\n // Styling hook: present while the sticky-header scroll mode detects\n // vertical overflow, so consumers can style scrollable vs short\n // grids with a plain ancestor attribute selector.\n data-overflow-vertical={hasCustomVerticalOverflow ? \"true\" : undefined}\n className={cn(\"relative\", className)}\n {...props}\n >\n <ScrollAreaPrimitive.Viewport\n ref={viewportRef}\n data-slot=\"scroll-area-viewport\"\n className=\"size-full\"\n >\n <ScrollAreaPrimitive.Content data-slot=\"scroll-area-content\">\n {children}\n </ScrollAreaPrimitive.Content>\n </ScrollAreaPrimitive.Viewport>\n\n {showHorizontal && (\n <ScrollAreaPrimitive.Scrollbar\n data-slot=\"data-grid-scrollbar\"\n data-orientation=\"horizontal\"\n orientation=\"horizontal\"\n className={SCROLLBAR_CLASSNAME}\n style={\n scrollbarInsetStart > 0 || scrollbarInsetEnd > 0\n ? {\n marginInlineStart: scrollbarInsetStart || undefined,\n marginInlineEnd: scrollbarInsetEnd || undefined,\n }\n : undefined\n }\n >\n <ScrollAreaPrimitive.Thumb\n data-slot=\"data-grid-thumb\"\n className={SCROLLBAR_THUMB_CLASSNAME}\n />\n </ScrollAreaPrimitive.Scrollbar>\n )}\n\n {showVertical && !usesCustomVerticalScrollbar && (\n <ScrollAreaPrimitive.Scrollbar\n data-slot=\"data-grid-scrollbar\"\n data-orientation=\"vertical\"\n orientation=\"vertical\"\n className={SCROLLBAR_CLASSNAME}\n >\n <ScrollAreaPrimitive.Thumb\n data-slot=\"data-grid-thumb\"\n className={SCROLLBAR_THUMB_CLASSNAME}\n />\n </ScrollAreaPrimitive.Scrollbar>\n )}\n </ScrollAreaPrimitive.Root>\n\n {usesCustomVerticalScrollbar && hasCustomVerticalOverflow && (\n <div\n ref={setOverlayRef}\n aria-hidden=\"true\"\n className=\"pointer-events-none absolute inset-e-px top-(--data-grid-scrollbar-header-height) z-20 h-(--data-grid-scrollbar-track-height)\"\n >\n <div\n className=\"pointer-events-auto relative h-full w-(--data-grid-scrollbar-size,0.625rem) touch-none p-px\"\n onPointerDown={handleTrackPointerDown}\n >\n <div\n className={cn(\n \"absolute end-px w-[calc(var(--data-grid-scrollbar-size,0.625rem)-0.1875rem)] bg-border\",\n \"top-(--data-grid-scrollbar-thumb-top) h-(--data-grid-scrollbar-thumb-height)\",\n \"rounded-full before:absolute before:-inset-0.5\",\n )}\n onLostPointerCapture={clearDragState}\n onPointerCancel={handleThumbPointerUp}\n onPointerDown={handleThumbPointerDown}\n onPointerMove={handleThumbPointerMove}\n onPointerUp={handleThumbPointerUp}\n />\n </div>\n </div>\n )}\n </div>\n </DirectionProvider>\n );\n}\n\nexport type { DataGridScrollAreaOrientation, DataGridScrollAreaProps };\nexport { DataGridScrollArea };\n"],"mappings":";;;;;;;;AAUA,MAAM,iBAAiB;AACvB,MAAM,0BAA0B;AAGhC,MAAM,qBAAqB;AAE3B,MAAM,kBAAkB;CACtB,qBAAqB;CACrB,cAAc;CACd,yBAAyB;CACzB,aAAa;CACb,UAAU;CACV,aAAa;AACf;AAOA,MAAM,sBACJ;AAIF,MAAM,4BACJ;AAyBF,SAAS,MAAM,OAAe,KAAa,KAAa;CACtD,OAAO,KAAK,IAAI,KAAK,KAAK,IAAI,KAAK,KAAK,CAAC;AAC3C;AAEA,SAAS,gBAAgB,MAAwB,MAAwB;CACvE,OACE,KAAK,wBAAwB,KAAK,uBAClC,KAAK,iBAAiB,KAAK,gBAC3B,KAAK,4BAA4B,KAAK,2BACtC,KAAK,gBAAgB,KAAK,eAC1B,KAAK,aAAa,KAAK,YACvB,KAAK,gBAAgB,KAAK;AAE9B;AAEA,SAAS,aAAa,SAAsB,SAA2B;CACrE,QAAQ,MAAM,YAAY,uCAAuC,GAAG,QAAQ,aAAa,GAAG;CAC5F,QAAQ,MAAM,YAAY,sCAAsC,GAAG,QAAQ,YAAY,GAAG;CAC1F,QAAQ,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,oBAAoB,IAC3C;OACE,mBAAmB,uBAAuB,KAAA;OAC1C,iBAAiB,qBAAqB,KAAA;MACxC,IACA,KAAA;MAGN,UAAA,oBAACA,WAAoB,OAArB;OACE,aAAU;OACV,WAAW;MACZ,CAAA;KAC4B,CAAA;KAGhC,gBAAgB,CAAC,+BAChB,oBAACA,WAAoB,WAArB;MACE,aAAU;MACV,oBAAiB;MACjB,aAAY;MACZ,WAAW;MAEX,UAAA,oBAACA,WAAoB,OAArB;OACE,aAAU;OACV,WAAW;MACZ,CAAA;KAC4B,CAAA;IAET;GAEzB,CAAA,GAAA,+BAA+B,6BAC9B,oBAAC,OAAD;IACE,KAAK;IACL,eAAY;IACZ,WAAU;IAEV,UAAA,oBAAC,OAAD;KACE,WAAU;KACV,eAAe;KAEf,UAAA,oBAAC,OAAD;MACE,WAAW,GACT,0FACA,gFACA,gDACF;MACA,sBAAsB;MACtB,iBAAiB;MACjB,eAAe;MACf,eAAe;MACf,aAAa;KACd,CAAA;IACE,CAAA;GACF,CAAA,CAEJ;;CACY,CAAA;AAEvB"}
|
|
1
|
+
{"version":3,"file":"data-grid-scroll-area.js","names":["ScrollAreaPrimitive"],"sources":["../../../../src/components/reui/data-grid/data-grid-scroll-area.tsx"],"sourcesContent":["\"use client\";\n\nimport type { PointerEvent, ReactNode } from \"react\";\nimport { useCallback, useEffect, useLayoutEffect, useRef, useState } from \"react\";\nimport { DirectionProvider, useDirection } from \"@base-ui/react/direction-provider\";\nimport { ScrollArea as ScrollAreaPrimitive } from \"@base-ui/react/scroll-area\";\n\nimport { cn } from \"@kumix/utils\";\nimport { useDataGrid } from \"./data-grid\";\n\nconst MIN_THUMB_SIZE = 24;\nconst FALLBACK_SCROLLBAR_SIZE = 12;\n// Gap between each track and the grid edge: the mb-px / me-px on the tracks and\n// the overlay's inset-e-px. The overlay's height math adds it below the bar.\nconst SCROLLBAR_EDGE_GAP = 1;\n\nconst INITIAL_METRICS = {\n hasVerticalOverflow: false,\n headerHeight: 0,\n horizontalScrollbarSize: 0,\n thumbHeight: 0,\n thumbTop: 0,\n trackHeight: 0,\n} as const;\n\n// Track footprint: --data-grid-scrollbar-size (10px by default) in both\n// orientations, less 1px for the transparent border and 2px for p-px, so every\n// thumb lands at that size less 3px (7px), held 1px off the grid edge. Thinner\n// was hard to grab; the tracks overlay the last row and column, so the default\n// stays under 12px. The sticky-header overlay below follows the same variable.\nconst SCROLLBAR_CLASSNAME =\n \"flex touch-none p-px transition-colors select-none data-[orientation=horizontal]:mb-px data-[orientation=horizontal]:h-[var(--data-grid-scrollbar-size,0.625rem)] data-[orientation=horizontal]:flex-col data-[orientation=horizontal]:border-t data-[orientation=horizontal]:border-t-transparent data-[orientation=vertical]:me-px data-[orientation=vertical]:h-full data-[orientation=vertical]:w-[var(--data-grid-scrollbar-size,0.625rem)] data-[orientation=vertical]:border-s data-[orientation=vertical]:border-s-transparent\";\n\n// The ::before reaches the track's outer edge, so the whole track thickness\n// grabs the thumb rather than only its painted 7px.\nconst SCROLLBAR_THUMB_CLASSNAME =\n \"bg-border rounded-full relative flex-1 before:absolute before:-inset-0.5\";\n\ntype DataGridScrollAreaOrientation = \"horizontal\" | \"vertical\" | \"both\";\n\ntype ScrollbarMetrics = {\n hasVerticalOverflow: boolean;\n headerHeight: number;\n horizontalScrollbarSize: number;\n thumbHeight: number;\n thumbTop: number;\n trackHeight: number;\n};\n\ntype ObservedElements = {\n header: HTMLElement | null;\n horizontalScrollbar: HTMLElement | null;\n table: HTMLElement | null;\n tableViewport: HTMLElement | null;\n};\n\ntype DataGridScrollAreaProps = Omit<ScrollAreaPrimitive.Root.Props, \"children\"> & {\n children: ReactNode;\n orientation?: DataGridScrollAreaOrientation;\n};\n\nfunction clamp(value: number, min: number, max: number) {\n return Math.min(max, Math.max(min, value));\n}\n\nfunction areMetricsEqual(next: ScrollbarMetrics, prev: ScrollbarMetrics) {\n return (\n next.hasVerticalOverflow === prev.hasVerticalOverflow &&\n next.headerHeight === prev.headerHeight &&\n next.horizontalScrollbarSize === prev.horizontalScrollbarSize &&\n next.thumbHeight === prev.thumbHeight &&\n next.thumbTop === prev.thumbTop &&\n next.trackHeight === prev.trackHeight\n );\n}\n\n// A footer held at the bottom (its tfoot or its cells are sticky, however the\n// consumer made them so) takes the track's lower end the way the sticky header\n// takes its top, so the thumb never paints over the totals.\nfunction getStickyFooterHeight(table: HTMLElement | null) {\n const footer = table instanceof HTMLTableElement ? table.tFoot : null;\n if (!footer) return 0;\n\n const isSticky = [footer, footer.rows[0]?.cells[0]].some(\n (element) => element && getComputedStyle(element).position === \"sticky\",\n );\n return isSticky ? footer.getBoundingClientRect().height : 0;\n}\n\nfunction applyMetrics(element: HTMLElement, metrics: ScrollbarMetrics) {\n element.style.setProperty(\"--data-grid-scrollbar-header-height\", `${metrics.headerHeight}px`);\n element.style.setProperty(\"--data-grid-scrollbar-thumb-height\", `${metrics.thumbHeight}px`);\n element.style.setProperty(\"--data-grid-scrollbar-thumb-top\", `${metrics.thumbTop}px`);\n element.style.setProperty(\"--data-grid-scrollbar-track-height\", `${metrics.trackHeight}px`);\n}\n\nfunction DataGridScrollArea({\n children,\n className,\n orientation = \"both\",\n ...props\n}: DataGridScrollAreaProps) {\n const { props: dataGridProps, table } = useDataGrid();\n const containerRef = useRef<HTMLDivElement>(null);\n const overlayRef = useRef<HTMLDivElement | null>(null);\n const viewportRef = useRef<HTMLDivElement | null>(null);\n const dragRef = useRef<{\n pointerId: number;\n startScrollTop: number;\n startY: number;\n } | null>(null);\n const metricsRef = useRef<ScrollbarMetrics>(INITIAL_METRICS);\n const observedElementsRef = useRef<ObservedElements>({\n header: null,\n horizontalScrollbar: null,\n table: null,\n tableViewport: null,\n });\n\n const showHorizontal = orientation !== \"vertical\";\n const showVertical = orientation !== \"horizontal\";\n const usesCustomVerticalScrollbar = showVertical && !!dataGridProps.tableLayout?.headerSticky;\n // Pinned columns are sticky and never scroll, so the horizontal scrollbar\n // track is inset to span only the scrollable center region between them.\n const isColumnsPinnable = !!dataGridProps.tableLayout?.columnsPinnable;\n const scrollbarInsetStart = isColumnsPinnable ? table.getStartTotalSize() : 0;\n const scrollbarInsetEnd = isColumnsPinnable ? table.getEndTotalSize() : 0;\n const [hasCustomVerticalOverflow, setHasCustomVerticalOverflow] = useState(false);\n\n // Base UI's thumb math reads direction from its own context, which a Radix\n // app or a bare dir=\"rtl\" page never provides, so RTL scrolled with LTR math\n // and the thumb froze. RTL is read off the layout instead, so no provider of\n // any kind is needed. LTR passes the inherited value through untouched: no\n // state change and no extra render, exactly as before this existed.\n const inheritedDirection = useDirection();\n const [isLayoutRtl, setIsLayoutRtl] = useState(false);\n\n useLayoutEffect(() => {\n const container = containerRef.current;\n if (!container) return;\n\n const readDirection = () => {\n const next = getComputedStyle(container).direction === \"rtl\";\n setIsLayoutRtl((prev) => (prev === next ? prev : next));\n };\n\n readDirection();\n if (typeof MutationObserver === \"undefined\") return;\n\n // Only a dir attribute flips it at runtime (an RTL toggle on <html>).\n const observer = new MutationObserver(readDirection);\n observer.observe(document.documentElement, {\n attributes: true,\n attributeFilter: [\"dir\"],\n subtree: true,\n });\n return () => observer.disconnect();\n }, []);\n\n const clearDragState = useCallback(() => {\n dragRef.current = null;\n document.body.style.userSelect = \"\";\n document.body.style.webkitUserSelect = \"\";\n }, []);\n\n // The overlay is mounted one commit after the sync that detected overflow,\n // so it misses that sync's write. Seeding it from the ref callback lands the\n // geometry during commit, before the browser paints the track.\n const setOverlayRef = useCallback((node: HTMLDivElement | null) => {\n overlayRef.current = node;\n\n if (node) applyMetrics(node, metricsRef.current);\n }, []);\n\n const resetMetrics = useCallback(() => {\n if (!areMetricsEqual(INITIAL_METRICS, metricsRef.current)) {\n metricsRef.current = INITIAL_METRICS;\n if (overlayRef.current) applyMetrics(overlayRef.current, INITIAL_METRICS);\n }\n\n setHasCustomVerticalOverflow((prev) => (prev ? false : prev));\n }, []);\n\n const syncCustomVerticalScrollbar = useCallback(() => {\n const container = containerRef.current;\n const viewport = viewportRef.current;\n\n if (!container || !viewport || !usesCustomVerticalScrollbar) {\n resetMetrics();\n return;\n }\n\n const { header, horizontalScrollbar, table } = observedElementsRef.current;\n const headerHeight = header?.getBoundingClientRect().height ?? 0;\n const footerHeight = getStickyFooterHeight(table);\n const viewportHeight = viewport.clientHeight;\n const viewportWidth = viewport.clientWidth;\n const scrollHeight = viewport.scrollHeight;\n const scrollWidth = viewport.scrollWidth;\n const hasHorizontalOverflow = showHorizontal && scrollWidth > viewportWidth + 0.5;\n const horizontalScrollbarSize = hasHorizontalOverflow\n ? (horizontalScrollbar?.offsetHeight || FALLBACK_SCROLLBAR_SIZE) + SCROLLBAR_EDGE_GAP\n : 0;\n // The horizontal bar overlays the bottom of the viewport, which a sticky\n // footer already covers, so only the larger of the two is taken off.\n const trackHeight = Math.max(\n 0,\n viewportHeight - headerHeight - Math.max(footerHeight, horizontalScrollbarSize),\n );\n const maxScroll = Math.max(0, scrollHeight - viewportHeight);\n\n let nextMetrics: ScrollbarMetrics;\n\n if (trackHeight === 0 || maxScroll === 0) {\n nextMetrics = {\n hasVerticalOverflow: false,\n headerHeight,\n horizontalScrollbarSize,\n thumbHeight: trackHeight,\n thumbTop: 0,\n trackHeight,\n };\n } else {\n const bodyContentHeight = Math.max(trackHeight, scrollHeight - headerHeight - footerHeight);\n const thumbHeight = clamp(\n trackHeight * (trackHeight / bodyContentHeight),\n MIN_THUMB_SIZE,\n trackHeight,\n );\n const maxThumbTop = Math.max(0, trackHeight - thumbHeight);\n const thumbTop = maxThumbTop > 0 ? (viewport.scrollTop / maxScroll) * maxThumbTop : 0;\n\n nextMetrics = {\n hasVerticalOverflow: true,\n headerHeight,\n horizontalScrollbarSize,\n thumbHeight,\n thumbTop,\n trackHeight,\n };\n }\n\n if (!areMetricsEqual(nextMetrics, metricsRef.current)) {\n metricsRef.current = nextMetrics;\n // Scoped to the overlay, never to the container. These four properties\n // inherit, and thumbTop changes on essentially every scroll frame, so\n // writing them on the element that wraps the whole grid invalidates\n // computed style for every row and cell each frame. The overlay subtree\n // is their only reader.\n if (overlayRef.current) applyMetrics(overlayRef.current, nextMetrics);\n }\n\n setHasCustomVerticalOverflow((prev) =>\n prev === nextMetrics.hasVerticalOverflow ? prev : nextMetrics.hasVerticalOverflow,\n );\n }, [resetMetrics, showHorizontal, usesCustomVerticalScrollbar]);\n\n useEffect(() => {\n const container = containerRef.current;\n const viewport = viewportRef.current;\n\n if (!container || !viewport) return;\n\n if (!usesCustomVerticalScrollbar) {\n resetMetrics();\n return;\n }\n\n let frame = 0;\n\n const scheduleSync = () => {\n cancelAnimationFrame(frame);\n frame = window.requestAnimationFrame(syncCustomVerticalScrollbar);\n };\n\n const observer =\n typeof ResizeObserver === \"undefined\" ? null : new ResizeObserver(scheduleSync);\n const observed = new Set<HTMLElement>();\n\n const observeElement = (element: HTMLElement | null) => {\n if (element && observer && !observed.has(element)) {\n observer.observe(element);\n observed.add(element);\n }\n };\n\n const resolveObservedElements = () => {\n observedElementsRef.current = {\n header: container.querySelector(\n '[data-slot=\"data-grid-table\"] thead',\n ) as HTMLElement | null,\n horizontalScrollbar: container.querySelector(\n '[data-slot=\"data-grid-scrollbar\"][data-orientation=\"horizontal\"]',\n ) as HTMLElement | null,\n table: container.querySelector('[data-slot=\"data-grid-table\"]') as HTMLElement | null,\n tableViewport: container.querySelector(\n '[data-slot=\"data-grid-table-viewport\"]',\n ) as HTMLElement | null,\n };\n\n observeElement(observedElementsRef.current.header);\n observeElement(observedElementsRef.current.table);\n observeElement(observedElementsRef.current.tableViewport);\n\n return !!(observedElementsRef.current.header && observedElementsRef.current.table);\n };\n\n observeElement(viewport);\n const resolvedOnMount = resolveObservedElements();\n\n scheduleSync();\n viewport.addEventListener(\"scroll\", scheduleSync, { passive: true });\n\n // A table that mounts after this effect (empty state swapped for data)\n // would otherwise never be observed and the custom scrollbar would\n // overlap the sticky header. One-shot: disconnects once resolved.\n let mutationObserver: MutationObserver | null = null;\n if (!resolvedOnMount && typeof MutationObserver !== \"undefined\") {\n mutationObserver = new MutationObserver(() => {\n if (resolveObservedElements()) {\n mutationObserver?.disconnect();\n mutationObserver = null;\n scheduleSync();\n }\n });\n mutationObserver.observe(container, { childList: true, subtree: true });\n }\n\n return () => {\n cancelAnimationFrame(frame);\n observer?.disconnect();\n mutationObserver?.disconnect();\n viewport.removeEventListener(\"scroll\", scheduleSync);\n clearDragState();\n };\n }, [clearDragState, resetMetrics, syncCustomVerticalScrollbar, usesCustomVerticalScrollbar]);\n\n const scrollToThumbOffset = (nextThumbTop: number) => {\n const viewport = viewportRef.current;\n const { thumbHeight, trackHeight } = metricsRef.current;\n\n if (!viewport) return;\n\n const maxScroll = Math.max(0, viewport.scrollHeight - viewport.clientHeight);\n const maxThumbTop = Math.max(0, trackHeight - thumbHeight);\n\n if (maxScroll === 0 || maxThumbTop === 0) {\n viewport.scrollTop = 0;\n return;\n }\n\n const ratio = clamp(nextThumbTop, 0, maxThumbTop) / maxThumbTop;\n viewport.scrollTop = ratio * maxScroll;\n };\n\n const handleThumbPointerDown = (event: PointerEvent<HTMLDivElement>) => {\n const viewport = viewportRef.current;\n\n if (!viewport) return;\n\n event.preventDefault();\n event.stopPropagation();\n event.currentTarget.setPointerCapture(event.pointerId);\n\n dragRef.current = {\n pointerId: event.pointerId,\n startScrollTop: viewport.scrollTop,\n startY: event.clientY,\n };\n\n document.body.style.userSelect = \"none\";\n document.body.style.webkitUserSelect = \"none\";\n };\n\n const handleThumbPointerMove = (event: PointerEvent<HTMLDivElement>) => {\n const viewport = viewportRef.current;\n const dragState = dragRef.current;\n const { thumbHeight, trackHeight } = metricsRef.current;\n\n if (!viewport || !dragState || dragState.pointerId !== event.pointerId) {\n return;\n }\n\n const maxThumbTop = Math.max(0, trackHeight - thumbHeight);\n const maxScroll = Math.max(0, viewport.scrollHeight - viewport.clientHeight);\n\n if (maxThumbTop === 0 || maxScroll === 0) return;\n\n const deltaY = event.clientY - dragState.startY;\n const nextScrollTop = dragState.startScrollTop + (deltaY / maxThumbTop) * maxScroll;\n\n viewport.scrollTop = clamp(nextScrollTop, 0, maxScroll);\n };\n\n const handleThumbPointerUp = (event: PointerEvent<HTMLDivElement>) => {\n if (dragRef.current?.pointerId !== event.pointerId) return;\n clearDragState();\n };\n\n const handleTrackPointerDown = (event: PointerEvent<HTMLDivElement>) => {\n const { thumbHeight } = metricsRef.current;\n\n if (event.target !== event.currentTarget) return;\n\n event.preventDefault();\n event.stopPropagation();\n\n const rect = event.currentTarget.getBoundingClientRect();\n const offsetY = event.clientY - rect.top - thumbHeight / 2;\n\n scrollToThumbOffset(offsetY);\n };\n\n return (\n <DirectionProvider direction={isLayoutRtl ? \"rtl\" : inheritedDirection}>\n <div ref={containerRef} className=\"relative\">\n <ScrollAreaPrimitive.Root\n data-slot=\"data-grid-scroll-area\"\n // Styling hook: present while the sticky-header scroll mode detects\n // vertical overflow, so consumers can style scrollable vs short\n // grids with a plain ancestor attribute selector.\n data-overflow-vertical={hasCustomVerticalOverflow ? \"true\" : undefined}\n className={cn(\"relative\", className)}\n {...props}\n >\n <ScrollAreaPrimitive.Viewport\n ref={viewportRef}\n data-slot=\"scroll-area-viewport\"\n className=\"size-full\"\n >\n <ScrollAreaPrimitive.Content data-slot=\"scroll-area-content\">\n {children}\n </ScrollAreaPrimitive.Content>\n </ScrollAreaPrimitive.Viewport>\n\n {showHorizontal && (\n <ScrollAreaPrimitive.Scrollbar\n data-slot=\"data-grid-scrollbar\"\n data-orientation=\"horizontal\"\n orientation=\"horizontal\"\n className={SCROLLBAR_CLASSNAME}\n style={\n scrollbarInsetStart > 0 || scrollbarInsetEnd > 0\n ? {\n marginInlineStart: scrollbarInsetStart || undefined,\n marginInlineEnd: scrollbarInsetEnd || undefined,\n }\n : undefined\n }\n >\n <ScrollAreaPrimitive.Thumb\n data-slot=\"data-grid-thumb\"\n className={SCROLLBAR_THUMB_CLASSNAME}\n />\n </ScrollAreaPrimitive.Scrollbar>\n )}\n\n {showVertical && !usesCustomVerticalScrollbar && (\n <ScrollAreaPrimitive.Scrollbar\n data-slot=\"data-grid-scrollbar\"\n data-orientation=\"vertical\"\n orientation=\"vertical\"\n className={SCROLLBAR_CLASSNAME}\n >\n <ScrollAreaPrimitive.Thumb\n data-slot=\"data-grid-thumb\"\n className={SCROLLBAR_THUMB_CLASSNAME}\n />\n </ScrollAreaPrimitive.Scrollbar>\n )}\n </ScrollAreaPrimitive.Root>\n\n {usesCustomVerticalScrollbar && hasCustomVerticalOverflow && (\n <div\n ref={setOverlayRef}\n aria-hidden=\"true\"\n className=\"pointer-events-none absolute inset-e-px top-(--data-grid-scrollbar-header-height) z-20 h-(--data-grid-scrollbar-track-height)\"\n >\n <div\n className=\"pointer-events-auto relative h-full w-(--data-grid-scrollbar-size,0.625rem) touch-none p-px\"\n onPointerDown={handleTrackPointerDown}\n >\n <div\n className={cn(\n \"absolute end-px w-[calc(var(--data-grid-scrollbar-size,0.625rem)-0.1875rem)] bg-border\",\n \"top-(--data-grid-scrollbar-thumb-top) h-(--data-grid-scrollbar-thumb-height)\",\n \"rounded-full before:absolute before:-inset-0.5\",\n )}\n onLostPointerCapture={clearDragState}\n onPointerCancel={handleThumbPointerUp}\n onPointerDown={handleThumbPointerDown}\n onPointerMove={handleThumbPointerMove}\n onPointerUp={handleThumbPointerUp}\n />\n </div>\n </div>\n )}\n </div>\n </DirectionProvider>\n );\n}\n\nexport type { DataGridScrollAreaOrientation, DataGridScrollAreaProps };\nexport { DataGridScrollArea };\n"],"mappings":";;;;;;;;AAUA,MAAM,iBAAiB;AACvB,MAAM,0BAA0B;AAGhC,MAAM,qBAAqB;AAE3B,MAAM,kBAAkB;CACtB,qBAAqB;CACrB,cAAc;CACd,yBAAyB;CACzB,aAAa;CACb,UAAU;CACV,aAAa;AACf;AAOA,MAAM,sBACJ;AAIF,MAAM,4BACJ;AAyBF,SAAS,MAAM,OAAe,KAAa,KAAa;CACtD,OAAO,KAAK,IAAI,KAAK,KAAK,IAAI,KAAK,KAAK,CAAC;AAC3C;AAEA,SAAS,gBAAgB,MAAwB,MAAwB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ACF;MACA,sBAAsB;MACtB,iBAAiB;MACjB,eAAe;MACf,eAAe;MACf,aAAa;KACd,CAAA;IACE,CAAA;GACF,CAAA,CAEJ;;CACY,CAAA;AAEvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-grid-table-dnd-rows.d.ts","names":[],"sources":["../../../../src/components/reui/data-grid/data-grid-table-dnd-rows.tsx"],"mappings":";;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"data-grid-table-dnd-rows.d.ts","names":[],"sources":["../../../../src/components/reui/data-grid/data-grid-table-dnd-rows.tsx"],"mappings":";;;;;;;;;;;KAqFK;EACH;;EAEA;;EAEA;;EAEA;;;;;;;KAQG,8BAA8B,yBAAyB;EAC1D,KAAK,IAAI,kBAAkB;EAC3B;EACA;MACI;iBAEG,4BACP,WACA,UACA;EAEA;;;;;;;EAOA;;EAEA;oBACD,IAAA;iBAkRQ,qBAAqB,wBAC5B,eACA,SACA,eACA,oBACA,WACA,iBACA,qBACA,eACA,aACA,YACA,YACA,cACA;EAEA,gBAAgB,OAAO;EACvB,SAAS;EACT,gBAAgB;;EAEhB,qBAAqB;;;;;;;EAOrB,YAAY;;;;;;;;;;EAUZ,kBAAkB;;EAElB,sBAAsB,8BAA8B;;;;;;EAMpD;EACA,eAAe,OAAO;EACtB,cAAc,OAAO;EACrB,cAAc,OAAO;EACrB,gBAAgB,OAAO;;;;;EAKvB,gBAAgB;oBACjB,IAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Button } from "../../ui/button.js";
|
|
3
3
|
import { useDataGrid } from "./data-grid.js";
|
|
4
|
-
import { DataGridTableBase, DataGridTableBody, DataGridTableBodyRow, DataGridTableBodyRowCell, DataGridTableBodyRowExpandded, DataGridTableBodyRowSkeleton, DataGridTableBodyRowSkeletonCell, DataGridTableEmpty, DataGridTableFillBodyCell, DataGridTableFillHeadCell, DataGridTableFoot, DataGridTableHead, DataGridTableHeadRow, DataGridTableHeadRowCell, DataGridTableHeadRowCellResize, DataGridTableRowSpacer, DataGridTableViewport } from "./data-grid-table.js";
|
|
4
|
+
import { DataGridTableBase, DataGridTableBody, DataGridTableBodyRow, DataGridTableBodyRowCell, DataGridTableBodyRowExpandded, DataGridTableBodyRowSkeleton, DataGridTableBodyRowSkeletonCell, DataGridTableEmpty, DataGridTableFillBodyCell, DataGridTableFillHeadCell, DataGridTableFoot, DataGridTableHead, DataGridTableHeadRow, DataGridTableHeadRowCell, DataGridTableHeadRowCellResize, DataGridTableRowSpacer, DataGridTableViewport, getDataGridHeadCellResizeHeader, getDataGridTableMergedHeaderGroups, renderDataGridTableHeadCellContent } from "./data-grid-table.js";
|
|
5
5
|
import { createContext, memo, useCallback, useContext, useEffect, useId, useMemo, useRef, useState } from "react";
|
|
6
6
|
import { cn } from "@kumix/utils";
|
|
7
7
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -110,6 +110,7 @@ function DataGridTableDndRow({ row, renderRowDecoration, dropIndicator = true })
|
|
|
110
110
|
row,
|
|
111
111
|
dndRef: setNodeRef,
|
|
112
112
|
dndStyle: style,
|
|
113
|
+
dndDragging: isDragging,
|
|
113
114
|
children: [
|
|
114
115
|
...cells.filter((cell) => cell.column.getIsPinned() !== "end").map(renderCell),
|
|
115
116
|
/* @__PURE__ */ jsx(DataGridTableFillBodyCell, {}, "__data-grid-fill"),
|
|
@@ -153,6 +154,7 @@ function DataGridTableDndRowsBody({ table, dataIds, renderRowDecoration, dropInd
|
|
|
153
154
|
const MemoizedDataGridTableDndRowsBody = memo(DataGridTableDndRowsBody, (_prev, next) => !!next.table.state.columnResizing.isResizingColumn);
|
|
154
155
|
function DataGridTableDndRows({ handleDragEnd, dataIds, footerContent, collisionDetection = closestCenter, modifiers, sortingStrategy = holdRowsInPlaceStrategy, renderRowDecoration, dropIndicator = true, onDragStart, onDragMove, onDragOver, onDragCancel, accessibility }) {
|
|
155
156
|
const { table, props } = useDataGrid();
|
|
157
|
+
const mergedHeaderGroups = getDataGridTableMergedHeaderGroups(table);
|
|
156
158
|
const tableContainerRef = useRef(null);
|
|
157
159
|
const [isDraggingRow, setIsDraggingRow] = useState(false);
|
|
158
160
|
const [portalTarget, setPortalTarget] = useState(null);
|
|
@@ -169,7 +171,7 @@ function DataGridTableDndRows({ handleDragEnd, dataIds, footerContent, collision
|
|
|
169
171
|
}
|
|
170
172
|
const source = Array.from(container.querySelectorAll("tbody tr[data-row-id]")).find((candidate) => candidate.dataset.rowId === String(id));
|
|
171
173
|
const height = source?.getBoundingClientRect().height ?? 0;
|
|
172
|
-
const columns = Array.from(head.children).filter((cell) => cell.getAttribute("data-slot") !== "data-grid-table-fill-head-cell").map((cell) => cell.getBoundingClientRect().width);
|
|
174
|
+
const columns = Array.from(source?.children ?? head.children).filter((cell) => cell.getAttribute("data-slot") !== "data-grid-table-fill-body-cell" && cell.getAttribute("data-slot") !== "data-grid-table-fill-head-cell").map((cell) => cell.getBoundingClientRect().width);
|
|
173
175
|
const padding = Array.from(source?.children ?? []).filter((cell) => cell.getAttribute("data-slot") !== "data-grid-table-fill-body-cell").map((cell) => {
|
|
174
176
|
const style = getComputedStyle(cell);
|
|
175
177
|
return {
|
|
@@ -243,20 +245,22 @@ function DataGridTableDndRows({ handleDragEnd, dataIds, footerContent, collision
|
|
|
243
245
|
viewportRef: tableContainerRef,
|
|
244
246
|
className: isDraggingRow ? "relative cursor-grabbing **:cursor-grabbing!" : "relative",
|
|
245
247
|
children: /* @__PURE__ */ jsxs(DataGridTableBase, { children: [
|
|
246
|
-
/* @__PURE__ */ jsx(DataGridTableHead, { children:
|
|
248
|
+
/* @__PURE__ */ jsx(DataGridTableHead, { children: mergedHeaderGroups.map((headerGroup, index) => {
|
|
247
249
|
const renderHeader = (header) => {
|
|
248
|
-
const
|
|
250
|
+
const coveredHeaders = headerGroup.coveredHeaders.get(header.id);
|
|
251
|
+
const resizeHeader = getDataGridHeadCellResizeHeader(header, coveredHeaders);
|
|
249
252
|
return /* @__PURE__ */ jsxs(DataGridTableHeadRowCell, {
|
|
250
253
|
header,
|
|
251
|
-
|
|
254
|
+
coveredHeaders,
|
|
255
|
+
children: [renderDataGridTableHeadCellContent(header), props.tableLayout?.columnsResizable && resizeHeader.column.getCanResize() && /* @__PURE__ */ jsx(DataGridTableHeadRowCellResize, { header: resizeHeader })]
|
|
252
256
|
}, header.id);
|
|
253
257
|
};
|
|
254
258
|
return /* @__PURE__ */ jsx(DataGridTableHeadRow, {
|
|
255
259
|
rowId: headerGroup.id,
|
|
256
260
|
children: [
|
|
257
|
-
...headerGroup.
|
|
258
|
-
/* @__PURE__ */ jsx(DataGridTableFillHeadCell, {}, "__data-grid-fill"),
|
|
259
|
-
...headerGroup.
|
|
261
|
+
...[...headerGroup.startHeaders, ...headerGroup.centerHeaders].map(renderHeader),
|
|
262
|
+
...index === 0 ? [/* @__PURE__ */ jsx(DataGridTableFillHeadCell, { rowSpan: mergedHeaderGroups.length }, "__data-grid-fill")] : [],
|
|
263
|
+
...headerGroup.endHeaders.map(renderHeader)
|
|
260
264
|
]
|
|
261
265
|
}, index);
|
|
262
266
|
}) }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-grid-table-dnd-rows.js","names":[],"sources":["../../../../src/components/reui/data-grid/data-grid-table-dnd-rows.tsx"],"sourcesContent":["\"use client\";\n\nimport type { CSSProperties, ReactNode } from \"react\";\nimport {\n createContext,\n memo,\n useCallback,\n useContext,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport {\n type CollisionDetection,\n closestCenter,\n DndContext,\n type DndContextProps,\n type DragCancelEvent,\n type DragEndEvent,\n type DragMoveEvent,\n type DragOverEvent,\n DragOverlay,\n type DragStartEvent,\n KeyboardSensor,\n type Modifier,\n MouseSensor,\n TouchSensor,\n type UniqueIdentifier,\n useSensor,\n useSensors,\n} from \"@dnd-kit/core\";\nimport { restrictToVerticalAxis } from \"@dnd-kit/modifiers\";\nimport {\n SortableContext,\n type SortingStrategy,\n sortableKeyboardCoordinates,\n useSortable,\n} from \"@dnd-kit/sortable\";\nimport { CSS } from \"@dnd-kit/utilities\";\nimport type { Cell, Header, HeaderGroup, Row } from \"@tanstack/react-table\";\nimport { flexRender } from \"@tanstack/react-table\";\nimport { GripHorizontalIcon } from \"lucide-react\";\nimport { createPortal } from \"react-dom\";\n\nimport { cn } from \"@kumix/utils\";\nimport { Button } from \"../../ui/button\";\nimport type { DataGridFeatures, DataGridTableInstance } from \"./data-grid\";\nimport { useDataGrid } from \"./data-grid\";\nimport {\n DataGridTableBase,\n DataGridTableBody,\n DataGridTableBodyRow,\n DataGridTableBodyRowCell,\n DataGridTableBodyRowExpandded,\n DataGridTableBodyRowSkeleton,\n DataGridTableBodyRowSkeletonCell,\n DataGridTableEmpty,\n DataGridTableFillBodyCell,\n DataGridTableFillHeadCell,\n DataGridTableFoot,\n DataGridTableHead,\n DataGridTableHeadRow,\n DataGridTableHeadRowCell,\n DataGridTableHeadRowCellResize,\n DataGridTableRowSpacer,\n DataGridTableViewport,\n} from \"./data-grid-table\";\n\n// Context to share sortable listeners from row to handle\ntype SortableContextValue = ReturnType<typeof useSortable>;\nconst SortableRowContext = createContext<Pick<\n SortableContextValue,\n \"attributes\" | \"listeners\"\n> | null>(null);\n\n/**\n * Tree metadata attached to every sortable row, readable from\n * `active.data.current` / `over.data.current` in any drag event. Cross-parent\n * drops can be resolved from it without re-deriving the shape of the table.\n */\ntype DataGridTableDndRowData = {\n type: \"data-grid-row\";\n /** Tree depth, 0 for root rows. */\n depth: number;\n /** Index within the parent's children, or within the root rows. */\n index: number;\n /** Parent row id, or null for root rows. */\n parentId: string | null;\n};\n\n/**\n * Per-row render slot for drop indicators and depth guides. The returned node\n * is positioned over the row, so it never adds a column, shifts striping, or\n * gets clipped by a truncating resizable cell.\n */\ntype DataGridTableDndRowDecoration<TData extends object> = (context: {\n row: Row<DataGridFeatures, TData>;\n isDragging: boolean;\n isOver: boolean;\n}) => ReactNode;\n\nfunction DataGridTableDndRowHandle({\n className,\n disabled,\n disabledLabel,\n}: {\n className?: string;\n /**\n * Renders the grip inert instead of withdrawing it. A grid that reorders on\n * one truth (manual order) and sorts on another cannot honour both at once,\n * but dropping the handle entirely collapses the gutter and reads as broken\n * rather than as unavailable. Keep the column's shape, mute the control.\n */\n disabled?: boolean;\n /** Announced and shown on hover in place of the drag affordance. */\n disabledLabel?: string;\n}) {\n const { i18n } = useDataGrid();\n const context = useContext(SortableRowContext);\n const resolvedDisabledLabel = disabledLabel ?? i18n.labels.reorderingUnavailable;\n\n if (!context || disabled) {\n return (\n <Button\n variant=\"ghost\"\n size=\"icon-sm\"\n className={cn(\n \"size-7 cursor-grab opacity-70 hover:bg-transparent hover:opacity-100 active:cursor-grabbing\",\n // The Button's own disabled treatment supplies the muting; only the\n // cursor needs saying, so the grip reads as unavailable rather than\n // merely unresponsive.\n disabled && \"cursor-not-allowed\",\n className,\n )}\n aria-label={disabled ? resolvedDisabledLabel : i18n.labels.dragToReorderRow}\n title={disabled ? resolvedDisabledLabel : undefined}\n disabled\n >\n <GripHorizontalIcon aria-hidden=\"true\" />\n </Button>\n );\n }\n\n return (\n <Button\n variant=\"ghost\"\n size=\"icon-sm\"\n className={cn(\n \"size-7 cursor-grab opacity-70 hover:bg-transparent hover:opacity-100 active:cursor-grabbing\",\n className,\n )}\n aria-label={i18n.labels.dragToReorderRow}\n {...context.attributes}\n {...context.listeners}\n >\n <GripHorizontalIcon aria-hidden=\"true\" />\n </Button>\n );\n}\n\n/**\n * The rows do not move while one is being carried.\n *\n * Sliding the siblings apart opens a gap the carried row could go into, which\n * reads well in a list of identical rows and badly in a table: the gap is the\n * height of the row you are holding, so with rows of unequal height it never\n * matches the slot it claims to be, and the row you picked up slides away from\n * where it started - which is exactly the position you need to remember if you\n * decide not to drop it.\n *\n * Holding everything still keeps the origin legible, and nothing is lost: the\n * DragOverlay clone follows the pointer and the drop indicator names the seam.\n * Pass `verticalListSortingStrategy` as `sortingStrategy` for the old feel.\n */\nconst holdRowsInPlaceStrategy: SortingStrategy = () => null;\n\nfunction DataGridTableDndRow<TData extends object>({\n row,\n renderRowDecoration,\n dropIndicator = true,\n}: {\n row: Row<DataGridFeatures, TData>;\n renderRowDecoration?: DataGridTableDndRowDecoration<TData>;\n dropIndicator?: boolean;\n}) {\n const rowData: DataGridTableDndRowData = {\n type: \"data-grid-row\",\n depth: row.depth,\n index: row.index,\n parentId: row.getParentRow()?.id ?? null,\n };\n\n const {\n transform,\n setNodeRef,\n isDragging,\n isOver,\n attributes,\n listeners,\n index,\n activeIndex,\n overIndex,\n } = useSortable({\n id: row.id,\n data: rowData,\n });\n\n // Which edge of THIS row the carried row would land on, or null when it is\n // not the drop target. Nothing slides apart any more, so the bar is the only\n // thing that says where the drop goes: it marks the row at the destination\n // index, on the side the carried row comes to rest.\n //\n // Dragging down it lands after the target, dragging up before it, so the\n // edge follows the direction of travel.\n const dropEdge =\n dropIndicator && activeIndex !== -1 && index === overIndex && !isDragging\n ? activeIndex < overIndex\n ? \"bottom\"\n : \"top\"\n : null;\n\n const style: CSSProperties = {\n transform: CSS.Transform.toString(transform),\n // dnd-kit's transition is deliberately dropped. A transition on a transform\n // property of a `tr` does not merely fail to animate in Chrome, it stops the\n // transform applying at all: the element sits at the start value forever.\n // The drag source escapes it because dnd-kit disables its own transition\n // while it is being dragged, which is why the carried row used to be the\n // ONLY one that moved and every other row silently refused to open a gap.\n // Displacement therefore lands in one step, which is what a table wants.\n zIndex: isDragging ? 1 : 0,\n position: \"relative\",\n cursor: isDragging ? \"grabbing\" : undefined,\n // The row you are holding is drawn by the DragOverlay, so the one left\n // behind is not a second copy of it - it is the slot you came from, and it\n // stays exactly where it was. Fading alone read as \"this row is busy\";\n // the outline says \"this is the space you are moving out of\", which is the\n // thing you need if you change your mind mid-drag.\n ...(isDragging && {\n opacity: 0.4,\n // Inset so the dashes sit inside the row box and cannot be clipped by\n // the neighbouring row's border.\n outline: \"1px dashed var(--border)\",\n outlineOffset: \"-1px\",\n }),\n };\n\n const decoration = renderRowDecoration?.({ row, isDragging, isOver });\n const cells = row.getVisibleCells();\n const lastCell = cells[cells.length - 1];\n\n const renderCell = (cell: Cell<DataGridFeatures, TData, unknown>) => (\n <DataGridTableBodyRowCell cell={cell} key={cell.id}>\n {flexRender(cell.column.columnDef.cell, cell.getContext())}\n {decoration && cell === lastCell ? (\n // Rides inside the last cell rather than in a `td` of its own.\n // An absolutely positioned `td` is still a cell as far as table\n // layout is concerned, so it added a NINTH column with no width\n // of its own, and under `table-layout: fixed` that new column\n // swallowed the whole surplus the real columns had been sharing,\n // so every column snapped back to its declared size and the row's\n // content visibly narrowed the moment a drag began. A plain\n // element adds no column. It anchors to the ROW, the nearest\n // positioned ancestor, and spans the full width, unless the last\n // cell is a sticky end-pinned one: that cell is positioned itself\n // and confines the decoration to its own width.\n <div\n aria-hidden=\"true\"\n data-slot=\"data-grid-table-row-decoration\"\n className=\"pointer-events-none absolute inset-0\"\n >\n {decoration}\n </div>\n ) : null}\n {dropEdge && cell === lastCell ? (\n // Same anchoring trick as the decoration above: a plain\n // element inside the last cell, so it adds no column and\n // cannot disturb `table-layout: fixed`. It spans the row, with\n // the same sticky end-pinned exception.\n <div\n aria-hidden=\"true\"\n data-slot=\"data-grid-table-row-drop-indicator\"\n data-edge={dropEdge}\n className=\"pointer-events-none absolute inset-0 z-20\"\n >\n {/* Two solid pixels down the leading edge, the same marker\n the tree drag uses for its drop target. A wash across\n the row has to stay faint enough not to read as a\n selected row, and in the achromatic styles primary\n carries no chroma at all, so faint plus colourless is\n just grey. The bar reads at any weight and leaves the\n row's own background to hover and selection.\n\n The bar is the whole indicator: the gap the rows have\n already opened says which side, so a rule across the\n seam as well only competes with the row borders it sits\n between. `data-edge` still carries the direction for\n anyone styling their own. */}\n <span className=\"absolute inset-y-0 start-0 w-0.5 bg-primary\" />\n </div>\n ) : null}\n </DataGridTableBodyRowCell>\n );\n\n return (\n <SortableRowContext.Provider value={{ attributes, listeners }}>\n <DataGridTableBodyRow row={row} dndRef={setNodeRef} dndStyle={style}>\n {/* One keyed list with the fill in the middle, as in the head row. */}\n {[\n ...cells.filter((cell) => cell.column.getIsPinned() !== \"end\").map(renderCell),\n <DataGridTableFillBodyCell key=\"__data-grid-fill\" />,\n ...cells.filter((cell) => cell.column.getIsPinned() === \"end\").map(renderCell),\n ]}\n </DataGridTableBodyRow>\n {row.getIsExpanded() && <DataGridTableBodyRowExpandded row={row} />}\n </SortableRowContext.Provider>\n );\n}\n\nfunction DataGridTableDndRowsBody<TData extends object>({\n table,\n dataIds,\n renderRowDecoration,\n dropIndicator,\n sortingStrategy,\n}: {\n table: DataGridTableInstance<TData>;\n dataIds: UniqueIdentifier[];\n renderRowDecoration?: DataGridTableDndRowDecoration<TData>;\n dropIndicator?: boolean;\n sortingStrategy: SortingStrategy;\n}) {\n const { isLoading, props } = useDataGrid();\n const pagination = table.state.pagination;\n\n if (props.loadingMode === \"skeleton\" && isLoading && pagination?.pageSize) {\n return (\n <>\n {Array.from({ length: pagination.pageSize }).map((_, rowIndex) => (\n <DataGridTableBodyRowSkeleton key={rowIndex}>\n {[\n ...[\n ...table.getStartVisibleLeafColumns(),\n ...table.getCenterVisibleLeafColumns(),\n ].map((column) => (\n <DataGridTableBodyRowSkeletonCell column={column} key={column.id}>\n {column.columnDef.meta?.skeleton}\n </DataGridTableBodyRowSkeletonCell>\n )),\n <DataGridTableFillBodyCell key=\"__data-grid-fill\" />,\n ...table.getEndVisibleLeafColumns().map((column) => (\n <DataGridTableBodyRowSkeletonCell column={column} key={column.id}>\n {column.columnDef.meta?.skeleton}\n </DataGridTableBodyRowSkeletonCell>\n )),\n ]}\n </DataGridTableBodyRowSkeleton>\n ))}\n </>\n );\n }\n\n if (!table.getRowModel().rows.length) return <DataGridTableEmpty />;\n\n return (\n <SortableContext items={dataIds} strategy={sortingStrategy}>\n {table.getRowModel().rows.map((row: Row<DataGridFeatures, TData>) => {\n return (\n <DataGridTableDndRow\n row={row}\n renderRowDecoration={renderRowDecoration}\n dropIndicator={dropIndicator}\n key={row.id}\n />\n );\n })}\n </SortableContext>\n );\n}\n\n/**\n * Memoized body rows: skip re-renders during active column resize.\n * Column widths update via CSS variables on the <table> element,\n * so the browser handles width changes without React re-renders.\n */\nconst MemoizedDataGridTableDndRowsBody = memo(\n DataGridTableDndRowsBody,\n (_prev, next) => !!next.table.state.columnResizing.isResizingColumn,\n) as typeof DataGridTableDndRowsBody;\n\nfunction DataGridTableDndRows<TData extends object>({\n handleDragEnd,\n dataIds,\n footerContent,\n collisionDetection = closestCenter,\n modifiers,\n sortingStrategy = holdRowsInPlaceStrategy,\n renderRowDecoration,\n dropIndicator = true,\n onDragStart,\n onDragMove,\n onDragOver,\n onDragCancel,\n accessibility,\n}: {\n handleDragEnd: (event: DragEndEvent) => void;\n dataIds: UniqueIdentifier[];\n footerContent?: ReactNode;\n /** Overrides the default `closestCenter` strategy. */\n collisionDetection?: CollisionDetection;\n /**\n * Replaces the default axis restriction, e.g. drop `restrictToVerticalAxis`\n * to allow the horizontal gesture that tree re-parenting relies on. The\n * table container clamp is always applied after these, so a dragged row\n * cannot leave the grid.\n */\n modifiers?: Modifier[];\n /**\n * Replaces the default `verticalListSortingStrategy`. Return null from a\n * strategy to leave every row exactly where it is. A tree needs that: its drop\n * is either INTO the hovered row or BETWEEN two rows, and which one it is\n * flips as the pointer crosses a single row, so a gap that opens for one and\n * shuts for the other flickers the whole surface. Such a caller draws its own\n * insertion line instead, and pairs this with a modifier that holds the\n * carried row still, since a gap nothing moves into is just a hole.\n */\n sortingStrategy?: SortingStrategy;\n /** Per-row slot for drop indicators and depth guides. */\n renderRowDecoration?: DataGridTableDndRowDecoration<TData>;\n /**\n * Draws a line on the seam the carried row would land on. On by default;\n * pass `false` when `renderRowDecoration` paints its own insertion affordance\n * and the two would compete.\n */\n dropIndicator?: boolean;\n onDragStart?: (event: DragStartEvent) => void;\n onDragMove?: (event: DragMoveEvent) => void;\n onDragOver?: (event: DragOverEvent) => void;\n onDragCancel?: (event: DragCancelEvent) => void;\n /**\n * Forwarded to dnd-kit's `DndContext`: its screen-reader instructions and\n * live-region announcements, which default to dnd-kit's English strings.\n */\n accessibility?: DndContextProps[\"accessibility\"];\n}) {\n const { table, props } = useDataGrid<TData>();\n const tableContainerRef = useRef<HTMLDivElement>(null);\n const [isDraggingRow, setIsDraggingRow] = useState(false);\n // The overlay is portalled to the document body. dnd-kit renders DragOverlay\n // in place, and it positions with `position: fixed` against viewport\n // coordinates - so any ancestor that establishes a containing block for fixed\n // descendants silently re-anchors it. `content-visibility`, `contain`,\n // `transform`, `filter` and `will-change` all do that, and the first two are\n // exactly what a card grid uses to defer off-screen work. The clone then\n // lands offset by that ancestor's own top/left, and the container clamp\n // below mis-clamps too, because its rects are measured in viewport space.\n //\n // Resolved in an effect rather than read at render so the server and the\n // first client render agree. A drag cannot start before hydration, so the\n // overlay being absent for one frame costs nothing.\n const [portalTarget, setPortalTarget] = useState<HTMLElement | null>(null);\n\n useEffect(() => {\n setPortalTarget(document.body);\n }, []);\n // The row being carried, plus the column widths measured off the header the\n // moment the drag starts. The clone lives outside the table, so it has no\n // columns of its own and has to be told what they are.\n const [carried, setCarried] = useState<{\n id: UniqueIdentifier;\n width: number;\n height: number;\n columns: number[];\n padding: { start: string; end: string }[];\n } | null>(null);\n\n const pickUpRow = useCallback((id: UniqueIdentifier) => {\n const container = tableContainerRef.current;\n const head = container?.querySelector(\"thead tr\");\n if (!container || !head) {\n setCarried(null);\n return;\n }\n\n // The clone has to be exactly as tall as the row it was lifted from.\n // A fixed height reads as the grid growing under the pointer the moment\n // you pick a row up, and it is wrong in both directions: rows whose\n // content wraps are taller than any constant, and dense rows are shorter.\n const source = Array.from(\n container.querySelectorAll<HTMLElement>(\"tbody tr[data-row-id]\"),\n ).find((candidate) => candidate.dataset.rowId === String(id));\n const height = source?.getBoundingClientRect().height ?? 0;\n\n // The fill cell is a header-only spacer that soaks up the surplus a column\n // resize leaves behind, and the clone renders data cells only. Measuring it\n // in would make the clone's table wider than the cells it actually holds,\n // and `table-fixed` hands that orphaned width back out across every column\n // -- the carried row comes out visibly wider than the row it was lifted\n // from. So the width is the sum of what we render, never the header's own.\n const columns = Array.from(head.children)\n .filter((cell) => cell.getAttribute(\"data-slot\") !== \"data-grid-table-fill-head-cell\")\n .map((cell) => cell.getBoundingClientRect().width);\n\n // Inline padding is read off the source cells for the same reason. A fixed\n // px-3 ignored edgeCell and cellClassName, so a 44px grip column holding a\n // 28px handle overflowed by 8px and truncate painted an ellipsis beside it.\n const padding = Array.from(source?.children ?? [])\n .filter((cell) => cell.getAttribute(\"data-slot\") !== \"data-grid-table-fill-body-cell\")\n .map((cell) => {\n const style = getComputedStyle(cell);\n return { start: style.paddingInlineStart, end: style.paddingInlineEnd };\n });\n\n setCarried({\n id,\n width: columns.reduce((total, width) => total + width, 0),\n height,\n columns,\n padding,\n });\n }, []);\n\n const carriedRow = carried\n ? table.getRowModel().rows.find((row: Row<DataGridFeatures, TData>) => row.id === carried.id)\n : undefined;\n\n const sensors = useSensors(\n useSensor(MouseSensor, {}),\n useSensor(TouchSensor, {}),\n // Keyboard reordering moves one sortable position per keypress instead\n // of the sensor's raw 25px default.\n useSensor(KeyboardSensor, {\n coordinateGetter: sortableKeyboardCoordinates,\n }),\n );\n\n useEffect(() => {\n if (!isDraggingRow) return;\n\n const { body, documentElement } = document;\n const previousBodyCursor = body.style.cursor;\n const previousDocumentCursor = documentElement.style.cursor;\n\n body.style.cursor = \"grabbing\";\n documentElement.style.cursor = \"grabbing\";\n\n return () => {\n body.style.cursor = previousBodyCursor;\n documentElement.style.cursor = previousDocumentCursor;\n };\n }, [isDraggingRow]);\n\n const resolvedModifiers = useMemo(() => {\n const restrictToTableContainer: Modifier = ({ transform, draggingNodeRect }) => {\n if (!tableContainerRef.current || !draggingNodeRect) {\n return transform;\n }\n\n const containerRect = tableContainerRef.current.getBoundingClientRect();\n const { x, y } = transform;\n\n const minX = containerRect.left - draggingNodeRect.left;\n const maxX = containerRect.right - draggingNodeRect.right;\n const minY = containerRect.top - draggingNodeRect.top;\n const maxY = containerRect.bottom - draggingNodeRect.bottom;\n\n return {\n ...transform,\n // The horizontal rail only engages while the default axis restriction\n // is in force. A row is exactly as wide as the viewport, so minX and\n // maxX both collapse to 0 and clamping x erases it entirely: harmless\n // under restrictToVerticalAxis, which zeroes x anyway, but fatal for a\n // caller that replaced the restriction precisely to READ x, as a tree\n // does to resolve drop depth. Vertical is railed either way, which is\n // what actually keeps a dragged row inside the grid.\n x: modifiers ? x : Math.max(minX, Math.min(maxX, x)),\n y: Math.max(minY, Math.min(maxY, y)),\n };\n };\n\n // The container clamp is a safety rail rather than a policy, so it stays\n // applied even when the caller replaces the axis restriction.\n return [...(modifiers ?? [restrictToVerticalAxis]), restrictToTableContainer];\n }, [modifiers]);\n\n return (\n <DndContext\n id={useId()}\n accessibility={accessibility}\n collisionDetection={collisionDetection}\n modifiers={resolvedModifiers}\n onDragCancel={(event) => {\n setIsDraggingRow(false);\n setCarried(null);\n onDragCancel?.(event);\n }}\n onDragEnd={(event) => {\n setIsDraggingRow(false);\n setCarried(null);\n handleDragEnd(event);\n }}\n onDragMove={onDragMove}\n onDragOver={onDragOver}\n onDragStart={(event) => {\n setIsDraggingRow(true);\n pickUpRow(event.active.id);\n onDragStart?.(event);\n }}\n sensors={sensors}\n >\n <DataGridTableViewport\n viewportRef={tableContainerRef}\n className={isDraggingRow ? \"relative cursor-grabbing **:cursor-grabbing!\" : \"relative\"}\n >\n <DataGridTableBase>\n <DataGridTableHead>\n {table\n .getHeaderGroups()\n .map((headerGroup: HeaderGroup<DataGridFeatures, TData>, index) => {\n const renderHeader = (header: Header<DataGridFeatures, TData, unknown>) => {\n const { column } = header;\n\n return (\n <DataGridTableHeadRowCell header={header} key={header.id}>\n {header.isPlaceholder\n ? null\n : props.tableLayout?.columnsResizable && column.getCanResize()\n ? flexRender(header.column.columnDef.header, header.getContext())\n : flexRender(header.column.columnDef.header, header.getContext())}\n {props.tableLayout?.columnsResizable && column.getCanResize() && (\n <DataGridTableHeadRowCellResize header={header} />\n )}\n </DataGridTableHeadRowCell>\n );\n };\n\n return (\n <DataGridTableHeadRow key={index} rowId={headerGroup.id}>\n {/* Every row follows DataGridTableBase's colgroup, which\n puts the fill col between the center and end-pinned\n groups; a fill cell appended last hands its width to\n the end-pinned column. One keyed list, not three, so\n a column pinned into or out of the end group moves\n instead of remounting, which would drop keyboard\n focus. */}\n {[\n ...headerGroup.headers\n .filter((header) => header.column.getIsPinned() !== \"end\")\n .map(renderHeader),\n <DataGridTableFillHeadCell key=\"__data-grid-fill\" />,\n ...headerGroup.headers\n .filter((header) => header.column.getIsPinned() === \"end\")\n .map(renderHeader),\n ]}\n </DataGridTableHeadRow>\n );\n })}\n </DataGridTableHead>\n\n {(props.tableLayout?.stripped || !props.tableLayout?.rowBorder) && (\n <DataGridTableRowSpacer />\n )}\n\n <DataGridTableBody>\n <MemoizedDataGridTableDndRowsBody\n table={table}\n dataIds={dataIds}\n renderRowDecoration={renderRowDecoration}\n dropIndicator={dropIndicator}\n sortingStrategy={sortingStrategy}\n />\n </DataGridTableBody>\n\n {footerContent && <DataGridTableFoot>{footerContent}</DataGridTableFoot>}\n </DataGridTableBase>\n </DataGridTableViewport>\n\n {/* The row you are actually holding. It is a real clone rendered outside\n the table, which is the only way a dragged row can follow the pointer\n without disturbing the grid: it adds no cell, so it cannot alter the\n column widths, and it floats above the rows rather than through them.\n Its presence also tells dnd-kit to stop translating the source row, so\n the row left behind simply dims in place.\n\n Portalled to the body so the fixed positioning resolves against the\n viewport wherever the grid is mounted. React context crosses a portal,\n so DndContext still reaches it. */}\n {portalTarget\n ? createPortal(\n <DragOverlay dropAnimation={null}>\n {carried && carriedRow ? (\n <table\n aria-hidden=\"true\"\n style={{ width: carried.width, tableLayout: \"fixed\" }}\n className=\"pointer-events-none cursor-grabbing rounded-md border border-border bg-background shadow-lg\"\n >\n <tbody>\n {/* Padding rides on the inner element, not the cell. A `td` can\n never render narrower than its own horizontal padding, so a\n column resized below that would silently widen here and the\n clone would stop matching the row it came from. Height comes\n from the measured source row for the same reason the widths\n do: the clone has no row of its own to inherit it from. */}\n <tr\n style={{ height: carried.height || undefined }}\n className=\"[&>td]:p-0 [&>td]:align-middle\"\n >\n {carriedRow\n .getVisibleCells()\n .map((cell: Cell<DataGridFeatures, TData, unknown>, index: number) => (\n <td\n key={cell.id}\n // Falls back to the column's own size so an unforeseen\n // header/cell count mismatch degrades to a real width\n // rather than to `auto`.\n style={{\n width: carried.columns[index] ?? cell.column.getSize(),\n }}\n >\n <div\n className={cn(\"truncate\", !carried.padding[index] && \"px-3\")}\n style={{\n paddingInlineStart: carried.padding[index]?.start,\n paddingInlineEnd: carried.padding[index]?.end,\n }}\n >\n {flexRender(cell.column.columnDef.cell, cell.getContext())}\n </div>\n </td>\n ))}\n </tr>\n </tbody>\n </table>\n ) : null}\n </DragOverlay>,\n portalTarget,\n )\n : null}\n </DndContext>\n );\n}\n\nexport type { DataGridTableDndRowData, DataGridTableDndRowDecoration };\nexport { DataGridTableDndRowHandle, DataGridTableDndRows };\n"],"mappings":";;;;;;;;;;;;;;;AAwEA,MAAM,qBAAqB,cAGjB,IAAI;AA4Bd,SAAS,0BAA0B,EACjC,WACA,UACA,iBAYC;CACD,MAAM,EAAE,SAAS,YAAY;CAC7B,MAAM,UAAU,WAAW,kBAAkB;CAC7C,MAAM,wBAAwB,iBAAiB,KAAK,OAAO;CAE3D,IAAI,CAAC,WAAW,UACd,OACE,oBAAC,QAAD;EACE,SAAQ;EACR,MAAK;EACL,WAAW,GACT,+FAIA,YAAY,sBACZ,SACF;EACA,cAAY,WAAW,wBAAwB,KAAK,OAAO;EAC3D,OAAO,WAAW,wBAAwB,KAAA;EAC1C,UAAA;EAEA,UAAA,oBAAC,oBAAD,EAAoB,eAAY,OAAQ,CAAA;CAClC,CAAA;CAIZ,OACE,oBAAC,QAAD;EACE,SAAQ;EACR,MAAK;EACL,WAAW,GACT,+FACA,SAC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;;AAEhB"}
|
|
1
|
+
{"version":3,"file":"data-grid-table-dnd-rows.js","names":[],"sources":["../../../../src/components/reui/data-grid/data-grid-table-dnd-rows.tsx"],"sourcesContent":["\"use client\";\n\nimport type { CSSProperties, ReactNode } from \"react\";\nimport {\n createContext,\n memo,\n useCallback,\n useContext,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport {\n type CollisionDetection,\n closestCenter,\n DndContext,\n type DndContextProps,\n type DragCancelEvent,\n type DragEndEvent,\n type DragMoveEvent,\n type DragOverEvent,\n DragOverlay,\n type DragStartEvent,\n KeyboardSensor,\n type Modifier,\n MouseSensor,\n TouchSensor,\n type UniqueIdentifier,\n useSensor,\n useSensors,\n} from \"@dnd-kit/core\";\nimport { restrictToVerticalAxis } from \"@dnd-kit/modifiers\";\nimport {\n SortableContext,\n type SortingStrategy,\n sortableKeyboardCoordinates,\n useSortable,\n} from \"@dnd-kit/sortable\";\nimport { CSS } from \"@dnd-kit/utilities\";\nimport type { Cell, Header, Row } from \"@tanstack/react-table\";\nimport { flexRender } from \"@tanstack/react-table\";\nimport { GripHorizontalIcon } from \"lucide-react\";\nimport { createPortal } from \"react-dom\";\n\nimport { cn } from \"@kumix/utils\";\nimport { Button } from \"../../ui/button\";\nimport type { DataGridFeatures, DataGridTableInstance } from \"./data-grid\";\nimport { useDataGrid } from \"./data-grid\";\nimport {\n DataGridTableBase,\n DataGridTableBody,\n DataGridTableBodyRow,\n DataGridTableBodyRowCell,\n DataGridTableBodyRowExpandded,\n DataGridTableBodyRowSkeleton,\n DataGridTableBodyRowSkeletonCell,\n DataGridTableEmpty,\n DataGridTableFillBodyCell,\n DataGridTableFillHeadCell,\n DataGridTableFoot,\n DataGridTableHead,\n DataGridTableHeadRow,\n DataGridTableHeadRowCell,\n DataGridTableHeadRowCellResize,\n DataGridTableRowSpacer,\n DataGridTableViewport,\n getDataGridHeadCellResizeHeader,\n getDataGridTableMergedHeaderGroups,\n renderDataGridTableHeadCellContent,\n} from \"./data-grid-table\";\n\n// Context to share sortable listeners from row to handle\ntype SortableContextValue = ReturnType<typeof useSortable>;\nconst SortableRowContext = createContext<Pick<\n SortableContextValue,\n \"attributes\" | \"listeners\"\n> | null>(null);\n\n/**\n * Tree metadata attached to every sortable row, readable from\n * `active.data.current` / `over.data.current` in any drag event. Cross-parent\n * drops can be resolved from it without re-deriving the shape of the table.\n */\ntype DataGridTableDndRowData = {\n type: \"data-grid-row\";\n /** Tree depth, 0 for root rows. */\n depth: number;\n /** Index within the parent's children, or within the root rows. */\n index: number;\n /** Parent row id, or null for root rows. */\n parentId: string | null;\n};\n\n/**\n * Per-row render slot for drop indicators and depth guides. The returned node\n * is positioned over the row, so it never adds a column, shifts striping, or\n * gets clipped by a truncating resizable cell.\n */\ntype DataGridTableDndRowDecoration<TData extends object> = (context: {\n row: Row<DataGridFeatures, TData>;\n isDragging: boolean;\n isOver: boolean;\n}) => ReactNode;\n\nfunction DataGridTableDndRowHandle({\n className,\n disabled,\n disabledLabel,\n}: {\n className?: string;\n /**\n * Renders the grip inert instead of withdrawing it. A grid that reorders on\n * one truth (manual order) and sorts on another cannot honour both at once,\n * but dropping the handle entirely collapses the gutter and reads as broken\n * rather than as unavailable. Keep the column's shape, mute the control.\n */\n disabled?: boolean;\n /** Announced and shown on hover in place of the drag affordance. */\n disabledLabel?: string;\n}) {\n const { i18n } = useDataGrid();\n const context = useContext(SortableRowContext);\n const resolvedDisabledLabel = disabledLabel ?? i18n.labels.reorderingUnavailable;\n\n if (!context || disabled) {\n return (\n <Button\n variant=\"ghost\"\n size=\"icon-sm\"\n className={cn(\n \"size-7 cursor-grab opacity-70 hover:bg-transparent hover:opacity-100 active:cursor-grabbing\",\n // The Button's own disabled treatment supplies the muting; only the\n // cursor needs saying, so the grip reads as unavailable rather than\n // merely unresponsive.\n disabled && \"cursor-not-allowed\",\n className,\n )}\n aria-label={disabled ? resolvedDisabledLabel : i18n.labels.dragToReorderRow}\n title={disabled ? resolvedDisabledLabel : undefined}\n disabled\n >\n <GripHorizontalIcon aria-hidden=\"true\" />\n </Button>\n );\n }\n\n return (\n <Button\n variant=\"ghost\"\n size=\"icon-sm\"\n className={cn(\n \"size-7 cursor-grab opacity-70 hover:bg-transparent hover:opacity-100 active:cursor-grabbing\",\n className,\n )}\n aria-label={i18n.labels.dragToReorderRow}\n {...context.attributes}\n {...context.listeners}\n >\n <GripHorizontalIcon aria-hidden=\"true\" />\n </Button>\n );\n}\n\n/**\n * The rows do not move while one is being carried.\n *\n * Sliding the siblings apart opens a gap the carried row could go into, which\n * reads well in a list of identical rows and badly in a table: the gap is the\n * height of the row you are holding, so with rows of unequal height it never\n * matches the slot it claims to be, and the row you picked up slides away from\n * where it started - which is exactly the position you need to remember if you\n * decide not to drop it.\n *\n * Holding everything still keeps the origin legible, and nothing is lost: the\n * DragOverlay clone follows the pointer and the drop indicator names the seam.\n * Pass `verticalListSortingStrategy` as `sortingStrategy` for the old feel.\n */\nconst holdRowsInPlaceStrategy: SortingStrategy = () => null;\n\nfunction DataGridTableDndRow<TData extends object>({\n row,\n renderRowDecoration,\n dropIndicator = true,\n}: {\n row: Row<DataGridFeatures, TData>;\n renderRowDecoration?: DataGridTableDndRowDecoration<TData>;\n dropIndicator?: boolean;\n}) {\n const rowData: DataGridTableDndRowData = {\n type: \"data-grid-row\",\n depth: row.depth,\n index: row.index,\n parentId: row.getParentRow()?.id ?? null,\n };\n\n const {\n transform,\n setNodeRef,\n isDragging,\n isOver,\n attributes,\n listeners,\n index,\n activeIndex,\n overIndex,\n } = useSortable({\n id: row.id,\n data: rowData,\n });\n\n // Which edge of THIS row the carried row would land on, or null when it is\n // not the drop target. Nothing slides apart any more, so the bar is the only\n // thing that says where the drop goes: it marks the row at the destination\n // index, on the side the carried row comes to rest.\n //\n // Dragging down it lands after the target, dragging up before it, so the\n // edge follows the direction of travel.\n const dropEdge =\n dropIndicator && activeIndex !== -1 && index === overIndex && !isDragging\n ? activeIndex < overIndex\n ? \"bottom\"\n : \"top\"\n : null;\n\n const style: CSSProperties = {\n transform: CSS.Transform.toString(transform),\n // dnd-kit's transition is deliberately dropped. A transition on a transform\n // property of a `tr` does not merely fail to animate in Chrome, it stops the\n // transform applying at all: the element sits at the start value forever.\n // The drag source escapes it because dnd-kit disables its own transition\n // while it is being dragged, which is why the carried row used to be the\n // ONLY one that moved and every other row silently refused to open a gap.\n // Displacement therefore lands in one step, which is what a table wants.\n zIndex: isDragging ? 1 : 0,\n position: \"relative\",\n cursor: isDragging ? \"grabbing\" : undefined,\n // The row you are holding is drawn by the DragOverlay, so the one left\n // behind is not a second copy of it - it is the slot you came from, and it\n // stays exactly where it was. Fading alone read as \"this row is busy\";\n // the outline says \"this is the space you are moving out of\", which is the\n // thing you need if you change your mind mid-drag.\n ...(isDragging && {\n opacity: 0.4,\n // Inset so the dashes sit inside the row box and cannot be clipped by\n // the neighbouring row's border.\n outline: \"1px dashed var(--border)\",\n outlineOffset: \"-1px\",\n }),\n };\n\n const decoration = renderRowDecoration?.({ row, isDragging, isOver });\n const cells = row.getVisibleCells();\n const lastCell = cells[cells.length - 1];\n\n const renderCell = (cell: Cell<DataGridFeatures, TData, unknown>) => (\n <DataGridTableBodyRowCell cell={cell} key={cell.id}>\n {flexRender(cell.column.columnDef.cell, cell.getContext())}\n {decoration && cell === lastCell ? (\n // Rides inside the last cell rather than in a `td` of its own.\n // An absolutely positioned `td` is still a cell as far as table\n // layout is concerned, so it added a NINTH column with no width\n // of its own, and under `table-layout: fixed` that new column\n // swallowed the whole surplus the real columns had been sharing,\n // so every column snapped back to its declared size and the row's\n // content visibly narrowed the moment a drag began. A plain\n // element adds no column. It anchors to the ROW, the nearest\n // positioned ancestor, and spans the full width, unless the last\n // cell is a sticky end-pinned one: that cell is positioned itself\n // and confines the decoration to its own width.\n <div\n aria-hidden=\"true\"\n data-slot=\"data-grid-table-row-decoration\"\n className=\"pointer-events-none absolute inset-0\"\n >\n {decoration}\n </div>\n ) : null}\n {dropEdge && cell === lastCell ? (\n // Same anchoring trick as the decoration above: a plain\n // element inside the last cell, so it adds no column and\n // cannot disturb `table-layout: fixed`. It spans the row, with\n // the same sticky end-pinned exception.\n <div\n aria-hidden=\"true\"\n data-slot=\"data-grid-table-row-drop-indicator\"\n data-edge={dropEdge}\n className=\"pointer-events-none absolute inset-0 z-20\"\n >\n {/* Two solid pixels down the leading edge, the same marker\n the tree drag uses for its drop target. A wash across\n the row has to stay faint enough not to read as a\n selected row, and in the achromatic styles primary\n carries no chroma at all, so faint plus colourless is\n just grey. The bar reads at any weight and leaves the\n row's own background to hover and selection.\n\n The bar is the whole indicator: the gap the rows have\n already opened says which side, so a rule across the\n seam as well only competes with the row borders it sits\n between. `data-edge` still carries the direction for\n anyone styling their own. */}\n <span className=\"absolute inset-y-0 start-0 w-0.5 bg-primary\" />\n </div>\n ) : null}\n </DataGridTableBodyRowCell>\n );\n\n return (\n <SortableRowContext.Provider value={{ attributes, listeners }}>\n <DataGridTableBodyRow row={row} dndRef={setNodeRef} dndStyle={style} dndDragging={isDragging}>\n {/* One keyed list with the fill in the middle, as in the head row. */}\n {[\n ...cells.filter((cell) => cell.column.getIsPinned() !== \"end\").map(renderCell),\n <DataGridTableFillBodyCell key=\"__data-grid-fill\" />,\n ...cells.filter((cell) => cell.column.getIsPinned() === \"end\").map(renderCell),\n ]}\n </DataGridTableBodyRow>\n {row.getIsExpanded() && <DataGridTableBodyRowExpandded row={row} />}\n </SortableRowContext.Provider>\n );\n}\n\nfunction DataGridTableDndRowsBody<TData extends object>({\n table,\n dataIds,\n renderRowDecoration,\n dropIndicator,\n sortingStrategy,\n}: {\n table: DataGridTableInstance<TData>;\n dataIds: UniqueIdentifier[];\n renderRowDecoration?: DataGridTableDndRowDecoration<TData>;\n dropIndicator?: boolean;\n sortingStrategy: SortingStrategy;\n}) {\n const { isLoading, props } = useDataGrid();\n const pagination = table.state.pagination;\n\n if (props.loadingMode === \"skeleton\" && isLoading && pagination?.pageSize) {\n return (\n <>\n {Array.from({ length: pagination.pageSize }).map((_, rowIndex) => (\n <DataGridTableBodyRowSkeleton key={rowIndex}>\n {[\n ...[\n ...table.getStartVisibleLeafColumns(),\n ...table.getCenterVisibleLeafColumns(),\n ].map((column) => (\n <DataGridTableBodyRowSkeletonCell column={column} key={column.id}>\n {column.columnDef.meta?.skeleton}\n </DataGridTableBodyRowSkeletonCell>\n )),\n <DataGridTableFillBodyCell key=\"__data-grid-fill\" />,\n ...table.getEndVisibleLeafColumns().map((column) => (\n <DataGridTableBodyRowSkeletonCell column={column} key={column.id}>\n {column.columnDef.meta?.skeleton}\n </DataGridTableBodyRowSkeletonCell>\n )),\n ]}\n </DataGridTableBodyRowSkeleton>\n ))}\n </>\n );\n }\n\n if (!table.getRowModel().rows.length) return <DataGridTableEmpty />;\n\n return (\n <SortableContext items={dataIds} strategy={sortingStrategy}>\n {table.getRowModel().rows.map((row: Row<DataGridFeatures, TData>) => {\n return (\n <DataGridTableDndRow\n row={row}\n renderRowDecoration={renderRowDecoration}\n dropIndicator={dropIndicator}\n key={row.id}\n />\n );\n })}\n </SortableContext>\n );\n}\n\n/**\n * Memoized body rows: skip re-renders during active column resize.\n * Column widths update via CSS variables on the <table> element,\n * so the browser handles width changes without React re-renders.\n */\nconst MemoizedDataGridTableDndRowsBody = memo(\n DataGridTableDndRowsBody,\n (_prev, next) => !!next.table.state.columnResizing.isResizingColumn,\n) as typeof DataGridTableDndRowsBody;\n\nfunction DataGridTableDndRows<TData extends object>({\n handleDragEnd,\n dataIds,\n footerContent,\n collisionDetection = closestCenter,\n modifiers,\n sortingStrategy = holdRowsInPlaceStrategy,\n renderRowDecoration,\n dropIndicator = true,\n onDragStart,\n onDragMove,\n onDragOver,\n onDragCancel,\n accessibility,\n}: {\n handleDragEnd: (event: DragEndEvent) => void;\n dataIds: UniqueIdentifier[];\n footerContent?: ReactNode;\n /** Overrides the default `closestCenter` strategy. */\n collisionDetection?: CollisionDetection;\n /**\n * Replaces the default axis restriction, e.g. drop `restrictToVerticalAxis`\n * to allow the horizontal gesture that tree re-parenting relies on. The\n * table container clamp is always applied after these, so a dragged row\n * cannot leave the grid.\n */\n modifiers?: Modifier[];\n /**\n * Replaces the default `verticalListSortingStrategy`. Return null from a\n * strategy to leave every row exactly where it is. A tree needs that: its drop\n * is either INTO the hovered row or BETWEEN two rows, and which one it is\n * flips as the pointer crosses a single row, so a gap that opens for one and\n * shuts for the other flickers the whole surface. Such a caller draws its own\n * insertion line instead, and pairs this with a modifier that holds the\n * carried row still, since a gap nothing moves into is just a hole.\n */\n sortingStrategy?: SortingStrategy;\n /** Per-row slot for drop indicators and depth guides. */\n renderRowDecoration?: DataGridTableDndRowDecoration<TData>;\n /**\n * Draws a line on the seam the carried row would land on. On by default;\n * pass `false` when `renderRowDecoration` paints its own insertion affordance\n * and the two would compete.\n */\n dropIndicator?: boolean;\n onDragStart?: (event: DragStartEvent) => void;\n onDragMove?: (event: DragMoveEvent) => void;\n onDragOver?: (event: DragOverEvent) => void;\n onDragCancel?: (event: DragCancelEvent) => void;\n /**\n * Forwarded to dnd-kit's `DndContext`: its screen-reader instructions and\n * live-region announcements, which default to dnd-kit's English strings.\n */\n accessibility?: DndContextProps[\"accessibility\"];\n}) {\n const { table, props } = useDataGrid<TData>();\n const mergedHeaderGroups = getDataGridTableMergedHeaderGroups(table);\n const tableContainerRef = useRef<HTMLDivElement>(null);\n const [isDraggingRow, setIsDraggingRow] = useState(false);\n // The overlay is portalled to the document body. dnd-kit renders DragOverlay\n // in place, and it positions with `position: fixed` against viewport\n // coordinates - so any ancestor that establishes a containing block for fixed\n // descendants silently re-anchors it. `content-visibility`, `contain`,\n // `transform`, `filter` and `will-change` all do that, and the first two are\n // exactly what a card grid uses to defer off-screen work. The clone then\n // lands offset by that ancestor's own top/left, and the container clamp\n // below mis-clamps too, because its rects are measured in viewport space.\n //\n // Resolved in an effect rather than read at render so the server and the\n // first client render agree. A drag cannot start before hydration, so the\n // overlay being absent for one frame costs nothing.\n const [portalTarget, setPortalTarget] = useState<HTMLElement | null>(null);\n\n useEffect(() => {\n setPortalTarget(document.body);\n }, []);\n // The row being carried, plus the column widths measured off the header the\n // moment the drag starts. The clone lives outside the table, so it has no\n // columns of its own and has to be told what they are.\n const [carried, setCarried] = useState<{\n id: UniqueIdentifier;\n width: number;\n height: number;\n columns: number[];\n padding: { start: string; end: string }[];\n } | null>(null);\n\n const pickUpRow = useCallback((id: UniqueIdentifier) => {\n const container = tableContainerRef.current;\n const head = container?.querySelector(\"thead tr\");\n if (!container || !head) {\n setCarried(null);\n return;\n }\n\n // The clone has to be exactly as tall as the row it was lifted from.\n // A fixed height reads as the grid growing under the pointer the moment\n // you pick a row up, and it is wrong in both directions: rows whose\n // content wraps are taller than any constant, and dense rows are shorter.\n const source = Array.from(\n container.querySelectorAll<HTMLElement>(\"tbody tr[data-row-id]\"),\n ).find((candidate) => candidate.dataset.rowId === String(id));\n const height = source?.getBoundingClientRect().height ?? 0;\n\n // The fill cell is a spacer that soaks up the surplus a column resize\n // leaves behind, and the clone renders data cells only. Measuring it in\n // would make the clone's table wider than the cells it actually holds,\n // and `table-fixed` hands that orphaned width back out across every column\n // -- the carried row comes out visibly wider than the row it was lifted\n // from. So the width is the sum of what we render, never the header's own.\n // Read off the source row, one cell per column: a head cell can span\n // several (a group, a merged or a meta.headerColSpan cell).\n const columns = Array.from(source?.children ?? head.children)\n .filter(\n (cell) =>\n cell.getAttribute(\"data-slot\") !== \"data-grid-table-fill-body-cell\" &&\n cell.getAttribute(\"data-slot\") !== \"data-grid-table-fill-head-cell\",\n )\n .map((cell) => cell.getBoundingClientRect().width);\n\n // Inline padding is read off the source cells for the same reason. A fixed\n // px-3 ignored edgeCell and cellClassName, so a 44px grip column holding a\n // 28px handle overflowed by 8px and truncate painted an ellipsis beside it.\n const padding = Array.from(source?.children ?? [])\n .filter((cell) => cell.getAttribute(\"data-slot\") !== \"data-grid-table-fill-body-cell\")\n .map((cell) => {\n const style = getComputedStyle(cell);\n return { start: style.paddingInlineStart, end: style.paddingInlineEnd };\n });\n\n setCarried({\n id,\n width: columns.reduce((total, width) => total + width, 0),\n height,\n columns,\n padding,\n });\n }, []);\n\n const carriedRow = carried\n ? table.getRowModel().rows.find((row: Row<DataGridFeatures, TData>) => row.id === carried.id)\n : undefined;\n\n const sensors = useSensors(\n useSensor(MouseSensor, {}),\n useSensor(TouchSensor, {}),\n // Keyboard reordering moves one sortable position per keypress instead\n // of the sensor's raw 25px default.\n useSensor(KeyboardSensor, {\n coordinateGetter: sortableKeyboardCoordinates,\n }),\n );\n\n useEffect(() => {\n if (!isDraggingRow) return;\n\n const { body, documentElement } = document;\n const previousBodyCursor = body.style.cursor;\n const previousDocumentCursor = documentElement.style.cursor;\n\n body.style.cursor = \"grabbing\";\n documentElement.style.cursor = \"grabbing\";\n\n return () => {\n body.style.cursor = previousBodyCursor;\n documentElement.style.cursor = previousDocumentCursor;\n };\n }, [isDraggingRow]);\n\n const resolvedModifiers = useMemo(() => {\n const restrictToTableContainer: Modifier = ({ transform, draggingNodeRect }) => {\n if (!tableContainerRef.current || !draggingNodeRect) {\n return transform;\n }\n\n const containerRect = tableContainerRef.current.getBoundingClientRect();\n const { x, y } = transform;\n\n const minX = containerRect.left - draggingNodeRect.left;\n const maxX = containerRect.right - draggingNodeRect.right;\n const minY = containerRect.top - draggingNodeRect.top;\n const maxY = containerRect.bottom - draggingNodeRect.bottom;\n\n return {\n ...transform,\n // The horizontal rail only engages while the default axis restriction\n // is in force. A row is exactly as wide as the viewport, so minX and\n // maxX both collapse to 0 and clamping x erases it entirely: harmless\n // under restrictToVerticalAxis, which zeroes x anyway, but fatal for a\n // caller that replaced the restriction precisely to READ x, as a tree\n // does to resolve drop depth. Vertical is railed either way, which is\n // what actually keeps a dragged row inside the grid.\n x: modifiers ? x : Math.max(minX, Math.min(maxX, x)),\n y: Math.max(minY, Math.min(maxY, y)),\n };\n };\n\n // The container clamp is a safety rail rather than a policy, so it stays\n // applied even when the caller replaces the axis restriction.\n return [...(modifiers ?? [restrictToVerticalAxis]), restrictToTableContainer];\n }, [modifiers]);\n\n return (\n <DndContext\n id={useId()}\n accessibility={accessibility}\n collisionDetection={collisionDetection}\n modifiers={resolvedModifiers}\n onDragCancel={(event) => {\n setIsDraggingRow(false);\n setCarried(null);\n onDragCancel?.(event);\n }}\n onDragEnd={(event) => {\n setIsDraggingRow(false);\n setCarried(null);\n handleDragEnd(event);\n }}\n onDragMove={onDragMove}\n onDragOver={onDragOver}\n onDragStart={(event) => {\n setIsDraggingRow(true);\n pickUpRow(event.active.id);\n onDragStart?.(event);\n }}\n sensors={sensors}\n >\n <DataGridTableViewport\n viewportRef={tableContainerRef}\n className={isDraggingRow ? \"relative cursor-grabbing **:cursor-grabbing!\" : \"relative\"}\n >\n <DataGridTableBase>\n <DataGridTableHead>\n {mergedHeaderGroups.map((headerGroup, index) => {\n const renderHeader = (header: Header<DataGridFeatures, TData, unknown>) => {\n const coveredHeaders = headerGroup.coveredHeaders.get(header.id);\n const resizeHeader = getDataGridHeadCellResizeHeader(header, coveredHeaders);\n\n return (\n <DataGridTableHeadRowCell\n header={header}\n coveredHeaders={coveredHeaders}\n key={header.id}\n >\n {renderDataGridTableHeadCellContent(header)}\n {props.tableLayout?.columnsResizable && resizeHeader.column.getCanResize() && (\n <DataGridTableHeadRowCellResize header={resizeHeader} />\n )}\n </DataGridTableHeadRowCell>\n );\n };\n\n return (\n <DataGridTableHeadRow key={index} rowId={headerGroup.id}>\n {/* Every row follows DataGridTableBase's colgroup, which\n puts the fill col between the center and end-pinned\n groups; a fill cell appended last hands its width to\n the end-pinned column. One keyed list, not three, so\n a column pinned into or out of the end group moves\n instead of remounting, which would drop keyboard\n focus. The fill spans every head row, so only the\n first renders it. */}\n {[\n ...[...headerGroup.startHeaders, ...headerGroup.centerHeaders].map(\n renderHeader,\n ),\n ...(index === 0\n ? [\n <DataGridTableFillHeadCell\n key=\"__data-grid-fill\"\n rowSpan={mergedHeaderGroups.length}\n />,\n ]\n : []),\n ...headerGroup.endHeaders.map(renderHeader),\n ]}\n </DataGridTableHeadRow>\n );\n })}\n </DataGridTableHead>\n\n {(props.tableLayout?.stripped || !props.tableLayout?.rowBorder) && (\n <DataGridTableRowSpacer />\n )}\n\n <DataGridTableBody>\n <MemoizedDataGridTableDndRowsBody\n table={table}\n dataIds={dataIds}\n renderRowDecoration={renderRowDecoration}\n dropIndicator={dropIndicator}\n sortingStrategy={sortingStrategy}\n />\n </DataGridTableBody>\n\n {footerContent && <DataGridTableFoot>{footerContent}</DataGridTableFoot>}\n </DataGridTableBase>\n </DataGridTableViewport>\n\n {/* The row you are actually holding. It is a real clone rendered outside\n the table, which is the only way a dragged row can follow the pointer\n without disturbing the grid: it adds no cell, so it cannot alter the\n column widths, and it floats above the rows rather than through them.\n Its presence also tells dnd-kit to stop translating the source row, so\n the row left behind simply dims in place.\n\n Portalled to the body so the fixed positioning resolves against the\n viewport wherever the grid is mounted. React context crosses a portal,\n so DndContext still reaches it. */}\n {portalTarget\n ? createPortal(\n <DragOverlay dropAnimation={null}>\n {carried && carriedRow ? (\n <table\n aria-hidden=\"true\"\n style={{ width: carried.width, tableLayout: \"fixed\" }}\n className=\"pointer-events-none cursor-grabbing rounded-md border border-border bg-background shadow-lg\"\n >\n <tbody>\n {/* Padding rides on the inner element, not the cell. A `td` can\n never render narrower than its own horizontal padding, so a\n column resized below that would silently widen here and the\n clone would stop matching the row it came from. Height comes\n from the measured source row for the same reason the widths\n do: the clone has no row of its own to inherit it from. */}\n <tr\n style={{ height: carried.height || undefined }}\n className=\"[&>td]:p-0 [&>td]:align-middle\"\n >\n {carriedRow\n .getVisibleCells()\n .map((cell: Cell<DataGridFeatures, TData, unknown>, index: number) => (\n <td\n key={cell.id}\n // Falls back to the column's own size so an unforeseen\n // header/cell count mismatch degrades to a real width\n // rather than to `auto`.\n style={{\n width: carried.columns[index] ?? cell.column.getSize(),\n }}\n >\n <div\n className={cn(\"truncate\", !carried.padding[index] && \"px-3\")}\n style={{\n paddingInlineStart: carried.padding[index]?.start,\n paddingInlineEnd: carried.padding[index]?.end,\n }}\n >\n {flexRender(cell.column.columnDef.cell, cell.getContext())}\n </div>\n </td>\n ))}\n </tr>\n </tbody>\n </table>\n ) : null}\n </DragOverlay>,\n portalTarget,\n )\n : null}\n </DndContext>\n );\n}\n\nexport type { DataGridTableDndRowData, DataGridTableDndRowDecoration };\nexport { DataGridTableDndRowHandle, DataGridTableDndRows };\n"],"mappings":";;;;;;;;;;;;;;;AA2EA,MAAM,qBAAqB,cAGjB,IAAI;AA4Bd,SAAS,0BAA0B,EACjC,WACA,UACA,iBAYC;CACD,MAAM,EAAE,SAAS,YAAY;CAC7B,MAAM,UAAU,WAAW,kBAAkB;CAC7C,MAAM,wBAAwB,iBAAiB,KAAK,OAAO;CAE3D,IAAI,CAAC,WAAW,UACd,OACE,oBAAC,QAAD;EACE,SAAQ;EACR,MAAK;EACL,WAAW,GACT,+FAIA,YAAY,sBACZ,SACF;EACA,cAAY,WAAW,wBAAwB,KAAK,OAAO;EAC3D,OAAO,WAAW,wBAAwB,KAAA;EAC1C,UAAA;EAEA,UAAA,oBAAC,oBAAD,EAAoB,eAAY,OAAQ,CAAA;CAClC,CAAA;CAIZ,OACE,oBAAC,QAAD;EACE,SAAQ;EACR,MAAK;EACL,WAAW,GACT,+FACA,SACF;EACA,cAAY,KAAK,OAAO;EACxB,GAAI,QAAQ;EACZ,GAAI,QAAQ;EAEZ,UAAA,oBAAC,oBAAD,EAAoB,eAAY,OAAQ,CAAA;CAClC,CAAA;AAEZ;;;;;;;;;;;;;;;AAgBA,MAAM,gCAAiD;AAEvD,SAAS,oBAA0C,EACjD,KACA,qBACA,gBAAgB,QAKf;CACD,MAAM,UAAmC;EACvC,MAAM;EACN,OAAO,IAAI;EACX,OAAO,IAAI;EACX,UAAU,IAAI,aAAa,CAAC,EAAE,MAAM;CACtC;CAEA,MAAM,EACJ,WACA,YACA,YACA,QACA,YACA,WACA,OACA,aACA,cACE,YAAY;EACd,IAAI,IAAI;EACR,MAAM;CACR,CAAC;C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,EAAA,CAAA;EACE,CAAA,GAYtB,eACG,aACE,oBAAC,aAAD;GAAa,eAAe;GACzB,UAAA,WAAW,aACV,oBAAC,SAAD;IACE,eAAY;IACZ,OAAO;KAAE,OAAO,QAAQ;KAAO,aAAa;IAAQ;IACpD,WAAU;IAEV,UAAA,oBAAC,SAAD,EAAA,UAOE,oBAAC,MAAD;KACE,OAAO,EAAE,QAAQ,QAAQ,UAAU,KAAA,EAAU;KAC7C,WAAU;KAET,UAAA,WACE,gBAAgB,CAAC,CACjB,KAAK,MAA8C,UAClD,oBAAC,MAAD;MAKE,OAAO,EACL,OAAO,QAAQ,QAAQ,UAAU,KAAK,OAAO,QAAQ,EACvD;MAEA,UAAA,oBAAC,OAAD;OACE,WAAW,GAAG,YAAY,CAAC,QAAQ,QAAQ,UAAU,MAAM;OAC3D,OAAO;QACL,oBAAoB,QAAQ,QAAQ,MAAM,EAAE;QAC5C,kBAAkB,QAAQ,QAAQ,MAAM,EAAE;OAC5C;OAEC,UAAA,WAAW,KAAK,OAAO,UAAU,MAAM,KAAK,WAAW,CAAC;MACtD,CAAA;KACH,GAjBG,KAAK,EAiBR,CACL;IACD,CAAA,EACC,CAAA;GACF,CAAA,IACL;EACO,CAAA,GACb,YACF,IACA,IACM;;AAEhB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
2
|
import { DndContextProps, DragEndEvent } from "@dnd-kit/core";
|
|
3
3
|
//#region src/components/reui/data-grid/data-grid-table-dnd.d.ts
|
|
4
|
-
declare function DataGridTableDnd<
|
|
4
|
+
declare function DataGridTableDnd<_TData extends object>({ handleDragEnd, footerContent, accessibility }: {
|
|
5
5
|
handleDragEnd: (event: DragEndEvent) => void;
|
|
6
6
|
footerContent?: ReactNode;
|
|
7
7
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-grid-table-dnd.d.ts","names":[],"sources":["../../../../src/components/reui/data-grid/data-grid-table-dnd.tsx"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"data-grid-table-dnd.d.ts","names":[],"sources":["../../../../src/components/reui/data-grid/data-grid-table-dnd.tsx"],"mappings":";;;iBA2VS,iBAAiB,yBACxB,eACA,eACA;EAEA,gBAAgB,OAAO;EACvB,gBAAgB;;;;;EAKhB,gBAAgB;oBACjB,IAAA"}
|