@ai-matrx/records-ui 0.116.33 → 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 +37 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +112 -87
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -20887,10 +20887,6 @@ function typedFormulaFields(all, rounds = FORMULA_TYPING_ROUNDS) {
|
|
|
20887
20887
|
byRounds.set(rounds, cur);
|
|
20888
20888
|
return cur;
|
|
20889
20889
|
}
|
|
20890
|
-
function formulaTypeOf(targetId, all, rounds = FORMULA_TYPING_ROUNDS) {
|
|
20891
|
-
const expr = ownExpression(all.find((f) => f.id === targetId));
|
|
20892
|
-
return expr ? formulaResultKind(expr, typedFormulaFields(all, rounds)) : "unknown";
|
|
20893
|
-
}
|
|
20894
20890
|
function formulaResultKind(node, all) {
|
|
20895
20891
|
if (!node || typeof node !== "object" || Array.isArray(node)) return "unknown";
|
|
20896
20892
|
const n = node;
|
|
@@ -20928,7 +20924,8 @@ function formulaResultKind(node, all) {
|
|
|
20928
20924
|
return FORMULA_NODE_RESULTS[op] ?? "unknown";
|
|
20929
20925
|
}
|
|
20930
20926
|
function isDateFormula(field, all) {
|
|
20931
|
-
|
|
20927
|
+
const expr = ownExpression(field);
|
|
20928
|
+
return !!expr && formulaResultKind(expr, typedFormulaFields(all)) === "date";
|
|
20932
20929
|
}
|
|
20933
20930
|
function isComputedField(field) {
|
|
20934
20931
|
return field?.type === "formula";
|
|
@@ -23653,7 +23650,7 @@ import { fieldKindFor, measureKey as measureKey5 } from "@ai-matrx/records";
|
|
|
23653
23650
|
import { Select as Select8, SelectContent as SelectContent6, SelectItem as SelectItem6, SelectTrigger as SelectTrigger6, SelectValue as SelectValue6 } from "@ai-matrx/design-system";
|
|
23654
23651
|
|
|
23655
23652
|
// src/ChartBlock.tsx
|
|
23656
|
-
import { useMemo as useMemo47 } from "react";
|
|
23653
|
+
import { useMemo as useMemo47, useRef as useRef35 } from "react";
|
|
23657
23654
|
import {
|
|
23658
23655
|
Area,
|
|
23659
23656
|
AreaChart,
|
|
@@ -24581,6 +24578,20 @@ function planCategoryTicks(slotPx, charPx = TICK_CHAR_PX, minChars = TICK_MIN_CH
|
|
|
24581
24578
|
const step2 = Math.max(1, Math.ceil((minChars * charPx + 4) / slot));
|
|
24582
24579
|
return { step: step2, perLine: Math.max(3, Math.floor((slot * step2 - 4) / charPx)) };
|
|
24583
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
|
+
}
|
|
24584
24595
|
function lineAxis(width, count) {
|
|
24585
24596
|
const plan = planCategoryTicks((width - 56) / Math.max(count, 1));
|
|
24586
24597
|
const pad2 = Math.min(30, Math.ceil(plan.perLine * TICK_CHAR_PX / 2));
|
|
@@ -24644,6 +24655,7 @@ function Drawing({
|
|
|
24644
24655
|
const pretty2 = usePrettyWith(prettyPlain);
|
|
24645
24656
|
const compactTick = useCompactWith(compactTickPlain);
|
|
24646
24657
|
const labelText = (v) => typeof v === "number" ? pretty2(v).length > 7 ? compactTick(v) : pretty2(v) : "";
|
|
24658
|
+
const scatterNames = useRef35({ keys: [], boxes: [] });
|
|
24647
24659
|
const compared = series.length > 1;
|
|
24648
24660
|
const drawOrder = compared ? [series[1], series[0]] : series;
|
|
24649
24661
|
const goalLine = (horizontal2) => goal && typeof goal.value === "number" ? /* @__PURE__ */ jsx83(
|
|
@@ -24686,7 +24698,7 @@ function Drawing({
|
|
|
24686
24698
|
nameKey: "label",
|
|
24687
24699
|
innerRadius: hole ? dataLabels ? DONUT_LABELLED.inner : 44 : 0,
|
|
24688
24700
|
outerRadius: dataLabels ? DONUT_LABELLED.outer : 66,
|
|
24689
|
-
...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) : {},
|
|
24690
24702
|
paddingAngle: donutGap(points.length),
|
|
24691
24703
|
isAnimationActive: false,
|
|
24692
24704
|
...click ? { onClick: click, className: "cursor-pointer" } : {},
|
|
@@ -24811,7 +24823,7 @@ function Drawing({
|
|
|
24811
24823
|
}
|
|
24812
24824
|
}
|
|
24813
24825
|
),
|
|
24814
|
-
/* @__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 })
|
|
24815
24827
|
] }) });
|
|
24816
24828
|
}
|
|
24817
24829
|
if (kind2 === "line") {
|
|
@@ -24926,16 +24938,28 @@ function SpacedLabel(props) {
|
|
|
24926
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 });
|
|
24927
24939
|
}
|
|
24928
24940
|
var DONUT_LABELLED = { inner: 30, outer: 46 };
|
|
24929
|
-
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) {
|
|
24930
24946
|
const total = values.reduce((a, b) => a + (b > 0 ? b : 0), 0);
|
|
24931
24947
|
if (total <= 0) return values.map(() => "none");
|
|
24932
24948
|
let acc = 0;
|
|
24933
24949
|
const lastY = { left: null, right: null };
|
|
24950
|
+
const insideBoxes = [];
|
|
24951
|
+
const rIn = insideLabelRadius(inner, outer);
|
|
24934
24952
|
return values.map((v) => {
|
|
24935
24953
|
const share = v > 0 ? v / total : 0;
|
|
24936
24954
|
const mid = (acc + share / 2) * 2 * Math.PI;
|
|
24937
24955
|
acc += share;
|
|
24938
|
-
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
|
+
}
|
|
24939
24963
|
if (share < 0.03) return "none";
|
|
24940
24964
|
const y = -Math.sin(mid) * (outer + 10);
|
|
24941
24965
|
const side = Math.cos(mid) >= 0 ? "right" : "left";
|
|
@@ -24945,8 +24969,9 @@ function donutLabelPlan(values, outer = DONUT_LABELLED.outer) {
|
|
|
24945
24969
|
return "outside";
|
|
24946
24970
|
});
|
|
24947
24971
|
}
|
|
24948
|
-
function donutLabelProps(values, asValue) {
|
|
24949
|
-
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);
|
|
24950
24975
|
const total = values.reduce((a, b) => a + (b > 0 ? b : 0), 0);
|
|
24951
24976
|
const words2 = (i) => asValue ? asValue(values[i] ?? 0) : `${Math.round((values[i] ?? 0) / (total || 1) * 100)}%`;
|
|
24952
24977
|
return {
|
|
@@ -24963,7 +24988,7 @@ function donutLabelProps(values, asValue) {
|
|
|
24963
24988
|
const rad = Math.PI / 180;
|
|
24964
24989
|
const mid = p.midAngle ?? 0;
|
|
24965
24990
|
if (where === "inside") {
|
|
24966
|
-
const r = (
|
|
24991
|
+
const r = insideLabelRadius(p.innerRadius ?? 0, p.outerRadius ?? 0);
|
|
24967
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) });
|
|
24968
24993
|
}
|
|
24969
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) });
|
|
@@ -25301,7 +25326,7 @@ function PivotLayout({ view, fields, filter, onChange, remembered }) {
|
|
|
25301
25326
|
}
|
|
25302
25327
|
|
|
25303
25328
|
// src/MapLayout.tsx
|
|
25304
|
-
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";
|
|
25305
25330
|
import { useFieldMutation as useFieldMutation6, useRecordMutation as useRecordMutation2 } from "@ai-matrx/records/react";
|
|
25306
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";
|
|
25307
25332
|
|
|
@@ -25430,9 +25455,9 @@ function MapLayout({ view, fields, rows, titleKey, openRecordId, onOpenRecord, o
|
|
|
25430
25455
|
const saved = !coordinateMode ? coordinateColumns(fields) : null;
|
|
25431
25456
|
const [found, setFound] = useState78(() => /* @__PURE__ */ new Map());
|
|
25432
25457
|
const [lookup, setLookup] = useState78({ running: false, notFound: /* @__PURE__ */ new Set(), couldNot: false });
|
|
25433
|
-
const tried =
|
|
25434
|
-
const passing =
|
|
25435
|
-
const mounted =
|
|
25458
|
+
const tried = useRef36(/* @__PURE__ */ new Set());
|
|
25459
|
+
const passing = useRef36(false);
|
|
25460
|
+
const mounted = useRef36(true);
|
|
25436
25461
|
useEffect69(() => {
|
|
25437
25462
|
mounted.current = true;
|
|
25438
25463
|
return () => {
|
|
@@ -25561,7 +25586,7 @@ function MapLayout({ view, fields, rows, titleKey, openRecordId, onOpenRecord, o
|
|
|
25561
25586
|
}
|
|
25562
25587
|
|
|
25563
25588
|
// src/OrgChartLayout.tsx
|
|
25564
|
-
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";
|
|
25565
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";
|
|
25566
25591
|
|
|
25567
25592
|
// src/orgTree.ts
|
|
@@ -25716,9 +25741,9 @@ function OrgChartLayout({ view, fields, rows, titleKey, openRecordId, onOpenReco
|
|
|
25716
25741
|
const forest = useMemo51(() => chosen ? buildOrgForest(rows, chosen.key) : null, [rows, chosen?.key]);
|
|
25717
25742
|
const [collapsed, setCollapsed] = useState79(() => /* @__PURE__ */ new Set());
|
|
25718
25743
|
const layout = useMemo51(() => forest ? layoutOrg(forest.roots, collapsed) : null, [forest, collapsed]);
|
|
25719
|
-
const box =
|
|
25744
|
+
const box = useRef37(null);
|
|
25720
25745
|
const [view2, setView2] = useState79({ scale: 1, x: 16, y: 16 });
|
|
25721
|
-
const fitted =
|
|
25746
|
+
const fitted = useRef37("");
|
|
25722
25747
|
const fit = useCallback35(() => {
|
|
25723
25748
|
const el = box.current;
|
|
25724
25749
|
if (!el || !layout) return;
|
|
@@ -25731,9 +25756,9 @@ function OrgChartLayout({ view, fields, rows, titleKey, openRecordId, onOpenReco
|
|
|
25731
25756
|
fit();
|
|
25732
25757
|
}
|
|
25733
25758
|
}, [shape, layout, fit]);
|
|
25734
|
-
const pointers =
|
|
25735
|
-
const gesture =
|
|
25736
|
-
const suppress =
|
|
25759
|
+
const pointers = useRef37(/* @__PURE__ */ new Map());
|
|
25760
|
+
const gesture = useRef37(null);
|
|
25761
|
+
const suppress = useRef37(false);
|
|
25737
25762
|
const onDown = (e) => {
|
|
25738
25763
|
pointers.current.set(e.pointerId, { x: e.clientX, y: e.clientY });
|
|
25739
25764
|
const pts = [...pointers.current.values()];
|
|
@@ -27466,7 +27491,7 @@ function ArchivedPortals({
|
|
|
27466
27491
|
import { ArchivedDisclosure as ArchivedDisclosure2, ARCHIVED_NEVER_DESTROYED } from "@ai-matrx/design-system";
|
|
27467
27492
|
|
|
27468
27493
|
// src/ViewBar.tsx
|
|
27469
|
-
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";
|
|
27470
27495
|
import { useRecordsClient as useRecordsClient65 } from "@ai-matrx/records/react";
|
|
27471
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";
|
|
27472
27497
|
import { Button as ControlButton2, Switch as Switch4, Tile } from "@ai-matrx/design-system/controls";
|
|
@@ -27579,8 +27604,8 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews,
|
|
|
27579
27604
|
if (!initialViews || initialViews.length === 0) return activeViewId ?? null;
|
|
27580
27605
|
return (initialViews.find((v) => v.id === activeViewId) ?? defaultViewOf(initialViews) ?? initialViews[0]).id;
|
|
27581
27606
|
});
|
|
27582
|
-
const readOnMount =
|
|
27583
|
-
const pendingPick =
|
|
27607
|
+
const readOnMount = useRef38(initialViews === void 0);
|
|
27608
|
+
const pendingPick = useRef38(null);
|
|
27584
27609
|
const [naming, setNaming] = useState83(false);
|
|
27585
27610
|
const [draftName, setDraftName] = useState83("");
|
|
27586
27611
|
const [open, setOpen] = useState83(false);
|
|
@@ -27600,7 +27625,7 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews,
|
|
|
27600
27625
|
});
|
|
27601
27626
|
const [renamingSection, setRenamingSection] = useState83(null);
|
|
27602
27627
|
const [dragging, setDragging] = useState83(false);
|
|
27603
|
-
const justDragged =
|
|
27628
|
+
const justDragged = useRef38(false);
|
|
27604
27629
|
const sensors = useSensors(useSensor(PointerSensor, { activationConstraint: { distance: 6 } }));
|
|
27605
27630
|
async function dropped(event) {
|
|
27606
27631
|
setDragging(false);
|
|
@@ -28063,7 +28088,7 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews,
|
|
|
28063
28088
|
}
|
|
28064
28089
|
|
|
28065
28090
|
// src/ProposalRow.tsx
|
|
28066
|
-
import { useEffect as useEffect75, useRef as
|
|
28091
|
+
import { useEffect as useEffect75, useRef as useRef39, useState as useState84 } from "react";
|
|
28067
28092
|
import { useRecordsClient as useRecordsClient66 } from "@ai-matrx/records/react";
|
|
28068
28093
|
import { Badge as Badge12, Button as Button67, cn as cn43 } from "@ai-matrx/design-system";
|
|
28069
28094
|
import { jsx as jsx92, jsxs as jsxs85 } from "react/jsx-runtime";
|
|
@@ -28081,7 +28106,7 @@ function ProposalRow({
|
|
|
28081
28106
|
const [settled, setSettled] = useState84(outcome ?? null);
|
|
28082
28107
|
const [busy, setBusy] = useState84(false);
|
|
28083
28108
|
const [confirming, setConfirming] = useState84(false);
|
|
28084
|
-
const drawnVersion =
|
|
28109
|
+
const drawnVersion = useRef39(null);
|
|
28085
28110
|
const needsVersion = change.act === "update" && Boolean(change.record) && change.version === void 0 && !onApply && !settled;
|
|
28086
28111
|
useEffect75(() => {
|
|
28087
28112
|
if (needsVersion && change.record && !drawnVersion.current) drawnVersion.current = (0, recordVersions_exports.readVersionNow)(client, change.record);
|
|
@@ -28171,7 +28196,7 @@ function ProposalRow({
|
|
|
28171
28196
|
}
|
|
28172
28197
|
|
|
28173
28198
|
// src/ActionInbox.tsx
|
|
28174
|
-
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";
|
|
28175
28200
|
import { useRecordsClient as useRecordsClient67 } from "@ai-matrx/records/react";
|
|
28176
28201
|
import { Badge as Badge13, Button as Button68, Checkbox as Checkbox6, Skeleton as Skeleton21, cn as cn44 } from "@ai-matrx/design-system";
|
|
28177
28202
|
import { toggleSelection as toggleSelection2 } from "@ai-matrx/design-system/data-table";
|
|
@@ -28274,9 +28299,9 @@ function ActionInbox({
|
|
|
28274
28299
|
const [outcome, setOutcome] = useState85({});
|
|
28275
28300
|
const [busy, setBusy] = useState85(null);
|
|
28276
28301
|
const [cursor, setCursor] = useState85(0);
|
|
28277
|
-
const listRef =
|
|
28302
|
+
const listRef = useRef40(null);
|
|
28278
28303
|
const [selected, setSelected] = useState85(/* @__PURE__ */ new Set());
|
|
28279
|
-
const anchor =
|
|
28304
|
+
const anchor = useRef40(null);
|
|
28280
28305
|
const [deciding, setDeciding] = useState85(false);
|
|
28281
28306
|
const [batchSaid, setBatchSaid] = useState85(null);
|
|
28282
28307
|
const [view, setView] = useState85("inbox");
|
|
@@ -28340,9 +28365,9 @@ function ActionInbox({
|
|
|
28340
28365
|
[client, load]
|
|
28341
28366
|
);
|
|
28342
28367
|
const [held, setHeld] = useState85({});
|
|
28343
|
-
const holds2 =
|
|
28344
|
-
const lastHold =
|
|
28345
|
-
const holdSeq =
|
|
28368
|
+
const holds2 = useRef40(/* @__PURE__ */ new Map());
|
|
28369
|
+
const lastHold = useRef40(null);
|
|
28370
|
+
const holdSeq = useRef40(0);
|
|
28346
28371
|
const [, tick] = useState85(0);
|
|
28347
28372
|
useEffect76(() => {
|
|
28348
28373
|
if (Object.keys(held).length === 0) return;
|
|
@@ -28400,7 +28425,7 @@ function ActionInbox({
|
|
|
28400
28425
|
flush();
|
|
28401
28426
|
};
|
|
28402
28427
|
}, []);
|
|
28403
|
-
const resumed =
|
|
28428
|
+
const resumed = useRef40(false);
|
|
28404
28429
|
useEffect76(() => {
|
|
28405
28430
|
if (resumed.current || items === null || view !== "inbox") return;
|
|
28406
28431
|
resumed.current = true;
|
|
@@ -29151,7 +29176,7 @@ function FormResultsPanel({ form, className }) {
|
|
|
29151
29176
|
}
|
|
29152
29177
|
|
|
29153
29178
|
// src/PortalBuilder.tsx
|
|
29154
|
-
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";
|
|
29155
29180
|
import { useRecordsClient as useRecordsClient68, useTables } from "@ai-matrx/records/react";
|
|
29156
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";
|
|
29157
29182
|
import { Select as Select13 } from "@ai-matrx/design-system/controls";
|
|
@@ -29257,7 +29282,7 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
|
|
|
29257
29282
|
if (on) void loadFields(t.id);
|
|
29258
29283
|
}
|
|
29259
29284
|
const [linking, setLinking] = useState87(null);
|
|
29260
|
-
const linkingNow =
|
|
29285
|
+
const linkingNow = useRef41(null);
|
|
29261
29286
|
async function addLinkBack(id) {
|
|
29262
29287
|
const clients = (tables.data ?? []).find((t) => t.id === clientTableId);
|
|
29263
29288
|
if (!clientTableId || !clients) return;
|
|
@@ -29284,7 +29309,7 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
|
|
|
29284
29309
|
linkingNow.current = null;
|
|
29285
29310
|
setLinking(null);
|
|
29286
29311
|
}
|
|
29287
|
-
const autoLinked =
|
|
29312
|
+
const autoLinked = useRef41(/* @__PURE__ */ new Set());
|
|
29288
29313
|
useEffect78(() => {
|
|
29289
29314
|
if (linking !== null || !clientTableId) return;
|
|
29290
29315
|
for (const e of Object.values(exposures)) {
|
|
@@ -31475,7 +31500,7 @@ import { copyText as copyText6 } from "@ai-matrx/kit/clipboard";
|
|
|
31475
31500
|
import { dropKeptDraft, keepDraft, readKeptDraft } from "@ai-matrx/kit/drafts";
|
|
31476
31501
|
import { ErrorBox as ErrorBox3 } from "@ai-matrx/design-system";
|
|
31477
31502
|
import { Select as Select15 } from "@ai-matrx/design-system/controls";
|
|
31478
|
-
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";
|
|
31479
31504
|
import { DndContext as DndContext2, KeyboardSensor, PointerSensor as PointerSensor2, closestCenter as closestCenter2, useSensor as useSensor2, useSensors as useSensors2 } from "@dnd-kit/core";
|
|
31480
31505
|
import { SortableContext as SortableContext2, arrayMove, sortableKeyboardCoordinates, useSortable as useSortable2, verticalListSortingStrategy as verticalListSortingStrategy2 } from "@dnd-kit/sortable";
|
|
31481
31506
|
import { CSS as CSS3 } from "@dnd-kit/utilities";
|
|
@@ -31748,7 +31773,7 @@ function EmbedSnippets({ url, label }) {
|
|
|
31748
31773
|
}
|
|
31749
31774
|
|
|
31750
31775
|
// src/FormRunner.tsx
|
|
31751
|
-
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";
|
|
31752
31777
|
import { useFields as useFields24, useOptionalRecordsClient as useOptionalRecordsClient9 } from "@ai-matrx/records/react";
|
|
31753
31778
|
import { Button as Button77, Label as Label14, Progress, Skeleton as Skeleton28, cn as cn54, formThemeClasses } from "@ai-matrx/design-system";
|
|
31754
31779
|
import { answerRefusal, formRoutes, pipeAnswers, submissionStamp } from "@ai-matrx/records/forms";
|
|
@@ -31866,11 +31891,11 @@ function FormStage({
|
|
|
31866
31891
|
const routes = formRoutes(form);
|
|
31867
31892
|
const [routeKnown, setRouteKnown] = useState94(() => !routes || !whichAsked);
|
|
31868
31893
|
const [stopped, setStopped] = useState94(null);
|
|
31869
|
-
const answersRef =
|
|
31894
|
+
const answersRef = useRef42(answers);
|
|
31870
31895
|
answersRef.current = answers;
|
|
31871
31896
|
const choose = autoAdvance ?? form.autoAdvance ?? true;
|
|
31872
|
-
const decoy =
|
|
31873
|
-
const stage =
|
|
31897
|
+
const decoy = useRef42("");
|
|
31898
|
+
const stage = useRef42(null);
|
|
31874
31899
|
const questions = useMemo59(() => {
|
|
31875
31900
|
const byKey = new Map((fields ?? []).map((f) => [f.key, f]));
|
|
31876
31901
|
return (form.questions ?? []).map((q) => {
|
|
@@ -31933,13 +31958,13 @@ function FormStage({
|
|
|
31933
31958
|
};
|
|
31934
31959
|
}, [whichAsked, questions, answers]);
|
|
31935
31960
|
const live = questions.filter((q) => !hidden[q.key]);
|
|
31936
|
-
const told =
|
|
31961
|
+
const told = useRef42(answers);
|
|
31937
31962
|
useEffect84(() => {
|
|
31938
31963
|
if (told.current === answers) return;
|
|
31939
31964
|
told.current = answers;
|
|
31940
31965
|
onAnswersChange?.(answers);
|
|
31941
31966
|
}, [answers, onAnswersChange]);
|
|
31942
|
-
const resumeAt =
|
|
31967
|
+
const resumeAt = useRef42(
|
|
31943
31968
|
resumed && initialAnswers && Object.keys(initialAnswers).length > 0 ? questions.find((q) => {
|
|
31944
31969
|
const v = initialAnswers[q.key];
|
|
31945
31970
|
return v === void 0 || v === null || v === "";
|
|
@@ -32053,9 +32078,9 @@ function FormStage({
|
|
|
32053
32078
|
if (stillMissing) refuse(stillMissing, refusalFor2(stillMissing));
|
|
32054
32079
|
else void submit();
|
|
32055
32080
|
}
|
|
32056
|
-
const routing =
|
|
32081
|
+
const routing = useRef42(false);
|
|
32057
32082
|
const [routingNow, setRoutingNow] = useState94(false);
|
|
32058
|
-
const typedAhead =
|
|
32083
|
+
const typedAhead = useRef42("");
|
|
32059
32084
|
useEffect84(() => {
|
|
32060
32085
|
if (!routingNow) return;
|
|
32061
32086
|
const hold = (event) => {
|
|
@@ -32089,7 +32114,7 @@ function FormStage({
|
|
|
32089
32114
|
useEffect84(() => {
|
|
32090
32115
|
if (!routingNow) pourTypedAhead();
|
|
32091
32116
|
}, [routingNow, at, pourTypedAhead]);
|
|
32092
|
-
const advanceRef =
|
|
32117
|
+
const advanceRef = useRef42(advance);
|
|
32093
32118
|
advanceRef.current = advance;
|
|
32094
32119
|
const chosen = useCallback45(() => {
|
|
32095
32120
|
if (!oneAtATime || !choose) return;
|
|
@@ -32118,7 +32143,7 @@ function FormStage({
|
|
|
32118
32143
|
input?.focus();
|
|
32119
32144
|
pourTypedAhead();
|
|
32120
32145
|
}, [index, done, started]);
|
|
32121
|
-
const startTold =
|
|
32146
|
+
const startTold = useRef42(false);
|
|
32122
32147
|
useEffect84(() => {
|
|
32123
32148
|
if (startTold.current || !onStart) return;
|
|
32124
32149
|
if (Object.values(answers).some((v) => v !== void 0 && v !== null && v !== "")) {
|
|
@@ -32126,7 +32151,7 @@ function FormStage({
|
|
|
32126
32151
|
onStart();
|
|
32127
32152
|
}
|
|
32128
32153
|
}, [answers, onStart]);
|
|
32129
|
-
const shownTold =
|
|
32154
|
+
const shownTold = useRef42(/* @__PURE__ */ new Set());
|
|
32130
32155
|
useEffect84(() => {
|
|
32131
32156
|
if (!onQuestionShown || !started || done) return;
|
|
32132
32157
|
for (const q of oneAtATime ? current ? [current] : [] : live) {
|
|
@@ -32494,7 +32519,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
|
|
|
32494
32519
|
const [restoredAt, setRestoredAt] = useState95(null);
|
|
32495
32520
|
const [showResults, setShowResults] = useState95(false);
|
|
32496
32521
|
const [adding, setAdding] = useState95(false);
|
|
32497
|
-
const keysBeforeAdd =
|
|
32522
|
+
const keysBeforeAdd = useRef43(null);
|
|
32498
32523
|
const [makeOnMount, setMakeOnMount] = useState95("waiting");
|
|
32499
32524
|
const publicOrigin = host.publicOrigin ?? (typeof window === "undefined" ? "" : window.location.origin);
|
|
32500
32525
|
const load = useCallback46(async () => {
|
|
@@ -33428,7 +33453,7 @@ function NotifyOnAnswer({
|
|
|
33428
33453
|
}
|
|
33429
33454
|
|
|
33430
33455
|
// src/DocRender.tsx
|
|
33431
|
-
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";
|
|
33432
33457
|
import { useRecordsClient as useRecordsClient75 } from "@ai-matrx/records/react";
|
|
33433
33458
|
import { Button as Button79, Skeleton as Skeleton30, cn as cn56 } from "@ai-matrx/design-system";
|
|
33434
33459
|
import { jsx as jsx106, jsxs as jsxs99 } from "react/jsx-runtime";
|
|
@@ -33439,7 +33464,7 @@ function DocRender({ templateId, recordId, filename, onRendered, className }) {
|
|
|
33439
33464
|
const [showing, setShowing] = useState96(null);
|
|
33440
33465
|
const [error, setError] = useState96(null);
|
|
33441
33466
|
const [busy, setBusy] = useState96(null);
|
|
33442
|
-
const paper =
|
|
33467
|
+
const paper = useRef44(null);
|
|
33443
33468
|
const load = useCallback47(async () => {
|
|
33444
33469
|
const [body, held] = await Promise.all([
|
|
33445
33470
|
client.docRenderBody({ template_id: templateId, record_id: recordId }),
|
|
@@ -35210,7 +35235,7 @@ function TargetControl({
|
|
|
35210
35235
|
|
|
35211
35236
|
// src/QuestionPanel.tsx
|
|
35212
35237
|
import { copyText as copyText7 } from "@ai-matrx/kit/clipboard";
|
|
35213
|
-
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";
|
|
35214
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";
|
|
35215
35240
|
import { useFields as useFields29, useRecordsClient as useRecordsClient80 } from "@ai-matrx/records/react";
|
|
35216
35241
|
|
|
@@ -35299,7 +35324,7 @@ function QuestionPanel({ tableId, activeQuestionId, draft, className }) {
|
|
|
35299
35324
|
const [saveError, setSaveError] = useState101(null);
|
|
35300
35325
|
const [saving, setSaving] = useState101(false);
|
|
35301
35326
|
const [linkMissed, setLinkMissed] = useState101(false);
|
|
35302
|
-
const openedFromLink =
|
|
35327
|
+
const openedFromLink = useRef45(false);
|
|
35303
35328
|
useEffect90(() => {
|
|
35304
35329
|
let live = true;
|
|
35305
35330
|
void (0, question_exports.questionsOf)(client, tableId).then((answer2) => {
|
|
@@ -36181,7 +36206,7 @@ function AgentAnswer({
|
|
|
36181
36206
|
}
|
|
36182
36207
|
|
|
36183
36208
|
// src/PageScreen.tsx
|
|
36184
|
-
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";
|
|
36185
36210
|
import { useRecordsClient as useRecordsClient83 } from "@ai-matrx/records/react";
|
|
36186
36211
|
import { BasicInput as BasicInput23, Button as Button87, Skeleton as Skeleton37, cn as cn63 } from "@ai-matrx/design-system";
|
|
36187
36212
|
|
|
@@ -37313,7 +37338,7 @@ function PageScreen({
|
|
|
37313
37338
|
const [run, setRun] = useState104(null);
|
|
37314
37339
|
const [saveError, setSaveError] = useState104(null);
|
|
37315
37340
|
const [askingToArchive, setAskingToArchive] = useState104(false);
|
|
37316
|
-
const canvas =
|
|
37341
|
+
const canvas = useRef46(null);
|
|
37317
37342
|
const [making, setMaking] = useState104("waiting");
|
|
37318
37343
|
const id = page?.id ?? pageId ?? null;
|
|
37319
37344
|
const load = useCallback51(
|
|
@@ -37514,7 +37539,7 @@ function PageScreen({
|
|
|
37514
37539
|
}
|
|
37515
37540
|
|
|
37516
37541
|
// src/InterfaceScreen.tsx
|
|
37517
|
-
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";
|
|
37518
37543
|
import { useRecordsClient as useRecordsClient84 } from "@ai-matrx/records/react";
|
|
37519
37544
|
import { BasicInput as BasicInput24, Button as Button88, Skeleton as Skeleton38, cn as cn64 } from "@ai-matrx/design-system";
|
|
37520
37545
|
import { Fragment as Fragment52, jsx as jsx116, jsxs as jsxs109 } from "react/jsx-runtime";
|
|
@@ -37551,7 +37576,7 @@ function InterfaceScreen({
|
|
|
37551
37576
|
const [making, setMaking] = useState105("waiting");
|
|
37552
37577
|
const [askingToArchive, setAskingToArchive] = useState105(false);
|
|
37553
37578
|
const [localPage, setLocalPage] = useState105(null);
|
|
37554
|
-
const canvas =
|
|
37579
|
+
const canvas = useRef47(null);
|
|
37555
37580
|
const load = useCallback52(
|
|
37556
37581
|
async (want) => {
|
|
37557
37582
|
const answered = await client.interfaceRead({ interface_id: want });
|
|
@@ -37828,7 +37853,7 @@ function InterfaceScreen({
|
|
|
37828
37853
|
|
|
37829
37854
|
// src/FormsPanel.tsx
|
|
37830
37855
|
import { copyText as copyText8 } from "@ai-matrx/kit/clipboard";
|
|
37831
|
-
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";
|
|
37832
37857
|
import { useRecordsClient as useRecordsClient85, useTable as useTable33 } from "@ai-matrx/records/react";
|
|
37833
37858
|
import { publicFormPath as publicFormPath2 } from "@ai-matrx/records";
|
|
37834
37859
|
import { Badge as Badge17, Button as Button89, Skeleton as Skeleton39, cn as cn65 } from "@ai-matrx/design-system";
|
|
@@ -37857,7 +37882,7 @@ function FormsPanel({ tableId, activeFormId, asView = false, className }) {
|
|
|
37857
37882
|
useEffect95(() => {
|
|
37858
37883
|
if (linked && rights.structure) setBuilding(true);
|
|
37859
37884
|
}, [linked, rights.structure]);
|
|
37860
|
-
const openedAsView =
|
|
37885
|
+
const openedAsView = useRef48(false);
|
|
37861
37886
|
useEffect95(() => {
|
|
37862
37887
|
if (!asView || openedAsView.current || forms === null || forms.length === 0 || !rights.structure) return;
|
|
37863
37888
|
openedAsView.current = true;
|
|
@@ -38018,12 +38043,12 @@ function FormsPanel({ tableId, activeFormId, asView = false, className }) {
|
|
|
38018
38043
|
}
|
|
38019
38044
|
|
|
38020
38045
|
// src/CaptureSheet.tsx
|
|
38021
|
-
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";
|
|
38022
38047
|
import { useFields as useFields32, useRecordsClient as useRecordsClient87, useTable as useTable34 } from "@ai-matrx/records/react";
|
|
38023
38048
|
import { Button as Button91, Input as Input8, Skeleton as Skeleton41, Textarea as Textarea7, cn as cn67 } from "@ai-matrx/design-system";
|
|
38024
38049
|
|
|
38025
38050
|
// src/CaptureRun.tsx
|
|
38026
|
-
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";
|
|
38027
38052
|
import {
|
|
38028
38053
|
coerceTypedAnswer,
|
|
38029
38054
|
coercionLabel,
|
|
@@ -38081,7 +38106,7 @@ function CaptureRun({ sheetId, face: given, className }) {
|
|
|
38081
38106
|
const [items, setItems] = useState107([]);
|
|
38082
38107
|
const [lastSynced, setLastSynced] = useState107(null);
|
|
38083
38108
|
const [sending, setSending] = useState107(false);
|
|
38084
|
-
const queueRef =
|
|
38109
|
+
const queueRef = useRef49(null);
|
|
38085
38110
|
useEffect96(() => {
|
|
38086
38111
|
const q2 = openCaptureQueue({
|
|
38087
38112
|
onChange: (c, all) => {
|
|
@@ -38461,7 +38486,7 @@ function AdHocCaptureSheet({
|
|
|
38461
38486
|
const [error, setError] = useState108(null);
|
|
38462
38487
|
const [uploadError, setUploadError] = useState108(null);
|
|
38463
38488
|
const [flushing, setFlushing] = useState108(false);
|
|
38464
|
-
const queue =
|
|
38489
|
+
const queue = useRef50([]);
|
|
38465
38490
|
const keep = useCallback55(
|
|
38466
38491
|
async (next) => {
|
|
38467
38492
|
queue.current = next;
|
|
@@ -38992,7 +39017,7 @@ function useEmbedHandshake(args) {
|
|
|
38992
39017
|
|
|
38993
39018
|
// src/TablePage.tsx
|
|
38994
39019
|
import { copyText as copyText13 } from "@ai-matrx/kit/clipboard";
|
|
38995
|
-
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";
|
|
38996
39021
|
import { archivedByLine as archivedByLine2 } from "@ai-matrx/records";
|
|
38997
39022
|
import { tableShapeChanged as tableShapeChanged11, useFields as useFields34, useRecordsClient as useRecordsClient92, useSeededAnswer, useTable as useTable36, useTableArchive as useTableArchive2 } from "@ai-matrx/records/react";
|
|
38998
39023
|
import {
|
|
@@ -39799,7 +39824,7 @@ function phoneTableActions(actions) {
|
|
|
39799
39824
|
}
|
|
39800
39825
|
|
|
39801
39826
|
// src/presence.tsx
|
|
39802
|
-
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";
|
|
39803
39828
|
import { jsx as jsx130, jsxs as jsxs123 } from "react/jsx-runtime";
|
|
39804
39829
|
var NO_PEOPLE = [];
|
|
39805
39830
|
var MAX_AVATARS = 4;
|
|
@@ -39846,7 +39871,7 @@ function TablePresence({ tableId }) {
|
|
|
39846
39871
|
const { session, people: published } = useTablePresence(tableId);
|
|
39847
39872
|
const roster = useMemberRoster();
|
|
39848
39873
|
const people = useMemo71(() => namePeople(published, roster), [published, roster]);
|
|
39849
|
-
const root =
|
|
39874
|
+
const root = useRef51(null);
|
|
39850
39875
|
const css = useMemo71(() => presenceOutlineCss(people), [people]);
|
|
39851
39876
|
useEffect103(() => {
|
|
39852
39877
|
if (!session || typeof MutationObserver === "undefined") return;
|
|
@@ -40436,7 +40461,7 @@ function TablePage({
|
|
|
40436
40461
|
return seededViews.find((v) => v.id === asked2) ?? defaultViewOf(seededViews) ?? seededViews[0];
|
|
40437
40462
|
});
|
|
40438
40463
|
const [looks, setLooks] = useState120(() => seededViews ? seededOpening?.looks : void 0);
|
|
40439
|
-
const looksSeededFor =
|
|
40464
|
+
const looksSeededFor = useRef52(seededViews && seededOpening ? tableId : null);
|
|
40440
40465
|
useEffect105(() => {
|
|
40441
40466
|
if (looksSeededFor.current === tableId) {
|
|
40442
40467
|
looksSeededFor.current = null;
|
|
@@ -40464,7 +40489,7 @@ function TablePage({
|
|
|
40464
40489
|
const opened = questionsFromLink ? { ...openedByPackage, main: "questions" } : formFromLink ? { ...openedByPackage, main: "form" } : openedByPackage;
|
|
40465
40490
|
const [views, setViews] = useState120(() => seededViews);
|
|
40466
40491
|
const [pickedViewId, setPickedViewId] = useState120(savedFromLink);
|
|
40467
|
-
const viewSeen =
|
|
40492
|
+
const viewSeen = useRef52(null);
|
|
40468
40493
|
const [viewLinkMissed, setViewLinkMissed] = useState120(false);
|
|
40469
40494
|
const railAsked = typeof activeRail === "string" ? activeRail.trim() : "";
|
|
40470
40495
|
const railUnknown = railAsked !== "" && railFromParam(railAsked) === null ? railAsked : null;
|
|
@@ -40494,7 +40519,7 @@ function TablePage({
|
|
|
40494
40519
|
const { open: renameOpen, setOpen: setRenameOpen, ask: askRename, menuContentProps: renameMenuProps } = useRenameFromMenu();
|
|
40495
40520
|
const [archiveAsked, setArchiveAsked] = useState120(0);
|
|
40496
40521
|
const pageArchive = useTableArchive2(tableId);
|
|
40497
|
-
const archiveRunning =
|
|
40522
|
+
const archiveRunning = useRef52(false);
|
|
40498
40523
|
const archiveFromMenu = useCallback60(async () => {
|
|
40499
40524
|
if (archiveRunning.current) return;
|
|
40500
40525
|
archiveRunning.current = true;
|
|
@@ -40575,7 +40600,7 @@ function TablePage({
|
|
|
40575
40600
|
lookDiffers: view ? lookDiffers(view, look) : false
|
|
40576
40601
|
};
|
|
40577
40602
|
const shownSignature = JSON.stringify(shownReport);
|
|
40578
|
-
const reportRef =
|
|
40603
|
+
const reportRef = useRef52(onShownViewChange);
|
|
40579
40604
|
reportRef.current = onShownViewChange;
|
|
40580
40605
|
useEffect105(() => {
|
|
40581
40606
|
reportRef.current?.(JSON.parse(shownSignature));
|
|
@@ -40586,8 +40611,8 @@ function TablePage({
|
|
|
40586
40611
|
onViewChanged?.(addressForView(view, next));
|
|
40587
40612
|
void patchView({ layout: next });
|
|
40588
40613
|
};
|
|
40589
|
-
const reportedRecords =
|
|
40590
|
-
const lastActiveRecord =
|
|
40614
|
+
const reportedRecords = useRef52(/* @__PURE__ */ new Set());
|
|
40615
|
+
const lastActiveRecord = useRef52(activeRecordId ?? null);
|
|
40591
40616
|
useEffect105(() => {
|
|
40592
40617
|
const before = lastActiveRecord.current;
|
|
40593
40618
|
lastActiveRecord.current = activeRecordId ?? null;
|
|
@@ -40610,7 +40635,7 @@ function TablePage({
|
|
|
40610
40635
|
if (rail !== "record") setRecordFull(false);
|
|
40611
40636
|
}, [rail]);
|
|
40612
40637
|
const shownRecord = rail === "record" ? openRecord : null;
|
|
40613
|
-
const reportedRecord =
|
|
40638
|
+
const reportedRecord = useRef52(activeRecordId ?? null);
|
|
40614
40639
|
useEffect105(() => {
|
|
40615
40640
|
if (shownRecord === reportedRecord.current) return;
|
|
40616
40641
|
const how = shownRecord === null ? "close" : reportedRecord.current === null ? "open" : "step";
|
|
@@ -40669,7 +40694,7 @@ function TablePage({
|
|
|
40669
40694
|
},
|
|
40670
40695
|
[client, tableId, view, looks, viewLocked, sayLocked]
|
|
40671
40696
|
);
|
|
40672
|
-
const arrival =
|
|
40697
|
+
const arrival = useRef52(viewAddress ?? null);
|
|
40673
40698
|
const [gridQuery, setGridQuery] = useState120(null);
|
|
40674
40699
|
const [addressResetEpoch, setAddressResetEpoch] = useState120(0);
|
|
40675
40700
|
const reportGrid = useCallback60((q) => {
|
|
@@ -40680,7 +40705,7 @@ function TablePage({
|
|
|
40680
40705
|
() => ({ initial: arrival.current, report: reportGrid, resetEpoch: addressResetEpoch }),
|
|
40681
40706
|
[reportGrid, addressResetEpoch]
|
|
40682
40707
|
);
|
|
40683
|
-
const hiddenApplied =
|
|
40708
|
+
const hiddenApplied = useRef52(false);
|
|
40684
40709
|
useEffect105(() => {
|
|
40685
40710
|
const hidden = arrival.current?.hidden;
|
|
40686
40711
|
if (hiddenApplied.current || !view || !looks || !hidden || hidden.length === 0) return;
|
|
@@ -40701,9 +40726,9 @@ function TablePage({
|
|
|
40701
40726
|
const gridPending = !isViewAddressEmpty({ ...arrival.current ?? {}, hidden: [] });
|
|
40702
40727
|
const addressReady = Boolean(view && looks) && (gridQuery !== null || !gridPending);
|
|
40703
40728
|
const addressSignature = JSON.stringify(viewAddressToParams(addressNow));
|
|
40704
|
-
const addressReportRef =
|
|
40729
|
+
const addressReportRef = useRef52(onViewAddressChange);
|
|
40705
40730
|
addressReportRef.current = onViewAddressChange;
|
|
40706
|
-
const addressSent =
|
|
40731
|
+
const addressSent = useRef52(null);
|
|
40707
40732
|
useEffect105(() => {
|
|
40708
40733
|
if (!addressReady) return;
|
|
40709
40734
|
if (addressSent.current === null && addressSignature === JSON.stringify(viewAddressToParams(arrival.current))) {
|
|
@@ -41026,9 +41051,9 @@ function TablePage({
|
|
|
41026
41051
|
}
|
|
41027
41052
|
});
|
|
41028
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;
|
|
41029
|
-
const actionsRef =
|
|
41054
|
+
const actionsRef = useRef52(actions);
|
|
41030
41055
|
actionsRef.current = actions;
|
|
41031
|
-
const onActionsRef =
|
|
41056
|
+
const onActionsRef = useRef52(onActions);
|
|
41032
41057
|
onActionsRef.current = onActions;
|
|
41033
41058
|
useEffect105(() => {
|
|
41034
41059
|
onActionsRef.current?.(actionsRef.current);
|
|
@@ -41660,7 +41685,7 @@ function usePublicReadOnly(client, organizationId, tableId, table, rights) {
|
|
|
41660
41685
|
import { formatCount as formatCount8 } from "@ai-matrx/kit/format";
|
|
41661
41686
|
import { TapTargetSearchGroup as TapTargetSearchGroup2, TooltipProvider } from "@ai-matrx/design-system";
|
|
41662
41687
|
import { MatrxTableCardShowMore as MatrxTableCardShowMore3 } from "@ai-matrx/design-system/data-table";
|
|
41663
|
-
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";
|
|
41664
41689
|
import { Button as Button100, ErrorBox as ErrorBox5, Input as Input12, cn as cn73 } from "@ai-matrx/design-system";
|
|
41665
41690
|
import { SEED_FRESH_MS, useRecordsClient as useRecordsClient93, useSeededAnswerAt } from "@ai-matrx/records/react";
|
|
41666
41691
|
import { Fragment as Fragment58, jsx as jsx132, jsxs as jsxs125 } from "react/jsx-runtime";
|
|
@@ -41768,7 +41793,7 @@ function EntityChartBlock({ source, kind: kind2, by, measure, title, where, orga
|
|
|
41768
41793
|
const base = { title: title ?? "", kind: kind2, measures, group_by: by ? [by] : [] };
|
|
41769
41794
|
const seeded = useSeededAnswerAt(`entity-chart:${ask2}`, (c) => c.drillAsk({ source, question }));
|
|
41770
41795
|
const [block, setBlock] = useState121(() => seeded ? blockOfAnswer({ ok: true, data: seeded.data }, base, by) : null);
|
|
41771
|
-
const seededFor =
|
|
41796
|
+
const seededFor = useRef53(seeded ? { ask: `${ask2}|${kind2}|${title ?? ""}`, at: seeded.at } : null);
|
|
41772
41797
|
useEffect106(() => {
|
|
41773
41798
|
const held = seededFor.current;
|
|
41774
41799
|
if (held && held.ask === `${ask2}|${kind2}|${title ?? ""}` && Date.now() - held.at < SEED_FRESH_MS) return;
|
|
@@ -42111,7 +42136,7 @@ function PreviewForms({ preview, booking }) {
|
|
|
42111
42136
|
}
|
|
42112
42137
|
|
|
42113
42138
|
// src/SectionCard.tsx
|
|
42114
|
-
import { useEffect as useEffect109, useRef as
|
|
42139
|
+
import { useEffect as useEffect109, useRef as useRef54, useState as useState125 } from "react";
|
|
42115
42140
|
import { atLeast } from "@ai-matrx/records/field-kinds";
|
|
42116
42141
|
import { useFields as useFields35, useRecordMutation as useRecordMutation3, useRecordPage as useRecordPage4, useRecordsClient as useRecordsClient95, useTable as useTable37 } from "@ai-matrx/records/react";
|
|
42117
42142
|
import {
|
|
@@ -42512,7 +42537,7 @@ function columnsOf(values) {
|
|
|
42512
42537
|
var same3 = (a, b) => JSON.stringify(a ?? null) === JSON.stringify(b ?? null);
|
|
42513
42538
|
function useDraft(stored, save) {
|
|
42514
42539
|
const [draft, setDraft] = useState125(null);
|
|
42515
|
-
const latest =
|
|
42540
|
+
const latest = useRef54({ draft, save, stored });
|
|
42516
42541
|
useEffect109(() => {
|
|
42517
42542
|
latest.current = { draft, save, stored };
|
|
42518
42543
|
});
|
|
@@ -42919,7 +42944,7 @@ function TableSectionCard(props) {
|
|
|
42919
42944
|
const rowNames = nameField ? rows.map((r) => String((r.document ?? {})[nameField.key] ?? "")).filter((n) => n !== "") : [];
|
|
42920
42945
|
const refused = table.error ?? fieldsRead.error ?? page.error;
|
|
42921
42946
|
const gridStyle = { gridTemplateColumns: `minmax(8rem, 12rem) repeat(${Math.max(columns.length, 1)}, minmax(0, 1fr)) 4.5rem` };
|
|
42922
|
-
const sectionRef =
|
|
42947
|
+
const sectionRef = useRef54(null);
|
|
42923
42948
|
const narrow = useNarrow2(sectionRef);
|
|
42924
42949
|
const cellLabel = (c) => c.part ? columns.filter((x) => x.field.key === c.field.key).map((x) => x.header).join(" \xB7 ") : c.header;
|
|
42925
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: [
|