@ai-matrx/design-system 0.20.6 → 0.20.9
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 +17 -0
- package/dist/data-table/copy-helpers.cjs.map +1 -1
- package/dist/data-table/copy-helpers.js.map +1 -1
- package/dist/data-table/data-row-inspector.cjs.map +1 -1
- package/dist/data-table/data-row-inspector.js.map +1 -1
- package/dist/data-table/data-row-window.cjs.map +1 -1
- package/dist/data-table/data-row-window.js.map +1 -1
- package/dist/data-table/filter-engine.cjs +6 -2
- package/dist/data-table/filter-engine.cjs.map +1 -1
- package/dist/data-table/filter-engine.d.cts +3 -1
- package/dist/data-table/filter-engine.d.ts +3 -1
- package/dist/data-table/filter-engine.js +6 -2
- package/dist/data-table/filter-engine.js.map +1 -1
- package/dist/data-table/index.cjs +264 -218
- package/dist/data-table/index.cjs.map +1 -1
- package/dist/data-table/index.js +106 -60
- package/dist/data-table/index.js.map +1 -1
- package/dist/data-table/infer-filter.cjs +11 -7
- package/dist/data-table/infer-filter.cjs.map +1 -1
- package/dist/data-table/infer-filter.js +11 -7
- package/dist/data-table/infer-filter.js.map +1 -1
- package/dist/data-table/query-control.cjs +11 -7
- package/dist/data-table/query-control.cjs.map +1 -1
- package/dist/data-table/query-control.js +11 -7
- package/dist/data-table/query-control.js.map +1 -1
- package/dist/data-table/xlsx.cjs.map +1 -1
- package/dist/data-table/xlsx.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -59,7 +59,7 @@ __export(data_table_exports, {
|
|
|
59
59
|
module.exports = __toCommonJS(data_table_exports);
|
|
60
60
|
|
|
61
61
|
// src/data-table/MatrxDataTable.tsx
|
|
62
|
-
var
|
|
62
|
+
var import_react18 = require("react");
|
|
63
63
|
var import_core3 = require("@dnd-kit/core");
|
|
64
64
|
|
|
65
65
|
// src/data-table/icons.tsx
|
|
@@ -219,6 +219,46 @@ var Button = React.forwardRef(
|
|
|
219
219
|
);
|
|
220
220
|
Button.displayName = "Button";
|
|
221
221
|
|
|
222
|
+
// src/data-table/use-column-reorder-animation.ts
|
|
223
|
+
var import_react = require("react");
|
|
224
|
+
function useColumnReorderAnimation(tableRef, order, dragging) {
|
|
225
|
+
const previous = (0, import_react.useRef)({ positions: /* @__PURE__ */ new Map(), dragging: false });
|
|
226
|
+
const animations = (0, import_react.useRef)([]);
|
|
227
|
+
(0, import_react.useLayoutEffect)(() => {
|
|
228
|
+
const table = tableRef.current;
|
|
229
|
+
if (!table) return;
|
|
230
|
+
const headers = Array.from(table.querySelectorAll("th[data-matrx-table-column-id]"));
|
|
231
|
+
const positions = new Map(headers.map((header) => [header.dataset.matrxTableColumnId, header.offsetLeft]));
|
|
232
|
+
const prefersReducedMotion = typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
233
|
+
const shouldAnimate = (dragging || previous.current.dragging) && !prefersReducedMotion;
|
|
234
|
+
const offsets = /* @__PURE__ */ new Map();
|
|
235
|
+
for (const header of headers) {
|
|
236
|
+
const id = header.dataset.matrxTableColumnId;
|
|
237
|
+
const oldLeft = previous.current.positions.get(id);
|
|
238
|
+
if (oldLeft === void 0) continue;
|
|
239
|
+
const transform = getComputedStyle(header).transform;
|
|
240
|
+
const remaining = transform && transform !== "none" ? new DOMMatrixReadOnly(transform).m41 : 0;
|
|
241
|
+
offsets.set(id, oldLeft - header.offsetLeft + remaining);
|
|
242
|
+
}
|
|
243
|
+
animations.current.forEach((animation) => animation.cancel());
|
|
244
|
+
animations.current = [];
|
|
245
|
+
if (shouldAnimate) {
|
|
246
|
+
for (const cell of Array.from(table.querySelectorAll("[data-matrx-table-column-id]"))) {
|
|
247
|
+
const offset = offsets.get(cell.dataset.matrxTableColumnId);
|
|
248
|
+
if (!offset || typeof cell.animate !== "function") continue;
|
|
249
|
+
animations.current.push(cell.animate(
|
|
250
|
+
[{ transform: `translateX(${offset}px)` }, { transform: "translateX(0)" }],
|
|
251
|
+
{ duration: 180, easing: "cubic-bezier(0.2, 0.8, 0.2, 1)" }
|
|
252
|
+
));
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
previous.current = { positions, dragging };
|
|
256
|
+
}, [tableRef, order, dragging]);
|
|
257
|
+
(0, import_react.useLayoutEffect)(() => () => {
|
|
258
|
+
animations.current.forEach((animation) => animation.cancel());
|
|
259
|
+
}, []);
|
|
260
|
+
}
|
|
261
|
+
|
|
222
262
|
// src/data-table/MatrxDataTable.tsx
|
|
223
263
|
var import_format3 = require("@ai-matrx/kit/format");
|
|
224
264
|
|
|
@@ -964,7 +1004,7 @@ function TableTitleRow({
|
|
|
964
1004
|
}
|
|
965
1005
|
|
|
966
1006
|
// src/data-table/TableSearch.tsx
|
|
967
|
-
var
|
|
1007
|
+
var import_react2 = require("react");
|
|
968
1008
|
|
|
969
1009
|
// src/tooltip.tsx
|
|
970
1010
|
var TooltipPrimitive = __toESM(require("@radix-ui/react-tooltip"), 1);
|
|
@@ -995,8 +1035,8 @@ TooltipContent.displayName = TooltipPrimitive.Content.displayName;
|
|
|
995
1035
|
// src/data-table/TableSearch.tsx
|
|
996
1036
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
997
1037
|
function TableSearch({ value, onChange, scope, onScopeChange, scopes, placeholder = "Search\u2026" }) {
|
|
998
|
-
const [expanded, setExpanded] = (0,
|
|
999
|
-
const inputRef = (0,
|
|
1038
|
+
const [expanded, setExpanded] = (0, import_react2.useState)(false);
|
|
1039
|
+
const inputRef = (0, import_react2.useRef)(null);
|
|
1000
1040
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { "data-matrx-table-search": true, className: "h-11 min-w-0 w-full sm:max-w-xs", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1001
1041
|
"div",
|
|
1002
1042
|
{
|
|
@@ -1042,7 +1082,7 @@ function TableSearch({ value, onChange, scope, onScopeChange, scopes, placeholde
|
|
|
1042
1082
|
}
|
|
1043
1083
|
|
|
1044
1084
|
// src/data-table/useScrollPagination.ts
|
|
1045
|
-
var
|
|
1085
|
+
var import_react3 = require("react");
|
|
1046
1086
|
var DEFAULT_THRESHOLD_PX = 96;
|
|
1047
1087
|
var DEFAULT_INTENT_TIMEOUT_MS = 1200;
|
|
1048
1088
|
function resolveContainer(container) {
|
|
@@ -1113,8 +1153,8 @@ function useScrollPagination({
|
|
|
1113
1153
|
intentTimeoutMs = DEFAULT_INTENT_TIMEOUT_MS,
|
|
1114
1154
|
enabled = true
|
|
1115
1155
|
}) {
|
|
1116
|
-
const [requestError, setRequestError] = (0,
|
|
1117
|
-
const latestRef = (0,
|
|
1156
|
+
const [requestError, setRequestError] = (0, import_react3.useState)(null);
|
|
1157
|
+
const latestRef = (0, import_react3.useRef)({
|
|
1118
1158
|
queryKey,
|
|
1119
1159
|
hasNextPage,
|
|
1120
1160
|
isFetchingNextPage,
|
|
@@ -1136,16 +1176,16 @@ function useScrollPagination({
|
|
|
1136
1176
|
thresholdPx,
|
|
1137
1177
|
enabled
|
|
1138
1178
|
};
|
|
1139
|
-
const intentRef = (0,
|
|
1140
|
-
const inputSequenceRef = (0,
|
|
1141
|
-
const consumedSequenceRef = (0,
|
|
1142
|
-
const requestGenerationRef = (0,
|
|
1143
|
-
const inFlightGenerationRef = (0,
|
|
1144
|
-
const requestErrorRef = (0,
|
|
1145
|
-
const mountedRef = (0,
|
|
1146
|
-
const observedTopRef = (0,
|
|
1179
|
+
const intentRef = (0, import_react3.useRef)(null);
|
|
1180
|
+
const inputSequenceRef = (0, import_react3.useRef)(0);
|
|
1181
|
+
const consumedSequenceRef = (0, import_react3.useRef)(0);
|
|
1182
|
+
const requestGenerationRef = (0, import_react3.useRef)(0);
|
|
1183
|
+
const inFlightGenerationRef = (0, import_react3.useRef)(null);
|
|
1184
|
+
const requestErrorRef = (0, import_react3.useRef)(null);
|
|
1185
|
+
const mountedRef = (0, import_react3.useRef)(false);
|
|
1186
|
+
const observedTopRef = (0, import_react3.useRef)(/* @__PURE__ */ new WeakMap());
|
|
1147
1187
|
const effectiveError = error ?? requestError;
|
|
1148
|
-
(0,
|
|
1188
|
+
(0, import_react3.useEffect)(() => {
|
|
1149
1189
|
mountedRef.current = true;
|
|
1150
1190
|
return () => {
|
|
1151
1191
|
mountedRef.current = false;
|
|
@@ -1175,7 +1215,7 @@ function useScrollPagination({
|
|
|
1175
1215
|
}
|
|
1176
1216
|
}
|
|
1177
1217
|
};
|
|
1178
|
-
(0,
|
|
1218
|
+
(0, import_react3.useEffect)(() => {
|
|
1179
1219
|
intentRef.current = null;
|
|
1180
1220
|
observedTopRef.current = /* @__PURE__ */ new WeakMap();
|
|
1181
1221
|
consumedSequenceRef.current = inputSequenceRef.current;
|
|
@@ -1184,7 +1224,7 @@ function useScrollPagination({
|
|
|
1184
1224
|
inFlightGenerationRef.current = null;
|
|
1185
1225
|
requestGenerationRef.current += 1;
|
|
1186
1226
|
}, [queryKey]);
|
|
1187
|
-
(0,
|
|
1227
|
+
(0, import_react3.useEffect)(() => {
|
|
1188
1228
|
if (mode !== "scroll" || !enabled || typeof window === "undefined") return;
|
|
1189
1229
|
const attachable = containers.map(resolveContainer).filter((container) => container !== null);
|
|
1190
1230
|
const ownerCleanups = /* @__PURE__ */ new Map();
|
|
@@ -1280,7 +1320,7 @@ function useScrollPagination({
|
|
|
1280
1320
|
}
|
|
1281
1321
|
|
|
1282
1322
|
// src/data-table/useProgressiveTableRows.ts
|
|
1283
|
-
var
|
|
1323
|
+
var import_react4 = require("react");
|
|
1284
1324
|
function safePageSize(pageSize) {
|
|
1285
1325
|
return Number.isFinite(pageSize) && pageSize > 0 ? Math.floor(pageSize) : 0;
|
|
1286
1326
|
}
|
|
@@ -1303,15 +1343,15 @@ function useProgressiveTableRows({
|
|
|
1303
1343
|
const pageSize = safePageSize(rawPageSize);
|
|
1304
1344
|
const hasExplicitRequestedPage = rawRequestedPage !== void 0;
|
|
1305
1345
|
const requestedPage = safeRequestedPage(rawRequestedPage);
|
|
1306
|
-
const initialRequestedPageRef = (0,
|
|
1307
|
-
const latestRequestedPageRef = (0,
|
|
1308
|
-
const optimisticAdvancePageRef = (0,
|
|
1346
|
+
const initialRequestedPageRef = (0, import_react4.useRef)(requestedPage);
|
|
1347
|
+
const latestRequestedPageRef = (0, import_react4.useRef)(requestedPage);
|
|
1348
|
+
const optimisticAdvancePageRef = (0, import_react4.useRef)(null);
|
|
1309
1349
|
latestRequestedPageRef.current = requestedPage;
|
|
1310
1350
|
const progressionKey = `${queryKey}\0${pageSize}`;
|
|
1311
1351
|
const initialShownCount = startCount(pageSize, initialRequestedPageRef.current);
|
|
1312
1352
|
const resetShownCount = startCount(pageSize, 1);
|
|
1313
1353
|
const queryStartShownCount = hasExplicitRequestedPage ? startCount(pageSize, requestedPage) : resetShownCount;
|
|
1314
|
-
const [progression, setProgression] = (0,
|
|
1354
|
+
const [progression, setProgression] = (0, import_react4.useState)(() => ({
|
|
1315
1355
|
key: progressionKey,
|
|
1316
1356
|
shownCount: initialShownCount,
|
|
1317
1357
|
requestedPage
|
|
@@ -1322,7 +1362,7 @@ function useProgressiveTableRows({
|
|
|
1322
1362
|
const shownCount = progression.key !== progressionKey ? queryStartShownCount : externallyRequestedPage ? startCount(pageSize, requestedPage) : Math.max(progression.shownCount, resetShownCount);
|
|
1323
1363
|
const visibleCount = Math.min(rows.length, shownCount);
|
|
1324
1364
|
const hasMore = enabled && pageSize > 0 && visibleCount < rows.length;
|
|
1325
|
-
(0,
|
|
1365
|
+
(0, import_react4.useEffect)(() => {
|
|
1326
1366
|
setProgression((current) => {
|
|
1327
1367
|
if (current.key !== progressionKey) {
|
|
1328
1368
|
optimisticAdvancePageRef.current = null;
|
|
@@ -1370,7 +1410,7 @@ function useProgressiveTableRows({
|
|
|
1370
1410
|
...thresholdPx === void 0 ? {} : { thresholdPx }
|
|
1371
1411
|
});
|
|
1372
1412
|
return {
|
|
1373
|
-
rows: (0,
|
|
1413
|
+
rows: (0, import_react4.useMemo)(() => rows.slice(0, visibleCount), [rows, visibleCount]),
|
|
1374
1414
|
shownCount: visibleCount,
|
|
1375
1415
|
hasMore,
|
|
1376
1416
|
showMore: scroll.requestNextPage
|
|
@@ -1805,26 +1845,26 @@ function DefaultTableWindow({ title, onClose, width = 720, height = 560, actions
|
|
|
1805
1845
|
}
|
|
1806
1846
|
|
|
1807
1847
|
// src/data-table/useTableNotice.tsx
|
|
1808
|
-
var
|
|
1848
|
+
var import_react6 = require("react");
|
|
1809
1849
|
|
|
1810
1850
|
// src/data-table/host.tsx
|
|
1811
|
-
var
|
|
1851
|
+
var import_react5 = require("react");
|
|
1812
1852
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1813
1853
|
var HOST_SLOT = /* @__PURE__ */ Symbol.for("ai-matrx.design-system.table-host-context");
|
|
1814
1854
|
var hostRegistry = globalThis;
|
|
1815
|
-
var HostContext = hostRegistry[HOST_SLOT] ??= (0,
|
|
1855
|
+
var HostContext = hostRegistry[HOST_SLOT] ??= (0, import_react5.createContext)({});
|
|
1816
1856
|
function MatrxDataTableProvider({ value, children }) {
|
|
1817
1857
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(HostContext.Provider, { value, children });
|
|
1818
1858
|
}
|
|
1819
1859
|
function useMatrxDataTableHost() {
|
|
1820
|
-
return (0,
|
|
1860
|
+
return (0, import_react5.useContext)(HostContext);
|
|
1821
1861
|
}
|
|
1822
1862
|
|
|
1823
1863
|
// src/data-table/useTableNotice.tsx
|
|
1824
1864
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1825
1865
|
function useTableNotice() {
|
|
1826
1866
|
const host = useMatrxDataTableHost();
|
|
1827
|
-
const [message, setMessage] = (0,
|
|
1867
|
+
const [message, setMessage] = (0, import_react6.useState)(null);
|
|
1828
1868
|
const notify = {
|
|
1829
1869
|
success(text) {
|
|
1830
1870
|
if (host.notify) host.notify.success(text);
|
|
@@ -2303,7 +2343,7 @@ var PopoverContent = React13.forwardRef(
|
|
|
2303
2343
|
PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
2304
2344
|
|
|
2305
2345
|
// src/tap-target/tap-target-button.tsx
|
|
2306
|
-
var
|
|
2346
|
+
var import_react7 = require("react");
|
|
2307
2347
|
|
|
2308
2348
|
// src/tap-target/cn.ts
|
|
2309
2349
|
function cn2(...values) {
|
|
@@ -2328,8 +2368,8 @@ function IconContent({
|
|
|
2328
2368
|
className
|
|
2329
2369
|
}) {
|
|
2330
2370
|
if (icon) {
|
|
2331
|
-
if ((0,
|
|
2332
|
-
return (0,
|
|
2371
|
+
if ((0, import_react7.isValidElement)(icon)) {
|
|
2372
|
+
return (0, import_react7.cloneElement)(icon, {
|
|
2333
2373
|
className: cn2(className, icon.props.className)
|
|
2334
2374
|
});
|
|
2335
2375
|
}
|
|
@@ -2572,7 +2612,7 @@ function withTooltip(trigger, {
|
|
|
2572
2612
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TooltipContent, { side: tooltipSide, align: tooltipAlign, children: label })
|
|
2573
2613
|
] });
|
|
2574
2614
|
}
|
|
2575
|
-
var TapTargetButton = (0,
|
|
2615
|
+
var TapTargetButton = (0, import_react7.forwardRef)(function TapTargetButton2({
|
|
2576
2616
|
icon,
|
|
2577
2617
|
children,
|
|
2578
2618
|
strokeWidth = 2,
|
|
@@ -2620,7 +2660,7 @@ var TapTargetButton = (0, import_react6.forwardRef)(function TapTargetButton2({
|
|
|
2620
2660
|
buttonRef: ref
|
|
2621
2661
|
});
|
|
2622
2662
|
});
|
|
2623
|
-
var TapTargetButtonTransparent = (0,
|
|
2663
|
+
var TapTargetButtonTransparent = (0, import_react7.forwardRef)(function TapTargetButtonTransparent2({
|
|
2624
2664
|
icon,
|
|
2625
2665
|
children,
|
|
2626
2666
|
strokeWidth = 2,
|
|
@@ -2668,7 +2708,7 @@ var TapTargetButtonTransparent = (0, import_react6.forwardRef)(function TapTarge
|
|
|
2668
2708
|
buttonRef: ref
|
|
2669
2709
|
});
|
|
2670
2710
|
});
|
|
2671
|
-
var TapTargetButtonSolid = (0,
|
|
2711
|
+
var TapTargetButtonSolid = (0, import_react7.forwardRef)(function TapTargetButtonSolid2({
|
|
2672
2712
|
icon,
|
|
2673
2713
|
children,
|
|
2674
2714
|
strokeWidth = 2,
|
|
@@ -2719,7 +2759,7 @@ var TapTargetButtonSolid = (0, import_react6.forwardRef)(function TapTargetButto
|
|
|
2719
2759
|
buttonRef: ref
|
|
2720
2760
|
});
|
|
2721
2761
|
});
|
|
2722
|
-
var TapTargetButtonDestructive = (0,
|
|
2762
|
+
var TapTargetButtonDestructive = (0, import_react7.forwardRef)(function TapTargetButtonDestructive2({
|
|
2723
2763
|
bgColor = "bg-destructive",
|
|
2724
2764
|
iconColor = "text-destructive-foreground",
|
|
2725
2765
|
hoverBgColor = "hover:bg-destructive/90",
|
|
@@ -2736,7 +2776,7 @@ var TapTargetButtonDestructive = (0, import_react6.forwardRef)(function TapTarge
|
|
|
2736
2776
|
}
|
|
2737
2777
|
);
|
|
2738
2778
|
});
|
|
2739
|
-
var TapTargetButtonForGroup = (0,
|
|
2779
|
+
var TapTargetButtonForGroup = (0, import_react7.forwardRef)(function TapTargetButtonForGroup2({
|
|
2740
2780
|
icon,
|
|
2741
2781
|
children,
|
|
2742
2782
|
strokeWidth = 2,
|
|
@@ -4606,7 +4646,7 @@ function CopyButtons(props) {
|
|
|
4606
4646
|
}
|
|
4607
4647
|
|
|
4608
4648
|
// src/data-table/CopySubset.tsx
|
|
4609
|
-
var
|
|
4649
|
+
var import_react8 = require("react");
|
|
4610
4650
|
var import_clipboard = require("@ai-matrx/kit/clipboard");
|
|
4611
4651
|
|
|
4612
4652
|
// src/data-table/layered-filters.ts
|
|
@@ -4819,6 +4859,9 @@ function compareValues(a, b) {
|
|
|
4819
4859
|
sensitivity: "base"
|
|
4820
4860
|
});
|
|
4821
4861
|
}
|
|
4862
|
+
function selectCellValues(value) {
|
|
4863
|
+
return (Array.isArray(value) ? value : [value]).map(stringifyCellValue).filter((item) => item !== "");
|
|
4864
|
+
}
|
|
4822
4865
|
function passesColumnFilter(value, filter) {
|
|
4823
4866
|
const matches = (() => {
|
|
4824
4867
|
switch (filter.kind) {
|
|
@@ -4835,9 +4878,9 @@ function passesColumnFilter(value, filter) {
|
|
|
4835
4878
|
case "select": {
|
|
4836
4879
|
const selected = filter.values ?? (filter.value && filter.value !== "__all__" ? [filter.value] : []);
|
|
4837
4880
|
if (selected.length === 0) return true;
|
|
4838
|
-
const
|
|
4881
|
+
const values = selectCellValues(value);
|
|
4839
4882
|
return selected.some(
|
|
4840
|
-
(v) => v === SELECT_EMPTY_VALUE ?
|
|
4883
|
+
(v) => v === SELECT_EMPTY_VALUE ? values.length === 0 : v === SELECT_NOT_EMPTY_VALUE ? values.length > 0 : values.includes(v)
|
|
4841
4884
|
);
|
|
4842
4885
|
}
|
|
4843
4886
|
case "boolean": {
|
|
@@ -5092,11 +5135,11 @@ function buildViewHuman(config, visible, columns) {
|
|
|
5092
5135
|
// src/data-table/CopySubset.tsx
|
|
5093
5136
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
5094
5137
|
function CopySubsetDialog({ source, onClose }) {
|
|
5095
|
-
const [rows] = (0,
|
|
5096
|
-
const [hidden, setHidden] = (0,
|
|
5097
|
-
const [selectedIds, setSelectedIds] = (0,
|
|
5098
|
-
const [format, setFormat] = (0,
|
|
5099
|
-
const [query, setQuery] = (0,
|
|
5138
|
+
const [rows] = (0, import_react8.useState)(() => [...source.rows]);
|
|
5139
|
+
const [hidden, setHidden] = (0, import_react8.useState)(() => new Set(source.columns.filter((c) => c.hidden).map((c) => c.id)));
|
|
5140
|
+
const [selectedIds, setSelectedIds] = (0, import_react8.useState)([]);
|
|
5141
|
+
const [format, setFormat] = (0, import_react8.useState)("ai");
|
|
5142
|
+
const [query, setQuery] = (0, import_react8.useState)({ page: 1, pageSize: 50, search: "", anyOf: "", columnFilters: {}, sort: null });
|
|
5100
5143
|
const { notify, notice } = useTableNotice();
|
|
5101
5144
|
const clipboard = (0, import_clipboard.useClipboard)({ notify: (message, kind) => notify[kind](message) });
|
|
5102
5145
|
const columns = source.columns.filter((c) => !hidden.has(c.id));
|
|
@@ -5161,9 +5204,9 @@ function useCopySubsetVariant() {
|
|
|
5161
5204
|
}
|
|
5162
5205
|
|
|
5163
5206
|
// src/data-table/clipping.ts
|
|
5164
|
-
var
|
|
5207
|
+
var import_react9 = require("react");
|
|
5165
5208
|
function useClippedContentGuard(ref, options) {
|
|
5166
|
-
(0,
|
|
5209
|
+
(0, import_react9.useEffect)(() => {
|
|
5167
5210
|
if (!options.enabled || !ref.current) return;
|
|
5168
5211
|
const node = ref.current;
|
|
5169
5212
|
const check = () => {
|
|
@@ -5177,7 +5220,7 @@ function useClippedContentGuard(ref, options) {
|
|
|
5177
5220
|
}
|
|
5178
5221
|
|
|
5179
5222
|
// src/data-table/url-state.ts
|
|
5180
|
-
var
|
|
5223
|
+
var import_react10 = require("react");
|
|
5181
5224
|
var import_url_state = require("@ai-matrx/kit/url-state");
|
|
5182
5225
|
function parseSort(raw) {
|
|
5183
5226
|
if (!raw) return null;
|
|
@@ -5229,11 +5272,11 @@ function useTableUrlState(options) {
|
|
|
5229
5272
|
textHistory = "session"
|
|
5230
5273
|
} = options;
|
|
5231
5274
|
const prefix = tableUrlParamPrefix(tableId);
|
|
5232
|
-
const key = (0,
|
|
5275
|
+
const key = (0, import_react10.useCallback)((name) => `${prefix}.${name}`, [prefix]);
|
|
5233
5276
|
const defaultSortId = defaultSort?.id;
|
|
5234
5277
|
const defaultSortDirection = defaultSort?.direction;
|
|
5235
5278
|
const searchParams = (0, import_url_state.useUrlSearchParams)();
|
|
5236
|
-
const readState = (0,
|
|
5279
|
+
const readState = (0, import_react10.useCallback)(
|
|
5237
5280
|
(params) => {
|
|
5238
5281
|
const initialSort = defaultSortId && defaultSortDirection ? { id: defaultSortId, direction: defaultSortDirection } : null;
|
|
5239
5282
|
return {
|
|
@@ -5254,9 +5297,9 @@ function useTableUrlState(options) {
|
|
|
5254
5297
|
[defaultPageSize, defaultSortDirection, defaultSortId, key]
|
|
5255
5298
|
);
|
|
5256
5299
|
const state = readState(searchParams);
|
|
5257
|
-
const lastTextWriteAt = (0,
|
|
5258
|
-
const [debouncedSearch, setDebouncedSearch] = (0,
|
|
5259
|
-
(0,
|
|
5300
|
+
const lastTextWriteAt = (0, import_react10.useRef)(0);
|
|
5301
|
+
const [debouncedSearch, setDebouncedSearch] = (0, import_react10.useState)(state.search);
|
|
5302
|
+
(0, import_react10.useEffect)(() => {
|
|
5260
5303
|
if (state.search === debouncedSearch) return;
|
|
5261
5304
|
const timer = window.setTimeout(
|
|
5262
5305
|
() => setDebouncedSearch(state.search),
|
|
@@ -5264,7 +5307,7 @@ function useTableUrlState(options) {
|
|
|
5264
5307
|
);
|
|
5265
5308
|
return () => window.clearTimeout(timer);
|
|
5266
5309
|
}, [state.search, debouncedSearch, searchDebounceMs]);
|
|
5267
|
-
const writeState = (0,
|
|
5310
|
+
const writeState = (0, import_react10.useCallback)(
|
|
5268
5311
|
(nextState, mode = history) => {
|
|
5269
5312
|
const params = new URLSearchParams(window.location.search);
|
|
5270
5313
|
const setOrDelete = (name, value) => {
|
|
@@ -5315,7 +5358,7 @@ function useTableUrlState(options) {
|
|
|
5315
5358
|
},
|
|
5316
5359
|
[defaultPageSize, defaultSortDirection, defaultSortId, history, key]
|
|
5317
5360
|
);
|
|
5318
|
-
const onStateChange = (0,
|
|
5361
|
+
const onStateChange = (0, import_react10.useCallback)(
|
|
5319
5362
|
(next) => {
|
|
5320
5363
|
const changed = Object.keys(next).filter(
|
|
5321
5364
|
(name) => JSON.stringify(next[name]) !== JSON.stringify(state[name])
|
|
@@ -5333,7 +5376,7 @@ function useTableUrlState(options) {
|
|
|
5333
5376
|
},
|
|
5334
5377
|
[history, state, textHistory, writeState]
|
|
5335
5378
|
);
|
|
5336
|
-
const reset = (0,
|
|
5379
|
+
const reset = (0, import_react10.useCallback)(() => {
|
|
5337
5380
|
const dSort = defaultSortId && defaultSortDirection ? { id: defaultSortId, direction: defaultSortDirection } : null;
|
|
5338
5381
|
const next = {
|
|
5339
5382
|
page: 1,
|
|
@@ -5349,7 +5392,7 @@ function useTableUrlState(options) {
|
|
|
5349
5392
|
writeState(next);
|
|
5350
5393
|
setDebouncedSearch("");
|
|
5351
5394
|
}, [defaultPageSize, defaultSortDirection, defaultSortId, writeState]);
|
|
5352
|
-
const queryState = (0,
|
|
5395
|
+
const queryState = (0, import_react10.useMemo)(
|
|
5353
5396
|
() => state.search === debouncedSearch ? state : { ...state, search: debouncedSearch, page: 1 },
|
|
5354
5397
|
[state, debouncedSearch]
|
|
5355
5398
|
);
|
|
@@ -5360,7 +5403,7 @@ function useTableUrlState(options) {
|
|
|
5360
5403
|
var import_url_state3 = require("@ai-matrx/kit/url-state");
|
|
5361
5404
|
|
|
5362
5405
|
// src/data-table/ColumnHeaderCell.tsx
|
|
5363
|
-
var
|
|
5406
|
+
var import_react11 = require("react");
|
|
5364
5407
|
var import_core = require("@dnd-kit/core");
|
|
5365
5408
|
|
|
5366
5409
|
// src/command.tsx
|
|
@@ -5508,7 +5551,7 @@ CommandShortcut.displayName = "CommandShortcut";
|
|
|
5508
5551
|
|
|
5509
5552
|
// src/data-table/ColumnHeaderCell.tsx
|
|
5510
5553
|
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
5511
|
-
var HeaderButton = (0,
|
|
5554
|
+
var HeaderButton = (0, import_react11.forwardRef)(({ dragDescription, "aria-describedby": tooltipDescription, ...props }, ref) => {
|
|
5512
5555
|
const descriptions = [tooltipDescription, dragDescription].filter((value) => Boolean(value)).join(" ");
|
|
5513
5556
|
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5514
5557
|
"button",
|
|
@@ -5568,9 +5611,9 @@ function ColumnHeaderCell({
|
|
|
5568
5611
|
const reorderClass = reorderEnabled ? "touch-none cursor-grab active:cursor-grabbing" : void 0;
|
|
5569
5612
|
const filterActive = isColumnFilterActive(filterValue);
|
|
5570
5613
|
const deferredFilter = filterApplyLabel !== void 0 || filterShowCancel || filterFooterHint !== void 0;
|
|
5571
|
-
const [filterOpen, setFilterOpen] = (0,
|
|
5572
|
-
const [draftFilter, setDraftFilter] = (0,
|
|
5573
|
-
(0,
|
|
5614
|
+
const [filterOpen, setFilterOpen] = (0, import_react11.useState)(false);
|
|
5615
|
+
const [draftFilter, setDraftFilter] = (0, import_react11.useState)(filterValue);
|
|
5616
|
+
(0, import_react11.useEffect)(() => {
|
|
5574
5617
|
if (!filterOpen) setDraftFilter(filterValue);
|
|
5575
5618
|
}, [filterOpen, filterValue]);
|
|
5576
5619
|
const applyFilter = () => {
|
|
@@ -5975,8 +6018,8 @@ function SearchableSelectFilter({
|
|
|
5975
6018
|
onChange,
|
|
5976
6019
|
single = false
|
|
5977
6020
|
}) {
|
|
5978
|
-
const [query, setQuery] = (0,
|
|
5979
|
-
const filtered = (0,
|
|
6021
|
+
const [query, setQuery] = (0, import_react11.useState)("");
|
|
6022
|
+
const filtered = (0, import_react11.useMemo)(() => {
|
|
5980
6023
|
const q = query.trim().toLowerCase();
|
|
5981
6024
|
if (!q) return options;
|
|
5982
6025
|
return options.filter(
|
|
@@ -6074,8 +6117,8 @@ function NumberFilterBody({
|
|
|
6074
6117
|
}) {
|
|
6075
6118
|
const min = value?.kind === "number" ? value.min : void 0;
|
|
6076
6119
|
const max = value?.kind === "number" ? value.max : void 0;
|
|
6077
|
-
const [minText, setMinText] = (0,
|
|
6078
|
-
const [maxText, setMaxText] = (0,
|
|
6120
|
+
const [minText, setMinText] = (0, import_react11.useState)(min !== void 0 ? String(min) : "");
|
|
6121
|
+
const [maxText, setMaxText] = (0, import_react11.useState)(max !== void 0 ? String(max) : "");
|
|
6079
6122
|
const commit = (raw, which) => {
|
|
6080
6123
|
const nextMin = which === "min" ? parseOptionalNumber(raw) : min;
|
|
6081
6124
|
const nextMax = which === "max" ? parseOptionalNumber(raw) : max;
|
|
@@ -6143,7 +6186,7 @@ function parseOptionalNumber(raw) {
|
|
|
6143
6186
|
}
|
|
6144
6187
|
|
|
6145
6188
|
// src/data-table/ColumnResizeHandle.tsx
|
|
6146
|
-
var
|
|
6189
|
+
var import_react12 = require("react");
|
|
6147
6190
|
|
|
6148
6191
|
// src/data-table/column-resize.ts
|
|
6149
6192
|
var DEFAULT_COLUMN_MIN_WIDTH = 80;
|
|
@@ -6185,24 +6228,24 @@ function ColumnResizeHandle({
|
|
|
6185
6228
|
onResizeCancel,
|
|
6186
6229
|
onResizeCommit
|
|
6187
6230
|
}) {
|
|
6188
|
-
const handleRef = (0,
|
|
6189
|
-
const activeResizeRef = (0,
|
|
6190
|
-
const previewRafRef = (0,
|
|
6191
|
-
const queuedWidthRef = (0,
|
|
6192
|
-
const keyboardWidthRef = (0,
|
|
6193
|
-
const [announcedWidth, setAnnouncedWidth] = (0,
|
|
6231
|
+
const handleRef = (0, import_react12.useRef)(null);
|
|
6232
|
+
const activeResizeRef = (0, import_react12.useRef)(null);
|
|
6233
|
+
const previewRafRef = (0, import_react12.useRef)(null);
|
|
6234
|
+
const queuedWidthRef = (0, import_react12.useRef)(null);
|
|
6235
|
+
const keyboardWidthRef = (0, import_react12.useRef)(null);
|
|
6236
|
+
const [announcedWidth, setAnnouncedWidth] = (0, import_react12.useState)(null);
|
|
6194
6237
|
const bounds = resolveColumnResizeBounds(minWidth, maxWidth);
|
|
6195
6238
|
const cssVar = columnResizeCssVar(columnId2);
|
|
6196
|
-
const readWidth = (0,
|
|
6239
|
+
const readWidth = (0, import_react12.useCallback)(() => {
|
|
6197
6240
|
const header = handleRef.current?.closest("th");
|
|
6198
6241
|
const measured = header?.getBoundingClientRect().width ?? 0;
|
|
6199
6242
|
const computed = header ? Number.parseFloat(getComputedStyle(header).width) : 0;
|
|
6200
6243
|
return clampColumnWidth(measured || computed || keyboardWidthRef.current || bounds.minWidth, bounds);
|
|
6201
6244
|
}, [bounds]);
|
|
6202
|
-
const writePreview = (0,
|
|
6245
|
+
const writePreview = (0, import_react12.useCallback)((width) => {
|
|
6203
6246
|
tableRef.current?.style.setProperty(cssVar, `${width}px`);
|
|
6204
6247
|
}, [cssVar, tableRef]);
|
|
6205
|
-
const queuePreview = (0,
|
|
6248
|
+
const queuePreview = (0, import_react12.useCallback)((width) => {
|
|
6206
6249
|
queuedWidthRef.current = width;
|
|
6207
6250
|
if (previewRafRef.current !== null) return;
|
|
6208
6251
|
previewRafRef.current = requestAnimationFrame(() => {
|
|
@@ -6212,12 +6255,12 @@ function ColumnResizeHandle({
|
|
|
6212
6255
|
if (nextWidth !== null) writePreview(nextWidth);
|
|
6213
6256
|
});
|
|
6214
6257
|
}, [writePreview]);
|
|
6215
|
-
const clearQueuedPreview = (0,
|
|
6258
|
+
const clearQueuedPreview = (0, import_react12.useCallback)(() => {
|
|
6216
6259
|
if (previewRafRef.current !== null) cancelAnimationFrame(previewRafRef.current);
|
|
6217
6260
|
previewRafRef.current = null;
|
|
6218
6261
|
queuedWidthRef.current = null;
|
|
6219
6262
|
}, []);
|
|
6220
|
-
const finishPointerResize = (0,
|
|
6263
|
+
const finishPointerResize = (0, import_react12.useCallback)((commit) => {
|
|
6221
6264
|
const active = activeResizeRef.current;
|
|
6222
6265
|
if (!active) return;
|
|
6223
6266
|
activeResizeRef.current = null;
|
|
@@ -6237,7 +6280,7 @@ function ColumnResizeHandle({
|
|
|
6237
6280
|
handleRef.current.releasePointerCapture(active.pointerId);
|
|
6238
6281
|
}
|
|
6239
6282
|
}, [clearQueuedPreview, columnId2, cssVar, onResizeCancel, onResizeCommit, tableRef, writePreview]);
|
|
6240
|
-
(0,
|
|
6283
|
+
(0, import_react12.useEffect)(() => () => clearQueuedPreview(), [clearQueuedPreview]);
|
|
6241
6284
|
const onPointerDown = (event) => {
|
|
6242
6285
|
if (disabled || event.button !== 0 || !event.isPrimary) return;
|
|
6243
6286
|
event.preventDefault();
|
|
@@ -6336,8 +6379,8 @@ function projectColumnDragOrder(orderedIds, preview2) {
|
|
|
6336
6379
|
function inferTableSearchRole(field) {
|
|
6337
6380
|
const key = field.replace(/([a-z])([A-Z])/g, "$1_$2").toLowerCase().replace(/[\s-]+/g, "_");
|
|
6338
6381
|
if (key === "id" || key === "uuid" || key.endsWith("_id")) return "id";
|
|
6339
|
-
if (/^(name|label|title|key|slug|display_name|common_name|model_name)$/.test(key) || /_(name|label|title)$/.test(key)) return "name";
|
|
6340
|
-
if (/^(description|summary|details|blurb)$/.test(key) || key.endsWith("_description")) return "description";
|
|
6382
|
+
if (/^(name|alias|label|title|key|slug|display_name|common_name|model_name)$/.test(key) || /_(name|label|title)$/.test(key)) return "name";
|
|
6383
|
+
if (/^(description|summary|details|notes|blurb)$/.test(key) || key.endsWith("_description")) return "description";
|
|
6341
6384
|
return "other";
|
|
6342
6385
|
}
|
|
6343
6386
|
function searchableFields(row, columns) {
|
|
@@ -6392,7 +6435,7 @@ function rankTableSearchRows(rows, columns, query, options = {}, extraText) {
|
|
|
6392
6435
|
}
|
|
6393
6436
|
|
|
6394
6437
|
// src/data-table/ColumnManager.tsx
|
|
6395
|
-
var
|
|
6438
|
+
var import_react13 = require("react");
|
|
6396
6439
|
var import_core2 = require("@dnd-kit/core");
|
|
6397
6440
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
6398
6441
|
function ColumnManager({
|
|
@@ -6403,15 +6446,15 @@ function ColumnManager({
|
|
|
6403
6446
|
hidden,
|
|
6404
6447
|
onApply
|
|
6405
6448
|
}) {
|
|
6406
|
-
const byId = (0,
|
|
6449
|
+
const byId = (0, import_react13.useMemo)(
|
|
6407
6450
|
() => new Map(columns.map((column) => [columnId(column), column])),
|
|
6408
6451
|
[columns]
|
|
6409
6452
|
);
|
|
6410
|
-
const [draftOrder, setDraftOrder] = (0,
|
|
6411
|
-
const [draftHidden, setDraftHidden] = (0,
|
|
6412
|
-
const [draggedColumnId, setDraggedColumnId] = (0,
|
|
6413
|
-
const [dropTarget, setDropTarget] = (0,
|
|
6414
|
-
(0,
|
|
6453
|
+
const [draftOrder, setDraftOrder] = (0, import_react13.useState)(order);
|
|
6454
|
+
const [draftHidden, setDraftHidden] = (0, import_react13.useState)(() => new Set(hidden));
|
|
6455
|
+
const [draggedColumnId, setDraggedColumnId] = (0, import_react13.useState)(null);
|
|
6456
|
+
const [dropTarget, setDropTarget] = (0, import_react13.useState)(null);
|
|
6457
|
+
(0, import_react13.useEffect)(() => {
|
|
6415
6458
|
if (!open) return;
|
|
6416
6459
|
setDraftOrder(order);
|
|
6417
6460
|
setDraftHidden(new Set(hidden));
|
|
@@ -6644,7 +6687,7 @@ function parseTableViewSnapshot(raw) {
|
|
|
6644
6687
|
}
|
|
6645
6688
|
|
|
6646
6689
|
// src/data-table/MatrxUuidCell.tsx
|
|
6647
|
-
var
|
|
6690
|
+
var import_react14 = require("react");
|
|
6648
6691
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
6649
6692
|
var SHORT_LEN = 8;
|
|
6650
6693
|
function shortUuid(id, len = SHORT_LEN) {
|
|
@@ -6684,11 +6727,11 @@ function MatrxUuidCell({
|
|
|
6684
6727
|
}) {
|
|
6685
6728
|
const { resolveEntityDoors, ResourcePeek } = useMatrxDataTableHost();
|
|
6686
6729
|
const { notify, notice } = useTableNotice();
|
|
6687
|
-
const [copied, setCopied] = (0,
|
|
6688
|
-
const [opening, setOpening] = (0,
|
|
6689
|
-
const [peekOpen, setPeekOpen] = (0,
|
|
6690
|
-
const timer = (0,
|
|
6691
|
-
(0,
|
|
6730
|
+
const [copied, setCopied] = (0, import_react14.useState)(false);
|
|
6731
|
+
const [opening, setOpening] = (0, import_react14.useState)(false);
|
|
6732
|
+
const [peekOpen, setPeekOpen] = (0, import_react14.useState)(false);
|
|
6733
|
+
const timer = (0, import_react14.useRef)(null);
|
|
6734
|
+
(0, import_react14.useEffect)(
|
|
6692
6735
|
() => () => {
|
|
6693
6736
|
if (timer.current) clearTimeout(timer.current);
|
|
6694
6737
|
},
|
|
@@ -6983,7 +7026,7 @@ function DataRowInspector({
|
|
|
6983
7026
|
}
|
|
6984
7027
|
|
|
6985
7028
|
// src/data-table/DataRowWindow.tsx
|
|
6986
|
-
var
|
|
7029
|
+
var import_react15 = require("react");
|
|
6987
7030
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
6988
7031
|
function DataRowWindow({
|
|
6989
7032
|
isOpen,
|
|
@@ -7004,8 +7047,8 @@ function DataRowWindow({
|
|
|
7004
7047
|
const hasEdit = editContent != null;
|
|
7005
7048
|
const hasTabs = hasEdit && children == null;
|
|
7006
7049
|
const initialTab = defaultTab ?? (hasEdit ? "edit" : "view");
|
|
7007
|
-
const [tab, setTab] = (0,
|
|
7008
|
-
(0,
|
|
7050
|
+
const [tab, setTab] = (0, import_react15.useState)(initialTab);
|
|
7051
|
+
(0, import_react15.useEffect)(() => {
|
|
7009
7052
|
if (!isOpen) return;
|
|
7010
7053
|
setTab(defaultTab ?? (hasEdit ? "edit" : "view"));
|
|
7011
7054
|
}, [isOpen, windowId, hasEdit, defaultTab]);
|
|
@@ -7156,7 +7199,7 @@ function DirtySavePill({
|
|
|
7156
7199
|
}
|
|
7157
7200
|
|
|
7158
7201
|
// src/data-table/EditableTableCell.tsx
|
|
7159
|
-
var
|
|
7202
|
+
var import_react16 = require("react");
|
|
7160
7203
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
7161
7204
|
function CellEditShell({
|
|
7162
7205
|
href,
|
|
@@ -7205,7 +7248,7 @@ function EditableTableCell({
|
|
|
7205
7248
|
href,
|
|
7206
7249
|
editTrigger = "click"
|
|
7207
7250
|
}) {
|
|
7208
|
-
const [open, setOpen] = (0,
|
|
7251
|
+
const [open, setOpen] = (0, import_react16.useState)(false);
|
|
7209
7252
|
const usePencil = Boolean(href) || editTrigger === "pencil";
|
|
7210
7253
|
if (editType === "string") {
|
|
7211
7254
|
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
@@ -7294,8 +7337,8 @@ function InlineStringEditor({
|
|
|
7294
7337
|
href,
|
|
7295
7338
|
usePencil
|
|
7296
7339
|
}) {
|
|
7297
|
-
const [editing, setEditing] = (0,
|
|
7298
|
-
const [draft, setDraft] = (0,
|
|
7340
|
+
const [editing, setEditing] = (0, import_react16.useState)(false);
|
|
7341
|
+
const [draft, setDraft] = (0, import_react16.useState)(value);
|
|
7299
7342
|
if (!editing) {
|
|
7300
7343
|
if (usePencil) {
|
|
7301
7344
|
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
@@ -7446,8 +7489,8 @@ function TagsEditor({
|
|
|
7446
7489
|
onCommit,
|
|
7447
7490
|
onCancel
|
|
7448
7491
|
}) {
|
|
7449
|
-
const [tags, setTags] = (0,
|
|
7450
|
-
const [draft, setDraft] = (0,
|
|
7492
|
+
const [tags, setTags] = (0, import_react16.useState)(value);
|
|
7493
|
+
const [draft, setDraft] = (0, import_react16.useState)("");
|
|
7451
7494
|
const add = (raw) => {
|
|
7452
7495
|
const next = raw.trim();
|
|
7453
7496
|
if (!next || tags.includes(next)) return;
|
|
@@ -7544,7 +7587,7 @@ function NumberEditor({
|
|
|
7544
7587
|
onCommit,
|
|
7545
7588
|
onCancel
|
|
7546
7589
|
}) {
|
|
7547
|
-
const [draft, setDraft] = (0,
|
|
7590
|
+
const [draft, setDraft] = (0, import_react16.useState)(String(value));
|
|
7548
7591
|
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
7549
7592
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
7550
7593
|
Input,
|
|
@@ -7671,7 +7714,7 @@ function resetToolbarFacets(facets) {
|
|
|
7671
7714
|
}
|
|
7672
7715
|
|
|
7673
7716
|
// src/data-table/LayeredFilterBuilder.tsx
|
|
7674
|
-
var
|
|
7717
|
+
var import_react17 = require("react");
|
|
7675
7718
|
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
7676
7719
|
function moveRule(rules, from, to) {
|
|
7677
7720
|
if (from === to || to < 0 || to >= rules.length) return [...rules];
|
|
@@ -7688,8 +7731,8 @@ function LayeredFilterBuilder({
|
|
|
7688
7731
|
maxRules = 20,
|
|
7689
7732
|
label = "Advanced filters"
|
|
7690
7733
|
}) {
|
|
7691
|
-
const [open, setOpen] = (0,
|
|
7692
|
-
const [draggedIndex, setDraggedIndex] = (0,
|
|
7734
|
+
const [open, setOpen] = (0, import_react17.useState)(false);
|
|
7735
|
+
const [draggedIndex, setDraggedIndex] = (0, import_react17.useState)(null);
|
|
7693
7736
|
if (fields.length === 0) return null;
|
|
7694
7737
|
const updateRule = (index, patch) => {
|
|
7695
7738
|
onChange(
|
|
@@ -8050,7 +8093,7 @@ function resolveFilterKind(col, sampleRows) {
|
|
|
8050
8093
|
if (values.every((v) => typeof v === "number" && Number.isFinite(v))) {
|
|
8051
8094
|
return "number";
|
|
8052
8095
|
}
|
|
8053
|
-
const strings = values.
|
|
8096
|
+
const strings = values.flatMap(selectCellValues);
|
|
8054
8097
|
const unique = new Set(strings);
|
|
8055
8098
|
if (unique.size >= 1 && unique.size <= SELECT_CARDINALITY_CAP && unique.size < strings.length * 0.6) {
|
|
8056
8099
|
return "select";
|
|
@@ -8062,15 +8105,16 @@ function collectSelectOptions(col, rows) {
|
|
|
8062
8105
|
const options = [];
|
|
8063
8106
|
let hasEmpty = false;
|
|
8064
8107
|
for (const row of rows) {
|
|
8065
|
-
const
|
|
8066
|
-
|
|
8067
|
-
if (!value) {
|
|
8108
|
+
const values = selectCellValues(getCellValue(row, col));
|
|
8109
|
+
if (values.length === 0) {
|
|
8068
8110
|
hasEmpty = true;
|
|
8069
8111
|
continue;
|
|
8070
8112
|
}
|
|
8071
|
-
|
|
8072
|
-
|
|
8073
|
-
|
|
8113
|
+
for (const value of values) {
|
|
8114
|
+
if (col.filterOptions?.length || seen.has(value)) continue;
|
|
8115
|
+
seen.add(value);
|
|
8116
|
+
options.push({ value, label: value });
|
|
8117
|
+
}
|
|
8074
8118
|
}
|
|
8075
8119
|
const base = col.filterOptions?.length ? [...col.filterOptions] : options.sort((a, b) => a.label.localeCompare(b.label));
|
|
8076
8120
|
if (hasEmpty) {
|
|
@@ -8144,7 +8188,7 @@ function TableToolbarAction({
|
|
|
8144
8188
|
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { "data-matrx-table-toolbar-action": true, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(HostAction, { ariaLabel, tooltip, disabled, busy, onClick, children }) });
|
|
8145
8189
|
}
|
|
8146
8190
|
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Tooltip, { children: [
|
|
8147
|
-
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { "data-matrx-table-toolbar-action": true, className: "inline-flex", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Button, { type: "button", variant: "ghost", size: "icon", className: "h-11 w-11 [&_svg]:size-5", "aria-label": ariaLabel, "aria-busy": busy || void 0, disabled, onClick, children: (0,
|
|
8191
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { "data-matrx-table-toolbar-action": true, className: "inline-flex", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Button, { type: "button", variant: "ghost", size: "icon", className: "h-11 w-11 [&_svg]:size-5", "aria-label": ariaLabel, "aria-busy": busy || void 0, disabled, onClick, children: (0, import_react18.isValidElement)(children) ? (0, import_react18.cloneElement)(children, { className: cn("h-5 w-5", children.props.className) }) : children }) }) }),
|
|
8148
8192
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TooltipContent, { children: tooltip ?? ariaLabel })
|
|
8149
8193
|
] });
|
|
8150
8194
|
}
|
|
@@ -8201,7 +8245,7 @@ function MatrxDataTableWithUrlState({
|
|
|
8201
8245
|
...urlState.history === void 0 ? {} : { history: urlState.history },
|
|
8202
8246
|
...urlState.textHistory === void 0 ? {} : { textHistory: urlState.textHistory }
|
|
8203
8247
|
});
|
|
8204
|
-
(0,
|
|
8248
|
+
(0, import_react18.useEffect)(() => {
|
|
8205
8249
|
if (activeUrlTableIds.has(urlState.id)) {
|
|
8206
8250
|
throw new Error(
|
|
8207
8251
|
`Duplicate MatrxDataTable urlState.id "${urlState.id}" on one page. Give every table a unique stable id.`
|
|
@@ -8322,7 +8366,7 @@ function MatrxDataTableCore({
|
|
|
8322
8366
|
}) {
|
|
8323
8367
|
const appendQuery = query?.mode === "controlled-append" ? query : null;
|
|
8324
8368
|
const appendQueryKey = appendQuery?.pagination.queryKey ?? null;
|
|
8325
|
-
const committedAppendQueryKey = (0,
|
|
8369
|
+
const committedAppendQueryKey = (0, import_react18.useRef)(appendQueryKey);
|
|
8326
8370
|
const appendSourceChanged = appendQuery !== null && committedAppendQueryKey.current !== appendQueryKey;
|
|
8327
8371
|
const data = appendQuery ? appendQuery.pagination.rows : suppliedData;
|
|
8328
8372
|
const isLoading = appendQuery ? appendQuery.pagination.loading : suppliedLoading;
|
|
@@ -8333,10 +8377,10 @@ function MatrxDataTableCore({
|
|
|
8333
8377
|
const Link = host.Link ?? DefaultTableLink;
|
|
8334
8378
|
const SidePanelSurface = host.SidePanelSurface ?? DefaultTableSidePanel;
|
|
8335
8379
|
const { notify: toast, notice } = useTableNotice();
|
|
8336
|
-
const [savedViewError, setSavedViewError] = (0,
|
|
8337
|
-
const [toolbarActionError, setToolbarActionError] = (0,
|
|
8338
|
-
const [toolbarActionPending, setToolbarActionPending] = (0,
|
|
8339
|
-
const toolbarActionPendingRef = (0,
|
|
8380
|
+
const [savedViewError, setSavedViewError] = (0, import_react18.useState)(null);
|
|
8381
|
+
const [toolbarActionError, setToolbarActionError] = (0, import_react18.useState)(null);
|
|
8382
|
+
const [toolbarActionPending, setToolbarActionPending] = (0, import_react18.useState)({ refresh: false, add: false });
|
|
8383
|
+
const toolbarActionPendingRef = (0, import_react18.useRef)({ refresh: false, add: false });
|
|
8340
8384
|
const CHECKBOX_TAP_AREA = "h-4 w-4 touch-manipulation";
|
|
8341
8385
|
const mobileCardsClass = mobileCardsBreakpoint === "lg" ? "lg:hidden" : "sm:hidden";
|
|
8342
8386
|
const tableWithCardsClass = mobileCardsBreakpoint === "lg" ? "max-lg:hidden" : "max-sm:hidden";
|
|
@@ -8349,7 +8393,7 @@ function MatrxDataTableCore({
|
|
|
8349
8393
|
const sourceOwnsIntelligentSearch = sourceProcessing?.intelligentSearch === "source";
|
|
8350
8394
|
const sourceOwnsSearch = remoteQuery?.mode === "controlled" || appendQuery !== null && sourceProcessing === void 0 || sourceProcessing?.search === "source" || sourceOwnsIntelligentSearch;
|
|
8351
8395
|
const intelligentSearchEnabled = toolbar?.intelligentSearch !== void 0 && (sourceOwnsIntelligentSearch || remoteQuery === null && !sourceOwnsSearch);
|
|
8352
|
-
const emitControlledQueryChange = (0,
|
|
8396
|
+
const emitControlledQueryChange = (0, import_react18.useCallback)(
|
|
8353
8397
|
(patch, options) => {
|
|
8354
8398
|
if (!controlledQuery) return;
|
|
8355
8399
|
controlledQuery.onStateChange(
|
|
@@ -8358,8 +8402,8 @@ function MatrxDataTableCore({
|
|
|
8358
8402
|
},
|
|
8359
8403
|
[controlledQuery]
|
|
8360
8404
|
);
|
|
8361
|
-
const [internalSearch, setInternalSearch] = (0,
|
|
8362
|
-
const [draggedRowId, setDraggedRowId] = (0,
|
|
8405
|
+
const [internalSearch, setInternalSearch] = (0, import_react18.useState)("");
|
|
8406
|
+
const [draggedRowId, setDraggedRowId] = (0, import_react18.useState)(null);
|
|
8363
8407
|
const hierarchySensors = (0, import_core3.useSensors)(
|
|
8364
8408
|
(0, import_core3.useSensor)(import_core3.PointerSensor, {
|
|
8365
8409
|
activationConstraint: { distance: COLUMN_REORDER_ACTIVATION_DISTANCE }
|
|
@@ -8375,7 +8419,7 @@ function MatrxDataTableCore({
|
|
|
8375
8419
|
}
|
|
8376
8420
|
toolbar?.onSearchChange?.(v);
|
|
8377
8421
|
};
|
|
8378
|
-
const [internalSearchMatchMode, setInternalSearchMatchMode] = (0,
|
|
8422
|
+
const [internalSearchMatchMode, setInternalSearchMatchMode] = (0, import_react18.useState)(
|
|
8379
8423
|
toolbar?.searchMatch?.defaultMode ?? "contains"
|
|
8380
8424
|
);
|
|
8381
8425
|
const searchMatchMode = controlledQuery ? controlledQuery.state.searchMatchMode ?? toolbar?.searchMatch?.defaultMode ?? "contains" : internalSearchMatchMode;
|
|
@@ -8386,7 +8430,7 @@ function MatrxDataTableCore({
|
|
|
8386
8430
|
}
|
|
8387
8431
|
setInternalSearchMatchMode(mode);
|
|
8388
8432
|
};
|
|
8389
|
-
const [internalSearchScope, setInternalSearchScope] = (0,
|
|
8433
|
+
const [internalSearchScope, setInternalSearchScope] = (0, import_react18.useState)("all");
|
|
8390
8434
|
const searchScope = controlledQuery ? controlledQuery.state.searchScope ?? "all" : internalSearchScope;
|
|
8391
8435
|
const setSearchScope = (scope) => {
|
|
8392
8436
|
if (controlledQuery) {
|
|
@@ -8395,7 +8439,7 @@ function MatrxDataTableCore({
|
|
|
8395
8439
|
}
|
|
8396
8440
|
setInternalSearchScope(scope);
|
|
8397
8441
|
};
|
|
8398
|
-
const [internalAnyOf, setInternalAnyOf] = (0,
|
|
8442
|
+
const [internalAnyOf, setInternalAnyOf] = (0, import_react18.useState)("");
|
|
8399
8443
|
const toolbarAnyOfControlled = toolbar?.anyOf?.value !== void 0;
|
|
8400
8444
|
const anyOfValue = controlledQuery ? controlledQuery.state.anyOf : toolbarAnyOfControlled ? toolbar?.anyOf?.value ?? "" : internalAnyOf;
|
|
8401
8445
|
const setAnyOfValue = (v) => {
|
|
@@ -8406,7 +8450,7 @@ function MatrxDataTableCore({
|
|
|
8406
8450
|
}
|
|
8407
8451
|
toolbar?.anyOf?.onChange?.(v);
|
|
8408
8452
|
};
|
|
8409
|
-
const [internalLayeredFilters, setInternalLayeredFilters] = (0,
|
|
8453
|
+
const [internalLayeredFilters, setInternalLayeredFilters] = (0, import_react18.useState)([]);
|
|
8410
8454
|
const layeredFilters = controlledQuery ? controlledQuery.state.layeredFilters ?? [] : internalLayeredFilters;
|
|
8411
8455
|
const setLayeredFilters = (next) => {
|
|
8412
8456
|
if (controlledQuery) {
|
|
@@ -8415,7 +8459,7 @@ function MatrxDataTableCore({
|
|
|
8415
8459
|
}
|
|
8416
8460
|
setInternalLayeredFilters(next);
|
|
8417
8461
|
};
|
|
8418
|
-
const [internalColumnFilters, setInternalColumnFilters] = (0,
|
|
8462
|
+
const [internalColumnFilters, setInternalColumnFilters] = (0, import_react18.useState)({});
|
|
8419
8463
|
const columnFilters = controlledQuery ? controlledQuery.state.columnFilters : internalColumnFilters;
|
|
8420
8464
|
const setColumnFilter = (id, next) => {
|
|
8421
8465
|
const nextFilters = { ...columnFilters, [id]: next };
|
|
@@ -8428,7 +8472,7 @@ function MatrxDataTableCore({
|
|
|
8428
8472
|
}
|
|
8429
8473
|
setInternalColumnFilters(nextFilters);
|
|
8430
8474
|
};
|
|
8431
|
-
const [internalSort, setInternalSort] = (0,
|
|
8475
|
+
const [internalSort, setInternalSort] = (0, import_react18.useState)(defaultSort);
|
|
8432
8476
|
const sort = controlledQuery ? controlledQuery.state.sort : internalSort;
|
|
8433
8477
|
const setSort = (next) => {
|
|
8434
8478
|
if (controlledQuery) {
|
|
@@ -8437,7 +8481,7 @@ function MatrxDataTableCore({
|
|
|
8437
8481
|
}
|
|
8438
8482
|
setInternalSort(next);
|
|
8439
8483
|
};
|
|
8440
|
-
const [internalPage, setInternalPage] = (0,
|
|
8484
|
+
const [internalPage, setInternalPage] = (0, import_react18.useState)(1);
|
|
8441
8485
|
const page = controlledQuery ? controlledQuery.state.page : internalPage;
|
|
8442
8486
|
const setPage = (next) => {
|
|
8443
8487
|
if (controlledQuery) {
|
|
@@ -8446,7 +8490,7 @@ function MatrxDataTableCore({
|
|
|
8446
8490
|
}
|
|
8447
8491
|
setInternalPage(next);
|
|
8448
8492
|
};
|
|
8449
|
-
const [internalPageSize, setInternalPageSize] = (0,
|
|
8493
|
+
const [internalPageSize, setInternalPageSize] = (0, import_react18.useState)(
|
|
8450
8494
|
defaultPageSize === 0 ? Math.max(data.length, 1) : defaultPageSize
|
|
8451
8495
|
);
|
|
8452
8496
|
const pageSize = controlledQuery ? controlledQuery.state.pageSize : internalPageSize;
|
|
@@ -8457,26 +8501,26 @@ function MatrxDataTableCore({
|
|
|
8457
8501
|
}
|
|
8458
8502
|
setInternalPageSize(next);
|
|
8459
8503
|
};
|
|
8460
|
-
const [uncontrolledSelectedId, setUncontrolledSelectedId] = (0,
|
|
8504
|
+
const [uncontrolledSelectedId, setUncontrolledSelectedId] = (0, import_react18.useState)(null);
|
|
8461
8505
|
const rawSelectedId = controlledSelectedId !== void 0 ? controlledSelectedId : uncontrolledSelectedId;
|
|
8462
8506
|
const selectedId = appendSourceChanged ? null : rawSelectedId;
|
|
8463
8507
|
const setSelectedId = (id) => {
|
|
8464
8508
|
if (controlledSelectedId === void 0) setUncontrolledSelectedId(id);
|
|
8465
8509
|
onSelectedIdChange?.(id);
|
|
8466
8510
|
};
|
|
8467
|
-
const [uncontrolledWindowRowId, setUncontrolledWindowRowId] = (0,
|
|
8511
|
+
const [uncontrolledWindowRowId, setUncontrolledWindowRowId] = (0, import_react18.useState)(null);
|
|
8468
8512
|
const rawWindowRowId = controlledWindowRowId !== void 0 ? controlledWindowRowId : uncontrolledWindowRowId;
|
|
8469
8513
|
const windowRowId = appendSourceChanged ? null : rawWindowRowId;
|
|
8470
8514
|
const setWindowRowId = (id) => {
|
|
8471
8515
|
if (controlledWindowRowId === void 0) setUncontrolledWindowRowId(id);
|
|
8472
8516
|
onWindowRowIdChange?.(id);
|
|
8473
8517
|
};
|
|
8474
|
-
const [windowRowSnapshot, setWindowRowSnapshot] = (0,
|
|
8518
|
+
const [windowRowSnapshot, setWindowRowSnapshot] = (0, import_react18.useState)(null);
|
|
8475
8519
|
const editScopeKey = appendQueryKey === null ? "\0local" : `append:${appendQueryKey}`;
|
|
8476
|
-
const [editsByScope, setEditsByScope] = (0,
|
|
8477
|
-
const editRevisionRef = (0,
|
|
8478
|
-
const [savingByScope, setSavingByScope] = (0,
|
|
8479
|
-
const [confirmForeignDraftDiscard, setConfirmForeignDraftDiscard] = (0,
|
|
8520
|
+
const [editsByScope, setEditsByScope] = (0, import_react18.useState)({});
|
|
8521
|
+
const editRevisionRef = (0, import_react18.useRef)({});
|
|
8522
|
+
const [savingByScope, setSavingByScope] = (0, import_react18.useState)({});
|
|
8523
|
+
const [confirmForeignDraftDiscard, setConfirmForeignDraftDiscard] = (0, import_react18.useState)(false);
|
|
8480
8524
|
const edits = editsByScope[editScopeKey]?.values ?? {};
|
|
8481
8525
|
const saving = (savingByScope[editScopeKey] ?? 0) > 0;
|
|
8482
8526
|
const setEdits = (next) => {
|
|
@@ -8543,7 +8587,7 @@ function MatrxDataTableCore({
|
|
|
8543
8587
|
rows: Object.entries(draft.values).map(([rowId, columns2]) => ({ rowId, columns: columns2 }))
|
|
8544
8588
|
}));
|
|
8545
8589
|
const selection = appendSourceChanged && selectionConfig ? { ...selectionConfig, selectedIds: [] } : selectionConfig;
|
|
8546
|
-
(0,
|
|
8590
|
+
(0, import_react18.useEffect)(() => {
|
|
8547
8591
|
const previous = committedAppendQueryKey.current;
|
|
8548
8592
|
committedAppendQueryKey.current = appendQueryKey;
|
|
8549
8593
|
if (previous === null || appendQueryKey === null || previous === appendQueryKey) {
|
|
@@ -8561,11 +8605,11 @@ function MatrxDataTableCore({
|
|
|
8561
8605
|
onWindowRowIdChange,
|
|
8562
8606
|
selectionConfig
|
|
8563
8607
|
]);
|
|
8564
|
-
const scrollRef = (0,
|
|
8565
|
-
const tableRef = (0,
|
|
8566
|
-
const cardsScrollRef = (0,
|
|
8567
|
-
const previousAppendKeyForScrollReset = (0,
|
|
8568
|
-
(0,
|
|
8608
|
+
const scrollRef = (0, import_react18.useRef)(null);
|
|
8609
|
+
const tableRef = (0, import_react18.useRef)(null);
|
|
8610
|
+
const cardsScrollRef = (0, import_react18.useRef)(null);
|
|
8611
|
+
const previousAppendKeyForScrollReset = (0, import_react18.useRef)(appendQueryKey);
|
|
8612
|
+
(0, import_react18.useLayoutEffect)(() => {
|
|
8569
8613
|
const previous = previousAppendKeyForScrollReset.current;
|
|
8570
8614
|
previousAppendKeyForScrollReset.current = appendQueryKey;
|
|
8571
8615
|
if (previous === null || appendQueryKey === null || previous === appendQueryKey) {
|
|
@@ -8590,13 +8634,13 @@ function MatrxDataTableCore({
|
|
|
8590
8634
|
...appendScrollPolicy?.mode === "scroll" && appendScrollPolicy.thresholdPx !== void 0 ? { thresholdPx: appendScrollPolicy.thresholdPx } : {},
|
|
8591
8635
|
...appendScrollPolicy?.mode === "scroll" && appendScrollPolicy.intentTimeoutMs !== void 0 ? { intentTimeoutMs: appendScrollPolicy.intentTimeoutMs } : {}
|
|
8592
8636
|
});
|
|
8593
|
-
const rootRef = (0,
|
|
8637
|
+
const rootRef = (0, import_react18.useRef)(null);
|
|
8594
8638
|
useClippedContentGuard(rootRef, {
|
|
8595
8639
|
label: typeof copy === "object" && copy.listLabel ? `Table: ${copy.listLabel}` : "MatrxDataTable"
|
|
8596
8640
|
});
|
|
8597
|
-
const [scrollHintRight, setScrollHintRight] = (0,
|
|
8598
|
-
const [scrollHintLeft, setScrollHintLeft] = (0,
|
|
8599
|
-
const updateScrollHint = (0,
|
|
8641
|
+
const [scrollHintRight, setScrollHintRight] = (0, import_react18.useState)(false);
|
|
8642
|
+
const [scrollHintLeft, setScrollHintLeft] = (0, import_react18.useState)(false);
|
|
8643
|
+
const updateScrollHint = (0, import_react18.useCallback)(() => {
|
|
8600
8644
|
const el = scrollRef.current;
|
|
8601
8645
|
if (!el) return;
|
|
8602
8646
|
setScrollHintRight(el.scrollLeft + el.clientWidth < el.scrollWidth - 2);
|
|
@@ -8610,7 +8654,7 @@ function MatrxDataTableCore({
|
|
|
8610
8654
|
behavior: "smooth"
|
|
8611
8655
|
});
|
|
8612
8656
|
};
|
|
8613
|
-
(0,
|
|
8657
|
+
(0, import_react18.useEffect)(() => {
|
|
8614
8658
|
updateScrollHint();
|
|
8615
8659
|
window.addEventListener("resize", updateScrollHint);
|
|
8616
8660
|
const el = scrollRef.current;
|
|
@@ -8625,30 +8669,30 @@ function MatrxDataTableCore({
|
|
|
8625
8669
|
observer?.disconnect();
|
|
8626
8670
|
};
|
|
8627
8671
|
}, [updateScrollHint, data, columns]);
|
|
8628
|
-
const [columnOrder, setColumnOrder] = (0,
|
|
8629
|
-
const [hiddenColumnIds, setHiddenColumnIds] = (0,
|
|
8672
|
+
const [columnOrder, setColumnOrder] = (0, import_react18.useState)(() => columnState?.order ?? columns.map(columnId));
|
|
8673
|
+
const [hiddenColumnIds, setHiddenColumnIds] = (0, import_react18.useState)(
|
|
8630
8674
|
() => new Set(columnState?.hidden ?? columns.filter((column) => column.hidden).map(columnId))
|
|
8631
8675
|
);
|
|
8632
|
-
const [columnWidths, setColumnWidths] = (0,
|
|
8676
|
+
const [columnWidths, setColumnWidths] = (0, import_react18.useState)(
|
|
8633
8677
|
() => normalizeColumnWidthsForColumns(columnState?.widths, columns)
|
|
8634
8678
|
);
|
|
8635
|
-
const [fixedTableGeometry, setFixedTableGeometry] = (0,
|
|
8636
|
-
const knownColumnIds = (0,
|
|
8637
|
-
const draggedColumnId = (0,
|
|
8638
|
-
const columnDragActive = (0,
|
|
8639
|
-
const columnDragRaf = (0,
|
|
8640
|
-
const columnDragScrollDirection = (0,
|
|
8641
|
-
const [columnDragPreview, setColumnDragPreview] = (0,
|
|
8642
|
-
const stopColumnDragScroll = (0,
|
|
8679
|
+
const [fixedTableGeometry, setFixedTableGeometry] = (0, import_react18.useState)(null);
|
|
8680
|
+
const knownColumnIds = (0, import_react18.useRef)(new Set(columns.map(columnId)));
|
|
8681
|
+
const draggedColumnId = (0, import_react18.useRef)(null);
|
|
8682
|
+
const columnDragActive = (0, import_react18.useRef)(false);
|
|
8683
|
+
const columnDragRaf = (0, import_react18.useRef)(null);
|
|
8684
|
+
const columnDragScrollDirection = (0, import_react18.useRef)(0);
|
|
8685
|
+
const [columnDragPreview, setColumnDragPreview] = (0, import_react18.useState)(null);
|
|
8686
|
+
const stopColumnDragScroll = (0, import_react18.useCallback)(() => {
|
|
8643
8687
|
if (columnDragRaf.current !== null) cancelAnimationFrame(columnDragRaf.current);
|
|
8644
8688
|
columnDragRaf.current = null;
|
|
8645
8689
|
columnDragScrollDirection.current = 0;
|
|
8646
8690
|
}, []);
|
|
8647
|
-
(0,
|
|
8691
|
+
(0, import_react18.useEffect)(() => () => {
|
|
8648
8692
|
columnDragActive.current = false;
|
|
8649
8693
|
stopColumnDragScroll();
|
|
8650
8694
|
}, [stopColumnDragScroll]);
|
|
8651
|
-
const startColumnDragScroll = (0,
|
|
8695
|
+
const startColumnDragScroll = (0, import_react18.useCallback)(() => {
|
|
8652
8696
|
if (!columnDragActive.current || columnDragRaf.current !== null) return;
|
|
8653
8697
|
const scrollStep = () => {
|
|
8654
8698
|
const scroll = scrollRef.current;
|
|
@@ -8675,25 +8719,25 @@ function MatrxDataTableCore({
|
|
|
8675
8719
|
};
|
|
8676
8720
|
columnDragRaf.current = requestAnimationFrame(scrollStep);
|
|
8677
8721
|
}, []);
|
|
8678
|
-
const commitColumnState = (0,
|
|
8722
|
+
const commitColumnState = (0, import_react18.useCallback)((order, hidden) => {
|
|
8679
8723
|
if (columnState) columnState.onChange({ order, hidden: [...hidden] });
|
|
8680
8724
|
else {
|
|
8681
8725
|
setColumnOrder(order);
|
|
8682
8726
|
setHiddenColumnIds(hidden);
|
|
8683
8727
|
}
|
|
8684
8728
|
}, [columnState]);
|
|
8685
|
-
const [internalColumnManagerOpen, setInternalColumnManagerOpen] = (0,
|
|
8729
|
+
const [internalColumnManagerOpen, setInternalColumnManagerOpen] = (0, import_react18.useState)(false);
|
|
8686
8730
|
const columnManagerOpen = controlledColumnManager?.open ?? internalColumnManagerOpen;
|
|
8687
8731
|
const setColumnManagerOpen = controlledColumnManager?.onOpenChange ?? setInternalColumnManagerOpen;
|
|
8688
|
-
const columnIds = (0,
|
|
8689
|
-
const effectiveColumnOrder = (0,
|
|
8690
|
-
const effectiveHiddenColumnIds = (0,
|
|
8691
|
-
const effectiveColumnWidths = (0,
|
|
8732
|
+
const columnIds = (0, import_react18.useMemo)(() => columns.map(columnId), [columns]);
|
|
8733
|
+
const effectiveColumnOrder = (0, import_react18.useMemo)(() => columnState ? [...columnState.order.filter((id, index, values) => columnIds.includes(id) && values.indexOf(id) === index), ...columnIds.filter((id) => !columnState.order.includes(id))] : columnOrder, [columnIds, columnOrder, columnState]);
|
|
8734
|
+
const effectiveHiddenColumnIds = (0, import_react18.useMemo)(() => columnState ? new Set(columnState.hidden.filter((id) => columnIds.includes(id))) : hiddenColumnIds, [columnIds, columnState, hiddenColumnIds]);
|
|
8735
|
+
const effectiveColumnWidths = (0, import_react18.useMemo)(
|
|
8692
8736
|
() => normalizeColumnWidthsForColumns(columnState?.widths ?? columnWidths, columns),
|
|
8693
8737
|
[columns, columnState?.widths, columnWidths]
|
|
8694
8738
|
);
|
|
8695
|
-
const resizeGestureSnapshotRef = (0,
|
|
8696
|
-
const measureVisibleColumnWidths = (0,
|
|
8739
|
+
const resizeGestureSnapshotRef = (0, import_react18.useRef)(null);
|
|
8740
|
+
const measureVisibleColumnWidths = (0, import_react18.useCallback)(() => {
|
|
8697
8741
|
const measured = {};
|
|
8698
8742
|
const headers = tableRef.current ? Array.from(tableRef.current.querySelectorAll(
|
|
8699
8743
|
"thead th[data-matrx-table-column-id]"
|
|
@@ -8707,7 +8751,7 @@ function MatrxDataTableCore({
|
|
|
8707
8751
|
}
|
|
8708
8752
|
return normalizeColumnWidthsForColumns(measured, columns);
|
|
8709
8753
|
}, [columns]);
|
|
8710
|
-
const measureFixedTableGeometry = (0,
|
|
8754
|
+
const measureFixedTableGeometry = (0, import_react18.useCallback)(() => {
|
|
8711
8755
|
const table = tableRef.current;
|
|
8712
8756
|
const headers = table ? Array.from(table.querySelectorAll("thead th")) : [];
|
|
8713
8757
|
const widthFor = (selector) => {
|
|
@@ -8737,16 +8781,16 @@ function MatrxDataTableCore({
|
|
|
8737
8781
|
...actionsWidth === void 0 ? {} : { actionsWidth }
|
|
8738
8782
|
};
|
|
8739
8783
|
}, [resolvedDensity]);
|
|
8740
|
-
const captureResizeGestureSnapshot = (0,
|
|
8784
|
+
const captureResizeGestureSnapshot = (0, import_react18.useCallback)(() => {
|
|
8741
8785
|
resizeGestureSnapshotRef.current = {
|
|
8742
8786
|
widths: measureVisibleColumnWidths(),
|
|
8743
8787
|
geometry: measureFixedTableGeometry()
|
|
8744
8788
|
};
|
|
8745
8789
|
}, [measureFixedTableGeometry, measureVisibleColumnWidths]);
|
|
8746
|
-
const clearResizeGestureSnapshot = (0,
|
|
8790
|
+
const clearResizeGestureSnapshot = (0, import_react18.useCallback)(() => {
|
|
8747
8791
|
resizeGestureSnapshotRef.current = null;
|
|
8748
8792
|
}, []);
|
|
8749
|
-
const commitColumnWidths = (0,
|
|
8793
|
+
const commitColumnWidths = (0, import_react18.useCallback)((next, captureInitialWidths = false) => {
|
|
8750
8794
|
const gestureSnapshot = captureInitialWidths ? resizeGestureSnapshotRef.current : null;
|
|
8751
8795
|
resizeGestureSnapshotRef.current = null;
|
|
8752
8796
|
const normalized = normalizeColumnWidthsForColumns(
|
|
@@ -8765,7 +8809,7 @@ function MatrxDataTableCore({
|
|
|
8765
8809
|
}
|
|
8766
8810
|
setColumnWidths(normalized);
|
|
8767
8811
|
}, [columnIds, columnState, columns, measureFixedTableGeometry, measureVisibleColumnWidths]);
|
|
8768
|
-
(0,
|
|
8812
|
+
(0, import_react18.useEffect)(() => {
|
|
8769
8813
|
const ids = columns.map(columnId);
|
|
8770
8814
|
if (columnState) return;
|
|
8771
8815
|
const previousIds = knownColumnIds.current;
|
|
@@ -8784,30 +8828,31 @@ function MatrxDataTableCore({
|
|
|
8784
8828
|
setColumnWidths((current) => normalizeColumnWidthsForColumns(current, columns));
|
|
8785
8829
|
knownColumnIds.current = new Set(ids);
|
|
8786
8830
|
}, [columns, columnState]);
|
|
8787
|
-
(0,
|
|
8831
|
+
(0, import_react18.useLayoutEffect)(() => {
|
|
8788
8832
|
for (const id of columnIds) {
|
|
8789
8833
|
tableRef.current?.style.removeProperty(columnResizeCssVar(id));
|
|
8790
8834
|
}
|
|
8791
8835
|
});
|
|
8792
|
-
const previewColumnOrder = (0,
|
|
8836
|
+
const previewColumnOrder = (0, import_react18.useMemo)(
|
|
8793
8837
|
() => projectColumnDragOrder(effectiveColumnOrder, columnDragPreview),
|
|
8794
8838
|
[columnDragPreview, effectiveColumnOrder]
|
|
8795
8839
|
);
|
|
8796
|
-
|
|
8840
|
+
useColumnReorderAnimation(tableRef, previewColumnOrder.join("\0"), columnDragPreview !== null);
|
|
8841
|
+
const visibleColumns = (0, import_react18.useMemo)(() => {
|
|
8797
8842
|
const byId = new Map(columns.map((column) => [columnId(column), column]));
|
|
8798
8843
|
return previewColumnOrder.map((id) => byId.get(id)).filter(
|
|
8799
8844
|
(column) => column !== void 0 && !effectiveHiddenColumnIds.has(columnId(column))
|
|
8800
8845
|
);
|
|
8801
8846
|
}, [columns, effectiveHiddenColumnIds, previewColumnOrder]);
|
|
8802
8847
|
const usesMeasuredFixedLayout = visibleColumns.length > 0 && visibleColumns.every((column) => effectiveColumnWidths[columnId(column)] !== void 0);
|
|
8803
|
-
(0,
|
|
8848
|
+
(0, import_react18.useLayoutEffect)(() => {
|
|
8804
8849
|
if (!usesMeasuredFixedLayout) {
|
|
8805
8850
|
if (fixedTableGeometry !== null) setFixedTableGeometry(null);
|
|
8806
8851
|
return;
|
|
8807
8852
|
}
|
|
8808
8853
|
if (fixedTableGeometry === null) setFixedTableGeometry(measureFixedTableGeometry());
|
|
8809
8854
|
}, [fixedTableGeometry, measureFixedTableGeometry, usesMeasuredFixedLayout]);
|
|
8810
|
-
(0,
|
|
8855
|
+
(0, import_react18.useLayoutEffect)(() => {
|
|
8811
8856
|
if (!usesMeasuredFixedLayout) return;
|
|
8812
8857
|
const table = tableRef.current;
|
|
8813
8858
|
if (!table) return;
|
|
@@ -8829,14 +8874,14 @@ function MatrxDataTableCore({
|
|
|
8829
8874
|
setFixedTableGeometry(geometry);
|
|
8830
8875
|
}, [resolvedDensity, measureFixedTableGeometry, usesMeasuredFixedLayout]);
|
|
8831
8876
|
const fixedLayoutActive = usesMeasuredFixedLayout && fixedTableGeometry !== null;
|
|
8832
|
-
const declaredVisibleCopyColumns = (0,
|
|
8877
|
+
const declaredVisibleCopyColumns = (0, import_react18.useMemo)(
|
|
8833
8878
|
() => visibleColumns.filter((column) => column.accessorFn !== void 0 || column.accessorKey !== void 0),
|
|
8834
8879
|
[visibleColumns]
|
|
8835
8880
|
);
|
|
8836
|
-
const tableCopySourceNamespace = (0,
|
|
8837
|
-
const tableDndContextId = (0,
|
|
8881
|
+
const tableCopySourceNamespace = (0, import_react18.useId)();
|
|
8882
|
+
const tableDndContextId = (0, import_react18.useId)();
|
|
8838
8883
|
const defaultCopyTitle = toolbar?.title || "Table";
|
|
8839
|
-
const defaultCopy = (0,
|
|
8884
|
+
const defaultCopy = (0, import_react18.useMemo)(() => ({
|
|
8840
8885
|
label: defaultCopyTitle,
|
|
8841
8886
|
listLabel: defaultCopyTitle,
|
|
8842
8887
|
location: defaultCopyTitle,
|
|
@@ -8871,7 +8916,7 @@ function MatrxDataTableCore({
|
|
|
8871
8916
|
serializer: (shaped) => buildViewAgentInput(effectiveCopy, shaped, data, { scope: "custom" })
|
|
8872
8917
|
}))
|
|
8873
8918
|
] : [];
|
|
8874
|
-
const filterMeta = (0,
|
|
8919
|
+
const filterMeta = (0, import_react18.useMemo)(() => {
|
|
8875
8920
|
const meta = /* @__PURE__ */ new Map();
|
|
8876
8921
|
for (const col of visibleColumns) {
|
|
8877
8922
|
const id = columnId(col);
|
|
@@ -8879,14 +8924,14 @@ function MatrxDataTableCore({
|
|
|
8879
8924
|
}
|
|
8880
8925
|
return meta;
|
|
8881
8926
|
}, [visibleColumns, data, remoteQuery]);
|
|
8882
|
-
const intelligentSearchScopes = (0,
|
|
8927
|
+
const intelligentSearchScopes = (0, import_react18.useMemo)(
|
|
8883
8928
|
() => resolveTableSearchScopes(data, columns, {
|
|
8884
8929
|
...toolbar?.intelligentSearch?.roles === void 0 ? {} : { roles: toolbar.intelligentSearch.roles },
|
|
8885
8930
|
...toolbar?.intelligentSearch?.scopes === void 0 ? {} : { scopes: toolbar.intelligentSearch.scopes }
|
|
8886
8931
|
}),
|
|
8887
8932
|
[columns, data, toolbar?.intelligentSearch?.roles, toolbar?.intelligentSearch?.scopes]
|
|
8888
8933
|
);
|
|
8889
|
-
const processed = (0,
|
|
8934
|
+
const processed = (0, import_react18.useMemo)(() => {
|
|
8890
8935
|
if (remoteQuery && !appendUsesLocalProcessing) return data;
|
|
8891
8936
|
if (processLocalRows) {
|
|
8892
8937
|
return processLocalRows(data, {
|
|
@@ -8948,8 +8993,8 @@ function MatrxDataTableCore({
|
|
|
8948
8993
|
intelligentSearchEnabled,
|
|
8949
8994
|
searchScope
|
|
8950
8995
|
]);
|
|
8951
|
-
const lastNotifiedViewRows = (0,
|
|
8952
|
-
(0,
|
|
8996
|
+
const lastNotifiedViewRows = (0, import_react18.useRef)(null);
|
|
8997
|
+
(0, import_react18.useEffect)(() => {
|
|
8953
8998
|
if (!onViewChange) {
|
|
8954
8999
|
lastNotifiedViewRows.current = null;
|
|
8955
9000
|
return;
|
|
@@ -8958,7 +9003,7 @@ function MatrxDataTableCore({
|
|
|
8958
9003
|
lastNotifiedViewRows.current = processed;
|
|
8959
9004
|
if (changed) onViewChange(processed);
|
|
8960
9005
|
}, [processed, onViewChange]);
|
|
8961
|
-
(0,
|
|
9006
|
+
(0, import_react18.useEffect)(() => {
|
|
8962
9007
|
if (controlledQuery) return;
|
|
8963
9008
|
setInternalPage(1);
|
|
8964
9009
|
}, [
|
|
@@ -8997,7 +9042,7 @@ function MatrxDataTableCore({
|
|
|
8997
9042
|
enabled: localProgressiveEnabled,
|
|
8998
9043
|
onPageAdvance: setPage
|
|
8999
9044
|
});
|
|
9000
|
-
const paginated = (0,
|
|
9045
|
+
const paginated = (0, import_react18.useMemo)(() => {
|
|
9001
9046
|
if (remoteQuery) return processed;
|
|
9002
9047
|
if (hidePagination) return processed;
|
|
9003
9048
|
if (localProgressiveEnabled) return [...progressiveRows.rows];
|
|
@@ -9005,15 +9050,15 @@ function MatrxDataTableCore({
|
|
|
9005
9050
|
const start = (safePage - 1) * effectivePageSize;
|
|
9006
9051
|
return processed.slice(start, start + effectivePageSize);
|
|
9007
9052
|
}, [processed, safePage, effectivePageSize, pageSize, remoteQuery, hidePagination, localProgressiveEnabled, progressiveRows.rows]);
|
|
9008
|
-
(0,
|
|
9053
|
+
(0, import_react18.useEffect)(() => {
|
|
9009
9054
|
if (!controlledQuery || controlledQuery.state.page === safePage) return;
|
|
9010
9055
|
emitControlledQueryChange({ page: safePage });
|
|
9011
9056
|
}, [controlledQuery, emitControlledQueryChange, safePage]);
|
|
9012
|
-
const selectedRow = (0,
|
|
9057
|
+
const selectedRow = (0, import_react18.useMemo)(() => {
|
|
9013
9058
|
if (!selectedId) return null;
|
|
9014
9059
|
return data.find((r) => getRowId(r) === selectedId) ?? null;
|
|
9015
9060
|
}, [data, selectedId, getRowId]);
|
|
9016
|
-
const windowRow = (0,
|
|
9061
|
+
const windowRow = (0, import_react18.useMemo)(() => {
|
|
9017
9062
|
if (!windowRowId) return null;
|
|
9018
9063
|
return data.find((r) => getRowId(r) === windowRowId) ?? (windowRowSnapshot && windowRowSnapshot.queryKey === appendQueryKey && getRowId(windowRowSnapshot.row) === windowRowId ? windowRowSnapshot.row : null);
|
|
9019
9064
|
}, [data, windowRowId, windowRowSnapshot, getRowId, appendQueryKey]);
|
|
@@ -9032,7 +9077,7 @@ function MatrxDataTableCore({
|
|
|
9032
9077
|
return def !== void 0 && f.value !== def;
|
|
9033
9078
|
});
|
|
9034
9079
|
const hasActiveFilters = activeFilterCount > 0 || Boolean(searchValue.trim()) || intelligentSearchEnabled && searchScope !== "all" || Boolean(anyOfValue.trim()) || completeLayeredFilterRules(layeredFilters).length > 0 || facetActive;
|
|
9035
|
-
const changeCount = (0,
|
|
9080
|
+
const changeCount = (0, import_react18.useMemo)(() => {
|
|
9036
9081
|
let n = 0;
|
|
9037
9082
|
for (const fields of Object.values(edits)) {
|
|
9038
9083
|
n += Object.keys(fields).length;
|
|
@@ -9134,7 +9179,7 @@ function MatrxDataTableCore({
|
|
|
9134
9179
|
};
|
|
9135
9180
|
const hierarchyRows = hierarchy?.rows ?? data;
|
|
9136
9181
|
const hierarchyGetParentId = hierarchy?.getParentId;
|
|
9137
|
-
const hierarchyIndex = (0,
|
|
9182
|
+
const hierarchyIndex = (0, import_react18.useMemo)(() => {
|
|
9138
9183
|
if (!hierarchyGetParentId) return null;
|
|
9139
9184
|
const byId = /* @__PURE__ */ new Map();
|
|
9140
9185
|
const parentById = /* @__PURE__ */ new Map();
|
|
@@ -9166,7 +9211,7 @@ function MatrxDataTableCore({
|
|
|
9166
9211
|
return { byId, parentById, depthById };
|
|
9167
9212
|
}, [hierarchyGetParentId, hierarchyRows, getRowId]);
|
|
9168
9213
|
const draggedRow = draggedRowId && hierarchyIndex ? hierarchyIndex.byId.get(draggedRowId) : void 0;
|
|
9169
|
-
const hierarchyBlockedIds = (0,
|
|
9214
|
+
const hierarchyBlockedIds = (0, import_react18.useMemo)(() => {
|
|
9170
9215
|
if (!draggedRowId || !hierarchyIndex) return null;
|
|
9171
9216
|
const childrenById = /* @__PURE__ */ new Map();
|
|
9172
9217
|
for (const [id, parentId] of hierarchyIndex.parentById) {
|
|
@@ -9346,7 +9391,7 @@ function MatrxDataTableCore({
|
|
|
9346
9391
|
edit?.onCancel?.();
|
|
9347
9392
|
};
|
|
9348
9393
|
const showActionsCol = windowEnabled || Boolean(rowActions) || showRowCopy;
|
|
9349
|
-
const selectedIdSet = (0,
|
|
9394
|
+
const selectedIdSet = (0, import_react18.useMemo)(
|
|
9350
9395
|
() => new Set(selection?.selectedIds ?? []),
|
|
9351
9396
|
[selection?.selectedIds]
|
|
9352
9397
|
);
|
|
@@ -9358,11 +9403,11 @@ function MatrxDataTableCore({
|
|
|
9358
9403
|
);
|
|
9359
9404
|
const allOnPageSelected = selectableRows.length > 0 && selectedOnPage.length === selectableRows.length;
|
|
9360
9405
|
const someOnPageSelected = selectedOnPage.length > 0 && !allOnPageSelected;
|
|
9361
|
-
const selectedRows = (0,
|
|
9406
|
+
const selectedRows = (0, import_react18.useMemo)(
|
|
9362
9407
|
() => data.filter((row) => selectedIdSet.has(getRowId(row))),
|
|
9363
9408
|
[data, selectedIdSet, getRowId]
|
|
9364
9409
|
);
|
|
9365
|
-
const lastToggledIndex = (0,
|
|
9410
|
+
const lastToggledIndex = (0, import_react18.useRef)(null);
|
|
9366
9411
|
const setSelectedIds = (next) => selection?.onSelectedIdsChange([...next]);
|
|
9367
9412
|
const toggleRowSelected = (index, shiftKey) => {
|
|
9368
9413
|
if (!selection) return;
|
|
@@ -9431,7 +9476,7 @@ function MatrxDataTableCore({
|
|
|
9431
9476
|
}
|
|
9432
9477
|
return href ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Link, { href, onClick: (event) => event.stopPropagation(), className: "block w-full min-w-0 rounded outline-none focus-visible:ring-2 focus-visible:ring-ring", children: display }) : display;
|
|
9433
9478
|
};
|
|
9434
|
-
const currentViewSnapshot = (0,
|
|
9479
|
+
const currentViewSnapshot = (0, import_react18.useMemo)(
|
|
9435
9480
|
() => ({
|
|
9436
9481
|
__kind: "matrx-table-view",
|
|
9437
9482
|
version: 1,
|
|
@@ -9466,7 +9511,7 @@ function MatrxDataTableCore({
|
|
|
9466
9511
|
sort
|
|
9467
9512
|
]
|
|
9468
9513
|
);
|
|
9469
|
-
const declaredDefaultViewSnapshot = (0,
|
|
9514
|
+
const declaredDefaultViewSnapshot = (0, import_react18.useMemo)(
|
|
9470
9515
|
() => defaultViewSnapshot ?? {
|
|
9471
9516
|
__kind: "matrx-table-view",
|
|
9472
9517
|
version: 1,
|
|
@@ -9485,7 +9530,7 @@ function MatrxDataTableCore({
|
|
|
9485
9530
|
},
|
|
9486
9531
|
[columns, defaultPageSize, defaultSort, defaultViewSnapshot]
|
|
9487
9532
|
);
|
|
9488
|
-
const applySavedView = (0,
|
|
9533
|
+
const applySavedView = (0, import_react18.useCallback)(
|
|
9489
9534
|
(rawSnapshot) => {
|
|
9490
9535
|
const snapshot = parseTableViewSnapshot(rawSnapshot);
|
|
9491
9536
|
if (!snapshot) {
|
|
@@ -10015,7 +10060,7 @@ function MatrxDataTableCore({
|
|
|
10015
10060
|
const id = getRowId(row);
|
|
10016
10061
|
const displayRow = applyRowEdits(row, edits[id]);
|
|
10017
10062
|
const selectable = selection?.isRowSelectable?.(row) ?? Boolean(selection);
|
|
10018
|
-
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
10063
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react18.Fragment, { children: mobileCards(displayRow, index, {
|
|
10019
10064
|
renderCell: (columnKey) => {
|
|
10020
10065
|
const column = columns.find((candidate) => columnId(candidate) === columnKey);
|
|
10021
10066
|
return column ? renderRecordCell(row, column, index) : null;
|
|
@@ -10366,6 +10411,7 @@ function MatrxDataTableCore({
|
|
|
10366
10411
|
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
10367
10412
|
"td",
|
|
10368
10413
|
{
|
|
10414
|
+
"data-matrx-table-column-id": columnId(col),
|
|
10369
10415
|
"data-matrx-column-drag-shadow": isColumnDragShadow ? "true" : void 0,
|
|
10370
10416
|
className: cn(
|
|
10371
10417
|
"py-1.5 align-middle lg:py-0.5",
|
|
@@ -10405,7 +10451,7 @@ function MatrxDataTableCore({
|
|
|
10405
10451
|
"div",
|
|
10406
10452
|
{
|
|
10407
10453
|
"data-matrx-cell-content": true,
|
|
10408
|
-
className: "min-w-0 max-w-full flex-1 whitespace-normal break-words [overflow-wrap:anywhere] sm:[&_*]:min-w-0 sm:[&_*]:
|
|
10454
|
+
className: "min-w-0 max-w-full flex-1 whitespace-normal break-words [overflow-wrap:anywhere] sm:[&_*]:min-w-0 sm:[&_*]:whitespace-normal sm:[&_*]:[overflow-wrap:anywhere] sm:[&_.truncate]:whitespace-nowrap sm:[&_[data-slot=badge]]:whitespace-nowrap sm:[&_[data-slot=badge]]:[overflow-wrap:normal] sm:[&_[data-matrx-cell-control]]:w-max sm:[&_[data-matrx-cell-control]]:min-w-max sm:[&_[data-matrx-cell-control]]:max-w-none sm:[&_[data-matrx-cell-control]]:whitespace-nowrap sm:[&_[data-matrx-cell-control]]:[overflow-wrap:normal] sm:[&_[data-matrx-cell-control]_*]:whitespace-nowrap sm:[&_[data-matrx-cell-control]_*]:[overflow-wrap:normal]",
|
|
10409
10455
|
children: renderRecordCell(row, col, index)
|
|
10410
10456
|
}
|
|
10411
10457
|
)
|
|
@@ -10484,7 +10530,7 @@ function MatrxDataTableCore({
|
|
|
10484
10530
|
children: wrappedRow
|
|
10485
10531
|
},
|
|
10486
10532
|
id
|
|
10487
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
10533
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react18.Fragment, { children: wrappedRow }, id);
|
|
10488
10534
|
}),
|
|
10489
10535
|
appendQuery !== null && isFetching && !isLoading ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("tr", { "data-matrx-table-append-loading-row": true, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
10490
10536
|
"td",
|
|
@@ -10978,7 +11024,7 @@ function HierarchyDragIndicatorLayer({
|
|
|
10978
11024
|
scrollRef,
|
|
10979
11025
|
resolve: resolve2
|
|
10980
11026
|
}) {
|
|
10981
|
-
const [indicator, setIndicator] = (0,
|
|
11027
|
+
const [indicator, setIndicator] = (0, import_react18.useState)(
|
|
10982
11028
|
null
|
|
10983
11029
|
);
|
|
10984
11030
|
(0, import_core3.useDndMonitor)({
|
|
@@ -11082,9 +11128,9 @@ function HierarchyDroppableRow({
|
|
|
11082
11128
|
children
|
|
11083
11129
|
}) {
|
|
11084
11130
|
const { setNodeRef } = (0, import_core3.useDroppable)({ id, disabled });
|
|
11085
|
-
if (!(0,
|
|
11131
|
+
if (!(0, import_react18.isValidElement)(children) || children.type !== "tr") return children;
|
|
11086
11132
|
const row = children;
|
|
11087
|
-
return (0,
|
|
11133
|
+
return (0, import_react18.cloneElement)(row, {
|
|
11088
11134
|
ref: setNodeRef,
|
|
11089
11135
|
className: row.props.className
|
|
11090
11136
|
});
|
|
@@ -11124,7 +11170,7 @@ function columnWidthVar(width, resizedWidth, id, resizable) {
|
|
|
11124
11170
|
};
|
|
11125
11171
|
}
|
|
11126
11172
|
function DefaultJsonCell({ value }) {
|
|
11127
|
-
const [open, setOpen] = (0,
|
|
11173
|
+
const [open, setOpen] = (0, import_react18.useState)(false);
|
|
11128
11174
|
const host = useMatrxDataTableHost();
|
|
11129
11175
|
const Viewer = host.JsonViewer;
|
|
11130
11176
|
const text = JSON.stringify(value, null, 2);
|
|
@@ -11181,7 +11227,7 @@ function resolveStringTitle(title, fallback) {
|
|
|
11181
11227
|
}
|
|
11182
11228
|
|
|
11183
11229
|
// src/data-table/SavedViewsControl.tsx
|
|
11184
|
-
var
|
|
11230
|
+
var import_react19 = require("react");
|
|
11185
11231
|
|
|
11186
11232
|
// src/dropdown-menu.tsx
|
|
11187
11233
|
var DropdownMenuPrimitive = __toESM(require("@radix-ui/react-dropdown-menu"), 1);
|
|
@@ -11324,11 +11370,11 @@ function SavedViewsControl({
|
|
|
11324
11370
|
onUpdate,
|
|
11325
11371
|
onReload
|
|
11326
11372
|
}) {
|
|
11327
|
-
const unsavedChangesId = (0,
|
|
11328
|
-
const [saveOpen, setSaveOpen] = (0,
|
|
11329
|
-
const [name, setName] = (0,
|
|
11330
|
-
const [saving, setSaving] = (0,
|
|
11331
|
-
const [actionError, setActionError] = (0,
|
|
11373
|
+
const unsavedChangesId = (0, import_react19.useId)();
|
|
11374
|
+
const [saveOpen, setSaveOpen] = (0, import_react19.useState)(false);
|
|
11375
|
+
const [name, setName] = (0, import_react19.useState)("");
|
|
11376
|
+
const [saving, setSaving] = (0, import_react19.useState)(false);
|
|
11377
|
+
const [actionError, setActionError] = (0, import_react19.useState)(null);
|
|
11332
11378
|
const visibleError = actionError ?? error;
|
|
11333
11379
|
const save = async () => {
|
|
11334
11380
|
const next = name.trim();
|