@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 +12 -0
- package/dist/index.cjs +52 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +53 -10
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -20533,10 +20533,11 @@ function viewOrderOf(definition) {
|
|
|
20533
20533
|
const raw = definition?.["order"];
|
|
20534
20534
|
return raw === "manual" ? "manual" : raw === "sorted" ? "sorted" : null;
|
|
20535
20535
|
}
|
|
20536
|
+
var RETIRED_HOST_LAYOUTS = ["sheet"];
|
|
20536
20537
|
function designatedLayoutOf(definition) {
|
|
20537
20538
|
const data = definition ?? {};
|
|
20538
20539
|
const raw = typeof data["layout"] === "string" ? data["layout"].trim().toLowerCase() : "";
|
|
20539
|
-
if (raw !== "" && !VIEW_LAYOUTS.includes(raw)) return raw;
|
|
20540
|
+
if (raw !== "" && !VIEW_LAYOUTS.includes(raw) && !RETIRED_HOST_LAYOUTS.includes(raw)) return raw;
|
|
20540
20541
|
return null;
|
|
20541
20542
|
}
|
|
20542
20543
|
function tableOpening(view, hostLayoutIds) {
|
|
@@ -22872,7 +22873,8 @@ function GridBody({
|
|
|
22872
22873
|
rows: rows.length,
|
|
22873
22874
|
onPage: setPage
|
|
22874
22875
|
}
|
|
22875
|
-
)
|
|
22876
|
+
),
|
|
22877
|
+
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
22878
|
] }),
|
|
22877
22879
|
/* @__PURE__ */ jsx68(ActionConfirm, { runner, fields: fields.data ?? [], noun, nounPlural }),
|
|
22878
22880
|
assist.dialogs,
|
|
@@ -30996,7 +30998,8 @@ function ListView({
|
|
|
30996
30998
|
remembered,
|
|
30997
30999
|
note,
|
|
30998
31000
|
style,
|
|
30999
|
-
formats
|
|
31001
|
+
formats,
|
|
31002
|
+
newLabel
|
|
31000
31003
|
}) {
|
|
31001
31004
|
const groupField = grouping?.field ? fields.find((f) => f.key === grouping.field) : void 0;
|
|
31002
31005
|
const groupKey = groupField?.key ?? null;
|
|
@@ -31062,14 +31065,17 @@ function ListView({
|
|
|
31062
31065
|
)
|
|
31063
31066
|
}
|
|
31064
31067
|
) }, row.id)) }),
|
|
31065
|
-
mayAddIn ? /* @__PURE__ */
|
|
31068
|
+
mayAddIn ? /* @__PURE__ */ jsxs93(
|
|
31066
31069
|
"button",
|
|
31067
31070
|
{
|
|
31068
31071
|
type: "button",
|
|
31069
31072
|
"data-records-list-add": group.key,
|
|
31070
31073
|
className: "self-start rounded px-1 py-0.5 text-xs text-muted-foreground hover:bg-muted hover:text-foreground",
|
|
31071
31074
|
onClick: () => void add(group),
|
|
31072
|
-
children:
|
|
31075
|
+
children: [
|
|
31076
|
+
"+ ",
|
|
31077
|
+
newLabel ?? "New"
|
|
31078
|
+
]
|
|
31073
31079
|
}
|
|
31074
31080
|
) : null
|
|
31075
31081
|
] }, group.key)) }),
|
|
@@ -31371,7 +31377,8 @@ function ViewSwitcher({
|
|
|
31371
31377
|
remembered: Boolean(onViewChange),
|
|
31372
31378
|
...onOpenRecord ? { onOpenRecord } : {},
|
|
31373
31379
|
...onMoved ? { onMoved } : {},
|
|
31374
|
-
canCreate: Boolean(onNewRecordForm)
|
|
31380
|
+
canCreate: Boolean(onNewRecordForm),
|
|
31381
|
+
...embedded && newRowLabel ? { newRowLabel } : {}
|
|
31375
31382
|
}
|
|
31376
31383
|
)
|
|
31377
31384
|
] });
|
|
@@ -31454,7 +31461,8 @@ function Board({
|
|
|
31454
31461
|
onMoved,
|
|
31455
31462
|
viewId,
|
|
31456
31463
|
onClearFilter,
|
|
31457
|
-
canCreate = false
|
|
31464
|
+
canCreate = false,
|
|
31465
|
+
newRowLabel
|
|
31458
31466
|
}) {
|
|
31459
31467
|
const fields = useFields18(view.subject);
|
|
31460
31468
|
const records = useViewRecords(view, pageSize, filter, viewId ?? null);
|
|
@@ -31698,6 +31706,7 @@ function Board({
|
|
|
31698
31706
|
onChanged: () => records.reload(),
|
|
31699
31707
|
...onMoved ? { onMoved } : {},
|
|
31700
31708
|
canAdd: mayAdd,
|
|
31709
|
+
...newRowLabel ? { newLabel: newRowLabel } : {},
|
|
31701
31710
|
remembered,
|
|
31702
31711
|
note: records.membership,
|
|
31703
31712
|
style,
|
|
@@ -31720,6 +31729,7 @@ function Board({
|
|
|
31720
31729
|
Gallery,
|
|
31721
31730
|
{
|
|
31722
31731
|
...addCard ? { onNew: () => void addCard() } : {},
|
|
31732
|
+
...newRowLabel ? { newLabel: newRowLabel } : {},
|
|
31723
31733
|
tableId: view.subject,
|
|
31724
31734
|
titleKey,
|
|
31725
31735
|
onChanged: () => {
|
|
@@ -32048,7 +32058,8 @@ function Gallery({
|
|
|
32048
32058
|
onSizeChange,
|
|
32049
32059
|
onHiddenFieldsChange,
|
|
32050
32060
|
remembered,
|
|
32051
|
-
onNew
|
|
32061
|
+
onNew,
|
|
32062
|
+
newLabel
|
|
32052
32063
|
}) {
|
|
32053
32064
|
const hidden = useMemo53(() => new Set(hiddenFields ?? []), [hiddenFields]);
|
|
32054
32065
|
const imageField = imageKey ? fields.find((field2) => field2.key === imageKey) : void 0;
|
|
@@ -32112,14 +32123,17 @@ function Gallery({
|
|
|
32112
32123
|
}
|
|
32113
32124
|
) }, row.id);
|
|
32114
32125
|
}),
|
|
32115
|
-
onNew ? /* @__PURE__ */ jsx105("li", { children: /* @__PURE__ */
|
|
32126
|
+
onNew ? /* @__PURE__ */ jsx105("li", { children: /* @__PURE__ */ jsxs94(
|
|
32116
32127
|
"button",
|
|
32117
32128
|
{
|
|
32118
32129
|
type: "button",
|
|
32119
32130
|
"data-records-gallery-add": "",
|
|
32120
32131
|
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
32132
|
onClick: onNew,
|
|
32122
|
-
children:
|
|
32133
|
+
children: [
|
|
32134
|
+
"+ ",
|
|
32135
|
+
newLabel ?? "New"
|
|
32136
|
+
]
|
|
32123
32137
|
}
|
|
32124
32138
|
) }) : null
|
|
32125
32139
|
]
|
|
@@ -44993,6 +45007,7 @@ import { useCallback as useCallback67, useEffect as useEffect109, useMemo as use
|
|
|
44993
45007
|
import { archivedByLine as archivedByLine2 } from "@ai-matrx/records";
|
|
44994
45008
|
import { useFields as useFields36, useRecordsClient as useRecordsClient95, useTable as useTable35 } from "@ai-matrx/records/react";
|
|
44995
45009
|
import {
|
|
45010
|
+
Badge as Badge25,
|
|
44996
45011
|
BottomSheet,
|
|
44997
45012
|
Button as Button105,
|
|
44998
45013
|
DropdownMenu as DropdownMenu10,
|
|
@@ -45991,6 +46006,7 @@ function TablePage({
|
|
|
45991
46006
|
const viewLabels = useRecordLabels(allFields.data ?? void 0);
|
|
45992
46007
|
const askedInWords = filter ? filterInWords(filter, pageFields.data ?? []) : null;
|
|
45993
46008
|
const organizationId = useRecordsClient95().config.organizationId;
|
|
46009
|
+
const publicReadOnly = usePublicReadOnly(client, organizationId, tableId, table.data, rights);
|
|
45994
46010
|
const [view, setView] = useState131(null);
|
|
45995
46011
|
const [looks, setLooks] = useState131(void 0);
|
|
45996
46012
|
useEffect109(() => {
|
|
@@ -46460,6 +46476,7 @@ function TablePage({
|
|
|
46460
46476
|
}, [recordsUi]);
|
|
46461
46477
|
const openedFromMenu = openedEntry ? { ...openedEntry, label: actions.find((a) => a.id === openedEntry.id)?.label ?? openedEntry.key } : null;
|
|
46462
46478
|
const pageActions = /* @__PURE__ */ jsxs140(Fragment61, { children: [
|
|
46479
|
+
publicReadOnly ? /* @__PURE__ */ jsx152(Badge25, { variant: "neutral", className: "shrink-0", "data-public-read-only": "", children: PUBLIC_READ_ONLY }, "public-read-only") : null,
|
|
46463
46480
|
!phone && rights.read && table.data ? /* @__PURE__ */ jsx152(
|
|
46464
46481
|
TableAsk,
|
|
46465
46482
|
{
|
|
@@ -46978,6 +46995,32 @@ function TablePage({
|
|
|
46978
46995
|
] })
|
|
46979
46996
|
] }) });
|
|
46980
46997
|
}
|
|
46998
|
+
var PUBLIC_READ_ONLY = "Public \xB7 read only";
|
|
46999
|
+
function usePublicReadOnly(client, organizationId, tableId, table, rights) {
|
|
47000
|
+
const readOnly = rights.known && rights.read && !rights.write;
|
|
47001
|
+
const marked = table?.published_to_web;
|
|
47002
|
+
const [isPublic, setIsPublic] = useState131(false);
|
|
47003
|
+
useEffect109(() => {
|
|
47004
|
+
if (!readOnly || !table) {
|
|
47005
|
+
setIsPublic(false);
|
|
47006
|
+
return;
|
|
47007
|
+
}
|
|
47008
|
+
if (marked !== void 0) {
|
|
47009
|
+
setIsPublic(Boolean(marked));
|
|
47010
|
+
return;
|
|
47011
|
+
}
|
|
47012
|
+
let live = true;
|
|
47013
|
+
void client.tableFacts(organizationId ? { organization_id: organizationId } : {}).then((answered) => {
|
|
47014
|
+
if (!live) return;
|
|
47015
|
+
const fact = answered.ok ? (answered.data ?? []).find((f) => f.table_id === tableId) : void 0;
|
|
47016
|
+
setIsPublic(Boolean(fact && (fact.published_to_web ?? fact.visibility === "public")));
|
|
47017
|
+
});
|
|
47018
|
+
return () => {
|
|
47019
|
+
live = false;
|
|
47020
|
+
};
|
|
47021
|
+
}, [client, organizationId, tableId, readOnly, marked, table]);
|
|
47022
|
+
return readOnly && isPublic;
|
|
47023
|
+
}
|
|
46981
47024
|
|
|
46982
47025
|
// src/entityViews.tsx
|
|
46983
47026
|
import { useEffect as useEffect110, useMemo as useMemo75, useState as useState132 } from "react";
|