@ai-matrx/records-ui 0.113.27 → 0.113.29
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 +30 -0
- package/dist/index.cjs +104 -31
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -6
- package/dist/index.d.ts +9 -6
- package/dist/index.js +105 -32
- package/dist/index.js.map +1 -1
- package/dist/pickers.cjs +9 -6
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +9 -6
- package/dist/pickers.js.map +1 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,41 @@
|
|
|
1
1
|
# Changelog — @ai-matrx/records-ui
|
|
2
2
|
|
|
3
|
+
## 0.113.29
|
|
4
|
+
|
|
5
|
+
Automatic changed-only republish (docs/metadata drift since the last tag — see
|
|
6
|
+
`git diff npm/records-ui/v0.113.28..npm/records-ui/v0.113.29 -- apps/shared/records-ui`).
|
|
7
|
+
No source changes intended and no consumer action required.
|
|
8
|
+
|
|
9
|
+
## 0.113.28
|
|
10
|
+
|
|
11
|
+
Automatic changed-only republish (docs/metadata drift since the last tag — see
|
|
12
|
+
`git diff npm/records-ui/v0.113.27..npm/records-ui/v0.113.28 -- apps/shared/records-ui`).
|
|
13
|
+
No source changes intended and no consumer action required.
|
|
14
|
+
|
|
3
15
|
## 0.113.27
|
|
4
16
|
|
|
5
17
|
Automatic changed-only republish (docs/metadata drift since the last tag — see
|
|
6
18
|
`git diff npm/records-ui/v0.113.26..npm/records-ui/v0.113.27 -- apps/shared/records-ui`).
|
|
7
19
|
No source changes intended and no consumer action required.
|
|
8
20
|
|
|
21
|
+
## 0.113.26
|
|
22
|
+
|
|
23
|
+
Automatic changed-only republish (docs/metadata drift since the last tag — see
|
|
24
|
+
`git diff npm/records-ui/v0.113.25..npm/records-ui/v0.113.26 -- apps/shared/records-ui`).
|
|
25
|
+
No source changes intended and no consumer action required.
|
|
26
|
+
|
|
27
|
+
## 0.113.25
|
|
28
|
+
|
|
29
|
+
Automatic changed-only republish (docs/metadata drift since the last tag — see
|
|
30
|
+
`git diff npm/records-ui/v0.113.24..npm/records-ui/v0.113.25 -- apps/shared/records-ui`).
|
|
31
|
+
No source changes intended and no consumer action required.
|
|
32
|
+
|
|
33
|
+
## 0.113.24
|
|
34
|
+
|
|
35
|
+
Automatic changed-only republish (docs/metadata drift since the last tag — see
|
|
36
|
+
`git diff npm/records-ui/v0.113.23..npm/records-ui/v0.113.24 -- apps/shared/records-ui`).
|
|
37
|
+
No source changes intended and no consumer action required.
|
|
38
|
+
|
|
9
39
|
## 0.113.23
|
|
10
40
|
|
|
11
41
|
Automatic changed-only republish (docs/metadata drift since the last tag — see
|
package/dist/index.cjs
CHANGED
|
@@ -5169,8 +5169,11 @@ var import_jsx_runtime14 = (
|
|
|
5169
5169
|
// `FieldLabel`, so the sentence does not say it a second time.
|
|
5170
5170
|
require("react/jsx-runtime")
|
|
5171
5171
|
);
|
|
5172
|
+
function withoutSelf(rows, selfId) {
|
|
5173
|
+
return selfId ? rows.filter((row) => row.id !== selfId) : rows;
|
|
5174
|
+
}
|
|
5172
5175
|
var NO_STORE_ON_THIS_SCREEN_REASON = "This question points at a record in somebody's own data, and a page answered without an account is never allowed to search that. Leave it blank \u2014 whoever receives your answer will fill it in.";
|
|
5173
|
-
function RelationPicker({ field: field2, value, onChange, disabled, id, className, allowCreate = true, onPicked, autoOpen, onClose, onCancel }) {
|
|
5176
|
+
function RelationPicker({ field: field2, value, onChange, disabled, id, className, allowCreate = true, onPicked, autoOpen, onClose, onCancel, excludeId }) {
|
|
5174
5177
|
const client = (0, import_react24.useOptionalRecordsClient)();
|
|
5175
5178
|
const [rows, setRows] = (0, import_react23.useState)(null);
|
|
5176
5179
|
const [words2, setWords] = (0, import_react23.useState)({});
|
|
@@ -5199,7 +5202,7 @@ function RelationPicker({ field: field2, value, onChange, disabled, id, classNam
|
|
|
5199
5202
|
let cancelled = false;
|
|
5200
5203
|
void client.list({ table_id: target2, limit: 200 }).then((result) => {
|
|
5201
5204
|
if (cancelled) return;
|
|
5202
|
-
if (result.ok) setRows(result.data.rows);
|
|
5205
|
+
if (result.ok) setRows(withoutSelf(result.data.rows, excludeId));
|
|
5203
5206
|
else setRefusal(result.error);
|
|
5204
5207
|
});
|
|
5205
5208
|
return () => {
|
|
@@ -5305,7 +5308,7 @@ function RelationPicker({ field: field2, value, onChange, disabled, id, classNam
|
|
|
5305
5308
|
}
|
|
5306
5309
|
const createdId = String(written.data);
|
|
5307
5310
|
const refreshed = await client.list({ table_id: tableId, limit: 200 });
|
|
5308
|
-
if (refreshed.ok) setRows(refreshed.data.rows);
|
|
5311
|
+
if (refreshed.ok) setRows(withoutSelf(refreshed.data.rows, excludeId));
|
|
5309
5312
|
setBusy(false);
|
|
5310
5313
|
setCreating(false);
|
|
5311
5314
|
setNewTitle("");
|
|
@@ -11435,7 +11438,7 @@ function isPersonsName(field2) {
|
|
|
11435
11438
|
const words2 = `${field2.key} ${field2.label ?? ""}`.toLowerCase();
|
|
11436
11439
|
return /(^|[\s_])(full[\s_]?)?name(\s|$)/.test(words2) && !/(therapist|doctor|physician|company|business|pet|room)/.test(words2);
|
|
11437
11440
|
}
|
|
11438
|
-
function FieldControl({ field: field2, value, onChange, disabled, id, autoOpen, onClose, onCommit, onCancel, addsChoices, initialSearch, asForm, onChosen }) {
|
|
11441
|
+
function FieldControl({ field: field2, value, onChange, disabled, id, autoOpen, onClose, onCommit, onCancel, addsChoices, initialSearch, asForm, onChosen, recordId }) {
|
|
11439
11442
|
const host = useRecordsUi();
|
|
11440
11443
|
const kind = editorKindFor(field2);
|
|
11441
11444
|
const inputId = id ?? `field-${field2.key}`;
|
|
@@ -11520,9 +11523,9 @@ function FieldControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
11520
11523
|
if (hostTakesFiles(host)) {
|
|
11521
11524
|
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(AttachmentControl, { field: field2, value, onChange, disabled, id: inputId, autoOpen, onClose });
|
|
11522
11525
|
}
|
|
11523
|
-
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(RelationPicker, { field: field2, value, onChange, disabled, id: inputId });
|
|
11526
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(RelationPicker, { field: field2, value, onChange, disabled, id: inputId, excludeId: recordId });
|
|
11524
11527
|
case "relation":
|
|
11525
|
-
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(RelationPicker, { field: field2, value, onChange, disabled, id: inputId, onPicked: onCommit, autoOpen, onClose, onCancel });
|
|
11528
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(RelationPicker, { field: field2, value, onChange, disabled, id: inputId, onPicked: onCommit, autoOpen, onClose, onCancel, excludeId: recordId });
|
|
11526
11529
|
default:
|
|
11527
11530
|
if (typeof value === "boolean" || field2.config?.["kind"] === "boolean") {
|
|
11528
11531
|
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
@@ -12930,6 +12933,7 @@ function GridCell({
|
|
|
12930
12933
|
OpenCell,
|
|
12931
12934
|
{
|
|
12932
12935
|
field: field2,
|
|
12936
|
+
recordId: row.id,
|
|
12933
12937
|
draft: editing.draft,
|
|
12934
12938
|
initialSearch: editing.searchSeed,
|
|
12935
12939
|
onType: editing.type,
|
|
@@ -13275,7 +13279,8 @@ function OpenCell({
|
|
|
13275
13279
|
onCommit,
|
|
13276
13280
|
onCancel,
|
|
13277
13281
|
below,
|
|
13278
|
-
initialSearch
|
|
13282
|
+
initialSearch,
|
|
13283
|
+
recordId
|
|
13279
13284
|
}) {
|
|
13280
13285
|
const multiline = takesANewline(field2);
|
|
13281
13286
|
const picker = opensAsAList(field2, hostTakesFiles(useRecordsUi()));
|
|
@@ -13398,7 +13403,8 @@ function OpenCell({
|
|
|
13398
13403
|
...picker && ahead ? { initialSearch: ahead } : {},
|
|
13399
13404
|
onCommit: () => once(() => onCommit(null, "pick")),
|
|
13400
13405
|
onCancel: () => once(() => onCancel("pick")),
|
|
13401
|
-
addsChoices: true
|
|
13406
|
+
addsChoices: true,
|
|
13407
|
+
recordId
|
|
13402
13408
|
}
|
|
13403
13409
|
),
|
|
13404
13410
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("span", { "data-records-cell-tray": "", className: FLOATING_CELL_TRAY_CLASS, children: [
|
|
@@ -15414,6 +15420,7 @@ function ActionsHeaderControls({ onAddColumn }) {
|
|
|
15414
15420
|
"aria-label": ADD_COLUMN_LABEL,
|
|
15415
15421
|
title: ADD_COLUMN_LABEL,
|
|
15416
15422
|
"data-records-actions-header-add": "",
|
|
15423
|
+
"data-records-add-column": "",
|
|
15417
15424
|
onClick: (event) => {
|
|
15418
15425
|
event.stopPropagation();
|
|
15419
15426
|
onAddColumn();
|
|
@@ -17793,6 +17800,7 @@ function CustomRecordForm({
|
|
|
17793
17800
|
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "grid gap-3 sm:grid-cols-2", children: (fields.data ?? []).map((field2) => /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
17794
17801
|
FieldRow,
|
|
17795
17802
|
{
|
|
17803
|
+
recordId,
|
|
17796
17804
|
field: field2,
|
|
17797
17805
|
value: draft[field2.key],
|
|
17798
17806
|
document: existing.data?.document,
|
|
@@ -17867,7 +17875,8 @@ function FieldRow({
|
|
|
17867
17875
|
problems,
|
|
17868
17876
|
onChange,
|
|
17869
17877
|
onKeepEditing,
|
|
17870
|
-
onDiscard
|
|
17878
|
+
onDiscard,
|
|
17879
|
+
recordId
|
|
17871
17880
|
}) {
|
|
17872
17881
|
const id = `field-${field2.id}`;
|
|
17873
17882
|
const storedWords = document2?.[field2.key];
|
|
@@ -17878,7 +17887,7 @@ function FieldRow({
|
|
|
17878
17887
|
// A TEXT KEPT AS A FILE opens WHOLE, never as the 1000 characters its cell holds —
|
|
17879
17888
|
// saving those would cut the value (lane BIG-VALUES-WRITE).
|
|
17880
17889
|
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(WholeValueEditor, { field: field2, pointer: whole, words: String(storedWords ?? ""), value, onChange, id })
|
|
17881
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(FieldControl, { field: field2, value, onChange, id }),
|
|
17890
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(FieldControl, { field: field2, value, onChange, id, recordId }),
|
|
17882
17891
|
problems.map((problem, index) => /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
17883
17892
|
RefusalNotice,
|
|
17884
17893
|
{
|
|
@@ -19543,6 +19552,9 @@ function useReverseGridColumns(tableId, rowIds) {
|
|
|
19543
19552
|
label: column.label,
|
|
19544
19553
|
accessorFn: (row) => held.answers?.[column.key]?.[row.id]?.total ?? 0,
|
|
19545
19554
|
sortable: false,
|
|
19555
|
+
// THE SAME HEADER AS EVERY OTHER COLUMN (WALK-FIXES-3 D13): its hover icon opens the menu,
|
|
19556
|
+
// which says why this column cannot sort — its links are kept on the other table.
|
|
19557
|
+
sortRefusal: `Kept on ${column.source_table_name}, so it cannot sort here.`,
|
|
19546
19558
|
filter: false,
|
|
19547
19559
|
copyValue: (row) => (held.answers?.[column.key]?.[row.id]?.links ?? []).map((l) => l.words).join(", "),
|
|
19548
19560
|
cell: (row) => row.id === SUMMARY_ROW_ID || row.id === ADD_ROW_ID ? null : /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(ReverseCell, { held, column, rowId: row.id, tableId }),
|
|
@@ -19585,10 +19597,14 @@ function ReverseCell({ held, column, rowId, tableId }) {
|
|
|
19585
19597
|
const reading = (0, import_react106.useSyncExternalStore)(subscribe, readReading, readReading);
|
|
19586
19598
|
const chips = /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(ReverseLinkChips, { column, answer, loading: reading, clamp: { tableId, recordId: rowId } });
|
|
19587
19599
|
if (column.read_only) return chips;
|
|
19588
|
-
return /* @__PURE__ */ (0, import_jsx_runtime64.
|
|
19589
|
-
|
|
19590
|
-
|
|
19591
|
-
|
|
19600
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(ReverseLinksEditCell, { tableId, recordId: rowId, column, chips });
|
|
19601
|
+
}
|
|
19602
|
+
var reverseCellOpeners = /* @__PURE__ */ new Map();
|
|
19603
|
+
function openReverseCell(rowId, columnId2) {
|
|
19604
|
+
const open = reverseCellOpeners.get(`${rowId}|${columnId2}`);
|
|
19605
|
+
if (!open) return false;
|
|
19606
|
+
open();
|
|
19607
|
+
return true;
|
|
19592
19608
|
}
|
|
19593
19609
|
function useReverseField(tableId, column) {
|
|
19594
19610
|
const client = (0, import_react107.useOptionalRecordsClient)();
|
|
@@ -19626,27 +19642,48 @@ function ReverseLinksEditor({ tableId, recordId, column, autoOpen, onClose }) {
|
|
|
19626
19642
|
if (done.ok) read.reload();
|
|
19627
19643
|
};
|
|
19628
19644
|
return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("span", { className: "flex min-w-0 flex-col gap-1", "data-records-reverse-editor": column.key, children: [
|
|
19629
|
-
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(RelationPicker, { field: field2, value: current, onChange: (next) => void write(next), autoOpen, onClose }),
|
|
19645
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(RelationPicker, { field: field2, value: current, onChange: (next) => void write(next), autoOpen, onClose, excludeId: recordId }),
|
|
19630
19646
|
refused ? /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(RefusalNotice, { error: refused }) : null
|
|
19631
19647
|
] });
|
|
19632
19648
|
}
|
|
19633
19649
|
var REVERSE_LINKS_EDIT_MAX = 50;
|
|
19634
|
-
function
|
|
19650
|
+
function ReverseLinksEditCell({ tableId, recordId, column, chips }) {
|
|
19635
19651
|
const [open, setOpen] = (0, import_react106.useState)(false);
|
|
19652
|
+
const key = `${recordId}|${reverseColumnId(column)}`;
|
|
19653
|
+
(0, import_react106.useEffect)(() => {
|
|
19654
|
+
reverseCellOpeners.set(key, () => setOpen(true));
|
|
19655
|
+
return () => {
|
|
19656
|
+
reverseCellOpeners.delete(key);
|
|
19657
|
+
};
|
|
19658
|
+
}, [key]);
|
|
19636
19659
|
return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_design_system57.Popover, { open, onOpenChange: setOpen, children: [
|
|
19637
19660
|
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_design_system57.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
19638
|
-
|
|
19661
|
+
"span",
|
|
19639
19662
|
{
|
|
19640
|
-
|
|
19641
|
-
|
|
19642
|
-
|
|
19643
|
-
"
|
|
19644
|
-
title: `Link ${column.source_table_name}`,
|
|
19663
|
+
role: "button",
|
|
19664
|
+
tabIndex: 0,
|
|
19665
|
+
"data-matrx-cell-control": "",
|
|
19666
|
+
"data-matrx-cell-fill": "",
|
|
19645
19667
|
"data-records-reverse-edit": column.key,
|
|
19646
|
-
|
|
19668
|
+
"aria-label": `Edit ${column.label}`,
|
|
19669
|
+
title: `${column.label} \u2014 click or press Enter to edit`,
|
|
19670
|
+
className: "flex w-full min-w-0 cursor-text items-center gap-1 rounded px-1 py-0.5 hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
19671
|
+
onClick: (event) => {
|
|
19672
|
+
if (event.target instanceof Element && event.target.closest("a[href]")) {
|
|
19673
|
+
event.preventDefault();
|
|
19674
|
+
return;
|
|
19675
|
+
}
|
|
19676
|
+
},
|
|
19677
|
+
onKeyDown: (event) => {
|
|
19678
|
+
if (event.key === "Enter" || event.key === "F2") {
|
|
19679
|
+
event.preventDefault();
|
|
19680
|
+
setOpen(true);
|
|
19681
|
+
}
|
|
19682
|
+
},
|
|
19683
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("span", { className: "min-w-0 flex-1", children: chips })
|
|
19647
19684
|
}
|
|
19648
19685
|
) }),
|
|
19649
|
-
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_design_system57.PopoverContent, { sizing: "content", align: "start", className: "w-80 p-2", children: open ? /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(ReverseLinksEditor, { tableId, recordId, column }) : null })
|
|
19686
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_design_system57.PopoverContent, { sizing: "content", align: "start", className: "w-80 p-2", children: open ? /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(ReverseLinksEditor, { tableId, recordId, column, autoOpen: true, onClose: () => setOpen(false) }) : null })
|
|
19650
19687
|
] });
|
|
19651
19688
|
}
|
|
19652
19689
|
var EMPTY_COLUMNS = [];
|
|
@@ -25262,9 +25299,10 @@ function GridBody({
|
|
|
25262
25299
|
(key) => holdHeaderMenu(headerHeld.current, menuLatest.current, key, controls.headerMenuFor(key)),
|
|
25263
25300
|
(key) => holdByContent(headerHeld.current, `filter:${key}`, filterFor(key))
|
|
25264
25301
|
);
|
|
25265
|
-
|
|
25302
|
+
const pinnedPlus = offersRowActions && mayManageActions;
|
|
25303
|
+
return merged && rights.structure && !readOnly && !pinnedPlus ? [...drawn, addColumnDef] : drawn;
|
|
25266
25304
|
},
|
|
25267
|
-
[bodyColumns, controls.headerMenuFor, controls.filterFor, merged, rights.structure, readOnly, addColumnDef]
|
|
25305
|
+
[bodyColumns, controls.headerMenuFor, controls.filterFor, merged, rights.structure, readOnly, addColumnDef, offersRowActions, mayManageActions]
|
|
25268
25306
|
);
|
|
25269
25307
|
const columnsHeld = (0, import_react127.useRef)(null);
|
|
25270
25308
|
const columns = columnsHeld.current !== null && sameColumns(columnsHeld.current, drawnColumns) ? columnsHeld.current : drawnColumns;
|
|
@@ -25273,7 +25311,7 @@ function GridBody({
|
|
|
25273
25311
|
() => offersRowActions ? [...columns, { id: "custom-actions", header: merged ? /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("span", { className: "inline-flex items-center gap-0.5", children: [
|
|
25274
25312
|
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { children: "Actions" }),
|
|
25275
25313
|
actionsHeader
|
|
25276
|
-
] }) : "Actions", label: "Actions", reorderable: false, sortable: false, filter: false, customActions: rowActions }] : columns,
|
|
25314
|
+
] }) : "Actions", label: "Actions", reorderable: false, sortable: false, filter: false, customActions: rowActions, cell: drawNothing }] : columns,
|
|
25277
25315
|
[columns, offersRowActions, merged, actionsHeader, rowActions]
|
|
25278
25316
|
);
|
|
25279
25317
|
const [localColumns, setLocalColumns] = (0, import_react127.useState)(
|
|
@@ -25441,6 +25479,9 @@ function GridBody({
|
|
|
25441
25479
|
*/
|
|
25442
25480
|
onEditRequest: (address2, seed) => {
|
|
25443
25481
|
const now = sheetNow.current;
|
|
25482
|
+
if (address2.columnId.startsWith(REVERSE_COLUMN_PREFIX)) {
|
|
25483
|
+
return (seed === null || seed === "") && now.mayWriteRow(address2.rowId) && openReverseCell(address2.rowId, address2.columnId);
|
|
25484
|
+
}
|
|
25444
25485
|
const field2 = now.fields.find((f) => f.key === address2.columnId);
|
|
25445
25486
|
if (!field2 || !fieldIsEditable(field2) || !now.mayWriteRow(address2.rowId)) return false;
|
|
25446
25487
|
if (editorKindFor(field2) === "checkbox") {
|
|
@@ -36115,6 +36156,7 @@ function copyName(name, taken) {
|
|
|
36115
36156
|
// src/ViewBar.tsx
|
|
36116
36157
|
var import_jsx_runtime117 = require("react/jsx-runtime");
|
|
36117
36158
|
var SAVED_VIEWS_UNAVAILABLE = "Saved views are not available in this organization right now, so the layout you pick here is not being kept. Everything else on this table works as usual.";
|
|
36159
|
+
var VIEW_CHIP_BOX = "h-8 w-32 shrink-0";
|
|
36118
36160
|
function seedIsSatisfied(seed, views) {
|
|
36119
36161
|
if (views.some((v) => v.name === seed.name)) return true;
|
|
36120
36162
|
return seed.isDefault === true && views.some((v) => v.isDefault);
|
|
@@ -36272,7 +36314,7 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews,
|
|
|
36272
36314
|
);
|
|
36273
36315
|
}
|
|
36274
36316
|
if (error) return /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(RefusalNotice, { error, className, actions: /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(import_design_system100.Button, { size: "sm", variant: "ghost", onClick: () => void load(), children: "Try again" }) });
|
|
36275
|
-
if (views === null) return /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(import_design_system100.Skeleton, { className: (0, import_design_system100.cn)("
|
|
36317
|
+
if (views === null) return /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(import_design_system100.Skeleton, { className: (0, import_design_system100.cn)(VIEW_CHIP_BOX, className), "data-view-picker-reserved": "" });
|
|
36276
36318
|
const current = views.find((v) => v.id === active) ?? null;
|
|
36277
36319
|
return /* @__PURE__ */ (0, import_jsx_runtime117.jsxs)(import_design_system100.Popover, { open, onOpenChange: setOpen, children: [
|
|
36278
36320
|
/* @__PURE__ */ (0, import_jsx_runtime117.jsx)(import_design_system100.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime117.jsxs)(
|
|
@@ -36280,7 +36322,8 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews,
|
|
|
36280
36322
|
{
|
|
36281
36323
|
size: "sm",
|
|
36282
36324
|
variant: "subtle",
|
|
36283
|
-
className: (0, import_design_system100.cn)("
|
|
36325
|
+
className: (0, import_design_system100.cn)(VIEW_CHIP_BOX, "justify-between gap-1 px-2 text-xs", className),
|
|
36326
|
+
title: current?.name ?? void 0,
|
|
36284
36327
|
"aria-label": `View: ${current?.name ?? "none yet"}. Change view`,
|
|
36285
36328
|
"data-view-picker": "",
|
|
36286
36329
|
children: [
|
|
@@ -50671,6 +50714,37 @@ function TablePage({
|
|
|
50671
50714
|
const [shareAsked, setShareAsked] = (0, import_react288.useState)(0);
|
|
50672
50715
|
const { open: renameOpen, setOpen: setRenameOpen, ask: askRename, menuContentProps: renameMenuProps } = useRenameFromMenu();
|
|
50673
50716
|
const [archiveAsked, setArchiveAsked] = (0, import_react288.useState)(0);
|
|
50717
|
+
const pageArchive = (0, import_react289.useTableArchive)(tableId);
|
|
50718
|
+
const archiveRunning = (0, import_react288.useRef)(false);
|
|
50719
|
+
const archiveFromMenu = (0, import_react288.useCallback)(async () => {
|
|
50720
|
+
if (archiveRunning.current) return;
|
|
50721
|
+
archiveRunning.current = true;
|
|
50722
|
+
try {
|
|
50723
|
+
const look2 = await pageArchive.preview();
|
|
50724
|
+
const line = look2?.confirm_over;
|
|
50725
|
+
if (!look2 || typeof line !== "number" || look2.remaining > line) {
|
|
50726
|
+
setSurface((now) => ({ ...now, main: "records", rail: "settings" }));
|
|
50727
|
+
setArchiveAsked((n) => n + 1);
|
|
50728
|
+
return;
|
|
50729
|
+
}
|
|
50730
|
+
const finished = await pageArchive.start();
|
|
50731
|
+
if (finished?.done && finished.table_archived) {
|
|
50732
|
+
announceTableArchived({
|
|
50733
|
+
notify: recordsUi.notify,
|
|
50734
|
+
client,
|
|
50735
|
+
tableId,
|
|
50736
|
+
name: finished.table_name || table.data?.name || "the table",
|
|
50737
|
+
onRestored: () => (0, import_react289.tableShapeChanged)(tableId)
|
|
50738
|
+
});
|
|
50739
|
+
(0, import_react289.tableShapeChanged)(tableId);
|
|
50740
|
+
return;
|
|
50741
|
+
}
|
|
50742
|
+
setSurface((now) => ({ ...now, main: "records", rail: "settings" }));
|
|
50743
|
+
setArchiveAsked((n) => n + 1);
|
|
50744
|
+
} finally {
|
|
50745
|
+
archiveRunning.current = false;
|
|
50746
|
+
}
|
|
50747
|
+
}, [pageArchive, client, tableId, table.data, recordsUi.notify]);
|
|
50674
50748
|
const [moveAsked, setMoveAsked] = (0, import_react288.useState)(0);
|
|
50675
50749
|
const [duplicateOpen, setDuplicateOpen] = (0, import_react288.useState)(false);
|
|
50676
50750
|
const [referenceOpen, setReferenceOpen] = (0, import_react288.useState)(false);
|
|
@@ -51038,8 +51112,7 @@ function TablePage({
|
|
|
51038
51112
|
...layoutShowingLabel ? { layoutLabel: layoutShowingLabel } : {},
|
|
51039
51113
|
openBuiltOn: (destination) => go(BUILT_ON_PRESS[destination]),
|
|
51040
51114
|
archive: () => {
|
|
51041
|
-
|
|
51042
|
-
setArchiveAsked((n) => n + 1);
|
|
51115
|
+
void archiveFromMenu();
|
|
51043
51116
|
},
|
|
51044
51117
|
unavailableReasons: {
|
|
51045
51118
|
open: "Already open",
|