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