@ai-matrx/records-ui 0.116.37 → 0.116.39

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/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";
@@ -12277,6 +12284,7 @@ var embeddedPageAskKey = (tableId, search, sorts, filter, pageDoorViewId) => JSO
12277
12284
  var NO_SUMMARIES = Object.freeze({});
12278
12285
  var NO_DRILL_FIELDS = Object.freeze([]);
12279
12286
  var rowIdOf = (row) => row.id;
12287
+ var ACTIONS_GHOST_ROW = { id: "", document: {} };
12280
12288
  var NO_REREAD = () => {
12281
12289
  };
12282
12290
  var VALUE_FILTER_UI = { allowNegation: true };
@@ -13580,9 +13588,9 @@ function GridBody({
13580
13588
  () => /* @__PURE__ */ jsx44(ActionsHeaderControls, { ...mayManageActions ? { onAddColumn: () => addColumnNow.current() } : {} }),
13581
13589
  [mayManageActions]
13582
13590
  );
13583
- const rowActions = useCallback22(
13584
- (row) => /* @__PURE__ */ jsxs39(Fragment15, { children: [
13585
- canWrite && mayWriteRow(row.id) ? tableActions2.runnable.map((action2) => /* @__PURE__ */ jsx44(
13591
+ const rowStrip = useCallback22(
13592
+ (row, writable) => /* @__PURE__ */ jsxs39(Fragment15, { children: [
13593
+ canWrite && writable ? tableActions2.runnable.map((action2) => /* @__PURE__ */ jsx44(
13586
13594
  ActionButton,
13587
13595
  {
13588
13596
  action: action2,
@@ -13632,7 +13640,7 @@ function GridBody({
13632
13640
  children: "Duplicate"
13633
13641
  }
13634
13642
  ) : null,
13635
- canWrite && mayWriteRow(row.id) ? /* @__PURE__ */ jsx44(
13643
+ canWrite && writable ? /* @__PURE__ */ jsx44(
13636
13644
  Button33,
13637
13645
  {
13638
13646
  size: "sm",
@@ -13644,8 +13652,9 @@ function GridBody({
13644
13652
  ) : null
13645
13653
  ] }),
13646
13654
  // eslint-disable-next-line react-hooks/exhaustive-deps -- `hasTalk`/`hasAgent` stand for the host ports the JSX reads; handlers run through `rowActionsNow`.
13647
- [canWrite, mayWriteRow, tableActions2.runnable, tableActions2.agent, runner.busy, hasTalk, hasAgent, editable, rights.write, readOnly]
13655
+ [canWrite, tableActions2.runnable, tableActions2.agent, runner.busy, hasTalk, hasAgent, editable, rights.write, readOnly]
13648
13656
  );
13657
+ const rowActions = useCallback22((row) => rowStrip(row, row === ACTIONS_GHOST_ROW || mayWriteRow(row.id)), [rowStrip, mayWriteRow]);
13649
13658
  const headerHeld = useRef21(/* @__PURE__ */ new Map());
13650
13659
  const menuLatest = useRef21(/* @__PURE__ */ new Map());
13651
13660
  const addColumnDef = useMemo26(() => addColumnColumn(() => addColumnNow.current()), []);
@@ -13669,7 +13678,7 @@ function GridBody({
13669
13678
  () => offersRowActions ? [...columns, { id: "custom-actions", header: merged ? /* @__PURE__ */ jsxs39("span", { className: "inline-flex items-center gap-0.5", children: [
13670
13679
  /* @__PURE__ */ jsx44("span", { children: "Actions" }),
13671
13680
  actionsHeader
13672
- ] }) : "Actions", label: "Actions", reorderable: false, sortable: false, filter: false, customActions: rowActions }] : columns,
13681
+ ] }) : "Actions", label: "Actions", reorderable: false, sortable: false, filter: false, customActions: rowActions, customActionsGhostRow: ACTIONS_GHOST_ROW }] : columns,
13673
13682
  [columns, offersRowActions, merged, actionsHeader, rowActions]
13674
13683
  );
13675
13684
  const [localColumns, setLocalColumns] = useState41(
@@ -14387,6 +14396,7 @@ function GridBody({
14387
14396
  bulk,
14388
14397
  noun,
14389
14398
  nounPlural,
14399
+ titleKey,
14390
14400
  onDone: () => setSelectedIds([])
14391
14401
  }
14392
14402
  ) : null,
@@ -26635,6 +26645,11 @@ function Board({
26635
26645
  pager
26636
26646
  ] });
26637
26647
  }
26648
+ function galleryValueTitle(value) {
26649
+ if (typeof value === "number") return String(value);
26650
+ if (typeof value !== "string" || value.trim() === "") return void 0;
26651
+ return value.length > 300 ? `${value.slice(0, 299)}\u2026` : value;
26652
+ }
26638
26653
  function FieldPicker({
26639
26654
  layout,
26640
26655
  label,
@@ -27010,45 +27025,49 @@ function Gallery({
27010
27025
  const filled = shown4.filter((field) => !isEmptyOnCard(doc[field.key]) || withheldNoticeOf(row.hidden, field.key));
27011
27026
  const onCard = chose ? filled : filled.slice(0, GALLERY_DEFAULT_FIELDS);
27012
27027
  const rowColor = style ? resolveRowColor4(style, { id: row.id, data: row.document ?? {} }, colorFromTheValue) : null;
27013
- return /* @__PURE__ */ jsx88("li", { className: "flex", children: /* @__PURE__ */ jsx88(
27014
- MaybeRecordActionMenu,
27015
- {
27016
- tableId,
27017
- row,
27018
- name: recordNameIn({ title_field: titleKey ?? null }, doc),
27019
- onOpenRecord,
27020
- onChanged,
27021
- children: /* @__PURE__ */ jsxs81(
27022
- ClickableSurface,
27023
- {
27024
- label: `Open ${recordNameIn({ title_field: titleKey ?? null }, doc) || "record"}`,
27025
- onOpen: () => onOpenRecord?.(row.id),
27026
- className: cn40("h-full w-full rounded border text-left hover:bg-muted", rowColor ? ROW_TINT_CLASS3[rowColor] : void 0),
27027
- contentClassName: "flex h-full w-full flex-col gap-1 p-2 pr-7",
27028
- data: { "data-records-gallery-card": row.id },
27029
- children: [
27030
- 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,
27031
- /* @__PURE__ */ jsx88("span", { className: "truncate text-sm font-medium", "data-records-gallery-title": "", children: recordNameIn({ title_field: titleKey ?? null }, doc) || "Untitled" }),
27032
- onCard.map((field) => /* @__PURE__ */ jsxs81("span", { className: "flex h-5 min-w-0 items-center gap-1 overflow-hidden whitespace-nowrap text-xs", children: [
27033
- /* @__PURE__ */ jsx88("span", { className: "shrink-0 text-muted-foreground", children: fieldName(field) }),
27034
- /* @__PURE__ */ jsx88("span", { className: "min-w-0 truncate", "data-records-gallery-value": field.key, children: /* @__PURE__ */ jsx88(
27035
- RecordValue,
27036
- {
27037
- inCell: true,
27038
- field,
27039
- value: doc[field.key],
27040
- document: row.document,
27041
- recordId: row.id,
27042
- withheld: withheldNoticeOf(row.hidden, field.key),
27043
- format: cellFormatFor(field, formats?.[field.key])
27044
- }
27045
- ) })
27046
- ] }, field.key))
27047
- ]
27048
- }
27049
- )
27050
- }
27051
- ) }, row.id);
27028
+ return (
27029
+ // min-w-0 + overflow-hidden: a long unbroken value (a link, a data: URL) is cut at the card's
27030
+ // edge with its line's ellipsis, never drawn over the next card (AT-SLOW 4b).
27031
+ /* @__PURE__ */ jsx88("li", { className: "flex min-w-0 overflow-hidden", "data-records-gallery-tile": "", children: /* @__PURE__ */ jsx88(
27032
+ MaybeRecordActionMenu,
27033
+ {
27034
+ tableId,
27035
+ row,
27036
+ name: recordNameIn({ title_field: titleKey ?? null }, doc),
27037
+ onOpenRecord,
27038
+ onChanged,
27039
+ children: /* @__PURE__ */ jsxs81(
27040
+ ClickableSurface,
27041
+ {
27042
+ label: `Open ${recordNameIn({ title_field: titleKey ?? null }, doc) || "record"}`,
27043
+ onOpen: () => onOpenRecord?.(row.id),
27044
+ 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),
27045
+ contentClassName: "flex h-full w-full min-w-0 flex-col gap-1 p-2 pr-7",
27046
+ data: { "data-records-gallery-card": row.id },
27047
+ children: [
27048
+ 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,
27049
+ /* @__PURE__ */ jsx88("span", { className: "truncate text-sm font-medium", "data-records-gallery-title": "", children: recordNameIn({ title_field: titleKey ?? null }, doc) || "Untitled" }),
27050
+ onCard.map((field) => /* @__PURE__ */ jsxs81("span", { className: "flex h-5 min-w-0 items-center gap-1 overflow-hidden whitespace-nowrap text-xs", children: [
27051
+ /* @__PURE__ */ jsx88("span", { className: "shrink-0 text-muted-foreground", children: fieldName(field) }),
27052
+ /* @__PURE__ */ jsx88("span", { className: "min-w-0 truncate", "data-records-gallery-value": field.key, title: galleryValueTitle(doc[field.key]), children: /* @__PURE__ */ jsx88(
27053
+ RecordValue,
27054
+ {
27055
+ inCell: true,
27056
+ field,
27057
+ value: doc[field.key],
27058
+ document: row.document,
27059
+ recordId: row.id,
27060
+ withheld: withheldNoticeOf(row.hidden, field.key),
27061
+ format: cellFormatFor(field, formats?.[field.key])
27062
+ }
27063
+ ) })
27064
+ ] }, field.key))
27065
+ ]
27066
+ }
27067
+ )
27068
+ }
27069
+ ) }, row.id)
27070
+ );
27052
27071
  }),
27053
27072
  onNew ? /* @__PURE__ */ jsx88("li", { children: /* @__PURE__ */ jsxs81(
27054
27073
  "button",