@ai-matrx/records-ui 0.115.99 → 0.115.100
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 +18 -1
- package/dist/index.cjs +3105 -3079
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +936 -910
- package/dist/index.js.map +1 -1
- package/dist/pickers.cjs +29 -0
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +29 -0
- package/dist/pickers.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -10284,7 +10284,7 @@ function ReferenceBuilder({
|
|
|
10284
10284
|
}
|
|
10285
10285
|
|
|
10286
10286
|
// src/gridEditing.tsx
|
|
10287
|
-
import { useCallback as useCallback15, useEffect as useEffect35, useMemo as useMemo20, useRef as useRef26, useState as useState46 } from "react";
|
|
10287
|
+
import { useCallback as useCallback15, useContext as useContext7, useEffect as useEffect35, useMemo as useMemo20, useRef as useRef26, useState as useState46 } from "react";
|
|
10288
10288
|
import { isButtonField as isButtonField4 } from "@ai-matrx/records";
|
|
10289
10289
|
import { asWriteConflict, wholeValueOf as wholeValueOf2 } from "@ai-matrx/records/core";
|
|
10290
10290
|
import { useRecordsClient as useRecordsClient21 } from "@ai-matrx/records/react";
|
|
@@ -13993,6 +13993,9 @@ function renderValue(field2, value, document2, labels, stillWaitingFor, look, ro
|
|
|
13993
13993
|
if (Array.isArray(value)) {
|
|
13994
13994
|
return /* @__PURE__ */ jsx44("span", { className: "flex flex-wrap gap-1", children: value.map((item, i) => /* @__PURE__ */ jsx44(Badge8, { variant: "secondary", className: "text-[11px]", children: scalarText(field2, item, labels) }, `${String(item)}-${i}`)) });
|
|
13995
13995
|
}
|
|
13996
|
+
if ((kind2 === "text" || kind2 === "url") && typeof value === "string" && isImageUrl2(value)) {
|
|
13997
|
+
return /* @__PURE__ */ jsx44(ImageUrlValue, { url: value.trim(), alt: field2.label || field2.key, room });
|
|
13998
|
+
}
|
|
13996
13999
|
if (kind2 === "url" && typeof value === "string") {
|
|
13997
14000
|
const href = value.includes("://") ? value : `https://${value}`;
|
|
13998
14001
|
return /* @__PURE__ */ jsx44(LinkPreviewCard, { url: href, children: /* @__PURE__ */ jsxs39(
|
|
@@ -14031,6 +14034,32 @@ function renderValue(field2, value, document2, labels, stillWaitingFor, look, ro
|
|
|
14031
14034
|
}
|
|
14032
14035
|
return /* @__PURE__ */ jsx44("span", { className: cn29("truncate", kind2 === "number" || kind2 === "currency" || kind2 === "percent" ? "tabular-nums" : ""), children: scalarText(field2, value, labels, stillWaitingFor) });
|
|
14033
14036
|
}
|
|
14037
|
+
function isImageUrl2(value) {
|
|
14038
|
+
const text = value.trim();
|
|
14039
|
+
if (!/^https?:\/\/[^\s]+$/i.test(text)) return false;
|
|
14040
|
+
let url;
|
|
14041
|
+
try {
|
|
14042
|
+
url = new URL(text);
|
|
14043
|
+
} catch {
|
|
14044
|
+
return false;
|
|
14045
|
+
}
|
|
14046
|
+
return /\.(png|jpe?g|gif|webp|avif|svg|bmp|ico)$/i.test(url.pathname) || /\/(images?|img)\//i.test(url.pathname);
|
|
14047
|
+
}
|
|
14048
|
+
function ImageUrlValue({ url, alt, room }) {
|
|
14049
|
+
const host = useRecordsUi();
|
|
14050
|
+
const box = room === "full" ? "size-24" : "size-6";
|
|
14051
|
+
return /* @__PURE__ */ jsx44(
|
|
14052
|
+
OutboundLink6,
|
|
14053
|
+
{
|
|
14054
|
+
className: cn29("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"),
|
|
14055
|
+
href: url,
|
|
14056
|
+
title: url,
|
|
14057
|
+
"data-records-image-url": "",
|
|
14058
|
+
onClick: (event) => event.stopPropagation(),
|
|
14059
|
+
children: host.fileImage ? host.fileImage({ fileId: url, alt }) : /* @__PURE__ */ jsx44("span", { className: "truncate", children: linkChipText(url) })
|
|
14060
|
+
}
|
|
14061
|
+
);
|
|
14062
|
+
}
|
|
14034
14063
|
function LivePersonChip({ id, name }) {
|
|
14035
14064
|
const open = useRecordsUi().openPerson;
|
|
14036
14065
|
return /* @__PURE__ */ jsx44(PersonChip, { name, ...open ? { onOpen: () => void openStoredPerson(id, open) } : {} });
|
|
@@ -18579,6 +18608,104 @@ function useWhoChanged(fieldKey, recordId) {
|
|
|
18579
18608
|
init_names();
|
|
18580
18609
|
init_host();
|
|
18581
18610
|
|
|
18611
|
+
// src/gridOpen.tsx
|
|
18612
|
+
import { createContext as createContext7 } from "react";
|
|
18613
|
+
import { openOutbound as openOutbound2 } from "@ai-matrx/kit/outbound";
|
|
18614
|
+
import { Fragment as Fragment21, jsx as jsx59, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
18615
|
+
var TITLE_OWN_CONTROLS = 'input, textarea, select, button, a[href], [role="combobox"], [contenteditable="true"], [contenteditable=""]';
|
|
18616
|
+
var TitleCellOpensContext = createContext7(false);
|
|
18617
|
+
function openRecordLabel(name) {
|
|
18618
|
+
return `Open ${name}`;
|
|
18619
|
+
}
|
|
18620
|
+
function opensOnKey(event) {
|
|
18621
|
+
if (event.key !== " " || event.altKey || event.ctrlKey || event.metaKey) return false;
|
|
18622
|
+
const target = event.target;
|
|
18623
|
+
if (!target) return false;
|
|
18624
|
+
const tag = target.tagName;
|
|
18625
|
+
if (tag === "INPUT" || tag === "TEXTAREA" || tag === "SELECT" || tag === "BUTTON") return false;
|
|
18626
|
+
if (target.isContentEditable) {
|
|
18627
|
+
const editor = target.closest('[contenteditable=""], [contenteditable="true"], [contenteditable="plaintext-only"]');
|
|
18628
|
+
const inside = event.currentTarget;
|
|
18629
|
+
if (!editor || !inside || inside.contains(editor)) return false;
|
|
18630
|
+
}
|
|
18631
|
+
return true;
|
|
18632
|
+
}
|
|
18633
|
+
function withOpenRecord(columns, onOpen, nameOf3, place = "end", hrefOf, openOnly) {
|
|
18634
|
+
if (!onOpen) return columns;
|
|
18635
|
+
return columns.map((column, index) => {
|
|
18636
|
+
const original = column.cell;
|
|
18637
|
+
const render = (row, rowIndex) => original ? original(row, rowIndex) : String(row[column.id ?? ""] ?? "");
|
|
18638
|
+
const openFrom = (row, event) => {
|
|
18639
|
+
const href = hrefOf?.(row);
|
|
18640
|
+
if (href && (event.metaKey || event.ctrlKey)) openOutbound2(href, "_blank", "noopener");
|
|
18641
|
+
else (openOnly ?? onOpen)(row.id);
|
|
18642
|
+
};
|
|
18643
|
+
const handle = (row) => /* @__PURE__ */ jsxs53(
|
|
18644
|
+
"button",
|
|
18645
|
+
{
|
|
18646
|
+
type: "button",
|
|
18647
|
+
"data-records-open-record": row.id,
|
|
18648
|
+
"aria-label": openRecordLabel(nameOf3(row)),
|
|
18649
|
+
title: `${openRecordLabel(nameOf3(row))} (Space) \xB7 \u2318-click: new tab`,
|
|
18650
|
+
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",
|
|
18651
|
+
onClick: (event) => {
|
|
18652
|
+
event.stopPropagation();
|
|
18653
|
+
openFrom(row, event);
|
|
18654
|
+
},
|
|
18655
|
+
onDoubleClick: (event) => event.stopPropagation(),
|
|
18656
|
+
children: [
|
|
18657
|
+
/* @__PURE__ */ jsx59("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__ */ jsx59("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" }) }),
|
|
18658
|
+
"Open"
|
|
18659
|
+
]
|
|
18660
|
+
}
|
|
18661
|
+
);
|
|
18662
|
+
const titleTarget = (event) => {
|
|
18663
|
+
const target = event.target;
|
|
18664
|
+
if (!target || typeof target.closest !== "function") return false;
|
|
18665
|
+
const hit = target.closest(TITLE_OWN_CONTROLS);
|
|
18666
|
+
return hit === null || !event.currentTarget.contains(hit);
|
|
18667
|
+
};
|
|
18668
|
+
return {
|
|
18669
|
+
...column,
|
|
18670
|
+
cell: (row, rowIndex) => /* @__PURE__ */ jsx59(
|
|
18671
|
+
"span",
|
|
18672
|
+
{
|
|
18673
|
+
className: index === 0 ? "relative flex min-w-0 items-center gap-1" : "contents",
|
|
18674
|
+
"data-records-opens-on-space": row.id,
|
|
18675
|
+
onKeyDown: (event) => {
|
|
18676
|
+
if (!opensOnKey(event)) return;
|
|
18677
|
+
event.preventDefault();
|
|
18678
|
+
event.stopPropagation();
|
|
18679
|
+
onOpen(row.id);
|
|
18680
|
+
},
|
|
18681
|
+
children: index === 0 ? /* @__PURE__ */ jsxs53(Fragment21, { children: [
|
|
18682
|
+
place === "start" ? handle(row) : null,
|
|
18683
|
+
/* @__PURE__ */ jsx59(
|
|
18684
|
+
"span",
|
|
18685
|
+
{
|
|
18686
|
+
className: "min-w-0 flex-1 decoration-muted-foreground/60 underline-offset-2 hover:underline",
|
|
18687
|
+
"data-clickable": "",
|
|
18688
|
+
"data-records-opens-on-click": row.id,
|
|
18689
|
+
onClickCapture: (event) => {
|
|
18690
|
+
if (!titleTarget(event)) return;
|
|
18691
|
+
openFrom(row, event);
|
|
18692
|
+
},
|
|
18693
|
+
onDoubleClickCapture: (event) => {
|
|
18694
|
+
if (!titleTarget(event)) return;
|
|
18695
|
+
event.stopPropagation();
|
|
18696
|
+
openFrom(row, event);
|
|
18697
|
+
},
|
|
18698
|
+
children: /* @__PURE__ */ jsx59(TitleCellOpensContext.Provider, { value: true, children: render(row, rowIndex) })
|
|
18699
|
+
}
|
|
18700
|
+
),
|
|
18701
|
+
place === "end" ? handle(row) : null
|
|
18702
|
+
] }) : render(row, rowIndex)
|
|
18703
|
+
}
|
|
18704
|
+
)
|
|
18705
|
+
};
|
|
18706
|
+
});
|
|
18707
|
+
}
|
|
18708
|
+
|
|
18582
18709
|
// src/gridHeldKeys.ts
|
|
18583
18710
|
function isHeldKey(e) {
|
|
18584
18711
|
if (e.metaKey || e.ctrlKey || e.altKey) return false;
|
|
@@ -18699,7 +18826,7 @@ function useWhenBackOnline(resend) {
|
|
|
18699
18826
|
}
|
|
18700
18827
|
|
|
18701
18828
|
// src/gridEditing.tsx
|
|
18702
|
-
import { jsx as
|
|
18829
|
+
import { jsx as jsx60, jsxs as jsxs54 } from "react/jsx-runtime";
|
|
18703
18830
|
var FLOATING_CELL_NOTE_CLASS = "[&_[data-records-cell-note]]:absolute [&_[data-records-cell-note]]:bottom-full [&_[data-records-cell-note]]:left-0 [&_[data-records-cell-note]]:z-[26] [&_[data-records-cell-note]]:mb-1 [&_[data-records-cell-note]]:w-max [&_[data-records-cell-note]]:max-w-[24rem] [&_[data-records-cell-note]]:rounded-md [&_[data-records-cell-note]]:border [&_[data-records-cell-note]]:bg-popover [&_[data-records-cell-note]]:px-1.5 [&_[data-records-cell-note]]:py-0.5 [&_[data-records-cell-note]]:shadow-md";
|
|
18704
18831
|
var FLOATING_CELL_TRAY_CLASS = "absolute left-0 top-full z-[26] mt-1 flex w-max max-w-[24rem] flex-col items-start gap-1";
|
|
18705
18832
|
var FLOATING_CELL_TRAY_PIECE_CLASS = "rounded-md border bg-popover px-1.5 py-0.5 shadow-md";
|
|
@@ -19327,6 +19454,7 @@ function GridCell({
|
|
|
19327
19454
|
clickOpens = false
|
|
19328
19455
|
}) {
|
|
19329
19456
|
const ui = useRecordsUi();
|
|
19457
|
+
const titleOpens = useContext7(TitleCellOpensContext);
|
|
19330
19458
|
const saidAt = useRef26(0);
|
|
19331
19459
|
const sayWhyNot = () => {
|
|
19332
19460
|
if (Date.now() - saidAt.current < 4e3) return;
|
|
@@ -19390,9 +19518,9 @@ function GridCell({
|
|
|
19390
19518
|
const refusal3 = editing ? editing.refusalOf(row.id, field2.key) : null;
|
|
19391
19519
|
const editable = Boolean(editing) && canWrite && fieldIsEditable(field2);
|
|
19392
19520
|
if (open && editing) {
|
|
19393
|
-
return /* @__PURE__ */
|
|
19394
|
-
/* @__PURE__ */
|
|
19395
|
-
/* @__PURE__ */
|
|
19521
|
+
return /* @__PURE__ */ jsxs54("span", { "data-records-open-cell": "", className: "relative block w-full min-w-0", children: [
|
|
19522
|
+
/* @__PURE__ */ jsxs54("span", { "aria-hidden": "true", inert: true, "data-records-cell-ghost": "", className: "pointer-events-none invisible flex w-full min-w-0 select-none items-center gap-1", children: [
|
|
19523
|
+
/* @__PURE__ */ jsx60("span", { className: "block min-w-0 flex-1 truncate px-1 py-0.5", children: /* @__PURE__ */ jsx60(
|
|
19396
19524
|
RecordValue,
|
|
19397
19525
|
{
|
|
19398
19526
|
inCell: true,
|
|
@@ -19404,11 +19532,11 @@ function GridCell({
|
|
|
19404
19532
|
...format ? { format } : {}
|
|
19405
19533
|
}
|
|
19406
19534
|
) }),
|
|
19407
|
-
onAskWhoChanged ? /* @__PURE__ */
|
|
19535
|
+
onAskWhoChanged ? /* @__PURE__ */ jsx60(WhoBadge, { field: field2, row, onAskWhoChanged: () => {
|
|
19408
19536
|
}, onPressedTwice: () => {
|
|
19409
19537
|
} }) : null
|
|
19410
19538
|
] }),
|
|
19411
|
-
/* @__PURE__ */
|
|
19539
|
+
/* @__PURE__ */ jsx60(
|
|
19412
19540
|
OpenCell,
|
|
19413
19541
|
{
|
|
19414
19542
|
field: field2,
|
|
@@ -19424,7 +19552,7 @@ function GridCell({
|
|
|
19424
19552
|
// state they are in, so only Discard is offered. It is INSIDE the open
|
|
19425
19553
|
// cell, so pressing Discard is not "focus left the cell" — which would
|
|
19426
19554
|
// commit the refused value one more time on its way out.
|
|
19427
|
-
refusal3 && !refusal3.conflict ? /* @__PURE__ */
|
|
19555
|
+
refusal3 && !refusal3.conflict ? /* @__PURE__ */ jsx60(
|
|
19428
19556
|
RefusalNotice,
|
|
19429
19557
|
{
|
|
19430
19558
|
error: refusal3.error,
|
|
@@ -19439,8 +19567,8 @@ function GridCell({
|
|
|
19439
19567
|
}
|
|
19440
19568
|
if (editorKindFor(field2) === "checkbox") {
|
|
19441
19569
|
const answered = value === true || value === false;
|
|
19442
|
-
return /* @__PURE__ */
|
|
19443
|
-
/* @__PURE__ */
|
|
19570
|
+
return /* @__PURE__ */ jsxs54("span", { "data-matrx-cell-control": "", className: "relative flex h-full w-full flex-wrap items-center gap-1.5", children: [
|
|
19571
|
+
/* @__PURE__ */ jsx60(
|
|
19444
19572
|
Checkbox8,
|
|
19445
19573
|
{
|
|
19446
19574
|
checked: value === true,
|
|
@@ -19451,15 +19579,15 @@ function GridCell({
|
|
|
19451
19579
|
onCheckedChange: (next) => editing?.setCell(row.id, field2.key, next === true)
|
|
19452
19580
|
}
|
|
19453
19581
|
),
|
|
19454
|
-
answered ? null : /* @__PURE__ */
|
|
19455
|
-
refusal3 ? /* @__PURE__ */
|
|
19582
|
+
answered ? null : /* @__PURE__ */ jsx60("span", { className: "text-xs text-muted-foreground", title: "nobody has answered this yet", children: "\u2014" }),
|
|
19583
|
+
refusal3 ? /* @__PURE__ */ jsx60(CellRefusalNotice, { refusal: refusal3, field: field2, row, editing, typed: false }) : null
|
|
19456
19584
|
] });
|
|
19457
19585
|
}
|
|
19458
19586
|
if (editable && format?.id === "rating") {
|
|
19459
|
-
return /* @__PURE__ */
|
|
19460
|
-
/* @__PURE__ */
|
|
19461
|
-
state2 === "saving" ? /* @__PURE__ */
|
|
19462
|
-
refusal3 ? /* @__PURE__ */
|
|
19587
|
+
return /* @__PURE__ */ jsxs54("span", { "data-matrx-cell-control": "", className: "relative flex h-full w-full flex-wrap items-center gap-1.5", children: [
|
|
19588
|
+
/* @__PURE__ */ jsx60(FormattedValue, { value, format, onRate: (next) => editing?.setCell(row.id, field2.key, next), selectFirst: true }),
|
|
19589
|
+
state2 === "saving" ? /* @__PURE__ */ jsx60("span", { "data-records-cell-saving": "", className: "pointer-events-none absolute right-1 top-1/2 z-10 -translate-y-1/2 rounded bg-card/90 px-1 text-[10px] text-muted-foreground", children: "Saving\u2026" }) : null,
|
|
19590
|
+
refusal3 ? /* @__PURE__ */ jsx60(CellRefusalNotice, { refusal: refusal3, field: field2, row, editing, typed: false }) : null
|
|
19463
19591
|
] });
|
|
19464
19592
|
}
|
|
19465
19593
|
const openThisCell = (event) => {
|
|
@@ -19491,15 +19619,15 @@ function GridCell({
|
|
|
19491
19619
|
// control IS the cell" marker, which overrides the `w-max` shrink that
|
|
19492
19620
|
// `data-matrx-cell-control` alone earns and which was beating this `w-full`
|
|
19493
19621
|
// — a 20px click target inside a 251px cell, measured.
|
|
19494
|
-
/* @__PURE__ */
|
|
19622
|
+
/* @__PURE__ */ jsxs54(
|
|
19495
19623
|
"span",
|
|
19496
19624
|
{
|
|
19497
19625
|
"data-matrx-cell-control": "",
|
|
19498
19626
|
"data-matrx-cell-fill": "",
|
|
19499
19627
|
className: "group/cell relative flex h-full w-full min-w-0 flex-col justify-center gap-0.5",
|
|
19500
19628
|
children: [
|
|
19501
|
-
/* @__PURE__ */
|
|
19502
|
-
/* @__PURE__ */
|
|
19629
|
+
/* @__PURE__ */ jsxs54("span", { className: "flex w-full min-w-0 items-center gap-1", children: [
|
|
19630
|
+
/* @__PURE__ */ jsx60(
|
|
19503
19631
|
"span",
|
|
19504
19632
|
{
|
|
19505
19633
|
ref: closedControl,
|
|
@@ -19507,7 +19635,7 @@ function GridCell({
|
|
|
19507
19635
|
"aria-label": editable ? `Edit ${fieldName(field2)}` : void 0,
|
|
19508
19636
|
title: cellMark ? cellMark : editable ? (
|
|
19509
19637
|
// The words match the gesture (WALK3-FIX): one click opens a record-page field.
|
|
19510
|
-
clickOpens ? `${fieldName(field2)} \u2014 click to edit` : `${fieldName(field2)} \u2014 double-click or press Enter to edit`
|
|
19638
|
+
clickOpens ? `${fieldName(field2)} \u2014 click to edit` : titleOpens ? "Click to open \xB7 Enter to edit" : `${fieldName(field2)} \u2014 double-click or press Enter to edit`
|
|
19511
19639
|
) : fieldIsEditable(field2) ? (
|
|
19512
19640
|
// NOT A DEAD CONTROL AND NOT A SILENT ONE: the cell is plain
|
|
19513
19641
|
// text, and hovering it says exactly why, in the level's own
|
|
@@ -19552,7 +19680,7 @@ function GridCell({
|
|
|
19552
19680
|
if (!editable && (event.key === "Enter" || event.key === "F2" || isTypedCharacter(event))) sayWhyNot();
|
|
19553
19681
|
},
|
|
19554
19682
|
tabIndex: editable || onAskWhoChanged ? 0 : void 0,
|
|
19555
|
-
children: /* @__PURE__ */
|
|
19683
|
+
children: /* @__PURE__ */ jsx60(
|
|
19556
19684
|
RecordValue,
|
|
19557
19685
|
{
|
|
19558
19686
|
inCell: true,
|
|
@@ -19567,7 +19695,7 @@ function GridCell({
|
|
|
19567
19695
|
)
|
|
19568
19696
|
}
|
|
19569
19697
|
),
|
|
19570
|
-
onAskWhoChanged ? /* @__PURE__ */
|
|
19698
|
+
onAskWhoChanged ? /* @__PURE__ */ jsx60(
|
|
19571
19699
|
WhoBadge,
|
|
19572
19700
|
{
|
|
19573
19701
|
field: field2,
|
|
@@ -19581,8 +19709,8 @@ function GridCell({
|
|
|
19581
19709
|
}
|
|
19582
19710
|
) : null
|
|
19583
19711
|
] }),
|
|
19584
|
-
state2 === "saving" ? /* @__PURE__ */
|
|
19585
|
-
refusal3 ? /* @__PURE__ */
|
|
19712
|
+
state2 === "saving" ? /* @__PURE__ */ jsx60("span", { "data-records-cell-saving": "", className: "pointer-events-none absolute right-1 top-1/2 z-10 -translate-y-1/2 rounded bg-card/90 px-1 text-[10px] text-muted-foreground", children: "Saving\u2026" }) : null,
|
|
19713
|
+
refusal3 ? /* @__PURE__ */ jsx60(CellRefusalNotice, { refusal: refusal3, field: field2, row, editing, typed: true }) : null
|
|
19586
19714
|
]
|
|
19587
19715
|
}
|
|
19588
19716
|
)
|
|
@@ -19599,31 +19727,31 @@ function CellRefusalNotice({
|
|
|
19599
19727
|
const line = refusal3.unsent ? UNSENT_LINE : refusalLineForAPerson(refusal3.error);
|
|
19600
19728
|
const notice = refusal3.unsent ? (
|
|
19601
19729
|
// NOT SENT, NOT REFUSED: what was typed is still in the cell; it goes again once online.
|
|
19602
|
-
/* @__PURE__ */
|
|
19603
|
-
/* @__PURE__ */
|
|
19604
|
-
/* @__PURE__ */
|
|
19605
|
-
/* @__PURE__ */
|
|
19606
|
-
/* @__PURE__ */
|
|
19607
|
-
/* @__PURE__ */
|
|
19730
|
+
/* @__PURE__ */ jsxs54("div", { className: "flex flex-col gap-1.5 px-3 py-2 text-xs", "data-records-cell-unsent": "", children: [
|
|
19731
|
+
/* @__PURE__ */ jsx60("span", { className: "font-medium", children: UNSENT_LINE }),
|
|
19732
|
+
/* @__PURE__ */ jsx60("span", { className: "max-w-[16rem] truncate text-muted-foreground", title: valueInALine(refusal3.attempted), children: valueInALine(refusal3.attempted) }),
|
|
19733
|
+
/* @__PURE__ */ jsxs54("span", { className: "flex flex-wrap gap-1", children: [
|
|
19734
|
+
/* @__PURE__ */ jsx60(Button30, { size: "sm", variant: "outline", className: "h-6", "data-records-cell-try-now": "", onClick: () => editing?.tryNow(row.id, field2.key), children: "Try now" }),
|
|
19735
|
+
/* @__PURE__ */ jsx60(Button30, { size: "sm", variant: "ghost", className: "h-6", "data-records-cell-discard": "", onClick: () => editing?.discard(row.id, field2.key), children: "Discard" })
|
|
19608
19736
|
] })
|
|
19609
19737
|
] })
|
|
19610
|
-
) : refusal3.conflict ? /* @__PURE__ */
|
|
19738
|
+
) : refusal3.conflict ? /* @__PURE__ */ jsx60(
|
|
19611
19739
|
RefusalNotice,
|
|
19612
19740
|
{
|
|
19613
19741
|
error: refusal3.error,
|
|
19614
19742
|
className: "py-1.5 text-left",
|
|
19615
|
-
actions: /* @__PURE__ */
|
|
19616
|
-
/* @__PURE__ */
|
|
19743
|
+
actions: /* @__PURE__ */ jsxs54("span", { className: "flex flex-col gap-1", "data-refusal-conflict": "", children: [
|
|
19744
|
+
/* @__PURE__ */ jsxs54("span", { className: "text-[11px]", children: [
|
|
19617
19745
|
"Theirs: ",
|
|
19618
|
-
/* @__PURE__ */
|
|
19746
|
+
/* @__PURE__ */ jsx60("strong", { children: formatTheirs(refusal3.conflict, field2.key) })
|
|
19619
19747
|
] }),
|
|
19620
|
-
/* @__PURE__ */
|
|
19621
|
-
/* @__PURE__ */
|
|
19622
|
-
/* @__PURE__ */
|
|
19748
|
+
/* @__PURE__ */ jsxs54("span", { className: "flex flex-wrap gap-1", children: [
|
|
19749
|
+
/* @__PURE__ */ jsx60(Button30, { size: "sm", variant: "outline", onClick: () => editing?.retry(row.id, field2.key), children: "Try again" }),
|
|
19750
|
+
/* @__PURE__ */ jsx60(Button30, { size: "sm", variant: "ghost", onClick: () => editing?.keepTheirs(row.id, field2.key), children: "Keep theirs" })
|
|
19623
19751
|
] })
|
|
19624
19752
|
] })
|
|
19625
19753
|
}
|
|
19626
|
-
) : /* @__PURE__ */
|
|
19754
|
+
) : /* @__PURE__ */ jsx60(
|
|
19627
19755
|
RefusalNotice,
|
|
19628
19756
|
{
|
|
19629
19757
|
error: refusal3.error,
|
|
@@ -19632,8 +19760,8 @@ function CellRefusalNotice({
|
|
|
19632
19760
|
onDiscard: () => editing?.discard(row.id, field2.key)
|
|
19633
19761
|
}
|
|
19634
19762
|
);
|
|
19635
|
-
return /* @__PURE__ */
|
|
19636
|
-
/* @__PURE__ */
|
|
19763
|
+
return /* @__PURE__ */ jsxs54(Popover10, { open, onOpenChange: setOpen, children: [
|
|
19764
|
+
/* @__PURE__ */ jsx60(PopoverTrigger10, { asChild: true, children: /* @__PURE__ */ jsx60(
|
|
19637
19765
|
"button",
|
|
19638
19766
|
{
|
|
19639
19767
|
type: "button",
|
|
@@ -19645,7 +19773,7 @@ function CellRefusalNotice({
|
|
|
19645
19773
|
children: "!"
|
|
19646
19774
|
}
|
|
19647
19775
|
) }),
|
|
19648
|
-
/* @__PURE__ */
|
|
19776
|
+
/* @__PURE__ */ jsx60(
|
|
19649
19777
|
PopoverContent10,
|
|
19650
19778
|
{
|
|
19651
19779
|
sizing: "content",
|
|
@@ -19672,7 +19800,7 @@ function WhoBadge({
|
|
|
19672
19800
|
// by CSS, so copying the page, a range or the cell never carries "who?". It is a pointer
|
|
19673
19801
|
// shortcut beside the value; the keyboard asks the same question with Option-Shift-H and the
|
|
19674
19802
|
// cell's right-click menu, so it stays out of the tab order and the accessibility tree.
|
|
19675
|
-
/* @__PURE__ */
|
|
19803
|
+
/* @__PURE__ */ jsx60(
|
|
19676
19804
|
"button",
|
|
19677
19805
|
{
|
|
19678
19806
|
type: "button",
|
|
@@ -19695,9 +19823,9 @@ function WhoBadge({
|
|
|
19695
19823
|
event.stopPropagation();
|
|
19696
19824
|
onPressedTwice();
|
|
19697
19825
|
},
|
|
19698
|
-
children: who.badge ? null : /* @__PURE__ */
|
|
19699
|
-
/* @__PURE__ */
|
|
19700
|
-
/* @__PURE__ */
|
|
19826
|
+
children: who.badge ? null : /* @__PURE__ */ jsxs54("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", width: "12", height: "12", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "data-records-who-glyph": "", children: [
|
|
19827
|
+
/* @__PURE__ */ jsx60("circle", { cx: "12", cy: "12", r: "9" }),
|
|
19828
|
+
/* @__PURE__ */ jsx60("path", { d: "M12 7v5l3 2" })
|
|
19701
19829
|
] })
|
|
19702
19830
|
}
|
|
19703
19831
|
)
|
|
@@ -19816,7 +19944,7 @@ function OpenCell({
|
|
|
19816
19944
|
once(() => onCommit(null, "blur"));
|
|
19817
19945
|
}
|
|
19818
19946
|
} : {};
|
|
19819
|
-
return /* @__PURE__ */
|
|
19947
|
+
return /* @__PURE__ */ jsxs54(
|
|
19820
19948
|
"span",
|
|
19821
19949
|
{
|
|
19822
19950
|
ref: host,
|
|
@@ -19876,7 +20004,7 @@ function OpenCell({
|
|
|
19876
20004
|
},
|
|
19877
20005
|
...blur,
|
|
19878
20006
|
children: [
|
|
19879
|
-
/* @__PURE__ */
|
|
20007
|
+
/* @__PURE__ */ jsx60(
|
|
19880
20008
|
FieldControl,
|
|
19881
20009
|
{
|
|
19882
20010
|
field: field2,
|
|
@@ -19891,12 +20019,12 @@ function OpenCell({
|
|
|
19891
20019
|
recordId
|
|
19892
20020
|
}
|
|
19893
20021
|
),
|
|
19894
|
-
/* @__PURE__ */
|
|
19895
|
-
picker || asksAboutAChoice(draft) ? null : blurCommits ? null : /* @__PURE__ */
|
|
19896
|
-
/* @__PURE__ */
|
|
19897
|
-
/* @__PURE__ */
|
|
20022
|
+
/* @__PURE__ */ jsxs54("span", { "data-records-cell-tray": "", className: FLOATING_CELL_TRAY_CLASS, children: [
|
|
20023
|
+
picker || asksAboutAChoice(draft) ? null : blurCommits ? null : /* @__PURE__ */ jsxs54("span", { className: cn35("flex items-center gap-1", FLOATING_CELL_TRAY_PIECE_CLASS), children: [
|
|
20024
|
+
/* @__PURE__ */ jsx60(Button30, { size: "sm", onClick: () => once(() => onCommit(null, "pick")), children: "Save" }),
|
|
20025
|
+
/* @__PURE__ */ jsx60(Button30, { size: "sm", variant: "ghost", onClick: () => once(() => onCancel("pick")), children: "Cancel" })
|
|
19898
20026
|
] }),
|
|
19899
|
-
below ? /* @__PURE__ */
|
|
20027
|
+
below ? /* @__PURE__ */ jsx60("span", { className: "block bg-popover shadow-md", children: below }) : null
|
|
19900
20028
|
] })
|
|
19901
20029
|
]
|
|
19902
20030
|
}
|
|
@@ -19945,7 +20073,7 @@ function rememberLayout(tableId, layout) {
|
|
|
19945
20073
|
import { useSyncExternalStore as useSyncExternalStore3 } from "react";
|
|
19946
20074
|
import { cn as cn36, Skeleton as Skeleton6 } from "@ai-matrx/design-system";
|
|
19947
20075
|
import { MatrxDataTable } from "@ai-matrx/design-system/data-table";
|
|
19948
|
-
import { Fragment as
|
|
20076
|
+
import { Fragment as Fragment22, jsx as jsx61, jsxs as jsxs55 } from "react/jsx-runtime";
|
|
19949
20077
|
var NEVER = () => () => {
|
|
19950
20078
|
};
|
|
19951
20079
|
function useRememberedPageRows(tableId) {
|
|
@@ -19988,7 +20116,7 @@ var PLACEHOLDER_COLUMNS = ["a", "b", "c", "d", "e", "f"].map((id) => ({
|
|
|
19988
20116
|
}));
|
|
19989
20117
|
var NO_ROWS2 = [];
|
|
19990
20118
|
function GridSkeleton({ embedded, rows }) {
|
|
19991
|
-
return /* @__PURE__ */
|
|
20119
|
+
return /* @__PURE__ */ jsx61(
|
|
19992
20120
|
MatrxDataTable,
|
|
19993
20121
|
{
|
|
19994
20122
|
...embedded ? {} : { className: "min-h-0 flex-1" },
|
|
@@ -20015,75 +20143,75 @@ function GridSkeleton({ embedded, rows }) {
|
|
|
20015
20143
|
var CHART_PLOT_PX = 140;
|
|
20016
20144
|
var RECORDS_GRID_ROW_PX = 35;
|
|
20017
20145
|
function Cards({ count, className }) {
|
|
20018
|
-
return /* @__PURE__ */
|
|
20146
|
+
return /* @__PURE__ */ jsx61(Fragment22, { children: Array.from({ length: count }, (_, i) => /* @__PURE__ */ jsx61(Skeleton6, { shape: "block", className }, i)) });
|
|
20019
20147
|
}
|
|
20020
20148
|
function BodySkeleton({ layout, embedded, rows }) {
|
|
20021
20149
|
const lineCount = rows === "fill" ? 12 : rows;
|
|
20022
20150
|
switch (layout) {
|
|
20023
20151
|
case "grid":
|
|
20024
20152
|
case "home":
|
|
20025
|
-
return /* @__PURE__ */
|
|
20153
|
+
return /* @__PURE__ */ jsx61(GridSkeleton, { embedded, rows });
|
|
20026
20154
|
case "kanban":
|
|
20027
|
-
return /* @__PURE__ */
|
|
20028
|
-
/* @__PURE__ */
|
|
20029
|
-
/* @__PURE__ */
|
|
20155
|
+
return /* @__PURE__ */ jsx61("div", { className: "flex min-h-0 flex-1 gap-2 overflow-hidden pb-2", "data-records-skeleton-part": "body", children: Array.from({ length: 4 }, (_, c) => /* @__PURE__ */ jsxs55("div", { className: "flex w-64 shrink-0 flex-col gap-2 rounded-lg bg-muted/40 p-2", children: [
|
|
20156
|
+
/* @__PURE__ */ jsx61(Skeleton6, { shape: "line", width: "1/2", className: "my-1.5" }),
|
|
20157
|
+
/* @__PURE__ */ jsx61(Cards, { count: 3 - c % 2, className: "h-24" })
|
|
20030
20158
|
] }, c)) });
|
|
20031
20159
|
case "gallery":
|
|
20032
|
-
return /* @__PURE__ */
|
|
20160
|
+
return /* @__PURE__ */ jsx61(
|
|
20033
20161
|
"div",
|
|
20034
20162
|
{
|
|
20035
20163
|
className: "grid min-h-0 flex-1 auto-rows-min grid-cols-[repeat(auto-fill,minmax(14rem,1fr))] gap-3 overflow-hidden",
|
|
20036
20164
|
"data-records-skeleton-part": "body",
|
|
20037
|
-
children: /* @__PURE__ */
|
|
20165
|
+
children: /* @__PURE__ */ jsx61(Cards, { count: 8, className: "h-48" })
|
|
20038
20166
|
}
|
|
20039
20167
|
);
|
|
20040
20168
|
case "list":
|
|
20041
|
-
return /* @__PURE__ */
|
|
20042
|
-
/* @__PURE__ */
|
|
20043
|
-
/* @__PURE__ */
|
|
20169
|
+
return /* @__PURE__ */ jsx61("div", { className: "flex min-h-0 flex-1 flex-col overflow-hidden", "data-records-skeleton-part": "body", children: Array.from({ length: lineCount }, (_, i) => /* @__PURE__ */ jsxs55("div", { className: "flex h-9 items-center gap-3 border-b border-border/60 px-2", children: [
|
|
20170
|
+
/* @__PURE__ */ jsx61(Skeleton6, { className: "size-4" }),
|
|
20171
|
+
/* @__PURE__ */ jsx61(Skeleton6, { shape: "line", width: i % 3 === 0 ? "1/2" : i % 3 === 1 ? "2/3" : "1/3" })
|
|
20044
20172
|
] }, i)) });
|
|
20045
20173
|
case "calendar":
|
|
20046
|
-
return /* @__PURE__ */
|
|
20047
|
-
/* @__PURE__ */
|
|
20048
|
-
/* @__PURE__ */
|
|
20174
|
+
return /* @__PURE__ */ jsxs55("div", { className: "flex min-h-0 flex-1 flex-col gap-2 overflow-hidden", "data-records-skeleton-part": "body", children: [
|
|
20175
|
+
/* @__PURE__ */ jsx61("div", { className: "grid grid-cols-7 gap-px", children: Array.from({ length: 7 }, (_, i) => /* @__PURE__ */ jsx61(Skeleton6, { shape: "line", width: "1/3", className: "mx-auto my-1" }, i)) }),
|
|
20176
|
+
/* @__PURE__ */ jsx61("div", { className: "grid flex-1 grid-cols-7 grid-rows-5 gap-px overflow-hidden rounded-md border border-border bg-border", children: Array.from({ length: 35 }, (_, i) => /* @__PURE__ */ jsx61("div", { className: "bg-card p-1.5", children: /* @__PURE__ */ jsx61(Skeleton6, { shape: "line", width: "1/3" }) }, i)) })
|
|
20049
20177
|
] });
|
|
20050
20178
|
case "timeline":
|
|
20051
|
-
return /* @__PURE__ */
|
|
20052
|
-
/* @__PURE__ */
|
|
20053
|
-
Array.from({ length: Math.min(lineCount, 8) }, (_, i) => /* @__PURE__ */
|
|
20179
|
+
return /* @__PURE__ */ jsxs55("div", { className: "flex min-h-0 flex-1 flex-col overflow-hidden rounded-md border border-border", "data-records-skeleton-part": "body", children: [
|
|
20180
|
+
/* @__PURE__ */ jsx61("div", { className: "flex h-9 items-center gap-6 border-b border-border px-3", children: Array.from({ length: 6 }, (_, i) => /* @__PURE__ */ jsx61(Skeleton6, { shape: "line", width: "sm", className: "w-16" }, i)) }),
|
|
20181
|
+
Array.from({ length: Math.min(lineCount, 8) }, (_, i) => /* @__PURE__ */ jsx61("div", { className: "flex h-10 items-center border-b border-border/60 px-3", children: /* @__PURE__ */ jsx61(Skeleton6, { className: "h-6 rounded-md", style: { marginLeft: `${i * 13 % 45}%`, width: `${20 + i * 7 % 25}%` } }) }, i))
|
|
20054
20182
|
] });
|
|
20055
20183
|
case "record":
|
|
20056
|
-
return /* @__PURE__ */
|
|
20057
|
-
/* @__PURE__ */
|
|
20058
|
-
/* @__PURE__ */
|
|
20059
|
-
/* @__PURE__ */
|
|
20060
|
-
/* @__PURE__ */
|
|
20184
|
+
return /* @__PURE__ */ jsxs55("div", { className: "flex min-h-0 flex-1 flex-col gap-2 overflow-hidden", "data-records-skeleton-part": "body", children: [
|
|
20185
|
+
/* @__PURE__ */ jsx61(Skeleton6, { shape: "title", width: "1/2", className: "h-8", "data-records-skeleton-part": "title" }),
|
|
20186
|
+
/* @__PURE__ */ jsxs55("div", { className: "flex h-[38px] items-center gap-2", "data-records-skeleton-part": "actions", children: [
|
|
20187
|
+
/* @__PURE__ */ jsx61(Skeleton6, { shape: "control", width: "sm", className: "h-8" }),
|
|
20188
|
+
/* @__PURE__ */ jsx61(Skeleton6, { shape: "control", width: "sm", className: "h-8" })
|
|
20061
20189
|
] }),
|
|
20062
|
-
/* @__PURE__ */
|
|
20063
|
-
/* @__PURE__ */
|
|
20064
|
-
/* @__PURE__ */
|
|
20065
|
-
/* @__PURE__ */
|
|
20190
|
+
/* @__PURE__ */ jsx61("div", { className: "h-px w-full shrink-0 bg-border" }),
|
|
20191
|
+
/* @__PURE__ */ jsx61("div", { className: "grid grid-cols-[minmax(6rem,12rem)_1fr] gap-x-3 gap-y-0.5", "data-records-skeleton-part": "fields", children: Array.from({ length: 6 }, (_, i) => /* @__PURE__ */ jsxs55("div", { className: "contents", children: [
|
|
20192
|
+
/* @__PURE__ */ jsx61(Skeleton6, { shape: "line", width: "2/3", className: "my-[7px]" }),
|
|
20193
|
+
/* @__PURE__ */ jsx61(Skeleton6, { shape: "row", className: "h-7" })
|
|
20066
20194
|
] }, i)) }),
|
|
20067
|
-
/* @__PURE__ */
|
|
20195
|
+
/* @__PURE__ */ jsx61(Skeleton6, { shape: "block", height: "lg" })
|
|
20068
20196
|
] });
|
|
20069
20197
|
case "form":
|
|
20070
|
-
return /* @__PURE__ */
|
|
20071
|
-
/* @__PURE__ */
|
|
20072
|
-
/* @__PURE__ */
|
|
20073
|
-
/* @__PURE__ */
|
|
20074
|
-
/* @__PURE__ */
|
|
20198
|
+
return /* @__PURE__ */ jsxs55("div", { className: "flex min-h-0 flex-1 flex-col gap-4 overflow-hidden", "data-records-skeleton-part": "body", children: [
|
|
20199
|
+
/* @__PURE__ */ jsx61(Skeleton6, { shape: "title", width: "1/2" }),
|
|
20200
|
+
/* @__PURE__ */ jsx61("div", { className: "grid grid-cols-[minmax(6rem,12rem)_1fr] gap-x-3 gap-y-1.5", children: Array.from({ length: 6 }, (_, i) => /* @__PURE__ */ jsxs55("div", { className: "contents", children: [
|
|
20201
|
+
/* @__PURE__ */ jsx61(Skeleton6, { shape: "line", width: "2/3", className: "my-1.5" }),
|
|
20202
|
+
/* @__PURE__ */ jsx61(Skeleton6, { shape: "row", className: "h-7" })
|
|
20075
20203
|
] }, i)) }),
|
|
20076
|
-
/* @__PURE__ */
|
|
20204
|
+
/* @__PURE__ */ jsx61(Skeleton6, { shape: "control", width: "sm" })
|
|
20077
20205
|
] });
|
|
20078
20206
|
case "chart":
|
|
20079
|
-
return /* @__PURE__ */
|
|
20080
|
-
embedded ? null : /* @__PURE__ */
|
|
20081
|
-
/* @__PURE__ */
|
|
20207
|
+
return /* @__PURE__ */ jsxs55("div", { className: "flex flex-col gap-2", "data-records-skeleton-part": "body", children: [
|
|
20208
|
+
embedded ? null : /* @__PURE__ */ jsx61(Skeleton6, { shape: "line", width: "1/3" }),
|
|
20209
|
+
/* @__PURE__ */ jsx61(Skeleton6, { shape: "block", style: { height: CHART_PLOT_PX } })
|
|
20082
20210
|
] });
|
|
20083
20211
|
}
|
|
20084
20212
|
}
|
|
20085
20213
|
function RecordsSkeleton({ layout = "grid", embedded = false, rows, className }) {
|
|
20086
|
-
return /* @__PURE__ */
|
|
20214
|
+
return /* @__PURE__ */ jsx61(
|
|
20087
20215
|
"div",
|
|
20088
20216
|
{
|
|
20089
20217
|
role: "status",
|
|
@@ -20091,7 +20219,7 @@ function RecordsSkeleton({ layout = "grid", embedded = false, rows, className })
|
|
|
20091
20219
|
"aria-busy": "true",
|
|
20092
20220
|
"data-records-skeleton": layout,
|
|
20093
20221
|
className: cn36("flex min-h-0 flex-col", !embedded && "flex-1", className),
|
|
20094
|
-
children: /* @__PURE__ */
|
|
20222
|
+
children: /* @__PURE__ */ jsx61(BodySkeleton, { layout, embedded, rows: rows ?? (embedded ? 5 : "fill") })
|
|
20095
20223
|
}
|
|
20096
20224
|
);
|
|
20097
20225
|
}
|
|
@@ -20106,17 +20234,17 @@ function TablePageSkeleton({
|
|
|
20106
20234
|
const rememberedFace = useRememberedLayout(embedded || layoutAsked ? void 0 : tableId);
|
|
20107
20235
|
const layout = layoutAsked ?? skeletonLayoutFor(rememberedFace);
|
|
20108
20236
|
const painted = rows ?? (remembered === "fill" ? void 0 : remembered);
|
|
20109
|
-
return /* @__PURE__ */
|
|
20110
|
-
/* @__PURE__ */
|
|
20111
|
-
/* @__PURE__ */
|
|
20112
|
-
/* @__PURE__ */
|
|
20113
|
-
/* @__PURE__ */
|
|
20114
|
-
/* @__PURE__ */
|
|
20115
|
-
/* @__PURE__ */
|
|
20116
|
-
/* @__PURE__ */
|
|
20237
|
+
return /* @__PURE__ */ jsx61("div", { className: cn36(TABLE_PAGE_FRAME_CLASS, className), "data-records-skeleton-page": layout, children: /* @__PURE__ */ jsxs55("div", { className: TABLE_PAGE_COLUMN_CLASS, children: [
|
|
20238
|
+
/* @__PURE__ */ jsxs55("div", { className: TABLE_TOOLBAR_ROW_CLASS, "data-table-toolbar": "", "data-records-skeleton-part": "toolbar", "aria-hidden": "true", children: [
|
|
20239
|
+
/* @__PURE__ */ jsx61(Skeleton6, { shape: "control", width: "sm", className: "w-28" }),
|
|
20240
|
+
/* @__PURE__ */ jsx61(Skeleton6, { shape: "control", className: "w-16" }),
|
|
20241
|
+
/* @__PURE__ */ jsx61(Skeleton6, { shape: "control", className: "w-16" }),
|
|
20242
|
+
/* @__PURE__ */ jsxs55("div", { className: "ml-auto flex items-center gap-1.5", children: [
|
|
20243
|
+
/* @__PURE__ */ jsx61(Skeleton6, { shape: "control", width: "md" }),
|
|
20244
|
+
/* @__PURE__ */ jsx61(Skeleton6, { shape: "control", className: "w-24" })
|
|
20117
20245
|
] })
|
|
20118
20246
|
] }),
|
|
20119
|
-
/* @__PURE__ */
|
|
20247
|
+
/* @__PURE__ */ jsx61("div", { className: "flex min-h-0 flex-1 flex-col gap-2", "data-table-records": "", children: /* @__PURE__ */ jsx61(RecordsSkeleton, { layout, embedded, ...painted !== void 0 ? { rows: painted } : {} }) })
|
|
20120
20248
|
] }) });
|
|
20121
20249
|
}
|
|
20122
20250
|
|
|
@@ -20194,7 +20322,7 @@ function useTableDecorations(tableId, revision) {
|
|
|
20194
20322
|
import { stableFilterKey } from "@ai-matrx/records";
|
|
20195
20323
|
import { Button as Button31 } from "@ai-matrx/design-system";
|
|
20196
20324
|
import { formatCount as formatCount2 } from "@ai-matrx/kit/format";
|
|
20197
|
-
import { jsx as
|
|
20325
|
+
import { jsx as jsx62, jsxs as jsxs56 } from "react/jsx-runtime";
|
|
20198
20326
|
function lockedRowsWords(count) {
|
|
20199
20327
|
return `${formatCount2(count)} ${count === 1 ? "record" : "records"} you can't open`;
|
|
20200
20328
|
}
|
|
@@ -20227,7 +20355,7 @@ function emptyWords(args) {
|
|
|
20227
20355
|
cause,
|
|
20228
20356
|
title: typed2 !== "" ? `No matches for \u201C${typed2}\u201D` : NO_ROWS_MATCH,
|
|
20229
20357
|
...args.onClear ? {
|
|
20230
|
-
action: /* @__PURE__ */
|
|
20358
|
+
action: /* @__PURE__ */ jsx62(Button31, { type: "button", variant: "outline", size: "sm", "data-records-clear-filters": "", onClick: args.onClear, children: searchOnly ? "Clear search" : "Clear filters" })
|
|
20231
20359
|
} : {}
|
|
20232
20360
|
};
|
|
20233
20361
|
}
|
|
@@ -20239,15 +20367,15 @@ function emptyWords(args) {
|
|
|
20239
20367
|
};
|
|
20240
20368
|
}
|
|
20241
20369
|
function EmptyRecords({ words: words2 }) {
|
|
20242
|
-
return /* @__PURE__ */
|
|
20370
|
+
return /* @__PURE__ */ jsxs56(
|
|
20243
20371
|
"div",
|
|
20244
20372
|
{
|
|
20245
20373
|
className: "flex flex-col items-center gap-1.5 rounded border border-dashed p-6 text-center",
|
|
20246
20374
|
"data-records-empty": words2.cause,
|
|
20247
20375
|
role: "status",
|
|
20248
20376
|
children: [
|
|
20249
|
-
/* @__PURE__ */
|
|
20250
|
-
words2.description ? /* @__PURE__ */
|
|
20377
|
+
/* @__PURE__ */ jsx62("p", { className: "text-sm font-medium", children: words2.title }),
|
|
20378
|
+
words2.description ? /* @__PURE__ */ jsx62("p", { className: "text-xs text-muted-foreground", children: words2.description }) : null,
|
|
20251
20379
|
words2.action ?? null
|
|
20252
20380
|
]
|
|
20253
20381
|
}
|
|
@@ -20332,7 +20460,7 @@ import {
|
|
|
20332
20460
|
DialogHeader as DialogHeader4,
|
|
20333
20461
|
DialogTitle as DialogTitle4
|
|
20334
20462
|
} from "@ai-matrx/design-system";
|
|
20335
|
-
import { jsx as
|
|
20463
|
+
import { jsx as jsx63, jsxs as jsxs57 } from "react/jsx-runtime";
|
|
20336
20464
|
function mergeConsequence(other, survivor) {
|
|
20337
20465
|
return `\u201C${other}\u201D goes into \u201C${survivor}\u201D: its links move here and its other values are kept as alternates. Undo puts it back.`;
|
|
20338
20466
|
}
|
|
@@ -20391,16 +20519,16 @@ function MergeRecordDialog({ tableId, record, open, onOpenChange, onMerged }) {
|
|
|
20391
20519
|
}
|
|
20392
20520
|
});
|
|
20393
20521
|
};
|
|
20394
|
-
return /* @__PURE__ */
|
|
20395
|
-
/* @__PURE__ */
|
|
20396
|
-
/* @__PURE__ */
|
|
20522
|
+
return /* @__PURE__ */ jsx63(Dialog4, { open, onOpenChange: close, children: /* @__PURE__ */ jsxs57(DialogContent4, { className: "sm:max-w-md", "data-records-merge": record.id, children: [
|
|
20523
|
+
/* @__PURE__ */ jsxs57(DialogHeader4, { children: [
|
|
20524
|
+
/* @__PURE__ */ jsxs57(DialogTitle4, { children: [
|
|
20397
20525
|
"Merge into \u201C",
|
|
20398
20526
|
record.name,
|
|
20399
20527
|
"\u201D"
|
|
20400
20528
|
] }),
|
|
20401
|
-
/* @__PURE__ */
|
|
20529
|
+
/* @__PURE__ */ jsx63(DialogDescription2, { children: other ? mergeConsequence(otherName, record.name) : "Pick the record to merge into this one." })
|
|
20402
20530
|
] }),
|
|
20403
|
-
/* @__PURE__ */
|
|
20531
|
+
/* @__PURE__ */ jsx63(
|
|
20404
20532
|
CreatablePicker,
|
|
20405
20533
|
{
|
|
20406
20534
|
value: other,
|
|
@@ -20413,10 +20541,10 @@ function MergeRecordDialog({ tableId, record, open, onOpenChange, onMerged }) {
|
|
|
20413
20541
|
ariaLabel: "Record to merge"
|
|
20414
20542
|
}
|
|
20415
20543
|
),
|
|
20416
|
-
refusal3 ? /* @__PURE__ */
|
|
20417
|
-
/* @__PURE__ */
|
|
20418
|
-
/* @__PURE__ */
|
|
20419
|
-
/* @__PURE__ */
|
|
20544
|
+
refusal3 ? /* @__PURE__ */ jsx63(RefusalNotice, { error: refusal3 }) : null,
|
|
20545
|
+
/* @__PURE__ */ jsxs57(DialogFooter, { children: [
|
|
20546
|
+
/* @__PURE__ */ jsx63(Button32, { variant: "ghost", size: "sm", onClick: () => close(false), disabled: busy, children: "Cancel" }),
|
|
20547
|
+
/* @__PURE__ */ jsx63(Button32, { size: "sm", onClick: () => void merge(), disabled: !other || busy, "data-records-merge-go": "", children: busy ? "Merging\u2026" : "Merge" })
|
|
20420
20548
|
] })
|
|
20421
20549
|
] }) });
|
|
20422
20550
|
}
|
|
@@ -20507,7 +20635,7 @@ function recordActions(input) {
|
|
|
20507
20635
|
|
|
20508
20636
|
// src/SplitRecordDialog.tsx
|
|
20509
20637
|
init_recordVersions();
|
|
20510
|
-
import { jsx as
|
|
20638
|
+
import { jsx as jsx64, jsxs as jsxs58 } from "react/jsx-runtime";
|
|
20511
20639
|
function valueWords(value) {
|
|
20512
20640
|
if (value === null || value === void 0) return "";
|
|
20513
20641
|
const text = typeof value === "string" ? value : typeof value === "object" ? JSON.stringify(value) : String(value);
|
|
@@ -20610,21 +20738,21 @@ function SplitRecordDialog({ tableId, record, document: document2, open, onOpenC
|
|
|
20610
20738
|
};
|
|
20611
20739
|
const stays = filled.filter((f) => !moving.has(f.key));
|
|
20612
20740
|
const moves = filled.filter((f) => moving.has(f.key));
|
|
20613
|
-
return /* @__PURE__ */
|
|
20614
|
-
/* @__PURE__ */
|
|
20615
|
-
/* @__PURE__ */
|
|
20741
|
+
return /* @__PURE__ */ jsx64(Dialog5, { open, onOpenChange: close, children: /* @__PURE__ */ jsxs58(DialogContent5, { className: "sm:max-w-lg", "data-records-split": record.id, children: [
|
|
20742
|
+
/* @__PURE__ */ jsxs58(DialogHeader5, { children: [
|
|
20743
|
+
/* @__PURE__ */ jsxs58(DialogTitle5, { children: [
|
|
20616
20744
|
"Split \u201C",
|
|
20617
20745
|
record.name,
|
|
20618
20746
|
"\u201D"
|
|
20619
20747
|
] }),
|
|
20620
|
-
/* @__PURE__ */
|
|
20748
|
+
/* @__PURE__ */ jsx64(DialogDescription3, { children: "Move to the new record" })
|
|
20621
20749
|
] }),
|
|
20622
|
-
/* @__PURE__ */
|
|
20623
|
-
/* @__PURE__ */
|
|
20624
|
-
/* @__PURE__ */
|
|
20625
|
-
/* @__PURE__ */
|
|
20626
|
-
] }) : filled.length === 0 ? /* @__PURE__ */
|
|
20627
|
-
/* @__PURE__ */
|
|
20750
|
+
/* @__PURE__ */ jsx64("div", { className: "min-h-32", children: fields.loading && !fields.data ? /* @__PURE__ */ jsxs58("div", { className: "flex flex-col gap-2", "data-records-split-loading": "", children: [
|
|
20751
|
+
/* @__PURE__ */ jsx64(Skeleton7, { className: "h-6 w-full" }),
|
|
20752
|
+
/* @__PURE__ */ jsx64(Skeleton7, { className: "h-6 w-full" }),
|
|
20753
|
+
/* @__PURE__ */ jsx64(Skeleton7, { className: "h-6 w-full" })
|
|
20754
|
+
] }) : filled.length === 0 ? /* @__PURE__ */ jsx64("p", { className: "text-sm text-muted-foreground", "data-records-split-empty": "", children: "No values to move" }) : /* @__PURE__ */ jsx64("ul", { className: "flex max-h-56 flex-col gap-1 overflow-y-auto", "data-records-split-fields": "", children: filled.map((f) => /* @__PURE__ */ jsx64("li", { children: /* @__PURE__ */ jsxs58("label", { className: "flex min-w-0 items-center gap-2 text-sm", children: [
|
|
20755
|
+
/* @__PURE__ */ jsx64(
|
|
20628
20756
|
Checkbox9,
|
|
20629
20757
|
{
|
|
20630
20758
|
checked: moving.has(f.key),
|
|
@@ -20633,23 +20761,23 @@ function SplitRecordDialog({ tableId, record, document: document2, open, onOpenC
|
|
|
20633
20761
|
"data-records-split-field": f.key
|
|
20634
20762
|
}
|
|
20635
20763
|
),
|
|
20636
|
-
/* @__PURE__ */
|
|
20637
|
-
/* @__PURE__ */
|
|
20764
|
+
/* @__PURE__ */ jsx64("span", { className: "shrink-0 font-medium", children: fieldName(f) }),
|
|
20765
|
+
/* @__PURE__ */ jsx64("span", { className: "min-w-0 truncate text-muted-foreground", children: valueWords(doc[f.key]) })
|
|
20638
20766
|
] }) }, f.key)) }) }),
|
|
20639
|
-
/* @__PURE__ */
|
|
20640
|
-
/* @__PURE__ */
|
|
20641
|
-
/* @__PURE__ */
|
|
20642
|
-
/* @__PURE__ */
|
|
20767
|
+
/* @__PURE__ */ jsxs58("div", { className: "grid grid-cols-2 gap-3 text-xs", "data-records-split-preview": "", children: [
|
|
20768
|
+
/* @__PURE__ */ jsxs58("div", { children: [
|
|
20769
|
+
/* @__PURE__ */ jsx64("div", { className: "mb-1 font-medium text-muted-foreground", children: "Stays" }),
|
|
20770
|
+
/* @__PURE__ */ jsx64("ul", { "data-records-split-stays": "", children: stays.map((f) => /* @__PURE__ */ jsx64("li", { className: "truncate", children: fieldName(f) }, f.key)) })
|
|
20643
20771
|
] }),
|
|
20644
|
-
/* @__PURE__ */
|
|
20645
|
-
/* @__PURE__ */
|
|
20646
|
-
/* @__PURE__ */
|
|
20772
|
+
/* @__PURE__ */ jsxs58("div", { children: [
|
|
20773
|
+
/* @__PURE__ */ jsx64("div", { className: "mb-1 font-medium text-muted-foreground", children: "Moves" }),
|
|
20774
|
+
/* @__PURE__ */ jsx64("ul", { "data-records-split-moves": "", children: moves.map((f) => /* @__PURE__ */ jsx64("li", { className: "truncate", children: fieldName(f) }, f.key)) })
|
|
20647
20775
|
] })
|
|
20648
20776
|
] }),
|
|
20649
|
-
refusal3 ? /* @__PURE__ */
|
|
20650
|
-
/* @__PURE__ */
|
|
20651
|
-
/* @__PURE__ */
|
|
20652
|
-
/* @__PURE__ */
|
|
20777
|
+
refusal3 ? /* @__PURE__ */ jsx64(RefusalNotice, { error: refusal3 }) : null,
|
|
20778
|
+
/* @__PURE__ */ jsxs58(DialogFooter2, { children: [
|
|
20779
|
+
/* @__PURE__ */ jsx64(Button33, { variant: "ghost", size: "sm", onClick: () => close(false), disabled: busy, children: "Cancel" }),
|
|
20780
|
+
/* @__PURE__ */ jsx64(Button33, { size: "sm", onClick: () => void split(), disabled: moving.size === 0 || busy, "data-records-split-go": "", children: busy ? "Splitting\u2026" : "Split" })
|
|
20653
20781
|
] })
|
|
20654
20782
|
] }) });
|
|
20655
20783
|
}
|
|
@@ -20765,7 +20893,7 @@ function PersonNamesBridge() {
|
|
|
20765
20893
|
// src/RecordsMount.tsx
|
|
20766
20894
|
init_host();
|
|
20767
20895
|
init_rights();
|
|
20768
|
-
import { jsx as
|
|
20896
|
+
import { jsx as jsx65, jsxs as jsxs59 } from "react/jsx-runtime";
|
|
20769
20897
|
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.";
|
|
20770
20898
|
function storeDecidesRights(_table) {
|
|
20771
20899
|
return NO_RIGHTS;
|
|
@@ -20778,8 +20906,8 @@ function RecordsMount({
|
|
|
20778
20906
|
}) {
|
|
20779
20907
|
const bound2 = useShallowStableHost(host);
|
|
20780
20908
|
void letTheStoreDecideRights;
|
|
20781
|
-
return /* @__PURE__ */
|
|
20782
|
-
/* @__PURE__ */
|
|
20909
|
+
return /* @__PURE__ */ jsx65(RecordsProvider, { config, children: /* @__PURE__ */ jsx65(RecordsUiProvider, { value: bound2, children: /* @__PURE__ */ jsxs59(RecordLabelProvider, { children: [
|
|
20910
|
+
/* @__PURE__ */ jsx65(PersonNamesBridge, {}),
|
|
20783
20911
|
children
|
|
20784
20912
|
] }) }) });
|
|
20785
20913
|
}
|
|
@@ -20805,7 +20933,7 @@ init_tablePicking();
|
|
|
20805
20933
|
init_Refusal();
|
|
20806
20934
|
init_refusals();
|
|
20807
20935
|
init_plainWords();
|
|
20808
|
-
import { Fragment as
|
|
20936
|
+
import { Fragment as Fragment23, jsx as jsx66, jsxs as jsxs60 } from "react/jsx-runtime";
|
|
20809
20937
|
var SHARED_FOR_MS = 5e3;
|
|
20810
20938
|
var sharedReads = /* @__PURE__ */ new WeakMap();
|
|
20811
20939
|
function readTablesAnywhere(dataSource) {
|
|
@@ -20875,16 +21003,16 @@ function TablePicker({ dataSource, value, onChange, disabled, tables }) {
|
|
|
20875
21003
|
hint: t.organization_name,
|
|
20876
21004
|
keywords: t.organization_name,
|
|
20877
21005
|
...twin && second ? {
|
|
20878
|
-
render: /* @__PURE__ */
|
|
20879
|
-
/* @__PURE__ */
|
|
20880
|
-
/* @__PURE__ */
|
|
21006
|
+
render: /* @__PURE__ */ jsxs60("span", { className: "flex min-w-0 flex-col", children: [
|
|
21007
|
+
/* @__PURE__ */ jsx66("span", { className: "truncate", children: t.table_name }),
|
|
21008
|
+
/* @__PURE__ */ jsx66("span", { className: "truncate text-[11px] text-muted-foreground", children: second })
|
|
20881
21009
|
] })
|
|
20882
21010
|
} : {}
|
|
20883
21011
|
};
|
|
20884
21012
|
});
|
|
20885
21013
|
const missing = Boolean(value) && !list.loading && !list.error && !list.rows.some((t) => t.table_id === value);
|
|
20886
|
-
return /* @__PURE__ */
|
|
20887
|
-
/* @__PURE__ */
|
|
21014
|
+
return /* @__PURE__ */ jsxs60("div", { className: "flex flex-col gap-1", children: [
|
|
21015
|
+
/* @__PURE__ */ jsx66(
|
|
20888
21016
|
CreatablePicker2,
|
|
20889
21017
|
{
|
|
20890
21018
|
value: value || null,
|
|
@@ -20898,17 +21026,17 @@ function TablePicker({ dataSource, value, onChange, disabled, tables }) {
|
|
|
20898
21026
|
ariaLabel: "Table"
|
|
20899
21027
|
}
|
|
20900
21028
|
),
|
|
20901
|
-
list.error && /* @__PURE__ */
|
|
20902
|
-
missing && /* @__PURE__ */
|
|
21029
|
+
list.error && /* @__PURE__ */ jsx66(RefusalLine, { error: (0, refusals_exports.refusal)("door", list.error, "Try again in a moment.") }),
|
|
21030
|
+
missing && /* @__PURE__ */ jsx66("p", { className: "text-[11px] text-destructive", children: "This table is archived or not shared with you." })
|
|
20903
21031
|
] });
|
|
20904
21032
|
}
|
|
20905
21033
|
function TableScope({ dataSource, userId, tableId, children, fallback = null, unavailable, tables }) {
|
|
20906
21034
|
const own3 = useTablesAnywhere(dataSource);
|
|
20907
21035
|
const list = tables ?? own3;
|
|
20908
21036
|
const organizationId = list.rows.find((t) => t.table_id === tableId)?.organization_id ?? null;
|
|
20909
|
-
if (tableId && !organizationId && !list.loading) return /* @__PURE__ */
|
|
20910
|
-
if (!tableId || !organizationId) return /* @__PURE__ */
|
|
20911
|
-
return /* @__PURE__ */
|
|
21037
|
+
if (tableId && !organizationId && !list.loading) return /* @__PURE__ */ jsx66(Fragment23, { children: unavailable ?? fallback });
|
|
21038
|
+
if (!tableId || !organizationId) return /* @__PURE__ */ jsx66(Fragment23, { children: fallback });
|
|
21039
|
+
return /* @__PURE__ */ jsx66(RecordsProvider2, { config: { dataSource, actor: personActor(userId), organizationId }, children });
|
|
20912
21040
|
}
|
|
20913
21041
|
function ColumnValuesEditor({ tableId, value, onChange, disabled, addLabel }) {
|
|
20914
21042
|
const fields = useFields6(tableId);
|
|
@@ -20928,11 +21056,11 @@ function ColumnValuesEditor({ tableId, value, onChange, disabled, addLabel }) {
|
|
|
20928
21056
|
void _gone;
|
|
20929
21057
|
onChange(rest);
|
|
20930
21058
|
};
|
|
20931
|
-
return /* @__PURE__ */
|
|
20932
|
-
fields.error && /* @__PURE__ */
|
|
21059
|
+
return /* @__PURE__ */ jsxs60("div", { className: "flex flex-col gap-2", children: [
|
|
21060
|
+
fields.error && /* @__PURE__ */ jsx66(RefusalLine, { error: fields.error }),
|
|
20933
21061
|
keys.map((key) => {
|
|
20934
21062
|
const field2 = byKey.get(key);
|
|
20935
|
-
return /* @__PURE__ */
|
|
21063
|
+
return /* @__PURE__ */ jsx66(
|
|
20936
21064
|
ColumnValueRow,
|
|
20937
21065
|
{
|
|
20938
21066
|
columnKey: key,
|
|
@@ -20948,7 +21076,7 @@ function ColumnValuesEditor({ tableId, value, onChange, disabled, addLabel }) {
|
|
|
20948
21076
|
key
|
|
20949
21077
|
);
|
|
20950
21078
|
}),
|
|
20951
|
-
adding && /* @__PURE__ */
|
|
21079
|
+
adding && /* @__PURE__ */ jsx66(
|
|
20952
21080
|
ColumnValueRow,
|
|
20953
21081
|
{
|
|
20954
21082
|
columnKey: null,
|
|
@@ -20965,7 +21093,7 @@ function ColumnValuesEditor({ tableId, value, onChange, disabled, addLabel }) {
|
|
|
20965
21093
|
onRemove: () => setAdding(false)
|
|
20966
21094
|
}
|
|
20967
21095
|
),
|
|
20968
|
-
!disabled && !adding && keys.length < all.length && /* @__PURE__ */
|
|
21096
|
+
!disabled && !adding && keys.length < all.length && /* @__PURE__ */ jsx66(Button34, { type: "button", variant: "outline", size: "sm", className: "self-start", onClick: () => setAdding(true), children: addLabel })
|
|
20969
21097
|
] });
|
|
20970
21098
|
}
|
|
20971
21099
|
function ColumnValueRow({
|
|
@@ -20981,9 +21109,9 @@ function ColumnValueRow({
|
|
|
20981
21109
|
}) {
|
|
20982
21110
|
const orphan = columnKey !== null && !loading && field2 === void 0;
|
|
20983
21111
|
const shown5 = orphan ? [{ value: columnKey, label: columnKey, hint: "Not a column" }, ...options] : options;
|
|
20984
|
-
return /* @__PURE__ */
|
|
20985
|
-
/* @__PURE__ */
|
|
20986
|
-
/* @__PURE__ */
|
|
21112
|
+
return /* @__PURE__ */ jsxs60("div", { className: "flex flex-col gap-1 rounded-md border border-border/60 p-2", children: [
|
|
21113
|
+
/* @__PURE__ */ jsxs60("div", { className: "flex items-center gap-2", children: [
|
|
21114
|
+
/* @__PURE__ */ jsx66("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsx66(
|
|
20987
21115
|
CreatablePicker2,
|
|
20988
21116
|
{
|
|
20989
21117
|
value: columnKey,
|
|
@@ -20997,9 +21125,9 @@ function ColumnValueRow({
|
|
|
20997
21125
|
ariaLabel: "Column"
|
|
20998
21126
|
}
|
|
20999
21127
|
) }),
|
|
21000
|
-
!disabled && /* @__PURE__ */
|
|
21128
|
+
!disabled && /* @__PURE__ */ jsx66(Button34, { type: "button", variant: "ghost", size: "sm", "aria-label": "Remove", onClick: onRemove, children: "\u2715" })
|
|
21001
21129
|
] }),
|
|
21002
|
-
field2 ? /* @__PURE__ */
|
|
21130
|
+
field2 ? /* @__PURE__ */ jsx66(FieldControl, { field: field2, value, onChange: onValue, disabled }) : orphan ? /* @__PURE__ */ jsx66("p", { className: "text-[11px] text-muted-foreground", children: value === null || value === void 0 ? "\u2014" : String(value) }) : null
|
|
21003
21131
|
] });
|
|
21004
21132
|
}
|
|
21005
21133
|
function RecordPicker({ tableId, value, onChange, disabled }) {
|
|
@@ -21011,8 +21139,8 @@ function RecordPicker({ tableId, value, onChange, disabled }) {
|
|
|
21011
21139
|
label: rowNameIn(table.data ?? null, row)
|
|
21012
21140
|
}));
|
|
21013
21141
|
const missing = Boolean(value) && !records.loading && !records.error && !rows.some((r) => r.id === value);
|
|
21014
|
-
return /* @__PURE__ */
|
|
21015
|
-
/* @__PURE__ */
|
|
21142
|
+
return /* @__PURE__ */ jsxs60("div", { className: "flex flex-col gap-1", children: [
|
|
21143
|
+
/* @__PURE__ */ jsx66(
|
|
21016
21144
|
CreatablePicker2,
|
|
21017
21145
|
{
|
|
21018
21146
|
value: value || null,
|
|
@@ -21026,12 +21154,12 @@ function RecordPicker({ tableId, value, onChange, disabled }) {
|
|
|
21026
21154
|
ariaLabel: "Record"
|
|
21027
21155
|
}
|
|
21028
21156
|
),
|
|
21029
|
-
records.error && /* @__PURE__ */
|
|
21157
|
+
records.error && /* @__PURE__ */ jsx66(RefusalLine, { error: records.error })
|
|
21030
21158
|
] });
|
|
21031
21159
|
}
|
|
21032
21160
|
|
|
21033
21161
|
// src/ExtractParentDialog.tsx
|
|
21034
|
-
import { jsx as
|
|
21162
|
+
import { jsx as jsx67, jsxs as jsxs61 } from "react/jsx-runtime";
|
|
21035
21163
|
function extractConsequence(record, parentTable) {
|
|
21036
21164
|
return `\u201C${record}\u201D will sit under the new ${parentTable} record`;
|
|
21037
21165
|
}
|
|
@@ -21152,21 +21280,21 @@ function ExtractParentDialog({ tableId, record, document: document2, open, onOpe
|
|
|
21152
21280
|
}
|
|
21153
21281
|
});
|
|
21154
21282
|
};
|
|
21155
|
-
return /* @__PURE__ */
|
|
21156
|
-
/* @__PURE__ */
|
|
21157
|
-
/* @__PURE__ */
|
|
21283
|
+
return /* @__PURE__ */ jsx67(Dialog6, { open, onOpenChange: close, children: /* @__PURE__ */ jsxs61(DialogContent6, { className: "sm:max-w-md", "data-records-extract-parent": record.id, children: [
|
|
21284
|
+
/* @__PURE__ */ jsxs61(DialogHeader6, { children: [
|
|
21285
|
+
/* @__PURE__ */ jsxs61(DialogTitle6, { children: [
|
|
21158
21286
|
"Extract parent of \u201C",
|
|
21159
21287
|
record.name,
|
|
21160
21288
|
"\u201D"
|
|
21161
21289
|
] }),
|
|
21162
|
-
/* @__PURE__ */
|
|
21290
|
+
/* @__PURE__ */ jsx67(DialogDescription4, { children: parentId ? extractConsequence(record.name, parentName) : "Pick the parent table" })
|
|
21163
21291
|
] }),
|
|
21164
|
-
/* @__PURE__ */
|
|
21165
|
-
/* @__PURE__ */
|
|
21166
|
-
/* @__PURE__ */
|
|
21167
|
-
/* @__PURE__ */
|
|
21168
|
-
] }) : shared.length === 0 ? /* @__PURE__ */
|
|
21169
|
-
/* @__PURE__ */
|
|
21292
|
+
/* @__PURE__ */ jsx67(TablePicker, { dataSource: client.config.dataSource, value: parentId, onChange: pick, tables: pickable, disabled: busy }),
|
|
21293
|
+
/* @__PURE__ */ jsx67("div", { className: "min-h-24", "data-records-extract-values": "", children: !parentId ? null : loadingShared ? /* @__PURE__ */ jsxs61("div", { className: "flex flex-col gap-2", children: [
|
|
21294
|
+
/* @__PURE__ */ jsx67(Skeleton8, { className: "h-6 w-full" }),
|
|
21295
|
+
/* @__PURE__ */ jsx67(Skeleton8, { className: "h-6 w-full" })
|
|
21296
|
+
] }) : shared.length === 0 ? /* @__PURE__ */ jsx67("p", { className: "text-sm text-muted-foreground", "data-records-extract-none": "", children: "No matching values" }) : /* @__PURE__ */ jsx67("ul", { className: "flex max-h-48 flex-col gap-1 overflow-y-auto", children: shared.map((f) => /* @__PURE__ */ jsx67("li", { children: /* @__PURE__ */ jsxs61("label", { className: "flex min-w-0 items-center gap-2 text-sm", children: [
|
|
21297
|
+
/* @__PURE__ */ jsx67(
|
|
21170
21298
|
Checkbox10,
|
|
21171
21299
|
{
|
|
21172
21300
|
checked: copying.has(f.key),
|
|
@@ -21175,10 +21303,10 @@ function ExtractParentDialog({ tableId, record, document: document2, open, onOpe
|
|
|
21175
21303
|
"data-records-extract-field": f.key
|
|
21176
21304
|
}
|
|
21177
21305
|
),
|
|
21178
|
-
/* @__PURE__ */
|
|
21179
|
-
/* @__PURE__ */
|
|
21306
|
+
/* @__PURE__ */ jsx67("span", { className: "shrink-0 font-medium", children: fieldName(f) }),
|
|
21307
|
+
/* @__PURE__ */ jsx67("span", { className: "min-w-0 truncate text-muted-foreground", children: valueWords(doc[f.key]) })
|
|
21180
21308
|
] }) }, f.key)) }) }),
|
|
21181
|
-
parentId ? /* @__PURE__ */
|
|
21309
|
+
parentId ? /* @__PURE__ */ jsx67(
|
|
21182
21310
|
Input2,
|
|
21183
21311
|
{
|
|
21184
21312
|
value: parentNameTyped,
|
|
@@ -21189,10 +21317,10 @@ function ExtractParentDialog({ tableId, record, document: document2, open, onOpe
|
|
|
21189
21317
|
"data-records-extract-name": ""
|
|
21190
21318
|
}
|
|
21191
21319
|
) : null,
|
|
21192
|
-
refusal3 ? /* @__PURE__ */
|
|
21193
|
-
/* @__PURE__ */
|
|
21194
|
-
/* @__PURE__ */
|
|
21195
|
-
/* @__PURE__ */
|
|
21320
|
+
refusal3 ? /* @__PURE__ */ jsx67(RefusalNotice, { error: refusal3 }) : null,
|
|
21321
|
+
/* @__PURE__ */ jsxs61(DialogFooter3, { children: [
|
|
21322
|
+
/* @__PURE__ */ jsx67(Button35, { variant: "ghost", size: "sm", onClick: () => close(false), disabled: busy, children: "Cancel" }),
|
|
21323
|
+
/* @__PURE__ */ jsx67(Button35, { size: "sm", onClick: () => void extract(), disabled: !parentId || loadingShared || busy || !hasChoice, "data-records-extract-go": "", children: busy ? "Extracting\u2026" : "Extract" })
|
|
21196
21324
|
] })
|
|
21197
21325
|
] }) });
|
|
21198
21326
|
}
|
|
@@ -21226,7 +21354,7 @@ import {
|
|
|
21226
21354
|
STYLE_COLORS as STYLE_COLORS4,
|
|
21227
21355
|
STYLE_COLOR_LABELS as STYLE_COLOR_LABELS3
|
|
21228
21356
|
} from "@ai-matrx/design-system/data-table";
|
|
21229
|
-
import { jsx as
|
|
21357
|
+
import { jsx as jsx68, jsxs as jsxs62 } from "react/jsx-runtime";
|
|
21230
21358
|
function isChoiceField(field2) {
|
|
21231
21359
|
const kind2 = String(editorKindFor(field2));
|
|
21232
21360
|
return kind2 === "select" || kind2 === "multi_select";
|
|
@@ -21519,7 +21647,7 @@ function useGridColours(args) {
|
|
|
21519
21647
|
},
|
|
21520
21648
|
[enabled, decorations.data, refusal3, write]
|
|
21521
21649
|
);
|
|
21522
|
-
const dialogs = enabled ? /* @__PURE__ */
|
|
21650
|
+
const dialogs = enabled ? /* @__PURE__ */ jsx68(
|
|
21523
21651
|
ColourRulesDialog,
|
|
21524
21652
|
{
|
|
21525
21653
|
open: rulesOpen !== null,
|
|
@@ -21546,12 +21674,12 @@ function useGridColours(args) {
|
|
|
21546
21674
|
) : null;
|
|
21547
21675
|
const colourable = fields.filter(colourableBy);
|
|
21548
21676
|
const byId = decorations.data?.color_by?.field ?? null;
|
|
21549
|
-
const sheet = enabled ? /* @__PURE__ */
|
|
21550
|
-
/* @__PURE__ */
|
|
21551
|
-
mayColour ? /* @__PURE__ */
|
|
21552
|
-
/* @__PURE__ */
|
|
21553
|
-
/* @__PURE__ */
|
|
21554
|
-
/* @__PURE__ */
|
|
21677
|
+
const sheet = enabled ? /* @__PURE__ */ jsxs62("div", { className: "flex flex-col gap-1.5", "data-records-grid-sheet-colours": "", children: [
|
|
21678
|
+
/* @__PURE__ */ jsx68("span", { className: "text-xs font-medium text-muted-foreground", children: "Colours" }),
|
|
21679
|
+
mayColour ? /* @__PURE__ */ jsxs62("div", { className: "flex items-center gap-2", children: [
|
|
21680
|
+
/* @__PURE__ */ jsxs62("label", { className: "flex min-w-0 flex-1 items-center gap-2 text-xs text-muted-foreground", children: [
|
|
21681
|
+
/* @__PURE__ */ jsx68("span", { className: "shrink-0", children: "Colour rows by" }),
|
|
21682
|
+
/* @__PURE__ */ jsx68(
|
|
21555
21683
|
PickOne,
|
|
21556
21684
|
{
|
|
21557
21685
|
label: "Colour rows by",
|
|
@@ -21565,8 +21693,8 @@ function useGridColours(args) {
|
|
|
21565
21693
|
}
|
|
21566
21694
|
)
|
|
21567
21695
|
] }),
|
|
21568
|
-
/* @__PURE__ */
|
|
21569
|
-
] }) : /* @__PURE__ */
|
|
21696
|
+
/* @__PURE__ */ jsx68(Button36, { type: "button", size: "sm", variant: "outline", className: "h-10 shrink-0", onClick: () => setRulesOpen(colourable[0]?.key ?? fields[0]?.key ?? ""), children: "Colour rules\u2026" })
|
|
21697
|
+
] }) : /* @__PURE__ */ jsx68("p", { className: "text-xs text-muted-foreground", children: whyNot })
|
|
21570
21698
|
] }) : null;
|
|
21571
21699
|
return { headerItem, cellItem, cellsItem, rowItem, dialogs, sheet };
|
|
21572
21700
|
}
|
|
@@ -21614,15 +21742,15 @@ function ColourRulesDialog({
|
|
|
21614
21742
|
onClose();
|
|
21615
21743
|
};
|
|
21616
21744
|
const first = startField ?? fields[0]?.key ?? "";
|
|
21617
|
-
return /* @__PURE__ */
|
|
21618
|
-
/* @__PURE__ */
|
|
21619
|
-
/* @__PURE__ */
|
|
21620
|
-
/* @__PURE__ */
|
|
21745
|
+
return /* @__PURE__ */ jsx68(Dialog7, { open, onOpenChange: (next) => !next ? close() : void 0, children: /* @__PURE__ */ jsxs62(DialogContent7, { className: "sm:max-w-2xl", "data-records-colour-rules": "", children: [
|
|
21746
|
+
/* @__PURE__ */ jsxs62(DialogHeader7, { children: [
|
|
21747
|
+
/* @__PURE__ */ jsx68(DialogTitle7, { children: "Colour rules" }),
|
|
21748
|
+
/* @__PURE__ */ jsx68(DialogDescription5, { children: scope === "view" ? "The first rule a row matches wins. These rules belong to this view alone, and a date can be tested against today." : "The first rule a row matches wins. A rule tints the whole row, or only the cell it reads. Everyone who opens this table sees them." })
|
|
21621
21749
|
] }),
|
|
21622
|
-
/* @__PURE__ */
|
|
21623
|
-
viewRules ? /* @__PURE__ */
|
|
21624
|
-
/* @__PURE__ */
|
|
21625
|
-
/* @__PURE__ */
|
|
21750
|
+
/* @__PURE__ */ jsxs62("div", { className: "flex flex-col gap-2", children: [
|
|
21751
|
+
viewRules ? /* @__PURE__ */ jsxs62("div", { className: "flex items-center gap-1.5 text-xs", "data-records-colour-rules-scope": "", children: [
|
|
21752
|
+
/* @__PURE__ */ jsx68("span", { className: "text-muted-foreground", children: "Keep them on" }),
|
|
21753
|
+
/* @__PURE__ */ jsx68(
|
|
21626
21754
|
PickOne,
|
|
21627
21755
|
{
|
|
21628
21756
|
label: "Where the rules are kept",
|
|
@@ -21639,10 +21767,10 @@ function ColourRulesDialog({
|
|
|
21639
21767
|
}
|
|
21640
21768
|
)
|
|
21641
21769
|
] }) : null,
|
|
21642
|
-
rows.length === 0 ? /* @__PURE__ */
|
|
21643
|
-
rows.map((rule, i) => /* @__PURE__ */
|
|
21644
|
-
/* @__PURE__ */
|
|
21645
|
-
/* @__PURE__ */
|
|
21770
|
+
rows.length === 0 ? /* @__PURE__ */ jsx68("p", { className: "text-xs text-muted-foreground", children: "No rules yet." }) : null,
|
|
21771
|
+
rows.map((rule, i) => /* @__PURE__ */ jsxs62("div", { className: "flex flex-wrap items-center gap-1.5 text-xs", "data-records-colour-rule": "", children: [
|
|
21772
|
+
/* @__PURE__ */ jsx68("span", { className: "text-muted-foreground", children: i === 0 ? "When" : "Else when" }),
|
|
21773
|
+
/* @__PURE__ */ jsx68(
|
|
21646
21774
|
PickOne,
|
|
21647
21775
|
{
|
|
21648
21776
|
label: "Column",
|
|
@@ -21652,7 +21780,7 @@ function ColourRulesDialog({
|
|
|
21652
21780
|
options: fields.map((f) => ({ value: f.key, label: fieldName(f) }))
|
|
21653
21781
|
}
|
|
21654
21782
|
),
|
|
21655
|
-
/* @__PURE__ */
|
|
21783
|
+
/* @__PURE__ */ jsx68(
|
|
21656
21784
|
PickOne,
|
|
21657
21785
|
{
|
|
21658
21786
|
label: "Test",
|
|
@@ -21666,7 +21794,7 @@ function ColourRulesDialog({
|
|
|
21666
21794
|
}))
|
|
21667
21795
|
}
|
|
21668
21796
|
),
|
|
21669
|
-
OPS_WITH_VALUE.includes(rule.op) && choicesOf(rule.field) ? /* @__PURE__ */
|
|
21797
|
+
OPS_WITH_VALUE.includes(rule.op) && choicesOf(rule.field) ? /* @__PURE__ */ jsx68(
|
|
21670
21798
|
PickOne,
|
|
21671
21799
|
{
|
|
21672
21800
|
label: "Choice",
|
|
@@ -21677,7 +21805,7 @@ function ColourRulesDialog({
|
|
|
21677
21805
|
onChange: (picked) => set(i, { value: picked }),
|
|
21678
21806
|
options: choicesOf(rule.field).map((option) => ({ value: option.id, label: option.label }))
|
|
21679
21807
|
}
|
|
21680
|
-
) : OPS_WITH_VALUE.includes(rule.op) ? /* @__PURE__ */
|
|
21808
|
+
) : OPS_WITH_VALUE.includes(rule.op) ? /* @__PURE__ */ jsx68(
|
|
21681
21809
|
"input",
|
|
21682
21810
|
{
|
|
21683
21811
|
"aria-label": "Value",
|
|
@@ -21687,8 +21815,8 @@ function ColourRulesDialog({
|
|
|
21687
21815
|
onChange: (e) => set(i, { value: e.target.value })
|
|
21688
21816
|
}
|
|
21689
21817
|
) : null,
|
|
21690
|
-
/* @__PURE__ */
|
|
21691
|
-
/* @__PURE__ */
|
|
21818
|
+
/* @__PURE__ */ jsx68("span", { className: "text-muted-foreground", children: "tint" }),
|
|
21819
|
+
/* @__PURE__ */ jsx68(
|
|
21692
21820
|
PickOne,
|
|
21693
21821
|
{
|
|
21694
21822
|
label: "Tint",
|
|
@@ -21701,7 +21829,7 @@ function ColourRulesDialog({
|
|
|
21701
21829
|
]
|
|
21702
21830
|
}
|
|
21703
21831
|
),
|
|
21704
|
-
/* @__PURE__ */
|
|
21832
|
+
/* @__PURE__ */ jsx68(
|
|
21705
21833
|
PickOne,
|
|
21706
21834
|
{
|
|
21707
21835
|
label: "Colour",
|
|
@@ -21712,9 +21840,9 @@ function ColourRulesDialog({
|
|
|
21712
21840
|
options: STYLE_COLORS4.map((c) => ({ value: c, label: STYLE_COLOR_LABELS3[c] }))
|
|
21713
21841
|
}
|
|
21714
21842
|
),
|
|
21715
|
-
/* @__PURE__ */
|
|
21843
|
+
/* @__PURE__ */ jsx68(Button36, { type: "button", size: "sm", variant: "ghost", onClick: () => setDrafts(rows.filter((_, j) => j !== i)), children: "Remove" })
|
|
21716
21844
|
] }, rule.id ?? `new-${i}`)),
|
|
21717
|
-
/* @__PURE__ */
|
|
21845
|
+
/* @__PURE__ */ jsx68("div", { children: /* @__PURE__ */ jsx68(
|
|
21718
21846
|
Button36,
|
|
21719
21847
|
{
|
|
21720
21848
|
type: "button",
|
|
@@ -21726,9 +21854,9 @@ function ColourRulesDialog({
|
|
|
21726
21854
|
}
|
|
21727
21855
|
) })
|
|
21728
21856
|
] }),
|
|
21729
|
-
/* @__PURE__ */
|
|
21730
|
-
/* @__PURE__ */
|
|
21731
|
-
/* @__PURE__ */
|
|
21857
|
+
/* @__PURE__ */ jsxs62(DialogFooter4, { children: [
|
|
21858
|
+
/* @__PURE__ */ jsx68(Button36, { type: "button", size: "sm", variant: "ghost", onClick: close, children: "Cancel" }),
|
|
21859
|
+
/* @__PURE__ */ jsx68(
|
|
21732
21860
|
Button36,
|
|
21733
21861
|
{
|
|
21734
21862
|
type: "button",
|
|
@@ -21766,7 +21894,7 @@ init_recordVersions();
|
|
|
21766
21894
|
init_writeOnTheWinningVersion();
|
|
21767
21895
|
init_plainWords();
|
|
21768
21896
|
init_PickOne();
|
|
21769
|
-
import { jsx as
|
|
21897
|
+
import { jsx as jsx69, jsxs as jsxs63 } from "react/jsx-runtime";
|
|
21770
21898
|
function labelColumns(fields) {
|
|
21771
21899
|
return [...fields].filter((f) => rowLabelRefusal(f) === void 0).sort(compareFieldOrder);
|
|
21772
21900
|
}
|
|
@@ -21857,14 +21985,14 @@ function RowLabelPicker({
|
|
|
21857
21985
|
onOpenChange(false);
|
|
21858
21986
|
onSaved();
|
|
21859
21987
|
};
|
|
21860
|
-
return /* @__PURE__ */
|
|
21861
|
-
/* @__PURE__ */
|
|
21862
|
-
/* @__PURE__ */
|
|
21863
|
-
/* @__PURE__ */
|
|
21988
|
+
return /* @__PURE__ */ jsx69(Dialog8, { open, onOpenChange, children: /* @__PURE__ */ jsxs63(DialogContent8, { className: "sm:max-w-lg", "data-records-row-label-picker": "", children: [
|
|
21989
|
+
/* @__PURE__ */ jsxs63(DialogHeader8, { children: [
|
|
21990
|
+
/* @__PURE__ */ jsx69(DialogTitle8, { children: "What names each record" }),
|
|
21991
|
+
/* @__PURE__ */ jsx69(DialogDescription6, { children: "The name every link, peek, copy, reference and agent calls a record by." })
|
|
21864
21992
|
] }),
|
|
21865
|
-
/* @__PURE__ */
|
|
21866
|
-
/* @__PURE__ */
|
|
21867
|
-
/* @__PURE__ */
|
|
21993
|
+
/* @__PURE__ */ jsxs63("div", { className: "flex items-center gap-1", role: "group", "aria-label": "How records are named", children: [
|
|
21994
|
+
/* @__PURE__ */ jsx69(Button37, { type: "button", size: "sm", variant: mode === "column" ? "secondary" : "ghost", "aria-pressed": mode === "column", onClick: () => setMode("column"), children: "One column" }),
|
|
21995
|
+
/* @__PURE__ */ jsx69(
|
|
21868
21996
|
Button37,
|
|
21869
21997
|
{
|
|
21870
21998
|
type: "button",
|
|
@@ -21877,9 +22005,9 @@ function RowLabelPicker({
|
|
|
21877
22005
|
}
|
|
21878
22006
|
)
|
|
21879
22007
|
] }),
|
|
21880
|
-
mode === "column" ? /* @__PURE__ */
|
|
22008
|
+
mode === "column" ? /* @__PURE__ */ jsxs63("label", { className: "flex flex-col gap-1 text-xs", children: [
|
|
21881
22009
|
"Column",
|
|
21882
|
-
/* @__PURE__ */
|
|
22010
|
+
/* @__PURE__ */ jsx69(
|
|
21883
22011
|
PickOne,
|
|
21884
22012
|
{
|
|
21885
22013
|
label: "Column",
|
|
@@ -21890,9 +22018,9 @@ function RowLabelPicker({
|
|
|
21890
22018
|
options: columns.map((f) => ({ value: f.key, label: `${fieldName(f)}${f.key === current && !keptFormula ? " (now)" : ""}` }))
|
|
21891
22019
|
}
|
|
21892
22020
|
),
|
|
21893
|
-
keptFormula ? /* @__PURE__ */
|
|
21894
|
-
] }) : /* @__PURE__ */
|
|
21895
|
-
/* @__PURE__ */
|
|
22021
|
+
keptFormula ? /* @__PURE__ */ jsx69("span", { className: "text-[11px] text-muted-foreground", children: "Replaces the formula that names records now" }) : null
|
|
22022
|
+
] }) : /* @__PURE__ */ jsxs63("div", { className: "flex flex-col gap-1 text-xs", "data-records-row-label-formula": "", children: [
|
|
22023
|
+
/* @__PURE__ */ jsx69(
|
|
21896
22024
|
FormulaTextEditor,
|
|
21897
22025
|
{
|
|
21898
22026
|
tableId,
|
|
@@ -21906,22 +22034,22 @@ function RowLabelPicker({
|
|
|
21906
22034
|
kept && kept.formula && !kept.valid ? (
|
|
21907
22035
|
// HONEST ABOUT A STALE FORMULA: a column it read was renamed or retired, so records are
|
|
21908
22036
|
// named by the column until it is fixed.
|
|
21909
|
-
/* @__PURE__ */
|
|
22037
|
+
/* @__PURE__ */ jsxs63("p", { "data-records-row-label-stale": "", role: "status", className: "text-[11px] text-foreground", children: [
|
|
21910
22038
|
kept.error ?? "This formula no longer reads.",
|
|
21911
22039
|
" Records are named by their column until it is fixed."
|
|
21912
22040
|
] })
|
|
21913
22041
|
) : null,
|
|
21914
|
-
formulaTooLong ? /* @__PURE__ */
|
|
22042
|
+
formulaTooLong ? /* @__PURE__ */ jsxs63("p", { className: "text-[11px] text-foreground", children: [
|
|
21915
22043
|
"Up to ",
|
|
21916
22044
|
ROW_LABEL_FORMULA_MAX_LENGTH,
|
|
21917
22045
|
" characters"
|
|
21918
22046
|
] }) : null
|
|
21919
22047
|
] }),
|
|
21920
|
-
kept && !mayChange ? /* @__PURE__ */
|
|
21921
|
-
refused ? /* @__PURE__ */
|
|
21922
|
-
/* @__PURE__ */
|
|
21923
|
-
/* @__PURE__ */
|
|
21924
|
-
mode === "column" ? /* @__PURE__ */
|
|
22048
|
+
kept && !mayChange ? /* @__PURE__ */ jsx69("p", { "data-records-row-label-not-yours": "", className: "text-xs text-muted-foreground", children: ROW_LABEL_NOT_YOURS }) : null,
|
|
22049
|
+
refused ? /* @__PURE__ */ jsx69("p", { "data-records-row-label-refused": "", className: "text-xs text-destructive", children: refused }) : null,
|
|
22050
|
+
/* @__PURE__ */ jsxs63(DialogFooter5, { children: [
|
|
22051
|
+
/* @__PURE__ */ jsx69(Button37, { type: "button", size: "sm", variant: "ghost", onClick: () => onOpenChange(false), children: "Cancel" }),
|
|
22052
|
+
mode === "column" ? /* @__PURE__ */ jsx69(
|
|
21925
22053
|
Button37,
|
|
21926
22054
|
{
|
|
21927
22055
|
type: "button",
|
|
@@ -21931,7 +22059,7 @@ function RowLabelPicker({
|
|
|
21931
22059
|
onClick: () => void saveColumn(),
|
|
21932
22060
|
children: busy ? "Saving\u2026" : "Use this column"
|
|
21933
22061
|
}
|
|
21934
|
-
) : /* @__PURE__ */
|
|
22062
|
+
) : /* @__PURE__ */ jsx69(
|
|
21935
22063
|
Button37,
|
|
21936
22064
|
{
|
|
21937
22065
|
type: "button",
|
|
@@ -21975,7 +22103,7 @@ init_names();
|
|
|
21975
22103
|
import { useEffect as useEffect42, useState as useState55 } from "react";
|
|
21976
22104
|
import { useRecordsClient as useRecordsClient29 } from "@ai-matrx/records/react";
|
|
21977
22105
|
import { cn as cn37 } from "@ai-matrx/design-system";
|
|
21978
|
-
import { jsx as
|
|
22106
|
+
import { jsx as jsx70, jsxs as jsxs64 } from "react/jsx-runtime";
|
|
21979
22107
|
function isComputed(field2) {
|
|
21980
22108
|
const kind2 = String(field2.type);
|
|
21981
22109
|
return kind2 === "formula" || kind2 === "lookup" || kind2 === "rollup" || field2.source === "formula";
|
|
@@ -22059,8 +22187,8 @@ function ActionRowPreview({
|
|
|
22059
22187
|
if (cell2.computed && cell2.how === null) return { text: words(cell2.before) || "empty", note: false };
|
|
22060
22188
|
return { text: words(cell2.after) || "empty", note: false };
|
|
22061
22189
|
};
|
|
22062
|
-
return /* @__PURE__ */
|
|
22063
|
-
/* @__PURE__ */
|
|
22190
|
+
return /* @__PURE__ */ jsxs64("div", { className: "flex flex-col gap-1", "data-records-action-row-preview": "", children: [
|
|
22191
|
+
/* @__PURE__ */ jsx70("div", { className: "max-w-full overflow-x-auto rounded border", children: /* @__PURE__ */ jsxs64(
|
|
22064
22192
|
"div",
|
|
22065
22193
|
{
|
|
22066
22194
|
role: "table",
|
|
@@ -22068,9 +22196,9 @@ function ActionRowPreview({
|
|
|
22068
22196
|
className: "grid w-max min-w-full text-xs",
|
|
22069
22197
|
style: { gridTemplateColumns: `4rem repeat(${preview.cells.length}, minmax(7rem, 12rem))` },
|
|
22070
22198
|
children: [
|
|
22071
|
-
/* @__PURE__ */
|
|
22072
|
-
/* @__PURE__ */
|
|
22073
|
-
preview.cells.map((cell2) => /* @__PURE__ */
|
|
22199
|
+
/* @__PURE__ */ jsxs64("div", { role: "row", className: "contents", children: [
|
|
22200
|
+
/* @__PURE__ */ jsx70("span", { role: "columnheader", className: "sticky left-0 bg-muted/60 px-2 py-1" }),
|
|
22201
|
+
preview.cells.map((cell2) => /* @__PURE__ */ jsx70(
|
|
22074
22202
|
"span",
|
|
22075
22203
|
{
|
|
22076
22204
|
role: "columnheader",
|
|
@@ -22081,11 +22209,11 @@ function ActionRowPreview({
|
|
|
22081
22209
|
cell2.key
|
|
22082
22210
|
))
|
|
22083
22211
|
] }),
|
|
22084
|
-
["before", "after"].map((which) => /* @__PURE__ */
|
|
22085
|
-
/* @__PURE__ */
|
|
22212
|
+
["before", "after"].map((which) => /* @__PURE__ */ jsxs64("div", { role: "row", className: "contents", "data-preview-row": which, children: [
|
|
22213
|
+
/* @__PURE__ */ jsx70("span", { role: "rowheader", className: "sticky left-0 border-t bg-background px-2 py-1 font-medium text-muted-foreground", children: which === "before" ? "Now" : "After" }),
|
|
22086
22214
|
preview.cells.map((cell2) => {
|
|
22087
22215
|
const shown5 = which === "before" ? { text: words(cell2.before) || "empty", note: false } : afterWords(cell2);
|
|
22088
|
-
return /* @__PURE__ */
|
|
22216
|
+
return /* @__PURE__ */ jsx70(
|
|
22089
22217
|
"span",
|
|
22090
22218
|
{
|
|
22091
22219
|
role: "cell",
|
|
@@ -22108,7 +22236,7 @@ function ActionRowPreview({
|
|
|
22108
22236
|
]
|
|
22109
22237
|
}
|
|
22110
22238
|
) }),
|
|
22111
|
-
/* @__PURE__ */
|
|
22239
|
+
/* @__PURE__ */ jsx70("p", { className: "text-[11px] text-muted-foreground", "data-records-action-preview-count": "", children: preview.changedCount === 0 ? "Nothing on this record would change: every value is already what the action sets." : `${preview.changedCount} of ${preview.cells.length} ${preview.cells.length === 1 ? "cell changes" : "cells change"}. Worked-out columns are worked out by the store when it runs.` })
|
|
22112
22240
|
] });
|
|
22113
22241
|
}
|
|
22114
22242
|
|
|
@@ -22124,7 +22252,7 @@ import { useCallback as useCallback18, useEffect as useEffect43, useMemo as useM
|
|
|
22124
22252
|
import { useRecordsClient as useRecordsClient30, useRowActions } from "@ai-matrx/records/react";
|
|
22125
22253
|
import { actionRefusals } from "@ai-matrx/records";
|
|
22126
22254
|
import { Button as Button38, ConfirmDialog as ConfirmDialog2, cn as cn38 } from "@ai-matrx/design-system";
|
|
22127
|
-
import { jsx as
|
|
22255
|
+
import { jsx as jsx71, jsxs as jsxs65 } from "react/jsx-runtime";
|
|
22128
22256
|
var EMPTY_ACTIONS = [];
|
|
22129
22257
|
var actionListeners = /* @__PURE__ */ new Map();
|
|
22130
22258
|
function rowActionsChanged(tableId) {
|
|
@@ -22276,7 +22404,7 @@ function ActionButton({
|
|
|
22276
22404
|
onPress,
|
|
22277
22405
|
className
|
|
22278
22406
|
}) {
|
|
22279
|
-
return /* @__PURE__ */
|
|
22407
|
+
return /* @__PURE__ */ jsx71(
|
|
22280
22408
|
Button38,
|
|
22281
22409
|
{
|
|
22282
22410
|
size: "sm",
|
|
@@ -22298,7 +22426,7 @@ function ActionOutcomeNotice({
|
|
|
22298
22426
|
onUndo,
|
|
22299
22427
|
onDismiss
|
|
22300
22428
|
}) {
|
|
22301
|
-
return /* @__PURE__ */
|
|
22429
|
+
return /* @__PURE__ */ jsxs65(
|
|
22302
22430
|
"div",
|
|
22303
22431
|
{
|
|
22304
22432
|
role: "status",
|
|
@@ -22308,10 +22436,10 @@ function ActionOutcomeNotice({
|
|
|
22308
22436
|
outcome.kind === "refused" ? "border-destructive/40 bg-destructive/5" : "border-border bg-muted/40"
|
|
22309
22437
|
),
|
|
22310
22438
|
children: [
|
|
22311
|
-
/* @__PURE__ */
|
|
22312
|
-
/* @__PURE__ */
|
|
22313
|
-
outcome.kind === "ran" && outcome.undo ? /* @__PURE__ */
|
|
22314
|
-
/* @__PURE__ */
|
|
22439
|
+
/* @__PURE__ */ jsxs65("div", { className: "flex items-center gap-2", children: [
|
|
22440
|
+
/* @__PURE__ */ jsx71("span", { children: outcome.says }),
|
|
22441
|
+
outcome.kind === "ran" && outcome.undo ? /* @__PURE__ */ jsx71(Button38, { size: "sm", variant: "outline", className: "ml-auto h-6", onClick: onUndo, children: "Undo" }) : null,
|
|
22442
|
+
/* @__PURE__ */ jsx71(
|
|
22315
22443
|
Button38,
|
|
22316
22444
|
{
|
|
22317
22445
|
size: "sm",
|
|
@@ -22322,13 +22450,13 @@ function ActionOutcomeNotice({
|
|
|
22322
22450
|
}
|
|
22323
22451
|
)
|
|
22324
22452
|
] }),
|
|
22325
|
-
outcome.kind === "ran" && !outcome.undo && outcome.undoWhyNot ? /* @__PURE__ */
|
|
22326
|
-
outcome.kind === "refused" ? outcome.refusals.length > 0 ? /* @__PURE__ */
|
|
22453
|
+
outcome.kind === "ran" && !outcome.undo && outcome.undoWhyNot ? /* @__PURE__ */ jsx71("span", { className: "text-muted-foreground", children: outcome.undoWhyNot }) : null,
|
|
22454
|
+
outcome.kind === "refused" ? outcome.refusals.length > 0 ? /* @__PURE__ */ jsx71("ul", { className: "list-disc pl-4", "data-records-action-refusals": "", children: outcome.refusals.map((r) => /* @__PURE__ */ jsxs65("li", { children: [
|
|
22327
22455
|
(r.record ?? "A record") + (r.field ? ` \xB7 ${r.field}` : ""),
|
|
22328
22456
|
": ",
|
|
22329
22457
|
r.says
|
|
22330
|
-
] }, `${r.record_id}:${r.field_id ?? ""}`)) }) : /* @__PURE__ */
|
|
22331
|
-
outcome.kind === "undone" && outcome.failures.length > 0 ? /* @__PURE__ */
|
|
22458
|
+
] }, `${r.record_id}:${r.field_id ?? ""}`)) }) : /* @__PURE__ */ jsx71(RefusalLine, { error: outcome.error }) : null,
|
|
22459
|
+
outcome.kind === "undone" && outcome.failures.length > 0 ? /* @__PURE__ */ jsx71("ul", { className: "list-disc pl-4", children: outcome.failures.map((f, i) => /* @__PURE__ */ jsx71("li", { children: f }, i)) }) : null
|
|
22332
22460
|
]
|
|
22333
22461
|
}
|
|
22334
22462
|
);
|
|
@@ -22340,7 +22468,7 @@ function ActionConfirm({
|
|
|
22340
22468
|
nounPlural
|
|
22341
22469
|
}) {
|
|
22342
22470
|
const held = runner.asking;
|
|
22343
|
-
return /* @__PURE__ */
|
|
22471
|
+
return /* @__PURE__ */ jsx71(
|
|
22344
22472
|
ConfirmDialog2,
|
|
22345
22473
|
{
|
|
22346
22474
|
open: held !== null,
|
|
@@ -22383,7 +22511,7 @@ function rowActionMenuItems(args) {
|
|
|
22383
22511
|
}
|
|
22384
22512
|
|
|
22385
22513
|
// src/RowActionsEditor.tsx
|
|
22386
|
-
import { jsx as
|
|
22514
|
+
import { jsx as jsx72, jsxs as jsxs66 } from "react/jsx-runtime";
|
|
22387
22515
|
function settableFields(fields) {
|
|
22388
22516
|
return [...fields].filter((f) => f.type !== "formula" && f.source !== "formula").sort((a, b) => (a.sort ?? 0) - (b.sort ?? 0));
|
|
22389
22517
|
}
|
|
@@ -22566,7 +22694,7 @@ function RowActionsSection({
|
|
|
22566
22694
|
}, [startAdding, addStarted, loaded, readError]);
|
|
22567
22695
|
if (editing) {
|
|
22568
22696
|
const original = editing === "new" ? null : editing;
|
|
22569
|
-
return /* @__PURE__ */
|
|
22697
|
+
return /* @__PURE__ */ jsx72(
|
|
22570
22698
|
ActionForm,
|
|
22571
22699
|
{
|
|
22572
22700
|
tableId,
|
|
@@ -22590,11 +22718,11 @@ function RowActionsSection({
|
|
|
22590
22718
|
}
|
|
22591
22719
|
);
|
|
22592
22720
|
}
|
|
22593
|
-
return /* @__PURE__ */
|
|
22594
|
-
/* @__PURE__ */
|
|
22595
|
-
/* @__PURE__ */
|
|
22596
|
-
loaded && !readError ? /* @__PURE__ */
|
|
22597
|
-
/* @__PURE__ */
|
|
22721
|
+
return /* @__PURE__ */ jsxs66("div", { className: cn39("flex flex-col gap-2", className), "data-records-row-actions-editor": "", children: [
|
|
22722
|
+
/* @__PURE__ */ jsxs66("div", { className: "flex items-center gap-2", children: [
|
|
22723
|
+
/* @__PURE__ */ jsx72("span", { className: "font-medium", children: "Row actions" }),
|
|
22724
|
+
loaded && !readError ? /* @__PURE__ */ jsx72("span", { className: "text-muted-foreground", children: actions.length }) : null,
|
|
22725
|
+
/* @__PURE__ */ jsx72(
|
|
22598
22726
|
Button39,
|
|
22599
22727
|
{
|
|
22600
22728
|
size: "sm",
|
|
@@ -22609,41 +22737,41 @@ function RowActionsSection({
|
|
|
22609
22737
|
}
|
|
22610
22738
|
)
|
|
22611
22739
|
] }),
|
|
22612
|
-
/* @__PURE__ */
|
|
22613
|
-
readError ? /* @__PURE__ */
|
|
22614
|
-
saveError ? /* @__PURE__ */
|
|
22615
|
-
retiring ? /* @__PURE__ */
|
|
22616
|
-
/* @__PURE__ */
|
|
22740
|
+
/* @__PURE__ */ jsx72("p", { className: "text-muted-foreground", children: "A button on every row: it changes that record in one click, or hands it to an agent with your words." }),
|
|
22741
|
+
readError ? /* @__PURE__ */ jsx72(RefusalNotice, { error: readError }) : null,
|
|
22742
|
+
saveError ? /* @__PURE__ */ jsx72(RefusalNotice, { error: saveError }) : null,
|
|
22743
|
+
retiring ? /* @__PURE__ */ jsxs66("div", { className: "flex flex-wrap items-center gap-2 rounded border border-destructive/40 px-2 py-1.5", children: [
|
|
22744
|
+
/* @__PURE__ */ jsxs66("span", { className: "text-destructive", children: [
|
|
22617
22745
|
"Retiring ",
|
|
22618
22746
|
retiring.name,
|
|
22619
22747
|
" takes its button off every row of this table. Records it already changed stay as they are."
|
|
22620
22748
|
] }),
|
|
22621
|
-
/* @__PURE__ */
|
|
22622
|
-
/* @__PURE__ */
|
|
22749
|
+
/* @__PURE__ */ jsx72(Button39, { size: "sm", variant: "destructive", disabled: saving, onClick: () => void retire(retiring), children: saving ? "Retiring\u2026" : "Retire it" }),
|
|
22750
|
+
/* @__PURE__ */ jsx72(Button39, { size: "sm", variant: "ghost", onClick: () => setRetiring(null), children: "Keep it" })
|
|
22623
22751
|
] }) : null,
|
|
22624
|
-
retired ? /* @__PURE__ */
|
|
22625
|
-
/* @__PURE__ */
|
|
22752
|
+
retired ? /* @__PURE__ */ jsxs66("div", { role: "status", className: "flex flex-wrap items-center gap-2 rounded border px-2 py-1.5", children: [
|
|
22753
|
+
/* @__PURE__ */ jsxs66("span", { children: [
|
|
22626
22754
|
retired.action.name,
|
|
22627
22755
|
" is retired."
|
|
22628
22756
|
] }),
|
|
22629
|
-
/* @__PURE__ */
|
|
22630
|
-
/* @__PURE__ */
|
|
22757
|
+
/* @__PURE__ */ jsx72(Button39, { size: "sm", variant: "outline", className: "ml-auto", disabled: saving, onClick: () => void putBack(), children: "Put it back" }),
|
|
22758
|
+
/* @__PURE__ */ jsx72(Button39, { size: "sm", variant: "ghost", onClick: () => setRetired(null), children: "Dismiss" })
|
|
22631
22759
|
] }) : null,
|
|
22632
|
-
loaded && !readError ? /* @__PURE__ */
|
|
22633
|
-
actions.map((action3, index) => /* @__PURE__ */
|
|
22760
|
+
loaded && !readError ? /* @__PURE__ */ jsxs66("ul", { className: "divide-y rounded border", children: [
|
|
22761
|
+
actions.map((action3, index) => /* @__PURE__ */ jsxs66(
|
|
22634
22762
|
"li",
|
|
22635
22763
|
{
|
|
22636
22764
|
"data-records-declared-action": action3.id,
|
|
22637
22765
|
className: "flex flex-wrap items-center gap-x-2 gap-y-1 px-2 py-1.5",
|
|
22638
22766
|
children: [
|
|
22639
|
-
/* @__PURE__ */
|
|
22640
|
-
/* @__PURE__ */
|
|
22641
|
-
/* @__PURE__ */
|
|
22767
|
+
/* @__PURE__ */ jsxs66("span", { className: "min-w-[8rem] flex-1 break-words", children: [
|
|
22768
|
+
/* @__PURE__ */ jsx72("span", { className: "font-medium", children: action3.name }),
|
|
22769
|
+
/* @__PURE__ */ jsx72("span", { className: "block text-muted-foreground", children: describe(action3, allFields) })
|
|
22642
22770
|
] }),
|
|
22643
|
-
action3.kind === "agent" ? /* @__PURE__ */
|
|
22644
|
-
action3.confirm ? /* @__PURE__ */
|
|
22645
|
-
action3.kind !== "agent" && action3.runnable === false ? /* @__PURE__ */
|
|
22646
|
-
/* @__PURE__ */
|
|
22771
|
+
action3.kind === "agent" ? /* @__PURE__ */ jsx72(Badge10, { variant: "secondary", className: "text-[10px] font-normal", children: "asks an agent" }) : null,
|
|
22772
|
+
action3.confirm ? /* @__PURE__ */ jsx72(Badge10, { variant: "outline", className: "text-[10px] font-normal", children: "asks first" }) : null,
|
|
22773
|
+
action3.kind !== "agent" && action3.runnable === false ? /* @__PURE__ */ jsx72(Badge10, { variant: "outline", className: "text-[10px] font-normal text-destructive", children: "a column it changes is gone" }) : null,
|
|
22774
|
+
/* @__PURE__ */ jsx72(
|
|
22647
22775
|
Button39,
|
|
22648
22776
|
{
|
|
22649
22777
|
size: "sm",
|
|
@@ -22654,7 +22782,7 @@ function RowActionsSection({
|
|
|
22654
22782
|
children: "\u2191"
|
|
22655
22783
|
}
|
|
22656
22784
|
),
|
|
22657
|
-
/* @__PURE__ */
|
|
22785
|
+
/* @__PURE__ */ jsx72(
|
|
22658
22786
|
Button39,
|
|
22659
22787
|
{
|
|
22660
22788
|
size: "sm",
|
|
@@ -22665,8 +22793,8 @@ function RowActionsSection({
|
|
|
22665
22793
|
children: "\u2193"
|
|
22666
22794
|
}
|
|
22667
22795
|
),
|
|
22668
|
-
/* @__PURE__ */
|
|
22669
|
-
/* @__PURE__ */
|
|
22796
|
+
/* @__PURE__ */ jsx72(Button39, { size: "sm", variant: "ghost", title: `Edit ${action3.name}`, onClick: () => setEditing(action3), children: "Edit" }),
|
|
22797
|
+
/* @__PURE__ */ jsx72(
|
|
22670
22798
|
Button39,
|
|
22671
22799
|
{
|
|
22672
22800
|
size: "sm",
|
|
@@ -22684,9 +22812,9 @@ function RowActionsSection({
|
|
|
22684
22812
|
},
|
|
22685
22813
|
action3.id ?? action3.name
|
|
22686
22814
|
)),
|
|
22687
|
-
actions.length === 0 ? /* @__PURE__ */
|
|
22815
|
+
actions.length === 0 ? /* @__PURE__ */ jsx72("li", { className: "px-2 py-2 text-muted-foreground", children: "This table has no row actions yet." }) : null
|
|
22688
22816
|
] }) : null,
|
|
22689
|
-
stale > 0 ? /* @__PURE__ */
|
|
22817
|
+
stale > 0 ? /* @__PURE__ */ jsxs66("p", { className: "text-muted-foreground", children: [
|
|
22690
22818
|
stale === 1 ? "One action names" : `${stale} actions name`,
|
|
22691
22819
|
" a column this table no longer has, so",
|
|
22692
22820
|
" ",
|
|
@@ -22737,11 +22865,11 @@ function ActionForm({
|
|
|
22737
22865
|
const first = settable2.find((f) => doc[f.key] !== null && doc[f.key] !== void 0 && doc[f.key] !== "");
|
|
22738
22866
|
return first ? shown2(doc[first.key]) : row.id;
|
|
22739
22867
|
};
|
|
22740
|
-
return /* @__PURE__ */
|
|
22741
|
-
/* @__PURE__ */
|
|
22742
|
-
/* @__PURE__ */
|
|
22743
|
-
/* @__PURE__ */
|
|
22744
|
-
/* @__PURE__ */
|
|
22868
|
+
return /* @__PURE__ */ jsxs66("div", { className: cn39("flex flex-col gap-3 text-xs", className), "data-records-action-form": "", children: [
|
|
22869
|
+
/* @__PURE__ */ jsx72("span", { className: "font-medium", children: original ? `Row action \xB7 ${original.name}` : "New row action" }),
|
|
22870
|
+
/* @__PURE__ */ jsxs66("label", { className: "flex flex-col gap-1", children: [
|
|
22871
|
+
/* @__PURE__ */ jsx72(Label13, { className: "text-xs", children: "Name" }),
|
|
22872
|
+
/* @__PURE__ */ jsx72(
|
|
22745
22873
|
BasicInput15,
|
|
22746
22874
|
{
|
|
22747
22875
|
value: draft.name,
|
|
@@ -22751,12 +22879,12 @@ function ActionForm({
|
|
|
22751
22879
|
onChange: (e) => setDraft((d) => ({ ...d, name: e.target.value }))
|
|
22752
22880
|
}
|
|
22753
22881
|
),
|
|
22754
|
-
/* @__PURE__ */
|
|
22882
|
+
/* @__PURE__ */ jsx72("span", { className: "text-[11px] text-muted-foreground", children: "The words on the button." })
|
|
22755
22883
|
] }),
|
|
22756
|
-
/* @__PURE__ */
|
|
22757
|
-
/* @__PURE__ */
|
|
22758
|
-
/* @__PURE__ */
|
|
22759
|
-
/* @__PURE__ */
|
|
22884
|
+
/* @__PURE__ */ jsxs66("div", { className: "flex flex-col gap-1", children: [
|
|
22885
|
+
/* @__PURE__ */ jsx72(Label13, { className: "text-xs", children: "What it does" }),
|
|
22886
|
+
/* @__PURE__ */ jsxs66("div", { className: "flex gap-1", children: [
|
|
22887
|
+
/* @__PURE__ */ jsx72(
|
|
22760
22888
|
Button39,
|
|
22761
22889
|
{
|
|
22762
22890
|
size: "sm",
|
|
@@ -22766,7 +22894,7 @@ function ActionForm({
|
|
|
22766
22894
|
children: "Changes the record"
|
|
22767
22895
|
}
|
|
22768
22896
|
),
|
|
22769
|
-
/* @__PURE__ */
|
|
22897
|
+
/* @__PURE__ */ jsx72(
|
|
22770
22898
|
Button39,
|
|
22771
22899
|
{
|
|
22772
22900
|
size: "sm",
|
|
@@ -22778,9 +22906,9 @@ function ActionForm({
|
|
|
22778
22906
|
)
|
|
22779
22907
|
] })
|
|
22780
22908
|
] }),
|
|
22781
|
-
draft.kind === "agent" ? /* @__PURE__ */
|
|
22782
|
-
/* @__PURE__ */
|
|
22783
|
-
/* @__PURE__ */
|
|
22909
|
+
draft.kind === "agent" ? /* @__PURE__ */ jsxs66("label", { className: "flex flex-col gap-1", children: [
|
|
22910
|
+
/* @__PURE__ */ jsx72(Label13, { className: "text-xs", children: "What to ask" }),
|
|
22911
|
+
/* @__PURE__ */ jsx72(
|
|
22784
22912
|
BasicTextarea6,
|
|
22785
22913
|
{
|
|
22786
22914
|
value: draft.prompt,
|
|
@@ -22789,13 +22917,13 @@ function ActionForm({
|
|
|
22789
22917
|
onChange: (e) => setDraft((d) => ({ ...d, prompt: e.target.value }))
|
|
22790
22918
|
}
|
|
22791
22919
|
),
|
|
22792
|
-
/* @__PURE__ */
|
|
22793
|
-
] }) : /* @__PURE__ */
|
|
22794
|
-
/* @__PURE__ */
|
|
22795
|
-
/* @__PURE__ */
|
|
22796
|
-
rows.length > 0 ? /* @__PURE__ */
|
|
22797
|
-
/* @__PURE__ */
|
|
22798
|
-
/* @__PURE__ */
|
|
22920
|
+
/* @__PURE__ */ jsx72("span", { className: "text-[11px] text-muted-foreground", children: "The agent is handed the record with these words, and answers in the record's chat." })
|
|
22921
|
+
] }) : /* @__PURE__ */ jsxs66("div", { className: "flex flex-col gap-2", children: [
|
|
22922
|
+
/* @__PURE__ */ jsxs66("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
22923
|
+
/* @__PURE__ */ jsx72(Label13, { className: "text-xs", children: "What it changes" }),
|
|
22924
|
+
rows.length > 0 ? /* @__PURE__ */ jsxs66("div", { className: "ml-auto flex items-center gap-1", children: [
|
|
22925
|
+
/* @__PURE__ */ jsx72("span", { className: "text-muted-foreground", children: "Start from a record" }),
|
|
22926
|
+
/* @__PURE__ */ jsxs66(
|
|
22799
22927
|
Select12,
|
|
22800
22928
|
{
|
|
22801
22929
|
value: "",
|
|
@@ -22814,28 +22942,28 @@ function ActionForm({
|
|
|
22814
22942
|
setPreviewId(row.id);
|
|
22815
22943
|
},
|
|
22816
22944
|
children: [
|
|
22817
|
-
/* @__PURE__ */
|
|
22818
|
-
/* @__PURE__ */
|
|
22945
|
+
/* @__PURE__ */ jsx72(SelectTrigger11, { size: "sm", "aria-label": "Start from a record", children: /* @__PURE__ */ jsx72(SelectValue11, { placeholder: "Pick one" }) }),
|
|
22946
|
+
/* @__PURE__ */ jsx72(SelectContent11, { children: rows.map((row) => /* @__PURE__ */ jsx72(SelectItem11, { value: row.id, children: rowName2(row) }, row.id)) })
|
|
22819
22947
|
]
|
|
22820
22948
|
}
|
|
22821
22949
|
)
|
|
22822
22950
|
] }) : null
|
|
22823
22951
|
] }),
|
|
22824
|
-
draft.steps.length === 0 ? /* @__PURE__ */
|
|
22825
|
-
draft.steps.map((step2, index) => /* @__PURE__ */
|
|
22826
|
-
/* @__PURE__ */
|
|
22827
|
-
/* @__PURE__ */
|
|
22828
|
-
/* @__PURE__ */
|
|
22952
|
+
draft.steps.length === 0 ? /* @__PURE__ */ jsx72("p", { className: "text-muted-foreground", children: "Nothing yet. Add a change, or start from a record and remove the columns it should leave alone." }) : null,
|
|
22953
|
+
draft.steps.map((step2, index) => /* @__PURE__ */ jsxs66("div", { className: "flex flex-wrap items-center gap-1", "data-records-action-step": index, children: [
|
|
22954
|
+
/* @__PURE__ */ jsxs66(Select12, { value: step2.field, onValueChange: (v) => setStep(index, { field: v }), children: [
|
|
22955
|
+
/* @__PURE__ */ jsx72(SelectTrigger11, { size: "sm", "aria-label": `Column for change ${index + 1}`, children: /* @__PURE__ */ jsx72(SelectValue11, { placeholder: "Column" }) }),
|
|
22956
|
+
/* @__PURE__ */ jsx72(SelectContent11, { children: settable2.map((f) => /* @__PURE__ */ jsx72(SelectItem11, { value: f.id, children: fieldName(f) }, f.id)) })
|
|
22829
22957
|
] }),
|
|
22830
|
-
/* @__PURE__ */
|
|
22831
|
-
/* @__PURE__ */
|
|
22832
|
-
/* @__PURE__ */
|
|
22833
|
-
/* @__PURE__ */
|
|
22834
|
-
/* @__PURE__ */
|
|
22835
|
-
/* @__PURE__ */
|
|
22958
|
+
/* @__PURE__ */ jsxs66(Select12, { value: step2.set, onValueChange: (v) => setStep(index, { set: v }), children: [
|
|
22959
|
+
/* @__PURE__ */ jsx72(SelectTrigger11, { size: "sm", "aria-label": `How change ${index + 1} sets it`, children: /* @__PURE__ */ jsx72(SelectValue11, {}) }),
|
|
22960
|
+
/* @__PURE__ */ jsxs66(SelectContent11, { children: [
|
|
22961
|
+
/* @__PURE__ */ jsx72(SelectItem11, { value: "value", children: "Set to" }),
|
|
22962
|
+
/* @__PURE__ */ jsx72(SelectItem11, { value: "clear", children: "Clear" }),
|
|
22963
|
+
/* @__PURE__ */ jsx72(SelectItem11, { value: "compute", children: "Work out" })
|
|
22836
22964
|
] })
|
|
22837
22965
|
] }),
|
|
22838
|
-
step2.set === "value" ? /* @__PURE__ */
|
|
22966
|
+
step2.set === "value" ? /* @__PURE__ */ jsx72(
|
|
22839
22967
|
BasicInput15,
|
|
22840
22968
|
{
|
|
22841
22969
|
className: "h-7 w-40",
|
|
@@ -22846,7 +22974,7 @@ function ActionForm({
|
|
|
22846
22974
|
) : step2.set === "compute" ? (
|
|
22847
22975
|
// THE ONE FORMULA BOX (Sheet parity): the store checks it as it is typed, and the host's
|
|
22848
22976
|
// "Help with this…" (`formulaHelp`) sees this table's columns and puts its answer back.
|
|
22849
|
-
/* @__PURE__ */
|
|
22977
|
+
/* @__PURE__ */ jsx72(
|
|
22850
22978
|
FormulaTextEditor,
|
|
22851
22979
|
{
|
|
22852
22980
|
className: "basis-full",
|
|
@@ -22863,7 +22991,7 @@ function ActionForm({
|
|
|
22863
22991
|
}
|
|
22864
22992
|
)
|
|
22865
22993
|
) : null,
|
|
22866
|
-
/* @__PURE__ */
|
|
22994
|
+
/* @__PURE__ */ jsx72(
|
|
22867
22995
|
Button39,
|
|
22868
22996
|
{
|
|
22869
22997
|
size: "sm",
|
|
@@ -22874,7 +23002,7 @@ function ActionForm({
|
|
|
22874
23002
|
}
|
|
22875
23003
|
)
|
|
22876
23004
|
] }, index)),
|
|
22877
|
-
/* @__PURE__ */
|
|
23005
|
+
/* @__PURE__ */ jsx72("div", { children: /* @__PURE__ */ jsx72(
|
|
22878
23006
|
Button39,
|
|
22879
23007
|
{
|
|
22880
23008
|
size: "sm",
|
|
@@ -22883,16 +23011,16 @@ function ActionForm({
|
|
|
22883
23011
|
children: "Add a change"
|
|
22884
23012
|
}
|
|
22885
23013
|
) }),
|
|
22886
|
-
previewRow && draft.steps.length > 0 && complete ? /* @__PURE__ */
|
|
22887
|
-
/* @__PURE__ */
|
|
22888
|
-
/* @__PURE__ */
|
|
22889
|
-
/* @__PURE__ */
|
|
22890
|
-
/* @__PURE__ */
|
|
22891
|
-
/* @__PURE__ */
|
|
22892
|
-
/* @__PURE__ */
|
|
23014
|
+
previewRow && draft.steps.length > 0 && complete ? /* @__PURE__ */ jsxs66("div", { className: "flex flex-col gap-1 rounded border px-2 py-1.5", "data-records-action-preview": "", children: [
|
|
23015
|
+
/* @__PURE__ */ jsxs66("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
23016
|
+
/* @__PURE__ */ jsx72("span", { className: "font-medium", children: "Before and after" }),
|
|
23017
|
+
/* @__PURE__ */ jsx72("span", { className: "text-muted-foreground", children: "on" }),
|
|
23018
|
+
/* @__PURE__ */ jsxs66(Select12, { value: previewRow.id, onValueChange: (v) => setPreviewId(v), children: [
|
|
23019
|
+
/* @__PURE__ */ jsx72(SelectTrigger11, { size: "sm", "aria-label": "Record to preview on", children: /* @__PURE__ */ jsx72(SelectValue11, {}) }),
|
|
23020
|
+
/* @__PURE__ */ jsx72(SelectContent11, { children: rows.map((row) => /* @__PURE__ */ jsx72(SelectItem11, { value: row.id, children: rowName2(row) }, row.id)) })
|
|
22893
23021
|
] })
|
|
22894
23022
|
] }),
|
|
22895
|
-
/* @__PURE__ */
|
|
23023
|
+
/* @__PURE__ */ jsx72(
|
|
22896
23024
|
ActionRowPreview,
|
|
22897
23025
|
{
|
|
22898
23026
|
tableId,
|
|
@@ -22901,9 +23029,9 @@ function ActionForm({
|
|
|
22901
23029
|
)
|
|
22902
23030
|
] }) : null
|
|
22903
23031
|
] }),
|
|
22904
|
-
/* @__PURE__ */
|
|
22905
|
-
/* @__PURE__ */
|
|
22906
|
-
/* @__PURE__ */
|
|
23032
|
+
/* @__PURE__ */ jsxs66("div", { className: "flex flex-wrap items-center gap-4", children: [
|
|
23033
|
+
/* @__PURE__ */ jsxs66("label", { className: "flex items-center gap-1.5", children: [
|
|
23034
|
+
/* @__PURE__ */ jsx72(
|
|
22907
23035
|
Checkbox11,
|
|
22908
23036
|
{
|
|
22909
23037
|
checked: draft.confirm,
|
|
@@ -22913,36 +23041,36 @@ function ActionForm({
|
|
|
22913
23041
|
),
|
|
22914
23042
|
"Ask before running"
|
|
22915
23043
|
] }),
|
|
22916
|
-
host.iconPicker ? /* @__PURE__ */
|
|
22917
|
-
/* @__PURE__ */
|
|
23044
|
+
host.iconPicker ? /* @__PURE__ */ jsxs66("div", { className: "flex items-center gap-1", "data-records-action-icon": "", children: [
|
|
23045
|
+
/* @__PURE__ */ jsx72("span", { className: "shrink-0 whitespace-nowrap text-muted-foreground", children: "Icon" }),
|
|
22918
23046
|
host.iconPicker({
|
|
22919
23047
|
value: draft.icon ?? "",
|
|
22920
23048
|
label: "Button icon",
|
|
22921
23049
|
onChange: (name) => setDraft((d) => ({ ...d, icon: name || void 0 }))
|
|
22922
23050
|
})
|
|
22923
23051
|
] }) : null,
|
|
22924
|
-
colors.length > 0 ? /* @__PURE__ */
|
|
22925
|
-
/* @__PURE__ */
|
|
22926
|
-
/* @__PURE__ */
|
|
23052
|
+
colors.length > 0 ? /* @__PURE__ */ jsxs66("div", { className: "flex items-center gap-1", children: [
|
|
23053
|
+
/* @__PURE__ */ jsx72("span", { className: "shrink-0 whitespace-nowrap text-muted-foreground", children: "Color" }),
|
|
23054
|
+
/* @__PURE__ */ jsxs66(
|
|
22927
23055
|
Select12,
|
|
22928
23056
|
{
|
|
22929
23057
|
value: draft.color || NO_COLOR,
|
|
22930
23058
|
onValueChange: (v) => setDraft((d) => ({ ...d, color: v === NO_COLOR ? "" : v })),
|
|
22931
23059
|
children: [
|
|
22932
|
-
/* @__PURE__ */
|
|
22933
|
-
/* @__PURE__ */
|
|
22934
|
-
/* @__PURE__ */
|
|
22935
|
-
colors.map((c) => /* @__PURE__ */
|
|
23060
|
+
/* @__PURE__ */ jsx72(SelectTrigger11, { size: "sm", "aria-label": "Button color", children: /* @__PURE__ */ jsx72(SelectValue11, {}) }),
|
|
23061
|
+
/* @__PURE__ */ jsxs66(SelectContent11, { children: [
|
|
23062
|
+
/* @__PURE__ */ jsx72(SelectItem11, { value: NO_COLOR, children: "None" }),
|
|
23063
|
+
colors.map((c) => /* @__PURE__ */ jsx72(SelectItem11, { value: c, children: c.charAt(0).toUpperCase() + c.slice(1) }, c))
|
|
22936
23064
|
] })
|
|
22937
23065
|
]
|
|
22938
23066
|
}
|
|
22939
23067
|
)
|
|
22940
23068
|
] }) : null
|
|
22941
23069
|
] }),
|
|
22942
|
-
error ? /* @__PURE__ */
|
|
22943
|
-
!complete ? /* @__PURE__ */
|
|
22944
|
-
/* @__PURE__ */
|
|
22945
|
-
/* @__PURE__ */
|
|
23070
|
+
error ? /* @__PURE__ */ jsx72(RefusalNotice, { error }) : null,
|
|
23071
|
+
!complete ? /* @__PURE__ */ jsx72("p", { className: "text-muted-foreground", children: "Every change needs its column before the action can be saved." }) : null,
|
|
23072
|
+
/* @__PURE__ */ jsxs66("div", { className: "flex gap-1", children: [
|
|
23073
|
+
/* @__PURE__ */ jsx72(
|
|
22946
23074
|
Button39,
|
|
22947
23075
|
{
|
|
22948
23076
|
size: "sm",
|
|
@@ -22951,18 +23079,18 @@ function ActionForm({
|
|
|
22951
23079
|
children: saving ? "Saving\u2026" : original ? "Save action" : "Add action"
|
|
22952
23080
|
}
|
|
22953
23081
|
),
|
|
22954
|
-
/* @__PURE__ */
|
|
23082
|
+
/* @__PURE__ */ jsx72(Button39, { size: "sm", variant: "ghost", onClick: onCancel, children: "Cancel" })
|
|
22955
23083
|
] })
|
|
22956
23084
|
] });
|
|
22957
23085
|
}
|
|
22958
23086
|
|
|
22959
23087
|
// src/gridActionsHeader.tsx
|
|
22960
|
-
import { jsx as
|
|
23088
|
+
import { jsx as jsx73, jsxs as jsxs67 } from "react/jsx-runtime";
|
|
22961
23089
|
var ADD_COLUMN_LABEL = "Add a column";
|
|
22962
23090
|
var ROW_ACTIONS_MENU_LABEL = "Row actions\u2026";
|
|
22963
23091
|
function ActionsHeaderControls({ onAddColumn }) {
|
|
22964
23092
|
if (!onAddColumn) return null;
|
|
22965
|
-
return /* @__PURE__ */
|
|
23093
|
+
return /* @__PURE__ */ jsx73(
|
|
22966
23094
|
Button40,
|
|
22967
23095
|
{
|
|
22968
23096
|
type: "button",
|
|
@@ -22977,7 +23105,7 @@ function ActionsHeaderControls({ onAddColumn }) {
|
|
|
22977
23105
|
event.stopPropagation();
|
|
22978
23106
|
onAddColumn();
|
|
22979
23107
|
},
|
|
22980
|
-
children: /* @__PURE__ */
|
|
23108
|
+
children: /* @__PURE__ */ jsx73("span", { "aria-hidden": true, className: "text-sm leading-none", children: "+" })
|
|
22981
23109
|
}
|
|
22982
23110
|
);
|
|
22983
23111
|
}
|
|
@@ -22986,9 +23114,9 @@ function RowActionsDialog({
|
|
|
22986
23114
|
open,
|
|
22987
23115
|
onOpenChange
|
|
22988
23116
|
}) {
|
|
22989
|
-
return /* @__PURE__ */
|
|
22990
|
-
/* @__PURE__ */
|
|
22991
|
-
open ? /* @__PURE__ */
|
|
23117
|
+
return /* @__PURE__ */ jsx73(Dialog9, { open, onOpenChange, children: /* @__PURE__ */ jsxs67(DialogContent9, { className: "max-h-[85dvh] overflow-y-auto sm:max-w-xl", "data-records-actions-header-editor": "", children: [
|
|
23118
|
+
/* @__PURE__ */ jsx73(DialogHeader9, { children: /* @__PURE__ */ jsx73(DialogTitle9, { children: "Row actions" }) }),
|
|
23119
|
+
open ? /* @__PURE__ */ jsx73(RowActionsSection, { tableId, className: "text-xs" }) : null
|
|
22992
23120
|
] }) });
|
|
22993
23121
|
}
|
|
22994
23122
|
|
|
@@ -23013,7 +23141,7 @@ import {
|
|
|
23013
23141
|
init_parity();
|
|
23014
23142
|
init_names();
|
|
23015
23143
|
init_PickOne();
|
|
23016
|
-
import { Fragment as
|
|
23144
|
+
import { Fragment as Fragment24, jsx as jsx74, jsxs as jsxs68 } from "react/jsx-runtime";
|
|
23017
23145
|
var SUMMARY_ROW_ID = "__records_ui_summary__";
|
|
23018
23146
|
var SUMMARY_ROW = {
|
|
23019
23147
|
id: SUMMARY_ROW_ID,
|
|
@@ -23109,8 +23237,8 @@ function SummaryCell({
|
|
|
23109
23237
|
const label = chosen ? words2(chosen, "footer") : null;
|
|
23110
23238
|
const isDate4 = editorKindFor(field2) === "datetime";
|
|
23111
23239
|
const shown5 = chosen === void 0 ? null : summaries.loading && value === void 0 ? "\u2026" : value === null || value === void 0 ? "\u2014" : chosen === "count" || chosen === "filled" || chosen === "empty" || chosen === "unique" ? String(value) : chosen === "percent_empty" || chosen === "percent_filled" ? `${Number(value.toFixed(2))}%` : chosen === "range" && isDate4 ? `${Math.round(value)} day${Math.round(value) === 1 ? "" : "s"}` : null;
|
|
23112
|
-
return /* @__PURE__ */
|
|
23113
|
-
/* @__PURE__ */
|
|
23240
|
+
return /* @__PURE__ */ jsxs68(DropdownMenu2, { onOpenChange: (open) => open ? summaries.askOperations() : void 0, children: [
|
|
23241
|
+
/* @__PURE__ */ jsx74(DropdownMenuTrigger2, { asChild: true, children: /* @__PURE__ */ jsx74(
|
|
23114
23242
|
Button41,
|
|
23115
23243
|
{
|
|
23116
23244
|
size: "sm",
|
|
@@ -23124,18 +23252,18 @@ function SummaryCell({
|
|
|
23124
23252
|
chosen ? "text-foreground" : "text-muted-foreground opacity-0 hover:opacity-100 focus-visible:opacity-100 data-[state=open]:opacity-100"
|
|
23125
23253
|
),
|
|
23126
23254
|
title: chosen && rowCount !== null ? `${label} of ${fieldName(field2)}, worked out by the store over all ${rowCount} record${rowCount === 1 ? "" : "s"} \u2014 not only this page.` : `Summarize ${fieldName(field2)}`,
|
|
23127
|
-
children: chosen ? /* @__PURE__ */
|
|
23128
|
-
/* @__PURE__ */
|
|
23255
|
+
children: chosen ? /* @__PURE__ */ jsxs68(Fragment24, { children: [
|
|
23256
|
+
/* @__PURE__ */ jsx74("span", { className: "text-muted-foreground", children: label }),
|
|
23129
23257
|
summaries.withheld[field2.key] ? (
|
|
23130
23258
|
// AGG-WITHHELD: the store withheld this column from her — say so, never a bare dash.
|
|
23131
|
-
/* @__PURE__ */
|
|
23132
|
-
) : shown5 !== null ? /* @__PURE__ */
|
|
23259
|
+
/* @__PURE__ */ jsx74("span", { className: "font-medium", children: /* @__PURE__ */ jsx74(WithheldValue, { field: field2, notice: summaries.withheld[field2.key] }) })
|
|
23260
|
+
) : shown5 !== null ? /* @__PURE__ */ jsx74("span", { className: "font-medium tabular-nums", children: shown5 }) : /* @__PURE__ */ jsx74("span", { className: "font-medium tabular-nums", children: /* @__PURE__ */ jsx74(RecordValue, { field: field2, value, format: formatForField(field2) }) })
|
|
23133
23261
|
] }) : calculate ? "Calculate" : "Summarize"
|
|
23134
23262
|
}
|
|
23135
23263
|
) }),
|
|
23136
|
-
/* @__PURE__ */
|
|
23137
|
-
/* @__PURE__ */
|
|
23138
|
-
offered === null ? /* @__PURE__ */
|
|
23264
|
+
/* @__PURE__ */ jsxs68(DropdownMenuContent2, { align: "start", children: [
|
|
23265
|
+
/* @__PURE__ */ jsx74(DropdownMenuLabel, { className: "text-xs", children: fieldName(field2) }),
|
|
23266
|
+
offered === null ? /* @__PURE__ */ jsx74(DropdownMenuLabel, { className: "text-xs font-normal text-muted-foreground", children: "Asking the store which measures it offers\u2026" }) : offered.length === 0 ? /* @__PURE__ */ jsx74(DropdownMenuLabel, { className: "text-xs font-normal text-muted-foreground", children: "The store offers no measure for this column." }) : offered.map((op2) => /* @__PURE__ */ jsx74(
|
|
23139
23267
|
DropdownMenuItem2,
|
|
23140
23268
|
{
|
|
23141
23269
|
"data-records-summary-choice": op2,
|
|
@@ -23145,9 +23273,9 @@ function SummaryCell({
|
|
|
23145
23273
|
},
|
|
23146
23274
|
op2
|
|
23147
23275
|
)),
|
|
23148
|
-
chosen ? /* @__PURE__ */
|
|
23149
|
-
/* @__PURE__ */
|
|
23150
|
-
/* @__PURE__ */
|
|
23276
|
+
chosen ? /* @__PURE__ */ jsxs68(Fragment24, { children: [
|
|
23277
|
+
/* @__PURE__ */ jsx74(DropdownMenuSeparator2, {}),
|
|
23278
|
+
/* @__PURE__ */ jsx74(DropdownMenuItem2, { onSelect: () => onChoose(null), children: calculate ? "None" : "No summary" })
|
|
23151
23279
|
] }) : null
|
|
23152
23280
|
] })
|
|
23153
23281
|
] });
|
|
@@ -23183,10 +23311,10 @@ function SummarySheetControls({
|
|
|
23183
23311
|
const offered = field2 && operations ? measuresFor(field2, operations, field2.key === firstKey) : null;
|
|
23184
23312
|
const current = columnKey ? chosen[columnKey] : void 0;
|
|
23185
23313
|
const control = "h-10 min-w-0 flex-1 text-base";
|
|
23186
|
-
return /* @__PURE__ */
|
|
23187
|
-
/* @__PURE__ */
|
|
23188
|
-
/* @__PURE__ */
|
|
23189
|
-
/* @__PURE__ */
|
|
23314
|
+
return /* @__PURE__ */ jsxs68("div", { className: "flex flex-col gap-1.5", "data-records-grid-sheet-summaries": "", children: [
|
|
23315
|
+
/* @__PURE__ */ jsx74("span", { className: "text-xs font-medium text-muted-foreground", children: "Summaries" }),
|
|
23316
|
+
/* @__PURE__ */ jsxs68("div", { className: "flex items-center gap-2", children: [
|
|
23317
|
+
/* @__PURE__ */ jsx74("span", { className: "contents", onFocusCapture: askOperations, onPointerDownCapture: askOperations, children: /* @__PURE__ */ jsx74(
|
|
23190
23318
|
PickOne,
|
|
23191
23319
|
{
|
|
23192
23320
|
label: "Summarize which column",
|
|
@@ -23203,7 +23331,7 @@ function SummarySheetControls({
|
|
|
23203
23331
|
}))
|
|
23204
23332
|
}
|
|
23205
23333
|
) }),
|
|
23206
|
-
field2 ? offered === null ? /* @__PURE__ */
|
|
23334
|
+
field2 ? offered === null ? /* @__PURE__ */ jsx74("span", { className: "text-xs text-muted-foreground", children: "Asking the store which measures it offers\u2026" }) : offered.length === 0 ? /* @__PURE__ */ jsx74("span", { className: "text-xs text-muted-foreground", children: "The store offers no measure for this column." }) : /* @__PURE__ */ jsx74(
|
|
23207
23335
|
PickOne,
|
|
23208
23336
|
{
|
|
23209
23337
|
label: "Summarize as",
|
|
@@ -23354,7 +23482,7 @@ function planTableClean(rows, keys, enabled) {
|
|
|
23354
23482
|
// src/ColumnCleanDialog.tsx
|
|
23355
23483
|
init_names();
|
|
23356
23484
|
init_plainWords();
|
|
23357
|
-
import { jsx as
|
|
23485
|
+
import { jsx as jsx75, jsxs as jsxs69 } from "react/jsx-runtime";
|
|
23358
23486
|
var PAGE2 = 500;
|
|
23359
23487
|
var SHOWN = 6;
|
|
23360
23488
|
function cleanBulkPlan(field2, cells) {
|
|
@@ -23437,14 +23565,14 @@ function ColumnCleanDialog({
|
|
|
23437
23565
|
onClose();
|
|
23438
23566
|
}
|
|
23439
23567
|
};
|
|
23440
|
-
return /* @__PURE__ */
|
|
23441
|
-
/* @__PURE__ */
|
|
23442
|
-
/* @__PURE__ */
|
|
23443
|
-
/* @__PURE__ */
|
|
23568
|
+
return /* @__PURE__ */ jsx75(Dialog10, { open: true, onOpenChange: (open) => !open && !busy ? onClose() : void 0, children: /* @__PURE__ */ jsxs69(DialogContent10, { className: "sm:max-w-lg", "data-column-clean": "", children: [
|
|
23569
|
+
/* @__PURE__ */ jsxs69(DialogHeader10, { children: [
|
|
23570
|
+
/* @__PURE__ */ jsx75(DialogTitle10, { children: title }),
|
|
23571
|
+
/* @__PURE__ */ jsx75(DialogDescription7, { className: "sr-only", children: whole ? "Tidy the text in every text column." : "Tidy the text in every row of this column." })
|
|
23444
23572
|
] }),
|
|
23445
|
-
failed ? /* @__PURE__ */
|
|
23446
|
-
/* @__PURE__ */
|
|
23447
|
-
/* @__PURE__ */
|
|
23573
|
+
failed ? /* @__PURE__ */ jsx75("p", { className: "text-sm text-destructive", children: failed }) : !plan ? /* @__PURE__ */ jsx75("p", { className: "text-sm text-muted-foreground", "data-column-clean-scanning": "", children: "Reading every row\u2026" }) : /* @__PURE__ */ jsxs69("div", { className: "flex flex-col gap-3", children: [
|
|
23574
|
+
/* @__PURE__ */ jsx75("div", { className: "flex flex-col gap-1.5", children: CLEAN_OPERATIONS.map((op2) => /* @__PURE__ */ jsxs69(Label14, { className: "flex items-center gap-2 text-sm font-normal", children: [
|
|
23575
|
+
/* @__PURE__ */ jsx75(
|
|
23448
23576
|
"input",
|
|
23449
23577
|
{
|
|
23450
23578
|
type: "checkbox",
|
|
@@ -23458,42 +23586,42 @@ function ColumnCleanDialog({
|
|
|
23458
23586
|
})
|
|
23459
23587
|
}
|
|
23460
23588
|
),
|
|
23461
|
-
/* @__PURE__ */
|
|
23462
|
-
/* @__PURE__ */
|
|
23589
|
+
/* @__PURE__ */ jsx75("span", { className: "flex-1", children: op2.label }),
|
|
23590
|
+
/* @__PURE__ */ jsx75("span", { className: "text-xs tabular-nums text-muted-foreground", children: plan.perOperation[op2.id] })
|
|
23463
23591
|
] }, op2.id)) }),
|
|
23464
|
-
/* @__PURE__ */
|
|
23592
|
+
/* @__PURE__ */ jsx75("div", { className: "rounded-md border", "data-column-clean-review": "", children: plan.cells.length === 0 ? /* @__PURE__ */ jsx75("p", { className: "px-3 py-2 text-sm text-muted-foreground", children: "Nothing to clean." }) : whole ? (
|
|
23465
23593
|
// ONE REVIEW, GROUPED BY TYPE OF CHANGE (the Sheet's CellCleanupReviewDialog).
|
|
23466
|
-
/* @__PURE__ */
|
|
23467
|
-
/* @__PURE__ */
|
|
23468
|
-
/* @__PURE__ */
|
|
23469
|
-
/* @__PURE__ */
|
|
23594
|
+
/* @__PURE__ */ jsx75("div", { className: "max-h-72 divide-y overflow-y-auto text-xs", "data-table-clean-groups": "", children: plan.byOperation.map((group) => /* @__PURE__ */ jsxs69("div", { className: "flex flex-col gap-1 px-3 py-1.5", "data-table-clean-group": group.id, children: [
|
|
23595
|
+
/* @__PURE__ */ jsxs69("span", { className: "flex items-center gap-2 font-medium", children: [
|
|
23596
|
+
/* @__PURE__ */ jsx75("span", { className: "flex-1", children: group.label }),
|
|
23597
|
+
/* @__PURE__ */ jsx75("span", { className: "tabular-nums text-muted-foreground", children: group.cells.length })
|
|
23470
23598
|
] }),
|
|
23471
|
-
group.cells.slice(0, 3).map((c) => /* @__PURE__ */
|
|
23472
|
-
/* @__PURE__ */
|
|
23473
|
-
/* @__PURE__ */
|
|
23474
|
-
/* @__PURE__ */
|
|
23599
|
+
group.cells.slice(0, 3).map((c) => /* @__PURE__ */ jsxs69("span", { className: "grid grid-cols-[6rem_1fr_1fr] gap-2", children: [
|
|
23600
|
+
/* @__PURE__ */ jsx75("span", { className: "truncate text-muted-foreground", children: nameOf3(c.key) }),
|
|
23601
|
+
/* @__PURE__ */ jsx75("span", { className: "truncate text-muted-foreground line-through", children: c.before }),
|
|
23602
|
+
/* @__PURE__ */ jsx75("span", { className: "truncate", children: c.after })
|
|
23475
23603
|
] }, `${c.rowId}:${c.key}`)),
|
|
23476
|
-
group.cells.length > 3 ? /* @__PURE__ */
|
|
23604
|
+
group.cells.length > 3 ? /* @__PURE__ */ jsxs69("span", { className: "text-muted-foreground", children: [
|
|
23477
23605
|
"+",
|
|
23478
23606
|
group.cells.length - 3,
|
|
23479
23607
|
" more"
|
|
23480
23608
|
] }) : null
|
|
23481
23609
|
] }, group.id)) })
|
|
23482
|
-
) : /* @__PURE__ */
|
|
23483
|
-
plan.cells.slice(0, SHOWN).map((c) => /* @__PURE__ */
|
|
23484
|
-
/* @__PURE__ */
|
|
23485
|
-
/* @__PURE__ */
|
|
23610
|
+
) : /* @__PURE__ */ jsxs69("ul", { className: "divide-y text-xs", children: [
|
|
23611
|
+
plan.cells.slice(0, SHOWN).map((c) => /* @__PURE__ */ jsxs69("li", { className: "grid grid-cols-2 gap-2 px-3 py-1.5", children: [
|
|
23612
|
+
/* @__PURE__ */ jsx75("span", { className: "truncate text-muted-foreground line-through", children: c.before }),
|
|
23613
|
+
/* @__PURE__ */ jsx75("span", { className: "truncate", children: c.after })
|
|
23486
23614
|
] }, c.rowId)),
|
|
23487
|
-
plan.cells.length > SHOWN ? /* @__PURE__ */
|
|
23615
|
+
plan.cells.length > SHOWN ? /* @__PURE__ */ jsxs69("li", { className: "px-3 py-1.5 text-muted-foreground", children: [
|
|
23488
23616
|
"+",
|
|
23489
23617
|
plan.cells.length - SHOWN,
|
|
23490
23618
|
" more"
|
|
23491
23619
|
] }) : null
|
|
23492
23620
|
] }) })
|
|
23493
23621
|
] }),
|
|
23494
|
-
/* @__PURE__ */
|
|
23495
|
-
/* @__PURE__ */
|
|
23496
|
-
/* @__PURE__ */
|
|
23622
|
+
/* @__PURE__ */ jsxs69(DialogFooter6, { children: [
|
|
23623
|
+
/* @__PURE__ */ jsx75(Button42, { variant: "ghost", onClick: onClose, disabled: busy, children: "Cancel" }),
|
|
23624
|
+
/* @__PURE__ */ jsx75(Button42, { onClick: () => void apply(), disabled: busy || !plan || plan.cells.length === 0, "data-column-clean-apply": "", children: plan && plan.cells.length > 0 ? `Clean ${plan.cells.length} ${plan.cells.length === 1 ? "cell" : "cells"}` : "Clean" })
|
|
23497
23625
|
] })
|
|
23498
23626
|
] }) });
|
|
23499
23627
|
}
|
|
@@ -23516,7 +23644,7 @@ import {
|
|
|
23516
23644
|
Label as Label15
|
|
23517
23645
|
} from "@ai-matrx/design-system";
|
|
23518
23646
|
init_plainWords();
|
|
23519
|
-
import { jsx as
|
|
23647
|
+
import { jsx as jsx76, jsxs as jsxs70 } from "react/jsx-runtime";
|
|
23520
23648
|
function NewFromTemplateMenu(props) {
|
|
23521
23649
|
const client = useRecordsClient34();
|
|
23522
23650
|
const [templates, setTemplates] = useState60(null);
|
|
@@ -23524,9 +23652,9 @@ function NewFromTemplateMenu(props) {
|
|
|
23524
23652
|
setTemplates(null);
|
|
23525
23653
|
void client.rowTemplates({ table_id: props.tableId }).then((answer) => setTemplates(answer.ok ? answer.data : []));
|
|
23526
23654
|
}, [client, props.tableId]);
|
|
23527
|
-
return /* @__PURE__ */
|
|
23528
|
-
/* @__PURE__ */
|
|
23529
|
-
/* @__PURE__ */
|
|
23655
|
+
return /* @__PURE__ */ jsxs70(DropdownMenu3, { onOpenChange: (open) => open ? read() : void 0, children: [
|
|
23656
|
+
/* @__PURE__ */ jsx76(DropdownMenuTrigger3, { asChild: true, children: /* @__PURE__ */ jsx76(Button43, { size: "sm", variant: "outline", className: "shrink-0", disabled: props.busy, "data-records-new-from-template": "", children: "From template" }) }),
|
|
23657
|
+
/* @__PURE__ */ jsx76(DropdownMenuContent3, { align: "end", className: "text-xs", children: templates === null ? /* @__PURE__ */ jsx76(DropdownMenuItem3, { disabled: true, className: "text-xs", children: "Reading templates\u2026" }) : templates.length === 0 ? /* @__PURE__ */ jsx76(DropdownMenuItem3, { disabled: true, className: "text-xs", children: "No templates yet. Save a row as one from its menu." }) : templates.map((t) => /* @__PURE__ */ jsx76(DropdownMenuItem3, { className: "text-xs", onSelect: () => props.onPick({ ...t.values }), children: t.name }, t.template_id)) })
|
|
23530
23658
|
] });
|
|
23531
23659
|
}
|
|
23532
23660
|
function templateValuesOf(row, fields, titleField) {
|
|
@@ -23562,9 +23690,9 @@ function SaveAsTemplateDialog(props) {
|
|
|
23562
23690
|
props.notify?.success(`Saved template ${name.trim()}.`);
|
|
23563
23691
|
props.onClose();
|
|
23564
23692
|
};
|
|
23565
|
-
return /* @__PURE__ */
|
|
23566
|
-
/* @__PURE__ */
|
|
23567
|
-
/* @__PURE__ */
|
|
23693
|
+
return /* @__PURE__ */ jsx76(Dialog11, { open: props.row !== null, onOpenChange: (open) => !open ? props.onClose() : void 0, children: /* @__PURE__ */ jsxs70(DialogContent11, { className: "sm:max-w-sm", children: [
|
|
23694
|
+
/* @__PURE__ */ jsx76(DialogHeader11, { children: /* @__PURE__ */ jsx76(DialogTitle11, { children: "Save as template" }) }),
|
|
23695
|
+
/* @__PURE__ */ jsxs70(
|
|
23568
23696
|
"form",
|
|
23569
23697
|
{
|
|
23570
23698
|
className: "flex flex-col gap-2",
|
|
@@ -23573,12 +23701,12 @@ function SaveAsTemplateDialog(props) {
|
|
|
23573
23701
|
void save();
|
|
23574
23702
|
},
|
|
23575
23703
|
children: [
|
|
23576
|
-
/* @__PURE__ */
|
|
23577
|
-
/* @__PURE__ */
|
|
23578
|
-
refused ? /* @__PURE__ */
|
|
23579
|
-
/* @__PURE__ */
|
|
23580
|
-
/* @__PURE__ */
|
|
23581
|
-
/* @__PURE__ */
|
|
23704
|
+
/* @__PURE__ */ jsx76(Label15, { className: "text-xs", htmlFor: "records-grid-template-name", children: "Template name" }),
|
|
23705
|
+
/* @__PURE__ */ jsx76(BasicInput16, { id: "records-grid-template-name", autoFocus: true, value: name, onChange: (e) => setName(e.target.value) }),
|
|
23706
|
+
refused ? /* @__PURE__ */ jsx76("p", { className: "text-xs text-destructive", children: refused }) : null,
|
|
23707
|
+
/* @__PURE__ */ jsxs70(DialogFooter7, { children: [
|
|
23708
|
+
/* @__PURE__ */ jsx76(Button43, { type: "button", variant: "ghost", size: "sm", onClick: props.onClose, children: "Cancel" }),
|
|
23709
|
+
/* @__PURE__ */ jsx76(Button43, { type: "submit", size: "sm", disabled: busy || name.trim() === "", children: "Save" })
|
|
23582
23710
|
] })
|
|
23583
23711
|
]
|
|
23584
23712
|
}
|
|
@@ -23601,7 +23729,7 @@ import {
|
|
|
23601
23729
|
DialogTitle as DialogTitle12
|
|
23602
23730
|
} from "@ai-matrx/design-system";
|
|
23603
23731
|
init_host();
|
|
23604
|
-
import { jsx as
|
|
23732
|
+
import { jsx as jsx77, jsxs as jsxs71 } from "react/jsx-runtime";
|
|
23605
23733
|
function isTextColumn(field2) {
|
|
23606
23734
|
if (!field2) return false;
|
|
23607
23735
|
const kind2 = editorKindFor(field2);
|
|
@@ -23649,22 +23777,22 @@ function WholeTextDialog({
|
|
|
23649
23777
|
if (draft !== startingText) onSave(target.rowId, target.key, draft === "" ? null : draft);
|
|
23650
23778
|
onClose();
|
|
23651
23779
|
};
|
|
23652
|
-
return /* @__PURE__ */
|
|
23653
|
-
/* @__PURE__ */
|
|
23654
|
-
/* @__PURE__ */
|
|
23655
|
-
/* @__PURE__ */
|
|
23780
|
+
return /* @__PURE__ */ jsx77(Dialog12, { open, onOpenChange: (next) => !next ? onClose() : void 0, children: /* @__PURE__ */ jsxs71(DialogContent12, { className: "sm:max-w-2xl", "data-records-whole-text": "", children: [
|
|
23781
|
+
/* @__PURE__ */ jsxs71(DialogHeader12, { children: [
|
|
23782
|
+
/* @__PURE__ */ jsx77(DialogTitle12, { children: title }),
|
|
23783
|
+
/* @__PURE__ */ jsxs71(DialogDescription8, { children: [
|
|
23656
23784
|
target ? `${target.rowTitle} \xB7 ` : "",
|
|
23657
23785
|
mayWrite ? "Cmd-Enter saves, Escape closes without saving." : whyNot
|
|
23658
23786
|
] })
|
|
23659
23787
|
] }),
|
|
23660
|
-
ready && renderText ? /* @__PURE__ */
|
|
23661
|
-
/* @__PURE__ */
|
|
23662
|
-
/* @__PURE__ */
|
|
23788
|
+
ready && renderText ? /* @__PURE__ */ jsxs71("div", { className: "flex items-center gap-1", role: "tablist", "aria-label": "How the text shows", children: [
|
|
23789
|
+
/* @__PURE__ */ jsx77(Button44, { size: "sm", variant: reading ? "ghost" : "secondary", role: "tab", "aria-selected": !reading, onClick: () => setReading(false), "data-records-whole-text-mode": "words", children: mayWrite ? "Edit" : "Words" }),
|
|
23790
|
+
/* @__PURE__ */ jsx77(Button44, { size: "sm", variant: reading ? "secondary" : "ghost", role: "tab", "aria-selected": reading, onClick: () => setReading(true), "data-records-whole-text-mode": "preview", children: "Preview" })
|
|
23663
23791
|
] }) : null,
|
|
23664
|
-
ready && reading && renderText ? /* @__PURE__ */
|
|
23792
|
+
ready && reading && renderText ? /* @__PURE__ */ jsx77("div", { className: "max-h-[60vh] min-h-[8rem] overflow-auto rounded-md border px-3 py-2 text-sm", "data-records-whole-text-preview": "", children: draft ? renderText(draft, "cell") : /* @__PURE__ */ jsx77("span", { className: "text-muted-foreground", children: "\u2014" }) }) : ready && textBox ? (
|
|
23665
23793
|
// THE HOST'S TEXT BOX (`textBox`): the same words, with its "…" menu (Clean up, Help with
|
|
23666
23794
|
// this…, Copy, Save, Share). What its menu puts in the box is unsaved until Save.
|
|
23667
|
-
/* @__PURE__ */
|
|
23795
|
+
/* @__PURE__ */ jsx77("div", { "data-records-whole-text-box": "", children: textBox({
|
|
23668
23796
|
value: draft ?? "",
|
|
23669
23797
|
onChange: (next) => {
|
|
23670
23798
|
setDraft(next);
|
|
@@ -23682,7 +23810,7 @@ function WholeTextDialog({
|
|
|
23682
23810
|
}
|
|
23683
23811
|
}
|
|
23684
23812
|
}) })
|
|
23685
|
-
) : ready ? /* @__PURE__ */
|
|
23813
|
+
) : ready ? /* @__PURE__ */ jsx77(
|
|
23686
23814
|
BasicTextarea7,
|
|
23687
23815
|
{
|
|
23688
23816
|
autoFocus: true,
|
|
@@ -23702,10 +23830,10 @@ function WholeTextDialog({
|
|
|
23702
23830
|
}
|
|
23703
23831
|
}
|
|
23704
23832
|
}
|
|
23705
|
-
) : /* @__PURE__ */
|
|
23706
|
-
cleanNote ? /* @__PURE__ */
|
|
23707
|
-
/* @__PURE__ */
|
|
23708
|
-
canClean && mayWrite ? /* @__PURE__ */
|
|
23833
|
+
) : /* @__PURE__ */ jsx77("p", { className: "text-sm text-muted-foreground", "data-records-whole-text-state": whole.state, children: target?.pointer ? whole.state === "loading" ? wholeValueOpening(target.pointer) : whole.state === "failed" ? `The whole text could not be opened (${whole.why}).` : WHOLE_VALUE_NOT_EDITABLE_HERE : null }),
|
|
23834
|
+
cleanNote ? /* @__PURE__ */ jsx77("p", { className: "text-xs text-muted-foreground", children: cleanNote }) : null,
|
|
23835
|
+
/* @__PURE__ */ jsxs71(DialogFooter8, { className: "gap-2", children: [
|
|
23836
|
+
canClean && mayWrite ? /* @__PURE__ */ jsx77(
|
|
23709
23837
|
Button44,
|
|
23710
23838
|
{
|
|
23711
23839
|
variant: "outline",
|
|
@@ -23719,8 +23847,8 @@ function WholeTextDialog({
|
|
|
23719
23847
|
children: "Clean HTML"
|
|
23720
23848
|
}
|
|
23721
23849
|
) : null,
|
|
23722
|
-
/* @__PURE__ */
|
|
23723
|
-
mayWrite && ready ? /* @__PURE__ */
|
|
23850
|
+
/* @__PURE__ */ jsx77(Button44, { variant: "ghost", onClick: onClose, children: mayWrite ? "Cancel" : "Close" }),
|
|
23851
|
+
mayWrite && ready ? /* @__PURE__ */ jsx77(Button44, { onClick: save, "data-records-whole-text-save": "", children: "Save" }) : null
|
|
23724
23852
|
] })
|
|
23725
23853
|
] }) });
|
|
23726
23854
|
}
|
|
@@ -23731,7 +23859,7 @@ init_parity();
|
|
|
23731
23859
|
init_pasteValues();
|
|
23732
23860
|
init_host();
|
|
23733
23861
|
init_plainWords();
|
|
23734
|
-
import { Fragment as
|
|
23862
|
+
import { Fragment as Fragment25, jsx as jsx78, jsxs as jsxs72 } from "react/jsx-runtime";
|
|
23735
23863
|
var VALUE_COUNTS_FRESH_MS = 1e4;
|
|
23736
23864
|
var CLEAN_TABLE_LABEL = "Clean table\u2026";
|
|
23737
23865
|
function filterForValue(field2, value) {
|
|
@@ -24296,7 +24424,7 @@ function useMergedGridControls(args) {
|
|
|
24296
24424
|
[enabled, order, hidden, keepColumns]
|
|
24297
24425
|
);
|
|
24298
24426
|
const close = () => setDialog(null);
|
|
24299
|
-
const dialogs = !enabled ? null : /* @__PURE__ */
|
|
24427
|
+
const dialogs = !enabled ? null : /* @__PURE__ */ jsxs72(Fragment25, { children: [
|
|
24300
24428
|
colours.dialogs,
|
|
24301
24429
|
dialog?.kind === "access" && columnAccess ? columnAccess({
|
|
24302
24430
|
tableId,
|
|
@@ -24305,8 +24433,8 @@ function useMergedGridControls(args) {
|
|
|
24305
24433
|
onClose: () => setDialog(null),
|
|
24306
24434
|
onChanged: () => tableShapeChanged6(tableId)
|
|
24307
24435
|
}) : null,
|
|
24308
|
-
/* @__PURE__ */
|
|
24309
|
-
/* @__PURE__ */
|
|
24436
|
+
/* @__PURE__ */ jsx78(RowActionsDialog, { tableId, open: rowActionsOpen, onOpenChange: setRowActionsOpen }),
|
|
24437
|
+
/* @__PURE__ */ jsx78(
|
|
24310
24438
|
RowLabelPicker,
|
|
24311
24439
|
{
|
|
24312
24440
|
open: labelling,
|
|
@@ -24321,7 +24449,7 @@ function useMergedGridControls(args) {
|
|
|
24321
24449
|
notify
|
|
24322
24450
|
}
|
|
24323
24451
|
),
|
|
24324
|
-
/* @__PURE__ */
|
|
24452
|
+
/* @__PURE__ */ jsx78(
|
|
24325
24453
|
SaveAsTemplateDialog,
|
|
24326
24454
|
{
|
|
24327
24455
|
tableId,
|
|
@@ -24332,12 +24460,12 @@ function useMergedGridControls(args) {
|
|
|
24332
24460
|
notify
|
|
24333
24461
|
}
|
|
24334
24462
|
),
|
|
24335
|
-
/* @__PURE__ */
|
|
24336
|
-
/* @__PURE__ */
|
|
24337
|
-
/* @__PURE__ */
|
|
24338
|
-
/* @__PURE__ */
|
|
24463
|
+
/* @__PURE__ */ jsx78(Dialog13, { open: dialog?.kind === "rename", onOpenChange: (open) => !open ? close() : void 0, children: /* @__PURE__ */ jsxs72(DialogContent13, { className: "sm:max-w-sm", children: [
|
|
24464
|
+
/* @__PURE__ */ jsxs72(DialogHeader13, { children: [
|
|
24465
|
+
/* @__PURE__ */ jsx78(DialogTitle13, { children: "Rename column" }),
|
|
24466
|
+
/* @__PURE__ */ jsx78(DialogDescription9, { children: "The name people read at the top of the column. What it holds does not change." })
|
|
24339
24467
|
] }),
|
|
24340
|
-
/* @__PURE__ */
|
|
24468
|
+
/* @__PURE__ */ jsxs72(
|
|
24341
24469
|
"form",
|
|
24342
24470
|
{
|
|
24343
24471
|
className: "flex flex-col gap-2",
|
|
@@ -24358,18 +24486,18 @@ function useMergedGridControls(args) {
|
|
|
24358
24486
|
});
|
|
24359
24487
|
},
|
|
24360
24488
|
children: [
|
|
24361
|
-
/* @__PURE__ */
|
|
24362
|
-
/* @__PURE__ */
|
|
24363
|
-
mutation.error ? /* @__PURE__ */
|
|
24364
|
-
/* @__PURE__ */
|
|
24365
|
-
/* @__PURE__ */
|
|
24366
|
-
/* @__PURE__ */
|
|
24489
|
+
/* @__PURE__ */ jsx78(Label16, { className: "text-xs", htmlFor: "records-grid-rename", children: "Name" }),
|
|
24490
|
+
/* @__PURE__ */ jsx78(BasicInput17, { id: "records-grid-rename", autoFocus: true, value: renameTo, onChange: (e) => setRenameTo(e.target.value) }),
|
|
24491
|
+
mutation.error ? /* @__PURE__ */ jsx78(RefusalNotice, { error: mutation.error }) : null,
|
|
24492
|
+
/* @__PURE__ */ jsxs72(DialogFooter9, { children: [
|
|
24493
|
+
/* @__PURE__ */ jsx78(Button45, { type: "button", variant: "ghost", size: "sm", onClick: close, children: "Cancel" }),
|
|
24494
|
+
/* @__PURE__ */ jsx78(Button45, { type: "submit", size: "sm", disabled: renameTo.trim() === "", children: "Rename" })
|
|
24367
24495
|
] })
|
|
24368
24496
|
]
|
|
24369
24497
|
}
|
|
24370
24498
|
)
|
|
24371
24499
|
] }) }),
|
|
24372
|
-
/* @__PURE__ */
|
|
24500
|
+
/* @__PURE__ */ jsx78(
|
|
24373
24501
|
Dialog13,
|
|
24374
24502
|
{
|
|
24375
24503
|
open: dialog?.kind === "settings" || dialog?.kind === "insert",
|
|
@@ -24379,12 +24507,12 @@ function useMergedGridControls(args) {
|
|
|
24379
24507
|
close();
|
|
24380
24508
|
}
|
|
24381
24509
|
},
|
|
24382
|
-
children: /* @__PURE__ */
|
|
24383
|
-
/* @__PURE__ */
|
|
24384
|
-
/* @__PURE__ */
|
|
24385
|
-
/* @__PURE__ */
|
|
24510
|
+
children: /* @__PURE__ */ jsxs72(DialogContent13, { className: "max-h-[85vh] overflow-y-auto sm:max-w-2xl", children: [
|
|
24511
|
+
/* @__PURE__ */ jsxs72(DialogHeader13, { children: [
|
|
24512
|
+
/* @__PURE__ */ jsx78(DialogTitle13, { children: columnDialog?.kind === "settings" ? `Column settings \xB7 ${fieldName(columnDialog.field)}` : columnDialog?.kind === "insert" && columnDialog.anchor ? `Add column ${columnDialog.side === "left" ? "left" : "right"} of ${fieldOf2(columnDialog.anchor) ? fieldName(fieldOf2(columnDialog.anchor)) : columnDialog.anchor}` : ADD_FIELD_OPEN_LABEL }),
|
|
24513
|
+
/* @__PURE__ */ jsx78(DialogDescription9, { className: "sr-only", children: "Name, type and look" })
|
|
24386
24514
|
] }),
|
|
24387
|
-
columnDialog?.kind === "settings" ? /* @__PURE__ */
|
|
24515
|
+
columnDialog?.kind === "settings" ? /* @__PURE__ */ jsx78(
|
|
24388
24516
|
FieldEditor,
|
|
24389
24517
|
{
|
|
24390
24518
|
tableId,
|
|
@@ -24401,7 +24529,7 @@ function useMergedGridControls(args) {
|
|
|
24401
24529
|
onCancel: close
|
|
24402
24530
|
},
|
|
24403
24531
|
`${columnDialog.field.id}-${insertEpoch.current}`
|
|
24404
|
-
) : columnDialog?.kind === "insert" ? /* @__PURE__ */
|
|
24532
|
+
) : columnDialog?.kind === "insert" ? /* @__PURE__ */ jsx78(
|
|
24405
24533
|
FieldEditor,
|
|
24406
24534
|
{
|
|
24407
24535
|
tableId,
|
|
@@ -24419,7 +24547,7 @@ function useMergedGridControls(args) {
|
|
|
24419
24547
|
] })
|
|
24420
24548
|
}
|
|
24421
24549
|
),
|
|
24422
|
-
dialog?.kind === "merge" ? /* @__PURE__ */
|
|
24550
|
+
dialog?.kind === "merge" ? /* @__PURE__ */ jsx78(
|
|
24423
24551
|
MergeRecordDialog,
|
|
24424
24552
|
{
|
|
24425
24553
|
tableId,
|
|
@@ -24430,7 +24558,7 @@ function useMergedGridControls(args) {
|
|
|
24430
24558
|
}
|
|
24431
24559
|
}
|
|
24432
24560
|
) : null,
|
|
24433
|
-
dialog?.kind === "split" ? /* @__PURE__ */
|
|
24561
|
+
dialog?.kind === "split" ? /* @__PURE__ */ jsx78(
|
|
24434
24562
|
SplitRecordDialog,
|
|
24435
24563
|
{
|
|
24436
24564
|
tableId,
|
|
@@ -24442,7 +24570,7 @@ function useMergedGridControls(args) {
|
|
|
24442
24570
|
}
|
|
24443
24571
|
}
|
|
24444
24572
|
) : null,
|
|
24445
|
-
dialog?.kind === "extract-parent" ? /* @__PURE__ */
|
|
24573
|
+
dialog?.kind === "extract-parent" ? /* @__PURE__ */ jsx78(
|
|
24446
24574
|
ExtractParentDialog,
|
|
24447
24575
|
{
|
|
24448
24576
|
tableId,
|
|
@@ -24454,7 +24582,7 @@ function useMergedGridControls(args) {
|
|
|
24454
24582
|
}
|
|
24455
24583
|
}
|
|
24456
24584
|
) : null,
|
|
24457
|
-
/* @__PURE__ */
|
|
24585
|
+
/* @__PURE__ */ jsx78(
|
|
24458
24586
|
Dialog13,
|
|
24459
24587
|
{
|
|
24460
24588
|
modal: true,
|
|
@@ -24462,18 +24590,18 @@ function useMergedGridControls(args) {
|
|
|
24462
24590
|
onOpenChange: (open) => {
|
|
24463
24591
|
if (!open) close();
|
|
24464
24592
|
},
|
|
24465
|
-
children: /* @__PURE__ */
|
|
24466
|
-
/* @__PURE__ */
|
|
24467
|
-
/* @__PURE__ */
|
|
24468
|
-
/* @__PURE__ */
|
|
24593
|
+
children: /* @__PURE__ */ jsxs72(DialogContent13, { className: "sm:max-w-lg", children: [
|
|
24594
|
+
/* @__PURE__ */ jsxs72(DialogHeader13, { children: [
|
|
24595
|
+
/* @__PURE__ */ jsx78(DialogTitle13, { children: dialog?.kind === "retype" ? `Change type \xB7 ${fieldName(dialog.field)}` : "Change type" }),
|
|
24596
|
+
/* @__PURE__ */ jsx78(DialogDescription9, { children: "Values that fit convert. The rest stay with their records, in History." })
|
|
24469
24597
|
] }),
|
|
24470
|
-
dialog?.kind === "retype" ? /* @__PURE__ */
|
|
24598
|
+
dialog?.kind === "retype" ? /* @__PURE__ */ jsx78(FieldRetype, { field: dialog.field, tableId }, dialog.field.id) : null
|
|
24471
24599
|
] })
|
|
24472
24600
|
}
|
|
24473
24601
|
),
|
|
24474
|
-
dialog?.kind === "cleanTable" && args.bulkApply ? /* @__PURE__ */
|
|
24475
|
-
dialog?.kind === "clean" && args.bulkApply ? /* @__PURE__ */
|
|
24476
|
-
/* @__PURE__ */
|
|
24602
|
+
dialog?.kind === "cleanTable" && args.bulkApply ? /* @__PURE__ */ jsx78(ColumnCleanDialog, { tableId, fields: fields.filter((f) => isTextColumn(f) && fieldIsEditable(f)), onApply: args.bulkApply, onClose: close, notify }) : null,
|
|
24603
|
+
dialog?.kind === "clean" && args.bulkApply ? /* @__PURE__ */ jsx78(ColumnCleanDialog, { tableId, field: dialog.field, ...dialog.row ? { row: dialog.row } : {}, onApply: args.bulkApply, onClose: close, notify }) : null,
|
|
24604
|
+
/* @__PURE__ */ jsx78(
|
|
24477
24605
|
ConfirmDialog3,
|
|
24478
24606
|
{
|
|
24479
24607
|
open: dialog?.kind === "backlink",
|
|
@@ -24501,7 +24629,7 @@ function useMergedGridControls(args) {
|
|
|
24501
24629
|
}
|
|
24502
24630
|
}
|
|
24503
24631
|
),
|
|
24504
|
-
/* @__PURE__ */
|
|
24632
|
+
/* @__PURE__ */ jsx78(
|
|
24505
24633
|
ConfirmDialog3,
|
|
24506
24634
|
{
|
|
24507
24635
|
open: dialog?.kind === "delete",
|
|
@@ -24536,9 +24664,9 @@ function useMergedGridControls(args) {
|
|
|
24536
24664
|
columns: columnsControl,
|
|
24537
24665
|
dialogs,
|
|
24538
24666
|
addColumn: () => setDialog({ kind: "insert", anchor: null, side: "right" }),
|
|
24539
|
-
sheetTools: enabled ? /* @__PURE__ */
|
|
24667
|
+
sheetTools: enabled ? /* @__PURE__ */ jsxs72(Fragment25, { children: [
|
|
24540
24668
|
colours.sheet,
|
|
24541
|
-
args.summaries ? /* @__PURE__ */
|
|
24669
|
+
args.summaries ? /* @__PURE__ */ jsx78(
|
|
24542
24670
|
SummarySheetControls,
|
|
24543
24671
|
{
|
|
24544
24672
|
fields: order.filter((k) => !hidden.includes(k)).map(fieldOf2).filter((f) => Boolean(f)),
|
|
@@ -24637,7 +24765,7 @@ init_Refusal();
|
|
|
24637
24765
|
import { Button as Button46, Separator as Separator3, cn as cn41 } from "@ai-matrx/design-system";
|
|
24638
24766
|
import { mapPgError } from "@ai-matrx/records/core";
|
|
24639
24767
|
init_plainWords();
|
|
24640
|
-
import { jsx as
|
|
24768
|
+
import { jsx as jsx79, jsxs as jsxs73 } from "react/jsx-runtime";
|
|
24641
24769
|
function isEmptyValue(value) {
|
|
24642
24770
|
return value === null || value === void 0 || value === "" || Array.isArray(value) && value.length === 0;
|
|
24643
24771
|
}
|
|
@@ -24871,11 +24999,11 @@ function CustomFieldsSection({
|
|
|
24871
24999
|
if (!read.loading && !read.error && fields.length === 0 && !mayAdd && !rights.data) return null;
|
|
24872
25000
|
const storeReason = rights.data?.reason ?? null;
|
|
24873
25001
|
const reason = storeReason && entityLabel && rights.data?.label ? storeReason.split(rights.data.label).join(entityLabel) : storeReason;
|
|
24874
|
-
const cannotAdd = rights.data && !rights.data.may_declare ? /* @__PURE__ */
|
|
24875
|
-
reason ? /* @__PURE__ */
|
|
24876
|
-
onMakeOwnTable ? /* @__PURE__ */
|
|
25002
|
+
const cannotAdd = rights.data && !rights.data.may_declare ? /* @__PURE__ */ jsxs73("div", { className: "flex min-w-0 flex-wrap items-center gap-2", "data-records-custom-fields-cannot-add": "", children: [
|
|
25003
|
+
reason ? /* @__PURE__ */ jsx79("p", { className: "min-w-0 text-[11px] text-muted-foreground", children: reason }) : null,
|
|
25004
|
+
onMakeOwnTable ? /* @__PURE__ */ jsx79(Button46, { size: "sm", variant: "ghost", className: "ml-auto", onClick: onMakeOwnTable, children: "Make your own table" }) : null
|
|
24877
25005
|
] }) : null;
|
|
24878
|
-
const editor = adding ? /* @__PURE__ */
|
|
25006
|
+
const editor = adding ? /* @__PURE__ */ jsx79(
|
|
24879
25007
|
FieldEditor,
|
|
24880
25008
|
{
|
|
24881
25009
|
entityToken,
|
|
@@ -24887,24 +25015,24 @@ function CustomFieldsSection({
|
|
|
24887
25015
|
onCancel: () => setAdding(false)
|
|
24888
25016
|
}
|
|
24889
25017
|
) : null;
|
|
24890
|
-
if (read.error) return /* @__PURE__ */
|
|
25018
|
+
if (read.error) return /* @__PURE__ */ jsx79(RefusalLine, { error: read.error, className });
|
|
24891
25019
|
const values = read.data?.custom ?? {};
|
|
24892
25020
|
const empty = fields.length === 0;
|
|
24893
25021
|
if (empty && !adding) {
|
|
24894
|
-
return /* @__PURE__ */
|
|
24895
|
-
/* @__PURE__ */
|
|
24896
|
-
/* @__PURE__ */
|
|
24897
|
-
!read.loading ? /* @__PURE__ */
|
|
24898
|
-
mayAdd ? /* @__PURE__ */
|
|
25022
|
+
return /* @__PURE__ */ jsxs73("section", { className: cn41("flex min-w-0 flex-col gap-1 text-xs", className), children: [
|
|
25023
|
+
/* @__PURE__ */ jsxs73("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
25024
|
+
/* @__PURE__ */ jsx79("h3", { className: "text-sm font-medium", children: title }),
|
|
25025
|
+
!read.loading ? /* @__PURE__ */ jsx79("span", { className: "text-muted-foreground", children: "None yet" }) : null,
|
|
25026
|
+
mayAdd ? /* @__PURE__ */ jsx79(Button46, { size: "sm", variant: "ghost", className: "ml-auto", onClick: () => setAdding(true), children: "Add field" }) : null
|
|
24899
25027
|
] }),
|
|
24900
25028
|
cannotAdd
|
|
24901
25029
|
] });
|
|
24902
25030
|
}
|
|
24903
|
-
return /* @__PURE__ */
|
|
24904
|
-
/* @__PURE__ */
|
|
24905
|
-
/* @__PURE__ */
|
|
24906
|
-
!empty ? /* @__PURE__ */
|
|
24907
|
-
fields.length > 0 ? /* @__PURE__ */
|
|
25031
|
+
return /* @__PURE__ */ jsxs73("section", { className: cn41("flex min-w-0 flex-col gap-2 text-xs", className), children: [
|
|
25032
|
+
/* @__PURE__ */ jsxs73("div", { className: "flex items-center gap-2", children: [
|
|
25033
|
+
/* @__PURE__ */ jsx79("h3", { className: "text-sm font-medium", children: title }),
|
|
25034
|
+
!empty ? /* @__PURE__ */ jsx79("span", { className: "text-muted-foreground", children: fields.length }) : null,
|
|
25035
|
+
fields.length > 0 ? /* @__PURE__ */ jsx79(
|
|
24908
25036
|
Button46,
|
|
24909
25037
|
{
|
|
24910
25038
|
size: "sm",
|
|
@@ -24918,7 +25046,7 @@ function CustomFieldsSection({
|
|
|
24918
25046
|
children: editing ? "Cancel" : "Edit"
|
|
24919
25047
|
}
|
|
24920
25048
|
) : null,
|
|
24921
|
-
mayAdd && !editing && !adding ? /* @__PURE__ */
|
|
25049
|
+
mayAdd && !editing && !adding ? /* @__PURE__ */ jsx79(
|
|
24922
25050
|
Button46,
|
|
24923
25051
|
{
|
|
24924
25052
|
size: "sm",
|
|
@@ -24928,7 +25056,7 @@ function CustomFieldsSection({
|
|
|
24928
25056
|
children: "Add field"
|
|
24929
25057
|
}
|
|
24930
25058
|
) : null,
|
|
24931
|
-
editing ? /* @__PURE__ */
|
|
25059
|
+
editing ? /* @__PURE__ */ jsx79(
|
|
24932
25060
|
Button46,
|
|
24933
25061
|
{
|
|
24934
25062
|
size: "sm",
|
|
@@ -24950,18 +25078,18 @@ function CustomFieldsSection({
|
|
|
24950
25078
|
}
|
|
24951
25079
|
) : null
|
|
24952
25080
|
] }),
|
|
24953
|
-
/* @__PURE__ */
|
|
24954
|
-
writeError ? /* @__PURE__ */
|
|
24955
|
-
mutation.error ? /* @__PURE__ */
|
|
25081
|
+
/* @__PURE__ */ jsx79(Separator3, {}),
|
|
25082
|
+
writeError ? /* @__PURE__ */ jsx79(RefusalLine, { error: writeError }) : null,
|
|
25083
|
+
mutation.error ? /* @__PURE__ */ jsx79(RefusalLine, { error: mutation.error }) : null,
|
|
24956
25084
|
cannotAdd,
|
|
24957
25085
|
editor,
|
|
24958
|
-
editing ? /* @__PURE__ */
|
|
25086
|
+
editing ? /* @__PURE__ */ jsx79("div", { className: "flex flex-col gap-3", children: fields.map((f) => {
|
|
24959
25087
|
const field2 = asField(f);
|
|
24960
25088
|
const id = `cf-${recordId}-${f.key}`;
|
|
24961
|
-
return /* @__PURE__ */
|
|
24962
|
-
/* @__PURE__ */
|
|
24963
|
-
/* @__PURE__ */
|
|
24964
|
-
mayAdd && removing !== f.id ? /* @__PURE__ */
|
|
25089
|
+
return /* @__PURE__ */ jsxs73("div", { className: "flex min-w-0 flex-col gap-1", children: [
|
|
25090
|
+
/* @__PURE__ */ jsxs73("div", { className: "flex items-center gap-2", children: [
|
|
25091
|
+
/* @__PURE__ */ jsx79(FieldLabel, { field: field2, htmlFor: id }),
|
|
25092
|
+
mayAdd && removing !== f.id ? /* @__PURE__ */ jsx79(
|
|
24965
25093
|
Button46,
|
|
24966
25094
|
{
|
|
24967
25095
|
size: "sm",
|
|
@@ -24972,12 +25100,12 @@ function CustomFieldsSection({
|
|
|
24972
25100
|
}
|
|
24973
25101
|
) : null
|
|
24974
25102
|
] }),
|
|
24975
|
-
removing === f.id ? /* @__PURE__ */
|
|
24976
|
-
/* @__PURE__ */
|
|
25103
|
+
removing === f.id ? /* @__PURE__ */ jsxs73("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
25104
|
+
/* @__PURE__ */ jsxs73("span", { className: "text-destructive", children: [
|
|
24977
25105
|
archiveConfirmSentence(`the field \u201C${f.label}\u201D`),
|
|
24978
25106
|
" It is removed for everyone in this organization; its values stay in every record and come back with it."
|
|
24979
25107
|
] }),
|
|
24980
|
-
/* @__PURE__ */
|
|
25108
|
+
/* @__PURE__ */ jsx79(
|
|
24981
25109
|
Button46,
|
|
24982
25110
|
{
|
|
24983
25111
|
size: "sm",
|
|
@@ -24997,9 +25125,9 @@ function CustomFieldsSection({
|
|
|
24997
25125
|
children: "Remove it"
|
|
24998
25126
|
}
|
|
24999
25127
|
),
|
|
25000
|
-
/* @__PURE__ */
|
|
25128
|
+
/* @__PURE__ */ jsx79(Button46, { size: "sm", variant: "ghost", onClick: () => setRemoving(null), children: "Keep it" })
|
|
25001
25129
|
] }) : null,
|
|
25002
|
-
noticeOf(f) ? /* @__PURE__ */
|
|
25130
|
+
noticeOf(f) ? /* @__PURE__ */ jsx79(WithheldValue, { field: field2, notice: noticeOf(f) }) : /* @__PURE__ */ jsx79(
|
|
25003
25131
|
FieldControl,
|
|
25004
25132
|
{
|
|
25005
25133
|
id,
|
|
@@ -25009,9 +25137,9 @@ function CustomFieldsSection({
|
|
|
25009
25137
|
}
|
|
25010
25138
|
)
|
|
25011
25139
|
] }, f.id);
|
|
25012
|
-
}) }) : /* @__PURE__ */
|
|
25013
|
-
/* @__PURE__ */
|
|
25014
|
-
/* @__PURE__ */
|
|
25140
|
+
}) }) : /* @__PURE__ */ jsx79("dl", { className: "grid grid-cols-[minmax(6rem,12rem)_1fr] gap-x-3 gap-y-1.5", children: fields.map((f) => /* @__PURE__ */ jsxs73("div", { className: "contents", children: [
|
|
25141
|
+
/* @__PURE__ */ jsx79("dt", { className: "flex items-baseline gap-1 truncate text-muted-foreground", children: f.label }),
|
|
25142
|
+
/* @__PURE__ */ jsx79("dd", { className: "min-w-0", children: noticeOf(f) ? /* @__PURE__ */ jsx79(WithheldValue, { field: asField(f), notice: noticeOf(f) }) : cellKey === f.key ? /* @__PURE__ */ jsx79(
|
|
25015
25143
|
"div",
|
|
25016
25144
|
{
|
|
25017
25145
|
className: "min-w-0",
|
|
@@ -25032,7 +25160,7 @@ function CustomFieldsSection({
|
|
|
25032
25160
|
if (e.relatedTarget?.closest?.("[data-matrx-cell-editor], [role=listbox], [role=dialog]")) return;
|
|
25033
25161
|
void saveCell(f.key);
|
|
25034
25162
|
},
|
|
25035
|
-
children: /* @__PURE__ */
|
|
25163
|
+
children: /* @__PURE__ */ jsx79(
|
|
25036
25164
|
FieldControl,
|
|
25037
25165
|
{
|
|
25038
25166
|
id: `cf-${recordId}-${f.key}`,
|
|
@@ -25045,7 +25173,7 @@ function CustomFieldsSection({
|
|
|
25045
25173
|
}
|
|
25046
25174
|
)
|
|
25047
25175
|
}
|
|
25048
|
-
) : /* @__PURE__ */
|
|
25176
|
+
) : /* @__PURE__ */ jsx79(
|
|
25049
25177
|
"button",
|
|
25050
25178
|
{
|
|
25051
25179
|
type: "button",
|
|
@@ -25057,7 +25185,7 @@ function CustomFieldsSection({
|
|
|
25057
25185
|
setCellValue(values[f.key]);
|
|
25058
25186
|
setCellKey(f.key);
|
|
25059
25187
|
},
|
|
25060
|
-
children: isEmptyValue(values[f.key]) ? /* @__PURE__ */
|
|
25188
|
+
children: isEmptyValue(values[f.key]) ? /* @__PURE__ */ jsx79("span", { className: "text-muted-foreground", children: "\u2014" }) : /* @__PURE__ */ jsx79(CustomValue, { field: asField(f), value: values[f.key] })
|
|
25061
25189
|
}
|
|
25062
25190
|
) })
|
|
25063
25191
|
] }, f.id)) })
|
|
@@ -25066,7 +25194,7 @@ function CustomFieldsSection({
|
|
|
25066
25194
|
|
|
25067
25195
|
// src/StandardRecordForm.tsx
|
|
25068
25196
|
init_Refusal();
|
|
25069
|
-
import { jsx as
|
|
25197
|
+
import { jsx as jsx80, jsxs as jsxs74 } from "react/jsx-runtime";
|
|
25070
25198
|
function standardTokenOf(token2) {
|
|
25071
25199
|
return token2.startsWith("entity:") ? token2.slice("entity:".length) : token2;
|
|
25072
25200
|
}
|
|
@@ -25115,14 +25243,14 @@ function StandardRecordForm({ token: token2, recordId, columns, onSaved, classNa
|
|
|
25115
25243
|
read.reload();
|
|
25116
25244
|
onSaved?.(recordId);
|
|
25117
25245
|
};
|
|
25118
|
-
if (read.error) return /* @__PURE__ */
|
|
25119
|
-
return /* @__PURE__ */
|
|
25120
|
-
/* @__PURE__ */
|
|
25246
|
+
if (read.error) return /* @__PURE__ */ jsx80(RefusalLine, { error: read.error, className });
|
|
25247
|
+
return /* @__PURE__ */ jsxs74("div", { className: cn42("flex min-w-0 flex-col gap-2 text-xs", className), "data-records-standard-form": entityToken, children: [
|
|
25248
|
+
/* @__PURE__ */ jsx80("dl", { className: "grid grid-cols-[minmax(5rem,7rem)_1fr] gap-x-3 gap-y-1", children: columns.map((column) => {
|
|
25121
25249
|
const id = `std-${recordId}-${column.key}`;
|
|
25122
25250
|
const value = stored[column.key];
|
|
25123
|
-
return /* @__PURE__ */
|
|
25124
|
-
/* @__PURE__ */
|
|
25125
|
-
/* @__PURE__ */
|
|
25251
|
+
return /* @__PURE__ */ jsxs74("div", { className: "contents", children: [
|
|
25252
|
+
/* @__PURE__ */ jsx80("dt", { className: "truncate py-1 text-right text-muted-foreground", children: /* @__PURE__ */ jsx80("label", { htmlFor: id, children: column.label }) }),
|
|
25253
|
+
/* @__PURE__ */ jsx80("dd", { className: "min-w-0", children: cellKey === column.key ? column.multiline ? /* @__PURE__ */ jsx80(
|
|
25126
25254
|
Textarea3,
|
|
25127
25255
|
{
|
|
25128
25256
|
id,
|
|
@@ -25140,7 +25268,7 @@ function StandardRecordForm({ token: token2, recordId, columns, onSaved, classNa
|
|
|
25140
25268
|
if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) void save(column);
|
|
25141
25269
|
}
|
|
25142
25270
|
}
|
|
25143
|
-
) : /* @__PURE__ */
|
|
25271
|
+
) : /* @__PURE__ */ jsx80(
|
|
25144
25272
|
Input3,
|
|
25145
25273
|
{
|
|
25146
25274
|
id,
|
|
@@ -25158,7 +25286,7 @@ function StandardRecordForm({ token: token2, recordId, columns, onSaved, classNa
|
|
|
25158
25286
|
if (e.key === "Enter") void save(column);
|
|
25159
25287
|
}
|
|
25160
25288
|
}
|
|
25161
|
-
) : /* @__PURE__ */
|
|
25289
|
+
) : /* @__PURE__ */ jsx80(
|
|
25162
25290
|
"button",
|
|
25163
25291
|
{
|
|
25164
25292
|
type: "button",
|
|
@@ -25168,23 +25296,23 @@ function StandardRecordForm({ token: token2, recordId, columns, onSaved, classNa
|
|
|
25168
25296
|
"aria-label": `Edit ${column.label}`,
|
|
25169
25297
|
"data-records-standard-value": column.key,
|
|
25170
25298
|
onClick: () => open(column.key),
|
|
25171
|
-
children: isEmpty(value) ? /* @__PURE__ */
|
|
25299
|
+
children: isEmpty(value) ? /* @__PURE__ */ jsx80("span", { className: "text-muted-foreground", children: "\u2014" }) : String(value)
|
|
25172
25300
|
}
|
|
25173
25301
|
) })
|
|
25174
25302
|
] }, column.key);
|
|
25175
25303
|
}) }),
|
|
25176
|
-
error ? /* @__PURE__ */
|
|
25304
|
+
error ? /* @__PURE__ */ jsx80(RefusalLine, { error }) : null,
|
|
25177
25305
|
children,
|
|
25178
|
-
/* @__PURE__ */
|
|
25306
|
+
/* @__PURE__ */ jsx80(CustomFieldsSection, { entityToken, recordId, ...custom ?? {} })
|
|
25179
25307
|
] });
|
|
25180
25308
|
}
|
|
25181
25309
|
|
|
25182
25310
|
// src/RecordForm.tsx
|
|
25183
|
-
import { jsx as
|
|
25311
|
+
import { jsx as jsx81, jsxs as jsxs75 } from "react/jsx-runtime";
|
|
25184
25312
|
function RecordForm(props) {
|
|
25185
25313
|
if (props.token) {
|
|
25186
25314
|
if (!props.recordId) {
|
|
25187
|
-
return /* @__PURE__ */
|
|
25315
|
+
return /* @__PURE__ */ jsx81(
|
|
25188
25316
|
RefusalNotice,
|
|
25189
25317
|
{
|
|
25190
25318
|
error: { code: "refused_by_rule", message: "A standard record is opened here, never created." },
|
|
@@ -25192,7 +25320,7 @@ function RecordForm(props) {
|
|
|
25192
25320
|
}
|
|
25193
25321
|
);
|
|
25194
25322
|
}
|
|
25195
|
-
return /* @__PURE__ */
|
|
25323
|
+
return /* @__PURE__ */ jsx81(
|
|
25196
25324
|
StandardRecordForm,
|
|
25197
25325
|
{
|
|
25198
25326
|
token: props.token,
|
|
@@ -25205,7 +25333,7 @@ function RecordForm(props) {
|
|
|
25205
25333
|
}
|
|
25206
25334
|
);
|
|
25207
25335
|
}
|
|
25208
|
-
return /* @__PURE__ */
|
|
25336
|
+
return /* @__PURE__ */ jsx81(CustomRecordForm, { ...props, tableId: props.tableId });
|
|
25209
25337
|
}
|
|
25210
25338
|
function CustomRecordForm({
|
|
25211
25339
|
tableId,
|
|
@@ -25293,8 +25421,8 @@ function CustomRecordForm({
|
|
|
25293
25421
|
() => fields.data ? predictWriteRefusals({ fields: fields.data, document: document2, ...recordType ? { recordType } : {} }) : [],
|
|
25294
25422
|
[fields.data, document2, recordType]
|
|
25295
25423
|
);
|
|
25296
|
-
if (fields.error) return /* @__PURE__ */
|
|
25297
|
-
if (existing.error) return /* @__PURE__ */
|
|
25424
|
+
if (fields.error) return /* @__PURE__ */ jsx81(RefusalNotice, { error: fields.error, className });
|
|
25425
|
+
if (existing.error) return /* @__PURE__ */ jsx81(RefusalNotice, { error: existing.error, className });
|
|
25298
25426
|
const storeSaid = said2.error && said2.error !== answered ? said2.error : null;
|
|
25299
25427
|
const fieldProblems = predicted.filter((p) => p.field_key);
|
|
25300
25428
|
const problemsShown = (key) => touched || changed2[key] ? fieldProblems.filter((p) => p.field_key === key) : [];
|
|
@@ -25359,7 +25487,7 @@ function CustomRecordForm({
|
|
|
25359
25487
|
onSaved?.(written);
|
|
25360
25488
|
}
|
|
25361
25489
|
};
|
|
25362
|
-
return /* @__PURE__ */
|
|
25490
|
+
return /* @__PURE__ */ jsxs75(
|
|
25363
25491
|
"form",
|
|
25364
25492
|
{
|
|
25365
25493
|
className: cn43("flex min-w-0 flex-col gap-3", className),
|
|
@@ -25368,7 +25496,7 @@ function CustomRecordForm({
|
|
|
25368
25496
|
void save();
|
|
25369
25497
|
},
|
|
25370
25498
|
children: [
|
|
25371
|
-
/* @__PURE__ */
|
|
25499
|
+
/* @__PURE__ */ jsx81("div", { className: "grid gap-3 sm:grid-cols-2", children: (fields.data ?? []).map((field2) => /* @__PURE__ */ jsx81(
|
|
25372
25500
|
FieldRow,
|
|
25373
25501
|
{
|
|
25374
25502
|
recordId,
|
|
@@ -25386,31 +25514,31 @@ function CustomRecordForm({
|
|
|
25386
25514
|
},
|
|
25387
25515
|
field2.id
|
|
25388
25516
|
)) }),
|
|
25389
|
-
touched ? predicted.filter((p) => !p.field_key).map((p) => /* @__PURE__ */
|
|
25517
|
+
touched ? predicted.filter((p) => !p.field_key).map((p) => /* @__PURE__ */ jsx81(
|
|
25390
25518
|
RefusalNotice,
|
|
25391
25519
|
{
|
|
25392
25520
|
error: { code: "refused_by_rule", message: p.message }
|
|
25393
25521
|
},
|
|
25394
25522
|
p.message
|
|
25395
25523
|
)) : null,
|
|
25396
|
-
storeSaid && !storeRefusalIsOnAField ? /* @__PURE__ */
|
|
25524
|
+
storeSaid && !storeRefusalIsOnAField ? /* @__PURE__ */ jsx81(
|
|
25397
25525
|
RefusalNotice,
|
|
25398
25526
|
{
|
|
25399
25527
|
error: storeSaid,
|
|
25400
25528
|
...said2.conflict ? {
|
|
25401
|
-
actions: /* @__PURE__ */
|
|
25529
|
+
actions: /* @__PURE__ */ jsxs75("div", { className: "mt-1 space-y-1", children: [
|
|
25402
25530
|
Object.entries(said2.conflict.contested_fields).map(([key, theirs]) => {
|
|
25403
25531
|
const column = (fields.data ?? []).find((f) => f.key === key);
|
|
25404
|
-
return /* @__PURE__ */
|
|
25532
|
+
return /* @__PURE__ */ jsxs75("p", { className: "text-[11px]", children: [
|
|
25405
25533
|
column ? fieldName(column) : humanizeIdentifier9(key),
|
|
25406
25534
|
": yours",
|
|
25407
25535
|
" ",
|
|
25408
|
-
/* @__PURE__ */
|
|
25536
|
+
/* @__PURE__ */ jsx81("strong", { children: asWords(draft[key]) }),
|
|
25409
25537
|
" \xB7 theirs ",
|
|
25410
|
-
/* @__PURE__ */
|
|
25538
|
+
/* @__PURE__ */ jsx81("strong", { children: asWords(theirs) })
|
|
25411
25539
|
] }, key);
|
|
25412
25540
|
}),
|
|
25413
|
-
/* @__PURE__ */
|
|
25541
|
+
/* @__PURE__ */ jsx81(
|
|
25414
25542
|
Button47,
|
|
25415
25543
|
{
|
|
25416
25544
|
type: "button",
|
|
@@ -25430,10 +25558,10 @@ function CustomRecordForm({
|
|
|
25430
25558
|
} : { onKeepEditing: () => keepEditing(), onDiscard: () => discard() }
|
|
25431
25559
|
}
|
|
25432
25560
|
) : null,
|
|
25433
|
-
/* @__PURE__ */
|
|
25434
|
-
/* @__PURE__ */
|
|
25435
|
-
/* @__PURE__ */
|
|
25436
|
-
onCancel ? /* @__PURE__ */
|
|
25561
|
+
/* @__PURE__ */ jsx81(Separator4, {}),
|
|
25562
|
+
/* @__PURE__ */ jsxs75("div", { className: "flex items-center gap-2", children: [
|
|
25563
|
+
/* @__PURE__ */ jsx81(Button47, { type: "submit", size: "sm", disabled: said2.saving, children: said2.saving ? "Saving\u2026" : recordId ? "Save" : "Create" }),
|
|
25564
|
+
onCancel ? /* @__PURE__ */ jsx81(Button47, { type: "button", size: "sm", variant: "ghost", onClick: onCancel, children: "Cancel" }) : null
|
|
25437
25565
|
] })
|
|
25438
25566
|
]
|
|
25439
25567
|
}
|
|
@@ -25452,14 +25580,14 @@ function FieldRow({
|
|
|
25452
25580
|
const id = `field-${field2.id}`;
|
|
25453
25581
|
const storedWords = document2?.[field2.key];
|
|
25454
25582
|
const whole = typeof storedWords === "string" ? wholeValueOf3(document2, field2.key) : null;
|
|
25455
|
-
return /* @__PURE__ */
|
|
25456
|
-
/* @__PURE__ */
|
|
25583
|
+
return /* @__PURE__ */ jsxs75("div", { className: cn43("flex min-w-0 flex-col gap-1", whole && "sm:col-span-2"), children: [
|
|
25584
|
+
/* @__PURE__ */ jsx81(FieldLabel, { field: field2, htmlFor: id, children: /* @__PURE__ */ jsx81(ProvenanceBadge, { document: document2, fieldKey: field2.key }) }),
|
|
25457
25585
|
whole ? (
|
|
25458
25586
|
// A TEXT KEPT AS A FILE opens WHOLE, never as the 1000 characters its cell holds —
|
|
25459
25587
|
// saving those would cut the value (lane BIG-VALUES-WRITE).
|
|
25460
|
-
/* @__PURE__ */
|
|
25461
|
-
) : /* @__PURE__ */
|
|
25462
|
-
problems.map((problem, index) => /* @__PURE__ */
|
|
25588
|
+
/* @__PURE__ */ jsx81(WholeValueEditor, { field: field2, pointer: whole, words: String(storedWords ?? ""), value, onChange, id })
|
|
25589
|
+
) : /* @__PURE__ */ jsx81(FieldControl, { field: field2, value, onChange, id, recordId }),
|
|
25590
|
+
problems.map((problem, index) => /* @__PURE__ */ jsx81(
|
|
25463
25591
|
RefusalNotice,
|
|
25464
25592
|
{
|
|
25465
25593
|
error: { code: "refused_by_rule", message: problem.message },
|
|
@@ -25478,7 +25606,7 @@ function asWords(value) {
|
|
|
25478
25606
|
}
|
|
25479
25607
|
|
|
25480
25608
|
// src/gridAddRow.tsx
|
|
25481
|
-
import { Fragment as
|
|
25609
|
+
import { Fragment as Fragment26, jsx as jsx82, jsxs as jsxs76 } from "react/jsx-runtime";
|
|
25482
25610
|
var ADD_ROW_ID = "__records_ui_add_row__";
|
|
25483
25611
|
var ADD_ROW = {
|
|
25484
25612
|
id: ADD_ROW_ID,
|
|
@@ -25567,7 +25695,7 @@ function withAddRowCells(columns, line) {
|
|
|
25567
25695
|
});
|
|
25568
25696
|
}
|
|
25569
25697
|
function AddRowLine({ onAdd, busy, label = "Add row" }) {
|
|
25570
|
-
return /* @__PURE__ */
|
|
25698
|
+
return /* @__PURE__ */ jsxs76(
|
|
25571
25699
|
"button",
|
|
25572
25700
|
{
|
|
25573
25701
|
type: "button",
|
|
@@ -25579,7 +25707,7 @@ function AddRowLine({ onAdd, busy, label = "Add row" }) {
|
|
|
25579
25707
|
},
|
|
25580
25708
|
className: "-mx-1 flex w-max items-center gap-1.5 whitespace-nowrap rounded px-1 text-xs font-normal text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-60",
|
|
25581
25709
|
children: [
|
|
25582
|
-
/* @__PURE__ */
|
|
25710
|
+
/* @__PURE__ */ jsx82("span", { "aria-hidden": "true", className: "text-sm leading-none", children: "+" }),
|
|
25583
25711
|
busy ? "Adding\u2026" : label
|
|
25584
25712
|
]
|
|
25585
25713
|
}
|
|
@@ -25590,7 +25718,7 @@ function addColumnColumn(onAdd) {
|
|
|
25590
25718
|
return {
|
|
25591
25719
|
id: ADD_COLUMN_ID,
|
|
25592
25720
|
label: "Add a column",
|
|
25593
|
-
header: /* @__PURE__ */
|
|
25721
|
+
header: /* @__PURE__ */ jsx82(
|
|
25594
25722
|
"button",
|
|
25595
25723
|
{
|
|
25596
25724
|
type: "button",
|
|
@@ -25618,7 +25746,7 @@ function addColumnColumn(onAdd) {
|
|
|
25618
25746
|
};
|
|
25619
25747
|
}
|
|
25620
25748
|
function AddFirstRowButton({ onAdd, busy }) {
|
|
25621
|
-
return /* @__PURE__ */
|
|
25749
|
+
return /* @__PURE__ */ jsx82(Button48, { size: "sm", "data-records-add-first-row": "", disabled: busy, onClick: onAdd, children: busy ? "Adding\u2026" : "Add the first row" });
|
|
25622
25750
|
}
|
|
25623
25751
|
var NEW_RECORD_FORM_LABEL = "Fill in a form\u2026";
|
|
25624
25752
|
function NewRecordControl({
|
|
@@ -25638,11 +25766,11 @@ function NewRecordControl({
|
|
|
25638
25766
|
setFormInitial(ask2.initial);
|
|
25639
25767
|
setFormOpen(true);
|
|
25640
25768
|
}, [ask2]);
|
|
25641
|
-
return /* @__PURE__ */
|
|
25642
|
-
/* @__PURE__ */
|
|
25643
|
-
/* @__PURE__ */
|
|
25644
|
-
/* @__PURE__ */
|
|
25645
|
-
/* @__PURE__ */
|
|
25769
|
+
return /* @__PURE__ */ jsxs76(Fragment26, { children: [
|
|
25770
|
+
/* @__PURE__ */ jsxs76("div", { className: "inline-flex shrink-0", "data-records-new-record": "", children: [
|
|
25771
|
+
/* @__PURE__ */ jsx82(Button48, { size: "sm", className: "rounded-r-none", disabled: busy, onClick: onAdd, children: busy ? "Adding\u2026" : "New record" }),
|
|
25772
|
+
/* @__PURE__ */ jsxs76(DropdownMenu4, { children: [
|
|
25773
|
+
/* @__PURE__ */ jsx82(DropdownMenuTrigger4, { asChild: true, children: /* @__PURE__ */ jsx82(
|
|
25646
25774
|
Button48,
|
|
25647
25775
|
{
|
|
25648
25776
|
size: "sm",
|
|
@@ -25650,21 +25778,21 @@ function NewRecordControl({
|
|
|
25650
25778
|
disabled: busy,
|
|
25651
25779
|
"aria-label": "More ways to add",
|
|
25652
25780
|
"data-records-new-record-more": "",
|
|
25653
|
-
children: /* @__PURE__ */
|
|
25781
|
+
children: /* @__PURE__ */ jsx82("span", { "aria-hidden": true, className: "text-xs leading-none", children: "\u25BE" })
|
|
25654
25782
|
}
|
|
25655
25783
|
) }),
|
|
25656
|
-
/* @__PURE__ */
|
|
25657
|
-
/* @__PURE__ */
|
|
25658
|
-
/* @__PURE__ */
|
|
25784
|
+
/* @__PURE__ */ jsxs76(DropdownMenuContent4, { align: "end", className: "text-xs", children: [
|
|
25785
|
+
/* @__PURE__ */ jsx82(DropdownMenuItem4, { className: "text-xs", onSelect: onAdd, children: "Blank row" }),
|
|
25786
|
+
/* @__PURE__ */ jsx82(DropdownMenuItem4, { className: "text-xs", "data-records-new-record-form-open": "", onSelect: () => setFormOpen(true), children: NEW_RECORD_FORM_LABEL })
|
|
25659
25787
|
] })
|
|
25660
25788
|
] })
|
|
25661
25789
|
] }),
|
|
25662
|
-
/* @__PURE__ */
|
|
25663
|
-
/* @__PURE__ */
|
|
25790
|
+
/* @__PURE__ */ jsx82(Dialog14, { open: formOpen, onOpenChange: setFormOpen, children: /* @__PURE__ */ jsxs76(DialogContent14, { className: "max-h-[85dvh] overflow-y-auto sm:max-w-2xl", "data-records-new-record-form": "", children: [
|
|
25791
|
+
/* @__PURE__ */ jsx82(DialogHeader14, { children: /* @__PURE__ */ jsxs76(DialogTitle14, { children: [
|
|
25664
25792
|
"New ",
|
|
25665
25793
|
noun
|
|
25666
25794
|
] }) }),
|
|
25667
|
-
formOpen ? /* @__PURE__ */
|
|
25795
|
+
formOpen ? /* @__PURE__ */ jsx82(
|
|
25668
25796
|
RecordForm,
|
|
25669
25797
|
{
|
|
25670
25798
|
tableId,
|
|
@@ -26347,7 +26475,7 @@ import {
|
|
|
26347
26475
|
cn as cn44
|
|
26348
26476
|
} from "@ai-matrx/design-system";
|
|
26349
26477
|
import { formatRelativeTime as formatRelativeTime2 } from "@ai-matrx/kit/format";
|
|
26350
|
-
import { Fragment as
|
|
26478
|
+
import { Fragment as Fragment27, jsx as jsx83, jsxs as jsxs77 } from "react/jsx-runtime";
|
|
26351
26479
|
var NO_ENRICH_REASON = "Having an agent fill this column is not switched on here yet, so this panel does not offer it rather than offering something that cannot happen. Everything else on this panel works. It is on our list, not yours.";
|
|
26352
26480
|
function cellState(cell2) {
|
|
26353
26481
|
if (!cell2 || !cell2.agent_owned) return "none";
|
|
@@ -26366,9 +26494,9 @@ function EnrichBadge({ cell: cell2, onPin, className }) {
|
|
|
26366
26494
|
const read = Array.isArray(source.read) ? source.read : [];
|
|
26367
26495
|
const alternates = cell2.alternates ?? [];
|
|
26368
26496
|
const word = state2 === "yours" ? "yours" : state2 === "unsure" ? "unsure" : "agent";
|
|
26369
|
-
return /* @__PURE__ */
|
|
26370
|
-
/* @__PURE__ */
|
|
26371
|
-
/* @__PURE__ */
|
|
26497
|
+
return /* @__PURE__ */ jsxs77(HoverCard2, { children: [
|
|
26498
|
+
/* @__PURE__ */ jsx83(HoverCardTrigger2, { asChild: true, children: /* @__PURE__ */ jsxs77("span", { className: cn44("inline-flex items-center gap-1 align-middle", className), children: [
|
|
26499
|
+
/* @__PURE__ */ jsx83(
|
|
26372
26500
|
Badge11,
|
|
26373
26501
|
{
|
|
26374
26502
|
variant: state2 === "yours" ? "secondary" : "outline",
|
|
@@ -26376,40 +26504,40 @@ function EnrichBadge({ cell: cell2, onPin, className }) {
|
|
|
26376
26504
|
children: word
|
|
26377
26505
|
}
|
|
26378
26506
|
),
|
|
26379
|
-
cell2.stale ? /* @__PURE__ */
|
|
26507
|
+
cell2.stale ? /* @__PURE__ */ jsx83(Badge11, { variant: "outline", className: "text-[10px] font-normal leading-none opacity-70", children: "stale" }) : null
|
|
26380
26508
|
] }) }),
|
|
26381
|
-
/* @__PURE__ */
|
|
26382
|
-
/* @__PURE__ */
|
|
26383
|
-
state2 !== "yours" && cell2.on_behalf_of ? /* @__PURE__ */
|
|
26509
|
+
/* @__PURE__ */ jsxs77(HoverCardContent2, { className: "w-80 space-y-2 text-xs", children: [
|
|
26510
|
+
/* @__PURE__ */ jsx83("p", { className: "font-medium", children: state2 === "yours" ? "You typed this one in" : state2 === "unsure" ? "A model had candidates and committed to none" : "Filled in by a model" }),
|
|
26511
|
+
state2 !== "yours" && cell2.on_behalf_of ? /* @__PURE__ */ jsxs77("p", { className: "text-muted-foreground", children: [
|
|
26384
26512
|
"Acting for ",
|
|
26385
26513
|
cell2.on_behalf_of,
|
|
26386
26514
|
cell2.written_at ? `, ${ago(cell2.written_at)}` : "",
|
|
26387
26515
|
"."
|
|
26388
|
-
] }) : cell2.written_at ? /* @__PURE__ */
|
|
26516
|
+
] }) : cell2.written_at ? /* @__PURE__ */ jsxs77("p", { className: "text-muted-foreground", children: [
|
|
26389
26517
|
"Written ",
|
|
26390
26518
|
ago(cell2.written_at),
|
|
26391
26519
|
"."
|
|
26392
26520
|
] }) : null,
|
|
26393
|
-
source.model ? /* @__PURE__ */
|
|
26521
|
+
source.model ? /* @__PURE__ */ jsxs77("p", { className: "text-muted-foreground", children: [
|
|
26394
26522
|
String(source.model),
|
|
26395
26523
|
source.model_version ? ` (${String(source.model_version)})` : "",
|
|
26396
26524
|
typeof source.confidence === "number" ? ` \xB7 ${Math.round(source.confidence * 100)}% sure` : ""
|
|
26397
26525
|
] }) : null,
|
|
26398
|
-
source.note ? /* @__PURE__ */
|
|
26399
|
-
read.length > 0 ? /* @__PURE__ */
|
|
26400
|
-
/* @__PURE__ */
|
|
26401
|
-
/* @__PURE__ */
|
|
26526
|
+
source.note ? /* @__PURE__ */ jsx83("p", { className: "text-muted-foreground", children: String(source.note) }) : null,
|
|
26527
|
+
read.length > 0 ? /* @__PURE__ */ jsxs77("div", { children: [
|
|
26528
|
+
/* @__PURE__ */ jsx83("p", { className: "text-muted-foreground", children: "What it read" }),
|
|
26529
|
+
/* @__PURE__ */ jsx83("ul", { className: "list-inside list-disc", children: read.slice(0, 4).map((r, i) => /* @__PURE__ */ jsx83("li", { className: "truncate", children: String(r.title ?? r.url ?? "") }, i)) })
|
|
26402
26530
|
] }) : null,
|
|
26403
|
-
alternates.length > 0 ? /* @__PURE__ */
|
|
26404
|
-
/* @__PURE__ */
|
|
26405
|
-
/* @__PURE__ */
|
|
26531
|
+
alternates.length > 0 ? /* @__PURE__ */ jsxs77("div", { children: [
|
|
26532
|
+
/* @__PURE__ */ jsx83("p", { className: "text-muted-foreground", children: state2 === "unsure" ? "What it considered" : "What it nearly said instead" }),
|
|
26533
|
+
/* @__PURE__ */ jsx83("ul", { className: "list-inside list-decimal", children: alternates.slice(0, 4).map((a, i) => /* @__PURE__ */ jsx83("li", { children: String(a.value ?? "") }, i)) })
|
|
26406
26534
|
] }) : null,
|
|
26407
|
-
cell2.stale && cell2.due_at ? /* @__PURE__ */
|
|
26535
|
+
cell2.stale && cell2.due_at ? /* @__PURE__ */ jsxs77("p", { className: "text-muted-foreground", children: [
|
|
26408
26536
|
"Past its date \u2014 it was due to be looked at again ",
|
|
26409
26537
|
ago(cell2.due_at),
|
|
26410
26538
|
". The value is still here; nothing was overwritten."
|
|
26411
26539
|
] }) : null,
|
|
26412
|
-
onPin ? /* @__PURE__ */
|
|
26540
|
+
onPin ? /* @__PURE__ */ jsx83(
|
|
26413
26541
|
Button49,
|
|
26414
26542
|
{
|
|
26415
26543
|
size: "sm",
|
|
@@ -26532,30 +26660,30 @@ function EnrichPanel({ tableId, fieldId, className }) {
|
|
|
26532
26660
|
},
|
|
26533
26661
|
[host, load, tableId]
|
|
26534
26662
|
);
|
|
26535
|
-
if (error) return /* @__PURE__ */
|
|
26536
|
-
if (rows === null) return /* @__PURE__ */
|
|
26663
|
+
if (error) return /* @__PURE__ */ jsx83(RefusalNotice, { error, className });
|
|
26664
|
+
if (rows === null) return /* @__PURE__ */ jsx83(Skeleton9, { className: cn44("h-40 w-full", className) });
|
|
26537
26665
|
if (shown5.length === 0 && fieldId) {
|
|
26538
26666
|
const target = (fields.data ?? []).find((f) => f.id === fieldId);
|
|
26539
26667
|
const setup = draft[fieldId] ?? { instruction: "", every: "30" };
|
|
26540
26668
|
if (!rights.admin) {
|
|
26541
|
-
return /* @__PURE__ */
|
|
26542
|
-
/* @__PURE__ */
|
|
26669
|
+
return /* @__PURE__ */ jsxs77("div", { className: cn44("space-y-2 p-4 text-sm", className), children: [
|
|
26670
|
+
/* @__PURE__ */ jsxs77("p", { className: "font-medium", children: [
|
|
26543
26671
|
"Nothing fills ",
|
|
26544
26672
|
target?.name ?? "this column",
|
|
26545
26673
|
" in automatically."
|
|
26546
26674
|
] }),
|
|
26547
|
-
/* @__PURE__ */
|
|
26675
|
+
/* @__PURE__ */ jsx83("p", { className: "text-muted-foreground", children: "An admin on this table sets that up." })
|
|
26548
26676
|
] });
|
|
26549
26677
|
}
|
|
26550
|
-
return /* @__PURE__ */
|
|
26551
|
-
/* @__PURE__ */
|
|
26678
|
+
return /* @__PURE__ */ jsxs77("div", { className: cn44("space-y-3 p-4 text-sm", className), children: [
|
|
26679
|
+
/* @__PURE__ */ jsxs77("p", { className: "font-medium", children: [
|
|
26552
26680
|
"Let a model keep ",
|
|
26553
26681
|
target?.name ?? "this column",
|
|
26554
26682
|
" filled in"
|
|
26555
26683
|
] }),
|
|
26556
|
-
/* @__PURE__ */
|
|
26557
|
-
/* @__PURE__ */
|
|
26558
|
-
/* @__PURE__ */
|
|
26684
|
+
/* @__PURE__ */ jsxs77("div", { className: "space-y-1", children: [
|
|
26685
|
+
/* @__PURE__ */ jsx83(Label17, { className: "text-xs", htmlFor: "new-instruction", children: "What goes in this column" }),
|
|
26686
|
+
/* @__PURE__ */ jsx83(
|
|
26559
26687
|
Input4,
|
|
26560
26688
|
{
|
|
26561
26689
|
id: "new-instruction",
|
|
@@ -26564,11 +26692,11 @@ function EnrichPanel({ tableId, fieldId, className }) {
|
|
|
26564
26692
|
onChange: (e) => setDraft((prev) => ({ ...prev, [fieldId]: { ...setup, instruction: e.target.value } }))
|
|
26565
26693
|
}
|
|
26566
26694
|
),
|
|
26567
|
-
/* @__PURE__ */
|
|
26695
|
+
/* @__PURE__ */ jsx83("p", { className: "text-[11px] text-muted-foreground", children: "This sentence is what the model is asked. It is set up switched OFF \u2014 nothing is written into anybody's records until you turn it on." })
|
|
26568
26696
|
] }),
|
|
26569
|
-
/* @__PURE__ */
|
|
26570
|
-
/* @__PURE__ */
|
|
26571
|
-
/* @__PURE__ */
|
|
26697
|
+
/* @__PURE__ */ jsxs77("div", { className: "space-y-1", children: [
|
|
26698
|
+
/* @__PURE__ */ jsx83(Label17, { className: "text-xs", htmlFor: "new-every", children: "Look at each one again after" }),
|
|
26699
|
+
/* @__PURE__ */ jsx83(
|
|
26572
26700
|
Input4,
|
|
26573
26701
|
{
|
|
26574
26702
|
id: "new-every",
|
|
@@ -26578,7 +26706,7 @@ function EnrichPanel({ tableId, fieldId, className }) {
|
|
|
26578
26706
|
}
|
|
26579
26707
|
)
|
|
26580
26708
|
] }),
|
|
26581
|
-
/* @__PURE__ */
|
|
26709
|
+
/* @__PURE__ */ jsx83(
|
|
26582
26710
|
Button49,
|
|
26583
26711
|
{
|
|
26584
26712
|
size: "sm",
|
|
@@ -26594,26 +26722,26 @@ function EnrichPanel({ tableId, fieldId, className }) {
|
|
|
26594
26722
|
children: "Set it up"
|
|
26595
26723
|
}
|
|
26596
26724
|
),
|
|
26597
|
-
outcome ? /* @__PURE__ */
|
|
26725
|
+
outcome ? /* @__PURE__ */ jsx83("p", { className: "text-xs text-muted-foreground", children: outcome.message }) : null
|
|
26598
26726
|
] });
|
|
26599
26727
|
}
|
|
26600
26728
|
if (shown5.length === 0) {
|
|
26601
|
-
return /* @__PURE__ */
|
|
26602
|
-
/* @__PURE__ */
|
|
26603
|
-
/* @__PURE__ */
|
|
26729
|
+
return /* @__PURE__ */ jsxs77("div", { className: cn44("space-y-2 p-4 text-sm", className), children: [
|
|
26730
|
+
/* @__PURE__ */ jsx83("p", { className: "font-medium", children: "No column here is filled in by a model." }),
|
|
26731
|
+
/* @__PURE__ */ jsx83("p", { className: "text-muted-foreground", children: rights.admin ? "Open a column's menu and choose \u201CLet AI fill\u201D to set one up \u2014 or just ask for it in plain words and the agent will." : "An admin on this table sets that up." })
|
|
26604
26732
|
] });
|
|
26605
26733
|
}
|
|
26606
|
-
return /* @__PURE__ */
|
|
26734
|
+
return /* @__PURE__ */ jsx83("div", { className: cn44("space-y-6 p-4", className), children: shown5.map((row) => {
|
|
26607
26735
|
const d = draft[row.field_id] ?? {
|
|
26608
26736
|
instruction: row.enrichment?.instruction ?? "",
|
|
26609
26737
|
every: row.review_interval_days ? String(row.review_interval_days) : ""
|
|
26610
26738
|
};
|
|
26611
26739
|
const field2 = fieldByKey.get(row.field_key);
|
|
26612
|
-
return /* @__PURE__ */
|
|
26613
|
-
/* @__PURE__ */
|
|
26614
|
-
/* @__PURE__ */
|
|
26615
|
-
/* @__PURE__ */
|
|
26616
|
-
/* @__PURE__ */
|
|
26740
|
+
return /* @__PURE__ */ jsxs77("section", { className: "space-y-3 rounded-md border p-3", children: [
|
|
26741
|
+
/* @__PURE__ */ jsxs77("header", { className: "flex items-center justify-between gap-2", children: [
|
|
26742
|
+
/* @__PURE__ */ jsxs77("div", { className: "min-w-0", children: [
|
|
26743
|
+
/* @__PURE__ */ jsx83("h3", { className: "truncate text-sm font-medium", children: row.label }),
|
|
26744
|
+
/* @__PURE__ */ jsxs77("p", { className: "text-xs text-muted-foreground", children: [
|
|
26617
26745
|
row.rows_filled,
|
|
26618
26746
|
" of ",
|
|
26619
26747
|
row.rows_total,
|
|
@@ -26623,8 +26751,8 @@ function EnrichPanel({ tableId, fieldId, className }) {
|
|
|
26623
26751
|
row.rows_absent > 0 ? ` \xB7 ${row.rows_absent} nothing to find` : ""
|
|
26624
26752
|
] })
|
|
26625
26753
|
] }),
|
|
26626
|
-
rights.admin ? /* @__PURE__ */
|
|
26627
|
-
/* @__PURE__ */
|
|
26754
|
+
rights.admin ? /* @__PURE__ */ jsxs77("label", { className: "flex shrink-0 items-center gap-2 text-xs", children: [
|
|
26755
|
+
/* @__PURE__ */ jsx83(
|
|
26628
26756
|
Switch2,
|
|
26629
26757
|
{
|
|
26630
26758
|
checked: row.enabled,
|
|
@@ -26633,11 +26761,11 @@ function EnrichPanel({ tableId, fieldId, className }) {
|
|
|
26633
26761
|
}
|
|
26634
26762
|
),
|
|
26635
26763
|
row.enabled ? "On" : "Off"
|
|
26636
|
-
] }) : /* @__PURE__ */
|
|
26764
|
+
] }) : /* @__PURE__ */ jsx83(Badge11, { variant: "outline", className: "text-[10px] font-normal", children: row.enabled ? "on" : "off" })
|
|
26637
26765
|
] }),
|
|
26638
|
-
/* @__PURE__ */
|
|
26639
|
-
/* @__PURE__ */
|
|
26640
|
-
/* @__PURE__ */
|
|
26766
|
+
/* @__PURE__ */ jsxs77("div", { className: "space-y-1", children: [
|
|
26767
|
+
/* @__PURE__ */ jsx83(Label17, { className: "text-xs", htmlFor: `instr-${row.field_id}`, children: "What goes in this column" }),
|
|
26768
|
+
/* @__PURE__ */ jsx83(
|
|
26641
26769
|
Input4,
|
|
26642
26770
|
{
|
|
26643
26771
|
id: `instr-${row.field_id}`,
|
|
@@ -26650,19 +26778,19 @@ function EnrichPanel({ tableId, fieldId, className }) {
|
|
|
26650
26778
|
}))
|
|
26651
26779
|
}
|
|
26652
26780
|
),
|
|
26653
|
-
/* @__PURE__ */
|
|
26781
|
+
/* @__PURE__ */ jsx83("p", { className: "text-[11px] text-muted-foreground", children: "This sentence is what the model is asked, so write it the way you would say it to a person." })
|
|
26654
26782
|
] }),
|
|
26655
|
-
/* @__PURE__ */
|
|
26656
|
-
/* @__PURE__ */
|
|
26657
|
-
/* @__PURE__ */
|
|
26658
|
-
/* @__PURE__ */
|
|
26783
|
+
/* @__PURE__ */ jsxs77("div", { className: "grid grid-cols-2 gap-3", children: [
|
|
26784
|
+
/* @__PURE__ */ jsxs77("div", { className: "space-y-1", children: [
|
|
26785
|
+
/* @__PURE__ */ jsx83(Label17, { className: "text-xs", children: "It may look at" }),
|
|
26786
|
+
/* @__PURE__ */ jsxs77("p", { className: "text-xs", children: [
|
|
26659
26787
|
(row.enrichment?.inputs ?? []).length > 0 ? (row.enrichment?.inputs ?? []).map((k) => fieldByKey.get(k)?.name ?? k).join(", ") : "nothing else on the record",
|
|
26660
26788
|
row.enrichment?.web_search ? " \xB7 and the open web" : ""
|
|
26661
26789
|
] })
|
|
26662
26790
|
] }),
|
|
26663
|
-
/* @__PURE__ */
|
|
26664
|
-
/* @__PURE__ */
|
|
26665
|
-
/* @__PURE__ */
|
|
26791
|
+
/* @__PURE__ */ jsxs77("div", { className: "space-y-1", children: [
|
|
26792
|
+
/* @__PURE__ */ jsx83(Label17, { className: "text-xs", htmlFor: `every-${row.field_id}`, children: "Look at each one again after" }),
|
|
26793
|
+
/* @__PURE__ */ jsx83(
|
|
26666
26794
|
Input4,
|
|
26667
26795
|
{
|
|
26668
26796
|
id: `every-${row.field_id}`,
|
|
@@ -26675,15 +26803,15 @@ function EnrichPanel({ tableId, fieldId, className }) {
|
|
|
26675
26803
|
}))
|
|
26676
26804
|
}
|
|
26677
26805
|
),
|
|
26678
|
-
/* @__PURE__ */
|
|
26806
|
+
/* @__PURE__ */ jsx83("p", { className: "text-[11px] text-muted-foreground", children: d.every ? `${d.every} days` : NEVER2 })
|
|
26679
26807
|
] })
|
|
26680
26808
|
] }),
|
|
26681
|
-
/* @__PURE__ */
|
|
26809
|
+
/* @__PURE__ */ jsxs77("p", { className: "text-xs text-muted-foreground", children: [
|
|
26682
26810
|
row.runs === 0 ? "It has not run yet, so it has cost nothing." : `${row.runs} run${row.runs === 1 ? "" : "s"}` + (costInPoints(Number(row.cost_cents), host.pointsRate) !== null ? ` \xB7 ${costInPoints(Number(row.cost_cents), host.pointsRate)} so far` : "") + (row.cost_per_row_cents !== null && costInPoints(Number(row.cost_per_row_cents), host.pointsRate) !== null ? ` \xB7 ${costInPoints(Number(row.cost_per_row_cents), host.pointsRate)} a row` : "") + (row.last_run_at ? ` \xB7 last ran ${ago(row.last_run_at)}` : ""),
|
|
26683
26811
|
row.enrichment?.model ? ` \xB7 ${row.enrichment.model}` : ""
|
|
26684
26812
|
] }),
|
|
26685
|
-
rights.admin ? /* @__PURE__ */
|
|
26686
|
-
/* @__PURE__ */
|
|
26813
|
+
rights.admin ? /* @__PURE__ */ jsxs77("div", { className: "flex flex-wrap gap-2", children: [
|
|
26814
|
+
/* @__PURE__ */ jsx83(
|
|
26687
26815
|
Button49,
|
|
26688
26816
|
{
|
|
26689
26817
|
size: "sm",
|
|
@@ -26696,7 +26824,7 @@ function EnrichPanel({ tableId, fieldId, className }) {
|
|
|
26696
26824
|
children: "Save"
|
|
26697
26825
|
}
|
|
26698
26826
|
),
|
|
26699
|
-
/* @__PURE__ */
|
|
26827
|
+
/* @__PURE__ */ jsx83(
|
|
26700
26828
|
Button49,
|
|
26701
26829
|
{
|
|
26702
26830
|
size: "sm",
|
|
@@ -26706,8 +26834,8 @@ function EnrichPanel({ tableId, fieldId, className }) {
|
|
|
26706
26834
|
children: "Show me five rows it would do"
|
|
26707
26835
|
}
|
|
26708
26836
|
),
|
|
26709
|
-
host.enrich ? /* @__PURE__ */
|
|
26710
|
-
/* @__PURE__ */
|
|
26837
|
+
host.enrich ? /* @__PURE__ */ jsxs77(Fragment27, { children: [
|
|
26838
|
+
/* @__PURE__ */ jsx83(
|
|
26711
26839
|
Button49,
|
|
26712
26840
|
{
|
|
26713
26841
|
size: "sm",
|
|
@@ -26717,7 +26845,7 @@ function EnrichPanel({ tableId, fieldId, className }) {
|
|
|
26717
26845
|
children: "Preview on five rows"
|
|
26718
26846
|
}
|
|
26719
26847
|
),
|
|
26720
|
-
/* @__PURE__ */
|
|
26848
|
+
/* @__PURE__ */ jsx83(
|
|
26721
26849
|
Button49,
|
|
26722
26850
|
{
|
|
26723
26851
|
size: "sm",
|
|
@@ -26728,34 +26856,34 @@ function EnrichPanel({ tableId, fieldId, className }) {
|
|
|
26728
26856
|
)
|
|
26729
26857
|
] }) : null
|
|
26730
26858
|
] }) : null,
|
|
26731
|
-
!host.enrich && rights.admin ? /* @__PURE__ */
|
|
26732
|
-
preview && preview.length > 0 ? /* @__PURE__ */
|
|
26733
|
-
/* @__PURE__ */
|
|
26859
|
+
!host.enrich && rights.admin ? /* @__PURE__ */ jsx83("p", { className: "text-[11px] text-muted-foreground", children: NO_ENRICH_REASON }) : null,
|
|
26860
|
+
preview && preview.length > 0 ? /* @__PURE__ */ jsxs77("div", { className: "rounded border p-2 text-xs", children: [
|
|
26861
|
+
/* @__PURE__ */ jsxs77("p", { className: "mb-1 font-medium", children: [
|
|
26734
26862
|
"The next ",
|
|
26735
26863
|
preview.length,
|
|
26736
26864
|
" it would do, and why:"
|
|
26737
26865
|
] }),
|
|
26738
|
-
/* @__PURE__ */
|
|
26739
|
-
/* @__PURE__ */
|
|
26740
|
-
/* @__PURE__ */
|
|
26866
|
+
/* @__PURE__ */ jsx83("ul", { className: "space-y-1", children: preview.map((p) => /* @__PURE__ */ jsxs77("li", { className: "flex justify-between gap-2", children: [
|
|
26867
|
+
/* @__PURE__ */ jsx83("span", { className: "truncate", children: p.title }),
|
|
26868
|
+
/* @__PURE__ */ jsx83("span", { className: "shrink-0 text-muted-foreground", children: p.reason })
|
|
26741
26869
|
] }, p.record_id)) }),
|
|
26742
|
-
preview[0]?.trimmed_to ? /* @__PURE__ */
|
|
26870
|
+
preview[0]?.trimmed_to ? /* @__PURE__ */ jsxs77("p", { className: "mt-1 text-muted-foreground", children: [
|
|
26743
26871
|
"This organization does at most ",
|
|
26744
26872
|
preview[0].trimmed_to,
|
|
26745
26873
|
" in one go."
|
|
26746
26874
|
] }) : null
|
|
26747
26875
|
] }) : null,
|
|
26748
|
-
outcome?.ok && outcome.fieldId === row.field_id && outcome.wouldWrite && outcome.wouldWrite.length > 0 ? /* @__PURE__ */
|
|
26749
|
-
/* @__PURE__ */
|
|
26750
|
-
/* @__PURE__ */
|
|
26876
|
+
outcome?.ok && outcome.fieldId === row.field_id && outcome.wouldWrite && outcome.wouldWrite.length > 0 ? /* @__PURE__ */ jsx83("ul", { className: "space-y-1 rounded border p-2 text-xs", "data-testid": "enrich-would-write", children: outcome.wouldWrite.map((w) => /* @__PURE__ */ jsxs77("li", { className: "flex justify-between gap-2", children: [
|
|
26877
|
+
/* @__PURE__ */ jsx83("span", { className: "truncate text-muted-foreground", children: preview?.find((p) => p.record_id === w.record_id)?.title ?? w.record_id.slice(0, 8) }),
|
|
26878
|
+
/* @__PURE__ */ jsx83("span", { className: "min-w-0 truncate text-right", children: w.absent ? w.absent === "conflicting" ? "Sources disagree" : "Nothing found" : String(w.value ?? "") })
|
|
26751
26879
|
] }, w.record_id)) }) : null,
|
|
26752
|
-
outcome && (outcome.fieldId === void 0 || outcome.fieldId === row.field_id) ? outcome.ok ? /* @__PURE__ */
|
|
26880
|
+
outcome && (outcome.fieldId === void 0 || outcome.fieldId === row.field_id) ? outcome.ok ? /* @__PURE__ */ jsxs77("p", { className: "text-xs text-muted-foreground", "data-testid": "enrich-outcome", children: [
|
|
26753
26881
|
outcome.message,
|
|
26754
26882
|
costInPoints(outcome.costCents, host.pointsRate) !== null ? ` \xB7 ${costInPoints(outcome.costCents, host.pointsRate)}` : ""
|
|
26755
26883
|
] }) : (
|
|
26756
26884
|
// A run that did not happen is a refusal, with a heading and a remedy,
|
|
26757
26885
|
// never the host's words in red (lane REFUSAL-SWEEP).
|
|
26758
|
-
/* @__PURE__ */
|
|
26886
|
+
/* @__PURE__ */ jsx83(
|
|
26759
26887
|
RefusalLine,
|
|
26760
26888
|
{
|
|
26761
26889
|
error: (0, refusals_exports.refusal)(
|
|
@@ -26825,7 +26953,7 @@ init_parity();
|
|
|
26825
26953
|
init_names();
|
|
26826
26954
|
import { humanizeIdentifier as humanizeIdentifier10 } from "@ai-matrx/kit/text-case";
|
|
26827
26955
|
init_choiceLooks();
|
|
26828
|
-
import { jsx as
|
|
26956
|
+
import { jsx as jsx84, jsxs as jsxs78 } from "react/jsx-runtime";
|
|
26829
26957
|
function workedOutFrom(field2) {
|
|
26830
26958
|
const kind2 = editorKindFor(field2);
|
|
26831
26959
|
if (kind2 !== "formula" && kind2 !== "lookup" && kind2 !== "rollup") return null;
|
|
@@ -26880,7 +27008,7 @@ function columnLabel(fields, columnId2) {
|
|
|
26880
27008
|
return field2 ? fieldName(field2) : humanizeIdentifier10(columnId2);
|
|
26881
27009
|
}
|
|
26882
27010
|
function AddFieldButton({ onClick }) {
|
|
26883
|
-
return /* @__PURE__ */
|
|
27011
|
+
return /* @__PURE__ */ jsx84(
|
|
26884
27012
|
Button50,
|
|
26885
27013
|
{
|
|
26886
27014
|
size: "sm",
|
|
@@ -26902,22 +27030,22 @@ function Pager({
|
|
|
26902
27030
|
const from = page * pageSize;
|
|
26903
27031
|
const last = total === null ? rows < pageSize : from + rows >= total;
|
|
26904
27032
|
if (page === 0 && last) return null;
|
|
26905
|
-
return /* @__PURE__ */
|
|
26906
|
-
/* @__PURE__ */
|
|
26907
|
-
/* @__PURE__ */
|
|
27033
|
+
return /* @__PURE__ */ jsxs78("div", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
|
|
27034
|
+
/* @__PURE__ */ jsx84(Button50, { size: "sm", variant: "ghost", disabled: page === 0, onClick: () => onPage(page - 1), children: "Previous" }),
|
|
27035
|
+
/* @__PURE__ */ jsxs78("span", { children: [
|
|
26908
27036
|
from + 1,
|
|
26909
27037
|
"\u2013",
|
|
26910
27038
|
from + rows,
|
|
26911
27039
|
total === null ? "" : ` of ${total}`
|
|
26912
27040
|
] }),
|
|
26913
|
-
/* @__PURE__ */
|
|
27041
|
+
/* @__PURE__ */ jsx84(Button50, { size: "sm", variant: "ghost", disabled: last, onClick: () => onPage(page + 1), children: "Next" })
|
|
26914
27042
|
] });
|
|
26915
27043
|
}
|
|
26916
27044
|
function columnForField(field2, editing, mayWriteRow, whyNotRow, look, onAskWhoChanged, enrich) {
|
|
26917
27045
|
const name = fieldName(field2);
|
|
26918
27046
|
const format = cellFormatFor(field2, look?.format);
|
|
26919
27047
|
const workedOut = workedOutFrom(field2);
|
|
26920
|
-
const syncedMark = field2.source === "synced" ? /* @__PURE__ */
|
|
27048
|
+
const syncedMark = field2.source === "synced" ? /* @__PURE__ */ jsx84(
|
|
26921
27049
|
"span",
|
|
26922
27050
|
{
|
|
26923
27051
|
"data-records-synced": field2.key,
|
|
@@ -26928,25 +27056,25 @@ function columnForField(field2, editing, mayWriteRow, whyNotRow, look, onAskWhoC
|
|
|
26928
27056
|
}
|
|
26929
27057
|
) : null;
|
|
26930
27058
|
const restricted = field2.sensitivity === "confidential" || field2.sensitivity === "restricted";
|
|
26931
|
-
const lockMark = restricted ? /* @__PURE__ */
|
|
27059
|
+
const lockMark = restricted ? /* @__PURE__ */ jsx84(
|
|
26932
27060
|
"span",
|
|
26933
27061
|
{
|
|
26934
27062
|
"data-records-restricted": field2.key,
|
|
26935
27063
|
title: "Fewer people see this column",
|
|
26936
27064
|
"aria-label": "Fewer people see this column",
|
|
26937
27065
|
className: "inline-flex text-muted-foreground",
|
|
26938
|
-
children: /* @__PURE__ */
|
|
26939
|
-
/* @__PURE__ */
|
|
26940
|
-
/* @__PURE__ */
|
|
27066
|
+
children: /* @__PURE__ */ jsxs78("svg", { viewBox: "0 0 24 24", width: "11", height: "11", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
|
|
27067
|
+
/* @__PURE__ */ jsx84("rect", { x: "4", y: "11", width: "16", height: "10", rx: "2" }),
|
|
27068
|
+
/* @__PURE__ */ jsx84("path", { d: "M8 11V7a4 4 0 0 1 8 0v4" })
|
|
26941
27069
|
] })
|
|
26942
27070
|
}
|
|
26943
27071
|
) : null;
|
|
26944
27072
|
const withSynced = (inner2) => {
|
|
26945
|
-
const header = lockMark ? /* @__PURE__ */
|
|
27073
|
+
const header = lockMark ? /* @__PURE__ */ jsxs78("span", { className: "inline-flex items-center gap-1", children: [
|
|
26946
27074
|
inner2,
|
|
26947
27075
|
lockMark
|
|
26948
27076
|
] }) : inner2;
|
|
26949
|
-
return syncedMark ? /* @__PURE__ */
|
|
27077
|
+
return syncedMark ? /* @__PURE__ */ jsxs78("span", { className: "inline-flex items-center gap-1", children: [
|
|
26950
27078
|
syncedMark,
|
|
26951
27079
|
header
|
|
26952
27080
|
] }) : header;
|
|
@@ -26961,8 +27089,8 @@ function columnForField(field2, editing, mayWriteRow, whyNotRow, look, onAskWhoC
|
|
|
26961
27089
|
header: withSynced(
|
|
26962
27090
|
look?.rowLabel ? (
|
|
26963
27091
|
// THE COLUMN THAT NAMES EACH RECORD says so (tranche 6i, the older grid's key marker).
|
|
26964
|
-
/* @__PURE__ */
|
|
26965
|
-
/* @__PURE__ */
|
|
27092
|
+
/* @__PURE__ */ jsxs78("span", { className: "inline-flex items-center gap-1", children: [
|
|
27093
|
+
/* @__PURE__ */ jsx84(
|
|
26966
27094
|
"span",
|
|
26967
27095
|
{
|
|
26968
27096
|
"data-records-row-label": field2.key,
|
|
@@ -26977,10 +27105,10 @@ function columnForField(field2, editing, mayWriteRow, whyNotRow, look, onAskWhoC
|
|
|
26977
27105
|
) : workedOut && stampMarkOf(field2) ? (
|
|
26978
27106
|
// A STAMP OR A RECORD NUMBER (walk 2026-10-08 D7): kept by the store, but nobody wrote a formula
|
|
26979
27107
|
// for it, so its header wears its own mark — a clock, a person, a number sign — never "fx".
|
|
26980
|
-
/* @__PURE__ */
|
|
26981
|
-
) : workedOut ? /* @__PURE__ */
|
|
27108
|
+
/* @__PURE__ */ jsx84("span", { className: "inline-flex items-center", title: workedOut, "data-records-stamp": stampMarkOf(field2), children: withTypeMark(field2, name) })
|
|
27109
|
+
) : workedOut ? /* @__PURE__ */ jsxs78("span", { className: "inline-flex items-center gap-1", children: [
|
|
26982
27110
|
name,
|
|
26983
|
-
/* @__PURE__ */
|
|
27111
|
+
/* @__PURE__ */ jsx84(
|
|
26984
27112
|
"span",
|
|
26985
27113
|
{
|
|
26986
27114
|
"data-records-worked-out": field2.key,
|
|
@@ -27023,7 +27151,7 @@ function columnForField(field2, editing, mayWriteRow, whyNotRow, look, onAskWhoC
|
|
|
27023
27151
|
* at viewer. It rendered zero of them. The shell is drawn whenever there
|
|
27024
27152
|
* is an editor OR a question to ask; a null session simply has no editor.
|
|
27025
27153
|
*/
|
|
27026
|
-
editing || onAskWhoChanged ? /* @__PURE__ */
|
|
27154
|
+
editing || onAskWhoChanged ? /* @__PURE__ */ jsx84(
|
|
27027
27155
|
GridCell,
|
|
27028
27156
|
{
|
|
27029
27157
|
field: field2,
|
|
@@ -27034,8 +27162,8 @@ function columnForField(field2, editing, mayWriteRow, whyNotRow, look, onAskWhoC
|
|
|
27034
27162
|
...format ? { format } : {},
|
|
27035
27163
|
...onAskWhoChanged ? { onAskWhoChanged } : {}
|
|
27036
27164
|
}
|
|
27037
|
-
) : /* @__PURE__ */
|
|
27038
|
-
/* @__PURE__ */
|
|
27165
|
+
) : /* @__PURE__ */ jsxs78("span", { className: "inline-flex items-center gap-1", children: [
|
|
27166
|
+
/* @__PURE__ */ jsx84(
|
|
27039
27167
|
RecordValue,
|
|
27040
27168
|
{
|
|
27041
27169
|
inCell: true,
|
|
@@ -27047,7 +27175,7 @@ function columnForField(field2, editing, mayWriteRow, whyNotRow, look, onAskWhoC
|
|
|
27047
27175
|
...format ? { format } : {}
|
|
27048
27176
|
}
|
|
27049
27177
|
),
|
|
27050
|
-
enrich ? /* @__PURE__ */
|
|
27178
|
+
enrich ? /* @__PURE__ */ jsx84(
|
|
27051
27179
|
EnrichBadge,
|
|
27052
27180
|
{
|
|
27053
27181
|
cell: enrich.cellFor(row.id),
|
|
@@ -27111,8 +27239,8 @@ function withTypeMark(field2, header) {
|
|
|
27111
27239
|
const stamp = stampMarkOf(field2);
|
|
27112
27240
|
const kind2 = stamp ?? editorKindFor(field2);
|
|
27113
27241
|
const parts = (stamp ? STAMP_ICON[stamp] : TYPE_ICON[editorKindFor(field2)]) ?? TYPE_ICON.text;
|
|
27114
|
-
return /* @__PURE__ */
|
|
27115
|
-
/* @__PURE__ */
|
|
27242
|
+
return /* @__PURE__ */ jsxs78("span", { className: "inline-flex min-w-0 items-center gap-1.5", "data-records-type-mark": kind2, title: fieldHelpText(field2), children: [
|
|
27243
|
+
/* @__PURE__ */ jsx84(
|
|
27116
27244
|
"svg",
|
|
27117
27245
|
{
|
|
27118
27246
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -27129,7 +27257,7 @@ function withTypeMark(field2, header) {
|
|
|
27129
27257
|
"data-records-type-icon": kind2,
|
|
27130
27258
|
children: parts.map(([tag, attrs], i) => {
|
|
27131
27259
|
const El = tag;
|
|
27132
|
-
return /* @__PURE__ */
|
|
27260
|
+
return /* @__PURE__ */ jsx84(El, { ...attrs }, i);
|
|
27133
27261
|
})
|
|
27134
27262
|
}
|
|
27135
27263
|
),
|
|
@@ -27156,7 +27284,7 @@ import { useFields as useFields11, useOptionalRecordsClient as useOptionalRecord
|
|
|
27156
27284
|
import { Button as Button51, Dialog as Dialog15, DialogContent as DialogContent15, DialogHeader as DialogHeader15, DialogTitle as DialogTitle15, Popover as Popover11, PopoverContent as PopoverContent11, PopoverTrigger as PopoverTrigger11, Separator as Separator5, Skeleton as Skeleton10, cn as cn45 } from "@ai-matrx/design-system";
|
|
27157
27285
|
init_host();
|
|
27158
27286
|
init_Refusal();
|
|
27159
|
-
import { Fragment as
|
|
27287
|
+
import { Fragment as Fragment28, jsx as jsx85, jsxs as jsxs79 } from "react/jsx-runtime";
|
|
27160
27288
|
function reverseColumnId(column) {
|
|
27161
27289
|
return `${REVERSE_COLUMN_PREFIX}${column.key}`;
|
|
27162
27290
|
}
|
|
@@ -27176,25 +27304,25 @@ function ReverseLinkChips({
|
|
|
27176
27304
|
loading,
|
|
27177
27305
|
clamp
|
|
27178
27306
|
}) {
|
|
27179
|
-
if (!answer && loading) return /* @__PURE__ */
|
|
27180
|
-
if (!answer || answer.total === 0) return /* @__PURE__ */
|
|
27307
|
+
if (!answer && loading) return /* @__PURE__ */ jsx85(Skeleton10, { className: "h-4 w-24", "data-records-reverse-loading": "" });
|
|
27308
|
+
if (!answer || answer.total === 0) return /* @__PURE__ */ jsx85("span", { className: "text-muted-foreground", children: "\u2014" });
|
|
27181
27309
|
const refs = refsOf(column, answer);
|
|
27182
27310
|
const more = answer.total - refs.length;
|
|
27183
27311
|
if (clamp) {
|
|
27184
|
-
return /* @__PURE__ */
|
|
27312
|
+
return /* @__PURE__ */ jsx85(
|
|
27185
27313
|
ClampedChips,
|
|
27186
27314
|
{
|
|
27187
27315
|
dataAttr: column.key,
|
|
27188
|
-
items: refs.map((r) => ({ key: r.id, node: /* @__PURE__ */
|
|
27316
|
+
items: refs.map((r) => ({ key: r.id, node: /* @__PURE__ */ jsx85(ReferenceChip, { reference: r }) })),
|
|
27189
27317
|
total: answer.total,
|
|
27190
|
-
all: /* @__PURE__ */
|
|
27318
|
+
all: /* @__PURE__ */ jsx85(ReverseAllLinks, { column, tableId: clamp.tableId, recordId: clamp.recordId, first: refs, total: answer.total }),
|
|
27191
27319
|
className
|
|
27192
27320
|
}
|
|
27193
27321
|
);
|
|
27194
27322
|
}
|
|
27195
|
-
return /* @__PURE__ */
|
|
27196
|
-
refs.map((r) => /* @__PURE__ */
|
|
27197
|
-
more > 0 ? /* @__PURE__ */
|
|
27323
|
+
return /* @__PURE__ */ jsxs79("span", { className: cn45("flex min-w-0 flex-wrap items-center gap-1", className), "data-records-reverse-cell": column.key, children: [
|
|
27324
|
+
refs.map((r) => /* @__PURE__ */ jsx85(ReferenceChip, { reference: r }, r.id)),
|
|
27325
|
+
more > 0 ? /* @__PURE__ */ jsxs79("span", { className: "shrink-0 text-[11px] text-muted-foreground", title: `${more} more`, "data-records-reverse-more": "", children: [
|
|
27198
27326
|
"+",
|
|
27199
27327
|
more
|
|
27200
27328
|
] }) : null
|
|
@@ -27213,10 +27341,10 @@ function ReverseAllLinks({
|
|
|
27213
27341
|
const answer = read.data?.[column.key]?.[recordId];
|
|
27214
27342
|
const refs = answer ? refsOf(column, answer) : first;
|
|
27215
27343
|
const rest = total - refs.length;
|
|
27216
|
-
return /* @__PURE__ */
|
|
27217
|
-
/* @__PURE__ */
|
|
27218
|
-
read.error ? /* @__PURE__ */
|
|
27219
|
-
rest > 0 && !read.loading ? /* @__PURE__ */
|
|
27344
|
+
return /* @__PURE__ */ jsxs79("span", { className: "flex flex-col gap-1.5", "data-records-reverse-all": column.key, children: [
|
|
27345
|
+
/* @__PURE__ */ jsx85("span", { className: "flex flex-wrap gap-1", children: refs.map((r) => /* @__PURE__ */ jsx85(ReferenceChip, { reference: r }, r.id)) }),
|
|
27346
|
+
read.error ? /* @__PURE__ */ jsx85(RefusalNotice, { error: read.error }) : null,
|
|
27347
|
+
rest > 0 && !read.loading ? /* @__PURE__ */ jsxs79("span", { className: "text-[11px] text-muted-foreground", children: [
|
|
27220
27348
|
"+",
|
|
27221
27349
|
rest,
|
|
27222
27350
|
" more in the record panel"
|
|
@@ -27243,7 +27371,7 @@ function useReverseGridColumns(tableId, rowIds) {
|
|
|
27243
27371
|
sortRefusal: `Kept on ${column.source_table_name}, so it cannot sort here.`,
|
|
27244
27372
|
filter: false,
|
|
27245
27373
|
copyValue: (row) => (held.answers?.[column.key]?.[row.id]?.links ?? []).map((l) => l.words).join(", "),
|
|
27246
|
-
cell: (row) => row.id === SUMMARY_ROW_ID || row.id === ADD_ROW_ID ? null : /* @__PURE__ */
|
|
27374
|
+
cell: (row) => row.id === SUMMARY_ROW_ID || row.id === ADD_ROW_ID ? null : /* @__PURE__ */ jsx85(ReverseCell, { held, column, rowId: row.id, tableId }),
|
|
27247
27375
|
headerClassName: "whitespace-nowrap",
|
|
27248
27376
|
className: "align-middle",
|
|
27249
27377
|
...{ title: `Linked from ${column.source_table_name}` }
|
|
@@ -27281,9 +27409,9 @@ function ReverseCell({ held, column, rowId, tableId }) {
|
|
|
27281
27409
|
const readReading = () => held.reading;
|
|
27282
27410
|
const answer = useSyncExternalStore5(subscribe, readAnswer, readAnswer);
|
|
27283
27411
|
const reading = useSyncExternalStore5(subscribe, readReading, readReading);
|
|
27284
|
-
const chips = /* @__PURE__ */
|
|
27412
|
+
const chips = /* @__PURE__ */ jsx85(ReverseLinkChips, { column, answer, loading: reading, clamp: { tableId, recordId: rowId } });
|
|
27285
27413
|
if (column.read_only) return chips;
|
|
27286
|
-
return /* @__PURE__ */
|
|
27414
|
+
return /* @__PURE__ */ jsx85(ReverseLinksEditCell, { tableId, recordId: rowId, column, chips });
|
|
27287
27415
|
}
|
|
27288
27416
|
var reverseCellOpeners = /* @__PURE__ */ new Map();
|
|
27289
27417
|
function openReverseCell(rowId, columnId2) {
|
|
@@ -27315,8 +27443,8 @@ function ReverseLinksEditor({ tableId, recordId, column, autoOpen, onClose }) {
|
|
|
27315
27443
|
const read = useReverseLinks(tableId, one, ids, REVERSE_LINKS_EDIT_MAX);
|
|
27316
27444
|
const answer = read.data?.[column.key]?.[recordId];
|
|
27317
27445
|
const [refused, setRefused] = useState70(null);
|
|
27318
|
-
if (read.error) return /* @__PURE__ */
|
|
27319
|
-
if (!field2 || !answer || !client) return /* @__PURE__ */
|
|
27446
|
+
if (read.error) return /* @__PURE__ */ jsx85(RefusalNotice, { error: read.error });
|
|
27447
|
+
if (!field2 || !answer || !client) return /* @__PURE__ */ jsx85(Skeleton10, { className: "h-7 w-40", "data-records-reverse-editor-loading": "" });
|
|
27320
27448
|
const current = answer.links.map((l) => l.id);
|
|
27321
27449
|
const write = async (next) => {
|
|
27322
27450
|
const want = (Array.isArray(next) ? next : next ? [next] : []).map(String);
|
|
@@ -27327,9 +27455,9 @@ function ReverseLinksEditor({ tableId, recordId, column, autoOpen, onClose }) {
|
|
|
27327
27455
|
setRefused(done.ok ? null : done.error);
|
|
27328
27456
|
if (done.ok) read.reload();
|
|
27329
27457
|
};
|
|
27330
|
-
return /* @__PURE__ */
|
|
27331
|
-
/* @__PURE__ */
|
|
27332
|
-
refused ? /* @__PURE__ */
|
|
27458
|
+
return /* @__PURE__ */ jsxs79("span", { className: "flex min-w-0 flex-col gap-1", "data-records-reverse-editor": column.key, children: [
|
|
27459
|
+
/* @__PURE__ */ jsx85(RelationPicker, { field: field2, value: current, onChange: (next) => void write(next), autoOpen, onClose, excludeId: recordId }),
|
|
27460
|
+
refused ? /* @__PURE__ */ jsx85(RefusalNotice, { error: refused }) : null
|
|
27333
27461
|
] });
|
|
27334
27462
|
}
|
|
27335
27463
|
var REVERSE_LINKS_EDIT_MAX = 50;
|
|
@@ -27342,8 +27470,8 @@ function ReverseLinksEditCell({ tableId, recordId, column, chips }) {
|
|
|
27342
27470
|
reverseCellOpeners.delete(key);
|
|
27343
27471
|
};
|
|
27344
27472
|
}, [key]);
|
|
27345
|
-
return /* @__PURE__ */
|
|
27346
|
-
/* @__PURE__ */
|
|
27473
|
+
return /* @__PURE__ */ jsxs79(Popover11, { open, onOpenChange: setOpen, children: [
|
|
27474
|
+
/* @__PURE__ */ jsx85(PopoverTrigger11, { asChild: true, children: /* @__PURE__ */ jsx85(
|
|
27347
27475
|
"span",
|
|
27348
27476
|
{
|
|
27349
27477
|
role: "button",
|
|
@@ -27366,21 +27494,21 @@ function ReverseLinksEditCell({ tableId, recordId, column, chips }) {
|
|
|
27366
27494
|
setOpen(true);
|
|
27367
27495
|
}
|
|
27368
27496
|
},
|
|
27369
|
-
children: /* @__PURE__ */
|
|
27497
|
+
children: /* @__PURE__ */ jsx85("span", { className: "min-w-0 flex-1", children: chips })
|
|
27370
27498
|
}
|
|
27371
27499
|
) }),
|
|
27372
|
-
/* @__PURE__ */
|
|
27500
|
+
/* @__PURE__ */ jsx85(PopoverContent11, { sizing: "content", align: "start", className: "w-80 p-2", children: open ? /* @__PURE__ */ jsx85(ReverseLinksEditor, { tableId, recordId, column, autoOpen: true, onClose: () => setOpen(false) }) : null })
|
|
27373
27501
|
] });
|
|
27374
27502
|
}
|
|
27375
27503
|
var EMPTY_COLUMNS = [];
|
|
27376
27504
|
function ReverseLinksSections({ tableId, recordId }) {
|
|
27377
27505
|
const reverse = useReverseColumns3(tableId);
|
|
27378
|
-
if (reverse.error) return reverse.error.code === "door_absent" ? null : /* @__PURE__ */
|
|
27506
|
+
if (reverse.error) return reverse.error.code === "door_absent" ? null : /* @__PURE__ */ jsx85(RefusalNotice, { error: reverse.error });
|
|
27379
27507
|
const columns = reverse.data ?? [];
|
|
27380
27508
|
if (columns.length === 0) return null;
|
|
27381
|
-
return /* @__PURE__ */
|
|
27382
|
-
/* @__PURE__ */
|
|
27383
|
-
/* @__PURE__ */
|
|
27509
|
+
return /* @__PURE__ */ jsxs79(Fragment28, { children: [
|
|
27510
|
+
/* @__PURE__ */ jsx85(Separator5, {}),
|
|
27511
|
+
/* @__PURE__ */ jsx85("div", { className: "flex flex-col gap-3", "data-records-reverse-sections": "", children: columns.map((column) => /* @__PURE__ */ jsx85(ReverseLinksSection, { tableId, recordId, column }, column.key)) })
|
|
27384
27512
|
] });
|
|
27385
27513
|
}
|
|
27386
27514
|
function ReverseLinksSection({ tableId, recordId, column }) {
|
|
@@ -27390,26 +27518,26 @@ function ReverseLinksSection({ tableId, recordId, column }) {
|
|
|
27390
27518
|
const first = useReverseLinks(tableId, one, ids, Math.min(shown5, 50));
|
|
27391
27519
|
const answer = first.data?.[column.key]?.[recordId];
|
|
27392
27520
|
const [adding, setAdding] = useState70(false);
|
|
27393
|
-
return /* @__PURE__ */
|
|
27394
|
-
/* @__PURE__ */
|
|
27395
|
-
/* @__PURE__ */
|
|
27396
|
-
answer && answer.total > 0 ? /* @__PURE__ */
|
|
27397
|
-
/* @__PURE__ */
|
|
27521
|
+
return /* @__PURE__ */ jsxs79("section", { className: "flex min-w-0 flex-col gap-1.5", "data-records-reverse-section": column.key, children: [
|
|
27522
|
+
/* @__PURE__ */ jsxs79("div", { className: "flex items-center gap-2", children: [
|
|
27523
|
+
/* @__PURE__ */ jsx85("h4", { className: "truncate text-xs font-medium", title: column.label, children: column.label }),
|
|
27524
|
+
answer && answer.total > 0 ? /* @__PURE__ */ jsx85("span", { className: "text-[11px] text-muted-foreground", children: answer.total }) : null,
|
|
27525
|
+
/* @__PURE__ */ jsx85(AddLinkedButton, { column, onAdd: () => setAdding(true) })
|
|
27398
27526
|
] }),
|
|
27399
|
-
first.error ? /* @__PURE__ */
|
|
27400
|
-
answer && answer.total > answer.links.length && answer.links.length < 50 ? /* @__PURE__ */
|
|
27527
|
+
first.error ? /* @__PURE__ */ jsx85(RefusalNotice, { error: first.error }) : column.read_only ? /* @__PURE__ */ jsx85(ReverseLinkChips, { column, answer, loading: first.loading }) : /* @__PURE__ */ jsx85(ReverseLinksEditor, { tableId, recordId, column }),
|
|
27528
|
+
answer && answer.total > answer.links.length && answer.links.length < 50 ? /* @__PURE__ */ jsxs79(Button51, { size: "sm", variant: "ghost", className: "self-start px-1 text-[11px]", onClick: () => setShown((n) => n + REVERSE_PANEL_PAGE), children: [
|
|
27401
27529
|
"Show ",
|
|
27402
27530
|
Math.min(REVERSE_PANEL_PAGE, answer.total - answer.links.length),
|
|
27403
27531
|
" more"
|
|
27404
27532
|
] }) : null,
|
|
27405
|
-
adding ? /* @__PURE__ */
|
|
27533
|
+
adding ? /* @__PURE__ */ jsx85(AddLinkedDialog, { column, targetId: recordId, onClose: () => setAdding(false), onSaved: () => first.reload() }) : null
|
|
27406
27534
|
] });
|
|
27407
27535
|
}
|
|
27408
27536
|
function AddLinkedButton({ column, onAdd }) {
|
|
27409
27537
|
const source = useTable9(column.source_table_id);
|
|
27410
27538
|
const rights = useTableRights(source.data);
|
|
27411
27539
|
if (!rights.known || !rights.write) return null;
|
|
27412
|
-
return /* @__PURE__ */
|
|
27540
|
+
return /* @__PURE__ */ jsx85(
|
|
27413
27541
|
Button51,
|
|
27414
27542
|
{
|
|
27415
27543
|
size: "sm",
|
|
@@ -27432,12 +27560,12 @@ function AddLinkedDialog({
|
|
|
27432
27560
|
const fields = useFields11(column.source_table_id);
|
|
27433
27561
|
const field2 = (fields.data ?? []).find((f) => f.id === column.source_field_id);
|
|
27434
27562
|
const initial = field2 ? { [field2.key]: field2.multi ? [targetId] : targetId } : null;
|
|
27435
|
-
return /* @__PURE__ */
|
|
27436
|
-
/* @__PURE__ */
|
|
27563
|
+
return /* @__PURE__ */ jsx85(Dialog15, { open: true, onOpenChange: (next) => !next ? onClose() : void 0, children: /* @__PURE__ */ jsxs79(DialogContent15, { className: "sm:max-w-lg", "data-records-reverse-dialog": column.key, children: [
|
|
27564
|
+
/* @__PURE__ */ jsx85(DialogHeader15, { children: /* @__PURE__ */ jsxs79(DialogTitle15, { children: [
|
|
27437
27565
|
"Add to ",
|
|
27438
27566
|
column.source_table_name
|
|
27439
27567
|
] }) }),
|
|
27440
|
-
fields.error ? /* @__PURE__ */
|
|
27568
|
+
fields.error ? /* @__PURE__ */ jsx85(RefusalNotice, { error: fields.error }) : initial ? /* @__PURE__ */ jsx85(
|
|
27441
27569
|
RecordForm,
|
|
27442
27570
|
{
|
|
27443
27571
|
tableId: column.source_table_id,
|
|
@@ -27453,7 +27581,7 @@ function AddLinkedDialog({
|
|
|
27453
27581
|
}
|
|
27454
27582
|
|
|
27455
27583
|
// src/subItems.tsx
|
|
27456
|
-
import { jsx as
|
|
27584
|
+
import { jsx as jsx86, jsxs as jsxs80 } from "react/jsx-runtime";
|
|
27457
27585
|
function subItemsField(fields, tableId) {
|
|
27458
27586
|
for (const f of fields ?? []) {
|
|
27459
27587
|
const config = f.config ?? {};
|
|
@@ -27517,8 +27645,8 @@ function withSubItems(columns, tree, collapsed, onToggle, onAddSubItem) {
|
|
|
27517
27645
|
const d = tree.depth.get(row.id);
|
|
27518
27646
|
if (d === void 0) return drawn;
|
|
27519
27647
|
const open = !collapsed.has(row.id);
|
|
27520
|
-
return /* @__PURE__ */
|
|
27521
|
-
tree.parents.has(row.id) ? /* @__PURE__ */
|
|
27648
|
+
return /* @__PURE__ */ jsxs80("span", { className: "flex min-w-0 items-center gap-0.5", style: { paddingLeft: d * SUB_ITEM_INDENT_PX }, "data-records-sub-item-depth": d, children: [
|
|
27649
|
+
tree.parents.has(row.id) ? /* @__PURE__ */ jsx86(
|
|
27522
27650
|
"button",
|
|
27523
27651
|
{
|
|
27524
27652
|
type: "button",
|
|
@@ -27532,9 +27660,9 @@ function withSubItems(columns, tree, collapsed, onToggle, onAddSubItem) {
|
|
|
27532
27660
|
},
|
|
27533
27661
|
children: open ? "\u25BE" : "\u25B8"
|
|
27534
27662
|
}
|
|
27535
|
-
) : /* @__PURE__ */
|
|
27536
|
-
/* @__PURE__ */
|
|
27537
|
-
onAddSubItem ? /* @__PURE__ */
|
|
27663
|
+
) : /* @__PURE__ */ jsx86("span", { className: "w-4 shrink-0", "aria-hidden": true }),
|
|
27664
|
+
/* @__PURE__ */ jsx86("span", { className: "min-w-0 flex-1", children: drawn }),
|
|
27665
|
+
onAddSubItem ? /* @__PURE__ */ jsx86(
|
|
27538
27666
|
"button",
|
|
27539
27667
|
{
|
|
27540
27668
|
type: "button",
|
|
@@ -27564,7 +27692,7 @@ init_Refusal();
|
|
|
27564
27692
|
init_refusals();
|
|
27565
27693
|
import { useState as useState71 } from "react";
|
|
27566
27694
|
import { Badge as Badge12, Button as Button52, Separator as Separator6 } from "@ai-matrx/design-system";
|
|
27567
|
-
import { Fragment as
|
|
27695
|
+
import { Fragment as Fragment29, jsx as jsx87, jsxs as jsxs81 } from "react/jsx-runtime";
|
|
27568
27696
|
function PastePreview({
|
|
27569
27697
|
plan,
|
|
27570
27698
|
noun,
|
|
@@ -27579,7 +27707,7 @@ function PastePreview({
|
|
|
27579
27707
|
const [adding, setAdding] = useState71(null);
|
|
27580
27708
|
const [addFailed, setAddFailed] = useState71(null);
|
|
27581
27709
|
const nothingToDo = plan.cells === 0;
|
|
27582
|
-
return /* @__PURE__ */
|
|
27710
|
+
return /* @__PURE__ */ jsx87(
|
|
27583
27711
|
"div",
|
|
27584
27712
|
{
|
|
27585
27713
|
role: "dialog",
|
|
@@ -27593,50 +27721,50 @@ function PastePreview({
|
|
|
27593
27721
|
event.stopPropagation();
|
|
27594
27722
|
if (!busy) onCancel();
|
|
27595
27723
|
},
|
|
27596
|
-
children: /* @__PURE__ */
|
|
27597
|
-
/* @__PURE__ */
|
|
27598
|
-
/* @__PURE__ */
|
|
27599
|
-
/* @__PURE__ */
|
|
27724
|
+
children: /* @__PURE__ */ jsxs81("div", { className: "flex max-h-[80vh] w-full max-w-2xl flex-col gap-3 overflow-auto rounded-lg border bg-background p-4 shadow-lg", children: [
|
|
27725
|
+
/* @__PURE__ */ jsxs81("div", { className: "flex items-baseline justify-between gap-3", children: [
|
|
27726
|
+
/* @__PURE__ */ jsx87("h2", { className: "text-sm font-medium", children: outcome ? "What was written" : "Before this is written" }),
|
|
27727
|
+
/* @__PURE__ */ jsx87("span", { className: "text-xs text-muted-foreground", "data-matrx-paste-summary": true, children: outcome ? `${outcome.readBack} ${outcome.readBack === 1 ? "value" : "values"} read back` : summarize(plan) })
|
|
27600
27728
|
] }),
|
|
27601
|
-
/* @__PURE__ */
|
|
27602
|
-
outcome === null ? /* @__PURE__ */
|
|
27603
|
-
nothingToDo ? /* @__PURE__ */
|
|
27729
|
+
/* @__PURE__ */ jsx87(Separator6, {}),
|
|
27730
|
+
outcome === null ? /* @__PURE__ */ jsxs81(Fragment29, { children: [
|
|
27731
|
+
nothingToDo ? /* @__PURE__ */ jsx87("p", { className: "text-sm", children: "Nothing in what you pasted can be written to this table. Every cell is listed below with the reason." }) : /* @__PURE__ */ jsxs81("p", { className: "text-sm", children: [
|
|
27604
27732
|
sentence(plan, noun, nounPlural),
|
|
27605
27733
|
" The values below are exactly what will be stored, written the way the grid writes them \u2014 a choice column shows the word and stores the option behind it."
|
|
27606
27734
|
] }),
|
|
27607
|
-
plan.header ? /* @__PURE__ */
|
|
27735
|
+
plan.header ? /* @__PURE__ */ jsxs81("p", { className: "text-xs text-muted-foreground", "data-matrx-paste-header": true, children: [
|
|
27608
27736
|
"The first line named columns, so it matched by name and is not written.",
|
|
27609
27737
|
plan.header.unmatched.length > 0 ? ` Not in this table, so left out: ${plan.header.unmatched.join(", ")}.` : ""
|
|
27610
27738
|
] }) : null,
|
|
27611
|
-
plan.droppedLines ? /* @__PURE__ */
|
|
27739
|
+
plan.droppedLines ? /* @__PURE__ */ jsxs81("p", { className: "text-xs text-muted-foreground", "data-matrx-paste-dropped": true, children: [
|
|
27612
27740
|
plural4(plan.droppedLines, "line", "lines"),
|
|
27613
27741
|
" past the last row ",
|
|
27614
27742
|
plan.droppedLines === 1 ? "was" : "were",
|
|
27615
27743
|
" left out."
|
|
27616
27744
|
] }) : null,
|
|
27617
|
-
/* @__PURE__ */
|
|
27618
|
-
plan.refusals.length > 0 ? /* @__PURE__ */
|
|
27619
|
-
/* @__PURE__ */
|
|
27620
|
-
/* @__PURE__ */
|
|
27621
|
-
/* @__PURE__ */
|
|
27745
|
+
/* @__PURE__ */ jsx87(PlanTable, { plan }),
|
|
27746
|
+
plan.refusals.length > 0 ? /* @__PURE__ */ jsxs81("div", { "data-matrx-paste-refusals": true, className: "flex flex-col gap-1", children: [
|
|
27747
|
+
/* @__PURE__ */ jsx87("p", { className: "text-xs font-medium", children: plan.refusals.length === 1 ? "One cell will be left alone:" : `${plan.refusals.length} cells will be left alone:` }),
|
|
27748
|
+
/* @__PURE__ */ jsx87("ul", { className: "flex flex-col gap-1", children: plan.refusals.slice(0, 12).map((refusal3, index) => /* @__PURE__ */ jsxs81("li", { className: "text-xs text-muted-foreground", children: [
|
|
27749
|
+
/* @__PURE__ */ jsx87("span", { className: "font-medium", children: refusal3.fromLine > 0 ? `Row ${refusal3.fromLine}, ${refusal3.column}` : refusal3.column }),
|
|
27622
27750
|
" \u2014 ",
|
|
27623
27751
|
refusal3.why
|
|
27624
27752
|
] }, index)) }),
|
|
27625
|
-
plan.refusals.length > 12 ? /* @__PURE__ */
|
|
27753
|
+
plan.refusals.length > 12 ? /* @__PURE__ */ jsxs81("p", { className: "text-xs text-muted-foreground", children: [
|
|
27626
27754
|
plan.refusals.length - 12,
|
|
27627
27755
|
" more of the same kinds."
|
|
27628
27756
|
] }) : null
|
|
27629
27757
|
] }) : null,
|
|
27630
|
-
onAddOptions && plan.unmatchedOptions.length > 0 ? /* @__PURE__ */
|
|
27631
|
-
plan.unmatchedOptions.map((group) => /* @__PURE__ */
|
|
27632
|
-
/* @__PURE__ */
|
|
27633
|
-
/* @__PURE__ */
|
|
27758
|
+
onAddOptions && plan.unmatchedOptions.length > 0 ? /* @__PURE__ */ jsxs81("div", { "data-matrx-paste-add-options": true, className: "flex flex-col gap-2", children: [
|
|
27759
|
+
plan.unmatchedOptions.map((group) => /* @__PURE__ */ jsxs81("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
27760
|
+
/* @__PURE__ */ jsxs81("p", { className: "text-xs", children: [
|
|
27761
|
+
/* @__PURE__ */ jsx87("span", { className: "font-medium", children: group.column }),
|
|
27634
27762
|
" does not offer",
|
|
27635
27763
|
" ",
|
|
27636
27764
|
group.words.map((w) => `\u201C${w}\u201D`).join(", "),
|
|
27637
27765
|
"."
|
|
27638
27766
|
] }),
|
|
27639
|
-
/* @__PURE__ */
|
|
27767
|
+
/* @__PURE__ */ jsx87(
|
|
27640
27768
|
Button52,
|
|
27641
27769
|
{
|
|
27642
27770
|
type: "button",
|
|
@@ -27662,9 +27790,9 @@ function PastePreview({
|
|
|
27662
27790
|
}
|
|
27663
27791
|
)
|
|
27664
27792
|
] }, group.fieldKey)),
|
|
27665
|
-
addFailed ? /* @__PURE__ */
|
|
27793
|
+
addFailed ? /* @__PURE__ */ jsx87(RefusalLine, { error: addFailed }) : null
|
|
27666
27794
|
] }) : null,
|
|
27667
|
-
plan.pastRightEdge > 0 ? /* @__PURE__ */
|
|
27795
|
+
plan.pastRightEdge > 0 ? /* @__PURE__ */ jsxs81("p", { className: "text-xs text-muted-foreground", children: [
|
|
27668
27796
|
plan.pastRightEdge,
|
|
27669
27797
|
" ",
|
|
27670
27798
|
plan.pastRightEdge === 1 ? "value was" : "values were",
|
|
@@ -27672,9 +27800,9 @@ function PastePreview({
|
|
|
27672
27800
|
plan.pastRightEdge === 1 ? "it" : "them",
|
|
27673
27801
|
". Add the columns first and paste again."
|
|
27674
27802
|
] }) : null,
|
|
27675
|
-
/* @__PURE__ */
|
|
27676
|
-
/* @__PURE__ */
|
|
27677
|
-
onFillExisting && plan.creates > 0 && plan.updates > 0 ? /* @__PURE__ */
|
|
27803
|
+
/* @__PURE__ */ jsxs81("div", { className: "flex items-center justify-end gap-2 pt-1", children: [
|
|
27804
|
+
/* @__PURE__ */ jsx87(Button52, { size: "sm", variant: "ghost", onClick: onCancel, disabled: busy, autoFocus: nothingToDo, children: "Cancel" }),
|
|
27805
|
+
onFillExisting && plan.creates > 0 && plan.updates > 0 ? /* @__PURE__ */ jsx87(
|
|
27678
27806
|
Button52,
|
|
27679
27807
|
{
|
|
27680
27808
|
size: "sm",
|
|
@@ -27685,7 +27813,7 @@ function PastePreview({
|
|
|
27685
27813
|
children: "Fill only the existing rows"
|
|
27686
27814
|
}
|
|
27687
27815
|
) : null,
|
|
27688
|
-
/* @__PURE__ */
|
|
27816
|
+
/* @__PURE__ */ jsx87(
|
|
27689
27817
|
Button52,
|
|
27690
27818
|
{
|
|
27691
27819
|
size: "sm",
|
|
@@ -27700,17 +27828,17 @@ function PastePreview({
|
|
|
27700
27828
|
}
|
|
27701
27829
|
)
|
|
27702
27830
|
] })
|
|
27703
|
-
] }) : /* @__PURE__ */
|
|
27831
|
+
] }) : /* @__PURE__ */ jsx87(Outcome, { outcome, onClose: onCancel })
|
|
27704
27832
|
] })
|
|
27705
27833
|
}
|
|
27706
27834
|
);
|
|
27707
27835
|
}
|
|
27708
27836
|
function Outcome({ outcome, onClose }) {
|
|
27709
27837
|
const whole = outcome.missing === 0 && outcome.refusals.length === 0;
|
|
27710
|
-
return /* @__PURE__ */
|
|
27711
|
-
/* @__PURE__ */
|
|
27712
|
-
outcome.refusals.length > 0 ? /* @__PURE__ */
|
|
27713
|
-
/* @__PURE__ */
|
|
27838
|
+
return /* @__PURE__ */ jsxs81(Fragment29, { children: [
|
|
27839
|
+
/* @__PURE__ */ jsx87("p", { className: "text-sm", "data-matrx-paste-outcome": whole ? "whole" : "partial", children: whole ? `All ${outcome.readBack} ${outcome.readBack === 1 ? "value is" : "values are"} in the table \u2014 read back out of it, not just accepted.` : `${outcome.readBack} of ${outcome.readBack + outcome.missing} values are in the table. The rest are not, and nothing was lost from what you copied \u2014 it is still on your clipboard.` }),
|
|
27840
|
+
outcome.refusals.length > 0 ? /* @__PURE__ */ jsx87("ul", { className: "flex flex-col gap-1", children: outcome.refusals.slice(0, 8).map((why, index) => /* @__PURE__ */ jsx87("li", { className: "text-xs text-muted-foreground", children: why }, index)) }) : null,
|
|
27841
|
+
/* @__PURE__ */ jsx87("div", { className: "flex justify-end pt-1", children: /* @__PURE__ */ jsx87(Button52, { size: "sm", onClick: onClose, autoFocus: true, children: "Close" }) })
|
|
27714
27842
|
] });
|
|
27715
27843
|
}
|
|
27716
27844
|
function PlanTable({ plan }) {
|
|
@@ -27719,24 +27847,24 @@ function PlanTable({ plan }) {
|
|
|
27719
27847
|
if (shown5.length === 0 || keys.length === 0) return null;
|
|
27720
27848
|
const columnName = /* @__PURE__ */ new Map();
|
|
27721
27849
|
for (const row of shown5) for (const cell2 of row.cells) if (!columnName.has(cell2.key)) columnName.set(cell2.key, cell2.column);
|
|
27722
|
-
return /* @__PURE__ */
|
|
27723
|
-
/* @__PURE__ */
|
|
27724
|
-
/* @__PURE__ */
|
|
27725
|
-
/* @__PURE__ */
|
|
27726
|
-
keys.map((key) => /* @__PURE__ */
|
|
27850
|
+
return /* @__PURE__ */ jsxs81("div", { className: "overflow-auto rounded border", children: [
|
|
27851
|
+
/* @__PURE__ */ jsxs81("table", { className: "w-full text-xs", "data-matrx-paste-plan": true, children: [
|
|
27852
|
+
/* @__PURE__ */ jsx87("thead", { className: "bg-muted/50", children: /* @__PURE__ */ jsxs81("tr", { children: [
|
|
27853
|
+
/* @__PURE__ */ jsx87("th", { className: "px-2 py-1 text-left font-medium", children: "Row" }),
|
|
27854
|
+
keys.map((key) => /* @__PURE__ */ jsx87("th", { className: "px-2 py-1 text-left font-medium", children: columnName.get(key) ?? key }, key))
|
|
27727
27855
|
] }) }),
|
|
27728
|
-
/* @__PURE__ */
|
|
27729
|
-
/* @__PURE__ */
|
|
27856
|
+
/* @__PURE__ */ jsx87("tbody", { children: shown5.map((row) => /* @__PURE__ */ jsxs81("tr", { className: "border-t", children: [
|
|
27857
|
+
/* @__PURE__ */ jsxs81("td", { className: "whitespace-nowrap px-2 py-1", children: [
|
|
27730
27858
|
row.fromLine,
|
|
27731
|
-
row.recordId === null ? /* @__PURE__ */
|
|
27859
|
+
row.recordId === null ? /* @__PURE__ */ jsx87(Badge12, { variant: "outline", className: "ml-1", children: "new" }) : null
|
|
27732
27860
|
] }),
|
|
27733
27861
|
keys.map((key) => {
|
|
27734
27862
|
const cell2 = row.cells.find((c) => c.key === key);
|
|
27735
|
-
if (!cell2) return /* @__PURE__ */
|
|
27863
|
+
if (!cell2) return /* @__PURE__ */ jsx87("td", { className: "px-2 py-1" }, key);
|
|
27736
27864
|
if (cell2.refusal !== null) {
|
|
27737
|
-
return /* @__PURE__ */
|
|
27865
|
+
return /* @__PURE__ */ jsx87("td", { className: "px-2 py-1 text-muted-foreground line-through", children: cell2.raw }, key);
|
|
27738
27866
|
}
|
|
27739
|
-
return /* @__PURE__ */
|
|
27867
|
+
return /* @__PURE__ */ jsx87("td", { className: "px-2 py-1", children: cell2.value === null ? /* @__PURE__ */ jsx87("span", { className: "text-muted-foreground", children: "cleared" }) : (
|
|
27740
27868
|
// THE WORDS, NOT THE ID. A choice column stores the option
|
|
27741
27869
|
// record's id and the person pasted a word; showing the id
|
|
27742
27870
|
// here made this panel print
|
|
@@ -27747,7 +27875,7 @@ function PlanTable({ plan }) {
|
|
|
27747
27875
|
})
|
|
27748
27876
|
] }, row.fromLine)) })
|
|
27749
27877
|
] }),
|
|
27750
|
-
plan.rows.length > shown5.length ? /* @__PURE__ */
|
|
27878
|
+
plan.rows.length > shown5.length ? /* @__PURE__ */ jsxs81("p", { className: "px-2 py-1 text-xs text-muted-foreground", children: [
|
|
27751
27879
|
"\u2026and ",
|
|
27752
27880
|
plan.rows.length - shown5.length,
|
|
27753
27881
|
" more rows the same way."
|
|
@@ -27804,8 +27932,8 @@ init_host();
|
|
|
27804
27932
|
init_rights();
|
|
27805
27933
|
init_names();
|
|
27806
27934
|
init_plainWords();
|
|
27807
|
-
import { openOutbound as
|
|
27808
|
-
import { Fragment as
|
|
27935
|
+
import { openOutbound as openOutbound3 } from "@ai-matrx/kit/outbound";
|
|
27936
|
+
import { Fragment as Fragment30, jsx as jsx88, jsxs as jsxs82 } from "react/jsx-runtime";
|
|
27809
27937
|
function duplicateValues(fields, document2) {
|
|
27810
27938
|
const data = {};
|
|
27811
27939
|
for (const field2 of fields) {
|
|
@@ -27838,7 +27966,7 @@ function useRecordActionHost({ tableId, row, onOpenRecord, onChanged, onMerge, o
|
|
|
27838
27966
|
// The record's panel carries its history under it — on its page, or in the table's rail.
|
|
27839
27967
|
...href ? { history: () => navigate ? navigate(href) : window.location.assign(href) } : onOpenRecord ? { history: (r) => onOpenRecord(r.id) } : {},
|
|
27840
27968
|
openInNewTab: (url) => {
|
|
27841
|
-
|
|
27969
|
+
openOutbound3(url, "_blank", "noopener");
|
|
27842
27970
|
},
|
|
27843
27971
|
copyText: async (url) => {
|
|
27844
27972
|
if (await copyText3(url)) {
|
|
@@ -27900,7 +28028,7 @@ function useRecordActionHost({ tableId, row, onOpenRecord, onChanged, onMerge, o
|
|
|
27900
28028
|
}
|
|
27901
28029
|
function ContextActionItem({ action: action3 }) {
|
|
27902
28030
|
const disabled = action3.disabledReason !== void 0;
|
|
27903
|
-
return /* @__PURE__ */
|
|
28031
|
+
return /* @__PURE__ */ jsxs82(
|
|
27904
28032
|
ContextMenuItem,
|
|
27905
28033
|
{
|
|
27906
28034
|
disabled,
|
|
@@ -27911,26 +28039,26 @@ function ContextActionItem({ action: action3 }) {
|
|
|
27911
28039
|
"data-object-action": action3.id,
|
|
27912
28040
|
className: action3.destructive ? "text-destructive focus:text-destructive" : void 0,
|
|
27913
28041
|
children: [
|
|
27914
|
-
/* @__PURE__ */
|
|
27915
|
-
/* @__PURE__ */
|
|
27916
|
-
/* @__PURE__ */
|
|
27917
|
-
disabled ? /* @__PURE__ */
|
|
28042
|
+
/* @__PURE__ */ jsx88(ObjectActionGlyph, { name: action3.icon, className: "mr-2 h-4 w-4 shrink-0" }),
|
|
28043
|
+
/* @__PURE__ */ jsxs82("span", { className: "flex min-w-0 flex-col", children: [
|
|
28044
|
+
/* @__PURE__ */ jsx88("span", { children: action3.label }),
|
|
28045
|
+
disabled ? /* @__PURE__ */ jsx88("span", { className: "truncate text-xs text-muted-foreground", "data-object-action-reason": "", children: action3.disabledReason }) : null
|
|
27918
28046
|
] }),
|
|
27919
|
-
action3.shortcut ? /* @__PURE__ */
|
|
28047
|
+
action3.shortcut ? /* @__PURE__ */ jsx88(ContextMenuShortcut, { children: action3.shortcut }) : null
|
|
27920
28048
|
]
|
|
27921
28049
|
}
|
|
27922
28050
|
);
|
|
27923
28051
|
}
|
|
27924
28052
|
function ObjectActionContextMenuItems({ actions }) {
|
|
27925
|
-
return /* @__PURE__ */
|
|
27926
|
-
if (entry.kind === "separator") return /* @__PURE__ */
|
|
27927
|
-
if (entry.kind === "item") return /* @__PURE__ */
|
|
27928
|
-
return /* @__PURE__ */
|
|
27929
|
-
/* @__PURE__ */
|
|
27930
|
-
entry.icon ? /* @__PURE__ */
|
|
28053
|
+
return /* @__PURE__ */ jsx88(Fragment30, { children: toDropdownEntries(actions).map((entry) => {
|
|
28054
|
+
if (entry.kind === "separator") return /* @__PURE__ */ jsx88(ContextMenuSeparator, {}, entry.id);
|
|
28055
|
+
if (entry.kind === "item") return /* @__PURE__ */ jsx88(ContextActionItem, { action: entry.action }, entry.action.id);
|
|
28056
|
+
return /* @__PURE__ */ jsxs82(ContextMenuSub, { children: [
|
|
28057
|
+
/* @__PURE__ */ jsxs82(ContextMenuSubTrigger, { "data-object-action-group": entry.id, children: [
|
|
28058
|
+
entry.icon ? /* @__PURE__ */ jsx88(ObjectActionGlyph, { name: entry.icon, className: "mr-2 h-4 w-4 shrink-0" }) : null,
|
|
27931
28059
|
entry.label
|
|
27932
28060
|
] }),
|
|
27933
|
-
/* @__PURE__ */
|
|
28061
|
+
/* @__PURE__ */ jsx88(ContextMenuSubContent, { children: entry.actions.map((a) => /* @__PURE__ */ jsx88(ContextActionItem, { action: a }, a.id)) })
|
|
27934
28062
|
] }, entry.id);
|
|
27935
28063
|
}) });
|
|
27936
28064
|
}
|
|
@@ -27947,11 +28075,11 @@ function RecordActionMenu({ tableId, row, name, onOpenRecord, onChanged, childre
|
|
|
27947
28075
|
() => recordActions({ record: { id: row.id, tableId, name }, rights, host: actionHost }),
|
|
27948
28076
|
[row.id, tableId, name, rights, actionHost]
|
|
27949
28077
|
);
|
|
27950
|
-
return /* @__PURE__ */
|
|
27951
|
-
/* @__PURE__ */
|
|
28078
|
+
return /* @__PURE__ */ jsxs82(ContextMenu, { children: [
|
|
28079
|
+
/* @__PURE__ */ jsx88(ContextMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs82("div", { className: cn46("group/record-card relative", className), "data-record-actions": row.id, children: [
|
|
27952
28080
|
children,
|
|
27953
|
-
/* @__PURE__ */
|
|
27954
|
-
/* @__PURE__ */
|
|
28081
|
+
/* @__PURE__ */ jsxs82(DropdownMenu5, { children: [
|
|
28082
|
+
/* @__PURE__ */ jsx88(DropdownMenuTrigger5, { asChild: true, children: /* @__PURE__ */ jsx88(
|
|
27955
28083
|
"button",
|
|
27956
28084
|
{
|
|
27957
28085
|
type: "button",
|
|
@@ -27959,18 +28087,18 @@ function RecordActionMenu({ tableId, row, name, onOpenRecord, onChanged, childre
|
|
|
27959
28087
|
title: "More",
|
|
27960
28088
|
"data-record-actions-trigger": row.id,
|
|
27961
28089
|
className: "absolute right-0.5 top-0.5 flex h-6 w-6 items-center justify-center rounded bg-background/90 text-muted-foreground opacity-0 hover:bg-muted hover:text-foreground focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring group-hover/record-card:opacity-100 data-[state=open]:opacity-100 [@media(hover:none)]:opacity-100",
|
|
27962
|
-
children: /* @__PURE__ */
|
|
27963
|
-
/* @__PURE__ */
|
|
27964
|
-
/* @__PURE__ */
|
|
27965
|
-
/* @__PURE__ */
|
|
28090
|
+
children: /* @__PURE__ */ jsxs82("svg", { viewBox: "0 0 24 24", className: "h-4 w-4", fill: "currentColor", "aria-hidden": "true", children: [
|
|
28091
|
+
/* @__PURE__ */ jsx88("circle", { cx: "5", cy: "12", r: "1.75" }),
|
|
28092
|
+
/* @__PURE__ */ jsx88("circle", { cx: "12", cy: "12", r: "1.75" }),
|
|
28093
|
+
/* @__PURE__ */ jsx88("circle", { cx: "19", cy: "12", r: "1.75" })
|
|
27966
28094
|
] })
|
|
27967
28095
|
}
|
|
27968
28096
|
) }),
|
|
27969
|
-
/* @__PURE__ */
|
|
28097
|
+
/* @__PURE__ */ jsx88(DropdownMenuContent5, { align: "end", className: "w-56", children: /* @__PURE__ */ jsx88(ObjectActionMenuItems, { actions }) })
|
|
27970
28098
|
] })
|
|
27971
28099
|
] }) }),
|
|
27972
|
-
/* @__PURE__ */
|
|
27973
|
-
merging ? /* @__PURE__ */
|
|
28100
|
+
/* @__PURE__ */ jsx88(ContextMenuContent, { className: "w-56", children: /* @__PURE__ */ jsx88(ObjectActionContextMenuItems, { actions }) }),
|
|
28101
|
+
merging ? /* @__PURE__ */ jsx88(
|
|
27974
28102
|
MergeRecordDialog,
|
|
27975
28103
|
{
|
|
27976
28104
|
tableId,
|
|
@@ -27980,7 +28108,7 @@ function RecordActionMenu({ tableId, row, name, onOpenRecord, onChanged, childre
|
|
|
27980
28108
|
onMerged: onChanged
|
|
27981
28109
|
}
|
|
27982
28110
|
) : null,
|
|
27983
|
-
splitting ? /* @__PURE__ */
|
|
28111
|
+
splitting ? /* @__PURE__ */ jsx88(
|
|
27984
28112
|
SplitRecordDialog,
|
|
27985
28113
|
{
|
|
27986
28114
|
tableId,
|
|
@@ -27991,7 +28119,7 @@ function RecordActionMenu({ tableId, row, name, onOpenRecord, onChanged, childre
|
|
|
27991
28119
|
onChanged
|
|
27992
28120
|
}
|
|
27993
28121
|
) : null,
|
|
27994
|
-
extracting ? /* @__PURE__ */
|
|
28122
|
+
extracting ? /* @__PURE__ */ jsx88(
|
|
27995
28123
|
ExtractParentDialog,
|
|
27996
28124
|
{
|
|
27997
28125
|
tableId,
|
|
@@ -28005,118 +28133,17 @@ function RecordActionMenu({ tableId, row, name, onOpenRecord, onChanged, childre
|
|
|
28005
28133
|
] });
|
|
28006
28134
|
}
|
|
28007
28135
|
|
|
28008
|
-
// src/gridOpen.tsx
|
|
28009
|
-
import { openOutbound as openOutbound3 } from "@ai-matrx/kit/outbound";
|
|
28010
|
-
import { Fragment as Fragment30, jsx as jsx88, jsxs as jsxs82 } from "react/jsx-runtime";
|
|
28011
|
-
var TITLE_OWN_CONTROLS = 'input, textarea, select, button, a[href], [role="combobox"], [contenteditable="true"], [contenteditable=""]';
|
|
28012
|
-
function openRecordLabel(name) {
|
|
28013
|
-
return `Open ${name}`;
|
|
28014
|
-
}
|
|
28015
|
-
function opensOnKey(event) {
|
|
28016
|
-
if (event.key !== " " || event.altKey || event.ctrlKey || event.metaKey) return false;
|
|
28017
|
-
const target = event.target;
|
|
28018
|
-
if (!target) return false;
|
|
28019
|
-
const tag = target.tagName;
|
|
28020
|
-
if (tag === "INPUT" || tag === "TEXTAREA" || tag === "SELECT" || tag === "BUTTON") return false;
|
|
28021
|
-
if (target.isContentEditable) {
|
|
28022
|
-
const editor = target.closest('[contenteditable=""], [contenteditable="true"], [contenteditable="plaintext-only"]');
|
|
28023
|
-
const inside = event.currentTarget;
|
|
28024
|
-
if (!editor || !inside || inside.contains(editor)) return false;
|
|
28025
|
-
}
|
|
28026
|
-
return true;
|
|
28027
|
-
}
|
|
28028
|
-
function withOpenRecord(columns, onOpen, nameOf3, place = "end", hrefOf, navigate) {
|
|
28029
|
-
if (!onOpen) return columns;
|
|
28030
|
-
return columns.map((column, index) => {
|
|
28031
|
-
const original = column.cell;
|
|
28032
|
-
const render = (row, rowIndex) => original ? original(row, rowIndex) : String(row[column.id ?? ""] ?? "");
|
|
28033
|
-
const openFrom = (row, event) => {
|
|
28034
|
-
const href = hrefOf?.(row);
|
|
28035
|
-
if (!href) {
|
|
28036
|
-
onOpen(row.id);
|
|
28037
|
-
return;
|
|
28038
|
-
}
|
|
28039
|
-
if (event.metaKey || event.ctrlKey) openOutbound3(href, "_blank", "noopener");
|
|
28040
|
-
else if (navigate) navigate(href);
|
|
28041
|
-
else window.location.assign(href);
|
|
28042
|
-
};
|
|
28043
|
-
const handle = (row) => /* @__PURE__ */ jsxs82(
|
|
28044
|
-
"button",
|
|
28045
|
-
{
|
|
28046
|
-
type: "button",
|
|
28047
|
-
"data-records-open-record": row.id,
|
|
28048
|
-
"aria-label": openRecordLabel(nameOf3(row)),
|
|
28049
|
-
title: `${openRecordLabel(nameOf3(row))} (Space)`,
|
|
28050
|
-
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",
|
|
28051
|
-
onClick: (event) => {
|
|
28052
|
-
event.stopPropagation();
|
|
28053
|
-
openFrom(row, event);
|
|
28054
|
-
},
|
|
28055
|
-
onDoubleClick: (event) => event.stopPropagation(),
|
|
28056
|
-
children: [
|
|
28057
|
-
/* @__PURE__ */ jsx88("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__ */ jsx88("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" }) }),
|
|
28058
|
-
"Open"
|
|
28059
|
-
]
|
|
28060
|
-
}
|
|
28061
|
-
);
|
|
28062
|
-
const titleTarget = (event) => {
|
|
28063
|
-
const target = event.target;
|
|
28064
|
-
if (!target || typeof target.closest !== "function") return false;
|
|
28065
|
-
const hit = target.closest(TITLE_OWN_CONTROLS);
|
|
28066
|
-
return hit === null || !event.currentTarget.contains(hit);
|
|
28067
|
-
};
|
|
28068
|
-
return {
|
|
28069
|
-
...column,
|
|
28070
|
-
cell: (row, rowIndex) => /* @__PURE__ */ jsx88(
|
|
28071
|
-
"span",
|
|
28072
|
-
{
|
|
28073
|
-
className: index === 0 ? "relative flex min-w-0 items-center gap-1" : "contents",
|
|
28074
|
-
"data-records-opens-on-space": row.id,
|
|
28075
|
-
onKeyDown: (event) => {
|
|
28076
|
-
if (!opensOnKey(event)) return;
|
|
28077
|
-
event.preventDefault();
|
|
28078
|
-
event.stopPropagation();
|
|
28079
|
-
onOpen(row.id);
|
|
28080
|
-
},
|
|
28081
|
-
children: index === 0 ? /* @__PURE__ */ jsxs82(Fragment30, { children: [
|
|
28082
|
-
place === "start" ? handle(row) : null,
|
|
28083
|
-
/* @__PURE__ */ jsx88(
|
|
28084
|
-
"span",
|
|
28085
|
-
{
|
|
28086
|
-
className: "min-w-0 flex-1 decoration-muted-foreground/60 underline-offset-2 hover:underline",
|
|
28087
|
-
"data-clickable": "",
|
|
28088
|
-
"data-records-opens-on-click": row.id,
|
|
28089
|
-
onClick: (event) => {
|
|
28090
|
-
if (!titleTarget(event)) return;
|
|
28091
|
-
openFrom(row, event);
|
|
28092
|
-
},
|
|
28093
|
-
onDoubleClickCapture: (event) => {
|
|
28094
|
-
if (!titleTarget(event)) return;
|
|
28095
|
-
event.stopPropagation();
|
|
28096
|
-
openFrom(row, event);
|
|
28097
|
-
},
|
|
28098
|
-
children: render(row, rowIndex)
|
|
28099
|
-
}
|
|
28100
|
-
),
|
|
28101
|
-
place === "end" ? handle(row) : null
|
|
28102
|
-
] }) : render(row, rowIndex)
|
|
28103
|
-
}
|
|
28104
|
-
)
|
|
28105
|
-
};
|
|
28106
|
-
});
|
|
28107
|
-
}
|
|
28108
|
-
|
|
28109
28136
|
// src/Grid.tsx
|
|
28110
28137
|
init_ImportWizard();
|
|
28111
28138
|
init_tableShape();
|
|
28112
28139
|
|
|
28113
28140
|
// src/toolbarSlot.tsx
|
|
28114
|
-
import { createContext as
|
|
28141
|
+
import { createContext as createContext8, useContext as useContext8 } from "react";
|
|
28115
28142
|
import { createPortal as createPortal2 } from "react-dom";
|
|
28116
28143
|
import { Fragment as Fragment31, jsx as jsx89 } from "react/jsx-runtime";
|
|
28117
|
-
var TableToolbarSlotContext =
|
|
28144
|
+
var TableToolbarSlotContext = createContext8(void 0);
|
|
28118
28145
|
function useTableToolbarSlot() {
|
|
28119
|
-
return
|
|
28146
|
+
return useContext8(TableToolbarSlotContext);
|
|
28120
28147
|
}
|
|
28121
28148
|
function InTableToolbar({ children }) {
|
|
28122
28149
|
const slot = useTableToolbarSlot();
|
|
@@ -28124,13 +28151,13 @@ function InTableToolbar({ children }) {
|
|
|
28124
28151
|
if (slot === null) return null;
|
|
28125
28152
|
return createPortal2(children, slot);
|
|
28126
28153
|
}
|
|
28127
|
-
var TableToolbarFoldContext =
|
|
28154
|
+
var TableToolbarFoldContext = createContext8(0);
|
|
28128
28155
|
function useTableToolbarFold() {
|
|
28129
|
-
return
|
|
28156
|
+
return useContext8(TableToolbarFoldContext);
|
|
28130
28157
|
}
|
|
28131
|
-
var TableToolbarSheetExtrasContext =
|
|
28158
|
+
var TableToolbarSheetExtrasContext = createContext8(void 0);
|
|
28132
28159
|
function useTableToolbarSheetExtras() {
|
|
28133
|
-
return
|
|
28160
|
+
return useContext8(TableToolbarSheetExtrasContext);
|
|
28134
28161
|
}
|
|
28135
28162
|
|
|
28136
28163
|
// src/GridLayoutMenu.tsx
|
|
@@ -28262,15 +28289,15 @@ function GridLayoutMenu({
|
|
|
28262
28289
|
}
|
|
28263
28290
|
|
|
28264
28291
|
// src/newRowValues.tsx
|
|
28265
|
-
import { createContext as
|
|
28292
|
+
import { createContext as createContext9, useContext as useContext9 } from "react";
|
|
28266
28293
|
import { Fragment as Fragment33, jsx as jsx91 } from "react/jsx-runtime";
|
|
28267
|
-
var NewRowValuesContext =
|
|
28294
|
+
var NewRowValuesContext = createContext9(null);
|
|
28268
28295
|
function NewRowValuesProvider({ values, children }) {
|
|
28269
28296
|
if (!values || Object.keys(values).length === 0) return /* @__PURE__ */ jsx91(Fragment33, { children });
|
|
28270
28297
|
return /* @__PURE__ */ jsx91(NewRowValuesContext.Provider, { value: values, children });
|
|
28271
28298
|
}
|
|
28272
28299
|
function useNewRowValues() {
|
|
28273
|
-
return
|
|
28300
|
+
return useContext9(NewRowValuesContext);
|
|
28274
28301
|
}
|
|
28275
28302
|
function withNewRowValues(preset, data) {
|
|
28276
28303
|
return { ...preset ?? {}, ...data ?? {} };
|
|
@@ -29847,7 +29874,7 @@ function StructureLocked({ className }) {
|
|
|
29847
29874
|
init_PickOne();
|
|
29848
29875
|
|
|
29849
29876
|
// src/viewAddress.ts
|
|
29850
|
-
import { createContext as
|
|
29877
|
+
import { createContext as createContext10, useContext as useContext10 } from "react";
|
|
29851
29878
|
var VIEW_ADDRESS_KEYS = ["sort", "cf", "q", "hide", "page"];
|
|
29852
29879
|
function isViewAddressEmpty(state2) {
|
|
29853
29880
|
if (!state2) return true;
|
|
@@ -29901,8 +29928,8 @@ function viewAddressFromParams(get) {
|
|
|
29901
29928
|
function sameViewAddress(a, b) {
|
|
29902
29929
|
return JSON.stringify(viewAddressToParams(a)) === JSON.stringify(viewAddressToParams(b));
|
|
29903
29930
|
}
|
|
29904
|
-
var ViewAddressContext =
|
|
29905
|
-
var useViewAddress = () =>
|
|
29931
|
+
var ViewAddressContext = createContext10(null);
|
|
29932
|
+
var useViewAddress = () => useContext10(ViewAddressContext);
|
|
29906
29933
|
|
|
29907
29934
|
// src/Grid.tsx
|
|
29908
29935
|
import { Fragment as Fragment36, jsx as jsx99, jsxs as jsxs89 } from "react/jsx-runtime";
|
|
@@ -29953,7 +29980,6 @@ function GridBody({
|
|
|
29953
29980
|
const fills = footer === "sticky";
|
|
29954
29981
|
const host = useRecordsUi();
|
|
29955
29982
|
const hrefForRecord = host.hrefForRecord;
|
|
29956
|
-
const navigate = host.navigate;
|
|
29957
29983
|
const client = useRecordsClient50();
|
|
29958
29984
|
const table = useTable11(tableId);
|
|
29959
29985
|
const fields = useFields13(tableId);
|
|
@@ -31150,9 +31176,9 @@ function GridBody({
|
|
|
31150
31176
|
(row) => recordNameIn(table.data, row.document ?? {}),
|
|
31151
31177
|
// The merged grid's handle sits at the START of the row, where Airtable's expand sits.
|
|
31152
31178
|
merged ? "start" : "end",
|
|
31153
|
-
//
|
|
31179
|
+
// ⌘/Ctrl-click opens the record's own page in a new tab; every other way in opens the panel.
|
|
31154
31180
|
hrefForRecord && table.data ? (row) => hrefForRecord({ table: table.data, recordId: row.id }) : void 0,
|
|
31155
|
-
|
|
31181
|
+
onOpenRecord
|
|
31156
31182
|
),
|
|
31157
31183
|
// REL-9: the tables that link HERE, as read-only columns after the table's own
|
|
31158
31184
|
// (`ReverseColumns.tsx`). Virtual — never a Field, so no menu, filter or paste reaches them.
|
|
@@ -31162,7 +31188,7 @@ function GridBody({
|
|
|
31162
31188
|
),
|
|
31163
31189
|
mayAddRow ? () => footerNow.current.addLine() : null
|
|
31164
31190
|
),
|
|
31165
|
-
[treeColumns, reverseGridColumns, onOpenRecord, table.data, merged, mayAddRow, hrefForRecord
|
|
31191
|
+
[treeColumns, reverseGridColumns, onOpenRecord, table.data, merged, mayAddRow, hrefForRecord]
|
|
31166
31192
|
);
|
|
31167
31193
|
const isRowSelectable = useCallback32((row) => row.id !== SUMMARY_ROW.id && mayWriteRow(row.id), [mayWriteRow]);
|
|
31168
31194
|
const viewRowsNow = useRef42([]);
|
|
@@ -52628,7 +52654,7 @@ init_Refusal();
|
|
|
52628
52654
|
init_host();
|
|
52629
52655
|
|
|
52630
52656
|
// src/PageCanvas.tsx
|
|
52631
|
-
import { createContext as
|
|
52657
|
+
import { createContext as createContext11, useContext as useContext11, useEffect as useEffect119, useMemo as useMemo78, useState as useState139 } from "react";
|
|
52632
52658
|
import {
|
|
52633
52659
|
useFields as useFields35,
|
|
52634
52660
|
useRecordPage as useRecordPage3,
|
|
@@ -52725,10 +52751,10 @@ function RecordStepper({ neighbors, onStep, expanded, onToggleExpand }) {
|
|
|
52725
52751
|
|
|
52726
52752
|
// src/PageCanvas.tsx
|
|
52727
52753
|
import { Fragment as Fragment66, jsx as jsx165, jsxs as jsxs153 } from "react/jsx-runtime";
|
|
52728
|
-
var InterfaceDoorContext =
|
|
52754
|
+
var InterfaceDoorContext = createContext11(null);
|
|
52729
52755
|
var InterfaceDoorProvider = InterfaceDoorContext.Provider;
|
|
52730
52756
|
function useInterfaceDoor() {
|
|
52731
|
-
return
|
|
52757
|
+
return useContext11(InterfaceDoorContext);
|
|
52732
52758
|
}
|
|
52733
52759
|
function doorField(f) {
|
|
52734
52760
|
return {
|