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