twico-ui 1.31.0 → 1.32.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 +22 -0
- package/dist/index.cjs +398 -71
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +35 -2
- package/dist/index.d.ts +35 -2
- package/dist/index.mjs +398 -71
- package/dist/index.mjs.map +1 -1
- package/llms.txt +5 -0
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -8191,7 +8191,6 @@ function classifyDiff(from = [], to = [], columns = [], rowKey, opts = {}) {
|
|
|
8191
8191
|
return { rows, counts };
|
|
8192
8192
|
}
|
|
8193
8193
|
var DT_FILTER_PANEL_W = 620;
|
|
8194
|
-
var DT_FILTER_LOGIC_W = 68;
|
|
8195
8194
|
var DT_CSS = `
|
|
8196
8195
|
.twc-dt { display: flex; flex-direction: column; font-family: var(--font-sans); color: var(--color-text);
|
|
8197
8196
|
border: var(--border-thin) solid var(--color-border); border-radius: var(--radius-lg);
|
|
@@ -8433,7 +8432,13 @@ var DT_CSS = `
|
|
|
8433
8432
|
/* #244: batch editor = pick columns (searchable), then set a value for each. */
|
|
8434
8433
|
.twc-dt__be-add { padding: 6px 6px 8px; border-bottom: var(--border-thin) solid var(--color-divider); }
|
|
8435
8434
|
.twc-dt__be-row { display: flex; align-items: center; gap: 8px; padding: 5px 6px; }
|
|
8436
|
-
|
|
8435
|
+
/* #341: cap width at min(260, row \u2212 160px) so the value control keeps ~120px (+ gaps + remove) and never
|
|
8436
|
+
collapses \u2014 panel-width-aware in pure CSS, so it also grows if the (resizable) panel is widened. */
|
|
8437
|
+
.twc-dt__be-name { position: relative; flex: none; width: clamp(88px, var(--twc-dt-be-name-usr, 108px), min(260px, 100% - 160px)); font-size: var(--text-sm); color: var(--color-text); }
|
|
8438
|
+
/* #341: ellipsis lives on the inner text span so the outer field can host the (edge-overhanging) resize handle without clipping it. */
|
|
8439
|
+
.twc-dt__be-name-txt { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
8440
|
+
/* #341: reveal the batch-name resize handle (reused .twc-dt__f-rz) on row hover, like the filter fields. */
|
|
8441
|
+
.twc-dt__be-row:hover .twc-dt__f-rz { opacity: 1; }
|
|
8437
8442
|
.twc-dt__be-ctl { flex: 1; min-width: 0; }
|
|
8438
8443
|
.twc-dt__be-x { flex: none; display: inline-grid; place-items: center; width: 24px; height: 24px; padding: 0; border: none;
|
|
8439
8444
|
background: transparent; color: var(--color-text-subtle); cursor: pointer; border-radius: var(--radius-sm);
|
|
@@ -8498,6 +8503,19 @@ var DT_CSS = `
|
|
|
8498
8503
|
clipping to one line. height stays a per-row minimum, so single-line cells are unchanged. */
|
|
8499
8504
|
.twc-dt__td[data-wrap="true"] { white-space: normal; overflow: hidden; text-overflow: clip;
|
|
8500
8505
|
word-break: break-word; overflow-wrap: anywhere; vertical-align: top; padding-block: 10px; line-height: 1.45; }
|
|
8506
|
+
/* #338: "combined" column cell \u2014 one column showing several source columns' values. */
|
|
8507
|
+
.twc-dt__combine--stack { display: flex; flex-direction: column; gap: 1px; }
|
|
8508
|
+
.twc-dt__combine-sep { color: var(--color-text-subtle); padding-inline: 3px; }
|
|
8509
|
+
.twc-dt__combine-label { color: var(--color-text-muted); font-weight: var(--font-medium); }
|
|
8510
|
+
/* #339: the runtime combine-columns editor panel. */
|
|
8511
|
+
.twc-dt__combine-hint { padding: 2px 12px 8px; font-size: var(--text-xs); color: var(--color-text-muted); }
|
|
8512
|
+
.twc-dt__combine-opts { padding: 8px 12px; border-top: var(--border-thin) solid var(--color-divider); display: flex; flex-direction: column; gap: 8px; }
|
|
8513
|
+
.twc-dt__combine-opt { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: var(--text-sm); color: var(--color-text); }
|
|
8514
|
+
.twc-dt__combine-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; border-top: var(--border-thin) solid var(--color-divider); }
|
|
8515
|
+
.twc-dt__combine-apply { border: none; background: var(--color-primary); color: var(--color-primary-fg); font-family: inherit; font-size: var(--text-sm); font-weight: var(--font-semibold); padding: 6px 14px; border-radius: var(--radius-md); cursor: pointer; }
|
|
8516
|
+
.twc-dt__combine-apply:hover { opacity: 0.9; }
|
|
8517
|
+
.twc-dt__combine-apply:focus-visible { outline: none; box-shadow: var(--ring); }
|
|
8518
|
+
.twc-dt__col-combined { color: var(--color-text-subtle); font-size: var(--text-xs); font-style: italic; }
|
|
8501
8519
|
.twc-dt__td[data-num="true"] { text-align: end; font-variant-numeric: tabular-nums; }
|
|
8502
8520
|
/* Auto row-number gutter (rowNumbers) \u2014 a sticky-left ordinal column. */
|
|
8503
8521
|
.twc-dt__rownum { text-align: end; font-variant-numeric: tabular-nums; color: var(--color-text-subtle);
|
|
@@ -8616,8 +8634,11 @@ th.twc-dt__rownum .twc-dt__th-inner { padding-inline: 8px; gap: 2px; justify-con
|
|
|
8616
8634
|
.twc-dt__link:hover { background: var(--color-primary-subtle); }
|
|
8617
8635
|
/* #330: MUI DataGrid-style per-row And/Or connector. Row 1 shows a static "Where"; the first connector
|
|
8618
8636
|
row (row 2) hosts an editable And/Or Select bound to the single filterLogic; rows 3+ echo it as static
|
|
8619
|
-
text.
|
|
8620
|
-
|
|
8637
|
+
text. Leading cell aligns the Column/Operator/Value cells across rows. It is a first-class resizable
|
|
8638
|
+
filter field like col/op: auto-fit to its content (-fit, from the #289 measurer) with a user drag tier
|
|
8639
|
+
(-usr) winning in the clamp cascade, so it no longer truncates and the width can be adjusted manually. */
|
|
8640
|
+
.twc-dt__f-logic { position: relative; flex: none; min-width: 84px;
|
|
8641
|
+
width: clamp(84px, var(--twc-dt-flogic-usr, var(--twc-dt-flogic-fit, 84px)), var(--twc-dt-flogic-cap, 180px)); }
|
|
8621
8642
|
.twc-dt__f-where { display: inline-flex; align-items: center; height: 38px; padding-inline: 6px; color: var(--color-text-muted); font-size: var(--text-sm); font-weight: var(--font-medium); }
|
|
8622
8643
|
|
|
8623
8644
|
/* Filter panel \u2014 user-resizable (#292): panel size + per-field widths resolve through a two-tier CSS var
|
|
@@ -8829,6 +8850,34 @@ function mergeColOrder(saved, propFields) {
|
|
|
8829
8850
|
return result;
|
|
8830
8851
|
}
|
|
8831
8852
|
var getColVal = (col, row) => col && col.valueGetter ? col.valueGetter(row) : row == null ? void 0 : row[col && col.field];
|
|
8853
|
+
function combineCfg(combine) {
|
|
8854
|
+
if (!combine) return null;
|
|
8855
|
+
const cfg = Array.isArray(combine) ? { fields: combine } : combine;
|
|
8856
|
+
const fields = Array.isArray(cfg.fields) ? cfg.fields.filter((f) => f != null) : [];
|
|
8857
|
+
if (!fields.length) return null;
|
|
8858
|
+
return { fields, separator: cfg.separator != null ? cfg.separator : " \xB7 ", labels: !!cfg.labels, layout: cfg.layout === "stack" ? "stack" : "inline" };
|
|
8859
|
+
}
|
|
8860
|
+
var combineSrcCols = (cfg, byField) => cfg.fields.map((f) => byField && byField[f] || { field: f, headerName: String(f) });
|
|
8861
|
+
var combineValueGetter = (srcCols, cfg) => (row) => srcCols.map((sc) => {
|
|
8862
|
+
const v = getColVal(sc, row);
|
|
8863
|
+
const s = v == null ? "" : String(v);
|
|
8864
|
+
return cfg.labels && s ? `${sc.headerName ?? sc.field}: ${s}` : s;
|
|
8865
|
+
}).filter(Boolean).join(cfg.separator);
|
|
8866
|
+
function renderCombined(srcCols, row, cfg) {
|
|
8867
|
+
const nodes = [];
|
|
8868
|
+
let count = 0;
|
|
8869
|
+
srcCols.forEach((sc, idx) => {
|
|
8870
|
+
const v = getColVal(sc, row);
|
|
8871
|
+
if (v == null || v === "") return;
|
|
8872
|
+
const disp = sc.valueFormatter ? sc.valueFormatter(v, row) : v;
|
|
8873
|
+
const label = cfg.labels ? React51__default.createElement("span", { className: "twc-dt__combine-label" }, (sc.headerName ?? sc.field) + ": ") : null;
|
|
8874
|
+
if (count > 0 && cfg.layout !== "stack") nodes.push(React51__default.createElement("span", { key: "sep" + idx, className: "twc-dt__combine-sep", "aria-hidden": "true" }, cfg.separator));
|
|
8875
|
+
nodes.push(React51__default.createElement("span", { key: idx, className: "twc-dt__combine-item" }, label, disp));
|
|
8876
|
+
count++;
|
|
8877
|
+
});
|
|
8878
|
+
if (!nodes.length) return "";
|
|
8879
|
+
return React51__default.createElement("span", { className: cfg.layout === "stack" ? "twc-dt__combine twc-dt__combine--stack" : "twc-dt__combine" }, nodes);
|
|
8880
|
+
}
|
|
8832
8881
|
var diffValueNode = (col, v, row) => col.renderCell ? col.renderCell(v, row) : col.valueFormatter ? col.valueFormatter(v, row) : v == null ? "" : v;
|
|
8833
8882
|
function renderDiffCell(col, val, row) {
|
|
8834
8883
|
const meta = row && row.__diffMeta;
|
|
@@ -9209,6 +9258,7 @@ function Datatable({
|
|
|
9209
9258
|
aggregationValues = null,
|
|
9210
9259
|
disableColumnReorder = false,
|
|
9211
9260
|
disableColumnResize = false,
|
|
9261
|
+
columnCombining = false,
|
|
9212
9262
|
emptyMessage,
|
|
9213
9263
|
renderEmpty,
|
|
9214
9264
|
editMode = false,
|
|
@@ -9275,9 +9325,19 @@ function Datatable({
|
|
|
9275
9325
|
if (diffData && onClassifiedRef.current) onClassifiedRef.current(diffData.counts);
|
|
9276
9326
|
}, [diffData]);
|
|
9277
9327
|
const diffRowKeyFn = React51__default.useCallback((r2) => r2.__diffKey, []);
|
|
9328
|
+
const [userCombine, setUserCombine] = React51__default.useState({});
|
|
9278
9329
|
const columns = React51__default.useMemo(
|
|
9279
|
-
() =>
|
|
9280
|
-
|
|
9330
|
+
() => {
|
|
9331
|
+
if (!isDiff) return columnsProp;
|
|
9332
|
+
const byField = {};
|
|
9333
|
+
for (const c of columnsProp) if (c && c.field != null) byField[c.field] = c;
|
|
9334
|
+
return [DIFF_OP_COLUMN, ...columnsProp.map((c) => {
|
|
9335
|
+
const cfg = combineCfg(userCombine[c.field] || c.combine);
|
|
9336
|
+
const base = cfg && !c.valueGetter ? { ...c, valueGetter: combineValueGetter(combineSrcCols(cfg, byField), cfg) } : c;
|
|
9337
|
+
return { ...base, renderCell: (val, row) => renderDiffCell(base, val, row) };
|
|
9338
|
+
})];
|
|
9339
|
+
},
|
|
9340
|
+
[isDiff, columnsProp, userCombine]
|
|
9281
9341
|
);
|
|
9282
9342
|
const rows = React51__default.useMemo(
|
|
9283
9343
|
() => isDiff ? diffData.rows.filter((r2) => !diffOnly || r2.op !== "unchanged").map((r2) => ({ ...r2.to || r2.from, __diffop: r2.op, __diffMeta: r2, __diffKey: r2.key })) : rowsProp,
|
|
@@ -9317,8 +9377,26 @@ function Datatable({
|
|
|
9317
9377
|
getActions: () => []
|
|
9318
9378
|
});
|
|
9319
9379
|
}
|
|
9380
|
+
const byField = {};
|
|
9381
|
+
for (const c of out) if (c.field != null) byField[c.field] = c;
|
|
9382
|
+
for (let i = 0; i < out.length; i++) {
|
|
9383
|
+
const c = out[i];
|
|
9384
|
+
const cfg = combineCfg(userCombine[c.field] || c.combine);
|
|
9385
|
+
if (!cfg) continue;
|
|
9386
|
+
const srcCols = combineSrcCols(cfg, byField);
|
|
9387
|
+
out[i] = {
|
|
9388
|
+
...c,
|
|
9389
|
+
editable: false,
|
|
9390
|
+
// the combined value is synthetic — inline editing would write to a phantom field
|
|
9391
|
+
valueGetter: c.valueGetter || combineValueGetter(srcCols, cfg),
|
|
9392
|
+
// Consumer renderCell wins. If they overrode only valueGetter, fall back to the DEFAULT cell render
|
|
9393
|
+
// (renderCell: undefined) so the cell shows THEIR value — keeping display in sync with what
|
|
9394
|
+
// sort/filter/search/export use — rather than the auto source-join. Otherwise render the combined cell.
|
|
9395
|
+
renderCell: c.renderCell || (c.valueGetter ? void 0 : ((value, row) => renderCombined(srcCols, row, cfg)))
|
|
9396
|
+
};
|
|
9397
|
+
}
|
|
9320
9398
|
return out;
|
|
9321
|
-
}, [columns, rowPinning]);
|
|
9399
|
+
}, [columns, rowPinning, userCombine]);
|
|
9322
9400
|
const _autoKey = React51__default.useRef();
|
|
9323
9401
|
if (!_autoKey.current) _autoKey.current = { map: /* @__PURE__ */ new WeakMap(), n: 0 };
|
|
9324
9402
|
const keyOf = rowKey || ((r2, i) => {
|
|
@@ -9352,6 +9430,42 @@ function Datatable({
|
|
|
9352
9430
|
n.has(field) ? n.delete(field) : n.add(field);
|
|
9353
9431
|
return n;
|
|
9354
9432
|
});
|
|
9433
|
+
const openCombineEditor = (field) => {
|
|
9434
|
+
const existing = userCombine[field];
|
|
9435
|
+
setCombineTarget(field);
|
|
9436
|
+
setCombineDraft({
|
|
9437
|
+
selected: existing ? existing.fields.filter((f) => f !== field) : [],
|
|
9438
|
+
layout: existing && existing.layout === "stack" ? "stack" : "inline",
|
|
9439
|
+
labels: !!(existing && existing.labels)
|
|
9440
|
+
});
|
|
9441
|
+
};
|
|
9442
|
+
const closeCombineEditor = () => {
|
|
9443
|
+
setPanel(null);
|
|
9444
|
+
closePanel();
|
|
9445
|
+
setCombineTarget(null);
|
|
9446
|
+
setCombineDraft(null);
|
|
9447
|
+
restoreTriggerFocus();
|
|
9448
|
+
};
|
|
9449
|
+
const applyCombine = () => {
|
|
9450
|
+
if (!combineTarget || !combineDraft) return;
|
|
9451
|
+
const field = combineTarget;
|
|
9452
|
+
const sources = combineDraft.selected.filter((f) => f !== field);
|
|
9453
|
+
setUserCombine((m) => {
|
|
9454
|
+
const next = { ...m };
|
|
9455
|
+
if (sources.length) next[field] = { fields: [field, ...sources], layout: combineDraft.layout === "stack" ? "stack" : "inline", separator: " \xB7 ", labels: !!combineDraft.labels };
|
|
9456
|
+
else delete next[field];
|
|
9457
|
+
return next;
|
|
9458
|
+
});
|
|
9459
|
+
closeCombineEditor();
|
|
9460
|
+
};
|
|
9461
|
+
const uncombine = (field) => {
|
|
9462
|
+
setUserCombine((m) => {
|
|
9463
|
+
const next = { ...m };
|
|
9464
|
+
delete next[field];
|
|
9465
|
+
return next;
|
|
9466
|
+
});
|
|
9467
|
+
closeCombineEditor();
|
|
9468
|
+
};
|
|
9355
9469
|
const [pins, setPins] = React51__default.useState(() => {
|
|
9356
9470
|
const left = [], right = [];
|
|
9357
9471
|
columns.forEach((c) => {
|
|
@@ -9413,6 +9527,7 @@ function Datatable({
|
|
|
9413
9527
|
const rowFocusRef = React51__default.useRef(null);
|
|
9414
9528
|
const [fWidths, setFWidths] = React51__default.useState({});
|
|
9415
9529
|
const [fPanelSize, setFPanelSize] = React51__default.useState(null);
|
|
9530
|
+
const [batchNameW, setBatchNameW] = React51__default.useState(null);
|
|
9416
9531
|
const [popSizes, setPopSizes] = React51__default.useState({});
|
|
9417
9532
|
const serializeState = () => ({
|
|
9418
9533
|
filters: filters.map(({ id, ...f }) => f),
|
|
@@ -9431,9 +9546,13 @@ function Datatable({
|
|
|
9431
9546
|
density,
|
|
9432
9547
|
// #292: additive, optional — user-resized filter panel + field widths (panel-global, not per column).
|
|
9433
9548
|
filterPanelSize: fPanelSize || void 0,
|
|
9434
|
-
filterFieldWidths: fWidths.col != null || fWidths.op != null || fWidths.val != null ? fWidths : void 0,
|
|
9549
|
+
filterFieldWidths: fWidths.col != null || fWidths.op != null || fWidths.val != null || fWidths.logic != null ? fWidths : void 0,
|
|
9435
9550
|
// #304: additive, optional — user-resized sizes of the other toolbar popovers, keyed by popover id.
|
|
9436
|
-
popoverSizes: Object.keys(popSizes).length ? popSizes : void 0
|
|
9551
|
+
popoverSizes: Object.keys(popSizes).length ? popSizes : void 0,
|
|
9552
|
+
// #339: additive, optional — runtime user-defined combined columns, keyed by target field.
|
|
9553
|
+
columnCombine: Object.keys(userCombine).length ? userCombine : void 0,
|
|
9554
|
+
// #341: additive, optional — user-resized batch-editor column-name field width (px).
|
|
9555
|
+
batchNameWidth: batchNameW != null ? batchNameW : void 0
|
|
9437
9556
|
});
|
|
9438
9557
|
const applyState = (s) => {
|
|
9439
9558
|
if (!s || typeof s !== "object") return;
|
|
@@ -9461,7 +9580,7 @@ function Datatable({
|
|
|
9461
9580
|
if (s.density === "compact" || s.density === "standard" || s.density === "comfortable") setDensity(s.density);
|
|
9462
9581
|
if (s.filterFieldWidths && typeof s.filterFieldWidths === "object") {
|
|
9463
9582
|
const fw = {};
|
|
9464
|
-
for (const k of ["col", "op", "val"]) if (typeof s.filterFieldWidths[k] === "number") fw[k] = s.filterFieldWidths[k];
|
|
9583
|
+
for (const k of ["col", "op", "val", "logic"]) if (typeof s.filterFieldWidths[k] === "number") fw[k] = s.filterFieldWidths[k];
|
|
9465
9584
|
if (Object.keys(fw).length) setFWidths(fw);
|
|
9466
9585
|
}
|
|
9467
9586
|
if (s.filterPanelSize && typeof s.filterPanelSize === "object") {
|
|
@@ -9478,6 +9597,16 @@ function Datatable({
|
|
|
9478
9597
|
}
|
|
9479
9598
|
if (Object.keys(next).length) setPopSizes(next);
|
|
9480
9599
|
}
|
|
9600
|
+
if (s.columnCombine && typeof s.columnCombine === "object") {
|
|
9601
|
+
const uc = {};
|
|
9602
|
+
for (const [f, cfg] of Object.entries(s.columnCombine)) {
|
|
9603
|
+
if (!known.has(f) || !cfg || !Array.isArray(cfg.fields)) continue;
|
|
9604
|
+
const rest2 = cfg.fields.filter((x) => known.has(x) && x !== f);
|
|
9605
|
+
if (rest2.length) uc[f] = { fields: [f, ...rest2], layout: cfg.layout === "stack" ? "stack" : "inline", separator: typeof cfg.separator === "string" ? cfg.separator : " \xB7 ", labels: !!cfg.labels };
|
|
9606
|
+
}
|
|
9607
|
+
if (Object.keys(uc).length) setUserCombine(uc);
|
|
9608
|
+
}
|
|
9609
|
+
if (typeof s.batchNameWidth === "number") setBatchNameW(clampNum(s.batchNameWidth, 88, 260));
|
|
9481
9610
|
};
|
|
9482
9611
|
const stateReadyRef = React51__default.useRef(false);
|
|
9483
9612
|
const stateRestoredRef = React51__default.useRef(false);
|
|
@@ -9495,7 +9624,7 @@ function Datatable({
|
|
|
9495
9624
|
}
|
|
9496
9625
|
}
|
|
9497
9626
|
return void 0;
|
|
9498
|
-
}, [filters, filterLogic, sort, quick, pageVal, sizeVal, order, widths, hidden, pins, density, fWidths, fPanelSize, popSizes, stateKey]);
|
|
9627
|
+
}, [filters, filterLogic, sort, quick, pageVal, sizeVal, order, widths, hidden, pins, density, fWidths, fPanelSize, popSizes, userCombine, batchNameW, stateKey]);
|
|
9499
9628
|
const restoreState = () => {
|
|
9500
9629
|
let saved = null;
|
|
9501
9630
|
if (stateKey) {
|
|
@@ -9636,6 +9765,15 @@ function Datatable({
|
|
|
9636
9765
|
const [menuPos, openMenu, closeMenu] = useFloating();
|
|
9637
9766
|
const [panel, setPanel] = React51__default.useState(null);
|
|
9638
9767
|
const [panelPos, openPanel, closePanel] = useFloating();
|
|
9768
|
+
const [combineTarget, setCombineTarget] = React51__default.useState(null);
|
|
9769
|
+
const [combineDraft, setCombineDraft] = React51__default.useState(null);
|
|
9770
|
+
const combinePanelRef = React51__default.useRef(null);
|
|
9771
|
+
React51__default.useEffect(() => {
|
|
9772
|
+
if (panel === "combine" && combinePanelRef.current) {
|
|
9773
|
+
const el = combinePanelRef.current.querySelector('[role="switch"], button, [tabindex]');
|
|
9774
|
+
(el || combinePanelRef.current).focus?.();
|
|
9775
|
+
}
|
|
9776
|
+
}, [panel]);
|
|
9639
9777
|
const [rowMenu, setRowMenu] = React51__default.useState(null);
|
|
9640
9778
|
const [rowMenuPos, openRowMenu, closeRowMenu] = useFloating();
|
|
9641
9779
|
const [exportOpen, setExportOpen] = React51__default.useState(false);
|
|
@@ -9736,7 +9874,21 @@ function Datatable({
|
|
|
9736
9874
|
};
|
|
9737
9875
|
}, [exportOpen]);
|
|
9738
9876
|
const colByField = React51__default.useMemo(() => Object.fromEntries(cols.map((c) => [c.field, c])), [cols]);
|
|
9739
|
-
const
|
|
9877
|
+
const combineSources = React51__default.useMemo(() => {
|
|
9878
|
+
const s = /* @__PURE__ */ new Set();
|
|
9879
|
+
for (const cfg of Object.values(userCombine)) (cfg && cfg.fields ? cfg.fields : []).slice(1).forEach((f) => s.add(f));
|
|
9880
|
+
return s;
|
|
9881
|
+
}, [userCombine]);
|
|
9882
|
+
const stackCombineTargets = React51__default.useMemo(
|
|
9883
|
+
() => new Set(cols.filter((c) => {
|
|
9884
|
+
const cfg = combineCfg(userCombine[c.field] || c.combine);
|
|
9885
|
+
return cfg && cfg.layout === "stack";
|
|
9886
|
+
}).map((c) => c.field)),
|
|
9887
|
+
[cols, userCombine]
|
|
9888
|
+
);
|
|
9889
|
+
const effectiveHidden = React51__default.useMemo(() => combineSources.size ? /* @__PURE__ */ new Set([...hidden, ...combineSources]) : hidden, [hidden, combineSources]);
|
|
9890
|
+
const effectiveWrapped = React51__default.useMemo(() => stackCombineTargets.size ? /* @__PURE__ */ new Set([...wrapped, ...stackCombineTargets]) : wrapped, [wrapped, stackCombineTargets]);
|
|
9891
|
+
const visibleCols = cols.filter((c) => !effectiveHidden.has(c.field));
|
|
9740
9892
|
const colFieldsKey = JSON.stringify(
|
|
9741
9893
|
cols.filter((c) => typeof c.field === "string" && c.type !== "actions").map((c) => c.field)
|
|
9742
9894
|
);
|
|
@@ -9755,17 +9907,17 @@ function Datatable({
|
|
|
9755
9907
|
const i = order.indexOf(f);
|
|
9756
9908
|
return i === -1 ? 9999 : i;
|
|
9757
9909
|
};
|
|
9758
|
-
const L = pins.left.map((f) => colByField[f]).filter((c) => c && !
|
|
9759
|
-
const R = pins.right.map((f) => colByField[f]).filter((c) => c && !
|
|
9910
|
+
const L = pins.left.map((f) => colByField[f]).filter((c) => c && !effectiveHidden.has(c.field));
|
|
9911
|
+
const R = pins.right.map((f) => colByField[f]).filter((c) => c && !effectiveHidden.has(c.field));
|
|
9760
9912
|
const mid = visibleCols.filter((c) => !pins.left.includes(c.field) && !pins.right.includes(c.field)).sort((a, b) => orderIdx(a.field) - orderIdx(b.field));
|
|
9761
9913
|
return [...L, ...mid, ...R];
|
|
9762
|
-
}, [pins,
|
|
9914
|
+
}, [pins, effectiveHidden, visibleCols, colByField, order]);
|
|
9763
9915
|
const NUM_W = 56;
|
|
9764
9916
|
const CHK_W = checkboxSelection ? rowReorder ? 68 : 44 : 0;
|
|
9765
9917
|
const numLeft = CHK_W;
|
|
9766
9918
|
const leadW = numLeft + (showRowNum ? NUM_W : 0);
|
|
9767
|
-
const visLeft = React51__default.useMemo(() => pins.left.filter((f) => colByField[f] && !
|
|
9768
|
-
const visRight = React51__default.useMemo(() => pins.right.filter((f) => colByField[f] && !
|
|
9919
|
+
const visLeft = React51__default.useMemo(() => pins.left.filter((f) => colByField[f] && !effectiveHidden.has(f)), [pins.left, colByField, effectiveHidden]);
|
|
9920
|
+
const visRight = React51__default.useMemo(() => pins.right.filter((f) => colByField[f] && !effectiveHidden.has(f)), [pins.right, colByField, effectiveHidden]);
|
|
9769
9921
|
const stickyOf = (field) => {
|
|
9770
9922
|
if (visLeft.includes(field)) {
|
|
9771
9923
|
let off = leadW;
|
|
@@ -10832,9 +10984,11 @@ function Datatable({
|
|
|
10832
10984
|
const pad2 = trigger ? (parseFloat(cs.paddingLeft) || 0) + (parseFloat(cs.paddingRight) || 0) : 24;
|
|
10833
10985
|
const chrome = pad2 + 8 + 16 + 4;
|
|
10834
10986
|
const widest = (labels) => labels.reduce((m, l) => Math.max(m, ctx.measureText(String(l)).width), 0);
|
|
10835
|
-
const
|
|
10987
|
+
const logicW = Math.min(180, Math.max(84, Math.ceil(widest(["And", "Or"]) + chrome)));
|
|
10988
|
+
const colCap = Math.max(118, Math.min(210, el.clientWidth - logicW - 118 - 30 - 30 - 140 - 5 * 6 - 2 * 4));
|
|
10836
10989
|
const colW = Math.min(colCap, Math.max(118, Math.ceil(widest(filterableCols.map((c) => c.headerName ?? c.field)) + chrome)));
|
|
10837
10990
|
const opW = Math.min(170, Math.max(118, Math.ceil(widest(ALL_OP_LABELS) + chrome)));
|
|
10991
|
+
if (Number.isFinite(logicW)) el.style.setProperty("--twc-dt-flogic-fit", `${logicW}px`);
|
|
10838
10992
|
if (Number.isFinite(colW)) el.style.setProperty("--twc-dt-fcol-fit", `${colW}px`);
|
|
10839
10993
|
if (Number.isFinite(opW)) el.style.setProperty("--twc-dt-fop-fit", `${opW}px`);
|
|
10840
10994
|
};
|
|
@@ -10848,10 +11002,10 @@ function Datatable({
|
|
|
10848
11002
|
}
|
|
10849
11003
|
return () => ro?.disconnect();
|
|
10850
11004
|
}, [panel, filterableCols, filters.length]);
|
|
10851
|
-
const F_MIN = { col: 118, op: 118, val: 140 };
|
|
10852
|
-
const F_VAR = { col: "--twc-dt-fcol-usr", op: "--twc-dt-fop-usr", val: "--twc-dt-fval-usr" };
|
|
10853
|
-
const F_SEL = { col: ".twc-dt__f-col", op: ".twc-dt__f-op", val: ".twc-dt__f-val" };
|
|
10854
|
-
const F_LABEL = { col: "column", op: "operator", val: "value" };
|
|
11005
|
+
const F_MIN = { col: 118, op: 118, val: 140, logic: 84 };
|
|
11006
|
+
const F_VAR = { col: "--twc-dt-fcol-usr", op: "--twc-dt-fop-usr", val: "--twc-dt-fval-usr", logic: "--twc-dt-flogic-usr" };
|
|
11007
|
+
const F_SEL = { col: ".twc-dt__f-col", op: ".twc-dt__f-op", val: ".twc-dt__f-val", logic: ".twc-dt__f-logic" };
|
|
11008
|
+
const F_LABEL = { col: "column", op: "operator", val: "value", logic: "connector" };
|
|
10855
11009
|
const fMaxW = () => typeof window === "undefined" ? 9999 : window.innerWidth - 32;
|
|
10856
11010
|
const fMaxH = () => typeof window === "undefined" ? 9999 : window.innerHeight - 32;
|
|
10857
11011
|
const clampNum = (v, lo, hi) => Math.max(lo, Math.min(hi, Math.round(v)));
|
|
@@ -10860,11 +11014,12 @@ function Datatable({
|
|
|
10860
11014
|
return el ? el.getBoundingClientRect().width : F_MIN[field];
|
|
10861
11015
|
};
|
|
10862
11016
|
const fCap = (field) => {
|
|
11017
|
+
if (field === "logic") return 180;
|
|
10863
11018
|
if (field === "col") return filterFieldMaxWidth || 360;
|
|
10864
11019
|
if (field === "op") return filterFieldMaxWidth || 260;
|
|
10865
11020
|
const p = filterPanelRef.current;
|
|
10866
11021
|
if (!p) return 640;
|
|
10867
|
-
return clampNum(p.clientWidth -
|
|
11022
|
+
return clampNum(p.clientWidth - fLiveW("logic") - fLiveW("col") - fLiveW("op") - 30 - 30 - 5 * 6 - 2 * 4, F_MIN.val, 640);
|
|
10868
11023
|
};
|
|
10869
11024
|
const isRtl = () => {
|
|
10870
11025
|
const p = filterPanelRef.current;
|
|
@@ -10927,6 +11082,54 @@ function Datatable({
|
|
|
10927
11082
|
if (field === "val") p.removeAttribute("data-val-fixed");
|
|
10928
11083
|
}
|
|
10929
11084
|
};
|
|
11085
|
+
const BE_NAME_MIN = 88, BE_NAME_MAX = 260;
|
|
11086
|
+
const startBeNameResize = (e) => {
|
|
11087
|
+
if (e.button != null && e.button !== 0) return;
|
|
11088
|
+
e.preventDefault();
|
|
11089
|
+
e.stopPropagation();
|
|
11090
|
+
const handle = e.currentTarget;
|
|
11091
|
+
const panel2 = handle.closest(".twc-dt__cfg"), nameEl = handle.closest(".twc-dt__be-name");
|
|
11092
|
+
if (!panel2 || !nameEl) return;
|
|
11093
|
+
const startX = e.clientX, startW = nameEl.getBoundingClientRect().width;
|
|
11094
|
+
const dir = getComputedStyle(panel2).direction === "rtl" ? -1 : 1;
|
|
11095
|
+
handle.setAttribute("data-active", "true");
|
|
11096
|
+
let last = startW;
|
|
11097
|
+
const onMove = (ev) => {
|
|
11098
|
+
last = clampNum(startW + (ev.clientX - startX) * dir, BE_NAME_MIN, BE_NAME_MAX);
|
|
11099
|
+
panel2.style.setProperty("--twc-dt-be-name-usr", `${last}px`);
|
|
11100
|
+
};
|
|
11101
|
+
const onUp = () => {
|
|
11102
|
+
setBatchNameW(last);
|
|
11103
|
+
handle.removeAttribute("data-active");
|
|
11104
|
+
window.removeEventListener("pointermove", onMove);
|
|
11105
|
+
window.removeEventListener("pointerup", onUp);
|
|
11106
|
+
};
|
|
11107
|
+
window.addEventListener("pointermove", onMove);
|
|
11108
|
+
window.addEventListener("pointerup", onUp);
|
|
11109
|
+
};
|
|
11110
|
+
const onBeNameResizeKey = (e) => {
|
|
11111
|
+
const panel2 = e.currentTarget.closest(".twc-dt__cfg");
|
|
11112
|
+
if (e.key === "Enter" || e.key === " " || e.key === "Backspace") {
|
|
11113
|
+
e.preventDefault();
|
|
11114
|
+
e.stopPropagation();
|
|
11115
|
+
setBatchNameW(null);
|
|
11116
|
+
if (panel2) panel2.style.removeProperty("--twc-dt-be-name-usr");
|
|
11117
|
+
return;
|
|
11118
|
+
}
|
|
11119
|
+
if (!["ArrowLeft", "ArrowRight", "Home", "End"].includes(e.key)) return;
|
|
11120
|
+
e.preventDefault();
|
|
11121
|
+
e.stopPropagation();
|
|
11122
|
+
const nameEl = e.currentTarget.closest(".twc-dt__be-name");
|
|
11123
|
+
const cur = nameEl ? nameEl.getBoundingClientRect().width : batchNameW ?? 108;
|
|
11124
|
+
const dir = panel2 && getComputedStyle(panel2).direction === "rtl" ? -1 : 1;
|
|
11125
|
+
const step = e.shiftKey ? 2 : 10;
|
|
11126
|
+
let next = cur;
|
|
11127
|
+
if (e.key === "ArrowRight") next = cur + step * dir;
|
|
11128
|
+
else if (e.key === "ArrowLeft") next = cur - step * dir;
|
|
11129
|
+
else if (e.key === "Home") next = BE_NAME_MIN;
|
|
11130
|
+
else if (e.key === "End") next = BE_NAME_MAX;
|
|
11131
|
+
setBatchNameW(clampNum(next, BE_NAME_MIN, BE_NAME_MAX));
|
|
11132
|
+
};
|
|
10930
11133
|
const startPanelResize = (e) => {
|
|
10931
11134
|
if (e.button != null && e.button !== 0) return;
|
|
10932
11135
|
e.preventDefault();
|
|
@@ -10997,12 +11200,12 @@ function Datatable({
|
|
|
10997
11200
|
setFPanelSize(null);
|
|
10998
11201
|
const p = filterPanelRef.current;
|
|
10999
11202
|
if (p) {
|
|
11000
|
-
["--twc-dt-fcol-usr", "--twc-dt-fop-usr", "--twc-dt-fval-usr", "--twc-dt-panel-w", "--twc-dt-panel-h"].forEach((v) => p.style.removeProperty(v));
|
|
11203
|
+
["--twc-dt-fcol-usr", "--twc-dt-fop-usr", "--twc-dt-fval-usr", "--twc-dt-flogic-usr", "--twc-dt-panel-w", "--twc-dt-panel-h"].forEach((v) => p.style.removeProperty(v));
|
|
11001
11204
|
p.removeAttribute("data-val-fixed");
|
|
11002
11205
|
p.removeAttribute("data-panel-sized");
|
|
11003
11206
|
}
|
|
11004
11207
|
};
|
|
11005
|
-
const hasFilterSizeOverride = fWidths.col != null || fWidths.op != null || fWidths.val != null || fPanelSize != null;
|
|
11208
|
+
const hasFilterSizeOverride = fWidths.col != null || fWidths.op != null || fWidths.val != null || fWidths.logic != null || fPanelSize != null;
|
|
11006
11209
|
const POP_MIN_W = { columns: 240, agg: 240, pivot: 260, batchedit: 260 };
|
|
11007
11210
|
const popMinW = (id) => POP_MIN_W[id] || 200;
|
|
11008
11211
|
const clearPop = (id, node) => {
|
|
@@ -11149,7 +11352,7 @@ function Datatable({
|
|
|
11149
11352
|
const shownColRows = cols.filter((c) => c.field !== "__pinactions__" && c.headerName.toLowerCase().includes(colQuery.trim().toLowerCase())).sort((a, b) => orderIdxOf(a.field) - orderIdxOf(b.field));
|
|
11150
11353
|
const rowNumMatch = rowNumbers && "row number".includes(colQuery.trim().toLowerCase());
|
|
11151
11354
|
const manageableCols = cols.filter((c) => c.field !== "__pinactions__");
|
|
11152
|
-
const visibleColCount = manageableCols.filter((c) => !
|
|
11355
|
+
const visibleColCount = manageableCols.filter((c) => !effectiveHidden.has(c.field)).length;
|
|
11153
11356
|
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) }));
|
|
11154
11357
|
const totalCols = ordered.length + (checkboxSelection ? 1 : 0) + (showRowNum ? 1 : 0);
|
|
11155
11358
|
function renderGroupRow(item) {
|
|
@@ -11307,7 +11510,7 @@ function Datatable({
|
|
|
11307
11510
|
"data-cell-active": cellActive || void 0,
|
|
11308
11511
|
"data-cell-selected": cellSelected || void 0,
|
|
11309
11512
|
"data-copied": cellFlash || void 0,
|
|
11310
|
-
"data-wrap":
|
|
11513
|
+
"data-wrap": effectiveWrapped.has(c.field) || void 0,
|
|
11311
11514
|
"data-pin": st.pin,
|
|
11312
11515
|
"data-pin-edge": st.edge,
|
|
11313
11516
|
style: { width: widthOf(c), ...st.style },
|
|
@@ -12004,7 +12207,7 @@ function Datatable({
|
|
|
12004
12207
|
delete values[f];
|
|
12005
12208
|
return { ...b, fields, values };
|
|
12006
12209
|
});
|
|
12007
|
-
return /* @__PURE__ */ 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: [
|
|
12210
|
+
return /* @__PURE__ */ jsxs("div", { className: "twc-dt__pop twc-dt__cfg", style: { top: batchEditPos.top, left: batchEditPos.left, width: 320, "--twc-dt-be-name-usr": batchNameW != null ? `${batchNameW}px` : void 0, ...popStyle("batchedit") }, "data-pop-sized": popSizes.batchedit ? "" : void 0, children: [
|
|
12008
12211
|
/* @__PURE__ */ jsx(Caret, { pos: batchEditPos }),
|
|
12009
12212
|
/* @__PURE__ */ jsxs("div", { className: "twc-dt__cfg-head", children: [
|
|
12010
12213
|
"Edit ",
|
|
@@ -12025,10 +12228,25 @@ function Datatable({
|
|
|
12025
12228
|
onChange: addField
|
|
12026
12229
|
}
|
|
12027
12230
|
) }) : null,
|
|
12028
|
-
/* @__PURE__ */ jsx("div", { className: "twc-dt__cfg-list", children: pickedCols.length === 0 ? /* @__PURE__ */ jsx("div", { className: "twc-dt__be-empty", children: "Pick a column to set its value on all selected rows." }) : pickedCols.map((c) => {
|
|
12231
|
+
/* @__PURE__ */ jsx("div", { className: "twc-dt__cfg-list", children: pickedCols.length === 0 ? /* @__PURE__ */ jsx("div", { className: "twc-dt__be-empty", children: "Pick a column to set its value on all selected rows." }) : pickedCols.map((c, i) => {
|
|
12029
12232
|
const opts = c.valueOptions ? c.valueOptions.map((o) => typeof o === "string" ? { value: o, label: o } : o) : null;
|
|
12030
12233
|
return /* @__PURE__ */ jsxs("div", { className: "twc-dt__be-row", children: [
|
|
12031
|
-
/* @__PURE__ */
|
|
12234
|
+
/* @__PURE__ */ jsxs("span", { className: "twc-dt__be-name", title: String(c.headerName ?? c.field), children: [
|
|
12235
|
+
/* @__PURE__ */ jsx("span", { className: "twc-dt__be-name-txt", children: c.headerName }),
|
|
12236
|
+
resizableFilters && i === 0 ? /* @__PURE__ */ jsx(
|
|
12237
|
+
"span",
|
|
12238
|
+
{
|
|
12239
|
+
className: "twc-dt__f-rz",
|
|
12240
|
+
role: "separator",
|
|
12241
|
+
"aria-orientation": "vertical",
|
|
12242
|
+
tabIndex: 0,
|
|
12243
|
+
"aria-label": "Resize column name field (Enter to reset)",
|
|
12244
|
+
onPointerDown: startBeNameResize,
|
|
12245
|
+
onClick: (e) => e.stopPropagation(),
|
|
12246
|
+
onKeyDown: onBeNameResizeKey
|
|
12247
|
+
}
|
|
12248
|
+
) : null
|
|
12249
|
+
] }),
|
|
12032
12250
|
/* @__PURE__ */ jsx("div", { className: "twc-dt__be-ctl", children: c.renderBatchEditCell ? c.renderBatchEditCell({
|
|
12033
12251
|
value: batchEdit.values[c.field],
|
|
12034
12252
|
field: c.field,
|
|
@@ -12143,6 +12361,18 @@ function Datatable({
|
|
|
12143
12361
|
" ",
|
|
12144
12362
|
groupBy.includes(c.field) ? "Stop grouping" : "Group by this column"
|
|
12145
12363
|
] }) : null,
|
|
12364
|
+
columnCombining && c.type !== "actions" ? /* @__PURE__ */ jsxs("button", { type: "button", role: "menuitem", className: "twc-dt__mi", "data-active": !!userCombine[c.field] || void 0, onClick: () => {
|
|
12365
|
+
const anchor = menuTriggerRef.current;
|
|
12366
|
+
setColMenu(null);
|
|
12367
|
+
closeMenu();
|
|
12368
|
+
openCombineEditor(c.field);
|
|
12369
|
+
setPanel("combine");
|
|
12370
|
+
openPanel(anchor, "right", 300);
|
|
12371
|
+
}, children: [
|
|
12372
|
+
/* @__PURE__ */ jsx(Svg, { d: I.columns }),
|
|
12373
|
+
" ",
|
|
12374
|
+
userCombine[c.field] ? "Edit combined column\u2026" : "Combine columns\u2026"
|
|
12375
|
+
] }) : null,
|
|
12146
12376
|
!disableColumnReorder && c.reorderable !== false && c.type !== "actions" && !pins.left.includes(c.field) && !pins.right.includes(c.field) && movableMidFields.length > 1 ? (() => {
|
|
12147
12377
|
const midIdx = movableMidFields.indexOf(c.field);
|
|
12148
12378
|
const atFirst = midIdx === 0;
|
|
@@ -12310,10 +12540,13 @@ function Datatable({
|
|
|
12310
12540
|
e.preventDefault();
|
|
12311
12541
|
onColDrop(c.field);
|
|
12312
12542
|
} : void 0,
|
|
12313
|
-
onClick: () => c.hideable && toggleHiddenField(c.field),
|
|
12543
|
+
onClick: () => c.hideable && !combineSources.has(c.field) && toggleHiddenField(c.field),
|
|
12314
12544
|
children: [
|
|
12315
12545
|
canDrag ? /* @__PURE__ */ jsx("span", { className: "twc-dt__col-grip", "aria-hidden": "true", children: /* @__PURE__ */ jsx(Svg, { d: I.grip }) }) : null,
|
|
12316
|
-
/* @__PURE__ */
|
|
12546
|
+
/* @__PURE__ */ jsxs("span", { className: "twc-dt__col-name", children: [
|
|
12547
|
+
c.headerName,
|
|
12548
|
+
combineSources.has(c.field) ? /* @__PURE__ */ jsx("span", { className: "twc-dt__col-combined", children: " \xB7 combined" }) : null
|
|
12549
|
+
] }),
|
|
12317
12550
|
c.pinnable && c.type !== "actions" ? (
|
|
12318
12551
|
// Pin from here too, so columns scrolled out of view (no reachable header ⋮) can still be pinned.
|
|
12319
12552
|
/* @__PURE__ */ jsxs("span", { className: "twc-dt__col-pins", draggable: false, onClick: (e) => e.stopPropagation(), children: [
|
|
@@ -12349,19 +12582,19 @@ function Datatable({
|
|
|
12349
12582
|
"span",
|
|
12350
12583
|
{
|
|
12351
12584
|
className: "twc-dt__sw",
|
|
12352
|
-
"data-on": !
|
|
12585
|
+
"data-on": !effectiveHidden.has(c.field) || void 0,
|
|
12353
12586
|
role: "switch",
|
|
12354
|
-
"aria-checked": !
|
|
12587
|
+
"aria-checked": !effectiveHidden.has(c.field),
|
|
12355
12588
|
"aria-label": c.headerName,
|
|
12356
|
-
"aria-disabled": !c.hideable || void 0,
|
|
12357
|
-
tabIndex: c.hideable ? 0 : -1,
|
|
12589
|
+
"aria-disabled": !c.hideable || combineSources.has(c.field) || void 0,
|
|
12590
|
+
tabIndex: c.hideable && !combineSources.has(c.field) ? 0 : -1,
|
|
12358
12591
|
onKeyDown: (e) => {
|
|
12359
|
-
if ((e.key === "Enter" || e.key === " ") && c.hideable) {
|
|
12592
|
+
if ((e.key === "Enter" || e.key === " ") && c.hideable && !combineSources.has(c.field)) {
|
|
12360
12593
|
e.preventDefault();
|
|
12361
12594
|
toggleHiddenField(c.field);
|
|
12362
12595
|
}
|
|
12363
12596
|
},
|
|
12364
|
-
style: c.hideable ? void 0 : { opacity: 0.4 }
|
|
12597
|
+
style: c.hideable && !combineSources.has(c.field) ? void 0 : { opacity: 0.4 }
|
|
12365
12598
|
}
|
|
12366
12599
|
)
|
|
12367
12600
|
]
|
|
@@ -12372,6 +12605,82 @@ function Datatable({
|
|
|
12372
12605
|
] }),
|
|
12373
12606
|
popGrip("columns")
|
|
12374
12607
|
] }) : null,
|
|
12608
|
+
panel === "combine" && panelPos && combineTarget && combineDraft ? (() => {
|
|
12609
|
+
const target = colByField[combineTarget];
|
|
12610
|
+
const candidates = cols.filter((c) => c.field !== combineTarget && c.type !== "actions" && c.field !== "__pinactions__" && c.hideable !== false && !userCombine[c.field]);
|
|
12611
|
+
const toggle = (f) => setCombineDraft((d) => ({ ...d, selected: d.selected.includes(f) ? d.selected.filter((x) => x !== f) : [...d.selected, f] }));
|
|
12612
|
+
return /* @__PURE__ */ jsxs("div", { ref: combinePanelRef, tabIndex: -1, className: "twc-dt__pop twc-dt__cols", style: { top: panelPos.top, left: panelPos.left, ...popStyle("combine") }, "data-pop-sized": popSizes.combine ? "" : void 0, role: "dialog", "aria-label": `Combine columns into ${target?.headerName || combineTarget}`, children: [
|
|
12613
|
+
/* @__PURE__ */ jsx("div", { className: "twc-dt__panel-head", children: /* @__PURE__ */ jsxs("span", { className: "twc-dt__panel-title", children: [
|
|
12614
|
+
"Combine into \u201C",
|
|
12615
|
+
target?.headerName || combineTarget,
|
|
12616
|
+
"\u201D"
|
|
12617
|
+
] }) }),
|
|
12618
|
+
/* @__PURE__ */ jsx("div", { className: "twc-dt__combine-hint", children: "Pick columns to merge into this one \u2014 their data shows in this cell and their own columns hide." }),
|
|
12619
|
+
/* @__PURE__ */ jsx("div", { className: "twc-dt__col-list", children: candidates.length === 0 ? /* @__PURE__ */ jsx("div", { className: "twc-dt__empty", style: { padding: "18px 12px" }, children: "No other columns" }) : candidates.map((c) => {
|
|
12620
|
+
const on = combineDraft.selected.includes(c.field);
|
|
12621
|
+
return /* @__PURE__ */ jsxs("div", { className: "twc-dt__col-row", onClick: () => toggle(c.field), children: [
|
|
12622
|
+
/* @__PURE__ */ jsx("span", { className: "twc-dt__col-name", children: c.headerName }),
|
|
12623
|
+
/* @__PURE__ */ jsx(
|
|
12624
|
+
"span",
|
|
12625
|
+
{
|
|
12626
|
+
className: "twc-dt__sw",
|
|
12627
|
+
"data-on": on || void 0,
|
|
12628
|
+
role: "switch",
|
|
12629
|
+
"aria-checked": on,
|
|
12630
|
+
"aria-label": c.headerName,
|
|
12631
|
+
tabIndex: 0,
|
|
12632
|
+
onKeyDown: (e) => {
|
|
12633
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
12634
|
+
e.preventDefault();
|
|
12635
|
+
toggle(c.field);
|
|
12636
|
+
}
|
|
12637
|
+
}
|
|
12638
|
+
}
|
|
12639
|
+
)
|
|
12640
|
+
] }, c.field);
|
|
12641
|
+
}) }),
|
|
12642
|
+
/* @__PURE__ */ jsxs("div", { className: "twc-dt__combine-opts", children: [
|
|
12643
|
+
/* @__PURE__ */ jsxs("label", { className: "twc-dt__combine-opt", children: [
|
|
12644
|
+
/* @__PURE__ */ jsx("span", { children: "Layout" }),
|
|
12645
|
+
/* @__PURE__ */ jsx(
|
|
12646
|
+
Select,
|
|
12647
|
+
{
|
|
12648
|
+
size: "sm",
|
|
12649
|
+
portal: true,
|
|
12650
|
+
matchTriggerWidth: false,
|
|
12651
|
+
value: combineDraft.layout,
|
|
12652
|
+
options: [{ value: "inline", label: "Inline" }, { value: "stack", label: "Stacked" }],
|
|
12653
|
+
onChange: (v) => setCombineDraft((d) => ({ ...d, layout: v }))
|
|
12654
|
+
}
|
|
12655
|
+
)
|
|
12656
|
+
] }),
|
|
12657
|
+
/* @__PURE__ */ jsxs("div", { className: "twc-dt__combine-opt", onClick: () => setCombineDraft((d) => ({ ...d, labels: !d.labels })), style: { cursor: "pointer" }, children: [
|
|
12658
|
+
/* @__PURE__ */ jsx("span", { children: "Show labels" }),
|
|
12659
|
+
/* @__PURE__ */ jsx(
|
|
12660
|
+
"span",
|
|
12661
|
+
{
|
|
12662
|
+
className: "twc-dt__sw",
|
|
12663
|
+
"data-on": combineDraft.labels || void 0,
|
|
12664
|
+
role: "switch",
|
|
12665
|
+
"aria-checked": combineDraft.labels,
|
|
12666
|
+
"aria-label": "Show labels",
|
|
12667
|
+
tabIndex: 0,
|
|
12668
|
+
onKeyDown: (e) => {
|
|
12669
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
12670
|
+
e.preventDefault();
|
|
12671
|
+
setCombineDraft((d) => ({ ...d, labels: !d.labels }));
|
|
12672
|
+
}
|
|
12673
|
+
}
|
|
12674
|
+
}
|
|
12675
|
+
)
|
|
12676
|
+
] })
|
|
12677
|
+
] }),
|
|
12678
|
+
/* @__PURE__ */ jsxs("div", { className: "twc-dt__combine-foot", children: [
|
|
12679
|
+
userCombine[combineTarget] ? /* @__PURE__ */ jsx("button", { type: "button", className: "twc-dt__link", onClick: () => uncombine(combineTarget), children: "Uncombine" }) : /* @__PURE__ */ jsx("span", {}),
|
|
12680
|
+
/* @__PURE__ */ jsx("button", { type: "button", className: "twc-dt__combine-apply", onClick: applyCombine, children: "Apply" })
|
|
12681
|
+
] })
|
|
12682
|
+
] });
|
|
12683
|
+
})() : null,
|
|
12375
12684
|
panel === "agg" && panelPos ? /* @__PURE__ */ 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: [
|
|
12376
12685
|
/* @__PURE__ */ jsxs("div", { className: "twc-dt__panel-head", children: [
|
|
12377
12686
|
/* @__PURE__ */ jsx("span", { className: "twc-dt__panel-title", children: "Aggregation" }),
|
|
@@ -12552,6 +12861,7 @@ function Datatable({
|
|
|
12552
12861
|
"--twc-dt-fcol-usr": fWidths.col != null ? `${fWidths.col}px` : void 0,
|
|
12553
12862
|
"--twc-dt-fop-usr": fWidths.op != null ? `${fWidths.op}px` : void 0,
|
|
12554
12863
|
"--twc-dt-fval-usr": fWidths.val != null ? `${fWidths.val}px` : void 0,
|
|
12864
|
+
"--twc-dt-flogic-usr": fWidths.logic != null ? `${fWidths.logic}px` : void 0,
|
|
12555
12865
|
"--twc-dt-panel-w": fPanelSize?.w != null ? `${fPanelSize.w}px` : void 0,
|
|
12556
12866
|
"--twc-dt-panel-h": fPanelSize?.h != null ? `${fPanelSize.h}px` : void 0,
|
|
12557
12867
|
"--twc-dt-fcol-cap": filterFieldMaxWidth ? `${filterFieldMaxWidth}px` : void 0,
|
|
@@ -12572,17 +12882,20 @@ function Datatable({
|
|
|
12572
12882
|
const ops = opsFor(filterTypeOf(col));
|
|
12573
12883
|
const op = ops.find((o) => o.value === f.op) || ops[0];
|
|
12574
12884
|
return /* @__PURE__ */ jsxs("div", { className: "twc-dt__frow", children: [
|
|
12575
|
-
/* @__PURE__ */
|
|
12576
|
-
|
|
12577
|
-
|
|
12578
|
-
|
|
12579
|
-
|
|
12580
|
-
|
|
12581
|
-
|
|
12582
|
-
|
|
12583
|
-
|
|
12584
|
-
|
|
12585
|
-
|
|
12885
|
+
/* @__PURE__ */ jsxs("div", { className: "twc-dt__f-logic", children: [
|
|
12886
|
+
i === 0 ? /* @__PURE__ */ jsx("span", { className: "twc-dt__f-where", children: "Where" }) : i === 1 ? /* @__PURE__ */ jsx(
|
|
12887
|
+
Select,
|
|
12888
|
+
{
|
|
12889
|
+
size: "sm",
|
|
12890
|
+
portal: true,
|
|
12891
|
+
"aria-label": "Combine with the other filters",
|
|
12892
|
+
value: filterLogic,
|
|
12893
|
+
options: [{ value: "and", label: "And" }, { value: "or", label: "Or" }],
|
|
12894
|
+
onChange: (v) => setFilterLogic(v)
|
|
12895
|
+
}
|
|
12896
|
+
) : /* @__PURE__ */ jsx("span", { className: "twc-dt__f-where", children: filterLogic === "or" ? "Or" : "And" }),
|
|
12897
|
+
fieldHandle("logic", i)
|
|
12898
|
+
] }),
|
|
12586
12899
|
/* @__PURE__ */ jsxs("div", { className: "twc-dt__f-col", children: [
|
|
12587
12900
|
/* @__PURE__ */ jsx(
|
|
12588
12901
|
Select,
|
|
@@ -15520,6 +15833,8 @@ var ICONBTN_CSS = `
|
|
|
15520
15833
|
.twc-iconbtn:focus-visible { outline: none; box-shadow: var(--ring); }
|
|
15521
15834
|
.twc-iconbtn:active:not(:disabled) { transform: scale(var(--press-scale)); }
|
|
15522
15835
|
.twc-iconbtn:disabled { opacity: 0.5; cursor: not-allowed; }
|
|
15836
|
+
/* #342: disabled state for the anchor form (as="a") \u2014 :disabled doesn't apply to <a>. */
|
|
15837
|
+
.twc-iconbtn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; pointer-events: none; }
|
|
15523
15838
|
.twc-iconbtn svg { width: 1.25em; height: 1.25em; }
|
|
15524
15839
|
|
|
15525
15840
|
/* tone supplies the accent set; variant decides how it's applied \u2014 mirrors Button. Default tone
|
|
@@ -15538,6 +15853,11 @@ var ICONBTN_CSS = `
|
|
|
15538
15853
|
.twc-iconbtn[data-variant="outline"]:hover:not(:disabled) { border-color: var(--_accent); color: var(--_accent); background: var(--color-surface-sunken); }
|
|
15539
15854
|
.twc-iconbtn[data-variant="ghost"]:hover:not(:disabled) { background: var(--color-surface-sunken); color: var(--_accent); }
|
|
15540
15855
|
`;
|
|
15856
|
+
function safeHref6(url) {
|
|
15857
|
+
if (url == null) return void 0;
|
|
15858
|
+
const s = String(url).replace(/[\x00-\x20]+/g, "").toLowerCase();
|
|
15859
|
+
return s.startsWith("javascript:") || s.startsWith("data:") || s.startsWith("vbscript:") ? void 0 : url;
|
|
15860
|
+
}
|
|
15541
15861
|
function IconButton({
|
|
15542
15862
|
children,
|
|
15543
15863
|
icon,
|
|
@@ -15546,21 +15866,28 @@ function IconButton({
|
|
|
15546
15866
|
size = "md",
|
|
15547
15867
|
round = false,
|
|
15548
15868
|
disabled = false,
|
|
15869
|
+
as = "button",
|
|
15870
|
+
href,
|
|
15549
15871
|
className = "",
|
|
15550
15872
|
"aria-label": ariaLabel,
|
|
15551
15873
|
...rest
|
|
15552
15874
|
}) {
|
|
15553
15875
|
const __twcStyles = useScopedStyles("twc-iconbtn-styles", ICONBTN_CSS);
|
|
15876
|
+
const Tag2 = as;
|
|
15877
|
+
const inert = Tag2 === "a" && disabled;
|
|
15554
15878
|
return /* @__PURE__ */ jsxs(
|
|
15555
|
-
|
|
15879
|
+
Tag2,
|
|
15556
15880
|
{
|
|
15557
15881
|
className: `twc-iconbtn ${className}`,
|
|
15558
15882
|
"data-variant": variant,
|
|
15559
15883
|
"data-tone": tone,
|
|
15560
15884
|
"data-size": size,
|
|
15561
15885
|
"data-round": round || void 0,
|
|
15562
|
-
disabled,
|
|
15563
|
-
type: "button",
|
|
15886
|
+
disabled: Tag2 === "button" ? disabled : void 0,
|
|
15887
|
+
type: Tag2 === "button" ? "button" : void 0,
|
|
15888
|
+
href: Tag2 === "a" && !inert ? safeHref6(href) : void 0,
|
|
15889
|
+
"aria-disabled": inert || void 0,
|
|
15890
|
+
tabIndex: inert ? -1 : void 0,
|
|
15564
15891
|
"aria-label": ariaLabel,
|
|
15565
15892
|
...rest,
|
|
15566
15893
|
children: [
|
|
@@ -15762,7 +16089,7 @@ var LIST_CSS = `
|
|
|
15762
16089
|
`;
|
|
15763
16090
|
function List({ items, plain = false, emptyMessage, className = "", ...rest }) {
|
|
15764
16091
|
const __twcStyles = useScopedStyles("twc-list-styles", LIST_CSS);
|
|
15765
|
-
const
|
|
16092
|
+
const safeHref14 = (url) => {
|
|
15766
16093
|
if (url == null) return void 0;
|
|
15767
16094
|
const s = String(url).replace(/[\x00-\x20]+/g, "").toLowerCase();
|
|
15768
16095
|
return s.startsWith("javascript:") || s.startsWith("data:") || s.startsWith("vbscript:") ? void 0 : url;
|
|
@@ -15774,7 +16101,7 @@ function List({ items, plain = false, emptyMessage, className = "", ...rest }) {
|
|
|
15774
16101
|
/* @__PURE__ */ jsxs("ul", { className: `twc-list ${className}`, role: "list", "data-plain": plain || void 0, ...rest, children: [
|
|
15775
16102
|
__twcStyles,
|
|
15776
16103
|
items.length === 0 ? /* @__PURE__ */ jsx("li", { role: "presentation", style: { display: "contents" }, children: /* @__PURE__ */ jsx("div", { className: "twc-list__empty", children: emptyMessage ?? "Nothing here yet" }) }) : items.map((it, i) => {
|
|
15777
|
-
const href =
|
|
16104
|
+
const href = safeHref14(it.href);
|
|
15778
16105
|
const interactive = Boolean(it.onClick || href);
|
|
15779
16106
|
const Tag2 = href ? "a" : interactive ? "button" : "div";
|
|
15780
16107
|
const content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -15830,7 +16157,7 @@ button.twc-navbar__brand, a.twc-navbar__brand { cursor: pointer; }
|
|
|
15830
16157
|
.twc-navbar__menu-btn { display: inline-grid; }
|
|
15831
16158
|
}
|
|
15832
16159
|
`;
|
|
15833
|
-
function
|
|
16160
|
+
function safeHref7(url) {
|
|
15834
16161
|
if (url == null) return void 0;
|
|
15835
16162
|
const s = String(url).replace(/[\x00-\x20]+/g, "").toLowerCase();
|
|
15836
16163
|
return s.startsWith("javascript:") || s.startsWith("data:") || s.startsWith("vbscript:") ? void 0 : url;
|
|
@@ -15853,9 +16180,9 @@ function Navbar({
|
|
|
15853
16180
|
return /* @__PURE__ */ jsxs("header", { className: `twc-navbar ${className}`, "data-sticky": sticky || void 0, ...rest, children: [
|
|
15854
16181
|
__twcStyles,
|
|
15855
16182
|
onMenuClick ? /* @__PURE__ */ jsx("button", { type: "button", className: "twc-navbar__menu-btn", "aria-expanded": menuOpen, "aria-controls": menuControls, "aria-label": menuOpen ? "Close menu" : "Open menu", onClick: onMenuClick, children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx("path", { d: "M4 6h16M4 12h16M4 18h16" }) }) }) : null,
|
|
15856
|
-
brand ? brandHref ? /* @__PURE__ */ jsx("a", { className: "twc-navbar__brand", href:
|
|
16183
|
+
brand ? brandHref ? /* @__PURE__ */ jsx("a", { className: "twc-navbar__brand", href: safeHref7(brandHref), children: brand }) : onBrandClick ? /* @__PURE__ */ jsx("button", { type: "button", className: "twc-navbar__brand", onClick: onBrandClick, children: brand }) : /* @__PURE__ */ jsx("span", { className: "twc-navbar__brand", children: brand }) : null,
|
|
15857
16184
|
/* @__PURE__ */ jsx("nav", { className: "twc-navbar__links", "aria-label": navLabel, children: links.map((l, i) => {
|
|
15858
|
-
const href =
|
|
16185
|
+
const href = safeHref7(l.href);
|
|
15859
16186
|
const inner = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
15860
16187
|
l.icon,
|
|
15861
16188
|
l.label
|
|
@@ -16642,13 +16969,13 @@ function Sidebar({
|
|
|
16642
16969
|
document.addEventListener("keydown", onKey);
|
|
16643
16970
|
return () => document.removeEventListener("keydown", onKey);
|
|
16644
16971
|
}, [overlay, open, openProp, onOpenChange]);
|
|
16645
|
-
const
|
|
16972
|
+
const safeHref14 = (url) => {
|
|
16646
16973
|
if (url == null) return void 0;
|
|
16647
16974
|
const s = String(url).replace(/[\x00-\x20]+/g, "").toLowerCase();
|
|
16648
16975
|
return s.startsWith("javascript:") || s.startsWith("data:") || s.startsWith("vbscript:") ? void 0 : url;
|
|
16649
16976
|
};
|
|
16650
16977
|
const renderItem = (it, i) => {
|
|
16651
|
-
const href =
|
|
16978
|
+
const href = safeHref14(it.href);
|
|
16652
16979
|
const labelStr = typeof it.label === "string" ? it.label : void 0;
|
|
16653
16980
|
const inner = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
16654
16981
|
it.icon ? /* @__PURE__ */ jsx("span", { className: "twc-sidebar__ic", "aria-hidden": "true", children: it.icon }) : labelStr != null ? /* @__PURE__ */ jsx("span", { className: "twc-sidebar__ic twc-sidebar__ic--initial", "aria-hidden": "true", children: labelStr.charAt(0) }) : null,
|
|
@@ -18362,7 +18689,7 @@ function bgValue(bg) {
|
|
|
18362
18689
|
if (BG[bg]) return `var(${BG[bg]})`;
|
|
18363
18690
|
return String(bg).startsWith("--") ? `var(${bg})` : bg;
|
|
18364
18691
|
}
|
|
18365
|
-
function
|
|
18692
|
+
function safeHref8(url) {
|
|
18366
18693
|
if (url == null) return void 0;
|
|
18367
18694
|
const s = String(url).replace(/[\x00-\x20]+/g, "").toLowerCase();
|
|
18368
18695
|
return s.startsWith("javascript:") || s.startsWith("data:") || s.startsWith("vbscript:") ? void 0 : url;
|
|
@@ -18410,7 +18737,7 @@ var Box = React51__default.forwardRef(function Box2({
|
|
|
18410
18737
|
...style,
|
|
18411
18738
|
...flatStyle
|
|
18412
18739
|
};
|
|
18413
|
-
if (Tag2 === "a" && rest.href != null) rest.href =
|
|
18740
|
+
if (Tag2 === "a" && rest.href != null) rest.href = safeHref8(rest.href);
|
|
18414
18741
|
return /* @__PURE__ */ jsxs(Tag2, { ref, className: `twc-box ${className}`.trim(), style: s, "data-twc-sx": sxAttr, ...rest, children: [
|
|
18415
18742
|
styleNode,
|
|
18416
18743
|
children
|
|
@@ -18418,7 +18745,7 @@ var Box = React51__default.forwardRef(function Box2({
|
|
|
18418
18745
|
});
|
|
18419
18746
|
Box.displayName = "Box";
|
|
18420
18747
|
var SIZES = { sm: 640, md: 768, lg: 1024, xl: 1280, full: "100%" };
|
|
18421
|
-
function
|
|
18748
|
+
function safeHref9(url) {
|
|
18422
18749
|
if (url == null) return void 0;
|
|
18423
18750
|
const s = String(url).replace(/[\x00-\x20]+/g, "").toLowerCase();
|
|
18424
18751
|
return s.startsWith("javascript:") || s.startsWith("data:") || s.startsWith("vbscript:") ? void 0 : url;
|
|
@@ -18435,7 +18762,7 @@ var Container = React51__default.forwardRef(function Container2({
|
|
|
18435
18762
|
}, ref) {
|
|
18436
18763
|
const { flatStyle, styleNode, sxAttr } = useSx(sx);
|
|
18437
18764
|
const max = SIZES[size] ?? size;
|
|
18438
|
-
if (Tag2 === "a" && rest.href != null) rest.href =
|
|
18765
|
+
if (Tag2 === "a" && rest.href != null) rest.href = safeHref9(rest.href);
|
|
18439
18766
|
return /* @__PURE__ */ jsxs(
|
|
18440
18767
|
Tag2,
|
|
18441
18768
|
{
|
|
@@ -18466,7 +18793,7 @@ function space2(v) {
|
|
|
18466
18793
|
if (typeof v === "number") return `var(--space-${String(v).replace(".", "-")})`;
|
|
18467
18794
|
return v;
|
|
18468
18795
|
}
|
|
18469
|
-
function
|
|
18796
|
+
function safeHref10(url) {
|
|
18470
18797
|
if (url == null) return void 0;
|
|
18471
18798
|
const s = String(url).replace(/[\x00-\x20]+/g, "").toLowerCase();
|
|
18472
18799
|
return s.startsWith("javascript:") || s.startsWith("data:") || s.startsWith("vbscript:") ? void 0 : url;
|
|
@@ -18494,7 +18821,7 @@ var Stack = React51__default.forwardRef(function Stack2({
|
|
|
18494
18821
|
...rest
|
|
18495
18822
|
}, ref) {
|
|
18496
18823
|
const { flatStyle, styleNode, sxAttr } = useSx(sx);
|
|
18497
|
-
if (Tag2 === "a" && rest.href != null) rest.href =
|
|
18824
|
+
if (Tag2 === "a" && rest.href != null) rest.href = safeHref10(rest.href);
|
|
18498
18825
|
const kids = divider != null ? React51__default.Children.toArray(children).flatMap((child, i, arr) => i < arr.length - 1 ? [child, /* @__PURE__ */ jsx(React51__default.Fragment, { children: divider }, `twc-stack-div-${i}`)] : [child]) : children;
|
|
18499
18826
|
return /* @__PURE__ */ jsxs(
|
|
18500
18827
|
Tag2,
|
|
@@ -18549,7 +18876,7 @@ var CODE_CSS = `
|
|
|
18549
18876
|
.twc-code__copy:focus-visible { outline: none; box-shadow: var(--ring); }
|
|
18550
18877
|
.twc-code__copy svg { width: 15px; height: 15px; display: block; }
|
|
18551
18878
|
`;
|
|
18552
|
-
function
|
|
18879
|
+
function safeHref11(url) {
|
|
18553
18880
|
if (url == null) return void 0;
|
|
18554
18881
|
const s = String(url).replace(/[\x00-\x20]+/g, "").toLowerCase();
|
|
18555
18882
|
return s.startsWith("javascript:") || s.startsWith("data:") || s.startsWith("vbscript:") ? void 0 : url;
|
|
@@ -18566,7 +18893,7 @@ function Code({
|
|
|
18566
18893
|
}) {
|
|
18567
18894
|
const __twcStyles = useScopedStyles("twc-code-styles", CODE_CSS);
|
|
18568
18895
|
const Tag2 = as ?? (block ? "pre" : "code");
|
|
18569
|
-
if (Tag2 === "a" && rest.href != null) rest.href =
|
|
18896
|
+
if (Tag2 === "a" && rest.href != null) rest.href = safeHref11(rest.href);
|
|
18570
18897
|
const rootRef = React51__default.useRef(null);
|
|
18571
18898
|
const [copied, setCopied] = React51__default.useState(false);
|
|
18572
18899
|
const timerRef = React51__default.useRef(null);
|
|
@@ -18591,7 +18918,7 @@ function Code({
|
|
|
18591
18918
|
] });
|
|
18592
18919
|
}
|
|
18593
18920
|
var LEVEL_SIZE = { 1: "4xl", 2: "2xl", 3: "xl", 4: "lg", 5: "base", 6: "sm" };
|
|
18594
|
-
function
|
|
18921
|
+
function safeHref12(url) {
|
|
18595
18922
|
if (url == null) return void 0;
|
|
18596
18923
|
const s = String(url).replace(/[\x00-\x20]+/g, "").toLowerCase();
|
|
18597
18924
|
return s.startsWith("javascript:") || s.startsWith("data:") || s.startsWith("vbscript:") ? void 0 : url;
|
|
@@ -18613,7 +18940,7 @@ var Heading = React51__default.forwardRef(function Heading2({
|
|
|
18613
18940
|
const { flatStyle, styleNode, sxAttr } = useSx(sx);
|
|
18614
18941
|
const Tag2 = as || `h${level}`;
|
|
18615
18942
|
const sz = size || (display ? "display" : LEVEL_SIZE[level]) || "2xl";
|
|
18616
|
-
if (Tag2 === "a" && rest.href != null) rest.href =
|
|
18943
|
+
if (Tag2 === "a" && rest.href != null) rest.href = safeHref12(rest.href);
|
|
18617
18944
|
return /* @__PURE__ */ jsxs(
|
|
18618
18945
|
Tag2,
|
|
18619
18946
|
{
|
|
@@ -18660,7 +18987,7 @@ var TONE = {
|
|
|
18660
18987
|
// Adopt the surrounding color (e.g. inside a solid Button/Badge/Alert or a link).
|
|
18661
18988
|
inherit: "inherit"
|
|
18662
18989
|
};
|
|
18663
|
-
function
|
|
18990
|
+
function safeHref13(url) {
|
|
18664
18991
|
if (url == null) return void 0;
|
|
18665
18992
|
const s = String(url).replace(/[\x00-\x20]+/g, "").toLowerCase();
|
|
18666
18993
|
return s.startsWith("javascript:") || s.startsWith("data:") || s.startsWith("vbscript:") ? void 0 : url;
|
|
@@ -18680,7 +19007,7 @@ var Text = React51__default.forwardRef(function Text2({
|
|
|
18680
19007
|
...rest
|
|
18681
19008
|
}, ref) {
|
|
18682
19009
|
const { flatStyle, styleNode, sxAttr } = useSx(sx);
|
|
18683
|
-
if (Tag2 === "a" && rest.href != null) rest.href =
|
|
19010
|
+
if (Tag2 === "a" && rest.href != null) rest.href = safeHref13(rest.href);
|
|
18684
19011
|
const toneToken = TONE[tone] || TONE.default;
|
|
18685
19012
|
return /* @__PURE__ */ jsxs(
|
|
18686
19013
|
Tag2,
|