@ai-matrx/records-ui 0.101.26 → 0.101.28

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
@@ -13382,6 +13382,14 @@ function asField(f) {
13382
13382
  relation_target: f.relation_target ?? null
13383
13383
  };
13384
13384
  }
13385
+ function CustomValue({ field: field2, value }) {
13386
+ const choice = isChoiceField(field2);
13387
+ const index = useChoiceOptions(choice ? [field2] : [], choice ? [field2.key] : []);
13388
+ const options = index.get(field2.key);
13389
+ if (!choice || !options) return renderValue(field2, value);
13390
+ const worded = (v) => optionFor(options, v)?.label ?? v;
13391
+ return renderValue(field2, Array.isArray(value) ? value.map(worded) : worded(value));
13392
+ }
13385
13393
  function CustomFieldsSection({
13386
13394
  entityToken,
13387
13395
  recordId,
@@ -13701,7 +13709,7 @@ function CustomFieldsSection({
13701
13709
  setCellValue(values[f.key]);
13702
13710
  setCellKey(f.key);
13703
13711
  },
13704
- children: isEmptyValue(values[f.key]) ? /* @__PURE__ */ jsx47("span", { className: "text-muted-foreground", children: "\u2014" }) : renderValue(asField(f), values[f.key])
13712
+ children: isEmptyValue(values[f.key]) ? /* @__PURE__ */ jsx47("span", { className: "text-muted-foreground", children: "\u2014" }) : /* @__PURE__ */ jsx47(CustomValue, { field: asField(f), value: values[f.key] })
13705
13713
  }
13706
13714
  ) })
13707
13715
  ] }, f.id)) })
@@ -20533,10 +20541,11 @@ function viewOrderOf(definition) {
20533
20541
  const raw = definition?.["order"];
20534
20542
  return raw === "manual" ? "manual" : raw === "sorted" ? "sorted" : null;
20535
20543
  }
20544
+ var RETIRED_HOST_LAYOUTS = ["sheet"];
20536
20545
  function designatedLayoutOf(definition) {
20537
20546
  const data = definition ?? {};
20538
20547
  const raw = typeof data["layout"] === "string" ? data["layout"].trim().toLowerCase() : "";
20539
- if (raw !== "" && !VIEW_LAYOUTS.includes(raw)) return raw;
20548
+ if (raw !== "" && !VIEW_LAYOUTS.includes(raw) && !RETIRED_HOST_LAYOUTS.includes(raw)) return raw;
20540
20549
  return null;
20541
20550
  }
20542
20551
  function tableOpening(view, hostLayoutIds) {
@@ -22872,7 +22881,8 @@ function GridBody({
22872
22881
  rows: rows.length,
22873
22882
  onPage: setPage
22874
22883
  }
22875
- )
22884
+ ),
22885
+ embedded && !merged && !readOnly && rights.write ? /* @__PURE__ */ jsx68("div", { className: "px-2 py-1.5", children: /* @__PURE__ */ jsx68(AddRowLine, { onAdd: () => void addRecord(), busy: editingBusy, label: newRowLabel ?? "Add row" }) }) : null
22876
22886
  ] }),
22877
22887
  /* @__PURE__ */ jsx68(ActionConfirm, { runner, fields: fields.data ?? [], noun, nounPlural }),
22878
22888
  assist.dialogs,
@@ -30996,7 +31006,8 @@ function ListView({
30996
31006
  remembered,
30997
31007
  note,
30998
31008
  style,
30999
- formats
31009
+ formats,
31010
+ newLabel
31000
31011
  }) {
31001
31012
  const groupField = grouping?.field ? fields.find((f) => f.key === grouping.field) : void 0;
31002
31013
  const groupKey = groupField?.key ?? null;
@@ -31062,14 +31073,17 @@ function ListView({
31062
31073
  )
31063
31074
  }
31064
31075
  ) }, row.id)) }),
