@nivaro/react 0.3.111 → 0.3.112
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +170 -2
- package/dist/index.js +745 -728
- package/dist/shared/components/CollectionBrowserView.js +3097 -2972
- package/dist/shared/components/CollectionImportBanner.js +135 -0
- package/dist/shared/components/ItemEditForm.js +2235 -2218
- package/dist/shared/components/JobsTray.js +54 -47
- package/dist/shared/components/ViewAsPersonButton.js +109 -0
- package/dist/shared/components/bulk/BulkFieldUpdate.js +228 -150
- package/dist/shared/components/bulk/BulkFieldUpdateButton.js +35 -41
- package/dist/shared/components/bulk/BulkLinksValue.js +91 -0
- package/dist/shared/components/bulk/bulk-field-options.js +20 -19
- package/dist/shared/components/bulk/bulk-update-preview.js +39 -0
- package/dist/shared/components/cbv/ColumnHeaderMenu.js +113 -0
- package/dist/shared/components/cbv/column-totals.js +66 -0
- package/dist/shared/components/collections-directory/CollectionHoverCard.js +108 -81
- package/dist/shared/components/collections-directory/CollectionRow.js +164 -148
- package/dist/shared/components/collections-directory/CollectionsDirectory.js +167 -166
- package/dist/shared/components/collections-directory/directory-data.js +70 -58
- package/dist/shared/components/imports/CollectionImportPanel.js +120 -118
- package/dist/shared/components/imports/DefinitionsPanel.js +24 -24
- package/dist/shared/components/imports/ImportDuplicatesNotice.js +65 -0
- package/dist/shared/components/item-edit/CatalogPickerField.js +631 -639
- package/dist/shared/components/item-edit/DuplicateNotice.js +168 -0
- package/dist/shared/components/item-edit/FieldRow.js +248 -246
- package/dist/shared/components/item-edit/InlineGridField.js +34 -33
- package/dist/shared/components/item-edit/InlineTableField.js +3064 -2882
- package/dist/shared/components/item-edit/MembershipSetField.js +165 -169
- package/dist/shared/components/item-edit/NestedRelationEditor.js +184 -189
- package/dist/shared/components/item-edit/PlanGrid.js +2 -1
- package/dist/shared/components/item-edit/QuickPickerDialog.js +35 -34
- package/dist/shared/components/item-edit/RecordLiveSync.js +32 -30
- package/dist/shared/components/item-edit/RelationCombobox.js +101 -100
- package/dist/shared/components/item-edit/RowHistorySheet.js +28 -27
- package/dist/shared/components/item-edit/SummaryPanel.js +133 -135
- package/dist/shared/components/item-edit/ViewAsRole.js +129 -52
- package/dist/shared/components/item-edit/grid-search.js +345 -0
- package/dist/shared/components/item-edit/render-stability.js +61 -54
- package/dist/shared/components/notifications/NotificationRulesEditor.js +25 -20
- package/dist/shared/components/ops-report/DigestSections.js +163 -144
- package/dist/shared/components/ops-report/drill.js +97 -97
- package/dist/shared/components/panels/AddendumLinesDiff.js +52 -51
- package/dist/shared/components/panels/AddendumPanel.js +92 -91
- package/dist/shared/components/panels/AsyncUserPicker.js +108 -0
- package/dist/shared/components/panels/CommentPanel.js +265 -252
- package/dist/shared/components/panels/OwnersSlot.js +47 -35
- package/dist/shared/components/panels/PipelineInsight.js +186 -0
- package/dist/shared/components/panels/PipelinePanel.js +1529 -1492
- package/dist/shared/components/panels/RecordIntegrityBanner.js +39 -38
- package/dist/shared/components/panels/RevisionsPanel.js +261 -260
- package/dist/shared/components/pipeline/FieldPicker.js +41 -40
- package/dist/shared/components/pipeline/OwnerMatrix.js +829 -700
- package/dist/shared/components/pipeline/OwnerRecordTrial.js +362 -0
- package/dist/shared/components/pipeline/PipelineEditorView.js +483 -467
- package/dist/shared/components/pipeline/PipelineStateOwners.js +65 -64
- package/dist/shared/components/pipeline/owner-matrix-draft.js +178 -0
- package/dist/shared/components/profile/MyDefaultsCard.js +36 -35
- package/dist/shared/components/profile/PersonHeader.js +29 -29
- package/dist/shared/components/profile/PersonProfile.js +30 -28
- package/dist/shared/components/profile/SlowScreensCard.js +286 -0
- package/dist/shared/components/queue/QueueWorklist.js +1090 -1071
- package/dist/shared/components/quick-filters/useQuickFilterEditing.js +45 -44
- package/dist/shared/components/support/TicketDetailSheet.js +25 -16
- package/dist/shared/components/support/TicketSlowScreens.js +32 -0
- package/dist/shared/lib/activity-sentence.js +224 -178
- package/dist/shared/lib/collection-import-banner.js +27 -0
- package/dist/shared/lib/crash-report.js +112 -0
- package/dist/shared/lib/export-runs.js +99 -0
- package/dist/shared/lib/jobs-tray.js +89 -67
- package/dist/shared/lib/list-link.js +76 -69
- package/dist/shared/lib/nav-trail.js +180 -76
- package/dist/shared/lib/query-keys.js +26 -0
- package/dist/shared/lib/view-as.js +16 -11
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as m, jsx as s, Fragment as ft } from "react/jsx-runtime";
|
|
2
2
|
import { useQuery as I } from "@tanstack/react-query";
|
|
3
|
-
import { ChevronDown as mt, Loader2 as ye, AlertTriangle as
|
|
4
|
-
import { useState as F, useRef as D, useEffect as w, useId as gt, useLayoutEffect as ht, useMemo as
|
|
3
|
+
import { ChevronDown as mt, Loader2 as ye, AlertTriangle as At, Search as Ft, X as Ot, Check as pt } from "lucide-react";
|
|
4
|
+
import { useState as F, useRef as D, useEffect as w, useId as gt, useLayoutEffect as ht, useMemo as A } from "react";
|
|
5
5
|
import { createPortal as xt } from "react-dom";
|
|
6
6
|
import { useNivaroClient as Te, useItemEditAuth as Tt, useStaleFieldReporter as jt } from "../../context.js";
|
|
7
7
|
import { get as G, post as Mt } from "../../lib/commands.js";
|
|
@@ -10,20 +10,21 @@ import { useRecordReader as vt } from "../../lib/record-loader.js";
|
|
|
10
10
|
import { useOnlineUsers as Ut } from "../../lib/use-online-users.js";
|
|
11
11
|
import { SearchHighlight as Ht } from "../SearchHighlight.js";
|
|
12
12
|
import { UserAvatar as Jt } from "../UserAvatar.js";
|
|
13
|
-
import {
|
|
13
|
+
import { queryKeys as zt } from "../../lib/query-keys.js";
|
|
14
|
+
import { userOptionFilter as Yt, matchesAllTokens as Wt, cn as U } from "../../lib/utils.js";
|
|
14
15
|
import { applyDisplayTemplate as k } from "./helpers.js";
|
|
15
|
-
import { collidingIds as
|
|
16
|
-
import { usePickerMissReport as
|
|
17
|
-
import { useLatestSearch as
|
|
16
|
+
import { collidingIds as Gt, disambiguators as Vt, isNamelessLabel as ee, NAMELESS_LABEL as le } from "./option-disambiguate.js";
|
|
17
|
+
import { usePickerMissReport as Xt } from "./picker-miss.js";
|
|
18
|
+
import { useLatestSearch as Zt, onlyCloseMatches as bt, labelOnlyMatches as Qt, narrowLocally as Bt, PICKER_PAGE as en } from "./picker-search.js";
|
|
18
19
|
import { retryRelatedRead as wt, useRelatedMissing as kt, RelatedMissingLabel as Nt } from "./related-missing.js";
|
|
19
|
-
function
|
|
20
|
+
function tn(o) {
|
|
20
21
|
return o.replace(/\(.*$/, "").trim().split(/\s+/).map((r) => r[0]).filter(Boolean).slice(0, 2).join("").toUpperCase() || "?";
|
|
21
22
|
}
|
|
22
|
-
function
|
|
23
|
+
function nn(o) {
|
|
23
24
|
const [r, h] = F(null), g = {
|
|
24
|
-
onMouseEnter: (
|
|
25
|
+
onMouseEnter: (q) => {
|
|
25
26
|
if (!o) return;
|
|
26
|
-
const x =
|
|
27
|
+
const x = q.currentTarget.getBoundingClientRect(), N = window.innerHeight - x.bottom < 80;
|
|
27
28
|
h({ x: x.left, y: N ? x.top - 58 : x.bottom + 4 });
|
|
28
29
|
},
|
|
29
30
|
onMouseLeave: () => h(null)
|
|
@@ -43,16 +44,16 @@ function tn(o) {
|
|
|
43
44
|
function yt(o, r) {
|
|
44
45
|
return o == null || o === "" || r == null || r === "" ? !1 : String(o) === String(r);
|
|
45
46
|
}
|
|
46
|
-
function
|
|
47
|
+
function rn({
|
|
47
48
|
collection: o,
|
|
48
49
|
value: r,
|
|
49
50
|
onChange: h,
|
|
50
51
|
disabled: g,
|
|
51
52
|
placeholder: O,
|
|
52
|
-
extraFilter:
|
|
53
|
+
extraFilter: q,
|
|
53
54
|
autoSelectSingle: x,
|
|
54
55
|
optionSort: N,
|
|
55
|
-
requiredParent:
|
|
56
|
+
requiredParent: C,
|
|
56
57
|
facets: l,
|
|
57
58
|
fieldKey: T,
|
|
58
59
|
narrowedBy: d,
|
|
@@ -62,14 +63,14 @@ function nn({
|
|
|
62
63
|
onClose: je,
|
|
63
64
|
displayTemplate: St
|
|
64
65
|
}) {
|
|
65
|
-
const V = Te(), Me = vt(), [i,
|
|
66
|
+
const V = Te(), Me = vt(), [i, $] = F(xe ?? !1), [c, ce] = F(""), de = D(je);
|
|
66
67
|
de.current = je;
|
|
67
68
|
const Pe = D(i);
|
|
68
69
|
w(() => {
|
|
69
70
|
var e;
|
|
70
71
|
Pe.current && !i && ((e = de.current) == null || e.call(de)), Pe.current = i;
|
|
71
72
|
}, [i]);
|
|
72
|
-
const [Lt, _t] = F(!1), j =
|
|
73
|
+
const [Lt, _t] = F(!1), j = Zt(c, Lt), Ue = D(null), X = D(null), ve = D(null), H = D(null), we = gt(), He = gt(), [Je, J] = F(-1), M = D(null), te = () => {
|
|
73
74
|
var t;
|
|
74
75
|
const e = Ue.current;
|
|
75
76
|
if (!e || document.activeElement === e) return;
|
|
@@ -82,7 +83,7 @@ function nn({
|
|
|
82
83
|
}, [i]);
|
|
83
84
|
const ke = D(!1), Ne = () => {
|
|
84
85
|
var e;
|
|
85
|
-
|
|
86
|
+
$(!1), (e = H.current) == null || e.focus(), ke.current = !0;
|
|
86
87
|
};
|
|
87
88
|
w(() => {
|
|
88
89
|
var n;
|
|
@@ -93,10 +94,10 @@ function nn({
|
|
|
93
94
|
}), w(() => {
|
|
94
95
|
if (!i) return;
|
|
95
96
|
const e = (n) => {
|
|
96
|
-
var E,
|
|
97
|
+
var E, R, ae;
|
|
97
98
|
if (n.key !== "Escape") return;
|
|
98
99
|
const t = document.activeElement;
|
|
99
|
-
(t === document.body || t && ((E = ve.current) != null && E.contains(t) || (
|
|
100
|
+
(t === document.body || t && ((E = ve.current) != null && E.contains(t) || (R = X.current) != null && R.contains(t))) && (n.preventDefault(), n.stopPropagation(), $(!1), (ae = H.current) == null || ae.focus());
|
|
100
101
|
};
|
|
101
102
|
return window.addEventListener("keydown", e, !0), () => window.removeEventListener("keydown", e, !0);
|
|
102
103
|
}, [i]), w(() => {
|
|
@@ -104,7 +105,7 @@ function nn({
|
|
|
104
105
|
const e = (n) => {
|
|
105
106
|
var a, E;
|
|
106
107
|
const t = n.target;
|
|
107
|
-
!t || t === document.body || (a = t.closest) != null && a.call(t, "[data-nvr-combobox-panel]") || (E = X.current) != null && E.contains(t) ||
|
|
108
|
+
!t || t === document.body || (a = t.closest) != null && a.call(t, "[data-nvr-combobox-panel]") || (E = X.current) != null && E.contains(t) || $(!1);
|
|
108
109
|
};
|
|
109
110
|
return document.addEventListener("focusin", e), () => document.removeEventListener("focusin", e);
|
|
110
111
|
}, [i]), w(() => {
|
|
@@ -112,7 +113,7 @@ function nn({
|
|
|
112
113
|
const e = (n) => {
|
|
113
114
|
var a;
|
|
114
115
|
const t = n.target;
|
|
115
|
-
(a = t == null ? void 0 : t.closest) != null && a.call(t, "[data-nvr-combobox-panel]") || X.current && !X.current.contains(n.target) &&
|
|
116
|
+
(a = t == null ? void 0 : t.closest) != null && a.call(t, "[data-nvr-combobox-panel]") || X.current && !X.current.contains(n.target) && $(!1);
|
|
116
117
|
};
|
|
117
118
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
118
119
|
}, [i]);
|
|
@@ -127,16 +128,16 @@ function nn({
|
|
|
127
128
|
if (!n) return;
|
|
128
129
|
const t = n.getBoundingClientRect(), a = n.closest('[role="dialog"]') ?? document.body;
|
|
129
130
|
Et(a);
|
|
130
|
-
const E = window.innerHeight - t.bottom < 340 && t.top > window.innerHeight - t.bottom,
|
|
131
|
+
const E = window.innerHeight - t.bottom < 340 && t.top > window.innerHeight - t.bottom, R = t.left, ae = E ? t.top - 4 : t.bottom + 4, dt = {
|
|
131
132
|
minWidth: t.width,
|
|
132
133
|
zIndex: 120,
|
|
133
134
|
...E ? { transform: "translateY(-100%)" } : {}
|
|
134
135
|
};
|
|
135
136
|
if (a === document.body)
|
|
136
|
-
Le({ position: "fixed", left:
|
|
137
|
+
Le({ position: "fixed", left: R, top: ae, ...dt });
|
|
137
138
|
else {
|
|
138
139
|
const ut = a.getBoundingClientRect();
|
|
139
|
-
Le({ position: "absolute", left:
|
|
140
|
+
Le({ position: "absolute", left: R - ut.left, top: ae - ut.top, ...dt });
|
|
140
141
|
}
|
|
141
142
|
};
|
|
142
143
|
return e(), window.addEventListener("scroll", e, !0), window.addEventListener("resize", e), () => {
|
|
@@ -152,8 +153,8 @@ function nn({
|
|
|
152
153
|
queryFn: () => V.request(G(`/collections/${o}`)).then((e) => e.data),
|
|
153
154
|
staleTime: 3e5,
|
|
154
155
|
retry: !1
|
|
155
|
-
}), [
|
|
156
|
-
queryKey:
|
|
156
|
+
}), [qe, qt] = F({}), { data: We = [] } = I({
|
|
157
|
+
queryKey: zt.collectionRelations(o),
|
|
157
158
|
queryFn: () => V.request(
|
|
158
159
|
G(`/collections/${o}`)
|
|
159
160
|
).then(
|
|
@@ -164,7 +165,7 @@ function nn({
|
|
|
164
165
|
),
|
|
165
166
|
enabled: !!(l != null && l.length),
|
|
166
167
|
staleTime: 10 * 6e4
|
|
167
|
-
}),
|
|
168
|
+
}), Ct = A(() => {
|
|
168
169
|
const e = {};
|
|
169
170
|
for (const n of l ?? []) {
|
|
170
171
|
const t = We.find(
|
|
@@ -173,21 +174,21 @@ function nn({
|
|
|
173
174
|
t != null && t.one_collection && (e[n.field] = t.one_collection);
|
|
174
175
|
}
|
|
175
176
|
return e;
|
|
176
|
-
}, [l, We, o]), Z = o === "nivaro_users",
|
|
177
|
+
}, [l, We, o]), Z = o === "nivaro_users", Rt = Ut(Z), Ge = Tt().isAdmin, Ce = A(() => {
|
|
177
178
|
const e = [];
|
|
178
|
-
Z && e.push(
|
|
179
|
-
for (const [n, t] of Object.entries(
|
|
179
|
+
Z && e.push(Yt(Ge)), q && e.push(q);
|
|
180
|
+
for (const [n, t] of Object.entries(qe))
|
|
180
181
|
t != null && t !== "" && e.push({ [n]: { _eq: t } });
|
|
181
182
|
if (e.length !== 0)
|
|
182
183
|
return e.length === 1 ? e[0] : { _and: e };
|
|
183
|
-
}, [
|
|
184
|
+
}, [q, qe, Ge]), Q = St || (Ee == null ? void 0 : Ee.display_template) || (Z ? "{{first_name}} {{last_name}} ({{email}})" : null), v = A(() => {
|
|
184
185
|
if (!Q) return;
|
|
185
186
|
const e = [...Q.matchAll(/\{\{([\w.]+)\}\}/g)].map((n) => n[1]);
|
|
186
187
|
if (e.length)
|
|
187
188
|
return [.../* @__PURE__ */ new Set(["id", ...e])].join(",");
|
|
188
|
-
}, [Q]), S =
|
|
189
|
+
}, [Q]), S = Ce ? JSON.stringify(Ce) : void 0, z = N && !/^-?label$/.test(N) ? N : void 0, Ve = (e) => V.request(
|
|
189
190
|
G(`/items/${o}`, {
|
|
190
|
-
limit:
|
|
191
|
+
limit: en,
|
|
191
192
|
picker: "1",
|
|
192
193
|
// Typo pass (fix11-search): only when the exact search finds nothing,
|
|
193
194
|
// the server answers close matches, each marked `fuzzy`.
|
|
@@ -199,7 +200,7 @@ function nn({
|
|
|
199
200
|
).then((n) => n.data ?? []), {
|
|
200
201
|
data: u,
|
|
201
202
|
isFetching: Y,
|
|
202
|
-
isPlaceholderData:
|
|
203
|
+
isPlaceholderData: Re
|
|
203
204
|
} = I({
|
|
204
205
|
queryKey: [
|
|
205
206
|
"relation-opts",
|
|
@@ -224,38 +225,38 @@ function nn({
|
|
|
224
225
|
}
|
|
225
226
|
});
|
|
226
227
|
w(() => _t(Y), [Y]);
|
|
227
|
-
const ue = !!j.trim() && c === j && !
|
|
228
|
+
const ue = !!j.trim() && c === j && !Re && !Y && u !== void 0 && (u.length === 0 || bt(u)), { data: fe } = I({
|
|
228
229
|
queryKey: ["relation-opts", o, "", S, v, z ?? ""],
|
|
229
230
|
queryFn: () => Ve(""),
|
|
230
231
|
enabled: i && !Ye && ue,
|
|
231
232
|
staleTime: S ? 0 : 3e4
|
|
232
|
-
}),
|
|
233
|
-
() => ue && fe ?
|
|
233
|
+
}), K = A(
|
|
234
|
+
() => ue && fe ? Qt(
|
|
234
235
|
fe,
|
|
235
236
|
(e) => k(Q, e) || "",
|
|
236
237
|
c
|
|
237
238
|
) : null,
|
|
238
239
|
[ue, fe, Q, c]
|
|
239
|
-
), Xe = ue && fe === void 0, ne = !!u && bt(u) && !(
|
|
240
|
-
|
|
240
|
+
), Xe = ue && fe === void 0, ne = !!u && bt(u) && !(K && K.length > 0);
|
|
241
|
+
Xt({
|
|
241
242
|
placement: y,
|
|
242
243
|
open: i,
|
|
243
244
|
search: j,
|
|
244
|
-
settled: !Y && !
|
|
245
|
-
count: (
|
|
245
|
+
settled: !Y && !Re && u !== void 0 && !Xe,
|
|
246
|
+
count: (K == null ? void 0 : K.length) ?? (u == null ? void 0 : u.length) ?? 0
|
|
246
247
|
});
|
|
247
248
|
const {
|
|
248
249
|
data: re,
|
|
249
250
|
isLoading: Ze,
|
|
250
251
|
error: Qe,
|
|
251
|
-
isFetched:
|
|
252
|
+
isFetched: $t
|
|
252
253
|
} = I({
|
|
253
254
|
queryKey: ["relation-single", o, String(r), v],
|
|
254
255
|
queryFn: () => Me(o, r, v),
|
|
255
256
|
enabled: !!r,
|
|
256
257
|
staleTime: 6e4,
|
|
257
258
|
retry: wt
|
|
258
|
-
}), Be = !!r && !Ze &&
|
|
259
|
+
}), Be = !!r && !Ze && $t && !re, { settling: et } = kt(
|
|
259
260
|
Qe,
|
|
260
261
|
Be ? o : null,
|
|
261
262
|
r
|
|
@@ -266,7 +267,7 @@ function nn({
|
|
|
266
267
|
),
|
|
267
268
|
enabled: !!L && i,
|
|
268
269
|
staleTime: 6e4
|
|
269
|
-
}), Dt = JSON.stringify(
|
|
270
|
+
}), Dt = JSON.stringify(q ? { _and: [{ id: { _eq: r } }, q] } : { id: { _eq: r } }), { data: me } = I({
|
|
270
271
|
queryKey: ["relation-avail", o, String(r), S],
|
|
271
272
|
queryFn: () => V.request(
|
|
272
273
|
G(`/items/${o}`, {
|
|
@@ -281,13 +282,13 @@ function nn({
|
|
|
281
282
|
// the pin is available by construction — never probe it, never flag it.
|
|
282
283
|
enabled: !!r && !!re && String(r) !== L,
|
|
283
284
|
staleTime: 3e4
|
|
284
|
-
}), oe = !!r && String(r) !== L && me !== void 0 && me.length === 0, pe = D(null),
|
|
285
|
-
|
|
285
|
+
}), oe = !!r && String(r) !== L && me !== void 0 && me.length === 0, pe = D(null), $e = D(!1), tt = `${o}|${S ?? ""}`, It = () => {
|
|
286
|
+
$e.current = !0, pe.current = tt, h(null);
|
|
286
287
|
}, ge = r == null || r === "";
|
|
287
288
|
w(() => {
|
|
288
|
-
ge || (
|
|
289
|
+
ge || ($e.current = !1);
|
|
289
290
|
}, [ge]), w(() => {
|
|
290
|
-
if (!x || g || !ge ||
|
|
291
|
+
if (!x || g || !ge || $e.current) return;
|
|
291
292
|
const e = tt;
|
|
292
293
|
pe.current !== e && (pe.current = e, V.request(
|
|
293
294
|
G(`/items/${o}`, {
|
|
@@ -304,8 +305,8 @@ function nn({
|
|
|
304
305
|
pe.current = null;
|
|
305
306
|
}));
|
|
306
307
|
}, [x, g, ge, o, S]);
|
|
307
|
-
const b = Q, De = r && re ? k(b, re) : null, Ie = De === null ? null : ee(De) ? le : De, W = !
|
|
308
|
-
() => (
|
|
308
|
+
const b = Q, De = r && re ? k(b, re) : null, Ie = De === null ? null : ee(De) ? le : De, W = !Re && c === j && !Xe, Ke = A(
|
|
309
|
+
() => (K && (K.length > 0 || !(u != null && u.length)) ? K : null) ?? Bt(
|
|
309
310
|
u ?? [],
|
|
310
311
|
(e) => k(b, e) || `#${e.id}`,
|
|
311
312
|
// The server also reads a joined code by its parts ("2026-NNO-POWER"
|
|
@@ -314,9 +315,9 @@ function nn({
|
|
|
314
315
|
c.replace(/[-_/]+/g, " "),
|
|
315
316
|
W
|
|
316
317
|
),
|
|
317
|
-
[u, b, c, W,
|
|
318
|
-
), he =
|
|
319
|
-
() =>
|
|
318
|
+
[u, b, c, W, K]
|
|
319
|
+
), he = A(
|
|
320
|
+
() => Gt(u ?? [], (e) => k(b, e) || `#${e.id}`),
|
|
320
321
|
[u, b]
|
|
321
322
|
), { data: se } = I({
|
|
322
323
|
queryKey: ["relation-opts-dups", o, he.join(",")],
|
|
@@ -330,7 +331,7 @@ function nn({
|
|
|
330
331
|
).then((e) => e.data ?? []),
|
|
331
332
|
enabled: i && he.length > 0 && !Z,
|
|
332
333
|
staleTime: 6e4
|
|
333
|
-
}), nt =
|
|
334
|
+
}), nt = A(() => {
|
|
334
335
|
if (!(se != null && se.length)) return /* @__PURE__ */ new Map();
|
|
335
336
|
const e = new Map(
|
|
336
337
|
(u ?? []).map((t) => [
|
|
@@ -342,15 +343,15 @@ function nn({
|
|
|
342
343
|
const a = e.get(String(t.id));
|
|
343
344
|
a !== void 0 && n.set(a, [...n.get(a) ?? [], t]);
|
|
344
345
|
}
|
|
345
|
-
return
|
|
346
|
+
return Vt(
|
|
346
347
|
[...n.values()],
|
|
347
348
|
((v == null ? void 0 : v.split(",")) ?? []).map((t) => t.split(".")[0])
|
|
348
349
|
);
|
|
349
|
-
}, [se, u, b, v]),
|
|
350
|
+
}, [se, u, b, v]), Kt = !!r && Ze && !re || et, rt = nn(oe), ot = A(
|
|
350
351
|
() => (u ?? []).some((e) => !ee(k(b, e))),
|
|
351
352
|
[u, b]
|
|
352
|
-
), ie =
|
|
353
|
-
() => (z ? [...
|
|
353
|
+
), ie = A(
|
|
354
|
+
() => (z ? [...Ke] : [...Ke].sort(
|
|
354
355
|
(e, n) => Pt(
|
|
355
356
|
k(b, e),
|
|
356
357
|
k(b, n),
|
|
@@ -360,11 +361,11 @@ function nn({
|
|
|
360
361
|
)).filter((e) => !L || String(e.id) !== L).filter(
|
|
361
362
|
(e) => !ot || String(e.id) === String(r) || !ee(k(b, e))
|
|
362
363
|
),
|
|
363
|
-
[
|
|
364
|
-
), st = P && !ee(k(b, P)) ? k(b, P) : le,
|
|
364
|
+
[Ke, z, b, c, N, L, r, ot]
|
|
365
|
+
), st = P && !ee(k(b, P)) ? k(b, P) : le, Ae = !!L && (!c.trim() || Wt(
|
|
365
366
|
`${P ? st : ""} ${(f == null ? void 0 : f.tag) ?? "Default"}`,
|
|
366
367
|
c.replace(/[-_/]+/g, " ")
|
|
367
|
-
)), B =
|
|
368
|
+
)), B = Ae ? 1 : 0, _ = B + ie.length, p = Je >= _ ? _ - 1 : Je;
|
|
368
369
|
w(() => {
|
|
369
370
|
J(i && c.trim() && !ne ? B : -1);
|
|
370
371
|
}, [i, c, B, ne]);
|
|
@@ -393,21 +394,21 @@ function nn({
|
|
|
393
394
|
}, [i, c, W, p, _]);
|
|
394
395
|
const lt = (e) => {
|
|
395
396
|
var n;
|
|
396
|
-
e.key === "ArrowDown" ? (e.preventDefault(), _ > 0 && J(p < 0 ? 0 : Math.min(p + 1, _ - 1))) : e.key === "ArrowUp" ? (e.preventDefault(), _ > 0 && J(p <= 0 ? 0 : p - 1)) : e.key === "Home" && _ > 0 && !c ? (e.preventDefault(), J(0)) : e.key === "End" && _ > 0 && !c ? (e.preventDefault(), J(_ - 1)) : e.key === "Enter" ? (e.preventDefault(), c.trim() && !W ? M.current = c : p >= 0 ? be(p) : _ === 1 && W && u !== void 0 && !ne && be(0)) : e.key === "Tab" && (
|
|
397
|
+
e.key === "ArrowDown" ? (e.preventDefault(), _ > 0 && J(p < 0 ? 0 : Math.min(p + 1, _ - 1))) : e.key === "ArrowUp" ? (e.preventDefault(), _ > 0 && J(p <= 0 ? 0 : p - 1)) : e.key === "Home" && _ > 0 && !c ? (e.preventDefault(), J(0)) : e.key === "End" && _ > 0 && !c ? (e.preventDefault(), J(_ - 1)) : e.key === "Enter" ? (e.preventDefault(), c.trim() && !W ? M.current = c : p >= 0 ? be(p) : _ === 1 && W && u !== void 0 && !ne && be(0)) : e.key === "Tab" && ($(!1), (n = H.current) == null || n.focus());
|
|
397
398
|
}, ct = (e) => {
|
|
398
399
|
if (g) return;
|
|
399
400
|
const n = e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey && (i || e.key !== " ");
|
|
400
401
|
if (!i && (e.key === "ArrowDown" || e.key === "ArrowUp"))
|
|
401
|
-
e.preventDefault(),
|
|
402
|
+
e.preventDefault(), $(!0);
|
|
402
403
|
else if (n) {
|
|
403
404
|
e.preventDefault();
|
|
404
405
|
const t = e.key;
|
|
405
|
-
M.current = null, ce((a) => t === " " && (a === "" || a.endsWith(" ")) ? a : a + t), i ? te() :
|
|
406
|
+
M.current = null, ce((a) => t === " " && (a === "" || a.endsWith(" ")) ? a : a + t), i ? te() : $(!0);
|
|
406
407
|
} else i && e.key === "Backspace" ? (e.preventDefault(), M.current = null, ce((t) => t.slice(0, -1)), te()) : i && (e.key === "Enter" || e.key === "ArrowDown" || e.key === "ArrowUp" || e.key === "Home" || e.key === "End") && (lt(e), te());
|
|
407
408
|
}, Oe = jt();
|
|
408
409
|
return w(() => {
|
|
409
410
|
!Oe || !T || me === void 0 || Oe(T, oe);
|
|
410
|
-
}, [Oe, T, oe, me]),
|
|
411
|
+
}, [Oe, T, oe, me]), C ? /* @__PURE__ */ m(
|
|
411
412
|
"button",
|
|
412
413
|
{
|
|
413
414
|
type: "button",
|
|
@@ -416,7 +417,7 @@ function nn({
|
|
|
416
417
|
children: [
|
|
417
418
|
/* @__PURE__ */ m("span", { className: "truncate text-muted-foreground", children: [
|
|
418
419
|
"Select ",
|
|
419
|
-
|
|
420
|
+
C,
|
|
420
421
|
" first"
|
|
421
422
|
] }),
|
|
422
423
|
/* @__PURE__ */ s(mt, { className: "h-4 w-4 shrink-0 opacity-50" })
|
|
@@ -440,7 +441,7 @@ function nn({
|
|
|
440
441
|
{
|
|
441
442
|
"data-related-unavailable-field": "",
|
|
442
443
|
onClick: g ? void 0 : (e) => {
|
|
443
|
-
e.target.closest("button") ||
|
|
444
|
+
e.target.closest("button") || $((n) => !n);
|
|
444
445
|
},
|
|
445
446
|
className: U(
|
|
446
447
|
"flex h-9 w-full items-center gap-2 rounded-md border border-slate-200 bg-slate-50 px-3 text-sm dark:border-border dark:bg-muted/40",
|
|
@@ -464,7 +465,7 @@ function nn({
|
|
|
464
465
|
"aria-haspopup": "listbox",
|
|
465
466
|
"aria-expanded": i,
|
|
466
467
|
"aria-describedby": He,
|
|
467
|
-
onClick: () =>
|
|
468
|
+
onClick: () => $((e) => !e),
|
|
468
469
|
onKeyDown: ct,
|
|
469
470
|
className: "-mr-1 shrink-0 rounded border border-slate-300 px-2 py-0.5 text-[11px] font-medium text-slate-700 hover:bg-slate-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/60 dark:border-slate-600",
|
|
470
471
|
children: "Change"
|
|
@@ -481,14 +482,14 @@ function nn({
|
|
|
481
482
|
disabled: g,
|
|
482
483
|
"aria-haspopup": "listbox",
|
|
483
484
|
"aria-expanded": i,
|
|
484
|
-
onClick: () =>
|
|
485
|
+
onClick: () => $((e) => !e),
|
|
485
486
|
onKeyDown: ct,
|
|
486
487
|
className: U(
|
|
487
488
|
"flex h-9 w-full items-center justify-between gap-2 rounded-md border bg-background px-3 text-sm text-left hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/60 disabled:pointer-events-none disabled:opacity-50",
|
|
488
489
|
oe ? "border-amber-300 dark:border-amber-600" : "border-input"
|
|
489
490
|
),
|
|
490
491
|
children: [
|
|
491
|
-
|
|
492
|
+
Kt ? /* @__PURE__ */ s(ye, { className: "h-3.5 w-3.5 animate-spin text-muted-foreground" }) : /* @__PURE__ */ m(
|
|
492
493
|
"span",
|
|
493
494
|
{
|
|
494
495
|
className: U(
|
|
@@ -498,7 +499,7 @@ function nn({
|
|
|
498
499
|
children: [
|
|
499
500
|
oe && /* @__PURE__ */ m(ft, { children: [
|
|
500
501
|
/* @__PURE__ */ s(
|
|
501
|
-
|
|
502
|
+
At,
|
|
502
503
|
{
|
|
503
504
|
"aria-hidden": "true",
|
|
504
505
|
className: "h-3.5 w-3.5 shrink-0 text-amber-500"
|
|
@@ -528,15 +529,15 @@ function nn({
|
|
|
528
529
|
),
|
|
529
530
|
children: [
|
|
530
531
|
!!(l != null && l.length) && /* @__PURE__ */ s("div", { className: "grid grid-cols-2 gap-2 border-b border-border bg-slate-50/60 p-2 dark:bg-muted/40", children: l.map((e) => {
|
|
531
|
-
const n =
|
|
532
|
+
const n = Ct[e.field];
|
|
532
533
|
return n ? /* @__PURE__ */ m("div", { children: [
|
|
533
534
|
/* @__PURE__ */ s("p", { className: "mb-0.5 text-[10px] font-medium uppercase tracking-wide text-slate-400", children: e.label ?? e.field }),
|
|
534
535
|
/* @__PURE__ */ s(
|
|
535
|
-
|
|
536
|
+
rn,
|
|
536
537
|
{
|
|
537
538
|
collection: n,
|
|
538
|
-
value:
|
|
539
|
-
onChange: (t) =>
|
|
539
|
+
value: qe[e.field] ?? null,
|
|
540
|
+
onChange: (t) => qt((a) => ({ ...a, [e.field]: t })),
|
|
540
541
|
placeholder: "Any",
|
|
541
542
|
optionSort: e.sort,
|
|
542
543
|
extraFilter: e.filter
|
|
@@ -588,7 +589,7 @@ function nn({
|
|
|
588
589
|
]
|
|
589
590
|
}
|
|
590
591
|
),
|
|
591
|
-
|
|
592
|
+
Ae && /* @__PURE__ */ m(
|
|
592
593
|
"button",
|
|
593
594
|
{
|
|
594
595
|
type: "button",
|
|
@@ -620,7 +621,7 @@ function nn({
|
|
|
620
621
|
]
|
|
621
622
|
}
|
|
622
623
|
),
|
|
623
|
-
u === void 0 && Y ? /* @__PURE__ */ s("div", { className: "flex items-center justify-center py-4", children: /* @__PURE__ */ s(ye, { className: "h-4 w-4 animate-spin text-muted-foreground" }) }) : ie.length === 0 && !W ? /* @__PURE__ */ s("p", { className: "px-3 py-2 text-[13px] text-muted-foreground", children: "Searching…" }) : ie.length === 0 ?
|
|
624
|
+
u === void 0 && Y ? /* @__PURE__ */ s("div", { className: "flex items-center justify-center py-4", children: /* @__PURE__ */ s(ye, { className: "h-4 w-4 animate-spin text-muted-foreground" }) }) : ie.length === 0 && !W ? /* @__PURE__ */ s("p", { className: "px-3 py-2 text-[13px] text-muted-foreground", children: "Searching…" }) : ie.length === 0 ? Ae && c.trim() ? null : d && d.labels.length > 0 && !c.trim() ? /* @__PURE__ */ m("div", { className: "px-3 py-2 text-[12px] leading-5 text-muted-foreground", children: [
|
|
624
625
|
/* @__PURE__ */ m("p", { children: [
|
|
625
626
|
"No options for",
|
|
626
627
|
" ",
|
|
@@ -659,21 +660,21 @@ function nn({
|
|
|
659
660
|
}
|
|
660
661
|
),
|
|
661
662
|
ie.map((e, n) => {
|
|
662
|
-
const t = k(b, e), a = ee(t) ? le : t, E = String(e.id) === String(r),
|
|
663
|
+
const t = k(b, e), a = ee(t) ? le : t, E = String(e.id) === String(r), R = n + B;
|
|
663
664
|
return /* @__PURE__ */ m(
|
|
664
665
|
"button",
|
|
665
666
|
{
|
|
666
667
|
type: "button",
|
|
667
668
|
tabIndex: -1,
|
|
668
|
-
id: Fe(
|
|
669
|
+
id: Fe(R),
|
|
669
670
|
role: "option",
|
|
670
671
|
"aria-selected": E,
|
|
671
|
-
"data-nav-index":
|
|
672
|
+
"data-nav-index": R,
|
|
672
673
|
onClick: () => at(e),
|
|
673
|
-
onMouseMove: () => p !==
|
|
674
|
+
onMouseMove: () => p !== R && J(R),
|
|
674
675
|
className: U(
|
|
675
676
|
"flex w-full items-center gap-2 px-3 py-1.5 text-[13px] text-left hover:bg-muted",
|
|
676
|
-
p ===
|
|
677
|
+
p === R && "bg-muted"
|
|
677
678
|
),
|
|
678
679
|
children: [
|
|
679
680
|
/* @__PURE__ */ s(
|
|
@@ -691,10 +692,10 @@ function nn({
|
|
|
691
692
|
{
|
|
692
693
|
userId: e.id,
|
|
693
694
|
className: "h-4 w-4",
|
|
694
|
-
fallback: /* @__PURE__ */ s("span", { className: "flex h-4 w-4 shrink-0 items-center justify-center rounded-full bg-nvr-cyan/20 text-[8px] font-bold text-nvr-navy dark:text-nvr-cyan", children:
|
|
695
|
+
fallback: /* @__PURE__ */ s("span", { className: "flex h-4 w-4 shrink-0 items-center justify-center rounded-full bg-nvr-cyan/20 text-[8px] font-bold text-nvr-navy dark:text-nvr-cyan", children: tn(a) })
|
|
695
696
|
}
|
|
696
697
|
),
|
|
697
|
-
Z &&
|
|
698
|
+
Z && Rt.has(String(e.id).toUpperCase()) && /* @__PURE__ */ s(
|
|
698
699
|
"span",
|
|
699
700
|
{
|
|
700
701
|
className: "h-1.5 w-1.5 shrink-0 rounded-full bg-emerald-500",
|
|
@@ -718,11 +719,11 @@ function nn({
|
|
|
718
719
|
] })
|
|
719
720
|
] }),
|
|
720
721
|
!Y && /* @__PURE__ */ s(
|
|
721
|
-
|
|
722
|
+
on,
|
|
722
723
|
{
|
|
723
724
|
collection: o,
|
|
724
725
|
search: j,
|
|
725
|
-
filter:
|
|
726
|
+
filter: Ce,
|
|
726
727
|
narrowedLabels: (d == null ? void 0 : d.labels) ?? [],
|
|
727
728
|
auto: (u ?? []).length === 0 && !!j
|
|
728
729
|
}
|
|
@@ -735,16 +736,16 @@ function nn({
|
|
|
735
736
|
] })
|
|
736
737
|
);
|
|
737
738
|
}
|
|
738
|
-
function
|
|
739
|
+
function on({
|
|
739
740
|
collection: o,
|
|
740
741
|
search: r,
|
|
741
742
|
filter: h,
|
|
742
743
|
narrowedLabels: g,
|
|
743
744
|
auto: O
|
|
744
745
|
}) {
|
|
745
|
-
const
|
|
746
|
-
queryKey: ["picker-narrowing", o, r,
|
|
747
|
-
queryFn: () =>
|
|
746
|
+
const q = Te(), [x, N] = F(!1), C = h ? JSON.stringify(h) : "", { data: l, isFetching: T } = I({
|
|
747
|
+
queryKey: ["picker-narrowing", o, r, C],
|
|
748
|
+
queryFn: () => q.request(
|
|
748
749
|
Mt("/picker-narrowing", { collection: o, search: r, filter: h ?? null })
|
|
749
750
|
).then((y) => y.data),
|
|
750
751
|
enabled: x || O,
|
|
@@ -785,17 +786,17 @@ function rn({
|
|
|
785
786
|
}
|
|
786
787
|
);
|
|
787
788
|
}
|
|
788
|
-
function
|
|
789
|
+
function Ln({
|
|
789
790
|
collection: o,
|
|
790
791
|
id: r,
|
|
791
792
|
displayTemplate: h,
|
|
792
793
|
explainMissing: g
|
|
793
794
|
}) {
|
|
794
|
-
const O = Te(),
|
|
795
|
+
const O = Te(), q = vt(), x = o === "nivaro_files" || o === "directus_files", N = (() => {
|
|
795
796
|
if (!h || !h.includes(".")) return null;
|
|
796
797
|
const y = [...h.matchAll(/\{\{([^}]+)\}\}/g)].map((xe) => xe[1].trim());
|
|
797
798
|
return y.length > 0 ? ["id", ...y].join(",") : null;
|
|
798
|
-
})(), { data:
|
|
799
|
+
})(), { data: C, isLoading: l, error: T } = I({
|
|
799
800
|
queryKey: ["relation-single", o, String(r), N ?? ""],
|
|
800
801
|
queryFn: () => x ? (
|
|
801
802
|
// The file's row, not its bytes: GET /files/:id downloads the whole
|
|
@@ -804,17 +805,17 @@ function Nn({
|
|
|
804
805
|
O.request(
|
|
805
806
|
G(`/files/${encodeURIComponent(String(r))}/meta`)
|
|
806
807
|
).then((y) => y.data)
|
|
807
|
-
) :
|
|
808
|
+
) : q(o, r, N),
|
|
808
809
|
enabled: !!r && !!o,
|
|
809
810
|
staleTime: 6e4,
|
|
810
811
|
retry: wt
|
|
811
812
|
}), { settling: d } = kt(
|
|
812
813
|
T,
|
|
813
|
-
g && !l &&
|
|
814
|
+
g && !l && !C ? o : null,
|
|
814
815
|
r
|
|
815
816
|
);
|
|
816
817
|
if (l || d) return /* @__PURE__ */ s(ye, { className: "h-3 w-3 animate-spin text-slate-400" });
|
|
817
|
-
if (
|
|
818
|
+
if (!C)
|
|
818
819
|
return r == null || r === "" ? null : /* @__PURE__ */ s(
|
|
819
820
|
Nt,
|
|
820
821
|
{
|
|
@@ -824,15 +825,15 @@ function Nn({
|
|
|
824
825
|
}
|
|
825
826
|
);
|
|
826
827
|
if (x) {
|
|
827
|
-
const y =
|
|
828
|
+
const y = C.title || C.filename_download || C.filename_disk || String(r);
|
|
828
829
|
return /* @__PURE__ */ s("span", { children: y });
|
|
829
830
|
}
|
|
830
|
-
const f = k(h,
|
|
831
|
+
const f = k(h, C);
|
|
831
832
|
return ee(f) ? /* @__PURE__ */ s("span", { className: "italic text-muted-foreground", children: le }) : /* @__PURE__ */ s("span", { children: f });
|
|
832
833
|
}
|
|
833
834
|
export {
|
|
834
|
-
|
|
835
|
-
|
|
835
|
+
Ln as RelatedItemLabel,
|
|
836
|
+
rn as RelationCombobox,
|
|
836
837
|
yt as isSamePick,
|
|
837
|
-
|
|
838
|
+
nn as useStaleTip
|
|
838
839
|
};
|