@nivaro/react 0.3.52 → 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/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +47 -3
- package/dist/shared/components/ItemEditForm.js +4196 -4163
- package/dist/shared/components/NotificationBell.js +163 -150
- package/dist/shared/components/PageRenderer.js +645 -593
- package/dist/shared/components/ProfileView.js +36 -34
- package/dist/shared/components/QueryStatStrip.js +96 -89
- package/dist/shared/components/QueryTable.js +214 -215
- package/dist/shared/components/ReportView.js +548 -529
- package/dist/shared/components/alerts/AlertManagerView.js +346 -320
- package/dist/shared/components/item-edit/CatalogPickerField.js +1300 -1219
- package/dist/shared/components/item-edit/DraftRecoveryBanner.js +52 -54
- package/dist/shared/components/item-edit/FieldAffordances.js +145 -136
- package/dist/shared/components/item-edit/FieldRenderer.js +366 -326
- package/dist/shared/components/item-edit/InlineTableField.js +3047 -2932
- package/dist/shared/components/item-edit/NestedRelationEditor.js +149 -143
- package/dist/shared/components/item-edit/PersonalDefaultControl.js +12 -11
- package/dist/shared/components/item-edit/PlanGrid.js +718 -705
- package/dist/shared/components/item-edit/RelationCombobox.js +23 -20
- package/dist/shared/components/item-edit/SummaryPanel.js +415 -361
- package/dist/shared/components/item-edit/line-qty.js +115 -53
- package/dist/shared/components/item-edit/save-outcome.js +48 -0
- package/dist/shared/components/item-edit/save-refusal.js +18 -18
- package/dist/shared/components/item-edit/stale-banner.js +13 -0
- package/dist/shared/components/item-edit/usePersonalDefaults.js +225 -220
- package/dist/shared/components/panels/CommentPanel.js +204 -197
- package/dist/shared/components/panels/ItemLockBanner.js +318 -291
- package/dist/shared/components/panels/PipelinePanel.js +1388 -1218
- package/dist/shared/components/panels/RecordIntegrityBanner.js +201 -172
- package/dist/shared/components/panels/RevisionsPanel.js +101 -106
- package/dist/shared/components/panels/TransitionRequirementsDialog.js +564 -534
- package/dist/shared/components/panels/requirement-side-effects.js +46 -29
- package/dist/shared/components/queue/QueueItemSheet.js +219 -146
- package/dist/shared/components/queue/QueueWorklist.js +738 -730
- package/dist/shared/components/widgets/ReviewListWidget.js +236 -201
- package/dist/shared/lib/activity-sentence.js +236 -227
- package/dist/shared/lib/draft-store.js +35 -29
- package/dist/shared/lib/page-widget-access.js +11 -0
- package/dist/shared/lib/record-ref.js +43 -34
- package/package.json +1 -1
|
@@ -1,524 +1,574 @@
|
|
|
1
|
-
import { jsx 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
|
|
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
|
|
6
|
+
import { get as O } from "../../lib/commands.js";
|
|
7
7
|
import { useRecordReader as ge } from "../../lib/record-loader.js";
|
|
8
|
-
import { cn as
|
|
9
|
-
import { useChangePulse as
|
|
10
|
-
import { SYSTEM_FIELDS as
|
|
11
|
-
import { RelatedItemLabel as
|
|
12
|
-
const re =
|
|
13
|
-
function qe(e,
|
|
14
|
-
return
|
|
15
|
-
([
|
|
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
|
+
([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:
|
|
21
|
-
allRelations:
|
|
20
|
+
parentId: n,
|
|
21
|
+
allRelations: l,
|
|
22
22
|
staging: a,
|
|
23
|
-
maxValues:
|
|
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
|
-
fields: `id,${
|
|
48
|
+
fields: `id,${y}`
|
|
49
49
|
})
|
|
50
|
-
).then((
|
|
50
|
+
).then((i) => i.data ?? []),
|
|
51
51
|
staleTime: 3e4,
|
|
52
|
-
enabled: !!
|
|
53
|
-
}), d =
|
|
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,${
|
|
61
|
+
fields: `id,${y},${d}`
|
|
62
62
|
})
|
|
63
|
-
).then((
|
|
63
|
+
).then((i) => i.data ?? []),
|
|
64
64
|
staleTime: 3e4,
|
|
65
|
-
enabled: !!d && !!
|
|
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 (
|
|
76
|
-
return /* @__PURE__ */
|
|
77
|
-
if (
|
|
78
|
-
const
|
|
79
|
-
return /* @__PURE__ */
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
/* @__PURE__ */
|
|
83
|
-
|
|
75
|
+
if (q.length === 0)
|
|
76
|
+
return /* @__PURE__ */ r("span", { className: "text-slate-400 dark:text-slate-500", children: "—" });
|
|
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
|
+
/* @__PURE__ */ r(
|
|
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
|
-
|
|
104
|
-
/* @__PURE__ */
|
|
105
|
-
|
|
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
|
+
/* @__PURE__ */ r(
|
|
105
|
+
X,
|
|
106
106
|
{
|
|
107
|
-
collection: $e(String(
|
|
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
125
|
function $e(e) {
|
|
126
126
|
return e === "directus_users" ? "nivaro_users" : e;
|
|
127
127
|
}
|
|
128
128
|
function se(e) {
|
|
129
|
-
const
|
|
130
|
-
return
|
|
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
|
-
return ((a =
|
|
134
|
+
return ((a = l.data) == null ? void 0 : a.display_template) ?? null;
|
|
135
135
|
}).catch(() => null),
|
|
136
136
|
enabled: !!e,
|
|
137
137
|
staleTime: 10 * 6e4
|
|
138
138
|
}).data;
|
|
139
139
|
}
|
|
140
|
-
function
|
|
141
|
-
const
|
|
142
|
-
return /* @__PURE__ */
|
|
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
|
|
148
|
-
if (
|
|
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
|
+
if (l !== "") return l;
|
|
149
149
|
}
|
|
150
|
-
for (const
|
|
151
|
-
const a = e[
|
|
150
|
+
for (const l of je) {
|
|
151
|
+
const a = e[l];
|
|
152
152
|
if (a != null && String(a).trim() !== "") return String(a).trim();
|
|
153
153
|
}
|
|
154
|
-
return
|
|
154
|
+
return null;
|
|
155
|
+
}
|
|
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) {
|
|
174
|
+
const a = e.filter(
|
|
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];
|
|
177
|
+
return f != null && f.many_field && f.one_collection ? { field: f.many_field, collection: f.one_collection } : null;
|
|
155
178
|
}
|
|
156
179
|
function oe({
|
|
157
180
|
relatedCollection: e,
|
|
158
|
-
manyField:
|
|
159
|
-
parentId:
|
|
181
|
+
manyField: n,
|
|
182
|
+
parentId: l,
|
|
160
183
|
rowFilter: a,
|
|
161
|
-
expanded:
|
|
184
|
+
expanded: f
|
|
162
185
|
}) {
|
|
163
|
-
var
|
|
164
|
-
const
|
|
186
|
+
var N, w;
|
|
187
|
+
const s = U(), m = xe(re), y = a && Object.keys(a).length > 0 ? {
|
|
165
188
|
_and: [
|
|
166
|
-
{ [
|
|
189
|
+
{ [n]: { _eq: l } },
|
|
167
190
|
Object.fromEntries(
|
|
168
|
-
Object.entries(a).map(([
|
|
169
|
-
|
|
170
|
-
|
|
191
|
+
Object.entries(a).map(([t, u]) => [
|
|
192
|
+
t,
|
|
193
|
+
u !== null && typeof u == "object" ? u : { _eq: u }
|
|
171
194
|
])
|
|
172
195
|
)
|
|
173
196
|
]
|
|
174
|
-
} : { [
|
|
197
|
+
} : { [n]: { _eq: l } }, { data: h, isLoading: k } = $({
|
|
175
198
|
queryKey: [
|
|
176
199
|
"o2m-rows",
|
|
177
200
|
e,
|
|
178
|
-
t,
|
|
179
201
|
n,
|
|
202
|
+
l,
|
|
180
203
|
a ? JSON.stringify(a) : ""
|
|
181
204
|
],
|
|
182
|
-
queryFn: () =>
|
|
183
|
-
|
|
184
|
-
filter: JSON.stringify(
|
|
185
|
-
limit:
|
|
205
|
+
queryFn: () => s.request(
|
|
206
|
+
O(`/items/${e}`, {
|
|
207
|
+
filter: JSON.stringify(y),
|
|
208
|
+
limit: I
|
|
186
209
|
})
|
|
187
|
-
).then((
|
|
188
|
-
enabled: !!
|
|
210
|
+
).then((t) => t.data ?? []),
|
|
211
|
+
enabled: !!l && l !== "new",
|
|
189
212
|
staleTime: 3e4
|
|
190
|
-
}),
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
213
|
+
}), g = se(e), { data: o = [] } = $({
|
|
214
|
+
queryKey: ["collection-relations", e],
|
|
215
|
+
queryFn: () => s.request(O(`/collections/${e}`)).then((t) => {
|
|
216
|
+
var u;
|
|
217
|
+
return ((u = t.data) == null ? void 0 : u.relations) ?? [];
|
|
218
|
+
}),
|
|
219
|
+
staleTime: 10 * 6e4
|
|
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)
|
|
241
|
+
), _ = [
|
|
242
|
+
...(h ?? []).filter((t) => !(C != null && C.has(String(t.id)))),
|
|
243
|
+
...q
|
|
195
244
|
];
|
|
196
|
-
if (
|
|
197
|
-
return /* @__PURE__ */
|
|
198
|
-
if (
|
|
199
|
-
return /* @__PURE__ */
|
|
200
|
-
const
|
|
201
|
-
(
|
|
202
|
-
(
|
|
245
|
+
if (k && q.length === 0)
|
|
246
|
+
return /* @__PURE__ */ r(pe, { className: "h-3 w-3 animate-spin text-slate-400 dark:text-slate-500" });
|
|
247
|
+
if (_.length === 0)
|
|
248
|
+
return /* @__PURE__ */ r("span", { className: "italic text-[11px] text-slate-400 dark:text-slate-500", children: "None yet" });
|
|
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]))
|
|
203
252
|
)
|
|
204
|
-
),
|
|
205
|
-
const
|
|
206
|
-
return
|
|
207
|
-
}, 0) : null,
|
|
208
|
-
return /* @__PURE__ */
|
|
209
|
-
/* @__PURE__ */
|
|
210
|
-
/* @__PURE__ */
|
|
211
|
-
|
|
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,
|
|
212
261
|
" row",
|
|
213
|
-
|
|
262
|
+
_.length !== 1 ? "s" : ""
|
|
214
263
|
] }),
|
|
215
|
-
|
|
264
|
+
M !== null && /* @__PURE__ */ r("span", { className: "tabular-nums text-[11px] text-slate-500 dark:text-slate-400", children: i ? M.toLocaleString(void 0, {
|
|
216
265
|
style: "currency",
|
|
217
266
|
currency: "USD",
|
|
218
|
-
maximumFractionDigits:
|
|
219
|
-
}) :
|
|
267
|
+
maximumFractionDigits: M % 1 === 0 ? 0 : 2
|
|
268
|
+
}) : M.toLocaleString() })
|
|
220
269
|
] }),
|
|
221
|
-
/* @__PURE__ */
|
|
222
|
-
(
|
|
270
|
+
/* @__PURE__ */ b("span", { className: "mt-1 block space-y-0.5", children: [
|
|
271
|
+
(f ? _ : _.slice(0, V)).map((t, u) => /* @__PURE__ */ b(
|
|
223
272
|
"span",
|
|
224
273
|
{
|
|
225
274
|
className: "flex items-baseline justify-between gap-2 text-[11px] text-slate-500 dark:text-slate-400",
|
|
226
275
|
children: [
|
|
227
|
-
/* @__PURE__ */
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
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, {
|
|
231
283
|
style: "currency",
|
|
232
284
|
currency: "USD",
|
|
233
|
-
maximumFractionDigits:
|
|
234
|
-
}) :
|
|
285
|
+
maximumFractionDigits: x % 1 === 0 ? 0 : 2
|
|
286
|
+
}) : x.toLocaleString() : String(t[S]);
|
|
235
287
|
})() })
|
|
236
288
|
]
|
|
237
289
|
},
|
|
238
|
-
String(
|
|
290
|
+
String(t.id ?? u)
|
|
239
291
|
)),
|
|
240
|
-
!
|
|
292
|
+
!f && _.length > V && /* @__PURE__ */ b("span", { className: "block text-[11px] italic text-slate-400 dark:text-slate-500", children: [
|
|
241
293
|
"+",
|
|
242
|
-
|
|
294
|
+
L ? `${_.length - V}+` : _.length - V,
|
|
243
295
|
" more"
|
|
244
296
|
] })
|
|
245
297
|
] })
|
|
246
298
|
] });
|
|
247
299
|
}
|
|
248
|
-
function
|
|
249
|
-
const
|
|
250
|
-
return /* @__PURE__ */
|
|
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 }) });
|
|
251
303
|
}
|
|
252
|
-
function
|
|
304
|
+
function Ae({
|
|
253
305
|
field: e,
|
|
254
|
-
val:
|
|
255
|
-
relations:
|
|
306
|
+
val: n,
|
|
307
|
+
relations: l,
|
|
256
308
|
collection: a,
|
|
257
|
-
itemId:
|
|
258
|
-
staging:
|
|
309
|
+
itemId: f,
|
|
310
|
+
staging: s
|
|
259
311
|
}) {
|
|
260
|
-
const
|
|
261
|
-
if (!
|
|
262
|
-
const
|
|
263
|
-
(
|
|
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)
|
|
264
316
|
);
|
|
265
|
-
if (
|
|
266
|
-
const
|
|
317
|
+
if (o != null && o.many_collection && o.many_field) {
|
|
318
|
+
const c = (() => {
|
|
267
319
|
try {
|
|
268
320
|
return typeof e.options == "string" ? JSON.parse(e.options) : e.options ?? {};
|
|
269
321
|
} catch {
|
|
270
322
|
return {};
|
|
271
323
|
}
|
|
272
324
|
})();
|
|
273
|
-
return /* @__PURE__ */
|
|
325
|
+
return /* @__PURE__ */ r(
|
|
274
326
|
oe,
|
|
275
327
|
{
|
|
276
|
-
relatedCollection:
|
|
277
|
-
manyField:
|
|
278
|
-
parentId:
|
|
279
|
-
rowFilter:
|
|
328
|
+
relatedCollection: o.many_collection,
|
|
329
|
+
manyField: o.many_field,
|
|
330
|
+
parentId: f,
|
|
331
|
+
rowFilter: c.row_filter && typeof c.row_filter == "object" ? c.row_filter : void 0
|
|
280
332
|
}
|
|
281
333
|
);
|
|
282
334
|
}
|
|
283
335
|
}
|
|
284
|
-
if (
|
|
285
|
-
const
|
|
336
|
+
if (y.has(m) && f) {
|
|
337
|
+
const o = l.find(
|
|
286
338
|
(d) => d.one_collection === a && (d.one_field === e.field || d.junction_field != null && d.many_collection === e.field)
|
|
287
|
-
),
|
|
288
|
-
const d =
|
|
289
|
-
(
|
|
339
|
+
), c = o ? o.junction_field ? o : (() => {
|
|
340
|
+
const d = l.find(
|
|
341
|
+
(j) => j.many_collection === o.many_collection && j.id !== o.id
|
|
290
342
|
);
|
|
291
|
-
return d ? { ...
|
|
343
|
+
return d ? { ...o, junction_field: d.many_field } : null;
|
|
292
344
|
})() : null;
|
|
293
|
-
if (
|
|
294
|
-
const d =
|
|
295
|
-
return /* @__PURE__ */
|
|
345
|
+
if (c) {
|
|
346
|
+
const d = ae(e.options);
|
|
347
|
+
return /* @__PURE__ */ r(
|
|
296
348
|
Te,
|
|
297
349
|
{
|
|
298
|
-
relation:
|
|
299
|
-
parentId:
|
|
300
|
-
allRelations:
|
|
301
|
-
staging:
|
|
350
|
+
relation: c,
|
|
351
|
+
parentId: f,
|
|
352
|
+
allRelations: l,
|
|
353
|
+
staging: s,
|
|
302
354
|
maxValues: d == null ? void 0 : d.max_values
|
|
303
355
|
}
|
|
304
356
|
);
|
|
305
357
|
}
|
|
306
358
|
}
|
|
307
|
-
const
|
|
308
|
-
if (
|
|
309
|
-
return /* @__PURE__ */
|
|
310
|
-
if (
|
|
311
|
-
if (
|
|
312
|
-
const
|
|
313
|
-
if (
|
|
314
|
-
return /* @__PURE__ */
|
|
359
|
+
const h = n == null || n === "";
|
|
360
|
+
if (h && e.type === "boolean")
|
|
361
|
+
return /* @__PURE__ */ r("span", { className: "text-slate-700 dark:text-slate-200", children: "No" });
|
|
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 || "—" });
|
|
315
367
|
}
|
|
316
|
-
if (typeof
|
|
317
|
-
return /* @__PURE__ */
|
|
318
|
-
const
|
|
319
|
-
(
|
|
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
|
|
320
372
|
);
|
|
321
|
-
if (
|
|
322
|
-
return /* @__PURE__ */
|
|
373
|
+
if (k != null && k.one_collection)
|
|
374
|
+
return /* @__PURE__ */ r(X, { collection: k.one_collection, id: n });
|
|
323
375
|
if (e.type === "datetime" || e.type === "date")
|
|
324
376
|
try {
|
|
325
|
-
return /* @__PURE__ */
|
|
377
|
+
return /* @__PURE__ */ r("span", { className: "text-slate-700 dark:text-slate-200", children: _e(n) });
|
|
326
378
|
} catch {
|
|
327
379
|
}
|
|
328
|
-
const
|
|
329
|
-
return /* @__PURE__ */
|
|
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) });
|
|
330
382
|
}
|
|
331
|
-
function
|
|
332
|
-
var
|
|
333
|
-
if (
|
|
334
|
-
const
|
|
383
|
+
function Ke(e, n) {
|
|
384
|
+
var f;
|
|
385
|
+
if (n == null || typeof n == "object") return null;
|
|
386
|
+
const l = ae(
|
|
335
387
|
e
|
|
336
|
-
), a = (
|
|
388
|
+
), a = (f = l == null ? void 0 : l.choices) == null ? void 0 : f.find((s) => s && String(s.value) === String(n));
|
|
337
389
|
return (a == null ? void 0 : a.text) != null ? ke(a.text) : null;
|
|
338
390
|
}
|
|
339
|
-
const
|
|
391
|
+
const Pe = /* @__PURE__ */ new Set([
|
|
340
392
|
"extension-editorjs",
|
|
341
393
|
"input-rich-text-html",
|
|
342
394
|
"rich_text",
|
|
343
395
|
"wysiwyg"
|
|
344
396
|
]);
|
|
345
|
-
function
|
|
397
|
+
function Fe(e, n) {
|
|
346
398
|
if (typeof e != "string") return null;
|
|
347
|
-
if (
|
|
348
|
-
const
|
|
349
|
-
return
|
|
399
|
+
if (Pe.has(n)) return ee(e);
|
|
400
|
+
const l = e.trim();
|
|
401
|
+
return l.startsWith("{") && /"blocks"\s*:/.test(l) ? ee(e) : null;
|
|
350
402
|
}
|
|
351
|
-
function
|
|
403
|
+
function Je(e) {
|
|
352
404
|
if (e == null || e === "") return "—";
|
|
353
405
|
if (typeof e == "boolean") return e ? "Yes" : "No";
|
|
354
|
-
const
|
|
355
|
-
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))
|
|
356
408
|
try {
|
|
357
|
-
return new Date(
|
|
409
|
+
return new Date(n).toLocaleDateString();
|
|
358
410
|
} catch {
|
|
359
411
|
}
|
|
360
|
-
return
|
|
412
|
+
return n;
|
|
361
413
|
}
|
|
362
|
-
const
|
|
414
|
+
const te = (e) => {
|
|
363
415
|
if (e == null || e === "") return "empty";
|
|
364
416
|
if (typeof e == "boolean") return e ? "Yes" : "No";
|
|
365
|
-
if (typeof e == "object")
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
}
|
|
369
|
-
const t = String(e).replace(/<[^>]+>/g, "").trim();
|
|
370
|
-
return t.length > 48 ? `${t.slice(0, 48)}…` : t;
|
|
417
|
+
if (typeof e == "object")
|
|
418
|
+
return e.id != null ? "a linked record" : Array.isArray(e) ? `${e.length} items` : "a value";
|
|
419
|
+
const n = String(e).replace(/<[^>]+>/g, "").trim();
|
|
420
|
+
return n.length > 48 ? `${n.slice(0, 48)}…` : n;
|
|
371
421
|
};
|
|
372
|
-
function
|
|
373
|
-
const
|
|
422
|
+
function ne(e, n) {
|
|
423
|
+
const l = U(), a = ge(), f = !!e && n != null && n !== "", { data: s } = $({
|
|
374
424
|
queryKey: ["cbv-collection-meta", e],
|
|
375
|
-
queryFn: () =>
|
|
376
|
-
enabled:
|
|
425
|
+
queryFn: () => l.request(O(`/collections/${e}`)).then((h) => h.data),
|
|
426
|
+
enabled: f,
|
|
377
427
|
staleTime: 10 * 6e4,
|
|
378
428
|
retry: !1
|
|
379
|
-
}), { data:
|
|
380
|
-
queryKey: ["rrv-related", e, String(
|
|
381
|
-
queryFn: () => a(e,
|
|
382
|
-
enabled:
|
|
429
|
+
}), { data: m } = $({
|
|
430
|
+
queryKey: ["rrv-related", e, String(n)],
|
|
431
|
+
queryFn: () => a(e, n).catch(() => null),
|
|
432
|
+
enabled: f && !!s,
|
|
383
433
|
staleTime: 6e4,
|
|
384
434
|
retry: !1
|
|
385
435
|
});
|
|
386
|
-
if (!
|
|
387
|
-
if (!
|
|
388
|
-
const
|
|
389
|
-
if (
|
|
390
|
-
for (const
|
|
391
|
-
return
|
|
436
|
+
if (!f) return null;
|
|
437
|
+
if (!m) return "a linked record";
|
|
438
|
+
const y = le(s == null ? void 0 : s.display_template, m).trim();
|
|
439
|
+
if (y) return y;
|
|
440
|
+
for (const h of ["name", "title", "label", "number", "email"]) if (m[h]) return String(m[h]);
|
|
441
|
+
return "a linked record";
|
|
392
442
|
}
|
|
393
|
-
function
|
|
443
|
+
function Ve({
|
|
394
444
|
field: e,
|
|
395
|
-
from:
|
|
396
|
-
to:
|
|
445
|
+
from: n,
|
|
446
|
+
to: l,
|
|
397
447
|
detail: a,
|
|
398
|
-
relations:
|
|
399
|
-
collection:
|
|
400
|
-
onRevert:
|
|
448
|
+
relations: f,
|
|
449
|
+
collection: s,
|
|
450
|
+
onRevert: m
|
|
401
451
|
}) {
|
|
402
|
-
var
|
|
403
|
-
const
|
|
404
|
-
(
|
|
405
|
-
)) == null ? void 0 :
|
|
406
|
-
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 ? (
|
|
407
457
|
// biome-ignore lint/a11y/useSemanticElements: nested inside the row's <button> — a real <button> is invalid there
|
|
408
|
-
/* @__PURE__ */
|
|
458
|
+
/* @__PURE__ */ r(
|
|
409
459
|
"span",
|
|
410
460
|
{
|
|
411
461
|
role: "button",
|
|
412
462
|
tabIndex: 0,
|
|
413
463
|
"data-summary-changed": !0,
|
|
414
|
-
"data-tip": `${
|
|
464
|
+
"data-tip": `${g} · click to revert`,
|
|
415
465
|
"aria-label": "Revert this change",
|
|
416
|
-
onClick: (
|
|
417
|
-
|
|
466
|
+
onClick: (c) => {
|
|
467
|
+
c.stopPropagation(), m();
|
|
418
468
|
},
|
|
419
|
-
onKeyDown: (
|
|
420
|
-
(
|
|
469
|
+
onKeyDown: (c) => {
|
|
470
|
+
(c.key === "Enter" || c.key === " ") && (c.preventDefault(), c.stopPropagation(), m());
|
|
421
471
|
},
|
|
422
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",
|
|
423
|
-
children: /* @__PURE__ */
|
|
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" })
|
|
424
474
|
}
|
|
425
475
|
)
|
|
426
|
-
) : /* @__PURE__ */
|
|
476
|
+
) : /* @__PURE__ */ r(
|
|
427
477
|
"span",
|
|
428
478
|
{
|
|
429
479
|
"data-summary-changed": !0,
|
|
430
|
-
"data-tip":
|
|
480
|
+
"data-tip": g,
|
|
431
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"
|
|
432
482
|
}
|
|
433
483
|
);
|
|
434
484
|
}
|
|
435
|
-
function
|
|
485
|
+
function et({
|
|
436
486
|
allSteps: e,
|
|
437
|
-
groupedMap:
|
|
438
|
-
ungroupedFields:
|
|
487
|
+
groupedMap: n,
|
|
488
|
+
ungroupedFields: l,
|
|
439
489
|
sectionGroups: a,
|
|
440
|
-
draft:
|
|
441
|
-
relations:
|
|
442
|
-
collection:
|
|
443
|
-
itemId:
|
|
444
|
-
staging:
|
|
445
|
-
errors:
|
|
446
|
-
staleFields:
|
|
447
|
-
aliasEmptiness:
|
|
448
|
-
layoutFields:
|
|
490
|
+
draft: f,
|
|
491
|
+
relations: s,
|
|
492
|
+
collection: m,
|
|
493
|
+
itemId: y,
|
|
494
|
+
staging: h,
|
|
495
|
+
errors: k,
|
|
496
|
+
staleFields: g,
|
|
497
|
+
aliasEmptiness: o,
|
|
498
|
+
layoutFields: c,
|
|
449
499
|
changedFields: d,
|
|
450
|
-
onRevertChange:
|
|
451
|
-
onFieldClick:
|
|
452
|
-
stagedO2MRows:
|
|
453
|
-
stagedO2MDeletes:
|
|
500
|
+
onRevertChange: j,
|
|
501
|
+
onFieldClick: P,
|
|
502
|
+
stagedO2MRows: D,
|
|
503
|
+
stagedO2MDeletes: K
|
|
454
504
|
}) {
|
|
455
|
-
const [
|
|
456
|
-
...!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" }] : [],
|
|
457
507
|
...e
|
|
458
|
-
].map((
|
|
459
|
-
const
|
|
460
|
-
return { step:
|
|
461
|
-
}).filter((
|
|
462
|
-
(
|
|
463
|
-
(!
|
|
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))
|
|
464
514
|
) : [];
|
|
465
|
-
return
|
|
466
|
-
/* @__PURE__ */
|
|
467
|
-
|
|
468
|
-
/* @__PURE__ */
|
|
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: [
|
|
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" }) }),
|
|
517
|
+
i.map(({ step: t, fields: u }, x) => /* @__PURE__ */ b("div", { children: [
|
|
518
|
+
/* @__PURE__ */ r(
|
|
469
519
|
"div",
|
|
470
520
|
{
|
|
471
|
-
className:
|
|
521
|
+
className: R(
|
|
472
522
|
"bg-slate-100 px-4 py-2 border-b border-slate-200 dark:bg-white/[0.06] dark:border-border/80",
|
|
473
|
-
|
|
523
|
+
x > 0 && "border-t border-slate-200 dark:border-border/80"
|
|
474
524
|
),
|
|
475
|
-
children: /* @__PURE__ */
|
|
525
|
+
children: /* @__PURE__ */ r("span", { className: "text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: t.label })
|
|
476
526
|
}
|
|
477
527
|
),
|
|
478
|
-
|
|
479
|
-
const T =
|
|
480
|
-
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(
|
|
481
531
|
"div",
|
|
482
532
|
{
|
|
483
|
-
className:
|
|
533
|
+
className: R(
|
|
484
534
|
"group/row flex items-stretch",
|
|
485
|
-
|
|
486
|
-
A ? "bg-red-50 dark:bg-red-900/10" : H ||
|
|
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" : ""
|
|
487
537
|
),
|
|
488
538
|
children: [
|
|
489
|
-
/* @__PURE__ */
|
|
539
|
+
/* @__PURE__ */ b(
|
|
490
540
|
"button",
|
|
491
541
|
{
|
|
492
542
|
type: "button",
|
|
493
|
-
onClick: () =>
|
|
494
|
-
className:
|
|
543
|
+
onClick: () => P(t.key, p.field),
|
|
544
|
+
className: R(
|
|
495
545
|
"flex flex-1 flex-col px-4 py-2 text-left transition-colors duration-150 min-w-0",
|
|
496
546
|
A ? "hover:bg-red-50 dark:hover:bg-red-900/15" : "hover:bg-slate-50 dark:hover:bg-white/[0.03]"
|
|
497
547
|
),
|
|
498
548
|
children: [
|
|
499
|
-
/* @__PURE__ */
|
|
549
|
+
/* @__PURE__ */ b(
|
|
500
550
|
"span",
|
|
501
551
|
{
|
|
502
|
-
className:
|
|
552
|
+
className: R(
|
|
503
553
|
"flex items-center gap-1 text-[10px] font-medium truncate",
|
|
504
|
-
A ? "text-red-500 dark:text-red-400" : H ||
|
|
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"
|
|
505
555
|
),
|
|
506
556
|
children: [
|
|
507
|
-
/* @__PURE__ */
|
|
508
|
-
(d == null ? void 0 : d[
|
|
509
|
-
|
|
557
|
+
/* @__PURE__ */ r("span", { className: "truncate", children: E }),
|
|
558
|
+
(d == null ? void 0 : d[p.field]) && /* @__PURE__ */ r(
|
|
559
|
+
Ve,
|
|
510
560
|
{
|
|
511
|
-
field:
|
|
512
|
-
from: d[
|
|
513
|
-
detail: d[
|
|
561
|
+
field: p,
|
|
562
|
+
from: d[p.field].from,
|
|
563
|
+
detail: d[p.field].detail,
|
|
514
564
|
to: T,
|
|
515
|
-
relations:
|
|
516
|
-
collection:
|
|
517
|
-
onRevert:
|
|
565
|
+
relations: s,
|
|
566
|
+
collection: m,
|
|
567
|
+
onRevert: j ? () => j(p.field) : void 0
|
|
518
568
|
}
|
|
519
569
|
),
|
|
520
|
-
H && /* @__PURE__ */
|
|
521
|
-
|
|
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(
|
|
522
572
|
"span",
|
|
523
573
|
{
|
|
524
574
|
title: "This value is no longer one of the available options",
|
|
@@ -529,22 +579,22 @@ function Ge({
|
|
|
529
579
|
]
|
|
530
580
|
}
|
|
531
581
|
),
|
|
532
|
-
/* @__PURE__ */
|
|
582
|
+
/* @__PURE__ */ r(
|
|
533
583
|
"span",
|
|
534
584
|
{
|
|
535
|
-
ref: (
|
|
536
|
-
|
|
585
|
+
ref: (B) => {
|
|
586
|
+
L.current.set(p.field, B);
|
|
537
587
|
},
|
|
538
588
|
className: "mt-0.5 w-full text-[12px] min-w-0 overflow-hidden",
|
|
539
|
-
children: /* @__PURE__ */
|
|
540
|
-
|
|
589
|
+
children: /* @__PURE__ */ r(
|
|
590
|
+
De,
|
|
541
591
|
{
|
|
542
|
-
field:
|
|
592
|
+
field: p,
|
|
543
593
|
val: T,
|
|
544
|
-
relations:
|
|
545
|
-
collection:
|
|
546
|
-
itemId:
|
|
547
|
-
staging:
|
|
594
|
+
relations: s,
|
|
595
|
+
collection: m,
|
|
596
|
+
itemId: y,
|
|
597
|
+
staging: h
|
|
548
598
|
}
|
|
549
599
|
)
|
|
550
600
|
}
|
|
@@ -552,58 +602,58 @@ function Ge({
|
|
|
552
602
|
]
|
|
553
603
|
}
|
|
554
604
|
),
|
|
555
|
-
/* @__PURE__ */
|
|
605
|
+
/* @__PURE__ */ r(
|
|
556
606
|
"button",
|
|
557
607
|
{
|
|
558
608
|
type: "button",
|
|
559
609
|
title: "Copy value",
|
|
560
|
-
onClick: (
|
|
610
|
+
onClick: (B) => {
|
|
561
611
|
var Y, G;
|
|
562
|
-
|
|
563
|
-
const me = ((G = (Y =
|
|
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);
|
|
564
614
|
navigator.clipboard.writeText(me).catch(() => {
|
|
565
|
-
}),
|
|
566
|
-
() =>
|
|
615
|
+
}), C(p.field), setTimeout(
|
|
616
|
+
() => C((Q) => Q === p.field ? null : Q),
|
|
567
617
|
1500
|
|
568
618
|
);
|
|
569
619
|
},
|
|
570
|
-
className:
|
|
620
|
+
className: R(
|
|
571
621
|
"flex items-center px-2 opacity-0 group-hover/row:opacity-100 transition-all duration-150",
|
|
572
|
-
|
|
622
|
+
v === p.field ? "text-emerald-500" : "text-slate-400 hover:text-slate-600 dark:text-slate-500 dark:hover:text-slate-300"
|
|
573
623
|
),
|
|
574
|
-
children:
|
|
624
|
+
children: v === p.field ? /* @__PURE__ */ r(ue, { className: "h-3 w-3" }) : /* @__PURE__ */ r(fe, { className: "h-3 w-3" })
|
|
575
625
|
}
|
|
576
626
|
)
|
|
577
627
|
]
|
|
578
628
|
},
|
|
579
|
-
|
|
629
|
+
p.field
|
|
580
630
|
);
|
|
581
631
|
})
|
|
582
|
-
] },
|
|
583
|
-
|
|
584
|
-
/* @__PURE__ */
|
|
585
|
-
|
|
586
|
-
const
|
|
587
|
-
return /* @__PURE__ */
|
|
632
|
+
] }, t.key)),
|
|
633
|
+
w.length > 0 && /* @__PURE__ */ b("div", { children: [
|
|
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" }) }),
|
|
635
|
+
w.map((t, u) => {
|
|
636
|
+
const x = t.one_field ?? t.many_collection ?? "", p = q === x;
|
|
637
|
+
return /* @__PURE__ */ r(
|
|
588
638
|
"div",
|
|
589
639
|
{
|
|
590
|
-
className:
|
|
640
|
+
className: R(
|
|
591
641
|
"flex items-stretch",
|
|
592
|
-
|
|
642
|
+
u < w.length - 1 && "border-b border-slate-100 dark:border-border/60"
|
|
593
643
|
),
|
|
594
|
-
children: /* @__PURE__ */
|
|
644
|
+
children: /* @__PURE__ */ b(
|
|
595
645
|
"button",
|
|
596
646
|
{
|
|
597
647
|
type: "button",
|
|
598
648
|
onClick: () => {
|
|
599
649
|
var A;
|
|
600
|
-
const
|
|
601
|
-
if (!
|
|
602
|
-
|
|
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);
|
|
603
653
|
return;
|
|
604
654
|
}
|
|
605
|
-
|
|
606
|
-
() =>
|
|
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(
|
|
607
657
|
"ring-2",
|
|
608
658
|
"ring-nvr-cyan",
|
|
609
659
|
"ring-offset-2",
|
|
@@ -614,41 +664,45 @@ function Ge({
|
|
|
614
664
|
},
|
|
615
665
|
className: "flex flex-1 flex-col px-4 py-2 min-w-0 text-left transition-colors hover:bg-nvr-cyan/5",
|
|
616
666
|
children: [
|
|
617
|
-
/* @__PURE__ */
|
|
618
|
-
/* @__PURE__ */
|
|
667
|
+
/* @__PURE__ */ b("span", { className: "flex items-center gap-1 text-[10px] font-medium truncate text-slate-400 dark:text-slate-500", children: [
|
|
668
|
+
/* @__PURE__ */ r(
|
|
619
669
|
ye,
|
|
620
670
|
{
|
|
621
|
-
className:
|
|
671
|
+
className: R(
|
|
622
672
|
"h-3 w-3 shrink-0 transition-transform",
|
|
623
|
-
|
|
673
|
+
p && "rotate-90"
|
|
624
674
|
)
|
|
625
675
|
}
|
|
626
676
|
),
|
|
627
|
-
|
|
677
|
+
Z(t.one_field ?? t.many_collection ?? "")
|
|
628
678
|
] }),
|
|
629
|
-
/* @__PURE__ */
|
|
679
|
+
/* @__PURE__ */ r("span", { className: "mt-0.5 text-[12px]", children: /* @__PURE__ */ r(
|
|
630
680
|
oe,
|
|
631
681
|
{
|
|
632
|
-
relatedCollection:
|
|
633
|
-
manyField:
|
|
634
|
-
parentId:
|
|
635
|
-
expanded:
|
|
682
|
+
relatedCollection: t.many_collection ?? "",
|
|
683
|
+
manyField: t.many_field,
|
|
684
|
+
parentId: y,
|
|
685
|
+
expanded: p
|
|
636
686
|
}
|
|
637
687
|
) })
|
|
638
688
|
]
|
|
639
689
|
}
|
|
640
690
|
)
|
|
641
691
|
},
|
|
642
|
-
|
|
692
|
+
t.id ?? `${t.many_collection}.${t.many_field}`
|
|
643
693
|
);
|
|
644
694
|
})
|
|
645
695
|
] })
|
|
646
696
|
] }) });
|
|
647
697
|
}
|
|
648
698
|
export {
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
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
|
|
654
708
|
};
|