@fuf-stack/megapixels 0.13.5 → 0.14.0
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/DataTable/index.cjs +8 -0
- package/dist/DataTable/index.d.cts +2 -0
- package/dist/DataTable/index.d.ts +2 -0
- package/dist/DataTable/index.js +2 -0
- package/dist/DataTable-CF0oifeL.cjs +1166 -0
- package/dist/DataTable-CF0oifeL.cjs.map +1 -0
- package/dist/DataTable-Da6WZFKm.js +1145 -0
- package/dist/DataTable-Da6WZFKm.js.map +1 -0
- package/dist/Filter/index.cjs +1 -1
- package/dist/Filter/index.d.cts +1 -1
- package/dist/Filter/index.d.ts +1 -1
- package/dist/Filter/index.js +1 -1
- package/dist/{Filter-faDLPGFC.cjs → Filter-CbApjj6y.cjs} +41 -50
- package/dist/Filter-CbApjj6y.cjs.map +1 -0
- package/dist/{Filter-BKfVjFPo.js → Filter-DNj4lzj5.js} +35 -23
- package/dist/Filter-DNj4lzj5.js.map +1 -0
- package/dist/VirtualList/index.cjs +8 -0
- package/dist/VirtualList/index.d.cts +2 -0
- package/dist/VirtualList/index.d.ts +2 -0
- package/dist/VirtualList/index.js +2 -0
- package/dist/VirtualList-BALnlyjy.cjs +172 -0
- package/dist/VirtualList-BALnlyjy.cjs.map +1 -0
- package/dist/VirtualList-DQ4uR-wR.js +153 -0
- package/dist/VirtualList-DQ4uR-wR.js.map +1 -0
- package/dist/index-BGYzDspd.d.cts +5192 -0
- package/dist/index-BGYzDspd.d.cts.map +1 -0
- package/dist/index-Crb5hCFD.d.ts +5192 -0
- package/dist/index-Crb5hCFD.d.ts.map +1 -0
- package/dist/index-D7ZLM0zx.d.cts +1141 -0
- package/dist/index-D7ZLM0zx.d.cts.map +1 -0
- package/dist/{index-CgoXcO8f.d.cts → index-DCiYTnRL.d.ts} +22 -12
- package/dist/{index-E2k5kJ14.d.ts.map → index-DCiYTnRL.d.ts.map} +1 -1
- package/dist/{index-E2k5kJ14.d.ts → index-FDKfDW98.d.cts} +21 -11
- package/dist/{index-CgoXcO8f.d.cts.map → index-FDKfDW98.d.cts.map} +1 -1
- package/dist/index-jFySXsl9.d.ts +1141 -0
- package/dist/index-jFySXsl9.d.ts.map +1 -0
- package/dist/index.cjs +7 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/rolldown-runtime-D6vf50IK.cjs +28 -0
- package/dist/useInfiniteVirtualizer-BK0VroW4.cjs +175 -0
- package/dist/useInfiniteVirtualizer-BK0VroW4.cjs.map +1 -0
- package/dist/useInfiniteVirtualizer-BSCDrdRi.js +170 -0
- package/dist/useInfiniteVirtualizer-BSCDrdRi.js.map +1 -0
- package/package.json +15 -4
- package/dist/Filter-BKfVjFPo.js.map +0 -1
- package/dist/Filter-faDLPGFC.cjs.map +0 -1
|
@@ -0,0 +1,1145 @@
|
|
|
1
|
+
import { t as useInfiniteVirtualizer } from "./useInfiniteVirtualizer-BSCDrdRi.js";
|
|
2
|
+
import { Fragment, useCallback, useMemo, useRef, useState } from "react";
|
|
3
|
+
import { cn, tv, variantsToClassNames } from "@fuf-stack/pixel-utils";
|
|
4
|
+
import ScrollShadow from "@fuf-stack/pixels/ScrollShadow";
|
|
5
|
+
import { flexRender, getCoreRowModel, getExpandedRowModel, getFilteredRowModel, getPaginationRowModel, getSortedRowModel, useReactTable } from "@tanstack/react-table";
|
|
6
|
+
import Button from "@fuf-stack/pixels/Button";
|
|
7
|
+
import { Checkbox } from "@base-ui/react/checkbox";
|
|
8
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import Menu from "@fuf-stack/pixels/Menu";
|
|
10
|
+
import { LuColumns3 } from "react-icons/lu";
|
|
11
|
+
//#region src/DataTable/Subcomponents/DataTableCheckbox.tsx
|
|
12
|
+
/** Small checkbox wrapper used by DataTable selection UI. */
|
|
13
|
+
const DataTableCheckbox = ({ ariaLabel, checked, className = void 0, checkedIcon = "✓", indeterminate = false, indeterminateIcon = "−", onCheckedChange, testId = void 0 }) => {
|
|
14
|
+
const indicatorIcon = indeterminate ? indeterminateIcon : checkedIcon;
|
|
15
|
+
const resolvedIndicatorIcon = indicatorIcon === false ? null : indicatorIcon;
|
|
16
|
+
return /* @__PURE__ */ jsx(Checkbox.Root, {
|
|
17
|
+
"aria-label": ariaLabel,
|
|
18
|
+
checked,
|
|
19
|
+
className: className?.checkbox,
|
|
20
|
+
"data-slot": "checkbox",
|
|
21
|
+
"data-testid": testId,
|
|
22
|
+
indeterminate,
|
|
23
|
+
onCheckedChange: (nextChecked) => {
|
|
24
|
+
onCheckedChange(Boolean(nextChecked));
|
|
25
|
+
},
|
|
26
|
+
children: /* @__PURE__ */ jsx(Checkbox.Indicator, {
|
|
27
|
+
className: className?.checkboxIndicator,
|
|
28
|
+
"data-slot": "checkbox-indicator",
|
|
29
|
+
children: resolvedIndicatorIcon
|
|
30
|
+
})
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
//#endregion
|
|
34
|
+
//#region src/DataTable/hooks/useDataTableController.tsx
|
|
35
|
+
/** Stable id used for the injected row-selection column. */
|
|
36
|
+
const SELECTION_COLUMN_ID = "__select";
|
|
37
|
+
/** Stable id used for the injected row-expansion column. */
|
|
38
|
+
const EXPANSION_COLUMN_ID = "__expand";
|
|
39
|
+
const SortAscendingIcon = () => {
|
|
40
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
41
|
+
"aria-hidden": "true",
|
|
42
|
+
fill: "none",
|
|
43
|
+
focusable: "false",
|
|
44
|
+
height: "14",
|
|
45
|
+
viewBox: "0 0 16 16",
|
|
46
|
+
width: "14",
|
|
47
|
+
children: [/* @__PURE__ */ jsx("path", {
|
|
48
|
+
d: "M8 13V3",
|
|
49
|
+
stroke: "currentColor",
|
|
50
|
+
strokeLinecap: "round",
|
|
51
|
+
strokeLinejoin: "round",
|
|
52
|
+
strokeWidth: "1.75"
|
|
53
|
+
}), /* @__PURE__ */ jsx("path", {
|
|
54
|
+
d: "M4.5 6.5 8 3l3.5 3.5",
|
|
55
|
+
stroke: "currentColor",
|
|
56
|
+
strokeLinecap: "round",
|
|
57
|
+
strokeLinejoin: "round",
|
|
58
|
+
strokeWidth: "1.75"
|
|
59
|
+
})]
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
const SortDescendingIcon = () => {
|
|
63
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
64
|
+
"aria-hidden": "true",
|
|
65
|
+
fill: "none",
|
|
66
|
+
focusable: "false",
|
|
67
|
+
height: "14",
|
|
68
|
+
viewBox: "0 0 16 16",
|
|
69
|
+
width: "14",
|
|
70
|
+
children: [/* @__PURE__ */ jsx("path", {
|
|
71
|
+
d: "M8 3v10",
|
|
72
|
+
stroke: "currentColor",
|
|
73
|
+
strokeLinecap: "round",
|
|
74
|
+
strokeLinejoin: "round",
|
|
75
|
+
strokeWidth: "1.75"
|
|
76
|
+
}), /* @__PURE__ */ jsx("path", {
|
|
77
|
+
d: "M4.5 9.5 8 13l3.5-3.5",
|
|
78
|
+
stroke: "currentColor",
|
|
79
|
+
strokeLinecap: "round",
|
|
80
|
+
strokeLinejoin: "round",
|
|
81
|
+
strokeWidth: "1.75"
|
|
82
|
+
})]
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
const SortUnsortedIcon = () => {
|
|
86
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
87
|
+
"aria-hidden": "true",
|
|
88
|
+
fill: "none",
|
|
89
|
+
focusable: "false",
|
|
90
|
+
height: "14",
|
|
91
|
+
viewBox: "0 0 16 16",
|
|
92
|
+
width: "14",
|
|
93
|
+
children: [/* @__PURE__ */ jsx("path", {
|
|
94
|
+
d: "M5 6 8 3l3 3",
|
|
95
|
+
stroke: "currentColor",
|
|
96
|
+
strokeLinecap: "round",
|
|
97
|
+
strokeLinejoin: "round",
|
|
98
|
+
strokeWidth: "1.75"
|
|
99
|
+
}), /* @__PURE__ */ jsx("path", {
|
|
100
|
+
d: "M5 10l3 3 3-3",
|
|
101
|
+
stroke: "currentColor",
|
|
102
|
+
strokeLinecap: "round",
|
|
103
|
+
strokeLinejoin: "round",
|
|
104
|
+
strokeWidth: "1.75"
|
|
105
|
+
})]
|
|
106
|
+
});
|
|
107
|
+
};
|
|
108
|
+
const RowCollapsedIcon = () => {
|
|
109
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
110
|
+
"aria-hidden": "true",
|
|
111
|
+
fill: "none",
|
|
112
|
+
focusable: "false",
|
|
113
|
+
height: "14",
|
|
114
|
+
viewBox: "0 0 16 16",
|
|
115
|
+
width: "14",
|
|
116
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
117
|
+
d: "m6 4 4 4-4 4",
|
|
118
|
+
stroke: "currentColor",
|
|
119
|
+
strokeLinecap: "round",
|
|
120
|
+
strokeLinejoin: "round",
|
|
121
|
+
strokeWidth: "1.75"
|
|
122
|
+
})
|
|
123
|
+
});
|
|
124
|
+
};
|
|
125
|
+
const RowExpandedIcon = () => {
|
|
126
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
127
|
+
"aria-hidden": "true",
|
|
128
|
+
fill: "none",
|
|
129
|
+
focusable: "false",
|
|
130
|
+
height: "14",
|
|
131
|
+
viewBox: "0 0 16 16",
|
|
132
|
+
width: "14",
|
|
133
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
134
|
+
d: "m4 6 4 4 4-4",
|
|
135
|
+
stroke: "currentColor",
|
|
136
|
+
strokeLinecap: "round",
|
|
137
|
+
strokeLinejoin: "round",
|
|
138
|
+
strokeWidth: "1.75"
|
|
139
|
+
})
|
|
140
|
+
});
|
|
141
|
+
};
|
|
142
|
+
/** Builds the optional leading expansion column used by DataTable. */
|
|
143
|
+
const createExpansionColumn = (classNames, icons) => {
|
|
144
|
+
return {
|
|
145
|
+
cell: ({ row }) => {
|
|
146
|
+
const isExpanded = row.getIsExpanded();
|
|
147
|
+
const icon = isExpanded ? icons?.expanded ?? /* @__PURE__ */ jsx(RowExpandedIcon, {}) : icons?.collapsed ?? /* @__PURE__ */ jsx(RowCollapsedIcon, {});
|
|
148
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
149
|
+
ariaLabel: `${isExpanded ? "Collapse" : "Expand"} row ${row.id}`,
|
|
150
|
+
className: classNames.expandButton,
|
|
151
|
+
dataSlot: "expand-button",
|
|
152
|
+
disabled: !row.getCanExpand(),
|
|
153
|
+
onClick: () => {
|
|
154
|
+
row.toggleExpanded();
|
|
155
|
+
},
|
|
156
|
+
size: "sm",
|
|
157
|
+
variant: "light",
|
|
158
|
+
children: icon === false ? null : /* @__PURE__ */ jsx("span", {
|
|
159
|
+
"aria-hidden": "true",
|
|
160
|
+
className: classNames.expandIcon,
|
|
161
|
+
"data-slot": "expand-icon",
|
|
162
|
+
children: icon
|
|
163
|
+
})
|
|
164
|
+
});
|
|
165
|
+
},
|
|
166
|
+
enableHiding: false,
|
|
167
|
+
enableSorting: false,
|
|
168
|
+
header: void 0,
|
|
169
|
+
id: EXPANSION_COLUMN_ID,
|
|
170
|
+
size: 36
|
|
171
|
+
};
|
|
172
|
+
};
|
|
173
|
+
/** Builds the optional leading selection column used by DataTable. */
|
|
174
|
+
const createSelectionColumn = (classNames, icons) => {
|
|
175
|
+
return {
|
|
176
|
+
cell: ({ row }) => {
|
|
177
|
+
return /* @__PURE__ */ jsx(DataTableCheckbox, {
|
|
178
|
+
ariaLabel: `Select row ${row.id}`,
|
|
179
|
+
checked: row.getIsSelected(),
|
|
180
|
+
checkedIcon: icons?.checked,
|
|
181
|
+
className: {
|
|
182
|
+
checkbox: classNames.checkbox,
|
|
183
|
+
checkboxIndicator: classNames.checkboxIndicator
|
|
184
|
+
},
|
|
185
|
+
indeterminateIcon: icons?.indeterminate,
|
|
186
|
+
onCheckedChange: (checked) => {
|
|
187
|
+
row.toggleSelected(checked);
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
},
|
|
191
|
+
enableHiding: false,
|
|
192
|
+
enableSorting: false,
|
|
193
|
+
header: ({ table }) => {
|
|
194
|
+
return /* @__PURE__ */ jsx(DataTableCheckbox, {
|
|
195
|
+
ariaLabel: "Select all rows on page",
|
|
196
|
+
checked: table.getIsAllPageRowsSelected(),
|
|
197
|
+
checkedIcon: icons?.checked,
|
|
198
|
+
className: {
|
|
199
|
+
checkbox: classNames.checkbox,
|
|
200
|
+
checkboxIndicator: classNames.checkboxIndicator
|
|
201
|
+
},
|
|
202
|
+
indeterminate: !table.getIsAllPageRowsSelected() && table.getIsSomePageRowsSelected(),
|
|
203
|
+
indeterminateIcon: icons?.indeterminate,
|
|
204
|
+
onCheckedChange: (checked) => {
|
|
205
|
+
table.toggleAllPageRowsSelected(checked);
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
},
|
|
209
|
+
id: SELECTION_COLUMN_ID,
|
|
210
|
+
size: 36
|
|
211
|
+
};
|
|
212
|
+
};
|
|
213
|
+
/** Maps TanStack sort state to the header indicator glyph. */
|
|
214
|
+
const getSortIndicator = (canSort, sortState, icons = {}) => {
|
|
215
|
+
const ascIcon = icons.asc ?? /* @__PURE__ */ jsx(SortAscendingIcon, {});
|
|
216
|
+
const descIcon = icons.desc ?? /* @__PURE__ */ jsx(SortDescendingIcon, {});
|
|
217
|
+
const unsortedIcon = icons.unsorted ?? /* @__PURE__ */ jsx(SortUnsortedIcon, {});
|
|
218
|
+
if (sortState === "asc") return ascIcon === false ? null : ascIcon;
|
|
219
|
+
if (sortState === "desc") return descIcon === false ? null : descIcon;
|
|
220
|
+
if (canSort) return unsortedIcon === false ? null : unsortedIcon;
|
|
221
|
+
return null;
|
|
222
|
+
};
|
|
223
|
+
/**
|
|
224
|
+
* Central controller hook for DataTable state and TanStack wiring.
|
|
225
|
+
*
|
|
226
|
+
* Keeps stateful table mechanics out of the render component so `DataTable.tsx`
|
|
227
|
+
* can stay focused on structure/markup.
|
|
228
|
+
*/
|
|
229
|
+
const useDataTableController = ({ checkboxClassNames, columns, data, enableExpandableRows, enablePagination, enableServerMode = false, enableRowSelection, expansionClassNames, expansionIcons = void 0, getSubRows = void 0, hasExpandableRowContent, pageSizeOptions, selectionIcons = void 0, onSortingChange = void 0 }) => {
|
|
230
|
+
const [sorting, setSorting] = useState([]);
|
|
231
|
+
const [expanded, setExpanded] = useState({});
|
|
232
|
+
const [columnFilters, setColumnFilters] = useState([]);
|
|
233
|
+
const [columnVisibility, setColumnVisibility] = useState({});
|
|
234
|
+
const [rowSelection, setRowSelection] = useState({});
|
|
235
|
+
const [pagination, setPagination] = useState({
|
|
236
|
+
pageIndex: 0,
|
|
237
|
+
pageSize: pageSizeOptions[0] ?? 10
|
|
238
|
+
});
|
|
239
|
+
const tableColumns = useMemo(() => {
|
|
240
|
+
let nextColumns = columns;
|
|
241
|
+
if (enableRowSelection) nextColumns = [createSelectionColumn(checkboxClassNames, selectionIcons), ...nextColumns];
|
|
242
|
+
if (enableExpandableRows) nextColumns = [createExpansionColumn(expansionClassNames, expansionIcons), ...nextColumns];
|
|
243
|
+
return nextColumns;
|
|
244
|
+
}, [
|
|
245
|
+
checkboxClassNames,
|
|
246
|
+
columns,
|
|
247
|
+
enableExpandableRows,
|
|
248
|
+
enableRowSelection,
|
|
249
|
+
expansionClassNames,
|
|
250
|
+
expansionIcons,
|
|
251
|
+
selectionIcons
|
|
252
|
+
]);
|
|
253
|
+
const handleSortingChange = (nextSorting) => {
|
|
254
|
+
setSorting((previousState) => {
|
|
255
|
+
const resolvedSorting = typeof nextSorting === "function" ? nextSorting(previousState) : nextSorting;
|
|
256
|
+
onSortingChange?.(resolvedSorting);
|
|
257
|
+
return resolvedSorting;
|
|
258
|
+
});
|
|
259
|
+
};
|
|
260
|
+
return {
|
|
261
|
+
table: useReactTable({
|
|
262
|
+
columns: tableColumns,
|
|
263
|
+
data,
|
|
264
|
+
defaultColumn: { enableSorting: false },
|
|
265
|
+
enableExpanding: enableExpandableRows,
|
|
266
|
+
enableRowSelection,
|
|
267
|
+
getCoreRowModel: getCoreRowModel(),
|
|
268
|
+
getExpandedRowModel: enableExpandableRows ? getExpandedRowModel() : void 0,
|
|
269
|
+
getFilteredRowModel: enableServerMode ? void 0 : getFilteredRowModel(),
|
|
270
|
+
getPaginationRowModel: enablePagination ? getPaginationRowModel() : void 0,
|
|
271
|
+
getRowCanExpand: (row) => {
|
|
272
|
+
return hasExpandableRowContent || row.subRows.length > 0;
|
|
273
|
+
},
|
|
274
|
+
getSubRows,
|
|
275
|
+
getSortedRowModel: enableServerMode ? void 0 : getSortedRowModel(),
|
|
276
|
+
manualFiltering: enableServerMode,
|
|
277
|
+
manualSorting: enableServerMode,
|
|
278
|
+
onColumnFiltersChange: setColumnFilters,
|
|
279
|
+
onColumnVisibilityChange: setColumnVisibility,
|
|
280
|
+
onExpandedChange: setExpanded,
|
|
281
|
+
onPaginationChange: setPagination,
|
|
282
|
+
onRowSelectionChange: setRowSelection,
|
|
283
|
+
onSortingChange: handleSortingChange,
|
|
284
|
+
state: {
|
|
285
|
+
columnFilters,
|
|
286
|
+
columnVisibility,
|
|
287
|
+
expanded,
|
|
288
|
+
pagination,
|
|
289
|
+
rowSelection,
|
|
290
|
+
sorting
|
|
291
|
+
}
|
|
292
|
+
}),
|
|
293
|
+
tableColumns
|
|
294
|
+
};
|
|
295
|
+
};
|
|
296
|
+
//#endregion
|
|
297
|
+
//#region src/DataTable/Subcomponents/DataTableCells.tsx
|
|
298
|
+
const getColumnKind = (columnId) => {
|
|
299
|
+
if (columnId === "__expand") return "expansion";
|
|
300
|
+
if (columnId === "__select") return "selection";
|
|
301
|
+
return "data";
|
|
302
|
+
};
|
|
303
|
+
const getCellDataSlot = (columnKind) => {
|
|
304
|
+
if (columnKind === "expansion") return "expansion-cell";
|
|
305
|
+
if (columnKind === "selection") return "selection-cell";
|
|
306
|
+
return "td";
|
|
307
|
+
};
|
|
308
|
+
const getHeaderDataSlot = (columnKind) => {
|
|
309
|
+
if (columnKind === "data") return "th";
|
|
310
|
+
return getCellDataSlot(columnKind);
|
|
311
|
+
};
|
|
312
|
+
const getControlCellContentDataSlot = (columnKind) => {
|
|
313
|
+
if (columnKind === "expansion") return "expansion-cell-content";
|
|
314
|
+
return "selection-cell-content";
|
|
315
|
+
};
|
|
316
|
+
/**
|
|
317
|
+
* Flex sizing for cells in virtualized mode.
|
|
318
|
+
*
|
|
319
|
+
* Because virtual rows are absolutely positioned, we cannot rely on native
|
|
320
|
+
* table layout for column width sync; header/body cells must apply matching
|
|
321
|
+
* explicit sizing rules.
|
|
322
|
+
*/
|
|
323
|
+
const getVirtualCellStyle = (columnKind, size) => {
|
|
324
|
+
if (columnKind === "data") return {
|
|
325
|
+
flex: `1 1 ${size}px`,
|
|
326
|
+
minWidth: 0,
|
|
327
|
+
width: size
|
|
328
|
+
};
|
|
329
|
+
return {
|
|
330
|
+
flex: `0 0 ${size}px`,
|
|
331
|
+
width: size
|
|
332
|
+
};
|
|
333
|
+
};
|
|
334
|
+
/** Shared row positioning style for full-width virtual rows. */
|
|
335
|
+
const virtualFullWidthRowStyle = (start) => {
|
|
336
|
+
return {
|
|
337
|
+
display: "flex",
|
|
338
|
+
position: "absolute",
|
|
339
|
+
transform: `translateY(${start}px)`,
|
|
340
|
+
width: "100%"
|
|
341
|
+
};
|
|
342
|
+
};
|
|
343
|
+
/** Shared single-cell style for full-width virtual rows. */
|
|
344
|
+
const virtualFullWidthCellStyle = {
|
|
345
|
+
flex: "1 1 auto",
|
|
346
|
+
width: "100%"
|
|
347
|
+
};
|
|
348
|
+
/**
|
|
349
|
+
* Renders one header cell and encapsulates sortable/non-sortable behavior.
|
|
350
|
+
*/
|
|
351
|
+
const DataTableHeaderCell = ({ classNames, header, sortIcons = void 0, virtualized = false }) => {
|
|
352
|
+
const canSort = header.column.getCanSort();
|
|
353
|
+
const columnKind = getColumnKind(header.column.id);
|
|
354
|
+
const isExpansionColumn = columnKind === "expansion";
|
|
355
|
+
const isSelectionColumn = columnKind === "selection";
|
|
356
|
+
const sortState = header.column.getIsSorted();
|
|
357
|
+
const sortIndicator = getSortIndicator(canSort, sortState, sortIcons);
|
|
358
|
+
if (header.isPlaceholder) return /* @__PURE__ */ jsx("th", {
|
|
359
|
+
"aria-label": "Empty column header",
|
|
360
|
+
className: classNames.th,
|
|
361
|
+
"data-slot": getHeaderDataSlot(columnKind)
|
|
362
|
+
}, header.id);
|
|
363
|
+
return /* @__PURE__ */ jsx("th", {
|
|
364
|
+
className: cn(classNames.th, isExpansionColumn && classNames.expansionCell, isSelectionColumn && classNames.selectionCell),
|
|
365
|
+
"data-slot": getHeaderDataSlot(columnKind),
|
|
366
|
+
style: virtualized ? {
|
|
367
|
+
alignItems: "center",
|
|
368
|
+
display: "flex",
|
|
369
|
+
...getVirtualCellStyle(columnKind, header.getSize())
|
|
370
|
+
} : void 0,
|
|
371
|
+
children: canSort ? /* @__PURE__ */ jsxs(Button, {
|
|
372
|
+
className: classNames.sortButton,
|
|
373
|
+
"data-sortable": canSort,
|
|
374
|
+
dataSlot: "sort-button",
|
|
375
|
+
onClick: () => {
|
|
376
|
+
header.column.toggleSorting(sortState === "asc");
|
|
377
|
+
},
|
|
378
|
+
size: "sm",
|
|
379
|
+
variant: "light",
|
|
380
|
+
children: [flexRender(header.column.columnDef.header, header.getContext()), sortIndicator ? /* @__PURE__ */ jsx("span", {
|
|
381
|
+
"aria-hidden": "true",
|
|
382
|
+
className: classNames.sortIcon,
|
|
383
|
+
"data-slot": "sort-icon",
|
|
384
|
+
children: sortIndicator
|
|
385
|
+
}) : null]
|
|
386
|
+
}) : /* @__PURE__ */ jsx("div", {
|
|
387
|
+
className: cn(classNames.nonSortableHeaderContent, isExpansionColumn && classNames.expansionCellContent, isSelectionColumn && classNames.selectionCellContent),
|
|
388
|
+
"data-slot": columnKind === "data" ? "non-sortable-header-content" : getControlCellContentDataSlot(columnKind),
|
|
389
|
+
children: flexRender(header.column.columnDef.header, header.getContext())
|
|
390
|
+
})
|
|
391
|
+
}, header.id);
|
|
392
|
+
};
|
|
393
|
+
/**
|
|
394
|
+
* Renders one body cell and hides control-column wrapper details from row loops.
|
|
395
|
+
*/
|
|
396
|
+
const DataTableBodyCell = ({ cell, classNames, virtualized = false }) => {
|
|
397
|
+
const columnKind = getColumnKind(cell.column.id);
|
|
398
|
+
const isExpansionColumn = columnKind === "expansion";
|
|
399
|
+
const isSelectionColumn = columnKind === "selection";
|
|
400
|
+
const isControlColumn = columnKind !== "data";
|
|
401
|
+
const cellContent = flexRender(cell.column.columnDef.cell, cell.getContext());
|
|
402
|
+
const expansionIndent = isExpansionColumn && cell.row.depth > 0 ? { paddingLeft: `${cell.row.depth * 1.25}rem` } : void 0;
|
|
403
|
+
return /* @__PURE__ */ jsx("td", {
|
|
404
|
+
className: cn(classNames.td, isExpansionColumn && classNames.expansionCell, isSelectionColumn && classNames.selectionCell),
|
|
405
|
+
"data-slot": getCellDataSlot(columnKind),
|
|
406
|
+
style: virtualized ? getVirtualCellStyle(columnKind, cell.column.getSize()) : void 0,
|
|
407
|
+
children: isControlColumn ? /* @__PURE__ */ jsx("div", {
|
|
408
|
+
className: cn(isExpansionColumn && classNames.expansionCellContent, isSelectionColumn && classNames.selectionCellContent),
|
|
409
|
+
"data-slot": getControlCellContentDataSlot(columnKind),
|
|
410
|
+
style: expansionIndent,
|
|
411
|
+
children: cellContent
|
|
412
|
+
}) : cellContent
|
|
413
|
+
}, cell.id);
|
|
414
|
+
};
|
|
415
|
+
//#endregion
|
|
416
|
+
//#region src/DataTable/Subcomponents/DataTableBodyRows.tsx
|
|
417
|
+
/**
|
|
418
|
+
* Standard row renderer used in non-virtualized table mode.
|
|
419
|
+
*
|
|
420
|
+
* It renders:
|
|
421
|
+
* - each data row
|
|
422
|
+
* - an optional sibling expanded-content row that spans all visible columns
|
|
423
|
+
*/
|
|
424
|
+
const DataTableBodyRows = ({ classNames, expandableRows = void 0, rows, visibleColumnCount, virtualized = false }) => {
|
|
425
|
+
return rows.map((row) => {
|
|
426
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("tr", {
|
|
427
|
+
className: classNames.tr,
|
|
428
|
+
"data-slot": "tr",
|
|
429
|
+
"data-state": row.getIsSelected() ? "selected" : void 0,
|
|
430
|
+
style: virtualized ? {
|
|
431
|
+
display: "flex",
|
|
432
|
+
width: "100%"
|
|
433
|
+
} : void 0,
|
|
434
|
+
children: row.getVisibleCells().map((cell) => {
|
|
435
|
+
return /* @__PURE__ */ jsx(DataTableBodyCell, {
|
|
436
|
+
cell,
|
|
437
|
+
classNames,
|
|
438
|
+
virtualized
|
|
439
|
+
}, cell.id);
|
|
440
|
+
})
|
|
441
|
+
}), expandableRows?.renderContent && row.getIsExpanded() ? /* @__PURE__ */ jsx("tr", {
|
|
442
|
+
className: cn(classNames.tr, classNames.expandedRow),
|
|
443
|
+
"data-slot": "expanded-row",
|
|
444
|
+
children: /* @__PURE__ */ jsx("td", {
|
|
445
|
+
className: classNames.expandedCell,
|
|
446
|
+
colSpan: visibleColumnCount,
|
|
447
|
+
"data-slot": "expanded-cell",
|
|
448
|
+
children: expandableRows.renderContent(row)
|
|
449
|
+
})
|
|
450
|
+
}) : null] }, row.id);
|
|
451
|
+
});
|
|
452
|
+
};
|
|
453
|
+
//#endregion
|
|
454
|
+
//#region src/DataTable/Subcomponents/DataTablePagination.tsx
|
|
455
|
+
const ChevronDownIcon = () => {
|
|
456
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
457
|
+
"aria-hidden": "true",
|
|
458
|
+
fill: "none",
|
|
459
|
+
focusable: "false",
|
|
460
|
+
height: "14",
|
|
461
|
+
viewBox: "0 0 16 16",
|
|
462
|
+
width: "14",
|
|
463
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
464
|
+
d: "m4 6 4 4 4-4",
|
|
465
|
+
stroke: "currentColor",
|
|
466
|
+
strokeLinecap: "round",
|
|
467
|
+
strokeLinejoin: "round",
|
|
468
|
+
strokeWidth: "1.75"
|
|
469
|
+
})
|
|
470
|
+
});
|
|
471
|
+
};
|
|
472
|
+
/** Footer controls for paging, page size, and selected-row summary. */
|
|
473
|
+
const DataTablePagination = ({ classNames, pageSizeOptions, showRowsPerPage, showSelectionSummary, table, testId = void 0 }) => {
|
|
474
|
+
const { pageSize } = table.getState().pagination;
|
|
475
|
+
const selectedRowCount = table.getFilteredSelectedRowModel().rows.length;
|
|
476
|
+
const pageSizeItems = pageSizeOptions.map((size) => {
|
|
477
|
+
return {
|
|
478
|
+
key: String(size),
|
|
479
|
+
textValue: String(size),
|
|
480
|
+
label: /* @__PURE__ */ jsxs("span", {
|
|
481
|
+
className: "flex items-center gap-2",
|
|
482
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
483
|
+
className: "inline-flex w-3 justify-center",
|
|
484
|
+
children: size === pageSize ? "✓" : ""
|
|
485
|
+
}), size]
|
|
486
|
+
})
|
|
487
|
+
};
|
|
488
|
+
});
|
|
489
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
490
|
+
className: classNames.pagination,
|
|
491
|
+
"data-slot": "pagination",
|
|
492
|
+
children: [
|
|
493
|
+
showSelectionSummary && selectedRowCount > 0 ? /* @__PURE__ */ jsxs("div", {
|
|
494
|
+
className: classNames.selectionSummary,
|
|
495
|
+
"data-slot": "selection-summary",
|
|
496
|
+
children: [
|
|
497
|
+
selectedRowCount,
|
|
498
|
+
" of ",
|
|
499
|
+
table.getFilteredRowModel().rows.length,
|
|
500
|
+
" row(s) selected."
|
|
501
|
+
]
|
|
502
|
+
}) : /* @__PURE__ */ jsx("div", {
|
|
503
|
+
"aria-hidden": "true",
|
|
504
|
+
className: classNames.selectionSummary,
|
|
505
|
+
"data-slot": "selection-summary"
|
|
506
|
+
}),
|
|
507
|
+
showRowsPerPage && pageSizeOptions.length > 0 ? /* @__PURE__ */ jsxs("div", {
|
|
508
|
+
className: classNames.pageSizeLabel,
|
|
509
|
+
"data-slot": "page-size-label",
|
|
510
|
+
children: [/* @__PURE__ */ jsx("span", { children: "Rows per page" }), /* @__PURE__ */ jsxs(Menu, {
|
|
511
|
+
ariaLabel: "Rows per page",
|
|
512
|
+
items: pageSizeItems,
|
|
513
|
+
onAction: (key) => {
|
|
514
|
+
table.setPageSize(Number(key));
|
|
515
|
+
},
|
|
516
|
+
placement: "top",
|
|
517
|
+
testId: testId ? `${testId}-page-size` : void 0,
|
|
518
|
+
triggerButtonProps: {
|
|
519
|
+
"aria-label": "Rows per page",
|
|
520
|
+
className: classNames.pageSizeSelect,
|
|
521
|
+
dataSlot: "page-size-select",
|
|
522
|
+
disableRipple: true,
|
|
523
|
+
size: "sm",
|
|
524
|
+
variant: "bordered"
|
|
525
|
+
},
|
|
526
|
+
children: [pageSize, /* @__PURE__ */ jsx(ChevronDownIcon, {})]
|
|
527
|
+
})]
|
|
528
|
+
}) : null,
|
|
529
|
+
/* @__PURE__ */ jsxs("div", {
|
|
530
|
+
className: classNames.pageSummary,
|
|
531
|
+
"data-slot": "page-summary",
|
|
532
|
+
children: [
|
|
533
|
+
"Page ",
|
|
534
|
+
table.getState().pagination.pageIndex + 1,
|
|
535
|
+
" of",
|
|
536
|
+
" ",
|
|
537
|
+
Math.max(table.getPageCount(), 1)
|
|
538
|
+
]
|
|
539
|
+
}),
|
|
540
|
+
/* @__PURE__ */ jsx(Button, {
|
|
541
|
+
className: classNames.paginationButton,
|
|
542
|
+
dataSlot: "pagination-button",
|
|
543
|
+
disabled: !table.getCanPreviousPage(),
|
|
544
|
+
onClick: () => {
|
|
545
|
+
table.previousPage();
|
|
546
|
+
},
|
|
547
|
+
size: "sm",
|
|
548
|
+
testId: testId ? `${testId}-previous-page` : void 0,
|
|
549
|
+
variant: "bordered",
|
|
550
|
+
children: "Previous"
|
|
551
|
+
}),
|
|
552
|
+
/* @__PURE__ */ jsx(Button, {
|
|
553
|
+
className: classNames.paginationButton,
|
|
554
|
+
dataSlot: "pagination-button",
|
|
555
|
+
disabled: !table.getCanNextPage(),
|
|
556
|
+
onClick: () => {
|
|
557
|
+
table.nextPage();
|
|
558
|
+
},
|
|
559
|
+
size: "sm",
|
|
560
|
+
testId: testId ? `${testId}-next-page` : void 0,
|
|
561
|
+
variant: "bordered",
|
|
562
|
+
children: "Next"
|
|
563
|
+
})
|
|
564
|
+
]
|
|
565
|
+
});
|
|
566
|
+
};
|
|
567
|
+
//#endregion
|
|
568
|
+
//#region src/DataTable/Subcomponents/DataTableViewOptions.tsx
|
|
569
|
+
/**
|
|
570
|
+
* Resolves a human-readable label for a column, preferring its string header
|
|
571
|
+
* over the raw TanStack column id (e.g. "Status" instead of "status").
|
|
572
|
+
*/
|
|
573
|
+
const getColumnLabel = (column) => {
|
|
574
|
+
const { header } = column.columnDef;
|
|
575
|
+
return typeof header === "string" ? header : column.id;
|
|
576
|
+
};
|
|
577
|
+
/** Dropdown for toggling table column visibility. */
|
|
578
|
+
const DataTableViewOptions = ({ classNames, table, triggerIcon = /* @__PURE__ */ jsx(LuColumns3, {}), visibleIcon = "✓", testId = void 0 }) => {
|
|
579
|
+
const hideableColumns = table.getAllColumns().filter((column) => {
|
|
580
|
+
return column.getCanHide();
|
|
581
|
+
});
|
|
582
|
+
const columnsById = new Map(hideableColumns.map((column) => {
|
|
583
|
+
return [column.id, column];
|
|
584
|
+
}));
|
|
585
|
+
return /* @__PURE__ */ jsxs(Menu, {
|
|
586
|
+
items: hideableColumns.map((column) => {
|
|
587
|
+
const columnLabel = getColumnLabel(column);
|
|
588
|
+
return {
|
|
589
|
+
key: column.id,
|
|
590
|
+
className: classNames.viewOptionsItem,
|
|
591
|
+
dataSlot: "view-options-item",
|
|
592
|
+
textValue: columnLabel,
|
|
593
|
+
label: /* @__PURE__ */ jsxs("span", {
|
|
594
|
+
className: "flex items-center gap-2",
|
|
595
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
596
|
+
className: classNames.viewOptionsIndicator,
|
|
597
|
+
"data-slot": "view-options-indicator",
|
|
598
|
+
children: column.getIsVisible() && visibleIcon !== false ? visibleIcon : ""
|
|
599
|
+
}), columnLabel]
|
|
600
|
+
})
|
|
601
|
+
};
|
|
602
|
+
}),
|
|
603
|
+
onAction: (key) => {
|
|
604
|
+
const column = columnsById.get(String(key));
|
|
605
|
+
if (!column) return;
|
|
606
|
+
column.toggleVisibility(!column.getIsVisible());
|
|
607
|
+
},
|
|
608
|
+
testId: testId ? `${testId}-column-visibility-trigger` : void 0,
|
|
609
|
+
triggerButtonProps: {
|
|
610
|
+
"aria-label": "Toggle column visibility",
|
|
611
|
+
className: classNames.viewOptionsTrigger,
|
|
612
|
+
dataSlot: "view-options-trigger",
|
|
613
|
+
disableRipple: true,
|
|
614
|
+
size: "sm",
|
|
615
|
+
variant: "bordered"
|
|
616
|
+
},
|
|
617
|
+
children: [triggerIcon === false ? null : triggerIcon, "Columns"]
|
|
618
|
+
});
|
|
619
|
+
};
|
|
620
|
+
//#endregion
|
|
621
|
+
//#region src/DataTable/hooks/useDataTableVirtualizer.ts
|
|
622
|
+
/**
|
|
623
|
+
* Flattens current table state into virtual render items.
|
|
624
|
+
*
|
|
625
|
+
* Ordering rules:
|
|
626
|
+
* - each loaded row always produces a `row` item
|
|
627
|
+
* - each expanded row optionally produces an adjacent `expanded` item
|
|
628
|
+
* - `total-count` mode appends unloaded `placeholder` items after loaded rows
|
|
629
|
+
* - infinite mode appends a trailing `load-more` sentinel when needed
|
|
630
|
+
*/
|
|
631
|
+
const getDataTableVirtualItems = ({ expandableRows, infiniteScroll, rows }) => {
|
|
632
|
+
const nextItems = [];
|
|
633
|
+
rows.forEach((row, rowIndex) => {
|
|
634
|
+
nextItems.push({
|
|
635
|
+
key: `row-${row.id}`,
|
|
636
|
+
kind: "row",
|
|
637
|
+
row
|
|
638
|
+
});
|
|
639
|
+
if (expandableRows?.renderContent && row.getIsExpanded()) nextItems.push({
|
|
640
|
+
key: `expanded-${row.id}`,
|
|
641
|
+
kind: "expanded",
|
|
642
|
+
row
|
|
643
|
+
});
|
|
644
|
+
if (infiniteScroll?.scrollbarMode !== "total-count") return;
|
|
645
|
+
if (!(rowIndex === rows.length - 1)) return;
|
|
646
|
+
const placeholderCount = Math.max(infiniteScroll.pageInfo.totalCount - rows.length, 0);
|
|
647
|
+
for (let placeholderOffset = 0; placeholderOffset < placeholderCount; placeholderOffset += 1) {
|
|
648
|
+
const placeholderIndex = rows.length + placeholderOffset;
|
|
649
|
+
nextItems.push({
|
|
650
|
+
key: `placeholder-${placeholderIndex}`,
|
|
651
|
+
kind: "placeholder",
|
|
652
|
+
rowIndex: placeholderIndex
|
|
653
|
+
});
|
|
654
|
+
}
|
|
655
|
+
});
|
|
656
|
+
if (rows.length === 0 && infiniteScroll?.scrollbarMode === "total-count") {
|
|
657
|
+
const placeholderCount = Math.max(infiniteScroll.pageInfo.totalCount, 0);
|
|
658
|
+
for (let placeholderIndex = 0; placeholderIndex < placeholderCount; placeholderIndex += 1) nextItems.push({
|
|
659
|
+
key: `placeholder-${placeholderIndex}`,
|
|
660
|
+
kind: "placeholder",
|
|
661
|
+
rowIndex: placeholderIndex
|
|
662
|
+
});
|
|
663
|
+
}
|
|
664
|
+
if (Boolean(infiniteScroll && ((infiniteScroll.pageInfo.hasNextPage ?? false) || (infiniteScroll.isFetchingNextPage ?? false) || (infiniteScroll.loadMoreError ?? false)))) nextItems.push({
|
|
665
|
+
key: "load-more",
|
|
666
|
+
kind: "load-more"
|
|
667
|
+
});
|
|
668
|
+
return nextItems;
|
|
669
|
+
};
|
|
670
|
+
/**
|
|
671
|
+
* DataTable-specific adapter around the shared `useInfiniteVirtualizer`.
|
|
672
|
+
*
|
|
673
|
+
* Responsibilities:
|
|
674
|
+
* - flatten table/expanded/placeholder/loading state into virtual items
|
|
675
|
+
* - derive `loadedItemCount` used for duplicate-load guards
|
|
676
|
+
* - translate generic load events back to cursor-based `onLoadMore`
|
|
677
|
+
* - expose a `getItem(virtualItem)` lookup for row rendering
|
|
678
|
+
*/
|
|
679
|
+
const useDataTableVirtualizer = ({ expandableRows, infiniteScroll, rows, scrollElementRef, virtualization }) => {
|
|
680
|
+
const virtualRows = useMemo(() => {
|
|
681
|
+
return getDataTableVirtualItems({
|
|
682
|
+
expandableRows,
|
|
683
|
+
infiniteScroll,
|
|
684
|
+
rows
|
|
685
|
+
});
|
|
686
|
+
}, [
|
|
687
|
+
expandableRows,
|
|
688
|
+
infiniteScroll,
|
|
689
|
+
rows
|
|
690
|
+
]);
|
|
691
|
+
const loadedItemCount = useMemo(() => {
|
|
692
|
+
const loadMoreIndex = virtualRows.findIndex((item) => {
|
|
693
|
+
return item.kind === "load-more";
|
|
694
|
+
});
|
|
695
|
+
if (loadMoreIndex >= 0) return loadMoreIndex;
|
|
696
|
+
const placeholderIndex = virtualRows.findIndex((item) => {
|
|
697
|
+
return item.kind === "placeholder";
|
|
698
|
+
});
|
|
699
|
+
if (placeholderIndex >= 0) return placeholderIndex;
|
|
700
|
+
return virtualRows.length;
|
|
701
|
+
}, [virtualRows]);
|
|
702
|
+
const virtualizer = useInfiniteVirtualizer({
|
|
703
|
+
count: virtualRows.length,
|
|
704
|
+
dynamicRowHeight: virtualization?.dynamicRowHeight ?? Boolean(infiniteScroll),
|
|
705
|
+
enabled: Boolean(virtualization ?? infiniteScroll),
|
|
706
|
+
estimateSize: () => {
|
|
707
|
+
return virtualization?.estimateRowHeight ?? 45;
|
|
708
|
+
},
|
|
709
|
+
hasNextPage: infiniteScroll?.pageInfo.hasNextPage,
|
|
710
|
+
isFetchingNextPage: infiniteScroll?.isFetchingNextPage,
|
|
711
|
+
loadedCount: loadedItemCount,
|
|
712
|
+
loadMoreError: infiniteScroll?.loadMoreError,
|
|
713
|
+
loadMoreThreshold: infiniteScroll?.loadMoreThreshold,
|
|
714
|
+
onLoadMore: infiniteScroll ? () => {
|
|
715
|
+
infiniteScroll.onLoadMore({
|
|
716
|
+
cursor: infiniteScroll.pageInfo.endCursor,
|
|
717
|
+
direction: "forward"
|
|
718
|
+
});
|
|
719
|
+
} : void 0,
|
|
720
|
+
overscan: virtualization?.overscan,
|
|
721
|
+
scrollElementRef,
|
|
722
|
+
shouldLoadMore: ({ loadMoreThreshold, virtualItems }) => {
|
|
723
|
+
if (!infiniteScroll) return false;
|
|
724
|
+
const kindsInRange = new Set(virtualItems.map((item) => {
|
|
725
|
+
return virtualRows[item.index]?.kind;
|
|
726
|
+
}));
|
|
727
|
+
if (kindsInRange.has("placeholder") || kindsInRange.has("load-more")) return true;
|
|
728
|
+
return (virtualItems[virtualItems.length - 1]?.index ?? 0) >= Math.max(loadedItemCount - loadMoreThreshold - 1, 0);
|
|
729
|
+
}
|
|
730
|
+
});
|
|
731
|
+
const getItem = (virtualItem) => {
|
|
732
|
+
return virtualRows[virtualItem.index];
|
|
733
|
+
};
|
|
734
|
+
return {
|
|
735
|
+
getItem,
|
|
736
|
+
items: virtualRows,
|
|
737
|
+
loadedItemCount,
|
|
738
|
+
...virtualizer
|
|
739
|
+
};
|
|
740
|
+
};
|
|
741
|
+
//#endregion
|
|
742
|
+
//#region src/DataTable/Subcomponents/DataTableVirtualBodyRows.tsx
|
|
743
|
+
/**
|
|
744
|
+
* Virtualized row renderer for DataTable body.
|
|
745
|
+
*
|
|
746
|
+
* It maps virtual items (row/expanded/placeholder/load-more) to absolute
|
|
747
|
+
* positioned `<tr>` elements and delegates load-more retry handling.
|
|
748
|
+
*/
|
|
749
|
+
const DataTableVirtualBodyRows = ({ classNames, expandableRows = void 0, infiniteScroll = void 0, loadingMoreContent = "Loading more...", retryContent = "Load next page", rows, scrollElementRef = void 0, virtualized, virtualization = void 0, visibleColumnCount }) => {
|
|
750
|
+
const { getItem, measureElement, retry, totalSize, virtualItems } = useDataTableVirtualizer({
|
|
751
|
+
expandableRows,
|
|
752
|
+
infiniteScroll,
|
|
753
|
+
rows,
|
|
754
|
+
scrollElementRef,
|
|
755
|
+
virtualization
|
|
756
|
+
});
|
|
757
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("tr", {
|
|
758
|
+
style: { height: `${totalSize}px` },
|
|
759
|
+
children: /* @__PURE__ */ jsx("td", {
|
|
760
|
+
"aria-label": "Virtual spacer row",
|
|
761
|
+
colSpan: visibleColumnCount,
|
|
762
|
+
style: { padding: 0 }
|
|
763
|
+
})
|
|
764
|
+
}), virtualItems.map((virtualItem) => {
|
|
765
|
+
const item = getItem(virtualItem);
|
|
766
|
+
if (!item) return null;
|
|
767
|
+
if (item.kind === "row") return /* @__PURE__ */ jsx("tr", {
|
|
768
|
+
ref: measureElement,
|
|
769
|
+
className: classNames.tr,
|
|
770
|
+
"data-index": virtualItem.index,
|
|
771
|
+
"data-slot": "tr",
|
|
772
|
+
"data-state": item.row.getIsSelected() ? "selected" : void 0,
|
|
773
|
+
style: {
|
|
774
|
+
display: virtualized ? "flex" : void 0,
|
|
775
|
+
position: "absolute",
|
|
776
|
+
transform: `translateY(${virtualItem.start}px)`,
|
|
777
|
+
width: "100%"
|
|
778
|
+
},
|
|
779
|
+
children: item.row.getVisibleCells().map((cell) => {
|
|
780
|
+
return /* @__PURE__ */ jsx(DataTableBodyCell, {
|
|
781
|
+
cell,
|
|
782
|
+
classNames,
|
|
783
|
+
virtualized
|
|
784
|
+
}, cell.id);
|
|
785
|
+
})
|
|
786
|
+
}, item.key);
|
|
787
|
+
if (item.kind === "expanded") return /* @__PURE__ */ jsx("tr", {
|
|
788
|
+
ref: measureElement,
|
|
789
|
+
className: cn(classNames.tr, classNames.expandedRow),
|
|
790
|
+
"data-index": virtualItem.index,
|
|
791
|
+
"data-slot": "expanded-row",
|
|
792
|
+
style: virtualFullWidthRowStyle(virtualItem.start),
|
|
793
|
+
children: /* @__PURE__ */ jsx("td", {
|
|
794
|
+
className: classNames.expandedCell,
|
|
795
|
+
colSpan: visibleColumnCount,
|
|
796
|
+
"data-slot": "expanded-cell",
|
|
797
|
+
style: virtualFullWidthCellStyle,
|
|
798
|
+
children: expandableRows?.renderContent?.(item.row)
|
|
799
|
+
})
|
|
800
|
+
}, item.key);
|
|
801
|
+
if (item.kind === "placeholder") return /* @__PURE__ */ jsx("tr", {
|
|
802
|
+
ref: measureElement,
|
|
803
|
+
className: classNames.tr,
|
|
804
|
+
"data-index": virtualItem.index,
|
|
805
|
+
"data-slot": "placeholder-row",
|
|
806
|
+
style: {
|
|
807
|
+
...virtualFullWidthRowStyle(virtualItem.start),
|
|
808
|
+
height: `${virtualItem.size}px`
|
|
809
|
+
},
|
|
810
|
+
children: rows[0]?.getVisibleCells().map((cell) => {
|
|
811
|
+
const columnKind = getColumnKind(cell.column.id);
|
|
812
|
+
return /* @__PURE__ */ jsx("td", {
|
|
813
|
+
"aria-label": "Loading placeholder",
|
|
814
|
+
className: classNames.placeholderCell,
|
|
815
|
+
"data-slot": "placeholder-cell",
|
|
816
|
+
style: getVirtualCellStyle(columnKind, cell.column.getSize()),
|
|
817
|
+
children: /* @__PURE__ */ jsx("span", { className: "block h-3 rounded bg-default-300/50 dark:bg-default-300/20" })
|
|
818
|
+
}, `${item.key}-${cell.column.id}`);
|
|
819
|
+
})
|
|
820
|
+
}, item.key);
|
|
821
|
+
return /* @__PURE__ */ jsx("tr", {
|
|
822
|
+
ref: measureElement,
|
|
823
|
+
className: classNames.tr,
|
|
824
|
+
"data-index": virtualItem.index,
|
|
825
|
+
"data-slot": "loading-more-row",
|
|
826
|
+
style: virtualFullWidthRowStyle(virtualItem.start),
|
|
827
|
+
children: /* @__PURE__ */ jsx("td", {
|
|
828
|
+
className: classNames.loadingMoreCell,
|
|
829
|
+
colSpan: visibleColumnCount,
|
|
830
|
+
"data-slot": "loading-more-cell",
|
|
831
|
+
style: virtualFullWidthCellStyle,
|
|
832
|
+
children: infiniteScroll?.loadMoreError ? /* @__PURE__ */ jsx(Button, {
|
|
833
|
+
dataSlot: "load-more-retry-button",
|
|
834
|
+
onClick: retry,
|
|
835
|
+
size: "sm",
|
|
836
|
+
variant: "bordered",
|
|
837
|
+
children: retryContent
|
|
838
|
+
}) : loadingMoreContent
|
|
839
|
+
})
|
|
840
|
+
}, item.key);
|
|
841
|
+
})] });
|
|
842
|
+
};
|
|
843
|
+
//#endregion
|
|
844
|
+
//#region src/DataTable/DataTable.tsx
|
|
845
|
+
const dataTableVariants = tv({ slots: {
|
|
846
|
+
base: "w-full",
|
|
847
|
+
checkbox: "relative inline-flex h-4 w-4 shrink-0 cursor-pointer items-center justify-center rounded border border-divider bg-background align-middle text-foreground",
|
|
848
|
+
checkboxIndicator: "pointer-events-none absolute inset-0 flex items-center justify-center text-[10px] leading-none",
|
|
849
|
+
emptyCell: "h-24 text-center text-default-500",
|
|
850
|
+
expandButton: "h-8 min-w-8 px-0 disabled:cursor-not-allowed data-[disabled=true]:pointer-events-auto data-[disabled=true]:cursor-not-allowed",
|
|
851
|
+
expandIcon: "inline-flex h-3.5 w-3.5 shrink-0 items-center justify-center text-default-500",
|
|
852
|
+
expansionCell: "w-10 px-0 text-center",
|
|
853
|
+
expansionCellContent: "flex justify-center",
|
|
854
|
+
expandedRow: "bg-content1",
|
|
855
|
+
expandedCell: "p-4 text-sm text-default-600",
|
|
856
|
+
searchInput: "h-10 w-full max-w-sm rounded-small border-2 border-default-200 bg-transparent px-3 text-sm text-foreground outline-none transition-colors placeholder:text-default-500 hover:border-default-400 data-[focused=true]:border-focus dark:border-default-100",
|
|
857
|
+
loadingCell: "h-24 text-center text-default-500",
|
|
858
|
+
loadingMoreCell: "flex h-14 items-center justify-center text-default-500",
|
|
859
|
+
nonSortableHeaderContent: "inline-flex items-center",
|
|
860
|
+
pageSizeLabel: "flex items-center gap-2 text-sm text-default-500",
|
|
861
|
+
pageSizeSelect: "min-w-16 justify-between gap-2",
|
|
862
|
+
pageSummary: "text-sm text-default-500",
|
|
863
|
+
pagination: "flex items-center gap-2 py-4",
|
|
864
|
+
paginationButton: "",
|
|
865
|
+
placeholderCell: "h-10 animate-pulse bg-default-100/60 p-3 dark:bg-default-100/10",
|
|
866
|
+
selectionSummary: "mr-auto text-sm text-default-500",
|
|
867
|
+
selectionCell: "w-10 px-0 text-center",
|
|
868
|
+
selectionCellContent: "flex justify-center",
|
|
869
|
+
sortButton: "-ml-2 min-w-0 justify-start gap-1.5 px-2 text-left font-medium text-foreground data-[sortable=true]:cursor-pointer",
|
|
870
|
+
sortIcon: "inline-flex h-3.5 w-3.5 shrink-0 items-center justify-center text-default-400",
|
|
871
|
+
scrollContainer: "overflow-y-auto overflow-x-hidden",
|
|
872
|
+
scrollShadow: "",
|
|
873
|
+
table: "w-full caption-bottom text-sm",
|
|
874
|
+
tableWrapper: "overflow-hidden rounded-md border border-divider",
|
|
875
|
+
tbody: "",
|
|
876
|
+
td: "p-3 align-middle text-foreground",
|
|
877
|
+
th: "h-10 px-3 text-left align-middle font-medium text-foreground",
|
|
878
|
+
thead: "bg-content2",
|
|
879
|
+
toolbar: "flex items-center gap-3 py-4",
|
|
880
|
+
toolbarContent: "flex flex-1 items-center",
|
|
881
|
+
tr: "border-b border-divider last:border-b-0 data-[state=selected]:bg-content2/60",
|
|
882
|
+
viewOptionsIndicator: "mr-2 inline-flex w-3 justify-center",
|
|
883
|
+
viewOptionsItem: "data-highlighted:bg-default-100 dark:data-highlighted:bg-default-100/20 flex cursor-pointer items-center rounded px-2 py-1 text-sm text-foreground outline-none",
|
|
884
|
+
viewOptionsMenu: "z-50 min-w-40 rounded-md border border-divider bg-background p-1 shadow-md",
|
|
885
|
+
viewOptionsPositioner: "outline-none",
|
|
886
|
+
viewOptionsTrigger: "ml-auto gap-2"
|
|
887
|
+
} });
|
|
888
|
+
/**
|
|
889
|
+
* Generic, feature-composable data table built on TanStack Table.
|
|
890
|
+
*
|
|
891
|
+
* Responsibilities:
|
|
892
|
+
* - Renders semantic table markup (`table`, `thead`, `tbody`, `tr`, `th`, `td`).
|
|
893
|
+
* - Wires sorting/search/visibility/selection/pagination state via
|
|
894
|
+
* `useDataTableController`.
|
|
895
|
+
* - Exposes slot-based styling through `dataTableVariants` + `className`.
|
|
896
|
+
* - Supports optional custom toolbar content (e.g. megapixels `Filter`).
|
|
897
|
+
*
|
|
898
|
+
* Feature configuration:
|
|
899
|
+
* - Configure search/visibility/selection/pagination through `features`.
|
|
900
|
+
*/
|
|
901
|
+
const DataTable = ({ ariaLabel = "Data table", className = void 0, columns, data, emptyContent = "No results.", features = void 0, icons = void 0, loading = false, loadingContent = "Loading...", testId = void 0, toolbarContent = void 0 }) => {
|
|
902
|
+
const resolvedEnableColumnVisibility = features?.columnVisibility ?? false;
|
|
903
|
+
const resolvedExpandableRows = features?.expandableRows;
|
|
904
|
+
const resolvedEnableExpandableRows = Boolean(resolvedExpandableRows);
|
|
905
|
+
const paginationConfig = typeof features?.pagination === "object" ? features.pagination : void 0;
|
|
906
|
+
const resolvedInfiniteScroll = features?.infiniteScroll;
|
|
907
|
+
const resolvedVirtualization = features?.virtualization;
|
|
908
|
+
const resolvedEnableVirtualization = Boolean(resolvedVirtualization ?? resolvedInfiniteScroll);
|
|
909
|
+
const resolvedEnablePagination = Boolean(features?.pagination && !resolvedInfiniteScroll);
|
|
910
|
+
const resolvedEnableRowSelection = Boolean(features?.rowSelection && !resolvedInfiniteScroll);
|
|
911
|
+
const resolvedPageSizeOptions = paginationConfig?.pageSizeOptions ?? [
|
|
912
|
+
10,
|
|
913
|
+
20,
|
|
914
|
+
50
|
|
915
|
+
];
|
|
916
|
+
const resolvedShowRowsPerPage = paginationConfig?.showRowsPerPage ?? true;
|
|
917
|
+
const resolvedSearchFields = features?.search?.columns ?? [];
|
|
918
|
+
const virtualConfig = resolvedVirtualization ?? (resolvedInfiniteScroll ? {
|
|
919
|
+
dynamicRowHeight: true,
|
|
920
|
+
maxHeight: 600
|
|
921
|
+
} : void 0);
|
|
922
|
+
const variants = dataTableVariants();
|
|
923
|
+
const scrollContainerRef = useRef(null);
|
|
924
|
+
const handleSortingChange = useCallback((sorting) => {
|
|
925
|
+
if (resolvedInfiniteScroll) scrollContainerRef.current?.scrollTo({ top: 0 });
|
|
926
|
+
resolvedInfiniteScroll?.onSortingChange?.(sorting);
|
|
927
|
+
}, [resolvedInfiniteScroll]);
|
|
928
|
+
const classNames = variantsToClassNames(variants, className, "base");
|
|
929
|
+
const checkboxClassNames = useMemo(() => {
|
|
930
|
+
return {
|
|
931
|
+
checkbox: classNames.checkbox,
|
|
932
|
+
checkboxIndicator: classNames.checkboxIndicator
|
|
933
|
+
};
|
|
934
|
+
}, [classNames.checkbox, classNames.checkboxIndicator]);
|
|
935
|
+
const expansionClassNames = useMemo(() => {
|
|
936
|
+
return {
|
|
937
|
+
expandButton: classNames.expandButton,
|
|
938
|
+
expandIcon: classNames.expandIcon
|
|
939
|
+
};
|
|
940
|
+
}, [classNames.expandButton, classNames.expandIcon]);
|
|
941
|
+
const { table } = useDataTableController({
|
|
942
|
+
checkboxClassNames,
|
|
943
|
+
columns,
|
|
944
|
+
data,
|
|
945
|
+
enableExpandableRows: resolvedEnableExpandableRows,
|
|
946
|
+
enablePagination: resolvedEnablePagination,
|
|
947
|
+
enableServerMode: Boolean(resolvedInfiniteScroll),
|
|
948
|
+
enableRowSelection: resolvedEnableRowSelection,
|
|
949
|
+
expansionClassNames,
|
|
950
|
+
expansionIcons: icons?.expandableRows,
|
|
951
|
+
getSubRows: resolvedExpandableRows?.getSubRows,
|
|
952
|
+
hasExpandableRowContent: Boolean(resolvedExpandableRows?.renderContent),
|
|
953
|
+
onSortingChange: handleSortingChange,
|
|
954
|
+
pageSizeOptions: resolvedPageSizeOptions,
|
|
955
|
+
selectionIcons: icons?.selection
|
|
956
|
+
});
|
|
957
|
+
const visibleColumnCount = table.getVisibleLeafColumns().length;
|
|
958
|
+
const tableRows = table.getRowModel().rows;
|
|
959
|
+
const showToolbar = resolvedSearchFields.length > 0 || resolvedEnableColumnVisibility || Boolean(toolbarContent);
|
|
960
|
+
const renderHeaderRows = (virtualized) => {
|
|
961
|
+
return table.getHeaderGroups().map((headerGroup) => {
|
|
962
|
+
return /* @__PURE__ */ jsx("tr", {
|
|
963
|
+
className: classNames.tr,
|
|
964
|
+
"data-slot": "tr",
|
|
965
|
+
style: virtualized ? {
|
|
966
|
+
display: "flex",
|
|
967
|
+
width: "100%"
|
|
968
|
+
} : void 0,
|
|
969
|
+
children: headerGroup.headers.map((header) => {
|
|
970
|
+
return /* @__PURE__ */ jsx(DataTableHeaderCell, {
|
|
971
|
+
classNames,
|
|
972
|
+
header,
|
|
973
|
+
sortIcons: icons?.sort,
|
|
974
|
+
virtualized
|
|
975
|
+
}, header.id);
|
|
976
|
+
})
|
|
977
|
+
}, headerGroup.id);
|
|
978
|
+
});
|
|
979
|
+
};
|
|
980
|
+
const renderBodyStateRows = () => {
|
|
981
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [loading ? /* @__PURE__ */ jsx("tr", {
|
|
982
|
+
className: classNames.tr,
|
|
983
|
+
"data-slot": "tr",
|
|
984
|
+
children: /* @__PURE__ */ jsx("td", {
|
|
985
|
+
className: classNames.loadingCell,
|
|
986
|
+
colSpan: visibleColumnCount,
|
|
987
|
+
"data-slot": "loading-cell",
|
|
988
|
+
children: loadingContent
|
|
989
|
+
})
|
|
990
|
+
}) : null, !loading && tableRows.length === 0 ? /* @__PURE__ */ jsx("tr", {
|
|
991
|
+
className: classNames.tr,
|
|
992
|
+
"data-slot": "tr",
|
|
993
|
+
children: /* @__PURE__ */ jsx("td", {
|
|
994
|
+
className: classNames.emptyCell,
|
|
995
|
+
colSpan: visibleColumnCount,
|
|
996
|
+
"data-slot": "empty-cell",
|
|
997
|
+
children: emptyContent
|
|
998
|
+
})
|
|
999
|
+
}) : null] });
|
|
1000
|
+
};
|
|
1001
|
+
const renderVirtualizedTable = () => {
|
|
1002
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("table", {
|
|
1003
|
+
"aria-hidden": loading && tableRows.length === 0 ? "true" : void 0,
|
|
1004
|
+
className: classNames.table,
|
|
1005
|
+
"data-slot": "table",
|
|
1006
|
+
style: { display: "grid" },
|
|
1007
|
+
children: /* @__PURE__ */ jsx("thead", {
|
|
1008
|
+
className: classNames.thead,
|
|
1009
|
+
"data-slot": "thead",
|
|
1010
|
+
children: renderHeaderRows(true)
|
|
1011
|
+
})
|
|
1012
|
+
}), /* @__PURE__ */ jsx(ScrollShadow, {
|
|
1013
|
+
ref: scrollContainerRef,
|
|
1014
|
+
className: classNames.scrollShadow ? `${classNames.scrollContainer} ${classNames.scrollShadow}` : classNames.scrollContainer,
|
|
1015
|
+
visibility: resolvedInfiniteScroll?.loadMoreError ? "none" : "auto",
|
|
1016
|
+
dataSlot: "scroll-container",
|
|
1017
|
+
style: { maxHeight: virtualConfig?.maxHeight },
|
|
1018
|
+
size: virtualConfig?.scrollShadowSize ?? 40,
|
|
1019
|
+
children: /* @__PURE__ */ jsx("table", {
|
|
1020
|
+
"aria-label": ariaLabel,
|
|
1021
|
+
className: classNames.table,
|
|
1022
|
+
"data-slot": "table",
|
|
1023
|
+
style: { display: "grid" },
|
|
1024
|
+
children: /* @__PURE__ */ jsxs("tbody", {
|
|
1025
|
+
className: classNames.tbody,
|
|
1026
|
+
"data-slot": "tbody",
|
|
1027
|
+
style: {
|
|
1028
|
+
display: "grid",
|
|
1029
|
+
position: "relative"
|
|
1030
|
+
},
|
|
1031
|
+
children: [loading ? null : /* @__PURE__ */ jsx(DataTableVirtualBodyRows, {
|
|
1032
|
+
classNames,
|
|
1033
|
+
expandableRows: resolvedExpandableRows,
|
|
1034
|
+
infiniteScroll: resolvedInfiniteScroll,
|
|
1035
|
+
loadingMoreContent: resolvedInfiniteScroll?.loadingMoreContent,
|
|
1036
|
+
retryContent: resolvedInfiniteScroll?.retryContent,
|
|
1037
|
+
rows: tableRows,
|
|
1038
|
+
scrollElementRef: scrollContainerRef,
|
|
1039
|
+
virtualization: virtualConfig,
|
|
1040
|
+
virtualized: true,
|
|
1041
|
+
visibleColumnCount
|
|
1042
|
+
}), renderBodyStateRows()]
|
|
1043
|
+
})
|
|
1044
|
+
})
|
|
1045
|
+
})] });
|
|
1046
|
+
};
|
|
1047
|
+
const renderStandardTable = () => {
|
|
1048
|
+
return /* @__PURE__ */ jsxs("table", {
|
|
1049
|
+
"aria-label": ariaLabel,
|
|
1050
|
+
className: classNames.table,
|
|
1051
|
+
"data-slot": "table",
|
|
1052
|
+
children: [/* @__PURE__ */ jsx("thead", {
|
|
1053
|
+
className: classNames.thead,
|
|
1054
|
+
"data-slot": "thead",
|
|
1055
|
+
children: renderHeaderRows(false)
|
|
1056
|
+
}), /* @__PURE__ */ jsxs("tbody", {
|
|
1057
|
+
className: classNames.tbody,
|
|
1058
|
+
"data-slot": "tbody",
|
|
1059
|
+
children: [loading ? null : /* @__PURE__ */ jsx(DataTableBodyRows, {
|
|
1060
|
+
classNames,
|
|
1061
|
+
expandableRows: resolvedExpandableRows,
|
|
1062
|
+
rows: tableRows,
|
|
1063
|
+
visibleColumnCount
|
|
1064
|
+
}), renderBodyStateRows()]
|
|
1065
|
+
})]
|
|
1066
|
+
});
|
|
1067
|
+
};
|
|
1068
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1069
|
+
className: classNames.base,
|
|
1070
|
+
"data-slot": "base",
|
|
1071
|
+
"data-testid": testId,
|
|
1072
|
+
children: [
|
|
1073
|
+
showToolbar ? /* @__PURE__ */ jsxs("div", {
|
|
1074
|
+
className: classNames.toolbar,
|
|
1075
|
+
"data-slot": "toolbar",
|
|
1076
|
+
children: [
|
|
1077
|
+
toolbarContent ? /* @__PURE__ */ jsx("div", {
|
|
1078
|
+
className: classNames.toolbarContent,
|
|
1079
|
+
"data-slot": "toolbar-content",
|
|
1080
|
+
children: toolbarContent
|
|
1081
|
+
}) : null,
|
|
1082
|
+
resolvedSearchFields.map((searchField) => {
|
|
1083
|
+
const searchValue = table.getColumn(searchField.column)?.getFilterValue() ?? "";
|
|
1084
|
+
let searchTestId;
|
|
1085
|
+
if (testId) searchTestId = resolvedSearchFields.length === 1 ? `${testId}-search` : `${testId}-search-${searchField.column}`;
|
|
1086
|
+
return /* @__PURE__ */ jsx("input", {
|
|
1087
|
+
className: classNames.searchInput,
|
|
1088
|
+
"data-focused": Boolean(searchValue),
|
|
1089
|
+
"data-slot": "search-input",
|
|
1090
|
+
"data-testid": searchTestId,
|
|
1091
|
+
onChange: (event) => {
|
|
1092
|
+
const { value } = event.target;
|
|
1093
|
+
table.getColumn(searchField.column)?.setFilterValue(value);
|
|
1094
|
+
if (resolvedInfiniteScroll) {
|
|
1095
|
+
resolvedInfiniteScroll.onSearchChange?.(searchField.column, value);
|
|
1096
|
+
scrollContainerRef.current?.scrollTo({ top: 0 });
|
|
1097
|
+
}
|
|
1098
|
+
},
|
|
1099
|
+
placeholder: searchField.placeholder ?? "Search...",
|
|
1100
|
+
value: searchValue
|
|
1101
|
+
}, searchField.column);
|
|
1102
|
+
}),
|
|
1103
|
+
resolvedEnableColumnVisibility ? /* @__PURE__ */ jsx(DataTableViewOptions, {
|
|
1104
|
+
classNames: {
|
|
1105
|
+
viewOptionsIndicator: classNames.viewOptionsIndicator,
|
|
1106
|
+
viewOptionsItem: classNames.viewOptionsItem,
|
|
1107
|
+
viewOptionsTrigger: classNames.viewOptionsTrigger
|
|
1108
|
+
},
|
|
1109
|
+
table,
|
|
1110
|
+
testId,
|
|
1111
|
+
triggerIcon: icons?.columnVisibility?.trigger,
|
|
1112
|
+
visibleIcon: icons?.columnVisibility?.visible
|
|
1113
|
+
}) : null
|
|
1114
|
+
]
|
|
1115
|
+
}) : null,
|
|
1116
|
+
/* @__PURE__ */ jsx("div", {
|
|
1117
|
+
className: classNames.tableWrapper,
|
|
1118
|
+
"data-slot": "table-wrapper",
|
|
1119
|
+
children: resolvedEnableVirtualization ? renderVirtualizedTable() : renderStandardTable()
|
|
1120
|
+
}),
|
|
1121
|
+
resolvedEnablePagination ? /* @__PURE__ */ jsx(DataTablePagination, {
|
|
1122
|
+
classNames: {
|
|
1123
|
+
pageSizeLabel: classNames.pageSizeLabel,
|
|
1124
|
+
pageSizeSelect: classNames.pageSizeSelect,
|
|
1125
|
+
pageSummary: classNames.pageSummary,
|
|
1126
|
+
pagination: classNames.pagination,
|
|
1127
|
+
paginationButton: classNames.paginationButton,
|
|
1128
|
+
selectionSummary: classNames.selectionSummary
|
|
1129
|
+
},
|
|
1130
|
+
pageSizeOptions: resolvedPageSizeOptions,
|
|
1131
|
+
showRowsPerPage: resolvedShowRowsPerPage,
|
|
1132
|
+
showSelectionSummary: resolvedEnableRowSelection,
|
|
1133
|
+
table,
|
|
1134
|
+
testId
|
|
1135
|
+
}) : null
|
|
1136
|
+
]
|
|
1137
|
+
});
|
|
1138
|
+
};
|
|
1139
|
+
//#endregion
|
|
1140
|
+
//#region src/DataTable/index.ts
|
|
1141
|
+
var DataTable_default = DataTable;
|
|
1142
|
+
//#endregion
|
|
1143
|
+
export { DataTable as n, dataTableVariants as r, DataTable_default as t };
|
|
1144
|
+
|
|
1145
|
+
//# sourceMappingURL=DataTable-Da6WZFKm.js.map
|