@nivaro/react 0.3.89 → 0.3.91
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/hooks/useSessionRecorder.js +1 -1
- package/dist/shared/components/CollectionBrowserView.js +151 -150
- package/dist/shared/components/ItemEditForm.js +2401 -2349
- package/dist/shared/components/panels/AddendumPanel.js +691 -691
- package/dist/shared/components/panels/MoveToStatePanel.js +78 -64
- package/dist/shared/components/panels/PipelinePanel.js +1149 -1132
- package/dist/shared/lib/move-state.js +10 -0
- package/package.json +1 -1
|
@@ -103,7 +103,7 @@ function ya(n, o) {
|
|
|
103
103
|
var w;
|
|
104
104
|
if (!o || o.kind !== "m2m") return null;
|
|
105
105
|
const h = o.relation.many_collection, d = o.relation.junction_field;
|
|
106
|
-
return !h || !d ? null : ((w = n.find((
|
|
106
|
+
return !h || !d ? null : ((w = n.find((S) => S.many_collection === h && S.many_field === d)) == null ? void 0 : w.one_collection) ?? null;
|
|
107
107
|
}
|
|
108
108
|
function Yn(n) {
|
|
109
109
|
if (!n) return "id";
|
|
@@ -122,13 +122,13 @@ function wa(n, o) {
|
|
|
122
122
|
if (!o || o.length === 0) return null;
|
|
123
123
|
const h = n == null ? "" : String(n), d = Number(h);
|
|
124
124
|
for (const w of o) {
|
|
125
|
-
const
|
|
125
|
+
const S = Number(w.value), $ = Number.isFinite(d) && Number.isFinite(S);
|
|
126
126
|
switch (w.op) {
|
|
127
127
|
case "gt":
|
|
128
|
-
if ($ && d >
|
|
128
|
+
if ($ && d > S) return w.color;
|
|
129
129
|
break;
|
|
130
130
|
case "lt":
|
|
131
|
-
if ($ && d <
|
|
131
|
+
if ($ && d < S) return w.color;
|
|
132
132
|
break;
|
|
133
133
|
case "eq":
|
|
134
134
|
if (h.toLowerCase() === String(w.value ?? "").toLowerCase()) return w.color;
|
|
@@ -174,7 +174,7 @@ function Ta(n, o) {
|
|
|
174
174
|
return String(o.id ?? "");
|
|
175
175
|
}
|
|
176
176
|
return n.replace(/\{\{([\w.]+)\}\}/g, (h, d) => {
|
|
177
|
-
const w = d.split(".").reduce((
|
|
177
|
+
const w = d.split(".").reduce((S, $) => S == null ? void 0 : S[$], o);
|
|
178
178
|
return w == null ? "" : String(w);
|
|
179
179
|
});
|
|
180
180
|
}
|
|
@@ -193,25 +193,25 @@ function Nu(n) {
|
|
|
193
193
|
if (d < 60) return `${d}m ago`;
|
|
194
194
|
const w = Math.floor(d / 60);
|
|
195
195
|
if (w < 24) return `${w}h ago`;
|
|
196
|
-
const
|
|
197
|
-
return
|
|
196
|
+
const S = Math.floor(w / 24);
|
|
197
|
+
return S < 7 ? `${S}d ago` : o.toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" });
|
|
198
198
|
}
|
|
199
199
|
const bt = (n) => n.toLocaleString("en-US"), Yl = /* @__PURE__ */ new Set(["nivaro_users", "directus_users"]), Tt = (n) => n.startsWith("directus_") || n.startsWith("nivaro_"), Cr = /* @__PURE__ */ new Map();
|
|
200
200
|
function Jl(n, o, h) {
|
|
201
201
|
let d = Cr.get(o);
|
|
202
202
|
d || (d = { ids: /* @__PURE__ */ new Set(), waiters: [], promise: null }, Cr.set(o, d));
|
|
203
203
|
const w = d;
|
|
204
|
-
return w.ids.add(h), w.promise || (w.promise = new Promise((
|
|
204
|
+
return w.ids.add(h), w.promise || (w.promise = new Promise((S) => {
|
|
205
205
|
setTimeout(() => {
|
|
206
206
|
Cr.delete(o);
|
|
207
207
|
const $ = [...w.ids], q = [];
|
|
208
|
-
for (let
|
|
208
|
+
for (let N = 0; N < $.length; N += 200) q.push($.slice(N, N + 200));
|
|
209
209
|
Promise.all(
|
|
210
210
|
q.map(
|
|
211
|
-
(
|
|
211
|
+
(N) => n.request(
|
|
212
212
|
J(`/items/${o}`, {
|
|
213
|
-
filter: JSON.stringify({ id: { _in:
|
|
214
|
-
limit:
|
|
213
|
+
filter: JSON.stringify({ id: { _in: N } }),
|
|
214
|
+
limit: N.length,
|
|
215
215
|
fields: "*",
|
|
216
216
|
// #2444 — a display-label lookup: the server may answer it from its
|
|
217
217
|
// short-lived label row cache (busted by this collection's writes).
|
|
@@ -219,13 +219,13 @@ function Jl(n, o, h) {
|
|
|
219
219
|
})
|
|
220
220
|
).then((L) => L.data ?? []).catch(() => [])
|
|
221
221
|
)
|
|
222
|
-
).then((
|
|
222
|
+
).then((N) => {
|
|
223
223
|
const L = /* @__PURE__ */ new Map();
|
|
224
|
-
for (const K of
|
|
225
|
-
|
|
224
|
+
for (const K of N.flat()) L.set(String(K.id), K);
|
|
225
|
+
S(L);
|
|
226
226
|
});
|
|
227
227
|
}, 0);
|
|
228
|
-
})), w.promise.then((
|
|
228
|
+
})), w.promise.then((S) => S.get(h) ?? null);
|
|
229
229
|
}
|
|
230
230
|
const Su = {
|
|
231
231
|
draft: "draft",
|
|
@@ -235,12 +235,13 @@ const Su = {
|
|
|
235
235
|
rejected: "rejected"
|
|
236
236
|
};
|
|
237
237
|
function Cu({ summary: n }) {
|
|
238
|
+
var N;
|
|
238
239
|
if (!n || n.total === 0) return /* @__PURE__ */ a("span", { className: "text-[12px] text-slate-300", children: "—" });
|
|
239
|
-
const o = n.latest, h = n.active > 0, d = o ? Su[o.status] ?? o.status : "",
|
|
240
|
+
const o = n.latest, h = n.active > 0, d = !!(o != null && o.workflow_state) && !["approved", "rejected", "reverted"].includes(o.status), w = o ? d ? ((N = o.workflow_state) == null ? void 0 : N.label) ?? "" : Su[o.status] ?? o.status : "", S = o == null ? void 0 : o.cost_impact, $ = S != null && S !== 0 ? `${S > 0 ? "+" : "−"}$${Math.abs(S).toLocaleString(void 0, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}` : null, q = o ? `${o.title ?? "Addendum"} — ${w}${n.total > 1 ? ` (${n.total} total)` : ""}` : void 0;
|
|
240
241
|
return /* @__PURE__ */ c(
|
|
241
242
|
"span",
|
|
242
243
|
{
|
|
243
|
-
"data-tip":
|
|
244
|
+
"data-tip": q,
|
|
244
245
|
className: `inline-flex max-w-[220px] items-center gap-1.5 truncate rounded-full border px-2 py-0.5 text-[11px] font-medium ${h ? "border-amber-300 bg-amber-50 text-amber-800 dark:border-amber-500/50 dark:bg-amber-500/10 dark:text-amber-300" : "border-slate-200 bg-slate-50 text-slate-600 dark:border-slate-700 dark:bg-slate-800 dark:text-slate-300"}`,
|
|
245
246
|
children: [
|
|
246
247
|
/* @__PURE__ */ a(
|
|
@@ -250,17 +251,17 @@ function Cu({ summary: n }) {
|
|
|
250
251
|
className: `h-1.5 w-1.5 shrink-0 rounded-full ${h ? "bg-amber-500" : "bg-slate-400"}`
|
|
251
252
|
}
|
|
252
253
|
),
|
|
253
|
-
h ? `${n.active} ${n.active === 1 ? "addendum" : "addendums"}
|
|
254
|
-
|
|
254
|
+
h ? `${n.active} ${n.active === 1 ? "addendum" : "addendums"}${d ? ` · ${w}` : ` ${w || "active"}`}` : `${n.total} ${w}`,
|
|
255
|
+
$ && /* @__PURE__ */ c("span", { className: "tabular-nums opacity-80", children: [
|
|
255
256
|
"· ",
|
|
256
|
-
|
|
257
|
+
$
|
|
257
258
|
] })
|
|
258
259
|
]
|
|
259
260
|
}
|
|
260
261
|
);
|
|
261
262
|
}
|
|
262
263
|
function Dr({ relatedCollection: n, id: o }) {
|
|
263
|
-
const h = St(), d = Yl.has(n), w = o != null && o !== "", { data:
|
|
264
|
+
const h = St(), d = Yl.has(n), w = o != null && o !== "", { data: S } = ne({
|
|
264
265
|
queryKey: ["cbv-collection-meta", n],
|
|
265
266
|
queryFn: () => h.request(J(`/collections/${n}`)).then((L) => L.data),
|
|
266
267
|
staleTime: 10 * 6e4,
|
|
@@ -288,16 +289,16 @@ function Dr({ relatedCollection: n, id: o }) {
|
|
|
288
289
|
}
|
|
289
290
|
);
|
|
290
291
|
}
|
|
291
|
-
const
|
|
292
|
+
const N = d ? String(
|
|
292
293
|
[$.first_name, $.last_name].filter(Boolean).join(" ") || $.email || $.id || ""
|
|
293
|
-
) : Ta((
|
|
294
|
-
return /* @__PURE__ */ a("span", { className: "text-[12px] text-slate-700 dark:text-slate-200", children:
|
|
294
|
+
) : Ta((S == null ? void 0 : S.display_template) ?? null, $);
|
|
295
|
+
return /* @__PURE__ */ a("span", { className: "text-[12px] text-slate-700 dark:text-slate-200", children: N });
|
|
295
296
|
}
|
|
296
|
-
function Gl(n, o, h, d, w,
|
|
297
|
+
function Gl(n, o, h, d, w, S) {
|
|
297
298
|
const $ = o.getQueryData(["cbv-collection-meta", h]);
|
|
298
299
|
return Bd(
|
|
299
300
|
Ud(n, h, $, d, w).then(
|
|
300
|
-
(q) => window.location.origin +
|
|
301
|
+
(q) => window.location.origin + S({ collection: h, itemId: q })
|
|
301
302
|
)
|
|
302
303
|
).catch(() => {
|
|
303
304
|
});
|
|
@@ -330,10 +331,10 @@ function Tu({
|
|
|
330
331
|
hasPipeline: h,
|
|
331
332
|
onOpen: d,
|
|
332
333
|
onPeek: w,
|
|
333
|
-
onAudit:
|
|
334
|
+
onAudit: S,
|
|
334
335
|
urlFor: $,
|
|
335
336
|
onDeleted: q,
|
|
336
|
-
onAfterTransition:
|
|
337
|
+
onAfterTransition: N,
|
|
337
338
|
row: L,
|
|
338
339
|
bulkEnabledKeys: K,
|
|
339
340
|
disabled: V = !1,
|
|
@@ -487,7 +488,7 @@ function Tu({
|
|
|
487
488
|
onSuccess: (g, R) => {
|
|
488
489
|
E(!1);
|
|
489
490
|
const Z = $e.find((ue) => ue.id === R.transitionId);
|
|
490
|
-
ge.success(Z ? `${F.name} moved to ${mt(Z)}` : `${F.name} moved`), Ca(y, n), Dl(y, n, [o]),
|
|
491
|
+
ge.success(Z ? `${F.name} moved to ${mt(Z)}` : `${F.name} moved`), Ca(y, n), Dl(y, n, [o]), N == null || N();
|
|
491
492
|
},
|
|
492
493
|
onError: (g) => ge.error(
|
|
493
494
|
Zt(g, "Transition failed"),
|
|
@@ -511,7 +512,7 @@ function Tu({
|
|
|
511
512
|
ge.info(`${F.name}: ${nn ?? "nothing to change"}`);
|
|
512
513
|
return;
|
|
513
514
|
}
|
|
514
|
-
ge.success(`${g.label} — done on ${F.name}`), Ca(y, n), Dl(y, n, [o]),
|
|
515
|
+
ge.success(`${g.label} — done on ${F.name}`), Ca(y, n), Dl(y, n, [o]), N == null || N();
|
|
515
516
|
},
|
|
516
517
|
onError: (g) => {
|
|
517
518
|
const R = g.response;
|
|
@@ -532,7 +533,7 @@ function Tu({
|
|
|
532
533
|
"item-actions"
|
|
533
534
|
])
|
|
534
535
|
y.invalidateQueries({ queryKey: [ue] });
|
|
535
|
-
Ca(y, n),
|
|
536
|
+
Ca(y, n), N == null || N();
|
|
536
537
|
},
|
|
537
538
|
onError: (g) => {
|
|
538
539
|
const R = g.response;
|
|
@@ -693,8 +694,8 @@ function Tu({
|
|
|
693
694
|
g || ge.error("This record has no chat room you can open");
|
|
694
695
|
}).catch(() => ge.error("Could not open the chat room"));
|
|
695
696
|
}),
|
|
696
|
-
|
|
697
|
-
E(!1),
|
|
697
|
+
S && Je("Audit log", () => {
|
|
698
|
+
E(!1), S();
|
|
698
699
|
}),
|
|
699
700
|
h && Xe.length > 0 && /* @__PURE__ */ c(Qe, { children: [
|
|
700
701
|
jt,
|
|
@@ -875,9 +876,9 @@ function jl({
|
|
|
875
876
|
value: d,
|
|
876
877
|
relations: w
|
|
877
878
|
}) {
|
|
878
|
-
const
|
|
879
|
-
if (
|
|
880
|
-
return /* @__PURE__ */ a(Dr, { relatedCollection:
|
|
879
|
+
const S = Er(w, n, o);
|
|
880
|
+
if (S != null && S.one_collection)
|
|
881
|
+
return /* @__PURE__ */ a(Dr, { relatedCollection: S.one_collection, id: d });
|
|
881
882
|
if (d == null) return /* @__PURE__ */ a("span", { className: "text-[12px] text-slate-300", children: "—" });
|
|
882
883
|
if (h === "boolean")
|
|
883
884
|
return /* @__PURE__ */ a(
|
|
@@ -928,10 +929,10 @@ function Ra({
|
|
|
928
929
|
selected: h,
|
|
929
930
|
onChange: d,
|
|
930
931
|
loading: w,
|
|
931
|
-
block:
|
|
932
|
+
block: S,
|
|
932
933
|
onOpenChange: $,
|
|
933
934
|
badge: q,
|
|
934
|
-
onSearch:
|
|
935
|
+
onSearch: N
|
|
935
936
|
}) {
|
|
936
937
|
var E;
|
|
937
938
|
const [L, K] = _(!1);
|
|
@@ -940,8 +941,8 @@ function Ra({
|
|
|
940
941
|
}, [L]);
|
|
941
942
|
const [V, I] = _("");
|
|
942
943
|
pe(() => {
|
|
943
|
-
if (!
|
|
944
|
-
const P = setTimeout(() =>
|
|
944
|
+
if (!N) return;
|
|
945
|
+
const P = setTimeout(() => N(V.trim()), 250);
|
|
945
946
|
return () => clearTimeout(P);
|
|
946
947
|
}, [V]);
|
|
947
948
|
const u = fe(null);
|
|
@@ -953,8 +954,8 @@ function Ra({
|
|
|
953
954
|
};
|
|
954
955
|
return window.addEventListener("mousedown", P), () => window.removeEventListener("mousedown", P);
|
|
955
956
|
}, [L]);
|
|
956
|
-
const y = V && !
|
|
957
|
-
return /* @__PURE__ */ c("div", { ref: u, className:
|
|
957
|
+
const y = V && !N ? o.filter((P) => P.label.toLowerCase().includes(V.toLowerCase())) : o, Q = new Set(h.map(String)), F = ((E = o.find((P) => String(P.value) === String(h[0]))) == null ? void 0 : E.label) ?? String(h[0] ?? ""), m = h.length === 0 ? n : h.length === 1 ? F : `${F} +${h.length - 1}`;
|
|
958
|
+
return /* @__PURE__ */ c("div", { ref: u, className: S ? "relative w-full" : "relative", children: [
|
|
958
959
|
/* @__PURE__ */ c(
|
|
959
960
|
"button",
|
|
960
961
|
{
|
|
@@ -963,7 +964,7 @@ function Ra({
|
|
|
963
964
|
P.stopPropagation(), K((M) => !M);
|
|
964
965
|
},
|
|
965
966
|
title: n,
|
|
966
|
-
className: `inline-flex h-6 items-center gap-1 rounded border px-1.5 text-[11px] font-normal normal-case tracking-normal ${
|
|
967
|
+
className: `inline-flex h-6 items-center gap-1 rounded border px-1.5 text-[11px] font-normal normal-case tracking-normal ${S ? "w-full min-w-[64px]" : "max-w-[150px]"} ${h.length ? "border-nvr-cyan/40 bg-nvr-cyan/[0.08] text-slate-800 dark:text-slate-100" : "border-slate-200 bg-white text-slate-500 dark:border-slate-700 dark:bg-slate-900 dark:text-slate-400"}`,
|
|
967
968
|
children: [
|
|
968
969
|
q && /* @__PURE__ */ a(
|
|
969
970
|
"span",
|
|
@@ -1033,11 +1034,11 @@ function Lu({
|
|
|
1033
1034
|
onChange: d,
|
|
1034
1035
|
preferIds: w
|
|
1035
1036
|
}) {
|
|
1036
|
-
const
|
|
1037
|
+
const S = St(), [$, q] = _(!1), N = $ || h.length > 0, [L, K] = _(""), V = (w ?? []).map(String).sort().join(","), { data: I } = ne({
|
|
1037
1038
|
queryKey: ["cbv-collection-meta", n],
|
|
1038
|
-
queryFn: () =>
|
|
1039
|
+
queryFn: () => S.request(J(`/collections/${n}`)).then((T) => T.data),
|
|
1039
1040
|
staleTime: 10 * 6e4,
|
|
1040
|
-
enabled:
|
|
1041
|
+
enabled: N,
|
|
1041
1042
|
retry: !1
|
|
1042
1043
|
}), u = Yn(I), y = (I == null ? void 0 : I.display_template) ?? null, { data: Q = [], isLoading: F } = ne({
|
|
1043
1044
|
// Own key shape (an array of {value,label}) — 'cbv-filter-options' held the
|
|
@@ -1054,19 +1055,19 @@ function Lu({
|
|
|
1054
1055
|
label: (y ? Ta(y, Ae) : "") || String(Ae[u] ?? Ae.id ?? "")
|
|
1055
1056
|
})), me = await Promise.all(
|
|
1056
1057
|
T.map(
|
|
1057
|
-
(we) =>
|
|
1058
|
+
(we) => S.request(J(`/items/${n}`, we)).then((Ae) => de(Ae.data ?? []))
|
|
1058
1059
|
)
|
|
1059
1060
|
);
|
|
1060
1061
|
return Uc(me);
|
|
1061
1062
|
},
|
|
1062
1063
|
staleTime: 10 * 6e4,
|
|
1063
|
-
enabled:
|
|
1064
|
+
enabled: N && !!I,
|
|
1064
1065
|
retry: !1
|
|
1065
1066
|
}), m = h.filter((T) => !Q.some((de) => String(de.value) === String(T))), E = m.map(String).join(","), { data: P = [] } = ne({
|
|
1066
1067
|
queryKey: ["cbv-filter-selected-labels", n, u, y ?? "", E],
|
|
1067
1068
|
queryFn: () => {
|
|
1068
1069
|
const T = Rr(y, u);
|
|
1069
|
-
return
|
|
1070
|
+
return S.request(
|
|
1070
1071
|
J(`/items/${n}`, {
|
|
1071
1072
|
limit: m.length,
|
|
1072
1073
|
filter: JSON.stringify({ id: { _in: m } }),
|
|
@@ -1079,7 +1080,7 @@ function Lu({
|
|
|
1079
1080
|
}))
|
|
1080
1081
|
);
|
|
1081
1082
|
},
|
|
1082
|
-
enabled:
|
|
1083
|
+
enabled: N && !!I && !F && m.length > 0,
|
|
1083
1084
|
staleTime: 10 * 6e4,
|
|
1084
1085
|
retry: !1
|
|
1085
1086
|
}), M = P.length > 0 ? [
|
|
@@ -1108,11 +1109,11 @@ function Fu({
|
|
|
1108
1109
|
selected: h,
|
|
1109
1110
|
onChange: d
|
|
1110
1111
|
}) {
|
|
1111
|
-
const w = St(), [
|
|
1112
|
+
const w = St(), [S, $] = _(!1), { data: q = [], isLoading: N } = ne({
|
|
1112
1113
|
queryKey: ["cbv-distinct", n, o],
|
|
1113
1114
|
queryFn: () => w.request(J(`/items/${n}/distinct`, { field: o })).then((L) => L.data ?? []),
|
|
1114
1115
|
staleTime: 5 * 6e4,
|
|
1115
|
-
enabled:
|
|
1116
|
+
enabled: S,
|
|
1116
1117
|
retry: !1
|
|
1117
1118
|
});
|
|
1118
1119
|
return /* @__PURE__ */ a(
|
|
@@ -1123,7 +1124,7 @@ function Fu({
|
|
|
1123
1124
|
options: q.map((L) => ({ value: String(L), label: je(String(L)) })),
|
|
1124
1125
|
selected: h,
|
|
1125
1126
|
onChange: d,
|
|
1126
|
-
loading:
|
|
1127
|
+
loading: N,
|
|
1127
1128
|
onOpenChange: (L) => {
|
|
1128
1129
|
L && $(!0);
|
|
1129
1130
|
}
|
|
@@ -1134,18 +1135,18 @@ function Ru({
|
|
|
1134
1135
|
value: n,
|
|
1135
1136
|
onChange: o
|
|
1136
1137
|
}) {
|
|
1137
|
-
const [h, d] = _(!1), [w,
|
|
1138
|
+
const [h, d] = _(!1), [w, S] = _(""), [$, q] = _(""), N = fe(null);
|
|
1138
1139
|
pe(() => {
|
|
1139
1140
|
if (!h) return;
|
|
1140
1141
|
const u = (y) => {
|
|
1141
1142
|
var Q;
|
|
1142
|
-
(Q =
|
|
1143
|
+
(Q = N.current) != null && Q.contains(y.target) || d(!1);
|
|
1143
1144
|
};
|
|
1144
1145
|
return window.addEventListener("mousedown", u), () => window.removeEventListener("mousedown", u);
|
|
1145
1146
|
}, [h]), pe(() => {
|
|
1146
1147
|
if (h && n.startsWith("r:")) {
|
|
1147
1148
|
const [u, y] = n.slice(2).split("..");
|
|
1148
|
-
|
|
1149
|
+
S(u ?? ""), q(y ?? "");
|
|
1149
1150
|
}
|
|
1150
1151
|
}, [h, n]);
|
|
1151
1152
|
const L = (() => {
|
|
@@ -1162,7 +1163,7 @@ function Ru({
|
|
|
1162
1163
|
const u = w || $;
|
|
1163
1164
|
u && (o(Ji({ op: K, from: u, to: $ || w || u })), d(!1));
|
|
1164
1165
|
};
|
|
1165
|
-
return /* @__PURE__ */ c("div", { ref:
|
|
1166
|
+
return /* @__PURE__ */ c("div", { ref: N, className: "relative w-full", children: [
|
|
1166
1167
|
/* @__PURE__ */ c(
|
|
1167
1168
|
"button",
|
|
1168
1169
|
{
|
|
@@ -1223,7 +1224,7 @@ function Ru({
|
|
|
1223
1224
|
{
|
|
1224
1225
|
type: "date",
|
|
1225
1226
|
value: w,
|
|
1226
|
-
onChange: (u) =>
|
|
1227
|
+
onChange: (u) => S(u.target.value),
|
|
1227
1228
|
"aria-label": "From date",
|
|
1228
1229
|
className: "h-6 min-w-0 flex-1 rounded border border-slate-200 bg-white px-1 text-[10.5px] font-normal dark:border-slate-700 dark:bg-slate-800 dark:text-slate-100"
|
|
1229
1230
|
}
|
|
@@ -1261,15 +1262,15 @@ function Eu({
|
|
|
1261
1262
|
onChange: h,
|
|
1262
1263
|
allowedIds: d,
|
|
1263
1264
|
scopeDefault: w,
|
|
1264
|
-
narrowBy:
|
|
1265
|
+
narrowBy: S = []
|
|
1265
1266
|
}) {
|
|
1266
|
-
const $ = St(), q = Fa(),
|
|
1267
|
+
const $ = St(), q = Fa(), N = n.value_field ?? "id", [L, K] = _(!1), V = JSON.stringify(S.filter((F) => F.values.length > 0)), { data: I = [], isLoading: u } = ne({
|
|
1267
1268
|
// The cascade rides at the END of the key so label lookups by the prefix
|
|
1268
1269
|
// (the filter sentence) still find every option list.
|
|
1269
1270
|
queryKey: [
|
|
1270
1271
|
"cbv-quick-options",
|
|
1271
1272
|
n.collection,
|
|
1272
|
-
|
|
1273
|
+
N,
|
|
1273
1274
|
n.label_field,
|
|
1274
1275
|
n.sort ?? "",
|
|
1275
1276
|
V,
|
|
@@ -1279,7 +1280,7 @@ function Eu({
|
|
|
1279
1280
|
const F = V !== "[]" ? Ad(
|
|
1280
1281
|
n.collection,
|
|
1281
1282
|
await Id($, q, n.collection),
|
|
1282
|
-
|
|
1283
|
+
S
|
|
1283
1284
|
) : null, m = (T, de) => $.request(
|
|
1284
1285
|
J(`/items/${n.collection}`, {
|
|
1285
1286
|
limit: 1e3,
|
|
@@ -1287,16 +1288,16 @@ function Eu({
|
|
|
1287
1288
|
...de ? { picker: "1" } : {},
|
|
1288
1289
|
...n.sort ? { sort: n.sort } : {},
|
|
1289
1290
|
...T ? { filter: JSON.stringify(T) } : {},
|
|
1290
|
-
fields: [.../* @__PURE__ */ new Set(["id",
|
|
1291
|
+
fields: [.../* @__PURE__ */ new Set(["id", N, n.label_field])].join(",")
|
|
1291
1292
|
})
|
|
1292
1293
|
).then(
|
|
1293
1294
|
(me) => (me.data ?? []).map((we) => ({
|
|
1294
|
-
value: we[
|
|
1295
|
-
label: String(we[n.label_field] ?? we[
|
|
1295
|
+
value: we[N],
|
|
1296
|
+
label: String(we[n.label_field] ?? we[N] ?? ""),
|
|
1296
1297
|
id: we.id
|
|
1297
1298
|
})).filter((we) => we.value != null && we.label !== "")
|
|
1298
1299
|
), E = await m(F, !0), P = new Set(E.map((T) => String(T.value))), M = o.filter((T) => !P.has(String(T)));
|
|
1299
|
-
return M.length === 0 ? E : [...E, ...await m({ [
|
|
1300
|
+
return M.length === 0 ? E : [...E, ...await m({ [N]: { _in: M } }, !1)];
|
|
1300
1301
|
},
|
|
1301
1302
|
staleTime: 10 * 6e4,
|
|
1302
1303
|
enabled: L || o.length > 0,
|
|
@@ -1368,13 +1369,13 @@ function Bl(n) {
|
|
|
1368
1369
|
for (const d of n) {
|
|
1369
1370
|
const w = d.fieldType === "date" || d.fieldType === "datetime" || d.fieldType === "timestamp";
|
|
1370
1371
|
if (d.op === "_between") {
|
|
1371
|
-
const [q,
|
|
1372
|
+
const [q, N] = String(d.value).split("..");
|
|
1372
1373
|
if (d.not) {
|
|
1373
1374
|
const L = [];
|
|
1374
|
-
q && L.push({ path: d.path, op: "_lt", value: q }),
|
|
1375
|
+
q && L.push({ path: d.path, op: "_lt", value: q }), N && L.push({ path: d.path, op: "_gt", value: w ? `${N}T23:59:59` : N }), L.length && o.push({ or: L });
|
|
1375
1376
|
continue;
|
|
1376
1377
|
}
|
|
1377
|
-
q && o.push({ path: d.path, op: "_gte", value: q }),
|
|
1378
|
+
q && o.push({ path: d.path, op: "_gte", value: q }), N && o.push({ path: d.path, op: "_lte", value: w ? `${N}T23:59:59` : N });
|
|
1378
1379
|
continue;
|
|
1379
1380
|
}
|
|
1380
1381
|
if ((h = d.path[0]) != null && h.startsWith("$has_") || d.path[0] === "$missing_required" || d.path[0] === "$unseen") {
|
|
@@ -1391,8 +1392,8 @@ function Bl(n) {
|
|
|
1391
1392
|
}) : (o.push({ path: d.path, op: "_gte", value: q.from }), o.push({ path: d.path, op: "_lte", value: `${q.to}T23:59:59` })));
|
|
1392
1393
|
continue;
|
|
1393
1394
|
}
|
|
1394
|
-
let
|
|
1395
|
-
d.fieldType === "boolean" && ($ === "true" || $ === "false") && ($ = $ === "true"), d.not && (
|
|
1395
|
+
let S = d.op.includes(":") ? d.op.split(":")[0] : d.op, $ = d.op.includes(":") ? d.op.split(":")[1] : d.value || null;
|
|
1396
|
+
d.fieldType === "boolean" && ($ === "true" || $ === "false") && ($ = $ === "true"), d.not && (S = Du[S] ?? S), o.push({ path: d.path, op: S, value: $ });
|
|
1396
1397
|
}
|
|
1397
1398
|
return o;
|
|
1398
1399
|
}
|
|
@@ -1459,20 +1460,20 @@ function Pr({
|
|
|
1459
1460
|
path: h,
|
|
1460
1461
|
pathLabels: d,
|
|
1461
1462
|
filterText: w,
|
|
1462
|
-
includeAliases:
|
|
1463
|
+
includeAliases: S = !1,
|
|
1463
1464
|
onPick: $
|
|
1464
1465
|
}) {
|
|
1465
|
-
const q = St(), { data:
|
|
1466
|
+
const q = St(), { data: N } = ne({
|
|
1466
1467
|
queryKey: ["cbv-collection-meta", n],
|
|
1467
1468
|
queryFn: () => q.request(J(`/collections/${n}`)).then((I) => I.data),
|
|
1468
1469
|
staleTime: 10 * 6e4,
|
|
1469
1470
|
retry: !1
|
|
1470
1471
|
}), [L, K] = _(/* @__PURE__ */ new Set());
|
|
1471
|
-
if (!
|
|
1472
|
+
if (!N)
|
|
1472
1473
|
return /* @__PURE__ */ a("div", { className: "px-3 py-1.5", style: { paddingLeft: `${0.5 + o}rem` }, children: /* @__PURE__ */ a("span", { className: "inline-block h-3 w-20 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }) });
|
|
1473
1474
|
const V = o < 2;
|
|
1474
|
-
return /* @__PURE__ */ a(Qe, { children:
|
|
1475
|
-
const u = V ? ot(
|
|
1475
|
+
return /* @__PURE__ */ a(Qe, { children: N.fields.filter((I) => !I.hidden && (!w || I.field.includes(w))).map((I) => {
|
|
1476
|
+
const u = V ? ot(N.relations, n, I.field) : void 0, y = V && S ? Sn(N.relations, n, I.field) : void 0, Q = (u == null ? void 0 : u.one_collection) ?? null, F = L.has(I.field);
|
|
1476
1477
|
return /* @__PURE__ */ c("div", { children: [
|
|
1477
1478
|
/* @__PURE__ */ c(
|
|
1478
1479
|
"button",
|
|
@@ -1505,7 +1506,7 @@ function Pr({
|
|
|
1505
1506
|
path: [...h, I.field],
|
|
1506
1507
|
pathLabels: [...d, je(I.field)],
|
|
1507
1508
|
filterText: "",
|
|
1508
|
-
includeAliases:
|
|
1509
|
+
includeAliases: S,
|
|
1509
1510
|
onPick: $
|
|
1510
1511
|
}
|
|
1511
1512
|
),
|
|
@@ -1516,7 +1517,7 @@ function Pr({
|
|
|
1516
1517
|
depth: o + 1,
|
|
1517
1518
|
path: [...h, I.field],
|
|
1518
1519
|
pathLabels: [...d, je(I.field)],
|
|
1519
|
-
includeAliases:
|
|
1520
|
+
includeAliases: S,
|
|
1520
1521
|
onPick: $
|
|
1521
1522
|
}
|
|
1522
1523
|
)
|
|
@@ -1529,9 +1530,9 @@ function eo({
|
|
|
1529
1530
|
path: h,
|
|
1530
1531
|
pathLabels: d,
|
|
1531
1532
|
includeAliases: w,
|
|
1532
|
-
onPick:
|
|
1533
|
+
onPick: S
|
|
1533
1534
|
}) {
|
|
1534
|
-
const $ = St(), q = n.relation.many_collection ?? "", { data:
|
|
1535
|
+
const $ = St(), q = n.relation.many_collection ?? "", { data: N } = ne({
|
|
1535
1536
|
queryKey: ["cbv-collection-meta", q],
|
|
1536
1537
|
queryFn: () => $.request(J(`/collections/${q}`)).then((K) => K.data),
|
|
1537
1538
|
staleTime: 10 * 6e4,
|
|
@@ -1541,7 +1542,7 @@ function eo({
|
|
|
1541
1542
|
let L = null;
|
|
1542
1543
|
if (n.kind === "o2m") L = q || null;
|
|
1543
1544
|
else {
|
|
1544
|
-
const K =
|
|
1545
|
+
const K = N == null ? void 0 : N.relations.find(
|
|
1545
1546
|
(V) => V.many_collection === q && V.many_field === n.relation.junction_field
|
|
1546
1547
|
);
|
|
1547
1548
|
L = (K == null ? void 0 : K.one_collection) ?? null;
|
|
@@ -1555,7 +1556,7 @@ function eo({
|
|
|
1555
1556
|
pathLabels: d,
|
|
1556
1557
|
filterText: "",
|
|
1557
1558
|
includeAliases: w,
|
|
1558
|
-
onPick:
|
|
1559
|
+
onPick: S
|
|
1559
1560
|
}
|
|
1560
1561
|
) : /* @__PURE__ */ a("div", { className: "px-3 py-1.5", style: { paddingLeft: `${0.5 + o}rem` }, children: /* @__PURE__ */ a("span", { className: "inline-block h-3 w-20 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }) });
|
|
1561
1562
|
}
|
|
@@ -1570,29 +1571,29 @@ function Ou({
|
|
|
1570
1571
|
pathLabels: h,
|
|
1571
1572
|
search: d,
|
|
1572
1573
|
depth: w,
|
|
1573
|
-
onDrill:
|
|
1574
|
+
onDrill: S,
|
|
1574
1575
|
onPick: $
|
|
1575
1576
|
}) {
|
|
1576
|
-
const q = St(), { data:
|
|
1577
|
+
const q = St(), { data: N } = ne({
|
|
1577
1578
|
queryKey: ["cbv-collection-meta", n],
|
|
1578
1579
|
queryFn: () => q.request(J(`/collections/${n}`)).then((m) => m.data),
|
|
1579
1580
|
staleTime: 10 * 6e4,
|
|
1580
1581
|
retry: !1
|
|
1581
1582
|
}), L = be(() => {
|
|
1582
|
-
if (!
|
|
1583
|
+
if (!N) return [];
|
|
1583
1584
|
const m = /* @__PURE__ */ new Set();
|
|
1584
|
-
for (const E of
|
|
1585
|
+
for (const E of N.fields) {
|
|
1585
1586
|
if (E.hidden) continue;
|
|
1586
|
-
const P = ot(
|
|
1587
|
+
const P = ot(N.relations, n, E.field);
|
|
1587
1588
|
P != null && P.one_collection && !Tt(P.one_collection) && m.add(P.one_collection);
|
|
1588
|
-
const M = Sn(
|
|
1589
|
+
const M = Sn(N.relations, n, E.field);
|
|
1589
1590
|
if (M) {
|
|
1590
|
-
const T = ya(
|
|
1591
|
+
const T = ya(N.relations, M) ?? M.relation.many_collection;
|
|
1591
1592
|
T && !Tt(T) && m.add(T);
|
|
1592
1593
|
}
|
|
1593
1594
|
}
|
|
1594
1595
|
return [...m].slice(0, 12);
|
|
1595
|
-
}, [
|
|
1596
|
+
}, [N, n]), K = _a({
|
|
1596
1597
|
queries: L.map((m) => ({
|
|
1597
1598
|
queryKey: ["cbv-collection-meta", m],
|
|
1598
1599
|
queryFn: () => q.request(J(`/collections/${m}`)).then((E) => E.data),
|
|
@@ -1607,12 +1608,12 @@ function Ou({
|
|
|
1607
1608
|
return m.set(E, (M = K[P]) == null ? void 0 : M.data);
|
|
1608
1609
|
}), m;
|
|
1609
1610
|
}, [L, K]);
|
|
1610
|
-
if (!
|
|
1611
|
+
if (!N)
|
|
1611
1612
|
return /* @__PURE__ */ a("div", { className: "px-3 py-2", children: /* @__PURE__ */ a("span", { className: "inline-block h-3 w-24 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }) });
|
|
1612
1613
|
const I = d.trim().toLowerCase(), u = (m) => !I || m.toLowerCase().includes(I) || m.toLowerCase().replace(/ /g, "_").includes(I), y = [];
|
|
1613
|
-
for (const m of
|
|
1614
|
+
for (const m of N.fields) {
|
|
1614
1615
|
if (m.hidden) continue;
|
|
1615
|
-
const E = je(m.field), P = ot(
|
|
1616
|
+
const E = je(m.field), P = ot(N.relations, n, m.field), M = Sn(N.relations, n, m.field), T = [...o, m.field], de = [...h, E];
|
|
1616
1617
|
if (P != null && P.one_collection && !Tt(P.one_collection))
|
|
1617
1618
|
u(E) && y.push({
|
|
1618
1619
|
key: m.field,
|
|
@@ -1627,17 +1628,17 @@ function Ou({
|
|
|
1627
1628
|
}
|
|
1628
1629
|
});
|
|
1629
1630
|
else if (M) {
|
|
1630
|
-
const me = ya(
|
|
1631
|
+
const me = ya(N.relations, M) ?? M.relation.many_collection;
|
|
1631
1632
|
u(E) && me && y.push({
|
|
1632
1633
|
key: m.field,
|
|
1633
1634
|
label: E,
|
|
1634
1635
|
hint: M.kind === "m2m" ? "list" : "items",
|
|
1635
1636
|
drillTo: w < 2 ? { collection: me, path: T, pathLabels: de } : void 0,
|
|
1636
|
-
leaf: M.kind === "m2m" && ya(
|
|
1637
|
+
leaf: M.kind === "m2m" && ya(N.relations, M) ? {
|
|
1637
1638
|
path: T,
|
|
1638
1639
|
pathLabels: de,
|
|
1639
1640
|
fieldType: "relation",
|
|
1640
|
-
relTarget: ya(
|
|
1641
|
+
relTarget: ya(N.relations, M)
|
|
1641
1642
|
} : void 0
|
|
1642
1643
|
});
|
|
1643
1644
|
} else u(E) && y.push({
|
|
@@ -1649,9 +1650,9 @@ function Ou({
|
|
|
1649
1650
|
}
|
|
1650
1651
|
const Q = [];
|
|
1651
1652
|
if (I)
|
|
1652
|
-
for (const m of
|
|
1653
|
+
for (const m of N.fields) {
|
|
1653
1654
|
if (m.hidden) continue;
|
|
1654
|
-
const E = ot(
|
|
1655
|
+
const E = ot(N.relations, n, m.field);
|
|
1655
1656
|
if (!(E != null && E.one_collection) || Tt(E.one_collection)) continue;
|
|
1656
1657
|
const P = V.get(E.one_collection);
|
|
1657
1658
|
if (!P) continue;
|
|
@@ -1686,7 +1687,7 @@ function Ou({
|
|
|
1686
1687
|
{
|
|
1687
1688
|
type: "button",
|
|
1688
1689
|
onClick: () => {
|
|
1689
|
-
m.leaf ? $(m.leaf) : m.drillTo &&
|
|
1690
|
+
m.leaf ? $(m.leaf) : m.drillTo && S(m.drillTo.collection, m.drillTo.path, m.drillTo.pathLabels);
|
|
1690
1691
|
},
|
|
1691
1692
|
className: "flex min-w-0 flex-1 items-center gap-1.5 rounded px-1.5 py-1.5 text-left text-[12.5px] text-slate-700 dark:text-slate-200",
|
|
1692
1693
|
children: [
|
|
@@ -1703,7 +1704,7 @@ function Ou({
|
|
|
1703
1704
|
"button",
|
|
1704
1705
|
{
|
|
1705
1706
|
type: "button",
|
|
1706
|
-
onClick: () =>
|
|
1707
|
+
onClick: () => S(m.drillTo.collection, m.drillTo.path, m.drillTo.pathLabels),
|
|
1707
1708
|
"aria-label": `Drill into ${m.label}`,
|
|
1708
1709
|
className: "shrink-0 rounded px-1.5 py-1 text-[11px] text-slate-300 hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-slate-700",
|
|
1709
1710
|
children: "▸"
|
|
@@ -1720,39 +1721,39 @@ function Au({
|
|
|
1720
1721
|
labels: h,
|
|
1721
1722
|
onToggle: d
|
|
1722
1723
|
}) {
|
|
1723
|
-
const w = St(), [
|
|
1724
|
+
const w = St(), [S, $] = _(""), { data: q } = ne({
|
|
1724
1725
|
queryKey: ["cbv-collection-meta", n],
|
|
1725
1726
|
queryFn: () => w.request(J(`/collections/${n}`)).then((y) => y.data),
|
|
1726
1727
|
staleTime: 10 * 6e4,
|
|
1727
1728
|
retry: !1
|
|
1728
|
-
}),
|
|
1729
|
-
queryKey: ["cbv-filter-options", n,
|
|
1729
|
+
}), N = Yn(q), L = (q == null ? void 0 : q.display_template) ?? null, { data: K = [], isLoading: V } = ne({
|
|
1730
|
+
queryKey: ["cbv-filter-options", n, N, L ?? ""],
|
|
1730
1731
|
queryFn: () => {
|
|
1731
|
-
const y = Rr(L,
|
|
1732
|
+
const y = Rr(L, N);
|
|
1732
1733
|
return w.request(
|
|
1733
1734
|
J(`/items/${n}`, {
|
|
1734
1735
|
limit: 500,
|
|
1735
|
-
sort:
|
|
1736
|
+
sort: N,
|
|
1736
1737
|
picker: "1",
|
|
1737
1738
|
...y ? { fields: y } : {}
|
|
1738
1739
|
})
|
|
1739
1740
|
).then(
|
|
1740
1741
|
(Q) => (Q.data ?? []).map((F) => ({
|
|
1741
1742
|
value: F.id,
|
|
1742
|
-
label: (L ? Ta(L, F) : "") || String(F[
|
|
1743
|
+
label: (L ? Ta(L, F) : "") || String(F[N] ?? F.id ?? "")
|
|
1743
1744
|
})).filter((F) => F.value != null && F.label !== "")
|
|
1744
1745
|
);
|
|
1745
1746
|
},
|
|
1746
1747
|
staleTime: 10 * 6e4,
|
|
1747
1748
|
enabled: !!q,
|
|
1748
1749
|
retry: !1
|
|
1749
|
-
}), I = new Set(o.map(String)), u =
|
|
1750
|
+
}), I = new Set(o.map(String)), u = S ? K.filter((y) => y.label.toLowerCase().includes(S.toLowerCase())) : K;
|
|
1750
1751
|
return /* @__PURE__ */ c("div", { className: "flex max-h-64 flex-col", children: [
|
|
1751
1752
|
/* @__PURE__ */ a(
|
|
1752
1753
|
"input",
|
|
1753
1754
|
{
|
|
1754
1755
|
autoFocus: !0,
|
|
1755
|
-
value:
|
|
1756
|
+
value: S,
|
|
1756
1757
|
onChange: (y) => $(y.target.value),
|
|
1757
1758
|
placeholder: `Search ${je(n)}…`,
|
|
1758
1759
|
className: "mx-2 mb-1 h-7 shrink-0 rounded border border-slate-200 bg-slate-50 px-2 text-[12px] outline-none focus:border-nvr-cyan/50 dark:border-slate-700 dark:bg-slate-800 dark:text-slate-100"
|
|
@@ -1797,11 +1798,11 @@ function Iu(n) {
|
|
|
1797
1798
|
};
|
|
1798
1799
|
}
|
|
1799
1800
|
if (n.op === "_between") {
|
|
1800
|
-
const [w,
|
|
1801
|
-
return { field: o, op: "between", value: `${w} – ${
|
|
1801
|
+
const [w, S] = String(n.value).split("..");
|
|
1802
|
+
return { field: o, op: "between", value: `${w} – ${S}` };
|
|
1802
1803
|
}
|
|
1803
1804
|
if (n.op === "_preset") {
|
|
1804
|
-
const w = ((h = La.find((
|
|
1805
|
+
const w = ((h = La.find((S) => S.value === n.value)) == null ? void 0 : h.label) ?? String(n.value);
|
|
1805
1806
|
return { field: o, op: "in the", value: `${w} (rolling)` };
|
|
1806
1807
|
}
|
|
1807
1808
|
return (d = n.path[0]) != null && d.startsWith("$has_") || n.path[0] === "$missing_required" ? { field: o, op: "", value: "" } : { field: o, op: Mu(n.op).toLowerCase(), value: String(n.value ?? "") };
|
|
@@ -1812,9 +1813,9 @@ function Ku({
|
|
|
1812
1813
|
search: h,
|
|
1813
1814
|
onSearch: d,
|
|
1814
1815
|
filters: w,
|
|
1815
|
-
onFiltersChange:
|
|
1816
|
+
onFiltersChange: S
|
|
1816
1817
|
}) {
|
|
1817
|
-
const [$, q] = _(!1), [
|
|
1818
|
+
const [$, q] = _(!1), [N, L] = _(""), [K, V] = _({
|
|
1818
1819
|
collection: n,
|
|
1819
1820
|
path: [],
|
|
1820
1821
|
pathLabels: []
|
|
@@ -1836,7 +1837,7 @@ function Ku({
|
|
|
1836
1837
|
}, Se = () => {
|
|
1837
1838
|
Be(), q(!0);
|
|
1838
1839
|
}, X = (k) => {
|
|
1839
|
-
|
|
1840
|
+
S(we ? w.map((le) => le.id === we ? { ...k, id: we } : le) : [...w, { ...k, id: crypto.randomUUID() }]), q(!1), Be();
|
|
1840
1841
|
}, $e = (k, le) => {
|
|
1841
1842
|
I && X({
|
|
1842
1843
|
path: I.path,
|
|
@@ -1940,14 +1941,14 @@ function Ku({
|
|
|
1940
1941
|
"input",
|
|
1941
1942
|
{
|
|
1942
1943
|
autoFocus: !0,
|
|
1943
|
-
value:
|
|
1944
|
+
value: N,
|
|
1944
1945
|
onChange: (k) => L(k.target.value),
|
|
1945
1946
|
placeholder: "Find field…",
|
|
1946
1947
|
className: "h-8 w-full rounded-lg border-2 border-nvr-cyan/50 bg-white px-2.5 text-[12.5px] outline-none placeholder:text-slate-400 focus:ring-2 focus:ring-nvr-cyan/20 dark:border-nvr-cyan/40 dark:bg-slate-800 dark:text-slate-100"
|
|
1947
1948
|
}
|
|
1948
1949
|
) }),
|
|
1949
1950
|
/* @__PURE__ */ c("div", { className: "max-h-80 overflow-y-auto py-1", children: [
|
|
1950
|
-
K.path.length === 0 && !
|
|
1951
|
+
K.path.length === 0 && !N && /* @__PURE__ */ a("div", { className: "mb-1 border-b border-slate-100 pb-1 dark:border-slate-800", children: [
|
|
1951
1952
|
["$has_files", "Has attachments"],
|
|
1952
1953
|
["$has_comments", "Has comments"],
|
|
1953
1954
|
["$has_tasks", "Has open tasks"],
|
|
@@ -1959,7 +1960,7 @@ function Ku({
|
|
|
1959
1960
|
{
|
|
1960
1961
|
type: "button",
|
|
1961
1962
|
onClick: () => {
|
|
1962
|
-
|
|
1963
|
+
S([
|
|
1963
1964
|
...w.filter((ee) => ee.path[0] !== k),
|
|
1964
1965
|
{
|
|
1965
1966
|
id: `${k}-${Date.now()}`,
|
|
@@ -1985,7 +1986,7 @@ function Ku({
|
|
|
1985
1986
|
collection: K.collection,
|
|
1986
1987
|
path: K.path,
|
|
1987
1988
|
pathLabels: K.pathLabels,
|
|
1988
|
-
search:
|
|
1989
|
+
search: N,
|
|
1989
1990
|
depth: K.path.length,
|
|
1990
1991
|
onDrill: (k, le, ee) => {
|
|
1991
1992
|
V({ collection: k, path: le, pathLabels: ee }), L("");
|
|
@@ -2194,7 +2195,7 @@ function Ku({
|
|
|
2194
2195
|
"button",
|
|
2195
2196
|
{
|
|
2196
2197
|
type: "button",
|
|
2197
|
-
onClick: () =>
|
|
2198
|
+
onClick: () => S(w.map((ee) => ee.id === k.id ? { ...ee, not: !ee.not } : ee)),
|
|
2198
2199
|
"data-tip": k.not ? "Negated — click to restore" : "Click to negate (NOT)",
|
|
2199
2200
|
className: k.not ? "rounded bg-amber-100 px-1 text-[10.5px] font-bold text-amber-700 dark:bg-amber-400/15 dark:text-amber-400" : "rounded px-1 text-[10.5px] font-bold text-slate-300 hover:text-slate-500",
|
|
2200
2201
|
children: "NOT"
|
|
@@ -2217,7 +2218,7 @@ function Ku({
|
|
|
2217
2218
|
"button",
|
|
2218
2219
|
{
|
|
2219
2220
|
type: "button",
|
|
2220
|
-
onClick: () =>
|
|
2221
|
+
onClick: () => S(w.filter((ee) => ee.id !== k.id)),
|
|
2221
2222
|
"aria-label": "Remove filter",
|
|
2222
2223
|
className: "text-slate-400 hover:text-red-500",
|
|
2223
2224
|
children: "✕"
|
|
@@ -2236,10 +2237,10 @@ function ju({
|
|
|
2236
2237
|
meta: o,
|
|
2237
2238
|
onPick: h
|
|
2238
2239
|
}) {
|
|
2239
|
-
const [d, w] = _(/* @__PURE__ */ new Set()),
|
|
2240
|
+
const [d, w] = _(/* @__PURE__ */ new Set()), S = ($, q) => h($, q);
|
|
2240
2241
|
return /* @__PURE__ */ a("div", { className: "max-h-56 overflow-y-auto", children: o.fields.filter(($) => !$.hidden).map(($) => {
|
|
2241
|
-
const q = ot(o.relations, n, $.field),
|
|
2242
|
-
if (!(q != null && q.one_collection) && !
|
|
2242
|
+
const q = ot(o.relations, n, $.field), N = Sn(o.relations, n, $.field);
|
|
2243
|
+
if (!(q != null && q.one_collection) && !N) return null;
|
|
2243
2244
|
const L = d.has($.field);
|
|
2244
2245
|
return /* @__PURE__ */ c("div", { children: [
|
|
2245
2246
|
/* @__PURE__ */ c(
|
|
@@ -2255,7 +2256,7 @@ function ju({
|
|
|
2255
2256
|
L ? "▾" : "▸",
|
|
2256
2257
|
" ",
|
|
2257
2258
|
je($.field),
|
|
2258
|
-
|
|
2259
|
+
N && /* @__PURE__ */ a("span", { className: "text-[10px] text-slate-400", children: N.kind })
|
|
2259
2260
|
]
|
|
2260
2261
|
}
|
|
2261
2262
|
),
|
|
@@ -2268,18 +2269,18 @@ function ju({
|
|
|
2268
2269
|
pathLabels: [je($.field)],
|
|
2269
2270
|
filterText: "",
|
|
2270
2271
|
includeAliases: !0,
|
|
2271
|
-
onPick:
|
|
2272
|
+
onPick: S
|
|
2272
2273
|
}
|
|
2273
2274
|
),
|
|
2274
|
-
L &&
|
|
2275
|
+
L && N && /* @__PURE__ */ a(
|
|
2275
2276
|
eo,
|
|
2276
2277
|
{
|
|
2277
|
-
aliasInfo:
|
|
2278
|
+
aliasInfo: N,
|
|
2278
2279
|
depth: 1,
|
|
2279
2280
|
path: [$.field],
|
|
2280
2281
|
pathLabels: [je($.field)],
|
|
2281
2282
|
includeAliases: !0,
|
|
2282
|
-
onPick:
|
|
2283
|
+
onPick: S
|
|
2283
2284
|
}
|
|
2284
2285
|
)
|
|
2285
2286
|
] }, $.field);
|
|
@@ -2291,13 +2292,13 @@ function Bu({
|
|
|
2291
2292
|
onDone: h,
|
|
2292
2293
|
onCancel: d
|
|
2293
2294
|
}) {
|
|
2294
|
-
const w = St(), [
|
|
2295
|
+
const w = St(), [S, $] = _(o[0]), [q, N] = _(!1), [L, K] = _(null), [V, I] = _(null), u = o.find((F) => String(F) !== String(S));
|
|
2295
2296
|
pe(() => {
|
|
2296
2297
|
I(null);
|
|
2297
2298
|
let F = !0;
|
|
2298
2299
|
return w.request(
|
|
2299
2300
|
he(`/record-merge/${n}`, {
|
|
2300
|
-
survivor_id:
|
|
2301
|
+
survivor_id: S,
|
|
2301
2302
|
merged_id: u,
|
|
2302
2303
|
dry_run: !0
|
|
2303
2304
|
})
|
|
@@ -2308,23 +2309,23 @@ function Bu({
|
|
|
2308
2309
|
}), () => {
|
|
2309
2310
|
F = !1;
|
|
2310
2311
|
};
|
|
2311
|
-
}, [
|
|
2312
|
+
}, [S]);
|
|
2312
2313
|
const y = V ? Object.values(V.references).reduce((F, m) => F + m, 0) : null, Q = async () => {
|
|
2313
2314
|
var F;
|
|
2314
|
-
|
|
2315
|
+
N(!0), K(null);
|
|
2315
2316
|
try {
|
|
2316
2317
|
const m = await w.request(
|
|
2317
|
-
he(`/record-merge/${n}`, { survivor_id:
|
|
2318
|
+
he(`/record-merge/${n}`, { survivor_id: S, merged_id: u })
|
|
2318
2319
|
);
|
|
2319
2320
|
h(
|
|
2320
|
-
m.data.delete_error ? `Merged — references repointed, but the duplicate was not deleted: ${m.data.delete_error}` : `Merged ${u} into ${
|
|
2321
|
+
m.data.delete_error ? `Merged — references repointed, but the duplicate was not deleted: ${m.data.delete_error}` : `Merged ${u} into ${S}`
|
|
2321
2322
|
);
|
|
2322
2323
|
} catch (m) {
|
|
2323
2324
|
K(
|
|
2324
2325
|
((F = m == null ? void 0 : m.response) == null ? void 0 : F.error) ?? Zt(m, "Merge failed")
|
|
2325
2326
|
);
|
|
2326
2327
|
} finally {
|
|
2327
|
-
|
|
2328
|
+
N(!1);
|
|
2328
2329
|
}
|
|
2329
2330
|
};
|
|
2330
2331
|
return /* @__PURE__ */ c("span", { className: "flex flex-wrap items-center gap-2", children: [
|
|
@@ -2336,7 +2337,7 @@ function Bu({
|
|
|
2336
2337
|
onClick: () => $(F),
|
|
2337
2338
|
className: Xt(
|
|
2338
2339
|
"h-8 rounded-md border px-3 font-mono text-[12px]",
|
|
2339
|
-
String(
|
|
2340
|
+
String(S) === String(F) ? "border-nvr-cyan bg-nvr-cyan/[0.13] text-[#7fe7ff]" : "border-white/20 dark:border-border text-slate-300 dark:text-muted-foreground hover:bg-white/10 dark:hover:bg-muted"
|
|
2340
2341
|
),
|
|
2341
2342
|
children: String(F)
|
|
2342
2343
|
},
|
|
@@ -2371,10 +2372,10 @@ function Uu({
|
|
|
2371
2372
|
transitions: h,
|
|
2372
2373
|
states: d = [],
|
|
2373
2374
|
fields: w,
|
|
2374
|
-
relations:
|
|
2375
|
+
relations: S,
|
|
2375
2376
|
registryKeys: $,
|
|
2376
2377
|
onClear: q,
|
|
2377
|
-
onSuccess:
|
|
2378
|
+
onSuccess: N
|
|
2378
2379
|
}) {
|
|
2379
2380
|
const L = $a(), K = St(), V = Fa(), I = Vl(), [u, y] = _("actions"), Q = pc([n], $), { data: F = [] } = ne({
|
|
2380
2381
|
queryKey: ["bulk-recipes", n],
|
|
@@ -2464,7 +2465,7 @@ function Uu({
|
|
|
2464
2465
|
Ai(H, o);
|
|
2465
2466
|
try {
|
|
2466
2467
|
const te = await f(H);
|
|
2467
|
-
Xe(te),
|
|
2468
|
+
Xe(te), N(), q(), y("actions");
|
|
2468
2469
|
} catch (te) {
|
|
2469
2470
|
Xe(Xi(te, "Bulk action failed"));
|
|
2470
2471
|
} finally {
|
|
@@ -2565,7 +2566,7 @@ function Uu({
|
|
|
2565
2566
|
{
|
|
2566
2567
|
targets: o.map((f) => ({ collection: n, id: f })),
|
|
2567
2568
|
fields: w,
|
|
2568
|
-
relations:
|
|
2569
|
+
relations: S,
|
|
2569
2570
|
renderValue: (f, H, te, oe) => Qu(n, f, H, te, oe),
|
|
2570
2571
|
className: "h-8 rounded-md border border-white/20 dark:border-border px-3 text-[12.5px] font-medium hover:bg-white/10 dark:hover:bg-muted"
|
|
2571
2572
|
}
|
|
@@ -2588,7 +2589,7 @@ function Uu({
|
|
|
2588
2589
|
tone: "dark",
|
|
2589
2590
|
disabled: ee,
|
|
2590
2591
|
onDone: (f) => {
|
|
2591
|
-
Xe(null),
|
|
2592
|
+
Xe(null), N(), f.failed === 0 && q();
|
|
2592
2593
|
}
|
|
2593
2594
|
}
|
|
2594
2595
|
),
|
|
@@ -2639,7 +2640,7 @@ function Uu({
|
|
|
2639
2640
|
collection: n,
|
|
2640
2641
|
ids: o.slice(0, 2),
|
|
2641
2642
|
onDone: (f) => {
|
|
2642
|
-
Xe(f),
|
|
2643
|
+
Xe(f), N(), q(), y("actions");
|
|
2643
2644
|
},
|
|
2644
2645
|
onCancel: () => y("actions")
|
|
2645
2646
|
}
|
|
@@ -2868,10 +2869,10 @@ function D0({
|
|
|
2868
2869
|
initialColumns: h,
|
|
2869
2870
|
initialSort: d,
|
|
2870
2871
|
pageSize: w = 25,
|
|
2871
|
-
initialSearch:
|
|
2872
|
+
initialSearch: S = "",
|
|
2872
2873
|
initialFilters: $,
|
|
2873
2874
|
initialConditions: q,
|
|
2874
|
-
onOpenItem:
|
|
2875
|
+
onOpenItem: N,
|
|
2875
2876
|
initialAiPrompt: L,
|
|
2876
2877
|
extraViews: K,
|
|
2877
2878
|
showCreate: V = !0,
|
|
@@ -2893,7 +2894,7 @@ function D0({
|
|
|
2893
2894
|
}
|
|
2894
2895
|
vd(`cbv:${n}`, M);
|
|
2895
2896
|
}, [n, M]);
|
|
2896
|
-
const me = fe(sd()), [we, Ae] = _(m ? m.q ?? "" :
|
|
2897
|
+
const me = fe(sd()), [we, Ae] = _(m ? m.q ?? "" : S), G = wl(we.trim(), 350), [Be, Se] = _(
|
|
2897
2898
|
E ? E.filters : $ ?? []
|
|
2898
2899
|
), [X, $e] = _(m ? m.s ?? "" : d ?? ""), [it, at] = _(h ?? null), [Ie, Pe] = _({}), [We, k] = _({}), [le, ee] = _(null), [xe, rt] = _({}), [Xe, mt] = _({}), [Lt, f] = _({}), [H, te] = _({}), [oe, ae] = _(null), [qe, ht] = _(!1), It = fe(null), [Cn, st] = _(
|
|
2899
2900
|
() => (m == null ? void 0 : m.qf) ?? {}
|
|
@@ -2971,7 +2972,7 @@ function D0({
|
|
|
2971
2972
|
}, [Ma]);
|
|
2972
2973
|
const jr = fe(null), Br = fe(null), Ur = !m && ((q == null ? void 0 : q.length) ?? 0) > 0, Oa = fe(!!m || Ur), { isAdmin: Ct } = $a(), zr = fe(n);
|
|
2973
2974
|
pe(() => {
|
|
2974
|
-
zr.current !== n && (zr.current = n, T(1), Ae(
|
|
2975
|
+
zr.current !== n && (zr.current = n, T(1), Ae(S), Se([]), $e(d ?? ""), at(h ?? null), Pe({}), k({}), rt({}), mt({}), rn([]), Dn(null), st({}), Kt({}), Qt({}), dn([]), lt != null && lt.length && xt.back(lt.length), cn(null), Oa.current = !1);
|
|
2975
2976
|
}, [n]), pe(() => {
|
|
2976
2977
|
if (!un) return;
|
|
2977
2978
|
const e = (t) => {
|
|
@@ -4380,7 +4381,7 @@ function D0({
|
|
|
4380
4381
|
type: "record",
|
|
4381
4382
|
collection: n,
|
|
4382
4383
|
item: e === "new" ? null : e
|
|
4383
|
-
}),
|
|
4384
|
+
}), N ? N(e) : Q({ collection: n, itemId: String(e) });
|
|
4384
4385
|
}, zs = (e) => {
|
|
4385
4386
|
const t = ot(Ge, n, e), r = (s) => {
|
|
4386
4387
|
$e(Gd(X, s, De.default_sort ?? "")), T(1);
|
|
@@ -7109,8 +7110,8 @@ ${r}`).then(() => {
|
|
|
7109
7110
|
);
|
|
7110
7111
|
}
|
|
7111
7112
|
function Qu(n, o, h, d, w) {
|
|
7112
|
-
const
|
|
7113
|
-
return
|
|
7113
|
+
const S = Er(o, n, h);
|
|
7114
|
+
return S != null && S.one_collection ? /* @__PURE__ */ a(Dr, { relatedCollection: S.one_collection, id: d }) : Wi(d, w);
|
|
7114
7115
|
}
|
|
7115
7116
|
export {
|
|
7116
7117
|
D0 as CollectionBrowserView,
|