@ai-matrx/records-ui 0.101.25 → 0.101.27

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.27
4
+
5
+ Automatic changed-only republish (docs/metadata drift since the last tag — see
6
+ `git diff npm/records-ui/v0.101.26..npm/records-ui/v0.101.27 -- apps/shared/records-ui`).
7
+ No source changes intended and no consumer action required.
8
+
9
+ ## 0.101.26
10
+
11
+ Automatic changed-only republish (docs/metadata drift since the last tag — see
12
+ `git diff npm/records-ui/v0.101.25..npm/records-ui/v0.101.26 -- apps/shared/records-ui`).
13
+ No source changes intended and no consumer action required.
14
+
3
15
  ## 0.101.24
4
16
 
5
17
  Automatic changed-only republish (docs/metadata drift since the last tag — see
package/dist/index.cjs CHANGED
@@ -20815,10 +20815,11 @@ function viewOrderOf(definition) {
20815
20815
  const raw = definition?.["order"];
20816
20816
  return raw === "manual" ? "manual" : raw === "sorted" ? "sorted" : null;
20817
20817
  }
20818
+ var RETIRED_HOST_LAYOUTS = ["sheet"];
20818
20819
  function designatedLayoutOf(definition) {
20819
20820
  const data = definition ?? {};
20820
20821
  const raw = typeof data["layout"] === "string" ? data["layout"].trim().toLowerCase() : "";
20821
- if (raw !== "" && !VIEW_LAYOUTS.includes(raw)) return raw;
20822
+ if (raw !== "" && !VIEW_LAYOUTS.includes(raw) && !RETIRED_HOST_LAYOUTS.includes(raw)) return raw;
20822
20823
  return null;
20823
20824
  }
20824
20825
  function tableOpening(view, hostLayoutIds) {
@@ -23154,7 +23155,8 @@ function GridBody({
23154
23155
  rows: rows.length,
23155
23156
  onPage: setPage
23156
23157
  }
23157
- )
23158
+ ),
23159
+ embedded && !merged && !readOnly && rights.write ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: "px-2 py-1.5", children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(AddRowLine, { onAdd: () => void addRecord(), busy: editingBusy, label: newRowLabel ?? "Add row" }) }) : null
23158
23160
  ] }),
23159
23161
  /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(ActionConfirm, { runner, fields: fields.data ?? [], noun, nounPlural }),
23160
23162
  assist.dialogs,
@@ -31187,7 +31189,8 @@ function ListView({
31187
31189
  remembered,
31188
31190
  note,
31189
31191
  style,
31190
- formats
31192
+ formats,
31193
+ newLabel
31191
31194
  }) {
31192
31195
  const groupField = grouping?.field ? fields.find((f) => f.key === grouping.field) : void 0;
31193
31196
  const groupKey = groupField?.key ?? null;
@@ -31253,14 +31256,17 @@ function ListView({
31253
31256
  )
31254
31257
  }
31255
31258
  ) }, row.id)) }),
31256
- mayAddIn ? /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
31259
+ mayAddIn ? /* @__PURE__ */ (0, import_jsx_runtime104.jsxs)(
31257
31260
  "button",
31258
31261
  {
31259
31262
  type: "button",
31260
31263
  "data-records-list-add": group.key,
31261
31264
  className: "self-start rounded px-1 py-0.5 text-xs text-muted-foreground hover:bg-muted hover:text-foreground",
31262
31265
  onClick: () => void add(group),
31263
- children: "+ New"
31266
+ children: [
31267
+ "+ ",
31268
+ newLabel ?? "New"
31269
+ ]
31264
31270
  }
31265
31271
  ) : null
31266
31272
  ] }, group.key)) }),
@@ -31562,7 +31568,8 @@ function ViewSwitcher({
31562
31568
  remembered: Boolean(onViewChange),
31563
31569
  ...onOpenRecord ? { onOpenRecord } : {},
31564
31570
  ...onMoved ? { onMoved } : {},
31565
- canCreate: Boolean(onNewRecordForm)
31571
+ canCreate: Boolean(onNewRecordForm),
31572
+ ...embedded && newRowLabel ? { newRowLabel } : {}
31566
31573
  }
31567
31574
  )
31568
31575
  ] });
