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