@ai-matrx/records-ui 0.115.74 → 0.115.75
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 +538 -395
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +26 -3
- package/dist/index.d.ts +26 -3
- package/dist/index.js +520 -377
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -25448,6 +25448,7 @@ function GridBody({
|
|
|
25448
25448
|
onOpenRecord,
|
|
25449
25449
|
openRecordId = null,
|
|
25450
25450
|
onCloseRecord,
|
|
25451
|
+
onRowsShown,
|
|
25451
25452
|
onAddField,
|
|
25452
25453
|
onNewRecordForm,
|
|
25453
25454
|
toolbarActions,
|
|
@@ -25728,6 +25729,11 @@ function GridBody({
|
|
|
25728
25729
|
const rows = added.rows;
|
|
25729
25730
|
const lockedRows = records.data?.locked ?? 0;
|
|
25730
25731
|
const rowIds = useMemo39(() => rows.map((row) => row.id), [rows]);
|
|
25732
|
+
const rowsShownRef = useRef37(onRowsShown);
|
|
25733
|
+
rowsShownRef.current = onRowsShown;
|
|
25734
|
+
useEffect55(() => {
|
|
25735
|
+
rowsShownRef.current?.(rowIds);
|
|
25736
|
+
}, [rowIds]);
|
|
25731
25737
|
const countedButNotReturned = !records.error && !records.loading && rows.length === 0 && typeof records.data?.total === "number" && records.data.total > 0 && (storePaged ? query.page <= 1 : page <= 0);
|
|
25732
25738
|
const reReads = useRef37(0);
|
|
25733
25739
|
const reloadRecords = useRef37(records.reload);
|
|
@@ -38134,6 +38140,7 @@ function ViewSwitcher({
|
|
|
38134
38140
|
onOpenRecord,
|
|
38135
38141
|
openRecordId,
|
|
38136
38142
|
onCloseRecord,
|
|
38143
|
+
onRowsShown,
|
|
38137
38144
|
onMoved,
|
|
38138
38145
|
onNewRecordForm,
|
|
38139
38146
|
onAskWhoChanged,
|
|
@@ -38211,6 +38218,7 @@ function ViewSwitcher({
|
|
|
38211
38218
|
...onOpenRecord ? { onOpenRecord } : {},
|
|
38212
38219
|
...openRecordId ? { openRecordId } : {},
|
|
38213
38220
|
...onCloseRecord ? { onCloseRecord } : {},
|
|
38221
|
+
...onRowsShown ? { onRowsShown } : {},
|
|
38214
38222
|
...onNewRecordForm ? { onNewRecordForm } : {},
|
|
38215
38223
|
...onAskWhoChanged ? { onAskWhoChanged } : {},
|
|
38216
38224
|
...viewId ? {
|
|
@@ -52141,7 +52149,7 @@ import { tableShapeChanged as tableShapeChanged15, useFields as useFields39, use
|
|
|
52141
52149
|
import {
|
|
52142
52150
|
Badge as Badge26,
|
|
52143
52151
|
BottomSheet,
|
|
52144
|
-
Button as
|
|
52152
|
+
Button as Button120,
|
|
52145
52153
|
DropdownMenu as DropdownMenu10,
|
|
52146
52154
|
DropdownMenuContent as DropdownMenuContent10,
|
|
52147
52155
|
DropdownMenuItem as DropdownMenuItem8,
|
|
@@ -52399,42 +52407,143 @@ async function runTablePageAction(kind, args) {
|
|
|
52399
52407
|
}
|
|
52400
52408
|
}
|
|
52401
52409
|
|
|
52402
|
-
// src/
|
|
52403
|
-
import {
|
|
52404
|
-
import {
|
|
52405
|
-
|
|
52406
|
-
|
|
52407
|
-
|
|
52408
|
-
|
|
52409
|
-
|
|
52410
|
-
|
|
52411
|
-
|
|
52412
|
-
|
|
52413
|
-
|
|
52414
|
-
|
|
52415
|
-
|
|
52416
|
-
|
|
52417
|
-
|
|
52418
|
-
|
|
52410
|
+
// src/RecordStepper.tsx
|
|
52411
|
+
import { Button as Button114 } from "@ai-matrx/design-system";
|
|
52412
|
+
import { jsx as jsx169, jsxs as jsxs157 } from "react/jsx-runtime";
|
|
52413
|
+
function neighborsOf(ids, id) {
|
|
52414
|
+
const index = ids.indexOf(id);
|
|
52415
|
+
if (index < 0) return null;
|
|
52416
|
+
return {
|
|
52417
|
+
index,
|
|
52418
|
+
total: ids.length,
|
|
52419
|
+
previous: index > 0 ? ids[index - 1] : null,
|
|
52420
|
+
next: index < ids.length - 1 ? ids[index + 1] : null
|
|
52421
|
+
};
|
|
52422
|
+
}
|
|
52423
|
+
var TEXT_TAGS = /* @__PURE__ */ new Set(["INPUT", "TEXTAREA", "SELECT"]);
|
|
52424
|
+
function stepKeyOf(event) {
|
|
52425
|
+
if (event.defaultPrevented || event.metaKey || event.ctrlKey || event.altKey || event.shiftKey) return null;
|
|
52426
|
+
if (event.key !== "ArrowUp" && event.key !== "ArrowDown") return null;
|
|
52427
|
+
const target = event.target;
|
|
52428
|
+
if (target) {
|
|
52429
|
+
if (TEXT_TAGS.has(target.tagName) || target.isContentEditable) return null;
|
|
52430
|
+
const role = target.getAttribute?.("role");
|
|
52431
|
+
if (role === "combobox" || role === "listbox" || role === "option" || role === "slider" || role === "spinbutton") return null;
|
|
52432
|
+
}
|
|
52433
|
+
return event.key === "ArrowUp" ? -1 : 1;
|
|
52434
|
+
}
|
|
52435
|
+
function RecordStepper({ neighbors, onStep, expanded, onToggleExpand }) {
|
|
52436
|
+
return /* @__PURE__ */ jsxs157("div", { className: "flex items-center gap-1", "data-record-stepper": "", children: [
|
|
52419
52437
|
/* @__PURE__ */ jsx169(
|
|
52420
|
-
|
|
52438
|
+
Button114,
|
|
52421
52439
|
{
|
|
52422
|
-
|
|
52423
|
-
|
|
52424
|
-
|
|
52440
|
+
size: "sm",
|
|
52441
|
+
variant: "ghost",
|
|
52442
|
+
className: "h-7 w-7 p-0",
|
|
52443
|
+
"aria-label": "Previous record",
|
|
52444
|
+
title: "Previous record (\u2191)",
|
|
52445
|
+
disabled: neighbors.previous === null,
|
|
52446
|
+
onClick: () => neighbors.previous && onStep(neighbors.previous),
|
|
52447
|
+
"data-record-previous": "",
|
|
52448
|
+
children: "\u2191"
|
|
52425
52449
|
}
|
|
52426
52450
|
),
|
|
52427
|
-
|
|
52428
|
-
|
|
52429
|
-
|
|
52430
|
-
|
|
52431
|
-
|
|
52432
|
-
|
|
52433
|
-
|
|
52434
|
-
|
|
52435
|
-
|
|
52451
|
+
/* @__PURE__ */ jsx169(
|
|
52452
|
+
Button114,
|
|
52453
|
+
{
|
|
52454
|
+
size: "sm",
|
|
52455
|
+
variant: "ghost",
|
|
52456
|
+
className: "h-7 w-7 p-0",
|
|
52457
|
+
"aria-label": "Next record",
|
|
52458
|
+
title: "Next record (\u2193)",
|
|
52459
|
+
disabled: neighbors.next === null,
|
|
52460
|
+
onClick: () => neighbors.next && onStep(neighbors.next),
|
|
52461
|
+
"data-record-next": "",
|
|
52462
|
+
children: "\u2193"
|
|
52463
|
+
}
|
|
52464
|
+
),
|
|
52465
|
+
/* @__PURE__ */ jsxs157("span", { className: "text-[11px] tabular-nums text-muted-foreground", "data-record-position": "", children: [
|
|
52466
|
+
neighbors.index + 1,
|
|
52467
|
+
" of ",
|
|
52468
|
+
neighbors.total
|
|
52469
|
+
] }),
|
|
52470
|
+
onToggleExpand ? /* @__PURE__ */ jsx169(
|
|
52471
|
+
Button114,
|
|
52472
|
+
{
|
|
52473
|
+
size: "sm",
|
|
52474
|
+
variant: "ghost",
|
|
52475
|
+
className: "ml-auto h-7 px-2 text-xs",
|
|
52476
|
+
"aria-pressed": Boolean(expanded),
|
|
52477
|
+
onClick: onToggleExpand,
|
|
52478
|
+
"data-record-expand": "",
|
|
52479
|
+
children: expanded ? "Shrink" : "Expand"
|
|
52480
|
+
}
|
|
52481
|
+
) : null
|
|
52436
52482
|
] });
|
|
52437
52483
|
}
|
|
52484
|
+
|
|
52485
|
+
// src/RecordPanel.tsx
|
|
52486
|
+
import { Fragment as Fragment68, useState as useState144 } from "react";
|
|
52487
|
+
import { Button as Button115, Separator as Separator13 } from "@ai-matrx/design-system";
|
|
52488
|
+
import { useFields as useFields37, useRecord as useRecord5 } from "@ai-matrx/records/react";
|
|
52489
|
+
import { Fragment as Fragment69, jsx as jsx170, jsxs as jsxs158 } from "react/jsx-runtime";
|
|
52490
|
+
function RecordPanel({ tableId, recordId, onClose, onAskAboutField, onPage = false, neighbors, onStep, expanded, onToggleExpand }) {
|
|
52491
|
+
const host = useRecordsUi();
|
|
52492
|
+
const [asking, setAsking] = useState144(null);
|
|
52493
|
+
return /* @__PURE__ */ jsxs158(
|
|
52494
|
+
"div",
|
|
52495
|
+
{
|
|
52496
|
+
className: "space-y-3 outline-none",
|
|
52497
|
+
tabIndex: -1,
|
|
52498
|
+
"data-record-panel": recordId,
|
|
52499
|
+
onKeyDown: (event) => {
|
|
52500
|
+
if (event.key === "Escape" && !event.defaultPrevented && onClose && !onPage) {
|
|
52501
|
+
const tag = event.target?.tagName;
|
|
52502
|
+
if (tag !== "INPUT" && tag !== "TEXTAREA" && tag !== "SELECT") {
|
|
52503
|
+
event.preventDefault();
|
|
52504
|
+
onClose();
|
|
52505
|
+
}
|
|
52506
|
+
return;
|
|
52507
|
+
}
|
|
52508
|
+
if (!neighbors || !onStep) return;
|
|
52509
|
+
const way = stepKeyOf(event);
|
|
52510
|
+
const to = way === null ? null : way < 0 ? neighbors.previous : neighbors.next;
|
|
52511
|
+
if (to) {
|
|
52512
|
+
event.preventDefault();
|
|
52513
|
+
onStep(to);
|
|
52514
|
+
}
|
|
52515
|
+
},
|
|
52516
|
+
children: [
|
|
52517
|
+
neighbors && onStep ? /* @__PURE__ */ jsx170(RecordStepper, { neighbors, onStep: (to) => onStep(to), expanded, onToggleExpand }) : null,
|
|
52518
|
+
/* @__PURE__ */ jsx170(Peek, { tableId, recordId, onPage, ...onClose ? { onClose } : {} }),
|
|
52519
|
+
onPage ? /* @__PURE__ */ jsxs158(Fragment69, { children: [
|
|
52520
|
+
/* @__PURE__ */ jsx170(RecordBody, { tableId, recordId }),
|
|
52521
|
+
/* @__PURE__ */ jsx170(LinkedLists, { tableId, recordId }),
|
|
52522
|
+
/* @__PURE__ */ jsx170(ReverseLinksSections, { tableId, recordId }),
|
|
52523
|
+
/* @__PURE__ */ jsx170(RecordAsk, { tableId, recordId })
|
|
52524
|
+
] }) : null,
|
|
52525
|
+
/* @__PURE__ */ jsx170(Separator13, {}),
|
|
52526
|
+
/* @__PURE__ */ jsx170(
|
|
52527
|
+
HistoryPanel,
|
|
52528
|
+
{
|
|
52529
|
+
tableId,
|
|
52530
|
+
recordId,
|
|
52531
|
+
onAskAboutField: (fieldKey) => onAskAboutField ? onAskAboutField(fieldKey) : setAsking(fieldKey)
|
|
52532
|
+
}
|
|
52533
|
+
),
|
|
52534
|
+
!onAskAboutField && asking ? /* @__PURE__ */ jsx170(FieldHistoryPanel, { tableId, fieldKey: asking, recordId, onClose: () => setAsking(null) }) : null,
|
|
52535
|
+
host.recordSections ? /* @__PURE__ */ jsxs158(Fragment68, { children: [
|
|
52536
|
+
/* @__PURE__ */ jsx170(Separator13, {}),
|
|
52537
|
+
host.recordSections({ tableId, recordId })
|
|
52538
|
+
] }) : null,
|
|
52539
|
+
/* @__PURE__ */ jsx170(Separator13, {}),
|
|
52540
|
+
/* @__PURE__ */ jsx170(ChecklistRunner, { tableId, recordId }),
|
|
52541
|
+
/* @__PURE__ */ jsx170(Separator13, {}),
|
|
52542
|
+
/* @__PURE__ */ jsx170(CommentThread, { tableId, recordId })
|
|
52543
|
+
]
|
|
52544
|
+
}
|
|
52545
|
+
);
|
|
52546
|
+
}
|
|
52438
52547
|
function LinkedLists({ tableId, recordId }) {
|
|
52439
52548
|
const fields = useFields37(tableId);
|
|
52440
52549
|
const record = useRecord5(recordId, true, { tableId });
|
|
@@ -52444,9 +52553,9 @@ function LinkedLists({ tableId, recordId }) {
|
|
|
52444
52553
|
const may = useRecordRights(recordId);
|
|
52445
52554
|
if (links.length === 0 || !document2) return null;
|
|
52446
52555
|
if (may.write) {
|
|
52447
|
-
return /* @__PURE__ */
|
|
52448
|
-
/* @__PURE__ */
|
|
52449
|
-
/* @__PURE__ */
|
|
52556
|
+
return /* @__PURE__ */ jsxs158("div", { className: "flex flex-col gap-3", "data-record-linked-lists": "", children: [
|
|
52557
|
+
/* @__PURE__ */ jsx170(Separator13, {}),
|
|
52558
|
+
/* @__PURE__ */ jsx170(
|
|
52450
52559
|
RecordFieldsInPlace,
|
|
52451
52560
|
{
|
|
52452
52561
|
tableId,
|
|
@@ -52459,25 +52568,25 @@ function LinkedLists({ tableId, recordId }) {
|
|
|
52459
52568
|
className: "flex min-w-0 flex-col gap-1",
|
|
52460
52569
|
renderLabel: (field2) => {
|
|
52461
52570
|
const count = referencesOf(field2, document2[field2.key], "relation", labels).length;
|
|
52462
|
-
return /* @__PURE__ */
|
|
52463
|
-
/* @__PURE__ */
|
|
52464
|
-
count > 0 ? /* @__PURE__ */
|
|
52571
|
+
return /* @__PURE__ */ jsxs158("span", { className: "flex items-center gap-2 pt-2 text-foreground", "data-record-linked-list": field2.key, children: [
|
|
52572
|
+
/* @__PURE__ */ jsx170("span", { className: "truncate text-xs font-medium", children: fieldName(field2) }),
|
|
52573
|
+
count > 0 ? /* @__PURE__ */ jsx170("span", { className: "text-[11px] text-muted-foreground", children: count }) : null
|
|
52465
52574
|
] });
|
|
52466
52575
|
}
|
|
52467
52576
|
}
|
|
52468
52577
|
)
|
|
52469
52578
|
] });
|
|
52470
52579
|
}
|
|
52471
|
-
return /* @__PURE__ */
|
|
52472
|
-
/* @__PURE__ */
|
|
52580
|
+
return /* @__PURE__ */ jsxs158("div", { className: "flex flex-col gap-3", "data-record-linked-lists": "", children: [
|
|
52581
|
+
/* @__PURE__ */ jsx170(Separator13, {}),
|
|
52473
52582
|
links.map((field2) => {
|
|
52474
52583
|
const refs = referencesOf(field2, document2[field2.key], "relation", labels);
|
|
52475
|
-
return /* @__PURE__ */
|
|
52476
|
-
/* @__PURE__ */
|
|
52477
|
-
/* @__PURE__ */
|
|
52478
|
-
refs.length > 0 ? /* @__PURE__ */
|
|
52584
|
+
return /* @__PURE__ */ jsxs158("section", { className: "flex min-w-0 flex-col gap-1", "data-record-linked-list": field2.key, children: [
|
|
52585
|
+
/* @__PURE__ */ jsxs158("div", { className: "flex items-center gap-2", children: [
|
|
52586
|
+
/* @__PURE__ */ jsx170("h4", { className: "truncate text-xs font-medium", children: fieldName(field2) }),
|
|
52587
|
+
refs.length > 0 ? /* @__PURE__ */ jsx170("span", { className: "text-[11px] text-muted-foreground", children: refs.length }) : null
|
|
52479
52588
|
] }),
|
|
52480
|
-
refs.length === 0 ? /* @__PURE__ */
|
|
52589
|
+
refs.length === 0 ? /* @__PURE__ */ jsx170("span", { className: "text-xs text-muted-foreground", children: "\u2014" }) : /* @__PURE__ */ jsx170("ul", { className: "flex min-w-0 flex-col gap-1", children: refs.map((ref) => /* @__PURE__ */ jsx170("li", { className: "min-w-0", children: /* @__PURE__ */ jsx170(ReferenceChip, { reference: ref }) }, ref.id)) })
|
|
52481
52590
|
] }, field2.id);
|
|
52482
52591
|
})
|
|
52483
52592
|
] });
|
|
@@ -52486,16 +52595,16 @@ function RecordAsk({ tableId, recordId }) {
|
|
|
52486
52595
|
const host = useRecordsUi();
|
|
52487
52596
|
const [open, setOpen] = useState144(false);
|
|
52488
52597
|
if (!host.chat) return null;
|
|
52489
|
-
return /* @__PURE__ */
|
|
52490
|
-
/* @__PURE__ */
|
|
52491
|
-
open ? /* @__PURE__ */
|
|
52598
|
+
return /* @__PURE__ */ jsxs158("section", { className: "flex min-w-0 flex-col gap-1.5", "data-record-ask": open ? "open" : "", children: [
|
|
52599
|
+
/* @__PURE__ */ jsx170(Separator13, {}),
|
|
52600
|
+
open ? /* @__PURE__ */ jsx170(RecordChat, { tableId, recordId, className: "min-h-[22rem]" }) : /* @__PURE__ */ jsx170(Button115, { size: "sm", variant: "outline", className: "self-start", onClick: () => setOpen(true), "data-record-ask-open": "", children: "Ask about this record" })
|
|
52492
52601
|
] });
|
|
52493
52602
|
}
|
|
52494
52603
|
|
|
52495
52604
|
// src/breakDown.tsx
|
|
52496
52605
|
import { useMemo as useMemo79, useState as useState145 } from "react";
|
|
52497
52606
|
import {
|
|
52498
|
-
Button as
|
|
52607
|
+
Button as Button116,
|
|
52499
52608
|
Dialog as Dialog18,
|
|
52500
52609
|
DialogContent as DialogContent18,
|
|
52501
52610
|
DialogHeader as DialogHeader18,
|
|
@@ -52506,7 +52615,7 @@ import {
|
|
|
52506
52615
|
SelectTrigger as SelectTrigger20,
|
|
52507
52616
|
SelectValue as SelectValue20
|
|
52508
52617
|
} from "@ai-matrx/design-system";
|
|
52509
|
-
import { jsx as
|
|
52618
|
+
import { jsx as jsx171, jsxs as jsxs159 } from "react/jsx-runtime";
|
|
52510
52619
|
var BREAK_DOWN_ACTION_ID = "break-down";
|
|
52511
52620
|
var NO_DIMENSION_REASON = "No column to break down by";
|
|
52512
52621
|
function breakDownAction(args) {
|
|
@@ -52535,14 +52644,14 @@ function BreakDownDialog({
|
|
|
52535
52644
|
const dimensions = useMemo79(() => drillDimensionsOf(def, NO_LABELS), [def]);
|
|
52536
52645
|
const [picked, setPicked] = useState145(null);
|
|
52537
52646
|
const key = picked ?? held?.field ?? dimensions[0]?.key ?? "";
|
|
52538
|
-
return /* @__PURE__ */
|
|
52539
|
-
/* @__PURE__ */
|
|
52540
|
-
/* @__PURE__ */
|
|
52541
|
-
/* @__PURE__ */
|
|
52542
|
-
/* @__PURE__ */
|
|
52647
|
+
return /* @__PURE__ */ jsx171(Dialog18, { open, onOpenChange, children: /* @__PURE__ */ jsxs159(DialogContent18, { "data-break-down": "", className: "max-w-sm", children: [
|
|
52648
|
+
/* @__PURE__ */ jsx171(DialogHeader18, { children: /* @__PURE__ */ jsx171(DialogTitle18, { children: "Break down by" }) }),
|
|
52649
|
+
/* @__PURE__ */ jsxs159(Select28, { value: key, onValueChange: setPicked, children: [
|
|
52650
|
+
/* @__PURE__ */ jsx171(SelectTrigger20, { "aria-label": "Column to break down by", "data-break-down-select": "", children: /* @__PURE__ */ jsx171(SelectValue20, { placeholder: def ? NO_DIMENSION_REASON : "Reading this table\u2026" }) }),
|
|
52651
|
+
/* @__PURE__ */ jsx171(SelectContent20, { children: dimensions.map((d) => /* @__PURE__ */ jsx171(SelectItem20, { value: d.key, children: d.label }, d.key)) })
|
|
52543
52652
|
] }),
|
|
52544
|
-
/* @__PURE__ */
|
|
52545
|
-
|
|
52653
|
+
/* @__PURE__ */ jsx171(
|
|
52654
|
+
Button116,
|
|
52546
52655
|
{
|
|
52547
52656
|
type: "button",
|
|
52548
52657
|
"data-break-down-apply": "",
|
|
@@ -52562,8 +52671,8 @@ function BreakDownDialog({
|
|
|
52562
52671
|
import { copyText as copyText14 } from "@ai-matrx/kit/clipboard";
|
|
52563
52672
|
import { useCallback as useCallback69, useMemo as useMemo80, useState as useState146 } from "react";
|
|
52564
52673
|
import { useContentTransferCapabilities as useContentTransferCapabilities2 } from "@ai-matrx/alchemy/react/workspace";
|
|
52565
|
-
import { Button as
|
|
52566
|
-
import { jsx as
|
|
52674
|
+
import { Button as Button117, Dialog as Dialog19, DialogContent as DialogContent19, DialogHeader as DialogHeader19, DialogTitle as DialogTitle19 } from "@ai-matrx/design-system";
|
|
52675
|
+
import { jsx as jsx172, jsxs as jsxs160 } from "react/jsx-runtime";
|
|
52567
52676
|
function tableReferenceChoices(tableId, name) {
|
|
52568
52677
|
return [
|
|
52569
52678
|
{
|
|
@@ -52606,11 +52715,11 @@ function TableReferenceDialog({
|
|
|
52606
52715
|
},
|
|
52607
52716
|
[port, notify]
|
|
52608
52717
|
);
|
|
52609
|
-
return /* @__PURE__ */
|
|
52610
|
-
/* @__PURE__ */
|
|
52611
|
-
/* @__PURE__ */
|
|
52612
|
-
/* @__PURE__ */
|
|
52613
|
-
/* @__PURE__ */
|
|
52718
|
+
return /* @__PURE__ */ jsx172(Dialog19, { open, onOpenChange, children: /* @__PURE__ */ jsxs160(DialogContent19, { className: "sm:max-w-sm", "data-table-reference": "", children: [
|
|
52719
|
+
/* @__PURE__ */ jsx172(DialogHeader19, { children: /* @__PURE__ */ jsx172(DialogTitle19, { children: "Get reference" }) }),
|
|
52720
|
+
/* @__PURE__ */ jsx172("div", { className: "flex flex-col gap-2", children: choices.map((choice) => /* @__PURE__ */ jsxs160("div", { className: "flex items-center justify-between gap-3 rounded-md border px-3 py-2", children: [
|
|
52721
|
+
/* @__PURE__ */ jsx172("span", { className: "text-sm", children: choice.label }),
|
|
52722
|
+
/* @__PURE__ */ jsx172(Button117, { size: "sm", variant: "outline", onClick: () => void copy(choice), "data-table-reference-copy": choice.id, children: copied === choice.id ? "Copied" : "Copy" })
|
|
52614
52723
|
] }, choice.id)) })
|
|
52615
52724
|
] }) });
|
|
52616
52725
|
}
|
|
@@ -52619,8 +52728,8 @@ function TableReferenceDialog({
|
|
|
52619
52728
|
import { formatCount as formatCount7 } from "@ai-matrx/kit/format";
|
|
52620
52729
|
import { useState as useState147 } from "react";
|
|
52621
52730
|
import { tableShapeChanged as tableShapeChanged14, useRecordsClient as useRecordsClient105 } from "@ai-matrx/records/react";
|
|
52622
|
-
import { Button as
|
|
52623
|
-
import { Fragment as Fragment70, jsx as
|
|
52731
|
+
import { Button as Button118, Dialog as Dialog20, DialogContent as DialogContent20, DialogFooter as DialogFooter13, DialogHeader as DialogHeader20, DialogTitle as DialogTitle20, ErrorBox as ErrorBox8, Input as Input11, Switch as Switch7 } from "@ai-matrx/design-system";
|
|
52732
|
+
import { Fragment as Fragment70, jsx as jsx173, jsxs as jsxs161 } from "react/jsx-runtime";
|
|
52624
52733
|
function copyNameFor(name) {
|
|
52625
52734
|
return `${name.trim() || "Table"} (copy)`;
|
|
52626
52735
|
}
|
|
@@ -52668,13 +52777,13 @@ function TableDuplicateDialog({ tableId, name, open, onOpenChange, onDuplicated
|
|
|
52668
52777
|
if (onDuplicated) onDuplicated(copy);
|
|
52669
52778
|
else if (typeof window !== "undefined") window.location.assign(copy.path);
|
|
52670
52779
|
};
|
|
52671
|
-
return /* @__PURE__ */
|
|
52672
|
-
/* @__PURE__ */
|
|
52780
|
+
return /* @__PURE__ */ jsx173(Dialog20, { open, onOpenChange: close, children: /* @__PURE__ */ jsxs161(DialogContent20, { className: "sm:max-w-md", "data-table-duplicate": tableId, children: [
|
|
52781
|
+
/* @__PURE__ */ jsx173(DialogHeader20, { children: /* @__PURE__ */ jsxs161(DialogTitle20, { children: [
|
|
52673
52782
|
"Duplicate ",
|
|
52674
52783
|
name || "table"
|
|
52675
52784
|
] }) }),
|
|
52676
|
-
phase.kind === "done" ? /* @__PURE__ */
|
|
52677
|
-
/* @__PURE__ */
|
|
52785
|
+
phase.kind === "done" ? /* @__PURE__ */ jsxs161("div", { className: "flex flex-col gap-1.5 text-sm", "data-table-duplicate-done": "", children: [
|
|
52786
|
+
/* @__PURE__ */ jsxs161("p", { children: [
|
|
52678
52787
|
phase.copy.table.name,
|
|
52679
52788
|
": ",
|
|
52680
52789
|
phase.copy.copied.fields,
|
|
@@ -52684,13 +52793,13 @@ function TableDuplicateDialog({ tableId, name, open, onOpenChange, onDuplicated
|
|
|
52684
52793
|
phase.copy.copied.withRecords ? `, ${formatCount7(phase.copy.copied.records)} records` : "",
|
|
52685
52794
|
"."
|
|
52686
52795
|
] }),
|
|
52687
|
-
phase.copy.notCopied.length > 0 ? /* @__PURE__ */
|
|
52796
|
+
phase.copy.notCopied.length > 0 ? /* @__PURE__ */ jsxs161("p", { className: "text-xs text-muted-foreground", children: [
|
|
52688
52797
|
"Not copied: ",
|
|
52689
52798
|
phase.copy.notCopied.join(", "),
|
|
52690
52799
|
"."
|
|
52691
52800
|
] }) : null
|
|
52692
|
-
] }) : /* @__PURE__ */
|
|
52693
|
-
/* @__PURE__ */
|
|
52801
|
+
] }) : /* @__PURE__ */ jsxs161("div", { className: "flex flex-col gap-3 text-sm", children: [
|
|
52802
|
+
/* @__PURE__ */ jsx173(
|
|
52694
52803
|
Input11,
|
|
52695
52804
|
{
|
|
52696
52805
|
autoFocus: true,
|
|
@@ -52703,26 +52812,26 @@ function TableDuplicateDialog({ tableId, name, open, onOpenChange, onDuplicated
|
|
|
52703
52812
|
}
|
|
52704
52813
|
}
|
|
52705
52814
|
),
|
|
52706
|
-
/* @__PURE__ */
|
|
52707
|
-
/* @__PURE__ */
|
|
52708
|
-
/* @__PURE__ */
|
|
52815
|
+
/* @__PURE__ */ jsxs161("label", { className: "flex items-center justify-between gap-2", children: [
|
|
52816
|
+
/* @__PURE__ */ jsx173("span", { children: "Copy its records" }),
|
|
52817
|
+
/* @__PURE__ */ jsx173(Switch7, { checked: withRecords, disabled: copying, onCheckedChange: setWithRecords, "aria-label": "Copy its records" })
|
|
52709
52818
|
] }),
|
|
52710
|
-
phase.kind === "copying" ? /* @__PURE__ */
|
|
52711
|
-
phase.kind === "refused" ? /* @__PURE__ */
|
|
52712
|
-
problem && typed2 !== "" ? /* @__PURE__ */
|
|
52819
|
+
phase.kind === "copying" ? /* @__PURE__ */ jsx173("p", { className: "text-xs text-muted-foreground", "data-table-duplicate-progress": "", children: phase.progress ? duplicateProgressWords(phase.progress) : "Starting the copy\u2026" }) : null,
|
|
52820
|
+
phase.kind === "refused" ? /* @__PURE__ */ jsx173(ErrorBox8, { children: phase.sentence }) : null,
|
|
52821
|
+
problem && typed2 !== "" ? /* @__PURE__ */ jsx173("p", { className: "text-xs text-muted-foreground", children: problem }) : null
|
|
52713
52822
|
] }),
|
|
52714
|
-
/* @__PURE__ */
|
|
52715
|
-
/* @__PURE__ */
|
|
52716
|
-
/* @__PURE__ */
|
|
52823
|
+
/* @__PURE__ */ jsx173(DialogFooter13, { children: phase.kind === "done" ? /* @__PURE__ */ jsx173(Button118, { onClick: () => openCopy(phase.copy), "data-table-duplicate-open": "", children: "Open the copy" }) : /* @__PURE__ */ jsxs161(Fragment70, { children: [
|
|
52824
|
+
/* @__PURE__ */ jsx173(Button118, { variant: "ghost", disabled: copying, onClick: () => close(false), children: "Cancel" }),
|
|
52825
|
+
/* @__PURE__ */ jsx173(Button118, { disabled: copying || problem !== null, onClick: () => void go(), children: copying ? "Duplicating\u2026" : "Duplicate" })
|
|
52717
52826
|
] }) })
|
|
52718
52827
|
] }) });
|
|
52719
52828
|
}
|
|
52720
52829
|
|
|
52721
52830
|
// src/ViewFilter.tsx
|
|
52722
52831
|
import { useEffect as useEffect122, useMemo as useMemo81, useState as useState148 } from "react";
|
|
52723
|
-
import { Button as
|
|
52832
|
+
import { Button as Button119, Popover as Popover19, PopoverContent as PopoverContent19, PopoverTrigger as PopoverTrigger19 } from "@ai-matrx/design-system";
|
|
52724
52833
|
import { useFields as useFields38 } from "@ai-matrx/records/react";
|
|
52725
|
-
import { jsx as
|
|
52834
|
+
import { jsx as jsx174, jsxs as jsxs162 } from "react/jsx-runtime";
|
|
52726
52835
|
function conditionCount(expr) {
|
|
52727
52836
|
if (!expr || typeof expr !== "object" || Array.isArray(expr)) return 0;
|
|
52728
52837
|
const node = expr;
|
|
@@ -52750,7 +52859,7 @@ function ViewFilter({ tableId, view, onApply, className }) {
|
|
|
52750
52859
|
return (
|
|
52751
52860
|
// THE BUILDER FLOATS OVER THE TABLE (STABLE-TABLES; Notion's filter popover): drawn inside the
|
|
52752
52861
|
// toolbar row it grew the row and pushed the whole table down (0.13 + 0.13 layout shift).
|
|
52753
|
-
/* @__PURE__ */
|
|
52862
|
+
/* @__PURE__ */ jsxs162(
|
|
52754
52863
|
Popover19,
|
|
52755
52864
|
{
|
|
52756
52865
|
open,
|
|
@@ -52759,8 +52868,8 @@ function ViewFilter({ tableId, view, onApply, className }) {
|
|
|
52759
52868
|
setOpen(next);
|
|
52760
52869
|
},
|
|
52761
52870
|
children: [
|
|
52762
|
-
/* @__PURE__ */
|
|
52763
|
-
|
|
52871
|
+
/* @__PURE__ */ jsx174(PopoverTrigger19, { asChild: true, children: /* @__PURE__ */ jsx174(
|
|
52872
|
+
Button119,
|
|
52764
52873
|
{
|
|
52765
52874
|
size: "sm",
|
|
52766
52875
|
variant: open || count > 0 ? "secondary" : "ghost",
|
|
@@ -52771,17 +52880,17 @@ function ViewFilter({ tableId, view, onApply, className }) {
|
|
|
52771
52880
|
children: count > 0 ? `Filter \xB7 ${count}` : "Filter"
|
|
52772
52881
|
}
|
|
52773
52882
|
) }),
|
|
52774
|
-
/* @__PURE__ */
|
|
52883
|
+
/* @__PURE__ */ jsx174(PopoverContent19, { sizing: "content", align: "start", className: "w-auto max-w-[min(42rem,calc(100vw-2rem))] p-2", children: /* @__PURE__ */ jsxs162(
|
|
52775
52884
|
"div",
|
|
52776
52885
|
{
|
|
52777
52886
|
className: "flex flex-col gap-2 text-xs",
|
|
52778
52887
|
"data-testid": "view-filter-panel",
|
|
52779
52888
|
children: [
|
|
52780
|
-
view.ruleId ? /* @__PURE__ */
|
|
52889
|
+
view.ruleId ? /* @__PURE__ */ jsx174("p", { className: "text-muted-foreground", children: "This view's records are chosen by a membership Rule, and the store answers it. Change the Rule to change who is in this view." }) : !conditionIsDrawable(saved) ? /* @__PURE__ */ jsxs162("p", { className: "text-muted-foreground", children: [
|
|
52781
52890
|
"This view asks: ",
|
|
52782
52891
|
conditionInWords(saved, conditionFields),
|
|
52783
52892
|
". It cannot be drawn here; clear it to start a new filter."
|
|
52784
|
-
] }) : /* @__PURE__ */
|
|
52893
|
+
] }) : /* @__PURE__ */ jsx174(FilterTermsContext.Provider, { value: true, children: /* @__PURE__ */ jsx174(
|
|
52785
52894
|
ConditionGroup,
|
|
52786
52895
|
{
|
|
52787
52896
|
lead: "Show records where",
|
|
@@ -52791,9 +52900,9 @@ function ViewFilter({ tableId, view, onApply, className }) {
|
|
|
52791
52900
|
onChange: setDraft
|
|
52792
52901
|
}
|
|
52793
52902
|
) }),
|
|
52794
|
-
view.ruleId ? null : /* @__PURE__ */
|
|
52795
|
-
changed2 ? /* @__PURE__ */
|
|
52796
|
-
|
|
52903
|
+
view.ruleId ? null : /* @__PURE__ */ jsxs162("div", { className: "flex items-center gap-1", children: [
|
|
52904
|
+
changed2 ? /* @__PURE__ */ jsx174(
|
|
52905
|
+
Button119,
|
|
52797
52906
|
{
|
|
52798
52907
|
size: "sm",
|
|
52799
52908
|
"data-testid": "view-filter-apply",
|
|
@@ -52804,8 +52913,8 @@ function ViewFilter({ tableId, view, onApply, className }) {
|
|
|
52804
52913
|
children: "Apply"
|
|
52805
52914
|
}
|
|
52806
52915
|
) : null,
|
|
52807
|
-
count > 0 || draft ? /* @__PURE__ */
|
|
52808
|
-
|
|
52916
|
+
count > 0 || draft ? /* @__PURE__ */ jsx174(
|
|
52917
|
+
Button119,
|
|
52809
52918
|
{
|
|
52810
52919
|
size: "sm",
|
|
52811
52920
|
variant: "ghost",
|
|
@@ -52818,7 +52927,7 @@ function ViewFilter({ tableId, view, onApply, className }) {
|
|
|
52818
52927
|
children: "Clear filter"
|
|
52819
52928
|
}
|
|
52820
52929
|
) : null,
|
|
52821
|
-
/* @__PURE__ */
|
|
52930
|
+
/* @__PURE__ */ jsx174(Button119, { size: "sm", variant: "ghost", onClick: () => {
|
|
52822
52931
|
setDraft(saved);
|
|
52823
52932
|
setOpen(false);
|
|
52824
52933
|
}, children: "Cancel" })
|
|
@@ -52834,10 +52943,10 @@ function ViewFilter({ tableId, view, onApply, className }) {
|
|
|
52834
52943
|
|
|
52835
52944
|
// src/PhoneTableActions.tsx
|
|
52836
52945
|
import { DropdownMenu as DropdownMenu9, DropdownMenuContent as DropdownMenuContent9, DropdownMenuTrigger as DropdownMenuTrigger9, cn as cn99 } from "@ai-matrx/design-system";
|
|
52837
|
-
import { jsx as
|
|
52946
|
+
import { jsx as jsx175, jsxs as jsxs163 } from "react/jsx-runtime";
|
|
52838
52947
|
function PhoneActionRow({ action: action3, groupStart }) {
|
|
52839
52948
|
const disabled = action3.disabledReason !== void 0;
|
|
52840
|
-
return /* @__PURE__ */
|
|
52949
|
+
return /* @__PURE__ */ jsxs163(
|
|
52841
52950
|
"button",
|
|
52842
52951
|
{
|
|
52843
52952
|
type: "button",
|
|
@@ -52853,10 +52962,10 @@ function PhoneActionRow({ action: action3, groupStart }) {
|
|
|
52853
52962
|
action3.destructive && "text-destructive"
|
|
52854
52963
|
),
|
|
52855
52964
|
children: [
|
|
52856
|
-
/* @__PURE__ */
|
|
52857
|
-
/* @__PURE__ */
|
|
52858
|
-
/* @__PURE__ */
|
|
52859
|
-
disabled ? /* @__PURE__ */
|
|
52965
|
+
/* @__PURE__ */ jsx175(ObjectActionGlyph, { name: action3.icon, className: "h-5 w-5 shrink-0" }),
|
|
52966
|
+
/* @__PURE__ */ jsxs163("span", { className: "flex min-w-0 flex-col", children: [
|
|
52967
|
+
/* @__PURE__ */ jsx175("span", { className: "truncate", children: action3.label }),
|
|
52968
|
+
disabled ? /* @__PURE__ */ jsx175("span", { className: "truncate text-xs text-muted-foreground", "data-object-action-reason": "", children: action3.disabledReason }) : null
|
|
52860
52969
|
] })
|
|
52861
52970
|
]
|
|
52862
52971
|
}
|
|
@@ -52864,20 +52973,20 @@ function PhoneActionRow({ action: action3, groupStart }) {
|
|
|
52864
52973
|
}
|
|
52865
52974
|
PhoneActionRow.routeHeaderMenu = true;
|
|
52866
52975
|
function PhoneSubmenu({ label, icon, actions }) {
|
|
52867
|
-
return /* @__PURE__ */
|
|
52868
|
-
/* @__PURE__ */
|
|
52976
|
+
return /* @__PURE__ */ jsxs163(DropdownMenu9, { children: [
|
|
52977
|
+
/* @__PURE__ */ jsx175(DropdownMenuTrigger9, { asChild: true, children: /* @__PURE__ */ jsxs163(
|
|
52869
52978
|
"button",
|
|
52870
52979
|
{
|
|
52871
52980
|
type: "button",
|
|
52872
52981
|
"data-object-action-group": "built-on",
|
|
52873
52982
|
className: "flex min-h-11 w-full items-center gap-3 border-t border-border px-1 pt-1 text-left text-base",
|
|
52874
52983
|
children: [
|
|
52875
|
-
icon ? /* @__PURE__ */
|
|
52876
|
-
/* @__PURE__ */
|
|
52984
|
+
icon ? /* @__PURE__ */ jsx175(ObjectActionGlyph, { name: icon, className: "h-5 w-5 shrink-0" }) : null,
|
|
52985
|
+
/* @__PURE__ */ jsx175("span", { className: "truncate", children: label })
|
|
52877
52986
|
]
|
|
52878
52987
|
}
|
|
52879
52988
|
) }),
|
|
52880
|
-
/* @__PURE__ */
|
|
52989
|
+
/* @__PURE__ */ jsx175(DropdownMenuContent9, { align: "end", className: "w-64", children: /* @__PURE__ */ jsx175(ObjectActionMenuItems, { actions: actions.map((a) => ({ ...a, group: "manage" })) }) })
|
|
52881
52990
|
] });
|
|
52882
52991
|
}
|
|
52883
52992
|
PhoneSubmenu.routeHeaderMenu = true;
|
|
@@ -52890,13 +52999,13 @@ function phoneTableActions(actions) {
|
|
|
52890
52999
|
continue;
|
|
52891
53000
|
}
|
|
52892
53001
|
if (entry.kind === "submenu") {
|
|
52893
|
-
out.push(/* @__PURE__ */
|
|
53002
|
+
out.push(/* @__PURE__ */ jsx175(PhoneSubmenu, { label: entry.label, icon: entry.icon, actions: entry.actions }, `phone-group-${entry.id}`));
|
|
52894
53003
|
groupStart = false;
|
|
52895
53004
|
continue;
|
|
52896
53005
|
}
|
|
52897
53006
|
const a = entry.action;
|
|
52898
53007
|
out.push(
|
|
52899
|
-
/* @__PURE__ */
|
|
53008
|
+
/* @__PURE__ */ jsx175(
|
|
52900
53009
|
PhoneActionRow,
|
|
52901
53010
|
{
|
|
52902
53011
|
action: a,
|
|
@@ -53122,7 +53231,7 @@ function useSlotScroll(slot) {
|
|
|
53122
53231
|
// src/TablePage.tsx
|
|
53123
53232
|
import { isUuidShape as isUuidShape3 } from "@ai-matrx/kit/uuid";
|
|
53124
53233
|
import { openOutbound as openOutbound4 } from "@ai-matrx/kit/outbound";
|
|
53125
|
-
import { Fragment as Fragment71, jsx as
|
|
53234
|
+
import { Fragment as Fragment71, jsx as jsx176, jsxs as jsxs164 } from "react/jsx-runtime";
|
|
53126
53235
|
var RAIL_TITLE = {
|
|
53127
53236
|
settings: "Table settings",
|
|
53128
53237
|
inbox: "Inbox",
|
|
@@ -53139,20 +53248,21 @@ var RAIL_TITLE = {
|
|
|
53139
53248
|
export: "Export"
|
|
53140
53249
|
};
|
|
53141
53250
|
function LookGlyph() {
|
|
53142
|
-
return /* @__PURE__ */
|
|
53143
|
-
/* @__PURE__ */
|
|
53144
|
-
/* @__PURE__ */
|
|
53145
|
-
/* @__PURE__ */
|
|
53251
|
+
return /* @__PURE__ */ jsxs164("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", width: "14", height: "14", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
53252
|
+
/* @__PURE__ */ jsx176("path", { d: "M4 7h10M18 7h2M4 17h2M10 17h10" }),
|
|
53253
|
+
/* @__PURE__ */ jsx176("circle", { cx: "16", cy: "7", r: "2" }),
|
|
53254
|
+
/* @__PURE__ */ jsx176("circle", { cx: "8", cy: "17", r: "2" })
|
|
53146
53255
|
] });
|
|
53147
53256
|
}
|
|
53148
53257
|
function RailFrame({
|
|
53149
53258
|
phone,
|
|
53150
53259
|
title,
|
|
53151
53260
|
onClose,
|
|
53261
|
+
over = false,
|
|
53152
53262
|
children
|
|
53153
53263
|
}) {
|
|
53154
53264
|
if (phone) {
|
|
53155
|
-
return /* @__PURE__ */
|
|
53265
|
+
return /* @__PURE__ */ jsx176(
|
|
53156
53266
|
BottomSheet,
|
|
53157
53267
|
{
|
|
53158
53268
|
open: true,
|
|
@@ -53162,11 +53272,19 @@ function RailFrame({
|
|
|
53162
53272
|
title,
|
|
53163
53273
|
size: "full",
|
|
53164
53274
|
surface: "solid",
|
|
53165
|
-
children: /* @__PURE__ */
|
|
53275
|
+
children: /* @__PURE__ */ jsx176("div", { "data-rail-sheet": "", className: "min-h-0 flex-1 overflow-y-auto px-3 pb-6", children })
|
|
53166
53276
|
}
|
|
53167
53277
|
);
|
|
53168
53278
|
}
|
|
53169
|
-
return /* @__PURE__ */
|
|
53279
|
+
return /* @__PURE__ */ jsx176(
|
|
53280
|
+
"aside",
|
|
53281
|
+
{
|
|
53282
|
+
"data-rail-column": "",
|
|
53283
|
+
"data-rail-over": over ? "" : void 0,
|
|
53284
|
+
className: over ? "w-[26rem] shrink-0" : "w-[26rem] shrink-0 overflow-y-auto rounded-md border p-3",
|
|
53285
|
+
children: over ? /* @__PURE__ */ jsx176("div", { className: "fixed inset-y-0 right-0 z-40 w-[min(48rem,100vw)] overflow-y-auto border-l bg-background p-4 shadow-xl", children }) : children
|
|
53286
|
+
}
|
|
53287
|
+
);
|
|
53170
53288
|
}
|
|
53171
53289
|
function filterInWords(filter, fields) {
|
|
53172
53290
|
const nameOf2 = (key) => {
|
|
@@ -53219,17 +53337,17 @@ function TableNotHere({
|
|
|
53219
53337
|
alive = false;
|
|
53220
53338
|
};
|
|
53221
53339
|
}, [client, tableId]);
|
|
53222
|
-
if (archived.phase === "asking") return /* @__PURE__ */
|
|
53340
|
+
if (archived.phase === "asking") return /* @__PURE__ */ jsx176(Skeleton47, { className: "h-40 w-full" });
|
|
53223
53341
|
const row = archived.phase === "answered" ? archived.row : null;
|
|
53224
53342
|
if (row) {
|
|
53225
|
-
return /* @__PURE__ */
|
|
53226
|
-
/* @__PURE__ */
|
|
53227
|
-
/* @__PURE__ */
|
|
53228
|
-
/* @__PURE__ */
|
|
53229
|
-
refusal3 ? /* @__PURE__ */
|
|
53230
|
-
/* @__PURE__ */
|
|
53231
|
-
/* @__PURE__ */
|
|
53232
|
-
|
|
53343
|
+
return /* @__PURE__ */ jsxs164("div", { className: cn100("flex flex-col items-start gap-2 rounded-md border border-dashed p-6", className), children: [
|
|
53344
|
+
/* @__PURE__ */ jsx176("p", { className: "text-sm font-medium", children: "This table is archived" }),
|
|
53345
|
+
/* @__PURE__ */ jsx176("p", { className: "max-w-prose text-xs text-muted-foreground", children: TABLE_IS_ARCHIVED }),
|
|
53346
|
+
/* @__PURE__ */ jsx176("p", { className: "text-xs text-muted-foreground", children: archivedByLine2(row) }),
|
|
53347
|
+
refusal3 ? /* @__PURE__ */ jsx176(RefusalNotice, { error: refusal3 }) : null,
|
|
53348
|
+
/* @__PURE__ */ jsxs164("div", { className: "flex gap-2", children: [
|
|
53349
|
+
/* @__PURE__ */ jsx176(
|
|
53350
|
+
Button120,
|
|
53233
53351
|
{
|
|
53234
53352
|
size: "sm",
|
|
53235
53353
|
disabled: restoring,
|
|
@@ -53247,14 +53365,14 @@ function TableNotHere({
|
|
|
53247
53365
|
children: restoring ? "Bringing it back\u2026" : "Bring it back"
|
|
53248
53366
|
}
|
|
53249
53367
|
),
|
|
53250
|
-
onLeave ? /* @__PURE__ */
|
|
53368
|
+
onLeave ? /* @__PURE__ */ jsx176(Button120, { size: "sm", variant: "outline", onClick: onLeave, children: leaveLabel }) : null
|
|
53251
53369
|
] })
|
|
53252
53370
|
] });
|
|
53253
53371
|
}
|
|
53254
|
-
return /* @__PURE__ */
|
|
53255
|
-
/* @__PURE__ */
|
|
53256
|
-
/* @__PURE__ */
|
|
53257
|
-
onLeave ? /* @__PURE__ */
|
|
53372
|
+
return /* @__PURE__ */ jsxs164("div", { className: cn100("flex flex-col items-start gap-2 rounded-md border border-dashed p-6", className), children: [
|
|
53373
|
+
/* @__PURE__ */ jsx176("p", { className: "text-sm font-medium", children: "This table is not here" }),
|
|
53374
|
+
/* @__PURE__ */ jsx176("p", { className: "max-w-prose text-xs text-muted-foreground", children: TABLE_NOT_REACHABLE }),
|
|
53375
|
+
onLeave ? /* @__PURE__ */ jsx176(Button120, { size: "sm", variant: "outline", onClick: onLeave, children: leaveLabel }) : null
|
|
53258
53376
|
] });
|
|
53259
53377
|
}
|
|
53260
53378
|
var TABLE_NOT_REACHABLE = (
|
|
@@ -53388,6 +53506,7 @@ function TablePage({
|
|
|
53388
53506
|
leaveLabel = "Back to your tables",
|
|
53389
53507
|
activeDashboardId,
|
|
53390
53508
|
activeRecordId,
|
|
53509
|
+
onRecordChange,
|
|
53391
53510
|
activeView,
|
|
53392
53511
|
onViewChanged,
|
|
53393
53512
|
activeGroupField,
|
|
@@ -53572,11 +53691,30 @@ function TablePage({
|
|
|
53572
53691
|
onViewChanged?.(addressForView(view, next));
|
|
53573
53692
|
void patchView({ layout: next });
|
|
53574
53693
|
};
|
|
53694
|
+
const reportedRecords = useRef64(/* @__PURE__ */ new Set());
|
|
53695
|
+
const lastActiveRecord = useRef64(activeRecordId ?? null);
|
|
53575
53696
|
useEffect124(() => {
|
|
53576
|
-
|
|
53697
|
+
const before = lastActiveRecord.current;
|
|
53698
|
+
lastActiveRecord.current = activeRecordId ?? null;
|
|
53699
|
+
if (!activeRecordId) {
|
|
53700
|
+
if (before) setSurface((now) => now.rail === "record" ? { ...now, rail: "none" } : now);
|
|
53701
|
+
return;
|
|
53702
|
+
}
|
|
53703
|
+
if (reportedRecords.current.delete(activeRecordId)) return;
|
|
53577
53704
|
setOpenRecord(activeRecordId);
|
|
53578
53705
|
setSurface((now) => ({ ...now, rail: "record" }));
|
|
53579
53706
|
}, [activeRecordId]);
|
|
53707
|
+
const [shownIds, setShownIds] = useState150([]);
|
|
53708
|
+
const [recordExpanded, setRecordExpanded] = useState150(false);
|
|
53709
|
+
const shownRecord = rail === "record" ? openRecord : null;
|
|
53710
|
+
const reportedRecord = useRef64(activeRecordId ?? null);
|
|
53711
|
+
useEffect124(() => {
|
|
53712
|
+
if (shownRecord === reportedRecord.current) return;
|
|
53713
|
+
const how = shownRecord === null ? "close" : reportedRecord.current === null ? "open" : "step";
|
|
53714
|
+
reportedRecord.current = shownRecord;
|
|
53715
|
+
if (shownRecord) reportedRecords.current.add(shownRecord);
|
|
53716
|
+
onRecordChange?.(shownRecord, how);
|
|
53717
|
+
}, [shownRecord, onRecordChange]);
|
|
53580
53718
|
useEffect124(() => {
|
|
53581
53719
|
if (activeRecordId) return;
|
|
53582
53720
|
const named = railFromParam(activeRail);
|
|
@@ -53763,20 +53901,20 @@ function TablePage({
|
|
|
53763
53901
|
};
|
|
53764
53902
|
const footer = footerOf(shown5?.presentation);
|
|
53765
53903
|
const setFooter = (next) => void patchView({ presentation: { ...shown5?.presentation ?? {}, footer: next } });
|
|
53766
|
-
const layoutRadio = /* @__PURE__ */
|
|
53904
|
+
const layoutRadio = /* @__PURE__ */ jsx176(
|
|
53767
53905
|
DropdownMenuRadioGroup3,
|
|
53768
53906
|
{
|
|
53769
53907
|
value: layoutShowing ?? "",
|
|
53770
53908
|
onValueChange: (value) => {
|
|
53771
53909
|
if (VIEW_LAYOUTS.includes(value)) pickLayout(value);
|
|
53772
53910
|
},
|
|
53773
|
-
children: VIEW_LAYOUTS.map((option) => /* @__PURE__ */
|
|
53911
|
+
children: VIEW_LAYOUTS.map((option) => /* @__PURE__ */ jsx176(DropdownMenuRadioItem3, { value: option, children: LAYOUT_LABEL[option] }, option))
|
|
53774
53912
|
}
|
|
53775
53913
|
);
|
|
53776
|
-
const sheetExtras = controlsInSheet && main === "records" && shownLayout === "grid" ? /* @__PURE__ */
|
|
53777
|
-
/* @__PURE__ */
|
|
53778
|
-
/* @__PURE__ */
|
|
53779
|
-
|
|
53914
|
+
const sheetExtras = controlsInSheet && main === "records" && shownLayout === "grid" ? /* @__PURE__ */ jsxs164(Fragment71, { children: [
|
|
53915
|
+
/* @__PURE__ */ jsx176("div", { className: "flex items-center gap-2 text-xs", "data-table-sheet-filter": "", "data-matrx-table-tools-keep-open": "", children: /* @__PURE__ */ jsx176(ViewFilter, { tableId, view: shown5, onApply: (where) => void patchView({ where }) }) }),
|
|
53916
|
+
/* @__PURE__ */ jsx176("div", { role: "group", "aria-label": "Layout", className: "flex flex-wrap gap-1 pt-1", "data-table-sheet-layout": "", children: VIEW_LAYOUTS.map((option) => /* @__PURE__ */ jsx176(
|
|
53917
|
+
Button120,
|
|
53780
53918
|
{
|
|
53781
53919
|
size: "sm",
|
|
53782
53920
|
variant: layoutShowing === option ? "secondary" : "ghost",
|
|
@@ -53787,7 +53925,7 @@ function TablePage({
|
|
|
53787
53925
|
},
|
|
53788
53926
|
option
|
|
53789
53927
|
)) }),
|
|
53790
|
-
rights.share && canShare ? /* @__PURE__ */
|
|
53928
|
+
rights.share && canShare ? /* @__PURE__ */ jsx176(Button120, { size: "sm", variant: "ghost", className: "h-8", onClick: () => setShareAsked((n) => n + 1), "data-table-sheet-share": "", children: "Share\u2026" }) : null
|
|
53791
53929
|
] }) : void 0;
|
|
53792
53930
|
const go = (pressed) => {
|
|
53793
53931
|
if (!surfaceChosen(surface, pressed)) press(pressed);
|
|
@@ -53993,9 +54131,9 @@ function TablePage({
|
|
|
53993
54131
|
return () => window.removeEventListener("keydown", onKey);
|
|
53994
54132
|
}, [recordsUi]);
|
|
53995
54133
|
const openedFromMenu = openedEntry ? { ...openedEntry, label: actions.find((a) => a.id === openedEntry.id)?.label ?? openedEntry.key } : null;
|
|
53996
|
-
const pageActions = /* @__PURE__ */
|
|
53997
|
-
publicReadOnly ? /* @__PURE__ */
|
|
53998
|
-
!phone && rights.read && table.data ? /* @__PURE__ */
|
|
54134
|
+
const pageActions = /* @__PURE__ */ jsxs164(Fragment71, { children: [
|
|
54135
|
+
publicReadOnly ? /* @__PURE__ */ jsx176(Badge26, { variant: "neutral", className: "shrink-0", "data-public-read-only": "", children: PUBLIC_READ_ONLY }, "public-read-only") : null,
|
|
54136
|
+
!phone && rights.read && table.data ? /* @__PURE__ */ jsx176(
|
|
53999
54137
|
TableAsk,
|
|
54000
54138
|
{
|
|
54001
54139
|
tableId,
|
|
@@ -54007,7 +54145,7 @@ function TablePage({
|
|
|
54007
54145
|
},
|
|
54008
54146
|
"ask"
|
|
54009
54147
|
) : null,
|
|
54010
|
-
organizationId ? /* @__PURE__ */
|
|
54148
|
+
organizationId ? /* @__PURE__ */ jsx176("span", { className: shareInMenu ? "hidden" : "flex shrink-0 items-center", "data-toolbar-fit": "share", children: /* @__PURE__ */ jsx176(
|
|
54011
54149
|
ShareControl,
|
|
54012
54150
|
{
|
|
54013
54151
|
kind: "table",
|
|
@@ -54021,28 +54159,28 @@ function TablePage({
|
|
|
54021
54159
|
},
|
|
54022
54160
|
`share-${shareAsked}`
|
|
54023
54161
|
) }, "share") : null,
|
|
54024
|
-
phone ? /* @__PURE__ */
|
|
54025
|
-
!chooserInline && !chooserCompact && !embedded ? /* @__PURE__ */
|
|
54026
|
-
/* @__PURE__ */
|
|
54027
|
-
/* @__PURE__ */
|
|
54162
|
+
phone ? /* @__PURE__ */ jsxs164(Fragment71, { children: [
|
|
54163
|
+
!chooserInline && !chooserCompact && !embedded ? /* @__PURE__ */ jsxs164(DropdownMenu10, { children: [
|
|
54164
|
+
/* @__PURE__ */ jsx176(DropdownMenuTrigger10, { asChild: true, children: /* @__PURE__ */ jsx176(Button120, { size: "sm", variant: "ghost", "aria-label": "Layout", title: "Layout", "data-table-layout-menu": "", children: "Layout" }) }),
|
|
54165
|
+
/* @__PURE__ */ jsx176(DropdownMenuContent10, { align: "end", className: "w-56", children: layoutRadio })
|
|
54028
54166
|
] }, "phone-layout") : null,
|
|
54029
54167
|
phoneTableActions(actions)
|
|
54030
|
-
] }) : /* @__PURE__ */
|
|
54031
|
-
/* @__PURE__ */
|
|
54032
|
-
/* @__PURE__ */
|
|
54033
|
-
/* @__PURE__ */
|
|
54034
|
-
/* @__PURE__ */
|
|
54168
|
+
] }) : /* @__PURE__ */ jsxs164(DropdownMenu10, { children: [
|
|
54169
|
+
/* @__PURE__ */ jsx176(DropdownMenuTrigger10, { asChild: true, children: /* @__PURE__ */ jsx176(Button120, { size: "sm", variant: "ghost", "aria-label": "Table menu", title: "Table menu", "data-table-menu": "", children: /* @__PURE__ */ jsxs164("svg", { viewBox: "0 0 24 24", className: "h-4 w-4", fill: "currentColor", "aria-hidden": "true", children: [
|
|
54170
|
+
/* @__PURE__ */ jsx176("circle", { cx: "5", cy: "12", r: "1.75" }),
|
|
54171
|
+
/* @__PURE__ */ jsx176("circle", { cx: "12", cy: "12", r: "1.75" }),
|
|
54172
|
+
/* @__PURE__ */ jsx176("circle", { cx: "19", cy: "12", r: "1.75" })
|
|
54035
54173
|
] }) }) }),
|
|
54036
|
-
/* @__PURE__ */
|
|
54037
|
-
!chooserInline && !chooserCompact && !embedded ? /* @__PURE__ */
|
|
54038
|
-
/* @__PURE__ */
|
|
54174
|
+
/* @__PURE__ */ jsxs164(DropdownMenuContent10, { align: "end", className: "w-64", "data-table-menu-content": "", ...renameMenuProps, children: [
|
|
54175
|
+
!chooserInline && !chooserCompact && !embedded ? /* @__PURE__ */ jsxs164(Fragment71, { children: [
|
|
54176
|
+
/* @__PURE__ */ jsx176(DropdownMenuLabel3, { className: "text-xs text-muted-foreground", children: "Layout" }),
|
|
54039
54177
|
layoutRadio,
|
|
54040
|
-
/* @__PURE__ */
|
|
54178
|
+
/* @__PURE__ */ jsx176(DropdownMenuSeparator5, {})
|
|
54041
54179
|
] }) : null,
|
|
54042
|
-
/* @__PURE__ */
|
|
54180
|
+
/* @__PURE__ */ jsx176(ObjectActionMenuItems, { actions })
|
|
54043
54181
|
] })
|
|
54044
54182
|
] }, "menu"),
|
|
54045
|
-
moveAsked > 0 && !actionHost?.move ? /* @__PURE__ */
|
|
54183
|
+
moveAsked > 0 && !actionHost?.move ? /* @__PURE__ */ jsx176(
|
|
54046
54184
|
WhereItLives,
|
|
54047
54185
|
{
|
|
54048
54186
|
tableId,
|
|
@@ -54055,7 +54193,7 @@ function TablePage({
|
|
|
54055
54193
|
},
|
|
54056
54194
|
"move"
|
|
54057
54195
|
) : null,
|
|
54058
|
-
breakDownOpen ? /* @__PURE__ */
|
|
54196
|
+
breakDownOpen ? /* @__PURE__ */ jsx176(
|
|
54059
54197
|
BreakDownDialog,
|
|
54060
54198
|
{
|
|
54061
54199
|
tableId,
|
|
@@ -54066,7 +54204,7 @@ function TablePage({
|
|
|
54066
54204
|
},
|
|
54067
54205
|
"break-down"
|
|
54068
54206
|
) : null,
|
|
54069
|
-
subscribeOpen && recordsUi.calendarFeed && organizationId && view ? /* @__PURE__ */
|
|
54207
|
+
subscribeOpen && recordsUi.calendarFeed && organizationId && view ? /* @__PURE__ */ jsx176(
|
|
54070
54208
|
CalendarSubscribeDialog,
|
|
54071
54209
|
{
|
|
54072
54210
|
port: recordsUi.calendarFeed,
|
|
@@ -54079,8 +54217,8 @@ function TablePage({
|
|
|
54079
54217
|
},
|
|
54080
54218
|
"subscribe"
|
|
54081
54219
|
) : null,
|
|
54082
|
-
referenceOpen && table.data ? /* @__PURE__ */
|
|
54083
|
-
duplicateOpen && table.data ? /* @__PURE__ */
|
|
54220
|
+
referenceOpen && table.data ? /* @__PURE__ */ jsx176(TableReferenceDialog, { table: table.data, open: referenceOpen, onOpenChange: setReferenceOpen }, "reference") : null,
|
|
54221
|
+
duplicateOpen && table.data ? /* @__PURE__ */ jsx176(
|
|
54084
54222
|
TableDuplicateDialog,
|
|
54085
54223
|
{
|
|
54086
54224
|
tableId,
|
|
@@ -54091,39 +54229,39 @@ function TablePage({
|
|
|
54091
54229
|
},
|
|
54092
54230
|
"duplicate"
|
|
54093
54231
|
) : null,
|
|
54094
|
-
rights.structure && table.data ? /* @__PURE__ */
|
|
54232
|
+
rights.structure && table.data ? /* @__PURE__ */ jsx176(TableRenameDialog, { tableId, name: table.data.name, open: renameOpen, onOpenChange: setRenameOpen }, "rename") : null
|
|
54095
54233
|
] });
|
|
54096
54234
|
const headerNode = header && !embedded ? header({ actions: table.data ? pageActions : null, tableName: table.data?.name ?? null }) : null;
|
|
54097
|
-
if (table.error) return /* @__PURE__ */
|
|
54235
|
+
if (table.error) return /* @__PURE__ */ jsxs164(Fragment71, { children: [
|
|
54098
54236
|
headerNode,
|
|
54099
|
-
/* @__PURE__ */
|
|
54237
|
+
/* @__PURE__ */ jsx176(RefusalNotice, { error: table.error })
|
|
54100
54238
|
] });
|
|
54101
54239
|
if (table.loading && !table.data) {
|
|
54102
|
-
return /* @__PURE__ */
|
|
54240
|
+
return /* @__PURE__ */ jsxs164(Fragment71, { children: [
|
|
54103
54241
|
headerNode,
|
|
54104
|
-
/* @__PURE__ */
|
|
54242
|
+
/* @__PURE__ */ jsx176(TablePageSkeleton, { layout: skeletonFace, embedded, tableId, ...className ? { className } : {} })
|
|
54105
54243
|
] });
|
|
54106
54244
|
}
|
|
54107
54245
|
if (!table.data) {
|
|
54108
|
-
return /* @__PURE__ */
|
|
54246
|
+
return /* @__PURE__ */ jsxs164(Fragment71, { children: [
|
|
54109
54247
|
headerNode,
|
|
54110
|
-
/* @__PURE__ */
|
|
54248
|
+
/* @__PURE__ */ jsx176(TableNotHere, { tableId, onLeave, leaveLabel, className })
|
|
54111
54249
|
] });
|
|
54112
54250
|
}
|
|
54113
54251
|
const lookSavable = Boolean(
|
|
54114
54252
|
rights.write && view && Object.keys(viewPatchDocument(saveToViewPlan(view, look ?? {}).patch)).length > 0
|
|
54115
54253
|
);
|
|
54116
|
-
return /* @__PURE__ */
|
|
54254
|
+
return /* @__PURE__ */ jsx176(ViewAddressContext.Provider, { value: addressPort, children: /* @__PURE__ */ jsxs164("div", { className: cn100("flex h-full min-h-0 gap-4", className), "data-table-footer": footer, children: [
|
|
54117
54255
|
headerNode,
|
|
54118
|
-
/* @__PURE__ */
|
|
54256
|
+
/* @__PURE__ */ jsx176("div", { className: "flex min-h-0 min-w-0 flex-1 flex-col gap-2", children: structure.hidden || !structure.settled ? (
|
|
54119
54257
|
/* THE TOOLBAR ROW'S HEIGHT IS KEPT (min-h-8), so the sentence lands exactly where the bar was. */
|
|
54120
|
-
/* @__PURE__ */
|
|
54121
|
-
/* @__PURE__ */
|
|
54122
|
-
structure.hidden ? /* @__PURE__ */
|
|
54258
|
+
/* @__PURE__ */ jsxs164(Fragment71, { children: [
|
|
54259
|
+
/* @__PURE__ */ jsx176("div", { className: TABLE_TOOLBAR_ROW_CLASS, "data-table-toolbar": "", "aria-hidden": "true" }),
|
|
54260
|
+
structure.hidden ? /* @__PURE__ */ jsx176(StructureLocked, {}) : /* @__PURE__ */ jsx176(RecordsSkeleton, { layout: skeletonFace, embedded })
|
|
54123
54261
|
] })
|
|
54124
|
-
) : /* @__PURE__ */
|
|
54125
|
-
/* @__PURE__ */
|
|
54126
|
-
/* @__PURE__ */
|
|
54262
|
+
) : /* @__PURE__ */ jsxs164(Fragment71, { children: [
|
|
54263
|
+
/* @__PURE__ */ jsx176(ImportNotice, { tableId, epoch: importEpoch, onOpenImport: () => setRail("import") }),
|
|
54264
|
+
/* @__PURE__ */ jsxs164(
|
|
54127
54265
|
"div",
|
|
54128
54266
|
{
|
|
54129
54267
|
ref: setToolbarRow,
|
|
@@ -54131,7 +54269,7 @@ function TablePage({
|
|
|
54131
54269
|
"data-table-toolbar": "",
|
|
54132
54270
|
"data-table-toolbar-fold": toolbarFold2,
|
|
54133
54271
|
children: [
|
|
54134
|
-
/* @__PURE__ */
|
|
54272
|
+
/* @__PURE__ */ jsx176(
|
|
54135
54273
|
ViewBar,
|
|
54136
54274
|
{
|
|
54137
54275
|
tableId,
|
|
@@ -54150,9 +54288,9 @@ function TablePage({
|
|
|
54150
54288
|
onViews: setViews,
|
|
54151
54289
|
...seededViews && viewsEpoch === 0 ? { initialViews: seededViews } : {},
|
|
54152
54290
|
seed: seedViews ?? [defaultView(tableId)],
|
|
54153
|
-
settings: view && main === "records" && shownLayout === "grid" ? /* @__PURE__ */
|
|
54154
|
-
/* @__PURE__ */
|
|
54155
|
-
["sticky", "inline"].map((option) => /* @__PURE__ */
|
|
54291
|
+
settings: view && main === "records" && shownLayout === "grid" ? /* @__PURE__ */ jsxs164("div", { className: "flex flex-col gap-0.5 px-1 py-1", role: "radiogroup", "aria-label": FOOTER_WORDS.label, children: [
|
|
54292
|
+
/* @__PURE__ */ jsx176("span", { className: "px-1 pb-0.5 text-[11px] font-medium text-muted-foreground", children: FOOTER_WORDS.label }),
|
|
54293
|
+
["sticky", "inline"].map((option) => /* @__PURE__ */ jsxs164(
|
|
54156
54294
|
"button",
|
|
54157
54295
|
{
|
|
54158
54296
|
type: "button",
|
|
@@ -54165,7 +54303,7 @@ function TablePage({
|
|
|
54165
54303
|
),
|
|
54166
54304
|
onClick: () => setFooter(option),
|
|
54167
54305
|
children: [
|
|
54168
|
-
/* @__PURE__ */
|
|
54306
|
+
/* @__PURE__ */ jsx176(
|
|
54169
54307
|
"span",
|
|
54170
54308
|
{
|
|
54171
54309
|
"aria-hidden": "true",
|
|
@@ -54181,8 +54319,8 @@ function TablePage({
|
|
|
54181
54319
|
},
|
|
54182
54320
|
viewsEpoch
|
|
54183
54321
|
),
|
|
54184
|
-
chooserInline ? /* @__PURE__ */
|
|
54185
|
-
|
|
54322
|
+
chooserInline ? /* @__PURE__ */ jsx176("div", { className: "flex shrink-0 items-center gap-0.5", role: "group", "aria-label": "Layout", "data-toolbar-fit": "chooser", children: VIEW_LAYOUTS.map((option) => /* @__PURE__ */ jsx176(
|
|
54323
|
+
Button120,
|
|
54186
54324
|
{
|
|
54187
54325
|
size: "sm",
|
|
54188
54326
|
variant: layoutShowing === option ? "secondary" : "ghost",
|
|
@@ -54196,21 +54334,21 @@ function TablePage({
|
|
|
54196
54334
|
/* THE ROW HAD NO ROOM (lane C, review 2026-09-26 D6: the switcher vanished at 1280 px and
|
|
54197
54335
|
with the record panel open): the chooser folds to ONE button naming the layout that is
|
|
54198
54336
|
showing — it never leaves the row. */
|
|
54199
|
-
/* @__PURE__ */
|
|
54200
|
-
/* @__PURE__ */
|
|
54337
|
+
/* @__PURE__ */ jsx176("span", { className: "flex shrink-0 items-center", "data-toolbar-fit": "chooser", "data-layout-chooser-compact": "", children: /* @__PURE__ */ jsxs164(DropdownMenu10, { children: [
|
|
54338
|
+
/* @__PURE__ */ jsx176(DropdownMenuTrigger10, { asChild: true, children: /* @__PURE__ */ jsxs164(Button120, { size: "sm", variant: "outline", className: "h-8 gap-1 px-2 text-xs", "aria-label": `Layout: ${layoutShowingLabel ?? "none"}`, children: [
|
|
54201
54339
|
layoutShowingLabel ?? "Layout",
|
|
54202
|
-
/* @__PURE__ */
|
|
54340
|
+
/* @__PURE__ */ jsx176("svg", { viewBox: "0 0 24 24", className: "h-3.5 w-3.5 opacity-70", fill: "none", stroke: "currentColor", strokeWidth: "2", "aria-hidden": "true", children: /* @__PURE__ */ jsx176("path", { d: "m6 9 6 6 6-6" }) })
|
|
54203
54341
|
] }) }),
|
|
54204
|
-
/* @__PURE__ */
|
|
54205
|
-
/* @__PURE__ */
|
|
54342
|
+
/* @__PURE__ */ jsxs164(DropdownMenuContent10, { align: "start", className: "w-44", "data-layout-chooser-menu": "", children: [
|
|
54343
|
+
/* @__PURE__ */ jsx176(DropdownMenuLabel3, { className: "text-xs text-muted-foreground", children: "Layout" }),
|
|
54206
54344
|
layoutRadio
|
|
54207
54345
|
] })
|
|
54208
54346
|
] }) })
|
|
54209
54347
|
) : null,
|
|
54210
|
-
main === "records" && !(controlsInSheet && shownLayout === "grid") ? /* @__PURE__ */
|
|
54211
|
-
lookShowing && main === "records" && !namingLook ? /* @__PURE__ */
|
|
54212
|
-
/* @__PURE__ */
|
|
54213
|
-
|
|
54348
|
+
main === "records" && !(controlsInSheet && shownLayout === "grid") ? /* @__PURE__ */ jsx176(ViewFilter, { tableId, view: shown5, onApply: (where) => void patchView({ where }) }) : null,
|
|
54349
|
+
lookShowing && main === "records" && !namingLook ? /* @__PURE__ */ jsxs164("span", { className: "flex shrink-0 items-center gap-1", "data-view-look": "", "data-view-look-folded": "", "data-toolbar-fit": "look", children: [
|
|
54350
|
+
/* @__PURE__ */ jsx176(
|
|
54351
|
+
Button120,
|
|
54214
54352
|
{
|
|
54215
54353
|
size: "sm",
|
|
54216
54354
|
variant: "outline",
|
|
@@ -54219,36 +54357,36 @@ function TablePage({
|
|
|
54219
54357
|
"aria-label": "Reset view",
|
|
54220
54358
|
onClick: () => void resetLook(),
|
|
54221
54359
|
"data-view-look-reset-button": "",
|
|
54222
|
-
children: /* @__PURE__ */
|
|
54223
|
-
/* @__PURE__ */
|
|
54224
|
-
/* @__PURE__ */
|
|
54360
|
+
children: /* @__PURE__ */ jsxs164("svg", { viewBox: "0 0 24 24", className: "h-4 w-4", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
|
|
54361
|
+
/* @__PURE__ */ jsx176("path", { d: "M3 12a9 9 0 1 0 3-6.7L3 8" }),
|
|
54362
|
+
/* @__PURE__ */ jsx176("path", { d: "M3 3v5h5" })
|
|
54225
54363
|
] })
|
|
54226
54364
|
}
|
|
54227
54365
|
),
|
|
54228
|
-
/* @__PURE__ */
|
|
54229
|
-
/* @__PURE__ */
|
|
54230
|
-
/* @__PURE__ */
|
|
54231
|
-
/* @__PURE__ */
|
|
54366
|
+
/* @__PURE__ */ jsxs164(DropdownMenu10, { children: [
|
|
54367
|
+
/* @__PURE__ */ jsx176(DropdownMenuTrigger10, { asChild: true, children: /* @__PURE__ */ jsxs164(Button120, { size: "sm", variant: "outline", className: "relative h-8 w-8 shrink-0 px-0", title: LOOK_WORDS.folded, "aria-label": LOOK_WORDS.folded, "data-view-look-menu": "", children: [
|
|
54368
|
+
/* @__PURE__ */ jsx176(LookGlyph, {}),
|
|
54369
|
+
/* @__PURE__ */ jsx176("span", { "aria-hidden": "true", className: "absolute right-1 top-1 h-1.5 w-1.5 rounded-full bg-primary" })
|
|
54232
54370
|
] }) }),
|
|
54233
|
-
/* @__PURE__ */
|
|
54234
|
-
lookSavable ? /* @__PURE__ */
|
|
54235
|
-
rights.write ? /* @__PURE__ */
|
|
54236
|
-
/* @__PURE__ */
|
|
54371
|
+
/* @__PURE__ */ jsxs164(DropdownMenuContent10, { align: "start", className: "w-60", "data-view-look-menu-content": "", children: [
|
|
54372
|
+
lookSavable ? /* @__PURE__ */ jsx176(DropdownMenuItem8, { onSelect: () => void saveLookToView(), "data-view-look-save": "", children: LOOK_WORDS.saveToView }) : null,
|
|
54373
|
+
rights.write ? /* @__PURE__ */ jsx176(DropdownMenuItem8, { onSelect: () => setNamingLook(true), "data-view-look-save-new": "", children: LOOK_WORDS.saveAsNew }) : null,
|
|
54374
|
+
/* @__PURE__ */ jsx176(DropdownMenuItem8, { onSelect: () => void resetLook(), "data-view-look-reset": "", children: LOOK_WORDS.reset })
|
|
54237
54375
|
] })
|
|
54238
54376
|
] })
|
|
54239
54377
|
] }) : !lookShowing && main === "records" && view && !phone && !controlsInSheet ? (
|
|
54240
54378
|
/* The reserved place keeps its full width at every row width (STABLE-TABLES): when it
|
|
54241
54379
|
shrank on a narrow row, the look arriving on a sort pushed every control after it.
|
|
54242
54380
|
A row too narrow for it scrolls sideways, as the row already does. */
|
|
54243
|
-
/* @__PURE__ */
|
|
54244
|
-
/* @__PURE__ */
|
|
54245
|
-
/* @__PURE__ */
|
|
54381
|
+
/* @__PURE__ */ jsxs164("span", { "aria-hidden": "true", className: "invisible flex shrink-0 items-center gap-1 overflow-hidden", "data-view-look-place": "", "data-toolbar-fit-gives": "", children: [
|
|
54382
|
+
/* @__PURE__ */ jsx176(Button120, { size: "sm", variant: "outline", className: "h-8 w-8 shrink-0 px-0", tabIndex: -1, children: /* @__PURE__ */ jsx176(LookGlyph, {}) }),
|
|
54383
|
+
/* @__PURE__ */ jsx176(Button120, { size: "sm", variant: "outline", className: "h-8 w-8 shrink-0 px-0", tabIndex: -1 })
|
|
54246
54384
|
] })
|
|
54247
|
-
) : lookShowing && main === "records" ? /* @__PURE__ */
|
|
54248
|
-
/* @__PURE__ */
|
|
54249
|
-
/* @__PURE__ */
|
|
54250
|
-
lookSavable ? /* @__PURE__ */
|
|
54251
|
-
rights.write ? namingLook ? /* @__PURE__ */
|
|
54385
|
+
) : lookShowing && main === "records" ? /* @__PURE__ */ jsxs164("span", { className: "flex shrink-0 items-center gap-1", "data-view-look": "", "data-toolbar-fit": "look", title: LOOK_WORDS.yours, children: [
|
|
54386
|
+
/* @__PURE__ */ jsx176("span", { className: "sr-only", children: LOOK_WORDS.yours }),
|
|
54387
|
+
/* @__PURE__ */ jsx176("span", { "aria-hidden": "true", className: "h-1.5 w-1.5 shrink-0 rounded-full bg-primary" }),
|
|
54388
|
+
lookSavable ? /* @__PURE__ */ jsx176(Button120, { size: "sm", variant: "outline", className: "h-8 px-2 text-xs", onClick: () => void saveLookToView(), "data-view-look-save": "", children: LOOK_WORDS.saveToView }) : null,
|
|
54389
|
+
rights.write ? namingLook ? /* @__PURE__ */ jsxs164(
|
|
54252
54390
|
"form",
|
|
54253
54391
|
{
|
|
54254
54392
|
className: "flex items-center gap-1",
|
|
@@ -54257,7 +54395,7 @@ function TablePage({
|
|
|
54257
54395
|
void saveLookAsNewView(lookName);
|
|
54258
54396
|
},
|
|
54259
54397
|
children: [
|
|
54260
|
-
/* @__PURE__ */
|
|
54398
|
+
/* @__PURE__ */ jsx176(
|
|
54261
54399
|
Input12,
|
|
54262
54400
|
{
|
|
54263
54401
|
autoFocus: true,
|
|
@@ -54268,13 +54406,13 @@ function TablePage({
|
|
|
54268
54406
|
placeholder: "View name"
|
|
54269
54407
|
}
|
|
54270
54408
|
),
|
|
54271
|
-
/* @__PURE__ */
|
|
54409
|
+
/* @__PURE__ */ jsx176(Button120, { size: "sm", type: "submit", className: "h-8 px-2 text-xs", disabled: lookName.trim() === "", children: "Save" })
|
|
54272
54410
|
]
|
|
54273
54411
|
}
|
|
54274
|
-
) : /* @__PURE__ */
|
|
54275
|
-
/* @__PURE__ */
|
|
54412
|
+
) : /* @__PURE__ */ jsx176(Button120, { size: "sm", variant: "ghost", className: "h-8 px-2 text-xs", onClick: () => setNamingLook(true), "data-view-look-save-new": "", children: LOOK_WORDS.saveAsNew }) : null,
|
|
54413
|
+
/* @__PURE__ */ jsx176(Button120, { size: "sm", variant: "ghost", className: "h-8 px-2 text-xs", onClick: () => void resetLook(), "data-view-look-reset": "", children: LOOK_WORDS.reset })
|
|
54276
54414
|
] }) : null,
|
|
54277
|
-
/* @__PURE__ */
|
|
54415
|
+
/* @__PURE__ */ jsx176(
|
|
54278
54416
|
"div",
|
|
54279
54417
|
{
|
|
54280
54418
|
ref: setToolbarSlot,
|
|
@@ -54296,9 +54434,9 @@ function TablePage({
|
|
|
54296
54434
|
"data-clipped": slotClipped
|
|
54297
54435
|
}
|
|
54298
54436
|
),
|
|
54299
|
-
rights.write && view && main === "records" && shownLayout !== "grid" ? /* @__PURE__ */
|
|
54300
|
-
openedFromMenu ? /* @__PURE__ */
|
|
54301
|
-
|
|
54437
|
+
rights.write && view && main === "records" && shownLayout !== "grid" ? /* @__PURE__ */ jsx176(Button120, { size: "sm", className: "shrink-0", onClick: () => show("new-record"), children: "New record" }) : null,
|
|
54438
|
+
openedFromMenu ? /* @__PURE__ */ jsx176(
|
|
54439
|
+
Button120,
|
|
54302
54440
|
{
|
|
54303
54441
|
size: "sm",
|
|
54304
54442
|
variant: "secondary",
|
|
@@ -54310,19 +54448,19 @@ function TablePage({
|
|
|
54310
54448
|
children: openedFromMenu.label
|
|
54311
54449
|
}
|
|
54312
54450
|
) : null,
|
|
54313
|
-
header ? null : /* @__PURE__ */
|
|
54451
|
+
header ? null : /* @__PURE__ */ jsx176("span", { className: "flex shrink-0 items-center gap-1", "data-table-page-actions": "", children: pageActions })
|
|
54314
54452
|
]
|
|
54315
54453
|
}
|
|
54316
54454
|
),
|
|
54317
|
-
designateRefused ? /* @__PURE__ */
|
|
54318
|
-
viewSaveRefused ? /* @__PURE__ */
|
|
54455
|
+
designateRefused ? /* @__PURE__ */ jsx176(RefusalNotice, { error: designateRefused }) : null,
|
|
54456
|
+
viewSaveRefused ? /* @__PURE__ */ jsx176(
|
|
54319
54457
|
RefusalNotice,
|
|
54320
54458
|
{
|
|
54321
54459
|
error: viewSaveRefused.error,
|
|
54322
|
-
actions: /* @__PURE__ */
|
|
54323
|
-
/* @__PURE__ */
|
|
54324
|
-
/* @__PURE__ */
|
|
54325
|
-
|
|
54460
|
+
actions: /* @__PURE__ */ jsxs164("span", { className: "flex flex-wrap gap-1 pt-0.5", "data-view-save-refused": "", children: [
|
|
54461
|
+
/* @__PURE__ */ jsx176(Button120, { size: "sm", variant: "outline", onClick: () => void patchView(viewSaveRefused.patch), children: "Try again" }),
|
|
54462
|
+
/* @__PURE__ */ jsx176(
|
|
54463
|
+
Button120,
|
|
54326
54464
|
{
|
|
54327
54465
|
size: "sm",
|
|
54328
54466
|
variant: "ghost",
|
|
@@ -54342,8 +54480,8 @@ function TablePage({
|
|
|
54342
54480
|
] })
|
|
54343
54481
|
}
|
|
54344
54482
|
) : null,
|
|
54345
|
-
lookRefused ? /* @__PURE__ */
|
|
54346
|
-
main === "dashboards" ? /* @__PURE__ */
|
|
54483
|
+
lookRefused ? /* @__PURE__ */ jsx176(RefusalNotice, { error: lookRefused }) : null,
|
|
54484
|
+
main === "dashboards" ? /* @__PURE__ */ jsx176(DashboardCanvas, { tableId, activeDashboardId: activeDashboardId ?? null }) : main === "questions" ? /* @__PURE__ */ jsx176(
|
|
54347
54485
|
QuestionPanel,
|
|
54348
54486
|
{
|
|
54349
54487
|
tableId,
|
|
@@ -54355,7 +54493,7 @@ function TablePage({
|
|
|
54355
54493
|
page returns to the records rather than leaving the person looking
|
|
54356
54494
|
at a list the record is no longer in — and opens it, because the
|
|
54357
54495
|
thing they just rescued is the thing they came for. */
|
|
54358
|
-
/* @__PURE__ */
|
|
54496
|
+
/* @__PURE__ */ jsx176(
|
|
54359
54497
|
ArchivedView,
|
|
54360
54498
|
{
|
|
54361
54499
|
tableId,
|
|
@@ -54367,7 +54505,7 @@ function TablePage({
|
|
|
54367
54505
|
}
|
|
54368
54506
|
}
|
|
54369
54507
|
)
|
|
54370
|
-
) : /* @__PURE__ */
|
|
54508
|
+
) : /* @__PURE__ */ jsx176(TableToolbarSlotContext.Provider, { value: toolbarSlot, children: /* @__PURE__ */ jsx176(TableToolbarFoldContext.Provider, { value: toolbarFold2, children: /* @__PURE__ */ jsx176(TableToolbarSheetExtrasContext.Provider, { value: sheetExtras, children: /* @__PURE__ */ jsxs164(
|
|
54371
54509
|
"div",
|
|
54372
54510
|
{
|
|
54373
54511
|
className: cn100(
|
|
@@ -54378,10 +54516,10 @@ function TablePage({
|
|
|
54378
54516
|
),
|
|
54379
54517
|
"data-table-records": "",
|
|
54380
54518
|
children: [
|
|
54381
|
-
railUnknown ? /* @__PURE__ */
|
|
54382
|
-
shareFromLink && rights.known && (!rights.share || !canShare) ? /* @__PURE__ */
|
|
54383
|
-
opened.unknown ? /* @__PURE__ */
|
|
54384
|
-
viewLinkMissed ? /* @__PURE__ */
|
|
54519
|
+
railUnknown ? /* @__PURE__ */ jsx176("p", { className: "rounded-md border border-amber-600/40 bg-amber-500/5 px-3 py-2 text-xs leading-relaxed text-amber-700 dark:border-amber-400/40 dark:text-amber-300", children: unknownRailLine(railUnknown) }) : null,
|
|
54520
|
+
shareFromLink && rights.known && (!rights.share || !canShare) ? /* @__PURE__ */ jsx176("p", { className: "rounded-md border border-amber-600/40 bg-amber-500/5 px-3 py-2 text-xs leading-relaxed text-amber-700 dark:border-amber-400/40 dark:text-amber-300", children: canShare ? SHARE_NOT_YOURS_LINE : shareUnavailableReason() }) : null,
|
|
54521
|
+
opened.unknown ? /* @__PURE__ */ jsx176("p", { className: "rounded-md border border-amber-600/40 bg-amber-500/5 px-3 py-2 text-xs leading-relaxed text-amber-700 dark:border-amber-400/40 dark:text-amber-300", children: unknownViewLine(opened.unknown) }) : null,
|
|
54522
|
+
viewLinkMissed ? /* @__PURE__ */ jsx176(
|
|
54385
54523
|
"p",
|
|
54386
54524
|
{
|
|
54387
54525
|
"data-records-view-link-missed": "",
|
|
@@ -54389,7 +54527,7 @@ function TablePage({
|
|
|
54389
54527
|
children: unknownSavedViewLine(view?.name ?? null)
|
|
54390
54528
|
}
|
|
54391
54529
|
) : null,
|
|
54392
|
-
cameFrom ? /* @__PURE__ */
|
|
54530
|
+
cameFrom ? /* @__PURE__ */ jsx176(
|
|
54393
54531
|
"p",
|
|
54394
54532
|
{
|
|
54395
54533
|
"data-testid": "came-from-a-number",
|
|
@@ -54399,7 +54537,7 @@ function TablePage({
|
|
|
54399
54537
|
) : null,
|
|
54400
54538
|
faceUnknown ? (
|
|
54401
54539
|
/* REVIEW-FIX 10: a full page paints the rows this table showed last time (else fills). */
|
|
54402
|
-
/* @__PURE__ */
|
|
54540
|
+
/* @__PURE__ */ jsx176(
|
|
54403
54541
|
RecordsSkeleton,
|
|
54404
54542
|
{
|
|
54405
54543
|
layout: skeletonFace,
|
|
@@ -54407,7 +54545,7 @@ function TablePage({
|
|
|
54407
54545
|
...embedded ? {} : { rows: rememberedRowCount(`${tableId}:page:last`, 100, "fill") }
|
|
54408
54546
|
}
|
|
54409
54547
|
)
|
|
54410
|
-
) : /* @__PURE__ */
|
|
54548
|
+
) : /* @__PURE__ */ jsx176(
|
|
54411
54549
|
ViewSwitcher,
|
|
54412
54550
|
{
|
|
54413
54551
|
chooser: false,
|
|
@@ -54449,19 +54587,20 @@ function TablePage({
|
|
|
54449
54587
|
},
|
|
54450
54588
|
openRecordId: rail === "record" ? openRecord : null,
|
|
54451
54589
|
onCloseRecord: () => setRail("none"),
|
|
54590
|
+
onRowsShown: setShownIds,
|
|
54452
54591
|
onAskWhoChanged: (fieldKey, recordId) => {
|
|
54453
54592
|
setAsking({ fieldKey, recordId });
|
|
54454
54593
|
setRail("who-changed");
|
|
54455
54594
|
}
|
|
54456
54595
|
}
|
|
54457
54596
|
),
|
|
54458
|
-
view || faceUnknown || views === void 0 || views !== null && views.length > 0 ? null : /* @__PURE__ */
|
|
54597
|
+
view || faceUnknown || views === void 0 || views !== null && views.length > 0 ? null : /* @__PURE__ */ jsx176("p", { className: "text-xs text-muted-foreground", children: VIEW_NOT_SAVED_YET })
|
|
54459
54598
|
]
|
|
54460
54599
|
}
|
|
54461
54600
|
) }) }) })
|
|
54462
54601
|
] }) }),
|
|
54463
|
-
rail === "none" ? null : /* @__PURE__ */
|
|
54464
|
-
rail === "settings" ? /* @__PURE__ */
|
|
54602
|
+
rail === "none" ? null : /* @__PURE__ */ jsxs164(RailFrame, { phone, title: RAIL_TITLE[rail], onClose: () => setRail("none"), over: rail === "record" && recordExpanded, children: [
|
|
54603
|
+
rail === "settings" ? /* @__PURE__ */ jsx176(
|
|
54465
54604
|
TableSettings,
|
|
54466
54605
|
{
|
|
54467
54606
|
tableId,
|
|
@@ -54478,7 +54617,7 @@ function TablePage({
|
|
|
54478
54617
|
} : void 0
|
|
54479
54618
|
}
|
|
54480
54619
|
) : null,
|
|
54481
|
-
rail === "inbox" ? /* @__PURE__ */
|
|
54620
|
+
rail === "inbox" ? /* @__PURE__ */ jsx176(
|
|
54482
54621
|
ActionInbox,
|
|
54483
54622
|
{
|
|
54484
54623
|
tableId,
|
|
@@ -54488,9 +54627,9 @@ function TablePage({
|
|
|
54488
54627
|
}
|
|
54489
54628
|
}
|
|
54490
54629
|
) : null,
|
|
54491
|
-
rail === "forms" ? /* @__PURE__ */
|
|
54492
|
-
rail === "bookings" ? /* @__PURE__ */
|
|
54493
|
-
rail === "checklists" ? /* @__PURE__ */
|
|
54630
|
+
rail === "forms" ? /* @__PURE__ */ jsx176(FormsPanel, { tableId, activeFormId: itemFor("forms") }) : null,
|
|
54631
|
+
rail === "bookings" ? /* @__PURE__ */ jsx176(BookingSlots, { tableId, activeBookingId: itemFor("bookings") }) : null,
|
|
54632
|
+
rail === "checklists" ? /* @__PURE__ */ jsx176(
|
|
54494
54633
|
ChecklistsPanel,
|
|
54495
54634
|
{
|
|
54496
54635
|
tableId,
|
|
@@ -54500,12 +54639,12 @@ function TablePage({
|
|
|
54500
54639
|
}
|
|
54501
54640
|
}
|
|
54502
54641
|
) : null,
|
|
54503
|
-
rail === "notifications" ? /* @__PURE__ */
|
|
54504
|
-
rail === "portals" ? /* @__PURE__ */
|
|
54505
|
-
rail === "export" ? /* @__PURE__ */
|
|
54506
|
-
rail === "import" ? /* @__PURE__ */
|
|
54507
|
-
rail === "field" ? /* @__PURE__ */
|
|
54508
|
-
rail === "new-record" ? /* @__PURE__ */
|
|
54642
|
+
rail === "notifications" ? /* @__PURE__ */ jsx176(SubscriptionsPanel, { tableId, activeRuleId: itemFor("notifications") }) : null,
|
|
54643
|
+
rail === "portals" ? /* @__PURE__ */ jsx176(PortalsPanel, { tableId, activePortalId: itemFor("portals") }) : null,
|
|
54644
|
+
rail === "export" ? /* @__PURE__ */ jsx176(ExportMenu, { tableId, view: viewReading }) : null,
|
|
54645
|
+
rail === "import" ? /* @__PURE__ */ jsx176(ImportWizard, { tableId, onWrote: () => setImportEpoch((n) => n + 1), onDone: () => setRail("none") }) : null,
|
|
54646
|
+
rail === "field" ? /* @__PURE__ */ jsx176(FieldEditor, { tableId, onSaved: () => setRail("none"), onCancel: () => setRail("none") }) : null,
|
|
54647
|
+
rail === "new-record" ? /* @__PURE__ */ jsx176(
|
|
54509
54648
|
RecordForm,
|
|
54510
54649
|
{
|
|
54511
54650
|
tableId,
|
|
@@ -54516,7 +54655,7 @@ function TablePage({
|
|
|
54516
54655
|
onCancel: () => setRail("none")
|
|
54517
54656
|
}
|
|
54518
54657
|
) : null,
|
|
54519
|
-
rail === "who-changed" && asking ? /* @__PURE__ */
|
|
54658
|
+
rail === "who-changed" && asking ? /* @__PURE__ */ jsx176(
|
|
54520
54659
|
FieldHistoryPanel,
|
|
54521
54660
|
{
|
|
54522
54661
|
tableId,
|
|
@@ -54529,12 +54668,16 @@ function TablePage({
|
|
|
54529
54668
|
}
|
|
54530
54669
|
}
|
|
54531
54670
|
) : null,
|
|
54532
|
-
rail === "record" && openRecord ? /* @__PURE__ */
|
|
54671
|
+
rail === "record" && openRecord ? /* @__PURE__ */ jsx176(
|
|
54533
54672
|
RecordPanel,
|
|
54534
54673
|
{
|
|
54535
54674
|
tableId,
|
|
54536
54675
|
recordId: openRecord,
|
|
54537
54676
|
onClose: () => setRail("none"),
|
|
54677
|
+
neighbors: neighborsOf(shownIds, openRecord),
|
|
54678
|
+
onStep: (to) => setOpenRecord(to),
|
|
54679
|
+
expanded: recordExpanded,
|
|
54680
|
+
onToggleExpand: () => setRecordExpanded((now) => !now),
|
|
54538
54681
|
onAskAboutField: (fieldKey) => {
|
|
54539
54682
|
setAsking({ fieldKey, recordId: openRecord });
|
|
54540
54683
|
setRail("who-changed");
|
|
@@ -54576,9 +54719,9 @@ import { formatCount as formatCount8 } from "@ai-matrx/kit/format";
|
|
|
54576
54719
|
import { TapTargetSearchGroup as TapTargetSearchGroup2, TooltipProvider } from "@ai-matrx/design-system";
|
|
54577
54720
|
import { MatrxTableCardShowMore as MatrxTableCardShowMore3 } from "@ai-matrx/design-system/data-table";
|
|
54578
54721
|
import { useEffect as useEffect125, useMemo as useMemo83, useRef as useRef65, useState as useState151 } from "react";
|
|
54579
|
-
import { Button as
|
|
54722
|
+
import { Button as Button121, ErrorBox as ErrorBox9, Input as Input13, cn as cn101 } from "@ai-matrx/design-system";
|
|
54580
54723
|
import { SEED_FRESH_MS, useRecordsClient as useRecordsClient107, useSeededAnswerAt } from "@ai-matrx/records/react";
|
|
54581
|
-
import { Fragment as Fragment72, jsx as
|
|
54724
|
+
import { Fragment as Fragment72, jsx as jsx177, jsxs as jsxs165 } from "react/jsx-runtime";
|
|
54582
54725
|
var entityTitleColumn = entityNameColumn;
|
|
54583
54726
|
function shown4(v) {
|
|
54584
54727
|
if (v === null || v === void 0 || v === "") return "";
|
|
@@ -54594,9 +54737,9 @@ function EntityBoard({ entity, groupBy, cardFields, onOpenRecord, className }) {
|
|
|
54594
54737
|
);
|
|
54595
54738
|
const [refused, setRefused] = useState151(null);
|
|
54596
54739
|
const [over, setOver] = useState151(null);
|
|
54597
|
-
if (entity.error) return /* @__PURE__ */
|
|
54740
|
+
if (entity.error) return /* @__PURE__ */ jsx177("p", { className: "px-1 py-3 text-xs text-muted-foreground", children: `This board could not be read: ${entity.error}` });
|
|
54598
54741
|
if (!entity.loading && !column) {
|
|
54599
|
-
return /* @__PURE__ */
|
|
54742
|
+
return /* @__PURE__ */ jsx177("p", { className: "px-1 py-3 text-xs text-muted-foreground", children: `${entity.label ?? "This table"} has no choice column to make a board of.` });
|
|
54600
54743
|
}
|
|
54601
54744
|
if (!column) return null;
|
|
54602
54745
|
const words2 = column.choices ?? [];
|
|
@@ -54614,10 +54757,10 @@ function EntityBoard({ entity, groupBy, cardFields, onOpenRecord, className }) {
|
|
|
54614
54757
|
const says = await entity.update(id, column, to);
|
|
54615
54758
|
if (says) setRefused({ to, says });
|
|
54616
54759
|
};
|
|
54617
|
-
return /* @__PURE__ */
|
|
54760
|
+
return /* @__PURE__ */ jsx177("div", { className: cn101("flex min-h-40 gap-2 overflow-x-auto pb-1", className), "data-records-entity-board": column.key, children: lanes.map((lane) => {
|
|
54618
54761
|
const cards = rowsOf2(lane.key);
|
|
54619
54762
|
if (lane.key === "" && cards.length === 0) return null;
|
|
54620
|
-
return /* @__PURE__ */
|
|
54763
|
+
return /* @__PURE__ */ jsxs165(
|
|
54621
54764
|
"section",
|
|
54622
54765
|
{
|
|
54623
54766
|
"aria-label": lane.label,
|
|
@@ -54629,12 +54772,12 @@ function EntityBoard({ entity, groupBy, cardFields, onOpenRecord, className }) {
|
|
|
54629
54772
|
onDragLeave: writable && lane.key ? () => setOver((o) => o === lane.key ? null : o) : void 0,
|
|
54630
54773
|
onDrop: writable && lane.key ? (e) => void drop(e, lane.key) : void 0,
|
|
54631
54774
|
children: [
|
|
54632
|
-
/* @__PURE__ */
|
|
54633
|
-
/* @__PURE__ */
|
|
54634
|
-
/* @__PURE__ */
|
|
54775
|
+
/* @__PURE__ */ jsxs165("header", { className: "flex items-baseline gap-1.5 px-1 text-xs", children: [
|
|
54776
|
+
/* @__PURE__ */ jsx177("span", { className: "truncate font-medium", children: lane.label }),
|
|
54777
|
+
/* @__PURE__ */ jsx177("span", { className: "tabular-nums text-muted-foreground", children: cards.length })
|
|
54635
54778
|
] }),
|
|
54636
|
-
refused && refused.to === lane.key ? /* @__PURE__ */
|
|
54637
|
-
cards.map((row) => /* @__PURE__ */
|
|
54779
|
+
refused && refused.to === lane.key ? /* @__PURE__ */ jsx177(ErrorBox9, { className: "rounded border border-destructive/40 px-1.5 py-1 text-xs text-destructive", message: refused.says, operation: "Move a card", origin: "records-ui/entityViews" }) : null,
|
|
54780
|
+
cards.map((row) => /* @__PURE__ */ jsxs165(
|
|
54638
54781
|
"article",
|
|
54639
54782
|
{
|
|
54640
54783
|
draggable: writable,
|
|
@@ -54645,8 +54788,8 @@ function EntityBoard({ entity, groupBy, cardFields, onOpenRecord, className }) {
|
|
|
54645
54788
|
className: cn101("flex flex-col gap-0.5 rounded border bg-card px-2 py-1.5 text-xs shadow-sm", writable && "cursor-grab"),
|
|
54646
54789
|
"data-records-entity-card": row._id,
|
|
54647
54790
|
children: [
|
|
54648
|
-
onOpenRecord ? /* @__PURE__ */
|
|
54649
|
-
extra.map((c) => entityValueText(c, entityCellValue(row, c)) ? /* @__PURE__ */
|
|
54791
|
+
onOpenRecord ? /* @__PURE__ */ jsx177("button", { type: "button", className: "truncate text-left font-medium hover:underline", onClick: () => onOpenRecord(row._id), children: (title ? entityValueText(title, entityCellValue(row, title)) : shown4(row._id)) || "Untitled" }) : /* @__PURE__ */ jsx177("span", { className: "truncate font-medium", children: (title ? entityValueText(title, entityCellValue(row, title)) : shown4(row._id)) || "Untitled" }),
|
|
54792
|
+
extra.map((c) => entityValueText(c, entityCellValue(row, c)) ? /* @__PURE__ */ jsx177("span", { className: "truncate text-muted-foreground", children: entityValueText(c, entityCellValue(row, c)) }, c.key) : null)
|
|
54650
54793
|
]
|
|
54651
54794
|
},
|
|
54652
54795
|
row._id
|
|
@@ -54697,9 +54840,9 @@ function EntityChartBlock({ source, kind, by, measure, title, where, organizatio
|
|
|
54697
54840
|
};
|
|
54698
54841
|
}, [client, ask2, kind, title]);
|
|
54699
54842
|
if (!block) {
|
|
54700
|
-
return /* @__PURE__ */
|
|
54843
|
+
return /* @__PURE__ */ jsx177(RecordsSkeleton, { layout: "chart", embedded: variant === "bare", ...className ? { className } : {} });
|
|
54701
54844
|
}
|
|
54702
|
-
return /* @__PURE__ */
|
|
54845
|
+
return /* @__PURE__ */ jsx177(
|
|
54703
54846
|
ChartBlock,
|
|
54704
54847
|
{
|
|
54705
54848
|
block,
|
|
@@ -54712,7 +54855,7 @@ function EntityChartBlock({ source, kind, by, measure, title, where, organizatio
|
|
|
54712
54855
|
);
|
|
54713
54856
|
}
|
|
54714
54857
|
function EntityTablePage(props) {
|
|
54715
|
-
return /* @__PURE__ */
|
|
54858
|
+
return /* @__PURE__ */ jsx177(EntityDataScope, { children: /* @__PURE__ */ jsx177(EntityTablePageBody, { ...props }) });
|
|
54716
54859
|
}
|
|
54717
54860
|
function EntityTablePageBody({
|
|
54718
54861
|
source,
|
|
@@ -54762,20 +54905,20 @@ function EntityTablePageBody({
|
|
|
54762
54905
|
rowNoun: (entity.label ?? "record").toLowerCase(),
|
|
54763
54906
|
enabled: layout === "grid"
|
|
54764
54907
|
});
|
|
54765
|
-
return /* @__PURE__ */
|
|
54766
|
-
presentation === "page" || boardable || entity.creatable ? /* @__PURE__ */
|
|
54767
|
-
presentation === "page" ? /* @__PURE__ */
|
|
54768
|
-
presentation === "page" ? /* @__PURE__ */
|
|
54769
|
-
/* @__PURE__ */
|
|
54770
|
-
boardable ? /* @__PURE__ */
|
|
54771
|
-
/* @__PURE__ */
|
|
54772
|
-
/* @__PURE__ */
|
|
54908
|
+
return /* @__PURE__ */ jsxs165("div", { className: cn101("flex min-w-0 flex-col gap-2", className), "data-records-entity-page": source.token, children: [
|
|
54909
|
+
presentation === "page" || boardable || entity.creatable ? /* @__PURE__ */ jsxs165("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
54910
|
+
presentation === "page" ? /* @__PURE__ */ jsx177("h2", { className: "truncate text-base font-semibold", children: entity.label ?? (entity.loading ? "Loading\u2026" : "Table") }) : null,
|
|
54911
|
+
presentation === "page" ? /* @__PURE__ */ jsx177("span", { className: "text-xs tabular-nums text-muted-foreground", children: entity.loading || entity.total === null ? "" : formatCount8(entity.total) }) : null,
|
|
54912
|
+
/* @__PURE__ */ jsxs165("span", { className: "ml-auto flex items-center gap-1", children: [
|
|
54913
|
+
boardable ? /* @__PURE__ */ jsxs165(Fragment72, { children: [
|
|
54914
|
+
/* @__PURE__ */ jsx177(Button121, { size: "sm", variant: layout === "grid" ? "secondary" : "ghost", "aria-pressed": layout === "grid", onClick: () => choose("grid"), children: "Table" }),
|
|
54915
|
+
/* @__PURE__ */ jsx177(Button121, { size: "sm", variant: layout === "board" ? "secondary" : "ghost", "aria-pressed": layout === "board", onClick: () => choose("board"), children: "Board" })
|
|
54773
54916
|
] }) : null,
|
|
54774
|
-
entity.creatable && naming === null ? /* @__PURE__ */
|
|
54917
|
+
entity.creatable && naming === null ? /* @__PURE__ */ jsx177(Button121, { size: "sm", variant: "ghost", onClick: () => {
|
|
54775
54918
|
setAddRefused(null);
|
|
54776
54919
|
setNaming("");
|
|
54777
54920
|
}, children: "New page" }) : null,
|
|
54778
|
-
entity.creatable && naming !== null ? /* @__PURE__ */
|
|
54921
|
+
entity.creatable && naming !== null ? /* @__PURE__ */ jsx177(
|
|
54779
54922
|
Input13,
|
|
54780
54923
|
{
|
|
54781
54924
|
autoFocus: true,
|
|
@@ -54805,9 +54948,9 @@ function EntityTablePageBody({
|
|
|
54805
54948
|
actions
|
|
54806
54949
|
] })
|
|
54807
54950
|
] }) : null,
|
|
54808
|
-
addRefused ? /* @__PURE__ */
|
|
54809
|
-
entity.error ? /* @__PURE__ */
|
|
54810
|
-
presentation === "embedded" && searchBox ? /* @__PURE__ */
|
|
54951
|
+
addRefused ? /* @__PURE__ */ jsx177(ErrorBox9, { className: "rounded border border-destructive/40 px-1.5 py-1 text-xs text-destructive", message: addRefused, operation: "Add a row", origin: "records-ui/entityViews" }) : null,
|
|
54952
|
+
entity.error ? /* @__PURE__ */ jsx177("p", { className: "px-1 py-3 text-xs text-muted-foreground", children: `This table could not be read: ${entity.error}` }) : layout === "board" && boardable ? /* @__PURE__ */ jsx177(EntityBoard, { entity, groupBy, onOpenRecord }) : /* @__PURE__ */ jsxs165(Fragment72, { children: [
|
|
54953
|
+
presentation === "embedded" && searchBox ? /* @__PURE__ */ jsx177("div", { className: "flex min-w-0 items-center justify-end", "data-records-entity-search": "", children: /* @__PURE__ */ jsx177(TooltipProvider, { children: /* @__PURE__ */ jsx177(
|
|
54811
54954
|
TapTargetSearchGroup2,
|
|
54812
54955
|
{
|
|
54813
54956
|
surface: "solid",
|
|
@@ -54819,8 +54962,8 @@ function EntityTablePageBody({
|
|
|
54819
54962
|
}
|
|
54820
54963
|
}
|
|
54821
54964
|
) }) }) : null,
|
|
54822
|
-
/* @__PURE__ */
|
|
54823
|
-
entity.hasMore ? /* @__PURE__ */
|
|
54965
|
+
/* @__PURE__ */ jsx177(EntityGrid, { entity, pageSize, embedded: presentation === "embedded", ...drill ? { drill } : {} }),
|
|
54966
|
+
entity.hasMore ? /* @__PURE__ */ jsx177(
|
|
54824
54967
|
MatrxTableCardShowMore3,
|
|
54825
54968
|
{
|
|
54826
54969
|
shown: entity.rows.length,
|
|
@@ -54834,12 +54977,12 @@ function EntityTablePageBody({
|
|
|
54834
54977
|
}
|
|
54835
54978
|
|
|
54836
54979
|
// src/TablePageSource.tsx
|
|
54837
|
-
import { jsx as
|
|
54980
|
+
import { jsx as jsx178 } from "react/jsx-runtime";
|
|
54838
54981
|
function TablePage2(props) {
|
|
54839
|
-
if (props.source === void 0) return /* @__PURE__ */
|
|
54982
|
+
if (props.source === void 0) return /* @__PURE__ */ jsx178(TablePage, { ...props });
|
|
54840
54983
|
const { source, layout, onLayoutChange, groupBy, onOpenRecord, ...rest } = props;
|
|
54841
|
-
if (source.kind === "table") return /* @__PURE__ */
|
|
54842
|
-
return /* @__PURE__ */
|
|
54984
|
+
if (source.kind === "table") return /* @__PURE__ */ jsx178(TablePage, { ...rest, tableId: source.id });
|
|
54985
|
+
return /* @__PURE__ */ jsx178(
|
|
54843
54986
|
EntityTablePage,
|
|
54844
54987
|
{
|
|
54845
54988
|
source,
|
|
@@ -54861,8 +55004,8 @@ function TablePage2(props) {
|
|
|
54861
55004
|
import { useEffect as useEffect126, useMemo as useMemo84 } from "react";
|
|
54862
55005
|
import { isEntityReferenceConfig } from "@ai-matrx/records";
|
|
54863
55006
|
import { useFields as useFields40, useTable as useTable41 } from "@ai-matrx/records/react";
|
|
54864
|
-
import { BasicInput as BasicInput36, Button as
|
|
54865
|
-
import { jsx as
|
|
55007
|
+
import { BasicInput as BasicInput36, Button as Button122, CreatablePicker as CreatablePicker3, cn as cn102 } from "@ai-matrx/design-system";
|
|
55008
|
+
import { jsx as jsx179, jsxs as jsxs166 } from "react/jsx-runtime";
|
|
54866
55009
|
var DATA_BINDING_SHAPES = [
|
|
54867
55010
|
{ value: "collection", label: "The whole table" },
|
|
54868
55011
|
{ value: "reference", label: "One record" },
|
|
@@ -54929,9 +55072,9 @@ function DataBindingPicker({ dataSource, userId, binding, onChange, disabled, de
|
|
|
54929
55072
|
...binding.semantic_type === "collection" && defaultRowLimit ? { limit: defaultRowLimit } : {}
|
|
54930
55073
|
});
|
|
54931
55074
|
};
|
|
54932
|
-
return /* @__PURE__ */
|
|
54933
|
-
/* @__PURE__ */
|
|
54934
|
-
/* @__PURE__ */
|
|
55075
|
+
return /* @__PURE__ */ jsxs166("div", { className: "flex flex-col gap-2", children: [
|
|
55076
|
+
/* @__PURE__ */ jsx179(TablePicker, { dataSource, value: tableId, onChange: selectTable, disabled: Boolean(disabled), tables }),
|
|
55077
|
+
/* @__PURE__ */ jsx179(TableScope, { dataSource, userId, tableId, tables, children: tableId && /* @__PURE__ */ jsx179(
|
|
54935
55078
|
BindingDetails,
|
|
54936
55079
|
{
|
|
54937
55080
|
tableId,
|
|
@@ -54995,9 +55138,9 @@ function BindingDetails({
|
|
|
54995
55138
|
const fieldOptions = fieldList.map((f) => ({ value: f.key, label: fieldName(f) }));
|
|
54996
55139
|
const template = binding.transform?.template ?? "";
|
|
54997
55140
|
const setTemplate = (next) => onChange({ ...binding, transform: { join: "\n", ...binding.transform, name: "list", template: next } });
|
|
54998
|
-
return /* @__PURE__ */
|
|
54999
|
-
/* @__PURE__ */
|
|
55000
|
-
|
|
55141
|
+
return /* @__PURE__ */ jsxs166("div", { className: "flex flex-col gap-2", children: [
|
|
55142
|
+
/* @__PURE__ */ jsx179("div", { className: "flex flex-wrap gap-1", role: "radiogroup", "aria-label": "What to read", children: DATA_BINDING_SHAPES.map((s) => /* @__PURE__ */ jsx179(
|
|
55143
|
+
Button122,
|
|
55001
55144
|
{
|
|
55002
55145
|
type: "button",
|
|
55003
55146
|
size: "sm",
|
|
@@ -55010,7 +55153,7 @@ function BindingDetails({
|
|
|
55010
55153
|
},
|
|
55011
55154
|
s.value
|
|
55012
55155
|
)) }),
|
|
55013
|
-
shape !== "collection" && /* @__PURE__ */
|
|
55156
|
+
shape !== "collection" && /* @__PURE__ */ jsx179(
|
|
55014
55157
|
RecordPicker,
|
|
55015
55158
|
{
|
|
55016
55159
|
tableId,
|
|
@@ -55019,7 +55162,7 @@ function BindingDetails({
|
|
|
55019
55162
|
disabled: Boolean(disabled)
|
|
55020
55163
|
}
|
|
55021
55164
|
),
|
|
55022
|
-
shape === "value" && /* @__PURE__ */
|
|
55165
|
+
shape === "value" && /* @__PURE__ */ jsx179(
|
|
55023
55166
|
CreatablePicker3,
|
|
55024
55167
|
{
|
|
55025
55168
|
value: binding.field_key ?? null,
|
|
@@ -55033,8 +55176,8 @@ function BindingDetails({
|
|
|
55033
55176
|
ariaLabel: "Column"
|
|
55034
55177
|
}
|
|
55035
55178
|
),
|
|
55036
|
-
shape !== "value" && /* @__PURE__ */
|
|
55037
|
-
/* @__PURE__ */
|
|
55179
|
+
shape !== "value" && /* @__PURE__ */ jsxs166("div", { className: "flex flex-col gap-1", children: [
|
|
55180
|
+
/* @__PURE__ */ jsx179(
|
|
55038
55181
|
"textarea",
|
|
55039
55182
|
{
|
|
55040
55183
|
className: cn102(
|
|
@@ -55046,8 +55189,8 @@ function BindingDetails({
|
|
|
55046
55189
|
onChange: (e) => setTemplate(e.target.value)
|
|
55047
55190
|
}
|
|
55048
55191
|
),
|
|
55049
|
-
!disabled && /* @__PURE__ */
|
|
55050
|
-
|
|
55192
|
+
!disabled && /* @__PURE__ */ jsx179("div", { className: "flex flex-wrap gap-1", children: fieldList.flatMap(bindingPlaceholdersFor).map((p) => /* @__PURE__ */ jsx179(
|
|
55193
|
+
Button122,
|
|
55051
55194
|
{
|
|
55052
55195
|
type: "button",
|
|
55053
55196
|
size: "sm",
|
|
@@ -55059,9 +55202,9 @@ function BindingDetails({
|
|
|
55059
55202
|
p.token
|
|
55060
55203
|
)) })
|
|
55061
55204
|
] }),
|
|
55062
|
-
shape === "collection" && /* @__PURE__ */
|
|
55205
|
+
shape === "collection" && /* @__PURE__ */ jsxs166("label", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
|
|
55063
55206
|
"Up to",
|
|
55064
|
-
/* @__PURE__ */
|
|
55207
|
+
/* @__PURE__ */ jsx179(
|
|
55065
55208
|
BasicInput36,
|
|
55066
55209
|
{
|
|
55067
55210
|
type: "number",
|
|
@@ -55078,10 +55221,10 @@ function BindingDetails({
|
|
|
55078
55221
|
),
|
|
55079
55222
|
"rows"
|
|
55080
55223
|
] }),
|
|
55081
|
-
/* @__PURE__ */
|
|
55082
|
-
/* @__PURE__ */
|
|
55083
|
-
DATA_BINDING_MISSING.map((m) => /* @__PURE__ */
|
|
55084
|
-
|
|
55224
|
+
/* @__PURE__ */ jsxs166("div", { className: "flex flex-wrap items-center gap-1", role: "radiogroup", "aria-label": "If nothing is found", children: [
|
|
55225
|
+
/* @__PURE__ */ jsx179("span", { className: "text-xs text-muted-foreground", children: "If nothing is found" }),
|
|
55226
|
+
DATA_BINDING_MISSING.map((m) => /* @__PURE__ */ jsx179(
|
|
55227
|
+
Button122,
|
|
55085
55228
|
{
|
|
55086
55229
|
type: "button",
|
|
55087
55230
|
size: "sm",
|
|
@@ -55100,13 +55243,13 @@ function BindingDetails({
|
|
|
55100
55243
|
|
|
55101
55244
|
// src/PickedSummaries.tsx
|
|
55102
55245
|
import { useFields as useFields41, useRecord as useRecord6, useTable as useTable42 } from "@ai-matrx/records/react";
|
|
55103
|
-
import { Fragment as Fragment73, jsx as
|
|
55246
|
+
import { Fragment as Fragment73, jsx as jsx180, jsxs as jsxs167 } from "react/jsx-runtime";
|
|
55104
55247
|
function TableNameText({ dataSource, tableId }) {
|
|
55105
55248
|
const tables = useTablesAnywhere(dataSource);
|
|
55106
|
-
if (!tableId) return /* @__PURE__ */
|
|
55107
|
-
if (tables.loading) return /* @__PURE__ */
|
|
55108
|
-
if (tables.error) return /* @__PURE__ */
|
|
55109
|
-
return /* @__PURE__ */
|
|
55249
|
+
if (!tableId) return /* @__PURE__ */ jsx180(Fragment73, { children: "\u2014" });
|
|
55250
|
+
if (tables.loading) return /* @__PURE__ */ jsx180(Fragment73, { children: "\u2026" });
|
|
55251
|
+
if (tables.error) return /* @__PURE__ */ jsx180(Fragment73, { children: "Couldn't load the table's name" });
|
|
55252
|
+
return /* @__PURE__ */ jsx180(Fragment73, { children: tables.rows.find((t) => t.table_id === tableId)?.table_name ?? "\u2014" });
|
|
55110
55253
|
}
|
|
55111
55254
|
function ColumnValuesText({
|
|
55112
55255
|
dataSource,
|
|
@@ -55114,38 +55257,38 @@ function ColumnValuesText({
|
|
|
55114
55257
|
tableId,
|
|
55115
55258
|
value
|
|
55116
55259
|
}) {
|
|
55117
|
-
if (!tableId) return /* @__PURE__ */
|
|
55118
|
-
return /* @__PURE__ */
|
|
55260
|
+
if (!tableId) return /* @__PURE__ */ jsx180(Fragment73, { children: "\u2014" });
|
|
55261
|
+
return /* @__PURE__ */ jsx180(
|
|
55119
55262
|
TableScope,
|
|
55120
55263
|
{
|
|
55121
55264
|
dataSource,
|
|
55122
55265
|
userId,
|
|
55123
55266
|
tableId,
|
|
55124
|
-
fallback: /* @__PURE__ */
|
|
55125
|
-
unavailable: /* @__PURE__ */
|
|
55126
|
-
children: /* @__PURE__ */
|
|
55267
|
+
fallback: /* @__PURE__ */ jsx180(Fragment73, { children: "\u2026" }),
|
|
55268
|
+
unavailable: /* @__PURE__ */ jsx180(Fragment73, { children: "Couldn't load this table's columns" }),
|
|
55269
|
+
children: /* @__PURE__ */ jsx180(RecordLabelProvider, { children: /* @__PURE__ */ jsx180(ColumnValuesWords, { tableId, value }) })
|
|
55127
55270
|
}
|
|
55128
55271
|
);
|
|
55129
55272
|
}
|
|
55130
55273
|
function ColumnValuesWords({ tableId, value }) {
|
|
55131
55274
|
const fields = useFields41(tableId);
|
|
55132
55275
|
const labels = useRecordLabels(fields.data ?? void 0);
|
|
55133
|
-
if (fields.loading) return /* @__PURE__ */
|
|
55134
|
-
if (fields.error) return /* @__PURE__ */
|
|
55276
|
+
if (fields.loading) return /* @__PURE__ */ jsx180(Fragment73, { children: "\u2026" });
|
|
55277
|
+
if (fields.error) return /* @__PURE__ */ jsx180(Fragment73, { children: "Couldn't load this table's columns" });
|
|
55135
55278
|
const parts = [];
|
|
55136
55279
|
for (const [key, stored] of Object.entries(value)) {
|
|
55137
55280
|
if (key.startsWith("_")) continue;
|
|
55138
55281
|
const field2 = (fields.data ?? []).find((f) => f.key === key);
|
|
55139
|
-
if (parts.length) parts.push(/* @__PURE__ */
|
|
55282
|
+
if (parts.length) parts.push(/* @__PURE__ */ jsx180("span", { children: ", " }, `${key}-sep`));
|
|
55140
55283
|
parts.push(
|
|
55141
|
-
/* @__PURE__ */
|
|
55284
|
+
/* @__PURE__ */ jsxs167("span", { children: [
|
|
55142
55285
|
field2 ? fieldName(field2) : "A removed column",
|
|
55143
55286
|
" is ",
|
|
55144
55287
|
field2 ? renderValue(field2, stored, void 0, labels) : "\u2014"
|
|
55145
55288
|
] }, key)
|
|
55146
55289
|
);
|
|
55147
55290
|
}
|
|
55148
|
-
return parts.length ? /* @__PURE__ */
|
|
55291
|
+
return parts.length ? /* @__PURE__ */ jsx180(Fragment73, { children: parts }) : /* @__PURE__ */ jsx180(Fragment73, { children: "\u2014" });
|
|
55149
55292
|
}
|
|
55150
55293
|
function RecordNameText({
|
|
55151
55294
|
dataSource,
|
|
@@ -55153,35 +55296,35 @@ function RecordNameText({
|
|
|
55153
55296
|
tableId,
|
|
55154
55297
|
recordId
|
|
55155
55298
|
}) {
|
|
55156
|
-
if (!tableId || !recordId) return /* @__PURE__ */
|
|
55157
|
-
return /* @__PURE__ */
|
|
55299
|
+
if (!tableId || !recordId) return /* @__PURE__ */ jsx180(Fragment73, { children: "\u2014" });
|
|
55300
|
+
return /* @__PURE__ */ jsx180(
|
|
55158
55301
|
TableScope,
|
|
55159
55302
|
{
|
|
55160
55303
|
dataSource,
|
|
55161
55304
|
userId,
|
|
55162
55305
|
tableId,
|
|
55163
|
-
fallback: /* @__PURE__ */
|
|
55164
|
-
unavailable: /* @__PURE__ */
|
|
55165
|
-
children: /* @__PURE__ */
|
|
55306
|
+
fallback: /* @__PURE__ */ jsx180(Fragment73, { children: "\u2026" }),
|
|
55307
|
+
unavailable: /* @__PURE__ */ jsx180(Fragment73, { children: "Couldn't load this record" }),
|
|
55308
|
+
children: /* @__PURE__ */ jsx180(RecordNameWords, { tableId, recordId })
|
|
55166
55309
|
}
|
|
55167
55310
|
);
|
|
55168
55311
|
}
|
|
55169
55312
|
function RecordNameWords({ tableId, recordId }) {
|
|
55170
55313
|
const table = useTable42(tableId);
|
|
55171
55314
|
const record = useRecord6(recordId);
|
|
55172
|
-
if (record.loading || table.loading) return /* @__PURE__ */
|
|
55173
|
-
if (record.error) return /* @__PURE__ */
|
|
55174
|
-
if (!record.data) return /* @__PURE__ */
|
|
55175
|
-
return /* @__PURE__ */
|
|
55315
|
+
if (record.loading || table.loading) return /* @__PURE__ */ jsx180(Fragment73, { children: "\u2026" });
|
|
55316
|
+
if (record.error) return /* @__PURE__ */ jsx180(Fragment73, { children: "Couldn't load this record" });
|
|
55317
|
+
if (!record.data) return /* @__PURE__ */ jsx180(Fragment73, { children: "A record you cannot open" });
|
|
55318
|
+
return /* @__PURE__ */ jsx180(Fragment73, { children: recordName(record.data.document, table.data?.title_field ?? null) });
|
|
55176
55319
|
}
|
|
55177
55320
|
|
|
55178
55321
|
// src/HeldChangeDecision.tsx
|
|
55179
55322
|
import { useEffect as useEffect127, useState as useState152 } from "react";
|
|
55180
55323
|
import { RecordsProvider as RecordsProvider3, useRecordsClient as useRecordsClient108 } from "@ai-matrx/records/react";
|
|
55181
|
-
import { Button as
|
|
55182
|
-
import { jsx as
|
|
55324
|
+
import { Button as Button123 } from "@ai-matrx/design-system";
|
|
55325
|
+
import { jsx as jsx181, jsxs as jsxs168 } from "react/jsx-runtime";
|
|
55183
55326
|
function HeldChangeDecision({ dataSource, userId, organizationId, approvalId, onDecided, approveLabel }) {
|
|
55184
|
-
return /* @__PURE__ */
|
|
55327
|
+
return /* @__PURE__ */ jsx181(RecordsProvider3, { config: { dataSource, actor: personActor(userId), organizationId }, children: /* @__PURE__ */ jsx181(Decision, { approvalId, onDecided, approveLabel: approveLabel ?? "Approve" }) });
|
|
55185
55328
|
}
|
|
55186
55329
|
function Decision({
|
|
55187
55330
|
approvalId,
|
|
@@ -55214,20 +55357,20 @@ function Decision({
|
|
|
55214
55357
|
if (res.ok) onDecided(approve);
|
|
55215
55358
|
else setError(res.error);
|
|
55216
55359
|
};
|
|
55217
|
-
if (may === null) return /* @__PURE__ */
|
|
55218
|
-
return /* @__PURE__ */
|
|
55219
|
-
may ? /* @__PURE__ */
|
|
55220
|
-
/* @__PURE__ */
|
|
55221
|
-
/* @__PURE__ */
|
|
55222
|
-
] }) : !error && /* @__PURE__ */
|
|
55223
|
-
error ? /* @__PURE__ */
|
|
55360
|
+
if (may === null) return /* @__PURE__ */ jsx181("p", { className: "text-xs text-muted-foreground", children: "Checking who can decide\u2026" });
|
|
55361
|
+
return /* @__PURE__ */ jsxs168("div", { className: "flex flex-col gap-1.5", children: [
|
|
55362
|
+
may ? /* @__PURE__ */ jsxs168("div", { className: "flex gap-2", children: [
|
|
55363
|
+
/* @__PURE__ */ jsx181(Button123, { type: "button", size: "sm", disabled: busy !== null, onClick: () => void decide(true), children: busy === "approve" ? "Approving\u2026" : approveLabel }),
|
|
55364
|
+
/* @__PURE__ */ jsx181(Button123, { type: "button", size: "sm", variant: "outline", disabled: busy !== null, onClick: () => void decide(false), children: busy === "refuse" ? "Refusing\u2026" : "Refuse" })
|
|
55365
|
+
] }) : !error && /* @__PURE__ */ jsx181("p", { className: "text-xs text-muted-foreground", children: "An owner or admin of this organization decides this." }),
|
|
55366
|
+
error ? /* @__PURE__ */ jsx181(RefusalLine, { error }) : null
|
|
55224
55367
|
] });
|
|
55225
55368
|
}
|
|
55226
55369
|
|
|
55227
55370
|
// src/CalendarLinks.tsx
|
|
55228
55371
|
import { useCallback as useCallback71, useEffect as useEffect128, useState as useState153 } from "react";
|
|
55229
|
-
import { Button as
|
|
55230
|
-
import { jsx as
|
|
55372
|
+
import { Button as Button124 } from "@ai-matrx/design-system";
|
|
55373
|
+
import { jsx as jsx182, jsxs as jsxs169 } from "react/jsx-runtime";
|
|
55231
55374
|
var day = (iso) => iso ? new Date(iso).toLocaleDateString(void 0, { year: "numeric", month: "short", day: "numeric" }) : null;
|
|
55232
55375
|
function CalendarLinks({ port }) {
|
|
55233
55376
|
const [rows, setRows] = useState153(null);
|
|
@@ -55252,15 +55395,15 @@ function CalendarLinks({ port }) {
|
|
|
55252
55395
|
setError(asRefusal3(e, "That didn\u2019t work"));
|
|
55253
55396
|
}
|
|
55254
55397
|
};
|
|
55255
|
-
if (rows === null && !error) return /* @__PURE__ */
|
|
55256
|
-
return /* @__PURE__ */
|
|
55257
|
-
error ? /* @__PURE__ */
|
|
55258
|
-
rows && rows.length === 0 ? /* @__PURE__ */
|
|
55259
|
-
rows?.map((row) => /* @__PURE__ */
|
|
55260
|
-
/* @__PURE__ */
|
|
55261
|
-
/* @__PURE__ */
|
|
55262
|
-
/* @__PURE__ */
|
|
55263
|
-
/* @__PURE__ */
|
|
55398
|
+
if (rows === null && !error) return /* @__PURE__ */ jsx182("p", { className: "text-sm text-muted-foreground", "data-calendar-links-loading": "", children: "Reading your links\u2026" });
|
|
55399
|
+
return /* @__PURE__ */ jsxs169("div", { className: "flex flex-col gap-2", "data-calendar-links": "", children: [
|
|
55400
|
+
error ? /* @__PURE__ */ jsx182(RefusalNotice, { error }) : null,
|
|
55401
|
+
rows && rows.length === 0 ? /* @__PURE__ */ jsx182("p", { className: "text-sm text-muted-foreground", children: "No calendar links yet." }) : null,
|
|
55402
|
+
rows?.map((row) => /* @__PURE__ */ jsxs169("div", { className: "flex flex-col gap-2 rounded-md border px-3 py-2", "data-calendar-link-row": row.id, children: [
|
|
55403
|
+
/* @__PURE__ */ jsxs169("div", { className: "flex flex-wrap items-center justify-between gap-2", children: [
|
|
55404
|
+
/* @__PURE__ */ jsxs169("div", { className: "min-w-0", children: [
|
|
55405
|
+
/* @__PURE__ */ jsx182("div", { className: "truncate text-sm font-medium", children: row.title }),
|
|
55406
|
+
/* @__PURE__ */ jsxs169("div", { className: "text-xs text-muted-foreground", children: [
|
|
55264
55407
|
"Made ",
|
|
55265
55408
|
day(row.created_at),
|
|
55266
55409
|
" \xB7 ",
|
|
@@ -55269,9 +55412,9 @@ function CalendarLinks({ port }) {
|
|
|
55269
55412
|
row.expired ? "Expired" : row.expires_at ? `Expires ${day(row.expires_at)}` : "Never expires"
|
|
55270
55413
|
] })
|
|
55271
55414
|
] }),
|
|
55272
|
-
/* @__PURE__ */
|
|
55273
|
-
/* @__PURE__ */
|
|
55274
|
-
|
|
55415
|
+
/* @__PURE__ */ jsxs169("div", { className: "flex shrink-0 gap-2", children: [
|
|
55416
|
+
/* @__PURE__ */ jsx182(
|
|
55417
|
+
Button124,
|
|
55275
55418
|
{
|
|
55276
55419
|
size: "sm",
|
|
55277
55420
|
variant: "outline",
|
|
@@ -55284,8 +55427,8 @@ function CalendarLinks({ port }) {
|
|
|
55284
55427
|
children: "Rotate"
|
|
55285
55428
|
}
|
|
55286
55429
|
),
|
|
55287
|
-
/* @__PURE__ */
|
|
55288
|
-
|
|
55430
|
+
/* @__PURE__ */ jsx182(
|
|
55431
|
+
Button124,
|
|
55289
55432
|
{
|
|
55290
55433
|
size: "sm",
|
|
55291
55434
|
variant: "outline",
|
|
@@ -55300,7 +55443,7 @@ function CalendarLinks({ port }) {
|
|
|
55300
55443
|
)
|
|
55301
55444
|
] })
|
|
55302
55445
|
] }),
|
|
55303
|
-
fresh?.id === row.id ? /* @__PURE__ */
|
|
55446
|
+
fresh?.id === row.id ? /* @__PURE__ */ jsx182(CalendarLinkOnce, { url: fresh.url }) : null
|
|
55304
55447
|
] }, row.id))
|
|
55305
55448
|
] });
|
|
55306
55449
|
}
|
|
@@ -55310,7 +55453,7 @@ import { useEffect as useEffect129, useMemo as useMemo85, useState as useState15
|
|
|
55310
55453
|
import { templatePreview } from "@ai-matrx/records/memory";
|
|
55311
55454
|
import { useRecordsClient as useRecordsClient109 } from "@ai-matrx/records/react";
|
|
55312
55455
|
import { formFromSummary as formFromSummary3 } from "@ai-matrx/records/forms";
|
|
55313
|
-
import { jsx as
|
|
55456
|
+
import { jsx as jsx183, jsxs as jsxs170 } from "react/jsx-runtime";
|
|
55314
55457
|
function useTemplatePreview(spec, today) {
|
|
55315
55458
|
return useMemo85(() => templatePreview(spec, today ? { today } : {}), [spec, today]);
|
|
55316
55459
|
}
|
|
@@ -55321,9 +55464,9 @@ function TemplatePreview({ spec, today, initialTable, host, aside, booking, clas
|
|
|
55321
55464
|
const [active, setActive] = useState154(first?.id ?? null);
|
|
55322
55465
|
const table = preview.tables.find((t) => t.id === active) ?? first;
|
|
55323
55466
|
if (!table) return null;
|
|
55324
|
-
return /* @__PURE__ */
|
|
55325
|
-
preview.tables.length > 1 || aside ? /* @__PURE__ */
|
|
55326
|
-
preview.tables.map((t) => /* @__PURE__ */
|
|
55467
|
+
return /* @__PURE__ */ jsxs170("div", { className: ["flex min-w-0 flex-col gap-3", className].filter(Boolean).join(" "), "data-template-preview": preview.tables.length, children: [
|
|
55468
|
+
preview.tables.length > 1 || aside ? /* @__PURE__ */ jsxs170("div", { className: "flex min-w-0 flex-wrap items-center gap-1.5", role: "tablist", "aria-label": "Tables", children: [
|
|
55469
|
+
preview.tables.map((t) => /* @__PURE__ */ jsxs170(
|
|
55327
55470
|
"button",
|
|
55328
55471
|
{
|
|
55329
55472
|
type: "button",
|
|
@@ -55337,19 +55480,19 @@ function TemplatePreview({ spec, today, initialTable, host, aside, booking, clas
|
|
|
55337
55480
|
].join(" "),
|
|
55338
55481
|
children: [
|
|
55339
55482
|
t.name,
|
|
55340
|
-
/* @__PURE__ */
|
|
55483
|
+
/* @__PURE__ */ jsx183("span", { className: "text-xs tabular-nums text-muted-foreground", children: t.rows })
|
|
55341
55484
|
]
|
|
55342
55485
|
},
|
|
55343
55486
|
t.id
|
|
55344
55487
|
)),
|
|
55345
|
-
aside ? /* @__PURE__ */
|
|
55488
|
+
aside ? /* @__PURE__ */ jsx183("div", { className: "ml-auto", children: aside }) : null
|
|
55346
55489
|
] }) : null,
|
|
55347
|
-
/* @__PURE__ */
|
|
55348
|
-
/* @__PURE__ */
|
|
55349
|
-
/* @__PURE__ */
|
|
55350
|
-
preview.dashboards.length ? /* @__PURE__ */
|
|
55351
|
-
/* @__PURE__ */
|
|
55352
|
-
preview.dashboards.map((d) => /* @__PURE__ */
|
|
55490
|
+
/* @__PURE__ */ jsxs170(RecordsMount, { config: preview.config, host: bound2, children: [
|
|
55491
|
+
/* @__PURE__ */ jsx183("div", { className: "min-h-[32rem] min-w-0 overflow-hidden rounded-xl border border-border bg-card", children: /* @__PURE__ */ jsx183(TablePage, { tableId: table.id }, table.id) }),
|
|
55492
|
+
/* @__PURE__ */ jsx183(PreviewForms, { preview, booking }),
|
|
55493
|
+
preview.dashboards.length ? /* @__PURE__ */ jsxs170("section", { className: "flex min-w-0 flex-col gap-3", "aria-label": "Dashboards", "data-template-preview-dashboards": preview.dashboards.length, children: [
|
|
55494
|
+
/* @__PURE__ */ jsx183("h2", { className: "text-lg font-semibold tracking-tight", children: "Dashboards" }),
|
|
55495
|
+
preview.dashboards.map((d) => /* @__PURE__ */ jsx183("div", { className: "min-w-0 overflow-hidden rounded-xl border border-border bg-card p-3", "data-template-preview-dashboard": d.token, children: /* @__PURE__ */ jsx183(DashboardCanvas, { tableId: d.tableId, activeDashboardId: d.id }) }, d.id))
|
|
55353
55496
|
] }) : null
|
|
55354
55497
|
] })
|
|
55355
55498
|
] });
|
|
@@ -55377,14 +55520,14 @@ function PreviewForms({ preview, booking }) {
|
|
|
55377
55520
|
};
|
|
55378
55521
|
}, [client, preview, booking]);
|
|
55379
55522
|
if (!forms?.length && !pages.length) return null;
|
|
55380
|
-
return /* @__PURE__ */
|
|
55381
|
-
/* @__PURE__ */
|
|
55382
|
-
/* @__PURE__ */
|
|
55383
|
-
/* @__PURE__ */
|
|
55384
|
-
/* @__PURE__ */
|
|
55523
|
+
return /* @__PURE__ */ jsxs170("section", { className: "flex min-w-0 flex-col gap-3", "aria-label": "Forms and booking", "data-template-preview-forms": forms?.length ?? 0, children: [
|
|
55524
|
+
/* @__PURE__ */ jsx183("h2", { className: "text-lg font-semibold tracking-tight", children: "Forms and booking" }),
|
|
55525
|
+
/* @__PURE__ */ jsx183("div", { className: "grid min-w-0 gap-4 md:grid-cols-2", children: (forms ?? []).map((f) => /* @__PURE__ */ jsxs170("div", { className: "min-w-0 rounded-xl border border-border bg-card p-4", "data-template-preview-form": f.slug ?? f.id, children: [
|
|
55526
|
+
/* @__PURE__ */ jsx183("h3", { className: "mb-3 text-sm font-semibold", children: f.name }),
|
|
55527
|
+
/* @__PURE__ */ jsx183(FormRunner, { form: f, preview: true })
|
|
55385
55528
|
] }, f.id)) }),
|
|
55386
|
-
booking ? pages.map((p) => /* @__PURE__ */
|
|
55387
|
-
/* @__PURE__ */
|
|
55529
|
+
booking ? pages.map((p) => /* @__PURE__ */ jsxs170("div", { className: "min-w-0 rounded-xl border border-border bg-card p-4", "data-template-preview-booking": p.id, children: [
|
|
55530
|
+
/* @__PURE__ */ jsx183("h3", { className: "mb-3 text-sm font-semibold", children: String(p.page["title"] ?? "") }),
|
|
55388
55531
|
booking(p.page)
|
|
55389
55532
|
] }, p.id)) : null
|
|
55390
55533
|
] });
|