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