@ai-matrx/design-system 0.57.0 → 0.59.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 +43 -0
- package/dist/data-table/index.cjs +616 -446
- package/dist/data-table/index.cjs.map +1 -1
- package/dist/data-table/index.js +205 -35
- package/dist/data-table/index.js.map +1 -1
- package/dist/field-formats/index.cjs +15 -0
- package/dist/field-formats/index.cjs.map +1 -1
- package/dist/field-formats/index.d.cts +10 -1
- package/dist/field-formats/index.d.ts +10 -1
- package/dist/field-formats/index.js +15 -0
- package/dist/field-formats/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -34775,7 +34775,7 @@ function TableIconActions({ actions }) {
|
|
|
34775
34775
|
}
|
|
34776
34776
|
|
|
34777
34777
|
// src/data-table/MatrxDataTable.tsx
|
|
34778
|
-
var
|
|
34778
|
+
var import_react29 = require("react");
|
|
34779
34779
|
var import_react_dom4 = require("react-dom");
|
|
34780
34780
|
|
|
34781
34781
|
// src/data-table/tableCardContext.ts
|
|
@@ -35660,6 +35660,162 @@ function Skeleton({ className, animated = true, ...props }) {
|
|
|
35660
35660
|
);
|
|
35661
35661
|
}
|
|
35662
35662
|
|
|
35663
|
+
// src/data-table/row-drawing.ts
|
|
35664
|
+
var import_react3 = require("react");
|
|
35665
|
+
var LAZY = /* @__PURE__ */ Symbol.for("@ai-matrx/design-system/data-table/lazy-callback");
|
|
35666
|
+
var MAX_DEPTH = 32;
|
|
35667
|
+
var HANDLER_KEY = /^on[A-Z]/;
|
|
35668
|
+
function lazyCallback(fn) {
|
|
35669
|
+
fn[LAZY] = true;
|
|
35670
|
+
return fn;
|
|
35671
|
+
}
|
|
35672
|
+
function isLazy(fn) {
|
|
35673
|
+
return fn[LAZY] === true;
|
|
35674
|
+
}
|
|
35675
|
+
function trampolinable(key, fn) {
|
|
35676
|
+
return isLazy(fn) || HANDLER_KEY.test(key);
|
|
35677
|
+
}
|
|
35678
|
+
function isPlainObject(value) {
|
|
35679
|
+
if (value === null || typeof value !== "object") return false;
|
|
35680
|
+
const proto = Object.getPrototypeOf(value);
|
|
35681
|
+
return proto === Object.prototype || proto === null;
|
|
35682
|
+
}
|
|
35683
|
+
function makeSlot(fn) {
|
|
35684
|
+
const slot = {
|
|
35685
|
+
fn,
|
|
35686
|
+
// A Proxy rather than a bare wrapper: a handler that carries its own members (a debounced
|
|
35687
|
+
// function's `cancel`) keeps them, read from the latest function.
|
|
35688
|
+
stable: new Proxy((() => void 0), {
|
|
35689
|
+
apply: (_target, thisArg, args) => Reflect.apply(slot.fn, thisArg, args),
|
|
35690
|
+
get: (_target, key) => Reflect.get(slot.fn, key)
|
|
35691
|
+
})
|
|
35692
|
+
};
|
|
35693
|
+
return slot;
|
|
35694
|
+
}
|
|
35695
|
+
function sameEntries(a, b, path2, depth, updates) {
|
|
35696
|
+
const keys2 = Object.keys(a);
|
|
35697
|
+
if (keys2.length !== Object.keys(b).length) return false;
|
|
35698
|
+
for (const key of keys2) {
|
|
35699
|
+
if (!Object.prototype.hasOwnProperty.call(b, key)) return false;
|
|
35700
|
+
if (key === "ref") {
|
|
35701
|
+
if (!Object.is(a[key], b[key])) return false;
|
|
35702
|
+
continue;
|
|
35703
|
+
}
|
|
35704
|
+
if (!sameDrawing(a[key], b[key], key, `${path2}/${key}`, depth + 1, updates)) return false;
|
|
35705
|
+
}
|
|
35706
|
+
return true;
|
|
35707
|
+
}
|
|
35708
|
+
function sameDrawing(previous, next, key, path2, depth, updates) {
|
|
35709
|
+
if (Object.is(previous, next)) return true;
|
|
35710
|
+
if (typeof previous === "function" && typeof next === "function") {
|
|
35711
|
+
if (trampolinable(key, previous) && trampolinable(key, next)) {
|
|
35712
|
+
updates.push([path2, next]);
|
|
35713
|
+
return true;
|
|
35714
|
+
}
|
|
35715
|
+
return false;
|
|
35716
|
+
}
|
|
35717
|
+
if (depth > MAX_DEPTH) return false;
|
|
35718
|
+
if ((0, import_react3.isValidElement)(previous) && (0, import_react3.isValidElement)(next)) {
|
|
35719
|
+
if (previous.type !== next.type || previous.key !== next.key) return false;
|
|
35720
|
+
return sameEntries(
|
|
35721
|
+
previous.props,
|
|
35722
|
+
next.props,
|
|
35723
|
+
path2,
|
|
35724
|
+
depth,
|
|
35725
|
+
updates
|
|
35726
|
+
);
|
|
35727
|
+
}
|
|
35728
|
+
if (Array.isArray(previous) && Array.isArray(next)) {
|
|
35729
|
+
if (previous.length !== next.length) return false;
|
|
35730
|
+
for (let i = 0; i < previous.length; i += 1) {
|
|
35731
|
+
if (!sameDrawing(previous[i], next[i], key, `${path2}/${i}`, depth + 1, updates)) return false;
|
|
35732
|
+
}
|
|
35733
|
+
return true;
|
|
35734
|
+
}
|
|
35735
|
+
if (isPlainObject(previous) && isPlainObject(next)) return sameEntries(previous, next, path2, depth, updates);
|
|
35736
|
+
return false;
|
|
35737
|
+
}
|
|
35738
|
+
function stabilize(value, key, path2, depth, slots, reuse) {
|
|
35739
|
+
if (typeof value === "function") {
|
|
35740
|
+
if (!trampolinable(key, value)) return value;
|
|
35741
|
+
const fn = value;
|
|
35742
|
+
const kept = reuse?.get(path2);
|
|
35743
|
+
const slot = kept ?? makeSlot(fn);
|
|
35744
|
+
slot.fn = fn;
|
|
35745
|
+
slots.set(path2, slot);
|
|
35746
|
+
return slot.stable;
|
|
35747
|
+
}
|
|
35748
|
+
if (depth > MAX_DEPTH) return value;
|
|
35749
|
+
if ((0, import_react3.isValidElement)(value)) {
|
|
35750
|
+
const props = value.props;
|
|
35751
|
+
let changed = null;
|
|
35752
|
+
for (const propKey of Object.keys(props)) {
|
|
35753
|
+
if (propKey === "ref") continue;
|
|
35754
|
+
const before2 = props[propKey];
|
|
35755
|
+
const after2 = stabilize(before2, propKey, `${path2}/${propKey}`, depth + 1, slots, reuse);
|
|
35756
|
+
if (after2 !== before2) (changed ??= {})[propKey] = after2;
|
|
35757
|
+
}
|
|
35758
|
+
if (!changed) return value;
|
|
35759
|
+
const clone = (0, import_react3.cloneElement)(value, changed);
|
|
35760
|
+
const before = value._store;
|
|
35761
|
+
const after = clone._store;
|
|
35762
|
+
if (before && after && "validated" in before) {
|
|
35763
|
+
try {
|
|
35764
|
+
after.validated = before.validated;
|
|
35765
|
+
} catch {
|
|
35766
|
+
}
|
|
35767
|
+
}
|
|
35768
|
+
return clone;
|
|
35769
|
+
}
|
|
35770
|
+
if (Array.isArray(value)) {
|
|
35771
|
+
let out = null;
|
|
35772
|
+
for (let i = 0; i < value.length; i += 1) {
|
|
35773
|
+
const after = stabilize(value[i], key, `${path2}/${i}`, depth + 1, slots, reuse);
|
|
35774
|
+
if (after !== value[i]) (out ??= value.slice())[i] = after;
|
|
35775
|
+
}
|
|
35776
|
+
return out ?? value;
|
|
35777
|
+
}
|
|
35778
|
+
if (isPlainObject(value)) {
|
|
35779
|
+
let out = null;
|
|
35780
|
+
for (const entryKey of Object.keys(value)) {
|
|
35781
|
+
const before = value[entryKey];
|
|
35782
|
+
const after = stabilize(before, entryKey, `${path2}/${entryKey}`, depth + 1, slots, reuse);
|
|
35783
|
+
if (after !== before) (out ??= { ...value })[entryKey] = after;
|
|
35784
|
+
}
|
|
35785
|
+
return out ?? value;
|
|
35786
|
+
}
|
|
35787
|
+
return value;
|
|
35788
|
+
}
|
|
35789
|
+
var RowDrawings = class {
|
|
35790
|
+
rows = /* @__PURE__ */ new Map();
|
|
35791
|
+
/**
|
|
35792
|
+
* The element to hand React for this row. The SAME object as last time when `raw` draws what the
|
|
35793
|
+
* last one drew (its handlers are re-pointed); a new one otherwise.
|
|
35794
|
+
*/
|
|
35795
|
+
draw(rowId, raw, fresh = false) {
|
|
35796
|
+
const previous = this.rows.get(rowId);
|
|
35797
|
+
if (previous && !fresh) {
|
|
35798
|
+
const updates = [];
|
|
35799
|
+
if (sameDrawing(previous.raw, raw, "", "", 0, updates) && updates.every(([path2]) => previous.slots.has(path2))) {
|
|
35800
|
+
for (const [path2, fn] of updates) previous.slots.get(path2).fn = fn;
|
|
35801
|
+
previous.raw = raw;
|
|
35802
|
+
return previous.out;
|
|
35803
|
+
}
|
|
35804
|
+
}
|
|
35805
|
+
const slots = /* @__PURE__ */ new Map();
|
|
35806
|
+
const out = stabilize(raw, "", "", 0, slots, previous?.slots);
|
|
35807
|
+
this.rows.set(rowId, { raw, out, slots });
|
|
35808
|
+
return out;
|
|
35809
|
+
}
|
|
35810
|
+
/** Forget rows that are no longer in the table (bounded by what was ever drawn). */
|
|
35811
|
+
prune(liveIds) {
|
|
35812
|
+
for (const id of this.rows.keys()) if (!liveIds.has(id)) this.rows.delete(id);
|
|
35813
|
+
}
|
|
35814
|
+
get size() {
|
|
35815
|
+
return this.rows.size;
|
|
35816
|
+
}
|
|
35817
|
+
};
|
|
35818
|
+
|
|
35663
35819
|
// src/data-table/TableTitleRow.tsx
|
|
35664
35820
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
35665
35821
|
function TableTitleRow({
|
|
@@ -35727,11 +35883,11 @@ function TableTitleRow({
|
|
|
35727
35883
|
}
|
|
35728
35884
|
|
|
35729
35885
|
// src/data-table/TableSearch.tsx
|
|
35730
|
-
var
|
|
35886
|
+
var import_react4 = require("react");
|
|
35731
35887
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
35732
35888
|
function TableSearch({ value, onChange, scope, onScopeChange, scopes, placeholder = "Search\u2026" }) {
|
|
35733
|
-
const [expanded, setExpanded] = (0,
|
|
35734
|
-
const inputRef = (0,
|
|
35889
|
+
const [expanded, setExpanded] = (0, import_react4.useState)(false);
|
|
35890
|
+
const inputRef = (0, import_react4.useRef)(null);
|
|
35735
35891
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { "data-matrx-table-search": true, className: "h-11 min-w-0 w-full sm:max-w-xs", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
35736
35892
|
"div",
|
|
35737
35893
|
{
|
|
@@ -35777,7 +35933,7 @@ function TableSearch({ value, onChange, scope, onScopeChange, scopes, placeholde
|
|
|
35777
35933
|
}
|
|
35778
35934
|
|
|
35779
35935
|
// src/data-table/useScrollPagination.ts
|
|
35780
|
-
var
|
|
35936
|
+
var import_react5 = require("react");
|
|
35781
35937
|
var DEFAULT_THRESHOLD_PX = 96;
|
|
35782
35938
|
var DEFAULT_INTENT_TIMEOUT_MS = 1200;
|
|
35783
35939
|
function resolveContainer(container) {
|
|
@@ -35848,8 +36004,8 @@ function useScrollPagination({
|
|
|
35848
36004
|
intentTimeoutMs = DEFAULT_INTENT_TIMEOUT_MS,
|
|
35849
36005
|
enabled = true
|
|
35850
36006
|
}) {
|
|
35851
|
-
const [requestError, setRequestError] = (0,
|
|
35852
|
-
const latestRef = (0,
|
|
36007
|
+
const [requestError, setRequestError] = (0, import_react5.useState)(null);
|
|
36008
|
+
const latestRef = (0, import_react5.useRef)({
|
|
35853
36009
|
queryKey,
|
|
35854
36010
|
hasNextPage,
|
|
35855
36011
|
isFetchingNextPage,
|
|
@@ -35871,16 +36027,16 @@ function useScrollPagination({
|
|
|
35871
36027
|
thresholdPx,
|
|
35872
36028
|
enabled
|
|
35873
36029
|
};
|
|
35874
|
-
const intentRef = (0,
|
|
35875
|
-
const inputSequenceRef = (0,
|
|
35876
|
-
const consumedSequenceRef = (0,
|
|
35877
|
-
const requestGenerationRef = (0,
|
|
35878
|
-
const inFlightGenerationRef = (0,
|
|
35879
|
-
const requestErrorRef = (0,
|
|
35880
|
-
const mountedRef = (0,
|
|
35881
|
-
const observedTopRef = (0,
|
|
36030
|
+
const intentRef = (0, import_react5.useRef)(null);
|
|
36031
|
+
const inputSequenceRef = (0, import_react5.useRef)(0);
|
|
36032
|
+
const consumedSequenceRef = (0, import_react5.useRef)(0);
|
|
36033
|
+
const requestGenerationRef = (0, import_react5.useRef)(0);
|
|
36034
|
+
const inFlightGenerationRef = (0, import_react5.useRef)(null);
|
|
36035
|
+
const requestErrorRef = (0, import_react5.useRef)(null);
|
|
36036
|
+
const mountedRef = (0, import_react5.useRef)(false);
|
|
36037
|
+
const observedTopRef = (0, import_react5.useRef)(/* @__PURE__ */ new WeakMap());
|
|
35882
36038
|
const effectiveError = error ?? requestError;
|
|
35883
|
-
(0,
|
|
36039
|
+
(0, import_react5.useEffect)(() => {
|
|
35884
36040
|
mountedRef.current = true;
|
|
35885
36041
|
return () => {
|
|
35886
36042
|
mountedRef.current = false;
|
|
@@ -35910,7 +36066,7 @@ function useScrollPagination({
|
|
|
35910
36066
|
}
|
|
35911
36067
|
}
|
|
35912
36068
|
};
|
|
35913
|
-
(0,
|
|
36069
|
+
(0, import_react5.useEffect)(() => {
|
|
35914
36070
|
intentRef.current = null;
|
|
35915
36071
|
observedTopRef.current = /* @__PURE__ */ new WeakMap();
|
|
35916
36072
|
consumedSequenceRef.current = inputSequenceRef.current;
|
|
@@ -35919,7 +36075,7 @@ function useScrollPagination({
|
|
|
35919
36075
|
inFlightGenerationRef.current = null;
|
|
35920
36076
|
requestGenerationRef.current += 1;
|
|
35921
36077
|
}, [queryKey]);
|
|
35922
|
-
(0,
|
|
36078
|
+
(0, import_react5.useEffect)(() => {
|
|
35923
36079
|
if (mode !== "scroll" || !enabled || typeof window === "undefined") return;
|
|
35924
36080
|
const attachable = containers.map(resolveContainer).filter((container) => container !== null);
|
|
35925
36081
|
const ownerCleanups = /* @__PURE__ */ new Map();
|
|
@@ -36015,7 +36171,7 @@ function useScrollPagination({
|
|
|
36015
36171
|
}
|
|
36016
36172
|
|
|
36017
36173
|
// src/data-table/useProgressiveTableRows.ts
|
|
36018
|
-
var
|
|
36174
|
+
var import_react6 = require("react");
|
|
36019
36175
|
function safePageSize(pageSize) {
|
|
36020
36176
|
return Number.isFinite(pageSize) && pageSize > 0 ? Math.floor(pageSize) : 0;
|
|
36021
36177
|
}
|
|
@@ -36041,15 +36197,15 @@ function useProgressiveTableRows({
|
|
|
36041
36197
|
const pageSize = safePageSize(rawPageSize);
|
|
36042
36198
|
const hasExplicitRequestedPage = rawRequestedPage !== void 0;
|
|
36043
36199
|
const requestedPage = safeRequestedPage(rawRequestedPage);
|
|
36044
|
-
const initialRequestedPageRef = (0,
|
|
36045
|
-
const latestRequestedPageRef = (0,
|
|
36046
|
-
const optimisticAdvancePageRef = (0,
|
|
36200
|
+
const initialRequestedPageRef = (0, import_react6.useRef)(requestedPage);
|
|
36201
|
+
const latestRequestedPageRef = (0, import_react6.useRef)(requestedPage);
|
|
36202
|
+
const optimisticAdvancePageRef = (0, import_react6.useRef)(null);
|
|
36047
36203
|
latestRequestedPageRef.current = requestedPage;
|
|
36048
36204
|
const progressionKey = `${queryKey}\0${pageSize}`;
|
|
36049
36205
|
const initialShownCount = startCount(pageSize, initialRequestedPageRef.current);
|
|
36050
36206
|
const resetShownCount = startCount(pageSize, 1);
|
|
36051
36207
|
const queryStartShownCount = hasExplicitRequestedPage ? startCount(pageSize, requestedPage) : resetShownCount;
|
|
36052
|
-
const [progression, setProgression] = (0,
|
|
36208
|
+
const [progression, setProgression] = (0, import_react6.useState)(() => ({
|
|
36053
36209
|
key: progressionKey,
|
|
36054
36210
|
shownCount: initialShownCount,
|
|
36055
36211
|
requestedPage
|
|
@@ -36060,7 +36216,7 @@ function useProgressiveTableRows({
|
|
|
36060
36216
|
const shownCount = progression.key !== progressionKey ? queryStartShownCount : externallyRequestedPage ? startCount(pageSize, requestedPage) : Math.max(progression.shownCount, resetShownCount);
|
|
36061
36217
|
const visibleCount = Math.min(rows.length, shownCount);
|
|
36062
36218
|
const hasMore = enabled && pageSize > 0 && visibleCount < rows.length;
|
|
36063
|
-
(0,
|
|
36219
|
+
(0, import_react6.useEffect)(() => {
|
|
36064
36220
|
setProgression((current) => {
|
|
36065
36221
|
if (current.key !== progressionKey) {
|
|
36066
36222
|
optimisticAdvancePageRef.current = null;
|
|
@@ -36100,12 +36256,12 @@ function useProgressiveTableRows({
|
|
|
36100
36256
|
onPageAdvance(nextPage);
|
|
36101
36257
|
}
|
|
36102
36258
|
};
|
|
36103
|
-
const warnedUnderfill = (0,
|
|
36104
|
-
const numberedMeasured = (0,
|
|
36105
|
-
const fillInputs = (0,
|
|
36259
|
+
const warnedUnderfill = (0, import_react6.useRef)(null);
|
|
36260
|
+
const numberedMeasured = (0, import_react6.useRef)(false);
|
|
36261
|
+
const fillInputs = (0, import_react6.useRef)({ containers, onPageSizeChange, visibleCount });
|
|
36106
36262
|
fillInputs.current = { containers, onPageSizeChange, visibleCount };
|
|
36107
36263
|
const containerCount = containers.length;
|
|
36108
|
-
(0,
|
|
36264
|
+
(0, import_react6.useEffect)(() => {
|
|
36109
36265
|
if (!hasMore && !numberedPageHasMore) return;
|
|
36110
36266
|
if (!hasMore && numberedMeasured.current) return;
|
|
36111
36267
|
if (!hasMore) numberedMeasured.current = true;
|
|
@@ -36151,7 +36307,7 @@ function useProgressiveTableRows({
|
|
|
36151
36307
|
...thresholdPx === void 0 ? {} : { thresholdPx }
|
|
36152
36308
|
});
|
|
36153
36309
|
return {
|
|
36154
|
-
rows: (0,
|
|
36310
|
+
rows: (0, import_react6.useMemo)(() => rows.slice(0, visibleCount), [rows, visibleCount]),
|
|
36155
36311
|
shownCount: visibleCount,
|
|
36156
36312
|
hasMore,
|
|
36157
36313
|
showMore: scroll.requestNextPage
|
|
@@ -36761,32 +36917,32 @@ function DefaultTableStaleNotice({ error, what, onRetry }) {
|
|
|
36761
36917
|
}
|
|
36762
36918
|
|
|
36763
36919
|
// src/data-table/useTableNotice.tsx
|
|
36764
|
-
var
|
|
36920
|
+
var import_react8 = require("react");
|
|
36765
36921
|
|
|
36766
36922
|
// src/data-table/host.tsx
|
|
36767
|
-
var
|
|
36923
|
+
var import_react7 = require("react");
|
|
36768
36924
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
36769
36925
|
var HOST_SLOT = /* @__PURE__ */ Symbol.for("ai-matrx.design-system.table-host-context");
|
|
36770
36926
|
var hostRegistry = globalThis;
|
|
36771
|
-
var HostContext = hostRegistry[HOST_SLOT] ??= (0,
|
|
36927
|
+
var HostContext = hostRegistry[HOST_SLOT] ??= (0, import_react7.createContext)({});
|
|
36772
36928
|
function MatrxDataTableProvider({ value, children }) {
|
|
36773
36929
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(HostContext.Provider, { value, children });
|
|
36774
36930
|
}
|
|
36775
36931
|
function useMatrxDataTableHost() {
|
|
36776
|
-
return (0,
|
|
36932
|
+
return (0, import_react7.useContext)(HostContext);
|
|
36777
36933
|
}
|
|
36778
36934
|
var ROW_ALCHEMY_SLOT = /* @__PURE__ */ Symbol.for("ai-matrx.design-system.table-row-alchemy-context");
|
|
36779
36935
|
var rowAlchemyRegistry = globalThis;
|
|
36780
|
-
var RowAlchemyContext = rowAlchemyRegistry[ROW_ALCHEMY_SLOT] ??= (0,
|
|
36936
|
+
var RowAlchemyContext = rowAlchemyRegistry[ROW_ALCHEMY_SLOT] ??= (0, import_react7.createContext)(null);
|
|
36781
36937
|
function MatrxTableRowAlchemyScope({ value, children }) {
|
|
36782
36938
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(RowAlchemyContext.Provider, { value, children });
|
|
36783
36939
|
}
|
|
36784
36940
|
function useMatrxTableRowAlchemy() {
|
|
36785
|
-
return (0,
|
|
36941
|
+
return (0, import_react7.useContext)(RowAlchemyContext);
|
|
36786
36942
|
}
|
|
36787
36943
|
var ROW_CONTROLS_SLOT = /* @__PURE__ */ Symbol.for("ai-matrx.design-system.table-row-controls-context");
|
|
36788
36944
|
var rowControlsRegistry = globalThis;
|
|
36789
|
-
var RowControlsContext = rowControlsRegistry[ROW_CONTROLS_SLOT] ??= (0,
|
|
36945
|
+
var RowControlsContext = rowControlsRegistry[ROW_CONTROLS_SLOT] ??= (0, import_react7.createContext)(null);
|
|
36790
36946
|
function MatrxTableRowControlsScope({ value, children }) {
|
|
36791
36947
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(RowControlsContext.Provider, { value, children });
|
|
36792
36948
|
}
|
|
@@ -36795,8 +36951,8 @@ function MatrxTableRowControlsScope({ value, children }) {
|
|
|
36795
36951
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
36796
36952
|
function useTableNotice() {
|
|
36797
36953
|
const host = useMatrxDataTableHost();
|
|
36798
|
-
const [message, setMessage] = (0,
|
|
36799
|
-
const notify = (0,
|
|
36954
|
+
const [message, setMessage] = (0, import_react8.useState)(null);
|
|
36955
|
+
const notify = (0, import_react8.useMemo)(
|
|
36800
36956
|
() => ({
|
|
36801
36957
|
success(text) {
|
|
36802
36958
|
if (host.notify) host.notify.success(text);
|
|
@@ -37137,13 +37293,13 @@ function GenericTablePagination({
|
|
|
37137
37293
|
}
|
|
37138
37294
|
|
|
37139
37295
|
// src/data-table/TableViewTabs.tsx
|
|
37140
|
-
var
|
|
37296
|
+
var import_react9 = require("react");
|
|
37141
37297
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
37142
37298
|
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 }) {
|
|
37143
|
-
const [renaming, setRenaming] = (0,
|
|
37144
|
-
const [draft, setDraft] = (0,
|
|
37145
|
-
const opened = (0,
|
|
37146
|
-
(0,
|
|
37299
|
+
const [renaming, setRenaming] = (0, import_react9.useState)(null);
|
|
37300
|
+
const [draft, setDraft] = (0, import_react9.useState)("");
|
|
37301
|
+
const opened = (0, import_react9.useRef)(null);
|
|
37302
|
+
(0, import_react9.useEffect)(() => {
|
|
37147
37303
|
if (!editingId || opened.current === editingId) return;
|
|
37148
37304
|
const tab = tabs.find((t) => t.id === editingId);
|
|
37149
37305
|
if (!tab) return;
|
|
@@ -37244,16 +37400,16 @@ function TableViewTabs({ tabs, activeId, onSelect, onAdd, onClose, onRename, rel
|
|
|
37244
37400
|
}
|
|
37245
37401
|
var same = (a, b) => JSON.stringify(a) === JSON.stringify(b);
|
|
37246
37402
|
function TableViewWorkspace({ snapshot, onApply, related, store }) {
|
|
37247
|
-
const [localViews, setLocalViews] = (0,
|
|
37248
|
-
const [defaultSnapshot, setDefaultSnapshot] = (0,
|
|
37249
|
-
const [activeId, setActiveId] = (0,
|
|
37250
|
-
const [namingId, setNamingId] = (0,
|
|
37403
|
+
const [localViews, setLocalViews] = (0, import_react9.useState)([]);
|
|
37404
|
+
const [defaultSnapshot, setDefaultSnapshot] = (0, import_react9.useState)(snapshot);
|
|
37405
|
+
const [activeId, setActiveId] = (0, import_react9.useState)("default");
|
|
37406
|
+
const [namingId, setNamingId] = (0, import_react9.useState)(null);
|
|
37251
37407
|
const saved = store ? store.views : localViews;
|
|
37252
37408
|
const write = (next) => store ? store.onChange(next) : setLocalViews(next);
|
|
37253
37409
|
const tabs = [{ id: "default", label: "Default view", snapshot: defaultSnapshot }, ...saved];
|
|
37254
37410
|
const stashed = () => saved.map((tab) => tab.id === activeId && !same(tab.snapshot, snapshot) ? { ...tab, snapshot } : tab);
|
|
37255
37411
|
const activeSaved = saved.find((tab) => tab.id === activeId);
|
|
37256
|
-
(0,
|
|
37412
|
+
(0, import_react9.useEffect)(() => {
|
|
37257
37413
|
if (store && activeSaved && !same(activeSaved.snapshot, snapshot)) write(stashed());
|
|
37258
37414
|
}, [snapshot]);
|
|
37259
37415
|
const select = (id) => {
|
|
@@ -38474,16 +38630,16 @@ var React17 = __toESM(require("react"), 1);
|
|
|
38474
38630
|
var React15 = __toESM(require("react"), 1);
|
|
38475
38631
|
|
|
38476
38632
|
// src/use-scroll-fade.ts
|
|
38477
|
-
var
|
|
38633
|
+
var import_react10 = require("react");
|
|
38478
38634
|
var EPSILON = 2;
|
|
38479
38635
|
function useScrollFade() {
|
|
38480
|
-
const [state, setState] = (0,
|
|
38636
|
+
const [state, setState] = (0, import_react10.useState)({
|
|
38481
38637
|
top: false,
|
|
38482
38638
|
bottom: false
|
|
38483
38639
|
});
|
|
38484
|
-
const nodeRef = (0,
|
|
38485
|
-
const cleanupRef = (0,
|
|
38486
|
-
const measure = (0,
|
|
38640
|
+
const nodeRef = (0, import_react10.useRef)(null);
|
|
38641
|
+
const cleanupRef = (0, import_react10.useRef)(null);
|
|
38642
|
+
const measure = (0, import_react10.useCallback)(() => {
|
|
38487
38643
|
const el = nodeRef.current;
|
|
38488
38644
|
if (!el) return;
|
|
38489
38645
|
const overflowing = el.scrollHeight - el.clientHeight > EPSILON;
|
|
@@ -38495,7 +38651,7 @@ function useScrollFade() {
|
|
|
38495
38651
|
(prev) => prev.top === next.top && prev.bottom === next.bottom ? prev : next
|
|
38496
38652
|
);
|
|
38497
38653
|
}, []);
|
|
38498
|
-
const ref = (0,
|
|
38654
|
+
const ref = (0, import_react10.useCallback)(
|
|
38499
38655
|
(node) => {
|
|
38500
38656
|
cleanupRef.current?.();
|
|
38501
38657
|
cleanupRef.current = null;
|
|
@@ -38515,7 +38671,7 @@ function useScrollFade() {
|
|
|
38515
38671
|
},
|
|
38516
38672
|
[measure]
|
|
38517
38673
|
);
|
|
38518
|
-
(0,
|
|
38674
|
+
(0, import_react10.useEffect)(() => () => cleanupRef.current?.(), []);
|
|
38519
38675
|
return {
|
|
38520
38676
|
ref,
|
|
38521
38677
|
state,
|
|
@@ -38755,7 +38911,7 @@ var ContextMenuShortcut = ({
|
|
|
38755
38911
|
ContextMenuShortcut.displayName = "ContextMenuShortcut";
|
|
38756
38912
|
|
|
38757
38913
|
// src/data-table/LayeredFilterBuilder.tsx
|
|
38758
|
-
var
|
|
38914
|
+
var import_react11 = require("react");
|
|
38759
38915
|
|
|
38760
38916
|
// src/popover.tsx
|
|
38761
38917
|
var PopoverPrimitive = __toESM(require("@radix-ui/react-popover"), 1);
|
|
@@ -38819,8 +38975,8 @@ function LayeredFilterBuilder({
|
|
|
38819
38975
|
maxRules = 20,
|
|
38820
38976
|
label = "Advanced filters"
|
|
38821
38977
|
}) {
|
|
38822
|
-
const [open, setOpen] = (0,
|
|
38823
|
-
const [draggedIndex, setDraggedIndex] = (0,
|
|
38978
|
+
const [open, setOpen] = (0, import_react11.useState)(false);
|
|
38979
|
+
const [draggedIndex, setDraggedIndex] = (0, import_react11.useState)(null);
|
|
38824
38980
|
if (fields.length === 0) return null;
|
|
38825
38981
|
const updateRule = (index, patch) => {
|
|
38826
38982
|
onChange(
|
|
@@ -40853,7 +41009,7 @@ function WorkspaceWindowSlot({ onNode, sessionKey, onClose }) {
|
|
|
40853
41009
|
}
|
|
40854
41010
|
|
|
40855
41011
|
// src/tap-target/tap-target-button.tsx
|
|
40856
|
-
var
|
|
41012
|
+
var import_react14 = require("react");
|
|
40857
41013
|
|
|
40858
41014
|
// src/tap-target/cn.ts
|
|
40859
41015
|
function cn2(...values) {
|
|
@@ -40861,7 +41017,7 @@ function cn2(...values) {
|
|
|
40861
41017
|
}
|
|
40862
41018
|
|
|
40863
41019
|
// src/tap-target/tap-target-guard.ts
|
|
40864
|
-
var
|
|
41020
|
+
var import_react12 = require("react");
|
|
40865
41021
|
var GUARD_SLOT = /* @__PURE__ */ Symbol.for("@ai-matrx/tap-target:guard");
|
|
40866
41022
|
function guardOn() {
|
|
40867
41023
|
return globalThis[GUARD_SLOT] === true;
|
|
@@ -41122,8 +41278,8 @@ function assignRef(ref, value) {
|
|
|
41122
41278
|
else if (ref) ref.current = value;
|
|
41123
41279
|
}
|
|
41124
41280
|
function useTapGuardRef(forwarded, propViolation) {
|
|
41125
|
-
const current = (0,
|
|
41126
|
-
return (0,
|
|
41281
|
+
const current = (0, import_react12.useRef)(null);
|
|
41282
|
+
return (0, import_react12.useCallback)(
|
|
41127
41283
|
(node) => {
|
|
41128
41284
|
assignRef(forwarded, node);
|
|
41129
41285
|
if (current.current && current.current !== node) mounted.delete(current.current);
|
|
@@ -41144,7 +41300,7 @@ function useTapGuardRef(forwarded, propViolation) {
|
|
|
41144
41300
|
}
|
|
41145
41301
|
|
|
41146
41302
|
// src/tap-target/tap-features.tsx
|
|
41147
|
-
var
|
|
41303
|
+
var import_react13 = require("react");
|
|
41148
41304
|
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
41149
41305
|
var TAP_TONE_CLASS = {
|
|
41150
41306
|
default: "text-foreground",
|
|
@@ -41186,7 +41342,7 @@ function matchesShortcut(e, shortcut) {
|
|
|
41186
41342
|
return e.key.toLowerCase() === p.key;
|
|
41187
41343
|
}
|
|
41188
41344
|
function useTapShortcut(shortcut, getNode, enabled) {
|
|
41189
|
-
(0,
|
|
41345
|
+
(0, import_react13.useEffect)(() => {
|
|
41190
41346
|
if (!shortcut || !enabled) return;
|
|
41191
41347
|
const onKey = (e) => {
|
|
41192
41348
|
if (!matchesShortcut(e, shortcut)) return;
|
|
@@ -41261,8 +41417,8 @@ function IconContent({
|
|
|
41261
41417
|
className
|
|
41262
41418
|
}) {
|
|
41263
41419
|
if (icon) {
|
|
41264
|
-
if ((0,
|
|
41265
|
-
return (0,
|
|
41420
|
+
if ((0, import_react14.isValidElement)(icon)) {
|
|
41421
|
+
return (0, import_react14.cloneElement)(icon, {
|
|
41266
41422
|
className: cn2(className, icon.props.className)
|
|
41267
41423
|
});
|
|
41268
41424
|
}
|
|
@@ -41371,15 +41527,15 @@ function useTapTarget({
|
|
|
41371
41527
|
buttonRef,
|
|
41372
41528
|
propViolation
|
|
41373
41529
|
);
|
|
41374
|
-
const nodeRef = (0,
|
|
41375
|
-
const triggerRef = (0,
|
|
41530
|
+
const nodeRef = (0, import_react14.useRef)(null);
|
|
41531
|
+
const triggerRef = (0, import_react14.useCallback)(
|
|
41376
41532
|
(node) => {
|
|
41377
41533
|
nodeRef.current = node;
|
|
41378
41534
|
guardRef(node);
|
|
41379
41535
|
},
|
|
41380
41536
|
[guardRef]
|
|
41381
41537
|
);
|
|
41382
|
-
const getNode = (0,
|
|
41538
|
+
const getNode = (0, import_react14.useCallback)(() => nodeRef.current, []);
|
|
41383
41539
|
useTapShortcut(shortcut, getNode, !isDisabled && !loading);
|
|
41384
41540
|
const toneColor = tone ? TAP_TONE_CLASS[tone] : pressed && !colorClassName ? TAP_TONE_CLASS.primary : null;
|
|
41385
41541
|
if (toneColor) {
|
|
@@ -41569,7 +41725,7 @@ function withTooltip(trigger, {
|
|
|
41569
41725
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(TooltipContent, { side: tooltipSide, align: tooltipAlign, children: tooltipBody(label, shortcut) })
|
|
41570
41726
|
] });
|
|
41571
41727
|
}
|
|
41572
|
-
var TapTargetButton = (0,
|
|
41728
|
+
var TapTargetButton = (0, import_react14.forwardRef)(function TapTargetButton2({
|
|
41573
41729
|
icon,
|
|
41574
41730
|
children,
|
|
41575
41731
|
strokeWidth = 2,
|
|
@@ -41618,7 +41774,7 @@ var TapTargetButton = (0, import_react13.forwardRef)(function TapTargetButton2({
|
|
|
41618
41774
|
buttonRef: ref
|
|
41619
41775
|
});
|
|
41620
41776
|
});
|
|
41621
|
-
var TapTargetButtonTransparent = (0,
|
|
41777
|
+
var TapTargetButtonTransparent = (0, import_react14.forwardRef)(function TapTargetButtonTransparent2({
|
|
41622
41778
|
icon,
|
|
41623
41779
|
children,
|
|
41624
41780
|
strokeWidth = 2,
|
|
@@ -41667,7 +41823,7 @@ var TapTargetButtonTransparent = (0, import_react13.forwardRef)(function TapTarg
|
|
|
41667
41823
|
buttonRef: ref
|
|
41668
41824
|
});
|
|
41669
41825
|
});
|
|
41670
|
-
var TapTargetButtonOutline = (0,
|
|
41826
|
+
var TapTargetButtonOutline = (0, import_react14.forwardRef)(function TapTargetButtonOutline2({
|
|
41671
41827
|
icon,
|
|
41672
41828
|
children,
|
|
41673
41829
|
strokeWidth = 2,
|
|
@@ -41717,7 +41873,7 @@ var TapTargetButtonOutline = (0, import_react13.forwardRef)(function TapTargetBu
|
|
|
41717
41873
|
buttonRef: ref
|
|
41718
41874
|
});
|
|
41719
41875
|
});
|
|
41720
|
-
var TapTargetButtonSolid = (0,
|
|
41876
|
+
var TapTargetButtonSolid = (0, import_react14.forwardRef)(function TapTargetButtonSolid2({
|
|
41721
41877
|
icon,
|
|
41722
41878
|
children,
|
|
41723
41879
|
strokeWidth = 2,
|
|
@@ -41784,10 +41940,10 @@ function solidClasses(tone, bgColor, iconColor, hoverBgColor, activeBgColor) {
|
|
|
41784
41940
|
labelClassName: `matrx-tap-label ${glyph}`
|
|
41785
41941
|
};
|
|
41786
41942
|
}
|
|
41787
|
-
var TapTargetButtonDestructive = (0,
|
|
41943
|
+
var TapTargetButtonDestructive = (0, import_react14.forwardRef)(function TapTargetButtonDestructive2({ tone = "destructive", ...rest }, ref) {
|
|
41788
41944
|
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(TapTargetButtonSolid, { ref, tone, ...rest });
|
|
41789
41945
|
});
|
|
41790
|
-
var TapTargetButtonForGroup = (0,
|
|
41946
|
+
var TapTargetButtonForGroup = (0, import_react14.forwardRef)(function TapTargetButtonForGroup2({
|
|
41791
41947
|
icon,
|
|
41792
41948
|
children,
|
|
41793
41949
|
strokeWidth = 2,
|
|
@@ -43010,9 +43166,9 @@ function useCopySubsetVariant() {
|
|
|
43010
43166
|
}
|
|
43011
43167
|
|
|
43012
43168
|
// src/data-table/clipping.ts
|
|
43013
|
-
var
|
|
43169
|
+
var import_react15 = require("react");
|
|
43014
43170
|
function useClippedContentGuard(ref, options) {
|
|
43015
|
-
(0,
|
|
43171
|
+
(0, import_react15.useEffect)(() => {
|
|
43016
43172
|
if (!options.enabled || !ref.current) return;
|
|
43017
43173
|
const node = ref.current;
|
|
43018
43174
|
const check2 = () => {
|
|
@@ -43026,7 +43182,7 @@ function useClippedContentGuard(ref, options) {
|
|
|
43026
43182
|
}
|
|
43027
43183
|
|
|
43028
43184
|
// src/data-table/url-state.ts
|
|
43029
|
-
var
|
|
43185
|
+
var import_react16 = require("react");
|
|
43030
43186
|
var import_url_state = require("@ai-matrx/kit/url-state");
|
|
43031
43187
|
function parseSort(raw) {
|
|
43032
43188
|
if (!raw) return null;
|
|
@@ -43078,11 +43234,11 @@ function useTableUrlState(options) {
|
|
|
43078
43234
|
textHistory = "session"
|
|
43079
43235
|
} = options;
|
|
43080
43236
|
const prefix = tableUrlParamPrefix(tableId);
|
|
43081
|
-
const key = (0,
|
|
43237
|
+
const key = (0, import_react16.useCallback)((name) => `${prefix}.${name}`, [prefix]);
|
|
43082
43238
|
const defaultSortId = defaultSort?.id;
|
|
43083
43239
|
const defaultSortDirection = defaultSort?.direction;
|
|
43084
43240
|
const searchParams = (0, import_url_state.useUrlSearchParams)();
|
|
43085
|
-
const readState = (0,
|
|
43241
|
+
const readState = (0, import_react16.useCallback)(
|
|
43086
43242
|
(params) => {
|
|
43087
43243
|
const initialSort = defaultSortId && defaultSortDirection ? { id: defaultSortId, direction: defaultSortDirection } : null;
|
|
43088
43244
|
return {
|
|
@@ -43103,9 +43259,9 @@ function useTableUrlState(options) {
|
|
|
43103
43259
|
[defaultPageSize, defaultSortDirection, defaultSortId, key]
|
|
43104
43260
|
);
|
|
43105
43261
|
const state = readState(searchParams);
|
|
43106
|
-
const lastTextWriteAt = (0,
|
|
43107
|
-
const [debouncedSearch, setDebouncedSearch] = (0,
|
|
43108
|
-
(0,
|
|
43262
|
+
const lastTextWriteAt = (0, import_react16.useRef)(0);
|
|
43263
|
+
const [debouncedSearch, setDebouncedSearch] = (0, import_react16.useState)(state.search);
|
|
43264
|
+
(0, import_react16.useEffect)(() => {
|
|
43109
43265
|
if (state.search === debouncedSearch) return;
|
|
43110
43266
|
const timer = window.setTimeout(
|
|
43111
43267
|
() => setDebouncedSearch(state.search),
|
|
@@ -43113,7 +43269,7 @@ function useTableUrlState(options) {
|
|
|
43113
43269
|
);
|
|
43114
43270
|
return () => window.clearTimeout(timer);
|
|
43115
43271
|
}, [state.search, debouncedSearch, searchDebounceMs]);
|
|
43116
|
-
const writeState = (0,
|
|
43272
|
+
const writeState = (0, import_react16.useCallback)(
|
|
43117
43273
|
(nextState, mode = history) => {
|
|
43118
43274
|
const params = new URLSearchParams(window.location.search);
|
|
43119
43275
|
const setOrDelete = (name, value) => {
|
|
@@ -43164,7 +43320,7 @@ function useTableUrlState(options) {
|
|
|
43164
43320
|
},
|
|
43165
43321
|
[defaultPageSize, defaultSortDirection, defaultSortId, history, key]
|
|
43166
43322
|
);
|
|
43167
|
-
const onStateChange = (0,
|
|
43323
|
+
const onStateChange = (0, import_react16.useCallback)(
|
|
43168
43324
|
(next) => {
|
|
43169
43325
|
const changed = Object.keys(next).filter(
|
|
43170
43326
|
(name) => JSON.stringify(next[name]) !== JSON.stringify(state[name])
|
|
@@ -43182,7 +43338,7 @@ function useTableUrlState(options) {
|
|
|
43182
43338
|
},
|
|
43183
43339
|
[history, state, textHistory, writeState]
|
|
43184
43340
|
);
|
|
43185
|
-
const reset = (0,
|
|
43341
|
+
const reset = (0, import_react16.useCallback)(() => {
|
|
43186
43342
|
const dSort = defaultSortId && defaultSortDirection ? { id: defaultSortId, direction: defaultSortDirection } : null;
|
|
43187
43343
|
const next = {
|
|
43188
43344
|
page: 1,
|
|
@@ -43198,7 +43354,7 @@ function useTableUrlState(options) {
|
|
|
43198
43354
|
writeState(next);
|
|
43199
43355
|
setDebouncedSearch("");
|
|
43200
43356
|
}, [defaultPageSize, defaultSortDirection, defaultSortId, writeState]);
|
|
43201
|
-
const queryState = (0,
|
|
43357
|
+
const queryState = (0, import_react16.useMemo)(
|
|
43202
43358
|
() => state.search === debouncedSearch ? state : { ...state, search: debouncedSearch, page: 1 },
|
|
43203
43359
|
[state, debouncedSearch]
|
|
43204
43360
|
);
|
|
@@ -43209,14 +43365,14 @@ function useTableUrlState(options) {
|
|
|
43209
43365
|
var import_url_state3 = require("@ai-matrx/kit/url-state");
|
|
43210
43366
|
|
|
43211
43367
|
// src/data-table/RowAlchemyLauncher.tsx
|
|
43212
|
-
var
|
|
43368
|
+
var import_react17 = require("react");
|
|
43213
43369
|
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
43214
43370
|
function MatrxTableRowAlchemyProvider({ copy, placement, controls, children }) {
|
|
43215
|
-
const controller = (0,
|
|
43371
|
+
const controller = (0, import_react17.useRef)(null);
|
|
43216
43372
|
const { CopyControls } = useMatrxDataTableHost();
|
|
43217
|
-
const [active, setActive] = (0,
|
|
43218
|
-
const [fallback, setFallback] = (0,
|
|
43219
|
-
(0,
|
|
43373
|
+
const [active, setActive] = (0, import_react17.useState)(false);
|
|
43374
|
+
const [fallback, setFallback] = (0, import_react17.useState)(false);
|
|
43375
|
+
(0, import_react17.useEffect)(() => {
|
|
43220
43376
|
if (placement !== "menu" || active) return;
|
|
43221
43377
|
const timer = window.setTimeout(() => {
|
|
43222
43378
|
if (!active) {
|
|
@@ -43226,11 +43382,11 @@ function MatrxTableRowAlchemyProvider({ copy, placement, controls, children }) {
|
|
|
43226
43382
|
}, 0);
|
|
43227
43383
|
return () => window.clearTimeout(timer);
|
|
43228
43384
|
}, [active, placement]);
|
|
43229
|
-
const activate = (0,
|
|
43230
|
-
const mountMenu = (0,
|
|
43385
|
+
const activate = (0, import_react17.useCallback)(() => setActive(true), []);
|
|
43386
|
+
const mountMenu = (0, import_react17.useCallback)((target, onClose, restoreFocus) => {
|
|
43231
43387
|
controller.current?.mountPalette(target, onClose, restoreFocus);
|
|
43232
43388
|
}, []);
|
|
43233
|
-
const prepare = (0,
|
|
43389
|
+
const prepare = (0, import_react17.useCallback)(async (restoreFocus) => {
|
|
43234
43390
|
if (copy.disabled) throw new Error("Alchemy is disabled for this record.");
|
|
43235
43391
|
if (!controller.current) throw new Error("Alchemy is unavailable because its launcher did not mount.");
|
|
43236
43392
|
await controller.current.preparePrimary(restoreFocus ? { restoreFocus } : void 0);
|
|
@@ -43251,7 +43407,7 @@ function MatrxTableRowAlchemyProvider({ copy, placement, controls, children }) {
|
|
|
43251
43407
|
}
|
|
43252
43408
|
|
|
43253
43409
|
// src/data-table/ColumnHeaderCell.tsx
|
|
43254
|
-
var
|
|
43410
|
+
var import_react18 = require("react");
|
|
43255
43411
|
var import_core = require("@dnd-kit/core");
|
|
43256
43412
|
|
|
43257
43413
|
// src/command.tsx
|
|
@@ -43522,7 +43678,7 @@ function HeaderMenuItems({
|
|
|
43522
43678
|
onDone,
|
|
43523
43679
|
depth = 0
|
|
43524
43680
|
}) {
|
|
43525
|
-
const [openSubmenu, setOpenSubmenu] = (0,
|
|
43681
|
+
const [openSubmenu, setOpenSubmenu] = (0, import_react18.useState)(null);
|
|
43526
43682
|
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("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) => {
|
|
43527
43683
|
const disabled = Boolean(item.disabledReason);
|
|
43528
43684
|
const hasSubmenu = Boolean(item.submenu && item.submenu.length > 0);
|
|
@@ -43563,7 +43719,7 @@ function HeaderMenuItems({
|
|
|
43563
43719
|
] }, item.id);
|
|
43564
43720
|
}) });
|
|
43565
43721
|
}
|
|
43566
|
-
var HeaderButton = (0,
|
|
43722
|
+
var HeaderButton = (0, import_react18.forwardRef)(({ dragDescription, "aria-describedby": tooltipDescription, ...props }, ref) => {
|
|
43567
43723
|
const descriptions = [tooltipDescription, dragDescription].filter((value) => Boolean(value)).join(" ");
|
|
43568
43724
|
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
43569
43725
|
"button",
|
|
@@ -43638,18 +43794,18 @@ function ColumnHeaderCell({
|
|
|
43638
43794
|
const filterActive = isColumnFilterActive(filterValue);
|
|
43639
43795
|
const deferredFilter = filterKind === "text" || filterApplyLabel !== void 0 || Boolean(filterShowCancel) || filterFooterHint !== void 0;
|
|
43640
43796
|
const showFilterCancel = filterShowCancel ?? filterKind === "text";
|
|
43641
|
-
const [filterOpen, setFilterOpen] = (0,
|
|
43642
|
-
const [pendingNegation, setPendingNegation] = (0,
|
|
43643
|
-
const [draftFilter, setDraftFilter] = (0,
|
|
43644
|
-
(0,
|
|
43797
|
+
const [filterOpen, setFilterOpen] = (0, import_react18.useState)(false);
|
|
43798
|
+
const [pendingNegation, setPendingNegation] = (0, import_react18.useState)(false);
|
|
43799
|
+
const [draftFilter, setDraftFilter] = (0, import_react18.useState)(filterValue);
|
|
43800
|
+
(0, import_react18.useEffect)(() => {
|
|
43645
43801
|
if (!filterOpen) {
|
|
43646
43802
|
setDraftFilter(filterValue);
|
|
43647
43803
|
setPendingNegation(filterValue?.negated ?? false);
|
|
43648
43804
|
}
|
|
43649
43805
|
}, [filterOpen, filterValue]);
|
|
43650
|
-
const notifyOpen = (0,
|
|
43806
|
+
const notifyOpen = (0, import_react18.useRef)(onFilterOpen);
|
|
43651
43807
|
notifyOpen.current = onFilterOpen;
|
|
43652
|
-
(0,
|
|
43808
|
+
(0, import_react18.useEffect)(() => {
|
|
43653
43809
|
if (filterOpen) notifyOpen.current?.();
|
|
43654
43810
|
}, [filterOpen]);
|
|
43655
43811
|
const applyFilter = () => {
|
|
@@ -44146,10 +44302,10 @@ function FacetChecklist({
|
|
|
44146
44302
|
value,
|
|
44147
44303
|
onChange
|
|
44148
44304
|
}) {
|
|
44149
|
-
const [query, setQuery] = (0,
|
|
44305
|
+
const [query, setQuery] = (0, import_react18.useState)("");
|
|
44150
44306
|
const selected = value?.kind === "select" ? (value.values ?? (value.value && value.value !== "__all__" ? [value.value] : [])).map((candidate) => candidate === SELECT_EMPTY_VALUE ? "" : candidate) : [];
|
|
44151
44307
|
const selectedSet = new Set(selected);
|
|
44152
|
-
const rows = (0,
|
|
44308
|
+
const rows = (0, import_react18.useMemo)(() => {
|
|
44153
44309
|
if (!facets) return [];
|
|
44154
44310
|
const listed = facets.values.map((entry) => ({
|
|
44155
44311
|
value: entry.value,
|
|
@@ -44323,8 +44479,8 @@ function SearchableSelectFilter({
|
|
|
44323
44479
|
single = false,
|
|
44324
44480
|
allowCustom = false
|
|
44325
44481
|
}) {
|
|
44326
|
-
const [query, setQuery] = (0,
|
|
44327
|
-
const filtered = (0,
|
|
44482
|
+
const [query, setQuery] = (0, import_react18.useState)("");
|
|
44483
|
+
const filtered = (0, import_react18.useMemo)(() => {
|
|
44328
44484
|
const q = query.trim().toLowerCase();
|
|
44329
44485
|
if (!q) return options;
|
|
44330
44486
|
return options.filter(
|
|
@@ -44453,11 +44609,11 @@ function NumberFilterBody({
|
|
|
44453
44609
|
}) {
|
|
44454
44610
|
const min = value?.kind === "number" ? value.min : void 0;
|
|
44455
44611
|
const max = value?.kind === "number" ? value.max : void 0;
|
|
44456
|
-
const [op, setOp] = (0,
|
|
44457
|
-
const [minText, setMinText] = (0,
|
|
44612
|
+
const [op, setOp] = (0, import_react18.useState)(() => numberOpOf(value));
|
|
44613
|
+
const [minText, setMinText] = (0, import_react18.useState)(
|
|
44458
44614
|
value?.kind === "number" && value.op === "lt" && max !== void 0 ? String(max) : min !== void 0 ? String(min) : ""
|
|
44459
44615
|
);
|
|
44460
|
-
const [maxText, setMaxText] = (0,
|
|
44616
|
+
const [maxText, setMaxText] = (0, import_react18.useState)(max !== void 0 ? String(max) : "");
|
|
44461
44617
|
const active = value?.kind === "number" && (value.op === "empty" || value.op === "not_empty" || min !== void 0 || max !== void 0);
|
|
44462
44618
|
const emit2 = (nextOp, lowRaw, highRaw) => {
|
|
44463
44619
|
if (nextOp === "empty" || nextOp === "not_empty") {
|
|
@@ -44663,7 +44819,7 @@ function MatrxTableGroupHeaderRow({
|
|
|
44663
44819
|
}
|
|
44664
44820
|
|
|
44665
44821
|
// src/data-table/DrillAnswerTable.tsx
|
|
44666
|
-
var
|
|
44822
|
+
var import_react19 = require("react");
|
|
44667
44823
|
var import_format10 = require("@ai-matrx/kit/format");
|
|
44668
44824
|
|
|
44669
44825
|
// src/dropdown-menu.tsx
|
|
@@ -45889,12 +46045,12 @@ function MatrxDrillAnswerTable({
|
|
|
45889
46045
|
attributes
|
|
45890
46046
|
}) {
|
|
45891
46047
|
const host = useMatrxDataTableHost();
|
|
45892
|
-
const tableId = `drill-answer-${(0,
|
|
45893
|
-
const [query, setQuery] = (0,
|
|
45894
|
-
const [peek, setPeek] = (0,
|
|
45895
|
-
const [collapsed, setCollapsed] = (0,
|
|
46048
|
+
const tableId = `drill-answer-${(0, import_react19.useId)()}`;
|
|
46049
|
+
const [query, setQuery] = (0, import_react19.useState)("");
|
|
46050
|
+
const [peek, setPeek] = (0, import_react19.useState)(null);
|
|
46051
|
+
const [collapsed, setCollapsed] = (0, import_react19.useState)(() => /* @__PURE__ */ new Set());
|
|
45896
46052
|
const selectionFor = JSON.stringify([question.by, question.across ?? null, question.where, question.window ?? null]);
|
|
45897
|
-
const [ticked, setTicked] = (0,
|
|
46053
|
+
const [ticked, setTicked] = (0, import_react19.useState)(() => ({ forQuestion: selectionFor, keys: /* @__PURE__ */ new Set() }));
|
|
45898
46054
|
const selected = ticked.forQuestion === selectionFor ? ticked.keys : /* @__PURE__ */ new Set();
|
|
45899
46055
|
const toggleTick = (key) => setTicked(() => {
|
|
45900
46056
|
const keys2 = new Set(selected);
|
|
@@ -45902,12 +46058,12 @@ function MatrxDrillAnswerTable({
|
|
|
45902
46058
|
else keys2.add(key);
|
|
45903
46059
|
return { forQuestion: selectionFor, keys: keys2 };
|
|
45904
46060
|
});
|
|
45905
|
-
const shown = (0,
|
|
46061
|
+
const shown = (0, import_react19.useMemo)(
|
|
45906
46062
|
() => question.show.map((key) => measures.find((m) => m.key === key)).filter((m) => Boolean(m)),
|
|
45907
46063
|
[question.show, measures]
|
|
45908
46064
|
);
|
|
45909
|
-
const tree = (0,
|
|
45910
|
-
const columns = (0,
|
|
46065
|
+
const tree = (0, import_react19.useMemo)(() => buildDrillTree(question, answers, measures), [question, answers, measures]);
|
|
46066
|
+
const columns = (0, import_react19.useMemo)(
|
|
45911
46067
|
() => pivotColumns(question, answers, dimensions, measures, pivotColumnCap ?? MATRX_DRILL_PIVOT_COLUMNS),
|
|
45912
46068
|
[question, answers, dimensions, measures, pivotColumnCap]
|
|
45913
46069
|
);
|
|
@@ -46087,7 +46243,7 @@ function MatrxDrillAnswerTable({
|
|
|
46087
46243
|
const intoLabel = intoRef ? dimensionRefLabel(dimensions, intoRef) : null;
|
|
46088
46244
|
const drill = () => onQuestionChange(drillInto(scope, node.groups, dimensions, intoRef, paths));
|
|
46089
46245
|
const records = () => onQuestionChange(drillToRecords(scope, node.groups));
|
|
46090
|
-
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|
|
46246
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_react19.Fragment, { children: [
|
|
46091
46247
|
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
46092
46248
|
MatrxTableGroupHeaderRow,
|
|
46093
46249
|
{
|
|
@@ -46349,7 +46505,7 @@ function DrillExport({
|
|
|
46349
46505
|
measures,
|
|
46350
46506
|
emptyLabel
|
|
46351
46507
|
}) {
|
|
46352
|
-
const [said, setSaid] = (0,
|
|
46508
|
+
const [said, setSaid] = (0, import_react19.useState)(null);
|
|
46353
46509
|
const grid = drillAnswerGrid(question, answers, dimensions, measures, emptyLabel);
|
|
46354
46510
|
const trail = question.where.map((w) => `${dimensionRefLabel(dimensions, w.dim)}: ${drillValueLabel(dimensions, w.dim, w.value, emptyLabel)}`);
|
|
46355
46511
|
const copy = async (text, what) => {
|
|
@@ -46403,7 +46559,7 @@ function DrillExport({
|
|
|
46403
46559
|
}
|
|
46404
46560
|
|
|
46405
46561
|
// src/data-table/DrillControls.tsx
|
|
46406
|
-
var
|
|
46562
|
+
var import_react20 = require("react");
|
|
46407
46563
|
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
46408
46564
|
var NONE = "\0none";
|
|
46409
46565
|
function refsFree(dimensions, taken) {
|
|
@@ -46637,7 +46793,7 @@ function MatrxDrillTrail({
|
|
|
46637
46793
|
children: [
|
|
46638
46794
|
crumbs.map((crumb, i) => {
|
|
46639
46795
|
const last = i === crumbs.length - 1;
|
|
46640
|
-
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
46796
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_react20.Fragment, { children: [
|
|
46641
46797
|
i > 0 ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(ChevronRight, { "aria-hidden": "true", className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }) : null,
|
|
46642
46798
|
last ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
46643
46799
|
"span",
|
|
@@ -46693,11 +46849,11 @@ function MatrxDrillWindowMenu({
|
|
|
46693
46849
|
customRange = true
|
|
46694
46850
|
}) {
|
|
46695
46851
|
const label = drillWindowLabel(question.window);
|
|
46696
|
-
const [editing, setEditing] = (0,
|
|
46697
|
-
const toForm = (0,
|
|
46852
|
+
const [editing, setEditing] = (0, import_react20.useState)(false);
|
|
46853
|
+
const toForm = (0, import_react20.useRef)(false);
|
|
46698
46854
|
const current = question.window ? drillWindowRange(question.window) : null;
|
|
46699
|
-
const [from, setFrom] = (0,
|
|
46700
|
-
const [to, setTo] = (0,
|
|
46855
|
+
const [from, setFrom] = (0, import_react20.useState)("");
|
|
46856
|
+
const [to, setTo] = (0, import_react20.useState)("");
|
|
46701
46857
|
const isPreset = !question.window || presets.some((p) => p.key === question.window);
|
|
46702
46858
|
const openCustom = () => {
|
|
46703
46859
|
setFrom(localInput(current?.from));
|
|
@@ -46815,7 +46971,7 @@ function MatrxDrillWindowMenu({
|
|
|
46815
46971
|
}
|
|
46816
46972
|
|
|
46817
46973
|
// src/data-table/ColumnResizeHandle.tsx
|
|
46818
|
-
var
|
|
46974
|
+
var import_react21 = require("react");
|
|
46819
46975
|
|
|
46820
46976
|
// src/data-table/column-resize.ts
|
|
46821
46977
|
var DEFAULT_COLUMN_MIN_WIDTH = 80;
|
|
@@ -46857,24 +47013,24 @@ function ColumnResizeHandle({
|
|
|
46857
47013
|
onResizeCancel,
|
|
46858
47014
|
onResizeCommit
|
|
46859
47015
|
}) {
|
|
46860
|
-
const handleRef = (0,
|
|
46861
|
-
const activeResizeRef = (0,
|
|
46862
|
-
const previewRafRef = (0,
|
|
46863
|
-
const queuedWidthRef = (0,
|
|
46864
|
-
const keyboardWidthRef = (0,
|
|
46865
|
-
const [announcedWidth, setAnnouncedWidth] = (0,
|
|
47016
|
+
const handleRef = (0, import_react21.useRef)(null);
|
|
47017
|
+
const activeResizeRef = (0, import_react21.useRef)(null);
|
|
47018
|
+
const previewRafRef = (0, import_react21.useRef)(null);
|
|
47019
|
+
const queuedWidthRef = (0, import_react21.useRef)(null);
|
|
47020
|
+
const keyboardWidthRef = (0, import_react21.useRef)(null);
|
|
47021
|
+
const [announcedWidth, setAnnouncedWidth] = (0, import_react21.useState)(null);
|
|
46866
47022
|
const bounds = resolveColumnResizeBounds(minWidth, maxWidth);
|
|
46867
47023
|
const cssVar = columnResizeCssVar(columnId2);
|
|
46868
|
-
const readWidth = (0,
|
|
47024
|
+
const readWidth = (0, import_react21.useCallback)(() => {
|
|
46869
47025
|
const header = handleRef.current?.closest("th");
|
|
46870
47026
|
const measured = header?.getBoundingClientRect().width ?? 0;
|
|
46871
47027
|
const computed = header ? Number.parseFloat(getComputedStyle(header).width) : 0;
|
|
46872
47028
|
return clampColumnWidth(measured || computed || keyboardWidthRef.current || bounds.minWidth, bounds);
|
|
46873
47029
|
}, [bounds]);
|
|
46874
|
-
const writePreview = (0,
|
|
47030
|
+
const writePreview = (0, import_react21.useCallback)((width) => {
|
|
46875
47031
|
tableRef.current?.style.setProperty(cssVar, `${width}px`);
|
|
46876
47032
|
}, [cssVar, tableRef]);
|
|
46877
|
-
const queuePreview = (0,
|
|
47033
|
+
const queuePreview = (0, import_react21.useCallback)((width) => {
|
|
46878
47034
|
queuedWidthRef.current = width;
|
|
46879
47035
|
if (previewRafRef.current !== null) return;
|
|
46880
47036
|
previewRafRef.current = requestAnimationFrame(() => {
|
|
@@ -46884,12 +47040,12 @@ function ColumnResizeHandle({
|
|
|
46884
47040
|
if (nextWidth !== null) writePreview(nextWidth);
|
|
46885
47041
|
});
|
|
46886
47042
|
}, [writePreview]);
|
|
46887
|
-
const clearQueuedPreview = (0,
|
|
47043
|
+
const clearQueuedPreview = (0, import_react21.useCallback)(() => {
|
|
46888
47044
|
if (previewRafRef.current !== null) cancelAnimationFrame(previewRafRef.current);
|
|
46889
47045
|
previewRafRef.current = null;
|
|
46890
47046
|
queuedWidthRef.current = null;
|
|
46891
47047
|
}, []);
|
|
46892
|
-
const finishPointerResize = (0,
|
|
47048
|
+
const finishPointerResize = (0, import_react21.useCallback)((commit) => {
|
|
46893
47049
|
const active = activeResizeRef.current;
|
|
46894
47050
|
if (!active) return;
|
|
46895
47051
|
activeResizeRef.current = null;
|
|
@@ -46909,7 +47065,7 @@ function ColumnResizeHandle({
|
|
|
46909
47065
|
handleRef.current.releasePointerCapture(active.pointerId);
|
|
46910
47066
|
}
|
|
46911
47067
|
}, [clearQueuedPreview, columnId2, cssVar, onResizeCancel, onResizeCommit, tableRef, writePreview]);
|
|
46912
|
-
(0,
|
|
47068
|
+
(0, import_react21.useEffect)(() => () => clearQueuedPreview(), [clearQueuedPreview]);
|
|
46913
47069
|
const onPointerDown = (event) => {
|
|
46914
47070
|
if (disabled || event.button !== 0 || !event.isPrimary) return;
|
|
46915
47071
|
event.preventDefault();
|
|
@@ -47274,7 +47430,7 @@ function groupSummary(group, rowNoun = "row") {
|
|
|
47274
47430
|
}
|
|
47275
47431
|
|
|
47276
47432
|
// src/data-table/useSpreadsheetGrid.ts
|
|
47277
|
-
var
|
|
47433
|
+
var import_react22 = require("react");
|
|
47278
47434
|
|
|
47279
47435
|
// src/data-table/grid-selection.ts
|
|
47280
47436
|
function rangeBounds(range, rowIds, fieldNames) {
|
|
@@ -48002,41 +48158,41 @@ var LAYERS_THE_GRID_OPENS = `[data-radix-popper-content-wrapper], [data-radix-po
|
|
|
48002
48158
|
var OPEN_LAYERS = `[role="menu"], [role="dialog"], [role="alertdialog"], [role="listbox"]`;
|
|
48003
48159
|
var READ_ONLY_REASON = "This table is view-only \u2014 you can select and copy, but not change cells.";
|
|
48004
48160
|
function useSpreadsheetGrid(options) {
|
|
48005
|
-
const [range, setRange] = (0,
|
|
48006
|
-
const [fillTarget, setFillTarget] = (0,
|
|
48007
|
-
const [stack, setStack] = (0,
|
|
48008
|
-
const draggingRef = (0,
|
|
48009
|
-
const catcherRef = (0,
|
|
48010
|
-
const composingRef = (0,
|
|
48011
|
-
const optionsRef = (0,
|
|
48161
|
+
const [range, setRange] = (0, import_react22.useState)(null);
|
|
48162
|
+
const [fillTarget, setFillTarget] = (0, import_react22.useState)(null);
|
|
48163
|
+
const [stack, setStack] = (0, import_react22.useState)(() => createUndoStack(options?.undoDepth ?? 100));
|
|
48164
|
+
const draggingRef = (0, import_react22.useRef)(null);
|
|
48165
|
+
const catcherRef = (0, import_react22.useRef)(null);
|
|
48166
|
+
const composingRef = (0, import_react22.useRef)(false);
|
|
48167
|
+
const optionsRef = (0, import_react22.useRef)(options);
|
|
48012
48168
|
optionsRef.current = options;
|
|
48013
48169
|
const rowIds = options?.rowIds ?? [];
|
|
48014
|
-
const columnIds = (0,
|
|
48170
|
+
const columnIds = (0, import_react22.useMemo)(
|
|
48015
48171
|
() => options ? options.columnIds.filter((id) => id !== "") : [],
|
|
48016
48172
|
[options]
|
|
48017
48173
|
);
|
|
48018
|
-
(0,
|
|
48174
|
+
(0, import_react22.useEffect)(() => {
|
|
48019
48175
|
if (!range) return;
|
|
48020
48176
|
const rowSet = new Set(rowIds);
|
|
48021
48177
|
const colSet = new Set(columnIds);
|
|
48022
48178
|
const alive = rowSet.has(range.anchor.rowId) && rowSet.has(range.focus.rowId) && colSet.has(range.anchor.fieldName) && colSet.has(range.focus.fieldName);
|
|
48023
48179
|
if (!alive) setRange(null);
|
|
48024
48180
|
}, [range, rowIds, columnIds]);
|
|
48025
|
-
const bounds = (0,
|
|
48181
|
+
const bounds = (0, import_react22.useMemo)(
|
|
48026
48182
|
() => range ? rangeBounds(range, rowIds, columnIds) : null,
|
|
48027
48183
|
[range, rowIds, columnIds]
|
|
48028
48184
|
);
|
|
48029
|
-
const rowIndexById = (0,
|
|
48185
|
+
const rowIndexById = (0, import_react22.useMemo)(() => {
|
|
48030
48186
|
const map = /* @__PURE__ */ new Map();
|
|
48031
48187
|
for (let i = 0; i < rowIds.length; i += 1) map.set(rowIds[i], i);
|
|
48032
48188
|
return map;
|
|
48033
48189
|
}, [rowIds]);
|
|
48034
|
-
const columnIndexById = (0,
|
|
48190
|
+
const columnIndexById = (0, import_react22.useMemo)(() => {
|
|
48035
48191
|
const map = /* @__PURE__ */ new Map();
|
|
48036
48192
|
for (let i = 0; i < columnIds.length; i += 1) map.set(columnIds[i], i);
|
|
48037
48193
|
return map;
|
|
48038
48194
|
}, [columnIds]);
|
|
48039
|
-
const screenPatches = (0,
|
|
48195
|
+
const screenPatches = (0, import_react22.useCallback)(
|
|
48040
48196
|
(patches) => {
|
|
48041
48197
|
const validate = optionsRef.current?.validateCell;
|
|
48042
48198
|
if (!validate) return { accepted: patches, refusals: [] };
|
|
@@ -48056,7 +48212,7 @@ function useSpreadsheetGrid(options) {
|
|
|
48056
48212
|
},
|
|
48057
48213
|
[]
|
|
48058
48214
|
);
|
|
48059
|
-
const applyPatches = (0,
|
|
48215
|
+
const applyPatches = (0, import_react22.useCallback)(
|
|
48060
48216
|
async (patches, intent, label) => {
|
|
48061
48217
|
const current = optionsRef.current;
|
|
48062
48218
|
if (!current || patches.length === 0) return;
|
|
@@ -48074,21 +48230,21 @@ function useSpreadsheetGrid(options) {
|
|
|
48074
48230
|
},
|
|
48075
48231
|
[]
|
|
48076
48232
|
);
|
|
48077
|
-
const refuseWrite = (0,
|
|
48233
|
+
const refuseWrite = (0, import_react22.useCallback)(() => {
|
|
48078
48234
|
const current = optionsRef.current;
|
|
48079
48235
|
if (!current) return true;
|
|
48080
48236
|
if (!current.readOnly && current.onPatch) return false;
|
|
48081
48237
|
current.notify?.(current.readOnlyReason ?? READ_ONLY_REASON);
|
|
48082
48238
|
return true;
|
|
48083
48239
|
}, []);
|
|
48084
|
-
const readValueAt = (0,
|
|
48240
|
+
const readValueAt = (0, import_react22.useCallback)((rowIndex, columnIndex) => {
|
|
48085
48241
|
const current = optionsRef.current;
|
|
48086
48242
|
const rowId = current?.rowIds[rowIndex];
|
|
48087
48243
|
const columnId2 = current?.columnIds[columnIndex];
|
|
48088
48244
|
if (!current || rowId === void 0 || columnId2 === void 0) return null;
|
|
48089
48245
|
return current.valueAt(rowId, columnId2);
|
|
48090
48246
|
}, []);
|
|
48091
|
-
const fillRequestBase = (0,
|
|
48247
|
+
const fillRequestBase = (0, import_react22.useCallback)(() => {
|
|
48092
48248
|
const current = optionsRef.current;
|
|
48093
48249
|
if (!current) return null;
|
|
48094
48250
|
return {
|
|
@@ -48098,7 +48254,7 @@ function useSpreadsheetGrid(options) {
|
|
|
48098
48254
|
isColumnWritable: current.isColumnWritable
|
|
48099
48255
|
};
|
|
48100
48256
|
}, [readValueAt]);
|
|
48101
|
-
const announceSkips = (0,
|
|
48257
|
+
const announceSkips = (0, import_react22.useCallback)(
|
|
48102
48258
|
(skipped, summary) => {
|
|
48103
48259
|
const current = optionsRef.current;
|
|
48104
48260
|
if (!current?.notify) return;
|
|
@@ -48113,7 +48269,7 @@ function useSpreadsheetGrid(options) {
|
|
|
48113
48269
|
},
|
|
48114
48270
|
[]
|
|
48115
48271
|
);
|
|
48116
|
-
const doFillDown = (0,
|
|
48272
|
+
const doFillDown = (0, import_react22.useCallback)(async () => {
|
|
48117
48273
|
if (refuseWrite()) return;
|
|
48118
48274
|
const base = fillRequestBase();
|
|
48119
48275
|
if (!base || !bounds) return;
|
|
@@ -48125,7 +48281,7 @@ function useSpreadsheetGrid(options) {
|
|
|
48125
48281
|
await applyPatches(screened.accepted, "fill-down", "Filled down");
|
|
48126
48282
|
announceSkips([...result.skipped, ...screened.refusals], result.summary);
|
|
48127
48283
|
}, [fillRequestBase, bounds, applyPatches, announceSkips, screenPatches, refuseWrite]);
|
|
48128
|
-
const doClear = (0,
|
|
48284
|
+
const doClear = (0, import_react22.useCallback)(async () => {
|
|
48129
48285
|
if (refuseWrite()) return;
|
|
48130
48286
|
const current = optionsRef.current;
|
|
48131
48287
|
if (!current || !bounds) return;
|
|
@@ -48154,7 +48310,7 @@ function useSpreadsheetGrid(options) {
|
|
|
48154
48310
|
`Cleared ${screened.accepted.length} cells.`
|
|
48155
48311
|
);
|
|
48156
48312
|
}, [bounds, applyPatches, announceSkips, screenPatches, refuseWrite]);
|
|
48157
|
-
const doUndo = (0,
|
|
48313
|
+
const doUndo = (0, import_react22.useCallback)(async () => {
|
|
48158
48314
|
if (refuseWrite()) return;
|
|
48159
48315
|
const taken = popUndo(stack);
|
|
48160
48316
|
if (!taken.entry) return;
|
|
@@ -48162,14 +48318,14 @@ function useSpreadsheetGrid(options) {
|
|
|
48162
48318
|
await applyPatches(taken.entry.undo, "undo", taken.entry.label);
|
|
48163
48319
|
optionsRef.current?.notify?.(taken.entry.label);
|
|
48164
48320
|
}, [stack, applyPatches, refuseWrite]);
|
|
48165
|
-
const doRedo = (0,
|
|
48321
|
+
const doRedo = (0, import_react22.useCallback)(async () => {
|
|
48166
48322
|
if (refuseWrite()) return;
|
|
48167
48323
|
const taken = popRedo(stack);
|
|
48168
48324
|
if (!taken.entry) return;
|
|
48169
48325
|
setStack(taken.stack);
|
|
48170
48326
|
await applyPatches(taken.entry.redo, "redo", taken.entry.label);
|
|
48171
48327
|
}, [stack, applyPatches, refuseWrite]);
|
|
48172
|
-
const move = (0,
|
|
48328
|
+
const move = (0, import_react22.useCallback)(
|
|
48173
48329
|
(direction, extend) => {
|
|
48174
48330
|
setRange((previous) => {
|
|
48175
48331
|
const from = previous ? extend ? previous.focus : previous.anchor : null;
|
|
@@ -48181,31 +48337,31 @@ function useSpreadsheetGrid(options) {
|
|
|
48181
48337
|
},
|
|
48182
48338
|
[rowIds, columnIds]
|
|
48183
48339
|
);
|
|
48184
|
-
const rowIdsRef = (0,
|
|
48340
|
+
const rowIdsRef = (0, import_react22.useRef)(rowIds);
|
|
48185
48341
|
rowIdsRef.current = rowIds;
|
|
48186
|
-
const columnIdsRef = (0,
|
|
48342
|
+
const columnIdsRef = (0, import_react22.useRef)(columnIds);
|
|
48187
48343
|
columnIdsRef.current = columnIds;
|
|
48188
|
-
const rangeRef = (0,
|
|
48344
|
+
const rangeRef = (0, import_react22.useRef)(range);
|
|
48189
48345
|
rangeRef.current = range;
|
|
48190
|
-
const focusGrid = (0,
|
|
48346
|
+
const focusGrid = (0, import_react22.useCallback)(() => {
|
|
48191
48347
|
const catcher = catcherRef.current;
|
|
48192
48348
|
if (catcher && catcher.isConnected) {
|
|
48193
48349
|
catcher.focus({ preventScroll: true });
|
|
48194
48350
|
return;
|
|
48195
48351
|
}
|
|
48196
48352
|
}, []);
|
|
48197
|
-
const focusIsLost = (0,
|
|
48353
|
+
const focusIsLost = (0, import_react22.useCallback)(() => {
|
|
48198
48354
|
if (typeof document === "undefined") return false;
|
|
48199
48355
|
const active = document.activeElement;
|
|
48200
48356
|
return !active || active === document.body || active === document.documentElement || !active.isConnected;
|
|
48201
48357
|
}, []);
|
|
48202
|
-
const focusIsLostOrOurs = (0,
|
|
48358
|
+
const focusIsLostOrOurs = (0, import_react22.useCallback)(() => {
|
|
48203
48359
|
if (focusIsLost()) return true;
|
|
48204
48360
|
const container = catcherRef.current?.closest('[data-matrx-table-spreadsheet="true"]');
|
|
48205
48361
|
const active = typeof document === "undefined" ? null : document.activeElement;
|
|
48206
48362
|
return Boolean(container && active && container.contains(active));
|
|
48207
48363
|
}, [focusIsLost]);
|
|
48208
|
-
const endEdit = (0,
|
|
48364
|
+
const endEdit = (0, import_react22.useCallback)(
|
|
48209
48365
|
(exit = "stay", from = null, how = "keyboard") => {
|
|
48210
48366
|
const move2 = exit === "down" ? "down" : exit === "up" ? "up" : exit === "right" ? "nextCell" : exit === "left" ? "prevCell" : null;
|
|
48211
48367
|
const at2 = from ? { rowId: from.rowId, fieldName: from.columnId } : null;
|
|
@@ -48228,7 +48384,7 @@ function useSpreadsheetGrid(options) {
|
|
|
48228
48384
|
},
|
|
48229
48385
|
[focusGrid, focusIsLost, focusIsLostOrOurs]
|
|
48230
48386
|
);
|
|
48231
|
-
const select = (0,
|
|
48387
|
+
const select = (0, import_react22.useCallback)(
|
|
48232
48388
|
(anchor, focus) => {
|
|
48233
48389
|
const a = { rowId: anchor.rowId, fieldName: anchor.columnId };
|
|
48234
48390
|
const f = focus ? { rowId: focus.rowId, fieldName: focus.columnId } : a;
|
|
@@ -48236,7 +48392,7 @@ function useSpreadsheetGrid(options) {
|
|
|
48236
48392
|
},
|
|
48237
48393
|
[]
|
|
48238
48394
|
);
|
|
48239
|
-
const onKeyDownCapture = (0,
|
|
48395
|
+
const onKeyDownCapture = (0, import_react22.useCallback)(
|
|
48240
48396
|
(event) => {
|
|
48241
48397
|
const key = event.key;
|
|
48242
48398
|
if (key !== "Enter" && key !== "Tab" && key !== "Escape") return;
|
|
@@ -48255,7 +48411,7 @@ function useSpreadsheetGrid(options) {
|
|
|
48255
48411
|
[endEdit, focusIsLost]
|
|
48256
48412
|
);
|
|
48257
48413
|
const holdsARange = range !== null;
|
|
48258
|
-
(0,
|
|
48414
|
+
(0, import_react22.useEffect)(() => {
|
|
48259
48415
|
if (!holdsARange || typeof document === "undefined") return;
|
|
48260
48416
|
const onPointerDown = (event) => {
|
|
48261
48417
|
const target = event.target instanceof Element ? event.target : null;
|
|
@@ -48271,7 +48427,7 @@ function useSpreadsheetGrid(options) {
|
|
|
48271
48427
|
document.addEventListener("pointerdown", onPointerDown, true);
|
|
48272
48428
|
return () => document.removeEventListener("pointerdown", onPointerDown, true);
|
|
48273
48429
|
}, [holdsARange]);
|
|
48274
|
-
(0,
|
|
48430
|
+
(0, import_react22.useEffect)(() => {
|
|
48275
48431
|
if (!holdsARange || typeof document === "undefined" || typeof MutationObserver === "undefined") return;
|
|
48276
48432
|
const timers = [];
|
|
48277
48433
|
const lookAgain = () => {
|
|
@@ -48297,8 +48453,8 @@ function useSpreadsheetGrid(options) {
|
|
|
48297
48453
|
for (const t of timers) clearTimeout(t);
|
|
48298
48454
|
};
|
|
48299
48455
|
}, [holdsARange, focusGrid, focusIsLost]);
|
|
48300
|
-
const controller = (0,
|
|
48301
|
-
const onKeyDown = (0,
|
|
48456
|
+
const controller = (0, import_react22.useMemo)(() => ({ endEdit, select, focusGrid }), [endEdit, select, focusGrid]);
|
|
48457
|
+
const onKeyDown = (0, import_react22.useCallback)(
|
|
48302
48458
|
(event) => {
|
|
48303
48459
|
const current = optionsRef.current;
|
|
48304
48460
|
if (!current) return;
|
|
@@ -48382,7 +48538,7 @@ function useSpreadsheetGrid(options) {
|
|
|
48382
48538
|
},
|
|
48383
48539
|
[move, range, rowIds, columnIds, doClear, doFillDown, doUndo, doRedo]
|
|
48384
48540
|
);
|
|
48385
|
-
const selectionAsTsv = (0,
|
|
48541
|
+
const selectionAsTsv = (0, import_react22.useCallback)(() => {
|
|
48386
48542
|
const current = optionsRef.current;
|
|
48387
48543
|
if (!current || !range) return "";
|
|
48388
48544
|
const grid = rangeRows(range, rowIds, columnIds).map(
|
|
@@ -48390,14 +48546,14 @@ function useSpreadsheetGrid(options) {
|
|
|
48390
48546
|
);
|
|
48391
48547
|
return gridToTsv(grid);
|
|
48392
48548
|
}, [range, rowIds, columnIds]);
|
|
48393
|
-
const selectionAddresses = (0,
|
|
48549
|
+
const selectionAddresses = (0, import_react22.useCallback)(() => {
|
|
48394
48550
|
if (!range || !bounds) return { rowIds: [], columnIds: [] };
|
|
48395
48551
|
return {
|
|
48396
48552
|
rowIds: rowIds.slice(bounds.r0, bounds.r1 + 1),
|
|
48397
48553
|
columnIds: columnIds.slice(bounds.c0, bounds.c1 + 1)
|
|
48398
48554
|
};
|
|
48399
48555
|
}, [range, bounds, rowIds, columnIds]);
|
|
48400
|
-
const onCopy = (0,
|
|
48556
|
+
const onCopy = (0, import_react22.useCallback)(
|
|
48401
48557
|
(event) => {
|
|
48402
48558
|
if (!optionsRef.current || !range || targetsAnEditor(event.target)) return;
|
|
48403
48559
|
if (camePastAPortalIntoTheContainer(event.target)) return;
|
|
@@ -48411,7 +48567,7 @@ function useSpreadsheetGrid(options) {
|
|
|
48411
48567
|
},
|
|
48412
48568
|
[range, selectionAsTsv, selectionAddresses]
|
|
48413
48569
|
);
|
|
48414
|
-
const onCut = (0,
|
|
48570
|
+
const onCut = (0, import_react22.useCallback)(
|
|
48415
48571
|
(event) => {
|
|
48416
48572
|
if (!optionsRef.current || !range || targetsAnEditor(event.target)) return;
|
|
48417
48573
|
if (camePastAPortalIntoTheContainer(event.target)) return;
|
|
@@ -48423,7 +48579,7 @@ function useSpreadsheetGrid(options) {
|
|
|
48423
48579
|
},
|
|
48424
48580
|
[range, selectionAsTsv, doClear]
|
|
48425
48581
|
);
|
|
48426
|
-
const onPaste = (0,
|
|
48582
|
+
const onPaste = (0, import_react22.useCallback)(
|
|
48427
48583
|
(event) => {
|
|
48428
48584
|
const current = optionsRef.current;
|
|
48429
48585
|
if (!current || current.paste === false || !range || targetsAnEditor(event.target)) return;
|
|
@@ -48520,7 +48676,7 @@ function useSpreadsheetGrid(options) {
|
|
|
48520
48676
|
},
|
|
48521
48677
|
[range, bounds, rowIds, columnIds, applyPatches, announceSkips, screenPatches, refuseWrite]
|
|
48522
48678
|
);
|
|
48523
|
-
const cellProps = (0,
|
|
48679
|
+
const cellProps = (0, import_react22.useCallback)(
|
|
48524
48680
|
(rowId, columnId2) => {
|
|
48525
48681
|
const address = { rowId, fieldName: columnId2 };
|
|
48526
48682
|
const rowIndex = rowIndexById.get(rowId) ?? -1;
|
|
@@ -48569,7 +48725,7 @@ function useSpreadsheetGrid(options) {
|
|
|
48569
48725
|
},
|
|
48570
48726
|
[rowIndexById, columnIndexById, bounds, range, fillTarget]
|
|
48571
48727
|
);
|
|
48572
|
-
const isFillHandleCell = (0,
|
|
48728
|
+
const isFillHandleCell = (0, import_react22.useCallback)(
|
|
48573
48729
|
(rowId, columnId2) => {
|
|
48574
48730
|
const current = optionsRef.current;
|
|
48575
48731
|
if (!current || current.fillHandle === false || current.readOnly || !bounds) return false;
|
|
@@ -48577,7 +48733,7 @@ function useSpreadsheetGrid(options) {
|
|
|
48577
48733
|
},
|
|
48578
48734
|
[bounds, rowIds, columnIds]
|
|
48579
48735
|
);
|
|
48580
|
-
const startFillDrag = (0,
|
|
48736
|
+
const startFillDrag = (0, import_react22.useCallback)(
|
|
48581
48737
|
(event) => {
|
|
48582
48738
|
event.preventDefault();
|
|
48583
48739
|
event.stopPropagation();
|
|
@@ -48585,11 +48741,11 @@ function useSpreadsheetGrid(options) {
|
|
|
48585
48741
|
},
|
|
48586
48742
|
[]
|
|
48587
48743
|
);
|
|
48588
|
-
const fillTargetRef = (0,
|
|
48744
|
+
const fillTargetRef = (0, import_react22.useRef)(null);
|
|
48589
48745
|
fillTargetRef.current = fillTarget;
|
|
48590
|
-
const boundsRef = (0,
|
|
48746
|
+
const boundsRef = (0, import_react22.useRef)(null);
|
|
48591
48747
|
boundsRef.current = bounds;
|
|
48592
|
-
(0,
|
|
48748
|
+
(0, import_react22.useEffect)(() => {
|
|
48593
48749
|
if (!options) return;
|
|
48594
48750
|
const commit = () => {
|
|
48595
48751
|
const wasDragging = draggingRef.current;
|
|
@@ -48614,7 +48770,7 @@ function useSpreadsheetGrid(options) {
|
|
|
48614
48770
|
window.addEventListener("mouseup", commit);
|
|
48615
48771
|
return () => window.removeEventListener("mouseup", commit);
|
|
48616
48772
|
}, [options, fillRequestBase, applyPatches, announceSkips, screenPatches, refuseWrite]);
|
|
48617
|
-
const takeTypedText = (0,
|
|
48773
|
+
const takeTypedText = (0, import_react22.useCallback)(
|
|
48618
48774
|
(text) => {
|
|
48619
48775
|
if (catcherRef.current) catcherRef.current.value = "";
|
|
48620
48776
|
const current = optionsRef.current;
|
|
@@ -48685,7 +48841,7 @@ function useSpreadsheetGrid(options) {
|
|
|
48685
48841
|
}
|
|
48686
48842
|
|
|
48687
48843
|
// src/data-table/ToolbarOverflow.tsx
|
|
48688
|
-
var
|
|
48844
|
+
var import_react23 = require("react");
|
|
48689
48845
|
|
|
48690
48846
|
// src/bottom-sheet.tsx
|
|
48691
48847
|
var import_react_visually_hidden = require("@radix-ui/react-visually-hidden");
|
|
@@ -48925,13 +49081,13 @@ function BottomSheet({
|
|
|
48925
49081
|
// src/data-table/ToolbarOverflow.tsx
|
|
48926
49082
|
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
48927
49083
|
var TOOLBAR_CONTROL_HEIGHT = "h-8";
|
|
48928
|
-
var ListedContext = (0,
|
|
49084
|
+
var ListedContext = (0, import_react23.createContext)(false);
|
|
48929
49085
|
function useToolbarListed() {
|
|
48930
|
-
return (0,
|
|
49086
|
+
return (0, import_react23.useContext)(ListedContext);
|
|
48931
49087
|
}
|
|
48932
49088
|
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";
|
|
48933
49089
|
function ToolbarOverflowMenu({ children, label = "More tools" }) {
|
|
48934
|
-
const [open, setOpen] = (0,
|
|
49090
|
+
const [open, setOpen] = (0, import_react23.useState)(false);
|
|
48935
49091
|
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(Popover, { open, onOpenChange: setOpen, children: [
|
|
48936
49092
|
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
48937
49093
|
Button,
|
|
@@ -48959,7 +49115,7 @@ function ToolbarOverflowSheet({
|
|
|
48959
49115
|
title = "Table tools",
|
|
48960
49116
|
top
|
|
48961
49117
|
}) {
|
|
48962
|
-
const [open, setOpen] = (0,
|
|
49118
|
+
const [open, setOpen] = (0, import_react23.useState)(false);
|
|
48963
49119
|
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_jsx_runtime50.Fragment, { children: [
|
|
48964
49120
|
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
48965
49121
|
Button,
|
|
@@ -49004,16 +49160,16 @@ function ToolbarListedLabel({ label, children }) {
|
|
|
49004
49160
|
}
|
|
49005
49161
|
|
|
49006
49162
|
// src/data-table/pinned-fold.ts
|
|
49007
|
-
var
|
|
49163
|
+
var import_react24 = require("react");
|
|
49008
49164
|
function pinnedMustFold(room, full) {
|
|
49009
49165
|
if (room <= 0 || full === null) return false;
|
|
49010
49166
|
return full > room + 0.5;
|
|
49011
49167
|
}
|
|
49012
49168
|
function usePinnedFold(el, active) {
|
|
49013
|
-
const [folded, setFolded] = (0,
|
|
49014
|
-
const full = (0,
|
|
49015
|
-
const current = (0,
|
|
49016
|
-
(0,
|
|
49169
|
+
const [folded, setFolded] = (0, import_react24.useState)(false);
|
|
49170
|
+
const full = (0, import_react24.useRef)(null);
|
|
49171
|
+
const current = (0, import_react24.useRef)(false);
|
|
49172
|
+
(0, import_react24.useEffect)(() => {
|
|
49017
49173
|
if (!active || !el) {
|
|
49018
49174
|
if (current.current) {
|
|
49019
49175
|
current.current = false;
|
|
@@ -49200,7 +49356,7 @@ function rankTableSearchRows(rows, columns, query, options = {}, extraText) {
|
|
|
49200
49356
|
}
|
|
49201
49357
|
|
|
49202
49358
|
// src/data-table/ColumnManager.tsx
|
|
49203
|
-
var
|
|
49359
|
+
var import_react25 = require("react");
|
|
49204
49360
|
var import_core2 = require("@dnd-kit/core");
|
|
49205
49361
|
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
49206
49362
|
function ColumnManager({
|
|
@@ -49211,15 +49367,15 @@ function ColumnManager({
|
|
|
49211
49367
|
hidden,
|
|
49212
49368
|
onApply
|
|
49213
49369
|
}) {
|
|
49214
|
-
const byId = (0,
|
|
49370
|
+
const byId = (0, import_react25.useMemo)(
|
|
49215
49371
|
() => new Map(columns.map((column) => [columnId(column), column])),
|
|
49216
49372
|
[columns]
|
|
49217
49373
|
);
|
|
49218
|
-
const [draftOrder, setDraftOrder] = (0,
|
|
49219
|
-
const [draftHidden, setDraftHidden] = (0,
|
|
49220
|
-
const [draggedColumnId, setDraggedColumnId] = (0,
|
|
49221
|
-
const [dropTarget, setDropTarget] = (0,
|
|
49222
|
-
(0,
|
|
49374
|
+
const [draftOrder, setDraftOrder] = (0, import_react25.useState)(order);
|
|
49375
|
+
const [draftHidden, setDraftHidden] = (0, import_react25.useState)(() => new Set(hidden));
|
|
49376
|
+
const [draggedColumnId, setDraggedColumnId] = (0, import_react25.useState)(null);
|
|
49377
|
+
const [dropTarget, setDropTarget] = (0, import_react25.useState)(null);
|
|
49378
|
+
(0, import_react25.useEffect)(() => {
|
|
49223
49379
|
if (!open) return;
|
|
49224
49380
|
setDraftOrder(order);
|
|
49225
49381
|
setDraftHidden(new Set(hidden));
|
|
@@ -49761,7 +49917,7 @@ function parseTableViewSnapshot(raw) {
|
|
|
49761
49917
|
}
|
|
49762
49918
|
|
|
49763
49919
|
// src/data-table/MatrxUuidCell.tsx
|
|
49764
|
-
var
|
|
49920
|
+
var import_react26 = require("react");
|
|
49765
49921
|
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
49766
49922
|
var SHORT_LEN = 8;
|
|
49767
49923
|
function shortUuid(id, len = SHORT_LEN) {
|
|
@@ -49801,11 +49957,11 @@ function MatrxUuidCell({
|
|
|
49801
49957
|
}) {
|
|
49802
49958
|
const { resolveEntityDoors, ResourcePeek } = useMatrxDataTableHost();
|
|
49803
49959
|
const { notify, notice } = useTableNotice();
|
|
49804
|
-
const [copied, setCopied] = (0,
|
|
49805
|
-
const [opening, setOpening] = (0,
|
|
49806
|
-
const [peekOpen, setPeekOpen] = (0,
|
|
49807
|
-
const timer = (0,
|
|
49808
|
-
(0,
|
|
49960
|
+
const [copied, setCopied] = (0, import_react26.useState)(false);
|
|
49961
|
+
const [opening, setOpening] = (0, import_react26.useState)(false);
|
|
49962
|
+
const [peekOpen, setPeekOpen] = (0, import_react26.useState)(false);
|
|
49963
|
+
const timer = (0, import_react26.useRef)(null);
|
|
49964
|
+
(0, import_react26.useEffect)(
|
|
49809
49965
|
() => () => {
|
|
49810
49966
|
if (timer.current) clearTimeout(timer.current);
|
|
49811
49967
|
},
|
|
@@ -50015,7 +50171,7 @@ function formatValue2(value) {
|
|
|
50015
50171
|
return String(value);
|
|
50016
50172
|
}
|
|
50017
50173
|
}
|
|
50018
|
-
function
|
|
50174
|
+
function isPlainObject2(value) {
|
|
50019
50175
|
return typeof value === "object" && value !== null && !Array.isArray(value) && !(value instanceof Date);
|
|
50020
50176
|
}
|
|
50021
50177
|
function DataRowInspector({
|
|
@@ -50028,7 +50184,7 @@ function DataRowInspector({
|
|
|
50028
50184
|
location,
|
|
50029
50185
|
tokenForField = noFieldToken
|
|
50030
50186
|
}) {
|
|
50031
|
-
const entries =
|
|
50187
|
+
const entries = isPlainObject2(row) ? Object.entries(row) : [["value", row]];
|
|
50032
50188
|
const fieldButtons = (key, value) => fieldCopy ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "absolute right-1 top-1 opacity-0 transition-opacity focus-within:opacity-100 group-hover/field:opacity-100", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
50033
50189
|
CopyButtons,
|
|
50034
50190
|
{
|
|
@@ -50101,7 +50257,7 @@ function DataRowInspector({
|
|
|
50101
50257
|
}
|
|
50102
50258
|
|
|
50103
50259
|
// src/data-table/DataRowWindow.tsx
|
|
50104
|
-
var
|
|
50260
|
+
var import_react27 = require("react");
|
|
50105
50261
|
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
50106
50262
|
function DataRowWindow({
|
|
50107
50263
|
isOpen,
|
|
@@ -50122,8 +50278,8 @@ function DataRowWindow({
|
|
|
50122
50278
|
const hasEdit = editContent != null;
|
|
50123
50279
|
const hasTabs = hasEdit && children == null;
|
|
50124
50280
|
const initialTab = defaultTab ?? (hasEdit ? "edit" : "view");
|
|
50125
|
-
const [tab, setTab] = (0,
|
|
50126
|
-
(0,
|
|
50281
|
+
const [tab, setTab] = (0, import_react27.useState)(initialTab);
|
|
50282
|
+
(0, import_react27.useEffect)(() => {
|
|
50127
50283
|
if (!isOpen) return;
|
|
50128
50284
|
setTab(defaultTab ?? (hasEdit ? "edit" : "view"));
|
|
50129
50285
|
}, [isOpen, windowId, hasEdit, defaultTab]);
|
|
@@ -51364,7 +51520,7 @@ function DirtySavePill({
|
|
|
51364
51520
|
}
|
|
51365
51521
|
|
|
51366
51522
|
// src/data-table/EditableTableCell.tsx
|
|
51367
|
-
var
|
|
51523
|
+
var import_react28 = require("react");
|
|
51368
51524
|
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
51369
51525
|
function CellRefusal({ reason }) {
|
|
51370
51526
|
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
@@ -51426,12 +51582,12 @@ function EditableTableCell({
|
|
|
51426
51582
|
editRequest,
|
|
51427
51583
|
editSeed
|
|
51428
51584
|
}) {
|
|
51429
|
-
const [open, setOpen] = (0,
|
|
51430
|
-
const [refusal, setRefusal] = (0,
|
|
51431
|
-
(0,
|
|
51585
|
+
const [open, setOpen] = (0, import_react28.useState)(false);
|
|
51586
|
+
const [refusal, setRefusal] = (0, import_react28.useState)(null);
|
|
51587
|
+
(0, import_react28.useEffect)(() => {
|
|
51432
51588
|
if (editRequest !== void 0) setOpen(true);
|
|
51433
51589
|
}, [editRequest]);
|
|
51434
|
-
(0,
|
|
51590
|
+
(0, import_react28.useEffect)(() => {
|
|
51435
51591
|
if (!open) setRefusal(null);
|
|
51436
51592
|
}, [open]);
|
|
51437
51593
|
const usePencil = Boolean(href) || editTrigger === "pencil";
|
|
@@ -51535,13 +51691,13 @@ function InlineStringEditor({
|
|
|
51535
51691
|
editRequest,
|
|
51536
51692
|
editSeed
|
|
51537
51693
|
}) {
|
|
51538
|
-
const [editing, setEditing] = (0,
|
|
51539
|
-
const [draft, setDraft] = (0,
|
|
51540
|
-
const [refusal, setRefusal] = (0,
|
|
51541
|
-
const handledEditRequest = (0,
|
|
51542
|
-
const seedRef = (0,
|
|
51694
|
+
const [editing, setEditing] = (0, import_react28.useState)(false);
|
|
51695
|
+
const [draft, setDraft] = (0, import_react28.useState)(value);
|
|
51696
|
+
const [refusal, setRefusal] = (0, import_react28.useState)(null);
|
|
51697
|
+
const handledEditRequest = (0, import_react28.useRef)(void 0);
|
|
51698
|
+
const seedRef = (0, import_react28.useRef)(editSeed);
|
|
51543
51699
|
seedRef.current = editSeed;
|
|
51544
|
-
(0,
|
|
51700
|
+
(0, import_react28.useEffect)(() => {
|
|
51545
51701
|
if (editRequest === void 0 || handledEditRequest.current === editRequest) return;
|
|
51546
51702
|
handledEditRequest.current = editRequest;
|
|
51547
51703
|
setDraft(seedRef.current ?? value);
|
|
@@ -51701,8 +51857,8 @@ function DateEditor({
|
|
|
51701
51857
|
onCommit,
|
|
51702
51858
|
onCancel
|
|
51703
51859
|
}) {
|
|
51704
|
-
const [draft, setDraft] = (0,
|
|
51705
|
-
const done = (0,
|
|
51860
|
+
const [draft, setDraft] = (0, import_react28.useState)(value);
|
|
51861
|
+
const done = (0, import_react28.useRef)(false);
|
|
51706
51862
|
const finish = () => {
|
|
51707
51863
|
if (done.current) return;
|
|
51708
51864
|
done.current = true;
|
|
@@ -51737,8 +51893,8 @@ function TagsEditor({
|
|
|
51737
51893
|
onCommit,
|
|
51738
51894
|
onCancel
|
|
51739
51895
|
}) {
|
|
51740
|
-
const [tags, setTags] = (0,
|
|
51741
|
-
const [draft, setDraft] = (0,
|
|
51896
|
+
const [tags, setTags] = (0, import_react28.useState)(value);
|
|
51897
|
+
const [draft, setDraft] = (0, import_react28.useState)("");
|
|
51742
51898
|
const add = (raw) => {
|
|
51743
51899
|
const next = raw.trim();
|
|
51744
51900
|
if (!next || tags.includes(next)) return;
|
|
@@ -51835,7 +51991,7 @@ function NumberEditor({
|
|
|
51835
51991
|
onCommit,
|
|
51836
51992
|
onCancel
|
|
51837
51993
|
}) {
|
|
51838
|
-
const [draft, setDraft] = (0,
|
|
51994
|
+
const [draft, setDraft] = (0, import_react28.useState)(String(value));
|
|
51839
51995
|
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
51840
51996
|
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
51841
51997
|
Input,
|
|
@@ -52264,7 +52420,7 @@ function TableToolbarAction({
|
|
|
52264
52420
|
disabled,
|
|
52265
52421
|
onClick,
|
|
52266
52422
|
children: [
|
|
52267
|
-
(0,
|
|
52423
|
+
(0, import_react29.isValidElement)(children) ? (0, import_react29.cloneElement)(children, { className: cn("h-4 w-4", children.props.className) }) : children,
|
|
52268
52424
|
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { children: ariaLabel })
|
|
52269
52425
|
]
|
|
52270
52426
|
}
|
|
@@ -52286,7 +52442,7 @@ function TableToolbarAction({
|
|
|
52286
52442
|
"aria-busy": busy || void 0,
|
|
52287
52443
|
disabled,
|
|
52288
52444
|
onClick,
|
|
52289
|
-
children: (0,
|
|
52445
|
+
children: (0, import_react29.isValidElement)(children) ? (0, import_react29.cloneElement)(children, { className: cn("h-5 w-5", children.props.className) }) : children
|
|
52290
52446
|
}
|
|
52291
52447
|
) }) }),
|
|
52292
52448
|
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(TooltipContent, { children: tooltip ?? ariaLabel })
|
|
@@ -52315,9 +52471,10 @@ function tableRowCopyProps(copy, row, sourceId, defaultColumns) {
|
|
|
52315
52471
|
label: copy.label,
|
|
52316
52472
|
...copy.rowReferences ? { references: copy.rowReferences(row) } : {},
|
|
52317
52473
|
...copy.triggerVariant ? { triggerVariant: copy.triggerVariant } : {},
|
|
52318
|
-
|
|
52319
|
-
|
|
52320
|
-
|
|
52474
|
+
// Run on a copy, never while the menu renders: a row may keep a trampoline to them.
|
|
52475
|
+
human: lazyCallback(() => copy.humanRow(row)),
|
|
52476
|
+
json: lazyCallback(() => copy.agentRow ? copy.agentRow(row) : row),
|
|
52477
|
+
agent: lazyCallback(() => defaultColumns ? buildDefaultTableRowAgentInput(copy, row, defaultColumns()) : buildRowAgentInput(copy, row)),
|
|
52321
52478
|
...aiVariants === void 0 ? {} : { aiVariants }
|
|
52322
52479
|
};
|
|
52323
52480
|
}
|
|
@@ -52343,7 +52500,7 @@ function MatrxDataTable(suppliedProps) {
|
|
|
52343
52500
|
const props = card ? withTableCardDefaults(suppliedProps, card) : suppliedProps;
|
|
52344
52501
|
const sourceRows = props.query?.mode === "controlled-append" ? props.query.pagination.rows : props.data;
|
|
52345
52502
|
const availableRows = sourceRows ?? EMPTY_TABLE_ROWS;
|
|
52346
|
-
const [defaultSelectionState, setDefaultSelectionState] = (0,
|
|
52503
|
+
const [defaultSelectionState, setDefaultSelectionState] = (0, import_react29.useState)({
|
|
52347
52504
|
sourceRows: availableRows,
|
|
52348
52505
|
selectedIds: []
|
|
52349
52506
|
});
|
|
@@ -52381,7 +52538,7 @@ function useHostCustomFieldColumns(token, rows) {
|
|
|
52381
52538
|
const host = useMatrxDataTableHost();
|
|
52382
52539
|
const useColumns = host.useCustomFieldColumns ?? noCustomFieldColumns;
|
|
52383
52540
|
const orgKey = token ? rowOrganizationIds(rows).join(",") : "";
|
|
52384
|
-
const organizationIds = (0,
|
|
52541
|
+
const organizationIds = (0, import_react29.useMemo)(() => orgKey ? orgKey.split(",") : [], [orgKey]);
|
|
52385
52542
|
const answer = useColumns(token, organizationIds);
|
|
52386
52543
|
return answer?.columns ?? NO_CUSTOM_FIELD_COLUMNS;
|
|
52387
52544
|
}
|
|
@@ -52401,7 +52558,7 @@ function MatrxDataTableWithUrlState({
|
|
|
52401
52558
|
...urlState.history === void 0 ? {} : { history: urlState.history },
|
|
52402
52559
|
...urlState.textHistory === void 0 ? {} : { textHistory: urlState.textHistory }
|
|
52403
52560
|
});
|
|
52404
|
-
(0,
|
|
52561
|
+
(0, import_react29.useEffect)(() => {
|
|
52405
52562
|
if (activeUrlTableIds.has(urlState.id)) {
|
|
52406
52563
|
throw new Error(
|
|
52407
52564
|
`Duplicate MatrxDataTable urlState.id "${urlState.id}" on one page. Give every table a unique stable id.`
|
|
@@ -52510,7 +52667,7 @@ var DND_MEASURING = { droppable: { strategy: import_core3.MeasuringStrategy.Alwa
|
|
|
52510
52667
|
var NO_LAYERED_FILTERS = [];
|
|
52511
52668
|
var NO_GROUPING_VALUE = "__matrx_no_grouping__";
|
|
52512
52669
|
function useRenderEpoch(values) {
|
|
52513
|
-
const held = (0,
|
|
52670
|
+
const held = (0, import_react29.useRef)(null);
|
|
52514
52671
|
const previous = held.current;
|
|
52515
52672
|
if (previous !== null && previous.values.length === values.length && previous.values.every((value, i) => Object.is(value, values[i]))) {
|
|
52516
52673
|
return previous.epoch;
|
|
@@ -52550,12 +52707,16 @@ function versionFacts(version2) {
|
|
|
52550
52707
|
return Array.isArray(version2) ? ["rowVersion", ...version2] : ["rowVersion", version2];
|
|
52551
52708
|
}
|
|
52552
52709
|
function sameBodyRow(a, b) {
|
|
52553
|
-
return a.row === b.row && a.index === b.index && a.epoch === b.epoch && a.rowId === b.rowId && a.facts.length === b.facts.length && a.facts.every((fact, i) => Object.is(fact, b.facts[i]));
|
|
52554
|
-
}
|
|
52555
|
-
var MatrxTableBodyRow = (0,
|
|
52556
|
-
|
|
52710
|
+
return a.row === b.row && a.index === b.index && a.epoch === b.epoch && a.probe === b.probe && a.rowId === b.rowId && a.facts.length === b.facts.length && a.facts.every((fact, i) => Object.is(fact, b.facts[i]));
|
|
52711
|
+
}
|
|
52712
|
+
var MatrxTableBodyRow = (0, import_react29.memo)(function MatrxTableBodyRow2(props) {
|
|
52713
|
+
const { rowId, row, index, draw } = props;
|
|
52714
|
+
const last = (0, import_react29.useRef)(null);
|
|
52715
|
+
const fresh = last.current === null || !sameBodyRow({ ...last.current, probe: props.probe }, props);
|
|
52716
|
+
last.current = props;
|
|
52717
|
+
return draw(rowId, row, index, fresh);
|
|
52557
52718
|
}, sameBodyRow);
|
|
52558
|
-
var MatrxTableChrome = (0,
|
|
52719
|
+
var MatrxTableChrome = (0, import_react29.memo)(function MatrxTableChrome2({ render }) {
|
|
52559
52720
|
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_jsx_runtime59.Fragment, { children: render() });
|
|
52560
52721
|
}, (a, b) => a.part === b.part && a.epoch === b.epoch);
|
|
52561
52722
|
function columnsSignature(columns) {
|
|
@@ -52653,7 +52814,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
52653
52814
|
fitToWidth = false,
|
|
52654
52815
|
appearance = "standalone"
|
|
52655
52816
|
} = coreProps;
|
|
52656
|
-
const columns = (0,
|
|
52817
|
+
const columns = (0, import_react29.useMemo)(() => suppliedColumns.filter((column) => !("customActions" in column) || column.customActions !== void 0).map((column) => {
|
|
52657
52818
|
if (!column.customActions) return column;
|
|
52658
52819
|
const {
|
|
52659
52820
|
accessorKey: _key,
|
|
@@ -52668,11 +52829,11 @@ function MatrxDataTableCore(coreProps) {
|
|
|
52668
52829
|
}), [suppliedColumns]);
|
|
52669
52830
|
const embedded = appearance === "embedded";
|
|
52670
52831
|
const zebra = suppliedZebra ?? !embedded;
|
|
52671
|
-
const tableCard = (0,
|
|
52832
|
+
const tableCard = (0, import_react29.useContext)(TableCardOwnerContext);
|
|
52672
52833
|
const selectionConfig = suppliedSelectionConfig === false ? void 0 : suppliedSelectionConfig;
|
|
52673
52834
|
const appendQuery = query?.mode === "controlled-append" ? query : null;
|
|
52674
52835
|
const appendQueryKey = appendQuery?.pagination.queryKey ?? null;
|
|
52675
|
-
const committedAppendQueryKey = (0,
|
|
52836
|
+
const committedAppendQueryKey = (0, import_react29.useRef)(appendQueryKey);
|
|
52676
52837
|
const appendSourceChanged = appendQuery !== null && committedAppendQueryKey.current !== appendQueryKey;
|
|
52677
52838
|
const data = (appendQuery ? appendQuery.pagination.rows : suppliedData) ?? EMPTY_TABLE_ROWS;
|
|
52678
52839
|
const readView = tableReadView(read, data.length, appendQuery ? appendQuery.pagination.loading : suppliedLoading);
|
|
@@ -52690,16 +52851,16 @@ function MatrxDataTableCore(coreProps) {
|
|
|
52690
52851
|
const Link = host.Link ?? DefaultTableLink;
|
|
52691
52852
|
const SidePanelSurface = host.SidePanelSurface ?? DefaultTableSidePanel;
|
|
52692
52853
|
const { notify: toast, notice } = useTableNotice();
|
|
52693
|
-
const [savedViewError, setSavedViewError] = (0,
|
|
52694
|
-
const [toolbarActionError, setToolbarActionError] = (0,
|
|
52695
|
-
const [toolbarActionPending, setToolbarActionPending] = (0,
|
|
52696
|
-
const toolbarActionPendingRef = (0,
|
|
52854
|
+
const [savedViewError, setSavedViewError] = (0, import_react29.useState)(null);
|
|
52855
|
+
const [toolbarActionError, setToolbarActionError] = (0, import_react29.useState)(null);
|
|
52856
|
+
const [toolbarActionPending, setToolbarActionPending] = (0, import_react29.useState)({ refresh: false, add: false });
|
|
52857
|
+
const toolbarActionPendingRef = (0, import_react29.useRef)({ refresh: false, add: false });
|
|
52697
52858
|
const CHECKBOX_TAP_AREA = "h-4 w-4 touch-manipulation";
|
|
52698
52859
|
const mobileCardsClass = mobileCardsBreakpoint === "lg" ? "lg:hidden" : "sm:hidden";
|
|
52699
52860
|
const tableWithCardsClass = mobileCardsBreakpoint === "lg" ? "max-lg:hidden" : "max-sm:hidden";
|
|
52700
52861
|
const cardsQuery = mobileCardsBreakpoint === "lg" ? "(max-width: 1023px)" : "(max-width: 639px)";
|
|
52701
|
-
const [cardsActive, setCardsActive] = (0,
|
|
52702
|
-
(0,
|
|
52862
|
+
const [cardsActive, setCardsActive] = (0, import_react29.useState)(null);
|
|
52863
|
+
(0, import_react29.useEffect)(() => {
|
|
52703
52864
|
if (!mobileCards || typeof window === "undefined" || !window.matchMedia) return;
|
|
52704
52865
|
const mql = window.matchMedia(cardsQuery);
|
|
52705
52866
|
const read2 = () => setCardsActive(mql.matches);
|
|
@@ -52720,7 +52881,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
52720
52881
|
const sourceOwnsIntelligentSearch = sourceProcessing?.intelligentSearch === "source";
|
|
52721
52882
|
const sourceOwnsSearch = remoteQuery?.mode === "controlled" && sourceProcessing?.search !== "local" || appendQuery !== null && sourceProcessing === void 0 || sourceProcessing?.search === "source" || sourceOwnsIntelligentSearch;
|
|
52722
52883
|
const intelligentSearchEnabled = toolbar?.intelligentSearch !== void 0 && (sourceOwnsIntelligentSearch || remoteQuery === null && !sourceOwnsSearch);
|
|
52723
|
-
const emitControlledQueryChange = (0,
|
|
52884
|
+
const emitControlledQueryChange = (0, import_react29.useCallback)(
|
|
52724
52885
|
(patch, options) => {
|
|
52725
52886
|
if (!controlledQuery) return;
|
|
52726
52887
|
controlledQuery.onStateChange(
|
|
@@ -52729,8 +52890,8 @@ function MatrxDataTableCore(coreProps) {
|
|
|
52729
52890
|
},
|
|
52730
52891
|
[controlledQuery]
|
|
52731
52892
|
);
|
|
52732
|
-
const [internalSearch, setInternalSearch] = (0,
|
|
52733
|
-
const [draggedRowId, setDraggedRowId] = (0,
|
|
52893
|
+
const [internalSearch, setInternalSearch] = (0, import_react29.useState)("");
|
|
52894
|
+
const [draggedRowId, setDraggedRowId] = (0, import_react29.useState)(null);
|
|
52734
52895
|
const hierarchySensors = (0, import_core3.useSensors)((0, import_core3.useSensor)(import_core3.PointerSensor, POINTER_SENSOR_OPTIONS));
|
|
52735
52896
|
const toolbarSearchControlled = toolbar?.searchValue !== void 0;
|
|
52736
52897
|
const searchValue = controlledQuery ? controlledQuery.state.search : toolbarSearchControlled ? toolbar?.searchValue ?? "" : internalSearch;
|
|
@@ -52742,7 +52903,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
52742
52903
|
}
|
|
52743
52904
|
toolbar?.onSearchChange?.(v);
|
|
52744
52905
|
};
|
|
52745
|
-
const [internalSearchMatchMode, setInternalSearchMatchMode] = (0,
|
|
52906
|
+
const [internalSearchMatchMode, setInternalSearchMatchMode] = (0, import_react29.useState)(
|
|
52746
52907
|
toolbar?.searchMatch?.defaultMode ?? "contains"
|
|
52747
52908
|
);
|
|
52748
52909
|
const searchMatchMode = controlledQuery ? controlledQuery.state.searchMatchMode ?? toolbar?.searchMatch?.defaultMode ?? "contains" : internalSearchMatchMode;
|
|
@@ -52753,7 +52914,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
52753
52914
|
}
|
|
52754
52915
|
setInternalSearchMatchMode(mode);
|
|
52755
52916
|
};
|
|
52756
|
-
const [internalSearchScope, setInternalSearchScope] = (0,
|
|
52917
|
+
const [internalSearchScope, setInternalSearchScope] = (0, import_react29.useState)("all");
|
|
52757
52918
|
const searchScope = controlledQuery ? controlledQuery.state.searchScope ?? "all" : internalSearchScope;
|
|
52758
52919
|
const setSearchScope = (scope) => {
|
|
52759
52920
|
if (controlledQuery) {
|
|
@@ -52762,7 +52923,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
52762
52923
|
}
|
|
52763
52924
|
setInternalSearchScope(scope);
|
|
52764
52925
|
};
|
|
52765
|
-
const [internalAnyOf, setInternalAnyOf] = (0,
|
|
52926
|
+
const [internalAnyOf, setInternalAnyOf] = (0, import_react29.useState)("");
|
|
52766
52927
|
const toolbarAnyOfControlled = toolbar?.anyOf?.value !== void 0;
|
|
52767
52928
|
const anyOfValue = controlledQuery ? controlledQuery.state.anyOf : toolbarAnyOfControlled ? toolbar?.anyOf?.value ?? "" : internalAnyOf;
|
|
52768
52929
|
const setAnyOfValue = (v) => {
|
|
@@ -52773,7 +52934,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
52773
52934
|
}
|
|
52774
52935
|
toolbar?.anyOf?.onChange?.(v);
|
|
52775
52936
|
};
|
|
52776
|
-
const [internalLayeredFilters, setInternalLayeredFilters] = (0,
|
|
52937
|
+
const [internalLayeredFilters, setInternalLayeredFilters] = (0, import_react29.useState)([]);
|
|
52777
52938
|
const layeredFilters = controlledQuery ? controlledQuery.state.layeredFilters ?? NO_LAYERED_FILTERS : internalLayeredFilters;
|
|
52778
52939
|
const setLayeredFilters = (next) => {
|
|
52779
52940
|
if (controlledQuery) {
|
|
@@ -52782,9 +52943,9 @@ function MatrxDataTableCore(coreProps) {
|
|
|
52782
52943
|
}
|
|
52783
52944
|
setInternalLayeredFilters(next);
|
|
52784
52945
|
};
|
|
52785
|
-
const [internalColumnFilters, setInternalColumnFilters] = (0,
|
|
52946
|
+
const [internalColumnFilters, setInternalColumnFilters] = (0, import_react29.useState)({});
|
|
52786
52947
|
const columnFilters = controlledQuery ? controlledQuery.state.columnFilters : internalColumnFilters;
|
|
52787
|
-
const localColumnFilters = (0,
|
|
52948
|
+
const localColumnFilters = (0, import_react29.useMemo)(() => {
|
|
52788
52949
|
if (appendDefaultsToSourceProcessing) return {};
|
|
52789
52950
|
if (sourceColumnFilterOwnership === "source") return {};
|
|
52790
52951
|
if (sourceColumnFilterOwnership === void 0 || sourceColumnFilterOwnership === "local") {
|
|
@@ -52806,7 +52967,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
52806
52967
|
}
|
|
52807
52968
|
setInternalColumnFilters(nextFilters);
|
|
52808
52969
|
};
|
|
52809
|
-
const [internalSort, setInternalSort] = (0,
|
|
52970
|
+
const [internalSort, setInternalSort] = (0, import_react29.useState)(defaultSort);
|
|
52810
52971
|
const sort = controlledQuery ? controlledQuery.state.sort : internalSort;
|
|
52811
52972
|
const setSort = (next) => {
|
|
52812
52973
|
if (controlledQuery) {
|
|
@@ -52815,7 +52976,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
52815
52976
|
}
|
|
52816
52977
|
setInternalSort(next);
|
|
52817
52978
|
};
|
|
52818
|
-
const [internalPage, setInternalPage] = (0,
|
|
52979
|
+
const [internalPage, setInternalPage] = (0, import_react29.useState)(1);
|
|
52819
52980
|
const page = controlledQuery ? controlledQuery.state.page : internalPage;
|
|
52820
52981
|
const setPage = (next) => {
|
|
52821
52982
|
if (controlledQuery) {
|
|
@@ -52824,7 +52985,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
52824
52985
|
}
|
|
52825
52986
|
setInternalPage(next);
|
|
52826
52987
|
};
|
|
52827
|
-
const [internalPageSize, setInternalPageSize] = (0,
|
|
52988
|
+
const [internalPageSize, setInternalPageSize] = (0, import_react29.useState)(
|
|
52828
52989
|
defaultPageSize
|
|
52829
52990
|
);
|
|
52830
52991
|
const pageSize = controlledQuery ? controlledQuery.state.pageSize : internalPageSize;
|
|
@@ -52835,29 +52996,29 @@ function MatrxDataTableCore(coreProps) {
|
|
|
52835
52996
|
}
|
|
52836
52997
|
setInternalPageSize(next);
|
|
52837
52998
|
};
|
|
52838
|
-
const [uncontrolledSelectedId, setUncontrolledSelectedId] = (0,
|
|
52999
|
+
const [uncontrolledSelectedId, setUncontrolledSelectedId] = (0, import_react29.useState)(null);
|
|
52839
53000
|
const rawSelectedId = controlledSelectedId !== void 0 ? controlledSelectedId : uncontrolledSelectedId;
|
|
52840
53001
|
const selectedId = appendSourceChanged ? null : rawSelectedId;
|
|
52841
|
-
const [openRequest, setOpenRequest] = (0,
|
|
53002
|
+
const [openRequest, setOpenRequest] = (0, import_react29.useState)(0);
|
|
52842
53003
|
const setSelectedId = (id) => {
|
|
52843
53004
|
if (controlledSelectedId === void 0) setUncontrolledSelectedId(id);
|
|
52844
53005
|
onSelectedIdChange?.(id);
|
|
52845
53006
|
};
|
|
52846
|
-
const [uncontrolledWindowRowId, setUncontrolledWindowRowId] = (0,
|
|
53007
|
+
const [uncontrolledWindowRowId, setUncontrolledWindowRowId] = (0, import_react29.useState)(null);
|
|
52847
53008
|
const rawWindowRowId = controlledWindowRowId !== void 0 ? controlledWindowRowId : uncontrolledWindowRowId;
|
|
52848
53009
|
const windowRowId = appendSourceChanged ? null : rawWindowRowId;
|
|
52849
53010
|
const setWindowRowId = (id) => {
|
|
52850
53011
|
if (controlledWindowRowId === void 0) setUncontrolledWindowRowId(id);
|
|
52851
53012
|
onWindowRowIdChange?.(id);
|
|
52852
53013
|
};
|
|
52853
|
-
const [windowRowSnapshot, setWindowRowSnapshot] = (0,
|
|
53014
|
+
const [windowRowSnapshot, setWindowRowSnapshot] = (0, import_react29.useState)(null);
|
|
52854
53015
|
const editScopeKey = appendQueryKey === null ? "\0local" : `append:${appendQueryKey}`;
|
|
52855
|
-
const [editsByScope, setEditsByScope] = (0,
|
|
52856
|
-
const editRevisionRef = (0,
|
|
52857
|
-
const [savingByScope, setSavingByScope] = (0,
|
|
52858
|
-
const savingScopesRef = (0,
|
|
52859
|
-
const [editRequest, setEditRequest] = (0,
|
|
52860
|
-
const [confirmForeignDraftDiscard, setConfirmForeignDraftDiscard] = (0,
|
|
53016
|
+
const [editsByScope, setEditsByScope] = (0, import_react29.useState)({});
|
|
53017
|
+
const editRevisionRef = (0, import_react29.useRef)({});
|
|
53018
|
+
const [savingByScope, setSavingByScope] = (0, import_react29.useState)({});
|
|
53019
|
+
const savingScopesRef = (0, import_react29.useRef)(/* @__PURE__ */ new Set());
|
|
53020
|
+
const [editRequest, setEditRequest] = (0, import_react29.useState)(null);
|
|
53021
|
+
const [confirmForeignDraftDiscard, setConfirmForeignDraftDiscard] = (0, import_react29.useState)(false);
|
|
52861
53022
|
const edits = editsByScope[editScopeKey]?.values ?? {};
|
|
52862
53023
|
const saving = (savingByScope[editScopeKey] ?? 0) > 0;
|
|
52863
53024
|
const setEdits = (next) => {
|
|
@@ -52924,7 +53085,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
52924
53085
|
rows: Object.entries(draft.values).map(([rowId, columns2]) => ({ rowId, columns: columns2 }))
|
|
52925
53086
|
}));
|
|
52926
53087
|
const selection = appendSourceChanged && selectionConfig ? { ...selectionConfig, selectedIds: [] } : selectionConfig;
|
|
52927
|
-
(0,
|
|
53088
|
+
(0, import_react29.useEffect)(() => {
|
|
52928
53089
|
const previous = committedAppendQueryKey.current;
|
|
52929
53090
|
committedAppendQueryKey.current = appendQueryKey;
|
|
52930
53091
|
if (previous === null || appendQueryKey === null || previous === appendQueryKey) {
|
|
@@ -52942,15 +53103,15 @@ function MatrxDataTableCore(coreProps) {
|
|
|
52942
53103
|
onWindowRowIdChange,
|
|
52943
53104
|
selectionConfig
|
|
52944
53105
|
]);
|
|
52945
|
-
const scrollRef = (0,
|
|
52946
|
-
const tableRef = (0,
|
|
52947
|
-
const tableHeaderRef = (0,
|
|
52948
|
-
const cardsScrollRef = (0,
|
|
52949
|
-
const scrollContainers = (0,
|
|
52950
|
-
const [documentStickyHeader, setDocumentStickyHeader] = (0,
|
|
52951
|
-
const documentStickyHeaderRef = (0,
|
|
52952
|
-
const previousAppendKeyForScrollReset = (0,
|
|
52953
|
-
(0,
|
|
53106
|
+
const scrollRef = (0, import_react29.useRef)(null);
|
|
53107
|
+
const tableRef = (0, import_react29.useRef)(null);
|
|
53108
|
+
const tableHeaderRef = (0, import_react29.useRef)(null);
|
|
53109
|
+
const cardsScrollRef = (0, import_react29.useRef)(null);
|
|
53110
|
+
const scrollContainers = (0, import_react29.useMemo)(() => [scrollRef, cardsScrollRef], []);
|
|
53111
|
+
const [documentStickyHeader, setDocumentStickyHeader] = (0, import_react29.useState)(false);
|
|
53112
|
+
const documentStickyHeaderRef = (0, import_react29.useRef)(false);
|
|
53113
|
+
const previousAppendKeyForScrollReset = (0, import_react29.useRef)(appendQueryKey);
|
|
53114
|
+
(0, import_react29.useLayoutEffect)(() => {
|
|
52954
53115
|
const previous = previousAppendKeyForScrollReset.current;
|
|
52955
53116
|
previousAppendKeyForScrollReset.current = appendQueryKey;
|
|
52956
53117
|
if (previous === null || appendQueryKey === null || previous === appendQueryKey) {
|
|
@@ -52975,15 +53136,15 @@ function MatrxDataTableCore(coreProps) {
|
|
|
52975
53136
|
...appendScrollPolicy?.mode === "scroll" && appendScrollPolicy.thresholdPx !== void 0 ? { thresholdPx: appendScrollPolicy.thresholdPx } : {},
|
|
52976
53137
|
...appendScrollPolicy?.mode === "scroll" && appendScrollPolicy.intentTimeoutMs !== void 0 ? { intentTimeoutMs: appendScrollPolicy.intentTimeoutMs } : {}
|
|
52977
53138
|
});
|
|
52978
|
-
const rootRef = (0,
|
|
53139
|
+
const rootRef = (0, import_react29.useRef)(null);
|
|
52979
53140
|
useClippedContentGuard(rootRef, {
|
|
52980
53141
|
label: typeof copy === "object" && copy.listLabel ? `Table: ${copy.listLabel}` : "MatrxDataTable"
|
|
52981
53142
|
});
|
|
52982
|
-
const [scrollHintRight, setScrollHintRight] = (0,
|
|
52983
|
-
const [scrollHintLeft, setScrollHintLeft] = (0,
|
|
52984
|
-
const [scrollHintRightInset, setScrollHintRightInset] = (0,
|
|
52985
|
-
const hintScrollLeft = (0,
|
|
52986
|
-
const updateScrollHint = (0,
|
|
53143
|
+
const [scrollHintRight, setScrollHintRight] = (0, import_react29.useState)(false);
|
|
53144
|
+
const [scrollHintLeft, setScrollHintLeft] = (0, import_react29.useState)(false);
|
|
53145
|
+
const [scrollHintRightInset, setScrollHintRightInset] = (0, import_react29.useState)(6);
|
|
53146
|
+
const hintScrollLeft = (0, import_react29.useRef)(0);
|
|
53147
|
+
const updateScrollHint = (0, import_react29.useCallback)(() => {
|
|
52987
53148
|
const el = scrollRef.current;
|
|
52988
53149
|
if (!el) return;
|
|
52989
53150
|
hintScrollLeft.current = el.scrollLeft;
|
|
@@ -52993,7 +53154,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
52993
53154
|
setScrollHintLeft(hasRows && el.scrollLeft > 2);
|
|
52994
53155
|
setScrollHintRightInset(actions ? Math.ceil(actions.getBoundingClientRect().width) + 6 : 6);
|
|
52995
53156
|
}, []);
|
|
52996
|
-
const onTableScroll = (0,
|
|
53157
|
+
const onTableScroll = (0, import_react29.useCallback)(() => {
|
|
52997
53158
|
const el = scrollRef.current;
|
|
52998
53159
|
if (!el || el.scrollLeft === hintScrollLeft.current) return;
|
|
52999
53160
|
updateScrollHint();
|
|
@@ -53006,7 +53167,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53006
53167
|
behavior: "smooth"
|
|
53007
53168
|
});
|
|
53008
53169
|
};
|
|
53009
|
-
(0,
|
|
53170
|
+
(0, import_react29.useEffect)(() => {
|
|
53010
53171
|
window.addEventListener("resize", updateScrollHint);
|
|
53011
53172
|
const el = scrollRef.current;
|
|
53012
53173
|
const observer = el && typeof ResizeObserver !== "undefined" ? new ResizeObserver(updateScrollHint) : null;
|
|
@@ -53021,7 +53182,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53021
53182
|
observer?.disconnect();
|
|
53022
53183
|
};
|
|
53023
53184
|
}, [updateScrollHint, data, columns]);
|
|
53024
|
-
(0,
|
|
53185
|
+
(0, import_react29.useLayoutEffect)(() => {
|
|
53025
53186
|
const scroll = scrollRef.current;
|
|
53026
53187
|
const table = tableRef.current;
|
|
53027
53188
|
const header = tableHeaderRef.current;
|
|
@@ -53080,30 +53241,30 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53080
53241
|
window.removeEventListener("resize", requestUpdate);
|
|
53081
53242
|
};
|
|
53082
53243
|
}, [stickyHeader, data, columns]);
|
|
53083
|
-
const [columnOrder, setColumnOrder] = (0,
|
|
53084
|
-
const [hiddenColumnIds, setHiddenColumnIds] = (0,
|
|
53244
|
+
const [columnOrder, setColumnOrder] = (0, import_react29.useState)(() => columnState?.order ?? columns.map(columnId));
|
|
53245
|
+
const [hiddenColumnIds, setHiddenColumnIds] = (0, import_react29.useState)(
|
|
53085
53246
|
() => new Set(columnState?.hidden ?? columns.filter((column) => column.hidden).map(columnId))
|
|
53086
53247
|
);
|
|
53087
|
-
const [columnWidths, setColumnWidths] = (0,
|
|
53248
|
+
const [columnWidths, setColumnWidths] = (0, import_react29.useState)(
|
|
53088
53249
|
() => normalizeColumnWidthsForColumns(columnState?.widths, columns)
|
|
53089
53250
|
);
|
|
53090
|
-
const [fixedTableGeometry, setFixedTableGeometry] = (0,
|
|
53091
|
-
const knownColumnIds = (0,
|
|
53092
|
-
const draggedColumnId = (0,
|
|
53093
|
-
const columnDragActive = (0,
|
|
53094
|
-
const columnDragRaf = (0,
|
|
53095
|
-
const columnDragScrollDirection = (0,
|
|
53096
|
-
const [columnDragPreview, setColumnDragPreview] = (0,
|
|
53097
|
-
const stopColumnDragScroll = (0,
|
|
53251
|
+
const [fixedTableGeometry, setFixedTableGeometry] = (0, import_react29.useState)(null);
|
|
53252
|
+
const knownColumnIds = (0, import_react29.useRef)(new Set(columns.map(columnId)));
|
|
53253
|
+
const draggedColumnId = (0, import_react29.useRef)(null);
|
|
53254
|
+
const columnDragActive = (0, import_react29.useRef)(false);
|
|
53255
|
+
const columnDragRaf = (0, import_react29.useRef)(null);
|
|
53256
|
+
const columnDragScrollDirection = (0, import_react29.useRef)(0);
|
|
53257
|
+
const [columnDragPreview, setColumnDragPreview] = (0, import_react29.useState)(null);
|
|
53258
|
+
const stopColumnDragScroll = (0, import_react29.useCallback)(() => {
|
|
53098
53259
|
if (columnDragRaf.current !== null) cancelAnimationFrame(columnDragRaf.current);
|
|
53099
53260
|
columnDragRaf.current = null;
|
|
53100
53261
|
columnDragScrollDirection.current = 0;
|
|
53101
53262
|
}, []);
|
|
53102
|
-
(0,
|
|
53263
|
+
(0, import_react29.useEffect)(() => () => {
|
|
53103
53264
|
columnDragActive.current = false;
|
|
53104
53265
|
stopColumnDragScroll();
|
|
53105
53266
|
}, [stopColumnDragScroll]);
|
|
53106
|
-
const startColumnDragScroll = (0,
|
|
53267
|
+
const startColumnDragScroll = (0, import_react29.useCallback)(() => {
|
|
53107
53268
|
if (!columnDragActive.current || columnDragRaf.current !== null) return;
|
|
53108
53269
|
const scrollStep = () => {
|
|
53109
53270
|
const scroll = scrollRef.current;
|
|
@@ -53130,25 +53291,25 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53130
53291
|
};
|
|
53131
53292
|
columnDragRaf.current = requestAnimationFrame(scrollStep);
|
|
53132
53293
|
}, []);
|
|
53133
|
-
const commitColumnState = (0,
|
|
53294
|
+
const commitColumnState = (0, import_react29.useCallback)((order, hidden) => {
|
|
53134
53295
|
if (columnState) columnState.onChange({ order, hidden: [...hidden] });
|
|
53135
53296
|
else {
|
|
53136
53297
|
setColumnOrder(order);
|
|
53137
53298
|
setHiddenColumnIds(hidden);
|
|
53138
53299
|
}
|
|
53139
53300
|
}, [columnState]);
|
|
53140
|
-
const [internalColumnManagerOpen, setInternalColumnManagerOpen] = (0,
|
|
53301
|
+
const [internalColumnManagerOpen, setInternalColumnManagerOpen] = (0, import_react29.useState)(false);
|
|
53141
53302
|
const columnManagerOpen = controlledColumnManager?.open ?? internalColumnManagerOpen;
|
|
53142
53303
|
const setColumnManagerOpen = controlledColumnManager?.onOpenChange ?? setInternalColumnManagerOpen;
|
|
53143
|
-
const columnIds = (0,
|
|
53144
|
-
const effectiveColumnOrder = (0,
|
|
53145
|
-
const effectiveHiddenColumnIds = (0,
|
|
53146
|
-
const effectiveColumnWidths = (0,
|
|
53304
|
+
const columnIds = (0, import_react29.useMemo)(() => columns.map(columnId), [columns]);
|
|
53305
|
+
const effectiveColumnOrder = (0, import_react29.useMemo)(() => columnState ? [...columnState.order.filter((id, index, values) => columnIds.includes(id) && values.indexOf(id) === index), ...columnIds.filter((id) => !columnState.order.includes(id))] : columnOrder, [columnIds, columnOrder, columnState]);
|
|
53306
|
+
const effectiveHiddenColumnIds = (0, import_react29.useMemo)(() => columnState ? new Set(columnState.hidden.filter((id) => columnIds.includes(id))) : hiddenColumnIds, [columnIds, columnState, hiddenColumnIds]);
|
|
53307
|
+
const effectiveColumnWidths = (0, import_react29.useMemo)(
|
|
53147
53308
|
() => normalizeColumnWidthsForColumns(columnState?.widths ?? columnWidths, columns),
|
|
53148
53309
|
[columns, columnState?.widths, columnWidths]
|
|
53149
53310
|
);
|
|
53150
|
-
const resizeGestureSnapshotRef = (0,
|
|
53151
|
-
const measureVisibleColumnWidths = (0,
|
|
53311
|
+
const resizeGestureSnapshotRef = (0, import_react29.useRef)(null);
|
|
53312
|
+
const measureVisibleColumnWidths = (0, import_react29.useCallback)(() => {
|
|
53152
53313
|
const measured = {};
|
|
53153
53314
|
const headers = tableRef.current ? Array.from(tableRef.current.querySelectorAll(
|
|
53154
53315
|
"thead th[data-matrx-table-column-id]"
|
|
@@ -53162,7 +53323,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53162
53323
|
}
|
|
53163
53324
|
return normalizeColumnWidthsForColumns(measured, columns);
|
|
53164
53325
|
}, [columns]);
|
|
53165
|
-
const measureFixedTableGeometry = (0,
|
|
53326
|
+
const measureFixedTableGeometry = (0, import_react29.useCallback)(() => {
|
|
53166
53327
|
const table = tableRef.current;
|
|
53167
53328
|
const headers = table ? Array.from(table.querySelectorAll("thead th")) : [];
|
|
53168
53329
|
const widthFor = (selector) => {
|
|
@@ -53197,16 +53358,16 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53197
53358
|
...actionsWidth === void 0 ? {} : { actionsWidth }
|
|
53198
53359
|
};
|
|
53199
53360
|
}, [resolvedDensity]);
|
|
53200
|
-
const captureResizeGestureSnapshot = (0,
|
|
53361
|
+
const captureResizeGestureSnapshot = (0, import_react29.useCallback)(() => {
|
|
53201
53362
|
resizeGestureSnapshotRef.current = {
|
|
53202
53363
|
widths: measureVisibleColumnWidths(),
|
|
53203
53364
|
geometry: measureFixedTableGeometry()
|
|
53204
53365
|
};
|
|
53205
53366
|
}, [measureFixedTableGeometry, measureVisibleColumnWidths]);
|
|
53206
|
-
const clearResizeGestureSnapshot = (0,
|
|
53367
|
+
const clearResizeGestureSnapshot = (0, import_react29.useCallback)(() => {
|
|
53207
53368
|
resizeGestureSnapshotRef.current = null;
|
|
53208
53369
|
}, []);
|
|
53209
|
-
const commitColumnWidths = (0,
|
|
53370
|
+
const commitColumnWidths = (0, import_react29.useCallback)((next, captureInitialWidths = false) => {
|
|
53210
53371
|
const gestureSnapshot = captureInitialWidths ? resizeGestureSnapshotRef.current : null;
|
|
53211
53372
|
resizeGestureSnapshotRef.current = null;
|
|
53212
53373
|
const normalized = normalizeColumnWidthsForColumns(
|
|
@@ -53225,7 +53386,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53225
53386
|
}
|
|
53226
53387
|
setColumnWidths(normalized);
|
|
53227
53388
|
}, [columnIds, columnState, columns, measureFixedTableGeometry, measureVisibleColumnWidths]);
|
|
53228
|
-
(0,
|
|
53389
|
+
(0, import_react29.useEffect)(() => {
|
|
53229
53390
|
const ids = columns.map(columnId);
|
|
53230
53391
|
if (columnState) return;
|
|
53231
53392
|
const previousIds = knownColumnIds.current;
|
|
@@ -53244,31 +53405,31 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53244
53405
|
setColumnWidths((current) => normalizeColumnWidthsForColumns(current, columns));
|
|
53245
53406
|
knownColumnIds.current = new Set(ids);
|
|
53246
53407
|
}, [columns, columnState]);
|
|
53247
|
-
(0,
|
|
53408
|
+
(0, import_react29.useLayoutEffect)(() => {
|
|
53248
53409
|
for (const id of columnIds) {
|
|
53249
53410
|
tableRef.current?.style.removeProperty(columnResizeCssVar(id));
|
|
53250
53411
|
}
|
|
53251
53412
|
});
|
|
53252
|
-
const previewColumnOrder = (0,
|
|
53413
|
+
const previewColumnOrder = (0, import_react29.useMemo)(
|
|
53253
53414
|
() => projectColumnDragOrder(effectiveColumnOrder, columnDragPreview),
|
|
53254
53415
|
[columnDragPreview, effectiveColumnOrder]
|
|
53255
53416
|
);
|
|
53256
53417
|
useColumnReorderAnimation(tableRef, previewColumnOrder.join("\0"), columnDragPreview !== null);
|
|
53257
|
-
const visibleColumns = (0,
|
|
53418
|
+
const visibleColumns = (0, import_react29.useMemo)(() => {
|
|
53258
53419
|
const byId = new Map(columns.map((column) => [columnId(column), column]));
|
|
53259
53420
|
return previewColumnOrder.map((id) => byId.get(id)).filter(
|
|
53260
53421
|
(column) => column !== void 0 && !effectiveHiddenColumnIds.has(columnId(column))
|
|
53261
53422
|
);
|
|
53262
53423
|
}, [columns, effectiveHiddenColumnIds, previewColumnOrder]);
|
|
53263
53424
|
const usesMeasuredFixedLayout = visibleColumns.length > 0 && visibleColumns.every((column) => effectiveColumnWidths[columnId(column)] !== void 0);
|
|
53264
|
-
(0,
|
|
53425
|
+
(0, import_react29.useLayoutEffect)(() => {
|
|
53265
53426
|
if (!usesMeasuredFixedLayout) {
|
|
53266
53427
|
if (fixedTableGeometry !== null) setFixedTableGeometry(null);
|
|
53267
53428
|
return;
|
|
53268
53429
|
}
|
|
53269
53430
|
if (fixedTableGeometry === null) setFixedTableGeometry(measureFixedTableGeometry());
|
|
53270
53431
|
}, [fixedTableGeometry, measureFixedTableGeometry, usesMeasuredFixedLayout]);
|
|
53271
|
-
(0,
|
|
53432
|
+
(0, import_react29.useLayoutEffect)(() => {
|
|
53272
53433
|
if (!usesMeasuredFixedLayout) return;
|
|
53273
53434
|
const table = tableRef.current;
|
|
53274
53435
|
if (!table) return;
|
|
@@ -53292,8 +53453,8 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53292
53453
|
const fixedLayoutActive = usesMeasuredFixedLayout && fixedTableGeometry !== null;
|
|
53293
53454
|
const freezeWanted = visibleColumns.some((column) => column.frozen);
|
|
53294
53455
|
const selectionColumnWidth = fixedTableGeometry?.selectionWidth ?? (selection && (freezeWanted || fitToWidth) ? SELECTION_COLUMN_PX : void 0);
|
|
53295
|
-
const [fitSpace, setFitSpace] = (0,
|
|
53296
|
-
(0,
|
|
53456
|
+
const [fitSpace, setFitSpace] = (0, import_react29.useState)(null);
|
|
53457
|
+
(0, import_react29.useLayoutEffect)(() => {
|
|
53297
53458
|
if (!fitToWidth) {
|
|
53298
53459
|
setFitSpace(null);
|
|
53299
53460
|
return;
|
|
@@ -53336,7 +53497,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53336
53497
|
if (table) observer.observe(table);
|
|
53337
53498
|
return () => observer.disconnect();
|
|
53338
53499
|
}, [fitToWidth, data.length]);
|
|
53339
|
-
const fittedWidths = (0,
|
|
53500
|
+
const fittedWidths = (0, import_react29.useMemo)(() => {
|
|
53340
53501
|
if (!fitToWidth || !fitSpace) return null;
|
|
53341
53502
|
const contentWidth = (col) => col.customActions ? fitSpace.custom[columnId(col)] : void 0;
|
|
53342
53503
|
const keepsItsWidth = (col) => resolveColumnMarker(col) !== void 0 || col.resizable === false && pixelWidth(col.width) !== void 0 || contentWidth(col) !== void 0;
|
|
@@ -53361,7 +53522,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53361
53522
|
}, [fitToWidth, fitSpace, visibleColumns, selection, selectionColumnWidth, effectiveColumnWidths]);
|
|
53362
53523
|
const fitActive = fittedWidths !== null;
|
|
53363
53524
|
const actionsColumnWidth = fitActive && fitSpace ? fitSpace.actions : fixedTableGeometry?.actionsWidth;
|
|
53364
|
-
const frozenColumns = (0,
|
|
53525
|
+
const frozenColumns = (0, import_react29.useMemo)(() => {
|
|
53365
53526
|
if (!freezeWanted) return NO_FROZEN_COLUMNS;
|
|
53366
53527
|
const ids = visibleColumns.map(columnId);
|
|
53367
53528
|
const byId = new Map(visibleColumns.map((column) => [columnId(column), column]));
|
|
@@ -53409,15 +53570,18 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53409
53570
|
const color = cellTintColor(row, id, colId);
|
|
53410
53571
|
return color ? CELL_TINT_CLASS[color] : void 0;
|
|
53411
53572
|
};
|
|
53412
|
-
const declaredVisibleCopyColumns = (0,
|
|
53573
|
+
const declaredVisibleCopyColumns = (0, import_react29.useMemo)(
|
|
53413
53574
|
() => visibleColumns.filter((column) => column.accessorFn !== void 0 || column.accessorKey !== void 0),
|
|
53414
53575
|
[visibleColumns]
|
|
53415
53576
|
);
|
|
53416
|
-
const tableCopySourceNamespace = (0,
|
|
53417
|
-
const tableContextMenuInstanceId = (0,
|
|
53418
|
-
const tableDndContextId = (0,
|
|
53577
|
+
const tableCopySourceNamespace = (0, import_react29.useId)();
|
|
53578
|
+
const tableContextMenuInstanceId = (0, import_react29.useId)();
|
|
53579
|
+
const tableDndContextId = (0, import_react29.useId)();
|
|
53419
53580
|
const defaultCopyTitle = toolbar?.title || "Table";
|
|
53420
|
-
const
|
|
53581
|
+
const copyColumnsLatest = (0, import_react29.useRef)(declaredVisibleCopyColumns);
|
|
53582
|
+
copyColumnsLatest.current = declaredVisibleCopyColumns;
|
|
53583
|
+
const readDeclaredCopyColumns = lazyCallback(() => copyColumnsLatest.current);
|
|
53584
|
+
const defaultCopy = (0, import_react29.useMemo)(() => ({
|
|
53421
53585
|
label: defaultCopyTitle,
|
|
53422
53586
|
listLabel: defaultCopyTitle,
|
|
53423
53587
|
location: defaultCopyTitle,
|
|
@@ -53426,23 +53590,23 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53426
53590
|
listDescription: `${defaultCopyTitle} \u2014 ${remoteQuery ? "current filtered/sorted loaded view" : "current filtered/sorted view"}.`,
|
|
53427
53591
|
listAttributes: (_visible, loaded) => remoteQuery ? { coverage: "loaded-current-view", loaded_count: loaded.length } : { coverage: "current-view" },
|
|
53428
53592
|
humanRow: (row) => formatDefaultTableCopyRecord(
|
|
53429
|
-
projectDefaultTableCopyRow(row,
|
|
53430
|
-
|
|
53593
|
+
projectDefaultTableCopyRow(row, copyColumnsLatest.current),
|
|
53594
|
+
copyColumnsLatest.current
|
|
53431
53595
|
),
|
|
53432
|
-
agentRow: (row) => projectDefaultTableCopyRow(row,
|
|
53433
|
-
}), [defaultCopyTitle,
|
|
53596
|
+
agentRow: (row) => projectDefaultTableCopyRow(row, copyColumnsLatest.current)
|
|
53597
|
+
}), [defaultCopyTitle, remoteQuery]);
|
|
53434
53598
|
const effectiveCopy = copy === false ? void 0 : copy ?? defaultCopy;
|
|
53435
|
-
const visibleDataColumns = (0,
|
|
53599
|
+
const visibleDataColumns = (0, import_react29.useMemo)(() => visibleColumns.filter((column) => !column.customActions), [visibleColumns]);
|
|
53436
53600
|
const effectiveCopyColumns = copy === void 0 ? declaredVisibleCopyColumns : visibleDataColumns;
|
|
53437
53601
|
const copySubsetVariant2 = useCopySubsetVariant();
|
|
53438
|
-
const chromeLatest = (0,
|
|
53602
|
+
const chromeLatest = (0, import_react29.useRef)({
|
|
53439
53603
|
processed: [],
|
|
53440
53604
|
data: [],
|
|
53441
53605
|
toggleAllOnPage: () => void 0,
|
|
53442
53606
|
showMore: async () => void 0,
|
|
53443
53607
|
applySavedView: () => void 0
|
|
53444
53608
|
});
|
|
53445
|
-
const applyLatestSavedView = (0,
|
|
53609
|
+
const applyLatestSavedView = (0, import_react29.useCallback)((snapshot) => chromeLatest.current.applySavedView(snapshot), []);
|
|
53446
53610
|
const copySubsetColumns = () => effectiveCopyColumns.filter((c) => c.filter !== false || c.accessorKey || c.accessorFn).map((c) => ({
|
|
53447
53611
|
id: columnId(c),
|
|
53448
53612
|
header: typeof c.header === "string" ? c.header : columnId(c),
|
|
@@ -53463,7 +53627,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53463
53627
|
serializer: (shaped) => buildViewAgentInput(effectiveCopy, shaped, chromeLatest.current.data, { scope: "custom" })
|
|
53464
53628
|
}), copySubsetSize(rows().length, copySubsetColumns().length))
|
|
53465
53629
|
] : [];
|
|
53466
|
-
const filterMeta = (0,
|
|
53630
|
+
const filterMeta = (0, import_react29.useMemo)(() => {
|
|
53467
53631
|
const meta = /* @__PURE__ */ new Map();
|
|
53468
53632
|
for (const col of visibleColumns) {
|
|
53469
53633
|
const id = columnId(col);
|
|
@@ -53471,14 +53635,14 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53471
53635
|
}
|
|
53472
53636
|
return meta;
|
|
53473
53637
|
}, [visibleColumns, data, remoteQuery]);
|
|
53474
|
-
const intelligentSearchScopes = (0,
|
|
53638
|
+
const intelligentSearchScopes = (0, import_react29.useMemo)(
|
|
53475
53639
|
() => resolveTableSearchScopes(data, columns, {
|
|
53476
53640
|
...toolbar?.intelligentSearch?.roles === void 0 ? {} : { roles: toolbar.intelligentSearch.roles },
|
|
53477
53641
|
...toolbar?.intelligentSearch?.scopes === void 0 ? {} : { scopes: toolbar.intelligentSearch.scopes }
|
|
53478
53642
|
}),
|
|
53479
53643
|
[columns, data, toolbar?.intelligentSearch?.roles, toolbar?.intelligentSearch?.scopes]
|
|
53480
53644
|
);
|
|
53481
|
-
const processed = (0,
|
|
53645
|
+
const processed = (0, import_react29.useMemo)(() => {
|
|
53482
53646
|
if (remoteQuery && !appendUsesLocalProcessing && !remoteQueryUsesLocalProcessing) return data;
|
|
53483
53647
|
if (processLocalRows) {
|
|
53484
53648
|
return processLocalRows(data, {
|
|
@@ -53542,8 +53706,8 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53542
53706
|
intelligentSearchEnabled,
|
|
53543
53707
|
searchScope
|
|
53544
53708
|
]);
|
|
53545
|
-
const lastNotifiedViewRows = (0,
|
|
53546
|
-
(0,
|
|
53709
|
+
const lastNotifiedViewRows = (0, import_react29.useRef)(null);
|
|
53710
|
+
(0, import_react29.useEffect)(() => {
|
|
53547
53711
|
if (!onViewChange) {
|
|
53548
53712
|
lastNotifiedViewRows.current = null;
|
|
53549
53713
|
return;
|
|
@@ -53552,7 +53716,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53552
53716
|
lastNotifiedViewRows.current = processed;
|
|
53553
53717
|
if (changed) onViewChange(processed);
|
|
53554
53718
|
}, [processed, onViewChange]);
|
|
53555
|
-
(0,
|
|
53719
|
+
(0, import_react29.useEffect)(() => {
|
|
53556
53720
|
if (controlledQuery) return;
|
|
53557
53721
|
setInternalPage(1);
|
|
53558
53722
|
}, [
|
|
@@ -53600,7 +53764,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53600
53764
|
numberedPageHasMore: !hidePagination && !isLoading && !isFetching && processed.length > 0 && safePage < pageCount && (remoteQuery?.mode === "controlled" || !remoteQuery),
|
|
53601
53765
|
onPageAdvance: setPage
|
|
53602
53766
|
});
|
|
53603
|
-
const paginated = (0,
|
|
53767
|
+
const paginated = (0, import_react29.useMemo)(() => {
|
|
53604
53768
|
if (remoteQuery) return processed;
|
|
53605
53769
|
if (hidePagination) return processed;
|
|
53606
53770
|
if (localProgressiveEnabled) return [...progressiveRows.rows];
|
|
@@ -53610,16 +53774,16 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53610
53774
|
}, [processed, safePage, effectivePageSize, pageSize, remoteQuery, hidePagination, localProgressiveEnabled, progressiveRows.rows]);
|
|
53611
53775
|
const drillGrouped = Boolean(drill && drill.question.by.length > 0);
|
|
53612
53776
|
const groupingColumnId = drill ? null : grouping?.columnId ?? null;
|
|
53613
|
-
const [uncontrolledCollapsed, setUncontrolledCollapsed] = (0,
|
|
53777
|
+
const [uncontrolledCollapsed, setUncontrolledCollapsed] = (0, import_react29.useState)([]);
|
|
53614
53778
|
const collapsedGroups = grouping?.collapsed ?? uncontrolledCollapsed;
|
|
53615
|
-
const setCollapsedGroups = (0,
|
|
53779
|
+
const setCollapsedGroups = (0, import_react29.useCallback)(
|
|
53616
53780
|
(next) => {
|
|
53617
53781
|
if (grouping?.onCollapsedChange) grouping.onCollapsedChange(next);
|
|
53618
53782
|
else setUncontrolledCollapsed(next);
|
|
53619
53783
|
},
|
|
53620
53784
|
[grouping]
|
|
53621
53785
|
);
|
|
53622
|
-
const groups = (0,
|
|
53786
|
+
const groups = (0, import_react29.useMemo)(() => {
|
|
53623
53787
|
if (!grouping || !groupingColumnId) return null;
|
|
53624
53788
|
const groupColumn = columns.find((col) => columnId(col) === groupingColumnId);
|
|
53625
53789
|
if (!groupColumn) return null;
|
|
@@ -53638,7 +53802,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53638
53802
|
...grouping.emptyLabel ? { emptyLabel: grouping.emptyLabel } : {}
|
|
53639
53803
|
});
|
|
53640
53804
|
}, [grouping, groupingColumnId, columns, paginated]);
|
|
53641
|
-
const groupableColumns = (0,
|
|
53805
|
+
const groupableColumns = (0, import_react29.useMemo)(() => {
|
|
53642
53806
|
const allowed = grouping?.groupableColumnIds;
|
|
53643
53807
|
return visibleColumns.filter((col) => {
|
|
53644
53808
|
const id = columnId(col);
|
|
@@ -53646,7 +53810,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53646
53810
|
return col.accessorKey !== void 0 || col.accessorFn !== void 0;
|
|
53647
53811
|
});
|
|
53648
53812
|
}, [visibleColumns, grouping?.groupableColumnIds]);
|
|
53649
|
-
const groupedRenderRows = (0,
|
|
53813
|
+
const groupedRenderRows = (0, import_react29.useMemo)(
|
|
53650
53814
|
() => groups ? flattenGroups(groups, collapsedGroups) : null,
|
|
53651
53815
|
[groups, collapsedGroups]
|
|
53652
53816
|
);
|
|
@@ -53658,7 +53822,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53658
53822
|
const bodyEntryCount = groupedRenderRows ? groupedRenderRows.length : paginated.length;
|
|
53659
53823
|
const virtualizeActive = virtualizeConfig !== null && virtualizeConfig.enabled !== false && bodyEntryCount > virtualThreshold && !hierarchy && expandedDetail === void 0;
|
|
53660
53824
|
const columnWindowWidth = virtualizeConfig?.columnWidth ?? 160;
|
|
53661
|
-
const frozenRunLength = (0,
|
|
53825
|
+
const frozenRunLength = (0, import_react29.useMemo)(() => {
|
|
53662
53826
|
let run = 0;
|
|
53663
53827
|
for (const col of visibleColumns) {
|
|
53664
53828
|
if (frozenColumns.offsets[columnId(col)] === void 0) break;
|
|
@@ -53667,9 +53831,9 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53667
53831
|
return run;
|
|
53668
53832
|
}, [visibleColumns, frozenColumns]);
|
|
53669
53833
|
const columnVirtualizeActive = virtualizeConfig !== null && virtualizeConfig.enabled !== false && virtualizeConfig.columns === true && visibleColumns.length - frozenRunLength > 30 && !hierarchy && mobileCards === void 0;
|
|
53670
|
-
const [rowWindow, setRowWindow] = (0,
|
|
53671
|
-
const [columnWindow, setColumnWindow] = (0,
|
|
53672
|
-
const windowInputs = (0,
|
|
53834
|
+
const [rowWindow, setRowWindow] = (0, import_react29.useState)(null);
|
|
53835
|
+
const [columnWindow, setColumnWindow] = (0, import_react29.useState)(null);
|
|
53836
|
+
const windowInputs = (0, import_react29.useRef)({
|
|
53673
53837
|
virtualizeActive: false,
|
|
53674
53838
|
bodyEntryCount: 0,
|
|
53675
53839
|
virtualRowHeight: 40,
|
|
@@ -53689,7 +53853,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53689
53853
|
columnWindowWidth,
|
|
53690
53854
|
frozenRunLength
|
|
53691
53855
|
};
|
|
53692
|
-
const recomputeWindows = (0,
|
|
53856
|
+
const recomputeWindows = (0, import_react29.useCallback)(() => {
|
|
53693
53857
|
const el = scrollRef.current;
|
|
53694
53858
|
const input = windowInputs.current;
|
|
53695
53859
|
const nextRow = input.virtualizeActive ? computeWindow({
|
|
@@ -53710,7 +53874,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53710
53874
|
setRowWindow((prev) => sameWindow(prev, nextRow) ? prev : nextRow);
|
|
53711
53875
|
setColumnWindow((prev) => sameWindow(prev, nextColumn) ? prev : nextColumn);
|
|
53712
53876
|
}, []);
|
|
53713
|
-
const effectiveRowWindow = (0,
|
|
53877
|
+
const effectiveRowWindow = (0, import_react29.useMemo)(() => {
|
|
53714
53878
|
if (!virtualizeActive) return null;
|
|
53715
53879
|
if (rowWindow && rowWindow.end <= bodyEntryCount) return rowWindow;
|
|
53716
53880
|
return computeWindow({
|
|
@@ -53721,7 +53885,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53721
53885
|
overscan: virtualizeConfig?.overscan ?? 8
|
|
53722
53886
|
});
|
|
53723
53887
|
}, [virtualizeActive, rowWindow, bodyEntryCount, virtualRowHeight, virtualizeConfig?.overscan]);
|
|
53724
|
-
const effectiveColumnWindow = (0,
|
|
53888
|
+
const effectiveColumnWindow = (0, import_react29.useMemo)(() => {
|
|
53725
53889
|
if (!columnVirtualizeActive) return null;
|
|
53726
53890
|
if (columnWindow && columnWindow.end <= visibleColumns.length) return columnWindow;
|
|
53727
53891
|
return computeWindow({
|
|
@@ -53741,7 +53905,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53741
53905
|
frozenRunLength
|
|
53742
53906
|
]);
|
|
53743
53907
|
const metricsWanted = virtualizeActive || columnVirtualizeActive;
|
|
53744
|
-
(0,
|
|
53908
|
+
(0, import_react29.useEffect)(() => {
|
|
53745
53909
|
recomputeWindows();
|
|
53746
53910
|
}, [
|
|
53747
53911
|
recomputeWindows,
|
|
@@ -53753,7 +53917,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53753
53917
|
columnWindowWidth,
|
|
53754
53918
|
frozenRunLength
|
|
53755
53919
|
]);
|
|
53756
|
-
(0,
|
|
53920
|
+
(0, import_react29.useEffect)(() => {
|
|
53757
53921
|
if (!metricsWanted) return;
|
|
53758
53922
|
const el = scrollRef.current;
|
|
53759
53923
|
if (!el) return;
|
|
@@ -53774,7 +53938,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53774
53938
|
observer?.disconnect();
|
|
53775
53939
|
};
|
|
53776
53940
|
}, [metricsWanted, recomputeWindows]);
|
|
53777
|
-
const renderedColumns = (0,
|
|
53941
|
+
const renderedColumns = (0, import_react29.useMemo)(
|
|
53778
53942
|
() => effectiveColumnWindow ? [
|
|
53779
53943
|
...visibleColumns.slice(0, frozenRunLength),
|
|
53780
53944
|
...visibleColumns.slice(effectiveColumnWindow.start, effectiveColumnWindow.end)
|
|
@@ -53782,7 +53946,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53782
53946
|
[effectiveColumnWindow, visibleColumns, frozenRunLength]
|
|
53783
53947
|
);
|
|
53784
53948
|
const columnSpacers = effectiveColumnWindow ? { start: effectiveColumnWindow.padStart, end: effectiveColumnWindow.padEnd } : null;
|
|
53785
|
-
const windowedWidthFor = (0,
|
|
53949
|
+
const windowedWidthFor = (0, import_react29.useCallback)(
|
|
53786
53950
|
(id, declared) => {
|
|
53787
53951
|
const fitted = fittedWidths?.[id];
|
|
53788
53952
|
if (fitted !== void 0) return fitted;
|
|
@@ -53794,7 +53958,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53794
53958
|
[effectiveColumnWindow, effectiveColumnWidths, frozenColumns, columnWindowWidth, fittedWidths]
|
|
53795
53959
|
);
|
|
53796
53960
|
const coverageUnanswered = readView.failure || read?.status === "loading" && data.length === 0;
|
|
53797
|
-
const coverageResult = (0,
|
|
53961
|
+
const coverageResult = (0, import_react29.useMemo)(() => {
|
|
53798
53962
|
if (!coverage || coverageUnanswered) return null;
|
|
53799
53963
|
return describeCoverage({
|
|
53800
53964
|
loaded: coverage.loaded ?? data.length,
|
|
@@ -53805,7 +53969,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53805
53969
|
...coverage.noun === void 0 ? {} : { noun: coverage.noun }
|
|
53806
53970
|
});
|
|
53807
53971
|
}, [coverage, coverageUnanswered, data.length]);
|
|
53808
|
-
const bodyEntries = (0,
|
|
53972
|
+
const bodyEntries = (0, import_react29.useMemo)(() => {
|
|
53809
53973
|
const from = effectiveRowWindow ? effectiveRowWindow.start : 0;
|
|
53810
53974
|
const to = effectiveRowWindow ? effectiveRowWindow.end : void 0;
|
|
53811
53975
|
const windowed = groupedRenderRows ? groupedRenderRows.slice(from, to).map(
|
|
@@ -53822,28 +53986,28 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53822
53986
|
windowed.push({ kind: "spacer", height: effectiveRowWindow.padEnd, place: "end" });
|
|
53823
53987
|
return windowed;
|
|
53824
53988
|
}, [groupedRenderRows, collapsedGroups, paginated, effectiveRowWindow]);
|
|
53825
|
-
const getRowIdRef = (0,
|
|
53989
|
+
const getRowIdRef = (0, import_react29.useRef)(getRowId);
|
|
53826
53990
|
getRowIdRef.current = getRowId;
|
|
53827
|
-
const spreadsheetRowIds = (0,
|
|
53991
|
+
const spreadsheetRowIds = (0, import_react29.useMemo)(
|
|
53828
53992
|
() => paginated.map((row) => getRowIdRef.current(row)),
|
|
53829
53993
|
[paginated]
|
|
53830
53994
|
);
|
|
53831
|
-
const spreadsheetColumnIds = (0,
|
|
53995
|
+
const spreadsheetColumnIds = (0, import_react29.useMemo)(
|
|
53832
53996
|
() => visibleColumns.filter((col) => !col.customActions).map((col) => columnId(col)),
|
|
53833
53997
|
[visibleColumns]
|
|
53834
53998
|
);
|
|
53835
|
-
const spreadsheetRowById = (0,
|
|
53999
|
+
const spreadsheetRowById = (0, import_react29.useMemo)(() => {
|
|
53836
54000
|
const map = /* @__PURE__ */ new Map();
|
|
53837
54001
|
for (const row of paginated) map.set(getRowIdRef.current(row), row);
|
|
53838
54002
|
return map;
|
|
53839
54003
|
}, [paginated]);
|
|
53840
|
-
const spreadsheetColumnById = (0,
|
|
54004
|
+
const spreadsheetColumnById = (0, import_react29.useMemo)(() => {
|
|
53841
54005
|
const map = /* @__PURE__ */ new Map();
|
|
53842
54006
|
for (const col of visibleColumns) if (!col.customActions) map.set(columnId(col), col);
|
|
53843
54007
|
return map;
|
|
53844
54008
|
}, [visibleColumns]);
|
|
53845
54009
|
const spreadsheetEnabled = Boolean(spreadsheet && spreadsheet.enabled !== false);
|
|
53846
|
-
const openRowRef = (0,
|
|
54010
|
+
const openRowRef = (0, import_react29.useRef)(() => void 0);
|
|
53847
54011
|
const sheet = useSpreadsheetGrid(
|
|
53848
54012
|
spreadsheetEnabled && spreadsheet ? {
|
|
53849
54013
|
rowIds: spreadsheetRowIds,
|
|
@@ -53885,12 +54049,12 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53885
54049
|
} : null
|
|
53886
54050
|
);
|
|
53887
54051
|
if (spreadsheet?.controllerRef) spreadsheet.controllerRef.current = spreadsheetEnabled ? sheet.controller : null;
|
|
53888
|
-
const sheetRef = (0,
|
|
54052
|
+
const sheetRef = (0, import_react29.useRef)(sheet);
|
|
53889
54053
|
sheetRef.current = sheet;
|
|
53890
|
-
const onSheetSelectionRef = (0,
|
|
54054
|
+
const onSheetSelectionRef = (0, import_react29.useRef)(spreadsheet?.onSelectionChange);
|
|
53891
54055
|
onSheetSelectionRef.current = spreadsheet?.onSelectionChange;
|
|
53892
54056
|
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}` : ""}` : "";
|
|
53893
|
-
(0,
|
|
54057
|
+
(0, import_react29.useEffect)(() => {
|
|
53894
54058
|
const tell = onSheetSelectionRef.current;
|
|
53895
54059
|
if (!tell) return;
|
|
53896
54060
|
const current = sheetRef.current;
|
|
@@ -53907,12 +54071,12 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53907
54071
|
tsv: current.selectionTsv()
|
|
53908
54072
|
});
|
|
53909
54073
|
}, [sheetSelectionKey]);
|
|
53910
|
-
const searchValueRef = (0,
|
|
54074
|
+
const searchValueRef = (0, import_react29.useRef)(searchValue);
|
|
53911
54075
|
searchValueRef.current = searchValue;
|
|
53912
54076
|
const facetsEnabled = Boolean(facets && facets.enabled !== false);
|
|
53913
54077
|
const coreSuggestionsEnabled = facets?.enabled !== false;
|
|
53914
|
-
const [facetState, setFacetState] = (0,
|
|
53915
|
-
const facetReadCell = (0,
|
|
54078
|
+
const [facetState, setFacetState] = (0, import_react29.useState)({});
|
|
54079
|
+
const facetReadCell = (0, import_react29.useCallback)(
|
|
53916
54080
|
(row, colId) => {
|
|
53917
54081
|
if (facets?.readCell) return facets.readCell(row, colId);
|
|
53918
54082
|
const col = visibleColumns.find((candidate) => columnId(candidate) === colId);
|
|
@@ -53922,11 +54086,11 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53922
54086
|
);
|
|
53923
54087
|
const coreFacetTotal = remoteQuery?.mode === "controlled" ? remoteQuery.totalItems : appendQuery?.pagination.sourceRecords?.total ?? coverage?.matched ?? coverage?.total;
|
|
53924
54088
|
const coreFacetLoaded = appendQuery?.pagination.sourceRecords?.loaded;
|
|
53925
|
-
const facetInputsRef = (0,
|
|
54089
|
+
const facetInputsRef = (0, import_react29.useRef)({ data, facets, facetReadCell, coreFacetTotal, coreFacetLoaded });
|
|
53926
54090
|
facetInputsRef.current = { data, facets, facetReadCell, coreFacetTotal, coreFacetLoaded };
|
|
53927
|
-
const facetRequestRef = (0,
|
|
53928
|
-
const requestedFacetColumns = (0,
|
|
53929
|
-
const requestFacets = (0,
|
|
54091
|
+
const facetRequestRef = (0, import_react29.useRef)(/* @__PURE__ */ new Map());
|
|
54092
|
+
const requestedFacetColumns = (0, import_react29.useRef)(/* @__PURE__ */ new Set());
|
|
54093
|
+
const requestFacets = (0, import_react29.useCallback)((colId) => {
|
|
53930
54094
|
requestedFacetColumns.current.add(colId);
|
|
53931
54095
|
const { data: rows, facets: config, facetReadCell: readCell, coreFacetTotal: total, coreFacetLoaded: loaded } = facetInputsRef.current;
|
|
53932
54096
|
if (!config || config.enabled === false) {
|
|
@@ -54009,7 +54173,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
54009
54173
|
}));
|
|
54010
54174
|
});
|
|
54011
54175
|
}, []);
|
|
54012
|
-
(0,
|
|
54176
|
+
(0, import_react29.useEffect)(() => {
|
|
54013
54177
|
setFacetState((current) => Object.keys(current).length === 0 ? current : {});
|
|
54014
54178
|
for (const [colId, ticket] of facetRequestRef.current) {
|
|
54015
54179
|
facetRequestRef.current.set(colId, ticket + 1);
|
|
@@ -54019,15 +54183,15 @@ function MatrxDataTableCore(coreProps) {
|
|
|
54019
54183
|
}
|
|
54020
54184
|
}, [facetsEnabled, coreSuggestionsEnabled, data, searchValue, coreFacetTotal, coreFacetLoaded, requestFacets]);
|
|
54021
54185
|
const totalIsKnown = !isLoading && !readView.failure;
|
|
54022
|
-
(0,
|
|
54186
|
+
(0, import_react29.useEffect)(() => {
|
|
54023
54187
|
if (!controlledQuery || !totalIsKnown || controlledQuery.state.page === safePage) return;
|
|
54024
54188
|
emitControlledQueryChange({ page: safePage });
|
|
54025
54189
|
}, [controlledQuery, emitControlledQueryChange, safePage, totalIsKnown]);
|
|
54026
|
-
const selectedRow = (0,
|
|
54190
|
+
const selectedRow = (0, import_react29.useMemo)(() => {
|
|
54027
54191
|
if (!selectedId) return null;
|
|
54028
54192
|
return data.find((r) => getRowId(r) === selectedId) ?? null;
|
|
54029
54193
|
}, [data, selectedId, getRowId]);
|
|
54030
|
-
const windowRow = (0,
|
|
54194
|
+
const windowRow = (0, import_react29.useMemo)(() => {
|
|
54031
54195
|
if (!windowRowId) return null;
|
|
54032
54196
|
return data.find((r) => getRowId(r) === windowRowId) ?? (windowRowSnapshot && windowRowSnapshot.queryKey === appendQueryKey && getRowId(windowRowSnapshot.row) === windowRowId ? windowRowSnapshot.row : null);
|
|
54033
54197
|
}, [data, windowRowId, windowRowSnapshot, getRowId, appendQueryKey]);
|
|
@@ -54054,14 +54218,14 @@ function MatrxDataTableCore(coreProps) {
|
|
|
54054
54218
|
const reportCardTotal = embedded ? tableCard?.reportTotal : void 0;
|
|
54055
54219
|
const cardTotal = appendQuery ? appendQuery.pagination.totalItems : remoteQuery?.mode === "controlled" ? isLoading ? void 0 : remoteQuery.totalItems : isLoading ? void 0 : sourceProcessing ? sourceTotal : data.length;
|
|
54056
54220
|
const embeddedControlledPage = embedded && remoteQuery?.mode === "controlled" ? remoteQuery.state.page : 1;
|
|
54057
|
-
(0,
|
|
54221
|
+
(0, import_react29.useEffect)(() => {
|
|
54058
54222
|
if (embeddedControlledPage !== 1) emitControlledQueryChange({ page: 1 });
|
|
54059
54223
|
}, [embeddedControlledPage]);
|
|
54060
|
-
(0,
|
|
54224
|
+
(0, import_react29.useEffect)(() => {
|
|
54061
54225
|
reportCardTotal?.(cardTotal);
|
|
54062
54226
|
}, [reportCardTotal, cardTotal]);
|
|
54063
|
-
(0,
|
|
54064
|
-
const [pinnedEl, setPinnedEl] = (0,
|
|
54227
|
+
(0, import_react29.useEffect)(() => () => reportCardTotal?.(void 0), [reportCardTotal]);
|
|
54228
|
+
const [pinnedEl, setPinnedEl] = (0, import_react29.useState)(null);
|
|
54065
54229
|
const pinnedRowActive = Boolean(
|
|
54066
54230
|
toolbar?.singleRow && toolbar.overflow && toolbar.overflow.mode !== "sheet" && (toolbar.overflow.pinned || toolbar.overflow.mode === "menu")
|
|
54067
54231
|
);
|
|
@@ -54125,7 +54289,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
54125
54289
|
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
54126
54290
|
MatrxTableRowAlchemyProvider,
|
|
54127
54291
|
{
|
|
54128
|
-
copy: tableRowCopyProps(effectiveCopy, row, `${tableCopySourceNamespace}:row:${getRowId(row)}`, copy === void 0 ?
|
|
54292
|
+
copy: tableRowCopyProps(effectiveCopy, row, `${tableCopySourceNamespace}:row:${getRowId(row)}`, copy === void 0 ? readDeclaredCopyColumns : void 0),
|
|
54129
54293
|
placement: rowCopyInMenu ? "menu" : "inline",
|
|
54130
54294
|
controls,
|
|
54131
54295
|
children: scopedActions
|
|
@@ -54181,7 +54345,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
54181
54345
|
...resolveSummaryValue(summary?.source?.totals?.[id], value)
|
|
54182
54346
|
}));
|
|
54183
54347
|
const hasSummaryTotals = summaryTotals.length > 0;
|
|
54184
|
-
const changeCount = (0,
|
|
54348
|
+
const changeCount = (0, import_react29.useMemo)(() => {
|
|
54185
54349
|
let n = 0;
|
|
54186
54350
|
for (const fields of Object.values(edits)) {
|
|
54187
54351
|
n += Object.keys(fields).length;
|
|
@@ -54366,7 +54530,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
54366
54530
|
}));
|
|
54367
54531
|
return true;
|
|
54368
54532
|
};
|
|
54369
|
-
const requestCellEditRef = (0,
|
|
54533
|
+
const requestCellEditRef = (0, import_react29.useRef)(requestCellEdit);
|
|
54370
54534
|
requestCellEditRef.current = requestCellEdit;
|
|
54371
54535
|
const buildRecordControls = (row) => {
|
|
54372
54536
|
const rowId = getRowId(row);
|
|
@@ -54393,7 +54557,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
54393
54557
|
};
|
|
54394
54558
|
const hierarchyRows = hierarchy?.rows ?? data;
|
|
54395
54559
|
const hierarchyGetParentId = hierarchy?.getParentId;
|
|
54396
|
-
const hierarchyIndex = (0,
|
|
54560
|
+
const hierarchyIndex = (0, import_react29.useMemo)(() => {
|
|
54397
54561
|
if (!hierarchyGetParentId) return null;
|
|
54398
54562
|
const byId = /* @__PURE__ */ new Map();
|
|
54399
54563
|
const parentById = /* @__PURE__ */ new Map();
|
|
@@ -54425,7 +54589,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
54425
54589
|
return { byId, parentById, depthById };
|
|
54426
54590
|
}, [hierarchyGetParentId, hierarchyRows, getRowId]);
|
|
54427
54591
|
const draggedRow = draggedRowId && hierarchyIndex ? hierarchyIndex.byId.get(draggedRowId) : void 0;
|
|
54428
|
-
const hierarchyBlockedIds = (0,
|
|
54592
|
+
const hierarchyBlockedIds = (0, import_react29.useMemo)(() => {
|
|
54429
54593
|
if (!draggedRowId || !hierarchyIndex) return null;
|
|
54430
54594
|
const childrenById = /* @__PURE__ */ new Map();
|
|
54431
54595
|
for (const [id, parentId] of hierarchyIndex.parentById) {
|
|
@@ -54712,16 +54876,16 @@ function MatrxDataTableCore(coreProps) {
|
|
|
54712
54876
|
return [];
|
|
54713
54877
|
}
|
|
54714
54878
|
};
|
|
54715
|
-
const menuSectionsForRef = (0,
|
|
54879
|
+
const menuSectionsForRef = (0, import_react29.useRef)(menuSectionsFor);
|
|
54716
54880
|
menuSectionsForRef.current = menuSectionsFor;
|
|
54717
54881
|
const hasMenuSections = Boolean(contextMenu?.sections);
|
|
54718
|
-
const boundarySections = (0,
|
|
54882
|
+
const boundarySections = (0, import_react29.useCallback)(
|
|
54719
54883
|
(target) => menuSectionsForRef.current(target),
|
|
54720
54884
|
[]
|
|
54721
54885
|
);
|
|
54722
|
-
const resolveMenuLevelRef = (0,
|
|
54886
|
+
const resolveMenuLevelRef = (0, import_react29.useRef)(resolveMenuLevel);
|
|
54723
54887
|
resolveMenuLevelRef.current = resolveMenuLevel;
|
|
54724
|
-
(0,
|
|
54888
|
+
(0, import_react29.useEffect)(() => {
|
|
54725
54889
|
if (!host.rowContextRegistry) return;
|
|
54726
54890
|
return host.rowContextRegistry.register(
|
|
54727
54891
|
tableContextMenuInstanceId,
|
|
@@ -54732,7 +54896,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
54732
54896
|
const lastVisibleColumn = visibleColumns[visibleColumns.length - 1];
|
|
54733
54897
|
const pinnedActionsColumnId = !showActionsCol && lastVisibleColumn?.customActions ? columnId(lastVisibleColumn) : void 0;
|
|
54734
54898
|
const getSelectionId = selection?.getSelectionId ?? getRowId;
|
|
54735
|
-
const selectedIdSet = (0,
|
|
54899
|
+
const selectedIdSet = (0, import_react29.useMemo)(
|
|
54736
54900
|
() => new Set(selection?.selectedIds ?? []),
|
|
54737
54901
|
[selection?.selectedIds]
|
|
54738
54902
|
);
|
|
@@ -54744,7 +54908,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
54744
54908
|
);
|
|
54745
54909
|
const allOnPageSelected = selectableRows.length > 0 && selectedOnPage.length === selectableRows.length;
|
|
54746
54910
|
const someOnPageSelected = selectedOnPage.length > 0 && !allOnPageSelected;
|
|
54747
|
-
const selectedRows = (0,
|
|
54911
|
+
const selectedRows = (0, import_react29.useMemo)(() => {
|
|
54748
54912
|
const resolved = /* @__PURE__ */ new Set();
|
|
54749
54913
|
return data.filter((row) => {
|
|
54750
54914
|
const id = getSelectionId(row);
|
|
@@ -54753,7 +54917,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
54753
54917
|
return true;
|
|
54754
54918
|
});
|
|
54755
54919
|
}, [data, getSelectionId, selectedIdSet]);
|
|
54756
|
-
const lastToggledIndex = (0,
|
|
54920
|
+
const lastToggledIndex = (0, import_react29.useRef)(null);
|
|
54757
54921
|
const setSelectedIds = (next) => selection?.onSelectedIdsChange([...next]);
|
|
54758
54922
|
const toggleRowSelected = (index, shiftKey) => {
|
|
54759
54923
|
if (!selection) return;
|
|
@@ -54794,7 +54958,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
54794
54958
|
}
|
|
54795
54959
|
} : facet
|
|
54796
54960
|
) : toolbar?.facets;
|
|
54797
|
-
const rowLatest = (0,
|
|
54961
|
+
const rowLatest = (0, import_react29.useRef)(null);
|
|
54798
54962
|
const renderRecordCell = (row, col, index, suppliedControls) => {
|
|
54799
54963
|
const id = getRowId(row);
|
|
54800
54964
|
const field = col.accessorKey ? String(col.accessorKey) : columnId(col);
|
|
@@ -54812,13 +54976,13 @@ function MatrxDataTableCore(coreProps) {
|
|
|
54812
54976
|
copy: effectiveCopy,
|
|
54813
54977
|
row: displayRow,
|
|
54814
54978
|
sourceId: `${tableCopySourceNamespace}:row:${getRowId(displayRow)}`,
|
|
54815
|
-
...copy === void 0 ? { defaultColumns:
|
|
54979
|
+
...copy === void 0 ? { defaultColumns: readDeclaredCopyColumns } : {}
|
|
54816
54980
|
}
|
|
54817
54981
|
) : null,
|
|
54818
54982
|
effectiveCopy && showRowCopy ? /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
54819
54983
|
MatrxTableRowAlchemyProvider,
|
|
54820
54984
|
{
|
|
54821
|
-
copy: tableRowCopyProps(effectiveCopy, displayRow, `${tableCopySourceNamespace}:row:${getRowId(displayRow)}`, copy === void 0 ?
|
|
54985
|
+
copy: tableRowCopyProps(effectiveCopy, displayRow, `${tableCopySourceNamespace}:row:${getRowId(displayRow)}`, copy === void 0 ? readDeclaredCopyColumns : void 0),
|
|
54822
54986
|
placement: rowCopyInMenu && columnId(col) === (menuActionsColumn ? columnId(menuActionsColumn) : void 0) ? "menu" : "inline",
|
|
54823
54987
|
controls,
|
|
54824
54988
|
children: content
|
|
@@ -54857,7 +55021,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
54857
55021
|
}
|
|
54858
55022
|
return href ? /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(Link, { href, onClick: (event) => event.stopPropagation(), className: "block w-full min-w-0 rounded outline-none focus-visible:ring-2 focus-visible:ring-ring", children: display }) : display;
|
|
54859
55023
|
};
|
|
54860
|
-
const currentViewSnapshot = (0,
|
|
55024
|
+
const currentViewSnapshot = (0, import_react29.useMemo)(
|
|
54861
55025
|
() => ({
|
|
54862
55026
|
__kind: "matrx-table-view",
|
|
54863
55027
|
version: 1,
|
|
@@ -54893,7 +55057,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
54893
55057
|
]
|
|
54894
55058
|
);
|
|
54895
55059
|
const declaredDefaultSort = urlState ? urlState.defaultSort ?? null : defaultSort;
|
|
54896
|
-
const declaredDefaultViewSnapshot = (0,
|
|
55060
|
+
const declaredDefaultViewSnapshot = (0, import_react29.useMemo)(
|
|
54897
55061
|
() => defaultViewSnapshot ?? {
|
|
54898
55062
|
__kind: "matrx-table-view",
|
|
54899
55063
|
version: 1,
|
|
@@ -54911,7 +55075,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
54911
55075
|
},
|
|
54912
55076
|
[columns, defaultPageSize, declaredDefaultSort, defaultViewSnapshot]
|
|
54913
55077
|
);
|
|
54914
|
-
const applySavedView = (0,
|
|
55078
|
+
const applySavedView = (0, import_react29.useCallback)(
|
|
54915
55079
|
(rawSnapshot) => {
|
|
54916
55080
|
const snapshot = parseTableViewSnapshot(rawSnapshot);
|
|
54917
55081
|
if (!snapshot) {
|
|
@@ -54992,15 +55156,15 @@ function MatrxDataTableCore(coreProps) {
|
|
|
54992
55156
|
const drawn = buildRecordControls(row);
|
|
54993
55157
|
const live = {};
|
|
54994
55158
|
for (const [key, value] of Object.entries(drawn)) {
|
|
54995
|
-
live[key] = typeof value === "function" ? (...args) => {
|
|
55159
|
+
live[key] = typeof value === "function" ? lazyCallback((...args) => {
|
|
54996
55160
|
const now = rowLatest.current.buildRecordControls(row);
|
|
54997
55161
|
const handler = now[key];
|
|
54998
55162
|
return typeof handler === "function" ? handler(...args) : void 0;
|
|
54999
|
-
} : value;
|
|
55163
|
+
}) : value;
|
|
55000
55164
|
}
|
|
55001
55165
|
return live;
|
|
55002
55166
|
};
|
|
55003
|
-
const
|
|
55167
|
+
const rowShape = [
|
|
55004
55168
|
// WHAT A BODY ROW READS FROM THIS TABLE'S PROPS — and nothing it does not, so a host that
|
|
55005
55169
|
// rebuilds its toolbar, its query or its empty state on every render redraws no row. Handlers
|
|
55006
55170
|
// are absent on purpose: they run through `rowLatest`. Columns count by what a body cell
|
|
@@ -55064,7 +55228,12 @@ function MatrxDataTableCore(coreProps) {
|
|
|
55064
55228
|
hierarchyIndex,
|
|
55065
55229
|
hierarchyBlockedIds,
|
|
55066
55230
|
draggedRowId
|
|
55067
|
-
]
|
|
55231
|
+
];
|
|
55232
|
+
const rowEpoch = useRenderEpoch(rowShape.filter((value) => typeof value !== "function" && (typeof value !== "object" || value === null)));
|
|
55233
|
+
const rowProbe = useRenderEpoch(rowShape.filter((value) => typeof value === "function" || typeof value === "object" && value !== null));
|
|
55234
|
+
const rowDrawings = (0, import_react29.useRef)(null);
|
|
55235
|
+
rowDrawings.current ??= new RowDrawings();
|
|
55236
|
+
const drawBodyRow = (rowId, row, index, fresh) => rowDrawings.current.draw(rowId, renderRecordRow(row, index), fresh);
|
|
55068
55237
|
chromeLatest.current = { processed, data, toggleAllOnPage, showMore: progressiveRows.showMore, applySavedView };
|
|
55069
55238
|
const chromeGeometry = [
|
|
55070
55239
|
...Object.entries(effectiveColumnWidths).flat(),
|
|
@@ -55506,7 +55675,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
55506
55675
|
copy: effectiveCopy,
|
|
55507
55676
|
row: displayRow,
|
|
55508
55677
|
sourceId: `${tableCopySourceNamespace}:row:${getRowId(displayRow)}`,
|
|
55509
|
-
...copy === void 0 ? { defaultColumns:
|
|
55678
|
+
...copy === void 0 ? { defaultColumns: readDeclaredCopyColumns } : {}
|
|
55510
55679
|
}
|
|
55511
55680
|
) : null,
|
|
55512
55681
|
renderRowActions(displayRow, controls),
|
|
@@ -55556,7 +55725,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
55556
55725
|
},
|
|
55557
55726
|
`${id}:expanded-detail`
|
|
55558
55727
|
) : null;
|
|
55559
|
-
return hierarchy ? /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
|
|
55728
|
+
return hierarchy ? /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(import_react29.Fragment, { children: [
|
|
55560
55729
|
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
55561
55730
|
HierarchyDroppableRow,
|
|
55562
55731
|
{
|
|
@@ -55566,7 +55735,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
55566
55735
|
}
|
|
55567
55736
|
),
|
|
55568
55737
|
inlineDetail
|
|
55569
|
-
] }, id) : /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
|
|
55738
|
+
] }, id) : /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(import_react29.Fragment, { children: [
|
|
55570
55739
|
wrappedRow,
|
|
55571
55740
|
inlineDetail
|
|
55572
55741
|
] }, id);
|
|
@@ -56142,11 +56311,11 @@ function MatrxDataTableCore(coreProps) {
|
|
|
56142
56311
|
copy: effectiveCopy,
|
|
56143
56312
|
row: displayRow,
|
|
56144
56313
|
sourceId: `${tableCopySourceNamespace}:row:${getRowId(displayRow)}`,
|
|
56145
|
-
...copy === void 0 ? { defaultColumns:
|
|
56314
|
+
...copy === void 0 ? { defaultColumns: readDeclaredCopyColumns } : {}
|
|
56146
56315
|
}
|
|
56147
56316
|
) : null,
|
|
56148
56317
|
renderRowActions(displayRow, controls),
|
|
56149
|
-
visibleColumns.filter((column) => column.customActions).map((column) => /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
56318
|
+
visibleColumns.filter((column) => column.customActions).map((column) => /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_react29.Fragment, { children: renderRecordCell(row, column, index, controls) }, columnId(column)))
|
|
56150
56319
|
]
|
|
56151
56320
|
}
|
|
56152
56321
|
) : null,
|
|
@@ -56583,8 +56752,9 @@ function MatrxDataTableCore(coreProps) {
|
|
|
56583
56752
|
row,
|
|
56584
56753
|
index,
|
|
56585
56754
|
epoch: rowEpoch,
|
|
56755
|
+
probe: rowProbe,
|
|
56586
56756
|
facts: rowFactsFor(row, id, index),
|
|
56587
|
-
|
|
56757
|
+
draw: drawBodyRow
|
|
56588
56758
|
},
|
|
56589
56759
|
id
|
|
56590
56760
|
);
|
|
@@ -57035,7 +57205,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
57035
57205
|
copy: effectiveCopy,
|
|
57036
57206
|
sourceId: `${tableCopySourceNamespace}:row:${getRowId(selectedRow)}`,
|
|
57037
57207
|
row: selectedRow,
|
|
57038
|
-
...copy === void 0 ? { defaultColumns:
|
|
57208
|
+
...copy === void 0 ? { defaultColumns: readDeclaredCopyColumns } : {}
|
|
57039
57209
|
}
|
|
57040
57210
|
) : null,
|
|
57041
57211
|
detail?.headerActions?.(selectedRow),
|
|
@@ -57123,7 +57293,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
57123
57293
|
copy: effectiveCopy,
|
|
57124
57294
|
sourceId: `${tableCopySourceNamespace}:row:${getRowId(windowRow)}`,
|
|
57125
57295
|
row: windowRow,
|
|
57126
|
-
...copy === void 0 ? { defaultColumns:
|
|
57296
|
+
...copy === void 0 ? { defaultColumns: readDeclaredCopyColumns } : {}
|
|
57127
57297
|
}
|
|
57128
57298
|
) : null
|
|
57129
57299
|
] }),
|
|
@@ -57286,7 +57456,7 @@ function HierarchyDragIndicatorLayer({
|
|
|
57286
57456
|
scrollRef,
|
|
57287
57457
|
resolve: resolve2
|
|
57288
57458
|
}) {
|
|
57289
|
-
const [indicator, setIndicator] = (0,
|
|
57459
|
+
const [indicator, setIndicator] = (0, import_react29.useState)(
|
|
57290
57460
|
null
|
|
57291
57461
|
);
|
|
57292
57462
|
(0, import_core3.useDndMonitor)({
|
|
@@ -57390,9 +57560,9 @@ function HierarchyDroppableRow({
|
|
|
57390
57560
|
children
|
|
57391
57561
|
}) {
|
|
57392
57562
|
const { setNodeRef } = (0, import_core3.useDroppable)({ id, disabled });
|
|
57393
|
-
if (!(0,
|
|
57563
|
+
if (!(0, import_react29.isValidElement)(children) || children.type !== "tr") return children;
|
|
57394
57564
|
const row = children;
|
|
57395
|
-
return (0,
|
|
57565
|
+
return (0, import_react29.cloneElement)(row, {
|
|
57396
57566
|
ref: setNodeRef,
|
|
57397
57567
|
className: row.props.className
|
|
57398
57568
|
});
|
|
@@ -57486,7 +57656,7 @@ function columnWidthVar(width, resizedWidth, id, resizable) {
|
|
|
57486
57656
|
};
|
|
57487
57657
|
}
|
|
57488
57658
|
function DefaultJsonCell({ value }) {
|
|
57489
|
-
const [open, setOpen] = (0,
|
|
57659
|
+
const [open, setOpen] = (0, import_react29.useState)(false);
|
|
57490
57660
|
const host = useMatrxDataTableHost();
|
|
57491
57661
|
const Viewer = host.JsonViewer;
|
|
57492
57662
|
const text = JSON.stringify(value, null, 2);
|
|
@@ -57566,7 +57736,7 @@ function resolveStringTitle(title, fallback) {
|
|
|
57566
57736
|
}
|
|
57567
57737
|
|
|
57568
57738
|
// src/data-table/MatrxTableCard.tsx
|
|
57569
|
-
var
|
|
57739
|
+
var import_react30 = require("react");
|
|
57570
57740
|
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
57571
57741
|
function nounText(noun) {
|
|
57572
57742
|
return `${noun.count.toLocaleString()} ${noun.count === 1 ? noun.singular : noun.plural}`;
|
|
@@ -57590,10 +57760,10 @@ function MatrxTableCard({
|
|
|
57590
57760
|
className
|
|
57591
57761
|
}) {
|
|
57592
57762
|
const { Link } = useMatrxDataTableHost();
|
|
57593
|
-
const [toolbarSlot, setToolbarSlot] = (0,
|
|
57594
|
-
const [footerSlot, setFooterSlot] = (0,
|
|
57595
|
-
const [reportedTotal, setReportedTotal] = (0,
|
|
57596
|
-
const context = (0,
|
|
57763
|
+
const [toolbarSlot, setToolbarSlot] = (0, import_react30.useState)(null);
|
|
57764
|
+
const [footerSlot, setFooterSlot] = (0, import_react30.useState)(null);
|
|
57765
|
+
const [reportedTotal, setReportedTotal] = (0, import_react30.useState)(void 0);
|
|
57766
|
+
const context = (0, import_react30.useMemo)(
|
|
57597
57767
|
() => ({ appearance: "embedded", toolbarSlot, footerSlot, initialRows, reportTotal: setReportedTotal }),
|
|
57598
57768
|
[toolbarSlot, footerSlot, initialRows]
|
|
57599
57769
|
);
|
|
@@ -57706,7 +57876,7 @@ function MatrxTableCardEmpty({ message, action, children }) {
|
|
|
57706
57876
|
}
|
|
57707
57877
|
|
|
57708
57878
|
// src/data-table/SavedViewsControl.tsx
|
|
57709
|
-
var
|
|
57879
|
+
var import_react31 = require("react");
|
|
57710
57880
|
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
57711
57881
|
function SavedViewsControl({
|
|
57712
57882
|
views,
|
|
@@ -57723,14 +57893,14 @@ function SavedViewsControl({
|
|
|
57723
57893
|
onRemove,
|
|
57724
57894
|
related
|
|
57725
57895
|
}) {
|
|
57726
|
-
const unsavedChangesId = (0,
|
|
57727
|
-
const [saveOpen, setSaveOpen] = (0,
|
|
57728
|
-
const [name, setName] = (0,
|
|
57729
|
-
const [saving, setSaving] = (0,
|
|
57730
|
-
const [removing, setRemoving] = (0,
|
|
57731
|
-
const [actionError, setActionError] = (0,
|
|
57732
|
-
const [pendingSelect, setPendingSelect] = (0,
|
|
57733
|
-
const [pendingRemove, setPendingRemove] = (0,
|
|
57896
|
+
const unsavedChangesId = (0, import_react31.useId)();
|
|
57897
|
+
const [saveOpen, setSaveOpen] = (0, import_react31.useState)(false);
|
|
57898
|
+
const [name, setName] = (0, import_react31.useState)("");
|
|
57899
|
+
const [saving, setSaving] = (0, import_react31.useState)(false);
|
|
57900
|
+
const [removing, setRemoving] = (0, import_react31.useState)(false);
|
|
57901
|
+
const [actionError, setActionError] = (0, import_react31.useState)(null);
|
|
57902
|
+
const [pendingSelect, setPendingSelect] = (0, import_react31.useState)(void 0);
|
|
57903
|
+
const [pendingRemove, setPendingRemove] = (0, import_react31.useState)(null);
|
|
57734
57904
|
const visibleError = actionError ?? error;
|
|
57735
57905
|
const select = (id) => {
|
|
57736
57906
|
if (id === activeId) return;
|
|
@@ -57948,7 +58118,7 @@ function downloadTableAsXlsx({
|
|
|
57948
58118
|
}
|
|
57949
58119
|
|
|
57950
58120
|
// src/data-table/drill-url-state.ts
|
|
57951
|
-
var
|
|
58121
|
+
var import_react32 = require("react");
|
|
57952
58122
|
var import_url_state4 = require("@ai-matrx/kit/url-state");
|
|
57953
58123
|
function useDrillUrlState({
|
|
57954
58124
|
fallback,
|
|
@@ -57956,19 +58126,19 @@ function useDrillUrlState({
|
|
|
57956
58126
|
}) {
|
|
57957
58127
|
const params = (0, import_url_state4.useUrlSearchParams)();
|
|
57958
58128
|
const fallbackKey = JSON.stringify(fallback);
|
|
57959
|
-
const question = (0,
|
|
58129
|
+
const question = (0, import_react32.useMemo)(
|
|
57960
58130
|
() => drillQuestionFromParams(params, JSON.parse(fallbackKey), prefix),
|
|
57961
58131
|
[params, fallbackKey, prefix]
|
|
57962
58132
|
);
|
|
57963
58133
|
const fromAddress = addressHasDrill(params, prefix);
|
|
57964
|
-
const setQuestion = (0,
|
|
58134
|
+
const setQuestion = (0, import_react32.useCallback)(
|
|
57965
58135
|
(next) => {
|
|
57966
58136
|
const current = new URLSearchParams(window.location.search);
|
|
57967
58137
|
(0, import_url_state4.commitUrlParams)(drillQuestionToParams(next, current, prefix), "push");
|
|
57968
58138
|
},
|
|
57969
58139
|
[prefix]
|
|
57970
58140
|
);
|
|
57971
|
-
const clearAddress = (0,
|
|
58141
|
+
const clearAddress = (0, import_react32.useCallback)(() => {
|
|
57972
58142
|
const current = new URLSearchParams(window.location.search);
|
|
57973
58143
|
const patch = drillQuestionToParams({ by: [], across: null, show: [], where: [] }, current, prefix);
|
|
57974
58144
|
(0, import_url_state4.commitUrlParams)(patch, "replace");
|