@ai-matrx/records-ui 0.115.61 → 0.115.62
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 +6 -0
- package/dist/index.cjs +10 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +313 -304
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -28384,7 +28384,7 @@ function ImportNotice({ tableId, onOpenImport, epoch = 0, className }) {
|
|
|
28384
28384
|
}
|
|
28385
28385
|
|
|
28386
28386
|
// src/SaveToTable.tsx
|
|
28387
|
-
import { useMemo as useMemo45, useState as useState80 } from "react";
|
|
28387
|
+
import { useEffect as useEffect63, useMemo as useMemo45, useRef as useRef40, useState as useState80 } from "react";
|
|
28388
28388
|
import { useRecordsClient as useRecordsClient53, useMyLevels as useMyLevels3, useTables as useTables3 } from "@ai-matrx/records/react";
|
|
28389
28389
|
import {
|
|
28390
28390
|
Button as Button60,
|
|
@@ -30558,7 +30558,7 @@ async function sha256Text(text) {
|
|
|
30558
30558
|
function typeWord2(t) {
|
|
30559
30559
|
return fieldTypeChoice(t)?.label ?? t;
|
|
30560
30560
|
}
|
|
30561
|
-
function SaveToTable({ source, shapeIndex = 0, onOpenTable, onSaved, onClose, className }) {
|
|
30561
|
+
function SaveToTable({ source, shapeIndex = 0, onOpenTable, onSaved, onClose, makeAtOnce = false, className }) {
|
|
30562
30562
|
const client = useRecordsClient53();
|
|
30563
30563
|
const shapes = useMemo45(() => shapesOfSource(source), [source]);
|
|
30564
30564
|
const [which, setWhich] = useState80(() => Math.min(Math.max(0, shapeIndex), Math.max(0, shapes.length - 1)));
|
|
@@ -30588,6 +30588,14 @@ function SaveToTable({ source, shapeIndex = 0, onOpenTable, onSaved, onClose, cl
|
|
|
30588
30588
|
const [phase, setPhase] = useState80("ready");
|
|
30589
30589
|
const [made, setMade] = useState80(null);
|
|
30590
30590
|
const sourceName = source.title?.trim() || shape?.name || "the rows above";
|
|
30591
|
+
const makeRef = useRef40(null);
|
|
30592
|
+
const madeAtOnce = useRef40(false);
|
|
30593
|
+
const tablesKnown = tables.data !== void 0;
|
|
30594
|
+
useEffect63(() => {
|
|
30595
|
+
if (!makeAtOnce || madeAtOnce.current || !shape || !tablesKnown || !makeRef.current) return;
|
|
30596
|
+
madeAtOnce.current = true;
|
|
30597
|
+
void makeRef.current();
|
|
30598
|
+
}, [makeAtOnce, shape, tablesKnown]);
|
|
30591
30599
|
const sourceText = useMemo45(() => JSON.stringify({ headers, rows }), [headers, rows]);
|
|
30592
30600
|
const wizardSource = useMemo45(
|
|
30593
30601
|
() => ({ name: sourceName, parsed: { headers, rows }, text: sourceText }),
|
|
@@ -30697,6 +30705,7 @@ function SaveToTable({ source, shapeIndex = 0, onOpenTable, onSaved, onClose, cl
|
|
|
30697
30705
|
setPhase("ready");
|
|
30698
30706
|
}
|
|
30699
30707
|
};
|
|
30708
|
+
makeRef.current = make;
|
|
30700
30709
|
const busy = phase === "making" || phase === "writing";
|
|
30701
30710
|
return /* @__PURE__ */ jsxs89("div", { className: cn48("flex min-w-0 flex-col gap-3 text-sm", className), "data-save-to-table": "", children: [
|
|
30702
30711
|
/* @__PURE__ */ jsxs89("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
@@ -30943,7 +30952,7 @@ function SaveToTable({ source, shapeIndex = 0, onOpenTable, onSaved, onClose, cl
|
|
|
30943
30952
|
}
|
|
30944
30953
|
|
|
30945
30954
|
// src/StageRules.tsx
|
|
30946
|
-
import { useCallback as useCallback34, useEffect as
|
|
30955
|
+
import { useCallback as useCallback34, useEffect as useEffect64, useMemo as useMemo46, useState as useState81 } from "react";
|
|
30947
30956
|
import { useFields as useFields16, useRecordsClient as useRecordsClient54, useTable as useTable14 } from "@ai-matrx/records/react";
|
|
30948
30957
|
import { BasicInput as BasicInput18, BasicTextarea as BasicTextarea8, Button as Button61, Separator as Separator7, Skeleton as Skeleton11, cn as cn49 } from "@ai-matrx/design-system";
|
|
30949
30958
|
import { jsx as jsx101, jsxs as jsxs90 } from "react/jsx-runtime";
|
|
@@ -30998,7 +31007,7 @@ function StageRulesSection({ tableId, stage, className }) {
|
|
|
30998
31007
|
if (mode.ok) setEnforcement(mode.data);
|
|
30999
31008
|
setAsked(true);
|
|
31000
31009
|
}, [client, tableId]);
|
|
31001
|
-
|
|
31010
|
+
useEffect64(() => {
|
|
31002
31011
|
void load();
|
|
31003
31012
|
}, [load]);
|
|
31004
31013
|
const stages = pipeline?.stages ?? [];
|
|
@@ -31009,7 +31018,7 @@ function StageRulesSection({ tableId, stage, className }) {
|
|
|
31009
31018
|
() => (fields.data ?? []).map((f) => ({ id: String(f.id), key: f.key, label: fieldName(f), field: f })),
|
|
31010
31019
|
[fields.data]
|
|
31011
31020
|
);
|
|
31012
|
-
|
|
31021
|
+
useEffect64(() => {
|
|
31013
31022
|
if (!draft || !stageKey || !draft.demands || Object.keys(draft.demands).length === 0) {
|
|
31014
31023
|
setPreview(null);
|
|
31015
31024
|
setPreviewError(null);
|
|
@@ -31231,7 +31240,7 @@ function Clause({
|
|
|
31231
31240
|
}
|
|
31232
31241
|
|
|
31233
31242
|
// src/TableRename.tsx
|
|
31234
|
-
import { useCallback as useCallback35, useEffect as
|
|
31243
|
+
import { useCallback as useCallback35, useEffect as useEffect65, useRef as useRef41, useState as useState82 } from "react";
|
|
31235
31244
|
import { tableShapeChanged as tableShapeChanged8, useRecordsClient as useRecordsClient55 } from "@ai-matrx/records/react";
|
|
31236
31245
|
import {
|
|
31237
31246
|
Button as Button62,
|
|
@@ -31253,7 +31262,7 @@ function tableNameProblem(typed2) {
|
|
|
31253
31262
|
}
|
|
31254
31263
|
function useRenameFromMenu() {
|
|
31255
31264
|
const [open, setOpen] = useState82(false);
|
|
31256
|
-
const asked3 =
|
|
31265
|
+
const asked3 = useRef41(false);
|
|
31257
31266
|
const ask2 = useCallback35(() => {
|
|
31258
31267
|
asked3.current = true;
|
|
31259
31268
|
window.setTimeout(() => setOpen(true), 0);
|
|
@@ -31279,9 +31288,9 @@ function TableRenameDialog({
|
|
|
31279
31288
|
const [typed2, setTyped] = useState82(name);
|
|
31280
31289
|
const [busy, setBusy] = useState82(false);
|
|
31281
31290
|
const [refused, setRefused] = useState82(null);
|
|
31282
|
-
const box =
|
|
31283
|
-
const openedAt =
|
|
31284
|
-
|
|
31291
|
+
const box = useRef41(null);
|
|
31292
|
+
const openedAt = useRef41(null);
|
|
31293
|
+
useEffect65(() => {
|
|
31285
31294
|
if (!open) return;
|
|
31286
31295
|
openedAt.current = (0, recordVersions_exports.readTableVersionNow)(client, tableId);
|
|
31287
31296
|
setTyped(name);
|
|
@@ -31372,7 +31381,7 @@ function TableRenameDialog({
|
|
|
31372
31381
|
}
|
|
31373
31382
|
|
|
31374
31383
|
// src/TableSettings.tsx
|
|
31375
|
-
import { useEffect as
|
|
31384
|
+
import { useEffect as useEffect70, useMemo as useMemo49, useRef as useRef42, useState as useState88 } from "react";
|
|
31376
31385
|
import { levelHasShownTo as levelHasShownTo2 } from "@ai-matrx/records";
|
|
31377
31386
|
|
|
31378
31387
|
// src/ArchiveDeliberately.tsx
|
|
@@ -31498,7 +31507,7 @@ function announceTableArchived({ notify, client, tableId, name, onRestored }) {
|
|
|
31498
31507
|
}
|
|
31499
31508
|
|
|
31500
31509
|
// src/TableFoundation.tsx
|
|
31501
|
-
import { useEffect as
|
|
31510
|
+
import { useEffect as useEffect66, useState as useState84 } from "react";
|
|
31502
31511
|
import { tableShapeChanged as tableShapeChanged9, useRecordsClient as useRecordsClient57 } from "@ai-matrx/records/react";
|
|
31503
31512
|
import { Switch as Switch3 } from "@ai-matrx/design-system";
|
|
31504
31513
|
import { jsx as jsx104, jsxs as jsxs93 } from "react/jsx-runtime";
|
|
@@ -31511,7 +31520,7 @@ function TableFoundationSwitch({ tableId, table }) {
|
|
|
31511
31520
|
const [pending, setPending] = useState84(null);
|
|
31512
31521
|
const [refused, setRefused] = useState84(null);
|
|
31513
31522
|
const on = pending ?? stored;
|
|
31514
|
-
|
|
31523
|
+
useEffect66(() => {
|
|
31515
31524
|
if (pending !== null && stored === pending) setPending(null);
|
|
31516
31525
|
}, [stored, pending]);
|
|
31517
31526
|
const change = async (next) => {
|
|
@@ -31549,7 +31558,7 @@ function TableFoundationSwitch({ tableId, table }) {
|
|
|
31549
31558
|
}
|
|
31550
31559
|
|
|
31551
31560
|
// src/TableAccessLevel.tsx
|
|
31552
|
-
import { useCallback as useCallback36, useEffect as
|
|
31561
|
+
import { useCallback as useCallback36, useEffect as useEffect67, useMemo as useMemo47, useState as useState85 } from "react";
|
|
31553
31562
|
import { tableShapeChanged as tableShapeChanged10, useRecordsClient as useRecordsClient58 } from "@ai-matrx/records/react";
|
|
31554
31563
|
import { Badge as Badge12, Button as Button64, Textarea as Textarea5, cn as cn50 } from "@ai-matrx/design-system";
|
|
31555
31564
|
import { Fragment as Fragment36, jsx as jsx105, jsxs as jsxs94 } from "react/jsx-runtime";
|
|
@@ -31580,7 +31589,7 @@ function TableAccessLevel({ tableId, fields }) {
|
|
|
31580
31589
|
setPicked(answer.data.readers.map((r) => r.field));
|
|
31581
31590
|
setReason("");
|
|
31582
31591
|
}, [client, tableId]);
|
|
31583
|
-
|
|
31592
|
+
useEffect67(() => {
|
|
31584
31593
|
void load();
|
|
31585
31594
|
}, [load]);
|
|
31586
31595
|
if (failed) return /* @__PURE__ */ jsx105("p", { className: "text-destructive", "data-table-access-level": "", children: failed });
|
|
@@ -31670,7 +31679,7 @@ function TableAccessLevel({ tableId, fields }) {
|
|
|
31670
31679
|
}
|
|
31671
31680
|
|
|
31672
31681
|
// src/RowControls.tsx
|
|
31673
|
-
import { useCallback as useCallback37, useEffect as
|
|
31682
|
+
import { useCallback as useCallback37, useEffect as useEffect68, useState as useState86 } from "react";
|
|
31674
31683
|
import {
|
|
31675
31684
|
isShownTo,
|
|
31676
31685
|
levelHasShownTo,
|
|
@@ -31730,7 +31739,7 @@ function NewRowsDefaults({ tableId }) {
|
|
|
31730
31739
|
setError(null);
|
|
31731
31740
|
} else setError(answer.error);
|
|
31732
31741
|
}, [client, tableId]);
|
|
31733
|
-
|
|
31742
|
+
useEffect68(() => {
|
|
31734
31743
|
void read();
|
|
31735
31744
|
}, [read]);
|
|
31736
31745
|
const set = async (patch) => {
|
|
@@ -31813,7 +31822,7 @@ function RowShownTo({ recordId, tableId }) {
|
|
|
31813
31822
|
setError(null);
|
|
31814
31823
|
} else setError(answer.error);
|
|
31815
31824
|
}, [client, recordId]);
|
|
31816
|
-
|
|
31825
|
+
useEffect68(() => {
|
|
31817
31826
|
setC(null);
|
|
31818
31827
|
void read();
|
|
31819
31828
|
}, [read]);
|
|
@@ -31849,7 +31858,7 @@ function RowShownTo({ recordId, tableId }) {
|
|
|
31849
31858
|
}
|
|
31850
31859
|
|
|
31851
31860
|
// src/ColumnsAtOnce.tsx
|
|
31852
|
-
import { useEffect as
|
|
31861
|
+
import { useEffect as useEffect69, useMemo as useMemo48, useState as useState87 } from "react";
|
|
31853
31862
|
import { useFieldMutation as useFieldMutation3 } from "@ai-matrx/records/react";
|
|
31854
31863
|
import { Badge as Badge13, BasicInput as BasicInput19, Button as Button66, Checkbox as Checkbox12, cn as cn51 } from "@ai-matrx/design-system";
|
|
31855
31864
|
import { jsx as jsx107, jsxs as jsxs96 } from "react/jsx-runtime";
|
|
@@ -31883,10 +31892,10 @@ function ColumnsAtOnce({
|
|
|
31883
31892
|
const shape = useFieldMutation3();
|
|
31884
31893
|
const savedSignature = JSON.stringify(rows.map((f) => [f.id, f.label, f.sort]));
|
|
31885
31894
|
const [draft, setDraft] = useState87(() => draftOf3(rows));
|
|
31886
|
-
|
|
31895
|
+
useEffect69(() => setDraft(draftOf3(rows)), [savedSignature]);
|
|
31887
31896
|
const hiddenSignature = JSON.stringify(look?.hidden ?? []);
|
|
31888
31897
|
const [hidden, setHidden] = useState87(() => [...look?.hidden ?? []]);
|
|
31889
|
-
|
|
31898
|
+
useEffect69(() => setHidden([...look?.hidden ?? []]), [hiddenSignature]);
|
|
31890
31899
|
const [dragging, setDragging] = useState87(null);
|
|
31891
31900
|
const [saving, setSaving] = useState87(false);
|
|
31892
31901
|
const byId = useMemo48(() => new Map(rows.map((f) => [f.id, f])), [rows]);
|
|
@@ -32036,9 +32045,9 @@ function TableSettings(props) {
|
|
|
32036
32045
|
const client = useRecordsClient60();
|
|
32037
32046
|
const table = useTable16(props.tableId);
|
|
32038
32047
|
const fields = useFields17(props.tableId);
|
|
32039
|
-
const now =
|
|
32048
|
+
const now = useRef42({ table: table.data ?? null, fields: fields.data ?? [] });
|
|
32040
32049
|
now.current = { table: table.data ?? null, fields: fields.data ?? [] };
|
|
32041
|
-
const slots =
|
|
32050
|
+
const slots = useRef42({ details: { current: null }, rowActions: { current: null } }).current;
|
|
32042
32051
|
const agent = useMemo49(
|
|
32043
32052
|
() => buildTableSettingsAgent(props.tableId, () => now.current, client, slots),
|
|
32044
32053
|
[props.tableId, client, slots]
|
|
@@ -32062,7 +32071,7 @@ function TableSettingsPanel({
|
|
|
32062
32071
|
const archive = useTableArchive(tableId);
|
|
32063
32072
|
const client = useRecordsClient60();
|
|
32064
32073
|
const ui = useRecordsUi();
|
|
32065
|
-
|
|
32074
|
+
useEffect70(() => {
|
|
32066
32075
|
let live = true;
|
|
32067
32076
|
void archive.preview().then((answer) => {
|
|
32068
32077
|
if (live && answer?.in_progress) setAskingToDelete(true);
|
|
@@ -32071,10 +32080,10 @@ function TableSettingsPanel({
|
|
|
32071
32080
|
live = false;
|
|
32072
32081
|
};
|
|
32073
32082
|
}, [tableId]);
|
|
32074
|
-
const askToArchiveRef =
|
|
32075
|
-
const archiveAskedSeen =
|
|
32083
|
+
const askToArchiveRef = useRef42(null);
|
|
32084
|
+
const archiveAskedSeen = useRef42(0);
|
|
32076
32085
|
const panelReady = Boolean(table.data && fields.data && rights.structure);
|
|
32077
|
-
|
|
32086
|
+
useEffect70(() => {
|
|
32078
32087
|
const ask2 = askToArchiveRef.current;
|
|
32079
32088
|
if (!panelReady || !ask2 || archiveAsked <= archiveAskedSeen.current) return;
|
|
32080
32089
|
archiveAskedSeen.current = archiveAsked;
|
|
@@ -32283,13 +32292,13 @@ function TableSettingsPanel({
|
|
|
32283
32292
|
}
|
|
32284
32293
|
|
|
32285
32294
|
// src/Peek.tsx
|
|
32286
|
-
import { useEffect as
|
|
32295
|
+
import { useEffect as useEffect74, useState as useState93 } from "react";
|
|
32287
32296
|
import { isLockedStub } from "@ai-matrx/records";
|
|
32288
32297
|
import { useFields as useFields19, useRecord as useRecord3, useRecordsClient as useRecordsClient65, useTable as useTable19 } from "@ai-matrx/records/react";
|
|
32289
32298
|
import { AlchemyMenu as AlchemyMenu2 } from "@ai-matrx/alchemy/react";
|
|
32290
32299
|
|
|
32291
32300
|
// src/RecordChat.tsx
|
|
32292
|
-
import { useEffect as
|
|
32301
|
+
import { useEffect as useEffect71, useMemo as useMemo50, useState as useState89 } from "react";
|
|
32293
32302
|
import { useRecordsClient as useRecordsClient61 } from "@ai-matrx/records/react";
|
|
32294
32303
|
import { Skeleton as Skeleton12, cn as cn53 } from "@ai-matrx/design-system";
|
|
32295
32304
|
import { jsx as jsx109, jsxs as jsxs98 } from "react/jsx-runtime";
|
|
@@ -32299,7 +32308,7 @@ function RecordChat({ tableId, recordId, className }) {
|
|
|
32299
32308
|
const host = useRecordsUi();
|
|
32300
32309
|
const [scope, setScope] = useState89(null);
|
|
32301
32310
|
const [error, setError] = useState89(null);
|
|
32302
|
-
|
|
32311
|
+
useEffect71(() => {
|
|
32303
32312
|
let cancelled = false;
|
|
32304
32313
|
setScope(null);
|
|
32305
32314
|
setError(null);
|
|
@@ -32416,7 +32425,7 @@ function entriesFor(scope) {
|
|
|
32416
32425
|
import { Button as Button71, Separator as Separator9, Skeleton as Skeleton14, cn as cn55 } from "@ai-matrx/design-system";
|
|
32417
32426
|
|
|
32418
32427
|
// src/recordInPlace.tsx
|
|
32419
|
-
import { useMemo as useMemo51, useRef as
|
|
32428
|
+
import { useMemo as useMemo51, useRef as useRef43 } from "react";
|
|
32420
32429
|
import { useRecordsClient as useRecordsClient62, useTable as useTable17 } from "@ai-matrx/records/react";
|
|
32421
32430
|
import { humanizeIdentifier as humanizeIdentifier11 } from "@ai-matrx/kit/text-case";
|
|
32422
32431
|
import { jsx as jsx110, jsxs as jsxs99 } from "react/jsx-runtime";
|
|
@@ -32440,7 +32449,7 @@ function RecordFieldsInPlace({
|
|
|
32440
32449
|
);
|
|
32441
32450
|
const rows = useMemo51(() => [row], [row]);
|
|
32442
32451
|
const versions = (0, recordVersions_exports.useRecordVersions)(client, rows);
|
|
32443
|
-
const pushWritten =
|
|
32452
|
+
const pushWritten = useRef43(null);
|
|
32444
32453
|
const editing = useGridEditing({
|
|
32445
32454
|
tableId,
|
|
32446
32455
|
fields,
|
|
@@ -32612,7 +32621,7 @@ function ValueAlternates({
|
|
|
32612
32621
|
|
|
32613
32622
|
// src/ShareControl.tsx
|
|
32614
32623
|
import { copyText as copyText6 } from "@ai-matrx/kit/clipboard";
|
|
32615
|
-
import { useEffect as
|
|
32624
|
+
import { useEffect as useEffect72, useState as useState91 } from "react";
|
|
32616
32625
|
import { Button as Button69, Popover as Popover14, PopoverContent as PopoverContent14, PopoverTrigger as PopoverTrigger14 } from "@ai-matrx/design-system";
|
|
32617
32626
|
import { Fragment as Fragment39, jsx as jsx112, jsxs as jsxs101 } from "react/jsx-runtime";
|
|
32618
32627
|
function useCanShare() {
|
|
@@ -32635,7 +32644,7 @@ function ShareControl({
|
|
|
32635
32644
|
}) {
|
|
32636
32645
|
const host = useRecordsUi();
|
|
32637
32646
|
const [open, setOpen] = useState91(initiallyOpen);
|
|
32638
|
-
|
|
32647
|
+
useEffect72(() => {
|
|
32639
32648
|
if (initiallyOpen) setOpen(true);
|
|
32640
32649
|
}, [initiallyOpen]);
|
|
32641
32650
|
const asked3 = useRecordRights(may === void 0 ? subjectId : null);
|
|
@@ -32699,7 +32708,7 @@ function ShareForSomebodyElse({
|
|
|
32699
32708
|
}
|
|
32700
32709
|
|
|
32701
32710
|
// src/RecordBody.tsx
|
|
32702
|
-
import { useEffect as
|
|
32711
|
+
import { useEffect as useEffect73, useRef as useRef44, useState as useState92 } from "react";
|
|
32703
32712
|
import { Button as Button70, cn as cn54 } from "@ai-matrx/design-system";
|
|
32704
32713
|
import { newerKindOf as newerKindOf6 } from "@ai-matrx/records";
|
|
32705
32714
|
import { tableShapeChanged as tableShapeChanged12, useFieldMutation as useFieldMutation5, useFields as useFields18, useRecord as useRecord2, useRecordsClient as useRecordsClient64, useTable as useTable18 } from "@ai-matrx/records/react";
|
|
@@ -32736,9 +32745,9 @@ function BodyEditor({ tableId, recordId, field: field2 }) {
|
|
|
32736
32745
|
const raw = record.data?.document?.[field2.key];
|
|
32737
32746
|
const stored = typeof raw === "string" ? raw : "";
|
|
32738
32747
|
const [saving, setSaving] = useState92({ phase: "idle" });
|
|
32739
|
-
const lastSaved =
|
|
32740
|
-
const waiting =
|
|
32741
|
-
const timer =
|
|
32748
|
+
const lastSaved = useRef44(null);
|
|
32749
|
+
const waiting = useRef44(null);
|
|
32750
|
+
const timer = useRef44(null);
|
|
32742
32751
|
if (lastSaved.current === null && record.data) lastSaved.current = stored;
|
|
32743
32752
|
const write = async () => {
|
|
32744
32753
|
if (timer.current) clearTimeout(timer.current);
|
|
@@ -32759,9 +32768,9 @@ function BodyEditor({ tableId, recordId, field: field2 }) {
|
|
|
32759
32768
|
setSaving({ phase: "refused", error: answered.error });
|
|
32760
32769
|
}
|
|
32761
32770
|
};
|
|
32762
|
-
const writeRef =
|
|
32771
|
+
const writeRef = useRef44(write);
|
|
32763
32772
|
writeRef.current = write;
|
|
32764
|
-
|
|
32773
|
+
useEffect73(
|
|
32765
32774
|
() => () => {
|
|
32766
32775
|
if (waiting.current !== null) void writeRef.current();
|
|
32767
32776
|
},
|
|
@@ -32824,7 +32833,7 @@ function Peek({ tableId, recordId, onClose, className, onPage = false }) {
|
|
|
32824
32833
|
const shownFieldCount = (fields.data ?? []).filter(
|
|
32825
32834
|
(field2) => !onPage || !drawnBelowOnPage(field2, onPage ? bodyFieldOf(fields.data ?? [])?.key : void 0)
|
|
32826
32835
|
).length;
|
|
32827
|
-
|
|
32836
|
+
useEffect74(() => {
|
|
32828
32837
|
if (fields.data) rememberRowCount(peekMemoryKey, shownFieldCount);
|
|
32829
32838
|
}, [fields.data, peekMemoryKey, shownFieldCount]);
|
|
32830
32839
|
if (record.error) return /* @__PURE__ */ jsx114(RefusalNotice, { error: record.error, className });
|
|
@@ -32963,7 +32972,7 @@ function computedInPlainWords(row, field2) {
|
|
|
32963
32972
|
}
|
|
32964
32973
|
|
|
32965
32974
|
// src/platformTable.ts
|
|
32966
|
-
import { useEffect as
|
|
32975
|
+
import { useEffect as useEffect75, useMemo as useMemo52, useState as useState94 } from "react";
|
|
32967
32976
|
import { useRecordsClient as useRecordsClient66 } from "@ai-matrx/records/react";
|
|
32968
32977
|
var inFlight = /* @__PURE__ */ new Map();
|
|
32969
32978
|
async function ensurePlatformTable(client, spec) {
|
|
@@ -33096,7 +33105,7 @@ function usePlatformTable(spec) {
|
|
|
33096
33105
|
const [state, setState] = useState94({ tableId: null, loading: true, error: null });
|
|
33097
33106
|
const slug = spec.slug;
|
|
33098
33107
|
const stable = useMemo52(() => spec, [slug]);
|
|
33099
|
-
|
|
33108
|
+
useEffect75(() => {
|
|
33100
33109
|
let cancelled = false;
|
|
33101
33110
|
setState({ tableId: null, loading: true, error: null });
|
|
33102
33111
|
void ensurePlatformTable(client, stable).then((result) => {
|
|
@@ -33143,7 +33152,7 @@ function lookAfterReset(look) {
|
|
|
33143
33152
|
}
|
|
33144
33153
|
|
|
33145
33154
|
// src/ViewSwitcher.tsx
|
|
33146
|
-
import { useEffect as
|
|
33155
|
+
import { useEffect as useEffect87, useMemo as useMemo62, useState as useState106 } from "react";
|
|
33147
33156
|
import { mayDrag as mayDrag4, useFields as useFields21, useRecordPage as useRecordPage2, useRecordsClient as useRecordsClient71, useTable as useTable21 } from "@ai-matrx/records/react";
|
|
33148
33157
|
import { isButtonField as isButtonField5, newerKindOf as newerKindOf7, stableFilterKey as stableFilterKey4 } from "@ai-matrx/records";
|
|
33149
33158
|
import { Button as Button77, Select as Select17, SelectContent as SelectContent17, SelectItem as SelectItem17, SelectTrigger as SelectTrigger17, SelectValue as SelectValue17, cn as cn62 } from "@ai-matrx/design-system";
|
|
@@ -33157,7 +33166,7 @@ import {
|
|
|
33157
33166
|
import { formatCount as formatCount6 } from "@ai-matrx/kit/format";
|
|
33158
33167
|
|
|
33159
33168
|
// src/recordMoves.tsx
|
|
33160
|
-
import { useCallback as useCallback38, useEffect as
|
|
33169
|
+
import { useCallback as useCallback38, useEffect as useEffect76, useMemo as useMemo53, useRef as useRef45, useState as useState95 } from "react";
|
|
33161
33170
|
import { useRecordsClient as useRecordsClient67 } from "@ai-matrx/records/react";
|
|
33162
33171
|
import { Button as Button72 } from "@ai-matrx/design-system";
|
|
33163
33172
|
import { Fragment as Fragment42, jsx as jsx115, jsxs as jsxs104 } from "react/jsx-runtime";
|
|
@@ -33282,9 +33291,9 @@ function useRecordMoves({
|
|
|
33282
33291
|
[client, undo, onMoved]
|
|
33283
33292
|
);
|
|
33284
33293
|
const offering = Boolean(undo.notice);
|
|
33285
|
-
const undoRef =
|
|
33294
|
+
const undoRef = useRef45(undo);
|
|
33286
33295
|
undoRef.current = undo;
|
|
33287
|
-
|
|
33296
|
+
useEffect76(() => {
|
|
33288
33297
|
if (!offering || typeof document === "undefined") return;
|
|
33289
33298
|
const onKey = (event) => {
|
|
33290
33299
|
const which = undoKey(event);
|
|
@@ -33350,7 +33359,7 @@ function MoveRefusedBadge({ refused }) {
|
|
|
33350
33359
|
}
|
|
33351
33360
|
|
|
33352
33361
|
// src/Pipeline.tsx
|
|
33353
|
-
import { useCallback as useCallback39, useEffect as
|
|
33362
|
+
import { useCallback as useCallback39, useEffect as useEffect77, useMemo as useMemo54, useRef as useRef46, useState as useState96 } from "react";
|
|
33354
33363
|
import {
|
|
33355
33364
|
mayDrag,
|
|
33356
33365
|
useFields as useFields20,
|
|
@@ -33463,14 +33472,14 @@ function PipelineBoard({
|
|
|
33463
33472
|
const [waiting, setWaiting] = useState96(/* @__PURE__ */ new Map());
|
|
33464
33473
|
const [dragging, setDragging] = useState96(null);
|
|
33465
33474
|
const [over, setOver] = useState96(null);
|
|
33466
|
-
const alive =
|
|
33475
|
+
const alive = useRef46(true);
|
|
33467
33476
|
const [selected, setSelected] = useState96(/* @__PURE__ */ new Set());
|
|
33468
|
-
const anchor =
|
|
33477
|
+
const anchor = useRef46(null);
|
|
33469
33478
|
const [batch, setBatch] = useState96(/* @__PURE__ */ new Map());
|
|
33470
33479
|
const [batchSaid, setBatchSaid] = useState96(null);
|
|
33471
33480
|
const [batchError, setBatchError] = useState96(null);
|
|
33472
33481
|
const [moving, setMoving] = useState96(false);
|
|
33473
|
-
|
|
33482
|
+
useEffect77(() => {
|
|
33474
33483
|
alive.current = true;
|
|
33475
33484
|
return () => {
|
|
33476
33485
|
alive.current = false;
|
|
@@ -33495,11 +33504,11 @@ function PipelineBoard({
|
|
|
33495
33504
|
setWaiting(held.ok ? new Map((held.data ?? []).map((p) => [p.record_id, p])) : /* @__PURE__ */ new Map());
|
|
33496
33505
|
setColumns(board.ok ? board.data ?? [] : []);
|
|
33497
33506
|
}, [client, tableId, measure, filterKey]);
|
|
33498
|
-
|
|
33507
|
+
useEffect77(() => {
|
|
33499
33508
|
void reload();
|
|
33500
33509
|
}, [reload]);
|
|
33501
33510
|
const versions = (0, recordVersions_exports.useRecordVersions)(client, rows, (r) => mayDrag(r.level));
|
|
33502
|
-
const versionsRef =
|
|
33511
|
+
const versionsRef = useRef46(versions);
|
|
33503
33512
|
versionsRef.current = versions;
|
|
33504
33513
|
const drawnVersion = (id) => versionsRef.current.seen(id);
|
|
33505
33514
|
const stageKey = definition?.stage_field ?? null;
|
|
@@ -34155,13 +34164,13 @@ function CardFieldsInline({ row, fields }) {
|
|
|
34155
34164
|
}
|
|
34156
34165
|
|
|
34157
34166
|
// src/CalendarView.tsx
|
|
34158
|
-
import { useEffect as
|
|
34167
|
+
import { useEffect as useEffect79, useMemo as useMemo56, useRef as useRef47, useState as useState98 } from "react";
|
|
34159
34168
|
import { mayDrag as mayDrag2 } from "@ai-matrx/records/react";
|
|
34160
34169
|
import { Button as Button74, Select as Select13, SelectContent as SelectContent13, SelectItem as SelectItem13, SelectTrigger as SelectTrigger13, SelectValue as SelectValue13, cn as cn57 } from "@ai-matrx/design-system";
|
|
34161
34170
|
import { CHOICE_CHIP_CLASS as CHOICE_CHIP_CLASS3 } from "@ai-matrx/design-system/data-table";
|
|
34162
34171
|
|
|
34163
34172
|
// src/weekStart.ts
|
|
34164
|
-
import { useEffect as
|
|
34173
|
+
import { useEffect as useEffect78, useState as useState97 } from "react";
|
|
34165
34174
|
import { useOptionalRecordsClient as useOptionalRecordsClient14 } from "@ai-matrx/records/react";
|
|
34166
34175
|
var DAYS2 = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"];
|
|
34167
34176
|
function weekStartIndex(word) {
|
|
@@ -34183,7 +34192,7 @@ function ask(client) {
|
|
|
34183
34192
|
function useReaderWeekStart() {
|
|
34184
34193
|
const client = useOptionalRecordsClient14();
|
|
34185
34194
|
const [first, setFirst] = useState97(1);
|
|
34186
|
-
|
|
34195
|
+
useEffect78(() => {
|
|
34187
34196
|
if (!client) return;
|
|
34188
34197
|
let live = true;
|
|
34189
34198
|
void ask(client).then((n) => live && setFirst(n));
|
|
@@ -34470,7 +34479,7 @@ function useNarrow() {
|
|
|
34470
34479
|
const query = "(max-width: 639px)";
|
|
34471
34480
|
const read = () => typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia(query).matches;
|
|
34472
34481
|
const [narrow, setNarrow] = useState98(read);
|
|
34473
|
-
|
|
34482
|
+
useEffect79(() => {
|
|
34474
34483
|
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
|
|
34475
34484
|
const list = window.matchMedia(query);
|
|
34476
34485
|
const on = () => setNarrow(list.matches);
|
|
@@ -34541,9 +34550,9 @@ function CalendarView({
|
|
|
34541
34550
|
const colorKey = colorPick !== void 0 ? colorPick : style?.colorBy?.field ?? choiceFields[0]?.key ?? null;
|
|
34542
34551
|
const colorOf = useRowColorBy(all, colorKey, style);
|
|
34543
34552
|
const [placedOver, setPlacedOver] = useState98(() => /* @__PURE__ */ new Map());
|
|
34544
|
-
|
|
34553
|
+
useEffect79(() => setPlacedOver(/* @__PURE__ */ new Map()), [rows]);
|
|
34545
34554
|
const undoneCount = moves.undo.depth.forward;
|
|
34546
|
-
|
|
34555
|
+
useEffect79(() => {
|
|
34547
34556
|
if (undoneCount > 0) setPlacedOver(/* @__PURE__ */ new Map());
|
|
34548
34557
|
}, [undoneCount]);
|
|
34549
34558
|
const startOf = (row) => placedOver.has(row.id) ? placedOver.get(row.id).start : (row.document ?? {})[dateField.key];
|
|
@@ -34570,9 +34579,9 @@ function CalendarView({
|
|
|
34570
34579
|
}, [rows, dateField.key, endField?.key, placedOver, defaultMinutes]);
|
|
34571
34580
|
const titleOf = (row) => cardWords(row, titleField, labels).text;
|
|
34572
34581
|
const rowById = (id) => rows.find((r) => r.id === id);
|
|
34573
|
-
const frame =
|
|
34582
|
+
const frame = useRef47(null);
|
|
34574
34583
|
const [focusOn, setFocusOn] = useState98(null);
|
|
34575
|
-
|
|
34584
|
+
useEffect79(() => {
|
|
34576
34585
|
if (!focusOn) return;
|
|
34577
34586
|
const button = frame.current?.querySelector(`[data-calendar-card="${focusOn}"] button`);
|
|
34578
34587
|
button?.focus({ preventScroll: true });
|
|
@@ -34619,10 +34628,10 @@ function CalendarView({
|
|
|
34619
34628
|
const made = await moves.create({ tableId, data, label: `New record on ${where}` });
|
|
34620
34629
|
if (made) onOpenRecord?.(made);
|
|
34621
34630
|
};
|
|
34622
|
-
const grabOffset =
|
|
34631
|
+
const grabOffset = useRef47(0);
|
|
34623
34632
|
const [resizing, setResizing] = useState98(null);
|
|
34624
34633
|
const [ghost, setGhost] = useState98(null);
|
|
34625
|
-
|
|
34634
|
+
useEffect79(() => {
|
|
34626
34635
|
if (!ghost || typeof document === "undefined") return;
|
|
34627
34636
|
const clear = () => setGhost(null);
|
|
34628
34637
|
document.addEventListener("dragend", clear);
|
|
@@ -35169,13 +35178,13 @@ function WeekHours({
|
|
|
35169
35178
|
render,
|
|
35170
35179
|
overlay
|
|
35171
35180
|
}) {
|
|
35172
|
-
const frame =
|
|
35173
|
-
|
|
35181
|
+
const frame = useRef47(null);
|
|
35182
|
+
useEffect79(() => {
|
|
35174
35183
|
if (frame.current) frame.current.scrollTop = 7 * HOUR_PX;
|
|
35175
35184
|
}, []);
|
|
35176
35185
|
usePersonTimeZone();
|
|
35177
35186
|
const [now, setNow] = useState98(() => personWallNow());
|
|
35178
|
-
|
|
35187
|
+
useEffect79(() => {
|
|
35179
35188
|
const timer = setInterval(() => setNow(personWallNow()), 6e4);
|
|
35180
35189
|
return () => clearInterval(timer);
|
|
35181
35190
|
}, []);
|
|
@@ -35217,7 +35226,7 @@ function weekHeading(first) {
|
|
|
35217
35226
|
}
|
|
35218
35227
|
|
|
35219
35228
|
// src/TimelineView.tsx
|
|
35220
|
-
import { useEffect as
|
|
35229
|
+
import { useEffect as useEffect80, useMemo as useMemo57, useRef as useRef48, useState as useState99 } from "react";
|
|
35221
35230
|
import { mayDrag as mayDrag3 } from "@ai-matrx/records/react";
|
|
35222
35231
|
import { DropdownMenu as DropdownMenu8, DropdownMenuCheckboxItem as DropdownMenuCheckboxItem2, DropdownMenuContent as DropdownMenuContent8, DropdownMenuItem as DropdownMenuItem7, DropdownMenuRadioGroup as DropdownMenuRadioGroup2, DropdownMenuRadioItem as DropdownMenuRadioItem2, DropdownMenuSeparator as DropdownMenuSeparator4, DropdownMenuSub as DropdownMenuSub2, DropdownMenuSubContent as DropdownMenuSubContent2, DropdownMenuSubTrigger as DropdownMenuSubTrigger2, DropdownMenuTrigger as DropdownMenuTrigger8, Button as Button75, Select as Select14, SelectContent as SelectContent14, SelectItem as SelectItem14, SelectTrigger as SelectTrigger14, SelectValue as SelectValue14, cn as cn58 } from "@ai-matrx/design-system";
|
|
35223
35232
|
import { CHOICE_CHIP_CLASS as CHOICE_CHIP_CLASS4 } from "@ai-matrx/design-system/data-table";
|
|
@@ -35482,7 +35491,7 @@ function TimelineView({
|
|
|
35482
35491
|
const dates = useMemo57(() => offerableFields(fields, "date", { far: farFields }), [fields, farFields]);
|
|
35483
35492
|
const has = (list, key) => key && list.some((f) => f.key === key) ? key : null;
|
|
35484
35493
|
const [picked, setPicked] = useState99({});
|
|
35485
|
-
|
|
35494
|
+
useEffect80(() => setPicked({}), [startKey, endKey, groupKey, colorKey]);
|
|
35486
35495
|
const named = (key) => key && fields.some((f) => f.key === key) ? key : null;
|
|
35487
35496
|
const startChosen = "startKey" in picked ? picked.startKey ?? null : has(dates, startKey) ?? named(startKey) ?? onlyCandidate(dates);
|
|
35488
35497
|
const endCandidates = useMemo57(() => dates.filter((f) => f.key !== startChosen), [dates, startChosen]);
|
|
@@ -35503,7 +35512,7 @@ function TimelineView({
|
|
|
35503
35512
|
};
|
|
35504
35513
|
const [ganttPicked, setGanttPicked] = useState99({});
|
|
35505
35514
|
const ganttSaved = JSON.stringify(gantt ?? {});
|
|
35506
|
-
|
|
35515
|
+
useEffect80(() => setGanttPicked({}), [ganttSaved]);
|
|
35507
35516
|
const g = { ...gantt ?? {}, ...ganttPicked };
|
|
35508
35517
|
const ganttOn = g.mode === true;
|
|
35509
35518
|
const setGantt = (patch) => {
|
|
@@ -35527,7 +35536,7 @@ function TimelineView({
|
|
|
35527
35536
|
const milestoneCandidates = useMemo57(() => fields.filter((f) => String(editorKindFor(f)) === "checkbox" || String(editorKindFor(f)) === "boolean"), [fields]);
|
|
35528
35537
|
const knobClient = useOptionalRecordsClient15();
|
|
35529
35538
|
const [shiftDependents, setShiftDependents] = useState99(true);
|
|
35530
|
-
|
|
35539
|
+
useEffect80(() => {
|
|
35531
35540
|
if (!depField || !knobClient) return;
|
|
35532
35541
|
let live = true;
|
|
35533
35542
|
void knobClient.timelineDependencyShift().then((got) => {
|
|
@@ -35543,9 +35552,9 @@ function TimelineView({
|
|
|
35543
35552
|
const titleOf = (row) => cardWords(row, titleField, labels).text;
|
|
35544
35553
|
const groupOptions = useChoiceOptions(fields, groupField && isChoiceField(groupField) ? [groupField.key] : []).get(groupField?.key ?? "");
|
|
35545
35554
|
const [placedOver, setPlacedOver] = useState99(() => /* @__PURE__ */ new Map());
|
|
35546
|
-
|
|
35555
|
+
useEffect80(() => setPlacedOver(/* @__PURE__ */ new Map()), [rows]);
|
|
35547
35556
|
const undoneCount = moves.undo.depth.forward;
|
|
35548
|
-
|
|
35557
|
+
useEffect80(() => {
|
|
35549
35558
|
if (undoneCount > 0) setPlacedOver(/* @__PURE__ */ new Map());
|
|
35550
35559
|
}, [undoneCount]);
|
|
35551
35560
|
const startOf = (row) => placedOver.has(row.id) ? placedOver.get(row.id).start : startField ? (row.document ?? {})[startField.key] : null;
|
|
@@ -35808,11 +35817,11 @@ function TimelineView({
|
|
|
35808
35817
|
const width = days * px;
|
|
35809
35818
|
const scale = useMemo57(() => scaleOf(from, days, zoom, firstDay), [from, days, zoom, firstDay]);
|
|
35810
35819
|
const xOf = (day2) => daysBetween(from, day2) * px;
|
|
35811
|
-
const scroller =
|
|
35820
|
+
const scroller = useRef48(null);
|
|
35812
35821
|
const grouped = Boolean(groupField) && !ganttOn;
|
|
35813
35822
|
const hasLabel = grouped || ganttOn;
|
|
35814
35823
|
const [scrollX, setScrollX] = useState99(0);
|
|
35815
|
-
const frame =
|
|
35824
|
+
const frame = useRef48(null);
|
|
35816
35825
|
const onScroll = () => {
|
|
35817
35826
|
if (frame.current !== null) return;
|
|
35818
35827
|
frame.current = requestAnimationFrame(() => {
|
|
@@ -35820,7 +35829,7 @@ function TimelineView({
|
|
|
35820
35829
|
setScrollX(scroller.current?.scrollLeft ?? 0);
|
|
35821
35830
|
});
|
|
35822
35831
|
};
|
|
35823
|
-
|
|
35832
|
+
useEffect80(() => {
|
|
35824
35833
|
const el = scroller.current;
|
|
35825
35834
|
if (!el) return;
|
|
35826
35835
|
const label = el.querySelector("[data-timeline-label]")?.offsetWidth ?? 0;
|
|
@@ -36347,7 +36356,7 @@ function TimelineView({
|
|
|
36347
36356
|
}
|
|
36348
36357
|
|
|
36349
36358
|
// src/ViewNeeds.tsx
|
|
36350
|
-
import { useEffect as
|
|
36359
|
+
import { useEffect as useEffect81, useState as useState100 } from "react";
|
|
36351
36360
|
import { useFieldMutation as useFieldMutation6, useRecordsClient as useRecordsClient69, useTable as useTable20 } from "@ai-matrx/records/react";
|
|
36352
36361
|
import { BasicInput as BasicInput20, Button as Button76, Label as Label19 } from "@ai-matrx/design-system";
|
|
36353
36362
|
import { jsx as jsx121, jsxs as jsxs110 } from "react/jsx-runtime";
|
|
@@ -36368,7 +36377,7 @@ function useAskedColumnLands(layout, tableId, fields, chosen, offerable, onMade)
|
|
|
36368
36377
|
const wanted = askedFor.get(askKey(tableId, layout));
|
|
36369
36378
|
const landed = wanted && !chosen ? offerable(fields).find((f) => fieldName(f).trim().toLowerCase() === wanted.trim().toLowerCase()) : void 0;
|
|
36370
36379
|
const key = landed?.key ?? null;
|
|
36371
|
-
|
|
36380
|
+
useEffect81(() => {
|
|
36372
36381
|
if (!key) return;
|
|
36373
36382
|
askedFor.delete(askKey(tableId, layout));
|
|
36374
36383
|
onMade(key);
|
|
@@ -36480,7 +36489,7 @@ function ViewNeeds({ layout, tableId, fields, onMade, className }) {
|
|
|
36480
36489
|
}
|
|
36481
36490
|
|
|
36482
36491
|
// src/GalleryCover.tsx
|
|
36483
|
-
import { useEffect as
|
|
36492
|
+
import { useEffect as useEffect82, useState as useState101 } from "react";
|
|
36484
36493
|
import { useOptionalRecordsClient as useOptionalRecordsClient16 } from "@ai-matrx/records/react";
|
|
36485
36494
|
import { Fragment as Fragment46, jsx as jsx122 } from "react/jsx-runtime";
|
|
36486
36495
|
function isImageAddress(value) {
|
|
@@ -36502,7 +36511,7 @@ function FileCover({ recordId }) {
|
|
|
36502
36511
|
const client = useOptionalRecordsClient16();
|
|
36503
36512
|
const host = useRecordsUi();
|
|
36504
36513
|
const [read, setRead] = useState101(null);
|
|
36505
|
-
|
|
36514
|
+
useEffect82(() => {
|
|
36506
36515
|
let cancelled = false;
|
|
36507
36516
|
if (!client) {
|
|
36508
36517
|
setRead({ fileId: recordId, name: "" });
|
|
@@ -36900,7 +36909,7 @@ function ListRow({
|
|
|
36900
36909
|
}
|
|
36901
36910
|
|
|
36902
36911
|
// src/ChartLayout.tsx
|
|
36903
|
-
import { useEffect as
|
|
36912
|
+
import { useEffect as useEffect86, useMemo as useMemo61, useState as useState105 } from "react";
|
|
36904
36913
|
import { useRecordsClient as useRecordsClient70 } from "@ai-matrx/records/react";
|
|
36905
36914
|
import { fieldKindFor as fieldKindFor2, measureKey as measureKey4 } from "@ai-matrx/records";
|
|
36906
36915
|
import { Select as Select16, SelectContent as SelectContent16, SelectItem as SelectItem16, SelectTrigger as SelectTrigger16, SelectValue as SelectValue16 } from "@ai-matrx/design-system";
|
|
@@ -36930,7 +36939,7 @@ import { cn as cn61 } from "@ai-matrx/design-system";
|
|
|
36930
36939
|
import { formatCount as formatCount5 } from "@ai-matrx/kit/format";
|
|
36931
36940
|
|
|
36932
36941
|
// src/linkWords.ts
|
|
36933
|
-
import { useEffect as
|
|
36942
|
+
import { useEffect as useEffect83, useMemo as useMemo59, useState as useState102 } from "react";
|
|
36934
36943
|
import { useOptionalRecordsClient as useOptionalRecordsClient17 } from "@ai-matrx/records/react";
|
|
36935
36944
|
|
|
36936
36945
|
// src/charts.ts
|
|
@@ -37148,7 +37157,7 @@ function useLinkGroupNamer(block, tableId) {
|
|
|
37148
37157
|
const [named, setNamed] = useState102({});
|
|
37149
37158
|
const [choices, setChoices] = useState102([]);
|
|
37150
37159
|
const labels = useRecordLabels(choices);
|
|
37151
|
-
|
|
37160
|
+
useEffect83(() => {
|
|
37152
37161
|
if (!client || groupBy.length === 0 || rows.length === 0) return;
|
|
37153
37162
|
let cancelled = false;
|
|
37154
37163
|
void (async () => {
|
|
@@ -37191,7 +37200,7 @@ function useLinkGroupNamer(block, tableId) {
|
|
|
37191
37200
|
}
|
|
37192
37201
|
|
|
37193
37202
|
// src/measureWords.ts
|
|
37194
|
-
import { useEffect as
|
|
37203
|
+
import { useEffect as useEffect84, useState as useState103 } from "react";
|
|
37195
37204
|
import { useOptionalRecordsClient as useOptionalRecordsClient18 } from "@ai-matrx/records/react";
|
|
37196
37205
|
import { humanizeIdentifier as humanizeIdentifier14 } from "@ai-matrx/kit/text-case";
|
|
37197
37206
|
var OP_WORD = { sum: "Total", avg: "Average", min: "Lowest", max: "Highest" };
|
|
@@ -37210,7 +37219,7 @@ function useMeasureWords(key, tableId) {
|
|
|
37210
37219
|
const client = useOptionalRecordsClient18();
|
|
37211
37220
|
const [fields, setFields] = useState103(null);
|
|
37212
37221
|
const needs = key !== "count";
|
|
37213
|
-
|
|
37222
|
+
useEffect84(() => {
|
|
37214
37223
|
if (!client || !tableId || !needs) return;
|
|
37215
37224
|
let cancelled = false;
|
|
37216
37225
|
void client.fields({ table_id: tableId }).then((result) => {
|
|
@@ -37225,17 +37234,17 @@ function useMeasureWords(key, tableId) {
|
|
|
37225
37234
|
|
|
37226
37235
|
// src/chartFrame.tsx
|
|
37227
37236
|
import {
|
|
37228
|
-
useEffect as
|
|
37237
|
+
useEffect as useEffect85,
|
|
37229
37238
|
useId as useId4,
|
|
37230
|
-
useRef as
|
|
37239
|
+
useRef as useRef49,
|
|
37231
37240
|
useState as useState104
|
|
37232
37241
|
} from "react";
|
|
37233
37242
|
import { cn as cn60 } from "@ai-matrx/design-system";
|
|
37234
37243
|
import { jsx as jsx125, jsxs as jsxs113 } from "react/jsx-runtime";
|
|
37235
37244
|
function useMeasuredWidth(fallback = 480) {
|
|
37236
|
-
const ref =
|
|
37245
|
+
const ref = useRef49(null);
|
|
37237
37246
|
const [width, setWidth] = useState104(fallback);
|
|
37238
|
-
|
|
37247
|
+
useEffect85(() => {
|
|
37239
37248
|
const node = ref.current;
|
|
37240
37249
|
if (!node) return;
|
|
37241
37250
|
const apply = () => {
|
|
@@ -37873,7 +37882,7 @@ function ChartLayout({ view, fields, filter, onChange, remembered }) {
|
|
|
37873
37882
|
const [state, setState] = useState105({ block: null, error: null });
|
|
37874
37883
|
const filterKey = JSON.stringify(filter ?? {});
|
|
37875
37884
|
const qKey = JSON.stringify(q);
|
|
37876
|
-
|
|
37885
|
+
useEffect86(() => {
|
|
37877
37886
|
let cancelled = false;
|
|
37878
37887
|
const asked3 = JSON.parse(filterKey);
|
|
37879
37888
|
const question = JSON.parse(qKey);
|
|
@@ -37949,7 +37958,7 @@ function useViewRecords(view, pageSize = 200, filter, viewId) {
|
|
|
37949
37958
|
const client = useRecordsClient71();
|
|
37950
37959
|
const [limit, setLimit] = useState106(pageSize);
|
|
37951
37960
|
const questionKey = `${view.subject}|${stableFilterKey4(filter ?? null)}|${JSON.stringify(view.sorts ?? [])}`;
|
|
37952
|
-
|
|
37961
|
+
useEffect87(() => {
|
|
37953
37962
|
setLimit(pageSize);
|
|
37954
37963
|
}, [questionKey, pageSize]);
|
|
37955
37964
|
const storeSort = useMemo62(
|
|
@@ -37967,7 +37976,7 @@ function useViewRecords(view, pageSize = 200, filter, viewId) {
|
|
|
37967
37976
|
error: null
|
|
37968
37977
|
});
|
|
37969
37978
|
const ruleId = view.ruleId ?? null;
|
|
37970
|
-
|
|
37979
|
+
useEffect87(() => {
|
|
37971
37980
|
if (!ruleId) return;
|
|
37972
37981
|
let cancelled = false;
|
|
37973
37982
|
setRuled({ rows: [], loading: true, error: null });
|
|
@@ -38089,7 +38098,7 @@ function ViewSwitcher({
|
|
|
38089
38098
|
setSeenSignature(viewSignature);
|
|
38090
38099
|
if (Object.keys(local).length > 0) setLocal({});
|
|
38091
38100
|
}
|
|
38092
|
-
|
|
38101
|
+
useEffect87(() => {
|
|
38093
38102
|
setLayout(view.layout);
|
|
38094
38103
|
setLocal({});
|
|
38095
38104
|
}, [view.layout, view.name, view.subject]);
|
|
@@ -38187,7 +38196,7 @@ function useFarFields(all) {
|
|
|
38187
38196
|
const client = useRecordsClient71();
|
|
38188
38197
|
const targets = lookupTargets(all).sort().join(",");
|
|
38189
38198
|
const [far, setFar] = useState106(() => /* @__PURE__ */ new Map());
|
|
38190
|
-
|
|
38199
|
+
useEffect87(() => {
|
|
38191
38200
|
let cancelled = false;
|
|
38192
38201
|
const ids = targets ? targets.split(",") : [];
|
|
38193
38202
|
if (ids.length === 0) {
|
|
@@ -38226,7 +38235,7 @@ function useStageField(tableId) {
|
|
|
38226
38235
|
asked: false,
|
|
38227
38236
|
key: null
|
|
38228
38237
|
});
|
|
38229
|
-
|
|
38238
|
+
useEffect87(() => {
|
|
38230
38239
|
let cancelled = false;
|
|
38231
38240
|
setStage({ asked: false, key: null });
|
|
38232
38241
|
void client.tableStageField({ table_id: tableId }).then((r) => {
|
|
@@ -39120,7 +39129,7 @@ function boardDefaultGroupField(eligible) {
|
|
|
39120
39129
|
}
|
|
39121
39130
|
|
|
39122
39131
|
// src/ArchivedView.tsx
|
|
39123
|
-
import { useCallback as useCallback40, useEffect as
|
|
39132
|
+
import { useCallback as useCallback40, useEffect as useEffect88, useState as useState107 } from "react";
|
|
39124
39133
|
import {
|
|
39125
39134
|
ARCHIVE_LANES,
|
|
39126
39135
|
ARCHIVE_LANE_LABEL,
|
|
@@ -39158,7 +39167,7 @@ function ArchivedView({
|
|
|
39158
39167
|
const [error, setError] = useState107(null);
|
|
39159
39168
|
const [restoring, setRestoring] = useState107(null);
|
|
39160
39169
|
const [refusal3, setRefusal] = useState107(null);
|
|
39161
|
-
|
|
39170
|
+
useEffect88(() => {
|
|
39162
39171
|
if (laneFromHost) setLane(laneFromHost);
|
|
39163
39172
|
}, [laneFromHost]);
|
|
39164
39173
|
const read = useCallback40(async () => {
|
|
@@ -39173,7 +39182,7 @@ function ArchivedView({
|
|
|
39173
39182
|
}
|
|
39174
39183
|
setLoading(false);
|
|
39175
39184
|
}, [client, tableId, lane, pageSize]);
|
|
39176
|
-
|
|
39185
|
+
useEffect88(() => {
|
|
39177
39186
|
void read();
|
|
39178
39187
|
}, [read]);
|
|
39179
39188
|
const pick = (next) => {
|
|
@@ -39274,7 +39283,7 @@ function RetiredColumns({ tableId, mayRestore, whyNot }) {
|
|
|
39274
39283
|
setError(answer.error);
|
|
39275
39284
|
}
|
|
39276
39285
|
}, [client, tableId]);
|
|
39277
|
-
|
|
39286
|
+
useEffect88(() => {
|
|
39278
39287
|
void read();
|
|
39279
39288
|
}, [read]);
|
|
39280
39289
|
const restore = async (fieldId) => {
|
|
@@ -39319,7 +39328,7 @@ function RetiredColumns({ tableId, mayRestore, whyNot }) {
|
|
|
39319
39328
|
}
|
|
39320
39329
|
|
|
39321
39330
|
// src/ArchivedDisclosure.tsx
|
|
39322
|
-
import { useCallback as useCallback41, useEffect as
|
|
39331
|
+
import { useCallback as useCallback41, useEffect as useEffect89, useState as useState108 } from "react";
|
|
39323
39332
|
import {
|
|
39324
39333
|
emptyPortalArchiveLine,
|
|
39325
39334
|
portalConfirmLine,
|
|
@@ -39388,7 +39397,7 @@ function ArchivedPortals({
|
|
|
39388
39397
|
setError(answered.error);
|
|
39389
39398
|
}
|
|
39390
39399
|
}, [client]);
|
|
39391
|
-
|
|
39400
|
+
useEffect89(() => {
|
|
39392
39401
|
void read();
|
|
39393
39402
|
}, [read, refreshToken]);
|
|
39394
39403
|
const restore = async (portal) => {
|
|
@@ -39504,7 +39513,7 @@ function ArchivedPortals({
|
|
|
39504
39513
|
}
|
|
39505
39514
|
|
|
39506
39515
|
// src/ViewBar.tsx
|
|
39507
|
-
import { useCallback as useCallback43, useEffect as
|
|
39516
|
+
import { useCallback as useCallback43, useEffect as useEffect90, useRef as useRef51, useState as useState109 } from "react";
|
|
39508
39517
|
import { useRecordsClient as useRecordsClient74 } from "@ai-matrx/records/react";
|
|
39509
39518
|
import { Badge as Badge15, Button as Button80, Input as Input7, Popover as Popover16, PopoverContent as PopoverContent16, PopoverTrigger as PopoverTrigger16, Skeleton as Skeleton18, cn as cn65 } from "@ai-matrx/design-system";
|
|
39510
39519
|
import { Button as ControlButton, Switch as Switch5, Tile as Tile2 } from "@ai-matrx/design-system/controls";
|
|
@@ -39513,9 +39522,9 @@ import { SortableContext, useSortable, verticalListSortingStrategy } from "@dnd-
|
|
|
39513
39522
|
import { CSS as CSS2 } from "@dnd-kit/utilities";
|
|
39514
39523
|
|
|
39515
39524
|
// src/seedOnce.ts
|
|
39516
|
-
import { useCallback as useCallback42, useRef as
|
|
39525
|
+
import { useCallback as useCallback42, useRef as useRef50 } from "react";
|
|
39517
39526
|
function useSeedGuard() {
|
|
39518
|
-
const claimed =
|
|
39527
|
+
const claimed = useRef50(/* @__PURE__ */ new Set());
|
|
39519
39528
|
return useCallback42((name) => {
|
|
39520
39529
|
if (claimed.current.has(name)) return false;
|
|
39521
39530
|
claimed.current.add(name);
|
|
@@ -39611,8 +39620,8 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews,
|
|
|
39611
39620
|
if (!initialViews || initialViews.length === 0) return activeViewId ?? null;
|
|
39612
39621
|
return (initialViews.find((v) => v.id === activeViewId) ?? defaultViewOf(initialViews) ?? initialViews[0]).id;
|
|
39613
39622
|
});
|
|
39614
|
-
const readOnMount =
|
|
39615
|
-
const pendingPick =
|
|
39623
|
+
const readOnMount = useRef51(initialViews === void 0);
|
|
39624
|
+
const pendingPick = useRef51(null);
|
|
39616
39625
|
const [naming, setNaming] = useState109(false);
|
|
39617
39626
|
const [draftName, setDraftName] = useState109("");
|
|
39618
39627
|
const [open, setOpen] = useState109(false);
|
|
@@ -39630,7 +39639,7 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews,
|
|
|
39630
39639
|
});
|
|
39631
39640
|
const [renamingSection, setRenamingSection] = useState109(null);
|
|
39632
39641
|
const [dragging, setDragging] = useState109(false);
|
|
39633
|
-
const justDragged =
|
|
39642
|
+
const justDragged = useRef51(false);
|
|
39634
39643
|
const sensors = useSensors(useSensor(PointerSensor, { activationConstraint: { distance: 6 } }));
|
|
39635
39644
|
async function dropped(event) {
|
|
39636
39645
|
setDragging(false);
|
|
@@ -39708,14 +39717,14 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews,
|
|
|
39708
39717
|
setViews(mine);
|
|
39709
39718
|
onViews?.(mine);
|
|
39710
39719
|
}, [client, readViews, tableId, seedKey, tableThere]);
|
|
39711
|
-
|
|
39720
|
+
useEffect90(() => {
|
|
39712
39721
|
if (!readOnMount.current) {
|
|
39713
39722
|
readOnMount.current = true;
|
|
39714
39723
|
return;
|
|
39715
39724
|
}
|
|
39716
39725
|
void load();
|
|
39717
39726
|
}, [load]);
|
|
39718
|
-
|
|
39727
|
+
useEffect90(() => {
|
|
39719
39728
|
if (!views || views.length === 0) return;
|
|
39720
39729
|
const wanted = pendingPick.current;
|
|
39721
39730
|
pendingPick.current = null;
|
|
@@ -40066,7 +40075,7 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews,
|
|
|
40066
40075
|
}
|
|
40067
40076
|
|
|
40068
40077
|
// src/ProposalRow.tsx
|
|
40069
|
-
import { useEffect as
|
|
40078
|
+
import { useEffect as useEffect91, useRef as useRef52, useState as useState110 } from "react";
|
|
40070
40079
|
import { useRecordsClient as useRecordsClient75 } from "@ai-matrx/records/react";
|
|
40071
40080
|
import { Badge as Badge16, Button as Button81, cn as cn66 } from "@ai-matrx/design-system";
|
|
40072
40081
|
import { jsx as jsx132, jsxs as jsxs120 } from "react/jsx-runtime";
|
|
@@ -40084,9 +40093,9 @@ function ProposalRow({
|
|
|
40084
40093
|
const [settled, setSettled] = useState110(outcome ?? null);
|
|
40085
40094
|
const [busy, setBusy] = useState110(false);
|
|
40086
40095
|
const [confirming, setConfirming] = useState110(false);
|
|
40087
|
-
const drawnVersion =
|
|
40096
|
+
const drawnVersion = useRef52(null);
|
|
40088
40097
|
const needsVersion = change.act === "update" && Boolean(change.record) && change.version === void 0 && !onApply && !settled;
|
|
40089
|
-
|
|
40098
|
+
useEffect91(() => {
|
|
40090
40099
|
if (needsVersion && change.record && !drawnVersion.current) drawnVersion.current = (0, recordVersions_exports.readVersionNow)(client, change.record);
|
|
40091
40100
|
}, [needsVersion, change.record, client]);
|
|
40092
40101
|
async function applyThroughTheStore() {
|
|
@@ -40174,14 +40183,14 @@ function ProposalRow({
|
|
|
40174
40183
|
}
|
|
40175
40184
|
|
|
40176
40185
|
// src/ActionInbox.tsx
|
|
40177
|
-
import { useCallback as useCallback45, useEffect as
|
|
40186
|
+
import { useCallback as useCallback45, useEffect as useEffect93, useMemo as useMemo64, useRef as useRef53, useState as useState112 } from "react";
|
|
40178
40187
|
import { useRecordsClient as useRecordsClient77 } from "@ai-matrx/records/react";
|
|
40179
40188
|
import { Badge as Badge18, Button as Button83, Checkbox as Checkbox13, Skeleton as Skeleton20, cn as cn68 } from "@ai-matrx/design-system";
|
|
40180
40189
|
import { toggleSelection as toggleSelection2 } from "@ai-matrx/design-system/data-table";
|
|
40181
40190
|
import { formatAbsoluteDate, formatDurationMs } from "@ai-matrx/kit/format";
|
|
40182
40191
|
|
|
40183
40192
|
// src/ChecklistRunner.tsx
|
|
40184
|
-
import { useCallback as useCallback44, useEffect as
|
|
40193
|
+
import { useCallback as useCallback44, useEffect as useEffect92, useMemo as useMemo63, useState as useState111 } from "react";
|
|
40185
40194
|
import { useRecordsClient as useRecordsClient76, useTable as useTable24 } from "@ai-matrx/records/react";
|
|
40186
40195
|
import { Badge as Badge17, BasicInput as BasicInput22, BasicTextarea as BasicTextarea9, Button as Button82, Skeleton as Skeleton19, cn as cn67 } from "@ai-matrx/design-system";
|
|
40187
40196
|
import { humanizeIdentifier as humanizeIdentifier15 } from "@ai-matrx/kit/text-case";
|
|
@@ -40231,10 +40240,10 @@ function ChecklistRunner({
|
|
|
40231
40240
|
(held) => held && answered.data.some((r) => r.run_id === held) ? held : answered.data[0]?.run_id ?? null
|
|
40232
40241
|
);
|
|
40233
40242
|
}, [client, includeClosed, recordId, runId, tableId]);
|
|
40234
|
-
|
|
40243
|
+
useEffect92(() => {
|
|
40235
40244
|
void loadRuns();
|
|
40236
40245
|
}, [loadRuns]);
|
|
40237
|
-
|
|
40246
|
+
useEffect92(() => {
|
|
40238
40247
|
if (runId) setActiveId(runId);
|
|
40239
40248
|
}, [runId]);
|
|
40240
40249
|
const loadSteps = useCallback44(async () => {
|
|
@@ -40251,10 +40260,10 @@ function ChecklistRunner({
|
|
|
40251
40260
|
setError(null);
|
|
40252
40261
|
setSteps(answered.data);
|
|
40253
40262
|
}, [client, activeId]);
|
|
40254
|
-
|
|
40263
|
+
useEffect92(() => {
|
|
40255
40264
|
void loadSteps();
|
|
40256
40265
|
}, [loadSteps]);
|
|
40257
|
-
|
|
40266
|
+
useEffect92(() => {
|
|
40258
40267
|
if (!mayStart || !tableId) return;
|
|
40259
40268
|
let cancelled = false;
|
|
40260
40269
|
void client.checklistTemplates({ about_table_id: tableId, limit: 50 }).then((answered) => {
|
|
@@ -40388,7 +40397,7 @@ function StepRow({
|
|
|
40388
40397
|
const host = useRecordsUi();
|
|
40389
40398
|
const [members, setMembers] = useState111(null);
|
|
40390
40399
|
const unassigned = !step2.finished && !step2.assignee_user_id && Boolean(step2.role);
|
|
40391
|
-
|
|
40400
|
+
useEffect92(() => {
|
|
40392
40401
|
if (!unassigned || !onAssign || !host.members || members !== null) return;
|
|
40393
40402
|
let alive = true;
|
|
40394
40403
|
void host.members().then((roster) => {
|
|
@@ -40523,7 +40532,7 @@ function useMyChecklistSteps(limit = 25) {
|
|
|
40523
40532
|
setSteps(held);
|
|
40524
40533
|
setLoading(false);
|
|
40525
40534
|
}, [client, limit, me]);
|
|
40526
|
-
|
|
40535
|
+
useEffect92(() => {
|
|
40527
40536
|
void refresh();
|
|
40528
40537
|
}, [refresh]);
|
|
40529
40538
|
return { steps, loading, error, refresh };
|
|
@@ -40536,7 +40545,7 @@ function MyChecklistSteps({
|
|
|
40536
40545
|
}) {
|
|
40537
40546
|
const client = useRecordsClient76();
|
|
40538
40547
|
const { steps: held, loading, error, refresh } = useMyChecklistSteps();
|
|
40539
|
-
|
|
40548
|
+
useEffect92(() => {
|
|
40540
40549
|
onSteps?.(held.map((s) => s.step_id));
|
|
40541
40550
|
}, [held, onSteps]);
|
|
40542
40551
|
const steps = onlyIds ? held.filter((s) => onlyIds.has(s.step_id)) : held;
|
|
@@ -40605,7 +40614,7 @@ function ChecklistsPanel({ tableId, onOpenRecord, className }) {
|
|
|
40605
40614
|
if (!r.ok) setRuns([]);
|
|
40606
40615
|
else setRuns(r.data);
|
|
40607
40616
|
}, [client, tableId]);
|
|
40608
|
-
|
|
40617
|
+
useEffect92(() => {
|
|
40609
40618
|
void load();
|
|
40610
40619
|
}, [load]);
|
|
40611
40620
|
if (templates === null) return /* @__PURE__ */ jsx133(Skeleton19, { className: cn67("h-40 w-full", className) });
|
|
@@ -40768,7 +40777,7 @@ function ChecklistTemplateEditor({
|
|
|
40768
40777
|
const [error, setError] = useState111(null);
|
|
40769
40778
|
const [busy, setBusy] = useState111(false);
|
|
40770
40779
|
const [loading, setLoading] = useState111(Boolean(templateId));
|
|
40771
|
-
|
|
40780
|
+
useEffect92(() => {
|
|
40772
40781
|
if (!templateId) return;
|
|
40773
40782
|
let cancelled = false;
|
|
40774
40783
|
void client.checklistTemplateShape({ template_id: templateId }).then((answered) => {
|
|
@@ -40805,8 +40814,8 @@ function ChecklistTemplateEditor({
|
|
|
40805
40814
|
}),
|
|
40806
40815
|
[aboutTableId, name, rows]
|
|
40807
40816
|
);
|
|
40808
|
-
|
|
40809
|
-
|
|
40817
|
+
useEffect92(() => setSaved(false), [spec]);
|
|
40818
|
+
useEffect92(() => {
|
|
40810
40819
|
if (spec.steps.length === 0 || spec.name.length === 0) {
|
|
40811
40820
|
setRefusal(null);
|
|
40812
40821
|
return;
|
|
@@ -41076,9 +41085,9 @@ function ActionInbox({
|
|
|
41076
41085
|
const [outcome, setOutcome] = useState112({});
|
|
41077
41086
|
const [busy, setBusy] = useState112(null);
|
|
41078
41087
|
const [cursor, setCursor] = useState112(0);
|
|
41079
|
-
const listRef =
|
|
41088
|
+
const listRef = useRef53(null);
|
|
41080
41089
|
const [selected, setSelected] = useState112(/* @__PURE__ */ new Set());
|
|
41081
|
-
const anchor =
|
|
41090
|
+
const anchor = useRef53(null);
|
|
41082
41091
|
const [deciding, setDeciding] = useState112(false);
|
|
41083
41092
|
const [batchSaid, setBatchSaid] = useState112(null);
|
|
41084
41093
|
const [view, setView] = useState112("inbox");
|
|
@@ -41102,7 +41111,7 @@ function ActionInbox({
|
|
|
41102
41111
|
setError(null);
|
|
41103
41112
|
setItems(result.data);
|
|
41104
41113
|
}, [client, showDecided, view]);
|
|
41105
|
-
|
|
41114
|
+
useEffect93(() => {
|
|
41106
41115
|
void load();
|
|
41107
41116
|
}, [load]);
|
|
41108
41117
|
const narrowed = useMemo64(() => {
|
|
@@ -41117,10 +41126,10 @@ function ActionInbox({
|
|
|
41117
41126
|
const groups = useMemo64(() => groupInbox(narrowed, groupBy), [narrowed, groupBy]);
|
|
41118
41127
|
const shown5 = useMemo64(() => groups.flatMap((g) => g.items), [groups]);
|
|
41119
41128
|
const elsewhere = (items?.length ?? 0) - narrowed.length;
|
|
41120
|
-
|
|
41129
|
+
useEffect93(() => {
|
|
41121
41130
|
if (cursor >= shown5.length) setCursor(Math.max(0, shown5.length - 1));
|
|
41122
41131
|
}, [shown5.length, cursor]);
|
|
41123
|
-
|
|
41132
|
+
useEffect93(() => {
|
|
41124
41133
|
const list = listRef.current;
|
|
41125
41134
|
const el = list?.querySelector(`[data-row="${cursor}"]`);
|
|
41126
41135
|
if (list && el) scrollWithinList(list, el);
|
|
@@ -41142,11 +41151,11 @@ function ActionInbox({
|
|
|
41142
41151
|
[client, load]
|
|
41143
41152
|
);
|
|
41144
41153
|
const [held, setHeld] = useState112({});
|
|
41145
|
-
const holds2 =
|
|
41146
|
-
const lastHold =
|
|
41147
|
-
const holdSeq =
|
|
41154
|
+
const holds2 = useRef53(/* @__PURE__ */ new Map());
|
|
41155
|
+
const lastHold = useRef53(null);
|
|
41156
|
+
const holdSeq = useRef53(0);
|
|
41148
41157
|
const [, tick] = useState112(0);
|
|
41149
|
-
|
|
41158
|
+
useEffect93(() => {
|
|
41150
41159
|
if (Object.keys(held).length === 0) return;
|
|
41151
41160
|
const t = setInterval(() => tick((n) => n + 1), 250);
|
|
41152
41161
|
return () => clearInterval(t);
|
|
@@ -41191,7 +41200,7 @@ function ActionInbox({
|
|
|
41191
41200
|
});
|
|
41192
41201
|
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 });
|
|
41193
41202
|
}, []);
|
|
41194
|
-
|
|
41203
|
+
useEffect93(() => {
|
|
41195
41204
|
const flush = () => {
|
|
41196
41205
|
for (const entry of [...holds2.current.values()]) entry.commit();
|
|
41197
41206
|
};
|
|
@@ -41201,8 +41210,8 @@ function ActionInbox({
|
|
|
41201
41210
|
flush();
|
|
41202
41211
|
};
|
|
41203
41212
|
}, []);
|
|
41204
|
-
const resumed =
|
|
41205
|
-
|
|
41213
|
+
const resumed = useRef53(false);
|
|
41214
|
+
useEffect93(() => {
|
|
41206
41215
|
if (resumed.current || items === null || view !== "inbox") return;
|
|
41207
41216
|
resumed.current = true;
|
|
41208
41217
|
const kept = readHolds();
|
|
@@ -41822,7 +41831,7 @@ function ActionInbox({
|
|
|
41822
41831
|
}
|
|
41823
41832
|
|
|
41824
41833
|
// src/HistoryPanel.tsx
|
|
41825
|
-
import { useCallback as useCallback47, useEffect as
|
|
41834
|
+
import { useCallback as useCallback47, useEffect as useEffect96, useRef as useRef54, useState as useState115 } from "react";
|
|
41826
41835
|
|
|
41827
41836
|
// src/undoChange.ts
|
|
41828
41837
|
function blank(value) {
|
|
@@ -41869,7 +41878,7 @@ import { Badge as Badge19, Button as Button86, Skeleton as Skeleton22, cn as cn7
|
|
|
41869
41878
|
import { formatRelativeTime as formatRelativeTime3 } from "@ai-matrx/kit/format";
|
|
41870
41879
|
|
|
41871
41880
|
// src/AsOfReading.tsx
|
|
41872
|
-
import { useEffect as
|
|
41881
|
+
import { useEffect as useEffect94, useMemo as useMemo65, useState as useState113 } from "react";
|
|
41873
41882
|
import { readTypedDate as readTypedDate3, typedDateText as typedDateText3 } from "@ai-matrx/records";
|
|
41874
41883
|
import { useRecordsClient as useRecordsClient78 } from "@ai-matrx/records/react";
|
|
41875
41884
|
import { Button as Button84, Skeleton as Skeleton21, cn as cn69 } from "@ai-matrx/design-system";
|
|
@@ -41996,7 +42005,7 @@ function AsOfReading({
|
|
|
41996
42005
|
const zone2 = usePersonTimeZone();
|
|
41997
42006
|
const [answer, setAnswer] = useState113(null);
|
|
41998
42007
|
const key = `${recordId}|${asOf.clock}|${asOf.day}|${zone2 ?? ""}`;
|
|
41999
|
-
|
|
42008
|
+
useEffect94(() => {
|
|
42000
42009
|
let live = true;
|
|
42001
42010
|
void client.recordAsOf(asOfArgs(recordId, asOf, zone2)).then((got) => {
|
|
42002
42011
|
if (!live) return;
|
|
@@ -42031,7 +42040,7 @@ function AsOfReading({
|
|
|
42031
42040
|
import { humanizeIdentifier as humanizeIdentifier18 } from "@ai-matrx/kit/text-case";
|
|
42032
42041
|
|
|
42033
42042
|
// src/MigrationLog.tsx
|
|
42034
|
-
import { useCallback as useCallback46, useEffect as
|
|
42043
|
+
import { useCallback as useCallback46, useEffect as useEffect95, useState as useState114 } from "react";
|
|
42035
42044
|
import { useRecordsClient as useRecordsClient79 } from "@ai-matrx/records/react";
|
|
42036
42045
|
import { Button as Button85, cn as cn70 } from "@ai-matrx/design-system";
|
|
42037
42046
|
import { humanizeIdentifier as humanizeIdentifier17 } from "@ai-matrx/kit/text-case";
|
|
@@ -42072,7 +42081,7 @@ function useMigrationLog(recordId) {
|
|
|
42072
42081
|
setError(null);
|
|
42073
42082
|
setEntries(answered.data);
|
|
42074
42083
|
}, [client, recordId]);
|
|
42075
|
-
|
|
42084
|
+
useEffect95(() => {
|
|
42076
42085
|
void reload();
|
|
42077
42086
|
}, [reload]);
|
|
42078
42087
|
return { entries, error, reload };
|
|
@@ -42137,9 +42146,9 @@ function HistoryPanel({ tableId, recordId, onAskAboutField, className }) {
|
|
|
42137
42146
|
const [open, setOpen] = useState115(null);
|
|
42138
42147
|
const [pending, setPending] = useState115({ phase: "idle" });
|
|
42139
42148
|
const [undo, setUndo] = useState115({ phase: "idle" });
|
|
42140
|
-
const seenAtPreview =
|
|
42149
|
+
const seenAtPreview = useRef54(null);
|
|
42141
42150
|
const [said2, setSaid] = useState115(null);
|
|
42142
|
-
const listRef =
|
|
42151
|
+
const listRef = useRef54(null);
|
|
42143
42152
|
const [asOf, setAsOf] = useState115(null);
|
|
42144
42153
|
const today = useRecord4(recordId, false, { tableId });
|
|
42145
42154
|
const changed2 = useRecordChangeRevision(recordId);
|
|
@@ -42153,7 +42162,7 @@ function HistoryPanel({ tableId, recordId, onAskAboutField, className }) {
|
|
|
42153
42162
|
setError(null);
|
|
42154
42163
|
setEntries(answered.data);
|
|
42155
42164
|
}, [client, recordId, changed2]);
|
|
42156
|
-
|
|
42165
|
+
useEffect96(() => {
|
|
42157
42166
|
void load();
|
|
42158
42167
|
}, [load]);
|
|
42159
42168
|
if (error) return /* @__PURE__ */ jsx137(RefusalNotice, { error, className });
|
|
@@ -42575,7 +42584,7 @@ function say(value, field2) {
|
|
|
42575
42584
|
}
|
|
42576
42585
|
|
|
42577
42586
|
// src/CommentThread.tsx
|
|
42578
|
-
import { useCallback as useCallback48, useEffect as
|
|
42587
|
+
import { useCallback as useCallback48, useEffect as useEffect97, useMemo as useMemo66, useRef as useRef55, useState as useState116 } from "react";
|
|
42579
42588
|
import {
|
|
42580
42589
|
useFields as useFields24,
|
|
42581
42590
|
useRecordsClient as useRecordsClient81,
|
|
@@ -42599,7 +42608,7 @@ function CommentThread({ tableId, recordId, fieldKey, className }) {
|
|
|
42599
42608
|
const [people, setPeople] = useState116([]);
|
|
42600
42609
|
const [mentionQuery, setMentionQuery] = useState116(null);
|
|
42601
42610
|
const [picked, setPicked] = useState116([]);
|
|
42602
|
-
const box =
|
|
42611
|
+
const box = useRef55(null);
|
|
42603
42612
|
const load = useCallback48(async () => {
|
|
42604
42613
|
const answered = await client.commentThread({ record_id: recordId, include_resolved: showResolved });
|
|
42605
42614
|
if (!answered.ok) {
|
|
@@ -42613,10 +42622,10 @@ function CommentThread({ tableId, recordId, fieldKey, className }) {
|
|
|
42613
42622
|
mayResolve: answered.data.may_resolve
|
|
42614
42623
|
});
|
|
42615
42624
|
}, [client, recordId, showResolved]);
|
|
42616
|
-
|
|
42625
|
+
useEffect97(() => {
|
|
42617
42626
|
void load();
|
|
42618
42627
|
}, [load]);
|
|
42619
|
-
|
|
42628
|
+
useEffect97(() => {
|
|
42620
42629
|
let alive = true;
|
|
42621
42630
|
if (!host.members) return;
|
|
42622
42631
|
void host.members().then((roster) => {
|
|
@@ -42819,7 +42828,7 @@ function Line2({
|
|
|
42819
42828
|
}
|
|
42820
42829
|
|
|
42821
42830
|
// src/FieldHistoryPanel.tsx
|
|
42822
|
-
import { useCallback as useCallback49, useEffect as
|
|
42831
|
+
import { useCallback as useCallback49, useEffect as useEffect98, useRef as useRef56, useState as useState117 } from "react";
|
|
42823
42832
|
import {
|
|
42824
42833
|
useFields as useFields25,
|
|
42825
42834
|
useRecordsClient as useRecordsClient82,
|
|
@@ -42843,7 +42852,7 @@ function FieldHistoryPanel({
|
|
|
42843
42852
|
const [rows, setRows] = useState117(null);
|
|
42844
42853
|
const [error, setError] = useState117(null);
|
|
42845
42854
|
const [pending, setPending] = useState117({ phase: "idle" });
|
|
42846
|
-
const seenAtPreview =
|
|
42855
|
+
const seenAtPreview = useRef56(null);
|
|
42847
42856
|
const [said2, setSaid] = useState117(null);
|
|
42848
42857
|
const load = useCallback49(async () => {
|
|
42849
42858
|
const answered = await client.fieldHistory(
|
|
@@ -42856,7 +42865,7 @@ function FieldHistoryPanel({
|
|
|
42856
42865
|
setError(null);
|
|
42857
42866
|
setRows(answered.data);
|
|
42858
42867
|
}, [client, tableId, fieldKey, recordId]);
|
|
42859
|
-
|
|
42868
|
+
useEffect98(() => {
|
|
42860
42869
|
void load();
|
|
42861
42870
|
}, [load]);
|
|
42862
42871
|
const label = (fields.data ?? []).find((f) => f.key === fieldKey)?.label || humanizeIdentifier20(fieldKey);
|
|
@@ -42991,7 +43000,7 @@ function FieldHistoryPanel({
|
|
|
42991
43000
|
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";
|
|
42992
43001
|
|
|
42993
43002
|
// src/FormResultsPanel.tsx
|
|
42994
|
-
import { useEffect as
|
|
43003
|
+
import { useEffect as useEffect99, useMemo as useMemo67, useState as useState118 } from "react";
|
|
42995
43004
|
import { useFields as useFields26, useOptionalRecordsClient as useOptionalRecordsClient19 } from "@ai-matrx/records/react";
|
|
42996
43005
|
import { Button as Button89, Skeleton as Skeleton25, cn as cn74 } from "@ai-matrx/design-system";
|
|
42997
43006
|
import { jsx as jsx140, jsxs as jsxs128 } from "react/jsx-runtime";
|
|
@@ -43020,7 +43029,7 @@ function FormResultsPanel({ form, className }) {
|
|
|
43020
43029
|
const [results, setResults] = useState118(null);
|
|
43021
43030
|
const [error, setError] = useState118(null);
|
|
43022
43031
|
const [round, setRound] = useState118(0);
|
|
43023
|
-
|
|
43032
|
+
useEffect99(() => {
|
|
43024
43033
|
if (!client) {
|
|
43025
43034
|
setError((0, refusals_exports.refusal)("not_supported", "Results are read from the record store, and this screen has none.", "Open the form inside the app."));
|
|
43026
43035
|
return;
|
|
@@ -43118,7 +43127,7 @@ function FormResultsPanel({ form, className }) {
|
|
|
43118
43127
|
}
|
|
43119
43128
|
|
|
43120
43129
|
// src/PortalBuilder.tsx
|
|
43121
|
-
import { useCallback as useCallback50, useEffect as
|
|
43130
|
+
import { useCallback as useCallback50, useEffect as useEffect100, useMemo as useMemo68, useRef as useRef57, useState as useState119 } from "react";
|
|
43122
43131
|
import { useRecordsClient as useRecordsClient83, useTables as useTables4 } from "@ai-matrx/records/react";
|
|
43123
43132
|
import { BasicInput as BasicInput23, Button as Button90, Checkbox as Checkbox14, Label as Label20, Separator as Separator10, Skeleton as Skeleton26, cn as cn75 } from "@ai-matrx/design-system";
|
|
43124
43133
|
import { Fragment as Fragment55, jsx as jsx141, jsxs as jsxs129 } from "react/jsx-runtime";
|
|
@@ -43151,7 +43160,7 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
|
|
|
43151
43160
|
},
|
|
43152
43161
|
[client, fieldsByTable]
|
|
43153
43162
|
);
|
|
43154
|
-
|
|
43163
|
+
useEffect100(() => {
|
|
43155
43164
|
if (!portalId) return;
|
|
43156
43165
|
void (async () => {
|
|
43157
43166
|
const answered = await client.portalCard({ portal_id: portalId });
|
|
@@ -43165,7 +43174,7 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
|
|
|
43165
43174
|
setClientTableId(answered.data.client_table_id);
|
|
43166
43175
|
})();
|
|
43167
43176
|
}, [client, portalId]);
|
|
43168
|
-
|
|
43177
|
+
useEffect100(() => {
|
|
43169
43178
|
if (!tableId) return;
|
|
43170
43179
|
setExposures(
|
|
43171
43180
|
(prev) => prev[tableId] ? prev : {
|
|
@@ -43178,7 +43187,7 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
|
|
|
43178
43187
|
const cameFromPeople = Boolean(
|
|
43179
43188
|
tableId && (fieldsByTable[tableId] ?? []).some((f) => editorKindFor(f) === "email")
|
|
43180
43189
|
);
|
|
43181
|
-
|
|
43190
|
+
useEffect100(() => {
|
|
43182
43191
|
if (!tableId || portalId || clientTableId !== null || !cameFromPeople) return;
|
|
43183
43192
|
setClientTableId(tableId);
|
|
43184
43193
|
setExposures((prev) => {
|
|
@@ -43193,7 +43202,7 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
|
|
|
43193
43202
|
),
|
|
43194
43203
|
[fieldsByTable, clientTableId]
|
|
43195
43204
|
);
|
|
43196
|
-
|
|
43205
|
+
useEffect100(() => {
|
|
43197
43206
|
for (const e of Object.values(exposures)) {
|
|
43198
43207
|
if (!e.on || e.namesVia.trim() !== "") continue;
|
|
43199
43208
|
const ties = tiesTo(e.tableId);
|
|
@@ -43208,7 +43217,7 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
|
|
|
43208
43217
|
if (on) void loadFields(t.id);
|
|
43209
43218
|
}
|
|
43210
43219
|
const [linking, setLinking] = useState119(null);
|
|
43211
|
-
const linkingNow =
|
|
43220
|
+
const linkingNow = useRef57(null);
|
|
43212
43221
|
async function addLinkBack(id) {
|
|
43213
43222
|
const clients = (tables.data ?? []).find((t) => t.id === clientTableId);
|
|
43214
43223
|
if (!clientTableId || !clients) return;
|
|
@@ -43235,8 +43244,8 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
|
|
|
43235
43244
|
linkingNow.current = null;
|
|
43236
43245
|
setLinking(null);
|
|
43237
43246
|
}
|
|
43238
|
-
const autoLinked =
|
|
43239
|
-
|
|
43247
|
+
const autoLinked = useRef57(/* @__PURE__ */ new Set());
|
|
43248
|
+
useEffect100(() => {
|
|
43240
43249
|
if (linking !== null || !clientTableId) return;
|
|
43241
43250
|
for (const e of Object.values(exposures)) {
|
|
43242
43251
|
if (!e.on || !fieldsByTable[e.tableId] || autoLinked.current.has(e.tableId)) continue;
|
|
@@ -43510,7 +43519,7 @@ function clientNoun(table) {
|
|
|
43510
43519
|
|
|
43511
43520
|
// src/PortalsPanel.tsx
|
|
43512
43521
|
import { copyText as copyText7 } from "@ai-matrx/kit/clipboard";
|
|
43513
|
-
import { useCallback as useCallback51, useEffect as
|
|
43522
|
+
import { useCallback as useCallback51, useEffect as useEffect102, useMemo as useMemo70, useState as useState121 } from "react";
|
|
43514
43523
|
import { useRecordsClient as useRecordsClient85 } from "@ai-matrx/records/react";
|
|
43515
43524
|
import {
|
|
43516
43525
|
portalArchiveConsequence,
|
|
@@ -43521,7 +43530,7 @@ import {
|
|
|
43521
43530
|
import { Badge as Badge22, BasicInput as BasicInput25, Button as Button92, Separator as Separator11, Skeleton as Skeleton27, cn as cn78 } from "@ai-matrx/design-system";
|
|
43522
43531
|
|
|
43523
43532
|
// src/PortalLookEditor.tsx
|
|
43524
|
-
import { useEffect as
|
|
43533
|
+
import { useEffect as useEffect101, useMemo as useMemo69, useState as useState120 } from "react";
|
|
43525
43534
|
import { useRecordsClient as useRecordsClient84 } from "@ai-matrx/records/react";
|
|
43526
43535
|
import { BasicInput as BasicInput24, Button as Button91, cn as cn77 } from "@ai-matrx/design-system";
|
|
43527
43536
|
|
|
@@ -43609,7 +43618,7 @@ function PortalLookEditor({ card, onSaved, className }) {
|
|
|
43609
43618
|
const [said2, setSaid] = useState120(null);
|
|
43610
43619
|
const [formsError, setFormsError] = useState120(null);
|
|
43611
43620
|
const [formsUnread, setFormsUnread] = useState120(false);
|
|
43612
|
-
|
|
43621
|
+
useEffect101(() => {
|
|
43613
43622
|
let cancelled = false;
|
|
43614
43623
|
void (async () => {
|
|
43615
43624
|
try {
|
|
@@ -43859,7 +43868,7 @@ function PortalsPanel({ tableId, activePortalId, className }) {
|
|
|
43859
43868
|
const [exposures, setExposures] = useState121([]);
|
|
43860
43869
|
const [listError, setListError] = useState121(null);
|
|
43861
43870
|
const [openId, setOpenId] = useState121(activePortalId ?? null);
|
|
43862
|
-
|
|
43871
|
+
useEffect102(() => {
|
|
43863
43872
|
if (activePortalId) setOpenId(activePortalId);
|
|
43864
43873
|
}, [activePortalId]);
|
|
43865
43874
|
const [building, setBuilding] = useState121(false);
|
|
@@ -43877,7 +43886,7 @@ function PortalsPanel({ tableId, activePortalId, className }) {
|
|
|
43877
43886
|
setPortals(answered.data);
|
|
43878
43887
|
setExposures(mapped.ok ? mapped.data : []);
|
|
43879
43888
|
}, [client]);
|
|
43880
|
-
|
|
43889
|
+
useEffect102(() => {
|
|
43881
43890
|
void load();
|
|
43882
43891
|
}, [load]);
|
|
43883
43892
|
if (portals === null) return /* @__PURE__ */ jsx144(Skeleton27, { className: cn78("h-32 w-full", className) });
|
|
@@ -44152,7 +44161,7 @@ function PortalDetail({
|
|
|
44152
44161
|
setError(null);
|
|
44153
44162
|
setCard(answered.data);
|
|
44154
44163
|
}, [client, portalId]);
|
|
44155
|
-
|
|
44164
|
+
useEffect102(() => {
|
|
44156
44165
|
void load();
|
|
44157
44166
|
}, [load]);
|
|
44158
44167
|
const revoke = useCallback51(
|
|
@@ -44360,7 +44369,7 @@ function Preview({
|
|
|
44360
44369
|
const [which, setWhich] = useState121(first?.table_id ?? null);
|
|
44361
44370
|
const [rows, setRows] = useState121(null);
|
|
44362
44371
|
const [error, setError] = useState121(null);
|
|
44363
|
-
|
|
44372
|
+
useEffect102(() => {
|
|
44364
44373
|
if (!which) return;
|
|
44365
44374
|
let cancelled = false;
|
|
44366
44375
|
setRows(null);
|
|
@@ -44406,7 +44415,7 @@ function Invite({ card, onInvited }) {
|
|
|
44406
44415
|
const [busy, setBusy] = useState121(false);
|
|
44407
44416
|
const [said2, setSaid] = useState121(null);
|
|
44408
44417
|
const [error, setError] = useState121(null);
|
|
44409
|
-
|
|
44418
|
+
useEffect102(() => {
|
|
44410
44419
|
let cancelled = false;
|
|
44411
44420
|
void client.list({ table_id: card.client_table_id, limit: 200 }).then((answered) => {
|
|
44412
44421
|
if (cancelled) return;
|
|
@@ -44617,7 +44626,7 @@ function FormLookFrame({ look, title, children, contained = false, showOwnerHead
|
|
|
44617
44626
|
}
|
|
44618
44627
|
|
|
44619
44628
|
// src/DigestScheduler.tsx
|
|
44620
|
-
import { useCallback as useCallback52, useEffect as
|
|
44629
|
+
import { useCallback as useCallback52, useEffect as useEffect103, useMemo as useMemo71, useState as useState122 } from "react";
|
|
44621
44630
|
import { useRecordsClient as useRecordsClient86, useTable as useTable28 } from "@ai-matrx/records/react";
|
|
44622
44631
|
import { hasQuietHours } from "@ai-matrx/records";
|
|
44623
44632
|
import { BasicInput as BasicInput26, Button as Button93, Checkbox as Checkbox15, Label as Label21, Separator as Separator12, Skeleton as Skeleton28, cn as cn80 } from "@ai-matrx/design-system";
|
|
@@ -44734,7 +44743,7 @@ function DigestScheduler({
|
|
|
44734
44743
|
setMembers([]);
|
|
44735
44744
|
}
|
|
44736
44745
|
}, [client, tableId, host]);
|
|
44737
|
-
|
|
44746
|
+
useEffect103(() => {
|
|
44738
44747
|
void load();
|
|
44739
44748
|
}, [load]);
|
|
44740
44749
|
const schedule = useMemo71(() => {
|
|
@@ -44989,13 +44998,13 @@ function DigestScheduler({
|
|
|
44989
44998
|
}
|
|
44990
44999
|
|
|
44991
45000
|
// src/SubscriptionsPanel.tsx
|
|
44992
|
-
import { useCallback as useCallback54, useEffect as
|
|
45001
|
+
import { useCallback as useCallback54, useEffect as useEffect105, useState as useState124 } from "react";
|
|
44993
45002
|
import { useRecordsClient as useRecordsClient88 } from "@ai-matrx/records/react";
|
|
44994
45003
|
import { hasQuietHours as hasQuietHours2 } from "@ai-matrx/records";
|
|
44995
45004
|
import { Badge as Badge23, Button as Button95, Skeleton as Skeleton30, Switch as Switch6, cn as cn82 } from "@ai-matrx/design-system";
|
|
44996
45005
|
|
|
44997
45006
|
// src/WebhooksPanel.tsx
|
|
44998
|
-
import { useCallback as useCallback53, useEffect as
|
|
45007
|
+
import { useCallback as useCallback53, useEffect as useEffect104, useState as useState123 } from "react";
|
|
44999
45008
|
import { useRecordsClient as useRecordsClient87, useTable as useTable29 } from "@ai-matrx/records/react";
|
|
45000
45009
|
import { BasicInput as BasicInput27, Button as Button94, Checkbox as Checkbox16, ConfirmDialog as ConfirmDialog7, Label as Label22, Skeleton as Skeleton29, cn as cn81 } from "@ai-matrx/design-system";
|
|
45001
45010
|
import { jsx as jsx147, jsxs as jsxs135 } from "react/jsx-runtime";
|
|
@@ -45041,7 +45050,7 @@ function WebhooksPanel({ tableId, className }) {
|
|
|
45041
45050
|
setError(null);
|
|
45042
45051
|
setHooks(answered.data ?? []);
|
|
45043
45052
|
}, [client, tableId]);
|
|
45044
|
-
|
|
45053
|
+
useEffect104(() => {
|
|
45045
45054
|
void load();
|
|
45046
45055
|
}, [load]);
|
|
45047
45056
|
const declare2 = async () => {
|
|
@@ -45229,7 +45238,7 @@ function SubscriptionsPanel({ tableId, activeRuleId, className }) {
|
|
|
45229
45238
|
setError(null);
|
|
45230
45239
|
setRows(answered.data);
|
|
45231
45240
|
}, [client, tableId]);
|
|
45232
|
-
|
|
45241
|
+
useEffect105(() => {
|
|
45233
45242
|
void load();
|
|
45234
45243
|
}, [load]);
|
|
45235
45244
|
const flip = useCallback54(
|
|
@@ -45420,7 +45429,7 @@ function SubscriptionsPanel({ tableId, activeRuleId, className }) {
|
|
|
45420
45429
|
// src/FormBuilder.tsx
|
|
45421
45430
|
import { copyText as copyText8 } from "@ai-matrx/kit/clipboard";
|
|
45422
45431
|
import { ErrorBox as ErrorBox7 } from "@ai-matrx/design-system";
|
|
45423
|
-
import { useCallback as useCallback56, useEffect as
|
|
45432
|
+
import { useCallback as useCallback56, useEffect as useEffect107, useMemo as useMemo73, useRef as useRef59, useState as useState127 } from "react";
|
|
45424
45433
|
import { DndContext as DndContext2, KeyboardSensor, PointerSensor as PointerSensor2, closestCenter as closestCenter2, useSensor as useSensor2, useSensors as useSensors2 } from "@dnd-kit/core";
|
|
45425
45434
|
import { SortableContext as SortableContext2, arrayMove, sortableKeyboardCoordinates, useSortable as useSortable2, verticalListSortingStrategy as verticalListSortingStrategy2 } from "@dnd-kit/sortable";
|
|
45426
45435
|
import { CSS as CSS3 } from "@dnd-kit/utilities";
|
|
@@ -45693,7 +45702,7 @@ function EmbedSnippets({ url, label }) {
|
|
|
45693
45702
|
}
|
|
45694
45703
|
|
|
45695
45704
|
// src/FormRunner.tsx
|
|
45696
|
-
import { useCallback as useCallback55, useEffect as
|
|
45705
|
+
import { useCallback as useCallback55, useEffect as useEffect106, useMemo as useMemo72, useRef as useRef58, useState as useState126 } from "react";
|
|
45697
45706
|
import { useFields as useFields27, useOptionalRecordsClient as useOptionalRecordsClient20 } from "@ai-matrx/records/react";
|
|
45698
45707
|
import { Button as Button97, Label as Label24, Progress, Skeleton as Skeleton31, cn as cn83, formThemeClasses } from "@ai-matrx/design-system";
|
|
45699
45708
|
import { answerRefusal, formRoutes, pipeAnswers, submissionStamp } from "@ai-matrx/records/forms";
|
|
@@ -45811,11 +45820,11 @@ function FormStage({
|
|
|
45811
45820
|
const routes = formRoutes(form);
|
|
45812
45821
|
const [routeKnown, setRouteKnown] = useState126(() => !routes || !whichAsked);
|
|
45813
45822
|
const [stopped, setStopped] = useState126(null);
|
|
45814
|
-
const answersRef =
|
|
45823
|
+
const answersRef = useRef58(answers);
|
|
45815
45824
|
answersRef.current = answers;
|
|
45816
45825
|
const choose = autoAdvance ?? form.autoAdvance ?? true;
|
|
45817
|
-
const decoy =
|
|
45818
|
-
const stage =
|
|
45826
|
+
const decoy = useRef58("");
|
|
45827
|
+
const stage = useRef58(null);
|
|
45819
45828
|
const questions = useMemo72(() => {
|
|
45820
45829
|
const byKey = new Map((fields ?? []).map((f) => [f.key, f]));
|
|
45821
45830
|
return (form.questions ?? []).map((q) => {
|
|
@@ -45833,7 +45842,7 @@ function FormStage({
|
|
|
45833
45842
|
};
|
|
45834
45843
|
});
|
|
45835
45844
|
}, [fields, form.questions]);
|
|
45836
|
-
|
|
45845
|
+
useEffect106(() => {
|
|
45837
45846
|
if (!whichAsked) return;
|
|
45838
45847
|
if (!routes) return;
|
|
45839
45848
|
let cancelled = false;
|
|
@@ -45878,19 +45887,19 @@ function FormStage({
|
|
|
45878
45887
|
};
|
|
45879
45888
|
}, [whichAsked, questions, answers]);
|
|
45880
45889
|
const live = questions.filter((q) => !hidden[q.key]);
|
|
45881
|
-
const told =
|
|
45882
|
-
|
|
45890
|
+
const told = useRef58(answers);
|
|
45891
|
+
useEffect106(() => {
|
|
45883
45892
|
if (told.current === answers) return;
|
|
45884
45893
|
told.current = answers;
|
|
45885
45894
|
onAnswersChange?.(answers);
|
|
45886
45895
|
}, [answers, onAnswersChange]);
|
|
45887
|
-
const resumeAt =
|
|
45896
|
+
const resumeAt = useRef58(
|
|
45888
45897
|
resumed && initialAnswers && Object.keys(initialAnswers).length > 0 ? questions.find((q) => {
|
|
45889
45898
|
const v = initialAnswers[q.key];
|
|
45890
45899
|
return v === void 0 || v === null || v === "";
|
|
45891
45900
|
})?.key ?? null : null
|
|
45892
45901
|
);
|
|
45893
|
-
|
|
45902
|
+
useEffect106(() => {
|
|
45894
45903
|
const key = resumeAt.current;
|
|
45895
45904
|
if (!key) return;
|
|
45896
45905
|
const i = live.findIndex((q) => q.key === key);
|
|
@@ -45998,10 +46007,10 @@ function FormStage({
|
|
|
45998
46007
|
if (stillMissing) refuse(stillMissing, refusalFor2(stillMissing));
|
|
45999
46008
|
else void submit();
|
|
46000
46009
|
}
|
|
46001
|
-
const routing =
|
|
46010
|
+
const routing = useRef58(false);
|
|
46002
46011
|
const [routingNow, setRoutingNow] = useState126(false);
|
|
46003
|
-
const typedAhead =
|
|
46004
|
-
|
|
46012
|
+
const typedAhead = useRef58("");
|
|
46013
|
+
useEffect106(() => {
|
|
46005
46014
|
if (!routingNow) return;
|
|
46006
46015
|
const hold = (event) => {
|
|
46007
46016
|
if (!routing.current || event.metaKey || event.ctrlKey || event.altKey || event.isComposing) return;
|
|
@@ -46031,10 +46040,10 @@ function FormStage({
|
|
|
46031
46040
|
}
|
|
46032
46041
|
for (const key of held) target.dispatchEvent(new KeyboardEvent("keydown", { key, bubbles: true, cancelable: true }));
|
|
46033
46042
|
}, [live, at]);
|
|
46034
|
-
|
|
46043
|
+
useEffect106(() => {
|
|
46035
46044
|
if (!routingNow) pourTypedAhead();
|
|
46036
46045
|
}, [routingNow, at, pourTypedAhead]);
|
|
46037
|
-
const advanceRef =
|
|
46046
|
+
const advanceRef = useRef58(advance);
|
|
46038
46047
|
advanceRef.current = advance;
|
|
46039
46048
|
const chosen = useCallback55(() => {
|
|
46040
46049
|
if (!oneAtATime || !choose) return;
|
|
@@ -46056,23 +46065,23 @@ function FormStage({
|
|
|
46056
46065
|
if (event.shiftKey) retreat();
|
|
46057
46066
|
else advance();
|
|
46058
46067
|
}
|
|
46059
|
-
|
|
46068
|
+
useEffect106(() => {
|
|
46060
46069
|
const input = stage.current?.querySelector("[role='radio'][aria-checked='true']") ?? stage.current?.querySelector(
|
|
46061
46070
|
"input:not([tabindex='-1']), textarea, select, [role='combobox'], [role='radio'], [role='checkbox']"
|
|
46062
46071
|
);
|
|
46063
46072
|
input?.focus();
|
|
46064
46073
|
pourTypedAhead();
|
|
46065
46074
|
}, [index, done, started]);
|
|
46066
|
-
const startTold =
|
|
46067
|
-
|
|
46075
|
+
const startTold = useRef58(false);
|
|
46076
|
+
useEffect106(() => {
|
|
46068
46077
|
if (startTold.current || !onStart) return;
|
|
46069
46078
|
if (Object.values(answers).some((v) => v !== void 0 && v !== null && v !== "")) {
|
|
46070
46079
|
startTold.current = true;
|
|
46071
46080
|
onStart();
|
|
46072
46081
|
}
|
|
46073
46082
|
}, [answers, onStart]);
|
|
46074
|
-
const shownTold =
|
|
46075
|
-
|
|
46083
|
+
const shownTold = useRef58(/* @__PURE__ */ new Set());
|
|
46084
|
+
useEffect106(() => {
|
|
46076
46085
|
if (!onQuestionShown || !started || done) return;
|
|
46077
46086
|
for (const q of oneAtATime ? current ? [current] : [] : live) {
|
|
46078
46087
|
if (shownTold.current.has(q.key)) continue;
|
|
@@ -46256,7 +46265,7 @@ function ThankYou({
|
|
|
46256
46265
|
const title = rawTitle ? pipe(rawTitle) : rawTitle;
|
|
46257
46266
|
const body = rawBody ? pipe(rawBody) : rawBody;
|
|
46258
46267
|
const going = redirect !== null && done !== "preview";
|
|
46259
|
-
|
|
46268
|
+
useEffect106(() => {
|
|
46260
46269
|
if (!going || !redirect) return;
|
|
46261
46270
|
const timer = window.setTimeout(() => window.location.assign(redirect), REDIRECT_AFTER_MS);
|
|
46262
46271
|
return () => window.clearTimeout(timer);
|
|
@@ -46456,7 +46465,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
|
|
|
46456
46465
|
const [restoredAt, setRestoredAt] = useState127(null);
|
|
46457
46466
|
const [showResults, setShowResults] = useState127(false);
|
|
46458
46467
|
const [adding, setAdding] = useState127(false);
|
|
46459
|
-
const keysBeforeAdd =
|
|
46468
|
+
const keysBeforeAdd = useRef59(null);
|
|
46460
46469
|
const [makeOnMount, setMakeOnMount] = useState127("waiting");
|
|
46461
46470
|
const publicOrigin = host.publicOrigin ?? (typeof window === "undefined" ? "" : window.location.origin);
|
|
46462
46471
|
const load = useCallback56(async () => {
|
|
@@ -46486,10 +46495,10 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
|
|
|
46486
46495
|
setError(null);
|
|
46487
46496
|
setForms(mine);
|
|
46488
46497
|
}, [client, tableId, seed, claimSeed]);
|
|
46489
|
-
|
|
46498
|
+
useEffect107(() => {
|
|
46490
46499
|
void load();
|
|
46491
46500
|
}, [load]);
|
|
46492
|
-
|
|
46501
|
+
useEffect107(() => {
|
|
46493
46502
|
let cancelled = false;
|
|
46494
46503
|
Promise.resolve().then(() => client.formKnobs()).then((r) => {
|
|
46495
46504
|
if (!cancelled && r.ok) setOrgKnobs(r.data);
|
|
@@ -46498,7 +46507,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
|
|
|
46498
46507
|
cancelled = true;
|
|
46499
46508
|
};
|
|
46500
46509
|
}, [client]);
|
|
46501
|
-
|
|
46510
|
+
useEffect107(() => {
|
|
46502
46511
|
if (!forms || forms.length === 0) return;
|
|
46503
46512
|
if (createOnMount && makeOnMount !== "made") return;
|
|
46504
46513
|
const chosen = forms.find((f) => f.id === (activeFormId ?? activeId)) ?? forms[0];
|
|
@@ -46522,7 +46531,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
|
|
|
46522
46531
|
);
|
|
46523
46532
|
const stored = useMemo73(() => draft ? (forms ?? []).find((f) => f.id === draft.id) ?? null : null, [draft, forms]);
|
|
46524
46533
|
const dirty = Boolean(draft && stored && !sameForm(draft, stored));
|
|
46525
|
-
|
|
46534
|
+
useEffect107(() => {
|
|
46526
46535
|
if (!draft || !stored) return;
|
|
46527
46536
|
const timer = window.setTimeout(() => {
|
|
46528
46537
|
if (sameForm(draft, stored)) dropKeptDraft(draft.id);
|
|
@@ -46531,7 +46540,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
|
|
|
46531
46540
|
return () => window.clearTimeout(timer);
|
|
46532
46541
|
}, [draft, stored]);
|
|
46533
46542
|
const lookKey = draft ? JSON.stringify(formLookDocument(draft.look ?? null)) : null;
|
|
46534
|
-
|
|
46543
|
+
useEffect107(() => {
|
|
46535
46544
|
if (lookKey === null) return;
|
|
46536
46545
|
let cancelled = false;
|
|
46537
46546
|
const timer = window.setTimeout(() => {
|
|
@@ -46548,7 +46557,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
|
|
|
46548
46557
|
window.clearTimeout(timer);
|
|
46549
46558
|
};
|
|
46550
46559
|
}, [client, lookKey]);
|
|
46551
|
-
|
|
46560
|
+
useEffect107(() => {
|
|
46552
46561
|
const before = keysBeforeAdd.current;
|
|
46553
46562
|
if (!before || !fields.data) return;
|
|
46554
46563
|
const made = askableFields(fields.data).filter((f) => !before.has(f.key));
|
|
@@ -46659,14 +46668,14 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
|
|
|
46659
46668
|
return true;
|
|
46660
46669
|
}
|
|
46661
46670
|
const [started, setStarted] = useState127(false);
|
|
46662
|
-
|
|
46671
|
+
useEffect107(() => {
|
|
46663
46672
|
if (!startWithOne || started || forms === null || forms.length > 0) return;
|
|
46664
46673
|
if (askableFields(fields.data ?? []).length === 0) return;
|
|
46665
46674
|
if (!table.data && !table.error) return;
|
|
46666
46675
|
setStarted(true);
|
|
46667
46676
|
void create(table.data?.name?.trim() ? `${table.data.name.trim()} form` : "Form 1");
|
|
46668
46677
|
}, [startWithOne, started, forms, fields.data, create, table.data, table.error]);
|
|
46669
|
-
|
|
46678
|
+
useEffect107(() => {
|
|
46670
46679
|
if (!createOnMount || makeOnMount !== "waiting" || forms === null) return;
|
|
46671
46680
|
if (!table.data && !table.error) return;
|
|
46672
46681
|
if (askableFields(fields.data ?? []).length === 0) {
|
|
@@ -47257,8 +47266,8 @@ function NotifyOnAnswer({
|
|
|
47257
47266
|
const [error, setError] = useState127(null);
|
|
47258
47267
|
const [said2, setSaid] = useState127(null);
|
|
47259
47268
|
const [url, setUrl] = useState127(notify?.webhookUrl ?? "");
|
|
47260
|
-
|
|
47261
|
-
|
|
47269
|
+
useEffect107(() => setUrl(notify?.webhookUrl ?? ""), [notify?.webhookUrl]);
|
|
47270
|
+
useEffect107(() => {
|
|
47262
47271
|
let cancelled = false;
|
|
47263
47272
|
void client.subscriptions({ table_id: tableId }).then((r) => {
|
|
47264
47273
|
if (!cancelled && r.ok) setSubs(r.data);
|
|
@@ -47389,7 +47398,7 @@ function NotifyOnAnswer({
|
|
|
47389
47398
|
}
|
|
47390
47399
|
|
|
47391
47400
|
// src/DocTemplate.tsx
|
|
47392
|
-
import { useCallback as useCallback57, useEffect as
|
|
47401
|
+
import { useCallback as useCallback57, useEffect as useEffect108, useState as useState128 } from "react";
|
|
47393
47402
|
import { useFields as useFields29, useRecordsClient as useRecordsClient90, useTable as useTable31 } from "@ai-matrx/records/react";
|
|
47394
47403
|
import { BasicInput as BasicInput30, BasicTextarea as BasicTextarea12, Button as Button99, Label as Label26, Skeleton as Skeleton33, cn as cn85 } from "@ai-matrx/design-system";
|
|
47395
47404
|
import { jsx as jsx152, jsxs as jsxs140 } from "react/jsx-runtime";
|
|
@@ -47437,10 +47446,10 @@ function DocTemplate({ tableId, seed, activeTemplateId, onActiveTemplate, classN
|
|
|
47437
47446
|
setError(null);
|
|
47438
47447
|
setTemplates(rows);
|
|
47439
47448
|
}, [client, tableId, seed, fields.data]);
|
|
47440
|
-
|
|
47449
|
+
useEffect108(() => {
|
|
47441
47450
|
void load();
|
|
47442
47451
|
}, [load]);
|
|
47443
|
-
|
|
47452
|
+
useEffect108(() => {
|
|
47444
47453
|
if (!templates || templates.length === 0) return;
|
|
47445
47454
|
const chosen = templates.find((t) => t.id === (activeTemplateId ?? activeId)) ?? templates[0];
|
|
47446
47455
|
if (chosen.id !== activeId) setActiveId(chosen.id);
|
|
@@ -47448,7 +47457,7 @@ function DocTemplate({ tableId, seed, activeTemplateId, onActiveTemplate, classN
|
|
|
47448
47457
|
setDraftBody(chosen.body);
|
|
47449
47458
|
onActiveTemplate?.(chosen);
|
|
47450
47459
|
}, [templates, activeTemplateId]);
|
|
47451
|
-
|
|
47460
|
+
useEffect108(() => {
|
|
47452
47461
|
let cancelled = false;
|
|
47453
47462
|
if (draftBody.trim() === "") {
|
|
47454
47463
|
setUnresolved([]);
|
|
@@ -47573,7 +47582,7 @@ function DocTemplate({ tableId, seed, activeTemplateId, onActiveTemplate, classN
|
|
|
47573
47582
|
}
|
|
47574
47583
|
|
|
47575
47584
|
// src/DocRender.tsx
|
|
47576
|
-
import { useCallback as useCallback58, useEffect as
|
|
47585
|
+
import { useCallback as useCallback58, useEffect as useEffect109, useRef as useRef60, useState as useState129 } from "react";
|
|
47577
47586
|
import { useRecordsClient as useRecordsClient91 } from "@ai-matrx/records/react";
|
|
47578
47587
|
import { Button as Button100, Skeleton as Skeleton34, cn as cn86 } from "@ai-matrx/design-system";
|
|
47579
47588
|
import { jsx as jsx153, jsxs as jsxs141 } from "react/jsx-runtime";
|
|
@@ -47584,7 +47593,7 @@ function DocRender({ templateId, recordId, filename, onRendered, className }) {
|
|
|
47584
47593
|
const [showing, setShowing] = useState129(null);
|
|
47585
47594
|
const [error, setError] = useState129(null);
|
|
47586
47595
|
const [busy, setBusy] = useState129(null);
|
|
47587
|
-
const paper =
|
|
47596
|
+
const paper = useRef60(null);
|
|
47588
47597
|
const load = useCallback58(async () => {
|
|
47589
47598
|
const [body, held] = await Promise.all([
|
|
47590
47599
|
client.docRenderBody({ template_id: templateId, record_id: recordId }),
|
|
@@ -47602,7 +47611,7 @@ function DocRender({ templateId, recordId, filename, onRendered, className }) {
|
|
|
47602
47611
|
setPreview(body.data);
|
|
47603
47612
|
setRenders(held.data.filter((r) => r.template_id === templateId));
|
|
47604
47613
|
}, [client, templateId, recordId]);
|
|
47605
|
-
|
|
47614
|
+
useEffect109(() => {
|
|
47606
47615
|
void load();
|
|
47607
47616
|
}, [load]);
|
|
47608
47617
|
async function freeze() {
|
|
@@ -47689,7 +47698,7 @@ function DocRender({ templateId, recordId, filename, onRendered, className }) {
|
|
|
47689
47698
|
}
|
|
47690
47699
|
|
|
47691
47700
|
// src/SignBlock.tsx
|
|
47692
|
-
import { useCallback as useCallback59, useEffect as
|
|
47701
|
+
import { useCallback as useCallback59, useEffect as useEffect110, useState as useState130 } from "react";
|
|
47693
47702
|
import { useFields as useFields30, useRecordsClient as useRecordsClient92 } from "@ai-matrx/records/react";
|
|
47694
47703
|
import { BasicInput as BasicInput31, Button as Button101, Skeleton as Skeleton35, cn as cn87 } from "@ai-matrx/design-system";
|
|
47695
47704
|
import { useTable as useTable32 } from "@ai-matrx/records/react";
|
|
@@ -47719,7 +47728,7 @@ function SignBlock({ tableId, recordId, render, className }) {
|
|
|
47719
47728
|
}
|
|
47720
47729
|
setVerdicts(answers);
|
|
47721
47730
|
}, [client, recordId]);
|
|
47722
|
-
|
|
47731
|
+
useEffect110(() => {
|
|
47723
47732
|
void load();
|
|
47724
47733
|
}, [load]);
|
|
47725
47734
|
async function sign(field2) {
|
|
@@ -47840,7 +47849,7 @@ function SignBlock({ tableId, recordId, render, className }) {
|
|
|
47840
47849
|
}
|
|
47841
47850
|
|
|
47842
47851
|
// src/NotifyRuleEditor.tsx
|
|
47843
|
-
import { useCallback as useCallback60, useEffect as
|
|
47852
|
+
import { useCallback as useCallback60, useEffect as useEffect111, useState as useState131 } from "react";
|
|
47844
47853
|
import { useRecordsClient as useRecordsClient93, useTable as useTable33 } from "@ai-matrx/records/react";
|
|
47845
47854
|
import { hasQuietHours as hasQuietHours3 } from "@ai-matrx/records";
|
|
47846
47855
|
import { Button as Button102, Skeleton as Skeleton36, cn as cn88 } from "@ai-matrx/design-system";
|
|
@@ -47886,7 +47895,7 @@ function NotifyRuleEditor({ tableId, seed, chosenRuleId, onChoose, className })
|
|
|
47886
47895
|
}
|
|
47887
47896
|
setViews(listed.data.map((v) => ({ id: v.view_id, name: v.name })));
|
|
47888
47897
|
}, [client, host, tableId]);
|
|
47889
|
-
|
|
47898
|
+
useEffect111(() => {
|
|
47890
47899
|
void load();
|
|
47891
47900
|
}, [load]);
|
|
47892
47901
|
const write = useCallback60(
|
|
@@ -47914,7 +47923,7 @@ function NotifyRuleEditor({ tableId, seed, chosenRuleId, onChoose, className })
|
|
|
47914
47923
|
},
|
|
47915
47924
|
[client, tableId]
|
|
47916
47925
|
);
|
|
47917
|
-
|
|
47926
|
+
useEffect111(() => {
|
|
47918
47927
|
if (!subscriptions || !seed || seed.length === 0) return;
|
|
47919
47928
|
const missing = seed.filter((s) => !subscriptions.some((held) => held.name === s.name));
|
|
47920
47929
|
if (missing.length === 0) return;
|
|
@@ -48095,7 +48104,7 @@ function NotifyRuleEditor({ tableId, seed, chosenRuleId, onChoose, className })
|
|
|
48095
48104
|
}
|
|
48096
48105
|
|
|
48097
48106
|
// src/DashboardCanvas.tsx
|
|
48098
|
-
import { useCallback as useCallback61, useEffect as
|
|
48107
|
+
import { useCallback as useCallback61, useEffect as useEffect112, useMemo as useMemo75, useState as useState133 } from "react";
|
|
48099
48108
|
import { useFields as useFields32, useRecordsClient as useRecordsClient95, useTable as useTable34 } from "@ai-matrx/records/react";
|
|
48100
48109
|
import {
|
|
48101
48110
|
BasicInput as BasicInput32,
|
|
@@ -48504,10 +48513,10 @@ function DashboardCanvas({ tableId, activeDashboardId, filter, createOnMount, on
|
|
|
48504
48513
|
return read;
|
|
48505
48514
|
}, [client, tableId]);
|
|
48506
48515
|
const [notKept, setNotKept] = useState133(null);
|
|
48507
|
-
|
|
48516
|
+
useEffect112(() => {
|
|
48508
48517
|
void load();
|
|
48509
48518
|
}, [load]);
|
|
48510
|
-
|
|
48519
|
+
useEffect112(() => {
|
|
48511
48520
|
if (!boards || boards.length === 0) return;
|
|
48512
48521
|
if (createOnMount && madeOnMount !== "done") return;
|
|
48513
48522
|
const chosen = boards.find((d) => d.id === (activeDashboardId ?? activeId)) ?? boards[0];
|
|
@@ -48515,7 +48524,7 @@ function DashboardCanvas({ tableId, activeDashboardId, filter, createOnMount, on
|
|
|
48515
48524
|
}, [boards, activeDashboardId, madeOnMount]);
|
|
48516
48525
|
const board = useMemo75(() => boards?.find((d) => d.id === activeId) ?? null, [boards, activeId]);
|
|
48517
48526
|
const filterKey = JSON.stringify(filter ?? {});
|
|
48518
|
-
|
|
48527
|
+
useEffect112(() => {
|
|
48519
48528
|
if (!activeId) {
|
|
48520
48529
|
setRun(null);
|
|
48521
48530
|
return;
|
|
@@ -48585,7 +48594,7 @@ function DashboardCanvas({ tableId, activeDashboardId, filter, createOnMount, on
|
|
|
48585
48594
|
]
|
|
48586
48595
|
);
|
|
48587
48596
|
}
|
|
48588
|
-
|
|
48597
|
+
useEffect112(() => {
|
|
48589
48598
|
if (!createOnMount || madeOnMount !== "waiting" || boards === null || !fields.data) return;
|
|
48590
48599
|
setMadeOnMount("making");
|
|
48591
48600
|
void create().then(() => setMadeOnMount("done"));
|
|
@@ -49033,7 +49042,7 @@ function TargetControl({
|
|
|
49033
49042
|
const [mode, setMode] = useState133(saved);
|
|
49034
49043
|
const savedValue = block.target && "value" in block.target && typeof block.target.value === "number" ? block.target.value : null;
|
|
49035
49044
|
const [draft, setDraft] = useState133(savedValue === null ? "" : String(savedValue));
|
|
49036
|
-
|
|
49045
|
+
useEffect112(() => {
|
|
49037
49046
|
setMode(saved);
|
|
49038
49047
|
setDraft(savedValue === null ? "" : String(savedValue));
|
|
49039
49048
|
}, [saved, savedValue]);
|
|
@@ -49101,7 +49110,7 @@ function TargetControl({
|
|
|
49101
49110
|
|
|
49102
49111
|
// src/QuestionPanel.tsx
|
|
49103
49112
|
import { copyText as copyText9 } from "@ai-matrx/kit/clipboard";
|
|
49104
|
-
import { useEffect as
|
|
49113
|
+
import { useEffect as useEffect113, useMemo as useMemo76, useRef as useRef61, useState as useState134 } from "react";
|
|
49105
49114
|
import { Badge as Badge24, BasicInput as BasicInput33, Button as Button105, Checkbox as Checkbox18, Label as Label27, Skeleton as Skeleton38, cn as cn91 } from "@ai-matrx/design-system";
|
|
49106
49115
|
import { useFields as useFields33, useRecordsClient as useRecordsClient96 } from "@ai-matrx/records/react";
|
|
49107
49116
|
|
|
@@ -49157,7 +49166,7 @@ function QuestionPanel({ tableId, activeQuestionId, draft, className }) {
|
|
|
49157
49166
|
const me = client.config.actor?.user_id ?? null;
|
|
49158
49167
|
const [hidden, setHidden] = useState134(null);
|
|
49159
49168
|
const [related, setRelated] = useState134({});
|
|
49160
|
-
|
|
49169
|
+
useEffect113(() => {
|
|
49161
49170
|
if (all.length === 0) {
|
|
49162
49171
|
if (!fields.loading) setHidden(/* @__PURE__ */ new Set());
|
|
49163
49172
|
return;
|
|
@@ -49190,8 +49199,8 @@ function QuestionPanel({ tableId, activeQuestionId, draft, className }) {
|
|
|
49190
49199
|
const [saveError, setSaveError] = useState134(null);
|
|
49191
49200
|
const [saving, setSaving] = useState134(false);
|
|
49192
49201
|
const [linkMissed, setLinkMissed] = useState134(false);
|
|
49193
|
-
const openedFromLink =
|
|
49194
|
-
|
|
49202
|
+
const openedFromLink = useRef61(false);
|
|
49203
|
+
useEffect113(() => {
|
|
49195
49204
|
let live = true;
|
|
49196
49205
|
void (0, question_exports.questionsOf)(client, tableId).then((answer2) => {
|
|
49197
49206
|
if (!live) return;
|
|
@@ -49214,7 +49223,7 @@ function QuestionPanel({ tableId, activeQuestionId, draft, className }) {
|
|
|
49214
49223
|
setShared(q ? q.shared : true);
|
|
49215
49224
|
setSaveError(null);
|
|
49216
49225
|
};
|
|
49217
|
-
|
|
49226
|
+
useEffect113(() => {
|
|
49218
49227
|
if (!draft) return;
|
|
49219
49228
|
open(null);
|
|
49220
49229
|
setSpec(draft);
|
|
@@ -49223,7 +49232,7 @@ function QuestionPanel({ tableId, activeQuestionId, draft, className }) {
|
|
|
49223
49232
|
const [answer, setAnswer] = useState134(null);
|
|
49224
49233
|
const [asking, setAsking] = useState134(false);
|
|
49225
49234
|
const specKey = JSON.stringify(spec);
|
|
49226
|
-
|
|
49235
|
+
useEffect113(() => {
|
|
49227
49236
|
if (all.length === 0) return;
|
|
49228
49237
|
let live = true;
|
|
49229
49238
|
setAsking(true);
|
|
@@ -49665,7 +49674,7 @@ function QuestionAnswerView({ tableId, spec, answer, fields, related = NO_RELATE
|
|
|
49665
49674
|
}
|
|
49666
49675
|
|
|
49667
49676
|
// src/TableAsk.tsx
|
|
49668
|
-
import { useEffect as
|
|
49677
|
+
import { useEffect as useEffect114, useState as useState135 } from "react";
|
|
49669
49678
|
import { formatPoints as formatPoints2 } from "@ai-matrx/kit/format";
|
|
49670
49679
|
import { BasicInput as BasicInput34, Button as Button106, Popover as Popover18, PopoverContent as PopoverContent18, PopoverTrigger as PopoverTrigger18, Skeleton as Skeleton39 } from "@ai-matrx/design-system";
|
|
49671
49680
|
import { optionLabel as optionLabel4 } from "@ai-matrx/records";
|
|
@@ -49983,7 +49992,7 @@ function useNames(tableId, ids) {
|
|
|
49983
49992
|
const [names, setNames] = useState135({});
|
|
49984
49993
|
const titleField = table.data?.title_field ?? null;
|
|
49985
49994
|
const key = ids.join("|");
|
|
49986
|
-
|
|
49995
|
+
useEffect114(() => {
|
|
49987
49996
|
let live = true;
|
|
49988
49997
|
void Promise.all(
|
|
49989
49998
|
ids.map(async (id) => {
|
|
@@ -50075,7 +50084,7 @@ function AgentAnswer({
|
|
|
50075
50084
|
}
|
|
50076
50085
|
|
|
50077
50086
|
// src/PageScreen.tsx
|
|
50078
|
-
import { useCallback as useCallback62, useEffect as
|
|
50087
|
+
import { useCallback as useCallback62, useEffect as useEffect115, useMemo as useMemo77, useState as useState136 } from "react";
|
|
50079
50088
|
import {
|
|
50080
50089
|
useFields as useFields35,
|
|
50081
50090
|
useRecordPage as useRecordPage3,
|
|
@@ -50133,7 +50142,7 @@ function PageScreen({
|
|
|
50133
50142
|
},
|
|
50134
50143
|
[client]
|
|
50135
50144
|
);
|
|
50136
|
-
|
|
50145
|
+
useEffect115(() => {
|
|
50137
50146
|
if (!newOnTable || pageId || making !== "waiting") return;
|
|
50138
50147
|
setMaking("making");
|
|
50139
50148
|
void client.dashboardDeclare({
|
|
@@ -50153,11 +50162,11 @@ function PageScreen({
|
|
|
50153
50162
|
onCreated?.(made.data);
|
|
50154
50163
|
});
|
|
50155
50164
|
}, [client, newOnTable, pageId, making, load, onCreated]);
|
|
50156
|
-
|
|
50165
|
+
useEffect115(() => {
|
|
50157
50166
|
if (!pageId) return;
|
|
50158
50167
|
void load(pageId);
|
|
50159
50168
|
}, [pageId, load]);
|
|
50160
|
-
|
|
50169
|
+
useEffect115(() => {
|
|
50161
50170
|
if (!id) return;
|
|
50162
50171
|
let live = true;
|
|
50163
50172
|
void client.myLevels({ ids: [id], subject: "record" }).then((answered) => {
|
|
@@ -50169,7 +50178,7 @@ function PageScreen({
|
|
|
50169
50178
|
}, [client, id]);
|
|
50170
50179
|
const canEdit = level !== null && EDIT_LEVELS.has(level);
|
|
50171
50180
|
const chartKey = page ? JSON.stringify(page.blocks.map((b) => b.id)) + page.version : "";
|
|
50172
|
-
|
|
50181
|
+
useEffect115(() => {
|
|
50173
50182
|
if (!page || page.blocks.length === 0) {
|
|
50174
50183
|
setRun(null);
|
|
50175
50184
|
return;
|
|
@@ -50415,7 +50424,7 @@ function AppletBlockView({ block }) {
|
|
|
50415
50424
|
function AppletPick({ value, onChange }) {
|
|
50416
50425
|
const host = useRecordsUi();
|
|
50417
50426
|
const [options, setOptions] = useState136(null);
|
|
50418
|
-
|
|
50427
|
+
useEffect115(() => {
|
|
50419
50428
|
let live = true;
|
|
50420
50429
|
host.applets?.list().then((apps) => live && setOptions(apps.map((a) => ({ value: a.id, label: a.name })))).catch(() => live && setOptions([]));
|
|
50421
50430
|
return () => {
|
|
@@ -50452,7 +50461,7 @@ function ListBlockView({
|
|
|
50452
50461
|
const fields = useFields35(block.table_id);
|
|
50453
50462
|
const all = useMemo77(() => onePerKey3(fields.data ?? []), [fields.data]);
|
|
50454
50463
|
const [view, setView] = useState136(block.view_id ? "reading" : null);
|
|
50455
|
-
|
|
50464
|
+
useEffect115(() => {
|
|
50456
50465
|
if (!block.view_id) {
|
|
50457
50466
|
setView(null);
|
|
50458
50467
|
return;
|
|
@@ -50470,7 +50479,7 @@ function ListBlockView({
|
|
|
50470
50479
|
}, [client, block.table_id, block.view_id]);
|
|
50471
50480
|
const meField = block.me_field ? all.find((f) => f.key === block.me_field) : void 0;
|
|
50472
50481
|
const [me, setMe] = useState136(null);
|
|
50473
|
-
|
|
50482
|
+
useEffect115(() => {
|
|
50474
50483
|
if (!mine || !meField?.relation_target || !viewerUserId) {
|
|
50475
50484
|
setMe(null);
|
|
50476
50485
|
return;
|
|
@@ -50500,12 +50509,12 @@ function ListBlockView({
|
|
|
50500
50509
|
...sort.length > 0 ? { sort } : {}
|
|
50501
50510
|
});
|
|
50502
50511
|
const reload = page.reload;
|
|
50503
|
-
|
|
50512
|
+
useEffect115(() => onRecordChanged2(() => reload()), [reload]);
|
|
50504
50513
|
const rows = nobodyIsMe ? [] : page.data?.rows ?? [];
|
|
50505
50514
|
const columns = block.columns && block.columns.length > 0 ? block.columns.map((k) => all.find((f) => f.key === k)).filter((f) => !!f) : [...all].sort((a, b) => (a.sort ?? 100) - (b.sort ?? 100)).slice(0, DEFAULT_COLUMNS);
|
|
50506
50515
|
const firstId = rows[0]?.id ?? null;
|
|
50507
50516
|
const stillThere = selected !== null && rows.some((r) => r.id === selected);
|
|
50508
|
-
|
|
50517
|
+
useEffect115(() => {
|
|
50509
50518
|
if (page.loading || waiting) return;
|
|
50510
50519
|
if (!stillThere) onSelect(firstId);
|
|
50511
50520
|
}, [firstId, stillThere, page.loading, waiting]);
|
|
@@ -50572,7 +50581,7 @@ function ActionButton2({ block, recordId }) {
|
|
|
50572
50581
|
const [running, setRunning] = useState136(false);
|
|
50573
50582
|
const [done, setDone] = useState136(null);
|
|
50574
50583
|
const [error, setError] = useState136(null);
|
|
50575
|
-
|
|
50584
|
+
useEffect115(() => {
|
|
50576
50585
|
setDone(null);
|
|
50577
50586
|
setError(null);
|
|
50578
50587
|
setAsking(false);
|
|
@@ -50613,7 +50622,7 @@ function FormBlockView({ block }) {
|
|
|
50613
50622
|
const client = useRecordsClient98();
|
|
50614
50623
|
const [form, setForm] = useState136("reading");
|
|
50615
50624
|
const [sent, setSent] = useState136(0);
|
|
50616
|
-
|
|
50625
|
+
useEffect115(() => {
|
|
50617
50626
|
if (!block.form_id) {
|
|
50618
50627
|
setForm(null);
|
|
50619
50628
|
return;
|
|
@@ -50741,7 +50750,7 @@ function ListSettings({ block, onChange }) {
|
|
|
50741
50750
|
const [views, setViews] = useState136([]);
|
|
50742
50751
|
const fields = useFields35(block.table_id);
|
|
50743
50752
|
const all = onePerKey3(fields.data ?? []);
|
|
50744
|
-
|
|
50753
|
+
useEffect115(() => {
|
|
50745
50754
|
let live = true;
|
|
50746
50755
|
void client.views({ table_id: block.table_id }).then((answered) => {
|
|
50747
50756
|
if (live) setViews(answered.ok ? answered.data : []);
|
|
@@ -50818,7 +50827,7 @@ function ActionPicker({ tableId, value, onChange }) {
|
|
|
50818
50827
|
function FormPicker({ tableId, value, onChange }) {
|
|
50819
50828
|
const client = useRecordsClient98();
|
|
50820
50829
|
const [forms, setForms] = useState136([]);
|
|
50821
|
-
|
|
50830
|
+
useEffect115(() => {
|
|
50822
50831
|
let live = true;
|
|
50823
50832
|
void client.forms({ table_id: tableId }).then((answered) => {
|
|
50824
50833
|
if (live) setForms(answered.ok ? answered.data : []);
|
|
@@ -50864,7 +50873,7 @@ function onePerKey3(all) {
|
|
|
50864
50873
|
|
|
50865
50874
|
// src/FormsPanel.tsx
|
|
50866
50875
|
import { copyText as copyText10 } from "@ai-matrx/kit/clipboard";
|
|
50867
|
-
import { useCallback as useCallback63, useEffect as
|
|
50876
|
+
import { useCallback as useCallback63, useEffect as useEffect116, useState as useState137 } from "react";
|
|
50868
50877
|
import { useRecordsClient as useRecordsClient99, useTable as useTable37 } from "@ai-matrx/records/react";
|
|
50869
50878
|
import { publicFormPath as publicFormPath2 } from "@ai-matrx/records";
|
|
50870
50879
|
import { Badge as Badge25, Button as Button108, Skeleton as Skeleton41, cn as cn93 } from "@ai-matrx/design-system";
|
|
@@ -50890,7 +50899,7 @@ function FormsPanel({ tableId, activeFormId, className }) {
|
|
|
50890
50899
|
const [archivedSaid, setArchivedSaid] = useState137(null);
|
|
50891
50900
|
const linked = activeFormId && forms !== null ? forms.find((f) => f.form_id === activeFormId) ?? null : null;
|
|
50892
50901
|
const linkedMissing = Boolean(activeFormId) && forms !== null && linked === null;
|
|
50893
|
-
|
|
50902
|
+
useEffect116(() => {
|
|
50894
50903
|
if (linked && rights.structure) setBuilding(true);
|
|
50895
50904
|
}, [linked, rights.structure]);
|
|
50896
50905
|
const load = useCallback63(async () => {
|
|
@@ -50903,7 +50912,7 @@ function FormsPanel({ tableId, activeFormId, className }) {
|
|
|
50903
50912
|
setError(null);
|
|
50904
50913
|
setForms(answered.data);
|
|
50905
50914
|
}, [client, tableId]);
|
|
50906
|
-
|
|
50915
|
+
useEffect116(() => {
|
|
50907
50916
|
void load();
|
|
50908
50917
|
}, [load]);
|
|
50909
50918
|
const toggle = useCallback63(
|
|
@@ -51048,12 +51057,12 @@ function FormsPanel({ tableId, activeFormId, className }) {
|
|
|
51048
51057
|
}
|
|
51049
51058
|
|
|
51050
51059
|
// src/CaptureSheet.tsx
|
|
51051
|
-
import { useCallback as useCallback65, useEffect as
|
|
51060
|
+
import { useCallback as useCallback65, useEffect as useEffect118, useRef as useRef63, useState as useState139 } from "react";
|
|
51052
51061
|
import { useFields as useFields36, useRecordsClient as useRecordsClient101, useTable as useTable38 } from "@ai-matrx/records/react";
|
|
51053
51062
|
import { Button as Button110, Input as Input9, Skeleton as Skeleton43, Textarea as Textarea8, cn as cn95 } from "@ai-matrx/design-system";
|
|
51054
51063
|
|
|
51055
51064
|
// src/CaptureRun.tsx
|
|
51056
|
-
import { useCallback as useCallback64, useEffect as
|
|
51065
|
+
import { useCallback as useCallback64, useEffect as useEffect117, useMemo as useMemo78, useRef as useRef62, useState as useState138 } from "react";
|
|
51057
51066
|
import {
|
|
51058
51067
|
coerceTypedAnswer as coerceTypedAnswer3,
|
|
51059
51068
|
coercionLabel,
|
|
@@ -51111,8 +51120,8 @@ function CaptureRun({ sheetId, face: given, className }) {
|
|
|
51111
51120
|
const [items, setItems] = useState138([]);
|
|
51112
51121
|
const [lastSynced, setLastSynced] = useState138(null);
|
|
51113
51122
|
const [sending, setSending] = useState138(false);
|
|
51114
|
-
const queueRef =
|
|
51115
|
-
|
|
51123
|
+
const queueRef = useRef62(null);
|
|
51124
|
+
useEffect117(() => {
|
|
51116
51125
|
const q2 = openCaptureQueue({
|
|
51117
51126
|
onChange: (c, all) => {
|
|
51118
51127
|
setCounts(c);
|
|
@@ -51150,7 +51159,7 @@ function CaptureRun({ sheetId, face: given, className }) {
|
|
|
51150
51159
|
void q2.sync().then(() => void q2.lastSyncedAt().then(setLastSynced));
|
|
51151
51160
|
return () => q2.dispose();
|
|
51152
51161
|
}, [client, host]);
|
|
51153
|
-
|
|
51162
|
+
useEffect117(() => {
|
|
51154
51163
|
if (given !== void 0) return;
|
|
51155
51164
|
let cancelled = false;
|
|
51156
51165
|
void client.captureOpen({ sheet_id: sheetId }).then((res) => {
|
|
@@ -51491,7 +51500,7 @@ function AdHocCaptureSheet({
|
|
|
51491
51500
|
const [error, setError] = useState139(null);
|
|
51492
51501
|
const [uploadError, setUploadError] = useState139(null);
|
|
51493
51502
|
const [flushing, setFlushing] = useState139(false);
|
|
51494
|
-
const queue =
|
|
51503
|
+
const queue = useRef63([]);
|
|
51495
51504
|
const keep = useCallback65(
|
|
51496
51505
|
async (next) => {
|
|
51497
51506
|
queue.current = next;
|
|
@@ -51500,7 +51509,7 @@ function AdHocCaptureSheet({
|
|
|
51500
51509
|
},
|
|
51501
51510
|
[host]
|
|
51502
51511
|
);
|
|
51503
|
-
|
|
51512
|
+
useEffect118(() => {
|
|
51504
51513
|
let cancelled = false;
|
|
51505
51514
|
void (async () => {
|
|
51506
51515
|
const held = host.captureQueue ? await host.captureQueue.load() : [];
|
|
@@ -51679,7 +51688,7 @@ function AdHocCaptureSheet({
|
|
|
51679
51688
|
}
|
|
51680
51689
|
|
|
51681
51690
|
// src/PortalShell.tsx
|
|
51682
|
-
import { useCallback as useCallback66, useEffect as
|
|
51691
|
+
import { useCallback as useCallback66, useEffect as useEffect119, useState as useState140 } from "react";
|
|
51683
51692
|
import { useRecordsClient as useRecordsClient102 } from "@ai-matrx/records/react";
|
|
51684
51693
|
import { Button as Button111, Skeleton as Skeleton44, cn as cn96 } from "@ai-matrx/design-system";
|
|
51685
51694
|
import { jsx as jsx165, jsxs as jsxs153 } from "react/jsx-runtime";
|
|
@@ -51705,7 +51714,7 @@ function PortalShell({ tableId, form, resourceType = "record", className }) {
|
|
|
51705
51714
|
}
|
|
51706
51715
|
setReach(reached.data.map((row) => row.resource_id));
|
|
51707
51716
|
}, [client, resourceType]);
|
|
51708
|
-
|
|
51717
|
+
useEffect119(() => {
|
|
51709
51718
|
void load();
|
|
51710
51719
|
}, [load]);
|
|
51711
51720
|
if (error) {
|
|
@@ -51765,7 +51774,7 @@ function PortalShell({ tableId, form, resourceType = "record", className }) {
|
|
|
51765
51774
|
function PortalRow({ tableId, recordId }) {
|
|
51766
51775
|
const client = useRecordsClient102();
|
|
51767
51776
|
const [title, setTitle] = useState140(null);
|
|
51768
|
-
|
|
51777
|
+
useEffect119(() => {
|
|
51769
51778
|
let cancelled = false;
|
|
51770
51779
|
void client.recordRead({ record_id: recordId }).then((answered) => {
|
|
51771
51780
|
if (cancelled) return;
|
|
@@ -51785,7 +51794,7 @@ function PortalRow({ tableId, recordId }) {
|
|
|
51785
51794
|
}
|
|
51786
51795
|
|
|
51787
51796
|
// src/PublicViewPage.tsx
|
|
51788
|
-
import { useCallback as useCallback67, useEffect as
|
|
51797
|
+
import { useCallback as useCallback67, useEffect as useEffect120, useState as useState141 } from "react";
|
|
51789
51798
|
import { useRecordsClient as useRecordsClient103 } from "@ai-matrx/records/react";
|
|
51790
51799
|
import { Skeleton as Skeleton45, cn as cn97 } from "@ai-matrx/design-system";
|
|
51791
51800
|
import { publicReadOf } from "@ai-matrx/records/forms";
|
|
@@ -51848,7 +51857,7 @@ function PublicViewPage({ slug, className }) {
|
|
|
51848
51857
|
}
|
|
51849
51858
|
setRows([{ id: chosen.recordId, document: read.data.document, level: "viewer", hidden: read.data.hidden }]);
|
|
51850
51859
|
}, [client, slug]);
|
|
51851
|
-
|
|
51860
|
+
useEffect120(() => {
|
|
51852
51861
|
void load();
|
|
51853
51862
|
}, [load]);
|
|
51854
51863
|
if (error) return /* @__PURE__ */ jsx166(RefusalNotice, { error, className });
|
|
@@ -51886,7 +51895,7 @@ function PublicRow({ row, fields }) {
|
|
|
51886
51895
|
|
|
51887
51896
|
// src/EmbedFrame.tsx
|
|
51888
51897
|
import { copyText as copyText11 } from "@ai-matrx/kit/clipboard";
|
|
51889
|
-
import { useCallback as useCallback68, useEffect as
|
|
51898
|
+
import { useCallback as useCallback68, useEffect as useEffect121, useState as useState142 } from "react";
|
|
51890
51899
|
import { useRecordsClient as useRecordsClient104 } from "@ai-matrx/records/react";
|
|
51891
51900
|
import { Button as Button112, Input as Input10, Skeleton as Skeleton46, Textarea as Textarea9, cn as cn98 } from "@ai-matrx/design-system";
|
|
51892
51901
|
import { useTable as useTable39 } from "@ai-matrx/records/react";
|
|
@@ -51999,7 +52008,7 @@ function useEmbedHandshake(args) {
|
|
|
51999
52008
|
const [loading, setLoading] = useState142(true);
|
|
52000
52009
|
const origin = args.origin ?? (typeof location === "undefined" ? "" : location.origin);
|
|
52001
52010
|
const { secret, requiredMode } = args;
|
|
52002
|
-
|
|
52011
|
+
useEffect121(() => {
|
|
52003
52012
|
let cancelled = false;
|
|
52004
52013
|
setLoading(true);
|
|
52005
52014
|
setError(null);
|
|
@@ -52022,7 +52031,7 @@ function useEmbedHandshake(args) {
|
|
|
52022
52031
|
|
|
52023
52032
|
// src/TablePage.tsx
|
|
52024
52033
|
import { copyText as copyText15 } from "@ai-matrx/kit/clipboard";
|
|
52025
|
-
import { useCallback as useCallback70, useEffect as
|
|
52034
|
+
import { useCallback as useCallback70, useEffect as useEffect124, useMemo as useMemo82, useRef as useRef64, useState as useState150 } from "react";
|
|
52026
52035
|
import { archivedByLine as archivedByLine2 } from "@ai-matrx/records";
|
|
52027
52036
|
import { tableShapeChanged as tableShapeChanged15, useFields as useFields39, useRecordsClient as useRecordsClient106, useSeededAnswer, useTable as useTable40, useTableArchive as useTableArchive2 } from "@ai-matrx/records/react";
|
|
52028
52037
|
import {
|
|
@@ -52605,7 +52614,7 @@ function TableDuplicateDialog({ tableId, name, open, onOpenChange, onDuplicated
|
|
|
52605
52614
|
}
|
|
52606
52615
|
|
|
52607
52616
|
// src/ViewFilter.tsx
|
|
52608
|
-
import { useEffect as
|
|
52617
|
+
import { useEffect as useEffect122, useMemo as useMemo81, useState as useState148 } from "react";
|
|
52609
52618
|
import { Button as Button118, Popover as Popover19, PopoverContent as PopoverContent19, PopoverTrigger as PopoverTrigger19 } from "@ai-matrx/design-system";
|
|
52610
52619
|
import { useFields as useFields38 } from "@ai-matrx/records/react";
|
|
52611
52620
|
import { jsx as jsx173, jsxs as jsxs161 } from "react/jsx-runtime";
|
|
@@ -52623,7 +52632,7 @@ function ViewFilter({ tableId, view, onApply, className }) {
|
|
|
52623
52632
|
const saved = view?.where ?? null;
|
|
52624
52633
|
const [draft, setDraft] = useState148(saved);
|
|
52625
52634
|
const savedKey = JSON.stringify(saved);
|
|
52626
|
-
|
|
52635
|
+
useEffect122(() => {
|
|
52627
52636
|
setDraft(saved);
|
|
52628
52637
|
}, [view?.id, savedKey]);
|
|
52629
52638
|
const conditionFields = useMemo81(
|
|
@@ -52798,7 +52807,7 @@ function phoneTableActions(actions) {
|
|
|
52798
52807
|
}
|
|
52799
52808
|
|
|
52800
52809
|
// src/toolbarFit.ts
|
|
52801
|
-
import { useEffect as
|
|
52810
|
+
import { useEffect as useEffect123, useLayoutEffect as useLayoutEffect6, useState as useState149 } from "react";
|
|
52802
52811
|
var FOLDED_GUESS = { look: 104, chooser: 96, tools: 120 };
|
|
52803
52812
|
var SLOT_MIN = 36;
|
|
52804
52813
|
function toolbarFold(input) {
|
|
@@ -52854,7 +52863,7 @@ function rowNeeds(row) {
|
|
|
52854
52863
|
}
|
|
52855
52864
|
return { needs: needs + gap * Math.max(0, pieces.length - 1), gap };
|
|
52856
52865
|
}
|
|
52857
|
-
var useIsoLayoutEffect = typeof window === "undefined" ?
|
|
52866
|
+
var useIsoLayoutEffect = typeof window === "undefined" ? useEffect123 : useLayoutEffect6;
|
|
52858
52867
|
function useToolbarFit(row) {
|
|
52859
52868
|
const [fold, setFold] = useState149(0);
|
|
52860
52869
|
useIsoLayoutEffect(() => {
|
|
@@ -52943,7 +52952,7 @@ function clippedEnds(scrollLeft, clientWidth, scrollWidth) {
|
|
|
52943
52952
|
}
|
|
52944
52953
|
function useSlotScroll(slot) {
|
|
52945
52954
|
const [ends, setEnds] = useState149("none");
|
|
52946
|
-
|
|
52955
|
+
useEffect123(() => {
|
|
52947
52956
|
if (!slot) return;
|
|
52948
52957
|
let pending = 0;
|
|
52949
52958
|
const read = () => {
|
|
@@ -53071,7 +53080,7 @@ function TableNotHere({
|
|
|
53071
53080
|
const [archived, setArchived] = useState150({ phase: "asking" });
|
|
53072
53081
|
const [restoring, setRestoring] = useState150(false);
|
|
53073
53082
|
const [refusal3, setRefusal] = useState150(null);
|
|
53074
|
-
|
|
53083
|
+
useEffect124(() => {
|
|
53075
53084
|
let alive = true;
|
|
53076
53085
|
void client.tableArchived({ table_id: tableId }).then((answered) => {
|
|
53077
53086
|
if (!alive) return;
|
|
@@ -53292,8 +53301,8 @@ function TablePage({
|
|
|
53292
53301
|
return seededViews.find((v) => v.id === asked3) ?? defaultViewOf(seededViews) ?? seededViews[0];
|
|
53293
53302
|
});
|
|
53294
53303
|
const [looks, setLooks] = useState150(() => seededViews ? seededOpening?.looks : void 0);
|
|
53295
|
-
const looksSeededFor =
|
|
53296
|
-
|
|
53304
|
+
const looksSeededFor = useRef64(seededViews && seededOpening ? tableId : null);
|
|
53305
|
+
useEffect124(() => {
|
|
53297
53306
|
if (looksSeededFor.current === tableId) {
|
|
53298
53307
|
looksSeededFor.current = null;
|
|
53299
53308
|
return;
|
|
@@ -53319,7 +53328,7 @@ function TablePage({
|
|
|
53319
53328
|
const opened = questionsFromLink ? { ...openedByPackage, main: "questions" } : openedByPackage;
|
|
53320
53329
|
const [views, setViews] = useState150(() => seededViews);
|
|
53321
53330
|
const [pickedViewId, setPickedViewId] = useState150(savedFromLink);
|
|
53322
|
-
const viewSeen =
|
|
53331
|
+
const viewSeen = useRef64(null);
|
|
53323
53332
|
const [viewLinkMissed, setViewLinkMissed] = useState150(false);
|
|
53324
53333
|
const railAsked = typeof activeRail === "string" ? activeRail.trim() : "";
|
|
53325
53334
|
const railUnknown = railAsked !== "" && railFromParam(railAsked) === null ? railAsked : null;
|
|
@@ -53342,7 +53351,7 @@ function TablePage({
|
|
|
53342
53351
|
const { open: renameOpen, setOpen: setRenameOpen, ask: askRename, menuContentProps: renameMenuProps } = useRenameFromMenu();
|
|
53343
53352
|
const [archiveAsked, setArchiveAsked] = useState150(0);
|
|
53344
53353
|
const pageArchive = useTableArchive2(tableId);
|
|
53345
|
-
const archiveRunning =
|
|
53354
|
+
const archiveRunning = useRef64(false);
|
|
53346
53355
|
const archiveFromMenu = useCallback70(async () => {
|
|
53347
53356
|
if (archiveRunning.current) return;
|
|
53348
53357
|
archiveRunning.current = true;
|
|
@@ -53405,7 +53414,7 @@ function TablePage({
|
|
|
53405
53414
|
const skeletonFace = skeletonLayoutFor(
|
|
53406
53415
|
faceUnknown && !layoutFromLink ? rememberedFace ?? shownLayout : shownLayout
|
|
53407
53416
|
);
|
|
53408
|
-
|
|
53417
|
+
useEffect124(() => {
|
|
53409
53418
|
if (embedded || faceUnknown || main !== "records" || opened.layout || !table.data) return;
|
|
53410
53419
|
rememberLayout(tableId, shownLayout);
|
|
53411
53420
|
}, [embedded, faceUnknown, main, shownLayout, tableId, table.data !== void 0]);
|
|
@@ -53423,9 +53432,9 @@ function TablePage({
|
|
|
53423
53432
|
lookDiffers: view ? lookDiffers(view, look) : false
|
|
53424
53433
|
};
|
|
53425
53434
|
const shownSignature = JSON.stringify(shownReport);
|
|
53426
|
-
const reportRef =
|
|
53435
|
+
const reportRef = useRef64(onShownViewChange);
|
|
53427
53436
|
reportRef.current = onShownViewChange;
|
|
53428
|
-
|
|
53437
|
+
useEffect124(() => {
|
|
53429
53438
|
reportRef.current?.(JSON.parse(shownSignature));
|
|
53430
53439
|
}, [shownSignature]);
|
|
53431
53440
|
const pickLayout = (next) => {
|
|
@@ -53434,18 +53443,18 @@ function TablePage({
|
|
|
53434
53443
|
onViewChanged?.(addressForView(view, next));
|
|
53435
53444
|
void patchView({ layout: next });
|
|
53436
53445
|
};
|
|
53437
|
-
|
|
53446
|
+
useEffect124(() => {
|
|
53438
53447
|
if (!activeRecordId) return;
|
|
53439
53448
|
setOpenRecord(activeRecordId);
|
|
53440
53449
|
setSurface((now) => ({ ...now, rail: "record" }));
|
|
53441
53450
|
}, [activeRecordId]);
|
|
53442
|
-
|
|
53451
|
+
useEffect124(() => {
|
|
53443
53452
|
if (activeRecordId) return;
|
|
53444
53453
|
const named = railFromParam(activeRail);
|
|
53445
53454
|
if (named === null || named === "share") return;
|
|
53446
53455
|
setSurface((now) => ({ ...now, rail: named }));
|
|
53447
53456
|
}, [activeRail, activeRecordId]);
|
|
53448
|
-
|
|
53457
|
+
useEffect124(() => {
|
|
53449
53458
|
const named = pageViewFromParam(activeView);
|
|
53450
53459
|
if (named === null) return;
|
|
53451
53460
|
const isLayout = named !== "dashboards" && named !== "archived";
|
|
@@ -53486,7 +53495,7 @@ function TablePage({
|
|
|
53486
53495
|
},
|
|
53487
53496
|
[client, tableId, view, looks, viewLocked, sayLocked]
|
|
53488
53497
|
);
|
|
53489
|
-
const arrival =
|
|
53498
|
+
const arrival = useRef64(viewAddress ?? null);
|
|
53490
53499
|
const [gridQuery, setGridQuery] = useState150(null);
|
|
53491
53500
|
const [addressResetEpoch, setAddressResetEpoch] = useState150(0);
|
|
53492
53501
|
const reportGrid = useCallback70((q) => {
|
|
@@ -53497,8 +53506,8 @@ function TablePage({
|
|
|
53497
53506
|
() => ({ initial: arrival.current, report: reportGrid, resetEpoch: addressResetEpoch }),
|
|
53498
53507
|
[reportGrid, addressResetEpoch]
|
|
53499
53508
|
);
|
|
53500
|
-
const hiddenApplied =
|
|
53501
|
-
|
|
53509
|
+
const hiddenApplied = useRef64(false);
|
|
53510
|
+
useEffect124(() => {
|
|
53502
53511
|
const hidden = arrival.current?.hidden;
|
|
53503
53512
|
if (hiddenApplied.current || !view || !looks || !hidden || hidden.length === 0) return;
|
|
53504
53513
|
hiddenApplied.current = true;
|
|
@@ -53518,10 +53527,10 @@ function TablePage({
|
|
|
53518
53527
|
const gridPending = !isViewAddressEmpty({ ...arrival.current ?? {}, hidden: [] });
|
|
53519
53528
|
const addressReady = Boolean(view && looks) && (gridQuery !== null || !gridPending);
|
|
53520
53529
|
const addressSignature = JSON.stringify(viewAddressToParams(addressNow));
|
|
53521
|
-
const addressReportRef =
|
|
53530
|
+
const addressReportRef = useRef64(onViewAddressChange);
|
|
53522
53531
|
addressReportRef.current = onViewAddressChange;
|
|
53523
|
-
const addressSent =
|
|
53524
|
-
|
|
53532
|
+
const addressSent = useRef64(null);
|
|
53533
|
+
useEffect124(() => {
|
|
53525
53534
|
if (!addressReady) return;
|
|
53526
53535
|
if (addressSent.current === null && addressSignature === JSON.stringify(viewAddressToParams(arrival.current))) {
|
|
53527
53536
|
addressSent.current = addressSignature;
|
|
@@ -53836,14 +53845,14 @@ function TablePage({
|
|
|
53836
53845
|
}
|
|
53837
53846
|
});
|
|
53838
53847
|
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;
|
|
53839
|
-
const actionsRef =
|
|
53848
|
+
const actionsRef = useRef64(actions);
|
|
53840
53849
|
actionsRef.current = actions;
|
|
53841
|
-
const onActionsRef =
|
|
53850
|
+
const onActionsRef = useRef64(onActions);
|
|
53842
53851
|
onActionsRef.current = onActions;
|
|
53843
|
-
|
|
53852
|
+
useEffect124(() => {
|
|
53844
53853
|
onActionsRef.current?.(actionsRef.current);
|
|
53845
53854
|
});
|
|
53846
|
-
|
|
53855
|
+
useEffect124(() => {
|
|
53847
53856
|
const onKey = (event) => {
|
|
53848
53857
|
const asked3 = objectActionForKey(actionsRef.current, event);
|
|
53849
53858
|
if (!asked3) return;
|
|
@@ -54411,7 +54420,7 @@ function usePublicReadOnly(client, organizationId, tableId, table, rights) {
|
|
|
54411
54420
|
const readOnly = rights.known && rights.read && !rights.write;
|
|
54412
54421
|
const marked = table?.published_to_web;
|
|
54413
54422
|
const [isPublic, setIsPublic] = useState150(false);
|
|
54414
|
-
|
|
54423
|
+
useEffect124(() => {
|
|
54415
54424
|
if (!readOnly || !table) {
|
|
54416
54425
|
setIsPublic(false);
|
|
54417
54426
|
return;
|
|
@@ -54437,7 +54446,7 @@ function usePublicReadOnly(client, organizationId, tableId, table, rights) {
|
|
|
54437
54446
|
import { formatCount as formatCount8 } from "@ai-matrx/kit/format";
|
|
54438
54447
|
import { TapTargetSearchGroup as TapTargetSearchGroup2, TooltipProvider } from "@ai-matrx/design-system";
|
|
54439
54448
|
import { MatrxTableCardShowMore as MatrxTableCardShowMore3 } from "@ai-matrx/design-system/data-table";
|
|
54440
|
-
import { useEffect as
|
|
54449
|
+
import { useEffect as useEffect125, useMemo as useMemo83, useRef as useRef65, useState as useState151 } from "react";
|
|
54441
54450
|
import { Button as Button120, ErrorBox as ErrorBox9, Input as Input13, cn as cn101 } from "@ai-matrx/design-system";
|
|
54442
54451
|
import { SEED_FRESH_MS, useRecordsClient as useRecordsClient107, useSeededAnswerAt } from "@ai-matrx/records/react";
|
|
54443
54452
|
import { Fragment as Fragment72, jsx as jsx176, jsxs as jsxs164 } from "react/jsx-runtime";
|
|
@@ -54544,8 +54553,8 @@ function EntityChartBlock({ source, kind, by, measure, title, where, organizatio
|
|
|
54544
54553
|
const base2 = { title: title ?? "", kind, measures, group_by: by ? [by] : [] };
|
|
54545
54554
|
const seeded = useSeededAnswerAt(`entity-chart:${ask2}`, (c) => c.drillAsk({ source, question }));
|
|
54546
54555
|
const [block, setBlock] = useState151(() => seeded ? blockOfAnswer({ ok: true, data: seeded.data }, base2, by) : null);
|
|
54547
|
-
const seededFor =
|
|
54548
|
-
|
|
54556
|
+
const seededFor = useRef65(seeded ? { ask: `${ask2}|${kind}|${title ?? ""}`, at: seeded.at } : null);
|
|
54557
|
+
useEffect125(() => {
|
|
54549
54558
|
const held = seededFor.current;
|
|
54550
54559
|
if (held && held.ask === `${ask2}|${kind}|${title ?? ""}` && Date.now() - held.at < SEED_FRESH_MS) return;
|
|
54551
54560
|
seededFor.current = null;
|
|
@@ -54594,7 +54603,7 @@ function EntityTablePageBody({
|
|
|
54594
54603
|
const term = searchOverride ?? typed2;
|
|
54595
54604
|
const entity = useEntityTable(source.token, { pageSize, search: term });
|
|
54596
54605
|
const [layout, setLayout] = useState151(opened);
|
|
54597
|
-
|
|
54606
|
+
useEffect125(() => setLayout(opened), [opened]);
|
|
54598
54607
|
const choose = (next) => {
|
|
54599
54608
|
setLayout(next);
|
|
54600
54609
|
onLayoutChange?.(next);
|
|
@@ -54720,7 +54729,7 @@ function TablePage2(props) {
|
|
|
54720
54729
|
}
|
|
54721
54730
|
|
|
54722
54731
|
// src/DataBindingPicker.tsx
|
|
54723
|
-
import { useEffect as
|
|
54732
|
+
import { useEffect as useEffect126, useMemo as useMemo84 } from "react";
|
|
54724
54733
|
import { isEntityReferenceConfig } from "@ai-matrx/records";
|
|
54725
54734
|
import { useFields as useFields40, useTable as useTable41 } from "@ai-matrx/records/react";
|
|
54726
54735
|
import { BasicInput as BasicInput36, Button as Button121, CreatablePicker as CreatablePicker3, cn as cn102 } from "@ai-matrx/design-system";
|
|
@@ -54816,7 +54825,7 @@ function BindingDetails({
|
|
|
54816
54825
|
const fields = useFields40(tableId);
|
|
54817
54826
|
const fieldList = useMemo84(() => fields.data ?? [], [fields.data]);
|
|
54818
54827
|
const shape = binding.semantic_type;
|
|
54819
|
-
|
|
54828
|
+
useEffect126(() => {
|
|
54820
54829
|
if (disabled || shape === "value" || binding.transform || fields.loading || fieldList.length === 0) return;
|
|
54821
54830
|
onChange({
|
|
54822
54831
|
...binding,
|
|
@@ -55038,7 +55047,7 @@ function RecordNameWords({ tableId, recordId }) {
|
|
|
55038
55047
|
}
|
|
55039
55048
|
|
|
55040
55049
|
// src/HeldChangeDecision.tsx
|
|
55041
|
-
import { useEffect as
|
|
55050
|
+
import { useEffect as useEffect127, useState as useState152 } from "react";
|
|
55042
55051
|
import { RecordsProvider as RecordsProvider3, useRecordsClient as useRecordsClient108 } from "@ai-matrx/records/react";
|
|
55043
55052
|
import { Button as Button122 } from "@ai-matrx/design-system";
|
|
55044
55053
|
import { jsx as jsx180, jsxs as jsxs167 } from "react/jsx-runtime";
|
|
@@ -55054,7 +55063,7 @@ function Decision({
|
|
|
55054
55063
|
const [may, setMay] = useState152(null);
|
|
55055
55064
|
const [busy, setBusy] = useState152(null);
|
|
55056
55065
|
const [error, setError] = useState152(null);
|
|
55057
|
-
|
|
55066
|
+
useEffect127(() => {
|
|
55058
55067
|
let live = true;
|
|
55059
55068
|
void client.workApprovalMayDecide({ approval_id: approvalId }).then((res) => {
|
|
55060
55069
|
if (!live) return;
|
|
@@ -55087,7 +55096,7 @@ function Decision({
|
|
|
55087
55096
|
}
|
|
55088
55097
|
|
|
55089
55098
|
// src/CalendarLinks.tsx
|
|
55090
|
-
import { useCallback as useCallback71, useEffect as
|
|
55099
|
+
import { useCallback as useCallback71, useEffect as useEffect128, useState as useState153 } from "react";
|
|
55091
55100
|
import { Button as Button123 } from "@ai-matrx/design-system";
|
|
55092
55101
|
import { jsx as jsx181, jsxs as jsxs168 } from "react/jsx-runtime";
|
|
55093
55102
|
var day = (iso) => iso ? new Date(iso).toLocaleDateString(void 0, { year: "numeric", month: "short", day: "numeric" }) : null;
|
|
@@ -55103,7 +55112,7 @@ function CalendarLinks({ port }) {
|
|
|
55103
55112
|
setError(asRefusal3(e, "The links could not be read"));
|
|
55104
55113
|
}
|
|
55105
55114
|
}, [port]);
|
|
55106
|
-
|
|
55115
|
+
useEffect128(() => {
|
|
55107
55116
|
void load();
|
|
55108
55117
|
}, [load]);
|
|
55109
55118
|
const act = async (run) => {
|
|
@@ -55168,7 +55177,7 @@ function CalendarLinks({ port }) {
|
|
|
55168
55177
|
}
|
|
55169
55178
|
|
|
55170
55179
|
// src/TemplatePreview.tsx
|
|
55171
|
-
import { useEffect as
|
|
55180
|
+
import { useEffect as useEffect129, useMemo as useMemo85, useState as useState154 } from "react";
|
|
55172
55181
|
import { templatePreview } from "@ai-matrx/records/memory";
|
|
55173
55182
|
import { useRecordsClient as useRecordsClient109 } from "@ai-matrx/records/react";
|
|
55174
55183
|
import { formFromSummary as formFromSummary3 } from "@ai-matrx/records/forms";
|
|
@@ -55220,7 +55229,7 @@ function PreviewForms({ preview, booking }) {
|
|
|
55220
55229
|
const client = useRecordsClient109();
|
|
55221
55230
|
const [forms, setForms] = useState154(null);
|
|
55222
55231
|
const [pages, setPages] = useState154([]);
|
|
55223
|
-
|
|
55232
|
+
useEffect129(() => {
|
|
55224
55233
|
let gone = false;
|
|
55225
55234
|
void client.forms().then((answered) => {
|
|
55226
55235
|
if (!gone) setForms(answered.ok ? answered.data.map(formFromSummary3) : []);
|