@ai-matrx/records-ui 0.101.25 → 0.101.26

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,11 @@
1
1
  # Changelog — @ai-matrx/records-ui
2
2
 
3
+ ## 0.101.26
4
+
5
+ Automatic changed-only republish (docs/metadata drift since the last tag — see
6
+ `git diff npm/records-ui/v0.101.25..npm/records-ui/v0.101.26 -- apps/shared/records-ui`).
7
+ No source changes intended and no consumer action required.
8
+
3
9
  ## 0.101.24
4
10
 
5
11
  Automatic changed-only republish (docs/metadata drift since the last tag — see
package/dist/index.cjs CHANGED
@@ -46059,6 +46059,7 @@ function TablePage({
46059
46059
  const viewLabels = useRecordLabels(allFields.data ?? void 0);
46060
46060
  const askedInWords = filter ? filterInWords(filter, pageFields.data ?? []) : null;
46061
46061
  const organizationId = (0, import_react265.useRecordsClient)().config.organizationId;
46062
+ const publicReadOnly = usePublicReadOnly(client, organizationId, tableId, table.data, rights);
46062
46063
  const [view, setView] = (0, import_react264.useState)(null);
46063
46064
  const [looks, setLooks] = (0, import_react264.useState)(void 0);
46064
46065
  (0, import_react264.useEffect)(() => {
@@ -46528,6 +46529,7 @@ function TablePage({
46528
46529
  }, [recordsUi]);
46529
46530
  const openedFromMenu = openedEntry ? { ...openedEntry, label: actions.find((a) => a.id === openedEntry.id)?.label ?? openedEntry.key } : null;
46530
46531
  const pageActions = /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)(import_jsx_runtime152.Fragment, { children: [
46532
+ 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
46533
  !phone && rights.read && table.data ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
46532
46534
  TableAsk,
46533
46535
  {
@@ -47046,6 +47048,32 @@ function TablePage({
47046
47048
  ] })
47047
47049
  ] }) });
47048
47050
  }
47051
+ var PUBLIC_READ_ONLY = "Public \xB7 read only";
47052
+ function usePublicReadOnly(client, organizationId, tableId, table, rights) {
47053
+ const readOnly = rights.known && rights.read && !rights.write;
47054
+ const marked = table?.published_to_web;
47055
+ const [isPublic, setIsPublic] = (0, import_react264.useState)(false);
47056
+ (0, import_react264.useEffect)(() => {
47057
+ if (!readOnly || !table) {
47058
+ setIsPublic(false);
47059
+ return;
47060
+ }
47061
+ if (marked !== void 0) {
47062
+ setIsPublic(Boolean(marked));
47063
+ return;
47064
+ }
47065
+ let live = true;
47066
+ void client.tableFacts(organizationId ? { organization_id: organizationId } : {}).then((answered) => {
47067
+ if (!live) return;
47068
+ const fact = answered.ok ? (answered.data ?? []).find((f) => f.table_id === tableId) : void 0;
47069
+ setIsPublic(Boolean(fact && (fact.published_to_web ?? fact.visibility === "public")));
47070
+ });
47071
+ return () => {
47072
+ live = false;
47073
+ };
47074
+ }, [client, organizationId, tableId, readOnly, marked, table]);
47075
+ return readOnly && isPublic;
47076
+ }
47049
47077
 
47050
47078
  // src/entityViews.tsx
47051
47079
  var import_react266 = require("react");