react-glide-table 1.6.0 → 2.0.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/index.cjs CHANGED
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var src_exports = {};
22
22
  __export(src_exports, {
23
+ BUILTIN_CELL_RENDERERS: () => BUILTIN_CELL_RENDERERS,
23
24
  CELL_SELECTION_EDGES_CLASS: () => CELL_SELECTION_EDGES_CLASS,
24
25
  DEFAULT_DATA_TABLE_LABELS: () => DEFAULT_DATA_TABLE_LABELS,
25
26
  DEFAULT_TREE_CHILDREN_FIELD: () => DEFAULT_TREE_CHILDREN_FIELD,
@@ -28,6 +29,7 @@ __export(src_exports, {
28
29
  DEFAULT_TREE_QTY_FIELD: () => DEFAULT_TREE_QTY_FIELD,
29
30
  DataTable: () => DataTable,
30
31
  INLINE_SEARCH_MAX_RESULTS: () => INLINE_SEARCH_MAX_RESULTS,
32
+ ResolvedTableCell: () => ResolvedTableCell,
31
33
  Table: () => Table,
32
34
  applyCellEdit: () => applyCellEdit,
33
35
  applyFillData: () => applyFillData,
@@ -47,10 +49,14 @@ __export(src_exports, {
47
49
  collectFillChanges: () => collectFillChanges,
48
50
  collectRowSpanColumns: () => collectRowSpanColumns,
49
51
  collectSearchMatchesInRange: () => collectSearchMatchesInRange,
52
+ commitCellValue: () => commitCellValue,
53
+ createCellRendererRegistry: () => createCellRendererRegistry,
50
54
  createSearchRegex: () => createSearchRegex,
51
55
  createTable: () => createTable,
52
56
  escapeSearchRegex: () => escapeSearchRegex,
53
57
  flattenSubtreeRows: () => flattenSubtreeRows,
58
+ formatCellValue: () => formatCellValue,
59
+ formatDefaultCellValue: () => formatDefaultCellValue,
54
60
  formatSearchResultLabel: () => formatSearchResultLabel,
55
61
  getCellEditDraftValue: () => getCellEditDraftValue,
56
62
  getCellSelectionEdgeStyle: () => getCellSelectionEdgeStyle,
@@ -72,8 +78,10 @@ __export(src_exports, {
72
78
  parseClipboardTSV: () => parseClipboardTSV,
73
79
  parseClipboardTSVWithDepths: () => parseClipboardTSVWithDepths,
74
80
  previousSearchIndex: () => previousSearchIndex,
81
+ resolveCellRenderer: () => resolveCellRenderer,
75
82
  resolveColumnFreezeSide: () => resolveColumnFreezeSide,
76
83
  resolveDataTableLabels: () => resolveDataTableLabels,
84
+ resolveHeaderFreezeOffset: () => resolveHeaderFreezeOffset,
77
85
  resolvePasteColumnIds: () => resolvePasteColumnIds,
78
86
  resolveRowSelection: () => resolveRowSelection,
79
87
  resolveRowSpanAt: () => resolveRowSpanAt,
@@ -132,6 +140,7 @@ var ROW_HOVER_CLASS = "row-hoverable";
132
140
  var ROW_HOVERED_BG_CLASS = "row-hovered";
133
141
  var CELL_SELECTION_FILL_CLASS = "cell-selection-fill";
134
142
  var DATA_TABLE_ROW_HEIGHT = 44;
143
+ var DATA_TABLE_HEADER_ROW_HEIGHT = 40;
135
144
  var DATA_TABLE_VIRTUAL_OVERSCAN = 8;
136
145
  var DATA_TABLE_COLUMN_SIZE = 150;
137
146
  var DATA_TABLE_COLUMN_MIN_SIZE = 40;
@@ -186,6 +195,37 @@ function applyCellEdit(data, rows, rowIndex, colIndex, raw) {
186
195
  return newData;
187
196
  }
188
197
 
198
+ // src/components/ui/table/features/cell-render/commitCellValue.ts
199
+ function commitCellValue({
200
+ data,
201
+ rows,
202
+ rowId,
203
+ columnId,
204
+ value,
205
+ onCellChange,
206
+ onDataChange
207
+ }) {
208
+ if (!onCellChange && !onDataChange) return true;
209
+ if (onCellChange) {
210
+ onCellChange(rowId, columnId, value);
211
+ return true;
212
+ }
213
+ const row = rows.find((item) => item.id === rowId);
214
+ if (!row) return false;
215
+ const cell = row.getAllCells().find((item) => item.column.id === columnId) ?? row.getVisibleCells().find((item) => item.column.id === columnId);
216
+ if (!cell) return false;
217
+ const accessorKey = getColumnAccessorKey(cell.column.columnDef);
218
+ if (!accessorKey) return false;
219
+ const dataIndex = row.index;
220
+ if (dataIndex < 0 || dataIndex >= data.length) return false;
221
+ const next = data.map((item) => ({ ...item }));
222
+ const target = next[dataIndex];
223
+ if (!target) return false;
224
+ target[accessorKey] = value;
225
+ onDataChange?.(next);
226
+ return true;
227
+ }
228
+
189
229
  // src/components/ui/table/features/cell-edit/useCellEdit.ts
190
230
  function useCellEdit({
191
231
  data,
@@ -221,21 +261,23 @@ function useCellEdit({
221
261
  cancelEdit();
222
262
  return true;
223
263
  }
224
- const value = raw ?? draftValueRef.current;
225
264
  if (!isColumnEditable(cell.column.columnDef)) {
226
265
  cancelEdit();
227
266
  return true;
228
267
  }
268
+ const value = raw ?? draftValueRef.current;
229
269
  const parsed = parseCellEditValue(value, getColumnEditType(cell.column.columnDef));
230
270
  if (!parsed.ok) return false;
231
- if (onCellChange) {
232
- onCellChange(row.id, cell.column.id, parsed.value);
233
- cancelEdit();
234
- return true;
235
- }
236
- const next = applyCellEdit(data, rows, current.rowIndex, current.colIndex, value);
237
- if (!next) return false;
238
- onDataChange?.(next);
271
+ const committed = commitCellValue({
272
+ data,
273
+ rows,
274
+ rowId: row.id,
275
+ columnId: cell.column.id,
276
+ value: parsed.value,
277
+ onCellChange,
278
+ onDataChange
279
+ });
280
+ if (!committed) return false;
239
281
  cancelEdit();
240
282
  return true;
241
283
  },
@@ -264,6 +306,218 @@ function useCellEdit({
264
306
  };
265
307
  }
266
308
 
309
+ // src/components/ui/table/features/cell-render/builtins.tsx
310
+ var import_jsx_runtime = require("react/jsx-runtime");
311
+ function asString(value) {
312
+ if (value == null) return "";
313
+ return String(value);
314
+ }
315
+ function asStringList(value) {
316
+ if (Array.isArray(value)) {
317
+ return value.map((item) => asString(item)).filter(Boolean);
318
+ }
319
+ if (value == null || value === "") return [];
320
+ return [asString(value)];
321
+ }
322
+ function asDrilldownItems(value) {
323
+ if (!Array.isArray(value)) return [];
324
+ return value.flatMap((item) => {
325
+ if (item == null) return [];
326
+ if (typeof item === "string") return [{ text: item }];
327
+ if (typeof item === "object") {
328
+ const record = item;
329
+ const text = asString(record.text ?? record.label ?? "");
330
+ if (!text) return [];
331
+ const img = record.img ?? record.image;
332
+ return [{ text, ...typeof img === "string" ? { img } : {} }];
333
+ }
334
+ return [{ text: asString(item) }];
335
+ });
336
+ }
337
+ function escapeHtml(text) {
338
+ return text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
339
+ }
340
+ function simpleMarkdownToHtml(source) {
341
+ const escaped = escapeHtml(source);
342
+ return escaped.replace(/`([^`]+)`/g, "<code>$1</code>").replace(/\*\*([^*]+)\*\*/g, "<strong>$1</strong>").replace(/\*([^*]+)\*/g, "<em>$1</em>").replace(/\n/g, "<br />");
343
+ }
344
+ function TextCell({ value }) {
345
+ return asString(value);
346
+ }
347
+ function NumberCell({ value }) {
348
+ if (value == null || value === "") return null;
349
+ return asString(value);
350
+ }
351
+ function BooleanCell({ value, update, cellProps }) {
352
+ const checked = Boolean(value);
353
+ const readonly = Boolean(cellProps?.readonly);
354
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
355
+ "input",
356
+ {
357
+ type: "checkbox",
358
+ className: "data-table-cell-boolean",
359
+ checked,
360
+ disabled: readonly,
361
+ "aria-checked": checked,
362
+ onChange: (event) => {
363
+ if (readonly) return;
364
+ update(event.target.checked);
365
+ },
366
+ onClick: (event) => {
367
+ event.stopPropagation();
368
+ },
369
+ onMouseDown: (event) => {
370
+ event.stopPropagation();
371
+ }
372
+ }
373
+ );
374
+ }
375
+ function sanitizeUriHref(raw) {
376
+ const href = raw.trim();
377
+ if (!href) return null;
378
+ if (href.startsWith("/") || href.startsWith("#") || href.startsWith("?") || href.startsWith("./") || href.startsWith("../")) {
379
+ return href;
380
+ }
381
+ try {
382
+ const parsed = new URL(href);
383
+ const protocol = parsed.protocol.toLowerCase();
384
+ if (protocol === "http:" || protocol === "https:" || protocol === "mailto:") {
385
+ return href;
386
+ }
387
+ return null;
388
+ } catch {
389
+ if (/^[a-z][a-z0-9+.-]*:/i.test(href)) return null;
390
+ return href;
391
+ }
392
+ }
393
+ function UriCell({ value }) {
394
+ const raw = asString(value);
395
+ if (!raw) return null;
396
+ const href = sanitizeUriHref(raw);
397
+ if (!href) {
398
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "data-table-cell-uri", children: raw });
399
+ }
400
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
401
+ "a",
402
+ {
403
+ className: "data-table-cell-uri",
404
+ href,
405
+ target: "_blank",
406
+ rel: "noopener noreferrer",
407
+ onClick: (event) => event.stopPropagation(),
408
+ onMouseDown: (event) => event.stopPropagation(),
409
+ children: raw
410
+ }
411
+ );
412
+ }
413
+ function ImageCell({ value }) {
414
+ const urls = asStringList(value);
415
+ if (urls.length === 0) return null;
416
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "data-table-cell-image", children: urls.map((url, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
417
+ "img",
418
+ {
419
+ src: url,
420
+ alt: "",
421
+ className: "data-table-cell-image-item"
422
+ },
423
+ `${index}:${url}`
424
+ )) });
425
+ }
426
+ function BubbleCell({ value }) {
427
+ const items = asStringList(value);
428
+ if (items.length === 0) return null;
429
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "data-table-cell-bubble", children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "data-table-cell-bubble-item", children: item }, `${index}:${item}`)) });
430
+ }
431
+ function MarkdownCell({ value }) {
432
+ const source = asString(value);
433
+ if (!source) return null;
434
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
435
+ "span",
436
+ {
437
+ className: "data-table-cell-markdown",
438
+ dangerouslySetInnerHTML: { __html: simpleMarkdownToHtml(source) }
439
+ }
440
+ );
441
+ }
442
+ function DrilldownCell({ value }) {
443
+ const items = asDrilldownItems(value);
444
+ if (items.length === 0) return null;
445
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "data-table-cell-drilldown", children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
446
+ "span",
447
+ {
448
+ className: "data-table-cell-drilldown-item",
449
+ children: [
450
+ item.img ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
451
+ "img",
452
+ {
453
+ src: item.img,
454
+ alt: "",
455
+ className: "data-table-cell-drilldown-image"
456
+ }
457
+ ) : null,
458
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "data-table-cell-drilldown-text", children: item.text })
459
+ ]
460
+ },
461
+ `${index}:${item.text}:${item.img ?? ""}`
462
+ )) });
463
+ }
464
+ function LoadingCell() {
465
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "data-table-cell-loading", "aria-busy": "true" });
466
+ }
467
+ function ProtectedCell() {
468
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "data-table-cell-protected", "aria-label": "protected", children: "****" });
469
+ }
470
+ function RowIdCell({ value }) {
471
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "data-table-cell-row-id", children: asString(value) });
472
+ }
473
+ var BUILTIN_RENDER_MAP = {
474
+ text: TextCell,
475
+ number: NumberCell,
476
+ boolean: BooleanCell,
477
+ uri: UriCell,
478
+ image: ImageCell,
479
+ bubble: BubbleCell,
480
+ markdown: MarkdownCell,
481
+ drilldown: DrilldownCell,
482
+ loading: LoadingCell,
483
+ protected: ProtectedCell,
484
+ "row-id": RowIdCell
485
+ };
486
+ var BUILTIN_CELL_RENDERERS = Object.keys(BUILTIN_RENDER_MAP).map((kind) => ({
487
+ kind,
488
+ render: BUILTIN_RENDER_MAP[kind]
489
+ }));
490
+
491
+ // src/components/ui/table/features/cell-render/registry.ts
492
+ function createCellRendererRegistry(customRenderers = []) {
493
+ const registry = /* @__PURE__ */ new Map();
494
+ for (const renderer of BUILTIN_CELL_RENDERERS) {
495
+ registry.set(renderer.kind, renderer);
496
+ }
497
+ for (const renderer of customRenderers) {
498
+ registry.set(renderer.kind, renderer);
499
+ }
500
+ return registry;
501
+ }
502
+ function resolveCellRenderer(registry, kind, ctx) {
503
+ if (!kind) return void 0;
504
+ const renderer = registry.get(kind);
505
+ if (!renderer) return void 0;
506
+ if (renderer.isMatch && !renderer.isMatch(ctx)) {
507
+ return void 0;
508
+ }
509
+ return renderer;
510
+ }
511
+ function formatDefaultCellValue(value) {
512
+ if (value == null) return null;
513
+ if (typeof value === "string") return value;
514
+ if (typeof value === "number" || typeof value === "boolean") {
515
+ return String(value);
516
+ }
517
+ if (typeof value === "bigint") return value.toString();
518
+ return String(value);
519
+ }
520
+
267
521
  // src/components/ui/table/features/cell-selection/useCellSelection.ts
268
522
  var import_react2 = require("react");
269
523
 
@@ -573,9 +827,34 @@ function hasCellSelectionEdges(style) {
573
827
  }
574
828
 
575
829
  // src/components/ui/table/features/cell-selection/copyData.ts
830
+ function formatPrimitive(value) {
831
+ if (value === null || value === void 0) return "";
832
+ if (typeof value === "string") return value;
833
+ if (typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") {
834
+ return String(value);
835
+ }
836
+ return "";
837
+ }
838
+ function formatObjectValue(value) {
839
+ const text = value.text ?? value.label ?? value.name ?? value.title;
840
+ if (text != null && text !== "") {
841
+ return formatCellValue(text);
842
+ }
843
+ try {
844
+ return JSON.stringify(value);
845
+ } catch {
846
+ return "";
847
+ }
848
+ }
576
849
  function formatCellValue(value) {
577
850
  if (value === null || value === void 0) return "";
578
- return String(value);
851
+ if (Array.isArray(value)) {
852
+ return value.map((item) => formatCellValue(item)).filter((item) => item.length > 0).join(", ");
853
+ }
854
+ if (typeof value === "object") {
855
+ return formatObjectValue(value);
856
+ }
857
+ return formatPrimitive(value);
579
858
  }
580
859
  function getNestedValue(row, path) {
581
860
  if (!path.includes(".")) return row[path];
@@ -1199,10 +1478,40 @@ function getColumnFreezeStyle(offset, options) {
1199
1478
  return {
1200
1479
  position: "sticky",
1201
1480
  ...offset.side === "left" ? { left: offset.offset } : { right: offset.offset },
1202
- zIndex: zBase + offset.stack,
1203
- ...options?.isHeader ? { top: 0 } : {}
1481
+ zIndex: zBase + offset.stack
1204
1482
  };
1205
1483
  }
1484
+ function resolveHeaderFreezeOffset(column, freezeOffsets) {
1485
+ const direct = freezeOffsets.get(column.id);
1486
+ if (direct) return direct;
1487
+ const leaves = typeof column.getLeafColumns === "function" ? column.getLeafColumns() : column.columns && column.columns.length > 0 ? flattenHeaderLeaves(column) : [];
1488
+ if (leaves.length === 0) return void 0;
1489
+ const leafOffsets = [];
1490
+ for (const leaf of leaves) {
1491
+ const offset2 = freezeOffsets.get(leaf.id);
1492
+ if (!offset2) return void 0;
1493
+ leafOffsets.push(offset2);
1494
+ }
1495
+ const side = leafOffsets[0]?.side;
1496
+ if (!side || leafOffsets.some((offset2) => offset2.side !== side)) {
1497
+ return void 0;
1498
+ }
1499
+ const offset = Math.min(...leafOffsets.map((item) => item.offset));
1500
+ const leftmost = leafOffsets[0];
1501
+ const rightmost = leafOffsets[leafOffsets.length - 1];
1502
+ return {
1503
+ side,
1504
+ offset,
1505
+ edgeLeft: leftmost.edgeLeft,
1506
+ edgeRight: rightmost.edgeRight,
1507
+ isEdge: leftmost.edgeLeft || rightmost.edgeRight,
1508
+ stack: Math.max(...leafOffsets.map((item) => item.stack))
1509
+ };
1510
+ }
1511
+ function flattenHeaderLeaves(column) {
1512
+ if (!column.columns || column.columns.length === 0) return [column];
1513
+ return column.columns.flatMap((child) => flattenHeaderLeaves(child));
1514
+ }
1206
1515
 
1207
1516
  // src/components/ui/table/features/inline-search/inlineSearch.ts
1208
1517
  var INLINE_SEARCH_MAX_RESULTS = 1e3;
@@ -1946,6 +2255,7 @@ function useGlideTable(options) {
1946
2255
  onDataChange,
1947
2256
  onCellChange,
1948
2257
  onBatchChange,
2258
+ cellRenderers,
1949
2259
  preserveRowSelection = false,
1950
2260
  toggleField,
1951
2261
  childField,
@@ -2171,6 +2481,22 @@ function useGlideTable(options) {
2171
2481
  commitEdit,
2172
2482
  cancelEdit
2173
2483
  } = useCellEdit({ data: tableData, rows, onDataChange, onCellChange });
2484
+ const cellRendererRegistry = (0, import_react5.useMemo)(
2485
+ () => createCellRendererRegistry(cellRenderers),
2486
+ [cellRenderers]
2487
+ );
2488
+ const commitRenderedCellValue = (0, import_react5.useCallback)(
2489
+ (rowId, columnId, value) => commitCellValue({
2490
+ data: tableData,
2491
+ rows,
2492
+ rowId,
2493
+ columnId,
2494
+ value,
2495
+ onCellChange,
2496
+ onDataChange
2497
+ }),
2498
+ [onCellChange, onDataChange, rows, tableData]
2499
+ );
2174
2500
  const handleCellMouseDownWithCommit = (0, import_react5.useCallback)(
2175
2501
  (rowIndex, colIndex, options2) => {
2176
2502
  const isSameEditingCell = editingCell?.rowIndex === rowIndex && editingCell?.colIndex === colIndex;
@@ -2407,6 +2733,10 @@ function useGlideTable(options) {
2407
2733
  onCommitEdit: commitEdit,
2408
2734
  onCancelEdit: cancelEdit
2409
2735
  },
2736
+ cellRender: {
2737
+ registry: cellRendererRegistry,
2738
+ commitValue: commitRenderedCellValue
2739
+ },
2410
2740
  expand: {
2411
2741
  enableExpand,
2412
2742
  toggleField,
@@ -2453,6 +2783,8 @@ function useGlideTable(options) {
2453
2783
  startEdit,
2454
2784
  commitEdit,
2455
2785
  cancelEdit,
2786
+ cellRendererRegistry,
2787
+ commitRenderedCellValue,
2456
2788
  enableExpand,
2457
2789
  toggleField,
2458
2790
  expandedRows,
@@ -2517,6 +2849,60 @@ function useGlideTable(options) {
2517
2849
  };
2518
2850
  }
2519
2851
 
2852
+ // src/components/ui/table/features/cell-render/ResolvedTableCell.tsx
2853
+ var import_react7 = require("react");
2854
+
2855
+ // src/components/ui/table/DataTableContext.tsx
2856
+ var import_react6 = require("react");
2857
+ var import_jsx_runtime2 = require("react/jsx-runtime");
2858
+ var DataTableContext = (0, import_react6.createContext)(null);
2859
+ function useDataTableRowContext() {
2860
+ const context = (0, import_react6.use)(DataTableContext);
2861
+ if (!context) {
2862
+ throw new Error("useDataTableRowContext must be used within a DataTableContextProvider");
2863
+ }
2864
+ return context;
2865
+ }
2866
+ function DataTableContextProvider({
2867
+ value,
2868
+ children
2869
+ }) {
2870
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(DataTableContext, { value, children });
2871
+ }
2872
+
2873
+ // src/components/ui/table/features/cell-render/ResolvedTableCell.tsx
2874
+ function ResolvedTableCell({
2875
+ info
2876
+ }) {
2877
+ const { cellRender } = useDataTableRowContext();
2878
+ const { row, column, getValue } = info;
2879
+ const meta = column.columnDef.meta;
2880
+ const value = getValue();
2881
+ const columnId = column.id;
2882
+ const update = (0, import_react7.useCallback)(
2883
+ (next) => {
2884
+ cellRender.commitValue(row.id, columnId, next);
2885
+ },
2886
+ [cellRender, columnId, row.id]
2887
+ );
2888
+ const ctx = {
2889
+ value,
2890
+ row,
2891
+ index: row.index,
2892
+ columnId,
2893
+ cellProps: meta?.cellProps,
2894
+ update
2895
+ };
2896
+ if (meta?.cellRender) {
2897
+ return meta.cellRender(ctx);
2898
+ }
2899
+ const renderer = resolveCellRenderer(cellRender.registry, meta?.kind, ctx);
2900
+ if (renderer) {
2901
+ return renderer.render(ctx);
2902
+ }
2903
+ return formatDefaultCellValue(value);
2904
+ }
2905
+
2520
2906
  // src/components/ui/table/features/column-resize/columnResize.ts
2521
2907
  function getColumnSizeStyle(size, options) {
2522
2908
  const { force = false, lockMax = false } = options ?? {};
@@ -2532,34 +2918,16 @@ function getColumnSizeStyle(size, options) {
2532
2918
 
2533
2919
  // src/components/ui/table/components/DataTable/DataTable.tsx
2534
2920
  var import_react_table3 = require("@tanstack/react-table");
2535
- var import_react8 = require("react");
2921
+ var import_react9 = require("react");
2536
2922
 
2537
2923
  // src/components/ui/table/components/DataTable/DataTableRow.tsx
2538
2924
  var import_react_table2 = require("@tanstack/react-table");
2539
- var import_react7 = require("react");
2540
-
2541
- // src/components/ui/table/DataTableContext.tsx
2542
- var import_react6 = require("react");
2543
- var import_jsx_runtime = require("react/jsx-runtime");
2544
- var DataTableContext = (0, import_react6.createContext)(null);
2545
- function useDataTableRowContext() {
2546
- const context = (0, import_react6.use)(DataTableContext);
2547
- if (!context) {
2548
- throw new Error("useDataTableRowContext must be used within a DataTableContextProvider");
2549
- }
2550
- return context;
2551
- }
2552
- function DataTableContextProvider({
2553
- value,
2554
- children
2555
- }) {
2556
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DataTableContext, { value, children });
2557
- }
2925
+ var import_react8 = require("react");
2558
2926
 
2559
2927
  // src/components/ui/table/components/icons.tsx
2560
- var import_jsx_runtime2 = require("react/jsx-runtime");
2928
+ var import_jsx_runtime3 = require("react/jsx-runtime");
2561
2929
  function ChevronDown({ className, "aria-hidden": ariaHidden = true }) {
2562
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2930
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2563
2931
  "svg",
2564
2932
  {
2565
2933
  className,
@@ -2572,12 +2940,12 @@ function ChevronDown({ className, "aria-hidden": ariaHidden = true }) {
2572
2940
  strokeWidth: "2",
2573
2941
  strokeLinecap: "round",
2574
2942
  strokeLinejoin: "round",
2575
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "m6 9 6 6 6-6" })
2943
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "m6 9 6 6 6-6" })
2576
2944
  }
2577
2945
  );
2578
2946
  }
2579
2947
  function ChevronUp({ className, "aria-hidden": ariaHidden = true }) {
2580
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2948
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2581
2949
  "svg",
2582
2950
  {
2583
2951
  className,
@@ -2590,12 +2958,12 @@ function ChevronUp({ className, "aria-hidden": ariaHidden = true }) {
2590
2958
  strokeWidth: "2",
2591
2959
  strokeLinecap: "round",
2592
2960
  strokeLinejoin: "round",
2593
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "m18 15-6-6-6 6" })
2961
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "m18 15-6-6-6 6" })
2594
2962
  }
2595
2963
  );
2596
2964
  }
2597
2965
  function ChevronLeft({ className, "aria-hidden": ariaHidden = true }) {
2598
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2966
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2599
2967
  "svg",
2600
2968
  {
2601
2969
  className,
@@ -2608,12 +2976,12 @@ function ChevronLeft({ className, "aria-hidden": ariaHidden = true }) {
2608
2976
  strokeWidth: "2",
2609
2977
  strokeLinecap: "round",
2610
2978
  strokeLinejoin: "round",
2611
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "m15 18-6-6 6-6" })
2979
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "m15 18-6-6 6-6" })
2612
2980
  }
2613
2981
  );
2614
2982
  }
2615
2983
  function ChevronRight({ className, "aria-hidden": ariaHidden = true }) {
2616
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2984
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2617
2985
  "svg",
2618
2986
  {
2619
2987
  className,
@@ -2626,12 +2994,12 @@ function ChevronRight({ className, "aria-hidden": ariaHidden = true }) {
2626
2994
  strokeWidth: "2",
2627
2995
  strokeLinecap: "round",
2628
2996
  strokeLinejoin: "round",
2629
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "m9 18 6-6-6-6" })
2997
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "m9 18 6-6-6-6" })
2630
2998
  }
2631
2999
  );
2632
3000
  }
2633
3001
  function ArrowUp({ className, "aria-hidden": ariaHidden = true }) {
2634
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
3002
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
2635
3003
  "svg",
2636
3004
  {
2637
3005
  className,
@@ -2645,14 +3013,14 @@ function ArrowUp({ className, "aria-hidden": ariaHidden = true }) {
2645
3013
  strokeLinecap: "round",
2646
3014
  strokeLinejoin: "round",
2647
3015
  children: [
2648
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "m18 15-6-6-6 6" }),
2649
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M12 21V9" })
3016
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "m18 15-6-6-6 6" }),
3017
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M12 21V9" })
2650
3018
  ]
2651
3019
  }
2652
3020
  );
2653
3021
  }
2654
3022
  function ArrowDown({ className, "aria-hidden": ariaHidden = true }) {
2655
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
3023
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
2656
3024
  "svg",
2657
3025
  {
2658
3026
  className,
@@ -2666,14 +3034,14 @@ function ArrowDown({ className, "aria-hidden": ariaHidden = true }) {
2666
3034
  strokeLinecap: "round",
2667
3035
  strokeLinejoin: "round",
2668
3036
  children: [
2669
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "m6 9 6 6 6-6" }),
2670
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M12 3v12" })
3037
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "m6 9 6 6 6-6" }),
3038
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M12 3v12" })
2671
3039
  ]
2672
3040
  }
2673
3041
  );
2674
3042
  }
2675
3043
  function ArrowUpDown({ className, "aria-hidden": ariaHidden = true }) {
2676
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
3044
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
2677
3045
  "svg",
2678
3046
  {
2679
3047
  className,
@@ -2687,10 +3055,10 @@ function ArrowUpDown({ className, "aria-hidden": ariaHidden = true }) {
2687
3055
  strokeLinecap: "round",
2688
3056
  strokeLinejoin: "round",
2689
3057
  children: [
2690
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "m21 16-4 4-4-4" }),
2691
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M17 20V4" }),
2692
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "m3 8 4-4 4 4" }),
2693
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M7 4v16" })
3058
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "m21 16-4 4-4-4" }),
3059
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M17 20V4" }),
3060
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "m3 8 4-4 4 4" }),
3061
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M7 4v16" })
2694
3062
  ]
2695
3063
  }
2696
3064
  );
@@ -2702,7 +3070,7 @@ function cn(...inputs) {
2702
3070
  }
2703
3071
 
2704
3072
  // src/components/ui/table/components/DataTable/DataTableRow.tsx
2705
- var import_jsx_runtime3 = require("react/jsx-runtime");
3073
+ var import_jsx_runtime4 = require("react/jsx-runtime");
2706
3074
  function isInteractiveMouseTarget(target) {
2707
3075
  if (!(target instanceof Element)) return false;
2708
3076
  const interactiveSelector = [
@@ -2847,14 +3215,14 @@ function DataTableRow({
2847
3215
  const expandKey = toggleField && rowData[toggleField] !== null && rowData[toggleField] !== void 0 ? String(rowData[toggleField]) : null;
2848
3216
  const isExpanded = expandKey !== null && Boolean(expandedRows?.has(expandKey));
2849
3217
  const rowLevel = typeof rowData.level === "number" ? rowData.level : 0;
2850
- const editInputRef = (0, import_react7.useRef)(null);
3218
+ const editInputRef = (0, import_react8.useRef)(null);
2851
3219
  const isRowEditing = editingCell?.rowIndex === rowIndex;
2852
- (0, import_react7.useEffect)(() => {
3220
+ (0, import_react8.useEffect)(() => {
2853
3221
  if (!isRowEditing) return;
2854
3222
  editInputRef.current?.focus();
2855
3223
  editInputRef.current?.select();
2856
3224
  }, [isRowEditing, editingCell?.colIndex]);
2857
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
3225
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2858
3226
  "tr",
2859
3227
  {
2860
3228
  ref: measureElement,
@@ -2948,7 +3316,7 @@ function DataTableRow({
2948
3316
  const searchMatchKey = buildSearchMatchKey(cellIndex, rowIndex);
2949
3317
  const isSearchMatch = enableInlineSearch && searchMatchKeys.has(searchMatchKey);
2950
3318
  const isSearchActive = isSearchMatch && activeMatch !== null && activeMatch[0] === cellIndex && activeMatch[1] === rowIndex;
2951
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
3319
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
2952
3320
  "td",
2953
3321
  {
2954
3322
  "data-row-index": rowIndex,
@@ -3022,7 +3390,7 @@ function DataTableRow({
3022
3390
  classNames?.cell
3023
3391
  ),
3024
3392
  children: [
3025
- isEditing ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
3393
+ isEditing ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3026
3394
  "input",
3027
3395
  {
3028
3396
  ...editInputProps,
@@ -3065,8 +3433,8 @@ function DataTableRow({
3065
3433
  onCommitEdit(event.currentTarget.value);
3066
3434
  }
3067
3435
  }
3068
- ) : isExpandCell && enableExpand ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: cn("expand-cell", classNames?.expandCell), children: [
3069
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
3436
+ ) : isExpandCell && enableExpand ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: cn("expand-cell", classNames?.expandCell), children: [
3437
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
3070
3438
  "div",
3071
3439
  {
3072
3440
  className: cn(
@@ -3074,7 +3442,7 @@ function DataTableRow({
3074
3442
  classNames?.expandCellContent
3075
3443
  ),
3076
3444
  children: [
3077
- rowLevel > 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
3445
+ rowLevel > 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3078
3446
  "span",
3079
3447
  {
3080
3448
  className: cn(
@@ -3084,7 +3452,7 @@ function DataTableRow({
3084
3452
  children: "\xB7"
3085
3453
  }
3086
3454
  ),
3087
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
3455
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3088
3456
  "div",
3089
3457
  {
3090
3458
  className: cn(
@@ -3097,7 +3465,7 @@ function DataTableRow({
3097
3465
  ]
3098
3466
  }
3099
3467
  ),
3100
- canExpand && expandKey && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
3468
+ canExpand && expandKey && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3101
3469
  "button",
3102
3470
  {
3103
3471
  type: "button",
@@ -3111,7 +3479,7 @@ function DataTableRow({
3111
3479
  onToggleExpand?.(expandKey);
3112
3480
  },
3113
3481
  onMouseDown: (event) => event.stopPropagation(),
3114
- children: isExpanded ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
3482
+ children: isExpanded ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3115
3483
  ChevronUp,
3116
3484
  {
3117
3485
  className: cn(
@@ -3119,7 +3487,7 @@ function DataTableRow({
3119
3487
  classNames?.expandToggleIcon
3120
3488
  )
3121
3489
  }
3122
- ) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
3490
+ ) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3123
3491
  ChevronDown,
3124
3492
  {
3125
3493
  className: cn(
@@ -3131,7 +3499,7 @@ function DataTableRow({
3131
3499
  }
3132
3500
  )
3133
3501
  ] }) : (0, import_react_table2.flexRender)(cell.column.columnDef.cell, cell.getContext()),
3134
- isBottomRightCell && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
3502
+ isBottomRightCell && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3135
3503
  "div",
3136
3504
  {
3137
3505
  role: "presentation",
@@ -3153,9 +3521,9 @@ function DataTableRow({
3153
3521
  }
3154
3522
 
3155
3523
  // src/components/ui/table/components/DataTable/DataTableSearch.tsx
3156
- var import_jsx_runtime4 = require("react/jsx-runtime");
3524
+ var import_jsx_runtime5 = require("react/jsx-runtime");
3157
3525
  function SearchCloseIcon({ className }) {
3158
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
3526
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
3159
3527
  "svg",
3160
3528
  {
3161
3529
  className,
@@ -3169,8 +3537,8 @@ function SearchCloseIcon({ className }) {
3169
3537
  strokeLinecap: "round",
3170
3538
  strokeLinejoin: "round",
3171
3539
  children: [
3172
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M18 6 6 18" }),
3173
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "m6 6 12 12" })
3540
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M18 6 6 18" }),
3541
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "m6 6 12 12" })
3174
3542
  ]
3175
3543
  }
3176
3544
  );
@@ -3216,15 +3584,15 @@ function DataTableSearch({
3216
3584
  onPrevious();
3217
3585
  }
3218
3586
  };
3219
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
3587
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
3220
3588
  "div",
3221
3589
  {
3222
3590
  className: cn("data-table-search", classNames?.search),
3223
3591
  role: "search",
3224
3592
  onMouseDown: (event) => event.stopPropagation(),
3225
3593
  children: [
3226
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "data-table-search-row", children: [
3227
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3594
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "data-table-search-row", children: [
3595
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
3228
3596
  "input",
3229
3597
  {
3230
3598
  ref: searchInputRef,
@@ -3240,7 +3608,7 @@ function DataTableSearch({
3240
3608
  onKeyDown: handleKeyDown
3241
3609
  }
3242
3610
  ),
3243
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3611
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
3244
3612
  "button",
3245
3613
  {
3246
3614
  type: "button",
@@ -3250,10 +3618,10 @@ function DataTableSearch({
3250
3618
  event.stopPropagation();
3251
3619
  onPrevious();
3252
3620
  },
3253
- children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ChevronUp, { className: "data-table-search-icon" })
3621
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ChevronUp, { className: "data-table-search-icon" })
3254
3622
  }
3255
3623
  ),
3256
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3624
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
3257
3625
  "button",
3258
3626
  {
3259
3627
  type: "button",
@@ -3263,10 +3631,10 @@ function DataTableSearch({
3263
3631
  event.stopPropagation();
3264
3632
  onNext();
3265
3633
  },
3266
- children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ChevronDown, { className: "data-table-search-icon" })
3634
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ChevronDown, { className: "data-table-search-icon" })
3267
3635
  }
3268
3636
  ),
3269
- canClose ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3637
+ canClose ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
3270
3638
  "button",
3271
3639
  {
3272
3640
  type: "button",
@@ -3276,11 +3644,11 @@ function DataTableSearch({
3276
3644
  event.stopPropagation();
3277
3645
  onClose();
3278
3646
  },
3279
- children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SearchCloseIcon, { className: "data-table-search-icon" })
3647
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SearchCloseIcon, { className: "data-table-search-icon" })
3280
3648
  }
3281
3649
  ) : null
3282
3650
  ] }),
3283
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3651
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
3284
3652
  "div",
3285
3653
  {
3286
3654
  className: cn("data-table-search-status", classNames?.searchStatus),
@@ -3288,7 +3656,7 @@ function DataTableSearch({
3288
3656
  children: resultString
3289
3657
  }
3290
3658
  ),
3291
- searchStatus !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3659
+ searchStatus !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
3292
3660
  "div",
3293
3661
  {
3294
3662
  className: cn(
@@ -3299,7 +3667,7 @@ function DataTableSearch({
3299
3667
  "aria-valuemin": 0,
3300
3668
  "aria-valuemax": 100,
3301
3669
  "aria-valuenow": progress,
3302
- children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3670
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
3303
3671
  "div",
3304
3672
  {
3305
3673
  className: "data-table-search-progress-bar",
@@ -3314,7 +3682,7 @@ function DataTableSearch({
3314
3682
  }
3315
3683
 
3316
3684
  // src/components/ui/table/components/DataTable/DataTableToolbar.tsx
3317
- var import_jsx_runtime5 = require("react/jsx-runtime");
3685
+ var import_jsx_runtime6 = require("react/jsx-runtime");
3318
3686
  function DataTableToolbar({
3319
3687
  filteredCount,
3320
3688
  totalCount,
@@ -3332,39 +3700,71 @@ function DataTableToolbar({
3332
3700
  const selectionContent = selectionLabel?.(selectedCount) ?? null;
3333
3701
  const hasSelectionContent = selectionContent !== null && selectionContent !== false && selectionContent !== void 0 && typeof selectionContent !== "boolean";
3334
3702
  if (!hasLeftContent && !hasToolbar && !hasSelectionContent) return null;
3335
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: cn("DataTableToolbarJSX", classNames?.toolbar, className), children: [
3336
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: cn("toolbar-left", classNames?.toolbarLeft), children: [
3337
- hasCount && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: cn("toolbar-count", classNames?.toolbarCount), children: displayFiltered !== void 0 && totalCount !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
3338
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "toolbar-count-primary", children: displayFiltered }),
3339
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "toolbar-count-placeholder", children: [
3703
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: cn("DataTableToolbarJSX", classNames?.toolbar, className), children: [
3704
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: cn("toolbar-left", classNames?.toolbarLeft), children: [
3705
+ hasCount && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: cn("toolbar-count", classNames?.toolbarCount), children: displayFiltered !== void 0 && totalCount !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
3706
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "toolbar-count-primary", children: displayFiltered }),
3707
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "toolbar-count-placeholder", children: [
3340
3708
  " / ",
3341
3709
  totalCount
3342
3710
  ] })
3343
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "toolbar-count-primary", children: displayFiltered ?? totalCount }) }),
3711
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "toolbar-count-primary", children: displayFiltered ?? totalCount }) }),
3344
3712
  summary
3345
3713
  ] }),
3346
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: cn("toolbar-right", classNames?.toolbarRight), children: [
3347
- hasSelectionContent && (typeof selectionContent === "string" || typeof selectionContent === "number" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: cn("toolbar-selection", classNames?.toolbarSelection), children: selectionContent }) : selectionContent),
3348
- hasToolbar && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: cn("toolbar-actions", classNames?.toolbarActions), children: toolbar })
3714
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: cn("toolbar-right", classNames?.toolbarRight), children: [
3715
+ hasSelectionContent && (typeof selectionContent === "string" || typeof selectionContent === "number" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: cn("toolbar-selection", classNames?.toolbarSelection), children: selectionContent }) : selectionContent),
3716
+ hasToolbar && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: cn("toolbar-actions", classNames?.toolbarActions), children: toolbar })
3349
3717
  ] })
3350
3718
  ] });
3351
3719
  }
3352
3720
 
3721
+ // src/components/ui/table/features/column-groups/mergeHeaderGroups.ts
3722
+ function getMergedHeaderGroups(headerGroups) {
3723
+ if (headerGroups.length <= 1) {
3724
+ return headerGroups.map((group) => ({
3725
+ ...group,
3726
+ headers: group.headers.map((header) => ({
3727
+ ...header,
3728
+ mergedRowSpan: 1
3729
+ }))
3730
+ }));
3731
+ }
3732
+ const seenColumnIds = /* @__PURE__ */ new Set();
3733
+ const fullDepth = headerGroups.length;
3734
+ return headerGroups.map((group, depth) => ({
3735
+ ...group,
3736
+ headers: group.headers.filter((header) => !seenColumnIds.has(header.column.id)).map((header) => {
3737
+ seenColumnIds.add(header.column.id);
3738
+ if (header.isPlaceholder) {
3739
+ return {
3740
+ ...header,
3741
+ isPlaceholder: false,
3742
+ mergedRowSpan: fullDepth - depth
3743
+ };
3744
+ }
3745
+ return {
3746
+ ...header,
3747
+ mergedRowSpan: 1
3748
+ };
3749
+ })
3750
+ }));
3751
+ }
3752
+
3353
3753
  // src/components/ui/table/components/DataTable/DataTable.tsx
3354
- var import_jsx_runtime6 = require("react/jsx-runtime");
3754
+ var import_jsx_runtime7 = require("react/jsx-runtime");
3355
3755
  function DefaultScroll({
3356
3756
  scrollRef,
3357
3757
  children,
3358
3758
  className
3359
3759
  }) {
3360
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { ref: scrollRef, className: cn("data-table-scroll", className), children });
3760
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { ref: scrollRef, className: cn("data-table-scroll", className), children });
3361
3761
  }
3362
3762
  function DefaultPending({
3363
3763
  loadingText,
3364
3764
  className,
3365
3765
  classNames
3366
3766
  }) {
3367
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
3767
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
3368
3768
  "div",
3369
3769
  {
3370
3770
  className: cn(
@@ -3374,7 +3774,7 @@ function DefaultPending({
3374
3774
  classNames?.pending,
3375
3775
  className
3376
3776
  ),
3377
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: cn("data-table-loading-text", classNames?.loadingText), children: loadingText })
3777
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: cn("data-table-loading-text", classNames?.loadingText), children: loadingText })
3378
3778
  }
3379
3779
  );
3380
3780
  }
@@ -3383,7 +3783,7 @@ function DefaultEmpty({
3383
3783
  columnCount,
3384
3784
  classNames
3385
3785
  }) {
3386
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
3786
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
3387
3787
  "td",
3388
3788
  {
3389
3789
  colSpan: columnCount,
@@ -3435,12 +3835,13 @@ function DataTable({
3435
3835
  const PendingSlot = slots?.Pending ?? DefaultPending;
3436
3836
  const EmptySlot = slots?.Empty ?? DefaultEmpty;
3437
3837
  const freezeOffsets = rowContextValue.columnFreeze.offsets;
3438
- const contextValue = (0, import_react8.useMemo)(
3838
+ const headerGroups = getMergedHeaderGroups(table.getHeaderGroups());
3839
+ const contextValue = (0, import_react9.useMemo)(
3439
3840
  () => ({ ...rowContextValue, classNames }),
3440
3841
  [rowContextValue, classNames]
3441
3842
  );
3442
3843
  if (isPending) {
3443
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
3844
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
3444
3845
  PendingSlot,
3445
3846
  {
3446
3847
  loadingText,
@@ -3449,7 +3850,7 @@ function DataTable({
3449
3850
  }
3450
3851
  );
3451
3852
  }
3452
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
3853
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
3453
3854
  "div",
3454
3855
  {
3455
3856
  ref: rootRef,
@@ -3463,7 +3864,7 @@ function DataTable({
3463
3864
  className
3464
3865
  ),
3465
3866
  children: [
3466
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
3867
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
3467
3868
  ToolbarSlot,
3468
3869
  {
3469
3870
  filteredCount: filteredCount ?? tableData.length,
@@ -3475,7 +3876,7 @@ function DataTable({
3475
3876
  classNames
3476
3877
  }
3477
3878
  ),
3478
- enableInlineSearch ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
3879
+ enableInlineSearch ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
3479
3880
  DataTableSearch,
3480
3881
  {
3481
3882
  showSearch: inlineSearch.showSearch,
@@ -3497,14 +3898,14 @@ function DataTable({
3497
3898
  onPrevious: inlineSearch.goToPrevious
3498
3899
  }
3499
3900
  ) : null,
3500
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ScrollSlot, { scrollRef, className: classNames?.scroll, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
3901
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ScrollSlot, { scrollRef, className: classNames?.scroll, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
3501
3902
  "table",
3502
3903
  {
3503
3904
  className: cn("data-table", classNames?.table),
3504
3905
  style: enableColumnResize ? { width: table.getTotalSize() } : void 0,
3505
3906
  onDragStart: enableCellSelection ? (event) => event.preventDefault() : void 0,
3506
3907
  children: [
3507
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("thead", { className: cn("data-table-head", classNames?.head), children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
3908
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("thead", { className: cn("data-table-head", classNames?.head), children: headerGroups.map((headerGroup) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
3508
3909
  "tr",
3509
3910
  {
3510
3911
  className: cn("data-table-head-row", classNames?.headRow),
@@ -3516,17 +3917,20 @@ function DataTable({
3516
3917
  force: enableColumnResize,
3517
3918
  lockMax: enableColumnResize
3518
3919
  });
3519
- const freezeOffset = enableColumnFreeze ? freezeOffsets.get(header.column.id) : void 0;
3920
+ const freezeOffset = enableColumnFreeze ? resolveHeaderFreezeOffset(header.column, freezeOffsets) : void 0;
3520
3921
  const freezeStyle = getColumnFreezeStyle(freezeOffset, {
3521
- isHeader: true
3922
+ isHeader: true,
3923
+ headerTop: header.depth * DATA_TABLE_HEADER_ROW_HEIGHT
3522
3924
  });
3523
3925
  const headerStyle = {
3524
3926
  ...sizeStyle,
3525
3927
  ...freezeStyle
3526
3928
  };
3527
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
3929
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
3528
3930
  "th",
3529
3931
  {
3932
+ colSpan: header.colSpan,
3933
+ rowSpan: header.mergedRowSpan,
3530
3934
  "data-resizing": header.column.getIsResizing() ? "" : void 0,
3531
3935
  "data-frozen": freezeOffset?.side,
3532
3936
  "data-freeze-edge": getColumnFreezeEdgeAttr(freezeOffset),
@@ -3539,8 +3943,11 @@ function DataTable({
3539
3943
  headerClassName
3540
3944
  ),
3541
3945
  children: [
3542
- header.isPlaceholder ? null : (0, import_react_table3.flexRender)(header.column.columnDef.header, header.getContext()),
3543
- canResize ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
3946
+ header.isPlaceholder ? null : (0, import_react_table3.flexRender)(
3947
+ header.column.columnDef.header,
3948
+ header.getContext()
3949
+ ),
3950
+ canResize ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
3544
3951
  "div",
3545
3952
  {
3546
3953
  role: "separator",
@@ -3566,20 +3973,20 @@ function DataTable({
3566
3973
  },
3567
3974
  headerGroup.id
3568
3975
  )) }),
3569
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DataTableContextProvider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
3976
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DataTableContextProvider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
3570
3977
  "tbody",
3571
3978
  {
3572
3979
  onMouseLeave: clearHover,
3573
3980
  className: cn("data-table-body", classNames?.body),
3574
- children: rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
3981
+ children: rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
3575
3982
  EmptySlot,
3576
3983
  {
3577
3984
  emptyText,
3578
3985
  columnCount,
3579
3986
  classNames
3580
3987
  }
3581
- ) : shouldVirtualize ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
3582
- paddingTop > 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
3988
+ ) : shouldVirtualize ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
3989
+ paddingTop > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
3583
3990
  "tr",
3584
3991
  {
3585
3992
  "aria-hidden": true,
@@ -3587,7 +3994,7 @@ function DataTable({
3587
3994
  "data-table-virtual-spacer",
3588
3995
  classNames?.virtualSpacer
3589
3996
  ),
3590
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
3997
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
3591
3998
  "td",
3592
3999
  {
3593
4000
  colSpan: columnCount,
@@ -3603,7 +4010,7 @@ function DataTable({
3603
4010
  virtualRows.map((virtualRow) => {
3604
4011
  const row = rows[virtualRow.index];
3605
4012
  if (!row) return null;
3606
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
4013
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
3607
4014
  RowSlot,
3608
4015
  {
3609
4016
  row,
@@ -3614,7 +4021,7 @@ function DataTable({
3614
4021
  row.id
3615
4022
  );
3616
4023
  }),
3617
- paddingBottom > 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
4024
+ paddingBottom > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
3618
4025
  "tr",
3619
4026
  {
3620
4027
  "aria-hidden": true,
@@ -3622,7 +4029,7 @@ function DataTable({
3622
4029
  "data-table-virtual-spacer",
3623
4030
  classNames?.virtualSpacer
3624
4031
  ),
3625
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
4032
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
3626
4033
  "td",
3627
4034
  {
3628
4035
  colSpan: columnCount,
@@ -3635,7 +4042,7 @@ function DataTable({
3635
4042
  )
3636
4043
  }
3637
4044
  )
3638
- ] }) : rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
4045
+ ] }) : rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
3639
4046
  RowSlot,
3640
4047
  {
3641
4048
  row,
@@ -3654,10 +4061,10 @@ function DataTable({
3654
4061
  }
3655
4062
 
3656
4063
  // src/components/ui/table/components/Table/Table.tsx
3657
- var import_react11 = require("react");
4064
+ var import_react12 = require("react");
3658
4065
 
3659
4066
  // src/components/ui/table/components/Table/buildColumnDef.tsx
3660
- var import_jsx_runtime7 = require("react/jsx-runtime");
4067
+ var import_jsx_runtime8 = require("react/jsx-runtime");
3661
4068
  function SortableHeader({
3662
4069
  label,
3663
4070
  field,
@@ -3666,15 +4073,18 @@ function SortableHeader({
3666
4073
  }) {
3667
4074
  const isActive = sort?.field === field;
3668
4075
  const Icon = isActive ? sort.direction === "asc" ? ArrowUp : ArrowDown : ArrowUpDown;
3669
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
4076
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
3670
4077
  "button",
3671
4078
  {
3672
4079
  type: "button",
3673
- className: cn("SortableHeaderJSX", isActive ? "is-active" : "is-inactive"),
4080
+ className: cn(
4081
+ "SortableHeaderJSX",
4082
+ isActive ? "is-active" : "is-inactive"
4083
+ ),
3674
4084
  onClick: () => onSort(field),
3675
4085
  children: [
3676
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: label }),
3677
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, { className: "sortable-header-icon" })
4086
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: label }),
4087
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon, { className: "sortable-header-icon" })
3678
4088
  ]
3679
4089
  }
3680
4090
  );
@@ -3696,6 +4106,8 @@ function buildColumnDef(props, sort, onSort) {
3696
4106
  editable,
3697
4107
  editType,
3698
4108
  editInputProps,
4109
+ kind,
4110
+ cellProps,
3699
4111
  className,
3700
4112
  headerClassName,
3701
4113
  render
@@ -3707,18 +4119,20 @@ function buildColumnDef(props, sort, onSort) {
3707
4119
  ...minWidth != null ? { minSize: minWidth } : {},
3708
4120
  ...maxWidth != null ? { maxSize: maxWidth } : {},
3709
4121
  ...resizable === false ? { enableResizing: false } : {},
3710
- header: sortable ? () => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SortableHeader, { label: children, field, sort, onSort }) : (
4122
+ header: sortable ? () => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
4123
+ SortableHeader,
4124
+ {
4125
+ label: children,
4126
+ field,
4127
+ sort,
4128
+ onSort
4129
+ }
4130
+ ) : (
3711
4131
  // eslint-disable-next-line @typescript-eslint/promise-function-async
3712
4132
  () => children
3713
4133
  ),
3714
- ...render ? {
3715
- // eslint-disable-next-line @typescript-eslint/promise-function-async
3716
- cell: ({ row, getValue }) => render(
3717
- getValue(),
3718
- row,
3719
- row.index
3720
- )
3721
- } : {},
4134
+ // eslint-disable-next-line @typescript-eslint/promise-function-async
4135
+ cell: (info) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ResolvedTableCell, { info }),
3722
4136
  meta: {
3723
4137
  align,
3724
4138
  rowSpan,
@@ -3726,21 +4140,63 @@ function buildColumnDef(props, sort, onSort) {
3726
4140
  editable,
3727
4141
  editType,
3728
4142
  editInputProps,
4143
+ kind,
4144
+ cellProps,
4145
+ cellRender: render,
3729
4146
  frozen,
3730
4147
  className,
3731
4148
  headerClassName
3732
4149
  }
3733
4150
  };
3734
4151
  }
4152
+ function resolveGroupId(props, index) {
4153
+ if (props.id) return props.id;
4154
+ if (typeof props.header === "string" || typeof props.header === "number") {
4155
+ return `group:${props.header}:${index}`;
4156
+ }
4157
+ return `group:${index}`;
4158
+ }
4159
+ function buildColumnDefsFromTree(nodes, sort, onSort) {
4160
+ return nodes.map((node, index) => {
4161
+ if (node.type === "leaf") {
4162
+ return buildColumnDef(node.props, sort, onSort);
4163
+ }
4164
+ const childDefs = buildColumnDefsFromTree(node.columns, sort, onSort);
4165
+ const { header, align, headerClassName } = node.props;
4166
+ return {
4167
+ id: resolveGroupId(node.props, index),
4168
+ // eslint-disable-next-line @typescript-eslint/promise-function-async
4169
+ header: () => header,
4170
+ columns: childDefs,
4171
+ enableResizing: false,
4172
+ meta: {
4173
+ align,
4174
+ headerClassName
4175
+ }
4176
+ };
4177
+ });
4178
+ }
4179
+ function countLeafColumns(nodes) {
4180
+ let count = 0;
4181
+ for (const node of nodes) {
4182
+ if (node.type === "leaf") {
4183
+ count += 1;
4184
+ } else {
4185
+ count += countLeafColumns(node.columns);
4186
+ }
4187
+ }
4188
+ return count;
4189
+ }
3735
4190
 
3736
4191
  // src/components/ui/table/components/Table/parseTableChildren.ts
3737
- var import_react10 = require("react");
4192
+ var import_react11 = require("react");
3738
4193
 
3739
4194
  // src/components/ui/table/components/Table/tableChildTypes.ts
3740
- var import_react9 = require("react");
4195
+ var import_react10 = require("react");
3741
4196
  var TABLE_HEADER_DISPLAY_NAME = "Table.Header";
3742
4197
  var TABLE_BODY_DISPLAY_NAME = "Table.Body";
3743
4198
  var TABLE_COLUMN_DISPLAY_NAME = "Table.Column";
4199
+ var TABLE_COLUMN_GROUP_DISPLAY_NAME = "Table.ColumnGroup";
3744
4200
  var TABLE_PAGINATION_DISPLAY_NAME = "Table.Pagination";
3745
4201
  function getComponentDisplayName(type) {
3746
4202
  if (typeof type === "function" || typeof type === "object" && type !== null) {
@@ -3749,16 +4205,19 @@ function getComponentDisplayName(type) {
3749
4205
  return void 0;
3750
4206
  }
3751
4207
  function isTableHeaderElement(child) {
3752
- return (0, import_react9.isValidElement)(child) && getComponentDisplayName(child.type) === TABLE_HEADER_DISPLAY_NAME;
4208
+ return (0, import_react10.isValidElement)(child) && getComponentDisplayName(child.type) === TABLE_HEADER_DISPLAY_NAME;
3753
4209
  }
3754
4210
  function isTableBodyElement(child) {
3755
- return (0, import_react9.isValidElement)(child) && getComponentDisplayName(child.type) === TABLE_BODY_DISPLAY_NAME;
4211
+ return (0, import_react10.isValidElement)(child) && getComponentDisplayName(child.type) === TABLE_BODY_DISPLAY_NAME;
3756
4212
  }
3757
4213
  function isTableColumnElement(child) {
3758
- return (0, import_react9.isValidElement)(child) && getComponentDisplayName(child.type) === TABLE_COLUMN_DISPLAY_NAME;
4214
+ return (0, import_react10.isValidElement)(child) && getComponentDisplayName(child.type) === TABLE_COLUMN_DISPLAY_NAME;
4215
+ }
4216
+ function isTableColumnGroupElement(child) {
4217
+ return (0, import_react10.isValidElement)(child) && getComponentDisplayName(child.type) === TABLE_COLUMN_GROUP_DISPLAY_NAME;
3759
4218
  }
3760
4219
  function isTablePaginationElement(child) {
3761
- return (0, import_react9.isValidElement)(child) && getComponentDisplayName(child.type) === TABLE_PAGINATION_DISPLAY_NAME;
4220
+ return (0, import_react10.isValidElement)(child) && getComponentDisplayName(child.type) === TABLE_PAGINATION_DISPLAY_NAME;
3762
4221
  }
3763
4222
 
3764
4223
  // src/components/ui/table/components/Table/parseTableChildren.ts
@@ -3768,7 +4227,7 @@ function parseTableChildren(children) {
3768
4227
  body: null,
3769
4228
  pagination: null
3770
4229
  };
3771
- for (const child of import_react10.Children.toArray(children)) {
4230
+ for (const child of import_react11.Children.toArray(children)) {
3772
4231
  if (isTableHeaderElement(child)) {
3773
4232
  slots.header = child;
3774
4233
  continue;
@@ -3783,26 +4242,38 @@ function parseTableChildren(children) {
3783
4242
  }
3784
4243
  return slots;
3785
4244
  }
3786
- function flattenColumnElements(children) {
4245
+ function walkColumnTreeNodes(children) {
3787
4246
  const result = [];
3788
- for (const child of import_react10.Children.toArray(children)) {
4247
+ for (const child of import_react11.Children.toArray(children)) {
3789
4248
  if (isTableColumnElement(child)) {
3790
- result.push(child);
4249
+ result.push({
4250
+ type: "leaf",
4251
+ props: child.props
4252
+ });
3791
4253
  continue;
3792
4254
  }
3793
- if ((0, import_react10.isValidElement)(child)) {
4255
+ if (isTableColumnGroupElement(child)) {
4256
+ const groupProps = child.props;
4257
+ result.push({
4258
+ type: "group",
4259
+ props: groupProps,
4260
+ columns: walkColumnTreeNodes(groupProps.children)
4261
+ });
4262
+ continue;
4263
+ }
4264
+ if ((0, import_react11.isValidElement)(child)) {
3794
4265
  const nested = child.props.children;
3795
4266
  if (nested != null) {
3796
- result.push(...flattenColumnElements(nested));
4267
+ result.push(...walkColumnTreeNodes(nested));
3797
4268
  }
3798
4269
  }
3799
4270
  }
3800
4271
  return result;
3801
4272
  }
3802
- function extractColumnElements(header) {
4273
+ function extractColumnTree(header) {
3803
4274
  if (!header) return [];
3804
4275
  const { children } = header.props;
3805
- return flattenColumnElements(children);
4276
+ return walkColumnTreeNodes(children);
3806
4277
  }
3807
4278
 
3808
4279
  // src/components/ui/table/components/Table/TableBody.tsx
@@ -3818,6 +4289,13 @@ function TableColumn(props) {
3818
4289
  }
3819
4290
  TableColumn.displayName = TABLE_COLUMN_DISPLAY_NAME;
3820
4291
 
4292
+ // src/components/ui/table/components/Table/TableColumnGroup.tsx
4293
+ function TableColumnGroup(props) {
4294
+ void props;
4295
+ return null;
4296
+ }
4297
+ TableColumnGroup.displayName = TABLE_COLUMN_GROUP_DISPLAY_NAME;
4298
+
3821
4299
  // src/components/ui/table/components/Table/tableDataPipeline.ts
3822
4300
  function sortTableData(data, sort) {
3823
4301
  if (!sort) return data;
@@ -3855,7 +4333,7 @@ function TableHeader(props) {
3855
4333
  TableHeader.displayName = TABLE_HEADER_DISPLAY_NAME;
3856
4334
 
3857
4335
  // src/components/ui/table/components/Table/TablePagination.tsx
3858
- var import_jsx_runtime8 = require("react/jsx-runtime");
4336
+ var import_jsx_runtime9 = require("react/jsx-runtime");
3859
4337
  function TablePagination({
3860
4338
  page,
3861
4339
  pageSize = 10,
@@ -3867,8 +4345,8 @@ function TablePagination({
3867
4345
  const safePage = Math.min(Math.max(1, page), totalPages);
3868
4346
  const canGoPrev = safePage > 1;
3869
4347
  const canGoNext = safePage < totalPages;
3870
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: cn("TablePaginationJSX", className), children: [
3871
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
4348
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: cn("TablePaginationJSX", className), children: [
4349
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3872
4350
  "button",
3873
4351
  {
3874
4352
  type: "button",
@@ -3876,15 +4354,15 @@ function TablePagination({
3876
4354
  disabled: !canGoPrev,
3877
4355
  onClick: () => onChange(safePage - 1),
3878
4356
  "aria-label": "Previous page",
3879
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ChevronLeft, { className: "pagination-button-icon" })
4357
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ChevronLeft, { className: "pagination-button-icon" })
3880
4358
  }
3881
4359
  ),
3882
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { className: "pagination-label", children: [
4360
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "pagination-label", children: [
3883
4361
  safePage,
3884
4362
  " / ",
3885
4363
  totalPages
3886
4364
  ] }),
3887
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
4365
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3888
4366
  "button",
3889
4367
  {
3890
4368
  type: "button",
@@ -3892,7 +4370,7 @@ function TablePagination({
3892
4370
  disabled: !canGoNext,
3893
4371
  onClick: () => onChange(safePage + 1),
3894
4372
  "aria-label": "Next page",
3895
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ChevronRight, { className: "pagination-button-icon" })
4373
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ChevronRight, { className: "pagination-button-icon" })
3896
4374
  }
3897
4375
  )
3898
4376
  ] });
@@ -3900,7 +4378,7 @@ function TablePagination({
3900
4378
  TablePagination.displayName = TABLE_PAGINATION_DISPLAY_NAME;
3901
4379
 
3902
4380
  // src/components/ui/table/components/Table/Table.tsx
3903
- var import_jsx_runtime9 = require("react/jsx-runtime");
4381
+ var import_jsx_runtime10 = require("react/jsx-runtime");
3904
4382
  function TableRoot({
3905
4383
  data,
3906
4384
  children,
@@ -3909,12 +4387,12 @@ function TableRoot({
3909
4387
  filteredCount,
3910
4388
  ...dataTableProps
3911
4389
  }) {
3912
- const { header, pagination: paginationElement } = (0, import_react11.useMemo)(
4390
+ const { header, pagination: paginationElement } = (0, import_react12.useMemo)(
3913
4391
  () => parseTableChildren(children),
3914
4392
  [children]
3915
4393
  );
3916
- const [sort, setSort] = (0, import_react11.useState)(null);
3917
- const handleSort = (0, import_react11.useCallback)((field) => {
4394
+ const [sort, setSort] = (0, import_react12.useState)(null);
4395
+ const handleSort = (0, import_react12.useCallback)((field) => {
3918
4396
  setSort((previous) => {
3919
4397
  if (previous?.field !== field) {
3920
4398
  return { field, direction: "asc" };
@@ -3925,25 +4403,25 @@ function TableRoot({
3925
4403
  return null;
3926
4404
  });
3927
4405
  }, []);
3928
- const columns = (0, import_react11.useMemo)(() => {
3929
- return extractColumnElements(header).map(
3930
- (columnElement) => buildColumnDef(columnElement.props, sort, handleSort)
3931
- );
3932
- }, [header, sort, handleSort]);
4406
+ const columnTree = (0, import_react12.useMemo)(() => extractColumnTree(header), [header]);
4407
+ const columns = (0, import_react12.useMemo)(
4408
+ () => buildColumnDefsFromTree(columnTree, sort, handleSort),
4409
+ [columnTree, sort, handleSort]
4410
+ );
3933
4411
  const paginationProps = paginationElement?.props;
3934
4412
  const pageSize = paginationProps?.pageSize ?? 10;
3935
4413
  const page = paginationProps?.page ?? 1;
3936
4414
  const resolvedTotalCount = paginationProps?.totalCount ?? totalCount ?? data.length;
3937
- const tableData = (0, import_react11.useMemo)(() => {
4415
+ const tableData = (0, import_react12.useMemo)(() => {
3938
4416
  const sortedData = sortTableData(data, sort);
3939
4417
  if (!paginationProps) return sortedData;
3940
4418
  return paginateTableData(sortedData, page, pageSize);
3941
4419
  }, [data, sort, paginationProps, page, pageSize]);
3942
- if (columns.length === 0) {
4420
+ if (countLeafColumns(columnTree) === 0) {
3943
4421
  console.warn("[Table] Declare at least one Table.Column inside Table.Header.");
3944
4422
  }
3945
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "TableJSX", children: [
3946
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
4423
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "TableJSX", children: [
4424
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3947
4425
  DataTable,
3948
4426
  {
3949
4427
  ...dataTableProps,
@@ -3954,7 +4432,7 @@ function TableRoot({
3954
4432
  className: cn(className, paginationProps && "DataTableJSX--with-pagination")
3955
4433
  }
3956
4434
  ),
3957
- paginationProps && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
4435
+ paginationProps && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3958
4436
  TablePagination,
3959
4437
  {
3960
4438
  page,
@@ -3972,13 +4450,19 @@ function createTable() {
3972
4450
  return null;
3973
4451
  }
3974
4452
  Column.displayName = TABLE_COLUMN_DISPLAY_NAME;
4453
+ function ColumnGroup(props) {
4454
+ void props;
4455
+ return null;
4456
+ }
4457
+ ColumnGroup.displayName = TABLE_COLUMN_GROUP_DISPLAY_NAME;
3975
4458
  return Object.assign(
3976
4459
  function BoundTable(props) {
3977
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(TableRoot, { ...props });
4460
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(TableRoot, { ...props });
3978
4461
  },
3979
4462
  {
3980
4463
  Header: TableHeader,
3981
4464
  Column,
4465
+ ColumnGroup,
3982
4466
  Body: TableBody,
3983
4467
  Pagination: TablePagination
3984
4468
  }
@@ -3987,11 +4471,13 @@ function createTable() {
3987
4471
  var Table = Object.assign(TableRoot, {
3988
4472
  Header: TableHeader,
3989
4473
  Column: TableColumn,
4474
+ ColumnGroup: TableColumnGroup,
3990
4475
  Body: TableBody,
3991
4476
  Pagination: TablePagination
3992
4477
  });
3993
4478
  // Annotate the CommonJS export names for ESM import in node:
3994
4479
  0 && (module.exports = {
4480
+ BUILTIN_CELL_RENDERERS,
3995
4481
  CELL_SELECTION_EDGES_CLASS,
3996
4482
  DEFAULT_DATA_TABLE_LABELS,
3997
4483
  DEFAULT_TREE_CHILDREN_FIELD,
@@ -4000,6 +4486,7 @@ var Table = Object.assign(TableRoot, {
4000
4486
  DEFAULT_TREE_QTY_FIELD,
4001
4487
  DataTable,
4002
4488
  INLINE_SEARCH_MAX_RESULTS,
4489
+ ResolvedTableCell,
4003
4490
  Table,
4004
4491
  applyCellEdit,
4005
4492
  applyFillData,
@@ -4019,10 +4506,14 @@ var Table = Object.assign(TableRoot, {
4019
4506
  collectFillChanges,
4020
4507
  collectRowSpanColumns,
4021
4508
  collectSearchMatchesInRange,
4509
+ commitCellValue,
4510
+ createCellRendererRegistry,
4022
4511
  createSearchRegex,
4023
4512
  createTable,
4024
4513
  escapeSearchRegex,
4025
4514
  flattenSubtreeRows,
4515
+ formatCellValue,
4516
+ formatDefaultCellValue,
4026
4517
  formatSearchResultLabel,
4027
4518
  getCellEditDraftValue,
4028
4519
  getCellSelectionEdgeStyle,
@@ -4044,8 +4535,10 @@ var Table = Object.assign(TableRoot, {
4044
4535
  parseClipboardTSV,
4045
4536
  parseClipboardTSVWithDepths,
4046
4537
  previousSearchIndex,
4538
+ resolveCellRenderer,
4047
4539
  resolveColumnFreezeSide,
4048
4540
  resolveDataTableLabels,
4541
+ resolveHeaderFreezeOffset,
4049
4542
  resolvePasteColumnIds,
4050
4543
  resolveRowSelection,
4051
4544
  resolveRowSpanAt,