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