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