@nivaro/react 0.3.119 → 0.3.121
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/shared/components/CopyValueButton.js +61 -0
- package/dist/shared/components/GridPresenceLine.js +46 -36
- package/dist/shared/components/ItemEditForm.js +1701 -1671
- package/dist/shared/components/ProfileView.js +181 -175
- package/dist/shared/components/RecordReadView.js +590 -557
- package/dist/shared/components/UserAvatar.js +11 -11
- package/dist/shared/components/item-edit/HeaderBand.js +50 -50
- package/dist/shared/components/item-edit/UserChip.js +52 -47
- package/dist/shared/components/notifications/NotificationRulesEditor.js +63 -53
- package/dist/shared/components/profile/PersonAccess.js +84 -94
- package/dist/shared/components/profile/primitives.js +2 -1
- package/dist/shared/components/support/SupportEmailSwitch.js +63 -0
- package/dist/shared/components/support/SupportView.js +51 -45
- package/dist/shared/lib/header-strip.js +121 -115
- package/package.json +1 -1
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import { jsx as t, jsxs as p, Fragment as
|
|
2
|
-
import { useQuery as U, useQueryClient as
|
|
3
|
-
import { Pencil as
|
|
4
|
-
import { useMemo as
|
|
5
|
-
import { DrilldownContext as Ut, useNivaroClient as Ne, useApiFetchConfig as Vt, useDrilldown as
|
|
6
|
-
import { useDebounced as
|
|
7
|
-
import { parseAllowedCollections as
|
|
8
|
-
import { get as
|
|
9
|
-
import { toastError as
|
|
10
|
-
import { readGroupStructure as Yt, isFolded as
|
|
11
|
-
import { quietHiddenSectionsOf as
|
|
12
|
-
import { useLiveRecord as
|
|
13
|
-
import { isDisplayFormulaField as
|
|
14
|
-
import { invalidateRecordRow as
|
|
15
|
-
import { sanitizeHtml as
|
|
16
|
-
import { titleCase as Ze, formatRelative as
|
|
17
|
-
import { matchesVisibleWhen as
|
|
18
|
-
import { InboundRequestPopover as
|
|
19
|
-
import { FileM2MField as
|
|
20
|
-
import { useFieldTouches as
|
|
1
|
+
import { jsx as t, jsxs as p, Fragment as me } from "react/jsx-runtime";
|
|
2
|
+
import { useQuery as U, useQueryClient as kt } from "@tanstack/react-query";
|
|
3
|
+
import { Pencil as Bt, ChevronDown as It } from "lucide-react";
|
|
4
|
+
import { useMemo as ke, useRef as Xe, useState as H, useEffect as fe, useCallback as gt, Fragment as Ht } from "react";
|
|
5
|
+
import { DrilldownContext as Ut, useNivaroClient as Ne, useApiFetchConfig as Vt, useDrilldown as Nt } from "../context.js";
|
|
6
|
+
import { useDebounced as Gt } from "../hooks/useDebounced.js";
|
|
7
|
+
import { parseAllowedCollections as Jt } from "../lib/allowed-collections.js";
|
|
8
|
+
import { get as z, patch as Qt } from "../lib/commands.js";
|
|
9
|
+
import { toastError as zt } from "../lib/error-toast.js";
|
|
10
|
+
import { readGroupStructure as Yt, isFolded as Xt, isEmptyValue as ve, planFieldGrid as Zt } from "../lib/form-structure.js";
|
|
11
|
+
import { quietHiddenSectionsOf as el } from "../lib/layout-resolve.js";
|
|
12
|
+
import { useLiveRecord as tl } from "../lib/live.js";
|
|
13
|
+
import { isDisplayFormulaField as Le, resolvePlacementText as ll, displayFormulaOf as rl, formatDisplayValue as nl } from "../lib/placement-behaviour.js";
|
|
14
|
+
import { invalidateRecordRow as al, useRecordReader as il } from "../lib/record-loader.js";
|
|
15
|
+
import { sanitizeHtml as sl } from "../lib/sanitize-html.js";
|
|
16
|
+
import { titleCase as Ze, formatRelative as je } from "../lib/utils.js";
|
|
17
|
+
import { matchesVisibleWhen as dl } from "../lib/visible-when.js";
|
|
18
|
+
import { InboundRequestPopover as ol } from "./integrations/InboundRequest.js";
|
|
19
|
+
import { FileM2MField as cl } from "./item-edit/FilePickerField.js";
|
|
20
|
+
import { useFieldTouches as ul } from "./item-edit/HeaderFreshness.js";
|
|
21
21
|
import { richTextToPlain as ml } from "./item-edit/helpers.js";
|
|
22
|
-
import { isNamelessLabel as
|
|
23
|
-
import { PersonalDefaultMark as
|
|
24
|
-
import { usePlacementTextContext as
|
|
25
|
-
import { RuleHiddenNotes as
|
|
26
|
-
import { RELATED_LOADING_CLASS as
|
|
27
|
-
import { ruleHiddenGroups as
|
|
28
|
-
import { UserChip as
|
|
29
|
-
import { DesignNode as
|
|
30
|
-
import { DesignCanvas as
|
|
31
|
-
import { revealGroupKey as
|
|
32
|
-
import { choiceLabelsFrom as
|
|
33
|
-
import { useRecordIntegrity as
|
|
22
|
+
import { isNamelessLabel as fl, NAMELESS_LABEL as pl } from "./item-edit/option-disambiguate.js";
|
|
23
|
+
import { PersonalDefaultMark as yt } from "./item-edit/PersonalDefaultControl.js";
|
|
24
|
+
import { usePlacementTextContext as hl, evaluateDisplayFormula as bl } from "./item-edit/placement-behaviour.js";
|
|
25
|
+
import { RuleHiddenNotes as gl } from "./item-edit/RuleHiddenNotes.js";
|
|
26
|
+
import { RELATED_LOADING_CLASS as yl, RelatedMissingLabel as xl } from "./item-edit/related-missing.js";
|
|
27
|
+
import { ruleHiddenGroups as vl, groupHasReadableField as _l } from "./item-edit/rule-hidden.js";
|
|
28
|
+
import { UserChip as wt } from "./item-edit/UserChip.js";
|
|
29
|
+
import { DesignNode as kl } from "./layout-editor/DesignNode.js";
|
|
30
|
+
import { DesignCanvas as Nl } from "./layout-editor/design-canvas.js";
|
|
31
|
+
import { revealGroupKey as wl } from "./layout-editor/design-context.js";
|
|
32
|
+
import { choiceLabelsFrom as Sl } from "./layout-editor/overview/describe-conditions.js";
|
|
33
|
+
import { useRecordIntegrity as $l, integrityByField as Fl } from "./panels/RecordIntegrityBanner.js";
|
|
34
34
|
import { RecordHoverCard as et } from "./RecordHoverCard.js";
|
|
35
|
-
import { RelativeTime as
|
|
36
|
-
import { SimpleSelectXs as
|
|
37
|
-
import { WidgetSlot as
|
|
38
|
-
const
|
|
35
|
+
import { RelativeTime as ql } from "./RelativeTime.js";
|
|
36
|
+
import { SimpleSelectXs as xt } from "./ui/SimpleSelect.js";
|
|
37
|
+
import { WidgetSlot as Rl } from "./WidgetSlot.js";
|
|
38
|
+
const _e = (a) => {
|
|
39
39
|
if (!a) return {};
|
|
40
40
|
if (typeof a == "object") return a;
|
|
41
41
|
try {
|
|
@@ -44,39 +44,74 @@ const xe = (a) => {
|
|
|
44
44
|
return {};
|
|
45
45
|
}
|
|
46
46
|
}, Al = 3;
|
|
47
|
-
function
|
|
48
|
-
let
|
|
49
|
-
if (typeof
|
|
47
|
+
function Tl(a) {
|
|
48
|
+
let u = a;
|
|
49
|
+
if (typeof u == "string")
|
|
50
50
|
try {
|
|
51
|
-
|
|
51
|
+
u = JSON.parse(u);
|
|
52
52
|
} catch {
|
|
53
|
-
|
|
53
|
+
u = u ? u.split(",").map((i) => i.trim()) : [];
|
|
54
54
|
}
|
|
55
|
-
if (!Array.isArray(
|
|
56
|
-
const
|
|
57
|
-
for (const
|
|
58
|
-
if (typeof
|
|
59
|
-
else if (
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
field:
|
|
63
|
-
label: typeof
|
|
55
|
+
if (!Array.isArray(u)) return [];
|
|
56
|
+
const h = [];
|
|
57
|
+
for (const i of u)
|
|
58
|
+
if (typeof i == "string" && i) h.push({ field: i, label: null });
|
|
59
|
+
else if (i && typeof i == "object" && typeof i.field == "string") {
|
|
60
|
+
const w = i.label;
|
|
61
|
+
h.push({
|
|
62
|
+
field: i.field,
|
|
63
|
+
label: typeof w == "string" && w.trim() ? w.trim() : null
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
|
-
return
|
|
66
|
+
return h.filter((i) => !i.field.startsWith("__"));
|
|
67
67
|
}
|
|
68
|
-
const
|
|
69
|
-
const
|
|
70
|
-
if (
|
|
71
|
-
const
|
|
72
|
-
return Number.isNaN(
|
|
68
|
+
const St = (a) => {
|
|
69
|
+
const u = String(a).match(/^(\d{4})-(\d{2})-(\d{2})(?:[T ]00:00:00(?:\.0+)?(?:Z|[+-]00:?00)?)?$/);
|
|
70
|
+
if (u) return `${u[2]}/${u[3]}/${u[1]}`;
|
|
71
|
+
const h = new Date(String(a));
|
|
72
|
+
return Number.isNaN(h.getTime()) ? String(a) : `${String(h.getMonth() + 1).padStart(2, "0")}/${String(h.getDate()).padStart(2, "0")}/${h.getFullYear()}`;
|
|
73
73
|
}, tt = (a) => {
|
|
74
|
-
const
|
|
75
|
-
return Number.isNaN(
|
|
76
|
-
},
|
|
77
|
-
const
|
|
78
|
-
return Number.isNaN(
|
|
79
|
-
},
|
|
74
|
+
const u = Number(a);
|
|
75
|
+
return Number.isNaN(u) ? String(a) : `$${u.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`;
|
|
76
|
+
}, Be = (a) => {
|
|
77
|
+
const u = Number(a);
|
|
78
|
+
return Number.isNaN(u) ? String(a) : u.toLocaleString("en-US");
|
|
79
|
+
}, lt = "text-[11.5px] font-medium text-slate-500 dark:text-slate-400", vt = `${lt} flex min-w-0 items-center whitespace-nowrap`;
|
|
80
|
+
function Cl({ name: a, at: u }) {
|
|
81
|
+
const h = Xe(null), [i, w] = H(!1), _ = Xe(0);
|
|
82
|
+
return fe(() => {
|
|
83
|
+
const x = h.current, S = x == null ? void 0 : x.parentElement, N = S == null ? void 0 : S.parentElement;
|
|
84
|
+
if (!x || !S || !N || typeof ResizeObserver > "u") return;
|
|
85
|
+
const m = () => {
|
|
86
|
+
if (!i) {
|
|
87
|
+
const L = x.scrollWidth - x.clientWidth;
|
|
88
|
+
L > 0.5 && (_.current = S.getBoundingClientRect().width + L, w(!0));
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
const F = N.getBoundingClientRect().right - S.getBoundingClientRect().left;
|
|
92
|
+
_.current && F >= _.current + 1 && w(!1);
|
|
93
|
+
};
|
|
94
|
+
m();
|
|
95
|
+
const T = new ResizeObserver(m);
|
|
96
|
+
return T.observe(N), () => T.disconnect();
|
|
97
|
+
}, [i]), /* @__PURE__ */ p(
|
|
98
|
+
"span",
|
|
99
|
+
{
|
|
100
|
+
ref: h,
|
|
101
|
+
"data-field-touch-text": !0,
|
|
102
|
+
"data-short": i || void 0,
|
|
103
|
+
className: "min-w-0 truncate",
|
|
104
|
+
children: [
|
|
105
|
+
a,
|
|
106
|
+
!i && /* @__PURE__ */ p(me, { children: [
|
|
107
|
+
" · ",
|
|
108
|
+
/* @__PURE__ */ t(ql, { value: u })
|
|
109
|
+
] })
|
|
110
|
+
]
|
|
111
|
+
}
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
const le = () => /* @__PURE__ */ t("span", { className: "text-slate-300 dark:text-slate-600", children: "—" }), Ol = `
|
|
80
115
|
[data-read-board]{grid-template-columns:minmax(0,1fr)}
|
|
81
116
|
[data-read-dl]{grid-template-columns:repeat(2,minmax(0,1fr))}
|
|
82
117
|
@media (min-width:640px){[data-read-dl="full"]{grid-template-columns:repeat(3,minmax(0,1fr))}}
|
|
@@ -91,49 +126,49 @@ const Nt = (a) => {
|
|
|
91
126
|
}
|
|
92
127
|
@media (min-width:1536px){[data-read-dl="full"]{grid-template-columns:repeat(6,minmax(0,1fr))}}
|
|
93
128
|
`;
|
|
94
|
-
function
|
|
129
|
+
function Ie({
|
|
95
130
|
value: a,
|
|
96
|
-
trueTone:
|
|
131
|
+
trueTone: u = "positive"
|
|
97
132
|
}) {
|
|
98
|
-
const
|
|
133
|
+
const h = a === !0 || a === 1 || a === "1" || a === "true";
|
|
99
134
|
return /* @__PURE__ */ t(
|
|
100
135
|
"span",
|
|
101
136
|
{
|
|
102
|
-
className: `inline-flex h-[18px] items-center rounded-full px-1.5 text-[10.5px] font-semibold ${
|
|
103
|
-
children:
|
|
137
|
+
className: `inline-flex h-[18px] items-center rounded-full px-1.5 text-[10.5px] font-semibold ${h ? u === "danger" ? "bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-400" : "bg-emerald-100 text-emerald-700 dark:bg-emerald-900/40 dark:text-emerald-400" : "bg-slate-100 text-slate-500 dark:bg-slate-800 dark:text-slate-400"}`,
|
|
138
|
+
children: h ? "Yes" : "No"
|
|
104
139
|
}
|
|
105
140
|
);
|
|
106
141
|
}
|
|
107
|
-
function Ll({ collection: a, id:
|
|
108
|
-
const
|
|
142
|
+
function Ll({ collection: a, id: u }) {
|
|
143
|
+
const h = Ne(), i = il(), w = Nt(), { data: _ } = U({
|
|
109
144
|
queryKey: ["cbv-collection-meta", a],
|
|
110
|
-
queryFn: () =>
|
|
111
|
-
|
|
112
|
-
).then((
|
|
145
|
+
queryFn: () => h.request(
|
|
146
|
+
z(`/collections/${a}`)
|
|
147
|
+
).then((F) => F.data).catch(() => ({ display_template: null, fields: [] })),
|
|
113
148
|
staleTime: 10 * 6e4,
|
|
114
149
|
retry: !1
|
|
115
150
|
}), {
|
|
116
|
-
data:
|
|
117
|
-
isPending:
|
|
118
|
-
error:
|
|
151
|
+
data: x,
|
|
152
|
+
isPending: S,
|
|
153
|
+
error: N
|
|
119
154
|
} = U({
|
|
120
|
-
queryKey: ["rrv-related", a, String(
|
|
121
|
-
queryFn: () =>
|
|
122
|
-
enabled:
|
|
155
|
+
queryKey: ["rrv-related", a, String(u)],
|
|
156
|
+
queryFn: () => i(a, u),
|
|
157
|
+
enabled: u != null && !!_,
|
|
123
158
|
staleTime: 6e4,
|
|
124
159
|
retry: !1
|
|
125
160
|
});
|
|
126
|
-
if (
|
|
127
|
-
if (!
|
|
128
|
-
return /* @__PURE__ */ t("span", { className:
|
|
129
|
-
if (!
|
|
130
|
-
let
|
|
131
|
-
const T =
|
|
132
|
-
if (T && (
|
|
133
|
-
const
|
|
134
|
-
return
|
|
135
|
-
}).trim()), !
|
|
136
|
-
for (const
|
|
161
|
+
if (u == null) return /* @__PURE__ */ t(le, {});
|
|
162
|
+
if (!x && !N && (S || !_))
|
|
163
|
+
return /* @__PURE__ */ t("span", { className: yl });
|
|
164
|
+
if (!x) return /* @__PURE__ */ t(xl, { error: N, collection: a, id: u });
|
|
165
|
+
let m = "";
|
|
166
|
+
const T = _ == null ? void 0 : _.display_template;
|
|
167
|
+
if (T && (m = T.replace(/\{\{\s*([^}]+?)\s*\}\}/g, (F, L) => {
|
|
168
|
+
const q = L.split(".").reduce((v, g) => v == null ? void 0 : v[g], x);
|
|
169
|
+
return q == null ? "" : String(q);
|
|
170
|
+
}).trim()), !m) {
|
|
171
|
+
for (const F of [
|
|
137
172
|
"name",
|
|
138
173
|
"title",
|
|
139
174
|
"label",
|
|
@@ -143,65 +178,65 @@ function Ll({ collection: a, id: m }) {
|
|
|
143
178
|
"filename_download",
|
|
144
179
|
"filename"
|
|
145
180
|
])
|
|
146
|
-
if (
|
|
147
|
-
|
|
181
|
+
if (x[F]) {
|
|
182
|
+
m = String(x[F]);
|
|
148
183
|
break;
|
|
149
184
|
}
|
|
150
185
|
}
|
|
151
|
-
return
|
|
186
|
+
return fl(m) && (m = pl), w ? /* @__PURE__ */ t(et, { collection: a, id: u, children: /* @__PURE__ */ t(
|
|
152
187
|
"button",
|
|
153
188
|
{
|
|
154
189
|
type: "button",
|
|
155
|
-
onClick: () =>
|
|
190
|
+
onClick: () => w.open({ collection: a, itemId: String(u) }),
|
|
156
191
|
className: "inline-block max-w-full truncate text-left align-bottom underline decoration-slate-300 underline-offset-2 transition-colors hover:text-[#007a99] hover:decoration-[#007a99] dark:decoration-slate-600 dark:hover:text-nvr-cyan dark:hover:decoration-nvr-cyan",
|
|
157
|
-
children:
|
|
192
|
+
children: m
|
|
158
193
|
}
|
|
159
|
-
) }) : /* @__PURE__ */ t(et, { collection: a, id:
|
|
194
|
+
) }) : /* @__PURE__ */ t(et, { collection: a, id: u, children: m });
|
|
160
195
|
}
|
|
161
|
-
function
|
|
162
|
-
const
|
|
196
|
+
function El({ id: a }) {
|
|
197
|
+
const u = Ne(), { apiBase: h } = Vt(), { data: i, isPending: w } = U({
|
|
163
198
|
queryKey: ["rrv-file-meta", String(a)],
|
|
164
|
-
queryFn: () =>
|
|
165
|
-
|
|
166
|
-
).then((
|
|
199
|
+
queryFn: () => u.request(
|
|
200
|
+
z(`/files/${a}/meta`)
|
|
201
|
+
).then((x) => x.data).catch(() => null),
|
|
167
202
|
enabled: a != null,
|
|
168
203
|
staleTime: 5 * 6e4,
|
|
169
204
|
retry: !1
|
|
170
205
|
});
|
|
171
206
|
if (a == null) return /* @__PURE__ */ t(le, {});
|
|
172
|
-
if (!
|
|
207
|
+
if (!i && w)
|
|
173
208
|
return /* @__PURE__ */ t("span", { className: "inline-block h-3.5 w-24 animate-pulse rounded bg-slate-100 align-middle dark:bg-[hsl(var(--nvr-skeleton))]" });
|
|
174
|
-
const
|
|
209
|
+
const _ = (i == null ? void 0 : i.title) || (i == null ? void 0 : i.filename_download) || `#${String(a)}`;
|
|
175
210
|
return /* @__PURE__ */ t(
|
|
176
211
|
"a",
|
|
177
212
|
{
|
|
178
|
-
href: `${
|
|
213
|
+
href: `${h}/files/${a}`,
|
|
179
214
|
target: "_blank",
|
|
180
215
|
rel: "noreferrer",
|
|
181
216
|
className: "underline decoration-slate-300 underline-offset-2 transition-colors hover:text-[#007a99] hover:decoration-[#007a99] dark:decoration-slate-600 dark:hover:text-nvr-cyan dark:hover:decoration-nvr-cyan",
|
|
182
|
-
children:
|
|
217
|
+
children: _
|
|
183
218
|
}
|
|
184
219
|
);
|
|
185
220
|
}
|
|
186
|
-
const
|
|
187
|
-
function
|
|
221
|
+
const rt = ({ collection: a, id: u }) => a === "nivaro_files" ? /* @__PURE__ */ t(El, { id: u }) : /* @__PURE__ */ t(Ll, { collection: a, id: u });
|
|
222
|
+
function Dl({
|
|
188
223
|
junction: a,
|
|
189
|
-
parentFk:
|
|
190
|
-
junctionField:
|
|
191
|
-
parentId:
|
|
192
|
-
onCount:
|
|
193
|
-
onTarget:
|
|
194
|
-
relation:
|
|
224
|
+
parentFk: u,
|
|
225
|
+
junctionField: h,
|
|
226
|
+
parentId: i,
|
|
227
|
+
onCount: w,
|
|
228
|
+
onTarget: _,
|
|
229
|
+
relation: x
|
|
195
230
|
}) {
|
|
196
|
-
var
|
|
197
|
-
const
|
|
231
|
+
var j;
|
|
232
|
+
const S = Ne(), { data: N } = U({
|
|
198
233
|
queryKey: ["cbv-collection-meta", a],
|
|
199
|
-
queryFn: () =>
|
|
234
|
+
queryFn: () => S.request(z(`/collections/${a}`)).then((k) => k.data),
|
|
200
235
|
staleTime: 10 * 6e4,
|
|
201
236
|
retry: !1
|
|
202
|
-
}),
|
|
203
|
-
(
|
|
204
|
-
), T =
|
|
237
|
+
}), m = ((N == null ? void 0 : N.relations) ?? []).find(
|
|
238
|
+
(k) => k.many_collection === a && k.many_field === h
|
|
239
|
+
), T = Jt(m == null ? void 0 : m.one_allowed_collections), F = !!m && !m.one_collection && (T.length > 0 || !!m.one_collection_field), L = (m == null ? void 0 : m.one_collection_field) ?? "collection", q = (k) => k ? k === "directus_users" ? "nivaro_users" : k : null, v = (m == null ? void 0 : m.one_collection) ?? (F ? T.some((k) => k === "directus_users" || k === "nivaro_users") ? "nivaro_users" : q(T[0]) : null), { data: g } = U({
|
|
205
240
|
// Under the edit form's ['m2m-items', junction, parentFk, parentId] prefix (a longer key,
|
|
206
241
|
// so never the same cache entry): every link write that refreshes the form's list —
|
|
207
242
|
// a file upload, a picker change, the save itself — refreshes Summary's too. Its own
|
|
@@ -209,89 +244,89 @@ function Cl({
|
|
|
209
244
|
queryKey: [
|
|
210
245
|
"m2m-items",
|
|
211
246
|
a,
|
|
212
|
-
|
|
213
|
-
|
|
247
|
+
u,
|
|
248
|
+
i,
|
|
214
249
|
"rrv",
|
|
215
|
-
|
|
216
|
-
|
|
250
|
+
h,
|
|
251
|
+
F ? L : ""
|
|
217
252
|
],
|
|
218
|
-
queryFn: () =>
|
|
219
|
-
|
|
220
|
-
filter: JSON.stringify({ [
|
|
221
|
-
fields:
|
|
253
|
+
queryFn: () => S.request(
|
|
254
|
+
z(`/items/${a}`, {
|
|
255
|
+
filter: JSON.stringify({ [u]: { _eq: i } }),
|
|
256
|
+
fields: F ? `id,${h},${L}` : `id,${h}`,
|
|
222
257
|
limit: 200
|
|
223
258
|
})
|
|
224
259
|
).then(
|
|
225
|
-
(
|
|
226
|
-
const
|
|
260
|
+
(k) => (k.data ?? []).filter(($) => $[h] != null).map(($) => {
|
|
261
|
+
const A = $[h];
|
|
227
262
|
return {
|
|
228
|
-
id: String(typeof
|
|
229
|
-
collection:
|
|
263
|
+
id: String(typeof A == "object" ? A.id : A),
|
|
264
|
+
collection: F ? q($[L]) : null
|
|
230
265
|
};
|
|
231
266
|
})
|
|
232
267
|
).catch(() => []),
|
|
233
268
|
// The fields list depends on the companion leg — wait for it.
|
|
234
|
-
enabled: !!
|
|
269
|
+
enabled: !!N,
|
|
235
270
|
staleTime: 3e4,
|
|
236
271
|
retry: !1
|
|
237
|
-
}),
|
|
238
|
-
return
|
|
239
|
-
D !== void 0 && (
|
|
240
|
-
}, [D,
|
|
241
|
-
|
|
242
|
-
}, [
|
|
243
|
-
|
|
272
|
+
}), E = g == null ? void 0 : g.map((k) => k.id), R = v ?? (F ? ((j = g == null ? void 0 : g.find((k) => k.collection)) == null ? void 0 : j.collection) ?? null : null), D = E == null ? void 0 : E.length;
|
|
273
|
+
return fe(() => {
|
|
274
|
+
D !== void 0 && (w == null || w(D));
|
|
275
|
+
}, [D, w]), fe(() => {
|
|
276
|
+
R && (_ == null || _(R));
|
|
277
|
+
}, [R, _]), N && !R && (!F || g) ? /* @__PURE__ */ t(le, {}) : !E || !R ? /* @__PURE__ */ t("span", { className: "inline-block h-3.5 w-20 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }) : E.length === 0 ? /* @__PURE__ */ t(le, {}) : R === "nivaro_files" && x ? /* @__PURE__ */ t("div", { className: "mt-1", children: /* @__PURE__ */ t(
|
|
278
|
+
cl,
|
|
244
279
|
{
|
|
245
|
-
relation:
|
|
246
|
-
parentId:
|
|
280
|
+
relation: x,
|
|
281
|
+
parentId: i,
|
|
247
282
|
allRelations: [],
|
|
248
283
|
disabled: !0
|
|
249
284
|
}
|
|
250
|
-
) }) : /* @__PURE__ */ t("span", { className: "flex flex-wrap gap-x-1.5 gap-y-0.5", children: (g ?? []).map(({ id:
|
|
285
|
+
) }) : /* @__PURE__ */ t("span", { className: "flex flex-wrap gap-x-1.5 gap-y-0.5", children: (g ?? []).map(({ id: k, collection: $ }, A) => /* @__PURE__ */ p(
|
|
251
286
|
"span",
|
|
252
287
|
{
|
|
253
288
|
className: "inline-flex items-center whitespace-nowrap",
|
|
254
289
|
children: [
|
|
255
|
-
/* @__PURE__ */ t(
|
|
256
|
-
|
|
290
|
+
/* @__PURE__ */ t(rt, { collection: $ ?? R, id: k }),
|
|
291
|
+
A < E.length - 1 && /* @__PURE__ */ t("span", { className: "text-slate-300 dark:text-slate-600", children: "," })
|
|
257
292
|
]
|
|
258
293
|
},
|
|
259
|
-
`${
|
|
294
|
+
`${$ ?? R}:${k}`
|
|
260
295
|
)) });
|
|
261
296
|
}
|
|
262
|
-
function
|
|
297
|
+
function Pl({
|
|
263
298
|
collection: a,
|
|
264
|
-
fkField:
|
|
265
|
-
parentId:
|
|
266
|
-
layoutId:
|
|
267
|
-
presets:
|
|
268
|
-
defaultPreset:
|
|
269
|
-
onCount:
|
|
299
|
+
fkField: u,
|
|
300
|
+
parentId: h,
|
|
301
|
+
layoutId: i,
|
|
302
|
+
presets: w,
|
|
303
|
+
defaultPreset: _,
|
|
304
|
+
onCount: x
|
|
270
305
|
}) {
|
|
271
|
-
const
|
|
306
|
+
const S = Ne(), N = Nt(), m = (w ?? []).filter((l) => l && Array.isArray(l.columns)), [T, F] = H(
|
|
272
307
|
() => {
|
|
273
308
|
var l;
|
|
274
|
-
return
|
|
309
|
+
return m.length >= 2 ? ((l = m.find((d) => d.name === _)) == null ? void 0 : l.name) ?? m[0].name : "__all__";
|
|
275
310
|
}
|
|
276
|
-
), { data:
|
|
311
|
+
), { data: L } = U({
|
|
277
312
|
queryKey: ["cbv-collection-meta", a],
|
|
278
|
-
queryFn: () =>
|
|
313
|
+
queryFn: () => S.request(z(`/collections/${a}`)).then((l) => l.data),
|
|
279
314
|
staleTime: 10 * 6e4,
|
|
280
315
|
retry: !1
|
|
281
|
-
}),
|
|
316
|
+
}), q = (l) => {
|
|
282
317
|
var d;
|
|
283
|
-
return ((d = ((
|
|
318
|
+
return ((d = ((L == null ? void 0 : L.relations) ?? []).find(
|
|
284
319
|
(o) => o.many_collection === a && o.many_field === l && o.one_collection
|
|
285
320
|
)) == null ? void 0 : d.one_collection) ?? null;
|
|
286
|
-
}, { data:
|
|
287
|
-
queryKey: ["rrv-cols", a,
|
|
288
|
-
queryFn: () =>
|
|
289
|
-
|
|
321
|
+
}, { data: v } = U({
|
|
322
|
+
queryKey: ["rrv-cols", a, i ?? null],
|
|
323
|
+
queryFn: () => S.request(
|
|
324
|
+
z(`/field-config/${a}`, i ? { layout_id: i } : {})
|
|
290
325
|
).then((l) => ({
|
|
291
326
|
// Lines carry their own number — sort by it and show it first.
|
|
292
327
|
lineNo: (l.data ?? []).some((d) => d.field === "line_number"),
|
|
293
328
|
cols: (l.data ?? []).filter(
|
|
294
|
-
(d) => !d.hidden && !d.field.startsWith("__") && (!d.field.includes(".") || d.interface === "relation-path") && d.field !==
|
|
329
|
+
(d) => !d.hidden && !d.field.startsWith("__") && (!d.field.includes(".") || d.interface === "relation-path") && d.field !== u && ((i ? d.layout_assigned : !0) ?? !0) && (d.interface === "relation-path" || [
|
|
295
330
|
"string",
|
|
296
331
|
"text",
|
|
297
332
|
"integer",
|
|
@@ -303,69 +338,69 @@ function Dl({
|
|
|
303
338
|
"timestamp",
|
|
304
339
|
"uuid"
|
|
305
340
|
].includes(d.type ?? ""))
|
|
306
|
-
).filter((d, o,
|
|
341
|
+
).filter((d, o, b) => b.findIndex((O) => O.field === d.field) === o)
|
|
307
342
|
})),
|
|
308
343
|
staleTime: 5 * 6e4,
|
|
309
344
|
retry: !1
|
|
310
|
-
}), g = (
|
|
311
|
-
if (!
|
|
312
|
-
const l = new Set(
|
|
345
|
+
}), g = (v == null ? void 0 : v.cols) ?? [], E = !!(v != null && v.lineNo), R = T !== "__all__" ? m.find((l) => l.name === T) : null, D = ke(() => {
|
|
346
|
+
if (!R) return g;
|
|
347
|
+
const l = new Set(R.columns), d = g.filter((o) => l.has(o.field));
|
|
313
348
|
return d.length > 0 ? d : g;
|
|
314
|
-
}, [g,
|
|
349
|
+
}, [g, R]), [j, k] = H(""), [$, A] = H(1), [ie, V] = H({}), Z = Gt(ie, 350), Ee = ke(() => {
|
|
315
350
|
const l = [
|
|
316
|
-
{ path: [
|
|
351
|
+
{ path: [u], op: "_eq", value: h }
|
|
317
352
|
];
|
|
318
353
|
for (const [d, o] of Object.entries(Z)) {
|
|
319
354
|
if (!(o != null && o.value.trim())) continue;
|
|
320
|
-
const
|
|
321
|
-
l.push({ path: [d], op: o.op, value:
|
|
355
|
+
const b = o.value.trim(), O = Number(b), W = o.op === "_contains" ? b : b === "true" || b === "false" ? b === "true" : Number.isNaN(O) ? b : O;
|
|
356
|
+
l.push({ path: [d], op: o.op, value: W });
|
|
322
357
|
}
|
|
323
358
|
return JSON.stringify(l);
|
|
324
|
-
}, [Z,
|
|
325
|
-
data:
|
|
326
|
-
isLoading:
|
|
327
|
-
isFetching:
|
|
359
|
+
}, [Z, u, h]), f = 25, {
|
|
360
|
+
data: G,
|
|
361
|
+
isLoading: pe,
|
|
362
|
+
isFetching: De
|
|
328
363
|
} = U({
|
|
329
|
-
queryKey: ["rrv-rows", a,
|
|
330
|
-
queryFn: () =>
|
|
331
|
-
|
|
332
|
-
limit:
|
|
333
|
-
page:
|
|
334
|
-
...
|
|
335
|
-
conditions:
|
|
364
|
+
queryKey: ["rrv-rows", a, u, h, j, E, $, Ee],
|
|
365
|
+
queryFn: () => S.request(
|
|
366
|
+
z(`/items/${a}`, {
|
|
367
|
+
limit: f,
|
|
368
|
+
page: $,
|
|
369
|
+
...j ? { sort: j } : E ? { sort: "line_number" } : {},
|
|
370
|
+
conditions: Ee
|
|
336
371
|
})
|
|
337
372
|
),
|
|
338
373
|
placeholderData: (l) => l,
|
|
339
374
|
staleTime: 3e4,
|
|
340
375
|
retry: !1
|
|
341
|
-
}),
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
}, [
|
|
345
|
-
const
|
|
376
|
+
}), P = (G == null ? void 0 : G.data) ?? [], ee = (G == null ? void 0 : G.total) ?? P.length, I = Object.values(Z).some((l) => !!(l != null && l.value.trim()));
|
|
377
|
+
fe(() => {
|
|
378
|
+
G && !I && (x == null || x(ee));
|
|
379
|
+
}, [G, I, ee, x]);
|
|
380
|
+
const he = D.filter((l) => l.field.includes(".")), be = P.map((l) => String(l.id)), { data: Y } = U({
|
|
346
381
|
queryKey: [
|
|
347
382
|
"rrv-resolve-paths",
|
|
348
383
|
a,
|
|
349
|
-
|
|
350
|
-
|
|
384
|
+
he.map((l) => l.field).join(","),
|
|
385
|
+
be.join(",")
|
|
351
386
|
],
|
|
352
|
-
queryFn: () =>
|
|
353
|
-
|
|
354
|
-
ids:
|
|
355
|
-
paths:
|
|
387
|
+
queryFn: () => S.request(
|
|
388
|
+
z(`/items/${a}/resolve-paths`, {
|
|
389
|
+
ids: be.join(","),
|
|
390
|
+
paths: he.map((l) => l.field).join(",")
|
|
356
391
|
})
|
|
357
392
|
).then((l) => l.data ?? { rows: {}, targets: {} }).catch(() => ({ rows: {}, targets: {} })),
|
|
358
|
-
enabled:
|
|
393
|
+
enabled: he.length > 0 && be.length > 0,
|
|
359
394
|
staleTime: 3e4
|
|
360
|
-
}),
|
|
361
|
-
|
|
362
|
-
const
|
|
363
|
-
return o ?
|
|
395
|
+
}), M = E && P.some((l) => l.line_number != null), se = Math.max(1, Math.ceil(ee / f)), de = (l, d, o) => {
|
|
396
|
+
A(1), V((b) => {
|
|
397
|
+
const O = { ...b };
|
|
398
|
+
return o ? O[l] = { op: d, value: o } : delete O[l], O;
|
|
364
399
|
});
|
|
365
|
-
},
|
|
366
|
-
|
|
400
|
+
}, He = (l) => {
|
|
401
|
+
A(1), k((d) => d === l ? `-${l}` : d === `-${l}` ? "" : l);
|
|
367
402
|
};
|
|
368
|
-
if (
|
|
403
|
+
if (pe)
|
|
369
404
|
return /* @__PURE__ */ t("div", { className: "space-y-1.5 py-2", children: [0, 1, 2].map((l) => /* @__PURE__ */ t(
|
|
370
405
|
"div",
|
|
371
406
|
{
|
|
@@ -373,22 +408,22 @@ function Dl({
|
|
|
373
408
|
},
|
|
374
409
|
l
|
|
375
410
|
)) });
|
|
376
|
-
if (
|
|
411
|
+
if (P.length === 0 && Object.keys(Z).length === 0)
|
|
377
412
|
return /* @__PURE__ */ t("p", { className: "py-3 text-[12px] text-slate-400", children: "No records" });
|
|
378
|
-
const
|
|
379
|
-
var
|
|
413
|
+
const Ue = (l, d) => {
|
|
414
|
+
var W, re;
|
|
380
415
|
if (d.field.includes(".")) {
|
|
381
|
-
const ne = (
|
|
382
|
-
if (!
|
|
416
|
+
const ne = (W = Y == null ? void 0 : Y.rows[String(l.id)]) == null ? void 0 : W[d.field];
|
|
417
|
+
if (!Y)
|
|
383
418
|
return /* @__PURE__ */ t("span", { className: "inline-block h-3 w-14 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" });
|
|
384
419
|
if (!ne || ne.value === "") return /* @__PURE__ */ t(le, {});
|
|
385
|
-
const qe =
|
|
386
|
-
return
|
|
420
|
+
const qe = Y.targets[d.field], ge = (re = ne.ids) == null ? void 0 : re[0];
|
|
421
|
+
return N && qe && ge ? /* @__PURE__ */ t(et, { collection: qe, id: ge, children: /* @__PURE__ */ t(
|
|
387
422
|
"button",
|
|
388
423
|
{
|
|
389
424
|
type: "button",
|
|
390
|
-
onClick: (
|
|
391
|
-
|
|
425
|
+
onClick: (Ve) => {
|
|
426
|
+
Ve.stopPropagation(), N.open({ collection: qe, itemId: String(ge) });
|
|
392
427
|
},
|
|
393
428
|
className: "inline-block max-w-full truncate text-left align-bottom underline decoration-slate-300 underline-offset-2 hover:text-[#007a99] dark:decoration-slate-600 dark:hover:text-nvr-cyan",
|
|
394
429
|
children: ne.value
|
|
@@ -396,19 +431,19 @@ function Dl({
|
|
|
396
431
|
) }) : ne.value;
|
|
397
432
|
}
|
|
398
433
|
const o = l[d.field];
|
|
399
|
-
if (d.type === "boolean" && o == null) return /* @__PURE__ */ t(
|
|
434
|
+
if (d.type === "boolean" && o == null) return /* @__PURE__ */ t(Ie, { value: !1 });
|
|
400
435
|
if (o == null || o === "") return /* @__PURE__ */ t(le, {});
|
|
401
|
-
const
|
|
402
|
-
if (
|
|
403
|
-
return /* @__PURE__ */ t("span", { className: "inline-block", children: /* @__PURE__ */ t(
|
|
404
|
-
if (
|
|
405
|
-
if (d.type === "boolean") return /* @__PURE__ */ t(
|
|
436
|
+
const b = q(d.field);
|
|
437
|
+
if (b === "nivaro_users")
|
|
438
|
+
return /* @__PURE__ */ t("span", { className: "inline-block", children: /* @__PURE__ */ t(wt, { userId: String(o), size: "compact" }) });
|
|
439
|
+
if (b) return /* @__PURE__ */ t(rt, { collection: b, id: o });
|
|
440
|
+
if (d.type === "boolean") return /* @__PURE__ */ t(Ie, { value: o });
|
|
406
441
|
if (d.type === "decimal" || d.type === "float") return tt(o);
|
|
407
|
-
if (d.type === "integer") return
|
|
408
|
-
if (d.type === "date" || d.type === "datetime" || d.type === "timestamp") return
|
|
409
|
-
const
|
|
410
|
-
return
|
|
411
|
-
}, oe = (l) => ["decimal", "float", "integer"].includes(l.type ?? "") && !
|
|
442
|
+
if (d.type === "integer") return Be(o);
|
|
443
|
+
if (d.type === "date" || d.type === "datetime" || d.type === "timestamp") return St(o);
|
|
444
|
+
const O = String(o);
|
|
445
|
+
return O.length > 48 ? `${O.slice(0, 48)}…` : O;
|
|
446
|
+
}, oe = (l) => ["decimal", "float", "integer"].includes(l.type ?? "") && !q(l.field) && !l.field.includes("."), Pe = (l) => {
|
|
412
447
|
const d = l.options;
|
|
413
448
|
if (!d) return {};
|
|
414
449
|
if (typeof d == "string")
|
|
@@ -424,21 +459,21 @@ function Dl({
|
|
|
424
459
|
}, Me = D.some((l) => we(l)), Se = (l) => {
|
|
425
460
|
const d = we(l);
|
|
426
461
|
if (!d) return null;
|
|
427
|
-
const o =
|
|
428
|
-
let
|
|
429
|
-
if (d === "count" ?
|
|
430
|
-
const
|
|
431
|
-
return d === "count" ||
|
|
432
|
-
}, $e = (l) => !
|
|
462
|
+
const o = P.map((W) => Number(W[l.field])).filter((W) => !Number.isNaN(W));
|
|
463
|
+
let b = null;
|
|
464
|
+
if (d === "count" ? b = P.length : o.length > 0 && (d === "sum" ? b = o.reduce((W, re) => W + re, 0) : d === "avg" ? b = o.reduce((W, re) => W + re, 0) / o.length : d === "min" ? b = Math.min(...o) : d === "max" && (b = Math.max(...o))), b === null) return "—";
|
|
465
|
+
const O = Pe(l).format;
|
|
466
|
+
return d === "count" || O === "int" ? Be(Math.round(b)) : O === "currency" || l.type === "decimal" || l.type === "float" ? tt(b) : d === "avg" ? b.toFixed(2) : Be(b);
|
|
467
|
+
}, $e = (l) => !q(l.field) && !l.field.includes("."), We = (l) => q(l.field) || l.field.includes(".") ? null : l.type === "boolean" ? "bool" : ["integer", "decimal", "float"].includes(l.type ?? "") ? "num" : ["string", "text"].includes(l.type ?? "") ? "text" : null, Fe = D.some((l) => We(l) != null);
|
|
433
468
|
return /* @__PURE__ */ p("div", { children: [
|
|
434
|
-
|
|
469
|
+
m.length >= 2 && /* @__PURE__ */ t("div", { className: "mb-1.5 flex flex-wrap items-center gap-1", "data-read-presets": !0, children: [
|
|
435
470
|
{ name: "__all__", label: "All" },
|
|
436
|
-
...
|
|
471
|
+
...m.map((l) => ({ name: l.name, label: l.name }))
|
|
437
472
|
].map((l) => /* @__PURE__ */ t(
|
|
438
473
|
"button",
|
|
439
474
|
{
|
|
440
475
|
type: "button",
|
|
441
|
-
onClick: () =>
|
|
476
|
+
onClick: () => F(l.name),
|
|
442
477
|
"aria-pressed": T === l.name,
|
|
443
478
|
className: `rounded-full border px-2 py-0.5 text-[10.5px] font-medium transition-colors ${T === l.name ? "border-nvr-cyan bg-nvr-cyan/10 text-[#007a99] dark:text-nvr-cyan" : "border-slate-200 text-slate-500 hover:bg-slate-50 dark:border-slate-700 dark:text-slate-400 dark:hover:bg-slate-800"}`,
|
|
444
479
|
children: l.label
|
|
@@ -448,21 +483,21 @@ function Dl({
|
|
|
448
483
|
/* @__PURE__ */ t(
|
|
449
484
|
"div",
|
|
450
485
|
{
|
|
451
|
-
className: `overflow-x-auto rounded-md border border-slate-200 dark:border-slate-700 ${
|
|
486
|
+
className: `overflow-x-auto rounded-md border border-slate-200 dark:border-slate-700 ${De && !pe ? "opacity-70" : ""}`,
|
|
452
487
|
children: /* @__PURE__ */ p("table", { className: "w-full", style: { fontVariantNumeric: "tabular-nums" }, children: [
|
|
453
488
|
/* @__PURE__ */ p("thead", { children: [
|
|
454
489
|
/* @__PURE__ */ p("tr", { className: "border-b border-slate-200 bg-slate-50 dark:border-slate-700 dark:bg-slate-800", children: [
|
|
455
|
-
|
|
490
|
+
M && /* @__PURE__ */ t("th", { className: "h-7 w-8 px-2 text-right text-[9.5px] font-bold uppercase tracking-wider text-slate-400", children: "#" }),
|
|
456
491
|
D.map((l) => {
|
|
457
|
-
const d =
|
|
492
|
+
const d = j === l.field || j === `-${l.field}`;
|
|
458
493
|
return /* @__PURE__ */ p(
|
|
459
494
|
"th",
|
|
460
495
|
{
|
|
461
|
-
onClick: () => $e(l) &&
|
|
496
|
+
onClick: () => $e(l) && He(l.field),
|
|
462
497
|
className: `h-7 select-none whitespace-nowrap px-2.5 text-[9.5px] font-bold uppercase tracking-wider text-slate-500 dark:text-slate-400 ${oe(l) ? "text-right" : "text-left"} ${$e(l) ? "cursor-pointer hover:text-slate-700 dark:hover:text-slate-200" : ""}`,
|
|
463
498
|
children: [
|
|
464
499
|
l.label || Ze(l.field),
|
|
465
|
-
$e(l) && /* @__PURE__ */ t("span", { className: d ? "ml-0.5 text-[#00a5cc]" : "ml-0.5 text-slate-300", children: d ?
|
|
500
|
+
$e(l) && /* @__PURE__ */ t("span", { className: d ? "ml-0.5 text-[#00a5cc]" : "ml-0.5 text-slate-300", children: d ? j.startsWith("-") ? "▼" : "▲" : "⇅" })
|
|
466
501
|
]
|
|
467
502
|
},
|
|
468
503
|
l.field
|
|
@@ -470,15 +505,15 @@ function Dl({
|
|
|
470
505
|
})
|
|
471
506
|
] }),
|
|
472
507
|
Fe && /* @__PURE__ */ p("tr", { className: "border-b border-slate-200 bg-slate-50 dark:border-slate-700 dark:bg-slate-800", children: [
|
|
473
|
-
|
|
508
|
+
M && /* @__PURE__ */ t("th", { className: "px-1.5 py-1" }),
|
|
474
509
|
D.map((l) => {
|
|
475
|
-
const d =
|
|
510
|
+
const d = We(l), o = ie[l.field];
|
|
476
511
|
return /* @__PURE__ */ p("th", { className: "px-1.5 py-1 font-normal", children: [
|
|
477
512
|
d === "text" && /* @__PURE__ */ t(
|
|
478
513
|
"input",
|
|
479
514
|
{
|
|
480
515
|
value: (o == null ? void 0 : o.value) ?? "",
|
|
481
|
-
onChange: (
|
|
516
|
+
onChange: (b) => de(l.field, "_contains", b.target.value),
|
|
482
517
|
placeholder: "Filter…",
|
|
483
518
|
"aria-label": `Filter ${l.field}`,
|
|
484
519
|
className: "h-6 w-full min-w-[56px] rounded border border-slate-200 bg-white px-1.5 text-[10.5px] font-normal normal-case tracking-normal outline-none focus:border-nvr-cyan/50 dark:border-slate-600 dark:bg-slate-900 dark:text-slate-100"
|
|
@@ -486,10 +521,10 @@ function Dl({
|
|
|
486
521
|
),
|
|
487
522
|
d === "num" && /* @__PURE__ */ p("span", { className: "flex items-center gap-0.5", children: [
|
|
488
523
|
/* @__PURE__ */ t(
|
|
489
|
-
|
|
524
|
+
xt,
|
|
490
525
|
{
|
|
491
526
|
value: (o == null ? void 0 : o.op) ?? "_eq",
|
|
492
|
-
onChange: (
|
|
527
|
+
onChange: (b) => de(l.field, b, (o == null ? void 0 : o.value) ?? ""),
|
|
493
528
|
options: [
|
|
494
529
|
{ value: "_eq", label: "=" },
|
|
495
530
|
{ value: "_gte", label: "≥" },
|
|
@@ -503,17 +538,17 @@ function Dl({
|
|
|
503
538
|
{
|
|
504
539
|
type: "number",
|
|
505
540
|
value: (o == null ? void 0 : o.value) ?? "",
|
|
506
|
-
onChange: (
|
|
541
|
+
onChange: (b) => de(l.field, (o == null ? void 0 : o.op) ?? "_eq", b.target.value),
|
|
507
542
|
"aria-label": `Filter ${l.field}`,
|
|
508
543
|
className: "h-6 w-full min-w-[48px] rounded border border-slate-200 bg-white px-1 text-[10.5px] font-normal outline-none focus:border-nvr-cyan/50 dark:border-slate-600 dark:bg-slate-900 dark:text-slate-100"
|
|
509
544
|
}
|
|
510
545
|
)
|
|
511
546
|
] }),
|
|
512
547
|
d === "bool" && /* @__PURE__ */ t(
|
|
513
|
-
|
|
548
|
+
xt,
|
|
514
549
|
{
|
|
515
550
|
value: (o == null ? void 0 : o.value) ?? "",
|
|
516
|
-
onChange: (
|
|
551
|
+
onChange: (b) => de(l.field, "_eq", b),
|
|
517
552
|
options: [
|
|
518
553
|
{ value: "", label: "All" },
|
|
519
554
|
{ value: "true", label: "Yes" },
|
|
@@ -528,26 +563,26 @@ function Dl({
|
|
|
528
563
|
] })
|
|
529
564
|
] }),
|
|
530
565
|
/* @__PURE__ */ p("tbody", { children: [
|
|
531
|
-
|
|
566
|
+
P.length === 0 && /* @__PURE__ */ t("tr", { children: /* @__PURE__ */ t(
|
|
532
567
|
"td",
|
|
533
568
|
{
|
|
534
|
-
colSpan: D.length + (
|
|
569
|
+
colSpan: D.length + (M ? 1 : 0),
|
|
535
570
|
className: "py-4 text-center text-[12px] text-slate-400",
|
|
536
571
|
children: "No matches — adjust filters"
|
|
537
572
|
}
|
|
538
573
|
) }),
|
|
539
|
-
|
|
574
|
+
P.map((l) => /* @__PURE__ */ p(
|
|
540
575
|
"tr",
|
|
541
576
|
{
|
|
542
|
-
onClick:
|
|
543
|
-
className: `border-b border-slate-100 last:border-0 dark:border-slate-800 ${
|
|
577
|
+
onClick: N ? () => N.open({ collection: a, itemId: String(l.id) }) : void 0,
|
|
578
|
+
className: `border-b border-slate-100 last:border-0 dark:border-slate-800 ${N ? "cursor-pointer hover:bg-nvr-cyan/5 dark:hover:bg-nvr-cyan/10" : ""}`,
|
|
544
579
|
children: [
|
|
545
|
-
|
|
580
|
+
M && /* @__PURE__ */ t("td", { className: "px-2 py-1.5 text-right text-[11px] tabular-nums text-slate-400", children: l.line_number == null ? "" : String(l.line_number) }),
|
|
546
581
|
D.map((d) => /* @__PURE__ */ t(
|
|
547
582
|
"td",
|
|
548
583
|
{
|
|
549
584
|
className: `whitespace-nowrap px-2.5 py-1.5 text-[12px] text-slate-700 dark:text-slate-200 ${oe(d) ? "text-right" : ""}`,
|
|
550
|
-
children:
|
|
585
|
+
children: Ue(l, d)
|
|
551
586
|
},
|
|
552
587
|
d.field
|
|
553
588
|
))
|
|
@@ -556,20 +591,20 @@ function Dl({
|
|
|
556
591
|
String(l.id)
|
|
557
592
|
))
|
|
558
593
|
] }),
|
|
559
|
-
Me &&
|
|
594
|
+
Me && P.length > 0 && /* @__PURE__ */ t("tfoot", { children: /* @__PURE__ */ p(
|
|
560
595
|
"tr",
|
|
561
596
|
{
|
|
562
597
|
"data-read-grid-footer": !0,
|
|
563
598
|
className: "border-t border-slate-200 bg-slate-50 text-[11px] font-medium text-slate-600 dark:border-slate-700 dark:bg-slate-800/60 dark:text-slate-300",
|
|
564
599
|
children: [
|
|
565
|
-
|
|
600
|
+
M && /* @__PURE__ */ t("td", {}),
|
|
566
601
|
D.map((l) => {
|
|
567
602
|
const d = we(l);
|
|
568
603
|
return /* @__PURE__ */ t(
|
|
569
604
|
"td",
|
|
570
605
|
{
|
|
571
606
|
className: `whitespace-nowrap px-2.5 py-1.5 ${oe(l) ? "text-right" : ""}`,
|
|
572
|
-
children: d && /* @__PURE__ */ p(
|
|
607
|
+
children: d && /* @__PURE__ */ p(me, { children: [
|
|
573
608
|
/* @__PURE__ */ t("span", { className: "mr-1 font-mono text-[10px] text-slate-400", children: d.toUpperCase() }),
|
|
574
609
|
/* @__PURE__ */ t("span", { className: "tabular-nums", children: Se(l) })
|
|
575
610
|
] })
|
|
@@ -583,11 +618,11 @@ function Dl({
|
|
|
583
618
|
] })
|
|
584
619
|
}
|
|
585
620
|
),
|
|
586
|
-
ee >
|
|
621
|
+
ee > f && /* @__PURE__ */ p("div", { className: "mt-1.5 flex items-center justify-between", children: [
|
|
587
622
|
/* @__PURE__ */ p("p", { className: "text-[11px] tabular-nums text-slate-400", children: [
|
|
588
|
-
((
|
|
623
|
+
(($ - 1) * f + 1).toLocaleString("en-US"),
|
|
589
624
|
"–",
|
|
590
|
-
Math.min(
|
|
625
|
+
Math.min($ * f, ee).toLocaleString("en-US"),
|
|
591
626
|
" of",
|
|
592
627
|
" ",
|
|
593
628
|
ee.toLocaleString("en-US")
|
|
@@ -597,8 +632,8 @@ function Dl({
|
|
|
597
632
|
"button",
|
|
598
633
|
{
|
|
599
634
|
type: "button",
|
|
600
|
-
disabled:
|
|
601
|
-
onClick: () =>
|
|
635
|
+
disabled: $ <= 1,
|
|
636
|
+
onClick: () => A(1),
|
|
602
637
|
"aria-label": "First page",
|
|
603
638
|
"data-tip": "First page",
|
|
604
639
|
className: "h-6 rounded px-2 text-[11px] text-slate-600 hover:bg-slate-100 disabled:opacity-30 dark:text-slate-300 dark:hover:bg-slate-800",
|
|
@@ -609,14 +644,14 @@ function Dl({
|
|
|
609
644
|
"button",
|
|
610
645
|
{
|
|
611
646
|
type: "button",
|
|
612
|
-
disabled:
|
|
613
|
-
onClick: () =>
|
|
647
|
+
disabled: $ <= 1,
|
|
648
|
+
onClick: () => A((l) => Math.max(1, l - 1)),
|
|
614
649
|
className: "h-6 rounded px-2 text-[11px] text-slate-600 hover:bg-slate-100 disabled:opacity-30 dark:text-slate-300 dark:hover:bg-slate-800",
|
|
615
650
|
children: "← Prev"
|
|
616
651
|
}
|
|
617
652
|
),
|
|
618
653
|
/* @__PURE__ */ p("span", { className: "min-w-[48px] text-center text-[11px] tabular-nums text-slate-500", children: [
|
|
619
|
-
|
|
654
|
+
$,
|
|
620
655
|
" / ",
|
|
621
656
|
se.toLocaleString("en-US")
|
|
622
657
|
] }),
|
|
@@ -624,8 +659,8 @@ function Dl({
|
|
|
624
659
|
"button",
|
|
625
660
|
{
|
|
626
661
|
type: "button",
|
|
627
|
-
disabled:
|
|
628
|
-
onClick: () =>
|
|
662
|
+
disabled: $ >= se,
|
|
663
|
+
onClick: () => A((l) => l + 1),
|
|
629
664
|
className: "h-6 rounded px-2 text-[11px] text-slate-600 hover:bg-slate-100 disabled:opacity-30 dark:text-slate-300 dark:hover:bg-slate-800",
|
|
630
665
|
children: "Next →"
|
|
631
666
|
}
|
|
@@ -634,8 +669,8 @@ function Dl({
|
|
|
634
669
|
"button",
|
|
635
670
|
{
|
|
636
671
|
type: "button",
|
|
637
|
-
disabled:
|
|
638
|
-
onClick: () =>
|
|
672
|
+
disabled: $ >= se,
|
|
673
|
+
onClick: () => A(se),
|
|
639
674
|
"aria-label": "Last page",
|
|
640
675
|
"data-tip": "Last page",
|
|
641
676
|
className: "h-6 rounded px-2 text-[11px] text-slate-600 hover:bg-slate-100 disabled:opacity-30 dark:text-slate-300 dark:hover:bg-slate-800",
|
|
@@ -646,61 +681,59 @@ function Dl({
|
|
|
646
681
|
] })
|
|
647
682
|
] });
|
|
648
683
|
}
|
|
649
|
-
function
|
|
684
|
+
function _t({
|
|
650
685
|
collection: a,
|
|
651
|
-
itemId:
|
|
652
|
-
layoutData:
|
|
653
|
-
design:
|
|
654
|
-
flush:
|
|
655
|
-
renderSlot:
|
|
656
|
-
integrityMarks:
|
|
657
|
-
renderGrid:
|
|
658
|
-
onEditSection:
|
|
659
|
-
gridCounts:
|
|
686
|
+
itemId: u,
|
|
687
|
+
layoutData: h,
|
|
688
|
+
design: i,
|
|
689
|
+
flush: w,
|
|
690
|
+
renderSlot: _,
|
|
691
|
+
integrityMarks: x,
|
|
692
|
+
renderGrid: S,
|
|
693
|
+
onEditSection: N,
|
|
694
|
+
gridCounts: m
|
|
660
695
|
}) {
|
|
661
|
-
var
|
|
662
|
-
const T = Ne(),
|
|
663
|
-
() =>
|
|
664
|
-
...
|
|
665
|
-
layout:
|
|
666
|
-
} :
|
|
667
|
-
[
|
|
668
|
-
),
|
|
669
|
-
kind:
|
|
696
|
+
var ct;
|
|
697
|
+
const T = Ne(), F = hl(), L = i ? i.record ?? {} : null, q = !!(i != null && i.context.showHidden), v = i ? String(((ct = i.record) == null ? void 0 : ct.id) ?? "") : u ?? "", g = ke(
|
|
698
|
+
() => i ? {
|
|
699
|
+
...i.layout,
|
|
700
|
+
layout: i.layout.layout ?? { id: 0, name: "" }
|
|
701
|
+
} : h,
|
|
702
|
+
[i, h]
|
|
703
|
+
), E = (e) => ({
|
|
704
|
+
kind: Le(e.field) ? "slot" : "field",
|
|
670
705
|
field: e.field,
|
|
671
706
|
group_key: e.group_key ?? null
|
|
672
|
-
}),
|
|
707
|
+
}), R = (e, r, s = !1) => i ? /* @__PURE__ */ t(kl, { target: e, children: s ? /* @__PURE__ */ t("div", { "data-design-hidden": !0, className: "opacity-40", children: r }) : r }) : r, D = ke(
|
|
673
708
|
() => [
|
|
674
709
|
...new Set(
|
|
675
|
-
(
|
|
710
|
+
(i ? [] : (g == null ? void 0 : g.assignments) ?? []).map((e) => e.field).filter((e) => e && !e.startsWith("__") && !e.includes("."))
|
|
676
711
|
)
|
|
677
712
|
].sort(),
|
|
678
|
-
[g,
|
|
679
|
-
), { data:
|
|
680
|
-
const r =
|
|
713
|
+
[g, i]
|
|
714
|
+
), { data: j } = ul(a, v, D), k = (e) => {
|
|
715
|
+
const r = j == null ? void 0 : j[e];
|
|
681
716
|
if (!r) return null;
|
|
682
|
-
const
|
|
717
|
+
const s = r.via !== "user";
|
|
683
718
|
return r.caller && r.activity_id ? /* @__PURE__ */ t(
|
|
684
|
-
|
|
719
|
+
ol,
|
|
685
720
|
{
|
|
686
721
|
activityId: r.activity_id,
|
|
687
722
|
callerName: r.caller.name,
|
|
688
723
|
collection: a,
|
|
689
|
-
itemId:
|
|
724
|
+
itemId: v,
|
|
690
725
|
children: /* @__PURE__ */ p(
|
|
691
726
|
"button",
|
|
692
727
|
{
|
|
693
728
|
type: "button",
|
|
694
729
|
"data-field-touch": e,
|
|
695
730
|
"data-field-touch-caller": r.caller.key,
|
|
696
|
-
"data-tip": `Changed ${
|
|
697
|
-
"aria-label": `Changed ${
|
|
698
|
-
className: "ml-1 inline-flex items-center gap-1 rounded-full bg-amber-50 px-1.5 align-middle text-[9.5px] font-medium leading-4 text-amber-800 hover:bg-amber-100 dark:bg-amber-400/10 dark:text-amber-300 dark:hover:bg-amber-400/20",
|
|
731
|
+
"data-tip": `Changed ${je(r.at)} by ${r.caller.name} (through the API) — click for the request`,
|
|
732
|
+
"aria-label": `Changed ${je(r.at)} by ${r.caller.name} through the API`,
|
|
733
|
+
className: "ml-1 inline-flex min-w-0 items-center gap-1 overflow-hidden rounded-full bg-amber-50 px-1.5 align-middle text-[9.5px] font-medium leading-4 text-amber-800 hover:bg-amber-100 dark:bg-amber-400/10 dark:text-amber-300 dark:hover:bg-amber-400/20",
|
|
699
734
|
children: [
|
|
700
|
-
/* @__PURE__ */ t("span", { className: "h-1.5 w-1.5 rounded-full bg-amber-400", "aria-hidden": !0 }),
|
|
701
|
-
r.caller.name,
|
|
702
|
-
" · ",
|
|
703
|
-
/* @__PURE__ */ t(Fl, { value: r.at })
|
|
735
|
+
/* @__PURE__ */ t("span", { className: "h-1.5 w-1.5 shrink-0 rounded-full bg-amber-400", "aria-hidden": !0 }),
|
|
736
|
+
/* @__PURE__ */ t(Cl, { name: r.caller.name, at: r.at })
|
|
704
737
|
]
|
|
705
738
|
}
|
|
706
739
|
)
|
|
@@ -709,27 +742,27 @@ function xt({
|
|
|
709
742
|
"span",
|
|
710
743
|
{
|
|
711
744
|
"data-field-touch": e,
|
|
712
|
-
"data-tip": `Changed ${
|
|
745
|
+
"data-tip": `Changed ${je(r.at)} by ${r.who}${s ? ` · ${r.via}` : ""}`,
|
|
713
746
|
role: "img",
|
|
714
|
-
"aria-label": `Changed ${
|
|
715
|
-
className: `ml-1 inline-block h-1.5 w-1.5 rounded-full align-middle ${
|
|
747
|
+
"aria-label": `Changed ${je(r.at)} by ${r.who}`,
|
|
748
|
+
className: `ml-1 inline-block h-1.5 w-1.5 shrink-0 rounded-full align-middle ${s ? "bg-amber-400" : "bg-slate-300 dark:bg-slate-600"}`
|
|
716
749
|
}
|
|
717
750
|
);
|
|
718
|
-
}, { data:
|
|
719
|
-
() =>
|
|
720
|
-
[
|
|
751
|
+
}, { data: $ } = $l(a, v, !!x && !i), A = ke(
|
|
752
|
+
() => x && ($ != null && $.enabled) ? Fl($.findings) : null,
|
|
753
|
+
[x, $]
|
|
721
754
|
), ie = ({ field: e }) => {
|
|
722
|
-
const r =
|
|
755
|
+
const r = A == null ? void 0 : A.get(e);
|
|
723
756
|
if (!r || r.length === 0) return null;
|
|
724
|
-
const
|
|
757
|
+
const s = r.map((c) => c.message || c.rule).join(`
|
|
725
758
|
`);
|
|
726
759
|
return /* @__PURE__ */ t(
|
|
727
760
|
"span",
|
|
728
761
|
{
|
|
729
762
|
"data-integrity-mark": e,
|
|
730
|
-
"data-tip":
|
|
763
|
+
"data-tip": s,
|
|
731
764
|
role: "img",
|
|
732
|
-
"aria-label": `${r.length} data integrity issue${r.length === 1 ? "" : "s"}: ${
|
|
765
|
+
"aria-label": `${r.length} data integrity issue${r.length === 1 ? "" : "s"}: ${s}`,
|
|
733
766
|
className: "ml-1.5 inline-flex h-[14px] min-w-[14px] items-center justify-center rounded-full bg-amber-400/90 px-1 align-middle text-[9px] font-bold leading-none text-amber-950 dark:bg-amber-400 dark:text-amber-950",
|
|
734
767
|
children: r.length > 1 ? r.length : "!"
|
|
735
768
|
}
|
|
@@ -737,225 +770,225 @@ function xt({
|
|
|
737
770
|
}, { data: V } = U({
|
|
738
771
|
queryKey: ["cbv-collection-meta", a],
|
|
739
772
|
queryFn: () => T.request(
|
|
740
|
-
|
|
773
|
+
z(`/collections/${a}`)
|
|
741
774
|
).then((e) => e.data),
|
|
742
775
|
staleTime: 10 * 6e4,
|
|
743
776
|
retry: !1
|
|
744
|
-
}), Z =
|
|
745
|
-
queryKey: ["rrv-record", a,
|
|
746
|
-
enabled: !
|
|
747
|
-
queryFn: () => T.request(
|
|
748
|
-
initialData: () => Z.getQueryData(["item", a,
|
|
777
|
+
}), Z = kt(), { data: Ee } = U({
|
|
778
|
+
queryKey: ["rrv-record", a, v],
|
|
779
|
+
enabled: !i,
|
|
780
|
+
queryFn: () => T.request(z(`/items/${a}/${v}`)).then((e) => e.data),
|
|
781
|
+
initialData: () => Z.getQueryData(["item", a, v]) ?? void 0,
|
|
749
782
|
initialDataUpdatedAt: () => {
|
|
750
783
|
var e;
|
|
751
|
-
return (e = Z.getQueryState(["item", a,
|
|
784
|
+
return (e = Z.getQueryState(["item", a, v])) == null ? void 0 : e.dataUpdatedAt;
|
|
752
785
|
},
|
|
753
786
|
staleTime: 3e4,
|
|
754
787
|
retry: !1
|
|
755
|
-
}),
|
|
756
|
-
|
|
757
|
-
e.aspectsOnly || e.deleted || (Z.invalidateQueries({ queryKey: ["rrv-record", a,
|
|
788
|
+
}), f = L ?? Ee;
|
|
789
|
+
tl(a, i ? null : v, (e) => {
|
|
790
|
+
e.aspectsOnly || e.deleted || (Z.invalidateQueries({ queryKey: ["rrv-record", a, v] }), Z.invalidateQueries({ queryKey: ["field-touch", a, v] }));
|
|
758
791
|
});
|
|
759
|
-
const
|
|
760
|
-
|
|
761
|
-
const e =
|
|
762
|
-
if (
|
|
763
|
-
const r = Object.keys(
|
|
764
|
-
(c) => !c.startsWith("__") && JSON.stringify(e[c]) !== JSON.stringify(
|
|
792
|
+
const G = Xe(null), [pe, De] = H(() => /* @__PURE__ */ new Set());
|
|
793
|
+
fe(() => {
|
|
794
|
+
const e = G.current;
|
|
795
|
+
if (G.current = f ?? null, i || !e || !f || e === f) return;
|
|
796
|
+
const r = Object.keys(f).filter(
|
|
797
|
+
(c) => !c.startsWith("__") && JSON.stringify(e[c]) !== JSON.stringify(f[c])
|
|
765
798
|
);
|
|
766
799
|
if (r.length === 0) return;
|
|
767
|
-
|
|
768
|
-
const
|
|
769
|
-
return () => clearTimeout(
|
|
770
|
-
}, [
|
|
771
|
-
const
|
|
800
|
+
De(new Set(r));
|
|
801
|
+
const s = setTimeout(() => De(/* @__PURE__ */ new Set()), 2400);
|
|
802
|
+
return () => clearTimeout(s);
|
|
803
|
+
}, [f, i]);
|
|
804
|
+
const P = (e) => pe.has(e) ? " nvr-value-pulse-bg rounded-sm" : "", { data: ee } = U({
|
|
772
805
|
queryKey: ["rrv-field-config", a, g.layout.id],
|
|
773
|
-
enabled: !
|
|
806
|
+
enabled: !i,
|
|
774
807
|
queryFn: () => T.request(
|
|
775
|
-
|
|
808
|
+
z(`/field-config/${a}`, { layout_id: g.layout.id })
|
|
776
809
|
).then((e) => e.data ?? []).catch(() => null),
|
|
777
810
|
staleTime: 5 * 6e4,
|
|
778
811
|
retry: !1
|
|
779
|
-
}),
|
|
812
|
+
}), I = ke(
|
|
780
813
|
() => new Map((ee ?? (V == null ? void 0 : V.fields) ?? []).map((e) => [e.field, e])),
|
|
781
814
|
[ee, V]
|
|
782
|
-
),
|
|
815
|
+
), he = (V == null ? void 0 : V.relations) ?? [], be = (e) => {
|
|
783
816
|
var r;
|
|
784
|
-
return ((r =
|
|
785
|
-
(
|
|
817
|
+
return ((r = he.find(
|
|
818
|
+
(s) => s.many_collection === a && s.many_field === e && s.one_collection
|
|
786
819
|
)) == null ? void 0 : r.one_collection) ?? null;
|
|
787
|
-
},
|
|
820
|
+
}, Y = (e) => he.find(
|
|
788
821
|
(r) => r.one_collection === a && (r.one_field === e || r.many_collection === e)
|
|
789
|
-
) ?? null,
|
|
822
|
+
) ?? null, M = (e) => {
|
|
790
823
|
var r;
|
|
791
|
-
return !((e.is_visible === void 0 || e.is_visible) &&
|
|
824
|
+
return !((e.is_visible === void 0 || e.is_visible) && _e(e.overrides).hidden !== !0 && !((r = I.get(e.field)) != null && r.hidden));
|
|
792
825
|
}, se = g.assignments.filter(
|
|
793
|
-
(e) => (!e.field.startsWith("__") ||
|
|
826
|
+
(e) => (!e.field.startsWith("__") || Le(e.field)) && (q || !M(e))
|
|
794
827
|
), de = g.assignments.filter(
|
|
795
|
-
(e) => e.field.startsWith("__widget_") && e.widget_id != null && (
|
|
796
|
-
),
|
|
828
|
+
(e) => e.field.startsWith("__widget_") && e.widget_id != null && (q || e.is_visible === void 0 || !!e.is_visible)
|
|
829
|
+
), He = (e) => {
|
|
797
830
|
if (!e.input_bindings) return [];
|
|
798
831
|
try {
|
|
799
832
|
return JSON.parse(String(e.input_bindings));
|
|
800
833
|
} catch {
|
|
801
834
|
return [];
|
|
802
835
|
}
|
|
803
|
-
},
|
|
804
|
-
(e) => e.field.startsWith("__") && !e.field.startsWith("__widget_") && !
|
|
805
|
-
).sort((e, r) => e.sort - r.sort) : [], oe = ["__pipeline__", "__addendums__"], Pe = new Set(oe), we = (e) => (
|
|
806
|
-
(
|
|
836
|
+
}, Ue = _ || i ? g.assignments.filter(
|
|
837
|
+
(e) => e.field.startsWith("__") && !e.field.startsWith("__widget_") && !Le(e.field) && (q || e.is_visible === void 0 || !!e.is_visible)
|
|
838
|
+
).sort((e, r) => e.sort - r.sort) : [], oe = ["__pipeline__", "__addendums__"], Pe = new Set(oe), we = (e) => (_ == null ? void 0 : _(e.field, e)) ?? (i ? /* @__PURE__ */ t("div", { className: "rounded-xl border border-dashed border-slate-300 bg-white px-5 py-3 text-[12px] font-medium text-slate-500 dark:border-slate-600 dark:bg-slate-900/40 dark:text-slate-400", children: e.label_override || Ze(e.field.replace(/^_+|_+$/g, "")) }) : null), Me = (e, r = "trailing") => _ || i ? Ue.filter(
|
|
839
|
+
(s) => e === null ? s.group_key == null && r === "leading" === Pe.has(s.field) : s.group_key === e
|
|
807
840
|
).sort(
|
|
808
|
-
(
|
|
809
|
-
).map((
|
|
810
|
-
const
|
|
811
|
-
return
|
|
841
|
+
(s, c) => r === "leading" && e === null ? oe.indexOf(s.field) - oe.indexOf(c.field) : 0
|
|
842
|
+
).map((s) => ({ key: s.field, a: s, node: we(s) })).filter((s) => s.node != null) : [], Se = (e, r = "trailing") => {
|
|
843
|
+
const s = Me(e, r);
|
|
844
|
+
return s.length === 0 ? null : /* @__PURE__ */ t(
|
|
812
845
|
"div",
|
|
813
846
|
{
|
|
814
847
|
className: r === "leading" ? "mb-4 space-y-4" : "mt-3 space-y-4",
|
|
815
848
|
"data-read-live-slots": r,
|
|
816
|
-
children:
|
|
849
|
+
children: s.map((c) => /* @__PURE__ */ t("div", { children: R(
|
|
817
850
|
{ kind: "slot", field: c.a.field, group_key: c.a.group_key ?? null },
|
|
818
851
|
c.node,
|
|
819
|
-
|
|
852
|
+
M(c.a)
|
|
820
853
|
) }, c.key))
|
|
821
854
|
}
|
|
822
855
|
);
|
|
823
|
-
}, [$e,
|
|
824
|
-
(e) => (r) => d((
|
|
856
|
+
}, [$e, We] = H({}), Fe = (e) => q || $e[e] === !0, [l, d] = H({}), o = gt(
|
|
857
|
+
(e) => (r) => d((s) => s[e] === r ? s : { ...s, [e]: r }),
|
|
825
858
|
[]
|
|
826
|
-
), [
|
|
827
|
-
(e) => (r) =>
|
|
859
|
+
), [b, O] = H({}), W = gt(
|
|
860
|
+
(e) => (r) => O((s) => s[e] === r ? s : { ...s, [e]: r }),
|
|
828
861
|
[]
|
|
829
862
|
), re = (e) => {
|
|
830
863
|
const r = de.filter((c) => c.group_key === e).sort((c, y) => c.sort - y.sort);
|
|
831
864
|
if (r.length === 0) return null;
|
|
832
|
-
const
|
|
833
|
-
return /* @__PURE__ */ t("div", { className:
|
|
865
|
+
const s = r.some((c) => Fe(c.field));
|
|
866
|
+
return /* @__PURE__ */ t("div", { className: s ? "mt-3 space-y-4" : "hidden", "data-read-widgets": !0, children: r.map((c) => /* @__PURE__ */ t("div", { hidden: !Fe(c.field), children: R(
|
|
834
867
|
{ kind: "slot", field: c.field, group_key: c.group_key ?? null },
|
|
835
868
|
/* @__PURE__ */ t(
|
|
836
|
-
|
|
869
|
+
Rl,
|
|
837
870
|
{
|
|
838
871
|
widgetId: c.widget_id,
|
|
839
|
-
inputBindings:
|
|
840
|
-
itemDraft:
|
|
872
|
+
inputBindings: He(c),
|
|
873
|
+
itemDraft: f ?? {},
|
|
841
874
|
itemCollection: a,
|
|
842
|
-
ready: !!
|
|
875
|
+
ready: !!f,
|
|
843
876
|
label: c.label_override ?? void 0,
|
|
844
877
|
defaultExpanded: c.default_expanded == null ? !0 : !!c.default_expanded,
|
|
845
|
-
onContentChange: (y) =>
|
|
846
|
-
(
|
|
878
|
+
onContentChange: (y) => We(
|
|
879
|
+
(B) => B[c.field] === y ? B : { ...B, [c.field]: y }
|
|
847
880
|
)
|
|
848
881
|
}
|
|
849
882
|
),
|
|
850
|
-
|
|
883
|
+
M(c)
|
|
851
884
|
) }, c.field)) });
|
|
852
|
-
}, [ne, qe] =
|
|
885
|
+
}, [ne, qe] = H(() => /* @__PURE__ */ new Set()), ge = q || !f ? [] : vl({
|
|
853
886
|
groups: g.groups.filter(
|
|
854
887
|
(e) => e.type !== "container" && e.visibility_mode !== "new_only"
|
|
855
888
|
),
|
|
856
|
-
values:
|
|
857
|
-
fields: [...
|
|
858
|
-
choices:
|
|
859
|
-
quiet:
|
|
860
|
-
readable: (e) =>
|
|
889
|
+
values: f,
|
|
890
|
+
fields: [...I.values()],
|
|
891
|
+
choices: Sl([...I.values()]),
|
|
892
|
+
quiet: el(g.layout.conditions),
|
|
893
|
+
readable: (e) => _l(
|
|
861
894
|
g.assignments.filter((r) => r.group_key === e).map((r) => r.field),
|
|
862
|
-
|
|
863
|
-
!!
|
|
895
|
+
f,
|
|
896
|
+
!!i
|
|
864
897
|
)
|
|
865
|
-
}),
|
|
866
|
-
const
|
|
867
|
-
return
|
|
868
|
-
}),
|
|
869
|
-
(e) =>
|
|
870
|
-
), [
|
|
871
|
-
const
|
|
872
|
-
return
|
|
873
|
-
}),
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
}, [
|
|
877
|
-
const e =
|
|
878
|
-
e &&
|
|
879
|
-
}, [
|
|
880
|
-
const
|
|
881
|
-
for (const e of
|
|
898
|
+
}), Ve = (e) => qe((r) => {
|
|
899
|
+
const s = new Set(r);
|
|
900
|
+
return s.has(e) ? s.delete(e) : s.add(e), s;
|
|
901
|
+
}), nt = [...g.groups].sort((e, r) => e.sort - r.sort).filter((e) => q || e.visibility_mode !== "new_only").filter(
|
|
902
|
+
(e) => q || !f || ne.has(e.key) || dl(e.visible_when, f)
|
|
903
|
+
), [$t, Ge] = H(() => /* @__PURE__ */ new Set()), ye = (e) => !e.is_collapsed || $t.has(e.key), Ft = (e) => Ge((r) => {
|
|
904
|
+
const s = new Set(r);
|
|
905
|
+
return s.has(e) ? s.delete(e) : s.add(e), s;
|
|
906
|
+
}), Re = (i == null ? void 0 : i.context.fold) ?? null, Ae = (i == null ? void 0 : i.context.reveal) ?? null;
|
|
907
|
+
fe(() => {
|
|
908
|
+
Re && Ge(Re.open ? new Set(g.groups.map((e) => e.key)) : /* @__PURE__ */ new Set());
|
|
909
|
+
}, [Re == null ? void 0 : Re.seq]), fe(() => {
|
|
910
|
+
const e = Ae ? wl(Ae.target) : null;
|
|
911
|
+
e && Ge((r) => r.has(e) ? r : new Set(r).add(e));
|
|
912
|
+
}, [Ae == null ? void 0 : Ae.seq]);
|
|
913
|
+
const Je = [];
|
|
914
|
+
for (const e of nt) {
|
|
882
915
|
if (e.type === "container") {
|
|
883
|
-
for (const r of
|
|
884
|
-
|
|
916
|
+
for (const r of nt.filter((s) => s.container_id != null && s.container_id === e.id))
|
|
917
|
+
Je.push(r);
|
|
885
918
|
continue;
|
|
886
919
|
}
|
|
887
|
-
e.container_id == null &&
|
|
920
|
+
e.container_id == null && Je.push(e);
|
|
888
921
|
}
|
|
889
|
-
const
|
|
922
|
+
const J = (e) => {
|
|
890
923
|
var r;
|
|
891
|
-
return !!((r =
|
|
892
|
-
},
|
|
893
|
-
var
|
|
924
|
+
return !!((r = Y(e.field)) != null && r.junction_field);
|
|
925
|
+
}, at = (e) => {
|
|
926
|
+
var s;
|
|
894
927
|
const r = String(
|
|
895
|
-
|
|
928
|
+
_e(e.overrides).interface ?? ((s = I.get(e.field)) == null ? void 0 : s.interface) ?? ""
|
|
896
929
|
);
|
|
897
930
|
return /rich|wysiwyg|editorjs/i.test(r);
|
|
898
931
|
}, Te = (e) => {
|
|
899
|
-
const r =
|
|
900
|
-
if (
|
|
932
|
+
const r = I.get(e.field), s = _e(e.overrides);
|
|
933
|
+
if (s.summary_toggle === !0 && !i && v && f)
|
|
901
934
|
return /* @__PURE__ */ t(
|
|
902
|
-
|
|
935
|
+
Ml,
|
|
903
936
|
{
|
|
904
937
|
collection: a,
|
|
905
|
-
itemId: String(
|
|
938
|
+
itemId: String(v),
|
|
906
939
|
field: e.field,
|
|
907
|
-
value:
|
|
940
|
+
value: f[e.field],
|
|
908
941
|
label: ce(e)
|
|
909
942
|
}
|
|
910
943
|
);
|
|
911
|
-
if (
|
|
912
|
-
const K =
|
|
913
|
-
return /* @__PURE__ */ t("span", { "data-display-formula": e.field, className: "tabular-nums", children:
|
|
944
|
+
if (Le(e.field)) {
|
|
945
|
+
const K = rl(s), ue = bl((K == null ? void 0 : K.expr) ?? "", f ?? {});
|
|
946
|
+
return /* @__PURE__ */ t("span", { "data-display-formula": e.field, className: "tabular-nums", children: ue.error ? "—" : nl(ue.value, K ?? { format: "", currency: null }) });
|
|
914
947
|
}
|
|
915
|
-
const c =
|
|
916
|
-
if (
|
|
948
|
+
const c = Y(e.field);
|
|
949
|
+
if (i && !v && (c != null && c.junction_field)) return /* @__PURE__ */ t(le, {});
|
|
917
950
|
if (c != null && c.junction_field && c.many_collection && c.many_field)
|
|
918
951
|
return /* @__PURE__ */ t(
|
|
919
|
-
|
|
952
|
+
Dl,
|
|
920
953
|
{
|
|
921
954
|
junction: c.many_collection,
|
|
922
955
|
parentFk: c.many_field,
|
|
923
956
|
junctionField: c.junction_field,
|
|
924
|
-
parentId:
|
|
957
|
+
parentId: v,
|
|
925
958
|
onCount: o(e.field),
|
|
926
|
-
onTarget:
|
|
959
|
+
onTarget: W(e.field),
|
|
927
960
|
relation: c
|
|
928
961
|
}
|
|
929
962
|
);
|
|
930
|
-
const y =
|
|
931
|
-
if (
|
|
932
|
-
return /* @__PURE__ */ t("span", { className: "inline-block", children: /* @__PURE__ */ t(
|
|
933
|
-
if (
|
|
934
|
-
if ((r == null ? void 0 : r.type) === "boolean" && (y == null || y === "")) return /* @__PURE__ */ t(
|
|
963
|
+
const y = f == null ? void 0 : f[e.field], B = be(e.field);
|
|
964
|
+
if (B === "nivaro_users" && y != null)
|
|
965
|
+
return /* @__PURE__ */ t("span", { className: "inline-block", children: /* @__PURE__ */ t(wt, { userId: String(y), size: "compact" }) });
|
|
966
|
+
if (B) return /* @__PURE__ */ t(rt, { collection: B, id: y });
|
|
967
|
+
if ((r == null ? void 0 : r.type) === "boolean" && (y == null || y === "")) return /* @__PURE__ */ t(Ie, { value: !1 });
|
|
935
968
|
if (y == null || y === "") return /* @__PURE__ */ t(le, {});
|
|
936
969
|
if ((r == null ? void 0 : r.type) === "boolean")
|
|
937
970
|
return /* @__PURE__ */ t(
|
|
938
|
-
|
|
971
|
+
Ie,
|
|
939
972
|
{
|
|
940
973
|
value: y,
|
|
941
|
-
trueTone: (
|
|
974
|
+
trueTone: (s.options ?? {}).trueTone ?? "positive"
|
|
942
975
|
}
|
|
943
976
|
);
|
|
944
|
-
const te =
|
|
945
|
-
return
|
|
977
|
+
const te = s.options ?? {};
|
|
978
|
+
return at(e) && typeof y == "string" ? /^\s*\{/.test(y) ? /* @__PURE__ */ t("div", { className: "min-w-0 whitespace-pre-wrap font-normal [overflow-wrap:anywhere]", children: ml(y) }) : /* @__PURE__ */ t(
|
|
946
979
|
"div",
|
|
947
980
|
{
|
|
948
981
|
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",
|
|
949
|
-
dangerouslySetInnerHTML: { __html:
|
|
982
|
+
dangerouslySetInnerHTML: { __html: sl(y) }
|
|
950
983
|
}
|
|
951
|
-
) : te.format === "currency" ? /* @__PURE__ */ t("span", { className: "tabular-nums", children: tt(y) }) : (r == null ? void 0 : r.type) === "decimal" || (r == null ? void 0 : r.type) === "float" ? /* @__PURE__ */ t("span", { className: "tabular-nums", children:
|
|
952
|
-
},
|
|
953
|
-
const r =
|
|
954
|
-
if (!(
|
|
955
|
-
if (
|
|
984
|
+
) : te.format === "currency" ? /* @__PURE__ */ t("span", { className: "tabular-nums", children: tt(y) }) : (r == null ? void 0 : r.type) === "decimal" || (r == null ? void 0 : r.type) === "float" ? /* @__PURE__ */ t("span", { className: "tabular-nums", children: Be(y) }) : (r == null ? void 0 : r.type) === "date" || (r == null ? void 0 : r.type) === "datetime" || (r == null ? void 0 : r.type) === "timestamp" ? St(y) : String(y);
|
|
985
|
+
}, qt = (e) => {
|
|
986
|
+
const r = _e(e.overrides), s = Y(e.field);
|
|
987
|
+
if (!(s != null && s.many_collection) || !s.many_field) return null;
|
|
988
|
+
if (i && !v) return /* @__PURE__ */ t("p", { className: "py-3 text-[12px] text-slate-400", children: "No records" });
|
|
956
989
|
const c = r.options ?? {}, y = (() => {
|
|
957
990
|
var K;
|
|
958
|
-
const te = (K =
|
|
991
|
+
const te = (K = I.get(e.field)) == null ? void 0 : K.options;
|
|
959
992
|
if (!te) return {};
|
|
960
993
|
if (typeof te == "string")
|
|
961
994
|
try {
|
|
@@ -964,94 +997,94 @@ function xt({
|
|
|
964
997
|
return {};
|
|
965
998
|
}
|
|
966
999
|
return te;
|
|
967
|
-
})(),
|
|
1000
|
+
})(), B = c.layout_id ?? null;
|
|
968
1001
|
return /* @__PURE__ */ t(
|
|
969
|
-
|
|
1002
|
+
Pl,
|
|
970
1003
|
{
|
|
971
|
-
collection:
|
|
972
|
-
fkField:
|
|
973
|
-
parentId:
|
|
974
|
-
layoutId:
|
|
1004
|
+
collection: s.many_collection,
|
|
1005
|
+
fkField: s.many_field,
|
|
1006
|
+
parentId: v,
|
|
1007
|
+
layoutId: B,
|
|
975
1008
|
presets: c.column_presets ?? y.column_presets,
|
|
976
1009
|
defaultPreset: c.default_preset ?? y.default_preset ?? null,
|
|
977
1010
|
onCount: o(e.field)
|
|
978
1011
|
},
|
|
979
1012
|
e.field
|
|
980
1013
|
);
|
|
981
|
-
}, X = (e) => !!
|
|
982
|
-
if (!
|
|
983
|
-
const r =
|
|
1014
|
+
}, X = (e) => !!Y(e.field) && !J(e), Rt = !!g.layout.hide_empty, it = Array.isArray(g.layout.header_fields) ? g.layout.header_fields.filter((e) => typeof e == "string") : [], At = new Set(it), Tt = (e) => {
|
|
1015
|
+
if (!f || J(e)) return !1;
|
|
1016
|
+
const r = f[e.field];
|
|
984
1017
|
return r == null || r === "" || Array.isArray(r) && r.length === 0;
|
|
985
|
-
},
|
|
1018
|
+
}, Ct = (e) => se.find((r) => r.field === e), ce = (e) => {
|
|
986
1019
|
var c;
|
|
987
|
-
const r =
|
|
988
|
-
return
|
|
989
|
-
},
|
|
990
|
-
const r = Yt(e.swap_config),
|
|
991
|
-
if (
|
|
992
|
-
const te = (n) =>
|
|
993
|
-
const
|
|
994
|
-
return
|
|
1020
|
+
const r = _e(e.overrides).label, s = F ? ll(e.overrides, F).label : void 0;
|
|
1021
|
+
return s !== void 0 ? s : Le(e.field) ? typeof r == "string" && r.trim() ? r : "Formula" : typeof r == "string" && r.trim() ? r : e.label_override || ((c = I.get(e.field)) == null ? void 0 : c.label) || Ze(e.field);
|
|
1022
|
+
}, Ot = (e) => {
|
|
1023
|
+
const r = Yt(e.swap_config), s = se.filter((n) => n.group_key === e.key && !At.has(n.field)).filter((n) => q || !f || !Xt(n.overrides) || !ve(f[n.field])).sort((n, C) => n.sort - C.sort), c = de.filter((n) => n.group_key === e.key), y = Me(e.key), B = s.length === 0 && c.length === 0 && y.length === 0;
|
|
1024
|
+
if (B && !i) return null;
|
|
1025
|
+
const te = (n) => Rt && !q && (X(n) || J(n)) && ((m == null ? void 0 : m[n.field]) ?? l[n.field]) === 0, K = s.filter((n) => !X(n)), ue = s.filter(X), Ke = c.filter((n) => Fe(n.field)), Et = !e.hide_when_empty && y.length === 0 && Ke.length === 0 && s.length > 0 && s.some((n) => X(n) || J(n)) && s.every(te), Qe = (n) => !Et && te(n), Dt = s.filter((n) => !Qe(n)), xe = (n) => (m == null ? void 0 : m[n.field]) ?? l[n.field], Pt = !!e.hide_when_empty && !i && !q && !!f && y.length === 0 && Ke.length === 0 && s.every((n) => X(n) || J(n) ? xe(n) === 0 : ve(f[n.field])) || !B && Dt.length === 0 && y.length === 0 && Ke.length === 0, Mt = (n) => (m == null ? void 0 : m[n.field]) ?? l[n.field], ze = !!r.emptyText && !!f && !i && y.length === 0 && Ke.length === 0 && s.every((n) => X(n) || J(n) ? Mt(n) === 0 : ve(f[n.field])), Wt = Zt(K, { rows: r.rows }).units, Ye = e.is_collapsed ? Tl(e.summary_fields).map((n) => {
|
|
1026
|
+
const C = s.find((Ce) => Ce.field === n.field);
|
|
1027
|
+
return C ? { a: C, label: n.label || ce(C) } : null;
|
|
995
1028
|
}).filter((n) => !!n).filter(
|
|
996
|
-
({ a: n }) => !e.summary_hide_empty || !
|
|
997
|
-
).slice(0, Al) : [],
|
|
998
|
-
var
|
|
999
|
-
const
|
|
1029
|
+
({ a: n }) => !e.summary_hide_empty || !f || (X(n) || J(n) ? xe(n) !== 0 : !ve(f[n.field]))
|
|
1030
|
+
).slice(0, Al) : [], ut = e.read_width === "full" || e.read_width === "half" || e.read_width === "third" ? e.read_width : ue.length > 0 || c.length > 0 || y.length > 0 || K.length > 4 ? "full" : "half", Kt = (n) => {
|
|
1031
|
+
var pt, ht, bt;
|
|
1032
|
+
const C = Qe(n), Q = !!(_e(n.overrides).options ?? {}).emphasis, Oe = at(n) || !!((ht = (pt = I.get(n.field)) == null ? void 0 : pt.interface) != null && ht.includes("rich-text")), mt = f == null ? void 0 : f[n.field], ft = !Oe && !J(n) && !be(n.field) && (String(((bt = I.get(n.field)) == null ? void 0 : bt.interface) ?? "").includes("textarea") || typeof mt == "string" && mt.length > 36);
|
|
1000
1033
|
return /* @__PURE__ */ t(
|
|
1001
1034
|
"div",
|
|
1002
1035
|
{
|
|
1003
|
-
hidden:
|
|
1004
|
-
className: `min-w-0 ${Oe ||
|
|
1005
|
-
children:
|
|
1006
|
-
|
|
1007
|
-
/* @__PURE__ */ p(
|
|
1008
|
-
/* @__PURE__ */ p("dt", { className:
|
|
1009
|
-
ce(n),
|
|
1036
|
+
hidden: C,
|
|
1037
|
+
className: `min-w-0 ${Oe || J(n) && (b[n.field] === "nivaro_files" || (l[n.field] ?? 0) > 3) ? "col-span-full" : Q || ft ? "col-span-2" : ""}`,
|
|
1038
|
+
children: R(
|
|
1039
|
+
E(n),
|
|
1040
|
+
/* @__PURE__ */ p(me, { children: [
|
|
1041
|
+
/* @__PURE__ */ p("dt", { className: vt, "data-fact-label": !0, children: [
|
|
1042
|
+
/* @__PURE__ */ t("span", { className: "max-w-full shrink-0 truncate", children: ce(n) }),
|
|
1010
1043
|
/* @__PURE__ */ t(ie, { field: n.field }),
|
|
1011
|
-
/* @__PURE__ */ t(
|
|
1012
|
-
|
|
1044
|
+
/* @__PURE__ */ t(yt, { field: n.field }),
|
|
1045
|
+
k(n.field)
|
|
1013
1046
|
] }),
|
|
1014
1047
|
/* @__PURE__ */ t(
|
|
1015
1048
|
"dd",
|
|
1016
1049
|
{
|
|
1017
1050
|
"data-replay-field": n.field,
|
|
1018
1051
|
"data-field-collection": a,
|
|
1019
|
-
"data-remote-changed":
|
|
1020
|
-
className: `mt-1 min-w-0${
|
|
1021
|
-
children:
|
|
1052
|
+
"data-remote-changed": pe.has(n.field) || void 0,
|
|
1053
|
+
className: `mt-1 min-w-0${P(n.field)} ${Q ? "text-[17px] font-semibold tracking-[-0.01em] text-slate-900 dark:text-white" : `${J(n) || Oe ? "" : ft ? "line-clamp-3 break-words " : "truncate "}text-[13px] font-medium text-slate-800 dark:text-slate-100`}`,
|
|
1054
|
+
children: f ? Te(n) : /* @__PURE__ */ t("span", { className: "inline-block h-3.5 w-20 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" })
|
|
1022
1055
|
}
|
|
1023
1056
|
)
|
|
1024
1057
|
] }),
|
|
1025
|
-
|
|
1058
|
+
M(n)
|
|
1026
1059
|
)
|
|
1027
1060
|
},
|
|
1028
1061
|
n.field
|
|
1029
1062
|
);
|
|
1030
|
-
},
|
|
1031
|
-
const
|
|
1063
|
+
}, jt = (n, C) => {
|
|
1064
|
+
const Ce = f && !i ? C.filter((Q) => !ve(f[Q.field])) : C;
|
|
1032
1065
|
return /* @__PURE__ */ p(
|
|
1033
1066
|
"div",
|
|
1034
1067
|
{
|
|
1035
1068
|
"data-read-row": n.key,
|
|
1036
|
-
className: `min-w-0 ${
|
|
1069
|
+
className: `min-w-0 ${C.length > 2 ? "col-span-full" : "col-span-2"}`,
|
|
1037
1070
|
children: [
|
|
1038
|
-
/* @__PURE__ */ t("dt", { className:
|
|
1039
|
-
/* @__PURE__ */ t("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:
|
|
1071
|
+
/* @__PURE__ */ t("dt", { className: lt, children: n.label.trim() || C.map(ce).join(" / ") }),
|
|
1072
|
+
/* @__PURE__ */ t("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: f ? Ce.length === 0 ? /* @__PURE__ */ t(le, {}) : Ce.map((Q, Oe) => /* @__PURE__ */ p(Ht, { children: [
|
|
1040
1073
|
Oe > 0 && /* @__PURE__ */ t("span", { "aria-hidden": !0, className: "text-slate-300 dark:text-slate-600", children: "·" }),
|
|
1041
|
-
|
|
1042
|
-
|
|
1074
|
+
R(
|
|
1075
|
+
E(Q),
|
|
1043
1076
|
/* @__PURE__ */ t(
|
|
1044
1077
|
"span",
|
|
1045
1078
|
{
|
|
1046
|
-
"data-replay-field":
|
|
1079
|
+
"data-replay-field": Q.field,
|
|
1047
1080
|
"data-field-collection": a,
|
|
1048
|
-
className: `min-w-0 break-words${
|
|
1049
|
-
children: Te(
|
|
1081
|
+
className: `min-w-0 break-words${P(Q.field)}`,
|
|
1082
|
+
children: Te(Q)
|
|
1050
1083
|
}
|
|
1051
1084
|
),
|
|
1052
|
-
|
|
1085
|
+
M(Q)
|
|
1053
1086
|
)
|
|
1054
|
-
] },
|
|
1087
|
+
] }, Q.field)) : /* @__PURE__ */ t("span", { className: "inline-block h-3.5 w-28 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }) })
|
|
1055
1088
|
]
|
|
1056
1089
|
},
|
|
1057
1090
|
`row:${n.key}`
|
|
@@ -1060,70 +1093,70 @@ function xt({
|
|
|
1060
1093
|
return /* @__PURE__ */ t(
|
|
1061
1094
|
"section",
|
|
1062
1095
|
{
|
|
1063
|
-
hidden:
|
|
1096
|
+
hidden: Pt,
|
|
1064
1097
|
"data-read-section": e.key,
|
|
1065
|
-
"data-read-width":
|
|
1098
|
+
"data-read-width": ut,
|
|
1066
1099
|
className: "min-w-0 rounded-xl border border-slate-200 bg-white dark:border-slate-700/60 dark:bg-slate-900/40",
|
|
1067
|
-
children:
|
|
1100
|
+
children: R(
|
|
1068
1101
|
{ kind: "group", key: e.key },
|
|
1069
|
-
/* @__PURE__ */ p(
|
|
1102
|
+
/* @__PURE__ */ p(me, { children: [
|
|
1070
1103
|
/* @__PURE__ */ p(
|
|
1071
1104
|
"h3",
|
|
1072
1105
|
{
|
|
1073
1106
|
"data-read-head": "",
|
|
1074
|
-
className: `group/rs relative flex items-center justify-between gap-2 px-5 py-2.5 text-[12.5px] font-semibold text-slate-700 dark:text-slate-200 ${
|
|
1107
|
+
className: `group/rs relative flex items-center justify-between gap-2 px-5 py-2.5 text-[12.5px] font-semibold text-slate-700 dark:text-slate-200 ${ye(e) ? "border-b border-slate-100 dark:border-slate-800" : ""}`,
|
|
1075
1108
|
children: [
|
|
1076
|
-
e.is_collapsed ? /* @__PURE__ */ p(
|
|
1109
|
+
e.is_collapsed ? /* @__PURE__ */ p(me, { children: [
|
|
1077
1110
|
/* @__PURE__ */ t(
|
|
1078
1111
|
"button",
|
|
1079
1112
|
{
|
|
1080
1113
|
type: "button",
|
|
1081
|
-
onClick: () =>
|
|
1082
|
-
"aria-expanded":
|
|
1083
|
-
className: `min-w-0 text-left after:absolute after:inset-0 group-hover/rs:text-slate-900 dark:group-hover/rs:text-white ${
|
|
1114
|
+
onClick: () => Ft(e.key),
|
|
1115
|
+
"aria-expanded": ye(e),
|
|
1116
|
+
className: `min-w-0 text-left after:absolute after:inset-0 group-hover/rs:text-slate-900 dark:group-hover/rs:text-white ${Ye.length > 0 && !ye(e) ? "shrink-0" : "flex-1"}`,
|
|
1084
1117
|
children: e.label
|
|
1085
1118
|
}
|
|
1086
1119
|
),
|
|
1087
|
-
!
|
|
1120
|
+
!ye(e) && Ye.length > 0 && // #3195: two or three values while the section is closed. Not
|
|
1088
1121
|
// interactive: the heading's toggle covers the whole row.
|
|
1089
1122
|
/* @__PURE__ */ t(
|
|
1090
1123
|
"span",
|
|
1091
1124
|
{
|
|
1092
1125
|
"data-read-collapsed-summary": e.key,
|
|
1093
1126
|
className: "pointer-events-none flex min-w-0 flex-1 items-baseline gap-x-3 overflow-hidden whitespace-nowrap text-[12px] font-normal",
|
|
1094
|
-
children:
|
|
1095
|
-
/* @__PURE__ */ t("span", { className: "shrink-0 text-[10px] font-semibold uppercase tracking-wider text-slate-400 dark:text-slate-500", children:
|
|
1096
|
-
/* @__PURE__ */ t("span", { className: "min-w-0 truncate font-medium text-slate-700 dark:text-slate-300", children:
|
|
1127
|
+
children: Ye.map(({ a: n, label: C }) => /* @__PURE__ */ p("span", { className: "flex min-w-0 shrink items-baseline gap-1", children: [
|
|
1128
|
+
/* @__PURE__ */ t("span", { className: "shrink-0 text-[10px] font-semibold uppercase tracking-wider text-slate-400 dark:text-slate-500", children: C }),
|
|
1129
|
+
/* @__PURE__ */ t("span", { className: "min-w-0 truncate font-medium text-slate-700 dark:text-slate-300", children: f ? X(n) || J(n) ? xe(n) == null ? "…" : `${xe(n)} ${X(n) ? xe(n) === 1 ? "row" : "rows" : xe(n) === 1 ? "item" : "items"}` : ve(f[n.field]) ? /* @__PURE__ */ t("span", { className: "text-slate-300 dark:text-slate-600", children: "—" }) : Te(n) : "…" })
|
|
1097
1130
|
] }, n.field))
|
|
1098
1131
|
}
|
|
1099
1132
|
)
|
|
1100
1133
|
] }) : /* @__PURE__ */ t("span", { className: "min-w-0 flex-1", children: e.label }),
|
|
1101
|
-
|
|
1134
|
+
N && (K.length > 0 || ue.length > 0) && /* @__PURE__ */ t(
|
|
1102
1135
|
"button",
|
|
1103
1136
|
{
|
|
1104
1137
|
type: "button",
|
|
1105
1138
|
"data-read-edit-section": e.key,
|
|
1106
1139
|
onClick: () => {
|
|
1107
|
-
var n,
|
|
1108
|
-
return
|
|
1140
|
+
var n, C;
|
|
1141
|
+
return N(e.key, ((n = K[0]) == null ? void 0 : n.field) ?? ((C = ue[0]) == null ? void 0 : C.field) ?? null);
|
|
1109
1142
|
},
|
|
1110
1143
|
title: `Edit ${e.label}`,
|
|
1111
1144
|
"aria-label": `Edit ${e.label}`,
|
|
1112
1145
|
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",
|
|
1113
|
-
children: /* @__PURE__ */ t(
|
|
1146
|
+
children: /* @__PURE__ */ t(Bt, { className: "h-3 w-3" })
|
|
1114
1147
|
}
|
|
1115
1148
|
),
|
|
1116
1149
|
e.is_collapsed && /* @__PURE__ */ t(
|
|
1117
|
-
|
|
1150
|
+
It,
|
|
1118
1151
|
{
|
|
1119
1152
|
"aria-hidden": "true",
|
|
1120
|
-
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 ${
|
|
1153
|
+
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 ${ye(e) ? "" : "-rotate-90"}`
|
|
1121
1154
|
}
|
|
1122
1155
|
)
|
|
1123
1156
|
]
|
|
1124
1157
|
}
|
|
1125
1158
|
),
|
|
1126
|
-
/* @__PURE__ */ p("div", { "data-read-body": "", className: "px-5 pb-5 pt-4", hidden: !
|
|
1159
|
+
/* @__PURE__ */ p("div", { "data-read-body": "", className: "px-5 pb-5 pt-4", hidden: !ye(e), children: [
|
|
1127
1160
|
ze && /* @__PURE__ */ t(
|
|
1128
1161
|
"p",
|
|
1129
1162
|
{
|
|
@@ -1140,37 +1173,37 @@ function xt({
|
|
|
1140
1173
|
"dl",
|
|
1141
1174
|
{
|
|
1142
1175
|
className: "grid gap-x-6 gap-y-5",
|
|
1143
|
-
"data-read-dl":
|
|
1176
|
+
"data-read-dl": ut,
|
|
1144
1177
|
style: ze ? { display: "none" } : void 0,
|
|
1145
|
-
children:
|
|
1146
|
-
(n) => n.kind === "row" ?
|
|
1178
|
+
children: Wt.map(
|
|
1179
|
+
(n) => n.kind === "row" ? jt(n.row, n.members) : Kt(n.field)
|
|
1147
1180
|
)
|
|
1148
1181
|
}
|
|
1149
1182
|
),
|
|
1150
|
-
|
|
1151
|
-
var
|
|
1183
|
+
ue.map((n) => {
|
|
1184
|
+
var C;
|
|
1152
1185
|
return /* @__PURE__ */ t(
|
|
1153
1186
|
"div",
|
|
1154
1187
|
{
|
|
1155
1188
|
className: K.length > 0 ? "mt-3" : "",
|
|
1156
|
-
hidden:
|
|
1157
|
-
children:
|
|
1158
|
-
|
|
1159
|
-
/* @__PURE__ */ p(
|
|
1160
|
-
(
|
|
1189
|
+
hidden: Qe(n) || ze,
|
|
1190
|
+
children: R(
|
|
1191
|
+
E(n),
|
|
1192
|
+
/* @__PURE__ */ p(me, { children: [
|
|
1193
|
+
(C = A == null ? void 0 : A.get(n.field)) != null && C.length ? /* @__PURE__ */ p("div", { className: "mb-1.5 flex items-center gap-1.5 text-[11px] font-medium text-amber-700 dark:text-amber-300", children: [
|
|
1161
1194
|
/* @__PURE__ */ t("span", { children: ce(n) }),
|
|
1162
1195
|
/* @__PURE__ */ t(ie, { field: n.field }),
|
|
1163
1196
|
/* @__PURE__ */ p("span", { className: "font-normal text-amber-700/80 dark:text-amber-300/80", children: [
|
|
1164
1197
|
"— ",
|
|
1165
|
-
|
|
1198
|
+
A.get(n.field).length,
|
|
1166
1199
|
" line issue",
|
|
1167
|
-
|
|
1200
|
+
A.get(n.field).length === 1 ? "" : "s",
|
|
1168
1201
|
"; switch to Edit to fix"
|
|
1169
1202
|
] })
|
|
1170
1203
|
] }) : null,
|
|
1171
|
-
(
|
|
1204
|
+
(S ? S(n) : null) ?? qt(n)
|
|
1172
1205
|
] }),
|
|
1173
|
-
|
|
1206
|
+
M(n)
|
|
1174
1207
|
)
|
|
1175
1208
|
},
|
|
1176
1209
|
n.field
|
|
@@ -1178,7 +1211,7 @@ function xt({
|
|
|
1178
1211
|
}),
|
|
1179
1212
|
re(e.key),
|
|
1180
1213
|
Se(e.key),
|
|
1181
|
-
|
|
1214
|
+
B && i && /* @__PURE__ */ t(
|
|
1182
1215
|
"div",
|
|
1183
1216
|
{
|
|
1184
1217
|
"data-design-drop": e.key,
|
|
@@ -1193,23 +1226,23 @@ function xt({
|
|
|
1193
1226
|
},
|
|
1194
1227
|
e.key
|
|
1195
1228
|
);
|
|
1196
|
-
},
|
|
1229
|
+
}, st = Se(null), Lt = Se(null, "leading"), dt = it.map((e) => Ct(e)).filter((e) => !!e && !X(e)).filter((e) => q || !Tt(e)), [ae, ...ot] = dt;
|
|
1197
1230
|
return /* @__PURE__ */ p(
|
|
1198
1231
|
"div",
|
|
1199
1232
|
{
|
|
1200
|
-
className:
|
|
1233
|
+
className: w ? "min-h-0 flex-1" : "min-h-0 flex-1 overflow-y-auto bg-slate-50/60 px-5 py-4 dark:bg-transparent",
|
|
1201
1234
|
children: [
|
|
1202
1235
|
Lt,
|
|
1203
|
-
|
|
1236
|
+
dt.length > 0 && /* @__PURE__ */ p(
|
|
1204
1237
|
"div",
|
|
1205
1238
|
{
|
|
1206
1239
|
"data-read-header": !0,
|
|
1207
1240
|
className: "mb-4 rounded-xl border border-slate-200 bg-white px-5 py-4 dark:border-slate-700/60 dark:bg-slate-900/40",
|
|
1208
1241
|
children: [
|
|
1209
|
-
ae &&
|
|
1242
|
+
ae && R(
|
|
1210
1243
|
{ kind: "header", field: ae.field },
|
|
1211
1244
|
/* @__PURE__ */ p("div", { className: "min-w-0", children: [
|
|
1212
|
-
/* @__PURE__ */ p("p", { className:
|
|
1245
|
+
/* @__PURE__ */ p("p", { className: lt, children: [
|
|
1213
1246
|
ce(ae),
|
|
1214
1247
|
/* @__PURE__ */ t(ie, { field: ae.field })
|
|
1215
1248
|
] }),
|
|
@@ -1218,73 +1251,73 @@ function xt({
|
|
|
1218
1251
|
{
|
|
1219
1252
|
"data-replay-field": ae.field,
|
|
1220
1253
|
"data-field-collection": a,
|
|
1221
|
-
className: `truncate text-[22px] font-semibold leading-tight tracking-[-0.015em] text-slate-900 dark:text-white${
|
|
1222
|
-
children:
|
|
1254
|
+
className: `truncate text-[22px] font-semibold leading-tight tracking-[-0.015em] text-slate-900 dark:text-white${P(ae.field)}`,
|
|
1255
|
+
children: f ? Te(ae) : "…"
|
|
1223
1256
|
}
|
|
1224
1257
|
)
|
|
1225
1258
|
] }),
|
|
1226
|
-
|
|
1259
|
+
M(ae)
|
|
1227
1260
|
),
|
|
1228
|
-
|
|
1261
|
+
ot.length > 0 && /* @__PURE__ */ t("dl", { className: "mt-3 flex flex-wrap gap-x-8 gap-y-2", children: ot.map((e) => /* @__PURE__ */ t("div", { className: "min-w-0", children: R(
|
|
1229
1262
|
{ kind: "header", field: e.field },
|
|
1230
|
-
/* @__PURE__ */ p(
|
|
1231
|
-
/* @__PURE__ */ p("dt", { className:
|
|
1232
|
-
ce(e),
|
|
1263
|
+
/* @__PURE__ */ p(me, { children: [
|
|
1264
|
+
/* @__PURE__ */ p("dt", { className: vt, children: [
|
|
1265
|
+
/* @__PURE__ */ t("span", { className: "max-w-full shrink-0 truncate", children: ce(e) }),
|
|
1233
1266
|
/* @__PURE__ */ t(ie, { field: e.field }),
|
|
1234
|
-
/* @__PURE__ */ t(
|
|
1235
|
-
|
|
1267
|
+
/* @__PURE__ */ t(yt, { field: e.field }),
|
|
1268
|
+
k(e.field)
|
|
1236
1269
|
] }),
|
|
1237
1270
|
/* @__PURE__ */ t(
|
|
1238
1271
|
"dd",
|
|
1239
1272
|
{
|
|
1240
1273
|
"data-replay-field": e.field,
|
|
1241
1274
|
"data-field-collection": a,
|
|
1242
|
-
"data-remote-changed":
|
|
1243
|
-
className: `mt-0.5 truncate text-[13px] font-medium text-slate-800 dark:text-slate-100${
|
|
1244
|
-
children:
|
|
1275
|
+
"data-remote-changed": pe.has(e.field) || void 0,
|
|
1276
|
+
className: `mt-0.5 truncate text-[13px] font-medium text-slate-800 dark:text-slate-100${P(e.field)}`,
|
|
1277
|
+
children: f ? Te(e) : "…"
|
|
1245
1278
|
}
|
|
1246
1279
|
)
|
|
1247
1280
|
] }),
|
|
1248
|
-
|
|
1281
|
+
M(e)
|
|
1249
1282
|
) }, e.field)) })
|
|
1250
1283
|
]
|
|
1251
1284
|
}
|
|
1252
1285
|
),
|
|
1253
|
-
/* @__PURE__ */ t("style", { children:
|
|
1254
|
-
V &&
|
|
1255
|
-
V ? /* @__PURE__ */ t("div", { className: "grid items-stretch gap-4", "data-read-board": !0, children:
|
|
1286
|
+
/* @__PURE__ */ t("style", { children: Ol }),
|
|
1287
|
+
V && ge.length > 0 && /* @__PURE__ */ t("div", { className: "mb-3", children: /* @__PURE__ */ t(gl, { items: ge, revealed: ne, onToggle: Ve }) }),
|
|
1288
|
+
V ? /* @__PURE__ */ t("div", { className: "grid items-stretch gap-4", "data-read-board": !0, children: Je.map(Ot) }) : /* @__PURE__ */ p("div", { className: "flex flex-col gap-4", "data-read-board-pending": !0, children: [
|
|
1256
1289
|
/* @__PURE__ */ t("div", { className: "h-32 animate-pulse rounded-xl bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }),
|
|
1257
1290
|
/* @__PURE__ */ t("div", { className: "h-32 animate-pulse rounded-xl bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }),
|
|
1258
1291
|
/* @__PURE__ */ t("div", { className: "h-56 animate-pulse rounded-xl bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" })
|
|
1259
1292
|
] }),
|
|
1260
|
-
|
|
1293
|
+
st && /* @__PURE__ */ t("div", { className: "mt-4", children: st })
|
|
1261
1294
|
]
|
|
1262
1295
|
}
|
|
1263
1296
|
);
|
|
1264
1297
|
}
|
|
1265
|
-
function
|
|
1266
|
-
return a.design ? /* @__PURE__ */ t(
|
|
1298
|
+
function Sr(a) {
|
|
1299
|
+
return a.design ? /* @__PURE__ */ t(Nl, { design: a.design.context, onRefusedWrite: a.design.onRefusedWrite, children: /* @__PURE__ */ t(Ut.Provider, { value: null, children: /* @__PURE__ */ t(_t, { ...a }) }) }) : /* @__PURE__ */ t(_t, { ...a });
|
|
1267
1300
|
}
|
|
1268
|
-
function
|
|
1301
|
+
function Ml({
|
|
1269
1302
|
collection: a,
|
|
1270
|
-
itemId:
|
|
1271
|
-
field:
|
|
1272
|
-
value:
|
|
1273
|
-
label:
|
|
1303
|
+
itemId: u,
|
|
1304
|
+
field: h,
|
|
1305
|
+
value: i,
|
|
1306
|
+
label: w
|
|
1274
1307
|
}) {
|
|
1275
|
-
const
|
|
1276
|
-
if (
|
|
1277
|
-
const
|
|
1278
|
-
|
|
1308
|
+
const _ = Ne(), x = kt(), [S, N] = H(null), m = S ?? (i === !0 || i === 1 || i === "1" || i === "true"), T = async () => {
|
|
1309
|
+
if (S !== null) return;
|
|
1310
|
+
const F = !m;
|
|
1311
|
+
N(F);
|
|
1279
1312
|
try {
|
|
1280
|
-
await
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
]),
|
|
1284
|
-
} catch (
|
|
1285
|
-
|
|
1313
|
+
await _.request(Qt(`/items/${a}/${u}`, { [h]: F })), await Promise.all([
|
|
1314
|
+
x.invalidateQueries({ queryKey: ["rrv-record", a, u] }),
|
|
1315
|
+
x.invalidateQueries({ queryKey: ["item", a, u] })
|
|
1316
|
+
]), al(x, a, u);
|
|
1317
|
+
} catch (L) {
|
|
1318
|
+
zt(L, "Could not save that change");
|
|
1286
1319
|
} finally {
|
|
1287
|
-
|
|
1320
|
+
N(null);
|
|
1288
1321
|
}
|
|
1289
1322
|
};
|
|
1290
1323
|
return /* @__PURE__ */ p(
|
|
@@ -1292,33 +1325,33 @@ function El({
|
|
|
1292
1325
|
{
|
|
1293
1326
|
type: "button",
|
|
1294
1327
|
role: "switch",
|
|
1295
|
-
"aria-checked":
|
|
1296
|
-
"aria-label": typeof
|
|
1297
|
-
disabled:
|
|
1328
|
+
"aria-checked": m,
|
|
1329
|
+
"aria-label": typeof w == "string" ? w : h,
|
|
1330
|
+
disabled: S !== null,
|
|
1298
1331
|
onClick: () => void T(),
|
|
1299
|
-
"data-summary-toggle":
|
|
1332
|
+
"data-summary-toggle": h,
|
|
1300
1333
|
className: "group inline-flex items-center gap-2 rounded-md py-0.5 text-[13px] font-medium text-slate-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan disabled:opacity-60 dark:text-slate-100",
|
|
1301
1334
|
children: [
|
|
1302
1335
|
/* @__PURE__ */ t(
|
|
1303
1336
|
"span",
|
|
1304
1337
|
{
|
|
1305
1338
|
"aria-hidden": !0,
|
|
1306
|
-
className: `relative inline-flex h-[18px] w-8 shrink-0 items-center rounded-full transition-colors ${
|
|
1339
|
+
className: `relative inline-flex h-[18px] w-8 shrink-0 items-center rounded-full transition-colors ${m ? "bg-nvr-cyan" : "bg-slate-300 dark:bg-slate-600"}`,
|
|
1307
1340
|
children: /* @__PURE__ */ t(
|
|
1308
1341
|
"span",
|
|
1309
1342
|
{
|
|
1310
|
-
className: `inline-block h-3.5 w-3.5 rounded-full bg-white shadow transition-transform ${
|
|
1343
|
+
className: `inline-block h-3.5 w-3.5 rounded-full bg-white shadow transition-transform ${m ? "translate-x-[16px]" : "translate-x-[2px]"}`
|
|
1311
1344
|
}
|
|
1312
1345
|
)
|
|
1313
1346
|
}
|
|
1314
1347
|
),
|
|
1315
|
-
|
|
1348
|
+
m ? "Yes" : "No"
|
|
1316
1349
|
]
|
|
1317
1350
|
}
|
|
1318
1351
|
);
|
|
1319
1352
|
}
|
|
1320
1353
|
export {
|
|
1321
1354
|
Al as COLLAPSED_SUMMARY_MAX,
|
|
1322
|
-
|
|
1323
|
-
|
|
1355
|
+
Sr as RecordReadView,
|
|
1356
|
+
Tl as collapsedSummaryEntries
|
|
1324
1357
|
};
|