@ai-matrx/design-system 0.61.8 → 0.61.10
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 +20 -0
- package/dist/data-table/copy-helpers.d.cts +1 -1
- package/dist/data-table/copy-helpers.d.ts +1 -1
- package/dist/data-table/filter-engine.d.cts +1 -1
- package/dist/data-table/filter-engine.d.ts +1 -1
- package/dist/data-table/host.d.cts +1 -1
- package/dist/data-table/host.d.ts +1 -1
- package/dist/data-table/index.cjs +55 -24
- package/dist/data-table/index.cjs.map +1 -1
- package/dist/data-table/index.d.cts +2 -2
- package/dist/data-table/index.d.ts +2 -2
- package/dist/data-table/index.js +331 -300
- package/dist/data-table/index.js.map +1 -1
- package/dist/data-table/infer-filter.d.cts +1 -1
- package/dist/data-table/infer-filter.d.ts +1 -1
- package/dist/data-table/layered-filters.d.cts +1 -1
- package/dist/data-table/layered-filters.d.ts +1 -1
- package/dist/data-table/query-control.d.cts +1 -1
- package/dist/data-table/query-control.d.ts +1 -1
- package/dist/data-table/types.d.cts +1 -1
- package/dist/data-table/types.d.ts +1 -1
- package/dist/data-table/url-state.d.cts +1 -1
- package/dist/data-table/url-state.d.ts +1 -1
- package/dist/data-table/xlsx.d.cts +1 -1
- package/dist/data-table/xlsx.d.ts +1 -1
- package/dist/index.cjs +32 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +32 -0
- package/dist/index.js.map +1 -1
- package/dist/{layered-filters-DL5BU8Mf.d.cts → layered-filters-DDgNWqzw.d.cts} +1 -1
- package/dist/{layered-filters-CCWzLsOC.d.ts → layered-filters-DnMvx2yK.d.ts} +1 -1
- package/package.json +1 -1
package/dist/data-table/index.js
CHANGED
|
@@ -34000,7 +34000,7 @@ var init_xlsx = __esm({
|
|
|
34000
34000
|
});
|
|
34001
34001
|
|
|
34002
34002
|
// src/data-table/TableScopeBar.tsx
|
|
34003
|
-
import { useId } from "react";
|
|
34003
|
+
import { useEffect, useId, useRef, useState } from "react";
|
|
34004
34004
|
|
|
34005
34005
|
// src/data-table/icons.tsx
|
|
34006
34006
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -34156,45 +34156,76 @@ function ScopeFilter({ filter, id }) {
|
|
|
34156
34156
|
)
|
|
34157
34157
|
] }) });
|
|
34158
34158
|
}
|
|
34159
|
+
function useLanesFit(lanesKey) {
|
|
34160
|
+
const boxRef = useRef(null);
|
|
34161
|
+
const rowRef = useRef(null);
|
|
34162
|
+
const [fits, setFits] = useState(true);
|
|
34163
|
+
useEffect(() => {
|
|
34164
|
+
const box = boxRef.current;
|
|
34165
|
+
const row = rowRef.current;
|
|
34166
|
+
if (!box || !row || typeof ResizeObserver === "undefined") return;
|
|
34167
|
+
const measure = () => {
|
|
34168
|
+
const next = row.scrollWidth <= box.clientWidth + 1;
|
|
34169
|
+
setFits((prev) => prev === next ? prev : next);
|
|
34170
|
+
};
|
|
34171
|
+
measure();
|
|
34172
|
+
const observer = new ResizeObserver(measure);
|
|
34173
|
+
observer.observe(box);
|
|
34174
|
+
observer.observe(row);
|
|
34175
|
+
return () => observer.disconnect();
|
|
34176
|
+
}, [lanesKey]);
|
|
34177
|
+
return { boxRef, rowRef, fits };
|
|
34178
|
+
}
|
|
34159
34179
|
function TableScopeBar({ lanes, value, onChange, dimension, organization }) {
|
|
34160
34180
|
const id = useId();
|
|
34181
|
+
const { boxRef, rowRef, fits } = useLanesFit(lanes.map((lane) => `${lane.value}:${lane.count ?? ""}`).join("|"));
|
|
34161
34182
|
return /* @__PURE__ */ jsxs2("div", { "data-matrx-table-scope-bar": true, className: "flex min-w-0 shrink-0 flex-col gap-1 sm:flex-row sm:items-center", children: [
|
|
34162
|
-
/* @__PURE__ */ jsxs2("div", { className: "min-w-0 sm:flex-1", children: [
|
|
34183
|
+
/* @__PURE__ */ jsxs2("div", { ref: boxRef, "data-matrx-table-scope-lanes": fits ? "tabs" : "select", className: "relative min-w-0 sm:flex-1", children: [
|
|
34163
34184
|
/* @__PURE__ */ jsx2(
|
|
34164
34185
|
"select",
|
|
34165
34186
|
{
|
|
34166
34187
|
"aria-label": "Record scope",
|
|
34167
34188
|
value,
|
|
34168
34189
|
onChange: (event) => onChange(event.target.value),
|
|
34169
|
-
className:
|
|
34190
|
+
className: `h-[var(--matrx-table-control-size,2rem)] w-full rounded-md border border-input bg-background px-2 text-sm sm:w-auto sm:max-w-full ${fits ? "sm:hidden" : ""}`,
|
|
34170
34191
|
children: lanes.map((lane) => /* @__PURE__ */ jsxs2("option", { value: lane.value, disabled: lane.disabled, children: [
|
|
34171
34192
|
lane.label,
|
|
34172
34193
|
lane.count == null ? "" : ` (${lane.count.toLocaleString()})`
|
|
34173
34194
|
] }, lane.value))
|
|
34174
34195
|
}
|
|
34175
34196
|
),
|
|
34176
|
-
/* @__PURE__ */ jsx2(
|
|
34177
|
-
|
|
34178
|
-
|
|
34179
|
-
|
|
34180
|
-
"
|
|
34181
|
-
|
|
34182
|
-
|
|
34183
|
-
|
|
34184
|
-
|
|
34185
|
-
|
|
34186
|
-
|
|
34187
|
-
|
|
34188
|
-
|
|
34189
|
-
|
|
34190
|
-
|
|
34191
|
-
|
|
34192
|
-
|
|
34193
|
-
|
|
34194
|
-
|
|
34195
|
-
|
|
34196
|
-
|
|
34197
|
-
|
|
34197
|
+
/* @__PURE__ */ jsx2(
|
|
34198
|
+
"div",
|
|
34199
|
+
{
|
|
34200
|
+
ref: rowRef,
|
|
34201
|
+
role: "tablist",
|
|
34202
|
+
"aria-label": "Record scope",
|
|
34203
|
+
...fits ? {} : { "aria-hidden": true, inert: true },
|
|
34204
|
+
className: `hidden min-w-0 gap-1 overflow-hidden sm:flex ${fits ? "" : "pointer-events-none invisible absolute left-0 top-0 max-w-none"}`,
|
|
34205
|
+
children: lanes.map((lane) => {
|
|
34206
|
+
const Icon3 = lane.icon ?? SCOPE_ICONS[lane.value] ?? Layers;
|
|
34207
|
+
const active = value === lane.value;
|
|
34208
|
+
return /* @__PURE__ */ jsxs2(
|
|
34209
|
+
"button",
|
|
34210
|
+
{
|
|
34211
|
+
type: "button",
|
|
34212
|
+
role: "tab",
|
|
34213
|
+
"aria-selected": active,
|
|
34214
|
+
"aria-label": lane.count == null ? lane.label : `${lane.label}, ${lane.count.toLocaleString()} records`,
|
|
34215
|
+
disabled: lane.disabled,
|
|
34216
|
+
onClick: () => onChange(lane.value),
|
|
34217
|
+
className: `inline-flex h-[var(--matrx-table-control-size,2rem)] shrink-0 items-center gap-1.5 whitespace-nowrap rounded-md px-2.5 text-sm font-medium transition-colors disabled:opacity-50 ${active ? "bg-primary text-primary-foreground" : "text-muted-foreground hover:bg-muted hover:text-foreground"}`,
|
|
34218
|
+
children: [
|
|
34219
|
+
/* @__PURE__ */ jsx2(Icon3, { "aria-hidden": "true", className: "h-3.5 w-3.5 shrink-0" }),
|
|
34220
|
+
/* @__PURE__ */ jsx2("span", { children: lane.label }),
|
|
34221
|
+
lane.count == null ? null : /* @__PURE__ */ jsx2("span", { className: `rounded px-1 text-xs font-semibold tabular-nums ${active ? "bg-primary-foreground/20" : "bg-muted-foreground/15"}`, children: lane.count.toLocaleString() })
|
|
34222
|
+
]
|
|
34223
|
+
},
|
|
34224
|
+
lane.value
|
|
34225
|
+
);
|
|
34226
|
+
})
|
|
34227
|
+
}
|
|
34228
|
+
)
|
|
34198
34229
|
] }),
|
|
34199
34230
|
dimension || organization ? /* @__PURE__ */ jsxs2("div", { className: "grid min-w-0 shrink-0 grid-cols-2 gap-1 sm:flex sm:max-w-[50%]", children: [
|
|
34200
34231
|
dimension ? /* @__PURE__ */ jsx2(ScopeFilter, { filter: dimension, id: `${id}-dimension` }) : null,
|
|
@@ -34677,7 +34708,7 @@ function TableIconActions({ actions }) {
|
|
|
34677
34708
|
|
|
34678
34709
|
// src/drag-cursor-monitor.tsx
|
|
34679
34710
|
import { useDndContext } from "@dnd-kit/core";
|
|
34680
|
-
import { useEffect as
|
|
34711
|
+
import { useEffect as useEffect3 } from "react";
|
|
34681
34712
|
|
|
34682
34713
|
// src/drag-cursor.ts
|
|
34683
34714
|
var holds = [];
|
|
@@ -34709,7 +34740,7 @@ function DragCursorMonitor({
|
|
|
34709
34740
|
}) {
|
|
34710
34741
|
const { active } = useDndContext();
|
|
34711
34742
|
const dragging = active !== null;
|
|
34712
|
-
|
|
34743
|
+
useEffect3(() => {
|
|
34713
34744
|
if (!dragging) return void 0;
|
|
34714
34745
|
return holdDragCursor(cursor);
|
|
34715
34746
|
}, [dragging, cursor]);
|
|
@@ -34723,12 +34754,12 @@ import {
|
|
|
34723
34754
|
isValidElement as isValidElement3,
|
|
34724
34755
|
memo,
|
|
34725
34756
|
useCallback as useCallback15,
|
|
34726
|
-
useEffect as
|
|
34757
|
+
useEffect as useEffect28,
|
|
34727
34758
|
useId as useId5,
|
|
34728
34759
|
useLayoutEffect as useLayoutEffect5,
|
|
34729
34760
|
useMemo as useMemo12,
|
|
34730
|
-
useRef as
|
|
34731
|
-
useState as
|
|
34761
|
+
useRef as useRef29,
|
|
34762
|
+
useState as useState30,
|
|
34732
34763
|
useContext as useContext10
|
|
34733
34764
|
} from "react";
|
|
34734
34765
|
import { createPortal as createPortal4 } from "react-dom";
|
|
@@ -34966,10 +34997,10 @@ var ErrorBox = React4.forwardRef(function ErrorBox2({
|
|
|
34966
34997
|
});
|
|
34967
34998
|
|
|
34968
34999
|
// src/data-table/use-column-reorder-animation.ts
|
|
34969
|
-
import { useLayoutEffect, useRef } from "react";
|
|
35000
|
+
import { useLayoutEffect, useRef as useRef2 } from "react";
|
|
34970
35001
|
function useColumnReorderAnimation(tableRef, order, dragging) {
|
|
34971
|
-
const previous =
|
|
34972
|
-
const animations =
|
|
35002
|
+
const previous = useRef2({ positions: /* @__PURE__ */ new Map(), dragging: false });
|
|
35003
|
+
const animations = useRef2([]);
|
|
34973
35004
|
useLayoutEffect(() => {
|
|
34974
35005
|
const table = tableRef.current;
|
|
34975
35006
|
if (!table) return;
|
|
@@ -35849,11 +35880,11 @@ function TableTitleRow({
|
|
|
35849
35880
|
}
|
|
35850
35881
|
|
|
35851
35882
|
// src/data-table/TableSearch.tsx
|
|
35852
|
-
import { useRef as
|
|
35883
|
+
import { useRef as useRef3, useState as useState3 } from "react";
|
|
35853
35884
|
import { jsx as jsx18, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
35854
35885
|
function TableSearch({ value, onChange, scope, onScopeChange, scopes, placeholder = "Search\u2026" }) {
|
|
35855
|
-
const [expanded, setExpanded] =
|
|
35856
|
-
const inputRef =
|
|
35886
|
+
const [expanded, setExpanded] = useState3(false);
|
|
35887
|
+
const inputRef = useRef3(null);
|
|
35857
35888
|
return /* @__PURE__ */ jsx18("div", { "data-matrx-table-search": true, className: "h-11 min-w-0 w-full sm:max-w-xs", children: /* @__PURE__ */ jsxs12(
|
|
35858
35889
|
"div",
|
|
35859
35890
|
{
|
|
@@ -35899,7 +35930,7 @@ function TableSearch({ value, onChange, scope, onScopeChange, scopes, placeholde
|
|
|
35899
35930
|
}
|
|
35900
35931
|
|
|
35901
35932
|
// src/data-table/useScrollPagination.ts
|
|
35902
|
-
import { useEffect as
|
|
35933
|
+
import { useEffect as useEffect4, useRef as useRef4, useState as useState4 } from "react";
|
|
35903
35934
|
var DEFAULT_THRESHOLD_PX = 96;
|
|
35904
35935
|
var DEFAULT_INTENT_TIMEOUT_MS = 1200;
|
|
35905
35936
|
function resolveContainer(container) {
|
|
@@ -35970,8 +36001,8 @@ function useScrollPagination({
|
|
|
35970
36001
|
intentTimeoutMs = DEFAULT_INTENT_TIMEOUT_MS,
|
|
35971
36002
|
enabled = true
|
|
35972
36003
|
}) {
|
|
35973
|
-
const [requestError, setRequestError] =
|
|
35974
|
-
const latestRef =
|
|
36004
|
+
const [requestError, setRequestError] = useState4(null);
|
|
36005
|
+
const latestRef = useRef4({
|
|
35975
36006
|
queryKey,
|
|
35976
36007
|
hasNextPage,
|
|
35977
36008
|
isFetchingNextPage,
|
|
@@ -35993,16 +36024,16 @@ function useScrollPagination({
|
|
|
35993
36024
|
thresholdPx,
|
|
35994
36025
|
enabled
|
|
35995
36026
|
};
|
|
35996
|
-
const intentRef =
|
|
35997
|
-
const inputSequenceRef =
|
|
35998
|
-
const consumedSequenceRef =
|
|
35999
|
-
const requestGenerationRef =
|
|
36000
|
-
const inFlightGenerationRef =
|
|
36001
|
-
const requestErrorRef =
|
|
36002
|
-
const mountedRef =
|
|
36003
|
-
const observedTopRef =
|
|
36027
|
+
const intentRef = useRef4(null);
|
|
36028
|
+
const inputSequenceRef = useRef4(0);
|
|
36029
|
+
const consumedSequenceRef = useRef4(0);
|
|
36030
|
+
const requestGenerationRef = useRef4(0);
|
|
36031
|
+
const inFlightGenerationRef = useRef4(null);
|
|
36032
|
+
const requestErrorRef = useRef4(null);
|
|
36033
|
+
const mountedRef = useRef4(false);
|
|
36034
|
+
const observedTopRef = useRef4(/* @__PURE__ */ new WeakMap());
|
|
36004
36035
|
const effectiveError = error ?? requestError;
|
|
36005
|
-
|
|
36036
|
+
useEffect4(() => {
|
|
36006
36037
|
mountedRef.current = true;
|
|
36007
36038
|
return () => {
|
|
36008
36039
|
mountedRef.current = false;
|
|
@@ -36032,7 +36063,7 @@ function useScrollPagination({
|
|
|
36032
36063
|
}
|
|
36033
36064
|
}
|
|
36034
36065
|
};
|
|
36035
|
-
|
|
36066
|
+
useEffect4(() => {
|
|
36036
36067
|
intentRef.current = null;
|
|
36037
36068
|
observedTopRef.current = /* @__PURE__ */ new WeakMap();
|
|
36038
36069
|
consumedSequenceRef.current = inputSequenceRef.current;
|
|
@@ -36041,7 +36072,7 @@ function useScrollPagination({
|
|
|
36041
36072
|
inFlightGenerationRef.current = null;
|
|
36042
36073
|
requestGenerationRef.current += 1;
|
|
36043
36074
|
}, [queryKey]);
|
|
36044
|
-
|
|
36075
|
+
useEffect4(() => {
|
|
36045
36076
|
if (mode !== "scroll" || !enabled || typeof window === "undefined") return;
|
|
36046
36077
|
const attachable = containers.map(resolveContainer).filter((container) => container !== null);
|
|
36047
36078
|
const ownerCleanups = /* @__PURE__ */ new Map();
|
|
@@ -36137,7 +36168,7 @@ function useScrollPagination({
|
|
|
36137
36168
|
}
|
|
36138
36169
|
|
|
36139
36170
|
// src/data-table/useProgressiveTableRows.ts
|
|
36140
|
-
import { useEffect as
|
|
36171
|
+
import { useEffect as useEffect5, useMemo, useRef as useRef5, useState as useState5 } from "react";
|
|
36141
36172
|
function safePageSize(pageSize) {
|
|
36142
36173
|
return Number.isFinite(pageSize) && pageSize > 0 ? Math.floor(pageSize) : 0;
|
|
36143
36174
|
}
|
|
@@ -36163,15 +36194,15 @@ function useProgressiveTableRows({
|
|
|
36163
36194
|
const pageSize = safePageSize(rawPageSize);
|
|
36164
36195
|
const hasExplicitRequestedPage = rawRequestedPage !== void 0;
|
|
36165
36196
|
const requestedPage = safeRequestedPage(rawRequestedPage);
|
|
36166
|
-
const initialRequestedPageRef =
|
|
36167
|
-
const latestRequestedPageRef =
|
|
36168
|
-
const optimisticAdvancePageRef =
|
|
36197
|
+
const initialRequestedPageRef = useRef5(requestedPage);
|
|
36198
|
+
const latestRequestedPageRef = useRef5(requestedPage);
|
|
36199
|
+
const optimisticAdvancePageRef = useRef5(null);
|
|
36169
36200
|
latestRequestedPageRef.current = requestedPage;
|
|
36170
36201
|
const progressionKey = `${queryKey}\0${pageSize}`;
|
|
36171
36202
|
const initialShownCount = startCount(pageSize, initialRequestedPageRef.current);
|
|
36172
36203
|
const resetShownCount = startCount(pageSize, 1);
|
|
36173
36204
|
const queryStartShownCount = hasExplicitRequestedPage ? startCount(pageSize, requestedPage) : resetShownCount;
|
|
36174
|
-
const [progression, setProgression] =
|
|
36205
|
+
const [progression, setProgression] = useState5(() => ({
|
|
36175
36206
|
key: progressionKey,
|
|
36176
36207
|
shownCount: initialShownCount,
|
|
36177
36208
|
requestedPage
|
|
@@ -36182,7 +36213,7 @@ function useProgressiveTableRows({
|
|
|
36182
36213
|
const shownCount = progression.key !== progressionKey ? queryStartShownCount : externallyRequestedPage ? startCount(pageSize, requestedPage) : Math.max(progression.shownCount, resetShownCount);
|
|
36183
36214
|
const visibleCount = Math.min(rows.length, shownCount);
|
|
36184
36215
|
const hasMore = enabled && pageSize > 0 && visibleCount < rows.length;
|
|
36185
|
-
|
|
36216
|
+
useEffect5(() => {
|
|
36186
36217
|
setProgression((current) => {
|
|
36187
36218
|
if (current.key !== progressionKey) {
|
|
36188
36219
|
optimisticAdvancePageRef.current = null;
|
|
@@ -36222,12 +36253,12 @@ function useProgressiveTableRows({
|
|
|
36222
36253
|
onPageAdvance(nextPage);
|
|
36223
36254
|
}
|
|
36224
36255
|
};
|
|
36225
|
-
const warnedUnderfill =
|
|
36226
|
-
const numberedMeasured =
|
|
36227
|
-
const fillInputs =
|
|
36256
|
+
const warnedUnderfill = useRef5(null);
|
|
36257
|
+
const numberedMeasured = useRef5(false);
|
|
36258
|
+
const fillInputs = useRef5({ containers, onPageSizeChange, visibleCount });
|
|
36228
36259
|
fillInputs.current = { containers, onPageSizeChange, visibleCount };
|
|
36229
36260
|
const containerCount = containers.length;
|
|
36230
|
-
|
|
36261
|
+
useEffect5(() => {
|
|
36231
36262
|
if (!hasMore && !numberedPageHasMore) return;
|
|
36232
36263
|
if (!hasMore && numberedMeasured.current) return;
|
|
36233
36264
|
if (!hasMore) numberedMeasured.current = true;
|
|
@@ -36883,7 +36914,7 @@ function DefaultTableStaleNotice({ error, what, onRetry }) {
|
|
|
36883
36914
|
}
|
|
36884
36915
|
|
|
36885
36916
|
// src/data-table/useTableNotice.tsx
|
|
36886
|
-
import { useMemo as useMemo3, useState as
|
|
36917
|
+
import { useMemo as useMemo3, useState as useState7 } from "react";
|
|
36887
36918
|
|
|
36888
36919
|
// src/data-table/host.tsx
|
|
36889
36920
|
import { createContext as createContext6, useContext as useContext6 } from "react";
|
|
@@ -36917,7 +36948,7 @@ function MatrxTableRowControlsScope({ value, children }) {
|
|
|
36917
36948
|
import { jsx as jsx25, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
36918
36949
|
function useTableNotice() {
|
|
36919
36950
|
const host = useMatrxDataTableHost();
|
|
36920
|
-
const [message, setMessage] =
|
|
36951
|
+
const [message, setMessage] = useState7(null);
|
|
36921
36952
|
const notify = useMemo3(
|
|
36922
36953
|
() => ({
|
|
36923
36954
|
success(text) {
|
|
@@ -37265,13 +37296,13 @@ function GenericTablePagination({
|
|
|
37265
37296
|
}
|
|
37266
37297
|
|
|
37267
37298
|
// src/data-table/TableViewTabs.tsx
|
|
37268
|
-
import { useEffect as
|
|
37299
|
+
import { useEffect as useEffect7, useRef as useRef7, useState as useState8 } from "react";
|
|
37269
37300
|
import { jsx as jsx27, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
37270
37301
|
function TableViewTabs({ tabs, activeId, onSelect, onAdd, onClose, onRename, related, editingId, onEditCancel, onEditDone, closable = true, closeLabel = "Close", addHint = "New view from the current one \xB7 double-click a tab to rename", renameable = true }) {
|
|
37271
|
-
const [renaming, setRenaming] =
|
|
37272
|
-
const [draft, setDraft] =
|
|
37273
|
-
const opened =
|
|
37274
|
-
|
|
37302
|
+
const [renaming, setRenaming] = useState8(null);
|
|
37303
|
+
const [draft, setDraft] = useState8("");
|
|
37304
|
+
const opened = useRef7(null);
|
|
37305
|
+
useEffect7(() => {
|
|
37275
37306
|
if (!editingId || opened.current === editingId) return;
|
|
37276
37307
|
const tab = tabs.find((t) => t.id === editingId);
|
|
37277
37308
|
if (!tab) return;
|
|
@@ -37372,16 +37403,16 @@ function TableViewTabs({ tabs, activeId, onSelect, onAdd, onClose, onRename, rel
|
|
|
37372
37403
|
}
|
|
37373
37404
|
var same = (a, b) => JSON.stringify(a) === JSON.stringify(b);
|
|
37374
37405
|
function TableViewWorkspace({ snapshot, onApply, related, store }) {
|
|
37375
|
-
const [localViews, setLocalViews] =
|
|
37376
|
-
const [defaultSnapshot, setDefaultSnapshot] =
|
|
37377
|
-
const [activeId, setActiveId] =
|
|
37378
|
-
const [namingId, setNamingId] =
|
|
37406
|
+
const [localViews, setLocalViews] = useState8([]);
|
|
37407
|
+
const [defaultSnapshot, setDefaultSnapshot] = useState8(snapshot);
|
|
37408
|
+
const [activeId, setActiveId] = useState8("default");
|
|
37409
|
+
const [namingId, setNamingId] = useState8(null);
|
|
37379
37410
|
const saved = store ? store.views : localViews;
|
|
37380
37411
|
const write = (next) => store ? store.onChange(next) : setLocalViews(next);
|
|
37381
37412
|
const tabs = [{ id: "default", label: "Default view", snapshot: defaultSnapshot }, ...saved];
|
|
37382
37413
|
const stashed = () => saved.map((tab) => tab.id === activeId && !same(tab.snapshot, snapshot) ? { ...tab, snapshot } : tab);
|
|
37383
37414
|
const activeSaved = saved.find((tab) => tab.id === activeId);
|
|
37384
|
-
|
|
37415
|
+
useEffect7(() => {
|
|
37385
37416
|
if (store && activeSaved && !same(activeSaved.snapshot, snapshot)) write(stashed());
|
|
37386
37417
|
}, [snapshot]);
|
|
37387
37418
|
const select = (id) => {
|
|
@@ -38655,15 +38686,15 @@ import * as React17 from "react";
|
|
|
38655
38686
|
import * as React15 from "react";
|
|
38656
38687
|
|
|
38657
38688
|
// src/use-scroll-fade.ts
|
|
38658
|
-
import { useCallback as useCallback4, useEffect as
|
|
38689
|
+
import { useCallback as useCallback4, useEffect as useEffect10, useRef as useRef10, useState as useState10 } from "react";
|
|
38659
38690
|
var EPSILON = 2;
|
|
38660
38691
|
function useScrollFade() {
|
|
38661
|
-
const [state, setState] =
|
|
38692
|
+
const [state, setState] = useState10({
|
|
38662
38693
|
top: false,
|
|
38663
38694
|
bottom: false
|
|
38664
38695
|
});
|
|
38665
|
-
const nodeRef =
|
|
38666
|
-
const cleanupRef =
|
|
38696
|
+
const nodeRef = useRef10(null);
|
|
38697
|
+
const cleanupRef = useRef10(null);
|
|
38667
38698
|
const measure = useCallback4(() => {
|
|
38668
38699
|
const el = nodeRef.current;
|
|
38669
38700
|
if (!el) return;
|
|
@@ -38696,7 +38727,7 @@ function useScrollFade() {
|
|
|
38696
38727
|
},
|
|
38697
38728
|
[measure]
|
|
38698
38729
|
);
|
|
38699
|
-
|
|
38730
|
+
useEffect10(() => () => cleanupRef.current?.(), []);
|
|
38700
38731
|
return {
|
|
38701
38732
|
ref,
|
|
38702
38733
|
state,
|
|
@@ -38936,7 +38967,7 @@ var ContextMenuShortcut = ({
|
|
|
38936
38967
|
ContextMenuShortcut.displayName = "ContextMenuShortcut";
|
|
38937
38968
|
|
|
38938
38969
|
// src/data-table/LayeredFilterBuilder.tsx
|
|
38939
|
-
import { useState as
|
|
38970
|
+
import { useState as useState11 } from "react";
|
|
38940
38971
|
|
|
38941
38972
|
// src/popover.tsx
|
|
38942
38973
|
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
@@ -39000,8 +39031,8 @@ function LayeredFilterBuilder({
|
|
|
39000
39031
|
maxRules = 20,
|
|
39001
39032
|
label = "Advanced filters"
|
|
39002
39033
|
}) {
|
|
39003
|
-
const [open, setOpen] =
|
|
39004
|
-
const [draggedIndex, setDraggedIndex] =
|
|
39034
|
+
const [open, setOpen] = useState11(false);
|
|
39035
|
+
const [draggedIndex, setDraggedIndex] = useState11(null);
|
|
39005
39036
|
if (fields.length === 0) return null;
|
|
39006
39037
|
const updateRule = (index, patch) => {
|
|
39007
39038
|
onChange(
|
|
@@ -41043,7 +41074,7 @@ import {
|
|
|
41043
41074
|
forwardRef as forwardRef13,
|
|
41044
41075
|
isValidElement as isValidElement2,
|
|
41045
41076
|
useCallback as useCallback9,
|
|
41046
|
-
useRef as
|
|
41077
|
+
useRef as useRef16
|
|
41047
41078
|
} from "react";
|
|
41048
41079
|
|
|
41049
41080
|
// src/tap-target/cn.ts
|
|
@@ -41052,7 +41083,7 @@ function cn2(...values) {
|
|
|
41052
41083
|
}
|
|
41053
41084
|
|
|
41054
41085
|
// src/tap-target/tap-target-guard.ts
|
|
41055
|
-
import { useCallback as useCallback8, useRef as
|
|
41086
|
+
import { useCallback as useCallback8, useRef as useRef15 } from "react";
|
|
41056
41087
|
var GUARD_SLOT = /* @__PURE__ */ Symbol.for("@ai-matrx/tap-target:guard");
|
|
41057
41088
|
function guardOn() {
|
|
41058
41089
|
return globalThis[GUARD_SLOT] === true;
|
|
@@ -41325,7 +41356,7 @@ function assignRef(ref, value) {
|
|
|
41325
41356
|
else if (ref) ref.current = value;
|
|
41326
41357
|
}
|
|
41327
41358
|
function useTapGuardRef(forwarded, propViolation) {
|
|
41328
|
-
const current =
|
|
41359
|
+
const current = useRef15(null);
|
|
41329
41360
|
return useCallback8(
|
|
41330
41361
|
(node) => {
|
|
41331
41362
|
assignRef(forwarded, node);
|
|
@@ -41347,7 +41378,7 @@ function useTapGuardRef(forwarded, propViolation) {
|
|
|
41347
41378
|
}
|
|
41348
41379
|
|
|
41349
41380
|
// src/tap-target/tap-features.tsx
|
|
41350
|
-
import { useEffect as
|
|
41381
|
+
import { useEffect as useEffect14 } from "react";
|
|
41351
41382
|
import { jsx as jsx36, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
41352
41383
|
var TAP_TONE_CLASS = {
|
|
41353
41384
|
default: "text-foreground",
|
|
@@ -41389,7 +41420,7 @@ function matchesShortcut(e, shortcut) {
|
|
|
41389
41420
|
return e.key.toLowerCase() === p.key;
|
|
41390
41421
|
}
|
|
41391
41422
|
function useTapShortcut(shortcut, getNode, enabled) {
|
|
41392
|
-
|
|
41423
|
+
useEffect14(() => {
|
|
41393
41424
|
if (!shortcut || !enabled) return;
|
|
41394
41425
|
const onKey = (e) => {
|
|
41395
41426
|
if (!matchesShortcut(e, shortcut)) return;
|
|
@@ -41574,7 +41605,7 @@ function useTapTarget({
|
|
|
41574
41605
|
buttonRef,
|
|
41575
41606
|
propViolation
|
|
41576
41607
|
);
|
|
41577
|
-
const nodeRef =
|
|
41608
|
+
const nodeRef = useRef16(null);
|
|
41578
41609
|
const triggerRef = useCallback9(
|
|
41579
41610
|
(node) => {
|
|
41580
41611
|
nodeRef.current = node;
|
|
@@ -43218,9 +43249,9 @@ function useCopySubsetVariant() {
|
|
|
43218
43249
|
}
|
|
43219
43250
|
|
|
43220
43251
|
// src/data-table/clipping.ts
|
|
43221
|
-
import { useEffect as
|
|
43252
|
+
import { useEffect as useEffect17 } from "react";
|
|
43222
43253
|
function useClippedContentGuard(ref, options) {
|
|
43223
|
-
|
|
43254
|
+
useEffect17(() => {
|
|
43224
43255
|
if (!options.enabled || !ref.current) return;
|
|
43225
43256
|
const node = ref.current;
|
|
43226
43257
|
const check2 = () => {
|
|
@@ -43234,7 +43265,7 @@ function useClippedContentGuard(ref, options) {
|
|
|
43234
43265
|
}
|
|
43235
43266
|
|
|
43236
43267
|
// src/data-table/url-state.ts
|
|
43237
|
-
import { useCallback as useCallback11, useEffect as
|
|
43268
|
+
import { useCallback as useCallback11, useEffect as useEffect18, useMemo as useMemo7, useRef as useRef20, useState as useState17 } from "react";
|
|
43238
43269
|
import {
|
|
43239
43270
|
commitUrlParams,
|
|
43240
43271
|
useUrlSearchParams
|
|
@@ -43314,9 +43345,9 @@ function useTableUrlState(options) {
|
|
|
43314
43345
|
[defaultPageSize, defaultSortDirection, defaultSortId, key]
|
|
43315
43346
|
);
|
|
43316
43347
|
const state = readState(searchParams);
|
|
43317
|
-
const lastTextWriteAt =
|
|
43318
|
-
const [debouncedSearch, setDebouncedSearch] =
|
|
43319
|
-
|
|
43348
|
+
const lastTextWriteAt = useRef20(0);
|
|
43349
|
+
const [debouncedSearch, setDebouncedSearch] = useState17(state.search);
|
|
43350
|
+
useEffect18(() => {
|
|
43320
43351
|
if (state.search === debouncedSearch) return;
|
|
43321
43352
|
const timer = window.setTimeout(
|
|
43322
43353
|
() => setDebouncedSearch(state.search),
|
|
@@ -43424,14 +43455,14 @@ import {
|
|
|
43424
43455
|
} from "@ai-matrx/kit/url-state";
|
|
43425
43456
|
|
|
43426
43457
|
// src/data-table/RowAlchemyLauncher.tsx
|
|
43427
|
-
import { useCallback as useCallback12, useEffect as
|
|
43458
|
+
import { useCallback as useCallback12, useEffect as useEffect19, useRef as useRef21, useState as useState18 } from "react";
|
|
43428
43459
|
import { jsx as jsx41, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
43429
43460
|
function MatrxTableRowAlchemyProvider({ copy, placement, controls, children }) {
|
|
43430
|
-
const controller =
|
|
43461
|
+
const controller = useRef21(null);
|
|
43431
43462
|
const { CopyControls } = useMatrxDataTableHost();
|
|
43432
|
-
const [active, setActive] =
|
|
43433
|
-
const [fallback, setFallback] =
|
|
43434
|
-
|
|
43463
|
+
const [active, setActive] = useState18(false);
|
|
43464
|
+
const [fallback, setFallback] = useState18(false);
|
|
43465
|
+
useEffect19(() => {
|
|
43435
43466
|
if (placement !== "menu" || active) return;
|
|
43436
43467
|
const timer = window.setTimeout(() => {
|
|
43437
43468
|
if (!active) {
|
|
@@ -43468,10 +43499,10 @@ function MatrxTableRowAlchemyProvider({ copy, placement, controls, children }) {
|
|
|
43468
43499
|
// src/data-table/ColumnHeaderCell.tsx
|
|
43469
43500
|
import {
|
|
43470
43501
|
forwardRef as forwardRef15,
|
|
43471
|
-
useEffect as
|
|
43502
|
+
useEffect as useEffect20,
|
|
43472
43503
|
useMemo as useMemo8,
|
|
43473
|
-
useRef as
|
|
43474
|
-
useState as
|
|
43504
|
+
useRef as useRef22,
|
|
43505
|
+
useState as useState19
|
|
43475
43506
|
} from "react";
|
|
43476
43507
|
import { useDraggable } from "@dnd-kit/core";
|
|
43477
43508
|
|
|
@@ -43743,7 +43774,7 @@ function HeaderMenuItems({
|
|
|
43743
43774
|
onDone,
|
|
43744
43775
|
depth = 0
|
|
43745
43776
|
}) {
|
|
43746
|
-
const [openSubmenu, setOpenSubmenu] =
|
|
43777
|
+
const [openSubmenu, setOpenSubmenu] = useState19(null);
|
|
43747
43778
|
return /* @__PURE__ */ jsx43("div", { className: cn("flex flex-col gap-0.5", depth > 0 && "ml-3 border-l border-border pl-1"), role: "group", children: items.map((item) => {
|
|
43748
43779
|
const disabled = Boolean(item.disabledReason);
|
|
43749
43780
|
const hasSubmenu = Boolean(item.submenu && item.submenu.length > 0);
|
|
@@ -43860,18 +43891,18 @@ function ColumnHeaderCell({
|
|
|
43860
43891
|
const filterActive = isColumnFilterActive(filterValue);
|
|
43861
43892
|
const deferredFilter = filterKind === "text" || filterApplyLabel !== void 0 || Boolean(filterShowCancel) || filterFooterHint !== void 0;
|
|
43862
43893
|
const showFilterCancel = filterShowCancel ?? filterKind === "text";
|
|
43863
|
-
const [filterOpen, setFilterOpen] =
|
|
43864
|
-
const [pendingNegation, setPendingNegation] =
|
|
43865
|
-
const [draftFilter, setDraftFilter] =
|
|
43866
|
-
|
|
43894
|
+
const [filterOpen, setFilterOpen] = useState19(false);
|
|
43895
|
+
const [pendingNegation, setPendingNegation] = useState19(false);
|
|
43896
|
+
const [draftFilter, setDraftFilter] = useState19(filterValue);
|
|
43897
|
+
useEffect20(() => {
|
|
43867
43898
|
if (!filterOpen) {
|
|
43868
43899
|
setDraftFilter(filterValue);
|
|
43869
43900
|
setPendingNegation(filterValue?.negated ?? false);
|
|
43870
43901
|
}
|
|
43871
43902
|
}, [filterOpen, filterValue]);
|
|
43872
|
-
const notifyOpen =
|
|
43903
|
+
const notifyOpen = useRef22(onFilterOpen);
|
|
43873
43904
|
notifyOpen.current = onFilterOpen;
|
|
43874
|
-
|
|
43905
|
+
useEffect20(() => {
|
|
43875
43906
|
if (filterOpen) notifyOpen.current?.();
|
|
43876
43907
|
}, [filterOpen]);
|
|
43877
43908
|
const applyFilter = () => {
|
|
@@ -44369,7 +44400,7 @@ function FacetChecklist({
|
|
|
44369
44400
|
value,
|
|
44370
44401
|
onChange
|
|
44371
44402
|
}) {
|
|
44372
|
-
const [query, setQuery] =
|
|
44403
|
+
const [query, setQuery] = useState19("");
|
|
44373
44404
|
const selected = value?.kind === "select" ? (value.values ?? (value.value && value.value !== "__all__" ? [value.value] : [])).map((candidate) => candidate === SELECT_EMPTY_VALUE ? "" : candidate) : [];
|
|
44374
44405
|
const selectedSet = new Set(selected);
|
|
44375
44406
|
const rows = useMemo8(() => {
|
|
@@ -44546,7 +44577,7 @@ function SearchableSelectFilter({
|
|
|
44546
44577
|
single = false,
|
|
44547
44578
|
allowCustom = false
|
|
44548
44579
|
}) {
|
|
44549
|
-
const [query, setQuery] =
|
|
44580
|
+
const [query, setQuery] = useState19("");
|
|
44550
44581
|
const filtered = useMemo8(() => {
|
|
44551
44582
|
const q = query.trim().toLowerCase();
|
|
44552
44583
|
if (!q) return options;
|
|
@@ -44676,11 +44707,11 @@ function NumberFilterBody({
|
|
|
44676
44707
|
}) {
|
|
44677
44708
|
const min = value?.kind === "number" ? value.min : void 0;
|
|
44678
44709
|
const max = value?.kind === "number" ? value.max : void 0;
|
|
44679
|
-
const [op, setOp] =
|
|
44680
|
-
const [minText, setMinText] =
|
|
44710
|
+
const [op, setOp] = useState19(() => numberOpOf(value));
|
|
44711
|
+
const [minText, setMinText] = useState19(
|
|
44681
44712
|
value?.kind === "number" && value.op === "lt" && max !== void 0 ? String(max) : min !== void 0 ? String(min) : ""
|
|
44682
44713
|
);
|
|
44683
|
-
const [maxText, setMaxText] =
|
|
44714
|
+
const [maxText, setMaxText] = useState19(max !== void 0 ? String(max) : "");
|
|
44684
44715
|
const active = value?.kind === "number" && (value.op === "empty" || value.op === "not_empty" || min !== void 0 || max !== void 0);
|
|
44685
44716
|
const emit2 = (nextOp, lowRaw, highRaw) => {
|
|
44686
44717
|
if (nextOp === "empty" || nextOp === "not_empty") {
|
|
@@ -44886,7 +44917,7 @@ function MatrxTableGroupHeaderRow({
|
|
|
44886
44917
|
}
|
|
44887
44918
|
|
|
44888
44919
|
// src/data-table/DrillAnswerTable.tsx
|
|
44889
|
-
import { Fragment as Fragment14, useId as useId4, useMemo as useMemo9, useState as
|
|
44920
|
+
import { Fragment as Fragment14, useId as useId4, useMemo as useMemo9, useState as useState20 } from "react";
|
|
44890
44921
|
import { formatCount as formatCount10 } from "@ai-matrx/kit/format";
|
|
44891
44922
|
|
|
44892
44923
|
// src/dropdown-menu.tsx
|
|
@@ -46113,11 +46144,11 @@ function MatrxDrillAnswerTable({
|
|
|
46113
46144
|
}) {
|
|
46114
46145
|
const host = useMatrxDataTableHost();
|
|
46115
46146
|
const tableId = `drill-answer-${useId4()}`;
|
|
46116
|
-
const [query, setQuery] =
|
|
46117
|
-
const [peek, setPeek] =
|
|
46118
|
-
const [collapsed, setCollapsed] =
|
|
46147
|
+
const [query, setQuery] = useState20("");
|
|
46148
|
+
const [peek, setPeek] = useState20(null);
|
|
46149
|
+
const [collapsed, setCollapsed] = useState20(() => /* @__PURE__ */ new Set());
|
|
46119
46150
|
const selectionFor = JSON.stringify([question.by, question.across ?? null, question.where, question.window ?? null]);
|
|
46120
|
-
const [ticked, setTicked] =
|
|
46151
|
+
const [ticked, setTicked] = useState20(() => ({ forQuestion: selectionFor, keys: /* @__PURE__ */ new Set() }));
|
|
46121
46152
|
const selected = ticked.forQuestion === selectionFor ? ticked.keys : /* @__PURE__ */ new Set();
|
|
46122
46153
|
const toggleTick = (key) => setTicked(() => {
|
|
46123
46154
|
const keys2 = new Set(selected);
|
|
@@ -46572,7 +46603,7 @@ function DrillExport({
|
|
|
46572
46603
|
measures,
|
|
46573
46604
|
emptyLabel
|
|
46574
46605
|
}) {
|
|
46575
|
-
const [said, setSaid] =
|
|
46606
|
+
const [said, setSaid] = useState20(null);
|
|
46576
46607
|
const grid = drillAnswerGrid(question, answers, dimensions, measures, emptyLabel);
|
|
46577
46608
|
const trail = question.where.map((w) => `${dimensionRefLabel(dimensions, w.dim)}: ${drillValueLabel(dimensions, w.dim, w.value, emptyLabel)}`);
|
|
46578
46609
|
const copy = async (text, what) => {
|
|
@@ -46626,7 +46657,7 @@ function DrillExport({
|
|
|
46626
46657
|
}
|
|
46627
46658
|
|
|
46628
46659
|
// src/data-table/DrillControls.tsx
|
|
46629
|
-
import { Fragment as Fragment16, useRef as
|
|
46660
|
+
import { Fragment as Fragment16, useRef as useRef23, useState as useState21 } from "react";
|
|
46630
46661
|
import { Fragment as Fragment17, jsx as jsx47, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
46631
46662
|
var NONE = "\0none";
|
|
46632
46663
|
function refsFree(dimensions, taken) {
|
|
@@ -46916,11 +46947,11 @@ function MatrxDrillWindowMenu({
|
|
|
46916
46947
|
customRange = true
|
|
46917
46948
|
}) {
|
|
46918
46949
|
const label = drillWindowLabel(question.window);
|
|
46919
|
-
const [editing, setEditing] =
|
|
46920
|
-
const toForm =
|
|
46950
|
+
const [editing, setEditing] = useState21(false);
|
|
46951
|
+
const toForm = useRef23(false);
|
|
46921
46952
|
const current = question.window ? drillWindowRange(question.window) : null;
|
|
46922
|
-
const [from, setFrom] =
|
|
46923
|
-
const [to, setTo] =
|
|
46953
|
+
const [from, setFrom] = useState21("");
|
|
46954
|
+
const [to, setTo] = useState21("");
|
|
46924
46955
|
const isPreset = !question.window || presets.some((p) => p.key === question.window);
|
|
46925
46956
|
const openCustom = () => {
|
|
46926
46957
|
setFrom(localInput(current?.from));
|
|
@@ -47040,9 +47071,9 @@ function MatrxDrillWindowMenu({
|
|
|
47040
47071
|
// src/data-table/ColumnResizeHandle.tsx
|
|
47041
47072
|
import {
|
|
47042
47073
|
useCallback as useCallback13,
|
|
47043
|
-
useEffect as
|
|
47044
|
-
useRef as
|
|
47045
|
-
useState as
|
|
47074
|
+
useEffect as useEffect21,
|
|
47075
|
+
useRef as useRef24,
|
|
47076
|
+
useState as useState22
|
|
47046
47077
|
} from "react";
|
|
47047
47078
|
|
|
47048
47079
|
// src/data-table/column-resize.ts
|
|
@@ -47085,12 +47116,12 @@ function ColumnResizeHandle({
|
|
|
47085
47116
|
onResizeCancel,
|
|
47086
47117
|
onResizeCommit
|
|
47087
47118
|
}) {
|
|
47088
|
-
const handleRef =
|
|
47089
|
-
const activeResizeRef =
|
|
47090
|
-
const previewRafRef =
|
|
47091
|
-
const queuedWidthRef =
|
|
47092
|
-
const keyboardWidthRef =
|
|
47093
|
-
const [announcedWidth, setAnnouncedWidth] =
|
|
47119
|
+
const handleRef = useRef24(null);
|
|
47120
|
+
const activeResizeRef = useRef24(null);
|
|
47121
|
+
const previewRafRef = useRef24(null);
|
|
47122
|
+
const queuedWidthRef = useRef24(null);
|
|
47123
|
+
const keyboardWidthRef = useRef24(null);
|
|
47124
|
+
const [announcedWidth, setAnnouncedWidth] = useState22(null);
|
|
47094
47125
|
const bounds = resolveColumnResizeBounds(minWidth, maxWidth);
|
|
47095
47126
|
const cssVar = columnResizeCssVar(columnId2);
|
|
47096
47127
|
const readWidth = useCallback13(() => {
|
|
@@ -47137,7 +47168,7 @@ function ColumnResizeHandle({
|
|
|
47137
47168
|
handleRef.current.releasePointerCapture(active.pointerId);
|
|
47138
47169
|
}
|
|
47139
47170
|
}, [clearQueuedPreview, columnId2, cssVar, onResizeCancel, onResizeCommit, tableRef, writePreview]);
|
|
47140
|
-
|
|
47171
|
+
useEffect21(() => () => clearQueuedPreview(), [clearQueuedPreview]);
|
|
47141
47172
|
const onPointerDown = (event) => {
|
|
47142
47173
|
if (disabled || event.button !== 0 || !event.isPrimary) return;
|
|
47143
47174
|
event.preventDefault();
|
|
@@ -47502,7 +47533,7 @@ function groupSummary(group, rowNoun = "row") {
|
|
|
47502
47533
|
}
|
|
47503
47534
|
|
|
47504
47535
|
// src/data-table/useSpreadsheetGrid.ts
|
|
47505
|
-
import { useCallback as useCallback14, useEffect as
|
|
47536
|
+
import { useCallback as useCallback14, useEffect as useEffect22, useMemo as useMemo10, useRef as useRef25, useState as useState23 } from "react";
|
|
47506
47537
|
|
|
47507
47538
|
// src/data-table/grid-selection.ts
|
|
47508
47539
|
function rangeBounds(range, rowIds, fieldNames) {
|
|
@@ -48230,20 +48261,20 @@ var LAYERS_THE_GRID_OPENS = `[data-radix-popper-content-wrapper], [data-radix-po
|
|
|
48230
48261
|
var OPEN_LAYERS = `[role="menu"], [role="dialog"], [role="alertdialog"], [role="listbox"]`;
|
|
48231
48262
|
var READ_ONLY_REASON = "This table is view-only \u2014 you can select and copy, but not change cells.";
|
|
48232
48263
|
function useSpreadsheetGrid(options) {
|
|
48233
|
-
const [range, setRange] =
|
|
48234
|
-
const [fillTarget, setFillTarget] =
|
|
48235
|
-
const [stack, setStack] =
|
|
48236
|
-
const draggingRef =
|
|
48237
|
-
const catcherRef =
|
|
48238
|
-
const composingRef =
|
|
48239
|
-
const optionsRef =
|
|
48264
|
+
const [range, setRange] = useState23(null);
|
|
48265
|
+
const [fillTarget, setFillTarget] = useState23(null);
|
|
48266
|
+
const [stack, setStack] = useState23(() => createUndoStack(options?.undoDepth ?? 100));
|
|
48267
|
+
const draggingRef = useRef25(null);
|
|
48268
|
+
const catcherRef = useRef25(null);
|
|
48269
|
+
const composingRef = useRef25(false);
|
|
48270
|
+
const optionsRef = useRef25(options);
|
|
48240
48271
|
optionsRef.current = options;
|
|
48241
48272
|
const rowIds = options?.rowIds ?? [];
|
|
48242
48273
|
const columnIds = useMemo10(
|
|
48243
48274
|
() => options ? options.columnIds.filter((id) => id !== "") : [],
|
|
48244
48275
|
[options]
|
|
48245
48276
|
);
|
|
48246
|
-
|
|
48277
|
+
useEffect22(() => {
|
|
48247
48278
|
if (!range) return;
|
|
48248
48279
|
const rowSet = new Set(rowIds);
|
|
48249
48280
|
const colSet = new Set(columnIds);
|
|
@@ -48409,11 +48440,11 @@ function useSpreadsheetGrid(options) {
|
|
|
48409
48440
|
},
|
|
48410
48441
|
[rowIds, columnIds]
|
|
48411
48442
|
);
|
|
48412
|
-
const rowIdsRef =
|
|
48443
|
+
const rowIdsRef = useRef25(rowIds);
|
|
48413
48444
|
rowIdsRef.current = rowIds;
|
|
48414
|
-
const columnIdsRef =
|
|
48445
|
+
const columnIdsRef = useRef25(columnIds);
|
|
48415
48446
|
columnIdsRef.current = columnIds;
|
|
48416
|
-
const rangeRef =
|
|
48447
|
+
const rangeRef = useRef25(range);
|
|
48417
48448
|
rangeRef.current = range;
|
|
48418
48449
|
const focusGrid = useCallback14(() => {
|
|
48419
48450
|
const catcher = catcherRef.current;
|
|
@@ -48483,7 +48514,7 @@ function useSpreadsheetGrid(options) {
|
|
|
48483
48514
|
[endEdit, focusIsLost]
|
|
48484
48515
|
);
|
|
48485
48516
|
const holdsARange = range !== null;
|
|
48486
|
-
|
|
48517
|
+
useEffect22(() => {
|
|
48487
48518
|
if (!holdsARange || typeof document === "undefined") return;
|
|
48488
48519
|
const onPointerDown = (event) => {
|
|
48489
48520
|
const target = event.target instanceof Element ? event.target : null;
|
|
@@ -48499,7 +48530,7 @@ function useSpreadsheetGrid(options) {
|
|
|
48499
48530
|
document.addEventListener("pointerdown", onPointerDown, true);
|
|
48500
48531
|
return () => document.removeEventListener("pointerdown", onPointerDown, true);
|
|
48501
48532
|
}, [holdsARange]);
|
|
48502
|
-
|
|
48533
|
+
useEffect22(() => {
|
|
48503
48534
|
if (!holdsARange || typeof document === "undefined" || typeof MutationObserver === "undefined") return;
|
|
48504
48535
|
const timers = [];
|
|
48505
48536
|
const lookAgain = () => {
|
|
@@ -48813,11 +48844,11 @@ function useSpreadsheetGrid(options) {
|
|
|
48813
48844
|
},
|
|
48814
48845
|
[]
|
|
48815
48846
|
);
|
|
48816
|
-
const fillTargetRef =
|
|
48847
|
+
const fillTargetRef = useRef25(null);
|
|
48817
48848
|
fillTargetRef.current = fillTarget;
|
|
48818
|
-
const boundsRef =
|
|
48849
|
+
const boundsRef = useRef25(null);
|
|
48819
48850
|
boundsRef.current = bounds;
|
|
48820
|
-
|
|
48851
|
+
useEffect22(() => {
|
|
48821
48852
|
if (!options) return;
|
|
48822
48853
|
const commit = () => {
|
|
48823
48854
|
const wasDragging = draggingRef.current;
|
|
@@ -48913,7 +48944,7 @@ function useSpreadsheetGrid(options) {
|
|
|
48913
48944
|
}
|
|
48914
48945
|
|
|
48915
48946
|
// src/data-table/ToolbarOverflow.tsx
|
|
48916
|
-
import { createContext as createContext9, useContext as useContext9, useState as
|
|
48947
|
+
import { createContext as createContext9, useContext as useContext9, useState as useState24 } from "react";
|
|
48917
48948
|
|
|
48918
48949
|
// src/bottom-sheet.tsx
|
|
48919
48950
|
import { VisuallyHidden as VisuallyHidden2 } from "@radix-ui/react-visually-hidden";
|
|
@@ -49159,7 +49190,7 @@ function useToolbarListed() {
|
|
|
49159
49190
|
}
|
|
49160
49191
|
var LIST_CLASS = "flex flex-col items-stretch gap-1 [&>*]:w-full [&_[data-matrx-table-toolbar-action]]:w-full [&_[data-matrx-table-group-by]]:w-full";
|
|
49161
49192
|
function ToolbarOverflowMenu({ children, label = "More tools" }) {
|
|
49162
|
-
const [open, setOpen] =
|
|
49193
|
+
const [open, setOpen] = useState24(false);
|
|
49163
49194
|
return /* @__PURE__ */ jsxs40(Popover, { open, onOpenChange: setOpen, children: [
|
|
49164
49195
|
/* @__PURE__ */ jsx51(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx51(
|
|
49165
49196
|
Button,
|
|
@@ -49187,7 +49218,7 @@ function ToolbarOverflowSheet({
|
|
|
49187
49218
|
title = "Table tools",
|
|
49188
49219
|
top
|
|
49189
49220
|
}) {
|
|
49190
|
-
const [open, setOpen] =
|
|
49221
|
+
const [open, setOpen] = useState24(false);
|
|
49191
49222
|
return /* @__PURE__ */ jsxs40(Fragment18, { children: [
|
|
49192
49223
|
/* @__PURE__ */ jsx51(
|
|
49193
49224
|
Button,
|
|
@@ -49232,16 +49263,16 @@ function ToolbarListedLabel({ label, children }) {
|
|
|
49232
49263
|
}
|
|
49233
49264
|
|
|
49234
49265
|
// src/data-table/pinned-fold.ts
|
|
49235
|
-
import { useEffect as
|
|
49266
|
+
import { useEffect as useEffect23, useRef as useRef26, useState as useState25 } from "react";
|
|
49236
49267
|
function pinnedMustFold(room, full) {
|
|
49237
49268
|
if (room <= 0 || full === null) return false;
|
|
49238
49269
|
return full > room + 0.5;
|
|
49239
49270
|
}
|
|
49240
49271
|
function usePinnedFold(el, active) {
|
|
49241
|
-
const [folded, setFolded] =
|
|
49242
|
-
const full =
|
|
49243
|
-
const current =
|
|
49244
|
-
|
|
49272
|
+
const [folded, setFolded] = useState25(false);
|
|
49273
|
+
const full = useRef26(null);
|
|
49274
|
+
const current = useRef26(false);
|
|
49275
|
+
useEffect23(() => {
|
|
49245
49276
|
if (!active || !el) {
|
|
49246
49277
|
if (current.current) {
|
|
49247
49278
|
current.current = false;
|
|
@@ -49428,7 +49459,7 @@ function rankTableSearchRows(rows, columns, query, options = {}, extraText) {
|
|
|
49428
49459
|
}
|
|
49429
49460
|
|
|
49430
49461
|
// src/data-table/ColumnManager.tsx
|
|
49431
|
-
import { useEffect as
|
|
49462
|
+
import { useEffect as useEffect24, useMemo as useMemo11, useState as useState26 } from "react";
|
|
49432
49463
|
import { useDndMonitor, useDraggable as useDraggable2, useDroppable } from "@dnd-kit/core";
|
|
49433
49464
|
import { jsx as jsx52, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
49434
49465
|
function ColumnManager({
|
|
@@ -49443,11 +49474,11 @@ function ColumnManager({
|
|
|
49443
49474
|
() => new Map(columns.map((column) => [columnId(column), column])),
|
|
49444
49475
|
[columns]
|
|
49445
49476
|
);
|
|
49446
|
-
const [draftOrder, setDraftOrder] =
|
|
49447
|
-
const [draftHidden, setDraftHidden] =
|
|
49448
|
-
const [draggedColumnId, setDraggedColumnId] =
|
|
49449
|
-
const [dropTarget, setDropTarget] =
|
|
49450
|
-
|
|
49477
|
+
const [draftOrder, setDraftOrder] = useState26(order);
|
|
49478
|
+
const [draftHidden, setDraftHidden] = useState26(() => new Set(hidden));
|
|
49479
|
+
const [draggedColumnId, setDraggedColumnId] = useState26(null);
|
|
49480
|
+
const [dropTarget, setDropTarget] = useState26(null);
|
|
49481
|
+
useEffect24(() => {
|
|
49451
49482
|
if (!open) return;
|
|
49452
49483
|
setDraftOrder(order);
|
|
49453
49484
|
setDraftHidden(new Set(hidden));
|
|
@@ -49990,9 +50021,9 @@ function parseTableViewSnapshot(raw) {
|
|
|
49990
50021
|
|
|
49991
50022
|
// src/data-table/MatrxUuidCell.tsx
|
|
49992
50023
|
import {
|
|
49993
|
-
useEffect as
|
|
49994
|
-
useRef as
|
|
49995
|
-
useState as
|
|
50024
|
+
useEffect as useEffect25,
|
|
50025
|
+
useRef as useRef27,
|
|
50026
|
+
useState as useState27
|
|
49996
50027
|
} from "react";
|
|
49997
50028
|
import { jsx as jsx53, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
49998
50029
|
var SHORT_LEN = 8;
|
|
@@ -50033,11 +50064,11 @@ function MatrxUuidCell({
|
|
|
50033
50064
|
}) {
|
|
50034
50065
|
const { resolveEntityDoors, ResourcePeek } = useMatrxDataTableHost();
|
|
50035
50066
|
const { notify, notice } = useTableNotice();
|
|
50036
|
-
const [copied, setCopied] =
|
|
50037
|
-
const [opening, setOpening] =
|
|
50038
|
-
const [peekOpen, setPeekOpen] =
|
|
50039
|
-
const timer =
|
|
50040
|
-
|
|
50067
|
+
const [copied, setCopied] = useState27(false);
|
|
50068
|
+
const [opening, setOpening] = useState27(false);
|
|
50069
|
+
const [peekOpen, setPeekOpen] = useState27(false);
|
|
50070
|
+
const timer = useRef27(null);
|
|
50071
|
+
useEffect25(
|
|
50041
50072
|
() => () => {
|
|
50042
50073
|
if (timer.current) clearTimeout(timer.current);
|
|
50043
50074
|
},
|
|
@@ -50333,7 +50364,7 @@ function DataRowInspector({
|
|
|
50333
50364
|
}
|
|
50334
50365
|
|
|
50335
50366
|
// src/data-table/DataRowWindow.tsx
|
|
50336
|
-
import { useEffect as
|
|
50367
|
+
import { useEffect as useEffect26, useState as useState28 } from "react";
|
|
50337
50368
|
import { jsx as jsx55, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
50338
50369
|
function DataRowWindow({
|
|
50339
50370
|
isOpen,
|
|
@@ -50354,8 +50385,8 @@ function DataRowWindow({
|
|
|
50354
50385
|
const hasEdit = editContent != null;
|
|
50355
50386
|
const hasTabs = hasEdit && children == null;
|
|
50356
50387
|
const initialTab = defaultTab ?? (hasEdit ? "edit" : "view");
|
|
50357
|
-
const [tab, setTab] =
|
|
50358
|
-
|
|
50388
|
+
const [tab, setTab] = useState28(initialTab);
|
|
50389
|
+
useEffect26(() => {
|
|
50359
50390
|
if (!isOpen) return;
|
|
50360
50391
|
setTab(defaultTab ?? (hasEdit ? "edit" : "view"));
|
|
50361
50392
|
}, [isOpen, windowId, hasEdit, defaultTab]);
|
|
@@ -51600,7 +51631,7 @@ function DirtySavePill({
|
|
|
51600
51631
|
}
|
|
51601
51632
|
|
|
51602
51633
|
// src/data-table/EditableTableCell.tsx
|
|
51603
|
-
import { useEffect as
|
|
51634
|
+
import { useEffect as useEffect27, useRef as useRef28, useState as useState29 } from "react";
|
|
51604
51635
|
import { jsx as jsx58, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
51605
51636
|
function CellRefusal({ reason }) {
|
|
51606
51637
|
return /* @__PURE__ */ jsx58(
|
|
@@ -51662,12 +51693,12 @@ function EditableTableCell({
|
|
|
51662
51693
|
editRequest,
|
|
51663
51694
|
editSeed
|
|
51664
51695
|
}) {
|
|
51665
|
-
const [open, setOpen] =
|
|
51666
|
-
const [refusal, setRefusal] =
|
|
51667
|
-
|
|
51696
|
+
const [open, setOpen] = useState29(false);
|
|
51697
|
+
const [refusal, setRefusal] = useState29(null);
|
|
51698
|
+
useEffect27(() => {
|
|
51668
51699
|
if (editRequest !== void 0) setOpen(true);
|
|
51669
51700
|
}, [editRequest]);
|
|
51670
|
-
|
|
51701
|
+
useEffect27(() => {
|
|
51671
51702
|
if (!open) setRefusal(null);
|
|
51672
51703
|
}, [open]);
|
|
51673
51704
|
const usePencil = Boolean(href) || editTrigger === "pencil";
|
|
@@ -51771,13 +51802,13 @@ function InlineStringEditor({
|
|
|
51771
51802
|
editRequest,
|
|
51772
51803
|
editSeed
|
|
51773
51804
|
}) {
|
|
51774
|
-
const [editing, setEditing] =
|
|
51775
|
-
const [draft, setDraft] =
|
|
51776
|
-
const [refusal, setRefusal] =
|
|
51777
|
-
const handledEditRequest =
|
|
51778
|
-
const seedRef =
|
|
51805
|
+
const [editing, setEditing] = useState29(false);
|
|
51806
|
+
const [draft, setDraft] = useState29(value);
|
|
51807
|
+
const [refusal, setRefusal] = useState29(null);
|
|
51808
|
+
const handledEditRequest = useRef28(void 0);
|
|
51809
|
+
const seedRef = useRef28(editSeed);
|
|
51779
51810
|
seedRef.current = editSeed;
|
|
51780
|
-
|
|
51811
|
+
useEffect27(() => {
|
|
51781
51812
|
if (editRequest === void 0 || handledEditRequest.current === editRequest) return;
|
|
51782
51813
|
handledEditRequest.current = editRequest;
|
|
51783
51814
|
setDraft(seedRef.current ?? value);
|
|
@@ -51937,8 +51968,8 @@ function DateEditor({
|
|
|
51937
51968
|
onCommit,
|
|
51938
51969
|
onCancel
|
|
51939
51970
|
}) {
|
|
51940
|
-
const [draft, setDraft] =
|
|
51941
|
-
const done =
|
|
51971
|
+
const [draft, setDraft] = useState29(value);
|
|
51972
|
+
const done = useRef28(false);
|
|
51942
51973
|
const finish = () => {
|
|
51943
51974
|
if (done.current) return;
|
|
51944
51975
|
done.current = true;
|
|
@@ -51973,8 +52004,8 @@ function TagsEditor({
|
|
|
51973
52004
|
onCommit,
|
|
51974
52005
|
onCancel
|
|
51975
52006
|
}) {
|
|
51976
|
-
const [tags, setTags] =
|
|
51977
|
-
const [draft, setDraft] =
|
|
52007
|
+
const [tags, setTags] = useState29(value);
|
|
52008
|
+
const [draft, setDraft] = useState29("");
|
|
51978
52009
|
const add = (raw) => {
|
|
51979
52010
|
const next = raw.trim();
|
|
51980
52011
|
if (!next || tags.includes(next)) return;
|
|
@@ -52071,7 +52102,7 @@ function NumberEditor({
|
|
|
52071
52102
|
onCommit,
|
|
52072
52103
|
onCancel
|
|
52073
52104
|
}) {
|
|
52074
|
-
const [draft, setDraft] =
|
|
52105
|
+
const [draft, setDraft] = useState29(String(value));
|
|
52075
52106
|
return /* @__PURE__ */ jsxs47("div", { className: "flex flex-col gap-2", children: [
|
|
52076
52107
|
/* @__PURE__ */ jsx58(
|
|
52077
52108
|
Input,
|
|
@@ -52580,7 +52611,7 @@ function MatrxDataTable(suppliedProps) {
|
|
|
52580
52611
|
const props = card ? withTableCardDefaults(suppliedProps, card) : suppliedProps;
|
|
52581
52612
|
const sourceRows = props.query?.mode === "controlled-append" ? props.query.pagination.rows : props.data;
|
|
52582
52613
|
const availableRows = sourceRows ?? EMPTY_TABLE_ROWS;
|
|
52583
|
-
const [defaultSelectionState, setDefaultSelectionState] =
|
|
52614
|
+
const [defaultSelectionState, setDefaultSelectionState] = useState30({
|
|
52584
52615
|
sourceRows: availableRows,
|
|
52585
52616
|
selectedIds: []
|
|
52586
52617
|
});
|
|
@@ -52638,7 +52669,7 @@ function MatrxDataTableWithUrlState({
|
|
|
52638
52669
|
...urlState.history === void 0 ? {} : { history: urlState.history },
|
|
52639
52670
|
...urlState.textHistory === void 0 ? {} : { textHistory: urlState.textHistory }
|
|
52640
52671
|
});
|
|
52641
|
-
|
|
52672
|
+
useEffect28(() => {
|
|
52642
52673
|
if (activeUrlTableIds.has(urlState.id)) {
|
|
52643
52674
|
throw new Error(
|
|
52644
52675
|
`Duplicate MatrxDataTable urlState.id "${urlState.id}" on one page. Give every table a unique stable id.`
|
|
@@ -52747,7 +52778,7 @@ var DND_MEASURING = { droppable: { strategy: MeasuringStrategy.Always } };
|
|
|
52747
52778
|
var NO_LAYERED_FILTERS = [];
|
|
52748
52779
|
var NO_GROUPING_VALUE = "__matrx_no_grouping__";
|
|
52749
52780
|
function useRenderEpoch(values) {
|
|
52750
|
-
const held =
|
|
52781
|
+
const held = useRef29(null);
|
|
52751
52782
|
const previous = held.current;
|
|
52752
52783
|
if (previous !== null && previous.values.length === values.length && previous.values.every((value, i) => Object.is(value, values[i]))) {
|
|
52753
52784
|
return previous.epoch;
|
|
@@ -52791,7 +52822,7 @@ function sameBodyRow(a, b) {
|
|
|
52791
52822
|
}
|
|
52792
52823
|
var MatrxTableBodyRow = memo(function MatrxTableBodyRow2(props) {
|
|
52793
52824
|
const { rowId, row, index, draw } = props;
|
|
52794
|
-
const last =
|
|
52825
|
+
const last = useRef29(null);
|
|
52795
52826
|
const fresh = last.current === null || !sameBodyRow({ ...last.current, probe: props.probe }, props);
|
|
52796
52827
|
last.current = props;
|
|
52797
52828
|
return draw(rowId, row, index, fresh);
|
|
@@ -52925,7 +52956,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
52925
52956
|
const selectionConfig = suppliedSelectionConfig === false ? void 0 : suppliedSelectionConfig;
|
|
52926
52957
|
const appendQuery = query?.mode === "controlled-append" ? query : null;
|
|
52927
52958
|
const appendQueryKey = appendQuery?.pagination.queryKey ?? null;
|
|
52928
|
-
const committedAppendQueryKey =
|
|
52959
|
+
const committedAppendQueryKey = useRef29(appendQueryKey);
|
|
52929
52960
|
const appendSourceChanged = appendQuery !== null && committedAppendQueryKey.current !== appendQueryKey;
|
|
52930
52961
|
const data = (appendQuery ? appendQuery.pagination.rows : suppliedData) ?? EMPTY_TABLE_ROWS;
|
|
52931
52962
|
const readView = tableReadView(read, data.length, appendQuery ? appendQuery.pagination.loading : suppliedLoading);
|
|
@@ -52943,16 +52974,16 @@ function MatrxDataTableCore(coreProps) {
|
|
|
52943
52974
|
const Link = host.Link ?? DefaultTableLink;
|
|
52944
52975
|
const SidePanelSurface = host.SidePanelSurface ?? DefaultTableSidePanel;
|
|
52945
52976
|
const { notify: toast, notice } = useTableNotice();
|
|
52946
|
-
const [savedViewError, setSavedViewError] =
|
|
52947
|
-
const [toolbarActionError, setToolbarActionError] =
|
|
52948
|
-
const [toolbarActionPending, setToolbarActionPending] =
|
|
52949
|
-
const toolbarActionPendingRef =
|
|
52977
|
+
const [savedViewError, setSavedViewError] = useState30(null);
|
|
52978
|
+
const [toolbarActionError, setToolbarActionError] = useState30(null);
|
|
52979
|
+
const [toolbarActionPending, setToolbarActionPending] = useState30({ refresh: false, add: false });
|
|
52980
|
+
const toolbarActionPendingRef = useRef29({ refresh: false, add: false });
|
|
52950
52981
|
const CHECKBOX_TAP_AREA = "h-4 w-4 touch-manipulation";
|
|
52951
52982
|
const mobileCardsClass = mobileCardsBreakpoint === "lg" ? "lg:hidden" : "sm:hidden";
|
|
52952
52983
|
const tableWithCardsClass = mobileCardsBreakpoint === "lg" ? "max-lg:hidden" : "max-sm:hidden";
|
|
52953
52984
|
const cardsQuery = mobileCardsBreakpoint === "lg" ? "(max-width: 1023px)" : "(max-width: 639px)";
|
|
52954
|
-
const [cardsActive, setCardsActive] =
|
|
52955
|
-
|
|
52985
|
+
const [cardsActive, setCardsActive] = useState30(null);
|
|
52986
|
+
useEffect28(() => {
|
|
52956
52987
|
if (!mobileCards || typeof window === "undefined" || !window.matchMedia) return;
|
|
52957
52988
|
const mql = window.matchMedia(cardsQuery);
|
|
52958
52989
|
const read2 = () => setCardsActive(mql.matches);
|
|
@@ -52982,8 +53013,8 @@ function MatrxDataTableCore(coreProps) {
|
|
|
52982
53013
|
},
|
|
52983
53014
|
[controlledQuery]
|
|
52984
53015
|
);
|
|
52985
|
-
const [internalSearch, setInternalSearch] =
|
|
52986
|
-
const [draggedRowId, setDraggedRowId] =
|
|
53016
|
+
const [internalSearch, setInternalSearch] = useState30("");
|
|
53017
|
+
const [draggedRowId, setDraggedRowId] = useState30(null);
|
|
52987
53018
|
const hierarchySensors = useSensors(useSensor(PointerSensor, POINTER_SENSOR_OPTIONS));
|
|
52988
53019
|
const toolbarSearchControlled = toolbar?.searchValue !== void 0;
|
|
52989
53020
|
const searchValue = controlledQuery ? controlledQuery.state.search : toolbarSearchControlled ? toolbar?.searchValue ?? "" : internalSearch;
|
|
@@ -52995,7 +53026,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
52995
53026
|
}
|
|
52996
53027
|
toolbar?.onSearchChange?.(v);
|
|
52997
53028
|
};
|
|
52998
|
-
const [internalSearchMatchMode, setInternalSearchMatchMode] =
|
|
53029
|
+
const [internalSearchMatchMode, setInternalSearchMatchMode] = useState30(
|
|
52999
53030
|
toolbar?.searchMatch?.defaultMode ?? "contains"
|
|
53000
53031
|
);
|
|
53001
53032
|
const searchMatchMode = controlledQuery ? controlledQuery.state.searchMatchMode ?? toolbar?.searchMatch?.defaultMode ?? "contains" : internalSearchMatchMode;
|
|
@@ -53006,7 +53037,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53006
53037
|
}
|
|
53007
53038
|
setInternalSearchMatchMode(mode);
|
|
53008
53039
|
};
|
|
53009
|
-
const [internalSearchScope, setInternalSearchScope] =
|
|
53040
|
+
const [internalSearchScope, setInternalSearchScope] = useState30("all");
|
|
53010
53041
|
const searchScope = controlledQuery ? controlledQuery.state.searchScope ?? "all" : internalSearchScope;
|
|
53011
53042
|
const setSearchScope = (scope) => {
|
|
53012
53043
|
if (controlledQuery) {
|
|
@@ -53015,7 +53046,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53015
53046
|
}
|
|
53016
53047
|
setInternalSearchScope(scope);
|
|
53017
53048
|
};
|
|
53018
|
-
const [internalAnyOf, setInternalAnyOf] =
|
|
53049
|
+
const [internalAnyOf, setInternalAnyOf] = useState30("");
|
|
53019
53050
|
const toolbarAnyOfControlled = toolbar?.anyOf?.value !== void 0;
|
|
53020
53051
|
const anyOfValue = controlledQuery ? controlledQuery.state.anyOf : toolbarAnyOfControlled ? toolbar?.anyOf?.value ?? "" : internalAnyOf;
|
|
53021
53052
|
const setAnyOfValue = (v) => {
|
|
@@ -53026,7 +53057,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53026
53057
|
}
|
|
53027
53058
|
toolbar?.anyOf?.onChange?.(v);
|
|
53028
53059
|
};
|
|
53029
|
-
const [internalLayeredFilters, setInternalLayeredFilters] =
|
|
53060
|
+
const [internalLayeredFilters, setInternalLayeredFilters] = useState30([]);
|
|
53030
53061
|
const layeredFilters = controlledQuery ? controlledQuery.state.layeredFilters ?? NO_LAYERED_FILTERS : internalLayeredFilters;
|
|
53031
53062
|
const setLayeredFilters = (next) => {
|
|
53032
53063
|
if (controlledQuery) {
|
|
@@ -53035,7 +53066,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53035
53066
|
}
|
|
53036
53067
|
setInternalLayeredFilters(next);
|
|
53037
53068
|
};
|
|
53038
|
-
const [internalColumnFilters, setInternalColumnFilters] =
|
|
53069
|
+
const [internalColumnFilters, setInternalColumnFilters] = useState30({});
|
|
53039
53070
|
const columnFilters = controlledQuery ? controlledQuery.state.columnFilters : internalColumnFilters;
|
|
53040
53071
|
const localColumnFilters = useMemo12(() => {
|
|
53041
53072
|
if (appendDefaultsToSourceProcessing) return {};
|
|
@@ -53059,7 +53090,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53059
53090
|
}
|
|
53060
53091
|
setInternalColumnFilters(nextFilters);
|
|
53061
53092
|
};
|
|
53062
|
-
const [internalSort, setInternalSort] =
|
|
53093
|
+
const [internalSort, setInternalSort] = useState30(defaultSort);
|
|
53063
53094
|
const sort = controlledQuery ? controlledQuery.state.sort : internalSort;
|
|
53064
53095
|
const setSort = (next) => {
|
|
53065
53096
|
if (controlledQuery) {
|
|
@@ -53068,7 +53099,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53068
53099
|
}
|
|
53069
53100
|
setInternalSort(next);
|
|
53070
53101
|
};
|
|
53071
|
-
const [internalPage, setInternalPage] =
|
|
53102
|
+
const [internalPage, setInternalPage] = useState30(1);
|
|
53072
53103
|
const page = controlledQuery ? controlledQuery.state.page : internalPage;
|
|
53073
53104
|
const setPage = (next) => {
|
|
53074
53105
|
if (controlledQuery) {
|
|
@@ -53077,7 +53108,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53077
53108
|
}
|
|
53078
53109
|
setInternalPage(next);
|
|
53079
53110
|
};
|
|
53080
|
-
const [internalPageSize, setInternalPageSize] =
|
|
53111
|
+
const [internalPageSize, setInternalPageSize] = useState30(
|
|
53081
53112
|
defaultPageSize
|
|
53082
53113
|
);
|
|
53083
53114
|
const pageSize = controlledQuery ? controlledQuery.state.pageSize : internalPageSize;
|
|
@@ -53088,29 +53119,29 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53088
53119
|
}
|
|
53089
53120
|
setInternalPageSize(next);
|
|
53090
53121
|
};
|
|
53091
|
-
const [uncontrolledSelectedId, setUncontrolledSelectedId] =
|
|
53122
|
+
const [uncontrolledSelectedId, setUncontrolledSelectedId] = useState30(null);
|
|
53092
53123
|
const rawSelectedId = controlledSelectedId !== void 0 ? controlledSelectedId : uncontrolledSelectedId;
|
|
53093
53124
|
const selectedId = appendSourceChanged ? null : rawSelectedId;
|
|
53094
|
-
const [openRequest, setOpenRequest] =
|
|
53125
|
+
const [openRequest, setOpenRequest] = useState30(0);
|
|
53095
53126
|
const setSelectedId = (id) => {
|
|
53096
53127
|
if (controlledSelectedId === void 0) setUncontrolledSelectedId(id);
|
|
53097
53128
|
onSelectedIdChange?.(id);
|
|
53098
53129
|
};
|
|
53099
|
-
const [uncontrolledWindowRowId, setUncontrolledWindowRowId] =
|
|
53130
|
+
const [uncontrolledWindowRowId, setUncontrolledWindowRowId] = useState30(null);
|
|
53100
53131
|
const rawWindowRowId = controlledWindowRowId !== void 0 ? controlledWindowRowId : uncontrolledWindowRowId;
|
|
53101
53132
|
const windowRowId = appendSourceChanged ? null : rawWindowRowId;
|
|
53102
53133
|
const setWindowRowId = (id) => {
|
|
53103
53134
|
if (controlledWindowRowId === void 0) setUncontrolledWindowRowId(id);
|
|
53104
53135
|
onWindowRowIdChange?.(id);
|
|
53105
53136
|
};
|
|
53106
|
-
const [windowRowSnapshot, setWindowRowSnapshot] =
|
|
53137
|
+
const [windowRowSnapshot, setWindowRowSnapshot] = useState30(null);
|
|
53107
53138
|
const editScopeKey = appendQueryKey === null ? "\0local" : `append:${appendQueryKey}`;
|
|
53108
|
-
const [editsByScope, setEditsByScope] =
|
|
53109
|
-
const editRevisionRef =
|
|
53110
|
-
const [savingByScope, setSavingByScope] =
|
|
53111
|
-
const savingScopesRef =
|
|
53112
|
-
const [editRequest, setEditRequest] =
|
|
53113
|
-
const [confirmForeignDraftDiscard, setConfirmForeignDraftDiscard] =
|
|
53139
|
+
const [editsByScope, setEditsByScope] = useState30({});
|
|
53140
|
+
const editRevisionRef = useRef29({});
|
|
53141
|
+
const [savingByScope, setSavingByScope] = useState30({});
|
|
53142
|
+
const savingScopesRef = useRef29(/* @__PURE__ */ new Set());
|
|
53143
|
+
const [editRequest, setEditRequest] = useState30(null);
|
|
53144
|
+
const [confirmForeignDraftDiscard, setConfirmForeignDraftDiscard] = useState30(false);
|
|
53114
53145
|
const edits = editsByScope[editScopeKey]?.values ?? {};
|
|
53115
53146
|
const saving = (savingByScope[editScopeKey] ?? 0) > 0;
|
|
53116
53147
|
const setEdits = (next) => {
|
|
@@ -53177,7 +53208,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53177
53208
|
rows: Object.entries(draft.values).map(([rowId, columns2]) => ({ rowId, columns: columns2 }))
|
|
53178
53209
|
}));
|
|
53179
53210
|
const selection = appendSourceChanged && selectionConfig ? { ...selectionConfig, selectedIds: [] } : selectionConfig;
|
|
53180
|
-
|
|
53211
|
+
useEffect28(() => {
|
|
53181
53212
|
const previous = committedAppendQueryKey.current;
|
|
53182
53213
|
committedAppendQueryKey.current = appendQueryKey;
|
|
53183
53214
|
if (previous === null || appendQueryKey === null || previous === appendQueryKey) {
|
|
@@ -53195,14 +53226,14 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53195
53226
|
onWindowRowIdChange,
|
|
53196
53227
|
selectionConfig
|
|
53197
53228
|
]);
|
|
53198
|
-
const scrollRef =
|
|
53199
|
-
const tableRef =
|
|
53200
|
-
const tableHeaderRef =
|
|
53201
|
-
const cardsScrollRef =
|
|
53229
|
+
const scrollRef = useRef29(null);
|
|
53230
|
+
const tableRef = useRef29(null);
|
|
53231
|
+
const tableHeaderRef = useRef29(null);
|
|
53232
|
+
const cardsScrollRef = useRef29(null);
|
|
53202
53233
|
const scrollContainers = useMemo12(() => [scrollRef, cardsScrollRef], []);
|
|
53203
|
-
const [documentStickyHeader, setDocumentStickyHeader] =
|
|
53204
|
-
const documentStickyHeaderRef =
|
|
53205
|
-
const previousAppendKeyForScrollReset =
|
|
53234
|
+
const [documentStickyHeader, setDocumentStickyHeader] = useState30(false);
|
|
53235
|
+
const documentStickyHeaderRef = useRef29(false);
|
|
53236
|
+
const previousAppendKeyForScrollReset = useRef29(appendQueryKey);
|
|
53206
53237
|
useLayoutEffect5(() => {
|
|
53207
53238
|
const previous = previousAppendKeyForScrollReset.current;
|
|
53208
53239
|
previousAppendKeyForScrollReset.current = appendQueryKey;
|
|
@@ -53228,14 +53259,14 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53228
53259
|
...appendScrollPolicy?.mode === "scroll" && appendScrollPolicy.thresholdPx !== void 0 ? { thresholdPx: appendScrollPolicy.thresholdPx } : {},
|
|
53229
53260
|
...appendScrollPolicy?.mode === "scroll" && appendScrollPolicy.intentTimeoutMs !== void 0 ? { intentTimeoutMs: appendScrollPolicy.intentTimeoutMs } : {}
|
|
53230
53261
|
});
|
|
53231
|
-
const rootRef =
|
|
53262
|
+
const rootRef = useRef29(null);
|
|
53232
53263
|
useClippedContentGuard(rootRef, {
|
|
53233
53264
|
label: typeof copy === "object" && copy.listLabel ? `Table: ${copy.listLabel}` : "MatrxDataTable"
|
|
53234
53265
|
});
|
|
53235
|
-
const [scrollHintRight, setScrollHintRight] =
|
|
53236
|
-
const [scrollHintLeft, setScrollHintLeft] =
|
|
53237
|
-
const [scrollHintRightInset, setScrollHintRightInset] =
|
|
53238
|
-
const hintScrollLeft =
|
|
53266
|
+
const [scrollHintRight, setScrollHintRight] = useState30(false);
|
|
53267
|
+
const [scrollHintLeft, setScrollHintLeft] = useState30(false);
|
|
53268
|
+
const [scrollHintRightInset, setScrollHintRightInset] = useState30(6);
|
|
53269
|
+
const hintScrollLeft = useRef29(0);
|
|
53239
53270
|
const updateScrollHint = useCallback15(() => {
|
|
53240
53271
|
const el = scrollRef.current;
|
|
53241
53272
|
if (!el) return;
|
|
@@ -53259,7 +53290,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53259
53290
|
behavior: "smooth"
|
|
53260
53291
|
});
|
|
53261
53292
|
};
|
|
53262
|
-
|
|
53293
|
+
useEffect28(() => {
|
|
53263
53294
|
window.addEventListener("resize", updateScrollHint);
|
|
53264
53295
|
const el = scrollRef.current;
|
|
53265
53296
|
const observer = el && typeof ResizeObserver !== "undefined" ? new ResizeObserver(updateScrollHint) : null;
|
|
@@ -53333,26 +53364,26 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53333
53364
|
window.removeEventListener("resize", requestUpdate);
|
|
53334
53365
|
};
|
|
53335
53366
|
}, [stickyHeader, data, columns]);
|
|
53336
|
-
const [columnOrder, setColumnOrder] =
|
|
53337
|
-
const [hiddenColumnIds, setHiddenColumnIds] =
|
|
53367
|
+
const [columnOrder, setColumnOrder] = useState30(() => columnState?.order ?? columns.map(columnId));
|
|
53368
|
+
const [hiddenColumnIds, setHiddenColumnIds] = useState30(
|
|
53338
53369
|
() => new Set(columnState?.hidden ?? columns.filter((column) => column.hidden).map(columnId))
|
|
53339
53370
|
);
|
|
53340
|
-
const [columnWidths, setColumnWidths] =
|
|
53371
|
+
const [columnWidths, setColumnWidths] = useState30(
|
|
53341
53372
|
() => normalizeColumnWidthsForColumns(columnState?.widths, columns)
|
|
53342
53373
|
);
|
|
53343
|
-
const [fixedTableGeometry, setFixedTableGeometry] =
|
|
53344
|
-
const knownColumnIds =
|
|
53345
|
-
const draggedColumnId =
|
|
53346
|
-
const columnDragActive =
|
|
53347
|
-
const columnDragRaf =
|
|
53348
|
-
const columnDragScrollDirection =
|
|
53349
|
-
const [columnDragPreview, setColumnDragPreview] =
|
|
53374
|
+
const [fixedTableGeometry, setFixedTableGeometry] = useState30(null);
|
|
53375
|
+
const knownColumnIds = useRef29(new Set(columns.map(columnId)));
|
|
53376
|
+
const draggedColumnId = useRef29(null);
|
|
53377
|
+
const columnDragActive = useRef29(false);
|
|
53378
|
+
const columnDragRaf = useRef29(null);
|
|
53379
|
+
const columnDragScrollDirection = useRef29(0);
|
|
53380
|
+
const [columnDragPreview, setColumnDragPreview] = useState30(null);
|
|
53350
53381
|
const stopColumnDragScroll = useCallback15(() => {
|
|
53351
53382
|
if (columnDragRaf.current !== null) cancelAnimationFrame(columnDragRaf.current);
|
|
53352
53383
|
columnDragRaf.current = null;
|
|
53353
53384
|
columnDragScrollDirection.current = 0;
|
|
53354
53385
|
}, []);
|
|
53355
|
-
|
|
53386
|
+
useEffect28(() => () => {
|
|
53356
53387
|
columnDragActive.current = false;
|
|
53357
53388
|
stopColumnDragScroll();
|
|
53358
53389
|
}, [stopColumnDragScroll]);
|
|
@@ -53390,7 +53421,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53390
53421
|
setHiddenColumnIds(hidden);
|
|
53391
53422
|
}
|
|
53392
53423
|
}, [columnState]);
|
|
53393
|
-
const [internalColumnManagerOpen, setInternalColumnManagerOpen] =
|
|
53424
|
+
const [internalColumnManagerOpen, setInternalColumnManagerOpen] = useState30(false);
|
|
53394
53425
|
const columnManagerOpen = controlledColumnManager?.open ?? internalColumnManagerOpen;
|
|
53395
53426
|
const setColumnManagerOpen = controlledColumnManager?.onOpenChange ?? setInternalColumnManagerOpen;
|
|
53396
53427
|
const columnIds = useMemo12(() => columns.map(columnId), [columns]);
|
|
@@ -53400,7 +53431,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53400
53431
|
() => normalizeColumnWidthsForColumns(columnState?.widths ?? columnWidths, columns),
|
|
53401
53432
|
[columns, columnState?.widths, columnWidths]
|
|
53402
53433
|
);
|
|
53403
|
-
const resizeGestureSnapshotRef =
|
|
53434
|
+
const resizeGestureSnapshotRef = useRef29(null);
|
|
53404
53435
|
const measureVisibleColumnWidths = useCallback15(() => {
|
|
53405
53436
|
const measured = {};
|
|
53406
53437
|
const headers = tableRef.current ? Array.from(tableRef.current.querySelectorAll(
|
|
@@ -53478,7 +53509,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53478
53509
|
}
|
|
53479
53510
|
setColumnWidths(normalized);
|
|
53480
53511
|
}, [columnIds, columnState, columns, measureFixedTableGeometry, measureVisibleColumnWidths]);
|
|
53481
|
-
|
|
53512
|
+
useEffect28(() => {
|
|
53482
53513
|
const ids = columns.map(columnId);
|
|
53483
53514
|
if (columnState) return;
|
|
53484
53515
|
const previousIds = knownColumnIds.current;
|
|
@@ -53545,7 +53576,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53545
53576
|
const fixedLayoutActive = usesMeasuredFixedLayout && fixedTableGeometry !== null;
|
|
53546
53577
|
const freezeWanted = visibleColumns.some((column) => column.frozen);
|
|
53547
53578
|
const selectionColumnWidth = fixedTableGeometry?.selectionWidth ?? (selection && (freezeWanted || fitToWidth) ? SELECTION_COLUMN_PX : void 0);
|
|
53548
|
-
const [fitSpace, setFitSpace] =
|
|
53579
|
+
const [fitSpace, setFitSpace] = useState30(null);
|
|
53549
53580
|
useLayoutEffect5(() => {
|
|
53550
53581
|
if (!fitToWidth) {
|
|
53551
53582
|
setFitSpace(null);
|
|
@@ -53670,7 +53701,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53670
53701
|
const tableContextMenuInstanceId = useId5();
|
|
53671
53702
|
const tableDndContextId = useId5();
|
|
53672
53703
|
const defaultCopyTitle = toolbar?.title || "Table";
|
|
53673
|
-
const copyColumnsLatest =
|
|
53704
|
+
const copyColumnsLatest = useRef29(declaredVisibleCopyColumns);
|
|
53674
53705
|
copyColumnsLatest.current = declaredVisibleCopyColumns;
|
|
53675
53706
|
const readDeclaredCopyColumns = lazyCallback(() => copyColumnsLatest.current);
|
|
53676
53707
|
const defaultCopy = useMemo12(() => ({
|
|
@@ -53691,7 +53722,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53691
53722
|
const visibleDataColumns = useMemo12(() => visibleColumns.filter((column) => !column.customActions), [visibleColumns]);
|
|
53692
53723
|
const effectiveCopyColumns = copy === void 0 ? declaredVisibleCopyColumns : visibleDataColumns;
|
|
53693
53724
|
const copySubsetVariant2 = useCopySubsetVariant();
|
|
53694
|
-
const chromeLatest =
|
|
53725
|
+
const chromeLatest = useRef29({
|
|
53695
53726
|
processed: [],
|
|
53696
53727
|
data: [],
|
|
53697
53728
|
toggleAllOnPage: () => void 0,
|
|
@@ -53798,8 +53829,8 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53798
53829
|
intelligentSearchEnabled,
|
|
53799
53830
|
searchScope
|
|
53800
53831
|
]);
|
|
53801
|
-
const lastNotifiedViewRows =
|
|
53802
|
-
|
|
53832
|
+
const lastNotifiedViewRows = useRef29(null);
|
|
53833
|
+
useEffect28(() => {
|
|
53803
53834
|
if (!onViewChange) {
|
|
53804
53835
|
lastNotifiedViewRows.current = null;
|
|
53805
53836
|
return;
|
|
@@ -53808,7 +53839,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53808
53839
|
lastNotifiedViewRows.current = processed;
|
|
53809
53840
|
if (changed) onViewChange(processed);
|
|
53810
53841
|
}, [processed, onViewChange]);
|
|
53811
|
-
|
|
53842
|
+
useEffect28(() => {
|
|
53812
53843
|
if (controlledQuery) return;
|
|
53813
53844
|
setInternalPage(1);
|
|
53814
53845
|
}, [
|
|
@@ -53870,7 +53901,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53870
53901
|
}, [processed, safePage, effectivePageSize, pageSize, remoteQuery, hidePagination, localProgressiveEnabled, progressiveRows.rows]);
|
|
53871
53902
|
const drillGrouped = Boolean(drill && drill.question.by.length > 0);
|
|
53872
53903
|
const groupingColumnId = drill ? null : grouping?.columnId ?? null;
|
|
53873
|
-
const [uncontrolledCollapsed, setUncontrolledCollapsed] =
|
|
53904
|
+
const [uncontrolledCollapsed, setUncontrolledCollapsed] = useState30([]);
|
|
53874
53905
|
const collapsedGroups = grouping?.collapsed ?? uncontrolledCollapsed;
|
|
53875
53906
|
const setCollapsedGroups = useCallback15(
|
|
53876
53907
|
(next) => {
|
|
@@ -53927,9 +53958,9 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53927
53958
|
return run;
|
|
53928
53959
|
}, [visibleColumns, frozenColumns]);
|
|
53929
53960
|
const columnVirtualizeActive = virtualizeConfig !== null && virtualizeConfig.enabled !== false && virtualizeConfig.columns === true && visibleColumns.length - frozenRunLength > 30 && !hierarchy && mobileCards === void 0;
|
|
53930
|
-
const [rowWindow, setRowWindow] =
|
|
53931
|
-
const [columnWindow, setColumnWindow] =
|
|
53932
|
-
const windowInputs =
|
|
53961
|
+
const [rowWindow, setRowWindow] = useState30(null);
|
|
53962
|
+
const [columnWindow, setColumnWindow] = useState30(null);
|
|
53963
|
+
const windowInputs = useRef29({
|
|
53933
53964
|
virtualizeActive: false,
|
|
53934
53965
|
bodyEntryCount: 0,
|
|
53935
53966
|
virtualRowHeight: 40,
|
|
@@ -54001,7 +54032,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
54001
54032
|
frozenRunLength
|
|
54002
54033
|
]);
|
|
54003
54034
|
const metricsWanted = virtualizeActive || columnVirtualizeActive;
|
|
54004
|
-
|
|
54035
|
+
useEffect28(() => {
|
|
54005
54036
|
recomputeWindows();
|
|
54006
54037
|
}, [
|
|
54007
54038
|
recomputeWindows,
|
|
@@ -54013,7 +54044,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
54013
54044
|
columnWindowWidth,
|
|
54014
54045
|
frozenRunLength
|
|
54015
54046
|
]);
|
|
54016
|
-
|
|
54047
|
+
useEffect28(() => {
|
|
54017
54048
|
if (!metricsWanted) return;
|
|
54018
54049
|
const el = scrollRef.current;
|
|
54019
54050
|
if (!el) return;
|
|
@@ -54082,7 +54113,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
54082
54113
|
windowed.push({ kind: "spacer", height: effectiveRowWindow.padEnd, place: "end" });
|
|
54083
54114
|
return windowed;
|
|
54084
54115
|
}, [groupedRenderRows, collapsedGroups, paginated, effectiveRowWindow]);
|
|
54085
|
-
const getRowIdRef =
|
|
54116
|
+
const getRowIdRef = useRef29(getRowId);
|
|
54086
54117
|
getRowIdRef.current = getRowId;
|
|
54087
54118
|
const spreadsheetRowIds = useMemo12(
|
|
54088
54119
|
() => paginated.map((row) => getRowIdRef.current(row)),
|
|
@@ -54103,7 +54134,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
54103
54134
|
return map;
|
|
54104
54135
|
}, [visibleColumns]);
|
|
54105
54136
|
const spreadsheetEnabled = Boolean(spreadsheet && spreadsheet.enabled !== false);
|
|
54106
|
-
const openRowRef =
|
|
54137
|
+
const openRowRef = useRef29(() => void 0);
|
|
54107
54138
|
const sheet = useSpreadsheetGrid(
|
|
54108
54139
|
spreadsheetEnabled && spreadsheet ? {
|
|
54109
54140
|
rowIds: spreadsheetRowIds,
|
|
@@ -54145,12 +54176,12 @@ function MatrxDataTableCore(coreProps) {
|
|
|
54145
54176
|
} : null
|
|
54146
54177
|
);
|
|
54147
54178
|
if (spreadsheet?.controllerRef) spreadsheet.controllerRef.current = spreadsheetEnabled ? sheet.controller : null;
|
|
54148
|
-
const sheetRef =
|
|
54179
|
+
const sheetRef = useRef29(sheet);
|
|
54149
54180
|
sheetRef.current = sheet;
|
|
54150
|
-
const onSheetSelectionRef =
|
|
54181
|
+
const onSheetSelectionRef = useRef29(spreadsheet?.onSelectionChange);
|
|
54151
54182
|
onSheetSelectionRef.current = spreadsheet?.onSelectionChange;
|
|
54152
54183
|
const sheetSelectionKey = sheet.range ? `${sheet.range.anchor.rowId}\0${sheet.range.anchor.fieldName}\0${sheet.range.focus.rowId}\0${sheet.range.focus.fieldName}\0${sheet.bounds ? `${sheet.bounds.r0}:${sheet.bounds.r1}:${sheet.bounds.c0}:${sheet.bounds.c1}` : ""}` : "";
|
|
54153
|
-
|
|
54184
|
+
useEffect28(() => {
|
|
54154
54185
|
const tell = onSheetSelectionRef.current;
|
|
54155
54186
|
if (!tell) return;
|
|
54156
54187
|
const current = sheetRef.current;
|
|
@@ -54167,11 +54198,11 @@ function MatrxDataTableCore(coreProps) {
|
|
|
54167
54198
|
tsv: current.selectionTsv()
|
|
54168
54199
|
});
|
|
54169
54200
|
}, [sheetSelectionKey]);
|
|
54170
|
-
const searchValueRef =
|
|
54201
|
+
const searchValueRef = useRef29(searchValue);
|
|
54171
54202
|
searchValueRef.current = searchValue;
|
|
54172
54203
|
const facetsEnabled = Boolean(facets && facets.enabled !== false);
|
|
54173
54204
|
const coreSuggestionsEnabled = facets?.enabled !== false;
|
|
54174
|
-
const [facetState, setFacetState] =
|
|
54205
|
+
const [facetState, setFacetState] = useState30({});
|
|
54175
54206
|
const facetReadCell = useCallback15(
|
|
54176
54207
|
(row, colId) => {
|
|
54177
54208
|
if (facets?.readCell) return facets.readCell(row, colId);
|
|
@@ -54182,10 +54213,10 @@ function MatrxDataTableCore(coreProps) {
|
|
|
54182
54213
|
);
|
|
54183
54214
|
const coreFacetTotal = remoteQuery?.mode === "controlled" ? remoteQuery.totalItems : appendQuery?.pagination.sourceRecords?.total ?? coverage?.matched ?? coverage?.total;
|
|
54184
54215
|
const coreFacetLoaded = appendQuery?.pagination.sourceRecords?.loaded;
|
|
54185
|
-
const facetInputsRef =
|
|
54216
|
+
const facetInputsRef = useRef29({ data, facets, facetReadCell, coreFacetTotal, coreFacetLoaded });
|
|
54186
54217
|
facetInputsRef.current = { data, facets, facetReadCell, coreFacetTotal, coreFacetLoaded };
|
|
54187
|
-
const facetRequestRef =
|
|
54188
|
-
const requestedFacetColumns =
|
|
54218
|
+
const facetRequestRef = useRef29(/* @__PURE__ */ new Map());
|
|
54219
|
+
const requestedFacetColumns = useRef29(/* @__PURE__ */ new Set());
|
|
54189
54220
|
const requestFacets = useCallback15((colId) => {
|
|
54190
54221
|
requestedFacetColumns.current.add(colId);
|
|
54191
54222
|
const { data: rows, facets: config, facetReadCell: readCell, coreFacetTotal: total, coreFacetLoaded: loaded } = facetInputsRef.current;
|
|
@@ -54269,7 +54300,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
54269
54300
|
}));
|
|
54270
54301
|
});
|
|
54271
54302
|
}, []);
|
|
54272
|
-
|
|
54303
|
+
useEffect28(() => {
|
|
54273
54304
|
setFacetState((current) => Object.keys(current).length === 0 ? current : {});
|
|
54274
54305
|
for (const [colId, ticket] of facetRequestRef.current) {
|
|
54275
54306
|
facetRequestRef.current.set(colId, ticket + 1);
|
|
@@ -54279,7 +54310,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
54279
54310
|
}
|
|
54280
54311
|
}, [facetsEnabled, coreSuggestionsEnabled, data, searchValue, coreFacetTotal, coreFacetLoaded, requestFacets]);
|
|
54281
54312
|
const totalIsKnown = !isLoading && !readView.failure;
|
|
54282
|
-
|
|
54313
|
+
useEffect28(() => {
|
|
54283
54314
|
if (!controlledQuery || !totalIsKnown || controlledQuery.state.page === safePage) return;
|
|
54284
54315
|
emitControlledQueryChange({ page: safePage });
|
|
54285
54316
|
}, [controlledQuery, emitControlledQueryChange, safePage, totalIsKnown]);
|
|
@@ -54317,14 +54348,14 @@ function MatrxDataTableCore(coreProps) {
|
|
|
54317
54348
|
const reportCardTotal = embedded ? tableCard?.reportTotal : void 0;
|
|
54318
54349
|
const cardTotal = appendQuery ? appendQuery.pagination.totalItems : remoteQuery?.mode === "controlled" ? isLoading ? void 0 : remoteQuery.totalItems : isLoading ? void 0 : sourceProcessing ? sourceTotal : data.length;
|
|
54319
54350
|
const embeddedControlledPage = embedded && remoteQuery?.mode === "controlled" ? remoteQuery.state.page : 1;
|
|
54320
|
-
|
|
54351
|
+
useEffect28(() => {
|
|
54321
54352
|
if (embeddedControlledPage !== 1) emitControlledQueryChange({ page: 1 });
|
|
54322
54353
|
}, [embeddedControlledPage]);
|
|
54323
|
-
|
|
54354
|
+
useEffect28(() => {
|
|
54324
54355
|
reportCardTotal?.(cardTotal);
|
|
54325
54356
|
}, [reportCardTotal, cardTotal]);
|
|
54326
|
-
|
|
54327
|
-
const [pinnedEl, setPinnedEl] =
|
|
54357
|
+
useEffect28(() => () => reportCardTotal?.(void 0), [reportCardTotal]);
|
|
54358
|
+
const [pinnedEl, setPinnedEl] = useState30(null);
|
|
54328
54359
|
const pinnedRowActive = Boolean(
|
|
54329
54360
|
toolbar?.singleRow && toolbar.overflow && toolbar.overflow.mode !== "sheet" && (toolbar.overflow.pinned || toolbar.overflow.mode === "menu")
|
|
54330
54361
|
);
|
|
@@ -54638,7 +54669,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
54638
54669
|
}));
|
|
54639
54670
|
return true;
|
|
54640
54671
|
};
|
|
54641
|
-
const requestCellEditRef =
|
|
54672
|
+
const requestCellEditRef = useRef29(requestCellEdit);
|
|
54642
54673
|
requestCellEditRef.current = requestCellEdit;
|
|
54643
54674
|
const buildRecordControls = (row) => {
|
|
54644
54675
|
const rowId = getRowId(row);
|
|
@@ -54984,16 +55015,16 @@ function MatrxDataTableCore(coreProps) {
|
|
|
54984
55015
|
return [];
|
|
54985
55016
|
}
|
|
54986
55017
|
};
|
|
54987
|
-
const menuSectionsForRef =
|
|
55018
|
+
const menuSectionsForRef = useRef29(menuSectionsFor);
|
|
54988
55019
|
menuSectionsForRef.current = menuSectionsFor;
|
|
54989
55020
|
const hasMenuSections = Boolean(contextMenu?.sections);
|
|
54990
55021
|
const boundarySections = useCallback15(
|
|
54991
55022
|
(target) => menuSectionsForRef.current(target),
|
|
54992
55023
|
[]
|
|
54993
55024
|
);
|
|
54994
|
-
const resolveMenuLevelRef =
|
|
55025
|
+
const resolveMenuLevelRef = useRef29(resolveMenuLevel);
|
|
54995
55026
|
resolveMenuLevelRef.current = resolveMenuLevel;
|
|
54996
|
-
|
|
55027
|
+
useEffect28(() => {
|
|
54997
55028
|
if (!host.rowContextRegistry) return;
|
|
54998
55029
|
return host.rowContextRegistry.register(
|
|
54999
55030
|
tableContextMenuInstanceId,
|
|
@@ -55002,7 +55033,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
55002
55033
|
}, [host.rowContextRegistry, tableContextMenuInstanceId]);
|
|
55003
55034
|
const showActionsCol = declaredActionsColumn === void 0 && (windowEnabled || Boolean(rowActions) || showInlineRowCopy);
|
|
55004
55035
|
const actionsHeaderCount = visibleColumns.filter((column) => typeof column.header === "string" && column.header.trim().toLowerCase() === "actions").length + (showActionsCol ? 1 : 0);
|
|
55005
|
-
|
|
55036
|
+
useEffect28(() => {
|
|
55006
55037
|
if (actionsHeaderCount > 1) {
|
|
55007
55038
|
console.error(
|
|
55008
55039
|
`[matrx-table] ${actionsHeaderCount} "Actions" columns in one table \u2014 a table has ONE actions column. Declare one customActions column headed "Actions"; the table folds copy, row actions and open-in-window into it.`
|
|
@@ -55053,7 +55084,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
55053
55084
|
return true;
|
|
55054
55085
|
});
|
|
55055
55086
|
}, [data, getSelectionId, selectedIdSet]);
|
|
55056
|
-
const lastToggledIndex =
|
|
55087
|
+
const lastToggledIndex = useRef29(null);
|
|
55057
55088
|
const setSelectedIds = (next) => selection?.onSelectedIdsChange([...next]);
|
|
55058
55089
|
const toggleRowSelected = (index, shiftKey) => {
|
|
55059
55090
|
if (!selection) return;
|
|
@@ -55094,7 +55125,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
55094
55125
|
}
|
|
55095
55126
|
} : facet
|
|
55096
55127
|
) : toolbar?.facets;
|
|
55097
|
-
const rowLatest =
|
|
55128
|
+
const rowLatest = useRef29(null);
|
|
55098
55129
|
const renderRecordCell = (row, col, index, suppliedControls) => {
|
|
55099
55130
|
const id = getRowId(row);
|
|
55100
55131
|
const field = col.accessorKey ? String(col.accessorKey) : columnId(col);
|
|
@@ -55371,7 +55402,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
55371
55402
|
];
|
|
55372
55403
|
const rowEpoch = useRenderEpoch(rowShape.filter((value) => typeof value !== "function" && (typeof value !== "object" || value === null)));
|
|
55373
55404
|
const rowProbe = useRenderEpoch(rowShape.filter((value) => typeof value === "function" || typeof value === "object" && value !== null));
|
|
55374
|
-
const rowDrawings =
|
|
55405
|
+
const rowDrawings = useRef29(null);
|
|
55375
55406
|
rowDrawings.current ??= new RowDrawings();
|
|
55376
55407
|
const drawBodyRow = (rowId, row, index, fresh) => rowDrawings.current.draw(rowId, renderRecordRow(row, index), fresh);
|
|
55377
55408
|
chromeLatest.current = { processed, data, toggleAllOnPage, showMore: progressiveRows.showMore, applySavedView };
|
|
@@ -57601,7 +57632,7 @@ function HierarchyDragIndicatorLayer({
|
|
|
57601
57632
|
scrollRef,
|
|
57602
57633
|
resolve: resolve2
|
|
57603
57634
|
}) {
|
|
57604
|
-
const [indicator, setIndicator] =
|
|
57635
|
+
const [indicator, setIndicator] = useState30(
|
|
57605
57636
|
null
|
|
57606
57637
|
);
|
|
57607
57638
|
useDndMonitor2({
|
|
@@ -57801,7 +57832,7 @@ function columnWidthVar(width, resizedWidth, id, resizable) {
|
|
|
57801
57832
|
};
|
|
57802
57833
|
}
|
|
57803
57834
|
function DefaultJsonCell({ value }) {
|
|
57804
|
-
const [open, setOpen] =
|
|
57835
|
+
const [open, setOpen] = useState30(false);
|
|
57805
57836
|
const host = useMatrxDataTableHost();
|
|
57806
57837
|
const Viewer = host.JsonViewer;
|
|
57807
57838
|
const text = JSON.stringify(value, null, 2);
|
|
@@ -57881,7 +57912,7 @@ function resolveStringTitle(title, fallback) {
|
|
|
57881
57912
|
}
|
|
57882
57913
|
|
|
57883
57914
|
// src/data-table/MatrxTableCard.tsx
|
|
57884
|
-
import { useMemo as useMemo13, useState as
|
|
57915
|
+
import { useMemo as useMemo13, useState as useState31 } from "react";
|
|
57885
57916
|
import { Fragment as Fragment21, jsx as jsx61, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
57886
57917
|
function nounText(noun) {
|
|
57887
57918
|
return `${noun.count.toLocaleString()} ${noun.count === 1 ? noun.singular : noun.plural}`;
|
|
@@ -57905,9 +57936,9 @@ function MatrxTableCard({
|
|
|
57905
57936
|
className
|
|
57906
57937
|
}) {
|
|
57907
57938
|
const { Link } = useMatrxDataTableHost();
|
|
57908
|
-
const [toolbarSlot, setToolbarSlot] =
|
|
57909
|
-
const [footerSlot, setFooterSlot] =
|
|
57910
|
-
const [reportedTotal, setReportedTotal] =
|
|
57939
|
+
const [toolbarSlot, setToolbarSlot] = useState31(null);
|
|
57940
|
+
const [footerSlot, setFooterSlot] = useState31(null);
|
|
57941
|
+
const [reportedTotal, setReportedTotal] = useState31(void 0);
|
|
57911
57942
|
const context = useMemo13(
|
|
57912
57943
|
() => ({ appearance: "embedded", toolbarSlot, footerSlot, initialRows, reportTotal: setReportedTotal }),
|
|
57913
57944
|
[toolbarSlot, footerSlot, initialRows]
|
|
@@ -58021,7 +58052,7 @@ function MatrxTableCardEmpty({ message, action, children }) {
|
|
|
58021
58052
|
}
|
|
58022
58053
|
|
|
58023
58054
|
// src/data-table/SavedViewsControl.tsx
|
|
58024
|
-
import { useId as useId6, useState as
|
|
58055
|
+
import { useId as useId6, useState as useState32 } from "react";
|
|
58025
58056
|
import { Fragment as Fragment22, jsx as jsx62, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
58026
58057
|
function SavedViewsControl({
|
|
58027
58058
|
views,
|
|
@@ -58039,13 +58070,13 @@ function SavedViewsControl({
|
|
|
58039
58070
|
related
|
|
58040
58071
|
}) {
|
|
58041
58072
|
const unsavedChangesId = useId6();
|
|
58042
|
-
const [saveOpen, setSaveOpen] =
|
|
58043
|
-
const [name, setName] =
|
|
58044
|
-
const [saving, setSaving] =
|
|
58045
|
-
const [removing, setRemoving] =
|
|
58046
|
-
const [actionError, setActionError] =
|
|
58047
|
-
const [pendingSelect, setPendingSelect] =
|
|
58048
|
-
const [pendingRemove, setPendingRemove] =
|
|
58073
|
+
const [saveOpen, setSaveOpen] = useState32(false);
|
|
58074
|
+
const [name, setName] = useState32("");
|
|
58075
|
+
const [saving, setSaving] = useState32(false);
|
|
58076
|
+
const [removing, setRemoving] = useState32(false);
|
|
58077
|
+
const [actionError, setActionError] = useState32(null);
|
|
58078
|
+
const [pendingSelect, setPendingSelect] = useState32(void 0);
|
|
58079
|
+
const [pendingRemove, setPendingRemove] = useState32(null);
|
|
58049
58080
|
const visibleError = actionError ?? error;
|
|
58050
58081
|
const select = (id) => {
|
|
58051
58082
|
if (id === activeId) return;
|