@ai-matrx/records-ui 0.116.8 → 0.116.9
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 +13 -1
- package/dist/{chunk-IYJVE222.js → chunk-HL7ZIVVJ.js} +968 -858
- package/dist/chunk-HL7ZIVVJ.js.map +1 -0
- package/dist/index.cjs +1884 -1848
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4206 -4276
- package/dist/index.js.map +1 -1
- package/dist/pickers.cjs +1664 -1647
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +1 -1
- package/package.json +4 -4
- package/dist/chunk-IYJVE222.js.map +0 -1
|
@@ -2335,12 +2335,111 @@ function RelationPicker({ field: field2, value, onChange, disabled, id, classNam
|
|
|
2335
2335
|
}
|
|
2336
2336
|
|
|
2337
2337
|
// src/buttonCell.tsx
|
|
2338
|
-
import { useEffect as useEffect17, useRef as useRef13, useState as useState25 } from "react";
|
|
2338
|
+
import { useContext as useContext3, useEffect as useEffect17, useRef as useRef13, useState as useState25 } from "react";
|
|
2339
2339
|
import { Button as Button15, Dialog as Dialog3, ErrorBox as ErrorBox2, DialogContent as DialogContent3, DialogDescription, DialogHeader as DialogHeader3, DialogTitle as DialogTitle3, Popover as Popover4, PopoverContent as PopoverContent4, PopoverTrigger as PopoverTrigger4, cn as cn18 } from "@ai-matrx/design-system";
|
|
2340
2340
|
import { CHOICE_CHIP_CLASS, NEUTRAL_CHIP_CLASS, isStyleColor } from "@ai-matrx/design-system/data-table";
|
|
2341
2341
|
import { buttonNeeds as buttonNeeds2, buttonOf as buttonOf2 } from "@ai-matrx/records";
|
|
2342
2342
|
import { useOptionalRecordsClient as useOptionalRecordsClient10, useTable as useTable2 } from "@ai-matrx/records/react";
|
|
2343
2343
|
|
|
2344
|
+
// src/gridOpen.tsx
|
|
2345
|
+
import { createContext as createContext2 } from "react";
|
|
2346
|
+
import { openOutbound } from "@ai-matrx/kit/outbound";
|
|
2347
|
+
import { Fragment as Fragment5, jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2348
|
+
var TITLE_OWN_CONTROLS = 'input, textarea, select, button, a[href], [role="combobox"], [contenteditable="true"], [contenteditable=""]';
|
|
2349
|
+
var TitleCellOpensContext = createContext2(false);
|
|
2350
|
+
var OpenRecordHereContext = createContext2(null);
|
|
2351
|
+
function openRecordLabel(name) {
|
|
2352
|
+
return `Open ${name}`;
|
|
2353
|
+
}
|
|
2354
|
+
function opensOnKey(event) {
|
|
2355
|
+
if (event.key !== " " || event.altKey || event.ctrlKey || event.metaKey) return false;
|
|
2356
|
+
const target = event.target;
|
|
2357
|
+
if (!target) return false;
|
|
2358
|
+
const tag = target.tagName;
|
|
2359
|
+
if (tag === "INPUT" || tag === "TEXTAREA" || tag === "SELECT" || tag === "BUTTON") return false;
|
|
2360
|
+
if (target.isContentEditable) {
|
|
2361
|
+
const editor = target.closest('[contenteditable=""], [contenteditable="true"], [contenteditable="plaintext-only"]');
|
|
2362
|
+
const inside = event.currentTarget;
|
|
2363
|
+
if (!editor || !inside || inside.contains(editor)) return false;
|
|
2364
|
+
}
|
|
2365
|
+
return true;
|
|
2366
|
+
}
|
|
2367
|
+
function withOpenRecord(columns, onOpen, nameOf3, place = "end", hrefOf, openOnly) {
|
|
2368
|
+
if (!onOpen) return columns;
|
|
2369
|
+
return columns.map((column, index) => {
|
|
2370
|
+
const original = column.cell;
|
|
2371
|
+
const render = (row, rowIndex) => original ? original(row, rowIndex) : String(row[column.id ?? ""] ?? "");
|
|
2372
|
+
const openFrom = (row, event) => {
|
|
2373
|
+
const href = hrefOf?.(row);
|
|
2374
|
+
if (href && (event.metaKey || event.ctrlKey)) openOutbound(href, "_blank", "noopener");
|
|
2375
|
+
else (openOnly ?? onOpen)(row.id);
|
|
2376
|
+
};
|
|
2377
|
+
const handle = (row) => /* @__PURE__ */ jsxs8(
|
|
2378
|
+
"button",
|
|
2379
|
+
{
|
|
2380
|
+
type: "button",
|
|
2381
|
+
"data-records-open-record": row.id,
|
|
2382
|
+
"aria-label": openRecordLabel(nameOf3(row)),
|
|
2383
|
+
title: `${openRecordLabel(nameOf3(row))} (Space) \xB7 \u2318-click: new tab`,
|
|
2384
|
+
className: "absolute right-0 top-1/2 z-10 inline-flex h-6 -translate-y-1/2 items-center gap-1 rounded border border-border bg-card px-1.5 text-xs font-medium leading-none text-foreground no-underline opacity-0 shadow-sm hover:bg-muted focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring group-hover/matrx-row:opacity-100 [@media(hover:none)]:opacity-100",
|
|
2385
|
+
onClick: (event) => {
|
|
2386
|
+
event.stopPropagation();
|
|
2387
|
+
openFrom(row, event);
|
|
2388
|
+
},
|
|
2389
|
+
onDoubleClick: (event) => event.stopPropagation(),
|
|
2390
|
+
children: [
|
|
2391
|
+
/* @__PURE__ */ jsx10("svg", { "aria-hidden": "true", viewBox: "0 0 16 16", width: "12", height: "12", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx10("path", { d: "M9.5 2.5h4v4M13.5 2.5 8.5 7.5M6.5 3.5h-3a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1v-3" }) }),
|
|
2392
|
+
"Open"
|
|
2393
|
+
]
|
|
2394
|
+
}
|
|
2395
|
+
);
|
|
2396
|
+
const titleTarget = (event) => {
|
|
2397
|
+
const target = event.target;
|
|
2398
|
+
if (!target || typeof target.closest !== "function") return false;
|
|
2399
|
+
const hit = target.closest(TITLE_OWN_CONTROLS);
|
|
2400
|
+
return hit === null || !event.currentTarget.contains(hit);
|
|
2401
|
+
};
|
|
2402
|
+
return {
|
|
2403
|
+
...column,
|
|
2404
|
+
cell: (row, rowIndex) => /* @__PURE__ */ jsx10(
|
|
2405
|
+
"span",
|
|
2406
|
+
{
|
|
2407
|
+
className: index === 0 ? "relative flex min-w-0 items-center gap-1" : "contents",
|
|
2408
|
+
"data-records-opens-on-space": row.id,
|
|
2409
|
+
onKeyDown: (event) => {
|
|
2410
|
+
if (!opensOnKey(event)) return;
|
|
2411
|
+
event.preventDefault();
|
|
2412
|
+
event.stopPropagation();
|
|
2413
|
+
onOpen(row.id);
|
|
2414
|
+
},
|
|
2415
|
+
children: index === 0 ? /* @__PURE__ */ jsxs8(Fragment5, { children: [
|
|
2416
|
+
place === "start" ? handle(row) : null,
|
|
2417
|
+
/* @__PURE__ */ jsx10(
|
|
2418
|
+
"span",
|
|
2419
|
+
{
|
|
2420
|
+
className: "min-w-0 flex-1 decoration-muted-foreground/60 underline-offset-2 hover:underline",
|
|
2421
|
+
"data-clickable": "",
|
|
2422
|
+
"data-records-opens-on-click": row.id,
|
|
2423
|
+
onClickCapture: (event) => {
|
|
2424
|
+
if (!titleTarget(event)) return;
|
|
2425
|
+
openFrom(row, event);
|
|
2426
|
+
},
|
|
2427
|
+
onDoubleClickCapture: (event) => {
|
|
2428
|
+
if (!titleTarget(event)) return;
|
|
2429
|
+
event.stopPropagation();
|
|
2430
|
+
openFrom(row, event);
|
|
2431
|
+
},
|
|
2432
|
+
children: /* @__PURE__ */ jsx10(TitleCellOpensContext.Provider, { value: true, children: render(row, rowIndex) })
|
|
2433
|
+
}
|
|
2434
|
+
),
|
|
2435
|
+
place === "end" ? handle(row) : null
|
|
2436
|
+
] }) : render(row, rowIndex)
|
|
2437
|
+
}
|
|
2438
|
+
)
|
|
2439
|
+
};
|
|
2440
|
+
});
|
|
2441
|
+
}
|
|
2442
|
+
|
|
2344
2443
|
// src/columnName.ts
|
|
2345
2444
|
var said = (name) => name.trim().replace(/\s+/g, " ");
|
|
2346
2445
|
function columnNameTakenBy(name, others) {
|
|
@@ -2409,7 +2508,7 @@ import {
|
|
|
2409
2508
|
|
|
2410
2509
|
// src/WatchFieldsPicker.tsx
|
|
2411
2510
|
import { Checkbox as Checkbox2, Label as Label2 } from "@ai-matrx/design-system";
|
|
2412
|
-
import { jsx as
|
|
2511
|
+
import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2413
2512
|
function watchedFieldsOf(field2) {
|
|
2414
2513
|
const list = field2?.config?.["only_fields"];
|
|
2415
2514
|
return Array.isArray(list) ? list.filter((k) => typeof k === "string") : [];
|
|
@@ -2425,15 +2524,15 @@ function watchable(field2) {
|
|
|
2425
2524
|
}
|
|
2426
2525
|
function WatchFieldsPicker({ fields, value, onChange }) {
|
|
2427
2526
|
const choices = fields.filter(watchable);
|
|
2428
|
-
return /* @__PURE__ */
|
|
2429
|
-
/* @__PURE__ */
|
|
2430
|
-
/* @__PURE__ */
|
|
2431
|
-
/* @__PURE__ */
|
|
2432
|
-
/* @__PURE__ */
|
|
2433
|
-
/* @__PURE__ */
|
|
2527
|
+
return /* @__PURE__ */ jsxs9("fieldset", { className: "flex flex-col gap-1", "data-records-watch-fields": "", children: [
|
|
2528
|
+
/* @__PURE__ */ jsx11(Label2, { className: "text-xs", children: "Changes to" }),
|
|
2529
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex flex-wrap gap-x-3 gap-y-1", children: [
|
|
2530
|
+
/* @__PURE__ */ jsxs9("label", { className: "flex items-center gap-1.5 text-sm", children: [
|
|
2531
|
+
/* @__PURE__ */ jsx11(Checkbox2, { checked: value.length === 0, "aria-label": "Any field", onCheckedChange: (v) => v === true && onChange([]) }),
|
|
2532
|
+
/* @__PURE__ */ jsx11("span", { children: "Any field" })
|
|
2434
2533
|
] }),
|
|
2435
|
-
choices.map((f) => /* @__PURE__ */
|
|
2436
|
-
/* @__PURE__ */
|
|
2534
|
+
choices.map((f) => /* @__PURE__ */ jsxs9("label", { className: "flex items-center gap-1.5 text-sm", children: [
|
|
2535
|
+
/* @__PURE__ */ jsx11(
|
|
2437
2536
|
Checkbox2,
|
|
2438
2537
|
{
|
|
2439
2538
|
checked: value.includes(f.key),
|
|
@@ -2442,7 +2541,7 @@ function WatchFieldsPicker({ fields, value, onChange }) {
|
|
|
2442
2541
|
onCheckedChange: (v) => onChange(v === true ? [...value.filter((k) => k !== f.key), f.key] : value.filter((k) => k !== f.key))
|
|
2443
2542
|
}
|
|
2444
2543
|
),
|
|
2445
|
-
/* @__PURE__ */
|
|
2544
|
+
/* @__PURE__ */ jsx11("span", { children: f.label })
|
|
2446
2545
|
] }, f.id))
|
|
2447
2546
|
] })
|
|
2448
2547
|
] });
|
|
@@ -2453,7 +2552,7 @@ import { useEffect as useEffect6, useMemo as useMemo5, useRef as useRef6, useSta
|
|
|
2453
2552
|
import { useRecordsClient as useRecordsClient3 } from "@ai-matrx/records/react";
|
|
2454
2553
|
import { RULE_NODE_KINDS } from "@ai-matrx/records";
|
|
2455
2554
|
import { BasicTextarea, Button as Button5, Label as Label3, cn as cn7 } from "@ai-matrx/design-system";
|
|
2456
|
-
import { jsx as
|
|
2555
|
+
import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2457
2556
|
var NOT_TYPED_BY_NAME = /* @__PURE__ */ new Set([
|
|
2458
2557
|
"fx.add",
|
|
2459
2558
|
"fx.sub",
|
|
@@ -2561,10 +2660,10 @@ function FormulaTextEditor({
|
|
|
2561
2660
|
const at = Math.max(0, Math.min(parsed.position ?? 0, parsed.text.length));
|
|
2562
2661
|
return { before: parsed.text.slice(0, at), after: parsed.text.slice(at) };
|
|
2563
2662
|
}, [parsed]);
|
|
2564
|
-
return /* @__PURE__ */
|
|
2565
|
-
/* @__PURE__ */
|
|
2566
|
-
/* @__PURE__ */
|
|
2567
|
-
host.formulaHelp ? /* @__PURE__ */
|
|
2663
|
+
return /* @__PURE__ */ jsxs10("div", { "data-records-formula-editor": "", className: cn7("flex flex-col gap-1.5", className), children: [
|
|
2664
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-1", children: [
|
|
2665
|
+
/* @__PURE__ */ jsx12(Label3, { className: "text-xs", children: "The formula" }),
|
|
2666
|
+
host.formulaHelp ? /* @__PURE__ */ jsx12("span", { "data-records-formula-help": "", className: "ml-auto", children: host.formulaHelp({
|
|
2568
2667
|
tableId,
|
|
2569
2668
|
text,
|
|
2570
2669
|
columns,
|
|
@@ -2574,7 +2673,7 @@ function FormulaTextEditor({
|
|
|
2574
2673
|
...purpose ? { purpose } : {}
|
|
2575
2674
|
}) }) : null
|
|
2576
2675
|
] }),
|
|
2577
|
-
/* @__PURE__ */
|
|
2676
|
+
/* @__PURE__ */ jsx12(
|
|
2578
2677
|
BasicTextarea,
|
|
2579
2678
|
{
|
|
2580
2679
|
ref: box,
|
|
@@ -2586,44 +2685,44 @@ function FormulaTextEditor({
|
|
|
2586
2685
|
onChange: (e) => onText(e.target.value)
|
|
2587
2686
|
}
|
|
2588
2687
|
),
|
|
2589
|
-
parsed?.ok ? /* @__PURE__ */
|
|
2688
|
+
parsed?.ok ? /* @__PURE__ */ jsxs10("p", { "data-records-formula-ok": "", className: "text-[11px] text-muted-foreground", children: [
|
|
2590
2689
|
"Reads ",
|
|
2591
2690
|
parsed.references.length === 0 ? "no column" : parsed.references.map((r) => r.name).join(", "),
|
|
2592
2691
|
" \xB7 gives ",
|
|
2593
2692
|
RESULT_WORD[parsed.result_type] ?? "an answer",
|
|
2594
2693
|
"."
|
|
2595
2694
|
] }) : null,
|
|
2596
|
-
parsed?.ok && parsed.record_id ? /* @__PURE__ */
|
|
2597
|
-
/* @__PURE__ */
|
|
2695
|
+
parsed?.ok && parsed.record_id ? /* @__PURE__ */ jsxs10("p", { "data-records-formula-sample": "", className: "truncate text-[11px]", title: sampleWords(parsed), children: [
|
|
2696
|
+
/* @__PURE__ */ jsxs10("span", { className: "text-muted-foreground", children: [
|
|
2598
2697
|
sampleRecordId ? "This record" : "First row",
|
|
2599
2698
|
": "
|
|
2600
2699
|
] }),
|
|
2601
|
-
/* @__PURE__ */
|
|
2700
|
+
/* @__PURE__ */ jsx12("span", { className: cn7("font-mono", parsed.error ? "text-muted-foreground" : "text-foreground"), children: sampleWords(parsed) })
|
|
2602
2701
|
] }) : null,
|
|
2603
2702
|
parsed && !parsed.ok ? (
|
|
2604
2703
|
// NOT A REFUSAL, SO NOT RED: nothing was pressed. It is the store's reading of the
|
|
2605
2704
|
// text as it stands, drawn the way the panel draws what Save is still waiting for.
|
|
2606
|
-
/* @__PURE__ */
|
|
2607
|
-
/* @__PURE__ */
|
|
2608
|
-
where ? /* @__PURE__ */
|
|
2705
|
+
/* @__PURE__ */ jsxs10("div", { "data-records-formula-mistake": "", role: "status", className: "text-[11px] text-foreground", children: [
|
|
2706
|
+
/* @__PURE__ */ jsx12("p", { children: parsed.error }),
|
|
2707
|
+
where ? /* @__PURE__ */ jsxs10("p", { className: "mt-0.5 font-mono text-foreground", children: [
|
|
2609
2708
|
where.before,
|
|
2610
|
-
/* @__PURE__ */
|
|
2709
|
+
/* @__PURE__ */ jsx12("span", { className: "bg-amber-500/30 px-0.5", children: "\u258F" }),
|
|
2611
2710
|
where.after
|
|
2612
2711
|
] }) : null
|
|
2613
2712
|
] })
|
|
2614
2713
|
) : null,
|
|
2615
|
-
error ? /* @__PURE__ */
|
|
2616
|
-
/* @__PURE__ */
|
|
2617
|
-
/* @__PURE__ */
|
|
2618
|
-
columns.map((f) => /* @__PURE__ */
|
|
2714
|
+
error ? /* @__PURE__ */ jsx12(RefusalLine, { error }) : null,
|
|
2715
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
2716
|
+
/* @__PURE__ */ jsx12("span", { className: "text-[11px] text-muted-foreground", children: "Columns:" }),
|
|
2717
|
+
columns.map((f) => /* @__PURE__ */ jsx12(Button5, { type: "button", size: "sm", variant: "outline", className: "h-6 px-1.5 text-[11px]", onClick: () => insert(`{${fieldName(f)}}`), children: fieldName(f) }, f.id))
|
|
2619
2718
|
] }),
|
|
2620
|
-
FORMULA_FUNCTION_NAMES.length > 0 ? /* @__PURE__ */
|
|
2621
|
-
/* @__PURE__ */
|
|
2719
|
+
FORMULA_FUNCTION_NAMES.length > 0 ? /* @__PURE__ */ jsxs10("details", { className: "text-[11px] text-muted-foreground", children: [
|
|
2720
|
+
/* @__PURE__ */ jsxs10("summary", { className: "cursor-pointer", children: [
|
|
2622
2721
|
"Functions the store works out (",
|
|
2623
2722
|
FORMULA_FUNCTION_NAMES.length,
|
|
2624
2723
|
")"
|
|
2625
2724
|
] }),
|
|
2626
|
-
/* @__PURE__ */
|
|
2725
|
+
/* @__PURE__ */ jsx12("div", { className: "mt-1 flex flex-wrap gap-1", children: FORMULA_FUNCTION_NAMES.map((name) => /* @__PURE__ */ jsx12(Button5, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-1.5 font-mono text-[11px]", onClick: () => insert(`${name}()`), children: name }, name)) })
|
|
2627
2726
|
] }) : null
|
|
2628
2727
|
] });
|
|
2629
2728
|
}
|
|
@@ -2632,7 +2731,7 @@ function FormulaTextEditor({
|
|
|
2632
2731
|
import { useMemo as useMemo6, useState as useState10 } from "react";
|
|
2633
2732
|
import { useEntityReferenceKinds } from "@ai-matrx/records/react";
|
|
2634
2733
|
import { Badge, BasicInput as BasicInput5, Checkbox as Checkbox3, Label as Label4, Skeleton, cn as cn8 } from "@ai-matrx/design-system";
|
|
2635
|
-
import { Fragment as
|
|
2734
|
+
import { Fragment as Fragment6, jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2636
2735
|
var ENTITY_REFERENCE_KINDS_MISSING = "Choose at least one kind of thing this column points at.";
|
|
2637
2736
|
function entityReferenceSpec(input) {
|
|
2638
2737
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -2683,11 +2782,11 @@ function EntityReferenceKindPicker({ value, onChange, locked = false, className
|
|
|
2683
2782
|
if (on) onChange(chosen.has(token) ? [...value] : [...value, token]);
|
|
2684
2783
|
else onChange(value.filter((t) => t !== token));
|
|
2685
2784
|
};
|
|
2686
|
-
return /* @__PURE__ */
|
|
2687
|
-
/* @__PURE__ */
|
|
2688
|
-
value.length > 0 ? /* @__PURE__ */
|
|
2785
|
+
return /* @__PURE__ */ jsxs11("div", { className: cn8("flex flex-col gap-2", className), children: [
|
|
2786
|
+
/* @__PURE__ */ jsx13(Label4, { className: "text-xs", children: "What it points at" }),
|
|
2787
|
+
value.length > 0 ? /* @__PURE__ */ jsx13("div", { className: "flex flex-wrap gap-1", "aria-label": "Chosen kinds", children: value.map((token) => /* @__PURE__ */ jsxs11(Badge, { variant: "secondary", className: "gap-1 text-[11px]", children: [
|
|
2689
2788
|
labelOf.get(token) ?? token,
|
|
2690
|
-
locked ? null : /* @__PURE__ */
|
|
2789
|
+
locked ? null : /* @__PURE__ */ jsx13(
|
|
2691
2790
|
"button",
|
|
2692
2791
|
{
|
|
2693
2792
|
type: "button",
|
|
@@ -2698,8 +2797,8 @@ function EntityReferenceKindPicker({ value, onChange, locked = false, className
|
|
|
2698
2797
|
}
|
|
2699
2798
|
)
|
|
2700
2799
|
] }, token)) }) : null,
|
|
2701
|
-
locked ? /* @__PURE__ */
|
|
2702
|
-
/* @__PURE__ */
|
|
2800
|
+
locked ? /* @__PURE__ */ jsx13("p", { className: "text-[11px] text-muted-foreground", children: "The kinds an existing column points at are kept as they are; add a new column to point at others." }) : error ? /* @__PURE__ */ jsx13(RefusalNotice, { error }) : loading ? /* @__PURE__ */ jsx13(Skeleton, { className: "h-24 w-full" }) : /* @__PURE__ */ jsxs11(Fragment6, { children: [
|
|
2801
|
+
/* @__PURE__ */ jsx13(
|
|
2703
2802
|
BasicInput5,
|
|
2704
2803
|
{
|
|
2705
2804
|
"aria-label": "Find a kind of thing",
|
|
@@ -2709,14 +2808,14 @@ function EntityReferenceKindPicker({ value, onChange, locked = false, className
|
|
|
2709
2808
|
onChange: (e) => setQuery(e.target.value)
|
|
2710
2809
|
}
|
|
2711
2810
|
),
|
|
2712
|
-
/* @__PURE__ */
|
|
2811
|
+
/* @__PURE__ */ jsx13("div", { className: "max-h-56 overflow-y-auto rounded-md border border-border p-2", role: "group", "aria-label": "Kinds of thing", children: groups.length === 0 ? /* @__PURE__ */ jsxs11("p", { className: "text-[11px] text-muted-foreground", children: [
|
|
2713
2812
|
"No kind of thing matches \u201C",
|
|
2714
2813
|
query.trim(),
|
|
2715
2814
|
"\u201D."
|
|
2716
|
-
] }) : groups.map(([category, kinds]) => /* @__PURE__ */
|
|
2717
|
-
/* @__PURE__ */
|
|
2718
|
-
/* @__PURE__ */
|
|
2719
|
-
/* @__PURE__ */
|
|
2815
|
+
] }) : groups.map(([category, kinds]) => /* @__PURE__ */ jsxs11("div", { className: "mb-2 last:mb-0", children: [
|
|
2816
|
+
/* @__PURE__ */ jsx13("p", { className: "mb-1 text-[10px] font-medium uppercase tracking-wide text-muted-foreground", children: category }),
|
|
2817
|
+
/* @__PURE__ */ jsx13("div", { className: "grid grid-cols-1 gap-1 sm:grid-cols-2", children: kinds.map((k) => /* @__PURE__ */ jsxs11("label", { className: "flex items-center gap-1.5 text-xs", children: [
|
|
2818
|
+
/* @__PURE__ */ jsx13(
|
|
2720
2819
|
Checkbox3,
|
|
2721
2820
|
{
|
|
2722
2821
|
checked: chosen.has(k.token),
|
|
@@ -2727,7 +2826,7 @@ function EntityReferenceKindPicker({ value, onChange, locked = false, className
|
|
|
2727
2826
|
k.label
|
|
2728
2827
|
] }, k.token)) })
|
|
2729
2828
|
] }, category)) }),
|
|
2730
|
-
value.length === 0 ? /* @__PURE__ */
|
|
2829
|
+
value.length === 0 ? /* @__PURE__ */ jsx13("p", { className: "text-[11px] text-muted-foreground", children: ENTITY_REFERENCE_KINDS_MISSING }) : null
|
|
2731
2830
|
] })
|
|
2732
2831
|
] });
|
|
2733
2832
|
}
|
|
@@ -2766,10 +2865,10 @@ function withheldSentence(field2, notice) {
|
|
|
2766
2865
|
}
|
|
2767
2866
|
|
|
2768
2867
|
// src/withheld.tsx
|
|
2769
|
-
import { jsx as
|
|
2868
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
2770
2869
|
function WithheldValue({ field: field2, notice }) {
|
|
2771
2870
|
const sentence = withheldSentence(field2, notice);
|
|
2772
|
-
return /* @__PURE__ */
|
|
2871
|
+
return /* @__PURE__ */ jsx14(
|
|
2773
2872
|
"span",
|
|
2774
2873
|
{
|
|
2775
2874
|
"data-records-withheld": field2.key,
|
|
@@ -2789,7 +2888,7 @@ import { useMemo as useMemo7, useState as useState11 } from "react";
|
|
|
2789
2888
|
import { entityRefsOf, entityRefsToWrite } from "@ai-matrx/records";
|
|
2790
2889
|
import { useEntityReferenceKinds as useEntityReferenceKinds2, useEntityReferenceSearch, useEntityReferenceWords, useOptionalRecordsClient as useOptionalRecordsClient5 } from "@ai-matrx/records/react";
|
|
2791
2890
|
import { Badge as Badge2, Button as Button6, cn as cn9 } from "@ai-matrx/design-system";
|
|
2792
|
-
import { Fragment as
|
|
2891
|
+
import { Fragment as Fragment7, jsx as jsx15, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2793
2892
|
var WITHHELD_ENTITY_LABEL = "Something you have not been given access to";
|
|
2794
2893
|
var ENTITY_REFERENCE_EMPTY = "Nothing is pointed at yet.";
|
|
2795
2894
|
function entityReferenceText(value) {
|
|
@@ -2804,7 +2903,7 @@ function allowedKindsOf(field2) {
|
|
|
2804
2903
|
}
|
|
2805
2904
|
function EntityReferenceControl(props) {
|
|
2806
2905
|
const client = useOptionalRecordsClient5();
|
|
2807
|
-
return client ? /* @__PURE__ */
|
|
2906
|
+
return client ? /* @__PURE__ */ jsx15(WithWords, { ...props }) : /* @__PURE__ */ jsx15(Chips, { ...props, words: null, picker: null });
|
|
2808
2907
|
}
|
|
2809
2908
|
function WithWords(props) {
|
|
2810
2909
|
const refs = useMemo7(() => entityRefsOf(props.value), [props.value]);
|
|
@@ -2816,7 +2915,7 @@ function WithWords(props) {
|
|
|
2816
2915
|
[JSON.stringify(withKnown)]
|
|
2817
2916
|
);
|
|
2818
2917
|
const words = useEntityReferenceWords(unlabelled);
|
|
2819
|
-
const picker = props.disabled ? null : /* @__PURE__ */
|
|
2918
|
+
const picker = props.disabled ? null : /* @__PURE__ */ jsx15(
|
|
2820
2919
|
EntityReferencePicker,
|
|
2821
2920
|
{
|
|
2822
2921
|
field: props.field,
|
|
@@ -2829,7 +2928,7 @@ function WithWords(props) {
|
|
|
2829
2928
|
}
|
|
2830
2929
|
}
|
|
2831
2930
|
);
|
|
2832
|
-
return /* @__PURE__ */
|
|
2931
|
+
return /* @__PURE__ */ jsx15(Chips, { ...props, value: withKnown, words, picker });
|
|
2833
2932
|
}
|
|
2834
2933
|
function EntityReferencePicker({
|
|
2835
2934
|
field: field2,
|
|
@@ -2852,7 +2951,7 @@ function EntityReferencePicker({
|
|
|
2852
2951
|
picked: refs.some((x) => x.token === r.token && x.id === r.id),
|
|
2853
2952
|
attrs: { "data-entity-reference-candidate": `${r.token}:${r.id}` }
|
|
2854
2953
|
}));
|
|
2855
|
-
const kindChoice = allowed.length > 1 ? allowed.length <= 4 ? /* @__PURE__ */
|
|
2954
|
+
const kindChoice = allowed.length > 1 ? allowed.length <= 4 ? /* @__PURE__ */ jsx15("div", { className: "mb-1 flex flex-wrap gap-1", role: "group", "aria-label": `Which kind \u2014 ${field2.label}`, children: [null, ...allowed].map((token) => /* @__PURE__ */ jsx15(
|
|
2856
2955
|
Button6,
|
|
2857
2956
|
{
|
|
2858
2957
|
type: "button",
|
|
@@ -2864,7 +2963,7 @@ function EntityReferencePicker({
|
|
|
2864
2963
|
children: token ? labelOfKind(token) : "Any"
|
|
2865
2964
|
},
|
|
2866
2965
|
token ?? "any"
|
|
2867
|
-
)) }) : /* @__PURE__ */
|
|
2966
|
+
)) }) : /* @__PURE__ */ jsx15(
|
|
2868
2967
|
PickOne,
|
|
2869
2968
|
{
|
|
2870
2969
|
label: `Which kind \u2014 ${field2.label}`,
|
|
@@ -2874,13 +2973,13 @@ function EntityReferencePicker({
|
|
|
2874
2973
|
options: [{ value: "", label: "Any kind" }, ...allowed.map((token) => ({ value: token, label: labelOfKind(token) }))]
|
|
2875
2974
|
}
|
|
2876
2975
|
) : null;
|
|
2877
|
-
const notice = /* @__PURE__ */
|
|
2976
|
+
const notice = /* @__PURE__ */ jsxs12(Fragment7, { children: [
|
|
2878
2977
|
kindChoice,
|
|
2879
|
-
found.error ? /* @__PURE__ */
|
|
2880
|
-
found.loading && !found.data ? /* @__PURE__ */
|
|
2978
|
+
found.error ? /* @__PURE__ */ jsx15(RefusalLine, { error: found.error, className: "px-2 py-1 text-[11px]" }) : null,
|
|
2979
|
+
found.loading && !found.data ? /* @__PURE__ */ jsx15("p", { className: "px-2 py-1 text-[11px] text-muted-foreground", children: "Searching\u2026" }) : null
|
|
2881
2980
|
] });
|
|
2882
2981
|
const kindWords = allowed.length === 1 ? labelOfKind(allowed[0]).toLowerCase() : "thing";
|
|
2883
|
-
return /* @__PURE__ */
|
|
2982
|
+
return /* @__PURE__ */ jsx15(
|
|
2884
2983
|
PickOrAdd,
|
|
2885
2984
|
{
|
|
2886
2985
|
triggerLabel: `Pick for ${field2.label}`,
|
|
@@ -2894,7 +2993,7 @@ function EntityReferencePicker({
|
|
|
2894
2993
|
onSearch: setSearch,
|
|
2895
2994
|
items,
|
|
2896
2995
|
notice,
|
|
2897
|
-
empty: found.loading ? null : /* @__PURE__ */
|
|
2996
|
+
empty: found.loading ? null : /* @__PURE__ */ jsx15("p", { className: "px-2 py-1 text-[11px] text-muted-foreground", children: search.trim() ? `No ${kindWords} you can open is called \u201C${search.trim()}\u201D.` : `There is no ${kindWords} you can open yet.` }),
|
|
2898
2997
|
onPick: (key) => {
|
|
2899
2998
|
const r = (found.data ?? []).find((x) => `${x.token}:${x.id}` === key);
|
|
2900
2999
|
if (!r) return;
|
|
@@ -2924,13 +3023,13 @@ function Chips({
|
|
|
2924
3023
|
return WITHHELD_ENTITY_LABEL;
|
|
2925
3024
|
};
|
|
2926
3025
|
const multi = Boolean(field2.multi);
|
|
2927
|
-
return /* @__PURE__ */
|
|
2928
|
-
refs.length === 0 && !picker ? /* @__PURE__ */
|
|
3026
|
+
return /* @__PURE__ */ jsxs12("div", { id, className: cn9("flex flex-wrap items-center gap-1", className), "aria-label": `What ${field2.label} points at`, children: [
|
|
3027
|
+
refs.length === 0 && !picker ? /* @__PURE__ */ jsx15("span", { className: "text-[11px] text-muted-foreground", children: ENTITY_REFERENCE_EMPTY }) : null,
|
|
2929
3028
|
refs.map((r) => {
|
|
2930
3029
|
const label = labelOf(r.token, r.id, r.label);
|
|
2931
|
-
return /* @__PURE__ */
|
|
3030
|
+
return /* @__PURE__ */ jsxs12(Badge2, { variant: "secondary", className: "gap-1 text-[11px]", "data-entity-reference-chip": `${r.token}:${r.id}`, children: [
|
|
2932
3031
|
label,
|
|
2933
|
-
disabled ? null : /* @__PURE__ */
|
|
3032
|
+
disabled ? null : /* @__PURE__ */ jsx15(
|
|
2934
3033
|
"button",
|
|
2935
3034
|
{
|
|
2936
3035
|
type: "button",
|
|
@@ -2957,7 +3056,7 @@ import { useEffect as useEffect7, useState as useState12 } from "react";
|
|
|
2957
3056
|
import { wholeValueSize } from "@ai-matrx/records/core";
|
|
2958
3057
|
import { BasicTextarea as BasicTextarea2 } from "@ai-matrx/design-system";
|
|
2959
3058
|
import { OutboundLink as OutboundLink2 } from "@ai-matrx/kit/outbound-react";
|
|
2960
|
-
import { jsx as
|
|
3059
|
+
import { jsx as jsx16, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2961
3060
|
var WHOLE_VALUE_UNBOUND = "The whole text is kept as a file, and this screen has no way to open files yet.";
|
|
2962
3061
|
function wholeValueLine(pointer) {
|
|
2963
3062
|
return `Open the whole text (${wholeValueSize(pointer)})`;
|
|
@@ -2966,12 +3065,12 @@ function WholeValueCell({ words, pointer }) {
|
|
|
2966
3065
|
const host = useRecordsUi();
|
|
2967
3066
|
const href = host.hrefForFile?.({ fileId: pointer.file_id });
|
|
2968
3067
|
const line = wholeValueLine(pointer);
|
|
2969
|
-
return /* @__PURE__ */
|
|
2970
|
-
/* @__PURE__ */
|
|
3068
|
+
return /* @__PURE__ */ jsxs13("span", { className: "flex min-w-0 items-baseline gap-2", "data-whole-value-file": pointer.file_id, children: [
|
|
3069
|
+
/* @__PURE__ */ jsxs13("span", { className: "truncate", title: `The first ${pointer.shown_chars} of ${pointer.chars} characters`, children: [
|
|
2971
3070
|
words,
|
|
2972
3071
|
"\u2026"
|
|
2973
3072
|
] }),
|
|
2974
|
-
href ? host.Link ? host.Link({ href, children: line, className: "shrink-0 text-xs text-primary underline-offset-2 hover:underline" }) : /* @__PURE__ */
|
|
3073
|
+
href ? host.Link ? host.Link({ href, children: line, className: "shrink-0 text-xs text-primary underline-offset-2 hover:underline" }) : /* @__PURE__ */ jsx16(OutboundLink2, { className: "shrink-0 text-xs text-primary underline-offset-2 hover:underline", href, children: line }) : /* @__PURE__ */ jsx16("span", { className: "shrink-0 text-xs italic text-muted-foreground", title: WHOLE_VALUE_UNBOUND, children: `${wholeValueSize(pointer)} in a file` })
|
|
2975
3074
|
] });
|
|
2976
3075
|
}
|
|
2977
3076
|
var WHOLE_VALUE_NOT_EDITABLE_HERE = "The whole text is kept as a file. Open it to read it; this screen cannot load it to edit.";
|
|
@@ -3013,7 +3112,7 @@ function WholeValueEditor({
|
|
|
3013
3112
|
const whole = useWholeText(pointer);
|
|
3014
3113
|
const touched = typeof value === "string" ? value !== words : value !== null && value !== void 0;
|
|
3015
3114
|
if (touched) {
|
|
3016
|
-
return /* @__PURE__ */
|
|
3115
|
+
return /* @__PURE__ */ jsx16(
|
|
3017
3116
|
BasicTextarea2,
|
|
3018
3117
|
{
|
|
3019
3118
|
id,
|
|
@@ -3026,7 +3125,7 @@ function WholeValueEditor({
|
|
|
3026
3125
|
);
|
|
3027
3126
|
}
|
|
3028
3127
|
if (whole.state === "ready") {
|
|
3029
|
-
return /* @__PURE__ */
|
|
3128
|
+
return /* @__PURE__ */ jsx16(
|
|
3030
3129
|
BasicTextarea2,
|
|
3031
3130
|
{
|
|
3032
3131
|
id,
|
|
@@ -3039,9 +3138,9 @@ function WholeValueEditor({
|
|
|
3039
3138
|
}
|
|
3040
3139
|
);
|
|
3041
3140
|
}
|
|
3042
|
-
return /* @__PURE__ */
|
|
3043
|
-
/* @__PURE__ */
|
|
3044
|
-
/* @__PURE__ */
|
|
3141
|
+
return /* @__PURE__ */ jsxs13("div", { id, className: "flex flex-col gap-1 rounded border px-2 py-1.5 text-sm", children: [
|
|
3142
|
+
/* @__PURE__ */ jsx16(WholeValueCell, { words, pointer }),
|
|
3143
|
+
/* @__PURE__ */ jsx16("span", { className: "text-xs text-muted-foreground", children: whole.state === "loading" ? wholeValueOpening(pointer) : whole.state === "failed" ? `The whole text could not be opened to edit (${whole.why}). Open it to read it.` : WHOLE_VALUE_NOT_EDITABLE_HERE })
|
|
3045
3144
|
] });
|
|
3046
3145
|
}
|
|
3047
3146
|
|
|
@@ -3054,7 +3153,7 @@ import { FormattedCell } from "@ai-matrx/design-system/data-table";
|
|
|
3054
3153
|
import { formatFieldValue as formatFieldValue2, formatPhone, getFieldFormat } from "@ai-matrx/design-system/field-formats";
|
|
3055
3154
|
import { cn as cn10 } from "@ai-matrx/design-system";
|
|
3056
3155
|
import { OutboundLink as OutboundLink3 } from "@ai-matrx/kit/outbound-react";
|
|
3057
|
-
import { jsx as
|
|
3156
|
+
import { jsx as jsx17, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3058
3157
|
var LINK = "inline-flex min-w-0 items-center gap-1 text-primary hover:underline";
|
|
3059
3158
|
var own2 = (event) => event.stopPropagation();
|
|
3060
3159
|
function numberOf2(value) {
|
|
@@ -3076,7 +3175,7 @@ function RatingStars({
|
|
|
3076
3175
|
const score = numberOf2(value) ?? 0;
|
|
3077
3176
|
const shown2 = Math.round(score);
|
|
3078
3177
|
const said2 = `${shown2} out of ${max}`;
|
|
3079
|
-
return /* @__PURE__ */
|
|
3178
|
+
return /* @__PURE__ */ jsx17(
|
|
3080
3179
|
"span",
|
|
3081
3180
|
{
|
|
3082
3181
|
"data-records-rating": "",
|
|
@@ -3088,8 +3187,8 @@ function RatingStars({
|
|
|
3088
3187
|
children: Array.from({ length: max }, (_, i) => {
|
|
3089
3188
|
const n = i + 1;
|
|
3090
3189
|
const lit = n <= shown2;
|
|
3091
|
-
const star = /* @__PURE__ */
|
|
3092
|
-
return onRate ? /* @__PURE__ */
|
|
3190
|
+
const star = /* @__PURE__ */ jsx17("span", { "aria-hidden": true, className: cn10("text-sm leading-none", lit ? "text-amber-400" : "text-muted-foreground/40"), children: "\u2605" });
|
|
3191
|
+
return onRate ? /* @__PURE__ */ jsx17(
|
|
3093
3192
|
"button",
|
|
3094
3193
|
{
|
|
3095
3194
|
type: "button",
|
|
@@ -3114,7 +3213,7 @@ function RatingStars({
|
|
|
3114
3213
|
children: star
|
|
3115
3214
|
},
|
|
3116
3215
|
n
|
|
3117
|
-
) : /* @__PURE__ */
|
|
3216
|
+
) : /* @__PURE__ */ jsx17("span", { children: star }, n);
|
|
3118
3217
|
})
|
|
3119
3218
|
}
|
|
3120
3219
|
);
|
|
@@ -3122,20 +3221,20 @@ function RatingStars({
|
|
|
3122
3221
|
function rich(id, text, raw, format) {
|
|
3123
3222
|
switch (id) {
|
|
3124
3223
|
case "email":
|
|
3125
|
-
return /* @__PURE__ */
|
|
3224
|
+
return /* @__PURE__ */ jsx17("a", { href: `mailto:${text}`, className: LINK, onClick: own2, children: /* @__PURE__ */ jsx17("span", { className: "truncate", children: text }) });
|
|
3126
3225
|
case "url":
|
|
3127
|
-
return /* @__PURE__ */
|
|
3226
|
+
return /* @__PURE__ */ jsx17(OutboundLink3, { href: text.includes("://") ? text : `https://${text}`, className: LINK, onClick: own2, children: /* @__PURE__ */ jsx17("span", { className: "truncate", children: text }) });
|
|
3128
3227
|
case "phone":
|
|
3129
|
-
return /* @__PURE__ */
|
|
3228
|
+
return /* @__PURE__ */ jsx17("a", { href: `tel:${text.replace(/[^\d+]/g, "")}`, className: LINK, onClick: own2, title: text, children: /* @__PURE__ */ jsx17("span", { className: "truncate tabular-nums", children: formatPhone(text) }) });
|
|
3130
3229
|
case "address":
|
|
3131
|
-
return /* @__PURE__ */
|
|
3230
|
+
return /* @__PURE__ */ jsx17(
|
|
3132
3231
|
OutboundLink3,
|
|
3133
3232
|
{
|
|
3134
3233
|
href: `https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(text)}`,
|
|
3135
3234
|
className: LINK,
|
|
3136
3235
|
title: "Open in maps",
|
|
3137
3236
|
onClick: own2,
|
|
3138
|
-
children: /* @__PURE__ */
|
|
3237
|
+
children: /* @__PURE__ */ jsx17("span", { className: "truncate", children: text })
|
|
3139
3238
|
}
|
|
3140
3239
|
);
|
|
3141
3240
|
case "progress": {
|
|
@@ -3143,8 +3242,8 @@ function rich(id, text, raw, format) {
|
|
|
3143
3242
|
if (n === null) return void 0;
|
|
3144
3243
|
const pct = format.options?.percentScale === "fraction" ? n * 100 : n;
|
|
3145
3244
|
const clamped = Math.max(0, Math.min(100, pct));
|
|
3146
|
-
return /* @__PURE__ */
|
|
3147
|
-
/* @__PURE__ */
|
|
3245
|
+
return /* @__PURE__ */ jsxs14("span", { className: "inline-flex w-full min-w-0 items-center gap-2", title: text, children: [
|
|
3246
|
+
/* @__PURE__ */ jsx17(
|
|
3148
3247
|
"span",
|
|
3149
3248
|
{
|
|
3150
3249
|
role: "progressbar",
|
|
@@ -3152,24 +3251,24 @@ function rich(id, text, raw, format) {
|
|
|
3152
3251
|
"aria-valuemax": 100,
|
|
3153
3252
|
"aria-valuenow": Math.round(clamped),
|
|
3154
3253
|
className: "h-1.5 min-w-8 flex-1 overflow-hidden rounded-full bg-muted",
|
|
3155
|
-
children: /* @__PURE__ */
|
|
3254
|
+
children: /* @__PURE__ */ jsx17("span", { className: cn10("block h-full rounded-full", pct >= 100 ? "bg-emerald-500" : "bg-primary"), style: { width: `${clamped}%` } })
|
|
3156
3255
|
}
|
|
3157
3256
|
),
|
|
3158
|
-
/* @__PURE__ */
|
|
3257
|
+
/* @__PURE__ */ jsx17("span", { className: "shrink-0 text-xs tabular-nums text-muted-foreground", children: text })
|
|
3159
3258
|
] });
|
|
3160
3259
|
}
|
|
3161
3260
|
case "color":
|
|
3162
|
-
return /* @__PURE__ */
|
|
3163
|
-
/* @__PURE__ */
|
|
3164
|
-
/* @__PURE__ */
|
|
3261
|
+
return /* @__PURE__ */ jsxs14("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
3262
|
+
/* @__PURE__ */ jsx17("span", { className: "h-4 w-4 shrink-0 rounded border border-border", style: { backgroundColor: text } }),
|
|
3263
|
+
/* @__PURE__ */ jsx17("code", { className: "font-mono text-xs", children: text })
|
|
3165
3264
|
] });
|
|
3166
3265
|
case "tags": {
|
|
3167
3266
|
const items = Array.isArray(raw) ? raw.map(String) : text.split(",").map((s) => s.trim()).filter(Boolean);
|
|
3168
3267
|
if (items.length === 0) return void 0;
|
|
3169
|
-
return /* @__PURE__ */
|
|
3268
|
+
return /* @__PURE__ */ jsx17("span", { className: "flex flex-wrap items-center gap-1", children: items.map((item, i) => /* @__PURE__ */ jsx17("span", { className: "inline-flex items-center rounded-md border border-border bg-muted px-1.5 py-0.5 text-xs", children: item }, `${item}-${i}`)) });
|
|
3170
3269
|
}
|
|
3171
3270
|
case "rating":
|
|
3172
|
-
return numberOf2(raw) === null ? void 0 : /* @__PURE__ */
|
|
3271
|
+
return numberOf2(raw) === null ? void 0 : /* @__PURE__ */ jsx17(RatingStars, { value: raw, max: format.options?.ratingMax ?? 5 });
|
|
3173
3272
|
default:
|
|
3174
3273
|
return void 0;
|
|
3175
3274
|
}
|
|
@@ -3184,16 +3283,16 @@ function FormattedValue({
|
|
|
3184
3283
|
const score = numberOf2(value);
|
|
3185
3284
|
const max = format.options?.ratingMax ?? 5;
|
|
3186
3285
|
if (def?.id === "rating" && onRate && (value === null || value === void 0 || value === "" || score !== null && score >= 0 && score <= max)) {
|
|
3187
|
-
return /* @__PURE__ */
|
|
3286
|
+
return /* @__PURE__ */ jsx17(RatingStars, { value, max: format.options?.ratingMax ?? 5, onRate, selectFirst });
|
|
3188
3287
|
}
|
|
3189
3288
|
const result = formatFieldValue2(value, format);
|
|
3190
|
-
if (!result.ok || result.empty || !def?.rich) return /* @__PURE__ */
|
|
3289
|
+
if (!result.ok || result.empty || !def?.rich) return /* @__PURE__ */ jsx17(FormattedCell, { result });
|
|
3191
3290
|
const look = fieldLookFor(def.id);
|
|
3192
3291
|
if (look) {
|
|
3193
3292
|
const View = look.View;
|
|
3194
|
-
return /* @__PURE__ */
|
|
3293
|
+
return /* @__PURE__ */ jsx17(View, { value, format });
|
|
3195
3294
|
}
|
|
3196
|
-
return rich(def.id, result.text, value, format) ?? /* @__PURE__ */
|
|
3295
|
+
return rich(def.id, result.text, value, format) ?? /* @__PURE__ */ jsx17(FormattedCell, { result });
|
|
3197
3296
|
}
|
|
3198
3297
|
function linkChipText(raw) {
|
|
3199
3298
|
try {
|
|
@@ -3209,7 +3308,7 @@ function linkChipText(raw) {
|
|
|
3209
3308
|
// src/LinkPreviewCard.tsx
|
|
3210
3309
|
import { useEffect as useEffect8, useRef as useRef8, useState as useState13 } from "react";
|
|
3211
3310
|
import { HoverCard, HoverCardContent, HoverCardTrigger } from "@ai-matrx/design-system";
|
|
3212
|
-
import { Fragment as
|
|
3311
|
+
import { Fragment as Fragment8, jsx as jsx18, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
3213
3312
|
var answers = /* @__PURE__ */ new Map();
|
|
3214
3313
|
function LinkPreviewCard({ url, children }) {
|
|
3215
3314
|
const port = useRecordsUi().linkPreview;
|
|
@@ -3217,7 +3316,7 @@ function LinkPreviewCard({ url, children }) {
|
|
|
3217
3316
|
const [open, setOpen] = useState13(false);
|
|
3218
3317
|
const timer = useRef8(null);
|
|
3219
3318
|
useEffect8(() => () => void (timer.current && clearTimeout(timer.current)), []);
|
|
3220
|
-
if (!port) return /* @__PURE__ */
|
|
3319
|
+
if (!port) return /* @__PURE__ */ jsx18(Fragment8, { children });
|
|
3221
3320
|
const ask = () => {
|
|
3222
3321
|
if (preview !== void 0) return;
|
|
3223
3322
|
let pending = answers.get(url);
|
|
@@ -3237,22 +3336,22 @@ function LinkPreviewCard({ url, children }) {
|
|
|
3237
3336
|
setOpen(false);
|
|
3238
3337
|
};
|
|
3239
3338
|
const shown2 = preview && (preview.title || preview.description || preview.imageUrl) ? preview : null;
|
|
3240
|
-
return /* @__PURE__ */
|
|
3241
|
-
/* @__PURE__ */
|
|
3242
|
-
shown2 ? /* @__PURE__ */
|
|
3339
|
+
return /* @__PURE__ */ jsxs15(HoverCard, { open: open && shown2 !== null, onOpenChange: (next) => next ? void 0 : setOpen(false), children: [
|
|
3340
|
+
/* @__PURE__ */ jsx18(HoverCardTrigger, { asChild: true, children: /* @__PURE__ */ jsx18("span", { className: "inline-flex min-w-0 max-w-full", onMouseEnter: enter, onMouseLeave: leave, onFocus: enter, onBlur: leave, children }) }),
|
|
3341
|
+
shown2 ? /* @__PURE__ */ jsxs15(HoverCardContent, { align: "start", className: "w-72 space-y-1.5 p-2 text-xs", "data-records-link-preview": "", children: [
|
|
3243
3342
|
shown2.imageUrl ? (
|
|
3244
3343
|
// eslint-disable-next-line @next/next/no-img-element
|
|
3245
|
-
/* @__PURE__ */
|
|
3344
|
+
/* @__PURE__ */ jsx18("img", { src: shown2.imageUrl, alt: "", className: "h-28 w-full rounded object-cover", referrerPolicy: "no-referrer" })
|
|
3246
3345
|
) : null,
|
|
3247
|
-
/* @__PURE__ */
|
|
3346
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex items-center gap-1.5", children: [
|
|
3248
3347
|
shown2.faviconUrl ? (
|
|
3249
3348
|
// eslint-disable-next-line @next/next/no-img-element
|
|
3250
|
-
/* @__PURE__ */
|
|
3349
|
+
/* @__PURE__ */ jsx18("img", { src: shown2.faviconUrl, alt: "", className: "h-3.5 w-3.5 shrink-0", referrerPolicy: "no-referrer" })
|
|
3251
3350
|
) : null,
|
|
3252
|
-
/* @__PURE__ */
|
|
3351
|
+
/* @__PURE__ */ jsx18("span", { className: "truncate text-muted-foreground", children: shown2.siteName ?? "" })
|
|
3253
3352
|
] }),
|
|
3254
|
-
shown2.title ? /* @__PURE__ */
|
|
3255
|
-
shown2.description ? /* @__PURE__ */
|
|
3353
|
+
shown2.title ? /* @__PURE__ */ jsx18("div", { className: "line-clamp-2 font-medium", children: shown2.title }) : null,
|
|
3354
|
+
shown2.description ? /* @__PURE__ */ jsx18("div", { className: "line-clamp-3 text-muted-foreground", children: shown2.description }) : null
|
|
3256
3355
|
] }) : null
|
|
3257
3356
|
] });
|
|
3258
3357
|
}
|
|
@@ -3262,7 +3361,7 @@ import { useEffect as useEffect9, useRef as useRef9, useState as useState14 } fr
|
|
|
3262
3361
|
import { useOptionalRecordsClient as useOptionalRecordsClient6 } from "@ai-matrx/records/react";
|
|
3263
3362
|
import { Badge as Badge3, Button as Button7, cn as cn11, Dialog, DialogContent, DialogHeader, DialogTitle } from "@ai-matrx/design-system";
|
|
3264
3363
|
import { OutboundLink as OutboundLink4 } from "@ai-matrx/kit/outbound-react";
|
|
3265
|
-
import { jsx as
|
|
3364
|
+
import { jsx as jsx19, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
3266
3365
|
function attachmentIdsOf(value) {
|
|
3267
3366
|
return idsOf(value);
|
|
3268
3367
|
}
|
|
@@ -3322,8 +3421,8 @@ function AttachmentChip({ id, onRemove, onPreview }) {
|
|
|
3322
3421
|
const href = read?.fileId ? host.hrefForFile?.({ fileId: read.fileId }) : void 0;
|
|
3323
3422
|
const title = onPreview ? `Preview ${words}` : href ? `Open ${words}` : read?.why ?? FILE_CHIP_NO_PAGE;
|
|
3324
3423
|
if (read?.fileId && read.mime?.startsWith("image/") && host.fileImage) {
|
|
3325
|
-
return /* @__PURE__ */
|
|
3326
|
-
/* @__PURE__ */
|
|
3424
|
+
return /* @__PURE__ */ jsxs16("span", { className: "relative inline-flex shrink-0", "data-records-file-thumb": id, children: [
|
|
3425
|
+
/* @__PURE__ */ jsx19(
|
|
3327
3426
|
"button",
|
|
3328
3427
|
{
|
|
3329
3428
|
type: "button",
|
|
@@ -3343,7 +3442,7 @@ function AttachmentChip({ id, onRemove, onPreview }) {
|
|
|
3343
3442
|
children: host.fileImage({ fileId: read.fileId, alt: words })
|
|
3344
3443
|
}
|
|
3345
3444
|
),
|
|
3346
|
-
onRemove ? /* @__PURE__ */
|
|
3445
|
+
onRemove ? /* @__PURE__ */ jsx19(
|
|
3347
3446
|
"button",
|
|
3348
3447
|
{
|
|
3349
3448
|
type: "button",
|
|
@@ -3358,7 +3457,7 @@ function AttachmentChip({ id, onRemove, onPreview }) {
|
|
|
3358
3457
|
) : null
|
|
3359
3458
|
] });
|
|
3360
3459
|
}
|
|
3361
|
-
return /* @__PURE__ */
|
|
3460
|
+
return /* @__PURE__ */ jsxs16(
|
|
3362
3461
|
Badge3,
|
|
3363
3462
|
{
|
|
3364
3463
|
variant: "secondary",
|
|
@@ -3374,7 +3473,7 @@ function AttachmentChip({ id, onRemove, onPreview }) {
|
|
|
3374
3473
|
onDoubleClick: (event) => event.stopPropagation()
|
|
3375
3474
|
} : {},
|
|
3376
3475
|
children: [
|
|
3377
|
-
onPreview ? /* @__PURE__ */
|
|
3476
|
+
onPreview ? /* @__PURE__ */ jsx19(
|
|
3378
3477
|
"button",
|
|
3379
3478
|
{
|
|
3380
3479
|
type: "button",
|
|
@@ -3388,7 +3487,7 @@ function AttachmentChip({ id, onRemove, onPreview }) {
|
|
|
3388
3487
|
onDoubleClick: (event) => event.stopPropagation(),
|
|
3389
3488
|
children: words
|
|
3390
3489
|
}
|
|
3391
|
-
) : href ? /* @__PURE__ */
|
|
3490
|
+
) : href ? /* @__PURE__ */ jsx19(
|
|
3392
3491
|
OutboundLink4,
|
|
3393
3492
|
{
|
|
3394
3493
|
href,
|
|
@@ -3398,8 +3497,8 @@ function AttachmentChip({ id, onRemove, onPreview }) {
|
|
|
3398
3497
|
onMouseDown: (event) => event.stopPropagation(),
|
|
3399
3498
|
children: words
|
|
3400
3499
|
}
|
|
3401
|
-
) : /* @__PURE__ */
|
|
3402
|
-
onRemove ? /* @__PURE__ */
|
|
3500
|
+
) : /* @__PURE__ */ jsx19("span", { className: "truncate", children: words }),
|
|
3501
|
+
onRemove ? /* @__PURE__ */ jsx19(
|
|
3403
3502
|
"button",
|
|
3404
3503
|
{
|
|
3405
3504
|
type: "button",
|
|
@@ -3422,8 +3521,8 @@ function AttachmentChips({ value, onRemove }) {
|
|
|
3422
3521
|
const [viewing, setViewing] = useState14(null);
|
|
3423
3522
|
if (ids.length === 0) return null;
|
|
3424
3523
|
const canPreview = Boolean(host.fileImage);
|
|
3425
|
-
return /* @__PURE__ */
|
|
3426
|
-
ids.map((id, index) => /* @__PURE__ */
|
|
3524
|
+
return /* @__PURE__ */ jsxs16("span", { className: "flex flex-wrap gap-1", "data-records-file-chips": "", children: [
|
|
3525
|
+
ids.map((id, index) => /* @__PURE__ */ jsx19(
|
|
3427
3526
|
AttachmentChip,
|
|
3428
3527
|
{
|
|
3429
3528
|
id,
|
|
@@ -3432,7 +3531,7 @@ function AttachmentChips({ value, onRemove }) {
|
|
|
3432
3531
|
},
|
|
3433
3532
|
id
|
|
3434
3533
|
)),
|
|
3435
|
-
viewing !== null && canPreview ? /* @__PURE__ */
|
|
3534
|
+
viewing !== null && canPreview ? /* @__PURE__ */ jsx19(AttachmentViewer, { ids, index: Math.min(viewing, ids.length - 1), onIndex: setViewing, onClose: () => setViewing(null) }) : null
|
|
3436
3535
|
] });
|
|
3437
3536
|
}
|
|
3438
3537
|
function stepAttachment(index, total, way) {
|
|
@@ -3450,7 +3549,7 @@ function AttachmentViewer({
|
|
|
3450
3549
|
const name = read?.name ?? (read ? FILE_CHIP_UNREAD : "\u2026");
|
|
3451
3550
|
const href = read?.fileId ? host.hrefForFile?.({ fileId: read.fileId }) : void 0;
|
|
3452
3551
|
const go = (way) => onIndex(stepAttachment(index, ids.length, way));
|
|
3453
|
-
return /* @__PURE__ */
|
|
3552
|
+
return /* @__PURE__ */ jsx19(Dialog, { open: true, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ jsxs16(
|
|
3454
3553
|
DialogContent,
|
|
3455
3554
|
{
|
|
3456
3555
|
className: "sm:max-w-3xl",
|
|
@@ -3478,17 +3577,17 @@ function AttachmentViewer({
|
|
|
3478
3577
|
},
|
|
3479
3578
|
onClick: (event) => event.stopPropagation(),
|
|
3480
3579
|
children: [
|
|
3481
|
-
/* @__PURE__ */
|
|
3482
|
-
/* @__PURE__ */
|
|
3483
|
-
/* @__PURE__ */
|
|
3484
|
-
/* @__PURE__ */
|
|
3485
|
-
/* @__PURE__ */
|
|
3486
|
-
/* @__PURE__ */
|
|
3580
|
+
/* @__PURE__ */ jsx19(DialogHeader, { children: /* @__PURE__ */ jsx19(DialogTitle, { className: "truncate text-sm", children: name }) }),
|
|
3581
|
+
/* @__PURE__ */ jsx19("div", { className: "relative h-[60vh] w-full overflow-hidden rounded-md bg-muted", "data-records-attachment-stage": "", children: read?.fileId ? host.fileImage?.({ fileId: read.fileId, alt: name }) : null }),
|
|
3582
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-2", children: [
|
|
3583
|
+
/* @__PURE__ */ jsx19(Button7, { size: "sm", variant: "outline", "aria-label": "Previous file", disabled: index === 0, onClick: () => go(-1), "data-records-attachment-previous": "", children: "\u2190" }),
|
|
3584
|
+
/* @__PURE__ */ jsx19(Button7, { size: "sm", variant: "outline", "aria-label": "Next file", disabled: index >= ids.length - 1, onClick: () => go(1), "data-records-attachment-next": "", children: "\u2192" }),
|
|
3585
|
+
/* @__PURE__ */ jsxs16("span", { className: "text-xs tabular-nums text-muted-foreground", "data-records-attachment-position": "", children: [
|
|
3487
3586
|
index + 1,
|
|
3488
3587
|
" of ",
|
|
3489
3588
|
ids.length
|
|
3490
3589
|
] }),
|
|
3491
|
-
href ? /* @__PURE__ */
|
|
3590
|
+
href ? /* @__PURE__ */ jsx19(OutboundLink4, { href, className: "ml-auto text-xs underline-offset-2 hover:underline", children: "Open in new tab" }) : null
|
|
3492
3591
|
] })
|
|
3493
3592
|
]
|
|
3494
3593
|
}
|
|
@@ -3537,19 +3636,19 @@ function AttachmentControl({
|
|
|
3537
3636
|
void pick();
|
|
3538
3637
|
}, [autoOpen]);
|
|
3539
3638
|
if (!hostTakesFiles(host)) {
|
|
3540
|
-
return /* @__PURE__ */
|
|
3639
|
+
return /* @__PURE__ */ jsx19("p", { id, className: "rounded border border-dashed px-2 py-1 text-xs text-muted-foreground", "data-records-no-file-door": "", children: NO_UPLOAD_REASON });
|
|
3541
3640
|
}
|
|
3542
|
-
return /* @__PURE__ */
|
|
3543
|
-
/* @__PURE__ */
|
|
3641
|
+
return /* @__PURE__ */ jsxs16("span", { id, className: "flex flex-col gap-1", "data-records-attachment-editor": "", children: [
|
|
3642
|
+
/* @__PURE__ */ jsx19(
|
|
3544
3643
|
AttachmentChips,
|
|
3545
3644
|
{
|
|
3546
3645
|
value,
|
|
3547
3646
|
...disabled ? {} : { onRemove: (removed) => onChange(withoutAttached(field2, latest.current, removed)) }
|
|
3548
3647
|
}
|
|
3549
3648
|
),
|
|
3550
|
-
/* @__PURE__ */
|
|
3551
|
-
host.pickFiles ? /* @__PURE__ */
|
|
3552
|
-
host.upload ? /* @__PURE__ */
|
|
3649
|
+
/* @__PURE__ */ jsxs16("span", { className: "flex flex-wrap items-center gap-1", children: [
|
|
3650
|
+
host.pickFiles ? /* @__PURE__ */ jsx19(Button7, { size: "sm", variant: "outline", disabled: disabled || busy, onClick: () => void pick(), "data-records-attach-files": "", children: busy ? "Choosing\u2026" : attachmentIdsOf(value).length > 0 ? "Add files\u2026" : "Attach files\u2026" }) : null,
|
|
3651
|
+
host.upload ? /* @__PURE__ */ jsx19(
|
|
3553
3652
|
FilePicker,
|
|
3554
3653
|
{
|
|
3555
3654
|
label: "Upload a file",
|
|
@@ -3569,14 +3668,14 @@ function AttachmentControl({
|
|
|
3569
3668
|
}
|
|
3570
3669
|
) : null
|
|
3571
3670
|
] }),
|
|
3572
|
-
why ? /* @__PURE__ */
|
|
3671
|
+
why ? /* @__PURE__ */ jsx19(RefusalLine, { error: (0, refusals_exports.refusal)("invalid_argument", why, "Pick another file, or try this one again.") }) : null
|
|
3573
3672
|
] });
|
|
3574
3673
|
}
|
|
3575
3674
|
|
|
3576
3675
|
// src/ReferenceChips.tsx
|
|
3577
3676
|
import { entityRefsOf as entityRefsOf2 } from "@ai-matrx/records";
|
|
3578
3677
|
import { Badge as Badge4, Skeleton as Skeleton2, cn as cn12 } from "@ai-matrx/design-system";
|
|
3579
|
-
import { jsx as
|
|
3678
|
+
import { jsx as jsx20, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
3580
3679
|
function glyphOf(icon) {
|
|
3581
3680
|
const text = (icon ?? "").trim();
|
|
3582
3681
|
return text !== "" && text.length <= 8 && /[^\u0000-\u007f]/.test(text) ? text : null;
|
|
@@ -3609,22 +3708,22 @@ function referencesOf(field2, value, kind, labels) {
|
|
|
3609
3708
|
var ARCHIVED_REFERENCE_WORD = "Archived";
|
|
3610
3709
|
var ARCHIVED_REFERENCE_TIP = "In the Archived view; restore it to use it again";
|
|
3611
3710
|
function PageGlyph() {
|
|
3612
|
-
return /* @__PURE__ */
|
|
3613
|
-
/* @__PURE__ */
|
|
3614
|
-
/* @__PURE__ */
|
|
3615
|
-
/* @__PURE__ */
|
|
3616
|
-
/* @__PURE__ */
|
|
3711
|
+
return /* @__PURE__ */ jsxs17("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", width: 14, height: 14, fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", "data-records-page-glyph": "", children: [
|
|
3712
|
+
/* @__PURE__ */ jsx20("path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z" }),
|
|
3713
|
+
/* @__PURE__ */ jsx20("path", { d: "M14 2v4a2 2 0 0 0 2 2h4" }),
|
|
3714
|
+
/* @__PURE__ */ jsx20("path", { d: "M10 13H8" }),
|
|
3715
|
+
/* @__PURE__ */ jsx20("path", { d: "M16 17H8" })
|
|
3617
3716
|
] });
|
|
3618
3717
|
}
|
|
3619
3718
|
function ReferenceChip({ reference, waiting }) {
|
|
3620
3719
|
const host = useRecordsUi();
|
|
3621
3720
|
const look = useEmbeddedLook();
|
|
3622
3721
|
const pending = reference.label == null && reference.token === "record" && !waiting && !host.renderReference;
|
|
3623
|
-
const pendingMark = /* @__PURE__ */
|
|
3722
|
+
const pendingMark = /* @__PURE__ */ jsx20(Skeleton2, { "aria-label": "Loading", "data-records-reference-pending": "", className: "inline-block h-3 w-16 shrink-0 rounded-sm align-middle" });
|
|
3624
3723
|
const words = reference.label ?? (reference.token === "record" ? waiting ?? "Loading\u2026" : WITHHELD_ENTITY_LABEL);
|
|
3625
3724
|
const drawn = host.renderReference ? host.renderReference({ ...reference, label: reference.label ?? words }) : null;
|
|
3626
3725
|
if (look?.plainRelation) {
|
|
3627
|
-
return /* @__PURE__ */
|
|
3726
|
+
return /* @__PURE__ */ jsxs17(
|
|
3628
3727
|
"span",
|
|
3629
3728
|
{
|
|
3630
3729
|
className: cn12(
|
|
@@ -3636,14 +3735,14 @@ function ReferenceChip({ reference, waiting }) {
|
|
|
3636
3735
|
"data-records-reference-archived": reference.archived ? "" : void 0,
|
|
3637
3736
|
title: reference.archived ? ARCHIVED_REFERENCE_TIP : words,
|
|
3638
3737
|
children: [
|
|
3639
|
-
/* @__PURE__ */
|
|
3640
|
-
drawn ?? (pending ? pendingMark : /* @__PURE__ */
|
|
3641
|
-
reference.archived ? /* @__PURE__ */
|
|
3738
|
+
/* @__PURE__ */ jsx20("span", { "aria-hidden": "true", "data-records-reference-icon": "", className: "inline-flex size-4 shrink-0 items-center justify-center text-muted-foreground", children: glyphOf(reference.icon) ? /* @__PURE__ */ jsx20("span", { className: "text-sm leading-none", children: reference.icon }) : reference.icon && host.renderIcon?.(reference.icon) || /* @__PURE__ */ jsx20(PageGlyph, {}) }),
|
|
3739
|
+
drawn ?? (pending ? pendingMark : /* @__PURE__ */ jsx20("span", { className: "truncate", children: words })),
|
|
3740
|
+
reference.archived ? /* @__PURE__ */ jsx20("span", { className: "shrink-0 text-muted-foreground", children: ARCHIVED_REFERENCE_WORD }) : null
|
|
3642
3741
|
]
|
|
3643
3742
|
}
|
|
3644
3743
|
);
|
|
3645
3744
|
}
|
|
3646
|
-
return /* @__PURE__ */
|
|
3745
|
+
return /* @__PURE__ */ jsxs17(
|
|
3647
3746
|
Badge4,
|
|
3648
3747
|
{
|
|
3649
3748
|
variant: "secondary",
|
|
@@ -3655,15 +3754,15 @@ function ReferenceChip({ reference, waiting }) {
|
|
|
3655
3754
|
"data-records-reference-archived": reference.archived ? "" : void 0,
|
|
3656
3755
|
title: reference.archived ? ARCHIVED_REFERENCE_TIP : words,
|
|
3657
3756
|
children: [
|
|
3658
|
-
drawn ?? (pending ? pendingMark : /* @__PURE__ */
|
|
3659
|
-
reference.archived ? /* @__PURE__ */
|
|
3757
|
+
drawn ?? (pending ? pendingMark : /* @__PURE__ */ jsx20("span", { className: "truncate", children: words })),
|
|
3758
|
+
reference.archived ? /* @__PURE__ */ jsx20("span", { className: "shrink-0 text-muted-foreground", children: ARCHIVED_REFERENCE_WORD }) : null
|
|
3660
3759
|
]
|
|
3661
3760
|
}
|
|
3662
3761
|
);
|
|
3663
3762
|
}
|
|
3664
3763
|
function ReferenceChips({ refs, waiting }) {
|
|
3665
|
-
if (refs.length === 0) return /* @__PURE__ */
|
|
3666
|
-
return /* @__PURE__ */
|
|
3764
|
+
if (refs.length === 0) return /* @__PURE__ */ jsx20("span", { className: "text-muted-foreground", children: "\u2014" });
|
|
3765
|
+
return /* @__PURE__ */ jsx20("span", { className: "flex min-w-0 flex-wrap gap-1", "data-records-reference-chips": "", children: refs.map((r) => /* @__PURE__ */ jsx20(ReferenceChip, { reference: r, waiting }, `${r.token}:${r.id}`)) });
|
|
3667
3766
|
}
|
|
3668
3767
|
function KindValueCell({
|
|
3669
3768
|
kv,
|
|
@@ -3672,16 +3771,16 @@ function KindValueCell({
|
|
|
3672
3771
|
}) {
|
|
3673
3772
|
const host = useRecordsUi();
|
|
3674
3773
|
if (host.renderKind) {
|
|
3675
|
-
return /* @__PURE__ */
|
|
3774
|
+
return /* @__PURE__ */ jsx20("span", { className: "flex min-w-0 max-w-full items-center", "data-records-kind-value": kv.kind, children: host.renderKind({ value: kv.value, kind: kv.kind, where, title }) });
|
|
3676
3775
|
}
|
|
3677
3776
|
const named = kv.items.map(kindItemWords).filter((w) => w !== null);
|
|
3678
|
-
return /* @__PURE__ */
|
|
3777
|
+
return /* @__PURE__ */ jsx20("span", { className: cn12("flex min-w-0 flex-wrap gap-1"), "data-records-kind-value": kv.kind, title: JSON.stringify(kv.value), children: named.length > 0 ? named.map((w, i) => /* @__PURE__ */ jsx20(Badge4, { variant: "secondary", className: "px-1.5 py-0 text-[11px] font-normal", children: w }, `${w}-${i}`)) : /* @__PURE__ */ jsx20(Badge4, { variant: "outline", className: "px-1.5 py-0 text-[11px] font-normal", children: kindLabel(kv.kind) }) });
|
|
3679
3778
|
}
|
|
3680
3779
|
|
|
3681
3780
|
// src/ClampedChips.tsx
|
|
3682
3781
|
import { useCallback as useCallback4, useLayoutEffect, useRef as useRef10, useState as useState15 } from "react";
|
|
3683
3782
|
import { Popover as Popover2, PopoverContent as PopoverContent2, PopoverTrigger as PopoverTrigger2, cn as cn13 } from "@ai-matrx/design-system";
|
|
3684
|
-
import { jsx as
|
|
3783
|
+
import { jsx as jsx21, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
3685
3784
|
var GAP = 4;
|
|
3686
3785
|
var OVERFLOW_ROOM = 34;
|
|
3687
3786
|
function ClampedChips({
|
|
@@ -3747,16 +3846,16 @@ function ClampedChips({
|
|
|
3747
3846
|
}, []);
|
|
3748
3847
|
const shown2 = measuring || fit === null ? items : items.slice(0, fit);
|
|
3749
3848
|
const hidden = stands - shown2.length;
|
|
3750
|
-
return /* @__PURE__ */
|
|
3849
|
+
return /* @__PURE__ */ jsxs18(
|
|
3751
3850
|
"span",
|
|
3752
3851
|
{
|
|
3753
3852
|
ref: box,
|
|
3754
3853
|
className: cn13("flex min-w-0 max-w-full flex-nowrap items-center gap-1 overflow-hidden [[data-matrx-cell-lines]:not([data-matrx-cell-lines=one])_&]:flex-wrap", className),
|
|
3755
3854
|
"data-records-clamped": dataAttr ?? "",
|
|
3756
3855
|
children: [
|
|
3757
|
-
shown2.map((item) => /* @__PURE__ */
|
|
3758
|
-
!measuring && hidden > 0 ? /* @__PURE__ */
|
|
3759
|
-
/* @__PURE__ */
|
|
3856
|
+
shown2.map((item) => /* @__PURE__ */ jsx21("span", { "data-clamp-item": "", className: "inline-flex min-w-0 shrink-0 max-w-full", children: item.node }, item.key)),
|
|
3857
|
+
!measuring && hidden > 0 ? /* @__PURE__ */ jsxs18(Popover2, { children: [
|
|
3858
|
+
/* @__PURE__ */ jsx21(PopoverTrigger2, { asChild: true, children: /* @__PURE__ */ jsxs18(
|
|
3760
3859
|
"button",
|
|
3761
3860
|
{
|
|
3762
3861
|
type: "button",
|
|
@@ -3770,7 +3869,7 @@ function ClampedChips({
|
|
|
3770
3869
|
]
|
|
3771
3870
|
}
|
|
3772
3871
|
) }),
|
|
3773
|
-
/* @__PURE__ */
|
|
3872
|
+
/* @__PURE__ */ jsx21(PopoverContent2, { sizing: "content", align: "start", className: "w-80 max-h-[50dvh] overflow-y-auto p-2", "data-records-clamped-all": "", children: all ?? /* @__PURE__ */ jsx21("span", { className: "flex flex-wrap gap-1", children: items.map((item) => /* @__PURE__ */ jsx21("span", { className: "inline-flex max-w-full min-w-0", children: item.node }, item.key)) }) })
|
|
3774
3873
|
] }) : null
|
|
3775
3874
|
]
|
|
3776
3875
|
}
|
|
@@ -4039,7 +4138,7 @@ function useKeptPeople(value, roster) {
|
|
|
4039
4138
|
}
|
|
4040
4139
|
|
|
4041
4140
|
// src/RetiredValues.tsx
|
|
4042
|
-
import { jsx as
|
|
4141
|
+
import { jsx as jsx22, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
4043
4142
|
function same(a, b) {
|
|
4044
4143
|
return JSON.stringify(a) === JSON.stringify(b);
|
|
4045
4144
|
}
|
|
@@ -4056,7 +4155,7 @@ function versionHolding(entries, value) {
|
|
|
4056
4155
|
function KeptPeople({ value, roster }) {
|
|
4057
4156
|
const host = useRecordsUi();
|
|
4058
4157
|
const people = useKeptPeople(value, roster);
|
|
4059
|
-
return /* @__PURE__ */
|
|
4158
|
+
return /* @__PURE__ */ jsx22("span", { className: "flex min-w-0 flex-wrap gap-1", "data-records-person-chips": "", children: (people ?? [{ id: "wait", recordId: null, name: "\u2026" }]).map((who, i) => /* @__PURE__ */ jsx22(
|
|
4060
4159
|
PersonChip,
|
|
4061
4160
|
{
|
|
4062
4161
|
name: who.name,
|
|
@@ -4111,36 +4210,36 @@ function RetiredValues({
|
|
|
4111
4210
|
setSaid(`Put back as version ${done.data.version}.`);
|
|
4112
4211
|
onRestored?.();
|
|
4113
4212
|
};
|
|
4114
|
-
return /* @__PURE__ */
|
|
4115
|
-
/* @__PURE__ */
|
|
4213
|
+
return /* @__PURE__ */ jsxs19("div", { className: "flex flex-col gap-1", "data-records-retired": "", children: [
|
|
4214
|
+
/* @__PURE__ */ jsx22("span", { className: "font-medium", children: "Kept aside" }),
|
|
4116
4215
|
kept.map((entry, index) => {
|
|
4117
4216
|
const id = `${entry.key}-${index}`;
|
|
4118
4217
|
const field2 = fields.find((f) => f.key === entry.key);
|
|
4119
4218
|
const name = field2 ? fieldName(field2) : entry.label ?? entry.key;
|
|
4120
4219
|
const shown2 = field2 ? scalarText(field2, entry.value) : typeof entry.value === "string" ? entry.value : JSON.stringify(entry.value);
|
|
4121
4220
|
const holdsUserId = (Array.isArray(entry.value) ? entry.value : [entry.value]).some(isUuidShape3);
|
|
4122
|
-
return /* @__PURE__ */
|
|
4123
|
-
/* @__PURE__ */
|
|
4124
|
-
/* @__PURE__ */
|
|
4125
|
-
holdsUserId ? /* @__PURE__ */
|
|
4126
|
-
mayWrite ? /* @__PURE__ */
|
|
4221
|
+
return /* @__PURE__ */ jsxs19("div", { className: "flex flex-col gap-0.5", "data-records-retired-key": entry.key, children: [
|
|
4222
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex flex-wrap items-baseline gap-2", children: [
|
|
4223
|
+
/* @__PURE__ */ jsx22("span", { className: "text-muted-foreground", children: name }),
|
|
4224
|
+
holdsUserId ? /* @__PURE__ */ jsx22(KeptPeople, { value: entry.value, roster }) : /* @__PURE__ */ jsx22("span", { className: "min-w-0 break-words", children: shown2 }),
|
|
4225
|
+
mayWrite ? /* @__PURE__ */ jsx22(Button8, { size: "sm", variant: "outline", className: "h-6 px-2 text-xs", disabled: busy !== null, onClick: () => void restore(entry, index), "data-records-retired-restore": "", children: busy === id ? "Restoring\u2026" : "Restore" }) : null
|
|
4127
4226
|
] }),
|
|
4128
|
-
entry.reason ? /* @__PURE__ */
|
|
4129
|
-
refusal?.key === id ? /* @__PURE__ */
|
|
4130
|
-
missing === id ? /* @__PURE__ */
|
|
4227
|
+
entry.reason ? /* @__PURE__ */ jsx22("p", { className: "text-[11px] text-muted-foreground", children: withoutInternalCodes(entry.reason) }) : null,
|
|
4228
|
+
refusal?.key === id ? /* @__PURE__ */ jsx22(RefusalNotice, { error: refusal.error }) : null,
|
|
4229
|
+
missing === id ? /* @__PURE__ */ jsxs19("p", { className: "text-[11px] text-muted-foreground", children: [
|
|
4131
4230
|
"No earlier version of ",
|
|
4132
4231
|
name,
|
|
4133
4232
|
" holds this value, so it cannot be put back from here."
|
|
4134
4233
|
] }) : null
|
|
4135
4234
|
] }, id);
|
|
4136
4235
|
}),
|
|
4137
|
-
said2 ? /* @__PURE__ */
|
|
4236
|
+
said2 ? /* @__PURE__ */ jsx22("p", { role: "status", className: "text-[11px] text-muted-foreground", children: said2 }) : null
|
|
4138
4237
|
] });
|
|
4139
4238
|
}
|
|
4140
4239
|
|
|
4141
4240
|
// src/cellMarks.tsx
|
|
4142
4241
|
import { isUuidShape as isUuidShape4 } from "@ai-matrx/kit/uuid";
|
|
4143
|
-
import { jsx as
|
|
4242
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
4144
4243
|
function keptAsideFor(document2, key) {
|
|
4145
4244
|
const doc = document2;
|
|
4146
4245
|
const now = doc?.[key];
|
|
@@ -4171,7 +4270,7 @@ function KeptAsideValue({ field: field2, entry, shown: shown2 }) {
|
|
|
4171
4270
|
const open = useRecordsUi().openPerson;
|
|
4172
4271
|
const person = (Array.isArray(entry.value) ? entry.value : [entry.value]).find(isUuidShape4);
|
|
4173
4272
|
const opens = open && typeof person === "string";
|
|
4174
|
-
return /* @__PURE__ */
|
|
4273
|
+
return /* @__PURE__ */ jsx23(
|
|
4175
4274
|
"span",
|
|
4176
4275
|
{
|
|
4177
4276
|
"data-records-kept-aside": field2.key,
|
|
@@ -4214,7 +4313,7 @@ function cellMarkSentence(field2, document2, value) {
|
|
|
4214
4313
|
return kept ? keptAsideReason(field2, kept) : null;
|
|
4215
4314
|
}
|
|
4216
4315
|
function WorkedOutError({ field: field2, sentence, floated = false }) {
|
|
4217
|
-
return /* @__PURE__ */
|
|
4316
|
+
return /* @__PURE__ */ jsx23(
|
|
4218
4317
|
"span",
|
|
4219
4318
|
{
|
|
4220
4319
|
"data-records-worked-out-error": field2.key,
|
|
@@ -4248,7 +4347,7 @@ import { PropertyRow } from "@ai-matrx/design-system/controls";
|
|
|
4248
4347
|
import { AlchemyMenu } from "@ai-matrx/alchemy/react";
|
|
4249
4348
|
import { OutboundLink as OutboundLink5 } from "@ai-matrx/kit/outbound-react";
|
|
4250
4349
|
import { humanizeIdentifier } from "@ai-matrx/kit/text-case";
|
|
4251
|
-
import { jsx as
|
|
4350
|
+
import { jsx as jsx24, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
4252
4351
|
var SaveToTable = lazy(() => import("./SaveToTable-QZCRFD5Q.js").then((m) => ({ default: m.SaveToTable })));
|
|
4253
4352
|
var LONGEST_READ = 5e5;
|
|
4254
4353
|
var FENCE = /^```(?:json)?[ \t]*\r?\n([\s\S]*?)\r?\n?```$/;
|
|
@@ -4362,7 +4461,7 @@ function stop(event) {
|
|
|
4362
4461
|
event.stopPropagation();
|
|
4363
4462
|
}
|
|
4364
4463
|
function Thumb({ src, size }) {
|
|
4365
|
-
return /* @__PURE__ */
|
|
4464
|
+
return /* @__PURE__ */ jsx24(OutboundLink5, { href: src, title: src, onClick: stop, className: "inline-flex shrink-0", "data-records-structured-thumb": "", children: /* @__PURE__ */ jsx24(
|
|
4366
4465
|
"img",
|
|
4367
4466
|
{
|
|
4368
4467
|
src,
|
|
@@ -4374,7 +4473,7 @@ function Thumb({ src, size }) {
|
|
|
4374
4473
|
) });
|
|
4375
4474
|
}
|
|
4376
4475
|
function LinkChip({ href, dense }) {
|
|
4377
|
-
return /* @__PURE__ */
|
|
4476
|
+
return /* @__PURE__ */ jsxs20(
|
|
4378
4477
|
OutboundLink5,
|
|
4379
4478
|
{
|
|
4380
4479
|
href,
|
|
@@ -4388,28 +4487,28 @@ function LinkChip({ href, dense }) {
|
|
|
4388
4487
|
),
|
|
4389
4488
|
"data-records-link-chip": "",
|
|
4390
4489
|
children: [
|
|
4391
|
-
/* @__PURE__ */
|
|
4392
|
-
/* @__PURE__ */
|
|
4490
|
+
/* @__PURE__ */ jsx24("span", { "aria-hidden": "true", className: "text-muted-foreground", children: "\u2197" }),
|
|
4491
|
+
/* @__PURE__ */ jsx24("span", { className: "truncate", children: linkChipText(href) })
|
|
4393
4492
|
]
|
|
4394
4493
|
}
|
|
4395
4494
|
);
|
|
4396
4495
|
}
|
|
4397
4496
|
function Scalar({ value, keyName, dense }) {
|
|
4398
4497
|
const ui = useRecordsUi();
|
|
4399
|
-
if (value === null || value === void 0 || value === "") return /* @__PURE__ */
|
|
4400
|
-
if (typeof value === "boolean") return /* @__PURE__ */
|
|
4401
|
-
if (typeof value === "number") return /* @__PURE__ */
|
|
4402
|
-
if (typeof value !== "string") return /* @__PURE__ */
|
|
4498
|
+
if (value === null || value === void 0 || value === "") return /* @__PURE__ */ jsx24("span", { className: "text-muted-foreground", children: "\u2014" });
|
|
4499
|
+
if (typeof value === "boolean") return /* @__PURE__ */ jsx24("span", { children: value ? "Yes" : "No" });
|
|
4500
|
+
if (typeof value === "number") return /* @__PURE__ */ jsx24("span", { className: "tabular-nums", children: value.toLocaleString() });
|
|
4501
|
+
if (typeof value !== "string") return /* @__PURE__ */ jsx24("span", { children: String(value) });
|
|
4403
4502
|
const text = value.trim();
|
|
4404
|
-
if (isImageUrl(text, keyName)) return /* @__PURE__ */
|
|
4405
|
-
if (isUrl(text)) return /* @__PURE__ */
|
|
4503
|
+
if (isImageUrl(text, keyName)) return /* @__PURE__ */ jsx24(Thumb, { src: text, size: dense ? "sm" : "md" });
|
|
4504
|
+
if (isUrl(text)) return /* @__PURE__ */ jsx24(LinkChip, { href: text, dense });
|
|
4406
4505
|
if (/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(text)) {
|
|
4407
|
-
return /* @__PURE__ */
|
|
4506
|
+
return /* @__PURE__ */ jsx24("a", { href: `mailto:${text}`, onClick: stop, className: "text-primary underline-offset-2 hover:underline", children: text });
|
|
4408
4507
|
}
|
|
4409
4508
|
const date = dateWords(text);
|
|
4410
|
-
if (date) return /* @__PURE__ */
|
|
4411
|
-
if (!dense && ui.renderText && text.length > 40 && MARKDOWN.test(text)) return /* @__PURE__ */
|
|
4412
|
-
return /* @__PURE__ */
|
|
4509
|
+
if (date) return /* @__PURE__ */ jsx24("span", { title: text, children: date });
|
|
4510
|
+
if (!dense && ui.renderText && text.length > 40 && MARKDOWN.test(text)) return /* @__PURE__ */ jsx24("div", { className: "min-w-0", children: ui.renderText(text, "cell") });
|
|
4511
|
+
return /* @__PURE__ */ jsx24("span", { className: cn14(dense ? "line-clamp-2 break-words" : "whitespace-pre-wrap [overflow-wrap:anywhere]"), children: text });
|
|
4413
4512
|
}
|
|
4414
4513
|
var TABLE_ROWS = 8;
|
|
4415
4514
|
var TABLE_COLUMNS = 12;
|
|
@@ -4418,12 +4517,12 @@ function RecordsTable({ items }) {
|
|
|
4418
4517
|
const keys = keysOf(items).filter((k) => k !== "__kind");
|
|
4419
4518
|
const pictureFirst = [...keys].sort((a, b) => rank(a, items) - rank(b, items)).slice(0, TABLE_COLUMNS);
|
|
4420
4519
|
const shown2 = all ? items : items.slice(0, TABLE_ROWS);
|
|
4421
|
-
return /* @__PURE__ */
|
|
4422
|
-
/* @__PURE__ */
|
|
4423
|
-
/* @__PURE__ */
|
|
4424
|
-
/* @__PURE__ */
|
|
4520
|
+
return /* @__PURE__ */ jsxs20("div", { className: "min-w-0", "data-records-structured": "table", children: [
|
|
4521
|
+
/* @__PURE__ */ jsx24("div", { className: "max-w-full overflow-x-auto rounded-md border border-border", "data-records-structured-table-frame": "", children: /* @__PURE__ */ jsxs20("table", { className: "w-full border-collapse text-xs", children: [
|
|
4522
|
+
/* @__PURE__ */ jsx24("thead", { className: "bg-muted/60 text-left", children: /* @__PURE__ */ jsx24("tr", { children: pictureFirst.map((k) => /* @__PURE__ */ jsx24("th", { scope: "col", className: "px-2 py-1 font-medium text-muted-foreground [overflow-wrap:anywhere]", children: keyWords(k) }, k)) }) }),
|
|
4523
|
+
/* @__PURE__ */ jsx24("tbody", { children: shown2.map((item, i) => /* @__PURE__ */ jsx24("tr", { className: "border-t border-border/60 align-top", children: pictureFirst.map((k) => /* @__PURE__ */ jsx24("td", { className: "min-w-[2rem] max-w-[18rem] break-words px-2 py-1 [overflow-wrap:anywhere]", children: k in item ? /* @__PURE__ */ jsx24(Nested, { value: item[k], keyName: k, dense: true }) : /* @__PURE__ */ jsx24("span", { className: "text-muted-foreground", children: "\u2014" }) }, k)) }, i)) })
|
|
4425
4524
|
] }) }),
|
|
4426
|
-
items.length > TABLE_ROWS ? /* @__PURE__ */
|
|
4525
|
+
items.length > TABLE_ROWS ? /* @__PURE__ */ jsx24(Button9, { type: "button", variant: "ghost", size: "sm", className: "mt-1 h-6 px-2 text-xs", onClick: (e) => {
|
|
4427
4526
|
stop(e);
|
|
4428
4527
|
setAll((a) => !a);
|
|
4429
4528
|
}, children: all ? "Show fewer" : `Show all ${items.length}` }) : null
|
|
@@ -4436,45 +4535,45 @@ function rank(key, items) {
|
|
|
4436
4535
|
}
|
|
4437
4536
|
function Nested({ value, keyName, dense, depth = 0 }) {
|
|
4438
4537
|
const kv = kindValueOf(value);
|
|
4439
|
-
if (kv) return /* @__PURE__ */
|
|
4538
|
+
if (kv) return /* @__PURE__ */ jsx24(KindValueCell, { kv, where: dense ? "cell" : "panel", title: keyName ? keyWords(keyName) : kv.kind });
|
|
4440
4539
|
const s = structuredOf(value);
|
|
4441
|
-
if (!s) return /* @__PURE__ */
|
|
4540
|
+
if (!s) return /* @__PURE__ */ jsx24(Scalar, { value, keyName, dense });
|
|
4442
4541
|
if (dense) {
|
|
4443
4542
|
if (Array.isArray(s.data) && s.data.length > 0 && s.data.length <= 4 && s.data.every((v) => v === null || typeof v !== "object")) {
|
|
4444
|
-
return /* @__PURE__ */
|
|
4543
|
+
return /* @__PURE__ */ jsx24(ScalarChips, { items: s.data, keyName });
|
|
4445
4544
|
}
|
|
4446
|
-
return /* @__PURE__ */
|
|
4545
|
+
return /* @__PURE__ */ jsx24("span", { className: "text-muted-foreground", children: structuredSummary(s.data) });
|
|
4447
4546
|
}
|
|
4448
|
-
return /* @__PURE__ */
|
|
4547
|
+
return /* @__PURE__ */ jsx24(Shape, { data: s.data, depth });
|
|
4449
4548
|
}
|
|
4450
4549
|
function ScalarChips({ items, keyName }) {
|
|
4451
|
-
return /* @__PURE__ */
|
|
4452
|
-
(item, i) => typeof item === "string" && isUrl(item) ? /* @__PURE__ */
|
|
4550
|
+
return /* @__PURE__ */ jsx24("span", { className: "flex min-w-0 flex-wrap gap-1", "data-records-structured": "chips", children: items.map(
|
|
4551
|
+
(item, i) => typeof item === "string" && isUrl(item) ? /* @__PURE__ */ jsx24(Scalar, { value: item, keyName, dense: true }, i) : /* @__PURE__ */ jsx24(Badge5, { variant: "secondary", className: "max-w-full text-[11px] font-normal", children: /* @__PURE__ */ jsx24("span", { className: "truncate", children: scalarWords(item) }) }, i)
|
|
4453
4552
|
) });
|
|
4454
4553
|
}
|
|
4455
4554
|
function Shape({ data, depth = 0 }) {
|
|
4456
4555
|
if (Array.isArray(data)) {
|
|
4457
|
-
if (data.length === 0) return /* @__PURE__ */
|
|
4458
|
-
if (data.every(isPlainObject) && !data.some((o) => kindValueOf(o))) return /* @__PURE__ */
|
|
4459
|
-
if (data.every((v) => v === null || typeof v !== "object")) return /* @__PURE__ */
|
|
4460
|
-
return /* @__PURE__ */
|
|
4556
|
+
if (data.length === 0) return /* @__PURE__ */ jsx24("span", { className: "text-muted-foreground", children: "Empty list" });
|
|
4557
|
+
if (data.every(isPlainObject) && !data.some((o) => kindValueOf(o))) return /* @__PURE__ */ jsx24(RecordsTable, { items: data });
|
|
4558
|
+
if (data.every((v) => v === null || typeof v !== "object")) return /* @__PURE__ */ jsx24(ScalarChips, { items: data });
|
|
4559
|
+
return /* @__PURE__ */ jsx24("div", { className: "min-w-0", "data-records-structured": "list", children: data.map((item, i) => /* @__PURE__ */ jsx24(Row, { label: `${i + 1}`, value: item, depth }, i)) });
|
|
4461
4560
|
}
|
|
4462
4561
|
const entries = Object.entries(data).filter(([k]) => k !== "__kind");
|
|
4463
|
-
if (entries.length === 0) return /* @__PURE__ */
|
|
4562
|
+
if (entries.length === 0) return /* @__PURE__ */ jsx24("span", { className: "text-muted-foreground", children: "Empty" });
|
|
4464
4563
|
const folds = entries.some(([, v]) => structuredOf(v) !== null);
|
|
4465
|
-
return /* @__PURE__ */
|
|
4564
|
+
return /* @__PURE__ */ jsx24("div", { className: "min-w-0", "data-records-structured": "properties", children: entries.map(([k, v]) => /* @__PURE__ */ jsx24(Row, { label: keyWords(k), keyName: k, value: v, depth, gutter: folds }, k)) });
|
|
4466
4565
|
}
|
|
4467
4566
|
function Row({ label, keyName, value, depth, gutter }) {
|
|
4468
4567
|
const s = kindValueOf(value) ? null : structuredOf(value);
|
|
4469
4568
|
if (!s) {
|
|
4470
|
-
return /* @__PURE__ */
|
|
4569
|
+
return /* @__PURE__ */ jsx24(PropertyRow, { label, gutter: gutter ?? false, value: /* @__PURE__ */ jsx24(Nested, { value, keyName }) });
|
|
4471
4570
|
}
|
|
4472
|
-
return /* @__PURE__ */
|
|
4571
|
+
return /* @__PURE__ */ jsx24(
|
|
4473
4572
|
PropertyRow,
|
|
4474
4573
|
{
|
|
4475
4574
|
label,
|
|
4476
4575
|
value: structuredSummary(s.data),
|
|
4477
|
-
expanded: /* @__PURE__ */
|
|
4576
|
+
expanded: /* @__PURE__ */ jsx24(Shape, { data: s.data, depth: depth + 1 }),
|
|
4478
4577
|
defaultOpen: depth === 0
|
|
4479
4578
|
}
|
|
4480
4579
|
);
|
|
@@ -4491,11 +4590,11 @@ function StructuredValueView({ structured, label, className }) {
|
|
|
4491
4590
|
const ui = useRecordsUi();
|
|
4492
4591
|
const savable = shapeOfValue(structured.data) !== null;
|
|
4493
4592
|
const text = rawTextOf(structured);
|
|
4494
|
-
return /* @__PURE__ */
|
|
4495
|
-
/* @__PURE__ */
|
|
4496
|
-
/* @__PURE__ */
|
|
4497
|
-
savable ? /* @__PURE__ */
|
|
4498
|
-
/* @__PURE__ */
|
|
4593
|
+
return /* @__PURE__ */ jsxs20("div", { className: cn14("flex min-w-0 flex-col gap-1.5 whitespace-normal", className), "data-records-structured-view": "", children: [
|
|
4594
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex min-w-0 items-center gap-1", onClick: stop, children: [
|
|
4595
|
+
/* @__PURE__ */ jsx24("span", { className: "min-w-0 flex-1 truncate text-xs text-muted-foreground", children: recordsCount(structured.data) }),
|
|
4596
|
+
savable ? /* @__PURE__ */ jsx24(Button9, { type: "button", variant: "ghost", size: "sm", className: "h-6 px-2 text-xs", onClick: () => setSaving(true), "data-records-structured-save": "", children: "Save as table" }) : null,
|
|
4597
|
+
/* @__PURE__ */ jsx24(
|
|
4499
4598
|
Button9,
|
|
4500
4599
|
{
|
|
4501
4600
|
type: "button",
|
|
@@ -4508,18 +4607,18 @@ function StructuredValueView({ structured, label, className }) {
|
|
|
4508
4607
|
children: "Raw"
|
|
4509
4608
|
}
|
|
4510
4609
|
),
|
|
4511
|
-
/* @__PURE__ */
|
|
4610
|
+
/* @__PURE__ */ jsx24(AlchemyMenu, { label, sourceId: `records:value:${label}`, size: "xs", json: () => structured.data, human: () => text })
|
|
4512
4611
|
] }),
|
|
4513
|
-
raw ? /* @__PURE__ */
|
|
4514
|
-
saving ? /* @__PURE__ */
|
|
4612
|
+
raw ? /* @__PURE__ */ jsx24("pre", { className: "max-h-[60vh] overflow-auto whitespace-pre-wrap break-words rounded-md bg-muted/60 p-2 font-mono text-xs", "data-records-structured-raw": "", children: structured.raw !== null ? prettyJsonText(structured.raw) : text }) : /* @__PURE__ */ jsx24(Shape, { data: structured.data }),
|
|
4613
|
+
saving ? /* @__PURE__ */ jsx24(Dialog2, { open: true, onOpenChange: (open) => {
|
|
4515
4614
|
if (!open) setSaving(false);
|
|
4516
|
-
}, children: /* @__PURE__ */
|
|
4517
|
-
/* @__PURE__ */
|
|
4615
|
+
}, children: /* @__PURE__ */ jsxs20(DialogContent2, { className: "max-h-[90vh] max-w-3xl overflow-y-auto", children: [
|
|
4616
|
+
/* @__PURE__ */ jsx24(DialogHeader2, { children: /* @__PURE__ */ jsxs20(DialogTitle2, { children: [
|
|
4518
4617
|
"Save ",
|
|
4519
4618
|
label,
|
|
4520
4619
|
" as a table"
|
|
4521
4620
|
] }) }),
|
|
4522
|
-
/* @__PURE__ */
|
|
4621
|
+
/* @__PURE__ */ jsx24(Suspense, { fallback: /* @__PURE__ */ jsx24("div", { className: "h-40 animate-pulse rounded-md bg-muted" }), children: /* @__PURE__ */ jsx24(
|
|
4523
4622
|
SaveToTable,
|
|
4524
4623
|
{
|
|
4525
4624
|
source: { value: structured.data, title: label },
|
|
@@ -4541,8 +4640,8 @@ function StructuredCell({ structured, label }) {
|
|
|
4541
4640
|
const summary = structuredSummary(structured.data);
|
|
4542
4641
|
const first = Array.isArray(structured.data) ? structured.data.find(isPlainObject) : structured.data;
|
|
4543
4642
|
const picture = isPlainObject(first) ? Object.entries(first).find(([k, v]) => isImageUrl(v, k))?.[1] : void 0;
|
|
4544
|
-
return /* @__PURE__ */
|
|
4545
|
-
/* @__PURE__ */
|
|
4643
|
+
return /* @__PURE__ */ jsxs20(Popover3, { children: [
|
|
4644
|
+
/* @__PURE__ */ jsx24(PopoverTrigger3, { asChild: true, children: /* @__PURE__ */ jsxs20(
|
|
4546
4645
|
"button",
|
|
4547
4646
|
{
|
|
4548
4647
|
type: "button",
|
|
@@ -4552,29 +4651,29 @@ function StructuredCell({ structured, label }) {
|
|
|
4552
4651
|
onDoubleClick: stop,
|
|
4553
4652
|
"aria-label": `Open ${label} (${summary})`,
|
|
4554
4653
|
children: [
|
|
4555
|
-
typeof picture === "string" ? /* @__PURE__ */
|
|
4556
|
-
/* @__PURE__ */
|
|
4654
|
+
typeof picture === "string" ? /* @__PURE__ */ jsx24("img", { src: picture, alt: "", loading: "lazy", referrerPolicy: "no-referrer", className: "size-4 shrink-0 rounded-sm object-cover" }) : null,
|
|
4655
|
+
/* @__PURE__ */ jsx24("span", { className: "min-w-0 truncate", children: summary })
|
|
4557
4656
|
]
|
|
4558
4657
|
}
|
|
4559
4658
|
) }),
|
|
4560
|
-
/* @__PURE__ */
|
|
4659
|
+
/* @__PURE__ */ jsx24(
|
|
4561
4660
|
PopoverContent3,
|
|
4562
4661
|
{
|
|
4563
4662
|
align: "start",
|
|
4564
4663
|
collisionPadding: 8,
|
|
4565
4664
|
className: "max-h-[70vh] w-[min(40rem,calc(100vw-1rem))] max-w-[calc(100vw-1rem)] overflow-y-auto p-3",
|
|
4566
4665
|
onClick: stop,
|
|
4567
|
-
children: /* @__PURE__ */
|
|
4666
|
+
children: /* @__PURE__ */ jsx24(StructuredValueView, { structured, label })
|
|
4568
4667
|
}
|
|
4569
4668
|
)
|
|
4570
4669
|
] });
|
|
4571
4670
|
}
|
|
4572
4671
|
|
|
4573
4672
|
// src/values.tsx
|
|
4574
|
-
import { Fragment as
|
|
4673
|
+
import { Fragment as Fragment9, jsx as jsx25, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
4575
4674
|
function statusMark(field2, item, document2) {
|
|
4576
4675
|
const mark = statusMarkOf(field2, item, document2);
|
|
4577
|
-
return mark ? /* @__PURE__ */
|
|
4676
|
+
return mark ? /* @__PURE__ */ jsx25("span", { "aria-label": mark.words, title: mark.words, className: "mr-1", "data-records-status-group": mark.group, children: mark.mark }) : null;
|
|
4578
4677
|
}
|
|
4579
4678
|
function envelopeFor(document2, key) {
|
|
4580
4679
|
const block = document2?._values;
|
|
@@ -4620,7 +4719,7 @@ function sourceArchivedSentence(state2) {
|
|
|
4620
4719
|
return state2.table ? `${state2.label} on ${state2.table} is archived` : `${state2.label} is archived`;
|
|
4621
4720
|
}
|
|
4622
4721
|
function SourceArchivedValue({ state: state2 }) {
|
|
4623
|
-
return /* @__PURE__ */
|
|
4722
|
+
return /* @__PURE__ */ jsx25("span", { className: "text-xs italic text-muted-foreground", title: sourceArchivedSentence(state2), "data-records-source-archived": state2.field_id ?? "", children: SOURCE_ARCHIVED_WORDS });
|
|
4624
4723
|
}
|
|
4625
4724
|
var ABSENCE_WORDS = ABSENCE_WORD_LABEL;
|
|
4626
4725
|
var NOT_STRUCTURE_KINDS = /* @__PURE__ */ new Set(["relation", "entity_reference", "member", "select", "multi_select", "attachment", "signature", "button"]);
|
|
@@ -4631,47 +4730,47 @@ function structuredValueOf(field2, value) {
|
|
|
4631
4730
|
}
|
|
4632
4731
|
function structuredNode(field2, structured, room) {
|
|
4633
4732
|
const label = field2.label || field2.key;
|
|
4634
|
-
return room === "cell" ? /* @__PURE__ */
|
|
4733
|
+
return room === "cell" ? /* @__PURE__ */ jsx25(StructuredCell, { structured, label }) : /* @__PURE__ */ jsx25(StructuredValueView, { structured, label });
|
|
4635
4734
|
}
|
|
4636
4735
|
function renderValue(field2, value, document2, labels, stillWaitingFor, look, room = "cell") {
|
|
4637
4736
|
const archivedSource = sourceArchivedOf2(value);
|
|
4638
|
-
if (archivedSource) return /* @__PURE__ */
|
|
4737
|
+
if (archivedSource) return /* @__PURE__ */ jsx25(SourceArchivedValue, { state: archivedSource });
|
|
4639
4738
|
const envelope = envelopeFor(document2, field2.key);
|
|
4640
4739
|
if (envelope?.absent) {
|
|
4641
|
-
return /* @__PURE__ */
|
|
4740
|
+
return /* @__PURE__ */ jsx25("span", { className: "text-xs italic text-muted-foreground", title: `VAL-2: ${envelope.absent}`, children: ABSENCE_WORDS[String(envelope.absent)] ?? String(envelope.absent) });
|
|
4642
4741
|
}
|
|
4643
4742
|
if (value === null || value === void 0 || value === "") {
|
|
4644
4743
|
const gone = unresolvedFor(document2, field2.key);
|
|
4645
4744
|
if (gone) {
|
|
4646
|
-
return /* @__PURE__ */
|
|
4745
|
+
return /* @__PURE__ */ jsx25("span", { className: "text-xs italic text-muted-foreground", title: `It pointed at ${gone}`, children: "The record this pointed at no longer exists" });
|
|
4647
4746
|
}
|
|
4648
4747
|
const archivedInput = formulaSourceArchived(field2, document2);
|
|
4649
|
-
if (archivedInput) return /* @__PURE__ */
|
|
4748
|
+
if (archivedInput) return /* @__PURE__ */ jsx25(SourceArchivedValue, { state: archivedInput });
|
|
4650
4749
|
const computed = computedEmptyOf(field2, document2);
|
|
4651
|
-
if (computed?.sentence) return /* @__PURE__ */
|
|
4652
|
-
if (computed?.words) return /* @__PURE__ */
|
|
4750
|
+
if (computed?.sentence) return /* @__PURE__ */ jsx25("span", { className: "text-xs italic text-muted-foreground", children: computed.sentence });
|
|
4751
|
+
if (computed?.words) return /* @__PURE__ */ jsx25("span", { "data-records-empty-why": computed.kind, children: computed.words });
|
|
4653
4752
|
if (computed?.why) {
|
|
4654
|
-
return /* @__PURE__ */
|
|
4753
|
+
return /* @__PURE__ */ jsx25("span", { className: "text-muted-foreground", title: computed.why, "data-records-empty-why": computed.kind, children: "\u2014" });
|
|
4655
4754
|
}
|
|
4656
4755
|
if (look?.blankEmpty) return null;
|
|
4657
|
-
return /* @__PURE__ */
|
|
4756
|
+
return /* @__PURE__ */ jsx25("span", { className: "text-muted-foreground", children: "\u2014" });
|
|
4658
4757
|
}
|
|
4659
|
-
if (isSignatureField(field2)) return /* @__PURE__ */
|
|
4660
|
-
if (isButtonField(field2)) return /* @__PURE__ */
|
|
4758
|
+
if (isSignatureField(field2)) return /* @__PURE__ */ jsx25(SignatureValue, { value, fieldKey: field2.key, document: document2 });
|
|
4759
|
+
if (isButtonField(field2)) return /* @__PURE__ */ jsx25(ButtonValue, { field: field2 });
|
|
4661
4760
|
const newer = newerKindValue(field2, value);
|
|
4662
4761
|
if (newer !== void 0) return newer;
|
|
4663
4762
|
const whole = typeof value === "string" ? wholeValueOf(document2, field2.key) : null;
|
|
4664
|
-
if (whole) return /* @__PURE__ */
|
|
4763
|
+
if (whole) return /* @__PURE__ */ jsx25(WholeValueCell, { words: value, pointer: whole });
|
|
4665
4764
|
const kind = editorKindFor(field2);
|
|
4666
4765
|
if (kind === "relation" || kind === "entity_reference") {
|
|
4667
|
-
return /* @__PURE__ */
|
|
4766
|
+
return /* @__PURE__ */ jsx25(ReferenceChips, { refs: referencesOf(field2, value, kind, labels), waiting: stillWaitingFor });
|
|
4668
4767
|
}
|
|
4669
4768
|
if (kind === "member") {
|
|
4670
4769
|
const ids = (Array.isArray(value) ? value : [value]).filter((v) => v !== null && v !== void 0 && v !== "");
|
|
4671
|
-
return /* @__PURE__ */
|
|
4770
|
+
return /* @__PURE__ */ jsx25("span", { className: "flex min-w-0 flex-wrap gap-1", "data-records-person-chips": "", children: ids.map((id, i) => /* @__PURE__ */ jsx25(LivePersonChip, { id: String(id), name: scalarText(field2, id, labels, stillWaitingFor) }, `${String(id)}-${i}`)) });
|
|
4672
4771
|
}
|
|
4673
4772
|
const kv = kind === "attachment" ? null : kindValueOf(value);
|
|
4674
|
-
if (kv) return /* @__PURE__ */
|
|
4773
|
+
if (kv) return /* @__PURE__ */ jsx25(KindValueCell, { kv, where: "cell", title: field2.label });
|
|
4675
4774
|
const structured = structuredValueOf(field2, value);
|
|
4676
4775
|
if (structured) return structuredNode(field2, structured, room);
|
|
4677
4776
|
const chosen = kind === "select" || kind === "multi_select";
|
|
@@ -4681,9 +4780,9 @@ function renderValue(field2, value, document2, labels, stillWaitingFor, look, ro
|
|
|
4681
4780
|
};
|
|
4682
4781
|
if (chosen) {
|
|
4683
4782
|
const items = Array.isArray(value) ? value : [value];
|
|
4684
|
-
return /* @__PURE__ */
|
|
4783
|
+
return /* @__PURE__ */ jsx25("span", { className: "flex flex-wrap gap-1", "data-records-choice-chips": "", children: items.map((item, i) => {
|
|
4685
4784
|
const chip = chipOf(item);
|
|
4686
|
-
return /* @__PURE__ */
|
|
4785
|
+
return /* @__PURE__ */ jsxs21(
|
|
4687
4786
|
Badge6,
|
|
4688
4787
|
{
|
|
4689
4788
|
variant: "outline",
|
|
@@ -4691,7 +4790,7 @@ function renderValue(field2, value, document2, labels, stillWaitingFor, look, ro
|
|
|
4691
4790
|
"data-records-choice-chip": "",
|
|
4692
4791
|
...chip.tinted ? { "data-records-choice-tint": "" } : {},
|
|
4693
4792
|
children: [
|
|
4694
|
-
look?.choiceDot ? /* @__PURE__ */
|
|
4793
|
+
look?.choiceDot ? /* @__PURE__ */ jsx25("span", { "aria-hidden": "true", "data-matrx-pill-ink": "", "data-records-choice-dot": "", className: cn15("mr-1.5 inline-block size-1.5 shrink-0 rounded-full", chip.dot) }) : null,
|
|
4695
4794
|
statusMark(field2, item, Array.isArray(value) ? void 0 : document2),
|
|
4696
4795
|
scalarText(field2, item, labels, Array.isArray(value) ? void 0 : stillWaitingFor)
|
|
4697
4796
|
]
|
|
@@ -4700,15 +4799,15 @@ function renderValue(field2, value, document2, labels, stillWaitingFor, look, ro
|
|
|
4700
4799
|
);
|
|
4701
4800
|
}) });
|
|
4702
4801
|
}
|
|
4703
|
-
if (kind === "attachment") return /* @__PURE__ */
|
|
4802
|
+
if (kind === "attachment") return /* @__PURE__ */ jsx25(AttachmentChips, { value });
|
|
4704
4803
|
if (Array.isArray(value)) {
|
|
4705
|
-
return /* @__PURE__ */
|
|
4804
|
+
return /* @__PURE__ */ jsx25("span", { className: "flex flex-wrap gap-1", children: value.map((item, i) => /* @__PURE__ */ jsx25(Badge6, { variant: "secondary", className: "text-[11px]", children: scalarText(field2, item, labels) }, `${String(item)}-${i}`)) });
|
|
4706
4805
|
}
|
|
4707
4806
|
const pictureAt = imageAddressOf(field2, value);
|
|
4708
|
-
if (pictureAt) return /* @__PURE__ */
|
|
4807
|
+
if (pictureAt) return /* @__PURE__ */ jsx25(ImageUrlValue, { url: pictureAt, alt: field2.label || field2.key, room });
|
|
4709
4808
|
if (kind === "url" && typeof value === "string") {
|
|
4710
4809
|
const href = value.includes("://") ? value : `https://${value}`;
|
|
4711
|
-
return /* @__PURE__ */
|
|
4810
|
+
return /* @__PURE__ */ jsx25(LinkPreviewCard, { url: href, children: /* @__PURE__ */ jsxs21(
|
|
4712
4811
|
OutboundLink6,
|
|
4713
4812
|
{
|
|
4714
4813
|
className: "inline-flex min-w-0 max-w-full items-center gap-1 rounded-md border border-border bg-muted/60 px-1.5 py-0.5 text-[11px] text-foreground hover:bg-accent",
|
|
@@ -4717,14 +4816,14 @@ function renderValue(field2, value, document2, labels, stillWaitingFor, look, ro
|
|
|
4717
4816
|
"data-records-link-chip": "",
|
|
4718
4817
|
onClick: (event) => event.stopPropagation(),
|
|
4719
4818
|
children: [
|
|
4720
|
-
/* @__PURE__ */
|
|
4721
|
-
/* @__PURE__ */
|
|
4819
|
+
/* @__PURE__ */ jsx25("span", { "aria-hidden": "true", className: "text-muted-foreground", children: "\u2197" }),
|
|
4820
|
+
/* @__PURE__ */ jsx25("span", { className: "truncate", children: linkChipText(value) })
|
|
4722
4821
|
]
|
|
4723
4822
|
}
|
|
4724
4823
|
) });
|
|
4725
4824
|
}
|
|
4726
4825
|
if (kind === "phone" && typeof value === "string" && value.trim() !== "") {
|
|
4727
|
-
return /* @__PURE__ */
|
|
4826
|
+
return /* @__PURE__ */ jsx25(
|
|
4728
4827
|
"a",
|
|
4729
4828
|
{
|
|
4730
4829
|
className: "truncate tabular-nums text-primary underline-offset-2 hover:underline",
|
|
@@ -4737,12 +4836,12 @@ function renderValue(field2, value, document2, labels, stillWaitingFor, look, ro
|
|
|
4737
4836
|
);
|
|
4738
4837
|
}
|
|
4739
4838
|
if (kind === "email" && typeof value === "string") {
|
|
4740
|
-
return /* @__PURE__ */
|
|
4839
|
+
return /* @__PURE__ */ jsx25("a", { className: "truncate text-primary underline-offset-2 hover:underline", href: `mailto:${value}`, children: value });
|
|
4741
4840
|
}
|
|
4742
4841
|
if (typeof value === "boolean") {
|
|
4743
|
-
return /* @__PURE__ */
|
|
4842
|
+
return /* @__PURE__ */ jsx25("span", { className: kind === "checkbox" ? "text-sm" : "", title: value ? "Yes" : "No", children: value ? "\u2713" : "\u2014" });
|
|
4744
4843
|
}
|
|
4745
|
-
return /* @__PURE__ */
|
|
4844
|
+
return /* @__PURE__ */ jsx25("span", { className: cn15("truncate", kind === "number" || kind === "currency" || kind === "percent" ? "tabular-nums" : ""), children: scalarText(field2, value, labels, stillWaitingFor) });
|
|
4746
4845
|
}
|
|
4747
4846
|
function isImageUrl2(value) {
|
|
4748
4847
|
const text = value.trim();
|
|
@@ -4767,7 +4866,7 @@ function imageAddressOf(field2, value) {
|
|
|
4767
4866
|
function ImageUrlValue({ url, alt, room }) {
|
|
4768
4867
|
const host = useRecordsUi();
|
|
4769
4868
|
const box = room === "full" ? "size-24" : "size-6";
|
|
4770
|
-
return /* @__PURE__ */
|
|
4869
|
+
return /* @__PURE__ */ jsx25(
|
|
4771
4870
|
OutboundLink6,
|
|
4772
4871
|
{
|
|
4773
4872
|
className: cn15("inline-flex shrink-0 overflow-hidden rounded-md border border-border bg-muted/40", host.fileImage ? box : "min-w-0 max-w-full items-center gap-1 px-1.5 py-0.5 text-[11px] text-foreground hover:bg-accent"),
|
|
@@ -4775,13 +4874,13 @@ function ImageUrlValue({ url, alt, room }) {
|
|
|
4775
4874
|
title: url,
|
|
4776
4875
|
"data-records-image-url": "",
|
|
4777
4876
|
onClick: (event) => event.stopPropagation(),
|
|
4778
|
-
children: host.fileImage ? host.fileImage({ fileId: url, alt }) : /* @__PURE__ */
|
|
4877
|
+
children: host.fileImage ? host.fileImage({ fileId: url, alt }) : /* @__PURE__ */ jsx25("span", { className: "truncate", children: linkChipText(url) })
|
|
4779
4878
|
}
|
|
4780
4879
|
);
|
|
4781
4880
|
}
|
|
4782
4881
|
function LivePersonChip({ id, name }) {
|
|
4783
4882
|
const open = useRecordsUi().openPerson;
|
|
4784
|
-
return /* @__PURE__ */
|
|
4883
|
+
return /* @__PURE__ */ jsx25(PersonChip, { name, ...open ? { onOpen: () => void openStoredPerson(id, open) } : {} });
|
|
4785
4884
|
}
|
|
4786
4885
|
var NEVER_AN_ID_KINDS = /* @__PURE__ */ new Set(["member", "person", "number", "currency", "percent", "date", "datetime", "checkbox", "boolean"]);
|
|
4787
4886
|
function personWordsOf(kind, value) {
|
|
@@ -4842,7 +4941,7 @@ function ProvenanceBadge({ document: document2, fieldKey }) {
|
|
|
4842
4941
|
const sources = document2?._sources;
|
|
4843
4942
|
const source = sources?.[envelope.src];
|
|
4844
4943
|
const label = source ? Object.values(source).map(String).join(" \xB7 ") : envelope.src;
|
|
4845
|
-
return /* @__PURE__ */
|
|
4944
|
+
return /* @__PURE__ */ jsx25(Badge6, { variant: "outline", className: "text-[10px] font-normal", title: `Written by ${envelope.actor ?? "?"}${envelope.at ? ` at ${envelope.at}` : ""}`, children: label });
|
|
4846
4945
|
}
|
|
4847
4946
|
function RecordValue({
|
|
4848
4947
|
field: field2,
|
|
@@ -4859,58 +4958,58 @@ function RecordValue({
|
|
|
4859
4958
|
const labels = useRecordLabels(ONE_FIELD_ARRAY_CACHE(field2));
|
|
4860
4959
|
const stillWaitingFor = useLabelWait(field2);
|
|
4861
4960
|
const embeddedLook = useEmbeddedLook();
|
|
4862
|
-
if (isButtonField(field2)) return /* @__PURE__ */
|
|
4863
|
-
if (withheld && (value === null || value === void 0)) return /* @__PURE__ */
|
|
4961
|
+
if (isButtonField(field2)) return /* @__PURE__ */ jsx25(ButtonValue, { field: field2, recordId, inCell });
|
|
4962
|
+
if (withheld && (value === null || value === void 0)) return /* @__PURE__ */ jsx25(WithheldValue, { field: field2, notice: withheld });
|
|
4864
4963
|
if (value === null || value === void 0) {
|
|
4865
4964
|
const failed = workedOutErrorFor(document2, field2.key);
|
|
4866
|
-
if (failed) return /* @__PURE__ */
|
|
4965
|
+
if (failed) return /* @__PURE__ */ jsx25(WorkedOutError, { field: field2, sentence: failed, floated: Boolean(inCell) });
|
|
4867
4966
|
}
|
|
4868
4967
|
if (inCell) {
|
|
4869
4968
|
const kept = keptAsideFor(document2, field2.key);
|
|
4870
|
-
if (kept) return /* @__PURE__ */
|
|
4969
|
+
if (kept) return /* @__PURE__ */ jsx25(KeptAsideValue, { field: field2, entry: kept, shown: scalarText(field2, kept.value) });
|
|
4871
4970
|
}
|
|
4872
4971
|
const archivedSource = sourceArchivedOf2(value);
|
|
4873
|
-
if (archivedSource) return /* @__PURE__ */
|
|
4874
|
-
if (formulaHasNothingToWorkOn(field2, document2)) return embeddedLook?.blankEmpty ? null : /* @__PURE__ */
|
|
4972
|
+
if (archivedSource) return /* @__PURE__ */ jsx25(SourceArchivedValue, { state: archivedSource });
|
|
4973
|
+
if (formulaHasNothingToWorkOn(field2, document2)) return embeddedLook?.blankEmpty ? null : /* @__PURE__ */ jsx25("span", { className: "text-muted-foreground", children: "\u2014" });
|
|
4875
4974
|
if (value !== null && value !== void 0 && value !== "" && !envelopeFor(document2, field2.key)?.absent) {
|
|
4876
4975
|
const newer = newerKindValue(field2, value, { inCell });
|
|
4877
|
-
if (newer !== void 0) return /* @__PURE__ */
|
|
4976
|
+
if (newer !== void 0) return /* @__PURE__ */ jsx25(Fragment9, { children: newer });
|
|
4878
4977
|
}
|
|
4879
4978
|
const room = inCell && !roomy ? "cell" : "full";
|
|
4880
4979
|
if (value !== null && value !== void 0 && !wholeValueOf(document2, field2.key) && !envelopeFor(document2, field2.key)?.absent) {
|
|
4881
4980
|
const structured = structuredValueOf(field2, value);
|
|
4882
|
-
if (structured) return /* @__PURE__ */
|
|
4981
|
+
if (structured) return /* @__PURE__ */ jsx25(Fragment9, { children: structuredNode(field2, structured, room) });
|
|
4883
4982
|
}
|
|
4884
4983
|
if (inCell && ui.grid === "merged" && ui.renderText && typeof value === "string" && value.trim() !== "" && editorKindFor(field2) === "long_text" && !shownAsOf(field2) && !wholeValueOf(document2, field2.key) && !envelopeFor(document2, field2.key)?.absent && // A long-text cell holding a kind is drawn by the kind system below, not as markdown.
|
|
4885
4984
|
!kindValueOf(value)) {
|
|
4886
|
-
return /* @__PURE__ */
|
|
4985
|
+
return /* @__PURE__ */ jsx25("span", { className: "block h-[1.5em] min-w-0 overflow-hidden whitespace-normal [[data-matrx-cell-lines]:not([data-matrx-cell-lines=one])_&]:h-auto", "data-records-cell-text": "", children: ui.renderText(withoutLeadingBlank(value), "cell") });
|
|
4887
4986
|
}
|
|
4888
4987
|
if (isSignatureField(field2) && value !== null && value !== void 0 && value !== "") {
|
|
4889
|
-
return /* @__PURE__ */
|
|
4988
|
+
return /* @__PURE__ */ jsx25(SignatureValue, { value, inCell, recordId, fieldKey: field2.key, document: document2 });
|
|
4890
4989
|
}
|
|
4891
4990
|
if (inCell) {
|
|
4892
4991
|
const linkKind = editorKindFor(field2);
|
|
4893
4992
|
if (linkKind === "relation" || linkKind === "entity_reference") {
|
|
4894
4993
|
const refs = referencesOf(field2, value, linkKind, labels);
|
|
4895
4994
|
if (refs.length > 1) {
|
|
4896
|
-
return /* @__PURE__ */
|
|
4995
|
+
return /* @__PURE__ */ jsx25(
|
|
4897
4996
|
ClampedChips,
|
|
4898
4997
|
{
|
|
4899
4998
|
dataAttr: field2.key,
|
|
4900
|
-
items: refs.map((r) => ({ key: `${r.token}:${r.id}`, node: /* @__PURE__ */
|
|
4999
|
+
items: refs.map((r) => ({ key: `${r.token}:${r.id}`, node: /* @__PURE__ */ jsx25(ReferenceChip, { reference: r, waiting: stillWaitingFor }) }))
|
|
4901
5000
|
}
|
|
4902
5001
|
);
|
|
4903
5002
|
}
|
|
4904
5003
|
}
|
|
4905
5004
|
}
|
|
4906
5005
|
const pictureAt = value !== null && value !== void 0 && !wholeValueOf(document2, field2.key) && !envelopeFor(document2, field2.key)?.absent ? imageAddressOf(field2, value) : null;
|
|
4907
|
-
if (pictureAt) return /* @__PURE__ */
|
|
5006
|
+
if (pictureAt) return /* @__PURE__ */ jsx25(ImageUrlValue, { url: pictureAt, alt: field2.label || field2.key, room });
|
|
4908
5007
|
const shown2 = format ?? formatForField(field2);
|
|
4909
5008
|
const shape = shown2 && (shown2.id === "date" || shown2.id === "datetime") && isDateField(field2) ? dateFormatFor(field2, value) : void 0;
|
|
4910
5009
|
const dated = shape ? { ...shape, ...shown2?.options ? { options: shown2.options } : {} } : void 0;
|
|
4911
5010
|
const formatted = shown2 ? formatColumnValue({ format: dated ?? shown2 }, value) : null;
|
|
4912
|
-
if (formatted && !(embeddedLook?.blankEmpty && formatted.empty)) return /* @__PURE__ */
|
|
4913
|
-
return /* @__PURE__ */
|
|
5011
|
+
if (formatted && !(embeddedLook?.blankEmpty && formatted.empty)) return /* @__PURE__ */ jsx25(FormattedValue, { value, format: dated ?? shown2 });
|
|
5012
|
+
return /* @__PURE__ */ jsx25(Fragment9, { children: renderValue(field2, value, document2, labels, stillWaitingFor, embeddedLook, room) });
|
|
4914
5013
|
}
|
|
4915
5014
|
var ONE_FIELD_ARRAYS = /* @__PURE__ */ new WeakMap();
|
|
4916
5015
|
function ONE_FIELD_ARRAY_CACHE(field2) {
|
|
@@ -4932,7 +5031,7 @@ function cardWords(record, field2, labels) {
|
|
|
4932
5031
|
}
|
|
4933
5032
|
|
|
4934
5033
|
// src/SourceArchivedNotice.tsx
|
|
4935
|
-
import { jsx as
|
|
5034
|
+
import { jsx as jsx26, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
4936
5035
|
function bringBackLabel(state2) {
|
|
4937
5036
|
return state2.label ? `Bring back ${state2.label}` : "Bring it back";
|
|
4938
5037
|
}
|
|
@@ -4949,7 +5048,7 @@ function SourceArchivedNotice({ fieldId, tableId }) {
|
|
|
4949
5048
|
useEffect11(() => {
|
|
4950
5049
|
void read();
|
|
4951
5050
|
}, [read]);
|
|
4952
|
-
if (refused && !state2) return /* @__PURE__ */
|
|
5051
|
+
if (refused && !state2) return /* @__PURE__ */ jsx26(RefusalNotice, { error: refused });
|
|
4953
5052
|
if (!state2) return null;
|
|
4954
5053
|
const restore = async () => {
|
|
4955
5054
|
if (!state2.field_id) return;
|
|
@@ -4965,30 +5064,30 @@ function SourceArchivedNotice({ fieldId, tableId }) {
|
|
|
4965
5064
|
tableShapeChanged(tableId);
|
|
4966
5065
|
await read();
|
|
4967
5066
|
};
|
|
4968
|
-
return /* @__PURE__ */
|
|
5067
|
+
return /* @__PURE__ */ jsxs22(
|
|
4969
5068
|
"div",
|
|
4970
5069
|
{
|
|
4971
5070
|
className: "flex flex-wrap items-center gap-2 rounded-md border border-border px-3 py-2",
|
|
4972
5071
|
"data-testid": "source-archived-notice",
|
|
4973
5072
|
"data-field-id": state2.field_id ?? "",
|
|
4974
5073
|
children: [
|
|
4975
|
-
/* @__PURE__ */
|
|
4976
|
-
/* @__PURE__ */
|
|
4977
|
-
/* @__PURE__ */
|
|
5074
|
+
/* @__PURE__ */ jsxs22("div", { className: "flex min-w-0 flex-1 flex-col", children: [
|
|
5075
|
+
/* @__PURE__ */ jsx26("span", { className: "text-sm", children: SOURCE_ARCHIVED_WORDS }),
|
|
5076
|
+
/* @__PURE__ */ jsx26("span", { className: "truncate text-xs text-muted-foreground", children: sourceArchivedSentence(state2) })
|
|
4978
5077
|
] }),
|
|
4979
|
-
state2.field_id ? /* @__PURE__ */
|
|
4980
|
-
refused ? /* @__PURE__ */
|
|
5078
|
+
state2.field_id ? /* @__PURE__ */ jsx26(Button10, { type: "button", size: "sm", variant: "secondary", disabled: busy, onClick: () => void restore(), children: bringBackLabel(state2) }) : null,
|
|
5079
|
+
refused ? /* @__PURE__ */ jsx26(RefusalNotice, { error: refused, className: "basis-full" }) : null
|
|
4981
5080
|
]
|
|
4982
5081
|
}
|
|
4983
5082
|
);
|
|
4984
5083
|
}
|
|
4985
5084
|
|
|
4986
5085
|
// src/Condition.tsx
|
|
4987
|
-
import { createContext as
|
|
5086
|
+
import { createContext as createContext3, useContext as useContext2, useEffect as useEffect12, useState as useState20 } from "react";
|
|
4988
5087
|
import { BasicInput as BasicInput6, Button as Button11 } from "@ai-matrx/design-system";
|
|
4989
5088
|
import { optionKey as optionKey2, optionLabel, rankTypedMatches as rankTypedMatches3 } from "@ai-matrx/records";
|
|
4990
5089
|
import { useOptionalRecordsClient as useOptionalRecordsClient8 } from "@ai-matrx/records/react";
|
|
4991
|
-
import { Fragment as
|
|
5090
|
+
import { Fragment as Fragment10, jsx as jsx27, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
4992
5091
|
var CONDITION_OPS = [
|
|
4993
5092
|
{ op: "eq", label: "is" },
|
|
4994
5093
|
{ op: "ne", label: "is not" },
|
|
@@ -5025,7 +5124,7 @@ function linkedOf(expr) {
|
|
|
5025
5124
|
if (match !== "any" && match !== "none") return null;
|
|
5026
5125
|
return { via: rel["field"], inner: a["field"], op: match === "any" ? "eq" : "ne", value: b["const"] };
|
|
5027
5126
|
}
|
|
5028
|
-
var FilterTermsContext =
|
|
5127
|
+
var FilterTermsContext = createContext3(false);
|
|
5029
5128
|
var RELATIVE_DAY_TERMS = [
|
|
5030
5129
|
{ kind: "today", label: "is today" },
|
|
5031
5130
|
{ kind: "tomorrow", label: "is tomorrow" },
|
|
@@ -5094,7 +5193,7 @@ function ChoiceValue({ field: field2, value, onChange }) {
|
|
|
5094
5193
|
};
|
|
5095
5194
|
}, [client, field2.id]);
|
|
5096
5195
|
if (!choices || choices.length === 0) {
|
|
5097
|
-
return /* @__PURE__ */
|
|
5196
|
+
return /* @__PURE__ */ jsx27(
|
|
5098
5197
|
BasicInput6,
|
|
5099
5198
|
{
|
|
5100
5199
|
className: "h-8 w-28 text-xs",
|
|
@@ -5105,7 +5204,7 @@ function ChoiceValue({ field: field2, value, onChange }) {
|
|
|
5105
5204
|
);
|
|
5106
5205
|
}
|
|
5107
5206
|
const shown2 = rankTypedMatches3(choices, search.trim(), (c) => c.label);
|
|
5108
|
-
return /* @__PURE__ */
|
|
5207
|
+
return /* @__PURE__ */ jsx27("span", { className: "inline-flex min-w-0", "data-records-condition-choice": "", "data-pick-value": value, children: /* @__PURE__ */ jsx27(
|
|
5109
5208
|
PickOrAdd,
|
|
5110
5209
|
{
|
|
5111
5210
|
triggerSize: "compact",
|
|
@@ -5131,7 +5230,7 @@ function ChoiceValue({ field: field2, value, onChange }) {
|
|
|
5131
5230
|
setOpen(false);
|
|
5132
5231
|
setSearch("");
|
|
5133
5232
|
},
|
|
5134
|
-
empty: /* @__PURE__ */
|
|
5233
|
+
empty: /* @__PURE__ */ jsx27("p", { className: "p-2 text-xs text-muted-foreground", children: "No match" })
|
|
5135
5234
|
}
|
|
5136
5235
|
) });
|
|
5137
5236
|
}
|
|
@@ -5271,9 +5370,9 @@ function ConditionRow({ lead, expr, fields, onChange, emptyLabel = "always", cla
|
|
|
5271
5370
|
VALUELESS_OPS.has(chosenOp) ? { op: chosenOp, args: [{ field: chosenField }] } : { op: chosenOp, args: [{ field: chosenField }, { const: chosenValue }] }
|
|
5272
5371
|
);
|
|
5273
5372
|
}
|
|
5274
|
-
return /* @__PURE__ */
|
|
5275
|
-
/* @__PURE__ */
|
|
5276
|
-
/* @__PURE__ */
|
|
5373
|
+
return /* @__PURE__ */ jsxs23("div", { className: className ?? "flex flex-wrap items-center gap-1 text-xs", children: [
|
|
5374
|
+
/* @__PURE__ */ jsx27("span", { className: "text-muted-foreground", children: lead }),
|
|
5375
|
+
/* @__PURE__ */ jsx27(
|
|
5277
5376
|
PickOne,
|
|
5278
5377
|
{
|
|
5279
5378
|
label: "Condition field",
|
|
@@ -5284,7 +5383,7 @@ function ConditionRow({ lead, expr, fields, onChange, emptyLabel = "always", cla
|
|
|
5284
5383
|
attrs: { "data-condition": "field" }
|
|
5285
5384
|
}
|
|
5286
5385
|
),
|
|
5287
|
-
onField && !fields.some((f) => f.id === onField) ? /* @__PURE__ */
|
|
5386
|
+
onField && !fields.some((f) => f.id === onField) ? /* @__PURE__ */ jsx27(
|
|
5288
5387
|
"span",
|
|
5289
5388
|
{
|
|
5290
5389
|
className: "rounded bg-destructive px-1.5 py-0.5 text-[11px] font-medium text-destructive-foreground",
|
|
@@ -5293,8 +5392,8 @@ function ConditionRow({ lead, expr, fields, onChange, emptyLabel = "always", cla
|
|
|
5293
5392
|
children: "Missing question"
|
|
5294
5393
|
}
|
|
5295
5394
|
) : null,
|
|
5296
|
-
onField ? /* @__PURE__ */
|
|
5297
|
-
/* @__PURE__ */
|
|
5395
|
+
onField ? /* @__PURE__ */ jsxs23(Fragment10, { children: [
|
|
5396
|
+
/* @__PURE__ */ jsx27(
|
|
5298
5397
|
PickOne,
|
|
5299
5398
|
{
|
|
5300
5399
|
label: "Condition comparison",
|
|
@@ -5305,7 +5404,7 @@ function ConditionRow({ lead, expr, fields, onChange, emptyLabel = "always", cla
|
|
|
5305
5404
|
attrs: { "data-condition": "comparison" }
|
|
5306
5405
|
}
|
|
5307
5406
|
),
|
|
5308
|
-
relative ? relativeTerm?.takesDays ? /* @__PURE__ */
|
|
5407
|
+
relative ? relativeTerm?.takesDays ? /* @__PURE__ */ jsx27(
|
|
5309
5408
|
BasicInput6,
|
|
5310
5409
|
{
|
|
5311
5410
|
className: "h-8 w-16 text-xs",
|
|
@@ -5322,7 +5421,7 @@ function ConditionRow({ lead, expr, fields, onChange, emptyLabel = "always", cla
|
|
|
5322
5421
|
// is asked for ONE record even when the column holds several: a clause compares
|
|
5323
5422
|
// against one value, and a picker that let somebody choose three would be
|
|
5324
5423
|
// writing an expression this row cannot draw back.
|
|
5325
|
-
/* @__PURE__ */
|
|
5424
|
+
/* @__PURE__ */ jsx27(
|
|
5326
5425
|
RelationPicker,
|
|
5327
5426
|
{
|
|
5328
5427
|
field: { ...chosen.field, multi: false },
|
|
@@ -5333,7 +5432,7 @@ function ConditionRow({ lead, expr, fields, onChange, emptyLabel = "always", cla
|
|
|
5333
5432
|
allowCreate: false
|
|
5334
5433
|
}
|
|
5335
5434
|
)
|
|
5336
|
-
) : isChoiceColumn(chosen) && (op2 === "eq" || op2 === "ne" || op2 === "contains" || op2 === "not_contains") ? /* @__PURE__ */
|
|
5435
|
+
) : isChoiceColumn(chosen) && (op2 === "eq" || op2 === "ne" || op2 === "contains" || op2 === "not_contains") ? /* @__PURE__ */ jsx27(ChoiceValue, { field: chosen.field, value: String(value ?? ""), onChange: (word) => write({ value: word }) }) : /* @__PURE__ */ jsx27(
|
|
5337
5436
|
BasicInput6,
|
|
5338
5437
|
{
|
|
5339
5438
|
className: "h-8 w-28 text-xs",
|
|
@@ -5421,16 +5520,16 @@ function ConditionGroup({
|
|
|
5421
5520
|
const joinWord = (index) => index === 0 ? lead : joiner === "or" || joiner === "none" ? "or" : "and";
|
|
5422
5521
|
const showJoiner = nested || args.length > 1 || joiner === "none" || joiner === "notall";
|
|
5423
5522
|
const opposite = joiner === "or" || joiner === "none" ? "and" : "or";
|
|
5424
|
-
return /* @__PURE__ */
|
|
5523
|
+
return /* @__PURE__ */ jsxs23(
|
|
5425
5524
|
"div",
|
|
5426
5525
|
{
|
|
5427
5526
|
className: className ?? "flex flex-col gap-1 text-xs",
|
|
5428
5527
|
"data-testid": nested ? "condition-nested-group" : "condition-group",
|
|
5429
5528
|
"data-depth": depth,
|
|
5430
5529
|
children: [
|
|
5431
|
-
showJoiner ? /* @__PURE__ */
|
|
5432
|
-
/* @__PURE__ */
|
|
5433
|
-
/* @__PURE__ */
|
|
5530
|
+
showJoiner ? /* @__PURE__ */ jsxs23("div", { className: "flex items-center gap-1", children: [
|
|
5531
|
+
/* @__PURE__ */ jsx27("span", { className: "text-muted-foreground", children: nested ? "Group:" : lead }),
|
|
5532
|
+
/* @__PURE__ */ jsx27(
|
|
5434
5533
|
PickOne,
|
|
5435
5534
|
{
|
|
5436
5535
|
label: nested ? `How the conditions in this group are joined (level ${depth + 1})` : "How these conditions are joined",
|
|
@@ -5441,7 +5540,7 @@ function ConditionGroup({
|
|
|
5441
5540
|
attrs: { "data-condition": "joiner" }
|
|
5442
5541
|
}
|
|
5443
5542
|
),
|
|
5444
|
-
nested && onRemove ? /* @__PURE__ */
|
|
5543
|
+
nested && onRemove ? /* @__PURE__ */ jsx27(
|
|
5445
5544
|
Button11,
|
|
5446
5545
|
{
|
|
5447
5546
|
size: "sm",
|
|
@@ -5453,7 +5552,7 @@ function ConditionGroup({
|
|
|
5453
5552
|
}
|
|
5454
5553
|
) : null
|
|
5455
5554
|
] }) : null,
|
|
5456
|
-
args.length === 0 ? /* @__PURE__ */
|
|
5555
|
+
args.length === 0 ? /* @__PURE__ */ jsx27(
|
|
5457
5556
|
ConditionRow,
|
|
5458
5557
|
{
|
|
5459
5558
|
lead,
|
|
@@ -5466,7 +5565,7 @@ function ConditionGroup({
|
|
|
5466
5565
|
const group = conditionGroupOf(arg);
|
|
5467
5566
|
const key = `clause-${index}`;
|
|
5468
5567
|
if (group && allowNesting) {
|
|
5469
|
-
return /* @__PURE__ */
|
|
5568
|
+
return /* @__PURE__ */ jsx27("div", { className: "ml-4 rounded border border-dashed p-1", children: /* @__PURE__ */ jsx27(
|
|
5470
5569
|
ConditionGroup,
|
|
5471
5570
|
{
|
|
5472
5571
|
lead: joinWord(index),
|
|
@@ -5480,7 +5579,7 @@ function ConditionGroup({
|
|
|
5480
5579
|
}
|
|
5481
5580
|
) }, key);
|
|
5482
5581
|
}
|
|
5483
|
-
return /* @__PURE__ */
|
|
5582
|
+
return /* @__PURE__ */ jsx27(
|
|
5484
5583
|
ConditionRow,
|
|
5485
5584
|
{
|
|
5486
5585
|
lead: showJoiner || args.length > 1 ? joinWord(index) : lead,
|
|
@@ -5492,7 +5591,7 @@ function ConditionGroup({
|
|
|
5492
5591
|
key
|
|
5493
5592
|
);
|
|
5494
5593
|
}),
|
|
5495
|
-
drafting ? /* @__PURE__ */
|
|
5594
|
+
drafting ? /* @__PURE__ */ jsx27("div", { className: drafting === "group" ? "ml-4 rounded border border-dashed p-1" : void 0, children: /* @__PURE__ */ jsx27(
|
|
5496
5595
|
ConditionRow,
|
|
5497
5596
|
{
|
|
5498
5597
|
lead: drafting === "group" ? `${joinWord(1)}, a group where` : joinWord(1),
|
|
@@ -5507,8 +5606,8 @@ function ConditionGroup({
|
|
|
5507
5606
|
}
|
|
5508
5607
|
}
|
|
5509
5608
|
) }) : null,
|
|
5510
|
-
args.length > 0 && !drafting ? /* @__PURE__ */
|
|
5511
|
-
/* @__PURE__ */
|
|
5609
|
+
args.length > 0 && !drafting ? /* @__PURE__ */ jsxs23("div", { className: "flex items-center gap-1", children: [
|
|
5610
|
+
/* @__PURE__ */ jsx27(
|
|
5512
5611
|
Button11,
|
|
5513
5612
|
{
|
|
5514
5613
|
size: "sm",
|
|
@@ -5519,7 +5618,7 @@ function ConditionGroup({
|
|
|
5519
5618
|
children: "Add another condition"
|
|
5520
5619
|
}
|
|
5521
5620
|
),
|
|
5522
|
-
allowNesting && (maxDepth === void 0 || depth < maxDepth) ? /* @__PURE__ */
|
|
5621
|
+
allowNesting && (maxDepth === void 0 || depth < maxDepth) ? /* @__PURE__ */ jsx27(
|
|
5523
5622
|
Button11,
|
|
5524
5623
|
{
|
|
5525
5624
|
size: "sm",
|
|
@@ -5648,7 +5747,7 @@ async function forgetWrittenWords(client, tableId, key, written) {
|
|
|
5648
5747
|
}
|
|
5649
5748
|
|
|
5650
5749
|
// src/FieldRetype.tsx
|
|
5651
|
-
import { jsx as
|
|
5750
|
+
import { jsx as jsx28, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
5652
5751
|
var RETYPE_TARGETS = [
|
|
5653
5752
|
{ id: "text", behaviour: "text", kind: null, label: "Text", holds: "words", via: "behaviour" },
|
|
5654
5753
|
{ id: "number", behaviour: "range", kind: "number", label: "Number", holds: "a number", via: "behaviour" },
|
|
@@ -5761,7 +5860,7 @@ function FieldRetype({ field: field2, tableId, onRetyped }) {
|
|
|
5761
5860
|
};
|
|
5762
5861
|
}, [client, tableId, field2.key, to, person, roster]);
|
|
5763
5862
|
if (!retypeableFrom(field2)) {
|
|
5764
|
-
return /* @__PURE__ */
|
|
5863
|
+
return /* @__PURE__ */ jsx28("p", { className: "text-[11px] text-muted-foreground", "data-records-retype": "not-here", children: whyNotRetypeable(field2) });
|
|
5765
5864
|
}
|
|
5766
5865
|
const change = async () => {
|
|
5767
5866
|
if (!to) return;
|
|
@@ -5836,21 +5935,21 @@ function FieldRetype({ field: field2, tableId, onRetyped }) {
|
|
|
5836
5935
|
tableShapeChanged2(tableId);
|
|
5837
5936
|
onRetyped?.();
|
|
5838
5937
|
};
|
|
5839
|
-
return /* @__PURE__ */
|
|
5840
|
-
/* @__PURE__ */
|
|
5841
|
-
/* @__PURE__ */
|
|
5842
|
-
/* @__PURE__ */
|
|
5843
|
-
/* @__PURE__ */
|
|
5938
|
+
return /* @__PURE__ */ jsxs24("div", { className: "flex flex-col gap-1.5", "data-records-retype": "", children: [
|
|
5939
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
5940
|
+
/* @__PURE__ */ jsxs24(Select3, { value: to?.id ?? "", onValueChange: (next) => setTo(targets.find((t) => t.id === next) ?? null), children: [
|
|
5941
|
+
/* @__PURE__ */ jsx28(SelectTrigger3, { size: "sm", "aria-label": "Change what this column holds", className: "w-auto min-w-[12rem]", children: /* @__PURE__ */ jsx28(SelectValue3, { placeholder: "Change what this column holds" }) }),
|
|
5942
|
+
/* @__PURE__ */ jsx28(SelectContent3, { children: targets.map((t) => /* @__PURE__ */ jsx28(SelectItem3, { value: t.id, children: t.label }, t.id)) })
|
|
5844
5943
|
] }),
|
|
5845
|
-
to ? /* @__PURE__ */
|
|
5846
|
-
to ? /* @__PURE__ */
|
|
5944
|
+
to ? /* @__PURE__ */ jsx28(Button12, { size: "sm", disabled: busy || asking || preview === null, onClick: () => void change(), "data-records-retype-go": "", children: busy ? "Changing\u2026" : `Change to ${to.label}` }) : null,
|
|
5945
|
+
to ? /* @__PURE__ */ jsx28(Button12, { size: "sm", variant: "ghost", onClick: () => setTo(null), disabled: busy, children: "Cancel" }) : null
|
|
5847
5946
|
] }),
|
|
5848
|
-
to && asking ? /* @__PURE__ */
|
|
5947
|
+
to && asking ? /* @__PURE__ */ jsxs24("p", { className: "text-[11px] text-muted-foreground", children: [
|
|
5849
5948
|
"Counting ",
|
|
5850
5949
|
name,
|
|
5851
5950
|
"'s values\u2026"
|
|
5852
5951
|
] }) : null,
|
|
5853
|
-
to && preview ? /* @__PURE__ */
|
|
5952
|
+
to && preview ? /* @__PURE__ */ jsxs24("p", { className: "text-[11px] text-muted-foreground", "data-records-retype-preview": "", children: [
|
|
5854
5953
|
preview.converts,
|
|
5855
5954
|
" ",
|
|
5856
5955
|
preview.converts === 1 ? "value converts" : "values convert",
|
|
@@ -5859,8 +5958,8 @@ function FieldRetype({ field: field2, tableId, onRetyped }) {
|
|
|
5859
5958
|
preview.keptAside > 0 ? `; ${preview.keptAside} ${preview.keptAside === 1 ? "value does" : "values do"} not fit and will be kept aside with ${preview.keptAside === 1 ? "its record" : "their records"}, with the reason \u2014 nothing is deleted` + (preview.examples.length > 0 ? ` (for example ${preview.examples.map((e) => `\u201C${e}\u201D`).join(", ")})` : "") : "",
|
|
5860
5959
|
preview.partial ? ". Counted over the first 1,000 different values." : "."
|
|
5861
5960
|
] }) : null,
|
|
5862
|
-
refusal ? /* @__PURE__ */
|
|
5863
|
-
said2 ? /* @__PURE__ */
|
|
5961
|
+
refusal ? /* @__PURE__ */ jsx28(RefusalNotice, { error: refusal }) : null,
|
|
5962
|
+
said2 ? /* @__PURE__ */ jsx28("p", { role: "status", className: "text-[11px] text-muted-foreground", "data-records-retype-done": "", children: said2 }) : null
|
|
5864
5963
|
] });
|
|
5865
5964
|
}
|
|
5866
5965
|
|
|
@@ -5868,7 +5967,7 @@ function FieldRetype({ field: field2, tableId, onRetyped }) {
|
|
|
5868
5967
|
import { useEffect as useEffect14, useMemo as useMemo9, useRef as useRef11, useState as useState22 } from "react";
|
|
5869
5968
|
import { previewRuleChange } from "@ai-matrx/records";
|
|
5870
5969
|
import { useRecordsClient as useRecordsClient7 } from "@ai-matrx/records/react";
|
|
5871
|
-
import { jsx as
|
|
5970
|
+
import { jsx as jsx29, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
5872
5971
|
var PREVIEW_GROUPS = 1e3;
|
|
5873
5972
|
function ruleWords(rules) {
|
|
5874
5973
|
return rules.map((r) => JSON.stringify([r.kind, r.value === void 0 || r.value === "" ? null : String(r.value), r.min ?? null, r.example ?? null])).sort().join("|");
|
|
@@ -5913,16 +6012,16 @@ function FieldRulePreview({ field: field2, tableId, rules }) {
|
|
|
5913
6012
|
clearTimeout(timer);
|
|
5914
6013
|
};
|
|
5915
6014
|
}, [client, tableId, field2.key, key]);
|
|
5916
|
-
if (refusal) return /* @__PURE__ */
|
|
6015
|
+
if (refusal) return /* @__PURE__ */ jsx29(RefusalNotice, { error: refusal });
|
|
5917
6016
|
if (!preview) {
|
|
5918
|
-
return /* @__PURE__ */
|
|
6017
|
+
return /* @__PURE__ */ jsxs25("p", { className: "text-[11px] text-muted-foreground", "data-records-rule-preview": "counting", children: [
|
|
5919
6018
|
"Counting ",
|
|
5920
6019
|
name,
|
|
5921
6020
|
"'s values\u2026"
|
|
5922
6021
|
] });
|
|
5923
6022
|
}
|
|
5924
6023
|
if (preview.keptAside === 0) {
|
|
5925
|
-
return /* @__PURE__ */
|
|
6024
|
+
return /* @__PURE__ */ jsxs25("p", { className: "text-[11px] text-muted-foreground", "data-records-rule-preview": "fits", children: [
|
|
5926
6025
|
"Every value already in ",
|
|
5927
6026
|
name,
|
|
5928
6027
|
" still fits",
|
|
@@ -5930,7 +6029,7 @@ function FieldRulePreview({ field: field2, tableId, rules }) {
|
|
|
5930
6029
|
"."
|
|
5931
6030
|
] });
|
|
5932
6031
|
}
|
|
5933
|
-
return /* @__PURE__ */
|
|
6032
|
+
return /* @__PURE__ */ jsxs25("p", { className: "text-[11px] text-amber-700 dark:text-amber-400", role: "status", "data-records-rule-preview": "sets-aside", children: [
|
|
5934
6033
|
preview.keptAside,
|
|
5935
6034
|
" ",
|
|
5936
6035
|
preview.keptAside === 1 ? "value no longer fits and will be" : "values no longer fit and will be",
|
|
@@ -6020,7 +6119,7 @@ import {
|
|
|
6020
6119
|
statusGroupOf as statusGroupOf2
|
|
6021
6120
|
} from "@ai-matrx/records";
|
|
6022
6121
|
import { Label as Label5, Select as Select4, SelectContent as SelectContent4, SelectItem as SelectItem4, SelectTrigger as SelectTrigger4, SelectValue as SelectValue4 } from "@ai-matrx/design-system";
|
|
6023
|
-
import { jsx as
|
|
6122
|
+
import { jsx as jsx30, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
6024
6123
|
var STATUS_STARTING_CHOICES = [
|
|
6025
6124
|
{ words: "Not started", group: "todo" },
|
|
6026
6125
|
{ words: "In progress", group: "in_progress" },
|
|
@@ -6049,13 +6148,13 @@ function StatusGroupsQuestion({
|
|
|
6049
6148
|
onGroup
|
|
6050
6149
|
}) {
|
|
6051
6150
|
if (rows.length === 0) return null;
|
|
6052
|
-
return /* @__PURE__ */
|
|
6053
|
-
/* @__PURE__ */
|
|
6054
|
-
rows.map((r) => /* @__PURE__ */
|
|
6055
|
-
/* @__PURE__ */
|
|
6056
|
-
/* @__PURE__ */
|
|
6057
|
-
/* @__PURE__ */
|
|
6058
|
-
/* @__PURE__ */
|
|
6151
|
+
return /* @__PURE__ */ jsxs26("div", { className: "flex flex-col gap-1", "data-records-status-groups": "", children: [
|
|
6152
|
+
/* @__PURE__ */ jsx30(Label5, { className: "text-xs", children: "Groups" }),
|
|
6153
|
+
rows.map((r) => /* @__PURE__ */ jsxs26("div", { className: "flex items-center gap-2", children: [
|
|
6154
|
+
/* @__PURE__ */ jsx30("span", { className: "min-w-0 flex-1 truncate text-sm", children: r.words }),
|
|
6155
|
+
/* @__PURE__ */ jsxs26(Select4, { value: r.group, onValueChange: (next) => onGroup(r.ref, next), children: [
|
|
6156
|
+
/* @__PURE__ */ jsx30(SelectTrigger4, { size: "sm", className: "w-36", "aria-label": `Group for ${r.words}`, children: /* @__PURE__ */ jsx30(SelectValue4, {}) }),
|
|
6157
|
+
/* @__PURE__ */ jsx30(SelectContent4, { children: STATUS_GROUPS.map((g) => /* @__PURE__ */ jsxs26(SelectItem4, { value: g, children: [
|
|
6059
6158
|
STATUS_GROUP_MARK[g],
|
|
6060
6159
|
" ",
|
|
6061
6160
|
STATUS_GROUP_WORDS2[g]
|
|
@@ -6065,11 +6164,11 @@ function StatusGroupsQuestion({
|
|
|
6065
6164
|
] });
|
|
6066
6165
|
}
|
|
6067
6166
|
function RatingMaxQuestion({ value, onChange }) {
|
|
6068
|
-
return /* @__PURE__ */
|
|
6069
|
-
/* @__PURE__ */
|
|
6070
|
-
/* @__PURE__ */
|
|
6071
|
-
/* @__PURE__ */
|
|
6072
|
-
/* @__PURE__ */
|
|
6167
|
+
return /* @__PURE__ */ jsxs26("label", { className: "flex max-w-[16rem] flex-col gap-1", children: [
|
|
6168
|
+
/* @__PURE__ */ jsx30(Label5, { className: "text-xs", children: "Out of" }),
|
|
6169
|
+
/* @__PURE__ */ jsxs26(Select4, { value: String(value), onValueChange: (next) => onChange(Number(next)), children: [
|
|
6170
|
+
/* @__PURE__ */ jsx30(SelectTrigger4, { size: "sm", "aria-label": "Out of", children: /* @__PURE__ */ jsx30(SelectValue4, {}) }),
|
|
6171
|
+
/* @__PURE__ */ jsx30(SelectContent4, { children: Array.from({ length: 10 }, (_, i) => i + 1).map((n) => /* @__PURE__ */ jsxs26(SelectItem4, { value: String(n), children: [
|
|
6073
6172
|
n,
|
|
6074
6173
|
" ",
|
|
6075
6174
|
n === 1 ? "star" : "stars"
|
|
@@ -6090,13 +6189,13 @@ var SYMBOLOGY_WORDS = {
|
|
|
6090
6189
|
pdf417: "PDF417"
|
|
6091
6190
|
};
|
|
6092
6191
|
function BarcodeSymbologyQuestion({ value, onChange }) {
|
|
6093
|
-
return /* @__PURE__ */
|
|
6094
|
-
/* @__PURE__ */
|
|
6095
|
-
/* @__PURE__ */
|
|
6096
|
-
/* @__PURE__ */
|
|
6097
|
-
/* @__PURE__ */
|
|
6098
|
-
/* @__PURE__ */
|
|
6099
|
-
BARCODE_SYMBOLOGIES.map((s) => /* @__PURE__ */
|
|
6192
|
+
return /* @__PURE__ */ jsxs26("label", { className: "flex max-w-[16rem] flex-col gap-1", children: [
|
|
6193
|
+
/* @__PURE__ */ jsx30(Label5, { className: "text-xs", children: "Code type" }),
|
|
6194
|
+
/* @__PURE__ */ jsxs26(Select4, { value: value === "" ? "any" : value, onValueChange: (next) => onChange(next === "any" ? "" : next), children: [
|
|
6195
|
+
/* @__PURE__ */ jsx30(SelectTrigger4, { size: "sm", "aria-label": "Code type", children: /* @__PURE__ */ jsx30(SelectValue4, {}) }),
|
|
6196
|
+
/* @__PURE__ */ jsxs26(SelectContent4, { children: [
|
|
6197
|
+
/* @__PURE__ */ jsx30(SelectItem4, { value: "any", children: "Any code" }),
|
|
6198
|
+
BARCODE_SYMBOLOGIES.map((s) => /* @__PURE__ */ jsx30(SelectItem4, { value: s, children: SYMBOLOGY_WORDS[s] }, s))
|
|
6100
6199
|
] })
|
|
6101
6200
|
] })
|
|
6102
6201
|
] });
|
|
@@ -6109,7 +6208,7 @@ import {
|
|
|
6109
6208
|
getFieldFormat as getFieldFormat2,
|
|
6110
6209
|
groupedFormatsForBase
|
|
6111
6210
|
} from "@ai-matrx/design-system/field-formats";
|
|
6112
|
-
import { jsx as
|
|
6211
|
+
import { jsx as jsx31, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
6113
6212
|
var KIND_WORD = {
|
|
6114
6213
|
choice: "select",
|
|
6115
6214
|
multi_choice: "multi_select",
|
|
@@ -6232,13 +6331,13 @@ function FieldFormatPicker({
|
|
|
6232
6331
|
else merged[key] = next;
|
|
6233
6332
|
onValue({ ...value, format: Object.keys(merged).length > 0 ? { id: value.format.id, options: merged } : { id: value.format.id } });
|
|
6234
6333
|
};
|
|
6235
|
-
const option = (key, label, control) => optionKeys.includes(key) ? /* @__PURE__ */
|
|
6334
|
+
const option = (key, label, control) => optionKeys.includes(key) ? /* @__PURE__ */ jsxs27("label", { className: "flex min-w-[6rem] flex-col gap-0.5 text-[11px] text-muted-foreground", children: [
|
|
6236
6335
|
label,
|
|
6237
6336
|
control
|
|
6238
6337
|
] }, key) : null;
|
|
6239
|
-
return /* @__PURE__ */
|
|
6240
|
-
/* @__PURE__ */
|
|
6241
|
-
/* @__PURE__ */
|
|
6338
|
+
return /* @__PURE__ */ jsxs27("div", { className: "flex flex-col gap-1", "data-records-format-picker": "", children: [
|
|
6339
|
+
/* @__PURE__ */ jsx31(Label6, { className: "text-xs", htmlFor: `records-shows-as-${field2.id}`, children: "Shows as" }),
|
|
6340
|
+
/* @__PURE__ */ jsx31(
|
|
6242
6341
|
PickOne,
|
|
6243
6342
|
{
|
|
6244
6343
|
id: `records-shows-as-${field2.id}`,
|
|
@@ -6264,12 +6363,12 @@ function FieldFormatPicker({
|
|
|
6264
6363
|
]
|
|
6265
6364
|
}
|
|
6266
6365
|
),
|
|
6267
|
-
/* @__PURE__ */
|
|
6268
|
-
optionKeys.length > 0 ? /* @__PURE__ */
|
|
6366
|
+
/* @__PURE__ */ jsx31("p", { className: "text-[11px] text-muted-foreground", children: retypedTo ? `This changes what the column stores, to ${storesWord(retypedTo.def)}. The store converts each value it can, and says so before it keeps anything it cannot.` : active ? active.description : "How every value in this column is written, wherever it appears." }),
|
|
6367
|
+
optionKeys.length > 0 ? /* @__PURE__ */ jsxs27("div", { className: "flex flex-wrap items-end gap-2", children: [
|
|
6269
6368
|
option(
|
|
6270
6369
|
"currency",
|
|
6271
6370
|
"Currency",
|
|
6272
|
-
/* @__PURE__ */
|
|
6371
|
+
/* @__PURE__ */ jsx31(
|
|
6273
6372
|
PickOne,
|
|
6274
6373
|
{
|
|
6275
6374
|
label: "Currency",
|
|
@@ -6284,7 +6383,7 @@ function FieldFormatPicker({
|
|
|
6284
6383
|
option(
|
|
6285
6384
|
"percentScale",
|
|
6286
6385
|
"Stored as",
|
|
6287
|
-
/* @__PURE__ */
|
|
6386
|
+
/* @__PURE__ */ jsx31(
|
|
6288
6387
|
PickOne,
|
|
6289
6388
|
{
|
|
6290
6389
|
label: "Stored as",
|
|
@@ -6302,7 +6401,7 @@ function FieldFormatPicker({
|
|
|
6302
6401
|
option(
|
|
6303
6402
|
"durationUnit",
|
|
6304
6403
|
"Unit",
|
|
6305
|
-
/* @__PURE__ */
|
|
6404
|
+
/* @__PURE__ */ jsx31(
|
|
6306
6405
|
PickOne,
|
|
6307
6406
|
{
|
|
6308
6407
|
label: "Unit",
|
|
@@ -6322,7 +6421,7 @@ function FieldFormatPicker({
|
|
|
6322
6421
|
option(
|
|
6323
6422
|
"precision",
|
|
6324
6423
|
"Decimals",
|
|
6325
|
-
/* @__PURE__ */
|
|
6424
|
+
/* @__PURE__ */ jsx31(
|
|
6326
6425
|
"input",
|
|
6327
6426
|
{
|
|
6328
6427
|
"data-records-format-option": "precision",
|
|
@@ -6339,7 +6438,7 @@ function FieldFormatPicker({
|
|
|
6339
6438
|
option(
|
|
6340
6439
|
"ratingMax",
|
|
6341
6440
|
"Out of",
|
|
6342
|
-
/* @__PURE__ */
|
|
6441
|
+
/* @__PURE__ */ jsx31(
|
|
6343
6442
|
"input",
|
|
6344
6443
|
{
|
|
6345
6444
|
"data-records-format-option": "ratingMax",
|
|
@@ -6355,7 +6454,7 @@ function FieldFormatPicker({
|
|
|
6355
6454
|
option(
|
|
6356
6455
|
"dateStyle",
|
|
6357
6456
|
"Style",
|
|
6358
|
-
/* @__PURE__ */
|
|
6457
|
+
/* @__PURE__ */ jsx31(
|
|
6359
6458
|
PickOne,
|
|
6360
6459
|
{
|
|
6361
6460
|
label: "Style",
|
|
@@ -6374,15 +6473,15 @@ function FieldFormatPicker({
|
|
|
6374
6473
|
option(
|
|
6375
6474
|
"prefix",
|
|
6376
6475
|
"Prefix",
|
|
6377
|
-
/* @__PURE__ */
|
|
6476
|
+
/* @__PURE__ */ jsx31("input", { "data-records-format-option": "prefix", className: BOX, value: options.prefix ?? "", onChange: (e) => setOption("prefix", e.target.value) })
|
|
6378
6477
|
),
|
|
6379
6478
|
option(
|
|
6380
6479
|
"suffix",
|
|
6381
6480
|
"Suffix",
|
|
6382
|
-
/* @__PURE__ */
|
|
6481
|
+
/* @__PURE__ */ jsx31("input", { "data-records-format-option": "suffix", className: BOX, placeholder: "e.g. kg", value: options.suffix ?? "", onChange: (e) => setOption("suffix", e.target.value) })
|
|
6383
6482
|
),
|
|
6384
|
-
optionKeys.includes("useGrouping") ? /* @__PURE__ */
|
|
6385
|
-
/* @__PURE__ */
|
|
6483
|
+
optionKeys.includes("useGrouping") ? /* @__PURE__ */ jsxs27("label", { className: "flex items-center gap-1.5 pb-1 text-[11px] text-muted-foreground", children: [
|
|
6484
|
+
/* @__PURE__ */ jsx31(
|
|
6386
6485
|
"input",
|
|
6387
6486
|
{
|
|
6388
6487
|
type: "checkbox",
|
|
@@ -7249,10 +7348,10 @@ import { useOptionalRecordsClient as useOptionalRecordsClient9 } from "@ai-matrx
|
|
|
7249
7348
|
import { PORTAL_ACCENTS } from "@ai-matrx/records";
|
|
7250
7349
|
import { cn as cn16 } from "@ai-matrx/design-system";
|
|
7251
7350
|
import { STYLE_COLOR_LABELS, SWATCH_CLASS as SWATCH_CLASS2 } from "@ai-matrx/design-system/data-table";
|
|
7252
|
-
import { jsx as
|
|
7351
|
+
import { jsx as jsx32, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
7253
7352
|
function AccentSwatches({ value, onChange, options = PORTAL_ACCENTS, noneLabel = "App colour" }) {
|
|
7254
|
-
return /* @__PURE__ */
|
|
7255
|
-
/* @__PURE__ */
|
|
7353
|
+
return /* @__PURE__ */ jsxs28("div", { className: "flex flex-wrap gap-1.5", role: "radiogroup", "aria-label": "Colour", children: [
|
|
7354
|
+
/* @__PURE__ */ jsx32(
|
|
7256
7355
|
"button",
|
|
7257
7356
|
{
|
|
7258
7357
|
type: "button",
|
|
@@ -7266,7 +7365,7 @@ function AccentSwatches({ value, onChange, options = PORTAL_ACCENTS, noneLabel =
|
|
|
7266
7365
|
children: noneLabel
|
|
7267
7366
|
}
|
|
7268
7367
|
),
|
|
7269
|
-
options.map((c) => /* @__PURE__ */
|
|
7368
|
+
options.map((c) => /* @__PURE__ */ jsx32(
|
|
7270
7369
|
"button",
|
|
7271
7370
|
{
|
|
7272
7371
|
type: "button",
|
|
@@ -7285,7 +7384,7 @@ function AccentSwatches({ value, onChange, options = PORTAL_ACCENTS, noneLabel =
|
|
|
7285
7384
|
// src/AddRowSettings.tsx
|
|
7286
7385
|
import { Label as Label7 } from "@ai-matrx/design-system";
|
|
7287
7386
|
import { useFields as useFields2 } from "@ai-matrx/records/react";
|
|
7288
|
-
import { jsx as
|
|
7387
|
+
import { jsx as jsx33, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
7289
7388
|
var THIS_ROW = "@row";
|
|
7290
7389
|
var NOTHING = "";
|
|
7291
7390
|
function prefillWith(prefill, key, from) {
|
|
@@ -7300,10 +7399,10 @@ function AddRowSettings({ value, onChange, tableId, fields }) {
|
|
|
7300
7399
|
const targetFields = useFields2(target);
|
|
7301
7400
|
const typed = (targetFields.data ?? []).filter((f) => f.type !== "formula" && typeof f.config?.["system"] !== "string");
|
|
7302
7401
|
const sources = [{ value: NOTHING, label: "Nothing" }, { value: THIS_ROW, label: "This row" }, ...fields.map((f) => ({ value: f.key, label: f.label }))];
|
|
7303
|
-
return /* @__PURE__ */
|
|
7304
|
-
/* @__PURE__ */
|
|
7305
|
-
/* @__PURE__ */
|
|
7306
|
-
/* @__PURE__ */
|
|
7402
|
+
return /* @__PURE__ */ jsxs29("div", { className: "flex flex-col gap-2", "data-records-button-add-row": "", children: [
|
|
7403
|
+
/* @__PURE__ */ jsxs29("div", { className: "flex flex-col gap-1", children: [
|
|
7404
|
+
/* @__PURE__ */ jsx33(Label7, { className: "text-xs", children: "Adds to" }),
|
|
7405
|
+
/* @__PURE__ */ jsx33(
|
|
7307
7406
|
PickOne,
|
|
7308
7407
|
{
|
|
7309
7408
|
label: "Table the new row goes in",
|
|
@@ -7314,9 +7413,9 @@ function AddRowSettings({ value, onChange, tableId, fields }) {
|
|
|
7314
7413
|
}
|
|
7315
7414
|
)
|
|
7316
7415
|
] }),
|
|
7317
|
-
typed.length ? /* @__PURE__ */
|
|
7318
|
-
/* @__PURE__ */
|
|
7319
|
-
/* @__PURE__ */
|
|
7416
|
+
typed.length ? /* @__PURE__ */ jsx33("div", { className: "grid grid-cols-[auto_1fr] items-center gap-x-2 gap-y-1", children: typed.map((f) => /* @__PURE__ */ jsxs29("div", { className: "contents", children: [
|
|
7417
|
+
/* @__PURE__ */ jsx33("span", { className: "text-sm", children: f.label }),
|
|
7418
|
+
/* @__PURE__ */ jsx33(
|
|
7320
7419
|
PickOne,
|
|
7321
7420
|
{
|
|
7322
7421
|
label: `${f.label} starts with`,
|
|
@@ -7331,7 +7430,7 @@ function AddRowSettings({ value, onChange, tableId, fields }) {
|
|
|
7331
7430
|
}
|
|
7332
7431
|
|
|
7333
7432
|
// src/ButtonSettings.tsx
|
|
7334
|
-
import { jsx as
|
|
7433
|
+
import { jsx as jsx34, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
7335
7434
|
var DOES_WORDS = {
|
|
7336
7435
|
none: "Nothing yet",
|
|
7337
7436
|
open_url: "Open a link",
|
|
@@ -7378,15 +7477,15 @@ function ButtonSettingsEditor({
|
|
|
7378
7477
|
}, [client, tableId, value.do, actions, automations]);
|
|
7379
7478
|
const set = (patch) => onChange({ ...value, ...patch });
|
|
7380
7479
|
const columns = fields.filter((f) => !(f.type === "text" && f.format === "button"));
|
|
7381
|
-
return /* @__PURE__ */
|
|
7382
|
-
/* @__PURE__ */
|
|
7383
|
-
/* @__PURE__ */
|
|
7384
|
-
/* @__PURE__ */
|
|
7385
|
-
/* @__PURE__ */
|
|
7480
|
+
return /* @__PURE__ */ jsxs30("div", { className: "flex flex-col gap-2 rounded-md border p-2", "data-records-button-settings": "", children: [
|
|
7481
|
+
/* @__PURE__ */ jsxs30("div", { className: "grid gap-2 sm:grid-cols-2", children: [
|
|
7482
|
+
/* @__PURE__ */ jsxs30("label", { className: "flex flex-col gap-1", children: [
|
|
7483
|
+
/* @__PURE__ */ jsx34(Label8, { className: "text-xs", children: "Button label" }),
|
|
7484
|
+
/* @__PURE__ */ jsx34(BasicInput7, { className: "h-8 text-xs", value: value.label, "data-records-button-label": "", onChange: (e) => set({ label: e.target.value }) })
|
|
7386
7485
|
] }),
|
|
7387
|
-
/* @__PURE__ */
|
|
7388
|
-
/* @__PURE__ */
|
|
7389
|
-
/* @__PURE__ */
|
|
7486
|
+
/* @__PURE__ */ jsxs30("div", { className: "flex flex-col gap-1", children: [
|
|
7487
|
+
/* @__PURE__ */ jsx34(Label8, { className: "text-xs", children: "Does" }),
|
|
7488
|
+
/* @__PURE__ */ jsx34(
|
|
7390
7489
|
PickOne,
|
|
7391
7490
|
{
|
|
7392
7491
|
label: "What a press does",
|
|
@@ -7398,9 +7497,9 @@ function ButtonSettingsEditor({
|
|
|
7398
7497
|
)
|
|
7399
7498
|
] })
|
|
7400
7499
|
] }),
|
|
7401
|
-
/* @__PURE__ */
|
|
7402
|
-
/* @__PURE__ */
|
|
7403
|
-
/* @__PURE__ */
|
|
7500
|
+
/* @__PURE__ */ jsxs30("div", { className: "flex flex-col gap-1", children: [
|
|
7501
|
+
/* @__PURE__ */ jsx34(Label8, { className: "text-xs", children: "Colour" }),
|
|
7502
|
+
/* @__PURE__ */ jsx34(
|
|
7404
7503
|
AccentSwatches,
|
|
7405
7504
|
{
|
|
7406
7505
|
value: value.color ?? "",
|
|
@@ -7410,10 +7509,10 @@ function ButtonSettingsEditor({
|
|
|
7410
7509
|
}
|
|
7411
7510
|
)
|
|
7412
7511
|
] }),
|
|
7413
|
-
value.do === "open_url" ? /* @__PURE__ */
|
|
7414
|
-
/* @__PURE__ */
|
|
7415
|
-
/* @__PURE__ */
|
|
7416
|
-
/* @__PURE__ */
|
|
7512
|
+
value.do === "open_url" ? /* @__PURE__ */ jsxs30("div", { className: "flex flex-col gap-1", children: [
|
|
7513
|
+
/* @__PURE__ */ jsx34(Label8, { className: "text-xs", children: "Link" }),
|
|
7514
|
+
/* @__PURE__ */ jsxs30("div", { className: "flex gap-1", children: [
|
|
7515
|
+
/* @__PURE__ */ jsx34(
|
|
7417
7516
|
BasicInput7,
|
|
7418
7517
|
{
|
|
7419
7518
|
className: "h-8 flex-1 font-mono text-xs",
|
|
@@ -7423,7 +7522,7 @@ function ButtonSettingsEditor({
|
|
|
7423
7522
|
onChange: (e) => set({ url: e.target.value })
|
|
7424
7523
|
}
|
|
7425
7524
|
),
|
|
7426
|
-
columns.length > 0 ? /* @__PURE__ */
|
|
7525
|
+
columns.length > 0 ? /* @__PURE__ */ jsx34(
|
|
7427
7526
|
PickOne,
|
|
7428
7527
|
{
|
|
7429
7528
|
label: "Add a column's value",
|
|
@@ -7436,11 +7535,11 @@ function ButtonSettingsEditor({
|
|
|
7436
7535
|
}
|
|
7437
7536
|
) : null
|
|
7438
7537
|
] }),
|
|
7439
|
-
value.url && buttonUrlPlaceholders(value.url).length > 0 ? /* @__PURE__ */
|
|
7538
|
+
value.url && buttonUrlPlaceholders(value.url).length > 0 ? /* @__PURE__ */ jsx34("p", { className: "truncate text-[11px] text-muted-foreground", "data-records-button-url-words": "", children: buttonUrlInWords(value.url, fields) }) : null
|
|
7440
7539
|
] }) : null,
|
|
7441
|
-
value.do === "add_row" ? /* @__PURE__ */
|
|
7442
|
-
value.do === "run_action" ? !tableId ? /* @__PURE__ */
|
|
7443
|
-
actions === null || actions.length > 0 ? /* @__PURE__ */
|
|
7540
|
+
value.do === "add_row" ? /* @__PURE__ */ jsx34(AddRowSettings, { value, onChange, tableId, fields }) : null,
|
|
7541
|
+
value.do === "run_action" ? !tableId ? /* @__PURE__ */ jsx34("p", { className: "text-xs text-muted-foreground", children: "Row actions belong to a table" }) : actionsRefused ? /* @__PURE__ */ jsx34(RefusalLine, { error: actionsRefused }) : /* @__PURE__ */ jsxs30("div", { className: "flex flex-col gap-2", "data-records-button-action": "", children: [
|
|
7542
|
+
actions === null || actions.length > 0 ? /* @__PURE__ */ jsx34(
|
|
7444
7543
|
PickOne,
|
|
7445
7544
|
{
|
|
7446
7545
|
label: "Row action",
|
|
@@ -7451,7 +7550,7 @@ function ButtonSettingsEditor({
|
|
|
7451
7550
|
options: (actions ?? []).map((a) => ({ value: a.id, label: a.name }))
|
|
7452
7551
|
}
|
|
7453
7552
|
) : null,
|
|
7454
|
-
actions !== null ? /* @__PURE__ */
|
|
7553
|
+
actions !== null ? /* @__PURE__ */ jsx34(
|
|
7455
7554
|
NewRowAction,
|
|
7456
7555
|
{
|
|
7457
7556
|
tableId,
|
|
@@ -7465,7 +7564,7 @@ function ButtonSettingsEditor({
|
|
|
7465
7564
|
}
|
|
7466
7565
|
) : null
|
|
7467
7566
|
] }) : null,
|
|
7468
|
-
value.do === "run_automation" ? automations && automations.length === 0 ? /* @__PURE__ */
|
|
7567
|
+
value.do === "run_automation" ? automations && automations.length === 0 ? /* @__PURE__ */ jsx34("p", { className: "text-xs text-muted-foreground", children: "No automations yet. Add one in Table \u22EF \u2192 Automations." }) : /* @__PURE__ */ jsx34(
|
|
7469
7568
|
PickOne,
|
|
7470
7569
|
{
|
|
7471
7570
|
label: "Automation",
|
|
@@ -7496,7 +7595,7 @@ function NewRowAction({
|
|
|
7496
7595
|
const [setTo, setSetTo] = useState23("");
|
|
7497
7596
|
const [busy, setBusy] = useState23(false);
|
|
7498
7597
|
const [refused, setRefused] = useState23(null);
|
|
7499
|
-
if (settable.length === 0) return /* @__PURE__ */
|
|
7598
|
+
if (settable.length === 0) return /* @__PURE__ */ jsx34("p", { className: "text-xs text-muted-foreground", children: "No column to set" });
|
|
7500
7599
|
const make = async () => {
|
|
7501
7600
|
if (!client || fieldId === "") return;
|
|
7502
7601
|
setBusy(true);
|
|
@@ -7520,10 +7619,10 @@ function NewRowAction({
|
|
|
7520
7619
|
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." });
|
|
7521
7620
|
onMade(made.id, all);
|
|
7522
7621
|
};
|
|
7523
|
-
return /* @__PURE__ */
|
|
7524
|
-
/* @__PURE__ */
|
|
7525
|
-
/* @__PURE__ */
|
|
7526
|
-
/* @__PURE__ */
|
|
7622
|
+
return /* @__PURE__ */ jsxs30("div", { className: "flex flex-col gap-1", "data-records-button-new-action": "", children: [
|
|
7623
|
+
/* @__PURE__ */ jsx34(Label8, { className: "text-xs", children: "New row action" }),
|
|
7624
|
+
/* @__PURE__ */ jsxs30("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
7625
|
+
/* @__PURE__ */ jsx34(
|
|
7527
7626
|
PickOne,
|
|
7528
7627
|
{
|
|
7529
7628
|
label: "Column to set",
|
|
@@ -7535,10 +7634,10 @@ function NewRowAction({
|
|
|
7535
7634
|
options: settable.map((f) => ({ value: f.id, label: fieldName(f) }))
|
|
7536
7635
|
}
|
|
7537
7636
|
),
|
|
7538
|
-
/* @__PURE__ */
|
|
7539
|
-
/* @__PURE__ */
|
|
7637
|
+
/* @__PURE__ */ jsx34(BasicInput7, { 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) }),
|
|
7638
|
+
/* @__PURE__ */ jsx34(Button13, { type: "button", size: "sm", variant: "outline", disabled: busy || fieldId === "", "data-records-button-action-make": "", onClick: () => void make(), children: busy ? "Making\u2026" : "Make" })
|
|
7540
7639
|
] }),
|
|
7541
|
-
refused ? /* @__PURE__ */
|
|
7640
|
+
refused ? /* @__PURE__ */ jsx34(RefusalLine, { error: refused }) : null
|
|
7542
7641
|
] });
|
|
7543
7642
|
}
|
|
7544
7643
|
|
|
@@ -7562,7 +7661,7 @@ var ADDABLE_TYPES = STANDARD_TABLE_FIELD_CHOICES.map((choice) => ({
|
|
|
7562
7661
|
}));
|
|
7563
7662
|
|
|
7564
7663
|
// src/FieldEditor.tsx
|
|
7565
|
-
import { Fragment as
|
|
7664
|
+
import { Fragment as Fragment11, jsx as jsx35, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
7566
7665
|
var RULE_KINDS = FIELD_RULE_KIND_VALUES.map((kind) => ({ kind, label: FIELD_RULE_KIND_LABEL[kind] }));
|
|
7567
7666
|
var SENSITIVITIES = FIELD_SENSITIVITIES.map((value) => ({ value, label: FIELD_SENSITIVITY_LABEL[value] }));
|
|
7568
7667
|
var AGENT_VISIBILITY = CONTEXT_POLICIES.map((value) => ({ value, label: CONTEXT_POLICY_LABEL[value] }));
|
|
@@ -7814,7 +7913,7 @@ function FieldEditor(props) {
|
|
|
7814
7913
|
const offersMany = multiApplies(type) && !isTitle;
|
|
7815
7914
|
if (!mayShape) {
|
|
7816
7915
|
if (onEntity && entityRights.loading) return null;
|
|
7817
|
-
return /* @__PURE__ */
|
|
7916
|
+
return /* @__PURE__ */ jsx35("p", { className: cn17("text-xs text-muted-foreground", className), children: props.tableLabel && storeLabel && whyNot ? whyNot.split(storeLabel).join(props.tableLabel) : whyNot });
|
|
7818
7917
|
}
|
|
7819
7918
|
const options = newChoices.map((r) => r.words.trim()).filter((word) => word !== "");
|
|
7820
7919
|
const shownStatusRows = type !== "status" ? [] : statusGroupRows(field2, editing ? choiceList ?? [] : newChoices, statusKeys, statusGroups);
|
|
@@ -8016,15 +8115,15 @@ function FieldEditor(props) {
|
|
|
8016
8115
|
if (gone) (onRemoved ?? onSaved)?.();
|
|
8017
8116
|
else setAskingToRemove(false);
|
|
8018
8117
|
};
|
|
8019
|
-
return /* @__PURE__ */
|
|
8020
|
-
/* @__PURE__ */
|
|
8021
|
-
/* @__PURE__ */
|
|
8022
|
-
/* @__PURE__ */
|
|
8118
|
+
return /* @__PURE__ */ jsxs31("div", { className: cn17("flex min-w-0 flex-col gap-3 text-xs", className), "data-records-field-editor": "", children: [
|
|
8119
|
+
/* @__PURE__ */ jsxs31("div", { className: "flex items-center gap-2", children: [
|
|
8120
|
+
/* @__PURE__ */ jsx35("span", { className: "font-medium", children: field2 ? `Field \xB7 ${fieldName(field2)}` : "New field" }),
|
|
8121
|
+
/* @__PURE__ */ jsx35("span", { className: "ml-auto text-muted-foreground", children: tableLabel })
|
|
8023
8122
|
] }),
|
|
8024
|
-
/* @__PURE__ */
|
|
8025
|
-
/* @__PURE__ */
|
|
8026
|
-
/* @__PURE__ */
|
|
8027
|
-
/* @__PURE__ */
|
|
8123
|
+
/* @__PURE__ */ jsxs31("div", { className: "grid gap-3 sm:grid-cols-2", children: [
|
|
8124
|
+
/* @__PURE__ */ jsxs31("label", { className: "flex flex-col gap-1", children: [
|
|
8125
|
+
/* @__PURE__ */ jsx35(Label9, { className: "text-xs", children: "Name" }),
|
|
8126
|
+
/* @__PURE__ */ jsx35(
|
|
8028
8127
|
BasicInput8,
|
|
8029
8128
|
{
|
|
8030
8129
|
value: label,
|
|
@@ -8040,7 +8139,7 @@ function FieldEditor(props) {
|
|
|
8040
8139
|
...nameLine ? { "aria-invalid": true, "aria-describedby": "field-editor-name-taken" } : {}
|
|
8041
8140
|
}
|
|
8042
8141
|
),
|
|
8043
|
-
nameLine ? /* @__PURE__ */
|
|
8142
|
+
nameLine ? /* @__PURE__ */ jsx35(
|
|
8044
8143
|
"span",
|
|
8045
8144
|
{
|
|
8046
8145
|
id: "field-editor-name-taken",
|
|
@@ -8051,9 +8150,9 @@ function FieldEditor(props) {
|
|
|
8051
8150
|
}
|
|
8052
8151
|
) : null
|
|
8053
8152
|
] }),
|
|
8054
|
-
field2 ? /* @__PURE__ */
|
|
8055
|
-
/* @__PURE__ */
|
|
8056
|
-
/* @__PURE__ */
|
|
8153
|
+
field2 ? /* @__PURE__ */ jsxs31("label", { className: "flex flex-col gap-1 sm:col-span-2", children: [
|
|
8154
|
+
/* @__PURE__ */ jsx35(Label9, { className: "text-xs", children: "Help text" }),
|
|
8155
|
+
/* @__PURE__ */ jsx35(
|
|
8057
8156
|
BasicInput8,
|
|
8058
8157
|
{
|
|
8059
8158
|
value: description,
|
|
@@ -8064,29 +8163,29 @@ function FieldEditor(props) {
|
|
|
8064
8163
|
}
|
|
8065
8164
|
)
|
|
8066
8165
|
] }) : null,
|
|
8067
|
-
/* @__PURE__ */
|
|
8068
|
-
/* @__PURE__ */
|
|
8069
|
-
/* @__PURE__ */
|
|
8166
|
+
/* @__PURE__ */ jsxs31("div", { className: "flex flex-col gap-1", children: [
|
|
8167
|
+
/* @__PURE__ */ jsx35(Label9, { className: "text-xs", children: "What it holds" }),
|
|
8168
|
+
/* @__PURE__ */ jsxs31(
|
|
8070
8169
|
Select5,
|
|
8071
8170
|
{
|
|
8072
8171
|
value: type,
|
|
8073
8172
|
disabled: editing,
|
|
8074
8173
|
onValueChange: (next) => setType(next),
|
|
8075
8174
|
children: [
|
|
8076
|
-
/* @__PURE__ */
|
|
8077
|
-
/* @__PURE__ */
|
|
8078
|
-
/* @__PURE__ */
|
|
8079
|
-
FIELD_TYPE_CATALOGUE.filter((c) => c.group === group && (c.id === type || offered.includes(c))).map((c) => /* @__PURE__ */
|
|
8175
|
+
/* @__PURE__ */ jsx35(SelectTrigger5, { size: "sm", "aria-label": "What this field holds", ...choice?.explanation ? { title: choice.explanation } : {}, children: /* @__PURE__ */ jsx35(SelectValue5, {}) }),
|
|
8176
|
+
/* @__PURE__ */ jsx35(SelectContent5, { children: FIELD_TYPE_GROUPS.filter((group) => offered.some((c) => c.group === group)).map((group) => /* @__PURE__ */ jsxs31(SelectGroup, { children: [
|
|
8177
|
+
/* @__PURE__ */ jsx35(SelectLabel, { children: group }),
|
|
8178
|
+
FIELD_TYPE_CATALOGUE.filter((c) => c.group === group && (c.id === type || offered.includes(c))).map((c) => /* @__PURE__ */ jsx35(SelectItem5, { value: c.id, children: c.label }, c.id))
|
|
8080
8179
|
] }, group)) })
|
|
8081
8180
|
]
|
|
8082
8181
|
}
|
|
8083
8182
|
),
|
|
8084
|
-
editing && field2 ? /* @__PURE__ */
|
|
8183
|
+
editing && field2 ? /* @__PURE__ */ jsx35(FieldRetype, { field: liveField ?? field2, tableId }) : null
|
|
8085
8184
|
] })
|
|
8086
8185
|
] }),
|
|
8087
|
-
type === "formula" && others.length > 0 ? /* @__PURE__ */
|
|
8088
|
-
editing ? startingFormulaText.trim() === "" ? /* @__PURE__ */
|
|
8089
|
-
/* @__PURE__ */
|
|
8186
|
+
type === "formula" && others.length > 0 ? /* @__PURE__ */ jsxs31("div", { className: "flex flex-col gap-2", children: [
|
|
8187
|
+
editing ? startingFormulaText.trim() === "" ? /* @__PURE__ */ jsx35("p", { className: "text-[11px] text-muted-foreground", children: EDITING_A_WORKED_OUT_COLUMN }) : null : /* @__PURE__ */ jsxs31("div", { className: "flex items-center gap-1", role: "group", "aria-label": "How to make this column", children: [
|
|
8188
|
+
/* @__PURE__ */ jsx35(
|
|
8090
8189
|
Button14,
|
|
8091
8190
|
{
|
|
8092
8191
|
type: "button",
|
|
@@ -8097,7 +8196,7 @@ function FieldEditor(props) {
|
|
|
8097
8196
|
children: "Pick the columns"
|
|
8098
8197
|
}
|
|
8099
8198
|
),
|
|
8100
|
-
/* @__PURE__ */
|
|
8199
|
+
/* @__PURE__ */ jsx35(
|
|
8101
8200
|
Button14,
|
|
8102
8201
|
{
|
|
8103
8202
|
type: "button",
|
|
@@ -8109,7 +8208,7 @@ function FieldEditor(props) {
|
|
|
8109
8208
|
}
|
|
8110
8209
|
)
|
|
8111
8210
|
] }),
|
|
8112
|
-
formulaWritten ? /* @__PURE__ */
|
|
8211
|
+
formulaWritten ? /* @__PURE__ */ jsx35(
|
|
8113
8212
|
FormulaTextEditor,
|
|
8114
8213
|
{
|
|
8115
8214
|
tableId,
|
|
@@ -8119,9 +8218,9 @@ function FieldEditor(props) {
|
|
|
8119
8218
|
columns: others
|
|
8120
8219
|
}
|
|
8121
8220
|
) : null
|
|
8122
|
-
] }) : editing && type === "formula" ? /* @__PURE__ */
|
|
8123
|
-
editing && field2 && !onEntity && (type === "lookup" || type === "rollup") ? /* @__PURE__ */
|
|
8124
|
-
!editing && !(type === "formula" && formulaWritten) || type === "select" || type === "multi_select" || type === "status" || type === "rating" || type === "barcode" || type === "relation" || type === "entity_reference" ? /* @__PURE__ */
|
|
8221
|
+
] }) : editing && type === "formula" ? /* @__PURE__ */ jsx35("p", { className: "text-[11px] text-muted-foreground", children: "No other column to read." }) : null,
|
|
8222
|
+
editing && field2 && !onEntity && (type === "lookup" || type === "rollup") ? /* @__PURE__ */ jsx35(SourceArchivedNotice, { fieldId: field2.id, tableId }) : null,
|
|
8223
|
+
!editing && !(type === "formula" && formulaWritten) || type === "select" || type === "multi_select" || type === "status" || type === "rating" || type === "barcode" || type === "relation" || type === "entity_reference" ? /* @__PURE__ */ jsx35(
|
|
8125
8224
|
TypeQuestions,
|
|
8126
8225
|
{
|
|
8127
8226
|
type,
|
|
@@ -8151,7 +8250,7 @@ function FieldEditor(props) {
|
|
|
8151
8250
|
setFormulaSeparator,
|
|
8152
8251
|
relations: sourcesFor(type),
|
|
8153
8252
|
others,
|
|
8154
|
-
choiceList: editing && field2 ? /* @__PURE__ */
|
|
8253
|
+
choiceList: editing && field2 ? /* @__PURE__ */ jsx35(
|
|
8155
8254
|
ChoiceListEditor,
|
|
8156
8255
|
{
|
|
8157
8256
|
field: field2,
|
|
@@ -8162,10 +8261,10 @@ function FieldEditor(props) {
|
|
|
8162
8261
|
rehome,
|
|
8163
8262
|
onRehome: setRehome
|
|
8164
8263
|
}
|
|
8165
|
-
) : /* @__PURE__ */
|
|
8264
|
+
) : /* @__PURE__ */ jsx35(ChoiceListEditor, { isNew: true, rows: newChoices, onRows: setNewChoices }),
|
|
8166
8265
|
allowedTypes,
|
|
8167
8266
|
setAllowedTypes,
|
|
8168
|
-
newer: type === "rating" ? /* @__PURE__ */
|
|
8267
|
+
newer: type === "rating" ? /* @__PURE__ */ jsx35(
|
|
8169
8268
|
RatingMaxQuestion,
|
|
8170
8269
|
{
|
|
8171
8270
|
value: ratingMax,
|
|
@@ -8173,20 +8272,20 @@ function FieldEditor(props) {
|
|
|
8173
8272
|
setRatingMax(next);
|
|
8174
8273
|
}
|
|
8175
8274
|
}
|
|
8176
|
-
) : type === "status" ? /* @__PURE__ */
|
|
8275
|
+
) : type === "status" ? /* @__PURE__ */ jsx35(StatusGroupsQuestion, { rows: shownStatusRows, onGroup: (ref, next) => setStatusGroups({ ...statusGroups, [ref]: next }) }) : type === "barcode" ? /* @__PURE__ */ jsx35(BarcodeSymbologyQuestion, { value: symbology, onChange: setSymbology }) : null
|
|
8177
8276
|
}
|
|
8178
8277
|
) : null,
|
|
8179
|
-
type === "button" ? /* @__PURE__ */
|
|
8180
|
-
type === "modified_time" ? /* @__PURE__ */
|
|
8181
|
-
type === "autonumber" ? /* @__PURE__ */
|
|
8182
|
-
/* @__PURE__ */
|
|
8183
|
-
/* @__PURE__ */
|
|
8278
|
+
type === "button" ? /* @__PURE__ */ jsx35(ButtonSettingsEditor, { value: buttonSettings, onChange: setButtonSettings, tableId: onEntity ? null : tableId, fields: others }) : null,
|
|
8279
|
+
type === "modified_time" ? /* @__PURE__ */ jsx35(WatchFieldsPicker, { fields: others, value: watchFields, onChange: setWatchFields }) : null,
|
|
8280
|
+
type === "autonumber" ? /* @__PURE__ */ jsxs31("label", { className: "flex max-w-[16rem] flex-col gap-1", children: [
|
|
8281
|
+
/* @__PURE__ */ jsx35(Label9, { className: "text-xs", children: "Prefix" }),
|
|
8282
|
+
/* @__PURE__ */ jsx35(BasicInput8, { className: "h-8 text-xs", placeholder: "TASK-", maxLength: 16, "data-records-autonumber-prefix": "", value: numberPrefix, onChange: (e) => setNumberPrefix(e.target.value) })
|
|
8184
8283
|
] }) : null,
|
|
8185
|
-
editing && field2?.type === "relation" && field2.relation_target && field2.relation_target === field2.entity_definition_id ? /* @__PURE__ */
|
|
8186
|
-
/* @__PURE__ */
|
|
8187
|
-
/* @__PURE__ */
|
|
8284
|
+
editing && field2?.type === "relation" && field2.relation_target && field2.relation_target === field2.entity_definition_id ? /* @__PURE__ */ jsxs31("label", { className: "flex items-center gap-1.5 text-sm", title: "A timeline draws a line to each record this one waits on", children: [
|
|
8285
|
+
/* @__PURE__ */ jsx35(Checkbox4, { checked: dependency, "aria-label": "Waits on the linked records", "data-records-dependency": "", onCheckedChange: (v) => setDependency(v === true) }),
|
|
8286
|
+
/* @__PURE__ */ jsx35("span", { children: "Waits on the linked records" })
|
|
8188
8287
|
] }) : null,
|
|
8189
|
-
type === "rollup" ? /* @__PURE__ */
|
|
8288
|
+
type === "rollup" ? /* @__PURE__ */ jsx35(
|
|
8190
8289
|
RollupFilterQuestion,
|
|
8191
8290
|
{
|
|
8192
8291
|
relation: totalSources.find((f) => f.key === via),
|
|
@@ -8196,10 +8295,10 @@ function FieldEditor(props) {
|
|
|
8196
8295
|
onChange: setRollupFilter
|
|
8197
8296
|
}
|
|
8198
8297
|
) : null,
|
|
8199
|
-
editing && field2 && !(type === "select" || type === "multi_select" || type === "status" || type === "autonumber") ? /* @__PURE__ */
|
|
8200
|
-
/* @__PURE__ */
|
|
8201
|
-
/* @__PURE__ */
|
|
8202
|
-
/* @__PURE__ */
|
|
8298
|
+
editing && field2 && !(type === "select" || type === "multi_select" || type === "status" || type === "autonumber") ? /* @__PURE__ */ jsx35(FieldFormatPicker, { field: field2, value: showsAs, onValue: setShowsAs }) : null,
|
|
8299
|
+
/* @__PURE__ */ jsxs31("div", { className: "flex flex-wrap items-center gap-4", children: [
|
|
8300
|
+
/* @__PURE__ */ jsxs31("label", { className: "flex items-center gap-1.5", children: [
|
|
8301
|
+
/* @__PURE__ */ jsx35(
|
|
8203
8302
|
Checkbox4,
|
|
8204
8303
|
{
|
|
8205
8304
|
checked: required,
|
|
@@ -8207,10 +8306,10 @@ function FieldEditor(props) {
|
|
|
8207
8306
|
onCheckedChange: (v) => setRequired(v === true)
|
|
8208
8307
|
}
|
|
8209
8308
|
),
|
|
8210
|
-
/* @__PURE__ */
|
|
8309
|
+
/* @__PURE__ */ jsx35("span", { title: "Every record has to have one", children: "Required" })
|
|
8211
8310
|
] }),
|
|
8212
|
-
offersMany ? /* @__PURE__ */
|
|
8213
|
-
/* @__PURE__ */
|
|
8311
|
+
offersMany ? /* @__PURE__ */ jsxs31("label", { className: "flex items-center gap-1.5", children: [
|
|
8312
|
+
/* @__PURE__ */ jsx35(
|
|
8214
8313
|
Checkbox4,
|
|
8215
8314
|
{
|
|
8216
8315
|
checked: multi,
|
|
@@ -8220,8 +8319,8 @@ function FieldEditor(props) {
|
|
|
8220
8319
|
),
|
|
8221
8320
|
"Can hold more than one"
|
|
8222
8321
|
] }) : null,
|
|
8223
|
-
/* @__PURE__ */
|
|
8224
|
-
/* @__PURE__ */
|
|
8322
|
+
/* @__PURE__ */ jsxs31("label", { className: "flex items-center gap-1.5", children: [
|
|
8323
|
+
/* @__PURE__ */ jsx35(
|
|
8225
8324
|
Checkbox4,
|
|
8226
8325
|
{
|
|
8227
8326
|
checked: dated,
|
|
@@ -8231,8 +8330,8 @@ function FieldEditor(props) {
|
|
|
8231
8330
|
),
|
|
8232
8331
|
"Each value has its own date"
|
|
8233
8332
|
] }),
|
|
8234
|
-
!field2 && type === "relation" && otherTable.data && otherTable.data.id !== tableId ? /* @__PURE__ */
|
|
8235
|
-
/* @__PURE__ */
|
|
8333
|
+
!field2 && type === "relation" && otherTable.data && otherTable.data.id !== tableId ? /* @__PURE__ */ jsxs31("label", { className: "flex items-center gap-1.5", children: [
|
|
8334
|
+
/* @__PURE__ */ jsx35(
|
|
8236
8335
|
Checkbox4,
|
|
8237
8336
|
{
|
|
8238
8337
|
checked: showOnOther,
|
|
@@ -8244,12 +8343,12 @@ function FieldEditor(props) {
|
|
|
8244
8343
|
"Show on ",
|
|
8245
8344
|
otherTable.data.name ?? "the other table"
|
|
8246
8345
|
] }) : null,
|
|
8247
|
-
!field2 && type === "relation" && relationTarget === tableId ? /* @__PURE__ */
|
|
8248
|
-
/* @__PURE__ */
|
|
8249
|
-
/* @__PURE__ */
|
|
8346
|
+
!field2 && type === "relation" && relationTarget === tableId ? /* @__PURE__ */ jsxs31("label", { className: "flex items-center gap-1.5", title: "A timeline draws a line to each record this one waits on", children: [
|
|
8347
|
+
/* @__PURE__ */ jsx35(Checkbox4, { checked: dependency, "aria-label": "Waits on the linked records", "data-records-dependency": "", onCheckedChange: (v) => setDependency(v === true) }),
|
|
8348
|
+
/* @__PURE__ */ jsx35("span", { children: "Waits on the linked records" })
|
|
8250
8349
|
] }) : null,
|
|
8251
|
-
!field2 && type === "relation" && relationTarget === tableId ? /* @__PURE__ */
|
|
8252
|
-
/* @__PURE__ */
|
|
8350
|
+
!field2 && type === "relation" && relationTarget === tableId ? /* @__PURE__ */ jsxs31("label", { className: "flex items-center gap-1.5", children: [
|
|
8351
|
+
/* @__PURE__ */ jsx35(
|
|
8253
8352
|
Checkbox4,
|
|
8254
8353
|
{
|
|
8255
8354
|
checked: nestsSubItems,
|
|
@@ -8261,10 +8360,10 @@ function FieldEditor(props) {
|
|
|
8261
8360
|
"data-records-sub-items": ""
|
|
8262
8361
|
}
|
|
8263
8362
|
),
|
|
8264
|
-
/* @__PURE__ */
|
|
8363
|
+
/* @__PURE__ */ jsx35("span", { title: "Each record sits under the one this column names", children: "Sub-items" })
|
|
8265
8364
|
] }) : null,
|
|
8266
|
-
CHOICE_EDITOR_ADDS_WHAT_IS_TYPED && (type === "select" || type === "multi_select") ? /* @__PURE__ */
|
|
8267
|
-
/* @__PURE__ */
|
|
8365
|
+
CHOICE_EDITOR_ADDS_WHAT_IS_TYPED && (type === "select" || type === "multi_select") ? /* @__PURE__ */ jsxs31("label", { className: "flex items-center gap-1.5", children: [
|
|
8366
|
+
/* @__PURE__ */ jsx35(
|
|
8268
8367
|
Checkbox4,
|
|
8269
8368
|
{
|
|
8270
8369
|
checked: allowOther,
|
|
@@ -8275,10 +8374,10 @@ function FieldEditor(props) {
|
|
|
8275
8374
|
"A value that is not one of the choices is added to them"
|
|
8276
8375
|
] }) : null
|
|
8277
8376
|
] }),
|
|
8278
|
-
!editing && !onEntity && newColumnTakesADefault(type) ? /* @__PURE__ */
|
|
8279
|
-
editing && field2 && takesADefault(liveField ?? field2) ? /* @__PURE__ */
|
|
8280
|
-
/* @__PURE__ */
|
|
8281
|
-
/* @__PURE__ */
|
|
8377
|
+
!editing && !onEntity && newColumnTakesADefault(type) ? /* @__PURE__ */ jsx35(NewColumnDefault, { type, choices: options, value: startsWith, onChange: setStartsWith }) : null,
|
|
8378
|
+
editing && field2 && takesADefault(liveField ?? field2) ? /* @__PURE__ */ jsxs31("div", { className: "flex flex-col gap-1", "data-records-field-default": "", children: [
|
|
8379
|
+
/* @__PURE__ */ jsx35(Label9, { htmlFor: "records-field-default", className: "text-xs", children: DEFAULT_LABEL }),
|
|
8380
|
+
/* @__PURE__ */ jsx35(
|
|
8282
8381
|
FieldControl,
|
|
8283
8382
|
{
|
|
8284
8383
|
id: "records-field-default",
|
|
@@ -8288,28 +8387,28 @@ function FieldEditor(props) {
|
|
|
8288
8387
|
}
|
|
8289
8388
|
)
|
|
8290
8389
|
] }) : null,
|
|
8291
|
-
/* @__PURE__ */
|
|
8292
|
-
/* @__PURE__ */
|
|
8293
|
-
/* @__PURE__ */
|
|
8294
|
-
/* @__PURE__ */
|
|
8295
|
-
/* @__PURE__ */
|
|
8296
|
-
/* @__PURE__ */
|
|
8297
|
-
/* @__PURE__ */
|
|
8390
|
+
/* @__PURE__ */ jsx35(Separator, {}),
|
|
8391
|
+
/* @__PURE__ */ jsxs31("div", { className: "grid gap-3 sm:grid-cols-2", children: [
|
|
8392
|
+
/* @__PURE__ */ jsxs31("div", { className: "flex flex-col gap-1", children: [
|
|
8393
|
+
/* @__PURE__ */ jsx35(Label9, { className: "text-xs", children: "Who can see what is in it" }),
|
|
8394
|
+
/* @__PURE__ */ jsxs31(Select5, { value: sensitivity, onValueChange: setSensitivity, children: [
|
|
8395
|
+
/* @__PURE__ */ jsx35(SelectTrigger5, { size: "sm", "aria-label": "Who can see what is in it", children: /* @__PURE__ */ jsx35(SelectValue5, {}) }),
|
|
8396
|
+
/* @__PURE__ */ jsx35(SelectContent5, { children: sensitivities.map((row) => /* @__PURE__ */ jsx35(SelectItem5, { value: row.value, children: row.label }, row.value)) })
|
|
8298
8397
|
] })
|
|
8299
8398
|
] }),
|
|
8300
|
-
/* @__PURE__ */
|
|
8301
|
-
/* @__PURE__ */
|
|
8302
|
-
/* @__PURE__ */
|
|
8303
|
-
/* @__PURE__ */
|
|
8304
|
-
/* @__PURE__ */
|
|
8399
|
+
/* @__PURE__ */ jsxs31("div", { className: "flex flex-col gap-1", children: [
|
|
8400
|
+
/* @__PURE__ */ jsx35(Label9, { className: "text-xs", children: "Can an assistant read it" }),
|
|
8401
|
+
/* @__PURE__ */ jsxs31(Select5, { value: contextPolicy, onValueChange: setContextPolicy, children: [
|
|
8402
|
+
/* @__PURE__ */ jsx35(SelectTrigger5, { size: "sm", "aria-label": "Can an assistant read it", children: /* @__PURE__ */ jsx35(SelectValue5, {}) }),
|
|
8403
|
+
/* @__PURE__ */ jsx35(SelectContent5, { children: AGENT_VISIBILITY.map((row) => /* @__PURE__ */ jsx35(SelectItem5, { value: row.value, children: row.label }, row.value)) })
|
|
8305
8404
|
] })
|
|
8306
8405
|
] })
|
|
8307
8406
|
] }),
|
|
8308
|
-
/* @__PURE__ */
|
|
8309
|
-
/* @__PURE__ */
|
|
8310
|
-
/* @__PURE__ */
|
|
8311
|
-
/* @__PURE__ */
|
|
8312
|
-
/* @__PURE__ */
|
|
8407
|
+
/* @__PURE__ */ jsx35(Separator, {}),
|
|
8408
|
+
/* @__PURE__ */ jsxs31("div", { className: "flex flex-col gap-2", children: [
|
|
8409
|
+
/* @__PURE__ */ jsxs31("div", { className: "flex items-center gap-2", children: [
|
|
8410
|
+
/* @__PURE__ */ jsx35("span", { className: "font-medium", children: "What counts as a good value" }),
|
|
8411
|
+
/* @__PURE__ */ jsx35(
|
|
8313
8412
|
Button14,
|
|
8314
8413
|
{
|
|
8315
8414
|
type: "button",
|
|
@@ -8321,8 +8420,8 @@ function FieldEditor(props) {
|
|
|
8321
8420
|
}
|
|
8322
8421
|
)
|
|
8323
8422
|
] }),
|
|
8324
|
-
canBeUnique(type, multi) || rules.some((r) => r.kind === "unique") ? /* @__PURE__ */
|
|
8325
|
-
/* @__PURE__ */
|
|
8423
|
+
canBeUnique(type, multi) || rules.some((r) => r.kind === "unique") ? /* @__PURE__ */ jsxs31("label", { className: "flex items-center gap-1.5", "data-records-field-unique": "", children: [
|
|
8424
|
+
/* @__PURE__ */ jsx35(
|
|
8326
8425
|
Checkbox4,
|
|
8327
8426
|
{
|
|
8328
8427
|
checked: rules.some((r) => r.kind === "unique"),
|
|
@@ -8332,20 +8431,20 @@ function FieldEditor(props) {
|
|
|
8332
8431
|
),
|
|
8333
8432
|
UNIQUE_LABEL
|
|
8334
8433
|
] }) : null,
|
|
8335
|
-
rules.length === 0 ? /* @__PURE__ */
|
|
8336
|
-
rules.map((rule, index) => rule.kind === "unique" ? null : /* @__PURE__ */
|
|
8337
|
-
/* @__PURE__ */
|
|
8434
|
+
rules.length === 0 ? /* @__PURE__ */ jsx35("p", { className: "text-muted-foreground", children: "No checks." }) : null,
|
|
8435
|
+
rules.map((rule, index) => rule.kind === "unique" ? null : /* @__PURE__ */ jsxs31("div", { className: "flex items-center gap-1", children: [
|
|
8436
|
+
/* @__PURE__ */ jsxs31(
|
|
8338
8437
|
Select5,
|
|
8339
8438
|
{
|
|
8340
8439
|
value: rule.kind,
|
|
8341
8440
|
onValueChange: (kind) => setRules(rules.map((r, i) => i === index ? { ...r, kind } : r)),
|
|
8342
8441
|
children: [
|
|
8343
|
-
/* @__PURE__ */
|
|
8344
|
-
/* @__PURE__ */
|
|
8442
|
+
/* @__PURE__ */ jsx35(SelectTrigger5, { size: "sm", className: "w-52", "aria-label": `Check ${index + 1}`, children: /* @__PURE__ */ jsx35(SelectValue5, {}) }),
|
|
8443
|
+
/* @__PURE__ */ jsx35(SelectContent5, { children: RULE_KINDS.map((row) => /* @__PURE__ */ jsx35(SelectItem5, { value: row.kind, children: row.label }, row.kind)) })
|
|
8345
8444
|
]
|
|
8346
8445
|
}
|
|
8347
8446
|
),
|
|
8348
|
-
rule.kind === "length" ? /* @__PURE__ */
|
|
8447
|
+
rule.kind === "length" ? /* @__PURE__ */ jsx35(
|
|
8349
8448
|
BasicInput8,
|
|
8350
8449
|
{
|
|
8351
8450
|
className: "h-8 w-24",
|
|
@@ -8356,7 +8455,7 @@ function FieldEditor(props) {
|
|
|
8356
8455
|
onChange: (e) => setRules(rules.map((r, i) => i === index ? withNumber(r, "min", e.target.value) : r))
|
|
8357
8456
|
}
|
|
8358
8457
|
) : null,
|
|
8359
|
-
/* @__PURE__ */
|
|
8458
|
+
/* @__PURE__ */ jsx35(
|
|
8360
8459
|
BasicInput8,
|
|
8361
8460
|
{
|
|
8362
8461
|
className: "h-8",
|
|
@@ -8366,7 +8465,7 @@ function FieldEditor(props) {
|
|
|
8366
8465
|
onChange: (e) => setRules(rules.map((r, i) => i === index ? { ...r, value: e.target.value } : r))
|
|
8367
8466
|
}
|
|
8368
8467
|
),
|
|
8369
|
-
rule.kind === "pattern" ? /* @__PURE__ */
|
|
8468
|
+
rule.kind === "pattern" ? /* @__PURE__ */ jsx35(
|
|
8370
8469
|
BasicInput8,
|
|
8371
8470
|
{
|
|
8372
8471
|
className: "h-8",
|
|
@@ -8376,7 +8475,7 @@ function FieldEditor(props) {
|
|
|
8376
8475
|
onChange: (e) => setRules(rules.map((r, i) => i === index ? withText(r, "example", e.target.value) : r))
|
|
8377
8476
|
}
|
|
8378
8477
|
) : null,
|
|
8379
|
-
/* @__PURE__ */
|
|
8478
|
+
/* @__PURE__ */ jsx35(
|
|
8380
8479
|
Button14,
|
|
8381
8480
|
{
|
|
8382
8481
|
type: "button",
|
|
@@ -8389,9 +8488,9 @@ function FieldEditor(props) {
|
|
|
8389
8488
|
)
|
|
8390
8489
|
] }, `${rule.kind}-${index}`))
|
|
8391
8490
|
] }),
|
|
8392
|
-
editing && field2 && !onEntity && rulesChanged(savedRules, editedRules) ? /* @__PURE__ */
|
|
8393
|
-
mutation.error ? /* @__PURE__ */
|
|
8394
|
-
notLanded ? /* @__PURE__ */
|
|
8491
|
+
editing && field2 && !onEntity && rulesChanged(savedRules, editedRules) ? /* @__PURE__ */ jsx35(FieldRulePreview, { field: field2, tableId, rules: editedRules }) : null,
|
|
8492
|
+
mutation.error ? /* @__PURE__ */ jsx35(RefusalNotice, { error: mutation.error }) : null,
|
|
8493
|
+
notLanded ? /* @__PURE__ */ jsx35(
|
|
8395
8494
|
RefusalNotice,
|
|
8396
8495
|
{
|
|
8397
8496
|
error: (0, refusals_exports.refusal)(
|
|
@@ -8401,10 +8500,10 @@ function FieldEditor(props) {
|
|
|
8401
8500
|
)
|
|
8402
8501
|
}
|
|
8403
8502
|
) : null,
|
|
8404
|
-
rehomeRefused ? /* @__PURE__ */
|
|
8405
|
-
rehomed ? /* @__PURE__ */
|
|
8406
|
-
/* @__PURE__ */
|
|
8407
|
-
rehomed.undo ? /* @__PURE__ */
|
|
8503
|
+
rehomeRefused ? /* @__PURE__ */ jsx35(RefusalNotice, { error: rehomeRefused }) : null,
|
|
8504
|
+
rehomed ? /* @__PURE__ */ jsxs31("div", { "data-records-choice-rehomed": "", className: "flex flex-wrap items-center gap-2 text-[11px]", children: [
|
|
8505
|
+
/* @__PURE__ */ jsx35("span", { children: rehomed.said }),
|
|
8506
|
+
rehomed.undo ? /* @__PURE__ */ jsx35(
|
|
8408
8507
|
Button14,
|
|
8409
8508
|
{
|
|
8410
8509
|
type: "button",
|
|
@@ -8429,18 +8528,18 @@ function FieldEditor(props) {
|
|
|
8429
8528
|
children: "Undo"
|
|
8430
8529
|
}
|
|
8431
8530
|
) : null,
|
|
8432
|
-
/* @__PURE__ */
|
|
8531
|
+
/* @__PURE__ */ jsx35(Button14, { type: "button", size: "sm", className: "h-6 px-2 text-xs", onClick: () => onSaved?.(), children: "Done" })
|
|
8433
8532
|
] }) : null,
|
|
8434
|
-
reverseRefused ? /* @__PURE__ */
|
|
8435
|
-
/* @__PURE__ */
|
|
8436
|
-
/* @__PURE__ */
|
|
8533
|
+
reverseRefused ? /* @__PURE__ */ jsxs31("div", { "data-records-reverse-field-refused": "", className: "flex flex-col gap-1", children: [
|
|
8534
|
+
/* @__PURE__ */ jsx35("p", { className: "text-[11px]", children: "The link is made. Its column on the other table was not:" }),
|
|
8535
|
+
/* @__PURE__ */ jsx35(RefusalNotice, { error: reverseRefused })
|
|
8437
8536
|
] }) : null,
|
|
8438
|
-
backfillError ? /* @__PURE__ */
|
|
8439
|
-
/* @__PURE__ */
|
|
8440
|
-
/* @__PURE__ */
|
|
8537
|
+
backfillError ? /* @__PURE__ */ jsxs31("div", { "data-records-autonumber-backfill-refused": "", className: "flex flex-col gap-1", children: [
|
|
8538
|
+
/* @__PURE__ */ jsx35("p", { className: "text-[11px]", children: "The column is made. The records already in the table were not numbered:" }),
|
|
8539
|
+
/* @__PURE__ */ jsx35(RefusalNotice, { error: backfillError })
|
|
8441
8540
|
] }) : null,
|
|
8442
|
-
/* @__PURE__ */
|
|
8443
|
-
/* @__PURE__ */
|
|
8541
|
+
/* @__PURE__ */ jsxs31("div", { className: "flex min-w-0 flex-nowrap items-center gap-2", "data-field-editor-footer": "", children: [
|
|
8542
|
+
/* @__PURE__ */ jsx35(
|
|
8444
8543
|
Button14,
|
|
8445
8544
|
{
|
|
8446
8545
|
size: "sm",
|
|
@@ -8456,8 +8555,8 @@ function FieldEditor(props) {
|
|
|
8456
8555
|
children: mutation.saving ? "Saving\u2026" : field2 ? EDIT_FIELD_SAVE_LABEL : onEntity ? ADD_STANDARD_FIELD_SAVE_LABEL : ADD_FIELD_SAVE_LABEL
|
|
8457
8556
|
}
|
|
8458
8557
|
),
|
|
8459
|
-
onCancel ? /* @__PURE__ */
|
|
8460
|
-
/* @__PURE__ */
|
|
8558
|
+
onCancel ? /* @__PURE__ */ jsx35(Button14, { size: "sm", variant: "ghost", onClick: onCancel, children: "Cancel" }) : null,
|
|
8559
|
+
/* @__PURE__ */ jsx35(
|
|
8461
8560
|
"span",
|
|
8462
8561
|
{
|
|
8463
8562
|
id: "field-editor-missing",
|
|
@@ -8473,11 +8572,11 @@ function FieldEditor(props) {
|
|
|
8473
8572
|
footer is always as wide and as tall as its larger state: opening the confirm moved
|
|
8474
8573
|
the dialog card 0.2278 and closing it 0.1303. The consequence is the tooltip of
|
|
8475
8574
|
"Remove it" (interface-text: the slot holds a label, never a paragraph). */
|
|
8476
|
-
/* @__PURE__ */
|
|
8477
|
-
/* @__PURE__ */
|
|
8478
|
-
/* @__PURE__ */
|
|
8479
|
-
/* @__PURE__ */
|
|
8480
|
-
/* @__PURE__ */
|
|
8575
|
+
/* @__PURE__ */ jsxs31("div", { className: "ml-auto grid shrink-0 items-center", "data-field-editor-remove": askingToRemove ? "asking" : "idle", children: [
|
|
8576
|
+
/* @__PURE__ */ jsx35("div", { className: cn17("col-start-1 row-start-1 flex items-center justify-end gap-2", askingToRemove && "invisible"), "aria-hidden": askingToRemove || void 0, children: /* @__PURE__ */ jsx35(Button14, { size: "sm", variant: "outline", tabIndex: askingToRemove ? -1 : void 0, onClick: () => setAskingToRemove(true), children: "Remove this field" }) }),
|
|
8577
|
+
/* @__PURE__ */ jsxs31("div", { className: cn17("col-start-1 row-start-1 flex items-center justify-end gap-2", !askingToRemove && "invisible"), "aria-hidden": !askingToRemove || void 0, children: [
|
|
8578
|
+
/* @__PURE__ */ jsx35("span", { className: "whitespace-nowrap text-destructive", "data-field-editor-remove-ask": "", children: "Archive this field?" }),
|
|
8579
|
+
/* @__PURE__ */ jsx35(
|
|
8481
8580
|
Button14,
|
|
8482
8581
|
{
|
|
8483
8582
|
size: "sm",
|
|
@@ -8490,7 +8589,7 @@ function FieldEditor(props) {
|
|
|
8490
8589
|
children: "Remove it"
|
|
8491
8590
|
}
|
|
8492
8591
|
),
|
|
8493
|
-
/* @__PURE__ */
|
|
8592
|
+
/* @__PURE__ */ jsx35(Button14, { size: "sm", variant: "ghost", tabIndex: askingToRemove ? void 0 : -1, onClick: () => setAskingToRemove(false), children: "Keep it" })
|
|
8494
8593
|
] })
|
|
8495
8594
|
] })
|
|
8496
8595
|
) : null
|
|
@@ -8581,10 +8680,10 @@ function formulaSeparatorOf(field2) {
|
|
|
8581
8680
|
function TypeQuestions(props) {
|
|
8582
8681
|
const { type } = props;
|
|
8583
8682
|
if (type === "entity_reference") {
|
|
8584
|
-
return /* @__PURE__ */
|
|
8683
|
+
return /* @__PURE__ */ jsx35(EntityReferenceKindPicker, { value: props.allowedTypes, onChange: props.setAllowedTypes, locked: props.editing });
|
|
8585
8684
|
}
|
|
8586
8685
|
if (type === "relation") {
|
|
8587
|
-
return /* @__PURE__ */
|
|
8686
|
+
return /* @__PURE__ */ jsx35(
|
|
8588
8687
|
ReferenceBuilder,
|
|
8589
8688
|
{
|
|
8590
8689
|
tableId: props.tableId,
|
|
@@ -8597,20 +8696,20 @@ function TypeQuestions(props) {
|
|
|
8597
8696
|
}
|
|
8598
8697
|
);
|
|
8599
8698
|
}
|
|
8600
|
-
if (type === "rating" || type === "barcode") return /* @__PURE__ */
|
|
8699
|
+
if (type === "rating" || type === "barcode") return /* @__PURE__ */ jsx35(Fragment11, { children: props.newer });
|
|
8601
8700
|
if (type === "status") {
|
|
8602
|
-
return /* @__PURE__ */
|
|
8701
|
+
return /* @__PURE__ */ jsxs31("div", { className: "flex flex-col gap-3", children: [
|
|
8603
8702
|
props.choiceList,
|
|
8604
8703
|
props.newer
|
|
8605
8704
|
] });
|
|
8606
8705
|
}
|
|
8607
8706
|
if (type === "select" || type === "multi_select") {
|
|
8608
|
-
return /* @__PURE__ */
|
|
8707
|
+
return /* @__PURE__ */ jsx35(Fragment11, { children: props.choiceList });
|
|
8609
8708
|
}
|
|
8610
8709
|
if (type === "currency") {
|
|
8611
|
-
return /* @__PURE__ */
|
|
8612
|
-
/* @__PURE__ */
|
|
8613
|
-
/* @__PURE__ */
|
|
8710
|
+
return /* @__PURE__ */ jsxs31("label", { className: "flex max-w-[16rem] flex-col gap-1", children: [
|
|
8711
|
+
/* @__PURE__ */ jsx35(Label9, { className: "text-xs", children: "The currency" }),
|
|
8712
|
+
/* @__PURE__ */ jsx35(
|
|
8614
8713
|
BasicInput8,
|
|
8615
8714
|
{
|
|
8616
8715
|
value: props.unit,
|
|
@@ -8622,8 +8721,8 @@ function TypeQuestions(props) {
|
|
|
8622
8721
|
] });
|
|
8623
8722
|
}
|
|
8624
8723
|
if (type === "datetime") {
|
|
8625
|
-
return /* @__PURE__ */
|
|
8626
|
-
/* @__PURE__ */
|
|
8724
|
+
return /* @__PURE__ */ jsxs31("label", { className: "flex items-center gap-1.5", children: [
|
|
8725
|
+
/* @__PURE__ */ jsx35(
|
|
8627
8726
|
Checkbox4,
|
|
8628
8727
|
{
|
|
8629
8728
|
checked: props.withTime,
|
|
@@ -8637,14 +8736,14 @@ function TypeQuestions(props) {
|
|
|
8637
8736
|
if (type === "lookup" || type === "rollup" || type === "count") {
|
|
8638
8737
|
const usable = props.relations;
|
|
8639
8738
|
if (usable.length === 0) {
|
|
8640
|
-
return /* @__PURE__ */
|
|
8641
|
-
}
|
|
8642
|
-
return /* @__PURE__ */
|
|
8643
|
-
/* @__PURE__ */
|
|
8644
|
-
/* @__PURE__ */
|
|
8645
|
-
/* @__PURE__ */
|
|
8646
|
-
/* @__PURE__ */
|
|
8647
|
-
/* @__PURE__ */
|
|
8739
|
+
return /* @__PURE__ */ jsx35("p", { className: "text-[11px] text-muted-foreground", children: "No link, Person or File column yet." });
|
|
8740
|
+
}
|
|
8741
|
+
return /* @__PURE__ */ jsxs31("div", { className: "grid gap-3 sm:grid-cols-2", children: [
|
|
8742
|
+
/* @__PURE__ */ jsxs31("div", { className: "flex flex-col gap-1", children: [
|
|
8743
|
+
/* @__PURE__ */ jsx35(Label9, { className: "text-xs", children: type !== "lookup" ? "Across the records in" : "Read it from" }),
|
|
8744
|
+
/* @__PURE__ */ jsxs31(Select5, { value: props.via, onValueChange: props.setVia, children: [
|
|
8745
|
+
/* @__PURE__ */ jsx35(SelectTrigger5, { size: "sm", "aria-label": type !== "lookup" ? "Across the records in" : "Read it from", children: /* @__PURE__ */ jsx35(SelectValue5, { placeholder: "Choose a column" }) }),
|
|
8746
|
+
/* @__PURE__ */ jsx35(SelectContent5, { children: usable.map((f) => /* @__PURE__ */ jsxs31(SelectItem5, { value: f.key, children: [
|
|
8648
8747
|
fieldName(f),
|
|
8649
8748
|
isBackLinkSource(f) ? BACK_LINK_SOURCE_SUFFIX : "",
|
|
8650
8749
|
sourceKindOf(f) === "person" ? " \u2014 a person" : sourceKindOf(f) === "file" ? " \u2014 a file" : "",
|
|
@@ -8652,7 +8751,7 @@ function TypeQuestions(props) {
|
|
|
8652
8751
|
] }, f.id)) })
|
|
8653
8752
|
] })
|
|
8654
8753
|
] }),
|
|
8655
|
-
type === "lookup" ? /* @__PURE__ */
|
|
8754
|
+
type === "lookup" ? /* @__PURE__ */ jsx35(
|
|
8656
8755
|
ValueOnTheOtherSide,
|
|
8657
8756
|
{
|
|
8658
8757
|
label: "The value to read",
|
|
@@ -8661,13 +8760,13 @@ function TypeQuestions(props) {
|
|
|
8661
8760
|
value: props.pick,
|
|
8662
8761
|
onChange: props.setPick
|
|
8663
8762
|
}
|
|
8664
|
-
) : type === "count" ? null : /* @__PURE__ */
|
|
8665
|
-
/* @__PURE__ */
|
|
8666
|
-
/* @__PURE__ */
|
|
8667
|
-
/* @__PURE__ */
|
|
8668
|
-
/* @__PURE__ */
|
|
8763
|
+
) : type === "count" ? null : /* @__PURE__ */ jsxs31("div", { className: "flex flex-col gap-1", children: [
|
|
8764
|
+
/* @__PURE__ */ jsx35(Label9, { className: "text-xs", children: "What to work out" }),
|
|
8765
|
+
/* @__PURE__ */ jsxs31(Select5, { value: props.agg, onValueChange: (v) => props.setAgg(v), children: [
|
|
8766
|
+
/* @__PURE__ */ jsx35(SelectTrigger5, { size: "sm", "aria-label": "What to work out", children: /* @__PURE__ */ jsx35(SelectValue5, {}) }),
|
|
8767
|
+
/* @__PURE__ */ jsx35(SelectContent5, { children: ROLLUP_OPERATIONS.map((row) => /* @__PURE__ */ jsx35(SelectItem5, { value: row.value, children: row.label }, row.value)) })
|
|
8669
8768
|
] }),
|
|
8670
|
-
props.agg !== "count" ? /* @__PURE__ */
|
|
8769
|
+
props.agg !== "count" ? /* @__PURE__ */ jsx35(
|
|
8671
8770
|
ValueOnTheOtherSide,
|
|
8672
8771
|
{
|
|
8673
8772
|
label: "Of which value",
|
|
@@ -8683,21 +8782,21 @@ function TypeQuestions(props) {
|
|
|
8683
8782
|
}
|
|
8684
8783
|
if (type === "formula") {
|
|
8685
8784
|
if (props.others.length === 0) {
|
|
8686
|
-
return /* @__PURE__ */
|
|
8687
|
-
}
|
|
8688
|
-
return /* @__PURE__ */
|
|
8689
|
-
/* @__PURE__ */
|
|
8690
|
-
/* @__PURE__ */
|
|
8691
|
-
/* @__PURE__ */
|
|
8692
|
-
/* @__PURE__ */
|
|
8693
|
-
/* @__PURE__ */
|
|
8785
|
+
return /* @__PURE__ */ jsx35("p", { className: "text-[11px] text-muted-foreground", children: "No other columns yet." });
|
|
8786
|
+
}
|
|
8787
|
+
return /* @__PURE__ */ jsxs31("div", { className: "flex flex-col gap-2", children: [
|
|
8788
|
+
/* @__PURE__ */ jsxs31("div", { className: "flex flex-col gap-1", children: [
|
|
8789
|
+
/* @__PURE__ */ jsx35(Label9, { className: "text-xs", children: "What to do" }),
|
|
8790
|
+
/* @__PURE__ */ jsxs31(Select5, { value: props.formulaOp, onValueChange: props.setFormulaOp, children: [
|
|
8791
|
+
/* @__PURE__ */ jsx35(SelectTrigger5, { size: "sm", className: "max-w-[18rem]", "aria-label": "What to do", children: /* @__PURE__ */ jsx35(SelectValue5, {}) }),
|
|
8792
|
+
/* @__PURE__ */ jsx35(SelectContent5, { children: FORMULA_OPERATIONS.map((row) => /* @__PURE__ */ jsx35(SelectItem5, { value: row.value, children: row.label }, row.value)) })
|
|
8694
8793
|
] })
|
|
8695
8794
|
] }),
|
|
8696
|
-
/* @__PURE__ */
|
|
8697
|
-
/* @__PURE__ */
|
|
8698
|
-
/* @__PURE__ */
|
|
8795
|
+
/* @__PURE__ */ jsxs31("div", { className: "flex flex-col gap-1", children: [
|
|
8796
|
+
/* @__PURE__ */ jsx35(Label9, { className: "text-xs", children: "Which columns" }),
|
|
8797
|
+
/* @__PURE__ */ jsx35("div", { className: "flex flex-wrap gap-1", children: props.others.map((f) => {
|
|
8699
8798
|
const picked = props.formulaFields.includes(f.id);
|
|
8700
|
-
return /* @__PURE__ */
|
|
8799
|
+
return /* @__PURE__ */ jsx35(
|
|
8701
8800
|
Button14,
|
|
8702
8801
|
{
|
|
8703
8802
|
type: "button",
|
|
@@ -8712,9 +8811,9 @@ function TypeQuestions(props) {
|
|
|
8712
8811
|
);
|
|
8713
8812
|
}) })
|
|
8714
8813
|
] }),
|
|
8715
|
-
props.formulaOp === "concat" ? /* @__PURE__ */
|
|
8716
|
-
/* @__PURE__ */
|
|
8717
|
-
/* @__PURE__ */
|
|
8814
|
+
props.formulaOp === "concat" ? /* @__PURE__ */ jsxs31("div", { className: "flex flex-col gap-1", children: [
|
|
8815
|
+
/* @__PURE__ */ jsx35(Label9, { className: "text-xs", children: FORMULA_SEPARATOR_LABEL }),
|
|
8816
|
+
/* @__PURE__ */ jsx35(
|
|
8718
8817
|
BasicInput8,
|
|
8719
8818
|
{
|
|
8720
8819
|
value: props.formulaSeparator,
|
|
@@ -8775,15 +8874,15 @@ function RollupFilterQuestion({
|
|
|
8775
8874
|
lastFar.current = far;
|
|
8776
8875
|
}, [far, editing, onChange]);
|
|
8777
8876
|
if (!relation || !far) return null;
|
|
8778
|
-
return /* @__PURE__ */
|
|
8779
|
-
/* @__PURE__ */
|
|
8877
|
+
return /* @__PURE__ */ jsx35("div", { className: "flex flex-col gap-1", "data-records-rollup-filter": "", children: !conditionIsDrawable(value) ? /* @__PURE__ */ jsxs31("div", { className: "flex flex-wrap items-center gap-2 text-[11px]", children: [
|
|
8878
|
+
/* @__PURE__ */ jsxs31("span", { className: "text-muted-foreground", children: [
|
|
8780
8879
|
rollupFilterLead(agg),
|
|
8781
8880
|
" ",
|
|
8782
8881
|
conditionInWords(value, conditionFields),
|
|
8783
8882
|
"."
|
|
8784
8883
|
] }),
|
|
8785
|
-
/* @__PURE__ */
|
|
8786
|
-
] }) : /* @__PURE__ */
|
|
8884
|
+
/* @__PURE__ */ jsx35(Button14, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-2 text-xs", onClick: () => onChange(null), children: "Clear" })
|
|
8885
|
+
] }) : /* @__PURE__ */ jsx35(
|
|
8787
8886
|
ConditionGroup,
|
|
8788
8887
|
{
|
|
8789
8888
|
lead: rollupFilterLead(agg),
|
|
@@ -8809,13 +8908,13 @@ function ValueOnTheOtherSide({
|
|
|
8809
8908
|
const carried = sample.data?.rows[0]?.document ?? null;
|
|
8810
8909
|
const offered = declared.length > 0 ? declared.map((f) => ({ key: f.key, name: fieldName(f) })) : Object.keys(carried ?? {}).map((key) => ({ key, name: humanizeIdentifier2(key) }));
|
|
8811
8910
|
const stillAsking = columns.loading || declared.length === 0 && sample.loading;
|
|
8812
|
-
const body = !relation ? /* @__PURE__ */
|
|
8813
|
-
/* @__PURE__ */
|
|
8814
|
-
/* @__PURE__ */
|
|
8911
|
+
const body = !relation ? /* @__PURE__ */ jsx35("p", { className: "text-[11px] text-muted-foreground", children: "Choose the column above first." }) : stillAsking ? /* @__PURE__ */ jsx35("p", { className: "text-[11px] text-muted-foreground", children: "Reading that table's columns\u2026" }) : offered.length === 0 ? /* @__PURE__ */ jsx35("p", { className: "text-[11px] text-muted-foreground", children: "No columns to read yet." }) : /* @__PURE__ */ jsxs31(Select5, { value, onValueChange: onChange, children: [
|
|
8912
|
+
/* @__PURE__ */ jsx35(SelectTrigger5, { size: "sm", "aria-label": label, children: /* @__PURE__ */ jsx35(SelectValue5, { placeholder: "Choose a column" }) }),
|
|
8913
|
+
/* @__PURE__ */ jsx35(SelectContent5, { children: offered.map((column) => /* @__PURE__ */ jsx35(SelectItem5, { value: column.key, children: column.name }, column.key)) })
|
|
8815
8914
|
] });
|
|
8816
|
-
if (compact) return /* @__PURE__ */
|
|
8817
|
-
return /* @__PURE__ */
|
|
8818
|
-
/* @__PURE__ */
|
|
8915
|
+
if (compact) return /* @__PURE__ */ jsx35("div", { className: "mt-1 flex flex-col gap-1", children: body });
|
|
8916
|
+
return /* @__PURE__ */ jsxs31("div", { className: "flex flex-col gap-1", children: [
|
|
8917
|
+
/* @__PURE__ */ jsx35(Label9, { className: "text-xs", title: help, children: label }),
|
|
8819
8918
|
body
|
|
8820
8919
|
] });
|
|
8821
8920
|
}
|
|
@@ -8841,18 +8940,18 @@ function NewColumnDefault({
|
|
|
8841
8940
|
onChange
|
|
8842
8941
|
}) {
|
|
8843
8942
|
const none = "__none__";
|
|
8844
|
-
return /* @__PURE__ */
|
|
8845
|
-
/* @__PURE__ */
|
|
8846
|
-
type === "checkbox" ? /* @__PURE__ */
|
|
8847
|
-
/* @__PURE__ */
|
|
8848
|
-
/* @__PURE__ */
|
|
8849
|
-
] }) : type === "select" || type === "multi_select" || type === "status" ? /* @__PURE__ */
|
|
8850
|
-
/* @__PURE__ */
|
|
8851
|
-
/* @__PURE__ */
|
|
8852
|
-
/* @__PURE__ */
|
|
8853
|
-
choices.map((c) => /* @__PURE__ */
|
|
8943
|
+
return /* @__PURE__ */ jsxs31("div", { className: "flex flex-col gap-1", "data-records-field-default": "", "data-records-new-field-default": "", children: [
|
|
8944
|
+
/* @__PURE__ */ jsx35(Label9, { htmlFor: "records-new-field-default", className: "text-xs", children: DEFAULT_LABEL }),
|
|
8945
|
+
type === "checkbox" ? /* @__PURE__ */ jsxs31("label", { className: "flex items-center gap-2", children: [
|
|
8946
|
+
/* @__PURE__ */ jsx35(Checkbox4, { id: "records-new-field-default", "aria-label": DEFAULT_LABEL, checked: value === true, onCheckedChange: (on) => onChange(on === true ? true : null) }),
|
|
8947
|
+
/* @__PURE__ */ jsx35("span", { children: "Ticked" })
|
|
8948
|
+
] }) : type === "select" || type === "multi_select" || type === "status" ? /* @__PURE__ */ jsxs31(Select5, { value: typeof value === "string" && choices.includes(value) ? value : none, onValueChange: (v) => onChange(v === none ? null : v), children: [
|
|
8949
|
+
/* @__PURE__ */ jsx35(SelectTrigger5, { id: "records-new-field-default", size: "sm", "aria-label": DEFAULT_LABEL, children: /* @__PURE__ */ jsx35(SelectValue5, {}) }),
|
|
8950
|
+
/* @__PURE__ */ jsxs31(SelectContent5, { children: [
|
|
8951
|
+
/* @__PURE__ */ jsx35(SelectItem5, { value: none, children: "Nothing" }),
|
|
8952
|
+
choices.map((c) => /* @__PURE__ */ jsx35(SelectItem5, { value: c, children: c }, c))
|
|
8854
8953
|
] })
|
|
8855
|
-
] }) : /* @__PURE__ */
|
|
8954
|
+
] }) : /* @__PURE__ */ jsx35(
|
|
8856
8955
|
BasicInput8,
|
|
8857
8956
|
{
|
|
8858
8957
|
id: "records-new-field-default",
|
|
@@ -8866,8 +8965,8 @@ function NewColumnDefault({
|
|
|
8866
8965
|
|
|
8867
8966
|
// src/buttonCell.tsx
|
|
8868
8967
|
import { OutboundLink as OutboundLink7 } from "@ai-matrx/kit/outbound-react";
|
|
8869
|
-
import { openOutbound } from "@ai-matrx/kit/outbound";
|
|
8870
|
-
import { Fragment as
|
|
8968
|
+
import { openOutbound as openOutbound2 } from "@ai-matrx/kit/outbound";
|
|
8969
|
+
import { Fragment as Fragment12, jsx as jsx36, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
8871
8970
|
function buttonPressWords(label, pressed) {
|
|
8872
8971
|
if (pressed.do === "open_url") return `${label} opened ${pressed.url}`;
|
|
8873
8972
|
if (pressed.do === "add_row") return `${label}: a row was added.`;
|
|
@@ -8929,6 +9028,8 @@ function ButtonValue({ field: field2, recordId, inCell }) {
|
|
|
8929
9028
|
const [busy, setBusy] = useState25(false);
|
|
8930
9029
|
const [said2, setSaid] = useState25(null);
|
|
8931
9030
|
const [settingUp, setSettingUp] = useState25(false);
|
|
9031
|
+
const [opening, setOpening] = useState25(false);
|
|
9032
|
+
const here = useContext3(OpenRecordHereContext);
|
|
8932
9033
|
const host = useRecordsUi();
|
|
8933
9034
|
const addsTo = useTable2(b?.do === "add_row" ? b.table_id ?? field2.entity_definition_id : null);
|
|
8934
9035
|
const waitingOn = useRef13(0);
|
|
@@ -8949,12 +9050,17 @@ function ButtonValue({ field: field2, recordId, inCell }) {
|
|
|
8949
9050
|
}
|
|
8950
9051
|
const pressed = answered.data;
|
|
8951
9052
|
if (pressed.do === "open_url") {
|
|
8952
|
-
const opened = typeof window !== "undefined" ?
|
|
9053
|
+
const opened = typeof window !== "undefined" ? openOutbound2(pressed.url, "_blank", "noopener") : null;
|
|
8953
9054
|
return setSaid({ kind: "ran", says: opened ? `${b.label} opened.` : `${b.label} is ready:`, link: pressed.url });
|
|
8954
9055
|
}
|
|
8955
9056
|
if (pressed.do === "add_row") {
|
|
9057
|
+
if (here && String(here.tableId) === String(pressed.table_id)) {
|
|
9058
|
+
here.open(pressed.record_id);
|
|
9059
|
+
return setSaid({ kind: "ran", says: `${b.label}: a row was added and opened.` });
|
|
9060
|
+
}
|
|
8956
9061
|
const href = addsTo.data ? host.hrefForRecord?.({ table: addsTo.data, recordId: pressed.record_id }) : void 0;
|
|
8957
9062
|
if (href) {
|
|
9063
|
+
setOpening(true);
|
|
8958
9064
|
if (host.navigate) host.navigate(href);
|
|
8959
9065
|
else if (typeof window !== "undefined") window.location.assign(href);
|
|
8960
9066
|
}
|
|
@@ -9017,8 +9123,8 @@ function ButtonValue({ field: field2, recordId, inCell }) {
|
|
|
9017
9123
|
}
|
|
9018
9124
|
setSaid({ kind: "ran", says: words });
|
|
9019
9125
|
};
|
|
9020
|
-
return /* @__PURE__ */
|
|
9021
|
-
/* @__PURE__ */
|
|
9126
|
+
return /* @__PURE__ */ jsxs32(Fragment12, { children: [
|
|
9127
|
+
/* @__PURE__ */ jsxs32(
|
|
9022
9128
|
Popover4,
|
|
9023
9129
|
{
|
|
9024
9130
|
open: said2 !== null,
|
|
@@ -9029,7 +9135,7 @@ function ButtonValue({ field: field2, recordId, inCell }) {
|
|
|
9029
9135
|
setSaid(null);
|
|
9030
9136
|
},
|
|
9031
9137
|
children: [
|
|
9032
|
-
/* @__PURE__ */
|
|
9138
|
+
/* @__PURE__ */ jsx36(PopoverTrigger4, { asChild: true, children: /* @__PURE__ */ jsx36(
|
|
9033
9139
|
Button15,
|
|
9034
9140
|
{
|
|
9035
9141
|
type: "button",
|
|
@@ -9037,8 +9143,9 @@ function ButtonValue({ field: field2, recordId, inCell }) {
|
|
|
9037
9143
|
variant: "outline",
|
|
9038
9144
|
"data-records-button": field2.key,
|
|
9039
9145
|
"data-records-button-unset": needs ? "" : void 0,
|
|
9040
|
-
"aria-busy": busy || void 0,
|
|
9041
|
-
|
|
9146
|
+
"aria-busy": busy || opening || void 0,
|
|
9147
|
+
"data-records-button-pending": busy || opening ? "" : void 0,
|
|
9148
|
+
disabled: busy || opening,
|
|
9042
9149
|
className: cn18("max-w-full gap-1 border px-2 font-medium", inCell ? "h-5" : "h-6", color, needs && "border-dashed opacity-80"),
|
|
9043
9150
|
onPointerDown: stop2,
|
|
9044
9151
|
onDoubleClick: stop2,
|
|
@@ -9047,23 +9154,23 @@ function ButtonValue({ field: field2, recordId, inCell }) {
|
|
|
9047
9154
|
event.preventDefault();
|
|
9048
9155
|
void press();
|
|
9049
9156
|
},
|
|
9050
|
-
children: /* @__PURE__ */
|
|
9157
|
+
children: /* @__PURE__ */ jsx36("span", { className: cn18("truncate", (busy || opening) && "matrx-shimmer"), children: b.label })
|
|
9051
9158
|
}
|
|
9052
9159
|
) }),
|
|
9053
|
-
/* @__PURE__ */
|
|
9054
|
-
said2?.kind === "refused" ? /* @__PURE__ */
|
|
9055
|
-
said2?.kind === "waiting" ? /* @__PURE__ */
|
|
9056
|
-
said2?.kind === "failed" ? /* @__PURE__ */
|
|
9057
|
-
said2?.kind === "public" ? /* @__PURE__ */
|
|
9058
|
-
said2?.kind === "ran" ? /* @__PURE__ */
|
|
9059
|
-
said2.value ? /* @__PURE__ */
|
|
9160
|
+
/* @__PURE__ */ jsxs32(PopoverContent4, { className: "w-72 space-y-2 p-3 text-sm", onClick: stop2, onPointerDown: stop2, "data-records-button-said": said2?.kind, children: [
|
|
9161
|
+
said2?.kind === "refused" ? /* @__PURE__ */ jsx36(RefusalLine, { error: said2.error }) : null,
|
|
9162
|
+
said2?.kind === "waiting" ? /* @__PURE__ */ jsx36("p", { className: "matrx-shimmer rounded px-1 py-0.5", role: "status", "aria-live": "polite", children: said2.says }) : null,
|
|
9163
|
+
said2?.kind === "failed" ? /* @__PURE__ */ jsx36(ErrorBox2, { as: "p", className: "break-words text-destructive", message: said2.says, origin: "records-ui/buttonCell", children: said2.says }) : null,
|
|
9164
|
+
said2?.kind === "public" ? /* @__PURE__ */ jsx36("p", { children: "Buttons run for signed-in people." }) : null,
|
|
9165
|
+
said2?.kind === "ran" ? /* @__PURE__ */ jsxs32("div", { className: "break-words", children: [
|
|
9166
|
+
said2.value ? /* @__PURE__ */ jsx36(StructuredValueView, { structured: said2.value, label: b.label }) : null,
|
|
9060
9167
|
said2.says,
|
|
9061
9168
|
" ",
|
|
9062
|
-
said2.link ? /* @__PURE__ */
|
|
9169
|
+
said2.link ? /* @__PURE__ */ jsx36(OutboundLink7, { href: said2.link, className: "text-primary underline", children: said2.link }) : null
|
|
9063
9170
|
] }) : null,
|
|
9064
|
-
said2?.kind === "needs" ? /* @__PURE__ */
|
|
9065
|
-
/* @__PURE__ */
|
|
9066
|
-
tableId ? /* @__PURE__ */
|
|
9171
|
+
said2?.kind === "needs" ? /* @__PURE__ */ jsxs32(Fragment12, { children: [
|
|
9172
|
+
/* @__PURE__ */ jsx36("p", { children: said2.says }),
|
|
9173
|
+
tableId ? /* @__PURE__ */ jsxs32(
|
|
9067
9174
|
Button15,
|
|
9068
9175
|
{
|
|
9069
9176
|
type: "button",
|
|
@@ -9084,12 +9191,12 @@ function ButtonValue({ field: field2, recordId, inCell }) {
|
|
|
9084
9191
|
]
|
|
9085
9192
|
}
|
|
9086
9193
|
),
|
|
9087
|
-
settingUp && tableId ? /* @__PURE__ */
|
|
9088
|
-
/* @__PURE__ */
|
|
9089
|
-
/* @__PURE__ */
|
|
9090
|
-
/* @__PURE__ */
|
|
9194
|
+
settingUp && tableId ? /* @__PURE__ */ jsx36(Dialog3, { open: true, onOpenChange: (open) => open ? null : setSettingUp(false), children: /* @__PURE__ */ jsxs32(DialogContent3, { className: "max-h-[85vh] overflow-y-auto sm:max-w-2xl", onClick: stop2, onPointerDown: stop2, children: [
|
|
9195
|
+
/* @__PURE__ */ jsxs32(DialogHeader3, { children: [
|
|
9196
|
+
/* @__PURE__ */ jsx36(DialogTitle3, { children: `Column settings \xB7 ${fieldName(field2)}` }),
|
|
9197
|
+
/* @__PURE__ */ jsx36(DialogDescription, { className: "sr-only", children: "What the button does" })
|
|
9091
9198
|
] }),
|
|
9092
|
-
/* @__PURE__ */
|
|
9199
|
+
/* @__PURE__ */ jsx36(FieldEditor, { tableId, field: field2, onSaved: () => setSettingUp(false), onCancel: () => setSettingUp(false) })
|
|
9093
9200
|
] }) }) : null
|
|
9094
9201
|
] });
|
|
9095
9202
|
}
|
|
@@ -9097,7 +9204,7 @@ function ButtonValue({ field: field2, recordId, inCell }) {
|
|
|
9097
9204
|
// src/FloatingRefusal.tsx
|
|
9098
9205
|
import { useLayoutEffect as useLayoutEffect2, useRef as useRef14, useState as useState26 } from "react";
|
|
9099
9206
|
import { createPortal } from "react-dom";
|
|
9100
|
-
import { Fragment as
|
|
9207
|
+
import { Fragment as Fragment13, jsx as jsx37, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
9101
9208
|
var GAP2 = 4;
|
|
9102
9209
|
function placeFor(anchor, note) {
|
|
9103
9210
|
const a = anchor.getBoundingClientRect();
|
|
@@ -9135,12 +9242,12 @@ function FloatingRefusal({ text, why }) {
|
|
|
9135
9242
|
};
|
|
9136
9243
|
}, [text]);
|
|
9137
9244
|
if (!floating) {
|
|
9138
|
-
return /* @__PURE__ */
|
|
9245
|
+
return /* @__PURE__ */ jsx37("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 });
|
|
9139
9246
|
}
|
|
9140
|
-
return /* @__PURE__ */
|
|
9141
|
-
/* @__PURE__ */
|
|
9247
|
+
return /* @__PURE__ */ jsxs33(Fragment13, { children: [
|
|
9248
|
+
/* @__PURE__ */ jsx37("span", { ref: spot, "data-records-refusal-anchor": "", hidden: true }),
|
|
9142
9249
|
typeof document === "undefined" ? null : createPortal(
|
|
9143
|
-
/* @__PURE__ */
|
|
9250
|
+
/* @__PURE__ */ jsx37(
|
|
9144
9251
|
"span",
|
|
9145
9252
|
{
|
|
9146
9253
|
ref: note,
|
|
@@ -9162,7 +9269,7 @@ function FloatingRefusal({ text, why }) {
|
|
|
9162
9269
|
import { useEffect as useEffect18, useRef as useRef15, useState as useState27 } from "react";
|
|
9163
9270
|
import { BasicInput as BasicInput9, BasicTextarea as BasicTextarea3 } from "@ai-matrx/design-system";
|
|
9164
9271
|
import { getFieldFormat as getFieldFormat3, parseFieldInput } from "@ai-matrx/design-system/field-formats";
|
|
9165
|
-
import { jsx as
|
|
9272
|
+
import { jsx as jsx38, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
9166
9273
|
var TYPED_NUMBERS = /* @__PURE__ */ new Set(["currency", "percent", "progress", "decimal", "duration", "file_size", "integer"]);
|
|
9167
9274
|
function scaled(format) {
|
|
9168
9275
|
return (format.id === "percent" || format.id === "progress") && format.options?.percentScale === "fraction";
|
|
@@ -9185,7 +9292,7 @@ function NumberInFormat({ format, value, onChange, disabled, id }) {
|
|
|
9185
9292
|
if (value === lastSent.current) return;
|
|
9186
9293
|
setText(typedText(format, value));
|
|
9187
9294
|
}, [value, format]);
|
|
9188
|
-
return /* @__PURE__ */
|
|
9295
|
+
return /* @__PURE__ */ jsx38(
|
|
9189
9296
|
BasicInput9,
|
|
9190
9297
|
{
|
|
9191
9298
|
id,
|
|
@@ -9210,21 +9317,21 @@ function formatControl(args) {
|
|
|
9210
9317
|
const look = fieldLookFor(def.id);
|
|
9211
9318
|
if (look?.Editor) {
|
|
9212
9319
|
const Editor = look.Editor;
|
|
9213
|
-
return /* @__PURE__ */
|
|
9320
|
+
return /* @__PURE__ */ jsx38(Editor, { value, format, onChange, disabled, id, label });
|
|
9214
9321
|
}
|
|
9215
9322
|
const text = value === null || value === void 0 ? "" : String(value);
|
|
9216
9323
|
const commit = (raw) => onChange(raw === "" ? null : parseFieldInput(raw, format));
|
|
9217
9324
|
if (def.id === "rating") {
|
|
9218
|
-
return disabled ? /* @__PURE__ */
|
|
9325
|
+
return disabled ? /* @__PURE__ */ jsx38(RatingStars, { value, max: format.options?.ratingMax ?? 5, label }) : /* @__PURE__ */ jsx38("span", { id, className: "inline-flex", children: /* @__PURE__ */ jsx38(RatingStars, { value, max: format.options?.ratingMax ?? 5, label, onRate: (n) => onChange(n) }) });
|
|
9219
9326
|
}
|
|
9220
|
-
if (TYPED_NUMBERS.has(def.id)) return /* @__PURE__ */
|
|
9327
|
+
if (TYPED_NUMBERS.has(def.id)) return /* @__PURE__ */ jsx38(NumberInFormat, { ...args });
|
|
9221
9328
|
switch (def.editor) {
|
|
9222
9329
|
// A TIME OF DAY is not this file's: `FieldControl` draws the typed box and its helper
|
|
9223
9330
|
// (`TypedWordsControl`), never the browser's time control (grids review 3, 2026-09-30).
|
|
9224
9331
|
case "email":
|
|
9225
9332
|
case "url":
|
|
9226
9333
|
case "tel":
|
|
9227
|
-
return /* @__PURE__ */
|
|
9334
|
+
return /* @__PURE__ */ jsx38(
|
|
9228
9335
|
BasicInput9,
|
|
9229
9336
|
{
|
|
9230
9337
|
id,
|
|
@@ -9237,8 +9344,8 @@ function formatControl(args) {
|
|
|
9237
9344
|
}
|
|
9238
9345
|
);
|
|
9239
9346
|
case "color":
|
|
9240
|
-
return /* @__PURE__ */
|
|
9241
|
-
/* @__PURE__ */
|
|
9347
|
+
return /* @__PURE__ */ jsxs34("span", { className: "flex items-center gap-2", children: [
|
|
9348
|
+
/* @__PURE__ */ jsx38(
|
|
9242
9349
|
BasicInput9,
|
|
9243
9350
|
{
|
|
9244
9351
|
id: `${id}-swatch`,
|
|
@@ -9250,10 +9357,10 @@ function formatControl(args) {
|
|
|
9250
9357
|
onChange: (e) => commit(e.target.value)
|
|
9251
9358
|
}
|
|
9252
9359
|
),
|
|
9253
|
-
/* @__PURE__ */
|
|
9360
|
+
/* @__PURE__ */ jsx38(BasicInput9, { id, value: text, placeholder: "#3b82f6", disabled, onChange: (e) => commit(e.target.value) })
|
|
9254
9361
|
] });
|
|
9255
9362
|
case "textarea":
|
|
9256
|
-
return /* @__PURE__ */
|
|
9363
|
+
return /* @__PURE__ */ jsx38(BasicTextarea3, { id, rows: 4, value: text, disabled, onChange: (e) => commit(e.target.value) });
|
|
9257
9364
|
default:
|
|
9258
9365
|
return null;
|
|
9259
9366
|
}
|
|
@@ -9263,7 +9370,7 @@ function formatControl(args) {
|
|
|
9263
9370
|
import { useState as useState28 } from "react";
|
|
9264
9371
|
import { Popover as Popover5, PopoverContent as PopoverContent5, PopoverTrigger as PopoverTrigger5, cn as cn19 } from "@ai-matrx/design-system";
|
|
9265
9372
|
import { readTypedDate, readTypedTime, typedDateText, typedTimeText } from "@ai-matrx/records";
|
|
9266
|
-
import { jsx as
|
|
9373
|
+
import { jsx as jsx39, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
9267
9374
|
var WEEK = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
|
|
9268
9375
|
var MONTHS = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
|
|
9269
9376
|
function pad(n) {
|
|
@@ -9292,15 +9399,15 @@ function wordsFor2(kind, day, time) {
|
|
|
9292
9399
|
}
|
|
9293
9400
|
var keepFocus = { onMouseDown: (e) => e.preventDefault(), tabIndex: -1 };
|
|
9294
9401
|
function CalendarGlyph() {
|
|
9295
|
-
return /* @__PURE__ */
|
|
9296
|
-
/* @__PURE__ */
|
|
9297
|
-
/* @__PURE__ */
|
|
9402
|
+
return /* @__PURE__ */ jsxs35("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", width: "14", height: "14", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
9403
|
+
/* @__PURE__ */ jsx39("rect", { x: "3", y: "4", width: "18", height: "18", rx: "2" }),
|
|
9404
|
+
/* @__PURE__ */ jsx39("path", { d: "M16 2v4M8 2v4M3 10h18" })
|
|
9298
9405
|
] });
|
|
9299
9406
|
}
|
|
9300
9407
|
function ClockGlyph() {
|
|
9301
|
-
return /* @__PURE__ */
|
|
9302
|
-
/* @__PURE__ */
|
|
9303
|
-
/* @__PURE__ */
|
|
9408
|
+
return /* @__PURE__ */ jsxs35("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", width: "14", height: "14", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
9409
|
+
/* @__PURE__ */ jsx39("circle", { cx: "12", cy: "12", r: "10" }),
|
|
9410
|
+
/* @__PURE__ */ jsx39("path", { d: "M12 6v6l4 2" })
|
|
9304
9411
|
] });
|
|
9305
9412
|
}
|
|
9306
9413
|
function TypedDateHelper({
|
|
@@ -9341,8 +9448,8 @@ function TypedDateHelper({
|
|
|
9341
9448
|
const at = new Date(shown2.y, shown2.m + by, 1);
|
|
9342
9449
|
setMonth({ y: at.getFullYear(), m: at.getMonth() });
|
|
9343
9450
|
};
|
|
9344
|
-
return /* @__PURE__ */
|
|
9345
|
-
/* @__PURE__ */
|
|
9451
|
+
return /* @__PURE__ */ jsxs35(Popover5, { open, onOpenChange: setOpen, children: [
|
|
9452
|
+
/* @__PURE__ */ jsx39(PopoverTrigger5, { asChild: true, children: /* @__PURE__ */ jsx39(
|
|
9346
9453
|
"button",
|
|
9347
9454
|
{
|
|
9348
9455
|
type: "button",
|
|
@@ -9351,10 +9458,10 @@ function TypedDateHelper({
|
|
|
9351
9458
|
"aria-label": kind === "time" ? `Pick a time for ${label}` : `Pick a date for ${label}`,
|
|
9352
9459
|
title: kind === "time" ? "Pick a time" : "Pick a date",
|
|
9353
9460
|
className: "inline-flex h-7 w-7 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-muted hover:text-foreground",
|
|
9354
|
-
children: kind === "time" ? /* @__PURE__ */
|
|
9461
|
+
children: kind === "time" ? /* @__PURE__ */ jsx39(ClockGlyph, {}) : /* @__PURE__ */ jsx39(CalendarGlyph, {})
|
|
9355
9462
|
}
|
|
9356
9463
|
) }),
|
|
9357
|
-
/* @__PURE__ */
|
|
9464
|
+
/* @__PURE__ */ jsx39(
|
|
9358
9465
|
PopoverContent5,
|
|
9359
9466
|
{
|
|
9360
9467
|
sizing: "content",
|
|
@@ -9364,23 +9471,23 @@ function TypedDateHelper({
|
|
|
9364
9471
|
"data-records-date-helper-panel": "",
|
|
9365
9472
|
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
9366
9473
|
onCloseAutoFocus: (e) => e.preventDefault(),
|
|
9367
|
-
children: /* @__PURE__ */
|
|
9368
|
-
kind === "time" ? null : /* @__PURE__ */
|
|
9369
|
-
/* @__PURE__ */
|
|
9370
|
-
/* @__PURE__ */
|
|
9371
|
-
/* @__PURE__ */
|
|
9474
|
+
children: /* @__PURE__ */ jsxs35("div", { className: "flex gap-2", children: [
|
|
9475
|
+
kind === "time" ? null : /* @__PURE__ */ jsxs35("div", { className: "flex flex-col gap-1", role: "grid", "aria-label": `${MONTHS[shown2.m]} ${shown2.y}`, children: [
|
|
9476
|
+
/* @__PURE__ */ jsxs35("div", { className: "flex items-center justify-between text-xs font-medium", children: [
|
|
9477
|
+
/* @__PURE__ */ jsx39("button", { type: "button", ...keepFocus, "aria-label": "Previous month", className: "rounded px-1.5 hover:bg-muted", onClick: () => turn(-1), children: "\u2039" }),
|
|
9478
|
+
/* @__PURE__ */ jsxs35("span", { children: [
|
|
9372
9479
|
MONTHS[shown2.m],
|
|
9373
9480
|
" ",
|
|
9374
9481
|
shown2.y
|
|
9375
9482
|
] }),
|
|
9376
|
-
/* @__PURE__ */
|
|
9483
|
+
/* @__PURE__ */ jsx39("button", { type: "button", ...keepFocus, "aria-label": "Next month", className: "rounded px-1.5 hover:bg-muted", onClick: () => turn(1), children: "\u203A" })
|
|
9377
9484
|
] }),
|
|
9378
|
-
/* @__PURE__ */
|
|
9379
|
-
WEEK.map((w) => /* @__PURE__ */
|
|
9485
|
+
/* @__PURE__ */ jsxs35("div", { className: "grid grid-cols-7 gap-0.5 text-center text-[11px]", children: [
|
|
9486
|
+
WEEK.map((w) => /* @__PURE__ */ jsx39("span", { className: "text-muted-foreground", children: w }, w)),
|
|
9380
9487
|
cells.map((d, i) => {
|
|
9381
|
-
if (d === null) return /* @__PURE__ */
|
|
9488
|
+
if (d === null) return /* @__PURE__ */ jsx39("span", {}, `blank-${i}`);
|
|
9382
9489
|
const key = `${shown2.y}-${pad(shown2.m + 1)}-${pad(d)}`;
|
|
9383
|
-
return /* @__PURE__ */
|
|
9490
|
+
return /* @__PURE__ */ jsx39(
|
|
9384
9491
|
"button",
|
|
9385
9492
|
{
|
|
9386
9493
|
type: "button",
|
|
@@ -9399,7 +9506,7 @@ function TypedDateHelper({
|
|
|
9399
9506
|
})
|
|
9400
9507
|
] })
|
|
9401
9508
|
] }),
|
|
9402
|
-
kind === "date" ? null : /* @__PURE__ */
|
|
9509
|
+
kind === "date" ? null : /* @__PURE__ */ jsx39("div", { className: "flex max-h-48 flex-col overflow-y-auto pr-1 text-[11px]", "aria-label": "Times", children: times.map((t) => /* @__PURE__ */ jsx39(
|
|
9403
9510
|
"button",
|
|
9404
9511
|
{
|
|
9405
9512
|
type: "button",
|
|
@@ -9421,7 +9528,7 @@ function TypedDateHelper({
|
|
|
9421
9528
|
}
|
|
9422
9529
|
|
|
9423
9530
|
// src/editors.tsx
|
|
9424
|
-
import { Fragment as
|
|
9531
|
+
import { Fragment as Fragment14, jsx as jsx40, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
9425
9532
|
var CHOICE_EDITOR_ADDS_WHAT_IS_TYPED = true;
|
|
9426
9533
|
function isChoiceAddition(value) {
|
|
9427
9534
|
return typeof value === "object" && value !== null && value.addingChoices === true;
|
|
@@ -9451,21 +9558,21 @@ function ChoiceAskButtons({
|
|
|
9451
9558
|
onCancel,
|
|
9452
9559
|
busy
|
|
9453
9560
|
}) {
|
|
9454
|
-
return /* @__PURE__ */
|
|
9455
|
-
/* @__PURE__ */
|
|
9456
|
-
/* @__PURE__ */
|
|
9457
|
-
/* @__PURE__ */
|
|
9458
|
-
keepOffered ? /* @__PURE__ */
|
|
9459
|
-
/* @__PURE__ */
|
|
9561
|
+
return /* @__PURE__ */ jsxs36("span", { "data-records-choice-ask": "", "data-records-cell-note": "", role: "group", "aria-label": choiceAskSentence(field2, words), className: "flex flex-col gap-1", children: [
|
|
9562
|
+
/* @__PURE__ */ jsx40("span", { className: "text-[11px] leading-snug", children: choiceAskSentence(field2, words) }),
|
|
9563
|
+
/* @__PURE__ */ jsxs36("span", { className: "flex flex-wrap items-center gap-1", children: [
|
|
9564
|
+
/* @__PURE__ */ jsx40(Button16, { type: "button", size: "sm", className: "h-6 px-2 text-xs", disabled: busy ?? false, onClick: onAdd, children: "Add" }),
|
|
9565
|
+
keepOffered ? /* @__PURE__ */ jsx40(Button16, { type: "button", size: "sm", variant: "outline", className: "h-6 px-2 text-xs", disabled: busy ?? false, onClick: onKeep, children: "Keep as typed" }) : null,
|
|
9566
|
+
/* @__PURE__ */ jsx40(Button16, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-2 text-xs", disabled: busy ?? false, onClick: onCancel, children: "Cancel" })
|
|
9460
9567
|
] })
|
|
9461
9568
|
] });
|
|
9462
9569
|
}
|
|
9463
9570
|
var FORMAT_BLIND_KINDS = /* @__PURE__ */ new Set(["formula", "lookup", "rollup", "json", "checkbox", "select", "multi_select", "member", "entity_reference", "relation", "attachment", "datetime"]);
|
|
9464
9571
|
function FieldLabel({ field: field2, htmlFor, children }) {
|
|
9465
|
-
return /* @__PURE__ */
|
|
9466
|
-
/* @__PURE__ */
|
|
9467
|
-
field2.required ? /* @__PURE__ */
|
|
9468
|
-
field2.unit && newerKindOf2(field2) !== "duration" ? /* @__PURE__ */
|
|
9572
|
+
return /* @__PURE__ */ jsxs36("div", { className: "flex items-baseline gap-1.5", children: [
|
|
9573
|
+
/* @__PURE__ */ jsx40(Label10, { htmlFor, className: "text-xs font-medium", children: fieldName(field2) }),
|
|
9574
|
+
field2.required ? /* @__PURE__ */ jsx40("span", { className: "text-xs text-destructive", children: "required" }) : null,
|
|
9575
|
+
field2.unit && newerKindOf2(field2) !== "duration" ? /* @__PURE__ */ jsx40("span", { className: "text-xs text-muted-foreground", children: field2.unit }) : null,
|
|
9469
9576
|
children
|
|
9470
9577
|
] });
|
|
9471
9578
|
}
|
|
@@ -9602,7 +9709,7 @@ function ReadsAsNote({ typed, always, children }) {
|
|
|
9602
9709
|
setRepeats(words(note.current?.textContent) === words(typed));
|
|
9603
9710
|
}, [typed, always]);
|
|
9604
9711
|
if (repeats) return null;
|
|
9605
|
-
return /* @__PURE__ */
|
|
9712
|
+
return /* @__PURE__ */ jsx40("span", { ref: note, "data-records-typed-reads-as": "", "data-records-cell-note": "", className: "text-[10px] text-muted-foreground", children });
|
|
9606
9713
|
}
|
|
9607
9714
|
function TypedTextControl({ field: field2, value, onChange, disabled, id, onCommit, onCancel }) {
|
|
9608
9715
|
const client = useOptionalRecordsClient11();
|
|
@@ -9632,7 +9739,7 @@ function TypedTextControl({ field: field2, value, onChange, disabled, id, onComm
|
|
|
9632
9739
|
judged: judgeTyped(field2, text, needsChoices ? choices : void 0, needsChoices ? nudge : void 0),
|
|
9633
9740
|
...value.openedAs !== void 0 ? { openedAs: value.openedAs } : {}
|
|
9634
9741
|
});
|
|
9635
|
-
const box = /* @__PURE__ */
|
|
9742
|
+
const box = /* @__PURE__ */ jsx40(
|
|
9636
9743
|
BasicInput10,
|
|
9637
9744
|
{
|
|
9638
9745
|
id,
|
|
@@ -9644,16 +9751,16 @@ function TypedTextControl({ field: field2, value, onChange, disabled, id, onComm
|
|
|
9644
9751
|
onChange: (e) => retype(e.target.value)
|
|
9645
9752
|
}
|
|
9646
9753
|
);
|
|
9647
|
-
return /* @__PURE__ */
|
|
9648
|
-
helper && !disabled ? /* @__PURE__ */
|
|
9754
|
+
return /* @__PURE__ */ jsxs36("span", { className: "flex flex-col gap-0.5", children: [
|
|
9755
|
+
helper && !disabled ? /* @__PURE__ */ jsxs36("span", { className: "flex min-w-0 items-center gap-0.5", children: [
|
|
9649
9756
|
box,
|
|
9650
|
-
/* @__PURE__ */
|
|
9757
|
+
/* @__PURE__ */ jsx40(TypedDateHelper, { kind: helper, text: value.text, onText: retype, label: fieldName(field2), onPicked: onCommit, startOpen: value.openedAs !== void 0 })
|
|
9651
9758
|
] }) : box,
|
|
9652
|
-
judged === null ? /* @__PURE__ */
|
|
9759
|
+
judged === null ? /* @__PURE__ */ jsxs36("span", { "data-records-cell-note": "", className: "text-[10px] text-muted-foreground", children: [
|
|
9653
9760
|
"Reading ",
|
|
9654
9761
|
fieldName(field2),
|
|
9655
9762
|
"'s choices\u2026"
|
|
9656
|
-
] }) : "ask" in judged ? /* @__PURE__ */
|
|
9763
|
+
] }) : "ask" in judged ? /* @__PURE__ */ jsx40(
|
|
9657
9764
|
ChoiceAskButtons,
|
|
9658
9765
|
{
|
|
9659
9766
|
field: field2,
|
|
@@ -9669,10 +9776,10 @@ function TypedTextControl({ field: field2, value, onChange, disabled, id, onComm
|
|
|
9669
9776
|
},
|
|
9670
9777
|
onCancel: () => onCancel?.()
|
|
9671
9778
|
}
|
|
9672
|
-
) : "refusal" in judged ? /* @__PURE__ */
|
|
9673
|
-
/* @__PURE__ */
|
|
9674
|
-
judged.cancelOnly && onCancel ? /* @__PURE__ */
|
|
9675
|
-
] }) : judged.value === null || judged.value === void 0 ? null : /* @__PURE__ */
|
|
9779
|
+
) : "refusal" in judged ? /* @__PURE__ */ jsxs36(Fragment14, { children: [
|
|
9780
|
+
/* @__PURE__ */ jsx40(FloatingRefusal, { text: judged.refusal, why: "why" in judged ? judged.why : void 0 }),
|
|
9781
|
+
judged.cancelOnly && onCancel ? /* @__PURE__ */ jsx40("span", { "data-records-cell-note": "", "data-records-choice-ask": "", children: /* @__PURE__ */ jsx40(Button16, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-2 text-xs", onClick: () => onCancel(), children: "Cancel" }) }) : null
|
|
9782
|
+
] }) : judged.value === null || judged.value === void 0 ? null : /* @__PURE__ */ jsxs36(ReadsAsNote, { typed: value.text, always: isChoiceAddition(judged.value), children: [
|
|
9676
9783
|
isChoiceAddition(judged.value) ? `Adds ${quoted(judged.value.add)} to the choices for ${fieldName(field2)}. ` : null,
|
|
9677
9784
|
"Reads as",
|
|
9678
9785
|
" ",
|
|
@@ -9683,7 +9790,7 @@ function TypedTextControl({ field: field2, value, onChange, disabled, id, onComm
|
|
|
9683
9790
|
}).join(", ")
|
|
9684
9791
|
) : (() => {
|
|
9685
9792
|
const shown2 = format ?? (kind === "datetime" ? { id: carriesTimeOfDay(field2, judged.value) ? "datetime" : "date" } : void 0);
|
|
9686
|
-
return shown2 ? /* @__PURE__ */
|
|
9793
|
+
return shown2 ? /* @__PURE__ */ jsx40(FormattedValue, { value: judged.value, format: shown2 }) : String(judged.value);
|
|
9687
9794
|
})()
|
|
9688
9795
|
] }, value.text)
|
|
9689
9796
|
] });
|
|
@@ -9697,33 +9804,33 @@ function FieldControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
9697
9804
|
const kind = editorKindFor(field2);
|
|
9698
9805
|
const inputId = id ?? `field-${field2.key}`;
|
|
9699
9806
|
const ownDetails = useOptionalRecordsClient11() === null;
|
|
9700
|
-
if (isTypedDraft(value)) return /* @__PURE__ */
|
|
9701
|
-
if (isSignatureField(field2)) return /* @__PURE__ */
|
|
9702
|
-
if (isButtonField2(field2)) return /* @__PURE__ */
|
|
9807
|
+
if (isTypedDraft(value)) return /* @__PURE__ */ jsx40(TypedTextControl, { field: field2, value, onChange, disabled, id: inputId, onCommit, onCancel });
|
|
9808
|
+
if (isSignatureField(field2)) return /* @__PURE__ */ jsx40(SignaturePad, { id: inputId, value, onChange, disabled });
|
|
9809
|
+
if (isButtonField2(field2)) return /* @__PURE__ */ jsx40(ButtonValue, { field: field2 });
|
|
9703
9810
|
const newerControl = newerKindControl({ field: field2, value, onChange, disabled, id: inputId });
|
|
9704
9811
|
if (newerControl !== void 0) return newerControl;
|
|
9705
9812
|
const format = formatForField(field2);
|
|
9706
|
-
if (format && format.id === "time") return /* @__PURE__ */
|
|
9813
|
+
if (format && format.id === "time") return /* @__PURE__ */ jsx40(TypedWordsControl, { field: field2, value, onChange, disabled, id: inputId });
|
|
9707
9814
|
if (format && !FORMAT_BLIND_KINDS.has(String(kind))) {
|
|
9708
9815
|
const own3 = formatControl({ format, value, onChange, disabled, id: inputId, label: fieldName(field2), ownDetails });
|
|
9709
9816
|
if (own3) return own3;
|
|
9710
9817
|
}
|
|
9711
9818
|
if ((kind === "text" || kind === "long_text") && typeof value === "string" && /^\s*(?:\[|\{|```json)/.test(value)) {
|
|
9712
|
-
return /* @__PURE__ */
|
|
9819
|
+
return /* @__PURE__ */ jsx40(StructuredTextControl, { field: field2, value, onChange, disabled, id: inputId, rows: asForm ? 8 : 3 });
|
|
9713
9820
|
}
|
|
9714
9821
|
switch (kind) {
|
|
9715
9822
|
case "formula":
|
|
9716
9823
|
case "lookup":
|
|
9717
9824
|
case "rollup":
|
|
9718
|
-
return /* @__PURE__ */
|
|
9825
|
+
return /* @__PURE__ */ jsxs36("div", { id: inputId, className: "rounded border border-dashed px-2 py-1.5 text-xs text-muted-foreground", children: [
|
|
9719
9826
|
value === null || value === void 0 ? "\u2014" : String(value),
|
|
9720
|
-
/* @__PURE__ */
|
|
9827
|
+
/* @__PURE__ */ jsxs36("span", { className: "ml-2 italic", children: [
|
|
9721
9828
|
fieldName(field2),
|
|
9722
9829
|
" is worked out by the system, so it cannot be typed in"
|
|
9723
9830
|
] })
|
|
9724
9831
|
] });
|
|
9725
9832
|
case "json":
|
|
9726
|
-
return /* @__PURE__ */
|
|
9833
|
+
return /* @__PURE__ */ jsx40(JsonControl, { field: field2, value, onChange, disabled, id: inputId });
|
|
9727
9834
|
case "long_text":
|
|
9728
9835
|
if (host.textBox) {
|
|
9729
9836
|
return host.textBox({
|
|
@@ -9736,7 +9843,7 @@ function FieldControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
9736
9843
|
disabled
|
|
9737
9844
|
});
|
|
9738
9845
|
}
|
|
9739
|
-
return /* @__PURE__ */
|
|
9846
|
+
return /* @__PURE__ */ jsx40(
|
|
9740
9847
|
BasicTextarea4,
|
|
9741
9848
|
{
|
|
9742
9849
|
id: inputId,
|
|
@@ -9749,7 +9856,7 @@ function FieldControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
9749
9856
|
case "number":
|
|
9750
9857
|
case "currency":
|
|
9751
9858
|
case "percent":
|
|
9752
|
-
return /* @__PURE__ */
|
|
9859
|
+
return /* @__PURE__ */ jsx40(
|
|
9753
9860
|
BasicInput10,
|
|
9754
9861
|
{
|
|
9755
9862
|
id: inputId,
|
|
@@ -9762,11 +9869,11 @@ function FieldControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
9762
9869
|
}
|
|
9763
9870
|
);
|
|
9764
9871
|
case "datetime":
|
|
9765
|
-
return /* @__PURE__ */
|
|
9872
|
+
return /* @__PURE__ */ jsx40(TypedWordsControl, { field: field2, value, onChange, disabled, id: inputId });
|
|
9766
9873
|
case "email":
|
|
9767
9874
|
case "phone":
|
|
9768
9875
|
case "url":
|
|
9769
|
-
return /* @__PURE__ */
|
|
9876
|
+
return /* @__PURE__ */ jsx40(
|
|
9770
9877
|
BasicInput10,
|
|
9771
9878
|
{
|
|
9772
9879
|
id: inputId,
|
|
@@ -9779,24 +9886,24 @@ function FieldControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
9779
9886
|
}
|
|
9780
9887
|
);
|
|
9781
9888
|
case "checkbox":
|
|
9782
|
-
return /* @__PURE__ */
|
|
9889
|
+
return /* @__PURE__ */ jsx40(CheckboxControl, { field: field2, value, onChange, disabled, id: inputId });
|
|
9783
9890
|
case "select":
|
|
9784
9891
|
case "multi_select":
|
|
9785
|
-
return /* @__PURE__ */
|
|
9892
|
+
return /* @__PURE__ */ jsx40(OptionControl, { field: field2, value, onChange, disabled, id: inputId, autoOpen, onClose, onCancel, addsChoices, initialSearch, asForm, onChosen });
|
|
9786
9893
|
case "member":
|
|
9787
|
-
return /* @__PURE__ */
|
|
9894
|
+
return /* @__PURE__ */ jsx40(PersonPicker, { field: field2, value, onChange, disabled, id: inputId, autoOpen, onClose, onCancel, initialSearch });
|
|
9788
9895
|
case "entity_reference":
|
|
9789
|
-
return /* @__PURE__ */
|
|
9896
|
+
return /* @__PURE__ */ jsx40(EntityReferenceControl, { field: field2, value, onChange, disabled, id: inputId });
|
|
9790
9897
|
case "attachment":
|
|
9791
9898
|
if (hostTakesFiles(host)) {
|
|
9792
|
-
return /* @__PURE__ */
|
|
9899
|
+
return /* @__PURE__ */ jsx40(AttachmentControl, { field: field2, value, onChange, disabled, id: inputId, autoOpen, onClose });
|
|
9793
9900
|
}
|
|
9794
|
-
return /* @__PURE__ */
|
|
9901
|
+
return /* @__PURE__ */ jsx40(RelationPicker, { field: field2, value, onChange, disabled, id: inputId, excludeId: recordId });
|
|
9795
9902
|
case "relation":
|
|
9796
|
-
return /* @__PURE__ */
|
|
9903
|
+
return /* @__PURE__ */ jsx40(RelationPicker, { field: field2, value, onChange, disabled, id: inputId, onPicked: onCommit, autoOpen, onClose, onCancel, excludeId: recordId });
|
|
9797
9904
|
default:
|
|
9798
9905
|
if (typeof value === "boolean" || field2.config?.["kind"] === "boolean") {
|
|
9799
|
-
return /* @__PURE__ */
|
|
9906
|
+
return /* @__PURE__ */ jsx40(
|
|
9800
9907
|
Checkbox5,
|
|
9801
9908
|
{
|
|
9802
9909
|
id: inputId,
|
|
@@ -9806,7 +9913,7 @@ function FieldControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
9806
9913
|
}
|
|
9807
9914
|
);
|
|
9808
9915
|
}
|
|
9809
|
-
return /* @__PURE__ */
|
|
9916
|
+
return /* @__PURE__ */ jsx40(
|
|
9810
9917
|
BasicInput10,
|
|
9811
9918
|
{
|
|
9812
9919
|
id: inputId,
|
|
@@ -9842,9 +9949,9 @@ function TypedWordsControl({ field: field2, value, onChange, disabled, id }) {
|
|
|
9842
9949
|
setWhy("why" in judged ? judged.why : void 0);
|
|
9843
9950
|
}
|
|
9844
9951
|
};
|
|
9845
|
-
return /* @__PURE__ */
|
|
9846
|
-
/* @__PURE__ */
|
|
9847
|
-
/* @__PURE__ */
|
|
9952
|
+
return /* @__PURE__ */ jsxs36("span", { className: "flex flex-col gap-0.5", children: [
|
|
9953
|
+
/* @__PURE__ */ jsxs36("span", { className: "flex min-w-0 items-center gap-0.5", children: [
|
|
9954
|
+
/* @__PURE__ */ jsx40(
|
|
9848
9955
|
BasicInput10,
|
|
9849
9956
|
{
|
|
9850
9957
|
id,
|
|
@@ -9861,9 +9968,9 @@ function TypedWordsControl({ field: field2, value, onChange, disabled, id }) {
|
|
|
9861
9968
|
}
|
|
9862
9969
|
}
|
|
9863
9970
|
),
|
|
9864
|
-
helper && !disabled ? /* @__PURE__ */
|
|
9971
|
+
helper && !disabled ? /* @__PURE__ */ jsx40(TypedDateHelper, { kind: helper, text, onText: retype, label: fieldName(field2) }) : null
|
|
9865
9972
|
] }),
|
|
9866
|
-
refusal ? /* @__PURE__ */
|
|
9973
|
+
refusal ? /* @__PURE__ */ jsx40(FloatingRefusal, { text: refusal, why }) : null
|
|
9867
9974
|
] });
|
|
9868
9975
|
}
|
|
9869
9976
|
function typedDatePlaceholder(helper) {
|
|
@@ -9874,8 +9981,8 @@ function typedDatePlaceholder(helper) {
|
|
|
9874
9981
|
}
|
|
9875
9982
|
function CheckboxControl({ field: field2, value, onChange, disabled, id }) {
|
|
9876
9983
|
const unanswered = value === null || value === void 0;
|
|
9877
|
-
return /* @__PURE__ */
|
|
9878
|
-
/* @__PURE__ */
|
|
9984
|
+
return /* @__PURE__ */ jsxs36("div", { className: "flex items-center gap-2", children: [
|
|
9985
|
+
/* @__PURE__ */ jsx40(
|
|
9879
9986
|
Checkbox5,
|
|
9880
9987
|
{
|
|
9881
9988
|
id,
|
|
@@ -9885,9 +9992,9 @@ function CheckboxControl({ field: field2, value, onChange, disabled, id }) {
|
|
|
9885
9992
|
onCheckedChange: (next) => onChange(next === true)
|
|
9886
9993
|
}
|
|
9887
9994
|
),
|
|
9888
|
-
unanswered ? /* @__PURE__ */
|
|
9889
|
-
/* @__PURE__ */
|
|
9890
|
-
field2.required ? null : /* @__PURE__ */
|
|
9995
|
+
unanswered ? /* @__PURE__ */ jsx40("span", { className: "text-xs italic text-muted-foreground", children: "not answered yet" }) : /* @__PURE__ */ jsxs36(Fragment14, { children: [
|
|
9996
|
+
/* @__PURE__ */ jsx40("span", { className: "text-xs text-muted-foreground", children: value === true ? "Yes" : "No" }),
|
|
9997
|
+
field2.required ? null : /* @__PURE__ */ jsx40(
|
|
9891
9998
|
Button16,
|
|
9892
9999
|
{
|
|
9893
10000
|
size: "sm",
|
|
@@ -9904,8 +10011,8 @@ function CheckboxControl({ field: field2, value, onChange, disabled, id }) {
|
|
|
9904
10011
|
function StructuredTextControl({ field: field2, value, onChange, disabled, id, rows }) {
|
|
9905
10012
|
const text = typeof value === "string" ? value : "";
|
|
9906
10013
|
const reads = structuredOf(text) !== null;
|
|
9907
|
-
return /* @__PURE__ */
|
|
9908
|
-
/* @__PURE__ */
|
|
10014
|
+
return /* @__PURE__ */ jsxs36("div", { className: "flex flex-col gap-1", "data-records-structured-editor": "", children: [
|
|
10015
|
+
/* @__PURE__ */ jsx40(
|
|
9909
10016
|
BasicTextarea4,
|
|
9910
10017
|
{
|
|
9911
10018
|
id,
|
|
@@ -9917,7 +10024,7 @@ function StructuredTextControl({ field: field2, value, onChange, disabled, id, r
|
|
|
9917
10024
|
onChange: (e) => onChange(e.target.value === "" ? null : e.target.value)
|
|
9918
10025
|
}
|
|
9919
10026
|
),
|
|
9920
|
-
/* @__PURE__ */
|
|
10027
|
+
/* @__PURE__ */ jsx40("span", { className: "flex h-6 items-center gap-2 text-xs", children: reads ? /* @__PURE__ */ jsx40(
|
|
9921
10028
|
Button16,
|
|
9922
10029
|
{
|
|
9923
10030
|
type: "button",
|
|
@@ -9929,15 +10036,15 @@ function StructuredTextControl({ field: field2, value, onChange, disabled, id, r
|
|
|
9929
10036
|
"data-records-structured-format": "",
|
|
9930
10037
|
children: "Format"
|
|
9931
10038
|
}
|
|
9932
|
-
) : /* @__PURE__ */
|
|
10039
|
+
) : /* @__PURE__ */ jsx40("span", { className: "text-amber-700 dark:text-amber-400", "data-records-structured-broken": "", children: "Not valid JSON \u2014 saves as plain text" }) })
|
|
9933
10040
|
] });
|
|
9934
10041
|
}
|
|
9935
10042
|
function JsonControl({ field: field2, value, onChange, disabled, id }) {
|
|
9936
10043
|
const initial = value === null || value === void 0 ? "" : typeof value === "string" ? value : JSON.stringify(value, null, 2);
|
|
9937
10044
|
const [text, setText] = useState29(initial);
|
|
9938
10045
|
const [broken, setBroken] = useState29(null);
|
|
9939
|
-
return /* @__PURE__ */
|
|
9940
|
-
/* @__PURE__ */
|
|
10046
|
+
return /* @__PURE__ */ jsxs36("div", { className: "flex flex-col gap-1", children: [
|
|
10047
|
+
/* @__PURE__ */ jsx40(
|
|
9941
10048
|
BasicTextarea4,
|
|
9942
10049
|
{
|
|
9943
10050
|
id,
|
|
@@ -9972,7 +10079,7 @@ function JsonControl({ field: field2, value, onChange, disabled, id }) {
|
|
|
9972
10079
|
broken ? (
|
|
9973
10080
|
// The typed text is still in the box: the notice owns the two doors out. In a grid cell it
|
|
9974
10081
|
// floats over the table (`data-records-cell-note`), so the row never grows.
|
|
9975
|
-
/* @__PURE__ */
|
|
10082
|
+
/* @__PURE__ */ jsx40("span", { "data-records-cell-note": "", className: "block", children: /* @__PURE__ */ jsx40(
|
|
9976
10083
|
RefusalNotice,
|
|
9977
10084
|
{
|
|
9978
10085
|
error: broken,
|
|
@@ -10014,11 +10121,11 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
10014
10121
|
}, [client, field2.id, reread]);
|
|
10015
10122
|
const handed = publicChoicesOf(field2);
|
|
10016
10123
|
if (!client && handed.length > 0) {
|
|
10017
|
-
return /* @__PURE__ */
|
|
10124
|
+
return /* @__PURE__ */ jsx40(ChoiceAnswer, { field: field2, choices: handed, value, onChange, disabled, id, onChosen });
|
|
10018
10125
|
}
|
|
10019
10126
|
if (!client) {
|
|
10020
|
-
return /* @__PURE__ */
|
|
10021
|
-
/* @__PURE__ */
|
|
10127
|
+
return /* @__PURE__ */ jsxs36("div", { className: "flex flex-col gap-1", children: [
|
|
10128
|
+
/* @__PURE__ */ jsx40(
|
|
10022
10129
|
BasicInput10,
|
|
10023
10130
|
{
|
|
10024
10131
|
id,
|
|
@@ -10027,15 +10134,15 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
10027
10134
|
onChange: (e) => onChange(e.target.value === "" ? null : e.target.value)
|
|
10028
10135
|
}
|
|
10029
10136
|
),
|
|
10030
|
-
/* @__PURE__ */
|
|
10137
|
+
/* @__PURE__ */ jsx40("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." })
|
|
10031
10138
|
] });
|
|
10032
10139
|
}
|
|
10033
10140
|
if (refusal)
|
|
10034
|
-
return /* @__PURE__ */
|
|
10035
|
-
if (!options) return /* @__PURE__ */
|
|
10141
|
+
return /* @__PURE__ */ jsx40("div", { id, children: /* @__PURE__ */ jsx40(RefusalLine, { error: refusal }) });
|
|
10142
|
+
if (!options) return /* @__PURE__ */ jsx40("p", { id, className: "text-xs text-muted-foreground", children: "Reading this field's choices\u2026" });
|
|
10036
10143
|
if (asForm && options.length > 0) {
|
|
10037
10144
|
const titled = (option) => recordName(option.data, null, "Unnamed choice");
|
|
10038
|
-
return /* @__PURE__ */
|
|
10145
|
+
return /* @__PURE__ */ jsx40(
|
|
10039
10146
|
ChoiceAnswer,
|
|
10040
10147
|
{
|
|
10041
10148
|
field: field2,
|
|
@@ -10053,7 +10160,7 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
10053
10160
|
);
|
|
10054
10161
|
}
|
|
10055
10162
|
const noChoicesYet = client && options.length === 0 && !disabled;
|
|
10056
|
-
const offerChoices = noChoicesYet ? /* @__PURE__ */
|
|
10163
|
+
const offerChoices = noChoicesYet ? /* @__PURE__ */ jsx40(
|
|
10057
10164
|
AddChoicesInline,
|
|
10058
10165
|
{
|
|
10059
10166
|
field: field2,
|
|
@@ -10064,9 +10171,9 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
10064
10171
|
}
|
|
10065
10172
|
) : null;
|
|
10066
10173
|
if (CHOICE_EDITOR_ADDS_WHAT_IS_TYPED) {
|
|
10067
|
-
return /* @__PURE__ */
|
|
10174
|
+
return /* @__PURE__ */ jsxs36(Fragment14, { children: [
|
|
10068
10175
|
offerChoices,
|
|
10069
|
-
/* @__PURE__ */
|
|
10176
|
+
/* @__PURE__ */ jsx40(
|
|
10070
10177
|
OpenChoicePicker,
|
|
10071
10178
|
{
|
|
10072
10179
|
field: field2,
|
|
@@ -10090,13 +10197,13 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
10090
10197
|
] });
|
|
10091
10198
|
}
|
|
10092
10199
|
if (options.length === 0) {
|
|
10093
|
-
return /* @__PURE__ */
|
|
10200
|
+
return /* @__PURE__ */ jsx40("p", { id, className: "text-xs text-muted-foreground", children: field2.options_table_id ? `${fieldName(field2)} takes its choices from a Table that has no records yet \u2014 add the choices there and they appear here.` : `${fieldName(field2)} 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.` });
|
|
10094
10201
|
}
|
|
10095
10202
|
const titleOf = (option) => recordName(option.data, null, "Unnamed choice");
|
|
10096
10203
|
if (field2.multi) {
|
|
10097
10204
|
const chosen = options.filter((option) => choiceValuesOf(value).some((v) => isTheChosen(option, v)));
|
|
10098
10205
|
const picked = new Set(chosen.map((option) => optionKey4(option)));
|
|
10099
|
-
const toggles = /* @__PURE__ */
|
|
10206
|
+
const toggles = /* @__PURE__ */ jsx40("div", { id: autoOpen ? void 0 : id, className: "flex flex-wrap gap-1", children: options.map((option) => /* @__PURE__ */ jsx40(
|
|
10100
10207
|
Button16,
|
|
10101
10208
|
{
|
|
10102
10209
|
type: "button",
|
|
@@ -10114,7 +10221,7 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
10114
10221
|
option.id
|
|
10115
10222
|
)) });
|
|
10116
10223
|
if (!autoOpen) return toggles;
|
|
10117
|
-
return /* @__PURE__ */
|
|
10224
|
+
return /* @__PURE__ */ jsxs36(
|
|
10118
10225
|
Popover6,
|
|
10119
10226
|
{
|
|
10120
10227
|
defaultOpen: true,
|
|
@@ -10122,14 +10229,14 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
10122
10229
|
if (!open) onClose?.();
|
|
10123
10230
|
},
|
|
10124
10231
|
children: [
|
|
10125
|
-
/* @__PURE__ */
|
|
10126
|
-
/* @__PURE__ */
|
|
10232
|
+
/* @__PURE__ */ jsx40(PopoverTrigger6, { asChild: true, children: /* @__PURE__ */ jsx40(Button16, { id, type: "button", size: "sm", variant: "outline", className: "h-6 max-w-full truncate", children: chosen.length === 0 ? "Choose" : chosen.map(titleOf).join(", ") }) }),
|
|
10233
|
+
/* @__PURE__ */ jsx40(PopoverContent6, { sizing: "content", className: "max-w-[20rem] p-2", align: "start", children: toggles })
|
|
10127
10234
|
]
|
|
10128
10235
|
}
|
|
10129
10236
|
);
|
|
10130
10237
|
}
|
|
10131
10238
|
const current = options.find((option) => isTheChosen(option, value));
|
|
10132
|
-
return /* @__PURE__ */
|
|
10239
|
+
return /* @__PURE__ */ jsxs36(
|
|
10133
10240
|
Select6,
|
|
10134
10241
|
{
|
|
10135
10242
|
value: current ? optionKey4(current) : "",
|
|
@@ -10143,8 +10250,8 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
10143
10250
|
}
|
|
10144
10251
|
} : {},
|
|
10145
10252
|
children: [
|
|
10146
|
-
/* @__PURE__ */
|
|
10147
|
-
/* @__PURE__ */
|
|
10253
|
+
/* @__PURE__ */ jsx40(SelectTrigger6, { id, size: "sm", children: /* @__PURE__ */ jsx40(SelectValue6, { placeholder: "Choose" }) }),
|
|
10254
|
+
/* @__PURE__ */ jsx40(SelectContent6, { children: options.map((option) => /* @__PURE__ */ jsx40(SelectItem6, { value: optionKey4(option), children: titleOf(option) }, option.id)) })
|
|
10148
10255
|
]
|
|
10149
10256
|
}
|
|
10150
10257
|
);
|
|
@@ -10233,7 +10340,7 @@ function OpenChoicePicker({
|
|
|
10233
10340
|
const pickedOptions = current.map((v) => options.find((o) => isTheChosen(o, v)));
|
|
10234
10341
|
const cellChips = pickedWords.map((word, i) => {
|
|
10235
10342
|
const chip = chipOf(pickedOptions[i], word);
|
|
10236
|
-
return /* @__PURE__ */
|
|
10343
|
+
return /* @__PURE__ */ jsx40(Badge7, { variant: "outline", className: cn20("text-[11px]", chip.className), "data-records-choice-chip": "", children: word }, word);
|
|
10237
10344
|
});
|
|
10238
10345
|
const headChips = pickedWords.map((word, i) => {
|
|
10239
10346
|
const option = pickedOptions[i];
|
|
@@ -10248,12 +10355,12 @@ function OpenChoicePicker({
|
|
|
10248
10355
|
};
|
|
10249
10356
|
});
|
|
10250
10357
|
const anchored = autoOpen === true;
|
|
10251
|
-
return /* @__PURE__ */
|
|
10358
|
+
return /* @__PURE__ */ jsxs36("div", { id, className: "flex flex-wrap items-center gap-1", children: [
|
|
10252
10359
|
anchored || disabled ? null : cellChips,
|
|
10253
10360
|
disabled ? cellChips : (
|
|
10254
10361
|
// THE ONE "PICK OR ADD" BUILDER (PickOrAdd.tsx) — the relation picker draws the same one.
|
|
10255
10362
|
// In a grid cell it hangs from the cell's own chips; no button is drawn in the cell.
|
|
10256
|
-
/* @__PURE__ */
|
|
10363
|
+
/* @__PURE__ */ jsx40(
|
|
10257
10364
|
PickOrAdd,
|
|
10258
10365
|
{
|
|
10259
10366
|
anchored,
|
|
@@ -10279,14 +10386,14 @@ function OpenChoicePicker({
|
|
|
10279
10386
|
const option = options.find((o) => o.id === optionId);
|
|
10280
10387
|
if (option) choose(optionKey4(option));
|
|
10281
10388
|
},
|
|
10282
|
-
empty: q === "" ? /* @__PURE__ */
|
|
10389
|
+
empty: q === "" ? /* @__PURE__ */ jsx40("p", { className: "p-2 text-xs text-muted-foreground", children: "No choices yet \u2014 type one to add it." }) : null,
|
|
10283
10390
|
add,
|
|
10284
10391
|
foot,
|
|
10285
|
-
footNote: addRefused ? /* @__PURE__ */
|
|
10392
|
+
footNote: addRefused ? /* @__PURE__ */ jsx40(RefusalLine, { error: addRefused }) : offList && decided.decision === "not_a_choice" ? (
|
|
10286
10393
|
// never_add on a column that takes only its choices: said, never a silent nothing.
|
|
10287
|
-
/* @__PURE__ */
|
|
10288
|
-
/* @__PURE__ */
|
|
10289
|
-
autoOpen ? /* @__PURE__ */
|
|
10394
|
+
/* @__PURE__ */ jsxs36(Fragment14, { children: [
|
|
10395
|
+
/* @__PURE__ */ jsx40("p", { "data-records-typed-refusal": "", className: "p-2 text-xs text-muted-foreground", children: notAChoiceSentence(field2, [q]) }),
|
|
10396
|
+
autoOpen ? /* @__PURE__ */ jsx40("span", { "data-records-choice-ask": "", className: "px-2 pb-1", children: /* @__PURE__ */ jsx40(Button16, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-2 text-xs", onClick: () => setOpen(false), children: "Cancel" }) }) : null
|
|
10290
10397
|
] })
|
|
10291
10398
|
) : null,
|
|
10292
10399
|
children: anchored ? cellChips : null
|
|
@@ -10306,9 +10413,9 @@ function RecordChip({
|
|
|
10306
10413
|
// name. So it caps at its container and ends in an ellipsis with the whole name in
|
|
10307
10414
|
// its tooltip, rather than being cut mid-word by whatever box it landed in
|
|
10308
10415
|
// (lane FIX-14, 2026-09-22).
|
|
10309
|
-
/* @__PURE__ */
|
|
10310
|
-
/* @__PURE__ */
|
|
10311
|
-
onRemove ? /* @__PURE__ */
|
|
10416
|
+
/* @__PURE__ */ jsxs36(Badge7, { variant: "secondary", className: cn20("max-w-full gap-1 text-[11px]", className), title, children: [
|
|
10417
|
+
/* @__PURE__ */ jsx40("span", { className: "min-w-0 truncate", children: title }),
|
|
10418
|
+
onRemove ? /* @__PURE__ */ jsx40("button", { type: "button", onClick: onRemove, "aria-label": `Remove ${title}`, className: "shrink-0 opacity-60 hover:opacity-100", children: "\xD7" }) : null
|
|
10312
10419
|
] })
|
|
10313
10420
|
);
|
|
10314
10421
|
}
|
|
@@ -10350,7 +10457,7 @@ function ChoiceAnswer({
|
|
|
10350
10457
|
const option = (choice) => {
|
|
10351
10458
|
const chosen = on(choice);
|
|
10352
10459
|
const letter = lettered ? CHOICE_LETTERS[choices.indexOf(choice)] : null;
|
|
10353
|
-
return /* @__PURE__ */
|
|
10460
|
+
return /* @__PURE__ */ jsxs36(
|
|
10354
10461
|
"button",
|
|
10355
10462
|
{
|
|
10356
10463
|
type: "button",
|
|
@@ -10366,7 +10473,7 @@ function ChoiceAnswer({
|
|
|
10366
10473
|
chosen ? "border-primary bg-primary/10" : "border-primary/30 bg-primary/[0.03] hover:bg-primary/10"
|
|
10367
10474
|
),
|
|
10368
10475
|
children: [
|
|
10369
|
-
letter ? /* @__PURE__ */
|
|
10476
|
+
letter ? /* @__PURE__ */ jsx40(
|
|
10370
10477
|
"kbd",
|
|
10371
10478
|
{
|
|
10372
10479
|
"aria-hidden": "true",
|
|
@@ -10377,8 +10484,8 @@ function ChoiceAnswer({
|
|
|
10377
10484
|
children: letter
|
|
10378
10485
|
}
|
|
10379
10486
|
) : null,
|
|
10380
|
-
/* @__PURE__ */
|
|
10381
|
-
chosen ? /* @__PURE__ */
|
|
10487
|
+
/* @__PURE__ */ jsx40("span", { className: "min-w-0 flex-1 break-words", children: choice.label }),
|
|
10488
|
+
chosen ? /* @__PURE__ */ jsx40("span", { "aria-hidden": "true", className: "shrink-0 text-primary", children: "\u2713" }) : null
|
|
10382
10489
|
]
|
|
10383
10490
|
},
|
|
10384
10491
|
choice.key
|
|
@@ -10411,12 +10518,12 @@ function ChoiceAnswer({
|
|
|
10411
10518
|
};
|
|
10412
10519
|
const group = { role: field2.multi ? "group" : "radiogroup", "aria-label": fieldName(field2), onKeyDown };
|
|
10413
10520
|
if (choices.length <= FORM_SEARCH_AFTER) {
|
|
10414
|
-
return /* @__PURE__ */
|
|
10521
|
+
return /* @__PURE__ */ jsx40("div", { id, className: "flex w-full flex-col gap-2", ...group, children: choices.map(option) });
|
|
10415
10522
|
}
|
|
10416
10523
|
const q = search.trim().toLowerCase();
|
|
10417
10524
|
const shown2 = q === "" ? choices : choices.filter((c) => c.label.toLowerCase().includes(q));
|
|
10418
|
-
return /* @__PURE__ */
|
|
10419
|
-
/* @__PURE__ */
|
|
10525
|
+
return /* @__PURE__ */ jsxs36("div", { id, className: "flex w-full flex-col gap-2", onKeyDown, children: [
|
|
10526
|
+
/* @__PURE__ */ jsx40(
|
|
10420
10527
|
BasicInput10,
|
|
10421
10528
|
{
|
|
10422
10529
|
value: search,
|
|
@@ -10427,15 +10534,15 @@ function ChoiceAnswer({
|
|
|
10427
10534
|
className: "h-11 text-base sm:h-9 sm:text-sm"
|
|
10428
10535
|
}
|
|
10429
10536
|
),
|
|
10430
|
-
/* @__PURE__ */
|
|
10537
|
+
/* @__PURE__ */ jsxs36("div", { className: "flex max-h-80 w-full flex-col gap-2 overflow-y-auto", role: group.role, "aria-label": group["aria-label"], children: [
|
|
10431
10538
|
shown2.map(option),
|
|
10432
|
-
shown2.length === 0 ? /* @__PURE__ */
|
|
10539
|
+
shown2.length === 0 ? /* @__PURE__ */ jsx40("p", { className: "text-xs text-muted-foreground", children: "No match" }) : null
|
|
10433
10540
|
] })
|
|
10434
10541
|
] });
|
|
10435
10542
|
}
|
|
10436
10543
|
|
|
10437
10544
|
// src/ChoiceListEditor.tsx
|
|
10438
|
-
import { Fragment as
|
|
10545
|
+
import { Fragment as Fragment15, jsx as jsx41, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
10439
10546
|
var rowSeed = 0;
|
|
10440
10547
|
var nextRow = () => `new-${rowSeed += 1}`;
|
|
10441
10548
|
function choiceRowsFrom(options, field2) {
|
|
@@ -10516,12 +10623,12 @@ function ChoiceListEditor({
|
|
|
10516
10623
|
};
|
|
10517
10624
|
}, [client, fieldId, onRehome]);
|
|
10518
10625
|
if (refused) {
|
|
10519
|
-
return /* @__PURE__ */
|
|
10626
|
+
return /* @__PURE__ */ jsxs37("p", { className: "text-[11px] text-muted-foreground", "data-records-choice-list": "", children: [
|
|
10520
10627
|
"The choices could not be read, so they are left as they are: ",
|
|
10521
10628
|
refused
|
|
10522
10629
|
] });
|
|
10523
10630
|
}
|
|
10524
|
-
if (rows === null) return /* @__PURE__ */
|
|
10631
|
+
if (rows === null) return /* @__PURE__ */ jsx41("p", { className: "text-[11px] text-muted-foreground", children: "Reading this column\u2019s choices\u2026" });
|
|
10525
10632
|
const set = (index, words) => onRows(rows.map((r, i) => i === index ? { ...r, words } : r));
|
|
10526
10633
|
const paint = (index, color) => onRows(rows.map((r, i) => i === index ? { ...r, color } : r));
|
|
10527
10634
|
const addRow = () => {
|
|
@@ -10579,12 +10686,12 @@ function ChoiceListEditor({
|
|
|
10579
10686
|
};
|
|
10580
10687
|
const targets = rows.filter((r) => r.id && r.id !== asking?.id && r.words.trim() !== "");
|
|
10581
10688
|
const wordsOf = (id) => rows.find((r) => r.id === id)?.words.trim() ?? usage?.[id]?.words ?? "";
|
|
10582
|
-
return /* @__PURE__ */
|
|
10583
|
-
/* @__PURE__ */
|
|
10584
|
-
rows.length === 0 ? /* @__PURE__ */
|
|
10585
|
-
/* @__PURE__ */
|
|
10586
|
-
/* @__PURE__ */
|
|
10587
|
-
/* @__PURE__ */
|
|
10689
|
+
return /* @__PURE__ */ jsxs37("div", { className: "flex flex-col gap-1", "data-records-choice-list": "", children: [
|
|
10690
|
+
/* @__PURE__ */ jsx41(Label11, { className: "text-xs", children: "The choices" }),
|
|
10691
|
+
rows.length === 0 ? /* @__PURE__ */ jsx41("p", { className: "text-xs text-muted-foreground", "data-records-choice-list-empty": "", children: "No choices yet." }) : null,
|
|
10692
|
+
/* @__PURE__ */ jsx41("ul", { className: "flex flex-col gap-1", children: rows.map((r, i) => /* @__PURE__ */ jsxs37("li", { className: "flex items-center gap-1", "data-records-choice-row": "", children: [
|
|
10693
|
+
/* @__PURE__ */ jsx41(ChoiceSwatch, { words: r.words.trim() === "" ? `choice ${i + 1}` : r.words.trim(), color: r.color ?? null, onColor: (c) => paint(i, c) }),
|
|
10694
|
+
/* @__PURE__ */ jsx41(
|
|
10588
10695
|
BasicInput11,
|
|
10589
10696
|
{
|
|
10590
10697
|
value: r.words,
|
|
@@ -10600,13 +10707,13 @@ function ChoiceListEditor({
|
|
|
10600
10707
|
onKeyDown: enterAdds(i)
|
|
10601
10708
|
}
|
|
10602
10709
|
),
|
|
10603
|
-
/* @__PURE__ */
|
|
10604
|
-
/* @__PURE__ */
|
|
10605
|
-
/* @__PURE__ */
|
|
10710
|
+
/* @__PURE__ */ jsx41(Button17, { type: "button", size: "sm", variant: "ghost", className: "h-7 px-1.5 text-xs", "aria-label": `Move ${named(r, i)} up`, disabled: i === 0, onClick: () => move(i, -1), children: "\u2191" }),
|
|
10711
|
+
/* @__PURE__ */ jsx41(Button17, { type: "button", size: "sm", variant: "ghost", className: "h-7 px-1.5 text-xs", "aria-label": `Move ${named(r, i)} down`, disabled: i === rows.length - 1, onClick: () => move(i, 1), children: "\u2193" }),
|
|
10712
|
+
/* @__PURE__ */ jsx41(Button17, { type: "button", size: "sm", variant: "ghost", className: "h-7 px-1.5 text-xs", "aria-label": `Remove ${named(r, i)}`, onClick: () => remove(i), children: "\xD7" })
|
|
10606
10713
|
] }, r.row)) }),
|
|
10607
10714
|
asking ? (
|
|
10608
10715
|
// THE QUESTION, Notion-style: where do the records that hold it go?
|
|
10609
|
-
/* @__PURE__ */
|
|
10716
|
+
/* @__PURE__ */ jsxs37(
|
|
10610
10717
|
"div",
|
|
10611
10718
|
{
|
|
10612
10719
|
role: "group",
|
|
@@ -10614,31 +10721,31 @@ function ChoiceListEditor({
|
|
|
10614
10721
|
"data-records-choice-removal-ask": "",
|
|
10615
10722
|
className: "flex flex-col gap-1 rounded border bg-muted/40 p-2",
|
|
10616
10723
|
children: [
|
|
10617
|
-
/* @__PURE__ */
|
|
10618
|
-
/* @__PURE__ */
|
|
10619
|
-
targets.length > 0 ? /* @__PURE__ */
|
|
10620
|
-
/* @__PURE__ */
|
|
10621
|
-
/* @__PURE__ */
|
|
10622
|
-
/* @__PURE__ */
|
|
10623
|
-
/* @__PURE__ */
|
|
10724
|
+
/* @__PURE__ */ jsx41("p", { className: "text-xs", children: recordsUseSentence(heldBy(asking), asking.words.trim()) }),
|
|
10725
|
+
/* @__PURE__ */ jsxs37("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
10726
|
+
targets.length > 0 ? /* @__PURE__ */ jsxs37(Fragment15, { children: [
|
|
10727
|
+
/* @__PURE__ */ jsx41(Button17, { type: "button", size: "sm", className: "h-7 px-2 text-xs", disabled: moveTo === "", onClick: () => answer({ then: "move", to: moveTo }), children: "Move them to" }),
|
|
10728
|
+
/* @__PURE__ */ jsxs37(Select7, { value: moveTo, onValueChange: setMoveTo, children: [
|
|
10729
|
+
/* @__PURE__ */ jsx41(SelectTrigger7, { size: "sm", className: "h-7 w-36 text-xs", "aria-label": "Another choice", children: /* @__PURE__ */ jsx41(SelectValue7, { placeholder: "Another choice" }) }),
|
|
10730
|
+
/* @__PURE__ */ jsx41(SelectContent7, { children: targets.map((r) => /* @__PURE__ */ jsx41(SelectItem7, { value: r.id, children: r.words.trim() }, r.id)) })
|
|
10624
10731
|
] })
|
|
10625
10732
|
] }) : null,
|
|
10626
|
-
allowOther ? /* @__PURE__ */
|
|
10627
|
-
/* @__PURE__ */
|
|
10628
|
-
/* @__PURE__ */
|
|
10733
|
+
allowOther ? /* @__PURE__ */ jsx41(Button17, { type: "button", size: "sm", variant: "outline", className: "h-7 px-2 text-xs", onClick: () => answer({ then: "keep" }), children: "Keep the words as other values" }) : null,
|
|
10734
|
+
/* @__PURE__ */ jsx41(Button17, { type: "button", size: "sm", variant: "outline", className: "h-7 px-2 text-xs", onClick: () => answer({ then: "clear" }), children: "Clear them" }),
|
|
10735
|
+
/* @__PURE__ */ jsx41(Button17, { type: "button", size: "sm", variant: "ghost", className: "h-7 px-2 text-xs", onClick: () => setAsking(null), children: "Cancel" })
|
|
10629
10736
|
] })
|
|
10630
10737
|
]
|
|
10631
10738
|
}
|
|
10632
10739
|
)
|
|
10633
10740
|
) : null,
|
|
10634
10741
|
Object.entries(rehome).map(
|
|
10635
|
-
([id, spec]) => removed[id] ? /* @__PURE__ */
|
|
10636
|
-
/* @__PURE__ */
|
|
10637
|
-
/* @__PURE__ */
|
|
10742
|
+
([id, spec]) => removed[id] ? /* @__PURE__ */ jsxs37("div", { className: "flex items-center justify-between gap-2 text-[11px] text-muted-foreground", "data-records-choice-rehome": "", children: [
|
|
10743
|
+
/* @__PURE__ */ jsx41("span", { children: rehomeSentence(usage?.[id]?.records ?? 0, removed[id].row.words.trim(), spec, spec.then === "move" ? wordsOf(spec.to) : void 0) }),
|
|
10744
|
+
/* @__PURE__ */ jsx41(Button17, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-1.5 text-[11px]", onClick: () => putBack(id), children: "Put it back" })
|
|
10638
10745
|
] }, id) : null
|
|
10639
10746
|
),
|
|
10640
|
-
/* @__PURE__ */
|
|
10641
|
-
isNew ? null : /* @__PURE__ */
|
|
10747
|
+
/* @__PURE__ */ jsx41(Button17, { type: "button", size: "sm", variant: "outline", className: "h-7 self-start text-xs", onClick: addRow, children: "Add a choice" }),
|
|
10748
|
+
isNew ? null : /* @__PURE__ */ jsx41("p", { className: "text-[11px] text-muted-foreground", children: "Changing a choice\u2019s words changes them in every record that holds it. Removing a choice that records hold asks where those records go." })
|
|
10642
10749
|
] });
|
|
10643
10750
|
}
|
|
10644
10751
|
function ChoiceSwatch({ words, color, onColor }) {
|
|
@@ -10647,8 +10754,8 @@ function ChoiceSwatch({ words, color, onColor }) {
|
|
|
10647
10754
|
onColor(next);
|
|
10648
10755
|
setOpen(false);
|
|
10649
10756
|
};
|
|
10650
|
-
return /* @__PURE__ */
|
|
10651
|
-
/* @__PURE__ */
|
|
10757
|
+
return /* @__PURE__ */ jsxs37(Popover7, { open, onOpenChange: setOpen, children: [
|
|
10758
|
+
/* @__PURE__ */ jsx41(PopoverTrigger7, { asChild: true, children: /* @__PURE__ */ jsx41(
|
|
10652
10759
|
"button",
|
|
10653
10760
|
{
|
|
10654
10761
|
type: "button",
|
|
@@ -10661,8 +10768,8 @@ function ChoiceSwatch({ words, color, onColor }) {
|
|
|
10661
10768
|
)
|
|
10662
10769
|
}
|
|
10663
10770
|
) }),
|
|
10664
|
-
/* @__PURE__ */
|
|
10665
|
-
/* @__PURE__ */
|
|
10771
|
+
/* @__PURE__ */ jsx41(PopoverContent7, { sizing: "content", align: "start", className: "p-2", children: /* @__PURE__ */ jsxs37("div", { className: "flex items-center gap-1", role: "radiogroup", "aria-label": `Colour for ${words}`, children: [
|
|
10772
|
+
/* @__PURE__ */ jsx41(
|
|
10666
10773
|
"button",
|
|
10667
10774
|
{
|
|
10668
10775
|
type: "button",
|
|
@@ -10674,7 +10781,7 @@ function ChoiceSwatch({ words, color, onColor }) {
|
|
|
10674
10781
|
className: cn21("h-5 w-5 rounded-full border border-border bg-background", color === null && "ring-2 ring-ring ring-offset-1")
|
|
10675
10782
|
}
|
|
10676
10783
|
),
|
|
10677
|
-
STYLE_COLORS2.map((c) => /* @__PURE__ */
|
|
10784
|
+
STYLE_COLORS2.map((c) => /* @__PURE__ */ jsx41(
|
|
10678
10785
|
"button",
|
|
10679
10786
|
{
|
|
10680
10787
|
type: "button",
|
|
@@ -10772,7 +10879,7 @@ function PersonNamesBridge() {
|
|
|
10772
10879
|
}
|
|
10773
10880
|
|
|
10774
10881
|
// src/RecordsMount.tsx
|
|
10775
|
-
import { jsx as
|
|
10882
|
+
import { jsx as jsx42, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
10776
10883
|
var STORE_DECIDES_REASON = "This host offers exactly what the record store says this person may do: the level comes back with the table on the read door, so a control they cannot use is never drawn in the first place.";
|
|
10777
10884
|
function storeDecidesRights(_table) {
|
|
10778
10885
|
return NO_RIGHTS;
|
|
@@ -10785,8 +10892,8 @@ function RecordsMount({
|
|
|
10785
10892
|
}) {
|
|
10786
10893
|
const bound2 = useShallowStableHost(host);
|
|
10787
10894
|
void letTheStoreDecideRights;
|
|
10788
|
-
return /* @__PURE__ */
|
|
10789
|
-
/* @__PURE__ */
|
|
10895
|
+
return /* @__PURE__ */ jsx42(RecordsProvider, { config, children: /* @__PURE__ */ jsx42(RecordsUiProvider, { value: bound2, children: /* @__PURE__ */ jsxs38(RecordLabelProvider, { children: [
|
|
10896
|
+
/* @__PURE__ */ jsx42(PersonNamesBridge, {}),
|
|
10790
10897
|
children
|
|
10791
10898
|
] }) }) });
|
|
10792
10899
|
}
|
|
@@ -10811,7 +10918,7 @@ function sameParts(a, b) {
|
|
|
10811
10918
|
import { useEffect as useEffect22, useMemo as useMemo11, useState as useState31 } from "react";
|
|
10812
10919
|
import { RecordsProvider as RecordsProvider2, useFields as useFields4, useRecords as useRecords3, useTable as useTable3 } from "@ai-matrx/records/react";
|
|
10813
10920
|
import { Button as Button18, CreatablePicker } from "@ai-matrx/design-system";
|
|
10814
|
-
import { Fragment as
|
|
10921
|
+
import { Fragment as Fragment16, jsx as jsx43, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
10815
10922
|
var SHARED_FOR_MS = 5e3;
|
|
10816
10923
|
var sharedReads = /* @__PURE__ */ new WeakMap();
|
|
10817
10924
|
function readTablesAnywhere(dataSource) {
|
|
@@ -10881,16 +10988,16 @@ function TablePicker({ dataSource, value, onChange, disabled, tables }) {
|
|
|
10881
10988
|
hint: t.organization_name,
|
|
10882
10989
|
keywords: t.organization_name,
|
|
10883
10990
|
...twin && second ? {
|
|
10884
|
-
render: /* @__PURE__ */
|
|
10885
|
-
/* @__PURE__ */
|
|
10886
|
-
/* @__PURE__ */
|
|
10991
|
+
render: /* @__PURE__ */ jsxs39("span", { className: "flex min-w-0 flex-col", children: [
|
|
10992
|
+
/* @__PURE__ */ jsx43("span", { className: "truncate", children: t.table_name }),
|
|
10993
|
+
/* @__PURE__ */ jsx43("span", { className: "truncate text-[11px] text-muted-foreground", children: second })
|
|
10887
10994
|
] })
|
|
10888
10995
|
} : {}
|
|
10889
10996
|
};
|
|
10890
10997
|
});
|
|
10891
10998
|
const missing = Boolean(value) && !list.loading && !list.error && !list.rows.some((t) => t.table_id === value);
|
|
10892
|
-
return /* @__PURE__ */
|
|
10893
|
-
/* @__PURE__ */
|
|
10999
|
+
return /* @__PURE__ */ jsxs39("div", { className: "flex flex-col gap-1", children: [
|
|
11000
|
+
/* @__PURE__ */ jsx43(
|
|
10894
11001
|
CreatablePicker,
|
|
10895
11002
|
{
|
|
10896
11003
|
value: value || null,
|
|
@@ -10904,17 +11011,17 @@ function TablePicker({ dataSource, value, onChange, disabled, tables }) {
|
|
|
10904
11011
|
ariaLabel: "Table"
|
|
10905
11012
|
}
|
|
10906
11013
|
),
|
|
10907
|
-
list.error && /* @__PURE__ */
|
|
10908
|
-
missing && /* @__PURE__ */
|
|
11014
|
+
list.error && /* @__PURE__ */ jsx43(RefusalLine, { error: (0, refusals_exports.refusal)("door", list.error, "Try again in a moment.") }),
|
|
11015
|
+
missing && /* @__PURE__ */ jsx43("p", { className: "text-[11px] text-destructive", children: "This table is archived or not shared with you." })
|
|
10909
11016
|
] });
|
|
10910
11017
|
}
|
|
10911
11018
|
function TableScope({ dataSource, userId, tableId, children, fallback = null, unavailable, tables }) {
|
|
10912
11019
|
const own3 = useTablesAnywhere(dataSource);
|
|
10913
11020
|
const list = tables ?? own3;
|
|
10914
11021
|
const organizationId = list.rows.find((t) => t.table_id === tableId)?.organization_id ?? null;
|
|
10915
|
-
if (tableId && !organizationId && !list.loading) return /* @__PURE__ */
|
|
10916
|
-
if (!tableId || !organizationId) return /* @__PURE__ */
|
|
10917
|
-
return /* @__PURE__ */
|
|
11022
|
+
if (tableId && !organizationId && !list.loading) return /* @__PURE__ */ jsx43(Fragment16, { children: unavailable ?? fallback });
|
|
11023
|
+
if (!tableId || !organizationId) return /* @__PURE__ */ jsx43(Fragment16, { children: fallback });
|
|
11024
|
+
return /* @__PURE__ */ jsx43(RecordsProvider2, { config: { dataSource, actor: personActor(userId), organizationId }, children });
|
|
10918
11025
|
}
|
|
10919
11026
|
function ColumnValuesEditor({ tableId, value, onChange, disabled, addLabel }) {
|
|
10920
11027
|
const fields = useFields4(tableId);
|
|
@@ -10934,11 +11041,11 @@ function ColumnValuesEditor({ tableId, value, onChange, disabled, addLabel }) {
|
|
|
10934
11041
|
void _gone;
|
|
10935
11042
|
onChange(rest);
|
|
10936
11043
|
};
|
|
10937
|
-
return /* @__PURE__ */
|
|
10938
|
-
fields.error && /* @__PURE__ */
|
|
11044
|
+
return /* @__PURE__ */ jsxs39("div", { className: "flex flex-col gap-2", children: [
|
|
11045
|
+
fields.error && /* @__PURE__ */ jsx43(RefusalLine, { error: fields.error }),
|
|
10939
11046
|
keys.map((key) => {
|
|
10940
11047
|
const field2 = byKey.get(key);
|
|
10941
|
-
return /* @__PURE__ */
|
|
11048
|
+
return /* @__PURE__ */ jsx43(
|
|
10942
11049
|
ColumnValueRow,
|
|
10943
11050
|
{
|
|
10944
11051
|
columnKey: key,
|
|
@@ -10954,7 +11061,7 @@ function ColumnValuesEditor({ tableId, value, onChange, disabled, addLabel }) {
|
|
|
10954
11061
|
key
|
|
10955
11062
|
);
|
|
10956
11063
|
}),
|
|
10957
|
-
adding && /* @__PURE__ */
|
|
11064
|
+
adding && /* @__PURE__ */ jsx43(
|
|
10958
11065
|
ColumnValueRow,
|
|
10959
11066
|
{
|
|
10960
11067
|
columnKey: null,
|
|
@@ -10971,7 +11078,7 @@ function ColumnValuesEditor({ tableId, value, onChange, disabled, addLabel }) {
|
|
|
10971
11078
|
onRemove: () => setAdding(false)
|
|
10972
11079
|
}
|
|
10973
11080
|
),
|
|
10974
|
-
!disabled && !adding && keys.length < all.length && /* @__PURE__ */
|
|
11081
|
+
!disabled && !adding && keys.length < all.length && /* @__PURE__ */ jsx43(Button18, { type: "button", variant: "outline", size: "sm", className: "self-start", onClick: () => setAdding(true), children: addLabel })
|
|
10975
11082
|
] });
|
|
10976
11083
|
}
|
|
10977
11084
|
function ColumnValueRow({
|
|
@@ -10987,9 +11094,9 @@ function ColumnValueRow({
|
|
|
10987
11094
|
}) {
|
|
10988
11095
|
const orphan = columnKey !== null && !loading && field2 === void 0;
|
|
10989
11096
|
const shown2 = orphan ? [{ value: columnKey, label: columnKey, hint: "Not a column" }, ...options] : options;
|
|
10990
|
-
return /* @__PURE__ */
|
|
10991
|
-
/* @__PURE__ */
|
|
10992
|
-
/* @__PURE__ */
|
|
11097
|
+
return /* @__PURE__ */ jsxs39("div", { className: "flex flex-col gap-1 rounded-md border border-border/60 p-2", children: [
|
|
11098
|
+
/* @__PURE__ */ jsxs39("div", { className: "flex items-center gap-2", children: [
|
|
11099
|
+
/* @__PURE__ */ jsx43("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsx43(
|
|
10993
11100
|
CreatablePicker,
|
|
10994
11101
|
{
|
|
10995
11102
|
value: columnKey,
|
|
@@ -11003,9 +11110,9 @@ function ColumnValueRow({
|
|
|
11003
11110
|
ariaLabel: "Column"
|
|
11004
11111
|
}
|
|
11005
11112
|
) }),
|
|
11006
|
-
!disabled && /* @__PURE__ */
|
|
11113
|
+
!disabled && /* @__PURE__ */ jsx43(Button18, { type: "button", variant: "ghost", size: "sm", "aria-label": "Remove", onClick: onRemove, children: "\u2715" })
|
|
11007
11114
|
] }),
|
|
11008
|
-
field2 ? /* @__PURE__ */
|
|
11115
|
+
field2 ? /* @__PURE__ */ jsx43(FieldControl, { field: field2, value, onChange: onValue, disabled }) : orphan ? /* @__PURE__ */ jsx43("p", { className: "text-[11px] text-muted-foreground", children: value === null || value === void 0 ? "\u2014" : String(value) }) : null
|
|
11009
11116
|
] });
|
|
11010
11117
|
}
|
|
11011
11118
|
function RecordPicker({ tableId, value, onChange, disabled }) {
|
|
@@ -11017,8 +11124,8 @@ function RecordPicker({ tableId, value, onChange, disabled }) {
|
|
|
11017
11124
|
label: rowNameIn(table.data ?? null, row)
|
|
11018
11125
|
}));
|
|
11019
11126
|
const missing = Boolean(value) && !records.loading && !records.error && !rows.some((r) => r.id === value);
|
|
11020
|
-
return /* @__PURE__ */
|
|
11021
|
-
/* @__PURE__ */
|
|
11127
|
+
return /* @__PURE__ */ jsxs39("div", { className: "flex flex-col gap-1", children: [
|
|
11128
|
+
/* @__PURE__ */ jsx43(
|
|
11022
11129
|
CreatablePicker,
|
|
11023
11130
|
{
|
|
11024
11131
|
value: value || null,
|
|
@@ -11032,7 +11139,7 @@ function RecordPicker({ tableId, value, onChange, disabled }) {
|
|
|
11032
11139
|
ariaLabel: "Record"
|
|
11033
11140
|
}
|
|
11034
11141
|
),
|
|
11035
|
-
records.error && /* @__PURE__ */
|
|
11142
|
+
records.error && /* @__PURE__ */ jsx43(RefusalLine, { error: records.error })
|
|
11036
11143
|
] });
|
|
11037
11144
|
}
|
|
11038
11145
|
|
|
@@ -11041,7 +11148,7 @@ import { useEffect as useEffect23, useMemo as useMemo12 } from "react";
|
|
|
11041
11148
|
import { isEntityReferenceConfig } from "@ai-matrx/records";
|
|
11042
11149
|
import { useFields as useFields5, useTable as useTable4 } from "@ai-matrx/records/react";
|
|
11043
11150
|
import { BasicInput as BasicInput12, Button as Button19, CreatablePicker as CreatablePicker2, cn as cn22 } from "@ai-matrx/design-system";
|
|
11044
|
-
import { jsx as
|
|
11151
|
+
import { jsx as jsx44, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
11045
11152
|
var DATA_BINDING_SHAPES = [
|
|
11046
11153
|
{ value: "collection", label: "The whole table" },
|
|
11047
11154
|
{ value: "reference", label: "One record" },
|
|
@@ -11108,9 +11215,9 @@ function DataBindingPicker({ dataSource, userId, binding, onChange, disabled, de
|
|
|
11108
11215
|
...binding.semantic_type === "collection" && defaultRowLimit ? { limit: defaultRowLimit } : {}
|
|
11109
11216
|
});
|
|
11110
11217
|
};
|
|
11111
|
-
return /* @__PURE__ */
|
|
11112
|
-
/* @__PURE__ */
|
|
11113
|
-
/* @__PURE__ */
|
|
11218
|
+
return /* @__PURE__ */ jsxs40("div", { className: "flex flex-col gap-2", children: [
|
|
11219
|
+
/* @__PURE__ */ jsx44(TablePicker, { dataSource, value: tableId, onChange: selectTable, disabled: Boolean(disabled), tables }),
|
|
11220
|
+
/* @__PURE__ */ jsx44(TableScope, { dataSource, userId, tableId, tables, children: tableId && /* @__PURE__ */ jsx44(
|
|
11114
11221
|
BindingDetails,
|
|
11115
11222
|
{
|
|
11116
11223
|
tableId,
|
|
@@ -11174,8 +11281,8 @@ function BindingDetails({
|
|
|
11174
11281
|
const fieldOptions = fieldList.map((f) => ({ value: f.key, label: fieldName(f) }));
|
|
11175
11282
|
const template = binding.transform?.template ?? "";
|
|
11176
11283
|
const setTemplate = (next) => onChange({ ...binding, transform: { join: "\n", ...binding.transform, name: "list", template: next } });
|
|
11177
|
-
return /* @__PURE__ */
|
|
11178
|
-
/* @__PURE__ */
|
|
11284
|
+
return /* @__PURE__ */ jsxs40("div", { className: "flex flex-col gap-2", children: [
|
|
11285
|
+
/* @__PURE__ */ jsx44("div", { className: "flex flex-wrap gap-1", role: "radiogroup", "aria-label": "What to read", children: DATA_BINDING_SHAPES.map((s) => /* @__PURE__ */ jsx44(
|
|
11179
11286
|
Button19,
|
|
11180
11287
|
{
|
|
11181
11288
|
type: "button",
|
|
@@ -11189,7 +11296,7 @@ function BindingDetails({
|
|
|
11189
11296
|
},
|
|
11190
11297
|
s.value
|
|
11191
11298
|
)) }),
|
|
11192
|
-
shape !== "collection" && /* @__PURE__ */
|
|
11299
|
+
shape !== "collection" && /* @__PURE__ */ jsx44(
|
|
11193
11300
|
RecordPicker,
|
|
11194
11301
|
{
|
|
11195
11302
|
tableId,
|
|
@@ -11198,7 +11305,7 @@ function BindingDetails({
|
|
|
11198
11305
|
disabled: Boolean(disabled)
|
|
11199
11306
|
}
|
|
11200
11307
|
),
|
|
11201
|
-
shape === "value" && /* @__PURE__ */
|
|
11308
|
+
shape === "value" && /* @__PURE__ */ jsx44(
|
|
11202
11309
|
CreatablePicker2,
|
|
11203
11310
|
{
|
|
11204
11311
|
value: binding.field_key ?? null,
|
|
@@ -11212,8 +11319,8 @@ function BindingDetails({
|
|
|
11212
11319
|
ariaLabel: "Column"
|
|
11213
11320
|
}
|
|
11214
11321
|
),
|
|
11215
|
-
shape !== "value" && /* @__PURE__ */
|
|
11216
|
-
/* @__PURE__ */
|
|
11322
|
+
shape !== "value" && /* @__PURE__ */ jsxs40("div", { className: "flex flex-col gap-1", children: [
|
|
11323
|
+
/* @__PURE__ */ jsx44(
|
|
11217
11324
|
"textarea",
|
|
11218
11325
|
{
|
|
11219
11326
|
className: cn22(
|
|
@@ -11225,7 +11332,7 @@ function BindingDetails({
|
|
|
11225
11332
|
onChange: (e) => setTemplate(e.target.value)
|
|
11226
11333
|
}
|
|
11227
11334
|
),
|
|
11228
|
-
!disabled && /* @__PURE__ */
|
|
11335
|
+
!disabled && /* @__PURE__ */ jsx44("div", { className: "flex flex-wrap gap-1", children: fieldList.flatMap(bindingPlaceholdersFor).map((p) => /* @__PURE__ */ jsx44(
|
|
11229
11336
|
Button19,
|
|
11230
11337
|
{
|
|
11231
11338
|
type: "button",
|
|
@@ -11238,9 +11345,9 @@ function BindingDetails({
|
|
|
11238
11345
|
p.token
|
|
11239
11346
|
)) })
|
|
11240
11347
|
] }),
|
|
11241
|
-
shape === "collection" && /* @__PURE__ */
|
|
11348
|
+
shape === "collection" && /* @__PURE__ */ jsxs40("label", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
|
|
11242
11349
|
"Up to",
|
|
11243
|
-
/* @__PURE__ */
|
|
11350
|
+
/* @__PURE__ */ jsx44(
|
|
11244
11351
|
BasicInput12,
|
|
11245
11352
|
{
|
|
11246
11353
|
type: "number",
|
|
@@ -11257,9 +11364,9 @@ function BindingDetails({
|
|
|
11257
11364
|
),
|
|
11258
11365
|
"rows"
|
|
11259
11366
|
] }),
|
|
11260
|
-
/* @__PURE__ */
|
|
11261
|
-
/* @__PURE__ */
|
|
11262
|
-
DATA_BINDING_MISSING.map((m) => /* @__PURE__ */
|
|
11367
|
+
/* @__PURE__ */ jsxs40("div", { className: "flex flex-wrap items-center gap-1", role: "radiogroup", "aria-label": "If nothing is found", children: [
|
|
11368
|
+
/* @__PURE__ */ jsx44("span", { className: "text-xs text-muted-foreground", children: "If nothing is found" }),
|
|
11369
|
+
DATA_BINDING_MISSING.map((m) => /* @__PURE__ */ jsx44(
|
|
11263
11370
|
Button19,
|
|
11264
11371
|
{
|
|
11265
11372
|
type: "button",
|
|
@@ -11279,13 +11386,13 @@ function BindingDetails({
|
|
|
11279
11386
|
|
|
11280
11387
|
// src/PickedSummaries.tsx
|
|
11281
11388
|
import { useFields as useFields6, useRecord, useTable as useTable5 } from "@ai-matrx/records/react";
|
|
11282
|
-
import { Fragment as
|
|
11389
|
+
import { Fragment as Fragment17, jsx as jsx45, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
11283
11390
|
function TableNameText({ dataSource, tableId }) {
|
|
11284
11391
|
const tables = useTablesAnywhere(dataSource);
|
|
11285
|
-
if (!tableId) return /* @__PURE__ */
|
|
11286
|
-
if (tables.loading) return /* @__PURE__ */
|
|
11287
|
-
if (tables.error) return /* @__PURE__ */
|
|
11288
|
-
return /* @__PURE__ */
|
|
11392
|
+
if (!tableId) return /* @__PURE__ */ jsx45(Fragment17, { children: "\u2014" });
|
|
11393
|
+
if (tables.loading) return /* @__PURE__ */ jsx45(Fragment17, { children: "\u2026" });
|
|
11394
|
+
if (tables.error) return /* @__PURE__ */ jsx45(Fragment17, { children: "Couldn't load the table's name" });
|
|
11395
|
+
return /* @__PURE__ */ jsx45(Fragment17, { children: tables.rows.find((t) => t.table_id === tableId)?.table_name ?? "\u2014" });
|
|
11289
11396
|
}
|
|
11290
11397
|
function ColumnValuesText({
|
|
11291
11398
|
dataSource,
|
|
@@ -11293,38 +11400,38 @@ function ColumnValuesText({
|
|
|
11293
11400
|
tableId,
|
|
11294
11401
|
value
|
|
11295
11402
|
}) {
|
|
11296
|
-
if (!tableId) return /* @__PURE__ */
|
|
11297
|
-
return /* @__PURE__ */
|
|
11403
|
+
if (!tableId) return /* @__PURE__ */ jsx45(Fragment17, { children: "\u2014" });
|
|
11404
|
+
return /* @__PURE__ */ jsx45(
|
|
11298
11405
|
TableScope,
|
|
11299
11406
|
{
|
|
11300
11407
|
dataSource,
|
|
11301
11408
|
userId,
|
|
11302
11409
|
tableId,
|
|
11303
|
-
fallback: /* @__PURE__ */
|
|
11304
|
-
unavailable: /* @__PURE__ */
|
|
11305
|
-
children: /* @__PURE__ */
|
|
11410
|
+
fallback: /* @__PURE__ */ jsx45(Fragment17, { children: "\u2026" }),
|
|
11411
|
+
unavailable: /* @__PURE__ */ jsx45(Fragment17, { children: "Couldn't load this table's columns" }),
|
|
11412
|
+
children: /* @__PURE__ */ jsx45(RecordLabelProvider, { children: /* @__PURE__ */ jsx45(ColumnValuesWords, { tableId, value }) })
|
|
11306
11413
|
}
|
|
11307
11414
|
);
|
|
11308
11415
|
}
|
|
11309
11416
|
function ColumnValuesWords({ tableId, value }) {
|
|
11310
11417
|
const fields = useFields6(tableId);
|
|
11311
11418
|
const labels = useRecordLabels(fields.data ?? void 0);
|
|
11312
|
-
if (fields.loading) return /* @__PURE__ */
|
|
11313
|
-
if (fields.error) return /* @__PURE__ */
|
|
11419
|
+
if (fields.loading) return /* @__PURE__ */ jsx45(Fragment17, { children: "\u2026" });
|
|
11420
|
+
if (fields.error) return /* @__PURE__ */ jsx45(Fragment17, { children: "Couldn't load this table's columns" });
|
|
11314
11421
|
const parts = [];
|
|
11315
11422
|
for (const [key, stored] of Object.entries(value)) {
|
|
11316
11423
|
if (key.startsWith("_")) continue;
|
|
11317
11424
|
const field2 = (fields.data ?? []).find((f) => f.key === key);
|
|
11318
|
-
if (parts.length) parts.push(/* @__PURE__ */
|
|
11425
|
+
if (parts.length) parts.push(/* @__PURE__ */ jsx45("span", { children: ", " }, `${key}-sep`));
|
|
11319
11426
|
parts.push(
|
|
11320
|
-
/* @__PURE__ */
|
|
11427
|
+
/* @__PURE__ */ jsxs41("span", { children: [
|
|
11321
11428
|
field2 ? fieldName(field2) : "A removed column",
|
|
11322
11429
|
" is ",
|
|
11323
11430
|
field2 ? renderValue(field2, stored, void 0, labels) : "\u2014"
|
|
11324
11431
|
] }, key)
|
|
11325
11432
|
);
|
|
11326
11433
|
}
|
|
11327
|
-
return parts.length ? /* @__PURE__ */
|
|
11434
|
+
return parts.length ? /* @__PURE__ */ jsx45(Fragment17, { children: parts }) : /* @__PURE__ */ jsx45(Fragment17, { children: "\u2014" });
|
|
11328
11435
|
}
|
|
11329
11436
|
function RecordNameText({
|
|
11330
11437
|
dataSource,
|
|
@@ -11332,35 +11439,35 @@ function RecordNameText({
|
|
|
11332
11439
|
tableId,
|
|
11333
11440
|
recordId
|
|
11334
11441
|
}) {
|
|
11335
|
-
if (!tableId || !recordId) return /* @__PURE__ */
|
|
11336
|
-
return /* @__PURE__ */
|
|
11442
|
+
if (!tableId || !recordId) return /* @__PURE__ */ jsx45(Fragment17, { children: "\u2014" });
|
|
11443
|
+
return /* @__PURE__ */ jsx45(
|
|
11337
11444
|
TableScope,
|
|
11338
11445
|
{
|
|
11339
11446
|
dataSource,
|
|
11340
11447
|
userId,
|
|
11341
11448
|
tableId,
|
|
11342
|
-
fallback: /* @__PURE__ */
|
|
11343
|
-
unavailable: /* @__PURE__ */
|
|
11344
|
-
children: /* @__PURE__ */
|
|
11449
|
+
fallback: /* @__PURE__ */ jsx45(Fragment17, { children: "\u2026" }),
|
|
11450
|
+
unavailable: /* @__PURE__ */ jsx45(Fragment17, { children: "Couldn't load this record" }),
|
|
11451
|
+
children: /* @__PURE__ */ jsx45(RecordNameWords, { tableId, recordId })
|
|
11345
11452
|
}
|
|
11346
11453
|
);
|
|
11347
11454
|
}
|
|
11348
11455
|
function RecordNameWords({ tableId, recordId }) {
|
|
11349
11456
|
const table = useTable5(tableId);
|
|
11350
11457
|
const record = useRecord(recordId);
|
|
11351
|
-
if (record.loading || table.loading) return /* @__PURE__ */
|
|
11352
|
-
if (record.error) return /* @__PURE__ */
|
|
11353
|
-
if (!record.data) return /* @__PURE__ */
|
|
11354
|
-
return /* @__PURE__ */
|
|
11458
|
+
if (record.loading || table.loading) return /* @__PURE__ */ jsx45(Fragment17, { children: "\u2026" });
|
|
11459
|
+
if (record.error) return /* @__PURE__ */ jsx45(Fragment17, { children: "Couldn't load this record" });
|
|
11460
|
+
if (!record.data) return /* @__PURE__ */ jsx45(Fragment17, { children: "A record you cannot open" });
|
|
11461
|
+
return /* @__PURE__ */ jsx45(Fragment17, { children: recordName(record.data.document, table.data?.title_field ?? null) });
|
|
11355
11462
|
}
|
|
11356
11463
|
|
|
11357
11464
|
// src/HeldChangeDecision.tsx
|
|
11358
11465
|
import { useEffect as useEffect24, useState as useState32 } from "react";
|
|
11359
11466
|
import { RecordsProvider as RecordsProvider3, useRecordsClient as useRecordsClient10 } from "@ai-matrx/records/react";
|
|
11360
11467
|
import { Button as Button20 } from "@ai-matrx/design-system";
|
|
11361
|
-
import { jsx as
|
|
11468
|
+
import { jsx as jsx46, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
11362
11469
|
function HeldChangeDecision({ dataSource, userId, organizationId, approvalId, onDecided, approveLabel }) {
|
|
11363
|
-
return /* @__PURE__ */
|
|
11470
|
+
return /* @__PURE__ */ jsx46(RecordsProvider3, { config: { dataSource, actor: personActor(userId), organizationId }, children: /* @__PURE__ */ jsx46(Decision, { approvalId, onDecided, approveLabel: approveLabel ?? "Approve" }) });
|
|
11364
11471
|
}
|
|
11365
11472
|
function Decision({
|
|
11366
11473
|
approvalId,
|
|
@@ -11393,13 +11500,13 @@ function Decision({
|
|
|
11393
11500
|
if (res.ok) onDecided(approve);
|
|
11394
11501
|
else setError(res.error);
|
|
11395
11502
|
};
|
|
11396
|
-
if (may === null) return /* @__PURE__ */
|
|
11397
|
-
return /* @__PURE__ */
|
|
11398
|
-
may ? /* @__PURE__ */
|
|
11399
|
-
/* @__PURE__ */
|
|
11400
|
-
/* @__PURE__ */
|
|
11401
|
-
] }) : !error && /* @__PURE__ */
|
|
11402
|
-
error ? /* @__PURE__ */
|
|
11503
|
+
if (may === null) return /* @__PURE__ */ jsx46("p", { className: "text-xs text-muted-foreground", children: "Checking who can decide\u2026" });
|
|
11504
|
+
return /* @__PURE__ */ jsxs42("div", { className: "flex flex-col gap-1.5", children: [
|
|
11505
|
+
may ? /* @__PURE__ */ jsxs42("div", { className: "flex gap-2", children: [
|
|
11506
|
+
/* @__PURE__ */ jsx46(Button20, { type: "button", size: "sm", disabled: busy !== null, onClick: () => void decide(true), children: busy === "approve" ? "Approving\u2026" : approveLabel }),
|
|
11507
|
+
/* @__PURE__ */ jsx46(Button20, { type: "button", size: "sm", variant: "outline", disabled: busy !== null, onClick: () => void decide(false), children: busy === "refuse" ? "Refusing\u2026" : "Refuse" })
|
|
11508
|
+
] }) : !error && /* @__PURE__ */ jsx46("p", { className: "text-xs text-muted-foreground", children: "An owner or admin of this organization decides this." }),
|
|
11509
|
+
error ? /* @__PURE__ */ jsx46(RefusalLine, { error }) : null
|
|
11403
11510
|
] });
|
|
11404
11511
|
}
|
|
11405
11512
|
|
|
@@ -11483,6 +11590,9 @@ export {
|
|
|
11483
11590
|
ChoiceListEditor,
|
|
11484
11591
|
SafeMarkdown,
|
|
11485
11592
|
RelationPicker,
|
|
11593
|
+
TitleCellOpensContext,
|
|
11594
|
+
OpenRecordHereContext,
|
|
11595
|
+
withOpenRecord,
|
|
11486
11596
|
ENTITY_REFERENCE_KINDS_MISSING,
|
|
11487
11597
|
entityReferenceSpec,
|
|
11488
11598
|
whatIsMissingForEntityReference,
|
|
@@ -11574,4 +11684,4 @@ export {
|
|
|
11574
11684
|
RecordNameText,
|
|
11575
11685
|
HeldChangeDecision
|
|
11576
11686
|
};
|
|
11577
|
-
//# sourceMappingURL=chunk-
|
|
11687
|
+
//# sourceMappingURL=chunk-HL7ZIVVJ.js.map
|