@nivaro/react 0.3.53 → 0.3.54
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/ItemEditForm.js +3350 -3347
- package/dist/shared/components/PageRenderer.js +397 -396
- package/dist/shared/components/item-edit/DraftRecoveryBanner.js +52 -54
- package/dist/shared/components/item-edit/PersonalDefaultControl.js +12 -11
- package/dist/shared/components/item-edit/RelationCombobox.js +23 -20
- package/dist/shared/components/item-edit/SummaryPanel.js +358 -318
- package/dist/shared/components/item-edit/save-outcome.js +48 -0
- package/dist/shared/components/item-edit/stale-banner.js +13 -0
- package/dist/shared/components/item-edit/usePersonalDefaults.js +116 -114
- package/dist/shared/lib/draft-store.js +35 -29
- package/dist/shared/lib/page-widget-access.js +11 -0
- package/package.json +1 -1
|
@@ -1,135 +1,135 @@
|
|
|
1
|
-
import { jsx as r, jsxs as
|
|
2
|
-
import { useQuery as
|
|
1
|
+
import { jsx as r, jsxs as b } from "react/jsx-runtime";
|
|
2
|
+
import { useQuery as $ } from "@tanstack/react-query";
|
|
3
3
|
import { Check as ue, Copy as fe, ChevronRight as ye, Loader2 as pe } from "lucide-react";
|
|
4
|
-
import { useState as z, useRef as he, createContext as
|
|
4
|
+
import { useState as z, useRef as he, createContext as be, useContext as xe } from "react";
|
|
5
5
|
import { useNivaroClient as U } from "../../context.js";
|
|
6
|
-
import { get as
|
|
7
|
-
import { useRecordReader as
|
|
8
|
-
import { cn as
|
|
9
|
-
import { useChangePulse as
|
|
10
|
-
import { SYSTEM_FIELDS as
|
|
11
|
-
import { RelatedItemLabel as
|
|
12
|
-
const
|
|
13
|
-
function qe(e,
|
|
14
|
-
return
|
|
6
|
+
import { get as O } from "../../lib/commands.js";
|
|
7
|
+
import { useRecordReader as ge } from "../../lib/record-loader.js";
|
|
8
|
+
import { cn as R, titleCase as Z, toLocalDateString as _e, choiceLabel as ke } from "../../lib/utils.js";
|
|
9
|
+
import { useChangePulse as Se } from "./GroupSection.js";
|
|
10
|
+
import { SYSTEM_FIELDS as Ne, SENTINEL_FIELDS as we, applyDisplayTemplate as le, parseJson as ae, richTextToPlain as ee } from "./helpers.js";
|
|
11
|
+
import { RelatedItemLabel as ie } from "./RelationCombobox.js";
|
|
12
|
+
const re = be({});
|
|
13
|
+
function qe(e, n) {
|
|
14
|
+
return n ? Object.entries(n).every(
|
|
15
15
|
([l, a]) => a !== null && typeof a == "object" || String(e[l] ?? "") === String(a ?? "")
|
|
16
16
|
) : !0;
|
|
17
17
|
}
|
|
18
18
|
function Te({
|
|
19
19
|
relation: e,
|
|
20
|
-
parentId:
|
|
20
|
+
parentId: n,
|
|
21
21
|
allRelations: l,
|
|
22
22
|
staging: a,
|
|
23
23
|
maxValues: f
|
|
24
24
|
}) {
|
|
25
|
-
var
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
(
|
|
25
|
+
var L, S, M;
|
|
26
|
+
const s = U(), m = e.many_field ?? "", y = e.junction_field ?? (() => {
|
|
27
|
+
const i = l.find(
|
|
28
|
+
(N) => N.many_collection === e.many_collection && N.id !== e.id
|
|
29
29
|
);
|
|
30
|
-
return (
|
|
31
|
-
})(),
|
|
32
|
-
(
|
|
33
|
-
)) == null ? void 0 :
|
|
30
|
+
return (i == null ? void 0 : i.many_field) ?? "";
|
|
31
|
+
})(), h = e.one_field ?? `${e.many_collection}.${y}`, k = ((L = l.find(
|
|
32
|
+
(i) => i.many_collection === e.many_collection && i.many_field === y && i.id !== e.id
|
|
33
|
+
)) == null ? void 0 : L.one_collection) ?? null, { data: g } = $({
|
|
34
34
|
queryKey: ["summary-junction-relations", e.many_collection],
|
|
35
|
-
queryFn: () =>
|
|
36
|
-
|
|
37
|
-
).then((
|
|
38
|
-
enabled: !
|
|
35
|
+
queryFn: () => s.request(
|
|
36
|
+
O(`/data-model/relations/for/${e.many_collection}`)
|
|
37
|
+
).then((i) => i.data ?? []).catch(() => []),
|
|
38
|
+
enabled: !k && !!e.many_collection && !!y,
|
|
39
39
|
staleTime: 10 * 6e4
|
|
40
|
-
}),
|
|
41
|
-
(
|
|
42
|
-
)) == null ? void 0 :
|
|
43
|
-
queryKey: ["m2m-items", e.many_collection,
|
|
44
|
-
queryFn: () =>
|
|
45
|
-
|
|
46
|
-
filter: JSON.stringify({ [
|
|
40
|
+
}), o = k ?? ((S = g == null ? void 0 : g.find(
|
|
41
|
+
(i) => i.many_collection === e.many_collection && i.many_field === y && !!i.one_collection
|
|
42
|
+
)) == null ? void 0 : S.one_collection) ?? null, { data: c = [] } = $({
|
|
43
|
+
queryKey: ["m2m-items", e.many_collection, m, n],
|
|
44
|
+
queryFn: () => s.request(
|
|
45
|
+
O(`/items/${e.many_collection}`, {
|
|
46
|
+
filter: JSON.stringify({ [m]: { _eq: n } }),
|
|
47
47
|
limit: 200,
|
|
48
48
|
fields: `id,${y}`
|
|
49
49
|
})
|
|
50
|
-
).then((
|
|
50
|
+
).then((i) => i.data ?? []),
|
|
51
51
|
staleTime: 3e4,
|
|
52
|
-
enabled: !!
|
|
53
|
-
}),
|
|
54
|
-
(
|
|
55
|
-
)) == null ? void 0 :
|
|
56
|
-
queryKey: ["summary-m2a-items", e.many_collection,
|
|
57
|
-
queryFn: () =>
|
|
58
|
-
|
|
59
|
-
filter: JSON.stringify({ [
|
|
52
|
+
enabled: !!n && n !== "new"
|
|
53
|
+
}), d = o ? null : ((M = [...l, ...g ?? []].find(
|
|
54
|
+
(i) => i.many_collection === e.many_collection && i.many_field === y && !!i.one_collection_field
|
|
55
|
+
)) == null ? void 0 : M.one_collection_field) ?? null, { data: j = [] } = $({
|
|
56
|
+
queryKey: ["summary-m2a-items", e.many_collection, m, n, d],
|
|
57
|
+
queryFn: () => s.request(
|
|
58
|
+
O(`/items/${e.many_collection}`, {
|
|
59
|
+
filter: JSON.stringify({ [m]: { _eq: n } }),
|
|
60
60
|
limit: 200,
|
|
61
|
-
fields: `id,${y},${
|
|
61
|
+
fields: `id,${y},${d}`
|
|
62
62
|
})
|
|
63
|
-
).then((
|
|
63
|
+
).then((i) => i.data ?? []),
|
|
64
64
|
staleTime: 3e4,
|
|
65
|
-
enabled: !!
|
|
66
|
-
}),
|
|
67
|
-
queryKey: ["col-meta",
|
|
68
|
-
queryFn: () =>
|
|
69
|
-
enabled: !!
|
|
65
|
+
enabled: !!d && !!n && n !== "new"
|
|
66
|
+
}), P = o === "nivaro_files" || o === "directus_files", { data: D } = $({
|
|
67
|
+
queryKey: ["col-meta", o],
|
|
68
|
+
queryFn: () => s.request(O(`/collections/${o}`)).then((i) => i.data),
|
|
69
|
+
enabled: !!o && !P,
|
|
70
70
|
staleTime: 3e5
|
|
71
|
-
}),
|
|
72
|
-
...
|
|
73
|
-
|
|
71
|
+
}), K = (a == null ? void 0 : a.getStagedLinks(h)) ?? [], v = (a == null ? void 0 : a.getStagedUnlinks(h)) ?? /* @__PURE__ */ new Set(), C = c.filter((i) => !v.has(i.id)), q = [
|
|
72
|
+
...K,
|
|
73
|
+
...C.map((i) => i[y]).filter((i) => i != null)
|
|
74
74
|
];
|
|
75
|
-
if (
|
|
75
|
+
if (q.length === 0)
|
|
76
76
|
return /* @__PURE__ */ r("span", { className: "text-slate-400 dark:text-slate-500", children: "—" });
|
|
77
|
-
if (
|
|
78
|
-
const
|
|
79
|
-
return /* @__PURE__ */
|
|
80
|
-
|
|
81
|
-
|
|
77
|
+
if (o) {
|
|
78
|
+
const N = q.slice(0, 5), w = q.length - 5;
|
|
79
|
+
return /* @__PURE__ */ b("span", { className: "text-[12px] text-slate-700 dark:text-slate-200", children: [
|
|
80
|
+
N.map((t, u) => /* @__PURE__ */ b("span", { children: [
|
|
81
|
+
u > 0 && ", ",
|
|
82
82
|
/* @__PURE__ */ r(
|
|
83
|
-
|
|
83
|
+
ie,
|
|
84
84
|
{
|
|
85
|
-
collection:
|
|
86
|
-
id:
|
|
87
|
-
displayTemplate:
|
|
85
|
+
collection: o,
|
|
86
|
+
id: t,
|
|
87
|
+
displayTemplate: D == null ? void 0 : D.display_template
|
|
88
88
|
}
|
|
89
89
|
)
|
|
90
|
-
] }, String(
|
|
91
|
-
|
|
90
|
+
] }, String(t))),
|
|
91
|
+
w > 0 && /* @__PURE__ */ b("span", { className: "text-slate-400 dark:text-slate-500", children: [
|
|
92
92
|
" +",
|
|
93
|
-
|
|
93
|
+
w,
|
|
94
94
|
" more"
|
|
95
95
|
] })
|
|
96
96
|
] });
|
|
97
97
|
}
|
|
98
|
-
const
|
|
99
|
-
if (
|
|
100
|
-
const
|
|
101
|
-
return /* @__PURE__ */
|
|
102
|
-
|
|
103
|
-
|
|
98
|
+
const _ = d ? j.filter((i) => !v.has(i.id) && i[y] != null && i[d]).slice(0, 5) : [];
|
|
99
|
+
if (_.length > 0 && K.length === 0) {
|
|
100
|
+
const i = q.length - _.length;
|
|
101
|
+
return /* @__PURE__ */ b("span", { className: "text-[12px] text-slate-700 dark:text-slate-200", children: [
|
|
102
|
+
_.map((N, w) => /* @__PURE__ */ b("span", { children: [
|
|
103
|
+
w > 0 && ", ",
|
|
104
104
|
/* @__PURE__ */ r(
|
|
105
|
-
|
|
105
|
+
X,
|
|
106
106
|
{
|
|
107
|
-
collection:
|
|
108
|
-
id:
|
|
107
|
+
collection: $e(String(N[d])),
|
|
108
|
+
id: N[y]
|
|
109
109
|
}
|
|
110
110
|
)
|
|
111
|
-
] }, String(
|
|
112
|
-
|
|
111
|
+
] }, String(N.id))),
|
|
112
|
+
i > 0 && /* @__PURE__ */ b("span", { className: "text-slate-400 dark:text-slate-500", children: [
|
|
113
113
|
" +",
|
|
114
|
-
|
|
114
|
+
i,
|
|
115
115
|
" more"
|
|
116
116
|
] })
|
|
117
117
|
] });
|
|
118
118
|
}
|
|
119
|
-
return /* @__PURE__ */
|
|
120
|
-
|
|
119
|
+
return /* @__PURE__ */ b("span", { className: "text-slate-700 dark:text-slate-200", children: [
|
|
120
|
+
q.length,
|
|
121
121
|
" item",
|
|
122
|
-
|
|
122
|
+
q.length !== 1 ? "s" : ""
|
|
123
123
|
] });
|
|
124
124
|
}
|
|
125
|
-
function
|
|
125
|
+
function $e(e) {
|
|
126
126
|
return e === "directus_users" ? "nivaro_users" : e;
|
|
127
127
|
}
|
|
128
|
-
function
|
|
129
|
-
const
|
|
130
|
-
return
|
|
128
|
+
function se(e) {
|
|
129
|
+
const n = U();
|
|
130
|
+
return $({
|
|
131
131
|
queryKey: ["summary-display-template", e],
|
|
132
|
-
queryFn: () =>
|
|
132
|
+
queryFn: () => n.request(O(`/collections/${e}`)).then((l) => {
|
|
133
133
|
var a;
|
|
134
134
|
return ((a = l.data) == null ? void 0 : a.display_template) ?? null;
|
|
135
135
|
}).catch(() => null),
|
|
@@ -137,147 +137,185 @@ function oe(e) {
|
|
|
137
137
|
staleTime: 10 * 6e4
|
|
138
138
|
}).data;
|
|
139
139
|
}
|
|
140
|
-
function
|
|
141
|
-
const l =
|
|
142
|
-
return /* @__PURE__ */ r(
|
|
140
|
+
function X({ collection: e, id: n }) {
|
|
141
|
+
const l = se(e);
|
|
142
|
+
return /* @__PURE__ */ r(ie, { collection: e, id: n, displayTemplate: l ?? void 0 });
|
|
143
143
|
}
|
|
144
|
-
const
|
|
145
|
-
function
|
|
146
|
-
if (
|
|
147
|
-
const l = le(
|
|
144
|
+
const je = ["name", "title", "label", "subject", "description", "line_number"], Le = ["amount", "total", "cost", "price", "quantity"], V = 4, I = 200;
|
|
145
|
+
function Oe(e, n) {
|
|
146
|
+
if (n) {
|
|
147
|
+
const l = le(n, e).replace(/\s*[·|\-–—/]\s*(?=[·|\-–—/]|$)/g, "").replace(/^\s*[·|\-–—/]\s*/, "").trim();
|
|
148
148
|
if (l !== "") return l;
|
|
149
149
|
}
|
|
150
|
-
for (const l of
|
|
150
|
+
for (const l of je) {
|
|
151
151
|
const a = e[l];
|
|
152
152
|
if (a != null && String(a).trim() !== "") return String(a).trim();
|
|
153
153
|
}
|
|
154
154
|
return null;
|
|
155
155
|
}
|
|
156
|
-
|
|
157
|
-
|
|
156
|
+
function ve(e) {
|
|
157
|
+
if (!e) return [];
|
|
158
|
+
const n = /* @__PURE__ */ new Set();
|
|
159
|
+
for (const l of e.matchAll(/\{\{\s*([\w.]+)\s*\}\}/g))
|
|
160
|
+
l[1].includes(".") && !l[1].startsWith(".") && n.add(l[1]);
|
|
161
|
+
return [...n];
|
|
162
|
+
}
|
|
163
|
+
function Ce(e, n, l) {
|
|
164
|
+
if (!n || l.length === 0) return e;
|
|
165
|
+
const a = { ...e };
|
|
166
|
+
for (const f of new Set(l.map((s) => s.split(".")[0]))) {
|
|
167
|
+
const s = n[f];
|
|
168
|
+
s !== null && typeof s == "object" && (a[f] = s);
|
|
169
|
+
}
|
|
170
|
+
return a;
|
|
171
|
+
}
|
|
172
|
+
const Me = ["cifa", "item", "catalog_item", "product", "part", "material"], Ee = /* @__PURE__ */ new Set(["nivaro_users", "directus_users"]);
|
|
173
|
+
function Re(e, n, l) {
|
|
158
174
|
const a = e.filter(
|
|
159
|
-
(
|
|
160
|
-
), f =
|
|
175
|
+
(s) => s.many_collection === n && !!s.many_field && s.many_field !== l && !s.junction_field && !!s.one_collection && !Ee.has(s.one_collection)
|
|
176
|
+
), f = Me.map((s) => a.find((m) => m.many_field === s)).find(Boolean) ?? a[0];
|
|
161
177
|
return f != null && f.many_field && f.one_collection ? { field: f.many_field, collection: f.one_collection } : null;
|
|
162
178
|
}
|
|
163
|
-
function
|
|
179
|
+
function oe({
|
|
164
180
|
relatedCollection: e,
|
|
165
|
-
manyField:
|
|
181
|
+
manyField: n,
|
|
166
182
|
parentId: l,
|
|
167
183
|
rowFilter: a,
|
|
168
184
|
expanded: f
|
|
169
185
|
}) {
|
|
170
|
-
var
|
|
171
|
-
const
|
|
186
|
+
var N, w;
|
|
187
|
+
const s = U(), m = xe(re), y = a && Object.keys(a).length > 0 ? {
|
|
172
188
|
_and: [
|
|
173
|
-
{ [
|
|
189
|
+
{ [n]: { _eq: l } },
|
|
174
190
|
Object.fromEntries(
|
|
175
|
-
Object.entries(a).map(([
|
|
176
|
-
|
|
177
|
-
|
|
191
|
+
Object.entries(a).map(([t, u]) => [
|
|
192
|
+
t,
|
|
193
|
+
u !== null && typeof u == "object" ? u : { _eq: u }
|
|
178
194
|
])
|
|
179
195
|
)
|
|
180
196
|
]
|
|
181
|
-
} : { [
|
|
197
|
+
} : { [n]: { _eq: l } }, { data: h, isLoading: k } = $({
|
|
182
198
|
queryKey: [
|
|
183
199
|
"o2m-rows",
|
|
184
200
|
e,
|
|
185
|
-
|
|
201
|
+
n,
|
|
186
202
|
l,
|
|
187
203
|
a ? JSON.stringify(a) : ""
|
|
188
204
|
],
|
|
189
|
-
queryFn: () =>
|
|
190
|
-
|
|
205
|
+
queryFn: () => s.request(
|
|
206
|
+
O(`/items/${e}`, {
|
|
191
207
|
filter: JSON.stringify(y),
|
|
192
|
-
limit:
|
|
208
|
+
limit: I
|
|
193
209
|
})
|
|
194
|
-
).then((
|
|
210
|
+
).then((t) => t.data ?? []),
|
|
195
211
|
enabled: !!l && l !== "new",
|
|
196
212
|
staleTime: 3e4
|
|
197
|
-
}),
|
|
213
|
+
}), g = se(e), { data: o = [] } = $({
|
|
198
214
|
queryKey: ["collection-relations", e],
|
|
199
|
-
queryFn: () =>
|
|
200
|
-
var
|
|
201
|
-
return ((
|
|
215
|
+
queryFn: () => s.request(O(`/collections/${e}`)).then((t) => {
|
|
216
|
+
var u;
|
|
217
|
+
return ((u = t.data) == null ? void 0 : u.relations) ?? [];
|
|
202
218
|
}),
|
|
203
219
|
staleTime: 10 * 6e4
|
|
204
|
-
}),
|
|
205
|
-
|
|
220
|
+
}), c = Re(o, e, n), d = ve(g), j = [...new Set(d.map((t) => t.split(".")[0]))], P = d.length ? JSON.stringify((h ?? []).map((t) => [t.id, ...j.map((u) => t[u] ?? null)])) : "", { data: D } = $({
|
|
221
|
+
queryKey: [
|
|
222
|
+
"o2m-summary-labels",
|
|
223
|
+
e,
|
|
224
|
+
n,
|
|
225
|
+
l,
|
|
226
|
+
a ? JSON.stringify(a) : "",
|
|
227
|
+
d.join(","),
|
|
228
|
+
P
|
|
229
|
+
],
|
|
230
|
+
queryFn: () => s.request(
|
|
231
|
+
O(`/items/${e}`, {
|
|
232
|
+
filter: JSON.stringify(y),
|
|
233
|
+
fields: ["id", ...d].join(","),
|
|
234
|
+
limit: I
|
|
235
|
+
})
|
|
236
|
+
).then((t) => t.data ?? []).catch(() => []),
|
|
237
|
+
enabled: d.length > 0 && !!l && l !== "new" && ((h == null ? void 0 : h.length) ?? 0) > 0,
|
|
238
|
+
staleTime: 6e4
|
|
239
|
+
}), K = new Map((D ?? []).map((t) => [String(t.id), t])), v = `${e}.${n}`, C = (N = m.deletes) == null ? void 0 : N.get(v), q = (((w = m.rows) == null ? void 0 : w.get(v)) ?? []).filter(
|
|
240
|
+
(t) => qe(t, a)
|
|
206
241
|
), _ = [
|
|
207
|
-
...(
|
|
208
|
-
...
|
|
242
|
+
...(h ?? []).filter((t) => !(C != null && C.has(String(t.id)))),
|
|
243
|
+
...q
|
|
209
244
|
];
|
|
210
|
-
if (
|
|
245
|
+
if (k && q.length === 0)
|
|
211
246
|
return /* @__PURE__ */ r(pe, { className: "h-3 w-3 animate-spin text-slate-400 dark:text-slate-500" });
|
|
212
247
|
if (_.length === 0)
|
|
213
248
|
return /* @__PURE__ */ r("span", { className: "italic text-[11px] text-slate-400 dark:text-slate-500", children: "None yet" });
|
|
214
|
-
const
|
|
215
|
-
(
|
|
216
|
-
(
|
|
249
|
+
const L = ((h == null ? void 0 : h.length) ?? 0) >= I, S = Le.find(
|
|
250
|
+
(t) => _.some(
|
|
251
|
+
(u) => typeof u[t] == "number" || typeof u[t] == "string" && u[t] !== "" && !Number.isNaN(Number(u[t]))
|
|
217
252
|
)
|
|
218
|
-
),
|
|
219
|
-
const
|
|
220
|
-
return
|
|
221
|
-
}, 0) : null,
|
|
222
|
-
return /* @__PURE__ */
|
|
223
|
-
/* @__PURE__ */
|
|
224
|
-
/* @__PURE__ */
|
|
225
|
-
|
|
253
|
+
), M = S && !L ? _.reduce((t, u) => {
|
|
254
|
+
const x = Number(u[S]);
|
|
255
|
+
return t + (Number.isFinite(x) ? x : 0);
|
|
256
|
+
}, 0) : null, i = S ? S !== "quantity" : !1;
|
|
257
|
+
return /* @__PURE__ */ b("span", { className: "block", children: [
|
|
258
|
+
/* @__PURE__ */ b("span", { className: "flex items-baseline gap-2", children: [
|
|
259
|
+
/* @__PURE__ */ b("span", { className: "text-slate-700 dark:text-slate-200", children: [
|
|
260
|
+
L ? `${I}+` : _.length,
|
|
226
261
|
" row",
|
|
227
262
|
_.length !== 1 ? "s" : ""
|
|
228
263
|
] }),
|
|
229
|
-
|
|
264
|
+
M !== null && /* @__PURE__ */ r("span", { className: "tabular-nums text-[11px] text-slate-500 dark:text-slate-400", children: i ? M.toLocaleString(void 0, {
|
|
230
265
|
style: "currency",
|
|
231
266
|
currency: "USD",
|
|
232
|
-
maximumFractionDigits:
|
|
233
|
-
}) :
|
|
267
|
+
maximumFractionDigits: M % 1 === 0 ? 0 : 2
|
|
268
|
+
}) : M.toLocaleString() })
|
|
234
269
|
] }),
|
|
235
|
-
/* @__PURE__ */
|
|
236
|
-
(f ? _ : _.slice(0, V)).map((
|
|
270
|
+
/* @__PURE__ */ b("span", { className: "mt-1 block space-y-0.5", children: [
|
|
271
|
+
(f ? _ : _.slice(0, V)).map((t, u) => /* @__PURE__ */ b(
|
|
237
272
|
"span",
|
|
238
273
|
{
|
|
239
274
|
className: "flex items-baseline justify-between gap-2 text-[11px] text-slate-500 dark:text-slate-400",
|
|
240
275
|
children: [
|
|
241
|
-
/* @__PURE__ */ r("span", { className: "truncate", children:
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
276
|
+
/* @__PURE__ */ r("span", { className: "truncate", children: Oe(
|
|
277
|
+
Ce(t, K.get(String(t.id)), d),
|
|
278
|
+
g ?? null
|
|
279
|
+
) ?? (c && t[c.field] != null && t[c.field] !== "" ? /* @__PURE__ */ r(X, { collection: c.collection, id: t[c.field] }) : `Row ${u + 1}`) }),
|
|
280
|
+
S && t[S] !== null && t[S] !== void 0 && /* @__PURE__ */ r("span", { className: "shrink-0 tabular-nums", children: (() => {
|
|
281
|
+
const x = Number(t[S]);
|
|
282
|
+
return Number.isFinite(x) ? i ? x.toLocaleString(void 0, {
|
|
245
283
|
style: "currency",
|
|
246
284
|
currency: "USD",
|
|
247
|
-
maximumFractionDigits:
|
|
248
|
-
}) :
|
|
285
|
+
maximumFractionDigits: x % 1 === 0 ? 0 : 2
|
|
286
|
+
}) : x.toLocaleString() : String(t[S]);
|
|
249
287
|
})() })
|
|
250
288
|
]
|
|
251
289
|
},
|
|
252
|
-
String(
|
|
290
|
+
String(t.id ?? u)
|
|
253
291
|
)),
|
|
254
|
-
!f && _.length > V && /* @__PURE__ */
|
|
292
|
+
!f && _.length > V && /* @__PURE__ */ b("span", { className: "block text-[11px] italic text-slate-400 dark:text-slate-500", children: [
|
|
255
293
|
"+",
|
|
256
|
-
|
|
294
|
+
L ? `${_.length - V}+` : _.length - V,
|
|
257
295
|
" more"
|
|
258
296
|
] })
|
|
259
297
|
] })
|
|
260
298
|
] });
|
|
261
299
|
}
|
|
262
|
-
function
|
|
263
|
-
const
|
|
264
|
-
return /* @__PURE__ */ r("span", { className:
|
|
300
|
+
function De(e) {
|
|
301
|
+
const n = Se(e.val);
|
|
302
|
+
return /* @__PURE__ */ r("span", { className: R("inline-block max-w-full rounded-sm", n && "nvr-value-pulse-bg"), children: /* @__PURE__ */ r(Ae, { ...e }) });
|
|
265
303
|
}
|
|
266
|
-
function
|
|
304
|
+
function Ae({
|
|
267
305
|
field: e,
|
|
268
|
-
val:
|
|
306
|
+
val: n,
|
|
269
307
|
relations: l,
|
|
270
308
|
collection: a,
|
|
271
309
|
itemId: f,
|
|
272
|
-
staging:
|
|
310
|
+
staging: s
|
|
273
311
|
}) {
|
|
274
|
-
const
|
|
275
|
-
if (!y.has(
|
|
276
|
-
const
|
|
277
|
-
(
|
|
312
|
+
const m = e.interface ?? "", y = /* @__PURE__ */ new Set(["select-multiple-m2m", "files-m2m", "files", "relation-grouped"]);
|
|
313
|
+
if (!y.has(m) && f) {
|
|
314
|
+
const o = l.find(
|
|
315
|
+
(c) => !c.junction_field && (c.one_field === e.field || c.many_collection === e.field) && (c.one_collection === a || c.one_collection == null)
|
|
278
316
|
);
|
|
279
|
-
if (
|
|
280
|
-
const
|
|
317
|
+
if (o != null && o.many_collection && o.many_field) {
|
|
318
|
+
const c = (() => {
|
|
281
319
|
try {
|
|
282
320
|
return typeof e.options == "string" ? JSON.parse(e.options) : e.options ?? {};
|
|
283
321
|
} catch {
|
|
@@ -285,137 +323,137 @@ function Re({
|
|
|
285
323
|
}
|
|
286
324
|
})();
|
|
287
325
|
return /* @__PURE__ */ r(
|
|
288
|
-
|
|
326
|
+
oe,
|
|
289
327
|
{
|
|
290
|
-
relatedCollection:
|
|
291
|
-
manyField:
|
|
328
|
+
relatedCollection: o.many_collection,
|
|
329
|
+
manyField: o.many_field,
|
|
292
330
|
parentId: f,
|
|
293
|
-
rowFilter:
|
|
331
|
+
rowFilter: c.row_filter && typeof c.row_filter == "object" ? c.row_filter : void 0
|
|
294
332
|
}
|
|
295
333
|
);
|
|
296
334
|
}
|
|
297
335
|
}
|
|
298
|
-
if (y.has(
|
|
299
|
-
const
|
|
300
|
-
(
|
|
301
|
-
),
|
|
302
|
-
const
|
|
303
|
-
(
|
|
336
|
+
if (y.has(m) && f) {
|
|
337
|
+
const o = l.find(
|
|
338
|
+
(d) => d.one_collection === a && (d.one_field === e.field || d.junction_field != null && d.many_collection === e.field)
|
|
339
|
+
), c = o ? o.junction_field ? o : (() => {
|
|
340
|
+
const d = l.find(
|
|
341
|
+
(j) => j.many_collection === o.many_collection && j.id !== o.id
|
|
304
342
|
);
|
|
305
|
-
return
|
|
343
|
+
return d ? { ...o, junction_field: d.many_field } : null;
|
|
306
344
|
})() : null;
|
|
307
|
-
if (
|
|
308
|
-
const
|
|
345
|
+
if (c) {
|
|
346
|
+
const d = ae(e.options);
|
|
309
347
|
return /* @__PURE__ */ r(
|
|
310
348
|
Te,
|
|
311
349
|
{
|
|
312
|
-
relation:
|
|
350
|
+
relation: c,
|
|
313
351
|
parentId: f,
|
|
314
352
|
allRelations: l,
|
|
315
|
-
staging:
|
|
316
|
-
maxValues:
|
|
353
|
+
staging: s,
|
|
354
|
+
maxValues: d == null ? void 0 : d.max_values
|
|
317
355
|
}
|
|
318
356
|
);
|
|
319
357
|
}
|
|
320
358
|
}
|
|
321
|
-
const
|
|
322
|
-
if (
|
|
359
|
+
const h = n == null || n === "";
|
|
360
|
+
if (h && e.type === "boolean")
|
|
323
361
|
return /* @__PURE__ */ r("span", { className: "text-slate-700 dark:text-slate-200", children: "No" });
|
|
324
|
-
if (
|
|
325
|
-
if (
|
|
326
|
-
const
|
|
327
|
-
if (
|
|
328
|
-
return /* @__PURE__ */ r("span", { className: "truncate text-slate-700 dark:text-slate-200", title:
|
|
362
|
+
if (h) return /* @__PURE__ */ r("span", { className: "text-slate-400 dark:text-slate-500", children: "—" });
|
|
363
|
+
if (m === "extension-editorjs" || m === "input-rich-text-html" || m === "rich_text" || m === "wysiwyg" || typeof n == "string") {
|
|
364
|
+
const o = Fe(n, m);
|
|
365
|
+
if (o !== null)
|
|
366
|
+
return /* @__PURE__ */ r("span", { className: "truncate text-slate-700 dark:text-slate-200", title: o, children: o || "—" });
|
|
329
367
|
}
|
|
330
|
-
if (typeof
|
|
331
|
-
return /* @__PURE__ */ r("span", { className: "text-slate-700 dark:text-slate-200", children:
|
|
332
|
-
const
|
|
333
|
-
(
|
|
368
|
+
if (typeof n == "boolean")
|
|
369
|
+
return /* @__PURE__ */ r("span", { className: "text-slate-700 dark:text-slate-200", children: n ? "Yes" : "No" });
|
|
370
|
+
const k = l.find(
|
|
371
|
+
(o) => o.many_collection === a && o.many_field === e.field && !o.junction_field
|
|
334
372
|
);
|
|
335
|
-
if (
|
|
336
|
-
return /* @__PURE__ */ r(
|
|
373
|
+
if (k != null && k.one_collection)
|
|
374
|
+
return /* @__PURE__ */ r(X, { collection: k.one_collection, id: n });
|
|
337
375
|
if (e.type === "datetime" || e.type === "date")
|
|
338
376
|
try {
|
|
339
|
-
return /* @__PURE__ */ r("span", { className: "text-slate-700 dark:text-slate-200", children:
|
|
377
|
+
return /* @__PURE__ */ r("span", { className: "text-slate-700 dark:text-slate-200", children: _e(n) });
|
|
340
378
|
} catch {
|
|
341
379
|
}
|
|
342
|
-
const
|
|
343
|
-
return /* @__PURE__ */ r("span", { className: "truncate text-slate-700 dark:text-slate-200", children:
|
|
380
|
+
const g = Ke(e.options, n);
|
|
381
|
+
return /* @__PURE__ */ r("span", { className: "truncate text-slate-700 dark:text-slate-200", children: g ?? String(n) });
|
|
344
382
|
}
|
|
345
|
-
function
|
|
383
|
+
function Ke(e, n) {
|
|
346
384
|
var f;
|
|
347
|
-
if (
|
|
385
|
+
if (n == null || typeof n == "object") return null;
|
|
348
386
|
const l = ae(
|
|
349
387
|
e
|
|
350
|
-
), a = (f = l == null ? void 0 : l.choices) == null ? void 0 : f.find((
|
|
388
|
+
), a = (f = l == null ? void 0 : l.choices) == null ? void 0 : f.find((s) => s && String(s.value) === String(n));
|
|
351
389
|
return (a == null ? void 0 : a.text) != null ? ke(a.text) : null;
|
|
352
390
|
}
|
|
353
|
-
const
|
|
391
|
+
const Pe = /* @__PURE__ */ new Set([
|
|
354
392
|
"extension-editorjs",
|
|
355
393
|
"input-rich-text-html",
|
|
356
394
|
"rich_text",
|
|
357
395
|
"wysiwyg"
|
|
358
396
|
]);
|
|
359
|
-
function
|
|
397
|
+
function Fe(e, n) {
|
|
360
398
|
if (typeof e != "string") return null;
|
|
361
|
-
if (
|
|
399
|
+
if (Pe.has(n)) return ee(e);
|
|
362
400
|
const l = e.trim();
|
|
363
401
|
return l.startsWith("{") && /"blocks"\s*:/.test(l) ? ee(e) : null;
|
|
364
402
|
}
|
|
365
|
-
function
|
|
403
|
+
function Je(e) {
|
|
366
404
|
if (e == null || e === "") return "—";
|
|
367
405
|
if (typeof e == "boolean") return e ? "Yes" : "No";
|
|
368
|
-
const
|
|
369
|
-
if (/^\d{4}-\d{2}-\d{2}T/.test(
|
|
406
|
+
const n = String(e);
|
|
407
|
+
if (/^\d{4}-\d{2}-\d{2}T/.test(n))
|
|
370
408
|
try {
|
|
371
|
-
return new Date(
|
|
409
|
+
return new Date(n).toLocaleDateString();
|
|
372
410
|
} catch {
|
|
373
411
|
}
|
|
374
|
-
return
|
|
412
|
+
return n;
|
|
375
413
|
}
|
|
376
414
|
const te = (e) => {
|
|
377
415
|
if (e == null || e === "") return "empty";
|
|
378
416
|
if (typeof e == "boolean") return e ? "Yes" : "No";
|
|
379
417
|
if (typeof e == "object")
|
|
380
418
|
return e.id != null ? "a linked record" : Array.isArray(e) ? `${e.length} items` : "a value";
|
|
381
|
-
const
|
|
382
|
-
return
|
|
419
|
+
const n = String(e).replace(/<[^>]+>/g, "").trim();
|
|
420
|
+
return n.length > 48 ? `${n.slice(0, 48)}…` : n;
|
|
383
421
|
};
|
|
384
|
-
function ne(e,
|
|
385
|
-
const l = U(), a =
|
|
422
|
+
function ne(e, n) {
|
|
423
|
+
const l = U(), a = ge(), f = !!e && n != null && n !== "", { data: s } = $({
|
|
386
424
|
queryKey: ["cbv-collection-meta", e],
|
|
387
|
-
queryFn: () => l.request(
|
|
425
|
+
queryFn: () => l.request(O(`/collections/${e}`)).then((h) => h.data),
|
|
388
426
|
enabled: f,
|
|
389
427
|
staleTime: 10 * 6e4,
|
|
390
428
|
retry: !1
|
|
391
|
-
}), { data:
|
|
392
|
-
queryKey: ["rrv-related", e, String(
|
|
393
|
-
queryFn: () => a(e,
|
|
394
|
-
enabled: f && !!
|
|
429
|
+
}), { data: m } = $({
|
|
430
|
+
queryKey: ["rrv-related", e, String(n)],
|
|
431
|
+
queryFn: () => a(e, n).catch(() => null),
|
|
432
|
+
enabled: f && !!s,
|
|
395
433
|
staleTime: 6e4,
|
|
396
434
|
retry: !1
|
|
397
435
|
});
|
|
398
436
|
if (!f) return null;
|
|
399
|
-
if (!
|
|
400
|
-
const y = le(
|
|
437
|
+
if (!m) return "a linked record";
|
|
438
|
+
const y = le(s == null ? void 0 : s.display_template, m).trim();
|
|
401
439
|
if (y) return y;
|
|
402
|
-
for (const
|
|
440
|
+
for (const h of ["name", "title", "label", "number", "email"]) if (m[h]) return String(m[h]);
|
|
403
441
|
return "a linked record";
|
|
404
442
|
}
|
|
405
|
-
function
|
|
443
|
+
function Ve({
|
|
406
444
|
field: e,
|
|
407
|
-
from:
|
|
445
|
+
from: n,
|
|
408
446
|
to: l,
|
|
409
447
|
detail: a,
|
|
410
448
|
relations: f,
|
|
411
|
-
collection:
|
|
412
|
-
onRevert:
|
|
449
|
+
collection: s,
|
|
450
|
+
onRevert: m
|
|
413
451
|
}) {
|
|
414
|
-
var
|
|
415
|
-
const y = ((
|
|
416
|
-
(
|
|
417
|
-
)) == null ? void 0 :
|
|
418
|
-
return
|
|
452
|
+
var o;
|
|
453
|
+
const y = ((o = f.find(
|
|
454
|
+
(c) => c.many_collection === s && c.many_field === e.field && !!c.one_collection
|
|
455
|
+
)) == null ? void 0 : o.one_collection) ?? null, h = ne(y, n), k = ne(y, l), g = a ? `Unsaved — ${a}` : `Unsaved — was ${h ?? te(n)} → now ${k ?? te(l)}`;
|
|
456
|
+
return m ? (
|
|
419
457
|
// biome-ignore lint/a11y/useSemanticElements: nested inside the row's <button> — a real <button> is invalid there
|
|
420
458
|
/* @__PURE__ */ r(
|
|
421
459
|
"span",
|
|
@@ -423,13 +461,13 @@ function Pe({
|
|
|
423
461
|
role: "button",
|
|
424
462
|
tabIndex: 0,
|
|
425
463
|
"data-summary-changed": !0,
|
|
426
|
-
"data-tip": `${
|
|
464
|
+
"data-tip": `${g} · click to revert`,
|
|
427
465
|
"aria-label": "Revert this change",
|
|
428
|
-
onClick: (
|
|
429
|
-
|
|
466
|
+
onClick: (c) => {
|
|
467
|
+
c.stopPropagation(), m();
|
|
430
468
|
},
|
|
431
|
-
onKeyDown: (
|
|
432
|
-
(
|
|
469
|
+
onKeyDown: (c) => {
|
|
470
|
+
(c.key === "Enter" || c.key === " ") && (c.preventDefault(), c.stopPropagation(), m());
|
|
433
471
|
},
|
|
434
472
|
className: "group/dot inline-flex h-4 w-4 shrink-0 cursor-pointer items-center justify-center rounded-full hover:bg-amber-100 dark:hover:bg-amber-500/20",
|
|
435
473
|
children: /* @__PURE__ */ r("span", { className: "h-1.5 w-1.5 rounded-full bg-amber-400 ring-2 ring-amber-100 group-hover/dot:ring-amber-200 dark:ring-amber-500/30" })
|
|
@@ -439,98 +477,98 @@ function Pe({
|
|
|
439
477
|
"span",
|
|
440
478
|
{
|
|
441
479
|
"data-summary-changed": !0,
|
|
442
|
-
"data-tip":
|
|
480
|
+
"data-tip": g,
|
|
443
481
|
className: "h-1.5 w-1.5 shrink-0 rounded-full bg-amber-400 ring-2 ring-amber-100 dark:ring-amber-500/30"
|
|
444
482
|
}
|
|
445
483
|
);
|
|
446
484
|
}
|
|
447
|
-
function
|
|
485
|
+
function et({
|
|
448
486
|
allSteps: e,
|
|
449
|
-
groupedMap:
|
|
487
|
+
groupedMap: n,
|
|
450
488
|
ungroupedFields: l,
|
|
451
489
|
sectionGroups: a,
|
|
452
490
|
draft: f,
|
|
453
|
-
relations:
|
|
454
|
-
collection:
|
|
491
|
+
relations: s,
|
|
492
|
+
collection: m,
|
|
455
493
|
itemId: y,
|
|
456
|
-
staging:
|
|
457
|
-
errors:
|
|
458
|
-
staleFields:
|
|
459
|
-
aliasEmptiness:
|
|
460
|
-
layoutFields:
|
|
461
|
-
changedFields:
|
|
462
|
-
onRevertChange:
|
|
463
|
-
onFieldClick:
|
|
464
|
-
stagedO2MRows:
|
|
465
|
-
stagedO2MDeletes:
|
|
494
|
+
staging: h,
|
|
495
|
+
errors: k,
|
|
496
|
+
staleFields: g,
|
|
497
|
+
aliasEmptiness: o,
|
|
498
|
+
layoutFields: c,
|
|
499
|
+
changedFields: d,
|
|
500
|
+
onRevertChange: j,
|
|
501
|
+
onFieldClick: P,
|
|
502
|
+
stagedO2MRows: D,
|
|
503
|
+
stagedO2MDeletes: K
|
|
466
504
|
}) {
|
|
467
|
-
const [
|
|
468
|
-
...!e.some((
|
|
505
|
+
const [v, C] = z(null), [q, _] = z(null), L = he(/* @__PURE__ */ new Map()), i = [
|
|
506
|
+
...!e.some((t) => t.key === "__general__") && l.length > 0 ? [{ key: "__general__", label: "General" }] : [],
|
|
469
507
|
...e
|
|
470
|
-
].map((
|
|
471
|
-
const
|
|
472
|
-
return { step:
|
|
473
|
-
}).filter((
|
|
474
|
-
(
|
|
475
|
-
(!
|
|
508
|
+
].map((t) => {
|
|
509
|
+
const u = (t.key === "__general__" ? [...l, ...a.flatMap((x) => n[x.key] ?? [])] : n[t.key] ?? []).filter((x) => !x.hidden && !Ne.has(x.field) && !we.has(x.field));
|
|
510
|
+
return { step: t, fields: u };
|
|
511
|
+
}).filter((t) => t.fields.length > 0), N = new Set(i.flatMap((t) => t.fields.map((u) => u.field))), w = y && y !== "new" ? s.filter(
|
|
512
|
+
(t) => !t.junction_field && t.many_field && t.many_collection && (t.one_collection === m || t.one_collection == null) && t.one_field != null && !N.has(t.one_field) && // Off-layout aliases stay out — the sidebar summarizes THIS layout.
|
|
513
|
+
(!c || c.has(t.one_field))
|
|
476
514
|
) : [];
|
|
477
|
-
return
|
|
515
|
+
return i.length === 0 && w.length === 0 ? null : /* @__PURE__ */ r(re.Provider, { value: { rows: D, deletes: K }, children: /* @__PURE__ */ b("div", { className: "overflow-hidden bg-white dark:bg-card", children: [
|
|
478
516
|
/* @__PURE__ */ r("div", { className: "bg-slate-200 border-b border-slate-300 px-4 py-2.5 dark:bg-white/[0.1] dark:border-border", children: /* @__PURE__ */ r("span", { className: "text-[12px] font-semibold text-slate-700 dark:text-slate-200", children: "Summary" }) }),
|
|
479
|
-
|
|
517
|
+
i.map(({ step: t, fields: u }, x) => /* @__PURE__ */ b("div", { children: [
|
|
480
518
|
/* @__PURE__ */ r(
|
|
481
519
|
"div",
|
|
482
520
|
{
|
|
483
|
-
className:
|
|
521
|
+
className: R(
|
|
484
522
|
"bg-slate-100 px-4 py-2 border-b border-slate-200 dark:bg-white/[0.06] dark:border-border/80",
|
|
485
|
-
|
|
523
|
+
x > 0 && "border-t border-slate-200 dark:border-border/80"
|
|
486
524
|
),
|
|
487
|
-
children: /* @__PURE__ */ r("span", { className: "text-[11px] font-semibold text-slate-600 dark:text-slate-300", children:
|
|
525
|
+
children: /* @__PURE__ */ r("span", { className: "text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: t.label })
|
|
488
526
|
}
|
|
489
527
|
),
|
|
490
|
-
|
|
491
|
-
const T = f[p.field],
|
|
492
|
-
return /* @__PURE__ */
|
|
528
|
+
u.map((p, J) => {
|
|
529
|
+
const T = f[p.field], E = p.label ?? Z(p.field), A = !!(k != null && k[p.field]), F = o == null ? void 0 : o[p.field], ce = F !== void 0 ? F === !0 : T == null || typeof T == "string" && T.trim() === "" || Array.isArray(T) && T.length === 0, de = F === null, H = !!p.required && ce && !A && !de, W = (g == null ? void 0 : g.has(p.field)) ?? !1;
|
|
530
|
+
return /* @__PURE__ */ b(
|
|
493
531
|
"div",
|
|
494
532
|
{
|
|
495
|
-
className:
|
|
533
|
+
className: R(
|
|
496
534
|
"group/row flex items-stretch",
|
|
497
|
-
|
|
498
|
-
|
|
535
|
+
J < u.length - 1 && "border-b border-slate-100 dark:border-border/60",
|
|
536
|
+
A ? "bg-red-50 dark:bg-red-900/10" : H || W ? "bg-amber-50/70 dark:bg-amber-900/10" : ""
|
|
499
537
|
),
|
|
500
538
|
children: [
|
|
501
|
-
/* @__PURE__ */
|
|
539
|
+
/* @__PURE__ */ b(
|
|
502
540
|
"button",
|
|
503
541
|
{
|
|
504
542
|
type: "button",
|
|
505
|
-
onClick: () =>
|
|
506
|
-
className:
|
|
543
|
+
onClick: () => P(t.key, p.field),
|
|
544
|
+
className: R(
|
|
507
545
|
"flex flex-1 flex-col px-4 py-2 text-left transition-colors duration-150 min-w-0",
|
|
508
|
-
|
|
546
|
+
A ? "hover:bg-red-50 dark:hover:bg-red-900/15" : "hover:bg-slate-50 dark:hover:bg-white/[0.03]"
|
|
509
547
|
),
|
|
510
548
|
children: [
|
|
511
|
-
/* @__PURE__ */
|
|
549
|
+
/* @__PURE__ */ b(
|
|
512
550
|
"span",
|
|
513
551
|
{
|
|
514
|
-
className:
|
|
552
|
+
className: R(
|
|
515
553
|
"flex items-center gap-1 text-[10px] font-medium truncate",
|
|
516
|
-
|
|
554
|
+
A ? "text-red-500 dark:text-red-400" : H || W ? "text-amber-700 dark:text-amber-400" : "text-slate-400 dark:text-slate-500"
|
|
517
555
|
),
|
|
518
556
|
children: [
|
|
519
|
-
/* @__PURE__ */ r("span", { className: "truncate", children:
|
|
520
|
-
(
|
|
521
|
-
|
|
557
|
+
/* @__PURE__ */ r("span", { className: "truncate", children: E }),
|
|
558
|
+
(d == null ? void 0 : d[p.field]) && /* @__PURE__ */ r(
|
|
559
|
+
Ve,
|
|
522
560
|
{
|
|
523
561
|
field: p,
|
|
524
|
-
from:
|
|
525
|
-
detail:
|
|
562
|
+
from: d[p.field].from,
|
|
563
|
+
detail: d[p.field].detail,
|
|
526
564
|
to: T,
|
|
527
|
-
relations:
|
|
528
|
-
collection:
|
|
529
|
-
onRevert:
|
|
565
|
+
relations: s,
|
|
566
|
+
collection: m,
|
|
567
|
+
onRevert: j ? () => j(p.field) : void 0
|
|
530
568
|
}
|
|
531
569
|
),
|
|
532
|
-
|
|
533
|
-
|
|
570
|
+
H && /* @__PURE__ */ r("span", { className: "shrink-0 rounded bg-amber-100 px-1 text-[9px] font-semibold uppercase tracking-wide text-amber-700 dark:bg-amber-900/30 dark:text-amber-400", children: "required" }),
|
|
571
|
+
W && /* @__PURE__ */ r(
|
|
534
572
|
"span",
|
|
535
573
|
{
|
|
536
574
|
title: "This value is no longer one of the available options",
|
|
@@ -544,19 +582,19 @@ function ze({
|
|
|
544
582
|
/* @__PURE__ */ r(
|
|
545
583
|
"span",
|
|
546
584
|
{
|
|
547
|
-
ref: (
|
|
548
|
-
|
|
585
|
+
ref: (B) => {
|
|
586
|
+
L.current.set(p.field, B);
|
|
549
587
|
},
|
|
550
588
|
className: "mt-0.5 w-full text-[12px] min-w-0 overflow-hidden",
|
|
551
589
|
children: /* @__PURE__ */ r(
|
|
552
|
-
|
|
590
|
+
De,
|
|
553
591
|
{
|
|
554
592
|
field: p,
|
|
555
593
|
val: T,
|
|
556
|
-
relations:
|
|
557
|
-
collection:
|
|
594
|
+
relations: s,
|
|
595
|
+
collection: m,
|
|
558
596
|
itemId: y,
|
|
559
|
-
staging:
|
|
597
|
+
staging: h
|
|
560
598
|
}
|
|
561
599
|
)
|
|
562
600
|
}
|
|
@@ -569,21 +607,21 @@ function ze({
|
|
|
569
607
|
{
|
|
570
608
|
type: "button",
|
|
571
609
|
title: "Copy value",
|
|
572
|
-
onClick: (
|
|
573
|
-
var
|
|
574
|
-
|
|
575
|
-
const me = ((G = (
|
|
610
|
+
onClick: (B) => {
|
|
611
|
+
var Y, G;
|
|
612
|
+
B.stopPropagation();
|
|
613
|
+
const me = ((G = (Y = L.current.get(p.field)) == null ? void 0 : Y.textContent) == null ? void 0 : G.trim()) ?? Je(T);
|
|
576
614
|
navigator.clipboard.writeText(me).catch(() => {
|
|
577
|
-
}),
|
|
578
|
-
() =>
|
|
615
|
+
}), C(p.field), setTimeout(
|
|
616
|
+
() => C((Q) => Q === p.field ? null : Q),
|
|
579
617
|
1500
|
|
580
618
|
);
|
|
581
619
|
},
|
|
582
|
-
className:
|
|
620
|
+
className: R(
|
|
583
621
|
"flex items-center px-2 opacity-0 group-hover/row:opacity-100 transition-all duration-150",
|
|
584
|
-
|
|
622
|
+
v === p.field ? "text-emerald-500" : "text-slate-400 hover:text-slate-600 dark:text-slate-500 dark:hover:text-slate-300"
|
|
585
623
|
),
|
|
586
|
-
children:
|
|
624
|
+
children: v === p.field ? /* @__PURE__ */ r(ue, { className: "h-3 w-3" }) : /* @__PURE__ */ r(fe, { className: "h-3 w-3" })
|
|
587
625
|
}
|
|
588
626
|
)
|
|
589
627
|
]
|
|
@@ -591,31 +629,31 @@ function ze({
|
|
|
591
629
|
p.field
|
|
592
630
|
);
|
|
593
631
|
})
|
|
594
|
-
] },
|
|
595
|
-
|
|
632
|
+
] }, t.key)),
|
|
633
|
+
w.length > 0 && /* @__PURE__ */ b("div", { children: [
|
|
596
634
|
/* @__PURE__ */ r("div", { className: "bg-slate-100 px-4 py-2 border-y border-slate-200 dark:bg-white/[0.06] dark:border-border/80", children: /* @__PURE__ */ r("span", { className: "text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: "Related" }) }),
|
|
597
|
-
|
|
598
|
-
const
|
|
635
|
+
w.map((t, u) => {
|
|
636
|
+
const x = t.one_field ?? t.many_collection ?? "", p = q === x;
|
|
599
637
|
return /* @__PURE__ */ r(
|
|
600
638
|
"div",
|
|
601
639
|
{
|
|
602
|
-
className:
|
|
640
|
+
className: R(
|
|
603
641
|
"flex items-stretch",
|
|
604
|
-
|
|
642
|
+
u < w.length - 1 && "border-b border-slate-100 dark:border-border/60"
|
|
605
643
|
),
|
|
606
|
-
children: /* @__PURE__ */
|
|
644
|
+
children: /* @__PURE__ */ b(
|
|
607
645
|
"button",
|
|
608
646
|
{
|
|
609
647
|
type: "button",
|
|
610
648
|
onClick: () => {
|
|
611
|
-
var
|
|
612
|
-
const
|
|
613
|
-
if (!
|
|
614
|
-
|
|
649
|
+
var A;
|
|
650
|
+
const J = t.many_collection ?? "", T = /(^|_)(notes?|comments?)$/i.test(J), E = document.querySelector(`[data-o2m-collection="${J}"]`) ?? (T ? document.querySelector('[data-panel="notes"]') : null);
|
|
651
|
+
if (!E) {
|
|
652
|
+
_((F) => F === x ? null : x);
|
|
615
653
|
return;
|
|
616
654
|
}
|
|
617
|
-
|
|
618
|
-
() =>
|
|
655
|
+
E.getAttribute("data-panel-expanded") === "false" && ((A = E.querySelector("[data-panel-toggle]")) == null || A.click()), E.scrollIntoView({ behavior: "smooth", block: "center" }), E.classList.add("ring-2", "ring-nvr-cyan", "ring-offset-2", "rounded-md"), setTimeout(
|
|
656
|
+
() => E.classList.remove(
|
|
619
657
|
"ring-2",
|
|
620
658
|
"ring-nvr-cyan",
|
|
621
659
|
"ring-offset-2",
|
|
@@ -626,23 +664,23 @@ function ze({
|
|
|
626
664
|
},
|
|
627
665
|
className: "flex flex-1 flex-col px-4 py-2 min-w-0 text-left transition-colors hover:bg-nvr-cyan/5",
|
|
628
666
|
children: [
|
|
629
|
-
/* @__PURE__ */
|
|
667
|
+
/* @__PURE__ */ b("span", { className: "flex items-center gap-1 text-[10px] font-medium truncate text-slate-400 dark:text-slate-500", children: [
|
|
630
668
|
/* @__PURE__ */ r(
|
|
631
669
|
ye,
|
|
632
670
|
{
|
|
633
|
-
className:
|
|
671
|
+
className: R(
|
|
634
672
|
"h-3 w-3 shrink-0 transition-transform",
|
|
635
673
|
p && "rotate-90"
|
|
636
674
|
)
|
|
637
675
|
}
|
|
638
676
|
),
|
|
639
|
-
Z(
|
|
677
|
+
Z(t.one_field ?? t.many_collection ?? "")
|
|
640
678
|
] }),
|
|
641
679
|
/* @__PURE__ */ r("span", { className: "mt-0.5 text-[12px]", children: /* @__PURE__ */ r(
|
|
642
|
-
|
|
680
|
+
oe,
|
|
643
681
|
{
|
|
644
|
-
relatedCollection:
|
|
645
|
-
manyField:
|
|
682
|
+
relatedCollection: t.many_collection ?? "",
|
|
683
|
+
manyField: t.many_field,
|
|
646
684
|
parentId: y,
|
|
647
685
|
expanded: p
|
|
648
686
|
}
|
|
@@ -651,18 +689,20 @@ function ze({
|
|
|
651
689
|
}
|
|
652
690
|
)
|
|
653
691
|
},
|
|
654
|
-
|
|
692
|
+
t.id ?? `${t.many_collection}.${t.many_field}`
|
|
655
693
|
);
|
|
656
694
|
})
|
|
657
695
|
] })
|
|
658
696
|
] }) });
|
|
659
697
|
}
|
|
660
698
|
export {
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
699
|
+
X as M2OSummaryValue,
|
|
700
|
+
De as SummaryFieldValue,
|
|
701
|
+
et as SummaryPanel,
|
|
702
|
+
Re as o2mItemRelation,
|
|
703
|
+
Oe as o2mRowLabel,
|
|
704
|
+
Ke as summaryChoiceLabel,
|
|
705
|
+
Fe as summaryPlainText,
|
|
706
|
+
ve as templateRelationPaths,
|
|
707
|
+
Ce as withTemplateRelations
|
|
668
708
|
};
|