twico-ui 1.34.0 → 1.36.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/index.mjs CHANGED
@@ -8869,11 +8869,12 @@ function combineCfg(combine) {
8869
8869
  if (!fields.length) return null;
8870
8870
  return { fields, separator: cfg.separator != null ? cfg.separator : " \xB7 ", labels: !!cfg.labels, layout: cfg.layout === "stack" ? "stack" : "inline" };
8871
8871
  }
8872
+ var colLabel = (c) => typeof c.headerName === "string" ? c.headerName : String(c.field ?? "");
8872
8873
  var combineSrcCols = (cfg, byField) => cfg.fields.map((f) => byField && byField[f] || { field: f, headerName: String(f) });
8873
8874
  var combineValueGetter = (srcCols, cfg) => (row) => srcCols.map((sc) => {
8874
8875
  const v = getColVal(sc, row);
8875
8876
  const s = v == null ? "" : String(v);
8876
- return cfg.labels && s ? `${sc.headerName ?? sc.field}: ${s}` : s;
8877
+ return cfg.labels && s ? `${colLabel(sc)}: ${s}` : s;
8877
8878
  }).filter(Boolean).join(cfg.separator);
8878
8879
  function renderCombined(srcCols, row, cfg) {
8879
8880
  const nodes = [];
@@ -8882,7 +8883,7 @@ function renderCombined(srcCols, row, cfg) {
8882
8883
  const v = getColVal(sc, row);
8883
8884
  if (v == null || v === "") return;
8884
8885
  const disp = sc.valueFormatter ? sc.valueFormatter(v, row) : v;
8885
- const label = cfg.labels ? React51__default.createElement("span", { className: "twc-dt__combine-label" }, (sc.headerName ?? sc.field) + ": ") : null;
8886
+ const label = cfg.labels ? React51__default.createElement("span", { className: "twc-dt__combine-label" }, colLabel(sc) + ": ") : null;
8886
8887
  if (count > 0 && cfg.layout !== "stack") nodes.push(React51__default.createElement("span", { key: "sep" + idx, className: "twc-dt__combine-sep", "aria-hidden": "true" }, cfg.separator));
8887
8888
  nodes.push(React51__default.createElement("span", { key: idx, className: "twc-dt__combine-item" }, label, disp));
8888
8889
  count++;
@@ -9132,7 +9133,7 @@ function EditCell({ col, value, options, onChange, onCommit, onCommitValue, onCa
9132
9133
  className: "twc-dt__editor",
9133
9134
  type: col.type === "number" ? "number" : "text",
9134
9135
  value: value ?? "",
9135
- "aria-label": `Edit ${col.headerName}`,
9136
+ "aria-label": `Edit ${colLabel(col)}`,
9136
9137
  onChange: (e) => onChange(e.target.value),
9137
9138
  onKeyDown,
9138
9139
  onBlur: onCommit
@@ -9326,6 +9327,13 @@ function Datatable({
9326
9327
  renderRowDetail,
9327
9328
  expandedRowIds,
9328
9329
  onExpandedRowsChange,
9330
+ // #359: server-mode lazy row-tree — `getRowCanExpand(row)` draws the same leading chevron on parent DATA
9331
+ // rows (independent of renderRowDetail); expanding reveals CHILD data rows in the SAME columns rather than a
9332
+ // panel. In server mode the host returns children inline (the expanded set is folded into onServerChange);
9333
+ // in client mode `getSubRows(row)` supplies them. `getRowDepth(row)` indents nested rows so they read as a tree.
9334
+ getRowCanExpand,
9335
+ getRowDepth,
9336
+ getSubRows,
9329
9337
  className = "",
9330
9338
  ...rest
9331
9339
  }) {
@@ -9538,6 +9546,7 @@ function Datatable({
9538
9546
  () => new Set(expandControlled ? expandedRowIds : internalExpanded),
9539
9547
  [expandControlled, expandedRowIds, internalExpanded]
9540
9548
  );
9549
+ const expandedKey = React51__default.useMemo(() => JSON.stringify([...expandedSet].sort()), [expandedSet]);
9541
9550
  const [pinnedRows, setPinnedRows] = React51__default.useState({ top: [], bottom: [] });
9542
9551
  const [headH, setHeadH] = React51__default.useState(41);
9543
9552
  const theadRef = React51__default.useRef(null);
@@ -9775,7 +9784,7 @@ function Datatable({
9775
9784
  }, [rowGroupingKey]);
9776
9785
  const AUTO_CHROME = 74;
9777
9786
  const autoWidth = (c) => {
9778
- const label = typeof c.headerName === "string" ? c.headerName : String(c.field ?? "");
9787
+ const label = colLabel(c);
9779
9788
  return AUTO_CHROME + Math.ceil(label.length * 8);
9780
9789
  };
9781
9790
  const clampWidth = (w, c) => {
@@ -9899,6 +9908,7 @@ function Datatable({
9899
9908
  };
9900
9909
  }, [exportOpen]);
9901
9910
  const colByField = React51__default.useMemo(() => Object.fromEntries(cols.map((c) => [c.field, c])), [cols]);
9911
+ const fieldLabel = (f) => colLabel(colByField[f] || { field: f });
9902
9912
  const combineSources = React51__default.useMemo(() => {
9903
9913
  const s = /* @__PURE__ */ new Set();
9904
9914
  for (const cfg of Object.values(userCombine)) (cfg && cfg.fields ? cfg.fields : []).slice(1).forEach((f) => s.add(f));
@@ -9940,7 +9950,10 @@ function Datatable({
9940
9950
  const NUM_W = 56;
9941
9951
  const CHK_W = checkboxSelection ? rowReorder ? 68 : 44 : 0;
9942
9952
  const hasRowDetail = typeof renderRowDetail === "function";
9943
- const EXP_W = hasRowDetail ? 44 : 0;
9953
+ const hasRowTree = typeof getRowCanExpand === "function";
9954
+ const hasExpandCol = hasRowDetail || hasRowTree;
9955
+ const treeExpandedKey = hasRowTree ? expandedKey : "";
9956
+ const EXP_W = hasExpandCol ? 44 : 0;
9944
9957
  const numLeft = EXP_W + CHK_W;
9945
9958
  const leadW = numLeft + (showRowNum ? NUM_W : 0);
9946
9959
  const visLeft = React51__default.useMemo(() => pins.left.filter((f) => colByField[f] && !effectiveHidden.has(f)), [pins.left, colByField, effectiveHidden]);
@@ -10013,6 +10026,40 @@ function Datatable({
10013
10026
  React51__default.useEffect(() => {
10014
10027
  if (pageVal > totalPages - 1) commitPage(0);
10015
10028
  }, [totalPages]);
10029
+ const treeRows = React51__default.useMemo(() => {
10030
+ if (serverMode || typeof getSubRows !== "function") return null;
10031
+ const out = [];
10032
+ const seen2 = /* @__PURE__ */ new Set();
10033
+ const walk = (r2, d) => {
10034
+ const key = keyOf(r2);
10035
+ if (seen2.has(key)) return;
10036
+ seen2.add(key);
10037
+ out.push({ row: r2, depth: d });
10038
+ if (expandedSet.has(key)) for (const c of getSubRows(r2) || []) walk(c, d + 1);
10039
+ };
10040
+ for (const r2 of paged) walk(r2, 0);
10041
+ return out;
10042
+ }, [serverMode, getSubRows, paged, expandedSet, keyOf]);
10043
+ const depthByKey = React51__default.useMemo(() => {
10044
+ const m = /* @__PURE__ */ new Map();
10045
+ if (treeRows) for (const t of treeRows) m.set(keyOf(t.row), t.depth);
10046
+ return m;
10047
+ }, [treeRows, keyOf]);
10048
+ const treeSeqByKey = React51__default.useMemo(() => {
10049
+ if (!treeRows) return null;
10050
+ const m = /* @__PURE__ */ new Map();
10051
+ const seen2 = /* @__PURE__ */ new Set();
10052
+ let n = 0;
10053
+ const walk = (r2) => {
10054
+ const key = keyOf(r2);
10055
+ if (seen2.has(key)) return;
10056
+ seen2.add(key);
10057
+ m.set(key, n++);
10058
+ if (expandedSet.has(key)) for (const c of getSubRows(r2) || []) walk(c);
10059
+ };
10060
+ for (const r2 of processed) walk(r2);
10061
+ return m;
10062
+ }, [treeRows, processed, expandedSet, getSubRows, keyOf]);
10016
10063
  const activeGroupBy = React51__default.useMemo(() => groupBy.filter((f) => colByField[f]), [groupBy, colByField]);
10017
10064
  function subtotalText(rowsIn) {
10018
10065
  const parts = [];
@@ -10022,7 +10069,7 @@ function Datatable({
10022
10069
  const v = computeAgg({ ...c, aggregation: agg }, rowsIn);
10023
10070
  if (v == null) continue;
10024
10071
  const disp = c.aggregationFormatter ? c.aggregationFormatter(v) : c.valueFormatter ? c.valueFormatter(v, null) : typeof v === "number" ? v.toLocaleString() : v;
10025
- parts.push(`${c.headerName} ${disp}`);
10072
+ parts.push(`${colLabel(c)} ${disp}`);
10026
10073
  }
10027
10074
  return parts;
10028
10075
  }
@@ -10063,7 +10110,7 @@ function Datatable({
10063
10110
  };
10064
10111
  return build(paged, 0, "");
10065
10112
  }, [activeGroupBy, collapsed, paged, ordered, aggOn]);
10066
- const leafRows = displayItems ? displayItems.filter((i) => i.kind === "leaf").map((i) => i.row) : paged;
10113
+ const leafRows = displayItems ? displayItems.filter((i) => i.kind === "leaf").map((i) => i.row) : treeRows ? treeRows.map((t) => t.row) : paged;
10067
10114
  function toggleGroup(key) {
10068
10115
  setCollapsed((s) => {
10069
10116
  const n = new Set(s);
@@ -10315,12 +10362,14 @@ function Datatable({
10315
10362
  // #303: "and" (default) | "or" — the server groups its WHERE accordingly
10316
10363
  quickFilter: quick.trim(),
10317
10364
  visibleColumns,
10318
- hiddenColumns
10365
+ hiddenColumns,
10319
10366
  // #191: server can project only the visible columns
10367
+ ...hasRowTree ? { expanded: [...expandedSet] } : null
10368
+ // #359: only a row-tree folds expanded parents in
10320
10369
  });
10321
10370
  }, 250);
10322
10371
  return () => clearTimeout(t);
10323
- }, [serverMode, pageVal, sizeVal, sort, filters, filterLogic, quick, visibleColumns, hiddenColumns]);
10372
+ }, [serverMode, pageVal, sizeVal, sort, filters, filterLogic, quick, visibleColumns, hiddenColumns, treeExpandedKey]);
10324
10373
  const onColVisRef = React51__default.useRef(onColumnVisibilityChange);
10325
10374
  onColVisRef.current = onColumnVisibilityChange;
10326
10375
  const lastVisibleKey = React51__default.useRef(null);
@@ -10373,7 +10422,7 @@ function Datatable({
10373
10422
  next.splice(dir > 0 ? b + 1 : b, 0, field);
10374
10423
  return next;
10375
10424
  });
10376
- const label = colByField[field]?.headerName || field;
10425
+ const label = fieldLabel(field);
10377
10426
  setReorderMsg(`Moved ${label} ${dir < 0 ? "left" : "right"}.`);
10378
10427
  }
10379
10428
  function optionsForField(field) {
@@ -10480,7 +10529,7 @@ function Datatable({
10480
10529
  const rowXml = (cells, r2) => `<row r="${r2}">${cells.map((v, ci) => cell(`${colLetter(ci)}${r2}`, v)).join("")}</row>`;
10481
10530
  const lastCell = `${expCols.length ? colLetter(expCols.length - 1) : "A"}${source.length + 1}`;
10482
10531
  const sheet = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
10483
- <worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><dimension ref="A1:${lastCell}"/><sheetViews><sheetView tabSelected="1" workbookViewId="0"/></sheetViews><sheetData>` + rowXml(expCols.map((c) => c.headerName), 1) + source.map((row, ri) => rowXml(expCols.map((c) => cellValue(c, row)), ri + 2)).join("") + "</sheetData></worksheet>";
10532
+ <worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><dimension ref="A1:${lastCell}"/><sheetViews><sheetView tabSelected="1" workbookViewId="0"/></sheetViews><sheetData>` + rowXml(expCols.map((c) => colLabel(c)), 1) + source.map((row, ri) => rowXml(expCols.map((c) => cellValue(c, row)), ri + 2)).join("") + "</sheetData></worksheet>";
10484
10533
  download(xlsxPackage(sheet), "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "xlsx");
10485
10534
  return;
10486
10535
  }
@@ -10488,7 +10537,7 @@ function Datatable({
10488
10537
  const s = defang(v, v == null ? "" : String(v));
10489
10538
  return /[",\n]/.test(s) ? `"${s.replace(/"/g, '""')}"` : s;
10490
10539
  };
10491
- const header = expCols.map((c) => escape(c.headerName)).join(",");
10540
+ const header = expCols.map((c) => escape(colLabel(c))).join(",");
10492
10541
  const lines = source.map((row) => expCols.map((c) => escape(cellValue(c, row))).join(","));
10493
10542
  const text = "\uFEFF" + [header, ...lines].join("\r\n");
10494
10543
  download(text, "text/csv;charset=utf-8;", "csv");
@@ -10694,12 +10743,12 @@ function Datatable({
10694
10743
  next = next === "" ? null : Number(next);
10695
10744
  if (Number.isNaN(next)) next = null;
10696
10745
  }
10697
- const row = paged.find((r2, i) => keyOf(r2, i) === editing.key);
10746
+ const row = leafRows.find((r2, i) => keyOf(r2, i) === editing.key);
10698
10747
  setEditing(null);
10699
10748
  if (!row || row[editing.field] === next) return;
10700
10749
  const updated = { ...row, [editing.field]: next };
10701
10750
  onRowUpdate?.(updated, row, editing.field);
10702
- if (onRowsChange) {
10751
+ if (onRowsChange && rows.some((r2, i) => keyOf(r2, i) === editing.key)) {
10703
10752
  onRowsChange(rows.map((r2, i) => keyOf(r2, i) === editing.key ? updated : r2));
10704
10753
  }
10705
10754
  }
@@ -10828,20 +10877,25 @@ function Datatable({
10828
10877
  };
10829
10878
  const writeCellPatches = (patchByKey) => {
10830
10879
  if (!patchByKey.size) return 0;
10831
- const changed = [];
10832
- const nextAll = rows.map((r2, i) => {
10833
- const k = keyOf(r2, i);
10834
- const patch = patchByKey.get(k);
10835
- if (!patch) return r2;
10880
+ let count = 0;
10881
+ leafRows.forEach((r2, i) => {
10882
+ const patch = patchByKey.get(keyOf(r2, i));
10883
+ if (!patch) return;
10836
10884
  const updated = { ...r2, ...patch };
10837
- changed.push([updated, r2, patch]);
10838
- return updated;
10885
+ for (const f of Object.keys(patch)) onRowUpdate?.(updated, r2, f);
10886
+ count++;
10839
10887
  });
10840
- changed.forEach(([updated, orig, patch]) => {
10841
- for (const f of Object.keys(patch)) onRowUpdate?.(updated, orig, f);
10842
- });
10843
- if (onRowsChange && changed.length) onRowsChange(nextAll);
10844
- return changed.length;
10888
+ if (onRowsChange) {
10889
+ let anyTop = false;
10890
+ const nextAll = rows.map((r2, i) => {
10891
+ const patch = patchByKey.get(keyOf(r2, i));
10892
+ if (!patch) return r2;
10893
+ anyTop = true;
10894
+ return { ...r2, ...patch };
10895
+ });
10896
+ if (anyTop) onRowsChange(nextAll);
10897
+ }
10898
+ return count;
10845
10899
  };
10846
10900
  const rectCells = () => {
10847
10901
  if (!cellRect) return null;
@@ -11020,7 +11074,7 @@ function Datatable({
11020
11074
  const widest = (labels) => labels.reduce((m, l) => Math.max(m, ctx.measureText(String(l)).width), 0);
11021
11075
  const logicW = Math.min(180, Math.max(84, Math.ceil(widest(["And", "Or"]) + chrome)));
11022
11076
  const colCap = Math.max(118, Math.min(210, el.clientWidth - logicW - 118 - 30 - 30 - 140 - 5 * 6 - 2 * 4));
11023
- const colW = Math.min(colCap, Math.max(118, Math.ceil(widest(filterableCols.map((c) => c.headerName ?? c.field)) + chrome)));
11077
+ const colW = Math.min(colCap, Math.max(118, Math.ceil(widest(filterableCols.map((c) => colLabel(c))) + chrome)));
11024
11078
  const opW = Math.min(170, Math.max(118, Math.ceil(widest(ALL_OP_LABELS) + chrome)));
11025
11079
  if (Number.isFinite(logicW)) el.style.setProperty("--twc-dt-flogic-fit", `${logicW}px`);
11026
11080
  if (Number.isFinite(colW)) el.style.setProperty("--twc-dt-fcol-fit", `${colW}px`);
@@ -11383,12 +11437,12 @@ function Datatable({
11383
11437
  const i = order.indexOf(f);
11384
11438
  return i === -1 ? 9999 : i;
11385
11439
  };
11386
- const shownColRows = cols.filter((c) => c.field !== "__pinactions__" && c.headerName.toLowerCase().includes(colQuery.trim().toLowerCase())).sort((a, b) => orderIdxOf(a.field) - orderIdxOf(b.field));
11440
+ const shownColRows = cols.filter((c) => c.field !== "__pinactions__" && colLabel(c).toLowerCase().includes(colQuery.trim().toLowerCase())).sort((a, b) => orderIdxOf(a.field) - orderIdxOf(b.field));
11387
11441
  const rowNumMatch = rowNumbers && "row number".includes(colQuery.trim().toLowerCase());
11388
11442
  const manageableCols = cols.filter((c) => c.field !== "__pinactions__");
11389
11443
  const visibleColCount = manageableCols.filter((c) => !effectiveHidden.has(c.field)).length;
11390
11444
  const rppOptions = Array.from(new Set([...pageSizeOptions || [], pageSize].filter((n) => n > 0))).sort((a, b) => a - b).map((n) => ({ value: String(n), label: String(n) }));
11391
- const totalCols = ordered.length + (checkboxSelection ? 1 : 0) + (showRowNum ? 1 : 0) + (hasRowDetail ? 1 : 0);
11445
+ const totalCols = ordered.length + (checkboxSelection ? 1 : 0) + (showRowNum ? 1 : 0) + (hasExpandCol ? 1 : 0);
11392
11446
  function renderGroupRow(item) {
11393
11447
  const subs = aggOn ? subtotalText(item.rows) : [];
11394
11448
  return /* @__PURE__ */ jsx("tr", { className: "twc-dt__group-row", role: "row", children: /* @__PURE__ */ jsxs("td", { className: "twc-dt__group-cell", role: "gridcell", colSpan: totalCols, style: { maxWidth: "none" }, children: [
@@ -11403,7 +11457,7 @@ function Datatable({
11403
11457
  children: [
11404
11458
  /* @__PURE__ */ jsx("span", { className: "twc-dt__group-chev", "data-open": !item.collapsed || void 0, children: /* @__PURE__ */ jsx(Svg, { d: I.chevDown }) }),
11405
11459
  /* @__PURE__ */ jsxs("span", { className: "twc-dt__group-name", children: [
11406
- colByField[item.field]?.headerName || item.field,
11460
+ fieldLabel(item.field),
11407
11461
  ":"
11408
11462
  ] }),
11409
11463
  /* @__PURE__ */ jsx("span", { className: "twc-dt__group-val", children: String(item.value) }),
@@ -11443,8 +11497,10 @@ function Datatable({
11443
11497
  const k = keyOf(row, ri);
11444
11498
  const sel = selected.has(k);
11445
11499
  const detail = hasRowDetail && !pinSide ? renderRowDetail(row) : null;
11446
- const expandable = detail != null;
11500
+ const canTreeExpand = hasRowTree && !pinSide && !!getRowCanExpand(row);
11501
+ const expandable = detail != null || canTreeExpand;
11447
11502
  const open = expandable && expandedSet.has(k);
11503
+ const depth = getRowDepth ? getRowDepth(row) || 0 : depthByKey.get(k) || 0;
11448
11504
  const rowActive = selectionMode === "row" && activeRowVal === k;
11449
11505
  const stickyStyle = pinSide === "top" ? { position: "sticky", top: headH, zIndex: 5 } : pinSide === "bottom" ? { position: "sticky", bottom: 0, zIndex: 5 } : void 0;
11450
11506
  const h = rowHeights[k];
@@ -11458,7 +11514,7 @@ function Datatable({
11458
11514
  {
11459
11515
  className: "twc-dt__row",
11460
11516
  role: "row",
11461
- "aria-rowindex": (paginated && !serverMode ? pageVal * sizeVal : 0) + ri + 2,
11517
+ "aria-rowindex": treeSeqByKey ? treeSeqByKey.get(k) + 2 : (paginated && !serverMode ? pageVal * sizeVal : 0) + ri + 2,
11462
11518
  "aria-selected": (checkboxSelection ? sel : rowActive) || void 0,
11463
11519
  "data-op": row.__diffop || void 0,
11464
11520
  "data-selected": sel || void 0,
@@ -11492,7 +11548,7 @@ function Datatable({
11492
11548
  onDragEnd: reorderable ? () => setRowDrag({ from: null, over: null, after: false }) : void 0,
11493
11549
  onClick: (e) => handleRowClick(e, k, row),
11494
11550
  children: [
11495
- hasRowDetail ? /* @__PURE__ */ jsx("td", { className: "twc-dt__td twc-dt__expand-cell", role: "gridcell", "data-pin": "left", "data-pin-edge": checkboxSelection || showRowNum || visLeft.length ? void 0 : "left", style: { insetInlineStart: 0, width: EXP_W }, children: expandable ? /* @__PURE__ */ jsx("button", { type: "button", className: "twc-dt__expand-btn", "aria-expanded": open, "aria-controls": open ? `${gridId}-detail-${ri}` : void 0, "aria-label": open ? "Collapse row" : "Expand row", onClick: (e) => {
11551
+ hasExpandCol ? /* @__PURE__ */ jsx("td", { className: "twc-dt__td twc-dt__expand-cell", role: "gridcell", "data-pin": "left", "data-pin-edge": checkboxSelection || showRowNum || visLeft.length ? void 0 : "left", style: { insetInlineStart: 0, width: EXP_W }, children: expandable ? /* @__PURE__ */ jsx("button", { type: "button", className: "twc-dt__expand-btn", "aria-expanded": open, "aria-controls": open && detail != null ? `${gridId}-detail-${ri}` : void 0, "aria-label": open ? "Collapse row" : "Expand row", onClick: (e) => {
11496
11552
  e.stopPropagation();
11497
11553
  toggleRowDetail(k);
11498
11554
  }, children: /* @__PURE__ */ jsx("span", { className: "twc-dt__expand-chev", "data-open": open || void 0, children: /* @__PURE__ */ jsx(Svg, { d: I.chevDown }) }) }) : null }) : null,
@@ -11521,7 +11577,7 @@ function Datatable({
11521
11577
  ] }),
11522
11578
  rowResize && !pinSide ? /* @__PURE__ */ jsx("span", { className: "twc-dt__row-resizer", title: "Drag to resize row", onPointerDown: (e) => startRowResize(e, k, e.currentTarget.closest("tr")), onClick: (e) => e.stopPropagation() }) : null
11523
11579
  ] }) : null,
11524
- showRowNum ? /* @__PURE__ */ jsx("td", { className: "twc-dt__td twc-dt__rownum", role: "gridcell", "aria-hidden": "true", "data-pin": "left", "data-pin-edge": visLeft.length ? void 0 : "left", style: { insetInlineStart: numLeft, width: NUM_W }, children: typeof ri === "number" ? (paginated || serverMode ? pageVal * sizeVal : 0) + ri + 1 : "" }) : null,
11580
+ showRowNum ? /* @__PURE__ */ jsx("td", { className: "twc-dt__td twc-dt__rownum", role: "gridcell", "aria-hidden": "true", "data-pin": "left", "data-pin-edge": visLeft.length ? void 0 : "left", style: { insetInlineStart: numLeft, width: NUM_W }, children: treeSeqByKey ? treeSeqByKey.get(k) + 1 : typeof ri === "number" ? (paginated || serverMode ? pageVal * sizeVal : 0) + ri + 1 : "" }) : null,
11525
11581
  ordered.map((c, ci) => {
11526
11582
  const st = stickyOf(c.field);
11527
11583
  const val = getColVal(c, row);
@@ -11544,7 +11600,7 @@ function Datatable({
11544
11600
  role: "gridcell",
11545
11601
  "data-r": ri,
11546
11602
  "data-c": ci,
11547
- "aria-colindex": ci + 1 + (checkboxSelection ? 1 : 0) + (hasRowDetail ? 1 : 0),
11603
+ "aria-colindex": ci + 1 + (checkboxSelection ? 1 : 0) + (hasExpandCol ? 1 : 0),
11548
11604
  tabIndex: focus.r === ri && focus.c === ci ? 0 : -1,
11549
11605
  "aria-selected": cellSelected || void 0,
11550
11606
  "data-num": c.type === "number" || void 0,
@@ -11557,7 +11613,7 @@ function Datatable({
11557
11613
  "data-wrap": effectiveWrapped.has(c.field) || void 0,
11558
11614
  "data-pin": st.pin,
11559
11615
  "data-pin-edge": st.edge,
11560
- style: { width: widthOf(c), ...cellSty, ...st.style, ...st.pin ? { position: "sticky", zIndex: 2 } : null },
11616
+ style: { width: widthOf(c), ...cellSty, ...st.style, ...st.pin ? { position: "sticky", zIndex: 2 } : null, ...ci === 0 && depth ? { paddingInlineStart: `calc(12px + ${depth * 20}px)` } : null },
11561
11617
  "data-ovtext": cellTitle,
11562
11618
  onClick: selectionMode === "cell" ? (e) => handleCellClick(e, k, row, c) : void 0,
11563
11619
  onFocus: () => setFocus((f) => f.r === ri && f.c === ci ? f : { r: ri, c: ci }),
@@ -11609,7 +11665,7 @@ function Datatable({
11609
11665
  ]
11610
11666
  }
11611
11667
  ),
11612
- open ? /* @__PURE__ */ jsx("tr", { className: "twc-dt__detail-row", role: "row", children: /* @__PURE__ */ jsx("td", { id: `${gridId}-detail-${ri}`, className: "twc-dt__detail-cell", role: "gridcell", colSpan: totalCols, style: { maxWidth: "none" }, children: detail }) }) : null
11668
+ open && detail != null ? /* @__PURE__ */ jsx("tr", { className: "twc-dt__detail-row", role: "row", children: /* @__PURE__ */ jsx("td", { id: `${gridId}-detail-${ri}`, className: "twc-dt__detail-cell", role: "gridcell", colSpan: totalCols, style: { maxWidth: "none" }, children: detail }) }) : null
11613
11669
  ] }, (pinSide ? "p-" : "") + k);
11614
11670
  }
11615
11671
  function renderPivot() {
@@ -11623,8 +11679,8 @@ function Datatable({
11623
11679
  const f = v.valueFormatter || col?.valueFormatter;
11624
11680
  return f ? f(val, null) : typeof val === "number" ? val.toLocaleString() : val;
11625
11681
  };
11626
- const vlabel = (v) => v.label || (colByField[v.field]?.headerName || v.field);
11627
- const rowFieldLabel = rFields.map((f) => colByField[f]?.headerName || f).join(" / ");
11682
+ const vlabel = (v) => v.label || fieldLabel(v.field);
11683
+ const rowFieldLabel = rFields.map((f) => fieldLabel(f)).join(" / ");
11628
11684
  const leafPaths = [];
11629
11685
  const seen2 = /* @__PURE__ */ new Set();
11630
11686
  for (const r2 of rows) {
@@ -11919,8 +11975,8 @@ function Datatable({
11919
11975
  /* @__PURE__ */ jsx(Svg, { d: I.group }),
11920
11976
  /* @__PURE__ */ jsx("span", { className: "twc-dt__groupbar-label", children: "Grouped by" }),
11921
11977
  activeGroupBy.map((f) => /* @__PURE__ */ jsxs("span", { className: "twc-dt__groupchip", children: [
11922
- colByField[f]?.headerName || f,
11923
- /* @__PURE__ */ jsx("button", { type: "button", className: "twc-dt__groupchip-x", "aria-label": `Stop grouping by ${colByField[f]?.headerName || f}`, onClick: () => toggleGroupField(f), children: /* @__PURE__ */ jsx(Svg, { d: I.x }) })
11978
+ fieldLabel(f),
11979
+ /* @__PURE__ */ jsx("button", { type: "button", className: "twc-dt__groupchip-x", "aria-label": `Stop grouping by ${fieldLabel(f)}`, onClick: () => toggleGroupField(f), children: /* @__PURE__ */ jsx(Svg, { d: I.x }) })
11924
11980
  ] }, f)),
11925
11981
  /* @__PURE__ */ jsx("button", { type: "button", className: "twc-dt__groupbar-clear", onClick: () => setGroupBy([]), children: "Clear all" })
11926
11982
  ] }) : null,
@@ -11946,15 +12002,15 @@ function Datatable({
11946
12002
  ref: gridRef,
11947
12003
  role: "grid",
11948
12004
  "aria-label": ariaLabelAttr || ariaLabel,
11949
- "aria-rowcount": totalRows + 1,
11950
- "aria-colcount": ordered.length + (checkboxSelection ? 1 : 0) + (hasRowDetail ? 1 : 0),
12005
+ "aria-rowcount": (treeSeqByKey ? treeSeqByKey.size : totalRows) + 1,
12006
+ "aria-colcount": ordered.length + (checkboxSelection ? 1 : 0) + (hasExpandCol ? 1 : 0),
11951
12007
  "aria-multiselectable": selectionMode === "cell" || void 0,
11952
12008
  "aria-activedescendant": activeCellId,
11953
12009
  "aria-busy": loading || void 0,
11954
12010
  onKeyDown: onGridKeyDown,
11955
12011
  children: [
11956
12012
  /* @__PURE__ */ jsx("thead", { ref: theadRef, children: /* @__PURE__ */ jsxs("tr", { role: "row", "aria-rowindex": 1, children: [
11957
- hasRowDetail ? /* @__PURE__ */ jsx("th", { className: "twc-dt__th twc-dt__expand-cell", role: "columnheader", "aria-label": "Expand", "data-pin": "left", "data-pin-edge": checkboxSelection || showRowNum || visLeft.length ? void 0 : "left", style: { insetInlineStart: 0, width: EXP_W, minWidth: EXP_W } }) : null,
12013
+ hasExpandCol ? /* @__PURE__ */ jsx("th", { className: "twc-dt__th twc-dt__expand-cell", role: "columnheader", "aria-label": "Expand", "data-pin": "left", "data-pin-edge": checkboxSelection || showRowNum || visLeft.length ? void 0 : "left", style: { insetInlineStart: 0, width: EXP_W, minWidth: EXP_W } }) : null,
11958
12014
  checkboxSelection ? /* @__PURE__ */ jsx("th", { className: "twc-dt__th", role: "columnheader", "aria-label": "Select", "data-pin": "left", "data-pin-edge": visLeft.length || showRowNum ? void 0 : "left", style: { insetInlineStart: EXP_W, width: CHK_W, minWidth: CHK_W }, children: /* @__PURE__ */ jsx("div", { className: "twc-dt__th-inner", style: { justifyContent: "center", padding: 0 }, children: /* @__PURE__ */ jsx(
11959
12015
  "span",
11960
12016
  {
@@ -12042,8 +12098,8 @@ function Datatable({
12042
12098
  className: "twc-dt__th-label",
12043
12099
  role: c.sortable ? "button" : void 0,
12044
12100
  tabIndex: c.sortable ? 0 : void 0,
12045
- "data-ovtext": typeof c.headerName === "string" ? c.headerName : void 0,
12046
- "aria-label": c.sortable ? `${c.headerName}, sort` : void 0,
12101
+ "data-ovtext": !c.renderHeader && typeof c.headerName === "string" ? c.headerName : void 0,
12102
+ "aria-label": c.sortable ? `${colLabel(c)}, sort` : void 0,
12047
12103
  draggable: reorderable || void 0,
12048
12104
  onDragStart: reorderable ? (e) => {
12049
12105
  setDrag({ from: c.field, over: null, after: false });
@@ -12061,7 +12117,7 @@ function Datatable({
12061
12117
  children: [
12062
12118
  reorderable ? /* @__PURE__ */ jsx("span", { className: "twc-dt__grip", "aria-hidden": "true", children: /* @__PURE__ */ jsx(Svg, { d: I.grip }) }) : null,
12063
12119
  filteredFields.has(c.field) ? /* @__PURE__ */ jsx("span", { className: "twc-dt__filterdot" }) : null,
12064
- c.headerName,
12120
+ c.renderHeader ? c.renderHeader({ column: c }) : c.headerName,
12065
12121
  c.sortable ? /* @__PURE__ */ jsx("span", { className: "twc-dt__sort", children: /* @__PURE__ */ jsx(Svg, { d: I.arrow }) }) : null
12066
12122
  ]
12067
12123
  }
@@ -12097,7 +12153,7 @@ function Datatable({
12097
12153
  "data-active": resizing || void 0,
12098
12154
  role: "separator",
12099
12155
  "aria-orientation": "vertical",
12100
- "aria-label": `Resize ${c.headerName} column (double-click to fit content)`,
12156
+ "aria-label": `Resize ${colLabel(c)} column (double-click to fit content)`,
12101
12157
  "aria-valuenow": w,
12102
12158
  "aria-valuemin": 72,
12103
12159
  tabIndex: 0,
@@ -12131,7 +12187,7 @@ function Datatable({
12131
12187
  })
12132
12188
  ] }) }),
12133
12189
  /* @__PURE__ */ jsx("tbody", { children: loading ? Array.from({ length: paginated ? Math.min(sizeVal, 8) : 8 }).map((_, ri) => /* @__PURE__ */ jsxs("tr", { className: "twc-dt__row", role: "row", children: [
12134
- hasRowDetail ? /* @__PURE__ */ jsx("td", { className: "twc-dt__td twc-dt__expand-cell", role: "gridcell", "data-pin": "left", style: { insetInlineStart: 0, width: EXP_W } }) : null,
12190
+ hasExpandCol ? /* @__PURE__ */ jsx("td", { className: "twc-dt__td twc-dt__expand-cell", role: "gridcell", "data-pin": "left", style: { insetInlineStart: 0, width: EXP_W } }) : null,
12135
12191
  checkboxSelection ? /* @__PURE__ */ jsx("td", { className: "twc-dt__td", role: "gridcell", "data-pin": "left", style: { insetInlineStart: EXP_W, width: CHK_W }, children: /* @__PURE__ */ jsx("span", { className: "twc-dt__sk", "aria-hidden": "true", style: { "--_w": "18px", height: 18, borderRadius: 4 } }) }) : null,
12136
12192
  showRowNum ? /* @__PURE__ */ jsx("td", { className: "twc-dt__td twc-dt__rownum", role: "gridcell", "aria-hidden": "true", "data-pin": "left", style: { insetInlineStart: numLeft, width: NUM_W }, children: /* @__PURE__ */ jsx("span", { className: "twc-dt__sk", "aria-hidden": "true", style: { "--_w": "16px", height: 14, borderRadius: 4 } }) }) : null,
12137
12193
  ordered.map((c, ci) => {
@@ -12154,7 +12210,7 @@ function Datatable({
12154
12210
  pinnedBottomRows.map((row) => renderLeaf(row, keyIndex.get(keyOf(row)), "bottom"))
12155
12211
  ] }) }),
12156
12212
  hasAggregation && aggOn && !loading && paged.length > 0 ? /* @__PURE__ */ jsx("tfoot", { children: /* @__PURE__ */ jsxs("tr", { role: "row", children: [
12157
- hasRowDetail ? /* @__PURE__ */ jsx("td", { role: "gridcell", "data-pin": "left", "data-pin-edge": checkboxSelection || showRowNum || visLeft.length ? void 0 : "left", style: { insetInlineStart: 0, width: EXP_W } }) : null,
12213
+ hasExpandCol ? /* @__PURE__ */ jsx("td", { role: "gridcell", "data-pin": "left", "data-pin-edge": checkboxSelection || showRowNum || visLeft.length ? void 0 : "left", style: { insetInlineStart: 0, width: EXP_W } }) : null,
12158
12214
  checkboxSelection ? /* @__PURE__ */ jsx("td", { role: "gridcell", "data-pin": "left", "data-pin-edge": visLeft.length || showRowNum ? void 0 : "left", style: { insetInlineStart: EXP_W, width: CHK_W } }) : null,
12159
12215
  showRowNum ? /* @__PURE__ */ jsx("td", { className: "twc-dt__rownum", role: "gridcell", "aria-hidden": "true", "data-pin": "left", "data-pin-edge": visLeft.length ? void 0 : "left", style: { insetInlineStart: numLeft, width: NUM_W } }) : null,
12160
12216
  ordered.map((c) => {
@@ -12272,15 +12328,15 @@ function Datatable({
12272
12328
  placeholder: "Add a column\u2026",
12273
12329
  value: "",
12274
12330
  "aria-label": "Add a column to edit",
12275
- options: unpicked.map((c) => ({ value: c.field, label: String(c.headerName ?? c.field) })),
12331
+ options: unpicked.map((c) => ({ value: c.field, label: colLabel(c) })),
12276
12332
  onChange: addField
12277
12333
  }
12278
12334
  ) }) : null,
12279
12335
  /* @__PURE__ */ jsx("div", { className: "twc-dt__cfg-list", children: pickedCols.length === 0 ? /* @__PURE__ */ jsx("div", { className: "twc-dt__be-empty", children: "Pick a column to set its value on all selected rows." }) : pickedCols.map((c, i) => {
12280
12336
  const opts = c.valueOptions ? c.valueOptions.map((o) => typeof o === "string" ? { value: o, label: o } : o) : null;
12281
12337
  return /* @__PURE__ */ jsxs("div", { className: "twc-dt__be-row", children: [
12282
- /* @__PURE__ */ jsxs("span", { className: "twc-dt__be-name", title: String(c.headerName ?? c.field), children: [
12283
- /* @__PURE__ */ jsx("span", { className: "twc-dt__be-name-txt", children: c.headerName }),
12338
+ /* @__PURE__ */ jsxs("span", { className: "twc-dt__be-name", title: colLabel(c), children: [
12339
+ /* @__PURE__ */ jsx("span", { className: "twc-dt__be-name-txt", children: colLabel(c) }),
12284
12340
  resizableFilters && i === 0 ? /* @__PURE__ */ jsx(
12285
12341
  "span",
12286
12342
  {
@@ -12320,7 +12376,7 @@ function Datatable({
12320
12376
  onChange: (e) => setBatchEdit((b) => ({ ...b, values: { ...b.values, [c.field]: e.target.value } }))
12321
12377
  }
12322
12378
  ) }),
12323
- /* @__PURE__ */ jsx("button", { type: "button", className: "twc-dt__be-x", "aria-label": `Remove ${String(c.headerName ?? c.field)}`, onClick: () => removeField(c.field), children: /* @__PURE__ */ jsx(Svg, { d: I.x }) })
12379
+ /* @__PURE__ */ jsx("button", { type: "button", className: "twc-dt__be-x", "aria-label": `Remove ${colLabel(c)}`, onClick: () => removeField(c.field), children: /* @__PURE__ */ jsx(Svg, { d: I.x }) })
12324
12380
  ] }, c.field);
12325
12381
  }) }),
12326
12382
  /* @__PURE__ */ jsxs("div", { className: "twc-dt__cfg-foot", children: [
@@ -12592,7 +12648,7 @@ function Datatable({
12592
12648
  children: [
12593
12649
  canDrag ? /* @__PURE__ */ jsx("span", { className: "twc-dt__col-grip", "aria-hidden": "true", children: /* @__PURE__ */ jsx(Svg, { d: I.grip }) }) : null,
12594
12650
  /* @__PURE__ */ jsxs("span", { className: "twc-dt__col-name", children: [
12595
- c.headerName,
12651
+ colLabel(c),
12596
12652
  combineSources.has(c.field) ? /* @__PURE__ */ jsx("span", { className: "twc-dt__col-combined", children: " \xB7 combined" }) : null
12597
12653
  ] }),
12598
12654
  c.pinnable && c.type !== "actions" ? (
@@ -12605,7 +12661,7 @@ function Datatable({
12605
12661
  className: "twc-dt__col-pin",
12606
12662
  "data-on": pins.left.includes(c.field) || void 0,
12607
12663
  "aria-pressed": pins.left.includes(c.field),
12608
- "aria-label": `Pin ${c.headerName} to left`,
12664
+ "aria-label": `Pin ${colLabel(c)} to left`,
12609
12665
  title: pins.left.includes(c.field) ? "Unpin" : "Pin to left",
12610
12666
  onClick: () => setPin(c.field, pins.left.includes(c.field) ? null : "left"),
12611
12667
  children: /* @__PURE__ */ jsx(Svg, { d: I.pinL })
@@ -12618,7 +12674,7 @@ function Datatable({
12618
12674
  className: "twc-dt__col-pin",
12619
12675
  "data-on": pins.right.includes(c.field) || void 0,
12620
12676
  "aria-pressed": pins.right.includes(c.field),
12621
- "aria-label": `Pin ${c.headerName} to right`,
12677
+ "aria-label": `Pin ${colLabel(c)} to right`,
12622
12678
  title: pins.right.includes(c.field) ? "Unpin" : "Pin to right",
12623
12679
  onClick: () => setPin(c.field, pins.right.includes(c.field) ? null : "right"),
12624
12680
  children: /* @__PURE__ */ jsx(Svg, { d: I.pin })
@@ -12633,7 +12689,7 @@ function Datatable({
12633
12689
  "data-on": !effectiveHidden.has(c.field) || void 0,
12634
12690
  role: "switch",
12635
12691
  "aria-checked": !effectiveHidden.has(c.field),
12636
- "aria-label": c.headerName,
12692
+ "aria-label": colLabel(c),
12637
12693
  "aria-disabled": !c.hideable || combineSources.has(c.field) || void 0,
12638
12694
  tabIndex: c.hideable && !combineSources.has(c.field) ? 0 : -1,
12639
12695
  onKeyDown: (e) => {
@@ -12657,17 +12713,17 @@ function Datatable({
12657
12713
  const target = colByField[combineTarget];
12658
12714
  const candidates = cols.filter((c) => c.field !== combineTarget && c.type !== "actions" && c.field !== "__pinactions__" && c.hideable !== false && !userCombine[c.field]);
12659
12715
  const toggle = (f) => setCombineDraft((d) => ({ ...d, selected: d.selected.includes(f) ? d.selected.filter((x) => x !== f) : [...d.selected, f] }));
12660
- return /* @__PURE__ */ jsxs("div", { ref: combinePanelRef, tabIndex: -1, className: "twc-dt__pop twc-dt__cols", style: { top: panelPos.top, left: panelPos.left, ...popStyle("combine") }, "data-pop-sized": popSizes.combine ? "" : void 0, role: "dialog", "aria-label": `Combine columns into ${target?.headerName || combineTarget}`, children: [
12716
+ return /* @__PURE__ */ jsxs("div", { ref: combinePanelRef, tabIndex: -1, className: "twc-dt__pop twc-dt__cols", style: { top: panelPos.top, left: panelPos.left, ...popStyle("combine") }, "data-pop-sized": popSizes.combine ? "" : void 0, role: "dialog", "aria-label": `Combine columns into ${target ? colLabel(target) : combineTarget}`, children: [
12661
12717
  /* @__PURE__ */ jsx("div", { className: "twc-dt__panel-head", children: /* @__PURE__ */ jsxs("span", { className: "twc-dt__panel-title", children: [
12662
12718
  "Combine into \u201C",
12663
- target?.headerName || combineTarget,
12719
+ target ? colLabel(target) : combineTarget,
12664
12720
  "\u201D"
12665
12721
  ] }) }),
12666
12722
  /* @__PURE__ */ jsx("div", { className: "twc-dt__combine-hint", children: "Pick columns to merge into this one \u2014 their data shows in this cell and their own columns hide." }),
12667
12723
  /* @__PURE__ */ jsx("div", { className: "twc-dt__col-list", children: candidates.length === 0 ? /* @__PURE__ */ jsx("div", { className: "twc-dt__empty", style: { padding: "18px 12px" }, children: "No other columns" }) : candidates.map((c) => {
12668
12724
  const on = combineDraft.selected.includes(c.field);
12669
12725
  return /* @__PURE__ */ jsxs("div", { className: "twc-dt__col-row", onClick: () => toggle(c.field), children: [
12670
- /* @__PURE__ */ jsx("span", { className: "twc-dt__col-name", children: c.headerName }),
12726
+ /* @__PURE__ */ jsx("span", { className: "twc-dt__col-name", children: colLabel(c) }),
12671
12727
  /* @__PURE__ */ jsx(
12672
12728
  "span",
12673
12729
  {
@@ -12675,7 +12731,7 @@ function Datatable({
12675
12731
  "data-on": on || void 0,
12676
12732
  role: "switch",
12677
12733
  "aria-checked": on,
12678
- "aria-label": c.headerName,
12734
+ "aria-label": colLabel(c),
12679
12735
  tabIndex: 0,
12680
12736
  onKeyDown: (e) => {
12681
12737
  if (e.key === "Enter" || e.key === " ") {
@@ -12758,7 +12814,7 @@ function Datatable({
12758
12814
  const numeric = c.type === "number";
12759
12815
  const opts = numeric ? [{ value: "", label: "None" }, { value: "sum", label: "Sum" }, { value: "avg", label: "Avg" }, { value: "min", label: "Min" }, { value: "max", label: "Max" }, { value: "count", label: "Count" }] : [{ value: "", label: "None" }, { value: "count", label: "Count" }];
12760
12816
  return /* @__PURE__ */ jsxs("div", { className: "twc-dt__cfg-row", children: [
12761
- /* @__PURE__ */ jsx("span", { className: "twc-dt__cfg-name", children: c.headerName }),
12817
+ /* @__PURE__ */ jsx("span", { className: "twc-dt__cfg-name", children: colLabel(c) }),
12762
12818
  /* @__PURE__ */ jsx("div", { className: "twc-dt__cfg-ctl", children: /* @__PURE__ */ jsx(
12763
12819
  Select,
12764
12820
  {
@@ -12782,9 +12838,9 @@ function Datatable({
12782
12838
  popGrip("agg")
12783
12839
  ] }) : null,
12784
12840
  panel === "pivot" && panelPos ? (() => {
12785
- const fieldOpts = ordered.filter((c) => c.type !== "actions").map((c) => ({ value: c.field, label: c.headerName }));
12841
+ const fieldOpts = ordered.filter((c) => c.type !== "actions").map((c) => ({ value: c.field, label: colLabel(c) }));
12786
12842
  const aggOpts = [{ value: "sum", label: "Sum" }, { value: "avg", label: "Avg" }, { value: "min", label: "Min" }, { value: "max", label: "Max" }, { value: "count", label: "Count" }];
12787
- const valueFieldOpts = ordered.filter((c) => c.type !== "actions" && !pivotConfig.values.some((v) => v.field === c.field)).map((c) => ({ value: c.field, label: c.headerName }));
12843
+ const valueFieldOpts = ordered.filter((c) => c.type !== "actions" && !pivotConfig.values.some((v) => v.field === c.field)).map((c) => ({ value: c.field, label: colLabel(c) }));
12788
12844
  return /* @__PURE__ */ jsxs("div", { className: "twc-dt__pop twc-dt__cfg", style: { top: panelPos.top, left: panelPos.left, width: 320, ...popStyle("pivot") }, "data-pop-sized": popSizes.pivot ? "" : void 0, role: "dialog", "aria-label": "Pivot settings", children: [
12789
12845
  /* @__PURE__ */ jsxs("div", { className: "twc-dt__panel-head", children: [
12790
12846
  /* @__PURE__ */ jsx("span", { className: "twc-dt__panel-title", children: "Pivot" }),
@@ -12853,7 +12909,7 @@ function Datatable({
12853
12909
  /* @__PURE__ */ jsxs("div", { className: "twc-dt__cfg-section", children: [
12854
12910
  /* @__PURE__ */ jsx("span", { className: "twc-dt__cfg-label", children: "Values" }),
12855
12911
  pivotConfig.values.map((v, i) => /* @__PURE__ */ jsxs("div", { className: "twc-dt__cfg-row", children: [
12856
- /* @__PURE__ */ jsx("span", { className: "twc-dt__cfg-name", children: colByField[v.field]?.headerName || v.field }),
12912
+ /* @__PURE__ */ jsx("span", { className: "twc-dt__cfg-name", children: fieldLabel(v.field) }),
12857
12913
  /* @__PURE__ */ jsx("div", { className: "twc-dt__cfg-ctl", children: /* @__PURE__ */ jsx(
12858
12914
  Select,
12859
12915
  {
@@ -12869,7 +12925,7 @@ function Datatable({
12869
12925
  {
12870
12926
  type: "button",
12871
12927
  className: "twc-dt__cfg-x",
12872
- "aria-label": `Remove ${colByField[v.field]?.headerName || v.field}`,
12928
+ "aria-label": `Remove ${fieldLabel(v.field)}`,
12873
12929
  onClick: () => setPivotConfig((p) => ({ ...p, values: p.values.filter((_, j) => j !== i) })),
12874
12930
  children: /* @__PURE__ */ jsx(Svg, { d: I.x })
12875
12931
  }
@@ -12951,7 +13007,7 @@ function Datatable({
12951
13007
  size: "sm",
12952
13008
  portal: true,
12953
13009
  value: f.field,
12954
- options: filterableCols.map((c) => ({ value: c.field, label: c.headerName })),
13010
+ options: filterableCols.map((c) => ({ value: c.field, label: colLabel(c) })),
12955
13011
  onChange: (v) => {
12956
13012
  const nc = colByField[v];
12957
13013
  setFilters((arr) => arr.map((x) => x.id === f.id ? { ...x, field: v, op: opsFor(filterTypeOf(nc))[0].value, value: "" } : x));
@@ -13008,7 +13064,7 @@ function Datatable({
13008
13064
  ),
13009
13065
  fieldHandle("val", i)
13010
13066
  ] }),
13011
- /* @__PURE__ */ jsx("button", { type: "button", className: "twc-dt__frm-x", "aria-label": `Add another condition on ${col.headerName}`, title: "Add another condition on this column", onClick: () => addFilter(f.field), children: /* @__PURE__ */ jsx(Svg, { d: I.plus }) }),
13067
+ /* @__PURE__ */ jsx("button", { type: "button", className: "twc-dt__frm-x", "aria-label": `Add another condition on ${colLabel(col)}`, title: "Add another condition on this column", onClick: () => addFilter(f.field), children: /* @__PURE__ */ jsx(Svg, { d: I.plus }) }),
13012
13068
  /* @__PURE__ */ jsx("button", { type: "button", className: "twc-dt__frm-x", "aria-label": "Remove filter", onClick: () => setFilters((arr) => arr.filter((x) => x.id !== f.id)), children: /* @__PURE__ */ jsx(Svg, { d: I.x }) })
13013
13069
  ] }, f.id);
13014
13070
  }) }),