@ai-matrx/records-ui 0.116.76 → 0.116.78
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 +21 -0
- package/dist/{SaveToTable-HQREESNE.js → SaveToTable-DQXFHYHS.js} +2 -2
- package/dist/{chunk-NDYZROTI.js → chunk-5RNBIP6J.js} +75 -56
- package/dist/{chunk-NDYZROTI.js.map → chunk-5RNBIP6J.js.map} +1 -1
- package/dist/{chunk-D2FZEAYO.js → chunk-AZZA7DQ4.js} +679 -558
- package/dist/chunk-AZZA7DQ4.js.map +1 -0
- package/dist/index.cjs +6097 -5996
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +184 -203
- package/dist/index.js.map +1 -1
- package/dist/pickers.cjs +724 -599
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +1 -1
- package/package.json +6 -6
- package/dist/chunk-D2FZEAYO.js.map +0 -1
- /package/dist/{SaveToTable-HQREESNE.js.map → SaveToTable-DQXFHYHS.js.map} +0 -0
package/dist/pickers.cjs
CHANGED
|
@@ -4772,7 +4772,7 @@ module.exports = __toCommonJS(pickers_exports);
|
|
|
4772
4772
|
// src/TablePickers.tsx
|
|
4773
4773
|
var import_react78 = require("react");
|
|
4774
4774
|
var import_react79 = require("@ai-matrx/records/react");
|
|
4775
|
-
var
|
|
4775
|
+
var import_design_system47 = require("@ai-matrx/design-system");
|
|
4776
4776
|
|
|
4777
4777
|
// src/askOnce.ts
|
|
4778
4778
|
var askOnce_exports = {};
|
|
@@ -5088,7 +5088,7 @@ function AddChoicesInline({ field, onAdded, disabled = false }) {
|
|
|
5088
5088
|
var import_react74 = require("react");
|
|
5089
5089
|
var import_records28 = require("@ai-matrx/records");
|
|
5090
5090
|
var import_react75 = require("@ai-matrx/records/react");
|
|
5091
|
-
var
|
|
5091
|
+
var import_design_system46 = require("@ai-matrx/design-system");
|
|
5092
5092
|
init_dates();
|
|
5093
5093
|
|
|
5094
5094
|
// src/newerKindValues.tsx
|
|
@@ -5461,6 +5461,13 @@ var import_jsx_runtime9 = (
|
|
|
5461
5461
|
// `FieldLabel`, so the sentence does not say it a second time.
|
|
5462
5462
|
require("react/jsx-runtime")
|
|
5463
5463
|
);
|
|
5464
|
+
function linkTargetsOf(field) {
|
|
5465
|
+
const own3 = field.relation_target ? String(field.relation_target) : "";
|
|
5466
|
+
if (own3 === "") return [];
|
|
5467
|
+
const listed = field.config?.["target_tables"];
|
|
5468
|
+
if (field.config?.["target_mode"] !== "several" || !Array.isArray(listed)) return [own3];
|
|
5469
|
+
return [own3, ...listed.map(String).filter((t, i, all) => t !== own3 && all.indexOf(t) === i)];
|
|
5470
|
+
}
|
|
5464
5471
|
function withoutSelf(rows, selfId) {
|
|
5465
5472
|
return selfId ? rows.filter((row) => row.id !== selfId) : rows;
|
|
5466
5473
|
}
|
|
@@ -5484,12 +5491,18 @@ function RelationPicker({ field, value, onChange, disabled, id, className, allow
|
|
|
5484
5491
|
const [newTitle, setNewTitle] = (0, import_react10.useState)("");
|
|
5485
5492
|
const [busy, setBusy] = (0, import_react10.useState)(false);
|
|
5486
5493
|
const [createRefusal, setCreateRefusal] = (0, import_react10.useState)(null);
|
|
5494
|
+
const [tableNames, setTableNames] = (0, import_react10.useState)({});
|
|
5487
5495
|
const picked = (0, import_react10.useMemo)(
|
|
5488
5496
|
() => Array.isArray(value) ? value.map(String) : value === null || value === void 0 ? [] : [String(value)],
|
|
5489
5497
|
[value]
|
|
5490
5498
|
);
|
|
5491
5499
|
const limitView = typeof field.config?.["limit_to_view"] === "string" ? field.config["limit_to_view"] : null;
|
|
5492
5500
|
const [viewGone, setViewGone] = (0, import_react10.useState)(false);
|
|
5501
|
+
const targetsKey = linkTargetsOf(field).join(",");
|
|
5502
|
+
const targets = (0, import_react10.useMemo)(() => targetsKey === "" ? [] : targetsKey.split(","), [targetsKey]);
|
|
5503
|
+
const several = targets.length > 1;
|
|
5504
|
+
const [rowTable, setRowTable] = (0, import_react10.useState)({});
|
|
5505
|
+
const viewFilter = (0, import_react10.useRef)(void 0);
|
|
5493
5506
|
const readChoices = (0, import_react10.useCallback)(async () => {
|
|
5494
5507
|
const target2 = field.relation_target;
|
|
5495
5508
|
if (!target2 || !client) return null;
|
|
@@ -5500,8 +5513,17 @@ function RelationPicker({ field, value, onChange, disabled, id, className, allow
|
|
|
5500
5513
|
setViewGone(view === void 0);
|
|
5501
5514
|
if (view) filter = view.filters;
|
|
5502
5515
|
}
|
|
5503
|
-
|
|
5504
|
-
|
|
5516
|
+
viewFilter.current = filter;
|
|
5517
|
+
const reads = await Promise.all(
|
|
5518
|
+
targets.map((t, i) => client.list({ table_id: t, limit: 200, ...i === 0 && filter ? { filter } : {} }))
|
|
5519
|
+
);
|
|
5520
|
+
const refused = reads.find((r) => !r.ok);
|
|
5521
|
+
if (refused) return refused;
|
|
5522
|
+
const learned = {};
|
|
5523
|
+
reads.forEach((r, i) => r.ok && r.data.rows.forEach((row) => learned[row.id] = targets[i]));
|
|
5524
|
+
setRowTable((current) => ({ ...current, ...learned }));
|
|
5525
|
+
return reads.length === 1 ? reads[0] : { ok: true, data: { rows: reads.flatMap((r) => r.ok ? r.data.rows : []), total: null } };
|
|
5526
|
+
}, [client, field.relation_target, limitView, targets]);
|
|
5505
5527
|
(0, import_react10.useEffect)(() => {
|
|
5506
5528
|
let cancelled = false;
|
|
5507
5529
|
void readChoices().then((result) => {
|
|
@@ -5513,6 +5535,45 @@ function RelationPicker({ field, value, onChange, disabled, id, className, allow
|
|
|
5513
5535
|
cancelled = true;
|
|
5514
5536
|
};
|
|
5515
5537
|
}, [readChoices]);
|
|
5538
|
+
const [searchRefusal, setSearchRefusal] = (0, import_react10.useState)(null);
|
|
5539
|
+
(0, import_react10.useEffect)(() => {
|
|
5540
|
+
const q = search.trim();
|
|
5541
|
+
if (!open || q === "" || !client || targets.length === 0) {
|
|
5542
|
+
setSearchRefusal(null);
|
|
5543
|
+
return;
|
|
5544
|
+
}
|
|
5545
|
+
let cancelled = false;
|
|
5546
|
+
const timer = setTimeout(() => {
|
|
5547
|
+
void Promise.all(
|
|
5548
|
+
targets.map(
|
|
5549
|
+
(t, i) => client.listPage({ table_id: t, search: q, limit: 50, ...i === 0 && viewFilter.current ? { filter: viewFilter.current } : {} })
|
|
5550
|
+
)
|
|
5551
|
+
).then((reads) => {
|
|
5552
|
+
if (cancelled) return;
|
|
5553
|
+
const refused = reads.find((r) => !r.ok);
|
|
5554
|
+
setSearchRefusal(refused && !refused.ok ? refused.error : null);
|
|
5555
|
+
const learned = {};
|
|
5556
|
+
const foundRows = [];
|
|
5557
|
+
reads.forEach(
|
|
5558
|
+
(r, i) => r.ok && r.data.rows.forEach((row) => {
|
|
5559
|
+
learned[row.id] = targets[i];
|
|
5560
|
+
foundRows.push(row);
|
|
5561
|
+
})
|
|
5562
|
+
);
|
|
5563
|
+
if (foundRows.length === 0) return;
|
|
5564
|
+
setRowTable((current) => ({ ...current, ...learned }));
|
|
5565
|
+
setRows((current) => {
|
|
5566
|
+
const have = new Set((current ?? []).map((row) => row.id));
|
|
5567
|
+
const added = withoutSelf(foundRows, excludeId).filter((row) => !have.has(row.id));
|
|
5568
|
+
return added.length === 0 ? current : [...current ?? [], ...added];
|
|
5569
|
+
});
|
|
5570
|
+
});
|
|
5571
|
+
}, 250);
|
|
5572
|
+
return () => {
|
|
5573
|
+
cancelled = true;
|
|
5574
|
+
clearTimeout(timer);
|
|
5575
|
+
};
|
|
5576
|
+
}, [client, open, search, targets, excludeId]);
|
|
5516
5577
|
(0, import_react10.useEffect)(() => {
|
|
5517
5578
|
if (!rows || !client) return;
|
|
5518
5579
|
const wanted = [.../* @__PURE__ */ new Set([...rows.map((row) => row.id), ...picked])].filter(
|
|
@@ -5534,7 +5595,7 @@ function RelationPicker({ field, value, onChange, disabled, id, className, allow
|
|
|
5534
5595
|
};
|
|
5535
5596
|
}, [client, field.id, rows, picked, words]);
|
|
5536
5597
|
(0, import_react10.useEffect)(() => {
|
|
5537
|
-
if (!open || !allowCreate || target || targetRefusal || !client) return;
|
|
5598
|
+
if (!open || !allowCreate && !several || target || targetRefusal || !client) return;
|
|
5538
5599
|
const id2 = field.relation_target;
|
|
5539
5600
|
if (!id2) return;
|
|
5540
5601
|
let cancelled = false;
|
|
@@ -5544,6 +5605,7 @@ function RelationPicker({ field, value, onChange, disabled, id, className, allow
|
|
|
5544
5605
|
setTargetRefusal(result.error);
|
|
5545
5606
|
return;
|
|
5546
5607
|
}
|
|
5608
|
+
setTableNames(Object.fromEntries(result.data.map((t) => [t.id, (t.name ?? "").trim() || "A table"])));
|
|
5547
5609
|
const found = result.data.find((t) => t.id === id2) ?? null;
|
|
5548
5610
|
if (found) setTarget(found);
|
|
5549
5611
|
else
|
|
@@ -5557,7 +5619,7 @@ function RelationPicker({ field, value, onChange, disabled, id, className, allow
|
|
|
5557
5619
|
return () => {
|
|
5558
5620
|
cancelled = true;
|
|
5559
5621
|
};
|
|
5560
|
-
}, [client, open, allowCreate, target, targetRefusal, field.relation_target]);
|
|
5622
|
+
}, [client, open, allowCreate, several, target, targetRefusal, field.relation_target]);
|
|
5561
5623
|
if (!client) {
|
|
5562
5624
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { id, className: (0, import_design_system9.cn)("text-xs text-muted-foreground", className), children: NO_STORE_ON_THIS_SCREEN_REASON });
|
|
5563
5625
|
}
|
|
@@ -5654,7 +5716,7 @@ function RelationPicker({ field, value, onChange, disabled, id, className, allow
|
|
|
5654
5716
|
items: visible.map((row) => ({
|
|
5655
5717
|
id: row.id,
|
|
5656
5718
|
label: titleOf(row.id),
|
|
5657
|
-
detail: apart.get(row.id) ?? null,
|
|
5719
|
+
detail: apart.get(row.id) ?? (several ? tableNames[rowTable[row.id] ?? ""] ?? null : null),
|
|
5658
5720
|
picked: picked.includes(row.id),
|
|
5659
5721
|
title: apart.has(row.id) ? `${titleOf(row.id)} \u2014 ${apart.get(row.id)}` : titleOf(row.id),
|
|
5660
5722
|
attrs: { "data-relation-candidate": row.id }
|
|
@@ -5662,6 +5724,7 @@ function RelationPicker({ field, value, onChange, disabled, id, className, allow
|
|
|
5662
5724
|
onPick: toggle,
|
|
5663
5725
|
notice: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
5664
5726
|
refusal ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(RefusalLine, { error: refusal, className: "p-2" }) : null,
|
|
5727
|
+
searchRefusal ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(RefusalLine, { error: searchRefusal, className: "p-2" }) : null,
|
|
5665
5728
|
!rows && !refusal ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "p-2 text-xs text-muted-foreground", children: "Reading\u2026" }) : null,
|
|
5666
5729
|
viewGone ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "p-2 text-xs text-muted-foreground", "data-relation-view-gone": "", children: "Its view is gone, so every record is offered." }) : null,
|
|
5667
5730
|
full ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("p", { className: "p-2 text-xs text-muted-foreground", children: [
|
|
@@ -5751,7 +5814,7 @@ function readableLink(raw) {
|
|
|
5751
5814
|
|
|
5752
5815
|
// src/buttonCell.tsx
|
|
5753
5816
|
var import_react69 = require("react");
|
|
5754
|
-
var
|
|
5817
|
+
var import_design_system43 = require("@ai-matrx/design-system");
|
|
5755
5818
|
var import_data_table6 = require("@ai-matrx/design-system/data-table");
|
|
5756
5819
|
var import_records26 = require("@ai-matrx/records");
|
|
5757
5820
|
var import_react70 = require("@ai-matrx/records/react");
|
|
@@ -5806,7 +5869,7 @@ function columnNameProblemLine(name, noun = "column") {
|
|
|
5806
5869
|
var import_react67 = require("react");
|
|
5807
5870
|
var import_react68 = require("@ai-matrx/records/react");
|
|
5808
5871
|
var import_core9 = require("@ai-matrx/records/core");
|
|
5809
|
-
var
|
|
5872
|
+
var import_design_system42 = require("@ai-matrx/design-system");
|
|
5810
5873
|
|
|
5811
5874
|
// src/WatchFieldsPicker.tsx
|
|
5812
5875
|
var import_design_system10 = require("@ai-matrx/design-system");
|
|
@@ -8173,12 +8236,36 @@ var import_design_system22 = require("@ai-matrx/design-system");
|
|
|
8173
8236
|
init_host();
|
|
8174
8237
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
8175
8238
|
var answers = /* @__PURE__ */ new Map();
|
|
8239
|
+
function hostOf(url) {
|
|
8240
|
+
try {
|
|
8241
|
+
return new URL(url).hostname.replace(/^www\./, "");
|
|
8242
|
+
} catch {
|
|
8243
|
+
return url;
|
|
8244
|
+
}
|
|
8245
|
+
}
|
|
8246
|
+
function linkPreviewRecord(url, shown2) {
|
|
8247
|
+
const site = shown2.siteName?.trim() || hostOf(url);
|
|
8248
|
+
const title = shown2.title?.trim() || site;
|
|
8249
|
+
return {
|
|
8250
|
+
kind: "Link",
|
|
8251
|
+
id: url,
|
|
8252
|
+
showId: false,
|
|
8253
|
+
title,
|
|
8254
|
+
...shown2.siteName || shown2.title ? { subtitle: site } : {},
|
|
8255
|
+
avatar: { initials: site.slice(0, 1).toUpperCase(), ...shown2.faviconUrl ? { src: shown2.faviconUrl } : {} },
|
|
8256
|
+
...shown2.imageUrl ? { media: { alt: title, src: shown2.imageUrl, aspect: "16:9" } } : {},
|
|
8257
|
+
...shown2.description ? { body: [{ section: "Description", text: shown2.description, clamp: 3 }] } : {},
|
|
8258
|
+
href: url,
|
|
8259
|
+
copyData: { url, title: shown2.title, description: shown2.description, site: shown2.siteName }
|
|
8260
|
+
};
|
|
8261
|
+
}
|
|
8176
8262
|
function LinkPreviewCard({ url, children }) {
|
|
8177
8263
|
const port = useRecordsUi().linkPreview;
|
|
8178
8264
|
const [preview, setPreview] = (0, import_react34.useState)(void 0);
|
|
8179
8265
|
const [open, setOpen] = (0, import_react34.useState)(false);
|
|
8180
|
-
const
|
|
8181
|
-
(0, import_react34.
|
|
8266
|
+
const shown2 = preview && (preview.title || preview.description || preview.imageUrl) ? preview : null;
|
|
8267
|
+
const record = (0, import_react34.useMemo)(() => shown2 ? linkPreviewRecord(url, shown2) : null, [url, shown2]);
|
|
8268
|
+
(0, import_react34.useEffect)(() => setPreview(void 0), [url]);
|
|
8182
8269
|
if (!port) return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, { children });
|
|
8183
8270
|
const ask = () => {
|
|
8184
8271
|
if (preview !== void 0) return;
|
|
@@ -8189,31 +8276,23 @@ function LinkPreviewCard({ url, children }) {
|
|
|
8189
8276
|
}
|
|
8190
8277
|
void pending.then((found) => setPreview(found));
|
|
8191
8278
|
};
|
|
8192
|
-
const
|
|
8193
|
-
|
|
8194
|
-
|
|
8195
|
-
|
|
8196
|
-
|
|
8197
|
-
|
|
8198
|
-
|
|
8199
|
-
|
|
8200
|
-
|
|
8201
|
-
|
|
8202
|
-
|
|
8203
|
-
|
|
8204
|
-
|
|
8205
|
-
|
|
8206
|
-
|
|
8207
|
-
|
|
8208
|
-
|
|
8209
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex items-center gap-1.5", children: [
|
|
8210
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_design_system22.SiteIcon, { site: url, iconUrl: shown2.faviconUrl, className: "h-3.5 w-3.5" }),
|
|
8211
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "truncate text-muted-foreground", children: shown2.siteName ?? "" })
|
|
8212
|
-
] }),
|
|
8213
|
-
shown2.title ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "line-clamp-2 font-medium", children: shown2.title }) : null,
|
|
8214
|
-
shown2.description ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "line-clamp-3 text-muted-foreground", children: shown2.description }) : null
|
|
8215
|
-
] }) : null
|
|
8216
|
-
] });
|
|
8279
|
+
const chip = /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "inline-flex min-w-0 max-w-full", onMouseEnter: ask, onFocus: ask, children });
|
|
8280
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
8281
|
+
import_design_system22.PeekHoverCard,
|
|
8282
|
+
{
|
|
8283
|
+
trigger: chip,
|
|
8284
|
+
label: record?.title ?? "Link",
|
|
8285
|
+
side: "bottom",
|
|
8286
|
+
align: "start",
|
|
8287
|
+
presentation: "float",
|
|
8288
|
+
open: open && record !== null,
|
|
8289
|
+
onOpenChange: (next) => {
|
|
8290
|
+
if (next) ask();
|
|
8291
|
+
setOpen(next);
|
|
8292
|
+
},
|
|
8293
|
+
children: record ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_design_system22.Peek, { record, size: "sm" }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, {})
|
|
8294
|
+
}
|
|
8295
|
+
);
|
|
8217
8296
|
}
|
|
8218
8297
|
|
|
8219
8298
|
// src/formattedValue.tsx
|
|
@@ -11365,6 +11444,44 @@ function FieldFormatPicker({
|
|
|
11365
11444
|
|
|
11366
11445
|
// src/FieldEditor.tsx
|
|
11367
11446
|
init_names();
|
|
11447
|
+
|
|
11448
|
+
// src/AlsoPointsAt.tsx
|
|
11449
|
+
var import_design_system38 = require("@ai-matrx/design-system");
|
|
11450
|
+
init_tablePicking();
|
|
11451
|
+
init_names();
|
|
11452
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
11453
|
+
function AlsoPointsAt({ own: own3, value, onChange }) {
|
|
11454
|
+
const tables = usePickerTables();
|
|
11455
|
+
const entries = tablePickerEntries(
|
|
11456
|
+
tables.data.map((t) => ({ ...t, name: tableName(t) })),
|
|
11457
|
+
{ keep: null }
|
|
11458
|
+
).entries.filter((e) => e.id !== own3);
|
|
11459
|
+
const unseen = tables.loading ? [] : value.filter((id) => !entries.some((e) => e.id === id));
|
|
11460
|
+
const toggle = (id, on) => onChange(on ? [...value.filter((v) => v !== id), id] : value.filter((v) => v !== id));
|
|
11461
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex flex-col gap-1", "data-records-link-also-points-at": "", children: [
|
|
11462
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_design_system38.Label, { className: "text-xs", children: "Also points at" }),
|
|
11463
|
+
tables.loading && entries.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { className: "text-xs text-muted-foreground", children: "Reading tables\u2026" }) : entries.length === 0 && unseen.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { className: "text-xs text-muted-foreground", children: "No other tables yet." }) : /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex max-h-40 flex-col gap-1 overflow-y-auto", children: [
|
|
11464
|
+
entries.map((e) => /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("label", { className: "flex items-center gap-1.5 text-sm", children: [
|
|
11465
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
11466
|
+
import_design_system38.Checkbox,
|
|
11467
|
+
{
|
|
11468
|
+
checked: value.includes(e.id),
|
|
11469
|
+
"aria-label": `Also points at ${e.label}`,
|
|
11470
|
+
"data-records-also-target": e.id,
|
|
11471
|
+
onCheckedChange: (v) => toggle(e.id, v === true)
|
|
11472
|
+
}
|
|
11473
|
+
),
|
|
11474
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "truncate", children: e.label })
|
|
11475
|
+
] }, e.id)),
|
|
11476
|
+
unseen.map((id) => /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("label", { className: "flex items-center gap-1.5 text-sm", children: [
|
|
11477
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_design_system38.Checkbox, { checked: true, "aria-label": "Also points at a table you cannot open", "data-records-also-target": id, onCheckedChange: (v) => toggle(id, v === true) }),
|
|
11478
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "truncate text-muted-foreground", children: "A table you cannot open" })
|
|
11479
|
+
] }, id))
|
|
11480
|
+
] })
|
|
11481
|
+
] });
|
|
11482
|
+
}
|
|
11483
|
+
|
|
11484
|
+
// src/FieldEditor.tsx
|
|
11368
11485
|
var import_text_case7 = require("@ai-matrx/kit/text-case");
|
|
11369
11486
|
|
|
11370
11487
|
// src/archiveWords.ts
|
|
@@ -11392,33 +11509,33 @@ var import_records24 = require("@ai-matrx/records");
|
|
|
11392
11509
|
|
|
11393
11510
|
// src/ButtonSettings.tsx
|
|
11394
11511
|
var import_react65 = require("react");
|
|
11395
|
-
var
|
|
11512
|
+
var import_design_system41 = require("@ai-matrx/design-system");
|
|
11396
11513
|
var import_data_table5 = require("@ai-matrx/design-system/data-table");
|
|
11397
11514
|
var import_records23 = require("@ai-matrx/records");
|
|
11398
11515
|
var import_react66 = require("@ai-matrx/records/react");
|
|
11399
11516
|
|
|
11400
11517
|
// src/AccentSwatches.tsx
|
|
11401
11518
|
var import_records22 = require("@ai-matrx/records");
|
|
11402
|
-
var
|
|
11519
|
+
var import_design_system39 = require("@ai-matrx/design-system");
|
|
11403
11520
|
var import_data_table4 = require("@ai-matrx/design-system/data-table");
|
|
11404
|
-
var
|
|
11521
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
11405
11522
|
function AccentSwatches({ value, onChange, options = import_records22.PORTAL_ACCENTS, noneLabel = "App color" }) {
|
|
11406
|
-
return /* @__PURE__ */ (0,
|
|
11407
|
-
/* @__PURE__ */ (0,
|
|
11523
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "flex flex-wrap gap-1.5", role: "radiogroup", "aria-label": "Color", children: [
|
|
11524
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
11408
11525
|
"button",
|
|
11409
11526
|
{
|
|
11410
11527
|
type: "button",
|
|
11411
11528
|
role: "radio",
|
|
11412
11529
|
"aria-checked": value === "",
|
|
11413
11530
|
onClick: () => onChange(""),
|
|
11414
|
-
className: (0,
|
|
11531
|
+
className: (0, import_design_system39.cn)(
|
|
11415
11532
|
"h-7 rounded border px-2 text-xs",
|
|
11416
11533
|
value === "" ? "border-foreground" : "border-border text-muted-foreground"
|
|
11417
11534
|
),
|
|
11418
11535
|
children: noneLabel
|
|
11419
11536
|
}
|
|
11420
11537
|
),
|
|
11421
|
-
options.map((c) => /* @__PURE__ */ (0,
|
|
11538
|
+
options.map((c) => /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
11422
11539
|
"button",
|
|
11423
11540
|
{
|
|
11424
11541
|
type: "button",
|
|
@@ -11427,7 +11544,7 @@ function AccentSwatches({ value, onChange, options = import_records22.PORTAL_ACC
|
|
|
11427
11544
|
"aria-label": import_data_table4.STYLE_COLOR_LABELS[c],
|
|
11428
11545
|
title: import_data_table4.STYLE_COLOR_LABELS[c],
|
|
11429
11546
|
onClick: () => onChange(c),
|
|
11430
|
-
className: (0,
|
|
11547
|
+
className: (0, import_design_system39.cn)("h-7 w-7 rounded-full border-2", import_data_table4.SWATCH_CLASS[c], value === c ? "border-foreground" : "border-transparent")
|
|
11431
11548
|
},
|
|
11432
11549
|
c
|
|
11433
11550
|
))
|
|
@@ -11438,13 +11555,13 @@ function AccentSwatches({ value, onChange, options = import_records22.PORTAL_ACC
|
|
|
11438
11555
|
init_PickOne();
|
|
11439
11556
|
|
|
11440
11557
|
// src/AddRowSettings.tsx
|
|
11441
|
-
var
|
|
11558
|
+
var import_design_system40 = require("@ai-matrx/design-system");
|
|
11442
11559
|
var import_react63 = require("@ai-matrx/records/react");
|
|
11443
11560
|
var import_react64 = require("react");
|
|
11444
11561
|
init_tablePicking();
|
|
11445
11562
|
init_tablePickerEntries();
|
|
11446
11563
|
init_PickOne();
|
|
11447
|
-
var
|
|
11564
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
11448
11565
|
var THIS_ROW = "@row";
|
|
11449
11566
|
var NOTHING = "";
|
|
11450
11567
|
function prefillWith(prefill, key, from) {
|
|
@@ -11469,10 +11586,10 @@ function AddRowSettings({ value, onChange, tableId, fields }) {
|
|
|
11469
11586
|
live = false;
|
|
11470
11587
|
};
|
|
11471
11588
|
}, [client, target]);
|
|
11472
|
-
return /* @__PURE__ */ (0,
|
|
11473
|
-
/* @__PURE__ */ (0,
|
|
11474
|
-
/* @__PURE__ */ (0,
|
|
11475
|
-
/* @__PURE__ */ (0,
|
|
11589
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "flex flex-col gap-2", "data-records-button-add-row": "", children: [
|
|
11590
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
11591
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_design_system40.Label, { className: "text-xs", children: "Adds to" }),
|
|
11592
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
11476
11593
|
PickOne,
|
|
11477
11594
|
{
|
|
11478
11595
|
label: "Table the new row goes in",
|
|
@@ -11483,9 +11600,9 @@ function AddRowSettings({ value, onChange, tableId, fields }) {
|
|
|
11483
11600
|
}
|
|
11484
11601
|
)
|
|
11485
11602
|
] }),
|
|
11486
|
-
templates.length || value.template_id ? /* @__PURE__ */ (0,
|
|
11487
|
-
/* @__PURE__ */ (0,
|
|
11488
|
-
/* @__PURE__ */ (0,
|
|
11603
|
+
templates.length || value.template_id ? /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
11604
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_design_system40.Label, { className: "text-xs", children: "Starts from" }),
|
|
11605
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
11489
11606
|
PickOne,
|
|
11490
11607
|
{
|
|
11491
11608
|
label: "Row template the new row starts from",
|
|
@@ -11496,9 +11613,9 @@ function AddRowSettings({ value, onChange, tableId, fields }) {
|
|
|
11496
11613
|
}
|
|
11497
11614
|
)
|
|
11498
11615
|
] }) : null,
|
|
11499
|
-
typed.length ? /* @__PURE__ */ (0,
|
|
11500
|
-
/* @__PURE__ */ (0,
|
|
11501
|
-
/* @__PURE__ */ (0,
|
|
11616
|
+
typed.length ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "grid grid-cols-[auto_1fr] items-center gap-x-2 gap-y-1", children: typed.map((f) => /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "contents", children: [
|
|
11617
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "text-sm", children: f.label }),
|
|
11618
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
11502
11619
|
PickOne,
|
|
11503
11620
|
{
|
|
11504
11621
|
label: `${f.label} starts with`,
|
|
@@ -11516,7 +11633,7 @@ function AddRowSettings({ value, onChange, tableId, fields }) {
|
|
|
11516
11633
|
init_names();
|
|
11517
11634
|
init_Refusal();
|
|
11518
11635
|
init_parity();
|
|
11519
|
-
var
|
|
11636
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
11520
11637
|
var DOES_WORDS = {
|
|
11521
11638
|
none: "Nothing yet",
|
|
11522
11639
|
open_url: "Open a link",
|
|
@@ -11563,15 +11680,15 @@ function ButtonSettingsEditor({
|
|
|
11563
11680
|
}, [client, tableId, value.do, actions, automations]);
|
|
11564
11681
|
const set = (patch) => onChange({ ...value, ...patch });
|
|
11565
11682
|
const columns = fields.filter((f) => !(f.type === "text" && f.format === "button"));
|
|
11566
|
-
return /* @__PURE__ */ (0,
|
|
11567
|
-
/* @__PURE__ */ (0,
|
|
11568
|
-
/* @__PURE__ */ (0,
|
|
11569
|
-
/* @__PURE__ */ (0,
|
|
11570
|
-
/* @__PURE__ */ (0,
|
|
11683
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex flex-col gap-2 rounded-md border p-2", "data-records-button-settings": "", children: [
|
|
11684
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "grid gap-2 sm:grid-cols-2", children: [
|
|
11685
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
11686
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_design_system41.Label, { className: "text-xs", children: "Button label" }),
|
|
11687
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_design_system41.BasicInput, { className: "h-8 text-xs", value: value.label, "data-records-button-label": "", onChange: (e) => set({ label: e.target.value }) })
|
|
11571
11688
|
] }),
|
|
11572
|
-
/* @__PURE__ */ (0,
|
|
11573
|
-
/* @__PURE__ */ (0,
|
|
11574
|
-
/* @__PURE__ */ (0,
|
|
11689
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
11690
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_design_system41.Label, { className: "text-xs", children: "Does" }),
|
|
11691
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
11575
11692
|
PickOne,
|
|
11576
11693
|
{
|
|
11577
11694
|
label: "What a press does",
|
|
@@ -11583,9 +11700,9 @@ function ButtonSettingsEditor({
|
|
|
11583
11700
|
)
|
|
11584
11701
|
] })
|
|
11585
11702
|
] }),
|
|
11586
|
-
/* @__PURE__ */ (0,
|
|
11587
|
-
/* @__PURE__ */ (0,
|
|
11588
|
-
/* @__PURE__ */ (0,
|
|
11703
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
11704
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_design_system41.Label, { className: "text-xs", children: "Color" }),
|
|
11705
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
11589
11706
|
AccentSwatches,
|
|
11590
11707
|
{
|
|
11591
11708
|
value: value.color ?? "",
|
|
@@ -11595,11 +11712,11 @@ function ButtonSettingsEditor({
|
|
|
11595
11712
|
}
|
|
11596
11713
|
)
|
|
11597
11714
|
] }),
|
|
11598
|
-
value.do === "open_url" ? /* @__PURE__ */ (0,
|
|
11599
|
-
/* @__PURE__ */ (0,
|
|
11600
|
-
/* @__PURE__ */ (0,
|
|
11601
|
-
/* @__PURE__ */ (0,
|
|
11602
|
-
|
|
11715
|
+
value.do === "open_url" ? /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
11716
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_design_system41.Label, { className: "text-xs", children: "Link" }),
|
|
11717
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex gap-1", children: [
|
|
11718
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
11719
|
+
import_design_system41.BasicInput,
|
|
11603
11720
|
{
|
|
11604
11721
|
className: "h-8 flex-1 font-mono text-xs",
|
|
11605
11722
|
placeholder: "https://",
|
|
@@ -11608,7 +11725,7 @@ function ButtonSettingsEditor({
|
|
|
11608
11725
|
onChange: (e) => set({ url: e.target.value })
|
|
11609
11726
|
}
|
|
11610
11727
|
),
|
|
11611
|
-
columns.length > 0 ? /* @__PURE__ */ (0,
|
|
11728
|
+
columns.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
11612
11729
|
PickOne,
|
|
11613
11730
|
{
|
|
11614
11731
|
label: "Add a column's value",
|
|
@@ -11621,11 +11738,11 @@ function ButtonSettingsEditor({
|
|
|
11621
11738
|
}
|
|
11622
11739
|
) : null
|
|
11623
11740
|
] }),
|
|
11624
|
-
value.url && (0, import_records23.buttonUrlPlaceholders)(value.url).length > 0 ? /* @__PURE__ */ (0,
|
|
11741
|
+
value.url && (0, import_records23.buttonUrlPlaceholders)(value.url).length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("p", { className: "truncate text-[11px] text-muted-foreground", "data-records-button-url-words": "", children: buttonUrlInWords(value.url, fields) }) : null
|
|
11625
11742
|
] }) : null,
|
|
11626
|
-
value.do === "add_row" ? /* @__PURE__ */ (0,
|
|
11627
|
-
value.do === "run_action" ? !tableId ? /* @__PURE__ */ (0,
|
|
11628
|
-
actions === null || actions.length > 0 ? /* @__PURE__ */ (0,
|
|
11743
|
+
value.do === "add_row" ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(AddRowSettings, { value, onChange, tableId, fields }) : null,
|
|
11744
|
+
value.do === "run_action" ? !tableId ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("p", { className: "text-xs text-muted-foreground", children: "Row actions belong to a table" }) : actionsRefused ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(RefusalLine, { error: actionsRefused }) : /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex flex-col gap-2", "data-records-button-action": "", children: [
|
|
11745
|
+
actions === null || actions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
11629
11746
|
PickOne,
|
|
11630
11747
|
{
|
|
11631
11748
|
label: "Row action",
|
|
@@ -11636,7 +11753,7 @@ function ButtonSettingsEditor({
|
|
|
11636
11753
|
options: (actions ?? []).map((a) => ({ value: a.id, label: a.name }))
|
|
11637
11754
|
}
|
|
11638
11755
|
) : null,
|
|
11639
|
-
actions !== null ? /* @__PURE__ */ (0,
|
|
11756
|
+
actions !== null ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
11640
11757
|
NewRowAction,
|
|
11641
11758
|
{
|
|
11642
11759
|
tableId,
|
|
@@ -11650,7 +11767,7 @@ function ButtonSettingsEditor({
|
|
|
11650
11767
|
}
|
|
11651
11768
|
) : null
|
|
11652
11769
|
] }) : null,
|
|
11653
|
-
value.do === "run_automation" ? automations && automations.length === 0 ? /* @__PURE__ */ (0,
|
|
11770
|
+
value.do === "run_automation" ? automations && automations.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("p", { className: "text-xs text-muted-foreground", children: "No automations yet. Add one in Table \u22EF \u2192 Automations." }) : /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
11654
11771
|
PickOne,
|
|
11655
11772
|
{
|
|
11656
11773
|
label: "Automation",
|
|
@@ -11681,7 +11798,7 @@ function NewRowAction({
|
|
|
11681
11798
|
const [setTo, setSetTo] = (0, import_react65.useState)("");
|
|
11682
11799
|
const [busy, setBusy] = (0, import_react65.useState)(false);
|
|
11683
11800
|
const [refused, setRefused] = (0, import_react65.useState)(null);
|
|
11684
|
-
if (settable.length === 0) return /* @__PURE__ */ (0,
|
|
11801
|
+
if (settable.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("p", { className: "text-xs text-muted-foreground", children: "No column to set" });
|
|
11685
11802
|
const make = async () => {
|
|
11686
11803
|
if (!client || fieldId === "") return;
|
|
11687
11804
|
setBusy(true);
|
|
@@ -11705,10 +11822,10 @@ function NewRowAction({
|
|
|
11705
11822
|
if (!made?.id) return setRefused({ code: "internal", message: "The row action was saved but could not be read back.", hint: "Reopen this column's settings and pick it from the list." });
|
|
11706
11823
|
onMade(made.id, all);
|
|
11707
11824
|
};
|
|
11708
|
-
return /* @__PURE__ */ (0,
|
|
11709
|
-
/* @__PURE__ */ (0,
|
|
11710
|
-
/* @__PURE__ */ (0,
|
|
11711
|
-
/* @__PURE__ */ (0,
|
|
11825
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex flex-col gap-1", "data-records-button-new-action": "", children: [
|
|
11826
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_design_system41.Label, { className: "text-xs", children: "New row action" }),
|
|
11827
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
11828
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
11712
11829
|
PickOne,
|
|
11713
11830
|
{
|
|
11714
11831
|
label: "Column to set",
|
|
@@ -11720,10 +11837,10 @@ function NewRowAction({
|
|
|
11720
11837
|
options: settable.map((f) => ({ value: f.id, label: fieldName(f) }))
|
|
11721
11838
|
}
|
|
11722
11839
|
),
|
|
11723
|
-
/* @__PURE__ */ (0,
|
|
11724
|
-
/* @__PURE__ */ (0,
|
|
11840
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_design_system41.BasicInput, { className: "h-8 w-32 text-xs", placeholder: "Value", "aria-label": "Value", "data-records-button-action-value": "", value: setTo, onChange: (e) => setSetTo(e.target.value) }),
|
|
11841
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_design_system41.Button, { type: "button", size: "sm", variant: "outline", disabled: busy || fieldId === "", "data-records-button-action-make": "", onClick: () => void make(), children: busy ? "Making\u2026" : "Make" })
|
|
11725
11842
|
] }),
|
|
11726
|
-
refused ? /* @__PURE__ */ (0,
|
|
11843
|
+
refused ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(RefusalLine, { error: refused }) : null
|
|
11727
11844
|
] });
|
|
11728
11845
|
}
|
|
11729
11846
|
|
|
@@ -11748,7 +11865,7 @@ var ADDABLE_TYPES = STANDARD_TABLE_FIELD_CHOICES.map((choice) => ({
|
|
|
11748
11865
|
}));
|
|
11749
11866
|
|
|
11750
11867
|
// src/FieldEditor.tsx
|
|
11751
|
-
var
|
|
11868
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
11752
11869
|
var RULE_KINDS = FIELD_RULE_KIND_VALUES.map((kind) => ({ kind, label: FIELD_RULE_KIND_LABEL[kind] }));
|
|
11753
11870
|
var SENSITIVITIES = import_records25.FIELD_SENSITIVITIES.map((value) => ({ value, label: FIELD_SENSITIVITY_LABEL[value] }));
|
|
11754
11871
|
var AGENT_VISIBILITY = import_records25.CONTEXT_POLICIES.map((value) => ({ value, label: CONTEXT_POLICY_LABEL[value] }));
|
|
@@ -11891,6 +12008,12 @@ function FieldEditor(props) {
|
|
|
11891
12008
|
const loopsStart = start?.config?.["loops"] === true;
|
|
11892
12009
|
const [loops, setLoops] = (0, import_react67.useState)(loopsStart);
|
|
11893
12010
|
const [targetViews, setTargetViews] = (0, import_react67.useState)(null);
|
|
12011
|
+
const alsoStart = (0, import_react67.useMemo)(() => {
|
|
12012
|
+
const listed = start?.config?.["target_tables"];
|
|
12013
|
+
const own3 = String(start?.relation_target ?? "");
|
|
12014
|
+
return start?.config?.["target_mode"] === "several" && Array.isArray(listed) ? listed.map(String).filter((t) => t !== own3) : [];
|
|
12015
|
+
}, [start]);
|
|
12016
|
+
const [alsoTargets, setAlsoTargets] = (0, import_react67.useState)(alsoStart);
|
|
11894
12017
|
const limitTarget = field?.type === "relation" && field.relation_target && !onEntity ? String(field.relation_target) : null;
|
|
11895
12018
|
(0, import_react67.useEffect)(() => {
|
|
11896
12019
|
if (!limitTarget) return;
|
|
@@ -12036,7 +12159,7 @@ function FieldEditor(props) {
|
|
|
12036
12159
|
const offersMany = multiApplies(type) && !isTitle;
|
|
12037
12160
|
if (!mayShape) {
|
|
12038
12161
|
if (onEntity && entityRights.loading) return null;
|
|
12039
|
-
return /* @__PURE__ */ (0,
|
|
12162
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: (0, import_design_system42.cn)("text-xs text-muted-foreground", className), children: props.tableLabel && storeLabel && whyNot ? whyNot.split(storeLabel).join(props.tableLabel) : whyNot });
|
|
12040
12163
|
}
|
|
12041
12164
|
const options = newChoices.map((r) => r.words.trim()).filter((word) => word !== "");
|
|
12042
12165
|
const shownStatusRows = type !== "status" ? [] : statusGroupRows(field, editing ? choiceList ?? [] : newChoices, statusKeys, statusGroups);
|
|
@@ -12099,6 +12222,7 @@ function FieldEditor(props) {
|
|
|
12099
12222
|
...field.type === "relation" && carries !== carriesStart ? { carries } : {},
|
|
12100
12223
|
...field.type === "relation" && carries && carriesMax !== carriesMaxStart ? { carries_max: carriesMax } : {},
|
|
12101
12224
|
...field.type === "relation" && loops !== loopsStart ? { loops } : {},
|
|
12225
|
+
...field.type === "relation" && limitTarget && [...alsoTargets].sort().join(",") !== [...alsoStart].sort().join(",") ? { target_tables: alsoTargets.length === 0 ? null : alsoTargets } : {},
|
|
12102
12226
|
...type === "modified_time" ? watchedFieldsPatch(watchStart, watchFields) : {},
|
|
12103
12227
|
...type === "autonumber" && numberPrefix.trim() !== prefixStart ? { display_format: { id: "autonumber", options: numberPrefix.trim() === "" ? {} : { prefix: numberPrefix.trim() } } } : {},
|
|
12104
12228
|
// THE CHOICES, ONE ROW EACH, IN ORDER (CHOICE-COLUMN-EDIT): `{id, words}` re-words a
|
|
@@ -12259,16 +12383,16 @@ function FieldEditor(props) {
|
|
|
12259
12383
|
if (gone) (onRemoved ?? onSaved)?.();
|
|
12260
12384
|
else setAskingToRemove(false);
|
|
12261
12385
|
};
|
|
12262
|
-
return /* @__PURE__ */ (0,
|
|
12263
|
-
/* @__PURE__ */ (0,
|
|
12264
|
-
/* @__PURE__ */ (0,
|
|
12265
|
-
/* @__PURE__ */ (0,
|
|
12386
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: (0, import_design_system42.cn)("flex min-w-0 flex-col gap-3 text-xs", className), "data-records-field-editor": "", children: [
|
|
12387
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
12388
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "font-medium", children: field ? `Field \xB7 ${fieldName(field)}` : "New field" }),
|
|
12389
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "ml-auto text-muted-foreground", children: tableLabel })
|
|
12266
12390
|
] }),
|
|
12267
|
-
/* @__PURE__ */ (0,
|
|
12268
|
-
/* @__PURE__ */ (0,
|
|
12269
|
-
/* @__PURE__ */ (0,
|
|
12270
|
-
/* @__PURE__ */ (0,
|
|
12271
|
-
|
|
12391
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "grid gap-3 sm:grid-cols-2", children: [
|
|
12392
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
12393
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.Label, { className: "text-xs", children: "Name" }),
|
|
12394
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
12395
|
+
import_design_system42.BasicInput,
|
|
12272
12396
|
{
|
|
12273
12397
|
value: label,
|
|
12274
12398
|
autoFocus: true,
|
|
@@ -12283,7 +12407,7 @@ function FieldEditor(props) {
|
|
|
12283
12407
|
...nameLine ? { "aria-invalid": true, "aria-describedby": "field-editor-name-taken" } : {}
|
|
12284
12408
|
}
|
|
12285
12409
|
),
|
|
12286
|
-
nameLine ? /* @__PURE__ */ (0,
|
|
12410
|
+
nameLine ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
12287
12411
|
"span",
|
|
12288
12412
|
{
|
|
12289
12413
|
id: "field-editor-name-taken",
|
|
@@ -12294,10 +12418,10 @@ function FieldEditor(props) {
|
|
|
12294
12418
|
}
|
|
12295
12419
|
) : null
|
|
12296
12420
|
] }),
|
|
12297
|
-
field ? /* @__PURE__ */ (0,
|
|
12298
|
-
/* @__PURE__ */ (0,
|
|
12299
|
-
/* @__PURE__ */ (0,
|
|
12300
|
-
|
|
12421
|
+
field ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex flex-col gap-1 sm:col-span-2", children: [
|
|
12422
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.Label, { className: "text-xs", children: "Help text" }),
|
|
12423
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
12424
|
+
import_design_system42.BasicInput,
|
|
12301
12425
|
{
|
|
12302
12426
|
value: description,
|
|
12303
12427
|
maxLength: 300,
|
|
@@ -12307,30 +12431,30 @@ function FieldEditor(props) {
|
|
|
12307
12431
|
}
|
|
12308
12432
|
)
|
|
12309
12433
|
] }) : null,
|
|
12310
|
-
/* @__PURE__ */ (0,
|
|
12311
|
-
/* @__PURE__ */ (0,
|
|
12312
|
-
/* @__PURE__ */ (0,
|
|
12313
|
-
|
|
12434
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
12435
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.Label, { className: "text-xs", children: "What it holds" }),
|
|
12436
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
|
|
12437
|
+
import_design_system42.Select,
|
|
12314
12438
|
{
|
|
12315
12439
|
value: type,
|
|
12316
12440
|
disabled: editing,
|
|
12317
12441
|
onValueChange: (next) => setType(next),
|
|
12318
12442
|
children: [
|
|
12319
|
-
/* @__PURE__ */ (0,
|
|
12320
|
-
/* @__PURE__ */ (0,
|
|
12321
|
-
/* @__PURE__ */ (0,
|
|
12322
|
-
FIELD_TYPE_CATALOGUE.filter((c) => c.group === group && (c.id === type || offered.includes(c))).map((c) => /* @__PURE__ */ (0,
|
|
12443
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.SelectTrigger, { size: "sm", "aria-label": "What this field holds", ...choice?.explanation ? { title: choice.explanation } : {}, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.SelectValue, {}) }),
|
|
12444
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.SelectContent, { children: FIELD_TYPE_GROUPS.filter((group) => offered.some((c) => c.group === group)).map((group) => /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_design_system42.SelectGroup, { children: [
|
|
12445
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.SelectLabel, { children: group }),
|
|
12446
|
+
FIELD_TYPE_CATALOGUE.filter((c) => c.group === group && (c.id === type || offered.includes(c))).map((c) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.SelectItem, { value: c.id, children: c.label }, c.id))
|
|
12323
12447
|
] }, group)) })
|
|
12324
12448
|
]
|
|
12325
12449
|
}
|
|
12326
12450
|
),
|
|
12327
|
-
editing && field ? /* @__PURE__ */ (0,
|
|
12451
|
+
editing && field ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(FieldRetype, { field: liveField ?? field, tableId }) : null
|
|
12328
12452
|
] })
|
|
12329
12453
|
] }),
|
|
12330
|
-
type === "formula" && others.length > 0 ? /* @__PURE__ */ (0,
|
|
12331
|
-
editing ? startingFormulaText.trim() === "" ? /* @__PURE__ */ (0,
|
|
12332
|
-
/* @__PURE__ */ (0,
|
|
12333
|
-
|
|
12454
|
+
type === "formula" && others.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
12455
|
+
editing ? startingFormulaText.trim() === "" ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "text-[11px] text-muted-foreground", children: EDITING_A_WORKED_OUT_COLUMN }) : null : /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex items-center gap-1", role: "group", "aria-label": "How to make this column", children: [
|
|
12456
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
12457
|
+
import_design_system42.Button,
|
|
12334
12458
|
{
|
|
12335
12459
|
type: "button",
|
|
12336
12460
|
size: "sm",
|
|
@@ -12340,8 +12464,8 @@ function FieldEditor(props) {
|
|
|
12340
12464
|
children: "Pick the columns"
|
|
12341
12465
|
}
|
|
12342
12466
|
),
|
|
12343
|
-
/* @__PURE__ */ (0,
|
|
12344
|
-
|
|
12467
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
12468
|
+
import_design_system42.Button,
|
|
12345
12469
|
{
|
|
12346
12470
|
type: "button",
|
|
12347
12471
|
size: "sm",
|
|
@@ -12352,7 +12476,7 @@ function FieldEditor(props) {
|
|
|
12352
12476
|
}
|
|
12353
12477
|
)
|
|
12354
12478
|
] }),
|
|
12355
|
-
formulaWritten ? /* @__PURE__ */ (0,
|
|
12479
|
+
formulaWritten ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
12356
12480
|
FormulaTextEditor,
|
|
12357
12481
|
{
|
|
12358
12482
|
tableId,
|
|
@@ -12362,9 +12486,9 @@ function FieldEditor(props) {
|
|
|
12362
12486
|
columns: others
|
|
12363
12487
|
}
|
|
12364
12488
|
) : null
|
|
12365
|
-
] }) : editing && type === "formula" ? /* @__PURE__ */ (0,
|
|
12366
|
-
editing && field && !onEntity && (type === "lookup" || type === "rollup") ? /* @__PURE__ */ (0,
|
|
12367
|
-
!editing && !(type === "formula" && formulaWritten) || type === "select" || type === "multi_select" || type === "status" || type === "rating" || type === "barcode" || type === "relation" || type === "entity_reference" ? /* @__PURE__ */ (0,
|
|
12489
|
+
] }) : editing && type === "formula" ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No other column to read." }) : null,
|
|
12490
|
+
editing && field && !onEntity && (type === "lookup" || type === "rollup") ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(SourceArchivedNotice, { fieldId: field.id, tableId }) : null,
|
|
12491
|
+
!editing && !(type === "formula" && formulaWritten) || type === "select" || type === "multi_select" || type === "status" || type === "rating" || type === "barcode" || type === "relation" || type === "entity_reference" ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
12368
12492
|
TypeQuestions,
|
|
12369
12493
|
{
|
|
12370
12494
|
type,
|
|
@@ -12394,7 +12518,7 @@ function FieldEditor(props) {
|
|
|
12394
12518
|
setFormulaSeparator,
|
|
12395
12519
|
relations: sourcesFor(type),
|
|
12396
12520
|
others,
|
|
12397
|
-
choiceList: editing && field ? /* @__PURE__ */ (0,
|
|
12521
|
+
choiceList: editing && field ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
12398
12522
|
ChoiceListEditor,
|
|
12399
12523
|
{
|
|
12400
12524
|
field,
|
|
@@ -12405,10 +12529,10 @@ function FieldEditor(props) {
|
|
|
12405
12529
|
rehome,
|
|
12406
12530
|
onRehome: setRehome
|
|
12407
12531
|
}
|
|
12408
|
-
) : /* @__PURE__ */ (0,
|
|
12532
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(ChoiceListEditor, { isNew: true, rows: newChoices, onRows: setNewChoices }),
|
|
12409
12533
|
allowedTypes,
|
|
12410
12534
|
setAllowedTypes,
|
|
12411
|
-
newer: type === "rating" ? /* @__PURE__ */ (0,
|
|
12535
|
+
newer: type === "rating" ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
12412
12536
|
RatingMaxQuestion,
|
|
12413
12537
|
{
|
|
12414
12538
|
value: ratingMax,
|
|
@@ -12416,65 +12540,66 @@ function FieldEditor(props) {
|
|
|
12416
12540
|
setRatingMax(next);
|
|
12417
12541
|
}
|
|
12418
12542
|
}
|
|
12419
|
-
) : type === "status" ? /* @__PURE__ */ (0,
|
|
12543
|
+
) : type === "status" ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(StatusGroupsQuestion, { rows: shownStatusRows, onGroup: (ref, next) => setStatusGroups({ ...statusGroups, [ref]: next }) }) : type === "barcode" ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(BarcodeSymbologyQuestion, { value: symbology, onChange: setSymbology }) : null
|
|
12420
12544
|
}
|
|
12421
12545
|
) : null,
|
|
12422
|
-
type === "button" ? /* @__PURE__ */ (0,
|
|
12423
|
-
type === "modified_time" ? /* @__PURE__ */ (0,
|
|
12424
|
-
type === "autonumber" ? /* @__PURE__ */ (0,
|
|
12425
|
-
/* @__PURE__ */ (0,
|
|
12426
|
-
/* @__PURE__ */ (0,
|
|
12546
|
+
type === "button" ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(ButtonSettingsEditor, { value: buttonSettings, onChange: setButtonSettings, tableId: onEntity ? null : tableId, fields: others }) : null,
|
|
12547
|
+
type === "modified_time" ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(WatchFieldsPicker, { fields: others, value: watchFields, onChange: setWatchFields }) : null,
|
|
12548
|
+
type === "autonumber" ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex max-w-[16rem] flex-col gap-1", children: [
|
|
12549
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.Label, { className: "text-xs", children: "Prefix" }),
|
|
12550
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.BasicInput, { className: "h-8 text-xs", placeholder: "TASK-", maxLength: 16, "data-records-autonumber-prefix": "", value: numberPrefix, onChange: (e) => setNumberPrefix(e.target.value) })
|
|
12427
12551
|
] }) : null,
|
|
12428
|
-
editing && field?.type === "relation" && field.relation_target && field.relation_target === field.entity_definition_id ? /* @__PURE__ */ (0,
|
|
12429
|
-
/* @__PURE__ */ (0,
|
|
12430
|
-
/* @__PURE__ */ (0,
|
|
12552
|
+
editing && field?.type === "relation" && field.relation_target && field.relation_target === field.entity_definition_id ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex items-center gap-1.5 text-sm", title: "A timeline draws a line to each record this one waits on", children: [
|
|
12553
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.Checkbox, { checked: dependency, "aria-label": "Waits on the linked records", "data-records-dependency": "", onCheckedChange: (v) => setDependency(v === true) }),
|
|
12554
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { children: "Waits on the linked records" })
|
|
12431
12555
|
] }) : null,
|
|
12432
|
-
editing && limitTarget ? /* @__PURE__ */ (0,
|
|
12433
|
-
/* @__PURE__ */ (0,
|
|
12434
|
-
/* @__PURE__ */ (0,
|
|
12435
|
-
/* @__PURE__ */ (0,
|
|
12436
|
-
/* @__PURE__ */ (0,
|
|
12437
|
-
/* @__PURE__ */ (0,
|
|
12438
|
-
(targetViews ?? []).map((v) => /* @__PURE__ */ (0,
|
|
12439
|
-
limitView !== "" && targetViews !== null && !targetViews.some((v) => v.id === limitView) ? /* @__PURE__ */ (0,
|
|
12556
|
+
editing && limitTarget ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-col gap-1", "data-records-limit-to-view": "", children: [
|
|
12557
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.Label, { className: "text-xs", children: "Choices come from" }),
|
|
12558
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_design_system42.Select, { value: limitView === "" ? "__all" : limitView, onValueChange: (next) => setLimitView(next === "__all" ? "" : next), disabled: targetViews === null, children: [
|
|
12559
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.SelectTrigger, { size: "sm", "aria-label": "Limit the choices to a view", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.SelectValue, {}) }),
|
|
12560
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_design_system42.SelectContent, { children: [
|
|
12561
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.SelectItem, { value: "__all", children: "Every record" }),
|
|
12562
|
+
(targetViews ?? []).map((v) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.SelectItem, { value: v.id, children: v.name }, v.id)),
|
|
12563
|
+
limitView !== "" && targetViews !== null && !targetViews.some((v) => v.id === limitView) ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.SelectItem, { value: limitView, children: "A view that is gone" }) : null
|
|
12440
12564
|
] })
|
|
12441
12565
|
] })
|
|
12442
12566
|
] }) : null,
|
|
12443
|
-
editing &&
|
|
12444
|
-
|
|
12445
|
-
/* @__PURE__ */ (0,
|
|
12446
|
-
|
|
12447
|
-
/* @__PURE__ */ (0,
|
|
12448
|
-
|
|
12449
|
-
/* @__PURE__ */ (0,
|
|
12567
|
+
editing && limitTarget ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(AlsoPointsAt, { own: limitTarget, value: alsoTargets, onChange: setAlsoTargets }) : null,
|
|
12568
|
+
editing && field?.type === "relation" ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-col gap-1", "data-records-link-binding": "", children: [
|
|
12569
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.Label, { className: "text-xs", children: "When a linked record changes" }),
|
|
12570
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_design_system42.Select, { value: binding, onValueChange: (next) => setBinding(next === "snapshot" ? "snapshot" : "live"), children: [
|
|
12571
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.SelectTrigger, { size: "sm", "aria-label": "When a linked record changes", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.SelectValue, {}) }),
|
|
12572
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_design_system42.SelectContent, { children: [
|
|
12573
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.SelectItem, { value: "live", children: "Show its changes" }),
|
|
12574
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.SelectItem, { value: "snapshot", children: "Keep it as it was when linked" })
|
|
12450
12575
|
] })
|
|
12451
12576
|
] })
|
|
12452
12577
|
] }) : null,
|
|
12453
|
-
editing && field?.type === "relation" ? /* @__PURE__ */ (0,
|
|
12454
|
-
/* @__PURE__ */ (0,
|
|
12455
|
-
/* @__PURE__ */ (0,
|
|
12456
|
-
/* @__PURE__ */ (0,
|
|
12578
|
+
editing && field?.type === "relation" ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-col gap-1.5", "data-records-link-carries": "", children: [
|
|
12579
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex items-center gap-1.5 text-sm", title: "Whoever can see a linked record can also see this one", children: [
|
|
12580
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.Checkbox, { checked: carries, "aria-label": "Carries access", onCheckedChange: (v) => setCarries(v === true) }),
|
|
12581
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { children: "Whoever sees a linked record sees this one" })
|
|
12457
12582
|
] }),
|
|
12458
|
-
carries ? /* @__PURE__ */ (0,
|
|
12459
|
-
/* @__PURE__ */ (0,
|
|
12460
|
-
/* @__PURE__ */ (0,
|
|
12461
|
-
/* @__PURE__ */ (0,
|
|
12462
|
-
/* @__PURE__ */ (0,
|
|
12583
|
+
carries ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_design_system42.Select, { value: carriesMax, onValueChange: (next) => setCarriesMax(next === "editor" ? "editor" : "viewer"), children: [
|
|
12584
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.SelectTrigger, { size: "sm", "aria-label": "Carried access level", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.SelectValue, {}) }),
|
|
12585
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_design_system42.SelectContent, { children: [
|
|
12586
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.SelectItem, { value: "viewer", children: "Up to view" }),
|
|
12587
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.SelectItem, { value: "editor", children: "Up to edit" })
|
|
12463
12588
|
] })
|
|
12464
12589
|
] }) : null,
|
|
12465
|
-
field.relation_target && field.relation_target === field.entity_definition_id ? /* @__PURE__ */ (0,
|
|
12466
|
-
/* @__PURE__ */ (0,
|
|
12467
|
-
/* @__PURE__ */ (0,
|
|
12590
|
+
field.relation_target && field.relation_target === field.entity_definition_id ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex items-center gap-1.5 text-sm", title: "Two records may point at each other along this link", children: [
|
|
12591
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.Checkbox, { checked: loops, "aria-label": "Two records can link each other", onCheckedChange: (v) => setLoops(v === true) }),
|
|
12592
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { children: "Two records can link each other" })
|
|
12468
12593
|
] }) : null,
|
|
12469
|
-
carries && loops ? /* @__PURE__ */ (0,
|
|
12594
|
+
carries && loops ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("p", { className: "text-xs text-muted-foreground", "data-records-loop-consequence": "", children: [
|
|
12470
12595
|
"Sharing one record shares the records it links to, and back again, ",
|
|
12471
12596
|
carriesMax === "editor" ? "up to edit" : "view only",
|
|
12472
12597
|
"."
|
|
12473
12598
|
] }) : null
|
|
12474
12599
|
] }) : null,
|
|
12475
|
-
personColumn ? /* @__PURE__ */ (0,
|
|
12476
|
-
/* @__PURE__ */ (0,
|
|
12477
|
-
|
|
12600
|
+
personColumn ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex items-center gap-1.5 text-sm", title: "Each person added to this column gets a notice", children: [
|
|
12601
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
12602
|
+
import_design_system42.Checkbox,
|
|
12478
12603
|
{
|
|
12479
12604
|
checked: notify,
|
|
12480
12605
|
disabled: notifyStart === null,
|
|
@@ -12483,10 +12608,10 @@ function FieldEditor(props) {
|
|
|
12483
12608
|
onCheckedChange: (v) => setNotify(v === true)
|
|
12484
12609
|
}
|
|
12485
12610
|
),
|
|
12486
|
-
/* @__PURE__ */ (0,
|
|
12611
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { children: "Notify people when they're added" })
|
|
12487
12612
|
] }) : null,
|
|
12488
|
-
notifyReadError ? /* @__PURE__ */ (0,
|
|
12489
|
-
type === "rollup" ? /* @__PURE__ */ (0,
|
|
12613
|
+
notifyReadError ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(RefusalNotice, { error: notifyReadError }) : null,
|
|
12614
|
+
type === "rollup" ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
12490
12615
|
RollupFilterQuestion,
|
|
12491
12616
|
{
|
|
12492
12617
|
relation: totalSources.find((f) => f.key === via),
|
|
@@ -12496,22 +12621,22 @@ function FieldEditor(props) {
|
|
|
12496
12621
|
onChange: setRollupFilter
|
|
12497
12622
|
}
|
|
12498
12623
|
) : null,
|
|
12499
|
-
editing && field && !(type === "select" || type === "multi_select" || type === "status" || type === "autonumber") ? /* @__PURE__ */ (0,
|
|
12500
|
-
/* @__PURE__ */ (0,
|
|
12501
|
-
/* @__PURE__ */ (0,
|
|
12502
|
-
/* @__PURE__ */ (0,
|
|
12503
|
-
|
|
12624
|
+
editing && field && !(type === "select" || type === "multi_select" || type === "status" || type === "autonumber") ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(FieldFormatPicker, { field, value: showsAs, onValue: setShowsAs }) : null,
|
|
12625
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-wrap items-center gap-4", children: [
|
|
12626
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex items-center gap-1.5", children: [
|
|
12627
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
12628
|
+
import_design_system42.Checkbox,
|
|
12504
12629
|
{
|
|
12505
12630
|
checked: required,
|
|
12506
12631
|
"aria-label": "Required",
|
|
12507
12632
|
onCheckedChange: (v) => setRequired(v === true)
|
|
12508
12633
|
}
|
|
12509
12634
|
),
|
|
12510
|
-
/* @__PURE__ */ (0,
|
|
12635
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { title: "Every record has to have one", children: "Required" })
|
|
12511
12636
|
] }),
|
|
12512
|
-
offersMany ? /* @__PURE__ */ (0,
|
|
12513
|
-
/* @__PURE__ */ (0,
|
|
12514
|
-
|
|
12637
|
+
offersMany ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex items-center gap-1.5", children: [
|
|
12638
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
12639
|
+
import_design_system42.Checkbox,
|
|
12515
12640
|
{
|
|
12516
12641
|
checked: multi,
|
|
12517
12642
|
"aria-label": "Can hold more than one",
|
|
@@ -12520,9 +12645,9 @@ function FieldEditor(props) {
|
|
|
12520
12645
|
),
|
|
12521
12646
|
"Can hold more than one"
|
|
12522
12647
|
] }) : null,
|
|
12523
|
-
/* @__PURE__ */ (0,
|
|
12524
|
-
/* @__PURE__ */ (0,
|
|
12525
|
-
|
|
12648
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex items-center gap-1.5", children: [
|
|
12649
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
12650
|
+
import_design_system42.Checkbox,
|
|
12526
12651
|
{
|
|
12527
12652
|
checked: dated,
|
|
12528
12653
|
"aria-label": "Each value has its own date",
|
|
@@ -12531,9 +12656,9 @@ function FieldEditor(props) {
|
|
|
12531
12656
|
),
|
|
12532
12657
|
"Each value has its own date"
|
|
12533
12658
|
] }),
|
|
12534
|
-
!field && type === "relation" && otherTable.data && otherTable.data.id !== tableId ? /* @__PURE__ */ (0,
|
|
12535
|
-
/* @__PURE__ */ (0,
|
|
12536
|
-
|
|
12659
|
+
!field && type === "relation" && otherTable.data && otherTable.data.id !== tableId ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex items-center gap-1.5", children: [
|
|
12660
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
12661
|
+
import_design_system42.Checkbox,
|
|
12537
12662
|
{
|
|
12538
12663
|
checked: showOnOther,
|
|
12539
12664
|
"aria-label": `Show on ${otherTable.data.name ?? "the other table"}`,
|
|
@@ -12544,13 +12669,13 @@ function FieldEditor(props) {
|
|
|
12544
12669
|
"Show on ",
|
|
12545
12670
|
otherTable.data.name ?? "the other table"
|
|
12546
12671
|
] }) : null,
|
|
12547
|
-
!field && type === "relation" && relationTarget === tableId ? /* @__PURE__ */ (0,
|
|
12548
|
-
/* @__PURE__ */ (0,
|
|
12549
|
-
/* @__PURE__ */ (0,
|
|
12672
|
+
!field && type === "relation" && relationTarget === tableId ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex items-center gap-1.5", title: "A timeline draws a line to each record this one waits on", children: [
|
|
12673
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.Checkbox, { checked: dependency, "aria-label": "Waits on the linked records", "data-records-dependency": "", onCheckedChange: (v) => setDependency(v === true) }),
|
|
12674
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { children: "Waits on the linked records" })
|
|
12550
12675
|
] }) : null,
|
|
12551
|
-
!field && type === "relation" && relationTarget === tableId ? /* @__PURE__ */ (0,
|
|
12552
|
-
/* @__PURE__ */ (0,
|
|
12553
|
-
|
|
12676
|
+
!field && type === "relation" && relationTarget === tableId ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex items-center gap-1.5", children: [
|
|
12677
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
12678
|
+
import_design_system42.Checkbox,
|
|
12554
12679
|
{
|
|
12555
12680
|
checked: nestsSubItems,
|
|
12556
12681
|
"aria-label": "Sub-items",
|
|
@@ -12561,11 +12686,11 @@ function FieldEditor(props) {
|
|
|
12561
12686
|
"data-records-sub-items": ""
|
|
12562
12687
|
}
|
|
12563
12688
|
),
|
|
12564
|
-
/* @__PURE__ */ (0,
|
|
12689
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { title: "Each record sits under the one this column names", children: "Sub-items" })
|
|
12565
12690
|
] }) : null,
|
|
12566
|
-
CHOICE_EDITOR_ADDS_WHAT_IS_TYPED && (type === "select" || type === "multi_select") ? /* @__PURE__ */ (0,
|
|
12567
|
-
/* @__PURE__ */ (0,
|
|
12568
|
-
|
|
12691
|
+
CHOICE_EDITOR_ADDS_WHAT_IS_TYPED && (type === "select" || type === "multi_select") ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex items-center gap-1.5", children: [
|
|
12692
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
12693
|
+
import_design_system42.Checkbox,
|
|
12569
12694
|
{
|
|
12570
12695
|
checked: allowOther,
|
|
12571
12696
|
"aria-label": "A value that is not one of the choices is added to them",
|
|
@@ -12575,10 +12700,10 @@ function FieldEditor(props) {
|
|
|
12575
12700
|
"A value that is not one of the choices is added to them"
|
|
12576
12701
|
] }) : null
|
|
12577
12702
|
] }),
|
|
12578
|
-
!editing && !onEntity && newColumnTakesADefault(type) ? /* @__PURE__ */ (0,
|
|
12579
|
-
editing && field && takesADefault(liveField ?? field) ? /* @__PURE__ */ (0,
|
|
12580
|
-
/* @__PURE__ */ (0,
|
|
12581
|
-
/* @__PURE__ */ (0,
|
|
12703
|
+
!editing && !onEntity && newColumnTakesADefault(type) ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(NewColumnDefault, { type, choices: options, value: startsWith, onChange: setStartsWith }) : null,
|
|
12704
|
+
editing && field && takesADefault(liveField ?? field) ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-col gap-1", "data-records-field-default": "", children: [
|
|
12705
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.Label, { htmlFor: "records-field-default", className: "text-xs", children: DEFAULT_LABEL }),
|
|
12706
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
12582
12707
|
FieldControl,
|
|
12583
12708
|
{
|
|
12584
12709
|
id: "records-field-default",
|
|
@@ -12588,29 +12713,29 @@ function FieldEditor(props) {
|
|
|
12588
12713
|
}
|
|
12589
12714
|
)
|
|
12590
12715
|
] }) : null,
|
|
12591
|
-
/* @__PURE__ */ (0,
|
|
12592
|
-
/* @__PURE__ */ (0,
|
|
12593
|
-
/* @__PURE__ */ (0,
|
|
12594
|
-
/* @__PURE__ */ (0,
|
|
12595
|
-
/* @__PURE__ */ (0,
|
|
12596
|
-
/* @__PURE__ */ (0,
|
|
12597
|
-
/* @__PURE__ */ (0,
|
|
12716
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.Separator, {}),
|
|
12717
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "grid gap-3 sm:grid-cols-2", children: [
|
|
12718
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
12719
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.Label, { className: "text-xs", children: "Who can see what is in it" }),
|
|
12720
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_design_system42.Select, { value: sensitivity, onValueChange: setSensitivity, children: [
|
|
12721
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.SelectTrigger, { size: "sm", "aria-label": "Who can see what is in it", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.SelectValue, {}) }),
|
|
12722
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.SelectContent, { children: sensitivities.map((row) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.SelectItem, { value: row.value, children: row.label }, row.value)) })
|
|
12598
12723
|
] })
|
|
12599
12724
|
] }),
|
|
12600
|
-
/* @__PURE__ */ (0,
|
|
12601
|
-
/* @__PURE__ */ (0,
|
|
12602
|
-
/* @__PURE__ */ (0,
|
|
12603
|
-
/* @__PURE__ */ (0,
|
|
12604
|
-
/* @__PURE__ */ (0,
|
|
12725
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
12726
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.Label, { className: "text-xs", children: "Can an assistant read it" }),
|
|
12727
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_design_system42.Select, { value: contextPolicy, onValueChange: setContextPolicy, children: [
|
|
12728
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.SelectTrigger, { size: "sm", "aria-label": "Can an assistant read it", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.SelectValue, {}) }),
|
|
12729
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.SelectContent, { children: AGENT_VISIBILITY.map((row) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.SelectItem, { value: row.value, children: row.label }, row.value)) })
|
|
12605
12730
|
] })
|
|
12606
12731
|
] })
|
|
12607
12732
|
] }),
|
|
12608
|
-
/* @__PURE__ */ (0,
|
|
12609
|
-
/* @__PURE__ */ (0,
|
|
12610
|
-
/* @__PURE__ */ (0,
|
|
12611
|
-
/* @__PURE__ */ (0,
|
|
12612
|
-
/* @__PURE__ */ (0,
|
|
12613
|
-
|
|
12733
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.Separator, {}),
|
|
12734
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
12735
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
12736
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "font-medium", children: "What counts as a good value" }),
|
|
12737
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
12738
|
+
import_design_system42.Button,
|
|
12614
12739
|
{
|
|
12615
12740
|
type: "button",
|
|
12616
12741
|
size: "sm",
|
|
@@ -12621,9 +12746,9 @@ function FieldEditor(props) {
|
|
|
12621
12746
|
}
|
|
12622
12747
|
)
|
|
12623
12748
|
] }),
|
|
12624
|
-
canBeUnique(type, multi) || rules.some((r) => r.kind === "unique") ? /* @__PURE__ */ (0,
|
|
12625
|
-
/* @__PURE__ */ (0,
|
|
12626
|
-
|
|
12749
|
+
canBeUnique(type, multi) || rules.some((r) => r.kind === "unique") ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex items-center gap-1.5", "data-records-field-unique": "", children: [
|
|
12750
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
12751
|
+
import_design_system42.Checkbox,
|
|
12627
12752
|
{
|
|
12628
12753
|
checked: rules.some((r) => r.kind === "unique"),
|
|
12629
12754
|
"aria-label": UNIQUE_LABEL,
|
|
@@ -12632,21 +12757,21 @@ function FieldEditor(props) {
|
|
|
12632
12757
|
),
|
|
12633
12758
|
UNIQUE_LABEL
|
|
12634
12759
|
] }) : null,
|
|
12635
|
-
rules.length === 0 ? /* @__PURE__ */ (0,
|
|
12636
|
-
rules.map((rule, index) => rule.kind === "unique" ? null : /* @__PURE__ */ (0,
|
|
12637
|
-
/* @__PURE__ */ (0,
|
|
12638
|
-
|
|
12760
|
+
rules.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "text-muted-foreground", children: "No checks." }) : null,
|
|
12761
|
+
rules.map((rule, index) => rule.kind === "unique" ? null : /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
12762
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
|
|
12763
|
+
import_design_system42.Select,
|
|
12639
12764
|
{
|
|
12640
12765
|
value: rule.kind,
|
|
12641
12766
|
onValueChange: (kind) => setRules(rules.map((r, i) => i === index ? { ...r, kind } : r)),
|
|
12642
12767
|
children: [
|
|
12643
|
-
/* @__PURE__ */ (0,
|
|
12644
|
-
/* @__PURE__ */ (0,
|
|
12768
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.SelectTrigger, { size: "sm", className: "w-52", "aria-label": `Check ${index + 1}`, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.SelectValue, {}) }),
|
|
12769
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.SelectContent, { children: RULE_KINDS.map((row) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.SelectItem, { value: row.kind, children: row.label }, row.kind)) })
|
|
12645
12770
|
]
|
|
12646
12771
|
}
|
|
12647
12772
|
),
|
|
12648
|
-
rule.kind === "length" ? /* @__PURE__ */ (0,
|
|
12649
|
-
|
|
12773
|
+
rule.kind === "length" ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
12774
|
+
import_design_system42.BasicInput,
|
|
12650
12775
|
{
|
|
12651
12776
|
className: "h-8 w-24",
|
|
12652
12777
|
inputMode: "numeric",
|
|
@@ -12656,8 +12781,8 @@ function FieldEditor(props) {
|
|
|
12656
12781
|
onChange: (e) => setRules(rules.map((r, i) => i === index ? withNumber(r, "min", e.target.value) : r))
|
|
12657
12782
|
}
|
|
12658
12783
|
) : null,
|
|
12659
|
-
/* @__PURE__ */ (0,
|
|
12660
|
-
|
|
12784
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
12785
|
+
import_design_system42.BasicInput,
|
|
12661
12786
|
{
|
|
12662
12787
|
className: "h-8",
|
|
12663
12788
|
...rule.kind === "length" ? { inputMode: "numeric", placeholder: "most" } : {},
|
|
@@ -12666,8 +12791,8 @@ function FieldEditor(props) {
|
|
|
12666
12791
|
onChange: (e) => setRules(rules.map((r, i) => i === index ? { ...r, value: e.target.value } : r))
|
|
12667
12792
|
}
|
|
12668
12793
|
),
|
|
12669
|
-
rule.kind === "pattern" ? /* @__PURE__ */ (0,
|
|
12670
|
-
|
|
12794
|
+
rule.kind === "pattern" ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
12795
|
+
import_design_system42.BasicInput,
|
|
12671
12796
|
{
|
|
12672
12797
|
className: "h-8",
|
|
12673
12798
|
placeholder: "for example 949-555-0142",
|
|
@@ -12676,8 +12801,8 @@ function FieldEditor(props) {
|
|
|
12676
12801
|
onChange: (e) => setRules(rules.map((r, i) => i === index ? withText(r, "example", e.target.value) : r))
|
|
12677
12802
|
}
|
|
12678
12803
|
) : null,
|
|
12679
|
-
/* @__PURE__ */ (0,
|
|
12680
|
-
|
|
12804
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
12805
|
+
import_design_system42.Button,
|
|
12681
12806
|
{
|
|
12682
12807
|
type: "button",
|
|
12683
12808
|
size: "sm",
|
|
@@ -12689,9 +12814,9 @@ function FieldEditor(props) {
|
|
|
12689
12814
|
)
|
|
12690
12815
|
] }, `${rule.kind}-${index}`))
|
|
12691
12816
|
] }),
|
|
12692
|
-
editing && field && !onEntity && rulesChanged(savedRules, editedRules) ? /* @__PURE__ */ (0,
|
|
12693
|
-
mutation.error ? /* @__PURE__ */ (0,
|
|
12694
|
-
notLanded ? /* @__PURE__ */ (0,
|
|
12817
|
+
editing && field && !onEntity && rulesChanged(savedRules, editedRules) ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(FieldRulePreview, { field, tableId, rules: editedRules }) : null,
|
|
12818
|
+
mutation.error ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(RefusalNotice, { error: mutation.error }) : null,
|
|
12819
|
+
notLanded ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
12695
12820
|
RefusalNotice,
|
|
12696
12821
|
{
|
|
12697
12822
|
error: (0, refusals_exports.refusal)(
|
|
@@ -12701,11 +12826,11 @@ function FieldEditor(props) {
|
|
|
12701
12826
|
)
|
|
12702
12827
|
}
|
|
12703
12828
|
) : null,
|
|
12704
|
-
rehomeRefused ? /* @__PURE__ */ (0,
|
|
12705
|
-
rehomed ? /* @__PURE__ */ (0,
|
|
12706
|
-
/* @__PURE__ */ (0,
|
|
12707
|
-
rehomed.undo ? /* @__PURE__ */ (0,
|
|
12708
|
-
|
|
12829
|
+
rehomeRefused ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(RefusalNotice, { error: rehomeRefused }) : null,
|
|
12830
|
+
rehomed ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { "data-records-choice-rehomed": "", className: "flex flex-wrap items-center gap-2 text-[11px]", children: [
|
|
12831
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { children: rehomed.said }),
|
|
12832
|
+
rehomed.undo ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
12833
|
+
import_design_system42.Button,
|
|
12709
12834
|
{
|
|
12710
12835
|
type: "button",
|
|
12711
12836
|
size: "sm",
|
|
@@ -12729,19 +12854,19 @@ function FieldEditor(props) {
|
|
|
12729
12854
|
children: "Undo"
|
|
12730
12855
|
}
|
|
12731
12856
|
) : null,
|
|
12732
|
-
/* @__PURE__ */ (0,
|
|
12857
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.Button, { type: "button", size: "sm", className: "h-6 px-2 text-xs", onClick: () => onSaved?.(), children: "Done" })
|
|
12733
12858
|
] }) : null,
|
|
12734
|
-
reverseRefused ? /* @__PURE__ */ (0,
|
|
12735
|
-
/* @__PURE__ */ (0,
|
|
12736
|
-
/* @__PURE__ */ (0,
|
|
12859
|
+
reverseRefused ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { "data-records-reverse-field-refused": "", className: "flex flex-col gap-1", children: [
|
|
12860
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "text-[11px]", children: "The link is made. Its column on the other table was not:" }),
|
|
12861
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(RefusalNotice, { error: reverseRefused })
|
|
12737
12862
|
] }) : null,
|
|
12738
|
-
backfillError ? /* @__PURE__ */ (0,
|
|
12739
|
-
/* @__PURE__ */ (0,
|
|
12740
|
-
/* @__PURE__ */ (0,
|
|
12863
|
+
backfillError ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { "data-records-autonumber-backfill-refused": "", className: "flex flex-col gap-1", children: [
|
|
12864
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "text-[11px]", children: "The column is made. The records already in the table were not numbered:" }),
|
|
12865
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(RefusalNotice, { error: backfillError })
|
|
12741
12866
|
] }) : null,
|
|
12742
|
-
/* @__PURE__ */ (0,
|
|
12743
|
-
/* @__PURE__ */ (0,
|
|
12744
|
-
|
|
12867
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex min-w-0 flex-nowrap items-center gap-2", "data-field-editor-footer": "", children: [
|
|
12868
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
12869
|
+
import_design_system42.Button,
|
|
12745
12870
|
{
|
|
12746
12871
|
size: "sm",
|
|
12747
12872
|
disabled: mutation.saving || Boolean(formulaMissing) || Boolean(nameLine) && label.trim() !== (field?.label ?? "").trim(),
|
|
@@ -12756,8 +12881,8 @@ function FieldEditor(props) {
|
|
|
12756
12881
|
children: mutation.saving ? "Saving\u2026" : field ? EDIT_FIELD_SAVE_LABEL : onEntity ? ADD_STANDARD_FIELD_SAVE_LABEL : ADD_FIELD_SAVE_LABEL
|
|
12757
12882
|
}
|
|
12758
12883
|
),
|
|
12759
|
-
onCancel ? /* @__PURE__ */ (0,
|
|
12760
|
-
/* @__PURE__ */ (0,
|
|
12884
|
+
onCancel ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.Button, { size: "sm", variant: "ghost", onClick: onCancel, children: "Cancel" }) : null,
|
|
12885
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
12761
12886
|
"span",
|
|
12762
12887
|
{
|
|
12763
12888
|
id: "field-editor-missing",
|
|
@@ -12773,12 +12898,12 @@ function FieldEditor(props) {
|
|
|
12773
12898
|
footer is always as wide and as tall as its larger state: opening the confirm moved
|
|
12774
12899
|
the dialog card 0.2278 and closing it 0.1303. The consequence is the tooltip of
|
|
12775
12900
|
"Remove it" (interface-text: the slot holds a label, never a paragraph). */
|
|
12776
|
-
/* @__PURE__ */ (0,
|
|
12777
|
-
/* @__PURE__ */ (0,
|
|
12778
|
-
/* @__PURE__ */ (0,
|
|
12779
|
-
/* @__PURE__ */ (0,
|
|
12780
|
-
/* @__PURE__ */ (0,
|
|
12781
|
-
|
|
12901
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "ml-auto grid shrink-0 items-center", "data-field-editor-remove": askingToRemove ? "asking" : "idle", children: [
|
|
12902
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: (0, import_design_system42.cn)("col-start-1 row-start-1 flex items-center justify-end gap-2", askingToRemove && "invisible"), "aria-hidden": askingToRemove || void 0, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.Button, { size: "sm", variant: "outline", tabIndex: askingToRemove ? -1 : void 0, onClick: () => setAskingToRemove(true), children: "Remove this field" }) }),
|
|
12903
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: (0, import_design_system42.cn)("col-start-1 row-start-1 flex items-center justify-end gap-2", !askingToRemove && "invisible"), "aria-hidden": !askingToRemove || void 0, children: [
|
|
12904
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "whitespace-nowrap text-destructive", "data-field-editor-remove-ask": "", children: "Archive this field?" }),
|
|
12905
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
12906
|
+
import_design_system42.Button,
|
|
12782
12907
|
{
|
|
12783
12908
|
size: "sm",
|
|
12784
12909
|
variant: "destructive",
|
|
@@ -12790,7 +12915,7 @@ function FieldEditor(props) {
|
|
|
12790
12915
|
children: "Remove it"
|
|
12791
12916
|
}
|
|
12792
12917
|
),
|
|
12793
|
-
/* @__PURE__ */ (0,
|
|
12918
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.Button, { size: "sm", variant: "ghost", tabIndex: askingToRemove ? void 0 : -1, onClick: () => setAskingToRemove(false), children: "Keep it" })
|
|
12794
12919
|
] })
|
|
12795
12920
|
] })
|
|
12796
12921
|
) : null
|
|
@@ -12881,10 +13006,10 @@ function formulaSeparatorOf(field) {
|
|
|
12881
13006
|
function TypeQuestions(props) {
|
|
12882
13007
|
const { type } = props;
|
|
12883
13008
|
if (type === "entity_reference") {
|
|
12884
|
-
return /* @__PURE__ */ (0,
|
|
13009
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(EntityReferenceKindPicker, { value: props.allowedTypes, onChange: props.setAllowedTypes, locked: props.editing });
|
|
12885
13010
|
}
|
|
12886
13011
|
if (type === "relation") {
|
|
12887
|
-
return /* @__PURE__ */ (0,
|
|
13012
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
12888
13013
|
ReferenceBuilder,
|
|
12889
13014
|
{
|
|
12890
13015
|
tableId: props.tableId,
|
|
@@ -12897,21 +13022,21 @@ function TypeQuestions(props) {
|
|
|
12897
13022
|
}
|
|
12898
13023
|
);
|
|
12899
13024
|
}
|
|
12900
|
-
if (type === "rating" || type === "barcode") return /* @__PURE__ */ (0,
|
|
13025
|
+
if (type === "rating" || type === "barcode") return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_jsx_runtime47.Fragment, { children: props.newer });
|
|
12901
13026
|
if (type === "status") {
|
|
12902
|
-
return /* @__PURE__ */ (0,
|
|
13027
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-col gap-3", children: [
|
|
12903
13028
|
props.choiceList,
|
|
12904
13029
|
props.newer
|
|
12905
13030
|
] });
|
|
12906
13031
|
}
|
|
12907
13032
|
if (type === "select" || type === "multi_select") {
|
|
12908
|
-
return /* @__PURE__ */ (0,
|
|
13033
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_jsx_runtime47.Fragment, { children: props.choiceList });
|
|
12909
13034
|
}
|
|
12910
13035
|
if (type === "currency") {
|
|
12911
|
-
return /* @__PURE__ */ (0,
|
|
12912
|
-
/* @__PURE__ */ (0,
|
|
12913
|
-
/* @__PURE__ */ (0,
|
|
12914
|
-
|
|
13036
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex max-w-[16rem] flex-col gap-1", children: [
|
|
13037
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.Label, { className: "text-xs", children: "The currency" }),
|
|
13038
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
13039
|
+
import_design_system42.BasicInput,
|
|
12915
13040
|
{
|
|
12916
13041
|
value: props.unit,
|
|
12917
13042
|
"aria-label": "The currency",
|
|
@@ -12922,9 +13047,9 @@ function TypeQuestions(props) {
|
|
|
12922
13047
|
] });
|
|
12923
13048
|
}
|
|
12924
13049
|
if (type === "datetime") {
|
|
12925
|
-
return /* @__PURE__ */ (0,
|
|
12926
|
-
/* @__PURE__ */ (0,
|
|
12927
|
-
|
|
13050
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex items-center gap-1.5", children: [
|
|
13051
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
13052
|
+
import_design_system42.Checkbox,
|
|
12928
13053
|
{
|
|
12929
13054
|
checked: props.withTime,
|
|
12930
13055
|
"aria-label": "Include a time of day",
|
|
@@ -12937,14 +13062,14 @@ function TypeQuestions(props) {
|
|
|
12937
13062
|
if (type === "lookup" || type === "rollup" || type === "count") {
|
|
12938
13063
|
const usable = props.relations;
|
|
12939
13064
|
if (usable.length === 0) {
|
|
12940
|
-
return /* @__PURE__ */ (0,
|
|
12941
|
-
}
|
|
12942
|
-
return /* @__PURE__ */ (0,
|
|
12943
|
-
/* @__PURE__ */ (0,
|
|
12944
|
-
/* @__PURE__ */ (0,
|
|
12945
|
-
/* @__PURE__ */ (0,
|
|
12946
|
-
/* @__PURE__ */ (0,
|
|
12947
|
-
/* @__PURE__ */ (0,
|
|
13065
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No link, Person or File column yet." });
|
|
13066
|
+
}
|
|
13067
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "grid gap-3 sm:grid-cols-2", children: [
|
|
13068
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
13069
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.Label, { className: "text-xs", children: type !== "lookup" ? "Across the records in" : "Read it from" }),
|
|
13070
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_design_system42.Select, { value: props.via, onValueChange: props.setVia, children: [
|
|
13071
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.SelectTrigger, { size: "sm", "aria-label": type !== "lookup" ? "Across the records in" : "Read it from", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.SelectValue, { placeholder: "Choose a column" }) }),
|
|
13072
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.SelectContent, { children: usable.map((f) => /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_design_system42.SelectItem, { value: f.key, children: [
|
|
12948
13073
|
fieldName(f),
|
|
12949
13074
|
isBackLinkSource(f) ? BACK_LINK_SOURCE_SUFFIX : "",
|
|
12950
13075
|
sourceKindOf(f) === "person" ? " \u2014 a person" : sourceKindOf(f) === "file" ? " \u2014 a file" : "",
|
|
@@ -12952,7 +13077,7 @@ function TypeQuestions(props) {
|
|
|
12952
13077
|
] }, f.id)) })
|
|
12953
13078
|
] })
|
|
12954
13079
|
] }),
|
|
12955
|
-
type === "lookup" ? /* @__PURE__ */ (0,
|
|
13080
|
+
type === "lookup" ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
12956
13081
|
ValueOnTheOtherSide,
|
|
12957
13082
|
{
|
|
12958
13083
|
label: "The value to read",
|
|
@@ -12961,13 +13086,13 @@ function TypeQuestions(props) {
|
|
|
12961
13086
|
value: props.pick,
|
|
12962
13087
|
onChange: props.setPick
|
|
12963
13088
|
}
|
|
12964
|
-
) : type === "count" ? null : /* @__PURE__ */ (0,
|
|
12965
|
-
/* @__PURE__ */ (0,
|
|
12966
|
-
/* @__PURE__ */ (0,
|
|
12967
|
-
/* @__PURE__ */ (0,
|
|
12968
|
-
/* @__PURE__ */ (0,
|
|
13089
|
+
) : type === "count" ? null : /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
13090
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.Label, { className: "text-xs", children: "What to work out" }),
|
|
13091
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_design_system42.Select, { value: props.agg, onValueChange: (v) => props.setAgg(v), children: [
|
|
13092
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.SelectTrigger, { size: "sm", "aria-label": "What to work out", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.SelectValue, {}) }),
|
|
13093
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.SelectContent, { children: ROLLUP_OPERATIONS.map((row) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.SelectItem, { value: row.value, children: row.label }, row.value)) })
|
|
12969
13094
|
] }),
|
|
12970
|
-
props.agg !== "count" ? /* @__PURE__ */ (0,
|
|
13095
|
+
props.agg !== "count" ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
12971
13096
|
ValueOnTheOtherSide,
|
|
12972
13097
|
{
|
|
12973
13098
|
label: "Of which value",
|
|
@@ -12983,22 +13108,22 @@ function TypeQuestions(props) {
|
|
|
12983
13108
|
}
|
|
12984
13109
|
if (type === "formula") {
|
|
12985
13110
|
if (props.others.length === 0) {
|
|
12986
|
-
return /* @__PURE__ */ (0,
|
|
12987
|
-
}
|
|
12988
|
-
return /* @__PURE__ */ (0,
|
|
12989
|
-
/* @__PURE__ */ (0,
|
|
12990
|
-
/* @__PURE__ */ (0,
|
|
12991
|
-
/* @__PURE__ */ (0,
|
|
12992
|
-
/* @__PURE__ */ (0,
|
|
12993
|
-
/* @__PURE__ */ (0,
|
|
13111
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No other columns yet." });
|
|
13112
|
+
}
|
|
13113
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
13114
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
13115
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.Label, { className: "text-xs", children: "What to do" }),
|
|
13116
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_design_system42.Select, { value: props.formulaOp, onValueChange: props.setFormulaOp, children: [
|
|
13117
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.SelectTrigger, { size: "sm", className: "max-w-[18rem]", "aria-label": "What to do", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.SelectValue, {}) }),
|
|
13118
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.SelectContent, { children: FORMULA_OPERATIONS.map((row) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.SelectItem, { value: row.value, children: row.label }, row.value)) })
|
|
12994
13119
|
] })
|
|
12995
13120
|
] }),
|
|
12996
|
-
/* @__PURE__ */ (0,
|
|
12997
|
-
/* @__PURE__ */ (0,
|
|
12998
|
-
/* @__PURE__ */ (0,
|
|
13121
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
13122
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.Label, { className: "text-xs", children: "Which columns" }),
|
|
13123
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "flex flex-wrap gap-1", children: props.others.map((f) => {
|
|
12999
13124
|
const picked = props.formulaFields.includes(f.id);
|
|
13000
|
-
return /* @__PURE__ */ (0,
|
|
13001
|
-
|
|
13125
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
13126
|
+
import_design_system42.Button,
|
|
13002
13127
|
{
|
|
13003
13128
|
type: "button",
|
|
13004
13129
|
size: "sm",
|
|
@@ -13012,10 +13137,10 @@ function TypeQuestions(props) {
|
|
|
13012
13137
|
);
|
|
13013
13138
|
}) })
|
|
13014
13139
|
] }),
|
|
13015
|
-
props.formulaOp === "concat" ? /* @__PURE__ */ (0,
|
|
13016
|
-
/* @__PURE__ */ (0,
|
|
13017
|
-
/* @__PURE__ */ (0,
|
|
13018
|
-
|
|
13140
|
+
props.formulaOp === "concat" ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
13141
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.Label, { className: "text-xs", children: FORMULA_SEPARATOR_LABEL }),
|
|
13142
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
13143
|
+
import_design_system42.BasicInput,
|
|
13019
13144
|
{
|
|
13020
13145
|
value: props.formulaSeparator,
|
|
13021
13146
|
"aria-label": FORMULA_SEPARATOR_LABEL,
|
|
@@ -13075,15 +13200,15 @@ function RollupFilterQuestion({
|
|
|
13075
13200
|
lastFar.current = far;
|
|
13076
13201
|
}, [far, editing, onChange]);
|
|
13077
13202
|
if (!relation || !far) return null;
|
|
13078
|
-
return /* @__PURE__ */ (0,
|
|
13079
|
-
/* @__PURE__ */ (0,
|
|
13203
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "flex flex-col gap-1", "data-records-rollup-filter": "", children: !conditionIsDrawable(value) ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-wrap items-center gap-2 text-[11px]", children: [
|
|
13204
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("span", { className: "text-muted-foreground", children: [
|
|
13080
13205
|
rollupFilterLead(agg),
|
|
13081
13206
|
" ",
|
|
13082
13207
|
conditionInWords(value, conditionFields),
|
|
13083
13208
|
"."
|
|
13084
13209
|
] }),
|
|
13085
|
-
/* @__PURE__ */ (0,
|
|
13086
|
-
] }) : /* @__PURE__ */ (0,
|
|
13210
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.Button, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-2 text-xs", onClick: () => onChange(null), children: "Clear" })
|
|
13211
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(ChoiceListTermsContext.Provider, { value: true, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
13087
13212
|
ConditionGroup,
|
|
13088
13213
|
{
|
|
13089
13214
|
lead: rollupFilterLead(agg),
|
|
@@ -13109,13 +13234,13 @@ function ValueOnTheOtherSide({
|
|
|
13109
13234
|
const carried = sample.data?.rows[0]?.document ?? null;
|
|
13110
13235
|
const offered = declared.length > 0 ? declared.map((f) => ({ key: f.key, name: fieldName(f) })) : Object.keys(carried ?? {}).map((key) => ({ key, name: (0, import_text_case7.humanizeIdentifier)(key) }));
|
|
13111
13236
|
const stillAsking = columns.loading || declared.length === 0 && sample.loading;
|
|
13112
|
-
const body = !relation ? /* @__PURE__ */ (0,
|
|
13113
|
-
/* @__PURE__ */ (0,
|
|
13114
|
-
/* @__PURE__ */ (0,
|
|
13237
|
+
const body = !relation ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Choose the column above first." }) : stillAsking ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Reading that table's columns\u2026" }) : offered.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No columns to read yet." }) : /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_design_system42.Select, { value, onValueChange: onChange, children: [
|
|
13238
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.SelectTrigger, { size: "sm", "aria-label": label, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.SelectValue, { placeholder: "Choose a column" }) }),
|
|
13239
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.SelectContent, { children: offered.map((column) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.SelectItem, { value: column.key, children: column.name }, column.key)) })
|
|
13115
13240
|
] });
|
|
13116
|
-
if (compact) return /* @__PURE__ */ (0,
|
|
13117
|
-
return /* @__PURE__ */ (0,
|
|
13118
|
-
/* @__PURE__ */ (0,
|
|
13241
|
+
if (compact) return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "mt-1 flex flex-col gap-1", children: body });
|
|
13242
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
13243
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.Label, { className: "text-xs", title: help, children: label }),
|
|
13119
13244
|
body
|
|
13120
13245
|
] });
|
|
13121
13246
|
}
|
|
@@ -13141,19 +13266,19 @@ function NewColumnDefault({
|
|
|
13141
13266
|
onChange
|
|
13142
13267
|
}) {
|
|
13143
13268
|
const none = "__none__";
|
|
13144
|
-
return /* @__PURE__ */ (0,
|
|
13145
|
-
/* @__PURE__ */ (0,
|
|
13146
|
-
type === "checkbox" ? /* @__PURE__ */ (0,
|
|
13147
|
-
/* @__PURE__ */ (0,
|
|
13148
|
-
/* @__PURE__ */ (0,
|
|
13149
|
-
] }) : type === "select" || type === "multi_select" || type === "status" ? /* @__PURE__ */ (0,
|
|
13150
|
-
/* @__PURE__ */ (0,
|
|
13151
|
-
/* @__PURE__ */ (0,
|
|
13152
|
-
/* @__PURE__ */ (0,
|
|
13153
|
-
choices.map((c) => /* @__PURE__ */ (0,
|
|
13269
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-col gap-1", "data-records-field-default": "", "data-records-new-field-default": "", children: [
|
|
13270
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.Label, { htmlFor: "records-new-field-default", className: "text-xs", children: DEFAULT_LABEL }),
|
|
13271
|
+
type === "checkbox" ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex items-center gap-2", children: [
|
|
13272
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.Checkbox, { id: "records-new-field-default", "aria-label": DEFAULT_LABEL, checked: value === true, onCheckedChange: (on) => onChange(on === true ? true : null) }),
|
|
13273
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { children: "Ticked" })
|
|
13274
|
+
] }) : type === "select" || type === "multi_select" || type === "status" ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_design_system42.Select, { value: typeof value === "string" && choices.includes(value) ? value : none, onValueChange: (v) => onChange(v === none ? null : v), children: [
|
|
13275
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.SelectTrigger, { id: "records-new-field-default", size: "sm", "aria-label": DEFAULT_LABEL, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.SelectValue, {}) }),
|
|
13276
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_design_system42.SelectContent, { children: [
|
|
13277
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.SelectItem, { value: none, children: "Nothing" }),
|
|
13278
|
+
choices.map((c) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.SelectItem, { value: c, children: c }, c))
|
|
13154
13279
|
] })
|
|
13155
|
-
] }) : /* @__PURE__ */ (0,
|
|
13156
|
-
|
|
13280
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
13281
|
+
import_design_system42.BasicInput,
|
|
13157
13282
|
{
|
|
13158
13283
|
id: "records-new-field-default",
|
|
13159
13284
|
value: typeof value === "string" ? value : value === null || value === void 0 ? "" : String(value),
|
|
@@ -13169,7 +13294,7 @@ init_names();
|
|
|
13169
13294
|
init_plainWords();
|
|
13170
13295
|
var import_outbound_react7 = require("@ai-matrx/kit/outbound-react");
|
|
13171
13296
|
var import_outbound2 = require("@ai-matrx/kit/outbound");
|
|
13172
|
-
var
|
|
13297
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
13173
13298
|
function buttonPressWords(label, pressed) {
|
|
13174
13299
|
if (pressed.do === "open_url") return `${label} opened ${readableLink(pressed.url)}`;
|
|
13175
13300
|
if (pressed.do === "add_row") return `${label}: a row was added.`;
|
|
@@ -13244,9 +13369,9 @@ function ButtonValue({ field, recordId, inCell, beforeSave }) {
|
|
|
13244
13369
|
if (!b) return null;
|
|
13245
13370
|
const color = (0, import_data_table6.isStyleColor)(b.color) ? import_data_table6.CHOICE_CHIP_CLASS[b.color] : import_data_table6.NEUTRAL_CHIP_CLASS;
|
|
13246
13371
|
if (beforeSave) {
|
|
13247
|
-
return /* @__PURE__ */ (0,
|
|
13248
|
-
/* @__PURE__ */ (0,
|
|
13249
|
-
/* @__PURE__ */ (0,
|
|
13372
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("span", { className: "inline-flex min-w-0 items-center gap-2", "data-records-button-before-save": field.key, children: [
|
|
13373
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_design_system43.Button, { type: "button", size: "xs", variant: "outline", disabled: true, "aria-describedby": `${field.key}-before-save`, "data-records-button": field.key, className: (0, import_design_system43.cn)("max-w-full gap-1 border px-2 font-medium", inCell ? "h-5" : "h-6", color), children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "truncate", children: b.label }) }),
|
|
13374
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { id: `${field.key}-before-save`, className: "whitespace-nowrap text-xs text-muted-foreground", children: "Save the record first" })
|
|
13250
13375
|
] });
|
|
13251
13376
|
}
|
|
13252
13377
|
const needs = (0, import_records26.buttonNeeds)(b);
|
|
@@ -13342,9 +13467,9 @@ function ButtonValue({ field, recordId, inCell, beforeSave }) {
|
|
|
13342
13467
|
}
|
|
13343
13468
|
setSaid({ kind: "ran", says: words });
|
|
13344
13469
|
};
|
|
13345
|
-
return /* @__PURE__ */ (0,
|
|
13346
|
-
/* @__PURE__ */ (0,
|
|
13347
|
-
|
|
13470
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
|
|
13471
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
13472
|
+
import_design_system43.Popover,
|
|
13348
13473
|
{
|
|
13349
13474
|
open: said2 !== null,
|
|
13350
13475
|
onOpenChange: (open) => {
|
|
@@ -13354,8 +13479,8 @@ function ButtonValue({ field, recordId, inCell, beforeSave }) {
|
|
|
13354
13479
|
setSaid(null);
|
|
13355
13480
|
},
|
|
13356
13481
|
children: [
|
|
13357
|
-
/* @__PURE__ */ (0,
|
|
13358
|
-
|
|
13482
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_design_system43.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
13483
|
+
import_design_system43.Button,
|
|
13359
13484
|
{
|
|
13360
13485
|
type: "button",
|
|
13361
13486
|
size: "xs",
|
|
@@ -13365,7 +13490,7 @@ function ButtonValue({ field, recordId, inCell, beforeSave }) {
|
|
|
13365
13490
|
"aria-busy": busy || opening || void 0,
|
|
13366
13491
|
"data-records-button-pending": busy || opening ? "" : void 0,
|
|
13367
13492
|
disabled: busy || opening,
|
|
13368
|
-
className: (0,
|
|
13493
|
+
className: (0, import_design_system43.cn)("max-w-full gap-1 border px-2 font-medium", inCell ? "h-5" : "h-6", color, needs && "border-dashed opacity-80"),
|
|
13369
13494
|
onPointerDown: stop2,
|
|
13370
13495
|
onDoubleClick: stop2,
|
|
13371
13496
|
onClick: (event) => {
|
|
@@ -13373,24 +13498,24 @@ function ButtonValue({ field, recordId, inCell, beforeSave }) {
|
|
|
13373
13498
|
event.preventDefault();
|
|
13374
13499
|
void press();
|
|
13375
13500
|
},
|
|
13376
|
-
children: /* @__PURE__ */ (0,
|
|
13501
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: (0, import_design_system43.cn)("truncate", (busy || opening) && "matrx-shimmer"), children: b.label })
|
|
13377
13502
|
}
|
|
13378
13503
|
) }),
|
|
13379
|
-
/* @__PURE__ */ (0,
|
|
13380
|
-
said2?.kind === "refused" ? /* @__PURE__ */ (0,
|
|
13381
|
-
said2?.kind === "waiting" ? /* @__PURE__ */ (0,
|
|
13382
|
-
said2?.kind === "failed" ? /* @__PURE__ */ (0,
|
|
13383
|
-
said2?.kind === "public" ? /* @__PURE__ */ (0,
|
|
13384
|
-
said2?.kind === "ran" ? /* @__PURE__ */ (0,
|
|
13385
|
-
said2.value ? /* @__PURE__ */ (0,
|
|
13504
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_design_system43.PopoverContent, { className: "w-72 space-y-2 p-3 text-sm", onClick: stop2, onPointerDown: stop2, "data-records-button-said": said2?.kind, children: [
|
|
13505
|
+
said2?.kind === "refused" ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(RefusalLine, { error: said2.error }) : null,
|
|
13506
|
+
said2?.kind === "waiting" ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { className: "matrx-shimmer rounded px-1 py-0.5", role: "status", "aria-live": "polite", children: said2.says }) : null,
|
|
13507
|
+
said2?.kind === "failed" ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_design_system43.ErrorBox, { as: "p", className: "break-words text-destructive", message: said2.says, origin: "records-ui/buttonCell", children: said2.says }) : null,
|
|
13508
|
+
said2?.kind === "public" ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { children: "Buttons run for signed-in people." }) : null,
|
|
13509
|
+
said2?.kind === "ran" ? /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "break-words", children: [
|
|
13510
|
+
said2.value ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(StructuredValueView, { structured: said2.value, label: b.label }) : null,
|
|
13386
13511
|
said2.says,
|
|
13387
13512
|
" ",
|
|
13388
|
-
said2.link ? /* @__PURE__ */ (0,
|
|
13513
|
+
said2.link ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_outbound_react7.OutboundLink, { href: said2.link, className: "text-primary underline", children: readableLink(said2.link) }) : null
|
|
13389
13514
|
] }) : null,
|
|
13390
|
-
said2?.kind === "needs" ? /* @__PURE__ */ (0,
|
|
13391
|
-
/* @__PURE__ */ (0,
|
|
13392
|
-
tableId ? /* @__PURE__ */ (0,
|
|
13393
|
-
|
|
13515
|
+
said2?.kind === "needs" ? /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
|
|
13516
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { children: said2.says }),
|
|
13517
|
+
tableId ? /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
13518
|
+
import_design_system43.Button,
|
|
13394
13519
|
{
|
|
13395
13520
|
type: "button",
|
|
13396
13521
|
size: "sm",
|
|
@@ -13410,12 +13535,12 @@ function ButtonValue({ field, recordId, inCell, beforeSave }) {
|
|
|
13410
13535
|
]
|
|
13411
13536
|
}
|
|
13412
13537
|
),
|
|
13413
|
-
settingUp && tableId ? /* @__PURE__ */ (0,
|
|
13414
|
-
/* @__PURE__ */ (0,
|
|
13415
|
-
/* @__PURE__ */ (0,
|
|
13416
|
-
/* @__PURE__ */ (0,
|
|
13538
|
+
settingUp && tableId ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_design_system43.Dialog, { open: true, onOpenChange: (open) => open ? null : setSettingUp(false), children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_design_system43.DialogContent, { className: "max-h-[85vh] overflow-y-auto sm:max-w-2xl", onClick: stop2, onPointerDown: stop2, children: [
|
|
13539
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_design_system43.DialogHeader, { children: [
|
|
13540
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_design_system43.DialogTitle, { children: `Column settings \xB7 ${fieldName(field)}` }),
|
|
13541
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_design_system43.DialogDescription, { className: "sr-only", children: "What the button does" })
|
|
13417
13542
|
] }),
|
|
13418
|
-
/* @__PURE__ */ (0,
|
|
13543
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(FieldEditor, { tableId, field, onSaved: () => setSettingUp(false), onCancel: () => setSettingUp(false) })
|
|
13419
13544
|
] }) }) : null
|
|
13420
13545
|
] });
|
|
13421
13546
|
}
|
|
@@ -13428,7 +13553,7 @@ init_Refusal();
|
|
|
13428
13553
|
// src/FloatingRefusal.tsx
|
|
13429
13554
|
var import_react71 = require("react");
|
|
13430
13555
|
var import_react_dom = require("react-dom");
|
|
13431
|
-
var
|
|
13556
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
13432
13557
|
var GAP = 4;
|
|
13433
13558
|
function placeFor(anchor, note) {
|
|
13434
13559
|
const a = anchor.getBoundingClientRect();
|
|
@@ -13466,12 +13591,12 @@ function FloatingRefusal({ text, why }) {
|
|
|
13466
13591
|
};
|
|
13467
13592
|
}, [text]);
|
|
13468
13593
|
if (!floating) {
|
|
13469
|
-
return /* @__PURE__ */ (0,
|
|
13594
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { ref: spot, "data-records-typed-refusal": "", role: "status", title: why, className: "text-[11px] leading-snug text-amber-700 dark:text-amber-400", children: text });
|
|
13470
13595
|
}
|
|
13471
|
-
return /* @__PURE__ */ (0,
|
|
13472
|
-
/* @__PURE__ */ (0,
|
|
13596
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_jsx_runtime49.Fragment, { children: [
|
|
13597
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { ref: spot, "data-records-refusal-anchor": "", hidden: true }),
|
|
13473
13598
|
typeof document === "undefined" ? null : (0, import_react_dom.createPortal)(
|
|
13474
|
-
/* @__PURE__ */ (0,
|
|
13599
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
13475
13600
|
"span",
|
|
13476
13601
|
{
|
|
13477
13602
|
ref: note,
|
|
@@ -13494,9 +13619,9 @@ init_refusals();
|
|
|
13494
13619
|
|
|
13495
13620
|
// src/formatControls.tsx
|
|
13496
13621
|
var import_react72 = require("react");
|
|
13497
|
-
var
|
|
13622
|
+
var import_design_system44 = require("@ai-matrx/design-system");
|
|
13498
13623
|
var import_field_formats12 = require("@ai-matrx/design-system/field-formats");
|
|
13499
|
-
var
|
|
13624
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
13500
13625
|
var TYPED_NUMBERS = /* @__PURE__ */ new Set(["currency", "percent", "progress", "decimal", "duration", "file_size", "integer"]);
|
|
13501
13626
|
function scaled(format) {
|
|
13502
13627
|
return (format.id === "percent" || format.id === "progress") && format.options?.percentScale === "fraction";
|
|
@@ -13519,8 +13644,8 @@ function NumberInFormat({ format, value, onChange, disabled, id }) {
|
|
|
13519
13644
|
if (value === lastSent.current) return;
|
|
13520
13645
|
setText(typedText(format, value));
|
|
13521
13646
|
}, [value, format]);
|
|
13522
|
-
return /* @__PURE__ */ (0,
|
|
13523
|
-
|
|
13647
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
13648
|
+
import_design_system44.BasicInput,
|
|
13524
13649
|
{
|
|
13525
13650
|
id,
|
|
13526
13651
|
inputMode: "decimal",
|
|
@@ -13544,22 +13669,22 @@ function formatControl(args) {
|
|
|
13544
13669
|
const look = fieldLookFor(def.id);
|
|
13545
13670
|
if (look?.Editor) {
|
|
13546
13671
|
const Editor = look.Editor;
|
|
13547
|
-
return /* @__PURE__ */ (0,
|
|
13672
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Editor, { value, format, onChange, disabled, id, label });
|
|
13548
13673
|
}
|
|
13549
13674
|
const text = value === null || value === void 0 ? "" : String(value);
|
|
13550
13675
|
const commit = (raw) => onChange(raw === "" ? null : (0, import_field_formats12.parseFieldInput)(raw, format));
|
|
13551
13676
|
if (def.id === "rating") {
|
|
13552
|
-
return disabled ? /* @__PURE__ */ (0,
|
|
13677
|
+
return disabled ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(RatingStars, { value, max: format.options?.ratingMax ?? 5, label }) : /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { id, className: "inline-flex", children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(RatingStars, { value, max: format.options?.ratingMax ?? 5, label, onRate: (n) => onChange(n) }) });
|
|
13553
13678
|
}
|
|
13554
|
-
if (TYPED_NUMBERS.has(def.id)) return /* @__PURE__ */ (0,
|
|
13679
|
+
if (TYPED_NUMBERS.has(def.id)) return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(NumberInFormat, { ...args });
|
|
13555
13680
|
switch (def.editor) {
|
|
13556
13681
|
// A TIME OF DAY is not this file's: `FieldControl` draws the typed box and its helper
|
|
13557
13682
|
// (`TypedWordsControl`), never the browser's time control (grids review 3, 2026-09-30).
|
|
13558
13683
|
case "email":
|
|
13559
13684
|
case "url":
|
|
13560
13685
|
case "tel":
|
|
13561
|
-
return /* @__PURE__ */ (0,
|
|
13562
|
-
|
|
13686
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
13687
|
+
import_design_system44.BasicInput,
|
|
13563
13688
|
{
|
|
13564
13689
|
id,
|
|
13565
13690
|
type: def.editor,
|
|
@@ -13571,9 +13696,9 @@ function formatControl(args) {
|
|
|
13571
13696
|
}
|
|
13572
13697
|
);
|
|
13573
13698
|
case "color":
|
|
13574
|
-
return /* @__PURE__ */ (0,
|
|
13575
|
-
/* @__PURE__ */ (0,
|
|
13576
|
-
|
|
13699
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("span", { className: "flex items-center gap-2", children: [
|
|
13700
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
13701
|
+
import_design_system44.BasicInput,
|
|
13577
13702
|
{
|
|
13578
13703
|
id: `${id}-swatch`,
|
|
13579
13704
|
type: "color",
|
|
@@ -13584,10 +13709,10 @@ function formatControl(args) {
|
|
|
13584
13709
|
onChange: (e) => commit(e.target.value)
|
|
13585
13710
|
}
|
|
13586
13711
|
),
|
|
13587
|
-
/* @__PURE__ */ (0,
|
|
13712
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_design_system44.BasicInput, { id, value: text, placeholder: "#3b82f6", disabled, onChange: (e) => commit(e.target.value) })
|
|
13588
13713
|
] });
|
|
13589
13714
|
case "textarea":
|
|
13590
|
-
return /* @__PURE__ */ (0,
|
|
13715
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_design_system44.BasicTextarea, { id, rows: 4, value: text, disabled, onChange: (e) => commit(e.target.value) });
|
|
13591
13716
|
default:
|
|
13592
13717
|
return null;
|
|
13593
13718
|
}
|
|
@@ -13595,9 +13720,9 @@ function formatControl(args) {
|
|
|
13595
13720
|
|
|
13596
13721
|
// src/typedDateHelper.tsx
|
|
13597
13722
|
var import_react73 = require("react");
|
|
13598
|
-
var
|
|
13723
|
+
var import_design_system45 = require("@ai-matrx/design-system");
|
|
13599
13724
|
var import_records27 = require("@ai-matrx/records");
|
|
13600
|
-
var
|
|
13725
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
13601
13726
|
var WEEK = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
|
|
13602
13727
|
var MONTHS = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
|
|
13603
13728
|
function pad(n) {
|
|
@@ -13626,15 +13751,15 @@ function wordsFor2(kind, day, time) {
|
|
|
13626
13751
|
}
|
|
13627
13752
|
var keepFocus = { onMouseDown: (e) => e.preventDefault(), tabIndex: -1 };
|
|
13628
13753
|
function CalendarGlyph() {
|
|
13629
|
-
return /* @__PURE__ */ (0,
|
|
13630
|
-
/* @__PURE__ */ (0,
|
|
13631
|
-
/* @__PURE__ */ (0,
|
|
13754
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", width: "14", height: "14", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
13755
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("rect", { x: "3", y: "4", width: "18", height: "18", rx: "2" }),
|
|
13756
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("path", { d: "M16 2v4M8 2v4M3 10h18" })
|
|
13632
13757
|
] });
|
|
13633
13758
|
}
|
|
13634
13759
|
function ClockGlyph() {
|
|
13635
|
-
return /* @__PURE__ */ (0,
|
|
13636
|
-
/* @__PURE__ */ (0,
|
|
13637
|
-
/* @__PURE__ */ (0,
|
|
13760
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", width: "14", height: "14", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
13761
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("circle", { cx: "12", cy: "12", r: "10" }),
|
|
13762
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("path", { d: "M12 6v6l4 2" })
|
|
13638
13763
|
] });
|
|
13639
13764
|
}
|
|
13640
13765
|
function TypedDateHelper({
|
|
@@ -13675,8 +13800,8 @@ function TypedDateHelper({
|
|
|
13675
13800
|
const at = new Date(shown2.y, shown2.m + by, 1);
|
|
13676
13801
|
setMonth({ y: at.getFullYear(), m: at.getMonth() });
|
|
13677
13802
|
};
|
|
13678
|
-
return /* @__PURE__ */ (0,
|
|
13679
|
-
/* @__PURE__ */ (0,
|
|
13803
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_design_system45.Popover, { open, onOpenChange: setOpen, children: [
|
|
13804
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_design_system45.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
13680
13805
|
"button",
|
|
13681
13806
|
{
|
|
13682
13807
|
type: "button",
|
|
@@ -13685,11 +13810,11 @@ function TypedDateHelper({
|
|
|
13685
13810
|
"aria-label": kind === "time" ? `Pick a time for ${label}` : `Pick a date for ${label}`,
|
|
13686
13811
|
title: kind === "time" ? "Pick a time" : "Pick a date",
|
|
13687
13812
|
className: "inline-flex h-7 w-7 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-muted hover:text-foreground",
|
|
13688
|
-
children: kind === "time" ? /* @__PURE__ */ (0,
|
|
13813
|
+
children: kind === "time" ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(ClockGlyph, {}) : /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(CalendarGlyph, {})
|
|
13689
13814
|
}
|
|
13690
13815
|
) }),
|
|
13691
|
-
/* @__PURE__ */ (0,
|
|
13692
|
-
|
|
13816
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
13817
|
+
import_design_system45.PopoverContent,
|
|
13693
13818
|
{
|
|
13694
13819
|
sizing: "content",
|
|
13695
13820
|
align: "start",
|
|
@@ -13698,29 +13823,29 @@ function TypedDateHelper({
|
|
|
13698
13823
|
"data-records-date-helper-panel": "",
|
|
13699
13824
|
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
13700
13825
|
onCloseAutoFocus: (e) => e.preventDefault(),
|
|
13701
|
-
children: /* @__PURE__ */ (0,
|
|
13702
|
-
kind === "time" ? null : /* @__PURE__ */ (0,
|
|
13703
|
-
/* @__PURE__ */ (0,
|
|
13704
|
-
/* @__PURE__ */ (0,
|
|
13705
|
-
/* @__PURE__ */ (0,
|
|
13826
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex gap-2", children: [
|
|
13827
|
+
kind === "time" ? null : /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex flex-col gap-1", role: "grid", "aria-label": `${MONTHS[shown2.m]} ${shown2.y}`, children: [
|
|
13828
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex items-center justify-between text-xs font-medium", children: [
|
|
13829
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("button", { type: "button", ...keepFocus, "aria-label": "Previous month", className: "rounded px-1.5 hover:bg-muted", onClick: () => turn(-1), children: "\u2039" }),
|
|
13830
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("span", { children: [
|
|
13706
13831
|
MONTHS[shown2.m],
|
|
13707
13832
|
" ",
|
|
13708
13833
|
shown2.y
|
|
13709
13834
|
] }),
|
|
13710
|
-
/* @__PURE__ */ (0,
|
|
13835
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("button", { type: "button", ...keepFocus, "aria-label": "Next month", className: "rounded px-1.5 hover:bg-muted", onClick: () => turn(1), children: "\u203A" })
|
|
13711
13836
|
] }),
|
|
13712
|
-
/* @__PURE__ */ (0,
|
|
13713
|
-
WEEK.map((w) => /* @__PURE__ */ (0,
|
|
13837
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "grid grid-cols-7 gap-0.5 text-center text-[11px]", children: [
|
|
13838
|
+
WEEK.map((w) => /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "text-muted-foreground", children: w }, w)),
|
|
13714
13839
|
cells.map((d, i) => {
|
|
13715
|
-
if (d === null) return /* @__PURE__ */ (0,
|
|
13840
|
+
if (d === null) return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", {}, `blank-${i}`);
|
|
13716
13841
|
const key = `${shown2.y}-${pad(shown2.m + 1)}-${pad(d)}`;
|
|
13717
|
-
return /* @__PURE__ */ (0,
|
|
13842
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
13718
13843
|
"button",
|
|
13719
13844
|
{
|
|
13720
13845
|
type: "button",
|
|
13721
13846
|
...keepFocus,
|
|
13722
13847
|
"data-records-date-helper-day": key,
|
|
13723
|
-
className: (0,
|
|
13848
|
+
className: (0, import_design_system45.cn)(
|
|
13724
13849
|
"h-6 w-6 rounded tabular-nums hover:bg-muted",
|
|
13725
13850
|
key === held.day ? "bg-primary text-primary-foreground hover:bg-primary" : "",
|
|
13726
13851
|
key === todayKey && key !== held.day ? "ring-1 ring-ring" : ""
|
|
@@ -13733,13 +13858,13 @@ function TypedDateHelper({
|
|
|
13733
13858
|
})
|
|
13734
13859
|
] })
|
|
13735
13860
|
] }),
|
|
13736
|
-
kind === "date" ? null : /* @__PURE__ */ (0,
|
|
13861
|
+
kind === "date" ? null : /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "flex max-h-48 flex-col overflow-y-auto pr-1 text-[11px]", "aria-label": "Times", children: times.map((t) => /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
13737
13862
|
"button",
|
|
13738
13863
|
{
|
|
13739
13864
|
type: "button",
|
|
13740
13865
|
...keepFocus,
|
|
13741
13866
|
"data-records-date-helper-time": `${pad(t.h)}:${pad(t.m)}`,
|
|
13742
|
-
className: (0,
|
|
13867
|
+
className: (0, import_design_system45.cn)(
|
|
13743
13868
|
"whitespace-nowrap rounded px-2 py-0.5 text-left tabular-nums hover:bg-muted",
|
|
13744
13869
|
held.time && held.time.h === t.h && held.time.m === t.m ? "bg-primary text-primary-foreground" : ""
|
|
13745
13870
|
),
|
|
@@ -13757,7 +13882,7 @@ function TypedDateHelper({
|
|
|
13757
13882
|
// src/editors.tsx
|
|
13758
13883
|
init_choiceNudge();
|
|
13759
13884
|
init_choiceLooks();
|
|
13760
|
-
var
|
|
13885
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
13761
13886
|
var CHOICE_EDITOR_ADDS_WHAT_IS_TYPED = true;
|
|
13762
13887
|
function isChoiceAddition(value) {
|
|
13763
13888
|
return typeof value === "object" && value !== null && value.addingChoices === true;
|
|
@@ -13787,12 +13912,12 @@ function ChoiceAskButtons({
|
|
|
13787
13912
|
onCancel,
|
|
13788
13913
|
busy
|
|
13789
13914
|
}) {
|
|
13790
|
-
return /* @__PURE__ */ (0,
|
|
13791
|
-
/* @__PURE__ */ (0,
|
|
13792
|
-
/* @__PURE__ */ (0,
|
|
13793
|
-
/* @__PURE__ */ (0,
|
|
13794
|
-
keepOffered ? /* @__PURE__ */ (0,
|
|
13795
|
-
/* @__PURE__ */ (0,
|
|
13915
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("span", { "data-records-choice-ask": "", "data-records-cell-note": "", role: "group", "aria-label": choiceAskSentence(field, words), className: "flex flex-col gap-1", children: [
|
|
13916
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "text-[11px] leading-snug", children: choiceAskSentence(field, words) }),
|
|
13917
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("span", { className: "flex flex-wrap items-center gap-1", children: [
|
|
13918
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_design_system46.Button, { type: "button", size: "sm", className: "h-6 px-2 text-xs", disabled: busy ?? false, onClick: onAdd, children: "Add" }),
|
|
13919
|
+
keepOffered ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_design_system46.Button, { type: "button", size: "sm", variant: "outline", className: "h-6 px-2 text-xs", disabled: busy ?? false, onClick: onKeep, children: "Keep as typed" }) : null,
|
|
13920
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_design_system46.Button, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-2 text-xs", disabled: busy ?? false, onClick: onCancel, children: "Cancel" })
|
|
13796
13921
|
] })
|
|
13797
13922
|
] });
|
|
13798
13923
|
}
|
|
@@ -13901,7 +14026,7 @@ function ReadsAsNote({ typed, always, children }) {
|
|
|
13901
14026
|
setRepeats(words(note.current?.textContent) === words(typed));
|
|
13902
14027
|
}, [typed, always]);
|
|
13903
14028
|
if (repeats) return null;
|
|
13904
|
-
return /* @__PURE__ */ (0,
|
|
14029
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { ref: note, "data-records-typed-reads-as": "", "data-records-cell-note": "", className: "text-[10px] text-muted-foreground", children });
|
|
13905
14030
|
}
|
|
13906
14031
|
function TypedTextControl({ field, value, onChange, disabled, id, onCommit, onCancel }) {
|
|
13907
14032
|
const client = (0, import_react75.useOptionalRecordsClient)();
|
|
@@ -13931,8 +14056,8 @@ function TypedTextControl({ field, value, onChange, disabled, id, onCommit, onCa
|
|
|
13931
14056
|
judged: judgeTyped(field, text, needsChoices ? choices : void 0, needsChoices ? nudge : void 0),
|
|
13932
14057
|
...value.openedAs !== void 0 ? { openedAs: value.openedAs } : {}
|
|
13933
14058
|
});
|
|
13934
|
-
const box = /* @__PURE__ */ (0,
|
|
13935
|
-
|
|
14059
|
+
const box = /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
14060
|
+
import_design_system46.BasicInput,
|
|
13936
14061
|
{
|
|
13937
14062
|
id,
|
|
13938
14063
|
value: value.text,
|
|
@@ -13943,16 +14068,16 @@ function TypedTextControl({ field, value, onChange, disabled, id, onCommit, onCa
|
|
|
13943
14068
|
onChange: (e) => retype(e.target.value)
|
|
13944
14069
|
}
|
|
13945
14070
|
);
|
|
13946
|
-
return /* @__PURE__ */ (0,
|
|
13947
|
-
helper && !disabled ? /* @__PURE__ */ (0,
|
|
14071
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("span", { className: "flex flex-col gap-0.5", children: [
|
|
14072
|
+
helper && !disabled ? /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("span", { className: "flex min-w-0 items-center gap-0.5", children: [
|
|
13948
14073
|
box,
|
|
13949
|
-
/* @__PURE__ */ (0,
|
|
14074
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(TypedDateHelper, { kind: helper, text: value.text, onText: retype, label: fieldName(field), onPicked: onCommit, startOpen: value.openedAs !== void 0 })
|
|
13950
14075
|
] }) : box,
|
|
13951
|
-
judged === null ? /* @__PURE__ */ (0,
|
|
14076
|
+
judged === null ? /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("span", { "data-records-cell-note": "", className: "text-[10px] text-muted-foreground", children: [
|
|
13952
14077
|
"Reading ",
|
|
13953
14078
|
fieldName(field),
|
|
13954
14079
|
"'s choices\u2026"
|
|
13955
|
-
] }) : "ask" in judged ? /* @__PURE__ */ (0,
|
|
14080
|
+
] }) : "ask" in judged ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
13956
14081
|
ChoiceAskButtons,
|
|
13957
14082
|
{
|
|
13958
14083
|
field,
|
|
@@ -13968,10 +14093,10 @@ function TypedTextControl({ field, value, onChange, disabled, id, onCommit, onCa
|
|
|
13968
14093
|
},
|
|
13969
14094
|
onCancel: () => onCancel?.()
|
|
13970
14095
|
}
|
|
13971
|
-
) : "refusal" in judged ? /* @__PURE__ */ (0,
|
|
13972
|
-
/* @__PURE__ */ (0,
|
|
13973
|
-
judged.cancelOnly && onCancel ? /* @__PURE__ */ (0,
|
|
13974
|
-
] }) : judged.value === null || judged.value === void 0 ? null : /* @__PURE__ */ (0,
|
|
14096
|
+
) : "refusal" in judged ? /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_jsx_runtime52.Fragment, { children: [
|
|
14097
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(FloatingRefusal, { text: judged.refusal, why: "why" in judged ? judged.why : void 0 }),
|
|
14098
|
+
judged.cancelOnly && onCancel ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { "data-records-cell-note": "", "data-records-choice-ask": "", children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_design_system46.Button, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-2 text-xs", onClick: () => onCancel(), children: "Cancel" }) }) : null
|
|
14099
|
+
] }) : judged.value === null || judged.value === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(ReadsAsNote, { typed: value.text, always: isChoiceAddition(judged.value), children: [
|
|
13975
14100
|
isChoiceAddition(judged.value) ? `Adds ${quoted(judged.value.add)} to the choices for ${fieldName(field)}. ` : null,
|
|
13976
14101
|
"Reads as",
|
|
13977
14102
|
" ",
|
|
@@ -13982,7 +14107,7 @@ function TypedTextControl({ field, value, onChange, disabled, id, onCommit, onCa
|
|
|
13982
14107
|
}).join(", ")
|
|
13983
14108
|
) : (() => {
|
|
13984
14109
|
const shown2 = format ?? (kind === "datetime" ? { id: carriesTimeOfDay(field, judged.value) ? "datetime" : "date" } : void 0);
|
|
13985
|
-
return shown2 ? /* @__PURE__ */ (0,
|
|
14110
|
+
return shown2 ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(FormattedValue, { value: judged.value, format: shown2 }) : String(judged.value);
|
|
13986
14111
|
})()
|
|
13987
14112
|
] }, value.text)
|
|
13988
14113
|
] });
|
|
@@ -13996,33 +14121,33 @@ function FieldControl({ field, value, onChange, disabled, id, autoOpen, onClose,
|
|
|
13996
14121
|
const kind = editorKindFor(field);
|
|
13997
14122
|
const inputId = id ?? `field-${field.key}`;
|
|
13998
14123
|
const ownDetails = (0, import_react75.useOptionalRecordsClient)() === null;
|
|
13999
|
-
if (isTypedDraft(value)) return /* @__PURE__ */ (0,
|
|
14000
|
-
if (isSignatureField(field)) return /* @__PURE__ */ (0,
|
|
14001
|
-
if ((0, import_records28.isButtonField)(field)) return /* @__PURE__ */ (0,
|
|
14124
|
+
if (isTypedDraft(value)) return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(TypedTextControl, { field, value, onChange, disabled, id: inputId, onCommit, onCancel });
|
|
14125
|
+
if (isSignatureField(field)) return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(SignaturePad, { id: inputId, value, onChange, disabled });
|
|
14126
|
+
if ((0, import_records28.isButtonField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(ButtonValue, { field, recordId: recordId ?? null, beforeSave: !recordId });
|
|
14002
14127
|
const newerControl = newerKindControl({ field, value, onChange, disabled, id: inputId });
|
|
14003
14128
|
if (newerControl !== void 0) return newerControl;
|
|
14004
14129
|
const format = formatForField(field);
|
|
14005
|
-
if (format && format.id === "time") return /* @__PURE__ */ (0,
|
|
14130
|
+
if (format && format.id === "time") return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(TypedWordsControl, { field, value, onChange, disabled, id: inputId });
|
|
14006
14131
|
if (format && !FORMAT_BLIND_KINDS.has(String(kind))) {
|
|
14007
14132
|
const own3 = formatControl({ format, value, onChange, disabled, id: inputId, label: fieldName(field), ownDetails });
|
|
14008
14133
|
if (own3) return own3;
|
|
14009
14134
|
}
|
|
14010
14135
|
if ((kind === "text" || kind === "long_text") && typeof value === "string" && /^\s*(?:\[|\{|```json)/.test(value)) {
|
|
14011
|
-
return /* @__PURE__ */ (0,
|
|
14136
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(StructuredTextControl, { field, value, onChange, disabled, id: inputId, rows: asForm ? 8 : 3 });
|
|
14012
14137
|
}
|
|
14013
14138
|
switch (kind) {
|
|
14014
14139
|
case "formula":
|
|
14015
14140
|
case "lookup":
|
|
14016
14141
|
case "rollup":
|
|
14017
|
-
return /* @__PURE__ */ (0,
|
|
14142
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { id: inputId, className: "rounded border border-dashed px-2 py-1.5 text-xs text-muted-foreground", children: [
|
|
14018
14143
|
value === null || value === void 0 ? "\u2014" : String(value),
|
|
14019
|
-
/* @__PURE__ */ (0,
|
|
14144
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("span", { className: "ml-2 italic", children: [
|
|
14020
14145
|
fieldName(field),
|
|
14021
14146
|
" is calculated, so it cannot be typed in"
|
|
14022
14147
|
] })
|
|
14023
14148
|
] });
|
|
14024
14149
|
case "json":
|
|
14025
|
-
return /* @__PURE__ */ (0,
|
|
14150
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(JsonControl, { field, value, onChange, disabled, id: inputId });
|
|
14026
14151
|
case "long_text":
|
|
14027
14152
|
if (host.textBox) {
|
|
14028
14153
|
return host.textBox({
|
|
@@ -14035,8 +14160,8 @@ function FieldControl({ field, value, onChange, disabled, id, autoOpen, onClose,
|
|
|
14035
14160
|
disabled
|
|
14036
14161
|
});
|
|
14037
14162
|
}
|
|
14038
|
-
return /* @__PURE__ */ (0,
|
|
14039
|
-
|
|
14163
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
14164
|
+
import_design_system46.BasicTextarea,
|
|
14040
14165
|
{
|
|
14041
14166
|
id: inputId,
|
|
14042
14167
|
rows: 3,
|
|
@@ -14048,8 +14173,8 @@ function FieldControl({ field, value, onChange, disabled, id, autoOpen, onClose,
|
|
|
14048
14173
|
case "number":
|
|
14049
14174
|
case "currency":
|
|
14050
14175
|
case "percent":
|
|
14051
|
-
return /* @__PURE__ */ (0,
|
|
14052
|
-
|
|
14176
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
14177
|
+
import_design_system46.BasicInput,
|
|
14053
14178
|
{
|
|
14054
14179
|
id: inputId,
|
|
14055
14180
|
type: "number",
|
|
@@ -14061,12 +14186,12 @@ function FieldControl({ field, value, onChange, disabled, id, autoOpen, onClose,
|
|
|
14061
14186
|
}
|
|
14062
14187
|
);
|
|
14063
14188
|
case "datetime":
|
|
14064
|
-
return /* @__PURE__ */ (0,
|
|
14189
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(TypedWordsControl, { field, value, onChange, disabled, id: inputId });
|
|
14065
14190
|
case "email":
|
|
14066
14191
|
case "phone":
|
|
14067
14192
|
case "url":
|
|
14068
|
-
return /* @__PURE__ */ (0,
|
|
14069
|
-
|
|
14193
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
14194
|
+
import_design_system46.BasicInput,
|
|
14070
14195
|
{
|
|
14071
14196
|
id: inputId,
|
|
14072
14197
|
type: kind === "email" ? "email" : kind === "phone" ? "tel" : "url",
|
|
@@ -14078,25 +14203,25 @@ function FieldControl({ field, value, onChange, disabled, id, autoOpen, onClose,
|
|
|
14078
14203
|
}
|
|
14079
14204
|
);
|
|
14080
14205
|
case "checkbox":
|
|
14081
|
-
return /* @__PURE__ */ (0,
|
|
14206
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(CheckboxControl, { field, value, onChange, disabled, id: inputId });
|
|
14082
14207
|
case "select":
|
|
14083
14208
|
case "multi_select":
|
|
14084
|
-
return /* @__PURE__ */ (0,
|
|
14209
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(OptionControl, { field, value, onChange, disabled, id: inputId, autoOpen, onClose, onCancel, addsChoices, initialSearch, asForm, onChosen });
|
|
14085
14210
|
case "member":
|
|
14086
|
-
return /* @__PURE__ */ (0,
|
|
14211
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(PersonPicker, { field, value, onChange, disabled, id: inputId, autoOpen, onClose, onCancel, initialSearch });
|
|
14087
14212
|
case "entity_reference":
|
|
14088
|
-
return /* @__PURE__ */ (0,
|
|
14213
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(EntityReferenceControl, { field, value, onChange, disabled, id: inputId, autoOpen, onClose, onCancel, initialSearch });
|
|
14089
14214
|
case "attachment":
|
|
14090
14215
|
if (hostTakesFiles(host)) {
|
|
14091
|
-
return /* @__PURE__ */ (0,
|
|
14216
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(AttachmentControl, { field, value, onChange, disabled, id: inputId, autoOpen, onClose });
|
|
14092
14217
|
}
|
|
14093
|
-
return /* @__PURE__ */ (0,
|
|
14218
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(RelationPicker, { field, value, onChange, disabled, id: inputId, excludeId: recordId });
|
|
14094
14219
|
case "relation":
|
|
14095
|
-
return /* @__PURE__ */ (0,
|
|
14220
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(RelationPicker, { field, value, onChange, disabled, id: inputId, onPicked: onCommit, autoOpen, onClose, onCancel, excludeId: recordId });
|
|
14096
14221
|
default:
|
|
14097
14222
|
if (typeof value === "boolean" || field.config?.["kind"] === "boolean") {
|
|
14098
|
-
return /* @__PURE__ */ (0,
|
|
14099
|
-
|
|
14223
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
14224
|
+
import_design_system46.Checkbox,
|
|
14100
14225
|
{
|
|
14101
14226
|
id: inputId,
|
|
14102
14227
|
checked: value === true,
|
|
@@ -14105,8 +14230,8 @@ function FieldControl({ field, value, onChange, disabled, id, autoOpen, onClose,
|
|
|
14105
14230
|
}
|
|
14106
14231
|
);
|
|
14107
14232
|
}
|
|
14108
|
-
return /* @__PURE__ */ (0,
|
|
14109
|
-
|
|
14233
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
14234
|
+
import_design_system46.BasicInput,
|
|
14110
14235
|
{
|
|
14111
14236
|
id: inputId,
|
|
14112
14237
|
...ownDetails && isPersonsName(field) ? { autoComplete: "name" } : {},
|
|
@@ -14141,10 +14266,10 @@ function TypedWordsControl({ field, value, onChange, disabled, id }) {
|
|
|
14141
14266
|
setWhy("why" in judged ? judged.why : void 0);
|
|
14142
14267
|
}
|
|
14143
14268
|
};
|
|
14144
|
-
return /* @__PURE__ */ (0,
|
|
14145
|
-
/* @__PURE__ */ (0,
|
|
14146
|
-
/* @__PURE__ */ (0,
|
|
14147
|
-
|
|
14269
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("span", { className: "flex flex-col gap-0.5", children: [
|
|
14270
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("span", { className: "flex min-w-0 items-center gap-0.5", children: [
|
|
14271
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
14272
|
+
import_design_system46.BasicInput,
|
|
14148
14273
|
{
|
|
14149
14274
|
id,
|
|
14150
14275
|
value: text,
|
|
@@ -14160,9 +14285,9 @@ function TypedWordsControl({ field, value, onChange, disabled, id }) {
|
|
|
14160
14285
|
}
|
|
14161
14286
|
}
|
|
14162
14287
|
),
|
|
14163
|
-
helper && !disabled ? /* @__PURE__ */ (0,
|
|
14288
|
+
helper && !disabled ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(TypedDateHelper, { kind: helper, text, onText: retype, label: fieldName(field) }) : null
|
|
14164
14289
|
] }),
|
|
14165
|
-
refusal ? /* @__PURE__ */ (0,
|
|
14290
|
+
refusal ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(FloatingRefusal, { text: refusal, why }) : null
|
|
14166
14291
|
] });
|
|
14167
14292
|
}
|
|
14168
14293
|
function typedDatePlaceholder(helper) {
|
|
@@ -14173,9 +14298,9 @@ function typedDatePlaceholder(helper) {
|
|
|
14173
14298
|
}
|
|
14174
14299
|
function CheckboxControl({ field, value, onChange, disabled, id }) {
|
|
14175
14300
|
const unanswered = value === null || value === void 0;
|
|
14176
|
-
return /* @__PURE__ */ (0,
|
|
14177
|
-
/* @__PURE__ */ (0,
|
|
14178
|
-
|
|
14301
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
14302
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
14303
|
+
import_design_system46.Checkbox,
|
|
14179
14304
|
{
|
|
14180
14305
|
id,
|
|
14181
14306
|
checked: value === true,
|
|
@@ -14184,10 +14309,10 @@ function CheckboxControl({ field, value, onChange, disabled, id }) {
|
|
|
14184
14309
|
onCheckedChange: (next) => onChange(next === true)
|
|
14185
14310
|
}
|
|
14186
14311
|
),
|
|
14187
|
-
unanswered ? /* @__PURE__ */ (0,
|
|
14188
|
-
/* @__PURE__ */ (0,
|
|
14189
|
-
field.required ? null : /* @__PURE__ */ (0,
|
|
14190
|
-
|
|
14312
|
+
unanswered ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "text-xs italic text-muted-foreground", children: "not answered yet" }) : /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_jsx_runtime52.Fragment, { children: [
|
|
14313
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "text-xs text-muted-foreground", children: value === true ? "Yes" : "No" }),
|
|
14314
|
+
field.required ? null : /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
14315
|
+
import_design_system46.Button,
|
|
14191
14316
|
{
|
|
14192
14317
|
size: "sm",
|
|
14193
14318
|
variant: "ghost",
|
|
@@ -14203,9 +14328,9 @@ function CheckboxControl({ field, value, onChange, disabled, id }) {
|
|
|
14203
14328
|
function StructuredTextControl({ field, value, onChange, disabled, id, rows }) {
|
|
14204
14329
|
const text = typeof value === "string" ? value : "";
|
|
14205
14330
|
const reads = structuredOf(text) !== null;
|
|
14206
|
-
return /* @__PURE__ */ (0,
|
|
14207
|
-
/* @__PURE__ */ (0,
|
|
14208
|
-
|
|
14331
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "flex flex-col gap-1", "data-records-structured-editor": "", children: [
|
|
14332
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
14333
|
+
import_design_system46.BasicTextarea,
|
|
14209
14334
|
{
|
|
14210
14335
|
id,
|
|
14211
14336
|
rows,
|
|
@@ -14216,8 +14341,8 @@ function StructuredTextControl({ field, value, onChange, disabled, id, rows }) {
|
|
|
14216
14341
|
onChange: (e) => onChange(e.target.value === "" ? null : e.target.value)
|
|
14217
14342
|
}
|
|
14218
14343
|
),
|
|
14219
|
-
/* @__PURE__ */ (0,
|
|
14220
|
-
|
|
14344
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "flex h-6 items-center gap-2 text-xs", children: reads ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
14345
|
+
import_design_system46.Button,
|
|
14221
14346
|
{
|
|
14222
14347
|
type: "button",
|
|
14223
14348
|
variant: "ghost",
|
|
@@ -14228,16 +14353,16 @@ function StructuredTextControl({ field, value, onChange, disabled, id, rows }) {
|
|
|
14228
14353
|
"data-records-structured-format": "",
|
|
14229
14354
|
children: "Format"
|
|
14230
14355
|
}
|
|
14231
|
-
) : /* @__PURE__ */ (0,
|
|
14356
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "text-amber-700 dark:text-amber-400", "data-records-structured-broken": "", children: "Not valid JSON \u2014 saves as plain text" }) })
|
|
14232
14357
|
] });
|
|
14233
14358
|
}
|
|
14234
14359
|
function JsonControl({ field, value, onChange, disabled, id }) {
|
|
14235
14360
|
const initial = value === null || value === void 0 ? "" : typeof value === "string" ? value : JSON.stringify(value, null, 2);
|
|
14236
14361
|
const [text, setText] = (0, import_react74.useState)(initial);
|
|
14237
14362
|
const [broken, setBroken] = (0, import_react74.useState)(null);
|
|
14238
|
-
return /* @__PURE__ */ (0,
|
|
14239
|
-
/* @__PURE__ */ (0,
|
|
14240
|
-
|
|
14363
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
14364
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
14365
|
+
import_design_system46.BasicTextarea,
|
|
14241
14366
|
{
|
|
14242
14367
|
id,
|
|
14243
14368
|
rows: 4,
|
|
@@ -14271,7 +14396,7 @@ function JsonControl({ field, value, onChange, disabled, id }) {
|
|
|
14271
14396
|
broken ? (
|
|
14272
14397
|
// The typed text is still in the box: the notice owns the two doors out. In a grid cell it
|
|
14273
14398
|
// floats over the table (`data-records-cell-note`), so the row never grows.
|
|
14274
|
-
/* @__PURE__ */ (0,
|
|
14399
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { "data-records-cell-note": "", className: "block", children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
14275
14400
|
RefusalNotice,
|
|
14276
14401
|
{
|
|
14277
14402
|
error: broken,
|
|
@@ -14313,12 +14438,12 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
|
|
|
14313
14438
|
}, [client, field.id, reread]);
|
|
14314
14439
|
const handed = publicChoicesOf(field);
|
|
14315
14440
|
if (!client && handed.length > 0) {
|
|
14316
|
-
return /* @__PURE__ */ (0,
|
|
14441
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(ChoiceAnswer, { field, choices: handed, value, onChange, disabled, id, onChosen });
|
|
14317
14442
|
}
|
|
14318
14443
|
if (!client) {
|
|
14319
|
-
return /* @__PURE__ */ (0,
|
|
14320
|
-
/* @__PURE__ */ (0,
|
|
14321
|
-
|
|
14444
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
14445
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
14446
|
+
import_design_system46.BasicInput,
|
|
14322
14447
|
{
|
|
14323
14448
|
id,
|
|
14324
14449
|
value: value === null || value === void 0 ? "" : String(value),
|
|
@@ -14326,15 +14451,15 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
|
|
|
14326
14451
|
onChange: (e) => onChange(e.target.value === "" ? null : e.target.value)
|
|
14327
14452
|
}
|
|
14328
14453
|
),
|
|
14329
|
-
/* @__PURE__ */ (0,
|
|
14454
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("p", { className: "text-xs text-muted-foreground", children: "This is normally picked from a list. A page answered without an account cannot read that list, so type your answer and whoever receives it will match it up." })
|
|
14330
14455
|
] });
|
|
14331
14456
|
}
|
|
14332
14457
|
if (refusal)
|
|
14333
|
-
return /* @__PURE__ */ (0,
|
|
14334
|
-
if (!options) return /* @__PURE__ */ (0,
|
|
14458
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { id, children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(RefusalLine, { error: refusal }) });
|
|
14459
|
+
if (!options) return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("p", { id, className: "text-xs text-muted-foreground", children: "Reading this field's choices\u2026" });
|
|
14335
14460
|
if (asForm && options.length > 0) {
|
|
14336
14461
|
const titled = (option) => recordName(option.data, null, "Unnamed choice");
|
|
14337
|
-
return /* @__PURE__ */ (0,
|
|
14462
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
14338
14463
|
ChoiceAnswer,
|
|
14339
14464
|
{
|
|
14340
14465
|
field,
|
|
@@ -14352,7 +14477,7 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
|
|
|
14352
14477
|
);
|
|
14353
14478
|
}
|
|
14354
14479
|
const noChoicesYet = client && options.length === 0 && !disabled;
|
|
14355
|
-
const offerChoices = noChoicesYet ? /* @__PURE__ */ (0,
|
|
14480
|
+
const offerChoices = noChoicesYet ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
14356
14481
|
AddChoicesInline,
|
|
14357
14482
|
{
|
|
14358
14483
|
field,
|
|
@@ -14363,9 +14488,9 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
|
|
|
14363
14488
|
}
|
|
14364
14489
|
) : null;
|
|
14365
14490
|
if (CHOICE_EDITOR_ADDS_WHAT_IS_TYPED) {
|
|
14366
|
-
return /* @__PURE__ */ (0,
|
|
14491
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_jsx_runtime52.Fragment, { children: [
|
|
14367
14492
|
offerChoices,
|
|
14368
|
-
/* @__PURE__ */ (0,
|
|
14493
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
14369
14494
|
OpenChoicePicker,
|
|
14370
14495
|
{
|
|
14371
14496
|
field,
|
|
@@ -14389,14 +14514,14 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
|
|
|
14389
14514
|
] });
|
|
14390
14515
|
}
|
|
14391
14516
|
if (options.length === 0) {
|
|
14392
|
-
return /* @__PURE__ */ (0,
|
|
14517
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("p", { id, className: "text-xs text-muted-foreground", children: field.options_table_id ? `${fieldName(field)} takes its choices from a Table that has no records yet \u2014 add the choices there and they appear here.` : `${fieldName(field)} does not name the Table its choices come from yet, so there is nothing to choose. A table admin sets it in the field editor.` });
|
|
14393
14518
|
}
|
|
14394
14519
|
const titleOf = (option) => recordName(option.data, null, "Unnamed choice");
|
|
14395
14520
|
if (field.multi) {
|
|
14396
14521
|
const chosen = options.filter((option) => (0, import_records28.choiceValuesOf)(value).some((v) => (0, import_records28.isTheChosen)(option, v)));
|
|
14397
14522
|
const picked = new Set(chosen.map((option) => (0, import_records28.optionKey)(option)));
|
|
14398
|
-
const toggles = /* @__PURE__ */ (0,
|
|
14399
|
-
|
|
14523
|
+
const toggles = /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { id: autoOpen ? void 0 : id, className: "flex flex-wrap gap-1", children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
14524
|
+
import_design_system46.Button,
|
|
14400
14525
|
{
|
|
14401
14526
|
type: "button",
|
|
14402
14527
|
size: "sm",
|
|
@@ -14413,23 +14538,23 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
|
|
|
14413
14538
|
option.id
|
|
14414
14539
|
)) });
|
|
14415
14540
|
if (!autoOpen) return toggles;
|
|
14416
|
-
return /* @__PURE__ */ (0,
|
|
14417
|
-
|
|
14541
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
|
|
14542
|
+
import_design_system46.Popover,
|
|
14418
14543
|
{
|
|
14419
14544
|
defaultOpen: true,
|
|
14420
14545
|
onOpenChange: (open) => {
|
|
14421
14546
|
if (!open) onClose?.();
|
|
14422
14547
|
},
|
|
14423
14548
|
children: [
|
|
14424
|
-
/* @__PURE__ */ (0,
|
|
14425
|
-
/* @__PURE__ */ (0,
|
|
14549
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_design_system46.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_design_system46.Button, { id, type: "button", size: "sm", variant: "outline", className: "h-6 max-w-full truncate", children: chosen.length === 0 ? "Choose" : chosen.map(titleOf).join(", ") }) }),
|
|
14550
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_design_system46.PopoverContent, { sizing: "content", className: "max-w-[20rem] p-2", align: "start", children: toggles })
|
|
14426
14551
|
]
|
|
14427
14552
|
}
|
|
14428
14553
|
);
|
|
14429
14554
|
}
|
|
14430
14555
|
const current = options.find((option) => (0, import_records28.isTheChosen)(option, value));
|
|
14431
|
-
return /* @__PURE__ */ (0,
|
|
14432
|
-
|
|
14556
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
|
|
14557
|
+
import_design_system46.Select,
|
|
14433
14558
|
{
|
|
14434
14559
|
value: current ? (0, import_records28.optionKey)(current) : "",
|
|
14435
14560
|
disabled: disabled ?? false,
|
|
@@ -14442,8 +14567,8 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
|
|
|
14442
14567
|
}
|
|
14443
14568
|
} : {},
|
|
14444
14569
|
children: [
|
|
14445
|
-
/* @__PURE__ */ (0,
|
|
14446
|
-
/* @__PURE__ */ (0,
|
|
14570
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_design_system46.SelectTrigger, { id, size: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_design_system46.SelectValue, { placeholder: "Choose" }) }),
|
|
14571
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_design_system46.SelectContent, { children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_design_system46.SelectItem, { value: (0, import_records28.optionKey)(option), children: titleOf(option) }, option.id)) })
|
|
14447
14572
|
]
|
|
14448
14573
|
}
|
|
14449
14574
|
);
|
|
@@ -14532,7 +14657,7 @@ function OpenChoicePicker({
|
|
|
14532
14657
|
const pickedOptions = current.map((v) => options.find((o) => (0, import_records28.isTheChosen)(o, v)));
|
|
14533
14658
|
const cellChips = pickedWords.map((word, i) => {
|
|
14534
14659
|
const chip = chipOf(pickedOptions[i], word);
|
|
14535
|
-
return /* @__PURE__ */ (0,
|
|
14660
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_design_system46.Badge, { variant: "outline", className: (0, import_design_system46.cn)("text-[11px]", chip.className), "data-records-choice-chip": "", children: word }, word);
|
|
14536
14661
|
});
|
|
14537
14662
|
const headChips = pickedWords.map((word, i) => {
|
|
14538
14663
|
const option = pickedOptions[i];
|
|
@@ -14547,12 +14672,12 @@ function OpenChoicePicker({
|
|
|
14547
14672
|
};
|
|
14548
14673
|
});
|
|
14549
14674
|
const anchored = autoOpen === true;
|
|
14550
|
-
return /* @__PURE__ */ (0,
|
|
14675
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { id, className: "flex flex-wrap items-center gap-1", children: [
|
|
14551
14676
|
anchored || disabled ? null : cellChips,
|
|
14552
14677
|
disabled ? cellChips : (
|
|
14553
14678
|
// THE ONE "PICK OR ADD" BUILDER (PickOrAdd.tsx) — the relation picker draws the same one.
|
|
14554
14679
|
// In a grid cell it hangs from the cell's own chips; no button is drawn in the cell.
|
|
14555
|
-
/* @__PURE__ */ (0,
|
|
14680
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
14556
14681
|
PickOrAdd,
|
|
14557
14682
|
{
|
|
14558
14683
|
anchored,
|
|
@@ -14578,14 +14703,14 @@ function OpenChoicePicker({
|
|
|
14578
14703
|
const option = options.find((o) => o.id === optionId);
|
|
14579
14704
|
if (option) choose((0, import_records28.optionKey)(option));
|
|
14580
14705
|
},
|
|
14581
|
-
empty: q === "" ? /* @__PURE__ */ (0,
|
|
14706
|
+
empty: q === "" ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("p", { className: "p-2 text-xs text-muted-foreground", children: "No choices yet \u2014 type one to add it." }) : null,
|
|
14582
14707
|
add,
|
|
14583
14708
|
foot,
|
|
14584
|
-
footNote: addRefused ? /* @__PURE__ */ (0,
|
|
14709
|
+
footNote: addRefused ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(RefusalLine, { error: addRefused }) : offList && decided.decision === "not_a_choice" ? (
|
|
14585
14710
|
// never_add on a column that takes only its choices: said, never a silent nothing.
|
|
14586
|
-
/* @__PURE__ */ (0,
|
|
14587
|
-
/* @__PURE__ */ (0,
|
|
14588
|
-
autoOpen ? /* @__PURE__ */ (0,
|
|
14711
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_jsx_runtime52.Fragment, { children: [
|
|
14712
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("p", { "data-records-typed-refusal": "", className: "p-2 text-xs text-muted-foreground", children: notAChoiceSentence(field, [q]) }),
|
|
14713
|
+
autoOpen ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { "data-records-choice-ask": "", className: "px-2 pb-1", children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_design_system46.Button, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-2 text-xs", onClick: () => setOpen(false), children: "Cancel" }) }) : null
|
|
14589
14714
|
] })
|
|
14590
14715
|
) : null,
|
|
14591
14716
|
children: anchored ? cellChips : null
|
|
@@ -14605,9 +14730,9 @@ function RecordChip({
|
|
|
14605
14730
|
// name. So it caps at its container and ends in an ellipsis with the whole name in
|
|
14606
14731
|
// its tooltip, rather than being cut mid-word by whatever box it landed in
|
|
14607
14732
|
// (lane FIX-14, 2026-09-22).
|
|
14608
|
-
/* @__PURE__ */ (0,
|
|
14609
|
-
/* @__PURE__ */ (0,
|
|
14610
|
-
onRemove ? /* @__PURE__ */ (0,
|
|
14733
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_design_system46.Badge, { variant: "secondary", className: (0, import_design_system46.cn)("max-w-full gap-1 text-[11px]", className), title, children: [
|
|
14734
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "min-w-0 truncate", children: title }),
|
|
14735
|
+
onRemove ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("button", { type: "button", onClick: onRemove, "aria-label": `Remove ${title}`, className: "shrink-0 opacity-60 hover:opacity-100", children: "\xD7" }) : null
|
|
14611
14736
|
] })
|
|
14612
14737
|
);
|
|
14613
14738
|
}
|
|
@@ -14649,7 +14774,7 @@ function ChoiceAnswer({
|
|
|
14649
14774
|
const option = (choice) => {
|
|
14650
14775
|
const chosen = on(choice);
|
|
14651
14776
|
const letter = lettered ? CHOICE_LETTERS[choices.indexOf(choice)] : null;
|
|
14652
|
-
return /* @__PURE__ */ (0,
|
|
14777
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
|
|
14653
14778
|
"button",
|
|
14654
14779
|
{
|
|
14655
14780
|
type: "button",
|
|
@@ -14660,24 +14785,24 @@ function ChoiceAnswer({
|
|
|
14660
14785
|
tabIndex: field.multi || choice.key === tabStop ? 0 : -1,
|
|
14661
14786
|
onClick: () => press(choice),
|
|
14662
14787
|
"data-records-choice-answer": choice.key,
|
|
14663
|
-
className: (0,
|
|
14788
|
+
className: (0, import_design_system46.cn)(
|
|
14664
14789
|
"flex min-h-11 w-full items-center gap-3 rounded-md border px-3 py-2 text-left text-base font-medium text-foreground transition-colors sm:min-h-10 sm:text-sm",
|
|
14665
14790
|
chosen ? "border-primary bg-primary/10" : "border-primary/30 bg-primary/[0.03] hover:bg-primary/10"
|
|
14666
14791
|
),
|
|
14667
14792
|
children: [
|
|
14668
|
-
letter ? /* @__PURE__ */ (0,
|
|
14793
|
+
letter ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
14669
14794
|
"kbd",
|
|
14670
14795
|
{
|
|
14671
14796
|
"aria-hidden": "true",
|
|
14672
|
-
className: (0,
|
|
14797
|
+
className: (0, import_design_system46.cn)(
|
|
14673
14798
|
"inline-flex h-6 w-6 shrink-0 items-center justify-center rounded border font-sans text-xs font-semibold",
|
|
14674
14799
|
chosen ? "border-primary bg-primary text-primary-foreground" : "border-primary/40 text-primary"
|
|
14675
14800
|
),
|
|
14676
14801
|
children: letter
|
|
14677
14802
|
}
|
|
14678
14803
|
) : null,
|
|
14679
|
-
/* @__PURE__ */ (0,
|
|
14680
|
-
chosen ? /* @__PURE__ */ (0,
|
|
14804
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "min-w-0 flex-1 break-words", children: choice.label }),
|
|
14805
|
+
chosen ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { "aria-hidden": "true", className: "shrink-0 text-primary", children: "\u2713" }) : null
|
|
14681
14806
|
]
|
|
14682
14807
|
},
|
|
14683
14808
|
choice.key
|
|
@@ -14710,13 +14835,13 @@ function ChoiceAnswer({
|
|
|
14710
14835
|
};
|
|
14711
14836
|
const group = { role: field.multi ? "group" : "radiogroup", "aria-label": fieldName(field), onKeyDown };
|
|
14712
14837
|
if (choices.length <= FORM_SEARCH_AFTER) {
|
|
14713
|
-
return /* @__PURE__ */ (0,
|
|
14838
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { id, className: "flex w-full flex-col gap-2", ...group, children: choices.map(option) });
|
|
14714
14839
|
}
|
|
14715
14840
|
const q = search.trim().toLowerCase();
|
|
14716
14841
|
const shown2 = q === "" ? choices : choices.filter((c) => c.label.toLowerCase().includes(q));
|
|
14717
|
-
return /* @__PURE__ */ (0,
|
|
14718
|
-
/* @__PURE__ */ (0,
|
|
14719
|
-
|
|
14842
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { id, className: "flex w-full flex-col gap-2", onKeyDown, children: [
|
|
14843
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
14844
|
+
import_design_system46.BasicInput,
|
|
14720
14845
|
{
|
|
14721
14846
|
value: search,
|
|
14722
14847
|
onChange: (e) => setSearch(e.target.value),
|
|
@@ -14726,9 +14851,9 @@ function ChoiceAnswer({
|
|
|
14726
14851
|
className: "h-11 text-base sm:h-9 sm:text-sm"
|
|
14727
14852
|
}
|
|
14728
14853
|
),
|
|
14729
|
-
/* @__PURE__ */ (0,
|
|
14854
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "flex max-h-80 w-full flex-col gap-2 overflow-y-auto", role: group.role, "aria-label": group["aria-label"], children: [
|
|
14730
14855
|
shown2.map(option),
|
|
14731
|
-
shown2.length === 0 ? /* @__PURE__ */ (0,
|
|
14856
|
+
shown2.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("p", { className: "text-xs text-muted-foreground", children: "No match" }) : null
|
|
14732
14857
|
] })
|
|
14733
14858
|
] });
|
|
14734
14859
|
}
|
|
@@ -14748,7 +14873,7 @@ var dataSources = (0, import_global_slot2.globalSlot)("ai-matrx.records-ui.data-
|
|
|
14748
14873
|
|
|
14749
14874
|
// src/RecordsMount.tsx
|
|
14750
14875
|
var import_react77 = require("@ai-matrx/records/react");
|
|
14751
|
-
var
|
|
14876
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
14752
14877
|
|
|
14753
14878
|
// src/TablePickers.tsx
|
|
14754
14879
|
init_tablePicking();
|
|
@@ -14756,7 +14881,7 @@ init_Refusal();
|
|
|
14756
14881
|
init_refusals();
|
|
14757
14882
|
init_plainWords();
|
|
14758
14883
|
var import_field_formats13 = require("@ai-matrx/design-system/field-formats");
|
|
14759
|
-
var
|
|
14884
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
14760
14885
|
var SHARED_FOR_MS = 5e3;
|
|
14761
14886
|
var sharedReads = /* @__PURE__ */ new WeakMap();
|
|
14762
14887
|
function readTablesAnywhere(dataSource) {
|
|
@@ -14818,7 +14943,7 @@ function TablePicker({ dataSource, value, onChange, disabled, tables }) {
|
|
|
14818
14943
|
const secondOf = (r) => [r.created_by_name ? `by ${r.created_by_name}` : null, r.updated_at ? `changed ${new Date(r.updated_at).toLocaleDateString(void 0, (0, import_field_formats13.momentZoneOptions)(r.updated_at))}` : null].filter(Boolean).join(" \xB7 ");
|
|
14819
14944
|
const base = secondOf(row);
|
|
14820
14945
|
const alike = options.filter((o) => o.organization_id === t.organization_id && o.table_name.trim().toLowerCase() === t.table_name.trim().toLowerCase() && secondOf(o) === base).length;
|
|
14821
|
-
const second = alike > 1 ? [base, `#${
|
|
14946
|
+
const second = alike > 1 ? [base, `#${(0, import_design_system47.displayId)(t.table_id)}`].filter(Boolean).join(" \xB7 ") : base;
|
|
14822
14947
|
return {
|
|
14823
14948
|
value: t.table_id,
|
|
14824
14949
|
// The organization hint already tells two same-named tables apart across organizations.
|
|
@@ -14826,17 +14951,17 @@ function TablePicker({ dataSource, value, onChange, disabled, tables }) {
|
|
|
14826
14951
|
hint: t.organization_name,
|
|
14827
14952
|
keywords: t.organization_name,
|
|
14828
14953
|
...twin && second ? {
|
|
14829
|
-
render: /* @__PURE__ */ (0,
|
|
14830
|
-
/* @__PURE__ */ (0,
|
|
14831
|
-
/* @__PURE__ */ (0,
|
|
14954
|
+
render: /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("span", { className: "flex min-w-0 flex-col", children: [
|
|
14955
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "truncate", children: t.table_name }),
|
|
14956
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "truncate text-[11px] text-muted-foreground", children: second })
|
|
14832
14957
|
] })
|
|
14833
14958
|
} : {}
|
|
14834
14959
|
};
|
|
14835
14960
|
});
|
|
14836
14961
|
const missing = Boolean(value) && !list.loading && !list.error && !list.rows.some((t) => t.table_id === value);
|
|
14837
|
-
return /* @__PURE__ */ (0,
|
|
14838
|
-
/* @__PURE__ */ (0,
|
|
14839
|
-
|
|
14962
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
14963
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
14964
|
+
import_design_system47.CreatablePicker,
|
|
14840
14965
|
{
|
|
14841
14966
|
value: value || null,
|
|
14842
14967
|
options: pickerOptions,
|
|
@@ -14849,17 +14974,17 @@ function TablePicker({ dataSource, value, onChange, disabled, tables }) {
|
|
|
14849
14974
|
ariaLabel: "Table"
|
|
14850
14975
|
}
|
|
14851
14976
|
),
|
|
14852
|
-
list.error && /* @__PURE__ */ (0,
|
|
14853
|
-
missing && /* @__PURE__ */ (0,
|
|
14977
|
+
list.error && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(RefusalLine, { error: (0, refusals_exports.refusal)("door", list.error, "Try again in a moment.") }),
|
|
14978
|
+
missing && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("p", { className: "text-[11px] text-destructive", children: "This table is archived or not shared with you." })
|
|
14854
14979
|
] });
|
|
14855
14980
|
}
|
|
14856
14981
|
function TableScope({ dataSource, userId, tableId, children, fallback = null, unavailable, tables }) {
|
|
14857
14982
|
const own3 = useTablesAnywhere(dataSource);
|
|
14858
14983
|
const list = tables ?? own3;
|
|
14859
14984
|
const organizationId = list.rows.find((t) => t.table_id === tableId)?.organization_id ?? null;
|
|
14860
|
-
if (tableId && !organizationId && !list.loading) return /* @__PURE__ */ (0,
|
|
14861
|
-
if (!tableId || !organizationId) return /* @__PURE__ */ (0,
|
|
14862
|
-
return /* @__PURE__ */ (0,
|
|
14985
|
+
if (tableId && !organizationId && !list.loading) return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_jsx_runtime54.Fragment, { children: unavailable ?? fallback });
|
|
14986
|
+
if (!tableId || !organizationId) return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_jsx_runtime54.Fragment, { children: fallback });
|
|
14987
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_react79.RecordsProvider, { config: { dataSource, actor: personActor(userId), organizationId }, children });
|
|
14863
14988
|
}
|
|
14864
14989
|
function ColumnValuesEditor({ tableId, value, onChange, disabled, addLabel }) {
|
|
14865
14990
|
const fields = (0, import_react79.useFields)(tableId);
|
|
@@ -14879,11 +15004,11 @@ function ColumnValuesEditor({ tableId, value, onChange, disabled, addLabel }) {
|
|
|
14879
15004
|
void _gone;
|
|
14880
15005
|
onChange(rest);
|
|
14881
15006
|
};
|
|
14882
|
-
return /* @__PURE__ */ (0,
|
|
14883
|
-
fields.error && /* @__PURE__ */ (0,
|
|
15007
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
15008
|
+
fields.error && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(RefusalLine, { error: fields.error }),
|
|
14884
15009
|
keys.map((key) => {
|
|
14885
15010
|
const field = byKey.get(key);
|
|
14886
|
-
return /* @__PURE__ */ (0,
|
|
15011
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
14887
15012
|
ColumnValueRow,
|
|
14888
15013
|
{
|
|
14889
15014
|
columnKey: key,
|
|
@@ -14899,7 +15024,7 @@ function ColumnValuesEditor({ tableId, value, onChange, disabled, addLabel }) {
|
|
|
14899
15024
|
key
|
|
14900
15025
|
);
|
|
14901
15026
|
}),
|
|
14902
|
-
adding && /* @__PURE__ */ (0,
|
|
15027
|
+
adding && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
14903
15028
|
ColumnValueRow,
|
|
14904
15029
|
{
|
|
14905
15030
|
columnKey: null,
|
|
@@ -14916,7 +15041,7 @@ function ColumnValuesEditor({ tableId, value, onChange, disabled, addLabel }) {
|
|
|
14916
15041
|
onRemove: () => setAdding(false)
|
|
14917
15042
|
}
|
|
14918
15043
|
),
|
|
14919
|
-
!disabled && !adding && keys.length < all.length && /* @__PURE__ */ (0,
|
|
15044
|
+
!disabled && !adding && keys.length < all.length && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_design_system47.Button, { type: "button", variant: "outline", size: "sm", className: "self-start", onClick: () => setAdding(true), children: addLabel })
|
|
14920
15045
|
] });
|
|
14921
15046
|
}
|
|
14922
15047
|
function ColumnValueRow({
|
|
@@ -14932,10 +15057,10 @@ function ColumnValueRow({
|
|
|
14932
15057
|
}) {
|
|
14933
15058
|
const orphan = columnKey !== null && !loading && field === void 0;
|
|
14934
15059
|
const shown2 = orphan ? [{ value: columnKey, label: columnKey, hint: "Not a column" }, ...options] : options;
|
|
14935
|
-
return /* @__PURE__ */ (0,
|
|
14936
|
-
/* @__PURE__ */ (0,
|
|
14937
|
-
/* @__PURE__ */ (0,
|
|
14938
|
-
|
|
15060
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex flex-col gap-1 rounded-md border border-border/60 p-2", children: [
|
|
15061
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
15062
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
15063
|
+
import_design_system47.CreatablePicker,
|
|
14939
15064
|
{
|
|
14940
15065
|
value: columnKey,
|
|
14941
15066
|
options: shown2,
|
|
@@ -14948,9 +15073,9 @@ function ColumnValueRow({
|
|
|
14948
15073
|
ariaLabel: "Column"
|
|
14949
15074
|
}
|
|
14950
15075
|
) }),
|
|
14951
|
-
!disabled && /* @__PURE__ */ (0,
|
|
15076
|
+
!disabled && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_design_system47.Button, { type: "button", variant: "ghost", size: "sm", "aria-label": "Remove", onClick: onRemove, children: "\u2715" })
|
|
14952
15077
|
] }),
|
|
14953
|
-
field ? /* @__PURE__ */ (0,
|
|
15078
|
+
field ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(FieldControl, { field, value, onChange: onValue, disabled }) : orphan ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("p", { className: "text-[11px] text-muted-foreground", children: value === null || value === void 0 ? "\u2014" : String(value) }) : null
|
|
14954
15079
|
] });
|
|
14955
15080
|
}
|
|
14956
15081
|
function RecordPicker({ tableId, value, onChange, disabled }) {
|
|
@@ -14962,9 +15087,9 @@ function RecordPicker({ tableId, value, onChange, disabled }) {
|
|
|
14962
15087
|
label: rowNameIn(table.data ?? null, row)
|
|
14963
15088
|
}));
|
|
14964
15089
|
const missing = Boolean(value) && !records.loading && !records.error && !rows.some((r) => r.id === value);
|
|
14965
|
-
return /* @__PURE__ */ (0,
|
|
14966
|
-
/* @__PURE__ */ (0,
|
|
14967
|
-
|
|
15090
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
15091
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
15092
|
+
import_design_system47.CreatablePicker,
|
|
14968
15093
|
{
|
|
14969
15094
|
value: value || null,
|
|
14970
15095
|
options,
|
|
@@ -14977,7 +15102,7 @@ function RecordPicker({ tableId, value, onChange, disabled }) {
|
|
|
14977
15102
|
ariaLabel: "Record"
|
|
14978
15103
|
}
|
|
14979
15104
|
),
|
|
14980
|
-
records.error && /* @__PURE__ */ (0,
|
|
15105
|
+
records.error && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(RefusalLine, { error: records.error })
|
|
14981
15106
|
] });
|
|
14982
15107
|
}
|
|
14983
15108
|
|
|
@@ -14985,9 +15110,9 @@ function RecordPicker({ tableId, value, onChange, disabled }) {
|
|
|
14985
15110
|
var import_react80 = require("react");
|
|
14986
15111
|
var import_records29 = require("@ai-matrx/records");
|
|
14987
15112
|
var import_react81 = require("@ai-matrx/records/react");
|
|
14988
|
-
var
|
|
15113
|
+
var import_design_system48 = require("@ai-matrx/design-system");
|
|
14989
15114
|
init_names();
|
|
14990
|
-
var
|
|
15115
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
14991
15116
|
var DATA_BINDING_SHAPES = [
|
|
14992
15117
|
{ value: "collection", label: "The whole table" },
|
|
14993
15118
|
{ value: "reference", label: "One record" },
|
|
@@ -15054,9 +15179,9 @@ function DataBindingPicker({ dataSource, userId, binding, onChange, disabled, de
|
|
|
15054
15179
|
...binding.semantic_type === "collection" && defaultRowLimit ? { limit: defaultRowLimit } : {}
|
|
15055
15180
|
});
|
|
15056
15181
|
};
|
|
15057
|
-
return /* @__PURE__ */ (0,
|
|
15058
|
-
/* @__PURE__ */ (0,
|
|
15059
|
-
/* @__PURE__ */ (0,
|
|
15182
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
15183
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(TablePicker, { dataSource, value: tableId, onChange: selectTable, disabled: Boolean(disabled), tables }),
|
|
15184
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(TableScope, { dataSource, userId, tableId, tables, children: tableId && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
15060
15185
|
BindingDetails,
|
|
15061
15186
|
{
|
|
15062
15187
|
tableId,
|
|
@@ -15120,9 +15245,9 @@ function BindingDetails({
|
|
|
15120
15245
|
const fieldOptions = fieldList.map((f) => ({ value: f.key, label: fieldName(f) }));
|
|
15121
15246
|
const template = binding.transform?.template ?? "";
|
|
15122
15247
|
const setTemplate = (next) => onChange({ ...binding, transform: { join: "\n", ...binding.transform, name: "list", template: next } });
|
|
15123
|
-
return /* @__PURE__ */ (0,
|
|
15124
|
-
/* @__PURE__ */ (0,
|
|
15125
|
-
|
|
15248
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
15249
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "flex flex-wrap gap-1", role: "radiogroup", "aria-label": "What to read", children: DATA_BINDING_SHAPES.map((s) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
15250
|
+
import_design_system48.Button,
|
|
15126
15251
|
{
|
|
15127
15252
|
type: "button",
|
|
15128
15253
|
size: "sm",
|
|
@@ -15135,7 +15260,7 @@ function BindingDetails({
|
|
|
15135
15260
|
},
|
|
15136
15261
|
s.value
|
|
15137
15262
|
)) }),
|
|
15138
|
-
shape !== "collection" && /* @__PURE__ */ (0,
|
|
15263
|
+
shape !== "collection" && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
15139
15264
|
RecordPicker,
|
|
15140
15265
|
{
|
|
15141
15266
|
tableId,
|
|
@@ -15144,8 +15269,8 @@ function BindingDetails({
|
|
|
15144
15269
|
disabled: Boolean(disabled)
|
|
15145
15270
|
}
|
|
15146
15271
|
),
|
|
15147
|
-
shape === "value" && /* @__PURE__ */ (0,
|
|
15148
|
-
|
|
15272
|
+
shape === "value" && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
15273
|
+
import_design_system48.CreatablePicker,
|
|
15149
15274
|
{
|
|
15150
15275
|
value: binding.field_key ?? null,
|
|
15151
15276
|
options: fieldOptions,
|
|
@@ -15158,11 +15283,11 @@ function BindingDetails({
|
|
|
15158
15283
|
ariaLabel: "Column"
|
|
15159
15284
|
}
|
|
15160
15285
|
),
|
|
15161
|
-
shape !== "value" && /* @__PURE__ */ (0,
|
|
15162
|
-
/* @__PURE__ */ (0,
|
|
15286
|
+
shape !== "value" && /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
15287
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
15163
15288
|
"textarea",
|
|
15164
15289
|
{
|
|
15165
|
-
className: (0,
|
|
15290
|
+
className: (0, import_design_system48.cn)(
|
|
15166
15291
|
"min-h-[3.5rem] w-full rounded-md border border-border bg-background px-2 py-1.5 font-mono text-xs"
|
|
15167
15292
|
),
|
|
15168
15293
|
"aria-label": "Each row reads as",
|
|
@@ -15171,8 +15296,8 @@ function BindingDetails({
|
|
|
15171
15296
|
onChange: (e) => setTemplate(e.target.value)
|
|
15172
15297
|
}
|
|
15173
15298
|
),
|
|
15174
|
-
!disabled && /* @__PURE__ */ (0,
|
|
15175
|
-
|
|
15299
|
+
!disabled && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "flex flex-wrap gap-1", children: fieldList.flatMap(bindingPlaceholdersFor).map((p) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
15300
|
+
import_design_system48.Button,
|
|
15176
15301
|
{
|
|
15177
15302
|
type: "button",
|
|
15178
15303
|
size: "sm",
|
|
@@ -15184,10 +15309,10 @@ function BindingDetails({
|
|
|
15184
15309
|
p.token
|
|
15185
15310
|
)) })
|
|
15186
15311
|
] }),
|
|
15187
|
-
shape === "collection" && /* @__PURE__ */ (0,
|
|
15312
|
+
shape === "collection" && /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("label", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
|
|
15188
15313
|
"Up to",
|
|
15189
|
-
/* @__PURE__ */ (0,
|
|
15190
|
-
|
|
15314
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
15315
|
+
import_design_system48.BasicInput,
|
|
15191
15316
|
{
|
|
15192
15317
|
type: "number",
|
|
15193
15318
|
min: 1,
|
|
@@ -15203,10 +15328,10 @@ function BindingDetails({
|
|
|
15203
15328
|
),
|
|
15204
15329
|
"rows"
|
|
15205
15330
|
] }),
|
|
15206
|
-
/* @__PURE__ */ (0,
|
|
15207
|
-
/* @__PURE__ */ (0,
|
|
15208
|
-
DATA_BINDING_MISSING.map((m) => /* @__PURE__ */ (0,
|
|
15209
|
-
|
|
15331
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "radiogroup", "aria-label": "If nothing is found", children: [
|
|
15332
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "text-xs text-muted-foreground", children: "If nothing is found" }),
|
|
15333
|
+
DATA_BINDING_MISSING.map((m) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
15334
|
+
import_design_system48.Button,
|
|
15210
15335
|
{
|
|
15211
15336
|
type: "button",
|
|
15212
15337
|
size: "sm",
|
|
@@ -15226,13 +15351,13 @@ function BindingDetails({
|
|
|
15226
15351
|
// src/PickedSummaries.tsx
|
|
15227
15352
|
var import_react82 = require("@ai-matrx/records/react");
|
|
15228
15353
|
init_names();
|
|
15229
|
-
var
|
|
15354
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
15230
15355
|
function TableNameText({ dataSource, tableId }) {
|
|
15231
15356
|
const tables = useTablesAnywhere(dataSource);
|
|
15232
|
-
if (!tableId) return /* @__PURE__ */ (0,
|
|
15233
|
-
if (tables.loading) return /* @__PURE__ */ (0,
|
|
15234
|
-
if (tables.error) return /* @__PURE__ */ (0,
|
|
15235
|
-
return /* @__PURE__ */ (0,
|
|
15357
|
+
if (!tableId) return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_jsx_runtime56.Fragment, { children: "\u2014" });
|
|
15358
|
+
if (tables.loading) return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_jsx_runtime56.Fragment, { children: "\u2026" });
|
|
15359
|
+
if (tables.error) return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_jsx_runtime56.Fragment, { children: "Couldn't load the table's name" });
|
|
15360
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_jsx_runtime56.Fragment, { children: tables.rows.find((t) => t.table_id === tableId)?.table_name ?? "\u2014" });
|
|
15236
15361
|
}
|
|
15237
15362
|
function ColumnValuesText({
|
|
15238
15363
|
dataSource,
|
|
@@ -15240,38 +15365,38 @@ function ColumnValuesText({
|
|
|
15240
15365
|
tableId,
|
|
15241
15366
|
value
|
|
15242
15367
|
}) {
|
|
15243
|
-
if (!tableId) return /* @__PURE__ */ (0,
|
|
15244
|
-
return /* @__PURE__ */ (0,
|
|
15368
|
+
if (!tableId) return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_jsx_runtime56.Fragment, { children: "\u2014" });
|
|
15369
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
15245
15370
|
TableScope,
|
|
15246
15371
|
{
|
|
15247
15372
|
dataSource,
|
|
15248
15373
|
userId,
|
|
15249
15374
|
tableId,
|
|
15250
|
-
fallback: /* @__PURE__ */ (0,
|
|
15251
|
-
unavailable: /* @__PURE__ */ (0,
|
|
15252
|
-
children: /* @__PURE__ */ (0,
|
|
15375
|
+
fallback: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_jsx_runtime56.Fragment, { children: "\u2026" }),
|
|
15376
|
+
unavailable: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_jsx_runtime56.Fragment, { children: "Couldn't load this table's columns" }),
|
|
15377
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(RecordLabelProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(ColumnValuesWords, { tableId, value }) })
|
|
15253
15378
|
}
|
|
15254
15379
|
);
|
|
15255
15380
|
}
|
|
15256
15381
|
function ColumnValuesWords({ tableId, value }) {
|
|
15257
15382
|
const fields = (0, import_react82.useFields)(tableId);
|
|
15258
15383
|
const labels = useRecordLabels(fields.data ?? void 0);
|
|
15259
|
-
if (fields.loading) return /* @__PURE__ */ (0,
|
|
15260
|
-
if (fields.error) return /* @__PURE__ */ (0,
|
|
15384
|
+
if (fields.loading) return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_jsx_runtime56.Fragment, { children: "\u2026" });
|
|
15385
|
+
if (fields.error) return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_jsx_runtime56.Fragment, { children: "Couldn't load this table's columns" });
|
|
15261
15386
|
const parts = [];
|
|
15262
15387
|
for (const [key, stored] of Object.entries(value)) {
|
|
15263
15388
|
if (key.startsWith("_")) continue;
|
|
15264
15389
|
const field = (fields.data ?? []).find((f) => f.key === key);
|
|
15265
|
-
if (parts.length) parts.push(/* @__PURE__ */ (0,
|
|
15390
|
+
if (parts.length) parts.push(/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { children: ", " }, `${key}-sep`));
|
|
15266
15391
|
parts.push(
|
|
15267
|
-
/* @__PURE__ */ (0,
|
|
15392
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("span", { children: [
|
|
15268
15393
|
field ? fieldName(field) : "A removed column",
|
|
15269
15394
|
" is ",
|
|
15270
15395
|
field ? renderValue(field, stored, void 0, labels) : "\u2014"
|
|
15271
15396
|
] }, key)
|
|
15272
15397
|
);
|
|
15273
15398
|
}
|
|
15274
|
-
return parts.length ? /* @__PURE__ */ (0,
|
|
15399
|
+
return parts.length ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_jsx_runtime56.Fragment, { children: parts }) : /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_jsx_runtime56.Fragment, { children: "\u2014" });
|
|
15275
15400
|
}
|
|
15276
15401
|
function RecordNameText({
|
|
15277
15402
|
dataSource,
|
|
@@ -15279,36 +15404,36 @@ function RecordNameText({
|
|
|
15279
15404
|
tableId,
|
|
15280
15405
|
recordId
|
|
15281
15406
|
}) {
|
|
15282
|
-
if (!tableId || !recordId) return /* @__PURE__ */ (0,
|
|
15283
|
-
return /* @__PURE__ */ (0,
|
|
15407
|
+
if (!tableId || !recordId) return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_jsx_runtime56.Fragment, { children: "\u2014" });
|
|
15408
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
15284
15409
|
TableScope,
|
|
15285
15410
|
{
|
|
15286
15411
|
dataSource,
|
|
15287
15412
|
userId,
|
|
15288
15413
|
tableId,
|
|
15289
|
-
fallback: /* @__PURE__ */ (0,
|
|
15290
|
-
unavailable: /* @__PURE__ */ (0,
|
|
15291
|
-
children: /* @__PURE__ */ (0,
|
|
15414
|
+
fallback: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_jsx_runtime56.Fragment, { children: "\u2026" }),
|
|
15415
|
+
unavailable: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_jsx_runtime56.Fragment, { children: "Couldn't load this record" }),
|
|
15416
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(RecordNameWords, { tableId, recordId })
|
|
15292
15417
|
}
|
|
15293
15418
|
);
|
|
15294
15419
|
}
|
|
15295
15420
|
function RecordNameWords({ tableId, recordId }) {
|
|
15296
15421
|
const table = (0, import_react82.useTable)(tableId);
|
|
15297
15422
|
const record = (0, import_react82.useRecord)(recordId);
|
|
15298
|
-
if (record.loading || table.loading) return /* @__PURE__ */ (0,
|
|
15299
|
-
if (record.error) return /* @__PURE__ */ (0,
|
|
15300
|
-
if (!record.data) return /* @__PURE__ */ (0,
|
|
15301
|
-
return /* @__PURE__ */ (0,
|
|
15423
|
+
if (record.loading || table.loading) return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_jsx_runtime56.Fragment, { children: "\u2026" });
|
|
15424
|
+
if (record.error) return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_jsx_runtime56.Fragment, { children: "Couldn't load this record" });
|
|
15425
|
+
if (!record.data) return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_jsx_runtime56.Fragment, { children: "A record you cannot open" });
|
|
15426
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_jsx_runtime56.Fragment, { children: recordName(record.data.document, table.data?.title_field ?? null) });
|
|
15302
15427
|
}
|
|
15303
15428
|
|
|
15304
15429
|
// src/HeldChangeDecision.tsx
|
|
15305
15430
|
var import_react83 = require("react");
|
|
15306
15431
|
var import_react84 = require("@ai-matrx/records/react");
|
|
15307
|
-
var
|
|
15432
|
+
var import_design_system49 = require("@ai-matrx/design-system");
|
|
15308
15433
|
init_Refusal();
|
|
15309
|
-
var
|
|
15434
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
15310
15435
|
function HeldChangeDecision({ dataSource, userId, organizationId, approvalId, onDecided, approveLabel }) {
|
|
15311
|
-
return /* @__PURE__ */ (0,
|
|
15436
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_react84.RecordsProvider, { config: { dataSource, actor: personActor(userId), organizationId }, children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Decision, { approvalId, onDecided, approveLabel: approveLabel ?? "Approve" }) });
|
|
15312
15437
|
}
|
|
15313
15438
|
function Decision({
|
|
15314
15439
|
approvalId,
|
|
@@ -15341,13 +15466,13 @@ function Decision({
|
|
|
15341
15466
|
if (res.ok) onDecided(approve);
|
|
15342
15467
|
else setError(res.error);
|
|
15343
15468
|
};
|
|
15344
|
-
if (may === null) return /* @__PURE__ */ (0,
|
|
15345
|
-
return /* @__PURE__ */ (0,
|
|
15346
|
-
may ? /* @__PURE__ */ (0,
|
|
15347
|
-
/* @__PURE__ */ (0,
|
|
15348
|
-
/* @__PURE__ */ (0,
|
|
15349
|
-
] }) : !error && /* @__PURE__ */ (0,
|
|
15350
|
-
error ? /* @__PURE__ */ (0,
|
|
15469
|
+
if (may === null) return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("p", { className: "text-xs text-muted-foreground", children: "Checking who can decide\u2026" });
|
|
15470
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "flex flex-col gap-1.5", children: [
|
|
15471
|
+
may ? /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "flex gap-2", children: [
|
|
15472
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_design_system49.Button, { type: "button", size: "sm", disabled: busy !== null, onClick: () => void decide(true), children: busy === "approve" ? "Approving\u2026" : approveLabel }),
|
|
15473
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_design_system49.Button, { type: "button", size: "sm", variant: "outline", disabled: busy !== null, onClick: () => void decide(false), children: busy === "refuse" ? "Refusing\u2026" : "Refuse" })
|
|
15474
|
+
] }) : !error && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("p", { className: "text-xs text-muted-foreground", children: "An owner or admin of this organization decides this." }),
|
|
15475
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(RefusalLine, { error }) : null
|
|
15351
15476
|
] });
|
|
15352
15477
|
}
|
|
15353
15478
|
//# sourceMappingURL=pickers.cjs.map
|