@nivaro/react 0.3.34 → 0.3.36
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/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +5 -4
- package/dist/shared/components/ItemEditForm.js +2009 -1996
- package/dist/shared/components/RecordReadView.js +88 -85
- package/dist/shared/components/item-edit/FieldAffordances.js +351 -307
- package/dist/shared/components/item-edit/FieldRow.js +453 -447
- package/dist/shared/components/item-edit/PersonalDefaultControl.js +228 -0
- package/dist/shared/components/item-edit/PersonalDefaultPill.js +9 -39
- package/dist/shared/components/item-edit/RecordLiveSync.js +115 -110
- package/dist/shared/components/item-edit/entry/useEntryKeyboard.js +27 -27
- package/dist/shared/components/item-edit/live-record-marks.js +13 -0
- package/dist/shared/components/item-edit/usePersonalDefaults.js +314 -230
- package/dist/shared/components/layout-editor/DesignNode.js +79 -78
- package/dist/shared/components/layout-editor/EditorCanvas.js +25 -17
- package/dist/shared/components/layout-editor/EditorTopBar.js +230 -188
- package/dist/shared/components/layout-editor/LayoutEditor.js +370 -369
- package/dist/shared/components/layout-editor/dnd/LayoutDndProvider.js +218 -182
- package/dist/shared/components/layout-editor/dnd/TrashZone.js +68 -0
- package/dist/shared/components/layout-editor/dnd/rail-drop.js +4 -4
- package/dist/shared/components/layout-editor/dnd/trash-drop.js +52 -0
- package/dist/shared/components/layout-editor/inspector/kit.js +1 -1
- package/dist/shared/components/layout-editor/panel-frame.js +1 -1
- package/dist/shared/components/layout-editor/personal-default-marks.js +40 -0
- package/dist/shared/components/layout-editor/preview/PreviewPanes.js +2 -2
- package/package.json +1 -1
|
@@ -1,30 +1,31 @@
|
|
|
1
1
|
import { jsx as r, jsxs as m, Fragment as ge } from "react/jsx-runtime";
|
|
2
|
-
import { useQuery as V, useQueryClient as
|
|
3
|
-
import { Pencil as
|
|
4
|
-
import { useMemo as be, useRef as
|
|
5
|
-
import { DrilldownContext as
|
|
6
|
-
import { useDebounced as
|
|
7
|
-
import { parseAllowedCollections as
|
|
2
|
+
import { useQuery as V, useQueryClient as Ct } from "@tanstack/react-query";
|
|
3
|
+
import { Pencil as Dt, ChevronDown as Lt } from "lucide-react";
|
|
4
|
+
import { useMemo as be, useRef as Et, useState as ee, useEffect as ye, useCallback as ct, Fragment as Pt } from "react";
|
|
5
|
+
import { DrilldownContext as Kt, useNivaroClient as Oe, useApiFetchConfig as jt, useDrilldown as pt } from "../context.js";
|
|
6
|
+
import { useDebounced as It } from "../hooks/useDebounced.js";
|
|
7
|
+
import { parseAllowedCollections as Wt } from "../lib/allowed-collections.js";
|
|
8
8
|
import { get as G } from "../lib/commands.js";
|
|
9
|
-
import { readGroupStructure as
|
|
10
|
-
import { useLiveRecord as
|
|
11
|
-
import { isDisplayFormulaField as qe, resolvePlacementText as
|
|
12
|
-
import { useRecordReader as
|
|
13
|
-
import { sanitizeHtml as
|
|
9
|
+
import { readGroupStructure as Mt, isFolded as Vt, isEmptyValue as je, planFieldGrid as Ut } from "../lib/form-structure.js";
|
|
10
|
+
import { useLiveRecord as Bt } from "../lib/live.js";
|
|
11
|
+
import { isDisplayFormulaField as qe, resolvePlacementText as Gt, displayFormulaOf as Jt, formatDisplayValue as Ht } from "../lib/placement-behaviour.js";
|
|
12
|
+
import { useRecordReader as Qt } from "../lib/record-loader.js";
|
|
13
|
+
import { sanitizeHtml as zt } from "../lib/sanitize-html.js";
|
|
14
14
|
import { titleCase as Qe, formatRelative as Te } from "../lib/utils.js";
|
|
15
|
-
import { matchesVisibleWhen as
|
|
16
|
-
import { InboundRequestPopover as
|
|
17
|
-
import { FileM2MField as
|
|
18
|
-
import { useFieldTouches as
|
|
19
|
-
import { richTextToPlain as
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
15
|
+
import { matchesVisibleWhen as Yt } from "../lib/visible-when.js";
|
|
16
|
+
import { InboundRequestPopover as Xt } from "./integrations/InboundRequest.js";
|
|
17
|
+
import { FileM2MField as Zt } from "./item-edit/FilePickerField.js";
|
|
18
|
+
import { useFieldTouches as el } from "./item-edit/HeaderFreshness.js";
|
|
19
|
+
import { richTextToPlain as tl } from "./item-edit/helpers.js";
|
|
20
|
+
import { PersonalDefaultMark as ut } from "./item-edit/PersonalDefaultControl.js";
|
|
21
|
+
import { usePlacementTextContext as ll, evaluateDisplayFormula as rl } from "./item-edit/placement-behaviour.js";
|
|
22
|
+
import { UserChip as ht } from "./item-edit/UserChip.js";
|
|
23
|
+
import { DesignNode as nl } from "./layout-editor/DesignNode.js";
|
|
24
|
+
import { DesignCanvas as al } from "./layout-editor/design-canvas.js";
|
|
25
|
+
import { revealGroupKey as il } from "./layout-editor/design-context.js";
|
|
26
|
+
import { useRecordIntegrity as sl, integrityByField as dl } from "./panels/RecordIntegrityBanner.js";
|
|
27
|
+
import { SimpleSelectXs as mt } from "./ui/SimpleSelect.js";
|
|
28
|
+
import { WidgetSlot as ol } from "./WidgetSlot.js";
|
|
28
29
|
const he = (a) => {
|
|
29
30
|
if (!a) return {};
|
|
30
31
|
if (typeof a == "object") return a;
|
|
@@ -33,7 +34,7 @@ const he = (a) => {
|
|
|
33
34
|
} catch {
|
|
34
35
|
return {};
|
|
35
36
|
}
|
|
36
|
-
},
|
|
37
|
+
}, gt = (a) => {
|
|
37
38
|
const f = String(a).match(/^(\d{4})-(\d{2})-(\d{2})(?:[T ]00:00:00(?:\.0+)?(?:Z|[+-]00:?00)?)?$/);
|
|
38
39
|
if (f) return `${f[2]}/${f[3]}/${f[1]}`;
|
|
39
40
|
const y = new Date(String(a));
|
|
@@ -44,7 +45,7 @@ const he = (a) => {
|
|
|
44
45
|
}, We = (a) => {
|
|
45
46
|
const f = Number(a);
|
|
46
47
|
return Number.isNaN(f) ? String(a) : f.toLocaleString("en-US");
|
|
47
|
-
}, Ie = "text-[11.5px] font-medium text-slate-500 dark:text-slate-400", te = () => /* @__PURE__ */ r("span", { className: "text-slate-300 dark:text-slate-600", children: "—" }),
|
|
48
|
+
}, Ie = "text-[11.5px] font-medium text-slate-500 dark:text-slate-400", te = () => /* @__PURE__ */ r("span", { className: "text-slate-300 dark:text-slate-600", children: "—" }), cl = `
|
|
48
49
|
[data-read-board]{grid-template-columns:minmax(0,1fr)}
|
|
49
50
|
[data-read-dl]{grid-template-columns:repeat(2,minmax(0,1fr))}
|
|
50
51
|
@media (min-width:640px){[data-read-dl="full"]{grid-template-columns:repeat(3,minmax(0,1fr))}}
|
|
@@ -72,8 +73,8 @@ function Me({
|
|
|
72
73
|
}
|
|
73
74
|
);
|
|
74
75
|
}
|
|
75
|
-
function
|
|
76
|
-
const y = Oe(), c =
|
|
76
|
+
function ul({ collection: a, id: f }) {
|
|
77
|
+
const y = Oe(), c = Qt(), P = pt(), { data: S } = V({
|
|
77
78
|
queryKey: ["cbv-collection-meta", a],
|
|
78
79
|
queryFn: () => y.request(
|
|
79
80
|
G(`/collections/${a}`)
|
|
@@ -125,8 +126,8 @@ function cl({ collection: a, id: f }) {
|
|
|
125
126
|
}
|
|
126
127
|
) : /* @__PURE__ */ r(ge, { children: _ });
|
|
127
128
|
}
|
|
128
|
-
function
|
|
129
|
-
const f = Oe(), { apiBase: y } =
|
|
129
|
+
function ml({ id: a }) {
|
|
130
|
+
const f = Oe(), { apiBase: y } = jt(), { data: c, isPending: P } = V({
|
|
130
131
|
queryKey: ["rrv-file-meta", String(a)],
|
|
131
132
|
queryFn: () => f.request(
|
|
132
133
|
G(`/files/${a}/meta`)
|
|
@@ -150,8 +151,8 @@ function ul({ id: a }) {
|
|
|
150
151
|
}
|
|
151
152
|
);
|
|
152
153
|
}
|
|
153
|
-
const Ye = ({ collection: a, id: f }) => a === "nivaro_files" ? /* @__PURE__ */ r(
|
|
154
|
-
function
|
|
154
|
+
const Ye = ({ collection: a, id: f }) => a === "nivaro_files" ? /* @__PURE__ */ r(ml, { id: f }) : /* @__PURE__ */ r(ul, { collection: a, id: f });
|
|
155
|
+
function fl({
|
|
155
156
|
junction: a,
|
|
156
157
|
parentFk: f,
|
|
157
158
|
junctionField: y,
|
|
@@ -168,7 +169,7 @@ function ml({
|
|
|
168
169
|
retry: !1
|
|
169
170
|
}), h = ((_ == null ? void 0 : _.relations) ?? []).find(
|
|
170
171
|
(v) => v.many_collection === a && v.many_field === y
|
|
171
|
-
), q =
|
|
172
|
+
), q = Wt(h == null ? void 0 : h.one_allowed_collections), K = !!h && !h.one_collection && (q.length > 0 || !!h.one_collection_field), M = (h == null ? void 0 : h.one_collection_field) ?? "collection", k = (v) => v ? v === "directus_users" ? "nivaro_users" : v : null, x = (h == null ? void 0 : h.one_collection) ?? (K ? q.some((v) => v === "directus_users" || v === "nivaro_users") ? "nivaro_users" : k(q[0]) : null), { data: b } = V({
|
|
172
173
|
// Under the edit form's ['m2m-items', junction, parentFk, parentId] prefix (a longer key,
|
|
173
174
|
// so never the same cache entry): every link write that refreshes the form's list —
|
|
174
175
|
// a file upload, a picker change, the save itself — refreshes Summary's too. Its own
|
|
@@ -207,7 +208,7 @@ function ml({
|
|
|
207
208
|
}, [A, P]), ye(() => {
|
|
208
209
|
N && (S == null || S(N));
|
|
209
210
|
}, [N, S]), _ && !N && (!K || b) ? /* @__PURE__ */ r(te, {}) : !O || !N ? /* @__PURE__ */ r("span", { className: "inline-block h-3.5 w-20 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }) : O.length === 0 ? /* @__PURE__ */ r(te, {}) : N === "nivaro_files" && $ ? /* @__PURE__ */ r("div", { className: "mt-1", children: /* @__PURE__ */ r(
|
|
210
|
-
|
|
211
|
+
Zt,
|
|
211
212
|
{
|
|
212
213
|
relation: $,
|
|
213
214
|
parentId: c,
|
|
@@ -226,7 +227,7 @@ function ml({
|
|
|
226
227
|
`${w ?? N}:${v}`
|
|
227
228
|
)) });
|
|
228
229
|
}
|
|
229
|
-
function
|
|
230
|
+
function pl({
|
|
230
231
|
collection: a,
|
|
231
232
|
fkField: f,
|
|
232
233
|
parentId: y,
|
|
@@ -235,7 +236,7 @@ function fl({
|
|
|
235
236
|
defaultPreset: S,
|
|
236
237
|
onCount: $
|
|
237
238
|
}) {
|
|
238
|
-
const W = Oe(), _ =
|
|
239
|
+
const W = Oe(), _ = pt(), h = (P ?? []).filter((t) => t && Array.isArray(t.columns)), [q, K] = ee(
|
|
239
240
|
() => {
|
|
240
241
|
var t;
|
|
241
242
|
return h.length >= 2 ? ((t = h.find((i) => i.name === S)) == null ? void 0 : t.name) ?? h[0].name : "__all__";
|
|
@@ -278,7 +279,7 @@ function fl({
|
|
|
278
279
|
if (!N) return b;
|
|
279
280
|
const t = new Set(N.columns), i = b.filter((d) => t.has(d.field));
|
|
280
281
|
return i.length > 0 ? i : b;
|
|
281
|
-
}, [b, N]), [j, v] = ee(""), [w, F] = ee(1), [ae, J] = ee({}), z =
|
|
282
|
+
}, [b, N]), [j, v] = ee(""), [w, F] = ee(1), [ae, J] = ee({}), z = It(ae, 350), Ae = be(() => {
|
|
282
283
|
const t = [
|
|
283
284
|
{ path: [f], op: "_eq", value: y }
|
|
284
285
|
];
|
|
@@ -367,12 +368,12 @@ function fl({
|
|
|
367
368
|
if (d == null || d === "") return /* @__PURE__ */ r(te, {});
|
|
368
369
|
const p = k(i.field);
|
|
369
370
|
if (p === "nivaro_users")
|
|
370
|
-
return /* @__PURE__ */ r("span", { className: "inline-block", children: /* @__PURE__ */ r(
|
|
371
|
+
return /* @__PURE__ */ r("span", { className: "inline-block", children: /* @__PURE__ */ r(ht, { userId: String(d), size: "compact" }) });
|
|
371
372
|
if (p) return /* @__PURE__ */ r(Ye, { collection: p, id: d });
|
|
372
373
|
if (i.type === "boolean") return /* @__PURE__ */ r(Me, { value: d });
|
|
373
374
|
if (i.type === "decimal" || i.type === "float") return ze(d);
|
|
374
375
|
if (i.type === "integer") return We(d);
|
|
375
|
-
if (i.type === "date" || i.type === "datetime" || i.type === "timestamp") return
|
|
376
|
+
if (i.type === "date" || i.type === "datetime" || i.type === "timestamp") return gt(d);
|
|
376
377
|
const T = String(d);
|
|
377
378
|
return T.length > 48 ? `${T.slice(0, 48)}…` : T;
|
|
378
379
|
}, se = (t) => ["decimal", "float", "integer"].includes(t.type ?? "") && !k(t.field) && !t.field.includes("."), Ce = (t) => {
|
|
@@ -453,7 +454,7 @@ function fl({
|
|
|
453
454
|
),
|
|
454
455
|
i === "num" && /* @__PURE__ */ m("span", { className: "flex items-center gap-0.5", children: [
|
|
455
456
|
/* @__PURE__ */ r(
|
|
456
|
-
|
|
457
|
+
mt,
|
|
457
458
|
{
|
|
458
459
|
value: (d == null ? void 0 : d.op) ?? "_eq",
|
|
459
460
|
onChange: (p) => ie(t.field, p, (d == null ? void 0 : d.value) ?? ""),
|
|
@@ -477,7 +478,7 @@ function fl({
|
|
|
477
478
|
)
|
|
478
479
|
] }),
|
|
479
480
|
i === "bool" && /* @__PURE__ */ r(
|
|
480
|
-
|
|
481
|
+
mt,
|
|
481
482
|
{
|
|
482
483
|
value: (d == null ? void 0 : d.value) ?? "",
|
|
483
484
|
onChange: (p) => ie(t.field, "_eq", p),
|
|
@@ -589,7 +590,7 @@ function fl({
|
|
|
589
590
|
] })
|
|
590
591
|
] });
|
|
591
592
|
}
|
|
592
|
-
function
|
|
593
|
+
function ft({
|
|
593
594
|
collection: a,
|
|
594
595
|
itemId: f,
|
|
595
596
|
layoutData: y,
|
|
@@ -602,7 +603,7 @@ function mt({
|
|
|
602
603
|
gridCounts: h
|
|
603
604
|
}) {
|
|
604
605
|
var rt;
|
|
605
|
-
const q = Oe(), K =
|
|
606
|
+
const q = Oe(), K = ll(), M = c ? c.record ?? {} : null, k = !!(c != null && c.context.showHidden), x = c ? String(((rt = c.record) == null ? void 0 : rt.id) ?? "") : f ?? "", b = be(
|
|
606
607
|
() => c ? {
|
|
607
608
|
...c.layout,
|
|
608
609
|
layout: c.layout.layout ?? { id: 0, name: "" }
|
|
@@ -612,19 +613,19 @@ function mt({
|
|
|
612
613
|
kind: qe(e.field) ? "slot" : "field",
|
|
613
614
|
field: e.field,
|
|
614
615
|
group_key: e.group_key ?? null
|
|
615
|
-
}), N = (e, l, s = !1) => c ? /* @__PURE__ */ r(
|
|
616
|
+
}), N = (e, l, s = !1) => c ? /* @__PURE__ */ r(nl, { target: e, children: s ? /* @__PURE__ */ r("div", { "data-design-hidden": !0, className: "opacity-40", children: l }) : l }) : l, A = be(
|
|
616
617
|
() => [
|
|
617
618
|
...new Set(
|
|
618
619
|
(c ? [] : (b == null ? void 0 : b.assignments) ?? []).map((e) => e.field).filter((e) => e && !e.startsWith("__") && !e.includes("."))
|
|
619
620
|
)
|
|
620
621
|
].sort(),
|
|
621
622
|
[b, c]
|
|
622
|
-
), { data: j } =
|
|
623
|
+
), { data: j } = el(a, x, A), v = (e) => {
|
|
623
624
|
const l = j == null ? void 0 : j[e];
|
|
624
625
|
if (!l) return null;
|
|
625
626
|
const s = l.via !== "user";
|
|
626
627
|
return l.caller && l.activity_id ? /* @__PURE__ */ r(
|
|
627
|
-
|
|
628
|
+
Xt,
|
|
628
629
|
{
|
|
629
630
|
activityId: l.activity_id,
|
|
630
631
|
callerName: l.caller.name,
|
|
@@ -658,8 +659,8 @@ function mt({
|
|
|
658
659
|
className: `ml-1 inline-block h-1.5 w-1.5 rounded-full align-middle ${s ? "bg-amber-400" : "bg-slate-300 dark:bg-slate-600"}`
|
|
659
660
|
}
|
|
660
661
|
);
|
|
661
|
-
}, { data: w } =
|
|
662
|
-
() => $ && (w != null && w.enabled) ?
|
|
662
|
+
}, { data: w } = sl(a, x, !!$ && !c), F = be(
|
|
663
|
+
() => $ && (w != null && w.enabled) ? dl(w.findings) : null,
|
|
663
664
|
[$, w]
|
|
664
665
|
), ae = ({ field: e }) => {
|
|
665
666
|
const l = F == null ? void 0 : F.get(e);
|
|
@@ -684,7 +685,7 @@ function mt({
|
|
|
684
685
|
).then((e) => e.data),
|
|
685
686
|
staleTime: 10 * 6e4,
|
|
686
687
|
retry: !1
|
|
687
|
-
}), z =
|
|
688
|
+
}), z = Ct(), { data: Ae } = V({
|
|
688
689
|
queryKey: ["rrv-record", a, x],
|
|
689
690
|
enabled: !c,
|
|
690
691
|
queryFn: () => q.request(G(`/items/${a}/${x}`)).then((e) => e.data),
|
|
@@ -696,10 +697,10 @@ function mt({
|
|
|
696
697
|
staleTime: 3e4,
|
|
697
698
|
retry: !1
|
|
698
699
|
}), u = M ?? Ae;
|
|
699
|
-
|
|
700
|
+
Bt(a, c ? null : x, (e) => {
|
|
700
701
|
e.aspectsOnly || e.deleted || (z.invalidateQueries({ queryKey: ["rrv-record", a, x] }), z.invalidateQueries({ queryKey: ["field-touch", a, x] }));
|
|
701
702
|
});
|
|
702
|
-
const U =
|
|
703
|
+
const U = Et(null), [ce, Re] = ee(() => /* @__PURE__ */ new Set());
|
|
703
704
|
ye(() => {
|
|
704
705
|
const e = U.current;
|
|
705
706
|
if (U.current = u ?? null, c || !e || !u || e === u) return;
|
|
@@ -776,7 +777,7 @@ function mt({
|
|
|
776
777
|
return /* @__PURE__ */ r("div", { className: s ? "mt-3 space-y-4" : "hidden", "data-read-widgets": !0, children: l.map((o) => /* @__PURE__ */ r("div", { hidden: !Ne(o.field), children: N(
|
|
777
778
|
{ kind: "slot", field: o.field, group_key: o.group_key ?? null },
|
|
778
779
|
/* @__PURE__ */ r(
|
|
779
|
-
|
|
780
|
+
ol,
|
|
780
781
|
{
|
|
781
782
|
widgetId: o.widget_id,
|
|
782
783
|
inputBindings: Ve(o),
|
|
@@ -792,14 +793,14 @@ function mt({
|
|
|
792
793
|
),
|
|
793
794
|
C(o)
|
|
794
795
|
) }, o.field)) });
|
|
795
|
-
}, re = [...b.groups].sort((e, l) => e.sort - l.sort).filter((e) => k || e.visibility_mode !== "new_only").filter((e) => k || !u ||
|
|
796
|
+
}, re = [...b.groups].sort((e, l) => e.sort - l.sort).filter((e) => k || e.visibility_mode !== "new_only").filter((e) => k || !u || Yt(e.visible_when, u)), [Ee, fe] = ee(() => /* @__PURE__ */ new Set()), pe = (e) => !e.is_collapsed || Ee.has(e.key), bt = (e) => fe((l) => {
|
|
796
797
|
const s = new Set(l);
|
|
797
798
|
return s.has(e) ? s.delete(e) : s.add(e), s;
|
|
798
799
|
}), we = (c == null ? void 0 : c.context.fold) ?? null, Se = (c == null ? void 0 : c.context.reveal) ?? null;
|
|
799
800
|
ye(() => {
|
|
800
801
|
we && fe(we.open ? new Set(b.groups.map((e) => e.key)) : /* @__PURE__ */ new Set());
|
|
801
802
|
}, [we == null ? void 0 : we.seq]), ye(() => {
|
|
802
|
-
const e = Se ?
|
|
803
|
+
const e = Se ? il(Se.target) : null;
|
|
803
804
|
e && fe((l) => l.has(e) ? l : new Set(l).add(e));
|
|
804
805
|
}, [Se == null ? void 0 : Se.seq]);
|
|
805
806
|
const Be = [];
|
|
@@ -823,14 +824,14 @@ function mt({
|
|
|
823
824
|
}, Pe = (e) => {
|
|
824
825
|
const l = H.get(e.field), s = he(e.overrides);
|
|
825
826
|
if (qe(e.field)) {
|
|
826
|
-
const L =
|
|
827
|
-
return /* @__PURE__ */ r("span", { "data-display-formula": e.field, className: "tabular-nums", children: oe.error ? "—" :
|
|
827
|
+
const L = Jt(s), oe = rl((L == null ? void 0 : L.expr) ?? "", u ?? {});
|
|
828
|
+
return /* @__PURE__ */ r("span", { "data-display-formula": e.field, className: "tabular-nums", children: oe.error ? "—" : Ht(oe.value, L ?? { format: "", currency: null }) });
|
|
828
829
|
}
|
|
829
830
|
const o = Q(e.field);
|
|
830
831
|
if (c && !x && (o != null && o.junction_field)) return /* @__PURE__ */ r(te, {});
|
|
831
832
|
if (o != null && o.junction_field && o.many_collection && o.many_field)
|
|
832
833
|
return /* @__PURE__ */ r(
|
|
833
|
-
|
|
834
|
+
fl,
|
|
834
835
|
{
|
|
835
836
|
junction: o.many_collection,
|
|
836
837
|
parentFk: o.many_field,
|
|
@@ -843,7 +844,7 @@ function mt({
|
|
|
843
844
|
);
|
|
844
845
|
const g = u == null ? void 0 : u[e.field], I = me(e.field);
|
|
845
846
|
if (I === "nivaro_users" && g != null)
|
|
846
|
-
return /* @__PURE__ */ r("span", { className: "inline-block", children: /* @__PURE__ */ r(
|
|
847
|
+
return /* @__PURE__ */ r("span", { className: "inline-block", children: /* @__PURE__ */ r(ht, { userId: String(g), size: "compact" }) });
|
|
847
848
|
if (I) return /* @__PURE__ */ r(Ye, { collection: I, id: g });
|
|
848
849
|
if ((l == null ? void 0 : l.type) === "boolean" && (g == null || g === "")) return /* @__PURE__ */ r(Me, { value: !1 });
|
|
849
850
|
if (g == null || g === "") return /* @__PURE__ */ r(te, {});
|
|
@@ -856,14 +857,14 @@ function mt({
|
|
|
856
857
|
}
|
|
857
858
|
);
|
|
858
859
|
const Z = s.options ?? {};
|
|
859
|
-
return Xe(e) && typeof g == "string" ? /^\s*\{/.test(g) ? /* @__PURE__ */ r("div", { className: "min-w-0 whitespace-pre-wrap font-normal [overflow-wrap:anywhere]", children:
|
|
860
|
+
return Xe(e) && typeof g == "string" ? /^\s*\{/.test(g) ? /* @__PURE__ */ r("div", { className: "min-w-0 whitespace-pre-wrap font-normal [overflow-wrap:anywhere]", children: tl(g) }) : /* @__PURE__ */ r(
|
|
860
861
|
"div",
|
|
861
862
|
{
|
|
862
863
|
className: "rrv-prose min-w-0 font-normal leading-relaxed [overflow-wrap:anywhere] [&_a]:underline [&_h1]:text-[15px] [&_h1]:font-semibold [&_h2]:text-[14px] [&_h2]:font-semibold [&_h3]:font-semibold [&_li]:ml-4 [&_ol]:list-decimal [&_p]:my-1 [&_ul]:list-disc",
|
|
863
|
-
dangerouslySetInnerHTML: { __html:
|
|
864
|
+
dangerouslySetInnerHTML: { __html: zt(g) }
|
|
864
865
|
}
|
|
865
|
-
) : Z.format === "currency" ? /* @__PURE__ */ r("span", { className: "tabular-nums", children: ze(g) }) : (l == null ? void 0 : l.type) === "decimal" || (l == null ? void 0 : l.type) === "float" ? /* @__PURE__ */ r("span", { className: "tabular-nums", children: We(g) }) : (l == null ? void 0 : l.type) === "date" || (l == null ? void 0 : l.type) === "datetime" || (l == null ? void 0 : l.type) === "timestamp" ?
|
|
866
|
-
},
|
|
866
|
+
) : Z.format === "currency" ? /* @__PURE__ */ r("span", { className: "tabular-nums", children: ze(g) }) : (l == null ? void 0 : l.type) === "decimal" || (l == null ? void 0 : l.type) === "float" ? /* @__PURE__ */ r("span", { className: "tabular-nums", children: We(g) }) : (l == null ? void 0 : l.type) === "date" || (l == null ? void 0 : l.type) === "datetime" || (l == null ? void 0 : l.type) === "timestamp" ? gt(g) : String(g);
|
|
867
|
+
}, yt = (e) => {
|
|
867
868
|
const l = he(e.overrides), s = Q(e.field);
|
|
868
869
|
if (!(s != null && s.many_collection) || !s.many_field) return null;
|
|
869
870
|
if (c && !x) return /* @__PURE__ */ r("p", { className: "py-3 text-[12px] text-slate-400", children: "No records" });
|
|
@@ -880,7 +881,7 @@ function mt({
|
|
|
880
881
|
return Z;
|
|
881
882
|
})(), I = o.layout_id ?? null;
|
|
882
883
|
return /* @__PURE__ */ r(
|
|
883
|
-
|
|
884
|
+
pl,
|
|
884
885
|
{
|
|
885
886
|
collection: s.many_collection,
|
|
886
887
|
fkField: s.many_field,
|
|
@@ -892,18 +893,18 @@ function mt({
|
|
|
892
893
|
},
|
|
893
894
|
e.field
|
|
894
895
|
);
|
|
895
|
-
}, de = (e) => !!Q(e.field) && !X(e),
|
|
896
|
+
}, de = (e) => !!Q(e.field) && !X(e), xt = !!b.layout.hide_empty, Ze = Array.isArray(b.layout.header_fields) ? b.layout.header_fields.filter((e) => typeof e == "string") : [], vt = new Set(Ze), _t = (e) => {
|
|
896
897
|
if (!u || X(e)) return !1;
|
|
897
898
|
const l = u[e.field];
|
|
898
899
|
return l == null || l === "" || Array.isArray(l) && l.length === 0;
|
|
899
|
-
},
|
|
900
|
+
}, kt = (e) => xe.find((l) => l.field === e), $e = (e) => {
|
|
900
901
|
var o;
|
|
901
|
-
const l = he(e.overrides).label, s = K ?
|
|
902
|
+
const l = he(e.overrides).label, s = K ? Gt(e.overrides, K).label : void 0;
|
|
902
903
|
return s !== void 0 ? s : qe(e.field) ? typeof l == "string" && l.trim() ? l : "Formula" : typeof l == "string" && l.trim() ? l : e.label_override || ((o = H.get(e.field)) == null ? void 0 : o.label) || Qe(e.field);
|
|
903
|
-
},
|
|
904
|
-
const l =
|
|
904
|
+
}, Nt = (e) => {
|
|
905
|
+
const l = Mt(e.swap_config), s = xe.filter((n) => n.group_key === e.key && !vt.has(n.field)).filter((n) => k || !u || !Vt(n.overrides) || !je(u[n.field])).sort((n, E) => n.sort - E.sort), o = ie.filter((n) => n.group_key === e.key), g = De(e.key), I = s.length === 0 && o.length === 0 && g.length === 0;
|
|
905
906
|
if (I && !c) return null;
|
|
906
|
-
const Z = (n) =>
|
|
907
|
+
const Z = (n) => xt && !k && (de(n) || X(n)) && ((h == null ? void 0 : h[n.field]) ?? t[n.field]) === 0, L = s.filter((n) => !de(n)), oe = s.filter(de), Ke = o.filter((n) => Ne(n.field)), St = !e.hide_when_empty && g.length === 0 && Ke.length === 0 && s.length > 0 && s.some((n) => de(n) || X(n)) && s.every(Z), Ge = (n) => !St && Z(n), $t = s.filter((n) => !Ge(n)), Ft = (n) => (h == null ? void 0 : h[n.field]) ?? t[n.field], qt = !!e.hide_when_empty && !c && !k && !!u && g.length === 0 && Ke.length === 0 && s.every((n) => de(n) || X(n) ? Ft(n) === 0 : je(u[n.field])) || !I && $t.length === 0 && g.length === 0 && Ke.length === 0, Tt = (n) => (h == null ? void 0 : h[n.field]) ?? t[n.field], Je = !!l.emptyText && !!u && !c && g.length === 0 && Ke.length === 0 && s.every((n) => de(n) || X(n) ? Tt(n) === 0 : je(u[n.field])), Ot = Ut(L, { rows: l.rows }).units, nt = e.read_width === "full" || e.read_width === "half" || e.read_width === "third" ? e.read_width : oe.length > 0 || o.length > 0 || g.length > 0 || L.length > 4 ? "full" : "half", At = (n) => {
|
|
907
908
|
var st, dt, ot;
|
|
908
909
|
const E = Ge(n), B = !!(he(n.overrides).options ?? {}).emphasis, Fe = Xe(n) || !!((dt = (st = H.get(n.field)) == null ? void 0 : st.interface) != null && dt.includes("rich-text")), at = u == null ? void 0 : u[n.field], it = !Fe && !X(n) && !me(n.field) && (String(((ot = H.get(n.field)) == null ? void 0 : ot.interface) ?? "").includes("textarea") || typeof at == "string" && at.length > 36);
|
|
909
910
|
return /* @__PURE__ */ r(
|
|
@@ -917,6 +918,7 @@ function mt({
|
|
|
917
918
|
/* @__PURE__ */ m("dt", { className: Ie, children: [
|
|
918
919
|
$e(n),
|
|
919
920
|
/* @__PURE__ */ r(ae, { field: n.field }),
|
|
921
|
+
/* @__PURE__ */ r(ut, { field: n.field }),
|
|
920
922
|
v(n.field)
|
|
921
923
|
] }),
|
|
922
924
|
/* @__PURE__ */ r(
|
|
@@ -935,7 +937,7 @@ function mt({
|
|
|
935
937
|
},
|
|
936
938
|
n.field
|
|
937
939
|
);
|
|
938
|
-
},
|
|
940
|
+
}, Rt = (n, E) => {
|
|
939
941
|
const He = u && !c ? E.filter((B) => !je(u[B.field])) : E;
|
|
940
942
|
return /* @__PURE__ */ m(
|
|
941
943
|
"div",
|
|
@@ -944,7 +946,7 @@ function mt({
|
|
|
944
946
|
className: `min-w-0 ${E.length > 2 ? "col-span-full" : "col-span-2"}`,
|
|
945
947
|
children: [
|
|
946
948
|
/* @__PURE__ */ r("dt", { className: Ie, children: n.label.trim() || E.map($e).join(" / ") }),
|
|
947
|
-
/* @__PURE__ */ r("dd", { className: "mt-1 flex min-w-0 flex-wrap items-baseline gap-x-1.5 text-[13px] font-medium text-slate-800 dark:text-slate-100", children: u ? He.length === 0 ? /* @__PURE__ */ r(te, {}) : He.map((B, Fe) => /* @__PURE__ */ m(
|
|
949
|
+
/* @__PURE__ */ r("dd", { className: "mt-1 flex min-w-0 flex-wrap items-baseline gap-x-1.5 text-[13px] font-medium text-slate-800 dark:text-slate-100", children: u ? He.length === 0 ? /* @__PURE__ */ r(te, {}) : He.map((B, Fe) => /* @__PURE__ */ m(Pt, { children: [
|
|
948
950
|
Fe > 0 && /* @__PURE__ */ r("span", { "aria-hidden": !0, className: "text-slate-300 dark:text-slate-600", children: "·" }),
|
|
949
951
|
N(
|
|
950
952
|
O(B),
|
|
@@ -968,7 +970,7 @@ function mt({
|
|
|
968
970
|
return /* @__PURE__ */ r(
|
|
969
971
|
"section",
|
|
970
972
|
{
|
|
971
|
-
hidden:
|
|
973
|
+
hidden: qt,
|
|
972
974
|
"data-read-section": e.key,
|
|
973
975
|
"data-read-width": nt,
|
|
974
976
|
className: "min-w-0 rounded-xl border border-slate-200 bg-white dark:border-slate-700/60 dark:bg-slate-900/40",
|
|
@@ -984,7 +986,7 @@ function mt({
|
|
|
984
986
|
"button",
|
|
985
987
|
{
|
|
986
988
|
type: "button",
|
|
987
|
-
onClick: () =>
|
|
989
|
+
onClick: () => bt(e.key),
|
|
988
990
|
"aria-expanded": pe(e),
|
|
989
991
|
className: "min-w-0 flex-1 text-left after:absolute after:inset-0 group-hover/rs:text-slate-900 dark:group-hover/rs:text-white",
|
|
990
992
|
children: e.label
|
|
@@ -1002,11 +1004,11 @@ function mt({
|
|
|
1002
1004
|
title: `Edit ${e.label}`,
|
|
1003
1005
|
"aria-label": `Edit ${e.label}`,
|
|
1004
1006
|
className: "relative -my-1 rounded p-1 text-slate-400 opacity-0 transition-opacity hover:bg-slate-100 hover:text-slate-700 focus-visible:opacity-100 group-hover/rs:opacity-100 dark:hover:bg-white/5 dark:hover:text-slate-200 motion-reduce:transition-none",
|
|
1005
|
-
children: /* @__PURE__ */ r(
|
|
1007
|
+
children: /* @__PURE__ */ r(Dt, { className: "h-3 w-3" })
|
|
1006
1008
|
}
|
|
1007
1009
|
),
|
|
1008
1010
|
e.is_collapsed && /* @__PURE__ */ r(
|
|
1009
|
-
|
|
1011
|
+
Lt,
|
|
1010
1012
|
{
|
|
1011
1013
|
"aria-hidden": "true",
|
|
1012
1014
|
className: `pointer-events-none h-3.5 w-3.5 shrink-0 transition-transform group-hover/rs:text-slate-700 dark:group-hover/rs:text-slate-200 ${pe(e) ? "" : "-rotate-90"}`
|
|
@@ -1034,8 +1036,8 @@ function mt({
|
|
|
1034
1036
|
className: "grid gap-x-6 gap-y-5",
|
|
1035
1037
|
"data-read-dl": nt,
|
|
1036
1038
|
style: Je ? { display: "none" } : void 0,
|
|
1037
|
-
children:
|
|
1038
|
-
(n) => n.kind === "row" ?
|
|
1039
|
+
children: Ot.map(
|
|
1040
|
+
(n) => n.kind === "row" ? Rt(n.row, n.members) : At(n.field)
|
|
1039
1041
|
)
|
|
1040
1042
|
}
|
|
1041
1043
|
),
|
|
@@ -1060,7 +1062,7 @@ function mt({
|
|
|
1060
1062
|
"; switch to Edit to fix"
|
|
1061
1063
|
] })
|
|
1062
1064
|
] }) : null,
|
|
1063
|
-
(W ? W(n) : null) ??
|
|
1065
|
+
(W ? W(n) : null) ?? yt(n)
|
|
1064
1066
|
] }),
|
|
1065
1067
|
C(n)
|
|
1066
1068
|
)
|
|
@@ -1085,13 +1087,13 @@ function mt({
|
|
|
1085
1087
|
},
|
|
1086
1088
|
e.key
|
|
1087
1089
|
);
|
|
1088
|
-
}, et = _e(null),
|
|
1090
|
+
}, et = _e(null), wt = _e(null, "leading"), tt = Ze.map((e) => kt(e)).filter((e) => !!e && !de(e)).filter((e) => k || !_t(e)), [ne, ...lt] = tt;
|
|
1089
1091
|
return /* @__PURE__ */ m(
|
|
1090
1092
|
"div",
|
|
1091
1093
|
{
|
|
1092
1094
|
className: P ? "min-h-0 flex-1" : "min-h-0 flex-1 overflow-y-auto bg-slate-50/60 px-5 py-4 dark:bg-transparent",
|
|
1093
1095
|
children: [
|
|
1094
|
-
|
|
1096
|
+
wt,
|
|
1095
1097
|
tt.length > 0 && /* @__PURE__ */ m(
|
|
1096
1098
|
"div",
|
|
1097
1099
|
{
|
|
@@ -1123,6 +1125,7 @@ function mt({
|
|
|
1123
1125
|
/* @__PURE__ */ m("dt", { className: Ie, children: [
|
|
1124
1126
|
$e(e),
|
|
1125
1127
|
/* @__PURE__ */ r(ae, { field: e.field }),
|
|
1128
|
+
/* @__PURE__ */ r(ut, { field: e.field }),
|
|
1126
1129
|
v(e.field)
|
|
1127
1130
|
] }),
|
|
1128
1131
|
/* @__PURE__ */ r(
|
|
@@ -1141,8 +1144,8 @@ function mt({
|
|
|
1141
1144
|
]
|
|
1142
1145
|
}
|
|
1143
1146
|
),
|
|
1144
|
-
/* @__PURE__ */ r("style", { children:
|
|
1145
|
-
J ? /* @__PURE__ */ r("div", { className: "grid items-stretch gap-4", "data-read-board": !0, children: Be.map(
|
|
1147
|
+
/* @__PURE__ */ r("style", { children: cl }),
|
|
1148
|
+
J ? /* @__PURE__ */ r("div", { className: "grid items-stretch gap-4", "data-read-board": !0, children: Be.map(Nt) }) : /* @__PURE__ */ m("div", { className: "flex flex-col gap-4", "data-read-board-pending": !0, children: [
|
|
1146
1149
|
/* @__PURE__ */ r("div", { className: "h-32 animate-pulse rounded-xl bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }),
|
|
1147
1150
|
/* @__PURE__ */ r("div", { className: "h-32 animate-pulse rounded-xl bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }),
|
|
1148
1151
|
/* @__PURE__ */ r("div", { className: "h-56 animate-pulse rounded-xl bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" })
|
|
@@ -1152,9 +1155,9 @@ function mt({
|
|
|
1152
1155
|
}
|
|
1153
1156
|
);
|
|
1154
1157
|
}
|
|
1155
|
-
function
|
|
1156
|
-
return a.design ? /* @__PURE__ */ r(
|
|
1158
|
+
function Gl(a) {
|
|
1159
|
+
return a.design ? /* @__PURE__ */ r(al, { design: a.design.context, onRefusedWrite: a.design.onRefusedWrite, children: /* @__PURE__ */ r(Kt.Provider, { value: null, children: /* @__PURE__ */ r(ft, { ...a }) }) }) : /* @__PURE__ */ r(ft, { ...a });
|
|
1157
1160
|
}
|
|
1158
1161
|
export {
|
|
1159
|
-
|
|
1162
|
+
Gl as RecordReadView
|
|
1160
1163
|
};
|