@nivaro/react 0.3.117 → 0.3.118
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 +136 -14
- package/dist/index.js +488 -485
- package/dist/shared/components/ActivityEntry.js +130 -125
- package/dist/shared/components/AgentPresenceChip.js +36 -26
- package/dist/shared/components/CellCopyLayer.js +50 -45
- package/dist/shared/components/CollectionBrowserView.js +3757 -3695
- package/dist/shared/components/FilePreviewLightbox.js +96 -58
- package/dist/shared/components/InStep.js +18 -17
- package/dist/shared/components/ItemEditForm.js +4220 -4175
- package/dist/shared/components/JobsTray.js +8 -8
- package/dist/shared/components/LiveNewMatchesPill.js +21 -14
- package/dist/shared/components/LiveOffNote.js +3 -2
- package/dist/shared/components/LiveRowMark.js +53 -23
- package/dist/shared/components/LiveTraceView.js +162 -123
- package/dist/shared/components/MyWorkView.js +320 -299
- package/dist/shared/components/NotificationBell.js +14 -14
- package/dist/shared/components/OverflowRail.js +1 -1
- package/dist/shared/components/PageRenderer.js +120 -116
- package/dist/shared/components/ProfileView.js +203 -202
- package/dist/shared/components/RealtimeStatusBanner.js +31 -29
- package/dist/shared/components/RecordDrilldownSheet.js +7 -7
- package/dist/shared/components/RecordHoverCard.js +102 -84
- package/dist/shared/components/RecordReadView.js +146 -146
- package/dist/shared/components/ScreenRefreshButton.js +34 -32
- package/dist/shared/components/TipLayer.js +65 -58
- package/dist/shared/components/WidgetImageMenu.js +83 -43
- package/dist/shared/components/activity/RecordActivityStream.js +175 -173
- package/dist/shared/components/bulk/BulkSelectionNotices.js +142 -119
- package/dist/shared/components/change-proposals/ChangeProposalsPanel.js +158 -143
- package/dist/shared/components/change-proposals/ProposeChangeButton.js +17 -11
- package/dist/shared/components/change-proposals/ProposeChangeDialog.js +201 -173
- package/dist/shared/components/chat/ChatAnalyticsView.js +27 -27
- package/dist/shared/components/chat/HuddleAnalyticsTab.js +17 -17
- package/dist/shared/components/collections-directory/CollectionsToolbar.js +39 -41
- package/dist/shared/components/collections-directory/page-model.js +72 -67
- package/dist/shared/components/integrations/RecordIntegrationPreview.js +48 -56
- package/dist/shared/components/integrations/SendStatus.js +65 -59
- package/dist/shared/components/integrations/console/ReadyToSendView.js +275 -209
- package/dist/shared/components/integrations/console/SignalCard.js +237 -230
- package/dist/shared/components/item-edit/CatalogPickerField.js +227 -205
- package/dist/shared/components/item-edit/ChangedAfterApprovalBadge.js +131 -92
- package/dist/shared/components/item-edit/CloneDialog.js +191 -161
- package/dist/shared/components/item-edit/DerivedCauseNote.js +44 -30
- package/dist/shared/components/item-edit/DraftRecoveryBanner.js +153 -134
- package/dist/shared/components/item-edit/FieldComments.js +54 -53
- package/dist/shared/components/item-edit/FieldPointer.js +82 -67
- package/dist/shared/components/item-edit/FieldRow.js +106 -100
- package/dist/shared/components/item-edit/FieldSourceBadge.js +58 -56
- package/dist/shared/components/item-edit/FilePickerField.js +452 -387
- package/dist/shared/components/item-edit/HeaderSummaryChip.js +78 -56
- package/dist/shared/components/item-edit/HeaderTools.js +94 -85
- package/dist/shared/components/item-edit/InlineTableField.js +1242 -1218
- package/dist/shared/components/item-edit/ListNeighborNav.js +47 -50
- package/dist/shared/components/item-edit/LiveTraceSheet.js +15 -10
- package/dist/shared/components/item-edit/MembershipSetField.js +285 -254
- package/dist/shared/components/item-edit/OutboxReviewTray.js +155 -144
- package/dist/shared/components/item-edit/QueueReturnChip.js +15 -36
- package/dist/shared/components/item-edit/RecalcValue.js +57 -32
- package/dist/shared/components/item-edit/RecordHelpChip.js +21 -22
- package/dist/shared/components/item-edit/RecordLiveSync.js +283 -231
- package/dist/shared/components/item-edit/RelationCombobox.js +439 -393
- package/dist/shared/components/item-edit/RemoteChangeUi.js +292 -224
- package/dist/shared/components/item-edit/RemoteUploads.js +26 -20
- package/dist/shared/components/item-edit/RemovedLineNote.js +77 -67
- package/dist/shared/components/item-edit/RichTextEditorImpl.js +184 -179
- package/dist/shared/components/item-edit/ScheduledChangeChip.js +168 -134
- package/dist/shared/components/item-edit/SectionPresence.js +18 -10
- package/dist/shared/components/item-edit/SplitLinesButton.js +163 -139
- package/dist/shared/components/item-edit/UserChip.js +1 -1
- package/dist/shared/components/item-edit/file-live.js +69 -54
- package/dist/shared/components/item-edit/layout-switch.js +98 -89
- package/dist/shared/components/item-edit/partner-needs.js +12 -12
- package/dist/shared/components/item-edit/removed-line.js +31 -25
- package/dist/shared/components/layout-editor/pickers/field-picker.js +112 -104
- package/dist/shared/components/list/ListViewers.js +46 -35
- package/dist/shared/components/notifications/NotificationCenterView.js +479 -437
- package/dist/shared/components/panels/AccessDeniedPanel.js +176 -101
- package/dist/shared/components/panels/AlertBanners.js +82 -72
- package/dist/shared/components/panels/BranchLanes.js +22 -22
- package/dist/shared/components/panels/CommentImages.js +123 -102
- package/dist/shared/components/panels/CommentPanel.js +186 -185
- package/dist/shared/components/panels/ExternalRequestsChip.js +111 -119
- package/dist/shared/components/panels/OwnerOpenedLine.js +31 -24
- package/dist/shared/components/panels/PipelinePanel.js +2037 -1885
- package/dist/shared/components/panels/ResubmissionDiff.js +163 -142
- package/dist/shared/components/pipeline/OwnerMatrixSheet.js +400 -288
- package/dist/shared/components/pipeline/PipelineEditorView.js +7 -2
- package/dist/shared/components/profile/AgentNameField.js +107 -81
- package/dist/shared/components/profile/AgentsPanel.js +184 -184
- package/dist/shared/components/profile/PersonAccess.js +599 -495
- package/dist/shared/components/profile/SignInTroubleshooter.js +160 -127
- package/dist/shared/components/profile/SignedInDevices.js +17 -17
- package/dist/shared/components/profile/primitives.js +1 -1
- package/dist/shared/components/queue/OwnerAvatars.js +91 -54
- package/dist/shared/components/queue/QueueTeamStrip.js +56 -46
- package/dist/shared/components/queue/QueueWorklist.js +1002 -983
- package/dist/shared/components/support/AssignRules.js +1733 -0
- package/dist/shared/components/support/PersonPick.js +88 -0
- package/dist/shared/components/support/RequestList.js +790 -0
- package/dist/shared/components/support/ScreenShare.js +158 -152
- package/dist/shared/components/support/SupportRequestDialog.js +50 -48
- package/dist/shared/components/support/SupportView.js +140 -246
- package/dist/shared/components/support/TicketDetailSheet.js +82 -75
- package/dist/shared/components/support/TicketSlowScreens.js +9 -9
- package/dist/shared/components/support/assign-rules-text.js +171 -0
- package/dist/shared/components/support/support-list.js +125 -0
- package/dist/shared/components/ui/SimpleSelect.js +28 -20
- package/dist/shared/components/ui/checkbox.js +6 -6
- package/dist/shared/components/ui/select.js +43 -39
- package/dist/shared/components/ui/sheet.js +9 -9
- package/dist/shared/components/ui/switch.js +12 -11
- package/dist/shared/components/watch-list/WatchDock.js +532 -459
- package/dist/shared/components/watch-list/WatchExtras.js +332 -286
- package/dist/shared/components/watch-list/WatchRows.js +164 -140
- package/dist/shared/lib/activity-sentence.js +103 -91
- package/dist/shared/lib/agent-presence.js +27 -21
- package/dist/shared/lib/approval-progress.js +2 -2
- package/dist/shared/lib/copy-rules.js +31 -24
- package/dist/shared/lib/derived-causes.js +113 -78
- package/dist/shared/lib/grid-cursors.js +26 -26
- package/dist/shared/lib/label-flash.js +27 -0
- package/dist/shared/lib/list-return.js +137 -125
- package/dist/shared/lib/live-deltas.js +40 -34
- package/dist/shared/lib/live-groups.js +56 -52
- package/dist/shared/lib/live-preference.js +64 -59
- package/dist/shared/lib/live-screen.js +223 -192
- package/dist/shared/lib/partner-failure.js +11 -11
- package/dist/shared/lib/rollup-recalc.js +68 -64
- package/dist/shared/lib/screen-refresh.js +74 -68
- package/dist/shared/lib/screen-share.js +108 -104
- package/dist/shared/lib/send-status.js +77 -61
- package/dist/shared/lib/text-diff-window.js +29 -0
- package/dist/shared/lib/watch-list.js +210 -209
- package/dist/shared/lib/widget-image-render.js +72 -49
- package/package.json +1 -1
|
@@ -1,37 +1,38 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useQuery as
|
|
3
|
-
import { ChevronDown as
|
|
4
|
-
import { useState as F, useRef as
|
|
5
|
-
import { createPortal as
|
|
6
|
-
import { useNivaroClient as
|
|
7
|
-
import { get as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
1
|
+
import { jsxs as u, jsx as s, Fragment as gt } from "react/jsx-runtime";
|
|
2
|
+
import { useQuery as K } from "@tanstack/react-query";
|
|
3
|
+
import { ChevronDown as ht, Loader2 as Se, AlertTriangle as Ut, Search as At, X as Ht, Check as bt } from "lucide-react";
|
|
4
|
+
import { useState as P, useMemo as F, useRef as I, useEffect as y, useId as xt, useLayoutEffect as yt } from "react";
|
|
5
|
+
import { createPortal as St } from "react-dom";
|
|
6
|
+
import { useNivaroClient as Ae, useItemEditAuth as Jt, useStaleFieldReporter as zt } from "../../context.js";
|
|
7
|
+
import { get as Z, post as Yt } from "../../lib/commands.js";
|
|
8
|
+
import { useLabelFlash as Wt, flashFieldBox as Gt } from "../../lib/label-flash.js";
|
|
9
|
+
import { compareByMatch as Vt } from "../../lib/picker-rank.js";
|
|
10
|
+
import { useRecordReader as Lt } from "../../lib/record-loader.js";
|
|
11
|
+
import { useOnlineUsers as Xt } from "../../lib/use-online-users.js";
|
|
12
|
+
import { SearchHighlight as Zt } from "../SearchHighlight.js";
|
|
13
|
+
import { UserAvatar as Qt } from "../UserAvatar.js";
|
|
14
|
+
import { pickerOptionsMeta as vt } from "../../lib/live-pickers.js";
|
|
15
|
+
import { useOptionBadges as Bt } from "../../lib/picker-badges.js";
|
|
16
|
+
import { queryKeys as en } from "../../lib/query-keys.js";
|
|
17
|
+
import { matchesAllTokens as wt, userOptionFilter as tn, cn as Y } from "../../lib/utils.js";
|
|
17
18
|
import { applyDisplayTemplate as k } from "./helpers.js";
|
|
18
|
-
import { collidingIds as
|
|
19
|
-
import { RecordPickerBadges as
|
|
20
|
-
import { usePickerMissReport as
|
|
21
|
-
import { useLatestSearch as
|
|
22
|
-
import { retryRelatedRead as
|
|
23
|
-
function
|
|
19
|
+
import { collidingIds as nn, disambiguators as rn, isNamelessLabel as se, NAMELESS_LABEL as me } from "./option-disambiguate.js";
|
|
20
|
+
import { RecordPickerBadges as on, PickerBadgeList as sn } from "./PickerBadges.js";
|
|
21
|
+
import { usePickerMissReport as an } from "./picker-miss.js";
|
|
22
|
+
import { useLatestSearch as ln, onlyCloseMatches as kt, labelOnlyMatches as cn, narrowLocally as dn, PICKER_PAGE as un } from "./picker-search.js";
|
|
23
|
+
import { retryRelatedRead as Et, useRelatedMissing as qt, RelatedMissingLabel as Ct } from "./related-missing.js";
|
|
24
|
+
function mn(o) {
|
|
24
25
|
return o.replace(/\(.*$/, "").trim().split(/\s+/).map((r) => r[0]).filter(Boolean).slice(0, 2).join("").toUpperCase() || "?";
|
|
25
26
|
}
|
|
26
|
-
function
|
|
27
|
-
const [r,
|
|
28
|
-
onMouseEnter: (
|
|
27
|
+
function fn(o) {
|
|
28
|
+
const [r, b] = P(null), g = {
|
|
29
|
+
onMouseEnter: (C) => {
|
|
29
30
|
if (!o) return;
|
|
30
|
-
const
|
|
31
|
-
|
|
31
|
+
const N = C.currentTarget.getBoundingClientRect(), v = window.innerHeight - N.bottom < 80;
|
|
32
|
+
b({ x: N.left, y: v ? N.top - 58 : N.bottom + 4 });
|
|
32
33
|
},
|
|
33
|
-
onMouseLeave: () =>
|
|
34
|
-
},
|
|
34
|
+
onMouseLeave: () => b(null)
|
|
35
|
+
}, T = o && r ? St(
|
|
35
36
|
/* @__PURE__ */ s(
|
|
36
37
|
"div",
|
|
37
38
|
{
|
|
@@ -42,183 +43,187 @@ function ln(o) {
|
|
|
42
43
|
),
|
|
43
44
|
document.body
|
|
44
45
|
) : null;
|
|
45
|
-
return { bind: g, tip:
|
|
46
|
+
return { bind: g, tip: T };
|
|
46
47
|
}
|
|
47
|
-
function
|
|
48
|
+
function Nt(o, r) {
|
|
48
49
|
return o == null || o === "" || r == null || r === "" ? !1 : String(o) === String(r);
|
|
49
50
|
}
|
|
50
|
-
function
|
|
51
|
+
function pn({
|
|
51
52
|
collection: o,
|
|
52
53
|
value: r,
|
|
53
|
-
onChange:
|
|
54
|
+
onChange: b,
|
|
54
55
|
disabled: g,
|
|
55
|
-
placeholder:
|
|
56
|
-
extraFilter:
|
|
57
|
-
autoSelectSingle:
|
|
58
|
-
optionSort:
|
|
59
|
-
requiredParent:
|
|
60
|
-
facets:
|
|
61
|
-
fieldKey:
|
|
62
|
-
narrowedBy:
|
|
63
|
-
pinned:
|
|
64
|
-
missPlacement:
|
|
65
|
-
defaultOpen:
|
|
66
|
-
onClose:
|
|
67
|
-
displayTemplate:
|
|
56
|
+
placeholder: T,
|
|
57
|
+
extraFilter: C,
|
|
58
|
+
autoSelectSingle: N,
|
|
59
|
+
optionSort: v,
|
|
60
|
+
requiredParent: R,
|
|
61
|
+
facets: h,
|
|
62
|
+
fieldKey: f,
|
|
63
|
+
narrowedBy: m,
|
|
64
|
+
pinned: c,
|
|
65
|
+
missPlacement: D,
|
|
66
|
+
defaultOpen: Q,
|
|
67
|
+
onClose: M,
|
|
68
|
+
displayTemplate: Rt,
|
|
69
|
+
alreadyAdded: j
|
|
68
70
|
}) {
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
const B = Ae(), He = Lt(), [i, _] = P(Q ?? !1), [l, fe] = P(""), ie = F(() => {
|
|
72
|
+
const e = l.trim();
|
|
73
|
+
return !e || !(j != null && j.items.length) ? [] : j.items.filter((n) => wt(n.label, e)).slice(0, 3);
|
|
74
|
+
}, [l, j]), pe = I(M);
|
|
75
|
+
pe.current = M;
|
|
76
|
+
const Je = I(i);
|
|
77
|
+
y(() => {
|
|
73
78
|
var e;
|
|
74
|
-
|
|
79
|
+
Je.current && !i && ((e = pe.current) == null || e.call(pe)), Je.current = i;
|
|
75
80
|
}, [i]);
|
|
76
|
-
const [_t,
|
|
81
|
+
const [_t, $t] = P(!1), U = ln(l, _t), ze = I(null), ee = I(null), Le = I(null), A = I(null), Ee = xt(), Ye = xt(), [We, W] = P(-1), H = I(null), ae = () => {
|
|
77
82
|
var t;
|
|
78
|
-
const e =
|
|
83
|
+
const e = ze.current;
|
|
79
84
|
if (!e || document.activeElement === e) return;
|
|
80
85
|
e.focus({ preventScroll: !0 });
|
|
81
86
|
const n = e.value.length;
|
|
82
87
|
(t = e.setSelectionRange) == null || t.call(e, n, n);
|
|
83
88
|
};
|
|
84
|
-
|
|
85
|
-
i ? setTimeout(
|
|
89
|
+
y(() => {
|
|
90
|
+
i ? setTimeout(ae, 30) : (fe(""), H.current = null);
|
|
86
91
|
}, [i]);
|
|
87
|
-
const
|
|
92
|
+
const qe = I(!1), Ce = () => {
|
|
88
93
|
var e;
|
|
89
|
-
|
|
94
|
+
_(!1), (e = A.current) == null || e.focus(), qe.current = !0;
|
|
90
95
|
};
|
|
91
|
-
|
|
96
|
+
y(() => {
|
|
92
97
|
var n;
|
|
93
|
-
if (!
|
|
94
|
-
|
|
98
|
+
if (!qe.current) return;
|
|
99
|
+
qe.current = !1;
|
|
95
100
|
const e = document.activeElement;
|
|
96
|
-
(!e || e === document.body) && ((n =
|
|
97
|
-
}),
|
|
101
|
+
(!e || e === document.body) && ((n = A.current) == null || n.focus());
|
|
102
|
+
}), y(() => {
|
|
98
103
|
if (!i) return;
|
|
99
104
|
const e = (n) => {
|
|
100
|
-
var
|
|
105
|
+
var q, $, ue;
|
|
101
106
|
if (n.key !== "Escape") return;
|
|
102
107
|
const t = document.activeElement;
|
|
103
|
-
(t === document.body || t && ((
|
|
108
|
+
(t === document.body || t && ((q = Le.current) != null && q.contains(t) || ($ = ee.current) != null && $.contains(t))) && (n.preventDefault(), n.stopPropagation(), _(!1), (ue = A.current) == null || ue.focus());
|
|
104
109
|
};
|
|
105
110
|
return window.addEventListener("keydown", e, !0), () => window.removeEventListener("keydown", e, !0);
|
|
106
|
-
}, [i]),
|
|
111
|
+
}, [i]), y(() => {
|
|
107
112
|
if (!i) return;
|
|
108
113
|
const e = (n) => {
|
|
109
|
-
var a,
|
|
114
|
+
var a, q;
|
|
110
115
|
const t = n.target;
|
|
111
|
-
!t || t === document.body || (a = t.closest) != null && a.call(t, "[data-nvr-combobox-panel]") || (
|
|
116
|
+
!t || t === document.body || (a = t.closest) != null && a.call(t, "[data-nvr-combobox-panel]") || (q = ee.current) != null && q.contains(t) || _(!1);
|
|
112
117
|
};
|
|
113
118
|
return document.addEventListener("focusin", e), () => document.removeEventListener("focusin", e);
|
|
114
|
-
}, [i]),
|
|
119
|
+
}, [i]), y(() => {
|
|
115
120
|
if (!i) return;
|
|
116
121
|
const e = (n) => {
|
|
117
122
|
var a;
|
|
118
123
|
const t = n.target;
|
|
119
|
-
(a = t == null ? void 0 : t.closest) != null && a.call(t, "[data-nvr-combobox-panel]") ||
|
|
124
|
+
(a = t == null ? void 0 : t.closest) != null && a.call(t, "[data-nvr-combobox-panel]") || ee.current && !ee.current.contains(n.target) && _(!1);
|
|
120
125
|
};
|
|
121
126
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
122
127
|
}, [i]);
|
|
123
|
-
const [
|
|
124
|
-
|
|
128
|
+
const [Re, _e] = P(null), [$e, Dt] = P(null);
|
|
129
|
+
yt(() => {
|
|
125
130
|
if (!i) {
|
|
126
|
-
|
|
131
|
+
_e(null);
|
|
127
132
|
return;
|
|
128
133
|
}
|
|
129
134
|
const e = () => {
|
|
130
|
-
const n =
|
|
135
|
+
const n = ee.current;
|
|
131
136
|
if (!n) return;
|
|
132
137
|
const t = n.getBoundingClientRect(), a = n.closest('[role="dialog"]') ?? document.body;
|
|
133
|
-
|
|
134
|
-
const
|
|
138
|
+
Dt(a);
|
|
139
|
+
const q = window.innerHeight - t.bottom < 340 && t.top > window.innerHeight - t.bottom, $ = t.left, ue = q ? t.top - 4 : t.bottom + 4, ft = {
|
|
135
140
|
minWidth: t.width,
|
|
136
141
|
zIndex: 120,
|
|
137
|
-
...
|
|
142
|
+
...q ? { transform: "translateY(-100%)" } : {}
|
|
138
143
|
};
|
|
139
144
|
if (a === document.body)
|
|
140
|
-
|
|
145
|
+
_e({ position: "fixed", left: $, top: ue, ...ft });
|
|
141
146
|
else {
|
|
142
|
-
const
|
|
143
|
-
|
|
147
|
+
const pt = a.getBoundingClientRect();
|
|
148
|
+
_e({ position: "absolute", left: $ - pt.left, top: ue - pt.top, ...ft });
|
|
144
149
|
}
|
|
145
150
|
};
|
|
146
151
|
return e(), window.addEventListener("scroll", e, !0), window.addEventListener("resize", e), () => {
|
|
147
152
|
window.removeEventListener("scroll", e, !0), window.removeEventListener("resize", e);
|
|
148
153
|
};
|
|
149
154
|
}, [i]);
|
|
150
|
-
const
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}, [
|
|
154
|
-
const { data:
|
|
155
|
+
const Ge = i && !!Re && !!$e;
|
|
156
|
+
yt(() => {
|
|
157
|
+
Ge && document.activeElement === A.current && ae();
|
|
158
|
+
}, [Ge]);
|
|
159
|
+
const { data: De, isPending: Ve } = K({
|
|
155
160
|
queryKey: ["col-meta", o],
|
|
156
|
-
queryFn: () =>
|
|
161
|
+
queryFn: () => B.request(Z(`/collections/${o}`)).then((e) => e.data),
|
|
157
162
|
staleTime: 3e5,
|
|
158
163
|
retry: !1
|
|
159
|
-
}), [
|
|
160
|
-
queryKey:
|
|
161
|
-
queryFn: () =>
|
|
162
|
-
|
|
164
|
+
}), [Fe, Ft] = P({}), { data: Xe = [] } = K({
|
|
165
|
+
queryKey: en.collectionRelations(o),
|
|
166
|
+
queryFn: () => B.request(
|
|
167
|
+
Z(`/collections/${o}`)
|
|
163
168
|
).then(
|
|
164
169
|
(e) => {
|
|
165
170
|
var n;
|
|
166
171
|
return ((n = e.data) == null ? void 0 : n.relations) ?? [];
|
|
167
172
|
}
|
|
168
173
|
),
|
|
169
|
-
enabled: !!(
|
|
174
|
+
enabled: !!(h != null && h.length),
|
|
170
175
|
staleTime: 10 * 6e4
|
|
171
|
-
}),
|
|
176
|
+
}), It = F(() => {
|
|
172
177
|
const e = {};
|
|
173
|
-
for (const n of
|
|
174
|
-
const t =
|
|
178
|
+
for (const n of h ?? []) {
|
|
179
|
+
const t = Xe.find(
|
|
175
180
|
(a) => a.many_collection === o && a.many_field === n.field && !a.junction_field
|
|
176
181
|
);
|
|
177
182
|
t != null && t.one_collection && (e[n.field] = t.one_collection);
|
|
178
183
|
}
|
|
179
184
|
return e;
|
|
180
|
-
}, [
|
|
185
|
+
}, [h, Xe, o]), J = o === "nivaro_users", Kt = Xt(J), Ze = Jt().isAdmin, Ie = F(() => {
|
|
181
186
|
const e = [];
|
|
182
|
-
|
|
183
|
-
for (const [n, t] of Object.entries(
|
|
187
|
+
J && e.push(tn(Ze)), C && e.push(C);
|
|
188
|
+
for (const [n, t] of Object.entries(Fe))
|
|
184
189
|
t != null && t !== "" && e.push({ [n]: { _eq: t } });
|
|
185
190
|
if (e.length !== 0)
|
|
186
191
|
return e.length === 1 ? e[0] : { _and: e };
|
|
187
|
-
}, [
|
|
188
|
-
if (!
|
|
189
|
-
const e = [...
|
|
192
|
+
}, [C, Fe, Ze]), te = Rt || (De == null ? void 0 : De.display_template) || (J ? "{{first_name}} {{last_name}} ({{email}})" : null), w = F(() => {
|
|
193
|
+
if (!te) return;
|
|
194
|
+
const e = [...te.matchAll(/\{\{([\w.]+)\}\}/g)].map((n) => n[1]);
|
|
190
195
|
if (e.length)
|
|
191
196
|
return [.../* @__PURE__ */ new Set(["id", ...e])].join(",");
|
|
192
|
-
}, [
|
|
193
|
-
|
|
194
|
-
limit:
|
|
197
|
+
}, [te]), S = Ie ? JSON.stringify(Ie) : void 0, G = v && !/^-?label$/.test(v) ? v : void 0, Qe = (e) => B.request(
|
|
198
|
+
Z(`/items/${o}`, {
|
|
199
|
+
limit: un,
|
|
195
200
|
picker: "1",
|
|
196
201
|
// Typo pass (fix11-search): only when the exact search finds nothing,
|
|
197
202
|
// the server answers close matches, each marked `fuzzy`.
|
|
198
203
|
...e.trim() ? { search: e.trim(), typo: "1" } : {},
|
|
199
204
|
...S ? { filter: S } : {},
|
|
200
|
-
...
|
|
201
|
-
...
|
|
205
|
+
...w ? { fields: w } : {},
|
|
206
|
+
...G ? { sort: G } : {}
|
|
202
207
|
})
|
|
203
208
|
).then((n) => n.data ?? []), {
|
|
204
|
-
data:
|
|
205
|
-
isFetching:
|
|
206
|
-
isPlaceholderData:
|
|
207
|
-
} =
|
|
209
|
+
data: d,
|
|
210
|
+
isFetching: V,
|
|
211
|
+
isPlaceholderData: Ke
|
|
212
|
+
} = K({
|
|
208
213
|
queryKey: [
|
|
209
214
|
"relation-opts",
|
|
210
215
|
o,
|
|
211
|
-
|
|
216
|
+
U,
|
|
212
217
|
S,
|
|
213
|
-
|
|
214
|
-
|
|
218
|
+
w,
|
|
219
|
+
G ?? ""
|
|
215
220
|
],
|
|
216
|
-
queryFn: () =>
|
|
221
|
+
queryFn: () => Qe(U),
|
|
217
222
|
// Wait for the display template: it decides `fields`, and starting before
|
|
218
223
|
// it lands sent the whole first page twice.
|
|
219
|
-
enabled: i && !
|
|
224
|
+
enabled: i && !Ve,
|
|
220
225
|
// Someone else's new / changed / removed record: re-read on the next open (live-pickers.ts).
|
|
221
|
-
meta:
|
|
226
|
+
meta: vt(o),
|
|
222
227
|
staleTime: S ? 0 : 3e4,
|
|
223
228
|
// A new SEARCH keeps the previous answer on screen (narrowed locally below)
|
|
224
229
|
// instead of blanking the list behind a spinner. A changed filter, sort or
|
|
@@ -226,58 +231,58 @@ function cn({
|
|
|
226
231
|
placeholderData: (e, n) => {
|
|
227
232
|
const t = n == null ? void 0 : n.queryKey;
|
|
228
233
|
if (!(!e || !t))
|
|
229
|
-
return t[1] === o && t[3] === S && t[4] ===
|
|
234
|
+
return t[1] === o && t[3] === S && t[4] === w && t[5] === (G ?? "") ? e : void 0;
|
|
230
235
|
}
|
|
231
236
|
});
|
|
232
|
-
|
|
233
|
-
const
|
|
234
|
-
queryKey: ["relation-opts", o, "", S,
|
|
235
|
-
queryFn: () =>
|
|
236
|
-
enabled: i && !
|
|
237
|
-
meta:
|
|
237
|
+
y(() => $t(V), [V]);
|
|
238
|
+
const ge = !!U.trim() && l === U && !Ke && !V && d !== void 0 && (d.length === 0 || kt(d)), { data: he } = K({
|
|
239
|
+
queryKey: ["relation-opts", o, "", S, w, G ?? ""],
|
|
240
|
+
queryFn: () => Qe(""),
|
|
241
|
+
enabled: i && !Ve && ge,
|
|
242
|
+
meta: vt(o),
|
|
238
243
|
staleTime: S ? 0 : 3e4
|
|
239
|
-
}),
|
|
240
|
-
() =>
|
|
241
|
-
|
|
242
|
-
(e) => k(
|
|
243
|
-
|
|
244
|
+
}), O = F(
|
|
245
|
+
() => ge && he ? cn(
|
|
246
|
+
he,
|
|
247
|
+
(e) => k(te, e) || "",
|
|
248
|
+
l
|
|
244
249
|
) : null,
|
|
245
|
-
[
|
|
246
|
-
),
|
|
247
|
-
|
|
248
|
-
placement:
|
|
250
|
+
[ge, he, te, l]
|
|
251
|
+
), Be = ge && he === void 0, le = !!d && kt(d) && !(O && O.length > 0);
|
|
252
|
+
an({
|
|
253
|
+
placement: D,
|
|
249
254
|
open: i,
|
|
250
|
-
search:
|
|
251
|
-
settled: !
|
|
252
|
-
count: (
|
|
255
|
+
search: U,
|
|
256
|
+
settled: !V && !Ke && d !== void 0 && !Be,
|
|
257
|
+
count: (O == null ? void 0 : O.length) ?? (d == null ? void 0 : d.length) ?? 0
|
|
253
258
|
});
|
|
254
259
|
const {
|
|
255
|
-
data:
|
|
256
|
-
isLoading:
|
|
257
|
-
error:
|
|
258
|
-
isFetched:
|
|
259
|
-
} =
|
|
260
|
-
queryKey: ["relation-single", o, String(r),
|
|
261
|
-
queryFn: () =>
|
|
260
|
+
data: ne,
|
|
261
|
+
isLoading: et,
|
|
262
|
+
error: tt,
|
|
263
|
+
isFetched: Mt
|
|
264
|
+
} = K({
|
|
265
|
+
queryKey: ["relation-single", o, String(r), w],
|
|
266
|
+
queryFn: () => He(o, r, w),
|
|
262
267
|
enabled: !!r,
|
|
263
268
|
staleTime: 6e4,
|
|
264
|
-
retry:
|
|
265
|
-
}),
|
|
266
|
-
|
|
267
|
-
|
|
269
|
+
retry: Et
|
|
270
|
+
}), nt = !!r && !et && Mt && !ne, { settling: rt } = qt(
|
|
271
|
+
tt,
|
|
272
|
+
nt ? o : null,
|
|
268
273
|
r
|
|
269
|
-
), L = (
|
|
270
|
-
queryKey: ["relation-single", o, L ?? "",
|
|
271
|
-
queryFn: () =>
|
|
274
|
+
), L = (c == null ? void 0 : c.id) != null && c.id !== "" ? String(c.id) : null, { data: z } = K({
|
|
275
|
+
queryKey: ["relation-single", o, L ?? "", w],
|
|
276
|
+
queryFn: () => He(o, L, w).catch(
|
|
272
277
|
() => null
|
|
273
278
|
),
|
|
274
279
|
enabled: !!L && i,
|
|
275
280
|
staleTime: 6e4
|
|
276
|
-
}),
|
|
281
|
+
}), Ot = JSON.stringify(C ? { _and: [{ id: { _eq: r } }, C] } : { id: { _eq: r } }), { data: be } = K({
|
|
277
282
|
queryKey: ["relation-avail", o, String(r), S],
|
|
278
|
-
queryFn: () =>
|
|
279
|
-
|
|
280
|
-
filter:
|
|
283
|
+
queryFn: () => B.request(
|
|
284
|
+
Z(`/items/${o}`, {
|
|
285
|
+
filter: Ot,
|
|
281
286
|
picker: "1",
|
|
282
287
|
limit: 1,
|
|
283
288
|
fields: "id"
|
|
@@ -286,18 +291,18 @@ function cn({
|
|
|
286
291
|
// The pinned option is offered OUTSIDE the option filter (a type's generic
|
|
287
292
|
// item is excluded from the general list on purpose), so a value that IS
|
|
288
293
|
// the pin is available by construction — never probe it, never flag it.
|
|
289
|
-
enabled: !!r && !!
|
|
294
|
+
enabled: !!r && !!ne && String(r) !== L,
|
|
290
295
|
staleTime: 3e4
|
|
291
|
-
}),
|
|
292
|
-
|
|
293
|
-
},
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
}, [
|
|
297
|
-
if (!
|
|
298
|
-
const e =
|
|
299
|
-
|
|
300
|
-
|
|
296
|
+
}), ce = !!r && String(r) !== L && be !== void 0 && be.length === 0, xe = I(null), Me = I(!1), ot = `${o}|${S ?? ""}`, Pt = () => {
|
|
297
|
+
Me.current = !0, xe.current = ot, b(null);
|
|
298
|
+
}, ye = r == null || r === "";
|
|
299
|
+
y(() => {
|
|
300
|
+
ye || (Me.current = !1);
|
|
301
|
+
}, [ye]), y(() => {
|
|
302
|
+
if (!N || g || !ye || Me.current) return;
|
|
303
|
+
const e = ot;
|
|
304
|
+
xe.current !== e && (xe.current = e, B.request(
|
|
305
|
+
Z(`/items/${o}`, {
|
|
301
306
|
limit: 2,
|
|
302
307
|
picker: "1",
|
|
303
308
|
fields: "id",
|
|
@@ -306,138 +311,142 @@ function cn({
|
|
|
306
311
|
).then((n) => {
|
|
307
312
|
var a;
|
|
308
313
|
const t = n.data ?? [];
|
|
309
|
-
t.length === 1 && ((a = t[0]) == null ? void 0 : a.id) != null &&
|
|
314
|
+
t.length === 1 && ((a = t[0]) == null ? void 0 : a.id) != null && b(t[0].id);
|
|
310
315
|
}).catch(() => {
|
|
311
|
-
|
|
316
|
+
xe.current = null;
|
|
312
317
|
}));
|
|
313
|
-
}, [
|
|
314
|
-
const
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
+
}, [N, g, ye, o, S]);
|
|
319
|
+
const x = te, Oe = r && ne ? k(x, ne) : null, ve = Oe === null ? null : se(Oe) ? me : Oe, we = Wt(r, ve);
|
|
320
|
+
y(() => {
|
|
321
|
+
we > 0 && Gt(A.current);
|
|
322
|
+
}, [we]);
|
|
323
|
+
const X = !Ke && l === U && !Be, Pe = F(
|
|
324
|
+
() => (O && (O.length > 0 || !(d != null && d.length)) ? O : null) ?? dn(
|
|
325
|
+
d ?? [],
|
|
326
|
+
(e) => k(x, e) || `#${e.id}`,
|
|
318
327
|
// The server also reads a joined code by its parts ("2026-NNO-POWER"
|
|
319
328
|
// finds 2026-WEST-NNO-HE-POWERING, services/search-synonyms.ts), so
|
|
320
329
|
// the list narrowed while that search is out does too.
|
|
321
|
-
|
|
322
|
-
|
|
330
|
+
l.replace(/[-_/]+/g, " "),
|
|
331
|
+
X
|
|
323
332
|
),
|
|
324
|
-
[
|
|
325
|
-
),
|
|
326
|
-
() =>
|
|
327
|
-
[
|
|
328
|
-
), { data:
|
|
329
|
-
queryKey: ["relation-opts-dups", o,
|
|
330
|
-
queryFn: () =>
|
|
331
|
-
|
|
332
|
-
limit:
|
|
333
|
+
[d, x, l, X, O]
|
|
334
|
+
), ke = F(
|
|
335
|
+
() => nn(d ?? [], (e) => k(x, e) || `#${e.id}`),
|
|
336
|
+
[d, x]
|
|
337
|
+
), { data: de } = K({
|
|
338
|
+
queryKey: ["relation-opts-dups", o, ke.join(",")],
|
|
339
|
+
queryFn: () => B.request(
|
|
340
|
+
Z(`/items/${o}`, {
|
|
341
|
+
limit: ke.length,
|
|
333
342
|
picker: "1",
|
|
334
|
-
filter: JSON.stringify({ id: { _in:
|
|
343
|
+
filter: JSON.stringify({ id: { _in: ke } }),
|
|
335
344
|
fields: "*"
|
|
336
345
|
})
|
|
337
346
|
).then((e) => e.data ?? []),
|
|
338
|
-
enabled: i &&
|
|
347
|
+
enabled: i && ke.length > 0 && !J,
|
|
339
348
|
staleTime: 6e4
|
|
340
|
-
}),
|
|
341
|
-
if (!(
|
|
349
|
+
}), st = F(() => {
|
|
350
|
+
if (!(de != null && de.length)) return /* @__PURE__ */ new Map();
|
|
342
351
|
const e = new Map(
|
|
343
|
-
(
|
|
352
|
+
(d ?? []).map((t) => [
|
|
344
353
|
String(t.id),
|
|
345
|
-
(k(
|
|
354
|
+
(k(x, t) || `#${t.id}`).trim().toLowerCase()
|
|
346
355
|
])
|
|
347
356
|
), n = /* @__PURE__ */ new Map();
|
|
348
|
-
for (const t of
|
|
357
|
+
for (const t of de) {
|
|
349
358
|
const a = e.get(String(t.id));
|
|
350
359
|
a !== void 0 && n.set(a, [...n.get(a) ?? [], t]);
|
|
351
360
|
}
|
|
352
|
-
return
|
|
361
|
+
return rn(
|
|
353
362
|
[...n.values()],
|
|
354
|
-
((
|
|
363
|
+
((w == null ? void 0 : w.split(",")) ?? []).map((t) => t.split(".")[0])
|
|
355
364
|
);
|
|
356
|
-
}, [
|
|
357
|
-
() => (
|
|
358
|
-
[
|
|
359
|
-
),
|
|
360
|
-
() => (
|
|
361
|
-
(e, n) =>
|
|
362
|
-
k(
|
|
363
|
-
k(
|
|
364
|
-
|
|
365
|
-
|
|
365
|
+
}, [de, d, x, w]), Tt = !!r && et && !ne || rt, it = fn(ce), at = F(
|
|
366
|
+
() => (d ?? []).some((e) => !se(k(x, e))),
|
|
367
|
+
[d, x]
|
|
368
|
+
), re = F(
|
|
369
|
+
() => (G ? [...Pe] : [...Pe].sort(
|
|
370
|
+
(e, n) => Vt(
|
|
371
|
+
k(x, e),
|
|
372
|
+
k(x, n),
|
|
373
|
+
l,
|
|
374
|
+
v === "-label"
|
|
366
375
|
)
|
|
367
376
|
)).filter((e) => !L || String(e.id) !== L).filter(
|
|
368
|
-
(e) => !
|
|
377
|
+
(e) => !at || String(e.id) === String(r) || !se(k(x, e))
|
|
369
378
|
),
|
|
370
|
-
[
|
|
371
|
-
),
|
|
379
|
+
[Pe, G, x, l, v, L, r, at]
|
|
380
|
+
), jt = Bt(
|
|
372
381
|
o,
|
|
373
|
-
|
|
374
|
-
i && !
|
|
375
|
-
),
|
|
376
|
-
`${
|
|
377
|
-
|
|
378
|
-
)),
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
}, [i,
|
|
382
|
-
const
|
|
383
|
-
const e = (
|
|
384
|
-
|
|
385
|
-
},
|
|
386
|
-
|
|
387
|
-
},
|
|
388
|
-
e < 0 || e >=
|
|
382
|
+
re.map((e) => e.id),
|
|
383
|
+
i && !J
|
|
384
|
+
), lt = z && !se(k(x, z)) ? k(x, z) : me, Te = !!L && (!l.trim() || wt(
|
|
385
|
+
`${z ? lt : ""} ${(c == null ? void 0 : c.tag) ?? "Default"}`,
|
|
386
|
+
l.replace(/[-_/]+/g, " ")
|
|
387
|
+
)), oe = Te ? 1 : 0, E = oe + re.length, p = We >= E ? E - 1 : We;
|
|
388
|
+
y(() => {
|
|
389
|
+
W(i && l.trim() && !le ? oe : -1);
|
|
390
|
+
}, [i, l, oe, le]);
|
|
391
|
+
const je = (e) => `${Ee}-opt-${e}`, ct = () => {
|
|
392
|
+
const e = (z == null ? void 0 : z.id) ?? (c == null ? void 0 : c.id);
|
|
393
|
+
Nt(r, e) || b(e), Ce();
|
|
394
|
+
}, dt = (e) => {
|
|
395
|
+
Nt(r, e.id) || b(e.id), Ce();
|
|
396
|
+
}, Ne = (e) => {
|
|
397
|
+
e < 0 || e >= E || (e < oe ? ct() : dt(re[e - oe]));
|
|
389
398
|
};
|
|
390
|
-
|
|
399
|
+
y(() => {
|
|
391
400
|
var n, t;
|
|
392
401
|
if (!i || p < 0) return;
|
|
393
|
-
const e = (n =
|
|
402
|
+
const e = (n = Le.current) == null ? void 0 : n.querySelector(`[data-nav-index="${p}"]`);
|
|
394
403
|
(t = e == null ? void 0 : e.scrollIntoView) == null || t.call(e, { block: "nearest" });
|
|
395
|
-
}, [i, p]),
|
|
396
|
-
const e =
|
|
404
|
+
}, [i, p]), y(() => {
|
|
405
|
+
const e = H.current;
|
|
397
406
|
if (e !== null) {
|
|
398
|
-
if (!i || e !==
|
|
399
|
-
|
|
407
|
+
if (!i || e !== l) {
|
|
408
|
+
H.current = null;
|
|
400
409
|
return;
|
|
401
410
|
}
|
|
402
|
-
|
|
411
|
+
X && (H.current = null, p >= 0 ? Ne(p) : E === 1 && d !== void 0 && !le && Ne(0));
|
|
403
412
|
}
|
|
404
|
-
}, [i,
|
|
405
|
-
const
|
|
413
|
+
}, [i, l, X, p, E]);
|
|
414
|
+
const ut = (e) => {
|
|
406
415
|
var n;
|
|
407
|
-
e.key === "ArrowDown" ? (e.preventDefault(),
|
|
408
|
-
},
|
|
416
|
+
e.key === "ArrowDown" ? (e.preventDefault(), E > 0 && W(p < 0 ? 0 : Math.min(p + 1, E - 1))) : e.key === "ArrowUp" ? (e.preventDefault(), E > 0 && W(p <= 0 ? 0 : p - 1)) : e.key === "Home" && E > 0 && !l ? (e.preventDefault(), W(0)) : e.key === "End" && E > 0 && !l ? (e.preventDefault(), W(E - 1)) : e.key === "Enter" ? (e.preventDefault(), l.trim() && !X ? H.current = l : p >= 0 ? Ne(p) : E === 1 && X && d !== void 0 && !le && Ne(0)) : e.key === "Tab" && (_(!1), (n = A.current) == null || n.focus());
|
|
417
|
+
}, mt = (e) => {
|
|
409
418
|
if (g) return;
|
|
410
419
|
const n = e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey && (i || e.key !== " ");
|
|
411
420
|
if (!i && (e.key === "ArrowDown" || e.key === "ArrowUp"))
|
|
412
|
-
e.preventDefault(),
|
|
421
|
+
e.preventDefault(), _(!0);
|
|
413
422
|
else if (n) {
|
|
414
423
|
e.preventDefault();
|
|
415
424
|
const t = e.key;
|
|
416
|
-
|
|
417
|
-
} else i && e.key === "Backspace" ? (e.preventDefault(),
|
|
418
|
-
},
|
|
419
|
-
return
|
|
420
|
-
!
|
|
421
|
-
}, [
|
|
425
|
+
H.current = null, fe((a) => t === " " && (a === "" || a.endsWith(" ")) ? a : a + t), i ? ae() : _(!0);
|
|
426
|
+
} else i && e.key === "Backspace" ? (e.preventDefault(), H.current = null, fe((t) => t.slice(0, -1)), ae()) : i && (e.key === "Enter" || e.key === "ArrowDown" || e.key === "ArrowUp" || e.key === "Home" || e.key === "End") && (ut(e), ae());
|
|
427
|
+
}, Ue = zt();
|
|
428
|
+
return y(() => {
|
|
429
|
+
!Ue || !f || be === void 0 || Ue(f, ce);
|
|
430
|
+
}, [Ue, f, ce, be]), R ? /* @__PURE__ */ u(
|
|
422
431
|
"button",
|
|
423
432
|
{
|
|
424
433
|
type: "button",
|
|
425
434
|
disabled: !0,
|
|
426
435
|
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",
|
|
427
436
|
children: [
|
|
428
|
-
/* @__PURE__ */
|
|
437
|
+
/* @__PURE__ */ u("span", { className: "truncate text-muted-foreground", children: [
|
|
429
438
|
"Select ",
|
|
430
|
-
|
|
439
|
+
R,
|
|
431
440
|
" first"
|
|
432
441
|
] }),
|
|
433
|
-
/* @__PURE__ */ s(
|
|
442
|
+
/* @__PURE__ */ s(ht, { className: "h-4 w-4 shrink-0 opacity-50" })
|
|
434
443
|
]
|
|
435
444
|
}
|
|
436
445
|
) : (
|
|
437
446
|
// Stale tooltip binds on the WRAPPER: a disabled trigger button swallows
|
|
438
447
|
// mouse events, so a locked-but-stale field would never show the hint.
|
|
439
|
-
/* @__PURE__ */
|
|
440
|
-
|
|
448
|
+
/* @__PURE__ */ u("div", { ref: ee, className: "relative", ...it.bind, children: [
|
|
449
|
+
nt && !rt ? (
|
|
441
450
|
// A value the reader cannot open is words, not a button: the field
|
|
442
451
|
// says the value is hidden from them (or gone) and, when it may be
|
|
443
452
|
// edited, offers the one thing they can do about it. It used to be
|
|
@@ -446,37 +455,37 @@ function cn({
|
|
|
446
455
|
// 2026-11-12); locked, that button was dead as well.
|
|
447
456
|
// biome-ignore lint/a11y/noStaticElementInteractions: a pointer shortcut only; "Change" inside is the control a keyboard and a screen reader reach
|
|
448
457
|
// biome-ignore lint/a11y/useKeyWithClickEvents: as above — the keys are handled on "Change"
|
|
449
|
-
/* @__PURE__ */
|
|
458
|
+
/* @__PURE__ */ u(
|
|
450
459
|
"div",
|
|
451
460
|
{
|
|
452
461
|
"data-related-unavailable-field": "",
|
|
453
462
|
onClick: g ? void 0 : (e) => {
|
|
454
|
-
e.target.closest("button") ||
|
|
463
|
+
e.target.closest("button") || _((n) => !n);
|
|
455
464
|
},
|
|
456
|
-
className:
|
|
465
|
+
className: Y(
|
|
457
466
|
"flex h-9 w-full items-center gap-2 rounded-md border border-slate-200 bg-slate-50 px-3 text-sm dark:border-border dark:bg-muted/40",
|
|
458
467
|
!g && "cursor-pointer"
|
|
459
468
|
),
|
|
460
469
|
children: [
|
|
461
470
|
/* @__PURE__ */ s("span", { className: "min-w-0 flex-1 truncate", children: /* @__PURE__ */ s(
|
|
462
|
-
|
|
471
|
+
Ct,
|
|
463
472
|
{
|
|
464
|
-
error:
|
|
473
|
+
error: tt,
|
|
465
474
|
collection: o,
|
|
466
475
|
id: r,
|
|
467
|
-
labelId:
|
|
476
|
+
labelId: Ye
|
|
468
477
|
}
|
|
469
478
|
) }),
|
|
470
479
|
!g && /* @__PURE__ */ s(
|
|
471
480
|
"button",
|
|
472
481
|
{
|
|
473
|
-
ref:
|
|
482
|
+
ref: A,
|
|
474
483
|
type: "button",
|
|
475
484
|
"aria-haspopup": "listbox",
|
|
476
485
|
"aria-expanded": i,
|
|
477
|
-
"aria-describedby":
|
|
478
|
-
onClick: () =>
|
|
479
|
-
onKeyDown:
|
|
486
|
+
"aria-describedby": Ye,
|
|
487
|
+
onClick: () => _((e) => !e),
|
|
488
|
+
onKeyDown: mt,
|
|
480
489
|
className: "-mr-1 shrink-0 rounded border border-slate-300 px-2 py-0.5 text-[11px] font-medium text-slate-700 hover:bg-slate-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/60 dark:border-slate-600",
|
|
481
490
|
children: "Change"
|
|
482
491
|
}
|
|
@@ -484,32 +493,32 @@ function cn({
|
|
|
484
493
|
]
|
|
485
494
|
}
|
|
486
495
|
)
|
|
487
|
-
) : /* @__PURE__ */
|
|
496
|
+
) : /* @__PURE__ */ u(
|
|
488
497
|
"button",
|
|
489
498
|
{
|
|
490
|
-
ref:
|
|
499
|
+
ref: A,
|
|
491
500
|
type: "button",
|
|
492
501
|
disabled: g,
|
|
493
502
|
"aria-haspopup": "listbox",
|
|
494
503
|
"aria-expanded": i,
|
|
495
|
-
onClick: () =>
|
|
496
|
-
onKeyDown:
|
|
497
|
-
className:
|
|
504
|
+
onClick: () => _((e) => !e),
|
|
505
|
+
onKeyDown: mt,
|
|
506
|
+
className: Y(
|
|
498
507
|
"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",
|
|
499
|
-
|
|
508
|
+
ce ? "border-amber-300 dark:border-amber-600" : "border-input"
|
|
500
509
|
),
|
|
501
510
|
children: [
|
|
502
|
-
|
|
511
|
+
Tt ? /* @__PURE__ */ s(Se, { className: "h-3.5 w-3.5 animate-spin text-muted-foreground" }) : /* @__PURE__ */ u(
|
|
503
512
|
"span",
|
|
504
513
|
{
|
|
505
|
-
className:
|
|
514
|
+
className: Y(
|
|
506
515
|
"flex items-center gap-1.5 truncate min-w-0",
|
|
507
|
-
(!
|
|
516
|
+
(!ve || ve === me) && "text-muted-foreground"
|
|
508
517
|
),
|
|
509
518
|
children: [
|
|
510
|
-
|
|
519
|
+
ce && /* @__PURE__ */ u(gt, { children: [
|
|
511
520
|
/* @__PURE__ */ s(
|
|
512
|
-
|
|
521
|
+
Ut,
|
|
513
522
|
{
|
|
514
523
|
"aria-hidden": "true",
|
|
515
524
|
className: "h-3.5 w-3.5 shrink-0 text-amber-500"
|
|
@@ -517,38 +526,46 @@ function cn({
|
|
|
517
526
|
),
|
|
518
527
|
/* @__PURE__ */ s("span", { className: "sr-only", children: "Not an available option: " })
|
|
519
528
|
] }),
|
|
520
|
-
/* @__PURE__ */ s(
|
|
521
|
-
|
|
529
|
+
/* @__PURE__ */ s(
|
|
530
|
+
"span",
|
|
531
|
+
{
|
|
532
|
+
"data-label-flash": we > 0 || void 0,
|
|
533
|
+
className: "truncate",
|
|
534
|
+
children: ve ?? T ?? "Select…"
|
|
535
|
+
},
|
|
536
|
+
we
|
|
537
|
+
),
|
|
538
|
+
!!r && !!ne && !J && /* @__PURE__ */ s(on, { collection: o, id: r })
|
|
522
539
|
]
|
|
523
540
|
}
|
|
524
541
|
),
|
|
525
|
-
/* @__PURE__ */ s(
|
|
542
|
+
/* @__PURE__ */ s(ht, { className: "h-4 w-4 shrink-0 opacity-50" })
|
|
526
543
|
]
|
|
527
544
|
}
|
|
528
545
|
),
|
|
529
|
-
|
|
530
|
-
i &&
|
|
531
|
-
/* @__PURE__ */
|
|
546
|
+
it.tip,
|
|
547
|
+
i && Re && $e && St(
|
|
548
|
+
/* @__PURE__ */ u(
|
|
532
549
|
"div",
|
|
533
550
|
{
|
|
534
|
-
ref:
|
|
551
|
+
ref: Le,
|
|
535
552
|
"data-nvr-combobox-panel": "",
|
|
536
|
-
style:
|
|
537
|
-
className:
|
|
553
|
+
style: Re,
|
|
554
|
+
className: Y(
|
|
538
555
|
"nvr-pop-in rounded-md border border-border bg-popover shadow-md",
|
|
539
|
-
|
|
556
|
+
h != null && h.length ? "w-[560px] max-w-[92vw]" : "min-w-[240px] w-max max-w-[360px]"
|
|
540
557
|
),
|
|
541
558
|
children: [
|
|
542
|
-
!!(
|
|
543
|
-
const n =
|
|
544
|
-
return n ? /* @__PURE__ */
|
|
559
|
+
!!(h != null && h.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: h.map((e) => {
|
|
560
|
+
const n = It[e.field];
|
|
561
|
+
return n ? /* @__PURE__ */ u("div", { children: [
|
|
545
562
|
/* @__PURE__ */ s("p", { className: "mb-0.5 text-[10px] font-medium uppercase tracking-wide text-slate-400", children: e.label ?? e.field }),
|
|
546
563
|
/* @__PURE__ */ s(
|
|
547
|
-
|
|
564
|
+
pn,
|
|
548
565
|
{
|
|
549
566
|
collection: n,
|
|
550
|
-
value:
|
|
551
|
-
onChange: (t) =>
|
|
567
|
+
value: Fe[e.field] ?? null,
|
|
568
|
+
onChange: (t) => Ft((a) => ({ ...a, [e.field]: t })),
|
|
552
569
|
placeholder: "Any",
|
|
553
570
|
optionSort: e.sort,
|
|
554
571
|
extraFilter: e.filter
|
|
@@ -556,63 +573,63 @@ function cn({
|
|
|
556
573
|
)
|
|
557
574
|
] }, e.field) : null;
|
|
558
575
|
}) }),
|
|
559
|
-
/* @__PURE__ */
|
|
560
|
-
/* @__PURE__ */ s(
|
|
576
|
+
/* @__PURE__ */ u("div", { className: "flex items-center border-b px-3", children: [
|
|
577
|
+
/* @__PURE__ */ s(At, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }),
|
|
561
578
|
/* @__PURE__ */ s(
|
|
562
579
|
"input",
|
|
563
580
|
{
|
|
564
|
-
ref:
|
|
565
|
-
value:
|
|
581
|
+
ref: ze,
|
|
582
|
+
value: l,
|
|
566
583
|
onChange: (e) => {
|
|
567
|
-
|
|
584
|
+
H.current = null, fe(e.target.value);
|
|
568
585
|
},
|
|
569
|
-
onKeyDown:
|
|
586
|
+
onKeyDown: ut,
|
|
570
587
|
role: "combobox",
|
|
571
588
|
"aria-expanded": !0,
|
|
572
589
|
"aria-autocomplete": "list",
|
|
573
|
-
"aria-controls": `${
|
|
574
|
-
"aria-activedescendant": p >= 0 ?
|
|
590
|
+
"aria-controls": `${Ee}-list`,
|
|
591
|
+
"aria-activedescendant": p >= 0 ? je(p) : void 0,
|
|
575
592
|
placeholder: "Search…",
|
|
576
593
|
className: "flex h-9 w-full bg-transparent py-3 text-[13px] outline-none placeholder:text-muted-foreground"
|
|
577
594
|
}
|
|
578
595
|
),
|
|
579
|
-
|
|
580
|
-
|
|
596
|
+
V && d !== void 0 && /* @__PURE__ */ s(
|
|
597
|
+
Se,
|
|
581
598
|
{
|
|
582
599
|
"data-picker-searching": !0,
|
|
583
600
|
className: "ml-2 h-3.5 w-3.5 shrink-0 animate-spin text-muted-foreground"
|
|
584
601
|
}
|
|
585
602
|
)
|
|
586
603
|
] }),
|
|
587
|
-
/* @__PURE__ */
|
|
588
|
-
!!r && !g && /* @__PURE__ */
|
|
604
|
+
/* @__PURE__ */ u("div", { id: `${Ee}-list`, role: "listbox", className: "max-h-52 overflow-y-auto py-1", children: [
|
|
605
|
+
!!r && !g && /* @__PURE__ */ u(
|
|
589
606
|
"button",
|
|
590
607
|
{
|
|
591
608
|
type: "button",
|
|
592
609
|
tabIndex: -1,
|
|
593
610
|
onClick: () => {
|
|
594
|
-
|
|
611
|
+
Pt(), Ce();
|
|
595
612
|
},
|
|
596
613
|
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",
|
|
597
614
|
children: [
|
|
598
|
-
/* @__PURE__ */ s(
|
|
615
|
+
/* @__PURE__ */ s(Ht, { className: "h-3.5 w-3.5 text-slate-400" }),
|
|
599
616
|
"Clear selection"
|
|
600
617
|
]
|
|
601
618
|
}
|
|
602
619
|
),
|
|
603
|
-
|
|
620
|
+
Te && /* @__PURE__ */ u(
|
|
604
621
|
"button",
|
|
605
622
|
{
|
|
606
623
|
type: "button",
|
|
607
624
|
tabIndex: -1,
|
|
608
|
-
id:
|
|
625
|
+
id: je(0),
|
|
609
626
|
role: "option",
|
|
610
627
|
"aria-selected": String(r) === L,
|
|
611
628
|
"data-nav-index": 0,
|
|
612
629
|
"data-nvr-pinned-option": !0,
|
|
613
|
-
onClick:
|
|
614
|
-
onMouseMove: () => p !== 0 &&
|
|
615
|
-
className:
|
|
630
|
+
onClick: ct,
|
|
631
|
+
onMouseMove: () => p !== 0 && W(0),
|
|
632
|
+
className: Y(
|
|
616
633
|
"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",
|
|
617
634
|
p === 0 ? "bg-nvr-cyan/10" : "bg-nvr-cyan/5"
|
|
618
635
|
),
|
|
@@ -620,107 +637,134 @@ function cn({
|
|
|
620
637
|
/* @__PURE__ */ s(
|
|
621
638
|
"div",
|
|
622
639
|
{
|
|
623
|
-
className:
|
|
640
|
+
className: Y(
|
|
624
641
|
"flex h-4 w-4 shrink-0 items-center justify-center rounded-full border transition-colors",
|
|
625
642
|
String(r) === L ? "border-nvr-cyan bg-nvr-cyan" : "border-slate-300"
|
|
626
643
|
),
|
|
627
|
-
children: String(r) === L && /* @__PURE__ */ s(
|
|
644
|
+
children: String(r) === L && /* @__PURE__ */ s(bt, { className: "h-2.5 w-2.5 text-white" })
|
|
628
645
|
}
|
|
629
646
|
),
|
|
630
|
-
/* @__PURE__ */ s("span", { className: "min-w-0 flex-1 truncate", children:
|
|
631
|
-
/* @__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: (
|
|
647
|
+
/* @__PURE__ */ s("span", { className: "min-w-0 flex-1 truncate", children: z === void 0 ? "Loading…" : lt }),
|
|
648
|
+
/* @__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: (c == null ? void 0 : c.tag) ?? "Default" })
|
|
632
649
|
]
|
|
633
650
|
}
|
|
634
651
|
),
|
|
635
|
-
|
|
636
|
-
|
|
652
|
+
ie.length > 0 && j && /* @__PURE__ */ s(
|
|
653
|
+
"div",
|
|
654
|
+
{
|
|
655
|
+
"data-picker-already-added": !0,
|
|
656
|
+
className: "space-y-1 border-b border-slate-100 px-3 py-2 text-[12px] leading-5 text-muted-foreground dark:border-border",
|
|
657
|
+
children: ie.map((e) => /* @__PURE__ */ u("p", { className: "flex items-center gap-2", children: [
|
|
658
|
+
/* @__PURE__ */ u("span", { className: "min-w-0 flex-1", children: [
|
|
659
|
+
/* @__PURE__ */ s("span", { className: "font-medium text-foreground", children: e.label }),
|
|
660
|
+
" is already",
|
|
661
|
+
" ",
|
|
662
|
+
j.where,
|
|
663
|
+
"."
|
|
664
|
+
] }),
|
|
665
|
+
/* @__PURE__ */ s(
|
|
666
|
+
"button",
|
|
667
|
+
{
|
|
668
|
+
type: "button",
|
|
669
|
+
onClick: (n) => {
|
|
670
|
+
n.stopPropagation(), _(!1), j.onShow(e.id);
|
|
671
|
+
},
|
|
672
|
+
className: "shrink-0 rounded-md border border-border bg-background px-2 py-0.5 text-[11.5px] font-medium text-foreground transition-colors duration-150 hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan",
|
|
673
|
+
children: "Show it"
|
|
674
|
+
}
|
|
675
|
+
)
|
|
676
|
+
] }, e.id))
|
|
677
|
+
}
|
|
678
|
+
),
|
|
679
|
+
d === void 0 && V ? /* @__PURE__ */ s("div", { className: "flex items-center justify-center py-4", children: /* @__PURE__ */ s(Se, { className: "h-4 w-4 animate-spin text-muted-foreground" }) }) : re.length === 0 && !X ? /* @__PURE__ */ s("p", { className: "px-3 py-2 text-[13px] text-muted-foreground", children: "Searching…" }) : re.length === 0 ? (Te || ie.length > 0) && l.trim() ? null : m && m.labels.length > 0 && !l.trim() ? /* @__PURE__ */ u("div", { className: "px-3 py-2 text-[12px] leading-5 text-muted-foreground", children: [
|
|
680
|
+
/* @__PURE__ */ u("p", { children: [
|
|
637
681
|
"No options for",
|
|
638
682
|
" ",
|
|
639
|
-
/* @__PURE__ */ s("span", { className: "font-medium text-foreground", children:
|
|
640
|
-
|
|
683
|
+
/* @__PURE__ */ s("span", { className: "font-medium text-foreground", children: m.labels.join(" · ") }),
|
|
684
|
+
m.onClear ? " — clear one to widen the list:" : ". Change it, or ask an administrator to add options for it."
|
|
641
685
|
] }),
|
|
642
|
-
|
|
643
|
-
(e, n) =>
|
|
686
|
+
m.onClear && /* @__PURE__ */ s("div", { className: "mt-1.5 flex flex-wrap gap-1.5", children: m.keys.map(
|
|
687
|
+
(e, n) => m.clearable && !m.clearable.includes(e) ? null : /* @__PURE__ */ u(
|
|
644
688
|
"button",
|
|
645
689
|
{
|
|
646
690
|
type: "button",
|
|
647
691
|
onClick: (t) => {
|
|
648
692
|
var a;
|
|
649
|
-
t.stopPropagation(), (a =
|
|
693
|
+
t.stopPropagation(), (a = m.onClear) == null || a.call(m, e);
|
|
650
694
|
},
|
|
651
695
|
className: "rounded-md border border-border bg-background px-2 py-0.5 text-[11.5px] font-medium text-foreground transition-colors duration-150 hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan",
|
|
652
696
|
children: [
|
|
653
697
|
"Clear ",
|
|
654
|
-
|
|
698
|
+
m.labels[n] ?? e
|
|
655
699
|
]
|
|
656
700
|
},
|
|
657
701
|
e
|
|
658
702
|
)
|
|
659
703
|
) })
|
|
660
|
-
] }) : /* @__PURE__ */ s("p", { className: "px-3 py-2 text-[13px] text-muted-foreground", children:
|
|
661
|
-
|
|
704
|
+
] }) : /* @__PURE__ */ s("p", { className: "px-3 py-2 text-[13px] text-muted-foreground", children: l.trim() ? `No results for “${l.trim()}”` : "No results" }) : /* @__PURE__ */ u(gt, { children: [
|
|
705
|
+
le && /* @__PURE__ */ u(
|
|
662
706
|
"p",
|
|
663
707
|
{
|
|
664
708
|
"data-picker-close-matches": !0,
|
|
665
709
|
className: "px-3 pb-1 pt-2 text-[11.5px] text-muted-foreground",
|
|
666
710
|
children: [
|
|
667
711
|
"No exact match for “",
|
|
668
|
-
|
|
712
|
+
l.trim(),
|
|
669
713
|
"” — did you mean:"
|
|
670
714
|
]
|
|
671
715
|
}
|
|
672
716
|
),
|
|
673
|
-
|
|
674
|
-
const t = k(
|
|
675
|
-
return /* @__PURE__ */
|
|
717
|
+
re.map((e, n) => {
|
|
718
|
+
const t = k(x, e), a = se(t) ? me : t, q = String(e.id) === String(r), $ = n + oe;
|
|
719
|
+
return /* @__PURE__ */ u(
|
|
676
720
|
"button",
|
|
677
721
|
{
|
|
678
722
|
type: "button",
|
|
679
723
|
tabIndex: -1,
|
|
680
|
-
id:
|
|
724
|
+
id: je($),
|
|
681
725
|
role: "option",
|
|
682
|
-
"aria-selected":
|
|
683
|
-
"data-nav-index":
|
|
684
|
-
onClick: () =>
|
|
685
|
-
onMouseMove: () => p !==
|
|
686
|
-
className:
|
|
726
|
+
"aria-selected": q,
|
|
727
|
+
"data-nav-index": $,
|
|
728
|
+
onClick: () => dt(e),
|
|
729
|
+
onMouseMove: () => p !== $ && W($),
|
|
730
|
+
className: Y(
|
|
687
731
|
"flex w-full items-center gap-2 px-3 py-1.5 text-[13px] text-left hover:bg-muted",
|
|
688
|
-
p ===
|
|
732
|
+
p === $ && "bg-muted"
|
|
689
733
|
),
|
|
690
734
|
children: [
|
|
691
735
|
/* @__PURE__ */ s(
|
|
692
736
|
"div",
|
|
693
737
|
{
|
|
694
|
-
className:
|
|
738
|
+
className: Y(
|
|
695
739
|
"flex h-4 w-4 shrink-0 items-center justify-center rounded-full border transition-colors",
|
|
696
|
-
|
|
740
|
+
q ? "border-nvr-cyan bg-nvr-cyan" : "border-slate-300"
|
|
697
741
|
),
|
|
698
|
-
children:
|
|
742
|
+
children: q && /* @__PURE__ */ s(bt, { className: "h-2.5 w-2.5 text-white" })
|
|
699
743
|
}
|
|
700
744
|
),
|
|
701
|
-
|
|
702
|
-
|
|
745
|
+
J && /* @__PURE__ */ s(
|
|
746
|
+
Qt,
|
|
703
747
|
{
|
|
704
748
|
userId: e.id,
|
|
705
749
|
className: "h-4 w-4",
|
|
706
|
-
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:
|
|
750
|
+
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: mn(a) })
|
|
707
751
|
}
|
|
708
752
|
),
|
|
709
|
-
|
|
753
|
+
J && Kt.has(String(e.id).toUpperCase()) && /* @__PURE__ */ s(
|
|
710
754
|
"span",
|
|
711
755
|
{
|
|
712
756
|
className: "h-1.5 w-1.5 shrink-0 rounded-full bg-emerald-500",
|
|
713
757
|
"data-tip": "Online now"
|
|
714
758
|
}
|
|
715
759
|
),
|
|
716
|
-
/* @__PURE__ */ s(
|
|
717
|
-
/* @__PURE__ */ s(
|
|
718
|
-
|
|
760
|
+
/* @__PURE__ */ s(Zt, { text: a, query: l }),
|
|
761
|
+
/* @__PURE__ */ s(sn, { badges: jt[String(e.id)] }),
|
|
762
|
+
st.has(String(e.id)) && /* @__PURE__ */ s(
|
|
719
763
|
"span",
|
|
720
764
|
{
|
|
721
765
|
className: "ml-auto max-w-[45%] shrink-0 truncate pl-2 text-[11.5px] text-muted-foreground",
|
|
722
766
|
"data-option-detail": !0,
|
|
723
|
-
children:
|
|
767
|
+
children: st.get(String(e.id))
|
|
724
768
|
}
|
|
725
769
|
)
|
|
726
770
|
]
|
|
@@ -730,122 +774,124 @@ function cn({
|
|
|
730
774
|
})
|
|
731
775
|
] })
|
|
732
776
|
] }),
|
|
733
|
-
!
|
|
734
|
-
|
|
777
|
+
!V && /* @__PURE__ */ s(
|
|
778
|
+
gn,
|
|
735
779
|
{
|
|
736
780
|
collection: o,
|
|
737
|
-
search:
|
|
738
|
-
filter:
|
|
739
|
-
narrowedLabels: (
|
|
740
|
-
auto: (
|
|
781
|
+
search: U,
|
|
782
|
+
filter: Ie,
|
|
783
|
+
narrowedLabels: (m == null ? void 0 : m.labels) ?? [],
|
|
784
|
+
auto: (d ?? []).length === 0 && !!U && ie.length === 0,
|
|
785
|
+
explained: ie.length
|
|
741
786
|
}
|
|
742
787
|
)
|
|
743
788
|
]
|
|
744
789
|
}
|
|
745
790
|
),
|
|
746
|
-
|
|
791
|
+
$e
|
|
747
792
|
)
|
|
748
793
|
] })
|
|
749
794
|
);
|
|
750
795
|
}
|
|
751
|
-
function
|
|
796
|
+
function gn({
|
|
752
797
|
collection: o,
|
|
753
798
|
search: r,
|
|
754
|
-
filter:
|
|
799
|
+
filter: b,
|
|
755
800
|
narrowedLabels: g,
|
|
756
|
-
auto:
|
|
801
|
+
auto: T,
|
|
802
|
+
explained: C = 0
|
|
757
803
|
}) {
|
|
758
|
-
const
|
|
759
|
-
queryKey: ["picker-narrowing", o, r,
|
|
760
|
-
queryFn: () =>
|
|
761
|
-
|
|
762
|
-
).then((
|
|
763
|
-
enabled:
|
|
804
|
+
const N = Ae(), [v, R] = P(!1), h = b ? JSON.stringify(b) : "", { data: f, isFetching: m } = K({
|
|
805
|
+
queryKey: ["picker-narrowing", o, r, h],
|
|
806
|
+
queryFn: () => N.request(
|
|
807
|
+
Yt("/picker-narrowing", { collection: o, search: r, filter: b ?? null })
|
|
808
|
+
).then((M) => M.data),
|
|
809
|
+
enabled: v || T,
|
|
764
810
|
staleTime: 3e4,
|
|
765
811
|
retry: !1
|
|
766
812
|
});
|
|
767
|
-
if (!
|
|
813
|
+
if (!v && !T)
|
|
768
814
|
return /* @__PURE__ */ s(
|
|
769
815
|
"button",
|
|
770
816
|
{
|
|
771
817
|
type: "button",
|
|
772
|
-
onClick: (
|
|
773
|
-
|
|
818
|
+
onClick: (M) => {
|
|
819
|
+
M.stopPropagation(), R(!0);
|
|
774
820
|
},
|
|
775
821
|
className: "w-full border-t border-border px-3 py-1.5 text-left text-[11px] text-muted-foreground hover:text-foreground",
|
|
776
822
|
"data-picker-narrowing-ask": !0,
|
|
777
823
|
children: "Missing something?"
|
|
778
824
|
}
|
|
779
825
|
);
|
|
780
|
-
if (
|
|
826
|
+
if (m && !f)
|
|
781
827
|
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…" });
|
|
782
|
-
if (!
|
|
783
|
-
const
|
|
784
|
-
return
|
|
785
|
-
`${
|
|
786
|
-
),
|
|
787
|
-
`${
|
|
788
|
-
),
|
|
828
|
+
if (!f) return null;
|
|
829
|
+
const c = [], D = r ? `match “${r}”` : "exist", Q = Math.max(0, f.by_field_filter - C);
|
|
830
|
+
return Q > 0 && c.push(
|
|
831
|
+
`${Q.toLocaleString()} more ${D} but this field only offers ${g.length ? `records that fit ${g.join(" · ")}` : "records its filter allows"}.`
|
|
832
|
+
), f.by_exclusions > 0 && c.push(
|
|
833
|
+
`${f.by_exclusions.toLocaleString()} ${f.by_exclusions === 1 ? "is" : "are"} hidden from pickers by an admin.`
|
|
834
|
+
), f.scopes.length > 0 && c.push(`Your ${f.scopes.join(", ")} access narrows what you can pick here.`), f.row_filter && c.push("Your role only sees some of these records."), c.length === 0 && c.push(
|
|
789
835
|
r ? `Nothing else you can see matches “${r}”.` : "Nothing narrows this list — every record you can see is offered."
|
|
790
836
|
), /* @__PURE__ */ s(
|
|
791
837
|
"div",
|
|
792
838
|
{
|
|
793
839
|
className: "space-y-0.5 border-t border-border px-3 py-1.5 text-[11px] leading-4 text-muted-foreground",
|
|
794
840
|
"data-picker-narrowing": !0,
|
|
795
|
-
"data-picker-narrowing-field":
|
|
796
|
-
"data-picker-narrowing-excluded":
|
|
797
|
-
children:
|
|
841
|
+
"data-picker-narrowing-field": f.by_field_filter,
|
|
842
|
+
"data-picker-narrowing-excluded": f.by_exclusions,
|
|
843
|
+
children: c.map((M) => /* @__PURE__ */ s("p", { children: M }, M))
|
|
798
844
|
}
|
|
799
845
|
);
|
|
800
846
|
}
|
|
801
|
-
function
|
|
847
|
+
function Tn({
|
|
802
848
|
collection: o,
|
|
803
849
|
id: r,
|
|
804
|
-
displayTemplate:
|
|
850
|
+
displayTemplate: b,
|
|
805
851
|
explainMissing: g
|
|
806
852
|
}) {
|
|
807
|
-
const
|
|
808
|
-
if (!
|
|
809
|
-
const
|
|
810
|
-
return
|
|
811
|
-
})(), { data:
|
|
812
|
-
queryKey: ["relation-single", o, String(r),
|
|
813
|
-
queryFn: () =>
|
|
853
|
+
const T = Ae(), C = Lt(), N = o === "nivaro_files" || o === "directus_files", v = (() => {
|
|
854
|
+
if (!b || !b.includes(".")) return null;
|
|
855
|
+
const D = [...b.matchAll(/\{\{([^}]+)\}\}/g)].map((Q) => Q[1].trim());
|
|
856
|
+
return D.length > 0 ? ["id", ...D].join(",") : null;
|
|
857
|
+
})(), { data: R, isLoading: h, error: f } = K({
|
|
858
|
+
queryKey: ["relation-single", o, String(r), v ?? ""],
|
|
859
|
+
queryFn: () => N ? (
|
|
814
860
|
// The file's row, not its bytes: GET /files/:id downloads the whole
|
|
815
861
|
// file (twice with the retry, 404 when storage lost it) only to read
|
|
816
862
|
// its name, and a missing object left the raw id as the label.
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
).then((
|
|
820
|
-
) :
|
|
863
|
+
T.request(
|
|
864
|
+
Z(`/files/${encodeURIComponent(String(r))}/meta`)
|
|
865
|
+
).then((D) => D.data)
|
|
866
|
+
) : C(o, r, v),
|
|
821
867
|
enabled: !!r && !!o,
|
|
822
868
|
staleTime: 6e4,
|
|
823
|
-
retry:
|
|
824
|
-
}), { settling:
|
|
825
|
-
|
|
826
|
-
g && !
|
|
869
|
+
retry: Et
|
|
870
|
+
}), { settling: m } = qt(
|
|
871
|
+
f,
|
|
872
|
+
g && !h && !R ? o : null,
|
|
827
873
|
r
|
|
828
874
|
);
|
|
829
|
-
if (
|
|
830
|
-
if (!
|
|
875
|
+
if (h || m) return /* @__PURE__ */ s(Se, { className: "h-3 w-3 animate-spin text-slate-400" });
|
|
876
|
+
if (!R)
|
|
831
877
|
return r == null || r === "" ? null : /* @__PURE__ */ s(
|
|
832
|
-
|
|
878
|
+
Ct,
|
|
833
879
|
{
|
|
834
|
-
error:
|
|
880
|
+
error: f,
|
|
835
881
|
collection: g ? o : null,
|
|
836
882
|
id: g ? r : null
|
|
837
883
|
}
|
|
838
884
|
);
|
|
839
|
-
if (
|
|
840
|
-
const
|
|
841
|
-
return /* @__PURE__ */ s("span", { children:
|
|
885
|
+
if (N) {
|
|
886
|
+
const D = R.title || R.filename_download || R.filename_disk || String(r);
|
|
887
|
+
return /* @__PURE__ */ s("span", { children: D });
|
|
842
888
|
}
|
|
843
|
-
const
|
|
844
|
-
return
|
|
889
|
+
const c = k(b, R);
|
|
890
|
+
return se(c) ? /* @__PURE__ */ s("span", { className: "italic text-muted-foreground", children: me }) : /* @__PURE__ */ s("span", { children: c });
|
|
845
891
|
}
|
|
846
892
|
export {
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
893
|
+
Tn as RelatedItemLabel,
|
|
894
|
+
pn as RelationCombobox,
|
|
895
|
+
Nt as isSamePick,
|
|
896
|
+
fn as useStaleTip
|
|
851
897
|
};
|