@kumix/ui 0.3.1 → 0.3.2
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 +33 -17
- package/dist/components/agents/agent-activity/activity-row.d.ts +8 -0
- package/dist/components/agents/agent-activity/activity-row.d.ts.map +1 -0
- package/dist/components/agents/agent-activity/activity-row.js +228 -0
- package/dist/components/agents/agent-activity/activity-row.js.map +1 -0
- package/dist/components/agents/agent-activity/index.d.ts +6 -0
- package/dist/components/agents/agent-activity/index.d.ts.map +1 -0
- package/dist/components/agents/agent-activity/index.js +182 -0
- package/dist/components/agents/agent-activity/index.js.map +1 -0
- package/dist/components/agents/agent-code.d.ts +25 -0
- package/dist/components/agents/agent-code.d.ts.map +1 -0
- package/dist/components/agents/agent-code.js +117 -0
- package/dist/components/agents/agent-code.js.map +1 -0
- package/dist/components/agents/agent-disclosure.d.ts +12 -0
- package/dist/components/agents/agent-disclosure.d.ts.map +1 -0
- package/dist/components/agents/agent-disclosure.js +36 -0
- package/dist/components/agents/agent-disclosure.js.map +1 -0
- package/dist/components/agents/ai-sidebar.d.ts +41 -0
- package/dist/components/agents/ai-sidebar.d.ts.map +1 -0
- package/dist/components/agents/ai-sidebar.js +576 -0
- package/dist/components/agents/ai-sidebar.js.map +1 -0
- package/dist/components/agents/approval-card/index.d.ts +51 -0
- package/dist/components/agents/approval-card/index.d.ts.map +1 -0
- package/dist/components/agents/approval-card/index.js +317 -0
- package/dist/components/agents/approval-card/index.js.map +1 -0
- package/dist/components/agents/chat-app.d.ts +10 -0
- package/dist/components/agents/chat-app.d.ts.map +1 -0
- package/dist/components/agents/chat-app.js +20 -0
- package/dist/components/agents/chat-app.js.map +1 -0
- package/dist/components/agents/citations.d.ts +45 -0
- package/dist/components/agents/citations.d.ts.map +1 -0
- package/dist/components/agents/citations.js +175 -0
- package/dist/components/agents/citations.js.map +1 -0
- package/dist/components/agents/code-block.d.ts +21 -0
- package/dist/components/agents/code-block.d.ts.map +1 -0
- package/dist/components/agents/code-block.js +113 -0
- package/dist/components/agents/code-block.js.map +1 -0
- package/dist/components/agents/file-diff.d.ts +30 -0
- package/dist/components/agents/file-diff.d.ts.map +1 -0
- package/dist/components/agents/file-diff.js +186 -0
- package/dist/components/agents/file-diff.js.map +1 -0
- package/dist/components/agents/image-generation.d.ts +27 -0
- package/dist/components/agents/image-generation.d.ts.map +1 -0
- package/dist/components/agents/image-generation.js +308 -0
- package/dist/components/agents/image-generation.js.map +1 -0
- package/dist/components/agents/loading-states/agent-progress.d.ts +16 -0
- package/dist/components/agents/loading-states/agent-progress.d.ts.map +1 -0
- package/dist/components/agents/loading-states/agent-progress.js +117 -0
- package/dist/components/agents/loading-states/agent-progress.js.map +1 -0
- package/dist/components/agents/loading-states/reasoning-text.d.ts +20 -0
- package/dist/components/agents/loading-states/reasoning-text.d.ts.map +1 -0
- package/dist/components/agents/loading-states/reasoning-text.js +184 -0
- package/dist/components/agents/loading-states/reasoning-text.js.map +1 -0
- package/dist/components/agents/loading-states/thinking-shimmer.d.ts +13 -0
- package/dist/components/agents/loading-states/thinking-shimmer.d.ts.map +1 -0
- package/dist/components/agents/loading-states/thinking-shimmer.js +17 -0
- package/dist/components/agents/loading-states/thinking-shimmer.js.map +1 -0
- package/dist/components/agents/message-bubble.d.ts +38 -0
- package/dist/components/agents/message-bubble.d.ts.map +1 -0
- package/dist/components/agents/message-bubble.js +182 -0
- package/dist/components/agents/message-bubble.js.map +1 -0
- package/dist/components/agents/message-context.d.ts +6 -0
- package/dist/components/agents/message-context.d.ts.map +1 -0
- package/dist/components/agents/message-context.js +8 -0
- package/dist/components/agents/message-context.js.map +1 -0
- package/dist/components/agents/message-scroller.d.ts +30 -0
- package/dist/components/agents/message-scroller.d.ts.map +1 -0
- package/dist/components/agents/message-scroller.js +314 -0
- package/dist/components/agents/message-scroller.js.map +1 -0
- package/dist/components/agents/message.d.ts +37 -0
- package/dist/components/agents/message.d.ts.map +1 -0
- package/dist/components/agents/message.js +139 -0
- package/dist/components/agents/message.js.map +1 -0
- package/dist/components/agents/prompt-input.d.ts +37 -0
- package/dist/components/agents/prompt-input.d.ts.map +1 -0
- package/dist/components/agents/prompt-input.js +216 -0
- package/dist/components/agents/prompt-input.js.map +1 -0
- package/dist/components/agents/streaming-response.d.ts +35 -0
- package/dist/components/agents/streaming-response.d.ts.map +1 -0
- package/dist/components/agents/streaming-response.js +151 -0
- package/dist/components/agents/streaming-response.js.map +1 -0
- package/dist/components/agents/todo-list.d.ts +24 -0
- package/dist/components/agents/todo-list.d.ts.map +1 -0
- package/dist/components/agents/todo-list.js +334 -0
- package/dist/components/agents/todo-list.js.map +1 -0
- package/dist/components/agents/tool-approval.d.ts +33 -0
- package/dist/components/agents/tool-approval.d.ts.map +1 -0
- package/dist/components/agents/tool-approval.js +166 -0
- package/dist/components/agents/tool-approval.js.map +1 -0
- package/dist/components/agents/tool-result.d.ts +34 -0
- package/dist/components/agents/tool-result.d.ts.map +1 -0
- package/dist/components/agents/tool-result.js +220 -0
- package/dist/components/agents/tool-result.js.map +1 -0
- package/dist/components/custom/confirm-dialog.js +1 -1
- package/dist/components/motion/animated-badge.js +1 -1
- package/dist/components/motion/animated-sidebar.d.ts.map +1 -1
- package/dist/components/motion/animated-sidebar.js +3 -3
- package/dist/components/motion/animated-sidebar.js.map +1 -1
- package/dist/components/motion/animated-toast-stack.js +3 -3
- package/dist/components/motion/animated-toast-stack.js.map +1 -1
- package/dist/components/motion/attachment-upload.js +1 -1
- package/dist/components/motion/availability-scheduler/copy-menu.js +1 -1
- 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.js +2 -2
- package/dist/components/motion/bloom-menu.js.map +1 -1
- package/dist/components/motion/bouncy-accordion.js +1 -1
- package/dist/components/motion/button/stateful.js +1 -1
- package/dist/components/motion/center-morph-modal.js +3 -3
- package/dist/components/motion/center-morph-modal.js.map +1 -1
- package/dist/components/motion/chromatic-text-reveal.js +1 -1
- package/dist/components/motion/chromatic-text-reveal.js.map +1 -1
- package/dist/components/motion/command-palette.js +8 -4
- package/dist/components/motion/command-palette.js.map +1 -1
- package/dist/components/motion/context-menu.js +1 -1
- package/dist/components/motion/feedback-widget.js +1 -1
- package/dist/components/motion/file-upload.js +1 -1
- package/dist/components/motion/infinite-masonry.js +1 -1
- package/dist/components/motion/notification-stack.js +1 -1
- package/dist/components/motion/overflow-actions.js +1 -1
- package/dist/components/motion/preview-rail.d.ts +10 -2
- package/dist/components/motion/preview-rail.d.ts.map +1 -1
- package/dist/components/motion/preview-rail.js +58 -27
- package/dist/components/motion/preview-rail.js.map +1 -1
- package/dist/components/motion/select-morph.js +1 -1
- package/dist/components/motion/select.js +1 -1
- package/dist/components/motion/table/row-handle.js +1 -1
- package/dist/components/motion/table/table-header.js +1 -1
- package/dist/components/motion/text-shimmer.d.ts.map +1 -1
- package/dist/components/motion/text-shimmer.js +4 -3
- package/dist/components/motion/text-shimmer.js.map +1 -1
- package/dist/components/motion/theme-toggle.js +1 -1
- package/dist/components/reui/alert.d.ts +1 -1
- package/dist/components/reui/alert.js +1 -1
- package/dist/components/reui/autocomplete.js +1 -1
- package/dist/components/reui/badge.d.ts +1 -1
- package/dist/components/reui/data-grid/data-grid-column-filter.d.ts +4 -3
- package/dist/components/reui/data-grid/data-grid-column-filter.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-column-filter.js +1 -2
- package/dist/components/reui/data-grid/data-grid-column-filter.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-column-header.d.ts +15 -4
- 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 +36 -8
- package/dist/components/reui/data-grid/data-grid-column-header.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-column-visibility.d.ts +3 -2
- package/dist/components/reui/data-grid/data-grid-column-visibility.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-column-visibility.js +0 -1
- package/dist/components/reui/data-grid/data-grid-column-visibility.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-pagination.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-pagination.js +3 -4
- package/dist/components/reui/data-grid/data-grid-pagination.js.map +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 +12 -7
- 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 +71 -4
- 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 +147 -40
- 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 +5 -6
- 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 +6 -5
- 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 +9 -10
- 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 +60 -33
- package/dist/components/reui/data-grid/data-grid-table.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table.js +152 -68
- package/dist/components/reui/data-grid/data-grid-table.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid.d.ts +105 -20
- package/dist/components/reui/data-grid/data-grid.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid.js +83 -10
- package/dist/components/reui/data-grid/data-grid.js.map +1 -1
- package/dist/components/reui/date-selector.js +47 -44
- package/dist/components/reui/date-selector.js.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-agenda-view.js +1 -1
- package/dist/components/reui/event-calendar/event-calendar-dnd.d.ts.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-dnd.js +20 -2
- package/dist/components/reui/event-calendar/event-calendar-dnd.js.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-event.js +1 -1
- package/dist/components/reui/event-calendar/event-calendar-month-view.js +1 -1
- package/dist/components/reui/event-calendar/event-calendar-nav.js +1 -1
- package/dist/components/reui/event-calendar/event-calendar-recurrence.js +7 -5
- package/dist/components/reui/event-calendar/event-calendar-recurrence.js.map +1 -1
- package/dist/components/reui/filters.js +26 -21
- package/dist/components/reui/filters.js.map +1 -1
- package/dist/components/reui/frame.d.ts +1 -1
- package/dist/components/reui/frame.js +1 -1
- package/dist/components/reui/gantt/gantt-bar.js +1 -1
- package/dist/components/reui/gantt/gantt-nav.js +1 -1
- package/dist/components/reui/gantt/gantt-view.js +1 -1
- package/dist/components/reui/icon-tile.d.ts +1 -1
- package/dist/components/reui/icon-tile.d.ts.map +1 -1
- package/dist/components/reui/icon-tile.js +8 -1
- package/dist/components/reui/icon-tile.js.map +1 -1
- package/dist/components/reui/number-field.js +1 -1
- package/dist/components/reui/phone-input.js +1 -1
- package/dist/components/reui/rating.js +1 -1
- package/dist/components/reui/sortable.js +13 -11
- package/dist/components/reui/sortable.js.map +1 -1
- package/dist/components/reui/tree.js +1 -1
- package/dist/components/ui/accordion.js +1 -1
- package/dist/components/ui/alert-dialog.js +1 -1
- package/dist/components/ui/alert.js +1 -1
- package/dist/components/ui/attachment.js +1 -1
- package/dist/components/ui/badge.d.ts +1 -1
- package/dist/components/ui/breadcrumb.js +1 -1
- package/dist/components/ui/bubble.d.ts +1 -1
- package/dist/components/ui/bubble.js +1 -1
- package/dist/components/ui/button-group.js +1 -1
- package/dist/components/ui/button.d.ts +1 -1
- package/dist/components/ui/button.js +1 -1
- package/dist/components/ui/calendar.js +1 -1
- package/dist/components/ui/carousel.js +1 -1
- package/dist/components/ui/checkbox.js +1 -1
- package/dist/components/ui/combobox.js +1 -1
- package/dist/components/ui/command.js +1 -1
- package/dist/components/ui/context-menu.js +1 -1
- package/dist/components/ui/dialog.js +1 -1
- package/dist/components/ui/dropdown-menu.js +1 -1
- package/dist/components/ui/empty.js +1 -1
- package/dist/components/ui/field.js +1 -1
- package/dist/components/ui/input-group.js +1 -1
- package/dist/components/ui/input-otp.js +1 -1
- package/dist/components/ui/item.d.ts +1 -1
- package/dist/components/ui/item.js +1 -1
- package/dist/components/ui/marker.d.ts +1 -1
- package/dist/components/ui/marker.js +1 -1
- package/dist/components/ui/menubar.js +1 -1
- package/dist/components/ui/message-scroller.js +1 -1
- package/dist/components/ui/native-select.js +1 -1
- package/dist/components/ui/navigation-menu.js +1 -1
- package/dist/components/ui/pagination.js +1 -1
- package/dist/components/ui/questionnaire.d.ts +21 -0
- package/dist/components/ui/questionnaire.d.ts.map +1 -0
- package/dist/components/ui/questionnaire.js +164 -0
- package/dist/components/ui/questionnaire.js.map +1 -0
- package/dist/components/ui/select.js +1 -1
- package/dist/components/ui/sheet.js +1 -1
- package/dist/components/ui/sidebar.d.ts +1 -1
- package/dist/components/ui/sidebar.js +1 -1
- package/dist/components/ui/spinner.js +1 -1
- package/dist/components/ui/tabs.js +1 -1
- package/dist/components/ui/toast.js +1 -1
- package/dist/components/ui/toggle.d.ts +1 -1
- package/dist/components/ui/toggle.js +1 -1
- package/dist/{copy-menu-BJ-MXnkN.js → copy-menu-Bk5GP9Gp.js} +3 -3
- package/dist/{copy-menu-BJ-MXnkN.js.map → copy-menu-Bk5GP9Gp.js.map} +1 -1
- package/dist/hooks/use-body-classes.d.ts +0 -3
- package/dist/hooks/use-body-classes.d.ts.map +1 -1
- package/dist/hooks/use-body-classes.js +0 -3
- package/dist/hooks/use-body-classes.js.map +1 -1
- package/dist/hooks/use-copy-to-clipboard.d.ts +0 -3
- package/dist/hooks/use-copy-to-clipboard.d.ts.map +1 -1
- package/dist/hooks/use-copy-to-clipboard.js +0 -3
- package/dist/hooks/use-copy-to-clipboard.js.map +1 -1
- package/dist/hooks/use-file-upload.js +6 -4
- package/dist/hooks/use-file-upload.js.map +1 -1
- package/dist/hooks/use-hydrated.d.ts +0 -10
- package/dist/hooks/use-hydrated.d.ts.map +1 -1
- package/dist/hooks/use-hydrated.js +0 -10
- package/dist/hooks/use-hydrated.js.map +1 -1
- package/dist/hooks/use-intersection-observer.d.ts.map +1 -1
- package/dist/hooks/use-intersection-observer.js +0 -5
- package/dist/hooks/use-intersection-observer.js.map +1 -1
- package/dist/hooks/use-is-mac.d.ts +0 -5
- package/dist/hooks/use-is-mac.d.ts.map +1 -1
- package/dist/hooks/use-is-mac.js +0 -5
- package/dist/hooks/use-is-mac.js.map +1 -1
- package/dist/hooks/use-media-query.d.ts +0 -5
- package/dist/hooks/use-media-query.d.ts.map +1 -1
- package/dist/hooks/use-media-query.js +0 -5
- package/dist/hooks/use-media-query.js.map +1 -1
- package/dist/hooks/use-meta-color.d.ts.map +1 -1
- package/dist/hooks/use-meta-color.js +0 -3
- package/dist/hooks/use-meta-color.js.map +1 -1
- package/dist/hooks/use-mutation-observer.d.ts.map +1 -1
- package/dist/hooks/use-mutation-observer.js +0 -5
- package/dist/hooks/use-mutation-observer.js.map +1 -1
- package/dist/hooks/use-scroll-position.d.ts.map +1 -1
- package/dist/hooks/use-scroll-position.js +0 -5
- package/dist/hooks/use-scroll-position.js.map +1 -1
- package/dist/hooks/use-slider-input.d.ts.map +1 -1
- package/dist/hooks/use-slider-input.js +0 -5
- package/dist/hooks/use-slider-input.js.map +1 -1
- package/dist/hooks/use-viewport.d.ts +0 -5
- package/dist/hooks/use-viewport.d.ts.map +1 -1
- package/dist/hooks/use-viewport.js +0 -5
- package/dist/hooks/use-viewport.js.map +1 -1
- package/dist/lib/favicon.d.ts +5 -0
- package/dist/lib/favicon.d.ts.map +1 -0
- package/dist/lib/favicon.js +12 -0
- package/dist/lib/favicon.js.map +1 -0
- package/dist/lib/text-shimmer.d.ts +8 -0
- package/dist/lib/text-shimmer.d.ts.map +1 -0
- package/dist/lib/text-shimmer.js +10 -0
- package/dist/lib/text-shimmer.js.map +1 -0
- package/dist/types-j36vVGtZ.d.ts +78 -0
- package/dist/types-j36vVGtZ.d.ts.map +1 -0
- package/package.json +18 -13
- package/dist/components/ui/sonner.d.ts +0 -7
- package/dist/components/ui/sonner.d.ts.map +0 -1
- package/dist/components/ui/sonner.js +0 -32
- package/dist/components/ui/sonner.js.map +0 -1
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use no memo";
|
|
3
2
|
import { Spinner } from "../../ui/spinner.js";
|
|
4
3
|
import { Checkbox } from "../../ui/checkbox.js";
|
|
5
4
|
import { useDataGrid } from "./data-grid.js";
|
|
6
5
|
import { Fragment, memo, useCallback, useEffect, useLayoutEffect, useMemo, useRef } from "react";
|
|
7
6
|
import { cn } from "@kumix/utils";
|
|
8
7
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
-
import { flexRender } from "@tanstack/react-table";
|
|
8
|
+
import { Subscribe, flexRender } from "@tanstack/react-table";
|
|
10
9
|
//#region src/components/reui/data-grid/data-grid-table.tsx
|
|
11
10
|
const headerCellSpacingVariants = ({ size }) => size === "dense" ? "px-2 h-8" : "px-3";
|
|
12
11
|
const bodyCellSpacingVariants = ({ size }) => size === "dense" ? "px-2 py-1.5" : "px-3 py-2";
|
|
@@ -14,8 +13,8 @@ const footerCellSpacingVariants = ({ size }) => size === "dense" ? "px-2 py-1.5"
|
|
|
14
13
|
function getPinningStyles(column) {
|
|
15
14
|
const isPinned = column.getIsPinned();
|
|
16
15
|
return {
|
|
17
|
-
insetInlineStart: isPinned === "
|
|
18
|
-
insetInlineEnd: isPinned === "
|
|
16
|
+
insetInlineStart: isPinned === "start" ? `${column.getStart("start")}px` : void 0,
|
|
17
|
+
insetInlineEnd: isPinned === "end" ? `${column.getAfter("end")}px` : void 0,
|
|
19
18
|
position: isPinned ? "sticky" : void 0,
|
|
20
19
|
transform: isPinned ? "translateZ(0)" : void 0,
|
|
21
20
|
contain: isPinned ? "paint" : void 0,
|
|
@@ -24,6 +23,9 @@ function getPinningStyles(column) {
|
|
|
24
23
|
backgroundClip: isPinned ? "padding-box" : void 0
|
|
25
24
|
};
|
|
26
25
|
}
|
|
26
|
+
function getDataGridTreeIndentStyle(row, indent = 20) {
|
|
27
|
+
return { "--data-grid-tree-padding": `${row.depth * indent}px` };
|
|
28
|
+
}
|
|
27
29
|
function assignRef(ref, value) {
|
|
28
30
|
if (!ref) return;
|
|
29
31
|
if (typeof ref === "function") {
|
|
@@ -102,7 +104,7 @@ function startDataGridColumnResizeOnEnd(event, header, table) {
|
|
|
102
104
|
columnSizingStart.forEach(([columnId, headerSize]) => {
|
|
103
105
|
nextColumnSizing[columnId] = Math.round(Math.max(headerSize + headerSize * deltaPercentage, 0) * 100) / 100;
|
|
104
106
|
});
|
|
105
|
-
table.
|
|
107
|
+
table.setColumnResizing((old) => ({
|
|
106
108
|
...old,
|
|
107
109
|
startOffset,
|
|
108
110
|
startSize,
|
|
@@ -121,7 +123,7 @@ function startDataGridColumnResizeOnEnd(event, header, table) {
|
|
|
121
123
|
ended = true;
|
|
122
124
|
for (const stop of stopListeners) stop();
|
|
123
125
|
updateOffset(clientXPos, true);
|
|
124
|
-
table.
|
|
126
|
+
table.setColumnResizing((old) => ({
|
|
125
127
|
...old,
|
|
126
128
|
isResizingColumn: false,
|
|
127
129
|
startOffset: null,
|
|
@@ -183,7 +185,7 @@ function startDataGridColumnResizeOnEnd(event, header, table) {
|
|
|
183
185
|
ownerWindow.addEventListener("blur", windowBlurHandler);
|
|
184
186
|
stopListeners.push(() => ownerWindow.removeEventListener("blur", windowBlurHandler));
|
|
185
187
|
}
|
|
186
|
-
table.
|
|
188
|
+
table.setColumnResizing((old) => ({
|
|
187
189
|
...old,
|
|
188
190
|
startOffset,
|
|
189
191
|
startSize,
|
|
@@ -228,22 +230,22 @@ function getDataGridTableResolvedRows(table, rowsPinnable) {
|
|
|
228
230
|
}
|
|
229
231
|
function getDataGridTableOrderedVisibleColumns(table) {
|
|
230
232
|
return [
|
|
231
|
-
...table.
|
|
233
|
+
...table.getStartVisibleLeafColumns(),
|
|
232
234
|
...table.getCenterVisibleLeafColumns(),
|
|
233
|
-
...table.
|
|
235
|
+
...table.getEndVisibleLeafColumns()
|
|
234
236
|
];
|
|
235
237
|
}
|
|
236
238
|
function getDataGridTableOrderedVisibleCells(row) {
|
|
237
239
|
return [
|
|
238
|
-
...row.
|
|
240
|
+
...row.getStartVisibleCells(),
|
|
239
241
|
...row.getCenterVisibleCells(),
|
|
240
|
-
...row.
|
|
242
|
+
...row.getEndVisibleCells()
|
|
241
243
|
];
|
|
242
244
|
}
|
|
243
245
|
function getDataGridTableMergedHeaderGroups(table) {
|
|
244
|
-
const leftHeaderGroups = table.
|
|
246
|
+
const leftHeaderGroups = table.getStartHeaderGroups();
|
|
245
247
|
const centerHeaderGroups = table.getCenterHeaderGroups();
|
|
246
|
-
const rightHeaderGroups = table.
|
|
248
|
+
const rightHeaderGroups = table.getEndHeaderGroups();
|
|
247
249
|
const headerGroupCount = Math.max(leftHeaderGroups.length, centerHeaderGroups.length, rightHeaderGroups.length);
|
|
248
250
|
return Array.from({ length: headerGroupCount }, (_, index) => {
|
|
249
251
|
const leftGroup = leftHeaderGroups[index];
|
|
@@ -264,7 +266,7 @@ function getDataGridTableMergedHeaderGroups(table) {
|
|
|
264
266
|
});
|
|
265
267
|
}
|
|
266
268
|
function hasDataGridTableRightPinnedColumns(table) {
|
|
267
|
-
return (table.
|
|
269
|
+
return (table.state.columnPinning.end?.length ?? 0) > 0;
|
|
268
270
|
}
|
|
269
271
|
function DataGridTableFillCol() {
|
|
270
272
|
const { props } = useDataGrid();
|
|
@@ -305,9 +307,9 @@ function DataGridTableFillFootCell() {
|
|
|
305
307
|
}
|
|
306
308
|
function DataGridTableBase({ children }) {
|
|
307
309
|
const { props, table } = useDataGrid();
|
|
308
|
-
const leftVisibleColumns = table.
|
|
310
|
+
const leftVisibleColumns = table.getStartVisibleLeafColumns();
|
|
309
311
|
const centerVisibleColumns = table.getCenterVisibleLeafColumns();
|
|
310
|
-
const rightVisibleColumns = table.
|
|
312
|
+
const rightVisibleColumns = table.getEndVisibleLeafColumns();
|
|
311
313
|
const hasRightPinnedColumns = hasDataGridTableRightPinnedColumns(table);
|
|
312
314
|
/**
|
|
313
315
|
* Compute column widths as CSS custom properties once upfront (memoized).
|
|
@@ -420,10 +422,10 @@ function DataGridTableHeadRowCell({ children, header, dndRef, dndStyle }) {
|
|
|
420
422
|
const { props } = useDataGrid();
|
|
421
423
|
const { column } = header;
|
|
422
424
|
const isPinned = column.getIsPinned();
|
|
423
|
-
const
|
|
424
|
-
const
|
|
425
|
-
const
|
|
426
|
-
const
|
|
425
|
+
const isFirstStartPinned = isPinned === "start" && column.getIsFirstColumn("start");
|
|
426
|
+
const isLastStartPinned = isPinned === "start" && column.getIsLastColumn("start");
|
|
427
|
+
const isFirstEndPinned = isPinned === "end" && column.getIsFirstColumn("end");
|
|
428
|
+
const isLastEndPinned = isPinned === "end" && column.getIsLastColumn("end");
|
|
427
429
|
const isLastVisibleColumn = column.getIndex() === header.getContext().table.getVisibleLeafColumns().length - 1;
|
|
428
430
|
const headerCellSpacing = headerCellSpacingVariants({ size: props.tableLayout?.dense ? "dense" : "default" });
|
|
429
431
|
const sortDirection = column.getIsSorted();
|
|
@@ -439,18 +441,33 @@ function DataGridTableHeadRowCell({ children, header, dndRef, dndStyle }) {
|
|
|
439
441
|
...dndStyle ? dndStyle : null
|
|
440
442
|
},
|
|
441
443
|
"data-pinned": isPinned || void 0,
|
|
442
|
-
"data-outer-pinned-col":
|
|
443
|
-
"data-last-col":
|
|
444
|
-
className: cn("relative h-10 text-left align-middle font-medium text-foreground rtl:text-right [&:has([role=checkbox])]:pe-0", headerCellSpacing, props.tableLayout?.headerBackground && "bg-muted", props.tableLayout?.cellBorder && "border-e", props.tableLayout?.columnsResizable && column.getCanResize() && (isPinned ? "overflow-hidden" : "overflow-visible"), props.tableLayout?.columnsResizable && column.getCanResize() && isLastVisibleColumn && "pe-8", props.tableLayout?.columnsPinnable && column.getCanPin() && cn("data-pinned:isolate data-pinned:bg-muted data-outer-pinned-col:bg-clip-padding", "[&[data-pinned=
|
|
444
|
+
"data-outer-pinned-col": isFirstStartPinned ? "start" : isLastEndPinned ? "end" : void 0,
|
|
445
|
+
"data-last-col": isLastStartPinned ? "start" : isFirstEndPinned ? "end" : void 0,
|
|
446
|
+
className: cn("relative h-10 text-left align-middle font-medium text-foreground rtl:text-right [&:has([role=checkbox])]:pe-0", headerCellSpacing, props.tableLayout?.headerBackground && "bg-muted", props.tableLayout?.cellBorder && "border-e", props.tableLayout?.columnsResizable && column.getCanResize() && (isPinned ? "overflow-hidden" : "overflow-visible"), props.tableLayout?.columnsResizable && column.getCanResize() && isLastVisibleColumn && "pe-8", props.tableLayout?.columnsPinnable && column.getCanPin() && cn("data-pinned:isolate data-pinned:bg-muted data-outer-pinned-col:bg-clip-padding", "[&[data-pinned=end]:last-child_div.cursor-col-resize:last-child]:opacity-0 [&[data-pinned=end][data-last-col=end]]:shadow-[inset_1px_0_0_0_var(--border)] [&[data-pinned=start][data-last-col=start]]:shadow-[inset_-1px_0_0_0_var(--border)]", "[&:not([data-pinned]):has(+[data-pinned])_div.cursor-col-resize:last-child]:opacity-0 [&[data-last-col=start]_div.cursor-col-resize:last-child]:opacity-0"), header.column.columnDef.meta?.headerClassName, column.getIndex() === 0 || isLastVisibleColumn ? props.tableClassNames?.edgeCell : ""),
|
|
445
447
|
children
|
|
446
448
|
});
|
|
447
449
|
}
|
|
450
|
+
/**
|
|
451
|
+
* TanStack's own default, restated here on purpose.
|
|
452
|
+
*
|
|
453
|
+
* v8 merged each feature's default table options into `table.options`, so
|
|
454
|
+
* reading `table.options.columnResizeMode` gave you `"onEnd"` even when the
|
|
455
|
+
* consumer never set it. v9 resolves feature defaults internally and leaves
|
|
456
|
+
* the option `undefined` on the instance, so the old `?? table.options...`
|
|
457
|
+
* fallback quietly produced `undefined` - and every grid that had not opted
|
|
458
|
+
* into a mode explicitly lost the onEnd drag session: no cursor lock, no
|
|
459
|
+
* vertical indicator, and an immediate commit instead of a deferred one.
|
|
460
|
+
*/
|
|
461
|
+
const DATA_GRID_DEFAULT_COLUMN_RESIZE_MODE = "onEnd";
|
|
462
|
+
function getDataGridColumnResizeMode(layoutMode, tableMode) {
|
|
463
|
+
return layoutMode ?? tableMode ?? DATA_GRID_DEFAULT_COLUMN_RESIZE_MODE;
|
|
464
|
+
}
|
|
448
465
|
function DataGridTableHeadRowCellResize({ header }) {
|
|
449
466
|
const { props, table } = useDataGrid();
|
|
450
467
|
const { column } = header;
|
|
451
468
|
const isPinned = column.getIsPinned();
|
|
452
469
|
const isLastVisibleColumn = column.getIndex() === header.getContext().table.getVisibleLeafColumns().length - 1;
|
|
453
|
-
const isResizeModeOnEnd = (props.tableLayout?.columnsResizeMode
|
|
470
|
+
const isResizeModeOnEnd = getDataGridColumnResizeMode(props.tableLayout?.columnsResizeMode, table.options.columnResizeMode) === "onEnd";
|
|
454
471
|
const stopResizeSessionRef = useRef(void 0);
|
|
455
472
|
useEffect(() => {
|
|
456
473
|
return () => {
|
|
@@ -483,7 +500,7 @@ function DataGridTableHeadRowCellResize({ header }) {
|
|
|
483
500
|
onDoubleClick: () => column.resetSize(),
|
|
484
501
|
onMouseDown: handleMouseDown,
|
|
485
502
|
onTouchStart: handleTouchStart,
|
|
486
|
-
className: cn("user-select-none absolute top-0 z-10 flex h-full cursor-col-resize touch-none", isLastVisibleColumn ? "end-0 w-5 justify-end before:hidden" : isPinned ? "end-0 w-5 justify-end before:hidden" : "-end-2 w-5 justify-center before:absolute before:inset-y-0 before:w-px before:-translate-x-px before:bg-border", column.getIsResizing() && (isResizeModeOnEnd ? "opacity-100" : isLastVisibleColumn ? "opacity-100 before:absolute before:inset-y-0 before:end-0 before:block before:w-0.5 before:bg-primary" : "opacity-100 before:block before:w-0.5 before:bg-primary"))
|
|
503
|
+
className: cn("user-select-none absolute top-0 z-10 flex h-full cursor-col-resize touch-none", isLastVisibleColumn ? "end-0 w-5 justify-end before:hidden" : isPinned ? cn("end-0 w-5 justify-end", props.tableLayout?.columnsPinnable ? "before:hidden" : "before:absolute before:inset-y-0 before:end-0 before:w-px before:bg-border") : "-end-2 w-5 justify-center before:absolute before:inset-y-0 before:w-px before:-translate-x-px before:bg-border", column.getIsResizing() && (isResizeModeOnEnd ? "opacity-100" : isLastVisibleColumn ? "opacity-100 before:absolute before:inset-y-0 before:end-0 before:block before:w-0.5 before:bg-primary" : "opacity-100 before:block before:w-0.5 before:bg-primary"))
|
|
487
504
|
});
|
|
488
505
|
}
|
|
489
506
|
function DataGridTableResizeIndicator({ viewportNodeRef }) {
|
|
@@ -494,9 +511,9 @@ function DataGridTableResizeIndicator({ viewportNodeRef }) {
|
|
|
494
511
|
key: false,
|
|
495
512
|
value: 0
|
|
496
513
|
});
|
|
497
|
-
const
|
|
498
|
-
const resizingColumnId =
|
|
499
|
-
const resizeMode = props.tableLayout?.columnsResizeMode
|
|
514
|
+
const columnResizing = table.state.columnResizing;
|
|
515
|
+
const resizingColumnId = columnResizing.isResizingColumn;
|
|
516
|
+
const resizeMode = getDataGridColumnResizeMode(props.tableLayout?.columnsResizeMode, table.options.columnResizeMode);
|
|
500
517
|
const isActive = !!(props.tableLayout?.columnsResizable && resizeMode === "onEnd" && resizingColumnId);
|
|
501
518
|
useLayoutEffect(() => {
|
|
502
519
|
const indicator = indicatorRef.current;
|
|
@@ -506,13 +523,13 @@ function DataGridTableResizeIndicator({ viewportNodeRef }) {
|
|
|
506
523
|
const resizingHeader = table.getFlatHeaders().find((header) => header.column.id === resizingColumnId || header.id === resizingColumnId);
|
|
507
524
|
if (!resizingHeader) return;
|
|
508
525
|
const directionMultiplier = table.options.columnResizeDirection === "rtl" ? -1 : 1;
|
|
509
|
-
const deltaOffset = (
|
|
526
|
+
const deltaOffset = (columnResizing.deltaOffset ?? 0) * directionMultiplier;
|
|
510
527
|
if (headerHeightCacheRef.current.key !== resizingColumnId) headerHeightCacheRef.current = {
|
|
511
528
|
key: resizingColumnId,
|
|
512
529
|
value: viewportElement?.querySelector("[data-slot=\"data-grid-table\"] thead")?.getBoundingClientRect().height ?? 0
|
|
513
530
|
};
|
|
514
531
|
const headerHeight = headerHeightCacheRef.current.value;
|
|
515
|
-
const indicatorLeft = typeof
|
|
532
|
+
const indicatorLeft = typeof columnResizing.startOffset === "number" && viewportElement ? columnResizing.startOffset - viewportElement.getBoundingClientRect().left : resizingHeader.getStart() + resizingHeader.getSize();
|
|
516
533
|
indicator.style.left = `${indicatorLeft}px`;
|
|
517
534
|
indicator.style.transform = `translateX(${deltaOffset}px)`;
|
|
518
535
|
indicatorHead.style.height = `${Math.max(headerHeight, 6)}px`;
|
|
@@ -521,7 +538,8 @@ function DataGridTableResizeIndicator({ viewportNodeRef }) {
|
|
|
521
538
|
return /* @__PURE__ */ jsxs("div", {
|
|
522
539
|
ref: indicatorRef,
|
|
523
540
|
"aria-hidden": "true",
|
|
524
|
-
|
|
541
|
+
"data-slot": "data-grid-table-resize-indicator",
|
|
542
|
+
className: "pointer-events-none absolute inset-y-0 z-50",
|
|
525
543
|
children: [/* @__PURE__ */ jsx("div", { className: "absolute inset-y-0 left-0 w-px -translate-x-1/2 bg-primary/85" }), /* @__PURE__ */ jsx("div", {
|
|
526
544
|
ref: indicatorHeadRef,
|
|
527
545
|
className: "absolute top-0 left-0 -translate-x-1/2 rounded-b-sm bg-primary shadow-xs",
|
|
@@ -581,7 +599,7 @@ function DataGridTableBodyRowSkeletonCell({ children, column }) {
|
|
|
581
599
|
const bodyCellSpacing = bodyCellSpacingVariants({ size: props.tableLayout?.dense ? "dense" : "default" });
|
|
582
600
|
return /* @__PURE__ */ jsx("td", {
|
|
583
601
|
style: props.tableLayout?.columnsResizable ? { width: `calc(var(--col-${column.id}-size) * 1px)` } : void 0,
|
|
584
|
-
className: cn("align-middle", bodyCellSpacing, props.tableLayout?.cellBorder && "border-e", props.tableLayout?.columnsResizable && column.getCanResize() && "truncate", column.columnDef.meta?.cellClassName, props.tableLayout?.columnsPinnable && column.getCanPin() && "data-pinned:isolate data-pinned:bg-background [&[data-pinned=
|
|
602
|
+
className: cn("align-middle", bodyCellSpacing, props.tableLayout?.cellBorder && "border-e", props.tableLayout?.columnsResizable && column.getCanResize() && "truncate", column.columnDef.meta?.cellClassName, props.tableLayout?.columnsPinnable && column.getCanPin() && "data-pinned:isolate data-pinned:bg-background [&[data-pinned=end][data-last-col=end]]:shadow-[inset_1px_0_0_0_var(--border)] [&[data-pinned=start][data-last-col=start]]:shadow-[inset_-1px_0_0_0_var(--border)]", column.getIndex() === 0 || column.getIndex() === table.getVisibleLeafColumns().length - 1 ? props.tableClassNames?.edgeCell : ""),
|
|
585
603
|
children
|
|
586
604
|
});
|
|
587
605
|
}
|
|
@@ -598,6 +616,7 @@ function DataGridTableBodyRow({ children, row, pinnedBoundary, rowRef, dndRef, d
|
|
|
598
616
|
"data-state": table.options.enableRowSelection && row.getIsSelected() ? "selected" : void 0,
|
|
599
617
|
"data-index": dataIndex,
|
|
600
618
|
"data-row-id": row.id,
|
|
619
|
+
"data-depth": row.depth || void 0,
|
|
601
620
|
"data-row-pinned": isRowPinned || void 0,
|
|
602
621
|
"data-row-pinned-boundary": pinnedBoundary,
|
|
603
622
|
onClick: () => props.onRowClick?.(row.original),
|
|
@@ -607,11 +626,13 @@ function DataGridTableBodyRow({ children, row, pinnedBoundary, rowRef, dndRef, d
|
|
|
607
626
|
}
|
|
608
627
|
function DataGridTableBodyRowExpandded({ row }) {
|
|
609
628
|
const { props, table } = useDataGrid();
|
|
629
|
+
const expandedContent = table.getAllColumns().find((column) => column.columnDef.meta?.expandedContent)?.columnDef.meta?.expandedContent;
|
|
630
|
+
if (!expandedContent) return null;
|
|
610
631
|
return /* @__PURE__ */ jsx("tr", {
|
|
611
632
|
className: cn(props.tableLayout?.rowBorder && "[&:not(:last-child)>td]:border-b [tbody:has(+tfoot)_&:last-child>td]:border-b [*:has(>[data-slot=data-grid]+[data-slot=data-grid-pagination])_[data-slot=data-grid]_&:last-child>td]:border-b"),
|
|
612
633
|
children: /* @__PURE__ */ jsx("td", {
|
|
613
634
|
colSpan: getDataGridTableOrderedVisibleCells(row).length + (props.tableLayout?.columnsResizable ? 1 : 0),
|
|
614
|
-
children:
|
|
635
|
+
children: expandedContent(row.original)
|
|
615
636
|
})
|
|
616
637
|
});
|
|
617
638
|
}
|
|
@@ -619,8 +640,8 @@ function DataGridTableBodyRowCell({ children, cell, dndRef, dndStyle }) {
|
|
|
619
640
|
const { props } = useDataGrid();
|
|
620
641
|
const { column, row } = cell;
|
|
621
642
|
const isPinned = column.getIsPinned();
|
|
622
|
-
const
|
|
623
|
-
const
|
|
643
|
+
const isLastStartPinned = isPinned === "start" && column.getIsLastColumn("start");
|
|
644
|
+
const isFirstEndPinned = isPinned === "end" && column.getIsFirstColumn("end");
|
|
624
645
|
const bodyCellSpacing = bodyCellSpacingVariants({ size: props.tableLayout?.dense ? "dense" : "default" });
|
|
625
646
|
return /* @__PURE__ */ jsx("td", {
|
|
626
647
|
ref: dndRef,
|
|
@@ -630,16 +651,16 @@ function DataGridTableBodyRowCell({ children, cell, dndRef, dndStyle }) {
|
|
|
630
651
|
...dndStyle ? dndStyle : null
|
|
631
652
|
},
|
|
632
653
|
"data-pinned": isPinned || void 0,
|
|
633
|
-
"data-last-col":
|
|
634
|
-
className: cn("align-middle", bodyCellSpacing, props.tableLayout?.cellBorder && "border-e", props.tableLayout?.columnsResizable && column.getCanResize() && "truncate", cell.column.columnDef.meta?.cellClassName, props.tableLayout?.columnsPinnable && column.getCanPin() && cn("data-pinned:isolate data-pinned:bg-background", "[&[data-pinned=
|
|
654
|
+
"data-last-col": isLastStartPinned ? "start" : isFirstEndPinned ? "end" : void 0,
|
|
655
|
+
className: cn("align-middle", bodyCellSpacing, props.tableLayout?.cellBorder && "border-e", props.tableLayout?.columnsResizable && column.getCanResize() && "truncate", cell.column.columnDef.meta?.cellClassName, props.tableLayout?.columnsPinnable && column.getCanPin() && cn("data-pinned:isolate data-pinned:bg-background", "[&[data-pinned=start][data-last-col=start]]:shadow-[inset_-1px_0_0_0_var(--border)]", "[&[data-pinned=end][data-last-col=end]]:shadow-[inset_1px_0_0_0_var(--border)]"), column.getIndex() === 0 || column.getIndex() === row.getVisibleCells().length - 1 ? props.tableClassNames?.edgeCell : ""),
|
|
635
656
|
children
|
|
636
657
|
});
|
|
637
658
|
}
|
|
638
659
|
function DataGridTableRenderedRow({ row, pinnedBoundary, rowRef, rowIndex }) {
|
|
639
660
|
const { props, table } = useDataGrid();
|
|
640
|
-
const
|
|
661
|
+
const startVisibleCells = row.getStartVisibleCells();
|
|
641
662
|
const centerVisibleCells = row.getCenterVisibleCells();
|
|
642
|
-
const
|
|
663
|
+
const endVisibleCells = row.getEndVisibleCells();
|
|
643
664
|
const hasRightPinnedColumns = hasDataGridTableRightPinnedColumns(table);
|
|
644
665
|
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(DataGridTableBodyRow, {
|
|
645
666
|
row,
|
|
@@ -647,12 +668,12 @@ function DataGridTableRenderedRow({ row, pinnedBoundary, rowRef, rowIndex }) {
|
|
|
647
668
|
rowRef,
|
|
648
669
|
dataIndex: rowIndex,
|
|
649
670
|
children: [
|
|
650
|
-
[...
|
|
671
|
+
[...startVisibleCells, ...centerVisibleCells].map((cell) => /* @__PURE__ */ jsx(DataGridTableBodyRowCell, {
|
|
651
672
|
cell,
|
|
652
673
|
children: flexRender(cell.column.columnDef.cell, cell.getContext())
|
|
653
674
|
}, cell.id)),
|
|
654
675
|
props.tableLayout?.columnsResizable && hasRightPinnedColumns ? /* @__PURE__ */ jsx(DataGridTableFillBodyCell, {}) : null,
|
|
655
|
-
|
|
676
|
+
endVisibleCells.map((cell) => /* @__PURE__ */ jsx(DataGridTableBodyRowCell, {
|
|
656
677
|
cell,
|
|
657
678
|
children: flexRender(cell.column.columnDef.cell, cell.getContext())
|
|
658
679
|
}, cell.id)),
|
|
@@ -717,37 +738,100 @@ function DataGridTableRowPin({ row }) {
|
|
|
717
738
|
})
|
|
718
739
|
});
|
|
719
740
|
}
|
|
741
|
+
/**
|
|
742
|
+
* Selection cell.
|
|
743
|
+
*
|
|
744
|
+
* The `Subscribe` wrapper is the v9 fix for React Compiler, and it is why this
|
|
745
|
+
* file no longer needs `"use no memo"`. `useTable` hands back a fresh table on
|
|
746
|
+
* every state change, which covers anything read through `table`, but this
|
|
747
|
+
* component reads selection through `row.getIsSelected()` - a builder call
|
|
748
|
+
* that hides its state dependency from the compiler. Rendered inside a column
|
|
749
|
+
* `cell` template it receives a *stable* row, so the compiler is free to
|
|
750
|
+
* memoize this JSX and never re-run those reads, which shows up as checkboxes
|
|
751
|
+
* that do not respond to clicks.
|
|
752
|
+
*
|
|
753
|
+
* Subscribing to the row-selection atom gives the compiler a dependency it can
|
|
754
|
+
* see. Note the standalone `Subscribe` rather than `table.Subscribe`: inside a
|
|
755
|
+
* cell template the `table` handed to the column def is the core `Table`, which
|
|
756
|
+
* has no `Subscribe` attached.
|
|
757
|
+
*/
|
|
720
758
|
function DataGridTableRowSelect({ row }) {
|
|
721
|
-
return /* @__PURE__ */
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
759
|
+
return /* @__PURE__ */ jsx(Subscribe, {
|
|
760
|
+
source: row.table.atoms.rowSelection,
|
|
761
|
+
children: () => /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("div", { className: cn("absolute inset-s-0 top-0 bottom-0 hidden w-[2px] bg-primary", row.getIsSelected() && "block") }), /* @__PURE__ */ jsx(Checkbox, {
|
|
762
|
+
checked: row.getIsSelected(),
|
|
763
|
+
indeterminate: row.getIsSomeSelected() && !row.getIsSelected(),
|
|
764
|
+
onCheckedChange: (value) => row.toggleSelected(!!value),
|
|
765
|
+
onClick: (event) => {
|
|
766
|
+
event.stopPropagation();
|
|
767
|
+
},
|
|
768
|
+
"aria-label": "Select row",
|
|
769
|
+
className: "align-[inherit]"
|
|
770
|
+
})] })
|
|
771
|
+
});
|
|
730
772
|
}
|
|
731
773
|
function DataGridTableRowSelectAll() {
|
|
732
774
|
const { table, recordCount, isLoading } = useDataGrid();
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
775
|
+
return /* @__PURE__ */ jsx(Subscribe, {
|
|
776
|
+
source: table.atoms.rowSelection,
|
|
777
|
+
children: () => {
|
|
778
|
+
const isAllSelected = table.getIsAllPageRowsSelected();
|
|
779
|
+
const isSomeSelected = table.getIsSomePageRowsSelected();
|
|
780
|
+
return /* @__PURE__ */ jsx(Checkbox, {
|
|
781
|
+
checked: isAllSelected,
|
|
782
|
+
indeterminate: isSomeSelected && !isAllSelected,
|
|
783
|
+
disabled: isLoading || recordCount === 0,
|
|
784
|
+
onCheckedChange: (value) => table.toggleAllPageRowsSelected(!!value),
|
|
785
|
+
"aria-label": "Select all",
|
|
786
|
+
className: "align-[inherit]"
|
|
787
|
+
});
|
|
788
|
+
}
|
|
789
|
+
});
|
|
790
|
+
}
|
|
791
|
+
function DataGridTableRowExpand({ row, indent = 20, className, children }) {
|
|
792
|
+
const { props } = useDataGrid();
|
|
793
|
+
const isExpanded = row.getIsExpanded();
|
|
794
|
+
const controlSize = props.tableLayout?.dense ? "size-6" : "size-7";
|
|
795
|
+
return /* @__PURE__ */ jsx("span", {
|
|
796
|
+
"data-slot": "data-grid-table-row-expand",
|
|
797
|
+
style: getDataGridTreeIndentStyle(row, indent),
|
|
798
|
+
className: cn("inline-flex shrink-0 items-center ps-(--data-grid-tree-padding) align-middle", className),
|
|
799
|
+
children: row.getCanExpand() ? /* @__PURE__ */ jsx("button", {
|
|
800
|
+
type: "button",
|
|
801
|
+
"aria-expanded": isExpanded,
|
|
802
|
+
"aria-label": isExpanded ? "Collapse row" : "Expand row",
|
|
803
|
+
onClick: (event) => {
|
|
804
|
+
event.stopPropagation();
|
|
805
|
+
row.toggleExpanded();
|
|
806
|
+
},
|
|
807
|
+
className: cn("inline-flex items-center justify-center rounded-lg text-muted-foreground transition-colors hover:text-foreground", controlSize),
|
|
808
|
+
children: children ?? /* @__PURE__ */ jsx("svg", {
|
|
809
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
810
|
+
width: "16",
|
|
811
|
+
height: "16",
|
|
812
|
+
viewBox: "0 0 24 24",
|
|
813
|
+
fill: "none",
|
|
814
|
+
stroke: "currentColor",
|
|
815
|
+
strokeWidth: "2",
|
|
816
|
+
strokeLinecap: "round",
|
|
817
|
+
strokeLinejoin: "round",
|
|
818
|
+
"aria-hidden": "true",
|
|
819
|
+
className: "in-aria-[expanded=false]:-rotate-90 transition-transform duration-200 rtl:in-aria-[expanded=false]:rotate-90",
|
|
820
|
+
children: /* @__PURE__ */ jsx("path", { d: "m6 9 6 6 6-6" })
|
|
821
|
+
})
|
|
822
|
+
}) : /* @__PURE__ */ jsx("span", {
|
|
823
|
+
"aria-hidden": "true",
|
|
824
|
+
className: "w-2 shrink-0"
|
|
825
|
+
})
|
|
742
826
|
});
|
|
743
827
|
}
|
|
744
828
|
function DataGridTableBodyRows({ table }) {
|
|
745
829
|
const { isLoading, props } = useDataGrid();
|
|
746
|
-
const pagination = table.
|
|
830
|
+
const pagination = table.state.pagination;
|
|
747
831
|
if (isLoading && props.loadingMode === "skeleton" && pagination?.pageSize) {
|
|
748
|
-
const leftVisibleColumns = table.
|
|
832
|
+
const leftVisibleColumns = table.getStartVisibleLeafColumns();
|
|
749
833
|
const centerVisibleColumns = table.getCenterVisibleLeafColumns();
|
|
750
|
-
const rightVisibleColumns = table.
|
|
834
|
+
const rightVisibleColumns = table.getEndVisibleLeafColumns();
|
|
751
835
|
const hasRightPinnedColumns = hasDataGridTableRightPinnedColumns(table);
|
|
752
836
|
return /* @__PURE__ */ jsx(Fragment$1, { children: Array.from({ length: pagination.pageSize }).map((_, rowIndex) => /* @__PURE__ */ jsxs(DataGridTableBodyRowSkeleton, { children: [
|
|
753
837
|
[...leftVisibleColumns, ...centerVisibleColumns].map((column) => /* @__PURE__ */ jsx(DataGridTableBodyRowSkeletonCell, {
|
|
@@ -799,7 +883,7 @@ function DataGridTableBodyRows({ table }) {
|
|
|
799
883
|
* Column widths update via CSS variables on the <table> element,
|
|
800
884
|
* so the browser handles width changes without React re-renders.
|
|
801
885
|
*/
|
|
802
|
-
const MemoizedDataGridTableBodyRows = memo(DataGridTableBodyRows, (_prev, next) => !!next.table.
|
|
886
|
+
const MemoizedDataGridTableBodyRows = memo(DataGridTableBodyRows, (_prev, next) => !!next.table.state.columnResizing.isResizingColumn);
|
|
803
887
|
function DataGridTableHeader() {
|
|
804
888
|
const { table, props } = useDataGrid();
|
|
805
889
|
const mergedHeaderGroups = getDataGridTableMergedHeaderGroups(table);
|
|
@@ -808,7 +892,7 @@ function DataGridTableHeader() {
|
|
|
808
892
|
return /* @__PURE__ */ jsxs(DataGridTableHeadRow, {
|
|
809
893
|
rowId: headerGroup.id,
|
|
810
894
|
children: [
|
|
811
|
-
headerGroup.headers.filter((header) => header.column.getIsPinned() !== "
|
|
895
|
+
headerGroup.headers.filter((header) => header.column.getIsPinned() !== "end").map((header) => {
|
|
812
896
|
const { column } = header;
|
|
813
897
|
return /* @__PURE__ */ jsxs(DataGridTableHeadRowCell, {
|
|
814
898
|
header,
|
|
@@ -816,7 +900,7 @@ function DataGridTableHeader() {
|
|
|
816
900
|
}, header.id);
|
|
817
901
|
}),
|
|
818
902
|
props.tableLayout?.columnsResizable && hasRightPinnedColumns ? /* @__PURE__ */ jsx(DataGridTableFillHeadCell, {}) : null,
|
|
819
|
-
headerGroup.headers.filter((header) => header.column.getIsPinned() === "
|
|
903
|
+
headerGroup.headers.filter((header) => header.column.getIsPinned() === "end").map((header) => {
|
|
820
904
|
const { column } = header;
|
|
821
905
|
return /* @__PURE__ */ jsxs(DataGridTableHeadRowCell, {
|
|
822
906
|
header,
|
|
@@ -837,7 +921,7 @@ function DataGridTable({ footerContent, renderHeader = true }) {
|
|
|
837
921
|
return /* @__PURE__ */ jsxs(DataGridTableHeadRow, {
|
|
838
922
|
rowId: headerGroup.id,
|
|
839
923
|
children: [
|
|
840
|
-
headerGroup.headers.filter((header) => header.column.getIsPinned() !== "
|
|
924
|
+
headerGroup.headers.filter((header) => header.column.getIsPinned() !== "end").map((header) => {
|
|
841
925
|
const { column } = header;
|
|
842
926
|
return /* @__PURE__ */ jsxs(DataGridTableHeadRowCell, {
|
|
843
927
|
header,
|
|
@@ -845,7 +929,7 @@ function DataGridTable({ footerContent, renderHeader = true }) {
|
|
|
845
929
|
}, header.id);
|
|
846
930
|
}),
|
|
847
931
|
props.tableLayout?.columnsResizable && hasRightPinnedColumns ? /* @__PURE__ */ jsx(DataGridTableFillHeadCell, {}) : null,
|
|
848
|
-
headerGroup.headers.filter((header) => header.column.getIsPinned() === "
|
|
932
|
+
headerGroup.headers.filter((header) => header.column.getIsPinned() === "end").map((header) => {
|
|
849
933
|
const { column } = header;
|
|
850
934
|
return /* @__PURE__ */ jsxs(DataGridTableHeadRowCell, {
|
|
851
935
|
header,
|
|
@@ -862,6 +946,6 @@ function DataGridTable({ footerContent, renderHeader = true }) {
|
|
|
862
946
|
] }) });
|
|
863
947
|
}
|
|
864
948
|
//#endregion
|
|
865
|
-
export { DataGridTable, DataGridTableBase, DataGridTableBody, DataGridTableBodyRow, DataGridTableBodyRowCell, DataGridTableBodyRowExpandded, DataGridTableBodyRowSkeleton, DataGridTableBodyRowSkeletonCell, DataGridTableEmpty, DataGridTableFillBodyCell, DataGridTableFillHeadCell, DataGridTableFoot, DataGridTableFootRow, DataGridTableFootRowCell, DataGridTableHead, DataGridTableHeadRow, DataGridTableHeadRowCell, DataGridTableHeadRowCellResize, DataGridTableHeader, DataGridTableLoader, DataGridTableRenderedRow, DataGridTableRowPin, DataGridTableRowSelect, DataGridTableRowSelectAll, DataGridTableRowSpacer, DataGridTableViewport, getDataGridScrollAreaViewport, getDataGridTableMergedHeaderGroups, getDataGridTableResolvedRows, getDataGridTableRowSections, getPinningStyles, hasDataGridTableRightPinnedColumns };
|
|
949
|
+
export { DataGridTable, DataGridTableBase, DataGridTableBody, DataGridTableBodyRow, DataGridTableBodyRowCell, DataGridTableBodyRowExpandded, DataGridTableBodyRowSkeleton, DataGridTableBodyRowSkeletonCell, DataGridTableEmpty, DataGridTableFillBodyCell, DataGridTableFillHeadCell, DataGridTableFoot, DataGridTableFootRow, DataGridTableFootRowCell, DataGridTableHead, DataGridTableHeadRow, DataGridTableHeadRowCell, DataGridTableHeadRowCellResize, DataGridTableHeader, DataGridTableLoader, DataGridTableRenderedRow, DataGridTableRowExpand, DataGridTableRowPin, DataGridTableRowSelect, DataGridTableRowSelectAll, DataGridTableRowSpacer, DataGridTableViewport, getDataGridScrollAreaViewport, getDataGridTableMergedHeaderGroups, getDataGridTableResolvedRows, getDataGridTableRowSections, getDataGridTreeIndentStyle, getPinningStyles, hasDataGridTableRightPinnedColumns };
|
|
866
950
|
|
|
867
951
|
//# sourceMappingURL=data-grid-table.js.map
|