@ai-matrx/design-system 0.37.1 → 0.38.1
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 +21 -0
- package/dist/content-transfer.cjs +84 -18
- package/dist/content-transfer.cjs.map +1 -1
- package/dist/content-transfer.js +84 -18
- package/dist/content-transfer.js.map +1 -1
- package/dist/data-table/data-row-inspector.cjs +84 -18
- package/dist/data-table/data-row-inspector.cjs.map +1 -1
- package/dist/data-table/data-row-inspector.js +86 -20
- package/dist/data-table/data-row-inspector.js.map +1 -1
- package/dist/data-table/data-row-window.cjs +84 -18
- package/dist/data-table/data-row-window.cjs.map +1 -1
- package/dist/data-table/data-row-window.js +86 -20
- package/dist/data-table/data-row-window.js.map +1 -1
- package/dist/data-table/index.cjs +85 -19
- package/dist/data-table/index.cjs.map +1 -1
- package/dist/data-table/index.js +181 -115
- package/dist/data-table/index.js.map +1 -1
- package/dist/index.cjs +84 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +21 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +94 -28
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/data-table/index.js
CHANGED
|
@@ -9,8 +9,8 @@ import {
|
|
|
9
9
|
useEffect as useEffect16,
|
|
10
10
|
useId as useId2,
|
|
11
11
|
useLayoutEffect as useLayoutEffect2,
|
|
12
|
-
useMemo as
|
|
13
|
-
useRef as
|
|
12
|
+
useMemo as useMemo9,
|
|
13
|
+
useRef as useRef16,
|
|
14
14
|
useState as useState22
|
|
15
15
|
} from "react";
|
|
16
16
|
import {
|
|
@@ -1486,12 +1486,14 @@ function useIsMobile() {
|
|
|
1486
1486
|
|
|
1487
1487
|
// src/dialog.tsx
|
|
1488
1488
|
import { jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1489
|
+
var DialogWindowedByDefaultContext = React10.createContext(false);
|
|
1489
1490
|
var Dialog = ({
|
|
1490
1491
|
children,
|
|
1491
1492
|
...props
|
|
1492
1493
|
}) => {
|
|
1493
|
-
const
|
|
1494
|
-
|
|
1494
|
+
const isMobile = useIsMobile();
|
|
1495
|
+
const modal = props.modal ?? isMobile;
|
|
1496
|
+
return /* @__PURE__ */ jsx15(DialogWindowedByDefaultContext.Provider, { value: props.modal === void 0, children: /* @__PURE__ */ jsx15(RadixDialogModalProvider, { modal, children: /* @__PURE__ */ jsx15(DialogPrimitive.Root, { ...props, modal, children }) }) });
|
|
1495
1497
|
};
|
|
1496
1498
|
Dialog.displayName = "Dialog";
|
|
1497
1499
|
var DialogPortal = ({
|
|
@@ -1536,6 +1538,11 @@ DialogContentPrimitive.displayName = "DialogContentPrimitive";
|
|
|
1536
1538
|
var DIALOG_DESKTOP_CLASSES = "matrx-dialog-card fixed inset-0 z-[10000] m-auto grid h-fit min-w-0 w-full max-w-lg gap-4 max-h-[85dvh] overflow-y-auto overscroll-contain [--dialog-pad:1.5rem] overflow-x-clip border bg-background p-6 shadow-lg [overflow-wrap:anywhere] [&>*]:min-w-0 [&>*]:max-w-full sm:rounded-lg";
|
|
1537
1539
|
var DIALOG_MOBILE_SHEET_CLASSES = "matrx-mobile-sheet matrx-dialog-card fixed inset-x-0 bottom-0 left-0 right-0 top-auto z-[10000] flex min-w-0 flex-col w-full max-w-full max-h-[90dvh] gap-4 [--dialog-pad:1rem] overflow-x-clip border-t bg-background p-4 pb-safe shadow-lg [overflow-wrap:anywhere] [&>*]:min-w-0 [&>*]:max-w-full rounded-t-2xl rounded-b-none overflow-y-auto overscroll-contain";
|
|
1538
1540
|
var DIALOG_MOBILE_SHEET_OVERRIDE = "inset-x-0 bottom-0 left-0 right-0 top-auto translate-none w-full max-w-full max-h-[90dvh] rounded-b-none rounded-t-2xl overflow-y-auto";
|
|
1541
|
+
var DialogWindowHandleContext = React10.createContext(null);
|
|
1542
|
+
var WINDOW_KEEP_VISIBLE = 80;
|
|
1543
|
+
function isInteractiveTarget(target) {
|
|
1544
|
+
return target instanceof Element && Boolean(target.closest("button, a, input, textarea, select, [role='button'], [contenteditable='true']"));
|
|
1545
|
+
}
|
|
1539
1546
|
var DialogContent = React10.forwardRef(
|
|
1540
1547
|
({
|
|
1541
1548
|
className,
|
|
@@ -1544,15 +1551,51 @@ var DialogContent = React10.forwardRef(
|
|
|
1544
1551
|
animated = true,
|
|
1545
1552
|
showCloseButton = true,
|
|
1546
1553
|
container,
|
|
1554
|
+
dismissOnOutsideClick = false,
|
|
1555
|
+
onInteractOutside,
|
|
1556
|
+
onEscapeKeyDown,
|
|
1557
|
+
style,
|
|
1547
1558
|
...props
|
|
1548
1559
|
}, ref) => {
|
|
1549
1560
|
const isMobile = useIsMobile();
|
|
1550
1561
|
const isModal = useRadixDialogModal();
|
|
1551
1562
|
const injectedContainer = usePortalContainer(container);
|
|
1552
1563
|
const asSheet = mobileSheet && isMobile;
|
|
1564
|
+
const windowed = !isModal && !asSheet;
|
|
1565
|
+
const windowedByDefault = React10.useContext(DialogWindowedByDefaultContext);
|
|
1553
1566
|
const [containerEl, setContainerEl] = React10.useState(
|
|
1554
1567
|
null
|
|
1555
1568
|
);
|
|
1569
|
+
const [offset, setOffset] = React10.useState({ x: 0, y: 0 });
|
|
1570
|
+
const dragRef = React10.useRef(null);
|
|
1571
|
+
const handle = React10.useMemo(() => {
|
|
1572
|
+
if (!windowed) return null;
|
|
1573
|
+
const clamp = (value, limit) => Math.max(-limit, Math.min(limit, value));
|
|
1574
|
+
return {
|
|
1575
|
+
onPointerDown: (event) => {
|
|
1576
|
+
if (event.button !== 0 || isInteractiveTarget(event.target)) return;
|
|
1577
|
+
dragRef.current = { x: event.clientX, y: event.clientY, baseX: offset.x, baseY: offset.y };
|
|
1578
|
+
event.currentTarget.setPointerCapture?.(event.pointerId);
|
|
1579
|
+
},
|
|
1580
|
+
onPointerMove: (event) => {
|
|
1581
|
+
const start = dragRef.current;
|
|
1582
|
+
if (!start) return;
|
|
1583
|
+
setOffset({
|
|
1584
|
+
x: clamp(start.baseX + event.clientX - start.x, window.innerWidth / 2 - WINDOW_KEEP_VISIBLE / 2),
|
|
1585
|
+
y: clamp(start.baseY + event.clientY - start.y, window.innerHeight / 2 - WINDOW_KEEP_VISIBLE / 2)
|
|
1586
|
+
});
|
|
1587
|
+
},
|
|
1588
|
+
onPointerUp: (event) => {
|
|
1589
|
+
if (!dragRef.current) return;
|
|
1590
|
+
dragRef.current = null;
|
|
1591
|
+
event.currentTarget.releasePointerCapture?.(event.pointerId);
|
|
1592
|
+
},
|
|
1593
|
+
onPointerCancel: () => {
|
|
1594
|
+
dragRef.current = null;
|
|
1595
|
+
},
|
|
1596
|
+
onDoubleClick: () => setOffset({ x: 0, y: 0 })
|
|
1597
|
+
};
|
|
1598
|
+
}, [windowed, offset.x, offset.y]);
|
|
1556
1599
|
const mergedRef = React10.useCallback(
|
|
1557
1600
|
(node) => {
|
|
1558
1601
|
setContainerEl(node);
|
|
@@ -1580,19 +1623,33 @@ var DialogContent = React10.forwardRef(
|
|
|
1580
1623
|
// can sit beside a host's floating window manager (which starts at
|
|
1581
1624
|
// z=1000); staying below that boundary makes a newly focused window
|
|
1582
1625
|
// usable without coupling the two systems.
|
|
1583
|
-
!isModal && "z-[900]"
|
|
1626
|
+
!isModal && !windowedByDefault && "z-[900]",
|
|
1627
|
+
// Without an overlay the card needs its own separation from the page.
|
|
1628
|
+
windowed && "shadow-2xl ring-1 ring-border/60"
|
|
1584
1629
|
),
|
|
1630
|
+
style: windowed && (offset.x !== 0 || offset.y !== 0) ? { ...style, translate: `${offset.x}px ${offset.y}px` } : style,
|
|
1631
|
+
onInteractOutside: (event) => {
|
|
1632
|
+
onInteractOutside?.(event);
|
|
1633
|
+
if (windowed && !dismissOnOutsideClick) event.preventDefault();
|
|
1634
|
+
},
|
|
1635
|
+
onEscapeKeyDown: (event) => {
|
|
1636
|
+
onEscapeKeyDown?.(event);
|
|
1637
|
+
const pressedIn = event.target instanceof Node && event.target !== document.body ? event.target : document.activeElement;
|
|
1638
|
+
if (windowed && containerEl && !(pressedIn && containerEl.contains(pressedIn))) {
|
|
1639
|
+
event.preventDefault();
|
|
1640
|
+
}
|
|
1641
|
+
},
|
|
1585
1642
|
...hasDescription ? {} : { "aria-describedby": void 0 },
|
|
1586
1643
|
...props,
|
|
1587
1644
|
children: [
|
|
1588
1645
|
hasTitle ? null : /* @__PURE__ */ jsx15(VisuallyHidden.Root, { children: /* @__PURE__ */ jsx15(DialogPrimitive.Title, { children: "Dialog" }) }),
|
|
1589
|
-
/* @__PURE__ */ jsx15(DialogContainerContext.Provider, { value: containerEl, children: /* @__PURE__ */ jsx15(
|
|
1646
|
+
/* @__PURE__ */ jsx15(DialogContainerContext.Provider, { value: containerEl, children: /* @__PURE__ */ jsx15(DialogWindowHandleContext.Provider, { value: handle, children: /* @__PURE__ */ jsx15(
|
|
1590
1647
|
PortalContainerProvider,
|
|
1591
1648
|
{
|
|
1592
1649
|
container: containerEl ?? injectedContainer ?? null,
|
|
1593
1650
|
children
|
|
1594
1651
|
}
|
|
1595
|
-
) }),
|
|
1652
|
+
) }) }),
|
|
1596
1653
|
showCloseButton ? /* @__PURE__ */ jsxs9(
|
|
1597
1654
|
DialogPrimitive.Close,
|
|
1598
1655
|
{
|
|
@@ -1615,19 +1672,28 @@ DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
|
1615
1672
|
var DialogHeader = ({
|
|
1616
1673
|
className,
|
|
1617
1674
|
...props
|
|
1618
|
-
}) =>
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
"
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1675
|
+
}) => {
|
|
1676
|
+
const handle = React10.useContext(DialogWindowHandleContext);
|
|
1677
|
+
return /* @__PURE__ */ jsx15(
|
|
1678
|
+
"div",
|
|
1679
|
+
{
|
|
1680
|
+
"data-slot": "dialog-header",
|
|
1681
|
+
...handle ? {
|
|
1682
|
+
...handle,
|
|
1683
|
+
"data-window-handle": "",
|
|
1684
|
+
title: "Drag to move \xB7 double-click to recenter"
|
|
1685
|
+
} : {},
|
|
1686
|
+
className: cn(
|
|
1687
|
+
// DialogContent owns an absolute close control. Reserve its hit area in
|
|
1688
|
+
// every header so trailing actions never render underneath it.
|
|
1689
|
+
"flex flex-col space-y-1.5 pr-12 text-center sm:text-left",
|
|
1690
|
+
handle && "cursor-grab select-none active:cursor-grabbing",
|
|
1691
|
+
className
|
|
1692
|
+
),
|
|
1693
|
+
...props
|
|
1694
|
+
}
|
|
1695
|
+
);
|
|
1696
|
+
};
|
|
1631
1697
|
DialogHeader.displayName = "DialogHeader";
|
|
1632
1698
|
var DialogFooter = ({
|
|
1633
1699
|
className,
|
|
@@ -5614,7 +5680,7 @@ function useClippedContentGuard(ref, options) {
|
|
|
5614
5680
|
}
|
|
5615
5681
|
|
|
5616
5682
|
// src/data-table/url-state.ts
|
|
5617
|
-
import { useCallback as useCallback4, useEffect as useEffect7, useMemo as
|
|
5683
|
+
import { useCallback as useCallback4, useEffect as useEffect7, useMemo as useMemo5, useRef as useRef9, useState as useState12 } from "react";
|
|
5618
5684
|
import {
|
|
5619
5685
|
commitUrlParams,
|
|
5620
5686
|
useUrlSearchParams
|
|
@@ -5694,7 +5760,7 @@ function useTableUrlState(options) {
|
|
|
5694
5760
|
[defaultPageSize, defaultSortDirection, defaultSortId, key]
|
|
5695
5761
|
);
|
|
5696
5762
|
const state = readState(searchParams);
|
|
5697
|
-
const lastTextWriteAt =
|
|
5763
|
+
const lastTextWriteAt = useRef9(0);
|
|
5698
5764
|
const [debouncedSearch, setDebouncedSearch] = useState12(state.search);
|
|
5699
5765
|
useEffect7(() => {
|
|
5700
5766
|
if (state.search === debouncedSearch) return;
|
|
@@ -5789,7 +5855,7 @@ function useTableUrlState(options) {
|
|
|
5789
5855
|
writeState(next);
|
|
5790
5856
|
setDebouncedSearch("");
|
|
5791
5857
|
}, [defaultPageSize, defaultSortDirection, defaultSortId, writeState]);
|
|
5792
|
-
const queryState =
|
|
5858
|
+
const queryState = useMemo5(
|
|
5793
5859
|
() => state.search === debouncedSearch ? state : { ...state, search: debouncedSearch, page: 1 },
|
|
5794
5860
|
[state, debouncedSearch]
|
|
5795
5861
|
);
|
|
@@ -5804,10 +5870,10 @@ import {
|
|
|
5804
5870
|
} from "@ai-matrx/kit/url-state";
|
|
5805
5871
|
|
|
5806
5872
|
// src/data-table/RowAlchemyLauncher.tsx
|
|
5807
|
-
import { useCallback as useCallback5, useEffect as useEffect8, useRef as
|
|
5873
|
+
import { useCallback as useCallback5, useEffect as useEffect8, useRef as useRef10, useState as useState13 } from "react";
|
|
5808
5874
|
import { jsx as jsx29, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
5809
5875
|
function MatrxTableRowAlchemyProvider({ copy, placement, controls, children }) {
|
|
5810
|
-
const controller =
|
|
5876
|
+
const controller = useRef10(null);
|
|
5811
5877
|
const { CopyControls } = useMatrxDataTableHost();
|
|
5812
5878
|
const [active, setActive] = useState13(false);
|
|
5813
5879
|
const [fallback, setFallback] = useState13(false);
|
|
@@ -5849,8 +5915,8 @@ function MatrxTableRowAlchemyProvider({ copy, placement, controls, children }) {
|
|
|
5849
5915
|
import {
|
|
5850
5916
|
forwardRef as forwardRef12,
|
|
5851
5917
|
useEffect as useEffect9,
|
|
5852
|
-
useMemo as
|
|
5853
|
-
useRef as
|
|
5918
|
+
useMemo as useMemo6,
|
|
5919
|
+
useRef as useRef11,
|
|
5854
5920
|
useState as useState14
|
|
5855
5921
|
} from "react";
|
|
5856
5922
|
import { useDraggable } from "@dnd-kit/core";
|
|
@@ -6192,7 +6258,7 @@ function ColumnHeaderCell({
|
|
|
6192
6258
|
setPendingNegation(filterValue?.negated ?? false);
|
|
6193
6259
|
}
|
|
6194
6260
|
}, [filterOpen, filterValue]);
|
|
6195
|
-
const notifyOpen =
|
|
6261
|
+
const notifyOpen = useRef11(onFilterOpen);
|
|
6196
6262
|
notifyOpen.current = onFilterOpen;
|
|
6197
6263
|
useEffect9(() => {
|
|
6198
6264
|
if (filterOpen) notifyOpen.current?.();
|
|
@@ -6679,7 +6745,7 @@ function FacetChecklist({
|
|
|
6679
6745
|
const [query, setQuery] = useState14("");
|
|
6680
6746
|
const selected = value?.kind === "select" ? value.values ?? (value.value && value.value !== "__all__" ? [value.value] : []) : [];
|
|
6681
6747
|
const selectedSet = new Set(selected);
|
|
6682
|
-
const rows =
|
|
6748
|
+
const rows = useMemo6(() => {
|
|
6683
6749
|
if (!facets) return [];
|
|
6684
6750
|
const listed = facets.values.map((entry) => ({
|
|
6685
6751
|
value: entry.value,
|
|
@@ -6849,7 +6915,7 @@ function SearchableSelectFilter({
|
|
|
6849
6915
|
allowCustom = false
|
|
6850
6916
|
}) {
|
|
6851
6917
|
const [query, setQuery] = useState14("");
|
|
6852
|
-
const filtered =
|
|
6918
|
+
const filtered = useMemo6(() => {
|
|
6853
6919
|
const q = query.trim().toLowerCase();
|
|
6854
6920
|
if (!q) return options;
|
|
6855
6921
|
return options.filter(
|
|
@@ -7035,7 +7101,7 @@ function parseOptionalNumber(raw) {
|
|
|
7035
7101
|
import {
|
|
7036
7102
|
useCallback as useCallback6,
|
|
7037
7103
|
useEffect as useEffect10,
|
|
7038
|
-
useRef as
|
|
7104
|
+
useRef as useRef12,
|
|
7039
7105
|
useState as useState15
|
|
7040
7106
|
} from "react";
|
|
7041
7107
|
|
|
@@ -7079,11 +7145,11 @@ function ColumnResizeHandle({
|
|
|
7079
7145
|
onResizeCancel,
|
|
7080
7146
|
onResizeCommit
|
|
7081
7147
|
}) {
|
|
7082
|
-
const handleRef =
|
|
7083
|
-
const activeResizeRef =
|
|
7084
|
-
const previewRafRef =
|
|
7085
|
-
const queuedWidthRef =
|
|
7086
|
-
const keyboardWidthRef =
|
|
7148
|
+
const handleRef = useRef12(null);
|
|
7149
|
+
const activeResizeRef = useRef12(null);
|
|
7150
|
+
const previewRafRef = useRef12(null);
|
|
7151
|
+
const queuedWidthRef = useRef12(null);
|
|
7152
|
+
const keyboardWidthRef = useRef12(null);
|
|
7087
7153
|
const [announcedWidth, setAnnouncedWidth] = useState15(null);
|
|
7088
7154
|
const bounds = resolveColumnResizeBounds(minWidth, maxWidth);
|
|
7089
7155
|
const cssVar = columnResizeCssVar(columnId2);
|
|
@@ -7672,7 +7738,7 @@ function scrollOffsetForIndex(input) {
|
|
|
7672
7738
|
}
|
|
7673
7739
|
|
|
7674
7740
|
// src/data-table/useSpreadsheetGrid.ts
|
|
7675
|
-
import { useCallback as useCallback7, useEffect as useEffect11, useMemo as
|
|
7741
|
+
import { useCallback as useCallback7, useEffect as useEffect11, useMemo as useMemo7, useRef as useRef13, useState as useState16 } from "react";
|
|
7676
7742
|
|
|
7677
7743
|
// src/data-table/grid-selection.ts
|
|
7678
7744
|
function rangeBounds(range, rowIds, fieldNames) {
|
|
@@ -8383,11 +8449,11 @@ function useSpreadsheetGrid(options) {
|
|
|
8383
8449
|
const [range, setRange] = useState16(null);
|
|
8384
8450
|
const [fillTarget, setFillTarget] = useState16(null);
|
|
8385
8451
|
const [stack, setStack] = useState16(() => createUndoStack(options?.undoDepth ?? 100));
|
|
8386
|
-
const draggingRef =
|
|
8387
|
-
const optionsRef =
|
|
8452
|
+
const draggingRef = useRef13(null);
|
|
8453
|
+
const optionsRef = useRef13(options);
|
|
8388
8454
|
optionsRef.current = options;
|
|
8389
8455
|
const rowIds = options?.rowIds ?? [];
|
|
8390
|
-
const columnIds =
|
|
8456
|
+
const columnIds = useMemo7(
|
|
8391
8457
|
() => options ? options.columnIds.filter((id) => id !== "") : [],
|
|
8392
8458
|
[options]
|
|
8393
8459
|
);
|
|
@@ -8398,16 +8464,16 @@ function useSpreadsheetGrid(options) {
|
|
|
8398
8464
|
const alive = rowSet.has(range.anchor.rowId) && rowSet.has(range.focus.rowId) && colSet.has(range.anchor.fieldName) && colSet.has(range.focus.fieldName);
|
|
8399
8465
|
if (!alive) setRange(null);
|
|
8400
8466
|
}, [range, rowIds, columnIds]);
|
|
8401
|
-
const bounds =
|
|
8467
|
+
const bounds = useMemo7(
|
|
8402
8468
|
() => range ? rangeBounds(range, rowIds, columnIds) : null,
|
|
8403
8469
|
[range, rowIds, columnIds]
|
|
8404
8470
|
);
|
|
8405
|
-
const rowIndexById =
|
|
8471
|
+
const rowIndexById = useMemo7(() => {
|
|
8406
8472
|
const map = /* @__PURE__ */ new Map();
|
|
8407
8473
|
for (let i = 0; i < rowIds.length; i += 1) map.set(rowIds[i], i);
|
|
8408
8474
|
return map;
|
|
8409
8475
|
}, [rowIds]);
|
|
8410
|
-
const columnIndexById =
|
|
8476
|
+
const columnIndexById = useMemo7(() => {
|
|
8411
8477
|
const map = /* @__PURE__ */ new Map();
|
|
8412
8478
|
for (let i = 0; i < columnIds.length; i += 1) map.set(columnIds[i], i);
|
|
8413
8479
|
return map;
|
|
@@ -8791,9 +8857,9 @@ function useSpreadsheetGrid(options) {
|
|
|
8791
8857
|
},
|
|
8792
8858
|
[]
|
|
8793
8859
|
);
|
|
8794
|
-
const fillTargetRef =
|
|
8860
|
+
const fillTargetRef = useRef13(null);
|
|
8795
8861
|
fillTargetRef.current = fillTarget;
|
|
8796
|
-
const boundsRef =
|
|
8862
|
+
const boundsRef = useRef13(null);
|
|
8797
8863
|
boundsRef.current = bounds;
|
|
8798
8864
|
useEffect11(() => {
|
|
8799
8865
|
if (!options) return;
|
|
@@ -8988,7 +9054,7 @@ function rankTableSearchRows(rows, columns, query, options = {}, extraText) {
|
|
|
8988
9054
|
}
|
|
8989
9055
|
|
|
8990
9056
|
// src/data-table/ColumnManager.tsx
|
|
8991
|
-
import { useEffect as useEffect12, useMemo as
|
|
9057
|
+
import { useEffect as useEffect12, useMemo as useMemo8, useState as useState17 } from "react";
|
|
8992
9058
|
import { useDndMonitor, useDraggable as useDraggable2, useDroppable } from "@dnd-kit/core";
|
|
8993
9059
|
import { jsx as jsx33, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
8994
9060
|
function ColumnManager({
|
|
@@ -8999,7 +9065,7 @@ function ColumnManager({
|
|
|
8999
9065
|
hidden,
|
|
9000
9066
|
onApply
|
|
9001
9067
|
}) {
|
|
9002
|
-
const byId =
|
|
9068
|
+
const byId = useMemo8(
|
|
9003
9069
|
() => new Map(columns.map((column) => [columnId(column), column])),
|
|
9004
9070
|
[columns]
|
|
9005
9071
|
);
|
|
@@ -9541,7 +9607,7 @@ function parseTableViewSnapshot(raw) {
|
|
|
9541
9607
|
// src/data-table/MatrxUuidCell.tsx
|
|
9542
9608
|
import {
|
|
9543
9609
|
useEffect as useEffect13,
|
|
9544
|
-
useRef as
|
|
9610
|
+
useRef as useRef14,
|
|
9545
9611
|
useState as useState18
|
|
9546
9612
|
} from "react";
|
|
9547
9613
|
import { jsx as jsx34, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
@@ -9586,7 +9652,7 @@ function MatrxUuidCell({
|
|
|
9586
9652
|
const [copied, setCopied] = useState18(false);
|
|
9587
9653
|
const [opening, setOpening] = useState18(false);
|
|
9588
9654
|
const [peekOpen, setPeekOpen] = useState18(false);
|
|
9589
|
-
const timer =
|
|
9655
|
+
const timer = useRef14(null);
|
|
9590
9656
|
useEffect13(
|
|
9591
9657
|
() => () => {
|
|
9592
9658
|
if (timer.current) clearTimeout(timer.current);
|
|
@@ -10820,7 +10886,7 @@ function DirtySavePill({
|
|
|
10820
10886
|
}
|
|
10821
10887
|
|
|
10822
10888
|
// src/data-table/EditableTableCell.tsx
|
|
10823
|
-
import { useEffect as useEffect15, useRef as
|
|
10889
|
+
import { useEffect as useEffect15, useRef as useRef15, useState as useState20 } from "react";
|
|
10824
10890
|
import { jsx as jsx39, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
10825
10891
|
function CellRefusal({ reason }) {
|
|
10826
10892
|
return /* @__PURE__ */ jsx39(
|
|
@@ -10994,8 +11060,8 @@ function InlineStringEditor({
|
|
|
10994
11060
|
const [editing, setEditing] = useState20(false);
|
|
10995
11061
|
const [draft, setDraft] = useState20(value);
|
|
10996
11062
|
const [refusal, setRefusal] = useState20(null);
|
|
10997
|
-
const handledEditRequest =
|
|
10998
|
-
const seedRef =
|
|
11063
|
+
const handledEditRequest = useRef15(void 0);
|
|
11064
|
+
const seedRef = useRef15(editSeed);
|
|
10999
11065
|
seedRef.current = editSeed;
|
|
11000
11066
|
useEffect15(() => {
|
|
11001
11067
|
if (editRequest === void 0 || handledEditRequest.current === editRequest) return;
|
|
@@ -12124,7 +12190,7 @@ function MatrxDataTableCore({
|
|
|
12124
12190
|
}) {
|
|
12125
12191
|
const appendQuery = query?.mode === "controlled-append" ? query : null;
|
|
12126
12192
|
const appendQueryKey = appendQuery?.pagination.queryKey ?? null;
|
|
12127
|
-
const committedAppendQueryKey =
|
|
12193
|
+
const committedAppendQueryKey = useRef16(appendQueryKey);
|
|
12128
12194
|
const appendSourceChanged = appendQuery !== null && committedAppendQueryKey.current !== appendQueryKey;
|
|
12129
12195
|
const data = (appendQuery ? appendQuery.pagination.rows : suppliedData) ?? [];
|
|
12130
12196
|
const isLoading = appendQuery ? appendQuery.pagination.loading : suppliedLoading;
|
|
@@ -12139,7 +12205,7 @@ function MatrxDataTableCore({
|
|
|
12139
12205
|
const [savedViewError, setSavedViewError] = useState22(null);
|
|
12140
12206
|
const [toolbarActionError, setToolbarActionError] = useState22(null);
|
|
12141
12207
|
const [toolbarActionPending, setToolbarActionPending] = useState22({ refresh: false, add: false });
|
|
12142
|
-
const toolbarActionPendingRef =
|
|
12208
|
+
const toolbarActionPendingRef = useRef16({ refresh: false, add: false });
|
|
12143
12209
|
const CHECKBOX_TAP_AREA = "h-4 w-4 touch-manipulation";
|
|
12144
12210
|
const mobileCardsClass = mobileCardsBreakpoint === "lg" ? "lg:hidden" : "sm:hidden";
|
|
12145
12211
|
const tableWithCardsClass = mobileCardsBreakpoint === "lg" ? "max-lg:hidden" : "max-sm:hidden";
|
|
@@ -12277,9 +12343,9 @@ function MatrxDataTableCore({
|
|
|
12277
12343
|
const [windowRowSnapshot, setWindowRowSnapshot] = useState22(null);
|
|
12278
12344
|
const editScopeKey = appendQueryKey === null ? "\0local" : `append:${appendQueryKey}`;
|
|
12279
12345
|
const [editsByScope, setEditsByScope] = useState22({});
|
|
12280
|
-
const editRevisionRef =
|
|
12346
|
+
const editRevisionRef = useRef16({});
|
|
12281
12347
|
const [savingByScope, setSavingByScope] = useState22({});
|
|
12282
|
-
const savingScopesRef =
|
|
12348
|
+
const savingScopesRef = useRef16(/* @__PURE__ */ new Set());
|
|
12283
12349
|
const [editRequest, setEditRequest] = useState22(null);
|
|
12284
12350
|
const [confirmForeignDraftDiscard, setConfirmForeignDraftDiscard] = useState22(false);
|
|
12285
12351
|
const edits = editsByScope[editScopeKey]?.values ?? {};
|
|
@@ -12366,13 +12432,13 @@ function MatrxDataTableCore({
|
|
|
12366
12432
|
onWindowRowIdChange,
|
|
12367
12433
|
selectionConfig
|
|
12368
12434
|
]);
|
|
12369
|
-
const scrollRef =
|
|
12370
|
-
const tableRef =
|
|
12371
|
-
const tableHeaderRef =
|
|
12372
|
-
const cardsScrollRef =
|
|
12435
|
+
const scrollRef = useRef16(null);
|
|
12436
|
+
const tableRef = useRef16(null);
|
|
12437
|
+
const tableHeaderRef = useRef16(null);
|
|
12438
|
+
const cardsScrollRef = useRef16(null);
|
|
12373
12439
|
const [documentStickyHeader, setDocumentStickyHeader] = useState22(false);
|
|
12374
|
-
const documentStickyHeaderRef =
|
|
12375
|
-
const previousAppendKeyForScrollReset =
|
|
12440
|
+
const documentStickyHeaderRef = useRef16(false);
|
|
12441
|
+
const previousAppendKeyForScrollReset = useRef16(appendQueryKey);
|
|
12376
12442
|
useLayoutEffect2(() => {
|
|
12377
12443
|
const previous = previousAppendKeyForScrollReset.current;
|
|
12378
12444
|
previousAppendKeyForScrollReset.current = appendQueryKey;
|
|
@@ -12398,7 +12464,7 @@ function MatrxDataTableCore({
|
|
|
12398
12464
|
...appendScrollPolicy?.mode === "scroll" && appendScrollPolicy.thresholdPx !== void 0 ? { thresholdPx: appendScrollPolicy.thresholdPx } : {},
|
|
12399
12465
|
...appendScrollPolicy?.mode === "scroll" && appendScrollPolicy.intentTimeoutMs !== void 0 ? { intentTimeoutMs: appendScrollPolicy.intentTimeoutMs } : {}
|
|
12400
12466
|
});
|
|
12401
|
-
const rootRef =
|
|
12467
|
+
const rootRef = useRef16(null);
|
|
12402
12468
|
useClippedContentGuard(rootRef, {
|
|
12403
12469
|
label: typeof copy === "object" && copy.listLabel ? `Table: ${copy.listLabel}` : "MatrxDataTable"
|
|
12404
12470
|
});
|
|
@@ -12500,11 +12566,11 @@ function MatrxDataTableCore({
|
|
|
12500
12566
|
() => normalizeColumnWidthsForColumns(columnState?.widths, columns)
|
|
12501
12567
|
);
|
|
12502
12568
|
const [fixedTableGeometry, setFixedTableGeometry] = useState22(null);
|
|
12503
|
-
const knownColumnIds =
|
|
12504
|
-
const draggedColumnId =
|
|
12505
|
-
const columnDragActive =
|
|
12506
|
-
const columnDragRaf =
|
|
12507
|
-
const columnDragScrollDirection =
|
|
12569
|
+
const knownColumnIds = useRef16(new Set(columns.map(columnId)));
|
|
12570
|
+
const draggedColumnId = useRef16(null);
|
|
12571
|
+
const columnDragActive = useRef16(false);
|
|
12572
|
+
const columnDragRaf = useRef16(null);
|
|
12573
|
+
const columnDragScrollDirection = useRef16(0);
|
|
12508
12574
|
const [columnDragPreview, setColumnDragPreview] = useState22(null);
|
|
12509
12575
|
const stopColumnDragScroll = useCallback8(() => {
|
|
12510
12576
|
if (columnDragRaf.current !== null) cancelAnimationFrame(columnDragRaf.current);
|
|
@@ -12552,14 +12618,14 @@ function MatrxDataTableCore({
|
|
|
12552
12618
|
const [internalColumnManagerOpen, setInternalColumnManagerOpen] = useState22(false);
|
|
12553
12619
|
const columnManagerOpen = controlledColumnManager?.open ?? internalColumnManagerOpen;
|
|
12554
12620
|
const setColumnManagerOpen = controlledColumnManager?.onOpenChange ?? setInternalColumnManagerOpen;
|
|
12555
|
-
const columnIds =
|
|
12556
|
-
const effectiveColumnOrder =
|
|
12557
|
-
const effectiveHiddenColumnIds =
|
|
12558
|
-
const effectiveColumnWidths =
|
|
12621
|
+
const columnIds = useMemo9(() => columns.map(columnId), [columns]);
|
|
12622
|
+
const effectiveColumnOrder = useMemo9(() => 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]);
|
|
12623
|
+
const effectiveHiddenColumnIds = useMemo9(() => columnState ? new Set(columnState.hidden.filter((id) => columnIds.includes(id))) : hiddenColumnIds, [columnIds, columnState, hiddenColumnIds]);
|
|
12624
|
+
const effectiveColumnWidths = useMemo9(
|
|
12559
12625
|
() => normalizeColumnWidthsForColumns(columnState?.widths ?? columnWidths, columns),
|
|
12560
12626
|
[columns, columnState?.widths, columnWidths]
|
|
12561
12627
|
);
|
|
12562
|
-
const resizeGestureSnapshotRef =
|
|
12628
|
+
const resizeGestureSnapshotRef = useRef16(null);
|
|
12563
12629
|
const measureVisibleColumnWidths = useCallback8(() => {
|
|
12564
12630
|
const measured = {};
|
|
12565
12631
|
const headers = tableRef.current ? Array.from(tableRef.current.querySelectorAll(
|
|
@@ -12661,12 +12727,12 @@ function MatrxDataTableCore({
|
|
|
12661
12727
|
tableRef.current?.style.removeProperty(columnResizeCssVar(id));
|
|
12662
12728
|
}
|
|
12663
12729
|
});
|
|
12664
|
-
const previewColumnOrder =
|
|
12730
|
+
const previewColumnOrder = useMemo9(
|
|
12665
12731
|
() => projectColumnDragOrder(effectiveColumnOrder, columnDragPreview),
|
|
12666
12732
|
[columnDragPreview, effectiveColumnOrder]
|
|
12667
12733
|
);
|
|
12668
12734
|
useColumnReorderAnimation(tableRef, previewColumnOrder.join("\0"), columnDragPreview !== null);
|
|
12669
|
-
const visibleColumns =
|
|
12735
|
+
const visibleColumns = useMemo9(() => {
|
|
12670
12736
|
const byId = new Map(columns.map((column) => [columnId(column), column]));
|
|
12671
12737
|
return previewColumnOrder.map((id) => byId.get(id)).filter(
|
|
12672
12738
|
(column) => column !== void 0 && !effectiveHiddenColumnIds.has(columnId(column))
|
|
@@ -12702,7 +12768,7 @@ function MatrxDataTableCore({
|
|
|
12702
12768
|
setFixedTableGeometry(geometry);
|
|
12703
12769
|
}, [resolvedDensity, measureFixedTableGeometry, usesMeasuredFixedLayout]);
|
|
12704
12770
|
const fixedLayoutActive = usesMeasuredFixedLayout && fixedTableGeometry !== null;
|
|
12705
|
-
const frozenColumns =
|
|
12771
|
+
const frozenColumns = useMemo9(() => {
|
|
12706
12772
|
if (!visibleColumns.some((column) => column.frozen)) return NO_FROZEN_COLUMNS;
|
|
12707
12773
|
const ids = visibleColumns.map(columnId);
|
|
12708
12774
|
const byId = new Map(visibleColumns.map((column) => [columnId(column), column]));
|
|
@@ -12750,7 +12816,7 @@ function MatrxDataTableCore({
|
|
|
12750
12816
|
const color = cellTintColor(row, id, colId);
|
|
12751
12817
|
return color ? CELL_TINT_CLASS[color] : void 0;
|
|
12752
12818
|
};
|
|
12753
|
-
const declaredVisibleCopyColumns =
|
|
12819
|
+
const declaredVisibleCopyColumns = useMemo9(
|
|
12754
12820
|
() => visibleColumns.filter((column) => column.accessorFn !== void 0 || column.accessorKey !== void 0),
|
|
12755
12821
|
[visibleColumns]
|
|
12756
12822
|
);
|
|
@@ -12758,7 +12824,7 @@ function MatrxDataTableCore({
|
|
|
12758
12824
|
const tableContextMenuInstanceId = useId2();
|
|
12759
12825
|
const tableDndContextId = useId2();
|
|
12760
12826
|
const defaultCopyTitle = toolbar?.title || "Table";
|
|
12761
|
-
const defaultCopy =
|
|
12827
|
+
const defaultCopy = useMemo9(() => ({
|
|
12762
12828
|
label: defaultCopyTitle,
|
|
12763
12829
|
listLabel: defaultCopyTitle,
|
|
12764
12830
|
location: defaultCopyTitle,
|
|
@@ -12793,7 +12859,7 @@ function MatrxDataTableCore({
|
|
|
12793
12859
|
serializer: (shaped) => buildViewAgentInput(effectiveCopy, shaped, data, { scope: "custom" })
|
|
12794
12860
|
}))
|
|
12795
12861
|
] : [];
|
|
12796
|
-
const filterMeta =
|
|
12862
|
+
const filterMeta = useMemo9(() => {
|
|
12797
12863
|
const meta = /* @__PURE__ */ new Map();
|
|
12798
12864
|
for (const col of visibleColumns) {
|
|
12799
12865
|
const id = columnId(col);
|
|
@@ -12801,14 +12867,14 @@ function MatrxDataTableCore({
|
|
|
12801
12867
|
}
|
|
12802
12868
|
return meta;
|
|
12803
12869
|
}, [visibleColumns, data, remoteQuery]);
|
|
12804
|
-
const intelligentSearchScopes =
|
|
12870
|
+
const intelligentSearchScopes = useMemo9(
|
|
12805
12871
|
() => resolveTableSearchScopes(data, columns, {
|
|
12806
12872
|
...toolbar?.intelligentSearch?.roles === void 0 ? {} : { roles: toolbar.intelligentSearch.roles },
|
|
12807
12873
|
...toolbar?.intelligentSearch?.scopes === void 0 ? {} : { scopes: toolbar.intelligentSearch.scopes }
|
|
12808
12874
|
}),
|
|
12809
12875
|
[columns, data, toolbar?.intelligentSearch?.roles, toolbar?.intelligentSearch?.scopes]
|
|
12810
12876
|
);
|
|
12811
|
-
const processed =
|
|
12877
|
+
const processed = useMemo9(() => {
|
|
12812
12878
|
if (remoteQuery && !appendUsesLocalProcessing) return data;
|
|
12813
12879
|
if (processLocalRows) {
|
|
12814
12880
|
return processLocalRows(data, {
|
|
@@ -12871,7 +12937,7 @@ function MatrxDataTableCore({
|
|
|
12871
12937
|
intelligentSearchEnabled,
|
|
12872
12938
|
searchScope
|
|
12873
12939
|
]);
|
|
12874
|
-
const lastNotifiedViewRows =
|
|
12940
|
+
const lastNotifiedViewRows = useRef16(null);
|
|
12875
12941
|
useEffect16(() => {
|
|
12876
12942
|
if (!onViewChange) {
|
|
12877
12943
|
lastNotifiedViewRows.current = null;
|
|
@@ -12925,7 +12991,7 @@ function MatrxDataTableCore({
|
|
|
12925
12991
|
numberedPageHasMore: !hidePagination && !isLoading && !isFetching && processed.length > 0 && safePage < pageCount && (remoteQuery?.mode === "controlled" || !remoteQuery && localPagination?.mode === "numbered"),
|
|
12926
12992
|
onPageAdvance: setPage
|
|
12927
12993
|
});
|
|
12928
|
-
const paginated =
|
|
12994
|
+
const paginated = useMemo9(() => {
|
|
12929
12995
|
if (remoteQuery) return processed;
|
|
12930
12996
|
if (hidePagination) return processed;
|
|
12931
12997
|
if (localProgressiveEnabled) return [...progressiveRows.rows];
|
|
@@ -12943,7 +13009,7 @@ function MatrxDataTableCore({
|
|
|
12943
13009
|
},
|
|
12944
13010
|
[grouping]
|
|
12945
13011
|
);
|
|
12946
|
-
const groups =
|
|
13012
|
+
const groups = useMemo9(() => {
|
|
12947
13013
|
if (!grouping || !groupingColumnId) return null;
|
|
12948
13014
|
const groupColumn = columns.find((col) => columnId(col) === groupingColumnId);
|
|
12949
13015
|
if (!groupColumn) return null;
|
|
@@ -12962,7 +13028,7 @@ function MatrxDataTableCore({
|
|
|
12962
13028
|
...grouping.emptyLabel ? { emptyLabel: grouping.emptyLabel } : {}
|
|
12963
13029
|
});
|
|
12964
13030
|
}, [grouping, groupingColumnId, columns, paginated]);
|
|
12965
|
-
const groupableColumns =
|
|
13031
|
+
const groupableColumns = useMemo9(() => {
|
|
12966
13032
|
const allowed = grouping?.groupableColumnIds;
|
|
12967
13033
|
return visibleColumns.filter((col) => {
|
|
12968
13034
|
const id = columnId(col);
|
|
@@ -12970,7 +13036,7 @@ function MatrxDataTableCore({
|
|
|
12970
13036
|
return col.accessorKey !== void 0 || col.accessorFn !== void 0;
|
|
12971
13037
|
});
|
|
12972
13038
|
}, [visibleColumns, grouping?.groupableColumnIds]);
|
|
12973
|
-
const groupedRenderRows =
|
|
13039
|
+
const groupedRenderRows = useMemo9(
|
|
12974
13040
|
() => groups ? flattenGroups(groups, collapsedGroups) : null,
|
|
12975
13041
|
[groups, collapsedGroups]
|
|
12976
13042
|
);
|
|
@@ -12980,7 +13046,7 @@ function MatrxDataTableCore({
|
|
|
12980
13046
|
const bodyEntryCount = groupedRenderRows ? groupedRenderRows.length : paginated.length;
|
|
12981
13047
|
const virtualizeActive = virtualizeConfig !== null && virtualizeConfig.enabled !== false && bodyEntryCount > virtualThreshold && !hierarchy && expandedDetail === void 0;
|
|
12982
13048
|
const columnWindowWidth = virtualizeConfig?.columnWidth ?? 160;
|
|
12983
|
-
const frozenRunLength =
|
|
13049
|
+
const frozenRunLength = useMemo9(() => {
|
|
12984
13050
|
let run = 0;
|
|
12985
13051
|
for (const col of visibleColumns) {
|
|
12986
13052
|
if (frozenColumns.offsets[columnId(col)] === void 0) break;
|
|
@@ -12991,7 +13057,7 @@ function MatrxDataTableCore({
|
|
|
12991
13057
|
const columnVirtualizeActive = virtualizeConfig !== null && virtualizeConfig.enabled !== false && virtualizeConfig.columns === true && visibleColumns.length - frozenRunLength > 30 && !hierarchy && mobileCards === void 0;
|
|
12992
13058
|
const [rowWindow, setRowWindow] = useState22(null);
|
|
12993
13059
|
const [columnWindow, setColumnWindow] = useState22(null);
|
|
12994
|
-
const windowInputs =
|
|
13060
|
+
const windowInputs = useRef16({
|
|
12995
13061
|
virtualizeActive: false,
|
|
12996
13062
|
bodyEntryCount: 0,
|
|
12997
13063
|
virtualRowHeight: 40,
|
|
@@ -13032,7 +13098,7 @@ function MatrxDataTableCore({
|
|
|
13032
13098
|
setRowWindow((prev) => sameWindow(prev, nextRow) ? prev : nextRow);
|
|
13033
13099
|
setColumnWindow((prev) => sameWindow(prev, nextColumn) ? prev : nextColumn);
|
|
13034
13100
|
}, []);
|
|
13035
|
-
const effectiveRowWindow =
|
|
13101
|
+
const effectiveRowWindow = useMemo9(() => {
|
|
13036
13102
|
if (!virtualizeActive) return null;
|
|
13037
13103
|
if (rowWindow && rowWindow.end <= bodyEntryCount) return rowWindow;
|
|
13038
13104
|
return computeWindow({
|
|
@@ -13043,7 +13109,7 @@ function MatrxDataTableCore({
|
|
|
13043
13109
|
overscan: virtualizeConfig?.overscan ?? 8
|
|
13044
13110
|
});
|
|
13045
13111
|
}, [virtualizeActive, rowWindow, bodyEntryCount, virtualRowHeight, virtualizeConfig?.overscan]);
|
|
13046
|
-
const effectiveColumnWindow =
|
|
13112
|
+
const effectiveColumnWindow = useMemo9(() => {
|
|
13047
13113
|
if (!columnVirtualizeActive) return null;
|
|
13048
13114
|
if (columnWindow && columnWindow.end <= visibleColumns.length) return columnWindow;
|
|
13049
13115
|
return computeWindow({
|
|
@@ -13096,7 +13162,7 @@ function MatrxDataTableCore({
|
|
|
13096
13162
|
observer?.disconnect();
|
|
13097
13163
|
};
|
|
13098
13164
|
}, [metricsWanted, recomputeWindows]);
|
|
13099
|
-
const renderedColumns =
|
|
13165
|
+
const renderedColumns = useMemo9(
|
|
13100
13166
|
() => effectiveColumnWindow ? [
|
|
13101
13167
|
...visibleColumns.slice(0, frozenRunLength),
|
|
13102
13168
|
...visibleColumns.slice(effectiveColumnWindow.start, effectiveColumnWindow.end)
|
|
@@ -13113,7 +13179,7 @@ function MatrxDataTableCore({
|
|
|
13113
13179
|
},
|
|
13114
13180
|
[effectiveColumnWindow, effectiveColumnWidths, frozenColumns, columnWindowWidth]
|
|
13115
13181
|
);
|
|
13116
|
-
const coverageResult =
|
|
13182
|
+
const coverageResult = useMemo9(() => {
|
|
13117
13183
|
if (!coverage) return null;
|
|
13118
13184
|
return describeCoverage({
|
|
13119
13185
|
loaded: coverage.loaded ?? data.length,
|
|
@@ -13124,7 +13190,7 @@ function MatrxDataTableCore({
|
|
|
13124
13190
|
...coverage.noun === void 0 ? {} : { noun: coverage.noun }
|
|
13125
13191
|
});
|
|
13126
13192
|
}, [coverage, data.length]);
|
|
13127
|
-
const bodyEntries =
|
|
13193
|
+
const bodyEntries = useMemo9(() => {
|
|
13128
13194
|
const from = effectiveRowWindow ? effectiveRowWindow.start : 0;
|
|
13129
13195
|
const to = effectiveRowWindow ? effectiveRowWindow.end : void 0;
|
|
13130
13196
|
const windowed = groupedRenderRows ? groupedRenderRows.slice(from, to).map(
|
|
@@ -13141,22 +13207,22 @@ function MatrxDataTableCore({
|
|
|
13141
13207
|
windowed.push({ kind: "spacer", height: effectiveRowWindow.padEnd, place: "end" });
|
|
13142
13208
|
return windowed;
|
|
13143
13209
|
}, [groupedRenderRows, collapsedGroups, paginated, effectiveRowWindow]);
|
|
13144
|
-
const getRowIdRef =
|
|
13210
|
+
const getRowIdRef = useRef16(getRowId);
|
|
13145
13211
|
getRowIdRef.current = getRowId;
|
|
13146
|
-
const spreadsheetRowIds =
|
|
13212
|
+
const spreadsheetRowIds = useMemo9(
|
|
13147
13213
|
() => paginated.map((row) => getRowIdRef.current(row)),
|
|
13148
13214
|
[paginated]
|
|
13149
13215
|
);
|
|
13150
|
-
const spreadsheetColumnIds =
|
|
13216
|
+
const spreadsheetColumnIds = useMemo9(
|
|
13151
13217
|
() => visibleColumns.map((col) => columnId(col)),
|
|
13152
13218
|
[visibleColumns]
|
|
13153
13219
|
);
|
|
13154
|
-
const spreadsheetRowById =
|
|
13220
|
+
const spreadsheetRowById = useMemo9(() => {
|
|
13155
13221
|
const map = /* @__PURE__ */ new Map();
|
|
13156
13222
|
for (const row of paginated) map.set(getRowIdRef.current(row), row);
|
|
13157
13223
|
return map;
|
|
13158
13224
|
}, [paginated]);
|
|
13159
|
-
const spreadsheetColumnById =
|
|
13225
|
+
const spreadsheetColumnById = useMemo9(() => {
|
|
13160
13226
|
const map = /* @__PURE__ */ new Map();
|
|
13161
13227
|
for (const col of visibleColumns) map.set(columnId(col), col);
|
|
13162
13228
|
return map;
|
|
@@ -13189,9 +13255,9 @@ function MatrxDataTableCore({
|
|
|
13189
13255
|
...spreadsheet.onPastePlan ? { onPastePlan: spreadsheet.onPastePlan } : {}
|
|
13190
13256
|
} : null
|
|
13191
13257
|
);
|
|
13192
|
-
const sheetRef =
|
|
13258
|
+
const sheetRef = useRef16(sheet);
|
|
13193
13259
|
sheetRef.current = sheet;
|
|
13194
|
-
const searchValueRef =
|
|
13260
|
+
const searchValueRef = useRef16(searchValue);
|
|
13195
13261
|
searchValueRef.current = searchValue;
|
|
13196
13262
|
const facetsEnabled = Boolean(facets && facets.enabled !== false);
|
|
13197
13263
|
const [facetState, setFacetState] = useState22({});
|
|
@@ -13203,9 +13269,9 @@ function MatrxDataTableCore({
|
|
|
13203
13269
|
},
|
|
13204
13270
|
[facets, visibleColumns]
|
|
13205
13271
|
);
|
|
13206
|
-
const facetInputsRef =
|
|
13272
|
+
const facetInputsRef = useRef16({ data, facets, facetReadCell });
|
|
13207
13273
|
facetInputsRef.current = { data, facets, facetReadCell };
|
|
13208
|
-
const facetRequestRef =
|
|
13274
|
+
const facetRequestRef = useRef16(/* @__PURE__ */ new Map());
|
|
13209
13275
|
const requestFacets = useCallback8((colId) => {
|
|
13210
13276
|
const { data: rows, facets: config, facetReadCell: readCell } = facetInputsRef.current;
|
|
13211
13277
|
if (!config || config.enabled === false) return;
|
|
@@ -13274,11 +13340,11 @@ function MatrxDataTableCore({
|
|
|
13274
13340
|
if (!controlledQuery || controlledQuery.state.page === safePage) return;
|
|
13275
13341
|
emitControlledQueryChange({ page: safePage });
|
|
13276
13342
|
}, [controlledQuery, emitControlledQueryChange, safePage]);
|
|
13277
|
-
const selectedRow =
|
|
13343
|
+
const selectedRow = useMemo9(() => {
|
|
13278
13344
|
if (!selectedId) return null;
|
|
13279
13345
|
return data.find((r) => getRowId(r) === selectedId) ?? null;
|
|
13280
13346
|
}, [data, selectedId, getRowId]);
|
|
13281
|
-
const windowRow =
|
|
13347
|
+
const windowRow = useMemo9(() => {
|
|
13282
13348
|
if (!windowRowId) return null;
|
|
13283
13349
|
return data.find((r) => getRowId(r) === windowRowId) ?? (windowRowSnapshot && windowRowSnapshot.queryKey === appendQueryKey && getRowId(windowRowSnapshot.row) === windowRowId ? windowRowSnapshot.row : null);
|
|
13284
13350
|
}, [data, windowRowId, windowRowSnapshot, getRowId, appendQueryKey]);
|
|
@@ -13313,7 +13379,7 @@ function MatrxDataTableCore({
|
|
|
13313
13379
|
return def !== void 0 && f.value !== def;
|
|
13314
13380
|
});
|
|
13315
13381
|
const hasActiveFilters = activeFilterCount > 0 || Boolean(searchValue.trim()) || intelligentSearchEnabled && searchScope !== "all" || Boolean(anyOfValue.trim()) || completeLayeredFilterRules(layeredFilters).length > 0 || facetActive;
|
|
13316
|
-
const changeCount =
|
|
13382
|
+
const changeCount = useMemo9(() => {
|
|
13317
13383
|
let n2 = 0;
|
|
13318
13384
|
for (const fields of Object.values(edits)) {
|
|
13319
13385
|
n2 += Object.keys(fields).length;
|
|
@@ -13492,7 +13558,7 @@ function MatrxDataTableCore({
|
|
|
13492
13558
|
}));
|
|
13493
13559
|
return true;
|
|
13494
13560
|
};
|
|
13495
|
-
const requestCellEditRef =
|
|
13561
|
+
const requestCellEditRef = useRef16(requestCellEdit);
|
|
13496
13562
|
requestCellEditRef.current = requestCellEdit;
|
|
13497
13563
|
const buildRecordControls = (row) => {
|
|
13498
13564
|
const rowId = getRowId(row);
|
|
@@ -13519,7 +13585,7 @@ function MatrxDataTableCore({
|
|
|
13519
13585
|
};
|
|
13520
13586
|
const hierarchyRows = hierarchy?.rows ?? data;
|
|
13521
13587
|
const hierarchyGetParentId = hierarchy?.getParentId;
|
|
13522
|
-
const hierarchyIndex =
|
|
13588
|
+
const hierarchyIndex = useMemo9(() => {
|
|
13523
13589
|
if (!hierarchyGetParentId) return null;
|
|
13524
13590
|
const byId = /* @__PURE__ */ new Map();
|
|
13525
13591
|
const parentById = /* @__PURE__ */ new Map();
|
|
@@ -13551,7 +13617,7 @@ function MatrxDataTableCore({
|
|
|
13551
13617
|
return { byId, parentById, depthById };
|
|
13552
13618
|
}, [hierarchyGetParentId, hierarchyRows, getRowId]);
|
|
13553
13619
|
const draggedRow = draggedRowId && hierarchyIndex ? hierarchyIndex.byId.get(draggedRowId) : void 0;
|
|
13554
|
-
const hierarchyBlockedIds =
|
|
13620
|
+
const hierarchyBlockedIds = useMemo9(() => {
|
|
13555
13621
|
if (!draggedRowId || !hierarchyIndex) return null;
|
|
13556
13622
|
const childrenById = /* @__PURE__ */ new Map();
|
|
13557
13623
|
for (const [id, parentId] of hierarchyIndex.parentById) {
|
|
@@ -13797,7 +13863,7 @@ function MatrxDataTableCore({
|
|
|
13797
13863
|
}
|
|
13798
13864
|
}
|
|
13799
13865
|
};
|
|
13800
|
-
const resolveMenuLevelRef =
|
|
13866
|
+
const resolveMenuLevelRef = useRef16(resolveMenuLevel);
|
|
13801
13867
|
resolveMenuLevelRef.current = resolveMenuLevel;
|
|
13802
13868
|
useEffect16(() => {
|
|
13803
13869
|
if (!host.rowContextRegistry) return;
|
|
@@ -13807,7 +13873,7 @@ function MatrxDataTableCore({
|
|
|
13807
13873
|
);
|
|
13808
13874
|
}, [host.rowContextRegistry, tableContextMenuInstanceId]);
|
|
13809
13875
|
const showActionsCol = windowEnabled || Boolean(rowActions) || showInlineRowCopy;
|
|
13810
|
-
const selectedIdSet =
|
|
13876
|
+
const selectedIdSet = useMemo9(
|
|
13811
13877
|
() => new Set(selection?.selectedIds ?? []),
|
|
13812
13878
|
[selection?.selectedIds]
|
|
13813
13879
|
);
|
|
@@ -13819,11 +13885,11 @@ function MatrxDataTableCore({
|
|
|
13819
13885
|
);
|
|
13820
13886
|
const allOnPageSelected = selectableRows.length > 0 && selectedOnPage.length === selectableRows.length;
|
|
13821
13887
|
const someOnPageSelected = selectedOnPage.length > 0 && !allOnPageSelected;
|
|
13822
|
-
const selectedRows =
|
|
13888
|
+
const selectedRows = useMemo9(
|
|
13823
13889
|
() => data.filter((row) => selectedIdSet.has(getRowId(row))),
|
|
13824
13890
|
[data, selectedIdSet, getRowId]
|
|
13825
13891
|
);
|
|
13826
|
-
const lastToggledIndex =
|
|
13892
|
+
const lastToggledIndex = useRef16(null);
|
|
13827
13893
|
const setSelectedIds = (next) => selection?.onSelectedIdsChange([...next]);
|
|
13828
13894
|
const toggleRowSelected = (index, shiftKey) => {
|
|
13829
13895
|
if (!selection) return;
|
|
@@ -13905,7 +13971,7 @@ function MatrxDataTableCore({
|
|
|
13905
13971
|
}
|
|
13906
13972
|
return href ? /* @__PURE__ */ jsx42(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;
|
|
13907
13973
|
};
|
|
13908
|
-
const currentViewSnapshot =
|
|
13974
|
+
const currentViewSnapshot = useMemo9(
|
|
13909
13975
|
() => ({
|
|
13910
13976
|
__kind: "matrx-table-view",
|
|
13911
13977
|
version: 1,
|
|
@@ -13940,7 +14006,7 @@ function MatrxDataTableCore({
|
|
|
13940
14006
|
sort
|
|
13941
14007
|
]
|
|
13942
14008
|
);
|
|
13943
|
-
const declaredDefaultViewSnapshot =
|
|
14009
|
+
const declaredDefaultViewSnapshot = useMemo9(
|
|
13944
14010
|
() => defaultViewSnapshot ?? {
|
|
13945
14011
|
__kind: "matrx-table-view",
|
|
13946
14012
|
version: 1,
|
|
@@ -16315,7 +16381,7 @@ function SavedViewsControl({
|
|
|
16315
16381
|
] })
|
|
16316
16382
|
] }),
|
|
16317
16383
|
dirty ? /* @__PURE__ */ jsx44("span", { id: unsavedChangesId, className: "sr-only", children: "This table view has unsaved changes. Open the view menu to save or update it." }) : null,
|
|
16318
|
-
visibleError ? /* @__PURE__ */ jsx44("p", { role: "alert", className: "basis-full break-words text-xs text-destructive", children: visibleError }) : null,
|
|
16384
|
+
visibleError && !saveOpen ? /* @__PURE__ */ jsx44("p", { role: "alert", className: "basis-full break-words text-xs text-destructive", children: visibleError }) : null,
|
|
16319
16385
|
/* @__PURE__ */ jsx44(Dialog, { open: saveOpen, onOpenChange: setSaveOpen, children: /* @__PURE__ */ jsxs34(DialogContent, { children: [
|
|
16320
16386
|
/* @__PURE__ */ jsx44(DialogHeader, { children: /* @__PURE__ */ jsx44(DialogTitle, { children: "Save current view" }) }),
|
|
16321
16387
|
visibleError ? /* @__PURE__ */ jsx44("p", { role: "alert", className: "text-sm text-destructive", children: visibleError }) : null,
|