@ai-matrx/design-system 0.57.0 → 0.59.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +33 -0
- package/dist/data-table/index.cjs +611 -445
- package/dist/data-table/index.cjs.map +1 -1
- package/dist/data-table/index.js +200 -34
- 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) {
|
|
35796
|
+
const previous = this.rows.get(rowId);
|
|
35797
|
+
if (previous) {
|
|
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,12 @@ 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]));
|
|
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]));
|
|
52554
52711
|
}
|
|
52555
|
-
var MatrxTableBodyRow = (0,
|
|
52556
|
-
return
|
|
52712
|
+
var MatrxTableBodyRow = (0, import_react29.memo)(function MatrxTableBodyRow2({ rowId, row, index, draw }) {
|
|
52713
|
+
return draw(rowId, row, index);
|
|
52557
52714
|
}, sameBodyRow);
|
|
52558
|
-
var MatrxTableChrome = (0,
|
|
52715
|
+
var MatrxTableChrome = (0, import_react29.memo)(function MatrxTableChrome2({ render }) {
|
|
52559
52716
|
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_jsx_runtime59.Fragment, { children: render() });
|
|
52560
52717
|
}, (a, b) => a.part === b.part && a.epoch === b.epoch);
|
|
52561
52718
|
function columnsSignature(columns) {
|
|
@@ -52653,7 +52810,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
52653
52810
|
fitToWidth = false,
|
|
52654
52811
|
appearance = "standalone"
|
|
52655
52812
|
} = coreProps;
|
|
52656
|
-
const columns = (0,
|
|
52813
|
+
const columns = (0, import_react29.useMemo)(() => suppliedColumns.filter((column) => !("customActions" in column) || column.customActions !== void 0).map((column) => {
|
|
52657
52814
|
if (!column.customActions) return column;
|
|
52658
52815
|
const {
|
|
52659
52816
|
accessorKey: _key,
|
|
@@ -52668,11 +52825,11 @@ function MatrxDataTableCore(coreProps) {
|
|
|
52668
52825
|
}), [suppliedColumns]);
|
|
52669
52826
|
const embedded = appearance === "embedded";
|
|
52670
52827
|
const zebra = suppliedZebra ?? !embedded;
|
|
52671
|
-
const tableCard = (0,
|
|
52828
|
+
const tableCard = (0, import_react29.useContext)(TableCardOwnerContext);
|
|
52672
52829
|
const selectionConfig = suppliedSelectionConfig === false ? void 0 : suppliedSelectionConfig;
|
|
52673
52830
|
const appendQuery = query?.mode === "controlled-append" ? query : null;
|
|
52674
52831
|
const appendQueryKey = appendQuery?.pagination.queryKey ?? null;
|
|
52675
|
-
const committedAppendQueryKey = (0,
|
|
52832
|
+
const committedAppendQueryKey = (0, import_react29.useRef)(appendQueryKey);
|
|
52676
52833
|
const appendSourceChanged = appendQuery !== null && committedAppendQueryKey.current !== appendQueryKey;
|
|
52677
52834
|
const data = (appendQuery ? appendQuery.pagination.rows : suppliedData) ?? EMPTY_TABLE_ROWS;
|
|
52678
52835
|
const readView = tableReadView(read, data.length, appendQuery ? appendQuery.pagination.loading : suppliedLoading);
|
|
@@ -52690,16 +52847,16 @@ function MatrxDataTableCore(coreProps) {
|
|
|
52690
52847
|
const Link = host.Link ?? DefaultTableLink;
|
|
52691
52848
|
const SidePanelSurface = host.SidePanelSurface ?? DefaultTableSidePanel;
|
|
52692
52849
|
const { notify: toast, notice } = useTableNotice();
|
|
52693
|
-
const [savedViewError, setSavedViewError] = (0,
|
|
52694
|
-
const [toolbarActionError, setToolbarActionError] = (0,
|
|
52695
|
-
const [toolbarActionPending, setToolbarActionPending] = (0,
|
|
52696
|
-
const toolbarActionPendingRef = (0,
|
|
52850
|
+
const [savedViewError, setSavedViewError] = (0, import_react29.useState)(null);
|
|
52851
|
+
const [toolbarActionError, setToolbarActionError] = (0, import_react29.useState)(null);
|
|
52852
|
+
const [toolbarActionPending, setToolbarActionPending] = (0, import_react29.useState)({ refresh: false, add: false });
|
|
52853
|
+
const toolbarActionPendingRef = (0, import_react29.useRef)({ refresh: false, add: false });
|
|
52697
52854
|
const CHECKBOX_TAP_AREA = "h-4 w-4 touch-manipulation";
|
|
52698
52855
|
const mobileCardsClass = mobileCardsBreakpoint === "lg" ? "lg:hidden" : "sm:hidden";
|
|
52699
52856
|
const tableWithCardsClass = mobileCardsBreakpoint === "lg" ? "max-lg:hidden" : "max-sm:hidden";
|
|
52700
52857
|
const cardsQuery = mobileCardsBreakpoint === "lg" ? "(max-width: 1023px)" : "(max-width: 639px)";
|
|
52701
|
-
const [cardsActive, setCardsActive] = (0,
|
|
52702
|
-
(0,
|
|
52858
|
+
const [cardsActive, setCardsActive] = (0, import_react29.useState)(null);
|
|
52859
|
+
(0, import_react29.useEffect)(() => {
|
|
52703
52860
|
if (!mobileCards || typeof window === "undefined" || !window.matchMedia) return;
|
|
52704
52861
|
const mql = window.matchMedia(cardsQuery);
|
|
52705
52862
|
const read2 = () => setCardsActive(mql.matches);
|
|
@@ -52720,7 +52877,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
52720
52877
|
const sourceOwnsIntelligentSearch = sourceProcessing?.intelligentSearch === "source";
|
|
52721
52878
|
const sourceOwnsSearch = remoteQuery?.mode === "controlled" && sourceProcessing?.search !== "local" || appendQuery !== null && sourceProcessing === void 0 || sourceProcessing?.search === "source" || sourceOwnsIntelligentSearch;
|
|
52722
52879
|
const intelligentSearchEnabled = toolbar?.intelligentSearch !== void 0 && (sourceOwnsIntelligentSearch || remoteQuery === null && !sourceOwnsSearch);
|
|
52723
|
-
const emitControlledQueryChange = (0,
|
|
52880
|
+
const emitControlledQueryChange = (0, import_react29.useCallback)(
|
|
52724
52881
|
(patch, options) => {
|
|
52725
52882
|
if (!controlledQuery) return;
|
|
52726
52883
|
controlledQuery.onStateChange(
|
|
@@ -52729,8 +52886,8 @@ function MatrxDataTableCore(coreProps) {
|
|
|
52729
52886
|
},
|
|
52730
52887
|
[controlledQuery]
|
|
52731
52888
|
);
|
|
52732
|
-
const [internalSearch, setInternalSearch] = (0,
|
|
52733
|
-
const [draggedRowId, setDraggedRowId] = (0,
|
|
52889
|
+
const [internalSearch, setInternalSearch] = (0, import_react29.useState)("");
|
|
52890
|
+
const [draggedRowId, setDraggedRowId] = (0, import_react29.useState)(null);
|
|
52734
52891
|
const hierarchySensors = (0, import_core3.useSensors)((0, import_core3.useSensor)(import_core3.PointerSensor, POINTER_SENSOR_OPTIONS));
|
|
52735
52892
|
const toolbarSearchControlled = toolbar?.searchValue !== void 0;
|
|
52736
52893
|
const searchValue = controlledQuery ? controlledQuery.state.search : toolbarSearchControlled ? toolbar?.searchValue ?? "" : internalSearch;
|
|
@@ -52742,7 +52899,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
52742
52899
|
}
|
|
52743
52900
|
toolbar?.onSearchChange?.(v);
|
|
52744
52901
|
};
|
|
52745
|
-
const [internalSearchMatchMode, setInternalSearchMatchMode] = (0,
|
|
52902
|
+
const [internalSearchMatchMode, setInternalSearchMatchMode] = (0, import_react29.useState)(
|
|
52746
52903
|
toolbar?.searchMatch?.defaultMode ?? "contains"
|
|
52747
52904
|
);
|
|
52748
52905
|
const searchMatchMode = controlledQuery ? controlledQuery.state.searchMatchMode ?? toolbar?.searchMatch?.defaultMode ?? "contains" : internalSearchMatchMode;
|
|
@@ -52753,7 +52910,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
52753
52910
|
}
|
|
52754
52911
|
setInternalSearchMatchMode(mode);
|
|
52755
52912
|
};
|
|
52756
|
-
const [internalSearchScope, setInternalSearchScope] = (0,
|
|
52913
|
+
const [internalSearchScope, setInternalSearchScope] = (0, import_react29.useState)("all");
|
|
52757
52914
|
const searchScope = controlledQuery ? controlledQuery.state.searchScope ?? "all" : internalSearchScope;
|
|
52758
52915
|
const setSearchScope = (scope) => {
|
|
52759
52916
|
if (controlledQuery) {
|
|
@@ -52762,7 +52919,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
52762
52919
|
}
|
|
52763
52920
|
setInternalSearchScope(scope);
|
|
52764
52921
|
};
|
|
52765
|
-
const [internalAnyOf, setInternalAnyOf] = (0,
|
|
52922
|
+
const [internalAnyOf, setInternalAnyOf] = (0, import_react29.useState)("");
|
|
52766
52923
|
const toolbarAnyOfControlled = toolbar?.anyOf?.value !== void 0;
|
|
52767
52924
|
const anyOfValue = controlledQuery ? controlledQuery.state.anyOf : toolbarAnyOfControlled ? toolbar?.anyOf?.value ?? "" : internalAnyOf;
|
|
52768
52925
|
const setAnyOfValue = (v) => {
|
|
@@ -52773,7 +52930,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
52773
52930
|
}
|
|
52774
52931
|
toolbar?.anyOf?.onChange?.(v);
|
|
52775
52932
|
};
|
|
52776
|
-
const [internalLayeredFilters, setInternalLayeredFilters] = (0,
|
|
52933
|
+
const [internalLayeredFilters, setInternalLayeredFilters] = (0, import_react29.useState)([]);
|
|
52777
52934
|
const layeredFilters = controlledQuery ? controlledQuery.state.layeredFilters ?? NO_LAYERED_FILTERS : internalLayeredFilters;
|
|
52778
52935
|
const setLayeredFilters = (next) => {
|
|
52779
52936
|
if (controlledQuery) {
|
|
@@ -52782,9 +52939,9 @@ function MatrxDataTableCore(coreProps) {
|
|
|
52782
52939
|
}
|
|
52783
52940
|
setInternalLayeredFilters(next);
|
|
52784
52941
|
};
|
|
52785
|
-
const [internalColumnFilters, setInternalColumnFilters] = (0,
|
|
52942
|
+
const [internalColumnFilters, setInternalColumnFilters] = (0, import_react29.useState)({});
|
|
52786
52943
|
const columnFilters = controlledQuery ? controlledQuery.state.columnFilters : internalColumnFilters;
|
|
52787
|
-
const localColumnFilters = (0,
|
|
52944
|
+
const localColumnFilters = (0, import_react29.useMemo)(() => {
|
|
52788
52945
|
if (appendDefaultsToSourceProcessing) return {};
|
|
52789
52946
|
if (sourceColumnFilterOwnership === "source") return {};
|
|
52790
52947
|
if (sourceColumnFilterOwnership === void 0 || sourceColumnFilterOwnership === "local") {
|
|
@@ -52806,7 +52963,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
52806
52963
|
}
|
|
52807
52964
|
setInternalColumnFilters(nextFilters);
|
|
52808
52965
|
};
|
|
52809
|
-
const [internalSort, setInternalSort] = (0,
|
|
52966
|
+
const [internalSort, setInternalSort] = (0, import_react29.useState)(defaultSort);
|
|
52810
52967
|
const sort = controlledQuery ? controlledQuery.state.sort : internalSort;
|
|
52811
52968
|
const setSort = (next) => {
|
|
52812
52969
|
if (controlledQuery) {
|
|
@@ -52815,7 +52972,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
52815
52972
|
}
|
|
52816
52973
|
setInternalSort(next);
|
|
52817
52974
|
};
|
|
52818
|
-
const [internalPage, setInternalPage] = (0,
|
|
52975
|
+
const [internalPage, setInternalPage] = (0, import_react29.useState)(1);
|
|
52819
52976
|
const page = controlledQuery ? controlledQuery.state.page : internalPage;
|
|
52820
52977
|
const setPage = (next) => {
|
|
52821
52978
|
if (controlledQuery) {
|
|
@@ -52824,7 +52981,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
52824
52981
|
}
|
|
52825
52982
|
setInternalPage(next);
|
|
52826
52983
|
};
|
|
52827
|
-
const [internalPageSize, setInternalPageSize] = (0,
|
|
52984
|
+
const [internalPageSize, setInternalPageSize] = (0, import_react29.useState)(
|
|
52828
52985
|
defaultPageSize
|
|
52829
52986
|
);
|
|
52830
52987
|
const pageSize = controlledQuery ? controlledQuery.state.pageSize : internalPageSize;
|
|
@@ -52835,29 +52992,29 @@ function MatrxDataTableCore(coreProps) {
|
|
|
52835
52992
|
}
|
|
52836
52993
|
setInternalPageSize(next);
|
|
52837
52994
|
};
|
|
52838
|
-
const [uncontrolledSelectedId, setUncontrolledSelectedId] = (0,
|
|
52995
|
+
const [uncontrolledSelectedId, setUncontrolledSelectedId] = (0, import_react29.useState)(null);
|
|
52839
52996
|
const rawSelectedId = controlledSelectedId !== void 0 ? controlledSelectedId : uncontrolledSelectedId;
|
|
52840
52997
|
const selectedId = appendSourceChanged ? null : rawSelectedId;
|
|
52841
|
-
const [openRequest, setOpenRequest] = (0,
|
|
52998
|
+
const [openRequest, setOpenRequest] = (0, import_react29.useState)(0);
|
|
52842
52999
|
const setSelectedId = (id) => {
|
|
52843
53000
|
if (controlledSelectedId === void 0) setUncontrolledSelectedId(id);
|
|
52844
53001
|
onSelectedIdChange?.(id);
|
|
52845
53002
|
};
|
|
52846
|
-
const [uncontrolledWindowRowId, setUncontrolledWindowRowId] = (0,
|
|
53003
|
+
const [uncontrolledWindowRowId, setUncontrolledWindowRowId] = (0, import_react29.useState)(null);
|
|
52847
53004
|
const rawWindowRowId = controlledWindowRowId !== void 0 ? controlledWindowRowId : uncontrolledWindowRowId;
|
|
52848
53005
|
const windowRowId = appendSourceChanged ? null : rawWindowRowId;
|
|
52849
53006
|
const setWindowRowId = (id) => {
|
|
52850
53007
|
if (controlledWindowRowId === void 0) setUncontrolledWindowRowId(id);
|
|
52851
53008
|
onWindowRowIdChange?.(id);
|
|
52852
53009
|
};
|
|
52853
|
-
const [windowRowSnapshot, setWindowRowSnapshot] = (0,
|
|
53010
|
+
const [windowRowSnapshot, setWindowRowSnapshot] = (0, import_react29.useState)(null);
|
|
52854
53011
|
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,
|
|
53012
|
+
const [editsByScope, setEditsByScope] = (0, import_react29.useState)({});
|
|
53013
|
+
const editRevisionRef = (0, import_react29.useRef)({});
|
|
53014
|
+
const [savingByScope, setSavingByScope] = (0, import_react29.useState)({});
|
|
53015
|
+
const savingScopesRef = (0, import_react29.useRef)(/* @__PURE__ */ new Set());
|
|
53016
|
+
const [editRequest, setEditRequest] = (0, import_react29.useState)(null);
|
|
53017
|
+
const [confirmForeignDraftDiscard, setConfirmForeignDraftDiscard] = (0, import_react29.useState)(false);
|
|
52861
53018
|
const edits = editsByScope[editScopeKey]?.values ?? {};
|
|
52862
53019
|
const saving = (savingByScope[editScopeKey] ?? 0) > 0;
|
|
52863
53020
|
const setEdits = (next) => {
|
|
@@ -52924,7 +53081,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
52924
53081
|
rows: Object.entries(draft.values).map(([rowId, columns2]) => ({ rowId, columns: columns2 }))
|
|
52925
53082
|
}));
|
|
52926
53083
|
const selection = appendSourceChanged && selectionConfig ? { ...selectionConfig, selectedIds: [] } : selectionConfig;
|
|
52927
|
-
(0,
|
|
53084
|
+
(0, import_react29.useEffect)(() => {
|
|
52928
53085
|
const previous = committedAppendQueryKey.current;
|
|
52929
53086
|
committedAppendQueryKey.current = appendQueryKey;
|
|
52930
53087
|
if (previous === null || appendQueryKey === null || previous === appendQueryKey) {
|
|
@@ -52942,15 +53099,15 @@ function MatrxDataTableCore(coreProps) {
|
|
|
52942
53099
|
onWindowRowIdChange,
|
|
52943
53100
|
selectionConfig
|
|
52944
53101
|
]);
|
|
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,
|
|
53102
|
+
const scrollRef = (0, import_react29.useRef)(null);
|
|
53103
|
+
const tableRef = (0, import_react29.useRef)(null);
|
|
53104
|
+
const tableHeaderRef = (0, import_react29.useRef)(null);
|
|
53105
|
+
const cardsScrollRef = (0, import_react29.useRef)(null);
|
|
53106
|
+
const scrollContainers = (0, import_react29.useMemo)(() => [scrollRef, cardsScrollRef], []);
|
|
53107
|
+
const [documentStickyHeader, setDocumentStickyHeader] = (0, import_react29.useState)(false);
|
|
53108
|
+
const documentStickyHeaderRef = (0, import_react29.useRef)(false);
|
|
53109
|
+
const previousAppendKeyForScrollReset = (0, import_react29.useRef)(appendQueryKey);
|
|
53110
|
+
(0, import_react29.useLayoutEffect)(() => {
|
|
52954
53111
|
const previous = previousAppendKeyForScrollReset.current;
|
|
52955
53112
|
previousAppendKeyForScrollReset.current = appendQueryKey;
|
|
52956
53113
|
if (previous === null || appendQueryKey === null || previous === appendQueryKey) {
|
|
@@ -52975,15 +53132,15 @@ function MatrxDataTableCore(coreProps) {
|
|
|
52975
53132
|
...appendScrollPolicy?.mode === "scroll" && appendScrollPolicy.thresholdPx !== void 0 ? { thresholdPx: appendScrollPolicy.thresholdPx } : {},
|
|
52976
53133
|
...appendScrollPolicy?.mode === "scroll" && appendScrollPolicy.intentTimeoutMs !== void 0 ? { intentTimeoutMs: appendScrollPolicy.intentTimeoutMs } : {}
|
|
52977
53134
|
});
|
|
52978
|
-
const rootRef = (0,
|
|
53135
|
+
const rootRef = (0, import_react29.useRef)(null);
|
|
52979
53136
|
useClippedContentGuard(rootRef, {
|
|
52980
53137
|
label: typeof copy === "object" && copy.listLabel ? `Table: ${copy.listLabel}` : "MatrxDataTable"
|
|
52981
53138
|
});
|
|
52982
|
-
const [scrollHintRight, setScrollHintRight] = (0,
|
|
52983
|
-
const [scrollHintLeft, setScrollHintLeft] = (0,
|
|
52984
|
-
const [scrollHintRightInset, setScrollHintRightInset] = (0,
|
|
52985
|
-
const hintScrollLeft = (0,
|
|
52986
|
-
const updateScrollHint = (0,
|
|
53139
|
+
const [scrollHintRight, setScrollHintRight] = (0, import_react29.useState)(false);
|
|
53140
|
+
const [scrollHintLeft, setScrollHintLeft] = (0, import_react29.useState)(false);
|
|
53141
|
+
const [scrollHintRightInset, setScrollHintRightInset] = (0, import_react29.useState)(6);
|
|
53142
|
+
const hintScrollLeft = (0, import_react29.useRef)(0);
|
|
53143
|
+
const updateScrollHint = (0, import_react29.useCallback)(() => {
|
|
52987
53144
|
const el = scrollRef.current;
|
|
52988
53145
|
if (!el) return;
|
|
52989
53146
|
hintScrollLeft.current = el.scrollLeft;
|
|
@@ -52993,7 +53150,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
52993
53150
|
setScrollHintLeft(hasRows && el.scrollLeft > 2);
|
|
52994
53151
|
setScrollHintRightInset(actions ? Math.ceil(actions.getBoundingClientRect().width) + 6 : 6);
|
|
52995
53152
|
}, []);
|
|
52996
|
-
const onTableScroll = (0,
|
|
53153
|
+
const onTableScroll = (0, import_react29.useCallback)(() => {
|
|
52997
53154
|
const el = scrollRef.current;
|
|
52998
53155
|
if (!el || el.scrollLeft === hintScrollLeft.current) return;
|
|
52999
53156
|
updateScrollHint();
|
|
@@ -53006,7 +53163,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53006
53163
|
behavior: "smooth"
|
|
53007
53164
|
});
|
|
53008
53165
|
};
|
|
53009
|
-
(0,
|
|
53166
|
+
(0, import_react29.useEffect)(() => {
|
|
53010
53167
|
window.addEventListener("resize", updateScrollHint);
|
|
53011
53168
|
const el = scrollRef.current;
|
|
53012
53169
|
const observer = el && typeof ResizeObserver !== "undefined" ? new ResizeObserver(updateScrollHint) : null;
|
|
@@ -53021,7 +53178,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53021
53178
|
observer?.disconnect();
|
|
53022
53179
|
};
|
|
53023
53180
|
}, [updateScrollHint, data, columns]);
|
|
53024
|
-
(0,
|
|
53181
|
+
(0, import_react29.useLayoutEffect)(() => {
|
|
53025
53182
|
const scroll = scrollRef.current;
|
|
53026
53183
|
const table = tableRef.current;
|
|
53027
53184
|
const header = tableHeaderRef.current;
|
|
@@ -53080,30 +53237,30 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53080
53237
|
window.removeEventListener("resize", requestUpdate);
|
|
53081
53238
|
};
|
|
53082
53239
|
}, [stickyHeader, data, columns]);
|
|
53083
|
-
const [columnOrder, setColumnOrder] = (0,
|
|
53084
|
-
const [hiddenColumnIds, setHiddenColumnIds] = (0,
|
|
53240
|
+
const [columnOrder, setColumnOrder] = (0, import_react29.useState)(() => columnState?.order ?? columns.map(columnId));
|
|
53241
|
+
const [hiddenColumnIds, setHiddenColumnIds] = (0, import_react29.useState)(
|
|
53085
53242
|
() => new Set(columnState?.hidden ?? columns.filter((column) => column.hidden).map(columnId))
|
|
53086
53243
|
);
|
|
53087
|
-
const [columnWidths, setColumnWidths] = (0,
|
|
53244
|
+
const [columnWidths, setColumnWidths] = (0, import_react29.useState)(
|
|
53088
53245
|
() => normalizeColumnWidthsForColumns(columnState?.widths, columns)
|
|
53089
53246
|
);
|
|
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,
|
|
53247
|
+
const [fixedTableGeometry, setFixedTableGeometry] = (0, import_react29.useState)(null);
|
|
53248
|
+
const knownColumnIds = (0, import_react29.useRef)(new Set(columns.map(columnId)));
|
|
53249
|
+
const draggedColumnId = (0, import_react29.useRef)(null);
|
|
53250
|
+
const columnDragActive = (0, import_react29.useRef)(false);
|
|
53251
|
+
const columnDragRaf = (0, import_react29.useRef)(null);
|
|
53252
|
+
const columnDragScrollDirection = (0, import_react29.useRef)(0);
|
|
53253
|
+
const [columnDragPreview, setColumnDragPreview] = (0, import_react29.useState)(null);
|
|
53254
|
+
const stopColumnDragScroll = (0, import_react29.useCallback)(() => {
|
|
53098
53255
|
if (columnDragRaf.current !== null) cancelAnimationFrame(columnDragRaf.current);
|
|
53099
53256
|
columnDragRaf.current = null;
|
|
53100
53257
|
columnDragScrollDirection.current = 0;
|
|
53101
53258
|
}, []);
|
|
53102
|
-
(0,
|
|
53259
|
+
(0, import_react29.useEffect)(() => () => {
|
|
53103
53260
|
columnDragActive.current = false;
|
|
53104
53261
|
stopColumnDragScroll();
|
|
53105
53262
|
}, [stopColumnDragScroll]);
|
|
53106
|
-
const startColumnDragScroll = (0,
|
|
53263
|
+
const startColumnDragScroll = (0, import_react29.useCallback)(() => {
|
|
53107
53264
|
if (!columnDragActive.current || columnDragRaf.current !== null) return;
|
|
53108
53265
|
const scrollStep = () => {
|
|
53109
53266
|
const scroll = scrollRef.current;
|
|
@@ -53130,25 +53287,25 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53130
53287
|
};
|
|
53131
53288
|
columnDragRaf.current = requestAnimationFrame(scrollStep);
|
|
53132
53289
|
}, []);
|
|
53133
|
-
const commitColumnState = (0,
|
|
53290
|
+
const commitColumnState = (0, import_react29.useCallback)((order, hidden) => {
|
|
53134
53291
|
if (columnState) columnState.onChange({ order, hidden: [...hidden] });
|
|
53135
53292
|
else {
|
|
53136
53293
|
setColumnOrder(order);
|
|
53137
53294
|
setHiddenColumnIds(hidden);
|
|
53138
53295
|
}
|
|
53139
53296
|
}, [columnState]);
|
|
53140
|
-
const [internalColumnManagerOpen, setInternalColumnManagerOpen] = (0,
|
|
53297
|
+
const [internalColumnManagerOpen, setInternalColumnManagerOpen] = (0, import_react29.useState)(false);
|
|
53141
53298
|
const columnManagerOpen = controlledColumnManager?.open ?? internalColumnManagerOpen;
|
|
53142
53299
|
const setColumnManagerOpen = controlledColumnManager?.onOpenChange ?? setInternalColumnManagerOpen;
|
|
53143
|
-
const columnIds = (0,
|
|
53144
|
-
const effectiveColumnOrder = (0,
|
|
53145
|
-
const effectiveHiddenColumnIds = (0,
|
|
53146
|
-
const effectiveColumnWidths = (0,
|
|
53300
|
+
const columnIds = (0, import_react29.useMemo)(() => columns.map(columnId), [columns]);
|
|
53301
|
+
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]);
|
|
53302
|
+
const effectiveHiddenColumnIds = (0, import_react29.useMemo)(() => columnState ? new Set(columnState.hidden.filter((id) => columnIds.includes(id))) : hiddenColumnIds, [columnIds, columnState, hiddenColumnIds]);
|
|
53303
|
+
const effectiveColumnWidths = (0, import_react29.useMemo)(
|
|
53147
53304
|
() => normalizeColumnWidthsForColumns(columnState?.widths ?? columnWidths, columns),
|
|
53148
53305
|
[columns, columnState?.widths, columnWidths]
|
|
53149
53306
|
);
|
|
53150
|
-
const resizeGestureSnapshotRef = (0,
|
|
53151
|
-
const measureVisibleColumnWidths = (0,
|
|
53307
|
+
const resizeGestureSnapshotRef = (0, import_react29.useRef)(null);
|
|
53308
|
+
const measureVisibleColumnWidths = (0, import_react29.useCallback)(() => {
|
|
53152
53309
|
const measured = {};
|
|
53153
53310
|
const headers = tableRef.current ? Array.from(tableRef.current.querySelectorAll(
|
|
53154
53311
|
"thead th[data-matrx-table-column-id]"
|
|
@@ -53162,7 +53319,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53162
53319
|
}
|
|
53163
53320
|
return normalizeColumnWidthsForColumns(measured, columns);
|
|
53164
53321
|
}, [columns]);
|
|
53165
|
-
const measureFixedTableGeometry = (0,
|
|
53322
|
+
const measureFixedTableGeometry = (0, import_react29.useCallback)(() => {
|
|
53166
53323
|
const table = tableRef.current;
|
|
53167
53324
|
const headers = table ? Array.from(table.querySelectorAll("thead th")) : [];
|
|
53168
53325
|
const widthFor = (selector) => {
|
|
@@ -53197,16 +53354,16 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53197
53354
|
...actionsWidth === void 0 ? {} : { actionsWidth }
|
|
53198
53355
|
};
|
|
53199
53356
|
}, [resolvedDensity]);
|
|
53200
|
-
const captureResizeGestureSnapshot = (0,
|
|
53357
|
+
const captureResizeGestureSnapshot = (0, import_react29.useCallback)(() => {
|
|
53201
53358
|
resizeGestureSnapshotRef.current = {
|
|
53202
53359
|
widths: measureVisibleColumnWidths(),
|
|
53203
53360
|
geometry: measureFixedTableGeometry()
|
|
53204
53361
|
};
|
|
53205
53362
|
}, [measureFixedTableGeometry, measureVisibleColumnWidths]);
|
|
53206
|
-
const clearResizeGestureSnapshot = (0,
|
|
53363
|
+
const clearResizeGestureSnapshot = (0, import_react29.useCallback)(() => {
|
|
53207
53364
|
resizeGestureSnapshotRef.current = null;
|
|
53208
53365
|
}, []);
|
|
53209
|
-
const commitColumnWidths = (0,
|
|
53366
|
+
const commitColumnWidths = (0, import_react29.useCallback)((next, captureInitialWidths = false) => {
|
|
53210
53367
|
const gestureSnapshot = captureInitialWidths ? resizeGestureSnapshotRef.current : null;
|
|
53211
53368
|
resizeGestureSnapshotRef.current = null;
|
|
53212
53369
|
const normalized = normalizeColumnWidthsForColumns(
|
|
@@ -53225,7 +53382,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53225
53382
|
}
|
|
53226
53383
|
setColumnWidths(normalized);
|
|
53227
53384
|
}, [columnIds, columnState, columns, measureFixedTableGeometry, measureVisibleColumnWidths]);
|
|
53228
|
-
(0,
|
|
53385
|
+
(0, import_react29.useEffect)(() => {
|
|
53229
53386
|
const ids = columns.map(columnId);
|
|
53230
53387
|
if (columnState) return;
|
|
53231
53388
|
const previousIds = knownColumnIds.current;
|
|
@@ -53244,31 +53401,31 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53244
53401
|
setColumnWidths((current) => normalizeColumnWidthsForColumns(current, columns));
|
|
53245
53402
|
knownColumnIds.current = new Set(ids);
|
|
53246
53403
|
}, [columns, columnState]);
|
|
53247
|
-
(0,
|
|
53404
|
+
(0, import_react29.useLayoutEffect)(() => {
|
|
53248
53405
|
for (const id of columnIds) {
|
|
53249
53406
|
tableRef.current?.style.removeProperty(columnResizeCssVar(id));
|
|
53250
53407
|
}
|
|
53251
53408
|
});
|
|
53252
|
-
const previewColumnOrder = (0,
|
|
53409
|
+
const previewColumnOrder = (0, import_react29.useMemo)(
|
|
53253
53410
|
() => projectColumnDragOrder(effectiveColumnOrder, columnDragPreview),
|
|
53254
53411
|
[columnDragPreview, effectiveColumnOrder]
|
|
53255
53412
|
);
|
|
53256
53413
|
useColumnReorderAnimation(tableRef, previewColumnOrder.join("\0"), columnDragPreview !== null);
|
|
53257
|
-
const visibleColumns = (0,
|
|
53414
|
+
const visibleColumns = (0, import_react29.useMemo)(() => {
|
|
53258
53415
|
const byId = new Map(columns.map((column) => [columnId(column), column]));
|
|
53259
53416
|
return previewColumnOrder.map((id) => byId.get(id)).filter(
|
|
53260
53417
|
(column) => column !== void 0 && !effectiveHiddenColumnIds.has(columnId(column))
|
|
53261
53418
|
);
|
|
53262
53419
|
}, [columns, effectiveHiddenColumnIds, previewColumnOrder]);
|
|
53263
53420
|
const usesMeasuredFixedLayout = visibleColumns.length > 0 && visibleColumns.every((column) => effectiveColumnWidths[columnId(column)] !== void 0);
|
|
53264
|
-
(0,
|
|
53421
|
+
(0, import_react29.useLayoutEffect)(() => {
|
|
53265
53422
|
if (!usesMeasuredFixedLayout) {
|
|
53266
53423
|
if (fixedTableGeometry !== null) setFixedTableGeometry(null);
|
|
53267
53424
|
return;
|
|
53268
53425
|
}
|
|
53269
53426
|
if (fixedTableGeometry === null) setFixedTableGeometry(measureFixedTableGeometry());
|
|
53270
53427
|
}, [fixedTableGeometry, measureFixedTableGeometry, usesMeasuredFixedLayout]);
|
|
53271
|
-
(0,
|
|
53428
|
+
(0, import_react29.useLayoutEffect)(() => {
|
|
53272
53429
|
if (!usesMeasuredFixedLayout) return;
|
|
53273
53430
|
const table = tableRef.current;
|
|
53274
53431
|
if (!table) return;
|
|
@@ -53292,8 +53449,8 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53292
53449
|
const fixedLayoutActive = usesMeasuredFixedLayout && fixedTableGeometry !== null;
|
|
53293
53450
|
const freezeWanted = visibleColumns.some((column) => column.frozen);
|
|
53294
53451
|
const selectionColumnWidth = fixedTableGeometry?.selectionWidth ?? (selection && (freezeWanted || fitToWidth) ? SELECTION_COLUMN_PX : void 0);
|
|
53295
|
-
const [fitSpace, setFitSpace] = (0,
|
|
53296
|
-
(0,
|
|
53452
|
+
const [fitSpace, setFitSpace] = (0, import_react29.useState)(null);
|
|
53453
|
+
(0, import_react29.useLayoutEffect)(() => {
|
|
53297
53454
|
if (!fitToWidth) {
|
|
53298
53455
|
setFitSpace(null);
|
|
53299
53456
|
return;
|
|
@@ -53336,7 +53493,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53336
53493
|
if (table) observer.observe(table);
|
|
53337
53494
|
return () => observer.disconnect();
|
|
53338
53495
|
}, [fitToWidth, data.length]);
|
|
53339
|
-
const fittedWidths = (0,
|
|
53496
|
+
const fittedWidths = (0, import_react29.useMemo)(() => {
|
|
53340
53497
|
if (!fitToWidth || !fitSpace) return null;
|
|
53341
53498
|
const contentWidth = (col) => col.customActions ? fitSpace.custom[columnId(col)] : void 0;
|
|
53342
53499
|
const keepsItsWidth = (col) => resolveColumnMarker(col) !== void 0 || col.resizable === false && pixelWidth(col.width) !== void 0 || contentWidth(col) !== void 0;
|
|
@@ -53361,7 +53518,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53361
53518
|
}, [fitToWidth, fitSpace, visibleColumns, selection, selectionColumnWidth, effectiveColumnWidths]);
|
|
53362
53519
|
const fitActive = fittedWidths !== null;
|
|
53363
53520
|
const actionsColumnWidth = fitActive && fitSpace ? fitSpace.actions : fixedTableGeometry?.actionsWidth;
|
|
53364
|
-
const frozenColumns = (0,
|
|
53521
|
+
const frozenColumns = (0, import_react29.useMemo)(() => {
|
|
53365
53522
|
if (!freezeWanted) return NO_FROZEN_COLUMNS;
|
|
53366
53523
|
const ids = visibleColumns.map(columnId);
|
|
53367
53524
|
const byId = new Map(visibleColumns.map((column) => [columnId(column), column]));
|
|
@@ -53409,15 +53566,18 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53409
53566
|
const color = cellTintColor(row, id, colId);
|
|
53410
53567
|
return color ? CELL_TINT_CLASS[color] : void 0;
|
|
53411
53568
|
};
|
|
53412
|
-
const declaredVisibleCopyColumns = (0,
|
|
53569
|
+
const declaredVisibleCopyColumns = (0, import_react29.useMemo)(
|
|
53413
53570
|
() => visibleColumns.filter((column) => column.accessorFn !== void 0 || column.accessorKey !== void 0),
|
|
53414
53571
|
[visibleColumns]
|
|
53415
53572
|
);
|
|
53416
|
-
const tableCopySourceNamespace = (0,
|
|
53417
|
-
const tableContextMenuInstanceId = (0,
|
|
53418
|
-
const tableDndContextId = (0,
|
|
53573
|
+
const tableCopySourceNamespace = (0, import_react29.useId)();
|
|
53574
|
+
const tableContextMenuInstanceId = (0, import_react29.useId)();
|
|
53575
|
+
const tableDndContextId = (0, import_react29.useId)();
|
|
53419
53576
|
const defaultCopyTitle = toolbar?.title || "Table";
|
|
53420
|
-
const
|
|
53577
|
+
const copyColumnsLatest = (0, import_react29.useRef)(declaredVisibleCopyColumns);
|
|
53578
|
+
copyColumnsLatest.current = declaredVisibleCopyColumns;
|
|
53579
|
+
const readDeclaredCopyColumns = lazyCallback(() => copyColumnsLatest.current);
|
|
53580
|
+
const defaultCopy = (0, import_react29.useMemo)(() => ({
|
|
53421
53581
|
label: defaultCopyTitle,
|
|
53422
53582
|
listLabel: defaultCopyTitle,
|
|
53423
53583
|
location: defaultCopyTitle,
|
|
@@ -53426,23 +53586,23 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53426
53586
|
listDescription: `${defaultCopyTitle} \u2014 ${remoteQuery ? "current filtered/sorted loaded view" : "current filtered/sorted view"}.`,
|
|
53427
53587
|
listAttributes: (_visible, loaded) => remoteQuery ? { coverage: "loaded-current-view", loaded_count: loaded.length } : { coverage: "current-view" },
|
|
53428
53588
|
humanRow: (row) => formatDefaultTableCopyRecord(
|
|
53429
|
-
projectDefaultTableCopyRow(row,
|
|
53430
|
-
|
|
53589
|
+
projectDefaultTableCopyRow(row, copyColumnsLatest.current),
|
|
53590
|
+
copyColumnsLatest.current
|
|
53431
53591
|
),
|
|
53432
|
-
agentRow: (row) => projectDefaultTableCopyRow(row,
|
|
53433
|
-
}), [defaultCopyTitle,
|
|
53592
|
+
agentRow: (row) => projectDefaultTableCopyRow(row, copyColumnsLatest.current)
|
|
53593
|
+
}), [defaultCopyTitle, remoteQuery]);
|
|
53434
53594
|
const effectiveCopy = copy === false ? void 0 : copy ?? defaultCopy;
|
|
53435
|
-
const visibleDataColumns = (0,
|
|
53595
|
+
const visibleDataColumns = (0, import_react29.useMemo)(() => visibleColumns.filter((column) => !column.customActions), [visibleColumns]);
|
|
53436
53596
|
const effectiveCopyColumns = copy === void 0 ? declaredVisibleCopyColumns : visibleDataColumns;
|
|
53437
53597
|
const copySubsetVariant2 = useCopySubsetVariant();
|
|
53438
|
-
const chromeLatest = (0,
|
|
53598
|
+
const chromeLatest = (0, import_react29.useRef)({
|
|
53439
53599
|
processed: [],
|
|
53440
53600
|
data: [],
|
|
53441
53601
|
toggleAllOnPage: () => void 0,
|
|
53442
53602
|
showMore: async () => void 0,
|
|
53443
53603
|
applySavedView: () => void 0
|
|
53444
53604
|
});
|
|
53445
|
-
const applyLatestSavedView = (0,
|
|
53605
|
+
const applyLatestSavedView = (0, import_react29.useCallback)((snapshot) => chromeLatest.current.applySavedView(snapshot), []);
|
|
53446
53606
|
const copySubsetColumns = () => effectiveCopyColumns.filter((c) => c.filter !== false || c.accessorKey || c.accessorFn).map((c) => ({
|
|
53447
53607
|
id: columnId(c),
|
|
53448
53608
|
header: typeof c.header === "string" ? c.header : columnId(c),
|
|
@@ -53463,7 +53623,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53463
53623
|
serializer: (shaped) => buildViewAgentInput(effectiveCopy, shaped, chromeLatest.current.data, { scope: "custom" })
|
|
53464
53624
|
}), copySubsetSize(rows().length, copySubsetColumns().length))
|
|
53465
53625
|
] : [];
|
|
53466
|
-
const filterMeta = (0,
|
|
53626
|
+
const filterMeta = (0, import_react29.useMemo)(() => {
|
|
53467
53627
|
const meta = /* @__PURE__ */ new Map();
|
|
53468
53628
|
for (const col of visibleColumns) {
|
|
53469
53629
|
const id = columnId(col);
|
|
@@ -53471,14 +53631,14 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53471
53631
|
}
|
|
53472
53632
|
return meta;
|
|
53473
53633
|
}, [visibleColumns, data, remoteQuery]);
|
|
53474
|
-
const intelligentSearchScopes = (0,
|
|
53634
|
+
const intelligentSearchScopes = (0, import_react29.useMemo)(
|
|
53475
53635
|
() => resolveTableSearchScopes(data, columns, {
|
|
53476
53636
|
...toolbar?.intelligentSearch?.roles === void 0 ? {} : { roles: toolbar.intelligentSearch.roles },
|
|
53477
53637
|
...toolbar?.intelligentSearch?.scopes === void 0 ? {} : { scopes: toolbar.intelligentSearch.scopes }
|
|
53478
53638
|
}),
|
|
53479
53639
|
[columns, data, toolbar?.intelligentSearch?.roles, toolbar?.intelligentSearch?.scopes]
|
|
53480
53640
|
);
|
|
53481
|
-
const processed = (0,
|
|
53641
|
+
const processed = (0, import_react29.useMemo)(() => {
|
|
53482
53642
|
if (remoteQuery && !appendUsesLocalProcessing && !remoteQueryUsesLocalProcessing) return data;
|
|
53483
53643
|
if (processLocalRows) {
|
|
53484
53644
|
return processLocalRows(data, {
|
|
@@ -53542,8 +53702,8 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53542
53702
|
intelligentSearchEnabled,
|
|
53543
53703
|
searchScope
|
|
53544
53704
|
]);
|
|
53545
|
-
const lastNotifiedViewRows = (0,
|
|
53546
|
-
(0,
|
|
53705
|
+
const lastNotifiedViewRows = (0, import_react29.useRef)(null);
|
|
53706
|
+
(0, import_react29.useEffect)(() => {
|
|
53547
53707
|
if (!onViewChange) {
|
|
53548
53708
|
lastNotifiedViewRows.current = null;
|
|
53549
53709
|
return;
|
|
@@ -53552,7 +53712,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53552
53712
|
lastNotifiedViewRows.current = processed;
|
|
53553
53713
|
if (changed) onViewChange(processed);
|
|
53554
53714
|
}, [processed, onViewChange]);
|
|
53555
|
-
(0,
|
|
53715
|
+
(0, import_react29.useEffect)(() => {
|
|
53556
53716
|
if (controlledQuery) return;
|
|
53557
53717
|
setInternalPage(1);
|
|
53558
53718
|
}, [
|
|
@@ -53600,7 +53760,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53600
53760
|
numberedPageHasMore: !hidePagination && !isLoading && !isFetching && processed.length > 0 && safePage < pageCount && (remoteQuery?.mode === "controlled" || !remoteQuery),
|
|
53601
53761
|
onPageAdvance: setPage
|
|
53602
53762
|
});
|
|
53603
|
-
const paginated = (0,
|
|
53763
|
+
const paginated = (0, import_react29.useMemo)(() => {
|
|
53604
53764
|
if (remoteQuery) return processed;
|
|
53605
53765
|
if (hidePagination) return processed;
|
|
53606
53766
|
if (localProgressiveEnabled) return [...progressiveRows.rows];
|
|
@@ -53610,16 +53770,16 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53610
53770
|
}, [processed, safePage, effectivePageSize, pageSize, remoteQuery, hidePagination, localProgressiveEnabled, progressiveRows.rows]);
|
|
53611
53771
|
const drillGrouped = Boolean(drill && drill.question.by.length > 0);
|
|
53612
53772
|
const groupingColumnId = drill ? null : grouping?.columnId ?? null;
|
|
53613
|
-
const [uncontrolledCollapsed, setUncontrolledCollapsed] = (0,
|
|
53773
|
+
const [uncontrolledCollapsed, setUncontrolledCollapsed] = (0, import_react29.useState)([]);
|
|
53614
53774
|
const collapsedGroups = grouping?.collapsed ?? uncontrolledCollapsed;
|
|
53615
|
-
const setCollapsedGroups = (0,
|
|
53775
|
+
const setCollapsedGroups = (0, import_react29.useCallback)(
|
|
53616
53776
|
(next) => {
|
|
53617
53777
|
if (grouping?.onCollapsedChange) grouping.onCollapsedChange(next);
|
|
53618
53778
|
else setUncontrolledCollapsed(next);
|
|
53619
53779
|
},
|
|
53620
53780
|
[grouping]
|
|
53621
53781
|
);
|
|
53622
|
-
const groups = (0,
|
|
53782
|
+
const groups = (0, import_react29.useMemo)(() => {
|
|
53623
53783
|
if (!grouping || !groupingColumnId) return null;
|
|
53624
53784
|
const groupColumn = columns.find((col) => columnId(col) === groupingColumnId);
|
|
53625
53785
|
if (!groupColumn) return null;
|
|
@@ -53638,7 +53798,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53638
53798
|
...grouping.emptyLabel ? { emptyLabel: grouping.emptyLabel } : {}
|
|
53639
53799
|
});
|
|
53640
53800
|
}, [grouping, groupingColumnId, columns, paginated]);
|
|
53641
|
-
const groupableColumns = (0,
|
|
53801
|
+
const groupableColumns = (0, import_react29.useMemo)(() => {
|
|
53642
53802
|
const allowed = grouping?.groupableColumnIds;
|
|
53643
53803
|
return visibleColumns.filter((col) => {
|
|
53644
53804
|
const id = columnId(col);
|
|
@@ -53646,7 +53806,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53646
53806
|
return col.accessorKey !== void 0 || col.accessorFn !== void 0;
|
|
53647
53807
|
});
|
|
53648
53808
|
}, [visibleColumns, grouping?.groupableColumnIds]);
|
|
53649
|
-
const groupedRenderRows = (0,
|
|
53809
|
+
const groupedRenderRows = (0, import_react29.useMemo)(
|
|
53650
53810
|
() => groups ? flattenGroups(groups, collapsedGroups) : null,
|
|
53651
53811
|
[groups, collapsedGroups]
|
|
53652
53812
|
);
|
|
@@ -53658,7 +53818,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53658
53818
|
const bodyEntryCount = groupedRenderRows ? groupedRenderRows.length : paginated.length;
|
|
53659
53819
|
const virtualizeActive = virtualizeConfig !== null && virtualizeConfig.enabled !== false && bodyEntryCount > virtualThreshold && !hierarchy && expandedDetail === void 0;
|
|
53660
53820
|
const columnWindowWidth = virtualizeConfig?.columnWidth ?? 160;
|
|
53661
|
-
const frozenRunLength = (0,
|
|
53821
|
+
const frozenRunLength = (0, import_react29.useMemo)(() => {
|
|
53662
53822
|
let run = 0;
|
|
53663
53823
|
for (const col of visibleColumns) {
|
|
53664
53824
|
if (frozenColumns.offsets[columnId(col)] === void 0) break;
|
|
@@ -53667,9 +53827,9 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53667
53827
|
return run;
|
|
53668
53828
|
}, [visibleColumns, frozenColumns]);
|
|
53669
53829
|
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,
|
|
53830
|
+
const [rowWindow, setRowWindow] = (0, import_react29.useState)(null);
|
|
53831
|
+
const [columnWindow, setColumnWindow] = (0, import_react29.useState)(null);
|
|
53832
|
+
const windowInputs = (0, import_react29.useRef)({
|
|
53673
53833
|
virtualizeActive: false,
|
|
53674
53834
|
bodyEntryCount: 0,
|
|
53675
53835
|
virtualRowHeight: 40,
|
|
@@ -53689,7 +53849,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53689
53849
|
columnWindowWidth,
|
|
53690
53850
|
frozenRunLength
|
|
53691
53851
|
};
|
|
53692
|
-
const recomputeWindows = (0,
|
|
53852
|
+
const recomputeWindows = (0, import_react29.useCallback)(() => {
|
|
53693
53853
|
const el = scrollRef.current;
|
|
53694
53854
|
const input = windowInputs.current;
|
|
53695
53855
|
const nextRow = input.virtualizeActive ? computeWindow({
|
|
@@ -53710,7 +53870,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53710
53870
|
setRowWindow((prev) => sameWindow(prev, nextRow) ? prev : nextRow);
|
|
53711
53871
|
setColumnWindow((prev) => sameWindow(prev, nextColumn) ? prev : nextColumn);
|
|
53712
53872
|
}, []);
|
|
53713
|
-
const effectiveRowWindow = (0,
|
|
53873
|
+
const effectiveRowWindow = (0, import_react29.useMemo)(() => {
|
|
53714
53874
|
if (!virtualizeActive) return null;
|
|
53715
53875
|
if (rowWindow && rowWindow.end <= bodyEntryCount) return rowWindow;
|
|
53716
53876
|
return computeWindow({
|
|
@@ -53721,7 +53881,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53721
53881
|
overscan: virtualizeConfig?.overscan ?? 8
|
|
53722
53882
|
});
|
|
53723
53883
|
}, [virtualizeActive, rowWindow, bodyEntryCount, virtualRowHeight, virtualizeConfig?.overscan]);
|
|
53724
|
-
const effectiveColumnWindow = (0,
|
|
53884
|
+
const effectiveColumnWindow = (0, import_react29.useMemo)(() => {
|
|
53725
53885
|
if (!columnVirtualizeActive) return null;
|
|
53726
53886
|
if (columnWindow && columnWindow.end <= visibleColumns.length) return columnWindow;
|
|
53727
53887
|
return computeWindow({
|
|
@@ -53741,7 +53901,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53741
53901
|
frozenRunLength
|
|
53742
53902
|
]);
|
|
53743
53903
|
const metricsWanted = virtualizeActive || columnVirtualizeActive;
|
|
53744
|
-
(0,
|
|
53904
|
+
(0, import_react29.useEffect)(() => {
|
|
53745
53905
|
recomputeWindows();
|
|
53746
53906
|
}, [
|
|
53747
53907
|
recomputeWindows,
|
|
@@ -53753,7 +53913,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53753
53913
|
columnWindowWidth,
|
|
53754
53914
|
frozenRunLength
|
|
53755
53915
|
]);
|
|
53756
|
-
(0,
|
|
53916
|
+
(0, import_react29.useEffect)(() => {
|
|
53757
53917
|
if (!metricsWanted) return;
|
|
53758
53918
|
const el = scrollRef.current;
|
|
53759
53919
|
if (!el) return;
|
|
@@ -53774,7 +53934,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53774
53934
|
observer?.disconnect();
|
|
53775
53935
|
};
|
|
53776
53936
|
}, [metricsWanted, recomputeWindows]);
|
|
53777
|
-
const renderedColumns = (0,
|
|
53937
|
+
const renderedColumns = (0, import_react29.useMemo)(
|
|
53778
53938
|
() => effectiveColumnWindow ? [
|
|
53779
53939
|
...visibleColumns.slice(0, frozenRunLength),
|
|
53780
53940
|
...visibleColumns.slice(effectiveColumnWindow.start, effectiveColumnWindow.end)
|
|
@@ -53782,7 +53942,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53782
53942
|
[effectiveColumnWindow, visibleColumns, frozenRunLength]
|
|
53783
53943
|
);
|
|
53784
53944
|
const columnSpacers = effectiveColumnWindow ? { start: effectiveColumnWindow.padStart, end: effectiveColumnWindow.padEnd } : null;
|
|
53785
|
-
const windowedWidthFor = (0,
|
|
53945
|
+
const windowedWidthFor = (0, import_react29.useCallback)(
|
|
53786
53946
|
(id, declared) => {
|
|
53787
53947
|
const fitted = fittedWidths?.[id];
|
|
53788
53948
|
if (fitted !== void 0) return fitted;
|
|
@@ -53794,7 +53954,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53794
53954
|
[effectiveColumnWindow, effectiveColumnWidths, frozenColumns, columnWindowWidth, fittedWidths]
|
|
53795
53955
|
);
|
|
53796
53956
|
const coverageUnanswered = readView.failure || read?.status === "loading" && data.length === 0;
|
|
53797
|
-
const coverageResult = (0,
|
|
53957
|
+
const coverageResult = (0, import_react29.useMemo)(() => {
|
|
53798
53958
|
if (!coverage || coverageUnanswered) return null;
|
|
53799
53959
|
return describeCoverage({
|
|
53800
53960
|
loaded: coverage.loaded ?? data.length,
|
|
@@ -53805,7 +53965,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53805
53965
|
...coverage.noun === void 0 ? {} : { noun: coverage.noun }
|
|
53806
53966
|
});
|
|
53807
53967
|
}, [coverage, coverageUnanswered, data.length]);
|
|
53808
|
-
const bodyEntries = (0,
|
|
53968
|
+
const bodyEntries = (0, import_react29.useMemo)(() => {
|
|
53809
53969
|
const from = effectiveRowWindow ? effectiveRowWindow.start : 0;
|
|
53810
53970
|
const to = effectiveRowWindow ? effectiveRowWindow.end : void 0;
|
|
53811
53971
|
const windowed = groupedRenderRows ? groupedRenderRows.slice(from, to).map(
|
|
@@ -53822,28 +53982,28 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53822
53982
|
windowed.push({ kind: "spacer", height: effectiveRowWindow.padEnd, place: "end" });
|
|
53823
53983
|
return windowed;
|
|
53824
53984
|
}, [groupedRenderRows, collapsedGroups, paginated, effectiveRowWindow]);
|
|
53825
|
-
const getRowIdRef = (0,
|
|
53985
|
+
const getRowIdRef = (0, import_react29.useRef)(getRowId);
|
|
53826
53986
|
getRowIdRef.current = getRowId;
|
|
53827
|
-
const spreadsheetRowIds = (0,
|
|
53987
|
+
const spreadsheetRowIds = (0, import_react29.useMemo)(
|
|
53828
53988
|
() => paginated.map((row) => getRowIdRef.current(row)),
|
|
53829
53989
|
[paginated]
|
|
53830
53990
|
);
|
|
53831
|
-
const spreadsheetColumnIds = (0,
|
|
53991
|
+
const spreadsheetColumnIds = (0, import_react29.useMemo)(
|
|
53832
53992
|
() => visibleColumns.filter((col) => !col.customActions).map((col) => columnId(col)),
|
|
53833
53993
|
[visibleColumns]
|
|
53834
53994
|
);
|
|
53835
|
-
const spreadsheetRowById = (0,
|
|
53995
|
+
const spreadsheetRowById = (0, import_react29.useMemo)(() => {
|
|
53836
53996
|
const map = /* @__PURE__ */ new Map();
|
|
53837
53997
|
for (const row of paginated) map.set(getRowIdRef.current(row), row);
|
|
53838
53998
|
return map;
|
|
53839
53999
|
}, [paginated]);
|
|
53840
|
-
const spreadsheetColumnById = (0,
|
|
54000
|
+
const spreadsheetColumnById = (0, import_react29.useMemo)(() => {
|
|
53841
54001
|
const map = /* @__PURE__ */ new Map();
|
|
53842
54002
|
for (const col of visibleColumns) if (!col.customActions) map.set(columnId(col), col);
|
|
53843
54003
|
return map;
|
|
53844
54004
|
}, [visibleColumns]);
|
|
53845
54005
|
const spreadsheetEnabled = Boolean(spreadsheet && spreadsheet.enabled !== false);
|
|
53846
|
-
const openRowRef = (0,
|
|
54006
|
+
const openRowRef = (0, import_react29.useRef)(() => void 0);
|
|
53847
54007
|
const sheet = useSpreadsheetGrid(
|
|
53848
54008
|
spreadsheetEnabled && spreadsheet ? {
|
|
53849
54009
|
rowIds: spreadsheetRowIds,
|
|
@@ -53885,12 +54045,12 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53885
54045
|
} : null
|
|
53886
54046
|
);
|
|
53887
54047
|
if (spreadsheet?.controllerRef) spreadsheet.controllerRef.current = spreadsheetEnabled ? sheet.controller : null;
|
|
53888
|
-
const sheetRef = (0,
|
|
54048
|
+
const sheetRef = (0, import_react29.useRef)(sheet);
|
|
53889
54049
|
sheetRef.current = sheet;
|
|
53890
|
-
const onSheetSelectionRef = (0,
|
|
54050
|
+
const onSheetSelectionRef = (0, import_react29.useRef)(spreadsheet?.onSelectionChange);
|
|
53891
54051
|
onSheetSelectionRef.current = spreadsheet?.onSelectionChange;
|
|
53892
54052
|
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,
|
|
54053
|
+
(0, import_react29.useEffect)(() => {
|
|
53894
54054
|
const tell = onSheetSelectionRef.current;
|
|
53895
54055
|
if (!tell) return;
|
|
53896
54056
|
const current = sheetRef.current;
|
|
@@ -53907,12 +54067,12 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53907
54067
|
tsv: current.selectionTsv()
|
|
53908
54068
|
});
|
|
53909
54069
|
}, [sheetSelectionKey]);
|
|
53910
|
-
const searchValueRef = (0,
|
|
54070
|
+
const searchValueRef = (0, import_react29.useRef)(searchValue);
|
|
53911
54071
|
searchValueRef.current = searchValue;
|
|
53912
54072
|
const facetsEnabled = Boolean(facets && facets.enabled !== false);
|
|
53913
54073
|
const coreSuggestionsEnabled = facets?.enabled !== false;
|
|
53914
|
-
const [facetState, setFacetState] = (0,
|
|
53915
|
-
const facetReadCell = (0,
|
|
54074
|
+
const [facetState, setFacetState] = (0, import_react29.useState)({});
|
|
54075
|
+
const facetReadCell = (0, import_react29.useCallback)(
|
|
53916
54076
|
(row, colId) => {
|
|
53917
54077
|
if (facets?.readCell) return facets.readCell(row, colId);
|
|
53918
54078
|
const col = visibleColumns.find((candidate) => columnId(candidate) === colId);
|
|
@@ -53922,11 +54082,11 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53922
54082
|
);
|
|
53923
54083
|
const coreFacetTotal = remoteQuery?.mode === "controlled" ? remoteQuery.totalItems : appendQuery?.pagination.sourceRecords?.total ?? coverage?.matched ?? coverage?.total;
|
|
53924
54084
|
const coreFacetLoaded = appendQuery?.pagination.sourceRecords?.loaded;
|
|
53925
|
-
const facetInputsRef = (0,
|
|
54085
|
+
const facetInputsRef = (0, import_react29.useRef)({ data, facets, facetReadCell, coreFacetTotal, coreFacetLoaded });
|
|
53926
54086
|
facetInputsRef.current = { data, facets, facetReadCell, coreFacetTotal, coreFacetLoaded };
|
|
53927
|
-
const facetRequestRef = (0,
|
|
53928
|
-
const requestedFacetColumns = (0,
|
|
53929
|
-
const requestFacets = (0,
|
|
54087
|
+
const facetRequestRef = (0, import_react29.useRef)(/* @__PURE__ */ new Map());
|
|
54088
|
+
const requestedFacetColumns = (0, import_react29.useRef)(/* @__PURE__ */ new Set());
|
|
54089
|
+
const requestFacets = (0, import_react29.useCallback)((colId) => {
|
|
53930
54090
|
requestedFacetColumns.current.add(colId);
|
|
53931
54091
|
const { data: rows, facets: config, facetReadCell: readCell, coreFacetTotal: total, coreFacetLoaded: loaded } = facetInputsRef.current;
|
|
53932
54092
|
if (!config || config.enabled === false) {
|
|
@@ -54009,7 +54169,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
54009
54169
|
}));
|
|
54010
54170
|
});
|
|
54011
54171
|
}, []);
|
|
54012
|
-
(0,
|
|
54172
|
+
(0, import_react29.useEffect)(() => {
|
|
54013
54173
|
setFacetState((current) => Object.keys(current).length === 0 ? current : {});
|
|
54014
54174
|
for (const [colId, ticket] of facetRequestRef.current) {
|
|
54015
54175
|
facetRequestRef.current.set(colId, ticket + 1);
|
|
@@ -54019,15 +54179,15 @@ function MatrxDataTableCore(coreProps) {
|
|
|
54019
54179
|
}
|
|
54020
54180
|
}, [facetsEnabled, coreSuggestionsEnabled, data, searchValue, coreFacetTotal, coreFacetLoaded, requestFacets]);
|
|
54021
54181
|
const totalIsKnown = !isLoading && !readView.failure;
|
|
54022
|
-
(0,
|
|
54182
|
+
(0, import_react29.useEffect)(() => {
|
|
54023
54183
|
if (!controlledQuery || !totalIsKnown || controlledQuery.state.page === safePage) return;
|
|
54024
54184
|
emitControlledQueryChange({ page: safePage });
|
|
54025
54185
|
}, [controlledQuery, emitControlledQueryChange, safePage, totalIsKnown]);
|
|
54026
|
-
const selectedRow = (0,
|
|
54186
|
+
const selectedRow = (0, import_react29.useMemo)(() => {
|
|
54027
54187
|
if (!selectedId) return null;
|
|
54028
54188
|
return data.find((r) => getRowId(r) === selectedId) ?? null;
|
|
54029
54189
|
}, [data, selectedId, getRowId]);
|
|
54030
|
-
const windowRow = (0,
|
|
54190
|
+
const windowRow = (0, import_react29.useMemo)(() => {
|
|
54031
54191
|
if (!windowRowId) return null;
|
|
54032
54192
|
return data.find((r) => getRowId(r) === windowRowId) ?? (windowRowSnapshot && windowRowSnapshot.queryKey === appendQueryKey && getRowId(windowRowSnapshot.row) === windowRowId ? windowRowSnapshot.row : null);
|
|
54033
54193
|
}, [data, windowRowId, windowRowSnapshot, getRowId, appendQueryKey]);
|
|
@@ -54054,14 +54214,14 @@ function MatrxDataTableCore(coreProps) {
|
|
|
54054
54214
|
const reportCardTotal = embedded ? tableCard?.reportTotal : void 0;
|
|
54055
54215
|
const cardTotal = appendQuery ? appendQuery.pagination.totalItems : remoteQuery?.mode === "controlled" ? isLoading ? void 0 : remoteQuery.totalItems : isLoading ? void 0 : sourceProcessing ? sourceTotal : data.length;
|
|
54056
54216
|
const embeddedControlledPage = embedded && remoteQuery?.mode === "controlled" ? remoteQuery.state.page : 1;
|
|
54057
|
-
(0,
|
|
54217
|
+
(0, import_react29.useEffect)(() => {
|
|
54058
54218
|
if (embeddedControlledPage !== 1) emitControlledQueryChange({ page: 1 });
|
|
54059
54219
|
}, [embeddedControlledPage]);
|
|
54060
|
-
(0,
|
|
54220
|
+
(0, import_react29.useEffect)(() => {
|
|
54061
54221
|
reportCardTotal?.(cardTotal);
|
|
54062
54222
|
}, [reportCardTotal, cardTotal]);
|
|
54063
|
-
(0,
|
|
54064
|
-
const [pinnedEl, setPinnedEl] = (0,
|
|
54223
|
+
(0, import_react29.useEffect)(() => () => reportCardTotal?.(void 0), [reportCardTotal]);
|
|
54224
|
+
const [pinnedEl, setPinnedEl] = (0, import_react29.useState)(null);
|
|
54065
54225
|
const pinnedRowActive = Boolean(
|
|
54066
54226
|
toolbar?.singleRow && toolbar.overflow && toolbar.overflow.mode !== "sheet" && (toolbar.overflow.pinned || toolbar.overflow.mode === "menu")
|
|
54067
54227
|
);
|
|
@@ -54125,7 +54285,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
54125
54285
|
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
54126
54286
|
MatrxTableRowAlchemyProvider,
|
|
54127
54287
|
{
|
|
54128
|
-
copy: tableRowCopyProps(effectiveCopy, row, `${tableCopySourceNamespace}:row:${getRowId(row)}`, copy === void 0 ?
|
|
54288
|
+
copy: tableRowCopyProps(effectiveCopy, row, `${tableCopySourceNamespace}:row:${getRowId(row)}`, copy === void 0 ? readDeclaredCopyColumns : void 0),
|
|
54129
54289
|
placement: rowCopyInMenu ? "menu" : "inline",
|
|
54130
54290
|
controls,
|
|
54131
54291
|
children: scopedActions
|
|
@@ -54181,7 +54341,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
54181
54341
|
...resolveSummaryValue(summary?.source?.totals?.[id], value)
|
|
54182
54342
|
}));
|
|
54183
54343
|
const hasSummaryTotals = summaryTotals.length > 0;
|
|
54184
|
-
const changeCount = (0,
|
|
54344
|
+
const changeCount = (0, import_react29.useMemo)(() => {
|
|
54185
54345
|
let n = 0;
|
|
54186
54346
|
for (const fields of Object.values(edits)) {
|
|
54187
54347
|
n += Object.keys(fields).length;
|
|
@@ -54366,7 +54526,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
54366
54526
|
}));
|
|
54367
54527
|
return true;
|
|
54368
54528
|
};
|
|
54369
|
-
const requestCellEditRef = (0,
|
|
54529
|
+
const requestCellEditRef = (0, import_react29.useRef)(requestCellEdit);
|
|
54370
54530
|
requestCellEditRef.current = requestCellEdit;
|
|
54371
54531
|
const buildRecordControls = (row) => {
|
|
54372
54532
|
const rowId = getRowId(row);
|
|
@@ -54393,7 +54553,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
54393
54553
|
};
|
|
54394
54554
|
const hierarchyRows = hierarchy?.rows ?? data;
|
|
54395
54555
|
const hierarchyGetParentId = hierarchy?.getParentId;
|
|
54396
|
-
const hierarchyIndex = (0,
|
|
54556
|
+
const hierarchyIndex = (0, import_react29.useMemo)(() => {
|
|
54397
54557
|
if (!hierarchyGetParentId) return null;
|
|
54398
54558
|
const byId = /* @__PURE__ */ new Map();
|
|
54399
54559
|
const parentById = /* @__PURE__ */ new Map();
|
|
@@ -54425,7 +54585,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
54425
54585
|
return { byId, parentById, depthById };
|
|
54426
54586
|
}, [hierarchyGetParentId, hierarchyRows, getRowId]);
|
|
54427
54587
|
const draggedRow = draggedRowId && hierarchyIndex ? hierarchyIndex.byId.get(draggedRowId) : void 0;
|
|
54428
|
-
const hierarchyBlockedIds = (0,
|
|
54588
|
+
const hierarchyBlockedIds = (0, import_react29.useMemo)(() => {
|
|
54429
54589
|
if (!draggedRowId || !hierarchyIndex) return null;
|
|
54430
54590
|
const childrenById = /* @__PURE__ */ new Map();
|
|
54431
54591
|
for (const [id, parentId] of hierarchyIndex.parentById) {
|
|
@@ -54712,16 +54872,16 @@ function MatrxDataTableCore(coreProps) {
|
|
|
54712
54872
|
return [];
|
|
54713
54873
|
}
|
|
54714
54874
|
};
|
|
54715
|
-
const menuSectionsForRef = (0,
|
|
54875
|
+
const menuSectionsForRef = (0, import_react29.useRef)(menuSectionsFor);
|
|
54716
54876
|
menuSectionsForRef.current = menuSectionsFor;
|
|
54717
54877
|
const hasMenuSections = Boolean(contextMenu?.sections);
|
|
54718
|
-
const boundarySections = (0,
|
|
54878
|
+
const boundarySections = (0, import_react29.useCallback)(
|
|
54719
54879
|
(target) => menuSectionsForRef.current(target),
|
|
54720
54880
|
[]
|
|
54721
54881
|
);
|
|
54722
|
-
const resolveMenuLevelRef = (0,
|
|
54882
|
+
const resolveMenuLevelRef = (0, import_react29.useRef)(resolveMenuLevel);
|
|
54723
54883
|
resolveMenuLevelRef.current = resolveMenuLevel;
|
|
54724
|
-
(0,
|
|
54884
|
+
(0, import_react29.useEffect)(() => {
|
|
54725
54885
|
if (!host.rowContextRegistry) return;
|
|
54726
54886
|
return host.rowContextRegistry.register(
|
|
54727
54887
|
tableContextMenuInstanceId,
|
|
@@ -54732,7 +54892,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
54732
54892
|
const lastVisibleColumn = visibleColumns[visibleColumns.length - 1];
|
|
54733
54893
|
const pinnedActionsColumnId = !showActionsCol && lastVisibleColumn?.customActions ? columnId(lastVisibleColumn) : void 0;
|
|
54734
54894
|
const getSelectionId = selection?.getSelectionId ?? getRowId;
|
|
54735
|
-
const selectedIdSet = (0,
|
|
54895
|
+
const selectedIdSet = (0, import_react29.useMemo)(
|
|
54736
54896
|
() => new Set(selection?.selectedIds ?? []),
|
|
54737
54897
|
[selection?.selectedIds]
|
|
54738
54898
|
);
|
|
@@ -54744,7 +54904,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
54744
54904
|
);
|
|
54745
54905
|
const allOnPageSelected = selectableRows.length > 0 && selectedOnPage.length === selectableRows.length;
|
|
54746
54906
|
const someOnPageSelected = selectedOnPage.length > 0 && !allOnPageSelected;
|
|
54747
|
-
const selectedRows = (0,
|
|
54907
|
+
const selectedRows = (0, import_react29.useMemo)(() => {
|
|
54748
54908
|
const resolved = /* @__PURE__ */ new Set();
|
|
54749
54909
|
return data.filter((row) => {
|
|
54750
54910
|
const id = getSelectionId(row);
|
|
@@ -54753,7 +54913,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
54753
54913
|
return true;
|
|
54754
54914
|
});
|
|
54755
54915
|
}, [data, getSelectionId, selectedIdSet]);
|
|
54756
|
-
const lastToggledIndex = (0,
|
|
54916
|
+
const lastToggledIndex = (0, import_react29.useRef)(null);
|
|
54757
54917
|
const setSelectedIds = (next) => selection?.onSelectedIdsChange([...next]);
|
|
54758
54918
|
const toggleRowSelected = (index, shiftKey) => {
|
|
54759
54919
|
if (!selection) return;
|
|
@@ -54794,7 +54954,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
54794
54954
|
}
|
|
54795
54955
|
} : facet
|
|
54796
54956
|
) : toolbar?.facets;
|
|
54797
|
-
const rowLatest = (0,
|
|
54957
|
+
const rowLatest = (0, import_react29.useRef)(null);
|
|
54798
54958
|
const renderRecordCell = (row, col, index, suppliedControls) => {
|
|
54799
54959
|
const id = getRowId(row);
|
|
54800
54960
|
const field = col.accessorKey ? String(col.accessorKey) : columnId(col);
|
|
@@ -54812,13 +54972,13 @@ function MatrxDataTableCore(coreProps) {
|
|
|
54812
54972
|
copy: effectiveCopy,
|
|
54813
54973
|
row: displayRow,
|
|
54814
54974
|
sourceId: `${tableCopySourceNamespace}:row:${getRowId(displayRow)}`,
|
|
54815
|
-
...copy === void 0 ? { defaultColumns:
|
|
54975
|
+
...copy === void 0 ? { defaultColumns: readDeclaredCopyColumns } : {}
|
|
54816
54976
|
}
|
|
54817
54977
|
) : null,
|
|
54818
54978
|
effectiveCopy && showRowCopy ? /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
54819
54979
|
MatrxTableRowAlchemyProvider,
|
|
54820
54980
|
{
|
|
54821
|
-
copy: tableRowCopyProps(effectiveCopy, displayRow, `${tableCopySourceNamespace}:row:${getRowId(displayRow)}`, copy === void 0 ?
|
|
54981
|
+
copy: tableRowCopyProps(effectiveCopy, displayRow, `${tableCopySourceNamespace}:row:${getRowId(displayRow)}`, copy === void 0 ? readDeclaredCopyColumns : void 0),
|
|
54822
54982
|
placement: rowCopyInMenu && columnId(col) === (menuActionsColumn ? columnId(menuActionsColumn) : void 0) ? "menu" : "inline",
|
|
54823
54983
|
controls,
|
|
54824
54984
|
children: content
|
|
@@ -54857,7 +55017,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
54857
55017
|
}
|
|
54858
55018
|
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
55019
|
};
|
|
54860
|
-
const currentViewSnapshot = (0,
|
|
55020
|
+
const currentViewSnapshot = (0, import_react29.useMemo)(
|
|
54861
55021
|
() => ({
|
|
54862
55022
|
__kind: "matrx-table-view",
|
|
54863
55023
|
version: 1,
|
|
@@ -54893,7 +55053,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
54893
55053
|
]
|
|
54894
55054
|
);
|
|
54895
55055
|
const declaredDefaultSort = urlState ? urlState.defaultSort ?? null : defaultSort;
|
|
54896
|
-
const declaredDefaultViewSnapshot = (0,
|
|
55056
|
+
const declaredDefaultViewSnapshot = (0, import_react29.useMemo)(
|
|
54897
55057
|
() => defaultViewSnapshot ?? {
|
|
54898
55058
|
__kind: "matrx-table-view",
|
|
54899
55059
|
version: 1,
|
|
@@ -54911,7 +55071,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
54911
55071
|
},
|
|
54912
55072
|
[columns, defaultPageSize, declaredDefaultSort, defaultViewSnapshot]
|
|
54913
55073
|
);
|
|
54914
|
-
const applySavedView = (0,
|
|
55074
|
+
const applySavedView = (0, import_react29.useCallback)(
|
|
54915
55075
|
(rawSnapshot) => {
|
|
54916
55076
|
const snapshot = parseTableViewSnapshot(rawSnapshot);
|
|
54917
55077
|
if (!snapshot) {
|
|
@@ -54992,15 +55152,15 @@ function MatrxDataTableCore(coreProps) {
|
|
|
54992
55152
|
const drawn = buildRecordControls(row);
|
|
54993
55153
|
const live = {};
|
|
54994
55154
|
for (const [key, value] of Object.entries(drawn)) {
|
|
54995
|
-
live[key] = typeof value === "function" ? (...args) => {
|
|
55155
|
+
live[key] = typeof value === "function" ? lazyCallback((...args) => {
|
|
54996
55156
|
const now = rowLatest.current.buildRecordControls(row);
|
|
54997
55157
|
const handler = now[key];
|
|
54998
55158
|
return typeof handler === "function" ? handler(...args) : void 0;
|
|
54999
|
-
} : value;
|
|
55159
|
+
}) : value;
|
|
55000
55160
|
}
|
|
55001
55161
|
return live;
|
|
55002
55162
|
};
|
|
55003
|
-
const
|
|
55163
|
+
const rowShape = [
|
|
55004
55164
|
// WHAT A BODY ROW READS FROM THIS TABLE'S PROPS — and nothing it does not, so a host that
|
|
55005
55165
|
// rebuilds its toolbar, its query or its empty state on every render redraws no row. Handlers
|
|
55006
55166
|
// are absent on purpose: they run through `rowLatest`. Columns count by what a body cell
|
|
@@ -55064,7 +55224,12 @@ function MatrxDataTableCore(coreProps) {
|
|
|
55064
55224
|
hierarchyIndex,
|
|
55065
55225
|
hierarchyBlockedIds,
|
|
55066
55226
|
draggedRowId
|
|
55067
|
-
]
|
|
55227
|
+
];
|
|
55228
|
+
const rowEpoch = useRenderEpoch(rowShape.filter((value) => typeof value !== "function" && (typeof value !== "object" || value === null)));
|
|
55229
|
+
const rowProbe = useRenderEpoch(rowShape.filter((value) => typeof value === "function" || typeof value === "object" && value !== null));
|
|
55230
|
+
const rowDrawings = (0, import_react29.useRef)(null);
|
|
55231
|
+
rowDrawings.current ??= new RowDrawings();
|
|
55232
|
+
const drawBodyRow = (rowId, row, index) => rowDrawings.current.draw(rowId, renderRecordRow(row, index));
|
|
55068
55233
|
chromeLatest.current = { processed, data, toggleAllOnPage, showMore: progressiveRows.showMore, applySavedView };
|
|
55069
55234
|
const chromeGeometry = [
|
|
55070
55235
|
...Object.entries(effectiveColumnWidths).flat(),
|
|
@@ -55506,7 +55671,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
55506
55671
|
copy: effectiveCopy,
|
|
55507
55672
|
row: displayRow,
|
|
55508
55673
|
sourceId: `${tableCopySourceNamespace}:row:${getRowId(displayRow)}`,
|
|
55509
|
-
...copy === void 0 ? { defaultColumns:
|
|
55674
|
+
...copy === void 0 ? { defaultColumns: readDeclaredCopyColumns } : {}
|
|
55510
55675
|
}
|
|
55511
55676
|
) : null,
|
|
55512
55677
|
renderRowActions(displayRow, controls),
|
|
@@ -55556,7 +55721,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
55556
55721
|
},
|
|
55557
55722
|
`${id}:expanded-detail`
|
|
55558
55723
|
) : null;
|
|
55559
|
-
return hierarchy ? /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
|
|
55724
|
+
return hierarchy ? /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(import_react29.Fragment, { children: [
|
|
55560
55725
|
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
55561
55726
|
HierarchyDroppableRow,
|
|
55562
55727
|
{
|
|
@@ -55566,7 +55731,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
55566
55731
|
}
|
|
55567
55732
|
),
|
|
55568
55733
|
inlineDetail
|
|
55569
|
-
] }, id) : /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
|
|
55734
|
+
] }, id) : /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(import_react29.Fragment, { children: [
|
|
55570
55735
|
wrappedRow,
|
|
55571
55736
|
inlineDetail
|
|
55572
55737
|
] }, id);
|
|
@@ -56142,11 +56307,11 @@ function MatrxDataTableCore(coreProps) {
|
|
|
56142
56307
|
copy: effectiveCopy,
|
|
56143
56308
|
row: displayRow,
|
|
56144
56309
|
sourceId: `${tableCopySourceNamespace}:row:${getRowId(displayRow)}`,
|
|
56145
|
-
...copy === void 0 ? { defaultColumns:
|
|
56310
|
+
...copy === void 0 ? { defaultColumns: readDeclaredCopyColumns } : {}
|
|
56146
56311
|
}
|
|
56147
56312
|
) : null,
|
|
56148
56313
|
renderRowActions(displayRow, controls),
|
|
56149
|
-
visibleColumns.filter((column) => column.customActions).map((column) => /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
56314
|
+
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
56315
|
]
|
|
56151
56316
|
}
|
|
56152
56317
|
) : null,
|
|
@@ -56583,8 +56748,9 @@ function MatrxDataTableCore(coreProps) {
|
|
|
56583
56748
|
row,
|
|
56584
56749
|
index,
|
|
56585
56750
|
epoch: rowEpoch,
|
|
56751
|
+
probe: rowProbe,
|
|
56586
56752
|
facts: rowFactsFor(row, id, index),
|
|
56587
|
-
|
|
56753
|
+
draw: drawBodyRow
|
|
56588
56754
|
},
|
|
56589
56755
|
id
|
|
56590
56756
|
);
|
|
@@ -57035,7 +57201,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
57035
57201
|
copy: effectiveCopy,
|
|
57036
57202
|
sourceId: `${tableCopySourceNamespace}:row:${getRowId(selectedRow)}`,
|
|
57037
57203
|
row: selectedRow,
|
|
57038
|
-
...copy === void 0 ? { defaultColumns:
|
|
57204
|
+
...copy === void 0 ? { defaultColumns: readDeclaredCopyColumns } : {}
|
|
57039
57205
|
}
|
|
57040
57206
|
) : null,
|
|
57041
57207
|
detail?.headerActions?.(selectedRow),
|
|
@@ -57123,7 +57289,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
57123
57289
|
copy: effectiveCopy,
|
|
57124
57290
|
sourceId: `${tableCopySourceNamespace}:row:${getRowId(windowRow)}`,
|
|
57125
57291
|
row: windowRow,
|
|
57126
|
-
...copy === void 0 ? { defaultColumns:
|
|
57292
|
+
...copy === void 0 ? { defaultColumns: readDeclaredCopyColumns } : {}
|
|
57127
57293
|
}
|
|
57128
57294
|
) : null
|
|
57129
57295
|
] }),
|
|
@@ -57286,7 +57452,7 @@ function HierarchyDragIndicatorLayer({
|
|
|
57286
57452
|
scrollRef,
|
|
57287
57453
|
resolve: resolve2
|
|
57288
57454
|
}) {
|
|
57289
|
-
const [indicator, setIndicator] = (0,
|
|
57455
|
+
const [indicator, setIndicator] = (0, import_react29.useState)(
|
|
57290
57456
|
null
|
|
57291
57457
|
);
|
|
57292
57458
|
(0, import_core3.useDndMonitor)({
|
|
@@ -57390,9 +57556,9 @@ function HierarchyDroppableRow({
|
|
|
57390
57556
|
children
|
|
57391
57557
|
}) {
|
|
57392
57558
|
const { setNodeRef } = (0, import_core3.useDroppable)({ id, disabled });
|
|
57393
|
-
if (!(0,
|
|
57559
|
+
if (!(0, import_react29.isValidElement)(children) || children.type !== "tr") return children;
|
|
57394
57560
|
const row = children;
|
|
57395
|
-
return (0,
|
|
57561
|
+
return (0, import_react29.cloneElement)(row, {
|
|
57396
57562
|
ref: setNodeRef,
|
|
57397
57563
|
className: row.props.className
|
|
57398
57564
|
});
|
|
@@ -57486,7 +57652,7 @@ function columnWidthVar(width, resizedWidth, id, resizable) {
|
|
|
57486
57652
|
};
|
|
57487
57653
|
}
|
|
57488
57654
|
function DefaultJsonCell({ value }) {
|
|
57489
|
-
const [open, setOpen] = (0,
|
|
57655
|
+
const [open, setOpen] = (0, import_react29.useState)(false);
|
|
57490
57656
|
const host = useMatrxDataTableHost();
|
|
57491
57657
|
const Viewer = host.JsonViewer;
|
|
57492
57658
|
const text = JSON.stringify(value, null, 2);
|
|
@@ -57566,7 +57732,7 @@ function resolveStringTitle(title, fallback) {
|
|
|
57566
57732
|
}
|
|
57567
57733
|
|
|
57568
57734
|
// src/data-table/MatrxTableCard.tsx
|
|
57569
|
-
var
|
|
57735
|
+
var import_react30 = require("react");
|
|
57570
57736
|
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
57571
57737
|
function nounText(noun) {
|
|
57572
57738
|
return `${noun.count.toLocaleString()} ${noun.count === 1 ? noun.singular : noun.plural}`;
|
|
@@ -57590,10 +57756,10 @@ function MatrxTableCard({
|
|
|
57590
57756
|
className
|
|
57591
57757
|
}) {
|
|
57592
57758
|
const { Link } = useMatrxDataTableHost();
|
|
57593
|
-
const [toolbarSlot, setToolbarSlot] = (0,
|
|
57594
|
-
const [footerSlot, setFooterSlot] = (0,
|
|
57595
|
-
const [reportedTotal, setReportedTotal] = (0,
|
|
57596
|
-
const context = (0,
|
|
57759
|
+
const [toolbarSlot, setToolbarSlot] = (0, import_react30.useState)(null);
|
|
57760
|
+
const [footerSlot, setFooterSlot] = (0, import_react30.useState)(null);
|
|
57761
|
+
const [reportedTotal, setReportedTotal] = (0, import_react30.useState)(void 0);
|
|
57762
|
+
const context = (0, import_react30.useMemo)(
|
|
57597
57763
|
() => ({ appearance: "embedded", toolbarSlot, footerSlot, initialRows, reportTotal: setReportedTotal }),
|
|
57598
57764
|
[toolbarSlot, footerSlot, initialRows]
|
|
57599
57765
|
);
|
|
@@ -57706,7 +57872,7 @@ function MatrxTableCardEmpty({ message, action, children }) {
|
|
|
57706
57872
|
}
|
|
57707
57873
|
|
|
57708
57874
|
// src/data-table/SavedViewsControl.tsx
|
|
57709
|
-
var
|
|
57875
|
+
var import_react31 = require("react");
|
|
57710
57876
|
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
57711
57877
|
function SavedViewsControl({
|
|
57712
57878
|
views,
|
|
@@ -57723,14 +57889,14 @@ function SavedViewsControl({
|
|
|
57723
57889
|
onRemove,
|
|
57724
57890
|
related
|
|
57725
57891
|
}) {
|
|
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,
|
|
57892
|
+
const unsavedChangesId = (0, import_react31.useId)();
|
|
57893
|
+
const [saveOpen, setSaveOpen] = (0, import_react31.useState)(false);
|
|
57894
|
+
const [name, setName] = (0, import_react31.useState)("");
|
|
57895
|
+
const [saving, setSaving] = (0, import_react31.useState)(false);
|
|
57896
|
+
const [removing, setRemoving] = (0, import_react31.useState)(false);
|
|
57897
|
+
const [actionError, setActionError] = (0, import_react31.useState)(null);
|
|
57898
|
+
const [pendingSelect, setPendingSelect] = (0, import_react31.useState)(void 0);
|
|
57899
|
+
const [pendingRemove, setPendingRemove] = (0, import_react31.useState)(null);
|
|
57734
57900
|
const visibleError = actionError ?? error;
|
|
57735
57901
|
const select = (id) => {
|
|
57736
57902
|
if (id === activeId) return;
|
|
@@ -57948,7 +58114,7 @@ function downloadTableAsXlsx({
|
|
|
57948
58114
|
}
|
|
57949
58115
|
|
|
57950
58116
|
// src/data-table/drill-url-state.ts
|
|
57951
|
-
var
|
|
58117
|
+
var import_react32 = require("react");
|
|
57952
58118
|
var import_url_state4 = require("@ai-matrx/kit/url-state");
|
|
57953
58119
|
function useDrillUrlState({
|
|
57954
58120
|
fallback,
|
|
@@ -57956,19 +58122,19 @@ function useDrillUrlState({
|
|
|
57956
58122
|
}) {
|
|
57957
58123
|
const params = (0, import_url_state4.useUrlSearchParams)();
|
|
57958
58124
|
const fallbackKey = JSON.stringify(fallback);
|
|
57959
|
-
const question = (0,
|
|
58125
|
+
const question = (0, import_react32.useMemo)(
|
|
57960
58126
|
() => drillQuestionFromParams(params, JSON.parse(fallbackKey), prefix),
|
|
57961
58127
|
[params, fallbackKey, prefix]
|
|
57962
58128
|
);
|
|
57963
58129
|
const fromAddress = addressHasDrill(params, prefix);
|
|
57964
|
-
const setQuestion = (0,
|
|
58130
|
+
const setQuestion = (0, import_react32.useCallback)(
|
|
57965
58131
|
(next) => {
|
|
57966
58132
|
const current = new URLSearchParams(window.location.search);
|
|
57967
58133
|
(0, import_url_state4.commitUrlParams)(drillQuestionToParams(next, current, prefix), "push");
|
|
57968
58134
|
},
|
|
57969
58135
|
[prefix]
|
|
57970
58136
|
);
|
|
57971
|
-
const clearAddress = (0,
|
|
58137
|
+
const clearAddress = (0, import_react32.useCallback)(() => {
|
|
57972
58138
|
const current = new URLSearchParams(window.location.search);
|
|
57973
58139
|
const patch = drillQuestionToParams({ by: [], across: null, show: [], where: [] }, current, prefix);
|
|
57974
58140
|
(0, import_url_state4.commitUrlParams)(patch, "replace");
|