@acronis-platform/ui-react 5.3.0 → 5.3.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/dist/components/ui/data-table/data-table-bulk-actions-bar.js +1 -1
- package/dist/components/ui/data-table/data-table-bulk-actions-bar.js.map +1 -1
- package/dist/components/ui/data-table/data-table-view-options.js +3 -2
- package/dist/components/ui/data-table/data-table-view-options.js.map +1 -1
- package/dist/components/ui/data-table/data-table.js +136 -132
- package/dist/components/ui/data-table/data-table.js.map +1 -1
- package/dist/components/ui/table/table-view-options.js +88 -33
- package/dist/components/ui/table/table-view-options.js.map +1 -1
- package/dist/components/ui/table/table.js.map +1 -1
- package/dist/llms/data-table.md +33 -7
- package/dist/llms/table.md +56 -23
- package/dist/llms.txt +1 -1
- package/dist/src/components/ui/data-table/data-table-view-options.d.ts +1 -1
- package/dist/src/components/ui/data-table/data-table.d.ts +11 -1
- package/dist/src/components/ui/data-table/data-table.docs.d.ts +6 -0
- package/dist/src/components/ui/table/table-view-options.d.ts +9 -1
- package/dist/ui-react.css +1 -1
- package/package.json +3 -3
|
@@ -5,7 +5,7 @@ import { Fragment as n, jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
|
5
5
|
function a({ table: a, children: o, selectedLabel: s = (e) => `${e} item${e === 1 ? "" : "s"} selected:`, clearLabel: c = "Deselect", loadedLabel: l }) {
|
|
6
6
|
let u = a.getSelectedRowModel().rows.length, d = t(a);
|
|
7
7
|
return /* @__PURE__ */ i("div", {
|
|
8
|
-
className: "flex items-center gap-4",
|
|
8
|
+
className: "flex items-center gap-4 px-[var(--ui-table-global-cell-padding-x)]",
|
|
9
9
|
children: [/* @__PURE__ */ r("fieldset", {
|
|
10
10
|
disabled: !d,
|
|
11
11
|
className: "m-0 flex min-w-0 items-center gap-4 border-0 p-0",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-table-bulk-actions-bar.js","names":[],"sources":["../../../../src/components/ui/data-table/data-table-bulk-actions-bar.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { Table } from '@tanstack/react-table';\n\nimport { Button } from '../button';\nimport { isBulkSelectionActive } from './data-table-selection';\n\ninterface DataTableBulkActionsBarProps<TData> {\n table: Table<TData>;\n /**\n * Bulk actions offered for the current selection — rendered leading, ahead\n * of the trailing summary/Deselect control. Wrapped in a native `<fieldset\n * disabled>` while nothing is selected, so every nested control (a `Button`\n * renders a plain `<button>`) picks up the disabled state and styling for\n * free — no per-action wiring needed. Each action reads the selection off\n * the same `table` instance (`table.getSelectedRowModel().rows`).\n */\n children?: ReactNode;\n /** Builds the trailing selection summary from the selected-row count. */\n selectedLabel?: (count: number) => string;\n /** Label of the trailing control that clears the selection. */\n clearLabel?: string;\n /**\n * Trailing summary shown in place of the selection summary while nothing is\n * selected — e.g. `\"25 of 1250 items loaded\"`. Omit to render nothing in\n * that state.\n */\n loadedLabel?: ReactNode;\n}\n\n// Thin TanStack adapter: reads the selected-row count off\n// `table.getSelectedRowModel()` and routes Deselect back through\n// `table.resetRowSelection()`. It owns no state of its own.\n//\n// Always mounted (unlike a bar that appears/disappears with selection) — it\n// just toggles between two states (Figma 5916-11286 disabled / 5916-11991\n// enabled), on the same `isBulkSelectionActive` threshold that hides the\n// per-row actions column: with nothing selected, the leading actions are\n// disabled and the trailing side shows `loadedLabel`; once at least one row\n// is selected — including exactly one — the actions enable and the trailing\n// side switches to the selection summary + Deselect.\nexport function DataTableBulkActionsBar<TData>({\n table,\n children,\n selectedLabel = (count) => `${count} item${count === 1 ? '' : 's'} selected:`,\n clearLabel = 'Deselect',\n loadedLabel,\n}: DataTableBulkActionsBarProps<TData>) {\n const selectedCount = table.getSelectedRowModel().rows.length;\n const hasSelection = isBulkSelectionActive(table);\n\n return (\n <div className=\"flex items-center gap-4\">\n <fieldset\n disabled={!hasSelection}\n className=\"m-0 flex min-w-0 items-center gap-4 border-0 p-0\"\n >\n {children}\n </fieldset>\n <div className=\"ms-auto flex items-center gap-2\">\n {hasSelection ? (\n <>\n <span className=\"text-sm\">{selectedLabel(selectedCount)}</span>\n <Button\n variant=\"ghost\"\n className=\"h-8\"\n onClick={() => table.resetRowSelection()}\n >\n {clearLabel}\n </Button>\n </>\n ) : (\n loadedLabel !== undefined && (\n <span className=\"text-sm text-muted-foreground\">{loadedLabel}</span>\n )\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;AAwCA,SAAgB,EAA+B,EAC7C,UACA,aACA,oBAAiB,MAAU,GAAG,EAAM,OAAO,MAAU,IAAI,KAAK,IAAI,aAClE,gBAAa,YACb,kBACsC;CACtC,IAAM,IAAgB,EAAM,oBAAoB,CAAC,CAAC,KAAK,QACjD,IAAe,EAAsB,CAAK;CAEhD,OACE,kBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,kBAAC,YAAD;GACE,UAAU,CAAC;GACX,WAAU;GAET;EACO,CAAA,GACV,kBAAC,OAAD;GAAK,WAAU;GACZ,UAAA,IACC,kBAAA,GAAA,EAAA,UAAA,CACE,kBAAC,QAAD;IAAM,WAAU;IAAW,UAAA,EAAc,CAAa;GAAQ,CAAA,GAC9D,kBAAC,GAAD;IACE,SAAQ;IACR,WAAU;IACV,eAAe,EAAM,kBAAkB;IAEtC,UAAA;GACK,CAAA,CACR,EAAA,CAAA,IAEF,MAAgB,KAAA,KACd,kBAAC,QAAD;IAAM,WAAU;IAAiC,UAAA;GAAkB,CAAA;EAGpE,CAAA,CACF;;AAET"}
|
|
1
|
+
{"version":3,"file":"data-table-bulk-actions-bar.js","names":[],"sources":["../../../../src/components/ui/data-table/data-table-bulk-actions-bar.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { Table } from '@tanstack/react-table';\n\nimport { Button } from '../button';\nimport { isBulkSelectionActive } from './data-table-selection';\n\ninterface DataTableBulkActionsBarProps<TData> {\n table: Table<TData>;\n /**\n * Bulk actions offered for the current selection — rendered leading, ahead\n * of the trailing summary/Deselect control. Wrapped in a native `<fieldset\n * disabled>` while nothing is selected, so every nested control (a `Button`\n * renders a plain `<button>`) picks up the disabled state and styling for\n * free — no per-action wiring needed. Each action reads the selection off\n * the same `table` instance (`table.getSelectedRowModel().rows`).\n */\n children?: ReactNode;\n /** Builds the trailing selection summary from the selected-row count. */\n selectedLabel?: (count: number) => string;\n /** Label of the trailing control that clears the selection. */\n clearLabel?: string;\n /**\n * Trailing summary shown in place of the selection summary while nothing is\n * selected — e.g. `\"25 of 1250 items loaded\"`. Omit to render nothing in\n * that state.\n */\n loadedLabel?: ReactNode;\n}\n\n// Thin TanStack adapter: reads the selected-row count off\n// `table.getSelectedRowModel()` and routes Deselect back through\n// `table.resetRowSelection()`. It owns no state of its own.\n//\n// Always mounted (unlike a bar that appears/disappears with selection) — it\n// just toggles between two states (Figma 5916-11286 disabled / 5916-11991\n// enabled), on the same `isBulkSelectionActive` threshold that hides the\n// per-row actions column: with nothing selected, the leading actions are\n// disabled and the trailing side shows `loadedLabel`; once at least one row\n// is selected — including exactly one — the actions enable and the trailing\n// side switches to the selection summary + Deselect.\nexport function DataTableBulkActionsBar<TData>({\n table,\n children,\n selectedLabel = (count) => `${count} item${count === 1 ? '' : 's'} selected:`,\n clearLabel = 'Deselect',\n loadedLabel,\n}: DataTableBulkActionsBarProps<TData>) {\n const selectedCount = table.getSelectedRowModel().rows.length;\n const hasSelection = isBulkSelectionActive(table);\n\n return (\n <div className=\"flex items-center gap-4 px-[var(--ui-table-global-cell-padding-x)]\">\n <fieldset\n disabled={!hasSelection}\n className=\"m-0 flex min-w-0 items-center gap-4 border-0 p-0\"\n >\n {children}\n </fieldset>\n <div className=\"ms-auto flex items-center gap-2\">\n {hasSelection ? (\n <>\n <span className=\"text-sm\">{selectedLabel(selectedCount)}</span>\n <Button\n variant=\"ghost\"\n className=\"h-8\"\n onClick={() => table.resetRowSelection()}\n >\n {clearLabel}\n </Button>\n </>\n ) : (\n loadedLabel !== undefined && (\n <span className=\"text-sm text-muted-foreground\">{loadedLabel}</span>\n )\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;AAwCA,SAAgB,EAA+B,EAC7C,UACA,aACA,oBAAiB,MAAU,GAAG,EAAM,OAAO,MAAU,IAAI,KAAK,IAAI,aAClE,gBAAa,YACb,kBACsC;CACtC,IAAM,IAAgB,EAAM,oBAAoB,CAAC,CAAC,KAAK,QACjD,IAAe,EAAsB,CAAK;CAEhD,OACE,kBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,kBAAC,YAAD;GACE,UAAU,CAAC;GACX,WAAU;GAET;EACO,CAAA,GACV,kBAAC,OAAD;GAAK,WAAU;GACZ,UAAA,IACC,kBAAA,GAAA,EAAA,UAAA,CACE,kBAAC,QAAD;IAAM,WAAU;IAAW,UAAA,EAAc,CAAa;GAAQ,CAAA,GAC9D,kBAAC,GAAD;IACE,SAAQ;IACR,WAAU;IACV,eAAe,EAAM,kBAAkB;IAEtC,UAAA;GACK,CAAA,CACR,EAAA,CAAA,IAEF,MAAgB,KAAA,KACd,kBAAC,QAAD;IAAM,WAAU;IAAiC,UAAA;GAAkB,CAAA;EAGpE,CAAA,CACF;;AAET"}
|
|
@@ -4,8 +4,9 @@ import { jsx as t } from "react/jsx-runtime";
|
|
|
4
4
|
function n({ table: n, ...r }) {
|
|
5
5
|
let i = n.getAllColumns().filter((e) => e.accessorFn !== void 0 && e.getCanHide()).map((e) => ({
|
|
6
6
|
id: e.id,
|
|
7
|
-
label: e.id,
|
|
8
|
-
hidden: !e.getIsVisible()
|
|
7
|
+
label: e.columnDef.meta?.label ?? (typeof e.columnDef.header == "string" ? e.columnDef.header : e.id),
|
|
8
|
+
hidden: !e.getIsVisible(),
|
|
9
|
+
category: e.columnDef.meta?.category
|
|
9
10
|
}));
|
|
10
11
|
return /* @__PURE__ */ t(e, {
|
|
11
12
|
columns: i,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-table-view-options.js","names":[],"sources":["../../../../src/components/ui/data-table/data-table-view-options.tsx"],"sourcesContent":["import type { Table } from '@tanstack/react-table';\n\nimport { TableViewOptions, type TableViewOptionsProps } from '../table';\n\ninterface DataTableViewOptionsProps<TData
|
|
1
|
+
{"version":3,"file":"data-table-view-options.js","names":[],"sources":["../../../../src/components/ui/data-table/data-table-view-options.tsx"],"sourcesContent":["import type { Table } from '@tanstack/react-table';\n\nimport { TableViewOptions, type TableViewOptionsProps } from '../table';\n\ninterface DataTableViewOptionsProps<TData> extends Pick<\n TableViewOptionsProps,\n | 'triggerLabel'\n | 'iconOnly'\n | 'triggerAriaLabel'\n | 'searchPlaceholder'\n | 'showAllLabel'\n | 'noResultsLabel'\n> {\n table: Table<TData>;\n}\n\n// Thin TanStack adapter over the primitive-only `TableViewOptions`: maps\n// `table.getAllColumns()` onto the plain `{ id, label, hidden }[]` shape and\n// routes `onToggle` back through `column.toggleVisibility()`.\nexport function DataTableViewOptions<TData>({\n table,\n ...triggerProps\n}: DataTableViewOptionsProps<TData>) {\n const columns = table\n .getAllColumns()\n .filter(\n (column) =>\n typeof column.accessorFn !== 'undefined' && column.getCanHide()\n )\n .map((column) => ({\n id: column.id,\n label:\n column.columnDef.meta?.label ??\n (typeof column.columnDef.header === 'string'\n ? column.columnDef.header\n : column.id),\n hidden: !column.getIsVisible(),\n category: column.columnDef.meta?.category,\n }));\n\n return (\n <TableViewOptions\n columns={columns}\n onToggle={(id) => {\n const column = table.getColumn(id);\n column?.toggleVisibility(!column.getIsVisible());\n }}\n {...triggerProps}\n />\n );\n}\n"],"mappings":";;;AAmBA,SAAgB,EAA4B,EAC1C,UACA,GAAG,KACgC;CACnC,IAAM,IAAU,EACb,cAAc,CAAC,CACf,QACE,MACQ,EAAO,eAAe,UAAe,EAAO,WAAW,CAClE,CAAC,CACA,KAAK,OAAY;EAChB,IAAI,EAAO;EACX,OACE,EAAO,UAAU,MAAM,UACtB,OAAO,EAAO,UAAU,UAAW,WAChC,EAAO,UAAU,SACjB,EAAO;EACb,QAAQ,CAAC,EAAO,aAAa;EAC7B,UAAU,EAAO,UAAU,MAAM;CACnC,EAAE;CAEJ,OACE,kBAAC,GAAD;EACW;EACT,WAAW,MAAO;GAChB,IAAM,IAAS,EAAM,UAAU,CAAE;GACjC,GAAQ,iBAAiB,CAAC,EAAO,aAAa,CAAC;EACjD;EACA,GAAI;CACL,CAAA;AAEL"}
|
|
@@ -8,11 +8,11 @@ import { DropdownMenu as ne, DropdownMenuContent as re, DropdownMenuTrigger as i
|
|
|
8
8
|
import { Table as ae, TableActionsCell as oe, TableBody as se, TableCell as f, TableHead as ce, TableHeader as le, TableRow as p, TableSettingsCell as ue } from "../table/table.js";
|
|
9
9
|
import { isBulkSelectionActive as de } from "./data-table-selection.js";
|
|
10
10
|
import { DataTableViewOptions as fe } from "./data-table-view-options.js";
|
|
11
|
-
import { Fragment as m, useEffect as
|
|
12
|
-
import { jsx as
|
|
13
|
-
import { EllipsisIcon as
|
|
11
|
+
import { Fragment as m, useEffect as h, useMemo as g, useRef as pe, useState as _ } from "react";
|
|
12
|
+
import { jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
13
|
+
import { EllipsisIcon as me } from "@acronis-platform/icons-react/stroke-mono";
|
|
14
14
|
//#region src/components/ui/data-table/data-table.tsx
|
|
15
|
-
function
|
|
15
|
+
function b(e) {
|
|
16
16
|
let t = e.getIsPinned();
|
|
17
17
|
if (t) return {
|
|
18
18
|
position: "sticky",
|
|
@@ -22,26 +22,26 @@ function v(e) {
|
|
|
22
22
|
boxShadow: t === "left" ? "4px 0 4px -4px var(--ui-table-global-row-border-color)" : "-4px 0 4px -4px var(--ui-table-global-row-border-color)"
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function x(e, t) {
|
|
26
26
|
if (e.id === "select") return 48;
|
|
27
27
|
if (t || e.columnDef.size !== void 0) return e.getSize();
|
|
28
28
|
}
|
|
29
|
-
function
|
|
30
|
-
let n =
|
|
29
|
+
function S(e, t) {
|
|
30
|
+
let n = b(e.column), r = x(e.column, t);
|
|
31
31
|
if (!(!n && r === void 0)) return {
|
|
32
32
|
...n,
|
|
33
33
|
width: r
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
|
-
function
|
|
37
|
-
let n =
|
|
36
|
+
function C(e, t) {
|
|
37
|
+
let n = b(e.column), r = x(e.column, t);
|
|
38
38
|
if (!(!n && r === void 0)) return {
|
|
39
39
|
...n,
|
|
40
40
|
width: r
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
|
-
var
|
|
44
|
-
function
|
|
43
|
+
var w = 20, he = 2 ** 53 - 1;
|
|
44
|
+
function ge(e, t, { shiftKey: n, min: r, max: i }) {
|
|
45
45
|
let a = n ? 50 : 10;
|
|
46
46
|
if (e === "ArrowLeft") return Math.min(i, Math.max(r, t - a));
|
|
47
47
|
if (e === "ArrowRight") return Math.max(r, Math.min(i, t + a));
|
|
@@ -66,21 +66,21 @@ var _e = {
|
|
|
66
66
|
action: "Drag border"
|
|
67
67
|
}
|
|
68
68
|
};
|
|
69
|
-
function E({ columns:
|
|
69
|
+
function E({ columns: b = [], data: x = [], table: E, getRowCanExpand: ve, renderExpandedRow: D, striped: O = !1, bordered: ye = !1, highlightCurrentRow: k = !1, skeleton: A = !1, skeletonRows: be = 5, enableColumnResizing: j = !1, onColumnSizingChange: xe, enableColumnReordering: Se = !1, columnOrder: M, onColumnOrderChange: Ce, columnVisibility: we, onColumnVisibilityChange: Te, rowSelection: N, onRowSelectionChange: Ee, manualSorting: P = !1, sorting: F, onSortingChange: De, renderRow: I, renderEmptyState: L, paginationMode: R = "page", onLoadMore: Oe, loadMoreRootMargin: ke, hasNextPage: z = !1, resizeColumnLabel: Ae = "Resize column", emptyLabel: je = "No results.", isLoadingMore: B = !1, hideActionColumn: Me = !1, renderRowActions: V, rowActionsLabel: Ne = "Row actions", columnSettingsLabel: Pe, columnSearchPlaceholder: Fe, showAllColumnsLabel: Ie, noColumnsFoundLabel: Le, headerHints: Re }) {
|
|
70
70
|
let H = {
|
|
71
71
|
..._e,
|
|
72
|
-
...
|
|
73
|
-
}, [
|
|
74
|
-
|
|
75
|
-
}, it = (e) => {
|
|
76
|
-
M === void 0 && Qe(e), Ce?.(e);
|
|
77
|
-
}, at = (e) => {
|
|
78
|
-
He(e), Te?.(e);
|
|
79
|
-
}, ot = (e) => {
|
|
80
|
-
F === void 0 && Le(e), De?.(e);
|
|
72
|
+
...Re
|
|
73
|
+
}, [ze, Be] = _([]), Ve = F ?? ze, [He, Ue] = _([]), [We, Ge] = _({}), Ke = we ?? We, [qe, Je] = _({}), Ye = N ?? qe, [Xe, Ze] = _({}), [Qe, $e] = _({}), [et, tt] = _([]), nt = M ?? et, [U, W] = _(), [rt, it] = _(), [at, G] = _(0), K = pe([]), ot = (e) => {
|
|
74
|
+
$e(e), xe?.(e);
|
|
81
75
|
}, st = (e) => {
|
|
82
|
-
|
|
83
|
-
}, ct =
|
|
76
|
+
M === void 0 && tt(e), Ce?.(e);
|
|
77
|
+
}, ct = (e) => {
|
|
78
|
+
Ge(e), Te?.(e);
|
|
79
|
+
}, lt = (e) => {
|
|
80
|
+
F === void 0 && Be(e), De?.(e);
|
|
81
|
+
}, ut = (e) => {
|
|
82
|
+
N === void 0 && Je(e), Ee?.(e);
|
|
83
|
+
}, q = !Me && !E, dt = g(() => q ? [{
|
|
84
84
|
id: "__actions",
|
|
85
85
|
size: 48,
|
|
86
86
|
enableSorting: !1,
|
|
@@ -88,131 +88,135 @@ function E({ columns: v = [], data: y = [], table: E, getRowCanExpand: ve, rende
|
|
|
88
88
|
meta: { pin: "right" },
|
|
89
89
|
header: () => null,
|
|
90
90
|
cell: () => null
|
|
91
|
-
}] : [], [
|
|
92
|
-
data:
|
|
93
|
-
columns:
|
|
91
|
+
}] : [], [q]), ft = g(() => [...b, ...dt], [b, dt]), [pt, mt] = _(), ht = te({
|
|
92
|
+
data: x,
|
|
93
|
+
columns: ft,
|
|
94
94
|
enableColumnResizing: j,
|
|
95
95
|
columnResizeMode: "onChange",
|
|
96
96
|
getCoreRowModel: s(),
|
|
97
97
|
getExpandedRowModel: c(),
|
|
98
98
|
...R === "page" ? { getPaginationRowModel: u() } : {},
|
|
99
99
|
getRowCanExpand: ve,
|
|
100
|
-
onExpandedChange:
|
|
100
|
+
onExpandedChange: Ze,
|
|
101
101
|
manualSorting: P,
|
|
102
|
-
onSortingChange:
|
|
102
|
+
onSortingChange: lt,
|
|
103
103
|
...P ? {} : { getSortedRowModel: ee() },
|
|
104
|
-
onColumnFiltersChange:
|
|
104
|
+
onColumnFiltersChange: Ue,
|
|
105
105
|
getFilteredRowModel: l(),
|
|
106
|
-
onColumnVisibilityChange:
|
|
107
|
-
onRowSelectionChange:
|
|
108
|
-
onColumnSizingChange:
|
|
109
|
-
onColumnOrderChange:
|
|
106
|
+
onColumnVisibilityChange: ct,
|
|
107
|
+
onRowSelectionChange: ut,
|
|
108
|
+
onColumnSizingChange: ot,
|
|
109
|
+
onColumnOrderChange: st,
|
|
110
|
+
initialState: q ? { columnPinning: { right: ["__actions"] } } : void 0,
|
|
110
111
|
state: {
|
|
111
|
-
sorting:
|
|
112
|
-
columnFilters:
|
|
113
|
-
columnVisibility:
|
|
114
|
-
rowSelection:
|
|
115
|
-
expanded:
|
|
116
|
-
columnSizing:
|
|
117
|
-
columnOrder:
|
|
112
|
+
sorting: Ve,
|
|
113
|
+
columnFilters: He,
|
|
114
|
+
columnVisibility: Ke,
|
|
115
|
+
rowSelection: Ye,
|
|
116
|
+
expanded: Xe,
|
|
117
|
+
columnSizing: Qe,
|
|
118
|
+
columnOrder: nt
|
|
118
119
|
}
|
|
119
|
-
}),
|
|
120
|
-
|
|
121
|
-
if (
|
|
120
|
+
}), J = E ?? ht, Y = !E && R === "infinite", X = j && !E, gt = Se && !E, Z = !!J.getState().columnSizingInfo.isResizingColumn;
|
|
121
|
+
h(() => {
|
|
122
|
+
if (Z) return document.documentElement.setAttribute("data-ui-column-resizing", ""), () => {
|
|
122
123
|
document.documentElement.removeAttribute("data-ui-column-resizing");
|
|
123
124
|
};
|
|
124
|
-
}, [
|
|
125
|
-
let
|
|
125
|
+
}, [Z]);
|
|
126
|
+
let _t = t({
|
|
126
127
|
onIntersect: () => Oe?.(),
|
|
127
|
-
disabled: !
|
|
128
|
+
disabled: !Y || !z || B,
|
|
128
129
|
rootMargin: ke
|
|
129
|
-
}),
|
|
130
|
+
}), vt = (e, t) => {
|
|
130
131
|
if (e.ctrlKey || e.altKey || e.metaKey) return;
|
|
131
|
-
let n =
|
|
132
|
+
let n = ge(e.key, t.column.getSize(), {
|
|
132
133
|
shiftKey: e.shiftKey,
|
|
133
|
-
min: t.column.columnDef.minSize ??
|
|
134
|
-
max: t.column.columnDef.maxSize ??
|
|
134
|
+
min: t.column.columnDef.minSize ?? w,
|
|
135
|
+
max: t.column.columnDef.maxSize ?? he
|
|
135
136
|
});
|
|
136
|
-
n !== void 0 && (e.preventDefault(),
|
|
137
|
+
n !== void 0 && (e.preventDefault(), J.setColumnSizing((e) => ({
|
|
137
138
|
...e,
|
|
138
139
|
[t.column.id]: n
|
|
139
140
|
})));
|
|
140
|
-
},
|
|
141
|
+
}, yt = (e, t) => {
|
|
141
142
|
e.dataTransfer && (e.dataTransfer.effectAllowed = "move", e.dataTransfer.setData("text/plain", t)), W(t);
|
|
142
|
-
},
|
|
143
|
+
}, bt = (e) => {
|
|
143
144
|
e.preventDefault(), e.dataTransfer && (e.dataTransfer.dropEffect = "move");
|
|
144
|
-
},
|
|
145
|
+
}, xt = (e, t) => {
|
|
145
146
|
if (e.preventDefault(), !U) return;
|
|
146
|
-
let n =
|
|
147
|
-
|
|
147
|
+
let n = J.getState().columnOrder, r = n.length ? n : J.getAllLeafColumns().map((e) => e.id);
|
|
148
|
+
J.setColumnOrder(T(r, U, t)), W(void 0);
|
|
148
149
|
};
|
|
149
|
-
|
|
150
|
-
E ||
|
|
150
|
+
h(() => {
|
|
151
|
+
E || J.getAllLeafColumns().forEach((e) => {
|
|
151
152
|
e.pin(e.columnDef.meta?.pin ?? !1);
|
|
152
153
|
});
|
|
153
154
|
}, [
|
|
154
|
-
|
|
155
|
-
|
|
155
|
+
J,
|
|
156
|
+
ft,
|
|
156
157
|
E
|
|
157
158
|
]);
|
|
158
|
-
let
|
|
159
|
+
let Q = J.getRowModel().rows, $ = de(J), St = Q.length ? Math.min(at, Q.length - 1) : 0, Ct = (e) => {
|
|
159
160
|
G(e);
|
|
160
|
-
},
|
|
161
|
+
}, wt = (e, t) => {
|
|
161
162
|
if (e.target !== e.currentTarget || e.key !== "ArrowDown" && e.key !== "ArrowUp") return;
|
|
162
|
-
let n = e.key === "ArrowDown" ? Math.min(t + 1,
|
|
163
|
+
let n = e.key === "ArrowDown" ? Math.min(t + 1, Q.length - 1) : Math.max(t - 1, 0);
|
|
163
164
|
n !== t && (e.preventDefault(), G(n), K.current[n]?.focus());
|
|
164
|
-
},
|
|
165
|
-
return /* @__PURE__ */
|
|
166
|
-
className: e("rounded-md border border-[var(--ui-table-global-row-border-color)]",
|
|
167
|
-
children: /* @__PURE__ */
|
|
168
|
-
style:
|
|
169
|
-
children: [/* @__PURE__ */
|
|
165
|
+
}, Tt = ye ? "[&_th:not(:last-child)]:border-e [&_td:not(:last-child)]:border-e [&_th]:border-[var(--ui-table-global-row-border-color)] [&_td]:border-[var(--ui-table-global-row-border-color)]" : void 0, Et = "bg-background";
|
|
166
|
+
return /* @__PURE__ */ v("div", {
|
|
167
|
+
className: e("rounded-md border border-[var(--ui-table-global-row-border-color)]", Tt),
|
|
168
|
+
children: /* @__PURE__ */ y(ae, {
|
|
169
|
+
style: X ? { width: J.getCenterTotalSize() } : void 0,
|
|
170
|
+
children: [/* @__PURE__ */ v(a, { children: /* @__PURE__ */ v(le, { children: J.getHeaderGroups().map((t) => /* @__PURE__ */ v(p, {
|
|
170
171
|
className: "hover:bg-transparent",
|
|
171
172
|
children: t.headers.map((t) => {
|
|
172
|
-
let n = t.column.getIsPinned(), a =
|
|
173
|
+
let n = t.column.getIsPinned(), a = X && t.column.getCanResize() && t.column.id !== "select", s = gt && !t.isPlaceholder && !n, c = !t.isPlaceholder && t.column.getCanSort(), l = [
|
|
173
174
|
c && H.sort,
|
|
174
175
|
s && H.reorder,
|
|
175
176
|
a && H.resize
|
|
176
177
|
].filter((e) => !!e);
|
|
177
|
-
if (t.column.id === "__actions") return /* @__PURE__ */
|
|
178
|
-
style:
|
|
179
|
-
className:
|
|
180
|
-
children: /* @__PURE__ */
|
|
181
|
-
table:
|
|
178
|
+
if (t.column.id === "__actions") return /* @__PURE__ */ v(ue, {
|
|
179
|
+
style: S(t, X),
|
|
180
|
+
className: Et,
|
|
181
|
+
children: /* @__PURE__ */ v(fe, {
|
|
182
|
+
table: J,
|
|
182
183
|
iconOnly: !0,
|
|
183
|
-
triggerAriaLabel: Pe
|
|
184
|
+
triggerAriaLabel: Pe,
|
|
185
|
+
searchPlaceholder: Fe,
|
|
186
|
+
showAllLabel: Ie,
|
|
187
|
+
noResultsLabel: Le
|
|
184
188
|
})
|
|
185
189
|
}, t.id);
|
|
186
|
-
let u = /* @__PURE__ */
|
|
190
|
+
let u = /* @__PURE__ */ y(ce, {
|
|
187
191
|
wrap: t.column.columnDef.meta?.wrap,
|
|
188
|
-
style:
|
|
189
|
-
draggable: s && !
|
|
190
|
-
onDragStart: s ? (e) =>
|
|
191
|
-
onDragOver: s ?
|
|
192
|
-
onDrop: s ? (e) =>
|
|
192
|
+
style: S(t, X),
|
|
193
|
+
draggable: s && !Z || void 0,
|
|
194
|
+
onDragStart: s ? (e) => yt(e, t.column.id) : void 0,
|
|
195
|
+
onDragOver: s ? bt : void 0,
|
|
196
|
+
onDrop: s ? (e) => xt(e, t.column.id) : void 0,
|
|
193
197
|
onDragEnd: s ? () => W(void 0) : void 0,
|
|
194
|
-
className: e(a && "relative", c && !
|
|
195
|
-
children: [t.isPlaceholder ? null : d(t.column.columnDef.header, t.getContext()), a && /* @__PURE__ */
|
|
198
|
+
className: e(a && "relative", c && !Z && "transition-colors hover:bg-[var(--ui-table-header-cell-color-hover)] active:bg-[var(--ui-table-header-cell-color-active)]", s && !Z && "cursor-grab select-none active:cursor-grabbing", s && U === t.column.id && "opacity-50", n && Et),
|
|
199
|
+
children: [t.isPlaceholder ? null : d(t.column.columnDef.header, t.getContext()), a && /* @__PURE__ */ v("div", {
|
|
196
200
|
role: "separator",
|
|
197
201
|
"aria-orientation": "vertical",
|
|
198
202
|
"aria-label": Ae,
|
|
199
203
|
"aria-valuenow": t.column.getSize(),
|
|
200
|
-
"aria-valuemin": t.column.columnDef.minSize ??
|
|
201
|
-
"aria-valuemax": t.column.columnDef.maxSize ??
|
|
204
|
+
"aria-valuemin": t.column.columnDef.minSize ?? w,
|
|
205
|
+
"aria-valuemax": t.column.columnDef.maxSize ?? he,
|
|
202
206
|
tabIndex: 0,
|
|
203
207
|
draggable: !1,
|
|
204
208
|
onMouseDown: t.getResizeHandler(),
|
|
205
209
|
onTouchStart: t.getResizeHandler(),
|
|
206
|
-
onKeyDown: (e) =>
|
|
207
|
-
className: e("absolute end-0 top-0 h-full w-1 cursor-(--ui-resizable-cursor) touch-none select-none bg-[var(--ui-table-global-row-border-color)] opacity-0 transition-[opacity,background-color] hover:bg-[var(--ui-resizable-border-color-hover)] hover:opacity-100 focus-visible:bg-[var(--ui-resizable-border-color-hover)] focus-visible:opacity-100 focus-visible:outline-[3px] focus-visible:
|
|
210
|
+
onKeyDown: (e) => vt(e, t),
|
|
211
|
+
className: e("absolute end-0 top-0 h-full w-1 cursor-(--ui-resizable-cursor) touch-none select-none bg-[var(--ui-table-global-row-border-color)] opacity-0 transition-[opacity,background-color] hover:bg-[var(--ui-resizable-border-color-hover)] hover:opacity-100 focus-visible:bg-[var(--ui-resizable-border-color-hover)] focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-inset focus-visible:ring-[var(--ui-focus-primary)]", t.column.getIsResizing() && "bg-[var(--ui-resizable-border-color-active)] opacity-100")
|
|
208
212
|
})]
|
|
209
213
|
});
|
|
210
|
-
return l.length === 0 ? /* @__PURE__ */
|
|
211
|
-
disabled:
|
|
212
|
-
children: [/* @__PURE__ */
|
|
214
|
+
return l.length === 0 ? /* @__PURE__ */ v(m, { children: u }, t.id) : /* @__PURE__ */ y(r, {
|
|
215
|
+
disabled: Z || U !== void 0,
|
|
216
|
+
children: [/* @__PURE__ */ v(o, { render: u }), /* @__PURE__ */ v(i, {
|
|
213
217
|
className: "flex flex-col gap-1",
|
|
214
|
-
children: l.map((e) => /* @__PURE__ */
|
|
215
|
-
/* @__PURE__ */
|
|
218
|
+
children: l.map((e) => /* @__PURE__ */ y("span", { children: [
|
|
219
|
+
/* @__PURE__ */ y("span", {
|
|
216
220
|
className: "font-semibold",
|
|
217
221
|
children: [e.label, ":"]
|
|
218
222
|
}),
|
|
@@ -222,80 +226,80 @@ function E({ columns: v = [], data: y = [], table: E, getRowCanExpand: ve, rende
|
|
|
222
226
|
})]
|
|
223
227
|
}, t.id);
|
|
224
228
|
})
|
|
225
|
-
}, t.id)) }) }), /* @__PURE__ */
|
|
226
|
-
A ? Array.from({ length: be }).map((e, t) => /* @__PURE__ */
|
|
229
|
+
}, t.id)) }) }), /* @__PURE__ */ y(se, { children: [
|
|
230
|
+
A ? Array.from({ length: be }).map((e, t) => /* @__PURE__ */ v(p, {
|
|
227
231
|
className: "hover:bg-transparent",
|
|
228
|
-
children:
|
|
229
|
-
}, `skeleton-${t}`)) :
|
|
230
|
-
if (I) return /* @__PURE__ */
|
|
231
|
-
let i = t.getIsSelected(), a = k &&
|
|
232
|
-
return /* @__PURE__ */
|
|
232
|
+
children: J.getVisibleLeafColumns().map((e) => /* @__PURE__ */ v(f, { children: /* @__PURE__ */ v("div", { className: "h-4 w-full animate-pulse rounded bg-[var(--ui-background-surface-secondary)]" }) }, e.id))
|
|
233
|
+
}, `skeleton-${t}`)) : Q?.length ? Q.map((t, r) => {
|
|
234
|
+
if (I) return /* @__PURE__ */ v(m, { children: I(t, r) }, t.id);
|
|
235
|
+
let i = t.getIsSelected(), a = k && rt === t.id, o = i || a ? "bg-[var(--ui-table-data-row-color-active)]" : O && r % 2 == 1 ? "bg-[var(--ui-background-surface-secondary)]" : "bg-background group-hover:bg-[var(--ui-table-data-row-color-hover)]", s = !$ && pt === t.id;
|
|
236
|
+
return /* @__PURE__ */ y(m, { children: [/* @__PURE__ */ v(p, {
|
|
233
237
|
ref: (e) => {
|
|
234
238
|
K.current[r] = e;
|
|
235
239
|
},
|
|
236
|
-
tabIndex: r ===
|
|
237
|
-
onFocus: () =>
|
|
238
|
-
onKeyDown: (e) =>
|
|
240
|
+
tabIndex: r === St ? 0 : -1,
|
|
241
|
+
onFocus: () => Ct(r),
|
|
242
|
+
onKeyDown: (e) => wt(e, r),
|
|
239
243
|
selected: i,
|
|
240
|
-
onClick: k ? () =>
|
|
244
|
+
onClick: k ? () => it(t.id) : void 0,
|
|
241
245
|
className: e("group", k && "cursor-pointer", O && r % 2 == 1 && !i && !a && "bg-[var(--ui-background-surface-secondary)]", a && !i && "bg-[var(--ui-table-data-row-color-active)]", s && "hover:bg-transparent"),
|
|
242
246
|
children: t.getVisibleCells().map((r) => {
|
|
243
247
|
let i = r.column.getIsPinned();
|
|
244
|
-
return r.column.id === "__actions" ? /* @__PURE__ */
|
|
245
|
-
style:
|
|
248
|
+
return r.column.id === "__actions" ? /* @__PURE__ */ v(oe, {
|
|
249
|
+
style: C(r, X),
|
|
246
250
|
className: o,
|
|
247
|
-
bulkSelectionActive:
|
|
248
|
-
onMouseEnter:
|
|
249
|
-
onMouseLeave:
|
|
250
|
-
children: V && /* @__PURE__ */
|
|
251
|
-
render: /* @__PURE__ */
|
|
252
|
-
children: /* @__PURE__ */
|
|
253
|
-
}), /* @__PURE__ */
|
|
251
|
+
bulkSelectionActive: $,
|
|
252
|
+
onMouseEnter: $ ? void 0 : () => mt(t.id),
|
|
253
|
+
onMouseLeave: $ ? void 0 : () => mt((e) => e === t.id ? void 0 : e),
|
|
254
|
+
children: V && /* @__PURE__ */ y(ne, { children: [/* @__PURE__ */ v(ie, {
|
|
255
|
+
render: /* @__PURE__ */ v(n, { "aria-label": Ne }),
|
|
256
|
+
children: /* @__PURE__ */ v(me, {})
|
|
257
|
+
}), /* @__PURE__ */ v(re, {
|
|
254
258
|
align: "end",
|
|
255
259
|
children: V(t)
|
|
256
260
|
})] })
|
|
257
|
-
}, r.id) : /* @__PURE__ */
|
|
261
|
+
}, r.id) : /* @__PURE__ */ v(f, {
|
|
258
262
|
wrap: r.column.columnDef.meta?.wrap,
|
|
259
|
-
style:
|
|
263
|
+
style: C(r, X),
|
|
260
264
|
className: e(i && o),
|
|
261
265
|
children: d(r.column.columnDef.cell, r.getContext())
|
|
262
266
|
}, r.id);
|
|
263
267
|
})
|
|
264
|
-
}), D && t.getIsExpanded() && /* @__PURE__ */
|
|
268
|
+
}), D && t.getIsExpanded() && /* @__PURE__ */ v(p, {
|
|
265
269
|
className: "hover:bg-transparent",
|
|
266
|
-
children: /* @__PURE__ */
|
|
270
|
+
children: /* @__PURE__ */ v(f, {
|
|
267
271
|
className: "h-auto py-3",
|
|
268
272
|
colSpan: t.getVisibleCells().length,
|
|
269
273
|
children: D(t)
|
|
270
274
|
})
|
|
271
275
|
})] }, t.id);
|
|
272
|
-
}) : L ? /* @__PURE__ */
|
|
273
|
-
colSpan:
|
|
276
|
+
}) : L ? /* @__PURE__ */ v(p, { children: /* @__PURE__ */ v(f, {
|
|
277
|
+
colSpan: J.getVisibleLeafColumns().length,
|
|
274
278
|
className: "h-24 text-center",
|
|
275
|
-
children: L({ hasFilters:
|
|
276
|
-
}) }) : /* @__PURE__ */
|
|
277
|
-
colSpan:
|
|
279
|
+
children: L({ hasFilters: J.getState().columnFilters.length > 0 })
|
|
280
|
+
}) }) : /* @__PURE__ */ v(p, { children: /* @__PURE__ */ v(f, {
|
|
281
|
+
colSpan: J.getVisibleLeafColumns().length,
|
|
278
282
|
className: "h-24 text-center text-[var(--ui-table-data-value-color-disabled)]",
|
|
279
283
|
children: je
|
|
280
284
|
}) }),
|
|
281
|
-
|
|
282
|
-
ref:
|
|
285
|
+
Y && !A && Q.length > 0 && z && /* @__PURE__ */ v(p, {
|
|
286
|
+
ref: _t,
|
|
283
287
|
"aria-hidden": !0,
|
|
284
288
|
className: "hover:bg-transparent",
|
|
285
|
-
children: /* @__PURE__ */
|
|
286
|
-
colSpan:
|
|
289
|
+
children: /* @__PURE__ */ v(f, {
|
|
290
|
+
colSpan: J.getVisibleLeafColumns().length,
|
|
287
291
|
className: "h-1 p-0"
|
|
288
292
|
})
|
|
289
293
|
}),
|
|
290
|
-
|
|
294
|
+
Y && !A && Q.length > 0 && B && /* @__PURE__ */ v(p, {
|
|
291
295
|
className: "hover:bg-transparent",
|
|
292
|
-
children: /* @__PURE__ */
|
|
293
|
-
colSpan:
|
|
294
|
-
children: /* @__PURE__ */
|
|
296
|
+
children: /* @__PURE__ */ v(f, {
|
|
297
|
+
colSpan: J.getVisibleLeafColumns().length,
|
|
298
|
+
children: /* @__PURE__ */ v("div", {
|
|
295
299
|
role: "status",
|
|
296
300
|
"aria-live": "polite",
|
|
297
301
|
className: "h-4 w-full animate-pulse rounded bg-[var(--ui-background-surface-secondary)]",
|
|
298
|
-
children: /* @__PURE__ */
|
|
302
|
+
children: /* @__PURE__ */ v("span", {
|
|
299
303
|
className: "sr-only",
|
|
300
304
|
children: "Loading more rows…"
|
|
301
305
|
})
|
|
@@ -307,6 +311,6 @@ function E({ columns: v = [], data: y = [], table: E, getRowCanExpand: ve, rende
|
|
|
307
311
|
});
|
|
308
312
|
}
|
|
309
313
|
//#endregion
|
|
310
|
-
export { E as DataTable,
|
|
314
|
+
export { E as DataTable, C as getCellStyle, x as getColumnWidth, b as getPinnedStyle, ge as getResizeKeyboardStep, T as reorderColumn };
|
|
311
315
|
|
|
312
316
|
//# sourceMappingURL=data-table.js.map
|