@acronis-platform/ui-react 5.3.1 → 5.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/dist/components/ui/data-table/data-table-view-options.js +1 -1
- package/dist/components/ui/data-table/data-table-view-options.js.map +1 -1
- package/dist/components/ui/data-table/data-table.js +179 -168
- package/dist/components/ui/data-table/data-table.js.map +1 -1
- package/dist/components/ui/segment-control/segment-control.js +99 -0
- package/dist/components/ui/segment-control/segment-control.js.map +1 -0
- package/dist/index.js +33 -32
- package/dist/llms/data-table.md +33 -1
- package/dist/llms/segment-control.md +161 -0
- package/dist/llms.txt +5 -1
- package/dist/react.js +33 -32
- package/dist/src/components/ui/data-table/data-table.d.ts +9 -3
- package/dist/src/components/ui/data-table/data-table.docs.d.ts +13 -6
- package/dist/src/components/ui/segment-control/index.d.ts +1 -0
- package/dist/src/components/ui/segment-control/segment-control.d.ts +32 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/ui-react.css +1 -1
- package/package.json +3 -3
|
@@ -2,7 +2,7 @@ import { TableViewOptions as e } from "../table/table-view-options.js";
|
|
|
2
2
|
import { jsx as t } from "react/jsx-runtime";
|
|
3
3
|
//#region src/components/ui/data-table/data-table-view-options.tsx
|
|
4
4
|
function n({ table: n, ...r }) {
|
|
5
|
-
let i = n.
|
|
5
|
+
let i = n.getAllLeafColumns().filter((e) => e.accessorFn !== void 0 && e.getCanHide()).map((e) => ({
|
|
6
6
|
id: e.id,
|
|
7
7
|
label: e.columnDef.meta?.label ?? (typeof e.columnDef.header == "string" ? e.columnDef.header : e.id),
|
|
8
8
|
hidden: !e.getIsVisible(),
|
|
@@ -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> 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.
|
|
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.getAllLeafColumns()` onto the plain `{ id, label, hidden }[]` shape and\n// routes `onToggle` back through `column.toggleVisibility()`.\n// Leaf (not `getAllColumns()`) because with grouped headers the top level is\n// group columns, which have no `accessorFn` and would all be filtered out.\nexport function DataTableViewOptions<TData>({\n table,\n ...triggerProps\n}: DataTableViewOptionsProps<TData>) {\n const columns = table\n .getAllLeafColumns()\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":";;;AAqBA,SAAgB,EAA4B,EAC1C,UACA,GAAG,KACgC;CACnC,IAAM,IAAU,EACb,kBAAkB,CAAC,CACnB,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"}
|
|
@@ -2,17 +2,17 @@ import { cn as e } from "../../../lib/utils.js";
|
|
|
2
2
|
import { useIntersectionObserver as t } from "../../../hooks/use-intersection-observer.js";
|
|
3
3
|
import { ButtonIcon as n } from "../button-icon/button-icon.js";
|
|
4
4
|
import { Tooltip as r, TooltipContent as i, TooltipProvider as a, TooltipTrigger as o } from "../tooltip/tooltip.js";
|
|
5
|
-
import { getCoreRowModel as s, getExpandedRowModel as c, getFilteredRowModel as l, getPaginationRowModel as u, getSortedRowModel as
|
|
6
|
-
import { flexRender as
|
|
7
|
-
import { DropdownMenu as
|
|
8
|
-
import { Table as
|
|
9
|
-
import { isBulkSelectionActive as
|
|
10
|
-
import { DataTableViewOptions as
|
|
11
|
-
import { Fragment as
|
|
12
|
-
import { jsx as
|
|
13
|
-
import { EllipsisIcon as
|
|
5
|
+
import { getCoreRowModel as s, getExpandedRowModel as c, getFilteredRowModel as l, getPaginationRowModel as u, getSortedRowModel as d } from "../../../node_modules/.pnpm/@tanstack_table-core@8.21.3/node_modules/@tanstack/table-core/build/lib/index.js";
|
|
6
|
+
import { flexRender as f, useReactTable as p } from "../../../node_modules/.pnpm/@tanstack_react-table@8.21.3_react-dom@19.2.6_react@19.2.6__react@19.2.6/node_modules/@tanstack/react-table/build/lib/index.js";
|
|
7
|
+
import { DropdownMenu as m, DropdownMenuContent as ee, DropdownMenuTrigger as te } from "../dropdown-menu/dropdown-menu.js";
|
|
8
|
+
import { Table as ne, TableActionsCell as re, TableBody as ie, TableCell as h, TableHead as ae, TableHeader as oe, TableRow as g, TableSettingsCell as se } from "../table/table.js";
|
|
9
|
+
import { isBulkSelectionActive as ce } from "./data-table-selection.js";
|
|
10
|
+
import { DataTableViewOptions as le } from "./data-table-view-options.js";
|
|
11
|
+
import { Fragment as _, useEffect as ue, useMemo as de, useRef as fe, useState as v } from "react";
|
|
12
|
+
import { jsx as y, jsxs as b } from "react/jsx-runtime";
|
|
13
|
+
import { EllipsisIcon as pe } from "@acronis-platform/icons-react/stroke-mono";
|
|
14
14
|
//#region src/components/ui/data-table/data-table.tsx
|
|
15
|
-
function
|
|
15
|
+
function x(e) {
|
|
16
16
|
let t = e.getIsPinned();
|
|
17
17
|
if (t) return {
|
|
18
18
|
position: "sticky",
|
|
@@ -22,37 +22,37 @@ function b(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 S(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 C(e, t) {
|
|
30
|
+
let n = x(e.column), r = e.subHeaders.length === 0 ? S(e.column, t) : void 0;
|
|
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 w(e, t) {
|
|
37
|
+
let n = x(e.column), r = S(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 T = 20, E = 2 ** 53 - 1;
|
|
44
|
+
function D(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));
|
|
48
48
|
}
|
|
49
|
-
function
|
|
49
|
+
function O(e, t, n) {
|
|
50
50
|
let r = e.indexOf(t), i = e.indexOf(n);
|
|
51
51
|
if (r === -1 || i === -1 || r === i) return e;
|
|
52
52
|
let a = [...e];
|
|
53
53
|
return a.splice(i, 0, a.splice(r, 1)[0]), a;
|
|
54
54
|
}
|
|
55
|
-
var
|
|
55
|
+
var me = {
|
|
56
56
|
sort: {
|
|
57
57
|
label: "Sort column",
|
|
58
58
|
action: "Click"
|
|
@@ -66,21 +66,21 @@ var _e = {
|
|
|
66
66
|
action: "Drag border"
|
|
67
67
|
}
|
|
68
68
|
};
|
|
69
|
-
function
|
|
70
|
-
let
|
|
71
|
-
...
|
|
72
|
-
...
|
|
73
|
-
}, [
|
|
74
|
-
|
|
75
|
-
}, st = (e) => {
|
|
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);
|
|
69
|
+
function k({ columns: x = [], data: S = [], table: k, getRowId: he, getRowCanExpand: ge, renderExpandedRow: _e, striped: ve = !1, bordered: ye = !1, highlightCurrentRow: A = !1, skeleton: j = !1, skeletonRows: be = 5, enableColumnResizing: xe = !1, onColumnSizingChange: Se, enableColumnReordering: Ce = !1, columnOrder: we, onColumnOrderChange: Te, columnVisibility: Ee, onColumnVisibilityChange: De, rowSelection: Oe, onRowSelectionChange: ke, manualSorting: M = !1, sorting: N, onSortingChange: Ae, renderRow: P, renderEmptyState: F, paginationMode: I = "page", onLoadMore: je, loadMoreRootMargin: Me, hasNextPage: L = !1, resizeColumnLabel: Ne = "Resize column", emptyLabel: Pe = "No results.", isLoadingMore: R = !1, hideActionColumn: Fe = !1, renderRowActions: z, rowActionsLabel: Ie = "Row actions", columnSettingsLabel: Le, columnSearchPlaceholder: Re, showAllColumnsLabel: ze, noColumnsFoundLabel: Be, headerHints: Ve }) {
|
|
70
|
+
let B = {
|
|
71
|
+
...me,
|
|
72
|
+
...Ve
|
|
73
|
+
}, [He, Ue] = v([]), We = N ?? He, [Ge, Ke] = v([]), [qe, Je] = v({}), Ye = Ee ?? qe, [Xe, Ze] = v({}), Qe = Oe ?? Xe, [$e, et] = v({}), [tt, nt] = v({}), [rt, it] = v([]), at = we ?? rt, [V, H] = v(), [ot, st] = v(), [ct, U] = v(0), W = fe([]), lt = (e) => {
|
|
74
|
+
nt(e), Se?.(e);
|
|
81
75
|
}, ut = (e) => {
|
|
82
|
-
|
|
83
|
-
},
|
|
76
|
+
we === void 0 && it(e), Te?.(e);
|
|
77
|
+
}, dt = (e) => {
|
|
78
|
+
Je(e), De?.(e);
|
|
79
|
+
}, ft = (e) => {
|
|
80
|
+
N === void 0 && Ue(e), Ae?.(e);
|
|
81
|
+
}, pt = (e) => {
|
|
82
|
+
Oe === void 0 && Ze(e), ke?.(e);
|
|
83
|
+
}, G = !Fe && !k, K = de(() => G ? [{
|
|
84
84
|
id: "__actions",
|
|
85
85
|
size: 48,
|
|
86
86
|
enableSorting: !1,
|
|
@@ -88,135 +88,146 @@ function E({ columns: b = [], data: x = [], table: E, getRowCanExpand: ve, rende
|
|
|
88
88
|
meta: { pin: "right" },
|
|
89
89
|
header: () => null,
|
|
90
90
|
cell: () => null
|
|
91
|
-
}] : [], [
|
|
92
|
-
data:
|
|
93
|
-
columns:
|
|
94
|
-
|
|
91
|
+
}] : [], [G]), mt = de(() => [...x, ...K], [x, K]), [ht, gt] = v(), _t = p({
|
|
92
|
+
data: S,
|
|
93
|
+
columns: mt,
|
|
94
|
+
getRowId: he,
|
|
95
|
+
enableColumnResizing: xe,
|
|
95
96
|
columnResizeMode: "onChange",
|
|
96
97
|
getCoreRowModel: s(),
|
|
97
98
|
getExpandedRowModel: c(),
|
|
98
|
-
...
|
|
99
|
-
getRowCanExpand:
|
|
100
|
-
onExpandedChange:
|
|
101
|
-
manualSorting:
|
|
102
|
-
onSortingChange:
|
|
103
|
-
...
|
|
104
|
-
onColumnFiltersChange:
|
|
99
|
+
...I === "page" ? { getPaginationRowModel: u() } : {},
|
|
100
|
+
getRowCanExpand: ge,
|
|
101
|
+
onExpandedChange: et,
|
|
102
|
+
manualSorting: M,
|
|
103
|
+
onSortingChange: ft,
|
|
104
|
+
...M ? {} : { getSortedRowModel: d() },
|
|
105
|
+
onColumnFiltersChange: Ke,
|
|
105
106
|
getFilteredRowModel: l(),
|
|
106
|
-
onColumnVisibilityChange:
|
|
107
|
-
onRowSelectionChange:
|
|
108
|
-
onColumnSizingChange:
|
|
109
|
-
onColumnOrderChange:
|
|
110
|
-
initialState:
|
|
107
|
+
onColumnVisibilityChange: dt,
|
|
108
|
+
onRowSelectionChange: pt,
|
|
109
|
+
onColumnSizingChange: lt,
|
|
110
|
+
onColumnOrderChange: ut,
|
|
111
|
+
initialState: G ? { columnPinning: { right: ["__actions"] } } : void 0,
|
|
111
112
|
state: {
|
|
112
|
-
sorting:
|
|
113
|
-
columnFilters:
|
|
114
|
-
columnVisibility:
|
|
115
|
-
rowSelection:
|
|
116
|
-
expanded:
|
|
117
|
-
columnSizing:
|
|
118
|
-
columnOrder:
|
|
113
|
+
sorting: We,
|
|
114
|
+
columnFilters: Ge,
|
|
115
|
+
columnVisibility: Ye,
|
|
116
|
+
rowSelection: Qe,
|
|
117
|
+
expanded: $e,
|
|
118
|
+
columnSizing: tt,
|
|
119
|
+
columnOrder: at
|
|
119
120
|
}
|
|
120
|
-
}),
|
|
121
|
-
|
|
122
|
-
if (
|
|
121
|
+
}), q = k ?? _t, J = !k && I === "infinite", Y = xe && !k, vt = Ce && !k, X = !!q.getState().columnSizingInfo.isResizingColumn;
|
|
122
|
+
ue(() => {
|
|
123
|
+
if (X) return document.documentElement.setAttribute("data-ui-column-resizing", ""), () => {
|
|
123
124
|
document.documentElement.removeAttribute("data-ui-column-resizing");
|
|
124
125
|
};
|
|
125
|
-
}, [
|
|
126
|
-
let
|
|
127
|
-
onIntersect: () =>
|
|
128
|
-
disabled: !
|
|
129
|
-
rootMargin:
|
|
130
|
-
}),
|
|
126
|
+
}, [X]);
|
|
127
|
+
let yt = t({
|
|
128
|
+
onIntersect: () => je?.(),
|
|
129
|
+
disabled: !J || !L || R,
|
|
130
|
+
rootMargin: Me
|
|
131
|
+
}), bt = (e, t) => {
|
|
131
132
|
if (e.ctrlKey || e.altKey || e.metaKey) return;
|
|
132
|
-
let n =
|
|
133
|
+
let n = D(e.key, t.column.getSize(), {
|
|
133
134
|
shiftKey: e.shiftKey,
|
|
134
|
-
min: t.column.columnDef.minSize ??
|
|
135
|
-
max: t.column.columnDef.maxSize ??
|
|
135
|
+
min: t.column.columnDef.minSize ?? T,
|
|
136
|
+
max: t.column.columnDef.maxSize ?? E
|
|
136
137
|
});
|
|
137
|
-
n !== void 0 && (e.preventDefault(),
|
|
138
|
+
n !== void 0 && (e.preventDefault(), q.setColumnSizing((e) => ({
|
|
138
139
|
...e,
|
|
139
140
|
[t.column.id]: n
|
|
140
141
|
})));
|
|
141
|
-
}, yt = (e, t) => {
|
|
142
|
-
e.dataTransfer && (e.dataTransfer.effectAllowed = "move", e.dataTransfer.setData("text/plain", t)), W(t);
|
|
143
|
-
}, bt = (e) => {
|
|
144
|
-
e.preventDefault(), e.dataTransfer && (e.dataTransfer.dropEffect = "move");
|
|
145
142
|
}, xt = (e, t) => {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
143
|
+
e.dataTransfer && (e.dataTransfer.effectAllowed = "move", e.dataTransfer.setData("text/plain", t)), H(t);
|
|
144
|
+
}, St = (e, t) => {
|
|
145
|
+
if (e.preventDefault(), !e.dataTransfer) return;
|
|
146
|
+
let n = V ? q.getColumn(V)?.parent?.id : void 0, r = q.getColumn(t)?.parent?.id;
|
|
147
|
+
e.dataTransfer.dropEffect = n === r ? "move" : "none";
|
|
148
|
+
}, Ct = (e, t) => {
|
|
149
|
+
if (e.preventDefault(), !V) return;
|
|
150
|
+
if (q.getColumn(V)?.parent?.id !== q.getColumn(t)?.parent?.id) {
|
|
151
|
+
H(void 0);
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
let n = q.getState().columnOrder, r = n.length ? n : q.getAllLeafColumns().map((e) => e.id);
|
|
155
|
+
q.setColumnOrder(O(r, V, t)), H(void 0);
|
|
149
156
|
};
|
|
150
|
-
|
|
151
|
-
|
|
157
|
+
ue(() => {
|
|
158
|
+
k || q.getAllLeafColumns().forEach((e) => {
|
|
152
159
|
e.pin(e.columnDef.meta?.pin ?? !1);
|
|
153
160
|
});
|
|
154
161
|
}, [
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
162
|
+
q,
|
|
163
|
+
mt,
|
|
164
|
+
k
|
|
158
165
|
]);
|
|
159
|
-
let
|
|
160
|
-
|
|
161
|
-
},
|
|
166
|
+
let Z = q.getRowModel().rows, Q = ce(q), wt = Z.length ? Math.min(ct, Z.length - 1) : 0, Tt = (e) => {
|
|
167
|
+
U(e);
|
|
168
|
+
}, Et = (e, t) => {
|
|
162
169
|
if (e.target !== e.currentTarget || e.key !== "ArrowDown" && e.key !== "ArrowUp") return;
|
|
163
|
-
let n = e.key === "ArrowDown" ? Math.min(t + 1,
|
|
164
|
-
n !== t && (e.preventDefault(),
|
|
165
|
-
},
|
|
166
|
-
return /* @__PURE__ */
|
|
167
|
-
className: e("rounded-md border border-[var(--ui-table-global-row-border-color)]",
|
|
168
|
-
children: /* @__PURE__ */
|
|
169
|
-
style:
|
|
170
|
-
children: [/* @__PURE__ */
|
|
170
|
+
let n = e.key === "ArrowDown" ? Math.min(t + 1, Z.length - 1) : Math.max(t - 1, 0);
|
|
171
|
+
n !== t && (e.preventDefault(), U(n), W.current[n]?.focus());
|
|
172
|
+
}, Dt = 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, $ = "bg-background";
|
|
173
|
+
return /* @__PURE__ */ y("div", {
|
|
174
|
+
className: e("rounded-md border border-[var(--ui-table-global-row-border-color)]", Dt),
|
|
175
|
+
children: /* @__PURE__ */ b(ne, {
|
|
176
|
+
style: Y ? { width: q.getCenterTotalSize() } : void 0,
|
|
177
|
+
children: [/* @__PURE__ */ y(a, { children: /* @__PURE__ */ y(oe, { children: q.getHeaderGroups().map((t, n, a) => /* @__PURE__ */ y(g, {
|
|
171
178
|
className: "hover:bg-transparent",
|
|
172
179
|
children: t.headers.map((t) => {
|
|
173
|
-
let
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
180
|
+
let s = t.column.getIsPinned(), c = t.subHeaders.length > 0, l = !c && Y && t.column.getCanResize() && t.column.id !== "select", u = !c && vt && !t.isPlaceholder && !s, d = !c && !t.isPlaceholder && t.column.getCanSort(), p = [
|
|
181
|
+
d && B.sort,
|
|
182
|
+
u && B.reorder,
|
|
183
|
+
l && B.resize
|
|
177
184
|
].filter((e) => !!e);
|
|
178
|
-
if (t.column.id === "__actions") return /* @__PURE__ */
|
|
179
|
-
style:
|
|
180
|
-
className:
|
|
181
|
-
|
|
182
|
-
|
|
185
|
+
if (t.column.id === "__actions") return n < a.length - 1 ? /* @__PURE__ */ y(se, {
|
|
186
|
+
style: C(t, Y),
|
|
187
|
+
className: $
|
|
188
|
+
}, t.id) : /* @__PURE__ */ y(se, {
|
|
189
|
+
style: C(t, Y),
|
|
190
|
+
className: $,
|
|
191
|
+
children: /* @__PURE__ */ y(le, {
|
|
192
|
+
table: q,
|
|
183
193
|
iconOnly: !0,
|
|
184
|
-
triggerAriaLabel:
|
|
185
|
-
searchPlaceholder:
|
|
186
|
-
showAllLabel:
|
|
187
|
-
noResultsLabel:
|
|
194
|
+
triggerAriaLabel: Le,
|
|
195
|
+
searchPlaceholder: Re,
|
|
196
|
+
showAllLabel: ze,
|
|
197
|
+
noResultsLabel: Be
|
|
188
198
|
})
|
|
189
199
|
}, t.id);
|
|
190
|
-
let
|
|
200
|
+
let m = /* @__PURE__ */ b(ae, {
|
|
201
|
+
colSpan: t.colSpan,
|
|
191
202
|
wrap: t.column.columnDef.meta?.wrap,
|
|
192
|
-
style:
|
|
193
|
-
draggable:
|
|
194
|
-
onDragStart:
|
|
195
|
-
onDragOver:
|
|
196
|
-
onDrop:
|
|
197
|
-
onDragEnd:
|
|
198
|
-
className: e(
|
|
199
|
-
children: [t.isPlaceholder ? null :
|
|
203
|
+
style: C(t, Y),
|
|
204
|
+
draggable: u && !X || void 0,
|
|
205
|
+
onDragStart: u ? (e) => xt(e, t.column.id) : void 0,
|
|
206
|
+
onDragOver: u ? (e) => St(e, t.column.id) : void 0,
|
|
207
|
+
onDrop: u ? (e) => Ct(e, t.column.id) : void 0,
|
|
208
|
+
onDragEnd: u ? () => H(void 0) : void 0,
|
|
209
|
+
className: e(l && "relative", d && !X && "transition-colors hover:bg-[var(--ui-table-header-cell-color-hover)] active:bg-[var(--ui-table-header-cell-color-active)]", u && !X && "cursor-grab select-none active:cursor-grabbing", u && V === t.column.id && "opacity-50", s && $),
|
|
210
|
+
children: [t.isPlaceholder ? null : f(t.column.columnDef.header, t.getContext()), l && /* @__PURE__ */ y("div", {
|
|
200
211
|
role: "separator",
|
|
201
212
|
"aria-orientation": "vertical",
|
|
202
|
-
"aria-label":
|
|
213
|
+
"aria-label": Ne,
|
|
203
214
|
"aria-valuenow": t.column.getSize(),
|
|
204
|
-
"aria-valuemin": t.column.columnDef.minSize ??
|
|
205
|
-
"aria-valuemax": t.column.columnDef.maxSize ??
|
|
215
|
+
"aria-valuemin": t.column.columnDef.minSize ?? T,
|
|
216
|
+
"aria-valuemax": t.column.columnDef.maxSize ?? E,
|
|
206
217
|
tabIndex: 0,
|
|
207
218
|
draggable: !1,
|
|
208
219
|
onMouseDown: t.getResizeHandler(),
|
|
209
220
|
onTouchStart: t.getResizeHandler(),
|
|
210
|
-
onKeyDown: (e) =>
|
|
221
|
+
onKeyDown: (e) => bt(e, t),
|
|
211
222
|
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")
|
|
212
223
|
})]
|
|
213
224
|
});
|
|
214
|
-
return
|
|
215
|
-
disabled:
|
|
216
|
-
children: [/* @__PURE__ */
|
|
225
|
+
return p.length === 0 ? /* @__PURE__ */ y(_, { children: m }, t.id) : /* @__PURE__ */ b(r, {
|
|
226
|
+
disabled: X || V !== void 0,
|
|
227
|
+
children: [/* @__PURE__ */ y(o, { render: m }), /* @__PURE__ */ y(i, {
|
|
217
228
|
className: "flex flex-col gap-1",
|
|
218
|
-
children:
|
|
219
|
-
/* @__PURE__ */
|
|
229
|
+
children: p.map((e) => /* @__PURE__ */ b("span", { children: [
|
|
230
|
+
/* @__PURE__ */ b("span", {
|
|
220
231
|
className: "font-semibold",
|
|
221
232
|
children: [e.label, ":"]
|
|
222
233
|
}),
|
|
@@ -226,80 +237,80 @@ function E({ columns: b = [], data: x = [], table: E, getRowCanExpand: ve, rende
|
|
|
226
237
|
})]
|
|
227
238
|
}, t.id);
|
|
228
239
|
})
|
|
229
|
-
}, t.id)) }) }), /* @__PURE__ */
|
|
230
|
-
|
|
240
|
+
}, t.id)) }) }), /* @__PURE__ */ b(ie, { children: [
|
|
241
|
+
j ? Array.from({ length: be }).map((e, t) => /* @__PURE__ */ y(g, {
|
|
231
242
|
className: "hover:bg-transparent",
|
|
232
|
-
children:
|
|
233
|
-
}, `skeleton-${t}`)) :
|
|
234
|
-
if (
|
|
235
|
-
let i = t.getIsSelected(), a =
|
|
236
|
-
return /* @__PURE__ */
|
|
243
|
+
children: q.getVisibleLeafColumns().map((e) => /* @__PURE__ */ y(h, { children: /* @__PURE__ */ y("div", { className: "h-4 w-full animate-pulse rounded bg-[var(--ui-background-surface-secondary)]" }) }, e.id))
|
|
244
|
+
}, `skeleton-${t}`)) : Z?.length ? Z.map((t, r) => {
|
|
245
|
+
if (P) return /* @__PURE__ */ y(_, { children: P(t, r) }, t.id);
|
|
246
|
+
let i = t.getIsSelected(), a = A && ot === t.id, o = i || a ? "bg-[var(--ui-table-data-row-color-active)]" : ve && r % 2 == 1 ? "bg-[var(--ui-background-surface-secondary)]" : "bg-background group-hover:bg-[var(--ui-table-data-row-color-hover)]", s = !Q && ht === t.id;
|
|
247
|
+
return /* @__PURE__ */ b(_, { children: [/* @__PURE__ */ y(g, {
|
|
237
248
|
ref: (e) => {
|
|
238
|
-
|
|
249
|
+
W.current[r] = e;
|
|
239
250
|
},
|
|
240
|
-
tabIndex: r ===
|
|
241
|
-
onFocus: () =>
|
|
242
|
-
onKeyDown: (e) =>
|
|
251
|
+
tabIndex: r === wt ? 0 : -1,
|
|
252
|
+
onFocus: () => Tt(r),
|
|
253
|
+
onKeyDown: (e) => Et(e, r),
|
|
243
254
|
selected: i,
|
|
244
|
-
onClick:
|
|
245
|
-
className: e("group",
|
|
255
|
+
onClick: A ? () => st(t.id) : void 0,
|
|
256
|
+
className: e("group", A && "cursor-pointer", ve && 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"),
|
|
246
257
|
children: t.getVisibleCells().map((r) => {
|
|
247
258
|
let i = r.column.getIsPinned();
|
|
248
|
-
return r.column.id === "__actions" ? /* @__PURE__ */
|
|
249
|
-
style:
|
|
259
|
+
return r.column.id === "__actions" ? /* @__PURE__ */ y(re, {
|
|
260
|
+
style: w(r, Y),
|
|
250
261
|
className: o,
|
|
251
|
-
bulkSelectionActive:
|
|
252
|
-
onMouseEnter:
|
|
253
|
-
onMouseLeave:
|
|
254
|
-
children:
|
|
255
|
-
render: /* @__PURE__ */
|
|
256
|
-
children: /* @__PURE__ */
|
|
257
|
-
}), /* @__PURE__ */
|
|
262
|
+
bulkSelectionActive: Q,
|
|
263
|
+
onMouseEnter: Q ? void 0 : () => gt(t.id),
|
|
264
|
+
onMouseLeave: Q ? void 0 : () => gt((e) => e === t.id ? void 0 : e),
|
|
265
|
+
children: z && /* @__PURE__ */ b(m, { children: [/* @__PURE__ */ y(te, {
|
|
266
|
+
render: /* @__PURE__ */ y(n, { "aria-label": Ie }),
|
|
267
|
+
children: /* @__PURE__ */ y(pe, {})
|
|
268
|
+
}), /* @__PURE__ */ y(ee, {
|
|
258
269
|
align: "end",
|
|
259
|
-
children:
|
|
270
|
+
children: z(t)
|
|
260
271
|
})] })
|
|
261
|
-
}, r.id) : /* @__PURE__ */
|
|
272
|
+
}, r.id) : /* @__PURE__ */ y(h, {
|
|
262
273
|
wrap: r.column.columnDef.meta?.wrap,
|
|
263
|
-
style:
|
|
274
|
+
style: w(r, Y),
|
|
264
275
|
className: e(i && o),
|
|
265
|
-
children:
|
|
276
|
+
children: f(r.column.columnDef.cell, r.getContext())
|
|
266
277
|
}, r.id);
|
|
267
278
|
})
|
|
268
|
-
}),
|
|
279
|
+
}), _e && t.getIsExpanded() && /* @__PURE__ */ y(g, {
|
|
269
280
|
className: "hover:bg-transparent",
|
|
270
|
-
children: /* @__PURE__ */
|
|
281
|
+
children: /* @__PURE__ */ y(h, {
|
|
271
282
|
className: "h-auto py-3",
|
|
272
283
|
colSpan: t.getVisibleCells().length,
|
|
273
|
-
children:
|
|
284
|
+
children: _e(t)
|
|
274
285
|
})
|
|
275
286
|
})] }, t.id);
|
|
276
|
-
}) :
|
|
277
|
-
colSpan:
|
|
287
|
+
}) : F ? /* @__PURE__ */ y(g, { children: /* @__PURE__ */ y(h, {
|
|
288
|
+
colSpan: q.getVisibleLeafColumns().length,
|
|
278
289
|
className: "h-24 text-center",
|
|
279
|
-
children:
|
|
280
|
-
}) }) : /* @__PURE__ */
|
|
281
|
-
colSpan:
|
|
290
|
+
children: F({ hasFilters: q.getState().columnFilters.length > 0 })
|
|
291
|
+
}) }) : /* @__PURE__ */ y(g, { children: /* @__PURE__ */ y(h, {
|
|
292
|
+
colSpan: q.getVisibleLeafColumns().length,
|
|
282
293
|
className: "h-24 text-center text-[var(--ui-table-data-value-color-disabled)]",
|
|
283
|
-
children:
|
|
294
|
+
children: Pe
|
|
284
295
|
}) }),
|
|
285
|
-
|
|
286
|
-
ref:
|
|
296
|
+
J && !j && Z.length > 0 && L && /* @__PURE__ */ y(g, {
|
|
297
|
+
ref: yt,
|
|
287
298
|
"aria-hidden": !0,
|
|
288
299
|
className: "hover:bg-transparent",
|
|
289
|
-
children: /* @__PURE__ */
|
|
290
|
-
colSpan:
|
|
300
|
+
children: /* @__PURE__ */ y(h, {
|
|
301
|
+
colSpan: q.getVisibleLeafColumns().length,
|
|
291
302
|
className: "h-1 p-0"
|
|
292
303
|
})
|
|
293
304
|
}),
|
|
294
|
-
|
|
305
|
+
J && !j && Z.length > 0 && R && /* @__PURE__ */ y(g, {
|
|
295
306
|
className: "hover:bg-transparent",
|
|
296
|
-
children: /* @__PURE__ */
|
|
297
|
-
colSpan:
|
|
298
|
-
children: /* @__PURE__ */
|
|
307
|
+
children: /* @__PURE__ */ y(h, {
|
|
308
|
+
colSpan: q.getVisibleLeafColumns().length,
|
|
309
|
+
children: /* @__PURE__ */ y("div", {
|
|
299
310
|
role: "status",
|
|
300
311
|
"aria-live": "polite",
|
|
301
312
|
className: "h-4 w-full animate-pulse rounded bg-[var(--ui-background-surface-secondary)]",
|
|
302
|
-
children: /* @__PURE__ */
|
|
313
|
+
children: /* @__PURE__ */ y("span", {
|
|
303
314
|
className: "sr-only",
|
|
304
315
|
children: "Loading more rows…"
|
|
305
316
|
})
|
|
@@ -311,6 +322,6 @@ function E({ columns: b = [], data: x = [], table: E, getRowCanExpand: ve, rende
|
|
|
311
322
|
});
|
|
312
323
|
}
|
|
313
324
|
//#endregion
|
|
314
|
-
export {
|
|
325
|
+
export { k as DataTable, w as getCellStyle, S as getColumnWidth, x as getPinnedStyle, D as getResizeKeyboardStep, O as reorderColumn };
|
|
315
326
|
|
|
316
327
|
//# sourceMappingURL=data-table.js.map
|