twico-ui 1.35.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/CHANGELOG.md +7 -0
- package/dist/index.cjs +40 -38
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.mjs +40 -38
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to Twico UI are documented here (newest first). This file is generated automatically on each release by [semantic-release](https://semantic-release.gitbook.io/) from [Conventional Commits](https://www.conventionalcommits.org/) — do not edit it by hand. The same notes appear on each [GitHub Release](https://github.com/EncryptionL/twico-ui/releases).
|
|
4
4
|
|
|
5
|
+
# [1.36.0](https://github.com/EncryptionL/twico-ui/compare/v1.35.0...v1.36.0) (2026-09-09)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **datatable:** custom column header via renderHeader ([#367](https://github.com/EncryptionL/twico-ui/issues/367)) ([647ab35](https://github.com/EncryptionL/twico-ui/commit/647ab35d171170b215d2945c5aa624e02230f144))
|
|
11
|
+
|
|
5
12
|
# [1.35.0](https://github.com/EncryptionL/twico-ui/compare/v1.34.0...v1.35.0) (2026-08-28)
|
|
6
13
|
|
|
7
14
|
|
package/dist/index.cjs
CHANGED
|
@@ -8890,11 +8890,12 @@ function combineCfg(combine) {
|
|
|
8890
8890
|
if (!fields.length) return null;
|
|
8891
8891
|
return { fields, separator: cfg.separator != null ? cfg.separator : " \xB7 ", labels: !!cfg.labels, layout: cfg.layout === "stack" ? "stack" : "inline" };
|
|
8892
8892
|
}
|
|
8893
|
+
var colLabel = (c) => typeof c.headerName === "string" ? c.headerName : String(c.field ?? "");
|
|
8893
8894
|
var combineSrcCols = (cfg, byField) => cfg.fields.map((f) => byField && byField[f] || { field: f, headerName: String(f) });
|
|
8894
8895
|
var combineValueGetter = (srcCols, cfg) => (row) => srcCols.map((sc) => {
|
|
8895
8896
|
const v = getColVal(sc, row);
|
|
8896
8897
|
const s = v == null ? "" : String(v);
|
|
8897
|
-
return cfg.labels && s ? `${sc
|
|
8898
|
+
return cfg.labels && s ? `${colLabel(sc)}: ${s}` : s;
|
|
8898
8899
|
}).filter(Boolean).join(cfg.separator);
|
|
8899
8900
|
function renderCombined(srcCols, row, cfg) {
|
|
8900
8901
|
const nodes = [];
|
|
@@ -8903,7 +8904,7 @@ function renderCombined(srcCols, row, cfg) {
|
|
|
8903
8904
|
const v = getColVal(sc, row);
|
|
8904
8905
|
if (v == null || v === "") return;
|
|
8905
8906
|
const disp = sc.valueFormatter ? sc.valueFormatter(v, row) : v;
|
|
8906
|
-
const label = cfg.labels ? React51__namespace.default.createElement("span", { className: "twc-dt__combine-label" }, (sc
|
|
8907
|
+
const label = cfg.labels ? React51__namespace.default.createElement("span", { className: "twc-dt__combine-label" }, colLabel(sc) + ": ") : null;
|
|
8907
8908
|
if (count > 0 && cfg.layout !== "stack") nodes.push(React51__namespace.default.createElement("span", { key: "sep" + idx, className: "twc-dt__combine-sep", "aria-hidden": "true" }, cfg.separator));
|
|
8908
8909
|
nodes.push(React51__namespace.default.createElement("span", { key: idx, className: "twc-dt__combine-item" }, label, disp));
|
|
8909
8910
|
count++;
|
|
@@ -9153,7 +9154,7 @@ function EditCell({ col, value, options, onChange, onCommit, onCommitValue, onCa
|
|
|
9153
9154
|
className: "twc-dt__editor",
|
|
9154
9155
|
type: col.type === "number" ? "number" : "text",
|
|
9155
9156
|
value: value ?? "",
|
|
9156
|
-
"aria-label": `Edit ${col
|
|
9157
|
+
"aria-label": `Edit ${colLabel(col)}`,
|
|
9157
9158
|
onChange: (e) => onChange(e.target.value),
|
|
9158
9159
|
onKeyDown,
|
|
9159
9160
|
onBlur: onCommit
|
|
@@ -9804,7 +9805,7 @@ function Datatable({
|
|
|
9804
9805
|
}, [rowGroupingKey]);
|
|
9805
9806
|
const AUTO_CHROME = 74;
|
|
9806
9807
|
const autoWidth = (c) => {
|
|
9807
|
-
const label =
|
|
9808
|
+
const label = colLabel(c);
|
|
9808
9809
|
return AUTO_CHROME + Math.ceil(label.length * 8);
|
|
9809
9810
|
};
|
|
9810
9811
|
const clampWidth = (w, c) => {
|
|
@@ -9928,6 +9929,7 @@ function Datatable({
|
|
|
9928
9929
|
};
|
|
9929
9930
|
}, [exportOpen]);
|
|
9930
9931
|
const colByField = React51__namespace.default.useMemo(() => Object.fromEntries(cols.map((c) => [c.field, c])), [cols]);
|
|
9932
|
+
const fieldLabel = (f) => colLabel(colByField[f] || { field: f });
|
|
9931
9933
|
const combineSources = React51__namespace.default.useMemo(() => {
|
|
9932
9934
|
const s = /* @__PURE__ */ new Set();
|
|
9933
9935
|
for (const cfg of Object.values(userCombine)) (cfg && cfg.fields ? cfg.fields : []).slice(1).forEach((f) => s.add(f));
|
|
@@ -10088,7 +10090,7 @@ function Datatable({
|
|
|
10088
10090
|
const v = computeAgg({ ...c, aggregation: agg }, rowsIn);
|
|
10089
10091
|
if (v == null) continue;
|
|
10090
10092
|
const disp = c.aggregationFormatter ? c.aggregationFormatter(v) : c.valueFormatter ? c.valueFormatter(v, null) : typeof v === "number" ? v.toLocaleString() : v;
|
|
10091
|
-
parts.push(`${c
|
|
10093
|
+
parts.push(`${colLabel(c)} ${disp}`);
|
|
10092
10094
|
}
|
|
10093
10095
|
return parts;
|
|
10094
10096
|
}
|
|
@@ -10441,7 +10443,7 @@ function Datatable({
|
|
|
10441
10443
|
next.splice(dir > 0 ? b + 1 : b, 0, field);
|
|
10442
10444
|
return next;
|
|
10443
10445
|
});
|
|
10444
|
-
const label =
|
|
10446
|
+
const label = fieldLabel(field);
|
|
10445
10447
|
setReorderMsg(`Moved ${label} ${dir < 0 ? "left" : "right"}.`);
|
|
10446
10448
|
}
|
|
10447
10449
|
function optionsForField(field) {
|
|
@@ -10548,7 +10550,7 @@ function Datatable({
|
|
|
10548
10550
|
const rowXml = (cells, r2) => `<row r="${r2}">${cells.map((v, ci) => cell(`${colLetter(ci)}${r2}`, v)).join("")}</row>`;
|
|
10549
10551
|
const lastCell = `${expCols.length ? colLetter(expCols.length - 1) : "A"}${source.length + 1}`;
|
|
10550
10552
|
const sheet = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
10551
|
-
<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
|
|
10553
|
+
<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>";
|
|
10552
10554
|
download(xlsxPackage(sheet), "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "xlsx");
|
|
10553
10555
|
return;
|
|
10554
10556
|
}
|
|
@@ -10556,7 +10558,7 @@ function Datatable({
|
|
|
10556
10558
|
const s = defang(v, v == null ? "" : String(v));
|
|
10557
10559
|
return /[",\n]/.test(s) ? `"${s.replace(/"/g, '""')}"` : s;
|
|
10558
10560
|
};
|
|
10559
|
-
const header = expCols.map((c) => escape(c
|
|
10561
|
+
const header = expCols.map((c) => escape(colLabel(c))).join(",");
|
|
10560
10562
|
const lines = source.map((row) => expCols.map((c) => escape(cellValue(c, row))).join(","));
|
|
10561
10563
|
const text = "\uFEFF" + [header, ...lines].join("\r\n");
|
|
10562
10564
|
download(text, "text/csv;charset=utf-8;", "csv");
|
|
@@ -11093,7 +11095,7 @@ function Datatable({
|
|
|
11093
11095
|
const widest = (labels) => labels.reduce((m, l) => Math.max(m, ctx.measureText(String(l)).width), 0);
|
|
11094
11096
|
const logicW = Math.min(180, Math.max(84, Math.ceil(widest(["And", "Or"]) + chrome)));
|
|
11095
11097
|
const colCap = Math.max(118, Math.min(210, el.clientWidth - logicW - 118 - 30 - 30 - 140 - 5 * 6 - 2 * 4));
|
|
11096
|
-
const colW = Math.min(colCap, Math.max(118, Math.ceil(widest(filterableCols.map((c) => c
|
|
11098
|
+
const colW = Math.min(colCap, Math.max(118, Math.ceil(widest(filterableCols.map((c) => colLabel(c))) + chrome)));
|
|
11097
11099
|
const opW = Math.min(170, Math.max(118, Math.ceil(widest(ALL_OP_LABELS) + chrome)));
|
|
11098
11100
|
if (Number.isFinite(logicW)) el.style.setProperty("--twc-dt-flogic-fit", `${logicW}px`);
|
|
11099
11101
|
if (Number.isFinite(colW)) el.style.setProperty("--twc-dt-fcol-fit", `${colW}px`);
|
|
@@ -11456,7 +11458,7 @@ function Datatable({
|
|
|
11456
11458
|
const i = order.indexOf(f);
|
|
11457
11459
|
return i === -1 ? 9999 : i;
|
|
11458
11460
|
};
|
|
11459
|
-
const shownColRows = cols.filter((c) => c.field !== "__pinactions__" && c.
|
|
11461
|
+
const shownColRows = cols.filter((c) => c.field !== "__pinactions__" && colLabel(c).toLowerCase().includes(colQuery.trim().toLowerCase())).sort((a, b) => orderIdxOf(a.field) - orderIdxOf(b.field));
|
|
11460
11462
|
const rowNumMatch = rowNumbers && "row number".includes(colQuery.trim().toLowerCase());
|
|
11461
11463
|
const manageableCols = cols.filter((c) => c.field !== "__pinactions__");
|
|
11462
11464
|
const visibleColCount = manageableCols.filter((c) => !effectiveHidden.has(c.field)).length;
|
|
@@ -11476,7 +11478,7 @@ function Datatable({
|
|
|
11476
11478
|
children: [
|
|
11477
11479
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "twc-dt__group-chev", "data-open": !item.collapsed || void 0, children: /* @__PURE__ */ jsxRuntime.jsx(Svg, { d: I.chevDown }) }),
|
|
11478
11480
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "twc-dt__group-name", children: [
|
|
11479
|
-
|
|
11481
|
+
fieldLabel(item.field),
|
|
11480
11482
|
":"
|
|
11481
11483
|
] }),
|
|
11482
11484
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "twc-dt__group-val", children: String(item.value) }),
|
|
@@ -11698,8 +11700,8 @@ function Datatable({
|
|
|
11698
11700
|
const f = v.valueFormatter || col?.valueFormatter;
|
|
11699
11701
|
return f ? f(val, null) : typeof val === "number" ? val.toLocaleString() : val;
|
|
11700
11702
|
};
|
|
11701
|
-
const vlabel = (v) => v.label || (
|
|
11702
|
-
const rowFieldLabel = rFields.map((f) =>
|
|
11703
|
+
const vlabel = (v) => v.label || fieldLabel(v.field);
|
|
11704
|
+
const rowFieldLabel = rFields.map((f) => fieldLabel(f)).join(" / ");
|
|
11703
11705
|
const leafPaths = [];
|
|
11704
11706
|
const seen2 = /* @__PURE__ */ new Set();
|
|
11705
11707
|
for (const r2 of rows) {
|
|
@@ -11994,8 +11996,8 @@ function Datatable({
|
|
|
11994
11996
|
/* @__PURE__ */ jsxRuntime.jsx(Svg, { d: I.group }),
|
|
11995
11997
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "twc-dt__groupbar-label", children: "Grouped by" }),
|
|
11996
11998
|
activeGroupBy.map((f) => /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "twc-dt__groupchip", children: [
|
|
11997
|
-
|
|
11998
|
-
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "twc-dt__groupchip-x", "aria-label": `Stop grouping by ${
|
|
11999
|
+
fieldLabel(f),
|
|
12000
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "twc-dt__groupchip-x", "aria-label": `Stop grouping by ${fieldLabel(f)}`, onClick: () => toggleGroupField(f), children: /* @__PURE__ */ jsxRuntime.jsx(Svg, { d: I.x }) })
|
|
11999
12001
|
] }, f)),
|
|
12000
12002
|
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "twc-dt__groupbar-clear", onClick: () => setGroupBy([]), children: "Clear all" })
|
|
12001
12003
|
] }) : null,
|
|
@@ -12117,8 +12119,8 @@ function Datatable({
|
|
|
12117
12119
|
className: "twc-dt__th-label",
|
|
12118
12120
|
role: c.sortable ? "button" : void 0,
|
|
12119
12121
|
tabIndex: c.sortable ? 0 : void 0,
|
|
12120
|
-
"data-ovtext": typeof c.headerName === "string" ? c.headerName : void 0,
|
|
12121
|
-
"aria-label": c.sortable ? `${c
|
|
12122
|
+
"data-ovtext": !c.renderHeader && typeof c.headerName === "string" ? c.headerName : void 0,
|
|
12123
|
+
"aria-label": c.sortable ? `${colLabel(c)}, sort` : void 0,
|
|
12122
12124
|
draggable: reorderable || void 0,
|
|
12123
12125
|
onDragStart: reorderable ? (e) => {
|
|
12124
12126
|
setDrag({ from: c.field, over: null, after: false });
|
|
@@ -12136,7 +12138,7 @@ function Datatable({
|
|
|
12136
12138
|
children: [
|
|
12137
12139
|
reorderable ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "twc-dt__grip", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(Svg, { d: I.grip }) }) : null,
|
|
12138
12140
|
filteredFields.has(c.field) ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "twc-dt__filterdot" }) : null,
|
|
12139
|
-
c.headerName,
|
|
12141
|
+
c.renderHeader ? c.renderHeader({ column: c }) : c.headerName,
|
|
12140
12142
|
c.sortable ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "twc-dt__sort", children: /* @__PURE__ */ jsxRuntime.jsx(Svg, { d: I.arrow }) }) : null
|
|
12141
12143
|
]
|
|
12142
12144
|
}
|
|
@@ -12172,7 +12174,7 @@ function Datatable({
|
|
|
12172
12174
|
"data-active": resizing || void 0,
|
|
12173
12175
|
role: "separator",
|
|
12174
12176
|
"aria-orientation": "vertical",
|
|
12175
|
-
"aria-label": `Resize ${c
|
|
12177
|
+
"aria-label": `Resize ${colLabel(c)} column (double-click to fit content)`,
|
|
12176
12178
|
"aria-valuenow": w,
|
|
12177
12179
|
"aria-valuemin": 72,
|
|
12178
12180
|
tabIndex: 0,
|
|
@@ -12347,15 +12349,15 @@ function Datatable({
|
|
|
12347
12349
|
placeholder: "Add a column\u2026",
|
|
12348
12350
|
value: "",
|
|
12349
12351
|
"aria-label": "Add a column to edit",
|
|
12350
|
-
options: unpicked.map((c) => ({ value: c.field, label:
|
|
12352
|
+
options: unpicked.map((c) => ({ value: c.field, label: colLabel(c) })),
|
|
12351
12353
|
onChange: addField
|
|
12352
12354
|
}
|
|
12353
12355
|
) }) : null,
|
|
12354
12356
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "twc-dt__cfg-list", children: pickedCols.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "twc-dt__be-empty", children: "Pick a column to set its value on all selected rows." }) : pickedCols.map((c, i) => {
|
|
12355
12357
|
const opts = c.valueOptions ? c.valueOptions.map((o) => typeof o === "string" ? { value: o, label: o } : o) : null;
|
|
12356
12358
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "twc-dt__be-row", children: [
|
|
12357
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "twc-dt__be-name", title:
|
|
12358
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "twc-dt__be-name-txt", children: c
|
|
12359
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "twc-dt__be-name", title: colLabel(c), children: [
|
|
12360
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "twc-dt__be-name-txt", children: colLabel(c) }),
|
|
12359
12361
|
resizableFilters && i === 0 ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
12360
12362
|
"span",
|
|
12361
12363
|
{
|
|
@@ -12395,7 +12397,7 @@ function Datatable({
|
|
|
12395
12397
|
onChange: (e) => setBatchEdit((b) => ({ ...b, values: { ...b.values, [c.field]: e.target.value } }))
|
|
12396
12398
|
}
|
|
12397
12399
|
) }),
|
|
12398
|
-
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "twc-dt__be-x", "aria-label": `Remove ${
|
|
12400
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "twc-dt__be-x", "aria-label": `Remove ${colLabel(c)}`, onClick: () => removeField(c.field), children: /* @__PURE__ */ jsxRuntime.jsx(Svg, { d: I.x }) })
|
|
12399
12401
|
] }, c.field);
|
|
12400
12402
|
}) }),
|
|
12401
12403
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "twc-dt__cfg-foot", children: [
|
|
@@ -12667,7 +12669,7 @@ function Datatable({
|
|
|
12667
12669
|
children: [
|
|
12668
12670
|
canDrag ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "twc-dt__col-grip", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(Svg, { d: I.grip }) }) : null,
|
|
12669
12671
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "twc-dt__col-name", children: [
|
|
12670
|
-
c
|
|
12672
|
+
colLabel(c),
|
|
12671
12673
|
combineSources.has(c.field) ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "twc-dt__col-combined", children: " \xB7 combined" }) : null
|
|
12672
12674
|
] }),
|
|
12673
12675
|
c.pinnable && c.type !== "actions" ? (
|
|
@@ -12680,7 +12682,7 @@ function Datatable({
|
|
|
12680
12682
|
className: "twc-dt__col-pin",
|
|
12681
12683
|
"data-on": pins.left.includes(c.field) || void 0,
|
|
12682
12684
|
"aria-pressed": pins.left.includes(c.field),
|
|
12683
|
-
"aria-label": `Pin ${c
|
|
12685
|
+
"aria-label": `Pin ${colLabel(c)} to left`,
|
|
12684
12686
|
title: pins.left.includes(c.field) ? "Unpin" : "Pin to left",
|
|
12685
12687
|
onClick: () => setPin(c.field, pins.left.includes(c.field) ? null : "left"),
|
|
12686
12688
|
children: /* @__PURE__ */ jsxRuntime.jsx(Svg, { d: I.pinL })
|
|
@@ -12693,7 +12695,7 @@ function Datatable({
|
|
|
12693
12695
|
className: "twc-dt__col-pin",
|
|
12694
12696
|
"data-on": pins.right.includes(c.field) || void 0,
|
|
12695
12697
|
"aria-pressed": pins.right.includes(c.field),
|
|
12696
|
-
"aria-label": `Pin ${c
|
|
12698
|
+
"aria-label": `Pin ${colLabel(c)} to right`,
|
|
12697
12699
|
title: pins.right.includes(c.field) ? "Unpin" : "Pin to right",
|
|
12698
12700
|
onClick: () => setPin(c.field, pins.right.includes(c.field) ? null : "right"),
|
|
12699
12701
|
children: /* @__PURE__ */ jsxRuntime.jsx(Svg, { d: I.pin })
|
|
@@ -12708,7 +12710,7 @@ function Datatable({
|
|
|
12708
12710
|
"data-on": !effectiveHidden.has(c.field) || void 0,
|
|
12709
12711
|
role: "switch",
|
|
12710
12712
|
"aria-checked": !effectiveHidden.has(c.field),
|
|
12711
|
-
"aria-label": c
|
|
12713
|
+
"aria-label": colLabel(c),
|
|
12712
12714
|
"aria-disabled": !c.hideable || combineSources.has(c.field) || void 0,
|
|
12713
12715
|
tabIndex: c.hideable && !combineSources.has(c.field) ? 0 : -1,
|
|
12714
12716
|
onKeyDown: (e) => {
|
|
@@ -12732,17 +12734,17 @@ function Datatable({
|
|
|
12732
12734
|
const target = colByField[combineTarget];
|
|
12733
12735
|
const candidates = cols.filter((c) => c.field !== combineTarget && c.type !== "actions" && c.field !== "__pinactions__" && c.hideable !== false && !userCombine[c.field]);
|
|
12734
12736
|
const toggle = (f) => setCombineDraft((d) => ({ ...d, selected: d.selected.includes(f) ? d.selected.filter((x) => x !== f) : [...d.selected, f] }));
|
|
12735
|
-
return /* @__PURE__ */ jsxRuntime.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
|
|
12737
|
+
return /* @__PURE__ */ jsxRuntime.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: [
|
|
12736
12738
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "twc-dt__panel-head", children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "twc-dt__panel-title", children: [
|
|
12737
12739
|
"Combine into \u201C",
|
|
12738
|
-
target
|
|
12740
|
+
target ? colLabel(target) : combineTarget,
|
|
12739
12741
|
"\u201D"
|
|
12740
12742
|
] }) }),
|
|
12741
12743
|
/* @__PURE__ */ jsxRuntime.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." }),
|
|
12742
12744
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "twc-dt__col-list", children: candidates.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "twc-dt__empty", style: { padding: "18px 12px" }, children: "No other columns" }) : candidates.map((c) => {
|
|
12743
12745
|
const on = combineDraft.selected.includes(c.field);
|
|
12744
12746
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "twc-dt__col-row", onClick: () => toggle(c.field), children: [
|
|
12745
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "twc-dt__col-name", children: c
|
|
12747
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "twc-dt__col-name", children: colLabel(c) }),
|
|
12746
12748
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12747
12749
|
"span",
|
|
12748
12750
|
{
|
|
@@ -12750,7 +12752,7 @@ function Datatable({
|
|
|
12750
12752
|
"data-on": on || void 0,
|
|
12751
12753
|
role: "switch",
|
|
12752
12754
|
"aria-checked": on,
|
|
12753
|
-
"aria-label": c
|
|
12755
|
+
"aria-label": colLabel(c),
|
|
12754
12756
|
tabIndex: 0,
|
|
12755
12757
|
onKeyDown: (e) => {
|
|
12756
12758
|
if (e.key === "Enter" || e.key === " ") {
|
|
@@ -12833,7 +12835,7 @@ function Datatable({
|
|
|
12833
12835
|
const numeric = c.type === "number";
|
|
12834
12836
|
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" }];
|
|
12835
12837
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "twc-dt__cfg-row", children: [
|
|
12836
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "twc-dt__cfg-name", children: c
|
|
12838
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "twc-dt__cfg-name", children: colLabel(c) }),
|
|
12837
12839
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "twc-dt__cfg-ctl", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12838
12840
|
Select,
|
|
12839
12841
|
{
|
|
@@ -12857,9 +12859,9 @@ function Datatable({
|
|
|
12857
12859
|
popGrip("agg")
|
|
12858
12860
|
] }) : null,
|
|
12859
12861
|
panel === "pivot" && panelPos ? (() => {
|
|
12860
|
-
const fieldOpts = ordered.filter((c) => c.type !== "actions").map((c) => ({ value: c.field, label: c
|
|
12862
|
+
const fieldOpts = ordered.filter((c) => c.type !== "actions").map((c) => ({ value: c.field, label: colLabel(c) }));
|
|
12861
12863
|
const aggOpts = [{ value: "sum", label: "Sum" }, { value: "avg", label: "Avg" }, { value: "min", label: "Min" }, { value: "max", label: "Max" }, { value: "count", label: "Count" }];
|
|
12862
|
-
const valueFieldOpts = ordered.filter((c) => c.type !== "actions" && !pivotConfig.values.some((v) => v.field === c.field)).map((c) => ({ value: c.field, label: c
|
|
12864
|
+
const valueFieldOpts = ordered.filter((c) => c.type !== "actions" && !pivotConfig.values.some((v) => v.field === c.field)).map((c) => ({ value: c.field, label: colLabel(c) }));
|
|
12863
12865
|
return /* @__PURE__ */ jsxRuntime.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: [
|
|
12864
12866
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "twc-dt__panel-head", children: [
|
|
12865
12867
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "twc-dt__panel-title", children: "Pivot" }),
|
|
@@ -12928,7 +12930,7 @@ function Datatable({
|
|
|
12928
12930
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "twc-dt__cfg-section", children: [
|
|
12929
12931
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "twc-dt__cfg-label", children: "Values" }),
|
|
12930
12932
|
pivotConfig.values.map((v, i) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "twc-dt__cfg-row", children: [
|
|
12931
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "twc-dt__cfg-name", children:
|
|
12933
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "twc-dt__cfg-name", children: fieldLabel(v.field) }),
|
|
12932
12934
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "twc-dt__cfg-ctl", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12933
12935
|
Select,
|
|
12934
12936
|
{
|
|
@@ -12944,7 +12946,7 @@ function Datatable({
|
|
|
12944
12946
|
{
|
|
12945
12947
|
type: "button",
|
|
12946
12948
|
className: "twc-dt__cfg-x",
|
|
12947
|
-
"aria-label": `Remove ${
|
|
12949
|
+
"aria-label": `Remove ${fieldLabel(v.field)}`,
|
|
12948
12950
|
onClick: () => setPivotConfig((p) => ({ ...p, values: p.values.filter((_, j) => j !== i) })),
|
|
12949
12951
|
children: /* @__PURE__ */ jsxRuntime.jsx(Svg, { d: I.x })
|
|
12950
12952
|
}
|
|
@@ -13026,7 +13028,7 @@ function Datatable({
|
|
|
13026
13028
|
size: "sm",
|
|
13027
13029
|
portal: true,
|
|
13028
13030
|
value: f.field,
|
|
13029
|
-
options: filterableCols.map((c) => ({ value: c.field, label: c
|
|
13031
|
+
options: filterableCols.map((c) => ({ value: c.field, label: colLabel(c) })),
|
|
13030
13032
|
onChange: (v) => {
|
|
13031
13033
|
const nc = colByField[v];
|
|
13032
13034
|
setFilters((arr) => arr.map((x) => x.id === f.id ? { ...x, field: v, op: opsFor(filterTypeOf(nc))[0].value, value: "" } : x));
|
|
@@ -13083,7 +13085,7 @@ function Datatable({
|
|
|
13083
13085
|
),
|
|
13084
13086
|
fieldHandle("val", i)
|
|
13085
13087
|
] }),
|
|
13086
|
-
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "twc-dt__frm-x", "aria-label": `Add another condition on ${col
|
|
13088
|
+
/* @__PURE__ */ jsxRuntime.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__ */ jsxRuntime.jsx(Svg, { d: I.plus }) }),
|
|
13087
13089
|
/* @__PURE__ */ jsxRuntime.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__ */ jsxRuntime.jsx(Svg, { d: I.x }) })
|
|
13088
13090
|
] }, f.id);
|
|
13089
13091
|
}) }),
|