@ai-matrx/records-ui 0.116.36 → 0.116.38
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 +21 -1
- package/dist/index.cjs +60 -41
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +60 -41
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -11769,6 +11769,7 @@ function BulkActions({
|
|
|
11769
11769
|
bulk,
|
|
11770
11770
|
noun,
|
|
11771
11771
|
nounPlural,
|
|
11772
|
+
titleKey = null,
|
|
11772
11773
|
onDone
|
|
11773
11774
|
}) {
|
|
11774
11775
|
const typeable = useMemo24(() => fields.filter(fieldIsEditable), [fields]);
|
|
@@ -11811,7 +11812,7 @@ function BulkActions({
|
|
|
11811
11812
|
),
|
|
11812
11813
|
/* @__PURE__ */ jsx40(Button30, { size: "sm", variant: "outline", className: "h-7 px-2", "data-records-bulk": "print", disabled: bulk.busy, onClick: () => setPrinting(true), children: "Print with layout\u2026" }),
|
|
11813
11814
|
/* @__PURE__ */ jsx40(Button30, { size: "sm", variant: "outline", className: "h-7 px-2", "data-records-bulk": "delete", disabled: bulk.busy, onClick: () => setConfirmDelete(true), children: "Delete" }),
|
|
11814
|
-
printing ? /* @__PURE__ */ jsx40(PrintWithLayoutDialog, { tableId, recordIds: ids, open: true, onOpenChange: setPrinting }) : null,
|
|
11815
|
+
printing ? /* @__PURE__ */ jsx40(PrintWithLayoutDialog, { tableId, recordIds: ids, names: printNames(ids, rows, titleKey), open: true, onOpenChange: setPrinting }) : null,
|
|
11815
11816
|
/* @__PURE__ */ jsx40(Dialog14, { open: asking !== null, onOpenChange: (next) => !next ? setAsking(null) : void 0, children: /* @__PURE__ */ jsxs36(DialogContent14, { className: "sm:max-w-md", children: [
|
|
11816
11817
|
/* @__PURE__ */ jsxs36(DialogHeader14, { children: [
|
|
11817
11818
|
/* @__PURE__ */ jsx40(DialogTitle14, { children: asking === "set" ? `Set a column on ${many}` : asking === "clear" ? `Clear a column on ${many}` : `Fill a column down ${many}` }),
|
|
@@ -11878,6 +11879,12 @@ function BulkActions({
|
|
|
11878
11879
|
)
|
|
11879
11880
|
] });
|
|
11880
11881
|
}
|
|
11882
|
+
function printNames(ids, rows, titleKey) {
|
|
11883
|
+
const want = new Set(ids);
|
|
11884
|
+
const out = {};
|
|
11885
|
+
for (const row of rows) if (want.has(row.id)) out[row.id] = rowName(row, titleKey ?? null);
|
|
11886
|
+
return out;
|
|
11887
|
+
}
|
|
11881
11888
|
|
|
11882
11889
|
// src/handOrder.tsx
|
|
11883
11890
|
import { useEffect as useEffect33, useMemo as useMemo25, useRef as useRef20, useState as useState39 } from "react";
|
|
@@ -14387,6 +14394,7 @@ function GridBody({
|
|
|
14387
14394
|
bulk,
|
|
14388
14395
|
noun,
|
|
14389
14396
|
nounPlural,
|
|
14397
|
+
titleKey,
|
|
14390
14398
|
onDone: () => setSelectedIds([])
|
|
14391
14399
|
}
|
|
14392
14400
|
) : null,
|
|
@@ -26635,6 +26643,11 @@ function Board({
|
|
|
26635
26643
|
pager
|
|
26636
26644
|
] });
|
|
26637
26645
|
}
|
|
26646
|
+
function galleryValueTitle(value) {
|
|
26647
|
+
if (typeof value === "number") return String(value);
|
|
26648
|
+
if (typeof value !== "string" || value.trim() === "") return void 0;
|
|
26649
|
+
return value.length > 300 ? `${value.slice(0, 299)}\u2026` : value;
|
|
26650
|
+
}
|
|
26638
26651
|
function FieldPicker({
|
|
26639
26652
|
layout,
|
|
26640
26653
|
label,
|
|
@@ -27010,45 +27023,49 @@ function Gallery({
|
|
|
27010
27023
|
const filled = shown4.filter((field) => !isEmptyOnCard(doc[field.key]) || withheldNoticeOf(row.hidden, field.key));
|
|
27011
27024
|
const onCard = chose ? filled : filled.slice(0, GALLERY_DEFAULT_FIELDS);
|
|
27012
27025
|
const rowColor = style ? resolveRowColor4(style, { id: row.id, data: row.document ?? {} }, colorFromTheValue) : null;
|
|
27013
|
-
return
|
|
27014
|
-
|
|
27015
|
-
|
|
27016
|
-
|
|
27017
|
-
|
|
27018
|
-
|
|
27019
|
-
|
|
27020
|
-
|
|
27021
|
-
|
|
27022
|
-
|
|
27023
|
-
|
|
27024
|
-
|
|
27025
|
-
|
|
27026
|
-
|
|
27027
|
-
|
|
27028
|
-
|
|
27029
|
-
|
|
27030
|
-
|
|
27031
|
-
|
|
27032
|
-
|
|
27033
|
-
/* @__PURE__ */ jsx88("span", { className: "shrink-0
|
|
27034
|
-
/* @__PURE__ */ jsx88("span", { className: "
|
|
27035
|
-
|
|
27036
|
-
{
|
|
27037
|
-
|
|
27038
|
-
|
|
27039
|
-
|
|
27040
|
-
|
|
27041
|
-
|
|
27042
|
-
|
|
27043
|
-
|
|
27044
|
-
|
|
27045
|
-
|
|
27046
|
-
|
|
27047
|
-
|
|
27048
|
-
|
|
27049
|
-
|
|
27050
|
-
|
|
27051
|
-
|
|
27026
|
+
return (
|
|
27027
|
+
// min-w-0 + overflow-hidden: a long unbroken value (a link, a data: URL) is cut at the card's
|
|
27028
|
+
// edge with its line's ellipsis, never drawn over the next card (AT-SLOW 4b).
|
|
27029
|
+
/* @__PURE__ */ jsx88("li", { className: "flex min-w-0 overflow-hidden", "data-records-gallery-tile": "", children: /* @__PURE__ */ jsx88(
|
|
27030
|
+
MaybeRecordActionMenu,
|
|
27031
|
+
{
|
|
27032
|
+
tableId,
|
|
27033
|
+
row,
|
|
27034
|
+
name: recordNameIn({ title_field: titleKey ?? null }, doc),
|
|
27035
|
+
onOpenRecord,
|
|
27036
|
+
onChanged,
|
|
27037
|
+
children: /* @__PURE__ */ jsxs81(
|
|
27038
|
+
ClickableSurface,
|
|
27039
|
+
{
|
|
27040
|
+
label: `Open ${recordNameIn({ title_field: titleKey ?? null }, doc) || "record"}`,
|
|
27041
|
+
onOpen: () => onOpenRecord?.(row.id),
|
|
27042
|
+
className: cn40("h-full w-full min-w-0 overflow-hidden rounded border text-left hover:bg-muted", rowColor ? ROW_TINT_CLASS3[rowColor] : void 0),
|
|
27043
|
+
contentClassName: "flex h-full w-full min-w-0 flex-col gap-1 p-2 pr-7",
|
|
27044
|
+
data: { "data-records-gallery-card": row.id },
|
|
27045
|
+
children: [
|
|
27046
|
+
imageField ? /* @__PURE__ */ jsx88("span", { className: cn40(dims.cover, "w-full shrink-0 overflow-hidden rounded bg-muted/50"), "data-records-gallery-cover": imageField.key, children: /* @__PURE__ */ jsx88(GalleryCover, { field: imageField, value: image }) }) : null,
|
|
27047
|
+
/* @__PURE__ */ jsx88("span", { className: "truncate text-sm font-medium", "data-records-gallery-title": "", children: recordNameIn({ title_field: titleKey ?? null }, doc) || "Untitled" }),
|
|
27048
|
+
onCard.map((field) => /* @__PURE__ */ jsxs81("span", { className: "flex h-5 min-w-0 items-center gap-1 overflow-hidden whitespace-nowrap text-xs", children: [
|
|
27049
|
+
/* @__PURE__ */ jsx88("span", { className: "shrink-0 text-muted-foreground", children: fieldName(field) }),
|
|
27050
|
+
/* @__PURE__ */ jsx88("span", { className: "min-w-0 truncate", "data-records-gallery-value": field.key, title: galleryValueTitle(doc[field.key]), children: /* @__PURE__ */ jsx88(
|
|
27051
|
+
RecordValue,
|
|
27052
|
+
{
|
|
27053
|
+
inCell: true,
|
|
27054
|
+
field,
|
|
27055
|
+
value: doc[field.key],
|
|
27056
|
+
document: row.document,
|
|
27057
|
+
recordId: row.id,
|
|
27058
|
+
withheld: withheldNoticeOf(row.hidden, field.key),
|
|
27059
|
+
format: cellFormatFor(field, formats?.[field.key])
|
|
27060
|
+
}
|
|
27061
|
+
) })
|
|
27062
|
+
] }, field.key))
|
|
27063
|
+
]
|
|
27064
|
+
}
|
|
27065
|
+
)
|
|
27066
|
+
}
|
|
27067
|
+
) }, row.id)
|
|
27068
|
+
);
|
|
27052
27069
|
}),
|
|
27053
27070
|
onNew ? /* @__PURE__ */ jsx88("li", { children: /* @__PURE__ */ jsxs81(
|
|
27054
27071
|
"button",
|
|
@@ -32585,10 +32602,11 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
|
|
|
32585
32602
|
);
|
|
32586
32603
|
const stored = useMemo60(() => draft ? (forms ?? []).find((f) => f.id === draft.id) ?? null : null, [draft, forms]);
|
|
32587
32604
|
const dirty = Boolean(draft && stored && !sameForm(draft, stored));
|
|
32605
|
+
const lastSaved = useRef43(null);
|
|
32588
32606
|
useEffect85(() => {
|
|
32589
32607
|
if (!draft || !stored) return;
|
|
32590
32608
|
const timer = window.setTimeout(() => {
|
|
32591
|
-
if (sameForm(draft, stored)) dropKeptDraft(formDraftKey(draft.id), { storage: "local" });
|
|
32609
|
+
if (sameForm(draft, stored) || lastSaved.current && sameForm(draft, lastSaved.current)) dropKeptDraft(formDraftKey(draft.id), { storage: "local" });
|
|
32592
32610
|
else keepDraft(formDraftKey(draft.id), keptSpecOf(draft), { storage: "local" });
|
|
32593
32611
|
}, 300);
|
|
32594
32612
|
return () => window.clearTimeout(timer);
|
|
@@ -32648,6 +32666,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
|
|
|
32648
32666
|
setRefused(written.error);
|
|
32649
32667
|
return false;
|
|
32650
32668
|
}
|
|
32669
|
+
lastSaved.current = draft;
|
|
32651
32670
|
dropKeptDraft(formDraftKey(draft.id), { storage: "local" });
|
|
32652
32671
|
setRestoredAt(null);
|
|
32653
32672
|
setSaved("Saved");
|