@ai-matrx/records-ui 0.115.46 → 0.115.48
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 +12 -0
- package/dist/index.cjs +355 -96
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +465 -206
- package/dist/index.js.map +1 -1
- package/dist/pickers.cjs +20 -9
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +20 -9
- package/dist/pickers.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -999,29 +999,29 @@ function clauseFor(f, value, now = /* @__PURE__ */ new Date()) {
|
|
|
999
999
|
}
|
|
1000
1000
|
case "select": {
|
|
1001
1001
|
const ticked = value.values ?? (value.value === "" ? [] : [value.value]);
|
|
1002
|
-
const
|
|
1002
|
+
const blank2 = ticked.includes(BLANK_VALUE);
|
|
1003
1003
|
const words2 = ticked.filter((w) => w !== BLANK_VALUE);
|
|
1004
|
-
if (!
|
|
1004
|
+
if (!blank2 && words2.length === 0) return value.negated ? null : { rule: constant(false) };
|
|
1005
1005
|
const present = op("present", field(f));
|
|
1006
1006
|
const kind = String(editorKindFor(f));
|
|
1007
1007
|
if (kind === "datetime" || kind === "date") {
|
|
1008
1008
|
if (words2.length === 0) return { rule: value.negated ? present : not(present) };
|
|
1009
1009
|
const holdsDays = String((f.config ?? {})["kind"] ?? "") === "date";
|
|
1010
|
-
if (words2.length === 1 && !
|
|
1010
|
+
if (words2.length === 1 && !blank2 && !value.negated) return { flat: { [f.key]: dayWindow(words2[0], holdsDays) } };
|
|
1011
1011
|
const leaves = words2.map((day2) => withinWindow(f, dayWindow(day2, holdsDays)));
|
|
1012
1012
|
const anyDay = leaves.length === 1 ? leaves[0] : op("or", ...leaves);
|
|
1013
|
-
if (!value.negated) return { rule:
|
|
1014
|
-
return { rule:
|
|
1013
|
+
if (!value.negated) return { rule: blank2 ? op("or", not(present), anyDay) : anyDay };
|
|
1014
|
+
return { rule: blank2 ? op("and", present, not(anyDay)) : not(anyDay) };
|
|
1015
1015
|
}
|
|
1016
1016
|
const asStored = (w) => holdsNumbers(f) || kind === "rating" ? Number.isFinite(Number(w)) ? Number(w) : w : kind === "checkbox" && (w === "true" || w === "false") ? w === "true" : w;
|
|
1017
1017
|
const stored = words2.map(asStored);
|
|
1018
1018
|
const anyWord = stored.length === 0 ? null : stored.length === 1 ? op("eq", field(f), constant(stored[0])) : op("or", ...stored.map((w) => op("eq", field(f), constant(w))));
|
|
1019
1019
|
if (!value.negated) {
|
|
1020
|
-
if (!
|
|
1021
|
-
if (!
|
|
1020
|
+
if (!blank2 && stored.length === 1) return { flat: { [f.key]: stored[0] } };
|
|
1021
|
+
if (!blank2) return { rule: anyWord };
|
|
1022
1022
|
return { rule: anyWord ? op("or", not(present), anyWord) : not(present) };
|
|
1023
1023
|
}
|
|
1024
|
-
if (
|
|
1024
|
+
if (blank2) return { rule: anyWord ? op("and", present, not(anyWord)) : present };
|
|
1025
1025
|
return { rule: op("or", not(present), not(anyWord)) };
|
|
1026
1026
|
}
|
|
1027
1027
|
case "boolean":
|
|
@@ -2030,14 +2030,24 @@ function RefusalLine({ error, className }) {
|
|
|
2030
2030
|
// src/FieldRetype.tsx
|
|
2031
2031
|
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
2032
2032
|
var RETYPE_TARGETS = [
|
|
2033
|
-
{ id: "text", behaviour: "text", kind: null, label: "Text", holds: "words" },
|
|
2034
|
-
{ id: "number", behaviour: "range", kind: "number", label: "Number", holds: "a number" },
|
|
2033
|
+
{ id: "text", behaviour: "text", kind: null, label: "Text", holds: "words", via: "behaviour" },
|
|
2034
|
+
{ id: "number", behaviour: "range", kind: "number", label: "Number", holds: "a number", via: "behaviour" },
|
|
2035
2035
|
// A DATE is a `range` of kind date: `migrate_retype` alone cannot say "date" (it keeps the old
|
|
2036
2036
|
// kind, so every date would be kept aside), so this one goes through `custom.field_update`'s own
|
|
2037
2037
|
// retype arm (`parity_type: datetime`), which converts on the SAME trigger and keeps what does not
|
|
2038
2038
|
// fit in `_retired` with the reason — measured on the live store 2026-09-28.
|
|
2039
|
-
{ id: "date", behaviour: "range", kind: "date", label: "Date", holds: "a date" },
|
|
2040
|
-
{ id: "checkbox", behaviour: "boolean", kind: null, label: "Yes / no", holds: "a yes or a no" }
|
|
2039
|
+
{ id: "date", behaviour: "range", kind: "date", label: "Date", holds: "a date", via: "kind", parity: "datetime" },
|
|
2040
|
+
{ id: "checkbox", behaviour: "boolean", kind: null, label: "Yes / no", holds: "a yes or a no", via: "behaviour" },
|
|
2041
|
+
// THE REST OF WHAT THE STORE'S RETYPE TAKES (walk 2026-10-10: a text column could only become Number,
|
|
2042
|
+
// Date or Yes/no, so it could not become a Choice, Phone, Email or Link — the Sheet allowed any
|
|
2043
|
+
// kind the values convert to). All go through `custom.field_update`'s `parity_type` arm, the same
|
|
2044
|
+
// conversion trigger, which keeps what does not fit in `_retired` with the reason.
|
|
2045
|
+
{ id: "email", behaviour: "text", kind: null, label: "Email address", holds: "email addresses", via: "kind", parity: "email" },
|
|
2046
|
+
{ id: "phone", behaviour: "text", kind: null, label: "Phone number", holds: "phone numbers", via: "kind", parity: "phone" },
|
|
2047
|
+
{ id: "url", behaviour: "text", kind: null, label: "Link", holds: "web addresses", via: "kind", parity: "url" },
|
|
2048
|
+
{ id: "currency", behaviour: "range", kind: "number", label: "Money", holds: "an amount of money", via: "kind", parity: "currency" },
|
|
2049
|
+
{ id: "percent", behaviour: "range", kind: "number", label: "Percentage", holds: "a percentage", via: "kind", parity: "percent" },
|
|
2050
|
+
{ id: "select", behaviour: "text", kind: null, label: "Choice", holds: "one choice from a list", via: "kind", parity: "select" }
|
|
2041
2051
|
];
|
|
2042
2052
|
var PREVIEW_GROUPS = 1e3;
|
|
2043
2053
|
function retypeableFrom(field2) {
|
|
@@ -2059,6 +2069,7 @@ function currentTarget(field2) {
|
|
|
2059
2069
|
const kind = String(editorKindFor(field2));
|
|
2060
2070
|
if (String(field2.type) === "boolean") return "checkbox";
|
|
2061
2071
|
if (kind === "datetime" || kind === "date") return "date";
|
|
2072
|
+
if (kind === "email" || kind === "phone" || kind === "url" || kind === "currency" || kind === "percent") return kind;
|
|
2062
2073
|
if (String(field2.type) === "range") return "number";
|
|
2063
2074
|
return "text";
|
|
2064
2075
|
}
|
|
@@ -2102,8 +2113,8 @@ function FieldRetype({ field: field2, tableId, onRetyped }) {
|
|
|
2102
2113
|
setRefusal(null);
|
|
2103
2114
|
let holding;
|
|
2104
2115
|
let aside;
|
|
2105
|
-
if (to.
|
|
2106
|
-
const done = await client.fieldUpdate({ field_id: field2.id, patch: { parity_type:
|
|
2116
|
+
if (to.via !== "behaviour") {
|
|
2117
|
+
const done = await client.fieldUpdate({ field_id: field2.id, patch: { parity_type: to.parity } });
|
|
2107
2118
|
setBusy(false);
|
|
2108
2119
|
if (!done.ok) {
|
|
2109
2120
|
setRefusal(done.error);
|
|
@@ -5360,7 +5371,7 @@ function FormulaTextEditor({
|
|
|
5360
5371
|
value: text,
|
|
5361
5372
|
rows: 2,
|
|
5362
5373
|
"aria-label": "The formula",
|
|
5363
|
-
placeholder:
|
|
5374
|
+
placeholder: columns.length > 0 ? `{${fieldName(columns[0])}}` : "Write a formula",
|
|
5364
5375
|
className: "font-mono text-xs",
|
|
5365
5376
|
onChange: (e) => onText(e.target.value)
|
|
5366
5377
|
}
|
|
@@ -8909,7 +8920,7 @@ function FieldEditor(props) {
|
|
|
8909
8920
|
const statusGroupsSent = Object.fromEntries(shownStatusRows.filter((r) => !editing || r.ref in statusGroups || !(r.ref in statusKeys)).map((r) => [r.ref, r.group]));
|
|
8910
8921
|
const statusGroupsChanged = type === "status" && editing && Object.keys(statusGroupsSent).length > 0;
|
|
8911
8922
|
const formulaChanged = formulaText.trim() !== startingFormulaText.trim();
|
|
8912
|
-
const formulaMissing = type !== "formula" || !formulaWritten ? null : editing && !formulaChanged ? null : formulaText.trim() === "" ? "Write the formula
|
|
8923
|
+
const formulaMissing = type !== "formula" || !formulaWritten ? null : editing && !formulaChanged ? null : formulaText.trim() === "" ? "Write the formula" : formulaOk === false ? "The formula has a mistake \u2014 it is marked above." : formulaOk === null ? "Checking the formula\u2026" : null;
|
|
8913
8924
|
const noun = onEntity ? "field" : "column";
|
|
8914
8925
|
const nameTaken = columnNameTakenBy(label, others.map(fieldName));
|
|
8915
8926
|
const nameLine = nameTaken ? columnNameTakenLine(nameTaken, noun) : columnNameProblemLine(label, noun);
|
|
@@ -9515,7 +9526,7 @@ function FieldEditor(props) {
|
|
|
9515
9526
|
Button17,
|
|
9516
9527
|
{
|
|
9517
9528
|
size: "sm",
|
|
9518
|
-
disabled: mutation.saving || Boolean(formulaMissing),
|
|
9529
|
+
disabled: mutation.saving || Boolean(formulaMissing) || Boolean(nameLine) && label.trim() !== (field2?.label ?? "").trim(),
|
|
9519
9530
|
...missingShown ? { "aria-describedby": "field-editor-missing" } : {},
|
|
9520
9531
|
onClick: () => {
|
|
9521
9532
|
if (missing) {
|
|
@@ -17701,6 +17712,7 @@ function useMergedGridControls(args) {
|
|
|
17701
17712
|
/* @__PURE__ */ jsx63(
|
|
17702
17713
|
Dialog11,
|
|
17703
17714
|
{
|
|
17715
|
+
modal: true,
|
|
17704
17716
|
open: dialog?.kind === "retype",
|
|
17705
17717
|
onOpenChange: (open) => {
|
|
17706
17718
|
if (!open) close();
|
|
@@ -21453,7 +21465,10 @@ var IMPORT_KINDS = [
|
|
|
21453
21465
|
{ kind: "date", label: "Date" },
|
|
21454
21466
|
{ kind: "number", label: "Number" },
|
|
21455
21467
|
{ kind: "currency", label: "Money" },
|
|
21456
|
-
{ kind: "checkbox", label: "Checkbox" }
|
|
21468
|
+
{ kind: "checkbox", label: "Checkbox" },
|
|
21469
|
+
{ kind: "email", label: "Email" },
|
|
21470
|
+
{ kind: "phone", label: "Phone" },
|
|
21471
|
+
{ kind: "url", label: "Link" }
|
|
21457
21472
|
];
|
|
21458
21473
|
function importKindOfPlan(type) {
|
|
21459
21474
|
if (type === "text" || type === "long_text") return "text";
|
|
@@ -21461,6 +21476,7 @@ function importKindOfPlan(type) {
|
|
|
21461
21476
|
if (type === "number" || type === "range" || type === "integer" || type === "decimal") return "number";
|
|
21462
21477
|
if (type === "currency") return "currency";
|
|
21463
21478
|
if (type === "checkbox" || type === "boolean") return "checkbox";
|
|
21479
|
+
if (type === "email" || type === "phone" || type === "url") return type;
|
|
21464
21480
|
return null;
|
|
21465
21481
|
}
|
|
21466
21482
|
function declarationFor(kind) {
|
|
@@ -21498,6 +21514,19 @@ function exactDuplicateRows(rows, headers) {
|
|
|
21498
21514
|
});
|
|
21499
21515
|
return out;
|
|
21500
21516
|
}
|
|
21517
|
+
var EMAIL = /^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/;
|
|
21518
|
+
var PHONE = /^\+?[\d\s().-]{7,20}$/;
|
|
21519
|
+
var URLISH = /^(https?:\/\/|www\.)\S+$/i;
|
|
21520
|
+
function looksLike(rows, header) {
|
|
21521
|
+
const cells = rows.map((r) => String(r[header] ?? "").trim()).filter((c) => c !== "");
|
|
21522
|
+
if (cells.length < 2) return null;
|
|
21523
|
+
const share = (test) => cells.filter(test).length / cells.length;
|
|
21524
|
+
if (share((c) => EMAIL.test(c)) >= 0.6) return "email";
|
|
21525
|
+
if (share((c) => URLISH.test(c)) >= 0.6) return "url";
|
|
21526
|
+
const isPhone = (c) => PHONE.test(c) && /[\d]/.test(c) && c.replace(/\D/g, "").length >= 7 && c.replace(/\D/g, "").length <= 15 && /[()\s.+-]/.test(c);
|
|
21527
|
+
if (share(isPhone) >= 0.6) return "phone";
|
|
21528
|
+
return null;
|
|
21529
|
+
}
|
|
21501
21530
|
|
|
21502
21531
|
// src/importCombine.ts
|
|
21503
21532
|
import { relationNameKey } from "@ai-matrx/records";
|
|
@@ -22102,6 +22131,7 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
|
|
|
22102
22131
|
for (const c of plan?.columns ?? []) {
|
|
22103
22132
|
const k = importKindOfPlan(c.type);
|
|
22104
22133
|
out[c.header] = (k === "text" || c.type === "select") && looksLikeDates(effectiveRows, c.header) ? "date" : k;
|
|
22134
|
+
if (out[c.header] === "text") out[c.header] = looksLike(effectiveRows, c.header) ?? "text";
|
|
22105
22135
|
if (combined?.multiValued.has(c.header) && (k === null || c.type === "select")) out[c.header] = "text";
|
|
22106
22136
|
}
|
|
22107
22137
|
return out;
|
|
@@ -22282,6 +22312,25 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
|
|
|
22282
22312
|
}
|
|
22283
22313
|
setColumnsAdded(added);
|
|
22284
22314
|
}
|
|
22315
|
+
if (makesColumns && plan) {
|
|
22316
|
+
const wantedKeys = plan.columns.map((c) => c.header).filter((h) => !leftOut.has(h)).map((h) => sendMapping[h]).filter((k) => Boolean(k));
|
|
22317
|
+
const now = await client.fields({ table_id: tableId });
|
|
22318
|
+
if (now.ok) {
|
|
22319
|
+
const order = new Map(wantedKeys.map((k, i) => [k, i]));
|
|
22320
|
+
const current = now.data.filter((f) => order.has(f.key)).sort((a, b) => (a.sort ?? 0) - (b.sort ?? 0)).map((f) => f.key);
|
|
22321
|
+
const inFileOrder = current.every((k, i) => k === wantedKeys.filter((w) => current.includes(w))[i]);
|
|
22322
|
+
if (!inFileOrder) {
|
|
22323
|
+
const slots = now.data.filter((f) => order.has(f.key)).map((f) => f.sort ?? 0).sort((a, b) => a - b);
|
|
22324
|
+
const byKey = new Map(now.data.map((f) => [f.key, f]));
|
|
22325
|
+
const present = wantedKeys.filter((k) => byKey.has(k));
|
|
22326
|
+
for (let i = 0; i < present.length; i += 1) {
|
|
22327
|
+
const f = byKey.get(present[i]);
|
|
22328
|
+
const to = slots[i] ?? (i + 1) * 10;
|
|
22329
|
+
if ((f.sort ?? 0) !== to) await client.fieldUpdate({ field_id: f.id, patch: { sort: to } });
|
|
22330
|
+
}
|
|
22331
|
+
}
|
|
22332
|
+
}
|
|
22333
|
+
}
|
|
22285
22334
|
setPhase("writing");
|
|
22286
22335
|
const opened = await client.importBegin({
|
|
22287
22336
|
table_id: tableId,
|
|
@@ -23502,9 +23551,9 @@ var PERCENT = /^[+-]?\d+(?:\.\d+)?\s?%$/;
|
|
|
23502
23551
|
var ISO_DATE = /^\d{4}-\d{2}-\d{2}(?:[T ]\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(?:Z|[+-]\d{2}:?\d{2})?)?$/;
|
|
23503
23552
|
var SLASH_DATE = /^\d{1,2}\/\d{1,2}\/\d{2,4}$/;
|
|
23504
23553
|
var WORD_DATE = /^(?:\d{1,2}\s+)?(?:jan|feb|mar|apr|may|jun|jul|aug|sep|sept|oct|nov|dec)[a-z]*\.?\s+\d{1,2}(?:st|nd|rd|th)?,?\s+\d{4}$|^\d{1,2}\s+(?:jan|feb|mar|apr|may|jun|jul|aug|sep|sept|oct|nov|dec)[a-z]*\.?\s+\d{4}$/i;
|
|
23505
|
-
var
|
|
23554
|
+
var EMAIL2 = /^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/;
|
|
23506
23555
|
var URL_WORD = /^https?:\/\/\S+$/i;
|
|
23507
|
-
var
|
|
23556
|
+
var PHONE2 = /^\+?[\d\s().-]{7,20}$/;
|
|
23508
23557
|
var YES = /* @__PURE__ */ new Set(["yes", "true", "y", "\u2713", "\u2714", "checked", "done"]);
|
|
23509
23558
|
var NO = /* @__PURE__ */ new Set(["no", "false", "n", "\u2717", "\u2718", "unchecked", ""]);
|
|
23510
23559
|
function isDate(v) {
|
|
@@ -23524,9 +23573,9 @@ function guessColumn(values) {
|
|
|
23524
23573
|
}
|
|
23525
23574
|
if (every((v) => PERCENT.test(v))) return { type: "percent" };
|
|
23526
23575
|
if (every(isDate)) return { type: "datetime", kind: every((v) => !/\d:\d/.test(v)) ? "date" : "datetime" };
|
|
23527
|
-
if (every((v) =>
|
|
23576
|
+
if (every((v) => EMAIL2.test(v))) return { type: "email" };
|
|
23528
23577
|
if (every((v) => URL_WORD.test(v))) return { type: "url" };
|
|
23529
|
-
if (every((v) =>
|
|
23578
|
+
if (every((v) => PHONE2.test(v) && (v.match(/\d/g)?.length ?? 0) >= 7)) return { type: "phone" };
|
|
23530
23579
|
if (filled.some((v) => v.length > 120 || v.includes("\n"))) return { type: "long_text" };
|
|
23531
23580
|
const distinct = [];
|
|
23532
23581
|
for (const v of filled) if (!distinct.some((d) => d.toLowerCase() === v.toLowerCase())) distinct.push(v);
|
|
@@ -23883,7 +23932,7 @@ function noValueList(columnId2) {
|
|
|
23883
23932
|
}
|
|
23884
23933
|
function facetsFromGroups(columnId2, key, rows, limit, distinctCount, order = "count") {
|
|
23885
23934
|
const counts = /* @__PURE__ */ new Map();
|
|
23886
|
-
let
|
|
23935
|
+
let blank2 = 0;
|
|
23887
23936
|
let total = 0;
|
|
23888
23937
|
let maxLength = 0;
|
|
23889
23938
|
let unlistable = 0;
|
|
@@ -23894,7 +23943,7 @@ function facetsFromGroups(columnId2, key, rows, limit, distinctCount, order = "c
|
|
|
23894
23943
|
const said2 = raw === null || raw === void 0 ? "" : String(raw).trim();
|
|
23895
23944
|
const text = order === "newest" && /^\d{4}-\d{2}-\d{2}/.test(said2) ? said2.slice(0, 10) : said2;
|
|
23896
23945
|
if (text === "") {
|
|
23897
|
-
|
|
23946
|
+
blank2 += n;
|
|
23898
23947
|
continue;
|
|
23899
23948
|
}
|
|
23900
23949
|
maxLength = Math.max(maxLength, text.length);
|
|
@@ -23912,8 +23961,8 @@ function facetsFromGroups(columnId2, key, rows, limit, distinctCount, order = "c
|
|
|
23912
23961
|
return {
|
|
23913
23962
|
columnId: columnId2,
|
|
23914
23963
|
totalRows: total,
|
|
23915
|
-
filled: total -
|
|
23916
|
-
blank,
|
|
23964
|
+
filled: total - blank2,
|
|
23965
|
+
blank: blank2,
|
|
23917
23966
|
distinctCount: known,
|
|
23918
23967
|
maxLength,
|
|
23919
23968
|
unlistable,
|
|
@@ -24023,7 +24072,18 @@ function useGroupFacts(args) {
|
|
|
24023
24072
|
}, [client, tableId, groupKey, chosenKey, filterKey, version]);
|
|
24024
24073
|
return facts;
|
|
24025
24074
|
}
|
|
24075
|
+
function yesNoGroupWords(field2, value) {
|
|
24076
|
+
const answer = value === true || value === "true" ? true : value === false || value === "false" ? false : null;
|
|
24077
|
+
if (answer === null) return null;
|
|
24078
|
+
const name = (field2.label || field2.key).trim();
|
|
24079
|
+
return answer ? `\u2713 ${name}` : `\u2014 Not ${name.charAt(0).toLowerCase()}${name.slice(1)}`;
|
|
24080
|
+
}
|
|
24026
24081
|
function GroupLabel({ field: field2, value, withheld = null }) {
|
|
24082
|
+
if (field2 && editorKindFor(field2) === "checkbox") {
|
|
24083
|
+
if (groupValueKey(value) === "") return /* @__PURE__ */ jsx81("span", { className: "text-muted-foreground", "data-records-group-label": "", children: "Not answered" });
|
|
24084
|
+
const words2 = yesNoGroupWords(field2, value);
|
|
24085
|
+
if (words2) return /* @__PURE__ */ jsx81("span", { "data-records-group-label": "", children: words2 });
|
|
24086
|
+
}
|
|
24027
24087
|
if (groupValueKey(value) === "" && !(field2 && withheld)) return /* @__PURE__ */ jsx81("span", { className: "text-muted-foreground", children: "No value" });
|
|
24028
24088
|
if (!field2) return /* @__PURE__ */ jsx81("span", { children: String(value) });
|
|
24029
24089
|
return /* @__PURE__ */ jsx81("span", { className: "inline-flex min-w-0 items-center", "data-records-group-label": "", children: /* @__PURE__ */ jsx81(RecordValue, { inCell: true, field: field2, value, format: formatForField(field2), withheld }) });
|
|
@@ -24057,11 +24117,16 @@ function groupFactsFor(facts, fields, chosen) {
|
|
|
24057
24117
|
return { count: fact.count, aggregates };
|
|
24058
24118
|
};
|
|
24059
24119
|
}
|
|
24060
|
-
function useGroupLabel(fields, groupKey) {
|
|
24120
|
+
function useGroupLabel(fields, groupKey, thenKeys = []) {
|
|
24121
|
+
const thenJoined = thenKeys.join("|");
|
|
24061
24122
|
return useMemo34(() => {
|
|
24062
|
-
const
|
|
24063
|
-
return (group) =>
|
|
24064
|
-
|
|
24123
|
+
const keys = groupKey ? [groupKey, ...thenJoined ? thenJoined.split("|") : []] : [];
|
|
24124
|
+
return (group) => {
|
|
24125
|
+
const key = keys[group.ancestors?.length ?? 0] ?? groupKey;
|
|
24126
|
+
const field2 = key ? fields.find((f) => f.key === key) : void 0;
|
|
24127
|
+
return /* @__PURE__ */ jsx81(GroupLabel, { field: field2, value: group.value, withheld: key ? groupWithheldNotice(group.rows, key, group.value) : null });
|
|
24128
|
+
};
|
|
24129
|
+
}, [fields, groupKey, thenJoined]);
|
|
24065
24130
|
}
|
|
24066
24131
|
|
|
24067
24132
|
// src/gridUndo.tsx
|
|
@@ -25842,7 +25907,7 @@ function GridBody({
|
|
|
25842
25907
|
const summaries = useColumnSummaries({ tableId, chosen: chosenSummaries, filter: readFilter, version: summaryVersion });
|
|
25843
25908
|
const drillConfig = useGridDrillConfig({ tableId, state: drillState, presentation, onPresentationChange, version: records.data });
|
|
25844
25909
|
const groupFacts = useGroupFacts({ tableId, groupKey: rowGroupKey, chosen: chosenSummaries, filter: readFilter, version: summaryVersion });
|
|
25845
|
-
const groupLabel2 = useGroupLabel(fields.data ?? [], rowGroupKey);
|
|
25910
|
+
const groupLabel2 = useGroupLabel(fields.data ?? [], rowGroupKey, (presentation.grouping?.then ?? []).map((t) => t.field));
|
|
25846
25911
|
const [duplicated, setDuplicated] = useState71(null);
|
|
25847
25912
|
const duplicate = useCallback28(
|
|
25848
25913
|
async (row) => {
|
|
@@ -26770,7 +26835,7 @@ function GridBody({
|
|
|
26770
26835
|
rowNoun: "record",
|
|
26771
26836
|
...thenKeys.length > 0 ? { thenColumnIds: thenKeys } : {},
|
|
26772
26837
|
...aggregates ? { aggregates } : {},
|
|
26773
|
-
...rowsGrouped ? { renderLabel:
|
|
26838
|
+
...rowsGrouped ? { renderLabel: groupLabel2, order: "first-seen", emptyLabel: "No value" } : {},
|
|
26774
26839
|
...facts ? { groupFacts: facts } : {},
|
|
26775
26840
|
...!rowsGrouped && view?.order ? { order: view.order } : {},
|
|
26776
26841
|
...view?.collapsed ? { collapsed: view.collapsed } : {},
|
|
@@ -28325,7 +28390,7 @@ import { Button as Button59, Skeleton as Skeleton10, cn as cn47 } from "@ai-matr
|
|
|
28325
28390
|
|
|
28326
28391
|
// src/NewTableStart.tsx
|
|
28327
28392
|
import { useCallback as useCallback30, useMemo as useMemo42, useRef as useRef38, useState as useState74 } from "react";
|
|
28328
|
-
import { useRecordsClient as useRecordsClient47 } from "@ai-matrx/records/react";
|
|
28393
|
+
import { tableShapeChanged as tableShapeChanged7, useRecordsClient as useRecordsClient47 } from "@ai-matrx/records/react";
|
|
28329
28394
|
import {
|
|
28330
28395
|
BasicInput as BasicInput15,
|
|
28331
28396
|
Button as Button53,
|
|
@@ -28726,6 +28791,10 @@ function NewTableStart({
|
|
|
28726
28791
|
onMade?.();
|
|
28727
28792
|
setStep({ at: "wizard", tableId: result.data, source, made: true });
|
|
28728
28793
|
}, [busy, client, fileName, importName, importReady, onMade, parsed, target]);
|
|
28794
|
+
const openImported = (tableId) => {
|
|
28795
|
+
tableShapeChanged7(tableId);
|
|
28796
|
+
onOpenTable?.(tableId);
|
|
28797
|
+
};
|
|
28729
28798
|
const back = () => {
|
|
28730
28799
|
setError(null);
|
|
28731
28800
|
setStep({ at: "choose" });
|
|
@@ -28921,10 +28990,10 @@ function NewTableStart({
|
|
|
28921
28990
|
/* @__PURE__ */ jsx92(Button53, { disabled: !importReady || busy, onClick: () => void continueImport(), "data-new-table-continue": "", children: busy ? "Creating\u2026" : "Next: columns" })
|
|
28922
28991
|
] });
|
|
28923
28992
|
} else {
|
|
28924
|
-
body = /* @__PURE__ */ jsx92("div", { "data-new-table-wizard": "", children: /* @__PURE__ */ jsx92(ImportWizard, { tableId: step2.tableId, source: step2.source, autoRun: step2.made, onDone: () =>
|
|
28993
|
+
body = /* @__PURE__ */ jsx92("div", { "data-new-table-wizard": "", children: /* @__PURE__ */ jsx92(ImportWizard, { tableId: step2.tableId, source: step2.source, autoRun: step2.made, onWrote: () => tableShapeChanged7(step2.tableId), onDone: () => openImported(step2.tableId) }) });
|
|
28925
28994
|
footer = /* @__PURE__ */ jsxs81(Fragment32, { children: [
|
|
28926
28995
|
!step2.made ? /* @__PURE__ */ jsx92(Button53, { variant: "ghost", className: "mr-auto", onClick: () => setStep({ at: "import" }), children: "Back" }) : null,
|
|
28927
|
-
/* @__PURE__ */ jsx92(Button53, { variant: "outline", onClick: () =>
|
|
28996
|
+
/* @__PURE__ */ jsx92(Button53, { variant: "outline", onClick: () => openImported(step2.tableId), "data-new-table-open": "", children: "Open the table" })
|
|
28928
28997
|
] });
|
|
28929
28998
|
}
|
|
28930
28999
|
return /* @__PURE__ */ jsxs81(
|
|
@@ -31145,7 +31214,7 @@ function Clause({
|
|
|
31145
31214
|
|
|
31146
31215
|
// src/TableRename.tsx
|
|
31147
31216
|
import { useCallback as useCallback35, useEffect as useEffect64, useRef as useRef40, useState as useState82 } from "react";
|
|
31148
|
-
import { tableShapeChanged as
|
|
31217
|
+
import { tableShapeChanged as tableShapeChanged8, useRecordsClient as useRecordsClient55 } from "@ai-matrx/records/react";
|
|
31149
31218
|
import {
|
|
31150
31219
|
Button as Button62,
|
|
31151
31220
|
Dialog as Dialog15,
|
|
@@ -31223,7 +31292,7 @@ function TableRenameDialog({
|
|
|
31223
31292
|
setRefused(refusalSentence(written.error));
|
|
31224
31293
|
return;
|
|
31225
31294
|
}
|
|
31226
|
-
|
|
31295
|
+
tableShapeChanged8(tableId);
|
|
31227
31296
|
onRenamed?.(next);
|
|
31228
31297
|
onOpenChange(false);
|
|
31229
31298
|
};
|
|
@@ -31372,7 +31441,7 @@ import {
|
|
|
31372
31441
|
useFields as useFields17,
|
|
31373
31442
|
useTable as useTable16,
|
|
31374
31443
|
useTableArchive,
|
|
31375
|
-
tableShapeChanged as
|
|
31444
|
+
tableShapeChanged as tableShapeChanged11
|
|
31376
31445
|
} from "@ai-matrx/records/react";
|
|
31377
31446
|
import { Badge as Badge14, Button as Button67, Separator as Separator8, cn as cn52 } from "@ai-matrx/design-system";
|
|
31378
31447
|
|
|
@@ -31412,7 +31481,7 @@ function announceTableArchived({ notify, client, tableId, name, onRestored }) {
|
|
|
31412
31481
|
|
|
31413
31482
|
// src/TableFoundation.tsx
|
|
31414
31483
|
import { useEffect as useEffect65, useState as useState84 } from "react";
|
|
31415
|
-
import { tableShapeChanged as
|
|
31484
|
+
import { tableShapeChanged as tableShapeChanged9, useRecordsClient as useRecordsClient57 } from "@ai-matrx/records/react";
|
|
31416
31485
|
import { Switch as Switch3 } from "@ai-matrx/design-system";
|
|
31417
31486
|
import { jsx as jsx104, jsxs as jsxs93 } from "react/jsx-runtime";
|
|
31418
31487
|
function isFoundationTable(table) {
|
|
@@ -31440,7 +31509,7 @@ function TableFoundationSwitch({ tableId, table }) {
|
|
|
31440
31509
|
setRefused(refusalSentence(written.error));
|
|
31441
31510
|
return;
|
|
31442
31511
|
}
|
|
31443
|
-
|
|
31512
|
+
tableShapeChanged9(tableId);
|
|
31444
31513
|
};
|
|
31445
31514
|
return /* @__PURE__ */ jsxs93("div", { className: "flex flex-col gap-1", "data-table-foundation": "", children: [
|
|
31446
31515
|
/* @__PURE__ */ jsxs93("label", { className: "flex items-center gap-2", children: [
|
|
@@ -31463,7 +31532,7 @@ function TableFoundationSwitch({ tableId, table }) {
|
|
|
31463
31532
|
|
|
31464
31533
|
// src/TableAccessLevel.tsx
|
|
31465
31534
|
import { useCallback as useCallback36, useEffect as useEffect66, useMemo as useMemo47, useState as useState85 } from "react";
|
|
31466
|
-
import { tableShapeChanged as
|
|
31535
|
+
import { tableShapeChanged as tableShapeChanged10, useRecordsClient as useRecordsClient58 } from "@ai-matrx/records/react";
|
|
31467
31536
|
import { Badge as Badge12, Button as Button64, Textarea as Textarea5, cn as cn50 } from "@ai-matrx/design-system";
|
|
31468
31537
|
import { Fragment as Fragment36, jsx as jsx105, jsxs as jsxs94 } from "react/jsx-runtime";
|
|
31469
31538
|
var PERSON_KERNEL_TABLE = "11111111-0000-4000-8000-000000000005";
|
|
@@ -31517,7 +31586,7 @@ function TableAccessLevel({ tableId, fields }) {
|
|
|
31517
31586
|
setRefused(refusalSentence(result.error));
|
|
31518
31587
|
return;
|
|
31519
31588
|
}
|
|
31520
|
-
|
|
31589
|
+
tableShapeChanged10(tableId);
|
|
31521
31590
|
await load();
|
|
31522
31591
|
};
|
|
31523
31592
|
return /* @__PURE__ */ jsxs94("div", { className: "flex flex-col gap-2", "data-table-access-level": facts.level, "data-can-set": "", children: [
|
|
@@ -31807,10 +31876,10 @@ function ColumnsAtOnce({
|
|
|
31807
31876
|
const orderMoved = rows.some((f, i) => f.id !== draft[i]?.id);
|
|
31808
31877
|
const hiddenChanged = look ? JSON.stringify([...hidden].sort()) !== JSON.stringify([...look.hidden].sort()) : false;
|
|
31809
31878
|
const lookChanged = Boolean(look) && (hiddenChanged || orderMoved && look.order !== null);
|
|
31810
|
-
const
|
|
31811
|
-
const dirty = batch.length > 0 || lookChanged || Boolean(
|
|
31879
|
+
const blank2 = draft.find((d) => d.label.trim() === "");
|
|
31880
|
+
const dirty = batch.length > 0 || lookChanged || Boolean(blank2);
|
|
31812
31881
|
const save = async () => {
|
|
31813
|
-
if (
|
|
31882
|
+
if (blank2) return;
|
|
31814
31883
|
setSaving(true);
|
|
31815
31884
|
try {
|
|
31816
31885
|
for (const one of batch) {
|
|
@@ -31923,7 +31992,7 @@ function ColumnsAtOnce({
|
|
|
31923
31992
|
draft.length === 0 ? /* @__PURE__ */ jsx107("li", { className: "px-2 py-2 text-muted-foreground", children: "This table has no fields yet." }) : null
|
|
31924
31993
|
] }),
|
|
31925
31994
|
dirty ? /* @__PURE__ */ jsxs96("div", { className: "flex flex-wrap items-center gap-2", "data-records-columns-save": "", children: [
|
|
31926
|
-
/* @__PURE__ */ jsx107(Button66, { size: "sm", disabled: saving || Boolean(
|
|
31995
|
+
/* @__PURE__ */ jsx107(Button66, { size: "sm", disabled: saving || Boolean(blank2), onClick: () => void save(), children: saving ? "Saving\u2026" : "Save columns" }),
|
|
31927
31996
|
/* @__PURE__ */ jsx107(
|
|
31928
31997
|
Button66,
|
|
31929
31998
|
{
|
|
@@ -31937,7 +32006,7 @@ function ColumnsAtOnce({
|
|
|
31937
32006
|
children: "Discard"
|
|
31938
32007
|
}
|
|
31939
32008
|
),
|
|
31940
|
-
|
|
32009
|
+
blank2 ? /* @__PURE__ */ jsx107("span", { className: "text-muted-foreground", children: "Every column needs a name." }) : null
|
|
31941
32010
|
] }) : null
|
|
31942
32011
|
] });
|
|
31943
32012
|
}
|
|
@@ -32042,9 +32111,9 @@ function TableSettingsPanel({
|
|
|
32042
32111
|
tableId,
|
|
32043
32112
|
name: finished.table_name || (table.data ? tableName(table.data) : "the table"),
|
|
32044
32113
|
// Undo shows the table again where it is: the page re-reads it.
|
|
32045
|
-
onRestored: () =>
|
|
32114
|
+
onRestored: () => tableShapeChanged11(tableId)
|
|
32046
32115
|
});
|
|
32047
|
-
|
|
32116
|
+
tableShapeChanged11(tableId);
|
|
32048
32117
|
}
|
|
32049
32118
|
};
|
|
32050
32119
|
const askToArchive = async () => {
|
|
@@ -32103,8 +32172,8 @@ function TableSettingsPanel({
|
|
|
32103
32172
|
open: true,
|
|
32104
32173
|
onOpenChange: (open) => !open ? setDeliberate(null) : void 0,
|
|
32105
32174
|
onArchived: () => {
|
|
32106
|
-
announceTableArchived({ notify: ui.notify, client, tableId, name: tableName(table.data), onRestored: () =>
|
|
32107
|
-
|
|
32175
|
+
announceTableArchived({ notify: ui.notify, client, tableId, name: tableName(table.data), onRestored: () => tableShapeChanged11(tableId) });
|
|
32176
|
+
tableShapeChanged11(tableId);
|
|
32108
32177
|
}
|
|
32109
32178
|
}
|
|
32110
32179
|
) : null,
|
|
@@ -32615,7 +32684,7 @@ function ShareForSomebodyElse({
|
|
|
32615
32684
|
import { useEffect as useEffect72, useRef as useRef43, useState as useState92 } from "react";
|
|
32616
32685
|
import { Button as Button70, cn as cn54 } from "@ai-matrx/design-system";
|
|
32617
32686
|
import { newerKindOf as newerKindOf6 } from "@ai-matrx/records";
|
|
32618
|
-
import { tableShapeChanged as
|
|
32687
|
+
import { tableShapeChanged as tableShapeChanged12, useFieldMutation as useFieldMutation5, useFields as useFields18, useRecord as useRecord2, useRecordsClient as useRecordsClient64, useTable as useTable18 } from "@ai-matrx/records/react";
|
|
32619
32688
|
import { Fragment as Fragment40, jsx as jsx113, jsxs as jsxs102 } from "react/jsx-runtime";
|
|
32620
32689
|
var BODY_NAMES = /^(notes?|page|body|content|page content|details|description)$/i;
|
|
32621
32690
|
function bodyFieldOf(fields) {
|
|
@@ -32709,7 +32778,7 @@ function AddBody({ tableId }) {
|
|
|
32709
32778
|
"data-record-body-add": "",
|
|
32710
32779
|
onClick: async () => {
|
|
32711
32780
|
const made = await mutation.declare({ table_id: tableId, spec: { label: BODY_COLUMN_NAME, type: "rich_text" } });
|
|
32712
|
-
if (made)
|
|
32781
|
+
if (made) tableShapeChanged12(tableId);
|
|
32713
32782
|
},
|
|
32714
32783
|
children: "Add notes"
|
|
32715
32784
|
}
|
|
@@ -35219,6 +35288,17 @@ function baselineSpan(start, end) {
|
|
|
35219
35288
|
if (!start) return null;
|
|
35220
35289
|
return { first: start, last: end && end >= start ? end : start };
|
|
35221
35290
|
}
|
|
35291
|
+
function taskListNeedsYear(days, currentYear) {
|
|
35292
|
+
const years = new Set(days.map((d) => Number(d.slice(0, 4))));
|
|
35293
|
+
return years.size > 1 || years.size === 1 && !years.has(currentYear);
|
|
35294
|
+
}
|
|
35295
|
+
function taskListDay(day2, withYear) {
|
|
35296
|
+
const m = /^(\d{4})-(\d{2})-(\d{2})$/.exec(day2);
|
|
35297
|
+
if (!m) return day2;
|
|
35298
|
+
const at = new Date(Number(m[1]), Number(m[2]) - 1, Number(m[3]));
|
|
35299
|
+
const short = at.toLocaleDateString(void 0, { month: "short", day: "numeric" });
|
|
35300
|
+
return withYear ? `${short} '${(m[1] ?? "").slice(2)}` : short;
|
|
35301
|
+
}
|
|
35222
35302
|
|
|
35223
35303
|
// src/TimelineView.tsx
|
|
35224
35304
|
import { Fragment as Fragment45, jsx as jsx120, jsxs as jsxs109 } from "react/jsx-runtime";
|
|
@@ -35296,9 +35376,6 @@ function packRows(bars) {
|
|
|
35296
35376
|
return { ...bar, row };
|
|
35297
35377
|
});
|
|
35298
35378
|
}
|
|
35299
|
-
function shortDay(day2) {
|
|
35300
|
-
return dayAt(day2).toLocaleDateString(void 0, { month: "short", day: "numeric" });
|
|
35301
|
-
}
|
|
35302
35379
|
function windowStart(anchor, zoom, firstDay) {
|
|
35303
35380
|
const from = dayAt(addDays(anchor, -WINDOW[zoom].lead));
|
|
35304
35381
|
if (zoom === "day" || zoom === "week") from.setDate(from.getDate() - daysSinceWeekStart(from.getDay(), firstDay));
|
|
@@ -36137,6 +36214,11 @@ function TimelineView({
|
|
|
36137
36214
|
}) })
|
|
36138
36215
|
] })
|
|
36139
36216
|
) : null;
|
|
36217
|
+
const listYear = ganttOn && taskListNeedsYear(placed.flatMap((p) => {
|
|
36218
|
+
const at = shown5(p);
|
|
36219
|
+
return [at.first, at.last];
|
|
36220
|
+
}), Number(today.slice(0, 4)));
|
|
36221
|
+
const listDayW = listYear ? "w-[3.75rem]" : "w-12";
|
|
36140
36222
|
const LABEL_COLUMN = cn58("sticky left-0 z-30 shrink-0 border-r bg-background", ganttOn ? "w-64 sm:w-80" : "w-24 sm:w-36");
|
|
36141
36223
|
const todayLine = todayX !== null ? /* @__PURE__ */ jsx120(
|
|
36142
36224
|
"div",
|
|
@@ -36150,8 +36232,8 @@ function TimelineView({
|
|
|
36150
36232
|
const headerRow = (segments, className2, key) => /* @__PURE__ */ jsxs109("div", { className: "flex", "data-timeline-scale": key, children: [
|
|
36151
36233
|
hasLabel ? /* @__PURE__ */ jsx120("div", { className: cn58(LABEL_COLUMN, "border-b"), children: ganttOn && key === "bottom" ? /* @__PURE__ */ jsxs109("div", { className: "flex h-full items-center gap-1 px-1.5 text-[11px] text-muted-foreground", "data-timeline-list-head": "", children: [
|
|
36152
36234
|
/* @__PURE__ */ jsx120("span", { className: "min-w-0 flex-1 truncate", children: "Task" }),
|
|
36153
|
-
/* @__PURE__ */ jsx120("span", { className: "
|
|
36154
|
-
/* @__PURE__ */ jsx120("span", { className: "
|
|
36235
|
+
/* @__PURE__ */ jsx120("span", { className: cn58(listDayW, "shrink-0"), children: "Start" }),
|
|
36236
|
+
/* @__PURE__ */ jsx120("span", { className: cn58(listDayW, "shrink-0"), children: "End" }),
|
|
36155
36237
|
/* @__PURE__ */ jsx120("span", { className: "w-14 shrink-0 text-right", children: "Days" })
|
|
36156
36238
|
] }) : null }) : null,
|
|
36157
36239
|
/* @__PURE__ */ jsxs109("div", { className: "relative shrink-0", style: { width, height: 22 }, children: [
|
|
@@ -36183,9 +36265,9 @@ function TimelineView({
|
|
|
36183
36265
|
const slip = slipDays(baselineOf(b.p.row)?.last ?? null, at.last);
|
|
36184
36266
|
return /* @__PURE__ */ jsxs109("div", { "data-timeline-list-row": b.p.row.id, className: "flex items-center gap-1 px-1.5 text-xs", style: { height: ROW_PX }, children: [
|
|
36185
36267
|
/* @__PURE__ */ jsx120("button", { type: "button", className: "min-w-0 flex-1 truncate text-left hover:underline", onClick: () => onOpenRecord?.(b.p.row.id), children: titleOf(b.p.row) }),
|
|
36186
|
-
/* @__PURE__ */ jsx120("span", { className: "
|
|
36187
|
-
/* @__PURE__ */ jsx120("span", { className: "
|
|
36188
|
-
/* @__PURE__ */ jsxs109("span", { className: "w-14 shrink-0 text-right tabular-nums", title: slip !== null ? slipWords(slip) : void 0, children: [
|
|
36268
|
+
/* @__PURE__ */ jsx120("span", { className: cn58(listDayW, "shrink-0 whitespace-nowrap tabular-nums text-muted-foreground"), children: taskListDay(at.first, listYear) }),
|
|
36269
|
+
/* @__PURE__ */ jsx120("span", { className: cn58(listDayW, "shrink-0 whitespace-nowrap tabular-nums text-muted-foreground"), children: taskListDay(at.last, listYear) }),
|
|
36270
|
+
/* @__PURE__ */ jsxs109("span", { className: "w-14 shrink-0 whitespace-nowrap text-right tabular-nums", title: slip !== null ? slipWords(slip) : void 0, children: [
|
|
36189
36271
|
daysBetween(at.first, at.last) + 1,
|
|
36190
36272
|
"d",
|
|
36191
36273
|
slip !== null && slip !== 0 ? /* @__PURE__ */ jsx120("span", { className: cn58("ml-1", slip > 0 ? "text-destructive" : "text-emerald-600"), children: slip > 0 ? `+${slip}` : slip }) : null
|
|
@@ -39009,7 +39091,7 @@ import {
|
|
|
39009
39091
|
archivedByLine,
|
|
39010
39092
|
emptyArchiveLine
|
|
39011
39093
|
} from "@ai-matrx/records";
|
|
39012
|
-
import { tableShapeChanged as
|
|
39094
|
+
import { tableShapeChanged as tableShapeChanged13, useFields as useFields22, useRecordsClient as useRecordsClient72, useTable as useTable22 } from "@ai-matrx/records/react";
|
|
39013
39095
|
import { Button as Button78, Skeleton as Skeleton16, cn as cn63 } from "@ai-matrx/design-system";
|
|
39014
39096
|
import { jsx as jsx129, jsxs as jsxs117 } from "react/jsx-runtime";
|
|
39015
39097
|
var ARCHIVE_MEANS = "Archiving never destroys anything. A record you remove from the grid waits here until somebody brings it back.";
|
|
@@ -39166,7 +39248,7 @@ function RetiredColumns({ tableId, mayRestore, whyNot }) {
|
|
|
39166
39248
|
setRefusal({ fieldId, error: done.error });
|
|
39167
39249
|
return;
|
|
39168
39250
|
}
|
|
39169
|
-
|
|
39251
|
+
tableShapeChanged13(tableId);
|
|
39170
39252
|
await read();
|
|
39171
39253
|
};
|
|
39172
39254
|
if (error) return /* @__PURE__ */ jsx129(RefusalNotice, { error });
|
|
@@ -39407,7 +39489,7 @@ function useSeedGuard() {
|
|
|
39407
39489
|
import { useTable as useTable23 } from "@ai-matrx/records/react";
|
|
39408
39490
|
|
|
39409
39491
|
// src/viewActions.ts
|
|
39410
|
-
var VIEW_LOCKED_REASON = "
|
|
39492
|
+
var VIEW_LOCKED_REASON = "Locked \xB7 ask an editor to unlock";
|
|
39411
39493
|
var NOOP3 = () => {
|
|
39412
39494
|
};
|
|
39413
39495
|
function viewActions(whyNot, host, locked = false, personal = false) {
|
|
@@ -39446,6 +39528,9 @@ function copyName(name, taken) {
|
|
|
39446
39528
|
if (!taken.includes(next)) return next;
|
|
39447
39529
|
}
|
|
39448
39530
|
}
|
|
39531
|
+
function viewActionReasons(actions) {
|
|
39532
|
+
return [...new Set(actions.flatMap((a) => a.disabledReason ? [a.disabledReason] : []))];
|
|
39533
|
+
}
|
|
39449
39534
|
|
|
39450
39535
|
// src/ViewBar.tsx
|
|
39451
39536
|
import { Fragment as Fragment49, jsx as jsx131, jsxs as jsxs119 } from "react/jsx-runtime";
|
|
@@ -39479,6 +39564,7 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews,
|
|
|
39479
39564
|
const claimSeed = useSeedGuard();
|
|
39480
39565
|
const table = useTable23(tableId);
|
|
39481
39566
|
const rights = useTableRights(table.data);
|
|
39567
|
+
const tableThere = Boolean(table.data);
|
|
39482
39568
|
const notify = useRecordsUi().notify;
|
|
39483
39569
|
const [views, setViews] = useState109(() => initialViews ?? null);
|
|
39484
39570
|
const [error, setError] = useState109(null);
|
|
@@ -39558,7 +39644,7 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews,
|
|
|
39558
39644
|
}
|
|
39559
39645
|
setUnavailable(false);
|
|
39560
39646
|
const mine = result.data;
|
|
39561
|
-
const missing = (seed ?? []).filter((s) => !seedIsSatisfied(s, mine));
|
|
39647
|
+
const missing = tableThere ? (seed ?? []).filter((s) => !seedIsSatisfied(s, mine)) : [];
|
|
39562
39648
|
if (missing.length > 0) {
|
|
39563
39649
|
for (const spec of missing) {
|
|
39564
39650
|
if (!claimSeed(spec.name)) continue;
|
|
@@ -39583,7 +39669,7 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews,
|
|
|
39583
39669
|
setError(null);
|
|
39584
39670
|
setViews(mine);
|
|
39585
39671
|
onViews?.(mine);
|
|
39586
|
-
}, [client, readViews, tableId, seedKey]);
|
|
39672
|
+
}, [client, readViews, tableId, seedKey, tableThere]);
|
|
39587
39673
|
useEffect89(() => {
|
|
39588
39674
|
if (!readOnMount.current) {
|
|
39589
39675
|
readOnMount.current = true;
|
|
@@ -39907,29 +39993,35 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews,
|
|
|
39907
39993
|
/* @__PURE__ */ jsx131(Button80, { size: "sm", type: "submit", className: "h-7", children: "Save" })
|
|
39908
39994
|
]
|
|
39909
39995
|
}
|
|
39910
|
-
) :
|
|
39911
|
-
|
|
39912
|
-
|
|
39913
|
-
|
|
39914
|
-
|
|
39915
|
-
|
|
39916
|
-
|
|
39917
|
-
|
|
39918
|
-
|
|
39919
|
-
|
|
39920
|
-
|
|
39921
|
-
|
|
39922
|
-
|
|
39923
|
-
|
|
39924
|
-
|
|
39925
|
-
|
|
39926
|
-
|
|
39927
|
-
|
|
39928
|
-
|
|
39929
|
-
|
|
39930
|
-
|
|
39931
|
-
|
|
39932
|
-
|
|
39996
|
+
) : (() => {
|
|
39997
|
+
const actions = viewActions(rights.admin || current.personal ? null : rightsReason(rights, "structure") ?? ACTION_NO_ACCESS_REASON, {
|
|
39998
|
+
rename: () => setRenaming(current.name),
|
|
39999
|
+
duplicate: () => duplicate(current),
|
|
40000
|
+
archive: () => archive(current),
|
|
40001
|
+
...rights.admin ? { toggleLock: () => toggleLock(current) } : {},
|
|
40002
|
+
// Collaborative -> personal is the creator's or an editor's; personal -> collaborative is the creator's,
|
|
40003
|
+
// and a personal view is only ever listed to its creator.
|
|
40004
|
+
...rights.admin || current.personal ? { togglePersonal: () => togglePersonal(current) } : {},
|
|
40005
|
+
moveToSection: () => setMovingTo("")
|
|
40006
|
+
}, current.presentation?.locked === true, current.personal === true);
|
|
40007
|
+
const reasons = viewActionReasons(actions);
|
|
40008
|
+
return /* @__PURE__ */ jsxs119(Fragment49, { children: [
|
|
40009
|
+
reasons.map((reason) => /* @__PURE__ */ jsx131("p", { className: "truncate px-2 py-1 text-xs text-muted-foreground", "data-view-actions-reason": "", title: reason, children: reason }, reason)),
|
|
40010
|
+
actions.map((action3) => /* @__PURE__ */ jsx131(
|
|
40011
|
+
Tile2,
|
|
40012
|
+
{
|
|
40013
|
+
variant: "quiet",
|
|
40014
|
+
...action3.destructive ? { danger: true } : {},
|
|
40015
|
+
disabled: action3.disabledReason !== void 0,
|
|
40016
|
+
"data-view-action": action3.id,
|
|
40017
|
+
onClick: () => void action3.run(),
|
|
40018
|
+
icon: /* @__PURE__ */ jsx131(ObjectActionGlyph, { name: action3.icon, className: "h-3.5 w-3.5 shrink-0" }),
|
|
40019
|
+
title: /* @__PURE__ */ jsx131("span", { title: action3.disabledReason, children: action3.label })
|
|
40020
|
+
},
|
|
40021
|
+
action3.id
|
|
40022
|
+
))
|
|
40023
|
+
] });
|
|
40024
|
+
})() }) : null,
|
|
39933
40025
|
settings ? /* @__PURE__ */ jsx131("div", { className: "mt-1 border-t border-border pt-1", "data-view-settings": "", children: settings }) : null
|
|
39934
40026
|
] })
|
|
39935
40027
|
] });
|
|
@@ -41693,6 +41785,41 @@ function ActionInbox({
|
|
|
41693
41785
|
|
|
41694
41786
|
// src/HistoryPanel.tsx
|
|
41695
41787
|
import { useCallback as useCallback47, useEffect as useEffect95, useRef as useRef53, useState as useState115 } from "react";
|
|
41788
|
+
|
|
41789
|
+
// src/undoChange.ts
|
|
41790
|
+
function blank(value) {
|
|
41791
|
+
return value === null || value === void 0 || value === "";
|
|
41792
|
+
}
|
|
41793
|
+
function sameValue2(a, b) {
|
|
41794
|
+
if (blank(a) || blank(b)) return blank(a) && blank(b);
|
|
41795
|
+
if (a === b) return true;
|
|
41796
|
+
if (typeof a !== "object" || typeof b !== "object") return false;
|
|
41797
|
+
if (Array.isArray(a) !== Array.isArray(b)) return false;
|
|
41798
|
+
const left = a;
|
|
41799
|
+
const right = b;
|
|
41800
|
+
const keys = /* @__PURE__ */ new Set([...Object.keys(left), ...Object.keys(right)]);
|
|
41801
|
+
for (const key of keys) if (!sameValue2(left[key], right[key])) return false;
|
|
41802
|
+
return true;
|
|
41803
|
+
}
|
|
41804
|
+
function planUndo(changes, current, only) {
|
|
41805
|
+
const doc = current ?? {};
|
|
41806
|
+
return changes.filter((change) => !only || change.key === only).map((change) => {
|
|
41807
|
+
const now = doc[change.key];
|
|
41808
|
+
const state = sameValue2(now, change.before) ? "already" : sameValue2(now, change.after) ? "clean" : "conflict";
|
|
41809
|
+
return { key: change.key, label: change.label, current: now, after: change.after, before: change.before, state };
|
|
41810
|
+
});
|
|
41811
|
+
}
|
|
41812
|
+
function undoPatch(lines, replaceLaterEdits) {
|
|
41813
|
+
const patch = {};
|
|
41814
|
+
for (const line of lines) {
|
|
41815
|
+
if (line.state === "already") continue;
|
|
41816
|
+
if (line.state === "conflict" && !replaceLaterEdits) continue;
|
|
41817
|
+
patch[line.key] = blank(line.before) ? null : line.before;
|
|
41818
|
+
}
|
|
41819
|
+
return patch;
|
|
41820
|
+
}
|
|
41821
|
+
|
|
41822
|
+
// src/HistoryPanel.tsx
|
|
41696
41823
|
import {
|
|
41697
41824
|
useFields as useFields23,
|
|
41698
41825
|
useRecord as useRecord4,
|
|
@@ -41961,7 +42088,7 @@ function MigrationLog({ entries, readError, canUndo, whyNotUndo, onUndone, class
|
|
|
41961
42088
|
}
|
|
41962
42089
|
|
|
41963
42090
|
// src/HistoryPanel.tsx
|
|
41964
|
-
import { jsx as jsx137, jsxs as jsxs125 } from "react/jsx-runtime";
|
|
42091
|
+
import { Fragment as Fragment53, jsx as jsx137, jsxs as jsxs125 } from "react/jsx-runtime";
|
|
41965
42092
|
function HistoryPanel({ tableId, recordId, onAskAboutField, className }) {
|
|
41966
42093
|
const client = useRecordsClient80();
|
|
41967
42094
|
const table = useTable25(tableId);
|
|
@@ -41971,6 +42098,7 @@ function HistoryPanel({ tableId, recordId, onAskAboutField, className }) {
|
|
|
41971
42098
|
const [error, setError] = useState115(null);
|
|
41972
42099
|
const [open, setOpen] = useState115(null);
|
|
41973
42100
|
const [pending, setPending] = useState115({ phase: "idle" });
|
|
42101
|
+
const [undo, setUndo] = useState115({ phase: "idle" });
|
|
41974
42102
|
const seenAtPreview = useRef53(null);
|
|
41975
42103
|
const [said2, setSaid] = useState115(null);
|
|
41976
42104
|
const listRef = useRef53(null);
|
|
@@ -42020,6 +42148,37 @@ function HistoryPanel({ tableId, recordId, onAskAboutField, className }) {
|
|
|
42020
42148
|
}
|
|
42021
42149
|
setPending({ phase: "confirm", version, fieldKey, preview: asked3.data });
|
|
42022
42150
|
}
|
|
42151
|
+
async function startUndo(entry, only) {
|
|
42152
|
+
setSaid(null);
|
|
42153
|
+
setPending({ phase: "idle" });
|
|
42154
|
+
setUndo({ phase: "asking", version: entry.version, only });
|
|
42155
|
+
const read = await client.recordRead({ record_id: recordId, withVersion: true });
|
|
42156
|
+
if (!read.ok) {
|
|
42157
|
+
setUndo({ phase: "idle" });
|
|
42158
|
+
setError(read.error);
|
|
42159
|
+
return;
|
|
42160
|
+
}
|
|
42161
|
+
const lines = planUndo(entry.changes, read.data.document, only);
|
|
42162
|
+
setUndo({ phase: "confirm", version: entry.version, only, lines, seen: read.data.version ?? await (0, recordVersions_exports.readVersionNow)(client, recordId) });
|
|
42163
|
+
}
|
|
42164
|
+
async function doUndo(replaceLaterEdits) {
|
|
42165
|
+
if (undo.phase !== "confirm") return;
|
|
42166
|
+
const { version, only, lines, seen } = undo;
|
|
42167
|
+
setUndo({ phase: "writing", version, only });
|
|
42168
|
+
const patch = undoPatch(lines, replaceLaterEdits);
|
|
42169
|
+
const written = await (0, recordVersions_exports.updateRecordAt)(client, { record_id: recordId, patch, version: seen });
|
|
42170
|
+
setUndo({ phase: "idle" });
|
|
42171
|
+
if (!written.ok) {
|
|
42172
|
+
setError(written.error);
|
|
42173
|
+
return;
|
|
42174
|
+
}
|
|
42175
|
+
const count = Object.keys(patch).length;
|
|
42176
|
+
const kept = lines.filter((line) => line.state === "conflict" && !replaceLaterEdits).length;
|
|
42177
|
+
setSaid(
|
|
42178
|
+
`Undone as version ${written.data}. ${count} ${count === 1 ? "value" : "values"} put back` + (kept ? `, ${kept} later ${kept === 1 ? "edit" : "edits"} kept` : "") + ". Every other field is as it was."
|
|
42179
|
+
);
|
|
42180
|
+
await load();
|
|
42181
|
+
}
|
|
42023
42182
|
async function doRestore(version, fieldKey) {
|
|
42024
42183
|
setPending({ phase: "writing", version, fieldKey });
|
|
42025
42184
|
const written = await (0, recordVersions_exports.restoreAt)(client, { record_id: recordId, version, field_key: fieldKey, seenVersion: seenAtPreview.current });
|
|
@@ -42078,6 +42237,10 @@ function HistoryPanel({ tableId, recordId, onAskAboutField, className }) {
|
|
|
42078
42237
|
canRestore: rights.write && entry.version >= newestMakerVersion && !(entry.migration_id && makerIds.has(entry.migration_id)),
|
|
42079
42238
|
whyNotRestore: entry.migration_id && makerIds.has(entry.migration_id) ? `This version is a ${migrationWords(makers.find((m) => m.id === entry.migration_id)?.verb ?? "split").toLowerCase()}. Undo it in the Migration log below, so no copy is left behind.` : rights.write && entry.version < newestMakerVersion ? "A newer split still holds some of these values. Undo it in the Migration log below first, so no copy is left behind." : rights.why("write"),
|
|
42080
42239
|
pending,
|
|
42240
|
+
undo,
|
|
42241
|
+
onUndo: (only) => void startUndo(entry, only),
|
|
42242
|
+
onUndoConfirm: (replace) => void doUndo(replace),
|
|
42243
|
+
onUndoCancel: () => setUndo({ phase: "idle" }),
|
|
42081
42244
|
onRestore: (fieldKey) => void startRestore(entry.version, fieldKey),
|
|
42082
42245
|
onConfirm: (fieldKey) => void doRestore(entry.version, fieldKey),
|
|
42083
42246
|
onCancel: () => setPending({ phase: "idle" }),
|
|
@@ -42107,6 +42270,10 @@ function VersionRow({
|
|
|
42107
42270
|
canRestore,
|
|
42108
42271
|
whyNotRestore,
|
|
42109
42272
|
pending,
|
|
42273
|
+
undo,
|
|
42274
|
+
onUndo,
|
|
42275
|
+
onUndoConfirm,
|
|
42276
|
+
onUndoCancel,
|
|
42110
42277
|
onRestore,
|
|
42111
42278
|
onConfirm,
|
|
42112
42279
|
onCancel,
|
|
@@ -42114,6 +42281,9 @@ function VersionRow({
|
|
|
42114
42281
|
}) {
|
|
42115
42282
|
const mine = pending.phase !== "idle" && pending.version === entry.version;
|
|
42116
42283
|
const confirming = mine && pending.phase === "confirm" ? pending : null;
|
|
42284
|
+
const canUndo = canRestore && entry.operation !== "insert" && entry.version > 1 && entry.changes.length > 0;
|
|
42285
|
+
const undoMine = undo.phase !== "idle" && undo.version === entry.version;
|
|
42286
|
+
const undoConfirming = undoMine && undo.phase === "confirm" ? undo : null;
|
|
42117
42287
|
return /* @__PURE__ */ jsxs125("li", { className: "flex flex-col", children: [
|
|
42118
42288
|
/* @__PURE__ */ jsxs125(
|
|
42119
42289
|
"div",
|
|
@@ -42169,13 +42339,24 @@ function VersionRow({
|
|
|
42169
42339
|
{
|
|
42170
42340
|
change,
|
|
42171
42341
|
field: byKey.get(change.key),
|
|
42172
|
-
canRestore,
|
|
42173
|
-
onRestore: () =>
|
|
42342
|
+
canRestore: canUndo,
|
|
42343
|
+
onRestore: () => onUndo(change.key),
|
|
42174
42344
|
...onAskAboutField ? { onAskAboutField } : {}
|
|
42175
42345
|
},
|
|
42176
42346
|
change.key
|
|
42177
42347
|
)) }),
|
|
42178
|
-
|
|
42348
|
+
undoConfirming ? /* @__PURE__ */ jsx137(ConfirmUndo, { lines: undoConfirming.lines, onConfirm: onUndoConfirm, onCancel: onUndoCancel }) : undoMine && undo.phase === "writing" ? /* @__PURE__ */ jsx137("p", { className: "text-[11px] text-muted-foreground", children: "Undoing\u2026" }) : canRestore && !confirming && !(mine && pending.phase === "writing") ? canUndo ? /* @__PURE__ */ jsx137("div", { className: "flex", children: /* @__PURE__ */ jsx137(
|
|
42349
|
+
Button86,
|
|
42350
|
+
{
|
|
42351
|
+
size: "sm",
|
|
42352
|
+
variant: "secondary",
|
|
42353
|
+
className: "h-6 px-2 text-[11px]",
|
|
42354
|
+
disabled: undoMine,
|
|
42355
|
+
onClick: () => onUndo(null),
|
|
42356
|
+
children: undoMine ? "Working out what would change\u2026" : "Undo this change"
|
|
42357
|
+
}
|
|
42358
|
+
) }) : null : null,
|
|
42359
|
+
canRestore && !undoMine ? confirming ? /* @__PURE__ */ jsx137(
|
|
42179
42360
|
ConfirmRestore,
|
|
42180
42361
|
{
|
|
42181
42362
|
preview: confirming.preview,
|
|
@@ -42257,9 +42438,64 @@ function ChangeLine({
|
|
|
42257
42438
|
children: "Who changed this?"
|
|
42258
42439
|
}
|
|
42259
42440
|
) : null,
|
|
42260
|
-
canRestore ? /* @__PURE__ */ jsx137(Button86, { size: "sm", variant: "ghost", className: "h-5 shrink-0 px-1 text-[10px]", onClick: onRestore, children: "
|
|
42441
|
+
canRestore ? /* @__PURE__ */ jsx137(Button86, { size: "sm", variant: "ghost", className: "h-5 shrink-0 px-1 text-[10px]", onClick: onRestore, children: "Undo this one" }) : null
|
|
42442
|
+
] });
|
|
42443
|
+
}
|
|
42444
|
+
function ConfirmUndo({
|
|
42445
|
+
lines,
|
|
42446
|
+
onConfirm,
|
|
42447
|
+
onCancel
|
|
42448
|
+
}) {
|
|
42449
|
+
const clean = lines.filter((line) => line.state === "clean");
|
|
42450
|
+
const conflicts = lines.filter((line) => line.state === "conflict");
|
|
42451
|
+
const already = lines.filter((line) => line.state === "already");
|
|
42452
|
+
const nothing = clean.length + conflicts.length === 0;
|
|
42453
|
+
return /* @__PURE__ */ jsxs125("div", { "data-undo-confirm": "", className: "flex flex-col gap-1 rounded border border-amber-500/40 bg-amber-500/5 p-2", children: [
|
|
42454
|
+
/* @__PURE__ */ jsx137("p", { className: "text-[11px] font-medium", children: nothing ? "Nothing to undo \u2014 every value this version changed already says what it said before." : `Undoing this would put back ${clean.length + conflicts.length} ${clean.length + conflicts.length === 1 ? "value" : "values"}:` }),
|
|
42455
|
+
/* @__PURE__ */ jsx137("ul", { className: "flex flex-col gap-0.5", children: [...clean, ...conflicts].map((line) => /* @__PURE__ */ jsxs125("li", { "data-undo-line": line.key, "data-undo-state": line.state, className: "text-[11px]", children: [
|
|
42456
|
+
/* @__PURE__ */ jsx137("span", { className: "font-medium", children: line.label }),
|
|
42457
|
+
" ",
|
|
42458
|
+
/* @__PURE__ */ jsx137("span", { className: "text-muted-foreground", children: say(line.current, void 0) }),
|
|
42459
|
+
/* @__PURE__ */ jsx137("span", { className: "mx-1 text-muted-foreground", children: "\u2192" }),
|
|
42460
|
+
/* @__PURE__ */ jsx137("strong", { className: "font-medium", children: blankSays(line.before) }),
|
|
42461
|
+
line.state === "conflict" ? /* @__PURE__ */ jsx137("span", { className: "ml-1 text-amber-700 dark:text-amber-400", children: "edited again since" }) : null
|
|
42462
|
+
] }, line.key)) }),
|
|
42463
|
+
already.length ? /* @__PURE__ */ jsxs125("p", { className: "text-[11px] text-muted-foreground", children: [
|
|
42464
|
+
"Already back: ",
|
|
42465
|
+
already.map((line) => line.label).join(", "),
|
|
42466
|
+
"."
|
|
42467
|
+
] }) : null,
|
|
42468
|
+
conflicts.length ? /* @__PURE__ */ jsxs125("p", { className: "text-[11px] text-muted-foreground", children: [
|
|
42469
|
+
conflicts.map((line) => line.label).join(", "),
|
|
42470
|
+
" ",
|
|
42471
|
+
conflicts.length === 1 ? "was" : "were",
|
|
42472
|
+
" edited again after this change. Keep the newer ",
|
|
42473
|
+
conflicts.length === 1 ? "edit" : "edits",
|
|
42474
|
+
", or replace ",
|
|
42475
|
+
conflicts.length === 1 ? "it" : "them",
|
|
42476
|
+
"?"
|
|
42477
|
+
] }) : /* @__PURE__ */ jsx137("p", { className: "text-[11px] text-muted-foreground", children: "It is saved as a new version. Nothing in the history is erased, and later edits to other fields stay." }),
|
|
42478
|
+
/* @__PURE__ */ jsxs125("div", { className: "flex flex-wrap gap-1", children: [
|
|
42479
|
+
conflicts.length ? /* @__PURE__ */ jsxs125(Fragment53, { children: [
|
|
42480
|
+
clean.length ? /* @__PURE__ */ jsx137(Button86, { size: "sm", className: "h-6 px-2 text-[11px]", onClick: () => onConfirm(false), children: "Undo the rest, keep newer edits" }) : null,
|
|
42481
|
+
/* @__PURE__ */ jsx137(
|
|
42482
|
+
Button86,
|
|
42483
|
+
{
|
|
42484
|
+
size: "sm",
|
|
42485
|
+
variant: clean.length ? "secondary" : "primary",
|
|
42486
|
+
className: "h-6 px-2 text-[11px]",
|
|
42487
|
+
onClick: () => onConfirm(true),
|
|
42488
|
+
children: "Replace newer edits too"
|
|
42489
|
+
}
|
|
42490
|
+
)
|
|
42491
|
+
] }) : /* @__PURE__ */ jsx137(Button86, { size: "sm", className: "h-6 px-2 text-[11px]", disabled: nothing, onClick: () => onConfirm(false), children: "Yes, undo it" }),
|
|
42492
|
+
/* @__PURE__ */ jsx137(Button86, { size: "sm", variant: "ghost", className: "h-6 px-2 text-[11px]", onClick: onCancel, children: "Cancel" })
|
|
42493
|
+
] })
|
|
42261
42494
|
] });
|
|
42262
42495
|
}
|
|
42496
|
+
function blankSays(value) {
|
|
42497
|
+
return value === null || value === void 0 || value === "" ? "cleared" : say(value, void 0);
|
|
42498
|
+
}
|
|
42263
42499
|
function ConfirmRestore({
|
|
42264
42500
|
preview,
|
|
42265
42501
|
busy,
|
|
@@ -42553,7 +42789,7 @@ import {
|
|
|
42553
42789
|
} from "@ai-matrx/records/react";
|
|
42554
42790
|
import { Badge as Badge21, Button as Button88, Skeleton as Skeleton24, cn as cn73 } from "@ai-matrx/design-system";
|
|
42555
42791
|
import { humanizeIdentifier as humanizeIdentifier20 } from "@ai-matrx/kit/text-case";
|
|
42556
|
-
import { Fragment as
|
|
42792
|
+
import { Fragment as Fragment54, jsx as jsx139, jsxs as jsxs127 } from "react/jsx-runtime";
|
|
42557
42793
|
function FieldHistoryPanel({
|
|
42558
42794
|
tableId,
|
|
42559
42795
|
fieldKey,
|
|
@@ -42588,11 +42824,12 @@ function FieldHistoryPanel({
|
|
|
42588
42824
|
const label = (fields.data ?? []).find((f) => f.key === fieldKey)?.label || humanizeIdentifier20(fieldKey);
|
|
42589
42825
|
if (error) return /* @__PURE__ */ jsx139(RefusalNotice, { error, className });
|
|
42590
42826
|
if (!rows || fields.loading && !fields.data || table.loading && !table.data) return /* @__PURE__ */ jsx139(Skeleton24, { className: cn73("h-40 w-full", className) });
|
|
42591
|
-
async function start(row) {
|
|
42827
|
+
async function start(row, back = false) {
|
|
42592
42828
|
setSaid(null);
|
|
42593
|
-
|
|
42829
|
+
const target = back ? row.version - 1 : row.version;
|
|
42830
|
+
setPending({ phase: "asking", recordId: row.record_id, version: target, back });
|
|
42594
42831
|
const [asked3, seen] = await Promise.all([
|
|
42595
|
-
client.restorePreview({ record_id: row.record_id, version:
|
|
42832
|
+
client.restorePreview({ record_id: row.record_id, version: target, field_key: fieldKey }),
|
|
42596
42833
|
(0, recordVersions_exports.readVersionNow)(client, row.record_id)
|
|
42597
42834
|
]);
|
|
42598
42835
|
seenAtPreview.current = seen;
|
|
@@ -42601,17 +42838,20 @@ function FieldHistoryPanel({
|
|
|
42601
42838
|
setError(asked3.error);
|
|
42602
42839
|
return;
|
|
42603
42840
|
}
|
|
42604
|
-
|
|
42841
|
+
const laterEdit = back && asked3.data.changes.some((c) => c.key === fieldKey && !sameValue2(c.before, row.after));
|
|
42842
|
+
setPending({ phase: "confirm", recordId: row.record_id, version: target, preview: asked3.data, back, laterEdit });
|
|
42605
42843
|
}
|
|
42606
|
-
async function confirm(recordOf2, version) {
|
|
42607
|
-
setPending({ phase: "writing", recordId: recordOf2, version });
|
|
42844
|
+
async function confirm(recordOf2, version, back = false) {
|
|
42845
|
+
setPending({ phase: "writing", recordId: recordOf2, version, back });
|
|
42608
42846
|
const written = await (0, recordVersions_exports.restoreAt)(client, { record_id: recordOf2, version, field_key: fieldKey, seenVersion: seenAtPreview.current });
|
|
42609
42847
|
setPending({ phase: "idle" });
|
|
42610
42848
|
if (!written.ok) {
|
|
42611
42849
|
setError(written.error);
|
|
42612
42850
|
return;
|
|
42613
42851
|
}
|
|
42614
|
-
setSaid(
|
|
42852
|
+
setSaid(
|
|
42853
|
+
back ? `Change undone as version ${written.data.version}. Other fields keep their later edits.` : `Put back as version ${written.data.version}. Every earlier version is still here.`
|
|
42854
|
+
);
|
|
42615
42855
|
await load();
|
|
42616
42856
|
}
|
|
42617
42857
|
return /* @__PURE__ */ jsxs127("section", { className: cn73("flex min-h-0 flex-col gap-2", className), children: [
|
|
@@ -42629,8 +42869,10 @@ function FieldHistoryPanel({
|
|
|
42629
42869
|
label,
|
|
42630
42870
|
" has never been changed on anything you can see."
|
|
42631
42871
|
] }) : /* @__PURE__ */ jsx139("ol", { className: "flex min-h-0 flex-col divide-y overflow-y-auto rounded border", children: rows.map((row) => {
|
|
42632
|
-
const
|
|
42633
|
-
const
|
|
42872
|
+
const matches2 = (back) => pending.phase !== "idle" && pending.recordId === row.record_id && Boolean(pending.back) === back && pending.version === (back ? row.version - 1 : row.version);
|
|
42873
|
+
const mineValue = matches2(false);
|
|
42874
|
+
const mineBack = matches2(true);
|
|
42875
|
+
const confirming = (mineValue || mineBack) && pending.phase === "confirm" ? pending : null;
|
|
42634
42876
|
return /* @__PURE__ */ jsxs127("li", { className: "flex flex-col", children: [
|
|
42635
42877
|
/* @__PURE__ */ jsxs127("div", { className: "flex items-baseline gap-2 px-2 py-1.5 text-xs", children: [
|
|
42636
42878
|
onOpenRecord ? /* @__PURE__ */ jsx139(
|
|
@@ -42649,7 +42891,7 @@ function FieldHistoryPanel({
|
|
|
42649
42891
|
/* @__PURE__ */ jsx139("span", { className: "mx-1 text-muted-foreground", children: "\u2192" }),
|
|
42650
42892
|
/* @__PURE__ */ jsx139("strong", { className: "font-medium", children: say(row.after, void 0) })
|
|
42651
42893
|
] }),
|
|
42652
|
-
/* @__PURE__ */ jsx139("span", { className: "shrink-0 text-muted-foreground", children: row.actor.kind === "agent" ? /* @__PURE__ */ jsxs127(
|
|
42894
|
+
/* @__PURE__ */ jsx139("span", { className: "shrink-0 text-muted-foreground", children: row.actor.kind === "agent" ? /* @__PURE__ */ jsxs127(Fragment54, { children: [
|
|
42653
42895
|
/* @__PURE__ */ jsx139(Badge21, { variant: "outline", className: "mr-1 text-[10px]", children: "agent" }),
|
|
42654
42896
|
"for ",
|
|
42655
42897
|
row.actor.on_behalf_of?.name ?? "a person",
|
|
@@ -42669,21 +42911,38 @@ function FieldHistoryPanel({
|
|
|
42669
42911
|
size: "sm",
|
|
42670
42912
|
variant: "ghost",
|
|
42671
42913
|
className: "h-5 shrink-0 px-1 text-[10px]",
|
|
42672
|
-
disabled:
|
|
42914
|
+
disabled: mineValue,
|
|
42673
42915
|
onClick: () => void start(row),
|
|
42674
42916
|
children: "Put this back"
|
|
42675
42917
|
}
|
|
42918
|
+
) : null,
|
|
42919
|
+
rights.write && row.version > 1 ? /* @__PURE__ */ jsx139(
|
|
42920
|
+
Button88,
|
|
42921
|
+
{
|
|
42922
|
+
size: "sm",
|
|
42923
|
+
variant: "ghost",
|
|
42924
|
+
className: "h-5 shrink-0 px-1 text-[10px]",
|
|
42925
|
+
disabled: mineBack,
|
|
42926
|
+
onClick: () => void start(row, true),
|
|
42927
|
+
children: "Undo this change"
|
|
42928
|
+
}
|
|
42676
42929
|
) : null
|
|
42677
42930
|
] }),
|
|
42678
|
-
confirming ? /* @__PURE__ */
|
|
42679
|
-
|
|
42680
|
-
|
|
42681
|
-
|
|
42682
|
-
|
|
42683
|
-
|
|
42684
|
-
|
|
42685
|
-
|
|
42686
|
-
|
|
42931
|
+
confirming ? /* @__PURE__ */ jsxs127("div", { className: "border-t px-2 py-2", children: [
|
|
42932
|
+
confirming.laterEdit ? /* @__PURE__ */ jsxs127("p", { "data-later-edit": "", className: "mb-1 text-[11px] font-medium text-amber-700 dark:text-amber-400", children: [
|
|
42933
|
+
label,
|
|
42934
|
+
" was edited again after this change. Undoing replaces that newer value; Cancel keeps it."
|
|
42935
|
+
] }) : null,
|
|
42936
|
+
/* @__PURE__ */ jsx139(
|
|
42937
|
+
ConfirmRestore,
|
|
42938
|
+
{
|
|
42939
|
+
preview: confirming.preview,
|
|
42940
|
+
busy: false,
|
|
42941
|
+
onConfirm: () => void confirm(confirming.recordId, confirming.version, confirming.back === true),
|
|
42942
|
+
onCancel: () => setPending({ phase: "idle" })
|
|
42943
|
+
}
|
|
42944
|
+
)
|
|
42945
|
+
] }) : null
|
|
42687
42946
|
] }, `${row.record_id}-${row.version}`);
|
|
42688
42947
|
}) }),
|
|
42689
42948
|
rights.write ? null : /* @__PURE__ */ jsx139("p", { className: "text-[11px] text-muted-foreground", children: rights.why("write") })
|
|
@@ -42824,7 +43083,7 @@ function FormResultsPanel({ form, className }) {
|
|
|
42824
43083
|
import { useCallback as useCallback50, useEffect as useEffect99, useMemo as useMemo68, useRef as useRef56, useState as useState119 } from "react";
|
|
42825
43084
|
import { useRecordsClient as useRecordsClient83, useTables as useTables4 } from "@ai-matrx/records/react";
|
|
42826
43085
|
import { BasicInput as BasicInput23, Button as Button90, Checkbox as Checkbox14, Label as Label20, Separator as Separator10, Skeleton as Skeleton26, cn as cn75 } from "@ai-matrx/design-system";
|
|
42827
|
-
import { Fragment as
|
|
43086
|
+
import { Fragment as Fragment55, jsx as jsx141, jsxs as jsxs129 } from "react/jsx-runtime";
|
|
42828
43087
|
var RESTATING_REPLACES = "Saving replaces what this portal shows: a table you untick stops being visible to every client the moment you save. Who is invited is not touched.";
|
|
42829
43088
|
function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
|
|
42830
43089
|
const client = useRecordsClient83();
|
|
@@ -43044,7 +43303,7 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
|
|
|
43044
43303
|
),
|
|
43045
43304
|
/* @__PURE__ */ jsx141("span", { className: "text-xs text-muted-foreground", children: "One record in this table is one client. Their sign-in is a one-time link emailed to them \u2014 a portal never holds a password." })
|
|
43046
43305
|
] }),
|
|
43047
|
-
clientTableId ? /* @__PURE__ */ jsxs129(
|
|
43306
|
+
clientTableId ? /* @__PURE__ */ jsxs129(Fragment55, { children: [
|
|
43048
43307
|
/* @__PURE__ */ jsx141(Separator10, {}),
|
|
43049
43308
|
/* @__PURE__ */ jsxs129("div", { className: "flex flex-col gap-2", children: [
|
|
43050
43309
|
/* @__PURE__ */ jsx141(Label20, { className: "text-xs font-medium", children: "What they can see" }),
|
|
@@ -43151,7 +43410,7 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
|
|
|
43151
43410
|
" yet."
|
|
43152
43411
|
] }) : null
|
|
43153
43412
|
] }) : null,
|
|
43154
|
-
savedId ? /* @__PURE__ */ jsxs129(
|
|
43413
|
+
savedId ? /* @__PURE__ */ jsxs129(Fragment55, { children: [
|
|
43155
43414
|
/* @__PURE__ */ jsx141(Separator10, {}),
|
|
43156
43415
|
/* @__PURE__ */ jsxs129("div", { className: "flex flex-col gap-2", children: [
|
|
43157
43416
|
/* @__PURE__ */ jsx141(Label20, { className: "text-xs font-medium", children: "Invite a client" }),
|
|
@@ -43524,7 +43783,7 @@ function PortalLookEditor({ card, onSaved, className }) {
|
|
|
43524
43783
|
}
|
|
43525
43784
|
|
|
43526
43785
|
// src/PortalsPanel.tsx
|
|
43527
|
-
import { Fragment as
|
|
43786
|
+
import { Fragment as Fragment56, jsx as jsx144, jsxs as jsxs132 } from "react/jsx-runtime";
|
|
43528
43787
|
var PORTAL_NOT_HERE_LINE = "The link named a portal this table is not part of \u2014 it may have been archived, or it shows other tables. The portals this table is in are listed here.";
|
|
43529
43788
|
function revokeConsequence(person, portalTitle) {
|
|
43530
43789
|
const who = person.client ? `${person.email} (${person.client})` : person.email;
|
|
@@ -43634,7 +43893,7 @@ function PortalsPanel({ tableId, activePortalId, className }) {
|
|
|
43634
43893
|
buildLabel: elsewhere > 0 ? "Build a new portal" : "Build the portal",
|
|
43635
43894
|
children: [
|
|
43636
43895
|
"A portal is how one of your clients signs in and sees the records that name them \u2014 their jobs, their invoices \u2014 and nothing else.",
|
|
43637
|
-
elsewhere > 0 ? /* @__PURE__ */ jsxs132(
|
|
43896
|
+
elsewhere > 0 ? /* @__PURE__ */ jsxs132(Fragment56, { children: [
|
|
43638
43897
|
" ",
|
|
43639
43898
|
"This table is not in",
|
|
43640
43899
|
" ",
|
|
@@ -43762,7 +44021,7 @@ function ArchivePortalControl({
|
|
|
43762
44021
|
if (said2) {
|
|
43763
44022
|
return /* @__PURE__ */ jsx144("span", { className: "text-xs text-muted-foreground", "data-testid": "portal-archived-said", children: said2 });
|
|
43764
44023
|
}
|
|
43765
|
-
return /* @__PURE__ */ jsxs132(
|
|
44024
|
+
return /* @__PURE__ */ jsxs132(Fragment56, { children: [
|
|
43766
44025
|
/* @__PURE__ */ jsx144(
|
|
43767
44026
|
Button92,
|
|
43768
44027
|
{
|
|
@@ -43810,7 +44069,7 @@ function ArchivePortalControl({
|
|
|
43810
44069
|
function CopyLink({ url, what }) {
|
|
43811
44070
|
const [copied, setCopied] = useState121(false);
|
|
43812
44071
|
const [shown5, setShown] = useState121(false);
|
|
43813
|
-
return /* @__PURE__ */ jsxs132(
|
|
44072
|
+
return /* @__PURE__ */ jsxs132(Fragment56, { children: [
|
|
43814
44073
|
/* @__PURE__ */ jsx144(
|
|
43815
44074
|
Button92,
|
|
43816
44075
|
{
|
|
@@ -43953,13 +44212,13 @@ function PortalCardView({
|
|
|
43953
44212
|
] })
|
|
43954
44213
|
] }, exposed.table_id))
|
|
43955
44214
|
] }),
|
|
43956
|
-
look ? /* @__PURE__ */ jsxs132(
|
|
44215
|
+
look ? /* @__PURE__ */ jsxs132(Fragment56, { children: [
|
|
43957
44216
|
/* @__PURE__ */ jsx144(Separator11, {}),
|
|
43958
44217
|
look
|
|
43959
44218
|
] }) : null,
|
|
43960
44219
|
/* @__PURE__ */ jsx144(Separator11, {}),
|
|
43961
44220
|
/* @__PURE__ */ jsx144(People, { card, onRevoke, onPreview, origin }),
|
|
43962
|
-
invite ? /* @__PURE__ */ jsxs132(
|
|
44221
|
+
invite ? /* @__PURE__ */ jsxs132(Fragment56, { children: [
|
|
43963
44222
|
/* @__PURE__ */ jsx144(Separator11, {}),
|
|
43964
44223
|
invite
|
|
43965
44224
|
] }) : null
|
|
@@ -44158,7 +44417,7 @@ function Invite({ card, onInvited }) {
|
|
|
44158
44417
|
/* @__PURE__ */ jsx144("p", { className: "text-xs text-muted-foreground", children: "Pick the client they are, and say where to send their sign-in link. They get nothing until they follow it." }),
|
|
44159
44418
|
error ? /* @__PURE__ */ jsx144(RefusalNotice, { error }) : null,
|
|
44160
44419
|
said2 ? /* @__PURE__ */ jsx144("p", { className: "text-xs text-muted-foreground", children: said2 }) : null,
|
|
44161
|
-
rows === null ? /* @__PURE__ */ jsx144(Skeleton27, { className: "h-9 w-full" }) : /* @__PURE__ */ jsxs132(
|
|
44420
|
+
rows === null ? /* @__PURE__ */ jsx144(Skeleton27, { className: "h-9 w-full" }) : /* @__PURE__ */ jsxs132(Fragment56, { children: [
|
|
44162
44421
|
/* @__PURE__ */ jsx144(
|
|
44163
44422
|
BasicInput25,
|
|
44164
44423
|
{
|
|
@@ -44346,7 +44605,7 @@ function scheduleWords(schedule, tz) {
|
|
|
44346
44605
|
}
|
|
44347
44606
|
|
|
44348
44607
|
// src/DigestScheduler.tsx
|
|
44349
|
-
import { Fragment as
|
|
44608
|
+
import { Fragment as Fragment57, jsx as jsx146, jsxs as jsxs134 } from "react/jsx-runtime";
|
|
44350
44609
|
var WEEKDAYS = ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"];
|
|
44351
44610
|
var CADENCE_WORDS = {
|
|
44352
44611
|
instant: "the moment something arrives",
|
|
@@ -44598,7 +44857,7 @@ function DigestScheduler({
|
|
|
44598
44857
|
] }),
|
|
44599
44858
|
/* @__PURE__ */ jsxs134("div", { className: "flex flex-col gap-1.5", children: [
|
|
44600
44859
|
/* @__PURE__ */ jsx146(Label21, { className: "text-xs font-medium", children: "Who to send it to" }),
|
|
44601
|
-
members === null ? /* @__PURE__ */ jsx146(Skeleton28, { className: "h-8 w-full" }) : members.length === 0 ? /* @__PURE__ */ jsx146("p", { className: "text-xs text-muted-foreground", children: "Nobody else is offered here, so this will be addressed to you. Who the people are is the platform's answer and this screen reaches it through its host's `members` port, which is not bound here." }) : /* @__PURE__ */ jsxs134(
|
|
44860
|
+
members === null ? /* @__PURE__ */ jsx146(Skeleton28, { className: "h-8 w-full" }) : members.length === 0 ? /* @__PURE__ */ jsx146("p", { className: "text-xs text-muted-foreground", children: "Nobody else is offered here, so this will be addressed to you. Who the people are is the platform's answer and this screen reaches it through its host's `members` port, which is not bound here." }) : /* @__PURE__ */ jsxs134(Fragment57, { children: [
|
|
44602
44861
|
/* @__PURE__ */ jsx146("div", { className: "flex flex-wrap gap-x-4 gap-y-1.5", children: members.map((m) => /* @__PURE__ */ jsxs134("label", { className: "flex items-center gap-1.5 text-xs", children: [
|
|
44603
44862
|
/* @__PURE__ */ jsx146(
|
|
44604
44863
|
Checkbox15,
|
|
@@ -44640,7 +44899,7 @@ function DigestScheduler({
|
|
|
44640
44899
|
),
|
|
44641
44900
|
/* @__PURE__ */ jsx146("span", { className: "text-xs text-muted-foreground", children: "A send inside these hours waits until they end \u2014 it is never dropped." })
|
|
44642
44901
|
] }) : null,
|
|
44643
|
-
outcomes ? /* @__PURE__ */ jsxs134(
|
|
44902
|
+
outcomes ? /* @__PURE__ */ jsxs134(Fragment57, { children: [
|
|
44644
44903
|
/* @__PURE__ */ jsx146(Separator12, {}),
|
|
44645
44904
|
/* @__PURE__ */ jsx146("div", { className: "flex flex-col gap-1.5", children: outcomes.map((o) => /* @__PURE__ */ jsx146("div", { className: "text-xs", children: o.ruleId ? /* @__PURE__ */ jsxs134("span", { children: [
|
|
44646
44905
|
o.who,
|
|
@@ -45156,7 +45415,7 @@ import {
|
|
|
45156
45415
|
FORM_EMBEDS,
|
|
45157
45416
|
formEmbedSnippet
|
|
45158
45417
|
} from "@ai-matrx/records/forms";
|
|
45159
|
-
import { Fragment as
|
|
45418
|
+
import { Fragment as Fragment58, jsx as jsx149, jsxs as jsxs137 } from "react/jsx-runtime";
|
|
45160
45419
|
function freshEndingId(taken) {
|
|
45161
45420
|
if (!taken.includes("ending")) return "ending";
|
|
45162
45421
|
let n = 2;
|
|
@@ -45205,7 +45464,7 @@ function EndingsEditor({
|
|
|
45205
45464
|
/* @__PURE__ */ jsx149(BasicTextarea10, { className: "col-span-2", rows: 2, "aria-label": "Ending message", placeholder: "Message", value: e.body ?? "", onChange: (ev) => patch(i, { body: ev.target.value || null }) }),
|
|
45206
45465
|
/* @__PURE__ */ jsx149(BasicInput28, { type: "url", "aria-label": "Ending page", placeholder: "Then go to (optional) https://", value: e.redirectUrl ?? "", onChange: (ev) => patch(i, { redirectUrl: ev.target.value || null }) }),
|
|
45207
45466
|
/* @__PURE__ */ jsx149(BasicInput28, { "aria-label": "Ending button", placeholder: "Continue", value: e.buttonLabel ?? "", onChange: (ev) => patch(i, { buttonLabel: ev.target.value || null }) }),
|
|
45208
|
-
scored ? /* @__PURE__ */ jsxs137(
|
|
45467
|
+
scored ? /* @__PURE__ */ jsxs137(Fragment58, { children: [
|
|
45209
45468
|
/* @__PURE__ */ jsx149(BasicInput28, { inputMode: "decimal", "aria-label": "Lowest score", placeholder: "From score", value: e.scoreMin ?? "", onChange: (ev) => patch(i, { scoreMin: numberOrNull(ev.target.value) }) }),
|
|
45210
45469
|
/* @__PURE__ */ jsx149(BasicInput28, { inputMode: "decimal", "aria-label": "Highest score", placeholder: "To score", value: e.scoreMax ?? "", onChange: (ev) => patch(i, { scoreMax: numberOrNull(ev.target.value) }) })
|
|
45211
45470
|
] }) : null,
|
|
@@ -45401,7 +45660,7 @@ import { useFields as useFields27, useOptionalRecordsClient as useOptionalRecord
|
|
|
45401
45660
|
import { Button as Button97, Label as Label24, Progress, Skeleton as Skeleton31, cn as cn83, formThemeClasses } from "@ai-matrx/design-system";
|
|
45402
45661
|
import { answerRefusal, formRoutes, pipeAnswers, submissionStamp } from "@ai-matrx/records/forms";
|
|
45403
45662
|
import { humanizeIdentifier as humanizeIdentifier21 } from "@ai-matrx/kit/text-case";
|
|
45404
|
-
import { Fragment as
|
|
45663
|
+
import { Fragment as Fragment59, jsx as jsx150, jsxs as jsxs138 } from "react/jsx-runtime";
|
|
45405
45664
|
function authored(host, text, where) {
|
|
45406
45665
|
return host.renderText ? host.renderText(text, where) : text;
|
|
45407
45666
|
}
|
|
@@ -45975,7 +46234,7 @@ function ThankYou({
|
|
|
45975
46234
|
),
|
|
45976
46235
|
ending?.pictureUrl ? /* @__PURE__ */ jsx150("img", { src: ending.pictureUrl, alt: "", className: "mb-3 max-h-48 w-full rounded-md object-cover" }) : null,
|
|
45977
46236
|
/* @__PURE__ */ jsx150("h2", { className: "text-2xl font-semibold", "data-records-form-ending": ending?.id ?? "", children: title || "Thank you" }),
|
|
45978
|
-
body ? /* @__PURE__ */ jsxs138(
|
|
46237
|
+
body ? /* @__PURE__ */ jsxs138(Fragment59, { children: [
|
|
45979
46238
|
done === "preview" ? /* @__PURE__ */ jsx150("p", { className: "mt-2 text-xs uppercase tracking-wide text-muted-foreground", children: "After a real send, people read:" }) : null,
|
|
45980
46239
|
/* @__PURE__ */ jsx150("p", { className: "mt-2 text-base text-muted-foreground", children: authored(host, body, "form-thank-you") })
|
|
45981
46240
|
] }) : null,
|
|
@@ -46031,7 +46290,7 @@ function Question({
|
|
|
46031
46290
|
field2.unit ? /* @__PURE__ */ jsx150("span", { className: "text-sm text-foreground/70", children: field2.unit }) : null
|
|
46032
46291
|
] }),
|
|
46033
46292
|
question.help ? /* @__PURE__ */ jsx150("p", { className: cn83("text-muted-foreground", large ? "text-base" : "text-sm"), children: authored(host, question.help, "form-help") }) : null,
|
|
46034
|
-
isAttachment && !upload ? /* @__PURE__ */ jsx150("p", { className: "w-fit rounded border border-dashed px-2 py-0.5 text-xs text-muted-foreground", title: NO_UPLOAD_REASON, children: "File upload unavailable here" }) : isAttachment ? /* @__PURE__ */ jsxs138(
|
|
46293
|
+
isAttachment && !upload ? /* @__PURE__ */ jsx150("p", { className: "w-fit rounded border border-dashed px-2 py-0.5 text-xs text-muted-foreground", title: NO_UPLOAD_REASON, children: "File upload unavailable here" }) : isAttachment ? /* @__PURE__ */ jsxs138(Fragment59, { children: [
|
|
46035
46294
|
/* @__PURE__ */ jsx150(
|
|
46036
46295
|
"input",
|
|
46037
46296
|
{
|
|
@@ -46075,7 +46334,7 @@ import {
|
|
|
46075
46334
|
formFromSummary,
|
|
46076
46335
|
formLookDocument
|
|
46077
46336
|
} from "@ai-matrx/records/forms";
|
|
46078
|
-
import { Fragment as
|
|
46337
|
+
import { Fragment as Fragment60, jsx as jsx151, jsxs as jsxs139 } from "react/jsx-runtime";
|
|
46079
46338
|
function freshFormName(base2, taken) {
|
|
46080
46339
|
const names = new Set(taken.map((n) => n.trim().toLowerCase()));
|
|
46081
46340
|
if (!names.has(base2.toLowerCase())) return base2;
|
|
@@ -46476,7 +46735,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
|
|
|
46476
46735
|
}
|
|
46477
46736
|
)
|
|
46478
46737
|
] }) : null,
|
|
46479
|
-
!draft ? /* @__PURE__ */ jsx151("p", { className: "text-xs text-muted-foreground", children: (fields.data ?? []).length === 0 ? "No fields yet" : "No form yet" }) : /* @__PURE__ */ jsxs139(
|
|
46738
|
+
!draft ? /* @__PURE__ */ jsx151("p", { className: "text-xs text-muted-foreground", children: (fields.data ?? []).length === 0 ? "No fields yet" : "No form yet" }) : /* @__PURE__ */ jsxs139(Fragment60, { children: [
|
|
46480
46739
|
/* @__PURE__ */ jsx151(
|
|
46481
46740
|
PublishRow,
|
|
46482
46741
|
{
|
|
@@ -46727,7 +46986,7 @@ function PublishRow({
|
|
|
46727
46986
|
children: busy ? "\u2026" : open ? "Unpublish" : unsaved ? "Save and publish" : "Publish"
|
|
46728
46987
|
}
|
|
46729
46988
|
) : null,
|
|
46730
|
-
state !== "draft" ? /* @__PURE__ */ jsxs139(
|
|
46989
|
+
state !== "draft" ? /* @__PURE__ */ jsxs139(Fragment60, { children: [
|
|
46731
46990
|
/* @__PURE__ */ jsx151(
|
|
46732
46991
|
"a",
|
|
46733
46992
|
{
|
|
@@ -48168,7 +48427,7 @@ function combineFilter(base2, extra, fieldIdOf) {
|
|
|
48168
48427
|
}
|
|
48169
48428
|
|
|
48170
48429
|
// src/DashboardCanvas.tsx
|
|
48171
|
-
import { Fragment as
|
|
48430
|
+
import { Fragment as Fragment61, jsx as jsx158, jsxs as jsxs146 } from "react/jsx-runtime";
|
|
48172
48431
|
function DashboardCanvas({ tableId, activeDashboardId, filter, createOnMount, onCreated, className }) {
|
|
48173
48432
|
const client = useRecordsClient95();
|
|
48174
48433
|
const host = useRecordsUi();
|
|
@@ -48421,7 +48680,7 @@ function DashboardCanvas({ tableId, activeDashboardId, filter, createOnMount, on
|
|
|
48421
48680
|
children: scheduling ? "Done" : "Send on a schedule"
|
|
48422
48681
|
}
|
|
48423
48682
|
),
|
|
48424
|
-
rights.admin && askingToRemove === board.id ? /* @__PURE__ */ jsxs146(
|
|
48683
|
+
rights.admin && askingToRemove === board.id ? /* @__PURE__ */ jsxs146(Fragment61, { children: [
|
|
48425
48684
|
/* @__PURE__ */ jsx158("span", { className: "text-xs text-destructive", children: archiveConfirmSentence(`the dashboard \u201C${board.name}\u201D`) }),
|
|
48426
48685
|
/* @__PURE__ */ jsx158(Button104, { size: "sm", variant: "destructive", onClick: () => void remove(board), children: "Remove it" }),
|
|
48427
48686
|
/* @__PURE__ */ jsx158(Button104, { size: "sm", variant: "ghost", onClick: () => setAskingToRemove(null), children: "Keep it" })
|
|
@@ -48469,7 +48728,7 @@ function DashboardCanvas({ tableId, activeDashboardId, filter, createOnMount, on
|
|
|
48469
48728
|
/* @__PURE__ */ jsx158(Button104, { size: "sm", disabled: !host.onReask || asking || question.trim() === "", onClick: () => void reask(), children: asking ? "Asking" : "Ask" })
|
|
48470
48729
|
] }) }) : null,
|
|
48471
48730
|
notKept ? /* @__PURE__ */ jsx158("p", { role: "status", "data-records-dashboard-not-kept": "", className: "text-xs text-amber-700 dark:text-amber-400", children: notKept }) : null,
|
|
48472
|
-
!board ? /* @__PURE__ */ jsx158("p", { className: "text-xs text-muted-foreground", children: rights.admin ? "No dashboards yet." : rights.why("structure") }) : run === null ? /* @__PURE__ */ jsx158(Skeleton37, { className: "h-64 w-full" }) : run.blocks.length === 0 ? /* @__PURE__ */ jsx158("p", { className: "text-xs text-muted-foreground", children: "No charts yet." }) : /* @__PURE__ */ jsxs146(
|
|
48731
|
+
!board ? /* @__PURE__ */ jsx158("p", { className: "text-xs text-muted-foreground", children: rights.admin ? "No dashboards yet." : rights.why("structure") }) : run === null ? /* @__PURE__ */ jsx158(Skeleton37, { className: "h-64 w-full" }) : run.blocks.length === 0 ? /* @__PURE__ */ jsx158("p", { className: "text-xs text-muted-foreground", children: "No charts yet." }) : /* @__PURE__ */ jsxs146(Fragment61, { children: [
|
|
48473
48732
|
/* @__PURE__ */ jsx158(
|
|
48474
48733
|
DashboardGrid,
|
|
48475
48734
|
{
|
|
@@ -48483,7 +48742,7 @@ function DashboardCanvas({ tableId, activeDashboardId, filter, createOnMount, on
|
|
|
48483
48742
|
id: board.blocks[index]?.id ?? block.id ?? `block-${index}`,
|
|
48484
48743
|
title: block.title,
|
|
48485
48744
|
span: board.blocks[index]?.span ?? block.span,
|
|
48486
|
-
body: /* @__PURE__ */ jsxs146(
|
|
48745
|
+
body: /* @__PURE__ */ jsxs146(Fragment61, { children: [
|
|
48487
48746
|
spansTables ? /* @__PURE__ */ jsx158(ChartOfTable, { block, subject: tableId, table: board.blocks[index]?.subject ?? block.table_id ?? tableId }) : /* @__PURE__ */ jsx158(ChartBlock, { block, subject: tableId }),
|
|
48488
48747
|
rights.admin && board.blocks[index] ? /* @__PURE__ */ jsx158(
|
|
48489
48748
|
BlockSettingsMenu,
|
|
@@ -48590,7 +48849,7 @@ function GroupingPicker({
|
|
|
48590
48849
|
return /* @__PURE__ */ jsx158("span", { className: "text-muted-foreground", children: "No columns to group by." });
|
|
48591
48850
|
}
|
|
48592
48851
|
const known = choices.some((c) => c.field.key === current);
|
|
48593
|
-
return /* @__PURE__ */ jsxs146(
|
|
48852
|
+
return /* @__PURE__ */ jsxs146(Fragment61, { children: [
|
|
48594
48853
|
/* @__PURE__ */ jsx158("label", { className: "text-muted-foreground", htmlFor: `block-group-${block.title}`, children: "Group by" }),
|
|
48595
48854
|
/* @__PURE__ */ jsxs146(Select19, { value: known ? current : "", onValueChange: onPick, children: [
|
|
48596
48855
|
/* @__PURE__ */ jsx158(
|
|
@@ -48687,7 +48946,7 @@ function CompareControl({
|
|
|
48687
48946
|
// that has one does not lose it by being shown.
|
|
48688
48947
|
(k) => k !== "range" || current === "range"
|
|
48689
48948
|
);
|
|
48690
|
-
return /* @__PURE__ */ jsxs146(
|
|
48949
|
+
return /* @__PURE__ */ jsxs146(Fragment61, { children: [
|
|
48691
48950
|
/* @__PURE__ */ jsxs146(
|
|
48692
48951
|
Select19,
|
|
48693
48952
|
{
|
|
@@ -48749,7 +49008,7 @@ function TargetControl({
|
|
|
48749
49008
|
if (draft.trim() === "" || !Number.isFinite(n) || n === savedValue) return;
|
|
48750
49009
|
onChange({ value: n, label: label && saved === "value" ? label : "Target", ...per ? { per } : {} });
|
|
48751
49010
|
}
|
|
48752
|
-
return /* @__PURE__ */ jsxs146(
|
|
49011
|
+
return /* @__PURE__ */ jsxs146(Fragment61, { children: [
|
|
48753
49012
|
/* @__PURE__ */ jsxs146(
|
|
48754
49013
|
Select19,
|
|
48755
49014
|
{
|
|
@@ -48814,7 +49073,7 @@ __reExport(question_exports, questions_star);
|
|
|
48814
49073
|
import * as questions_star from "@ai-matrx/records/questions";
|
|
48815
49074
|
|
|
48816
49075
|
// src/QuestionPanel.tsx
|
|
48817
|
-
import { Fragment as
|
|
49076
|
+
import { Fragment as Fragment62, jsx as jsx159, jsxs as jsxs147 } from "react/jsx-runtime";
|
|
48818
49077
|
var OP_LABEL = { count: "Count", sum: "Sum", avg: "Average", min: "Smallest", max: "Largest" };
|
|
48819
49078
|
var BUCKETS = [
|
|
48820
49079
|
{ value: "", label: "Exact date" },
|
|
@@ -49065,7 +49324,7 @@ function QuestionPanel({ tableId, activeQuestionId, draft, className }) {
|
|
|
49065
49324
|
}
|
|
49066
49325
|
) : /* @__PURE__ */ jsx159("span", { className: "text-muted-foreground", children: "Now" })
|
|
49067
49326
|
] }),
|
|
49068
|
-
spec.group ? /* @__PURE__ */ jsxs147(
|
|
49327
|
+
spec.group ? /* @__PURE__ */ jsxs147(Fragment62, { children: [
|
|
49069
49328
|
/* @__PURE__ */ jsx159(Label27, { className: "pt-1.5 text-xs text-muted-foreground", children: "Sort" }),
|
|
49070
49329
|
/* @__PURE__ */ jsxs147("div", { className: "flex flex-wrap items-center gap-1.5", children: [
|
|
49071
49330
|
/* @__PURE__ */ jsx159(
|
|
@@ -49583,7 +49842,7 @@ function questionFromWords(text, fields, choices = {}) {
|
|
|
49583
49842
|
}
|
|
49584
49843
|
|
|
49585
49844
|
// src/TableAsk.tsx
|
|
49586
|
-
import { Fragment as
|
|
49845
|
+
import { Fragment as Fragment63, jsx as jsx160, jsxs as jsxs148 } from "react/jsx-runtime";
|
|
49587
49846
|
function askExampleFor(fields) {
|
|
49588
49847
|
const by = fields.find(isChoiceField);
|
|
49589
49848
|
return by ? `count by ${fieldName(by)}` : "count";
|
|
@@ -49651,14 +49910,14 @@ function TableAsk({ tableId, onOpenInQuestions, viewId }) {
|
|
|
49651
49910
|
),
|
|
49652
49911
|
/* @__PURE__ */ jsxs148("div", { className: said2.kind === "idle" ? "hidden" : "flex min-h-32 flex-col gap-2", "data-table-ask-slot": "", children: [
|
|
49653
49912
|
said2.kind === "not-read" ? /* @__PURE__ */ jsx160("p", { className: "text-muted-foreground", role: "status", "data-table-ask-not-read": "", children: said2.why }) : null,
|
|
49654
|
-
said2.kind === "asking" ? /* @__PURE__ */ jsxs148(
|
|
49913
|
+
said2.kind === "asking" ? /* @__PURE__ */ jsxs148(Fragment63, { children: [
|
|
49655
49914
|
/* @__PURE__ */ jsx160("p", { className: "truncate text-muted-foreground", children: said2.reads }),
|
|
49656
49915
|
/* @__PURE__ */ jsx160(Skeleton39, { className: "h-24 w-full", "data-table-ask-pending": "" })
|
|
49657
49916
|
] }) : null,
|
|
49658
49917
|
said2.kind === "agent-failed" ? /* @__PURE__ */ jsx160("div", { "data-table-ask-failed": "", children: /* @__PURE__ */ jsx160(RefusalNotice, { error: said2.error }) }) : null,
|
|
49659
49918
|
said2.kind === "agent-answer" ? /* @__PURE__ */ jsx160(AgentAnswer, { tableId, answer: said2.answer, fields: all, costPoints: said2.costPoints }) : null,
|
|
49660
49919
|
said2.kind === "refused" ? /* @__PURE__ */ jsx160(RefusalNotice, { error: said2.error }) : null,
|
|
49661
|
-
said2.kind === "answer" ? /* @__PURE__ */ jsxs148(
|
|
49920
|
+
said2.kind === "answer" ? /* @__PURE__ */ jsxs148(Fragment63, { children: [
|
|
49662
49921
|
/* @__PURE__ */ jsx160("p", { className: "truncate text-muted-foreground", title: said2.reads, "data-table-ask-reads": "", children: said2.reads }),
|
|
49663
49922
|
/* @__PURE__ */ jsx160("div", { className: "max-h-64 overflow-y-auto", "data-table-ask-answer": "", children: /* @__PURE__ */ jsx160(QuestionAnswerView, { tableId, spec: said2.spec, answer: said2.answer, fields: all }) }),
|
|
49664
49923
|
onOpenInQuestions ? /* @__PURE__ */ jsx160(
|
|
@@ -49789,7 +50048,7 @@ import {
|
|
|
49789
50048
|
import { onRecordChanged as onRecordChanged2 } from "@ai-matrx/records/core";
|
|
49790
50049
|
import { BasicInput as BasicInput35, Button as Button107, Checkbox as Checkbox19, Skeleton as Skeleton40, cn as cn92 } from "@ai-matrx/design-system";
|
|
49791
50050
|
import { formFromSummary as formFromSummary2 } from "@ai-matrx/records/forms";
|
|
49792
|
-
import { Fragment as
|
|
50051
|
+
import { Fragment as Fragment64, jsx as jsx161, jsxs as jsxs149 } from "react/jsx-runtime";
|
|
49793
50052
|
var EDIT_LEVELS = /* @__PURE__ */ new Set(["edit_content", "editor", "admin", "owner"]);
|
|
49794
50053
|
function PageScreen({
|
|
49795
50054
|
pageId,
|
|
@@ -50008,7 +50267,7 @@ function PageScreen({
|
|
|
50008
50267
|
className: "h-8 w-40"
|
|
50009
50268
|
}
|
|
50010
50269
|
),
|
|
50011
|
-
/* @__PURE__ */ jsx161("span", { className: "ml-auto flex items-center gap-1", children: askingToArchive ? /* @__PURE__ */ jsxs149(
|
|
50270
|
+
/* @__PURE__ */ jsx161("span", { className: "ml-auto flex items-center gap-1", children: askingToArchive ? /* @__PURE__ */ jsxs149(Fragment64, { children: [
|
|
50012
50271
|
/* @__PURE__ */ jsx161("span", { className: "text-destructive", children: archiveConfirmSentence(`the page \u201C${page.name}\u201D`) }),
|
|
50013
50272
|
/* @__PURE__ */ jsx161(Button107, { size: "sm", variant: "destructive", onClick: () => void archive(), children: "Archive it" }),
|
|
50014
50273
|
/* @__PURE__ */ jsx161(Button107, { size: "sm", variant: "ghost", onClick: () => setAskingToArchive(false), children: "Keep it" })
|
|
@@ -50113,7 +50372,7 @@ function AppletBlockView({ block }) {
|
|
|
50113
50372
|
const host = useRecordsUi();
|
|
50114
50373
|
if (!host.applets) return /* @__PURE__ */ jsx161(BlockNote, { children: "Applets open inside AI Matrx." });
|
|
50115
50374
|
if (!block.app_id) return /* @__PURE__ */ jsx161(BlockNote, { children: "Choose an applet." });
|
|
50116
|
-
return /* @__PURE__ */ jsx161(
|
|
50375
|
+
return /* @__PURE__ */ jsx161(Fragment64, { children: host.applets.render(block.app_id) });
|
|
50117
50376
|
}
|
|
50118
50377
|
function AppletPick({ value, onChange }) {
|
|
50119
50378
|
const host = useRecordsUi();
|
|
@@ -50294,7 +50553,7 @@ function ActionButton2({ block, recordId }) {
|
|
|
50294
50553
|
else setError(ran.error);
|
|
50295
50554
|
}
|
|
50296
50555
|
return /* @__PURE__ */ jsxs149("div", { className: "flex flex-wrap items-center gap-2", "data-records-page-button": block.id, children: [
|
|
50297
|
-
asking ? /* @__PURE__ */ jsxs149(
|
|
50556
|
+
asking ? /* @__PURE__ */ jsxs149(Fragment64, { children: [
|
|
50298
50557
|
/* @__PURE__ */ jsx161("span", { className: "text-xs", children: `${label}?` }),
|
|
50299
50558
|
/* @__PURE__ */ jsx161(Button107, { size: "sm", onClick: () => void runIt(), children: label }),
|
|
50300
50559
|
/* @__PURE__ */ jsx161(Button107, { size: "sm", variant: "ghost", onClick: () => setAsking(false), children: "Cancel" })
|
|
@@ -50386,7 +50645,7 @@ function BlockSettings2({
|
|
|
50386
50645
|
),
|
|
50387
50646
|
block.kind === "list" ? /* @__PURE__ */ jsx161(ListSettings, { block, onChange }) : null,
|
|
50388
50647
|
block.kind === "record" ? /* @__PURE__ */ jsx161(PickOne, { label: "Follows list", placeholder: "Choose a list", value: block.source, options: listOptions, onChange: (source) => onChange({ ...block, source }), className: "h-7 w-36" }) : null,
|
|
50389
|
-
block.kind === "button" ? /* @__PURE__ */ jsxs149(
|
|
50648
|
+
block.kind === "button" ? /* @__PURE__ */ jsxs149(Fragment64, { children: [
|
|
50390
50649
|
/* @__PURE__ */ jsx161(
|
|
50391
50650
|
PickOne,
|
|
50392
50651
|
{
|
|
@@ -50403,11 +50662,11 @@ function BlockSettings2({
|
|
|
50403
50662
|
),
|
|
50404
50663
|
/* @__PURE__ */ jsx161(ActionPicker, { tableId: block.table_id, value: block.action_id, onChange: (action_id) => onChange({ ...block, action_id }) })
|
|
50405
50664
|
] }) : null,
|
|
50406
|
-
block.kind === "form" ? /* @__PURE__ */ jsxs149(
|
|
50665
|
+
block.kind === "form" ? /* @__PURE__ */ jsxs149(Fragment64, { children: [
|
|
50407
50666
|
/* @__PURE__ */ jsx161(TablePick, { value: block.table_id, onChange: (table_id) => onChange({ ...block, table_id, form_id: "" }) }),
|
|
50408
50667
|
/* @__PURE__ */ jsx161(FormPicker, { tableId: block.table_id, value: block.form_id, onChange: (form_id) => onChange({ ...block, form_id }) })
|
|
50409
50668
|
] }) : null,
|
|
50410
|
-
block.kind === "filter" ? /* @__PURE__ */ jsxs149(
|
|
50669
|
+
block.kind === "filter" ? /* @__PURE__ */ jsxs149(Fragment64, { children: [
|
|
50411
50670
|
/* @__PURE__ */ jsx161(TablePick, { value: block.table_id, onChange: (table_id) => onChange({ ...block, table_id, field: "" }) }),
|
|
50412
50671
|
/* @__PURE__ */ jsx161(FieldPick, { tableId: block.table_id, want: "choice", label: "Filter column", value: block.field, onChange: (field2) => onChange({ ...block, field: field2 }) })
|
|
50413
50672
|
] }) : null,
|
|
@@ -50454,7 +50713,7 @@ function ListSettings({ block, onChange }) {
|
|
|
50454
50713
|
};
|
|
50455
50714
|
}, [client, block.table_id]);
|
|
50456
50715
|
const shown5 = block.columns && block.columns.length > 0 ? block.columns : [...all].sort((a, b) => (a.sort ?? 100) - (b.sort ?? 100)).slice(0, DEFAULT_COLUMNS).map((f) => f.key);
|
|
50457
|
-
return /* @__PURE__ */ jsxs149(
|
|
50716
|
+
return /* @__PURE__ */ jsxs149(Fragment64, { children: [
|
|
50458
50717
|
/* @__PURE__ */ jsx161(
|
|
50459
50718
|
TablePick,
|
|
50460
50719
|
{
|
|
@@ -50534,7 +50793,7 @@ function FormPicker({ tableId, value, onChange }) {
|
|
|
50534
50793
|
return /* @__PURE__ */ jsx161(PickOne, { label: "Form", placeholder: "Choose a form", value, options, onChange: (v) => onChange(v), className: "h-7 w-40" });
|
|
50535
50794
|
}
|
|
50536
50795
|
function ChartSettings({ chart, onChange }) {
|
|
50537
|
-
return /* @__PURE__ */ jsxs149(
|
|
50796
|
+
return /* @__PURE__ */ jsxs149(Fragment64, { children: [
|
|
50538
50797
|
/* @__PURE__ */ jsx161(TablePick, { value: chart.subject, onChange: (subject) => onChange({ ...chart, subject, groupBy: [] }) }),
|
|
50539
50798
|
/* @__PURE__ */ jsx161(
|
|
50540
50799
|
PickOne,
|
|
@@ -50572,7 +50831,7 @@ import { useRecordsClient as useRecordsClient99, useTable as useTable37 } from "
|
|
|
50572
50831
|
import { publicFormPath as publicFormPath2 } from "@ai-matrx/records";
|
|
50573
50832
|
import { Badge as Badge25, Button as Button108, Skeleton as Skeleton41, cn as cn93 } from "@ai-matrx/design-system";
|
|
50574
50833
|
import { FORM_STATE_WORDS as FORM_STATE_WORDS2 } from "@ai-matrx/records/forms";
|
|
50575
|
-
import { Fragment as
|
|
50834
|
+
import { Fragment as Fragment65, jsx as jsx162, jsxs as jsxs150 } from "react/jsx-runtime";
|
|
50576
50835
|
var FORM_NOT_HERE_LINE = "The link named a form this table does not have \u2014 it may have been removed, or it belongs to another table. The forms this table does have are listed here.";
|
|
50577
50836
|
var WHAT_A_FORM_IS = "A form asks for this table's own fields, and its answers land here as ordinary records stamped with the form they came through.";
|
|
50578
50837
|
var NO_ADMIN2 = "This table has no forms. Making one needs the admin level on it, because a form decides what people with no account may add here.";
|
|
@@ -50708,12 +50967,12 @@ function FormsPanel({ tableId, activeFormId, className }) {
|
|
|
50708
50967
|
/* @__PURE__ */ jsxs150("p", { className: "mt-1.5 text-xs", children: [
|
|
50709
50968
|
/* @__PURE__ */ jsx162("span", { className: "font-medium", children: form.in_table }),
|
|
50710
50969
|
" in the table",
|
|
50711
|
-
form.held > 0 ? /* @__PURE__ */ jsxs150(
|
|
50970
|
+
form.held > 0 ? /* @__PURE__ */ jsxs150(Fragment65, { children: [
|
|
50712
50971
|
" \xB7 ",
|
|
50713
50972
|
/* @__PURE__ */ jsx162("span", { className: "font-medium", children: form.held }),
|
|
50714
50973
|
" waiting for someone"
|
|
50715
50974
|
] }) : null,
|
|
50716
|
-
form.rejected > 0 ? /* @__PURE__ */ jsxs150(
|
|
50975
|
+
form.rejected > 0 ? /* @__PURE__ */ jsxs150(Fragment65, { children: [
|
|
50717
50976
|
" \xB7 ",
|
|
50718
50977
|
/* @__PURE__ */ jsx162("span", { className: "font-medium", children: form.rejected }),
|
|
50719
50978
|
" turned away"
|
|
@@ -51142,7 +51401,7 @@ function CaptureRun({ sheetId, face: given, className }) {
|
|
|
51142
51401
|
}
|
|
51143
51402
|
|
|
51144
51403
|
// src/CaptureSheet.tsx
|
|
51145
|
-
import { Fragment as
|
|
51404
|
+
import { Fragment as Fragment66, jsx as jsx164, jsxs as jsxs152 } from "react/jsx-runtime";
|
|
51146
51405
|
var CAPTURE_MODES = ["reading", "photo", "voice"];
|
|
51147
51406
|
var IN_MEMORY_QUEUE_REASON = "Anything you capture while offline is held only in this page until it can be sent, and it is lost if you close the tab. Keep this page open until you are back on a connection. It is said here rather than discovered later.";
|
|
51148
51407
|
function mintClientKey() {
|
|
@@ -51319,7 +51578,7 @@ function AdHocCaptureSheet({
|
|
|
51319
51578
|
" ",
|
|
51320
51579
|
/* @__PURE__ */ jsx164("code", { children: "attachmentField" }),
|
|
51321
51580
|
"."
|
|
51322
|
-
] }) : /* @__PURE__ */ jsxs152(
|
|
51581
|
+
] }) : /* @__PURE__ */ jsxs152(Fragment66, { children: [
|
|
51323
51582
|
/* @__PURE__ */ jsx164(
|
|
51324
51583
|
"input",
|
|
51325
51584
|
{
|
|
@@ -51593,7 +51852,7 @@ import { useCallback as useCallback68, useEffect as useEffect120, useState as us
|
|
|
51593
51852
|
import { useRecordsClient as useRecordsClient104 } from "@ai-matrx/records/react";
|
|
51594
51853
|
import { Button as Button112, Input as Input10, Skeleton as Skeleton46, Textarea as Textarea9, cn as cn98 } from "@ai-matrx/design-system";
|
|
51595
51854
|
import { useTable as useTable39 } from "@ai-matrx/records/react";
|
|
51596
|
-
import { Fragment as
|
|
51855
|
+
import { Fragment as Fragment67, jsx as jsx167, jsxs as jsxs155 } from "react/jsx-runtime";
|
|
51597
51856
|
function EmbedFrame({
|
|
51598
51857
|
tableId,
|
|
51599
51858
|
formId,
|
|
@@ -51677,7 +51936,7 @@ function EmbedFrame({
|
|
|
51677
51936
|
" will not pass."
|
|
51678
51937
|
] })
|
|
51679
51938
|
] }),
|
|
51680
|
-
!secret ? /* @__PURE__ */ jsx167(Button112, { size: "sm", className: "self-start", disabled: busy || parsed.length === 0, onClick: () => void issue(), children: busy ? "Issuing\u2026" : "Issue embed" }) : /* @__PURE__ */ jsxs155(
|
|
51939
|
+
!secret ? /* @__PURE__ */ jsx167(Button112, { size: "sm", className: "self-start", disabled: busy || parsed.length === 0, onClick: () => void issue(), children: busy ? "Issuing\u2026" : "Issue embed" }) : /* @__PURE__ */ jsxs155(Fragment67, { children: [
|
|
51681
51940
|
/* @__PURE__ */ jsx167("p", { className: "rounded border px-2 py-1 text-xs text-muted-foreground", children: "Copy this now. Only its digest is stored, so nobody \u2014 including us \u2014 can show it to you again; if it is lost, issue a new one and replace the old." }),
|
|
51682
51941
|
/* @__PURE__ */ jsx167(Textarea9, { "aria-label": "Embed snippet", readOnly: true, rows: 3, className: "font-mono text-[11px]", value: snippet ?? "" }),
|
|
51683
51942
|
/* @__PURE__ */ jsxs155("div", { className: "flex gap-2", children: [
|
|
@@ -51727,7 +51986,7 @@ function useEmbedHandshake(args) {
|
|
|
51727
51986
|
import { copyText as copyText15 } from "@ai-matrx/kit/clipboard";
|
|
51728
51987
|
import { useCallback as useCallback70, useEffect as useEffect123, useMemo as useMemo82, useRef as useRef63, useState as useState150 } from "react";
|
|
51729
51988
|
import { archivedByLine as archivedByLine2 } from "@ai-matrx/records";
|
|
51730
|
-
import { tableShapeChanged as
|
|
51989
|
+
import { tableShapeChanged as tableShapeChanged15, useFields as useFields39, useRecordsClient as useRecordsClient106, useSeededAnswer, useTable as useTable40, useTableArchive as useTableArchive2 } from "@ai-matrx/records/react";
|
|
51731
51990
|
import {
|
|
51732
51991
|
Badge as Badge26,
|
|
51733
51992
|
BottomSheet,
|
|
@@ -51989,16 +52248,16 @@ async function runTablePageAction(kind, args) {
|
|
|
51989
52248
|
}
|
|
51990
52249
|
|
|
51991
52250
|
// src/RecordPanel.tsx
|
|
51992
|
-
import { Fragment as
|
|
52251
|
+
import { Fragment as Fragment68, useState as useState144 } from "react";
|
|
51993
52252
|
import { Button as Button114, Separator as Separator13 } from "@ai-matrx/design-system";
|
|
51994
52253
|
import { useFields as useFields37, useRecord as useRecord5 } from "@ai-matrx/records/react";
|
|
51995
|
-
import { Fragment as
|
|
52254
|
+
import { Fragment as Fragment69, jsx as jsx169, jsxs as jsxs157 } from "react/jsx-runtime";
|
|
51996
52255
|
function RecordPanel({ tableId, recordId, onClose, onAskAboutField, onPage = false }) {
|
|
51997
52256
|
const host = useRecordsUi();
|
|
51998
52257
|
const [asking, setAsking] = useState144(null);
|
|
51999
52258
|
return /* @__PURE__ */ jsxs157("div", { className: "space-y-3", "data-record-panel": recordId, children: [
|
|
52000
52259
|
/* @__PURE__ */ jsx169(Peek, { tableId, recordId, onPage, ...onClose ? { onClose } : {} }),
|
|
52001
|
-
onPage ? /* @__PURE__ */ jsxs157(
|
|
52260
|
+
onPage ? /* @__PURE__ */ jsxs157(Fragment69, { children: [
|
|
52002
52261
|
/* @__PURE__ */ jsx169(RecordBody, { tableId, recordId }),
|
|
52003
52262
|
/* @__PURE__ */ jsx169(LinkedLists, { tableId, recordId }),
|
|
52004
52263
|
/* @__PURE__ */ jsx169(ReverseLinksSections, { tableId, recordId }),
|
|
@@ -52014,7 +52273,7 @@ function RecordPanel({ tableId, recordId, onClose, onAskAboutField, onPage = fal
|
|
|
52014
52273
|
}
|
|
52015
52274
|
),
|
|
52016
52275
|
!onAskAboutField && asking ? /* @__PURE__ */ jsx169(FieldHistoryPanel, { tableId, fieldKey: asking, recordId, onClose: () => setAsking(null) }) : null,
|
|
52017
|
-
host.recordSections ? /* @__PURE__ */ jsxs157(
|
|
52276
|
+
host.recordSections ? /* @__PURE__ */ jsxs157(Fragment68, { children: [
|
|
52018
52277
|
/* @__PURE__ */ jsx169(Separator13, {}),
|
|
52019
52278
|
host.recordSections({ tableId, recordId })
|
|
52020
52279
|
] }) : null,
|
|
@@ -52207,9 +52466,9 @@ function TableReferenceDialog({
|
|
|
52207
52466
|
// src/TableDuplicate.tsx
|
|
52208
52467
|
import { formatCount as formatCount7 } from "@ai-matrx/kit/format";
|
|
52209
52468
|
import { useState as useState147 } from "react";
|
|
52210
|
-
import { tableShapeChanged as
|
|
52469
|
+
import { tableShapeChanged as tableShapeChanged14, useRecordsClient as useRecordsClient105 } from "@ai-matrx/records/react";
|
|
52211
52470
|
import { Button as Button117, Dialog as Dialog20, DialogContent as DialogContent20, DialogFooter as DialogFooter13, DialogHeader as DialogHeader20, DialogTitle as DialogTitle20, ErrorBox as ErrorBox8, Input as Input11, Switch as Switch7 } from "@ai-matrx/design-system";
|
|
52212
|
-
import { Fragment as
|
|
52471
|
+
import { Fragment as Fragment70, jsx as jsx172, jsxs as jsxs160 } from "react/jsx-runtime";
|
|
52213
52472
|
function copyNameFor(name) {
|
|
52214
52473
|
return `${name.trim() || "Table"} (copy)`;
|
|
52215
52474
|
}
|
|
@@ -52247,7 +52506,7 @@ function TableDuplicateDialog({ tableId, name, open, onOpenChange, onDuplicated
|
|
|
52247
52506
|
setPhase({ kind: "refused", sentence: refusalSentence(made.error) });
|
|
52248
52507
|
return;
|
|
52249
52508
|
}
|
|
52250
|
-
|
|
52509
|
+
tableShapeChanged14(made.data.table.id);
|
|
52251
52510
|
setPhase({ kind: "done", copy: made.data });
|
|
52252
52511
|
host.notify?.success(`Made ${made.data.table.name}`);
|
|
52253
52512
|
};
|
|
@@ -52300,7 +52559,7 @@ function TableDuplicateDialog({ tableId, name, open, onOpenChange, onDuplicated
|
|
|
52300
52559
|
phase.kind === "refused" ? /* @__PURE__ */ jsx172(ErrorBox8, { children: phase.sentence }) : null,
|
|
52301
52560
|
problem && typed2 !== "" ? /* @__PURE__ */ jsx172("p", { className: "text-xs text-muted-foreground", children: problem }) : null
|
|
52302
52561
|
] }),
|
|
52303
|
-
/* @__PURE__ */ jsx172(DialogFooter13, { children: phase.kind === "done" ? /* @__PURE__ */ jsx172(Button117, { onClick: () => openCopy(phase.copy), "data-table-duplicate-open": "", children: "Open the copy" }) : /* @__PURE__ */ jsxs160(
|
|
52562
|
+
/* @__PURE__ */ jsx172(DialogFooter13, { children: phase.kind === "done" ? /* @__PURE__ */ jsx172(Button117, { onClick: () => openCopy(phase.copy), "data-table-duplicate-open": "", children: "Open the copy" }) : /* @__PURE__ */ jsxs160(Fragment70, { children: [
|
|
52304
52563
|
/* @__PURE__ */ jsx172(Button117, { variant: "ghost", disabled: copying, onClick: () => close(false), children: "Cancel" }),
|
|
52305
52564
|
/* @__PURE__ */ jsx172(Button117, { disabled: copying || problem !== null, onClick: () => void go(), children: copying ? "Duplicating\u2026" : "Duplicate" })
|
|
52306
52565
|
] }) })
|
|
@@ -52687,7 +52946,7 @@ function useSlotScroll(slot) {
|
|
|
52687
52946
|
|
|
52688
52947
|
// src/TablePage.tsx
|
|
52689
52948
|
import { isUuidShape as isUuidShape3 } from "@ai-matrx/kit/uuid";
|
|
52690
|
-
import { Fragment as
|
|
52949
|
+
import { Fragment as Fragment71, jsx as jsx175, jsxs as jsxs163 } from "react/jsx-runtime";
|
|
52691
52950
|
var RAIL_TITLE = {
|
|
52692
52951
|
settings: "Table settings",
|
|
52693
52952
|
inbox: "Inbox",
|
|
@@ -53064,9 +53323,9 @@ function TablePage({
|
|
|
53064
53323
|
client,
|
|
53065
53324
|
tableId,
|
|
53066
53325
|
name: finished.table_name || table.data?.name || "the table",
|
|
53067
|
-
onRestored: () =>
|
|
53326
|
+
onRestored: () => tableShapeChanged15(tableId)
|
|
53068
53327
|
});
|
|
53069
|
-
|
|
53328
|
+
tableShapeChanged15(tableId);
|
|
53070
53329
|
return;
|
|
53071
53330
|
}
|
|
53072
53331
|
setSurface((now) => ({ ...now, main: "records", rail: "settings" }));
|
|
@@ -53336,7 +53595,7 @@ function TablePage({
|
|
|
53336
53595
|
children: VIEW_LAYOUTS.map((option) => /* @__PURE__ */ jsx175(DropdownMenuRadioItem3, { value: option, children: LAYOUT_LABEL[option] }, option))
|
|
53337
53596
|
}
|
|
53338
53597
|
);
|
|
53339
|
-
const sheetExtras = controlsInSheet && main === "records" && shownLayout === "grid" ? /* @__PURE__ */ jsxs163(
|
|
53598
|
+
const sheetExtras = controlsInSheet && main === "records" && shownLayout === "grid" ? /* @__PURE__ */ jsxs163(Fragment71, { children: [
|
|
53340
53599
|
/* @__PURE__ */ jsx175("div", { className: "flex items-center gap-2 text-xs", "data-table-sheet-filter": "", "data-matrx-table-tools-keep-open": "", children: /* @__PURE__ */ jsx175(ViewFilter, { tableId, view: shown5, onApply: (where) => void patchView({ where }) }) }),
|
|
53341
53600
|
/* @__PURE__ */ jsx175("div", { role: "group", "aria-label": "Layout", className: "flex flex-wrap gap-1 pt-1", "data-table-sheet-layout": "", children: VIEW_LAYOUTS.map((option) => /* @__PURE__ */ jsx175(
|
|
53342
53601
|
Button119,
|
|
@@ -53556,7 +53815,7 @@ function TablePage({
|
|
|
53556
53815
|
return () => window.removeEventListener("keydown", onKey);
|
|
53557
53816
|
}, [recordsUi]);
|
|
53558
53817
|
const openedFromMenu = openedEntry ? { ...openedEntry, label: actions.find((a) => a.id === openedEntry.id)?.label ?? openedEntry.key } : null;
|
|
53559
|
-
const pageActions = /* @__PURE__ */ jsxs163(
|
|
53818
|
+
const pageActions = /* @__PURE__ */ jsxs163(Fragment71, { children: [
|
|
53560
53819
|
publicReadOnly ? /* @__PURE__ */ jsx175(Badge26, { variant: "neutral", className: "shrink-0", "data-public-read-only": "", children: PUBLIC_READ_ONLY }, "public-read-only") : null,
|
|
53561
53820
|
!phone && rights.read && table.data ? /* @__PURE__ */ jsx175(
|
|
53562
53821
|
TableAsk,
|
|
@@ -53584,7 +53843,7 @@ function TablePage({
|
|
|
53584
53843
|
},
|
|
53585
53844
|
`share-${shareAsked}`
|
|
53586
53845
|
) }, "share") : null,
|
|
53587
|
-
phone ? /* @__PURE__ */ jsxs163(
|
|
53846
|
+
phone ? /* @__PURE__ */ jsxs163(Fragment71, { children: [
|
|
53588
53847
|
!chooserInline && !chooserCompact && !embedded ? /* @__PURE__ */ jsxs163(DropdownMenu10, { children: [
|
|
53589
53848
|
/* @__PURE__ */ jsx175(DropdownMenuTrigger10, { asChild: true, children: /* @__PURE__ */ jsx175(Button119, { size: "sm", variant: "ghost", "aria-label": "Layout", title: "Layout", "data-table-layout-menu": "", children: "Layout" }) }),
|
|
53590
53849
|
/* @__PURE__ */ jsx175(DropdownMenuContent10, { align: "end", className: "w-56", children: layoutRadio })
|
|
@@ -53597,7 +53856,7 @@ function TablePage({
|
|
|
53597
53856
|
/* @__PURE__ */ jsx175("circle", { cx: "19", cy: "12", r: "1.75" })
|
|
53598
53857
|
] }) }) }),
|
|
53599
53858
|
/* @__PURE__ */ jsxs163(DropdownMenuContent10, { align: "end", className: "w-64", "data-table-menu-content": "", ...renameMenuProps, children: [
|
|
53600
|
-
!chooserInline && !chooserCompact && !embedded ? /* @__PURE__ */ jsxs163(
|
|
53859
|
+
!chooserInline && !chooserCompact && !embedded ? /* @__PURE__ */ jsxs163(Fragment71, { children: [
|
|
53601
53860
|
/* @__PURE__ */ jsx175(DropdownMenuLabel3, { className: "text-xs text-muted-foreground", children: "Layout" }),
|
|
53602
53861
|
layoutRadio,
|
|
53603
53862
|
/* @__PURE__ */ jsx175(DropdownMenuSeparator5, {})
|
|
@@ -53657,18 +53916,18 @@ function TablePage({
|
|
|
53657
53916
|
rights.structure && table.data ? /* @__PURE__ */ jsx175(TableRenameDialog, { tableId, name: table.data.name, open: renameOpen, onOpenChange: setRenameOpen }, "rename") : null
|
|
53658
53917
|
] });
|
|
53659
53918
|
const headerNode = header && !embedded ? header({ actions: table.data ? pageActions : null, tableName: table.data?.name ?? null }) : null;
|
|
53660
|
-
if (table.error) return /* @__PURE__ */ jsxs163(
|
|
53919
|
+
if (table.error) return /* @__PURE__ */ jsxs163(Fragment71, { children: [
|
|
53661
53920
|
headerNode,
|
|
53662
53921
|
/* @__PURE__ */ jsx175(RefusalNotice, { error: table.error })
|
|
53663
53922
|
] });
|
|
53664
53923
|
if (table.loading && !table.data) {
|
|
53665
|
-
return /* @__PURE__ */ jsxs163(
|
|
53924
|
+
return /* @__PURE__ */ jsxs163(Fragment71, { children: [
|
|
53666
53925
|
headerNode,
|
|
53667
53926
|
/* @__PURE__ */ jsx175(TablePageSkeleton, { layout: skeletonFace, embedded, tableId, ...className ? { className } : {} })
|
|
53668
53927
|
] });
|
|
53669
53928
|
}
|
|
53670
53929
|
if (!table.data) {
|
|
53671
|
-
return /* @__PURE__ */ jsxs163(
|
|
53930
|
+
return /* @__PURE__ */ jsxs163(Fragment71, { children: [
|
|
53672
53931
|
headerNode,
|
|
53673
53932
|
/* @__PURE__ */ jsx175(TableNotHere, { tableId, onLeave, leaveLabel, className })
|
|
53674
53933
|
] });
|
|
@@ -53680,11 +53939,11 @@ function TablePage({
|
|
|
53680
53939
|
headerNode,
|
|
53681
53940
|
/* @__PURE__ */ jsx175("div", { className: "flex min-h-0 min-w-0 flex-1 flex-col gap-2", children: structure.hidden || !structure.settled ? (
|
|
53682
53941
|
/* THE TOOLBAR ROW'S HEIGHT IS KEPT (min-h-8), so the sentence lands exactly where the bar was. */
|
|
53683
|
-
/* @__PURE__ */ jsxs163(
|
|
53942
|
+
/* @__PURE__ */ jsxs163(Fragment71, { children: [
|
|
53684
53943
|
/* @__PURE__ */ jsx175("div", { className: TABLE_TOOLBAR_ROW_CLASS, "data-table-toolbar": "", "aria-hidden": "true" }),
|
|
53685
53944
|
structure.hidden ? /* @__PURE__ */ jsx175(StructureLocked, {}) : /* @__PURE__ */ jsx175(RecordsSkeleton, { layout: skeletonFace, embedded })
|
|
53686
53945
|
] })
|
|
53687
|
-
) : /* @__PURE__ */ jsxs163(
|
|
53946
|
+
) : /* @__PURE__ */ jsxs163(Fragment71, { children: [
|
|
53688
53947
|
/* @__PURE__ */ jsx175(ImportNotice, { tableId, epoch: importEpoch, onOpenImport: () => setRail("import") }),
|
|
53689
53948
|
/* @__PURE__ */ jsxs163(
|
|
53690
53949
|
"div",
|
|
@@ -54141,7 +54400,7 @@ import { MatrxTableCardShowMore as MatrxTableCardShowMore3 } from "@ai-matrx/des
|
|
|
54141
54400
|
import { useEffect as useEffect124, useMemo as useMemo83, useRef as useRef64, useState as useState151 } from "react";
|
|
54142
54401
|
import { Button as Button120, ErrorBox as ErrorBox9, Input as Input13, cn as cn101 } from "@ai-matrx/design-system";
|
|
54143
54402
|
import { SEED_FRESH_MS, useRecordsClient as useRecordsClient107, useSeededAnswerAt } from "@ai-matrx/records/react";
|
|
54144
|
-
import { Fragment as
|
|
54403
|
+
import { Fragment as Fragment72, jsx as jsx176, jsxs as jsxs164 } from "react/jsx-runtime";
|
|
54145
54404
|
var entityTitleColumn = entityNameColumn;
|
|
54146
54405
|
function shown4(v) {
|
|
54147
54406
|
if (v === null || v === void 0 || v === "") return "";
|
|
@@ -54330,7 +54589,7 @@ function EntityTablePageBody({
|
|
|
54330
54589
|
presentation === "page" ? /* @__PURE__ */ jsx176("h2", { className: "truncate text-base font-semibold", children: entity.label ?? (entity.loading ? "Loading\u2026" : "Table") }) : null,
|
|
54331
54590
|
presentation === "page" ? /* @__PURE__ */ jsx176("span", { className: "text-xs tabular-nums text-muted-foreground", children: entity.loading || entity.total === null ? "" : formatCount8(entity.total) }) : null,
|
|
54332
54591
|
/* @__PURE__ */ jsxs164("span", { className: "ml-auto flex items-center gap-1", children: [
|
|
54333
|
-
boardable ? /* @__PURE__ */ jsxs164(
|
|
54592
|
+
boardable ? /* @__PURE__ */ jsxs164(Fragment72, { children: [
|
|
54334
54593
|
/* @__PURE__ */ jsx176(Button120, { size: "sm", variant: layout === "grid" ? "secondary" : "ghost", "aria-pressed": layout === "grid", onClick: () => choose("grid"), children: "Table" }),
|
|
54335
54594
|
/* @__PURE__ */ jsx176(Button120, { size: "sm", variant: layout === "board" ? "secondary" : "ghost", "aria-pressed": layout === "board", onClick: () => choose("board"), children: "Board" })
|
|
54336
54595
|
] }) : null,
|
|
@@ -54369,7 +54628,7 @@ function EntityTablePageBody({
|
|
|
54369
54628
|
] })
|
|
54370
54629
|
] }) : null,
|
|
54371
54630
|
addRefused ? /* @__PURE__ */ jsx176(ErrorBox9, { className: "rounded border border-destructive/40 px-1.5 py-1 text-xs text-destructive", message: addRefused, operation: "Add a row", origin: "records-ui/entityViews" }) : null,
|
|
54372
|
-
entity.error ? /* @__PURE__ */ jsx176("p", { className: "px-1 py-3 text-xs text-muted-foreground", children: `This table could not be read: ${entity.error}` }) : layout === "board" && boardable ? /* @__PURE__ */ jsx176(EntityBoard, { entity, groupBy, onOpenRecord }) : /* @__PURE__ */ jsxs164(
|
|
54631
|
+
entity.error ? /* @__PURE__ */ jsx176("p", { className: "px-1 py-3 text-xs text-muted-foreground", children: `This table could not be read: ${entity.error}` }) : layout === "board" && boardable ? /* @__PURE__ */ jsx176(EntityBoard, { entity, groupBy, onOpenRecord }) : /* @__PURE__ */ jsxs164(Fragment72, { children: [
|
|
54373
54632
|
presentation === "embedded" && searchBox ? /* @__PURE__ */ jsx176("div", { className: "flex min-w-0 items-center justify-end", "data-records-entity-search": "", children: /* @__PURE__ */ jsx176(TooltipProvider, { children: /* @__PURE__ */ jsx176(
|
|
54374
54633
|
TapTargetSearchGroup2,
|
|
54375
54634
|
{
|
|
@@ -54663,13 +54922,13 @@ function BindingDetails({
|
|
|
54663
54922
|
|
|
54664
54923
|
// src/PickedSummaries.tsx
|
|
54665
54924
|
import { useFields as useFields41, useRecord as useRecord6, useTable as useTable42 } from "@ai-matrx/records/react";
|
|
54666
|
-
import { Fragment as
|
|
54925
|
+
import { Fragment as Fragment73, jsx as jsx179, jsxs as jsxs166 } from "react/jsx-runtime";
|
|
54667
54926
|
function TableNameText({ dataSource, tableId }) {
|
|
54668
54927
|
const tables = useTablesAnywhere(dataSource);
|
|
54669
|
-
if (!tableId) return /* @__PURE__ */ jsx179(
|
|
54670
|
-
if (tables.loading) return /* @__PURE__ */ jsx179(
|
|
54671
|
-
if (tables.error) return /* @__PURE__ */ jsx179(
|
|
54672
|
-
return /* @__PURE__ */ jsx179(
|
|
54928
|
+
if (!tableId) return /* @__PURE__ */ jsx179(Fragment73, { children: "\u2014" });
|
|
54929
|
+
if (tables.loading) return /* @__PURE__ */ jsx179(Fragment73, { children: "\u2026" });
|
|
54930
|
+
if (tables.error) return /* @__PURE__ */ jsx179(Fragment73, { children: "Couldn't load the table's name" });
|
|
54931
|
+
return /* @__PURE__ */ jsx179(Fragment73, { children: tables.rows.find((t) => t.table_id === tableId)?.table_name ?? "\u2014" });
|
|
54673
54932
|
}
|
|
54674
54933
|
function ColumnValuesText({
|
|
54675
54934
|
dataSource,
|
|
@@ -54677,15 +54936,15 @@ function ColumnValuesText({
|
|
|
54677
54936
|
tableId,
|
|
54678
54937
|
value
|
|
54679
54938
|
}) {
|
|
54680
|
-
if (!tableId) return /* @__PURE__ */ jsx179(
|
|
54939
|
+
if (!tableId) return /* @__PURE__ */ jsx179(Fragment73, { children: "\u2014" });
|
|
54681
54940
|
return /* @__PURE__ */ jsx179(
|
|
54682
54941
|
TableScope,
|
|
54683
54942
|
{
|
|
54684
54943
|
dataSource,
|
|
54685
54944
|
userId,
|
|
54686
54945
|
tableId,
|
|
54687
|
-
fallback: /* @__PURE__ */ jsx179(
|
|
54688
|
-
unavailable: /* @__PURE__ */ jsx179(
|
|
54946
|
+
fallback: /* @__PURE__ */ jsx179(Fragment73, { children: "\u2026" }),
|
|
54947
|
+
unavailable: /* @__PURE__ */ jsx179(Fragment73, { children: "Couldn't load this table's columns" }),
|
|
54689
54948
|
children: /* @__PURE__ */ jsx179(RecordLabelProvider, { children: /* @__PURE__ */ jsx179(ColumnValuesWords, { tableId, value }) })
|
|
54690
54949
|
}
|
|
54691
54950
|
);
|
|
@@ -54693,8 +54952,8 @@ function ColumnValuesText({
|
|
|
54693
54952
|
function ColumnValuesWords({ tableId, value }) {
|
|
54694
54953
|
const fields = useFields41(tableId);
|
|
54695
54954
|
const labels = useRecordLabels(fields.data ?? void 0);
|
|
54696
|
-
if (fields.loading) return /* @__PURE__ */ jsx179(
|
|
54697
|
-
if (fields.error) return /* @__PURE__ */ jsx179(
|
|
54955
|
+
if (fields.loading) return /* @__PURE__ */ jsx179(Fragment73, { children: "\u2026" });
|
|
54956
|
+
if (fields.error) return /* @__PURE__ */ jsx179(Fragment73, { children: "Couldn't load this table's columns" });
|
|
54698
54957
|
const parts = [];
|
|
54699
54958
|
for (const [key, stored] of Object.entries(value)) {
|
|
54700
54959
|
if (key.startsWith("_")) continue;
|
|
@@ -54708,7 +54967,7 @@ function ColumnValuesWords({ tableId, value }) {
|
|
|
54708
54967
|
] }, key)
|
|
54709
54968
|
);
|
|
54710
54969
|
}
|
|
54711
|
-
return parts.length ? /* @__PURE__ */ jsx179(
|
|
54970
|
+
return parts.length ? /* @__PURE__ */ jsx179(Fragment73, { children: parts }) : /* @__PURE__ */ jsx179(Fragment73, { children: "\u2014" });
|
|
54712
54971
|
}
|
|
54713
54972
|
function RecordNameText({
|
|
54714
54973
|
dataSource,
|
|
@@ -54716,15 +54975,15 @@ function RecordNameText({
|
|
|
54716
54975
|
tableId,
|
|
54717
54976
|
recordId
|
|
54718
54977
|
}) {
|
|
54719
|
-
if (!tableId || !recordId) return /* @__PURE__ */ jsx179(
|
|
54978
|
+
if (!tableId || !recordId) return /* @__PURE__ */ jsx179(Fragment73, { children: "\u2014" });
|
|
54720
54979
|
return /* @__PURE__ */ jsx179(
|
|
54721
54980
|
TableScope,
|
|
54722
54981
|
{
|
|
54723
54982
|
dataSource,
|
|
54724
54983
|
userId,
|
|
54725
54984
|
tableId,
|
|
54726
|
-
fallback: /* @__PURE__ */ jsx179(
|
|
54727
|
-
unavailable: /* @__PURE__ */ jsx179(
|
|
54985
|
+
fallback: /* @__PURE__ */ jsx179(Fragment73, { children: "\u2026" }),
|
|
54986
|
+
unavailable: /* @__PURE__ */ jsx179(Fragment73, { children: "Couldn't load this record" }),
|
|
54728
54987
|
children: /* @__PURE__ */ jsx179(RecordNameWords, { tableId, recordId })
|
|
54729
54988
|
}
|
|
54730
54989
|
);
|
|
@@ -54732,10 +54991,10 @@ function RecordNameText({
|
|
|
54732
54991
|
function RecordNameWords({ tableId, recordId }) {
|
|
54733
54992
|
const table = useTable42(tableId);
|
|
54734
54993
|
const record = useRecord6(recordId);
|
|
54735
|
-
if (record.loading || table.loading) return /* @__PURE__ */ jsx179(
|
|
54736
|
-
if (record.error) return /* @__PURE__ */ jsx179(
|
|
54737
|
-
if (!record.data) return /* @__PURE__ */ jsx179(
|
|
54738
|
-
return /* @__PURE__ */ jsx179(
|
|
54994
|
+
if (record.loading || table.loading) return /* @__PURE__ */ jsx179(Fragment73, { children: "\u2026" });
|
|
54995
|
+
if (record.error) return /* @__PURE__ */ jsx179(Fragment73, { children: "Couldn't load this record" });
|
|
54996
|
+
if (!record.data) return /* @__PURE__ */ jsx179(Fragment73, { children: "A record you cannot open" });
|
|
54997
|
+
return /* @__PURE__ */ jsx179(Fragment73, { children: recordName(record.data.document, table.data?.title_field ?? null) });
|
|
54739
54998
|
}
|
|
54740
54999
|
|
|
54741
55000
|
// src/HeldChangeDecision.tsx
|