@ai-matrx/records-ui 0.115.98 → 0.115.99
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 +5 -0
- package/dist/first-page.cjs.map +1 -1
- package/dist/first-page.js.map +1 -1
- package/dist/helpers.cjs.map +1 -1
- package/dist/helpers.js.map +1 -1
- package/dist/index.cjs +267 -173
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -9
- package/dist/index.d.ts +7 -9
- package/dist/index.js +467 -373
- package/dist/index.js.map +1 -1
- package/dist/pickers.cjs +24 -7
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +24 -7
- package/dist/pickers.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -11090,12 +11090,25 @@ function shownAsOf(field2) {
|
|
|
11090
11090
|
const options = raw.options;
|
|
11091
11091
|
return options && typeof options === "object" && Object.keys(options).length > 0 ? { id, options } : { id };
|
|
11092
11092
|
}
|
|
11093
|
+
var YEAR_NAMES = /(^|[\s_-])(year|founded|established|incorporated|vintage)([\s_-]|$)/i;
|
|
11094
|
+
function isYearField(field2) {
|
|
11095
|
+
return YEAR_NAMES.test(String(field2.label ?? "")) || YEAR_NAMES.test(field2.key);
|
|
11096
|
+
}
|
|
11097
|
+
function isYearValue(value) {
|
|
11098
|
+
return typeof value === "number" && Number.isInteger(value) && value >= 1e3 && value <= 2999;
|
|
11099
|
+
}
|
|
11100
|
+
function ungroupedForYears(field2, format) {
|
|
11101
|
+
if (format.id !== "number" || !isYearField(field2)) return format;
|
|
11102
|
+
const options = format.options ?? {};
|
|
11103
|
+
if (options["useGrouping"] !== void 0) return format;
|
|
11104
|
+
return { ...format, options: { ...options, useGrouping: false } };
|
|
11105
|
+
}
|
|
11093
11106
|
function formatForField(field2) {
|
|
11094
11107
|
const shownAs = shownAsOf(field2);
|
|
11095
11108
|
if ((0, import_records12.newerKindOf)(field2) === "rating" && (!shownAs || shownAs.id === "rating")) {
|
|
11096
11109
|
return { id: "rating", options: { ...shownAs?.options ?? {}, ratingMax: (0, import_records12.ratingMaxOf)(field2) } };
|
|
11097
11110
|
}
|
|
11098
|
-
if (shownAs) return shownAs;
|
|
11111
|
+
if (shownAs) return ungroupedForYears(field2, shownAs);
|
|
11099
11112
|
const stamp = dateFormatFor(field2);
|
|
11100
11113
|
if (stamp && editorKindFor(field2) !== "datetime") return stamp;
|
|
11101
11114
|
switch (editorKindFor(field2)) {
|
|
@@ -11115,7 +11128,7 @@ function formatForField(field2) {
|
|
|
11115
11128
|
case "phone":
|
|
11116
11129
|
return { id: "phone" };
|
|
11117
11130
|
case "number":
|
|
11118
|
-
return { id: "number" };
|
|
11131
|
+
return ungroupedForYears(field2, { id: "number" });
|
|
11119
11132
|
default:
|
|
11120
11133
|
return void 0;
|
|
11121
11134
|
}
|
|
@@ -14171,7 +14184,7 @@ function Scalar({ value, keyName, dense }) {
|
|
|
14171
14184
|
const date = dateWords(text);
|
|
14172
14185
|
if (date) return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { title: text, children: date });
|
|
14173
14186
|
if (!dense && ui.renderText && text.length > 40 && MARKDOWN.test(text)) return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "min-w-0", children: ui.renderText(text, "cell") });
|
|
14174
|
-
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: (0, import_design_system39.cn)(dense ? "line-clamp-2" : "whitespace-pre-wrap
|
|
14187
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: (0, import_design_system39.cn)(dense ? "line-clamp-2 break-words" : "whitespace-pre-wrap [overflow-wrap:anywhere]"), children: text });
|
|
14175
14188
|
}
|
|
14176
14189
|
var TABLE_ROWS = 8;
|
|
14177
14190
|
var TABLE_COLUMNS = 12;
|
|
@@ -14183,7 +14196,7 @@ function RecordsTable({ items }) {
|
|
|
14183
14196
|
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "min-w-0", "data-records-structured": "table", children: [
|
|
14184
14197
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "max-w-full overflow-x-auto rounded-md border border-border", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("table", { className: "w-full border-collapse text-xs", children: [
|
|
14185
14198
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("thead", { className: "bg-muted/60 text-left", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("tr", { children: pictureFirst.map((k) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("th", { scope: "col", className: "whitespace-nowrap px-2 py-1 font-medium text-muted-foreground", children: keyWords(k) }, k)) }) }),
|
|
14186
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("tbody", { children: shown5.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("tr", { className: "border-t border-border/60 align-top", children: pictureFirst.map((k) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("td", { className: "max-w-[18rem] px-2 py-1", children: k in item ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Nested, { value: item[k], keyName: k, dense: true }) : /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "text-muted-foreground", children: "\u2014" }) }, k)) }, i)) })
|
|
14199
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("tbody", { children: shown5.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("tr", { className: "border-t border-border/60 align-top", children: pictureFirst.map((k) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("td", { className: "min-w-[7rem] max-w-[18rem] px-2 py-1", children: k in item ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Nested, { value: item[k], keyName: k, dense: true }) : /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "text-muted-foreground", children: "\u2014" }) }, k)) }, i)) })
|
|
14187
14200
|
] }) }),
|
|
14188
14201
|
items.length > TABLE_ROWS ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_design_system39.Button, { type: "button", variant: "ghost", size: "sm", className: "mt-1 h-6 px-2 text-xs", onClick: (e) => {
|
|
14189
14202
|
stop(e);
|
|
@@ -14241,6 +14254,9 @@ function Row({ label, keyName, value, depth, gutter }) {
|
|
|
14241
14254
|
}
|
|
14242
14255
|
);
|
|
14243
14256
|
}
|
|
14257
|
+
function recordsCount(data) {
|
|
14258
|
+
return Array.isArray(data) && data.length > 0 && data.every(isPlainObject2) ? plural2(data.length, "item", "items") : "";
|
|
14259
|
+
}
|
|
14244
14260
|
function rawTextOf(s) {
|
|
14245
14261
|
return s.raw ?? JSON.stringify(s.data, null, 2);
|
|
14246
14262
|
}
|
|
@@ -14252,7 +14268,7 @@ function StructuredValueView({ structured, label, className }) {
|
|
|
14252
14268
|
const text = rawTextOf(structured);
|
|
14253
14269
|
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: (0, import_design_system39.cn)("flex min-w-0 flex-col gap-1.5 whitespace-normal", className), "data-records-structured-view": "", children: [
|
|
14254
14270
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex min-w-0 items-center gap-1", onClick: stop, children: [
|
|
14255
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "min-w-0 flex-1 truncate text-xs text-muted-foreground", children:
|
|
14271
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "min-w-0 flex-1 truncate text-xs text-muted-foreground", children: recordsCount(structured.data) }),
|
|
14256
14272
|
savable ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_design_system39.Button, { type: "button", variant: "ghost", size: "sm", className: "h-6 px-2 text-xs", onClick: () => setSaving(true), "data-records-structured-save": "", children: "Save as table" }) : null,
|
|
14257
14273
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
14258
14274
|
import_design_system39.Button,
|
|
@@ -14539,13 +14555,14 @@ function scalarText(field2, value, labels, stillWaitingFor) {
|
|
|
14539
14555
|
}
|
|
14540
14556
|
const shownAs = shownAsOf(field2);
|
|
14541
14557
|
if (shownAs) {
|
|
14542
|
-
const said2 = (0, import_field_formats4.formatFieldValue)(value, shownAs);
|
|
14558
|
+
const said2 = (0, import_field_formats4.formatFieldValue)(value, shownAs.id === "number" && isYearField(field2) && isYearValue(value) ? formatForField(field2) ?? shownAs : shownAs);
|
|
14543
14559
|
if (said2.ok && !said2.empty) return said2.text;
|
|
14544
14560
|
}
|
|
14545
14561
|
if (typeof value === "number") {
|
|
14546
14562
|
if (kind2 === "percent") return `${value}%`;
|
|
14547
14563
|
if (kind2 === "currency") return field2.unit ? `${field2.unit}${value.toLocaleString()}` : value.toLocaleString();
|
|
14548
|
-
|
|
14564
|
+
const plain2 = isYearField(field2) && isYearValue(value) ? String(value) : value.toLocaleString();
|
|
14565
|
+
return field2.unit ? `${plain2} ${field2.unit}` : plain2;
|
|
14549
14566
|
}
|
|
14550
14567
|
if (kind2 === "datetime" || systemStampOf(field2) === "created_time" || systemStampOf(field2) === "modified_time") {
|
|
14551
14568
|
const said2 = dateText(field2, value);
|
|
@@ -28276,7 +28293,7 @@ function RecordActionMenu({ tableId, row, name, onOpenRecord, onChanged, childre
|
|
|
28276
28293
|
// src/gridOpen.tsx
|
|
28277
28294
|
var import_outbound3 = require("@ai-matrx/kit/outbound");
|
|
28278
28295
|
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
28279
|
-
var TITLE_OWN_CONTROLS = 'input, textarea, select, button, a[href], [role="
|
|
28296
|
+
var TITLE_OWN_CONTROLS = 'input, textarea, select, button, a[href], [role="combobox"], [contenteditable="true"], [contenteditable=""]';
|
|
28280
28297
|
function openRecordLabel(name) {
|
|
28281
28298
|
return `Open ${name}`;
|
|
28282
28299
|
}
|
|
@@ -28358,7 +28375,7 @@ function withOpenRecord(columns, onOpen, nameOf3, place = "end", hrefOf, navigat
|
|
|
28358
28375
|
if (!titleTarget(event)) return;
|
|
28359
28376
|
openFrom(row, event);
|
|
28360
28377
|
},
|
|
28361
|
-
|
|
28378
|
+
onDoubleClickCapture: (event) => {
|
|
28362
28379
|
if (!titleTarget(event)) return;
|
|
28363
28380
|
event.stopPropagation();
|
|
28364
28381
|
openFrom(row, event);
|
|
@@ -33885,11 +33902,24 @@ function ShownToSelect({
|
|
|
33885
33902
|
value,
|
|
33886
33903
|
allowed,
|
|
33887
33904
|
label,
|
|
33905
|
+
prefix,
|
|
33888
33906
|
onChange,
|
|
33889
33907
|
testId
|
|
33890
33908
|
}) {
|
|
33891
33909
|
return /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(import_design_system93.Select, { value, onValueChange: (next) => (0, import_records53.isShownTo)(next) ? onChange(next) : void 0, children: [
|
|
33892
|
-
/* @__PURE__ */ (0, import_jsx_runtime109.
|
|
33910
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(
|
|
33911
|
+
import_design_system93.SelectTrigger,
|
|
33912
|
+
{
|
|
33913
|
+
size: "sm",
|
|
33914
|
+
"aria-label": label,
|
|
33915
|
+
className: prefix ? "h-7 w-auto gap-1 whitespace-nowrap border-transparent bg-transparent px-2 text-xs shadow-none hover:bg-accent" : "h-7 min-w-[8rem] text-xs",
|
|
33916
|
+
"data-testid": testId,
|
|
33917
|
+
children: [
|
|
33918
|
+
prefix ? /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("span", { className: "text-muted-foreground", children: prefix }) : null,
|
|
33919
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)(import_design_system93.SelectValue, {})
|
|
33920
|
+
]
|
|
33921
|
+
}
|
|
33922
|
+
),
|
|
33893
33923
|
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)(import_design_system93.SelectContent, { children: allowed.map((word) => /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(import_design_system93.SelectItem, { value: word, children: import_records53.SHOWN_TO_LABEL[word] }, word)) })
|
|
33894
33924
|
] });
|
|
33895
33925
|
}
|
|
@@ -34000,14 +34030,14 @@ function RowShownTo({ recordId, tableId }) {
|
|
|
34000
34030
|
if (!c || c.shown_to.is_child || !(0, import_records53.isShownTo)(c.shown_to.effective)) return null;
|
|
34001
34031
|
const effective = c.shown_to.effective;
|
|
34002
34032
|
const allowed = c.shown_to.allowed.filter(import_records53.isShownTo);
|
|
34003
|
-
return /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)("span", { className: "flex items-center
|
|
34004
|
-
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)("span", { className: "text-muted-foreground", children: ROW_CONTROL_WORDS.shownTo }),
|
|
34033
|
+
return /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)("span", { className: "inline-flex shrink-0 items-center", "data-testid": "row-shown-to", children: [
|
|
34005
34034
|
c.shown_to.can_change ? /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(
|
|
34006
34035
|
ShownToSelect,
|
|
34007
34036
|
{
|
|
34008
34037
|
value: effective,
|
|
34009
34038
|
allowed: allowed.includes(effective) ? allowed : [...allowed, effective],
|
|
34010
34039
|
label: ROW_CONTROL_WORDS.shownTo,
|
|
34040
|
+
prefix: ROW_CONTROL_WORDS.shownTo,
|
|
34011
34041
|
testId: "row-shown-to-select",
|
|
34012
34042
|
onChange: async (next) => {
|
|
34013
34043
|
const answer = await client.recordRowControlsSet({ record_id: recordId, controls: { shown_to: next } });
|
|
@@ -34017,10 +34047,21 @@ function RowShownTo({ recordId, tableId }) {
|
|
|
34017
34047
|
} else setError(answer.error);
|
|
34018
34048
|
}
|
|
34019
34049
|
}
|
|
34020
|
-
) :
|
|
34021
|
-
|
|
34022
|
-
/* @__PURE__ */ (0, import_jsx_runtime109.
|
|
34023
|
-
|
|
34050
|
+
) : (
|
|
34051
|
+
// Read-only: the same words in a quiet chip; who may change it is its tooltip, never a sentence in the row.
|
|
34052
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(
|
|
34053
|
+
"span",
|
|
34054
|
+
{
|
|
34055
|
+
className: "inline-flex h-7 items-center gap-1 whitespace-nowrap rounded px-2 text-xs",
|
|
34056
|
+
title: ROW_CONTROL_WORDS.whoMayChangeRow,
|
|
34057
|
+
children: [
|
|
34058
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)("span", { className: "text-muted-foreground", children: ROW_CONTROL_WORDS.shownTo }),
|
|
34059
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)("span", { "data-testid": "row-shown-to-text", children: import_records53.SHOWN_TO_LABEL[effective] }),
|
|
34060
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)("span", { className: "sr-only", "data-testid": "row-shown-to-who", children: ROW_CONTROL_WORDS.whoMayChangeRow })
|
|
34061
|
+
]
|
|
34062
|
+
}
|
|
34063
|
+
)
|
|
34064
|
+
),
|
|
34024
34065
|
error ? /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(RefusalNotice, { error }) : null
|
|
34025
34066
|
] });
|
|
34026
34067
|
}
|
|
@@ -35045,54 +35086,76 @@ function Peek({ tableId, recordId, onClose, className, onPage = false }) {
|
|
|
35045
35086
|
const title = document2 ? recordNameIn(table.data, document2) : "";
|
|
35046
35087
|
const bodyKey = onPage ? bodyFieldOf(fields.data ?? [])?.key : void 0;
|
|
35047
35088
|
const shownFields = (fields.data ?? []).filter((field2) => !onPage || !drawnBelowOnPage(field2, bodyKey));
|
|
35048
|
-
const askOpenBelow = onPage && !host.talkToRecord && Boolean(host.chat);
|
|
35049
35089
|
const href = host.hrefForRecord && table.data ? host.hrefForRecord({ table: table.data, recordId }) : void 0;
|
|
35090
|
+
const canAsk = Boolean(host.talkToRecord) || Boolean(host.chat);
|
|
35091
|
+
const whyNotWrite = !may.write && may.known ? may.why("write") : null;
|
|
35092
|
+
const shownTo = /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(RowShownTo, { recordId, tableId });
|
|
35093
|
+
const share = organizationId ? /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(ShareControl, { kind: "record", organizationId, subjectId: recordId, name: title, may: may.share, className: "h-7 px-2 text-xs" }) : null;
|
|
35094
|
+
const ask2 = canAsk ? /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(
|
|
35095
|
+
import_design_system100.Button,
|
|
35096
|
+
{
|
|
35097
|
+
size: "sm",
|
|
35098
|
+
variant: talking ? "secondary" : "ghost",
|
|
35099
|
+
className: "h-7 px-2 text-xs",
|
|
35100
|
+
title: "Ask about this record",
|
|
35101
|
+
"aria-pressed": host.talkToRecord ? void 0 : talking,
|
|
35102
|
+
...onPage ? { "data-record-ask": talking ? "shown" : "", "data-record-ask-open": "" } : {},
|
|
35103
|
+
onClick: () => host.talkToRecord ? host.talkToRecord({ tableId, recordId, title: title || "this record" }) : setTalking((t) => !t),
|
|
35104
|
+
children: "Ask"
|
|
35105
|
+
}
|
|
35106
|
+
) : null;
|
|
35107
|
+
const alchemy = /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(
|
|
35108
|
+
import_react205.AlchemyMenu,
|
|
35109
|
+
{
|
|
35110
|
+
label: title || "Record",
|
|
35111
|
+
sourceId: `record:${recordId}`,
|
|
35112
|
+
size: "xs",
|
|
35113
|
+
human: () => (fields.data ?? []).map((field2) => `${fieldName(field2)}: ${String(document2?.[field2.key] ?? "")}`).join("\n"),
|
|
35114
|
+
json: () => document2 ?? {},
|
|
35115
|
+
...host.talkToRecord ? {
|
|
35116
|
+
// AGT-N-9: the same act, in the menu every surface on the platform
|
|
35117
|
+
// already carries, for the person who goes looking there first.
|
|
35118
|
+
referenceActions: [
|
|
35119
|
+
{
|
|
35120
|
+
id: "talk-to-this-record",
|
|
35121
|
+
label: "Talk to this record",
|
|
35122
|
+
run: () => host.talkToRecord?.({ tableId, recordId, title: title || "this record" })
|
|
35123
|
+
}
|
|
35124
|
+
]
|
|
35125
|
+
} : {}
|
|
35126
|
+
}
|
|
35127
|
+
);
|
|
35050
35128
|
return /* @__PURE__ */ (0, import_jsx_runtime117.jsxs)("div", { className: (0, import_design_system100.cn)("flex min-w-0 flex-col gap-2 text-xs", className), children: [
|
|
35051
|
-
|
|
35052
|
-
|
|
35053
|
-
|
|
35054
|
-
|
|
35055
|
-
{
|
|
35056
|
-
|
|
35057
|
-
|
|
35058
|
-
|
|
35059
|
-
|
|
35060
|
-
|
|
35061
|
-
|
|
35062
|
-
|
|
35063
|
-
|
|
35064
|
-
|
|
35065
|
-
|
|
35066
|
-
|
|
35067
|
-
|
|
35068
|
-
|
|
35069
|
-
|
|
35070
|
-
|
|
35071
|
-
|
|
35072
|
-
|
|
35073
|
-
|
|
35074
|
-
|
|
35075
|
-
|
|
35076
|
-
|
|
35077
|
-
{
|
|
35078
|
-
size: "sm",
|
|
35079
|
-
variant: "outline",
|
|
35080
|
-
onClick: () => host.talkToRecord?.({ tableId, recordId, title: title || "this record" }),
|
|
35081
|
-
children: "Talk to this record"
|
|
35082
|
-
}
|
|
35083
|
-
) : host.chat && !askOpenBelow ? /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(import_design_system100.Button, { size: "sm", variant: talking ? "ghost" : "outline", onClick: () => setTalking((t) => !t), children: talking ? "Close chat" : "Talk to this record" }) : null,
|
|
35084
|
-
organizationId ? /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(ShareControl, { kind: "record", organizationId, subjectId: recordId, name: title, may: may.share }) : null,
|
|
35085
|
-
/* @__PURE__ */ (0, import_jsx_runtime117.jsx)(RowShownTo, { recordId, tableId }),
|
|
35086
|
-
!may.write && may.known && may.why("write") ? (
|
|
35087
|
-
// Absent AND explained: no Edit button, and one sentence saying what
|
|
35088
|
-
// it would take and who can give it.
|
|
35089
|
-
/* @__PURE__ */ (0, import_jsx_runtime117.jsx)("span", { className: "max-w-[18rem] text-[11px] text-muted-foreground", children: may.why("write") })
|
|
35090
|
-
) : null,
|
|
35091
|
-
onClose ? /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(import_design_system100.Button, { size: "sm", variant: "ghost", className: "ml-auto", onClick: onClose, "aria-label": "Close", children: "\xD7" }) : null
|
|
35129
|
+
onPage ? (
|
|
35130
|
+
// THE PAGE'S TITLE LINE: the whole name (wrapped, never cut) and its actions to the right; on a
|
|
35131
|
+
// narrow column the actions take the line under it, left-aligned with the name.
|
|
35132
|
+
/* @__PURE__ */ (0, import_jsx_runtime117.jsxs)("div", { className: "@container", "data-records-peek-head": "page", children: [
|
|
35133
|
+
/* @__PURE__ */ (0, import_jsx_runtime117.jsxs)("div", { className: "flex flex-col gap-2 @xl:flex-row @xl:items-start @xl:gap-4", children: [
|
|
35134
|
+
/* @__PURE__ */ (0, import_jsx_runtime117.jsx)("h1", { className: "min-w-0 flex-1 break-words text-2xl font-semibold leading-tight", "data-records-peek-title": "", title, children: record.loading && !document2 ? /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(import_design_system100.Skeleton, { className: "h-7 w-56" }) : title }),
|
|
35135
|
+
/* @__PURE__ */ (0, import_jsx_runtime117.jsxs)("div", { className: "flex min-h-7 shrink-0 flex-wrap items-center gap-1 @xl:mt-0.5 @xl:justify-end", "data-records-peek-actions": "", children: [
|
|
35136
|
+
shownTo,
|
|
35137
|
+
share,
|
|
35138
|
+
ask2,
|
|
35139
|
+
alchemy
|
|
35140
|
+
] })
|
|
35141
|
+
] }),
|
|
35142
|
+
whyNotWrite ? /* @__PURE__ */ (0, import_jsx_runtime117.jsx)("p", { className: "mt-1 text-[11px] text-muted-foreground", children: whyNotWrite }) : null
|
|
35143
|
+
] })
|
|
35144
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime117.jsxs)(import_jsx_runtime117.Fragment, { children: [
|
|
35145
|
+
/* @__PURE__ */ (0, import_jsx_runtime117.jsx)("h3", { className: "break-words text-sm font-medium leading-snug", "data-records-peek-title": "", title, children: record.loading && !document2 ? /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(import_design_system100.Skeleton, { className: "h-4 w-40" }) : title }),
|
|
35146
|
+
/* @__PURE__ */ (0, import_jsx_runtime117.jsxs)("div", { className: "flex min-h-7 flex-wrap items-center gap-1", "data-records-peek-actions": "", children: [
|
|
35147
|
+
alchemy,
|
|
35148
|
+
href ? /* @__PURE__ */ (0, import_jsx_runtime117.jsx)("a", { className: "inline-flex h-7 items-center rounded px-2 text-xs text-primary underline-offset-2 hover:underline", href, children: "Open" }) : null,
|
|
35149
|
+
share,
|
|
35150
|
+
ask2,
|
|
35151
|
+
shownTo,
|
|
35152
|
+
onClose ? /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(import_design_system100.Button, { size: "sm", variant: "ghost", className: "ml-auto h-7 w-7 p-0", onClick: onClose, "aria-label": "Close", children: "\xD7" }) : null
|
|
35153
|
+
] }),
|
|
35154
|
+
whyNotWrite ? /* @__PURE__ */ (0, import_jsx_runtime117.jsx)("p", { className: "text-[11px] text-muted-foreground", children: whyNotWrite }) : null
|
|
35092
35155
|
] }),
|
|
35093
35156
|
/* @__PURE__ */ (0, import_jsx_runtime117.jsx)(import_design_system100.Separator, {}),
|
|
35094
35157
|
talking && host.chat ? /* @__PURE__ */ (0, import_jsx_runtime117.jsxs)(import_jsx_runtime117.Fragment, { children: [
|
|
35095
|
-
/* @__PURE__ */ (0, import_jsx_runtime117.jsx)(RecordChat, { tableId, recordId, className: "min-h-[22rem]" }),
|
|
35158
|
+
/* @__PURE__ */ (0, import_jsx_runtime117.jsx)("section", { "data-record-ask": onPage ? "open" : void 0, className: "min-w-0", children: /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(RecordChat, { tableId, recordId, className: "min-h-[22rem]" }) }),
|
|
35096
35159
|
/* @__PURE__ */ (0, import_jsx_runtime117.jsx)(import_design_system100.Separator, {})
|
|
35097
35160
|
] }) : null,
|
|
35098
35161
|
fields.data && document2 && may.write ? /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(
|
|
@@ -42428,6 +42491,7 @@ function ChecklistRunner({
|
|
|
42428
42491
|
runId,
|
|
42429
42492
|
includeClosed = false,
|
|
42430
42493
|
offerToStart,
|
|
42494
|
+
quietWhenEmpty = false,
|
|
42431
42495
|
className
|
|
42432
42496
|
}) {
|
|
42433
42497
|
const client = (0, import_react246.useRecordsClient)();
|
|
@@ -42553,6 +42617,10 @@ function ChecklistRunner({
|
|
|
42553
42617
|
[runs, activeId]
|
|
42554
42618
|
);
|
|
42555
42619
|
if (table.error) return /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(RefusalNotice, { error: table.error, className });
|
|
42620
|
+
if (quietWhenEmpty && !runId) {
|
|
42621
|
+
const startable = mayStart && rights.write && (templates?.length ?? 0) > 0;
|
|
42622
|
+
if (runs === null || runs.length === 0 && !startable && !error && !said2) return null;
|
|
42623
|
+
}
|
|
42556
42624
|
if (runs === null && steps === null && !runId) {
|
|
42557
42625
|
return /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_design_system116.Skeleton, { shape: "block", height: "sm", className });
|
|
42558
42626
|
}
|
|
@@ -42579,7 +42647,7 @@ function ChecklistRunner({
|
|
|
42579
42647
|
] }),
|
|
42580
42648
|
error ? /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(RefusalNotice, { error }) : null,
|
|
42581
42649
|
said2 ? /* @__PURE__ */ (0, import_jsx_runtime136.jsx)("p", { className: "text-xs text-muted-foreground", children: said2 }) : null,
|
|
42582
|
-
active === null && runs !== null && runs.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime136.jsx)("p", { className: "text-xs text-muted-foreground", "data-testid": "checklist-empty", children: mayStart && templates && templates.length === 0 ? NO_TEMPLATES : NOTHING_RUNNING }) : null,
|
|
42650
|
+
!quietWhenEmpty && active === null && runs !== null && runs.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime136.jsx)("p", { className: "text-xs text-muted-foreground", "data-testid": "checklist-empty", children: mayStart && templates && templates.length === 0 ? NO_TEMPLATES : NOTHING_RUNNING }) : null,
|
|
42583
42651
|
steps === null ? null : steps.length === 0 && active ? /* @__PURE__ */ (0, import_jsx_runtime136.jsx)("p", { className: "text-xs text-muted-foreground", children: "No steps to show." }) : /* @__PURE__ */ (0, import_jsx_runtime136.jsx)("ol", { className: "flex min-h-0 flex-col gap-1.5 overflow-y-auto", "data-testid": "checklist-steps", children: (steps ?? []).map((step2) => /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(
|
|
42584
42652
|
StepRow,
|
|
42585
42653
|
{
|
|
@@ -44373,6 +44441,7 @@ function HistoryPanel({ tableId, recordId, onAskAboutField, className }) {
|
|
|
44373
44441
|
const [said2, setSaid] = (0, import_react253.useState)(null);
|
|
44374
44442
|
const listRef = (0, import_react253.useRef)(null);
|
|
44375
44443
|
const [asOf, setAsOf] = (0, import_react253.useState)(null);
|
|
44444
|
+
const [lookingBack, setLookingBack] = (0, import_react253.useState)(false);
|
|
44376
44445
|
const today = (0, import_react254.useRecord)(recordId, false, { tableId });
|
|
44377
44446
|
const changed2 = (0, import_react254.useRecordChangeRevision)(recordId);
|
|
44378
44447
|
const shape = useMigrationLog(recordId);
|
|
@@ -44465,15 +44534,33 @@ function HistoryPanel({ tableId, recordId, onAskAboutField, className }) {
|
|
|
44465
44534
|
await load();
|
|
44466
44535
|
}
|
|
44467
44536
|
return /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)("section", { className: (0, import_design_system120.cn)("flex min-h-0 flex-col gap-2", className), children: [
|
|
44468
|
-
/* @__PURE__ */ (0, import_jsx_runtime140.jsxs)("div", { className: "flex
|
|
44537
|
+
/* @__PURE__ */ (0, import_jsx_runtime140.jsxs)("div", { className: "flex h-7 items-center gap-2", children: [
|
|
44469
44538
|
/* @__PURE__ */ (0, import_jsx_runtime140.jsx)("h3", { className: "text-sm font-medium", children: "History" }),
|
|
44470
44539
|
/* @__PURE__ */ (0, import_jsx_runtime140.jsxs)("span", { className: "text-xs text-muted-foreground", children: [
|
|
44471
44540
|
entries.length,
|
|
44472
44541
|
" ",
|
|
44473
44542
|
entries.length === 1 ? "version" : "versions"
|
|
44474
44543
|
] }),
|
|
44475
|
-
/* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
|
|
44544
|
+
/* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
|
|
44545
|
+
import_design_system120.Button,
|
|
44546
|
+
{
|
|
44547
|
+
size: "sm",
|
|
44548
|
+
variant: lookingBack || asOf ? "secondary" : "ghost",
|
|
44549
|
+
className: "ml-auto h-7 px-2 text-xs",
|
|
44550
|
+
"aria-expanded": lookingBack || asOf !== null,
|
|
44551
|
+
"data-records-as-of-open": "",
|
|
44552
|
+
title: "See this record as it stood on a day",
|
|
44553
|
+
onClick: () => {
|
|
44554
|
+
if (lookingBack || asOf) {
|
|
44555
|
+
setLookingBack(false);
|
|
44556
|
+
setAsOf(null);
|
|
44557
|
+
} else setLookingBack(true);
|
|
44558
|
+
},
|
|
44559
|
+
children: "As of\u2026"
|
|
44560
|
+
}
|
|
44561
|
+
)
|
|
44476
44562
|
] }),
|
|
44563
|
+
lookingBack || asOf ? /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(AsOfControl, { value: asOf, onChange: setAsOf, className: "self-end" }) : null,
|
|
44477
44564
|
asOf ? /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(AsOfReading, { recordId, asOf, fields: fields.data ?? [], today: today.data?.document }) : null,
|
|
44478
44565
|
said2 ? /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("p", { role: "status", className: "text-xs text-muted-foreground", children: said2 }) : null,
|
|
44479
44566
|
asOf ? null : entries.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("p", { className: "text-xs text-muted-foreground", children: "Nothing has been recorded about this record yet." }) : /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
|
|
@@ -44483,7 +44570,7 @@ function HistoryPanel({ tableId, recordId, onAskAboutField, className }) {
|
|
|
44483
44570
|
role: "listbox",
|
|
44484
44571
|
"aria-label": "Versions of this record, newest first",
|
|
44485
44572
|
"data-records-history-list": "",
|
|
44486
|
-
className: "flex max-h-[
|
|
44573
|
+
className: "flex max-h-[13.5rem] min-h-0 flex-col overflow-y-auto",
|
|
44487
44574
|
onKeyDown: (event) => {
|
|
44488
44575
|
const at = entries.findIndex((e) => e.version === open);
|
|
44489
44576
|
if (event.key === "ArrowDown" || event.key === "ArrowUp") {
|
|
@@ -44554,102 +44641,109 @@ function VersionRow({
|
|
|
44554
44641
|
const canUndo = canRestore && entry.operation !== "insert" && entry.version > 1 && entry.changes.length > 0;
|
|
44555
44642
|
const undoMine = undo.phase !== "idle" && undo.version === entry.version;
|
|
44556
44643
|
const undoConfirming = undoMine && undo.phase === "confirm" ? undo : null;
|
|
44557
|
-
return
|
|
44644
|
+
return (
|
|
44645
|
+
// The timeline's rule (the li's ::before, from the first dot to the last) and its dot.
|
|
44558
44646
|
/* @__PURE__ */ (0, import_jsx_runtime140.jsxs)(
|
|
44559
|
-
"
|
|
44647
|
+
"li",
|
|
44560
44648
|
{
|
|
44561
|
-
|
|
44562
|
-
"
|
|
44563
|
-
"data-version": entry.version,
|
|
44564
|
-
tabIndex: 0,
|
|
44565
|
-
className: "flex cursor-pointer items-baseline gap-2 px-2 py-1.5 text-xs focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
44566
|
-
onClick: onToggle,
|
|
44567
|
-
onKeyDown: (event) => {
|
|
44568
|
-
if (event.key === "Enter" || event.key === " ") {
|
|
44569
|
-
event.preventDefault();
|
|
44570
|
-
onToggle();
|
|
44571
|
-
}
|
|
44572
|
-
if ((event.key === "r" || event.key === "R") && canRestore) {
|
|
44573
|
-
event.preventDefault();
|
|
44574
|
-
onRestore(null);
|
|
44575
|
-
}
|
|
44576
|
-
},
|
|
44649
|
+
className: "relative flex flex-col pl-5 before:absolute before:bottom-0 before:left-[7px] before:top-0 before:w-px before:bg-border first:before:top-3 last:before:bottom-auto last:before:h-3 only:before:hidden",
|
|
44650
|
+
"data-records-history-version": "",
|
|
44577
44651
|
children: [
|
|
44578
|
-
/* @__PURE__ */ (0, import_jsx_runtime140.
|
|
44579
|
-
|
|
44580
|
-
|
|
44581
|
-
] }),
|
|
44582
|
-
/* @__PURE__ */ (0, import_jsx_runtime140.jsx)("span", { className: "shrink-0 font-medium", children: operationWords(entry.operation_label) }),
|
|
44583
|
-
/* @__PURE__ */ (0, import_jsx_runtime140.jsx)(Who, { actor: entry.actor }),
|
|
44584
|
-
/* @__PURE__ */ (0, import_jsx_runtime140.jsxs)("span", { className: "flex min-w-0 flex-1 items-center gap-2", children: [
|
|
44585
|
-
/* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
|
|
44586
|
-
"span",
|
|
44587
|
-
{
|
|
44588
|
-
className: "min-w-0 truncate text-muted-foreground",
|
|
44589
|
-
title: entry.changes.length === 0 ? "nothing about the values changed" : entry.changes.map((c) => c.label).join(", "),
|
|
44590
|
-
children: entry.changes.length === 0 ? "nothing about the values changed" : entry.changes.map((c) => c.label).join(", ")
|
|
44591
|
-
}
|
|
44592
|
-
),
|
|
44593
|
-
entry.undoable ? /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(import_design_system120.Badge, { variant: "secondary", className: "min-w-0 shrink truncate text-[10px]", title: "part of a bigger change", children: "part of a bigger change" }) : null
|
|
44594
|
-
] }),
|
|
44595
|
-
/* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
|
|
44596
|
-
"span",
|
|
44652
|
+
/* @__PURE__ */ (0, import_jsx_runtime140.jsx)("span", { "aria-hidden": "true", className: "absolute left-[4px] top-[9px] size-[7px] rounded-full border border-background bg-muted-foreground" }),
|
|
44653
|
+
/* @__PURE__ */ (0, import_jsx_runtime140.jsxs)(
|
|
44654
|
+
"div",
|
|
44597
44655
|
{
|
|
44598
|
-
|
|
44599
|
-
|
|
44600
|
-
|
|
44656
|
+
role: "option",
|
|
44657
|
+
"aria-selected": expanded,
|
|
44658
|
+
"data-version": entry.version,
|
|
44659
|
+
tabIndex: 0,
|
|
44660
|
+
className: "flex cursor-pointer flex-col gap-0.5 rounded px-2 py-1.5 text-xs hover:bg-accent/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring aria-selected:bg-accent/50",
|
|
44661
|
+
onClick: onToggle,
|
|
44662
|
+
onKeyDown: (event) => {
|
|
44663
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
44664
|
+
event.preventDefault();
|
|
44665
|
+
onToggle();
|
|
44666
|
+
}
|
|
44667
|
+
if ((event.key === "r" || event.key === "R") && canRestore) {
|
|
44668
|
+
event.preventDefault();
|
|
44669
|
+
onRestore(null);
|
|
44670
|
+
}
|
|
44671
|
+
},
|
|
44672
|
+
children: [
|
|
44673
|
+
/* @__PURE__ */ (0, import_jsx_runtime140.jsxs)("span", { className: "flex min-w-0 items-baseline gap-1.5", children: [
|
|
44674
|
+
/* @__PURE__ */ (0, import_jsx_runtime140.jsx)(Who, { actor: entry.actor }),
|
|
44675
|
+
/* @__PURE__ */ (0, import_jsx_runtime140.jsx)("span", { className: "shrink-0 text-muted-foreground", children: verbWords(operationWords(entry.operation_label)) }),
|
|
44676
|
+
entry.undoable ? /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(import_design_system120.Badge, { variant: "secondary", className: "min-w-0 shrink truncate text-[10px]", title: "part of a bigger change", children: "part of a bigger change" }) : null,
|
|
44677
|
+
/* @__PURE__ */ (0, import_jsx_runtime140.jsxs)("span", { className: "ml-auto flex shrink-0 items-baseline gap-1.5 whitespace-nowrap text-muted-foreground", children: [
|
|
44678
|
+
/* @__PURE__ */ (0, import_jsx_runtime140.jsxs)("span", { className: "tabular-nums", children: [
|
|
44679
|
+
"v",
|
|
44680
|
+
entry.version
|
|
44681
|
+
] }),
|
|
44682
|
+
/* @__PURE__ */ (0, import_jsx_runtime140.jsx)("span", { "aria-hidden": "true", children: "\xB7" }),
|
|
44683
|
+
/* @__PURE__ */ (0, import_jsx_runtime140.jsx)("span", { title: new Date(entry.occurred_at).toLocaleString(), children: whenText(entry.occurred_at) })
|
|
44684
|
+
] })
|
|
44685
|
+
] }),
|
|
44686
|
+
/* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
|
|
44687
|
+
"span",
|
|
44688
|
+
{
|
|
44689
|
+
className: "min-w-0 truncate text-muted-foreground",
|
|
44690
|
+
title: entry.changes.length === 0 ? "nothing about the values changed" : entry.changes.map((c) => c.label).join(", "),
|
|
44691
|
+
children: changeSummary(entry)
|
|
44692
|
+
}
|
|
44693
|
+
)
|
|
44694
|
+
]
|
|
44601
44695
|
}
|
|
44602
|
-
)
|
|
44696
|
+
),
|
|
44697
|
+
expanded ? /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)("div", { className: "flex flex-col gap-1.5 border-t bg-muted/30 px-2 py-2", children: [
|
|
44698
|
+
entry.changes.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "This version changed the record without changing any of its values." }) : /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("ul", { className: "flex flex-col gap-1", children: entry.changes.map((change) => /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
|
|
44699
|
+
ChangeLine,
|
|
44700
|
+
{
|
|
44701
|
+
change,
|
|
44702
|
+
field: byKey.get(change.key),
|
|
44703
|
+
canRestore: canUndo,
|
|
44704
|
+
onRestore: () => onUndo(change.key),
|
|
44705
|
+
...onAskAboutField ? { onAskAboutField } : {}
|
|
44706
|
+
},
|
|
44707
|
+
change.key
|
|
44708
|
+
)) }),
|
|
44709
|
+
undoConfirming ? /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(ConfirmUndo, { lines: undoConfirming.lines, onConfirm: onUndoConfirm, onCancel: onUndoCancel }) : undoMine && undo.phase === "writing" ? /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Undoing\u2026" }) : canRestore && !confirming && !(mine && pending.phase === "writing") ? canUndo ? /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("div", { className: "flex", children: /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
|
|
44710
|
+
import_design_system120.Button,
|
|
44711
|
+
{
|
|
44712
|
+
size: "sm",
|
|
44713
|
+
variant: "secondary",
|
|
44714
|
+
className: "h-6 px-2 text-[11px]",
|
|
44715
|
+
disabled: undoMine,
|
|
44716
|
+
onClick: () => onUndo(null),
|
|
44717
|
+
children: undoMine ? "Working out what would change\u2026" : "Undo this change"
|
|
44718
|
+
}
|
|
44719
|
+
) }) : null : null,
|
|
44720
|
+
canRestore && !undoMine ? confirming ? /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
|
|
44721
|
+
ConfirmRestore,
|
|
44722
|
+
{
|
|
44723
|
+
preview: confirming.preview,
|
|
44724
|
+
busy: false,
|
|
44725
|
+
onConfirm: () => onConfirm(confirming.fieldKey),
|
|
44726
|
+
onCancel
|
|
44727
|
+
}
|
|
44728
|
+
) : mine && pending.phase === "writing" ? /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Putting it back\u2026" }) : /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("div", { className: "flex", children: /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
|
|
44729
|
+
import_design_system120.Button,
|
|
44730
|
+
{
|
|
44731
|
+
size: "sm",
|
|
44732
|
+
variant: "secondary",
|
|
44733
|
+
className: "h-6 px-2 text-[11px]",
|
|
44734
|
+
disabled: mine,
|
|
44735
|
+
onClick: () => onRestore(null),
|
|
44736
|
+
children: mine ? "Working out what would change\u2026" : "Put the record back to this version"
|
|
44737
|
+
}
|
|
44738
|
+
) }) : (
|
|
44739
|
+
// Absent AND explained: never a greyed button, never silence.
|
|
44740
|
+
/* @__PURE__ */ (0, import_jsx_runtime140.jsx)("p", { className: "text-[11px] text-muted-foreground", children: whyNotRestore })
|
|
44741
|
+
)
|
|
44742
|
+
] }) : null
|
|
44603
44743
|
]
|
|
44604
44744
|
}
|
|
44605
|
-
)
|
|
44606
|
-
|
|
44607
|
-
entry.changes.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "This version changed the record without changing any of its values." }) : /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("ul", { className: "flex flex-col gap-1", children: entry.changes.map((change) => /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
|
|
44608
|
-
ChangeLine,
|
|
44609
|
-
{
|
|
44610
|
-
change,
|
|
44611
|
-
field: byKey.get(change.key),
|
|
44612
|
-
canRestore: canUndo,
|
|
44613
|
-
onRestore: () => onUndo(change.key),
|
|
44614
|
-
...onAskAboutField ? { onAskAboutField } : {}
|
|
44615
|
-
},
|
|
44616
|
-
change.key
|
|
44617
|
-
)) }),
|
|
44618
|
-
undoConfirming ? /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(ConfirmUndo, { lines: undoConfirming.lines, onConfirm: onUndoConfirm, onCancel: onUndoCancel }) : undoMine && undo.phase === "writing" ? /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Undoing\u2026" }) : canRestore && !confirming && !(mine && pending.phase === "writing") ? canUndo ? /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("div", { className: "flex", children: /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
|
|
44619
|
-
import_design_system120.Button,
|
|
44620
|
-
{
|
|
44621
|
-
size: "sm",
|
|
44622
|
-
variant: "secondary",
|
|
44623
|
-
className: "h-6 px-2 text-[11px]",
|
|
44624
|
-
disabled: undoMine,
|
|
44625
|
-
onClick: () => onUndo(null),
|
|
44626
|
-
children: undoMine ? "Working out what would change\u2026" : "Undo this change"
|
|
44627
|
-
}
|
|
44628
|
-
) }) : null : null,
|
|
44629
|
-
canRestore && !undoMine ? confirming ? /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
|
|
44630
|
-
ConfirmRestore,
|
|
44631
|
-
{
|
|
44632
|
-
preview: confirming.preview,
|
|
44633
|
-
busy: false,
|
|
44634
|
-
onConfirm: () => onConfirm(confirming.fieldKey),
|
|
44635
|
-
onCancel
|
|
44636
|
-
}
|
|
44637
|
-
) : mine && pending.phase === "writing" ? /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Putting it back\u2026" }) : /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("div", { className: "flex", children: /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
|
|
44638
|
-
import_design_system120.Button,
|
|
44639
|
-
{
|
|
44640
|
-
size: "sm",
|
|
44641
|
-
variant: "secondary",
|
|
44642
|
-
className: "h-6 px-2 text-[11px]",
|
|
44643
|
-
disabled: mine,
|
|
44644
|
-
onClick: () => onRestore(null),
|
|
44645
|
-
children: mine ? "Working out what would change\u2026" : "Put the record back to this version"
|
|
44646
|
-
}
|
|
44647
|
-
) }) : (
|
|
44648
|
-
// Absent AND explained: never a greyed button, never silence.
|
|
44649
|
-
/* @__PURE__ */ (0, import_jsx_runtime140.jsx)("p", { className: "text-[11px] text-muted-foreground", children: whyNotRestore })
|
|
44650
|
-
)
|
|
44651
|
-
] }) : null
|
|
44652
|
-
] });
|
|
44745
|
+
)
|
|
44746
|
+
);
|
|
44653
44747
|
}
|
|
44654
44748
|
function Who({ actor }) {
|
|
44655
44749
|
const name = actor.name ?? (actor.kind === "system" ? "the platform" : "somebody");
|
|
@@ -44667,7 +44761,7 @@ function Who({ actor }) {
|
|
|
44667
44761
|
] }) : null
|
|
44668
44762
|
] });
|
|
44669
44763
|
}
|
|
44670
|
-
return /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)("span", { className: "
|
|
44764
|
+
return /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)("span", { className: "min-w-0 truncate font-medium text-foreground", children: [
|
|
44671
44765
|
name,
|
|
44672
44766
|
actor.kind === "system" ? /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(import_design_system120.Badge, { variant: "outline", className: "ml-1 text-[10px]", children: "automatic" }) : null
|
|
44673
44767
|
] });
|
|
@@ -44791,6 +44885,17 @@ function ConfirmRestore({
|
|
|
44791
44885
|
] })
|
|
44792
44886
|
] });
|
|
44793
44887
|
}
|
|
44888
|
+
function verbWords(words2) {
|
|
44889
|
+
return words2 ? words2.charAt(0).toLowerCase() + words2.slice(1) : words2;
|
|
44890
|
+
}
|
|
44891
|
+
function changeSummary(entry) {
|
|
44892
|
+
const labels = entry.changes.map((c) => c.label);
|
|
44893
|
+
if (labels.length === 0) return "nothing about the values changed";
|
|
44894
|
+
const shown5 = labels.slice(0, 3).join(", ");
|
|
44895
|
+
const more = labels.length - 3;
|
|
44896
|
+
const list = more > 0 ? `${shown5} and ${more} more` : shown5;
|
|
44897
|
+
return entry.operation === "insert" ? `${labels.length} ${labels.length === 1 ? "value" : "values"}: ${list}` : list;
|
|
44898
|
+
}
|
|
44794
44899
|
function whenText(at) {
|
|
44795
44900
|
const then = new Date(at);
|
|
44796
44901
|
const age = Date.now() - then.getTime();
|
|
@@ -55883,9 +55988,15 @@ function RecordPanel({ tableId, recordId, onClose, onAskAboutField, onPage = fal
|
|
|
55883
55988
|
onPage ? /* @__PURE__ */ (0, import_jsx_runtime176.jsxs)(import_jsx_runtime176.Fragment, { children: [
|
|
55884
55989
|
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)(RecordBody, { tableId, recordId }),
|
|
55885
55990
|
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)(LinkedLists, { tableId, recordId }),
|
|
55886
|
-
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)(ReverseLinksSections, { tableId, recordId })
|
|
55887
|
-
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)(RecordAsk, { tableId, recordId })
|
|
55991
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)(ReverseLinksSections, { tableId, recordId })
|
|
55888
55992
|
] }) : null,
|
|
55993
|
+
host.recordSections ? /* @__PURE__ */ (0, import_jsx_runtime176.jsxs)(import_react316.Fragment, { children: [
|
|
55994
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)(import_design_system157.Separator, {}),
|
|
55995
|
+
host.recordSections({ tableId, recordId })
|
|
55996
|
+
] }) : null,
|
|
55997
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)(ChecklistRunner, { tableId, recordId, quietWhenEmpty: true, className: "border-t pt-3" }),
|
|
55998
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)(import_design_system157.Separator, {}),
|
|
55999
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)(CommentThread, { tableId, recordId }),
|
|
55889
56000
|
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)(import_design_system157.Separator, {}),
|
|
55890
56001
|
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)(
|
|
55891
56002
|
HistoryPanel,
|
|
@@ -55895,15 +56006,7 @@ function RecordPanel({ tableId, recordId, onClose, onAskAboutField, onPage = fal
|
|
|
55895
56006
|
onAskAboutField: (fieldKey) => onAskAboutField ? onAskAboutField(fieldKey) : setAsking(fieldKey)
|
|
55896
56007
|
}
|
|
55897
56008
|
),
|
|
55898
|
-
!onAskAboutField && asking ? /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(FieldHistoryPanel, { tableId, fieldKey: asking, recordId, onClose: () => setAsking(null) }) : null
|
|
55899
|
-
host.recordSections ? /* @__PURE__ */ (0, import_jsx_runtime176.jsxs)(import_react316.Fragment, { children: [
|
|
55900
|
-
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)(import_design_system157.Separator, {}),
|
|
55901
|
-
host.recordSections({ tableId, recordId })
|
|
55902
|
-
] }) : null,
|
|
55903
|
-
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)(import_design_system157.Separator, {}),
|
|
55904
|
-
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)(ChecklistRunner, { tableId, recordId }),
|
|
55905
|
-
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)(import_design_system157.Separator, {}),
|
|
55906
|
-
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)(CommentThread, { tableId, recordId })
|
|
56009
|
+
!onAskAboutField && asking ? /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(FieldHistoryPanel, { tableId, fieldKey: asking, recordId, onClose: () => setAsking(null) }) : null
|
|
55907
56010
|
]
|
|
55908
56011
|
}
|
|
55909
56012
|
);
|
|
@@ -55955,15 +56058,6 @@ function LinkedLists({ tableId, recordId }) {
|
|
|
55955
56058
|
})
|
|
55956
56059
|
] });
|
|
55957
56060
|
}
|
|
55958
|
-
function RecordAsk({ tableId, recordId }) {
|
|
55959
|
-
const host = useRecordsUi();
|
|
55960
|
-
const [open, setOpen] = (0, import_react316.useState)(false);
|
|
55961
|
-
if (!host.chat) return null;
|
|
55962
|
-
return /* @__PURE__ */ (0, import_jsx_runtime176.jsxs)("section", { className: "flex min-w-0 flex-col gap-1.5", "data-record-ask": open ? "open" : "", children: [
|
|
55963
|
-
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)(import_design_system157.Separator, {}),
|
|
55964
|
-
open ? /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(RecordChat, { tableId, recordId, className: "min-h-[22rem]" }) : /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(import_design_system157.Button, { size: "sm", variant: "outline", className: "self-start", onClick: () => setOpen(true), "data-record-ask-open": "", children: "Ask about this record" })
|
|
55965
|
-
] });
|
|
55966
|
-
}
|
|
55967
56061
|
|
|
55968
56062
|
// src/TablePage.tsx
|
|
55969
56063
|
init_BookingSlots();
|