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