@ai-matrx/records-ui 0.116.34 → 0.116.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -1
- package/dist/index.cjs +35 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +110 -82
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -23650,7 +23650,7 @@ import { fieldKindFor, measureKey as measureKey5 } from "@ai-matrx/records";
|
|
|
23650
23650
|
import { Select as Select8, SelectContent as SelectContent6, SelectItem as SelectItem6, SelectTrigger as SelectTrigger6, SelectValue as SelectValue6 } from "@ai-matrx/design-system";
|
|
23651
23651
|
|
|
23652
23652
|
// src/ChartBlock.tsx
|
|
23653
|
-
import { useMemo as useMemo47 } from "react";
|
|
23653
|
+
import { useMemo as useMemo47, useRef as useRef35 } from "react";
|
|
23654
23654
|
import {
|
|
23655
23655
|
Area,
|
|
23656
23656
|
AreaChart,
|
|
@@ -24578,6 +24578,20 @@ function planCategoryTicks(slotPx, charPx = TICK_CHAR_PX, minChars = TICK_MIN_CH
|
|
|
24578
24578
|
const step2 = Math.max(1, Math.ceil((minChars * charPx + 4) / slot));
|
|
24579
24579
|
return { step: step2, perLine: Math.max(3, Math.floor((slot * step2 - 4) / charPx)) };
|
|
24580
24580
|
}
|
|
24581
|
+
function ScatterName(props) {
|
|
24582
|
+
const { placed } = props;
|
|
24583
|
+
const text = String(props.value ?? "");
|
|
24584
|
+
const x = Number(props.x ?? 0);
|
|
24585
|
+
const y = Number(props.y ?? 0) - 8;
|
|
24586
|
+
const key = `${x}|${y}|${text}`;
|
|
24587
|
+
if (placed.current.keys.includes(key)) placed.current = { keys: [], boxes: [] };
|
|
24588
|
+
placed.current.keys.push(key);
|
|
24589
|
+
const w = text.length * 6.4;
|
|
24590
|
+
const box = { l: x - w / 2, r: x + w / 2, t: y - 7, b: y + 7 };
|
|
24591
|
+
if (placed.current.boxes.some((o) => box.l < o.r + 4 && o.l < box.r + 4 && box.t < o.b && o.t < box.b)) return /* @__PURE__ */ jsx83("g", {});
|
|
24592
|
+
placed.current.boxes.push(box);
|
|
24593
|
+
return /* @__PURE__ */ jsx83("text", { x, y, textAnchor: "middle", fontSize: 10, className: "fill-muted-foreground", "data-records-chart-label": "", children: text });
|
|
24594
|
+
}
|
|
24581
24595
|
function lineAxis(width, count) {
|
|
24582
24596
|
const plan = planCategoryTicks((width - 56) / Math.max(count, 1));
|
|
24583
24597
|
const pad2 = Math.min(30, Math.ceil(plan.perLine * TICK_CHAR_PX / 2));
|
|
@@ -24641,6 +24655,7 @@ function Drawing({
|
|
|
24641
24655
|
const pretty2 = usePrettyWith(prettyPlain);
|
|
24642
24656
|
const compactTick = useCompactWith(compactTickPlain);
|
|
24643
24657
|
const labelText = (v) => typeof v === "number" ? pretty2(v).length > 7 ? compactTick(v) : pretty2(v) : "";
|
|
24658
|
+
const scatterNames = useRef35({ keys: [], boxes: [] });
|
|
24644
24659
|
const compared = series.length > 1;
|
|
24645
24660
|
const drawOrder = compared ? [series[1], series[0]] : series;
|
|
24646
24661
|
const goalLine = (horizontal2) => goal && typeof goal.value === "number" ? /* @__PURE__ */ jsx83(
|
|
@@ -24683,7 +24698,7 @@ function Drawing({
|
|
|
24683
24698
|
nameKey: "label",
|
|
24684
24699
|
innerRadius: hole ? dataLabels ? DONUT_LABELLED.inner : 44 : 0,
|
|
24685
24700
|
outerRadius: dataLabels ? DONUT_LABELLED.outer : 66,
|
|
24686
|
-
...dataLabels ? donutLabelProps(points.map((p) => p.values[series[0]] ?? 0), dataLabels === "value" ? (v) => labelText(v) : null) : {},
|
|
24701
|
+
...dataLabels ? donutLabelProps(points.map((p) => p.values[series[0]] ?? 0), dataLabels === "value" ? (v) => labelText(v) : null, hole) : {},
|
|
24687
24702
|
paddingAngle: donutGap(points.length),
|
|
24688
24703
|
isAnimationActive: false,
|
|
24689
24704
|
...click ? { onClick: click, className: "cursor-pointer" } : {},
|
|
@@ -24808,7 +24823,7 @@ function Drawing({
|
|
|
24808
24823
|
}
|
|
24809
24824
|
}
|
|
24810
24825
|
),
|
|
24811
|
-
/* @__PURE__ */ jsx83(Scatter, { data: dots, fill: SERIES_COLORS[0], isAnimationActive: false, ...click ? { onClick: (_e, index) => click(null, index), className: "cursor-pointer" } : {}, children: dataLabels && dots.length <= 12 ? /* @__PURE__ */ jsx83(LabelList, { dataKey: "label",
|
|
24826
|
+
/* @__PURE__ */ jsx83(Scatter, { data: dots, fill: SERIES_COLORS[0], isAnimationActive: false, ...click ? { onClick: (_e, index) => click(null, index), className: "cursor-pointer" } : {}, children: dataLabels && dots.length <= 12 ? /* @__PURE__ */ jsx83(LabelList, { dataKey: "label", content: /* @__PURE__ */ jsx83(ScatterName, { placed: scatterNames }) }) : null })
|
|
24812
24827
|
] }) });
|
|
24813
24828
|
}
|
|
24814
24829
|
if (kind2 === "line") {
|
|
@@ -24923,16 +24938,28 @@ function SpacedLabel(props) {
|
|
|
24923
24938
|
return placement === "end" ? /* @__PURE__ */ jsx83("text", { x: x + w + 4, y: y + h / 2, dominantBaseline: "central", fontSize: 10, className: "fill-muted-foreground tabular-nums", "data-records-chart-label": "", children: words2 }) : /* @__PURE__ */ jsx83("text", { x: x + w / 2, y: y - 5, textAnchor: "middle", fontSize: 10, className: "fill-muted-foreground tabular-nums", "data-records-chart-label": "", children: words2 });
|
|
24924
24939
|
}
|
|
24925
24940
|
var DONUT_LABELLED = { inner: 30, outer: 46 };
|
|
24926
|
-
function
|
|
24941
|
+
function insideLabelRadius(inner, outer) {
|
|
24942
|
+
return inner <= 0 ? outer * 0.62 : (inner + outer) / 2;
|
|
24943
|
+
}
|
|
24944
|
+
var INSIDE_LABEL_BOX = { w: 24, h: 11 };
|
|
24945
|
+
function donutLabelPlan(values, outer = DONUT_LABELLED.outer, inner = DONUT_LABELLED.inner) {
|
|
24927
24946
|
const total = values.reduce((a, b) => a + (b > 0 ? b : 0), 0);
|
|
24928
24947
|
if (total <= 0) return values.map(() => "none");
|
|
24929
24948
|
let acc = 0;
|
|
24930
24949
|
const lastY = { left: null, right: null };
|
|
24950
|
+
const insideBoxes = [];
|
|
24951
|
+
const rIn = insideLabelRadius(inner, outer);
|
|
24931
24952
|
return values.map((v) => {
|
|
24932
24953
|
const share = v > 0 ? v / total : 0;
|
|
24933
24954
|
const mid = (acc + share / 2) * 2 * Math.PI;
|
|
24934
24955
|
acc += share;
|
|
24935
|
-
if (share >= 0.09)
|
|
24956
|
+
if (share >= 0.09) {
|
|
24957
|
+
const at = { x: Math.cos(mid) * rIn, y: -Math.sin(mid) * rIn };
|
|
24958
|
+
if (!insideBoxes.some((b) => Math.abs(b.x - at.x) < INSIDE_LABEL_BOX.w && Math.abs(b.y - at.y) < INSIDE_LABEL_BOX.h)) {
|
|
24959
|
+
insideBoxes.push(at);
|
|
24960
|
+
return "inside";
|
|
24961
|
+
}
|
|
24962
|
+
}
|
|
24936
24963
|
if (share < 0.03) return "none";
|
|
24937
24964
|
const y = -Math.sin(mid) * (outer + 10);
|
|
24938
24965
|
const side = Math.cos(mid) >= 0 ? "right" : "left";
|
|
@@ -24942,8 +24969,9 @@ function donutLabelPlan(values, outer = DONUT_LABELLED.outer) {
|
|
|
24942
24969
|
return "outside";
|
|
24943
24970
|
});
|
|
24944
24971
|
}
|
|
24945
|
-
function donutLabelProps(values, asValue) {
|
|
24946
|
-
const
|
|
24972
|
+
function donutLabelProps(values, asValue, hole = true) {
|
|
24973
|
+
const innerR = hole ? DONUT_LABELLED.inner : 0;
|
|
24974
|
+
const plan = donutLabelPlan(values, DONUT_LABELLED.outer, innerR);
|
|
24947
24975
|
const total = values.reduce((a, b) => a + (b > 0 ? b : 0), 0);
|
|
24948
24976
|
const words2 = (i) => asValue ? asValue(values[i] ?? 0) : `${Math.round((values[i] ?? 0) / (total || 1) * 100)}%`;
|
|
24949
24977
|
return {
|
|
@@ -24960,7 +24988,7 @@ function donutLabelProps(values, asValue) {
|
|
|
24960
24988
|
const rad = Math.PI / 180;
|
|
24961
24989
|
const mid = p.midAngle ?? 0;
|
|
24962
24990
|
if (where === "inside") {
|
|
24963
|
-
const r = (
|
|
24991
|
+
const r = insideLabelRadius(p.innerRadius ?? 0, p.outerRadius ?? 0);
|
|
24964
24992
|
return /* @__PURE__ */ jsx83("text", { x: (p.cx ?? 0) + r * Math.cos(-mid * rad), y: (p.cy ?? 0) + r * Math.sin(-mid * rad), textAnchor: "middle", dominantBaseline: "central", fontSize: 9, className: "fill-background font-medium tabular-nums", "data-records-chart-label": "", children: words2(at) });
|
|
24965
24993
|
}
|
|
24966
24994
|
return /* @__PURE__ */ jsx83("text", { x: p.x ?? 0, y: p.y ?? 0, textAnchor: Math.cos(-mid * rad) >= 0 ? "start" : "end", dominantBaseline: "central", fontSize: 9, className: "fill-muted-foreground tabular-nums", "data-records-chart-label": "", children: words2(at) });
|
|
@@ -25298,7 +25326,7 @@ function PivotLayout({ view, fields, filter, onChange, remembered }) {
|
|
|
25298
25326
|
}
|
|
25299
25327
|
|
|
25300
25328
|
// src/MapLayout.tsx
|
|
25301
|
-
import { useEffect as useEffect69, useMemo as useMemo50, useRef as
|
|
25329
|
+
import { useEffect as useEffect69, useMemo as useMemo50, useRef as useRef36, useState as useState78 } from "react";
|
|
25302
25330
|
import { useFieldMutation as useFieldMutation6, useRecordMutation as useRecordMutation2 } from "@ai-matrx/records/react";
|
|
25303
25331
|
import { Button as Button61, Select as Select10, SelectContent as SelectContent8, SelectItem as SelectItem8, SelectTrigger as SelectTrigger8, SelectValue as SelectValue8, cn as cn38 } from "@ai-matrx/design-system";
|
|
25304
25332
|
|
|
@@ -25427,9 +25455,9 @@ function MapLayout({ view, fields, rows, titleKey, openRecordId, onOpenRecord, o
|
|
|
25427
25455
|
const saved = !coordinateMode ? coordinateColumns(fields) : null;
|
|
25428
25456
|
const [found, setFound] = useState78(() => /* @__PURE__ */ new Map());
|
|
25429
25457
|
const [lookup, setLookup] = useState78({ running: false, notFound: /* @__PURE__ */ new Set(), couldNot: false });
|
|
25430
|
-
const tried =
|
|
25431
|
-
const passing =
|
|
25432
|
-
const mounted =
|
|
25458
|
+
const tried = useRef36(/* @__PURE__ */ new Set());
|
|
25459
|
+
const passing = useRef36(false);
|
|
25460
|
+
const mounted = useRef36(true);
|
|
25433
25461
|
useEffect69(() => {
|
|
25434
25462
|
mounted.current = true;
|
|
25435
25463
|
return () => {
|
|
@@ -25558,7 +25586,7 @@ function MapLayout({ view, fields, rows, titleKey, openRecordId, onOpenRecord, o
|
|
|
25558
25586
|
}
|
|
25559
25587
|
|
|
25560
25588
|
// src/OrgChartLayout.tsx
|
|
25561
|
-
import { useCallback as useCallback35, useEffect as useEffect70, useMemo as useMemo51, useRef as
|
|
25589
|
+
import { useCallback as useCallback35, useEffect as useEffect70, useMemo as useMemo51, useRef as useRef37, useState as useState79 } from "react";
|
|
25562
25590
|
import { Button as Button62, Select as Select11, SelectContent as SelectContent9, SelectItem as SelectItem9, SelectTrigger as SelectTrigger9, SelectValue as SelectValue9, cn as cn39 } from "@ai-matrx/design-system";
|
|
25563
25591
|
|
|
25564
25592
|
// src/orgTree.ts
|
|
@@ -25713,9 +25741,9 @@ function OrgChartLayout({ view, fields, rows, titleKey, openRecordId, onOpenReco
|
|
|
25713
25741
|
const forest = useMemo51(() => chosen ? buildOrgForest(rows, chosen.key) : null, [rows, chosen?.key]);
|
|
25714
25742
|
const [collapsed, setCollapsed] = useState79(() => /* @__PURE__ */ new Set());
|
|
25715
25743
|
const layout = useMemo51(() => forest ? layoutOrg(forest.roots, collapsed) : null, [forest, collapsed]);
|
|
25716
|
-
const box =
|
|
25744
|
+
const box = useRef37(null);
|
|
25717
25745
|
const [view2, setView2] = useState79({ scale: 1, x: 16, y: 16 });
|
|
25718
|
-
const fitted =
|
|
25746
|
+
const fitted = useRef37("");
|
|
25719
25747
|
const fit = useCallback35(() => {
|
|
25720
25748
|
const el = box.current;
|
|
25721
25749
|
if (!el || !layout) return;
|
|
@@ -25728,9 +25756,9 @@ function OrgChartLayout({ view, fields, rows, titleKey, openRecordId, onOpenReco
|
|
|
25728
25756
|
fit();
|
|
25729
25757
|
}
|
|
25730
25758
|
}, [shape, layout, fit]);
|
|
25731
|
-
const pointers =
|
|
25732
|
-
const gesture =
|
|
25733
|
-
const suppress =
|
|
25759
|
+
const pointers = useRef37(/* @__PURE__ */ new Map());
|
|
25760
|
+
const gesture = useRef37(null);
|
|
25761
|
+
const suppress = useRef37(false);
|
|
25734
25762
|
const onDown = (e) => {
|
|
25735
25763
|
pointers.current.set(e.pointerId, { x: e.clientX, y: e.clientY });
|
|
25736
25764
|
const pts = [...pointers.current.values()];
|
|
@@ -27463,7 +27491,7 @@ function ArchivedPortals({
|
|
|
27463
27491
|
import { ArchivedDisclosure as ArchivedDisclosure2, ARCHIVED_NEVER_DESTROYED } from "@ai-matrx/design-system";
|
|
27464
27492
|
|
|
27465
27493
|
// src/ViewBar.tsx
|
|
27466
|
-
import { useCallback as useCallback38, useEffect as useEffect74, useRef as
|
|
27494
|
+
import { useCallback as useCallback38, useEffect as useEffect74, useRef as useRef38, useState as useState83 } from "react";
|
|
27467
27495
|
import { useRecordsClient as useRecordsClient65 } from "@ai-matrx/records/react";
|
|
27468
27496
|
import { Badge as Badge11, Button as Button66, Input as Input6, Popover as Popover8, PopoverContent as PopoverContent8, PopoverTrigger as PopoverTrigger8, Skeleton as Skeleton20, cn as cn42 } from "@ai-matrx/design-system";
|
|
27469
27497
|
import { Button as ControlButton2, Switch as Switch4, Tile } from "@ai-matrx/design-system/controls";
|
|
@@ -27576,8 +27604,8 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews,
|
|
|
27576
27604
|
if (!initialViews || initialViews.length === 0) return activeViewId ?? null;
|
|
27577
27605
|
return (initialViews.find((v) => v.id === activeViewId) ?? defaultViewOf(initialViews) ?? initialViews[0]).id;
|
|
27578
27606
|
});
|
|
27579
|
-
const readOnMount =
|
|
27580
|
-
const pendingPick =
|
|
27607
|
+
const readOnMount = useRef38(initialViews === void 0);
|
|
27608
|
+
const pendingPick = useRef38(null);
|
|
27581
27609
|
const [naming, setNaming] = useState83(false);
|
|
27582
27610
|
const [draftName, setDraftName] = useState83("");
|
|
27583
27611
|
const [open, setOpen] = useState83(false);
|
|
@@ -27597,7 +27625,7 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews,
|
|
|
27597
27625
|
});
|
|
27598
27626
|
const [renamingSection, setRenamingSection] = useState83(null);
|
|
27599
27627
|
const [dragging, setDragging] = useState83(false);
|
|
27600
|
-
const justDragged =
|
|
27628
|
+
const justDragged = useRef38(false);
|
|
27601
27629
|
const sensors = useSensors(useSensor(PointerSensor, { activationConstraint: { distance: 6 } }));
|
|
27602
27630
|
async function dropped(event) {
|
|
27603
27631
|
setDragging(false);
|
|
@@ -28060,7 +28088,7 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews,
|
|
|
28060
28088
|
}
|
|
28061
28089
|
|
|
28062
28090
|
// src/ProposalRow.tsx
|
|
28063
|
-
import { useEffect as useEffect75, useRef as
|
|
28091
|
+
import { useEffect as useEffect75, useRef as useRef39, useState as useState84 } from "react";
|
|
28064
28092
|
import { useRecordsClient as useRecordsClient66 } from "@ai-matrx/records/react";
|
|
28065
28093
|
import { Badge as Badge12, Button as Button67, cn as cn43 } from "@ai-matrx/design-system";
|
|
28066
28094
|
import { jsx as jsx92, jsxs as jsxs85 } from "react/jsx-runtime";
|
|
@@ -28078,7 +28106,7 @@ function ProposalRow({
|
|
|
28078
28106
|
const [settled, setSettled] = useState84(outcome ?? null);
|
|
28079
28107
|
const [busy, setBusy] = useState84(false);
|
|
28080
28108
|
const [confirming, setConfirming] = useState84(false);
|
|
28081
|
-
const drawnVersion =
|
|
28109
|
+
const drawnVersion = useRef39(null);
|
|
28082
28110
|
const needsVersion = change.act === "update" && Boolean(change.record) && change.version === void 0 && !onApply && !settled;
|
|
28083
28111
|
useEffect75(() => {
|
|
28084
28112
|
if (needsVersion && change.record && !drawnVersion.current) drawnVersion.current = (0, recordVersions_exports.readVersionNow)(client, change.record);
|
|
@@ -28168,7 +28196,7 @@ function ProposalRow({
|
|
|
28168
28196
|
}
|
|
28169
28197
|
|
|
28170
28198
|
// src/ActionInbox.tsx
|
|
28171
|
-
import { useCallback as useCallback39, useEffect as useEffect76, useMemo as useMemo53, useRef as
|
|
28199
|
+
import { useCallback as useCallback39, useEffect as useEffect76, useMemo as useMemo53, useRef as useRef40, useState as useState85 } from "react";
|
|
28172
28200
|
import { useRecordsClient as useRecordsClient67 } from "@ai-matrx/records/react";
|
|
28173
28201
|
import { Badge as Badge13, Button as Button68, Checkbox as Checkbox6, Skeleton as Skeleton21, cn as cn44 } from "@ai-matrx/design-system";
|
|
28174
28202
|
import { toggleSelection as toggleSelection2 } from "@ai-matrx/design-system/data-table";
|
|
@@ -28271,9 +28299,9 @@ function ActionInbox({
|
|
|
28271
28299
|
const [outcome, setOutcome] = useState85({});
|
|
28272
28300
|
const [busy, setBusy] = useState85(null);
|
|
28273
28301
|
const [cursor, setCursor] = useState85(0);
|
|
28274
|
-
const listRef =
|
|
28302
|
+
const listRef = useRef40(null);
|
|
28275
28303
|
const [selected, setSelected] = useState85(/* @__PURE__ */ new Set());
|
|
28276
|
-
const anchor =
|
|
28304
|
+
const anchor = useRef40(null);
|
|
28277
28305
|
const [deciding, setDeciding] = useState85(false);
|
|
28278
28306
|
const [batchSaid, setBatchSaid] = useState85(null);
|
|
28279
28307
|
const [view, setView] = useState85("inbox");
|
|
@@ -28337,9 +28365,9 @@ function ActionInbox({
|
|
|
28337
28365
|
[client, load]
|
|
28338
28366
|
);
|
|
28339
28367
|
const [held, setHeld] = useState85({});
|
|
28340
|
-
const holds2 =
|
|
28341
|
-
const lastHold =
|
|
28342
|
-
const holdSeq =
|
|
28368
|
+
const holds2 = useRef40(/* @__PURE__ */ new Map());
|
|
28369
|
+
const lastHold = useRef40(null);
|
|
28370
|
+
const holdSeq = useRef40(0);
|
|
28343
28371
|
const [, tick] = useState85(0);
|
|
28344
28372
|
useEffect76(() => {
|
|
28345
28373
|
if (Object.keys(held).length === 0) return;
|
|
@@ -28397,7 +28425,7 @@ function ActionInbox({
|
|
|
28397
28425
|
flush();
|
|
28398
28426
|
};
|
|
28399
28427
|
}, []);
|
|
28400
|
-
const resumed =
|
|
28428
|
+
const resumed = useRef40(false);
|
|
28401
28429
|
useEffect76(() => {
|
|
28402
28430
|
if (resumed.current || items === null || view !== "inbox") return;
|
|
28403
28431
|
resumed.current = true;
|
|
@@ -29148,7 +29176,7 @@ function FormResultsPanel({ form, className }) {
|
|
|
29148
29176
|
}
|
|
29149
29177
|
|
|
29150
29178
|
// src/PortalBuilder.tsx
|
|
29151
|
-
import { useCallback as useCallback40, useEffect as useEffect78, useMemo as useMemo55, useRef as
|
|
29179
|
+
import { useCallback as useCallback40, useEffect as useEffect78, useMemo as useMemo55, useRef as useRef41, useState as useState87 } from "react";
|
|
29152
29180
|
import { useRecordsClient as useRecordsClient68, useTables } from "@ai-matrx/records/react";
|
|
29153
29181
|
import { BasicInput as BasicInput11, Button as Button70, Checkbox as Checkbox7, Label as Label10, Separator as Separator9, Skeleton as Skeleton23, cn as cn46 } from "@ai-matrx/design-system";
|
|
29154
29182
|
import { Select as Select13 } from "@ai-matrx/design-system/controls";
|
|
@@ -29254,7 +29282,7 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
|
|
|
29254
29282
|
if (on) void loadFields(t.id);
|
|
29255
29283
|
}
|
|
29256
29284
|
const [linking, setLinking] = useState87(null);
|
|
29257
|
-
const linkingNow =
|
|
29285
|
+
const linkingNow = useRef41(null);
|
|
29258
29286
|
async function addLinkBack(id) {
|
|
29259
29287
|
const clients = (tables.data ?? []).find((t) => t.id === clientTableId);
|
|
29260
29288
|
if (!clientTableId || !clients) return;
|
|
@@ -29281,7 +29309,7 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
|
|
|
29281
29309
|
linkingNow.current = null;
|
|
29282
29310
|
setLinking(null);
|
|
29283
29311
|
}
|
|
29284
|
-
const autoLinked =
|
|
29312
|
+
const autoLinked = useRef41(/* @__PURE__ */ new Set());
|
|
29285
29313
|
useEffect78(() => {
|
|
29286
29314
|
if (linking !== null || !clientTableId) return;
|
|
29287
29315
|
for (const e of Object.values(exposures)) {
|
|
@@ -31472,7 +31500,7 @@ import { copyText as copyText6 } from "@ai-matrx/kit/clipboard";
|
|
|
31472
31500
|
import { dropKeptDraft, keepDraft, readKeptDraft } from "@ai-matrx/kit/drafts";
|
|
31473
31501
|
import { ErrorBox as ErrorBox3 } from "@ai-matrx/design-system";
|
|
31474
31502
|
import { Select as Select15 } from "@ai-matrx/design-system/controls";
|
|
31475
|
-
import { useCallback as useCallback46, useEffect as useEffect85, useMemo as useMemo60, useRef as
|
|
31503
|
+
import { useCallback as useCallback46, useEffect as useEffect85, useMemo as useMemo60, useRef as useRef43, useState as useState95 } from "react";
|
|
31476
31504
|
import { DndContext as DndContext2, KeyboardSensor, PointerSensor as PointerSensor2, closestCenter as closestCenter2, useSensor as useSensor2, useSensors as useSensors2 } from "@dnd-kit/core";
|
|
31477
31505
|
import { SortableContext as SortableContext2, arrayMove, sortableKeyboardCoordinates, useSortable as useSortable2, verticalListSortingStrategy as verticalListSortingStrategy2 } from "@dnd-kit/sortable";
|
|
31478
31506
|
import { CSS as CSS3 } from "@dnd-kit/utilities";
|
|
@@ -31745,7 +31773,7 @@ function EmbedSnippets({ url, label }) {
|
|
|
31745
31773
|
}
|
|
31746
31774
|
|
|
31747
31775
|
// src/FormRunner.tsx
|
|
31748
|
-
import { useCallback as useCallback45, useEffect as useEffect84, useMemo as useMemo59, useRef as
|
|
31776
|
+
import { useCallback as useCallback45, useEffect as useEffect84, useMemo as useMemo59, useRef as useRef42, useState as useState94 } from "react";
|
|
31749
31777
|
import { useFields as useFields24, useOptionalRecordsClient as useOptionalRecordsClient9 } from "@ai-matrx/records/react";
|
|
31750
31778
|
import { Button as Button77, Label as Label14, Progress, Skeleton as Skeleton28, cn as cn54, formThemeClasses } from "@ai-matrx/design-system";
|
|
31751
31779
|
import { answerRefusal, formRoutes, pipeAnswers, submissionStamp } from "@ai-matrx/records/forms";
|
|
@@ -31863,11 +31891,11 @@ function FormStage({
|
|
|
31863
31891
|
const routes = formRoutes(form);
|
|
31864
31892
|
const [routeKnown, setRouteKnown] = useState94(() => !routes || !whichAsked);
|
|
31865
31893
|
const [stopped, setStopped] = useState94(null);
|
|
31866
|
-
const answersRef =
|
|
31894
|
+
const answersRef = useRef42(answers);
|
|
31867
31895
|
answersRef.current = answers;
|
|
31868
31896
|
const choose = autoAdvance ?? form.autoAdvance ?? true;
|
|
31869
|
-
const decoy =
|
|
31870
|
-
const stage =
|
|
31897
|
+
const decoy = useRef42("");
|
|
31898
|
+
const stage = useRef42(null);
|
|
31871
31899
|
const questions = useMemo59(() => {
|
|
31872
31900
|
const byKey = new Map((fields ?? []).map((f) => [f.key, f]));
|
|
31873
31901
|
return (form.questions ?? []).map((q) => {
|
|
@@ -31930,13 +31958,13 @@ function FormStage({
|
|
|
31930
31958
|
};
|
|
31931
31959
|
}, [whichAsked, questions, answers]);
|
|
31932
31960
|
const live = questions.filter((q) => !hidden[q.key]);
|
|
31933
|
-
const told =
|
|
31961
|
+
const told = useRef42(answers);
|
|
31934
31962
|
useEffect84(() => {
|
|
31935
31963
|
if (told.current === answers) return;
|
|
31936
31964
|
told.current = answers;
|
|
31937
31965
|
onAnswersChange?.(answers);
|
|
31938
31966
|
}, [answers, onAnswersChange]);
|
|
31939
|
-
const resumeAt =
|
|
31967
|
+
const resumeAt = useRef42(
|
|
31940
31968
|
resumed && initialAnswers && Object.keys(initialAnswers).length > 0 ? questions.find((q) => {
|
|
31941
31969
|
const v = initialAnswers[q.key];
|
|
31942
31970
|
return v === void 0 || v === null || v === "";
|
|
@@ -32050,9 +32078,9 @@ function FormStage({
|
|
|
32050
32078
|
if (stillMissing) refuse(stillMissing, refusalFor2(stillMissing));
|
|
32051
32079
|
else void submit();
|
|
32052
32080
|
}
|
|
32053
|
-
const routing =
|
|
32081
|
+
const routing = useRef42(false);
|
|
32054
32082
|
const [routingNow, setRoutingNow] = useState94(false);
|
|
32055
|
-
const typedAhead =
|
|
32083
|
+
const typedAhead = useRef42("");
|
|
32056
32084
|
useEffect84(() => {
|
|
32057
32085
|
if (!routingNow) return;
|
|
32058
32086
|
const hold = (event) => {
|
|
@@ -32086,7 +32114,7 @@ function FormStage({
|
|
|
32086
32114
|
useEffect84(() => {
|
|
32087
32115
|
if (!routingNow) pourTypedAhead();
|
|
32088
32116
|
}, [routingNow, at, pourTypedAhead]);
|
|
32089
|
-
const advanceRef =
|
|
32117
|
+
const advanceRef = useRef42(advance);
|
|
32090
32118
|
advanceRef.current = advance;
|
|
32091
32119
|
const chosen = useCallback45(() => {
|
|
32092
32120
|
if (!oneAtATime || !choose) return;
|
|
@@ -32115,7 +32143,7 @@ function FormStage({
|
|
|
32115
32143
|
input?.focus();
|
|
32116
32144
|
pourTypedAhead();
|
|
32117
32145
|
}, [index, done, started]);
|
|
32118
|
-
const startTold =
|
|
32146
|
+
const startTold = useRef42(false);
|
|
32119
32147
|
useEffect84(() => {
|
|
32120
32148
|
if (startTold.current || !onStart) return;
|
|
32121
32149
|
if (Object.values(answers).some((v) => v !== void 0 && v !== null && v !== "")) {
|
|
@@ -32123,7 +32151,7 @@ function FormStage({
|
|
|
32123
32151
|
onStart();
|
|
32124
32152
|
}
|
|
32125
32153
|
}, [answers, onStart]);
|
|
32126
|
-
const shownTold =
|
|
32154
|
+
const shownTold = useRef42(/* @__PURE__ */ new Set());
|
|
32127
32155
|
useEffect84(() => {
|
|
32128
32156
|
if (!onQuestionShown || !started || done) return;
|
|
32129
32157
|
for (const q of oneAtATime ? current ? [current] : [] : live) {
|
|
@@ -32491,7 +32519,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
|
|
|
32491
32519
|
const [restoredAt, setRestoredAt] = useState95(null);
|
|
32492
32520
|
const [showResults, setShowResults] = useState95(false);
|
|
32493
32521
|
const [adding, setAdding] = useState95(false);
|
|
32494
|
-
const keysBeforeAdd =
|
|
32522
|
+
const keysBeforeAdd = useRef43(null);
|
|
32495
32523
|
const [makeOnMount, setMakeOnMount] = useState95("waiting");
|
|
32496
32524
|
const publicOrigin = host.publicOrigin ?? (typeof window === "undefined" ? "" : window.location.origin);
|
|
32497
32525
|
const load = useCallback46(async () => {
|
|
@@ -33425,7 +33453,7 @@ function NotifyOnAnswer({
|
|
|
33425
33453
|
}
|
|
33426
33454
|
|
|
33427
33455
|
// src/DocRender.tsx
|
|
33428
|
-
import { useCallback as useCallback47, useEffect as useEffect86, useRef as
|
|
33456
|
+
import { useCallback as useCallback47, useEffect as useEffect86, useRef as useRef44, useState as useState96 } from "react";
|
|
33429
33457
|
import { useRecordsClient as useRecordsClient75 } from "@ai-matrx/records/react";
|
|
33430
33458
|
import { Button as Button79, Skeleton as Skeleton30, cn as cn56 } from "@ai-matrx/design-system";
|
|
33431
33459
|
import { jsx as jsx106, jsxs as jsxs99 } from "react/jsx-runtime";
|
|
@@ -33436,7 +33464,7 @@ function DocRender({ templateId, recordId, filename, onRendered, className }) {
|
|
|
33436
33464
|
const [showing, setShowing] = useState96(null);
|
|
33437
33465
|
const [error, setError] = useState96(null);
|
|
33438
33466
|
const [busy, setBusy] = useState96(null);
|
|
33439
|
-
const paper =
|
|
33467
|
+
const paper = useRef44(null);
|
|
33440
33468
|
const load = useCallback47(async () => {
|
|
33441
33469
|
const [body, held] = await Promise.all([
|
|
33442
33470
|
client.docRenderBody({ template_id: templateId, record_id: recordId }),
|
|
@@ -35207,7 +35235,7 @@ function TargetControl({
|
|
|
35207
35235
|
|
|
35208
35236
|
// src/QuestionPanel.tsx
|
|
35209
35237
|
import { copyText as copyText7 } from "@ai-matrx/kit/clipboard";
|
|
35210
|
-
import { useEffect as useEffect90, useMemo as useMemo63, useRef as
|
|
35238
|
+
import { useEffect as useEffect90, useMemo as useMemo63, useRef as useRef45, useState as useState101 } from "react";
|
|
35211
35239
|
import { Badge as Badge16, BasicInput as BasicInput20, Button as Button84, Checkbox as Checkbox11, Label as Label16, Skeleton as Skeleton34, cn as cn61 } from "@ai-matrx/design-system";
|
|
35212
35240
|
import { useFields as useFields29, useRecordsClient as useRecordsClient80 } from "@ai-matrx/records/react";
|
|
35213
35241
|
|
|
@@ -35296,7 +35324,7 @@ function QuestionPanel({ tableId, activeQuestionId, draft, className }) {
|
|
|
35296
35324
|
const [saveError, setSaveError] = useState101(null);
|
|
35297
35325
|
const [saving, setSaving] = useState101(false);
|
|
35298
35326
|
const [linkMissed, setLinkMissed] = useState101(false);
|
|
35299
|
-
const openedFromLink =
|
|
35327
|
+
const openedFromLink = useRef45(false);
|
|
35300
35328
|
useEffect90(() => {
|
|
35301
35329
|
let live = true;
|
|
35302
35330
|
void (0, question_exports.questionsOf)(client, tableId).then((answer2) => {
|
|
@@ -36178,7 +36206,7 @@ function AgentAnswer({
|
|
|
36178
36206
|
}
|
|
36179
36207
|
|
|
36180
36208
|
// src/PageScreen.tsx
|
|
36181
|
-
import { useCallback as useCallback51, useEffect as useEffect93, useMemo as useMemo65, useRef as
|
|
36209
|
+
import { useCallback as useCallback51, useEffect as useEffect93, useMemo as useMemo65, useRef as useRef46, useState as useState104 } from "react";
|
|
36182
36210
|
import { useRecordsClient as useRecordsClient83 } from "@ai-matrx/records/react";
|
|
36183
36211
|
import { BasicInput as BasicInput23, Button as Button87, Skeleton as Skeleton37, cn as cn63 } from "@ai-matrx/design-system";
|
|
36184
36212
|
|
|
@@ -37310,7 +37338,7 @@ function PageScreen({
|
|
|
37310
37338
|
const [run, setRun] = useState104(null);
|
|
37311
37339
|
const [saveError, setSaveError] = useState104(null);
|
|
37312
37340
|
const [askingToArchive, setAskingToArchive] = useState104(false);
|
|
37313
|
-
const canvas =
|
|
37341
|
+
const canvas = useRef46(null);
|
|
37314
37342
|
const [making, setMaking] = useState104("waiting");
|
|
37315
37343
|
const id = page?.id ?? pageId ?? null;
|
|
37316
37344
|
const load = useCallback51(
|
|
@@ -37511,7 +37539,7 @@ function PageScreen({
|
|
|
37511
37539
|
}
|
|
37512
37540
|
|
|
37513
37541
|
// src/InterfaceScreen.tsx
|
|
37514
|
-
import { useCallback as useCallback52, useEffect as useEffect94, useMemo as useMemo66, useRef as
|
|
37542
|
+
import { useCallback as useCallback52, useEffect as useEffect94, useMemo as useMemo66, useRef as useRef47, useState as useState105 } from "react";
|
|
37515
37543
|
import { useRecordsClient as useRecordsClient84 } from "@ai-matrx/records/react";
|
|
37516
37544
|
import { BasicInput as BasicInput24, Button as Button88, Skeleton as Skeleton38, cn as cn64 } from "@ai-matrx/design-system";
|
|
37517
37545
|
import { Fragment as Fragment52, jsx as jsx116, jsxs as jsxs109 } from "react/jsx-runtime";
|
|
@@ -37548,7 +37576,7 @@ function InterfaceScreen({
|
|
|
37548
37576
|
const [making, setMaking] = useState105("waiting");
|
|
37549
37577
|
const [askingToArchive, setAskingToArchive] = useState105(false);
|
|
37550
37578
|
const [localPage, setLocalPage] = useState105(null);
|
|
37551
|
-
const canvas =
|
|
37579
|
+
const canvas = useRef47(null);
|
|
37552
37580
|
const load = useCallback52(
|
|
37553
37581
|
async (want) => {
|
|
37554
37582
|
const answered = await client.interfaceRead({ interface_id: want });
|
|
@@ -37825,7 +37853,7 @@ function InterfaceScreen({
|
|
|
37825
37853
|
|
|
37826
37854
|
// src/FormsPanel.tsx
|
|
37827
37855
|
import { copyText as copyText8 } from "@ai-matrx/kit/clipboard";
|
|
37828
|
-
import { useCallback as useCallback53, useEffect as useEffect95, useRef as
|
|
37856
|
+
import { useCallback as useCallback53, useEffect as useEffect95, useRef as useRef48, useState as useState106 } from "react";
|
|
37829
37857
|
import { useRecordsClient as useRecordsClient85, useTable as useTable33 } from "@ai-matrx/records/react";
|
|
37830
37858
|
import { publicFormPath as publicFormPath2 } from "@ai-matrx/records";
|
|
37831
37859
|
import { Badge as Badge17, Button as Button89, Skeleton as Skeleton39, cn as cn65 } from "@ai-matrx/design-system";
|
|
@@ -37854,7 +37882,7 @@ function FormsPanel({ tableId, activeFormId, asView = false, className }) {
|
|
|
37854
37882
|
useEffect95(() => {
|
|
37855
37883
|
if (linked && rights.structure) setBuilding(true);
|
|
37856
37884
|
}, [linked, rights.structure]);
|
|
37857
|
-
const openedAsView =
|
|
37885
|
+
const openedAsView = useRef48(false);
|
|
37858
37886
|
useEffect95(() => {
|
|
37859
37887
|
if (!asView || openedAsView.current || forms === null || forms.length === 0 || !rights.structure) return;
|
|
37860
37888
|
openedAsView.current = true;
|
|
@@ -38015,12 +38043,12 @@ function FormsPanel({ tableId, activeFormId, asView = false, className }) {
|
|
|
38015
38043
|
}
|
|
38016
38044
|
|
|
38017
38045
|
// src/CaptureSheet.tsx
|
|
38018
|
-
import { useCallback as useCallback55, useEffect as useEffect97, useRef as
|
|
38046
|
+
import { useCallback as useCallback55, useEffect as useEffect97, useRef as useRef50, useState as useState108 } from "react";
|
|
38019
38047
|
import { useFields as useFields32, useRecordsClient as useRecordsClient87, useTable as useTable34 } from "@ai-matrx/records/react";
|
|
38020
38048
|
import { Button as Button91, Input as Input8, Skeleton as Skeleton41, Textarea as Textarea7, cn as cn67 } from "@ai-matrx/design-system";
|
|
38021
38049
|
|
|
38022
38050
|
// src/CaptureRun.tsx
|
|
38023
|
-
import { useCallback as useCallback54, useEffect as useEffect96, useMemo as useMemo67, useRef as
|
|
38051
|
+
import { useCallback as useCallback54, useEffect as useEffect96, useMemo as useMemo67, useRef as useRef49, useState as useState107 } from "react";
|
|
38024
38052
|
import {
|
|
38025
38053
|
coerceTypedAnswer,
|
|
38026
38054
|
coercionLabel,
|
|
@@ -38078,7 +38106,7 @@ function CaptureRun({ sheetId, face: given, className }) {
|
|
|
38078
38106
|
const [items, setItems] = useState107([]);
|
|
38079
38107
|
const [lastSynced, setLastSynced] = useState107(null);
|
|
38080
38108
|
const [sending, setSending] = useState107(false);
|
|
38081
|
-
const queueRef =
|
|
38109
|
+
const queueRef = useRef49(null);
|
|
38082
38110
|
useEffect96(() => {
|
|
38083
38111
|
const q2 = openCaptureQueue({
|
|
38084
38112
|
onChange: (c, all) => {
|
|
@@ -38458,7 +38486,7 @@ function AdHocCaptureSheet({
|
|
|
38458
38486
|
const [error, setError] = useState108(null);
|
|
38459
38487
|
const [uploadError, setUploadError] = useState108(null);
|
|
38460
38488
|
const [flushing, setFlushing] = useState108(false);
|
|
38461
|
-
const queue =
|
|
38489
|
+
const queue = useRef50([]);
|
|
38462
38490
|
const keep = useCallback55(
|
|
38463
38491
|
async (next) => {
|
|
38464
38492
|
queue.current = next;
|
|
@@ -38989,7 +39017,7 @@ function useEmbedHandshake(args) {
|
|
|
38989
39017
|
|
|
38990
39018
|
// src/TablePage.tsx
|
|
38991
39019
|
import { copyText as copyText13 } from "@ai-matrx/kit/clipboard";
|
|
38992
|
-
import { useCallback as useCallback60, useEffect as useEffect105, useMemo as useMemo72, useRef as
|
|
39020
|
+
import { useCallback as useCallback60, useEffect as useEffect105, useMemo as useMemo72, useRef as useRef52, useState as useState120 } from "react";
|
|
38993
39021
|
import { archivedByLine as archivedByLine2 } from "@ai-matrx/records";
|
|
38994
39022
|
import { tableShapeChanged as tableShapeChanged11, useFields as useFields34, useRecordsClient as useRecordsClient92, useSeededAnswer, useTable as useTable36, useTableArchive as useTableArchive2 } from "@ai-matrx/records/react";
|
|
38995
39023
|
import {
|
|
@@ -39796,7 +39824,7 @@ function phoneTableActions(actions) {
|
|
|
39796
39824
|
}
|
|
39797
39825
|
|
|
39798
39826
|
// src/presence.tsx
|
|
39799
|
-
import { useEffect as useEffect103, useMemo as useMemo71, useRef as
|
|
39827
|
+
import { useEffect as useEffect103, useMemo as useMemo71, useRef as useRef51, useState as useState118, useSyncExternalStore as useSyncExternalStore4 } from "react";
|
|
39800
39828
|
import { jsx as jsx130, jsxs as jsxs123 } from "react/jsx-runtime";
|
|
39801
39829
|
var NO_PEOPLE = [];
|
|
39802
39830
|
var MAX_AVATARS = 4;
|
|
@@ -39843,7 +39871,7 @@ function TablePresence({ tableId }) {
|
|
|
39843
39871
|
const { session, people: published } = useTablePresence(tableId);
|
|
39844
39872
|
const roster = useMemberRoster();
|
|
39845
39873
|
const people = useMemo71(() => namePeople(published, roster), [published, roster]);
|
|
39846
|
-
const root =
|
|
39874
|
+
const root = useRef51(null);
|
|
39847
39875
|
const css = useMemo71(() => presenceOutlineCss(people), [people]);
|
|
39848
39876
|
useEffect103(() => {
|
|
39849
39877
|
if (!session || typeof MutationObserver === "undefined") return;
|
|
@@ -40433,7 +40461,7 @@ function TablePage({
|
|
|
40433
40461
|
return seededViews.find((v) => v.id === asked2) ?? defaultViewOf(seededViews) ?? seededViews[0];
|
|
40434
40462
|
});
|
|
40435
40463
|
const [looks, setLooks] = useState120(() => seededViews ? seededOpening?.looks : void 0);
|
|
40436
|
-
const looksSeededFor =
|
|
40464
|
+
const looksSeededFor = useRef52(seededViews && seededOpening ? tableId : null);
|
|
40437
40465
|
useEffect105(() => {
|
|
40438
40466
|
if (looksSeededFor.current === tableId) {
|
|
40439
40467
|
looksSeededFor.current = null;
|
|
@@ -40461,7 +40489,7 @@ function TablePage({
|
|
|
40461
40489
|
const opened = questionsFromLink ? { ...openedByPackage, main: "questions" } : formFromLink ? { ...openedByPackage, main: "form" } : openedByPackage;
|
|
40462
40490
|
const [views, setViews] = useState120(() => seededViews);
|
|
40463
40491
|
const [pickedViewId, setPickedViewId] = useState120(savedFromLink);
|
|
40464
|
-
const viewSeen =
|
|
40492
|
+
const viewSeen = useRef52(null);
|
|
40465
40493
|
const [viewLinkMissed, setViewLinkMissed] = useState120(false);
|
|
40466
40494
|
const railAsked = typeof activeRail === "string" ? activeRail.trim() : "";
|
|
40467
40495
|
const railUnknown = railAsked !== "" && railFromParam(railAsked) === null ? railAsked : null;
|
|
@@ -40491,7 +40519,7 @@ function TablePage({
|
|
|
40491
40519
|
const { open: renameOpen, setOpen: setRenameOpen, ask: askRename, menuContentProps: renameMenuProps } = useRenameFromMenu();
|
|
40492
40520
|
const [archiveAsked, setArchiveAsked] = useState120(0);
|
|
40493
40521
|
const pageArchive = useTableArchive2(tableId);
|
|
40494
|
-
const archiveRunning =
|
|
40522
|
+
const archiveRunning = useRef52(false);
|
|
40495
40523
|
const archiveFromMenu = useCallback60(async () => {
|
|
40496
40524
|
if (archiveRunning.current) return;
|
|
40497
40525
|
archiveRunning.current = true;
|
|
@@ -40572,7 +40600,7 @@ function TablePage({
|
|
|
40572
40600
|
lookDiffers: view ? lookDiffers(view, look) : false
|
|
40573
40601
|
};
|
|
40574
40602
|
const shownSignature = JSON.stringify(shownReport);
|
|
40575
|
-
const reportRef =
|
|
40603
|
+
const reportRef = useRef52(onShownViewChange);
|
|
40576
40604
|
reportRef.current = onShownViewChange;
|
|
40577
40605
|
useEffect105(() => {
|
|
40578
40606
|
reportRef.current?.(JSON.parse(shownSignature));
|
|
@@ -40583,8 +40611,8 @@ function TablePage({
|
|
|
40583
40611
|
onViewChanged?.(addressForView(view, next));
|
|
40584
40612
|
void patchView({ layout: next });
|
|
40585
40613
|
};
|
|
40586
|
-
const reportedRecords =
|
|
40587
|
-
const lastActiveRecord =
|
|
40614
|
+
const reportedRecords = useRef52(/* @__PURE__ */ new Set());
|
|
40615
|
+
const lastActiveRecord = useRef52(activeRecordId ?? null);
|
|
40588
40616
|
useEffect105(() => {
|
|
40589
40617
|
const before = lastActiveRecord.current;
|
|
40590
40618
|
lastActiveRecord.current = activeRecordId ?? null;
|
|
@@ -40607,7 +40635,7 @@ function TablePage({
|
|
|
40607
40635
|
if (rail !== "record") setRecordFull(false);
|
|
40608
40636
|
}, [rail]);
|
|
40609
40637
|
const shownRecord = rail === "record" ? openRecord : null;
|
|
40610
|
-
const reportedRecord =
|
|
40638
|
+
const reportedRecord = useRef52(activeRecordId ?? null);
|
|
40611
40639
|
useEffect105(() => {
|
|
40612
40640
|
if (shownRecord === reportedRecord.current) return;
|
|
40613
40641
|
const how = shownRecord === null ? "close" : reportedRecord.current === null ? "open" : "step";
|
|
@@ -40666,7 +40694,7 @@ function TablePage({
|
|
|
40666
40694
|
},
|
|
40667
40695
|
[client, tableId, view, looks, viewLocked, sayLocked]
|
|
40668
40696
|
);
|
|
40669
|
-
const arrival =
|
|
40697
|
+
const arrival = useRef52(viewAddress ?? null);
|
|
40670
40698
|
const [gridQuery, setGridQuery] = useState120(null);
|
|
40671
40699
|
const [addressResetEpoch, setAddressResetEpoch] = useState120(0);
|
|
40672
40700
|
const reportGrid = useCallback60((q) => {
|
|
@@ -40677,7 +40705,7 @@ function TablePage({
|
|
|
40677
40705
|
() => ({ initial: arrival.current, report: reportGrid, resetEpoch: addressResetEpoch }),
|
|
40678
40706
|
[reportGrid, addressResetEpoch]
|
|
40679
40707
|
);
|
|
40680
|
-
const hiddenApplied =
|
|
40708
|
+
const hiddenApplied = useRef52(false);
|
|
40681
40709
|
useEffect105(() => {
|
|
40682
40710
|
const hidden = arrival.current?.hidden;
|
|
40683
40711
|
if (hiddenApplied.current || !view || !looks || !hidden || hidden.length === 0) return;
|
|
@@ -40698,9 +40726,9 @@ function TablePage({
|
|
|
40698
40726
|
const gridPending = !isViewAddressEmpty({ ...arrival.current ?? {}, hidden: [] });
|
|
40699
40727
|
const addressReady = Boolean(view && looks) && (gridQuery !== null || !gridPending);
|
|
40700
40728
|
const addressSignature = JSON.stringify(viewAddressToParams(addressNow));
|
|
40701
|
-
const addressReportRef =
|
|
40729
|
+
const addressReportRef = useRef52(onViewAddressChange);
|
|
40702
40730
|
addressReportRef.current = onViewAddressChange;
|
|
40703
|
-
const addressSent =
|
|
40731
|
+
const addressSent = useRef52(null);
|
|
40704
40732
|
useEffect105(() => {
|
|
40705
40733
|
if (!addressReady) return;
|
|
40706
40734
|
if (addressSent.current === null && addressSignature === JSON.stringify(viewAddressToParams(arrival.current))) {
|
|
@@ -41023,9 +41051,9 @@ function TablePage({
|
|
|
41023
41051
|
}
|
|
41024
41052
|
});
|
|
41025
41053
|
const openedEntry = ACTION_PRESS.find((entry) => entry.press.main !== void 0 && entry.press.main === main) ?? ACTION_PRESS.find((entry) => entry.press.rail !== void 0 && entry.press.rail === rail) ?? null;
|
|
41026
|
-
const actionsRef =
|
|
41054
|
+
const actionsRef = useRef52(actions);
|
|
41027
41055
|
actionsRef.current = actions;
|
|
41028
|
-
const onActionsRef =
|
|
41056
|
+
const onActionsRef = useRef52(onActions);
|
|
41029
41057
|
onActionsRef.current = onActions;
|
|
41030
41058
|
useEffect105(() => {
|
|
41031
41059
|
onActionsRef.current?.(actionsRef.current);
|
|
@@ -41657,7 +41685,7 @@ function usePublicReadOnly(client, organizationId, tableId, table, rights) {
|
|
|
41657
41685
|
import { formatCount as formatCount8 } from "@ai-matrx/kit/format";
|
|
41658
41686
|
import { TapTargetSearchGroup as TapTargetSearchGroup2, TooltipProvider } from "@ai-matrx/design-system";
|
|
41659
41687
|
import { MatrxTableCardShowMore as MatrxTableCardShowMore3 } from "@ai-matrx/design-system/data-table";
|
|
41660
|
-
import { useEffect as useEffect106, useMemo as useMemo73, useRef as
|
|
41688
|
+
import { useEffect as useEffect106, useMemo as useMemo73, useRef as useRef53, useState as useState121 } from "react";
|
|
41661
41689
|
import { Button as Button100, ErrorBox as ErrorBox5, Input as Input12, cn as cn73 } from "@ai-matrx/design-system";
|
|
41662
41690
|
import { SEED_FRESH_MS, useRecordsClient as useRecordsClient93, useSeededAnswerAt } from "@ai-matrx/records/react";
|
|
41663
41691
|
import { Fragment as Fragment58, jsx as jsx132, jsxs as jsxs125 } from "react/jsx-runtime";
|
|
@@ -41765,7 +41793,7 @@ function EntityChartBlock({ source, kind: kind2, by, measure, title, where, orga
|
|
|
41765
41793
|
const base = { title: title ?? "", kind: kind2, measures, group_by: by ? [by] : [] };
|
|
41766
41794
|
const seeded = useSeededAnswerAt(`entity-chart:${ask2}`, (c) => c.drillAsk({ source, question }));
|
|
41767
41795
|
const [block, setBlock] = useState121(() => seeded ? blockOfAnswer({ ok: true, data: seeded.data }, base, by) : null);
|
|
41768
|
-
const seededFor =
|
|
41796
|
+
const seededFor = useRef53(seeded ? { ask: `${ask2}|${kind2}|${title ?? ""}`, at: seeded.at } : null);
|
|
41769
41797
|
useEffect106(() => {
|
|
41770
41798
|
const held = seededFor.current;
|
|
41771
41799
|
if (held && held.ask === `${ask2}|${kind2}|${title ?? ""}` && Date.now() - held.at < SEED_FRESH_MS) return;
|
|
@@ -42108,7 +42136,7 @@ function PreviewForms({ preview, booking }) {
|
|
|
42108
42136
|
}
|
|
42109
42137
|
|
|
42110
42138
|
// src/SectionCard.tsx
|
|
42111
|
-
import { useEffect as useEffect109, useRef as
|
|
42139
|
+
import { useEffect as useEffect109, useRef as useRef54, useState as useState125 } from "react";
|
|
42112
42140
|
import { atLeast } from "@ai-matrx/records/field-kinds";
|
|
42113
42141
|
import { useFields as useFields35, useRecordMutation as useRecordMutation3, useRecordPage as useRecordPage4, useRecordsClient as useRecordsClient95, useTable as useTable37 } from "@ai-matrx/records/react";
|
|
42114
42142
|
import {
|
|
@@ -42509,7 +42537,7 @@ function columnsOf(values) {
|
|
|
42509
42537
|
var same3 = (a, b) => JSON.stringify(a ?? null) === JSON.stringify(b ?? null);
|
|
42510
42538
|
function useDraft(stored, save) {
|
|
42511
42539
|
const [draft, setDraft] = useState125(null);
|
|
42512
|
-
const latest =
|
|
42540
|
+
const latest = useRef54({ draft, save, stored });
|
|
42513
42541
|
useEffect109(() => {
|
|
42514
42542
|
latest.current = { draft, save, stored };
|
|
42515
42543
|
});
|
|
@@ -42916,7 +42944,7 @@ function TableSectionCard(props) {
|
|
|
42916
42944
|
const rowNames = nameField ? rows.map((r) => String((r.document ?? {})[nameField.key] ?? "")).filter((n) => n !== "") : [];
|
|
42917
42945
|
const refused = table.error ?? fieldsRead.error ?? page.error;
|
|
42918
42946
|
const gridStyle = { gridTemplateColumns: `minmax(8rem, 12rem) repeat(${Math.max(columns.length, 1)}, minmax(0, 1fr)) 4.5rem` };
|
|
42919
|
-
const sectionRef =
|
|
42947
|
+
const sectionRef = useRef54(null);
|
|
42920
42948
|
const narrow = useNarrow2(sectionRef);
|
|
42921
42949
|
const cellLabel = (c) => c.part ? columns.filter((x) => x.field.key === c.field.key).map((x) => x.header).join(" \xB7 ") : c.header;
|
|
42922
42950
|
return /* @__PURE__ */ jsxs129("section", { ref: sectionRef, "data-records-section-card": "", "data-narrow": narrow ? "" : void 0, className: cn75("rounded-2xl border border-border bg-card text-card-foreground", className), children: [
|