@ai-matrx/records-ui 0.115.94 → 0.115.96
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 +17 -0
- package/dist/index.cjs +103 -49
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +676 -622
- package/dist/index.js.map +1 -1
- package/dist/pickers.cjs +103 -49
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +127 -73
- package/dist/pickers.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -3985,7 +3985,7 @@ function ReferenceBuilder({
|
|
|
3985
3985
|
}
|
|
3986
3986
|
|
|
3987
3987
|
// src/gridEditing.tsx
|
|
3988
|
-
import { useCallback as useCallback10, useEffect as
|
|
3988
|
+
import { useCallback as useCallback10, useEffect as useEffect28, useMemo as useMemo15, useRef as useRef23, useState as useState37 } from "react";
|
|
3989
3989
|
import { isButtonField as isButtonField4 } from "@ai-matrx/records";
|
|
3990
3990
|
import { asWriteConflict, wholeValueOf as wholeValueOf2 } from "@ai-matrx/records/core";
|
|
3991
3991
|
import { useRecordsClient as useRecordsClient13 } from "@ai-matrx/records/react";
|
|
@@ -4738,7 +4738,7 @@ function AddChoicesInline({ field: field2, onAdded, disabled = false }) {
|
|
|
4738
4738
|
}
|
|
4739
4739
|
|
|
4740
4740
|
// src/editors.tsx
|
|
4741
|
-
import { useCallback as useCallback8, useEffect as
|
|
4741
|
+
import { useCallback as useCallback8, useEffect as useEffect25, useLayoutEffect as useLayoutEffect3, useRef as useRef20, useState as useState35 } from "react";
|
|
4742
4742
|
import { isButtonField as isButtonField3, allowsOtherValues, choiceValuesOf, coerceTypedAnswer, newerKindOf as newerKindOf5, decideTypedChoice, isTheChosen, optionKey as optionKey4, rankTypedMatches as rankTypedMatches4, readTypedTime as readTypedTime2, typedDateText as typedDateText2, typedTimeText as typedTimeText2 } from "@ai-matrx/records";
|
|
4743
4743
|
import { useOptionalRecordsClient as useOptionalRecordsClient12 } from "@ai-matrx/records/react";
|
|
4744
4744
|
import {
|
|
@@ -5407,7 +5407,7 @@ function RelationPicker({ field: field2, value, onChange, disabled, id, classNam
|
|
|
5407
5407
|
}
|
|
5408
5408
|
|
|
5409
5409
|
// src/buttonCell.tsx
|
|
5410
|
-
import { useState as useState30 } from "react";
|
|
5410
|
+
import { useEffect as useEffect22, useRef as useRef17, useState as useState30 } from "react";
|
|
5411
5411
|
import { Button as Button18, Dialog as Dialog2, DialogContent as DialogContent2, DialogDescription, DialogHeader as DialogHeader2, DialogTitle as DialogTitle2, Popover as Popover5, PopoverContent as PopoverContent5, PopoverTrigger as PopoverTrigger5, cn as cn24 } from "@ai-matrx/design-system";
|
|
5412
5412
|
import { CHOICE_CHIP_CLASS as CHOICE_CHIP_CLASS2, NEUTRAL_CHIP_CLASS as NEUTRAL_CHIP_CLASS2, isStyleColor as isStyleColor2 } from "@ai-matrx/design-system/data-table";
|
|
5413
5413
|
import { buttonNeeds as buttonNeeds2, buttonOf as buttonOf2 } from "@ai-matrx/records";
|
|
@@ -10597,6 +10597,15 @@ function buttonPressWords(label, pressed) {
|
|
|
10597
10597
|
const status = pressed.status ?? "ran";
|
|
10598
10598
|
return [`${pressed.automation ?? label}: ${status}.`, pressed.says].filter(Boolean).join(" ");
|
|
10599
10599
|
}
|
|
10600
|
+
var POLL_EVERY_MS = 1200;
|
|
10601
|
+
var POLL_FOR_MS = 12e4;
|
|
10602
|
+
function runAnswerWords(label, run) {
|
|
10603
|
+
const steps = run.steps ?? [];
|
|
10604
|
+
const failedStep = [...steps].reverse().find((s) => s.status === "failed");
|
|
10605
|
+
if (run.status === "failed") return [failedStep?.output_text ?? failedStep?.says, run.says].filter((t, i, all) => t && all.indexOf(t) === i).join(" ") || `${label} failed.`;
|
|
10606
|
+
const answered = [...steps].reverse().find((s) => s.output_text && s.output_text.trim() !== "");
|
|
10607
|
+
return answered?.output_text?.trim() || run.says || `${label} ran.`;
|
|
10608
|
+
}
|
|
10600
10609
|
var stop = (event) => event.stopPropagation();
|
|
10601
10610
|
function ButtonValue({ field: field2, recordId, inCell }) {
|
|
10602
10611
|
const client = useOptionalRecordsClient10();
|
|
@@ -10604,76 +10613,121 @@ function ButtonValue({ field: field2, recordId, inCell }) {
|
|
|
10604
10613
|
const [busy, setBusy] = useState30(false);
|
|
10605
10614
|
const [said2, setSaid] = useState30(null);
|
|
10606
10615
|
const [settingUp, setSettingUp] = useState30(false);
|
|
10616
|
+
const waitingOn = useRef17(0);
|
|
10617
|
+
useEffect22(() => () => void (waitingOn.current += 1), []);
|
|
10607
10618
|
if (!b) return null;
|
|
10608
10619
|
const color = isStyleColor2(b.color) ? CHOICE_CHIP_CLASS2[b.color] : NEUTRAL_CHIP_CLASS2;
|
|
10609
10620
|
const needs = buttonNeeds2(b);
|
|
10610
10621
|
const tableId = field2.entity_definition_id;
|
|
10611
10622
|
const press = async () => {
|
|
10612
10623
|
if (!client || !recordId) return setSaid({ kind: "public" });
|
|
10613
|
-
if (needs) return setSaid({ kind: "needs", says: needs });
|
|
10624
|
+
if (needs && b.do) return setSaid({ kind: "needs", says: needs });
|
|
10614
10625
|
setBusy(true);
|
|
10615
10626
|
const answered = await client.buttonPress({ record_id: recordId, field_id: field2.id });
|
|
10616
10627
|
setBusy(false);
|
|
10617
|
-
if (!answered.ok)
|
|
10628
|
+
if (!answered.ok) {
|
|
10629
|
+
if (needs && (answered.error.sqlstate === "22023" || answered.error.code === "invalid_argument")) return setSaid({ kind: "needs", says: needs });
|
|
10630
|
+
return setSaid({ kind: "refused", error: answered.error });
|
|
10631
|
+
}
|
|
10618
10632
|
const pressed = answered.data;
|
|
10619
10633
|
if (pressed.do === "open_url") {
|
|
10620
10634
|
const opened = typeof window !== "undefined" ? openOutbound(pressed.url, "_blank", "noopener") : null;
|
|
10621
10635
|
return setSaid({ kind: "ran", says: opened ? `${b.label} opened.` : `${b.label} is ready:`, link: pressed.url });
|
|
10622
10636
|
}
|
|
10623
|
-
|
|
10637
|
+
const words2 = buttonPressWords(b.label, pressed);
|
|
10638
|
+
if (pressed.do === "run_automation" && pressed.status === "waiting" && pressed.run_id && b.automation_id) {
|
|
10639
|
+
const mine = waitingOn.current += 1;
|
|
10640
|
+
setBusy(true);
|
|
10641
|
+
setSaid({ kind: "waiting", says: `${b.label} is running` });
|
|
10642
|
+
const until = Date.now() + POLL_FOR_MS;
|
|
10643
|
+
while (waitingOn.current === mine) {
|
|
10644
|
+
await new Promise((r) => setTimeout(r, POLL_EVERY_MS));
|
|
10645
|
+
if (waitingOn.current !== mine) return;
|
|
10646
|
+
const runs = await client.automationRuns({ automation_id: b.automation_id, limit: 10 });
|
|
10647
|
+
if (!runs.ok) {
|
|
10648
|
+
setBusy(false);
|
|
10649
|
+
return setSaid({ kind: "refused", error: runs.error });
|
|
10650
|
+
}
|
|
10651
|
+
const run = runs.data.runs.find((r) => r.run_id === pressed.run_id);
|
|
10652
|
+
if (run && run.status !== "waiting") {
|
|
10653
|
+
setBusy(false);
|
|
10654
|
+
return setSaid(run.status === "ran" ? { kind: "ran", says: runAnswerWords(b.label, run) } : { kind: "failed", says: runAnswerWords(b.label, run) });
|
|
10655
|
+
}
|
|
10656
|
+
if (Date.now() > until) {
|
|
10657
|
+
setBusy(false);
|
|
10658
|
+
return setSaid({ kind: "ran", says: `${b.label} is still running. Its answer will be in the automation's runs.` });
|
|
10659
|
+
}
|
|
10660
|
+
}
|
|
10661
|
+
return;
|
|
10662
|
+
}
|
|
10663
|
+
setSaid({ kind: "ran", says: words2 });
|
|
10624
10664
|
};
|
|
10625
10665
|
return /* @__PURE__ */ jsxs36(Fragment12, { children: [
|
|
10626
|
-
/* @__PURE__ */ jsxs36(
|
|
10627
|
-
|
|
10628
|
-
|
|
10629
|
-
|
|
10630
|
-
|
|
10631
|
-
|
|
10632
|
-
|
|
10633
|
-
|
|
10634
|
-
|
|
10635
|
-
|
|
10636
|
-
|
|
10637
|
-
|
|
10638
|
-
onPointerDown: stop,
|
|
10639
|
-
onDoubleClick: stop,
|
|
10640
|
-
onClick: (event) => {
|
|
10641
|
-
event.stopPropagation();
|
|
10642
|
-
event.preventDefault();
|
|
10643
|
-
void press();
|
|
10644
|
-
},
|
|
10645
|
-
children: /* @__PURE__ */ jsx40("span", { className: "truncate", children: b.label })
|
|
10646
|
-
}
|
|
10647
|
-
) }),
|
|
10648
|
-
/* @__PURE__ */ jsxs36(PopoverContent5, { className: "w-72 space-y-2 p-3 text-sm", onClick: stop, onPointerDown: stop, "data-records-button-said": said2?.kind, children: [
|
|
10649
|
-
said2?.kind === "refused" ? /* @__PURE__ */ jsx40(RefusalLine, { error: said2.error }) : null,
|
|
10650
|
-
said2?.kind === "public" ? /* @__PURE__ */ jsx40("p", { children: "Buttons run for signed-in people." }) : null,
|
|
10651
|
-
said2?.kind === "ran" ? /* @__PURE__ */ jsxs36("p", { className: "break-words", children: [
|
|
10652
|
-
said2.says,
|
|
10653
|
-
" ",
|
|
10654
|
-
said2.link ? /* @__PURE__ */ jsx40(OutboundLink6, { href: said2.link, className: "text-primary underline", children: said2.link }) : null
|
|
10655
|
-
] }) : null,
|
|
10656
|
-
said2?.kind === "needs" ? /* @__PURE__ */ jsxs36(Fragment12, { children: [
|
|
10657
|
-
/* @__PURE__ */ jsx40("p", { children: said2.says }),
|
|
10658
|
-
tableId ? /* @__PURE__ */ jsxs36(
|
|
10666
|
+
/* @__PURE__ */ jsxs36(
|
|
10667
|
+
Popover5,
|
|
10668
|
+
{
|
|
10669
|
+
open: said2 !== null,
|
|
10670
|
+
onOpenChange: (open) => {
|
|
10671
|
+
if (open) return;
|
|
10672
|
+
waitingOn.current += 1;
|
|
10673
|
+
setBusy(false);
|
|
10674
|
+
setSaid(null);
|
|
10675
|
+
},
|
|
10676
|
+
children: [
|
|
10677
|
+
/* @__PURE__ */ jsx40(PopoverTrigger5, { asChild: true, children: /* @__PURE__ */ jsx40(
|
|
10659
10678
|
Button18,
|
|
10660
10679
|
{
|
|
10661
10680
|
type: "button",
|
|
10662
|
-
size: "
|
|
10663
|
-
|
|
10664
|
-
|
|
10665
|
-
|
|
10666
|
-
|
|
10681
|
+
size: "xs",
|
|
10682
|
+
variant: "outline",
|
|
10683
|
+
"data-records-button": field2.key,
|
|
10684
|
+
"data-records-button-unset": needs ? "" : void 0,
|
|
10685
|
+
"aria-busy": busy || void 0,
|
|
10686
|
+
disabled: busy,
|
|
10687
|
+
className: cn24("max-w-full gap-1 border px-2 font-medium", inCell ? "h-5" : "h-6", color, needs && "border-dashed opacity-80"),
|
|
10688
|
+
onPointerDown: stop,
|
|
10689
|
+
onDoubleClick: stop,
|
|
10690
|
+
onClick: (event) => {
|
|
10691
|
+
event.stopPropagation();
|
|
10692
|
+
event.preventDefault();
|
|
10693
|
+
void press();
|
|
10667
10694
|
},
|
|
10668
|
-
children:
|
|
10669
|
-
"Set up ",
|
|
10670
|
-
b.label
|
|
10671
|
-
]
|
|
10695
|
+
children: /* @__PURE__ */ jsx40("span", { className: "truncate", children: b.label })
|
|
10672
10696
|
}
|
|
10673
|
-
)
|
|
10674
|
-
|
|
10675
|
-
|
|
10676
|
-
|
|
10697
|
+
) }),
|
|
10698
|
+
/* @__PURE__ */ jsxs36(PopoverContent5, { className: "w-72 space-y-2 p-3 text-sm", onClick: stop, onPointerDown: stop, "data-records-button-said": said2?.kind, children: [
|
|
10699
|
+
said2?.kind === "refused" ? /* @__PURE__ */ jsx40(RefusalLine, { error: said2.error }) : null,
|
|
10700
|
+
said2?.kind === "waiting" ? /* @__PURE__ */ jsx40("p", { className: "matrx-shimmer rounded px-1 py-0.5", role: "status", "aria-live": "polite", children: said2.says }) : null,
|
|
10701
|
+
said2?.kind === "failed" ? /* @__PURE__ */ jsx40("p", { className: "break-words text-destructive", role: "alert", children: said2.says }) : null,
|
|
10702
|
+
said2?.kind === "public" ? /* @__PURE__ */ jsx40("p", { children: "Buttons run for signed-in people." }) : null,
|
|
10703
|
+
said2?.kind === "ran" ? /* @__PURE__ */ jsxs36("p", { className: "break-words", children: [
|
|
10704
|
+
said2.says,
|
|
10705
|
+
" ",
|
|
10706
|
+
said2.link ? /* @__PURE__ */ jsx40(OutboundLink6, { href: said2.link, className: "text-primary underline", children: said2.link }) : null
|
|
10707
|
+
] }) : null,
|
|
10708
|
+
said2?.kind === "needs" ? /* @__PURE__ */ jsxs36(Fragment12, { children: [
|
|
10709
|
+
/* @__PURE__ */ jsx40("p", { children: said2.says }),
|
|
10710
|
+
tableId ? /* @__PURE__ */ jsxs36(
|
|
10711
|
+
Button18,
|
|
10712
|
+
{
|
|
10713
|
+
type: "button",
|
|
10714
|
+
size: "sm",
|
|
10715
|
+
"data-records-button-set-up": "",
|
|
10716
|
+
onClick: () => {
|
|
10717
|
+
setSaid(null);
|
|
10718
|
+
setSettingUp(true);
|
|
10719
|
+
},
|
|
10720
|
+
children: [
|
|
10721
|
+
"Set up ",
|
|
10722
|
+
b.label
|
|
10723
|
+
]
|
|
10724
|
+
}
|
|
10725
|
+
) : null
|
|
10726
|
+
] }) : null
|
|
10727
|
+
] })
|
|
10728
|
+
]
|
|
10729
|
+
}
|
|
10730
|
+
),
|
|
10677
10731
|
settingUp && tableId ? /* @__PURE__ */ jsx40(Dialog2, { open: true, onOpenChange: (open) => open ? null : setSettingUp(false), children: /* @__PURE__ */ jsxs36(DialogContent2, { className: "max-h-[85vh] overflow-y-auto sm:max-w-2xl", onClick: stop, onPointerDown: stop, children: [
|
|
10678
10732
|
/* @__PURE__ */ jsxs36(DialogHeader2, { children: [
|
|
10679
10733
|
/* @__PURE__ */ jsx40(DialogTitle2, { children: `Column settings \xB7 ${fieldName(field2)}` }),
|
|
@@ -10685,7 +10739,7 @@ function ButtonValue({ field: field2, recordId, inCell }) {
|
|
|
10685
10739
|
}
|
|
10686
10740
|
|
|
10687
10741
|
// src/FloatingRefusal.tsx
|
|
10688
|
-
import { useLayoutEffect as useLayoutEffect2, useRef as
|
|
10742
|
+
import { useLayoutEffect as useLayoutEffect2, useRef as useRef18, useState as useState31 } from "react";
|
|
10689
10743
|
import { createPortal } from "react-dom";
|
|
10690
10744
|
import { Fragment as Fragment13, jsx as jsx41, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
10691
10745
|
var GAP2 = 4;
|
|
@@ -10703,8 +10757,8 @@ function placeFor(anchor, note) {
|
|
|
10703
10757
|
return { position: "fixed", top: a.top + (a.height - height) / 2, left: Math.max(a.left, a.right - width - 8) };
|
|
10704
10758
|
}
|
|
10705
10759
|
function FloatingRefusal({ text, why }) {
|
|
10706
|
-
const spot =
|
|
10707
|
-
const note =
|
|
10760
|
+
const spot = useRef18(null);
|
|
10761
|
+
const note = useRef18(null);
|
|
10708
10762
|
const [style, setStyle] = useState31(null);
|
|
10709
10763
|
const [floating, setFloating] = useState31(false);
|
|
10710
10764
|
useLayoutEffect2(() => {
|
|
@@ -10749,7 +10803,7 @@ function FloatingRefusal({ text, why }) {
|
|
|
10749
10803
|
}
|
|
10750
10804
|
|
|
10751
10805
|
// src/formatControls.tsx
|
|
10752
|
-
import { useEffect as
|
|
10806
|
+
import { useEffect as useEffect23, useRef as useRef19, useState as useState32 } from "react";
|
|
10753
10807
|
import { BasicInput as BasicInput10, BasicTextarea as BasicTextarea3 } from "@ai-matrx/design-system";
|
|
10754
10808
|
import { getFieldFormat as getFieldFormat4, parseFieldInput } from "@ai-matrx/design-system/field-formats";
|
|
10755
10809
|
import { jsx as jsx42, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
@@ -10770,8 +10824,8 @@ function keptValue(format, raw) {
|
|
|
10770
10824
|
}
|
|
10771
10825
|
function NumberInFormat({ format, value, onChange, disabled, id }) {
|
|
10772
10826
|
const [text, setText] = useState32(() => typedText(format, value));
|
|
10773
|
-
const lastSent =
|
|
10774
|
-
|
|
10827
|
+
const lastSent = useRef19(void 0);
|
|
10828
|
+
useEffect23(() => {
|
|
10775
10829
|
if (value === lastSent.current) return;
|
|
10776
10830
|
setText(typedText(format, value));
|
|
10777
10831
|
}, [value, format]);
|
|
@@ -11006,7 +11060,7 @@ function TypedDateHelper({
|
|
|
11006
11060
|
}
|
|
11007
11061
|
|
|
11008
11062
|
// src/choiceNudge.ts
|
|
11009
|
-
import { useEffect as
|
|
11063
|
+
import { useEffect as useEffect24, useState as useState34 } from "react";
|
|
11010
11064
|
import { useOptionalRecordsClient as useOptionalRecordsClient11 } from "@ai-matrx/records/react";
|
|
11011
11065
|
var asked2 = /* @__PURE__ */ new WeakMap();
|
|
11012
11066
|
function choiceNudgeOf(client) {
|
|
@@ -11023,7 +11077,7 @@ function choiceNudgeOf(client) {
|
|
|
11023
11077
|
function useChoiceNudge(enabled = true) {
|
|
11024
11078
|
const client = useOptionalRecordsClient11();
|
|
11025
11079
|
const [nudge, setNudge] = useState34(null);
|
|
11026
|
-
|
|
11080
|
+
useEffect24(() => {
|
|
11027
11081
|
if (!enabled || !client) return;
|
|
11028
11082
|
let live = true;
|
|
11029
11083
|
void choiceNudgeOf(client).then((answer) => {
|
|
@@ -11211,7 +11265,7 @@ function draftFromTyping(field2, seed) {
|
|
|
11211
11265
|
return { typedDraft: true, text: seed, judged: judgeTyped(field2, seed) };
|
|
11212
11266
|
}
|
|
11213
11267
|
function ReadsAsNote({ typed: typed2, always, children }) {
|
|
11214
|
-
const note =
|
|
11268
|
+
const note = useRef20(null);
|
|
11215
11269
|
const [repeats, setRepeats] = useState35(false);
|
|
11216
11270
|
useLayoutEffect3(() => {
|
|
11217
11271
|
if (always) return;
|
|
@@ -11227,7 +11281,7 @@ function TypedTextControl({ field: field2, value, onChange, disabled, id, onComm
|
|
|
11227
11281
|
const needsChoices = kind2 === "select" || kind2 === "multi_select";
|
|
11228
11282
|
const nudge = useChoiceNudge(needsChoices);
|
|
11229
11283
|
const [choices, setChoices] = useState35(null);
|
|
11230
|
-
|
|
11284
|
+
useEffect25(() => {
|
|
11231
11285
|
if (!needsChoices || !client) return;
|
|
11232
11286
|
let cancelled = false;
|
|
11233
11287
|
void (0, askOnce_exports.fieldOptionsOnce)(client, field2.id).then((result) => {
|
|
@@ -11237,7 +11291,7 @@ function TypedTextControl({ field: field2, value, onChange, disabled, id, onComm
|
|
|
11237
11291
|
cancelled = true;
|
|
11238
11292
|
};
|
|
11239
11293
|
}, [client, field2.id, needsChoices]);
|
|
11240
|
-
|
|
11294
|
+
useEffect25(() => {
|
|
11241
11295
|
if (choices && nudge && value.judged === null) onChange({ ...value, judged: judgeTyped(field2, value.text, choices, nudge) });
|
|
11242
11296
|
}, [choices, nudge, value, field2, onChange]);
|
|
11243
11297
|
const judged = value.judged;
|
|
@@ -11436,8 +11490,8 @@ function TypedWordsControl({ field: field2, value, onChange, disabled, id }) {
|
|
|
11436
11490
|
const [text, setText] = useState35(() => openingText(field2, value));
|
|
11437
11491
|
const [refusal3, setRefusal] = useState35(null);
|
|
11438
11492
|
const [why, setWhy] = useState35(void 0);
|
|
11439
|
-
const sent =
|
|
11440
|
-
|
|
11493
|
+
const sent = useRef20(value);
|
|
11494
|
+
useEffect25(() => {
|
|
11441
11495
|
if (value === sent.current) return;
|
|
11442
11496
|
sent.current = value;
|
|
11443
11497
|
setText(openingText(field2, value));
|
|
@@ -11583,7 +11637,7 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
11583
11637
|
const [options, setOptions] = useState35(null);
|
|
11584
11638
|
const [refusal3, setRefusal] = useState35(null);
|
|
11585
11639
|
const [reread, setReread] = useState35(0);
|
|
11586
|
-
|
|
11640
|
+
useEffect25(() => {
|
|
11587
11641
|
if (!client) return;
|
|
11588
11642
|
let cancelled = false;
|
|
11589
11643
|
void (0, askOnce_exports.fieldOptionsOnce)(client, field2.id).then((result) => {
|
|
@@ -11750,7 +11804,7 @@ function OpenChoicePicker({
|
|
|
11750
11804
|
const client = useOptionalRecordsClient12();
|
|
11751
11805
|
const nudge = useChoiceNudge();
|
|
11752
11806
|
const [open, setOpenState] = useState35(autoOpen === true);
|
|
11753
|
-
const onCloseRef =
|
|
11807
|
+
const onCloseRef = useRef20(onClose);
|
|
11754
11808
|
onCloseRef.current = onClose;
|
|
11755
11809
|
const setOpen = useCallback8((next) => {
|
|
11756
11810
|
setOpenState(next);
|
|
@@ -12018,7 +12072,7 @@ function ChoiceAnswer({
|
|
|
12018
12072
|
}
|
|
12019
12073
|
|
|
12020
12074
|
// src/whoChangedSource.tsx
|
|
12021
|
-
import { createContext as createContext6, useCallback as useCallback9, useContext as useContext6, useEffect as
|
|
12075
|
+
import { createContext as createContext6, useCallback as useCallback9, useContext as useContext6, useEffect as useEffect26, useMemo as useMemo14, useRef as useRef21, useState as useState36 } from "react";
|
|
12022
12076
|
import { useRecordsClient as useRecordsClient12 } from "@ai-matrx/records/react";
|
|
12023
12077
|
|
|
12024
12078
|
// src/whoChanged.ts
|
|
@@ -12094,8 +12148,8 @@ function WhoChangedSource({
|
|
|
12094
12148
|
const membersPort = host.members;
|
|
12095
12149
|
const [answers2, setAnswers] = useState36({});
|
|
12096
12150
|
const [roster, setRoster] = useState36({});
|
|
12097
|
-
const asked4 =
|
|
12098
|
-
|
|
12151
|
+
const asked4 = useRef21(/* @__PURE__ */ new Set());
|
|
12152
|
+
useEffect26(() => {
|
|
12099
12153
|
if (!membersPort) return;
|
|
12100
12154
|
let cancelled = false;
|
|
12101
12155
|
void membersPort().then((people) => {
|
|
@@ -12246,7 +12300,7 @@ function holdKeys() {
|
|
|
12246
12300
|
}
|
|
12247
12301
|
|
|
12248
12302
|
// src/unsentWrites.ts
|
|
12249
|
-
import { useEffect as
|
|
12303
|
+
import { useEffect as useEffect27, useRef as useRef22 } from "react";
|
|
12250
12304
|
var UNSENT_LINE = "Not saved";
|
|
12251
12305
|
function browserIsOffline() {
|
|
12252
12306
|
return typeof navigator !== "undefined" && navigator.onLine === false;
|
|
@@ -12255,9 +12309,9 @@ function isUnsentWrite(error) {
|
|
|
12255
12309
|
return error.code === "unreachable" || browserIsOffline();
|
|
12256
12310
|
}
|
|
12257
12311
|
function useWhenBackOnline(resend) {
|
|
12258
|
-
const latest =
|
|
12312
|
+
const latest = useRef22(resend);
|
|
12259
12313
|
latest.current = resend;
|
|
12260
|
-
|
|
12314
|
+
useEffect27(() => {
|
|
12261
12315
|
if (typeof window === "undefined") return;
|
|
12262
12316
|
const onOnline = () => latest.current();
|
|
12263
12317
|
window.addEventListener("online", onOnline);
|
|
@@ -12305,23 +12359,23 @@ function rememberVersion(cache, recordId, version2) {
|
|
|
12305
12359
|
}
|
|
12306
12360
|
function useGridEditing({ tableId, fields, rows, reload, reloadAfterWrite, canWrite, mayWriteRow, onWritten, onEnded, versions: shared }) {
|
|
12307
12361
|
const afterWrite = reloadAfterWrite ?? reload;
|
|
12308
|
-
const endedRef =
|
|
12362
|
+
const endedRef = useRef23(onEnded);
|
|
12309
12363
|
endedRef.current = onEnded;
|
|
12310
12364
|
const client = useRecordsClient13();
|
|
12311
12365
|
const own3 = (0, recordVersions_exports.useRecordVersions)(client, shared ? NO_ROWS : rows);
|
|
12312
12366
|
const source = shared ?? own3;
|
|
12313
|
-
const rowsNow =
|
|
12367
|
+
const rowsNow = useRef23(rows);
|
|
12314
12368
|
rowsNow.current = rows;
|
|
12315
12369
|
const [editing, setEditing] = useState37(null);
|
|
12316
12370
|
const [draft, setDraft] = useState37(null);
|
|
12317
|
-
const searchSeed =
|
|
12318
|
-
const typed2 =
|
|
12319
|
-
const startedFrom =
|
|
12320
|
-
const startedStored =
|
|
12371
|
+
const searchSeed = useRef23(null);
|
|
12372
|
+
const typed2 = useRef23(null);
|
|
12373
|
+
const startedFrom = useRef23(null);
|
|
12374
|
+
const startedStored = useRef23(null);
|
|
12321
12375
|
const host = useRecordsUi();
|
|
12322
|
-
const fieldsRef =
|
|
12376
|
+
const fieldsRef = useRef23(fields);
|
|
12323
12377
|
fieldsRef.current = fields;
|
|
12324
|
-
const forceNext =
|
|
12378
|
+
const forceNext = useRef23(/* @__PURE__ */ new Set());
|
|
12325
12379
|
const type = useCallback10((value) => {
|
|
12326
12380
|
typed2.current = value;
|
|
12327
12381
|
setDraft(value);
|
|
@@ -12331,10 +12385,10 @@ function useGridEditing({ tableId, fields, rows, reload, reloadAfterWrite, canWr
|
|
|
12331
12385
|
const [refusals, setRefusals] = useState37({});
|
|
12332
12386
|
const [rowError, setRowError] = useState37(null);
|
|
12333
12387
|
const [busy, setBusy] = useState37(false);
|
|
12334
|
-
const versions =
|
|
12335
|
-
const versionReads =
|
|
12336
|
-
const queues =
|
|
12337
|
-
const writtenRef =
|
|
12388
|
+
const versions = useRef23(/* @__PURE__ */ new Map());
|
|
12389
|
+
const versionReads = useRef23(/* @__PURE__ */ new Map());
|
|
12390
|
+
const queues = useRef23(/* @__PURE__ */ new Map());
|
|
12391
|
+
const writtenRef = useRef23(onWritten);
|
|
12338
12392
|
writtenRef.current = onWritten;
|
|
12339
12393
|
const editable = useMemo15(() => fields.filter(fieldIsEditable), [fields]);
|
|
12340
12394
|
const order = useMemo15(() => editable.map((f) => f.key), [editable]);
|
|
@@ -12364,8 +12418,8 @@ function useGridEditing({ tableId, fields, rows, reload, reloadAfterWrite, canWr
|
|
|
12364
12418
|
(rowId, key) => refusals[cellKey(rowId, key)] ?? null,
|
|
12365
12419
|
[refusals]
|
|
12366
12420
|
);
|
|
12367
|
-
const settling =
|
|
12368
|
-
|
|
12421
|
+
const settling = useRef23(/* @__PURE__ */ new Map());
|
|
12422
|
+
useEffect28(() => {
|
|
12369
12423
|
if (settling.current.size === 0) return;
|
|
12370
12424
|
const released = [];
|
|
12371
12425
|
for (const [id, before] of settling.current) {
|
|
@@ -12455,7 +12509,7 @@ function useGridEditing({ tableId, fields, rows, reload, reloadAfterWrite, canWr
|
|
|
12455
12509
|
},
|
|
12456
12510
|
[writable, client, editing, shownValue2, optimistic, rows, host, fields]
|
|
12457
12511
|
);
|
|
12458
|
-
const openRef =
|
|
12512
|
+
const openRef = useRef23(null);
|
|
12459
12513
|
openRef.current = editing;
|
|
12460
12514
|
const cancel = useCallback10((via = "key") => {
|
|
12461
12515
|
const open = openRef.current;
|
|
@@ -12894,7 +12948,7 @@ function GridCell({
|
|
|
12894
12948
|
clickOpens = false
|
|
12895
12949
|
}) {
|
|
12896
12950
|
const ui = useRecordsUi();
|
|
12897
|
-
const saidAt =
|
|
12951
|
+
const saidAt = useRef23(0);
|
|
12898
12952
|
const sayWhyNot = () => {
|
|
12899
12953
|
if (Date.now() - saidAt.current < 4e3) return;
|
|
12900
12954
|
saidAt.current = Date.now();
|
|
@@ -12904,9 +12958,9 @@ function GridCell({
|
|
|
12904
12958
|
const open = Boolean(
|
|
12905
12959
|
editing && editing.editing?.rowId === row.id && editing.editing.key === field2.key
|
|
12906
12960
|
);
|
|
12907
|
-
const closedControl =
|
|
12908
|
-
const wasOpen =
|
|
12909
|
-
|
|
12961
|
+
const closedControl = useRef23(null);
|
|
12962
|
+
const wasOpen = useRef23(false);
|
|
12963
|
+
useEffect28(() => {
|
|
12910
12964
|
if (open) {
|
|
12911
12965
|
wasOpen.current = true;
|
|
12912
12966
|
return;
|
|
@@ -12920,13 +12974,13 @@ function GridCell({
|
|
|
12920
12974
|
});
|
|
12921
12975
|
return () => cancelAnimationFrame(frame);
|
|
12922
12976
|
}, [open, clickOpens]);
|
|
12923
|
-
const wasActive =
|
|
12924
|
-
const singlePress =
|
|
12977
|
+
const wasActive = useRef23(false);
|
|
12978
|
+
const singlePress = useRef23(null);
|
|
12925
12979
|
const cancelSinglePress = () => {
|
|
12926
12980
|
if (singlePress.current) clearTimeout(singlePress.current);
|
|
12927
12981
|
singlePress.current = null;
|
|
12928
12982
|
};
|
|
12929
|
-
|
|
12983
|
+
useEffect28(() => cancelSinglePress, []);
|
|
12930
12984
|
const afterSinglePress = (act) => {
|
|
12931
12985
|
cancelSinglePress();
|
|
12932
12986
|
singlePress.current = setTimeout(() => {
|
|
@@ -13338,14 +13392,14 @@ function OpenCell({
|
|
|
13338
13392
|
const typedWords = isTypedDraft(draft) ? draft.text : typeof draft === "string" ? draft : null;
|
|
13339
13393
|
const widens = !picker && !multiline && typedWords !== null;
|
|
13340
13394
|
const wideTo = widens ? `max(100%, calc(${Math.max(typedWords.length, 8) + 3}ch + ${dateHelperKind(field2) ? "2.75rem" : "1rem"}))` : void 0;
|
|
13341
|
-
const done =
|
|
13395
|
+
const done = useRef23(false);
|
|
13342
13396
|
const once = (run) => {
|
|
13343
13397
|
if (done.current) return;
|
|
13344
13398
|
done.current = true;
|
|
13345
13399
|
if (run() === false) done.current = false;
|
|
13346
13400
|
};
|
|
13347
|
-
const host =
|
|
13348
|
-
|
|
13401
|
+
const host = useRef23(null);
|
|
13402
|
+
useEffect28(() => {
|
|
13349
13403
|
const active = document.activeElement;
|
|
13350
13404
|
if (active instanceof HTMLElement && active.closest("[data-matrx-cell-editor]") && !host.current?.contains(active)) return;
|
|
13351
13405
|
const control = host.current?.querySelector("input, textarea, [role='combobox'], button");
|
|
@@ -13363,7 +13417,7 @@ function OpenCell({
|
|
|
13363
13417
|
}
|
|
13364
13418
|
}, [field2.id]);
|
|
13365
13419
|
const typedNow = isTypedDraft(draft);
|
|
13366
|
-
|
|
13420
|
+
useEffect28(() => {
|
|
13367
13421
|
if (!typedNow) return;
|
|
13368
13422
|
const active = document.activeElement;
|
|
13369
13423
|
if (active instanceof HTMLElement && host.current?.contains(active)) return;
|
|
@@ -13683,12 +13737,12 @@ function TablePageSkeleton({
|
|
|
13683
13737
|
}
|
|
13684
13738
|
|
|
13685
13739
|
// src/wholeTableCount.ts
|
|
13686
|
-
import { useEffect as
|
|
13740
|
+
import { useEffect as useEffect29, useState as useState38 } from "react";
|
|
13687
13741
|
import { useRecordsClient as useRecordsClient14 } from "@ai-matrx/records/react";
|
|
13688
13742
|
function useWholeTableCount(args) {
|
|
13689
13743
|
const client = useRecordsClient14();
|
|
13690
13744
|
const [count, setCount] = useState38(null);
|
|
13691
|
-
|
|
13745
|
+
useEffect29(() => {
|
|
13692
13746
|
if (!args.needed) return;
|
|
13693
13747
|
let live = true;
|
|
13694
13748
|
void client.recordAggregate({ table_id: args.tableId, measures: [{ op: "count" }] }).then((answer) => {
|
|
@@ -13705,7 +13759,7 @@ function useWholeTableCount(args) {
|
|
|
13705
13759
|
}
|
|
13706
13760
|
|
|
13707
13761
|
// src/Grid.tsx
|
|
13708
|
-
import { useCallback as useCallback28, useEffect as
|
|
13762
|
+
import { useCallback as useCallback28, useEffect as useEffect59, useMemo as useMemo40, useRef as useRef39, useState as useState73 } from "react";
|
|
13709
13763
|
import {
|
|
13710
13764
|
useFields as useFields12,
|
|
13711
13765
|
useRecordPage,
|
|
@@ -13719,14 +13773,14 @@ import { MatrxDataTable as MatrxDataTable2, MatrxTableCardShowMore, tableStyleIs
|
|
|
13719
13773
|
import { announceRecordChanged as announceRecordChanged4, predictWriteRefusals as predictWriteRefusals2 } from "@ai-matrx/records/core";
|
|
13720
13774
|
|
|
13721
13775
|
// src/tableDecorations.ts
|
|
13722
|
-
import { useCallback as useCallback11, useEffect as
|
|
13776
|
+
import { useCallback as useCallback11, useEffect as useEffect30, useRef as useRef24, useState as useState39 } from "react";
|
|
13723
13777
|
import { useRecordsClient as useRecordsClient15 } from "@ai-matrx/records/react";
|
|
13724
13778
|
function useTableDecorations(tableId, revision) {
|
|
13725
13779
|
const client = useRecordsClient15();
|
|
13726
13780
|
const [state2, setState] = useState39({ data: null, loading: Boolean(tableId) });
|
|
13727
|
-
const seen =
|
|
13728
|
-
const ticket =
|
|
13729
|
-
|
|
13781
|
+
const seen = useRef24({ tableId: void 0, revision: void 0 });
|
|
13782
|
+
const ticket = useRef24(0);
|
|
13783
|
+
useEffect30(() => {
|
|
13730
13784
|
if (!tableId) {
|
|
13731
13785
|
ticket.current += 1;
|
|
13732
13786
|
setState({ data: null, loading: false });
|
|
@@ -13745,7 +13799,7 @@ function useTableDecorations(tableId, revision) {
|
|
|
13745
13799
|
setState({ data: result.ok ? result.data : null, loading: false });
|
|
13746
13800
|
});
|
|
13747
13801
|
}, [client, tableId, revision]);
|
|
13748
|
-
|
|
13802
|
+
useEffect30(() => () => {
|
|
13749
13803
|
ticket.current += 1;
|
|
13750
13804
|
}, []);
|
|
13751
13805
|
const apply = useCallback11((next) => setState({ data: next, loading: false }), []);
|
|
@@ -13857,7 +13911,7 @@ function useTableCanBeCleaned(tableId) {
|
|
|
13857
13911
|
// src/gridControls.tsx
|
|
13858
13912
|
import { copyText as writeClipboardText, readText as readClipboardText } from "@ai-matrx/kit/clipboard";
|
|
13859
13913
|
import { onRecordChanged } from "@ai-matrx/records/core";
|
|
13860
|
-
import { useCallback as useCallback17, useEffect as
|
|
13914
|
+
import { useCallback as useCallback17, useEffect as useEffect42, useMemo as useMemo25, useRef as useRef28, useState as useState53 } from "react";
|
|
13861
13915
|
import { tableShapeChanged as tableShapeChanged5, useFieldMutation as useFieldMutation2, useRecordsClient as useRecordsClient27, useReverseColumns as useReverseColumns2 } from "@ai-matrx/records/react";
|
|
13862
13916
|
import {
|
|
13863
13917
|
BasicInput as BasicInput14,
|
|
@@ -14436,12 +14490,12 @@ import {
|
|
|
14436
14490
|
} from "@ai-matrx/design-system";
|
|
14437
14491
|
|
|
14438
14492
|
// src/TablePickers.tsx
|
|
14439
|
-
import { useEffect as
|
|
14493
|
+
import { useEffect as useEffect32, useMemo as useMemo18, useState as useState42 } from "react";
|
|
14440
14494
|
import { RecordsProvider as RecordsProvider2, useFields as useFields4, useRecords as useRecords4, useTable as useTable4 } from "@ai-matrx/records/react";
|
|
14441
14495
|
import { Button as Button24, CreatablePicker as CreatablePicker2 } from "@ai-matrx/design-system";
|
|
14442
14496
|
|
|
14443
14497
|
// src/RecordsMount.tsx
|
|
14444
|
-
import { useRef as
|
|
14498
|
+
import { useRef as useRef25 } from "react";
|
|
14445
14499
|
|
|
14446
14500
|
// src/dataSource.ts
|
|
14447
14501
|
import { globalSlot as globalSlot2 } from "@ai-matrx/kit/global-slot";
|
|
@@ -14498,12 +14552,12 @@ async function hasSession(getSession) {
|
|
|
14498
14552
|
import { RecordsProvider } from "@ai-matrx/records/react";
|
|
14499
14553
|
|
|
14500
14554
|
// src/PersonNamesBridge.tsx
|
|
14501
|
-
import { useEffect as
|
|
14555
|
+
import { useEffect as useEffect31 } from "react";
|
|
14502
14556
|
import { useOptionalRecordsClient as useOptionalRecordsClient13 } from "@ai-matrx/records/react";
|
|
14503
14557
|
function PersonNamesBridge() {
|
|
14504
14558
|
const client = useOptionalRecordsClient13();
|
|
14505
14559
|
const roster = useMemberRoster();
|
|
14506
|
-
|
|
14560
|
+
useEffect31(() => {
|
|
14507
14561
|
if (!roster) return;
|
|
14508
14562
|
setPersonResolver(async (id) => {
|
|
14509
14563
|
const who = await resolveKeptPerson(client, id, roster);
|
|
@@ -14541,7 +14595,7 @@ function RecordsMount({
|
|
|
14541
14595
|
] }) }) });
|
|
14542
14596
|
}
|
|
14543
14597
|
function useShallowStableHost(host) {
|
|
14544
|
-
const held =
|
|
14598
|
+
const held = useRef25(null);
|
|
14545
14599
|
const next = host ?? {};
|
|
14546
14600
|
const previous = held.current;
|
|
14547
14601
|
if (previous !== null && sameParts(previous, next)) return previous;
|
|
@@ -14591,7 +14645,7 @@ function readTablesAnywhere(dataSource) {
|
|
|
14591
14645
|
}
|
|
14592
14646
|
function useTablesAnywhere(dataSource) {
|
|
14593
14647
|
const [state2, setState] = useState42({ loading: true, error: null, rows: [] });
|
|
14594
|
-
|
|
14648
|
+
useEffect32(() => {
|
|
14595
14649
|
let live = true;
|
|
14596
14650
|
void readTablesAnywhere(dataSource).then((result) => {
|
|
14597
14651
|
if (live) setState(result);
|
|
@@ -14951,7 +15005,7 @@ function ExtractParentDialog({ tableId, record, document: document2, open, onOpe
|
|
|
14951
15005
|
}
|
|
14952
15006
|
|
|
14953
15007
|
// src/gridColors.tsx
|
|
14954
|
-
import { useCallback as useCallback12, useEffect as
|
|
15008
|
+
import { useCallback as useCallback12, useEffect as useEffect33, useMemo as useMemo20, useState as useState44 } from "react";
|
|
14955
15009
|
import { optionKey as optionKey5, optionLabel as optionLabel3 } from "@ai-matrx/records";
|
|
14956
15010
|
import { useRecordsClient as useRecordsClient19 } from "@ai-matrx/records/react";
|
|
14957
15011
|
import {
|
|
@@ -15002,7 +15056,7 @@ function useChoiceOptions(fields, keys) {
|
|
|
15002
15056
|
const client = useRecordsClient19();
|
|
15003
15057
|
const [index, setIndex] = useState44(() => /* @__PURE__ */ new Map());
|
|
15004
15058
|
const wantedKey = keys.join("\0");
|
|
15005
|
-
|
|
15059
|
+
useEffect33(() => {
|
|
15006
15060
|
const missing = keys.map((key) => fields.find((f) => f.key === key)).filter((f) => f !== void 0 && !index.has(f.key));
|
|
15007
15061
|
if (missing.length === 0) return;
|
|
15008
15062
|
let cancelled = false;
|
|
@@ -15494,7 +15548,7 @@ function ColourRulesDialog({
|
|
|
15494
15548
|
}
|
|
15495
15549
|
|
|
15496
15550
|
// src/gridRowLabel.tsx
|
|
15497
|
-
import { useEffect as
|
|
15551
|
+
import { useEffect as useEffect34, useState as useState45 } from "react";
|
|
15498
15552
|
import { ROW_LABEL_FORMULA_MAX_LENGTH, clearsRowLabel } from "@ai-matrx/records";
|
|
15499
15553
|
import { useRecordsClient as useRecordsClient20 } from "@ai-matrx/records/react";
|
|
15500
15554
|
import {
|
|
@@ -15531,7 +15585,7 @@ function RowLabelPicker({
|
|
|
15531
15585
|
const [kept, setKept] = useState45(null);
|
|
15532
15586
|
const [formula, setFormula] = useState45("");
|
|
15533
15587
|
const [formulaOk, setFormulaOk] = useState45(null);
|
|
15534
|
-
|
|
15588
|
+
useEffect34(() => {
|
|
15535
15589
|
if (!open) return;
|
|
15536
15590
|
setMode("column");
|
|
15537
15591
|
setPicked(current ?? labelColumns(fields)[0]?.key ?? "");
|
|
@@ -15690,7 +15744,7 @@ function RowLabelPicker({
|
|
|
15690
15744
|
import { Button as Button30, Dialog as Dialog8, DialogContent as DialogContent8, DialogHeader as DialogHeader8, DialogTitle as DialogTitle8 } from "@ai-matrx/design-system";
|
|
15691
15745
|
|
|
15692
15746
|
// src/RowActionsEditor.tsx
|
|
15693
|
-
import { useCallback as useCallback14, useEffect as
|
|
15747
|
+
import { useCallback as useCallback14, useEffect as useEffect37, useMemo as useMemo22, useRef as useRef26, useState as useState48 } from "react";
|
|
15694
15748
|
import { useFields as useFields6, useRecords as useRecords5, useRecordsClient as useRecordsClient23 } from "@ai-matrx/records/react";
|
|
15695
15749
|
import {
|
|
15696
15750
|
Badge as Badge7,
|
|
@@ -15708,7 +15762,7 @@ import {
|
|
|
15708
15762
|
} from "@ai-matrx/design-system";
|
|
15709
15763
|
|
|
15710
15764
|
// src/rowActionPreview.tsx
|
|
15711
|
-
import { useEffect as
|
|
15765
|
+
import { useEffect as useEffect35, useState as useState46 } from "react";
|
|
15712
15766
|
import { useRecordsClient as useRecordsClient21 } from "@ai-matrx/records/react";
|
|
15713
15767
|
import { cn as cn29 } from "@ai-matrx/design-system";
|
|
15714
15768
|
import { jsx as jsx56, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
@@ -15763,7 +15817,7 @@ function useFormulaReadings(tableId, formulas) {
|
|
|
15763
15817
|
const client = useRecordsClient21();
|
|
15764
15818
|
const [readings, setReadings] = useState46({});
|
|
15765
15819
|
const key = formulas.join("\0");
|
|
15766
|
-
|
|
15820
|
+
useEffect35(() => {
|
|
15767
15821
|
if (!tableId) return;
|
|
15768
15822
|
let live = true;
|
|
15769
15823
|
for (const text of formulas) {
|
|
@@ -15849,7 +15903,7 @@ function ActionRowPreview({
|
|
|
15849
15903
|
}
|
|
15850
15904
|
|
|
15851
15905
|
// src/gridActions.tsx
|
|
15852
|
-
import { useCallback as useCallback13, useEffect as
|
|
15906
|
+
import { useCallback as useCallback13, useEffect as useEffect36, useMemo as useMemo21, useState as useState47 } from "react";
|
|
15853
15907
|
import { useRecordsClient as useRecordsClient22, useRowActions } from "@ai-matrx/records/react";
|
|
15854
15908
|
import { actionRefusals } from "@ai-matrx/records";
|
|
15855
15909
|
import { Button as Button28, ConfirmDialog, cn as cn30 } from "@ai-matrx/design-system";
|
|
@@ -15866,7 +15920,7 @@ function useTableActions(tableId, enabled) {
|
|
|
15866
15920
|
const loaded = enabled && (!read.loading || read.data !== null || read.error !== null);
|
|
15867
15921
|
const refetch = read.reload;
|
|
15868
15922
|
const reload = useCallback13(async () => refetch(), [refetch]);
|
|
15869
|
-
|
|
15923
|
+
useEffect36(() => {
|
|
15870
15924
|
if (!enabled) return;
|
|
15871
15925
|
const listener = () => void reload();
|
|
15872
15926
|
const set = actionListeners.get(tableId) ?? /* @__PURE__ */ new Set();
|
|
@@ -16202,10 +16256,10 @@ function RowActionsSection({
|
|
|
16202
16256
|
const [addStarted, setAddStarted] = useState48(false);
|
|
16203
16257
|
const slots = useSettingsAgentSlots();
|
|
16204
16258
|
const [seed, setSeed] = useState48(null);
|
|
16205
|
-
const openForm =
|
|
16206
|
-
const now =
|
|
16259
|
+
const openForm = useRef26(null);
|
|
16260
|
+
const now = useRef26({ actions, editing });
|
|
16207
16261
|
now.current = { actions, editing };
|
|
16208
|
-
|
|
16262
|
+
useEffect37(() => {
|
|
16209
16263
|
if (!slots) return void 0;
|
|
16210
16264
|
const slot = {
|
|
16211
16265
|
saved: () => now.current.actions,
|
|
@@ -16223,7 +16277,7 @@ function RowActionsSection({
|
|
|
16223
16277
|
if (slots.rowActions.current === slot) slots.rowActions.current = null;
|
|
16224
16278
|
};
|
|
16225
16279
|
}, [slots]);
|
|
16226
|
-
|
|
16280
|
+
useEffect37(() => {
|
|
16227
16281
|
if (!editing) {
|
|
16228
16282
|
setSeed(null);
|
|
16229
16283
|
openForm.current = null;
|
|
@@ -16240,10 +16294,10 @@ function RowActionsSection({
|
|
|
16240
16294
|
setActions(answered.data?.actions ?? []);
|
|
16241
16295
|
setStale((answered.data?.stale ?? []).length);
|
|
16242
16296
|
}, [client, tableId]);
|
|
16243
|
-
|
|
16297
|
+
useEffect37(() => {
|
|
16244
16298
|
void reload();
|
|
16245
16299
|
}, [reload]);
|
|
16246
|
-
|
|
16300
|
+
useEffect37(() => {
|
|
16247
16301
|
let live = true;
|
|
16248
16302
|
void client.tableDecorations({ table_id: tableId }).then((answered) => {
|
|
16249
16303
|
if (live && answered.ok) setColors(answered.data?.colors ?? []);
|
|
@@ -16288,7 +16342,7 @@ function RowActionsSection({
|
|
|
16288
16342
|
if (await declare2(next)) setRetired(null);
|
|
16289
16343
|
};
|
|
16290
16344
|
const allFields = fields.data ?? [];
|
|
16291
|
-
|
|
16345
|
+
useEffect37(() => {
|
|
16292
16346
|
if (!startAdding || addStarted || !loaded || readError) return;
|
|
16293
16347
|
setAddStarted(true);
|
|
16294
16348
|
setEditing("new");
|
|
@@ -16448,7 +16502,7 @@ function ActionForm({
|
|
|
16448
16502
|
const complete = draft.steps.every((s) => s.field !== "");
|
|
16449
16503
|
const [formulaChecks, setFormulaChecks] = useState48({});
|
|
16450
16504
|
const formulaWrong = draft.steps.some((s, i) => s.set === "compute" && formulaChecks[i] === false);
|
|
16451
|
-
|
|
16505
|
+
useEffect37(() => {
|
|
16452
16506
|
if (seed) setDraft(draftOf(seed.action));
|
|
16453
16507
|
}, [seed]);
|
|
16454
16508
|
const problems = [
|
|
@@ -16722,7 +16776,7 @@ function RowActionsDialog({
|
|
|
16722
16776
|
}
|
|
16723
16777
|
|
|
16724
16778
|
// src/gridSummaries.tsx
|
|
16725
|
-
import { useCallback as useCallback15, useEffect as
|
|
16779
|
+
import { useCallback as useCallback15, useEffect as useEffect38, useMemo as useMemo23, useRef as useRef27, useState as useState49 } from "react";
|
|
16726
16780
|
import { useRecordsClient as useRecordsClient24 } from "@ai-matrx/records/react";
|
|
16727
16781
|
import { measureKey } from "@ai-matrx/records";
|
|
16728
16782
|
import {
|
|
@@ -16754,7 +16808,7 @@ function useColumnSummaries(args) {
|
|
|
16754
16808
|
const [operations, setOperations] = useState49(null);
|
|
16755
16809
|
const chosenKey = JSON.stringify(Object.entries(chosen).sort());
|
|
16756
16810
|
const filterKey = JSON.stringify(args.filter ?? {});
|
|
16757
|
-
|
|
16811
|
+
useEffect38(() => {
|
|
16758
16812
|
const entries = JSON.parse(chosenKey);
|
|
16759
16813
|
const asked4 = JSON.parse(filterKey);
|
|
16760
16814
|
const filter = Object.keys(asked4).length > 0 ? asked4 : void 0;
|
|
@@ -16792,7 +16846,7 @@ function useColumnSummaries(args) {
|
|
|
16792
16846
|
cancelled = true;
|
|
16793
16847
|
};
|
|
16794
16848
|
}, [client, tableId, chosenKey, filterKey, version2]);
|
|
16795
|
-
const asking =
|
|
16849
|
+
const asking = useRef27(false);
|
|
16796
16850
|
const askOperations = useCallback15(() => {
|
|
16797
16851
|
if (operations !== null || asking.current) return;
|
|
16798
16852
|
asking.current = true;
|
|
@@ -16940,7 +16994,7 @@ function SummarySheetControls({
|
|
|
16940
16994
|
}
|
|
16941
16995
|
|
|
16942
16996
|
// src/ColumnCleanDialog.tsx
|
|
16943
|
-
import { useEffect as
|
|
16997
|
+
import { useEffect as useEffect39, useMemo as useMemo24, useState as useState50 } from "react";
|
|
16944
16998
|
import { useRecordsClient as useRecordsClient25 } from "@ai-matrx/records/react";
|
|
16945
16999
|
import {
|
|
16946
17000
|
Button as Button32,
|
|
@@ -17110,7 +17164,7 @@ function ColumnCleanDialog({
|
|
|
17110
17164
|
const [failed, setFailed] = useState50(null);
|
|
17111
17165
|
const [enabled, setEnabled] = useState50(() => new Set(DEFAULT_CLEAN_OPERATIONS));
|
|
17112
17166
|
const [busy, setBusy] = useState50(false);
|
|
17113
|
-
|
|
17167
|
+
useEffect39(() => {
|
|
17114
17168
|
if (row) {
|
|
17115
17169
|
setRows([row]);
|
|
17116
17170
|
return;
|
|
@@ -17216,7 +17270,7 @@ function ColumnCleanDialog({
|
|
|
17216
17270
|
}
|
|
17217
17271
|
|
|
17218
17272
|
// src/gridRowTemplates.tsx
|
|
17219
|
-
import { useCallback as useCallback16, useEffect as
|
|
17273
|
+
import { useCallback as useCallback16, useEffect as useEffect40, useState as useState51 } from "react";
|
|
17220
17274
|
import { useRecordsClient as useRecordsClient26 } from "@ai-matrx/records/react";
|
|
17221
17275
|
import {
|
|
17222
17276
|
BasicInput as BasicInput13,
|
|
@@ -17261,7 +17315,7 @@ function SaveAsTemplateDialog(props) {
|
|
|
17261
17315
|
const [name, setName] = useState51("");
|
|
17262
17316
|
const [busy, setBusy] = useState51(false);
|
|
17263
17317
|
const [refused, setRefused] = useState51(null);
|
|
17264
|
-
|
|
17318
|
+
useEffect40(() => {
|
|
17265
17319
|
setName("");
|
|
17266
17320
|
setRefused(null);
|
|
17267
17321
|
}, [props.row]);
|
|
@@ -17303,7 +17357,7 @@ function SaveAsTemplateDialog(props) {
|
|
|
17303
17357
|
}
|
|
17304
17358
|
|
|
17305
17359
|
// src/gridLongText.tsx
|
|
17306
|
-
import { useEffect as
|
|
17360
|
+
import { useEffect as useEffect41, useState as useState52 } from "react";
|
|
17307
17361
|
import {
|
|
17308
17362
|
BasicTextarea as BasicTextarea6,
|
|
17309
17363
|
Button as Button34,
|
|
@@ -17346,11 +17400,11 @@ function WholeTextDialog({
|
|
|
17346
17400
|
const { renderText, textBox } = useRecordsUi();
|
|
17347
17401
|
const [reading, setReading] = useState52(false);
|
|
17348
17402
|
const startingText = target === null ? null : target.pointer ? whole.state === "ready" ? whole.text : null : typeof target.value === "string" ? target.value : target.value === null || target.value === void 0 ? "" : String(target.value);
|
|
17349
|
-
|
|
17403
|
+
useEffect41(() => {
|
|
17350
17404
|
setDraft(startingText);
|
|
17351
17405
|
setCleanNote(null);
|
|
17352
17406
|
}, [target?.rowId, target?.key, startingText]);
|
|
17353
|
-
|
|
17407
|
+
useEffect41(() => {
|
|
17354
17408
|
setReading(!mayWrite && Boolean(renderText));
|
|
17355
17409
|
}, [target?.rowId, target?.key, mayWrite, renderText]);
|
|
17356
17410
|
const open = target !== null;
|
|
@@ -17709,9 +17763,9 @@ function useMergedGridControls(args) {
|
|
|
17709
17763
|
const mutation = useFieldMutation2();
|
|
17710
17764
|
const [dialog, setDialog] = useState53(null);
|
|
17711
17765
|
const canClean = Boolean(enabled && args.bulkApply);
|
|
17712
|
-
|
|
17713
|
-
const lastColumnDialog =
|
|
17714
|
-
const insertEpoch =
|
|
17766
|
+
useEffect42(() => canClean ? hearTableCleanAsks(tableId, () => setDialog({ kind: "cleanTable" })) : void 0, [canClean, tableId]);
|
|
17767
|
+
const lastColumnDialog = useRef28(null);
|
|
17768
|
+
const insertEpoch = useRef28(0);
|
|
17715
17769
|
if (dialog?.kind === "settings" || dialog?.kind === "insert") {
|
|
17716
17770
|
if (dialog !== lastColumnDialog.current) insertEpoch.current += 1;
|
|
17717
17771
|
lastColumnDialog.current = dialog;
|
|
@@ -17740,7 +17794,7 @@ function useMergedGridControls(args) {
|
|
|
17740
17794
|
const keptOrder = presentation.columnOrder;
|
|
17741
17795
|
const keptHidden = presentation.hiddenFields;
|
|
17742
17796
|
const keptKey = JSON.stringify([keptOrder ?? [], keptHidden ?? []]);
|
|
17743
|
-
|
|
17797
|
+
useEffect42(() => {
|
|
17744
17798
|
setHeld(null);
|
|
17745
17799
|
}, [keptKey]);
|
|
17746
17800
|
const order = useMemo25(() => {
|
|
@@ -17770,8 +17824,8 @@ function useMergedGridControls(args) {
|
|
|
17770
17824
|
},
|
|
17771
17825
|
[presentation, writeLook, naturalOrder]
|
|
17772
17826
|
);
|
|
17773
|
-
const pendingInsert =
|
|
17774
|
-
|
|
17827
|
+
const pendingInsert = useRef28(null);
|
|
17828
|
+
useEffect42(() => {
|
|
17775
17829
|
const pending = pendingInsert.current;
|
|
17776
17830
|
if (!pending) return;
|
|
17777
17831
|
const made = fieldKeys.find((k) => !pending.before.has(k));
|
|
@@ -17791,11 +17845,11 @@ function useMergedGridControls(args) {
|
|
|
17791
17845
|
const searchWords = (args.search ?? "").trim();
|
|
17792
17846
|
const countQuestionKey = JSON.stringify([choiceKeys, query.columnFilters, args.filter ?? null, searchWords]);
|
|
17793
17847
|
const rowsKey = rows.map((row) => `${row.id}:${row.version ?? ""}`).join(",");
|
|
17794
|
-
const fieldsRef =
|
|
17848
|
+
const fieldsRef = useRef28(fields);
|
|
17795
17849
|
fieldsRef.current = fields;
|
|
17796
17850
|
const [choiceCounts, setChoiceCounts] = useState53({});
|
|
17797
|
-
|
|
17798
|
-
|
|
17851
|
+
useEffect42(() => onRecordChanged(() => (0, askOnce_exports.forgetAsked)(client, `value_counts:${tableId}:`)), [client, tableId]);
|
|
17852
|
+
useEffect42(() => {
|
|
17799
17853
|
if (!enabled || choiceKeys.length === 0) {
|
|
17800
17854
|
setChoiceCounts({});
|
|
17801
17855
|
return;
|
|
@@ -18519,7 +18573,7 @@ function selectOpenCellText() {
|
|
|
18519
18573
|
import { Button as Button49, ConfirmDialog as ConfirmDialog5, TapTargetSearchGroup, cn as cn41, useIsMobile } from "@ai-matrx/design-system";
|
|
18520
18574
|
|
|
18521
18575
|
// src/gridAddRow.tsx
|
|
18522
|
-
import { useCallback as useCallback18, useEffect as
|
|
18576
|
+
import { useCallback as useCallback18, useEffect as useEffect45, useMemo as useMemo28, useRef as useRef31, useState as useState57 } from "react";
|
|
18523
18577
|
import { useRecordsClient as useRecordsClient31 } from "@ai-matrx/records/react";
|
|
18524
18578
|
import {
|
|
18525
18579
|
Button as Button38,
|
|
@@ -18534,7 +18588,7 @@ import {
|
|
|
18534
18588
|
} from "@ai-matrx/design-system";
|
|
18535
18589
|
|
|
18536
18590
|
// src/RecordForm.tsx
|
|
18537
|
-
import { useEffect as
|
|
18591
|
+
import { useEffect as useEffect44, useMemo as useMemo27, useRef as useRef30, useState as useState56 } from "react";
|
|
18538
18592
|
import {
|
|
18539
18593
|
useFields as useFields7,
|
|
18540
18594
|
useRecord,
|
|
@@ -18551,7 +18605,7 @@ import { useEntityRecord as useEntityRecord2, useRecordsClient as useRecordsClie
|
|
|
18551
18605
|
import { Input as Input2, Textarea as Textarea2, cn as cn34 } from "@ai-matrx/design-system";
|
|
18552
18606
|
|
|
18553
18607
|
// src/CustomFieldsSection.tsx
|
|
18554
|
-
import { useEffect as
|
|
18608
|
+
import { useEffect as useEffect43, useMemo as useMemo26, useRef as useRef29, useState as useState54 } from "react";
|
|
18555
18609
|
import {
|
|
18556
18610
|
useEntityFieldMutation as useEntityFieldMutation2,
|
|
18557
18611
|
useEntityFieldRights as useEntityFieldRights2,
|
|
@@ -18701,11 +18755,11 @@ function CustomFieldsSection({
|
|
|
18701
18755
|
read.reload();
|
|
18702
18756
|
};
|
|
18703
18757
|
const mayAdd = rights.data?.may_declare === true;
|
|
18704
|
-
const live =
|
|
18705
|
-
|
|
18758
|
+
const live = useRef29({ fields, rights: rights.data, loading: rights.loading, reload: read.reload, values: read.data?.custom ?? {} });
|
|
18759
|
+
useEffect43(() => {
|
|
18706
18760
|
live.current = { fields, rights: rights.data, loading: rights.loading, reload: read.reload, values: read.data?.custom ?? {} };
|
|
18707
18761
|
});
|
|
18708
|
-
|
|
18762
|
+
useEffect43(() => {
|
|
18709
18763
|
if (!agentDoor) return;
|
|
18710
18764
|
const state2 = () => {
|
|
18711
18765
|
const now = live.current;
|
|
@@ -19160,8 +19214,8 @@ function CustomRecordForm({
|
|
|
19160
19214
|
};
|
|
19161
19215
|
const [draft, setDraft] = useState56(() => recordId ? {} : { ...initial ?? {} });
|
|
19162
19216
|
const [touched, setTouched] = useState56(false);
|
|
19163
|
-
const seededStarts =
|
|
19164
|
-
|
|
19217
|
+
const seededStarts = useRef30(false);
|
|
19218
|
+
useEffect44(() => {
|
|
19165
19219
|
if (recordId || seededStarts.current || !fields.data) return;
|
|
19166
19220
|
seededStarts.current = true;
|
|
19167
19221
|
const starts = {};
|
|
@@ -19171,8 +19225,8 @@ function CustomRecordForm({
|
|
|
19171
19225
|
}
|
|
19172
19226
|
if (Object.keys(starts).length > 0) setDraft((held) => ({ ...starts, ...held }));
|
|
19173
19227
|
}, [recordId, fields.data]);
|
|
19174
|
-
const focusedFirst =
|
|
19175
|
-
|
|
19228
|
+
const focusedFirst = useRef30(false);
|
|
19229
|
+
useEffect44(() => {
|
|
19176
19230
|
if (!focusFirstRequired || recordId || focusedFirst.current || !fields.data) return;
|
|
19177
19231
|
focusedFirst.current = true;
|
|
19178
19232
|
const first = fields.data.find((f) => f.required && (draft[f.key] === void 0 || draft[f.key] === null || draft[f.key] === ""));
|
|
@@ -19187,13 +19241,13 @@ function CustomRecordForm({
|
|
|
19187
19241
|
[existing.data]
|
|
19188
19242
|
);
|
|
19189
19243
|
const versions = (0, recordVersions_exports.useRecordVersions)(client, formRows);
|
|
19190
|
-
const pinned =
|
|
19244
|
+
const pinned = useRef30(null);
|
|
19191
19245
|
const pin = () => {
|
|
19192
19246
|
if (recordId && !pinned.current) pinned.current = versions.seen(recordId);
|
|
19193
19247
|
};
|
|
19194
|
-
const changedRef =
|
|
19248
|
+
const changedRef = useRef30({});
|
|
19195
19249
|
changedRef.current = changed2;
|
|
19196
|
-
|
|
19250
|
+
useEffect44(() => {
|
|
19197
19251
|
const document3 = existing.data?.document;
|
|
19198
19252
|
if (!document3) return;
|
|
19199
19253
|
const mine = changedRef.current;
|
|
@@ -19415,13 +19469,13 @@ function useAddedRows(args) {
|
|
|
19415
19469
|
const [added, setAdded] = useState57([]);
|
|
19416
19470
|
const [anchors, setAnchors] = useState57(() => /* @__PURE__ */ new Map());
|
|
19417
19471
|
const [busy, setBusy] = useState57(false);
|
|
19418
|
-
|
|
19472
|
+
useEffect45(() => {
|
|
19419
19473
|
setAdded([]);
|
|
19420
19474
|
setAnchors(/* @__PURE__ */ new Map());
|
|
19421
19475
|
}, [pageKey, tableId]);
|
|
19422
19476
|
const pinnedKey = added.map((r) => r.id).join(",");
|
|
19423
|
-
const asked4 =
|
|
19424
|
-
|
|
19477
|
+
const asked4 = useRef31(0);
|
|
19478
|
+
useEffect45(() => {
|
|
19425
19479
|
if (!enabled || added.length === 0) return;
|
|
19426
19480
|
const onPage = new Set(pageRows.map((r) => r.id));
|
|
19427
19481
|
const missing = added.filter((r) => !onPage.has(r.id)).map((r) => r.id);
|
|
@@ -19553,8 +19607,8 @@ function NewRecordControl({
|
|
|
19553
19607
|
}) {
|
|
19554
19608
|
const [formOpen, setFormOpen] = useState57(false);
|
|
19555
19609
|
const [formInitial, setFormInitial] = useState57({});
|
|
19556
|
-
const seenAsk =
|
|
19557
|
-
|
|
19610
|
+
const seenAsk = useRef31(0);
|
|
19611
|
+
useEffect45(() => {
|
|
19558
19612
|
if (!ask2 || ask2.n === seenAsk.current) return;
|
|
19559
19613
|
seenAsk.current = ask2.n;
|
|
19560
19614
|
setFormInitial(ask2.initial);
|
|
@@ -19604,7 +19658,7 @@ function NewRecordControl({
|
|
|
19604
19658
|
}
|
|
19605
19659
|
|
|
19606
19660
|
// src/gridDrill.tsx
|
|
19607
|
-
import { useEffect as
|
|
19661
|
+
import { useEffect as useEffect47, useMemo as useMemo29, useState as useState59 } from "react";
|
|
19608
19662
|
import { useRecordsClient as useRecordsClient33 } from "@ai-matrx/records/react";
|
|
19609
19663
|
import {
|
|
19610
19664
|
isRuleFilter as isRuleFilter2
|
|
@@ -19618,7 +19672,7 @@ import {
|
|
|
19618
19672
|
} from "@ai-matrx/design-system/data-table";
|
|
19619
19673
|
|
|
19620
19674
|
// src/drillLevel.ts
|
|
19621
|
-
import { useEffect as
|
|
19675
|
+
import { useEffect as useEffect46, useState as useState58 } from "react";
|
|
19622
19676
|
import { useRecordsClient as useRecordsClient32 } from "@ai-matrx/records/react";
|
|
19623
19677
|
import {
|
|
19624
19678
|
drillFocus,
|
|
@@ -19693,7 +19747,7 @@ function useDrillLevelReads(args) {
|
|
|
19693
19747
|
const all = [...asks.attributes, ...asks.focus, ...asks.names];
|
|
19694
19748
|
const key = JSON.stringify({ source, all, window: args.window ?? null, lane: args.lane ?? null });
|
|
19695
19749
|
const [state2, setState] = useState58({ key: "", held: {}, failed: {} });
|
|
19696
|
-
|
|
19750
|
+
useEffect46(() => {
|
|
19697
19751
|
if (!enabled || !source || all.length === 0) return;
|
|
19698
19752
|
let cancelled = false;
|
|
19699
19753
|
const parsed = JSON.parse(key);
|
|
@@ -19815,7 +19869,7 @@ function useDrillDefinition(source) {
|
|
|
19815
19869
|
const client = useRecordsClient33();
|
|
19816
19870
|
const key = source ? JSON.stringify(source) : null;
|
|
19817
19871
|
const [state2, setState] = useState59({ key: null, def: null, error: null });
|
|
19818
|
-
|
|
19872
|
+
useEffect47(() => {
|
|
19819
19873
|
if (!key) return;
|
|
19820
19874
|
let cancelled = false;
|
|
19821
19875
|
void client.drillDescribe({ source: JSON.parse(key) }).then(
|
|
@@ -19891,7 +19945,7 @@ function useDrillAnswers(args) {
|
|
|
19891
19945
|
windowKey: args.windowKey ?? null,
|
|
19892
19946
|
lane: args.lane ?? null
|
|
19893
19947
|
});
|
|
19894
|
-
|
|
19948
|
+
useEffect47(() => {
|
|
19895
19949
|
if (!enabled || !source || question.by.length === 0) return;
|
|
19896
19950
|
const asked4 = JSON.parse(askKey2);
|
|
19897
19951
|
const range = asked4.window && asked4.windowKey ? drillWindowRange(asked4.window) : null;
|
|
@@ -20243,7 +20297,7 @@ function costInPoints(cents, rate) {
|
|
|
20243
20297
|
}
|
|
20244
20298
|
|
|
20245
20299
|
// src/Enrich.tsx
|
|
20246
|
-
import { useCallback as useCallback19, useEffect as
|
|
20300
|
+
import { useCallback as useCallback19, useEffect as useEffect48, useMemo as useMemo30, useState as useState60 } from "react";
|
|
20247
20301
|
import {
|
|
20248
20302
|
useFields as useFields8,
|
|
20249
20303
|
useRecordsClient as useRecordsClient34,
|
|
@@ -20360,7 +20414,7 @@ function useEnrichCells(tableId, recordIds) {
|
|
|
20360
20414
|
setCells(next);
|
|
20361
20415
|
}, [client, tableId, key]);
|
|
20362
20416
|
const refresh = useCallback19(() => load(true), [load]);
|
|
20363
|
-
|
|
20417
|
+
useEffect48(() => {
|
|
20364
20418
|
void load(false);
|
|
20365
20419
|
}, [load]);
|
|
20366
20420
|
return { cells, refresh, error };
|
|
@@ -20387,7 +20441,7 @@ function EnrichPanel({ tableId, fieldId, className }) {
|
|
|
20387
20441
|
setError(null);
|
|
20388
20442
|
setRows(answered.data);
|
|
20389
20443
|
}, [client, tableId]);
|
|
20390
|
-
|
|
20444
|
+
useEffect48(() => {
|
|
20391
20445
|
void load();
|
|
20392
20446
|
}, [load]);
|
|
20393
20447
|
const shown5 = useMemo30(
|
|
@@ -21044,7 +21098,7 @@ function withTypeMark(field2, header) {
|
|
|
21044
21098
|
}
|
|
21045
21099
|
|
|
21046
21100
|
// src/ReverseColumns.tsx
|
|
21047
|
-
import { useCallback as useCallback20, useEffect as
|
|
21101
|
+
import { useCallback as useCallback20, useEffect as useEffect49, useMemo as useMemo31, useRef as useRef32, useState as useState61, useSyncExternalStore as useSyncExternalStore5 } from "react";
|
|
21048
21102
|
import { isReverseField } from "@ai-matrx/records";
|
|
21049
21103
|
|
|
21050
21104
|
// src/groupReads.ts
|
|
@@ -21157,14 +21211,14 @@ function useReverseGridColumns(tableId, rowIds) {
|
|
|
21157
21211
|
}
|
|
21158
21212
|
var NO_GRID_COLUMNS = [];
|
|
21159
21213
|
function useStableColumns(listed) {
|
|
21160
|
-
const held =
|
|
21214
|
+
const held = useRef32({ key: "", columns: EMPTY_COLUMNS });
|
|
21161
21215
|
const key = JSON.stringify(listed ?? []);
|
|
21162
21216
|
if (held.current.key !== key) held.current = { key, columns: listed && listed.length > 0 ? listed : EMPTY_COLUMNS };
|
|
21163
21217
|
return held.current.columns;
|
|
21164
21218
|
}
|
|
21165
21219
|
function useLinksStore(answers2, reading) {
|
|
21166
|
-
const store =
|
|
21167
|
-
|
|
21220
|
+
const store = useRef32({ answers: null, reading: true, listeners: /* @__PURE__ */ new Set() }).current;
|
|
21221
|
+
useEffect49(() => {
|
|
21168
21222
|
store.answers = answers2;
|
|
21169
21223
|
store.reading = reading;
|
|
21170
21224
|
for (const listener of [...store.listeners]) listener();
|
|
@@ -21199,7 +21253,7 @@ function openReverseCell(rowId, columnId2) {
|
|
|
21199
21253
|
function useReverseField(tableId, column) {
|
|
21200
21254
|
const client = useOptionalRecordsClient14();
|
|
21201
21255
|
const [field2, setField] = useState61(null);
|
|
21202
|
-
|
|
21256
|
+
useEffect49(() => {
|
|
21203
21257
|
if (column.read_only || !client) return;
|
|
21204
21258
|
let live = true;
|
|
21205
21259
|
void client.fields({ table_id: tableId, withReverse: true }).then((read) => {
|
|
@@ -21240,7 +21294,7 @@ var REVERSE_LINKS_EDIT_MAX = 50;
|
|
|
21240
21294
|
function ReverseLinksEditCell({ tableId, recordId, column, chips }) {
|
|
21241
21295
|
const [open, setOpen] = useState61(false);
|
|
21242
21296
|
const key = `${recordId}|${reverseColumnId(column)}`;
|
|
21243
|
-
|
|
21297
|
+
useEffect49(() => {
|
|
21244
21298
|
reverseCellOpeners.set(key, () => setOpen(true));
|
|
21245
21299
|
return () => {
|
|
21246
21300
|
reverseCellOpeners.delete(key);
|
|
@@ -22076,7 +22130,7 @@ function withOpenRecord(columns, onOpen, nameOf2, place = "end", hrefOf, navigat
|
|
|
22076
22130
|
}
|
|
22077
22131
|
|
|
22078
22132
|
// src/ImportWizard.tsx
|
|
22079
|
-
import { useCallback as useCallback22, useEffect as
|
|
22133
|
+
import { useCallback as useCallback22, useEffect as useEffect50, useMemo as useMemo33, useState as useState64 } from "react";
|
|
22080
22134
|
import { useFields as useFields11, useRecordsClient as useRecordsClient36, useTable as useTable9 } from "@ai-matrx/records/react";
|
|
22081
22135
|
import {
|
|
22082
22136
|
importCsv,
|
|
@@ -22492,7 +22546,7 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
|
|
|
22492
22546
|
const [repeatsSkipped, setRepeatsSkipped] = useState64(0);
|
|
22493
22547
|
const [unmapped, setUnmapped] = useState64("propose");
|
|
22494
22548
|
const [unmappedChosen, setUnmappedChosen] = useState64(false);
|
|
22495
|
-
|
|
22549
|
+
useEffect50(() => {
|
|
22496
22550
|
if (rights.admin && !unmappedChosen) setUnmapped("create");
|
|
22497
22551
|
}, [rights.admin, unmappedChosen]);
|
|
22498
22552
|
const [fileName, setFileName] = useState64("");
|
|
@@ -22519,7 +22573,7 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
|
|
|
22519
22573
|
setRunsProblem(null);
|
|
22520
22574
|
} else setRunsProblem(answered.error);
|
|
22521
22575
|
}, [client, tableId]);
|
|
22522
|
-
|
|
22576
|
+
useEffect50(() => {
|
|
22523
22577
|
void loadRuns();
|
|
22524
22578
|
}, [loadRuns]);
|
|
22525
22579
|
const openRefusals = useCallback22(
|
|
@@ -22576,7 +22630,7 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
|
|
|
22576
22630
|
const combining = titleRepeating && (combine ?? combineDefault) === "combine";
|
|
22577
22631
|
const combined = useMemo33(() => combining && titleHeader ? combineRows(rows, titleHeader) : null, [combining, rows, titleHeader]);
|
|
22578
22632
|
const effectiveRows = combined?.rows ?? rows;
|
|
22579
|
-
|
|
22633
|
+
useEffect50(() => {
|
|
22580
22634
|
if (dedupeChosen) return;
|
|
22581
22635
|
setDedupeKey(combining && titleKey ? titleKey : "");
|
|
22582
22636
|
}, [combining, titleKey, dedupeChosen]);
|
|
@@ -22671,7 +22725,7 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
|
|
|
22671
22725
|
[planFrom, reset]
|
|
22672
22726
|
);
|
|
22673
22727
|
const [tookSource, setTookSource] = useState64(null);
|
|
22674
|
-
|
|
22728
|
+
useEffect50(() => {
|
|
22675
22729
|
if (!source || tookSource === source || !fields.data || !table.data) return;
|
|
22676
22730
|
setTookSource(source);
|
|
22677
22731
|
reset();
|
|
@@ -22707,7 +22761,7 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
|
|
|
22707
22761
|
},
|
|
22708
22762
|
[client]
|
|
22709
22763
|
);
|
|
22710
|
-
|
|
22764
|
+
useEffect50(() => {
|
|
22711
22765
|
if (!choiceKeysToRead) return;
|
|
22712
22766
|
void readChoices(mappedChoiceFields.filter((f) => choiceKeysToRead.split(",").includes(f.key)));
|
|
22713
22767
|
}, [choiceKeysToRead, readChoices]);
|
|
@@ -22779,7 +22833,7 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
|
|
|
22779
22833
|
},
|
|
22780
22834
|
[client, effectiveRows]
|
|
22781
22835
|
);
|
|
22782
|
-
|
|
22836
|
+
useEffect50(() => {
|
|
22783
22837
|
if (mappedRelations.length === 0) {
|
|
22784
22838
|
setRelationIndex(/* @__PURE__ */ new Map());
|
|
22785
22839
|
return;
|
|
@@ -23122,9 +23176,9 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
|
|
|
23122
23176
|
const ruleVerdictOf = useMemo33(() => new Map(ruleVerdicts.map((v) => [v.header, v])), [ruleVerdicts]);
|
|
23123
23177
|
const refusedByRules = ruleVerdicts.reduce((n, v) => n + v.refused, 0);
|
|
23124
23178
|
const verdictKey = ruleVerdicts.map((v) => `${v.header}:${v.refused}/${v.judged}`).join("|");
|
|
23125
|
-
|
|
23179
|
+
useEffect50(() => setGoAheadAnyway(false), [verdictKey]);
|
|
23126
23180
|
const [autoRan, setAutoRan] = useState64(false);
|
|
23127
|
-
|
|
23181
|
+
useEffect50(() => {
|
|
23128
23182
|
if (!autoRun || autoRan || !source || phase !== "ready" || !plan) return;
|
|
23129
23183
|
if (busy || !rights.write || rows.length === 0 || titleMissing || ruleVerdicts.length > 0) return;
|
|
23130
23184
|
setAutoRan(true);
|
|
@@ -24392,7 +24446,7 @@ function useTableToolbarSheetExtras() {
|
|
|
24392
24446
|
}
|
|
24393
24447
|
|
|
24394
24448
|
// src/GridLayoutMenu.tsx
|
|
24395
|
-
import { useEffect as
|
|
24449
|
+
import { useEffect as useEffect51, useState as useState65 } from "react";
|
|
24396
24450
|
import { useRecordsClient as useRecordsClient37 } from "@ai-matrx/records/react";
|
|
24397
24451
|
import {
|
|
24398
24452
|
Button as Button44,
|
|
@@ -24413,7 +24467,7 @@ function useStoreGridLayout(tableId) {
|
|
|
24413
24467
|
layout: null,
|
|
24414
24468
|
error: null
|
|
24415
24469
|
});
|
|
24416
|
-
|
|
24470
|
+
useEffect51(() => {
|
|
24417
24471
|
let alive = true;
|
|
24418
24472
|
void client.gridLayout({ table_id: tableId, view_id: null }).then((answered) => {
|
|
24419
24473
|
if (!alive) return;
|
|
@@ -24637,7 +24691,7 @@ function SortPanel({
|
|
|
24637
24691
|
import { pageSortFor as pageSortFor2, pageSortsFor, thenSortsOf } from "@ai-matrx/records/first-page";
|
|
24638
24692
|
|
|
24639
24693
|
// src/gridValueFilter.ts
|
|
24640
|
-
import { useMemo as useMemo34, useRef as
|
|
24694
|
+
import { useMemo as useMemo34, useRef as useRef33 } from "react";
|
|
24641
24695
|
var LONGEST_LISTABLE = 300;
|
|
24642
24696
|
var MOST_VALUES = 500;
|
|
24643
24697
|
function valueListKind(field2) {
|
|
@@ -24746,7 +24800,7 @@ async function askColumnValues(inputs, args) {
|
|
|
24746
24800
|
return facetsFromGroups(args.columnId, field2.key, rows, limit, distinct, kind2 === "numbers" ? "number" : kind2 === "days" ? "newest" : "count");
|
|
24747
24801
|
}
|
|
24748
24802
|
function useStoreValueFacets(enabled, inputs) {
|
|
24749
|
-
const latest =
|
|
24803
|
+
const latest = useRef33(inputs);
|
|
24750
24804
|
latest.current = inputs;
|
|
24751
24805
|
return useMemo34(
|
|
24752
24806
|
() => enabled ? { source: (args) => askColumnValues(latest.current, args) } : void 0,
|
|
@@ -24755,7 +24809,7 @@ function useStoreValueFacets(enabled, inputs) {
|
|
|
24755
24809
|
}
|
|
24756
24810
|
|
|
24757
24811
|
// src/gridGrouping.tsx
|
|
24758
|
-
import { useEffect as
|
|
24812
|
+
import { useEffect as useEffect52, useMemo as useMemo35, useState as useState67 } from "react";
|
|
24759
24813
|
import { useRecordsClient as useRecordsClient38 } from "@ai-matrx/records/react";
|
|
24760
24814
|
import { measureKey as measureKey2 } from "@ai-matrx/records";
|
|
24761
24815
|
import { jsx as jsx83, jsxs as jsxs75 } from "react/jsx-runtime";
|
|
@@ -24770,7 +24824,7 @@ function useGroupFacts(args) {
|
|
|
24770
24824
|
const [facts, setFacts] = useState67(null);
|
|
24771
24825
|
const chosenKey = JSON.stringify(Object.entries(args.chosen).filter(([, op2]) => op2 in MEASURE_LABEL).sort());
|
|
24772
24826
|
const filterKey = JSON.stringify(args.filter ?? {});
|
|
24773
|
-
|
|
24827
|
+
useEffect52(() => {
|
|
24774
24828
|
if (!groupKey) {
|
|
24775
24829
|
setFacts(null);
|
|
24776
24830
|
return;
|
|
@@ -24866,7 +24920,7 @@ function useGroupLabel(fields, groupKey, thenKeys = []) {
|
|
|
24866
24920
|
}
|
|
24867
24921
|
|
|
24868
24922
|
// src/gridUndo.tsx
|
|
24869
|
-
import { useCallback as useCallback23, useEffect as
|
|
24923
|
+
import { useCallback as useCallback23, useEffect as useEffect53, useLayoutEffect as useLayoutEffect4, useMemo as useMemo36, useRef as useRef34, useState as useState68, useSyncExternalStore as useSyncExternalStore6 } from "react";
|
|
24870
24924
|
import { tableShapeChanged as tableShapeChanged6, useRecordsClient as useRecordsClient39 } from "@ai-matrx/records/react";
|
|
24871
24925
|
import { announceRecordChanged as announceRecordChanged2 } from "@ai-matrx/records/core";
|
|
24872
24926
|
import { Button as Button46 } from "@ai-matrx/design-system";
|
|
@@ -24894,16 +24948,16 @@ function changesFor(step2, direction, versions = /* @__PURE__ */ new Map()) {
|
|
|
24894
24948
|
function useGridUndo(args) {
|
|
24895
24949
|
const client = useRecordsClient39();
|
|
24896
24950
|
const { tableId, reload, forget } = args;
|
|
24897
|
-
const onVersionsRef =
|
|
24951
|
+
const onVersionsRef = useRef34(args.onVersions);
|
|
24898
24952
|
onVersionsRef.current = args.onVersions;
|
|
24899
24953
|
const onVersions = (versions) => onVersionsRef.current?.(versions);
|
|
24900
|
-
const known =
|
|
24954
|
+
const known = useRef34(/* @__PURE__ */ new Map());
|
|
24901
24955
|
const [held, setHeld] = useState68(() => ({ stack: createUndoStack(args.depth ?? 100), steps: /* @__PURE__ */ new Map() }));
|
|
24902
|
-
const heldRef =
|
|
24956
|
+
const heldRef = useRef34(held);
|
|
24903
24957
|
heldRef.current = held;
|
|
24904
24958
|
const [busy, setBusy] = useState68(false);
|
|
24905
24959
|
const [notice, setNotice] = useState68(null);
|
|
24906
|
-
const counter =
|
|
24960
|
+
const counter = useRef34(0);
|
|
24907
24961
|
const dismiss = useCallback23(() => setNotice(null), []);
|
|
24908
24962
|
const push = useCallback23((step2) => {
|
|
24909
24963
|
if (step2.cells.length === 0 && !step2.created?.length && !step2.archived?.length && !step2.retiredField) return;
|
|
@@ -25000,7 +25054,7 @@ function useGridUndo(args) {
|
|
|
25000
25054
|
);
|
|
25001
25055
|
}
|
|
25002
25056
|
function useUndoSource(undo) {
|
|
25003
|
-
const box =
|
|
25057
|
+
const box = useRef34({
|
|
25004
25058
|
undo,
|
|
25005
25059
|
face: { back: undo.depth.back, forward: undo.depth.forward, busy: undo.busy },
|
|
25006
25060
|
listeners: /* @__PURE__ */ new Set()
|
|
@@ -25074,7 +25128,7 @@ function UndoRedoPair({ face, onUndo, onRedo }) {
|
|
|
25074
25128
|
function UndoNotice({ undo, placement = "frame" }) {
|
|
25075
25129
|
const notice = undo.notice;
|
|
25076
25130
|
const dismiss = undo.dismiss;
|
|
25077
|
-
|
|
25131
|
+
useEffect53(() => {
|
|
25078
25132
|
if (!notice || notice.refusal) return;
|
|
25079
25133
|
const timer = setTimeout(dismiss, 8e3);
|
|
25080
25134
|
return () => clearTimeout(timer);
|
|
@@ -25107,7 +25161,7 @@ function undoKey(event) {
|
|
|
25107
25161
|
}
|
|
25108
25162
|
|
|
25109
25163
|
// src/gridViewMove.ts
|
|
25110
|
-
import { useCallback as useCallback24, useEffect as
|
|
25164
|
+
import { useCallback as useCallback24, useEffect as useEffect54, useRef as useRef35 } from "react";
|
|
25111
25165
|
function viewMoveLine(name, move, sortedBy = null) {
|
|
25112
25166
|
const who = name.trim() === "" ? "The row" : name;
|
|
25113
25167
|
if (move === "filter") return `${who} moved out of this filter`;
|
|
@@ -25127,10 +25181,10 @@ function sameReading(a, b) {
|
|
|
25127
25181
|
}
|
|
25128
25182
|
var WATCH_MS = 15e3;
|
|
25129
25183
|
function useEditKeepsTheView(args) {
|
|
25130
|
-
const pending =
|
|
25131
|
-
const latest =
|
|
25184
|
+
const pending = useRef35(null);
|
|
25185
|
+
const latest = useRef35(args);
|
|
25132
25186
|
latest.current = args;
|
|
25133
|
-
|
|
25187
|
+
useEffect54(() => {
|
|
25134
25188
|
const held = pending.current;
|
|
25135
25189
|
if (!held || args.rows === held.rows) return;
|
|
25136
25190
|
if (Date.now() - held.at > WATCH_MS) {
|
|
@@ -25154,7 +25208,7 @@ function useEditKeepsTheView(args) {
|
|
|
25154
25208
|
}
|
|
25155
25209
|
|
|
25156
25210
|
// src/gridRowMove.ts
|
|
25157
|
-
import { useCallback as useCallback25, useEffect as
|
|
25211
|
+
import { useCallback as useCallback25, useEffect as useEffect55, useLayoutEffect as useLayoutEffect5, useRef as useRef36 } from "react";
|
|
25158
25212
|
var WATCH_MS2 = 15e3;
|
|
25159
25213
|
function token(el, name, fallback) {
|
|
25160
25214
|
const read = getComputedStyle(el).getPropertyValue(name).trim();
|
|
@@ -25193,12 +25247,12 @@ function bringIntoView(box, rowId, index, ids) {
|
|
|
25193
25247
|
scroller.scrollTop += (index - at) * any.getBoundingClientRect().height;
|
|
25194
25248
|
}
|
|
25195
25249
|
function useRowFollowsItsMove(args) {
|
|
25196
|
-
const held =
|
|
25197
|
-
const latest =
|
|
25250
|
+
const held = useRef36(null);
|
|
25251
|
+
const latest = useRef36(args);
|
|
25198
25252
|
latest.current = args;
|
|
25199
|
-
const lastIds =
|
|
25200
|
-
const frame =
|
|
25201
|
-
|
|
25253
|
+
const lastIds = useRef36(args.rowIds);
|
|
25254
|
+
const frame = useRef36(0);
|
|
25255
|
+
useEffect55(() => () => cancelAnimationFrame(frame.current), []);
|
|
25202
25256
|
const noteWrite = useCallback25((rowId, key) => {
|
|
25203
25257
|
const box = latest.current.box.current;
|
|
25204
25258
|
if (!box) return;
|
|
@@ -25258,7 +25312,7 @@ function useRowFollowsItsMove(args) {
|
|
|
25258
25312
|
|
|
25259
25313
|
// src/gridAssist.tsx
|
|
25260
25314
|
import { copyText as copyText2 } from "@ai-matrx/kit/clipboard";
|
|
25261
|
-
import { useCallback as useCallback26, useEffect as
|
|
25315
|
+
import { useCallback as useCallback26, useEffect as useEffect56, useMemo as useMemo37, useRef as useRef37, useState as useState69 } from "react";
|
|
25262
25316
|
import { tableKindSlug, wholeValueOf as wholeValueOf4 } from "@ai-matrx/records/core";
|
|
25263
25317
|
import { useContentTransferCapabilities } from "@ai-matrx/alchemy/react/workspace";
|
|
25264
25318
|
|
|
@@ -25347,10 +25401,10 @@ function useGridAssist(args) {
|
|
|
25347
25401
|
);
|
|
25348
25402
|
const fieldOf2 = useCallback26((key) => fields.find((f) => f.key === key), [fields]);
|
|
25349
25403
|
const onGridContext = host.onGridContext;
|
|
25350
|
-
const lastKey =
|
|
25404
|
+
const lastKey = useRef37("");
|
|
25351
25405
|
const editingAt = editing.editing;
|
|
25352
25406
|
const draft = editing.draft;
|
|
25353
|
-
|
|
25407
|
+
useEffect56(() => {
|
|
25354
25408
|
if (!enabled || !onGridContext) return;
|
|
25355
25409
|
const snapshot = gridContextSnapshot({
|
|
25356
25410
|
tableId,
|
|
@@ -25778,7 +25832,7 @@ function BulkActions({
|
|
|
25778
25832
|
}
|
|
25779
25833
|
|
|
25780
25834
|
// src/handOrder.tsx
|
|
25781
|
-
import { useEffect as
|
|
25835
|
+
import { useEffect as useEffect57, useMemo as useMemo39, useRef as useRef38, useState as useState71 } from "react";
|
|
25782
25836
|
import { useRecordsClient as useRecordsClient41 } from "@ai-matrx/records/react";
|
|
25783
25837
|
import { stableFilterKey as stableFilterKey2 } from "@ai-matrx/records";
|
|
25784
25838
|
import { Button as Button48, ConfirmDialog as ConfirmDialog4, Popover as Popover11, PopoverContent as PopoverContent11, PopoverTrigger as PopoverTrigger11, cn as cn40 } from "@ai-matrx/design-system";
|
|
@@ -25929,14 +25983,14 @@ function useHandOrderRows(args) {
|
|
|
25929
25983
|
const { viewId, active, page, pageSize } = args;
|
|
25930
25984
|
const filter = args.filter && Object.keys(args.filter).length > 0 ? args.filter : null;
|
|
25931
25985
|
const filterKey = filter ? stableFilterKey2(filter) : "";
|
|
25932
|
-
const filterNow =
|
|
25986
|
+
const filterNow = useRef38(filter);
|
|
25933
25987
|
filterNow.current = filter;
|
|
25934
25988
|
const [answer, setAnswer] = useState71(null);
|
|
25935
25989
|
const [tick, setTick] = useState71(0);
|
|
25936
25990
|
const limit = Math.max(1, Math.min(pageSize, DOOR_PAGE_MAX));
|
|
25937
25991
|
const offset = Math.max(0, page) * limit;
|
|
25938
25992
|
const key = `${viewId ?? ""}:${limit}:${offset}:${filterKey}`;
|
|
25939
|
-
|
|
25993
|
+
useEffect57(() => {
|
|
25940
25994
|
if (!active || !viewId) return;
|
|
25941
25995
|
let cancelled = false;
|
|
25942
25996
|
void client.readInViewOrder({ view_id: viewId, filter: filterNow.current, limit, offset }).then((result) => {
|
|
@@ -25975,7 +26029,7 @@ function HandOrderDialog({
|
|
|
25975
26029
|
const [dragging, setDragging] = useState71(null);
|
|
25976
26030
|
const [busy, setBusy] = useState71(false);
|
|
25977
26031
|
const [refused, setRefused] = useState71(null);
|
|
25978
|
-
|
|
26032
|
+
useEffect57(() => {
|
|
25979
26033
|
if (open) {
|
|
25980
26034
|
setList([...items]);
|
|
25981
26035
|
setRefused(null);
|
|
@@ -26047,7 +26101,7 @@ function HandOrderDialog({
|
|
|
26047
26101
|
}
|
|
26048
26102
|
|
|
26049
26103
|
// src/structureHidden.tsx
|
|
26050
|
-
import { useEffect as
|
|
26104
|
+
import { useEffect as useEffect58, useState as useState72 } from "react";
|
|
26051
26105
|
import { useRecordsClient as useRecordsClient42 } from "@ai-matrx/records/react";
|
|
26052
26106
|
import { jsx as jsx88 } from "react/jsx-runtime";
|
|
26053
26107
|
var STRUCTURE_LOCKED = "Confidential. Rows and columns are visible to people it\u2019s shared with.";
|
|
@@ -26056,7 +26110,7 @@ function useStructureHidden(tableId, level) {
|
|
|
26056
26110
|
const client = useRecordsClient42();
|
|
26057
26111
|
const asks = tableId !== null && mayHideStructure(level);
|
|
26058
26112
|
const [answer, setAnswer] = useState72(null);
|
|
26059
|
-
|
|
26113
|
+
useEffect58(() => {
|
|
26060
26114
|
if (!asks || tableId === null) return;
|
|
26061
26115
|
let live = true;
|
|
26062
26116
|
void client.tableLevelFacts({ table_id: tableId }).then((facts) => {
|
|
@@ -26213,7 +26267,7 @@ function GridBody({
|
|
|
26213
26267
|
const [heldOrder, setHeldOrder] = useState73(null);
|
|
26214
26268
|
const sortsKey = JSON.stringify(viewOrder?.sorts ?? []);
|
|
26215
26269
|
const [heldThen, setHeldThen] = useState73(null);
|
|
26216
|
-
|
|
26270
|
+
useEffect59(() => {
|
|
26217
26271
|
setHeldOrder(null);
|
|
26218
26272
|
setHeldThen(null);
|
|
26219
26273
|
}, [viewOrder?.viewId, viewOrder?.order, sortsKey]);
|
|
@@ -26231,8 +26285,8 @@ function GridBody({
|
|
|
26231
26285
|
const openingSort = manual ? null : viewSort ?? defaultSort;
|
|
26232
26286
|
const openingKey = openingSort ? `${openingSort.id}:${openingSort.direction}` : "none";
|
|
26233
26287
|
const address = useViewAddress();
|
|
26234
|
-
const addressSeed =
|
|
26235
|
-
const addressSort =
|
|
26288
|
+
const addressSeed = useRef39(address?.initial ?? null);
|
|
26289
|
+
const addressSort = useRef39(
|
|
26236
26290
|
address?.initial?.sort ? { id: address.initial.sort.field, direction: address.initial.sort.direction } : null
|
|
26237
26291
|
);
|
|
26238
26292
|
const [query, setQuery] = useState73(() => ({
|
|
@@ -26244,7 +26298,7 @@ function GridBody({
|
|
|
26244
26298
|
sort: addressSeed.current?.sort ? { id: addressSeed.current.sort.field, direction: addressSeed.current.sort.direction } : openingSort
|
|
26245
26299
|
}));
|
|
26246
26300
|
const [seatedOn, setSeatedOn] = useState73(openingKey);
|
|
26247
|
-
|
|
26301
|
+
useEffect59(() => {
|
|
26248
26302
|
const seed = addressSeed.current;
|
|
26249
26303
|
if (seed && fields.data) addressSeed.current = null;
|
|
26250
26304
|
setQuery((held) => ({
|
|
@@ -26254,14 +26308,14 @@ function GridBody({
|
|
|
26254
26308
|
}));
|
|
26255
26309
|
setSeatedOn(openingKey);
|
|
26256
26310
|
}, [openingKey]);
|
|
26257
|
-
|
|
26311
|
+
useEffect59(() => {
|
|
26258
26312
|
const held = addressSort.current;
|
|
26259
26313
|
if (held && (query.sort?.id !== held.id || query.sort?.direction !== held.direction)) addressSort.current = null;
|
|
26260
26314
|
}, [query.sort]);
|
|
26261
26315
|
const columnSort = query.sort;
|
|
26262
26316
|
const overrideKey = sortOverride ? `${sortOverride.field}:${sortOverride.direction}` : "";
|
|
26263
|
-
const overrideSeen =
|
|
26264
|
-
|
|
26317
|
+
const overrideSeen = useRef39(overrideKey);
|
|
26318
|
+
useEffect59(() => {
|
|
26265
26319
|
if (overrideSeen.current === overrideKey) return;
|
|
26266
26320
|
overrideSeen.current = overrideKey;
|
|
26267
26321
|
setQuery((held) => ({
|
|
@@ -26270,8 +26324,8 @@ function GridBody({
|
|
|
26270
26324
|
page: 1
|
|
26271
26325
|
}));
|
|
26272
26326
|
}, [overrideKey]);
|
|
26273
|
-
const overrideSearchSeen =
|
|
26274
|
-
|
|
26327
|
+
const overrideSearchSeen = useRef39(void 0);
|
|
26328
|
+
useEffect59(() => {
|
|
26275
26329
|
if (searchOverride === void 0) return;
|
|
26276
26330
|
const wanted = searchOverride ?? "";
|
|
26277
26331
|
if (overrideSearchSeen.current === wanted) return;
|
|
@@ -26279,7 +26333,7 @@ function GridBody({
|
|
|
26279
26333
|
setQuery((held) => held.search === wanted ? held : { ...held, search: wanted, page: 1 });
|
|
26280
26334
|
}, [searchOverride]);
|
|
26281
26335
|
const reportQuery = address?.report;
|
|
26282
|
-
|
|
26336
|
+
useEffect59(() => {
|
|
26283
26337
|
if (!reportQuery) return;
|
|
26284
26338
|
const sort = query.sort && `${query.sort.id}:${query.sort.direction}` !== openingKey ? { field: query.sort.id, direction: query.sort.direction } : null;
|
|
26285
26339
|
reportQuery({
|
|
@@ -26290,13 +26344,13 @@ function GridBody({
|
|
|
26290
26344
|
});
|
|
26291
26345
|
}, [reportQuery, query.sort, query.columnFilters, query.search, query.page, openingKey]);
|
|
26292
26346
|
const liveKeys = useMemo40(() => fields.data ? new Set(fields.data.map((f) => f.key)) : null, [fields.data]);
|
|
26293
|
-
|
|
26347
|
+
useEffect59(() => {
|
|
26294
26348
|
if (!liveKeys) return;
|
|
26295
26349
|
setQuery((held) => withoutGoneColumns(held, liveKeys, openingSort));
|
|
26296
26350
|
}, [liveKeys]);
|
|
26297
26351
|
const resetEpoch = address?.resetEpoch ?? 0;
|
|
26298
|
-
const resetSeen =
|
|
26299
|
-
|
|
26352
|
+
const resetSeen = useRef39(resetEpoch);
|
|
26353
|
+
useEffect59(() => {
|
|
26300
26354
|
if (resetSeen.current === resetEpoch) return;
|
|
26301
26355
|
resetSeen.current = resetEpoch;
|
|
26302
26356
|
addressSeed.current = null;
|
|
@@ -26305,7 +26359,7 @@ function GridBody({
|
|
|
26305
26359
|
}, [resetEpoch]);
|
|
26306
26360
|
const [page, setPage] = useState73(0);
|
|
26307
26361
|
const [searchTerm, setSearchTerm] = useState73("");
|
|
26308
|
-
|
|
26362
|
+
useEffect59(() => {
|
|
26309
26363
|
if (!storePaged) return;
|
|
26310
26364
|
const wanted = query.search.trim();
|
|
26311
26365
|
if (wanted === searchTerm) return;
|
|
@@ -26374,7 +26428,7 @@ function GridBody({
|
|
|
26374
26428
|
page: classicInCard ? 0 : page,
|
|
26375
26429
|
...readFilter ? { filter: readFilter } : {}
|
|
26376
26430
|
});
|
|
26377
|
-
const pageAskedFor =
|
|
26431
|
+
const pageAskedFor = useRef39(null);
|
|
26378
26432
|
if (fields.data && !table.loading) pageAskedFor.current = tableId;
|
|
26379
26433
|
const pageAsked = !storePaged || Boolean(fields.data) && pageAskedFor.current === tableId;
|
|
26380
26434
|
const numberAsked = useMemo40(() => autonumberSearchOf(fields.data ?? [], searchTerm), [fields.data, searchTerm]);
|
|
@@ -26404,9 +26458,9 @@ function GridBody({
|
|
|
26404
26458
|
const [appending, setAppending] = useState73(false);
|
|
26405
26459
|
const pageDoorViewId = manual && pageSort.length === 0 ? viewId : null;
|
|
26406
26460
|
const askKey2 = embeddedPageAskKey(tableId, pageSearch, pageSort, pageFilter ?? null, pageDoorViewId);
|
|
26407
|
-
const embeddedAskKey =
|
|
26461
|
+
const embeddedAskKey = useRef39(askKey2);
|
|
26408
26462
|
embeddedAskKey.current = askKey2;
|
|
26409
|
-
|
|
26463
|
+
useEffect59(() => {
|
|
26410
26464
|
setAppendedRows([]);
|
|
26411
26465
|
setAppendedPhysicalPages(0);
|
|
26412
26466
|
setAppending(false);
|
|
@@ -26447,16 +26501,16 @@ function GridBody({
|
|
|
26447
26501
|
const rows = added.rows;
|
|
26448
26502
|
const lockedRows = records.data?.locked ?? 0;
|
|
26449
26503
|
const rowIds = useMemo40(() => rows.map((row) => row.id), [rows]);
|
|
26450
|
-
const rowsShownRef =
|
|
26504
|
+
const rowsShownRef = useRef39(onRowsShown);
|
|
26451
26505
|
rowsShownRef.current = onRowsShown;
|
|
26452
|
-
|
|
26506
|
+
useEffect59(() => {
|
|
26453
26507
|
rowsShownRef.current?.(rowIds);
|
|
26454
26508
|
}, [rowIds]);
|
|
26455
26509
|
const countedButNotReturned = !records.error && !records.loading && rows.length === 0 && typeof records.data?.total === "number" && records.data.total > 0 && (storePaged ? query.page <= 1 : page <= 0);
|
|
26456
|
-
const reReads =
|
|
26457
|
-
const reloadRecords =
|
|
26510
|
+
const reReads = useRef39(0);
|
|
26511
|
+
const reloadRecords = useRef39(records.reload);
|
|
26458
26512
|
reloadRecords.current = records.reload;
|
|
26459
|
-
|
|
26513
|
+
useEffect59(() => {
|
|
26460
26514
|
if (!countedButNotReturned) {
|
|
26461
26515
|
reReads.current = 0;
|
|
26462
26516
|
return;
|
|
@@ -26488,10 +26542,10 @@ function GridBody({
|
|
|
26488
26542
|
);
|
|
26489
26543
|
const canWrite = Boolean(editable) && (rights.write || askPerRow && rowIds.some(mayWriteRow));
|
|
26490
26544
|
const readOnly = !editable || Boolean(host.rights) && !rights.write && !rights.structure;
|
|
26491
|
-
const gridBox =
|
|
26492
|
-
const lastExit =
|
|
26493
|
-
const pushWritten =
|
|
26494
|
-
const sheetController =
|
|
26545
|
+
const gridBox = useRef39(null);
|
|
26546
|
+
const lastExit = useRef39(null);
|
|
26547
|
+
const pushWritten = useRef39(null);
|
|
26548
|
+
const sheetController = useRef39(null);
|
|
26495
26549
|
const versions = (0, recordVersions_exports.useRecordVersions)(client, rows);
|
|
26496
26550
|
const editing = useGridEditing({
|
|
26497
26551
|
tableId,
|
|
@@ -26516,7 +26570,7 @@ function GridBody({
|
|
|
26516
26570
|
}
|
|
26517
26571
|
} : {}
|
|
26518
26572
|
});
|
|
26519
|
-
const editingNow =
|
|
26573
|
+
const editingNow = useRef39(editing);
|
|
26520
26574
|
editingNow.current = editing;
|
|
26521
26575
|
const editingHandle = useMemo40(
|
|
26522
26576
|
() => new Proxy({}, {
|
|
@@ -26714,8 +26768,8 @@ function GridBody({
|
|
|
26714
26768
|
const [deleting, setDeleting] = useState73(null);
|
|
26715
26769
|
const [deleteBusy, setDeleteBusy] = useState73(false);
|
|
26716
26770
|
const [archived, setArchived] = useState73(null);
|
|
26717
|
-
const choiceOptions =
|
|
26718
|
-
const relationNames =
|
|
26771
|
+
const choiceOptions = useRef39(/* @__PURE__ */ new Map());
|
|
26772
|
+
const relationNames = useRef39(/* @__PURE__ */ new Map());
|
|
26719
26773
|
const loadRelationNames = useCallback28(
|
|
26720
26774
|
async (fieldList, wanted) => {
|
|
26721
26775
|
relationNames.current = /* @__PURE__ */ new Map();
|
|
@@ -26942,7 +26996,7 @@ function GridBody({
|
|
|
26942
26996
|
},
|
|
26943
26997
|
[rows, client, tableId, editing, undo, records, versions, fields.data]
|
|
26944
26998
|
);
|
|
26945
|
-
const pasteAtOnce =
|
|
26999
|
+
const pasteAtOnce = useRef39(applyPasteAsOne);
|
|
26946
27000
|
pasteAtOnce.current = applyPasteAsOne;
|
|
26947
27001
|
const writeRange = useCallback28(
|
|
26948
27002
|
async (patches, intent) => {
|
|
@@ -27046,7 +27100,7 @@ function GridBody({
|
|
|
27046
27100
|
return { written, readBack, missing, refusals };
|
|
27047
27101
|
}, [pastePlan, client, tableId, records, merged, applyPasteAsOne, versions, fields.data]);
|
|
27048
27102
|
const columnIds = useMemo40(() => ordered.map((field2) => field2.key), [ordered]);
|
|
27049
|
-
const lookWrites =
|
|
27103
|
+
const lookWrites = useRef39(null);
|
|
27050
27104
|
const writeLook = useCallback28(
|
|
27051
27105
|
(next) => {
|
|
27052
27106
|
if (!onPresentationChange) return;
|
|
@@ -27118,7 +27172,7 @@ function GridBody({
|
|
|
27118
27172
|
total: typeof records.data?.total === "number" ? records.data.total : null,
|
|
27119
27173
|
search: searchTerm
|
|
27120
27174
|
});
|
|
27121
|
-
const followRef =
|
|
27175
|
+
const followRef = useRef39({ openRecordId, onOpenRecord, onCloseRecord });
|
|
27122
27176
|
followRef.current = { openRecordId, onOpenRecord, onCloseRecord };
|
|
27123
27177
|
const toggleRecord = useCallback28((rowId) => {
|
|
27124
27178
|
const { openRecordId: open, onOpenRecord: openIt, onCloseRecord: closeIt } = followRef.current;
|
|
@@ -27135,7 +27189,7 @@ function GridBody({
|
|
|
27135
27189
|
},
|
|
27136
27190
|
[assist.onSelectionChange]
|
|
27137
27191
|
);
|
|
27138
|
-
const addRowRef =
|
|
27192
|
+
const addRowRef = useRef39(() => void 0);
|
|
27139
27193
|
const valueFacets = useStoreValueFacets(merged && storePaged, {
|
|
27140
27194
|
client,
|
|
27141
27195
|
tableId,
|
|
@@ -27144,7 +27198,7 @@ function GridBody({
|
|
|
27144
27198
|
columnFilters: query.columnFilters
|
|
27145
27199
|
});
|
|
27146
27200
|
const [localWidths, setLocalWidths] = useState73(null);
|
|
27147
|
-
const widthsNow =
|
|
27201
|
+
const widthsNow = useRef39({ localWidths, presentation, writeLook });
|
|
27148
27202
|
widthsNow.current = { localWidths, presentation, writeLook };
|
|
27149
27203
|
const forgetWidth = useCallback28((key) => {
|
|
27150
27204
|
const { localWidths: held, presentation: look2, writeLook: write } = widthsNow.current;
|
|
@@ -27248,19 +27302,19 @@ function GridBody({
|
|
|
27248
27302
|
}
|
|
27249
27303
|
}, [added, controls.columns, columnIds, fields.data, editing, records, undo, formHosted, presetValues]);
|
|
27250
27304
|
addRowRef.current = () => void addRowHere();
|
|
27251
|
-
const addFromTemplateRef =
|
|
27305
|
+
const addFromTemplateRef = useRef39(() => void 0);
|
|
27252
27306
|
addFromTemplateRef.current = (values) => void addRowHere(values);
|
|
27253
|
-
const formCreatedRef =
|
|
27307
|
+
const formCreatedRef = useRef39(() => void 0);
|
|
27254
27308
|
formCreatedRef.current = (id) => {
|
|
27255
27309
|
added.pin({ id, document: {}, level: "editor", hidden: {} });
|
|
27256
27310
|
undo.push({ label: "Added a record", cells: [], created: [id] });
|
|
27257
27311
|
records.reload();
|
|
27258
27312
|
};
|
|
27259
27313
|
const labels = useRecordLabels(ordered);
|
|
27260
|
-
const labelsNow =
|
|
27314
|
+
const labelsNow = useRef39(labels);
|
|
27261
27315
|
labelsNow.current = labels;
|
|
27262
27316
|
const labelFor = useCallback28((field2, id) => labelsNow.current(field2, id), []);
|
|
27263
|
-
|
|
27317
|
+
useEffect59(() => {
|
|
27264
27318
|
for (const field2 of ordered) {
|
|
27265
27319
|
if (!pointsAtRecords(field2)) continue;
|
|
27266
27320
|
for (const row of rows) for (const id of idsOf(row.document?.[field2.key])) labels(field2, id);
|
|
@@ -27309,7 +27363,7 @@ function GridBody({
|
|
|
27309
27363
|
pinCell
|
|
27310
27364
|
]
|
|
27311
27365
|
);
|
|
27312
|
-
const footerNow =
|
|
27366
|
+
const footerNow = useRef39({
|
|
27313
27367
|
summaryCell: () => null,
|
|
27314
27368
|
addLine: () => null,
|
|
27315
27369
|
choose: () => void 0,
|
|
@@ -27338,7 +27392,7 @@ function GridBody({
|
|
|
27338
27392
|
},
|
|
27339
27393
|
addLine: () => /* @__PURE__ */ jsx89(AddRowLine, { onAdd: () => footerNow.current.add(), busy: added.busy, label: newRowLabel ?? "Add row" })
|
|
27340
27394
|
};
|
|
27341
|
-
const addColumnNow =
|
|
27395
|
+
const addColumnNow = useRef39(controls.addColumn);
|
|
27342
27396
|
addColumnNow.current = controls.addColumn;
|
|
27343
27397
|
const rowIdsOnScreen = useMemo40(() => rows.map((row) => row.id), [rows]);
|
|
27344
27398
|
const reverseGridColumns = useReverseGridColumns(tableId, rowIdsOnScreen);
|
|
@@ -27402,7 +27456,7 @@ function GridBody({
|
|
|
27402
27456
|
[treeColumns, reverseGridColumns, onOpenRecord, table.data, merged, mayAddRow, hrefForRecord, navigate]
|
|
27403
27457
|
);
|
|
27404
27458
|
const isRowSelectable = useCallback28((row) => row.id !== SUMMARY_ROW.id && mayWriteRow(row.id), [mayWriteRow]);
|
|
27405
|
-
const viewRowsNow =
|
|
27459
|
+
const viewRowsNow = useRef39([]);
|
|
27406
27460
|
viewRowsNow.current = rows.filter((row) => row.id !== SUMMARY_ROW.id);
|
|
27407
27461
|
const copyConfig = useMemo40(
|
|
27408
27462
|
() => table.data ? gridCopyConfig({
|
|
@@ -27428,7 +27482,7 @@ function GridBody({
|
|
|
27428
27482
|
},
|
|
27429
27483
|
[paint]
|
|
27430
27484
|
);
|
|
27431
|
-
const rowActionsNow =
|
|
27485
|
+
const rowActionsNow = useRef39({ runner, handToAgent, host, table: table.data, duplicate });
|
|
27432
27486
|
rowActionsNow.current = { runner, handToAgent, host, table: table.data, duplicate };
|
|
27433
27487
|
const offersRowActions = !embedded && (canWrite || Boolean(host.talkToRecord) || Boolean(!readOnly && host.runAgentAction && tableActions2.agent.length > 0));
|
|
27434
27488
|
const hasTalk = Boolean(host.talkToRecord);
|
|
@@ -27504,8 +27558,8 @@ function GridBody({
|
|
|
27504
27558
|
// eslint-disable-next-line react-hooks/exhaustive-deps -- `hasTalk`/`hasAgent` stand for the host ports the JSX reads; handlers run through `rowActionsNow`.
|
|
27505
27559
|
[canWrite, mayWriteRow, tableActions2.runnable, tableActions2.agent, runner.busy, hasTalk, hasAgent, editable, rights.write, readOnly]
|
|
27506
27560
|
);
|
|
27507
|
-
const headerHeld =
|
|
27508
|
-
const menuLatest =
|
|
27561
|
+
const headerHeld = useRef39(/* @__PURE__ */ new Map());
|
|
27562
|
+
const menuLatest = useRef39(/* @__PURE__ */ new Map());
|
|
27509
27563
|
const addColumnDef = useMemo40(() => addColumnColumn(() => addColumnNow.current()), []);
|
|
27510
27564
|
const drawnColumns = useMemo40(
|
|
27511
27565
|
() => {
|
|
@@ -27520,7 +27574,7 @@ function GridBody({
|
|
|
27520
27574
|
},
|
|
27521
27575
|
[bodyColumns, controls.headerMenuFor, controls.filterFor, merged, rights.structure, readOnly, addColumnDef, offersRowActions, mayManageActions]
|
|
27522
27576
|
);
|
|
27523
|
-
const columnsHeld =
|
|
27577
|
+
const columnsHeld = useRef39(null);
|
|
27524
27578
|
const columns = columnsHeld.current !== null && sameColumns(columnsHeld.current, drawnColumns) ? columnsHeld.current : drawnColumns;
|
|
27525
27579
|
columnsHeld.current = columns;
|
|
27526
27580
|
const tableColumns = useMemo40(
|
|
@@ -27668,7 +27722,7 @@ function GridBody({
|
|
|
27668
27722
|
}),
|
|
27669
27723
|
[storePaged, coverageTotal]
|
|
27670
27724
|
);
|
|
27671
|
-
const sheetNow =
|
|
27725
|
+
const sheetNow = useRef39({ merged, writeRange, editing, fields: fields.data ?? [], rows, mayWriteRow, notify: host.notify });
|
|
27672
27726
|
sheetNow.current = { merged, writeRange, editing, fields: fields.data ?? [], rows, mayWriteRow, notify: host.notify };
|
|
27673
27727
|
const hasNotify = Boolean(host.notify);
|
|
27674
27728
|
const readOnlyReason = !editable || !rights.known || rights.write ? "Editing is off here, so this table can be copied but not changed." : rights.why("write");
|
|
@@ -28017,7 +28071,7 @@ function GridBody({
|
|
|
28017
28071
|
);
|
|
28018
28072
|
const rowMemoryKey = `${tableId}:${embedded ? "embedded" : "page"}:${openingKey}`;
|
|
28019
28073
|
const rowsAnswered = Boolean(records.data) && !records.loading && !table.loading && !fields.loading;
|
|
28020
|
-
|
|
28074
|
+
useEffect59(() => {
|
|
28021
28075
|
if (rowsAnswered) {
|
|
28022
28076
|
rememberRowCount(rowMemoryKey, rows.length);
|
|
28023
28077
|
if (!embedded) rememberRowCount(`${tableId}:page:last`, rows.length);
|
|
@@ -28779,7 +28833,7 @@ function ConnectedRecordsTableCard({
|
|
|
28779
28833
|
// src/ExportMenu.tsx
|
|
28780
28834
|
import { copyText as copyText3 } from "@ai-matrx/kit/clipboard";
|
|
28781
28835
|
import { downloadFile as downloadFile2 } from "@ai-matrx/kit/download";
|
|
28782
|
-
import { useEffect as
|
|
28836
|
+
import { useEffect as useEffect60, useState as useState74 } from "react";
|
|
28783
28837
|
import { useFields as useFields14, useRecords as useRecords7, useRecordsClient as useRecordsClient45, useTable as useTable12 } from "@ai-matrx/records/react";
|
|
28784
28838
|
import { exportCsv, exportMarkdown, exportXlsx, wholeValueOf as wholeValueOf5, withWholeValues } from "@ai-matrx/records/core";
|
|
28785
28839
|
|
|
@@ -28894,7 +28948,7 @@ function ExportMenu({ tableId, rows, label, className, view }) {
|
|
|
28894
28948
|
const page = useRecords7(view ? null : tableId, { pageSize: 500 });
|
|
28895
28949
|
const viewKey = view ? JSON.stringify([view.filter ?? null, view.sorts ?? [], view.viewId ?? null]) : "";
|
|
28896
28950
|
const [viewRead, setViewRead] = useState74(null);
|
|
28897
|
-
|
|
28951
|
+
useEffect60(() => {
|
|
28898
28952
|
if (!view || !fields.data) return;
|
|
28899
28953
|
let live = true;
|
|
28900
28954
|
void readViewRows(client, tableId, fields.data, view).then((read) => {
|
|
@@ -29027,7 +29081,7 @@ function ExportMenu({ tableId, rows, label, className, view }) {
|
|
|
29027
29081
|
}
|
|
29028
29082
|
|
|
29029
29083
|
// src/ImportNotice.tsx
|
|
29030
|
-
import { useCallback as useCallback29, useEffect as
|
|
29084
|
+
import { useCallback as useCallback29, useEffect as useEffect61, useMemo as useMemo42, useState as useState75 } from "react";
|
|
29031
29085
|
import { useRecordsClient as useRecordsClient46 } from "@ai-matrx/records/react";
|
|
29032
29086
|
import { Button as Button52, cn as cn43 } from "@ai-matrx/design-system";
|
|
29033
29087
|
import { jsx as jsx93, jsxs as jsxs82 } from "react/jsx-runtime";
|
|
@@ -29058,7 +29112,7 @@ function ImportNotice({ tableId, onOpenImport, epoch = 0, className }) {
|
|
|
29058
29112
|
const [problem, setProblem] = useState75(null);
|
|
29059
29113
|
const [report, setReport] = useState75(null);
|
|
29060
29114
|
const [dismissed, setDismissed] = useState75(null);
|
|
29061
|
-
|
|
29115
|
+
useEffect61(() => {
|
|
29062
29116
|
let live = true;
|
|
29063
29117
|
void client.imports({ table_id: tableId, limit: 5 }).then((answered) => {
|
|
29064
29118
|
if (!live) return;
|
|
@@ -29073,7 +29127,7 @@ function ImportNotice({ tableId, onOpenImport, epoch = 0, className }) {
|
|
|
29073
29127
|
}, [client, tableId, epoch]);
|
|
29074
29128
|
const run = useMemo42(() => runs ? runToNotice(runs) : null, [runs]);
|
|
29075
29129
|
const shown5 = run && !wasDismissed(run.import_id) && dismissed !== run.import_id ? run : null;
|
|
29076
|
-
|
|
29130
|
+
useEffect61(() => {
|
|
29077
29131
|
if (!shown5 || report?.import_id === shown5.import_id) return;
|
|
29078
29132
|
let live = true;
|
|
29079
29133
|
void client.importReport({ import_id: shown5.import_id, state: "refused", limit: 500 }).then((answered) => {
|
|
@@ -29131,7 +29185,7 @@ function ImportNotice({ tableId, onOpenImport, epoch = 0, className }) {
|
|
|
29131
29185
|
}
|
|
29132
29186
|
|
|
29133
29187
|
// src/SaveToTable.tsx
|
|
29134
|
-
import { useEffect as
|
|
29188
|
+
import { useEffect as useEffect67, useMemo as useMemo46, useRef as useRef42, useState as useState82 } from "react";
|
|
29135
29189
|
import { useRecordsClient as useRecordsClient53, useMyLevels as useMyLevels3, useTables as useTables3 } from "@ai-matrx/records/react";
|
|
29136
29190
|
import {
|
|
29137
29191
|
Button as Button60,
|
|
@@ -29182,14 +29236,14 @@ async function findUnfinishedTable(client, wantedName, wantedKeys, wantedRows, n
|
|
|
29182
29236
|
}
|
|
29183
29237
|
|
|
29184
29238
|
// src/TablesHome.tsx
|
|
29185
|
-
import { useEffect as
|
|
29239
|
+
import { useEffect as useEffect66, useState as useState81 } from "react";
|
|
29186
29240
|
import { useRecordsClient as useRecordsClient52, useTables as useTables2 } from "@ai-matrx/records/react";
|
|
29187
29241
|
import { withTableFacts } from "@ai-matrx/records/core";
|
|
29188
29242
|
import { withTablePlacement as withTablePlacement2 } from "@ai-matrx/records";
|
|
29189
29243
|
import { Button as Button59, Skeleton as Skeleton10, cn as cn48 } from "@ai-matrx/design-system";
|
|
29190
29244
|
|
|
29191
29245
|
// src/NewTableStart.tsx
|
|
29192
|
-
import { useCallback as useCallback30, useMemo as useMemo43, useRef as
|
|
29246
|
+
import { useCallback as useCallback30, useMemo as useMemo43, useRef as useRef40, useState as useState76 } from "react";
|
|
29193
29247
|
import { tableShapeChanged as tableShapeChanged7, useRecordsClient as useRecordsClient47 } from "@ai-matrx/records/react";
|
|
29194
29248
|
import {
|
|
29195
29249
|
BasicInput as BasicInput15,
|
|
@@ -29482,7 +29536,7 @@ function NewTableStart({
|
|
|
29482
29536
|
const [busy, setBusy] = useState76(false);
|
|
29483
29537
|
const [error, setError] = useState76(null);
|
|
29484
29538
|
const [name, setName] = useState76("");
|
|
29485
|
-
const nameTyped =
|
|
29539
|
+
const nameTyped = useRef40("");
|
|
29486
29540
|
nameTyped.current = name;
|
|
29487
29541
|
const [columnWords2, setColumnWords] = useState76("");
|
|
29488
29542
|
const [columns, setColumns] = useState76([]);
|
|
@@ -29495,7 +29549,7 @@ function NewTableStart({
|
|
|
29495
29549
|
const [importName, setImportName] = useState76("");
|
|
29496
29550
|
const [target, setTarget] = useState76(NEW_TABLE2);
|
|
29497
29551
|
const [dragging, setDragging] = useState76(false);
|
|
29498
|
-
const fileInput =
|
|
29552
|
+
const fileInput = useRef40(null);
|
|
29499
29553
|
const parsed = useMemo43(() => read ? importFromGrid(read.grid, headerRow) : null, [read, headerRow]);
|
|
29500
29554
|
const intoTables = useMemo43(
|
|
29501
29555
|
() => (existingTables ?? []).filter((t) => !t.is_kernel).slice().sort((a, b) => tableName(a).localeCompare(tableName(b))),
|
|
@@ -29888,7 +29942,7 @@ function NewTableColumns({
|
|
|
29888
29942
|
|
|
29889
29943
|
// src/BookingSlots.tsx
|
|
29890
29944
|
import { copyText as copyText5 } from "@ai-matrx/kit/clipboard";
|
|
29891
|
-
import { useCallback as useCallback33, useEffect as
|
|
29945
|
+
import { useCallback as useCallback33, useEffect as useEffect64, useMemo as useMemo45, useState as useState79 } from "react";
|
|
29892
29946
|
import { useRecordsClient as useRecordsClient50, useMyLevels as useMyLevels2 } from "@ai-matrx/records/react";
|
|
29893
29947
|
import { bookingPath as bookingPath2 } from "@ai-matrx/records";
|
|
29894
29948
|
import { Badge as Badge11, Button as Button57, Skeleton as Skeleton9, cn as cn47 } from "@ai-matrx/design-system";
|
|
@@ -29896,7 +29950,7 @@ import { Badge as Badge11, Button as Button57, Skeleton as Skeleton9, cn as cn47
|
|
|
29896
29950
|
// src/BookingBuilder.tsx
|
|
29897
29951
|
import { copyText as copyText4 } from "@ai-matrx/kit/clipboard";
|
|
29898
29952
|
import { ErrorBox as ErrorBox3 } from "@ai-matrx/design-system";
|
|
29899
|
-
import { useCallback as useCallback31, useEffect as
|
|
29953
|
+
import { useCallback as useCallback31, useEffect as useEffect62, useMemo as useMemo44, useRef as useRef41, useState as useState77 } from "react";
|
|
29900
29954
|
import { useFields as useFields15, useRecordsClient as useRecordsClient48, useTable as useTable13 } from "@ai-matrx/records/react";
|
|
29901
29955
|
import { formatDurationMinutes } from "@ai-matrx/kit/format";
|
|
29902
29956
|
import {
|
|
@@ -30034,7 +30088,7 @@ function BookingBuilder({ tableId, bookingId, onSaved, onClose, startNew, classN
|
|
|
30034
30088
|
const [confirmation, setConfirmation] = useState77("");
|
|
30035
30089
|
const [offer, setOffer] = useState77(null);
|
|
30036
30090
|
const [formId, setFormId] = useState77(bookingId ?? null);
|
|
30037
|
-
const madeRef =
|
|
30091
|
+
const madeRef = useRef41(null);
|
|
30038
30092
|
const publicOrigin = host.publicOrigin ?? (typeof window === "undefined" ? "" : window.location.origin);
|
|
30039
30093
|
const askable = useMemo44(
|
|
30040
30094
|
() => askableFields(fields.data ?? [], STORE_ANSWERS_THESE),
|
|
@@ -30070,19 +30124,19 @@ function BookingBuilder({ tableId, bookingId, onSaved, onClose, startNew, classN
|
|
|
30070
30124
|
}
|
|
30071
30125
|
setLoaded(true);
|
|
30072
30126
|
}, [client, tableId, bookingId, startNew]);
|
|
30073
|
-
|
|
30127
|
+
useEffect62(() => {
|
|
30074
30128
|
void load();
|
|
30075
30129
|
}, [load]);
|
|
30076
|
-
|
|
30130
|
+
useEffect62(() => {
|
|
30077
30131
|
if (title !== "" || !table.data) return;
|
|
30078
30132
|
setTitle(existing?.title ?? `Book a ${minutes}-minute ${singularNoun(table.data, "appointment")}`);
|
|
30079
30133
|
}, [table.data, existing]);
|
|
30080
|
-
|
|
30134
|
+
useEffect62(() => {
|
|
30081
30135
|
if (!existing) return;
|
|
30082
30136
|
setMinutes(existing.slot_minutes);
|
|
30083
30137
|
if (existing.timezone && existing.timezone !== "UTC") setTimezone(existing.timezone);
|
|
30084
30138
|
}, [existing]);
|
|
30085
|
-
|
|
30139
|
+
useEffect62(() => {
|
|
30086
30140
|
if (!offer) return;
|
|
30087
30141
|
setWindows(draftWindows(offer));
|
|
30088
30142
|
setMinutes(offer.slot_minutes);
|
|
@@ -30104,8 +30158,8 @@ function BookingBuilder({ tableId, bookingId, onSaved, onClose, startNew, classN
|
|
|
30104
30158
|
}),
|
|
30105
30159
|
[timezone, minutes, buffer, lead, perDay, days, windows]
|
|
30106
30160
|
);
|
|
30107
|
-
const startedAsking =
|
|
30108
|
-
|
|
30161
|
+
const startedAsking = useRef41(false);
|
|
30162
|
+
useEffect62(() => {
|
|
30109
30163
|
if (startedAsking.current || !loaded || existing || formId || !fields.data) return;
|
|
30110
30164
|
startedAsking.current = true;
|
|
30111
30165
|
if (asked4.length > 0) return;
|
|
@@ -30133,7 +30187,7 @@ function BookingBuilder({ tableId, bookingId, onSaved, onClose, startNew, classN
|
|
|
30133
30187
|
setWhoAdded(true);
|
|
30134
30188
|
}
|
|
30135
30189
|
const [whoAdded, setWhoAdded] = useState77(false);
|
|
30136
|
-
|
|
30190
|
+
useEffect62(() => {
|
|
30137
30191
|
if (!whoAdded) return;
|
|
30138
30192
|
const who = askable.filter((f) => isWhoField(f)).map((f) => f.key);
|
|
30139
30193
|
if (who.length === 0) return;
|
|
@@ -30439,7 +30493,7 @@ function BuildOrAsk({
|
|
|
30439
30493
|
}
|
|
30440
30494
|
|
|
30441
30495
|
// src/BuiltOnArchive.tsx
|
|
30442
|
-
import { useCallback as useCallback32, useEffect as
|
|
30496
|
+
import { useCallback as useCallback32, useEffect as useEffect63, useState as useState78 } from "react";
|
|
30443
30497
|
import {
|
|
30444
30498
|
archivedWhen,
|
|
30445
30499
|
BUILT_KIND_WORD
|
|
@@ -30539,7 +30593,7 @@ function ArchivedBuiltOn({ tableId, onRestored }) {
|
|
|
30539
30593
|
setError(null);
|
|
30540
30594
|
setThings(archivedThings(forms.data, checklists.data));
|
|
30541
30595
|
}, [client, tableId]);
|
|
30542
|
-
|
|
30596
|
+
useEffect63(() => {
|
|
30543
30597
|
void read();
|
|
30544
30598
|
}, [read]);
|
|
30545
30599
|
const restore = async (thing) => {
|
|
@@ -30631,7 +30685,7 @@ function BookingSlots({ tableId, activeBookingId, className }) {
|
|
|
30631
30685
|
setError(null);
|
|
30632
30686
|
setPages(answered.data);
|
|
30633
30687
|
}, [client, tableId]);
|
|
30634
|
-
|
|
30688
|
+
useEffect64(() => {
|
|
30635
30689
|
void load();
|
|
30636
30690
|
}, [load]);
|
|
30637
30691
|
const subjectIds = useMemo45(
|
|
@@ -30848,7 +30902,7 @@ function nextInWords(page) {
|
|
|
30848
30902
|
}
|
|
30849
30903
|
|
|
30850
30904
|
// src/WhereItLives.tsx
|
|
30851
|
-
import { useEffect as
|
|
30905
|
+
import { useEffect as useEffect65, useState as useState80 } from "react";
|
|
30852
30906
|
import { moveConsequence } from "@ai-matrx/records";
|
|
30853
30907
|
import { useRecordsClient as useRecordsClient51 } from "@ai-matrx/records/react";
|
|
30854
30908
|
import { Button as Button58, ErrorBox as ErrorBox4, Popover as Popover12, PopoverContent as PopoverContent12, PopoverTrigger as PopoverTrigger12 } from "@ai-matrx/design-system";
|
|
@@ -30860,7 +30914,7 @@ function WhereItLives({ tableId, knownOrganizationName, onMoved, variant = "head
|
|
|
30860
30914
|
const [attempt, setAttempt] = useState80(0);
|
|
30861
30915
|
const [open, setOpen] = useState80(false);
|
|
30862
30916
|
const [armed, setArmed] = useState80(variant === "anchor" ? false : variant !== "row" || !knownOrganizationName);
|
|
30863
|
-
|
|
30917
|
+
useEffect65(() => {
|
|
30864
30918
|
if (openAsked <= 0) return;
|
|
30865
30919
|
setArmed(true);
|
|
30866
30920
|
setOpen(true);
|
|
@@ -30868,7 +30922,7 @@ function WhereItLives({ tableId, knownOrganizationName, onMoved, variant = "head
|
|
|
30868
30922
|
const [choosing, setChoosing] = useState80(null);
|
|
30869
30923
|
const [moving, setMoving] = useState80(false);
|
|
30870
30924
|
const [said2, setSaid] = useState80(null);
|
|
30871
|
-
|
|
30925
|
+
useEffect65(() => {
|
|
30872
30926
|
if (!armed) return;
|
|
30873
30927
|
let alive = true;
|
|
30874
30928
|
setAnswer(null);
|
|
@@ -31126,7 +31180,7 @@ function TablesHome({ onOpenTable, organizationName, makingOnly = false, askedBy
|
|
|
31126
31180
|
const tables = useTables2();
|
|
31127
31181
|
const me = client.config.actor.user_id ?? null;
|
|
31128
31182
|
const [facts, setFacts] = useState81({ phase: "reading" });
|
|
31129
|
-
|
|
31183
|
+
useEffect66(() => {
|
|
31130
31184
|
let alive = true;
|
|
31131
31185
|
void client.tableFacts().then((answered) => {
|
|
31132
31186
|
if (!alive) return;
|
|
@@ -31144,7 +31198,7 @@ function TablesHome({ onOpenTable, organizationName, makingOnly = false, askedBy
|
|
|
31144
31198
|
const keptCount = listed.filter((t) => laneFor(t) === "app").length;
|
|
31145
31199
|
const [askedName, setAskedName] = useState81(null);
|
|
31146
31200
|
const firstTableId = listed[0]?.id ?? null;
|
|
31147
|
-
|
|
31201
|
+
useEffect66(() => {
|
|
31148
31202
|
if (organizationName || !firstTableId) return;
|
|
31149
31203
|
let alive = true;
|
|
31150
31204
|
void client.tableHome({ table_id: firstTableId }).then((answered) => {
|
|
@@ -31159,12 +31213,12 @@ function TablesHome({ onOpenTable, organizationName, makingOnly = false, askedBy
|
|
|
31159
31213
|
const sectionsKnown = facts.phase !== "failed";
|
|
31160
31214
|
const [creating, setCreating] = useState81(() => (askedBy?.create ?? 0) > 0);
|
|
31161
31215
|
const createAsked = askedBy?.create ?? 0;
|
|
31162
|
-
|
|
31216
|
+
useEffect66(() => {
|
|
31163
31217
|
if (createAsked > 0) setCreating(true);
|
|
31164
31218
|
}, [createAsked]);
|
|
31165
31219
|
const hostButtons = askedBy !== void 0;
|
|
31166
31220
|
const [boards, setBoards] = useState81(null);
|
|
31167
|
-
|
|
31221
|
+
useEffect66(() => {
|
|
31168
31222
|
if (makingOnly) return;
|
|
31169
31223
|
let cancelled = false;
|
|
31170
31224
|
void client.dashboards({}).then((result) => {
|
|
@@ -31371,10 +31425,10 @@ function SaveToTable({ source, shapeIndex = 0, onOpenTable, onSaved, onClose, ma
|
|
|
31371
31425
|
const [phase, setPhase] = useState82("ready");
|
|
31372
31426
|
const [made, setMade] = useState82(null);
|
|
31373
31427
|
const sourceName = source.title?.trim() || shape?.name || "the rows above";
|
|
31374
|
-
const makeRef =
|
|
31375
|
-
const madeAtOnce =
|
|
31428
|
+
const makeRef = useRef42(null);
|
|
31429
|
+
const madeAtOnce = useRef42(false);
|
|
31376
31430
|
const tablesKnown = tables.data !== void 0;
|
|
31377
|
-
|
|
31431
|
+
useEffect67(() => {
|
|
31378
31432
|
if (!makeAtOnce || madeAtOnce.current || !shape || !tablesKnown || !makeRef.current) return;
|
|
31379
31433
|
madeAtOnce.current = true;
|
|
31380
31434
|
void makeRef.current();
|
|
@@ -31750,7 +31804,7 @@ function SaveToTable({ source, shapeIndex = 0, onOpenTable, onSaved, onClose, ma
|
|
|
31750
31804
|
}
|
|
31751
31805
|
|
|
31752
31806
|
// src/StageRules.tsx
|
|
31753
|
-
import { useCallback as useCallback34, useEffect as
|
|
31807
|
+
import { useCallback as useCallback34, useEffect as useEffect68, useMemo as useMemo47, useState as useState83 } from "react";
|
|
31754
31808
|
import { useFields as useFields16, useRecordsClient as useRecordsClient54, useTable as useTable14 } from "@ai-matrx/records/react";
|
|
31755
31809
|
import { BasicInput as BasicInput18, BasicTextarea as BasicTextarea8, Button as Button61, Separator as Separator7, Skeleton as Skeleton11, cn as cn50 } from "@ai-matrx/design-system";
|
|
31756
31810
|
import { Select as Select13 } from "@ai-matrx/design-system/controls";
|
|
@@ -31806,7 +31860,7 @@ function StageRulesSection({ tableId, stage, className }) {
|
|
|
31806
31860
|
if (mode.ok) setEnforcement(mode.data);
|
|
31807
31861
|
setAsked(true);
|
|
31808
31862
|
}, [client, tableId]);
|
|
31809
|
-
|
|
31863
|
+
useEffect68(() => {
|
|
31810
31864
|
void load();
|
|
31811
31865
|
}, [load]);
|
|
31812
31866
|
const stages = pipeline?.stages ?? [];
|
|
@@ -31817,7 +31871,7 @@ function StageRulesSection({ tableId, stage, className }) {
|
|
|
31817
31871
|
() => (fields.data ?? []).map((f) => ({ id: String(f.id), key: f.key, label: fieldName(f), field: f })),
|
|
31818
31872
|
[fields.data]
|
|
31819
31873
|
);
|
|
31820
|
-
|
|
31874
|
+
useEffect68(() => {
|
|
31821
31875
|
if (!draft || !stageKey || !draft.demands || Object.keys(draft.demands).length === 0) {
|
|
31822
31876
|
setPreview(null);
|
|
31823
31877
|
setPreviewError(null);
|
|
@@ -32037,7 +32091,7 @@ function Clause({
|
|
|
32037
32091
|
}
|
|
32038
32092
|
|
|
32039
32093
|
// src/TableRename.tsx
|
|
32040
|
-
import { useCallback as useCallback35, useEffect as
|
|
32094
|
+
import { useCallback as useCallback35, useEffect as useEffect69, useRef as useRef43, useState as useState84 } from "react";
|
|
32041
32095
|
import { tableShapeChanged as tableShapeChanged8, useRecordsClient as useRecordsClient55 } from "@ai-matrx/records/react";
|
|
32042
32096
|
import {
|
|
32043
32097
|
Button as Button62,
|
|
@@ -32059,7 +32113,7 @@ function tableNameProblem(typed2) {
|
|
|
32059
32113
|
}
|
|
32060
32114
|
function useRenameFromMenu() {
|
|
32061
32115
|
const [open, setOpen] = useState84(false);
|
|
32062
|
-
const asked4 =
|
|
32116
|
+
const asked4 = useRef43(false);
|
|
32063
32117
|
const ask2 = useCallback35(() => {
|
|
32064
32118
|
asked4.current = true;
|
|
32065
32119
|
window.setTimeout(() => setOpen(true), 0);
|
|
@@ -32085,9 +32139,9 @@ function TableRenameDialog({
|
|
|
32085
32139
|
const [typed2, setTyped] = useState84(name);
|
|
32086
32140
|
const [busy, setBusy] = useState84(false);
|
|
32087
32141
|
const [refused, setRefused] = useState84(null);
|
|
32088
|
-
const box =
|
|
32089
|
-
const openedAt =
|
|
32090
|
-
|
|
32142
|
+
const box = useRef43(null);
|
|
32143
|
+
const openedAt = useRef43(null);
|
|
32144
|
+
useEffect69(() => {
|
|
32091
32145
|
if (!open) return;
|
|
32092
32146
|
openedAt.current = (0, recordVersions_exports.readTableVersionNow)(client, tableId);
|
|
32093
32147
|
setTyped(name);
|
|
@@ -32178,7 +32232,7 @@ function TableRenameDialog({
|
|
|
32178
32232
|
}
|
|
32179
32233
|
|
|
32180
32234
|
// src/TableSettings.tsx
|
|
32181
|
-
import { useEffect as
|
|
32235
|
+
import { useEffect as useEffect74, useMemo as useMemo50, useRef as useRef44, useState as useState90 } from "react";
|
|
32182
32236
|
import { levelHasShownTo as levelHasShownTo2 } from "@ai-matrx/records";
|
|
32183
32237
|
|
|
32184
32238
|
// src/ArchiveDeliberately.tsx
|
|
@@ -32304,7 +32358,7 @@ function announceTableArchived({ notify, client, tableId, name, onRestored }) {
|
|
|
32304
32358
|
}
|
|
32305
32359
|
|
|
32306
32360
|
// src/TableFoundation.tsx
|
|
32307
|
-
import { useEffect as
|
|
32361
|
+
import { useEffect as useEffect70, useState as useState86 } from "react";
|
|
32308
32362
|
import { tableShapeChanged as tableShapeChanged9, useRecordsClient as useRecordsClient57 } from "@ai-matrx/records/react";
|
|
32309
32363
|
import { Switch as Switch3 } from "@ai-matrx/design-system";
|
|
32310
32364
|
import { jsx as jsx106, jsxs as jsxs95 } from "react/jsx-runtime";
|
|
@@ -32317,7 +32371,7 @@ function TableFoundationSwitch({ tableId, table }) {
|
|
|
32317
32371
|
const [pending, setPending] = useState86(null);
|
|
32318
32372
|
const [refused, setRefused] = useState86(null);
|
|
32319
32373
|
const on = pending ?? stored;
|
|
32320
|
-
|
|
32374
|
+
useEffect70(() => {
|
|
32321
32375
|
if (pending !== null && stored === pending) setPending(null);
|
|
32322
32376
|
}, [stored, pending]);
|
|
32323
32377
|
const change = async (next) => {
|
|
@@ -32355,7 +32409,7 @@ function TableFoundationSwitch({ tableId, table }) {
|
|
|
32355
32409
|
}
|
|
32356
32410
|
|
|
32357
32411
|
// src/TableAccessLevel.tsx
|
|
32358
|
-
import { useCallback as useCallback36, useEffect as
|
|
32412
|
+
import { useCallback as useCallback36, useEffect as useEffect71, useMemo as useMemo48, useState as useState87 } from "react";
|
|
32359
32413
|
import { tableShapeChanged as tableShapeChanged10, useRecordsClient as useRecordsClient58 } from "@ai-matrx/records/react";
|
|
32360
32414
|
import { Badge as Badge12, Button as Button64, Textarea as Textarea5, cn as cn51 } from "@ai-matrx/design-system";
|
|
32361
32415
|
import { Fragment as Fragment38, jsx as jsx107, jsxs as jsxs96 } from "react/jsx-runtime";
|
|
@@ -32386,7 +32440,7 @@ function TableAccessLevel({ tableId, fields }) {
|
|
|
32386
32440
|
setPicked(answer.data.readers.map((r) => r.field));
|
|
32387
32441
|
setReason("");
|
|
32388
32442
|
}, [client, tableId]);
|
|
32389
|
-
|
|
32443
|
+
useEffect71(() => {
|
|
32390
32444
|
void load();
|
|
32391
32445
|
}, [load]);
|
|
32392
32446
|
if (failed) return /* @__PURE__ */ jsx107("p", { className: "text-destructive", "data-table-access-level": "", children: failed });
|
|
@@ -32476,7 +32530,7 @@ function TableAccessLevel({ tableId, fields }) {
|
|
|
32476
32530
|
}
|
|
32477
32531
|
|
|
32478
32532
|
// src/RowControls.tsx
|
|
32479
|
-
import { useCallback as useCallback37, useEffect as
|
|
32533
|
+
import { useCallback as useCallback37, useEffect as useEffect72, useState as useState88 } from "react";
|
|
32480
32534
|
import {
|
|
32481
32535
|
isShownTo,
|
|
32482
32536
|
levelHasShownTo,
|
|
@@ -32536,7 +32590,7 @@ function NewRowsDefaults({ tableId }) {
|
|
|
32536
32590
|
setError(null);
|
|
32537
32591
|
} else setError(answer.error);
|
|
32538
32592
|
}, [client, tableId]);
|
|
32539
|
-
|
|
32593
|
+
useEffect72(() => {
|
|
32540
32594
|
void read();
|
|
32541
32595
|
}, [read]);
|
|
32542
32596
|
const set = async (patch) => {
|
|
@@ -32619,7 +32673,7 @@ function RowShownTo({ recordId, tableId }) {
|
|
|
32619
32673
|
setError(null);
|
|
32620
32674
|
} else setError(answer.error);
|
|
32621
32675
|
}, [client, recordId]);
|
|
32622
|
-
|
|
32676
|
+
useEffect72(() => {
|
|
32623
32677
|
setC(null);
|
|
32624
32678
|
void read();
|
|
32625
32679
|
}, [read]);
|
|
@@ -32655,7 +32709,7 @@ function RowShownTo({ recordId, tableId }) {
|
|
|
32655
32709
|
}
|
|
32656
32710
|
|
|
32657
32711
|
// src/ColumnsAtOnce.tsx
|
|
32658
|
-
import { useEffect as
|
|
32712
|
+
import { useEffect as useEffect73, useMemo as useMemo49, useState as useState89 } from "react";
|
|
32659
32713
|
import { useFieldMutation as useFieldMutation3 } from "@ai-matrx/records/react";
|
|
32660
32714
|
import { Badge as Badge13, BasicInput as BasicInput19, Button as Button66, Checkbox as Checkbox12, cn as cn52 } from "@ai-matrx/design-system";
|
|
32661
32715
|
import { jsx as jsx109, jsxs as jsxs98 } from "react/jsx-runtime";
|
|
@@ -32689,10 +32743,10 @@ function ColumnsAtOnce({
|
|
|
32689
32743
|
const shape = useFieldMutation3();
|
|
32690
32744
|
const savedSignature = JSON.stringify(rows.map((f) => [f.id, f.label, f.sort]));
|
|
32691
32745
|
const [draft, setDraft] = useState89(() => draftOf3(rows));
|
|
32692
|
-
|
|
32746
|
+
useEffect73(() => setDraft(draftOf3(rows)), [savedSignature]);
|
|
32693
32747
|
const hiddenSignature = JSON.stringify(look?.hidden ?? []);
|
|
32694
32748
|
const [hidden, setHidden] = useState89(() => [...look?.hidden ?? []]);
|
|
32695
|
-
|
|
32749
|
+
useEffect73(() => setHidden([...look?.hidden ?? []]), [hiddenSignature]);
|
|
32696
32750
|
const [dragging, setDragging] = useState89(null);
|
|
32697
32751
|
const [saving, setSaving] = useState89(false);
|
|
32698
32752
|
const byId = useMemo49(() => new Map(rows.map((f) => [f.id, f])), [rows]);
|
|
@@ -32842,9 +32896,9 @@ function TableSettings(props) {
|
|
|
32842
32896
|
const client = useRecordsClient60();
|
|
32843
32897
|
const table = useTable16(props.tableId);
|
|
32844
32898
|
const fields = useFields17(props.tableId);
|
|
32845
|
-
const now =
|
|
32899
|
+
const now = useRef44({ table: table.data ?? null, fields: fields.data ?? [] });
|
|
32846
32900
|
now.current = { table: table.data ?? null, fields: fields.data ?? [] };
|
|
32847
|
-
const slots =
|
|
32901
|
+
const slots = useRef44({ details: { current: null }, rowActions: { current: null } }).current;
|
|
32848
32902
|
const agent = useMemo50(
|
|
32849
32903
|
() => buildTableSettingsAgent(props.tableId, () => now.current, client, slots),
|
|
32850
32904
|
[props.tableId, client, slots]
|
|
@@ -32868,7 +32922,7 @@ function TableSettingsPanel({
|
|
|
32868
32922
|
const archive = useTableArchive(tableId);
|
|
32869
32923
|
const client = useRecordsClient60();
|
|
32870
32924
|
const ui = useRecordsUi();
|
|
32871
|
-
|
|
32925
|
+
useEffect74(() => {
|
|
32872
32926
|
let live = true;
|
|
32873
32927
|
void archive.preview().then((answer) => {
|
|
32874
32928
|
if (live && answer?.in_progress) setAskingToDelete(true);
|
|
@@ -32877,10 +32931,10 @@ function TableSettingsPanel({
|
|
|
32877
32931
|
live = false;
|
|
32878
32932
|
};
|
|
32879
32933
|
}, [tableId]);
|
|
32880
|
-
const askToArchiveRef =
|
|
32881
|
-
const archiveAskedSeen =
|
|
32934
|
+
const askToArchiveRef = useRef44(null);
|
|
32935
|
+
const archiveAskedSeen = useRef44(0);
|
|
32882
32936
|
const panelReady = Boolean(table.data && fields.data && rights.structure);
|
|
32883
|
-
|
|
32937
|
+
useEffect74(() => {
|
|
32884
32938
|
const ask2 = askToArchiveRef.current;
|
|
32885
32939
|
if (!panelReady || !ask2 || archiveAsked <= archiveAskedSeen.current) return;
|
|
32886
32940
|
archiveAskedSeen.current = archiveAsked;
|
|
@@ -33089,13 +33143,13 @@ function TableSettingsPanel({
|
|
|
33089
33143
|
}
|
|
33090
33144
|
|
|
33091
33145
|
// src/Peek.tsx
|
|
33092
|
-
import { useEffect as
|
|
33146
|
+
import { useEffect as useEffect78, useState as useState95 } from "react";
|
|
33093
33147
|
import { isLockedStub } from "@ai-matrx/records";
|
|
33094
33148
|
import { useFields as useFields19, useRecord as useRecord3, useRecordsClient as useRecordsClient65, useTable as useTable19 } from "@ai-matrx/records/react";
|
|
33095
33149
|
import { AlchemyMenu as AlchemyMenu2 } from "@ai-matrx/alchemy/react";
|
|
33096
33150
|
|
|
33097
33151
|
// src/RecordChat.tsx
|
|
33098
|
-
import { useEffect as
|
|
33152
|
+
import { useEffect as useEffect75, useMemo as useMemo51, useState as useState91 } from "react";
|
|
33099
33153
|
import { useRecordsClient as useRecordsClient61 } from "@ai-matrx/records/react";
|
|
33100
33154
|
import { Skeleton as Skeleton12, cn as cn54 } from "@ai-matrx/design-system";
|
|
33101
33155
|
import { jsx as jsx111, jsxs as jsxs100 } from "react/jsx-runtime";
|
|
@@ -33105,7 +33159,7 @@ function RecordChat({ tableId, recordId, className }) {
|
|
|
33105
33159
|
const host = useRecordsUi();
|
|
33106
33160
|
const [scope, setScope] = useState91(null);
|
|
33107
33161
|
const [error, setError] = useState91(null);
|
|
33108
|
-
|
|
33162
|
+
useEffect75(() => {
|
|
33109
33163
|
let cancelled = false;
|
|
33110
33164
|
setScope(null);
|
|
33111
33165
|
setError(null);
|
|
@@ -33222,7 +33276,7 @@ function entriesFor(scope) {
|
|
|
33222
33276
|
import { Button as Button71, Separator as Separator9, Skeleton as Skeleton14, cn as cn56 } from "@ai-matrx/design-system";
|
|
33223
33277
|
|
|
33224
33278
|
// src/recordInPlace.tsx
|
|
33225
|
-
import { useMemo as useMemo52, useRef as
|
|
33279
|
+
import { useMemo as useMemo52, useRef as useRef45 } from "react";
|
|
33226
33280
|
import { useRecordsClient as useRecordsClient62, useTable as useTable17 } from "@ai-matrx/records/react";
|
|
33227
33281
|
import { humanizeIdentifier as humanizeIdentifier11 } from "@ai-matrx/kit/text-case";
|
|
33228
33282
|
import { jsx as jsx112, jsxs as jsxs101 } from "react/jsx-runtime";
|
|
@@ -33246,7 +33300,7 @@ function RecordFieldsInPlace({
|
|
|
33246
33300
|
);
|
|
33247
33301
|
const rows = useMemo52(() => [row], [row]);
|
|
33248
33302
|
const versions = (0, recordVersions_exports.useRecordVersions)(client, rows);
|
|
33249
|
-
const pushWritten =
|
|
33303
|
+
const pushWritten = useRef45(null);
|
|
33250
33304
|
const editing = useGridEditing({
|
|
33251
33305
|
tableId,
|
|
33252
33306
|
fields,
|
|
@@ -33419,7 +33473,7 @@ function ValueAlternates({
|
|
|
33419
33473
|
|
|
33420
33474
|
// src/ShareControl.tsx
|
|
33421
33475
|
import { copyText as copyText6 } from "@ai-matrx/kit/clipboard";
|
|
33422
|
-
import { useEffect as
|
|
33476
|
+
import { useEffect as useEffect76, useState as useState93 } from "react";
|
|
33423
33477
|
import { Button as Button69, Popover as Popover14, PopoverContent as PopoverContent14, PopoverTrigger as PopoverTrigger14 } from "@ai-matrx/design-system";
|
|
33424
33478
|
import { Fragment as Fragment41, jsx as jsx114, jsxs as jsxs103 } from "react/jsx-runtime";
|
|
33425
33479
|
function useCanShare() {
|
|
@@ -33442,7 +33496,7 @@ function ShareControl({
|
|
|
33442
33496
|
}) {
|
|
33443
33497
|
const host = useRecordsUi();
|
|
33444
33498
|
const [open, setOpen] = useState93(initiallyOpen);
|
|
33445
|
-
|
|
33499
|
+
useEffect76(() => {
|
|
33446
33500
|
if (initiallyOpen) setOpen(true);
|
|
33447
33501
|
}, [initiallyOpen]);
|
|
33448
33502
|
const asked4 = useRecordRights(may === void 0 ? subjectId : null);
|
|
@@ -33506,7 +33560,7 @@ function ShareForSomebodyElse({
|
|
|
33506
33560
|
}
|
|
33507
33561
|
|
|
33508
33562
|
// src/RecordBody.tsx
|
|
33509
|
-
import { useEffect as
|
|
33563
|
+
import { useEffect as useEffect77, useRef as useRef46, useState as useState94 } from "react";
|
|
33510
33564
|
import { Button as Button70, cn as cn55 } from "@ai-matrx/design-system";
|
|
33511
33565
|
import { newerKindOf as newerKindOf6 } from "@ai-matrx/records";
|
|
33512
33566
|
import { tableShapeChanged as tableShapeChanged12, useFieldMutation as useFieldMutation5, useFields as useFields18, useRecord as useRecord2, useRecordsClient as useRecordsClient64, useTable as useTable18 } from "@ai-matrx/records/react";
|
|
@@ -33543,9 +33597,9 @@ function BodyEditor({ tableId, recordId, field: field2 }) {
|
|
|
33543
33597
|
const raw = record.data?.document?.[field2.key];
|
|
33544
33598
|
const stored = typeof raw === "string" ? raw : "";
|
|
33545
33599
|
const [saving, setSaving] = useState94({ phase: "idle" });
|
|
33546
|
-
const lastSaved =
|
|
33547
|
-
const waiting =
|
|
33548
|
-
const timer =
|
|
33600
|
+
const lastSaved = useRef46(null);
|
|
33601
|
+
const waiting = useRef46(null);
|
|
33602
|
+
const timer = useRef46(null);
|
|
33549
33603
|
if (lastSaved.current === null && record.data) lastSaved.current = stored;
|
|
33550
33604
|
const write = async () => {
|
|
33551
33605
|
if (timer.current) clearTimeout(timer.current);
|
|
@@ -33566,9 +33620,9 @@ function BodyEditor({ tableId, recordId, field: field2 }) {
|
|
|
33566
33620
|
setSaving({ phase: "refused", error: answered.error });
|
|
33567
33621
|
}
|
|
33568
33622
|
};
|
|
33569
|
-
const writeRef =
|
|
33623
|
+
const writeRef = useRef46(write);
|
|
33570
33624
|
writeRef.current = write;
|
|
33571
|
-
|
|
33625
|
+
useEffect77(
|
|
33572
33626
|
() => () => {
|
|
33573
33627
|
if (waiting.current !== null) void writeRef.current();
|
|
33574
33628
|
},
|
|
@@ -33632,7 +33686,7 @@ function Peek({ tableId, recordId, onClose, className, onPage = false }) {
|
|
|
33632
33686
|
const shownFieldCount = (fields.data ?? []).filter(
|
|
33633
33687
|
(field2) => !onPage || !drawnBelowOnPage(field2, onPage ? bodyFieldOf(fields.data ?? [])?.key : void 0)
|
|
33634
33688
|
).length;
|
|
33635
|
-
|
|
33689
|
+
useEffect78(() => {
|
|
33636
33690
|
if (fields.data) rememberRowCount(peekMemoryKey, shownFieldCount);
|
|
33637
33691
|
}, [fields.data, peekMemoryKey, shownFieldCount]);
|
|
33638
33692
|
if (record.error) return /* @__PURE__ */ jsx116(RefusalNotice, { error: record.error, className });
|
|
@@ -33771,7 +33825,7 @@ function computedInPlainWords(row, field2) {
|
|
|
33771
33825
|
}
|
|
33772
33826
|
|
|
33773
33827
|
// src/platformTable.ts
|
|
33774
|
-
import { useEffect as
|
|
33828
|
+
import { useEffect as useEffect79, useMemo as useMemo53, useState as useState96 } from "react";
|
|
33775
33829
|
import { useRecordsClient as useRecordsClient66 } from "@ai-matrx/records/react";
|
|
33776
33830
|
var inFlight = /* @__PURE__ */ new Map();
|
|
33777
33831
|
async function ensurePlatformTable(client, spec) {
|
|
@@ -33904,7 +33958,7 @@ function usePlatformTable(spec) {
|
|
|
33904
33958
|
const [state2, setState] = useState96({ tableId: null, loading: true, error: null });
|
|
33905
33959
|
const slug = spec.slug;
|
|
33906
33960
|
const stable = useMemo53(() => spec, [slug]);
|
|
33907
|
-
|
|
33961
|
+
useEffect79(() => {
|
|
33908
33962
|
let cancelled = false;
|
|
33909
33963
|
setState({ tableId: null, loading: true, error: null });
|
|
33910
33964
|
void ensurePlatformTable(client, stable).then((result) => {
|
|
@@ -33951,7 +34005,7 @@ function lookAfterReset(look) {
|
|
|
33951
34005
|
}
|
|
33952
34006
|
|
|
33953
34007
|
// src/ViewSwitcher.tsx
|
|
33954
|
-
import { useEffect as
|
|
34008
|
+
import { useEffect as useEffect91, useMemo as useMemo63, useState as useState108 } from "react";
|
|
33955
34009
|
import { mayDrag as mayDrag4, useFields as useFields21, useRecordPage as useRecordPage2, useRecordsClient as useRecordsClient71, useTable as useTable21 } from "@ai-matrx/records/react";
|
|
33956
34010
|
import { isButtonField as isButtonField5, newerKindOf as newerKindOf7, stableFilterKey as stableFilterKey4 } from "@ai-matrx/records";
|
|
33957
34011
|
import { Button as Button77, Select as Select19, SelectContent as SelectContent17, SelectItem as SelectItem17, SelectTrigger as SelectTrigger17, SelectValue as SelectValue17, cn as cn63 } from "@ai-matrx/design-system";
|
|
@@ -33965,7 +34019,7 @@ import {
|
|
|
33965
34019
|
import { formatCount as formatCount6 } from "@ai-matrx/kit/format";
|
|
33966
34020
|
|
|
33967
34021
|
// src/recordMoves.tsx
|
|
33968
|
-
import { useCallback as useCallback38, useEffect as
|
|
34022
|
+
import { useCallback as useCallback38, useEffect as useEffect80, useMemo as useMemo54, useRef as useRef47, useState as useState97 } from "react";
|
|
33969
34023
|
import { useRecordsClient as useRecordsClient67 } from "@ai-matrx/records/react";
|
|
33970
34024
|
import { Button as Button72 } from "@ai-matrx/design-system";
|
|
33971
34025
|
import { Fragment as Fragment44, jsx as jsx117, jsxs as jsxs106 } from "react/jsx-runtime";
|
|
@@ -34091,9 +34145,9 @@ function useRecordMoves({
|
|
|
34091
34145
|
[client, undo, onMoved, preset]
|
|
34092
34146
|
);
|
|
34093
34147
|
const offering = Boolean(undo.notice);
|
|
34094
|
-
const undoRef =
|
|
34148
|
+
const undoRef = useRef47(undo);
|
|
34095
34149
|
undoRef.current = undo;
|
|
34096
|
-
|
|
34150
|
+
useEffect80(() => {
|
|
34097
34151
|
if (!offering || typeof document === "undefined") return;
|
|
34098
34152
|
const onKey = (event) => {
|
|
34099
34153
|
const which = undoKey(event);
|
|
@@ -34159,7 +34213,7 @@ function MoveRefusedBadge({ refused }) {
|
|
|
34159
34213
|
}
|
|
34160
34214
|
|
|
34161
34215
|
// src/Pipeline.tsx
|
|
34162
|
-
import { useCallback as useCallback39, useEffect as
|
|
34216
|
+
import { useCallback as useCallback39, useEffect as useEffect81, useMemo as useMemo55, useRef as useRef48, useState as useState98 } from "react";
|
|
34163
34217
|
import {
|
|
34164
34218
|
mayDrag,
|
|
34165
34219
|
useFields as useFields20,
|
|
@@ -34272,14 +34326,14 @@ function PipelineBoard({
|
|
|
34272
34326
|
const [waiting, setWaiting] = useState98(/* @__PURE__ */ new Map());
|
|
34273
34327
|
const [dragging, setDragging] = useState98(null);
|
|
34274
34328
|
const [over, setOver] = useState98(null);
|
|
34275
|
-
const alive =
|
|
34329
|
+
const alive = useRef48(true);
|
|
34276
34330
|
const [selected, setSelected] = useState98(/* @__PURE__ */ new Set());
|
|
34277
|
-
const anchor =
|
|
34331
|
+
const anchor = useRef48(null);
|
|
34278
34332
|
const [batch, setBatch] = useState98(/* @__PURE__ */ new Map());
|
|
34279
34333
|
const [batchSaid, setBatchSaid] = useState98(null);
|
|
34280
34334
|
const [batchError, setBatchError] = useState98(null);
|
|
34281
34335
|
const [moving, setMoving] = useState98(false);
|
|
34282
|
-
|
|
34336
|
+
useEffect81(() => {
|
|
34283
34337
|
alive.current = true;
|
|
34284
34338
|
return () => {
|
|
34285
34339
|
alive.current = false;
|
|
@@ -34304,11 +34358,11 @@ function PipelineBoard({
|
|
|
34304
34358
|
setWaiting(held.ok ? new Map((held.data ?? []).map((p) => [p.record_id, p])) : /* @__PURE__ */ new Map());
|
|
34305
34359
|
setColumns(board.ok ? board.data ?? [] : []);
|
|
34306
34360
|
}, [client, tableId, measure, filterKey]);
|
|
34307
|
-
|
|
34361
|
+
useEffect81(() => {
|
|
34308
34362
|
void reload();
|
|
34309
34363
|
}, [reload]);
|
|
34310
34364
|
const versions = (0, recordVersions_exports.useRecordVersions)(client, rows, (r) => mayDrag(r.level));
|
|
34311
|
-
const versionsRef =
|
|
34365
|
+
const versionsRef = useRef48(versions);
|
|
34312
34366
|
versionsRef.current = versions;
|
|
34313
34367
|
const drawnVersion = (id) => versionsRef.current.seen(id);
|
|
34314
34368
|
const stageKey = definition?.stage_field ?? null;
|
|
@@ -34964,13 +35018,13 @@ function CardFieldsInline({ row, fields }) {
|
|
|
34964
35018
|
}
|
|
34965
35019
|
|
|
34966
35020
|
// src/CalendarView.tsx
|
|
34967
|
-
import { useEffect as
|
|
35021
|
+
import { useEffect as useEffect83, useMemo as useMemo57, useRef as useRef49, useState as useState100 } from "react";
|
|
34968
35022
|
import { mayDrag as mayDrag2 } from "@ai-matrx/records/react";
|
|
34969
35023
|
import { Button as Button74, Select as Select15, SelectContent as SelectContent13, SelectItem as SelectItem13, SelectTrigger as SelectTrigger13, SelectValue as SelectValue13, cn as cn58 } from "@ai-matrx/design-system";
|
|
34970
35024
|
import { CHOICE_CHIP_CLASS as CHOICE_CHIP_CLASS3 } from "@ai-matrx/design-system/data-table";
|
|
34971
35025
|
|
|
34972
35026
|
// src/weekStart.ts
|
|
34973
|
-
import { useEffect as
|
|
35027
|
+
import { useEffect as useEffect82, useState as useState99 } from "react";
|
|
34974
35028
|
import { useOptionalRecordsClient as useOptionalRecordsClient16 } from "@ai-matrx/records/react";
|
|
34975
35029
|
var DAYS2 = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"];
|
|
34976
35030
|
function weekStartIndex(word) {
|
|
@@ -34992,7 +35046,7 @@ function ask(client) {
|
|
|
34992
35046
|
function useReaderWeekStart() {
|
|
34993
35047
|
const client = useOptionalRecordsClient16();
|
|
34994
35048
|
const [first, setFirst] = useState99(1);
|
|
34995
|
-
|
|
35049
|
+
useEffect82(() => {
|
|
34996
35050
|
if (!client) return;
|
|
34997
35051
|
let live = true;
|
|
34998
35052
|
void ask(client).then((n) => live && setFirst(n));
|
|
@@ -35228,7 +35282,7 @@ function useNarrow() {
|
|
|
35228
35282
|
const query = "(max-width: 639px)";
|
|
35229
35283
|
const read = () => typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia(query).matches;
|
|
35230
35284
|
const [narrow, setNarrow] = useState100(read);
|
|
35231
|
-
|
|
35285
|
+
useEffect83(() => {
|
|
35232
35286
|
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
|
|
35233
35287
|
const list = window.matchMedia(query);
|
|
35234
35288
|
const on = () => setNarrow(list.matches);
|
|
@@ -35299,9 +35353,9 @@ function CalendarView({
|
|
|
35299
35353
|
const colorKey = colorPick !== void 0 ? colorPick : style?.colorBy?.field ?? choiceFields[0]?.key ?? null;
|
|
35300
35354
|
const colorOf = useRowColorBy(all, colorKey, style);
|
|
35301
35355
|
const [placedOver, setPlacedOver] = useState100(() => /* @__PURE__ */ new Map());
|
|
35302
|
-
|
|
35356
|
+
useEffect83(() => setPlacedOver(/* @__PURE__ */ new Map()), [rows]);
|
|
35303
35357
|
const undoneCount = moves.undo.depth.forward;
|
|
35304
|
-
|
|
35358
|
+
useEffect83(() => {
|
|
35305
35359
|
if (undoneCount > 0) setPlacedOver(/* @__PURE__ */ new Map());
|
|
35306
35360
|
}, [undoneCount]);
|
|
35307
35361
|
const startOf = (row) => placedOver.has(row.id) ? placedOver.get(row.id).start : (row.document ?? {})[dateField.key];
|
|
@@ -35328,9 +35382,9 @@ function CalendarView({
|
|
|
35328
35382
|
}, [rows, dateField.key, endField?.key, placedOver, defaultMinutes]);
|
|
35329
35383
|
const titleOf = (row) => cardWords(row, titleField, labels).text;
|
|
35330
35384
|
const rowById = (id) => rows.find((r) => r.id === id);
|
|
35331
|
-
const frame =
|
|
35385
|
+
const frame = useRef49(null);
|
|
35332
35386
|
const [focusOn, setFocusOn] = useState100(null);
|
|
35333
|
-
|
|
35387
|
+
useEffect83(() => {
|
|
35334
35388
|
if (!focusOn) return;
|
|
35335
35389
|
const button = frame.current?.querySelector(`[data-calendar-card="${focusOn}"] button`);
|
|
35336
35390
|
button?.focus({ preventScroll: true });
|
|
@@ -35377,10 +35431,10 @@ function CalendarView({
|
|
|
35377
35431
|
const made = await moves.create({ tableId, data, label: `New record on ${where}` });
|
|
35378
35432
|
if (made) onOpenRecord?.(made);
|
|
35379
35433
|
};
|
|
35380
|
-
const grabOffset =
|
|
35434
|
+
const grabOffset = useRef49(0);
|
|
35381
35435
|
const [resizing, setResizing] = useState100(null);
|
|
35382
35436
|
const [ghost, setGhost] = useState100(null);
|
|
35383
|
-
|
|
35437
|
+
useEffect83(() => {
|
|
35384
35438
|
if (!ghost || typeof document === "undefined") return;
|
|
35385
35439
|
const clear = () => setGhost(null);
|
|
35386
35440
|
document.addEventListener("dragend", clear);
|
|
@@ -35927,13 +35981,13 @@ function WeekHours({
|
|
|
35927
35981
|
render,
|
|
35928
35982
|
overlay
|
|
35929
35983
|
}) {
|
|
35930
|
-
const frame =
|
|
35931
|
-
|
|
35984
|
+
const frame = useRef49(null);
|
|
35985
|
+
useEffect83(() => {
|
|
35932
35986
|
if (frame.current) frame.current.scrollTop = 7 * HOUR_PX;
|
|
35933
35987
|
}, []);
|
|
35934
35988
|
usePersonTimeZone();
|
|
35935
35989
|
const [now, setNow] = useState100(() => personWallNow());
|
|
35936
|
-
|
|
35990
|
+
useEffect83(() => {
|
|
35937
35991
|
const timer = setInterval(() => setNow(personWallNow()), 6e4);
|
|
35938
35992
|
return () => clearInterval(timer);
|
|
35939
35993
|
}, []);
|
|
@@ -35975,7 +36029,7 @@ function weekHeading(first) {
|
|
|
35975
36029
|
}
|
|
35976
36030
|
|
|
35977
36031
|
// src/TimelineView.tsx
|
|
35978
|
-
import { useEffect as
|
|
36032
|
+
import { useEffect as useEffect84, useMemo as useMemo58, useRef as useRef50, useState as useState101 } from "react";
|
|
35979
36033
|
import { mayDrag as mayDrag3 } from "@ai-matrx/records/react";
|
|
35980
36034
|
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 Select16, SelectContent as SelectContent14, SelectItem as SelectItem14, SelectTrigger as SelectTrigger14, SelectValue as SelectValue14, cn as cn59 } from "@ai-matrx/design-system";
|
|
35981
36035
|
import { CHOICE_CHIP_CLASS as CHOICE_CHIP_CLASS4 } from "@ai-matrx/design-system/data-table";
|
|
@@ -36240,7 +36294,7 @@ function TimelineView({
|
|
|
36240
36294
|
const dates = useMemo58(() => offerableFields(fields, "date", { far: farFields }), [fields, farFields]);
|
|
36241
36295
|
const has = (list, key) => key && list.some((f) => f.key === key) ? key : null;
|
|
36242
36296
|
const [picked, setPicked] = useState101({});
|
|
36243
|
-
|
|
36297
|
+
useEffect84(() => setPicked({}), [startKey, endKey, groupKey, colorKey]);
|
|
36244
36298
|
const named = (key) => key && fields.some((f) => f.key === key) ? key : null;
|
|
36245
36299
|
const startChosen = "startKey" in picked ? picked.startKey ?? null : has(dates, startKey) ?? named(startKey) ?? onlyCandidate(dates);
|
|
36246
36300
|
const endCandidates = useMemo58(() => dates.filter((f) => f.key !== startChosen), [dates, startChosen]);
|
|
@@ -36261,7 +36315,7 @@ function TimelineView({
|
|
|
36261
36315
|
};
|
|
36262
36316
|
const [ganttPicked, setGanttPicked] = useState101({});
|
|
36263
36317
|
const ganttSaved = JSON.stringify(gantt ?? {});
|
|
36264
|
-
|
|
36318
|
+
useEffect84(() => setGanttPicked({}), [ganttSaved]);
|
|
36265
36319
|
const g = { ...gantt ?? {}, ...ganttPicked };
|
|
36266
36320
|
const ganttOn = g.mode === true;
|
|
36267
36321
|
const setGantt = (patch) => {
|
|
@@ -36285,7 +36339,7 @@ function TimelineView({
|
|
|
36285
36339
|
const milestoneCandidates = useMemo58(() => fields.filter((f) => String(editorKindFor(f)) === "checkbox" || String(editorKindFor(f)) === "boolean"), [fields]);
|
|
36286
36340
|
const knobClient = useOptionalRecordsClient17();
|
|
36287
36341
|
const [shiftDependents, setShiftDependents] = useState101(true);
|
|
36288
|
-
|
|
36342
|
+
useEffect84(() => {
|
|
36289
36343
|
if (!depField || !knobClient) return;
|
|
36290
36344
|
let live = true;
|
|
36291
36345
|
void knobClient.timelineDependencyShift().then((got) => {
|
|
@@ -36301,9 +36355,9 @@ function TimelineView({
|
|
|
36301
36355
|
const titleOf = (row) => cardWords(row, titleField, labels).text;
|
|
36302
36356
|
const groupOptions = useChoiceOptions(fields, groupField && isChoiceField(groupField) ? [groupField.key] : []).get(groupField?.key ?? "");
|
|
36303
36357
|
const [placedOver, setPlacedOver] = useState101(() => /* @__PURE__ */ new Map());
|
|
36304
|
-
|
|
36358
|
+
useEffect84(() => setPlacedOver(/* @__PURE__ */ new Map()), [rows]);
|
|
36305
36359
|
const undoneCount = moves.undo.depth.forward;
|
|
36306
|
-
|
|
36360
|
+
useEffect84(() => {
|
|
36307
36361
|
if (undoneCount > 0) setPlacedOver(/* @__PURE__ */ new Map());
|
|
36308
36362
|
}, [undoneCount]);
|
|
36309
36363
|
const startOf = (row) => placedOver.has(row.id) ? placedOver.get(row.id).start : startField ? (row.document ?? {})[startField.key] : null;
|
|
@@ -36566,11 +36620,11 @@ function TimelineView({
|
|
|
36566
36620
|
const width = days * px;
|
|
36567
36621
|
const scale = useMemo58(() => scaleOf(from, days, zoom, firstDay), [from, days, zoom, firstDay]);
|
|
36568
36622
|
const xOf = (day2) => daysBetween(from, day2) * px;
|
|
36569
|
-
const scroller =
|
|
36623
|
+
const scroller = useRef50(null);
|
|
36570
36624
|
const grouped = Boolean(groupField) && !ganttOn;
|
|
36571
36625
|
const hasLabel = grouped || ganttOn;
|
|
36572
36626
|
const [scrollX, setScrollX] = useState101(0);
|
|
36573
|
-
const frame =
|
|
36627
|
+
const frame = useRef50(null);
|
|
36574
36628
|
const onScroll = () => {
|
|
36575
36629
|
if (frame.current !== null) return;
|
|
36576
36630
|
frame.current = requestAnimationFrame(() => {
|
|
@@ -36578,7 +36632,7 @@ function TimelineView({
|
|
|
36578
36632
|
setScrollX(scroller.current?.scrollLeft ?? 0);
|
|
36579
36633
|
});
|
|
36580
36634
|
};
|
|
36581
|
-
|
|
36635
|
+
useEffect84(() => {
|
|
36582
36636
|
const el = scroller.current;
|
|
36583
36637
|
if (!el) return;
|
|
36584
36638
|
const label = el.querySelector("[data-timeline-label]")?.offsetWidth ?? 0;
|
|
@@ -37105,7 +37159,7 @@ function TimelineView({
|
|
|
37105
37159
|
}
|
|
37106
37160
|
|
|
37107
37161
|
// src/ViewNeeds.tsx
|
|
37108
|
-
import { useEffect as
|
|
37162
|
+
import { useEffect as useEffect85, useState as useState102 } from "react";
|
|
37109
37163
|
import { useFieldMutation as useFieldMutation6, useRecordsClient as useRecordsClient69, useTable as useTable20 } from "@ai-matrx/records/react";
|
|
37110
37164
|
import { BasicInput as BasicInput20, Button as Button76, Label as Label19 } from "@ai-matrx/design-system";
|
|
37111
37165
|
import { jsx as jsx123, jsxs as jsxs112 } from "react/jsx-runtime";
|
|
@@ -37126,7 +37180,7 @@ function useAskedColumnLands(layout, tableId, fields, chosen, offerable, onMade)
|
|
|
37126
37180
|
const wanted = askedFor.get(askKey(tableId, layout));
|
|
37127
37181
|
const landed = wanted && !chosen ? offerable(fields).find((f) => fieldName(f).trim().toLowerCase() === wanted.trim().toLowerCase()) : void 0;
|
|
37128
37182
|
const key = landed?.key ?? null;
|
|
37129
|
-
|
|
37183
|
+
useEffect85(() => {
|
|
37130
37184
|
if (!key) return;
|
|
37131
37185
|
askedFor.delete(askKey(tableId, layout));
|
|
37132
37186
|
onMade(key);
|
|
@@ -37238,7 +37292,7 @@ function ViewNeeds({ layout, tableId, fields, onMade, className }) {
|
|
|
37238
37292
|
}
|
|
37239
37293
|
|
|
37240
37294
|
// src/GalleryCover.tsx
|
|
37241
|
-
import { useEffect as
|
|
37295
|
+
import { useEffect as useEffect86, useState as useState103 } from "react";
|
|
37242
37296
|
import { useOptionalRecordsClient as useOptionalRecordsClient18 } from "@ai-matrx/records/react";
|
|
37243
37297
|
import { Fragment as Fragment48, jsx as jsx124 } from "react/jsx-runtime";
|
|
37244
37298
|
function isImageAddress(value) {
|
|
@@ -37260,7 +37314,7 @@ function FileCover({ recordId }) {
|
|
|
37260
37314
|
const client = useOptionalRecordsClient18();
|
|
37261
37315
|
const host = useRecordsUi();
|
|
37262
37316
|
const [read, setRead] = useState103(null);
|
|
37263
|
-
|
|
37317
|
+
useEffect86(() => {
|
|
37264
37318
|
let cancelled = false;
|
|
37265
37319
|
if (!client) {
|
|
37266
37320
|
setRead({ fileId: recordId, name: "" });
|
|
@@ -37658,7 +37712,7 @@ function ListRow({
|
|
|
37658
37712
|
}
|
|
37659
37713
|
|
|
37660
37714
|
// src/ChartLayout.tsx
|
|
37661
|
-
import { useEffect as
|
|
37715
|
+
import { useEffect as useEffect90, useMemo as useMemo62, useState as useState107 } from "react";
|
|
37662
37716
|
import { useRecordsClient as useRecordsClient70 } from "@ai-matrx/records/react";
|
|
37663
37717
|
import { fieldKindFor as fieldKindFor2, measureKey as measureKey4 } from "@ai-matrx/records";
|
|
37664
37718
|
import { Select as Select18, SelectContent as SelectContent16, SelectItem as SelectItem16, SelectTrigger as SelectTrigger16, SelectValue as SelectValue16 } from "@ai-matrx/design-system";
|
|
@@ -37688,7 +37742,7 @@ import { cn as cn62 } from "@ai-matrx/design-system";
|
|
|
37688
37742
|
import { formatCount as formatCount5 } from "@ai-matrx/kit/format";
|
|
37689
37743
|
|
|
37690
37744
|
// src/linkWords.ts
|
|
37691
|
-
import { useEffect as
|
|
37745
|
+
import { useEffect as useEffect87, useMemo as useMemo60, useState as useState104 } from "react";
|
|
37692
37746
|
import { useOptionalRecordsClient as useOptionalRecordsClient19 } from "@ai-matrx/records/react";
|
|
37693
37747
|
|
|
37694
37748
|
// src/charts.ts
|
|
@@ -37906,7 +37960,7 @@ function useLinkGroupNamer(block, tableId) {
|
|
|
37906
37960
|
const [named, setNamed] = useState104({});
|
|
37907
37961
|
const [choices, setChoices] = useState104([]);
|
|
37908
37962
|
const labels = useRecordLabels(choices);
|
|
37909
|
-
|
|
37963
|
+
useEffect87(() => {
|
|
37910
37964
|
if (!client || groupBy.length === 0 || rows.length === 0) return;
|
|
37911
37965
|
let cancelled = false;
|
|
37912
37966
|
void (async () => {
|
|
@@ -37949,7 +38003,7 @@ function useLinkGroupNamer(block, tableId) {
|
|
|
37949
38003
|
}
|
|
37950
38004
|
|
|
37951
38005
|
// src/measureWords.ts
|
|
37952
|
-
import { useEffect as
|
|
38006
|
+
import { useEffect as useEffect88, useState as useState105 } from "react";
|
|
37953
38007
|
import { useOptionalRecordsClient as useOptionalRecordsClient20 } from "@ai-matrx/records/react";
|
|
37954
38008
|
import { humanizeIdentifier as humanizeIdentifier14 } from "@ai-matrx/kit/text-case";
|
|
37955
38009
|
var OP_WORD = { sum: "Total", avg: "Average", min: "Lowest", max: "Highest" };
|
|
@@ -37968,7 +38022,7 @@ function useMeasureWords(key, tableId) {
|
|
|
37968
38022
|
const client = useOptionalRecordsClient20();
|
|
37969
38023
|
const [fields, setFields] = useState105(null);
|
|
37970
38024
|
const needs = key !== "count";
|
|
37971
|
-
|
|
38025
|
+
useEffect88(() => {
|
|
37972
38026
|
if (!client || !tableId || !needs) return;
|
|
37973
38027
|
let cancelled = false;
|
|
37974
38028
|
void client.fields({ table_id: tableId }).then((result) => {
|
|
@@ -37983,17 +38037,17 @@ function useMeasureWords(key, tableId) {
|
|
|
37983
38037
|
|
|
37984
38038
|
// src/chartFrame.tsx
|
|
37985
38039
|
import {
|
|
37986
|
-
useEffect as
|
|
38040
|
+
useEffect as useEffect89,
|
|
37987
38041
|
useId as useId4,
|
|
37988
|
-
useRef as
|
|
38042
|
+
useRef as useRef51,
|
|
37989
38043
|
useState as useState106
|
|
37990
38044
|
} from "react";
|
|
37991
38045
|
import { cn as cn61 } from "@ai-matrx/design-system";
|
|
37992
38046
|
import { jsx as jsx127, jsxs as jsxs115 } from "react/jsx-runtime";
|
|
37993
38047
|
function useMeasuredWidth(fallback = 480) {
|
|
37994
|
-
const ref =
|
|
38048
|
+
const ref = useRef51(null);
|
|
37995
38049
|
const [width, setWidth] = useState106(fallback);
|
|
37996
|
-
|
|
38050
|
+
useEffect89(() => {
|
|
37997
38051
|
const node = ref.current;
|
|
37998
38052
|
if (!node) return;
|
|
37999
38053
|
const apply = () => {
|
|
@@ -38631,7 +38685,7 @@ function ChartLayout({ view, fields, filter, onChange, remembered }) {
|
|
|
38631
38685
|
const [state2, setState] = useState107({ block: null, error: null });
|
|
38632
38686
|
const filterKey = JSON.stringify(filter ?? {});
|
|
38633
38687
|
const qKey = JSON.stringify(q);
|
|
38634
|
-
|
|
38688
|
+
useEffect90(() => {
|
|
38635
38689
|
let cancelled = false;
|
|
38636
38690
|
const asked4 = JSON.parse(filterKey);
|
|
38637
38691
|
const question = JSON.parse(qKey);
|
|
@@ -38707,7 +38761,7 @@ function useViewRecords(view, pageSize = 200, filter, viewId) {
|
|
|
38707
38761
|
const client = useRecordsClient71();
|
|
38708
38762
|
const [limit, setLimit] = useState108(pageSize);
|
|
38709
38763
|
const questionKey = `${view.subject}|${stableFilterKey4(filter ?? null)}|${JSON.stringify(view.sorts ?? [])}`;
|
|
38710
|
-
|
|
38764
|
+
useEffect91(() => {
|
|
38711
38765
|
setLimit(pageSize);
|
|
38712
38766
|
}, [questionKey, pageSize]);
|
|
38713
38767
|
const storeSort = useMemo63(
|
|
@@ -38725,7 +38779,7 @@ function useViewRecords(view, pageSize = 200, filter, viewId) {
|
|
|
38725
38779
|
error: null
|
|
38726
38780
|
});
|
|
38727
38781
|
const ruleId = view.ruleId ?? null;
|
|
38728
|
-
|
|
38782
|
+
useEffect91(() => {
|
|
38729
38783
|
if (!ruleId) return;
|
|
38730
38784
|
let cancelled = false;
|
|
38731
38785
|
setRuled({ rows: [], loading: true, error: null });
|
|
@@ -38851,7 +38905,7 @@ function ViewSwitcherBody({
|
|
|
38851
38905
|
setSeenSignature(viewSignature);
|
|
38852
38906
|
if (Object.keys(local).length > 0) setLocal({});
|
|
38853
38907
|
}
|
|
38854
|
-
|
|
38908
|
+
useEffect91(() => {
|
|
38855
38909
|
setLayout(view.layout);
|
|
38856
38910
|
setLocal({});
|
|
38857
38911
|
}, [view.layout, view.name, view.subject]);
|
|
@@ -38950,7 +39004,7 @@ function useFarFields(all) {
|
|
|
38950
39004
|
const client = useRecordsClient71();
|
|
38951
39005
|
const targets = lookupTargets(all).sort().join(",");
|
|
38952
39006
|
const [far, setFar] = useState108(() => /* @__PURE__ */ new Map());
|
|
38953
|
-
|
|
39007
|
+
useEffect91(() => {
|
|
38954
39008
|
let cancelled = false;
|
|
38955
39009
|
const ids = targets ? targets.split(",") : [];
|
|
38956
39010
|
if (ids.length === 0) {
|
|
@@ -38989,7 +39043,7 @@ function useStageField(tableId) {
|
|
|
38989
39043
|
asked: false,
|
|
38990
39044
|
key: null
|
|
38991
39045
|
});
|
|
38992
|
-
|
|
39046
|
+
useEffect91(() => {
|
|
38993
39047
|
let cancelled = false;
|
|
38994
39048
|
setStage({ asked: false, key: null });
|
|
38995
39049
|
void client.tableStageField({ table_id: tableId }).then((r) => {
|
|
@@ -39883,7 +39937,7 @@ function boardDefaultGroupField(eligible) {
|
|
|
39883
39937
|
}
|
|
39884
39938
|
|
|
39885
39939
|
// src/ArchivedView.tsx
|
|
39886
|
-
import { useCallback as useCallback40, useEffect as
|
|
39940
|
+
import { useCallback as useCallback40, useEffect as useEffect92, useState as useState109 } from "react";
|
|
39887
39941
|
import {
|
|
39888
39942
|
ARCHIVE_LANES,
|
|
39889
39943
|
ARCHIVE_LANE_LABEL,
|
|
@@ -39921,7 +39975,7 @@ function ArchivedView({
|
|
|
39921
39975
|
const [error, setError] = useState109(null);
|
|
39922
39976
|
const [restoring, setRestoring] = useState109(null);
|
|
39923
39977
|
const [refusal3, setRefusal] = useState109(null);
|
|
39924
|
-
|
|
39978
|
+
useEffect92(() => {
|
|
39925
39979
|
if (laneFromHost) setLane(laneFromHost);
|
|
39926
39980
|
}, [laneFromHost]);
|
|
39927
39981
|
const read = useCallback40(async () => {
|
|
@@ -39936,7 +39990,7 @@ function ArchivedView({
|
|
|
39936
39990
|
}
|
|
39937
39991
|
setLoading(false);
|
|
39938
39992
|
}, [client, tableId, lane, pageSize]);
|
|
39939
|
-
|
|
39993
|
+
useEffect92(() => {
|
|
39940
39994
|
void read();
|
|
39941
39995
|
}, [read]);
|
|
39942
39996
|
const pick = (next) => {
|
|
@@ -40037,7 +40091,7 @@ function RetiredColumns({ tableId, mayRestore, whyNot }) {
|
|
|
40037
40091
|
setError(answer.error);
|
|
40038
40092
|
}
|
|
40039
40093
|
}, [client, tableId]);
|
|
40040
|
-
|
|
40094
|
+
useEffect92(() => {
|
|
40041
40095
|
void read();
|
|
40042
40096
|
}, [read]);
|
|
40043
40097
|
const restore = async (fieldId) => {
|
|
@@ -40082,7 +40136,7 @@ function RetiredColumns({ tableId, mayRestore, whyNot }) {
|
|
|
40082
40136
|
}
|
|
40083
40137
|
|
|
40084
40138
|
// src/ArchivedDisclosure.tsx
|
|
40085
|
-
import { useCallback as useCallback41, useEffect as
|
|
40139
|
+
import { useCallback as useCallback41, useEffect as useEffect93, useState as useState110 } from "react";
|
|
40086
40140
|
import {
|
|
40087
40141
|
emptyPortalArchiveLine,
|
|
40088
40142
|
portalConfirmLine,
|
|
@@ -40151,7 +40205,7 @@ function ArchivedPortals({
|
|
|
40151
40205
|
setError(answered.error);
|
|
40152
40206
|
}
|
|
40153
40207
|
}, [client]);
|
|
40154
|
-
|
|
40208
|
+
useEffect93(() => {
|
|
40155
40209
|
void read();
|
|
40156
40210
|
}, [read, refreshToken]);
|
|
40157
40211
|
const restore = async (portal) => {
|
|
@@ -40267,7 +40321,7 @@ function ArchivedPortals({
|
|
|
40267
40321
|
}
|
|
40268
40322
|
|
|
40269
40323
|
// src/ViewBar.tsx
|
|
40270
|
-
import { useCallback as useCallback43, useEffect as
|
|
40324
|
+
import { useCallback as useCallback43, useEffect as useEffect94, useRef as useRef53, useState as useState111 } from "react";
|
|
40271
40325
|
import { useRecordsClient as useRecordsClient74 } from "@ai-matrx/records/react";
|
|
40272
40326
|
import { Badge as Badge15, Button as Button80, Input as Input7, Popover as Popover16, PopoverContent as PopoverContent16, PopoverTrigger as PopoverTrigger16, Skeleton as Skeleton18, cn as cn66 } from "@ai-matrx/design-system";
|
|
40273
40327
|
import { Button as ControlButton, Switch as Switch5, Tile as Tile2 } from "@ai-matrx/design-system/controls";
|
|
@@ -40276,9 +40330,9 @@ import { SortableContext, useSortable, verticalListSortingStrategy } from "@dnd-
|
|
|
40276
40330
|
import { CSS as CSS2 } from "@dnd-kit/utilities";
|
|
40277
40331
|
|
|
40278
40332
|
// src/seedOnce.ts
|
|
40279
|
-
import { useCallback as useCallback42, useRef as
|
|
40333
|
+
import { useCallback as useCallback42, useRef as useRef52 } from "react";
|
|
40280
40334
|
function useSeedGuard() {
|
|
40281
|
-
const claimed =
|
|
40335
|
+
const claimed = useRef52(/* @__PURE__ */ new Set());
|
|
40282
40336
|
return useCallback42((name) => {
|
|
40283
40337
|
if (claimed.current.has(name)) return false;
|
|
40284
40338
|
claimed.current.add(name);
|
|
@@ -40393,8 +40447,8 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews,
|
|
|
40393
40447
|
if (!initialViews || initialViews.length === 0) return activeViewId ?? null;
|
|
40394
40448
|
return (initialViews.find((v) => v.id === activeViewId) ?? defaultViewOf(initialViews) ?? initialViews[0]).id;
|
|
40395
40449
|
});
|
|
40396
|
-
const readOnMount =
|
|
40397
|
-
const pendingPick =
|
|
40450
|
+
const readOnMount = useRef53(initialViews === void 0);
|
|
40451
|
+
const pendingPick = useRef53(null);
|
|
40398
40452
|
const [naming, setNaming] = useState111(false);
|
|
40399
40453
|
const [draftName, setDraftName] = useState111("");
|
|
40400
40454
|
const [open, setOpen] = useState111(false);
|
|
@@ -40414,7 +40468,7 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews,
|
|
|
40414
40468
|
});
|
|
40415
40469
|
const [renamingSection, setRenamingSection] = useState111(null);
|
|
40416
40470
|
const [dragging, setDragging] = useState111(false);
|
|
40417
|
-
const justDragged =
|
|
40471
|
+
const justDragged = useRef53(false);
|
|
40418
40472
|
const sensors = useSensors(useSensor(PointerSensor, { activationConstraint: { distance: 6 } }));
|
|
40419
40473
|
async function dropped(event) {
|
|
40420
40474
|
setDragging(false);
|
|
@@ -40492,14 +40546,14 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews,
|
|
|
40492
40546
|
setViews(mine);
|
|
40493
40547
|
onViews?.(mine);
|
|
40494
40548
|
}, [client, readViews, tableId, seedKey, tableThere]);
|
|
40495
|
-
|
|
40549
|
+
useEffect94(() => {
|
|
40496
40550
|
if (!readOnMount.current) {
|
|
40497
40551
|
readOnMount.current = true;
|
|
40498
40552
|
return;
|
|
40499
40553
|
}
|
|
40500
40554
|
void load();
|
|
40501
40555
|
}, [load]);
|
|
40502
|
-
|
|
40556
|
+
useEffect94(() => {
|
|
40503
40557
|
if (!views || views.length === 0) return;
|
|
40504
40558
|
const wanted = pendingPick.current;
|
|
40505
40559
|
pendingPick.current = null;
|
|
@@ -40877,7 +40931,7 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews,
|
|
|
40877
40931
|
}
|
|
40878
40932
|
|
|
40879
40933
|
// src/ProposalRow.tsx
|
|
40880
|
-
import { useEffect as
|
|
40934
|
+
import { useEffect as useEffect95, useRef as useRef54, useState as useState112 } from "react";
|
|
40881
40935
|
import { useRecordsClient as useRecordsClient75 } from "@ai-matrx/records/react";
|
|
40882
40936
|
import { Badge as Badge16, Button as Button81, cn as cn67 } from "@ai-matrx/design-system";
|
|
40883
40937
|
import { jsx as jsx134, jsxs as jsxs122 } from "react/jsx-runtime";
|
|
@@ -40895,9 +40949,9 @@ function ProposalRow({
|
|
|
40895
40949
|
const [settled, setSettled] = useState112(outcome ?? null);
|
|
40896
40950
|
const [busy, setBusy] = useState112(false);
|
|
40897
40951
|
const [confirming, setConfirming] = useState112(false);
|
|
40898
|
-
const drawnVersion =
|
|
40952
|
+
const drawnVersion = useRef54(null);
|
|
40899
40953
|
const needsVersion = change.act === "update" && Boolean(change.record) && change.version === void 0 && !onApply && !settled;
|
|
40900
|
-
|
|
40954
|
+
useEffect95(() => {
|
|
40901
40955
|
if (needsVersion && change.record && !drawnVersion.current) drawnVersion.current = (0, recordVersions_exports.readVersionNow)(client, change.record);
|
|
40902
40956
|
}, [needsVersion, change.record, client]);
|
|
40903
40957
|
async function applyThroughTheStore() {
|
|
@@ -40985,14 +41039,14 @@ function ProposalRow({
|
|
|
40985
41039
|
}
|
|
40986
41040
|
|
|
40987
41041
|
// src/ActionInbox.tsx
|
|
40988
|
-
import { useCallback as useCallback45, useEffect as
|
|
41042
|
+
import { useCallback as useCallback45, useEffect as useEffect97, useMemo as useMemo65, useRef as useRef55, useState as useState114 } from "react";
|
|
40989
41043
|
import { useRecordsClient as useRecordsClient77 } from "@ai-matrx/records/react";
|
|
40990
41044
|
import { Badge as Badge18, Button as Button83, Checkbox as Checkbox13, Skeleton as Skeleton20, cn as cn69 } from "@ai-matrx/design-system";
|
|
40991
41045
|
import { toggleSelection as toggleSelection2 } from "@ai-matrx/design-system/data-table";
|
|
40992
41046
|
import { formatAbsoluteDate, formatDurationMs } from "@ai-matrx/kit/format";
|
|
40993
41047
|
|
|
40994
41048
|
// src/ChecklistRunner.tsx
|
|
40995
|
-
import { useCallback as useCallback44, useEffect as
|
|
41049
|
+
import { useCallback as useCallback44, useEffect as useEffect96, useMemo as useMemo64, useState as useState113 } from "react";
|
|
40996
41050
|
import { useRecordsClient as useRecordsClient76, useTable as useTable24 } from "@ai-matrx/records/react";
|
|
40997
41051
|
import { Badge as Badge17, BasicInput as BasicInput22, BasicTextarea as BasicTextarea9, Button as Button82, Skeleton as Skeleton19, cn as cn68 } from "@ai-matrx/design-system";
|
|
40998
41052
|
import { Select as Select20 } from "@ai-matrx/design-system/controls";
|
|
@@ -41043,10 +41097,10 @@ function ChecklistRunner({
|
|
|
41043
41097
|
(held) => held && answered.data.some((r) => r.run_id === held) ? held : answered.data[0]?.run_id ?? null
|
|
41044
41098
|
);
|
|
41045
41099
|
}, [client, includeClosed, recordId, runId, tableId]);
|
|
41046
|
-
|
|
41100
|
+
useEffect96(() => {
|
|
41047
41101
|
void loadRuns();
|
|
41048
41102
|
}, [loadRuns]);
|
|
41049
|
-
|
|
41103
|
+
useEffect96(() => {
|
|
41050
41104
|
if (runId) setActiveId(runId);
|
|
41051
41105
|
}, [runId]);
|
|
41052
41106
|
const loadSteps = useCallback44(async () => {
|
|
@@ -41063,10 +41117,10 @@ function ChecklistRunner({
|
|
|
41063
41117
|
setError(null);
|
|
41064
41118
|
setSteps(answered.data);
|
|
41065
41119
|
}, [client, activeId]);
|
|
41066
|
-
|
|
41120
|
+
useEffect96(() => {
|
|
41067
41121
|
void loadSteps();
|
|
41068
41122
|
}, [loadSteps]);
|
|
41069
|
-
|
|
41123
|
+
useEffect96(() => {
|
|
41070
41124
|
if (!mayStart || !tableId) return;
|
|
41071
41125
|
let cancelled = false;
|
|
41072
41126
|
void client.checklistTemplates({ about_table_id: tableId, limit: 50 }).then((answered) => {
|
|
@@ -41197,7 +41251,7 @@ function StepRow({
|
|
|
41197
41251
|
const host = useRecordsUi();
|
|
41198
41252
|
const [members, setMembers] = useState113(null);
|
|
41199
41253
|
const unassigned = !step2.finished && !step2.assignee_user_id && Boolean(step2.role);
|
|
41200
|
-
|
|
41254
|
+
useEffect96(() => {
|
|
41201
41255
|
if (!unassigned || !onAssign || !host.members || members !== null) return;
|
|
41202
41256
|
let alive = true;
|
|
41203
41257
|
void host.members().then((roster) => {
|
|
@@ -41331,7 +41385,7 @@ function useMyChecklistSteps(limit = 25) {
|
|
|
41331
41385
|
setSteps(held);
|
|
41332
41386
|
setLoading(false);
|
|
41333
41387
|
}, [client, limit, me]);
|
|
41334
|
-
|
|
41388
|
+
useEffect96(() => {
|
|
41335
41389
|
void refresh();
|
|
41336
41390
|
}, [refresh]);
|
|
41337
41391
|
return { steps, loading, error, refresh };
|
|
@@ -41344,7 +41398,7 @@ function MyChecklistSteps({
|
|
|
41344
41398
|
}) {
|
|
41345
41399
|
const client = useRecordsClient76();
|
|
41346
41400
|
const { steps: held, loading, error, refresh } = useMyChecklistSteps();
|
|
41347
|
-
|
|
41401
|
+
useEffect96(() => {
|
|
41348
41402
|
onSteps?.(held.map((s) => s.step_id));
|
|
41349
41403
|
}, [held, onSteps]);
|
|
41350
41404
|
const steps = onlyIds ? held.filter((s) => onlyIds.has(s.step_id)) : held;
|
|
@@ -41413,7 +41467,7 @@ function ChecklistsPanel({ tableId, onOpenRecord, className }) {
|
|
|
41413
41467
|
if (!r.ok) setRuns([]);
|
|
41414
41468
|
else setRuns(r.data);
|
|
41415
41469
|
}, [client, tableId]);
|
|
41416
|
-
|
|
41470
|
+
useEffect96(() => {
|
|
41417
41471
|
void load();
|
|
41418
41472
|
}, [load]);
|
|
41419
41473
|
if (templates === null) return /* @__PURE__ */ jsx135(Skeleton19, { className: cn68("h-40 w-full", className) });
|
|
@@ -41576,7 +41630,7 @@ function ChecklistTemplateEditor({
|
|
|
41576
41630
|
const [error, setError] = useState113(null);
|
|
41577
41631
|
const [busy, setBusy] = useState113(false);
|
|
41578
41632
|
const [loading, setLoading] = useState113(Boolean(templateId));
|
|
41579
|
-
|
|
41633
|
+
useEffect96(() => {
|
|
41580
41634
|
if (!templateId) return;
|
|
41581
41635
|
let cancelled = false;
|
|
41582
41636
|
void client.checklistTemplateShape({ template_id: templateId }).then((answered) => {
|
|
@@ -41613,8 +41667,8 @@ function ChecklistTemplateEditor({
|
|
|
41613
41667
|
}),
|
|
41614
41668
|
[aboutTableId, name, rows]
|
|
41615
41669
|
);
|
|
41616
|
-
|
|
41617
|
-
|
|
41670
|
+
useEffect96(() => setSaved(false), [spec]);
|
|
41671
|
+
useEffect96(() => {
|
|
41618
41672
|
if (spec.steps.length === 0 || spec.name.length === 0) {
|
|
41619
41673
|
setRefusal(null);
|
|
41620
41674
|
return;
|
|
@@ -41883,9 +41937,9 @@ function ActionInbox({
|
|
|
41883
41937
|
const [outcome, setOutcome] = useState114({});
|
|
41884
41938
|
const [busy, setBusy] = useState114(null);
|
|
41885
41939
|
const [cursor, setCursor] = useState114(0);
|
|
41886
|
-
const listRef =
|
|
41940
|
+
const listRef = useRef55(null);
|
|
41887
41941
|
const [selected, setSelected] = useState114(/* @__PURE__ */ new Set());
|
|
41888
|
-
const anchor =
|
|
41942
|
+
const anchor = useRef55(null);
|
|
41889
41943
|
const [deciding, setDeciding] = useState114(false);
|
|
41890
41944
|
const [batchSaid, setBatchSaid] = useState114(null);
|
|
41891
41945
|
const [view, setView] = useState114("inbox");
|
|
@@ -41909,7 +41963,7 @@ function ActionInbox({
|
|
|
41909
41963
|
setError(null);
|
|
41910
41964
|
setItems(result.data);
|
|
41911
41965
|
}, [client, showDecided, view]);
|
|
41912
|
-
|
|
41966
|
+
useEffect97(() => {
|
|
41913
41967
|
void load();
|
|
41914
41968
|
}, [load]);
|
|
41915
41969
|
const narrowed = useMemo65(() => {
|
|
@@ -41924,10 +41978,10 @@ function ActionInbox({
|
|
|
41924
41978
|
const groups = useMemo65(() => groupInbox(narrowed, groupBy), [narrowed, groupBy]);
|
|
41925
41979
|
const shown5 = useMemo65(() => groups.flatMap((g) => g.items), [groups]);
|
|
41926
41980
|
const elsewhere = (items?.length ?? 0) - narrowed.length;
|
|
41927
|
-
|
|
41981
|
+
useEffect97(() => {
|
|
41928
41982
|
if (cursor >= shown5.length) setCursor(Math.max(0, shown5.length - 1));
|
|
41929
41983
|
}, [shown5.length, cursor]);
|
|
41930
|
-
|
|
41984
|
+
useEffect97(() => {
|
|
41931
41985
|
const list = listRef.current;
|
|
41932
41986
|
const el = list?.querySelector(`[data-row="${cursor}"]`);
|
|
41933
41987
|
if (list && el) scrollWithinList(list, el);
|
|
@@ -41949,11 +42003,11 @@ function ActionInbox({
|
|
|
41949
42003
|
[client, load]
|
|
41950
42004
|
);
|
|
41951
42005
|
const [held, setHeld] = useState114({});
|
|
41952
|
-
const holds2 =
|
|
41953
|
-
const lastHold =
|
|
41954
|
-
const holdSeq =
|
|
42006
|
+
const holds2 = useRef55(/* @__PURE__ */ new Map());
|
|
42007
|
+
const lastHold = useRef55(null);
|
|
42008
|
+
const holdSeq = useRef55(0);
|
|
41955
42009
|
const [, tick] = useState114(0);
|
|
41956
|
-
|
|
42010
|
+
useEffect97(() => {
|
|
41957
42011
|
if (Object.keys(held).length === 0) return;
|
|
41958
42012
|
const t = setInterval(() => tick((n) => n + 1), 250);
|
|
41959
42013
|
return () => clearInterval(t);
|
|
@@ -41999,7 +42053,7 @@ function ActionInbox({
|
|
|
41999
42053
|
});
|
|
42000
42054
|
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 });
|
|
42001
42055
|
}, []);
|
|
42002
|
-
|
|
42056
|
+
useEffect97(() => {
|
|
42003
42057
|
const flush = () => {
|
|
42004
42058
|
for (const entry of [...holds2.current.values()]) entry.commit();
|
|
42005
42059
|
};
|
|
@@ -42009,8 +42063,8 @@ function ActionInbox({
|
|
|
42009
42063
|
flush();
|
|
42010
42064
|
};
|
|
42011
42065
|
}, []);
|
|
42012
|
-
const resumed =
|
|
42013
|
-
|
|
42066
|
+
const resumed = useRef55(false);
|
|
42067
|
+
useEffect97(() => {
|
|
42014
42068
|
if (resumed.current || items === null || view !== "inbox") return;
|
|
42015
42069
|
resumed.current = true;
|
|
42016
42070
|
const kept = readHolds();
|
|
@@ -42631,7 +42685,7 @@ function ActionInbox({
|
|
|
42631
42685
|
|
|
42632
42686
|
// src/HistoryPanel.tsx
|
|
42633
42687
|
import { isUuidShape as isUuidShape8 } from "@ai-matrx/kit/uuid";
|
|
42634
|
-
import { useCallback as useCallback47, useEffect as
|
|
42688
|
+
import { useCallback as useCallback47, useEffect as useEffect100, useRef as useRef56, useState as useState117 } from "react";
|
|
42635
42689
|
|
|
42636
42690
|
// src/undoChange.ts
|
|
42637
42691
|
function blank(value) {
|
|
@@ -42678,7 +42732,7 @@ import { Badge as Badge19, Button as Button86, Skeleton as Skeleton22, cn as cn7
|
|
|
42678
42732
|
import { formatRelativeTime as formatRelativeTime3 } from "@ai-matrx/kit/format";
|
|
42679
42733
|
|
|
42680
42734
|
// src/AsOfReading.tsx
|
|
42681
|
-
import { useEffect as
|
|
42735
|
+
import { useEffect as useEffect98, useMemo as useMemo66, useState as useState115 } from "react";
|
|
42682
42736
|
import { readTypedDate as readTypedDate3, typedDateText as typedDateText3 } from "@ai-matrx/records";
|
|
42683
42737
|
import { useRecordsClient as useRecordsClient78 } from "@ai-matrx/records/react";
|
|
42684
42738
|
import { Button as Button84, Skeleton as Skeleton21, cn as cn70 } from "@ai-matrx/design-system";
|
|
@@ -42806,7 +42860,7 @@ function AsOfReading({
|
|
|
42806
42860
|
const zone = usePersonTimeZone();
|
|
42807
42861
|
const [answer, setAnswer] = useState115(null);
|
|
42808
42862
|
const key = `${recordId}|${asOf.clock}|${asOf.day}|${zone ?? ""}`;
|
|
42809
|
-
|
|
42863
|
+
useEffect98(() => {
|
|
42810
42864
|
let live = true;
|
|
42811
42865
|
void client.recordAsOf(asOfArgs(recordId, asOf, zone)).then((got) => {
|
|
42812
42866
|
if (!live) return;
|
|
@@ -42841,7 +42895,7 @@ function AsOfReading({
|
|
|
42841
42895
|
import { humanizeIdentifier as humanizeIdentifier18 } from "@ai-matrx/kit/text-case";
|
|
42842
42896
|
|
|
42843
42897
|
// src/MigrationLog.tsx
|
|
42844
|
-
import { useCallback as useCallback46, useEffect as
|
|
42898
|
+
import { useCallback as useCallback46, useEffect as useEffect99, useState as useState116 } from "react";
|
|
42845
42899
|
import { useRecordsClient as useRecordsClient79 } from "@ai-matrx/records/react";
|
|
42846
42900
|
import { Button as Button85, cn as cn71 } from "@ai-matrx/design-system";
|
|
42847
42901
|
import { humanizeIdentifier as humanizeIdentifier17 } from "@ai-matrx/kit/text-case";
|
|
@@ -42882,7 +42936,7 @@ function useMigrationLog(recordId) {
|
|
|
42882
42936
|
setError(null);
|
|
42883
42937
|
setEntries(answered.data);
|
|
42884
42938
|
}, [client, recordId]);
|
|
42885
|
-
|
|
42939
|
+
useEffect99(() => {
|
|
42886
42940
|
void reload();
|
|
42887
42941
|
}, [reload]);
|
|
42888
42942
|
return { entries, error, reload };
|
|
@@ -42948,9 +43002,9 @@ function HistoryPanel({ tableId, recordId, onAskAboutField, className }) {
|
|
|
42948
43002
|
const [open, setOpen] = useState117(null);
|
|
42949
43003
|
const [pending, setPending] = useState117({ phase: "idle" });
|
|
42950
43004
|
const [undo, setUndo] = useState117({ phase: "idle" });
|
|
42951
|
-
const seenAtPreview =
|
|
43005
|
+
const seenAtPreview = useRef56(null);
|
|
42952
43006
|
const [said2, setSaid] = useState117(null);
|
|
42953
|
-
const listRef =
|
|
43007
|
+
const listRef = useRef56(null);
|
|
42954
43008
|
const [asOf, setAsOf] = useState117(null);
|
|
42955
43009
|
const today = useRecord4(recordId, false, { tableId });
|
|
42956
43010
|
const changed2 = useRecordChangeRevision(recordId);
|
|
@@ -42964,7 +43018,7 @@ function HistoryPanel({ tableId, recordId, onAskAboutField, className }) {
|
|
|
42964
43018
|
setError(null);
|
|
42965
43019
|
setEntries(answered.data);
|
|
42966
43020
|
}, [client, recordId, changed2]);
|
|
42967
|
-
|
|
43021
|
+
useEffect100(() => {
|
|
42968
43022
|
void load();
|
|
42969
43023
|
}, [load]);
|
|
42970
43024
|
if (error) return /* @__PURE__ */ jsx139(RefusalNotice, { error, className });
|
|
@@ -43394,7 +43448,7 @@ function say(value, field2) {
|
|
|
43394
43448
|
|
|
43395
43449
|
// src/CommentThread.tsx
|
|
43396
43450
|
import { isUuidShape as isUuidShape9 } from "@ai-matrx/kit/uuid";
|
|
43397
|
-
import { useCallback as useCallback48, useEffect as
|
|
43451
|
+
import { useCallback as useCallback48, useEffect as useEffect101, useMemo as useMemo67, useRef as useRef57, useState as useState118 } from "react";
|
|
43398
43452
|
import {
|
|
43399
43453
|
useFields as useFields24,
|
|
43400
43454
|
useRecordsClient as useRecordsClient81,
|
|
@@ -43418,7 +43472,7 @@ function CommentThread({ tableId, recordId, fieldKey, className }) {
|
|
|
43418
43472
|
const [people, setPeople] = useState118([]);
|
|
43419
43473
|
const [mentionQuery, setMentionQuery] = useState118(null);
|
|
43420
43474
|
const [picked, setPicked] = useState118([]);
|
|
43421
|
-
const box =
|
|
43475
|
+
const box = useRef57(null);
|
|
43422
43476
|
const load = useCallback48(async () => {
|
|
43423
43477
|
const answered = await client.commentThread({ record_id: recordId, include_resolved: showResolved });
|
|
43424
43478
|
if (!answered.ok) {
|
|
@@ -43432,10 +43486,10 @@ function CommentThread({ tableId, recordId, fieldKey, className }) {
|
|
|
43432
43486
|
mayResolve: answered.data.may_resolve
|
|
43433
43487
|
});
|
|
43434
43488
|
}, [client, recordId, showResolved]);
|
|
43435
|
-
|
|
43489
|
+
useEffect101(() => {
|
|
43436
43490
|
void load();
|
|
43437
43491
|
}, [load]);
|
|
43438
|
-
|
|
43492
|
+
useEffect101(() => {
|
|
43439
43493
|
let alive = true;
|
|
43440
43494
|
if (!host.members) return;
|
|
43441
43495
|
void host.members().then((roster) => {
|
|
@@ -43638,7 +43692,7 @@ function Line2({
|
|
|
43638
43692
|
}
|
|
43639
43693
|
|
|
43640
43694
|
// src/FieldHistoryPanel.tsx
|
|
43641
|
-
import { useCallback as useCallback49, useEffect as
|
|
43695
|
+
import { useCallback as useCallback49, useEffect as useEffect102, useRef as useRef58, useState as useState119 } from "react";
|
|
43642
43696
|
import {
|
|
43643
43697
|
useFields as useFields25,
|
|
43644
43698
|
useRecordsClient as useRecordsClient82,
|
|
@@ -43663,7 +43717,7 @@ function FieldHistoryPanel({
|
|
|
43663
43717
|
const [rows, setRows] = useState119(null);
|
|
43664
43718
|
const [error, setError] = useState119(null);
|
|
43665
43719
|
const [pending, setPending] = useState119({ phase: "idle" });
|
|
43666
|
-
const seenAtPreview =
|
|
43720
|
+
const seenAtPreview = useRef58(null);
|
|
43667
43721
|
const [said2, setSaid] = useState119(null);
|
|
43668
43722
|
const load = useCallback49(async () => {
|
|
43669
43723
|
const answered = await client.fieldHistory(
|
|
@@ -43676,7 +43730,7 @@ function FieldHistoryPanel({
|
|
|
43676
43730
|
setError(null);
|
|
43677
43731
|
setRows(answered.data);
|
|
43678
43732
|
}, [client, tableId, fieldKey, recordId]);
|
|
43679
|
-
|
|
43733
|
+
useEffect102(() => {
|
|
43680
43734
|
void load();
|
|
43681
43735
|
}, [load]);
|
|
43682
43736
|
const label = (fields.data ?? []).find((f) => f.key === fieldKey)?.label || humanizeIdentifier20(fieldKey);
|
|
@@ -43811,7 +43865,7 @@ function FieldHistoryPanel({
|
|
|
43811
43865
|
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";
|
|
43812
43866
|
|
|
43813
43867
|
// src/FormResultsPanel.tsx
|
|
43814
|
-
import { useEffect as
|
|
43868
|
+
import { useEffect as useEffect103, useMemo as useMemo68, useState as useState120 } from "react";
|
|
43815
43869
|
import { useFields as useFields26, useOptionalRecordsClient as useOptionalRecordsClient21 } from "@ai-matrx/records/react";
|
|
43816
43870
|
import { Button as Button89, Skeleton as Skeleton25, cn as cn75 } from "@ai-matrx/design-system";
|
|
43817
43871
|
import { jsx as jsx142, jsxs as jsxs130 } from "react/jsx-runtime";
|
|
@@ -43840,7 +43894,7 @@ function FormResultsPanel({ form, className }) {
|
|
|
43840
43894
|
const [results, setResults] = useState120(null);
|
|
43841
43895
|
const [error, setError] = useState120(null);
|
|
43842
43896
|
const [round, setRound] = useState120(0);
|
|
43843
|
-
|
|
43897
|
+
useEffect103(() => {
|
|
43844
43898
|
if (!client) {
|
|
43845
43899
|
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."));
|
|
43846
43900
|
return;
|
|
@@ -43938,7 +43992,7 @@ function FormResultsPanel({ form, className }) {
|
|
|
43938
43992
|
}
|
|
43939
43993
|
|
|
43940
43994
|
// src/PortalBuilder.tsx
|
|
43941
|
-
import { useCallback as useCallback50, useEffect as
|
|
43995
|
+
import { useCallback as useCallback50, useEffect as useEffect104, useMemo as useMemo69, useRef as useRef59, useState as useState121 } from "react";
|
|
43942
43996
|
import { useRecordsClient as useRecordsClient83, useTables as useTables4 } from "@ai-matrx/records/react";
|
|
43943
43997
|
import { BasicInput as BasicInput23, Button as Button90, Checkbox as Checkbox14, Label as Label20, Separator as Separator10, Skeleton as Skeleton26, cn as cn76 } from "@ai-matrx/design-system";
|
|
43944
43998
|
import { Select as Select21 } from "@ai-matrx/design-system/controls";
|
|
@@ -43972,7 +44026,7 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
|
|
|
43972
44026
|
},
|
|
43973
44027
|
[client, fieldsByTable]
|
|
43974
44028
|
);
|
|
43975
|
-
|
|
44029
|
+
useEffect104(() => {
|
|
43976
44030
|
if (!portalId) return;
|
|
43977
44031
|
void (async () => {
|
|
43978
44032
|
const answered = await client.portalCard({ portal_id: portalId });
|
|
@@ -43986,7 +44040,7 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
|
|
|
43986
44040
|
setClientTableId(answered.data.client_table_id);
|
|
43987
44041
|
})();
|
|
43988
44042
|
}, [client, portalId]);
|
|
43989
|
-
|
|
44043
|
+
useEffect104(() => {
|
|
43990
44044
|
if (!tableId) return;
|
|
43991
44045
|
setExposures(
|
|
43992
44046
|
(prev) => prev[tableId] ? prev : {
|
|
@@ -43999,7 +44053,7 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
|
|
|
43999
44053
|
const cameFromPeople = Boolean(
|
|
44000
44054
|
tableId && (fieldsByTable[tableId] ?? []).some((f) => editorKindFor(f) === "email")
|
|
44001
44055
|
);
|
|
44002
|
-
|
|
44056
|
+
useEffect104(() => {
|
|
44003
44057
|
if (!tableId || portalId || clientTableId !== null || !cameFromPeople) return;
|
|
44004
44058
|
setClientTableId(tableId);
|
|
44005
44059
|
setExposures((prev) => {
|
|
@@ -44014,7 +44068,7 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
|
|
|
44014
44068
|
),
|
|
44015
44069
|
[fieldsByTable, clientTableId]
|
|
44016
44070
|
);
|
|
44017
|
-
|
|
44071
|
+
useEffect104(() => {
|
|
44018
44072
|
for (const e of Object.values(exposures)) {
|
|
44019
44073
|
if (!e.on || e.namesVia.trim() !== "") continue;
|
|
44020
44074
|
const ties = tiesTo(e.tableId);
|
|
@@ -44029,7 +44083,7 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
|
|
|
44029
44083
|
if (on) void loadFields(t.id);
|
|
44030
44084
|
}
|
|
44031
44085
|
const [linking, setLinking] = useState121(null);
|
|
44032
|
-
const linkingNow =
|
|
44086
|
+
const linkingNow = useRef59(null);
|
|
44033
44087
|
async function addLinkBack(id) {
|
|
44034
44088
|
const clients = (tables.data ?? []).find((t) => t.id === clientTableId);
|
|
44035
44089
|
if (!clientTableId || !clients) return;
|
|
@@ -44056,8 +44110,8 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
|
|
|
44056
44110
|
linkingNow.current = null;
|
|
44057
44111
|
setLinking(null);
|
|
44058
44112
|
}
|
|
44059
|
-
const autoLinked =
|
|
44060
|
-
|
|
44113
|
+
const autoLinked = useRef59(/* @__PURE__ */ new Set());
|
|
44114
|
+
useEffect104(() => {
|
|
44061
44115
|
if (linking !== null || !clientTableId) return;
|
|
44062
44116
|
for (const e of Object.values(exposures)) {
|
|
44063
44117
|
if (!e.on || !fieldsByTable[e.tableId] || autoLinked.current.has(e.tableId)) continue;
|
|
@@ -44331,7 +44385,7 @@ function clientNoun(table) {
|
|
|
44331
44385
|
|
|
44332
44386
|
// src/PortalsPanel.tsx
|
|
44333
44387
|
import { copyText as copyText7 } from "@ai-matrx/kit/clipboard";
|
|
44334
|
-
import { useCallback as useCallback51, useEffect as
|
|
44388
|
+
import { useCallback as useCallback51, useEffect as useEffect106, useMemo as useMemo71, useState as useState123 } from "react";
|
|
44335
44389
|
import { useRecordsClient as useRecordsClient85 } from "@ai-matrx/records/react";
|
|
44336
44390
|
import {
|
|
44337
44391
|
portalArchiveConsequence,
|
|
@@ -44342,7 +44396,7 @@ import {
|
|
|
44342
44396
|
import { Badge as Badge22, BasicInput as BasicInput25, Button as Button92, Separator as Separator11, Skeleton as Skeleton27, cn as cn79 } from "@ai-matrx/design-system";
|
|
44343
44397
|
|
|
44344
44398
|
// src/PortalLookEditor.tsx
|
|
44345
|
-
import { useEffect as
|
|
44399
|
+
import { useEffect as useEffect105, useMemo as useMemo70, useState as useState122 } from "react";
|
|
44346
44400
|
import { useRecordsClient as useRecordsClient84 } from "@ai-matrx/records/react";
|
|
44347
44401
|
import { BasicInput as BasicInput24, Button as Button91, cn as cn78 } from "@ai-matrx/design-system";
|
|
44348
44402
|
|
|
@@ -44430,7 +44484,7 @@ function PortalLookEditor({ card, onSaved, className }) {
|
|
|
44430
44484
|
const [said2, setSaid] = useState122(null);
|
|
44431
44485
|
const [formsError, setFormsError] = useState122(null);
|
|
44432
44486
|
const [formsUnread, setFormsUnread] = useState122(false);
|
|
44433
|
-
|
|
44487
|
+
useEffect105(() => {
|
|
44434
44488
|
let cancelled = false;
|
|
44435
44489
|
void (async () => {
|
|
44436
44490
|
try {
|
|
@@ -44680,7 +44734,7 @@ function PortalsPanel({ tableId, activePortalId, className }) {
|
|
|
44680
44734
|
const [exposures, setExposures] = useState123([]);
|
|
44681
44735
|
const [listError, setListError] = useState123(null);
|
|
44682
44736
|
const [openId, setOpenId] = useState123(activePortalId ?? null);
|
|
44683
|
-
|
|
44737
|
+
useEffect106(() => {
|
|
44684
44738
|
if (activePortalId) setOpenId(activePortalId);
|
|
44685
44739
|
}, [activePortalId]);
|
|
44686
44740
|
const [building, setBuilding] = useState123(false);
|
|
@@ -44698,7 +44752,7 @@ function PortalsPanel({ tableId, activePortalId, className }) {
|
|
|
44698
44752
|
setPortals(answered.data);
|
|
44699
44753
|
setExposures(mapped.ok ? mapped.data : []);
|
|
44700
44754
|
}, [client]);
|
|
44701
|
-
|
|
44755
|
+
useEffect106(() => {
|
|
44702
44756
|
void load();
|
|
44703
44757
|
}, [load]);
|
|
44704
44758
|
if (portals === null) return /* @__PURE__ */ jsx146(Skeleton27, { className: cn79("h-32 w-full", className) });
|
|
@@ -44973,7 +45027,7 @@ function PortalDetail({
|
|
|
44973
45027
|
setError(null);
|
|
44974
45028
|
setCard(answered.data);
|
|
44975
45029
|
}, [client, portalId]);
|
|
44976
|
-
|
|
45030
|
+
useEffect106(() => {
|
|
44977
45031
|
void load();
|
|
44978
45032
|
}, [load]);
|
|
44979
45033
|
const revoke = useCallback51(
|
|
@@ -45181,7 +45235,7 @@ function Preview({
|
|
|
45181
45235
|
const [which, setWhich] = useState123(first?.table_id ?? null);
|
|
45182
45236
|
const [rows, setRows] = useState123(null);
|
|
45183
45237
|
const [error, setError] = useState123(null);
|
|
45184
|
-
|
|
45238
|
+
useEffect106(() => {
|
|
45185
45239
|
if (!which) return;
|
|
45186
45240
|
let cancelled = false;
|
|
45187
45241
|
setRows(null);
|
|
@@ -45227,7 +45281,7 @@ function Invite({ card, onInvited }) {
|
|
|
45227
45281
|
const [busy, setBusy] = useState123(false);
|
|
45228
45282
|
const [said2, setSaid] = useState123(null);
|
|
45229
45283
|
const [error, setError] = useState123(null);
|
|
45230
|
-
|
|
45284
|
+
useEffect106(() => {
|
|
45231
45285
|
let cancelled = false;
|
|
45232
45286
|
void client.list({ table_id: card.client_table_id, limit: 200 }).then((answered) => {
|
|
45233
45287
|
if (cancelled) return;
|
|
@@ -45438,7 +45492,7 @@ function FormLookFrame({ look, title, children, contained = false, showOwnerHead
|
|
|
45438
45492
|
}
|
|
45439
45493
|
|
|
45440
45494
|
// src/DigestScheduler.tsx
|
|
45441
|
-
import { useCallback as useCallback52, useEffect as
|
|
45495
|
+
import { useCallback as useCallback52, useEffect as useEffect107, useMemo as useMemo72, useState as useState124 } from "react";
|
|
45442
45496
|
import { useRecordsClient as useRecordsClient86, useTable as useTable28 } from "@ai-matrx/records/react";
|
|
45443
45497
|
import { hasQuietHours } from "@ai-matrx/records";
|
|
45444
45498
|
import { BasicInput as BasicInput26, Button as Button93, Checkbox as Checkbox15, Label as Label21, Separator as Separator12, Skeleton as Skeleton28, cn as cn81 } from "@ai-matrx/design-system";
|
|
@@ -45556,7 +45610,7 @@ function DigestScheduler({
|
|
|
45556
45610
|
setMembers([]);
|
|
45557
45611
|
}
|
|
45558
45612
|
}, [client, tableId, host]);
|
|
45559
|
-
|
|
45613
|
+
useEffect107(() => {
|
|
45560
45614
|
void load();
|
|
45561
45615
|
}, [load]);
|
|
45562
45616
|
const schedule = useMemo72(() => {
|
|
@@ -45814,13 +45868,13 @@ function DigestScheduler({
|
|
|
45814
45868
|
}
|
|
45815
45869
|
|
|
45816
45870
|
// src/SubscriptionsPanel.tsx
|
|
45817
|
-
import { useCallback as useCallback54, useEffect as
|
|
45871
|
+
import { useCallback as useCallback54, useEffect as useEffect109, useState as useState126 } from "react";
|
|
45818
45872
|
import { useRecordsClient as useRecordsClient88 } from "@ai-matrx/records/react";
|
|
45819
45873
|
import { hasQuietHours as hasQuietHours2 } from "@ai-matrx/records";
|
|
45820
45874
|
import { Badge as Badge23, Button as Button95, Skeleton as Skeleton30, Switch as Switch6, cn as cn83 } from "@ai-matrx/design-system";
|
|
45821
45875
|
|
|
45822
45876
|
// src/WebhooksPanel.tsx
|
|
45823
|
-
import { useCallback as useCallback53, useEffect as
|
|
45877
|
+
import { useCallback as useCallback53, useEffect as useEffect108, useState as useState125 } from "react";
|
|
45824
45878
|
import { useRecordsClient as useRecordsClient87, useTable as useTable29 } from "@ai-matrx/records/react";
|
|
45825
45879
|
import { BasicInput as BasicInput27, Button as Button94, Checkbox as Checkbox16, ConfirmDialog as ConfirmDialog7, Label as Label22, Skeleton as Skeleton29, cn as cn82 } from "@ai-matrx/design-system";
|
|
45826
45880
|
import { jsx as jsx149, jsxs as jsxs137 } from "react/jsx-runtime";
|
|
@@ -45866,7 +45920,7 @@ function WebhooksPanel({ tableId, className }) {
|
|
|
45866
45920
|
setError(null);
|
|
45867
45921
|
setHooks(answered.data ?? []);
|
|
45868
45922
|
}, [client, tableId]);
|
|
45869
|
-
|
|
45923
|
+
useEffect108(() => {
|
|
45870
45924
|
void load();
|
|
45871
45925
|
}, [load]);
|
|
45872
45926
|
const declare2 = async () => {
|
|
@@ -46054,7 +46108,7 @@ function SubscriptionsPanel({ tableId, activeRuleId, className }) {
|
|
|
46054
46108
|
setError(null);
|
|
46055
46109
|
setRows(answered.data);
|
|
46056
46110
|
}, [client, tableId]);
|
|
46057
|
-
|
|
46111
|
+
useEffect109(() => {
|
|
46058
46112
|
void load();
|
|
46059
46113
|
}, [load]);
|
|
46060
46114
|
const flip = useCallback54(
|
|
@@ -46246,7 +46300,7 @@ function SubscriptionsPanel({ tableId, activeRuleId, className }) {
|
|
|
46246
46300
|
import { copyText as copyText8 } from "@ai-matrx/kit/clipboard";
|
|
46247
46301
|
import { ErrorBox as ErrorBox7 } from "@ai-matrx/design-system";
|
|
46248
46302
|
import { Select as Select23 } from "@ai-matrx/design-system/controls";
|
|
46249
|
-
import { useCallback as useCallback56, useEffect as
|
|
46303
|
+
import { useCallback as useCallback56, useEffect as useEffect111, useMemo as useMemo74, useRef as useRef61, useState as useState129 } from "react";
|
|
46250
46304
|
import { DndContext as DndContext2, KeyboardSensor, PointerSensor as PointerSensor2, closestCenter as closestCenter2, useSensor as useSensor2, useSensors as useSensors2 } from "@dnd-kit/core";
|
|
46251
46305
|
import { SortableContext as SortableContext2, arrayMove, sortableKeyboardCoordinates, useSortable as useSortable2, verticalListSortingStrategy as verticalListSortingStrategy2 } from "@dnd-kit/sortable";
|
|
46252
46306
|
import { CSS as CSS3 } from "@dnd-kit/utilities";
|
|
@@ -46519,7 +46573,7 @@ function EmbedSnippets({ url, label }) {
|
|
|
46519
46573
|
}
|
|
46520
46574
|
|
|
46521
46575
|
// src/FormRunner.tsx
|
|
46522
|
-
import { useCallback as useCallback55, useEffect as
|
|
46576
|
+
import { useCallback as useCallback55, useEffect as useEffect110, useMemo as useMemo73, useRef as useRef60, useState as useState128 } from "react";
|
|
46523
46577
|
import { useFields as useFields27, useOptionalRecordsClient as useOptionalRecordsClient22 } from "@ai-matrx/records/react";
|
|
46524
46578
|
import { Button as Button97, Label as Label24, Progress, Skeleton as Skeleton31, cn as cn84, formThemeClasses } from "@ai-matrx/design-system";
|
|
46525
46579
|
import { answerRefusal, formRoutes, pipeAnswers, submissionStamp } from "@ai-matrx/records/forms";
|
|
@@ -46637,11 +46691,11 @@ function FormStage({
|
|
|
46637
46691
|
const routes = formRoutes(form);
|
|
46638
46692
|
const [routeKnown, setRouteKnown] = useState128(() => !routes || !whichAsked);
|
|
46639
46693
|
const [stopped, setStopped] = useState128(null);
|
|
46640
|
-
const answersRef =
|
|
46694
|
+
const answersRef = useRef60(answers2);
|
|
46641
46695
|
answersRef.current = answers2;
|
|
46642
46696
|
const choose = autoAdvance ?? form.autoAdvance ?? true;
|
|
46643
|
-
const decoy =
|
|
46644
|
-
const stage =
|
|
46697
|
+
const decoy = useRef60("");
|
|
46698
|
+
const stage = useRef60(null);
|
|
46645
46699
|
const questions = useMemo73(() => {
|
|
46646
46700
|
const byKey = new Map((fields ?? []).map((f) => [f.key, f]));
|
|
46647
46701
|
return (form.questions ?? []).map((q) => {
|
|
@@ -46659,7 +46713,7 @@ function FormStage({
|
|
|
46659
46713
|
};
|
|
46660
46714
|
});
|
|
46661
46715
|
}, [fields, form.questions]);
|
|
46662
|
-
|
|
46716
|
+
useEffect110(() => {
|
|
46663
46717
|
if (!whichAsked) return;
|
|
46664
46718
|
if (!routes) return;
|
|
46665
46719
|
let cancelled = false;
|
|
@@ -46704,19 +46758,19 @@ function FormStage({
|
|
|
46704
46758
|
};
|
|
46705
46759
|
}, [whichAsked, questions, answers2]);
|
|
46706
46760
|
const live = questions.filter((q) => !hidden[q.key]);
|
|
46707
|
-
const told =
|
|
46708
|
-
|
|
46761
|
+
const told = useRef60(answers2);
|
|
46762
|
+
useEffect110(() => {
|
|
46709
46763
|
if (told.current === answers2) return;
|
|
46710
46764
|
told.current = answers2;
|
|
46711
46765
|
onAnswersChange?.(answers2);
|
|
46712
46766
|
}, [answers2, onAnswersChange]);
|
|
46713
|
-
const resumeAt =
|
|
46767
|
+
const resumeAt = useRef60(
|
|
46714
46768
|
resumed && initialAnswers && Object.keys(initialAnswers).length > 0 ? questions.find((q) => {
|
|
46715
46769
|
const v = initialAnswers[q.key];
|
|
46716
46770
|
return v === void 0 || v === null || v === "";
|
|
46717
46771
|
})?.key ?? null : null
|
|
46718
46772
|
);
|
|
46719
|
-
|
|
46773
|
+
useEffect110(() => {
|
|
46720
46774
|
const key = resumeAt.current;
|
|
46721
46775
|
if (!key) return;
|
|
46722
46776
|
const i = live.findIndex((q) => q.key === key);
|
|
@@ -46824,10 +46878,10 @@ function FormStage({
|
|
|
46824
46878
|
if (stillMissing) refuse(stillMissing, refusalFor2(stillMissing));
|
|
46825
46879
|
else void submit();
|
|
46826
46880
|
}
|
|
46827
|
-
const routing =
|
|
46881
|
+
const routing = useRef60(false);
|
|
46828
46882
|
const [routingNow, setRoutingNow] = useState128(false);
|
|
46829
|
-
const typedAhead =
|
|
46830
|
-
|
|
46883
|
+
const typedAhead = useRef60("");
|
|
46884
|
+
useEffect110(() => {
|
|
46831
46885
|
if (!routingNow) return;
|
|
46832
46886
|
const hold = (event) => {
|
|
46833
46887
|
if (!routing.current || event.metaKey || event.ctrlKey || event.altKey || event.isComposing) return;
|
|
@@ -46857,10 +46911,10 @@ function FormStage({
|
|
|
46857
46911
|
}
|
|
46858
46912
|
for (const key of held) target.dispatchEvent(new KeyboardEvent("keydown", { key, bubbles: true, cancelable: true }));
|
|
46859
46913
|
}, [live, at]);
|
|
46860
|
-
|
|
46914
|
+
useEffect110(() => {
|
|
46861
46915
|
if (!routingNow) pourTypedAhead();
|
|
46862
46916
|
}, [routingNow, at, pourTypedAhead]);
|
|
46863
|
-
const advanceRef =
|
|
46917
|
+
const advanceRef = useRef60(advance);
|
|
46864
46918
|
advanceRef.current = advance;
|
|
46865
46919
|
const chosen = useCallback55(() => {
|
|
46866
46920
|
if (!oneAtATime || !choose) return;
|
|
@@ -46882,23 +46936,23 @@ function FormStage({
|
|
|
46882
46936
|
if (event.shiftKey) retreat();
|
|
46883
46937
|
else advance();
|
|
46884
46938
|
}
|
|
46885
|
-
|
|
46939
|
+
useEffect110(() => {
|
|
46886
46940
|
const input = stage.current?.querySelector("[role='radio'][aria-checked='true']") ?? stage.current?.querySelector(
|
|
46887
46941
|
"input:not([tabindex='-1']), textarea, select, [role='combobox'], [role='radio'], [role='checkbox']"
|
|
46888
46942
|
);
|
|
46889
46943
|
input?.focus();
|
|
46890
46944
|
pourTypedAhead();
|
|
46891
46945
|
}, [index, done, started]);
|
|
46892
|
-
const startTold =
|
|
46893
|
-
|
|
46946
|
+
const startTold = useRef60(false);
|
|
46947
|
+
useEffect110(() => {
|
|
46894
46948
|
if (startTold.current || !onStart) return;
|
|
46895
46949
|
if (Object.values(answers2).some((v) => v !== void 0 && v !== null && v !== "")) {
|
|
46896
46950
|
startTold.current = true;
|
|
46897
46951
|
onStart();
|
|
46898
46952
|
}
|
|
46899
46953
|
}, [answers2, onStart]);
|
|
46900
|
-
const shownTold =
|
|
46901
|
-
|
|
46954
|
+
const shownTold = useRef60(/* @__PURE__ */ new Set());
|
|
46955
|
+
useEffect110(() => {
|
|
46902
46956
|
if (!onQuestionShown || !started || done) return;
|
|
46903
46957
|
for (const q of oneAtATime ? current ? [current] : [] : live) {
|
|
46904
46958
|
if (shownTold.current.has(q.key)) continue;
|
|
@@ -47082,7 +47136,7 @@ function ThankYou({
|
|
|
47082
47136
|
const title = rawTitle ? pipe(rawTitle) : rawTitle;
|
|
47083
47137
|
const body = rawBody ? pipe(rawBody) : rawBody;
|
|
47084
47138
|
const going = redirect !== null && done !== "preview";
|
|
47085
|
-
|
|
47139
|
+
useEffect110(() => {
|
|
47086
47140
|
if (!going || !redirect) return;
|
|
47087
47141
|
const timer = window.setTimeout(() => window.location.assign(redirect), REDIRECT_AFTER_MS);
|
|
47088
47142
|
return () => window.clearTimeout(timer);
|
|
@@ -47283,7 +47337,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
|
|
|
47283
47337
|
const [restoredAt, setRestoredAt] = useState129(null);
|
|
47284
47338
|
const [showResults, setShowResults] = useState129(false);
|
|
47285
47339
|
const [adding, setAdding] = useState129(false);
|
|
47286
|
-
const keysBeforeAdd =
|
|
47340
|
+
const keysBeforeAdd = useRef61(null);
|
|
47287
47341
|
const [makeOnMount, setMakeOnMount] = useState129("waiting");
|
|
47288
47342
|
const publicOrigin = host.publicOrigin ?? (typeof window === "undefined" ? "" : window.location.origin);
|
|
47289
47343
|
const load = useCallback56(async () => {
|
|
@@ -47313,10 +47367,10 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
|
|
|
47313
47367
|
setError(null);
|
|
47314
47368
|
setForms(mine);
|
|
47315
47369
|
}, [client, tableId, seed, claimSeed]);
|
|
47316
|
-
|
|
47370
|
+
useEffect111(() => {
|
|
47317
47371
|
void load();
|
|
47318
47372
|
}, [load]);
|
|
47319
|
-
|
|
47373
|
+
useEffect111(() => {
|
|
47320
47374
|
let cancelled = false;
|
|
47321
47375
|
Promise.resolve().then(() => client.formKnobs()).then((r) => {
|
|
47322
47376
|
if (!cancelled && r.ok) setOrgKnobs(r.data);
|
|
@@ -47325,7 +47379,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
|
|
|
47325
47379
|
cancelled = true;
|
|
47326
47380
|
};
|
|
47327
47381
|
}, [client]);
|
|
47328
|
-
|
|
47382
|
+
useEffect111(() => {
|
|
47329
47383
|
if (!forms || forms.length === 0) return;
|
|
47330
47384
|
if (createOnMount && makeOnMount !== "made") return;
|
|
47331
47385
|
const chosen = forms.find((f) => f.id === (activeFormId ?? activeId)) ?? forms[0];
|
|
@@ -47349,7 +47403,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
|
|
|
47349
47403
|
);
|
|
47350
47404
|
const stored = useMemo74(() => draft ? (forms ?? []).find((f) => f.id === draft.id) ?? null : null, [draft, forms]);
|
|
47351
47405
|
const dirty = Boolean(draft && stored && !sameForm(draft, stored));
|
|
47352
|
-
|
|
47406
|
+
useEffect111(() => {
|
|
47353
47407
|
if (!draft || !stored) return;
|
|
47354
47408
|
const timer = window.setTimeout(() => {
|
|
47355
47409
|
if (sameForm(draft, stored)) dropKeptDraft(draft.id);
|
|
@@ -47358,7 +47412,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
|
|
|
47358
47412
|
return () => window.clearTimeout(timer);
|
|
47359
47413
|
}, [draft, stored]);
|
|
47360
47414
|
const lookKey = draft ? JSON.stringify(formLookDocument(draft.look ?? null)) : null;
|
|
47361
|
-
|
|
47415
|
+
useEffect111(() => {
|
|
47362
47416
|
if (lookKey === null) return;
|
|
47363
47417
|
let cancelled = false;
|
|
47364
47418
|
const timer = window.setTimeout(() => {
|
|
@@ -47375,7 +47429,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
|
|
|
47375
47429
|
window.clearTimeout(timer);
|
|
47376
47430
|
};
|
|
47377
47431
|
}, [client, lookKey]);
|
|
47378
|
-
|
|
47432
|
+
useEffect111(() => {
|
|
47379
47433
|
const before = keysBeforeAdd.current;
|
|
47380
47434
|
if (!before || !fields.data) return;
|
|
47381
47435
|
const made = askableFields(fields.data).filter((f) => !before.has(f.key));
|
|
@@ -47486,14 +47540,14 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
|
|
|
47486
47540
|
return true;
|
|
47487
47541
|
}
|
|
47488
47542
|
const [started, setStarted] = useState129(false);
|
|
47489
|
-
|
|
47543
|
+
useEffect111(() => {
|
|
47490
47544
|
if (!startWithOne || started || forms === null || forms.length > 0) return;
|
|
47491
47545
|
if (askableFields(fields.data ?? []).length === 0) return;
|
|
47492
47546
|
if (!table.data && !table.error) return;
|
|
47493
47547
|
setStarted(true);
|
|
47494
47548
|
void create(table.data?.name?.trim() ? `${table.data.name.trim()} form` : "Form 1");
|
|
47495
47549
|
}, [startWithOne, started, forms, fields.data, create, table.data, table.error]);
|
|
47496
|
-
|
|
47550
|
+
useEffect111(() => {
|
|
47497
47551
|
if (!createOnMount || makeOnMount !== "waiting" || forms === null) return;
|
|
47498
47552
|
if (!table.data && !table.error) return;
|
|
47499
47553
|
if (askableFields(fields.data ?? []).length === 0) {
|
|
@@ -48085,8 +48139,8 @@ function NotifyOnAnswer({
|
|
|
48085
48139
|
const [error, setError] = useState129(null);
|
|
48086
48140
|
const [said2, setSaid] = useState129(null);
|
|
48087
48141
|
const [url, setUrl] = useState129(notify?.webhookUrl ?? "");
|
|
48088
|
-
|
|
48089
|
-
|
|
48142
|
+
useEffect111(() => setUrl(notify?.webhookUrl ?? ""), [notify?.webhookUrl]);
|
|
48143
|
+
useEffect111(() => {
|
|
48090
48144
|
let cancelled = false;
|
|
48091
48145
|
void client.subscriptions({ table_id: tableId }).then((r) => {
|
|
48092
48146
|
if (!cancelled && r.ok) setSubs(r.data);
|
|
@@ -48217,7 +48271,7 @@ function NotifyOnAnswer({
|
|
|
48217
48271
|
}
|
|
48218
48272
|
|
|
48219
48273
|
// src/DocTemplate.tsx
|
|
48220
|
-
import { useCallback as useCallback57, useEffect as
|
|
48274
|
+
import { useCallback as useCallback57, useEffect as useEffect112, useState as useState130 } from "react";
|
|
48221
48275
|
import { useFields as useFields29, useRecordsClient as useRecordsClient90, useTable as useTable31 } from "@ai-matrx/records/react";
|
|
48222
48276
|
import { BasicInput as BasicInput30, BasicTextarea as BasicTextarea12, Button as Button99, Label as Label26, Skeleton as Skeleton33, cn as cn86 } from "@ai-matrx/design-system";
|
|
48223
48277
|
import { jsx as jsx154, jsxs as jsxs142 } from "react/jsx-runtime";
|
|
@@ -48265,10 +48319,10 @@ function DocTemplate({ tableId, seed, activeTemplateId, onActiveTemplate, classN
|
|
|
48265
48319
|
setError(null);
|
|
48266
48320
|
setTemplates(rows);
|
|
48267
48321
|
}, [client, tableId, seed, fields.data]);
|
|
48268
|
-
|
|
48322
|
+
useEffect112(() => {
|
|
48269
48323
|
void load();
|
|
48270
48324
|
}, [load]);
|
|
48271
|
-
|
|
48325
|
+
useEffect112(() => {
|
|
48272
48326
|
if (!templates || templates.length === 0) return;
|
|
48273
48327
|
const chosen = templates.find((t) => t.id === (activeTemplateId ?? activeId)) ?? templates[0];
|
|
48274
48328
|
if (chosen.id !== activeId) setActiveId(chosen.id);
|
|
@@ -48276,7 +48330,7 @@ function DocTemplate({ tableId, seed, activeTemplateId, onActiveTemplate, classN
|
|
|
48276
48330
|
setDraftBody(chosen.body);
|
|
48277
48331
|
onActiveTemplate?.(chosen);
|
|
48278
48332
|
}, [templates, activeTemplateId]);
|
|
48279
|
-
|
|
48333
|
+
useEffect112(() => {
|
|
48280
48334
|
let cancelled = false;
|
|
48281
48335
|
if (draftBody.trim() === "") {
|
|
48282
48336
|
setUnresolved([]);
|
|
@@ -48401,7 +48455,7 @@ function DocTemplate({ tableId, seed, activeTemplateId, onActiveTemplate, classN
|
|
|
48401
48455
|
}
|
|
48402
48456
|
|
|
48403
48457
|
// src/DocRender.tsx
|
|
48404
|
-
import { useCallback as useCallback58, useEffect as
|
|
48458
|
+
import { useCallback as useCallback58, useEffect as useEffect113, useRef as useRef62, useState as useState131 } from "react";
|
|
48405
48459
|
import { useRecordsClient as useRecordsClient91 } from "@ai-matrx/records/react";
|
|
48406
48460
|
import { Button as Button100, Skeleton as Skeleton34, cn as cn87 } from "@ai-matrx/design-system";
|
|
48407
48461
|
import { jsx as jsx155, jsxs as jsxs143 } from "react/jsx-runtime";
|
|
@@ -48412,7 +48466,7 @@ function DocRender({ templateId, recordId, filename, onRendered, className }) {
|
|
|
48412
48466
|
const [showing, setShowing] = useState131(null);
|
|
48413
48467
|
const [error, setError] = useState131(null);
|
|
48414
48468
|
const [busy, setBusy] = useState131(null);
|
|
48415
|
-
const paper =
|
|
48469
|
+
const paper = useRef62(null);
|
|
48416
48470
|
const load = useCallback58(async () => {
|
|
48417
48471
|
const [body, held] = await Promise.all([
|
|
48418
48472
|
client.docRenderBody({ template_id: templateId, record_id: recordId }),
|
|
@@ -48430,7 +48484,7 @@ function DocRender({ templateId, recordId, filename, onRendered, className }) {
|
|
|
48430
48484
|
setPreview(body.data);
|
|
48431
48485
|
setRenders(held.data.filter((r) => r.template_id === templateId));
|
|
48432
48486
|
}, [client, templateId, recordId]);
|
|
48433
|
-
|
|
48487
|
+
useEffect113(() => {
|
|
48434
48488
|
void load();
|
|
48435
48489
|
}, [load]);
|
|
48436
48490
|
async function freeze() {
|
|
@@ -48517,7 +48571,7 @@ function DocRender({ templateId, recordId, filename, onRendered, className }) {
|
|
|
48517
48571
|
}
|
|
48518
48572
|
|
|
48519
48573
|
// src/SignBlock.tsx
|
|
48520
|
-
import { useCallback as useCallback59, useEffect as
|
|
48574
|
+
import { useCallback as useCallback59, useEffect as useEffect114, useState as useState132 } from "react";
|
|
48521
48575
|
import { useFields as useFields30, useRecordsClient as useRecordsClient92 } from "@ai-matrx/records/react";
|
|
48522
48576
|
import { BasicInput as BasicInput31, Button as Button101, Skeleton as Skeleton35, cn as cn88 } from "@ai-matrx/design-system";
|
|
48523
48577
|
import { useTable as useTable32 } from "@ai-matrx/records/react";
|
|
@@ -48547,7 +48601,7 @@ function SignBlock({ tableId, recordId, render, className }) {
|
|
|
48547
48601
|
}
|
|
48548
48602
|
setVerdicts(answers2);
|
|
48549
48603
|
}, [client, recordId]);
|
|
48550
|
-
|
|
48604
|
+
useEffect114(() => {
|
|
48551
48605
|
void load();
|
|
48552
48606
|
}, [load]);
|
|
48553
48607
|
async function sign(field2) {
|
|
@@ -48668,7 +48722,7 @@ function SignBlock({ tableId, recordId, render, className }) {
|
|
|
48668
48722
|
}
|
|
48669
48723
|
|
|
48670
48724
|
// src/NotifyRuleEditor.tsx
|
|
48671
|
-
import { useCallback as useCallback60, useEffect as
|
|
48725
|
+
import { useCallback as useCallback60, useEffect as useEffect115, useState as useState133 } from "react";
|
|
48672
48726
|
import { useRecordsClient as useRecordsClient93, useTable as useTable33 } from "@ai-matrx/records/react";
|
|
48673
48727
|
import { hasQuietHours as hasQuietHours3 } from "@ai-matrx/records";
|
|
48674
48728
|
import { Button as Button102, Skeleton as Skeleton36, cn as cn89 } from "@ai-matrx/design-system";
|
|
@@ -48718,7 +48772,7 @@ function NotifyRuleEditor({ tableId, seed, chosenRuleId, onChoose, className })
|
|
|
48718
48772
|
}
|
|
48719
48773
|
setViews(listed.data.map((v) => ({ id: v.view_id, name: v.name })));
|
|
48720
48774
|
}, [client, host, tableId]);
|
|
48721
|
-
|
|
48775
|
+
useEffect115(() => {
|
|
48722
48776
|
void load();
|
|
48723
48777
|
}, [load]);
|
|
48724
48778
|
const write = useCallback60(
|
|
@@ -48746,7 +48800,7 @@ function NotifyRuleEditor({ tableId, seed, chosenRuleId, onChoose, className })
|
|
|
48746
48800
|
},
|
|
48747
48801
|
[client, tableId]
|
|
48748
48802
|
);
|
|
48749
|
-
|
|
48803
|
+
useEffect115(() => {
|
|
48750
48804
|
if (!subscriptions || !seed || seed.length === 0) return;
|
|
48751
48805
|
const missing = seed.filter((s) => !subscriptions.some((held) => held.name === s.name));
|
|
48752
48806
|
if (missing.length === 0) return;
|
|
@@ -48954,7 +49008,7 @@ function NotifyRuleEditor({ tableId, seed, chosenRuleId, onChoose, className })
|
|
|
48954
49008
|
}
|
|
48955
49009
|
|
|
48956
49010
|
// src/DashboardCanvas.tsx
|
|
48957
|
-
import { useCallback as useCallback61, useEffect as
|
|
49011
|
+
import { useCallback as useCallback61, useEffect as useEffect116, useMemo as useMemo76, useState as useState135 } from "react";
|
|
48958
49012
|
import { useFields as useFields32, useRecordsClient as useRecordsClient95, useTable as useTable34 } from "@ai-matrx/records/react";
|
|
48959
49013
|
import {
|
|
48960
49014
|
BasicInput as BasicInput32,
|
|
@@ -49577,10 +49631,10 @@ function DashboardCanvas({ tableId, activeDashboardId, filter, createOnMount, on
|
|
|
49577
49631
|
return read;
|
|
49578
49632
|
}, [client, tableId]);
|
|
49579
49633
|
const [notKept, setNotKept] = useState135(null);
|
|
49580
|
-
|
|
49634
|
+
useEffect116(() => {
|
|
49581
49635
|
void load();
|
|
49582
49636
|
}, [load]);
|
|
49583
|
-
|
|
49637
|
+
useEffect116(() => {
|
|
49584
49638
|
if (!boards || boards.length === 0) return;
|
|
49585
49639
|
if (createOnMount && madeOnMount !== "done") return;
|
|
49586
49640
|
const chosen = boards.find((d) => d.id === (activeDashboardId ?? activeId)) ?? boards[0];
|
|
@@ -49588,7 +49642,7 @@ function DashboardCanvas({ tableId, activeDashboardId, filter, createOnMount, on
|
|
|
49588
49642
|
}, [boards, activeDashboardId, madeOnMount]);
|
|
49589
49643
|
const board = useMemo76(() => boards?.find((d) => d.id === activeId) ?? null, [boards, activeId]);
|
|
49590
49644
|
const filterKey = JSON.stringify(filter ?? {});
|
|
49591
|
-
|
|
49645
|
+
useEffect116(() => {
|
|
49592
49646
|
if (!activeId) {
|
|
49593
49647
|
setRun(null);
|
|
49594
49648
|
return;
|
|
@@ -49658,7 +49712,7 @@ function DashboardCanvas({ tableId, activeDashboardId, filter, createOnMount, on
|
|
|
49658
49712
|
]
|
|
49659
49713
|
);
|
|
49660
49714
|
}
|
|
49661
|
-
|
|
49715
|
+
useEffect116(() => {
|
|
49662
49716
|
if (!createOnMount || madeOnMount !== "waiting" || boards === null || !fields.data) return;
|
|
49663
49717
|
setMadeOnMount("making");
|
|
49664
49718
|
void create().then(() => setMadeOnMount("done"));
|
|
@@ -50113,7 +50167,7 @@ function TargetControl({
|
|
|
50113
50167
|
const [mode, setMode] = useState135(saved);
|
|
50114
50168
|
const savedValue = block.target && "value" in block.target && typeof block.target.value === "number" ? block.target.value : null;
|
|
50115
50169
|
const [draft, setDraft] = useState135(savedValue === null ? "" : String(savedValue));
|
|
50116
|
-
|
|
50170
|
+
useEffect116(() => {
|
|
50117
50171
|
setMode(saved);
|
|
50118
50172
|
setDraft(savedValue === null ? "" : String(savedValue));
|
|
50119
50173
|
}, [saved, savedValue]);
|
|
@@ -50181,7 +50235,7 @@ function TargetControl({
|
|
|
50181
50235
|
|
|
50182
50236
|
// src/QuestionPanel.tsx
|
|
50183
50237
|
import { copyText as copyText9 } from "@ai-matrx/kit/clipboard";
|
|
50184
|
-
import { useEffect as
|
|
50238
|
+
import { useEffect as useEffect117, useMemo as useMemo77, useRef as useRef63, useState as useState136 } from "react";
|
|
50185
50239
|
import { Badge as Badge24, BasicInput as BasicInput33, Button as Button105, Checkbox as Checkbox18, Label as Label27, Skeleton as Skeleton38, cn as cn92 } from "@ai-matrx/design-system";
|
|
50186
50240
|
import { useFields as useFields33, useRecordsClient as useRecordsClient96 } from "@ai-matrx/records/react";
|
|
50187
50241
|
|
|
@@ -50237,7 +50291,7 @@ function QuestionPanel({ tableId, activeQuestionId, draft, className }) {
|
|
|
50237
50291
|
const me = client.config.actor?.user_id ?? null;
|
|
50238
50292
|
const [hidden, setHidden] = useState136(null);
|
|
50239
50293
|
const [related, setRelated] = useState136({});
|
|
50240
|
-
|
|
50294
|
+
useEffect117(() => {
|
|
50241
50295
|
if (all.length === 0) {
|
|
50242
50296
|
if (!fields.loading) setHidden(/* @__PURE__ */ new Set());
|
|
50243
50297
|
return;
|
|
@@ -50270,8 +50324,8 @@ function QuestionPanel({ tableId, activeQuestionId, draft, className }) {
|
|
|
50270
50324
|
const [saveError, setSaveError] = useState136(null);
|
|
50271
50325
|
const [saving, setSaving] = useState136(false);
|
|
50272
50326
|
const [linkMissed, setLinkMissed] = useState136(false);
|
|
50273
|
-
const openedFromLink =
|
|
50274
|
-
|
|
50327
|
+
const openedFromLink = useRef63(false);
|
|
50328
|
+
useEffect117(() => {
|
|
50275
50329
|
let live = true;
|
|
50276
50330
|
void (0, question_exports.questionsOf)(client, tableId).then((answer2) => {
|
|
50277
50331
|
if (!live) return;
|
|
@@ -50294,7 +50348,7 @@ function QuestionPanel({ tableId, activeQuestionId, draft, className }) {
|
|
|
50294
50348
|
setShared(q ? q.shared : true);
|
|
50295
50349
|
setSaveError(null);
|
|
50296
50350
|
};
|
|
50297
|
-
|
|
50351
|
+
useEffect117(() => {
|
|
50298
50352
|
if (!draft) return;
|
|
50299
50353
|
open(null);
|
|
50300
50354
|
setSpec(draft);
|
|
@@ -50303,7 +50357,7 @@ function QuestionPanel({ tableId, activeQuestionId, draft, className }) {
|
|
|
50303
50357
|
const [answer, setAnswer] = useState136(null);
|
|
50304
50358
|
const [asking, setAsking] = useState136(false);
|
|
50305
50359
|
const specKey = JSON.stringify(spec);
|
|
50306
|
-
|
|
50360
|
+
useEffect117(() => {
|
|
50307
50361
|
if (all.length === 0) return;
|
|
50308
50362
|
let live = true;
|
|
50309
50363
|
setAsking(true);
|
|
@@ -50745,7 +50799,7 @@ function QuestionAnswerView({ tableId, spec, answer, fields, related = NO_RELATE
|
|
|
50745
50799
|
}
|
|
50746
50800
|
|
|
50747
50801
|
// src/TableAsk.tsx
|
|
50748
|
-
import { useEffect as
|
|
50802
|
+
import { useEffect as useEffect118, useState as useState137 } from "react";
|
|
50749
50803
|
import { formatPoints as formatPoints2 } from "@ai-matrx/kit/format";
|
|
50750
50804
|
import { BasicInput as BasicInput34, Button as Button106, Popover as Popover18, PopoverContent as PopoverContent18, PopoverTrigger as PopoverTrigger18, Skeleton as Skeleton39 } from "@ai-matrx/design-system";
|
|
50751
50805
|
import { optionLabel as optionLabel4 } from "@ai-matrx/records";
|
|
@@ -51063,7 +51117,7 @@ function useNames(tableId, ids) {
|
|
|
51063
51117
|
const [names2, setNames] = useState137({});
|
|
51064
51118
|
const titleField = table.data?.title_field ?? null;
|
|
51065
51119
|
const key = ids.join("|");
|
|
51066
|
-
|
|
51120
|
+
useEffect118(() => {
|
|
51067
51121
|
let live = true;
|
|
51068
51122
|
void Promise.all(
|
|
51069
51123
|
ids.map(async (id) => {
|
|
@@ -51155,12 +51209,12 @@ function AgentAnswer({
|
|
|
51155
51209
|
}
|
|
51156
51210
|
|
|
51157
51211
|
// src/PageScreen.tsx
|
|
51158
|
-
import { useCallback as useCallback62, useEffect as
|
|
51212
|
+
import { useCallback as useCallback62, useEffect as useEffect120, useMemo as useMemo79, useRef as useRef64, useState as useState139 } from "react";
|
|
51159
51213
|
import { useRecordsClient as useRecordsClient99 } from "@ai-matrx/records/react";
|
|
51160
51214
|
import { BasicInput as BasicInput36, Button as Button109, Skeleton as Skeleton41, cn as cn94 } from "@ai-matrx/design-system";
|
|
51161
51215
|
|
|
51162
51216
|
// src/PageCanvas.tsx
|
|
51163
|
-
import { createContext as createContext10, useContext as useContext10, useEffect as
|
|
51217
|
+
import { createContext as createContext10, useContext as useContext10, useEffect as useEffect119, useMemo as useMemo78, useState as useState138 } from "react";
|
|
51164
51218
|
import {
|
|
51165
51219
|
useFields as useFields35,
|
|
51166
51220
|
useRecordPage as useRecordPage3,
|
|
@@ -51277,7 +51331,7 @@ function useDoorRows(door, elementId, recordId) {
|
|
|
51277
51331
|
error: null
|
|
51278
51332
|
});
|
|
51279
51333
|
const [tick, setTick] = useState138(0);
|
|
51280
|
-
|
|
51334
|
+
useEffect119(() => {
|
|
51281
51335
|
if (!door) return;
|
|
51282
51336
|
let live = true;
|
|
51283
51337
|
setState((s) => ({ ...s, loading: true }));
|
|
@@ -51388,7 +51442,7 @@ function useMemberQuestion(block, viewerUserId, extra, mineOn, enabled = true) {
|
|
|
51388
51442
|
const fields = useFields35(enabled ? block.table_id : null);
|
|
51389
51443
|
const all = useMemo78(() => onePerKey3(fields.data ?? []), [fields.data]);
|
|
51390
51444
|
const [view, setView] = useState138(block.view_id ? "reading" : null);
|
|
51391
|
-
|
|
51445
|
+
useEffect119(() => {
|
|
51392
51446
|
if (!block.view_id || !enabled) {
|
|
51393
51447
|
setView(null);
|
|
51394
51448
|
return;
|
|
@@ -51407,7 +51461,7 @@ function useMemberQuestion(block, viewerUserId, extra, mineOn, enabled = true) {
|
|
|
51407
51461
|
const mine = mineOn || block.me_only === true;
|
|
51408
51462
|
const meField = block.me_field ? all.find((f) => f.key === block.me_field) : void 0;
|
|
51409
51463
|
const [me, setMe] = useState138(null);
|
|
51410
|
-
|
|
51464
|
+
useEffect119(() => {
|
|
51411
51465
|
if (!enabled || !mine || !meField?.relation_target || !viewerUserId) {
|
|
51412
51466
|
setMe(null);
|
|
51413
51467
|
return;
|
|
@@ -51441,7 +51495,7 @@ function useMemberRows(block, viewerUserId, extra, mineOn, enabled) {
|
|
|
51441
51495
|
...q.sort.length > 0 ? { sort: q.sort } : {}
|
|
51442
51496
|
});
|
|
51443
51497
|
const reload = page.reload;
|
|
51444
|
-
|
|
51498
|
+
useEffect119(() => onRecordChanged2(() => reload()), [reload]);
|
|
51445
51499
|
return { q, page };
|
|
51446
51500
|
}
|
|
51447
51501
|
function BlockBody(inner2) {
|
|
@@ -51522,7 +51576,7 @@ function AppletBlockView({ block }) {
|
|
|
51522
51576
|
function AppletPick({ value, onChange }) {
|
|
51523
51577
|
const host = useRecordsUi();
|
|
51524
51578
|
const [options, setOptions] = useState138(null);
|
|
51525
|
-
|
|
51579
|
+
useEffect119(() => {
|
|
51526
51580
|
let live = true;
|
|
51527
51581
|
host.applets?.list().then((apps) => live && setOptions(apps.map((a) => ({ value: a.id, label: a.name })))).catch(() => live && setOptions([]));
|
|
51528
51582
|
return () => {
|
|
@@ -51595,10 +51649,10 @@ function ListBlockView({
|
|
|
51595
51649
|
const { rows, all } = read;
|
|
51596
51650
|
const columns = shownColumns(all, block.columns);
|
|
51597
51651
|
const name = block.title ?? table.data?.name ?? "List";
|
|
51598
|
-
|
|
51652
|
+
useEffect119(() => onRows(rows), [rows, onRows]);
|
|
51599
51653
|
const firstId = rows[0]?.id ?? null;
|
|
51600
51654
|
const stillThere = selected !== null && rows.some((r) => r.id === selected);
|
|
51601
|
-
|
|
51655
|
+
useEffect119(() => {
|
|
51602
51656
|
if (read.loading || read.waiting) return;
|
|
51603
51657
|
if (!stillThere) onSelect(firstId);
|
|
51604
51658
|
}, [firstId, stillThere, read.loading, read.waiting]);
|
|
@@ -51862,7 +51916,7 @@ function ActionButton2({ block, recordId }) {
|
|
|
51862
51916
|
const [running, setRunning] = useState138(false);
|
|
51863
51917
|
const [done, setDone] = useState138(null);
|
|
51864
51918
|
const [error, setError] = useState138(null);
|
|
51865
|
-
|
|
51919
|
+
useEffect119(() => {
|
|
51866
51920
|
setDone(null);
|
|
51867
51921
|
setError(null);
|
|
51868
51922
|
setAsking(false);
|
|
@@ -51903,7 +51957,7 @@ function FormBlockView({ block }) {
|
|
|
51903
51957
|
const client = useRecordsClient98();
|
|
51904
51958
|
const [form, setForm] = useState138("reading");
|
|
51905
51959
|
const [sent, setSent] = useState138(0);
|
|
51906
|
-
|
|
51960
|
+
useEffect119(() => {
|
|
51907
51961
|
if (!block.form_id) {
|
|
51908
51962
|
setForm(null);
|
|
51909
51963
|
return;
|
|
@@ -52036,7 +52090,7 @@ function ScopeSettings({
|
|
|
52036
52090
|
const [views, setViews] = useState138([]);
|
|
52037
52091
|
const fields = useFields35(block.table_id);
|
|
52038
52092
|
const all = onePerKey3(fields.data ?? []);
|
|
52039
|
-
|
|
52093
|
+
useEffect119(() => {
|
|
52040
52094
|
let live = true;
|
|
52041
52095
|
void client.views({ table_id: block.table_id }).then((answered) => {
|
|
52042
52096
|
if (live) setViews(answered.ok ? answered.data : []);
|
|
@@ -52186,7 +52240,7 @@ function ListSettings({ block, onChange }) {
|
|
|
52186
52240
|
const [views, setViews] = useState138([]);
|
|
52187
52241
|
const fields = useFields35(block.table_id);
|
|
52188
52242
|
const all = onePerKey3(fields.data ?? []);
|
|
52189
|
-
|
|
52243
|
+
useEffect119(() => {
|
|
52190
52244
|
let live = true;
|
|
52191
52245
|
void client.views({ table_id: block.table_id }).then((answered) => {
|
|
52192
52246
|
if (live) setViews(answered.ok ? answered.data : []);
|
|
@@ -52269,7 +52323,7 @@ function ActionPicker({ tableId, value, onChange }) {
|
|
|
52269
52323
|
function FormPicker({ tableId, value, onChange }) {
|
|
52270
52324
|
const client = useRecordsClient98();
|
|
52271
52325
|
const [forms, setForms] = useState138([]);
|
|
52272
|
-
|
|
52326
|
+
useEffect119(() => {
|
|
52273
52327
|
let live = true;
|
|
52274
52328
|
void client.forms({ table_id: tableId }).then((answered) => {
|
|
52275
52329
|
if (live) setForms(answered.ok ? answered.data : []);
|
|
@@ -52355,7 +52409,7 @@ function PageScreen({
|
|
|
52355
52409
|
const [run, setRun] = useState139(null);
|
|
52356
52410
|
const [saveError, setSaveError] = useState139(null);
|
|
52357
52411
|
const [askingToArchive, setAskingToArchive] = useState139(false);
|
|
52358
|
-
const canvas =
|
|
52412
|
+
const canvas = useRef64(null);
|
|
52359
52413
|
const [making, setMaking] = useState139("waiting");
|
|
52360
52414
|
const id = page?.id ?? pageId ?? null;
|
|
52361
52415
|
const load = useCallback62(
|
|
@@ -52377,7 +52431,7 @@ function PageScreen({
|
|
|
52377
52431
|
},
|
|
52378
52432
|
[client]
|
|
52379
52433
|
);
|
|
52380
|
-
|
|
52434
|
+
useEffect120(() => {
|
|
52381
52435
|
if (!newOnTable || pageId || making !== "waiting") return;
|
|
52382
52436
|
setMaking("making");
|
|
52383
52437
|
void client.dashboardDeclare({
|
|
@@ -52397,11 +52451,11 @@ function PageScreen({
|
|
|
52397
52451
|
onCreated?.(made.data);
|
|
52398
52452
|
});
|
|
52399
52453
|
}, [client, newOnTable, pageId, making, load, onCreated]);
|
|
52400
|
-
|
|
52454
|
+
useEffect120(() => {
|
|
52401
52455
|
if (!pageId) return;
|
|
52402
52456
|
void load(pageId);
|
|
52403
52457
|
}, [pageId, load]);
|
|
52404
|
-
|
|
52458
|
+
useEffect120(() => {
|
|
52405
52459
|
if (!id) return;
|
|
52406
52460
|
let live = true;
|
|
52407
52461
|
void client.myLevels({ ids: [id], subject: "record" }).then((answered) => {
|
|
@@ -52413,7 +52467,7 @@ function PageScreen({
|
|
|
52413
52467
|
}, [client, id]);
|
|
52414
52468
|
const canEdit = level !== null && EDIT_LEVELS.has(level);
|
|
52415
52469
|
const chartKey = page ? JSON.stringify(page.blocks.map((b) => b.id)) + page.version : "";
|
|
52416
|
-
|
|
52470
|
+
useEffect120(() => {
|
|
52417
52471
|
if (!page || page.blocks.length === 0) {
|
|
52418
52472
|
setRun(null);
|
|
52419
52473
|
return;
|
|
@@ -52556,7 +52610,7 @@ function PageScreen({
|
|
|
52556
52610
|
}
|
|
52557
52611
|
|
|
52558
52612
|
// src/InterfaceScreen.tsx
|
|
52559
|
-
import { useCallback as useCallback63, useEffect as
|
|
52613
|
+
import { useCallback as useCallback63, useEffect as useEffect121, useMemo as useMemo80, useRef as useRef65, useState as useState140 } from "react";
|
|
52560
52614
|
import { useRecordsClient as useRecordsClient100 } from "@ai-matrx/records/react";
|
|
52561
52615
|
import { BasicInput as BasicInput37, Button as Button110, Skeleton as Skeleton42, cn as cn95 } from "@ai-matrx/design-system";
|
|
52562
52616
|
import { Fragment as Fragment68, jsx as jsx166, jsxs as jsxs154 } from "react/jsx-runtime";
|
|
@@ -52593,7 +52647,7 @@ function InterfaceScreen({
|
|
|
52593
52647
|
const [making, setMaking] = useState140("waiting");
|
|
52594
52648
|
const [askingToArchive, setAskingToArchive] = useState140(false);
|
|
52595
52649
|
const [localPage, setLocalPage] = useState140(null);
|
|
52596
|
-
const canvas =
|
|
52650
|
+
const canvas = useRef65(null);
|
|
52597
52651
|
const load = useCallback63(
|
|
52598
52652
|
async (want) => {
|
|
52599
52653
|
const answered = await client.interfaceRead({ interface_id: want });
|
|
@@ -52610,10 +52664,10 @@ function InterfaceScreen({
|
|
|
52610
52664
|
},
|
|
52611
52665
|
[client]
|
|
52612
52666
|
);
|
|
52613
|
-
|
|
52667
|
+
useEffect121(() => {
|
|
52614
52668
|
if (interfaceId) void load(interfaceId);
|
|
52615
52669
|
}, [interfaceId, load]);
|
|
52616
|
-
|
|
52670
|
+
useEffect121(() => {
|
|
52617
52671
|
if (!newOnTable || interfaceId || making !== "waiting") return;
|
|
52618
52672
|
setMaking("making");
|
|
52619
52673
|
const shape2 = newInterfaceShape(newOnTable);
|
|
@@ -52636,7 +52690,7 @@ function InterfaceScreen({
|
|
|
52636
52690
|
const charts = useMemo80(() => shape ? interfaceCharts(shape) : [], [shape]);
|
|
52637
52691
|
const through = !!read && !read.member;
|
|
52638
52692
|
const chartKey = read ? `${read.id}:${read.version}:${charts.length}` : "";
|
|
52639
|
-
|
|
52693
|
+
useEffect121(() => {
|
|
52640
52694
|
if (!read || through || charts.length === 0) {
|
|
52641
52695
|
setRun(null);
|
|
52642
52696
|
return;
|
|
@@ -52870,7 +52924,7 @@ function InterfaceScreen({
|
|
|
52870
52924
|
|
|
52871
52925
|
// src/FormsPanel.tsx
|
|
52872
52926
|
import { copyText as copyText10 } from "@ai-matrx/kit/clipboard";
|
|
52873
|
-
import { useCallback as useCallback64, useEffect as
|
|
52927
|
+
import { useCallback as useCallback64, useEffect as useEffect122, useState as useState141 } from "react";
|
|
52874
52928
|
import { useRecordsClient as useRecordsClient101, useTable as useTable37 } from "@ai-matrx/records/react";
|
|
52875
52929
|
import { publicFormPath as publicFormPath2 } from "@ai-matrx/records";
|
|
52876
52930
|
import { Badge as Badge25, Button as Button111, Skeleton as Skeleton43, cn as cn96 } from "@ai-matrx/design-system";
|
|
@@ -52896,7 +52950,7 @@ function FormsPanel({ tableId, activeFormId, className }) {
|
|
|
52896
52950
|
const [archivedSaid, setArchivedSaid] = useState141(null);
|
|
52897
52951
|
const linked = activeFormId && forms !== null ? forms.find((f) => f.form_id === activeFormId) ?? null : null;
|
|
52898
52952
|
const linkedMissing = Boolean(activeFormId) && forms !== null && linked === null;
|
|
52899
|
-
|
|
52953
|
+
useEffect122(() => {
|
|
52900
52954
|
if (linked && rights.structure) setBuilding(true);
|
|
52901
52955
|
}, [linked, rights.structure]);
|
|
52902
52956
|
const load = useCallback64(async () => {
|
|
@@ -52909,7 +52963,7 @@ function FormsPanel({ tableId, activeFormId, className }) {
|
|
|
52909
52963
|
setError(null);
|
|
52910
52964
|
setForms(answered.data);
|
|
52911
52965
|
}, [client, tableId]);
|
|
52912
|
-
|
|
52966
|
+
useEffect122(() => {
|
|
52913
52967
|
void load();
|
|
52914
52968
|
}, [load]);
|
|
52915
52969
|
const toggle = useCallback64(
|
|
@@ -53054,12 +53108,12 @@ function FormsPanel({ tableId, activeFormId, className }) {
|
|
|
53054
53108
|
}
|
|
53055
53109
|
|
|
53056
53110
|
// src/CaptureSheet.tsx
|
|
53057
|
-
import { useCallback as useCallback66, useEffect as
|
|
53111
|
+
import { useCallback as useCallback66, useEffect as useEffect124, useRef as useRef67, useState as useState143 } from "react";
|
|
53058
53112
|
import { useFields as useFields36, useRecordsClient as useRecordsClient103, useTable as useTable38 } from "@ai-matrx/records/react";
|
|
53059
53113
|
import { Button as Button113, Input as Input9, Skeleton as Skeleton45, Textarea as Textarea8, cn as cn98 } from "@ai-matrx/design-system";
|
|
53060
53114
|
|
|
53061
53115
|
// src/CaptureRun.tsx
|
|
53062
|
-
import { useCallback as useCallback65, useEffect as
|
|
53116
|
+
import { useCallback as useCallback65, useEffect as useEffect123, useMemo as useMemo81, useRef as useRef66, useState as useState142 } from "react";
|
|
53063
53117
|
import {
|
|
53064
53118
|
coerceTypedAnswer as coerceTypedAnswer3,
|
|
53065
53119
|
coercionLabel,
|
|
@@ -53117,8 +53171,8 @@ function CaptureRun({ sheetId, face: given, className }) {
|
|
|
53117
53171
|
const [items, setItems] = useState142([]);
|
|
53118
53172
|
const [lastSynced, setLastSynced] = useState142(null);
|
|
53119
53173
|
const [sending, setSending] = useState142(false);
|
|
53120
|
-
const queueRef =
|
|
53121
|
-
|
|
53174
|
+
const queueRef = useRef66(null);
|
|
53175
|
+
useEffect123(() => {
|
|
53122
53176
|
const q2 = openCaptureQueue({
|
|
53123
53177
|
onChange: (c, all) => {
|
|
53124
53178
|
setCounts(c);
|
|
@@ -53156,7 +53210,7 @@ function CaptureRun({ sheetId, face: given, className }) {
|
|
|
53156
53210
|
void q2.sync().then(() => void q2.lastSyncedAt().then(setLastSynced));
|
|
53157
53211
|
return () => q2.dispose();
|
|
53158
53212
|
}, [client, host]);
|
|
53159
|
-
|
|
53213
|
+
useEffect123(() => {
|
|
53160
53214
|
if (given !== void 0) return;
|
|
53161
53215
|
let cancelled = false;
|
|
53162
53216
|
void client.captureOpen({ sheet_id: sheetId }).then((res) => {
|
|
@@ -53497,7 +53551,7 @@ function AdHocCaptureSheet({
|
|
|
53497
53551
|
const [error, setError] = useState143(null);
|
|
53498
53552
|
const [uploadError, setUploadError] = useState143(null);
|
|
53499
53553
|
const [flushing, setFlushing] = useState143(false);
|
|
53500
|
-
const queue =
|
|
53554
|
+
const queue = useRef67([]);
|
|
53501
53555
|
const keep = useCallback66(
|
|
53502
53556
|
async (next) => {
|
|
53503
53557
|
queue.current = next;
|
|
@@ -53506,7 +53560,7 @@ function AdHocCaptureSheet({
|
|
|
53506
53560
|
},
|
|
53507
53561
|
[host]
|
|
53508
53562
|
);
|
|
53509
|
-
|
|
53563
|
+
useEffect124(() => {
|
|
53510
53564
|
let cancelled = false;
|
|
53511
53565
|
void (async () => {
|
|
53512
53566
|
const held = host.captureQueue ? await host.captureQueue.load() : [];
|
|
@@ -53685,7 +53739,7 @@ function AdHocCaptureSheet({
|
|
|
53685
53739
|
}
|
|
53686
53740
|
|
|
53687
53741
|
// src/PortalShell.tsx
|
|
53688
|
-
import { useCallback as useCallback67, useEffect as
|
|
53742
|
+
import { useCallback as useCallback67, useEffect as useEffect125, useState as useState144 } from "react";
|
|
53689
53743
|
import { useRecordsClient as useRecordsClient104 } from "@ai-matrx/records/react";
|
|
53690
53744
|
import { Button as Button114, Skeleton as Skeleton46, cn as cn99 } from "@ai-matrx/design-system";
|
|
53691
53745
|
import { jsx as jsx170, jsxs as jsxs158 } from "react/jsx-runtime";
|
|
@@ -53711,7 +53765,7 @@ function PortalShell({ tableId, form, resourceType = "record", className }) {
|
|
|
53711
53765
|
}
|
|
53712
53766
|
setReach(reached.data.map((row) => row.resource_id));
|
|
53713
53767
|
}, [client, resourceType]);
|
|
53714
|
-
|
|
53768
|
+
useEffect125(() => {
|
|
53715
53769
|
void load();
|
|
53716
53770
|
}, [load]);
|
|
53717
53771
|
if (error) {
|
|
@@ -53771,7 +53825,7 @@ function PortalShell({ tableId, form, resourceType = "record", className }) {
|
|
|
53771
53825
|
function PortalRow({ tableId, recordId }) {
|
|
53772
53826
|
const client = useRecordsClient104();
|
|
53773
53827
|
const [title, setTitle] = useState144(null);
|
|
53774
|
-
|
|
53828
|
+
useEffect125(() => {
|
|
53775
53829
|
let cancelled = false;
|
|
53776
53830
|
void client.recordRead({ record_id: recordId }).then((answered) => {
|
|
53777
53831
|
if (cancelled) return;
|
|
@@ -53791,7 +53845,7 @@ function PortalRow({ tableId, recordId }) {
|
|
|
53791
53845
|
}
|
|
53792
53846
|
|
|
53793
53847
|
// src/PublicViewPage.tsx
|
|
53794
|
-
import { useCallback as useCallback68, useEffect as
|
|
53848
|
+
import { useCallback as useCallback68, useEffect as useEffect126, useState as useState145 } from "react";
|
|
53795
53849
|
import { useRecordsClient as useRecordsClient105 } from "@ai-matrx/records/react";
|
|
53796
53850
|
import { Skeleton as Skeleton47, cn as cn100 } from "@ai-matrx/design-system";
|
|
53797
53851
|
import { publicReadOf } from "@ai-matrx/records/forms";
|
|
@@ -53854,7 +53908,7 @@ function PublicViewPage({ slug, className }) {
|
|
|
53854
53908
|
}
|
|
53855
53909
|
setRows([{ id: chosen.recordId, document: read.data.document, level: "viewer", hidden: read.data.hidden }]);
|
|
53856
53910
|
}, [client, slug]);
|
|
53857
|
-
|
|
53911
|
+
useEffect126(() => {
|
|
53858
53912
|
void load();
|
|
53859
53913
|
}, [load]);
|
|
53860
53914
|
if (error) return /* @__PURE__ */ jsx171(RefusalNotice, { error, className });
|
|
@@ -53892,7 +53946,7 @@ function PublicRow({ row, fields }) {
|
|
|
53892
53946
|
|
|
53893
53947
|
// src/EmbedFrame.tsx
|
|
53894
53948
|
import { copyText as copyText11 } from "@ai-matrx/kit/clipboard";
|
|
53895
|
-
import { useCallback as useCallback69, useEffect as
|
|
53949
|
+
import { useCallback as useCallback69, useEffect as useEffect127, useState as useState146 } from "react";
|
|
53896
53950
|
import { useRecordsClient as useRecordsClient106 } from "@ai-matrx/records/react";
|
|
53897
53951
|
import { Button as Button115, Input as Input10, Skeleton as Skeleton48, Textarea as Textarea9, cn as cn101 } from "@ai-matrx/design-system";
|
|
53898
53952
|
import { useTable as useTable39 } from "@ai-matrx/records/react";
|
|
@@ -54005,7 +54059,7 @@ function useEmbedHandshake(args) {
|
|
|
54005
54059
|
const [loading, setLoading] = useState146(true);
|
|
54006
54060
|
const origin = args.origin ?? (typeof location === "undefined" ? "" : location.origin);
|
|
54007
54061
|
const { secret, requiredMode } = args;
|
|
54008
|
-
|
|
54062
|
+
useEffect127(() => {
|
|
54009
54063
|
let cancelled = false;
|
|
54010
54064
|
setLoading(true);
|
|
54011
54065
|
setError(null);
|
|
@@ -54028,7 +54082,7 @@ function useEmbedHandshake(args) {
|
|
|
54028
54082
|
|
|
54029
54083
|
// src/TablePage.tsx
|
|
54030
54084
|
import { copyText as copyText15 } from "@ai-matrx/kit/clipboard";
|
|
54031
|
-
import { useCallback as useCallback71, useEffect as
|
|
54085
|
+
import { useCallback as useCallback71, useEffect as useEffect131, useMemo as useMemo85, useRef as useRef68, useState as useState155 } from "react";
|
|
54032
54086
|
import { archivedByLine as archivedByLine2 } from "@ai-matrx/records";
|
|
54033
54087
|
import { tableShapeChanged as tableShapeChanged15, useFields as useFields39, useRecordsClient as useRecordsClient108, useSeededAnswer, useTable as useTable40, useTableArchive as useTableArchive2 } from "@ai-matrx/records/react";
|
|
54034
54088
|
import {
|
|
@@ -54293,7 +54347,7 @@ async function runTablePageAction(kind2, args) {
|
|
|
54293
54347
|
}
|
|
54294
54348
|
|
|
54295
54349
|
// src/GridShortcutsHelp.tsx
|
|
54296
|
-
import { useEffect as
|
|
54350
|
+
import { useEffect as useEffect128, useState as useState148 } from "react";
|
|
54297
54351
|
import { Dialog as Dialog19, DialogContent as DialogContent19, DialogHeader as DialogHeader19, DialogTitle as DialogTitle19 } from "@ai-matrx/design-system";
|
|
54298
54352
|
|
|
54299
54353
|
// src/gridShortcuts.ts
|
|
@@ -54363,7 +54417,7 @@ function asksShortcutHelp(event) {
|
|
|
54363
54417
|
}
|
|
54364
54418
|
function GridShortcutsHelp() {
|
|
54365
54419
|
const [open, setOpen] = useState148(false);
|
|
54366
|
-
|
|
54420
|
+
useEffect128(() => {
|
|
54367
54421
|
const onKey = (event) => {
|
|
54368
54422
|
if (!asksShortcutHelp(event)) return;
|
|
54369
54423
|
event.preventDefault();
|
|
@@ -54739,7 +54793,7 @@ function TableDuplicateDialog({ tableId, name, organizationId, open, onOpenChang
|
|
|
54739
54793
|
}
|
|
54740
54794
|
|
|
54741
54795
|
// src/ViewFilter.tsx
|
|
54742
|
-
import { useEffect as
|
|
54796
|
+
import { useEffect as useEffect129, useMemo as useMemo84, useState as useState153 } from "react";
|
|
54743
54797
|
import { Button as Button121, Popover as Popover19, PopoverContent as PopoverContent19, PopoverTrigger as PopoverTrigger19 } from "@ai-matrx/design-system";
|
|
54744
54798
|
import { useFields as useFields38, useOptionalRecordsClient as useOptionalRecordsClient23 } from "@ai-matrx/records/react";
|
|
54745
54799
|
import { jsx as jsx179, jsxs as jsxs167 } from "react/jsx-runtime";
|
|
@@ -54757,7 +54811,7 @@ function ViewFilter({ tableId, view, onApply, className }) {
|
|
|
54757
54811
|
const saved = view?.where ?? null;
|
|
54758
54812
|
const [draft, setDraft] = useState153(saved);
|
|
54759
54813
|
const savedKey = JSON.stringify(saved);
|
|
54760
|
-
|
|
54814
|
+
useEffect129(() => {
|
|
54761
54815
|
setDraft(saved);
|
|
54762
54816
|
}, [view?.id, savedKey]);
|
|
54763
54817
|
const client = useOptionalRecordsClient23();
|
|
@@ -54766,7 +54820,7 @@ function ViewFilter({ tableId, view, onApply, className }) {
|
|
|
54766
54820
|
[fields.data]
|
|
54767
54821
|
);
|
|
54768
54822
|
const [linkedFields, setLinkedFields] = useState153({});
|
|
54769
|
-
|
|
54823
|
+
useEffect129(() => {
|
|
54770
54824
|
if (!open || !client) return;
|
|
54771
54825
|
let cancelled = false;
|
|
54772
54826
|
for (const rel of relations) {
|
|
@@ -54961,7 +55015,7 @@ function phoneTableActions(actions) {
|
|
|
54961
55015
|
}
|
|
54962
55016
|
|
|
54963
55017
|
// src/toolbarFit.ts
|
|
54964
|
-
import { useEffect as
|
|
55018
|
+
import { useEffect as useEffect130, useLayoutEffect as useLayoutEffect6, useState as useState154 } from "react";
|
|
54965
55019
|
function widthAtFold(piece, fold) {
|
|
54966
55020
|
for (let f = Math.min(fold, (piece.byFold?.length ?? 0) - 1); f >= 0; f -= 1) {
|
|
54967
55021
|
const w = piece.byFold?.[f];
|
|
@@ -55052,7 +55106,7 @@ function createFitMemory() {
|
|
|
55052
55106
|
}
|
|
55053
55107
|
};
|
|
55054
55108
|
}
|
|
55055
|
-
var useIsoLayoutEffect = typeof window === "undefined" ?
|
|
55109
|
+
var useIsoLayoutEffect = typeof window === "undefined" ? useEffect130 : useLayoutEffect6;
|
|
55056
55110
|
function useToolbarFit(row) {
|
|
55057
55111
|
const [fold, setFold] = useState154(0);
|
|
55058
55112
|
useIsoLayoutEffect(() => {
|
|
@@ -55129,7 +55183,7 @@ function clippedEnds(scrollLeft, clientWidth, scrollWidth) {
|
|
|
55129
55183
|
}
|
|
55130
55184
|
function useSlotScroll(slot) {
|
|
55131
55185
|
const [ends, setEnds] = useState154("none");
|
|
55132
|
-
|
|
55186
|
+
useEffect130(() => {
|
|
55133
55187
|
if (!slot) return;
|
|
55134
55188
|
let pending = 0;
|
|
55135
55189
|
const read = () => {
|
|
@@ -55267,7 +55321,7 @@ function TableNotHere({
|
|
|
55267
55321
|
const [archived, setArchived] = useState155({ phase: "asking" });
|
|
55268
55322
|
const [restoring, setRestoring] = useState155(false);
|
|
55269
55323
|
const [refusal3, setRefusal] = useState155(null);
|
|
55270
|
-
|
|
55324
|
+
useEffect131(() => {
|
|
55271
55325
|
let alive = true;
|
|
55272
55326
|
void client.tableArchived({ table_id: tableId }).then((answered) => {
|
|
55273
55327
|
if (!alive) return;
|
|
@@ -55489,8 +55543,8 @@ function TablePage({
|
|
|
55489
55543
|
return seededViews.find((v) => v.id === asked4) ?? defaultViewOf(seededViews) ?? seededViews[0];
|
|
55490
55544
|
});
|
|
55491
55545
|
const [looks, setLooks] = useState155(() => seededViews ? seededOpening?.looks : void 0);
|
|
55492
|
-
const looksSeededFor =
|
|
55493
|
-
|
|
55546
|
+
const looksSeededFor = useRef68(seededViews && seededOpening ? tableId : null);
|
|
55547
|
+
useEffect131(() => {
|
|
55494
55548
|
if (looksSeededFor.current === tableId) {
|
|
55495
55549
|
looksSeededFor.current = null;
|
|
55496
55550
|
return;
|
|
@@ -55516,7 +55570,7 @@ function TablePage({
|
|
|
55516
55570
|
const opened = questionsFromLink ? { ...openedByPackage, main: "questions" } : openedByPackage;
|
|
55517
55571
|
const [views, setViews] = useState155(() => seededViews);
|
|
55518
55572
|
const [pickedViewId, setPickedViewId] = useState155(savedFromLink);
|
|
55519
|
-
const viewSeen =
|
|
55573
|
+
const viewSeen = useRef68(null);
|
|
55520
55574
|
const [viewLinkMissed, setViewLinkMissed] = useState155(false);
|
|
55521
55575
|
const railAsked = typeof activeRail === "string" ? activeRail.trim() : "";
|
|
55522
55576
|
const railUnknown = railAsked !== "" && railFromParam(railAsked) === null ? railAsked : null;
|
|
@@ -55539,7 +55593,7 @@ function TablePage({
|
|
|
55539
55593
|
const { open: renameOpen, setOpen: setRenameOpen, ask: askRename, menuContentProps: renameMenuProps } = useRenameFromMenu();
|
|
55540
55594
|
const [archiveAsked, setArchiveAsked] = useState155(0);
|
|
55541
55595
|
const pageArchive = useTableArchive2(tableId);
|
|
55542
|
-
const archiveRunning =
|
|
55596
|
+
const archiveRunning = useRef68(false);
|
|
55543
55597
|
const archiveFromMenu = useCallback71(async () => {
|
|
55544
55598
|
if (archiveRunning.current) return;
|
|
55545
55599
|
archiveRunning.current = true;
|
|
@@ -55602,7 +55656,7 @@ function TablePage({
|
|
|
55602
55656
|
const skeletonFace = skeletonLayoutFor(
|
|
55603
55657
|
faceUnknown && !layoutFromLink ? rememberedFace ?? shownLayout : shownLayout
|
|
55604
55658
|
);
|
|
55605
|
-
|
|
55659
|
+
useEffect131(() => {
|
|
55606
55660
|
if (embedded || faceUnknown || main !== "records" || opened.layout || !table.data) return;
|
|
55607
55661
|
rememberLayout(tableId, shownLayout);
|
|
55608
55662
|
}, [embedded, faceUnknown, main, shownLayout, tableId, table.data !== void 0]);
|
|
@@ -55620,9 +55674,9 @@ function TablePage({
|
|
|
55620
55674
|
lookDiffers: view ? lookDiffers(view, look) : false
|
|
55621
55675
|
};
|
|
55622
55676
|
const shownSignature = JSON.stringify(shownReport);
|
|
55623
|
-
const reportRef =
|
|
55677
|
+
const reportRef = useRef68(onShownViewChange);
|
|
55624
55678
|
reportRef.current = onShownViewChange;
|
|
55625
|
-
|
|
55679
|
+
useEffect131(() => {
|
|
55626
55680
|
reportRef.current?.(JSON.parse(shownSignature));
|
|
55627
55681
|
}, [shownSignature]);
|
|
55628
55682
|
const pickLayout = (next) => {
|
|
@@ -55631,9 +55685,9 @@ function TablePage({
|
|
|
55631
55685
|
onViewChanged?.(addressForView(view, next));
|
|
55632
55686
|
void patchView({ layout: next });
|
|
55633
55687
|
};
|
|
55634
|
-
const reportedRecords =
|
|
55635
|
-
const lastActiveRecord =
|
|
55636
|
-
|
|
55688
|
+
const reportedRecords = useRef68(/* @__PURE__ */ new Set());
|
|
55689
|
+
const lastActiveRecord = useRef68(activeRecordId ?? null);
|
|
55690
|
+
useEffect131(() => {
|
|
55637
55691
|
const before = lastActiveRecord.current;
|
|
55638
55692
|
lastActiveRecord.current = activeRecordId ?? null;
|
|
55639
55693
|
if (!activeRecordId) {
|
|
@@ -55651,21 +55705,21 @@ function TablePage({
|
|
|
55651
55705
|
);
|
|
55652
55706
|
const [recordExpanded, setRecordExpanded] = useState155(false);
|
|
55653
55707
|
const shownRecord = rail === "record" ? openRecord : null;
|
|
55654
|
-
const reportedRecord =
|
|
55655
|
-
|
|
55708
|
+
const reportedRecord = useRef68(activeRecordId ?? null);
|
|
55709
|
+
useEffect131(() => {
|
|
55656
55710
|
if (shownRecord === reportedRecord.current) return;
|
|
55657
55711
|
const how = shownRecord === null ? "close" : reportedRecord.current === null ? "open" : "step";
|
|
55658
55712
|
reportedRecord.current = shownRecord;
|
|
55659
55713
|
if (shownRecord) reportedRecords.current.add(shownRecord);
|
|
55660
55714
|
onRecordChange?.(shownRecord, how);
|
|
55661
55715
|
}, [shownRecord, onRecordChange]);
|
|
55662
|
-
|
|
55716
|
+
useEffect131(() => {
|
|
55663
55717
|
if (activeRecordId) return;
|
|
55664
55718
|
const named = railFromParam(activeRail);
|
|
55665
55719
|
if (named === null || named === "share") return;
|
|
55666
55720
|
setSurface((now) => ({ ...now, rail: named }));
|
|
55667
55721
|
}, [activeRail, activeRecordId]);
|
|
55668
|
-
|
|
55722
|
+
useEffect131(() => {
|
|
55669
55723
|
const named = pageViewFromParam(activeView);
|
|
55670
55724
|
if (named === null) return;
|
|
55671
55725
|
const isLayout = named !== "dashboards" && named !== "archived";
|
|
@@ -55706,7 +55760,7 @@ function TablePage({
|
|
|
55706
55760
|
},
|
|
55707
55761
|
[client, tableId, view, looks, viewLocked, sayLocked]
|
|
55708
55762
|
);
|
|
55709
|
-
const arrival =
|
|
55763
|
+
const arrival = useRef68(viewAddress ?? null);
|
|
55710
55764
|
const [gridQuery, setGridQuery] = useState155(null);
|
|
55711
55765
|
const [addressResetEpoch, setAddressResetEpoch] = useState155(0);
|
|
55712
55766
|
const reportGrid = useCallback71((q) => {
|
|
@@ -55717,8 +55771,8 @@ function TablePage({
|
|
|
55717
55771
|
() => ({ initial: arrival.current, report: reportGrid, resetEpoch: addressResetEpoch }),
|
|
55718
55772
|
[reportGrid, addressResetEpoch]
|
|
55719
55773
|
);
|
|
55720
|
-
const hiddenApplied =
|
|
55721
|
-
|
|
55774
|
+
const hiddenApplied = useRef68(false);
|
|
55775
|
+
useEffect131(() => {
|
|
55722
55776
|
const hidden = arrival.current?.hidden;
|
|
55723
55777
|
if (hiddenApplied.current || !view || !looks || !hidden || hidden.length === 0) return;
|
|
55724
55778
|
hiddenApplied.current = true;
|
|
@@ -55738,10 +55792,10 @@ function TablePage({
|
|
|
55738
55792
|
const gridPending = !isViewAddressEmpty({ ...arrival.current ?? {}, hidden: [] });
|
|
55739
55793
|
const addressReady = Boolean(view && looks) && (gridQuery !== null || !gridPending);
|
|
55740
55794
|
const addressSignature = JSON.stringify(viewAddressToParams(addressNow));
|
|
55741
|
-
const addressReportRef =
|
|
55795
|
+
const addressReportRef = useRef68(onViewAddressChange);
|
|
55742
55796
|
addressReportRef.current = onViewAddressChange;
|
|
55743
|
-
const addressSent =
|
|
55744
|
-
|
|
55797
|
+
const addressSent = useRef68(null);
|
|
55798
|
+
useEffect131(() => {
|
|
55745
55799
|
if (!addressReady) return;
|
|
55746
55800
|
if (addressSent.current === null && addressSignature === JSON.stringify(viewAddressToParams(arrival.current))) {
|
|
55747
55801
|
addressSent.current = addressSignature;
|
|
@@ -56056,14 +56110,14 @@ function TablePage({
|
|
|
56056
56110
|
}
|
|
56057
56111
|
});
|
|
56058
56112
|
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;
|
|
56059
|
-
const actionsRef =
|
|
56113
|
+
const actionsRef = useRef68(actions);
|
|
56060
56114
|
actionsRef.current = actions;
|
|
56061
|
-
const onActionsRef =
|
|
56115
|
+
const onActionsRef = useRef68(onActions);
|
|
56062
56116
|
onActionsRef.current = onActions;
|
|
56063
|
-
|
|
56117
|
+
useEffect131(() => {
|
|
56064
56118
|
onActionsRef.current?.(actionsRef.current);
|
|
56065
56119
|
});
|
|
56066
|
-
|
|
56120
|
+
useEffect131(() => {
|
|
56067
56121
|
const onKey = (event) => {
|
|
56068
56122
|
const asked4 = objectActionForKey(actionsRef.current, event);
|
|
56069
56123
|
if (!asked4) return;
|
|
@@ -56648,7 +56702,7 @@ function usePublicReadOnly(client, organizationId, tableId, table, rights) {
|
|
|
56648
56702
|
const readOnly = rights.known && rights.read && !rights.write;
|
|
56649
56703
|
const marked = table?.published_to_web;
|
|
56650
56704
|
const [isPublic, setIsPublic] = useState155(false);
|
|
56651
|
-
|
|
56705
|
+
useEffect131(() => {
|
|
56652
56706
|
if (!readOnly || !table) {
|
|
56653
56707
|
setIsPublic(false);
|
|
56654
56708
|
return;
|
|
@@ -56674,7 +56728,7 @@ function usePublicReadOnly(client, organizationId, tableId, table, rights) {
|
|
|
56674
56728
|
import { formatCount as formatCount8 } from "@ai-matrx/kit/format";
|
|
56675
56729
|
import { TapTargetSearchGroup as TapTargetSearchGroup2, TooltipProvider } from "@ai-matrx/design-system";
|
|
56676
56730
|
import { MatrxTableCardShowMore as MatrxTableCardShowMore3 } from "@ai-matrx/design-system/data-table";
|
|
56677
|
-
import { useEffect as
|
|
56731
|
+
import { useEffect as useEffect132, useMemo as useMemo86, useRef as useRef69, useState as useState156 } from "react";
|
|
56678
56732
|
import { Button as Button123, ErrorBox as ErrorBox9, Input as Input13, cn as cn104 } from "@ai-matrx/design-system";
|
|
56679
56733
|
import { SEED_FRESH_MS, useRecordsClient as useRecordsClient109, useSeededAnswerAt } from "@ai-matrx/records/react";
|
|
56680
56734
|
import { Fragment as Fragment76, jsx as jsx182, jsxs as jsxs170 } from "react/jsx-runtime";
|
|
@@ -56781,8 +56835,8 @@ function EntityChartBlock({ source, kind: kind2, by, measure, title, where, orga
|
|
|
56781
56835
|
const base2 = { title: title ?? "", kind: kind2, measures, group_by: by ? [by] : [] };
|
|
56782
56836
|
const seeded = useSeededAnswerAt(`entity-chart:${ask2}`, (c) => c.drillAsk({ source, question }));
|
|
56783
56837
|
const [block, setBlock] = useState156(() => seeded ? blockOfAnswer({ ok: true, data: seeded.data }, base2, by) : null);
|
|
56784
|
-
const seededFor =
|
|
56785
|
-
|
|
56838
|
+
const seededFor = useRef69(seeded ? { ask: `${ask2}|${kind2}|${title ?? ""}`, at: seeded.at } : null);
|
|
56839
|
+
useEffect132(() => {
|
|
56786
56840
|
const held = seededFor.current;
|
|
56787
56841
|
if (held && held.ask === `${ask2}|${kind2}|${title ?? ""}` && Date.now() - held.at < SEED_FRESH_MS) return;
|
|
56788
56842
|
seededFor.current = null;
|
|
@@ -56831,7 +56885,7 @@ function EntityTablePageBody({
|
|
|
56831
56885
|
const term = searchOverride ?? typed2;
|
|
56832
56886
|
const entity = useEntityTable(source.token, { pageSize, search: term });
|
|
56833
56887
|
const [layout, setLayout] = useState156(opened);
|
|
56834
|
-
|
|
56888
|
+
useEffect132(() => setLayout(opened), [opened]);
|
|
56835
56889
|
const choose = (next) => {
|
|
56836
56890
|
setLayout(next);
|
|
56837
56891
|
onLayoutChange?.(next);
|
|
@@ -56957,7 +57011,7 @@ function TablePage2(props) {
|
|
|
56957
57011
|
}
|
|
56958
57012
|
|
|
56959
57013
|
// src/DataBindingPicker.tsx
|
|
56960
|
-
import { useEffect as
|
|
57014
|
+
import { useEffect as useEffect133, useMemo as useMemo87 } from "react";
|
|
56961
57015
|
import { isEntityReferenceConfig } from "@ai-matrx/records";
|
|
56962
57016
|
import { useFields as useFields40, useTable as useTable41 } from "@ai-matrx/records/react";
|
|
56963
57017
|
import { BasicInput as BasicInput38, Button as Button124, CreatablePicker as CreatablePicker3, cn as cn105 } from "@ai-matrx/design-system";
|
|
@@ -57053,7 +57107,7 @@ function BindingDetails({
|
|
|
57053
57107
|
const fields = useFields40(tableId);
|
|
57054
57108
|
const fieldList = useMemo87(() => fields.data ?? [], [fields.data]);
|
|
57055
57109
|
const shape = binding.semantic_type;
|
|
57056
|
-
|
|
57110
|
+
useEffect133(() => {
|
|
57057
57111
|
if (disabled || shape === "value" || binding.transform || fields.loading || fieldList.length === 0) return;
|
|
57058
57112
|
onChange({
|
|
57059
57113
|
...binding,
|
|
@@ -57275,7 +57329,7 @@ function RecordNameWords({ tableId, recordId }) {
|
|
|
57275
57329
|
}
|
|
57276
57330
|
|
|
57277
57331
|
// src/HeldChangeDecision.tsx
|
|
57278
|
-
import { useEffect as
|
|
57332
|
+
import { useEffect as useEffect134, useState as useState157 } from "react";
|
|
57279
57333
|
import { RecordsProvider as RecordsProvider3, useRecordsClient as useRecordsClient110 } from "@ai-matrx/records/react";
|
|
57280
57334
|
import { Button as Button125 } from "@ai-matrx/design-system";
|
|
57281
57335
|
import { jsx as jsx186, jsxs as jsxs173 } from "react/jsx-runtime";
|
|
@@ -57291,7 +57345,7 @@ function Decision({
|
|
|
57291
57345
|
const [may, setMay] = useState157(null);
|
|
57292
57346
|
const [busy, setBusy] = useState157(null);
|
|
57293
57347
|
const [error, setError] = useState157(null);
|
|
57294
|
-
|
|
57348
|
+
useEffect134(() => {
|
|
57295
57349
|
let live = true;
|
|
57296
57350
|
void client.workApprovalMayDecide({ approval_id: approvalId }).then((res) => {
|
|
57297
57351
|
if (!live) return;
|
|
@@ -57324,7 +57378,7 @@ function Decision({
|
|
|
57324
57378
|
}
|
|
57325
57379
|
|
|
57326
57380
|
// src/CalendarLinks.tsx
|
|
57327
|
-
import { useCallback as useCallback72, useEffect as
|
|
57381
|
+
import { useCallback as useCallback72, useEffect as useEffect135, useState as useState158 } from "react";
|
|
57328
57382
|
import { Button as Button126 } from "@ai-matrx/design-system";
|
|
57329
57383
|
import { jsx as jsx187, jsxs as jsxs174 } from "react/jsx-runtime";
|
|
57330
57384
|
var day = (iso) => iso ? new Date(iso).toLocaleDateString(void 0, { year: "numeric", month: "short", day: "numeric" }) : null;
|
|
@@ -57340,7 +57394,7 @@ function CalendarLinks({ port }) {
|
|
|
57340
57394
|
setError(asRefusal3(e, "The links could not be read"));
|
|
57341
57395
|
}
|
|
57342
57396
|
}, [port]);
|
|
57343
|
-
|
|
57397
|
+
useEffect135(() => {
|
|
57344
57398
|
void load();
|
|
57345
57399
|
}, [load]);
|
|
57346
57400
|
const act = async (run) => {
|
|
@@ -57405,7 +57459,7 @@ function CalendarLinks({ port }) {
|
|
|
57405
57459
|
}
|
|
57406
57460
|
|
|
57407
57461
|
// src/TemplatePreview.tsx
|
|
57408
|
-
import { useEffect as
|
|
57462
|
+
import { useEffect as useEffect136, useMemo as useMemo88, useState as useState159 } from "react";
|
|
57409
57463
|
import { templatePreview } from "@ai-matrx/records/memory";
|
|
57410
57464
|
import { useRecordsClient as useRecordsClient111 } from "@ai-matrx/records/react";
|
|
57411
57465
|
import { formFromSummary as formFromSummary3 } from "@ai-matrx/records/forms";
|
|
@@ -57457,7 +57511,7 @@ function PreviewForms({ preview, booking }) {
|
|
|
57457
57511
|
const client = useRecordsClient111();
|
|
57458
57512
|
const [forms, setForms] = useState159(null);
|
|
57459
57513
|
const [pages, setPages] = useState159([]);
|
|
57460
|
-
|
|
57514
|
+
useEffect136(() => {
|
|
57461
57515
|
let gone = false;
|
|
57462
57516
|
void client.forms().then((answered) => {
|
|
57463
57517
|
if (!gone) setForms(answered.ok ? answered.data.map(formFromSummary3) : []);
|