@ai-matrx/records-ui 0.101.22 → 0.101.25

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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog — @ai-matrx/records-ui
2
2
 
3
+ ## 0.101.24
4
+
5
+ Automatic changed-only republish (docs/metadata drift since the last tag — see
6
+ `git diff npm/records-ui/v0.101.23..npm/records-ui/v0.101.24 -- apps/shared/records-ui`).
7
+ No source changes intended and no consumer action required.
8
+
9
+ ## 0.101.23
10
+
11
+ Automatic changed-only republish (docs/metadata drift since the last tag — see
12
+ `git diff npm/records-ui/v0.101.22..npm/records-ui/v0.101.23 -- apps/shared/records-ui`).
13
+ No source changes intended and no consumer action required.
14
+
3
15
  ## 0.101.22
4
16
 
5
17
  Automatic changed-only republish (docs/metadata drift since the last tag — see
package/dist/index.cjs CHANGED
@@ -3907,7 +3907,7 @@ var colorFromTheValue = (_fieldKey, value) => {
3907
3907
  for (let i = 0; i < text.length; i += 1) {
3908
3908
  hash = hash * 31 + text.charCodeAt(i) >>> 0;
3909
3909
  }
3910
- return import_data_table2.STYLE_COLORS[hash % import_data_table2.STYLE_COLORS.length];
3910
+ return import_data_table2.COLOR_ROTATION[hash % import_data_table2.COLOR_ROTATION.length];
3911
3911
  };
3912
3912
  function styleFromDecorations(decorations, fields) {
3913
3913
  if (!decorations) return { version: 1 };
@@ -6590,6 +6590,14 @@ function workedOutErrorFor(document2, key) {
6590
6590
  if (said && typeof said === "object" && typeof said.says === "string") return String(said.says).trim() || null;
6591
6591
  return null;
6592
6592
  }
6593
+ function cellMarkSentence(field2, document2, value) {
6594
+ if (value === null || value === void 0) {
6595
+ const failed = workedOutErrorFor(document2, field2.key);
6596
+ if (failed) return failed;
6597
+ }
6598
+ const kept = keptAsideFor(document2, field2.key);
6599
+ return kept ? keptAsideReason(field2, kept) : null;
6600
+ }
6593
6601
  var WORKED_OUT_ERROR_WORD = "#ERROR";
6594
6602
  function WorkedOutError({ field: field2, sentence: sentence2 }) {
6595
6603
  return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
@@ -7534,6 +7542,7 @@ function GridCell({
7534
7542
  }
7535
7543
  if (wasActive.current && opensAsAList(field2, hostTakesFiles(ui))) openThisCell(event);
7536
7544
  };
7545
+ const cellMark = cellMarkSentence(field2, row.document, value);
7537
7546
  return (
7538
7547
  // BOTH MARKERS, ON PURPOSE. `data-matrx-cell-control` is the data table's
7539
7548
  // opt-out from whole-row click, so opening a cell never also opens the
@@ -7554,7 +7563,7 @@ function GridCell({
7554
7563
  {
7555
7564
  role: editable ? "button" : void 0,
7556
7565
  "aria-label": editable ? `Edit ${fieldName(field2)}` : void 0,
7557
- title: editable ? `${fieldName(field2)} \u2014 double-click or press Enter to edit` : fieldIsEditable(field2) ? (
7566
+ title: cellMark ? cellMark : editable ? `${fieldName(field2)} \u2014 double-click or press Enter to edit` : fieldIsEditable(field2) ? (
7558
7567
  // NOT A DEAD CONTROL AND NOT A SILENT ONE: the cell is plain
7559
7568
  // text, and hovering it says exactly why, in the level's own
7560
7569
  // words. The editor was never offered, so nothing is refused
@@ -12907,6 +12916,9 @@ function storedValueAgrees(field2, stored, written, options) {
12907
12916
  }
12908
12917
  return JSON.stringify(stored) === JSON.stringify(written);
12909
12918
  }
12919
+ function refusalsBeyondTheHeader(refusals, headerRowId) {
12920
+ return headerRowId === void 0 ? [...refusals] : refusals.filter((r) => r.rowId !== headerRowId);
12921
+ }
12910
12922
  function columnsTheGridTurnedAway(turnedAway, columnKeys, columnName, already) {
12911
12923
  const said = /* @__PURE__ */ new Map();
12912
12924
  for (const refused of turnedAway) {
@@ -15667,33 +15679,55 @@ function columnForField(field2, editing, mayWriteRow, whyNotRow, look, onAskWhoC
15667
15679
  ...{ title: fieldTypeLabel(field2) }
15668
15680
  };
15669
15681
  }
15670
- var TYPE_GLYPH = {
15671
- text: "Aa",
15672
- longtext: "\xB6",
15673
- number: "#",
15674
- currency: "$",
15675
- percent: "%",
15676
- date: "\u25A6",
15677
- datetime: "\u25A6",
15678
- checkbox: "\u2713",
15679
- select: "\u25BE",
15680
- multiselect: "\u25BE",
15681
- choice: "\u25BE",
15682
- relation: "\u2197",
15683
- entity_reference: "\u2197",
15684
- attachment: "\u2398",
15685
- email: "@",
15686
- url: "\u2197",
15687
- phone: "\u2706",
15688
- formula: "\u0192",
15689
- lookup: "\u0192",
15690
- rollup: "\u0192"
15682
+ var LINK2 = [["path", { d: "M7 7h10v10" }], ["path", { d: "M7 17 17 7" }]];
15683
+ var FORMULA = [["path", { d: "M18 7V5a1 1 0 0 0-1-1H6.5a.5.5 0 0 0-.4.8l4.5 6a2 2 0 0 1 0 2.4l-4.5 6a.5.5 0 0 0 .4.8H17a1 1 0 0 0 1-1v-2" }]];
15684
+ var TYPE_ICON = {
15685
+ text: [["path", { d: "M12 4v16" }], ["path", { d: "M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2" }], ["path", { d: "M9 20h6" }]],
15686
+ long_text: [["path", { d: "M21 5H3" }], ["path", { d: "M15 12H3" }], ["path", { d: "M17 19H3" }]],
15687
+ number: [["line", { x1: 4, x2: 20, y1: 9, y2: 9 }], ["line", { x1: 4, x2: 20, y1: 15, y2: 15 }], ["line", { x1: 10, x2: 8, y1: 3, y2: 21 }], ["line", { x1: 16, x2: 14, y1: 3, y2: 21 }]],
15688
+ currency: [["line", { x1: 12, x2: 12, y1: 2, y2: 22 }], ["path", { d: "M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6" }]],
15689
+ percent: [["line", { x1: 19, x2: 5, y1: 5, y2: 19 }], ["circle", { cx: 6.5, cy: 6.5, r: 2.5 }], ["circle", { cx: 17.5, cy: 17.5, r: 2.5 }]],
15690
+ datetime: [["path", { d: "M8 2v3" }], ["path", { d: "M16 2v3" }], ["rect", { x: 3, y: 3, width: 18, height: 18, rx: 2 }], ["path", { d: "M3 9h18" }]],
15691
+ checkbox: [["rect", { width: 18, height: 18, x: 3, y: 3, rx: 2 }], ["path", { d: "m16 9-5.5 5.5L8 12" }]],
15692
+ select: [["circle", { cx: 12, cy: 12, r: 10 }], ["path", { d: "m16 10-4 4-4-4" }]],
15693
+ multi_select: [["path", { d: "M3 5h.01" }], ["path", { d: "M3 12h.01" }], ["path", { d: "M3 19h.01" }], ["path", { d: "M8 5h13" }], ["path", { d: "M8 12h13" }], ["path", { d: "M8 19h13" }]],
15694
+ member: [["path", { d: "M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2" }], ["circle", { cx: 12, cy: 7, r: 4 }]],
15695
+ relation: LINK2,
15696
+ entity_reference: LINK2,
15697
+ attachment: [["path", { d: "m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551" }]],
15698
+ email: [["path", { d: "m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7" }], ["rect", { x: 2, y: 4, width: 20, height: 16, rx: 2 }]],
15699
+ url: [["path", { d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" }], ["path", { d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" }]],
15700
+ phone: [["path", { d: "M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384" }]],
15701
+ formula: FORMULA,
15702
+ lookup: FORMULA,
15703
+ rollup: FORMULA,
15704
+ json: [["path", { d: "M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1" }], ["path", { d: "M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1" }]]
15691
15705
  };
15692
15706
  function withTypeMark(field2, header) {
15693
- const kind = String(editorKindFor(field2));
15694
- const glyph = TYPE_GLYPH[kind] ?? "\xB7";
15695
- return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("span", { className: "inline-flex min-w-0 items-center gap-1", "data-records-type-mark": kind, children: [
15696
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { "aria-hidden": "true", className: "shrink-0 text-[10px] font-normal text-muted-foreground", children: glyph }),
15707
+ const kind = editorKindFor(field2);
15708
+ const parts = TYPE_ICON[kind] ?? TYPE_ICON.text;
15709
+ return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("span", { className: "inline-flex min-w-0 items-center gap-1.5", "data-records-type-mark": kind, children: [
15710
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
15711
+ "svg",
15712
+ {
15713
+ xmlns: "http://www.w3.org/2000/svg",
15714
+ viewBox: "0 0 24 24",
15715
+ width: 14,
15716
+ height: 14,
15717
+ fill: "none",
15718
+ stroke: "currentColor",
15719
+ strokeWidth: 2,
15720
+ strokeLinecap: "round",
15721
+ strokeLinejoin: "round",
15722
+ "aria-hidden": "true",
15723
+ className: "shrink-0 text-muted-foreground",
15724
+ "data-records-type-icon": kind,
15725
+ children: parts.map(([tag, attrs], i) => {
15726
+ const El = tag;
15727
+ return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(El, { ...attrs }, i);
15728
+ })
15729
+ }
15730
+ ),
15697
15731
  header
15698
15732
  ] });
15699
15733
  }
@@ -21762,7 +21796,12 @@ function GridBody({
21762
21796
  ...headed ? { header: { unmatched: headed.unmatched } } : {}
21763
21797
  });
21764
21798
  built.refusals.push(
21765
- ...columnsTheGridTurnedAway(sheetPlan.refusals, columnKeys, (id) => columnLabel(fieldList, id), built.refusals)
21799
+ ...columnsTheGridTurnedAway(
21800
+ refusalsBeyondTheHeader(sheetPlan.refusals, headed ? touched[0] : void 0),
21801
+ columnKeys,
21802
+ (id) => columnLabel(fieldList, id),
21803
+ built.refusals
21804
+ )
21766
21805
  );
21767
21806
  if (merged && built.cells > 0 && built.creates === 0 && built.refusals.length === 0 && built.pastRightEdge === 0 && (built.header?.unmatched.length ?? 0) === 0 && built.unmatchedOptions.length === 0) {
21768
21807
  const outcome = await pasteAtOnce.current(built);
@@ -22659,7 +22698,7 @@ function GridBody({
22659
22698
  ) : null,
22660
22699
  viewId && viewOrder?.onPlaced && hasSeveralRows ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_design_system58.Button, { size: "sm", variant: "ghost", onClick: () => setReordering(true), "data-records-reorder-open": "", children: "Reorder" }) : null,
22661
22700
  !readOnly && rights.structure && onAddField ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(AddFieldButton, { onClick: onAddField }) : null,
22662
- /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
22701
+ embedded ? null : /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
22663
22702
  GridLayoutMenu,
22664
22703
  {
22665
22704
  look,
@@ -22796,7 +22835,8 @@ function GridBody({
22796
22835
  phoneSheetTools,
22797
22836
  sheetExtras,
22798
22837
  tableId,
22799
- noun
22838
+ noun,
22839
+ embedded
22800
22840
  ]
22801
22841
  );
22802
22842
  const labelOfField = (0, import_react112.useCallback)(
@@ -23003,6 +23043,7 @@ function GridBody({
23003
23043
  query: tableQuery,
23004
23044
  ...valueFacets ? { facets: valueFacets, filterUi: VALUE_FILTER_UI } : {},
23005
23045
  ...classicInCard ? { hidePagination: true } : {},
23046
+ ...embedded ? { appearance: "embedded" } : {},
23006
23047
  tableClassName: (0, import_design_system58.cn)(
23007
23048
  !look.wrap && "[&_tbody_td]:max-w-[28rem] [&_tbody_td]:overflow-hidden [&_tbody_td]:text-ellipsis [&_tbody_td]:whitespace-nowrap! [&_tbody_td_*]:whitespace-nowrap!",
23008
23049
  look.fit === "scroll" && "sm:[&>table]:w-max! sm:[&>table]:max-w-none! sm:[&>table]:min-w-full!"
@@ -23327,6 +23368,13 @@ function useEntitySource(token, options = {}) {
23327
23368
  );
23328
23369
  return { ...state, write, create, reload };
23329
23370
  }
23371
+ function entityValueText(column, v) {
23372
+ if (v === null || v === void 0 || v === "") return "";
23373
+ if (typeof v === "number") return v.toLocaleString();
23374
+ if (column.type !== "date" && column.type !== "datetime" && column.type !== "timestamp") return String(v);
23375
+ const kind = column.type === "date" ? "date" : "datetime";
23376
+ return dateText({ type: "range", config: { kind }, format: null }, v) ?? String(v);
23377
+ }
23330
23378
  var NAME_KEYS = ["name", "display_name", "title", "subject"];
23331
23379
  function entityNameColumn(columns) {
23332
23380
  for (const key of NAME_KEYS) {
@@ -23342,9 +23390,7 @@ function entityTableColumns(columns) {
23342
23390
  label: c.name,
23343
23391
  accessorFn: (row) => row[c.api_name] ?? null,
23344
23392
  cell: (row) => {
23345
- const v = row[c.api_name];
23346
- if (v === null || v === void 0 || v === "") return "";
23347
- return typeof v === "number" ? v.toLocaleString() : String(v);
23393
+ return entityValueText(c, row[c.api_name]);
23348
23394
  },
23349
23395
  sortable: !c.lookup,
23350
23396
  ...c.type === "choice" && c.choices ? { filter: "select", filterOptions: c.choices.map((w) => ({ value: w, label: w })) } : {}
@@ -31396,7 +31442,7 @@ function ViewSwitcher({
31396
31442
  onMoved,
31397
31443
  onNewRecordForm,
31398
31444
  onAskWhoChanged,
31399
- pageSize = 200,
31445
+ pageSize: pageSizeAsked,
31400
31446
  titleField = null,
31401
31447
  filter,
31402
31448
  onClearFilter,
@@ -31412,6 +31458,7 @@ function ViewSwitcher({
31412
31458
  newRowLabel,
31413
31459
  className
31414
31460
  }) {
31461
+ const pageSize = pageSizeAsked ?? (embedded ? 50 : 200);
31415
31462
  const toolbarSlot = useTableToolbarSlot();
31416
31463
  const [layout, setLayout] = (0, import_react177.useState)(view.layout);
31417
31464
  const hostLayouts = useRecordsUi().layouts ?? [];
@@ -31432,7 +31479,7 @@ function ViewSwitcher({
31432
31479
  onViewChange?.(patch);
31433
31480
  };
31434
31481
  return /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)("div", { className: (0, import_design_system90.cn)("flex min-h-0 flex-col gap-2", footer === "sticky" && "flex-1", className), children: [
31435
- chooser ? /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)("div", { className: "flex items-center gap-2", children: [
31482
+ chooser && !embedded ? /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)("div", { className: "flex items-center gap-2", children: [
31436
31483
  /* @__PURE__ */ (0, import_jsx_runtime105.jsx)("span", { className: "truncate text-sm font-medium", children: view.name }),
31437
31484
  /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)("div", { className: "ml-auto flex items-center gap-0.5", role: "group", "aria-label": "Layout", children: [
31438
31485
  VIEW_LAYOUTS.map((option) => /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
@@ -45983,7 +46030,7 @@ function TablePage({
45983
46030
  tableId,
45984
46031
  presentation: pagePresentation2 = "page",
45985
46032
  newRowLabel,
45986
- pageSize = 100,
46033
+ pageSize: pageSizeAsked,
45987
46034
  seedViews,
45988
46035
  onLeave,
45989
46036
  leaveLabel = "Back to your tables",
@@ -46075,6 +46122,7 @@ function TablePage({
46075
46122
  const face = tableOpening(view, hostLayouts.map((h) => h.id));
46076
46123
  const designated = face.kind === "designated";
46077
46124
  const embedded = pagePresentation2 === "embedded";
46125
+ const pageSize = pageSizeAsked ?? (embedded ? 50 : 100);
46078
46126
  const chooserInline = !embedded && !designated && !phone && toolbarFold2 < 2;
46079
46127
  const chooserCompact = !embedded && !designated && !phone && toolbarFold2 >= 2;
46080
46128
  const controlsInSheet = phone && !designated;
@@ -47077,7 +47125,7 @@ function EntityBoard({ entity, groupBy, cardFields, onOpenRecord, className }) {
47077
47125
  "data-records-entity-card": row.id,
47078
47126
  children: [
47079
47127
  onOpenRecord ? /* @__PURE__ */ (0, import_jsx_runtime153.jsx)("button", { type: "button", className: "truncate text-left font-medium hover:underline", onClick: () => onOpenRecord(row.id), children: shown3(title ? row[title.api_name] : row.id) || "Untitled" }) : /* @__PURE__ */ (0, import_jsx_runtime153.jsx)("span", { className: "truncate font-medium", children: shown3(title ? row[title.api_name] : row.id) || "Untitled" }),
47080
- extra.map((c) => shown3(row[c.api_name]) ? /* @__PURE__ */ (0, import_jsx_runtime153.jsx)("span", { className: "truncate text-muted-foreground", children: shown3(row[c.api_name]) }, c.api_name) : null)
47128
+ extra.map((c) => entityValueText(c, row[c.api_name]) ? /* @__PURE__ */ (0, import_jsx_runtime153.jsx)("span", { className: "truncate text-muted-foreground", children: entityValueText(c, row[c.api_name]) }, c.api_name) : null)
47081
47129
  ]
47082
47130
  },
47083
47131
  row.id