@nivaro/react 0.3.65 → 0.3.67
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 +21 -5
- package/dist/shared/components/ActivityEntry.js +28 -28
- package/dist/shared/components/CollectionBrowserView.js +2432 -2592
- package/dist/shared/components/ItemEditForm.js +3912 -3773
- package/dist/shared/components/MyWorkView.js +124 -113
- package/dist/shared/components/ProfileView.js +483 -472
- package/dist/shared/components/RecordCompare.js +149 -129
- package/dist/shared/components/ReportView.js +1100 -1094
- package/dist/shared/components/bulk/BulkCompareButton.js +62 -0
- package/dist/shared/components/bulk/MessageStakeholders.js +235 -0
- package/dist/shared/components/integrations/IntegrationObligationsView.js +199 -187
- package/dist/shared/components/integrations/console/EventsView.js +22 -24
- package/dist/shared/components/integrations/console/SubmissionRow.js +6 -13
- package/dist/shared/components/integrations/console/drill/SubmissionDrill.js +29 -28
- package/dist/shared/components/integrations/console/tone.js +22 -21
- package/dist/shared/components/item-edit/CatalogPickerField.js +240 -238
- package/dist/shared/components/item-edit/FieldRow.js +193 -193
- package/dist/shared/components/item-edit/GroupSection.js +559 -542
- package/dist/shared/components/item-edit/M2MCombobox.js +414 -349
- package/dist/shared/components/item-edit/MidairCollisionDialog.js +211 -187
- package/dist/shared/components/item-edit/RecordInsights.js +46 -45
- package/dist/shared/components/item-edit/RelationCombobox.js +327 -311
- package/dist/shared/components/item-edit/SummaryPanel.js +146 -144
- package/dist/shared/components/item-edit/UserChip.js +264 -229
- package/dist/shared/components/item-edit/cascade-clear-notice.js +23 -19
- package/dist/shared/components/item-edit/header-path-preview.js +52 -0
- package/dist/shared/components/item-edit/line-merge.js +73 -47
- package/dist/shared/components/item-edit/picker-search.js +25 -21
- package/dist/shared/components/panels/BranchLanes.js +7 -7
- package/dist/shared/components/panels/CommentPanel.js +72 -72
- package/dist/shared/components/panels/PipelinePanel.js +261 -261
- package/dist/shared/components/panels/RecordIntegrityBanner.js +78 -78
- package/dist/shared/components/panels/RevisionsPanel.js +220 -220
- package/dist/shared/components/panels/TaskPanel.js +75 -75
- package/dist/shared/components/queue/QueueWorklist.js +1007 -979
- package/dist/shared/lib/compare-value.js +73 -0
- package/dist/shared/lib/format-value.js +19 -18
- package/dist/shared/lib/obligation-reason-text.js +1 -1
- package/dist/shared/lib/quick-filter-cascade.js +29 -19
- package/dist/shared/lib/utils.js +59 -57
- package/package.json +1 -1
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as p, jsx as s, Fragment as st } from "react/jsx-runtime";
|
|
2
2
|
import { useQuery as q } from "@tanstack/react-query";
|
|
3
|
-
import { ChevronDown as
|
|
4
|
-
import { useState as
|
|
5
|
-
import { createPortal as
|
|
6
|
-
import { useNivaroClient as
|
|
7
|
-
import { get as
|
|
8
|
-
import { compareByMatch as
|
|
9
|
-
import { useRecordReader as
|
|
10
|
-
import { useOnlineUsers as
|
|
11
|
-
import { SearchHighlight as
|
|
12
|
-
import { UserAvatar as
|
|
13
|
-
import { userOptionFilter as
|
|
3
|
+
import { ChevronDown as it, Loader2 as ye, AlertTriangle as Ct, Search as Rt, X as Dt, Check as at } from "lucide-react";
|
|
4
|
+
import { useState as A, useRef as R, useEffect as E, useId as At, useLayoutEffect as lt, useMemo as D } from "react";
|
|
5
|
+
import { createPortal as ut } from "react-dom";
|
|
6
|
+
import { useNivaroClient as Fe, useItemEditAuth as It, useStaleFieldReporter as Kt } from "../../context.js";
|
|
7
|
+
import { get as Y, post as Ft } from "../../lib/commands.js";
|
|
8
|
+
import { compareByMatch as Mt } from "../../lib/picker-rank.js";
|
|
9
|
+
import { useRecordReader as ft } from "../../lib/record-loader.js";
|
|
10
|
+
import { useOnlineUsers as Ot } from "../../lib/use-online-users.js";
|
|
11
|
+
import { SearchHighlight as Tt } from "../SearchHighlight.js";
|
|
12
|
+
import { UserAvatar as jt } from "../UserAvatar.js";
|
|
13
|
+
import { userOptionFilter as Pt, matchesAllTokens as Ut, cn as z } from "../../lib/utils.js";
|
|
14
14
|
import { applyDisplayTemplate as v } from "./helpers.js";
|
|
15
|
-
import { collidingIds as
|
|
16
|
-
import { usePickerMissReport as
|
|
17
|
-
import { useLatestSearch as
|
|
18
|
-
import { retryRelatedRead as
|
|
19
|
-
function
|
|
15
|
+
import { collidingIds as Ht, disambiguators as Jt, isNamelessLabel as B, NAMELESS_LABEL as le } from "./option-disambiguate.js";
|
|
16
|
+
import { usePickerMissReport as zt } from "./picker-miss.js";
|
|
17
|
+
import { useLatestSearch as Yt, onlyCloseMatches as ct, labelOnlyMatches as Wt, narrowLocally as Gt, PICKER_PAGE as Vt } from "./picker-search.js";
|
|
18
|
+
import { retryRelatedRead as mt, RelatedMissingLabel as pt } from "./related-missing.js";
|
|
19
|
+
function Xt(o) {
|
|
20
20
|
return o.replace(/\(.*$/, "").trim().split(/\s+/).map((r) => r[0]).filter(Boolean).slice(0, 2).join("").toUpperCase() || "?";
|
|
21
21
|
}
|
|
22
|
-
function
|
|
23
|
-
const [r,
|
|
22
|
+
function Zt(o) {
|
|
23
|
+
const [r, g] = A(null), w = {
|
|
24
24
|
onMouseEnter: (k) => {
|
|
25
25
|
if (!o) return;
|
|
26
26
|
const y = k.currentTarget.getBoundingClientRect(), b = window.innerHeight - y.bottom < 80;
|
|
27
|
-
|
|
27
|
+
g({ x: y.left, y: b ? y.top - 58 : y.bottom + 4 });
|
|
28
28
|
},
|
|
29
|
-
onMouseLeave: () =>
|
|
30
|
-
},
|
|
29
|
+
onMouseLeave: () => g(null)
|
|
30
|
+
}, I = o && r ? ut(
|
|
31
31
|
/* @__PURE__ */ s(
|
|
32
32
|
"div",
|
|
33
33
|
{
|
|
@@ -38,38 +38,38 @@ function Vt(o) {
|
|
|
38
38
|
),
|
|
39
39
|
document.body
|
|
40
40
|
) : null;
|
|
41
|
-
return { bind: w, tip:
|
|
41
|
+
return { bind: w, tip: I };
|
|
42
42
|
}
|
|
43
|
-
function
|
|
43
|
+
function dt(o, r) {
|
|
44
44
|
return o == null || o === "" || r == null || r === "" ? !1 : String(o) === String(r);
|
|
45
45
|
}
|
|
46
|
-
function
|
|
46
|
+
function Qt({
|
|
47
47
|
collection: o,
|
|
48
48
|
value: r,
|
|
49
|
-
onChange:
|
|
49
|
+
onChange: g,
|
|
50
50
|
disabled: w,
|
|
51
|
-
placeholder:
|
|
51
|
+
placeholder: I,
|
|
52
52
|
extraFilter: k,
|
|
53
53
|
autoSelectSingle: y,
|
|
54
54
|
optionSort: b,
|
|
55
|
-
requiredParent:
|
|
55
|
+
requiredParent: W,
|
|
56
56
|
facets: c,
|
|
57
|
-
fieldKey:
|
|
57
|
+
fieldKey: K,
|
|
58
58
|
narrowedBy: l,
|
|
59
59
|
pinned: f,
|
|
60
|
-
missPlacement:
|
|
61
|
-
defaultOpen:
|
|
62
|
-
onClose:
|
|
63
|
-
displayTemplate:
|
|
60
|
+
missPlacement: F,
|
|
61
|
+
defaultOpen: gt,
|
|
62
|
+
onClose: Me,
|
|
63
|
+
displayTemplate: ht
|
|
64
64
|
}) {
|
|
65
|
-
const
|
|
66
|
-
|
|
65
|
+
const G = Fe(), Oe = ft(), [a, M] = A(gt ?? !1), [d, ce] = A(""), de = R(Me);
|
|
66
|
+
de.current = Me;
|
|
67
67
|
const Te = R(a);
|
|
68
68
|
E(() => {
|
|
69
69
|
var e;
|
|
70
|
-
Te.current && !a && ((e =
|
|
70
|
+
Te.current && !a && ((e = de.current) == null || e.call(de)), Te.current = a;
|
|
71
71
|
}, [a]);
|
|
72
|
-
const [
|
|
72
|
+
const [bt, yt] = A(!1), O = Yt(d, bt), je = R(null), V = R(null), xe = R(null), ee = R(null), ve = At(), [Pe, P] = A(-1), T = R(null), te = () => {
|
|
73
73
|
var t;
|
|
74
74
|
const e = je.current;
|
|
75
75
|
if (!e || document.activeElement === e) return;
|
|
@@ -78,19 +78,19 @@ function Xt({
|
|
|
78
78
|
(t = e.setSelectionRange) == null || t.call(e, n, n);
|
|
79
79
|
};
|
|
80
80
|
E(() => {
|
|
81
|
-
a ? setTimeout(
|
|
81
|
+
a ? setTimeout(te, 30) : (ce(""), T.current = null);
|
|
82
82
|
}, [a]);
|
|
83
|
-
const
|
|
83
|
+
const we = () => {
|
|
84
84
|
var e;
|
|
85
|
-
|
|
85
|
+
M(!1), (e = ee.current) == null || e.focus();
|
|
86
86
|
};
|
|
87
87
|
E(() => {
|
|
88
88
|
if (!a) return;
|
|
89
89
|
const e = (n) => {
|
|
90
|
-
var _, $,
|
|
90
|
+
var _, $, ae;
|
|
91
91
|
if (n.key !== "Escape") return;
|
|
92
92
|
const t = document.activeElement;
|
|
93
|
-
(t === document.body || t && ((_ =
|
|
93
|
+
(t === document.body || t && ((_ = xe.current) != null && _.contains(t) || ($ = V.current) != null && $.contains(t))) && (n.preventDefault(), n.stopPropagation(), M(!1), (ae = ee.current) == null || ae.focus());
|
|
94
94
|
};
|
|
95
95
|
return window.addEventListener("keydown", e, !0), () => window.removeEventListener("keydown", e, !0);
|
|
96
96
|
}, [a]), E(() => {
|
|
@@ -98,7 +98,7 @@ function Xt({
|
|
|
98
98
|
const e = (n) => {
|
|
99
99
|
var i, _;
|
|
100
100
|
const t = n.target;
|
|
101
|
-
!t || t === document.body || (i = t.closest) != null && i.call(t, "[data-nvr-combobox-panel]") || (_ =
|
|
101
|
+
!t || t === document.body || (i = t.closest) != null && i.call(t, "[data-nvr-combobox-panel]") || (_ = V.current) != null && _.contains(t) || M(!1);
|
|
102
102
|
};
|
|
103
103
|
return document.addEventListener("focusin", e), () => document.removeEventListener("focusin", e);
|
|
104
104
|
}, [a]), E(() => {
|
|
@@ -106,50 +106,50 @@ function Xt({
|
|
|
106
106
|
const e = (n) => {
|
|
107
107
|
var i;
|
|
108
108
|
const t = n.target;
|
|
109
|
-
(i = t == null ? void 0 : t.closest) != null && i.call(t, "[data-nvr-combobox-panel]") ||
|
|
109
|
+
(i = t == null ? void 0 : t.closest) != null && i.call(t, "[data-nvr-combobox-panel]") || V.current && !V.current.contains(n.target) && M(!1);
|
|
110
110
|
};
|
|
111
111
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
112
112
|
}, [a]);
|
|
113
|
-
const [
|
|
114
|
-
|
|
113
|
+
const [ke, Ne] = A(null), [Se, xt] = A(null);
|
|
114
|
+
lt(() => {
|
|
115
115
|
if (!a) {
|
|
116
|
-
|
|
116
|
+
Ne(null);
|
|
117
117
|
return;
|
|
118
118
|
}
|
|
119
119
|
const e = () => {
|
|
120
|
-
const n =
|
|
120
|
+
const n = V.current;
|
|
121
121
|
if (!n) return;
|
|
122
122
|
const t = n.getBoundingClientRect(), i = n.closest('[role="dialog"]') ?? document.body;
|
|
123
|
-
|
|
124
|
-
const _ = window.innerHeight - t.bottom < 340 && t.top > window.innerHeight - t.bottom, $ = t.left,
|
|
123
|
+
xt(i);
|
|
124
|
+
const _ = window.innerHeight - t.bottom < 340 && t.top > window.innerHeight - t.bottom, $ = t.left, ae = _ ? t.top - 4 : t.bottom + 4, rt = {
|
|
125
125
|
minWidth: t.width,
|
|
126
126
|
zIndex: 120,
|
|
127
127
|
..._ ? { transform: "translateY(-100%)" } : {}
|
|
128
128
|
};
|
|
129
129
|
if (i === document.body)
|
|
130
|
-
|
|
130
|
+
Ne({ position: "fixed", left: $, top: ae, ...rt });
|
|
131
131
|
else {
|
|
132
|
-
const
|
|
133
|
-
|
|
132
|
+
const ot = i.getBoundingClientRect();
|
|
133
|
+
Ne({ position: "absolute", left: $ - ot.left, top: ae - ot.top, ...rt });
|
|
134
134
|
}
|
|
135
135
|
};
|
|
136
136
|
return e(), window.addEventListener("scroll", e, !0), window.addEventListener("resize", e), () => {
|
|
137
137
|
window.removeEventListener("scroll", e, !0), window.removeEventListener("resize", e);
|
|
138
138
|
};
|
|
139
139
|
}, [a]);
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
}, [
|
|
144
|
-
const { data:
|
|
140
|
+
const Ue = a && !!ke && !!Se;
|
|
141
|
+
lt(() => {
|
|
142
|
+
Ue && document.activeElement === ee.current && te();
|
|
143
|
+
}, [Ue]);
|
|
144
|
+
const { data: Le, isPending: He } = q({
|
|
145
145
|
queryKey: ["col-meta", o],
|
|
146
|
-
queryFn: () =>
|
|
146
|
+
queryFn: () => G.request(Y(`/collections/${o}`)).then((e) => e.data),
|
|
147
147
|
staleTime: 3e5,
|
|
148
148
|
retry: !1
|
|
149
|
-
}), [
|
|
149
|
+
}), [_e, vt] = A({}), { data: Je = [] } = q({
|
|
150
150
|
queryKey: ["collection-meta", o],
|
|
151
|
-
queryFn: () =>
|
|
152
|
-
|
|
151
|
+
queryFn: () => G.request(
|
|
152
|
+
Y(`/collections/${o}`)
|
|
153
153
|
).then(
|
|
154
154
|
(e) => {
|
|
155
155
|
var n;
|
|
@@ -158,40 +158,42 @@ function Xt({
|
|
|
158
158
|
),
|
|
159
159
|
enabled: !!(c != null && c.length),
|
|
160
160
|
staleTime: 10 * 6e4
|
|
161
|
-
}),
|
|
161
|
+
}), wt = D(() => {
|
|
162
162
|
const e = {};
|
|
163
163
|
for (const n of c ?? []) {
|
|
164
|
-
const t =
|
|
164
|
+
const t = Je.find(
|
|
165
165
|
(i) => i.many_collection === o && i.many_field === n.field && !i.junction_field
|
|
166
166
|
);
|
|
167
167
|
t != null && t.one_collection && (e[n.field] = t.one_collection);
|
|
168
168
|
}
|
|
169
169
|
return e;
|
|
170
|
-
}, [c,
|
|
170
|
+
}, [c, Je, o]), X = o === "nivaro_users", kt = Ot(X), ze = It().isAdmin, Ee = D(() => {
|
|
171
171
|
const e = [];
|
|
172
|
-
|
|
173
|
-
for (const [n, t] of Object.entries(
|
|
172
|
+
X && e.push(Pt(ze)), k && e.push(k);
|
|
173
|
+
for (const [n, t] of Object.entries(_e))
|
|
174
174
|
t != null && t !== "" && e.push({ [n]: { _eq: t } });
|
|
175
175
|
if (e.length !== 0)
|
|
176
176
|
return e.length === 1 ? e[0] : { _and: e };
|
|
177
|
-
}, [k,
|
|
178
|
-
if (!
|
|
179
|
-
const e = [...
|
|
177
|
+
}, [k, _e, ze]), Z = ht || (Le == null ? void 0 : Le.display_template) || (X ? "{{first_name}} {{last_name}} ({{email}})" : null), x = D(() => {
|
|
178
|
+
if (!Z) return;
|
|
179
|
+
const e = [...Z.matchAll(/\{\{([\w.]+)\}\}/g)].map((n) => n[1]);
|
|
180
180
|
if (e.length)
|
|
181
181
|
return [.../* @__PURE__ */ new Set(["id", ...e])].join(",");
|
|
182
|
-
}, [
|
|
183
|
-
|
|
184
|
-
limit:
|
|
182
|
+
}, [Z]), N = Ee ? JSON.stringify(Ee) : void 0, U = b && !/^-?label$/.test(b) ? b : void 0, Ye = (e) => G.request(
|
|
183
|
+
Y(`/items/${o}`, {
|
|
184
|
+
limit: Vt,
|
|
185
185
|
picker: "1",
|
|
186
|
-
|
|
186
|
+
// Typo pass (fix11-search): only when the exact search finds nothing,
|
|
187
|
+
// the server answers close matches, each marked `fuzzy`.
|
|
188
|
+
...e.trim() ? { search: e.trim(), typo: "1" } : {},
|
|
187
189
|
...N ? { filter: N } : {},
|
|
188
190
|
...x ? { fields: x } : {},
|
|
189
|
-
...
|
|
191
|
+
...U ? { sort: U } : {}
|
|
190
192
|
})
|
|
191
193
|
).then((n) => n.data ?? []), {
|
|
192
194
|
data: u,
|
|
193
|
-
isFetching:
|
|
194
|
-
isPlaceholderData:
|
|
195
|
+
isFetching: H,
|
|
196
|
+
isPlaceholderData: $e
|
|
195
197
|
} = q({
|
|
196
198
|
queryKey: [
|
|
197
199
|
"relation-opts",
|
|
@@ -199,12 +201,12 @@ function Xt({
|
|
|
199
201
|
O,
|
|
200
202
|
N,
|
|
201
203
|
x,
|
|
202
|
-
|
|
204
|
+
U ?? ""
|
|
203
205
|
],
|
|
204
|
-
queryFn: () =>
|
|
206
|
+
queryFn: () => Ye(O),
|
|
205
207
|
// Wait for the display template: it decides `fields`, and starting before
|
|
206
208
|
// it lands sent the whole first page twice.
|
|
207
|
-
enabled: a && !
|
|
209
|
+
enabled: a && !He,
|
|
208
210
|
staleTime: N ? 0 : 3e4,
|
|
209
211
|
// A new SEARCH keeps the previous answer on screen (narrowed locally below)
|
|
210
212
|
// instead of blanking the list behind a spinner. A changed filter, sort or
|
|
@@ -212,53 +214,53 @@ function Xt({
|
|
|
212
214
|
placeholderData: (e, n) => {
|
|
213
215
|
const t = n == null ? void 0 : n.queryKey;
|
|
214
216
|
if (!(!e || !t))
|
|
215
|
-
return t[1] === o && t[3] === N && t[4] === x && t[5] === (
|
|
217
|
+
return t[1] === o && t[3] === N && t[4] === x && t[5] === (U ?? "") ? e : void 0;
|
|
216
218
|
}
|
|
217
219
|
});
|
|
218
|
-
E(() =>
|
|
219
|
-
const
|
|
220
|
-
queryKey: ["relation-opts", o, "", N, x,
|
|
221
|
-
queryFn: () =>
|
|
222
|
-
enabled: a && !
|
|
220
|
+
E(() => yt(H), [H]);
|
|
221
|
+
const ue = !!O.trim() && d === O && !$e && !H && u !== void 0 && (u.length === 0 || ct(u)), { data: fe } = q({
|
|
222
|
+
queryKey: ["relation-opts", o, "", N, x, U ?? ""],
|
|
223
|
+
queryFn: () => Ye(""),
|
|
224
|
+
enabled: a && !He && ue,
|
|
223
225
|
staleTime: N ? 0 : 3e4
|
|
224
|
-
}),
|
|
225
|
-
() =>
|
|
226
|
-
|
|
227
|
-
(e) => v(
|
|
226
|
+
}), C = D(
|
|
227
|
+
() => ue && fe ? Wt(
|
|
228
|
+
fe,
|
|
229
|
+
(e) => v(Z, e) || "",
|
|
228
230
|
d
|
|
229
231
|
) : null,
|
|
230
|
-
[
|
|
231
|
-
),
|
|
232
|
-
|
|
233
|
-
placement:
|
|
232
|
+
[ue, fe, Z, d]
|
|
233
|
+
), We = ue && fe === void 0, ne = !!u && ct(u) && !(C && C.length > 0);
|
|
234
|
+
zt({
|
|
235
|
+
placement: F,
|
|
234
236
|
open: a,
|
|
235
237
|
search: O,
|
|
236
|
-
settled: !
|
|
237
|
-
count: (
|
|
238
|
+
settled: !H && !$e && u !== void 0 && !We,
|
|
239
|
+
count: (C == null ? void 0 : C.length) ?? (u == null ? void 0 : u.length) ?? 0
|
|
238
240
|
});
|
|
239
241
|
const {
|
|
240
|
-
data:
|
|
241
|
-
isLoading:
|
|
242
|
-
error:
|
|
243
|
-
isFetched:
|
|
242
|
+
data: re,
|
|
243
|
+
isLoading: Ge,
|
|
244
|
+
error: Nt,
|
|
245
|
+
isFetched: St
|
|
244
246
|
} = q({
|
|
245
247
|
queryKey: ["relation-single", o, String(r), x],
|
|
246
248
|
queryFn: () => Oe(o, r, x),
|
|
247
249
|
enabled: !!r,
|
|
248
250
|
staleTime: 6e4,
|
|
249
|
-
retry:
|
|
250
|
-
}),
|
|
251
|
+
retry: mt
|
|
252
|
+
}), Lt = !!r && !Ge && St && !re, S = (f == null ? void 0 : f.id) != null && f.id !== "" ? String(f.id) : null, { data: j } = q({
|
|
251
253
|
queryKey: ["relation-single", o, S ?? "", x],
|
|
252
254
|
queryFn: () => Oe(o, S, x).catch(
|
|
253
255
|
() => null
|
|
254
256
|
),
|
|
255
257
|
enabled: !!S && a,
|
|
256
258
|
staleTime: 6e4
|
|
257
|
-
}),
|
|
259
|
+
}), _t = JSON.stringify(k ? { _and: [{ id: { _eq: r } }, k] } : { id: { _eq: r } }), { data: me } = q({
|
|
258
260
|
queryKey: ["relation-avail", o, String(r), N],
|
|
259
|
-
queryFn: () =>
|
|
260
|
-
|
|
261
|
-
filter:
|
|
261
|
+
queryFn: () => G.request(
|
|
262
|
+
Y(`/items/${o}`, {
|
|
263
|
+
filter: _t,
|
|
262
264
|
picker: "1",
|
|
263
265
|
limit: 1,
|
|
264
266
|
fields: "id"
|
|
@@ -267,18 +269,18 @@ function Xt({
|
|
|
267
269
|
// The pinned option is offered OUTSIDE the option filter (a type's generic
|
|
268
270
|
// item is excluded from the general list on purpose), so a value that IS
|
|
269
271
|
// the pin is available by construction — never probe it, never flag it.
|
|
270
|
-
enabled: !!r && !!
|
|
272
|
+
enabled: !!r && !!re && String(r) !== S,
|
|
271
273
|
staleTime: 3e4
|
|
272
|
-
}),
|
|
273
|
-
|
|
274
|
-
},
|
|
274
|
+
}), oe = !!r && String(r) !== S && me !== void 0 && me.length === 0, pe = R(null), qe = R(!1), Ve = `${o}|${N ?? ""}`, Et = () => {
|
|
275
|
+
qe.current = !0, pe.current = Ve, g(null);
|
|
276
|
+
}, ge = r == null || r === "";
|
|
275
277
|
E(() => {
|
|
276
|
-
|
|
277
|
-
}, [
|
|
278
|
-
if (!y || w || !
|
|
279
|
-
const e =
|
|
280
|
-
|
|
281
|
-
|
|
278
|
+
ge || (qe.current = !1);
|
|
279
|
+
}, [ge]), E(() => {
|
|
280
|
+
if (!y || w || !ge || qe.current) return;
|
|
281
|
+
const e = Ve;
|
|
282
|
+
pe.current !== e && (pe.current = e, G.request(
|
|
283
|
+
Y(`/items/${o}`, {
|
|
282
284
|
limit: 2,
|
|
283
285
|
picker: "1",
|
|
284
286
|
fields: "id",
|
|
@@ -287,87 +289,87 @@ function Xt({
|
|
|
287
289
|
).then((n) => {
|
|
288
290
|
var i;
|
|
289
291
|
const t = n.data ?? [];
|
|
290
|
-
t.length === 1 && ((i = t[0]) == null ? void 0 : i.id) != null &&
|
|
292
|
+
t.length === 1 && ((i = t[0]) == null ? void 0 : i.id) != null && g(t[0].id);
|
|
291
293
|
}).catch(() => {
|
|
292
|
-
|
|
294
|
+
pe.current = null;
|
|
293
295
|
}));
|
|
294
|
-
}, [y, w,
|
|
295
|
-
const
|
|
296
|
-
() =>
|
|
296
|
+
}, [y, w, ge, o, N]);
|
|
297
|
+
const h = Z, Ce = r && re ? v(h, re) : null, Re = Ce === null ? null : B(Ce) ? le : Ce, J = !$e && d === O && !We, De = D(
|
|
298
|
+
() => (C && (C.length > 0 || !(u != null && u.length)) ? C : null) ?? Gt(
|
|
297
299
|
u ?? [],
|
|
298
|
-
(e) => v(
|
|
300
|
+
(e) => v(h, e) || `#${e.id}`,
|
|
299
301
|
// The server also reads a joined code by its parts ("2026-NNO-POWER"
|
|
300
302
|
// finds 2026-WEST-NNO-HE-POWERING, services/search-synonyms.ts), so
|
|
301
303
|
// the list narrowed while that search is out does too.
|
|
302
304
|
d.replace(/[-_/]+/g, " "),
|
|
303
|
-
|
|
305
|
+
J
|
|
304
306
|
),
|
|
305
|
-
[u,
|
|
306
|
-
),
|
|
307
|
-
() =>
|
|
308
|
-
[u,
|
|
309
|
-
), { data:
|
|
310
|
-
queryKey: ["relation-opts-dups", o,
|
|
311
|
-
queryFn: () =>
|
|
312
|
-
|
|
313
|
-
limit:
|
|
307
|
+
[u, h, d, J, C]
|
|
308
|
+
), he = D(
|
|
309
|
+
() => Ht(u ?? [], (e) => v(h, e) || `#${e.id}`),
|
|
310
|
+
[u, h]
|
|
311
|
+
), { data: se } = q({
|
|
312
|
+
queryKey: ["relation-opts-dups", o, he.join(",")],
|
|
313
|
+
queryFn: () => G.request(
|
|
314
|
+
Y(`/items/${o}`, {
|
|
315
|
+
limit: he.length,
|
|
314
316
|
picker: "1",
|
|
315
|
-
filter: JSON.stringify({ id: { _in:
|
|
317
|
+
filter: JSON.stringify({ id: { _in: he } }),
|
|
316
318
|
fields: "*"
|
|
317
319
|
})
|
|
318
320
|
).then((e) => e.data ?? []),
|
|
319
|
-
enabled: a &&
|
|
321
|
+
enabled: a && he.length > 0 && !X,
|
|
320
322
|
staleTime: 6e4
|
|
321
|
-
}),
|
|
322
|
-
if (!(
|
|
323
|
+
}), Xe = D(() => {
|
|
324
|
+
if (!(se != null && se.length)) return /* @__PURE__ */ new Map();
|
|
323
325
|
const e = new Map(
|
|
324
326
|
(u ?? []).map((t) => [
|
|
325
327
|
String(t.id),
|
|
326
|
-
(v(
|
|
328
|
+
(v(h, t) || `#${t.id}`).trim().toLowerCase()
|
|
327
329
|
])
|
|
328
330
|
), n = /* @__PURE__ */ new Map();
|
|
329
|
-
for (const t of
|
|
331
|
+
for (const t of se) {
|
|
330
332
|
const i = e.get(String(t.id));
|
|
331
333
|
i !== void 0 && n.set(i, [...n.get(i) ?? [], t]);
|
|
332
334
|
}
|
|
333
|
-
return
|
|
335
|
+
return Jt(
|
|
334
336
|
[...n.values()],
|
|
335
337
|
((x == null ? void 0 : x.split(",")) ?? []).map((t) => t.split(".")[0])
|
|
336
338
|
);
|
|
337
|
-
}, [
|
|
338
|
-
() => (u ?? []).some((e) => !
|
|
339
|
-
[u,
|
|
340
|
-
),
|
|
341
|
-
() => (
|
|
342
|
-
(e, n) =>
|
|
343
|
-
v(
|
|
344
|
-
v(
|
|
339
|
+
}, [se, u, h, x]), $t = !!r && Ge && !re, Ze = Zt(oe), Qe = D(
|
|
340
|
+
() => (u ?? []).some((e) => !B(v(h, e))),
|
|
341
|
+
[u, h]
|
|
342
|
+
), ie = D(
|
|
343
|
+
() => (U ? [...De] : [...De].sort(
|
|
344
|
+
(e, n) => Mt(
|
|
345
|
+
v(h, e),
|
|
346
|
+
v(h, n),
|
|
345
347
|
d,
|
|
346
348
|
b === "-label"
|
|
347
349
|
)
|
|
348
350
|
)).filter((e) => !S || String(e.id) !== S).filter(
|
|
349
|
-
(e) => !
|
|
351
|
+
(e) => !Qe || String(e.id) === String(r) || !B(v(h, e))
|
|
350
352
|
),
|
|
351
|
-
[
|
|
352
|
-
),
|
|
353
|
-
`${j ?
|
|
353
|
+
[De, U, h, d, b, S, r, Qe]
|
|
354
|
+
), Be = j && !B(v(h, j)) ? v(h, j) : le, Ae = !!S && (!d.trim() || Ut(
|
|
355
|
+
`${j ? Be : ""} ${(f == null ? void 0 : f.tag) ?? "Default"}`,
|
|
354
356
|
d.replace(/[-_/]+/g, " ")
|
|
355
|
-
)),
|
|
357
|
+
)), Q = Ae ? 1 : 0, L = Q + ie.length, m = Pe >= L ? L - 1 : Pe;
|
|
356
358
|
E(() => {
|
|
357
|
-
|
|
358
|
-
}, [a, d,
|
|
359
|
-
const
|
|
359
|
+
P(a && d.trim() && !ne ? Q : -1);
|
|
360
|
+
}, [a, d, Q, ne]);
|
|
361
|
+
const Ie = (e) => `${ve}-opt-${e}`, et = () => {
|
|
360
362
|
const e = (j == null ? void 0 : j.id) ?? (f == null ? void 0 : f.id);
|
|
361
|
-
|
|
362
|
-
},
|
|
363
|
-
|
|
364
|
-
},
|
|
365
|
-
e < 0 || e >= L || (e <
|
|
363
|
+
dt(r, e) || g(e), we();
|
|
364
|
+
}, tt = (e) => {
|
|
365
|
+
dt(r, e.id) || g(e.id), we();
|
|
366
|
+
}, be = (e) => {
|
|
367
|
+
e < 0 || e >= L || (e < Q ? et() : tt(ie[e - Q]));
|
|
366
368
|
};
|
|
367
369
|
E(() => {
|
|
368
370
|
var n, t;
|
|
369
371
|
if (!a || m < 0) return;
|
|
370
|
-
const e = (n =
|
|
372
|
+
const e = (n = xe.current) == null ? void 0 : n.querySelector(`[data-nav-index="${m}"]`);
|
|
371
373
|
(t = e == null ? void 0 : e.scrollIntoView) == null || t.call(e, { block: "nearest" });
|
|
372
374
|
}, [a, m]), E(() => {
|
|
373
375
|
const e = T.current;
|
|
@@ -376,102 +378,102 @@ function Xt({
|
|
|
376
378
|
T.current = null;
|
|
377
379
|
return;
|
|
378
380
|
}
|
|
379
|
-
|
|
381
|
+
J && (T.current = null, m >= 0 ? be(m) : L === 1 && u !== void 0 && !ne && be(0));
|
|
380
382
|
}
|
|
381
|
-
}, [a, d,
|
|
382
|
-
const
|
|
383
|
+
}, [a, d, J, m, L]);
|
|
384
|
+
const nt = (e) => {
|
|
383
385
|
var n;
|
|
384
|
-
e.key === "ArrowDown" ? (e.preventDefault(), L > 0 &&
|
|
385
|
-
},
|
|
386
|
+
e.key === "ArrowDown" ? (e.preventDefault(), L > 0 && P(m < 0 ? 0 : Math.min(m + 1, L - 1))) : e.key === "ArrowUp" ? (e.preventDefault(), L > 0 && P(m <= 0 ? 0 : m - 1)) : e.key === "Home" && L > 0 && !d ? (e.preventDefault(), P(0)) : e.key === "End" && L > 0 && !d ? (e.preventDefault(), P(L - 1)) : e.key === "Enter" ? (e.preventDefault(), d.trim() && !J ? T.current = d : m >= 0 ? be(m) : L === 1 && J && u !== void 0 && !ne && be(0)) : e.key === "Tab" && (M(!1), (n = ee.current) == null || n.focus());
|
|
387
|
+
}, qt = (e) => {
|
|
386
388
|
if (w) return;
|
|
387
389
|
const n = e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey && (a || e.key !== " ");
|
|
388
390
|
if (!a && (e.key === "ArrowDown" || e.key === "ArrowUp"))
|
|
389
|
-
e.preventDefault(),
|
|
391
|
+
e.preventDefault(), M(!0);
|
|
390
392
|
else if (n) {
|
|
391
393
|
e.preventDefault();
|
|
392
394
|
const t = e.key;
|
|
393
|
-
T.current = null,
|
|
394
|
-
} else a && e.key === "Backspace" ? (e.preventDefault(), T.current = null,
|
|
395
|
-
},
|
|
395
|
+
T.current = null, ce((i) => t === " " && (i === "" || i.endsWith(" ")) ? i : i + t), a ? te() : M(!0);
|
|
396
|
+
} else a && e.key === "Backspace" ? (e.preventDefault(), T.current = null, ce((t) => t.slice(0, -1)), te()) : a && (e.key === "Enter" || e.key === "ArrowDown" || e.key === "ArrowUp" || e.key === "Home" || e.key === "End") && (nt(e), te());
|
|
397
|
+
}, Ke = Kt();
|
|
396
398
|
return E(() => {
|
|
397
|
-
!
|
|
398
|
-
}, [
|
|
399
|
+
!Ke || !K || me === void 0 || Ke(K, oe);
|
|
400
|
+
}, [Ke, K, oe, me]), W ? /* @__PURE__ */ p(
|
|
399
401
|
"button",
|
|
400
402
|
{
|
|
401
403
|
type: "button",
|
|
402
404
|
disabled: !0,
|
|
403
405
|
className: "flex h-9 w-full items-center justify-between gap-2 rounded-md border border-input bg-background px-3 text-sm text-left opacity-50 cursor-not-allowed",
|
|
404
406
|
children: [
|
|
405
|
-
/* @__PURE__ */
|
|
407
|
+
/* @__PURE__ */ p("span", { className: "truncate text-muted-foreground", children: [
|
|
406
408
|
"Select ",
|
|
407
|
-
|
|
409
|
+
W,
|
|
408
410
|
" first"
|
|
409
411
|
] }),
|
|
410
|
-
/* @__PURE__ */ s(
|
|
412
|
+
/* @__PURE__ */ s(it, { className: "h-4 w-4 shrink-0 opacity-50" })
|
|
411
413
|
]
|
|
412
414
|
}
|
|
413
415
|
) : (
|
|
414
416
|
// Stale tooltip binds on the WRAPPER: a disabled trigger button swallows
|
|
415
417
|
// mouse events, so a locked-but-stale field would never show the hint.
|
|
416
|
-
/* @__PURE__ */
|
|
417
|
-
/* @__PURE__ */
|
|
418
|
+
/* @__PURE__ */ p("div", { ref: V, className: "relative", ...Ze.bind, children: [
|
|
419
|
+
/* @__PURE__ */ p(
|
|
418
420
|
"button",
|
|
419
421
|
{
|
|
420
|
-
ref:
|
|
422
|
+
ref: ee,
|
|
421
423
|
type: "button",
|
|
422
424
|
disabled: w,
|
|
423
425
|
"aria-haspopup": "listbox",
|
|
424
426
|
"aria-expanded": a,
|
|
425
|
-
onClick: () =>
|
|
426
|
-
onKeyDown:
|
|
427
|
-
className:
|
|
427
|
+
onClick: () => M((e) => !e),
|
|
428
|
+
onKeyDown: qt,
|
|
429
|
+
className: z(
|
|
428
430
|
"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",
|
|
429
|
-
|
|
431
|
+
oe ? "border-amber-300 dark:border-amber-600" : "border-input"
|
|
430
432
|
),
|
|
431
433
|
children: [
|
|
432
|
-
|
|
434
|
+
$t ? /* @__PURE__ */ s(ye, { className: "h-3.5 w-3.5 animate-spin text-muted-foreground" }) : /* @__PURE__ */ p(
|
|
433
435
|
"span",
|
|
434
436
|
{
|
|
435
|
-
className:
|
|
437
|
+
className: z(
|
|
436
438
|
"flex items-center gap-1.5 truncate min-w-0",
|
|
437
|
-
(!Re || Re ===
|
|
439
|
+
(!Re || Re === le) && "text-muted-foreground"
|
|
438
440
|
),
|
|
439
441
|
children: [
|
|
440
|
-
|
|
441
|
-
/* @__PURE__ */ s(
|
|
442
|
+
oe && /* @__PURE__ */ p(st, { children: [
|
|
443
|
+
/* @__PURE__ */ s(Ct, { "aria-hidden": "true", className: "h-3.5 w-3.5 shrink-0 text-amber-500" }),
|
|
442
444
|
/* @__PURE__ */ s("span", { className: "sr-only", children: "Not an available option: " })
|
|
443
445
|
] }),
|
|
444
|
-
|
|
446
|
+
Lt ? /* @__PURE__ */ s(pt, { error: Nt, className: "truncate" }) : /* @__PURE__ */ s("span", { className: "truncate", children: Re ?? I ?? "Select…" })
|
|
445
447
|
]
|
|
446
448
|
}
|
|
447
449
|
),
|
|
448
|
-
/* @__PURE__ */ s(
|
|
450
|
+
/* @__PURE__ */ s(it, { className: "h-4 w-4 shrink-0 opacity-50" })
|
|
449
451
|
]
|
|
450
452
|
}
|
|
451
453
|
),
|
|
452
|
-
|
|
453
|
-
a &&
|
|
454
|
-
/* @__PURE__ */
|
|
454
|
+
Ze.tip,
|
|
455
|
+
a && ke && Se && ut(
|
|
456
|
+
/* @__PURE__ */ p(
|
|
455
457
|
"div",
|
|
456
458
|
{
|
|
457
|
-
ref:
|
|
459
|
+
ref: xe,
|
|
458
460
|
"data-nvr-combobox-panel": "",
|
|
459
|
-
style:
|
|
460
|
-
className:
|
|
461
|
+
style: ke,
|
|
462
|
+
className: z(
|
|
461
463
|
"nvr-pop-in rounded-md border border-border bg-popover shadow-md",
|
|
462
464
|
c != null && c.length ? "w-[560px] max-w-[92vw]" : "min-w-[240px] w-max max-w-[360px]"
|
|
463
465
|
),
|
|
464
466
|
children: [
|
|
465
467
|
!!(c != null && c.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: c.map((e) => {
|
|
466
|
-
const n =
|
|
467
|
-
return n ? /* @__PURE__ */
|
|
468
|
+
const n = wt[e.field];
|
|
469
|
+
return n ? /* @__PURE__ */ p("div", { children: [
|
|
468
470
|
/* @__PURE__ */ s("p", { className: "mb-0.5 text-[10px] font-medium uppercase tracking-wide text-slate-400", children: e.label ?? e.field }),
|
|
469
471
|
/* @__PURE__ */ s(
|
|
470
|
-
|
|
472
|
+
Qt,
|
|
471
473
|
{
|
|
472
474
|
collection: n,
|
|
473
|
-
value:
|
|
474
|
-
onChange: (t) =>
|
|
475
|
+
value: _e[e.field] ?? null,
|
|
476
|
+
onChange: (t) => vt((i) => ({ ...i, [e.field]: t })),
|
|
475
477
|
placeholder: "Any",
|
|
476
478
|
optionSort: e.sort,
|
|
477
479
|
extraFilter: e.filter
|
|
@@ -479,63 +481,63 @@ function Xt({
|
|
|
479
481
|
)
|
|
480
482
|
] }, e.field) : null;
|
|
481
483
|
}) }),
|
|
482
|
-
/* @__PURE__ */
|
|
483
|
-
/* @__PURE__ */ s(
|
|
484
|
+
/* @__PURE__ */ p("div", { className: "flex items-center border-b px-3", children: [
|
|
485
|
+
/* @__PURE__ */ s(Rt, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }),
|
|
484
486
|
/* @__PURE__ */ s(
|
|
485
487
|
"input",
|
|
486
488
|
{
|
|
487
489
|
ref: je,
|
|
488
490
|
value: d,
|
|
489
491
|
onChange: (e) => {
|
|
490
|
-
T.current = null,
|
|
492
|
+
T.current = null, ce(e.target.value);
|
|
491
493
|
},
|
|
492
|
-
onKeyDown:
|
|
494
|
+
onKeyDown: nt,
|
|
493
495
|
role: "combobox",
|
|
494
496
|
"aria-expanded": !0,
|
|
495
497
|
"aria-autocomplete": "list",
|
|
496
|
-
"aria-controls": `${
|
|
497
|
-
"aria-activedescendant": m >= 0 ?
|
|
498
|
+
"aria-controls": `${ve}-list`,
|
|
499
|
+
"aria-activedescendant": m >= 0 ? Ie(m) : void 0,
|
|
498
500
|
placeholder: "Search…",
|
|
499
501
|
className: "flex h-9 w-full bg-transparent py-3 text-[13px] outline-none placeholder:text-muted-foreground"
|
|
500
502
|
}
|
|
501
503
|
),
|
|
502
|
-
|
|
503
|
-
|
|
504
|
+
H && u !== void 0 && /* @__PURE__ */ s(
|
|
505
|
+
ye,
|
|
504
506
|
{
|
|
505
507
|
"data-picker-searching": !0,
|
|
506
508
|
className: "ml-2 h-3.5 w-3.5 shrink-0 animate-spin text-muted-foreground"
|
|
507
509
|
}
|
|
508
510
|
)
|
|
509
511
|
] }),
|
|
510
|
-
/* @__PURE__ */
|
|
511
|
-
!!r && !w && /* @__PURE__ */
|
|
512
|
+
/* @__PURE__ */ p("div", { id: `${ve}-list`, role: "listbox", className: "max-h-52 overflow-y-auto py-1", children: [
|
|
513
|
+
!!r && !w && /* @__PURE__ */ p(
|
|
512
514
|
"button",
|
|
513
515
|
{
|
|
514
516
|
type: "button",
|
|
515
517
|
tabIndex: -1,
|
|
516
518
|
onClick: () => {
|
|
517
|
-
|
|
519
|
+
Et(), we();
|
|
518
520
|
},
|
|
519
521
|
className: "flex w-full items-center gap-2 px-3 py-1.5 text-[13px] text-slate-500 hover:bg-muted border-b border-slate-100 dark:text-slate-400 dark:border-border",
|
|
520
522
|
children: [
|
|
521
|
-
/* @__PURE__ */ s(
|
|
523
|
+
/* @__PURE__ */ s(Dt, { className: "h-3.5 w-3.5 text-slate-400" }),
|
|
522
524
|
"Clear selection"
|
|
523
525
|
]
|
|
524
526
|
}
|
|
525
527
|
),
|
|
526
|
-
|
|
528
|
+
Ae && /* @__PURE__ */ p(
|
|
527
529
|
"button",
|
|
528
530
|
{
|
|
529
531
|
type: "button",
|
|
530
532
|
tabIndex: -1,
|
|
531
|
-
id:
|
|
533
|
+
id: Ie(0),
|
|
532
534
|
role: "option",
|
|
533
535
|
"aria-selected": String(r) === S,
|
|
534
536
|
"data-nav-index": 0,
|
|
535
537
|
"data-nvr-pinned-option": !0,
|
|
536
|
-
onClick:
|
|
537
|
-
onMouseMove: () => m !== 0 &&
|
|
538
|
-
className:
|
|
538
|
+
onClick: et,
|
|
539
|
+
onMouseMove: () => m !== 0 && P(0),
|
|
540
|
+
className: z(
|
|
539
541
|
"flex w-full items-center gap-2 border-b border-slate-100 px-3 py-1.5 text-left text-[13px] hover:bg-nvr-cyan/10 dark:border-border",
|
|
540
542
|
m === 0 ? "bg-nvr-cyan/10" : "bg-nvr-cyan/5"
|
|
541
543
|
),
|
|
@@ -543,27 +545,27 @@ function Xt({
|
|
|
543
545
|
/* @__PURE__ */ s(
|
|
544
546
|
"div",
|
|
545
547
|
{
|
|
546
|
-
className:
|
|
548
|
+
className: z(
|
|
547
549
|
"flex h-4 w-4 shrink-0 items-center justify-center rounded-full border transition-colors",
|
|
548
550
|
String(r) === S ? "border-nvr-cyan bg-nvr-cyan" : "border-slate-300"
|
|
549
551
|
),
|
|
550
|
-
children: String(r) === S && /* @__PURE__ */ s(
|
|
552
|
+
children: String(r) === S && /* @__PURE__ */ s(at, { className: "h-2.5 w-2.5 text-white" })
|
|
551
553
|
}
|
|
552
554
|
),
|
|
553
|
-
/* @__PURE__ */ s("span", { className: "min-w-0 flex-1 truncate", children: j === void 0 ? "Loading…" :
|
|
555
|
+
/* @__PURE__ */ s("span", { className: "min-w-0 flex-1 truncate", children: j === void 0 ? "Loading…" : Be }),
|
|
554
556
|
/* @__PURE__ */ s("span", { className: "shrink-0 rounded bg-nvr-cyan/15 px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-slate-700 dark:text-foreground", children: (f == null ? void 0 : f.tag) ?? "Default" })
|
|
555
557
|
]
|
|
556
558
|
}
|
|
557
559
|
),
|
|
558
|
-
u === void 0 &&
|
|
559
|
-
/* @__PURE__ */
|
|
560
|
+
u === void 0 && H ? /* @__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 && !J ? /* @__PURE__ */ s("p", { className: "px-3 py-2 text-[13px] text-muted-foreground", children: "Searching…" }) : ie.length === 0 ? Ae && d.trim() ? null : l && l.labels.length > 0 && !d.trim() ? /* @__PURE__ */ p("div", { className: "px-3 py-2 text-[12px] leading-5 text-muted-foreground", children: [
|
|
561
|
+
/* @__PURE__ */ p("p", { children: [
|
|
560
562
|
"No options for",
|
|
561
563
|
" ",
|
|
562
564
|
/* @__PURE__ */ s("span", { className: "font-medium text-foreground", children: l.labels.join(" · ") }),
|
|
563
565
|
l.onClear ? " — clear one to widen the list:" : ". Change it, or ask an administrator to add options for it."
|
|
564
566
|
] }),
|
|
565
567
|
l.onClear && /* @__PURE__ */ s("div", { className: "mt-1.5 flex flex-wrap gap-1.5", children: l.keys.map(
|
|
566
|
-
(e, n) => l.clearable && !l.clearable.includes(e) ? null : /* @__PURE__ */
|
|
568
|
+
(e, n) => l.clearable && !l.clearable.includes(e) ? null : /* @__PURE__ */ p(
|
|
567
569
|
"button",
|
|
568
570
|
{
|
|
569
571
|
type: "button",
|
|
@@ -580,70 +582,84 @@ function Xt({
|
|
|
580
582
|
e
|
|
581
583
|
)
|
|
582
584
|
) })
|
|
583
|
-
] }) : /* @__PURE__ */ s("p", { className: "px-3 py-2 text-[13px] text-muted-foreground", children: d.trim() ? `No results for “${d.trim()}”` : "No results" }) :
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
"button",
|
|
585
|
+
] }) : /* @__PURE__ */ s("p", { className: "px-3 py-2 text-[13px] text-muted-foreground", children: d.trim() ? `No results for “${d.trim()}”` : "No results" }) : /* @__PURE__ */ p(st, { children: [
|
|
586
|
+
ne && /* @__PURE__ */ p(
|
|
587
|
+
"p",
|
|
587
588
|
{
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
id: Ae($),
|
|
591
|
-
role: "option",
|
|
592
|
-
"aria-selected": _,
|
|
593
|
-
"data-nav-index": $,
|
|
594
|
-
onClick: () => et(e),
|
|
595
|
-
onMouseMove: () => m !== $ && M($),
|
|
596
|
-
className: J(
|
|
597
|
-
"flex w-full items-center gap-2 px-3 py-1.5 text-[13px] text-left hover:bg-muted",
|
|
598
|
-
m === $ && "bg-muted"
|
|
599
|
-
),
|
|
589
|
+
"data-picker-close-matches": !0,
|
|
590
|
+
className: "px-3 pb-1 pt-2 text-[11.5px] text-muted-foreground",
|
|
600
591
|
children: [
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
className: J(
|
|
605
|
-
"flex h-4 w-4 shrink-0 items-center justify-center rounded-full border transition-colors",
|
|
606
|
-
_ ? "border-nvr-cyan bg-nvr-cyan" : "border-slate-300"
|
|
607
|
-
),
|
|
608
|
-
children: _ && /* @__PURE__ */ s(st, { className: "h-2.5 w-2.5 text-white" })
|
|
609
|
-
}
|
|
610
|
-
),
|
|
611
|
-
V && /* @__PURE__ */ s(
|
|
612
|
-
Tt,
|
|
613
|
-
{
|
|
614
|
-
userId: e.id,
|
|
615
|
-
className: "h-4 w-4",
|
|
616
|
-
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: Gt(i) })
|
|
617
|
-
}
|
|
618
|
-
),
|
|
619
|
-
V && xt.has(String(e.id).toUpperCase()) && /* @__PURE__ */ s(
|
|
620
|
-
"span",
|
|
621
|
-
{
|
|
622
|
-
className: "h-1.5 w-1.5 shrink-0 rounded-full bg-emerald-500",
|
|
623
|
-
"data-tip": "Online now"
|
|
624
|
-
}
|
|
625
|
-
),
|
|
626
|
-
/* @__PURE__ */ s(Ot, { text: i, query: d }),
|
|
627
|
-
Ve.has(String(e.id)) && /* @__PURE__ */ s(
|
|
628
|
-
"span",
|
|
629
|
-
{
|
|
630
|
-
className: "ml-auto max-w-[45%] shrink-0 truncate pl-2 text-[11.5px] text-muted-foreground",
|
|
631
|
-
"data-option-detail": !0,
|
|
632
|
-
children: Ve.get(String(e.id))
|
|
633
|
-
}
|
|
634
|
-
)
|
|
592
|
+
"No exact match for “",
|
|
593
|
+
d.trim(),
|
|
594
|
+
"” — did you mean:"
|
|
635
595
|
]
|
|
636
|
-
}
|
|
637
|
-
|
|
638
|
-
)
|
|
639
|
-
|
|
596
|
+
}
|
|
597
|
+
),
|
|
598
|
+
ie.map((e, n) => {
|
|
599
|
+
const t = v(h, e), i = B(t) ? le : t, _ = String(e.id) === String(r), $ = n + Q;
|
|
600
|
+
return /* @__PURE__ */ p(
|
|
601
|
+
"button",
|
|
602
|
+
{
|
|
603
|
+
type: "button",
|
|
604
|
+
tabIndex: -1,
|
|
605
|
+
id: Ie($),
|
|
606
|
+
role: "option",
|
|
607
|
+
"aria-selected": _,
|
|
608
|
+
"data-nav-index": $,
|
|
609
|
+
onClick: () => tt(e),
|
|
610
|
+
onMouseMove: () => m !== $ && P($),
|
|
611
|
+
className: z(
|
|
612
|
+
"flex w-full items-center gap-2 px-3 py-1.5 text-[13px] text-left hover:bg-muted",
|
|
613
|
+
m === $ && "bg-muted"
|
|
614
|
+
),
|
|
615
|
+
children: [
|
|
616
|
+
/* @__PURE__ */ s(
|
|
617
|
+
"div",
|
|
618
|
+
{
|
|
619
|
+
className: z(
|
|
620
|
+
"flex h-4 w-4 shrink-0 items-center justify-center rounded-full border transition-colors",
|
|
621
|
+
_ ? "border-nvr-cyan bg-nvr-cyan" : "border-slate-300"
|
|
622
|
+
),
|
|
623
|
+
children: _ && /* @__PURE__ */ s(at, { className: "h-2.5 w-2.5 text-white" })
|
|
624
|
+
}
|
|
625
|
+
),
|
|
626
|
+
X && /* @__PURE__ */ s(
|
|
627
|
+
jt,
|
|
628
|
+
{
|
|
629
|
+
userId: e.id,
|
|
630
|
+
className: "h-4 w-4",
|
|
631
|
+
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: Xt(i) })
|
|
632
|
+
}
|
|
633
|
+
),
|
|
634
|
+
X && kt.has(String(e.id).toUpperCase()) && /* @__PURE__ */ s(
|
|
635
|
+
"span",
|
|
636
|
+
{
|
|
637
|
+
className: "h-1.5 w-1.5 shrink-0 rounded-full bg-emerald-500",
|
|
638
|
+
"data-tip": "Online now"
|
|
639
|
+
}
|
|
640
|
+
),
|
|
641
|
+
/* @__PURE__ */ s(Tt, { text: i, query: d }),
|
|
642
|
+
Xe.has(String(e.id)) && /* @__PURE__ */ s(
|
|
643
|
+
"span",
|
|
644
|
+
{
|
|
645
|
+
className: "ml-auto max-w-[45%] shrink-0 truncate pl-2 text-[11.5px] text-muted-foreground",
|
|
646
|
+
"data-option-detail": !0,
|
|
647
|
+
children: Xe.get(String(e.id))
|
|
648
|
+
}
|
|
649
|
+
)
|
|
650
|
+
]
|
|
651
|
+
},
|
|
652
|
+
String(e.id)
|
|
653
|
+
);
|
|
654
|
+
})
|
|
655
|
+
] })
|
|
640
656
|
] }),
|
|
641
|
-
!
|
|
642
|
-
|
|
657
|
+
!H && /* @__PURE__ */ s(
|
|
658
|
+
Bt,
|
|
643
659
|
{
|
|
644
660
|
collection: o,
|
|
645
661
|
search: O,
|
|
646
|
-
filter:
|
|
662
|
+
filter: Ee,
|
|
647
663
|
narrowedLabels: (l == null ? void 0 : l.labels) ?? [],
|
|
648
664
|
auto: (u ?? []).length === 0 && !!O
|
|
649
665
|
}
|
|
@@ -651,41 +667,41 @@ function Xt({
|
|
|
651
667
|
]
|
|
652
668
|
}
|
|
653
669
|
),
|
|
654
|
-
|
|
670
|
+
Se
|
|
655
671
|
)
|
|
656
672
|
] })
|
|
657
673
|
);
|
|
658
674
|
}
|
|
659
|
-
function
|
|
675
|
+
function Bt({
|
|
660
676
|
collection: o,
|
|
661
677
|
search: r,
|
|
662
|
-
filter:
|
|
678
|
+
filter: g,
|
|
663
679
|
narrowedLabels: w,
|
|
664
|
-
auto:
|
|
680
|
+
auto: I
|
|
665
681
|
}) {
|
|
666
|
-
const k =
|
|
667
|
-
queryKey: ["picker-narrowing", o, r,
|
|
682
|
+
const k = Fe(), [y, b] = A(!1), W = g ? JSON.stringify(g) : "", { data: c, isFetching: K } = q({
|
|
683
|
+
queryKey: ["picker-narrowing", o, r, W],
|
|
668
684
|
queryFn: () => k.request(
|
|
669
|
-
|
|
670
|
-
).then((
|
|
671
|
-
enabled: y ||
|
|
685
|
+
Ft("/picker-narrowing", { collection: o, search: r, filter: g ?? null })
|
|
686
|
+
).then((F) => F.data),
|
|
687
|
+
enabled: y || I,
|
|
672
688
|
staleTime: 3e4,
|
|
673
689
|
retry: !1
|
|
674
690
|
});
|
|
675
|
-
if (!y && !
|
|
691
|
+
if (!y && !I)
|
|
676
692
|
return /* @__PURE__ */ s(
|
|
677
693
|
"button",
|
|
678
694
|
{
|
|
679
695
|
type: "button",
|
|
680
|
-
onClick: (
|
|
681
|
-
|
|
696
|
+
onClick: (F) => {
|
|
697
|
+
F.stopPropagation(), b(!0);
|
|
682
698
|
},
|
|
683
699
|
className: "w-full border-t border-border px-3 py-1.5 text-left text-[11px] text-muted-foreground hover:text-foreground",
|
|
684
700
|
"data-picker-narrowing-ask": !0,
|
|
685
701
|
children: "Missing something?"
|
|
686
702
|
}
|
|
687
703
|
);
|
|
688
|
-
if (
|
|
704
|
+
if (K && !c)
|
|
689
705
|
return /* @__PURE__ */ s("p", { className: "border-t border-border px-3 py-1.5 text-[11px] text-muted-foreground", children: "Checking what narrows this list…" });
|
|
690
706
|
if (!c) return null;
|
|
691
707
|
const l = [], f = r ? `match “${r}”` : "exist";
|
|
@@ -702,45 +718,45 @@ function Zt({
|
|
|
702
718
|
"data-picker-narrowing": !0,
|
|
703
719
|
"data-picker-narrowing-field": c.by_field_filter,
|
|
704
720
|
"data-picker-narrowing-excluded": c.by_exclusions,
|
|
705
|
-
children: l.map((
|
|
721
|
+
children: l.map((F) => /* @__PURE__ */ s("p", { children: F }, F))
|
|
706
722
|
}
|
|
707
723
|
);
|
|
708
724
|
}
|
|
709
|
-
function
|
|
725
|
+
function xn({
|
|
710
726
|
collection: o,
|
|
711
727
|
id: r,
|
|
712
|
-
displayTemplate:
|
|
728
|
+
displayTemplate: g
|
|
713
729
|
}) {
|
|
714
|
-
const w =
|
|
715
|
-
if (!
|
|
716
|
-
const l = [...
|
|
730
|
+
const w = Fe(), I = ft(), k = o === "nivaro_files" || o === "directus_files", y = (() => {
|
|
731
|
+
if (!g || !g.includes(".")) return null;
|
|
732
|
+
const l = [...g.matchAll(/\{\{([^}]+)\}\}/g)].map((f) => f[1].trim());
|
|
717
733
|
return l.length > 0 ? ["id", ...l].join(",") : null;
|
|
718
|
-
})(), { data: b, isLoading:
|
|
734
|
+
})(), { data: b, isLoading: W, error: c } = q({
|
|
719
735
|
queryKey: ["relation-single", o, String(r), y ?? ""],
|
|
720
736
|
queryFn: () => k ? (
|
|
721
737
|
// The file's row, not its bytes: GET /files/:id downloads the whole
|
|
722
738
|
// file (twice with the retry, 404 when storage lost it) only to read
|
|
723
739
|
// its name, and a missing object left the raw id as the label.
|
|
724
740
|
w.request(
|
|
725
|
-
|
|
741
|
+
Y(`/files/${encodeURIComponent(String(r))}/meta`)
|
|
726
742
|
).then((l) => l.data)
|
|
727
|
-
) :
|
|
743
|
+
) : I(o, r, y),
|
|
728
744
|
enabled: !!r && !!o,
|
|
729
745
|
staleTime: 6e4,
|
|
730
|
-
retry:
|
|
746
|
+
retry: mt
|
|
731
747
|
});
|
|
732
|
-
if (
|
|
733
|
-
if (!b) return r == null || r === "" ? null : /* @__PURE__ */ s(
|
|
748
|
+
if (W) return /* @__PURE__ */ s(ye, { className: "h-3 w-3 animate-spin text-slate-400" });
|
|
749
|
+
if (!b) return r == null || r === "" ? null : /* @__PURE__ */ s(pt, { error: c });
|
|
734
750
|
if (k) {
|
|
735
751
|
const l = b.title || b.filename_download || b.filename_disk || String(r);
|
|
736
752
|
return /* @__PURE__ */ s("span", { children: l });
|
|
737
753
|
}
|
|
738
|
-
const
|
|
739
|
-
return
|
|
754
|
+
const K = v(g, b);
|
|
755
|
+
return B(K) ? /* @__PURE__ */ s("span", { className: "italic text-muted-foreground", children: le }) : /* @__PURE__ */ s("span", { children: K });
|
|
740
756
|
}
|
|
741
757
|
export {
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
758
|
+
xn as RelatedItemLabel,
|
|
759
|
+
Qt as RelationCombobox,
|
|
760
|
+
dt as isSamePick,
|
|
761
|
+
Zt as useStaleTip
|
|
746
762
|
};
|