@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.cjs
CHANGED
|
@@ -25702,6 +25702,7 @@ function GridBody({
|
|
|
25702
25702
|
onOpenRecord,
|
|
25703
25703
|
openRecordId = null,
|
|
25704
25704
|
onCloseRecord,
|
|
25705
|
+
onRowsShown,
|
|
25705
25706
|
onAddField,
|
|
25706
25707
|
onNewRecordForm,
|
|
25707
25708
|
toolbarActions,
|
|
@@ -25982,6 +25983,11 @@ function GridBody({
|
|
|
25982
25983
|
const rows = added.rows;
|
|
25983
25984
|
const lockedRows = records.data?.locked ?? 0;
|
|
25984
25985
|
const rowIds = (0, import_react143.useMemo)(() => rows.map((row) => row.id), [rows]);
|
|
25986
|
+
const rowsShownRef = (0, import_react143.useRef)(onRowsShown);
|
|
25987
|
+
rowsShownRef.current = onRowsShown;
|
|
25988
|
+
(0, import_react143.useEffect)(() => {
|
|
25989
|
+
rowsShownRef.current?.(rowIds);
|
|
25990
|
+
}, [rowIds]);
|
|
25985
25991
|
const countedButNotReturned = !records.error && !records.loading && rows.length === 0 && typeof records.data?.total === "number" && records.data.total > 0 && (storePaged ? query.page <= 1 : page <= 0);
|
|
25986
25992
|
const reReads = (0, import_react143.useRef)(0);
|
|
25987
25993
|
const reloadRecords = (0, import_react143.useRef)(records.reload);
|
|
@@ -38277,6 +38283,7 @@ function ViewSwitcher({
|
|
|
38277
38283
|
onOpenRecord,
|
|
38278
38284
|
openRecordId,
|
|
38279
38285
|
onCloseRecord,
|
|
38286
|
+
onRowsShown,
|
|
38280
38287
|
onMoved,
|
|
38281
38288
|
onNewRecordForm,
|
|
38282
38289
|
onAskWhoChanged,
|
|
@@ -38354,6 +38361,7 @@ function ViewSwitcher({
|
|
|
38354
38361
|
...onOpenRecord ? { onOpenRecord } : {},
|
|
38355
38362
|
...openRecordId ? { openRecordId } : {},
|
|
38356
38363
|
...onCloseRecord ? { onCloseRecord } : {},
|
|
38364
|
+
...onRowsShown ? { onRowsShown } : {},
|
|
38357
38365
|
...onNewRecordForm ? { onNewRecordForm } : {},
|
|
38358
38366
|
...onAskWhoChanged ? { onAskWhoChanged } : {},
|
|
38359
38367
|
...viewId ? {
|
|
@@ -52182,7 +52190,7 @@ var import_clipboard17 = require("@ai-matrx/kit/clipboard");
|
|
|
52182
52190
|
var import_react311 = require("react");
|
|
52183
52191
|
var import_records74 = require("@ai-matrx/records");
|
|
52184
52192
|
var import_react312 = require("@ai-matrx/records/react");
|
|
52185
|
-
var
|
|
52193
|
+
var import_design_system158 = require("@ai-matrx/design-system");
|
|
52186
52194
|
var import_text_case22 = require("@ai-matrx/kit/text-case");
|
|
52187
52195
|
|
|
52188
52196
|
// src/calendarFeed.ts
|
|
@@ -52427,42 +52435,143 @@ async function runTablePageAction(kind, args) {
|
|
|
52427
52435
|
}
|
|
52428
52436
|
}
|
|
52429
52437
|
|
|
52430
|
-
// src/
|
|
52431
|
-
var import_react302 = require("react");
|
|
52438
|
+
// src/RecordStepper.tsx
|
|
52432
52439
|
var import_design_system151 = require("@ai-matrx/design-system");
|
|
52433
|
-
var import_react303 = require("@ai-matrx/records/react");
|
|
52434
52440
|
var import_jsx_runtime169 = require("react/jsx-runtime");
|
|
52435
|
-
function
|
|
52436
|
-
const
|
|
52437
|
-
|
|
52438
|
-
return
|
|
52439
|
-
|
|
52440
|
-
|
|
52441
|
-
|
|
52442
|
-
|
|
52443
|
-
|
|
52444
|
-
|
|
52445
|
-
|
|
52446
|
-
|
|
52441
|
+
function neighborsOf(ids, id) {
|
|
52442
|
+
const index = ids.indexOf(id);
|
|
52443
|
+
if (index < 0) return null;
|
|
52444
|
+
return {
|
|
52445
|
+
index,
|
|
52446
|
+
total: ids.length,
|
|
52447
|
+
previous: index > 0 ? ids[index - 1] : null,
|
|
52448
|
+
next: index < ids.length - 1 ? ids[index + 1] : null
|
|
52449
|
+
};
|
|
52450
|
+
}
|
|
52451
|
+
var TEXT_TAGS = /* @__PURE__ */ new Set(["INPUT", "TEXTAREA", "SELECT"]);
|
|
52452
|
+
function stepKeyOf(event) {
|
|
52453
|
+
if (event.defaultPrevented || event.metaKey || event.ctrlKey || event.altKey || event.shiftKey) return null;
|
|
52454
|
+
if (event.key !== "ArrowUp" && event.key !== "ArrowDown") return null;
|
|
52455
|
+
const target = event.target;
|
|
52456
|
+
if (target) {
|
|
52457
|
+
if (TEXT_TAGS.has(target.tagName) || target.isContentEditable) return null;
|
|
52458
|
+
const role = target.getAttribute?.("role");
|
|
52459
|
+
if (role === "combobox" || role === "listbox" || role === "option" || role === "slider" || role === "spinbutton") return null;
|
|
52460
|
+
}
|
|
52461
|
+
return event.key === "ArrowUp" ? -1 : 1;
|
|
52462
|
+
}
|
|
52463
|
+
function RecordStepper({ neighbors, onStep, expanded, onToggleExpand }) {
|
|
52464
|
+
return /* @__PURE__ */ (0, import_jsx_runtime169.jsxs)("div", { className: "flex items-center gap-1", "data-record-stepper": "", children: [
|
|
52447
52465
|
/* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
|
|
52448
|
-
|
|
52466
|
+
import_design_system151.Button,
|
|
52449
52467
|
{
|
|
52450
|
-
|
|
52451
|
-
|
|
52452
|
-
|
|
52468
|
+
size: "sm",
|
|
52469
|
+
variant: "ghost",
|
|
52470
|
+
className: "h-7 w-7 p-0",
|
|
52471
|
+
"aria-label": "Previous record",
|
|
52472
|
+
title: "Previous record (\u2191)",
|
|
52473
|
+
disabled: neighbors.previous === null,
|
|
52474
|
+
onClick: () => neighbors.previous && onStep(neighbors.previous),
|
|
52475
|
+
"data-record-previous": "",
|
|
52476
|
+
children: "\u2191"
|
|
52453
52477
|
}
|
|
52454
52478
|
),
|
|
52455
|
-
|
|
52456
|
-
|
|
52457
|
-
|
|
52458
|
-
|
|
52459
|
-
|
|
52460
|
-
|
|
52461
|
-
|
|
52462
|
-
|
|
52463
|
-
|
|
52479
|
+
/* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
|
|
52480
|
+
import_design_system151.Button,
|
|
52481
|
+
{
|
|
52482
|
+
size: "sm",
|
|
52483
|
+
variant: "ghost",
|
|
52484
|
+
className: "h-7 w-7 p-0",
|
|
52485
|
+
"aria-label": "Next record",
|
|
52486
|
+
title: "Next record (\u2193)",
|
|
52487
|
+
disabled: neighbors.next === null,
|
|
52488
|
+
onClick: () => neighbors.next && onStep(neighbors.next),
|
|
52489
|
+
"data-record-next": "",
|
|
52490
|
+
children: "\u2193"
|
|
52491
|
+
}
|
|
52492
|
+
),
|
|
52493
|
+
/* @__PURE__ */ (0, import_jsx_runtime169.jsxs)("span", { className: "text-[11px] tabular-nums text-muted-foreground", "data-record-position": "", children: [
|
|
52494
|
+
neighbors.index + 1,
|
|
52495
|
+
" of ",
|
|
52496
|
+
neighbors.total
|
|
52497
|
+
] }),
|
|
52498
|
+
onToggleExpand ? /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
|
|
52499
|
+
import_design_system151.Button,
|
|
52500
|
+
{
|
|
52501
|
+
size: "sm",
|
|
52502
|
+
variant: "ghost",
|
|
52503
|
+
className: "ml-auto h-7 px-2 text-xs",
|
|
52504
|
+
"aria-pressed": Boolean(expanded),
|
|
52505
|
+
onClick: onToggleExpand,
|
|
52506
|
+
"data-record-expand": "",
|
|
52507
|
+
children: expanded ? "Shrink" : "Expand"
|
|
52508
|
+
}
|
|
52509
|
+
) : null
|
|
52464
52510
|
] });
|
|
52465
52511
|
}
|
|
52512
|
+
|
|
52513
|
+
// src/RecordPanel.tsx
|
|
52514
|
+
var import_react302 = require("react");
|
|
52515
|
+
var import_design_system152 = require("@ai-matrx/design-system");
|
|
52516
|
+
var import_react303 = require("@ai-matrx/records/react");
|
|
52517
|
+
var import_jsx_runtime170 = require("react/jsx-runtime");
|
|
52518
|
+
function RecordPanel({ tableId, recordId, onClose, onAskAboutField, onPage = false, neighbors, onStep, expanded, onToggleExpand }) {
|
|
52519
|
+
const host = useRecordsUi();
|
|
52520
|
+
const [asking, setAsking] = (0, import_react302.useState)(null);
|
|
52521
|
+
return /* @__PURE__ */ (0, import_jsx_runtime170.jsxs)(
|
|
52522
|
+
"div",
|
|
52523
|
+
{
|
|
52524
|
+
className: "space-y-3 outline-none",
|
|
52525
|
+
tabIndex: -1,
|
|
52526
|
+
"data-record-panel": recordId,
|
|
52527
|
+
onKeyDown: (event) => {
|
|
52528
|
+
if (event.key === "Escape" && !event.defaultPrevented && onClose && !onPage) {
|
|
52529
|
+
const tag = event.target?.tagName;
|
|
52530
|
+
if (tag !== "INPUT" && tag !== "TEXTAREA" && tag !== "SELECT") {
|
|
52531
|
+
event.preventDefault();
|
|
52532
|
+
onClose();
|
|
52533
|
+
}
|
|
52534
|
+
return;
|
|
52535
|
+
}
|
|
52536
|
+
if (!neighbors || !onStep) return;
|
|
52537
|
+
const way = stepKeyOf(event);
|
|
52538
|
+
const to = way === null ? null : way < 0 ? neighbors.previous : neighbors.next;
|
|
52539
|
+
if (to) {
|
|
52540
|
+
event.preventDefault();
|
|
52541
|
+
onStep(to);
|
|
52542
|
+
}
|
|
52543
|
+
},
|
|
52544
|
+
children: [
|
|
52545
|
+
neighbors && onStep ? /* @__PURE__ */ (0, import_jsx_runtime170.jsx)(RecordStepper, { neighbors, onStep: (to) => onStep(to), expanded, onToggleExpand }) : null,
|
|
52546
|
+
/* @__PURE__ */ (0, import_jsx_runtime170.jsx)(Peek, { tableId, recordId, onPage, ...onClose ? { onClose } : {} }),
|
|
52547
|
+
onPage ? /* @__PURE__ */ (0, import_jsx_runtime170.jsxs)(import_jsx_runtime170.Fragment, { children: [
|
|
52548
|
+
/* @__PURE__ */ (0, import_jsx_runtime170.jsx)(RecordBody, { tableId, recordId }),
|
|
52549
|
+
/* @__PURE__ */ (0, import_jsx_runtime170.jsx)(LinkedLists, { tableId, recordId }),
|
|
52550
|
+
/* @__PURE__ */ (0, import_jsx_runtime170.jsx)(ReverseLinksSections, { tableId, recordId }),
|
|
52551
|
+
/* @__PURE__ */ (0, import_jsx_runtime170.jsx)(RecordAsk, { tableId, recordId })
|
|
52552
|
+
] }) : null,
|
|
52553
|
+
/* @__PURE__ */ (0, import_jsx_runtime170.jsx)(import_design_system152.Separator, {}),
|
|
52554
|
+
/* @__PURE__ */ (0, import_jsx_runtime170.jsx)(
|
|
52555
|
+
HistoryPanel,
|
|
52556
|
+
{
|
|
52557
|
+
tableId,
|
|
52558
|
+
recordId,
|
|
52559
|
+
onAskAboutField: (fieldKey) => onAskAboutField ? onAskAboutField(fieldKey) : setAsking(fieldKey)
|
|
52560
|
+
}
|
|
52561
|
+
),
|
|
52562
|
+
!onAskAboutField && asking ? /* @__PURE__ */ (0, import_jsx_runtime170.jsx)(FieldHistoryPanel, { tableId, fieldKey: asking, recordId, onClose: () => setAsking(null) }) : null,
|
|
52563
|
+
host.recordSections ? /* @__PURE__ */ (0, import_jsx_runtime170.jsxs)(import_react302.Fragment, { children: [
|
|
52564
|
+
/* @__PURE__ */ (0, import_jsx_runtime170.jsx)(import_design_system152.Separator, {}),
|
|
52565
|
+
host.recordSections({ tableId, recordId })
|
|
52566
|
+
] }) : null,
|
|
52567
|
+
/* @__PURE__ */ (0, import_jsx_runtime170.jsx)(import_design_system152.Separator, {}),
|
|
52568
|
+
/* @__PURE__ */ (0, import_jsx_runtime170.jsx)(ChecklistRunner, { tableId, recordId }),
|
|
52569
|
+
/* @__PURE__ */ (0, import_jsx_runtime170.jsx)(import_design_system152.Separator, {}),
|
|
52570
|
+
/* @__PURE__ */ (0, import_jsx_runtime170.jsx)(CommentThread, { tableId, recordId })
|
|
52571
|
+
]
|
|
52572
|
+
}
|
|
52573
|
+
);
|
|
52574
|
+
}
|
|
52466
52575
|
function LinkedLists({ tableId, recordId }) {
|
|
52467
52576
|
const fields = (0, import_react303.useFields)(tableId);
|
|
52468
52577
|
const record = (0, import_react303.useRecord)(recordId, true, { tableId });
|
|
@@ -52472,9 +52581,9 @@ function LinkedLists({ tableId, recordId }) {
|
|
|
52472
52581
|
const may = useRecordRights(recordId);
|
|
52473
52582
|
if (links.length === 0 || !document2) return null;
|
|
52474
52583
|
if (may.write) {
|
|
52475
|
-
return /* @__PURE__ */ (0,
|
|
52476
|
-
/* @__PURE__ */ (0,
|
|
52477
|
-
/* @__PURE__ */ (0,
|
|
52584
|
+
return /* @__PURE__ */ (0, import_jsx_runtime170.jsxs)("div", { className: "flex flex-col gap-3", "data-record-linked-lists": "", children: [
|
|
52585
|
+
/* @__PURE__ */ (0, import_jsx_runtime170.jsx)(import_design_system152.Separator, {}),
|
|
52586
|
+
/* @__PURE__ */ (0, import_jsx_runtime170.jsx)(
|
|
52478
52587
|
RecordFieldsInPlace,
|
|
52479
52588
|
{
|
|
52480
52589
|
tableId,
|
|
@@ -52487,25 +52596,25 @@ function LinkedLists({ tableId, recordId }) {
|
|
|
52487
52596
|
className: "flex min-w-0 flex-col gap-1",
|
|
52488
52597
|
renderLabel: (field2) => {
|
|
52489
52598
|
const count = referencesOf(field2, document2[field2.key], "relation", labels).length;
|
|
52490
|
-
return /* @__PURE__ */ (0,
|
|
52491
|
-
/* @__PURE__ */ (0,
|
|
52492
|
-
count > 0 ? /* @__PURE__ */ (0,
|
|
52599
|
+
return /* @__PURE__ */ (0, import_jsx_runtime170.jsxs)("span", { className: "flex items-center gap-2 pt-2 text-foreground", "data-record-linked-list": field2.key, children: [
|
|
52600
|
+
/* @__PURE__ */ (0, import_jsx_runtime170.jsx)("span", { className: "truncate text-xs font-medium", children: fieldName(field2) }),
|
|
52601
|
+
count > 0 ? /* @__PURE__ */ (0, import_jsx_runtime170.jsx)("span", { className: "text-[11px] text-muted-foreground", children: count }) : null
|
|
52493
52602
|
] });
|
|
52494
52603
|
}
|
|
52495
52604
|
}
|
|
52496
52605
|
)
|
|
52497
52606
|
] });
|
|
52498
52607
|
}
|
|
52499
|
-
return /* @__PURE__ */ (0,
|
|
52500
|
-
/* @__PURE__ */ (0,
|
|
52608
|
+
return /* @__PURE__ */ (0, import_jsx_runtime170.jsxs)("div", { className: "flex flex-col gap-3", "data-record-linked-lists": "", children: [
|
|
52609
|
+
/* @__PURE__ */ (0, import_jsx_runtime170.jsx)(import_design_system152.Separator, {}),
|
|
52501
52610
|
links.map((field2) => {
|
|
52502
52611
|
const refs = referencesOf(field2, document2[field2.key], "relation", labels);
|
|
52503
|
-
return /* @__PURE__ */ (0,
|
|
52504
|
-
/* @__PURE__ */ (0,
|
|
52505
|
-
/* @__PURE__ */ (0,
|
|
52506
|
-
refs.length > 0 ? /* @__PURE__ */ (0,
|
|
52612
|
+
return /* @__PURE__ */ (0, import_jsx_runtime170.jsxs)("section", { className: "flex min-w-0 flex-col gap-1", "data-record-linked-list": field2.key, children: [
|
|
52613
|
+
/* @__PURE__ */ (0, import_jsx_runtime170.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
52614
|
+
/* @__PURE__ */ (0, import_jsx_runtime170.jsx)("h4", { className: "truncate text-xs font-medium", children: fieldName(field2) }),
|
|
52615
|
+
refs.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime170.jsx)("span", { className: "text-[11px] text-muted-foreground", children: refs.length }) : null
|
|
52507
52616
|
] }),
|
|
52508
|
-
refs.length === 0 ? /* @__PURE__ */ (0,
|
|
52617
|
+
refs.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime170.jsx)("span", { className: "text-xs text-muted-foreground", children: "\u2014" }) : /* @__PURE__ */ (0, import_jsx_runtime170.jsx)("ul", { className: "flex min-w-0 flex-col gap-1", children: refs.map((ref) => /* @__PURE__ */ (0, import_jsx_runtime170.jsx)("li", { className: "min-w-0", children: /* @__PURE__ */ (0, import_jsx_runtime170.jsx)(ReferenceChip, { reference: ref }) }, ref.id)) })
|
|
52509
52618
|
] }, field2.id);
|
|
52510
52619
|
})
|
|
52511
52620
|
] });
|
|
@@ -52514,16 +52623,16 @@ function RecordAsk({ tableId, recordId }) {
|
|
|
52514
52623
|
const host = useRecordsUi();
|
|
52515
52624
|
const [open, setOpen] = (0, import_react302.useState)(false);
|
|
52516
52625
|
if (!host.chat) return null;
|
|
52517
|
-
return /* @__PURE__ */ (0,
|
|
52518
|
-
/* @__PURE__ */ (0,
|
|
52519
|
-
open ? /* @__PURE__ */ (0,
|
|
52626
|
+
return /* @__PURE__ */ (0, import_jsx_runtime170.jsxs)("section", { className: "flex min-w-0 flex-col gap-1.5", "data-record-ask": open ? "open" : "", children: [
|
|
52627
|
+
/* @__PURE__ */ (0, import_jsx_runtime170.jsx)(import_design_system152.Separator, {}),
|
|
52628
|
+
open ? /* @__PURE__ */ (0, import_jsx_runtime170.jsx)(RecordChat, { tableId, recordId, className: "min-h-[22rem]" }) : /* @__PURE__ */ (0, import_jsx_runtime170.jsx)(import_design_system152.Button, { size: "sm", variant: "outline", className: "self-start", onClick: () => setOpen(true), "data-record-ask-open": "", children: "Ask about this record" })
|
|
52520
52629
|
] });
|
|
52521
52630
|
}
|
|
52522
52631
|
|
|
52523
52632
|
// src/breakDown.tsx
|
|
52524
52633
|
var import_react304 = require("react");
|
|
52525
|
-
var
|
|
52526
|
-
var
|
|
52634
|
+
var import_design_system153 = require("@ai-matrx/design-system");
|
|
52635
|
+
var import_jsx_runtime171 = require("react/jsx-runtime");
|
|
52527
52636
|
var BREAK_DOWN_ACTION_ID = "break-down";
|
|
52528
52637
|
var NO_DIMENSION_REASON = "No column to break down by";
|
|
52529
52638
|
function breakDownAction(args) {
|
|
@@ -52552,14 +52661,14 @@ function BreakDownDialog({
|
|
|
52552
52661
|
const dimensions = (0, import_react304.useMemo)(() => drillDimensionsOf(def, NO_LABELS), [def]);
|
|
52553
52662
|
const [picked, setPicked] = (0, import_react304.useState)(null);
|
|
52554
52663
|
const key = picked ?? held?.field ?? dimensions[0]?.key ?? "";
|
|
52555
|
-
return /* @__PURE__ */ (0,
|
|
52556
|
-
/* @__PURE__ */ (0,
|
|
52557
|
-
/* @__PURE__ */ (0,
|
|
52558
|
-
/* @__PURE__ */ (0,
|
|
52559
|
-
/* @__PURE__ */ (0,
|
|
52664
|
+
return /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(import_design_system153.Dialog, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime171.jsxs)(import_design_system153.DialogContent, { "data-break-down": "", className: "max-w-sm", children: [
|
|
52665
|
+
/* @__PURE__ */ (0, import_jsx_runtime171.jsx)(import_design_system153.DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(import_design_system153.DialogTitle, { children: "Break down by" }) }),
|
|
52666
|
+
/* @__PURE__ */ (0, import_jsx_runtime171.jsxs)(import_design_system153.Select, { value: key, onValueChange: setPicked, children: [
|
|
52667
|
+
/* @__PURE__ */ (0, import_jsx_runtime171.jsx)(import_design_system153.SelectTrigger, { "aria-label": "Column to break down by", "data-break-down-select": "", children: /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(import_design_system153.SelectValue, { placeholder: def ? NO_DIMENSION_REASON : "Reading this table\u2026" }) }),
|
|
52668
|
+
/* @__PURE__ */ (0, import_jsx_runtime171.jsx)(import_design_system153.SelectContent, { children: dimensions.map((d) => /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(import_design_system153.SelectItem, { value: d.key, children: d.label }, d.key)) })
|
|
52560
52669
|
] }),
|
|
52561
|
-
/* @__PURE__ */ (0,
|
|
52562
|
-
|
|
52670
|
+
/* @__PURE__ */ (0, import_jsx_runtime171.jsx)(
|
|
52671
|
+
import_design_system153.Button,
|
|
52563
52672
|
{
|
|
52564
52673
|
type: "button",
|
|
52565
52674
|
"data-break-down-apply": "",
|
|
@@ -52579,8 +52688,8 @@ function BreakDownDialog({
|
|
|
52579
52688
|
var import_clipboard16 = require("@ai-matrx/kit/clipboard");
|
|
52580
52689
|
var import_react305 = require("react");
|
|
52581
52690
|
var import_workspace2 = require("@ai-matrx/alchemy/react/workspace");
|
|
52582
|
-
var
|
|
52583
|
-
var
|
|
52691
|
+
var import_design_system154 = require("@ai-matrx/design-system");
|
|
52692
|
+
var import_jsx_runtime172 = require("react/jsx-runtime");
|
|
52584
52693
|
function tableReferenceChoices(tableId, name) {
|
|
52585
52694
|
return [
|
|
52586
52695
|
{
|
|
@@ -52623,11 +52732,11 @@ function TableReferenceDialog({
|
|
|
52623
52732
|
},
|
|
52624
52733
|
[port, notify]
|
|
52625
52734
|
);
|
|
52626
|
-
return /* @__PURE__ */ (0,
|
|
52627
|
-
/* @__PURE__ */ (0,
|
|
52628
|
-
/* @__PURE__ */ (0,
|
|
52629
|
-
/* @__PURE__ */ (0,
|
|
52630
|
-
/* @__PURE__ */ (0,
|
|
52735
|
+
return /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(import_design_system154.Dialog, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)(import_design_system154.DialogContent, { className: "sm:max-w-sm", "data-table-reference": "", children: [
|
|
52736
|
+
/* @__PURE__ */ (0, import_jsx_runtime172.jsx)(import_design_system154.DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(import_design_system154.DialogTitle, { children: "Get reference" }) }),
|
|
52737
|
+
/* @__PURE__ */ (0, import_jsx_runtime172.jsx)("div", { className: "flex flex-col gap-2", children: choices.map((choice) => /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)("div", { className: "flex items-center justify-between gap-3 rounded-md border px-3 py-2", children: [
|
|
52738
|
+
/* @__PURE__ */ (0, import_jsx_runtime172.jsx)("span", { className: "text-sm", children: choice.label }),
|
|
52739
|
+
/* @__PURE__ */ (0, import_jsx_runtime172.jsx)(import_design_system154.Button, { size: "sm", variant: "outline", onClick: () => void copy(choice), "data-table-reference-copy": choice.id, children: copied === choice.id ? "Copied" : "Copy" })
|
|
52631
52740
|
] }, choice.id)) })
|
|
52632
52741
|
] }) });
|
|
52633
52742
|
}
|
|
@@ -52636,8 +52745,8 @@ function TableReferenceDialog({
|
|
|
52636
52745
|
var import_format14 = require("@ai-matrx/kit/format");
|
|
52637
52746
|
var import_react306 = require("react");
|
|
52638
52747
|
var import_react307 = require("@ai-matrx/records/react");
|
|
52639
|
-
var
|
|
52640
|
-
var
|
|
52748
|
+
var import_design_system155 = require("@ai-matrx/design-system");
|
|
52749
|
+
var import_jsx_runtime173 = require("react/jsx-runtime");
|
|
52641
52750
|
function copyNameFor(name) {
|
|
52642
52751
|
return `${name.trim() || "Table"} (copy)`;
|
|
52643
52752
|
}
|
|
@@ -52685,13 +52794,13 @@ function TableDuplicateDialog({ tableId, name, open, onOpenChange, onDuplicated
|
|
|
52685
52794
|
if (onDuplicated) onDuplicated(copy);
|
|
52686
52795
|
else if (typeof window !== "undefined") window.location.assign(copy.path);
|
|
52687
52796
|
};
|
|
52688
|
-
return /* @__PURE__ */ (0,
|
|
52689
|
-
/* @__PURE__ */ (0,
|
|
52797
|
+
return /* @__PURE__ */ (0, import_jsx_runtime173.jsx)(import_design_system155.Dialog, { open, onOpenChange: close, children: /* @__PURE__ */ (0, import_jsx_runtime173.jsxs)(import_design_system155.DialogContent, { className: "sm:max-w-md", "data-table-duplicate": tableId, children: [
|
|
52798
|
+
/* @__PURE__ */ (0, import_jsx_runtime173.jsx)(import_design_system155.DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime173.jsxs)(import_design_system155.DialogTitle, { children: [
|
|
52690
52799
|
"Duplicate ",
|
|
52691
52800
|
name || "table"
|
|
52692
52801
|
] }) }),
|
|
52693
|
-
phase.kind === "done" ? /* @__PURE__ */ (0,
|
|
52694
|
-
/* @__PURE__ */ (0,
|
|
52802
|
+
phase.kind === "done" ? /* @__PURE__ */ (0, import_jsx_runtime173.jsxs)("div", { className: "flex flex-col gap-1.5 text-sm", "data-table-duplicate-done": "", children: [
|
|
52803
|
+
/* @__PURE__ */ (0, import_jsx_runtime173.jsxs)("p", { children: [
|
|
52695
52804
|
phase.copy.table.name,
|
|
52696
52805
|
": ",
|
|
52697
52806
|
phase.copy.copied.fields,
|
|
@@ -52701,14 +52810,14 @@ function TableDuplicateDialog({ tableId, name, open, onOpenChange, onDuplicated
|
|
|
52701
52810
|
phase.copy.copied.withRecords ? `, ${(0, import_format14.formatCount)(phase.copy.copied.records)} records` : "",
|
|
52702
52811
|
"."
|
|
52703
52812
|
] }),
|
|
52704
|
-
phase.copy.notCopied.length > 0 ? /* @__PURE__ */ (0,
|
|
52813
|
+
phase.copy.notCopied.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime173.jsxs)("p", { className: "text-xs text-muted-foreground", children: [
|
|
52705
52814
|
"Not copied: ",
|
|
52706
52815
|
phase.copy.notCopied.join(", "),
|
|
52707
52816
|
"."
|
|
52708
52817
|
] }) : null
|
|
52709
|
-
] }) : /* @__PURE__ */ (0,
|
|
52710
|
-
/* @__PURE__ */ (0,
|
|
52711
|
-
|
|
52818
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime173.jsxs)("div", { className: "flex flex-col gap-3 text-sm", children: [
|
|
52819
|
+
/* @__PURE__ */ (0, import_jsx_runtime173.jsx)(
|
|
52820
|
+
import_design_system155.Input,
|
|
52712
52821
|
{
|
|
52713
52822
|
autoFocus: true,
|
|
52714
52823
|
"aria-label": "Name of the copy",
|
|
@@ -52720,26 +52829,26 @@ function TableDuplicateDialog({ tableId, name, open, onOpenChange, onDuplicated
|
|
|
52720
52829
|
}
|
|
52721
52830
|
}
|
|
52722
52831
|
),
|
|
52723
|
-
/* @__PURE__ */ (0,
|
|
52724
|
-
/* @__PURE__ */ (0,
|
|
52725
|
-
/* @__PURE__ */ (0,
|
|
52832
|
+
/* @__PURE__ */ (0, import_jsx_runtime173.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
|
|
52833
|
+
/* @__PURE__ */ (0, import_jsx_runtime173.jsx)("span", { children: "Copy its records" }),
|
|
52834
|
+
/* @__PURE__ */ (0, import_jsx_runtime173.jsx)(import_design_system155.Switch, { checked: withRecords, disabled: copying, onCheckedChange: setWithRecords, "aria-label": "Copy its records" })
|
|
52726
52835
|
] }),
|
|
52727
|
-
phase.kind === "copying" ? /* @__PURE__ */ (0,
|
|
52728
|
-
phase.kind === "refused" ? /* @__PURE__ */ (0,
|
|
52729
|
-
problem && typed2 !== "" ? /* @__PURE__ */ (0,
|
|
52836
|
+
phase.kind === "copying" ? /* @__PURE__ */ (0, import_jsx_runtime173.jsx)("p", { className: "text-xs text-muted-foreground", "data-table-duplicate-progress": "", children: phase.progress ? duplicateProgressWords(phase.progress) : "Starting the copy\u2026" }) : null,
|
|
52837
|
+
phase.kind === "refused" ? /* @__PURE__ */ (0, import_jsx_runtime173.jsx)(import_design_system155.ErrorBox, { children: phase.sentence }) : null,
|
|
52838
|
+
problem && typed2 !== "" ? /* @__PURE__ */ (0, import_jsx_runtime173.jsx)("p", { className: "text-xs text-muted-foreground", children: problem }) : null
|
|
52730
52839
|
] }),
|
|
52731
|
-
/* @__PURE__ */ (0,
|
|
52732
|
-
/* @__PURE__ */ (0,
|
|
52733
|
-
/* @__PURE__ */ (0,
|
|
52840
|
+
/* @__PURE__ */ (0, import_jsx_runtime173.jsx)(import_design_system155.DialogFooter, { children: phase.kind === "done" ? /* @__PURE__ */ (0, import_jsx_runtime173.jsx)(import_design_system155.Button, { onClick: () => openCopy(phase.copy), "data-table-duplicate-open": "", children: "Open the copy" }) : /* @__PURE__ */ (0, import_jsx_runtime173.jsxs)(import_jsx_runtime173.Fragment, { children: [
|
|
52841
|
+
/* @__PURE__ */ (0, import_jsx_runtime173.jsx)(import_design_system155.Button, { variant: "ghost", disabled: copying, onClick: () => close(false), children: "Cancel" }),
|
|
52842
|
+
/* @__PURE__ */ (0, import_jsx_runtime173.jsx)(import_design_system155.Button, { disabled: copying || problem !== null, onClick: () => void go(), children: copying ? "Duplicating\u2026" : "Duplicate" })
|
|
52734
52843
|
] }) })
|
|
52735
52844
|
] }) });
|
|
52736
52845
|
}
|
|
52737
52846
|
|
|
52738
52847
|
// src/ViewFilter.tsx
|
|
52739
52848
|
var import_react308 = require("react");
|
|
52740
|
-
var
|
|
52849
|
+
var import_design_system156 = require("@ai-matrx/design-system");
|
|
52741
52850
|
var import_react309 = require("@ai-matrx/records/react");
|
|
52742
|
-
var
|
|
52851
|
+
var import_jsx_runtime174 = require("react/jsx-runtime");
|
|
52743
52852
|
function conditionCount(expr) {
|
|
52744
52853
|
if (!expr || typeof expr !== "object" || Array.isArray(expr)) return 0;
|
|
52745
52854
|
const node = expr;
|
|
@@ -52767,8 +52876,8 @@ function ViewFilter({ tableId, view, onApply, className }) {
|
|
|
52767
52876
|
return (
|
|
52768
52877
|
// THE BUILDER FLOATS OVER THE TABLE (STABLE-TABLES; Notion's filter popover): drawn inside the
|
|
52769
52878
|
// toolbar row it grew the row and pushed the whole table down (0.13 + 0.13 layout shift).
|
|
52770
|
-
/* @__PURE__ */ (0,
|
|
52771
|
-
|
|
52879
|
+
/* @__PURE__ */ (0, import_jsx_runtime174.jsxs)(
|
|
52880
|
+
import_design_system156.Popover,
|
|
52772
52881
|
{
|
|
52773
52882
|
open,
|
|
52774
52883
|
onOpenChange: (next) => {
|
|
@@ -52776,8 +52885,8 @@ function ViewFilter({ tableId, view, onApply, className }) {
|
|
|
52776
52885
|
setOpen(next);
|
|
52777
52886
|
},
|
|
52778
52887
|
children: [
|
|
52779
|
-
/* @__PURE__ */ (0,
|
|
52780
|
-
|
|
52888
|
+
/* @__PURE__ */ (0, import_jsx_runtime174.jsx)(import_design_system156.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime174.jsx)(
|
|
52889
|
+
import_design_system156.Button,
|
|
52781
52890
|
{
|
|
52782
52891
|
size: "sm",
|
|
52783
52892
|
variant: open || count > 0 ? "secondary" : "ghost",
|
|
@@ -52788,17 +52897,17 @@ function ViewFilter({ tableId, view, onApply, className }) {
|
|
|
52788
52897
|
children: count > 0 ? `Filter \xB7 ${count}` : "Filter"
|
|
52789
52898
|
}
|
|
52790
52899
|
) }),
|
|
52791
|
-
/* @__PURE__ */ (0,
|
|
52900
|
+
/* @__PURE__ */ (0, import_jsx_runtime174.jsx)(import_design_system156.PopoverContent, { sizing: "content", align: "start", className: "w-auto max-w-[min(42rem,calc(100vw-2rem))] p-2", children: /* @__PURE__ */ (0, import_jsx_runtime174.jsxs)(
|
|
52792
52901
|
"div",
|
|
52793
52902
|
{
|
|
52794
52903
|
className: "flex flex-col gap-2 text-xs",
|
|
52795
52904
|
"data-testid": "view-filter-panel",
|
|
52796
52905
|
children: [
|
|
52797
|
-
view.ruleId ? /* @__PURE__ */ (0,
|
|
52906
|
+
view.ruleId ? /* @__PURE__ */ (0, import_jsx_runtime174.jsx)("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__ */ (0, import_jsx_runtime174.jsxs)("p", { className: "text-muted-foreground", children: [
|
|
52798
52907
|
"This view asks: ",
|
|
52799
52908
|
conditionInWords(saved, conditionFields),
|
|
52800
52909
|
". It cannot be drawn here; clear it to start a new filter."
|
|
52801
|
-
] }) : /* @__PURE__ */ (0,
|
|
52910
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime174.jsx)(FilterTermsContext.Provider, { value: true, children: /* @__PURE__ */ (0, import_jsx_runtime174.jsx)(
|
|
52802
52911
|
ConditionGroup,
|
|
52803
52912
|
{
|
|
52804
52913
|
lead: "Show records where",
|
|
@@ -52808,9 +52917,9 @@ function ViewFilter({ tableId, view, onApply, className }) {
|
|
|
52808
52917
|
onChange: setDraft
|
|
52809
52918
|
}
|
|
52810
52919
|
) }),
|
|
52811
|
-
view.ruleId ? null : /* @__PURE__ */ (0,
|
|
52812
|
-
changed2 ? /* @__PURE__ */ (0,
|
|
52813
|
-
|
|
52920
|
+
view.ruleId ? null : /* @__PURE__ */ (0, import_jsx_runtime174.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
52921
|
+
changed2 ? /* @__PURE__ */ (0, import_jsx_runtime174.jsx)(
|
|
52922
|
+
import_design_system156.Button,
|
|
52814
52923
|
{
|
|
52815
52924
|
size: "sm",
|
|
52816
52925
|
"data-testid": "view-filter-apply",
|
|
@@ -52821,8 +52930,8 @@ function ViewFilter({ tableId, view, onApply, className }) {
|
|
|
52821
52930
|
children: "Apply"
|
|
52822
52931
|
}
|
|
52823
52932
|
) : null,
|
|
52824
|
-
count > 0 || draft ? /* @__PURE__ */ (0,
|
|
52825
|
-
|
|
52933
|
+
count > 0 || draft ? /* @__PURE__ */ (0, import_jsx_runtime174.jsx)(
|
|
52934
|
+
import_design_system156.Button,
|
|
52826
52935
|
{
|
|
52827
52936
|
size: "sm",
|
|
52828
52937
|
variant: "ghost",
|
|
@@ -52835,7 +52944,7 @@ function ViewFilter({ tableId, view, onApply, className }) {
|
|
|
52835
52944
|
children: "Clear filter"
|
|
52836
52945
|
}
|
|
52837
52946
|
) : null,
|
|
52838
|
-
/* @__PURE__ */ (0,
|
|
52947
|
+
/* @__PURE__ */ (0, import_jsx_runtime174.jsx)(import_design_system156.Button, { size: "sm", variant: "ghost", onClick: () => {
|
|
52839
52948
|
setDraft(saved);
|
|
52840
52949
|
setOpen(false);
|
|
52841
52950
|
}, children: "Cancel" })
|
|
@@ -52850,11 +52959,11 @@ function ViewFilter({ tableId, view, onApply, className }) {
|
|
|
52850
52959
|
}
|
|
52851
52960
|
|
|
52852
52961
|
// src/PhoneTableActions.tsx
|
|
52853
|
-
var
|
|
52854
|
-
var
|
|
52962
|
+
var import_design_system157 = require("@ai-matrx/design-system");
|
|
52963
|
+
var import_jsx_runtime175 = require("react/jsx-runtime");
|
|
52855
52964
|
function PhoneActionRow({ action: action3, groupStart }) {
|
|
52856
52965
|
const disabled = action3.disabledReason !== void 0;
|
|
52857
|
-
return /* @__PURE__ */ (0,
|
|
52966
|
+
return /* @__PURE__ */ (0, import_jsx_runtime175.jsxs)(
|
|
52858
52967
|
"button",
|
|
52859
52968
|
{
|
|
52860
52969
|
type: "button",
|
|
@@ -52864,16 +52973,16 @@ function PhoneActionRow({ action: action3, groupStart }) {
|
|
|
52864
52973
|
onClick: () => {
|
|
52865
52974
|
if (!disabled) void action3.run();
|
|
52866
52975
|
},
|
|
52867
|
-
className: (0,
|
|
52976
|
+
className: (0, import_design_system157.cn)(
|
|
52868
52977
|
"flex min-h-11 w-full items-center gap-3 px-1 text-left text-base disabled:opacity-60",
|
|
52869
52978
|
groupStart && "border-t border-border pt-1",
|
|
52870
52979
|
action3.destructive && "text-destructive"
|
|
52871
52980
|
),
|
|
52872
52981
|
children: [
|
|
52873
|
-
/* @__PURE__ */ (0,
|
|
52874
|
-
/* @__PURE__ */ (0,
|
|
52875
|
-
/* @__PURE__ */ (0,
|
|
52876
|
-
disabled ? /* @__PURE__ */ (0,
|
|
52982
|
+
/* @__PURE__ */ (0, import_jsx_runtime175.jsx)(ObjectActionGlyph, { name: action3.icon, className: "h-5 w-5 shrink-0" }),
|
|
52983
|
+
/* @__PURE__ */ (0, import_jsx_runtime175.jsxs)("span", { className: "flex min-w-0 flex-col", children: [
|
|
52984
|
+
/* @__PURE__ */ (0, import_jsx_runtime175.jsx)("span", { className: "truncate", children: action3.label }),
|
|
52985
|
+
disabled ? /* @__PURE__ */ (0, import_jsx_runtime175.jsx)("span", { className: "truncate text-xs text-muted-foreground", "data-object-action-reason": "", children: action3.disabledReason }) : null
|
|
52877
52986
|
] })
|
|
52878
52987
|
]
|
|
52879
52988
|
}
|
|
@@ -52881,20 +52990,20 @@ function PhoneActionRow({ action: action3, groupStart }) {
|
|
|
52881
52990
|
}
|
|
52882
52991
|
PhoneActionRow.routeHeaderMenu = true;
|
|
52883
52992
|
function PhoneSubmenu({ label, icon, actions }) {
|
|
52884
|
-
return /* @__PURE__ */ (0,
|
|
52885
|
-
/* @__PURE__ */ (0,
|
|
52993
|
+
return /* @__PURE__ */ (0, import_jsx_runtime175.jsxs)(import_design_system157.DropdownMenu, { children: [
|
|
52994
|
+
/* @__PURE__ */ (0, import_jsx_runtime175.jsx)(import_design_system157.DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime175.jsxs)(
|
|
52886
52995
|
"button",
|
|
52887
52996
|
{
|
|
52888
52997
|
type: "button",
|
|
52889
52998
|
"data-object-action-group": "built-on",
|
|
52890
52999
|
className: "flex min-h-11 w-full items-center gap-3 border-t border-border px-1 pt-1 text-left text-base",
|
|
52891
53000
|
children: [
|
|
52892
|
-
icon ? /* @__PURE__ */ (0,
|
|
52893
|
-
/* @__PURE__ */ (0,
|
|
53001
|
+
icon ? /* @__PURE__ */ (0, import_jsx_runtime175.jsx)(ObjectActionGlyph, { name: icon, className: "h-5 w-5 shrink-0" }) : null,
|
|
53002
|
+
/* @__PURE__ */ (0, import_jsx_runtime175.jsx)("span", { className: "truncate", children: label })
|
|
52894
53003
|
]
|
|
52895
53004
|
}
|
|
52896
53005
|
) }),
|
|
52897
|
-
/* @__PURE__ */ (0,
|
|
53006
|
+
/* @__PURE__ */ (0, import_jsx_runtime175.jsx)(import_design_system157.DropdownMenuContent, { align: "end", className: "w-64", children: /* @__PURE__ */ (0, import_jsx_runtime175.jsx)(ObjectActionMenuItems, { actions: actions.map((a) => ({ ...a, group: "manage" })) }) })
|
|
52898
53007
|
] });
|
|
52899
53008
|
}
|
|
52900
53009
|
PhoneSubmenu.routeHeaderMenu = true;
|
|
@@ -52907,13 +53016,13 @@ function phoneTableActions(actions) {
|
|
|
52907
53016
|
continue;
|
|
52908
53017
|
}
|
|
52909
53018
|
if (entry.kind === "submenu") {
|
|
52910
|
-
out.push(/* @__PURE__ */ (0,
|
|
53019
|
+
out.push(/* @__PURE__ */ (0, import_jsx_runtime175.jsx)(PhoneSubmenu, { label: entry.label, icon: entry.icon, actions: entry.actions }, `phone-group-${entry.id}`));
|
|
52911
53020
|
groupStart = false;
|
|
52912
53021
|
continue;
|
|
52913
53022
|
}
|
|
52914
53023
|
const a = entry.action;
|
|
52915
53024
|
out.push(
|
|
52916
|
-
/* @__PURE__ */ (0,
|
|
53025
|
+
/* @__PURE__ */ (0, import_jsx_runtime175.jsx)(
|
|
52917
53026
|
PhoneActionRow,
|
|
52918
53027
|
{
|
|
52919
53028
|
action: a,
|
|
@@ -53139,7 +53248,7 @@ function useSlotScroll(slot) {
|
|
|
53139
53248
|
// src/TablePage.tsx
|
|
53140
53249
|
var import_uuid3 = require("@ai-matrx/kit/uuid");
|
|
53141
53250
|
var import_outbound4 = require("@ai-matrx/kit/outbound");
|
|
53142
|
-
var
|
|
53251
|
+
var import_jsx_runtime176 = require("react/jsx-runtime");
|
|
53143
53252
|
var RAIL_TITLE = {
|
|
53144
53253
|
settings: "Table settings",
|
|
53145
53254
|
inbox: "Inbox",
|
|
@@ -53156,21 +53265,22 @@ var RAIL_TITLE = {
|
|
|
53156
53265
|
export: "Export"
|
|
53157
53266
|
};
|
|
53158
53267
|
function LookGlyph() {
|
|
53159
|
-
return /* @__PURE__ */ (0,
|
|
53160
|
-
/* @__PURE__ */ (0,
|
|
53161
|
-
/* @__PURE__ */ (0,
|
|
53162
|
-
/* @__PURE__ */ (0,
|
|
53268
|
+
return /* @__PURE__ */ (0, import_jsx_runtime176.jsxs)("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", width: "14", height: "14", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
53269
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)("path", { d: "M4 7h10M18 7h2M4 17h2M10 17h10" }),
|
|
53270
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)("circle", { cx: "16", cy: "7", r: "2" }),
|
|
53271
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)("circle", { cx: "8", cy: "17", r: "2" })
|
|
53163
53272
|
] });
|
|
53164
53273
|
}
|
|
53165
53274
|
function RailFrame({
|
|
53166
53275
|
phone,
|
|
53167
53276
|
title,
|
|
53168
53277
|
onClose,
|
|
53278
|
+
over = false,
|
|
53169
53279
|
children
|
|
53170
53280
|
}) {
|
|
53171
53281
|
if (phone) {
|
|
53172
|
-
return /* @__PURE__ */ (0,
|
|
53173
|
-
|
|
53282
|
+
return /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(
|
|
53283
|
+
import_design_system158.BottomSheet,
|
|
53174
53284
|
{
|
|
53175
53285
|
open: true,
|
|
53176
53286
|
onOpenChange: (open) => {
|
|
@@ -53179,11 +53289,19 @@ function RailFrame({
|
|
|
53179
53289
|
title,
|
|
53180
53290
|
size: "full",
|
|
53181
53291
|
surface: "solid",
|
|
53182
|
-
children: /* @__PURE__ */ (0,
|
|
53292
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime176.jsx)("div", { "data-rail-sheet": "", className: "min-h-0 flex-1 overflow-y-auto px-3 pb-6", children })
|
|
53183
53293
|
}
|
|
53184
53294
|
);
|
|
53185
53295
|
}
|
|
53186
|
-
return /* @__PURE__ */ (0,
|
|
53296
|
+
return /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(
|
|
53297
|
+
"aside",
|
|
53298
|
+
{
|
|
53299
|
+
"data-rail-column": "",
|
|
53300
|
+
"data-rail-over": over ? "" : void 0,
|
|
53301
|
+
className: over ? "w-[26rem] shrink-0" : "w-[26rem] shrink-0 overflow-y-auto rounded-md border p-3",
|
|
53302
|
+
children: over ? /* @__PURE__ */ (0, import_jsx_runtime176.jsx)("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
|
|
53303
|
+
}
|
|
53304
|
+
);
|
|
53187
53305
|
}
|
|
53188
53306
|
function filterInWords(filter, fields) {
|
|
53189
53307
|
const nameOf2 = (key) => {
|
|
@@ -53236,17 +53354,17 @@ function TableNotHere({
|
|
|
53236
53354
|
alive = false;
|
|
53237
53355
|
};
|
|
53238
53356
|
}, [client, tableId]);
|
|
53239
|
-
if (archived.phase === "asking") return /* @__PURE__ */ (0,
|
|
53357
|
+
if (archived.phase === "asking") return /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(import_design_system158.Skeleton, { className: "h-40 w-full" });
|
|
53240
53358
|
const row = archived.phase === "answered" ? archived.row : null;
|
|
53241
53359
|
if (row) {
|
|
53242
|
-
return /* @__PURE__ */ (0,
|
|
53243
|
-
/* @__PURE__ */ (0,
|
|
53244
|
-
/* @__PURE__ */ (0,
|
|
53245
|
-
/* @__PURE__ */ (0,
|
|
53246
|
-
refusal3 ? /* @__PURE__ */ (0,
|
|
53247
|
-
/* @__PURE__ */ (0,
|
|
53248
|
-
/* @__PURE__ */ (0,
|
|
53249
|
-
|
|
53360
|
+
return /* @__PURE__ */ (0, import_jsx_runtime176.jsxs)("div", { className: (0, import_design_system158.cn)("flex flex-col items-start gap-2 rounded-md border border-dashed p-6", className), children: [
|
|
53361
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)("p", { className: "text-sm font-medium", children: "This table is archived" }),
|
|
53362
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)("p", { className: "max-w-prose text-xs text-muted-foreground", children: TABLE_IS_ARCHIVED }),
|
|
53363
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)("p", { className: "text-xs text-muted-foreground", children: (0, import_records74.archivedByLine)(row) }),
|
|
53364
|
+
refusal3 ? /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(RefusalNotice, { error: refusal3 }) : null,
|
|
53365
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsxs)("div", { className: "flex gap-2", children: [
|
|
53366
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)(
|
|
53367
|
+
import_design_system158.Button,
|
|
53250
53368
|
{
|
|
53251
53369
|
size: "sm",
|
|
53252
53370
|
disabled: restoring,
|
|
@@ -53264,14 +53382,14 @@ function TableNotHere({
|
|
|
53264
53382
|
children: restoring ? "Bringing it back\u2026" : "Bring it back"
|
|
53265
53383
|
}
|
|
53266
53384
|
),
|
|
53267
|
-
onLeave ? /* @__PURE__ */ (0,
|
|
53385
|
+
onLeave ? /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(import_design_system158.Button, { size: "sm", variant: "outline", onClick: onLeave, children: leaveLabel }) : null
|
|
53268
53386
|
] })
|
|
53269
53387
|
] });
|
|
53270
53388
|
}
|
|
53271
|
-
return /* @__PURE__ */ (0,
|
|
53272
|
-
/* @__PURE__ */ (0,
|
|
53273
|
-
/* @__PURE__ */ (0,
|
|
53274
|
-
onLeave ? /* @__PURE__ */ (0,
|
|
53389
|
+
return /* @__PURE__ */ (0, import_jsx_runtime176.jsxs)("div", { className: (0, import_design_system158.cn)("flex flex-col items-start gap-2 rounded-md border border-dashed p-6", className), children: [
|
|
53390
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)("p", { className: "text-sm font-medium", children: "This table is not here" }),
|
|
53391
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)("p", { className: "max-w-prose text-xs text-muted-foreground", children: TABLE_NOT_REACHABLE }),
|
|
53392
|
+
onLeave ? /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(import_design_system158.Button, { size: "sm", variant: "outline", onClick: onLeave, children: leaveLabel }) : null
|
|
53275
53393
|
] });
|
|
53276
53394
|
}
|
|
53277
53395
|
var TABLE_NOT_REACHABLE = (
|
|
@@ -53405,6 +53523,7 @@ function TablePage({
|
|
|
53405
53523
|
leaveLabel = "Back to your tables",
|
|
53406
53524
|
activeDashboardId,
|
|
53407
53525
|
activeRecordId,
|
|
53526
|
+
onRecordChange,
|
|
53408
53527
|
activeView,
|
|
53409
53528
|
onViewChanged,
|
|
53410
53529
|
activeGroupField,
|
|
@@ -53492,7 +53611,7 @@ function TablePage({
|
|
|
53492
53611
|
const setRail = (next) => setSurface((now) => ({ ...now, rail: next }));
|
|
53493
53612
|
const [importEpoch, setImportEpoch] = (0, import_react311.useState)(0);
|
|
53494
53613
|
const [openRecord, setOpenRecord] = (0, import_react311.useState)(opening.record);
|
|
53495
|
-
const phone = (0,
|
|
53614
|
+
const phone = (0, import_design_system158.useIsMobile)();
|
|
53496
53615
|
const [shareAsked, setShareAsked] = (0, import_react311.useState)(0);
|
|
53497
53616
|
const { open: renameOpen, setOpen: setRenameOpen, ask: askRename, menuContentProps: renameMenuProps } = useRenameFromMenu();
|
|
53498
53617
|
const [archiveAsked, setArchiveAsked] = (0, import_react311.useState)(0);
|
|
@@ -53589,11 +53708,30 @@ function TablePage({
|
|
|
53589
53708
|
onViewChanged?.(addressForView(view, next));
|
|
53590
53709
|
void patchView({ layout: next });
|
|
53591
53710
|
};
|
|
53711
|
+
const reportedRecords = (0, import_react311.useRef)(/* @__PURE__ */ new Set());
|
|
53712
|
+
const lastActiveRecord = (0, import_react311.useRef)(activeRecordId ?? null);
|
|
53592
53713
|
(0, import_react311.useEffect)(() => {
|
|
53593
|
-
|
|
53714
|
+
const before = lastActiveRecord.current;
|
|
53715
|
+
lastActiveRecord.current = activeRecordId ?? null;
|
|
53716
|
+
if (!activeRecordId) {
|
|
53717
|
+
if (before) setSurface((now) => now.rail === "record" ? { ...now, rail: "none" } : now);
|
|
53718
|
+
return;
|
|
53719
|
+
}
|
|
53720
|
+
if (reportedRecords.current.delete(activeRecordId)) return;
|
|
53594
53721
|
setOpenRecord(activeRecordId);
|
|
53595
53722
|
setSurface((now) => ({ ...now, rail: "record" }));
|
|
53596
53723
|
}, [activeRecordId]);
|
|
53724
|
+
const [shownIds, setShownIds] = (0, import_react311.useState)([]);
|
|
53725
|
+
const [recordExpanded, setRecordExpanded] = (0, import_react311.useState)(false);
|
|
53726
|
+
const shownRecord = rail === "record" ? openRecord : null;
|
|
53727
|
+
const reportedRecord = (0, import_react311.useRef)(activeRecordId ?? null);
|
|
53728
|
+
(0, import_react311.useEffect)(() => {
|
|
53729
|
+
if (shownRecord === reportedRecord.current) return;
|
|
53730
|
+
const how = shownRecord === null ? "close" : reportedRecord.current === null ? "open" : "step";
|
|
53731
|
+
reportedRecord.current = shownRecord;
|
|
53732
|
+
if (shownRecord) reportedRecords.current.add(shownRecord);
|
|
53733
|
+
onRecordChange?.(shownRecord, how);
|
|
53734
|
+
}, [shownRecord, onRecordChange]);
|
|
53597
53735
|
(0, import_react311.useEffect)(() => {
|
|
53598
53736
|
if (activeRecordId) return;
|
|
53599
53737
|
const named = railFromParam(activeRail);
|
|
@@ -53780,20 +53918,20 @@ function TablePage({
|
|
|
53780
53918
|
};
|
|
53781
53919
|
const footer = footerOf(shown5?.presentation);
|
|
53782
53920
|
const setFooter = (next) => void patchView({ presentation: { ...shown5?.presentation ?? {}, footer: next } });
|
|
53783
|
-
const layoutRadio = /* @__PURE__ */ (0,
|
|
53784
|
-
|
|
53921
|
+
const layoutRadio = /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(
|
|
53922
|
+
import_design_system158.DropdownMenuRadioGroup,
|
|
53785
53923
|
{
|
|
53786
53924
|
value: layoutShowing ?? "",
|
|
53787
53925
|
onValueChange: (value) => {
|
|
53788
53926
|
if (import_views2.VIEW_LAYOUTS.includes(value)) pickLayout(value);
|
|
53789
53927
|
},
|
|
53790
|
-
children: import_views2.VIEW_LAYOUTS.map((option) => /* @__PURE__ */ (0,
|
|
53928
|
+
children: import_views2.VIEW_LAYOUTS.map((option) => /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(import_design_system158.DropdownMenuRadioItem, { value: option, children: import_views2.LAYOUT_LABEL[option] }, option))
|
|
53791
53929
|
}
|
|
53792
53930
|
);
|
|
53793
|
-
const sheetExtras = controlsInSheet && main === "records" && shownLayout === "grid" ? /* @__PURE__ */ (0,
|
|
53794
|
-
/* @__PURE__ */ (0,
|
|
53795
|
-
/* @__PURE__ */ (0,
|
|
53796
|
-
|
|
53931
|
+
const sheetExtras = controlsInSheet && main === "records" && shownLayout === "grid" ? /* @__PURE__ */ (0, import_jsx_runtime176.jsxs)(import_jsx_runtime176.Fragment, { children: [
|
|
53932
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)("div", { className: "flex items-center gap-2 text-xs", "data-table-sheet-filter": "", "data-matrx-table-tools-keep-open": "", children: /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(ViewFilter, { tableId, view: shown5, onApply: (where) => void patchView({ where }) }) }),
|
|
53933
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)("div", { role: "group", "aria-label": "Layout", className: "flex flex-wrap gap-1 pt-1", "data-table-sheet-layout": "", children: import_views2.VIEW_LAYOUTS.map((option) => /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(
|
|
53934
|
+
import_design_system158.Button,
|
|
53797
53935
|
{
|
|
53798
53936
|
size: "sm",
|
|
53799
53937
|
variant: layoutShowing === option ? "secondary" : "ghost",
|
|
@@ -53804,7 +53942,7 @@ function TablePage({
|
|
|
53804
53942
|
},
|
|
53805
53943
|
option
|
|
53806
53944
|
)) }),
|
|
53807
|
-
rights.share && canShare ? /* @__PURE__ */ (0,
|
|
53945
|
+
rights.share && canShare ? /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(import_design_system158.Button, { size: "sm", variant: "ghost", className: "h-8", onClick: () => setShareAsked((n) => n + 1), "data-table-sheet-share": "", children: "Share\u2026" }) : null
|
|
53808
53946
|
] }) : void 0;
|
|
53809
53947
|
const go = (pressed) => {
|
|
53810
53948
|
if (!surfaceChosen(surface, pressed)) press(pressed);
|
|
@@ -54010,9 +54148,9 @@ function TablePage({
|
|
|
54010
54148
|
return () => window.removeEventListener("keydown", onKey);
|
|
54011
54149
|
}, [recordsUi]);
|
|
54012
54150
|
const openedFromMenu = openedEntry ? { ...openedEntry, label: actions.find((a) => a.id === openedEntry.id)?.label ?? openedEntry.key } : null;
|
|
54013
|
-
const pageActions = /* @__PURE__ */ (0,
|
|
54014
|
-
publicReadOnly ? /* @__PURE__ */ (0,
|
|
54015
|
-
!phone && rights.read && table.data ? /* @__PURE__ */ (0,
|
|
54151
|
+
const pageActions = /* @__PURE__ */ (0, import_jsx_runtime176.jsxs)(import_jsx_runtime176.Fragment, { children: [
|
|
54152
|
+
publicReadOnly ? /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(import_design_system158.Badge, { variant: "neutral", className: "shrink-0", "data-public-read-only": "", children: PUBLIC_READ_ONLY }, "public-read-only") : null,
|
|
54153
|
+
!phone && rights.read && table.data ? /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(
|
|
54016
54154
|
TableAsk,
|
|
54017
54155
|
{
|
|
54018
54156
|
tableId,
|
|
@@ -54024,7 +54162,7 @@ function TablePage({
|
|
|
54024
54162
|
},
|
|
54025
54163
|
"ask"
|
|
54026
54164
|
) : null,
|
|
54027
|
-
organizationId ? /* @__PURE__ */ (0,
|
|
54165
|
+
organizationId ? /* @__PURE__ */ (0, import_jsx_runtime176.jsx)("span", { className: shareInMenu ? "hidden" : "flex shrink-0 items-center", "data-toolbar-fit": "share", children: /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(
|
|
54028
54166
|
ShareControl,
|
|
54029
54167
|
{
|
|
54030
54168
|
kind: "table",
|
|
@@ -54038,28 +54176,28 @@ function TablePage({
|
|
|
54038
54176
|
},
|
|
54039
54177
|
`share-${shareAsked}`
|
|
54040
54178
|
) }, "share") : null,
|
|
54041
|
-
phone ? /* @__PURE__ */ (0,
|
|
54042
|
-
!chooserInline && !chooserCompact && !embedded ? /* @__PURE__ */ (0,
|
|
54043
|
-
/* @__PURE__ */ (0,
|
|
54044
|
-
/* @__PURE__ */ (0,
|
|
54179
|
+
phone ? /* @__PURE__ */ (0, import_jsx_runtime176.jsxs)(import_jsx_runtime176.Fragment, { children: [
|
|
54180
|
+
!chooserInline && !chooserCompact && !embedded ? /* @__PURE__ */ (0, import_jsx_runtime176.jsxs)(import_design_system158.DropdownMenu, { children: [
|
|
54181
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)(import_design_system158.DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(import_design_system158.Button, { size: "sm", variant: "ghost", "aria-label": "Layout", title: "Layout", "data-table-layout-menu": "", children: "Layout" }) }),
|
|
54182
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)(import_design_system158.DropdownMenuContent, { align: "end", className: "w-56", children: layoutRadio })
|
|
54045
54183
|
] }, "phone-layout") : null,
|
|
54046
54184
|
phoneTableActions(actions)
|
|
54047
|
-
] }) : /* @__PURE__ */ (0,
|
|
54048
|
-
/* @__PURE__ */ (0,
|
|
54049
|
-
/* @__PURE__ */ (0,
|
|
54050
|
-
/* @__PURE__ */ (0,
|
|
54051
|
-
/* @__PURE__ */ (0,
|
|
54185
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime176.jsxs)(import_design_system158.DropdownMenu, { children: [
|
|
54186
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)(import_design_system158.DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(import_design_system158.Button, { size: "sm", variant: "ghost", "aria-label": "Table menu", title: "Table menu", "data-table-menu": "", children: /* @__PURE__ */ (0, import_jsx_runtime176.jsxs)("svg", { viewBox: "0 0 24 24", className: "h-4 w-4", fill: "currentColor", "aria-hidden": "true", children: [
|
|
54187
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)("circle", { cx: "5", cy: "12", r: "1.75" }),
|
|
54188
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)("circle", { cx: "12", cy: "12", r: "1.75" }),
|
|
54189
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)("circle", { cx: "19", cy: "12", r: "1.75" })
|
|
54052
54190
|
] }) }) }),
|
|
54053
|
-
/* @__PURE__ */ (0,
|
|
54054
|
-
!chooserInline && !chooserCompact && !embedded ? /* @__PURE__ */ (0,
|
|
54055
|
-
/* @__PURE__ */ (0,
|
|
54191
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsxs)(import_design_system158.DropdownMenuContent, { align: "end", className: "w-64", "data-table-menu-content": "", ...renameMenuProps, children: [
|
|
54192
|
+
!chooserInline && !chooserCompact && !embedded ? /* @__PURE__ */ (0, import_jsx_runtime176.jsxs)(import_jsx_runtime176.Fragment, { children: [
|
|
54193
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)(import_design_system158.DropdownMenuLabel, { className: "text-xs text-muted-foreground", children: "Layout" }),
|
|
54056
54194
|
layoutRadio,
|
|
54057
|
-
/* @__PURE__ */ (0,
|
|
54195
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)(import_design_system158.DropdownMenuSeparator, {})
|
|
54058
54196
|
] }) : null,
|
|
54059
|
-
/* @__PURE__ */ (0,
|
|
54197
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)(ObjectActionMenuItems, { actions })
|
|
54060
54198
|
] })
|
|
54061
54199
|
] }, "menu"),
|
|
54062
|
-
moveAsked > 0 && !actionHost?.move ? /* @__PURE__ */ (0,
|
|
54200
|
+
moveAsked > 0 && !actionHost?.move ? /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(
|
|
54063
54201
|
WhereItLives,
|
|
54064
54202
|
{
|
|
54065
54203
|
tableId,
|
|
@@ -54072,7 +54210,7 @@ function TablePage({
|
|
|
54072
54210
|
},
|
|
54073
54211
|
"move"
|
|
54074
54212
|
) : null,
|
|
54075
|
-
breakDownOpen ? /* @__PURE__ */ (0,
|
|
54213
|
+
breakDownOpen ? /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(
|
|
54076
54214
|
BreakDownDialog,
|
|
54077
54215
|
{
|
|
54078
54216
|
tableId,
|
|
@@ -54083,7 +54221,7 @@ function TablePage({
|
|
|
54083
54221
|
},
|
|
54084
54222
|
"break-down"
|
|
54085
54223
|
) : null,
|
|
54086
|
-
subscribeOpen && recordsUi.calendarFeed && organizationId && view ? /* @__PURE__ */ (0,
|
|
54224
|
+
subscribeOpen && recordsUi.calendarFeed && organizationId && view ? /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(
|
|
54087
54225
|
CalendarSubscribeDialog,
|
|
54088
54226
|
{
|
|
54089
54227
|
port: recordsUi.calendarFeed,
|
|
@@ -54096,8 +54234,8 @@ function TablePage({
|
|
|
54096
54234
|
},
|
|
54097
54235
|
"subscribe"
|
|
54098
54236
|
) : null,
|
|
54099
|
-
referenceOpen && table.data ? /* @__PURE__ */ (0,
|
|
54100
|
-
duplicateOpen && table.data ? /* @__PURE__ */ (0,
|
|
54237
|
+
referenceOpen && table.data ? /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(TableReferenceDialog, { table: table.data, open: referenceOpen, onOpenChange: setReferenceOpen }, "reference") : null,
|
|
54238
|
+
duplicateOpen && table.data ? /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(
|
|
54101
54239
|
TableDuplicateDialog,
|
|
54102
54240
|
{
|
|
54103
54241
|
tableId,
|
|
@@ -54108,39 +54246,39 @@ function TablePage({
|
|
|
54108
54246
|
},
|
|
54109
54247
|
"duplicate"
|
|
54110
54248
|
) : null,
|
|
54111
|
-
rights.structure && table.data ? /* @__PURE__ */ (0,
|
|
54249
|
+
rights.structure && table.data ? /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(TableRenameDialog, { tableId, name: table.data.name, open: renameOpen, onOpenChange: setRenameOpen }, "rename") : null
|
|
54112
54250
|
] });
|
|
54113
54251
|
const headerNode = header && !embedded ? header({ actions: table.data ? pageActions : null, tableName: table.data?.name ?? null }) : null;
|
|
54114
|
-
if (table.error) return /* @__PURE__ */ (0,
|
|
54252
|
+
if (table.error) return /* @__PURE__ */ (0, import_jsx_runtime176.jsxs)(import_jsx_runtime176.Fragment, { children: [
|
|
54115
54253
|
headerNode,
|
|
54116
|
-
/* @__PURE__ */ (0,
|
|
54254
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)(RefusalNotice, { error: table.error })
|
|
54117
54255
|
] });
|
|
54118
54256
|
if (table.loading && !table.data) {
|
|
54119
|
-
return /* @__PURE__ */ (0,
|
|
54257
|
+
return /* @__PURE__ */ (0, import_jsx_runtime176.jsxs)(import_jsx_runtime176.Fragment, { children: [
|
|
54120
54258
|
headerNode,
|
|
54121
|
-
/* @__PURE__ */ (0,
|
|
54259
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)(TablePageSkeleton, { layout: skeletonFace, embedded, tableId, ...className ? { className } : {} })
|
|
54122
54260
|
] });
|
|
54123
54261
|
}
|
|
54124
54262
|
if (!table.data) {
|
|
54125
|
-
return /* @__PURE__ */ (0,
|
|
54263
|
+
return /* @__PURE__ */ (0, import_jsx_runtime176.jsxs)(import_jsx_runtime176.Fragment, { children: [
|
|
54126
54264
|
headerNode,
|
|
54127
|
-
/* @__PURE__ */ (0,
|
|
54265
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)(TableNotHere, { tableId, onLeave, leaveLabel, className })
|
|
54128
54266
|
] });
|
|
54129
54267
|
}
|
|
54130
54268
|
const lookSavable = Boolean(
|
|
54131
54269
|
rights.write && view && Object.keys(viewPatchDocument((0, import_views3.saveToViewPlan)(view, look ?? {}).patch)).length > 0
|
|
54132
54270
|
);
|
|
54133
|
-
return /* @__PURE__ */ (0,
|
|
54271
|
+
return /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(ViewAddressContext.Provider, { value: addressPort, children: /* @__PURE__ */ (0, import_jsx_runtime176.jsxs)("div", { className: (0, import_design_system158.cn)("flex h-full min-h-0 gap-4", className), "data-table-footer": footer, children: [
|
|
54134
54272
|
headerNode,
|
|
54135
|
-
/* @__PURE__ */ (0,
|
|
54273
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)("div", { className: "flex min-h-0 min-w-0 flex-1 flex-col gap-2", children: structure.hidden || !structure.settled ? (
|
|
54136
54274
|
/* THE TOOLBAR ROW'S HEIGHT IS KEPT (min-h-8), so the sentence lands exactly where the bar was. */
|
|
54137
|
-
/* @__PURE__ */ (0,
|
|
54138
|
-
/* @__PURE__ */ (0,
|
|
54139
|
-
structure.hidden ? /* @__PURE__ */ (0,
|
|
54275
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsxs)(import_jsx_runtime176.Fragment, { children: [
|
|
54276
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)("div", { className: TABLE_TOOLBAR_ROW_CLASS, "data-table-toolbar": "", "aria-hidden": "true" }),
|
|
54277
|
+
structure.hidden ? /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(StructureLocked, {}) : /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(RecordsSkeleton, { layout: skeletonFace, embedded })
|
|
54140
54278
|
] })
|
|
54141
|
-
) : /* @__PURE__ */ (0,
|
|
54142
|
-
/* @__PURE__ */ (0,
|
|
54143
|
-
/* @__PURE__ */ (0,
|
|
54279
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime176.jsxs)(import_jsx_runtime176.Fragment, { children: [
|
|
54280
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)(ImportNotice, { tableId, epoch: importEpoch, onOpenImport: () => setRail("import") }),
|
|
54281
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsxs)(
|
|
54144
54282
|
"div",
|
|
54145
54283
|
{
|
|
54146
54284
|
ref: setToolbarRow,
|
|
@@ -54148,7 +54286,7 @@ function TablePage({
|
|
|
54148
54286
|
"data-table-toolbar": "",
|
|
54149
54287
|
"data-table-toolbar-fold": toolbarFold2,
|
|
54150
54288
|
children: [
|
|
54151
|
-
/* @__PURE__ */ (0,
|
|
54289
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)(
|
|
54152
54290
|
ViewBar,
|
|
54153
54291
|
{
|
|
54154
54292
|
tableId,
|
|
@@ -54167,26 +54305,26 @@ function TablePage({
|
|
|
54167
54305
|
onViews: setViews,
|
|
54168
54306
|
...seededViews && viewsEpoch === 0 ? { initialViews: seededViews } : {},
|
|
54169
54307
|
seed: seedViews ?? [defaultView(tableId)],
|
|
54170
|
-
settings: view && main === "records" && shownLayout === "grid" ? /* @__PURE__ */ (0,
|
|
54171
|
-
/* @__PURE__ */ (0,
|
|
54172
|
-
["sticky", "inline"].map((option) => /* @__PURE__ */ (0,
|
|
54308
|
+
settings: view && main === "records" && shownLayout === "grid" ? /* @__PURE__ */ (0, import_jsx_runtime176.jsxs)("div", { className: "flex flex-col gap-0.5 px-1 py-1", role: "radiogroup", "aria-label": FOOTER_WORDS.label, children: [
|
|
54309
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)("span", { className: "px-1 pb-0.5 text-[11px] font-medium text-muted-foreground", children: FOOTER_WORDS.label }),
|
|
54310
|
+
["sticky", "inline"].map((option) => /* @__PURE__ */ (0, import_jsx_runtime176.jsxs)(
|
|
54173
54311
|
"button",
|
|
54174
54312
|
{
|
|
54175
54313
|
type: "button",
|
|
54176
54314
|
role: "radio",
|
|
54177
54315
|
"aria-checked": footer === option,
|
|
54178
54316
|
"data-view-footer": option,
|
|
54179
|
-
className: (0,
|
|
54317
|
+
className: (0, import_design_system158.cn)(
|
|
54180
54318
|
"flex min-h-7 items-center gap-2 rounded-sm px-1 text-left text-xs text-popover-foreground hover:bg-accent hover:text-accent-foreground",
|
|
54181
54319
|
footer === option && "font-medium"
|
|
54182
54320
|
),
|
|
54183
54321
|
onClick: () => setFooter(option),
|
|
54184
54322
|
children: [
|
|
54185
|
-
/* @__PURE__ */ (0,
|
|
54323
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)(
|
|
54186
54324
|
"span",
|
|
54187
54325
|
{
|
|
54188
54326
|
"aria-hidden": "true",
|
|
54189
|
-
className: (0,
|
|
54327
|
+
className: (0, import_design_system158.cn)("h-2 w-2 shrink-0 rounded-full border border-current", footer === option && "bg-current")
|
|
54190
54328
|
}
|
|
54191
54329
|
),
|
|
54192
54330
|
FOOTER_WORDS[option]
|
|
@@ -54198,8 +54336,8 @@ function TablePage({
|
|
|
54198
54336
|
},
|
|
54199
54337
|
viewsEpoch
|
|
54200
54338
|
),
|
|
54201
|
-
chooserInline ? /* @__PURE__ */ (0,
|
|
54202
|
-
|
|
54339
|
+
chooserInline ? /* @__PURE__ */ (0, import_jsx_runtime176.jsx)("div", { className: "flex shrink-0 items-center gap-0.5", role: "group", "aria-label": "Layout", "data-toolbar-fit": "chooser", children: import_views2.VIEW_LAYOUTS.map((option) => /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(
|
|
54340
|
+
import_design_system158.Button,
|
|
54203
54341
|
{
|
|
54204
54342
|
size: "sm",
|
|
54205
54343
|
variant: layoutShowing === option ? "secondary" : "ghost",
|
|
@@ -54213,21 +54351,21 @@ function TablePage({
|
|
|
54213
54351
|
/* THE ROW HAD NO ROOM (lane C, review 2026-09-26 D6: the switcher vanished at 1280 px and
|
|
54214
54352
|
with the record panel open): the chooser folds to ONE button naming the layout that is
|
|
54215
54353
|
showing — it never leaves the row. */
|
|
54216
|
-
/* @__PURE__ */ (0,
|
|
54217
|
-
/* @__PURE__ */ (0,
|
|
54354
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)("span", { className: "flex shrink-0 items-center", "data-toolbar-fit": "chooser", "data-layout-chooser-compact": "", children: /* @__PURE__ */ (0, import_jsx_runtime176.jsxs)(import_design_system158.DropdownMenu, { children: [
|
|
54355
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)(import_design_system158.DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime176.jsxs)(import_design_system158.Button, { size: "sm", variant: "outline", className: "h-8 gap-1 px-2 text-xs", "aria-label": `Layout: ${layoutShowingLabel ?? "none"}`, children: [
|
|
54218
54356
|
layoutShowingLabel ?? "Layout",
|
|
54219
|
-
/* @__PURE__ */ (0,
|
|
54357
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)("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__ */ (0, import_jsx_runtime176.jsx)("path", { d: "m6 9 6 6 6-6" }) })
|
|
54220
54358
|
] }) }),
|
|
54221
|
-
/* @__PURE__ */ (0,
|
|
54222
|
-
/* @__PURE__ */ (0,
|
|
54359
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsxs)(import_design_system158.DropdownMenuContent, { align: "start", className: "w-44", "data-layout-chooser-menu": "", children: [
|
|
54360
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)(import_design_system158.DropdownMenuLabel, { className: "text-xs text-muted-foreground", children: "Layout" }),
|
|
54223
54361
|
layoutRadio
|
|
54224
54362
|
] })
|
|
54225
54363
|
] }) })
|
|
54226
54364
|
) : null,
|
|
54227
|
-
main === "records" && !(controlsInSheet && shownLayout === "grid") ? /* @__PURE__ */ (0,
|
|
54228
|
-
lookShowing && main === "records" && !namingLook ? /* @__PURE__ */ (0,
|
|
54229
|
-
/* @__PURE__ */ (0,
|
|
54230
|
-
|
|
54365
|
+
main === "records" && !(controlsInSheet && shownLayout === "grid") ? /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(ViewFilter, { tableId, view: shown5, onApply: (where) => void patchView({ where }) }) : null,
|
|
54366
|
+
lookShowing && main === "records" && !namingLook ? /* @__PURE__ */ (0, import_jsx_runtime176.jsxs)("span", { className: "flex shrink-0 items-center gap-1", "data-view-look": "", "data-view-look-folded": "", "data-toolbar-fit": "look", children: [
|
|
54367
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)(
|
|
54368
|
+
import_design_system158.Button,
|
|
54231
54369
|
{
|
|
54232
54370
|
size: "sm",
|
|
54233
54371
|
variant: "outline",
|
|
@@ -54236,36 +54374,36 @@ function TablePage({
|
|
|
54236
54374
|
"aria-label": "Reset view",
|
|
54237
54375
|
onClick: () => void resetLook(),
|
|
54238
54376
|
"data-view-look-reset-button": "",
|
|
54239
|
-
children: /* @__PURE__ */ (0,
|
|
54240
|
-
/* @__PURE__ */ (0,
|
|
54241
|
-
/* @__PURE__ */ (0,
|
|
54377
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime176.jsxs)("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: [
|
|
54378
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)("path", { d: "M3 12a9 9 0 1 0 3-6.7L3 8" }),
|
|
54379
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)("path", { d: "M3 3v5h5" })
|
|
54242
54380
|
] })
|
|
54243
54381
|
}
|
|
54244
54382
|
),
|
|
54245
|
-
/* @__PURE__ */ (0,
|
|
54246
|
-
/* @__PURE__ */ (0,
|
|
54247
|
-
/* @__PURE__ */ (0,
|
|
54248
|
-
/* @__PURE__ */ (0,
|
|
54383
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsxs)(import_design_system158.DropdownMenu, { children: [
|
|
54384
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)(import_design_system158.DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime176.jsxs)(import_design_system158.Button, { 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: [
|
|
54385
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)(LookGlyph, {}),
|
|
54386
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)("span", { "aria-hidden": "true", className: "absolute right-1 top-1 h-1.5 w-1.5 rounded-full bg-primary" })
|
|
54249
54387
|
] }) }),
|
|
54250
|
-
/* @__PURE__ */ (0,
|
|
54251
|
-
lookSavable ? /* @__PURE__ */ (0,
|
|
54252
|
-
rights.write ? /* @__PURE__ */ (0,
|
|
54253
|
-
/* @__PURE__ */ (0,
|
|
54388
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsxs)(import_design_system158.DropdownMenuContent, { align: "start", className: "w-60", "data-view-look-menu-content": "", children: [
|
|
54389
|
+
lookSavable ? /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(import_design_system158.DropdownMenuItem, { onSelect: () => void saveLookToView(), "data-view-look-save": "", children: LOOK_WORDS.saveToView }) : null,
|
|
54390
|
+
rights.write ? /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(import_design_system158.DropdownMenuItem, { onSelect: () => setNamingLook(true), "data-view-look-save-new": "", children: LOOK_WORDS.saveAsNew }) : null,
|
|
54391
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)(import_design_system158.DropdownMenuItem, { onSelect: () => void resetLook(), "data-view-look-reset": "", children: LOOK_WORDS.reset })
|
|
54254
54392
|
] })
|
|
54255
54393
|
] })
|
|
54256
54394
|
] }) : !lookShowing && main === "records" && view && !phone && !controlsInSheet ? (
|
|
54257
54395
|
/* The reserved place keeps its full width at every row width (STABLE-TABLES): when it
|
|
54258
54396
|
shrank on a narrow row, the look arriving on a sort pushed every control after it.
|
|
54259
54397
|
A row too narrow for it scrolls sideways, as the row already does. */
|
|
54260
|
-
/* @__PURE__ */ (0,
|
|
54261
|
-
/* @__PURE__ */ (0,
|
|
54262
|
-
/* @__PURE__ */ (0,
|
|
54398
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsxs)("span", { "aria-hidden": "true", className: "invisible flex shrink-0 items-center gap-1 overflow-hidden", "data-view-look-place": "", "data-toolbar-fit-gives": "", children: [
|
|
54399
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)(import_design_system158.Button, { size: "sm", variant: "outline", className: "h-8 w-8 shrink-0 px-0", tabIndex: -1, children: /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(LookGlyph, {}) }),
|
|
54400
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)(import_design_system158.Button, { size: "sm", variant: "outline", className: "h-8 w-8 shrink-0 px-0", tabIndex: -1 })
|
|
54263
54401
|
] })
|
|
54264
|
-
) : lookShowing && main === "records" ? /* @__PURE__ */ (0,
|
|
54265
|
-
/* @__PURE__ */ (0,
|
|
54266
|
-
/* @__PURE__ */ (0,
|
|
54267
|
-
lookSavable ? /* @__PURE__ */ (0,
|
|
54268
|
-
rights.write ? namingLook ? /* @__PURE__ */ (0,
|
|
54402
|
+
) : lookShowing && main === "records" ? /* @__PURE__ */ (0, import_jsx_runtime176.jsxs)("span", { className: "flex shrink-0 items-center gap-1", "data-view-look": "", "data-toolbar-fit": "look", title: LOOK_WORDS.yours, children: [
|
|
54403
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)("span", { className: "sr-only", children: LOOK_WORDS.yours }),
|
|
54404
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)("span", { "aria-hidden": "true", className: "h-1.5 w-1.5 shrink-0 rounded-full bg-primary" }),
|
|
54405
|
+
lookSavable ? /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(import_design_system158.Button, { size: "sm", variant: "outline", className: "h-8 px-2 text-xs", onClick: () => void saveLookToView(), "data-view-look-save": "", children: LOOK_WORDS.saveToView }) : null,
|
|
54406
|
+
rights.write ? namingLook ? /* @__PURE__ */ (0, import_jsx_runtime176.jsxs)(
|
|
54269
54407
|
"form",
|
|
54270
54408
|
{
|
|
54271
54409
|
className: "flex items-center gap-1",
|
|
@@ -54274,8 +54412,8 @@ function TablePage({
|
|
|
54274
54412
|
void saveLookAsNewView(lookName);
|
|
54275
54413
|
},
|
|
54276
54414
|
children: [
|
|
54277
|
-
/* @__PURE__ */ (0,
|
|
54278
|
-
|
|
54415
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)(
|
|
54416
|
+
import_design_system158.Input,
|
|
54279
54417
|
{
|
|
54280
54418
|
autoFocus: true,
|
|
54281
54419
|
"aria-label": LOOK_WORDS.newName,
|
|
@@ -54285,17 +54423,17 @@ function TablePage({
|
|
|
54285
54423
|
placeholder: "View name"
|
|
54286
54424
|
}
|
|
54287
54425
|
),
|
|
54288
|
-
/* @__PURE__ */ (0,
|
|
54426
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)(import_design_system158.Button, { size: "sm", type: "submit", className: "h-8 px-2 text-xs", disabled: lookName.trim() === "", children: "Save" })
|
|
54289
54427
|
]
|
|
54290
54428
|
}
|
|
54291
|
-
) : /* @__PURE__ */ (0,
|
|
54292
|
-
/* @__PURE__ */ (0,
|
|
54429
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(import_design_system158.Button, { size: "sm", variant: "ghost", className: "h-8 px-2 text-xs", onClick: () => setNamingLook(true), "data-view-look-save-new": "", children: LOOK_WORDS.saveAsNew }) : null,
|
|
54430
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)(import_design_system158.Button, { size: "sm", variant: "ghost", className: "h-8 px-2 text-xs", onClick: () => void resetLook(), "data-view-look-reset": "", children: LOOK_WORDS.reset })
|
|
54293
54431
|
] }) : null,
|
|
54294
|
-
/* @__PURE__ */ (0,
|
|
54432
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)(
|
|
54295
54433
|
"div",
|
|
54296
54434
|
{
|
|
54297
54435
|
ref: setToolbarSlot,
|
|
54298
|
-
className: (0,
|
|
54436
|
+
className: (0, import_design_system158.cn)(
|
|
54299
54437
|
// `min-w-9`: never narrower than the layout toolbar's folded "…" (36 px) — a row too
|
|
54300
54438
|
// narrow for its pinned controls folds them behind that "…" (design-system
|
|
54301
54439
|
// `usePinnedFold`), and the "…" itself is never cut (merged-grid leftovers, 2026-09-28).
|
|
@@ -54313,9 +54451,9 @@ function TablePage({
|
|
|
54313
54451
|
"data-clipped": slotClipped
|
|
54314
54452
|
}
|
|
54315
54453
|
),
|
|
54316
|
-
rights.write && view && main === "records" && shownLayout !== "grid" ? /* @__PURE__ */ (0,
|
|
54317
|
-
openedFromMenu ? /* @__PURE__ */ (0,
|
|
54318
|
-
|
|
54454
|
+
rights.write && view && main === "records" && shownLayout !== "grid" ? /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(import_design_system158.Button, { size: "sm", className: "shrink-0", onClick: () => show("new-record"), children: "New record" }) : null,
|
|
54455
|
+
openedFromMenu ? /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(
|
|
54456
|
+
import_design_system158.Button,
|
|
54319
54457
|
{
|
|
54320
54458
|
size: "sm",
|
|
54321
54459
|
variant: "secondary",
|
|
@@ -54327,19 +54465,19 @@ function TablePage({
|
|
|
54327
54465
|
children: openedFromMenu.label
|
|
54328
54466
|
}
|
|
54329
54467
|
) : null,
|
|
54330
|
-
header ? null : /* @__PURE__ */ (0,
|
|
54468
|
+
header ? null : /* @__PURE__ */ (0, import_jsx_runtime176.jsx)("span", { className: "flex shrink-0 items-center gap-1", "data-table-page-actions": "", children: pageActions })
|
|
54331
54469
|
]
|
|
54332
54470
|
}
|
|
54333
54471
|
),
|
|
54334
|
-
designateRefused ? /* @__PURE__ */ (0,
|
|
54335
|
-
viewSaveRefused ? /* @__PURE__ */ (0,
|
|
54472
|
+
designateRefused ? /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(RefusalNotice, { error: designateRefused }) : null,
|
|
54473
|
+
viewSaveRefused ? /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(
|
|
54336
54474
|
RefusalNotice,
|
|
54337
54475
|
{
|
|
54338
54476
|
error: viewSaveRefused.error,
|
|
54339
|
-
actions: /* @__PURE__ */ (0,
|
|
54340
|
-
/* @__PURE__ */ (0,
|
|
54341
|
-
/* @__PURE__ */ (0,
|
|
54342
|
-
|
|
54477
|
+
actions: /* @__PURE__ */ (0, import_jsx_runtime176.jsxs)("span", { className: "flex flex-wrap gap-1 pt-0.5", "data-view-save-refused": "", children: [
|
|
54478
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)(import_design_system158.Button, { size: "sm", variant: "outline", onClick: () => void patchView(viewSaveRefused.patch), children: "Try again" }),
|
|
54479
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)(
|
|
54480
|
+
import_design_system158.Button,
|
|
54343
54481
|
{
|
|
54344
54482
|
size: "sm",
|
|
54345
54483
|
variant: "ghost",
|
|
@@ -54359,8 +54497,8 @@ function TablePage({
|
|
|
54359
54497
|
] })
|
|
54360
54498
|
}
|
|
54361
54499
|
) : null,
|
|
54362
|
-
lookRefused ? /* @__PURE__ */ (0,
|
|
54363
|
-
main === "dashboards" ? /* @__PURE__ */ (0,
|
|
54500
|
+
lookRefused ? /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(RefusalNotice, { error: lookRefused }) : null,
|
|
54501
|
+
main === "dashboards" ? /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(DashboardCanvas, { tableId, activeDashboardId: activeDashboardId ?? null }) : main === "questions" ? /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(
|
|
54364
54502
|
QuestionPanel,
|
|
54365
54503
|
{
|
|
54366
54504
|
tableId,
|
|
@@ -54372,7 +54510,7 @@ function TablePage({
|
|
|
54372
54510
|
page returns to the records rather than leaving the person looking
|
|
54373
54511
|
at a list the record is no longer in — and opens it, because the
|
|
54374
54512
|
thing they just rescued is the thing they came for. */
|
|
54375
|
-
/* @__PURE__ */ (0,
|
|
54513
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)(
|
|
54376
54514
|
ArchivedView,
|
|
54377
54515
|
{
|
|
54378
54516
|
tableId,
|
|
@@ -54384,10 +54522,10 @@ function TablePage({
|
|
|
54384
54522
|
}
|
|
54385
54523
|
}
|
|
54386
54524
|
)
|
|
54387
|
-
) : /* @__PURE__ */ (0,
|
|
54525
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(TableToolbarSlotContext.Provider, { value: toolbarSlot, children: /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(TableToolbarFoldContext.Provider, { value: toolbarFold2, children: /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(TableToolbarSheetExtrasContext.Provider, { value: sheetExtras, children: /* @__PURE__ */ (0, import_jsx_runtime176.jsxs)(
|
|
54388
54526
|
"div",
|
|
54389
54527
|
{
|
|
54390
|
-
className: (0,
|
|
54528
|
+
className: (0, import_design_system158.cn)(
|
|
54391
54529
|
"min-h-0 flex-1",
|
|
54392
54530
|
// Inline: a plain scrolling block, so nothing in it shrinks to the height — the
|
|
54393
54531
|
// layout is as tall as its rows and the footer follows the last one.
|
|
@@ -54395,10 +54533,10 @@ function TablePage({
|
|
|
54395
54533
|
),
|
|
54396
54534
|
"data-table-records": "",
|
|
54397
54535
|
children: [
|
|
54398
|
-
railUnknown ? /* @__PURE__ */ (0,
|
|
54399
|
-
shareFromLink && rights.known && (!rights.share || !canShare) ? /* @__PURE__ */ (0,
|
|
54400
|
-
opened.unknown ? /* @__PURE__ */ (0,
|
|
54401
|
-
viewLinkMissed ? /* @__PURE__ */ (0,
|
|
54536
|
+
railUnknown ? /* @__PURE__ */ (0, import_jsx_runtime176.jsx)("p", { className: "rounded-md border border-amber-600/40 bg-amber-500/5 px-3 py-2 text-xs leading-relaxed text-amber-700 dark:border-amber-400/40 dark:text-amber-300", children: unknownRailLine(railUnknown) }) : null,
|
|
54537
|
+
shareFromLink && rights.known && (!rights.share || !canShare) ? /* @__PURE__ */ (0, import_jsx_runtime176.jsx)("p", { className: "rounded-md border border-amber-600/40 bg-amber-500/5 px-3 py-2 text-xs leading-relaxed text-amber-700 dark:border-amber-400/40 dark:text-amber-300", children: canShare ? SHARE_NOT_YOURS_LINE : shareUnavailableReason() }) : null,
|
|
54538
|
+
opened.unknown ? /* @__PURE__ */ (0, import_jsx_runtime176.jsx)("p", { className: "rounded-md border border-amber-600/40 bg-amber-500/5 px-3 py-2 text-xs leading-relaxed text-amber-700 dark:border-amber-400/40 dark:text-amber-300", children: (0, import_views2.unknownViewLine)(opened.unknown) }) : null,
|
|
54539
|
+
viewLinkMissed ? /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(
|
|
54402
54540
|
"p",
|
|
54403
54541
|
{
|
|
54404
54542
|
"data-records-view-link-missed": "",
|
|
@@ -54406,7 +54544,7 @@ function TablePage({
|
|
|
54406
54544
|
children: unknownSavedViewLine(view?.name ?? null)
|
|
54407
54545
|
}
|
|
54408
54546
|
) : null,
|
|
54409
|
-
cameFrom ? /* @__PURE__ */ (0,
|
|
54547
|
+
cameFrom ? /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(
|
|
54410
54548
|
"p",
|
|
54411
54549
|
{
|
|
54412
54550
|
"data-testid": "came-from-a-number",
|
|
@@ -54416,7 +54554,7 @@ function TablePage({
|
|
|
54416
54554
|
) : null,
|
|
54417
54555
|
faceUnknown ? (
|
|
54418
54556
|
/* REVIEW-FIX 10: a full page paints the rows this table showed last time (else fills). */
|
|
54419
|
-
/* @__PURE__ */ (0,
|
|
54557
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)(
|
|
54420
54558
|
RecordsSkeleton,
|
|
54421
54559
|
{
|
|
54422
54560
|
layout: skeletonFace,
|
|
@@ -54424,7 +54562,7 @@ function TablePage({
|
|
|
54424
54562
|
...embedded ? {} : { rows: rememberedRowCount(`${tableId}:page:last`, 100, "fill") }
|
|
54425
54563
|
}
|
|
54426
54564
|
)
|
|
54427
|
-
) : /* @__PURE__ */ (0,
|
|
54565
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(
|
|
54428
54566
|
ViewSwitcher,
|
|
54429
54567
|
{
|
|
54430
54568
|
chooser: false,
|
|
@@ -54466,19 +54604,20 @@ function TablePage({
|
|
|
54466
54604
|
},
|
|
54467
54605
|
openRecordId: rail === "record" ? openRecord : null,
|
|
54468
54606
|
onCloseRecord: () => setRail("none"),
|
|
54607
|
+
onRowsShown: setShownIds,
|
|
54469
54608
|
onAskWhoChanged: (fieldKey, recordId) => {
|
|
54470
54609
|
setAsking({ fieldKey, recordId });
|
|
54471
54610
|
setRail("who-changed");
|
|
54472
54611
|
}
|
|
54473
54612
|
}
|
|
54474
54613
|
),
|
|
54475
|
-
view || faceUnknown || views === void 0 || views !== null && views.length > 0 ? null : /* @__PURE__ */ (0,
|
|
54614
|
+
view || faceUnknown || views === void 0 || views !== null && views.length > 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime176.jsx)("p", { className: "text-xs text-muted-foreground", children: VIEW_NOT_SAVED_YET })
|
|
54476
54615
|
]
|
|
54477
54616
|
}
|
|
54478
54617
|
) }) }) })
|
|
54479
54618
|
] }) }),
|
|
54480
|
-
rail === "none" ? null : /* @__PURE__ */ (0,
|
|
54481
|
-
rail === "settings" ? /* @__PURE__ */ (0,
|
|
54619
|
+
rail === "none" ? null : /* @__PURE__ */ (0, import_jsx_runtime176.jsxs)(RailFrame, { phone, title: RAIL_TITLE[rail], onClose: () => setRail("none"), over: rail === "record" && recordExpanded, children: [
|
|
54620
|
+
rail === "settings" ? /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(
|
|
54482
54621
|
TableSettings,
|
|
54483
54622
|
{
|
|
54484
54623
|
tableId,
|
|
@@ -54495,7 +54634,7 @@ function TablePage({
|
|
|
54495
54634
|
} : void 0
|
|
54496
54635
|
}
|
|
54497
54636
|
) : null,
|
|
54498
|
-
rail === "inbox" ? /* @__PURE__ */ (0,
|
|
54637
|
+
rail === "inbox" ? /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(
|
|
54499
54638
|
ActionInbox,
|
|
54500
54639
|
{
|
|
54501
54640
|
tableId,
|
|
@@ -54505,9 +54644,9 @@ function TablePage({
|
|
|
54505
54644
|
}
|
|
54506
54645
|
}
|
|
54507
54646
|
) : null,
|
|
54508
|
-
rail === "forms" ? /* @__PURE__ */ (0,
|
|
54509
|
-
rail === "bookings" ? /* @__PURE__ */ (0,
|
|
54510
|
-
rail === "checklists" ? /* @__PURE__ */ (0,
|
|
54647
|
+
rail === "forms" ? /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(FormsPanel, { tableId, activeFormId: itemFor("forms") }) : null,
|
|
54648
|
+
rail === "bookings" ? /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(BookingSlots, { tableId, activeBookingId: itemFor("bookings") }) : null,
|
|
54649
|
+
rail === "checklists" ? /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(
|
|
54511
54650
|
ChecklistsPanel,
|
|
54512
54651
|
{
|
|
54513
54652
|
tableId,
|
|
@@ -54517,12 +54656,12 @@ function TablePage({
|
|
|
54517
54656
|
}
|
|
54518
54657
|
}
|
|
54519
54658
|
) : null,
|
|
54520
|
-
rail === "notifications" ? /* @__PURE__ */ (0,
|
|
54521
|
-
rail === "portals" ? /* @__PURE__ */ (0,
|
|
54522
|
-
rail === "export" ? /* @__PURE__ */ (0,
|
|
54523
|
-
rail === "import" ? /* @__PURE__ */ (0,
|
|
54524
|
-
rail === "field" ? /* @__PURE__ */ (0,
|
|
54525
|
-
rail === "new-record" ? /* @__PURE__ */ (0,
|
|
54659
|
+
rail === "notifications" ? /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(SubscriptionsPanel, { tableId, activeRuleId: itemFor("notifications") }) : null,
|
|
54660
|
+
rail === "portals" ? /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(PortalsPanel, { tableId, activePortalId: itemFor("portals") }) : null,
|
|
54661
|
+
rail === "export" ? /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(ExportMenu, { tableId, view: viewReading }) : null,
|
|
54662
|
+
rail === "import" ? /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(ImportWizard, { tableId, onWrote: () => setImportEpoch((n) => n + 1), onDone: () => setRail("none") }) : null,
|
|
54663
|
+
rail === "field" ? /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(FieldEditor, { tableId, onSaved: () => setRail("none"), onCancel: () => setRail("none") }) : null,
|
|
54664
|
+
rail === "new-record" ? /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(
|
|
54526
54665
|
RecordForm,
|
|
54527
54666
|
{
|
|
54528
54667
|
tableId,
|
|
@@ -54533,7 +54672,7 @@ function TablePage({
|
|
|
54533
54672
|
onCancel: () => setRail("none")
|
|
54534
54673
|
}
|
|
54535
54674
|
) : null,
|
|
54536
|
-
rail === "who-changed" && asking ? /* @__PURE__ */ (0,
|
|
54675
|
+
rail === "who-changed" && asking ? /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(
|
|
54537
54676
|
FieldHistoryPanel,
|
|
54538
54677
|
{
|
|
54539
54678
|
tableId,
|
|
@@ -54546,12 +54685,16 @@ function TablePage({
|
|
|
54546
54685
|
}
|
|
54547
54686
|
}
|
|
54548
54687
|
) : null,
|
|
54549
|
-
rail === "record" && openRecord ? /* @__PURE__ */ (0,
|
|
54688
|
+
rail === "record" && openRecord ? /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(
|
|
54550
54689
|
RecordPanel,
|
|
54551
54690
|
{
|
|
54552
54691
|
tableId,
|
|
54553
54692
|
recordId: openRecord,
|
|
54554
54693
|
onClose: () => setRail("none"),
|
|
54694
|
+
neighbors: neighborsOf(shownIds, openRecord),
|
|
54695
|
+
onStep: (to) => setOpenRecord(to),
|
|
54696
|
+
expanded: recordExpanded,
|
|
54697
|
+
onToggleExpand: () => setRecordExpanded((now) => !now),
|
|
54555
54698
|
onAskAboutField: (fieldKey) => {
|
|
54556
54699
|
setAsking({ fieldKey, recordId: openRecord });
|
|
54557
54700
|
setRail("who-changed");
|
|
@@ -54590,12 +54733,12 @@ function usePublicReadOnly(client, organizationId, tableId, table, rights) {
|
|
|
54590
54733
|
|
|
54591
54734
|
// src/entityViews.tsx
|
|
54592
54735
|
var import_format15 = require("@ai-matrx/kit/format");
|
|
54593
|
-
var
|
|
54736
|
+
var import_design_system159 = require("@ai-matrx/design-system");
|
|
54594
54737
|
var import_data_table25 = require("@ai-matrx/design-system/data-table");
|
|
54595
54738
|
var import_react313 = require("react");
|
|
54596
|
-
var
|
|
54739
|
+
var import_design_system160 = require("@ai-matrx/design-system");
|
|
54597
54740
|
var import_react314 = require("@ai-matrx/records/react");
|
|
54598
|
-
var
|
|
54741
|
+
var import_jsx_runtime177 = require("react/jsx-runtime");
|
|
54599
54742
|
var entityTitleColumn = entityNameColumn;
|
|
54600
54743
|
function shown4(v) {
|
|
54601
54744
|
if (v === null || v === void 0 || v === "") return "";
|
|
@@ -54611,9 +54754,9 @@ function EntityBoard({ entity, groupBy, cardFields, onOpenRecord, className }) {
|
|
|
54611
54754
|
);
|
|
54612
54755
|
const [refused, setRefused] = (0, import_react313.useState)(null);
|
|
54613
54756
|
const [over, setOver] = (0, import_react313.useState)(null);
|
|
54614
|
-
if (entity.error) return /* @__PURE__ */ (0,
|
|
54757
|
+
if (entity.error) return /* @__PURE__ */ (0, import_jsx_runtime177.jsx)("p", { className: "px-1 py-3 text-xs text-muted-foreground", children: `This board could not be read: ${entity.error}` });
|
|
54615
54758
|
if (!entity.loading && !column) {
|
|
54616
|
-
return /* @__PURE__ */ (0,
|
|
54759
|
+
return /* @__PURE__ */ (0, import_jsx_runtime177.jsx)("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.` });
|
|
54617
54760
|
}
|
|
54618
54761
|
if (!column) return null;
|
|
54619
54762
|
const words2 = column.choices ?? [];
|
|
@@ -54631,14 +54774,14 @@ function EntityBoard({ entity, groupBy, cardFields, onOpenRecord, className }) {
|
|
|
54631
54774
|
const says = await entity.update(id, column, to);
|
|
54632
54775
|
if (says) setRefused({ to, says });
|
|
54633
54776
|
};
|
|
54634
|
-
return /* @__PURE__ */ (0,
|
|
54777
|
+
return /* @__PURE__ */ (0, import_jsx_runtime177.jsx)("div", { className: (0, import_design_system160.cn)("flex min-h-40 gap-2 overflow-x-auto pb-1", className), "data-records-entity-board": column.key, children: lanes.map((lane) => {
|
|
54635
54778
|
const cards = rowsOf2(lane.key);
|
|
54636
54779
|
if (lane.key === "" && cards.length === 0) return null;
|
|
54637
|
-
return /* @__PURE__ */ (0,
|
|
54780
|
+
return /* @__PURE__ */ (0, import_jsx_runtime177.jsxs)(
|
|
54638
54781
|
"section",
|
|
54639
54782
|
{
|
|
54640
54783
|
"aria-label": lane.label,
|
|
54641
|
-
className: (0,
|
|
54784
|
+
className: (0, import_design_system160.cn)("flex w-60 shrink-0 flex-col gap-1.5 rounded-md bg-muted/40 p-1.5", over === lane.key && "ring-1 ring-ring"),
|
|
54642
54785
|
onDragOver: writable && lane.key ? (e) => {
|
|
54643
54786
|
e.preventDefault();
|
|
54644
54787
|
setOver(lane.key);
|
|
@@ -54646,12 +54789,12 @@ function EntityBoard({ entity, groupBy, cardFields, onOpenRecord, className }) {
|
|
|
54646
54789
|
onDragLeave: writable && lane.key ? () => setOver((o) => o === lane.key ? null : o) : void 0,
|
|
54647
54790
|
onDrop: writable && lane.key ? (e) => void drop(e, lane.key) : void 0,
|
|
54648
54791
|
children: [
|
|
54649
|
-
/* @__PURE__ */ (0,
|
|
54650
|
-
/* @__PURE__ */ (0,
|
|
54651
|
-
/* @__PURE__ */ (0,
|
|
54792
|
+
/* @__PURE__ */ (0, import_jsx_runtime177.jsxs)("header", { className: "flex items-baseline gap-1.5 px-1 text-xs", children: [
|
|
54793
|
+
/* @__PURE__ */ (0, import_jsx_runtime177.jsx)("span", { className: "truncate font-medium", children: lane.label }),
|
|
54794
|
+
/* @__PURE__ */ (0, import_jsx_runtime177.jsx)("span", { className: "tabular-nums text-muted-foreground", children: cards.length })
|
|
54652
54795
|
] }),
|
|
54653
|
-
refused && refused.to === lane.key ? /* @__PURE__ */ (0,
|
|
54654
|
-
cards.map((row) => /* @__PURE__ */ (0,
|
|
54796
|
+
refused && refused.to === lane.key ? /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(import_design_system160.ErrorBox, { 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,
|
|
54797
|
+
cards.map((row) => /* @__PURE__ */ (0, import_jsx_runtime177.jsxs)(
|
|
54655
54798
|
"article",
|
|
54656
54799
|
{
|
|
54657
54800
|
draggable: writable,
|
|
@@ -54659,11 +54802,11 @@ function EntityBoard({ entity, groupBy, cardFields, onOpenRecord, className }) {
|
|
|
54659
54802
|
e.dataTransfer.setData("text/x-entity-row", row._id);
|
|
54660
54803
|
e.dataTransfer.effectAllowed = "move";
|
|
54661
54804
|
},
|
|
54662
|
-
className: (0,
|
|
54805
|
+
className: (0, import_design_system160.cn)("flex flex-col gap-0.5 rounded border bg-card px-2 py-1.5 text-xs shadow-sm", writable && "cursor-grab"),
|
|
54663
54806
|
"data-records-entity-card": row._id,
|
|
54664
54807
|
children: [
|
|
54665
|
-
onOpenRecord ? /* @__PURE__ */ (0,
|
|
54666
|
-
extra.map((c) => entityValueText(c, entityCellValue(row, c)) ? /* @__PURE__ */ (0,
|
|
54808
|
+
onOpenRecord ? /* @__PURE__ */ (0, import_jsx_runtime177.jsx)("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__ */ (0, import_jsx_runtime177.jsx)("span", { className: "truncate font-medium", children: (title ? entityValueText(title, entityCellValue(row, title)) : shown4(row._id)) || "Untitled" }),
|
|
54809
|
+
extra.map((c) => entityValueText(c, entityCellValue(row, c)) ? /* @__PURE__ */ (0, import_jsx_runtime177.jsx)("span", { className: "truncate text-muted-foreground", children: entityValueText(c, entityCellValue(row, c)) }, c.key) : null)
|
|
54667
54810
|
]
|
|
54668
54811
|
},
|
|
54669
54812
|
row._id
|
|
@@ -54714,9 +54857,9 @@ function EntityChartBlock({ source, kind, by, measure, title, where, organizatio
|
|
|
54714
54857
|
};
|
|
54715
54858
|
}, [client, ask2, kind, title]);
|
|
54716
54859
|
if (!block) {
|
|
54717
|
-
return /* @__PURE__ */ (0,
|
|
54860
|
+
return /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(RecordsSkeleton, { layout: "chart", embedded: variant === "bare", ...className ? { className } : {} });
|
|
54718
54861
|
}
|
|
54719
|
-
return /* @__PURE__ */ (0,
|
|
54862
|
+
return /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(
|
|
54720
54863
|
ChartBlock,
|
|
54721
54864
|
{
|
|
54722
54865
|
block,
|
|
@@ -54729,7 +54872,7 @@ function EntityChartBlock({ source, kind, by, measure, title, where, organizatio
|
|
|
54729
54872
|
);
|
|
54730
54873
|
}
|
|
54731
54874
|
function EntityTablePage(props) {
|
|
54732
|
-
return /* @__PURE__ */ (0,
|
|
54875
|
+
return /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(EntityDataScope, { children: /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(EntityTablePageBody, { ...props }) });
|
|
54733
54876
|
}
|
|
54734
54877
|
function EntityTablePageBody({
|
|
54735
54878
|
source,
|
|
@@ -54779,21 +54922,21 @@ function EntityTablePageBody({
|
|
|
54779
54922
|
rowNoun: (entity.label ?? "record").toLowerCase(),
|
|
54780
54923
|
enabled: layout === "grid"
|
|
54781
54924
|
});
|
|
54782
|
-
return /* @__PURE__ */ (0,
|
|
54783
|
-
presentation === "page" || boardable || entity.creatable ? /* @__PURE__ */ (0,
|
|
54784
|
-
presentation === "page" ? /* @__PURE__ */ (0,
|
|
54785
|
-
presentation === "page" ? /* @__PURE__ */ (0,
|
|
54786
|
-
/* @__PURE__ */ (0,
|
|
54787
|
-
boardable ? /* @__PURE__ */ (0,
|
|
54788
|
-
/* @__PURE__ */ (0,
|
|
54789
|
-
/* @__PURE__ */ (0,
|
|
54925
|
+
return /* @__PURE__ */ (0, import_jsx_runtime177.jsxs)("div", { className: (0, import_design_system160.cn)("flex min-w-0 flex-col gap-2", className), "data-records-entity-page": source.token, children: [
|
|
54926
|
+
presentation === "page" || boardable || entity.creatable ? /* @__PURE__ */ (0, import_jsx_runtime177.jsxs)("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
54927
|
+
presentation === "page" ? /* @__PURE__ */ (0, import_jsx_runtime177.jsx)("h2", { className: "truncate text-base font-semibold", children: entity.label ?? (entity.loading ? "Loading\u2026" : "Table") }) : null,
|
|
54928
|
+
presentation === "page" ? /* @__PURE__ */ (0, import_jsx_runtime177.jsx)("span", { className: "text-xs tabular-nums text-muted-foreground", children: entity.loading || entity.total === null ? "" : (0, import_format15.formatCount)(entity.total) }) : null,
|
|
54929
|
+
/* @__PURE__ */ (0, import_jsx_runtime177.jsxs)("span", { className: "ml-auto flex items-center gap-1", children: [
|
|
54930
|
+
boardable ? /* @__PURE__ */ (0, import_jsx_runtime177.jsxs)(import_jsx_runtime177.Fragment, { children: [
|
|
54931
|
+
/* @__PURE__ */ (0, import_jsx_runtime177.jsx)(import_design_system160.Button, { size: "sm", variant: layout === "grid" ? "secondary" : "ghost", "aria-pressed": layout === "grid", onClick: () => choose("grid"), children: "Table" }),
|
|
54932
|
+
/* @__PURE__ */ (0, import_jsx_runtime177.jsx)(import_design_system160.Button, { size: "sm", variant: layout === "board" ? "secondary" : "ghost", "aria-pressed": layout === "board", onClick: () => choose("board"), children: "Board" })
|
|
54790
54933
|
] }) : null,
|
|
54791
|
-
entity.creatable && naming === null ? /* @__PURE__ */ (0,
|
|
54934
|
+
entity.creatable && naming === null ? /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(import_design_system160.Button, { size: "sm", variant: "ghost", onClick: () => {
|
|
54792
54935
|
setAddRefused(null);
|
|
54793
54936
|
setNaming("");
|
|
54794
54937
|
}, children: "New page" }) : null,
|
|
54795
|
-
entity.creatable && naming !== null ? /* @__PURE__ */ (0,
|
|
54796
|
-
|
|
54938
|
+
entity.creatable && naming !== null ? /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(
|
|
54939
|
+
import_design_system160.Input,
|
|
54797
54940
|
{
|
|
54798
54941
|
autoFocus: true,
|
|
54799
54942
|
"data-records-entity-new": source.token,
|
|
@@ -54822,10 +54965,10 @@ function EntityTablePageBody({
|
|
|
54822
54965
|
actions
|
|
54823
54966
|
] })
|
|
54824
54967
|
] }) : null,
|
|
54825
|
-
addRefused ? /* @__PURE__ */ (0,
|
|
54826
|
-
entity.error ? /* @__PURE__ */ (0,
|
|
54827
|
-
presentation === "embedded" && searchBox ? /* @__PURE__ */ (0,
|
|
54828
|
-
|
|
54968
|
+
addRefused ? /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(import_design_system160.ErrorBox, { 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,
|
|
54969
|
+
entity.error ? /* @__PURE__ */ (0, import_jsx_runtime177.jsx)("p", { className: "px-1 py-3 text-xs text-muted-foreground", children: `This table could not be read: ${entity.error}` }) : layout === "board" && boardable ? /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(EntityBoard, { entity, groupBy, onOpenRecord }) : /* @__PURE__ */ (0, import_jsx_runtime177.jsxs)(import_jsx_runtime177.Fragment, { children: [
|
|
54970
|
+
presentation === "embedded" && searchBox ? /* @__PURE__ */ (0, import_jsx_runtime177.jsx)("div", { className: "flex min-w-0 items-center justify-end", "data-records-entity-search": "", children: /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(import_design_system159.TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(
|
|
54971
|
+
import_design_system159.TapTargetSearchGroup,
|
|
54829
54972
|
{
|
|
54830
54973
|
surface: "solid",
|
|
54831
54974
|
placeholder: "Search",
|
|
@@ -54836,8 +54979,8 @@ function EntityTablePageBody({
|
|
|
54836
54979
|
}
|
|
54837
54980
|
}
|
|
54838
54981
|
) }) }) : null,
|
|
54839
|
-
/* @__PURE__ */ (0,
|
|
54840
|
-
entity.hasMore ? /* @__PURE__ */ (0,
|
|
54982
|
+
/* @__PURE__ */ (0, import_jsx_runtime177.jsx)(EntityGrid, { entity, pageSize, embedded: presentation === "embedded", ...drill ? { drill } : {} }),
|
|
54983
|
+
entity.hasMore ? /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(
|
|
54841
54984
|
import_data_table25.MatrxTableCardShowMore,
|
|
54842
54985
|
{
|
|
54843
54986
|
shown: entity.rows.length,
|
|
@@ -54851,12 +54994,12 @@ function EntityTablePageBody({
|
|
|
54851
54994
|
}
|
|
54852
54995
|
|
|
54853
54996
|
// src/TablePageSource.tsx
|
|
54854
|
-
var
|
|
54997
|
+
var import_jsx_runtime178 = require("react/jsx-runtime");
|
|
54855
54998
|
function TablePage2(props) {
|
|
54856
|
-
if (props.source === void 0) return /* @__PURE__ */ (0,
|
|
54999
|
+
if (props.source === void 0) return /* @__PURE__ */ (0, import_jsx_runtime178.jsx)(TablePage, { ...props });
|
|
54857
55000
|
const { source, layout, onLayoutChange, groupBy, onOpenRecord, ...rest } = props;
|
|
54858
|
-
if (source.kind === "table") return /* @__PURE__ */ (0,
|
|
54859
|
-
return /* @__PURE__ */ (0,
|
|
55001
|
+
if (source.kind === "table") return /* @__PURE__ */ (0, import_jsx_runtime178.jsx)(TablePage, { ...rest, tableId: source.id });
|
|
55002
|
+
return /* @__PURE__ */ (0, import_jsx_runtime178.jsx)(
|
|
54860
55003
|
EntityTablePage,
|
|
54861
55004
|
{
|
|
54862
55005
|
source,
|
|
@@ -54878,8 +55021,8 @@ function TablePage2(props) {
|
|
|
54878
55021
|
var import_react315 = require("react");
|
|
54879
55022
|
var import_records75 = require("@ai-matrx/records");
|
|
54880
55023
|
var import_react316 = require("@ai-matrx/records/react");
|
|
54881
|
-
var
|
|
54882
|
-
var
|
|
55024
|
+
var import_design_system161 = require("@ai-matrx/design-system");
|
|
55025
|
+
var import_jsx_runtime179 = require("react/jsx-runtime");
|
|
54883
55026
|
var DATA_BINDING_SHAPES = [
|
|
54884
55027
|
{ value: "collection", label: "The whole table" },
|
|
54885
55028
|
{ value: "reference", label: "One record" },
|
|
@@ -54946,9 +55089,9 @@ function DataBindingPicker({ dataSource, userId, binding, onChange, disabled, de
|
|
|
54946
55089
|
...binding.semantic_type === "collection" && defaultRowLimit ? { limit: defaultRowLimit } : {}
|
|
54947
55090
|
});
|
|
54948
55091
|
};
|
|
54949
|
-
return /* @__PURE__ */ (0,
|
|
54950
|
-
/* @__PURE__ */ (0,
|
|
54951
|
-
/* @__PURE__ */ (0,
|
|
55092
|
+
return /* @__PURE__ */ (0, import_jsx_runtime179.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
55093
|
+
/* @__PURE__ */ (0, import_jsx_runtime179.jsx)(TablePicker, { dataSource, value: tableId, onChange: selectTable, disabled: Boolean(disabled), tables }),
|
|
55094
|
+
/* @__PURE__ */ (0, import_jsx_runtime179.jsx)(TableScope, { dataSource, userId, tableId, tables, children: tableId && /* @__PURE__ */ (0, import_jsx_runtime179.jsx)(
|
|
54952
55095
|
BindingDetails,
|
|
54953
55096
|
{
|
|
54954
55097
|
tableId,
|
|
@@ -55012,9 +55155,9 @@ function BindingDetails({
|
|
|
55012
55155
|
const fieldOptions = fieldList.map((f) => ({ value: f.key, label: fieldName(f) }));
|
|
55013
55156
|
const template = binding.transform?.template ?? "";
|
|
55014
55157
|
const setTemplate = (next) => onChange({ ...binding, transform: { join: "\n", ...binding.transform, name: "list", template: next } });
|
|
55015
|
-
return /* @__PURE__ */ (0,
|
|
55016
|
-
/* @__PURE__ */ (0,
|
|
55017
|
-
|
|
55158
|
+
return /* @__PURE__ */ (0, import_jsx_runtime179.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
55159
|
+
/* @__PURE__ */ (0, import_jsx_runtime179.jsx)("div", { className: "flex flex-wrap gap-1", role: "radiogroup", "aria-label": "What to read", children: DATA_BINDING_SHAPES.map((s) => /* @__PURE__ */ (0, import_jsx_runtime179.jsx)(
|
|
55160
|
+
import_design_system161.Button,
|
|
55018
55161
|
{
|
|
55019
55162
|
type: "button",
|
|
55020
55163
|
size: "sm",
|
|
@@ -55027,7 +55170,7 @@ function BindingDetails({
|
|
|
55027
55170
|
},
|
|
55028
55171
|
s.value
|
|
55029
55172
|
)) }),
|
|
55030
|
-
shape !== "collection" && /* @__PURE__ */ (0,
|
|
55173
|
+
shape !== "collection" && /* @__PURE__ */ (0, import_jsx_runtime179.jsx)(
|
|
55031
55174
|
RecordPicker,
|
|
55032
55175
|
{
|
|
55033
55176
|
tableId,
|
|
@@ -55036,8 +55179,8 @@ function BindingDetails({
|
|
|
55036
55179
|
disabled: Boolean(disabled)
|
|
55037
55180
|
}
|
|
55038
55181
|
),
|
|
55039
|
-
shape === "value" && /* @__PURE__ */ (0,
|
|
55040
|
-
|
|
55182
|
+
shape === "value" && /* @__PURE__ */ (0, import_jsx_runtime179.jsx)(
|
|
55183
|
+
import_design_system161.CreatablePicker,
|
|
55041
55184
|
{
|
|
55042
55185
|
value: binding.field_key ?? null,
|
|
55043
55186
|
options: fieldOptions,
|
|
@@ -55050,11 +55193,11 @@ function BindingDetails({
|
|
|
55050
55193
|
ariaLabel: "Column"
|
|
55051
55194
|
}
|
|
55052
55195
|
),
|
|
55053
|
-
shape !== "value" && /* @__PURE__ */ (0,
|
|
55054
|
-
/* @__PURE__ */ (0,
|
|
55196
|
+
shape !== "value" && /* @__PURE__ */ (0, import_jsx_runtime179.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
55197
|
+
/* @__PURE__ */ (0, import_jsx_runtime179.jsx)(
|
|
55055
55198
|
"textarea",
|
|
55056
55199
|
{
|
|
55057
|
-
className: (0,
|
|
55200
|
+
className: (0, import_design_system161.cn)(
|
|
55058
55201
|
"min-h-[3.5rem] w-full rounded-md border border-border bg-background px-2 py-1.5 font-mono text-xs"
|
|
55059
55202
|
),
|
|
55060
55203
|
"aria-label": "Each row reads as",
|
|
@@ -55063,8 +55206,8 @@ function BindingDetails({
|
|
|
55063
55206
|
onChange: (e) => setTemplate(e.target.value)
|
|
55064
55207
|
}
|
|
55065
55208
|
),
|
|
55066
|
-
!disabled && /* @__PURE__ */ (0,
|
|
55067
|
-
|
|
55209
|
+
!disabled && /* @__PURE__ */ (0, import_jsx_runtime179.jsx)("div", { className: "flex flex-wrap gap-1", children: fieldList.flatMap(bindingPlaceholdersFor).map((p) => /* @__PURE__ */ (0, import_jsx_runtime179.jsx)(
|
|
55210
|
+
import_design_system161.Button,
|
|
55068
55211
|
{
|
|
55069
55212
|
type: "button",
|
|
55070
55213
|
size: "sm",
|
|
@@ -55076,10 +55219,10 @@ function BindingDetails({
|
|
|
55076
55219
|
p.token
|
|
55077
55220
|
)) })
|
|
55078
55221
|
] }),
|
|
55079
|
-
shape === "collection" && /* @__PURE__ */ (0,
|
|
55222
|
+
shape === "collection" && /* @__PURE__ */ (0, import_jsx_runtime179.jsxs)("label", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
|
|
55080
55223
|
"Up to",
|
|
55081
|
-
/* @__PURE__ */ (0,
|
|
55082
|
-
|
|
55224
|
+
/* @__PURE__ */ (0, import_jsx_runtime179.jsx)(
|
|
55225
|
+
import_design_system161.BasicInput,
|
|
55083
55226
|
{
|
|
55084
55227
|
type: "number",
|
|
55085
55228
|
min: 1,
|
|
@@ -55095,10 +55238,10 @@ function BindingDetails({
|
|
|
55095
55238
|
),
|
|
55096
55239
|
"rows"
|
|
55097
55240
|
] }),
|
|
55098
|
-
/* @__PURE__ */ (0,
|
|
55099
|
-
/* @__PURE__ */ (0,
|
|
55100
|
-
DATA_BINDING_MISSING.map((m) => /* @__PURE__ */ (0,
|
|
55101
|
-
|
|
55241
|
+
/* @__PURE__ */ (0, import_jsx_runtime179.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "radiogroup", "aria-label": "If nothing is found", children: [
|
|
55242
|
+
/* @__PURE__ */ (0, import_jsx_runtime179.jsx)("span", { className: "text-xs text-muted-foreground", children: "If nothing is found" }),
|
|
55243
|
+
DATA_BINDING_MISSING.map((m) => /* @__PURE__ */ (0, import_jsx_runtime179.jsx)(
|
|
55244
|
+
import_design_system161.Button,
|
|
55102
55245
|
{
|
|
55103
55246
|
type: "button",
|
|
55104
55247
|
size: "sm",
|
|
@@ -55117,13 +55260,13 @@ function BindingDetails({
|
|
|
55117
55260
|
|
|
55118
55261
|
// src/PickedSummaries.tsx
|
|
55119
55262
|
var import_react317 = require("@ai-matrx/records/react");
|
|
55120
|
-
var
|
|
55263
|
+
var import_jsx_runtime180 = require("react/jsx-runtime");
|
|
55121
55264
|
function TableNameText({ dataSource, tableId }) {
|
|
55122
55265
|
const tables = useTablesAnywhere(dataSource);
|
|
55123
|
-
if (!tableId) return /* @__PURE__ */ (0,
|
|
55124
|
-
if (tables.loading) return /* @__PURE__ */ (0,
|
|
55125
|
-
if (tables.error) return /* @__PURE__ */ (0,
|
|
55126
|
-
return /* @__PURE__ */ (0,
|
|
55266
|
+
if (!tableId) return /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(import_jsx_runtime180.Fragment, { children: "\u2014" });
|
|
55267
|
+
if (tables.loading) return /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(import_jsx_runtime180.Fragment, { children: "\u2026" });
|
|
55268
|
+
if (tables.error) return /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(import_jsx_runtime180.Fragment, { children: "Couldn't load the table's name" });
|
|
55269
|
+
return /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(import_jsx_runtime180.Fragment, { children: tables.rows.find((t) => t.table_id === tableId)?.table_name ?? "\u2014" });
|
|
55127
55270
|
}
|
|
55128
55271
|
function ColumnValuesText({
|
|
55129
55272
|
dataSource,
|
|
@@ -55131,38 +55274,38 @@ function ColumnValuesText({
|
|
|
55131
55274
|
tableId,
|
|
55132
55275
|
value
|
|
55133
55276
|
}) {
|
|
55134
|
-
if (!tableId) return /* @__PURE__ */ (0,
|
|
55135
|
-
return /* @__PURE__ */ (0,
|
|
55277
|
+
if (!tableId) return /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(import_jsx_runtime180.Fragment, { children: "\u2014" });
|
|
55278
|
+
return /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(
|
|
55136
55279
|
TableScope,
|
|
55137
55280
|
{
|
|
55138
55281
|
dataSource,
|
|
55139
55282
|
userId,
|
|
55140
55283
|
tableId,
|
|
55141
|
-
fallback: /* @__PURE__ */ (0,
|
|
55142
|
-
unavailable: /* @__PURE__ */ (0,
|
|
55143
|
-
children: /* @__PURE__ */ (0,
|
|
55284
|
+
fallback: /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(import_jsx_runtime180.Fragment, { children: "\u2026" }),
|
|
55285
|
+
unavailable: /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(import_jsx_runtime180.Fragment, { children: "Couldn't load this table's columns" }),
|
|
55286
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(RecordLabelProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(ColumnValuesWords, { tableId, value }) })
|
|
55144
55287
|
}
|
|
55145
55288
|
);
|
|
55146
55289
|
}
|
|
55147
55290
|
function ColumnValuesWords({ tableId, value }) {
|
|
55148
55291
|
const fields = (0, import_react317.useFields)(tableId);
|
|
55149
55292
|
const labels = useRecordLabels(fields.data ?? void 0);
|
|
55150
|
-
if (fields.loading) return /* @__PURE__ */ (0,
|
|
55151
|
-
if (fields.error) return /* @__PURE__ */ (0,
|
|
55293
|
+
if (fields.loading) return /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(import_jsx_runtime180.Fragment, { children: "\u2026" });
|
|
55294
|
+
if (fields.error) return /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(import_jsx_runtime180.Fragment, { children: "Couldn't load this table's columns" });
|
|
55152
55295
|
const parts = [];
|
|
55153
55296
|
for (const [key, stored] of Object.entries(value)) {
|
|
55154
55297
|
if (key.startsWith("_")) continue;
|
|
55155
55298
|
const field2 = (fields.data ?? []).find((f) => f.key === key);
|
|
55156
|
-
if (parts.length) parts.push(/* @__PURE__ */ (0,
|
|
55299
|
+
if (parts.length) parts.push(/* @__PURE__ */ (0, import_jsx_runtime180.jsx)("span", { children: ", " }, `${key}-sep`));
|
|
55157
55300
|
parts.push(
|
|
55158
|
-
/* @__PURE__ */ (0,
|
|
55301
|
+
/* @__PURE__ */ (0, import_jsx_runtime180.jsxs)("span", { children: [
|
|
55159
55302
|
field2 ? fieldName(field2) : "A removed column",
|
|
55160
55303
|
" is ",
|
|
55161
55304
|
field2 ? renderValue(field2, stored, void 0, labels) : "\u2014"
|
|
55162
55305
|
] }, key)
|
|
55163
55306
|
);
|
|
55164
55307
|
}
|
|
55165
|
-
return parts.length ? /* @__PURE__ */ (0,
|
|
55308
|
+
return parts.length ? /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(import_jsx_runtime180.Fragment, { children: parts }) : /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(import_jsx_runtime180.Fragment, { children: "\u2014" });
|
|
55166
55309
|
}
|
|
55167
55310
|
function RecordNameText({
|
|
55168
55311
|
dataSource,
|
|
@@ -55170,35 +55313,35 @@ function RecordNameText({
|
|
|
55170
55313
|
tableId,
|
|
55171
55314
|
recordId
|
|
55172
55315
|
}) {
|
|
55173
|
-
if (!tableId || !recordId) return /* @__PURE__ */ (0,
|
|
55174
|
-
return /* @__PURE__ */ (0,
|
|
55316
|
+
if (!tableId || !recordId) return /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(import_jsx_runtime180.Fragment, { children: "\u2014" });
|
|
55317
|
+
return /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(
|
|
55175
55318
|
TableScope,
|
|
55176
55319
|
{
|
|
55177
55320
|
dataSource,
|
|
55178
55321
|
userId,
|
|
55179
55322
|
tableId,
|
|
55180
|
-
fallback: /* @__PURE__ */ (0,
|
|
55181
|
-
unavailable: /* @__PURE__ */ (0,
|
|
55182
|
-
children: /* @__PURE__ */ (0,
|
|
55323
|
+
fallback: /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(import_jsx_runtime180.Fragment, { children: "\u2026" }),
|
|
55324
|
+
unavailable: /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(import_jsx_runtime180.Fragment, { children: "Couldn't load this record" }),
|
|
55325
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(RecordNameWords, { tableId, recordId })
|
|
55183
55326
|
}
|
|
55184
55327
|
);
|
|
55185
55328
|
}
|
|
55186
55329
|
function RecordNameWords({ tableId, recordId }) {
|
|
55187
55330
|
const table = (0, import_react317.useTable)(tableId);
|
|
55188
55331
|
const record = (0, import_react317.useRecord)(recordId);
|
|
55189
|
-
if (record.loading || table.loading) return /* @__PURE__ */ (0,
|
|
55190
|
-
if (record.error) return /* @__PURE__ */ (0,
|
|
55191
|
-
if (!record.data) return /* @__PURE__ */ (0,
|
|
55192
|
-
return /* @__PURE__ */ (0,
|
|
55332
|
+
if (record.loading || table.loading) return /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(import_jsx_runtime180.Fragment, { children: "\u2026" });
|
|
55333
|
+
if (record.error) return /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(import_jsx_runtime180.Fragment, { children: "Couldn't load this record" });
|
|
55334
|
+
if (!record.data) return /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(import_jsx_runtime180.Fragment, { children: "A record you cannot open" });
|
|
55335
|
+
return /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(import_jsx_runtime180.Fragment, { children: recordName(record.data.document, table.data?.title_field ?? null) });
|
|
55193
55336
|
}
|
|
55194
55337
|
|
|
55195
55338
|
// src/HeldChangeDecision.tsx
|
|
55196
55339
|
var import_react318 = require("react");
|
|
55197
55340
|
var import_react319 = require("@ai-matrx/records/react");
|
|
55198
|
-
var
|
|
55199
|
-
var
|
|
55341
|
+
var import_design_system162 = require("@ai-matrx/design-system");
|
|
55342
|
+
var import_jsx_runtime181 = require("react/jsx-runtime");
|
|
55200
55343
|
function HeldChangeDecision({ dataSource, userId, organizationId, approvalId, onDecided, approveLabel }) {
|
|
55201
|
-
return /* @__PURE__ */ (0,
|
|
55344
|
+
return /* @__PURE__ */ (0, import_jsx_runtime181.jsx)(import_react319.RecordsProvider, { config: { dataSource, actor: personActor(userId), organizationId }, children: /* @__PURE__ */ (0, import_jsx_runtime181.jsx)(Decision, { approvalId, onDecided, approveLabel: approveLabel ?? "Approve" }) });
|
|
55202
55345
|
}
|
|
55203
55346
|
function Decision({
|
|
55204
55347
|
approvalId,
|
|
@@ -55231,20 +55374,20 @@ function Decision({
|
|
|
55231
55374
|
if (res.ok) onDecided(approve);
|
|
55232
55375
|
else setError(res.error);
|
|
55233
55376
|
};
|
|
55234
|
-
if (may === null) return /* @__PURE__ */ (0,
|
|
55235
|
-
return /* @__PURE__ */ (0,
|
|
55236
|
-
may ? /* @__PURE__ */ (0,
|
|
55237
|
-
/* @__PURE__ */ (0,
|
|
55238
|
-
/* @__PURE__ */ (0,
|
|
55239
|
-
] }) : !error && /* @__PURE__ */ (0,
|
|
55240
|
-
error ? /* @__PURE__ */ (0,
|
|
55377
|
+
if (may === null) return /* @__PURE__ */ (0, import_jsx_runtime181.jsx)("p", { className: "text-xs text-muted-foreground", children: "Checking who can decide\u2026" });
|
|
55378
|
+
return /* @__PURE__ */ (0, import_jsx_runtime181.jsxs)("div", { className: "flex flex-col gap-1.5", children: [
|
|
55379
|
+
may ? /* @__PURE__ */ (0, import_jsx_runtime181.jsxs)("div", { className: "flex gap-2", children: [
|
|
55380
|
+
/* @__PURE__ */ (0, import_jsx_runtime181.jsx)(import_design_system162.Button, { type: "button", size: "sm", disabled: busy !== null, onClick: () => void decide(true), children: busy === "approve" ? "Approving\u2026" : approveLabel }),
|
|
55381
|
+
/* @__PURE__ */ (0, import_jsx_runtime181.jsx)(import_design_system162.Button, { type: "button", size: "sm", variant: "outline", disabled: busy !== null, onClick: () => void decide(false), children: busy === "refuse" ? "Refusing\u2026" : "Refuse" })
|
|
55382
|
+
] }) : !error && /* @__PURE__ */ (0, import_jsx_runtime181.jsx)("p", { className: "text-xs text-muted-foreground", children: "An owner or admin of this organization decides this." }),
|
|
55383
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime181.jsx)(RefusalLine, { error }) : null
|
|
55241
55384
|
] });
|
|
55242
55385
|
}
|
|
55243
55386
|
|
|
55244
55387
|
// src/CalendarLinks.tsx
|
|
55245
55388
|
var import_react320 = require("react");
|
|
55246
|
-
var
|
|
55247
|
-
var
|
|
55389
|
+
var import_design_system163 = require("@ai-matrx/design-system");
|
|
55390
|
+
var import_jsx_runtime182 = require("react/jsx-runtime");
|
|
55248
55391
|
var day = (iso) => iso ? new Date(iso).toLocaleDateString(void 0, { year: "numeric", month: "short", day: "numeric" }) : null;
|
|
55249
55392
|
function CalendarLinks({ port }) {
|
|
55250
55393
|
const [rows, setRows] = (0, import_react320.useState)(null);
|
|
@@ -55269,15 +55412,15 @@ function CalendarLinks({ port }) {
|
|
|
55269
55412
|
setError(asRefusal3(e, "That didn\u2019t work"));
|
|
55270
55413
|
}
|
|
55271
55414
|
};
|
|
55272
|
-
if (rows === null && !error) return /* @__PURE__ */ (0,
|
|
55273
|
-
return /* @__PURE__ */ (0,
|
|
55274
|
-
error ? /* @__PURE__ */ (0,
|
|
55275
|
-
rows && rows.length === 0 ? /* @__PURE__ */ (0,
|
|
55276
|
-
rows?.map((row) => /* @__PURE__ */ (0,
|
|
55277
|
-
/* @__PURE__ */ (0,
|
|
55278
|
-
/* @__PURE__ */ (0,
|
|
55279
|
-
/* @__PURE__ */ (0,
|
|
55280
|
-
/* @__PURE__ */ (0,
|
|
55415
|
+
if (rows === null && !error) return /* @__PURE__ */ (0, import_jsx_runtime182.jsx)("p", { className: "text-sm text-muted-foreground", "data-calendar-links-loading": "", children: "Reading your links\u2026" });
|
|
55416
|
+
return /* @__PURE__ */ (0, import_jsx_runtime182.jsxs)("div", { className: "flex flex-col gap-2", "data-calendar-links": "", children: [
|
|
55417
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime182.jsx)(RefusalNotice, { error }) : null,
|
|
55418
|
+
rows && rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime182.jsx)("p", { className: "text-sm text-muted-foreground", children: "No calendar links yet." }) : null,
|
|
55419
|
+
rows?.map((row) => /* @__PURE__ */ (0, import_jsx_runtime182.jsxs)("div", { className: "flex flex-col gap-2 rounded-md border px-3 py-2", "data-calendar-link-row": row.id, children: [
|
|
55420
|
+
/* @__PURE__ */ (0, import_jsx_runtime182.jsxs)("div", { className: "flex flex-wrap items-center justify-between gap-2", children: [
|
|
55421
|
+
/* @__PURE__ */ (0, import_jsx_runtime182.jsxs)("div", { className: "min-w-0", children: [
|
|
55422
|
+
/* @__PURE__ */ (0, import_jsx_runtime182.jsx)("div", { className: "truncate text-sm font-medium", children: row.title }),
|
|
55423
|
+
/* @__PURE__ */ (0, import_jsx_runtime182.jsxs)("div", { className: "text-xs text-muted-foreground", children: [
|
|
55281
55424
|
"Made ",
|
|
55282
55425
|
day(row.created_at),
|
|
55283
55426
|
" \xB7 ",
|
|
@@ -55286,9 +55429,9 @@ function CalendarLinks({ port }) {
|
|
|
55286
55429
|
row.expired ? "Expired" : row.expires_at ? `Expires ${day(row.expires_at)}` : "Never expires"
|
|
55287
55430
|
] })
|
|
55288
55431
|
] }),
|
|
55289
|
-
/* @__PURE__ */ (0,
|
|
55290
|
-
/* @__PURE__ */ (0,
|
|
55291
|
-
|
|
55432
|
+
/* @__PURE__ */ (0, import_jsx_runtime182.jsxs)("div", { className: "flex shrink-0 gap-2", children: [
|
|
55433
|
+
/* @__PURE__ */ (0, import_jsx_runtime182.jsx)(
|
|
55434
|
+
import_design_system163.Button,
|
|
55292
55435
|
{
|
|
55293
55436
|
size: "sm",
|
|
55294
55437
|
variant: "outline",
|
|
@@ -55301,8 +55444,8 @@ function CalendarLinks({ port }) {
|
|
|
55301
55444
|
children: "Rotate"
|
|
55302
55445
|
}
|
|
55303
55446
|
),
|
|
55304
|
-
/* @__PURE__ */ (0,
|
|
55305
|
-
|
|
55447
|
+
/* @__PURE__ */ (0, import_jsx_runtime182.jsx)(
|
|
55448
|
+
import_design_system163.Button,
|
|
55306
55449
|
{
|
|
55307
55450
|
size: "sm",
|
|
55308
55451
|
variant: "outline",
|
|
@@ -55317,7 +55460,7 @@ function CalendarLinks({ port }) {
|
|
|
55317
55460
|
)
|
|
55318
55461
|
] })
|
|
55319
55462
|
] }),
|
|
55320
|
-
fresh?.id === row.id ? /* @__PURE__ */ (0,
|
|
55463
|
+
fresh?.id === row.id ? /* @__PURE__ */ (0, import_jsx_runtime182.jsx)(CalendarLinkOnce, { url: fresh.url }) : null
|
|
55321
55464
|
] }, row.id))
|
|
55322
55465
|
] });
|
|
55323
55466
|
}
|
|
@@ -55327,7 +55470,7 @@ var import_react321 = require("react");
|
|
|
55327
55470
|
var import_memory = require("@ai-matrx/records/memory");
|
|
55328
55471
|
var import_react322 = require("@ai-matrx/records/react");
|
|
55329
55472
|
var import_forms7 = require("@ai-matrx/records/forms");
|
|
55330
|
-
var
|
|
55473
|
+
var import_jsx_runtime183 = require("react/jsx-runtime");
|
|
55331
55474
|
function useTemplatePreview(spec, today) {
|
|
55332
55475
|
return (0, import_react321.useMemo)(() => (0, import_memory.templatePreview)(spec, today ? { today } : {}), [spec, today]);
|
|
55333
55476
|
}
|
|
@@ -55338,9 +55481,9 @@ function TemplatePreview({ spec, today, initialTable, host, aside, booking, clas
|
|
|
55338
55481
|
const [active, setActive] = (0, import_react321.useState)(first?.id ?? null);
|
|
55339
55482
|
const table = preview.tables.find((t) => t.id === active) ?? first;
|
|
55340
55483
|
if (!table) return null;
|
|
55341
|
-
return /* @__PURE__ */ (0,
|
|
55342
|
-
preview.tables.length > 1 || aside ? /* @__PURE__ */ (0,
|
|
55343
|
-
preview.tables.map((t) => /* @__PURE__ */ (0,
|
|
55484
|
+
return /* @__PURE__ */ (0, import_jsx_runtime183.jsxs)("div", { className: ["flex min-w-0 flex-col gap-3", className].filter(Boolean).join(" "), "data-template-preview": preview.tables.length, children: [
|
|
55485
|
+
preview.tables.length > 1 || aside ? /* @__PURE__ */ (0, import_jsx_runtime183.jsxs)("div", { className: "flex min-w-0 flex-wrap items-center gap-1.5", role: "tablist", "aria-label": "Tables", children: [
|
|
55486
|
+
preview.tables.map((t) => /* @__PURE__ */ (0, import_jsx_runtime183.jsxs)(
|
|
55344
55487
|
"button",
|
|
55345
55488
|
{
|
|
55346
55489
|
type: "button",
|
|
@@ -55354,19 +55497,19 @@ function TemplatePreview({ spec, today, initialTable, host, aside, booking, clas
|
|
|
55354
55497
|
].join(" "),
|
|
55355
55498
|
children: [
|
|
55356
55499
|
t.name,
|
|
55357
|
-
/* @__PURE__ */ (0,
|
|
55500
|
+
/* @__PURE__ */ (0, import_jsx_runtime183.jsx)("span", { className: "text-xs tabular-nums text-muted-foreground", children: t.rows })
|
|
55358
55501
|
]
|
|
55359
55502
|
},
|
|
55360
55503
|
t.id
|
|
55361
55504
|
)),
|
|
55362
|
-
aside ? /* @__PURE__ */ (0,
|
|
55505
|
+
aside ? /* @__PURE__ */ (0, import_jsx_runtime183.jsx)("div", { className: "ml-auto", children: aside }) : null
|
|
55363
55506
|
] }) : null,
|
|
55364
|
-
/* @__PURE__ */ (0,
|
|
55365
|
-
/* @__PURE__ */ (0,
|
|
55366
|
-
/* @__PURE__ */ (0,
|
|
55367
|
-
preview.dashboards.length ? /* @__PURE__ */ (0,
|
|
55368
|
-
/* @__PURE__ */ (0,
|
|
55369
|
-
preview.dashboards.map((d) => /* @__PURE__ */ (0,
|
|
55507
|
+
/* @__PURE__ */ (0, import_jsx_runtime183.jsxs)(RecordsMount, { config: preview.config, host: bound2, children: [
|
|
55508
|
+
/* @__PURE__ */ (0, import_jsx_runtime183.jsx)("div", { className: "min-h-[32rem] min-w-0 overflow-hidden rounded-xl border border-border bg-card", children: /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(TablePage, { tableId: table.id }, table.id) }),
|
|
55509
|
+
/* @__PURE__ */ (0, import_jsx_runtime183.jsx)(PreviewForms, { preview, booking }),
|
|
55510
|
+
preview.dashboards.length ? /* @__PURE__ */ (0, import_jsx_runtime183.jsxs)("section", { className: "flex min-w-0 flex-col gap-3", "aria-label": "Dashboards", "data-template-preview-dashboards": preview.dashboards.length, children: [
|
|
55511
|
+
/* @__PURE__ */ (0, import_jsx_runtime183.jsx)("h2", { className: "text-lg font-semibold tracking-tight", children: "Dashboards" }),
|
|
55512
|
+
preview.dashboards.map((d) => /* @__PURE__ */ (0, import_jsx_runtime183.jsx)("div", { className: "min-w-0 overflow-hidden rounded-xl border border-border bg-card p-3", "data-template-preview-dashboard": d.token, children: /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(DashboardCanvas, { tableId: d.tableId, activeDashboardId: d.id }) }, d.id))
|
|
55370
55513
|
] }) : null
|
|
55371
55514
|
] })
|
|
55372
55515
|
] });
|
|
@@ -55394,14 +55537,14 @@ function PreviewForms({ preview, booking }) {
|
|
|
55394
55537
|
};
|
|
55395
55538
|
}, [client, preview, booking]);
|
|
55396
55539
|
if (!forms?.length && !pages.length) return null;
|
|
55397
|
-
return /* @__PURE__ */ (0,
|
|
55398
|
-
/* @__PURE__ */ (0,
|
|
55399
|
-
/* @__PURE__ */ (0,
|
|
55400
|
-
/* @__PURE__ */ (0,
|
|
55401
|
-
/* @__PURE__ */ (0,
|
|
55540
|
+
return /* @__PURE__ */ (0, import_jsx_runtime183.jsxs)("section", { className: "flex min-w-0 flex-col gap-3", "aria-label": "Forms and booking", "data-template-preview-forms": forms?.length ?? 0, children: [
|
|
55541
|
+
/* @__PURE__ */ (0, import_jsx_runtime183.jsx)("h2", { className: "text-lg font-semibold tracking-tight", children: "Forms and booking" }),
|
|
55542
|
+
/* @__PURE__ */ (0, import_jsx_runtime183.jsx)("div", { className: "grid min-w-0 gap-4 md:grid-cols-2", children: (forms ?? []).map((f) => /* @__PURE__ */ (0, import_jsx_runtime183.jsxs)("div", { className: "min-w-0 rounded-xl border border-border bg-card p-4", "data-template-preview-form": f.slug ?? f.id, children: [
|
|
55543
|
+
/* @__PURE__ */ (0, import_jsx_runtime183.jsx)("h3", { className: "mb-3 text-sm font-semibold", children: f.name }),
|
|
55544
|
+
/* @__PURE__ */ (0, import_jsx_runtime183.jsx)(FormRunner, { form: f, preview: true })
|
|
55402
55545
|
] }, f.id)) }),
|
|
55403
|
-
booking ? pages.map((p) => /* @__PURE__ */ (0,
|
|
55404
|
-
/* @__PURE__ */ (0,
|
|
55546
|
+
booking ? pages.map((p) => /* @__PURE__ */ (0, import_jsx_runtime183.jsxs)("div", { className: "min-w-0 rounded-xl border border-border bg-card p-4", "data-template-preview-booking": p.id, children: [
|
|
55547
|
+
/* @__PURE__ */ (0, import_jsx_runtime183.jsx)("h3", { className: "mb-3 text-sm font-semibold", children: String(p.page["title"] ?? "") }),
|
|
55405
55548
|
booking(p.page)
|
|
55406
55549
|
] }, p.id)) : null
|
|
55407
55550
|
] });
|