@ai-matrx/records-ui 0.116.44 → 0.116.46
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 +36 -1
- package/dist/{SaveToTable-EGBEB5WG.js → SaveToTable-SWB2ZN5X.js} +3 -3
- package/dist/{chunk-CV4D2BZY.js → chunk-UTMV5ES2.js} +5 -5
- package/dist/{chunk-CV4D2BZY.js.map → chunk-UTMV5ES2.js.map} +1 -1
- package/dist/{chunk-KP2R7LVO.js → chunk-Y5QOV3XA.js} +79 -76
- package/dist/chunk-Y5QOV3XA.js.map +1 -0
- package/dist/{chunk-KEILC5XG.js → chunk-ZUQUZOL5.js} +43 -20
- package/dist/chunk-ZUQUZOL5.js.map +1 -0
- package/dist/helpers.cjs +6 -4
- package/dist/helpers.cjs.map +1 -1
- package/dist/helpers.js +6 -4
- package/dist/helpers.js.map +1 -1
- package/dist/index.cjs +2392 -2332
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +240 -210
- package/dist/index.js.map +1 -1
- package/dist/pickers.cjs +565 -538
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +2 -2
- package/package.json +2 -2
- package/dist/chunk-KEILC5XG.js.map +0 -1
- package/dist/chunk-KP2R7LVO.js.map +0 -1
- /package/dist/{SaveToTable-EGBEB5WG.js.map → SaveToTable-SWB2ZN5X.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -182,7 +182,7 @@ import {
|
|
|
182
182
|
withoutAddition,
|
|
183
183
|
withoutLeadingBlank,
|
|
184
184
|
workedOutErrorFor
|
|
185
|
-
} from "./chunk-
|
|
185
|
+
} from "./chunk-Y5QOV3XA.js";
|
|
186
186
|
import {
|
|
187
187
|
CHART_PLOT_PX,
|
|
188
188
|
EMBEDDED_ROW_PX,
|
|
@@ -293,7 +293,7 @@ import {
|
|
|
293
293
|
visibilityLaneFor,
|
|
294
294
|
whyNotAskable,
|
|
295
295
|
writeOnTheWinningVersion_exports
|
|
296
|
-
} from "./chunk-
|
|
296
|
+
} from "./chunk-UTMV5ES2.js";
|
|
297
297
|
import {
|
|
298
298
|
ACTION_CHECKING_ACCESS_REASON,
|
|
299
299
|
ACTION_NOT_HERE_REASON,
|
|
@@ -384,7 +384,9 @@ import {
|
|
|
384
384
|
recordVersions_exports,
|
|
385
385
|
refusalForAPerson,
|
|
386
386
|
refusalLineForAPerson,
|
|
387
|
+
refusalSaid,
|
|
387
388
|
refusalSentence,
|
|
389
|
+
refusalTimedOut,
|
|
388
390
|
refusals_exports,
|
|
389
391
|
rowName,
|
|
390
392
|
rowNameIn,
|
|
@@ -400,7 +402,7 @@ import {
|
|
|
400
402
|
useRowRights,
|
|
401
403
|
useTableRights,
|
|
402
404
|
withoutInternalCodes
|
|
403
|
-
} from "./chunk-
|
|
405
|
+
} from "./chunk-ZUQUZOL5.js";
|
|
404
406
|
import {
|
|
405
407
|
FEWEST_KEY_VALUE_PAIRS,
|
|
406
408
|
FEWEST_LIST_ITEMS,
|
|
@@ -11770,6 +11772,7 @@ function BulkActions({
|
|
|
11770
11772
|
noun,
|
|
11771
11773
|
nounPlural,
|
|
11772
11774
|
titleKey = null,
|
|
11775
|
+
mayWrite = true,
|
|
11773
11776
|
onDone
|
|
11774
11777
|
}) {
|
|
11775
11778
|
const typeable = useMemo24(() => fields.filter(fieldIsEditable), [fields]);
|
|
@@ -11793,12 +11796,12 @@ function BulkActions({
|
|
|
11793
11796
|
if (ok) onDone();
|
|
11794
11797
|
};
|
|
11795
11798
|
return /* @__PURE__ */ jsxs36(Fragment14, { children: [
|
|
11796
|
-
typeable.length > 0 ? /* @__PURE__ */ jsxs36(Fragment14, { children: [
|
|
11799
|
+
mayWrite && typeable.length > 0 ? /* @__PURE__ */ jsxs36(Fragment14, { children: [
|
|
11797
11800
|
/* @__PURE__ */ jsx40(Button30, { size: "sm", variant: "outline", className: "h-7 px-2", "data-records-bulk": "set", disabled: bulk.busy, onClick: () => open("set"), children: "Set a column" }),
|
|
11798
11801
|
/* @__PURE__ */ jsx40(Button30, { size: "sm", variant: "outline", className: "h-7 px-2", "data-records-bulk": "clear", disabled: bulk.busy, onClick: () => open("clear"), children: "Clear a column" }),
|
|
11799
11802
|
ids.length > 1 ? /* @__PURE__ */ jsx40(Button30, { size: "sm", variant: "outline", className: "h-7 px-2", "data-records-bulk": "fill", disabled: bulk.busy, onClick: () => open("fill"), children: "Fill down" }) : null
|
|
11800
11803
|
] }) : null,
|
|
11801
|
-
/* @__PURE__ */ jsx40(
|
|
11804
|
+
mayWrite ? /* @__PURE__ */ jsx40(
|
|
11802
11805
|
Button30,
|
|
11803
11806
|
{
|
|
11804
11807
|
size: "sm",
|
|
@@ -11809,9 +11812,9 @@ function BulkActions({
|
|
|
11809
11812
|
onClick: () => void bulk.duplicate(ids).then((ok) => ok ? onDone() : void 0),
|
|
11810
11813
|
children: "Duplicate"
|
|
11811
11814
|
}
|
|
11812
|
-
),
|
|
11815
|
+
) : null,
|
|
11813
11816
|
/* @__PURE__ */ jsx40(Button30, { size: "sm", variant: "outline", className: "h-7 px-2", "data-records-bulk": "print", disabled: bulk.busy, onClick: () => setPrinting(true), children: "Print with layout\u2026" }),
|
|
11814
|
-
/* @__PURE__ */ jsx40(Button30, { size: "sm", variant: "outline", className: "h-7 px-2", "data-records-bulk": "delete", disabled: bulk.busy, onClick: () => setConfirmDelete(true), children: "Delete" }),
|
|
11817
|
+
mayWrite ? /* @__PURE__ */ jsx40(Button30, { size: "sm", variant: "outline", className: "h-7 px-2", "data-records-bulk": "delete", disabled: bulk.busy, onClick: () => setConfirmDelete(true), children: "Delete" }) : null,
|
|
11815
11818
|
printing ? /* @__PURE__ */ jsx40(PrintWithLayoutDialog, { tableId, recordIds: ids, names: printNames(ids, rows, titleKey), open: true, onOpenChange: setPrinting }) : null,
|
|
11816
11819
|
/* @__PURE__ */ jsx40(Dialog14, { open: asking !== null, onOpenChange: (next) => !next ? setAsking(null) : void 0, children: /* @__PURE__ */ jsxs36(DialogContent14, { className: "sm:max-w-md", children: [
|
|
11817
11820
|
/* @__PURE__ */ jsxs36(DialogHeader14, { children: [
|
|
@@ -12781,7 +12784,7 @@ function GridBody({
|
|
|
12781
12784
|
versions
|
|
12782
12785
|
});
|
|
12783
12786
|
const [selectedIds, setSelectedIds] = useState41([]);
|
|
12784
|
-
const offerSelection = !embedded && !readOnly &&
|
|
12787
|
+
const offerSelection = !embedded && !readOnly && (merged || canWrite && tableActions2.runnable.length > 0);
|
|
12785
12788
|
const [reordering, setReordering] = useState41(false);
|
|
12786
12789
|
const chosenSummaries = localSummaries ?? presentation.summaries ?? NO_SUMMARIES;
|
|
12787
12790
|
const summaryVersion = useMemo26(
|
|
@@ -14397,10 +14400,11 @@ function GridBody({
|
|
|
14397
14400
|
noun,
|
|
14398
14401
|
nounPlural,
|
|
14399
14402
|
titleKey,
|
|
14403
|
+
mayWrite: canWrite,
|
|
14400
14404
|
onDone: () => setSelectedIds([])
|
|
14401
14405
|
}
|
|
14402
14406
|
) : null,
|
|
14403
|
-
tableActions2.runnable.map((action2) => /* @__PURE__ */ jsx44(
|
|
14407
|
+
canWrite ? tableActions2.runnable.map((action2) => /* @__PURE__ */ jsx44(
|
|
14404
14408
|
ActionButton,
|
|
14405
14409
|
{
|
|
14406
14410
|
action: action2,
|
|
@@ -14409,7 +14413,7 @@ function GridBody({
|
|
|
14409
14413
|
onPress: () => runner.press(action2, ids)
|
|
14410
14414
|
},
|
|
14411
14415
|
action2.id
|
|
14412
|
-
))
|
|
14416
|
+
)) : null
|
|
14413
14417
|
] })
|
|
14414
14418
|
}
|
|
14415
14419
|
} : embedded ? { selection: false } : {},
|
|
@@ -18078,7 +18082,7 @@ function ConnectedRecordsTableCard({
|
|
|
18078
18082
|
// src/ExportMenu.tsx
|
|
18079
18083
|
import { copyText as copyText4 } from "@ai-matrx/kit/clipboard";
|
|
18080
18084
|
import { downloadFile } from "@ai-matrx/kit/download";
|
|
18081
|
-
import { useEffect as useEffect48, useState as useState56 } from "react";
|
|
18085
|
+
import { useEffect as useEffect48, useRef as useRef28, useState as useState56 } from "react";
|
|
18082
18086
|
import { useFields as useFields17, useRecords as useRecords4, useRecordsClient as useRecordsClient48, useTable as useTable18 } from "@ai-matrx/records/react";
|
|
18083
18087
|
import { exportCsv, exportMarkdown, exportXlsx, wholeValueOf as wholeValueOf4, withWholeValues } from "@ai-matrx/records/core";
|
|
18084
18088
|
|
|
@@ -18205,6 +18209,7 @@ function ExportMenu({ tableId, rows, label, className, view }) {
|
|
|
18205
18209
|
}, [client, tableId, fields.data, viewKey]);
|
|
18206
18210
|
const viewHeld = viewRead && viewRead.key === viewKey ? viewRead : null;
|
|
18207
18211
|
const [failure, setFailure] = useState56(null);
|
|
18212
|
+
const lastPressed = useRef28(null);
|
|
18208
18213
|
const labels = useRecordLabels(fields.data ?? void 0);
|
|
18209
18214
|
const records = rows ?? (view ? viewHeld && "rows" in viewHeld ? viewHeld.rows : [] : page.data?.rows ?? []);
|
|
18210
18215
|
const columns = view && fields.data ? viewColumns(fields.data, view.presentation) : fields.data ?? [];
|
|
@@ -18225,104 +18230,114 @@ function ExportMenu({ tableId, rows, label, className, view }) {
|
|
|
18225
18230
|
{ id: "copy-json", label: "Copy JSON", word: "JSON", suffix: "", copy: true, write: exportJson },
|
|
18226
18231
|
{ id: "copy-full-schema", label: "Copy full schema", word: "full schema", suffix: "", copy: true, write: (c, r) => exportFullSchema({ name: tableName2, settings }, c, r) }
|
|
18227
18232
|
];
|
|
18228
|
-
return /* @__PURE__ */ jsxs56(
|
|
18229
|
-
|
|
18230
|
-
|
|
18231
|
-
|
|
18232
|
-
|
|
18233
|
-
|
|
18234
|
-
|
|
18235
|
-
|
|
18233
|
+
return /* @__PURE__ */ jsxs56(
|
|
18234
|
+
"div",
|
|
18235
|
+
{
|
|
18236
|
+
className: cn24("flex items-center gap-1", className),
|
|
18237
|
+
onClickCapture: (event) => {
|
|
18238
|
+
const pressed = event.target.closest("button");
|
|
18239
|
+
if (pressed && !pressed.hasAttribute("data-refusal-retry")) lastPressed.current = pressed;
|
|
18240
|
+
},
|
|
18241
|
+
children: [
|
|
18242
|
+
/* @__PURE__ */ jsx62(
|
|
18243
|
+
Button48,
|
|
18244
|
+
{
|
|
18245
|
+
size: "sm",
|
|
18246
|
+
variant: "outline",
|
|
18247
|
+
onClick: () => void exported().then((rows2) => download(`${name}.csv`, "text/csv;charset=utf-8", exportCsv(columns, rows2))).catch(
|
|
18248
|
+
(thrown) => setFailure((0, refusals_exports.refusalFromThrown)(thrown, "The CSV could not be written.", "Try again in a moment."))
|
|
18249
|
+
),
|
|
18250
|
+
children: "CSV"
|
|
18251
|
+
}
|
|
18236
18252
|
),
|
|
18237
|
-
|
|
18238
|
-
|
|
18239
|
-
|
|
18240
|
-
|
|
18241
|
-
|
|
18242
|
-
|
|
18243
|
-
|
|
18244
|
-
|
|
18245
|
-
|
|
18246
|
-
|
|
18247
|
-
|
|
18248
|
-
|
|
18249
|
-
|
|
18250
|
-
|
|
18251
|
-
|
|
18252
|
-
|
|
18253
|
-
|
|
18254
|
-
|
|
18255
|
-
|
|
18256
|
-
|
|
18257
|
-
|
|
18258
|
-
|
|
18259
|
-
|
|
18260
|
-
|
|
18261
|
-
|
|
18262
|
-
|
|
18263
|
-
|
|
18253
|
+
/* @__PURE__ */ jsx62(
|
|
18254
|
+
Button48,
|
|
18255
|
+
{
|
|
18256
|
+
size: "sm",
|
|
18257
|
+
variant: "outline",
|
|
18258
|
+
onClick: () => {
|
|
18259
|
+
const failed = (thrown) => setFailure(
|
|
18260
|
+
(0, refusals_exports.refusalFromThrown)(
|
|
18261
|
+
thrown,
|
|
18262
|
+
"The spreadsheet could not be written.",
|
|
18263
|
+
"The CSV beside this button carries the same rows."
|
|
18264
|
+
)
|
|
18265
|
+
);
|
|
18266
|
+
setFailure(null);
|
|
18267
|
+
try {
|
|
18268
|
+
exported().then((rows2) => exportXlsx(columns, rows2, name)).then(
|
|
18269
|
+
(bytes) => download(
|
|
18270
|
+
`${name}.xlsx`,
|
|
18271
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
18272
|
+
bytes
|
|
18273
|
+
)
|
|
18274
|
+
).catch(failed);
|
|
18275
|
+
} catch (thrown) {
|
|
18276
|
+
failed(thrown);
|
|
18277
|
+
}
|
|
18278
|
+
},
|
|
18279
|
+
children: "XLSX"
|
|
18264
18280
|
}
|
|
18265
|
-
},
|
|
18266
|
-
children: "XLSX"
|
|
18267
|
-
}
|
|
18268
|
-
),
|
|
18269
|
-
/* @__PURE__ */ jsx62(
|
|
18270
|
-
Button48,
|
|
18271
|
-
{
|
|
18272
|
-
size: "sm",
|
|
18273
|
-
variant: "outline",
|
|
18274
|
-
onClick: () => void exported().then((rows2) => download(`${name}.md`, "text/markdown;charset=utf-8", exportMarkdown(columns, rows2))).catch(
|
|
18275
|
-
(thrown) => setFailure((0, refusals_exports.refusalFromThrown)(thrown, "The Markdown could not be written.", "The CSV beside this button carries the same rows."))
|
|
18276
18281
|
),
|
|
18277
|
-
|
|
18278
|
-
|
|
18279
|
-
|
|
18280
|
-
|
|
18281
|
-
|
|
18282
|
-
|
|
18283
|
-
|
|
18284
|
-
|
|
18285
|
-
|
|
18286
|
-
|
|
18287
|
-
else host.notify?.error("Couldn\u2019t copy the Markdown");
|
|
18288
|
-
}).catch(
|
|
18289
|
-
(thrown) => setFailure((0, refusals_exports.refusalFromThrown)(thrown, "The Markdown could not be written.", "The CSV beside this button carries the same rows."))
|
|
18282
|
+
/* @__PURE__ */ jsx62(
|
|
18283
|
+
Button48,
|
|
18284
|
+
{
|
|
18285
|
+
size: "sm",
|
|
18286
|
+
variant: "outline",
|
|
18287
|
+
onClick: () => void exported().then((rows2) => download(`${name}.md`, "text/markdown;charset=utf-8", exportMarkdown(columns, rows2))).catch(
|
|
18288
|
+
(thrown) => setFailure((0, refusals_exports.refusalFromThrown)(thrown, "The Markdown could not be written.", "The CSV beside this button carries the same rows."))
|
|
18289
|
+
),
|
|
18290
|
+
children: "Markdown"
|
|
18291
|
+
}
|
|
18290
18292
|
),
|
|
18291
|
-
|
|
18292
|
-
|
|
18293
|
-
|
|
18294
|
-
|
|
18295
|
-
|
|
18296
|
-
|
|
18297
|
-
|
|
18298
|
-
|
|
18299
|
-
|
|
18300
|
-
|
|
18301
|
-
|
|
18302
|
-
|
|
18303
|
-
|
|
18304
|
-
else host.notify?.error(`Couldn\u2019t copy the ${kind2.word}`);
|
|
18305
|
-
} else download(`${name}${kind2.suffix}`, "application/json;charset=utf-8", text);
|
|
18306
|
-
}).catch(
|
|
18307
|
-
(thrown) => setFailure((0, refusals_exports.refusalFromThrown)(thrown, `The ${kind2.word} could not be written.`, "The CSV beside this button carries the same rows."))
|
|
18293
|
+
/* @__PURE__ */ jsx62(
|
|
18294
|
+
Button48,
|
|
18295
|
+
{
|
|
18296
|
+
size: "sm",
|
|
18297
|
+
variant: "outline",
|
|
18298
|
+
onClick: () => void exported().then(async (rows2) => {
|
|
18299
|
+
if (await copyText4(exportMarkdown(columns, rows2))) host.notify?.success("Markdown copied");
|
|
18300
|
+
else host.notify?.error("Couldn\u2019t copy the Markdown");
|
|
18301
|
+
}).catch(
|
|
18302
|
+
(thrown) => setFailure((0, refusals_exports.refusalFromThrown)(thrown, "The Markdown could not be written.", "The CSV beside this button carries the same rows."))
|
|
18303
|
+
),
|
|
18304
|
+
children: "Copy Markdown"
|
|
18305
|
+
}
|
|
18308
18306
|
),
|
|
18309
|
-
|
|
18310
|
-
|
|
18311
|
-
|
|
18312
|
-
|
|
18313
|
-
|
|
18314
|
-
|
|
18315
|
-
|
|
18316
|
-
|
|
18317
|
-
|
|
18318
|
-
|
|
18319
|
-
|
|
18320
|
-
|
|
18321
|
-
|
|
18322
|
-
|
|
18323
|
-
|
|
18324
|
-
|
|
18325
|
-
|
|
18307
|
+
JSON_FILES.map((kind2) => /* @__PURE__ */ jsx62(
|
|
18308
|
+
Button48,
|
|
18309
|
+
{
|
|
18310
|
+
size: "sm",
|
|
18311
|
+
variant: "outline",
|
|
18312
|
+
"data-records-export": kind2.id,
|
|
18313
|
+
onClick: () => void exported().then(async (rows2) => {
|
|
18314
|
+
const text = kind2.write(columns, rows2);
|
|
18315
|
+
if (kind2.copy) {
|
|
18316
|
+
if (await copyText4(text)) host.notify?.success(`${kind2.word} copied`);
|
|
18317
|
+
else host.notify?.error(`Couldn\u2019t copy the ${kind2.word}`);
|
|
18318
|
+
} else download(`${name}${kind2.suffix}`, "application/json;charset=utf-8", text);
|
|
18319
|
+
}).catch(
|
|
18320
|
+
(thrown) => setFailure((0, refusals_exports.refusalFromThrown)(thrown, `The ${kind2.word} could not be written.`, "The CSV beside this button carries the same rows."))
|
|
18321
|
+
),
|
|
18322
|
+
children: kind2.label
|
|
18323
|
+
},
|
|
18324
|
+
kind2.id
|
|
18325
|
+
)),
|
|
18326
|
+
/* @__PURE__ */ jsx62(
|
|
18327
|
+
AlchemyMenu2,
|
|
18328
|
+
{
|
|
18329
|
+
label: name,
|
|
18330
|
+
sourceId: `records:${tableId}`,
|
|
18331
|
+
size: "xs",
|
|
18332
|
+
json: () => records.map((r) => r.document),
|
|
18333
|
+
human: () => exportCsv(columns, toRows(columns, records, labels))
|
|
18334
|
+
}
|
|
18335
|
+
),
|
|
18336
|
+
viewHeld && "rows" in viewHeld && viewHeld.cut ? /* @__PURE__ */ jsx62("span", { className: "text-xs text-muted-foreground", children: cutWords(viewHeld.rows.length) }) : null,
|
|
18337
|
+
failure ? /* @__PURE__ */ jsx62(RefusalLine, { error: failure, onRetry: () => lastPressed.current?.click() }) : null
|
|
18338
|
+
]
|
|
18339
|
+
}
|
|
18340
|
+
);
|
|
18326
18341
|
}
|
|
18327
18342
|
|
|
18328
18343
|
// src/ImportNotice.tsx
|
|
@@ -18717,7 +18732,7 @@ function Clause({
|
|
|
18717
18732
|
}
|
|
18718
18733
|
|
|
18719
18734
|
// src/TableRename.tsx
|
|
18720
|
-
import { useCallback as useCallback31, useEffect as useEffect51, useRef as
|
|
18735
|
+
import { useCallback as useCallback31, useEffect as useEffect51, useRef as useRef29, useState as useState59 } from "react";
|
|
18721
18736
|
import { tableShapeChanged as tableShapeChanged5, useRecordsClient as useRecordsClient51 } from "@ai-matrx/records/react";
|
|
18722
18737
|
import {
|
|
18723
18738
|
Button as Button51,
|
|
@@ -18739,7 +18754,7 @@ function tableNameProblem(typed2) {
|
|
|
18739
18754
|
}
|
|
18740
18755
|
function useRenameFromMenu() {
|
|
18741
18756
|
const [open, setOpen] = useState59(false);
|
|
18742
|
-
const asked2 =
|
|
18757
|
+
const asked2 = useRef29(false);
|
|
18743
18758
|
const ask2 = useCallback31(() => {
|
|
18744
18759
|
asked2.current = true;
|
|
18745
18760
|
window.setTimeout(() => setOpen(true), 0);
|
|
@@ -18765,8 +18780,8 @@ function TableRenameDialog({
|
|
|
18765
18780
|
const [typed2, setTyped] = useState59(name);
|
|
18766
18781
|
const [busy, setBusy] = useState59(false);
|
|
18767
18782
|
const [refused, setRefused] = useState59(null);
|
|
18768
|
-
const box =
|
|
18769
|
-
const openedAt =
|
|
18783
|
+
const box = useRef29(null);
|
|
18784
|
+
const openedAt = useRef29(null);
|
|
18770
18785
|
useEffect51(() => {
|
|
18771
18786
|
if (!open) return;
|
|
18772
18787
|
openedAt.current = (0, recordVersions_exports.readTableVersionNow)(client, tableId);
|
|
@@ -18858,7 +18873,7 @@ function TableRenameDialog({
|
|
|
18858
18873
|
}
|
|
18859
18874
|
|
|
18860
18875
|
// src/TableSettings.tsx
|
|
18861
|
-
import { useEffect as useEffect55, useMemo as useMemo37, useRef as
|
|
18876
|
+
import { useEffect as useEffect55, useMemo as useMemo37, useRef as useRef30, useState as useState64 } from "react";
|
|
18862
18877
|
import { levelHasShownTo as levelHasShownTo2 } from "@ai-matrx/records";
|
|
18863
18878
|
|
|
18864
18879
|
// src/ArchiveDeliberately.tsx
|
|
@@ -19347,9 +19362,9 @@ function TableSettings(props) {
|
|
|
19347
19362
|
const client = useRecordsClient55();
|
|
19348
19363
|
const table = useTable20(props.tableId);
|
|
19349
19364
|
const fields = useFields19(props.tableId);
|
|
19350
|
-
const now =
|
|
19365
|
+
const now = useRef30({ table: table.data ?? null, fields: fields.data ?? [] });
|
|
19351
19366
|
now.current = { table: table.data ?? null, fields: fields.data ?? [] };
|
|
19352
|
-
const slots2 =
|
|
19367
|
+
const slots2 = useRef30({ details: { current: null }, rowActions: { current: null } }).current;
|
|
19353
19368
|
const agent = useMemo37(
|
|
19354
19369
|
() => buildTableSettingsAgent(props.tableId, () => now.current, client, slots2),
|
|
19355
19370
|
[props.tableId, client, slots2]
|
|
@@ -19382,8 +19397,8 @@ function TableSettingsPanel({
|
|
|
19382
19397
|
live = false;
|
|
19383
19398
|
};
|
|
19384
19399
|
}, [tableId]);
|
|
19385
|
-
const askToArchiveRef =
|
|
19386
|
-
const archiveAskedSeen =
|
|
19400
|
+
const askToArchiveRef = useRef30(null);
|
|
19401
|
+
const archiveAskedSeen = useRef30(0);
|
|
19387
19402
|
const panelReady = Boolean(table.data && fields.data && rights.structure);
|
|
19388
19403
|
useEffect55(() => {
|
|
19389
19404
|
const ask2 = askToArchiveRef.current;
|
|
@@ -19588,7 +19603,7 @@ function TableSettingsPanel({
|
|
|
19588
19603
|
/* @__PURE__ */ jsx70(Button55, { size: "sm", variant: "ghost", onClick: () => setAskingToDelete(false), children: "Keep it" })
|
|
19589
19604
|
] }) })
|
|
19590
19605
|
] }) : /* @__PURE__ */ jsx70("div", { children: /* @__PURE__ */ jsx70(Button55, { size: "sm", variant: "outline", onClick: () => void askToArchive(), children: "Archive this table" }) }),
|
|
19591
|
-
archive.error ? /* @__PURE__ */ jsx70(RefusalNotice, { error: archive.error }) : null
|
|
19606
|
+
archive.error ? /* @__PURE__ */ jsx70(RefusalNotice, { error: archive.error, onRetry: () => void startArchive() }) : null
|
|
19592
19607
|
] })
|
|
19593
19608
|
] });
|
|
19594
19609
|
}
|
|
@@ -19788,7 +19803,7 @@ import {
|
|
|
19788
19803
|
import { formatCount as formatCount5 } from "@ai-matrx/kit/format";
|
|
19789
19804
|
|
|
19790
19805
|
// src/recordMoves.tsx
|
|
19791
|
-
import { useCallback as useCallback33, useEffect as useEffect57, useMemo as useMemo39, useRef as
|
|
19806
|
+
import { useCallback as useCallback33, useEffect as useEffect57, useMemo as useMemo39, useRef as useRef31, useState as useState66 } from "react";
|
|
19792
19807
|
import { useRecordsClient as useRecordsClient57 } from "@ai-matrx/records/react";
|
|
19793
19808
|
import { Button as Button56 } from "@ai-matrx/design-system";
|
|
19794
19809
|
import { Fragment as Fragment29, jsx as jsx71, jsxs as jsxs65 } from "react/jsx-runtime";
|
|
@@ -19914,7 +19929,7 @@ function useRecordMoves({
|
|
|
19914
19929
|
[client, undo, onMoved, preset]
|
|
19915
19930
|
);
|
|
19916
19931
|
const offering = Boolean(undo.notice);
|
|
19917
|
-
const undoRef =
|
|
19932
|
+
const undoRef = useRef31(undo);
|
|
19918
19933
|
undoRef.current = undo;
|
|
19919
19934
|
useEffect57(() => {
|
|
19920
19935
|
if (!offering || typeof document === "undefined") return;
|
|
@@ -19982,7 +19997,7 @@ function MoveRefusedBadge({ refused }) {
|
|
|
19982
19997
|
}
|
|
19983
19998
|
|
|
19984
19999
|
// src/Pipeline.tsx
|
|
19985
|
-
import { useCallback as useCallback34, useEffect as useEffect58, useMemo as useMemo40, useRef as
|
|
20000
|
+
import { useCallback as useCallback34, useEffect as useEffect58, useMemo as useMemo40, useRef as useRef32, useState as useState67 } from "react";
|
|
19986
20001
|
import {
|
|
19987
20002
|
mayDrag,
|
|
19988
20003
|
useFields as useFields20,
|
|
@@ -20095,9 +20110,9 @@ function PipelineBoard({
|
|
|
20095
20110
|
const [waiting, setWaiting] = useState67(/* @__PURE__ */ new Map());
|
|
20096
20111
|
const [dragging, setDragging] = useState67(null);
|
|
20097
20112
|
const [over, setOver] = useState67(null);
|
|
20098
|
-
const alive =
|
|
20113
|
+
const alive = useRef32(true);
|
|
20099
20114
|
const [selected, setSelected] = useState67(/* @__PURE__ */ new Set());
|
|
20100
|
-
const anchor =
|
|
20115
|
+
const anchor = useRef32(null);
|
|
20101
20116
|
const [batch, setBatch] = useState67(/* @__PURE__ */ new Map());
|
|
20102
20117
|
const [batchSaid, setBatchSaid] = useState67(null);
|
|
20103
20118
|
const [batchError, setBatchError] = useState67(null);
|
|
@@ -20131,7 +20146,7 @@ function PipelineBoard({
|
|
|
20131
20146
|
void reload();
|
|
20132
20147
|
}, [reload]);
|
|
20133
20148
|
const versions = (0, recordVersions_exports.useRecordVersions)(client, rows, (r) => mayDrag(r.level));
|
|
20134
|
-
const versionsRef =
|
|
20149
|
+
const versionsRef = useRef32(versions);
|
|
20135
20150
|
versionsRef.current = versions;
|
|
20136
20151
|
const drawnVersion = (id) => versionsRef.current.seen(id);
|
|
20137
20152
|
const stageKey = definition?.stage_field ?? null;
|
|
@@ -20794,7 +20809,7 @@ function structuredWordsFor(field, value) {
|
|
|
20794
20809
|
}
|
|
20795
20810
|
|
|
20796
20811
|
// src/CalendarView.tsx
|
|
20797
|
-
import { useEffect as useEffect60, useLayoutEffect as useLayoutEffect3, useMemo as useMemo43, useRef as
|
|
20812
|
+
import { useEffect as useEffect60, useLayoutEffect as useLayoutEffect3, useMemo as useMemo43, useRef as useRef33, useState as useState69 } from "react";
|
|
20798
20813
|
import { mayDrag as mayDrag2 } from "@ai-matrx/records/react";
|
|
20799
20814
|
import { Button as Button58, Select as Select5, SelectContent as SelectContent3, SelectItem as SelectItem3, SelectTrigger as SelectTrigger3, SelectValue as SelectValue3, cn as cn31 } from "@ai-matrx/design-system";
|
|
20800
20815
|
import { CHOICE_CHIP_CLASS } from "@ai-matrx/design-system/data-table";
|
|
@@ -21180,8 +21195,8 @@ function CalendarView({
|
|
|
21180
21195
|
}, [rows, dateField.key, endField?.key, placedOver, defaultMinutes]);
|
|
21181
21196
|
const titleOf = (row) => cardWords(row, titleField, labels).text;
|
|
21182
21197
|
const rowById = (id) => rows.find((r) => r.id === id);
|
|
21183
|
-
const frame =
|
|
21184
|
-
const grid =
|
|
21198
|
+
const frame = useRef33(null);
|
|
21199
|
+
const grid = useRef33(null);
|
|
21185
21200
|
const gridWidth = useGridWidth(grid, mode);
|
|
21186
21201
|
const cellColumns = mode === "month" ? 7 : mode === "week" ? 7 : 1;
|
|
21187
21202
|
const cellReserve = mode === "month" ? 0 : 44;
|
|
@@ -21234,7 +21249,7 @@ function CalendarView({
|
|
|
21234
21249
|
const made = await moves.create({ tableId, data, label: `New record on ${where}` });
|
|
21235
21250
|
if (made) onOpenRecord?.(made);
|
|
21236
21251
|
};
|
|
21237
|
-
const grabOffset =
|
|
21252
|
+
const grabOffset = useRef33(0);
|
|
21238
21253
|
const [resizing, setResizing] = useState69(null);
|
|
21239
21254
|
const [ghost, setGhost] = useState69(null);
|
|
21240
21255
|
useEffect60(() => {
|
|
@@ -21813,7 +21828,7 @@ function WeekHours({
|
|
|
21813
21828
|
render,
|
|
21814
21829
|
overlay
|
|
21815
21830
|
}) {
|
|
21816
|
-
const frame =
|
|
21831
|
+
const frame = useRef33(null);
|
|
21817
21832
|
useEffect60(() => {
|
|
21818
21833
|
if (frame.current) frame.current.scrollTop = 7 * HOUR_PX;
|
|
21819
21834
|
}, []);
|
|
@@ -21861,7 +21876,7 @@ function weekHeading(first) {
|
|
|
21861
21876
|
}
|
|
21862
21877
|
|
|
21863
21878
|
// src/TimelineView.tsx
|
|
21864
|
-
import { useEffect as useEffect61, useMemo as useMemo44, useRef as
|
|
21879
|
+
import { useEffect as useEffect61, useMemo as useMemo44, useRef as useRef34, useState as useState70 } from "react";
|
|
21865
21880
|
import { mayDrag as mayDrag3 } from "@ai-matrx/records/react";
|
|
21866
21881
|
import { DropdownMenu as DropdownMenu7, DropdownMenuCheckboxItem as DropdownMenuCheckboxItem2, DropdownMenuContent as DropdownMenuContent7, DropdownMenuItem as DropdownMenuItem6, DropdownMenuRadioGroup as DropdownMenuRadioGroup2, DropdownMenuRadioItem as DropdownMenuRadioItem2, DropdownMenuSeparator as DropdownMenuSeparator3, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger as DropdownMenuTrigger7, Button as Button59, Select as Select6, SelectContent as SelectContent4, SelectItem as SelectItem4, SelectTrigger as SelectTrigger4, SelectValue as SelectValue4, cn as cn32 } from "@ai-matrx/design-system";
|
|
21867
21882
|
import { CHOICE_CHIP_CLASS as CHOICE_CHIP_CLASS2 } from "@ai-matrx/design-system/data-table";
|
|
@@ -22452,11 +22467,11 @@ function TimelineView({
|
|
|
22452
22467
|
const width = days * px;
|
|
22453
22468
|
const scale = useMemo44(() => scaleOf(from, days, zoom, firstDay), [from, days, zoom, firstDay]);
|
|
22454
22469
|
const xOf = (day2) => daysBetween(from, day2) * px;
|
|
22455
|
-
const scroller =
|
|
22470
|
+
const scroller = useRef34(null);
|
|
22456
22471
|
const grouped = Boolean(groupField) && !ganttOn;
|
|
22457
22472
|
const hasLabel = grouped || ganttOn;
|
|
22458
22473
|
const [scrollX, setScrollX] = useState70(0);
|
|
22459
|
-
const frame =
|
|
22474
|
+
const frame = useRef34(null);
|
|
22460
22475
|
const onScroll = () => {
|
|
22461
22476
|
if (frame.current !== null) return;
|
|
22462
22477
|
frame.current = requestAnimationFrame(() => {
|
|
@@ -23666,7 +23681,7 @@ import { fieldKindFor, measureKey as measureKey5 } from "@ai-matrx/records";
|
|
|
23666
23681
|
import { Select as Select8, SelectContent as SelectContent6, SelectItem as SelectItem6, SelectTrigger as SelectTrigger6, SelectValue as SelectValue6 } from "@ai-matrx/design-system";
|
|
23667
23682
|
|
|
23668
23683
|
// src/ChartBlock.tsx
|
|
23669
|
-
import { useMemo as useMemo47, useRef as
|
|
23684
|
+
import { useMemo as useMemo47, useRef as useRef36 } from "react";
|
|
23670
23685
|
import {
|
|
23671
23686
|
Area,
|
|
23672
23687
|
AreaChart,
|
|
@@ -24077,14 +24092,14 @@ import {
|
|
|
24077
24092
|
useEffect as useEffect66,
|
|
24078
24093
|
useId as useId2,
|
|
24079
24094
|
useLayoutEffect as useLayoutEffect4,
|
|
24080
|
-
useRef as
|
|
24095
|
+
useRef as useRef35,
|
|
24081
24096
|
useState as useState75
|
|
24082
24097
|
} from "react";
|
|
24083
24098
|
import { cn as cn35 } from "@ai-matrx/design-system";
|
|
24084
24099
|
import { jsx as jsx82, jsxs as jsxs75 } from "react/jsx-runtime";
|
|
24085
24100
|
var useBeforePaint = typeof document === "undefined" ? useEffect66 : useLayoutEffect4;
|
|
24086
24101
|
function useMeasuredWidth(fallback = 480) {
|
|
24087
|
-
const ref =
|
|
24102
|
+
const ref = useRef35(null);
|
|
24088
24103
|
const [width, setWidth] = useState75(fallback);
|
|
24089
24104
|
useBeforePaint(() => {
|
|
24090
24105
|
const node = ref.current;
|
|
@@ -24671,7 +24686,7 @@ function Drawing({
|
|
|
24671
24686
|
const pretty2 = usePrettyWith(prettyPlain);
|
|
24672
24687
|
const compactTick = useCompactWith(compactTickPlain);
|
|
24673
24688
|
const labelText = (v) => typeof v === "number" ? pretty2(v).length > 7 ? compactTick(v) : pretty2(v) : "";
|
|
24674
|
-
const scatterNames =
|
|
24689
|
+
const scatterNames = useRef36({ keys: [], boxes: [] });
|
|
24675
24690
|
const compared = series.length > 1;
|
|
24676
24691
|
const drawOrder = compared ? [series[1], series[0]] : series;
|
|
24677
24692
|
const goalLine = (horizontal2) => goal && typeof goal.value === "number" ? /* @__PURE__ */ jsx83(
|
|
@@ -25342,7 +25357,7 @@ function PivotLayout({ view, fields, filter, onChange, remembered }) {
|
|
|
25342
25357
|
}
|
|
25343
25358
|
|
|
25344
25359
|
// src/MapLayout.tsx
|
|
25345
|
-
import { useEffect as useEffect69, useMemo as useMemo50, useRef as
|
|
25360
|
+
import { useEffect as useEffect69, useMemo as useMemo50, useRef as useRef37, useState as useState78 } from "react";
|
|
25346
25361
|
import { useFieldMutation as useFieldMutation6, useRecordMutation as useRecordMutation2 } from "@ai-matrx/records/react";
|
|
25347
25362
|
import { Button as Button61, Select as Select10, SelectContent as SelectContent8, SelectItem as SelectItem8, SelectTrigger as SelectTrigger8, SelectValue as SelectValue8, cn as cn38 } from "@ai-matrx/design-system";
|
|
25348
25363
|
|
|
@@ -25471,9 +25486,9 @@ function MapLayout({ view, fields, rows, titleKey, openRecordId, onOpenRecord, o
|
|
|
25471
25486
|
const saved = !coordinateMode ? coordinateColumns(fields) : null;
|
|
25472
25487
|
const [found, setFound] = useState78(() => /* @__PURE__ */ new Map());
|
|
25473
25488
|
const [lookup, setLookup] = useState78({ running: false, notFound: /* @__PURE__ */ new Set(), couldNot: false });
|
|
25474
|
-
const tried =
|
|
25475
|
-
const passing =
|
|
25476
|
-
const mounted =
|
|
25489
|
+
const tried = useRef37(/* @__PURE__ */ new Set());
|
|
25490
|
+
const passing = useRef37(false);
|
|
25491
|
+
const mounted = useRef37(true);
|
|
25477
25492
|
useEffect69(() => {
|
|
25478
25493
|
mounted.current = true;
|
|
25479
25494
|
return () => {
|
|
@@ -25602,7 +25617,7 @@ function MapLayout({ view, fields, rows, titleKey, openRecordId, onOpenRecord, o
|
|
|
25602
25617
|
}
|
|
25603
25618
|
|
|
25604
25619
|
// src/OrgChartLayout.tsx
|
|
25605
|
-
import { useCallback as useCallback35, useEffect as useEffect70, useMemo as useMemo51, useRef as
|
|
25620
|
+
import { useCallback as useCallback35, useEffect as useEffect70, useMemo as useMemo51, useRef as useRef38, useState as useState79 } from "react";
|
|
25606
25621
|
import { Button as Button62, Select as Select11, SelectContent as SelectContent9, SelectItem as SelectItem9, SelectTrigger as SelectTrigger9, SelectValue as SelectValue9, cn as cn39 } from "@ai-matrx/design-system";
|
|
25607
25622
|
|
|
25608
25623
|
// src/orgTree.ts
|
|
@@ -25757,9 +25772,9 @@ function OrgChartLayout({ view, fields, rows, titleKey, openRecordId, onOpenReco
|
|
|
25757
25772
|
const forest = useMemo51(() => chosen ? buildOrgForest(rows, chosen.key) : null, [rows, chosen?.key]);
|
|
25758
25773
|
const [collapsed, setCollapsed] = useState79(() => /* @__PURE__ */ new Set());
|
|
25759
25774
|
const layout = useMemo51(() => forest ? layoutOrg(forest.roots, collapsed) : null, [forest, collapsed]);
|
|
25760
|
-
const box =
|
|
25775
|
+
const box = useRef38(null);
|
|
25761
25776
|
const [view2, setView2] = useState79({ scale: 1, x: 16, y: 16 });
|
|
25762
|
-
const fitted =
|
|
25777
|
+
const fitted = useRef38("");
|
|
25763
25778
|
const fit = useCallback35(() => {
|
|
25764
25779
|
const el = box.current;
|
|
25765
25780
|
if (!el || !layout) return;
|
|
@@ -25772,9 +25787,9 @@ function OrgChartLayout({ view, fields, rows, titleKey, openRecordId, onOpenReco
|
|
|
25772
25787
|
fit();
|
|
25773
25788
|
}
|
|
25774
25789
|
}, [shape, layout, fit]);
|
|
25775
|
-
const pointers =
|
|
25776
|
-
const gesture =
|
|
25777
|
-
const suppress =
|
|
25790
|
+
const pointers = useRef38(/* @__PURE__ */ new Map());
|
|
25791
|
+
const gesture = useRef38(null);
|
|
25792
|
+
const suppress = useRef38(false);
|
|
25778
25793
|
const onDown = (e) => {
|
|
25779
25794
|
pointers.current.set(e.pointerId, { x: e.clientX, y: e.clientY });
|
|
25780
25795
|
const pts = [...pointers.current.values()];
|
|
@@ -27516,7 +27531,7 @@ function ArchivedPortals({
|
|
|
27516
27531
|
import { ArchivedDisclosure as ArchivedDisclosure2, ARCHIVED_NEVER_DESTROYED } from "@ai-matrx/design-system";
|
|
27517
27532
|
|
|
27518
27533
|
// src/ViewBar.tsx
|
|
27519
|
-
import { useCallback as useCallback38, useEffect as useEffect74, useRef as
|
|
27534
|
+
import { useCallback as useCallback38, useEffect as useEffect74, useRef as useRef39, useState as useState83 } from "react";
|
|
27520
27535
|
import { useRecordsClient as useRecordsClient65 } from "@ai-matrx/records/react";
|
|
27521
27536
|
import { Badge as Badge11, Button as Button66, Input as Input6, Popover as Popover8, PopoverContent as PopoverContent8, PopoverTrigger as PopoverTrigger8, Skeleton as Skeleton20, cn as cn42 } from "@ai-matrx/design-system";
|
|
27522
27537
|
import { Button as ControlButton2, Switch as Switch4, Tile } from "@ai-matrx/design-system/controls";
|
|
@@ -27629,8 +27644,8 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews,
|
|
|
27629
27644
|
if (!initialViews || initialViews.length === 0) return activeViewId ?? null;
|
|
27630
27645
|
return (initialViews.find((v) => v.id === activeViewId) ?? defaultViewOf(initialViews) ?? initialViews[0]).id;
|
|
27631
27646
|
});
|
|
27632
|
-
const readOnMount =
|
|
27633
|
-
const pendingPick =
|
|
27647
|
+
const readOnMount = useRef39(initialViews === void 0);
|
|
27648
|
+
const pendingPick = useRef39(null);
|
|
27634
27649
|
const [naming, setNaming] = useState83(false);
|
|
27635
27650
|
const [draftName, setDraftName] = useState83("");
|
|
27636
27651
|
const [open, setOpen] = useState83(false);
|
|
@@ -27650,7 +27665,7 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews,
|
|
|
27650
27665
|
});
|
|
27651
27666
|
const [renamingSection, setRenamingSection] = useState83(null);
|
|
27652
27667
|
const [dragging, setDragging] = useState83(false);
|
|
27653
|
-
const justDragged =
|
|
27668
|
+
const justDragged = useRef39(false);
|
|
27654
27669
|
const sensors = useSensors(useSensor(PointerSensor, { activationConstraint: { distance: 6 } }));
|
|
27655
27670
|
async function dropped(event) {
|
|
27656
27671
|
setDragging(false);
|
|
@@ -28113,7 +28128,7 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews,
|
|
|
28113
28128
|
}
|
|
28114
28129
|
|
|
28115
28130
|
// src/ProposalRow.tsx
|
|
28116
|
-
import { useEffect as useEffect75, useRef as
|
|
28131
|
+
import { useEffect as useEffect75, useRef as useRef40, useState as useState84 } from "react";
|
|
28117
28132
|
import { useRecordsClient as useRecordsClient66 } from "@ai-matrx/records/react";
|
|
28118
28133
|
import { Badge as Badge12, Button as Button67, cn as cn43 } from "@ai-matrx/design-system";
|
|
28119
28134
|
import { jsx as jsx92, jsxs as jsxs85 } from "react/jsx-runtime";
|
|
@@ -28131,7 +28146,7 @@ function ProposalRow({
|
|
|
28131
28146
|
const [settled, setSettled] = useState84(outcome ?? null);
|
|
28132
28147
|
const [busy, setBusy] = useState84(false);
|
|
28133
28148
|
const [confirming, setConfirming] = useState84(false);
|
|
28134
|
-
const drawnVersion =
|
|
28149
|
+
const drawnVersion = useRef40(null);
|
|
28135
28150
|
const needsVersion = change.act === "update" && Boolean(change.record) && change.version === void 0 && !onApply && !settled;
|
|
28136
28151
|
useEffect75(() => {
|
|
28137
28152
|
if (needsVersion && change.record && !drawnVersion.current) drawnVersion.current = (0, recordVersions_exports.readVersionNow)(client, change.record);
|
|
@@ -28221,7 +28236,7 @@ function ProposalRow({
|
|
|
28221
28236
|
}
|
|
28222
28237
|
|
|
28223
28238
|
// src/ActionInbox.tsx
|
|
28224
|
-
import { useCallback as useCallback39, useEffect as useEffect76, useMemo as useMemo53, useRef as
|
|
28239
|
+
import { useCallback as useCallback39, useEffect as useEffect76, useMemo as useMemo53, useRef as useRef41, useState as useState85 } from "react";
|
|
28225
28240
|
import { useRecordsClient as useRecordsClient67 } from "@ai-matrx/records/react";
|
|
28226
28241
|
import { Badge as Badge13, Button as Button68, Checkbox as Checkbox6, Skeleton as Skeleton21, cn as cn44 } from "@ai-matrx/design-system";
|
|
28227
28242
|
import { toggleSelection as toggleSelection2 } from "@ai-matrx/design-system/data-table";
|
|
@@ -28324,9 +28339,9 @@ function ActionInbox({
|
|
|
28324
28339
|
const [outcome, setOutcome] = useState85({});
|
|
28325
28340
|
const [busy, setBusy] = useState85(null);
|
|
28326
28341
|
const [cursor, setCursor] = useState85(0);
|
|
28327
|
-
const listRef =
|
|
28342
|
+
const listRef = useRef41(null);
|
|
28328
28343
|
const [selected, setSelected] = useState85(/* @__PURE__ */ new Set());
|
|
28329
|
-
const anchor =
|
|
28344
|
+
const anchor = useRef41(null);
|
|
28330
28345
|
const [deciding, setDeciding] = useState85(false);
|
|
28331
28346
|
const [batchSaid, setBatchSaid] = useState85(null);
|
|
28332
28347
|
const [view, setView] = useState85("inbox");
|
|
@@ -28390,9 +28405,9 @@ function ActionInbox({
|
|
|
28390
28405
|
[client, load]
|
|
28391
28406
|
);
|
|
28392
28407
|
const [held, setHeld] = useState85({});
|
|
28393
|
-
const holds2 =
|
|
28394
|
-
const lastHold =
|
|
28395
|
-
const holdSeq =
|
|
28408
|
+
const holds2 = useRef41(/* @__PURE__ */ new Map());
|
|
28409
|
+
const lastHold = useRef41(null);
|
|
28410
|
+
const holdSeq = useRef41(0);
|
|
28396
28411
|
const [, tick] = useState85(0);
|
|
28397
28412
|
useEffect76(() => {
|
|
28398
28413
|
if (Object.keys(held).length === 0) return;
|
|
@@ -28450,7 +28465,7 @@ function ActionInbox({
|
|
|
28450
28465
|
flush();
|
|
28451
28466
|
};
|
|
28452
28467
|
}, []);
|
|
28453
|
-
const resumed =
|
|
28468
|
+
const resumed = useRef41(false);
|
|
28454
28469
|
useEffect76(() => {
|
|
28455
28470
|
if (resumed.current || items === null || view !== "inbox") return;
|
|
28456
28471
|
resumed.current = true;
|
|
@@ -29201,7 +29216,7 @@ function FormResultsPanel({ form, className }) {
|
|
|
29201
29216
|
}
|
|
29202
29217
|
|
|
29203
29218
|
// src/PortalBuilder.tsx
|
|
29204
|
-
import { useCallback as useCallback40, useEffect as useEffect78, useMemo as useMemo55, useRef as
|
|
29219
|
+
import { useCallback as useCallback40, useEffect as useEffect78, useMemo as useMemo55, useRef as useRef42, useState as useState87 } from "react";
|
|
29205
29220
|
import { useRecordsClient as useRecordsClient68, useTables } from "@ai-matrx/records/react";
|
|
29206
29221
|
import { BasicInput as BasicInput11, Button as Button70, Checkbox as Checkbox7, Label as Label10, Separator as Separator9, Skeleton as Skeleton23, cn as cn46 } from "@ai-matrx/design-system";
|
|
29207
29222
|
import { Select as Select13 } from "@ai-matrx/design-system/controls";
|
|
@@ -29307,7 +29322,7 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
|
|
|
29307
29322
|
if (on) void loadFields(t.id);
|
|
29308
29323
|
}
|
|
29309
29324
|
const [linking, setLinking] = useState87(null);
|
|
29310
|
-
const linkingNow =
|
|
29325
|
+
const linkingNow = useRef42(null);
|
|
29311
29326
|
async function addLinkBack(id) {
|
|
29312
29327
|
const clients = (tables.data ?? []).find((t) => t.id === clientTableId);
|
|
29313
29328
|
if (!clientTableId || !clients) return;
|
|
@@ -29334,7 +29349,7 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
|
|
|
29334
29349
|
linkingNow.current = null;
|
|
29335
29350
|
setLinking(null);
|
|
29336
29351
|
}
|
|
29337
|
-
const autoLinked =
|
|
29352
|
+
const autoLinked = useRef42(/* @__PURE__ */ new Set());
|
|
29338
29353
|
useEffect78(() => {
|
|
29339
29354
|
if (linking !== null || !clientTableId) return;
|
|
29340
29355
|
for (const e of Object.values(exposures)) {
|
|
@@ -31525,7 +31540,7 @@ import { copyText as copyText6 } from "@ai-matrx/kit/clipboard";
|
|
|
31525
31540
|
import { dropKeptDraft, keepDraft, readKeptDraft } from "@ai-matrx/kit/drafts";
|
|
31526
31541
|
import { ErrorBox as ErrorBox3 } from "@ai-matrx/design-system";
|
|
31527
31542
|
import { Select as Select15 } from "@ai-matrx/design-system/controls";
|
|
31528
|
-
import { useCallback as useCallback46, useEffect as useEffect85, useMemo as useMemo60, useRef as
|
|
31543
|
+
import { useCallback as useCallback46, useEffect as useEffect85, useMemo as useMemo60, useRef as useRef44, useState as useState95 } from "react";
|
|
31529
31544
|
import { DndContext as DndContext2, KeyboardSensor, PointerSensor as PointerSensor2, closestCenter as closestCenter2, useSensor as useSensor2, useSensors as useSensors2 } from "@dnd-kit/core";
|
|
31530
31545
|
import { SortableContext as SortableContext2, arrayMove, sortableKeyboardCoordinates, useSortable as useSortable2, verticalListSortingStrategy as verticalListSortingStrategy2 } from "@dnd-kit/sortable";
|
|
31531
31546
|
import { CSS as CSS3 } from "@dnd-kit/utilities";
|
|
@@ -31798,7 +31813,7 @@ function EmbedSnippets({ url, label }) {
|
|
|
31798
31813
|
}
|
|
31799
31814
|
|
|
31800
31815
|
// src/FormRunner.tsx
|
|
31801
|
-
import { useCallback as useCallback45, useEffect as useEffect84, useMemo as useMemo59, useRef as
|
|
31816
|
+
import { useCallback as useCallback45, useEffect as useEffect84, useMemo as useMemo59, useRef as useRef43, useState as useState94 } from "react";
|
|
31802
31817
|
import { useFields as useFields24, useOptionalRecordsClient as useOptionalRecordsClient9 } from "@ai-matrx/records/react";
|
|
31803
31818
|
import { Button as Button77, Label as Label14, Progress, Skeleton as Skeleton28, cn as cn54, formThemeClasses } from "@ai-matrx/design-system";
|
|
31804
31819
|
import { answerRefusal, formRoutes, pipeAnswers, submissionStamp } from "@ai-matrx/records/forms";
|
|
@@ -31916,11 +31931,11 @@ function FormStage({
|
|
|
31916
31931
|
const routes = formRoutes(form);
|
|
31917
31932
|
const [routeKnown, setRouteKnown] = useState94(() => !routes || !whichAsked);
|
|
31918
31933
|
const [stopped, setStopped] = useState94(null);
|
|
31919
|
-
const answersRef =
|
|
31934
|
+
const answersRef = useRef43(answers);
|
|
31920
31935
|
answersRef.current = answers;
|
|
31921
31936
|
const choose = autoAdvance ?? form.autoAdvance ?? true;
|
|
31922
|
-
const decoy =
|
|
31923
|
-
const stage =
|
|
31937
|
+
const decoy = useRef43("");
|
|
31938
|
+
const stage = useRef43(null);
|
|
31924
31939
|
const questions = useMemo59(() => {
|
|
31925
31940
|
const byKey = new Map((fields ?? []).map((f) => [f.key, f]));
|
|
31926
31941
|
return (form.questions ?? []).map((q) => {
|
|
@@ -31983,13 +31998,13 @@ function FormStage({
|
|
|
31983
31998
|
};
|
|
31984
31999
|
}, [whichAsked, questions, answers]);
|
|
31985
32000
|
const live = questions.filter((q) => !hidden[q.key]);
|
|
31986
|
-
const told =
|
|
32001
|
+
const told = useRef43(answers);
|
|
31987
32002
|
useEffect84(() => {
|
|
31988
32003
|
if (told.current === answers) return;
|
|
31989
32004
|
told.current = answers;
|
|
31990
32005
|
onAnswersChange?.(answers);
|
|
31991
32006
|
}, [answers, onAnswersChange]);
|
|
31992
|
-
const resumeAt =
|
|
32007
|
+
const resumeAt = useRef43(
|
|
31993
32008
|
resumed && initialAnswers && Object.keys(initialAnswers).length > 0 ? questions.find((q) => {
|
|
31994
32009
|
const v = initialAnswers[q.key];
|
|
31995
32010
|
return v === void 0 || v === null || v === "";
|
|
@@ -32103,9 +32118,9 @@ function FormStage({
|
|
|
32103
32118
|
if (stillMissing) refuse(stillMissing, refusalFor2(stillMissing));
|
|
32104
32119
|
else void submit();
|
|
32105
32120
|
}
|
|
32106
|
-
const routing =
|
|
32121
|
+
const routing = useRef43(false);
|
|
32107
32122
|
const [routingNow, setRoutingNow] = useState94(false);
|
|
32108
|
-
const typedAhead =
|
|
32123
|
+
const typedAhead = useRef43("");
|
|
32109
32124
|
useEffect84(() => {
|
|
32110
32125
|
if (!routingNow) return;
|
|
32111
32126
|
const hold = (event) => {
|
|
@@ -32139,7 +32154,7 @@ function FormStage({
|
|
|
32139
32154
|
useEffect84(() => {
|
|
32140
32155
|
if (!routingNow) pourTypedAhead();
|
|
32141
32156
|
}, [routingNow, at, pourTypedAhead]);
|
|
32142
|
-
const advanceRef =
|
|
32157
|
+
const advanceRef = useRef43(advance);
|
|
32143
32158
|
advanceRef.current = advance;
|
|
32144
32159
|
const chosen = useCallback45(() => {
|
|
32145
32160
|
if (!oneAtATime || !choose) return;
|
|
@@ -32168,7 +32183,7 @@ function FormStage({
|
|
|
32168
32183
|
input?.focus();
|
|
32169
32184
|
pourTypedAhead();
|
|
32170
32185
|
}, [index, done, started]);
|
|
32171
|
-
const startTold =
|
|
32186
|
+
const startTold = useRef43(false);
|
|
32172
32187
|
useEffect84(() => {
|
|
32173
32188
|
if (startTold.current || !onStart) return;
|
|
32174
32189
|
if (Object.values(answers).some((v) => v !== void 0 && v !== null && v !== "")) {
|
|
@@ -32176,7 +32191,7 @@ function FormStage({
|
|
|
32176
32191
|
onStart();
|
|
32177
32192
|
}
|
|
32178
32193
|
}, [answers, onStart]);
|
|
32179
|
-
const shownTold =
|
|
32194
|
+
const shownTold = useRef43(/* @__PURE__ */ new Set());
|
|
32180
32195
|
useEffect84(() => {
|
|
32181
32196
|
if (!onQuestionShown || !started || done) return;
|
|
32182
32197
|
for (const q of oneAtATime ? current ? [current] : [] : live) {
|
|
@@ -32544,7 +32559,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
|
|
|
32544
32559
|
const [restoredAt, setRestoredAt] = useState95(null);
|
|
32545
32560
|
const [showResults, setShowResults] = useState95(false);
|
|
32546
32561
|
const [adding, setAdding] = useState95(false);
|
|
32547
|
-
const keysBeforeAdd =
|
|
32562
|
+
const keysBeforeAdd = useRef44(null);
|
|
32548
32563
|
const [makeOnMount, setMakeOnMount] = useState95("waiting");
|
|
32549
32564
|
const publicOrigin = host.publicOrigin ?? (typeof window === "undefined" ? "" : window.location.origin);
|
|
32550
32565
|
const load = useCallback46(async () => {
|
|
@@ -32610,7 +32625,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
|
|
|
32610
32625
|
);
|
|
32611
32626
|
const stored = useMemo60(() => draft ? (forms ?? []).find((f) => f.id === draft.id) ?? null : null, [draft, forms]);
|
|
32612
32627
|
const dirty = Boolean(draft && stored && !sameForm(draft, stored));
|
|
32613
|
-
const lastSaved =
|
|
32628
|
+
const lastSaved = useRef44(null);
|
|
32614
32629
|
useEffect85(() => {
|
|
32615
32630
|
if (!draft || !stored) return;
|
|
32616
32631
|
const timer = window.setTimeout(() => {
|
|
@@ -33480,7 +33495,7 @@ function NotifyOnAnswer({
|
|
|
33480
33495
|
}
|
|
33481
33496
|
|
|
33482
33497
|
// src/DocRender.tsx
|
|
33483
|
-
import { useCallback as useCallback47, useEffect as useEffect86, useRef as
|
|
33498
|
+
import { useCallback as useCallback47, useEffect as useEffect86, useRef as useRef45, useState as useState96 } from "react";
|
|
33484
33499
|
import { useRecordsClient as useRecordsClient75 } from "@ai-matrx/records/react";
|
|
33485
33500
|
import { Button as Button79, Skeleton as Skeleton30, cn as cn56 } from "@ai-matrx/design-system";
|
|
33486
33501
|
import { jsx as jsx106, jsxs as jsxs99 } from "react/jsx-runtime";
|
|
@@ -33491,7 +33506,7 @@ function DocRender({ templateId, recordId, filename, onRendered, className }) {
|
|
|
33491
33506
|
const [showing, setShowing] = useState96(null);
|
|
33492
33507
|
const [error, setError] = useState96(null);
|
|
33493
33508
|
const [busy, setBusy] = useState96(null);
|
|
33494
|
-
const paper =
|
|
33509
|
+
const paper = useRef45(null);
|
|
33495
33510
|
const load = useCallback47(async () => {
|
|
33496
33511
|
const [body, held] = await Promise.all([
|
|
33497
33512
|
client.docRenderBody({ template_id: templateId, record_id: recordId }),
|
|
@@ -35262,7 +35277,7 @@ function TargetControl({
|
|
|
35262
35277
|
|
|
35263
35278
|
// src/QuestionPanel.tsx
|
|
35264
35279
|
import { copyText as copyText7 } from "@ai-matrx/kit/clipboard";
|
|
35265
|
-
import { useEffect as useEffect90, useMemo as useMemo63, useRef as
|
|
35280
|
+
import { useEffect as useEffect90, useMemo as useMemo63, useRef as useRef46, useState as useState101 } from "react";
|
|
35266
35281
|
import { Badge as Badge16, BasicInput as BasicInput20, Button as Button84, Checkbox as Checkbox11, Label as Label16, Skeleton as Skeleton34, cn as cn61 } from "@ai-matrx/design-system";
|
|
35267
35282
|
import { useFields as useFields29, useRecordsClient as useRecordsClient80 } from "@ai-matrx/records/react";
|
|
35268
35283
|
|
|
@@ -35351,7 +35366,7 @@ function QuestionPanel({ tableId, activeQuestionId, draft, className }) {
|
|
|
35351
35366
|
const [saveError, setSaveError] = useState101(null);
|
|
35352
35367
|
const [saving, setSaving] = useState101(false);
|
|
35353
35368
|
const [linkMissed, setLinkMissed] = useState101(false);
|
|
35354
|
-
const openedFromLink =
|
|
35369
|
+
const openedFromLink = useRef46(false);
|
|
35355
35370
|
useEffect90(() => {
|
|
35356
35371
|
let live = true;
|
|
35357
35372
|
void (0, question_exports.questionsOf)(client, tableId).then((answer2) => {
|
|
@@ -36233,7 +36248,7 @@ function AgentAnswer({
|
|
|
36233
36248
|
}
|
|
36234
36249
|
|
|
36235
36250
|
// src/PageScreen.tsx
|
|
36236
|
-
import { useCallback as useCallback51, useEffect as useEffect93, useMemo as useMemo65, useRef as
|
|
36251
|
+
import { useCallback as useCallback51, useEffect as useEffect93, useMemo as useMemo65, useRef as useRef47, useState as useState104 } from "react";
|
|
36237
36252
|
import { useRecordsClient as useRecordsClient83 } from "@ai-matrx/records/react";
|
|
36238
36253
|
import { BasicInput as BasicInput23, Button as Button87, Skeleton as Skeleton37, cn as cn63 } from "@ai-matrx/design-system";
|
|
36239
36254
|
|
|
@@ -37369,7 +37384,7 @@ function PageScreen({
|
|
|
37369
37384
|
const [run, setRun] = useState104(null);
|
|
37370
37385
|
const [saveError, setSaveError] = useState104(null);
|
|
37371
37386
|
const [askingToArchive, setAskingToArchive] = useState104(false);
|
|
37372
|
-
const canvas =
|
|
37387
|
+
const canvas = useRef47(null);
|
|
37373
37388
|
const [making, setMaking] = useState104("waiting");
|
|
37374
37389
|
const id = page?.id ?? pageId ?? null;
|
|
37375
37390
|
const load = useCallback51(
|
|
@@ -37570,7 +37585,7 @@ function PageScreen({
|
|
|
37570
37585
|
}
|
|
37571
37586
|
|
|
37572
37587
|
// src/InterfaceScreen.tsx
|
|
37573
|
-
import { useCallback as useCallback52, useEffect as useEffect94, useMemo as useMemo66, useRef as
|
|
37588
|
+
import { useCallback as useCallback52, useEffect as useEffect94, useMemo as useMemo66, useRef as useRef48, useState as useState105 } from "react";
|
|
37574
37589
|
import { useRecordsClient as useRecordsClient84 } from "@ai-matrx/records/react";
|
|
37575
37590
|
import { BasicInput as BasicInput24, Button as Button88, Skeleton as Skeleton38, cn as cn64 } from "@ai-matrx/design-system";
|
|
37576
37591
|
import { Fragment as Fragment52, jsx as jsx116, jsxs as jsxs109 } from "react/jsx-runtime";
|
|
@@ -37607,7 +37622,7 @@ function InterfaceScreen({
|
|
|
37607
37622
|
const [making, setMaking] = useState105("waiting");
|
|
37608
37623
|
const [askingToArchive, setAskingToArchive] = useState105(false);
|
|
37609
37624
|
const [localPage, setLocalPage] = useState105(null);
|
|
37610
|
-
const canvas =
|
|
37625
|
+
const canvas = useRef48(null);
|
|
37611
37626
|
const load = useCallback52(
|
|
37612
37627
|
async (want) => {
|
|
37613
37628
|
const answered = await client.interfaceRead({ interface_id: want });
|
|
@@ -37884,7 +37899,7 @@ function InterfaceScreen({
|
|
|
37884
37899
|
|
|
37885
37900
|
// src/FormsPanel.tsx
|
|
37886
37901
|
import { copyText as copyText8 } from "@ai-matrx/kit/clipboard";
|
|
37887
|
-
import { useCallback as useCallback53, useEffect as useEffect95, useRef as
|
|
37902
|
+
import { useCallback as useCallback53, useEffect as useEffect95, useRef as useRef49, useState as useState106 } from "react";
|
|
37888
37903
|
import { useRecordsClient as useRecordsClient85, useTable as useTable33 } from "@ai-matrx/records/react";
|
|
37889
37904
|
import { publicFormPath as publicFormPath2 } from "@ai-matrx/records";
|
|
37890
37905
|
import { Badge as Badge17, Button as Button89, Skeleton as Skeleton39, cn as cn65 } from "@ai-matrx/design-system";
|
|
@@ -37913,7 +37928,7 @@ function FormsPanel({ tableId, activeFormId, asView = false, className }) {
|
|
|
37913
37928
|
useEffect95(() => {
|
|
37914
37929
|
if (linked && rights.structure) setBuilding(true);
|
|
37915
37930
|
}, [linked, rights.structure]);
|
|
37916
|
-
const openedAsView =
|
|
37931
|
+
const openedAsView = useRef49(false);
|
|
37917
37932
|
useEffect95(() => {
|
|
37918
37933
|
if (!asView || openedAsView.current || forms === null || forms.length === 0 || !rights.structure) return;
|
|
37919
37934
|
openedAsView.current = true;
|
|
@@ -38074,12 +38089,12 @@ function FormsPanel({ tableId, activeFormId, asView = false, className }) {
|
|
|
38074
38089
|
}
|
|
38075
38090
|
|
|
38076
38091
|
// src/CaptureSheet.tsx
|
|
38077
|
-
import { useCallback as useCallback55, useEffect as useEffect97, useRef as
|
|
38092
|
+
import { useCallback as useCallback55, useEffect as useEffect97, useRef as useRef51, useState as useState108 } from "react";
|
|
38078
38093
|
import { useFields as useFields32, useRecordsClient as useRecordsClient87, useTable as useTable34 } from "@ai-matrx/records/react";
|
|
38079
38094
|
import { Button as Button91, Input as Input8, Skeleton as Skeleton41, Textarea as Textarea7, cn as cn67 } from "@ai-matrx/design-system";
|
|
38080
38095
|
|
|
38081
38096
|
// src/CaptureRun.tsx
|
|
38082
|
-
import { useCallback as useCallback54, useEffect as useEffect96, useMemo as useMemo67, useRef as
|
|
38097
|
+
import { useCallback as useCallback54, useEffect as useEffect96, useMemo as useMemo67, useRef as useRef50, useState as useState107 } from "react";
|
|
38083
38098
|
import {
|
|
38084
38099
|
coerceTypedAnswer,
|
|
38085
38100
|
coercionLabel,
|
|
@@ -38137,7 +38152,7 @@ function CaptureRun({ sheetId, face: given, className }) {
|
|
|
38137
38152
|
const [items, setItems] = useState107([]);
|
|
38138
38153
|
const [lastSynced, setLastSynced] = useState107(null);
|
|
38139
38154
|
const [sending, setSending] = useState107(false);
|
|
38140
|
-
const queueRef =
|
|
38155
|
+
const queueRef = useRef50(null);
|
|
38141
38156
|
useEffect96(() => {
|
|
38142
38157
|
const q2 = openCaptureQueue({
|
|
38143
38158
|
onChange: (c, all) => {
|
|
@@ -38517,7 +38532,7 @@ function AdHocCaptureSheet({
|
|
|
38517
38532
|
const [error, setError] = useState108(null);
|
|
38518
38533
|
const [uploadError, setUploadError] = useState108(null);
|
|
38519
38534
|
const [flushing, setFlushing] = useState108(false);
|
|
38520
|
-
const queue =
|
|
38535
|
+
const queue = useRef51([]);
|
|
38521
38536
|
const keep = useCallback55(
|
|
38522
38537
|
async (next) => {
|
|
38523
38538
|
queue.current = next;
|
|
@@ -39048,7 +39063,7 @@ function useEmbedHandshake(args) {
|
|
|
39048
39063
|
|
|
39049
39064
|
// src/TablePage.tsx
|
|
39050
39065
|
import { copyText as copyText13 } from "@ai-matrx/kit/clipboard";
|
|
39051
|
-
import { useCallback as useCallback60, useEffect as useEffect105, useMemo as useMemo72, useRef as
|
|
39066
|
+
import { useCallback as useCallback60, useEffect as useEffect105, useMemo as useMemo72, useRef as useRef53, useState as useState120 } from "react";
|
|
39052
39067
|
import { archivedByLine as archivedByLine2 } from "@ai-matrx/records";
|
|
39053
39068
|
import { tableShapeChanged as tableShapeChanged11, useFields as useFields34, useRecordsClient as useRecordsClient92, useSeededAnswer, useTable as useTable36, useTableArchive as useTableArchive2 } from "@ai-matrx/records/react";
|
|
39054
39069
|
import {
|
|
@@ -39569,7 +39584,7 @@ function TableDuplicateDialog({ tableId, name, organizationId, open, onOpenChang
|
|
|
39569
39584
|
onProgress: (progress) => setPhase({ kind: "copying", progress })
|
|
39570
39585
|
});
|
|
39571
39586
|
if (!made.ok) {
|
|
39572
|
-
setPhase({ kind: "refused", sentence:
|
|
39587
|
+
setPhase({ kind: "refused", sentence: refusalSaid(made.error), timedOut: refusalTimedOut(made.error) });
|
|
39573
39588
|
return;
|
|
39574
39589
|
}
|
|
39575
39590
|
tableShapeChanged10(made.data.table.id);
|
|
@@ -39623,6 +39638,7 @@ function TableDuplicateDialog({ tableId, name, organizationId, open, onOpenChang
|
|
|
39623
39638
|
] }),
|
|
39624
39639
|
phase.kind === "copying" ? /* @__PURE__ */ jsx127("p", { className: "text-xs text-muted-foreground", "data-table-duplicate-progress": "", children: phase.progress ? duplicateProgressWords(phase.progress) : "Starting the copy\u2026" }) : null,
|
|
39625
39640
|
phase.kind === "refused" ? /* @__PURE__ */ jsx127(ErrorBox4, { children: phase.sentence }) : null,
|
|
39641
|
+
phase.kind === "refused" && phase.timedOut ? /* @__PURE__ */ jsx127(Button97, { variant: "outline", size: "sm", className: "self-start", "data-refusal-retry": "", onClick: () => void go(), children: "Try again" }) : null,
|
|
39626
39642
|
problem && typed2 !== "" ? /* @__PURE__ */ jsx127("p", { className: "text-xs text-muted-foreground", children: problem }) : null
|
|
39627
39643
|
] }),
|
|
39628
39644
|
/* @__PURE__ */ jsx127(DialogFooter13, { children: phase.kind === "done" ? /* @__PURE__ */ jsx127(Button97, { onClick: () => openCopy(phase.copy), "data-table-duplicate-open": "", children: "Open the copy" }) : /* @__PURE__ */ jsxs120(Fragment56, { children: [
|
|
@@ -39855,7 +39871,7 @@ function phoneTableActions(actions) {
|
|
|
39855
39871
|
}
|
|
39856
39872
|
|
|
39857
39873
|
// src/presence.tsx
|
|
39858
|
-
import { useEffect as useEffect103, useMemo as useMemo71, useRef as
|
|
39874
|
+
import { useEffect as useEffect103, useMemo as useMemo71, useRef as useRef52, useState as useState118, useSyncExternalStore as useSyncExternalStore4 } from "react";
|
|
39859
39875
|
import { jsx as jsx130, jsxs as jsxs123 } from "react/jsx-runtime";
|
|
39860
39876
|
var NO_PEOPLE = [];
|
|
39861
39877
|
var MAX_AVATARS = 4;
|
|
@@ -39902,7 +39918,7 @@ function TablePresence({ tableId }) {
|
|
|
39902
39918
|
const { session, people: published } = useTablePresence(tableId);
|
|
39903
39919
|
const roster = useMemberRoster();
|
|
39904
39920
|
const people = useMemo71(() => namePeople(published, roster), [published, roster]);
|
|
39905
|
-
const root =
|
|
39921
|
+
const root = useRef52(null);
|
|
39906
39922
|
const css = useMemo71(() => presenceOutlineCss(people), [people]);
|
|
39907
39923
|
useEffect103(() => {
|
|
39908
39924
|
if (!session || typeof MutationObserver === "undefined") return;
|
|
@@ -40492,7 +40508,7 @@ function TablePage({
|
|
|
40492
40508
|
return seededViews.find((v) => v.id === asked2) ?? defaultViewOf(seededViews) ?? seededViews[0];
|
|
40493
40509
|
});
|
|
40494
40510
|
const [looks, setLooks] = useState120(() => seededViews ? seededOpening?.looks : void 0);
|
|
40495
|
-
const looksSeededFor =
|
|
40511
|
+
const looksSeededFor = useRef53(seededViews && seededOpening ? tableId : null);
|
|
40496
40512
|
useEffect105(() => {
|
|
40497
40513
|
if (looksSeededFor.current === tableId) {
|
|
40498
40514
|
looksSeededFor.current = null;
|
|
@@ -40520,7 +40536,7 @@ function TablePage({
|
|
|
40520
40536
|
const opened = questionsFromLink ? { ...openedByPackage, main: "questions" } : formFromLink ? { ...openedByPackage, main: "form" } : openedByPackage;
|
|
40521
40537
|
const [views, setViews] = useState120(() => seededViews);
|
|
40522
40538
|
const [pickedViewId, setPickedViewId] = useState120(savedFromLink);
|
|
40523
|
-
const viewSeen =
|
|
40539
|
+
const viewSeen = useRef53(null);
|
|
40524
40540
|
const [viewLinkMissed, setViewLinkMissed] = useState120(false);
|
|
40525
40541
|
const railAsked = typeof activeRail === "string" ? activeRail.trim() : "";
|
|
40526
40542
|
const railUnknown = railAsked !== "" && railFromParam(railAsked) === null ? railAsked : null;
|
|
@@ -40550,7 +40566,7 @@ function TablePage({
|
|
|
40550
40566
|
const { open: renameOpen, setOpen: setRenameOpen, ask: askRename, menuContentProps: renameMenuProps } = useRenameFromMenu();
|
|
40551
40567
|
const [archiveAsked, setArchiveAsked] = useState120(0);
|
|
40552
40568
|
const pageArchive = useTableArchive2(tableId);
|
|
40553
|
-
const archiveRunning =
|
|
40569
|
+
const archiveRunning = useRef53(false);
|
|
40554
40570
|
const archiveFromMenu = useCallback60(async () => {
|
|
40555
40571
|
if (archiveRunning.current) return;
|
|
40556
40572
|
archiveRunning.current = true;
|
|
@@ -40585,6 +40601,20 @@ function TablePage({
|
|
|
40585
40601
|
const [duplicateOpen, setDuplicateOpen] = useState120(false);
|
|
40586
40602
|
const [referenceOpen, setReferenceOpen] = useState120(false);
|
|
40587
40603
|
const [subscribeOpen, setSubscribeOpen] = useState120(false);
|
|
40604
|
+
const subscribeDateKey = shown4?.dateField ?? (shown4?.layout === "calendar" && allFields.data ? eligibleFieldFor("date", allFields.data, null).field?.key ?? null : null);
|
|
40605
|
+
const subscribeInCalendar = async () => {
|
|
40606
|
+
const current = view;
|
|
40607
|
+
if (!current || !subscribeDateKey) return;
|
|
40608
|
+
if (current.dateField !== subscribeDateKey) {
|
|
40609
|
+
const written = await saveViewPatch(client, tableId, current.id, { dateField: subscribeDateKey });
|
|
40610
|
+
if (!written.ok) {
|
|
40611
|
+
recordsUi.notify?.error(refusalSentence(written.error));
|
|
40612
|
+
return;
|
|
40613
|
+
}
|
|
40614
|
+
setView({ ...current, dateField: subscribeDateKey });
|
|
40615
|
+
}
|
|
40616
|
+
setSubscribeOpen(true);
|
|
40617
|
+
};
|
|
40588
40618
|
const [breakDownOpen, setBreakDownOpen] = useState120(false);
|
|
40589
40619
|
const canGetReference = useCanGetReference();
|
|
40590
40620
|
const [toolbarSlot, setToolbarSlot] = useState120(null);
|
|
@@ -40631,7 +40661,7 @@ function TablePage({
|
|
|
40631
40661
|
lookDiffers: view ? lookDiffers(view, look) : false
|
|
40632
40662
|
};
|
|
40633
40663
|
const shownSignature = JSON.stringify(shownReport);
|
|
40634
|
-
const reportRef =
|
|
40664
|
+
const reportRef = useRef53(onShownViewChange);
|
|
40635
40665
|
reportRef.current = onShownViewChange;
|
|
40636
40666
|
useEffect105(() => {
|
|
40637
40667
|
reportRef.current?.(JSON.parse(shownSignature));
|
|
@@ -40642,8 +40672,8 @@ function TablePage({
|
|
|
40642
40672
|
onViewChanged?.(addressForView(view, next));
|
|
40643
40673
|
void patchView({ layout: next });
|
|
40644
40674
|
};
|
|
40645
|
-
const reportedRecords =
|
|
40646
|
-
const lastActiveRecord =
|
|
40675
|
+
const reportedRecords = useRef53(/* @__PURE__ */ new Set());
|
|
40676
|
+
const lastActiveRecord = useRef53(activeRecordId ?? null);
|
|
40647
40677
|
useEffect105(() => {
|
|
40648
40678
|
const before = lastActiveRecord.current;
|
|
40649
40679
|
lastActiveRecord.current = activeRecordId ?? null;
|
|
@@ -40666,7 +40696,7 @@ function TablePage({
|
|
|
40666
40696
|
if (rail !== "record") setRecordFull(false);
|
|
40667
40697
|
}, [rail]);
|
|
40668
40698
|
const shownRecord = rail === "record" ? openRecord : null;
|
|
40669
|
-
const reportedRecord =
|
|
40699
|
+
const reportedRecord = useRef53(activeRecordId ?? null);
|
|
40670
40700
|
useEffect105(() => {
|
|
40671
40701
|
if (shownRecord === reportedRecord.current) return;
|
|
40672
40702
|
const how = shownRecord === null ? "close" : reportedRecord.current === null ? "open" : "step";
|
|
@@ -40725,7 +40755,7 @@ function TablePage({
|
|
|
40725
40755
|
},
|
|
40726
40756
|
[client, tableId, view, looks, viewLocked, sayLocked]
|
|
40727
40757
|
);
|
|
40728
|
-
const arrival =
|
|
40758
|
+
const arrival = useRef53(viewAddress ?? null);
|
|
40729
40759
|
const [gridQuery, setGridQuery] = useState120(null);
|
|
40730
40760
|
const [addressResetEpoch, setAddressResetEpoch] = useState120(0);
|
|
40731
40761
|
const reportGrid = useCallback60((q) => {
|
|
@@ -40736,7 +40766,7 @@ function TablePage({
|
|
|
40736
40766
|
() => ({ initial: arrival.current, report: reportGrid, resetEpoch: addressResetEpoch }),
|
|
40737
40767
|
[reportGrid, addressResetEpoch]
|
|
40738
40768
|
);
|
|
40739
|
-
const hiddenApplied =
|
|
40769
|
+
const hiddenApplied = useRef53(false);
|
|
40740
40770
|
useEffect105(() => {
|
|
40741
40771
|
const hidden = arrival.current?.hidden;
|
|
40742
40772
|
if (hiddenApplied.current || !view || !looks || !hidden || hidden.length === 0) return;
|
|
@@ -40757,9 +40787,9 @@ function TablePage({
|
|
|
40757
40787
|
const gridPending = !isViewAddressEmpty({ ...arrival.current ?? {}, hidden: [] });
|
|
40758
40788
|
const addressReady = Boolean(view && looks) && (gridQuery !== null || !gridPending);
|
|
40759
40789
|
const addressSignature = JSON.stringify(viewAddressToParams(addressNow));
|
|
40760
|
-
const addressReportRef =
|
|
40790
|
+
const addressReportRef = useRef53(onViewAddressChange);
|
|
40761
40791
|
addressReportRef.current = onViewAddressChange;
|
|
40762
|
-
const addressSent =
|
|
40792
|
+
const addressSent = useRef53(null);
|
|
40763
40793
|
useEffect105(() => {
|
|
40764
40794
|
if (!addressReady) return;
|
|
40765
40795
|
if (addressSent.current === null && addressSignature === JSON.stringify(viewAddressToParams(arrival.current))) {
|
|
@@ -41043,8 +41073,8 @@ function TablePage({
|
|
|
41043
41073
|
// THE PRIVATE CALENDAR LINK (CAL-FEED-UI): only where the host bound the doors.
|
|
41044
41074
|
...recordsUi.calendarFeed && organizationId ? [
|
|
41045
41075
|
subscribeCalendarAction({
|
|
41046
|
-
...mayDo.known && !mayDo.read ? { disabledReason: "Needs Viewer access" } : !view ? { disabledReason: NO_VIEW_REASON } : !
|
|
41047
|
-
run: () => void window.setTimeout(() =>
|
|
41076
|
+
...mayDo.known && !mayDo.read ? { disabledReason: "Needs Viewer access" } : !view ? { disabledReason: NO_VIEW_REASON } : !subscribeDateKey ? { disabledReason: shown4?.layout === "calendar" ? "This table has no date column" : "Switch this view to Calendar to subscribe" } : {},
|
|
41077
|
+
run: () => void window.setTimeout(() => void subscribeInCalendar(), 0)
|
|
41048
41078
|
})
|
|
41049
41079
|
] : [],
|
|
41050
41080
|
...actionHost?.extend ? actionHost.extend(subject, mayDo) : []
|
|
@@ -41082,9 +41112,9 @@ function TablePage({
|
|
|
41082
41112
|
}
|
|
41083
41113
|
});
|
|
41084
41114
|
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;
|
|
41085
|
-
const actionsRef =
|
|
41115
|
+
const actionsRef = useRef53(actions);
|
|
41086
41116
|
actionsRef.current = actions;
|
|
41087
|
-
const onActionsRef =
|
|
41117
|
+
const onActionsRef = useRef53(onActions);
|
|
41088
41118
|
onActionsRef.current = onActions;
|
|
41089
41119
|
useEffect105(() => {
|
|
41090
41120
|
onActionsRef.current?.(actionsRef.current);
|
|
@@ -41716,7 +41746,7 @@ function usePublicReadOnly(client, organizationId, tableId, table, rights) {
|
|
|
41716
41746
|
import { formatCount as formatCount8 } from "@ai-matrx/kit/format";
|
|
41717
41747
|
import { TapTargetSearchGroup as TapTargetSearchGroup2, TooltipProvider } from "@ai-matrx/design-system";
|
|
41718
41748
|
import { MatrxTableCardShowMore as MatrxTableCardShowMore3 } from "@ai-matrx/design-system/data-table";
|
|
41719
|
-
import { useEffect as useEffect106, useMemo as useMemo73, useRef as
|
|
41749
|
+
import { useEffect as useEffect106, useMemo as useMemo73, useRef as useRef54, useState as useState121 } from "react";
|
|
41720
41750
|
import { Button as Button100, ErrorBox as ErrorBox5, Input as Input12, cn as cn73 } from "@ai-matrx/design-system";
|
|
41721
41751
|
import { SEED_FRESH_MS, useRecordsClient as useRecordsClient93, useSeededAnswerAt } from "@ai-matrx/records/react";
|
|
41722
41752
|
import { Fragment as Fragment58, jsx as jsx132, jsxs as jsxs125 } from "react/jsx-runtime";
|
|
@@ -41824,7 +41854,7 @@ function EntityChartBlock({ source, kind: kind2, by, measure, title, where, orga
|
|
|
41824
41854
|
const base = { title: title ?? "", kind: kind2, measures, group_by: by ? [by] : [] };
|
|
41825
41855
|
const seeded = useSeededAnswerAt(`entity-chart:${ask2}`, (c) => c.drillAsk({ source, question }));
|
|
41826
41856
|
const [block, setBlock] = useState121(() => seeded ? blockOfAnswer({ ok: true, data: seeded.data }, base, by) : null);
|
|
41827
|
-
const seededFor =
|
|
41857
|
+
const seededFor = useRef54(seeded ? { ask: `${ask2}|${kind2}|${title ?? ""}`, at: seeded.at } : null);
|
|
41828
41858
|
useEffect106(() => {
|
|
41829
41859
|
const held = seededFor.current;
|
|
41830
41860
|
if (held && held.ask === `${ask2}|${kind2}|${title ?? ""}` && Date.now() - held.at < SEED_FRESH_MS) return;
|
|
@@ -42167,7 +42197,7 @@ function PreviewForms({ preview, booking }) {
|
|
|
42167
42197
|
}
|
|
42168
42198
|
|
|
42169
42199
|
// src/SectionCard.tsx
|
|
42170
|
-
import { useEffect as useEffect109, useRef as
|
|
42200
|
+
import { useEffect as useEffect109, useRef as useRef55, useState as useState125 } from "react";
|
|
42171
42201
|
import { atLeast } from "@ai-matrx/records/field-kinds";
|
|
42172
42202
|
import { useFields as useFields35, useRecordMutation as useRecordMutation3, useRecordPage as useRecordPage4, useRecordsClient as useRecordsClient95, useTable as useTable37 } from "@ai-matrx/records/react";
|
|
42173
42203
|
import {
|
|
@@ -42568,7 +42598,7 @@ function columnsOf(values) {
|
|
|
42568
42598
|
var same3 = (a, b) => JSON.stringify(a ?? null) === JSON.stringify(b ?? null);
|
|
42569
42599
|
function useDraft(stored, save) {
|
|
42570
42600
|
const [draft, setDraft] = useState125(null);
|
|
42571
|
-
const latest =
|
|
42601
|
+
const latest = useRef55({ draft, save, stored });
|
|
42572
42602
|
useEffect109(() => {
|
|
42573
42603
|
latest.current = { draft, save, stored };
|
|
42574
42604
|
});
|
|
@@ -42975,7 +43005,7 @@ function TableSectionCard(props) {
|
|
|
42975
43005
|
const rowNames = nameField ? rows.map((r) => String((r.document ?? {})[nameField.key] ?? "")).filter((n) => n !== "") : [];
|
|
42976
43006
|
const refused = table.error ?? fieldsRead.error ?? page.error;
|
|
42977
43007
|
const gridStyle = { gridTemplateColumns: `minmax(8rem, 12rem) repeat(${Math.max(columns.length, 1)}, minmax(0, 1fr)) 4.5rem` };
|
|
42978
|
-
const sectionRef =
|
|
43008
|
+
const sectionRef = useRef55(null);
|
|
42979
43009
|
const narrow = useNarrow2(sectionRef);
|
|
42980
43010
|
const cellLabel = (c) => c.part ? columns.filter((x) => x.field.key === c.field.key).map((x) => x.header).join(" \xB7 ") : c.header;
|
|
42981
43011
|
return /* @__PURE__ */ jsxs129("section", { ref: sectionRef, "data-records-section-card": "", "data-narrow": narrow ? "" : void 0, className: cn75("rounded-2xl border border-border bg-card text-card-foreground", className), children: [
|