@ai-matrx/records-ui 0.116.88 → 0.116.90
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 +4 -1
- package/dist/index.cjs +15 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +239 -229
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -19814,7 +19814,7 @@ function lookAfterReset(look) {
|
|
|
19814
19814
|
}
|
|
19815
19815
|
|
|
19816
19816
|
// src/ViewSwitcher.tsx
|
|
19817
|
-
import { useEffect as
|
|
19817
|
+
import { useEffect as useEffect77, useMemo as useMemo53, useState as useState87 } from "react";
|
|
19818
19818
|
import { mayDrag as mayDrag4, useFields as useFields21, useRecordPage as useRecordPage2, useRecordsClient as useRecordsClient68, useTable as useTable25 } from "@ai-matrx/records/react";
|
|
19819
19819
|
import { isButtonField as isButtonField2, newerKindOf as newerKindOf2, stableFilterKey as stableFilterKey4 } from "@ai-matrx/records";
|
|
19820
19820
|
import { Button as Button69, Select as Select13, SelectContent as SelectContent11, SelectItem as SelectItem11, SelectTrigger as SelectTrigger11, SelectValue as SelectValue11, cn as cn40 } from "@ai-matrx/design-system";
|
|
@@ -25393,12 +25393,14 @@ function PivotLayout({ view, fields, filter, onChange, remembered }) {
|
|
|
25393
25393
|
}
|
|
25394
25394
|
|
|
25395
25395
|
// src/SwipeLayout.tsx
|
|
25396
|
-
import { useCallback as useCallback38, useMemo as useMemo51, useState as useState85 } from "react";
|
|
25396
|
+
import { useCallback as useCallback38, useEffect as useEffect75, useMemo as useMemo51, useRef as useRef36, useState as useState85 } from "react";
|
|
25397
25397
|
import { useRecordMutation } from "@ai-matrx/records/react";
|
|
25398
25398
|
import { Button as Button67, Select as Select11, SelectContent as SelectContent9, SelectItem as SelectItem9, SelectTrigger as SelectTrigger9, SelectValue as SelectValue9 } from "@ai-matrx/design-system";
|
|
25399
25399
|
import {
|
|
25400
25400
|
DEFAULT_DECK_KEY,
|
|
25401
25401
|
SwipeDeck,
|
|
25402
|
+
conditionProblems,
|
|
25403
|
+
mergeKey,
|
|
25402
25404
|
readDeckCondition
|
|
25403
25405
|
} from "@ai-matrx/design-system/swipe-deck";
|
|
25404
25406
|
|
|
@@ -25758,7 +25760,7 @@ function deckKeyFromOptions(options) {
|
|
|
25758
25760
|
const o = options[i];
|
|
25759
25761
|
answers[d] = o ? { id: o.id, label: o.label, tone: o.color && TONE_OF[o.color] || DEFAULT_DECK_KEY[d]?.tone || "neutral" } : null;
|
|
25760
25762
|
});
|
|
25761
|
-
return { answers, more: options.slice(4
|
|
25763
|
+
return { answers, more: options.slice(4).map((o) => ({ id: o.id, label: o.label, tone: o.color && TONE_OF[o.color] || "neutral" })) };
|
|
25762
25764
|
}
|
|
25763
25765
|
function plain(v, options) {
|
|
25764
25766
|
if (v === null || v === void 0) return "";
|
|
@@ -25780,7 +25782,12 @@ function readJson(v) {
|
|
|
25780
25782
|
return void 0;
|
|
25781
25783
|
}
|
|
25782
25784
|
}
|
|
25783
|
-
function SwipeLayout({ view, fields, rows, titleKey, onChange, canWrite, remembered, onChanged, note }) {
|
|
25785
|
+
function SwipeLayout({ view, fields, rows, titleKey, onChange, canWrite, remembered, onChanged, note, hasMore, onMore }) {
|
|
25786
|
+
const more = useRef36(onMore);
|
|
25787
|
+
more.current = onMore;
|
|
25788
|
+
useEffect75(() => {
|
|
25789
|
+
if (hasMore) more.current?.();
|
|
25790
|
+
}, [hasMore, rows.length]);
|
|
25784
25791
|
const host = useRecordsUi();
|
|
25785
25792
|
const mutation = useRecordMutation();
|
|
25786
25793
|
const answerChoices = answerFieldChoices(fields);
|
|
@@ -25863,7 +25870,8 @@ function SwipeLayout({ view, fields, rows, titleKey, onChange, canWrite, remembe
|
|
|
25863
25870
|
},
|
|
25864
25871
|
[answer, canWrite, mutation, stored, onChanged]
|
|
25865
25872
|
);
|
|
25866
|
-
const
|
|
25873
|
+
const problems = useMemo51(() => conditionProblems(items, { key: mergeKey(DEFAULT_DECK_KEY, key?.answers), ...key ? { more: key.more } : {} }), [items, key]);
|
|
25874
|
+
const binding = useMemo51(() => ({ status: keyReady && !hasMore ? "ready" : "loading", error: null, items, state, apply }), [keyReady, hasMore, items, state, apply]);
|
|
25867
25875
|
const [logicOpen, setLogicOpen] = useState85(false);
|
|
25868
25876
|
const [logicError, setLogicError] = useState85(null);
|
|
25869
25877
|
const saveLogic = useCallback38(
|
|
@@ -25897,7 +25905,8 @@ function SwipeLayout({ view, fields, rows, titleKey, onChange, canWrite, remembe
|
|
|
25897
25905
|
pick("Asked when", conditionChoices, condition, (k) => onChange({ conditionField: k }), "Every card asked"),
|
|
25898
25906
|
condition && canWrite ? /* @__PURE__ */ jsx94(Button67, { size: "sm", variant: logicOpen ? "secondary" : "ghost", className: "h-7", "aria-pressed": logicOpen, onClick: () => setLogicOpen((o) => !o), children: "Logic" }) : null,
|
|
25899
25907
|
remembered ? null : /* @__PURE__ */ jsx94("span", { className: "text-muted-foreground", children: "Kept for this visit only" }),
|
|
25900
|
-
note ? /* @__PURE__ */ jsx94("span", { className: "text-muted-foreground", children: note }) : null
|
|
25908
|
+
note ? /* @__PURE__ */ jsx94("span", { className: "text-muted-foreground", children: note }) : null,
|
|
25909
|
+
problems.map((p) => /* @__PURE__ */ jsx94("span", { className: "text-muted-foreground", "data-records-swipe-problem": "", children: p }, p))
|
|
25901
25910
|
] });
|
|
25902
25911
|
if (!answer) {
|
|
25903
25912
|
return /* @__PURE__ */ jsxs85("div", { className: "flex min-h-0 flex-col gap-2", "data-records-swipe-layout": "", "data-records-swipe-state": "needs-field", children: [
|
|
@@ -25927,7 +25936,7 @@ function SwipeLayout({ view, fields, rows, titleKey, onChange, canWrite, remembe
|
|
|
25927
25936
|
}
|
|
25928
25937
|
|
|
25929
25938
|
// src/MapLayout.tsx
|
|
25930
|
-
import { useEffect as
|
|
25939
|
+
import { useEffect as useEffect76, useMemo as useMemo52, useRef as useRef37, useState as useState86 } from "react";
|
|
25931
25940
|
import { useFieldMutation as useFieldMutation6, useRecordMutation as useRecordMutation2 } from "@ai-matrx/records/react";
|
|
25932
25941
|
import { Button as Button68, Select as Select12, SelectContent as SelectContent10, SelectItem as SelectItem10, SelectTrigger as SelectTrigger10, SelectValue as SelectValue10, cn as cn39 } from "@ai-matrx/design-system";
|
|
25933
25942
|
|
|
@@ -26056,10 +26065,10 @@ function MapLayout({ view, fields, rows, titleKey, openRecordId, onOpenRecord, o
|
|
|
26056
26065
|
const saved = !coordinateMode ? coordinateColumns(fields) : null;
|
|
26057
26066
|
const [found, setFound] = useState86(() => /* @__PURE__ */ new Map());
|
|
26058
26067
|
const [lookup, setLookup] = useState86({ running: false, notFound: /* @__PURE__ */ new Set(), couldNot: false });
|
|
26059
|
-
const tried =
|
|
26060
|
-
const passing =
|
|
26061
|
-
const mounted =
|
|
26062
|
-
|
|
26068
|
+
const tried = useRef37(/* @__PURE__ */ new Set());
|
|
26069
|
+
const passing = useRef37(false);
|
|
26070
|
+
const mounted = useRef37(true);
|
|
26071
|
+
useEffect76(() => {
|
|
26063
26072
|
mounted.current = true;
|
|
26064
26073
|
return () => {
|
|
26065
26074
|
mounted.current = false;
|
|
@@ -26075,7 +26084,7 @@ function MapLayout({ view, fields, rows, titleKey, openRecordId, onOpenRecord, o
|
|
|
26075
26084
|
const geocode = host.geocodeAddress;
|
|
26076
26085
|
const pending = placed.toLookUp.filter((r) => !tried.current.has(r.id));
|
|
26077
26086
|
const pendingKey = pending.map((p) => p.id).join(",");
|
|
26078
|
-
|
|
26087
|
+
useEffect76(() => {
|
|
26079
26088
|
if (!geocode || pending.length === 0 || passing.current) return;
|
|
26080
26089
|
passing.current = true;
|
|
26081
26090
|
const cancelled = () => !mounted.current;
|
|
@@ -26193,7 +26202,7 @@ function useViewRecords(view, pageSize = 200, filter, viewId) {
|
|
|
26193
26202
|
const client = useRecordsClient68();
|
|
26194
26203
|
const [limit, setLimit] = useState87(pageSize);
|
|
26195
26204
|
const questionKey = `${view.subject}|${stableFilterKey4(filter ?? null)}|${JSON.stringify(view.sorts ?? [])}`;
|
|
26196
|
-
|
|
26205
|
+
useEffect77(() => {
|
|
26197
26206
|
setLimit(pageSize);
|
|
26198
26207
|
}, [questionKey, pageSize]);
|
|
26199
26208
|
const storeSort = useMemo53(
|
|
@@ -26211,7 +26220,7 @@ function useViewRecords(view, pageSize = 200, filter, viewId) {
|
|
|
26211
26220
|
error: null
|
|
26212
26221
|
});
|
|
26213
26222
|
const ruleId = view.ruleId ?? null;
|
|
26214
|
-
|
|
26223
|
+
useEffect77(() => {
|
|
26215
26224
|
if (!ruleId) return;
|
|
26216
26225
|
let cancelled = false;
|
|
26217
26226
|
setRuled({ rows: [], loading: true, error: null });
|
|
@@ -26337,7 +26346,7 @@ function ViewSwitcherBody({
|
|
|
26337
26346
|
setSeenSignature(viewSignature);
|
|
26338
26347
|
if (Object.keys(local).length > 0) setLocal({});
|
|
26339
26348
|
}
|
|
26340
|
-
|
|
26349
|
+
useEffect77(() => {
|
|
26341
26350
|
setLayout(view.layout);
|
|
26342
26351
|
setLocal({});
|
|
26343
26352
|
}, [view.layout, view.name, view.subject]);
|
|
@@ -26440,7 +26449,7 @@ function useFarFields(all) {
|
|
|
26440
26449
|
const [far, setFar] = useState87(() => /* @__PURE__ */ new Map());
|
|
26441
26450
|
const reads = useReadRefusal("fields");
|
|
26442
26451
|
const [attempt, again] = useReadAgain();
|
|
26443
|
-
|
|
26452
|
+
useEffect77(() => {
|
|
26444
26453
|
let cancelled = false;
|
|
26445
26454
|
const ids = targets ? targets.split(",") : [];
|
|
26446
26455
|
if (ids.length === 0) {
|
|
@@ -26484,7 +26493,7 @@ function useStageField(tableId) {
|
|
|
26484
26493
|
});
|
|
26485
26494
|
const reads = useReadRefusal("table_stage_field");
|
|
26486
26495
|
const [attempt, again] = useReadAgain();
|
|
26487
|
-
|
|
26496
|
+
useEffect77(() => {
|
|
26488
26497
|
let cancelled = false;
|
|
26489
26498
|
setStage({ asked: false, key: null });
|
|
26490
26499
|
void askWithOneRetry(() => client.tableStageField({ table_id: tableId })).then((r) => {
|
|
@@ -26859,10 +26868,11 @@ function Board({
|
|
|
26859
26868
|
records.reload();
|
|
26860
26869
|
onMoved?.();
|
|
26861
26870
|
},
|
|
26862
|
-
note: records.membership
|
|
26871
|
+
note: records.membership,
|
|
26872
|
+
hasMore: records.total !== null && records.rows.length < records.total,
|
|
26873
|
+
onMore: records.loadMore
|
|
26863
26874
|
}
|
|
26864
|
-
)
|
|
26865
|
-
pager
|
|
26875
|
+
)
|
|
26866
26876
|
] });
|
|
26867
26877
|
}
|
|
26868
26878
|
if (view.layout === "list") {
|
|
@@ -27448,7 +27458,7 @@ function boardDefaultGroupField(eligible) {
|
|
|
27448
27458
|
}
|
|
27449
27459
|
|
|
27450
27460
|
// src/ArchivedView.tsx
|
|
27451
|
-
import { useCallback as useCallback39, useEffect as
|
|
27461
|
+
import { useCallback as useCallback39, useEffect as useEffect78, useState as useState88 } from "react";
|
|
27452
27462
|
import {
|
|
27453
27463
|
ARCHIVE_LANES,
|
|
27454
27464
|
ARCHIVE_LANE_LABEL,
|
|
@@ -27486,7 +27496,7 @@ function ArchivedView({
|
|
|
27486
27496
|
const [error, setError] = useState88(null);
|
|
27487
27497
|
const [restoring, setRestoring] = useState88(null);
|
|
27488
27498
|
const [refusal3, setRefusal] = useState88(null);
|
|
27489
|
-
|
|
27499
|
+
useEffect78(() => {
|
|
27490
27500
|
if (laneFromHost) setLane(laneFromHost);
|
|
27491
27501
|
}, [laneFromHost]);
|
|
27492
27502
|
const read = useCallback39(async () => {
|
|
@@ -27501,7 +27511,7 @@ function ArchivedView({
|
|
|
27501
27511
|
}
|
|
27502
27512
|
setLoading(false);
|
|
27503
27513
|
}, [client, tableId, lane, pageSize]);
|
|
27504
|
-
|
|
27514
|
+
useEffect78(() => {
|
|
27505
27515
|
void read();
|
|
27506
27516
|
}, [read]);
|
|
27507
27517
|
const pick = (next) => {
|
|
@@ -27602,7 +27612,7 @@ function RetiredColumns({ tableId, mayRestore, whyNot }) {
|
|
|
27602
27612
|
setError(answer.error);
|
|
27603
27613
|
}
|
|
27604
27614
|
}, [client, tableId]);
|
|
27605
|
-
|
|
27615
|
+
useEffect78(() => {
|
|
27606
27616
|
void read();
|
|
27607
27617
|
}, [read]);
|
|
27608
27618
|
const restore = async (fieldId) => {
|
|
@@ -27647,7 +27657,7 @@ function RetiredColumns({ tableId, mayRestore, whyNot }) {
|
|
|
27647
27657
|
}
|
|
27648
27658
|
|
|
27649
27659
|
// src/ArchivedDisclosure.tsx
|
|
27650
|
-
import { useCallback as useCallback40, useEffect as
|
|
27660
|
+
import { useCallback as useCallback40, useEffect as useEffect79, useState as useState89 } from "react";
|
|
27651
27661
|
import {
|
|
27652
27662
|
emptyPortalArchiveLine,
|
|
27653
27663
|
portalConfirmLine,
|
|
@@ -27680,7 +27690,7 @@ function ArchivedPortals({
|
|
|
27680
27690
|
setError(answered.error);
|
|
27681
27691
|
}
|
|
27682
27692
|
}, [client]);
|
|
27683
|
-
|
|
27693
|
+
useEffect79(() => {
|
|
27684
27694
|
void read();
|
|
27685
27695
|
}, [read, refreshToken]);
|
|
27686
27696
|
const restore = async (portal) => {
|
|
@@ -27799,7 +27809,7 @@ function ArchivedPortals({
|
|
|
27799
27809
|
import { ArchivedDisclosure as ArchivedDisclosure2, ARCHIVED_NEVER_DESTROYED } from "@ai-matrx/design-system";
|
|
27800
27810
|
|
|
27801
27811
|
// src/ViewBar.tsx
|
|
27802
|
-
import { useCallback as useCallback41, useEffect as
|
|
27812
|
+
import { useCallback as useCallback41, useEffect as useEffect80, useRef as useRef38, useState as useState90 } from "react";
|
|
27803
27813
|
import { useRecordsClient as useRecordsClient71 } from "@ai-matrx/records/react";
|
|
27804
27814
|
import { Badge as Badge12, Button as Button72, Input as Input6, Popover as Popover10, PopoverContent as PopoverContent10, PopoverTrigger as PopoverTrigger10, Skeleton as Skeleton25, cn as cn42 } from "@ai-matrx/design-system";
|
|
27805
27815
|
import { Button as ControlButton2, Switch as Switch6, Tile } from "@ai-matrx/design-system/controls";
|
|
@@ -27912,8 +27922,8 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews,
|
|
|
27912
27922
|
if (!initialViews || initialViews.length === 0) return activeViewId ?? null;
|
|
27913
27923
|
return (initialViews.find((v) => v.id === activeViewId) ?? defaultViewOf(initialViews) ?? initialViews[0]).id;
|
|
27914
27924
|
});
|
|
27915
|
-
const readOnMount =
|
|
27916
|
-
const pendingPick =
|
|
27925
|
+
const readOnMount = useRef38(initialViews === void 0);
|
|
27926
|
+
const pendingPick = useRef38(null);
|
|
27917
27927
|
const [naming, setNaming] = useState90(false);
|
|
27918
27928
|
const [draftName, setDraftName] = useState90("");
|
|
27919
27929
|
const [open, setOpen] = useState90(false);
|
|
@@ -27933,7 +27943,7 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews,
|
|
|
27933
27943
|
});
|
|
27934
27944
|
const [renamingSection, setRenamingSection] = useState90(null);
|
|
27935
27945
|
const [dragging, setDragging] = useState90(false);
|
|
27936
|
-
const justDragged =
|
|
27946
|
+
const justDragged = useRef38(false);
|
|
27937
27947
|
const sensors = useSensors(useSensor(PointerSensor, { activationConstraint: { distance: 6 } }));
|
|
27938
27948
|
async function dropped(event) {
|
|
27939
27949
|
setDragging(false);
|
|
@@ -28011,14 +28021,14 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews,
|
|
|
28011
28021
|
setViews(mine);
|
|
28012
28022
|
onViews?.(mine);
|
|
28013
28023
|
}, [client, readViews, tableId, seedKey, tableThere]);
|
|
28014
|
-
|
|
28024
|
+
useEffect80(() => {
|
|
28015
28025
|
if (!readOnMount.current) {
|
|
28016
28026
|
readOnMount.current = true;
|
|
28017
28027
|
return;
|
|
28018
28028
|
}
|
|
28019
28029
|
void load();
|
|
28020
28030
|
}, [load]);
|
|
28021
|
-
|
|
28031
|
+
useEffect80(() => {
|
|
28022
28032
|
if (!views || views.length === 0) return;
|
|
28023
28033
|
const wanted = pendingPick.current;
|
|
28024
28034
|
pendingPick.current = null;
|
|
@@ -28396,7 +28406,7 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews,
|
|
|
28396
28406
|
}
|
|
28397
28407
|
|
|
28398
28408
|
// src/ProposalRow.tsx
|
|
28399
|
-
import { useEffect as
|
|
28409
|
+
import { useEffect as useEffect81, useRef as useRef39, useState as useState91 } from "react";
|
|
28400
28410
|
import { useRecordsClient as useRecordsClient72 } from "@ai-matrx/records/react";
|
|
28401
28411
|
import { Badge as Badge13, Button as Button73, cn as cn43 } from "@ai-matrx/design-system";
|
|
28402
28412
|
import { jsx as jsx100, jsxs as jsxs91 } from "react/jsx-runtime";
|
|
@@ -28414,9 +28424,9 @@ function ProposalRow({
|
|
|
28414
28424
|
const [settled, setSettled] = useState91(outcome ?? null);
|
|
28415
28425
|
const [busy, setBusy] = useState91(false);
|
|
28416
28426
|
const [confirming, setConfirming] = useState91(false);
|
|
28417
|
-
const drawnVersion =
|
|
28427
|
+
const drawnVersion = useRef39(null);
|
|
28418
28428
|
const needsVersion = change.act === "update" && Boolean(change.record) && change.version === void 0 && !onApply && !settled;
|
|
28419
|
-
|
|
28429
|
+
useEffect81(() => {
|
|
28420
28430
|
if (needsVersion && change.record && !drawnVersion.current) drawnVersion.current = (0, recordVersions_exports.readVersionNow)(client, change.record);
|
|
28421
28431
|
}, [needsVersion, change.record, client]);
|
|
28422
28432
|
async function applyThroughTheStore() {
|
|
@@ -28504,7 +28514,7 @@ function ProposalRow({
|
|
|
28504
28514
|
}
|
|
28505
28515
|
|
|
28506
28516
|
// src/ActionInbox.tsx
|
|
28507
|
-
import { useCallback as useCallback42, useEffect as
|
|
28517
|
+
import { useCallback as useCallback42, useEffect as useEffect82, useMemo as useMemo54, useRef as useRef40, useState as useState92 } from "react";
|
|
28508
28518
|
import { useRecordsClient as useRecordsClient73 } from "@ai-matrx/records/react";
|
|
28509
28519
|
import { Badge as Badge14, Button as Button74, Checkbox as Checkbox6, Skeleton as Skeleton26, cn as cn44 } from "@ai-matrx/design-system";
|
|
28510
28520
|
import { toggleSelection as toggleSelection2 } from "@ai-matrx/design-system/data-table";
|
|
@@ -28608,9 +28618,9 @@ function ActionInbox({
|
|
|
28608
28618
|
const [outcome, setOutcome] = useState92({});
|
|
28609
28619
|
const [busy, setBusy] = useState92(null);
|
|
28610
28620
|
const [cursor, setCursor] = useState92(0);
|
|
28611
|
-
const listRef =
|
|
28621
|
+
const listRef = useRef40(null);
|
|
28612
28622
|
const [selected, setSelected] = useState92(/* @__PURE__ */ new Set());
|
|
28613
|
-
const anchor =
|
|
28623
|
+
const anchor = useRef40(null);
|
|
28614
28624
|
const [deciding, setDeciding] = useState92(false);
|
|
28615
28625
|
const [batchSaid, setBatchSaid] = useState92(null);
|
|
28616
28626
|
const [view, setView] = useState92("inbox");
|
|
@@ -28634,7 +28644,7 @@ function ActionInbox({
|
|
|
28634
28644
|
setError(null);
|
|
28635
28645
|
setItems(result.data);
|
|
28636
28646
|
}, [client, showDecided, view]);
|
|
28637
|
-
|
|
28647
|
+
useEffect82(() => {
|
|
28638
28648
|
void load();
|
|
28639
28649
|
}, [load]);
|
|
28640
28650
|
const narrowed = useMemo54(() => {
|
|
@@ -28649,10 +28659,10 @@ function ActionInbox({
|
|
|
28649
28659
|
const groups = useMemo54(() => groupInbox(narrowed, groupBy), [narrowed, groupBy]);
|
|
28650
28660
|
const shown4 = useMemo54(() => groups.flatMap((g) => g.items), [groups]);
|
|
28651
28661
|
const elsewhere = (items?.length ?? 0) - narrowed.length;
|
|
28652
|
-
|
|
28662
|
+
useEffect82(() => {
|
|
28653
28663
|
if (cursor >= shown4.length) setCursor(Math.max(0, shown4.length - 1));
|
|
28654
28664
|
}, [shown4.length, cursor]);
|
|
28655
|
-
|
|
28665
|
+
useEffect82(() => {
|
|
28656
28666
|
const list = listRef.current;
|
|
28657
28667
|
const el = list?.querySelector(`[data-row="${cursor}"]`);
|
|
28658
28668
|
if (list && el) scrollWithinList(list, el);
|
|
@@ -28674,11 +28684,11 @@ function ActionInbox({
|
|
|
28674
28684
|
[client, load]
|
|
28675
28685
|
);
|
|
28676
28686
|
const [held, setHeld] = useState92({});
|
|
28677
|
-
const holds2 =
|
|
28678
|
-
const lastHold =
|
|
28679
|
-
const holdSeq =
|
|
28687
|
+
const holds2 = useRef40(/* @__PURE__ */ new Map());
|
|
28688
|
+
const lastHold = useRef40(null);
|
|
28689
|
+
const holdSeq = useRef40(0);
|
|
28680
28690
|
const [, tick] = useState92(0);
|
|
28681
|
-
|
|
28691
|
+
useEffect82(() => {
|
|
28682
28692
|
if (Object.keys(held).length === 0) return;
|
|
28683
28693
|
const t = setInterval(() => tick((n) => n + 1), 250);
|
|
28684
28694
|
return () => clearInterval(t);
|
|
@@ -28724,7 +28734,7 @@ function ActionInbox({
|
|
|
28724
28734
|
});
|
|
28725
28735
|
setSaid({ text: entry.ids.length === 1 ? "Undone. It is waiting on you again, exactly as it was." : `Undone. All ${entry.ids.length} are waiting on you again, exactly as they were.`, undo: null });
|
|
28726
28736
|
}, []);
|
|
28727
|
-
|
|
28737
|
+
useEffect82(() => {
|
|
28728
28738
|
const flush = () => {
|
|
28729
28739
|
for (const entry of [...holds2.current.values()]) entry.commit();
|
|
28730
28740
|
};
|
|
@@ -28734,8 +28744,8 @@ function ActionInbox({
|
|
|
28734
28744
|
flush();
|
|
28735
28745
|
};
|
|
28736
28746
|
}, []);
|
|
28737
|
-
const resumed =
|
|
28738
|
-
|
|
28747
|
+
const resumed = useRef40(false);
|
|
28748
|
+
useEffect82(() => {
|
|
28739
28749
|
if (resumed.current || items === null || view !== "inbox") return;
|
|
28740
28750
|
resumed.current = true;
|
|
28741
28751
|
const kept = readHolds();
|
|
@@ -29358,7 +29368,7 @@ function ActionInbox({
|
|
|
29358
29368
|
import { FORM_FLOWS as FORM_FLOWS2, FORM_EMBEDS as FORM_EMBEDS2, formDeclareArgs as formDeclareArgs2, formFromSummary as formFromSummary4, formPresentation, formLookDocument as formLookDocument2, formLookFromDocument, submissionStamp as submissionStamp2, formEmbedSnippet as formEmbedSnippet2, formRoutes as formRoutes2, hiddenFromLink, endingsFromDocument, welcomeFromDocument, themeFromDocument } from "@ai-matrx/records/forms";
|
|
29359
29369
|
|
|
29360
29370
|
// src/FormResultsPanel.tsx
|
|
29361
|
-
import { useEffect as
|
|
29371
|
+
import { useEffect as useEffect83, useMemo as useMemo55, useState as useState93 } from "react";
|
|
29362
29372
|
import { useFields as useFields23, useOptionalRecordsClient as useOptionalRecordsClient8 } from "@ai-matrx/records/react";
|
|
29363
29373
|
import { Button as Button75, Skeleton as Skeleton27, cn as cn45 } from "@ai-matrx/design-system";
|
|
29364
29374
|
import { jsx as jsx102, jsxs as jsxs93 } from "react/jsx-runtime";
|
|
@@ -29387,7 +29397,7 @@ function FormResultsPanel({ form, className }) {
|
|
|
29387
29397
|
const [results, setResults] = useState93(null);
|
|
29388
29398
|
const [error, setError] = useState93(null);
|
|
29389
29399
|
const [round, setRound] = useState93(0);
|
|
29390
|
-
|
|
29400
|
+
useEffect83(() => {
|
|
29391
29401
|
if (!client) {
|
|
29392
29402
|
setError((0, refusals_exports.refusal)("not_supported", "No results are available on this screen.", "Open the form inside the app."));
|
|
29393
29403
|
return;
|
|
@@ -29485,7 +29495,7 @@ function FormResultsPanel({ form, className }) {
|
|
|
29485
29495
|
}
|
|
29486
29496
|
|
|
29487
29497
|
// src/PortalBuilder.tsx
|
|
29488
|
-
import { useCallback as useCallback43, useEffect as
|
|
29498
|
+
import { useCallback as useCallback43, useEffect as useEffect84, useMemo as useMemo56, useRef as useRef41, useState as useState94 } from "react";
|
|
29489
29499
|
import { useRecordsClient as useRecordsClient74, useTables } from "@ai-matrx/records/react";
|
|
29490
29500
|
import { BasicInput as BasicInput11, Button as Button76, Checkbox as Checkbox7, Label as Label10, Separator as Separator7, Skeleton as Skeleton28, cn as cn46 } from "@ai-matrx/design-system";
|
|
29491
29501
|
import { Select as Select14 } from "@ai-matrx/design-system/controls";
|
|
@@ -29519,7 +29529,7 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
|
|
|
29519
29529
|
},
|
|
29520
29530
|
[client, fieldsByTable]
|
|
29521
29531
|
);
|
|
29522
|
-
|
|
29532
|
+
useEffect84(() => {
|
|
29523
29533
|
if (!portalId) return;
|
|
29524
29534
|
void (async () => {
|
|
29525
29535
|
const answered = await client.portalCard({ portal_id: portalId });
|
|
@@ -29548,7 +29558,7 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
|
|
|
29548
29558
|
for (const t of answered.data.tables) void loadFields(t.table_id);
|
|
29549
29559
|
})();
|
|
29550
29560
|
}, [client, portalId]);
|
|
29551
|
-
|
|
29561
|
+
useEffect84(() => {
|
|
29552
29562
|
if (!tableId) return;
|
|
29553
29563
|
setExposures(
|
|
29554
29564
|
(prev) => prev[tableId] ? prev : {
|
|
@@ -29561,7 +29571,7 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
|
|
|
29561
29571
|
const cameFromPeople = Boolean(
|
|
29562
29572
|
tableId && (fieldsByTable[tableId] ?? []).some((f) => editorKindFor(f) === "email")
|
|
29563
29573
|
);
|
|
29564
|
-
|
|
29574
|
+
useEffect84(() => {
|
|
29565
29575
|
if (!tableId || portalId || clientTableId !== null || !cameFromPeople) return;
|
|
29566
29576
|
setClientTableId(tableId);
|
|
29567
29577
|
setExposures((prev) => {
|
|
@@ -29576,7 +29586,7 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
|
|
|
29576
29586
|
),
|
|
29577
29587
|
[fieldsByTable, clientTableId]
|
|
29578
29588
|
);
|
|
29579
|
-
|
|
29589
|
+
useEffect84(() => {
|
|
29580
29590
|
for (const e of Object.values(exposures)) {
|
|
29581
29591
|
if (!e.on || e.namesVia.trim() !== "") continue;
|
|
29582
29592
|
const ties = tiesTo(e.tableId);
|
|
@@ -29591,7 +29601,7 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
|
|
|
29591
29601
|
if (on) void loadFields(t.id);
|
|
29592
29602
|
}
|
|
29593
29603
|
const [linking, setLinking] = useState94(null);
|
|
29594
|
-
const linkingNow =
|
|
29604
|
+
const linkingNow = useRef41(null);
|
|
29595
29605
|
async function addLinkBack(id) {
|
|
29596
29606
|
const clients = (tables.data ?? []).find((t) => t.id === clientTableId);
|
|
29597
29607
|
if (!clientTableId || !clients) return;
|
|
@@ -29618,8 +29628,8 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
|
|
|
29618
29628
|
linkingNow.current = null;
|
|
29619
29629
|
setLinking(null);
|
|
29620
29630
|
}
|
|
29621
|
-
const autoLinked =
|
|
29622
|
-
|
|
29631
|
+
const autoLinked = useRef41(/* @__PURE__ */ new Set());
|
|
29632
|
+
useEffect84(() => {
|
|
29623
29633
|
if (linking !== null || !clientTableId) return;
|
|
29624
29634
|
for (const e of Object.values(exposures)) {
|
|
29625
29635
|
if (!e.on || !fieldsByTable[e.tableId] || autoLinked.current.has(e.tableId)) continue;
|
|
@@ -29893,7 +29903,7 @@ function clientNoun(table) {
|
|
|
29893
29903
|
|
|
29894
29904
|
// src/PortalsPanel.tsx
|
|
29895
29905
|
import { copyText as copyText5 } from "@ai-matrx/kit/clipboard";
|
|
29896
|
-
import { useCallback as useCallback44, useEffect as
|
|
29906
|
+
import { useCallback as useCallback44, useEffect as useEffect86, useMemo as useMemo58, useState as useState96 } from "react";
|
|
29897
29907
|
import { useRecordsClient as useRecordsClient76 } from "@ai-matrx/records/react";
|
|
29898
29908
|
import {
|
|
29899
29909
|
portalArchiveConsequence,
|
|
@@ -29904,7 +29914,7 @@ import {
|
|
|
29904
29914
|
import { Badge as Badge15, BasicInput as BasicInput13, Button as Button78, Separator as Separator8, Skeleton as Skeleton29, cn as cn49 } from "@ai-matrx/design-system";
|
|
29905
29915
|
|
|
29906
29916
|
// src/PortalLookEditor.tsx
|
|
29907
|
-
import { useEffect as
|
|
29917
|
+
import { useEffect as useEffect85, useMemo as useMemo57, useState as useState95 } from "react";
|
|
29908
29918
|
import { useRecordsClient as useRecordsClient75 } from "@ai-matrx/records/react";
|
|
29909
29919
|
import { BasicInput as BasicInput12, Button as Button77, cn as cn48 } from "@ai-matrx/design-system";
|
|
29910
29920
|
|
|
@@ -29992,7 +30002,7 @@ function PortalLookEditor({ card, onSaved, className }) {
|
|
|
29992
30002
|
const [said, setSaid] = useState95(null);
|
|
29993
30003
|
const [formsError, setFormsError] = useState95(null);
|
|
29994
30004
|
const [formsUnread, setFormsUnread] = useState95(false);
|
|
29995
|
-
|
|
30005
|
+
useEffect85(() => {
|
|
29996
30006
|
let cancelled = false;
|
|
29997
30007
|
void (async () => {
|
|
29998
30008
|
try {
|
|
@@ -30242,7 +30252,7 @@ function PortalsPanel({ tableId, activePortalId, className }) {
|
|
|
30242
30252
|
const [exposures, setExposures] = useState96([]);
|
|
30243
30253
|
const [listError, setListError] = useState96(null);
|
|
30244
30254
|
const [openId, setOpenId] = useState96(activePortalId ?? null);
|
|
30245
|
-
|
|
30255
|
+
useEffect86(() => {
|
|
30246
30256
|
if (activePortalId) setOpenId(activePortalId);
|
|
30247
30257
|
}, [activePortalId]);
|
|
30248
30258
|
const [building, setBuilding] = useState96(false);
|
|
@@ -30260,7 +30270,7 @@ function PortalsPanel({ tableId, activePortalId, className }) {
|
|
|
30260
30270
|
setPortals(answered.data);
|
|
30261
30271
|
setExposures(mapped.ok ? mapped.data : []);
|
|
30262
30272
|
}, [client]);
|
|
30263
|
-
|
|
30273
|
+
useEffect86(() => {
|
|
30264
30274
|
void load();
|
|
30265
30275
|
}, [load]);
|
|
30266
30276
|
if (portals === null) return /* @__PURE__ */ jsx106(Skeleton29, { className: cn49("h-32 w-full", className) });
|
|
@@ -30535,7 +30545,7 @@ function PortalDetail({
|
|
|
30535
30545
|
setError(null);
|
|
30536
30546
|
setCard(answered.data);
|
|
30537
30547
|
}, [client, portalId]);
|
|
30538
|
-
|
|
30548
|
+
useEffect86(() => {
|
|
30539
30549
|
void load();
|
|
30540
30550
|
}, [load]);
|
|
30541
30551
|
const revoke = useCallback44(
|
|
@@ -30743,7 +30753,7 @@ function Preview({
|
|
|
30743
30753
|
const [which, setWhich] = useState96(first?.table_id ?? null);
|
|
30744
30754
|
const [rows, setRows] = useState96(null);
|
|
30745
30755
|
const [error, setError] = useState96(null);
|
|
30746
|
-
|
|
30756
|
+
useEffect86(() => {
|
|
30747
30757
|
if (!which) return;
|
|
30748
30758
|
let cancelled = false;
|
|
30749
30759
|
setRows(null);
|
|
@@ -30789,7 +30799,7 @@ function Invite({ card, onInvited }) {
|
|
|
30789
30799
|
const [busy, setBusy] = useState96(false);
|
|
30790
30800
|
const [said, setSaid] = useState96(null);
|
|
30791
30801
|
const [error, setError] = useState96(null);
|
|
30792
|
-
|
|
30802
|
+
useEffect86(() => {
|
|
30793
30803
|
let cancelled = false;
|
|
30794
30804
|
void client.list({ table_id: card.client_table_id, limit: 200 }).then((answered) => {
|
|
30795
30805
|
if (cancelled) return;
|
|
@@ -31000,7 +31010,7 @@ function FormLookFrame({ look, title, children, contained = false, showOwnerHead
|
|
|
31000
31010
|
}
|
|
31001
31011
|
|
|
31002
31012
|
// src/DigestScheduler.tsx
|
|
31003
|
-
import { useCallback as useCallback45, useEffect as
|
|
31013
|
+
import { useCallback as useCallback45, useEffect as useEffect87, useMemo as useMemo59, useState as useState97 } from "react";
|
|
31004
31014
|
import { useRecordsClient as useRecordsClient77, useTable as useTable28 } from "@ai-matrx/records/react";
|
|
31005
31015
|
import { hasQuietHours } from "@ai-matrx/records";
|
|
31006
31016
|
import { BasicInput as BasicInput14, Button as Button79, Checkbox as Checkbox8, Label as Label11, Separator as Separator9, Skeleton as Skeleton30, cn as cn51 } from "@ai-matrx/design-system";
|
|
@@ -31118,7 +31128,7 @@ function DigestScheduler({
|
|
|
31118
31128
|
setMembers([]);
|
|
31119
31129
|
}
|
|
31120
31130
|
}, [client, tableId, host]);
|
|
31121
|
-
|
|
31131
|
+
useEffect87(() => {
|
|
31122
31132
|
void load();
|
|
31123
31133
|
}, [load]);
|
|
31124
31134
|
const schedule = useMemo59(() => {
|
|
@@ -31378,13 +31388,13 @@ function DigestScheduler({
|
|
|
31378
31388
|
}
|
|
31379
31389
|
|
|
31380
31390
|
// src/SubscriptionsPanel.tsx
|
|
31381
|
-
import { useCallback as useCallback47, useEffect as
|
|
31391
|
+
import { useCallback as useCallback47, useEffect as useEffect89, useState as useState99 } from "react";
|
|
31382
31392
|
import { useRecordsClient as useRecordsClient79 } from "@ai-matrx/records/react";
|
|
31383
31393
|
import { hasQuietHours as hasQuietHours2 } from "@ai-matrx/records";
|
|
31384
31394
|
import { Badge as Badge16, Button as Button81, Skeleton as Skeleton32, Switch as Switch7, cn as cn53 } from "@ai-matrx/design-system";
|
|
31385
31395
|
|
|
31386
31396
|
// src/WebhooksPanel.tsx
|
|
31387
|
-
import { useCallback as useCallback46, useEffect as
|
|
31397
|
+
import { useCallback as useCallback46, useEffect as useEffect88, useState as useState98 } from "react";
|
|
31388
31398
|
import { useRecordsClient as useRecordsClient78, useTable as useTable29 } from "@ai-matrx/records/react";
|
|
31389
31399
|
import { BasicInput as BasicInput15, Button as Button80, Checkbox as Checkbox9, ConfirmDialog as ConfirmDialog6, Label as Label12, Skeleton as Skeleton31, cn as cn52 } from "@ai-matrx/design-system";
|
|
31390
31400
|
import { jsx as jsx109, jsxs as jsxs100 } from "react/jsx-runtime";
|
|
@@ -31430,7 +31440,7 @@ function WebhooksPanel({ tableId, className }) {
|
|
|
31430
31440
|
setError(null);
|
|
31431
31441
|
setHooks(answered.data ?? []);
|
|
31432
31442
|
}, [client, tableId]);
|
|
31433
|
-
|
|
31443
|
+
useEffect88(() => {
|
|
31434
31444
|
void load();
|
|
31435
31445
|
}, [load]);
|
|
31436
31446
|
const declare2 = async () => {
|
|
@@ -31618,7 +31628,7 @@ function SubscriptionsPanel({ tableId, activeRuleId, className }) {
|
|
|
31618
31628
|
setError(null);
|
|
31619
31629
|
setRows(answered.data);
|
|
31620
31630
|
}, [client, tableId]);
|
|
31621
|
-
|
|
31631
|
+
useEffect89(() => {
|
|
31622
31632
|
void load();
|
|
31623
31633
|
}, [load]);
|
|
31624
31634
|
const flip = useCallback47(
|
|
@@ -31811,7 +31821,7 @@ import { copyText as copyText6 } from "@ai-matrx/kit/clipboard";
|
|
|
31811
31821
|
import { dropKeptDraft, keepDraft, readKeptDraft } from "@ai-matrx/kit/drafts";
|
|
31812
31822
|
import { ErrorBox as ErrorBox3 } from "@ai-matrx/design-system";
|
|
31813
31823
|
import { Select as Select16 } from "@ai-matrx/design-system/controls";
|
|
31814
|
-
import { useCallback as useCallback49, useEffect as
|
|
31824
|
+
import { useCallback as useCallback49, useEffect as useEffect92, useMemo as useMemo61, useRef as useRef43, useState as useState103 } from "react";
|
|
31815
31825
|
import { DndContext as DndContext2, KeyboardSensor, PointerSensor as PointerSensor2, closestCenter as closestCenter2, useSensor as useSensor2, useSensors as useSensors2 } from "@dnd-kit/core";
|
|
31816
31826
|
import { SortableContext as SortableContext2, arrayMove, sortableKeyboardCoordinates, useSortable as useSortable2, verticalListSortingStrategy as verticalListSortingStrategy2 } from "@dnd-kit/sortable";
|
|
31817
31827
|
import { CSS as CSS3 } from "@dnd-kit/utilities";
|
|
@@ -32084,7 +32094,7 @@ function EmbedSnippets({ url, label }) {
|
|
|
32084
32094
|
}
|
|
32085
32095
|
|
|
32086
32096
|
// src/FormRunner.tsx
|
|
32087
|
-
import { useCallback as useCallback48, useEffect as
|
|
32097
|
+
import { useCallback as useCallback48, useEffect as useEffect90, useMemo as useMemo60, useRef as useRef42, useState as useState101 } from "react";
|
|
32088
32098
|
import { useFields as useFields24, useOptionalRecordsClient as useOptionalRecordsClient9 } from "@ai-matrx/records/react";
|
|
32089
32099
|
import { Button as Button83, Label as Label14, Progress, Skeleton as Skeleton33, cn as cn54, formThemeClasses } from "@ai-matrx/design-system";
|
|
32090
32100
|
import { answerRefusal, formRoutes, FORM_RUNNER_WORDS_EN, pipeAnswers, submissionStamp } from "@ai-matrx/records/forms";
|
|
@@ -32223,11 +32233,11 @@ function FormStage({
|
|
|
32223
32233
|
const routes = formRoutes(form);
|
|
32224
32234
|
const [routeKnown, setRouteKnown] = useState101(() => !routes || !whichAsked);
|
|
32225
32235
|
const [stopped, setStopped] = useState101(null);
|
|
32226
|
-
const answersRef =
|
|
32236
|
+
const answersRef = useRef42(answers);
|
|
32227
32237
|
answersRef.current = answers;
|
|
32228
32238
|
const choose = autoAdvance ?? form.autoAdvance ?? true;
|
|
32229
|
-
const decoy =
|
|
32230
|
-
const stage =
|
|
32239
|
+
const decoy = useRef42("");
|
|
32240
|
+
const stage = useRef42(null);
|
|
32231
32241
|
const questions = useMemo60(() => {
|
|
32232
32242
|
const byKey = new Map((fields ?? []).map((f) => [f.key, f]));
|
|
32233
32243
|
return (form.questions ?? []).map((q) => {
|
|
@@ -32245,7 +32255,7 @@ function FormStage({
|
|
|
32245
32255
|
};
|
|
32246
32256
|
});
|
|
32247
32257
|
}, [fields, form.questions]);
|
|
32248
|
-
|
|
32258
|
+
useEffect90(() => {
|
|
32249
32259
|
if (!whichAsked) return;
|
|
32250
32260
|
if (!routes) return;
|
|
32251
32261
|
let cancelled = false;
|
|
@@ -32291,19 +32301,19 @@ function FormStage({
|
|
|
32291
32301
|
};
|
|
32292
32302
|
}, [whichAsked, questions, answers]);
|
|
32293
32303
|
const live = questions.filter((q) => !hidden[q.key]);
|
|
32294
|
-
const told =
|
|
32295
|
-
|
|
32304
|
+
const told = useRef42(answers);
|
|
32305
|
+
useEffect90(() => {
|
|
32296
32306
|
if (told.current === answers) return;
|
|
32297
32307
|
told.current = answers;
|
|
32298
32308
|
onAnswersChange?.(answers);
|
|
32299
32309
|
}, [answers, onAnswersChange]);
|
|
32300
|
-
const resumeAt =
|
|
32310
|
+
const resumeAt = useRef42(
|
|
32301
32311
|
resumed && initialAnswers && Object.keys(initialAnswers).length > 0 ? questions.find((q) => {
|
|
32302
32312
|
const v = initialAnswers[q.key];
|
|
32303
32313
|
return v === void 0 || v === null || v === "";
|
|
32304
32314
|
})?.key ?? null : null
|
|
32305
32315
|
);
|
|
32306
|
-
|
|
32316
|
+
useEffect90(() => {
|
|
32307
32317
|
const key = resumeAt.current;
|
|
32308
32318
|
if (!key) return;
|
|
32309
32319
|
const i = live.findIndex((q) => q.key === key);
|
|
@@ -32412,10 +32422,10 @@ function FormStage({
|
|
|
32412
32422
|
if (stillMissing) refuse(stillMissing, refusalFor2(stillMissing));
|
|
32413
32423
|
else void submit();
|
|
32414
32424
|
}
|
|
32415
|
-
const routing =
|
|
32425
|
+
const routing = useRef42(false);
|
|
32416
32426
|
const [routingNow, setRoutingNow] = useState101(false);
|
|
32417
|
-
const typedAhead =
|
|
32418
|
-
|
|
32427
|
+
const typedAhead = useRef42("");
|
|
32428
|
+
useEffect90(() => {
|
|
32419
32429
|
if (!routingNow) return;
|
|
32420
32430
|
const hold = (event) => {
|
|
32421
32431
|
if (!routing.current || event.metaKey || event.ctrlKey || event.altKey || event.isComposing) return;
|
|
@@ -32445,10 +32455,10 @@ function FormStage({
|
|
|
32445
32455
|
}
|
|
32446
32456
|
for (const key of held) target.dispatchEvent(new KeyboardEvent("keydown", { key, bubbles: true, cancelable: true }));
|
|
32447
32457
|
}, [live, at]);
|
|
32448
|
-
|
|
32458
|
+
useEffect90(() => {
|
|
32449
32459
|
if (!routingNow) pourTypedAhead();
|
|
32450
32460
|
}, [routingNow, at, pourTypedAhead]);
|
|
32451
|
-
const advanceRef =
|
|
32461
|
+
const advanceRef = useRef42(advance);
|
|
32452
32462
|
advanceRef.current = advance;
|
|
32453
32463
|
const chosen = useCallback48(() => {
|
|
32454
32464
|
if (!oneAtATime || !choose) return;
|
|
@@ -32470,23 +32480,23 @@ function FormStage({
|
|
|
32470
32480
|
if (event.shiftKey) retreat();
|
|
32471
32481
|
else advance();
|
|
32472
32482
|
}
|
|
32473
|
-
|
|
32483
|
+
useEffect90(() => {
|
|
32474
32484
|
const input = stage.current?.querySelector("[role='radio'][aria-checked='true']") ?? stage.current?.querySelector(
|
|
32475
32485
|
"input:not([tabindex='-1']), textarea, select, [role='combobox'], [role='radio'], [role='checkbox']"
|
|
32476
32486
|
);
|
|
32477
32487
|
input?.focus();
|
|
32478
32488
|
pourTypedAhead();
|
|
32479
32489
|
}, [index, done, started]);
|
|
32480
|
-
const startTold =
|
|
32481
|
-
|
|
32490
|
+
const startTold = useRef42(false);
|
|
32491
|
+
useEffect90(() => {
|
|
32482
32492
|
if (startTold.current || !onStart) return;
|
|
32483
32493
|
if (Object.values(answers).some((v) => v !== void 0 && v !== null && v !== "")) {
|
|
32484
32494
|
startTold.current = true;
|
|
32485
32495
|
onStart();
|
|
32486
32496
|
}
|
|
32487
32497
|
}, [answers, onStart]);
|
|
32488
|
-
const shownTold =
|
|
32489
|
-
|
|
32498
|
+
const shownTold = useRef42(/* @__PURE__ */ new Set());
|
|
32499
|
+
useEffect90(() => {
|
|
32490
32500
|
if (!onQuestionShown || !started || done) return;
|
|
32491
32501
|
for (const q of oneAtATime ? current ? [current] : [] : live) {
|
|
32492
32502
|
if (shownTold.current.has(q.key)) continue;
|
|
@@ -32673,7 +32683,7 @@ function ThankYou({
|
|
|
32673
32683
|
const title = rawTitle ? pipe(rawTitle) : rawTitle;
|
|
32674
32684
|
const body = rawBody ? pipe(rawBody) : rawBody;
|
|
32675
32685
|
const going = redirect !== null && done !== "preview";
|
|
32676
|
-
|
|
32686
|
+
useEffect90(() => {
|
|
32677
32687
|
if (!going || !redirect) return;
|
|
32678
32688
|
const timer = window.setTimeout(() => window.location.assign(redirect), REDIRECT_AFTER_MS);
|
|
32679
32689
|
return () => window.clearTimeout(timer);
|
|
@@ -32782,7 +32792,7 @@ function Question({
|
|
|
32782
32792
|
}
|
|
32783
32793
|
|
|
32784
32794
|
// src/FormExtrasEditor.tsx
|
|
32785
|
-
import { useEffect as
|
|
32795
|
+
import { useEffect as useEffect91, useState as useState102 } from "react";
|
|
32786
32796
|
import { useRecordsClient as useRecordsClient80 } from "@ai-matrx/records/react";
|
|
32787
32797
|
import {
|
|
32788
32798
|
FORM_LANGUAGE_NAMES,
|
|
@@ -32810,7 +32820,7 @@ function FormAnswerExtras({
|
|
|
32810
32820
|
const [typing, setTyping] = useState102(null);
|
|
32811
32821
|
const [saving, setSaving] = useState102(false);
|
|
32812
32822
|
const [refused, setRefused] = useState102(null);
|
|
32813
|
-
|
|
32823
|
+
useEffect91(() => {
|
|
32814
32824
|
if (!formId) return;
|
|
32815
32825
|
let cancelled = false;
|
|
32816
32826
|
void client.formSetPassword({ form_id: formId, password: null }).then((r) => {
|
|
@@ -33121,7 +33131,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
|
|
|
33121
33131
|
const [restoredAt, setRestoredAt] = useState103(null);
|
|
33122
33132
|
const [showResults, setShowResults] = useState103(false);
|
|
33123
33133
|
const [adding, setAdding] = useState103(false);
|
|
33124
|
-
const keysBeforeAdd =
|
|
33134
|
+
const keysBeforeAdd = useRef43(null);
|
|
33125
33135
|
const [makeOnMount, setMakeOnMount] = useState103("waiting");
|
|
33126
33136
|
const publicOrigin = host.publicOrigin ?? (typeof window === "undefined" ? "" : window.location.origin);
|
|
33127
33137
|
const load = useCallback49(async () => {
|
|
@@ -33151,10 +33161,10 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
|
|
|
33151
33161
|
setError(null);
|
|
33152
33162
|
setForms(mine);
|
|
33153
33163
|
}, [client, tableId, seed, claimSeed]);
|
|
33154
|
-
|
|
33164
|
+
useEffect92(() => {
|
|
33155
33165
|
void load();
|
|
33156
33166
|
}, [load]);
|
|
33157
|
-
|
|
33167
|
+
useEffect92(() => {
|
|
33158
33168
|
let cancelled = false;
|
|
33159
33169
|
Promise.resolve().then(() => client.formKnobs()).then((r) => {
|
|
33160
33170
|
if (!cancelled && r.ok) setOrgKnobs(r.data);
|
|
@@ -33163,7 +33173,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
|
|
|
33163
33173
|
cancelled = true;
|
|
33164
33174
|
};
|
|
33165
33175
|
}, [client]);
|
|
33166
|
-
|
|
33176
|
+
useEffect92(() => {
|
|
33167
33177
|
if (!forms || forms.length === 0) return;
|
|
33168
33178
|
if (createOnMount && makeOnMount !== "made") return;
|
|
33169
33179
|
const chosen = forms.find((f) => f.id === (activeFormId ?? activeId)) ?? forms[0];
|
|
@@ -33187,8 +33197,8 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
|
|
|
33187
33197
|
);
|
|
33188
33198
|
const stored = useMemo61(() => draft ? (forms ?? []).find((f) => f.id === draft.id) ?? null : null, [draft, forms]);
|
|
33189
33199
|
const dirty = Boolean(draft && stored && !sameForm(draft, stored));
|
|
33190
|
-
const lastSaved =
|
|
33191
|
-
|
|
33200
|
+
const lastSaved = useRef43(null);
|
|
33201
|
+
useEffect92(() => {
|
|
33192
33202
|
if (!draft || !stored) return;
|
|
33193
33203
|
const timer = window.setTimeout(() => {
|
|
33194
33204
|
if (sameForm(draft, stored) || lastSaved.current && sameForm(draft, lastSaved.current)) dropKeptDraft(formDraftKey(draft.id), { storage: "local" });
|
|
@@ -33197,7 +33207,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
|
|
|
33197
33207
|
return () => window.clearTimeout(timer);
|
|
33198
33208
|
}, [draft, stored]);
|
|
33199
33209
|
const lookKey = draft ? JSON.stringify(formLookDocument(draft.look ?? null)) : null;
|
|
33200
|
-
|
|
33210
|
+
useEffect92(() => {
|
|
33201
33211
|
if (lookKey === null) return;
|
|
33202
33212
|
let cancelled = false;
|
|
33203
33213
|
const timer = window.setTimeout(() => {
|
|
@@ -33214,7 +33224,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
|
|
|
33214
33224
|
window.clearTimeout(timer);
|
|
33215
33225
|
};
|
|
33216
33226
|
}, [client, lookKey]);
|
|
33217
|
-
|
|
33227
|
+
useEffect92(() => {
|
|
33218
33228
|
const before = keysBeforeAdd.current;
|
|
33219
33229
|
if (!before || !fields.data) return;
|
|
33220
33230
|
const made = askableFields(fields.data).filter((f) => !before.has(f.key));
|
|
@@ -33326,14 +33336,14 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
|
|
|
33326
33336
|
return true;
|
|
33327
33337
|
}
|
|
33328
33338
|
const [started, setStarted] = useState103(false);
|
|
33329
|
-
|
|
33339
|
+
useEffect92(() => {
|
|
33330
33340
|
if (!startWithOne || started || forms === null || forms.length > 0) return;
|
|
33331
33341
|
if (askableFields(fields.data ?? []).length === 0) return;
|
|
33332
33342
|
if (!table.data && !table.error) return;
|
|
33333
33343
|
setStarted(true);
|
|
33334
33344
|
void create(table.data?.name?.trim() ? `${table.data.name.trim()} form` : "Form 1");
|
|
33335
33345
|
}, [startWithOne, started, forms, fields.data, create, table.data, table.error]);
|
|
33336
|
-
|
|
33346
|
+
useEffect92(() => {
|
|
33337
33347
|
if (!createOnMount || makeOnMount !== "waiting" || forms === null) return;
|
|
33338
33348
|
if (!table.data && !table.error) return;
|
|
33339
33349
|
if (askableFields(fields.data ?? []).length === 0) {
|
|
@@ -33953,8 +33963,8 @@ function NotifyOnAnswer({
|
|
|
33953
33963
|
const [error, setError] = useState103(null);
|
|
33954
33964
|
const [said, setSaid] = useState103(null);
|
|
33955
33965
|
const [url, setUrl] = useState103(notify?.webhookUrl ?? "");
|
|
33956
|
-
|
|
33957
|
-
|
|
33966
|
+
useEffect92(() => setUrl(notify?.webhookUrl ?? ""), [notify?.webhookUrl]);
|
|
33967
|
+
useEffect92(() => {
|
|
33958
33968
|
let cancelled = false;
|
|
33959
33969
|
void client.subscriptions({ table_id: tableId }).then((r) => {
|
|
33960
33970
|
if (!cancelled && r.ok) setSubs(r.data);
|
|
@@ -34085,7 +34095,7 @@ function NotifyOnAnswer({
|
|
|
34085
34095
|
}
|
|
34086
34096
|
|
|
34087
34097
|
// src/DocRender.tsx
|
|
34088
|
-
import { useCallback as useCallback50, useEffect as
|
|
34098
|
+
import { useCallback as useCallback50, useEffect as useEffect93, useRef as useRef44, useState as useState104 } from "react";
|
|
34089
34099
|
import { useRecordsClient as useRecordsClient82 } from "@ai-matrx/records/react";
|
|
34090
34100
|
import { Button as Button86, Skeleton as Skeleton35, cn as cn56 } from "@ai-matrx/design-system";
|
|
34091
34101
|
import { jsx as jsx115, jsxs as jsxs106 } from "react/jsx-runtime";
|
|
@@ -34096,7 +34106,7 @@ function DocRender({ templateId, recordId, filename, onRendered, className }) {
|
|
|
34096
34106
|
const [showing, setShowing] = useState104(null);
|
|
34097
34107
|
const [error, setError] = useState104(null);
|
|
34098
34108
|
const [busy, setBusy] = useState104(null);
|
|
34099
|
-
const paper =
|
|
34109
|
+
const paper = useRef44(null);
|
|
34100
34110
|
const load = useCallback50(async () => {
|
|
34101
34111
|
const [body, held] = await Promise.all([
|
|
34102
34112
|
client.docRenderBody({ template_id: templateId, record_id: recordId }),
|
|
@@ -34114,7 +34124,7 @@ function DocRender({ templateId, recordId, filename, onRendered, className }) {
|
|
|
34114
34124
|
setPreview(body.data);
|
|
34115
34125
|
setRenders(held.data.filter((r) => r.template_id === templateId));
|
|
34116
34126
|
}, [client, templateId, recordId]);
|
|
34117
|
-
|
|
34127
|
+
useEffect93(() => {
|
|
34118
34128
|
void load();
|
|
34119
34129
|
}, [load]);
|
|
34120
34130
|
async function freeze() {
|
|
@@ -34201,7 +34211,7 @@ function DocRender({ templateId, recordId, filename, onRendered, className }) {
|
|
|
34201
34211
|
}
|
|
34202
34212
|
|
|
34203
34213
|
// src/SignBlock.tsx
|
|
34204
|
-
import { useCallback as useCallback51, useEffect as
|
|
34214
|
+
import { useCallback as useCallback51, useEffect as useEffect94, useState as useState105 } from "react";
|
|
34205
34215
|
import { useFields as useFields26, useRecordsClient as useRecordsClient83 } from "@ai-matrx/records/react";
|
|
34206
34216
|
import { BasicInput as BasicInput19, Button as Button87, Skeleton as Skeleton36, cn as cn57 } from "@ai-matrx/design-system";
|
|
34207
34217
|
import { useTable as useTable31 } from "@ai-matrx/records/react";
|
|
@@ -34231,7 +34241,7 @@ function SignBlock({ tableId, recordId, render, className }) {
|
|
|
34231
34241
|
}
|
|
34232
34242
|
setVerdicts(answers);
|
|
34233
34243
|
}, [client, recordId]);
|
|
34234
|
-
|
|
34244
|
+
useEffect94(() => {
|
|
34235
34245
|
void load();
|
|
34236
34246
|
}, [load]);
|
|
34237
34247
|
async function sign(field) {
|
|
@@ -34352,7 +34362,7 @@ function SignBlock({ tableId, recordId, render, className }) {
|
|
|
34352
34362
|
}
|
|
34353
34363
|
|
|
34354
34364
|
// src/NotifyRuleEditor.tsx
|
|
34355
|
-
import { useCallback as useCallback52, useEffect as
|
|
34365
|
+
import { useCallback as useCallback52, useEffect as useEffect95, useState as useState106 } from "react";
|
|
34356
34366
|
import { useRecordsClient as useRecordsClient84, useTable as useTable32 } from "@ai-matrx/records/react";
|
|
34357
34367
|
import { hasQuietHours as hasQuietHours3 } from "@ai-matrx/records";
|
|
34358
34368
|
import { Button as Button88, Skeleton as Skeleton37, cn as cn58 } from "@ai-matrx/design-system";
|
|
@@ -34402,7 +34412,7 @@ function NotifyRuleEditor({ tableId, seed, chosenRuleId, onChoose, className })
|
|
|
34402
34412
|
}
|
|
34403
34413
|
setViews(listed.data.map((v) => ({ id: v.view_id, name: v.name })));
|
|
34404
34414
|
}, [client, host, tableId]);
|
|
34405
|
-
|
|
34415
|
+
useEffect95(() => {
|
|
34406
34416
|
void load();
|
|
34407
34417
|
}, [load]);
|
|
34408
34418
|
const write = useCallback52(
|
|
@@ -34430,7 +34440,7 @@ function NotifyRuleEditor({ tableId, seed, chosenRuleId, onChoose, className })
|
|
|
34430
34440
|
},
|
|
34431
34441
|
[client, tableId]
|
|
34432
34442
|
);
|
|
34433
|
-
|
|
34443
|
+
useEffect95(() => {
|
|
34434
34444
|
if (!subscriptions || !seed || seed.length === 0) return;
|
|
34435
34445
|
const missing = seed.filter((s) => !subscriptions.some((held) => held.name === s.name));
|
|
34436
34446
|
if (missing.length === 0) return;
|
|
@@ -34638,7 +34648,7 @@ function NotifyRuleEditor({ tableId, seed, chosenRuleId, onChoose, className })
|
|
|
34638
34648
|
}
|
|
34639
34649
|
|
|
34640
34650
|
// src/DashboardCanvas.tsx
|
|
34641
|
-
import { useCallback as useCallback53, useEffect as
|
|
34651
|
+
import { useCallback as useCallback53, useEffect as useEffect96, useMemo as useMemo63, useState as useState108 } from "react";
|
|
34642
34652
|
import { useFields as useFields28, useRecordsClient as useRecordsClient86, useTable as useTable33 } from "@ai-matrx/records/react";
|
|
34643
34653
|
import {
|
|
34644
34654
|
BasicInput as BasicInput20,
|
|
@@ -35243,10 +35253,10 @@ function DashboardCanvas({ tableId, activeDashboardId, filter, createOnMount, on
|
|
|
35243
35253
|
return read;
|
|
35244
35254
|
}, [client, tableId]);
|
|
35245
35255
|
const [notKept, setNotKept] = useState108(null);
|
|
35246
|
-
|
|
35256
|
+
useEffect96(() => {
|
|
35247
35257
|
void load();
|
|
35248
35258
|
}, [load]);
|
|
35249
|
-
|
|
35259
|
+
useEffect96(() => {
|
|
35250
35260
|
if (!boards || boards.length === 0) return;
|
|
35251
35261
|
if (createOnMount && madeOnMount !== "done") return;
|
|
35252
35262
|
const chosen = boards.find((d) => d.id === (activeDashboardId ?? activeId)) ?? boards[0];
|
|
@@ -35254,7 +35264,7 @@ function DashboardCanvas({ tableId, activeDashboardId, filter, createOnMount, on
|
|
|
35254
35264
|
}, [boards, activeDashboardId, madeOnMount]);
|
|
35255
35265
|
const board = useMemo63(() => boards?.find((d) => d.id === activeId) ?? null, [boards, activeId]);
|
|
35256
35266
|
const filterKey = JSON.stringify(filter ?? {});
|
|
35257
|
-
|
|
35267
|
+
useEffect96(() => {
|
|
35258
35268
|
if (!activeId) {
|
|
35259
35269
|
setRun(null);
|
|
35260
35270
|
return;
|
|
@@ -35324,7 +35334,7 @@ function DashboardCanvas({ tableId, activeDashboardId, filter, createOnMount, on
|
|
|
35324
35334
|
]
|
|
35325
35335
|
);
|
|
35326
35336
|
}
|
|
35327
|
-
|
|
35337
|
+
useEffect96(() => {
|
|
35328
35338
|
if (!createOnMount || madeOnMount !== "waiting" || boards === null || !fields.data) return;
|
|
35329
35339
|
setMadeOnMount("making");
|
|
35330
35340
|
void create().then(() => setMadeOnMount("done"));
|
|
@@ -35778,7 +35788,7 @@ function TargetControl({
|
|
|
35778
35788
|
const [mode, setMode] = useState108(saved);
|
|
35779
35789
|
const savedValue = block.target && "value" in block.target && typeof block.target.value === "number" ? block.target.value : null;
|
|
35780
35790
|
const [draft, setDraft] = useState108(savedValue === null ? "" : String(savedValue));
|
|
35781
|
-
|
|
35791
|
+
useEffect96(() => {
|
|
35782
35792
|
setMode(saved);
|
|
35783
35793
|
setDraft(savedValue === null ? "" : String(savedValue));
|
|
35784
35794
|
}, [saved, savedValue]);
|
|
@@ -35846,7 +35856,7 @@ function TargetControl({
|
|
|
35846
35856
|
|
|
35847
35857
|
// src/QuestionPanel.tsx
|
|
35848
35858
|
import { copyText as copyText7 } from "@ai-matrx/kit/clipboard";
|
|
35849
|
-
import { useEffect as
|
|
35859
|
+
import { useEffect as useEffect97, useMemo as useMemo64, useRef as useRef45, useState as useState109 } from "react";
|
|
35850
35860
|
import { Badge as Badge17, BasicInput as BasicInput21, Button as Button91, Checkbox as Checkbox12, Label as Label17, Skeleton as Skeleton39, cn as cn60 } from "@ai-matrx/design-system";
|
|
35851
35861
|
import { useFields as useFields29, useRecordsClient as useRecordsClient87 } from "@ai-matrx/records/react";
|
|
35852
35862
|
|
|
@@ -35902,7 +35912,7 @@ function QuestionPanel({ tableId, activeQuestionId, draft, className }) {
|
|
|
35902
35912
|
const me = client.config.actor?.user_id ?? null;
|
|
35903
35913
|
const [hidden, setHidden] = useState109(null);
|
|
35904
35914
|
const [related, setRelated] = useState109({});
|
|
35905
|
-
|
|
35915
|
+
useEffect97(() => {
|
|
35906
35916
|
if (all.length === 0) {
|
|
35907
35917
|
if (!fields.loading) setHidden(/* @__PURE__ */ new Set());
|
|
35908
35918
|
return;
|
|
@@ -35935,8 +35945,8 @@ function QuestionPanel({ tableId, activeQuestionId, draft, className }) {
|
|
|
35935
35945
|
const [saveError, setSaveError] = useState109(null);
|
|
35936
35946
|
const [saving, setSaving] = useState109(false);
|
|
35937
35947
|
const [linkMissed, setLinkMissed] = useState109(false);
|
|
35938
|
-
const openedFromLink =
|
|
35939
|
-
|
|
35948
|
+
const openedFromLink = useRef45(false);
|
|
35949
|
+
useEffect97(() => {
|
|
35940
35950
|
let live = true;
|
|
35941
35951
|
void (0, question_exports.questionsOf)(client, tableId).then((answer2) => {
|
|
35942
35952
|
if (!live) return;
|
|
@@ -35959,7 +35969,7 @@ function QuestionPanel({ tableId, activeQuestionId, draft, className }) {
|
|
|
35959
35969
|
setShared(q ? q.shared : true);
|
|
35960
35970
|
setSaveError(null);
|
|
35961
35971
|
};
|
|
35962
|
-
|
|
35972
|
+
useEffect97(() => {
|
|
35963
35973
|
if (!draft) return;
|
|
35964
35974
|
open(null);
|
|
35965
35975
|
setSpec(draft);
|
|
@@ -35968,7 +35978,7 @@ function QuestionPanel({ tableId, activeQuestionId, draft, className }) {
|
|
|
35968
35978
|
const [answer, setAnswer] = useState109(null);
|
|
35969
35979
|
const [asking, setAsking] = useState109(false);
|
|
35970
35980
|
const specKey = JSON.stringify(spec);
|
|
35971
|
-
|
|
35981
|
+
useEffect97(() => {
|
|
35972
35982
|
if (all.length === 0) return;
|
|
35973
35983
|
let live = true;
|
|
35974
35984
|
setAsking(true);
|
|
@@ -36410,7 +36420,7 @@ function QuestionAnswerView({ tableId, spec, answer, fields, related = NO_RELATE
|
|
|
36410
36420
|
}
|
|
36411
36421
|
|
|
36412
36422
|
// src/TableAsk.tsx
|
|
36413
|
-
import { useEffect as
|
|
36423
|
+
import { useEffect as useEffect98, useState as useState110 } from "react";
|
|
36414
36424
|
import { BasicInput as BasicInput22, Button as Button92, Popover as Popover12, PopoverContent as PopoverContent12, PopoverTrigger as PopoverTrigger12, Skeleton as Skeleton40 } from "@ai-matrx/design-system";
|
|
36415
36425
|
import { optionLabel } from "@ai-matrx/records";
|
|
36416
36426
|
import { useFields as useFields30, useRecordsClient as useRecordsClient88, useTable as useTable34 } from "@ai-matrx/records/react";
|
|
@@ -36729,7 +36739,7 @@ function useNames(tableId, ids) {
|
|
|
36729
36739
|
const key = ids.join("|");
|
|
36730
36740
|
const reads = useReadRefusal("record_read");
|
|
36731
36741
|
const [attempt, again] = useReadAgain();
|
|
36732
|
-
|
|
36742
|
+
useEffect98(() => {
|
|
36733
36743
|
let live = true;
|
|
36734
36744
|
void Promise.all(ids.map(async (id) => [id, await askWithOneRetry(() => client.recordRead({ record_id: id }))])).then((pairs) => {
|
|
36735
36745
|
if (!live) return;
|
|
@@ -36822,12 +36832,12 @@ function AgentAnswer({
|
|
|
36822
36832
|
}
|
|
36823
36833
|
|
|
36824
36834
|
// src/PageScreen.tsx
|
|
36825
|
-
import { useCallback as useCallback54, useEffect as
|
|
36835
|
+
import { useCallback as useCallback54, useEffect as useEffect100, useMemo as useMemo66, useRef as useRef46, useState as useState112 } from "react";
|
|
36826
36836
|
import { useRecordsClient as useRecordsClient90 } from "@ai-matrx/records/react";
|
|
36827
36837
|
import { BasicInput as BasicInput24, Button as Button94, Skeleton as Skeleton42, cn as cn62 } from "@ai-matrx/design-system";
|
|
36828
36838
|
|
|
36829
36839
|
// src/PageCanvas.tsx
|
|
36830
|
-
import { createContext as createContext7, useContext as useContext8, useEffect as
|
|
36840
|
+
import { createContext as createContext7, useContext as useContext8, useEffect as useEffect99, useMemo as useMemo65, useState as useState111 } from "react";
|
|
36831
36841
|
import {
|
|
36832
36842
|
useFields as useFields31,
|
|
36833
36843
|
useRecordPage as useRecordPage3,
|
|
@@ -36886,7 +36896,7 @@ function useDoorRows(door, elementId, recordId) {
|
|
|
36886
36896
|
error: null
|
|
36887
36897
|
});
|
|
36888
36898
|
const [tick, setTick] = useState111(0);
|
|
36889
|
-
|
|
36899
|
+
useEffect99(() => {
|
|
36890
36900
|
if (!door) return;
|
|
36891
36901
|
let live = true;
|
|
36892
36902
|
setState((s) => ({ ...s, loading: true }));
|
|
@@ -37011,7 +37021,7 @@ function useMemberQuestion(block, viewerUserId, extra, mineOn, enabled = true) {
|
|
|
37011
37021
|
const [viewAttempt, viewAgain] = useReadAgain();
|
|
37012
37022
|
const meReads = useReadRefusal("me_record");
|
|
37013
37023
|
const [meAttempt, meAgain] = useReadAgain();
|
|
37014
|
-
|
|
37024
|
+
useEffect99(() => {
|
|
37015
37025
|
if (!block.view_id || !enabled) {
|
|
37016
37026
|
setView(null);
|
|
37017
37027
|
return;
|
|
@@ -37031,7 +37041,7 @@ function useMemberQuestion(block, viewerUserId, extra, mineOn, enabled = true) {
|
|
|
37031
37041
|
const mine = mineOn || block.me_only === true;
|
|
37032
37042
|
const meField = block.me_field ? all.find((f) => f.key === block.me_field) : void 0;
|
|
37033
37043
|
const [me, setMe] = useState111(null);
|
|
37034
|
-
|
|
37044
|
+
useEffect99(() => {
|
|
37035
37045
|
if (!enabled || !mine || !meField?.relation_target || !viewerUserId) {
|
|
37036
37046
|
setMe(null);
|
|
37037
37047
|
return;
|
|
@@ -37066,7 +37076,7 @@ function useMemberRows(block, viewerUserId, extra, mineOn, enabled) {
|
|
|
37066
37076
|
...q.sort.length > 0 ? { sort: q.sort } : {}
|
|
37067
37077
|
});
|
|
37068
37078
|
const reload = page.reload;
|
|
37069
|
-
|
|
37079
|
+
useEffect99(() => onRecordChanged2(() => reload()), [reload]);
|
|
37070
37080
|
return { q, page };
|
|
37071
37081
|
}
|
|
37072
37082
|
function BlockBody(inner) {
|
|
@@ -37147,7 +37157,7 @@ function AppletBlockView({ block }) {
|
|
|
37147
37157
|
function AppletPick({ value, onChange }) {
|
|
37148
37158
|
const host = useRecordsUi();
|
|
37149
37159
|
const [options, setOptions] = useState111(null);
|
|
37150
|
-
|
|
37160
|
+
useEffect99(() => {
|
|
37151
37161
|
let live = true;
|
|
37152
37162
|
host.applets?.list().then((apps) => live && setOptions(apps.map((a) => ({ value: a.id, label: a.name })))).catch(() => live && setOptions([]));
|
|
37153
37163
|
return () => {
|
|
@@ -37221,10 +37231,10 @@ function ListBlockView({
|
|
|
37221
37231
|
const { rows, all } = read;
|
|
37222
37232
|
const columns = shownColumns(all, block.columns);
|
|
37223
37233
|
const name = block.title ?? table.data?.name ?? "List";
|
|
37224
|
-
|
|
37234
|
+
useEffect99(() => onRows(rows), [rows, onRows]);
|
|
37225
37235
|
const firstId = rows[0]?.id ?? null;
|
|
37226
37236
|
const stillThere = selected !== null && rows.some((r) => r.id === selected);
|
|
37227
|
-
|
|
37237
|
+
useEffect99(() => {
|
|
37228
37238
|
if (read.loading || read.waiting) return;
|
|
37229
37239
|
if (!stillThere) onSelect(firstId);
|
|
37230
37240
|
}, [firstId, stillThere, read.loading, read.waiting]);
|
|
@@ -37401,7 +37411,7 @@ function InterfaceChartView({ door, chartId, title, subject }) {
|
|
|
37401
37411
|
waiting: true,
|
|
37402
37412
|
error: null
|
|
37403
37413
|
});
|
|
37404
|
-
|
|
37414
|
+
useEffect99(() => {
|
|
37405
37415
|
let live = true;
|
|
37406
37416
|
setState((s) => ({ ...s, waiting: true }));
|
|
37407
37417
|
void client.interfaceChart({ interface_id: door.interfaceId, chart_id: chartId }).then((answered) => {
|
|
@@ -37538,7 +37548,7 @@ function ActionButton2({ block, recordId }) {
|
|
|
37538
37548
|
const [running, setRunning] = useState111(false);
|
|
37539
37549
|
const [done, setDone] = useState111(null);
|
|
37540
37550
|
const [error, setError] = useState111(null);
|
|
37541
|
-
|
|
37551
|
+
useEffect99(() => {
|
|
37542
37552
|
setDone(null);
|
|
37543
37553
|
setError(null);
|
|
37544
37554
|
setAsking(false);
|
|
@@ -37579,7 +37589,7 @@ function FormBlockView({ block }) {
|
|
|
37579
37589
|
const client = useRecordsClient89();
|
|
37580
37590
|
const [form, setForm] = useState111("reading");
|
|
37581
37591
|
const [sent, setSent] = useState111(0);
|
|
37582
|
-
|
|
37592
|
+
useEffect99(() => {
|
|
37583
37593
|
if (!block.form_id) {
|
|
37584
37594
|
setForm(null);
|
|
37585
37595
|
return;
|
|
@@ -37712,7 +37722,7 @@ function ScopeSettings({
|
|
|
37712
37722
|
const [views, setViews] = useState111([]);
|
|
37713
37723
|
const fields = useFields31(block.table_id);
|
|
37714
37724
|
const all = onePerKey3(fields.data ?? []);
|
|
37715
|
-
|
|
37725
|
+
useEffect99(() => {
|
|
37716
37726
|
let live = true;
|
|
37717
37727
|
void client.views({ table_id: block.table_id }).then((answered) => {
|
|
37718
37728
|
if (live) setViews(answered.ok ? answered.data : []);
|
|
@@ -37867,7 +37877,7 @@ function ListSettings({ block, onChange }) {
|
|
|
37867
37877
|
const [views, setViews] = useState111([]);
|
|
37868
37878
|
const fields = useFields31(block.table_id);
|
|
37869
37879
|
const all = onePerKey3(fields.data ?? []);
|
|
37870
|
-
|
|
37880
|
+
useEffect99(() => {
|
|
37871
37881
|
let live = true;
|
|
37872
37882
|
void client.views({ table_id: block.table_id }).then((answered) => {
|
|
37873
37883
|
if (live) setViews(answered.ok ? answered.data : []);
|
|
@@ -37950,7 +37960,7 @@ function ActionPicker({ tableId, value, onChange }) {
|
|
|
37950
37960
|
function FormPicker({ tableId, value, onChange }) {
|
|
37951
37961
|
const client = useRecordsClient89();
|
|
37952
37962
|
const [forms, setForms] = useState111([]);
|
|
37953
|
-
|
|
37963
|
+
useEffect99(() => {
|
|
37954
37964
|
let live = true;
|
|
37955
37965
|
void client.forms({ table_id: tableId }).then((answered) => {
|
|
37956
37966
|
if (live) setForms(answered.ok ? answered.data : []);
|
|
@@ -38036,7 +38046,7 @@ function PageScreen({
|
|
|
38036
38046
|
const [run, setRun] = useState112(null);
|
|
38037
38047
|
const [saveError, setSaveError] = useState112(null);
|
|
38038
38048
|
const [askingToArchive, setAskingToArchive] = useState112(false);
|
|
38039
|
-
const canvas =
|
|
38049
|
+
const canvas = useRef46(null);
|
|
38040
38050
|
const [making, setMaking] = useState112("waiting");
|
|
38041
38051
|
const id = page?.id ?? pageId ?? null;
|
|
38042
38052
|
const load = useCallback54(
|
|
@@ -38058,7 +38068,7 @@ function PageScreen({
|
|
|
38058
38068
|
},
|
|
38059
38069
|
[client]
|
|
38060
38070
|
);
|
|
38061
|
-
|
|
38071
|
+
useEffect100(() => {
|
|
38062
38072
|
if (!newOnTable || pageId || making !== "waiting") return;
|
|
38063
38073
|
setMaking("making");
|
|
38064
38074
|
void client.dashboardDeclare({
|
|
@@ -38078,11 +38088,11 @@ function PageScreen({
|
|
|
38078
38088
|
onCreated?.(made.data);
|
|
38079
38089
|
});
|
|
38080
38090
|
}, [client, newOnTable, pageId, making, load, onCreated]);
|
|
38081
|
-
|
|
38091
|
+
useEffect100(() => {
|
|
38082
38092
|
if (!pageId) return;
|
|
38083
38093
|
void load(pageId);
|
|
38084
38094
|
}, [pageId, load]);
|
|
38085
|
-
|
|
38095
|
+
useEffect100(() => {
|
|
38086
38096
|
if (!id) return;
|
|
38087
38097
|
let live = true;
|
|
38088
38098
|
void client.myLevels({ ids: [id], subject: "record" }).then((answered) => {
|
|
@@ -38094,7 +38104,7 @@ function PageScreen({
|
|
|
38094
38104
|
}, [client, id]);
|
|
38095
38105
|
const canEdit = level !== null && EDIT_LEVELS.has(level);
|
|
38096
38106
|
const chartKey = page ? JSON.stringify(page.blocks.map((b) => b.id)) + page.version : "";
|
|
38097
|
-
|
|
38107
|
+
useEffect100(() => {
|
|
38098
38108
|
if (!page || page.blocks.length === 0) {
|
|
38099
38109
|
setRun(null);
|
|
38100
38110
|
return;
|
|
@@ -38237,7 +38247,7 @@ function PageScreen({
|
|
|
38237
38247
|
}
|
|
38238
38248
|
|
|
38239
38249
|
// src/InterfaceScreen.tsx
|
|
38240
|
-
import { useCallback as useCallback55, useEffect as
|
|
38250
|
+
import { useCallback as useCallback55, useEffect as useEffect101, useMemo as useMemo67, useRef as useRef47, useState as useState113 } from "react";
|
|
38241
38251
|
import { useRecordsClient as useRecordsClient91 } from "@ai-matrx/records/react";
|
|
38242
38252
|
import { BasicInput as BasicInput25, Button as Button95, Skeleton as Skeleton43, cn as cn63 } from "@ai-matrx/design-system";
|
|
38243
38253
|
import { Fragment as Fragment52, jsx as jsx125, jsxs as jsxs116 } from "react/jsx-runtime";
|
|
@@ -38274,7 +38284,7 @@ function InterfaceScreen({
|
|
|
38274
38284
|
const [making, setMaking] = useState113("waiting");
|
|
38275
38285
|
const [askingToArchive, setAskingToArchive] = useState113(false);
|
|
38276
38286
|
const [localPage, setLocalPage] = useState113(null);
|
|
38277
|
-
const canvas =
|
|
38287
|
+
const canvas = useRef47(null);
|
|
38278
38288
|
const load = useCallback55(
|
|
38279
38289
|
async (want) => {
|
|
38280
38290
|
const answered = await client.interfaceRead({ interface_id: want });
|
|
@@ -38291,10 +38301,10 @@ function InterfaceScreen({
|
|
|
38291
38301
|
},
|
|
38292
38302
|
[client]
|
|
38293
38303
|
);
|
|
38294
|
-
|
|
38304
|
+
useEffect101(() => {
|
|
38295
38305
|
if (interfaceId) void load(interfaceId);
|
|
38296
38306
|
}, [interfaceId, load]);
|
|
38297
|
-
|
|
38307
|
+
useEffect101(() => {
|
|
38298
38308
|
if (!newOnTable || interfaceId || making !== "waiting") return;
|
|
38299
38309
|
setMaking("making");
|
|
38300
38310
|
const shape2 = newInterfaceShape(newOnTable);
|
|
@@ -38317,7 +38327,7 @@ function InterfaceScreen({
|
|
|
38317
38327
|
const charts = useMemo67(() => shape ? interfaceCharts(shape) : [], [shape]);
|
|
38318
38328
|
const through = !!read && !read.member;
|
|
38319
38329
|
const chartKey = read ? `${read.id}:${read.version}:${charts.length}` : "";
|
|
38320
|
-
|
|
38330
|
+
useEffect101(() => {
|
|
38321
38331
|
if (!read || through || charts.length === 0) {
|
|
38322
38332
|
setRun(null);
|
|
38323
38333
|
return;
|
|
@@ -38551,7 +38561,7 @@ function InterfaceScreen({
|
|
|
38551
38561
|
|
|
38552
38562
|
// src/FormsPanel.tsx
|
|
38553
38563
|
import { copyText as copyText8 } from "@ai-matrx/kit/clipboard";
|
|
38554
|
-
import { useCallback as useCallback56, useEffect as
|
|
38564
|
+
import { useCallback as useCallback56, useEffect as useEffect102, useRef as useRef48, useState as useState114 } from "react";
|
|
38555
38565
|
import { useRecordsClient as useRecordsClient92, useTable as useTable36 } from "@ai-matrx/records/react";
|
|
38556
38566
|
import { publicFormPath as publicFormPath2 } from "@ai-matrx/records";
|
|
38557
38567
|
import { Badge as Badge18, Button as Button96, Skeleton as Skeleton44, cn as cn64 } from "@ai-matrx/design-system";
|
|
@@ -38577,11 +38587,11 @@ function FormsPanel({ tableId, activeFormId, asView = false, className }) {
|
|
|
38577
38587
|
const [archivedSaid, setArchivedSaid] = useState114(null);
|
|
38578
38588
|
const linked = activeFormId && forms !== null ? forms.find((f) => f.form_id === activeFormId) ?? null : null;
|
|
38579
38589
|
const linkedMissing = Boolean(activeFormId) && forms !== null && linked === null;
|
|
38580
|
-
|
|
38590
|
+
useEffect102(() => {
|
|
38581
38591
|
if (linked && rights.structure) setBuilding(true);
|
|
38582
38592
|
}, [linked, rights.structure]);
|
|
38583
|
-
const openedAsView =
|
|
38584
|
-
|
|
38593
|
+
const openedAsView = useRef48(false);
|
|
38594
|
+
useEffect102(() => {
|
|
38585
38595
|
if (!asView || openedAsView.current || forms === null || forms.length === 0 || !rights.structure) return;
|
|
38586
38596
|
openedAsView.current = true;
|
|
38587
38597
|
setBuilding(true);
|
|
@@ -38596,7 +38606,7 @@ function FormsPanel({ tableId, activeFormId, asView = false, className }) {
|
|
|
38596
38606
|
setError(null);
|
|
38597
38607
|
setForms(answered.data);
|
|
38598
38608
|
}, [client, tableId]);
|
|
38599
|
-
|
|
38609
|
+
useEffect102(() => {
|
|
38600
38610
|
void load();
|
|
38601
38611
|
}, [load]);
|
|
38602
38612
|
const toggle = useCallback56(
|
|
@@ -38741,12 +38751,12 @@ function FormsPanel({ tableId, activeFormId, asView = false, className }) {
|
|
|
38741
38751
|
}
|
|
38742
38752
|
|
|
38743
38753
|
// src/CaptureSheet.tsx
|
|
38744
|
-
import { useCallback as useCallback58, useEffect as
|
|
38754
|
+
import { useCallback as useCallback58, useEffect as useEffect104, useRef as useRef50, useState as useState116 } from "react";
|
|
38745
38755
|
import { useFields as useFields32, useRecordsClient as useRecordsClient94, useTable as useTable37 } from "@ai-matrx/records/react";
|
|
38746
38756
|
import { Button as Button98, Input as Input8, Skeleton as Skeleton46, Textarea as Textarea6, cn as cn66 } from "@ai-matrx/design-system";
|
|
38747
38757
|
|
|
38748
38758
|
// src/CaptureRun.tsx
|
|
38749
|
-
import { useCallback as useCallback57, useEffect as
|
|
38759
|
+
import { useCallback as useCallback57, useEffect as useEffect103, useMemo as useMemo68, useRef as useRef49, useState as useState115 } from "react";
|
|
38750
38760
|
import {
|
|
38751
38761
|
coerceTypedAnswer,
|
|
38752
38762
|
coercionLabel,
|
|
@@ -38813,8 +38823,8 @@ function CaptureRun({ sheetId, face: given, className }) {
|
|
|
38813
38823
|
const [items, setItems] = useState115([]);
|
|
38814
38824
|
const [lastSynced, setLastSynced] = useState115(null);
|
|
38815
38825
|
const [sending, setSending] = useState115(false);
|
|
38816
|
-
const queueRef =
|
|
38817
|
-
|
|
38826
|
+
const queueRef = useRef49(null);
|
|
38827
|
+
useEffect103(() => {
|
|
38818
38828
|
const q2 = openCaptureQueue({
|
|
38819
38829
|
onChange: (c, all) => {
|
|
38820
38830
|
setCounts(c);
|
|
@@ -38852,7 +38862,7 @@ function CaptureRun({ sheetId, face: given, className }) {
|
|
|
38852
38862
|
void q2.sync().then(() => void q2.lastSyncedAt().then(setLastSynced));
|
|
38853
38863
|
return () => q2.dispose();
|
|
38854
38864
|
}, [client, host]);
|
|
38855
|
-
|
|
38865
|
+
useEffect103(() => {
|
|
38856
38866
|
if (given !== void 0) return;
|
|
38857
38867
|
let cancelled = false;
|
|
38858
38868
|
void client.captureOpen({ sheet_id: sheetId }).then((res) => {
|
|
@@ -39210,7 +39220,7 @@ function AdHocCaptureSheet({
|
|
|
39210
39220
|
const [error, setError] = useState116(null);
|
|
39211
39221
|
const [uploadError, setUploadError] = useState116(null);
|
|
39212
39222
|
const [flushing, setFlushing] = useState116(false);
|
|
39213
|
-
const queue =
|
|
39223
|
+
const queue = useRef50([]);
|
|
39214
39224
|
const keep = useCallback58(
|
|
39215
39225
|
async (next) => {
|
|
39216
39226
|
queue.current = next;
|
|
@@ -39219,7 +39229,7 @@ function AdHocCaptureSheet({
|
|
|
39219
39229
|
},
|
|
39220
39230
|
[host]
|
|
39221
39231
|
);
|
|
39222
|
-
|
|
39232
|
+
useEffect104(() => {
|
|
39223
39233
|
let cancelled = false;
|
|
39224
39234
|
void (async () => {
|
|
39225
39235
|
const held = host.captureQueue ? await host.captureQueue.load() : [];
|
|
@@ -39398,7 +39408,7 @@ function AdHocCaptureSheet({
|
|
|
39398
39408
|
}
|
|
39399
39409
|
|
|
39400
39410
|
// src/PortalShell.tsx
|
|
39401
|
-
import { useCallback as useCallback59, useEffect as
|
|
39411
|
+
import { useCallback as useCallback59, useEffect as useEffect105, useState as useState117 } from "react";
|
|
39402
39412
|
import { useRecordsClient as useRecordsClient95 } from "@ai-matrx/records/react";
|
|
39403
39413
|
import { Button as Button99, Skeleton as Skeleton47, cn as cn67 } from "@ai-matrx/design-system";
|
|
39404
39414
|
import { jsx as jsx129, jsxs as jsxs120 } from "react/jsx-runtime";
|
|
@@ -39424,7 +39434,7 @@ function PortalShell({ tableId, form, resourceType = "record", className }) {
|
|
|
39424
39434
|
}
|
|
39425
39435
|
setReach(reached.data.map((row) => row.resource_id));
|
|
39426
39436
|
}, [client, resourceType]);
|
|
39427
|
-
|
|
39437
|
+
useEffect105(() => {
|
|
39428
39438
|
void load();
|
|
39429
39439
|
}, [load]);
|
|
39430
39440
|
if (error) {
|
|
@@ -39484,7 +39494,7 @@ function PortalShell({ tableId, form, resourceType = "record", className }) {
|
|
|
39484
39494
|
function PortalRow({ tableId, recordId }) {
|
|
39485
39495
|
const client = useRecordsClient95();
|
|
39486
39496
|
const [title, setTitle] = useState117(null);
|
|
39487
|
-
|
|
39497
|
+
useEffect105(() => {
|
|
39488
39498
|
let cancelled = false;
|
|
39489
39499
|
void client.recordRead({ record_id: recordId }).then((answered) => {
|
|
39490
39500
|
if (cancelled) return;
|
|
@@ -39504,7 +39514,7 @@ function PortalRow({ tableId, recordId }) {
|
|
|
39504
39514
|
}
|
|
39505
39515
|
|
|
39506
39516
|
// src/PublicViewPage.tsx
|
|
39507
|
-
import { useCallback as useCallback60, useEffect as
|
|
39517
|
+
import { useCallback as useCallback60, useEffect as useEffect106, useState as useState118 } from "react";
|
|
39508
39518
|
import { useRecordsClient as useRecordsClient96 } from "@ai-matrx/records/react";
|
|
39509
39519
|
import { Skeleton as Skeleton48, cn as cn68 } from "@ai-matrx/design-system";
|
|
39510
39520
|
import { publicReadOf } from "@ai-matrx/records/forms";
|
|
@@ -39567,7 +39577,7 @@ function PublicViewPage({ slug, className }) {
|
|
|
39567
39577
|
}
|
|
39568
39578
|
setRows([{ id: chosen.recordId, document: read.data.document, level: "viewer", hidden: read.data.hidden }]);
|
|
39569
39579
|
}, [client, slug]);
|
|
39570
|
-
|
|
39580
|
+
useEffect106(() => {
|
|
39571
39581
|
void load();
|
|
39572
39582
|
}, [load]);
|
|
39573
39583
|
if (error) return /* @__PURE__ */ jsx130(RefusalNotice, { error, className });
|
|
@@ -39605,7 +39615,7 @@ function PublicRow({ row, fields }) {
|
|
|
39605
39615
|
|
|
39606
39616
|
// src/EmbedFrame.tsx
|
|
39607
39617
|
import { copyText as copyText9 } from "@ai-matrx/kit/clipboard";
|
|
39608
|
-
import { useCallback as useCallback61, useEffect as
|
|
39618
|
+
import { useCallback as useCallback61, useEffect as useEffect107, useState as useState119 } from "react";
|
|
39609
39619
|
import { useRecordsClient as useRecordsClient97 } from "@ai-matrx/records/react";
|
|
39610
39620
|
import { Button as Button100, Input as Input9, Skeleton as Skeleton49, Textarea as Textarea7, cn as cn69 } from "@ai-matrx/design-system";
|
|
39611
39621
|
import { useTable as useTable38 } from "@ai-matrx/records/react";
|
|
@@ -39718,7 +39728,7 @@ function useEmbedHandshake(args) {
|
|
|
39718
39728
|
const [loading, setLoading] = useState119(true);
|
|
39719
39729
|
const origin = args.origin ?? (typeof location === "undefined" ? "" : location.origin);
|
|
39720
39730
|
const { secret, requiredMode } = args;
|
|
39721
|
-
|
|
39731
|
+
useEffect107(() => {
|
|
39722
39732
|
let cancelled = false;
|
|
39723
39733
|
setLoading(true);
|
|
39724
39734
|
setError(null);
|
|
@@ -39741,7 +39751,7 @@ function useEmbedHandshake(args) {
|
|
|
39741
39751
|
|
|
39742
39752
|
// src/TablePage.tsx
|
|
39743
39753
|
import { copyText as copyText13 } from "@ai-matrx/kit/clipboard";
|
|
39744
|
-
import { useCallback as useCallback63, useEffect as
|
|
39754
|
+
import { useCallback as useCallback63, useEffect as useEffect112, useMemo as useMemo73, useRef as useRef52, useState as useState128 } from "react";
|
|
39745
39755
|
import { archivedByLine as archivedByLine2 } from "@ai-matrx/records";
|
|
39746
39756
|
import { tableShapeChanged as tableShapeChanged14, useFields as useFields34, useRecordsClient as useRecordsClient99, useSeededAnswer, useTable as useTable39, useTableArchive as useTableArchive2 } from "@ai-matrx/records/react";
|
|
39747
39757
|
import {
|
|
@@ -39998,7 +40008,7 @@ async function runTablePageAction(kind2, args) {
|
|
|
39998
40008
|
}
|
|
39999
40009
|
|
|
40000
40010
|
// src/GridShortcutsHelp.tsx
|
|
40001
|
-
import { useEffect as
|
|
40011
|
+
import { useEffect as useEffect108, useState as useState121 } from "react";
|
|
40002
40012
|
import { Dialog as Dialog19, DialogContent as DialogContent19, DialogHeader as DialogHeader19, DialogTitle as DialogTitle19 } from "@ai-matrx/design-system";
|
|
40003
40013
|
|
|
40004
40014
|
// src/gridShortcuts.ts
|
|
@@ -40068,7 +40078,7 @@ function asksShortcutHelp(event) {
|
|
|
40068
40078
|
}
|
|
40069
40079
|
function GridShortcutsHelp() {
|
|
40070
40080
|
const [open, setOpen] = useState121(false);
|
|
40071
|
-
|
|
40081
|
+
useEffect108(() => {
|
|
40072
40082
|
const onKey = (event) => {
|
|
40073
40083
|
if (!asksShortcutHelp(event)) return;
|
|
40074
40084
|
event.preventDefault();
|
|
@@ -40326,7 +40336,7 @@ function TableDuplicateDialog({ tableId, name, organizationId, open, onOpenChang
|
|
|
40326
40336
|
}
|
|
40327
40337
|
|
|
40328
40338
|
// src/ViewFilter.tsx
|
|
40329
|
-
import { useEffect as
|
|
40339
|
+
import { useEffect as useEffect109, useMemo as useMemo71, useState as useState125 } from "react";
|
|
40330
40340
|
import { Button as Button105, Popover as Popover13, PopoverContent as PopoverContent13, PopoverTrigger as PopoverTrigger13 } from "@ai-matrx/design-system";
|
|
40331
40341
|
import { useFields as useFields33, useOptionalRecordsClient as useOptionalRecordsClient10 } from "@ai-matrx/records/react";
|
|
40332
40342
|
import { jsx as jsx137, jsxs as jsxs128 } from "react/jsx-runtime";
|
|
@@ -40344,7 +40354,7 @@ function ViewFilter({ tableId, view, onApply, withheldKeys, className }) {
|
|
|
40344
40354
|
const saved = view?.where ?? null;
|
|
40345
40355
|
const [draft, setDraft] = useState125(saved);
|
|
40346
40356
|
const savedKey = JSON.stringify(saved);
|
|
40347
|
-
|
|
40357
|
+
useEffect109(() => {
|
|
40348
40358
|
setDraft(saved);
|
|
40349
40359
|
}, [view?.id, savedKey]);
|
|
40350
40360
|
const client = useOptionalRecordsClient10();
|
|
@@ -40353,7 +40363,7 @@ function ViewFilter({ tableId, view, onApply, withheldKeys, className }) {
|
|
|
40353
40363
|
[fields.data]
|
|
40354
40364
|
);
|
|
40355
40365
|
const [linkedFields, setLinkedFields] = useState125({});
|
|
40356
|
-
|
|
40366
|
+
useEffect109(() => {
|
|
40357
40367
|
if (!open || !client) return;
|
|
40358
40368
|
let cancelled = false;
|
|
40359
40369
|
for (const rel of relations) {
|
|
@@ -40550,7 +40560,7 @@ function phoneTableActions(actions) {
|
|
|
40550
40560
|
}
|
|
40551
40561
|
|
|
40552
40562
|
// src/presence.tsx
|
|
40553
|
-
import { useEffect as
|
|
40563
|
+
import { useEffect as useEffect110, useMemo as useMemo72, useRef as useRef51, useState as useState126, useSyncExternalStore as useSyncExternalStore4 } from "react";
|
|
40554
40564
|
import { jsx as jsx139, jsxs as jsxs130 } from "react/jsx-runtime";
|
|
40555
40565
|
var NO_PEOPLE = [];
|
|
40556
40566
|
var MAX_AVATARS = 4;
|
|
@@ -40558,7 +40568,7 @@ var SAFE = /^[A-Za-z0-9_.:\-]+$/;
|
|
|
40558
40568
|
function useTablePresence(tableId) {
|
|
40559
40569
|
const port = useRecordsUi().presence;
|
|
40560
40570
|
const [session, setSession] = useState126(null);
|
|
40561
|
-
|
|
40571
|
+
useEffect110(() => {
|
|
40562
40572
|
if (!port) {
|
|
40563
40573
|
setSession(null);
|
|
40564
40574
|
return;
|
|
@@ -40597,9 +40607,9 @@ function TablePresence({ tableId }) {
|
|
|
40597
40607
|
const { session, people: published } = useTablePresence(tableId);
|
|
40598
40608
|
const roster = useMemberRoster();
|
|
40599
40609
|
const people = useMemo72(() => namePeople(published, roster), [published, roster]);
|
|
40600
|
-
const root =
|
|
40610
|
+
const root = useRef51(null);
|
|
40601
40611
|
const css = useMemo72(() => presenceOutlineCss(people), [people]);
|
|
40602
|
-
|
|
40612
|
+
useEffect110(() => {
|
|
40603
40613
|
if (!session || typeof MutationObserver === "undefined") return;
|
|
40604
40614
|
const scope = document.body;
|
|
40605
40615
|
const read = () => {
|
|
@@ -40637,7 +40647,7 @@ function TablePresence({ tableId }) {
|
|
|
40637
40647
|
}
|
|
40638
40648
|
|
|
40639
40649
|
// src/toolbarFit.ts
|
|
40640
|
-
import { useEffect as
|
|
40650
|
+
import { useEffect as useEffect111, useLayoutEffect as useLayoutEffect5, useState as useState127 } from "react";
|
|
40641
40651
|
import { flushSync } from "react-dom";
|
|
40642
40652
|
function widthAtFold(piece, fold) {
|
|
40643
40653
|
for (let f = Math.min(fold, (piece.byFold?.length ?? 0) - 1); f >= 0; f -= 1) {
|
|
@@ -40729,7 +40739,7 @@ function createFitMemory() {
|
|
|
40729
40739
|
}
|
|
40730
40740
|
};
|
|
40731
40741
|
}
|
|
40732
|
-
var useIsoLayoutEffect = typeof window === "undefined" ?
|
|
40742
|
+
var useIsoLayoutEffect = typeof window === "undefined" ? useEffect111 : useLayoutEffect5;
|
|
40733
40743
|
function useToolbarFit(row) {
|
|
40734
40744
|
const [fold, setFold] = useState127(0);
|
|
40735
40745
|
useIsoLayoutEffect(() => {
|
|
@@ -40808,7 +40818,7 @@ function clippedEnds(scrollLeft, clientWidth, scrollWidth) {
|
|
|
40808
40818
|
}
|
|
40809
40819
|
function useSlotScroll(slot) {
|
|
40810
40820
|
const [ends, setEnds] = useState127("none");
|
|
40811
|
-
|
|
40821
|
+
useEffect111(() => {
|
|
40812
40822
|
if (!slot) return;
|
|
40813
40823
|
let pending = 0;
|
|
40814
40824
|
const read = () => {
|
|
@@ -40968,7 +40978,7 @@ function TableNotHere({
|
|
|
40968
40978
|
const [archived, setArchived] = useState128({ phase: "asking" });
|
|
40969
40979
|
const [restoring, setRestoring] = useState128(false);
|
|
40970
40980
|
const [refusal3, setRefusal] = useState128(null);
|
|
40971
|
-
|
|
40981
|
+
useEffect112(() => {
|
|
40972
40982
|
let alive = true;
|
|
40973
40983
|
void client.tableArchived({ table_id: tableId }).then((answered) => {
|
|
40974
40984
|
if (!alive) return;
|
|
@@ -41197,8 +41207,8 @@ function TablePage({
|
|
|
41197
41207
|
return seededViews.find((v) => v.id === asked2) ?? defaultViewOf(seededViews) ?? seededViews[0];
|
|
41198
41208
|
});
|
|
41199
41209
|
const [looks, setLooks] = useState128(() => seededViews ? seededOpening?.looks : void 0);
|
|
41200
|
-
const looksSeededFor =
|
|
41201
|
-
|
|
41210
|
+
const looksSeededFor = useRef52(seededViews && seededOpening ? tableId : null);
|
|
41211
|
+
useEffect112(() => {
|
|
41202
41212
|
if (looksSeededFor.current === tableId) {
|
|
41203
41213
|
looksSeededFor.current = null;
|
|
41204
41214
|
return;
|
|
@@ -41225,7 +41235,7 @@ function TablePage({
|
|
|
41225
41235
|
const opened = questionsFromLink ? { ...openedByPackage, main: "questions" } : formFromLink ? { ...openedByPackage, main: "form" } : openedByPackage;
|
|
41226
41236
|
const [views, setViews] = useState128(() => seededViews);
|
|
41227
41237
|
const [pickedViewId, setPickedViewId] = useState128(savedFromLink);
|
|
41228
|
-
const viewSeen =
|
|
41238
|
+
const viewSeen = useRef52(null);
|
|
41229
41239
|
const [viewLinkMissed, setViewLinkMissed] = useState128(false);
|
|
41230
41240
|
const railAsked = typeof activeRail === "string" ? activeRail.trim() : "";
|
|
41231
41241
|
const railUnknown = railAsked !== "" && railFromParam(railAsked) === null ? railAsked : null;
|
|
@@ -41255,7 +41265,7 @@ function TablePage({
|
|
|
41255
41265
|
const { open: renameOpen, setOpen: setRenameOpen, ask: askRename, menuContentProps: renameMenuProps } = useRenameFromMenu();
|
|
41256
41266
|
const [archiveAsked, setArchiveAsked] = useState128(0);
|
|
41257
41267
|
const pageArchive = useTableArchive2(tableId);
|
|
41258
|
-
const archiveRunning =
|
|
41268
|
+
const archiveRunning = useRef52(false);
|
|
41259
41269
|
const archiveFromMenu = useCallback63(async () => {
|
|
41260
41270
|
if (archiveRunning.current) return;
|
|
41261
41271
|
archiveRunning.current = true;
|
|
@@ -41332,7 +41342,7 @@ function TablePage({
|
|
|
41332
41342
|
const skeletonFace = skeletonLayoutFor(
|
|
41333
41343
|
faceUnknown && !layoutFromLink ? rememberedFace ?? shownLayout : shownLayout
|
|
41334
41344
|
);
|
|
41335
|
-
|
|
41345
|
+
useEffect112(() => {
|
|
41336
41346
|
if (embedded || faceUnknown || main !== "records" || opened.layout || !table.data) return;
|
|
41337
41347
|
rememberLayout(tableId, shownLayout);
|
|
41338
41348
|
}, [embedded, faceUnknown, main, shownLayout, tableId, table.data !== void 0]);
|
|
@@ -41350,9 +41360,9 @@ function TablePage({
|
|
|
41350
41360
|
lookDiffers: view ? lookDiffers(view, look) : false
|
|
41351
41361
|
};
|
|
41352
41362
|
const shownSignature = JSON.stringify(shownReport);
|
|
41353
|
-
const reportRef =
|
|
41363
|
+
const reportRef = useRef52(onShownViewChange);
|
|
41354
41364
|
reportRef.current = onShownViewChange;
|
|
41355
|
-
|
|
41365
|
+
useEffect112(() => {
|
|
41356
41366
|
reportRef.current?.(JSON.parse(shownSignature));
|
|
41357
41367
|
}, [shownSignature]);
|
|
41358
41368
|
const pickLayout = (next) => {
|
|
@@ -41361,9 +41371,9 @@ function TablePage({
|
|
|
41361
41371
|
onViewChanged?.(addressForView(view, next));
|
|
41362
41372
|
void patchView({ layout: next });
|
|
41363
41373
|
};
|
|
41364
|
-
const reportedRecords =
|
|
41365
|
-
const lastActiveRecord =
|
|
41366
|
-
|
|
41374
|
+
const reportedRecords = useRef52(/* @__PURE__ */ new Set());
|
|
41375
|
+
const lastActiveRecord = useRef52(activeRecordId ?? null);
|
|
41376
|
+
useEffect112(() => {
|
|
41367
41377
|
const before = lastActiveRecord.current;
|
|
41368
41378
|
lastActiveRecord.current = activeRecordId ?? null;
|
|
41369
41379
|
if (!activeRecordId) {
|
|
@@ -41382,25 +41392,25 @@ function TablePage({
|
|
|
41382
41392
|
);
|
|
41383
41393
|
const [recordExpanded, setRecordExpanded] = useState128(false);
|
|
41384
41394
|
const [recordFull, setRecordFull] = useState128(false);
|
|
41385
|
-
|
|
41395
|
+
useEffect112(() => {
|
|
41386
41396
|
if (rail !== "record") setRecordFull(false);
|
|
41387
41397
|
}, [rail]);
|
|
41388
41398
|
const shownRecord = rail === "record" ? openRecord : null;
|
|
41389
|
-
const reportedRecord =
|
|
41390
|
-
|
|
41399
|
+
const reportedRecord = useRef52(activeRecordId ?? null);
|
|
41400
|
+
useEffect112(() => {
|
|
41391
41401
|
if (shownRecord === reportedRecord.current) return;
|
|
41392
41402
|
const how = shownRecord === null ? "close" : reportedRecord.current === null ? "open" : "step";
|
|
41393
41403
|
reportedRecord.current = shownRecord;
|
|
41394
41404
|
if (shownRecord) reportedRecords.current.add(shownRecord);
|
|
41395
41405
|
onRecordChange?.(shownRecord, how);
|
|
41396
41406
|
}, [shownRecord, onRecordChange]);
|
|
41397
|
-
|
|
41407
|
+
useEffect112(() => {
|
|
41398
41408
|
if (activeRecordId) return;
|
|
41399
41409
|
const named = railFromParam(activeRail);
|
|
41400
41410
|
if (named === null || named === "share") return;
|
|
41401
41411
|
setSurface((now) => ({ ...now, rail: named }));
|
|
41402
41412
|
}, [activeRail, activeRecordId]);
|
|
41403
|
-
|
|
41413
|
+
useEffect112(() => {
|
|
41404
41414
|
if (formFromParam(activeView)) {
|
|
41405
41415
|
setSurface((now) => ({ ...now, main: "form" }));
|
|
41406
41416
|
return;
|
|
@@ -41445,7 +41455,7 @@ function TablePage({
|
|
|
41445
41455
|
},
|
|
41446
41456
|
[client, tableId, view, looks, viewLocked, sayLocked]
|
|
41447
41457
|
);
|
|
41448
|
-
const arrival =
|
|
41458
|
+
const arrival = useRef52(viewAddress ?? null);
|
|
41449
41459
|
const [gridQuery, setGridQuery] = useState128(null);
|
|
41450
41460
|
const [addressResetEpoch, setAddressResetEpoch] = useState128(0);
|
|
41451
41461
|
const reportGrid = useCallback63((q) => {
|
|
@@ -41456,8 +41466,8 @@ function TablePage({
|
|
|
41456
41466
|
() => ({ initial: arrival.current, report: reportGrid, resetEpoch: addressResetEpoch }),
|
|
41457
41467
|
[reportGrid, addressResetEpoch]
|
|
41458
41468
|
);
|
|
41459
|
-
const hiddenApplied =
|
|
41460
|
-
|
|
41469
|
+
const hiddenApplied = useRef52(false);
|
|
41470
|
+
useEffect112(() => {
|
|
41461
41471
|
const hidden = arrival.current?.hidden;
|
|
41462
41472
|
if (hiddenApplied.current || !view || !looks || !hidden || hidden.length === 0) return;
|
|
41463
41473
|
hiddenApplied.current = true;
|
|
@@ -41477,10 +41487,10 @@ function TablePage({
|
|
|
41477
41487
|
const gridPending = !isViewAddressEmpty({ ...arrival.current ?? {}, hidden: [] });
|
|
41478
41488
|
const addressReady = Boolean(view && looks) && (gridQuery !== null || !gridPending);
|
|
41479
41489
|
const addressSignature = JSON.stringify(viewAddressToParams(addressNow));
|
|
41480
|
-
const addressReportRef =
|
|
41490
|
+
const addressReportRef = useRef52(onViewAddressChange);
|
|
41481
41491
|
addressReportRef.current = onViewAddressChange;
|
|
41482
|
-
const addressSent =
|
|
41483
|
-
|
|
41492
|
+
const addressSent = useRef52(null);
|
|
41493
|
+
useEffect112(() => {
|
|
41484
41494
|
if (!addressReady) return;
|
|
41485
41495
|
if (addressSent.current === null && addressSignature === JSON.stringify(viewAddressToParams(arrival.current))) {
|
|
41486
41496
|
addressSent.current = addressSignature;
|
|
@@ -41807,14 +41817,14 @@ function TablePage({
|
|
|
41807
41817
|
}
|
|
41808
41818
|
});
|
|
41809
41819
|
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;
|
|
41810
|
-
const actionsRef =
|
|
41820
|
+
const actionsRef = useRef52(actions);
|
|
41811
41821
|
actionsRef.current = actions;
|
|
41812
|
-
const onActionsRef =
|
|
41822
|
+
const onActionsRef = useRef52(onActions);
|
|
41813
41823
|
onActionsRef.current = onActions;
|
|
41814
|
-
|
|
41824
|
+
useEffect112(() => {
|
|
41815
41825
|
onActionsRef.current?.(actionsRef.current);
|
|
41816
41826
|
});
|
|
41817
|
-
|
|
41827
|
+
useEffect112(() => {
|
|
41818
41828
|
const onKey = (event) => {
|
|
41819
41829
|
const asked2 = objectActionForKey(actionsRef.current, event);
|
|
41820
41830
|
if (!asked2) return;
|
|
@@ -42420,7 +42430,7 @@ function usePublicReadOnly(client, organizationId, tableId, table, rights) {
|
|
|
42420
42430
|
const [isPublic, setIsPublic] = useState128(false);
|
|
42421
42431
|
const reads = useReadRefusal("table_facts");
|
|
42422
42432
|
const [attempt, again] = useReadAgain();
|
|
42423
|
-
|
|
42433
|
+
useEffect112(() => {
|
|
42424
42434
|
if (!readOnly || !table) {
|
|
42425
42435
|
setIsPublic(false);
|
|
42426
42436
|
return;
|
|
@@ -42447,7 +42457,7 @@ function usePublicReadOnly(client, organizationId, tableId, table, rights) {
|
|
|
42447
42457
|
import { formatCount as formatCount10 } from "@ai-matrx/kit/format";
|
|
42448
42458
|
import { TapTargetSearchGroup as TapTargetSearchGroup2, TooltipProvider } from "@ai-matrx/design-system";
|
|
42449
42459
|
import { MatrxTableCardShowMore as MatrxTableCardShowMore3 } from "@ai-matrx/design-system/data-table";
|
|
42450
|
-
import { useEffect as
|
|
42460
|
+
import { useEffect as useEffect113, useMemo as useMemo74, useRef as useRef53, useState as useState129 } from "react";
|
|
42451
42461
|
import { Button as Button107, ErrorBox as ErrorBox5, Input as Input12, cn as cn72 } from "@ai-matrx/design-system";
|
|
42452
42462
|
import { SEED_FRESH_MS, useRecordsClient as useRecordsClient100, useSeededAnswerAt } from "@ai-matrx/records/react";
|
|
42453
42463
|
import { Fragment as Fragment58, jsx as jsx141, jsxs as jsxs132 } from "react/jsx-runtime";
|
|
@@ -42555,8 +42565,8 @@ function EntityChartBlock({ source, kind: kind2, by, measure, title, where, orga
|
|
|
42555
42565
|
const base = { title: title ?? "", kind: kind2, measures, group_by: by ? [by] : [] };
|
|
42556
42566
|
const seeded = useSeededAnswerAt(`entity-chart:${ask2}`, (c) => c.drillAsk({ source, question }));
|
|
42557
42567
|
const [block, setBlock] = useState129(() => seeded ? blockOfAnswer({ ok: true, data: seeded.data }, base, by) : null);
|
|
42558
|
-
const seededFor =
|
|
42559
|
-
|
|
42568
|
+
const seededFor = useRef53(seeded ? { ask: `${ask2}|${kind2}|${title ?? ""}`, at: seeded.at } : null);
|
|
42569
|
+
useEffect113(() => {
|
|
42560
42570
|
const held = seededFor.current;
|
|
42561
42571
|
if (held && held.ask === `${ask2}|${kind2}|${title ?? ""}` && Date.now() - held.at < SEED_FRESH_MS) return;
|
|
42562
42572
|
seededFor.current = null;
|
|
@@ -42605,7 +42615,7 @@ function EntityTablePageBody({
|
|
|
42605
42615
|
const term = searchOverride ?? typed2;
|
|
42606
42616
|
const entity = useEntitySourceTable(source.token, { pageSize, search: term });
|
|
42607
42617
|
const [layout, setLayout] = useState129(opened);
|
|
42608
|
-
|
|
42618
|
+
useEffect113(() => setLayout(opened), [opened]);
|
|
42609
42619
|
const choose = (next) => {
|
|
42610
42620
|
setLayout(next);
|
|
42611
42621
|
onLayoutChange?.(next);
|
|
@@ -42731,7 +42741,7 @@ function TablePage2(props) {
|
|
|
42731
42741
|
}
|
|
42732
42742
|
|
|
42733
42743
|
// src/CalendarLinks.tsx
|
|
42734
|
-
import { useCallback as useCallback64, useEffect as
|
|
42744
|
+
import { useCallback as useCallback64, useEffect as useEffect114, useState as useState130 } from "react";
|
|
42735
42745
|
import { asRefusal as asRefusal4 } from "@ai-matrx/records/versions";
|
|
42736
42746
|
import { Button as Button108 } from "@ai-matrx/design-system";
|
|
42737
42747
|
import { momentZoneOptions as momentZoneOptions7 } from "@ai-matrx/design-system/field-formats";
|
|
@@ -42749,7 +42759,7 @@ function CalendarLinks({ port }) {
|
|
|
42749
42759
|
setError(asRefusal4(e, "The links could not be read"));
|
|
42750
42760
|
}
|
|
42751
42761
|
}, [port]);
|
|
42752
|
-
|
|
42762
|
+
useEffect114(() => {
|
|
42753
42763
|
void load();
|
|
42754
42764
|
}, [load]);
|
|
42755
42765
|
const act = async (run) => {
|
|
@@ -42814,7 +42824,7 @@ function CalendarLinks({ port }) {
|
|
|
42814
42824
|
}
|
|
42815
42825
|
|
|
42816
42826
|
// src/TemplatePreview.tsx
|
|
42817
|
-
import { useEffect as
|
|
42827
|
+
import { useEffect as useEffect115, useMemo as useMemo75, useState as useState131 } from "react";
|
|
42818
42828
|
import { templatePreview } from "@ai-matrx/records/memory";
|
|
42819
42829
|
import { useRecordsClient as useRecordsClient101 } from "@ai-matrx/records/react";
|
|
42820
42830
|
import { formFromSummary as formFromSummary3 } from "@ai-matrx/records/forms";
|
|
@@ -42866,7 +42876,7 @@ function PreviewForms({ preview, booking }) {
|
|
|
42866
42876
|
const client = useRecordsClient101();
|
|
42867
42877
|
const [forms, setForms] = useState131(null);
|
|
42868
42878
|
const [pages, setPages] = useState131([]);
|
|
42869
|
-
|
|
42879
|
+
useEffect115(() => {
|
|
42870
42880
|
let gone = false;
|
|
42871
42881
|
void client.forms().then((answered) => {
|
|
42872
42882
|
if (!gone) setForms(answered.ok ? answered.data.map(formFromSummary3) : []);
|
|
@@ -42899,7 +42909,7 @@ function PreviewForms({ preview, booking }) {
|
|
|
42899
42909
|
}
|
|
42900
42910
|
|
|
42901
42911
|
// src/SectionCard.tsx
|
|
42902
|
-
import { useEffect as
|
|
42912
|
+
import { useEffect as useEffect116, useRef as useRef54, useState as useState133 } from "react";
|
|
42903
42913
|
import { atLeast } from "@ai-matrx/records/field-kinds";
|
|
42904
42914
|
import { useFields as useFields35, useRecordMutation as useRecordMutation3, useRecordPage as useRecordPage4, useRecordsClient as useRecordsClient102, useTable as useTable40 } from "@ai-matrx/records/react";
|
|
42905
42915
|
import {
|
|
@@ -43304,11 +43314,11 @@ function columnsOf(values) {
|
|
|
43304
43314
|
var same3 = (a, b) => JSON.stringify(a ?? null) === JSON.stringify(b ?? null);
|
|
43305
43315
|
function useDraft(stored, save) {
|
|
43306
43316
|
const [draft, setDraft] = useState133(null);
|
|
43307
|
-
const latest =
|
|
43308
|
-
|
|
43317
|
+
const latest = useRef54({ draft, save, stored });
|
|
43318
|
+
useEffect116(() => {
|
|
43309
43319
|
latest.current = { draft, save, stored };
|
|
43310
43320
|
});
|
|
43311
|
-
|
|
43321
|
+
useEffect116(() => {
|
|
43312
43322
|
if (!draft || draft.phase !== "typing") return;
|
|
43313
43323
|
const timer = setTimeout(() => {
|
|
43314
43324
|
const sending = draft.value;
|
|
@@ -43320,7 +43330,7 @@ function useDraft(stored, save) {
|
|
|
43320
43330
|
}, SAVE_AFTER_MS);
|
|
43321
43331
|
return () => clearTimeout(timer);
|
|
43322
43332
|
}, [draft]);
|
|
43323
|
-
|
|
43333
|
+
useEffect116(
|
|
43324
43334
|
() => () => {
|
|
43325
43335
|
const held = latest.current;
|
|
43326
43336
|
if (held.draft && held.draft.phase === "typing") void held.save(held.draft.value);
|
|
@@ -43652,7 +43662,7 @@ function SectionCard(props) {
|
|
|
43652
43662
|
var SECTION_NARROW_PX = 576;
|
|
43653
43663
|
function useNarrow2(ref) {
|
|
43654
43664
|
const [narrow, setNarrow] = useState133(false);
|
|
43655
|
-
|
|
43665
|
+
useEffect116(() => {
|
|
43656
43666
|
const el = ref.current;
|
|
43657
43667
|
if (!el || typeof ResizeObserver === "undefined") return;
|
|
43658
43668
|
const ro = new ResizeObserver(() => {
|
|
@@ -43698,7 +43708,7 @@ function TableSectionCard(props) {
|
|
|
43698
43708
|
const [counts, setCounts] = useState133({});
|
|
43699
43709
|
const [countsAsked, setCountsAsked] = useState133(0);
|
|
43700
43710
|
const idsKey = rows.map((r) => r.id).join(",");
|
|
43701
|
-
|
|
43711
|
+
useEffect116(() => {
|
|
43702
43712
|
if (idsKey === "") return;
|
|
43703
43713
|
let alive = true;
|
|
43704
43714
|
void client.commentCounts({ record_ids: idsKey.split(",") }).then((answered) => {
|
|
@@ -43711,7 +43721,7 @@ function TableSectionCard(props) {
|
|
|
43711
43721
|
const rowNames = nameField ? rows.map((r) => String((r.document ?? {})[nameField.key] ?? "")).filter((n) => n !== "") : [];
|
|
43712
43722
|
const refused = table.error ?? fieldsRead.error ?? page.error;
|
|
43713
43723
|
const gridStyle = { gridTemplateColumns: `minmax(8rem, 12rem) repeat(${Math.max(columns.length, 1)}, minmax(0, 1fr)) 4.5rem` };
|
|
43714
|
-
const sectionRef =
|
|
43724
|
+
const sectionRef = useRef54(null);
|
|
43715
43725
|
const narrow = useNarrow2(sectionRef);
|
|
43716
43726
|
const cellLabel = (c) => c.part ? columns.filter((x) => x.field.key === c.field.key).map((x) => x.header).join(" \xB7 ") : c.header;
|
|
43717
43727
|
return /* @__PURE__ */ jsxs136("section", { ref: sectionRef, "data-records-section-card": "", "data-narrow": narrow ? "" : void 0, className: cn74("rounded-2xl border border-border bg-card text-card-foreground", className), children: [
|