@ai-matrx/records-ui 0.93.30 → 0.93.37
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 +42 -0
- package/dist/index.cjs +185 -118
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +104 -37
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -976,7 +976,7 @@ var import_design_system11 = require("@ai-matrx/design-system");
|
|
|
976
976
|
|
|
977
977
|
// src/editors.tsx
|
|
978
978
|
var import_react18 = require("react");
|
|
979
|
-
var
|
|
979
|
+
var import_records6 = require("@ai-matrx/records");
|
|
980
980
|
var import_react19 = require("@ai-matrx/records/react");
|
|
981
981
|
var import_design_system10 = require("@ai-matrx/design-system");
|
|
982
982
|
|
|
@@ -1684,6 +1684,7 @@ var import_design_system6 = require("@ai-matrx/design-system");
|
|
|
1684
1684
|
// src/labels.tsx
|
|
1685
1685
|
var import_react8 = require("react");
|
|
1686
1686
|
var import_react9 = require("@ai-matrx/records/react");
|
|
1687
|
+
var import_records4 = require("@ai-matrx/records");
|
|
1687
1688
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1688
1689
|
var LabelContext = (0, import_react8.createContext)({
|
|
1689
1690
|
// With no provider the resolver is ABSENT, not silently empty: a caller gets
|
|
@@ -1704,6 +1705,9 @@ function idsOf(value) {
|
|
|
1704
1705
|
return [];
|
|
1705
1706
|
}
|
|
1706
1707
|
var UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
1708
|
+
function choiceKeyName(fieldId, key) {
|
|
1709
|
+
return `${fieldId}\0key\0${key}`;
|
|
1710
|
+
}
|
|
1707
1711
|
function isId(value) {
|
|
1708
1712
|
return typeof value === "string" && UUID.test(value);
|
|
1709
1713
|
}
|
|
@@ -1770,7 +1774,10 @@ function RecordLabelProvider({ children }) {
|
|
|
1770
1774
|
setNames((current) => {
|
|
1771
1775
|
const next = { ...current };
|
|
1772
1776
|
for (const option of result.data ?? []) {
|
|
1773
|
-
|
|
1777
|
+
const words2 = recordName(option.data, null, "Unnamed choice");
|
|
1778
|
+
next[option.id] = words2;
|
|
1779
|
+
const key = (0, import_records4.optionKey)(option);
|
|
1780
|
+
if (key) next[choiceKeyName(field2.id, key)] = words2;
|
|
1774
1781
|
}
|
|
1775
1782
|
return next;
|
|
1776
1783
|
});
|
|
@@ -1834,14 +1841,26 @@ function RecordLabelProvider({ children }) {
|
|
|
1834
1841
|
},
|
|
1835
1842
|
[]
|
|
1836
1843
|
);
|
|
1844
|
+
const rereadFor = (0, import_react8.useRef)(/* @__PURE__ */ new Set());
|
|
1837
1845
|
const lookup = (0, import_react8.useCallback)(
|
|
1838
1846
|
(field2, id) => {
|
|
1847
|
+
if (field2.type === "list" && !isId(id)) {
|
|
1848
|
+
const named = names[choiceKeyName(field2.id, id)];
|
|
1849
|
+
if (named !== void 0) return named;
|
|
1850
|
+
const once = choiceKeyName(field2.id, id);
|
|
1851
|
+
if (settled[field2.id] && !rereadFor.current.has(once)) {
|
|
1852
|
+
rereadFor.current.add(once);
|
|
1853
|
+
asked2.current.delete(field2.id);
|
|
1854
|
+
want(field2);
|
|
1855
|
+
}
|
|
1856
|
+
return null;
|
|
1857
|
+
}
|
|
1839
1858
|
const known = names[id];
|
|
1840
1859
|
if (known !== void 0) return known;
|
|
1841
1860
|
if (settled[field2.id]) chase(field2, id);
|
|
1842
1861
|
return null;
|
|
1843
1862
|
},
|
|
1844
|
-
[names, settled, chase]
|
|
1863
|
+
[names, settled, chase, want]
|
|
1845
1864
|
);
|
|
1846
1865
|
const waiting = (0, import_react8.useCallback)((field2) => waitingLines[field2.id] ?? null, [waitingLines]);
|
|
1847
1866
|
const value = (0, import_react8.useMemo)(() => ({ lookup, want, waiting }), [lookup, want, waiting]);
|
|
@@ -2110,14 +2129,14 @@ function AttachmentControl({
|
|
|
2110
2129
|
|
|
2111
2130
|
// src/EntityReferenceControl.tsx
|
|
2112
2131
|
var import_react13 = require("react");
|
|
2113
|
-
var
|
|
2132
|
+
var import_records5 = require("@ai-matrx/records");
|
|
2114
2133
|
var import_react14 = require("@ai-matrx/records/react");
|
|
2115
2134
|
var import_design_system7 = require("@ai-matrx/design-system");
|
|
2116
2135
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
2117
2136
|
var WITHHELD_ENTITY_LABEL = "Something you have not been given access to";
|
|
2118
2137
|
var ENTITY_REFERENCE_EMPTY = "Nothing is pointed at yet. A reference is added from the thing itself, by an agent, or by an import.";
|
|
2119
2138
|
function entityReferenceText(value) {
|
|
2120
|
-
const refs = (0,
|
|
2139
|
+
const refs = (0, import_records5.entityRefsOf)(value);
|
|
2121
2140
|
if (refs.length === 0) return "\u2014";
|
|
2122
2141
|
return refs.map((r) => r.label ?? WITHHELD_ENTITY_LABEL).join(", ");
|
|
2123
2142
|
}
|
|
@@ -2126,13 +2145,13 @@ function EntityReferenceControl(props) {
|
|
|
2126
2145
|
return client ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(WithWords, { ...props }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Chips, { ...props, words: null });
|
|
2127
2146
|
}
|
|
2128
2147
|
function WithWords(props) {
|
|
2129
|
-
const refs = (0, import_react13.useMemo)(() => (0,
|
|
2148
|
+
const refs = (0, import_react13.useMemo)(() => (0, import_records5.entityRefsOf)(props.value), [props.value]);
|
|
2130
2149
|
const unlabelled = (0, import_react13.useMemo)(() => refs.filter((r) => r.label === null).map((r) => ({ token: r.token, id: r.id })), [refs]);
|
|
2131
2150
|
const words2 = (0, import_react14.useEntityReferenceWords)(unlabelled);
|
|
2132
2151
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Chips, { ...props, words: words2 });
|
|
2133
2152
|
}
|
|
2134
2153
|
function Chips({ field: field2, value, onChange, disabled, id, className, words: words2 }) {
|
|
2135
|
-
const refs = (0, import_react13.useMemo)(() => (0,
|
|
2154
|
+
const refs = (0, import_react13.useMemo)(() => (0, import_records5.entityRefsOf)(value), [value]);
|
|
2136
2155
|
const labelOf = (token, refId, own2) => {
|
|
2137
2156
|
if (own2) return own2;
|
|
2138
2157
|
const read = words2?.data?.find((w) => w.token === token && w.id === refId)?.label;
|
|
@@ -2156,7 +2175,7 @@ function Chips({ field: field2, value, onChange, disabled, id, className, words:
|
|
|
2156
2175
|
"aria-label": `Take ${label} off`,
|
|
2157
2176
|
onClick: () => {
|
|
2158
2177
|
const rest = refs.filter((x) => !(x.token === r.token && x.id === r.id));
|
|
2159
|
-
onChange((0,
|
|
2178
|
+
onChange((0, import_records5.entityRefsToWrite)(rest, multi));
|
|
2160
2179
|
},
|
|
2161
2180
|
children: "\xD7"
|
|
2162
2181
|
}
|
|
@@ -2809,14 +2828,14 @@ function judgeTyped(field2, text, choices, nudge) {
|
|
|
2809
2828
|
if (!choices || nudge === null) return null;
|
|
2810
2829
|
const several = field2.multi || kind === "multi_select";
|
|
2811
2830
|
const words2 = several ? trimmed.split(/\s*[,;\n]\s*/).filter(Boolean) : [trimmed];
|
|
2812
|
-
const allowOther = (0,
|
|
2831
|
+
const allowOther = (0, import_records6.allowsOtherValues)(field2);
|
|
2813
2832
|
const parts = [];
|
|
2814
2833
|
const add = [];
|
|
2815
2834
|
const ask = [];
|
|
2816
2835
|
const notChoices = [];
|
|
2817
2836
|
let keepOffered = allowOther;
|
|
2818
2837
|
for (const word of words2) {
|
|
2819
|
-
const decided = (0,
|
|
2838
|
+
const decided = (0, import_records6.decideTypedChoice)({ words: word, options: choices, allowOther, nudge });
|
|
2820
2839
|
if (decided.decision === "empty") continue;
|
|
2821
2840
|
if (decided.decision === "chosen") parts.push(decided.key);
|
|
2822
2841
|
else {
|
|
@@ -2843,7 +2862,7 @@ function judgeTyped(field2, text, choices, nudge) {
|
|
|
2843
2862
|
const max = format.options?.ratingMax ?? 5;
|
|
2844
2863
|
return Number.isInteger(n) && n >= 0 && n <= max ? { value: n === 0 ? null : n } : { refusal: `${fieldName(field2)} is a rating from 1 to ${max}, and \u201C${text}\u201D is not one.` };
|
|
2845
2864
|
}
|
|
2846
|
-
const read = (0,
|
|
2865
|
+
const read = (0, import_records6.coerceTypedAnswer)(field2, text, { label: fieldName(field2) });
|
|
2847
2866
|
if ("refusal" in read) return { refusal: read.refusal };
|
|
2848
2867
|
if (typeof read.value === "number" && format && (format.id === "percent" || format.id === "progress") && format.options?.percentScale === "fraction") {
|
|
2849
2868
|
return { value: Math.round(read.value / 100 * 1e9) / 1e9 };
|
|
@@ -2919,7 +2938,7 @@ function TypedTextControl({ field: field2, value, onChange, disabled, id, onComm
|
|
|
2919
2938
|
" ",
|
|
2920
2939
|
needsChoices ? String(
|
|
2921
2940
|
(Array.isArray(withoutAddition(judged.value).value) ? withoutAddition(judged.value).value : [withoutAddition(judged.value).value]).map((k) => {
|
|
2922
|
-
const option = choices?.find((o) => (0,
|
|
2941
|
+
const option = choices?.find((o) => (0, import_records6.optionKey)(o) === k);
|
|
2923
2942
|
return option ? recordName(option.data, null, String(k)) : String(k);
|
|
2924
2943
|
}).join(", ")
|
|
2925
2944
|
) : (() => {
|
|
@@ -3180,7 +3199,7 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
3180
3199
|
onClose,
|
|
3181
3200
|
initialSearch,
|
|
3182
3201
|
addsChoices,
|
|
3183
|
-
allowOther: (0,
|
|
3202
|
+
allowOther: (0, import_records6.allowsOtherValues)(field2),
|
|
3184
3203
|
onChoicesChanged: () => setReread((n) => n + 1)
|
|
3185
3204
|
}
|
|
3186
3205
|
);
|
|
@@ -3190,19 +3209,19 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
3190
3209
|
}
|
|
3191
3210
|
const titleOf = (option) => recordName(option.data, null, "Unnamed choice");
|
|
3192
3211
|
if (field2.multi) {
|
|
3193
|
-
const chosen = options.filter((option) => (0,
|
|
3194
|
-
const picked = new Set(chosen.map((option) => (0,
|
|
3212
|
+
const chosen = options.filter((option) => (0, import_records6.choiceValuesOf)(value).some((v) => (0, import_records6.isTheChosen)(option, v)));
|
|
3213
|
+
const picked = new Set(chosen.map((option) => (0, import_records6.optionKey)(option)));
|
|
3195
3214
|
const toggles = /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { id: autoOpen ? void 0 : id, className: "flex flex-wrap gap-1", children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
3196
3215
|
import_design_system10.Button,
|
|
3197
3216
|
{
|
|
3198
3217
|
type: "button",
|
|
3199
3218
|
size: "sm",
|
|
3200
|
-
variant: picked.has((0,
|
|
3219
|
+
variant: picked.has((0, import_records6.optionKey)(option)) ? "default" : "outline",
|
|
3201
3220
|
disabled,
|
|
3202
3221
|
onClick: () => {
|
|
3203
3222
|
const next = new Set(picked);
|
|
3204
|
-
if (next.has((0,
|
|
3205
|
-
else next.add((0,
|
|
3223
|
+
if (next.has((0, import_records6.optionKey)(option))) next.delete((0, import_records6.optionKey)(option));
|
|
3224
|
+
else next.add((0, import_records6.optionKey)(option));
|
|
3206
3225
|
onChange(next.size === 0 ? null : [...next]);
|
|
3207
3226
|
},
|
|
3208
3227
|
children: titleOf(option)
|
|
@@ -3224,11 +3243,11 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
3224
3243
|
}
|
|
3225
3244
|
);
|
|
3226
3245
|
}
|
|
3227
|
-
const current = options.find((option) => (0,
|
|
3246
|
+
const current = options.find((option) => (0, import_records6.isTheChosen)(option, value));
|
|
3228
3247
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
3229
3248
|
import_design_system10.Select,
|
|
3230
3249
|
{
|
|
3231
|
-
value: current ? (0,
|
|
3250
|
+
value: current ? (0, import_records6.optionKey)(current) : "",
|
|
3232
3251
|
disabled: disabled ?? false,
|
|
3233
3252
|
onValueChange: (next) => onChange(next === "" ? null : next),
|
|
3234
3253
|
...autoOpen ? {
|
|
@@ -3240,7 +3259,7 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
3240
3259
|
} : {},
|
|
3241
3260
|
children: [
|
|
3242
3261
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system10.SelectTrigger, { id, size: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system10.SelectValue, { placeholder: "Choose" }) }),
|
|
3243
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system10.SelectContent, { children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system10.SelectItem, { value: (0,
|
|
3262
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system10.SelectContent, { children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system10.SelectItem, { value: (0, import_records6.optionKey)(option), children: titleOf(option) }, option.id)) })
|
|
3244
3263
|
]
|
|
3245
3264
|
}
|
|
3246
3265
|
);
|
|
@@ -3273,22 +3292,22 @@ function OpenChoicePicker({
|
|
|
3273
3292
|
const [addRefused, setAddRefused] = (0, import_react18.useState)(null);
|
|
3274
3293
|
const titleOf = (option) => recordName(option.data, null, "Unnamed choice");
|
|
3275
3294
|
const held = withoutAddition(value);
|
|
3276
|
-
const current = (0,
|
|
3295
|
+
const current = (0, import_records6.choiceValuesOf)(held.value);
|
|
3277
3296
|
const pickedWords = current.map((v) => {
|
|
3278
|
-
const option = options.find((o) => (0,
|
|
3297
|
+
const option = options.find((o) => (0, import_records6.isTheChosen)(o, v));
|
|
3279
3298
|
return option ? titleOf(option) : String(v);
|
|
3280
3299
|
});
|
|
3281
3300
|
const q = search.trim();
|
|
3282
3301
|
const visible = options.filter((o) => q === "" || titleOf(o).toLowerCase().includes(q.toLowerCase()));
|
|
3283
|
-
const decided = (0,
|
|
3302
|
+
const decided = (0, import_records6.decideTypedChoice)({ words: q, options, allowOther, nudge: nudge ?? "ask" });
|
|
3284
3303
|
const choose = (word, addingIt = false) => {
|
|
3285
3304
|
const pending = held.add.filter((w) => w.toLowerCase() !== word.toLowerCase());
|
|
3286
3305
|
let next;
|
|
3287
3306
|
let add2 = [...pending];
|
|
3288
3307
|
if (field2.multi) {
|
|
3289
3308
|
const existing = current.map((v) => {
|
|
3290
|
-
const option = options.find((o) => (0,
|
|
3291
|
-
return option ? (0,
|
|
3309
|
+
const option = options.find((o) => (0, import_records6.isTheChosen)(o, v));
|
|
3310
|
+
return option ? (0, import_records6.optionKey)(option) : String(v);
|
|
3292
3311
|
});
|
|
3293
3312
|
const has = existing.some((v) => v.toLowerCase() === word.toLowerCase());
|
|
3294
3313
|
const list = has ? existing.filter((v) => v.toLowerCase() !== word.toLowerCase()) : [...existing, word];
|
|
@@ -3357,11 +3376,11 @@ function OpenChoicePicker({
|
|
|
3357
3376
|
items: visible.map((option) => ({
|
|
3358
3377
|
id: option.id,
|
|
3359
3378
|
label: titleOf(option),
|
|
3360
|
-
picked: current.some((v) => (0,
|
|
3379
|
+
picked: current.some((v) => (0, import_records6.isTheChosen)(option, v))
|
|
3361
3380
|
})),
|
|
3362
3381
|
onPick: (optionId) => {
|
|
3363
3382
|
const option = options.find((o) => o.id === optionId);
|
|
3364
|
-
if (option) choose((0,
|
|
3383
|
+
if (option) choose((0, import_records6.optionKey)(option));
|
|
3365
3384
|
},
|
|
3366
3385
|
empty: q === "" ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "p-2 text-xs text-muted-foreground", children: "No choices yet \u2014 type one to add it." }) : null,
|
|
3367
3386
|
add,
|
|
@@ -4284,6 +4303,10 @@ function scalarText(field2, value, labels, stillWaitingFor) {
|
|
|
4284
4303
|
if (isId(value) && (field2.type === "list" || field2.type === "relation")) {
|
|
4285
4304
|
return labels?.(field2, String(value)) ?? stillWaitingFor ?? "Loading\u2026";
|
|
4286
4305
|
}
|
|
4306
|
+
if (field2.type === "list" && typeof value === "string" && labels) {
|
|
4307
|
+
const words2 = labels(field2, value);
|
|
4308
|
+
if (words2) return words2;
|
|
4309
|
+
}
|
|
4287
4310
|
const shownAs = shownAsOf(field2);
|
|
4288
4311
|
if (shownAs) {
|
|
4289
4312
|
const said = (0, import_field_formats6.formatFieldValue)(value, shownAs);
|
|
@@ -4884,6 +4907,13 @@ function GridCell({
|
|
|
4884
4907
|
onAskWhoChanged
|
|
4885
4908
|
}) {
|
|
4886
4909
|
const ui = useRecordsUi();
|
|
4910
|
+
const saidAt = (0, import_react25.useRef)(0);
|
|
4911
|
+
const sayWhyNot = () => {
|
|
4912
|
+
if (Date.now() - saidAt.current < 4e3) return;
|
|
4913
|
+
saidAt.current = Date.now();
|
|
4914
|
+
const why = fieldIsEditable(field2) ? `${fieldName(field2)} \u2014 ${whyNot ?? "you cannot change this record"}` : `${fieldName(field2)} is worked out by the system, so it cannot be typed in`;
|
|
4915
|
+
ui.notify?.error(why);
|
|
4916
|
+
};
|
|
4887
4917
|
const open = Boolean(
|
|
4888
4918
|
editing && editing.editing?.rowId === row.id && editing.editing.key === field2.key
|
|
4889
4919
|
);
|
|
@@ -5002,6 +5032,7 @@ function GridCell({
|
|
|
5002
5032
|
event.preventDefault();
|
|
5003
5033
|
event.stopPropagation();
|
|
5004
5034
|
if (editable) editing?.begin({ rowId: row.id, key: field2.key });
|
|
5035
|
+
else sayWhyNot();
|
|
5005
5036
|
},
|
|
5006
5037
|
onKeyDown: (event) => {
|
|
5007
5038
|
if (editable && (event.key === "Enter" || event.key === "F2")) {
|
|
@@ -5017,7 +5048,9 @@ function GridCell({
|
|
|
5017
5048
|
if (editable && isTypedCharacter(event) && typingOpens(field2) !== "none") {
|
|
5018
5049
|
event.preventDefault();
|
|
5019
5050
|
editing?.begin({ rowId: row.id, key: field2.key }, event.key);
|
|
5051
|
+
return;
|
|
5020
5052
|
}
|
|
5053
|
+
if (!editable && (event.key === "Enter" || event.key === "F2" || isTypedCharacter(event))) sayWhyNot();
|
|
5021
5054
|
},
|
|
5022
5055
|
tabIndex: editable || onAskWhoChanged ? 0 : void 0,
|
|
5023
5056
|
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
@@ -5261,7 +5294,7 @@ function OpenCell({
|
|
|
5261
5294
|
// src/Grid.tsx
|
|
5262
5295
|
var import_react72 = require("react");
|
|
5263
5296
|
var import_react73 = require("@ai-matrx/records/react");
|
|
5264
|
-
var
|
|
5297
|
+
var import_records18 = require("@ai-matrx/records");
|
|
5265
5298
|
var import_data_table9 = require("@ai-matrx/design-system/data-table");
|
|
5266
5299
|
var import_core9 = require("@ai-matrx/records/core");
|
|
5267
5300
|
|
|
@@ -5297,11 +5330,11 @@ function useTableDecorations(tableId, revision) {
|
|
|
5297
5330
|
}
|
|
5298
5331
|
|
|
5299
5332
|
// src/emptyState.tsx
|
|
5300
|
-
var
|
|
5333
|
+
var import_records8 = require("@ai-matrx/records");
|
|
5301
5334
|
var import_design_system15 = require("@ai-matrx/design-system");
|
|
5302
5335
|
|
|
5303
5336
|
// src/gridPage.ts
|
|
5304
|
-
var
|
|
5337
|
+
var import_records7 = require("@ai-matrx/records");
|
|
5305
5338
|
var import_data_table5 = require("@ai-matrx/design-system/data-table");
|
|
5306
5339
|
function sortRefusal(f) {
|
|
5307
5340
|
if (!computedOnRead(f)) return null;
|
|
@@ -5402,7 +5435,7 @@ function storeQuestion(fields, base, columnFilters, now = /* @__PURE__ */ new Da
|
|
|
5402
5435
|
const refused = [];
|
|
5403
5436
|
const flat = {};
|
|
5404
5437
|
const rules = [];
|
|
5405
|
-
if (base && (0,
|
|
5438
|
+
if (base && (0, import_records7.isRuleFilter)(base)) rules.push(base);
|
|
5406
5439
|
else if (base) Object.assign(flat, base);
|
|
5407
5440
|
for (const [key, value] of Object.entries(columnFilters)) {
|
|
5408
5441
|
if (!value) continue;
|
|
@@ -5449,7 +5482,7 @@ var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
|
5449
5482
|
function questionIsAsked(args) {
|
|
5450
5483
|
if ((args.search ?? "").trim() !== "") return true;
|
|
5451
5484
|
if (Object.values(args.columnFilters ?? {}).some((value) => value !== void 0 && value !== null)) return true;
|
|
5452
|
-
if (args.filter && (0,
|
|
5485
|
+
if (args.filter && (0, import_records8.stableFilterKey)(args.filter) !== "{}") return true;
|
|
5453
5486
|
return Boolean(args.ruled);
|
|
5454
5487
|
}
|
|
5455
5488
|
function emptyCauseOf(args) {
|
|
@@ -5514,10 +5547,10 @@ var import_design_system22 = require("@ai-matrx/design-system");
|
|
|
5514
5547
|
// src/FormulaTextEditor.tsx
|
|
5515
5548
|
var import_react29 = require("react");
|
|
5516
5549
|
var import_react30 = require("@ai-matrx/records/react");
|
|
5517
|
-
var
|
|
5550
|
+
var import_records9 = require("@ai-matrx/records");
|
|
5518
5551
|
var import_design_system16 = require("@ai-matrx/design-system");
|
|
5519
5552
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
5520
|
-
var FORMULA_FUNCTIONS =
|
|
5553
|
+
var FORMULA_FUNCTIONS = import_records9.RULE_NODE_KINDS.map((row) => row.node).filter((node) => node.startsWith("fx.")).map((node) => node.slice(3).toUpperCase()).filter((name) => !["ADD", "SUB", "MUL", "DIV", "EQ", "NEQ", "GT", "GTE", "LT", "LTE", "NEG", "FIELD", "CONST"].includes(name)).sort();
|
|
5521
5554
|
var RESULT_WORD = {
|
|
5522
5555
|
number: "a number",
|
|
5523
5556
|
text: "text",
|
|
@@ -5739,21 +5772,31 @@ function EntityReferenceKindPicker({ value, onChange, locked = false, className
|
|
|
5739
5772
|
|
|
5740
5773
|
// src/FieldRetype.tsx
|
|
5741
5774
|
var import_react33 = require("react");
|
|
5742
|
-
var
|
|
5775
|
+
var import_records10 = require("@ai-matrx/records");
|
|
5743
5776
|
var import_react34 = require("@ai-matrx/records/react");
|
|
5744
5777
|
var import_design_system18 = require("@ai-matrx/design-system");
|
|
5745
5778
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
5746
5779
|
var RETYPE_TARGETS = [
|
|
5747
|
-
{ behaviour: "text", label: "Text", holds: "words" },
|
|
5748
|
-
{ behaviour: "range", label: "Number", holds: "a number" },
|
|
5749
|
-
|
|
5780
|
+
{ id: "text", behaviour: "text", kind: null, label: "Text", holds: "words" },
|
|
5781
|
+
{ id: "number", behaviour: "range", kind: "number", label: "Number", holds: "a number" },
|
|
5782
|
+
// A DATE is a `range` of kind date: `migrate_retype` alone cannot say "date" (it keeps the old
|
|
5783
|
+
// kind, so every date would be kept aside), so this one goes through `custom.field_update`'s own
|
|
5784
|
+
// retype arm (`parity_type: datetime`), which converts on the SAME trigger and keeps what does not
|
|
5785
|
+
// fit in `_retired` with the reason — measured on the live store 2026-09-28.
|
|
5786
|
+
{ id: "date", behaviour: "range", kind: "date", label: "Date", holds: "a date" },
|
|
5787
|
+
{ id: "checkbox", behaviour: "boolean", kind: null, label: "Yes / no", holds: "a yes or a no" }
|
|
5750
5788
|
];
|
|
5751
5789
|
var PREVIEW_GROUPS = 1e3;
|
|
5752
5790
|
function retypeableFrom(field2) {
|
|
5753
5791
|
const behaviour = String(field2.type);
|
|
5754
|
-
|
|
5792
|
+
return behaviour === "text" || behaviour === "range" || behaviour === "boolean";
|
|
5793
|
+
}
|
|
5794
|
+
function currentTarget(field2) {
|
|
5755
5795
|
const kind = String(editorKindFor(field2));
|
|
5756
|
-
|
|
5796
|
+
if (String(field2.type) === "boolean") return "checkbox";
|
|
5797
|
+
if (kind === "datetime" || kind === "date") return "date";
|
|
5798
|
+
if (String(field2.type) === "range") return "number";
|
|
5799
|
+
return "text";
|
|
5757
5800
|
}
|
|
5758
5801
|
function FieldRetype({ field: field2, tableId, onRetyped }) {
|
|
5759
5802
|
const client = (0, import_react34.useRecordsClient)();
|
|
@@ -5764,7 +5807,7 @@ function FieldRetype({ field: field2, tableId, onRetyped }) {
|
|
|
5764
5807
|
const [busy, setBusy] = (0, import_react33.useState)(false);
|
|
5765
5808
|
const [said, setSaid] = (0, import_react33.useState)(null);
|
|
5766
5809
|
const name = fieldName(field2);
|
|
5767
|
-
const targets = RETYPE_TARGETS.filter((t) => t.
|
|
5810
|
+
const targets = RETYPE_TARGETS.filter((t) => t.id !== currentTarget(field2));
|
|
5768
5811
|
(0, import_react33.useEffect)(() => {
|
|
5769
5812
|
if (!to) return;
|
|
5770
5813
|
let cancelled = false;
|
|
@@ -5779,7 +5822,7 @@ function FieldRetype({ field: field2, tableId, onRetyped }) {
|
|
|
5779
5822
|
return;
|
|
5780
5823
|
}
|
|
5781
5824
|
const groups = answer.data.map((row) => ({ value: row.groups[field2.key] ?? null, count: row.row_count }));
|
|
5782
|
-
setPreview((0,
|
|
5825
|
+
setPreview((0, import_records10.previewRetype)({ type: to.behaviour, kind: to.kind }, groups, answer.data.length >= PREVIEW_GROUPS));
|
|
5783
5826
|
});
|
|
5784
5827
|
return () => {
|
|
5785
5828
|
cancelled = true;
|
|
@@ -5789,22 +5832,35 @@ function FieldRetype({ field: field2, tableId, onRetyped }) {
|
|
|
5789
5832
|
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("p", { className: "text-[11px] text-muted-foreground", "data-records-retype": "not-here", children: [
|
|
5790
5833
|
name,
|
|
5791
5834
|
" holds ",
|
|
5792
|
-
String(
|
|
5793
|
-
",
|
|
5835
|
+
String(field2.type) === "formula" ? "a value the table works out" : "records picked from a list or another table",
|
|
5836
|
+
", and the store keeps those as record ids \u2014 turned into words or numbers they would read as ids, so it is not changed here."
|
|
5794
5837
|
] });
|
|
5795
5838
|
}
|
|
5796
5839
|
const change = async () => {
|
|
5797
5840
|
if (!to) return;
|
|
5798
5841
|
setBusy(true);
|
|
5799
5842
|
setRefusal(null);
|
|
5800
|
-
|
|
5801
|
-
|
|
5802
|
-
if (
|
|
5803
|
-
|
|
5804
|
-
|
|
5843
|
+
let holding;
|
|
5844
|
+
let aside;
|
|
5845
|
+
if (to.id === "date") {
|
|
5846
|
+
const done = await client.fieldUpdate({ field_id: field2.id, patch: { parity_type: "datetime" } });
|
|
5847
|
+
setBusy(false);
|
|
5848
|
+
if (!done.ok) {
|
|
5849
|
+
setRefusal(done.error);
|
|
5850
|
+
return;
|
|
5851
|
+
}
|
|
5852
|
+
holding = preview?.converts ?? 0;
|
|
5853
|
+
aside = preview?.keptAside ?? 0;
|
|
5854
|
+
} else {
|
|
5855
|
+
const done = await client.migrateRetype({ field_id: field2.id, to: to.behaviour });
|
|
5856
|
+
setBusy(false);
|
|
5857
|
+
if (!done.ok) {
|
|
5858
|
+
setRefusal(done.error);
|
|
5859
|
+
return;
|
|
5860
|
+
}
|
|
5861
|
+
holding = done.data.records_still_holding_a_value ?? 0;
|
|
5862
|
+
aside = done.data.values_in_retired_for_this_field ?? 0;
|
|
5805
5863
|
}
|
|
5806
|
-
const holding = done.data.records_still_holding_a_value ?? 0;
|
|
5807
|
-
const aside = done.data.values_in_retired_for_this_field ?? 0;
|
|
5808
5864
|
setSaid(
|
|
5809
5865
|
`${name} now holds ${to.holds}. ${holding} ${holding === 1 ? "record holds" : "records hold"} a value` + (aside > 0 ? `; ${aside} ${aside === 1 ? "value that did not fit was" : "values that did not fit were"} kept with ${aside === 1 ? "its record" : "their records"}, with the reason.` : ".")
|
|
5810
5866
|
);
|
|
@@ -5815,9 +5871,9 @@ function FieldRetype({ field: field2, tableId, onRetyped }) {
|
|
|
5815
5871
|
};
|
|
5816
5872
|
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-col gap-1.5", "data-records-retype": "", children: [
|
|
5817
5873
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
5818
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_design_system18.Select, { value: to?.
|
|
5874
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_design_system18.Select, { value: to?.id ?? "", onValueChange: (next) => setTo(targets.find((t) => t.id === next) ?? null), children: [
|
|
5819
5875
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_design_system18.SelectTrigger, { size: "sm", "aria-label": "Change what this column holds", className: "w-auto min-w-[12rem]", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_design_system18.SelectValue, { placeholder: "Change what this column holds" }) }),
|
|
5820
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_design_system18.SelectContent, { children: targets.map((t) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_design_system18.SelectItem, { value: t.
|
|
5876
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_design_system18.SelectContent, { children: targets.map((t) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_design_system18.SelectItem, { value: t.id, children: t.label }, t.id)) })
|
|
5821
5877
|
] }),
|
|
5822
5878
|
to ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_design_system18.Button, { size: "sm", disabled: busy || asking || preview === null, onClick: () => void change(), "data-records-retype-go": "", children: busy ? "Changing\u2026" : `Change to ${to.label}` }) : null,
|
|
5823
5879
|
to ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_design_system18.Button, { size: "sm", variant: "ghost", onClick: () => setTo(null), disabled: busy, children: "Cancel" }) : null
|
|
@@ -5970,14 +6026,14 @@ function ChoiceColorsEditor({
|
|
|
5970
6026
|
|
|
5971
6027
|
// src/ChoiceListEditor.tsx
|
|
5972
6028
|
var import_react37 = require("react");
|
|
5973
|
-
var
|
|
6029
|
+
var import_records11 = require("@ai-matrx/records");
|
|
5974
6030
|
var import_react38 = require("@ai-matrx/records/react");
|
|
5975
6031
|
var import_design_system20 = require("@ai-matrx/design-system");
|
|
5976
6032
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
5977
6033
|
var rowSeed = 0;
|
|
5978
6034
|
var nextRow = () => `new-${rowSeed += 1}`;
|
|
5979
6035
|
function choiceRowsFrom(options) {
|
|
5980
|
-
return inTheStoresOrder([...options]).map((option) => ({ id: option.id, words: (0,
|
|
6036
|
+
return inTheStoresOrder([...options]).map((option) => ({ id: option.id, words: (0, import_records11.optionLabel)(option), row: option.id }));
|
|
5981
6037
|
}
|
|
5982
6038
|
function choiceListPatch(start, rows) {
|
|
5983
6039
|
const kept = rows.filter((r) => r.words.trim() !== "");
|
|
@@ -6112,11 +6168,11 @@ function ChoiceListEditor({
|
|
|
6112
6168
|
"div",
|
|
6113
6169
|
{
|
|
6114
6170
|
role: "group",
|
|
6115
|
-
"aria-label": (0,
|
|
6171
|
+
"aria-label": (0, import_records11.recordsUseSentence)(heldBy(asking), asking.words.trim()),
|
|
6116
6172
|
"data-records-choice-removal-ask": "",
|
|
6117
6173
|
className: "flex flex-col gap-1 rounded border bg-muted/40 p-2",
|
|
6118
6174
|
children: [
|
|
6119
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "text-xs", children: (0,
|
|
6175
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "text-xs", children: (0, import_records11.recordsUseSentence)(heldBy(asking), asking.words.trim()) }),
|
|
6120
6176
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
6121
6177
|
targets.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
6122
6178
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_design_system20.Button, { type: "button", size: "sm", className: "h-7 px-2 text-xs", disabled: moveTo === "", onClick: () => answer({ then: "move", to: moveTo }), children: "Move them to" }),
|
|
@@ -6135,7 +6191,7 @@ function ChoiceListEditor({
|
|
|
6135
6191
|
) : null,
|
|
6136
6192
|
Object.entries(rehome).map(
|
|
6137
6193
|
([id, spec]) => removed[id] ? /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-center justify-between gap-2 text-[11px] text-muted-foreground", "data-records-choice-rehome": "", children: [
|
|
6138
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: (0,
|
|
6194
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: (0, import_records11.rehomeSentence)(usage?.[id]?.records ?? 0, removed[id].row.words.trim(), spec, spec.then === "move" ? wordsOf(spec.to) : void 0) }),
|
|
6139
6195
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_design_system20.Button, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-1.5 text-[11px]", onClick: () => putBack(id), children: "Put it back" })
|
|
6140
6196
|
] }, id) : null
|
|
6141
6197
|
),
|
|
@@ -6799,11 +6855,11 @@ function nextFieldSort(fields) {
|
|
|
6799
6855
|
}
|
|
6800
6856
|
|
|
6801
6857
|
// src/FieldEditor.tsx
|
|
6802
|
-
var
|
|
6858
|
+
var import_records12 = require("@ai-matrx/records");
|
|
6803
6859
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
6804
6860
|
var RULE_KINDS = FIELD_RULE_KIND_VALUES.map((kind) => ({ kind, label: FIELD_RULE_KIND_LABEL[kind] }));
|
|
6805
|
-
var SENSITIVITIES =
|
|
6806
|
-
var AGENT_VISIBILITY =
|
|
6861
|
+
var SENSITIVITIES = import_records12.FIELD_SENSITIVITIES.map((value) => ({ value, label: FIELD_SENSITIVITY_LABEL[value] }));
|
|
6862
|
+
var AGENT_VISIBILITY = import_records12.CONTEXT_POLICIES.map((value) => ({ value, label: CONTEXT_POLICY_LABEL[value] }));
|
|
6807
6863
|
var ROLLUP_OPERATIONS = ROLLUP_AGG_VALUES.map((value) => ({
|
|
6808
6864
|
value,
|
|
6809
6865
|
label: ROLLUP_AGG_LABEL[value]
|
|
@@ -7628,7 +7684,7 @@ function entityReferenceKindsOf(field2) {
|
|
|
7628
7684
|
|
|
7629
7685
|
// src/gridColors.tsx
|
|
7630
7686
|
var import_react41 = require("react");
|
|
7631
|
-
var
|
|
7687
|
+
var import_records13 = require("@ai-matrx/records");
|
|
7632
7688
|
var import_react42 = require("@ai-matrx/records/react");
|
|
7633
7689
|
var import_design_system23 = require("@ai-matrx/design-system");
|
|
7634
7690
|
var import_data_table7 = require("@ai-matrx/design-system/data-table");
|
|
@@ -7689,7 +7745,7 @@ function useChoiceOptions(fields, keys) {
|
|
|
7689
7745
|
function lookOf(option) {
|
|
7690
7746
|
const raw = option.data?.["color"];
|
|
7691
7747
|
const color = typeof raw === "string" && import_data_table7.STYLE_COLORS.includes(raw) ? raw : void 0;
|
|
7692
|
-
return { id: String(option.id), key: (0,
|
|
7748
|
+
return { id: String(option.id), key: (0, import_records13.optionKey)(option), label: (0, import_records13.optionLabel)(option), ...color ? { color } : {} };
|
|
7693
7749
|
}
|
|
7694
7750
|
function paintByOption(style, fields, index, lookup) {
|
|
7695
7751
|
if (index.size === 0) return { style, documentOf: (doc) => doc, choiceColorFor: lookup };
|
|
@@ -8155,7 +8211,7 @@ function RowLabelPicker({
|
|
|
8155
8211
|
// src/gridSummaries.tsx
|
|
8156
8212
|
var import_react45 = require("react");
|
|
8157
8213
|
var import_react46 = require("@ai-matrx/records/react");
|
|
8158
|
-
var
|
|
8214
|
+
var import_records14 = require("@ai-matrx/records");
|
|
8159
8215
|
var import_design_system25 = require("@ai-matrx/design-system");
|
|
8160
8216
|
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
8161
8217
|
var SUMMARY_ROW_ID = "__records_ui_summary__";
|
|
@@ -8200,7 +8256,7 @@ function useColumnSummaries(args) {
|
|
|
8200
8256
|
const out = {};
|
|
8201
8257
|
for (const [key, op2] of entries) {
|
|
8202
8258
|
const measure = op2 === "count" ? { op: "count" } : { op: op2, key };
|
|
8203
|
-
out[key] = row?.measures?.[(0,
|
|
8259
|
+
out[key] = row?.measures?.[(0, import_records14.measureKey)(measure)] ?? null;
|
|
8204
8260
|
}
|
|
8205
8261
|
setValues(out);
|
|
8206
8262
|
setRowCount(row?.row_count ?? 0);
|
|
@@ -8354,7 +8410,7 @@ function SummarySheetControls({
|
|
|
8354
8410
|
|
|
8355
8411
|
// src/pasteValues.ts
|
|
8356
8412
|
var import_core5 = require("@ai-matrx/records/core");
|
|
8357
|
-
var
|
|
8413
|
+
var import_records15 = require("@ai-matrx/records");
|
|
8358
8414
|
function wordForStoredChoice(options, value) {
|
|
8359
8415
|
if (options === void 0 || typeof value !== "string" || value === "") return null;
|
|
8360
8416
|
for (const label of options.labels) {
|
|
@@ -8367,7 +8423,7 @@ function choiceOptionsOf(options) {
|
|
|
8367
8423
|
const labels = [];
|
|
8368
8424
|
for (const option of options) {
|
|
8369
8425
|
const id = option.id;
|
|
8370
|
-
const key = (0,
|
|
8426
|
+
const key = (0, import_records15.optionKey)(option);
|
|
8371
8427
|
const label = recordName(option.data, null, "");
|
|
8372
8428
|
if (label) {
|
|
8373
8429
|
labels.push(label);
|
|
@@ -8379,7 +8435,7 @@ function choiceOptionsOf(options) {
|
|
|
8379
8435
|
return { byWord, labels };
|
|
8380
8436
|
}
|
|
8381
8437
|
function valueFromPastedText(field2, raw, options) {
|
|
8382
|
-
return (0,
|
|
8438
|
+
return (0, import_records15.coerceTypedAnswer)(field2, raw, {
|
|
8383
8439
|
label: fieldName(field2),
|
|
8384
8440
|
...options ? { options } : {}
|
|
8385
8441
|
});
|
|
@@ -9757,7 +9813,10 @@ function columnForField(field2, editing, mayWriteRow, whyNotRow, look, onAskWhoC
|
|
|
9757
9813
|
// The type is in the header's tooltip rather than a second header row: one
|
|
9758
9814
|
// row of headers, always — and it is the parity type's own WORD, not a
|
|
9759
9815
|
// token (`Long text`, never `long_text`).
|
|
9760
|
-
|
|
9816
|
+
// Top-aligned where a value may wrap to several lines; on a phone a cell never wraps (one line,
|
|
9817
|
+
// scrolled sideways) and the row is as tall as its 44 px tick box, so the value sits in the
|
|
9818
|
+
// middle beside the box — top-aligned it sat ~10 px above it (merged-grid review 2, 390 px).
|
|
9819
|
+
className: "sm:align-top max-sm:align-middle",
|
|
9761
9820
|
...{ title: fieldTypeLabel(field2) }
|
|
9762
9821
|
};
|
|
9763
9822
|
}
|
|
@@ -9787,6 +9846,12 @@ function PastePreview({
|
|
|
9787
9846
|
"aria-label": "What this paste will write",
|
|
9788
9847
|
"data-matrx-paste-preview": true,
|
|
9789
9848
|
className: "fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4",
|
|
9849
|
+
onKeyDown: (event) => {
|
|
9850
|
+
if (event.key !== "Escape") return;
|
|
9851
|
+
event.preventDefault();
|
|
9852
|
+
event.stopPropagation();
|
|
9853
|
+
if (!busy) onCancel();
|
|
9854
|
+
},
|
|
9790
9855
|
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex max-h-[80vh] w-full max-w-2xl flex-col gap-3 overflow-auto rounded-lg border bg-background p-4 shadow-lg", children: [
|
|
9791
9856
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex items-baseline justify-between gap-3", children: [
|
|
9792
9857
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("h2", { className: "text-sm font-medium", children: outcome ? "What was written" : "Before this is written" }),
|
|
@@ -9862,11 +9927,13 @@ function PastePreview({
|
|
|
9862
9927
|
". Add the columns first and paste again."
|
|
9863
9928
|
] }) : null,
|
|
9864
9929
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex items-center justify-end gap-2 pt-1", children: [
|
|
9865
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_design_system30.Button, { size: "sm", variant: "ghost", onClick: onCancel, disabled: busy, children: "Cancel" }),
|
|
9930
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_design_system30.Button, { size: "sm", variant: "ghost", onClick: onCancel, disabled: busy, autoFocus: nothingToDo, children: "Cancel" }),
|
|
9866
9931
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
9867
9932
|
import_design_system30.Button,
|
|
9868
9933
|
{
|
|
9869
9934
|
size: "sm",
|
|
9935
|
+
autoFocus: !nothingToDo,
|
|
9936
|
+
"data-matrx-paste-confirm": "",
|
|
9870
9937
|
disabled: busy || nothingToDo,
|
|
9871
9938
|
onClick: () => {
|
|
9872
9939
|
setBusy(true);
|
|
@@ -9886,7 +9953,7 @@ function Outcome({ outcome, onClose }) {
|
|
|
9886
9953
|
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
|
9887
9954
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { className: "text-sm", "data-matrx-paste-outcome": whole ? "whole" : "partial", children: whole ? `All ${outcome.readBack} ${outcome.readBack === 1 ? "value is" : "values are"} in the table \u2014 read back out of it, not just accepted.` : `${outcome.readBack} of ${outcome.readBack + outcome.missing} values are in the table. The rest are not, and nothing was lost from what you copied \u2014 it is still on your clipboard.` }),
|
|
9888
9955
|
outcome.refusals.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("ul", { className: "flex flex-col gap-1", children: outcome.refusals.slice(0, 8).map((why, index) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("li", { className: "text-xs text-muted-foreground", children: why }, index)) }) : null,
|
|
9889
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "flex justify-end pt-1", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_design_system30.Button, { size: "sm", onClick: onClose, children: "Close" }) })
|
|
9956
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "flex justify-end pt-1", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_design_system30.Button, { size: "sm", onClick: onClose, autoFocus: true, children: "Close" }) })
|
|
9890
9957
|
] });
|
|
9891
9958
|
}
|
|
9892
9959
|
function PlanTable({ plan }) {
|
|
@@ -9954,7 +10021,7 @@ function confirmLabel(plan, noun, nounPlural) {
|
|
|
9954
10021
|
// src/gridActions.tsx
|
|
9955
10022
|
var import_react54 = require("react");
|
|
9956
10023
|
var import_react55 = require("@ai-matrx/records/react");
|
|
9957
|
-
var
|
|
10024
|
+
var import_records16 = require("@ai-matrx/records");
|
|
9958
10025
|
var import_design_system31 = require("@ai-matrx/design-system");
|
|
9959
10026
|
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
9960
10027
|
var actionListeners = /* @__PURE__ */ new Map();
|
|
@@ -10047,7 +10114,7 @@ function useActionRunner(args) {
|
|
|
10047
10114
|
const answered = await client.actionRun({ action_id: action.id, record_ids: ids });
|
|
10048
10115
|
setBusy(null);
|
|
10049
10116
|
if (!answered.ok) {
|
|
10050
|
-
const refusals = (0,
|
|
10117
|
+
const refusals = (0, import_records16.actionRefusals)(answered.error);
|
|
10051
10118
|
setOutcome({
|
|
10052
10119
|
kind: "refused",
|
|
10053
10120
|
action,
|
|
@@ -11964,7 +12031,7 @@ function BulkActions({
|
|
|
11964
12031
|
// src/handOrder.tsx
|
|
11965
12032
|
var import_react70 = require("react");
|
|
11966
12033
|
var import_react71 = require("@ai-matrx/records/react");
|
|
11967
|
-
var
|
|
12034
|
+
var import_records17 = require("@ai-matrx/records");
|
|
11968
12035
|
var import_design_system39 = require("@ai-matrx/design-system");
|
|
11969
12036
|
|
|
11970
12037
|
// src/viewKeys.ts
|
|
@@ -12392,7 +12459,7 @@ function useHandOrderRows(args) {
|
|
|
12392
12459
|
const client = (0, import_react71.useRecordsClient)();
|
|
12393
12460
|
const { viewId, active, page, pageSize } = args;
|
|
12394
12461
|
const filter = args.filter && Object.keys(args.filter).length > 0 ? args.filter : null;
|
|
12395
|
-
const filterKey = filter ? (0,
|
|
12462
|
+
const filterKey = filter ? (0, import_records17.stableFilterKey)(filter) : "";
|
|
12396
12463
|
const filterNow = (0, import_react70.useRef)(filter);
|
|
12397
12464
|
filterNow.current = filter;
|
|
12398
12465
|
const [answer, setAnswer] = (0, import_react70.useState)(null);
|
|
@@ -13099,7 +13166,7 @@ function Grid({
|
|
|
13099
13166
|
tableName: table.data ? tableName(table.data) : "",
|
|
13100
13167
|
fields: fields.data ?? [],
|
|
13101
13168
|
document: row.document ?? {},
|
|
13102
|
-
level: (0,
|
|
13169
|
+
level: (0, import_records18.asPermissionLevel)(row.level)
|
|
13103
13170
|
}),
|
|
13104
13171
|
[host, tableId, table.data, fields.data]
|
|
13105
13172
|
);
|
|
@@ -16981,14 +17048,14 @@ var LOOK_WORDS = {
|
|
|
16981
17048
|
// src/ViewSwitcher.tsx
|
|
16982
17049
|
var import_react98 = require("react");
|
|
16983
17050
|
var import_react99 = require("@ai-matrx/records/react");
|
|
16984
|
-
var
|
|
17051
|
+
var import_records20 = require("@ai-matrx/records");
|
|
16985
17052
|
var import_design_system52 = require("@ai-matrx/design-system");
|
|
16986
17053
|
var import_data_table11 = require("@ai-matrx/design-system/data-table");
|
|
16987
17054
|
|
|
16988
17055
|
// src/Pipeline.tsx
|
|
16989
17056
|
var import_react96 = require("react");
|
|
16990
17057
|
var import_react97 = require("@ai-matrx/records/react");
|
|
16991
|
-
var
|
|
17058
|
+
var import_records19 = require("@ai-matrx/records");
|
|
16992
17059
|
var import_design_system51 = require("@ai-matrx/design-system");
|
|
16993
17060
|
var import_data_table10 = require("@ai-matrx/design-system/data-table");
|
|
16994
17061
|
|
|
@@ -17095,7 +17162,7 @@ function PipelineBoard({
|
|
|
17095
17162
|
alive.current = false;
|
|
17096
17163
|
};
|
|
17097
17164
|
}, []);
|
|
17098
|
-
const filterKey = (0,
|
|
17165
|
+
const filterKey = (0, import_records19.stableFilterKey)(filter);
|
|
17099
17166
|
const reload = (0, import_react96.useCallback)(async () => {
|
|
17100
17167
|
setLoading(true);
|
|
17101
17168
|
const [read, board, held] = await Promise.all([
|
|
@@ -17742,8 +17809,8 @@ function useViewRecords(view, pageSize = 200, filter, viewId) {
|
|
|
17742
17809
|
cancelled = true;
|
|
17743
17810
|
};
|
|
17744
17811
|
}, [client, ruleId, pageSize]);
|
|
17745
|
-
const asked2 = (0,
|
|
17746
|
-
const fromView = asked2 !== "{}" && (asked2 === (0,
|
|
17812
|
+
const asked2 = (0, import_records20.stableFilterKey)(filter ?? null);
|
|
17813
|
+
const fromView = asked2 !== "{}" && (asked2 === (0, import_records20.stableFilterKey)(view.where ?? null) || asked2 === (0, import_records20.stableFilterKey)(view.filters ?? null));
|
|
17747
17814
|
const tableRows = (0, import_react98.useMemo)(() => table.data?.rows ?? [], [table.data]);
|
|
17748
17815
|
const manual = view.order === "manual" && Boolean(viewId) && !ruleId;
|
|
17749
17816
|
const hand = useHandOrderRows({
|
|
@@ -18336,7 +18403,7 @@ function Card2({
|
|
|
18336
18403
|
|
|
18337
18404
|
// src/ArchivedView.tsx
|
|
18338
18405
|
var import_react100 = require("react");
|
|
18339
|
-
var
|
|
18406
|
+
var import_records21 = require("@ai-matrx/records");
|
|
18340
18407
|
var import_react101 = require("@ai-matrx/records/react");
|
|
18341
18408
|
var import_design_system53 = require("@ai-matrx/design-system");
|
|
18342
18409
|
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
@@ -18346,7 +18413,7 @@ function mayNotRestoreLine(why) {
|
|
|
18346
18413
|
return said === "" ? "Bringing a record back needs permission to edit this table. Ask somebody who has it." : said;
|
|
18347
18414
|
}
|
|
18348
18415
|
function archivedRowLine(row, titleKey) {
|
|
18349
|
-
return `${recordName(row.document, titleKey)} \u2014 ${(0,
|
|
18416
|
+
return `${recordName(row.document, titleKey)} \u2014 ${(0, import_records21.archivedByLine)(row)}`;
|
|
18350
18417
|
}
|
|
18351
18418
|
function ArchivedView({
|
|
18352
18419
|
tableId,
|
|
@@ -18360,7 +18427,7 @@ function ArchivedView({
|
|
|
18360
18427
|
const table = (0, import_react101.useTable)(tableId);
|
|
18361
18428
|
const rights = useTableRights(table.data);
|
|
18362
18429
|
const fields = (0, import_react101.useFields)(tableId);
|
|
18363
|
-
const [lane, setLane] = (0, import_react100.useState)(laneFromHost ??
|
|
18430
|
+
const [lane, setLane] = (0, import_react100.useState)(laneFromHost ?? import_records21.DEFAULT_ARCHIVE_LANE);
|
|
18364
18431
|
const [rows, setRows] = (0, import_react100.useState)([]);
|
|
18365
18432
|
const [loading, setLoading] = (0, import_react100.useState)(true);
|
|
18366
18433
|
const [error, setError] = (0, import_react100.useState)(null);
|
|
@@ -18407,15 +18474,15 @@ function ArchivedView({
|
|
|
18407
18474
|
return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: (0, import_design_system53.cn)("flex min-h-0 flex-col gap-2", className), "data-testid": "archived-view", children: [
|
|
18408
18475
|
/* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
18409
18476
|
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "text-sm font-medium", children: "Archived" }),
|
|
18410
|
-
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { className: "ml-auto flex items-center gap-0.5", role: "group", "aria-label": "Archived by", children:
|
|
18477
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { className: "ml-auto flex items-center gap-0.5", role: "group", "aria-label": "Archived by", children: import_records21.ARCHIVE_LANES.map((option) => /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
18411
18478
|
import_design_system53.Button,
|
|
18412
18479
|
{
|
|
18413
18480
|
size: "sm",
|
|
18414
18481
|
variant: option === lane ? "secondary" : "ghost",
|
|
18415
18482
|
"aria-pressed": option === lane,
|
|
18416
|
-
title:
|
|
18483
|
+
title: import_records21.ARCHIVE_LANE_MEANS[option],
|
|
18417
18484
|
onClick: () => pick(option),
|
|
18418
|
-
children:
|
|
18485
|
+
children: import_records21.ARCHIVE_LANE_LABEL[option]
|
|
18419
18486
|
},
|
|
18420
18487
|
option
|
|
18421
18488
|
)) })
|
|
@@ -18431,7 +18498,7 @@ function ArchivedView({
|
|
|
18431
18498
|
),
|
|
18432
18499
|
error ? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(RefusalNotice, { error }) : null,
|
|
18433
18500
|
loading && !error ? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_design_system53.Skeleton, { className: "h-24 w-full" }) : null,
|
|
18434
|
-
!loading && !error && rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("p", { "data-testid": "archived-empty", className: "rounded-md border border-dashed px-3 py-6 text-xs text-muted-foreground", children: (0,
|
|
18501
|
+
!loading && !error && rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("p", { "data-testid": "archived-empty", className: "rounded-md border border-dashed px-3 py-6 text-xs text-muted-foreground", children: (0, import_records21.emptyArchiveLine)(lane) }) : null,
|
|
18435
18502
|
!loading && !error && rows.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("ul", { className: "flex flex-col gap-1", "data-testid": "archived-rows", children: rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(
|
|
18436
18503
|
"li",
|
|
18437
18504
|
{
|
|
@@ -18441,7 +18508,7 @@ function ArchivedView({
|
|
|
18441
18508
|
children: [
|
|
18442
18509
|
/* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col", children: [
|
|
18443
18510
|
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "truncate text-sm", children: recordName(row.document, titleKey) }),
|
|
18444
|
-
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "truncate text-xs text-muted-foreground", "data-testid": "archived-who", children: (0,
|
|
18511
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "truncate text-xs text-muted-foreground", "data-testid": "archived-who", children: (0, import_records21.archivedByLine)(row) }),
|
|
18445
18512
|
refusal2 && refusal2.recordId === row.id ? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(RefusalNotice, { error: refusal2.error, className: "mt-2" }) : null
|
|
18446
18513
|
] }),
|
|
18447
18514
|
mayRestore ? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
@@ -18464,7 +18531,7 @@ function ArchivedView({
|
|
|
18464
18531
|
|
|
18465
18532
|
// src/ArchivedDisclosure.tsx
|
|
18466
18533
|
var import_react102 = require("react");
|
|
18467
|
-
var
|
|
18534
|
+
var import_records22 = require("@ai-matrx/records");
|
|
18468
18535
|
var import_react103 = require("@ai-matrx/records/react");
|
|
18469
18536
|
var import_design_system54 = require("@ai-matrx/design-system");
|
|
18470
18537
|
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
@@ -18564,10 +18631,10 @@ function ArchivedPortals({
|
|
|
18564
18631
|
error ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(RefusalNotice, { error }) : null,
|
|
18565
18632
|
rows === null && !error ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_design_system54.Skeleton, { className: "h-16 w-full" }) : null,
|
|
18566
18633
|
said ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("p", { className: "rounded-md border border-border px-3 py-2 text-xs", "data-testid": "archived-portal-said", children: said }) : null,
|
|
18567
|
-
rows !== null && !error && rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("p", { "data-testid": "archived-portals-empty", className: "text-xs text-muted-foreground", children: (0,
|
|
18634
|
+
rows !== null && !error && rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("p", { "data-testid": "archived-portals-empty", className: "text-xs text-muted-foreground", children: (0, import_records22.emptyPortalArchiveLine)() }) : null,
|
|
18568
18635
|
rows !== null && rows.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("ul", { className: "flex flex-col gap-1.5", "data-testid": "archived-portals", children: rows.map((portal) => {
|
|
18569
18636
|
const asking = confirming === portal.portal_id;
|
|
18570
|
-
const matches2 = (0,
|
|
18637
|
+
const matches2 = (0, import_records22.portalTitleTypedBack)(typed, portal.title);
|
|
18571
18638
|
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
18572
18639
|
"li",
|
|
18573
18640
|
{
|
|
@@ -18606,7 +18673,7 @@ function ArchivedPortals({
|
|
|
18606
18673
|
] }),
|
|
18607
18674
|
asking ? /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "flex flex-col gap-1.5", children: [
|
|
18608
18675
|
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("p", { className: "text-xs text-muted-foreground", children: [
|
|
18609
|
-
(0,
|
|
18676
|
+
(0, import_records22.portalConfirmLine)(portal.title),
|
|
18610
18677
|
" Restoring it puts it back exactly as it was: everyone who was invited can sign in again, and it shows the same Tables."
|
|
18611
18678
|
] }),
|
|
18612
18679
|
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "flex flex-wrap items-center gap-1.5", children: [
|
|
@@ -21564,7 +21631,7 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
|
|
|
21564
21631
|
// src/PortalsPanel.tsx
|
|
21565
21632
|
var import_react124 = require("react");
|
|
21566
21633
|
var import_react125 = require("@ai-matrx/records/react");
|
|
21567
|
-
var
|
|
21634
|
+
var import_records23 = require("@ai-matrx/records");
|
|
21568
21635
|
var import_design_system65 = require("@ai-matrx/design-system");
|
|
21569
21636
|
|
|
21570
21637
|
// src/BuildOrAsk.tsx
|
|
@@ -22028,7 +22095,7 @@ function PortalsPanel({ tableId, activePortalId, className }) {
|
|
|
22028
22095
|
] }) : null,
|
|
22029
22096
|
activePortalId && !shown3.some((p) => p.portal_id === activePortalId) ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("p", { className: "rounded-md border border-amber-600/40 bg-amber-500/5 px-3 py-2 text-xs leading-relaxed text-amber-700 dark:border-amber-400/40 dark:text-amber-300", children: PORTAL_NOT_HERE_LINE }) : null,
|
|
22030
22097
|
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("ul", { className: "flex flex-col gap-2", children: shown3.map((portal) => {
|
|
22031
|
-
const url = `${origin}${(0,
|
|
22098
|
+
const url = `${origin}${(0, import_records23.portalPath)(portal.slug)}`;
|
|
22032
22099
|
const open = openId === portal.portal_id;
|
|
22033
22100
|
const linked = portal.portal_id === activePortalId;
|
|
22034
22101
|
return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(
|
|
@@ -22143,8 +22210,8 @@ function ArchivePortalControl({
|
|
|
22143
22210
|
}
|
|
22144
22211
|
),
|
|
22145
22212
|
asking ? /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "mt-1.5 flex w-full flex-col gap-1.5 rounded-md border border-dashed border-border p-2.5", children: [
|
|
22146
|
-
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("p", { className: "text-xs text-muted-foreground", "data-testid": "portal-archive-consequence", children: (0,
|
|
22147
|
-
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("p", { className: "text-xs text-muted-foreground", children: (0,
|
|
22213
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("p", { className: "text-xs text-muted-foreground", "data-testid": "portal-archive-consequence", children: (0, import_records23.portalArchiveConsequence)(portal.title, portal.signed_in, portal.invited) }),
|
|
22214
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("p", { className: "text-xs text-muted-foreground", children: (0, import_records23.portalConfirmLine)(portal.title) }),
|
|
22148
22215
|
/* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "flex flex-wrap items-center gap-1.5", children: [
|
|
22149
22216
|
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
22150
22217
|
import_design_system65.BasicInput,
|
|
@@ -22162,7 +22229,7 @@ function ArchivePortalControl({
|
|
|
22162
22229
|
size: "sm",
|
|
22163
22230
|
variant: "destructive",
|
|
22164
22231
|
"data-testid": "portal-archive-do",
|
|
22165
|
-
disabled: busy || !(0,
|
|
22232
|
+
disabled: busy || !(0, import_records23.portalTitleTypedBack)(typed, portal.title),
|
|
22166
22233
|
onClick: () => void go(),
|
|
22167
22234
|
children: busy ? "Archiving\u2026" : "Archive it"
|
|
22168
22235
|
}
|
|
@@ -23321,7 +23388,7 @@ function usePublishGate() {
|
|
|
23321
23388
|
}
|
|
23322
23389
|
|
|
23323
23390
|
// src/FormBuilder.tsx
|
|
23324
|
-
var
|
|
23391
|
+
var import_records24 = require("@ai-matrx/records");
|
|
23325
23392
|
var import_design_system71 = require("@ai-matrx/design-system");
|
|
23326
23393
|
|
|
23327
23394
|
// src/FormRunner.tsx
|
|
@@ -24197,7 +24264,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, className }) {
|
|
|
24197
24264
|
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
24198
24265
|
PublishRow,
|
|
24199
24266
|
{
|
|
24200
|
-
url: `${publicOrigin}${(0,
|
|
24267
|
+
url: `${publicOrigin}${(0, import_records24.publicFormPath)(draft.id)}`,
|
|
24201
24268
|
state: draft.state,
|
|
24202
24269
|
mayPublish: rights.structure && !publishGate.blocked,
|
|
24203
24270
|
why: publishGate.why ?? rights.why("structure"),
|
|
@@ -25215,7 +25282,7 @@ function SignBlock({ tableId, recordId, render, className }) {
|
|
|
25215
25282
|
// src/ChartBlock.tsx
|
|
25216
25283
|
var import_react148 = require("react");
|
|
25217
25284
|
var import_recharts = require("recharts");
|
|
25218
|
-
var
|
|
25285
|
+
var import_records25 = require("@ai-matrx/records");
|
|
25219
25286
|
var import_core15 = require("@ai-matrx/records/core");
|
|
25220
25287
|
var import_design_system76 = require("@ai-matrx/design-system");
|
|
25221
25288
|
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
@@ -25286,7 +25353,7 @@ function ChartBlock({ block, subject, className }) {
|
|
|
25286
25353
|
const kind = block.kind;
|
|
25287
25354
|
const tableId = block.table_id ?? subject;
|
|
25288
25355
|
const measures = block.measures && block.measures.length > 0 ? block.measures : [{ op: "count" }];
|
|
25289
|
-
const primary = (0,
|
|
25356
|
+
const primary = (0, import_records25.measureKey)(measures[0]);
|
|
25290
25357
|
const windows = kind === "stuck" ? null : block.compare ?? null;
|
|
25291
25358
|
const compared = !!windows;
|
|
25292
25359
|
const grain = block.bucket?.by ?? null;
|
|
@@ -26218,7 +26285,7 @@ function TargetControl({
|
|
|
26218
26285
|
// src/FormsPanel.tsx
|
|
26219
26286
|
var import_react151 = require("react");
|
|
26220
26287
|
var import_react152 = require("@ai-matrx/records/react");
|
|
26221
|
-
var
|
|
26288
|
+
var import_records26 = require("@ai-matrx/records");
|
|
26222
26289
|
var import_design_system78 = require("@ai-matrx/design-system");
|
|
26223
26290
|
var import_jsx_runtime86 = require("react/jsx-runtime");
|
|
26224
26291
|
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.";
|
|
@@ -26322,7 +26389,7 @@ function FormsPanel({ tableId, activeFormId, className }) {
|
|
|
26322
26389
|
}
|
|
26323
26390
|
) : null,
|
|
26324
26391
|
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("ul", { className: "flex flex-col gap-2", children: forms.map((form) => {
|
|
26325
|
-
const url = `${origin}${(0,
|
|
26392
|
+
const url = `${origin}${(0, import_records26.publicFormPath)(form.form_id)}`;
|
|
26326
26393
|
return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(
|
|
26327
26394
|
"li",
|
|
26328
26395
|
{
|
|
@@ -26387,7 +26454,7 @@ function FormsPanel({ tableId, activeFormId, className }) {
|
|
|
26387
26454
|
// src/BookingBuilder.tsx
|
|
26388
26455
|
var import_react153 = require("react");
|
|
26389
26456
|
var import_react154 = require("@ai-matrx/records/react");
|
|
26390
|
-
var
|
|
26457
|
+
var import_records27 = require("@ai-matrx/records");
|
|
26391
26458
|
var import_design_system79 = require("@ai-matrx/design-system");
|
|
26392
26459
|
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
26393
26460
|
var STORE_ANSWERS_THESE = ["slot", "status", "booked_with"];
|
|
@@ -26531,7 +26598,7 @@ function BookingBuilder({ tableId, bookingId, onSaved, onClose, className }) {
|
|
|
26531
26598
|
if (!rights.structure) {
|
|
26532
26599
|
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("p", { className: (0, import_design_system79.cn)("text-xs text-muted-foreground", className), children: rights.why("structure") ?? "Making a booking page needs the admin level on this table, because it lets people with no account take time in your calendar." });
|
|
26533
26600
|
}
|
|
26534
|
-
const url = formId ? `${publicOrigin}${(0,
|
|
26601
|
+
const url = formId ? `${publicOrigin}${(0, import_records27.bookingPath)(formId)}` : null;
|
|
26535
26602
|
const shown3 = offer ?? null;
|
|
26536
26603
|
return (
|
|
26537
26604
|
// THE RAIL IS 384px WIDE AND THE VIEWPORT IS NOT (walk 1, 2026-09-21):
|
|
@@ -26733,7 +26800,7 @@ function BookingBuilder({ tableId, bookingId, onSaved, onClose, className }) {
|
|
|
26733
26800
|
// src/BookingSlots.tsx
|
|
26734
26801
|
var import_react155 = require("react");
|
|
26735
26802
|
var import_react156 = require("@ai-matrx/records/react");
|
|
26736
|
-
var
|
|
26803
|
+
var import_records28 = require("@ai-matrx/records");
|
|
26737
26804
|
var import_design_system80 = require("@ai-matrx/design-system");
|
|
26738
26805
|
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
26739
26806
|
var BOOKING_NOT_HERE_LINE = "The link named a booking page this table does not have \u2014 it may have been closed for good, or it writes into another table. The booking pages this table does have are listed here.";
|
|
@@ -26850,7 +26917,7 @@ function BookingSlots({ tableId, activeBookingId, className }) {
|
|
|
26850
26917
|
" Open the table the appointments should land in to make one."
|
|
26851
26918
|
] }) : null,
|
|
26852
26919
|
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("ul", { className: "flex flex-col gap-2", children: pages.map((page) => {
|
|
26853
|
-
const url = `${origin}${(0,
|
|
26920
|
+
const url = `${origin}${(0, import_records28.bookingPath)(page.form_id)}`;
|
|
26854
26921
|
const mayOpen = levels.data?.[page.table_id] === "admin";
|
|
26855
26922
|
const open = page.published_at !== null && page.closed_at === null;
|
|
26856
26923
|
return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(
|
|
@@ -26952,7 +27019,7 @@ var import_design_system82 = require("@ai-matrx/design-system");
|
|
|
26952
27019
|
|
|
26953
27020
|
// src/CaptureRun.tsx
|
|
26954
27021
|
var import_react157 = require("react");
|
|
26955
|
-
var
|
|
27022
|
+
var import_records29 = require("@ai-matrx/records");
|
|
26956
27023
|
var import_react158 = require("@ai-matrx/records/react");
|
|
26957
27024
|
var import_design_system81 = require("@ai-matrx/design-system");
|
|
26958
27025
|
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
@@ -27007,7 +27074,7 @@ function CaptureRun({ sheetId, face: given, className }) {
|
|
|
27007
27074
|
const [sending, setSending] = (0, import_react157.useState)(false);
|
|
27008
27075
|
const queueRef = (0, import_react157.useRef)(null);
|
|
27009
27076
|
(0, import_react157.useEffect)(() => {
|
|
27010
|
-
const q2 = (0,
|
|
27077
|
+
const q2 = (0, import_records29.openCaptureQueue)({
|
|
27011
27078
|
onChange: (c, all) => {
|
|
27012
27079
|
setCounts(c);
|
|
27013
27080
|
setItems(all);
|
|
@@ -27274,7 +27341,7 @@ function CaptureRun({ sheetId, face: given, className }) {
|
|
|
27274
27341
|
value: String(answers[q.field] ?? ""),
|
|
27275
27342
|
onChange: (e) => {
|
|
27276
27343
|
const raw = e.target.value;
|
|
27277
|
-
const answered2 = field2 ? (0,
|
|
27344
|
+
const answered2 = field2 ? (0, import_records29.coerceTypedAnswer)(field2, raw, { label: q.ask ?? (0, import_records29.coercionLabel)(field2) }) : { value: raw };
|
|
27278
27345
|
setAnswers((held) => ({
|
|
27279
27346
|
...held,
|
|
27280
27347
|
[q.field]: raw === "" ? "" : "refusal" in answered2 ? raw : answered2.value
|
|
@@ -27948,7 +28015,7 @@ function recordsDataSource(client, fallbackSchema = "custom") {
|
|
|
27948
28015
|
var import_react174 = require("react");
|
|
27949
28016
|
var import_react175 = require("@ai-matrx/records/react");
|
|
27950
28017
|
var import_core17 = require("@ai-matrx/records/core");
|
|
27951
|
-
var
|
|
28018
|
+
var import_records31 = require("@ai-matrx/records");
|
|
27952
28019
|
var import_design_system88 = require("@ai-matrx/design-system");
|
|
27953
28020
|
|
|
27954
28021
|
// src/ExampleTables.tsx
|
|
@@ -28046,7 +28113,7 @@ var import_core16 = require("@ai-matrx/records/core");
|
|
|
28046
28113
|
|
|
28047
28114
|
// src/WhereItLives.tsx
|
|
28048
28115
|
var import_react172 = require("react");
|
|
28049
|
-
var
|
|
28116
|
+
var import_records30 = require("@ai-matrx/records");
|
|
28050
28117
|
var import_react173 = require("@ai-matrx/records/react");
|
|
28051
28118
|
var import_design_system87 = require("@ai-matrx/design-system");
|
|
28052
28119
|
var import_jsx_runtime96 = require("react/jsx-runtime");
|
|
@@ -28172,7 +28239,7 @@ function WhereItLives({ tableId, knownOrganizationName, onMoved, variant = "head
|
|
|
28172
28239
|
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)(SharedNameAddress, { to: choosing, all: answer.home.destinations }),
|
|
28173
28240
|
"?"
|
|
28174
28241
|
] }),
|
|
28175
|
-
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)("p", { className: "text-muted-foreground", children: (0,
|
|
28242
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)("p", { className: "text-muted-foreground", children: (0, import_records30.moveConsequence)(answer.home, choosing) }),
|
|
28176
28243
|
said?.tone === "refused" ? /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
28177
28244
|
import_design_system87.ErrorBox,
|
|
28178
28245
|
{
|
|
@@ -28320,7 +28387,7 @@ function TablesHome({ onOpenTable, organizationName, makingOnly = false, askedBy
|
|
|
28320
28387
|
alive = false;
|
|
28321
28388
|
};
|
|
28322
28389
|
}, [client]);
|
|
28323
|
-
const listed = facts.phase === "read" ? (0,
|
|
28390
|
+
const listed = facts.phase === "read" ? (0, import_records31.withTablePlacement)(
|
|
28324
28391
|
(0, import_core17.withTableFacts)(tables.data ?? [], facts.rows, me),
|
|
28325
28392
|
facts.rows
|
|
28326
28393
|
) : tables.data ?? [];
|
|
@@ -28534,7 +28601,7 @@ function TablesHome({ onOpenTable, organizationName, makingOnly = false, askedBy
|
|
|
28534
28601
|
|
|
28535
28602
|
// src/TablePage.tsx
|
|
28536
28603
|
var import_react179 = require("react");
|
|
28537
|
-
var
|
|
28604
|
+
var import_records32 = require("@ai-matrx/records");
|
|
28538
28605
|
var import_react180 = require("@ai-matrx/records/react");
|
|
28539
28606
|
var import_design_system90 = require("@ai-matrx/design-system");
|
|
28540
28607
|
|
|
@@ -28909,7 +28976,7 @@ function TableNotHere({
|
|
|
28909
28976
|
return /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)("div", { className: (0, import_design_system90.cn)("flex flex-col items-start gap-2 rounded-md border border-dashed p-6", className), children: [
|
|
28910
28977
|
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)("p", { className: "text-sm font-medium", children: "This table is archived" }),
|
|
28911
28978
|
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)("p", { className: "max-w-prose text-xs text-muted-foreground", children: TABLE_IS_ARCHIVED }),
|
|
28912
|
-
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)("p", { className: "text-xs text-muted-foreground", children: (0,
|
|
28979
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)("p", { className: "text-xs text-muted-foreground", children: (0, import_records32.archivedByLine)(row) }),
|
|
28913
28980
|
refusal2 ? /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(RefusalNotice, { error: refusal2 }) : null,
|
|
28914
28981
|
/* @__PURE__ */ (0, import_jsx_runtime99.jsxs)("div", { className: "flex gap-2", children: [
|
|
28915
28982
|
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|