twico-ui 1.34.0 → 1.35.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 +12 -0
- package/dist/index.cjs +85 -31
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +23 -1
- package/dist/index.d.ts +23 -1
- package/dist/index.mjs +85 -31
- package/dist/index.mjs.map +1 -1
- package/llms.txt +4 -1
- package/package.json +4 -4
package/dist/index.d.cts
CHANGED
|
@@ -2050,8 +2050,26 @@ interface DatatableProps<T = any> extends Omit<React.HTMLAttributes<HTMLDivEleme
|
|
|
2050
2050
|
renderRowDetail?: (row: T) => React.ReactNode;
|
|
2051
2051
|
/** Controlled set of expanded row keys (values from `rowKey`). Omit for uncontrolled (internal) expansion. */
|
|
2052
2052
|
expandedRowIds?: Array<string | number>;
|
|
2053
|
-
/** Fires with the next full array of expanded row keys whenever a row is expanded or collapsed.
|
|
2053
|
+
/** Fires with the next full array of expanded row keys whenever a row is expanded or collapsed.
|
|
2054
|
+
* Shared by `renderRowDetail` (#350) and the row-tree (#359). */
|
|
2054
2055
|
onExpandedRowsChange?: (ids: Array<string | number>) => void;
|
|
2056
|
+
/** #359 (server-mode lazy row-tree): draw the same leading chevron on a parent DATA row (independent of
|
|
2057
|
+
* `renderRowDetail`). Expanding reveals CHILD data rows in the SAME columns rather than a detail panel.
|
|
2058
|
+
* In **server mode** the grid does not fetch children — the expanded key set is folded into the
|
|
2059
|
+
* `onServerChange` query (`expanded`), so the host returns the parent + its children inline (and sets
|
|
2060
|
+
* `rowCount` to the flattened visible count; a collapsed parent counts as one row). Uses the shared
|
|
2061
|
+
* `expandedRowIds`/`onExpandedRowsChange`. Tree rows need stable unique keys (via `rowKey`/`id`). Carries
|
|
2062
|
+
* the #350 limits: not yet supported with `virtualized`, pivot, or `rowGrouping`, and no chevron on a
|
|
2063
|
+
* pinned (sticky) row. */
|
|
2064
|
+
getRowCanExpand?: (row: T) => boolean;
|
|
2065
|
+
/** #359: 0-based nesting depth, used only for the tree indent on the first data cell (0 = top-level parent).
|
|
2066
|
+
* In server mode supply it from the host-flattened rows; in client mode it's derived from the `getSubRows`
|
|
2067
|
+
* splice when omitted. @default 0 */
|
|
2068
|
+
getRowDepth?: (row: T) => number;
|
|
2069
|
+
/** #359 (client mode): children for an expanded parent, spliced in as first-class rows (same columns)
|
|
2070
|
+
* immediately after it. Ignored in `serverMode` (the host returns children inline). Children are rendered
|
|
2071
|
+
* after pagination, so they don't consume the parent's page budget and aren't independently sorted/filtered. */
|
|
2072
|
+
getSubRows?: (row: T) => T[];
|
|
2055
2073
|
}
|
|
2056
2074
|
|
|
2057
2075
|
/** String-column filter operators (Datatable server mode). */
|
|
@@ -2092,6 +2110,10 @@ interface DatatableQuery {
|
|
|
2092
2110
|
/** `field`s of the columns currently hidden via the Columns menu. Always populated in
|
|
2093
2111
|
* `onServerChange`; optional for the same reason as `visibleColumns`. */
|
|
2094
2112
|
hiddenColumns?: string[];
|
|
2113
|
+
/** #359 (server-mode lazy row-tree): keys of the currently-expanded parent rows. Always populated in
|
|
2114
|
+
* `onServerChange` when `getRowCanExpand` is used — the host fetches those parents' children and returns
|
|
2115
|
+
* them inline (a collapsed parent is one row). Optional on a hand-built query. */
|
|
2116
|
+
expanded?: Array<string | number>;
|
|
2095
2117
|
}
|
|
2096
2118
|
|
|
2097
2119
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -2050,8 +2050,26 @@ interface DatatableProps<T = any> extends Omit<React.HTMLAttributes<HTMLDivEleme
|
|
|
2050
2050
|
renderRowDetail?: (row: T) => React.ReactNode;
|
|
2051
2051
|
/** Controlled set of expanded row keys (values from `rowKey`). Omit for uncontrolled (internal) expansion. */
|
|
2052
2052
|
expandedRowIds?: Array<string | number>;
|
|
2053
|
-
/** Fires with the next full array of expanded row keys whenever a row is expanded or collapsed.
|
|
2053
|
+
/** Fires with the next full array of expanded row keys whenever a row is expanded or collapsed.
|
|
2054
|
+
* Shared by `renderRowDetail` (#350) and the row-tree (#359). */
|
|
2054
2055
|
onExpandedRowsChange?: (ids: Array<string | number>) => void;
|
|
2056
|
+
/** #359 (server-mode lazy row-tree): draw the same leading chevron on a parent DATA row (independent of
|
|
2057
|
+
* `renderRowDetail`). Expanding reveals CHILD data rows in the SAME columns rather than a detail panel.
|
|
2058
|
+
* In **server mode** the grid does not fetch children — the expanded key set is folded into the
|
|
2059
|
+
* `onServerChange` query (`expanded`), so the host returns the parent + its children inline (and sets
|
|
2060
|
+
* `rowCount` to the flattened visible count; a collapsed parent counts as one row). Uses the shared
|
|
2061
|
+
* `expandedRowIds`/`onExpandedRowsChange`. Tree rows need stable unique keys (via `rowKey`/`id`). Carries
|
|
2062
|
+
* the #350 limits: not yet supported with `virtualized`, pivot, or `rowGrouping`, and no chevron on a
|
|
2063
|
+
* pinned (sticky) row. */
|
|
2064
|
+
getRowCanExpand?: (row: T) => boolean;
|
|
2065
|
+
/** #359: 0-based nesting depth, used only for the tree indent on the first data cell (0 = top-level parent).
|
|
2066
|
+
* In server mode supply it from the host-flattened rows; in client mode it's derived from the `getSubRows`
|
|
2067
|
+
* splice when omitted. @default 0 */
|
|
2068
|
+
getRowDepth?: (row: T) => number;
|
|
2069
|
+
/** #359 (client mode): children for an expanded parent, spliced in as first-class rows (same columns)
|
|
2070
|
+
* immediately after it. Ignored in `serverMode` (the host returns children inline). Children are rendered
|
|
2071
|
+
* after pagination, so they don't consume the parent's page budget and aren't independently sorted/filtered. */
|
|
2072
|
+
getSubRows?: (row: T) => T[];
|
|
2055
2073
|
}
|
|
2056
2074
|
|
|
2057
2075
|
/** String-column filter operators (Datatable server mode). */
|
|
@@ -2092,6 +2110,10 @@ interface DatatableQuery {
|
|
|
2092
2110
|
/** `field`s of the columns currently hidden via the Columns menu. Always populated in
|
|
2093
2111
|
* `onServerChange`; optional for the same reason as `visibleColumns`. */
|
|
2094
2112
|
hiddenColumns?: string[];
|
|
2113
|
+
/** #359 (server-mode lazy row-tree): keys of the currently-expanded parent rows. Always populated in
|
|
2114
|
+
* `onServerChange` when `getRowCanExpand` is used — the host fetches those parents' children and returns
|
|
2115
|
+
* them inline (a collapsed parent is one row). Optional on a hand-built query. */
|
|
2116
|
+
expanded?: Array<string | number>;
|
|
2095
2117
|
}
|
|
2096
2118
|
|
|
2097
2119
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -9326,6 +9326,13 @@ function Datatable({
|
|
|
9326
9326
|
renderRowDetail,
|
|
9327
9327
|
expandedRowIds,
|
|
9328
9328
|
onExpandedRowsChange,
|
|
9329
|
+
// #359: server-mode lazy row-tree — `getRowCanExpand(row)` draws the same leading chevron on parent DATA
|
|
9330
|
+
// rows (independent of renderRowDetail); expanding reveals CHILD data rows in the SAME columns rather than a
|
|
9331
|
+
// panel. In server mode the host returns children inline (the expanded set is folded into onServerChange);
|
|
9332
|
+
// in client mode `getSubRows(row)` supplies them. `getRowDepth(row)` indents nested rows so they read as a tree.
|
|
9333
|
+
getRowCanExpand,
|
|
9334
|
+
getRowDepth,
|
|
9335
|
+
getSubRows,
|
|
9329
9336
|
className = "",
|
|
9330
9337
|
...rest
|
|
9331
9338
|
}) {
|
|
@@ -9538,6 +9545,7 @@ function Datatable({
|
|
|
9538
9545
|
() => new Set(expandControlled ? expandedRowIds : internalExpanded),
|
|
9539
9546
|
[expandControlled, expandedRowIds, internalExpanded]
|
|
9540
9547
|
);
|
|
9548
|
+
const expandedKey = React51__default.useMemo(() => JSON.stringify([...expandedSet].sort()), [expandedSet]);
|
|
9541
9549
|
const [pinnedRows, setPinnedRows] = React51__default.useState({ top: [], bottom: [] });
|
|
9542
9550
|
const [headH, setHeadH] = React51__default.useState(41);
|
|
9543
9551
|
const theadRef = React51__default.useRef(null);
|
|
@@ -9940,7 +9948,10 @@ function Datatable({
|
|
|
9940
9948
|
const NUM_W = 56;
|
|
9941
9949
|
const CHK_W = checkboxSelection ? rowReorder ? 68 : 44 : 0;
|
|
9942
9950
|
const hasRowDetail = typeof renderRowDetail === "function";
|
|
9943
|
-
const
|
|
9951
|
+
const hasRowTree = typeof getRowCanExpand === "function";
|
|
9952
|
+
const hasExpandCol = hasRowDetail || hasRowTree;
|
|
9953
|
+
const treeExpandedKey = hasRowTree ? expandedKey : "";
|
|
9954
|
+
const EXP_W = hasExpandCol ? 44 : 0;
|
|
9944
9955
|
const numLeft = EXP_W + CHK_W;
|
|
9945
9956
|
const leadW = numLeft + (showRowNum ? NUM_W : 0);
|
|
9946
9957
|
const visLeft = React51__default.useMemo(() => pins.left.filter((f) => colByField[f] && !effectiveHidden.has(f)), [pins.left, colByField, effectiveHidden]);
|
|
@@ -10013,6 +10024,40 @@ function Datatable({
|
|
|
10013
10024
|
React51__default.useEffect(() => {
|
|
10014
10025
|
if (pageVal > totalPages - 1) commitPage(0);
|
|
10015
10026
|
}, [totalPages]);
|
|
10027
|
+
const treeRows = React51__default.useMemo(() => {
|
|
10028
|
+
if (serverMode || typeof getSubRows !== "function") return null;
|
|
10029
|
+
const out = [];
|
|
10030
|
+
const seen2 = /* @__PURE__ */ new Set();
|
|
10031
|
+
const walk = (r2, d) => {
|
|
10032
|
+
const key = keyOf(r2);
|
|
10033
|
+
if (seen2.has(key)) return;
|
|
10034
|
+
seen2.add(key);
|
|
10035
|
+
out.push({ row: r2, depth: d });
|
|
10036
|
+
if (expandedSet.has(key)) for (const c of getSubRows(r2) || []) walk(c, d + 1);
|
|
10037
|
+
};
|
|
10038
|
+
for (const r2 of paged) walk(r2, 0);
|
|
10039
|
+
return out;
|
|
10040
|
+
}, [serverMode, getSubRows, paged, expandedSet, keyOf]);
|
|
10041
|
+
const depthByKey = React51__default.useMemo(() => {
|
|
10042
|
+
const m = /* @__PURE__ */ new Map();
|
|
10043
|
+
if (treeRows) for (const t of treeRows) m.set(keyOf(t.row), t.depth);
|
|
10044
|
+
return m;
|
|
10045
|
+
}, [treeRows, keyOf]);
|
|
10046
|
+
const treeSeqByKey = React51__default.useMemo(() => {
|
|
10047
|
+
if (!treeRows) return null;
|
|
10048
|
+
const m = /* @__PURE__ */ new Map();
|
|
10049
|
+
const seen2 = /* @__PURE__ */ new Set();
|
|
10050
|
+
let n = 0;
|
|
10051
|
+
const walk = (r2) => {
|
|
10052
|
+
const key = keyOf(r2);
|
|
10053
|
+
if (seen2.has(key)) return;
|
|
10054
|
+
seen2.add(key);
|
|
10055
|
+
m.set(key, n++);
|
|
10056
|
+
if (expandedSet.has(key)) for (const c of getSubRows(r2) || []) walk(c);
|
|
10057
|
+
};
|
|
10058
|
+
for (const r2 of processed) walk(r2);
|
|
10059
|
+
return m;
|
|
10060
|
+
}, [treeRows, processed, expandedSet, getSubRows, keyOf]);
|
|
10016
10061
|
const activeGroupBy = React51__default.useMemo(() => groupBy.filter((f) => colByField[f]), [groupBy, colByField]);
|
|
10017
10062
|
function subtotalText(rowsIn) {
|
|
10018
10063
|
const parts = [];
|
|
@@ -10063,7 +10108,7 @@ function Datatable({
|
|
|
10063
10108
|
};
|
|
10064
10109
|
return build(paged, 0, "");
|
|
10065
10110
|
}, [activeGroupBy, collapsed, paged, ordered, aggOn]);
|
|
10066
|
-
const leafRows = displayItems ? displayItems.filter((i) => i.kind === "leaf").map((i) => i.row) : paged;
|
|
10111
|
+
const leafRows = displayItems ? displayItems.filter((i) => i.kind === "leaf").map((i) => i.row) : treeRows ? treeRows.map((t) => t.row) : paged;
|
|
10067
10112
|
function toggleGroup(key) {
|
|
10068
10113
|
setCollapsed((s) => {
|
|
10069
10114
|
const n = new Set(s);
|
|
@@ -10315,12 +10360,14 @@ function Datatable({
|
|
|
10315
10360
|
// #303: "and" (default) | "or" — the server groups its WHERE accordingly
|
|
10316
10361
|
quickFilter: quick.trim(),
|
|
10317
10362
|
visibleColumns,
|
|
10318
|
-
hiddenColumns
|
|
10363
|
+
hiddenColumns,
|
|
10319
10364
|
// #191: server can project only the visible columns
|
|
10365
|
+
...hasRowTree ? { expanded: [...expandedSet] } : null
|
|
10366
|
+
// #359: only a row-tree folds expanded parents in
|
|
10320
10367
|
});
|
|
10321
10368
|
}, 250);
|
|
10322
10369
|
return () => clearTimeout(t);
|
|
10323
|
-
}, [serverMode, pageVal, sizeVal, sort, filters, filterLogic, quick, visibleColumns, hiddenColumns]);
|
|
10370
|
+
}, [serverMode, pageVal, sizeVal, sort, filters, filterLogic, quick, visibleColumns, hiddenColumns, treeExpandedKey]);
|
|
10324
10371
|
const onColVisRef = React51__default.useRef(onColumnVisibilityChange);
|
|
10325
10372
|
onColVisRef.current = onColumnVisibilityChange;
|
|
10326
10373
|
const lastVisibleKey = React51__default.useRef(null);
|
|
@@ -10694,12 +10741,12 @@ function Datatable({
|
|
|
10694
10741
|
next = next === "" ? null : Number(next);
|
|
10695
10742
|
if (Number.isNaN(next)) next = null;
|
|
10696
10743
|
}
|
|
10697
|
-
const row =
|
|
10744
|
+
const row = leafRows.find((r2, i) => keyOf(r2, i) === editing.key);
|
|
10698
10745
|
setEditing(null);
|
|
10699
10746
|
if (!row || row[editing.field] === next) return;
|
|
10700
10747
|
const updated = { ...row, [editing.field]: next };
|
|
10701
10748
|
onRowUpdate?.(updated, row, editing.field);
|
|
10702
|
-
if (onRowsChange) {
|
|
10749
|
+
if (onRowsChange && rows.some((r2, i) => keyOf(r2, i) === editing.key)) {
|
|
10703
10750
|
onRowsChange(rows.map((r2, i) => keyOf(r2, i) === editing.key ? updated : r2));
|
|
10704
10751
|
}
|
|
10705
10752
|
}
|
|
@@ -10828,20 +10875,25 @@ function Datatable({
|
|
|
10828
10875
|
};
|
|
10829
10876
|
const writeCellPatches = (patchByKey) => {
|
|
10830
10877
|
if (!patchByKey.size) return 0;
|
|
10831
|
-
|
|
10832
|
-
|
|
10833
|
-
const
|
|
10834
|
-
|
|
10835
|
-
if (!patch) return r2;
|
|
10878
|
+
let count = 0;
|
|
10879
|
+
leafRows.forEach((r2, i) => {
|
|
10880
|
+
const patch = patchByKey.get(keyOf(r2, i));
|
|
10881
|
+
if (!patch) return;
|
|
10836
10882
|
const updated = { ...r2, ...patch };
|
|
10837
|
-
|
|
10838
|
-
|
|
10883
|
+
for (const f of Object.keys(patch)) onRowUpdate?.(updated, r2, f);
|
|
10884
|
+
count++;
|
|
10839
10885
|
});
|
|
10840
|
-
|
|
10841
|
-
|
|
10842
|
-
|
|
10843
|
-
|
|
10844
|
-
|
|
10886
|
+
if (onRowsChange) {
|
|
10887
|
+
let anyTop = false;
|
|
10888
|
+
const nextAll = rows.map((r2, i) => {
|
|
10889
|
+
const patch = patchByKey.get(keyOf(r2, i));
|
|
10890
|
+
if (!patch) return r2;
|
|
10891
|
+
anyTop = true;
|
|
10892
|
+
return { ...r2, ...patch };
|
|
10893
|
+
});
|
|
10894
|
+
if (anyTop) onRowsChange(nextAll);
|
|
10895
|
+
}
|
|
10896
|
+
return count;
|
|
10845
10897
|
};
|
|
10846
10898
|
const rectCells = () => {
|
|
10847
10899
|
if (!cellRect) return null;
|
|
@@ -11388,7 +11440,7 @@ function Datatable({
|
|
|
11388
11440
|
const manageableCols = cols.filter((c) => c.field !== "__pinactions__");
|
|
11389
11441
|
const visibleColCount = manageableCols.filter((c) => !effectiveHidden.has(c.field)).length;
|
|
11390
11442
|
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) + (
|
|
11443
|
+
const totalCols = ordered.length + (checkboxSelection ? 1 : 0) + (showRowNum ? 1 : 0) + (hasExpandCol ? 1 : 0);
|
|
11392
11444
|
function renderGroupRow(item) {
|
|
11393
11445
|
const subs = aggOn ? subtotalText(item.rows) : [];
|
|
11394
11446
|
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: [
|
|
@@ -11443,8 +11495,10 @@ function Datatable({
|
|
|
11443
11495
|
const k = keyOf(row, ri);
|
|
11444
11496
|
const sel = selected.has(k);
|
|
11445
11497
|
const detail = hasRowDetail && !pinSide ? renderRowDetail(row) : null;
|
|
11446
|
-
const
|
|
11498
|
+
const canTreeExpand = hasRowTree && !pinSide && !!getRowCanExpand(row);
|
|
11499
|
+
const expandable = detail != null || canTreeExpand;
|
|
11447
11500
|
const open = expandable && expandedSet.has(k);
|
|
11501
|
+
const depth = getRowDepth ? getRowDepth(row) || 0 : depthByKey.get(k) || 0;
|
|
11448
11502
|
const rowActive = selectionMode === "row" && activeRowVal === k;
|
|
11449
11503
|
const stickyStyle = pinSide === "top" ? { position: "sticky", top: headH, zIndex: 5 } : pinSide === "bottom" ? { position: "sticky", bottom: 0, zIndex: 5 } : void 0;
|
|
11450
11504
|
const h = rowHeights[k];
|
|
@@ -11458,7 +11512,7 @@ function Datatable({
|
|
|
11458
11512
|
{
|
|
11459
11513
|
className: "twc-dt__row",
|
|
11460
11514
|
role: "row",
|
|
11461
|
-
"aria-rowindex": (paginated && !serverMode ? pageVal * sizeVal : 0) + ri + 2,
|
|
11515
|
+
"aria-rowindex": treeSeqByKey ? treeSeqByKey.get(k) + 2 : (paginated && !serverMode ? pageVal * sizeVal : 0) + ri + 2,
|
|
11462
11516
|
"aria-selected": (checkboxSelection ? sel : rowActive) || void 0,
|
|
11463
11517
|
"data-op": row.__diffop || void 0,
|
|
11464
11518
|
"data-selected": sel || void 0,
|
|
@@ -11492,7 +11546,7 @@ function Datatable({
|
|
|
11492
11546
|
onDragEnd: reorderable ? () => setRowDrag({ from: null, over: null, after: false }) : void 0,
|
|
11493
11547
|
onClick: (e) => handleRowClick(e, k, row),
|
|
11494
11548
|
children: [
|
|
11495
|
-
|
|
11549
|
+
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
11550
|
e.stopPropagation();
|
|
11497
11551
|
toggleRowDetail(k);
|
|
11498
11552
|
}, 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 +11575,7 @@ function Datatable({
|
|
|
11521
11575
|
] }),
|
|
11522
11576
|
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
11577
|
] }) : 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,
|
|
11578
|
+
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
11579
|
ordered.map((c, ci) => {
|
|
11526
11580
|
const st = stickyOf(c.field);
|
|
11527
11581
|
const val = getColVal(c, row);
|
|
@@ -11544,7 +11598,7 @@ function Datatable({
|
|
|
11544
11598
|
role: "gridcell",
|
|
11545
11599
|
"data-r": ri,
|
|
11546
11600
|
"data-c": ci,
|
|
11547
|
-
"aria-colindex": ci + 1 + (checkboxSelection ? 1 : 0) + (
|
|
11601
|
+
"aria-colindex": ci + 1 + (checkboxSelection ? 1 : 0) + (hasExpandCol ? 1 : 0),
|
|
11548
11602
|
tabIndex: focus.r === ri && focus.c === ci ? 0 : -1,
|
|
11549
11603
|
"aria-selected": cellSelected || void 0,
|
|
11550
11604
|
"data-num": c.type === "number" || void 0,
|
|
@@ -11557,7 +11611,7 @@ function Datatable({
|
|
|
11557
11611
|
"data-wrap": effectiveWrapped.has(c.field) || void 0,
|
|
11558
11612
|
"data-pin": st.pin,
|
|
11559
11613
|
"data-pin-edge": st.edge,
|
|
11560
|
-
style: { width: widthOf(c), ...cellSty, ...st.style, ...st.pin ? { position: "sticky", zIndex: 2 } : null },
|
|
11614
|
+
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
11615
|
"data-ovtext": cellTitle,
|
|
11562
11616
|
onClick: selectionMode === "cell" ? (e) => handleCellClick(e, k, row, c) : void 0,
|
|
11563
11617
|
onFocus: () => setFocus((f) => f.r === ri && f.c === ci ? f : { r: ri, c: ci }),
|
|
@@ -11609,7 +11663,7 @@ function Datatable({
|
|
|
11609
11663
|
]
|
|
11610
11664
|
}
|
|
11611
11665
|
),
|
|
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
|
|
11666
|
+
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
11667
|
] }, (pinSide ? "p-" : "") + k);
|
|
11614
11668
|
}
|
|
11615
11669
|
function renderPivot() {
|
|
@@ -11946,15 +12000,15 @@ function Datatable({
|
|
|
11946
12000
|
ref: gridRef,
|
|
11947
12001
|
role: "grid",
|
|
11948
12002
|
"aria-label": ariaLabelAttr || ariaLabel,
|
|
11949
|
-
"aria-rowcount": totalRows + 1,
|
|
11950
|
-
"aria-colcount": ordered.length + (checkboxSelection ? 1 : 0) + (
|
|
12003
|
+
"aria-rowcount": (treeSeqByKey ? treeSeqByKey.size : totalRows) + 1,
|
|
12004
|
+
"aria-colcount": ordered.length + (checkboxSelection ? 1 : 0) + (hasExpandCol ? 1 : 0),
|
|
11951
12005
|
"aria-multiselectable": selectionMode === "cell" || void 0,
|
|
11952
12006
|
"aria-activedescendant": activeCellId,
|
|
11953
12007
|
"aria-busy": loading || void 0,
|
|
11954
12008
|
onKeyDown: onGridKeyDown,
|
|
11955
12009
|
children: [
|
|
11956
12010
|
/* @__PURE__ */ jsx("thead", { ref: theadRef, children: /* @__PURE__ */ jsxs("tr", { role: "row", "aria-rowindex": 1, children: [
|
|
11957
|
-
|
|
12011
|
+
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
12012
|
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
12013
|
"span",
|
|
11960
12014
|
{
|
|
@@ -12131,7 +12185,7 @@ function Datatable({
|
|
|
12131
12185
|
})
|
|
12132
12186
|
] }) }),
|
|
12133
12187
|
/* @__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
|
-
|
|
12188
|
+
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
12189
|
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
12190
|
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
12191
|
ordered.map((c, ci) => {
|
|
@@ -12154,7 +12208,7 @@ function Datatable({
|
|
|
12154
12208
|
pinnedBottomRows.map((row) => renderLeaf(row, keyIndex.get(keyOf(row)), "bottom"))
|
|
12155
12209
|
] }) }),
|
|
12156
12210
|
hasAggregation && aggOn && !loading && paged.length > 0 ? /* @__PURE__ */ jsx("tfoot", { children: /* @__PURE__ */ jsxs("tr", { role: "row", children: [
|
|
12157
|
-
|
|
12211
|
+
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
12212
|
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
12213
|
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
12214
|
ordered.map((c) => {
|