31065
- mayAddIn ? /* @__PURE__ */ jsx104(
31076
+ mayAddIn ? /* @__PURE__ */ jsxs93(
31066
31077
  "button",
31067
31078
  {
31068
31079
  type: "button",
31069
31080
  "data-records-list-add": group.key,
31070
31081
  className: "self-start rounded px-1 py-0.5 text-xs text-muted-foreground hover:bg-muted hover:text-foreground",
31071
31082
  onClick: () => void add(group),
31072
- children: "+ New"
31083
+ children: [
31084
+ "+ ",
31085
+ newLabel ?? "New"
31086
+ ]
31073
31087
  }
31074
31088
  ) : null
31075
31089
  ] }, group.key)) }),
@@ -31371,7 +31385,8 @@ function ViewSwitcher({
31371
31385
  remembered: Boolean(onViewChange),
31372
31386
  ...onOpenRecord ? { onOpenRecord } : {},
31373
31387
  ...onMoved ? { onMoved } : {},
31374
- canCreate: Boolean(onNewRecordForm)
31388
+ canCreate: Boolean(onNewRecordForm),
31389
+ ...embedded && newRowLabel ? { newRowLabel } : {}
31375
31390
  }
31376
31391
  )
31377
31392
  ] });
@@ -31454,7 +31469,8 @@ function Board({
31454
31469
  onMoved,
31455
31470
  viewId,
31456
31471
  onClearFilter,
31457
- canCreate = false
31472
+ canCreate = false,
31473
+ newRowLabel
31458
31474
  }) {
31459
31475
  const fields = useFields18(view.subject);
31460
31476
  const records = useViewRecords(view, pageSize, filter, viewId ?? null);
@@ -31698,6 +31714,7 @@ function Board({
31698
31714
  onChanged: () => records.reload(),
31699
31715
  ...onMoved ? { onMoved } : {},
31700
31716
  canAdd: mayAdd,
31717
+ ...newRowLabel ? { newLabel: newRowLabel } : {},
31701
31718
  remembered,
31702
31719
  note: records.membership,
31703
31720
  style,
@@ -31720,6 +31737,7 @@ function Board({
31720
31737
  Gallery,
31721
31738
  {
31722
31739
  ...addCard ? { onNew: () => void addCard() } : {},
31740
+ ...newRowLabel ? { newLabel: newRowLabel } : {},
31723
31741
  tableId: view.subject,
31724
31742
  titleKey,
31725
31743
  onChanged: () => {
@@ -32048,7 +32066,8 @@ function Gallery({
32048
32066
  onSizeChange,
32049
32067
  onHiddenFieldsChange,
32050
32068
  remembered,
32051
- onNew
32069
+ onNew,
32070
+ newLabel
32052
32071
  }) {
32053
32072
  const hidden = useMemo53(() => new Set(hiddenFields ?? []), [hiddenFields]);
32054
32073
  const imageField = imageKey ? fields.find((field2) => field2.key === imageKey) : void 0;
@@ -32112,14 +32131,17 @@ function Gallery({
32112
32131
  }
32113
32132
  ) }, row.id);
32114
32133
  }),
32115
- onNew ? /* @__PURE__ */ jsx105("li", { children: /* @__PURE__ */ jsx105(
32134
+ onNew ? /* @__PURE__ */ jsx105("li", { children: /* @__PURE__ */ jsxs94(
32116
32135
  "button",
32117
32136
  {
32118
32137
  type: "button",
32119
32138
  "data-records-gallery-add": "",
32120
32139
  className: "flex h-full min-h-16 w-full items-center justify-center rounded border border-dashed p-2 text-xs text-muted-foreground hover:bg-muted hover:text-foreground",
32121
32140
  onClick: onNew,
32122
- children: "+ New"
32141
+ children: [
32142
+ "+ ",
32143
+ newLabel ?? "New"
32144
+ ]
32123
32145
  }
32124
32146
  ) }) : null
32125
32147
  ]