@@ -31645,7 +31652,8 @@ function Board({
31645
31652
  onMoved,
31646
31653
  viewId,
31647
31654
  onClearFilter,
31648
- canCreate = false
31655
+ canCreate = false,
31656
+ newRowLabel
31649
31657
  }) {
31650
31658
  const fields = (0, import_react178.useFields)(view.subject);
31651
31659
  const records = useViewRecords(view, pageSize, filter, viewId ?? null);
@@ -31889,6 +31897,7 @@ function Board({
31889
31897
  onChanged: () => records.reload(),
31890
31898
  ...onMoved ? { onMoved } : {},
31891
31899
  canAdd: mayAdd,
31900
+ ...newRowLabel ? { newLabel: newRowLabel } : {},
31892
31901
  remembered,
31893
31902
  note: records.membership,
31894
31903
  style,
@@ -31911,6 +31920,7 @@ function Board({
31911
31920
  Gallery,
31912
31921
  {
31913
31922
  ...addCard ? { onNew: () => void addCard() } : {},
31923
+ ...newRowLabel ? { newLabel: newRowLabel } : {},
31914
31924
  tableId: view.subject,
31915
31925
  titleKey,
31916
31926
  onChanged: () => {
@@ -32239,7 +32249,8 @@ function Gallery({
32239
32249
  onSizeChange,
32240
32250
  onHiddenFieldsChange,
32241
32251
  remembered,
32242
- onNew
32252
+ onNew,
32253
+ newLabel
32243
32254
  }) {
32244
32255
  const hidden = (0, import_react177.useMemo)(() => new Set(hiddenFields ?? []), [hiddenFields]);
32245
32256
  const imageField = imageKey ? fields.find((field2) => field2.key === imageKey) : void 0;
@@ -32303,14 +32314,17 @@ function Gallery({
32303
32314
  }
32304
32315
  ) }, row.id);
32305
32316
  }),
32306
- onNew ? /* @__PURE__ */ (0, import_jsx_runtime105.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
32317
+ onNew ? /* @__PURE__ */ (0, import_jsx_runtime105.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)(
32307
32318
  "button",
32308
32319
  {
32309
32320
  type: "button",
32310
32321
  "data-records-gallery-add": "",
32311
32322
  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",
32312
32323
  onClick: onNew,
32313
- children: "+ New"
32324
+ children: [
32325
+ "+ ",
32326
+ newLabel ?? "New"
32327
+ ]
32314
32328
  }
32315
32329
  ) }) : null
32316
32330
  ]
@@ -46059,6 +46073,7 @@ function TablePage({
46059
46073
  const viewLabels = useRecordLabels(allFields.data ?? void 0);
46060
46074
  const askedInWords = filter ? filterInWords(filter, pageFields.data ?? []) : null;
46061
46075
  const organizationId = (0, import_react265.useRecordsClient)().config.organizationId;
46076
+ const publicReadOnly = usePublicReadOnly(client, organizationId, tableId, table.data, rights);
46062
46077
  const [view, setView] = (0, import_react264.useState)(null);
46063
46078
  const [looks, setLooks] = (0, import_react264.useState)(void 0);
46064
46079
  (0, import_react264.useEffect)(() => {
@@ -46528,6 +46543,7 @@ function TablePage({
46528
46543
  }, [recordsUi]);
46529
46544
  const openedFromMenu = openedEntry ? { ...openedEntry, label: actions.find((a) => a.id === openedEntry.id)?.label ?? openedEntry.key } : null;
46530
46545
  const pageActions = /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)(import_jsx_runtime152.Fragment, { children: [
46546
+ publicReadOnly ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(import_design_system137.Badge, { variant: "neutral", className: "shrink-0", "data-public-read-only": "", children: PUBLIC_READ_ONLY }, "public-read-only") : null,
46531
46547
  !phone && rights.read && table.data ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
46532
46548
  TableAsk,
46533
46549
  {
@@ -47046,6 +47062,32 @@ function TablePage({
47046
47062
  ] })
47047
47063
  ] }) });
47048
47064
  }
47065
+ var PUBLIC_READ_ONLY = "Public \xB7 read only";
47066
+ function usePublicReadOnly(client, organizationId, tableId, table, rights) {
47067
+ const readOnly = rights.known && rights.read && !rights.write;
47068
+ const marked = table?.published_to_web;
47069
+ const [isPublic, setIsPublic] = (0, import_react264.useState)(false);
47070
+ (0, import_react264.useEffect)(() => {
47071
+ if (!readOnly || !table) {
47072
+ setIsPublic(false);
47073
+ return;
47074
+ }
47075
+ if (marked !== void 0) {
47076
+ setIsPublic(Boolean(marked));
47077
+ return;
47078
+ }
47079
+ let live = true;
47080
+ void client.tableFacts(organizationId ? { organization_id: organizationId } : {}).then((answered) => {
47081
+ if (!live) return;
47082
+ const fact = answered.ok ? (answered.data ?? []).find((f) => f.table_id === tableId) : void 0;
47083
+ setIsPublic(Boolean(fact && (fact.published_to_web ?? fact.visibility === "public")));
47084
+ });
47085
+ return () => {
47086
+ live = false;
47087
+ };
47088
+ }, [client, organizationId, tableId, readOnly, marked, table]);
47089
+ return readOnly && isPublic;
47090
+ }
47049
47091
 
47050
47092
  // src/entityViews.tsx
47051
47093
  var import_react266 = require("react");