twico-ui 1.23.0 → 1.24.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 +265 -124
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.mjs +265 -124
- package/dist/index.mjs.map +1 -1
- package/llms.txt +2 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -8560,6 +8560,13 @@ th.twc-dt__rownum .twc-dt__th-inner { padding-inline: 8px; gap: 2px; justify-con
|
|
|
8560
8560
|
.twc-dt__panel-count { font-weight: 600; color: var(--color-text-muted); text-transform: none; letter-spacing: 0; margin-inline-start: 6px; font-variant-numeric: tabular-nums; }
|
|
8561
8561
|
.twc-dt__link { border: none; background: transparent; color: var(--color-primary); font-family: inherit; font-size: var(--text-xs); font-weight: 600; cursor: pointer; padding: 2px 4px; border-radius: var(--radius-sm); }
|
|
8562
8562
|
.twc-dt__link:hover { background: var(--color-primary-subtle); }
|
|
8563
|
+
/* #303: AND/OR connective toggle (segmented pill) in the Filters panel head. */
|
|
8564
|
+
.twc-dt__flogic { display: inline-flex; border: var(--border-thin) solid var(--color-border); border-radius: var(--radius-md); overflow: hidden; }
|
|
8565
|
+
.twc-dt__flogic-btn { border: none; background: transparent; color: var(--color-text-muted); font-family: inherit; font-size: 10px; font-weight: 700; letter-spacing: var(--tracking-wide); cursor: pointer; padding: 2px 8px; }
|
|
8566
|
+
.twc-dt__flogic-btn + .twc-dt__flogic-btn { border-inline-start: var(--border-thin) solid var(--color-border); }
|
|
8567
|
+
.twc-dt__flogic-btn:hover { background: var(--color-surface-sunken); }
|
|
8568
|
+
.twc-dt__flogic-btn[data-active] { background: var(--color-primary); color: var(--color-primary-fg); }
|
|
8569
|
+
.twc-dt__flogic-btn[data-active]:hover { background: var(--color-primary); }
|
|
8563
8570
|
|
|
8564
8571
|
/* Filter panel \u2014 user-resizable (#292): panel size + per-field widths resolve through a two-tier CSS var
|
|
8565
8572
|
cascade \u2014 user drag (-usr) > #289 measured auto-fit (-fit) > 118px fallback \u2014 entirely in clamp(), so
|
|
@@ -8590,7 +8597,9 @@ th.twc-dt__rownum .twc-dt__th-inner { padding-inline: 8px; gap: 2px; justify-con
|
|
|
8590
8597
|
/* value: the flex shock-absorber by default; the first drag flips it to a fixed width (data-val-fixed). */
|
|
8591
8598
|
.twc-dt__f-val { position: relative; flex: 1 1 140px; min-width: 140px; }
|
|
8592
8599
|
.twc-dt__filters[data-val-fixed] .twc-dt__f-val { flex: 0 0 clamp(140px, var(--twc-dt-fval-usr, 240px), 640px); }
|
|
8593
|
-
|
|
8600
|
+
/* #303: each row now has two .twc-dt__frm-x (the add-condition "+" then remove "x"); put the auto margin
|
|
8601
|
+
only on the first so the pair hugs the row end together (two auto margins would split the free space). */
|
|
8602
|
+
.twc-dt__filters[data-val-fixed] .twc-dt__frm-x:first-of-type { margin-inline-start: auto; }
|
|
8594
8603
|
.twc-dt__frm-x { display: inline-grid; place-items: center; width: 30px; height: 38px; border: none; background: transparent; color: var(--color-text-subtle); border-radius: var(--radius-md); cursor: pointer; flex: none; align-self: flex-start; }
|
|
8595
8604
|
.twc-dt__frm-x:hover { background: var(--color-danger-subtle); color: var(--color-danger-subtle-fg); }
|
|
8596
8605
|
.twc-dt__frm-x svg { width: 15px; height: 15px; }
|
|
@@ -8610,6 +8619,13 @@ th.twc-dt__rownum .twc-dt__th-inner { padding-inline: 8px; gap: 2px; justify-con
|
|
|
8610
8619
|
.twc-dt__f-rz { width: 16px; inset-inline-end: -6px; opacity: 0.4; }
|
|
8611
8620
|
.twc-dt__pop-grip { width: 20px; height: 20px; opacity: 0.6; }
|
|
8612
8621
|
}
|
|
8622
|
+
/* #304: generic resizable popovers. When the grip commits a size, the panel carries data-pop-sized +
|
|
8623
|
+
--twc-dt-pop-w/-h; the width override beats each panel default (incl. inline widths) and the inner
|
|
8624
|
+
scroll list drops its max-height and flexes to fill the taller panel. The panel keeps its base
|
|
8625
|
+
position: fixed (the absolute grip anchors to it) \u2014 do NOT set position here (see #294). Filters keep
|
|
8626
|
+
their own data-panel-sized system (untouched). */
|
|
8627
|
+
.twc-dt__pop[data-pop-sized] { display: flex; flex-direction: column; width: var(--twc-dt-pop-w) !important; height: var(--twc-dt-pop-h); max-width: calc(100vw - 32px); max-height: calc(100vh - 32px); }
|
|
8628
|
+
.twc-dt__pop[data-pop-sized] .twc-dt__col-list, .twc-dt__pop[data-pop-sized] .twc-dt__cfg-list, .twc-dt__pop[data-pop-sized] .twc-dt__pivot-body { max-height: none; flex: 1 1 auto; overflow-y: auto; }
|
|
8613
8629
|
.twc-dt__empty { padding: 30px 12px; text-align: center; color: var(--color-text-subtle); font-size: var(--text-sm); }
|
|
8614
8630
|
|
|
8615
8631
|
/* Action cell */
|
|
@@ -8839,9 +8855,10 @@ function runDatatableQuery(rows, query, options = {}) {
|
|
|
8839
8855
|
let out = Array.isArray(rows) ? rows : [];
|
|
8840
8856
|
const quick = String(q.quickFilter || "").trim().toLowerCase();
|
|
8841
8857
|
if (quick) out = out.filter((r2) => searchFields.some((f) => String(gv(f, r2) ?? "").toLowerCase().includes(quick)));
|
|
8842
|
-
|
|
8843
|
-
|
|
8844
|
-
out = out.filter((r2) => testFilter(gv(f.field, r2), f.op, f.value, filterTypeOf(fc)));
|
|
8858
|
+
const qF = (q.filters || []).map((f) => [cols.find((c) => c.field === f.field), f]).filter(([fc]) => fc);
|
|
8859
|
+
if (qF.length) {
|
|
8860
|
+
if (q.filterLogic === "or") out = out.filter((r2) => qF.some(([fc, f]) => testFilter(gv(f.field, r2), f.op, f.value, filterTypeOf(fc))));
|
|
8861
|
+
else for (const [fc, f] of qF) out = out.filter((r2) => testFilter(gv(f.field, r2), f.op, f.value, filterTypeOf(fc)));
|
|
8845
8862
|
}
|
|
8846
8863
|
if (q.sort && q.sort.field) {
|
|
8847
8864
|
const { field, dir } = q.sort, numeric = typeOf(field) === "number";
|
|
@@ -9163,6 +9180,7 @@ function Datatable({
|
|
|
9163
9180
|
onQuickFilterChange,
|
|
9164
9181
|
toolbarActions,
|
|
9165
9182
|
resizableFilters = true,
|
|
9183
|
+
resizablePopovers = false,
|
|
9166
9184
|
filterFieldMaxWidth,
|
|
9167
9185
|
rowPinning = false,
|
|
9168
9186
|
rowReorder = false,
|
|
@@ -9252,6 +9270,7 @@ function Datatable({
|
|
|
9252
9270
|
});
|
|
9253
9271
|
const [sort, setSort] = React51__namespace.default.useState(null);
|
|
9254
9272
|
const [filters, setFilters] = React51__namespace.default.useState([]);
|
|
9273
|
+
const [filterLogic, setFilterLogic] = React51__namespace.default.useState("and");
|
|
9255
9274
|
const [hidden, setHidden] = React51__namespace.default.useState(() => /* @__PURE__ */ new Set());
|
|
9256
9275
|
const [showRowNum, setShowRowNum] = React51__namespace.default.useState(rowNumbers);
|
|
9257
9276
|
const [wrapped, setWrapped] = React51__namespace.default.useState(() => new Set((columns || []).filter((c) => c.wrapText).map((c) => c.field)));
|
|
@@ -9317,9 +9336,12 @@ function Datatable({
|
|
|
9317
9336
|
const rowFocusRef = React51__namespace.default.useRef(null);
|
|
9318
9337
|
const [fWidths, setFWidths] = React51__namespace.default.useState({});
|
|
9319
9338
|
const [fPanelSize, setFPanelSize] = React51__namespace.default.useState(null);
|
|
9339
|
+
const [popSizes, setPopSizes] = React51__namespace.default.useState({});
|
|
9320
9340
|
const serializeState = () => ({
|
|
9321
9341
|
filters: filters.map(({ id, ...f }) => f),
|
|
9322
9342
|
// strip the internal row id
|
|
9343
|
+
filterLogic,
|
|
9344
|
+
// #303: "and" (default) | "or"
|
|
9323
9345
|
sort,
|
|
9324
9346
|
quickFilter: quick,
|
|
9325
9347
|
page: pageVal,
|
|
@@ -9332,12 +9354,15 @@ function Datatable({
|
|
|
9332
9354
|
density,
|
|
9333
9355
|
// #292: additive, optional — user-resized filter panel + field widths (panel-global, not per column).
|
|
9334
9356
|
filterPanelSize: fPanelSize || void 0,
|
|
9335
|
-
filterFieldWidths: fWidths.col != null || fWidths.op != null || fWidths.val != null ? fWidths : void 0
|
|
9357
|
+
filterFieldWidths: fWidths.col != null || fWidths.op != null || fWidths.val != null ? fWidths : void 0,
|
|
9358
|
+
// #304: additive, optional — user-resized sizes of the other toolbar popovers, keyed by popover id.
|
|
9359
|
+
popoverSizes: Object.keys(popSizes).length ? popSizes : void 0
|
|
9336
9360
|
});
|
|
9337
9361
|
const applyState = (s) => {
|
|
9338
9362
|
if (!s || typeof s !== "object") return;
|
|
9339
9363
|
const known = new Set(cols.map((c) => c.field).filter(Boolean));
|
|
9340
9364
|
if (Array.isArray(s.filters)) setFilters(s.filters.filter((f) => f && known.has(f.field)).map((f, i) => ({ id: Date.now() + Math.random() + i, field: f.field, op: f.op, value: f.value })));
|
|
9365
|
+
if (s.filterLogic === "or" || s.filterLogic === "and") setFilterLogic(s.filterLogic);
|
|
9341
9366
|
if ("sort" in s) setSort(s.sort && known.has(s.sort.field) ? { field: s.sort.field, dir: s.sort.dir === "desc" ? "desc" : "asc" } : null);
|
|
9342
9367
|
if (typeof s.quickFilter === "string" && quickFilter === void 0) setInternalQuick(s.quickFilter);
|
|
9343
9368
|
if (typeof s.page === "number" && !pageControlled) setInternalPage(Math.max(0, Math.floor(s.page)));
|
|
@@ -9367,6 +9392,14 @@ function Datatable({
|
|
|
9367
9392
|
const h = typeof s.filterPanelSize.h === "number" ? clampNum(s.filterPanelSize.h, 120, fMaxH()) : void 0;
|
|
9368
9393
|
if (w != null || h != null) setFPanelSize({ ...w != null ? { w } : {}, ...h != null ? { h } : {} });
|
|
9369
9394
|
}
|
|
9395
|
+
if (s.popoverSizes && typeof s.popoverSizes === "object") {
|
|
9396
|
+
const next = {};
|
|
9397
|
+
for (const [id, sz] of Object.entries(s.popoverSizes)) {
|
|
9398
|
+
if (!sz || typeof sz !== "object" || typeof sz.w !== "number" || typeof sz.h !== "number") continue;
|
|
9399
|
+
next[id] = { w: clampNum(sz.w, popMinW(id), fMaxW()), h: clampNum(sz.h, 120, fMaxH()) };
|
|
9400
|
+
}
|
|
9401
|
+
if (Object.keys(next).length) setPopSizes(next);
|
|
9402
|
+
}
|
|
9370
9403
|
};
|
|
9371
9404
|
const stateReadyRef = React51__namespace.default.useRef(false);
|
|
9372
9405
|
const stateRestoredRef = React51__namespace.default.useRef(false);
|
|
@@ -9384,7 +9417,7 @@ function Datatable({
|
|
|
9384
9417
|
}
|
|
9385
9418
|
}
|
|
9386
9419
|
return void 0;
|
|
9387
|
-
}, [filters, sort, quick, pageVal, sizeVal, order, widths, hidden, pins, density, fWidths, fPanelSize, stateKey]);
|
|
9420
|
+
}, [filters, filterLogic, sort, quick, pageVal, sizeVal, order, widths, hidden, pins, density, fWidths, fPanelSize, popSizes, stateKey]);
|
|
9388
9421
|
const restoreState = () => {
|
|
9389
9422
|
let saved = null;
|
|
9390
9423
|
if (stateKey) {
|
|
@@ -9651,24 +9684,26 @@ function Datatable({
|
|
|
9651
9684
|
const CHK_W = checkboxSelection ? rowReorder ? 68 : 44 : 0;
|
|
9652
9685
|
const numLeft = CHK_W;
|
|
9653
9686
|
const leadW = numLeft + (showRowNum ? NUM_W : 0);
|
|
9687
|
+
const visLeft = React51__namespace.default.useMemo(() => pins.left.filter((f) => colByField[f] && !hidden.has(f)), [pins.left, colByField, hidden]);
|
|
9688
|
+
const visRight = React51__namespace.default.useMemo(() => pins.right.filter((f) => colByField[f] && !hidden.has(f)), [pins.right, colByField, hidden]);
|
|
9654
9689
|
const stickyOf = (field) => {
|
|
9655
|
-
if (
|
|
9690
|
+
if (visLeft.includes(field)) {
|
|
9656
9691
|
let off = leadW;
|
|
9657
|
-
for (const f of
|
|
9692
|
+
for (const f of visLeft) {
|
|
9658
9693
|
if (f === field) break;
|
|
9659
9694
|
off += widthOf(colByField[f] || {});
|
|
9660
9695
|
}
|
|
9661
|
-
const isEdge =
|
|
9696
|
+
const isEdge = visLeft[visLeft.length - 1] === field;
|
|
9662
9697
|
return { style: { insetInlineStart: off }, pin: "left", edge: isEdge ? "left" : void 0 };
|
|
9663
9698
|
}
|
|
9664
|
-
if (
|
|
9699
|
+
if (visRight.includes(field)) {
|
|
9665
9700
|
let off = 0;
|
|
9666
|
-
const rev = [...
|
|
9701
|
+
const rev = [...visRight].reverse();
|
|
9667
9702
|
for (const f of rev) {
|
|
9668
9703
|
if (f === field) break;
|
|
9669
9704
|
off += widthOf(colByField[f] || {});
|
|
9670
9705
|
}
|
|
9671
|
-
const isEdge =
|
|
9706
|
+
const isEdge = visRight[0] === field;
|
|
9672
9707
|
return { style: { insetInlineEnd: off }, pin: "right", edge: isEdge ? "right" : void 0 };
|
|
9673
9708
|
}
|
|
9674
9709
|
return {};
|
|
@@ -9687,10 +9722,13 @@ function Datatable({
|
|
|
9687
9722
|
const searchCols = searchFields && searchFields.length ? searchFields.map((f) => colByField[f] || { field: f }) : visibleCols;
|
|
9688
9723
|
out = out.filter((r2) => searchCols.some((c) => String(getColVal(c, r2) ?? "").toLowerCase().includes(q)));
|
|
9689
9724
|
}
|
|
9690
|
-
|
|
9691
|
-
|
|
9692
|
-
if (
|
|
9693
|
-
|
|
9725
|
+
const activeF = filters.map((f) => [colByField[f.field], f]).filter(([col]) => col);
|
|
9726
|
+
if (activeF.length) {
|
|
9727
|
+
if (filterLogic === "or") {
|
|
9728
|
+
out = out.filter((r2) => activeF.some(([col, f]) => testFilter(getColVal(col, r2), f.op, f.value, filterTypeOf(col))));
|
|
9729
|
+
} else {
|
|
9730
|
+
for (const [col, f] of activeF) out = out.filter((r2) => testFilter(getColVal(col, r2), f.op, f.value, filterTypeOf(col)));
|
|
9731
|
+
}
|
|
9694
9732
|
}
|
|
9695
9733
|
if (sort) {
|
|
9696
9734
|
const col = colByField[sort.field];
|
|
@@ -9707,7 +9745,7 @@ function Datatable({
|
|
|
9707
9745
|
out = [...out].sort((a, b) => (idx.get(keyOf(a)) ?? 1e9) - (idx.get(keyOf(b)) ?? 1e9));
|
|
9708
9746
|
}
|
|
9709
9747
|
return out;
|
|
9710
|
-
}, [rows, quick, filters, sort, visibleCols, colByField, serverMode, rowOrder, searchFields]);
|
|
9748
|
+
}, [rows, quick, filters, filterLogic, sort, visibleCols, colByField, serverMode, rowOrder, searchFields]);
|
|
9711
9749
|
const paginated = pageSize > 0;
|
|
9712
9750
|
const serverTotal = rowCount == null ? processed.length : rowCount;
|
|
9713
9751
|
const totalRows = serverMode ? serverTotal : processed.length;
|
|
@@ -9982,6 +10020,8 @@ function Datatable({
|
|
|
9982
10020
|
pageSize: sizeVal,
|
|
9983
10021
|
sort,
|
|
9984
10022
|
filters: filters.map(({ id, ...f }) => f),
|
|
10023
|
+
filterLogic,
|
|
10024
|
+
// #303: "and" (default) | "or" — the server groups its WHERE accordingly
|
|
9985
10025
|
quickFilter: quick.trim(),
|
|
9986
10026
|
visibleColumns,
|
|
9987
10027
|
hiddenColumns
|
|
@@ -9989,7 +10029,7 @@ function Datatable({
|
|
|
9989
10029
|
});
|
|
9990
10030
|
}, 250);
|
|
9991
10031
|
return () => clearTimeout(t);
|
|
9992
|
-
}, [serverMode, pageVal, sizeVal, sort, filters, quick, visibleColumns, hiddenColumns]);
|
|
10032
|
+
}, [serverMode, pageVal, sizeVal, sort, filters, filterLogic, quick, visibleColumns, hiddenColumns]);
|
|
9993
10033
|
const onColVisRef = React51__namespace.default.useRef(onColumnVisibilityChange);
|
|
9994
10034
|
onColVisRef.current = onColumnVisibilityChange;
|
|
9995
10035
|
const lastVisibleKey = React51__namespace.default.useRef(null);
|
|
@@ -10647,7 +10687,97 @@ function Datatable({
|
|
|
10647
10687
|
}
|
|
10648
10688
|
};
|
|
10649
10689
|
const hasFilterSizeOverride = fWidths.col != null || fWidths.op != null || fWidths.val != null || fPanelSize != null;
|
|
10650
|
-
const
|
|
10690
|
+
const POP_MIN_W = { columns: 240, agg: 240, pivot: 260, batchedit: 260 };
|
|
10691
|
+
const popMinW = (id) => POP_MIN_W[id] || 200;
|
|
10692
|
+
const clearPop = (id, node) => {
|
|
10693
|
+
if (node) {
|
|
10694
|
+
node.style.removeProperty("--twc-dt-pop-w");
|
|
10695
|
+
node.style.removeProperty("--twc-dt-pop-h");
|
|
10696
|
+
node.removeAttribute("data-pop-sized");
|
|
10697
|
+
}
|
|
10698
|
+
setPopSizes((s) => {
|
|
10699
|
+
if (!(id in s)) return s;
|
|
10700
|
+
const n = { ...s };
|
|
10701
|
+
delete n[id];
|
|
10702
|
+
return n;
|
|
10703
|
+
});
|
|
10704
|
+
};
|
|
10705
|
+
const startPopResize = (id) => (e) => {
|
|
10706
|
+
if (e.button != null && e.button !== 0) return;
|
|
10707
|
+
e.preventDefault();
|
|
10708
|
+
e.stopPropagation();
|
|
10709
|
+
const pop = e.currentTarget.closest(".twc-dt__pop");
|
|
10710
|
+
if (!pop) return;
|
|
10711
|
+
const grip = e.currentTarget;
|
|
10712
|
+
const startX = e.clientX, startY = e.clientY;
|
|
10713
|
+
const r2 = pop.getBoundingClientRect();
|
|
10714
|
+
const startW = r2.width, startH = r2.height;
|
|
10715
|
+
const dir = typeof getComputedStyle !== "undefined" && getComputedStyle(pop).direction === "rtl" ? -1 : 1;
|
|
10716
|
+
pop.style.setProperty("--twc-dt-pop-w", `${startW}px`);
|
|
10717
|
+
pop.style.setProperty("--twc-dt-pop-h", `${startH}px`);
|
|
10718
|
+
grip.setAttribute("data-active", "true");
|
|
10719
|
+
pop.setAttribute("data-pop-sized", "");
|
|
10720
|
+
let lw = startW, lh = startH;
|
|
10721
|
+
const onMove = (ev) => {
|
|
10722
|
+
lw = clampNum(startW + (ev.clientX - startX) * dir, popMinW(id), fMaxW());
|
|
10723
|
+
lh = clampNum(startH + (ev.clientY - startY), 120, fMaxH());
|
|
10724
|
+
pop.style.setProperty("--twc-dt-pop-w", `${lw}px`);
|
|
10725
|
+
pop.style.setProperty("--twc-dt-pop-h", `${lh}px`);
|
|
10726
|
+
};
|
|
10727
|
+
const onUp = () => {
|
|
10728
|
+
setPopSizes((s) => ({ ...s, [id]: { w: lw, h: lh } }));
|
|
10729
|
+
grip.removeAttribute("data-active");
|
|
10730
|
+
window.removeEventListener("pointermove", onMove);
|
|
10731
|
+
window.removeEventListener("pointerup", onUp);
|
|
10732
|
+
};
|
|
10733
|
+
window.addEventListener("pointermove", onMove);
|
|
10734
|
+
window.addEventListener("pointerup", onUp);
|
|
10735
|
+
};
|
|
10736
|
+
const onPopGripKey = (id) => (e) => {
|
|
10737
|
+
if (e.key === "Enter" || e.key === " " || e.key === "Backspace") {
|
|
10738
|
+
e.preventDefault();
|
|
10739
|
+
clearPop(id, e.currentTarget.closest(".twc-dt__pop"));
|
|
10740
|
+
return;
|
|
10741
|
+
}
|
|
10742
|
+
if (!["ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown", "Home", "End"].includes(e.key)) return;
|
|
10743
|
+
e.preventDefault();
|
|
10744
|
+
const pop = e.currentTarget.closest(".twc-dt__pop");
|
|
10745
|
+
if (!pop) return;
|
|
10746
|
+
const r2 = pop.getBoundingClientRect();
|
|
10747
|
+
const step = e.shiftKey ? 4 : 20;
|
|
10748
|
+
const dir = typeof getComputedStyle !== "undefined" && getComputedStyle(pop).direction === "rtl" ? -1 : 1;
|
|
10749
|
+
let w = r2.width, h = r2.height;
|
|
10750
|
+
if (e.key === "ArrowRight") w += step * dir;
|
|
10751
|
+
else if (e.key === "ArrowLeft") w -= step * dir;
|
|
10752
|
+
else if (e.key === "ArrowDown") h += step;
|
|
10753
|
+
else if (e.key === "ArrowUp") h -= step;
|
|
10754
|
+
else if (e.key === "Home") {
|
|
10755
|
+
w = popMinW(id);
|
|
10756
|
+
h = 120;
|
|
10757
|
+
} else if (e.key === "End") {
|
|
10758
|
+
w = fMaxW();
|
|
10759
|
+
h = fMaxH();
|
|
10760
|
+
}
|
|
10761
|
+
setPopSizes((s) => ({ ...s, [id]: { w: clampNum(w, popMinW(id), fMaxW()), h: clampNum(h, 120, fMaxH()) } }));
|
|
10762
|
+
};
|
|
10763
|
+
const popStyle = (id) => popSizes[id] ? { "--twc-dt-pop-w": `${popSizes[id].w}px`, "--twc-dt-pop-h": `${popSizes[id].h}px` } : null;
|
|
10764
|
+
const popGrip = (id) => resizablePopovers ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
10765
|
+
"span",
|
|
10766
|
+
{
|
|
10767
|
+
className: "twc-dt__pop-grip",
|
|
10768
|
+
role: "slider",
|
|
10769
|
+
tabIndex: 0,
|
|
10770
|
+
"aria-label": "Resize panel (Enter or double-click to reset)",
|
|
10771
|
+
"aria-valuetext": popSizes[id] ? `Width ${Math.round(popSizes[id].w)} pixels, height ${Math.round(popSizes[id].h)} pixels` : "Default size",
|
|
10772
|
+
onPointerDown: startPopResize(id),
|
|
10773
|
+
onKeyDown: onPopGripKey(id),
|
|
10774
|
+
onDoubleClick: (e) => {
|
|
10775
|
+
e.preventDefault();
|
|
10776
|
+
clearPop(id, e.currentTarget.closest(".twc-dt__pop"));
|
|
10777
|
+
}
|
|
10778
|
+
}
|
|
10779
|
+
) : null;
|
|
10780
|
+
const fieldHandle = (field, rowIdx) => (resizableFilters || resizablePopovers) && rowIdx === 0 ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
10651
10781
|
"span",
|
|
10652
10782
|
{
|
|
10653
10783
|
className: "twc-dt__f-rz",
|
|
@@ -10769,7 +10899,7 @@ function Datatable({
|
|
|
10769
10899
|
onDragEnd: reorderable ? () => setRowDrag({ from: null, over: null, after: false }) : void 0,
|
|
10770
10900
|
onClick: (e) => handleRowClick(e, k, row),
|
|
10771
10901
|
children: [
|
|
10772
|
-
checkboxSelection ? /* @__PURE__ */ jsxRuntime.jsxs("td", { className: "twc-dt__td", role: "gridcell", "data-pin": "left", "data-pin-edge":
|
|
10902
|
+
checkboxSelection ? /* @__PURE__ */ jsxRuntime.jsxs("td", { className: "twc-dt__td", role: "gridcell", "data-pin": "left", "data-pin-edge": visLeft.length || showRowNum ? void 0 : "left", style: { insetInlineStart: 0, width: CHK_W }, children: [
|
|
10773
10903
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { style: { display: "inline-flex", alignItems: "center", gap: 4 }, children: [
|
|
10774
10904
|
reorderable ? rowHandle(k, midIdx, row) : null,
|
|
10775
10905
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -10794,7 +10924,7 @@ function Datatable({
|
|
|
10794
10924
|
] }),
|
|
10795
10925
|
rowResize && !pinSide ? /* @__PURE__ */ jsxRuntime.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
|
|
10796
10926
|
] }) : null,
|
|
10797
|
-
showRowNum ? /* @__PURE__ */ jsxRuntime.jsx("td", { className: "twc-dt__td twc-dt__rownum", role: "gridcell", "aria-hidden": "true", "data-pin": "left", "data-pin-edge":
|
|
10927
|
+
showRowNum ? /* @__PURE__ */ jsxRuntime.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,
|
|
10798
10928
|
ordered.map((c, ci) => {
|
|
10799
10929
|
const st = stickyOf(c.field);
|
|
10800
10930
|
const val = getColVal(c, row);
|
|
@@ -11204,7 +11334,7 @@ function Datatable({
|
|
|
11204
11334
|
onKeyDown: onGridKeyDown,
|
|
11205
11335
|
children: [
|
|
11206
11336
|
/* @__PURE__ */ jsxRuntime.jsx("thead", { ref: theadRef, children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { role: "row", "aria-rowindex": 1, children: [
|
|
11207
|
-
checkboxSelection ? /* @__PURE__ */ jsxRuntime.jsx("th", { className: "twc-dt__th", role: "columnheader", "aria-label": "Select", "data-pin": "left", "data-pin-edge":
|
|
11337
|
+
checkboxSelection ? /* @__PURE__ */ jsxRuntime.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: 0, width: CHK_W, minWidth: CHK_W }, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "twc-dt__th-inner", style: { justifyContent: "center", padding: 0 }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
11208
11338
|
"span",
|
|
11209
11339
|
{
|
|
11210
11340
|
className: "twc-dt__check",
|
|
@@ -11224,7 +11354,7 @@ function Datatable({
|
|
|
11224
11354
|
children: /* @__PURE__ */ jsxRuntime.jsx(Svg, { d: allSel ? I.check : I.minus })
|
|
11225
11355
|
}
|
|
11226
11356
|
) }) }) : null,
|
|
11227
|
-
showRowNum ? /* @__PURE__ */ jsxRuntime.jsx("th", { className: "twc-dt__th twc-dt__rownum", role: "columnheader", "aria-label": "Row number", "data-pin": "left", "data-pin-edge":
|
|
11357
|
+
showRowNum ? /* @__PURE__ */ jsxRuntime.jsx("th", { className: "twc-dt__th twc-dt__rownum", role: "columnheader", "aria-label": "Row number", "data-pin": "left", "data-pin-edge": visLeft.length ? void 0 : "left", style: { insetInlineStart: numLeft, width: NUM_W, minWidth: NUM_W }, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "twc-dt__th-inner", children: [
|
|
11228
11358
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "twc-dt__th-label", style: { flex: "none", cursor: "default" }, children: "#" }),
|
|
11229
11359
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11230
11360
|
"button",
|
|
@@ -11402,8 +11532,8 @@ function Datatable({
|
|
|
11402
11532
|
pinnedBottomRows.map((row) => renderLeaf(row, keyIndex.get(keyOf(row)), "bottom"))
|
|
11403
11533
|
] }) }),
|
|
11404
11534
|
hasAggregation && aggOn && !loading && paged.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("tfoot", { children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { role: "row", children: [
|
|
11405
|
-
checkboxSelection ? /* @__PURE__ */ jsxRuntime.jsx("td", { role: "gridcell", "data-pin": "left", "data-pin-edge":
|
|
11406
|
-
showRowNum ? /* @__PURE__ */ jsxRuntime.jsx("td", { className: "twc-dt__rownum", role: "gridcell", "aria-hidden": "true", "data-pin": "left", "data-pin-edge":
|
|
11535
|
+
checkboxSelection ? /* @__PURE__ */ jsxRuntime.jsx("td", { role: "gridcell", "data-pin": "left", "data-pin-edge": visLeft.length || showRowNum ? void 0 : "left", style: { insetInlineStart: 0, width: CHK_W } }) : null,
|
|
11536
|
+
showRowNum ? /* @__PURE__ */ jsxRuntime.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,
|
|
11407
11537
|
ordered.map((c) => {
|
|
11408
11538
|
const st = stickyOf(c.field);
|
|
11409
11539
|
const v = aggregate(c);
|
|
@@ -11502,7 +11632,7 @@ function Datatable({
|
|
|
11502
11632
|
delete values[f];
|
|
11503
11633
|
return { ...b, fields, values };
|
|
11504
11634
|
});
|
|
11505
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "twc-dt__pop twc-dt__cfg", style: { top: batchEditPos.top, left: batchEditPos.left, width: 320 }, children: [
|
|
11635
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "twc-dt__pop twc-dt__cfg", style: { top: batchEditPos.top, left: batchEditPos.left, width: 320, ...popStyle("batchedit") }, "data-pop-sized": popSizes.batchedit ? "" : void 0, children: [
|
|
11506
11636
|
/* @__PURE__ */ jsxRuntime.jsx(Caret, { pos: batchEditPos }),
|
|
11507
11637
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "twc-dt__cfg-head", children: [
|
|
11508
11638
|
"Edit ",
|
|
@@ -11564,7 +11694,8 @@ function Datatable({
|
|
|
11564
11694
|
"Apply to ",
|
|
11565
11695
|
selected.size
|
|
11566
11696
|
] })
|
|
11567
|
-
] })
|
|
11697
|
+
] }),
|
|
11698
|
+
popGrip("batchedit")
|
|
11568
11699
|
] });
|
|
11569
11700
|
})() : null,
|
|
11570
11701
|
colMenu && menuPos ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -11737,7 +11868,7 @@ function Datatable({
|
|
|
11737
11868
|
]
|
|
11738
11869
|
}
|
|
11739
11870
|
) : null,
|
|
11740
|
-
panel === "columns" && panelPos ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "twc-dt__pop twc-dt__cols", style: { top: panelPos.top, left: panelPos.left }, role: "dialog", "aria-label": "Column settings", children: [
|
|
11871
|
+
panel === "columns" && panelPos ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "twc-dt__pop twc-dt__cols", style: { top: panelPos.top, left: panelPos.left, ...popStyle("columns") }, "data-pop-sized": popSizes.columns ? "" : void 0, role: "dialog", "aria-label": "Column settings", children: [
|
|
11741
11872
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "twc-dt__panel-head", children: [
|
|
11742
11873
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "twc-dt__panel-title", children: [
|
|
11743
11874
|
"Columns ",
|
|
@@ -11862,9 +11993,10 @@ function Datatable({
|
|
|
11862
11993
|
c.field
|
|
11863
11994
|
);
|
|
11864
11995
|
})
|
|
11865
|
-
] })
|
|
11996
|
+
] }),
|
|
11997
|
+
popGrip("columns")
|
|
11866
11998
|
] }) : null,
|
|
11867
|
-
panel === "agg" && panelPos ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "twc-dt__pop twc-dt__cfg", style: { top: panelPos.top, left: panelPos.left, width: 300 }, role: "dialog", "aria-label": "Aggregation settings", children: [
|
|
11999
|
+
panel === "agg" && panelPos ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "twc-dt__pop twc-dt__cfg", style: { top: panelPos.top, left: panelPos.left, width: 300, ...popStyle("agg") }, "data-pop-sized": popSizes.agg ? "" : void 0, role: "dialog", "aria-label": "Aggregation settings", children: [
|
|
11868
12000
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "twc-dt__panel-head", children: [
|
|
11869
12001
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "twc-dt__panel-title", children: "Aggregation" }),
|
|
11870
12002
|
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "twc-dt__link", onClick: () => setAggConfig({}), children: "Clear" })
|
|
@@ -11913,13 +12045,14 @@ function Datatable({
|
|
|
11913
12045
|
}
|
|
11914
12046
|
) })
|
|
11915
12047
|
] }, c.field);
|
|
11916
|
-
}) })
|
|
12048
|
+
}) }),
|
|
12049
|
+
popGrip("agg")
|
|
11917
12050
|
] }) : null,
|
|
11918
12051
|
panel === "pivot" && panelPos ? (() => {
|
|
11919
12052
|
const fieldOpts = ordered.filter((c) => c.type !== "actions").map((c) => ({ value: c.field, label: c.headerName }));
|
|
11920
12053
|
const aggOpts = [{ value: "sum", label: "Sum" }, { value: "avg", label: "Avg" }, { value: "min", label: "Min" }, { value: "max", label: "Max" }, { value: "count", label: "Count" }];
|
|
11921
12054
|
const valueFieldOpts = ordered.filter((c) => c.type !== "actions" && !pivotConfig.values.some((v) => v.field === c.field)).map((c) => ({ value: c.field, label: c.headerName }));
|
|
11922
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "twc-dt__pop twc-dt__cfg", style: { top: panelPos.top, left: panelPos.left, width: 320 }, role: "dialog", "aria-label": "Pivot settings", children: [
|
|
12055
|
+
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: [
|
|
11923
12056
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "twc-dt__panel-head", children: [
|
|
11924
12057
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "twc-dt__panel-title", children: "Pivot" }),
|
|
11925
12058
|
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "twc-dt__link", onClick: () => {
|
|
@@ -11927,106 +12060,109 @@ function Datatable({
|
|
|
11927
12060
|
setPivotOn(false);
|
|
11928
12061
|
}, children: "Reset" })
|
|
11929
12062
|
] }),
|
|
11930
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "twc-
|
|
11931
|
-
/* @__PURE__ */ jsxRuntime.
|
|
11932
|
-
|
|
11933
|
-
|
|
11934
|
-
|
|
11935
|
-
|
|
11936
|
-
|
|
11937
|
-
|
|
11938
|
-
|
|
11939
|
-
|
|
11940
|
-
|
|
11941
|
-
|
|
11942
|
-
|
|
11943
|
-
e.
|
|
11944
|
-
|
|
12063
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "twc-dt__pivot-body", children: [
|
|
12064
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "twc-dt__cfg-toggle", children: [
|
|
12065
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Pivot mode" }),
|
|
12066
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12067
|
+
"span",
|
|
12068
|
+
{
|
|
12069
|
+
className: "twc-dt__sw",
|
|
12070
|
+
"data-on": pivotOn || void 0,
|
|
12071
|
+
role: "switch",
|
|
12072
|
+
"aria-checked": pivotOn,
|
|
12073
|
+
tabIndex: 0,
|
|
12074
|
+
onClick: () => setPivotOn((v) => !v),
|
|
12075
|
+
onKeyDown: (e) => {
|
|
12076
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
12077
|
+
e.preventDefault();
|
|
12078
|
+
setPivotOn((v) => !v);
|
|
12079
|
+
}
|
|
11945
12080
|
}
|
|
11946
12081
|
}
|
|
11947
|
-
|
|
11948
|
-
)
|
|
11949
|
-
|
|
11950
|
-
|
|
11951
|
-
|
|
11952
|
-
|
|
11953
|
-
|
|
11954
|
-
|
|
11955
|
-
|
|
11956
|
-
|
|
11957
|
-
|
|
11958
|
-
|
|
11959
|
-
|
|
11960
|
-
MultiSelect,
|
|
11961
|
-
{
|
|
11962
|
-
portal: true,
|
|
11963
|
-
placeholder: "Add row fields\u2026",
|
|
11964
|
-
value: pivotConfig.rows,
|
|
11965
|
-
options: fieldOpts,
|
|
11966
|
-
onChange: (vals) => {
|
|
11967
|
-
setPivotConfig((p) => ({ ...p, rows: vals }));
|
|
11968
|
-
if (vals.length) setPivotOn(true);
|
|
11969
|
-
}
|
|
11970
|
-
}
|
|
11971
|
-
)
|
|
11972
|
-
] }),
|
|
11973
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "twc-dt__cfg-section", children: [
|
|
11974
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "twc-dt__cfg-label", children: "Columns" }),
|
|
11975
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11976
|
-
MultiSelect,
|
|
11977
|
-
{
|
|
11978
|
-
portal: true,
|
|
11979
|
-
placeholder: "Add column fields\u2026",
|
|
11980
|
-
value: pivotConfig.columns,
|
|
11981
|
-
options: fieldOpts,
|
|
11982
|
-
onChange: (vals) => setPivotConfig((p) => ({ ...p, columns: vals }))
|
|
11983
|
-
}
|
|
11984
|
-
)
|
|
11985
|
-
] }),
|
|
11986
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "twc-dt__cfg-section", children: [
|
|
11987
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "twc-dt__cfg-label", children: "Values" }),
|
|
11988
|
-
pivotConfig.values.map((v, i) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "twc-dt__cfg-row", children: [
|
|
11989
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "twc-dt__cfg-name", children: colByField[v.field]?.headerName || v.field }),
|
|
11990
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "twc-dt__cfg-ctl", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
11991
|
-
Select,
|
|
12082
|
+
)
|
|
12083
|
+
] }),
|
|
12084
|
+
!pivotActive && pivotOn ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "twc-dt__cfg-hint", children: [
|
|
12085
|
+
"Add at least one ",
|
|
12086
|
+
/* @__PURE__ */ jsxRuntime.jsx("b", { children: "Row" }),
|
|
12087
|
+
" field and one ",
|
|
12088
|
+
/* @__PURE__ */ jsxRuntime.jsx("b", { children: "Value" }),
|
|
12089
|
+
" to see the pivot."
|
|
12090
|
+
] }) : null,
|
|
12091
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "twc-dt__cfg-section", children: [
|
|
12092
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "twc-dt__cfg-label", children: "Rows" }),
|
|
12093
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12094
|
+
MultiSelect,
|
|
11992
12095
|
{
|
|
11993
|
-
size: "sm",
|
|
11994
|
-
value: v.agg || "sum",
|
|
11995
|
-
options: aggOpts,
|
|
11996
12096
|
portal: true,
|
|
11997
|
-
|
|
12097
|
+
placeholder: "Add row fields\u2026",
|
|
12098
|
+
value: pivotConfig.rows,
|
|
12099
|
+
options: fieldOpts,
|
|
12100
|
+
onChange: (vals) => {
|
|
12101
|
+
setPivotConfig((p) => ({ ...p, rows: vals }));
|
|
12102
|
+
if (vals.length) setPivotOn(true);
|
|
12103
|
+
}
|
|
11998
12104
|
}
|
|
11999
|
-
)
|
|
12105
|
+
)
|
|
12106
|
+
] }),
|
|
12107
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "twc-dt__cfg-section", children: [
|
|
12108
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "twc-dt__cfg-label", children: "Columns" }),
|
|
12000
12109
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12001
|
-
|
|
12110
|
+
MultiSelect,
|
|
12002
12111
|
{
|
|
12003
|
-
|
|
12004
|
-
|
|
12005
|
-
|
|
12006
|
-
|
|
12007
|
-
|
|
12112
|
+
portal: true,
|
|
12113
|
+
placeholder: "Add column fields\u2026",
|
|
12114
|
+
value: pivotConfig.columns,
|
|
12115
|
+
options: fieldOpts,
|
|
12116
|
+
onChange: (vals) => setPivotConfig((p) => ({ ...p, columns: vals }))
|
|
12008
12117
|
}
|
|
12009
12118
|
)
|
|
12010
|
-
] }
|
|
12011
|
-
|
|
12012
|
-
|
|
12013
|
-
{
|
|
12014
|
-
|
|
12015
|
-
|
|
12016
|
-
|
|
12017
|
-
|
|
12018
|
-
|
|
12019
|
-
|
|
12020
|
-
|
|
12021
|
-
|
|
12022
|
-
|
|
12023
|
-
|
|
12024
|
-
|
|
12119
|
+
] }),
|
|
12120
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "twc-dt__cfg-section", children: [
|
|
12121
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "twc-dt__cfg-label", children: "Values" }),
|
|
12122
|
+
pivotConfig.values.map((v, i) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "twc-dt__cfg-row", children: [
|
|
12123
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "twc-dt__cfg-name", children: colByField[v.field]?.headerName || v.field }),
|
|
12124
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "twc-dt__cfg-ctl", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12125
|
+
Select,
|
|
12126
|
+
{
|
|
12127
|
+
size: "sm",
|
|
12128
|
+
value: v.agg || "sum",
|
|
12129
|
+
options: aggOpts,
|
|
12130
|
+
portal: true,
|
|
12131
|
+
onChange: (a) => setPivotConfig((p) => ({ ...p, values: p.values.map((x, j) => j === i ? { ...x, agg: a } : x) }))
|
|
12132
|
+
}
|
|
12133
|
+
) }),
|
|
12134
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12135
|
+
"button",
|
|
12136
|
+
{
|
|
12137
|
+
type: "button",
|
|
12138
|
+
className: "twc-dt__cfg-x",
|
|
12139
|
+
"aria-label": `Remove ${colByField[v.field]?.headerName || v.field}`,
|
|
12140
|
+
onClick: () => setPivotConfig((p) => ({ ...p, values: p.values.filter((_, j) => j !== i) })),
|
|
12141
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Svg, { d: I.x })
|
|
12142
|
+
}
|
|
12143
|
+
)
|
|
12144
|
+
] }, v.field + i)),
|
|
12145
|
+
valueFieldOpts.length ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "twc-dt__cfg-add", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12146
|
+
Select,
|
|
12147
|
+
{
|
|
12148
|
+
size: "sm",
|
|
12149
|
+
placeholder: "Add value field\u2026",
|
|
12150
|
+
value: "",
|
|
12151
|
+
options: valueFieldOpts,
|
|
12152
|
+
portal: true,
|
|
12153
|
+
searchable: true,
|
|
12154
|
+
searchPlaceholder: "Search fields\u2026",
|
|
12155
|
+
onChange: (f) => {
|
|
12156
|
+
if (f) {
|
|
12157
|
+
setPivotConfig((p) => p.values.some((x) => x.field === f) ? p : { ...p, values: [...p.values, { field: f, agg: "sum" }] });
|
|
12158
|
+
setPivotOn(true);
|
|
12159
|
+
}
|
|
12025
12160
|
}
|
|
12026
12161
|
}
|
|
12027
|
-
}
|
|
12028
|
-
|
|
12029
|
-
] })
|
|
12162
|
+
) }) : null
|
|
12163
|
+
] })
|
|
12164
|
+
] }),
|
|
12165
|
+
popGrip("pivot")
|
|
12030
12166
|
] });
|
|
12031
12167
|
})() : null,
|
|
12032
12168
|
panel === "filters" && panelPos ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -12050,8 +12186,12 @@ function Datatable({
|
|
|
12050
12186
|
children: [
|
|
12051
12187
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "twc-dt__panel-head", children: [
|
|
12052
12188
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "twc-dt__panel-title", children: "Filters" }),
|
|
12053
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { style: { display: "inline-flex", gap:
|
|
12054
|
-
|
|
12189
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { style: { display: "inline-flex", alignItems: "center", gap: 6 }, children: [
|
|
12190
|
+
filters.length > 1 ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "twc-dt__flogic", role: "group", "aria-label": "Combine filters with", children: [
|
|
12191
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "twc-dt__flogic-btn", "data-active": filterLogic === "and" || void 0, "aria-pressed": filterLogic === "and", onClick: () => setFilterLogic("and"), children: "AND" }),
|
|
12192
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "twc-dt__flogic-btn", "data-active": filterLogic === "or" || void 0, "aria-pressed": filterLogic === "or", onClick: () => setFilterLogic("or"), children: "OR" })
|
|
12193
|
+
] }) : null,
|
|
12194
|
+
(resizableFilters || resizablePopovers) && hasFilterSizeOverride ? /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "twc-dt__link", onClick: resetFilterSizes, children: "Reset sizes" }) : null,
|
|
12055
12195
|
filters.length ? /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "twc-dt__link", onClick: () => setFilters([]), children: "Clear all" }) : null
|
|
12056
12196
|
] })
|
|
12057
12197
|
] }),
|
|
@@ -12123,6 +12263,7 @@ function Datatable({
|
|
|
12123
12263
|
),
|
|
12124
12264
|
fieldHandle("val", i)
|
|
12125
12265
|
] }),
|
|
12266
|
+
/* @__PURE__ */ jsxRuntime.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__ */ jsxRuntime.jsx(Svg, { d: I.plus }) }),
|
|
12126
12267
|
/* @__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 }) })
|
|
12127
12268
|
] }, f.id);
|
|
12128
12269
|
}) }),
|
|
@@ -12130,7 +12271,7 @@ function Datatable({
|
|
|
12130
12271
|
/* @__PURE__ */ jsxRuntime.jsx(Svg, { d: I.plus, style: { color: "var(--color-primary)" } }),
|
|
12131
12272
|
" Add filter"
|
|
12132
12273
|
] }) }),
|
|
12133
|
-
resizableFilters ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
12274
|
+
resizableFilters || resizablePopovers ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
12134
12275
|
"span",
|
|
12135
12276
|
{
|
|
12136
12277
|
className: "twc-dt__pop-grip",
|