@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 +6 -0
- package/dist/index.cjs +28 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +29 -0
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -44993,6 +44993,7 @@ import { useCallback as useCallback67, useEffect as useEffect109, useMemo as use
|
|
|
44993
44993
|
import { archivedByLine as archivedByLine2 } from "@ai-matrx/records";
|
|
44994
44994
|
import { useFields as useFields36, useRecordsClient as useRecordsClient95, useTable as useTable35 } from "@ai-matrx/records/react";
|
|
44995
44995
|
import {
|
|
44996
|
+
Badge as Badge25,
|
|
44996
44997
|
BottomSheet,
|
|
44997
44998
|
Button as Button105,
|
|
44998
44999
|
DropdownMenu as DropdownMenu10,
|
|
@@ -45991,6 +45992,7 @@ function TablePage({
|
|
|
45991
45992
|
const viewLabels = useRecordLabels(allFields.data ?? void 0);
|
|
45992
45993
|
const askedInWords = filter ? filterInWords(filter, pageFields.data ?? []) : null;
|
|
45993
45994
|
const organizationId = useRecordsClient95().config.organizationId;
|
|
45995
|
+
const publicReadOnly = usePublicReadOnly(client, organizationId, tableId, table.data, rights);
|
|
45994
45996
|
const [view, setView] = useState131(null);
|
|
45995
45997
|
const [looks, setLooks] = useState131(void 0);
|
|
45996
45998
|
useEffect109(() => {
|
|
@@ -46460,6 +46462,7 @@ function TablePage({
|
|
|
46460
46462
|
}, [recordsUi]);
|
|
46461
46463
|
const openedFromMenu = openedEntry ? { ...openedEntry, label: actions.find((a) => a.id === openedEntry.id)?.label ?? openedEntry.key } : null;
|
|
46462
46464
|
const pageActions = /* @__PURE__ */ jsxs140(Fragment61, { children: [
|
|
46465
|
+
publicReadOnly ? /* @__PURE__ */ jsx152(Badge25, { variant: "neutral", className: "shrink-0", "data-public-read-only": "", children: PUBLIC_READ_ONLY }, "public-read-only") : null,
|
|
46463
46466
|
!phone && rights.read && table.data ? /* @__PURE__ */ jsx152(
|
|
46464
46467
|
TableAsk,
|
|
46465
46468
|
{
|
|
@@ -46978,6 +46981,32 @@ function TablePage({
|
|
|
46978
46981
|
] })
|
|
46979
46982
|
] }) });
|
|
46980
46983
|
}
|
|
46984
|
+
var PUBLIC_READ_ONLY = "Public \xB7 read only";
|
|
46985
|
+
function usePublicReadOnly(client, organizationId, tableId, table, rights) {
|
|
46986
|
+
const readOnly = rights.known && rights.read && !rights.write;
|
|
46987
|
+
const marked = table?.published_to_web;
|
|
46988
|
+
const [isPublic, setIsPublic] = useState131(false);
|
|
46989
|
+
useEffect109(() => {
|
|
46990
|
+
if (!readOnly || !table) {
|
|
46991
|
+
setIsPublic(false);
|
|
46992
|
+
return;
|
|
46993
|
+
}
|
|
46994
|
+
if (marked !== void 0) {
|
|
46995
|
+
setIsPublic(Boolean(marked));
|
|
46996
|
+
return;
|
|
46997
|
+
}
|
|
46998
|
+
let live = true;
|
|
46999
|
+
void client.tableFacts(organizationId ? { organization_id: organizationId } : {}).then((answered) => {
|
|
47000
|
+
if (!live) return;
|
|
47001
|
+
const fact = answered.ok ? (answered.data ?? []).find((f) => f.table_id === tableId) : void 0;
|
|
47002
|
+
setIsPublic(Boolean(fact && (fact.published_to_web ?? fact.visibility === "public")));
|
|
47003
|
+
});
|
|
47004
|
+
return () => {
|
|
47005
|
+
live = false;
|
|
47006
|
+
};
|
|
47007
|
+
}, [client, organizationId, tableId, readOnly, marked, table]);
|
|
47008
|
+
return readOnly && isPublic;
|
|
47009
|
+
}
|
|
46981
47010
|
|
|
46982
47011
|
// src/entityViews.tsx
|
|
46983
47012
|
import { useEffect as useEffect110, useMemo as useMemo75, useState as useState132 } from "react";
|