@nivaro/react 0.3.41 → 0.3.43
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/components/LayoutForm.js +100 -98
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +733 -15
- package/dist/index.js +820 -775
- package/dist/shared/components/ActivityEntry.js +154 -0
- package/dist/shared/components/AudienceConfirmPanel.js +98 -0
- package/dist/shared/components/BackgroundRunOffer.js +43 -31
- package/dist/shared/components/BroadcastView.js +225 -204
- package/dist/shared/components/CollectionBrowserView.js +3924 -3584
- package/dist/shared/components/ConfigHistory.js +153 -0
- package/dist/shared/components/ConfigReadBack.js +65 -0
- package/dist/shared/components/DataTable.js +379 -346
- package/dist/shared/components/ForceReloadBanner.js +47 -40
- package/dist/shared/components/IdleReloadWatcher.js +69 -0
- package/dist/shared/components/ItemEditForm.js +4041 -3853
- package/dist/shared/components/MyWorkView.js +278 -213
- package/dist/shared/components/NotificationBell.js +130 -121
- package/dist/shared/components/ProfileView.js +776 -1003
- package/dist/shared/components/RecentRecordsRail.js +34 -16
- package/dist/shared/components/RecordReadView.js +500 -477
- package/dist/shared/components/Skeletons.js +199 -0
- package/dist/shared/components/SlowNotice.js +63 -0
- package/dist/shared/components/Term.js +23 -0
- package/dist/shared/components/WidgetSlot.js +350 -353
- package/dist/shared/components/access/PermissionSummary.js +106 -0
- package/dist/shared/components/bulk/BulkActionButtons.js +76 -73
- package/dist/shared/components/chat/ChatPanel.js +902 -886
- package/dist/shared/components/chat/MemberPaging.js +70 -0
- package/dist/shared/components/chat/RoomParts.js +147 -117
- package/dist/shared/components/chat/ScreenClip.js +73 -69
- package/dist/shared/components/chat/chat-core.js +449 -396
- package/dist/shared/components/chat/huddle/huddle-store.js +48 -43
- package/dist/shared/components/help-videos/api.js +2 -5
- package/dist/shared/components/help-videos/viewer/HelpVideoMatchChip.js +79 -0
- package/dist/shared/components/help-videos/viewer/matchChip.js +50 -0
- package/dist/shared/components/imports/CollectionImportPanel.js +139 -133
- package/dist/shared/components/imports/RunDetailSheet.js +222 -227
- package/dist/shared/components/integrations/console/ErrorExplanation.js +121 -0
- package/dist/shared/components/integrations/console/PartnerDetail.js +175 -174
- package/dist/shared/components/integrations/console/SubmissionRow.js +36 -34
- package/dist/shared/components/integrations/console/drill/SubmissionDrill.js +50 -48
- package/dist/shared/components/item-edit/FieldComments.js +212 -0
- package/dist/shared/components/item-edit/FieldRow.js +340 -336
- package/dist/shared/components/item-edit/RecordHeaderActions.js +23 -22
- package/dist/shared/components/item-edit/RelationCombobox.js +231 -222
- package/dist/shared/components/item-edit/RuleHiddenNotes.js +55 -0
- package/dist/shared/components/item-edit/field-comments-context.js +6 -0
- package/dist/shared/components/item-edit/field-sources.js +33 -0
- package/dist/shared/components/item-edit/rule-hidden.js +30 -0
- package/dist/shared/components/layout-editor/HistoryPanel.js +113 -96
- package/dist/shared/components/layout-editor/editors/cascade-filters.js +170 -145
- package/dist/shared/components/layout-editor/inspector/Breadcrumb.js +22 -18
- package/dist/shared/components/layout-editor/inspector/GroupInspector.js +177 -159
- package/dist/shared/components/layout-editor/inspector/PickerTab.js +35 -34
- package/dist/shared/components/layout-editor/inspector/RulesTab.js +124 -111
- package/dist/shared/components/layout-editor/inspector/kit.js +292 -277
- package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
- package/dist/shared/components/list/CopyListLinkButton.js +41 -0
- package/dist/shared/components/list/InlineEdit.js +363 -0
- package/dist/shared/components/notifications/NotificationCenterView.js +213 -181
- package/dist/shared/components/notifications/NotificationDetailBits.js +205 -82
- package/dist/shared/components/notifications/NotificationRulesEditor.js +515 -0
- package/dist/shared/components/notifications/TestMyRules.js +137 -0
- package/dist/shared/components/notifications/changes-lines.js +24 -0
- package/dist/shared/components/notifications/why-lines.js +64 -0
- package/dist/shared/components/panels/CommentPanel.js +316 -281
- package/dist/shared/components/panels/LegalHoldBanner.js +38 -0
- package/dist/shared/components/panels/PipelinePanel.js +201 -196
- package/dist/shared/components/panels/RevisionsPanel.js +496 -479
- package/dist/shared/components/pipeline/PipelineEditorView.js +1587 -1560
- package/dist/shared/components/pipeline/PipelineStateOwners.js +116 -103
- package/dist/shared/components/profile/PersonDidPanel.js +188 -0
- package/dist/shared/components/profile/PersonProfile.js +57 -52
- package/dist/shared/components/queue/QueueWorklist.js +1526 -1365
- package/dist/shared/hooks/useSlowReason.js +39 -0
- package/dist/shared/lib/activity-sentence.js +670 -0
- package/dist/shared/lib/config-sentences.js +418 -0
- package/dist/shared/lib/core-glossary.js +229 -0
- package/dist/shared/lib/error-hints.js +159 -0
- package/dist/shared/lib/error-message.js +105 -0
- package/dist/shared/lib/error-toast.js +22 -0
- package/dist/shared/lib/field-comments.js +25 -0
- package/dist/shared/lib/filter-sentence.js +261 -0
- package/dist/shared/lib/glossary.js +55 -48
- package/dist/shared/lib/idle-reload.js +138 -0
- package/dist/shared/lib/layout-resolve.js +42 -29
- package/dist/shared/lib/list-inline-edit.js +190 -0
- package/dist/shared/lib/list-link.js +147 -0
- package/dist/shared/lib/nav-trail.js +107 -0
- package/dist/shared/lib/prefetch.js +259 -106
- package/dist/shared/lib/record-ref.js +72 -0
- package/dist/shared/lib/reload-holds.js +25 -0
- package/dist/shared/lib/safe-error.js +52 -24
- package/dist/shared/lib/skeleton-shapes.js +72 -0
- package/dist/shared/lib/slow-reason.js +63 -0
- package/package.json +1 -1
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as u, jsx as n } from "react/jsx-runtime";
|
|
2
2
|
import { useQuery as S } from "@tanstack/react-query";
|
|
3
|
-
import { ChevronDown as
|
|
4
|
-
import { useState as $, useRef as
|
|
5
|
-
import { createPortal as
|
|
6
|
-
import { useNivaroClient as
|
|
7
|
-
import { get as
|
|
8
|
-
import { compareByMatch as
|
|
9
|
-
import { useRecordReader as
|
|
10
|
-
import { useOnlineUsers as
|
|
11
|
-
import { SearchHighlight as
|
|
12
|
-
import { UserAvatar as
|
|
13
|
-
import { userOptionFilter as
|
|
3
|
+
import { ChevronDown as $e, Loader2 as B, AlertTriangle as Je, Search as ze, X as He, Check as Ce } from "lucide-react";
|
|
4
|
+
import { useState as $, useRef as I, useEffect as j, useLayoutEffect as Ye, useMemo as K } from "react";
|
|
5
|
+
import { createPortal as Le } from "react-dom";
|
|
6
|
+
import { useNivaroClient as ae, useItemEditAuth as We, useStaleFieldReporter as Xe } from "../../context.js";
|
|
7
|
+
import { get as R, post as Ge } from "../../lib/commands.js";
|
|
8
|
+
import { compareByMatch as Ve } from "../../lib/picker-rank.js";
|
|
9
|
+
import { useRecordReader as je } from "../../lib/record-loader.js";
|
|
10
|
+
import { useOnlineUsers as Ze } from "../../lib/use-online-users.js";
|
|
11
|
+
import { SearchHighlight as Qe } from "../SearchHighlight.js";
|
|
12
|
+
import { UserAvatar as Be } from "../UserAvatar.js";
|
|
13
|
+
import { userOptionFilter as et, cn as J } from "../../lib/utils.js";
|
|
14
14
|
import { applyDisplayTemplate as k } from "./helpers.js";
|
|
15
|
-
import { collidingIds as
|
|
16
|
-
import { usePickerMissReport as
|
|
17
|
-
import { useLatestSearch as
|
|
18
|
-
function
|
|
15
|
+
import { collidingIds as tt, disambiguators as rt } from "./option-disambiguate.js";
|
|
16
|
+
import { usePickerMissReport as nt } from "./picker-miss.js";
|
|
17
|
+
import { useLatestSearch as st, narrowLocally as ot } from "./picker-search.js";
|
|
18
|
+
function it(s) {
|
|
19
19
|
return s.replace(/\(.*$/, "").trim().split(/\s+/).map((r) => r[0]).filter(Boolean).slice(0, 2).join("").toUpperCase() || "?";
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
const [r, d] = $(null),
|
|
23
|
-
onMouseEnter: (
|
|
21
|
+
function at(s) {
|
|
22
|
+
const [r, d] = $(null), y = {
|
|
23
|
+
onMouseEnter: (g) => {
|
|
24
24
|
if (!s) return;
|
|
25
|
-
const
|
|
26
|
-
d({ x:
|
|
25
|
+
const p = g.currentTarget.getBoundingClientRect(), m = window.innerHeight - p.bottom < 80;
|
|
26
|
+
d({ x: p.left, y: m ? p.top - 58 : p.bottom + 4 });
|
|
27
27
|
},
|
|
28
28
|
onMouseLeave: () => d(null)
|
|
29
|
-
}, q = s && r ?
|
|
29
|
+
}, q = s && r ? Le(
|
|
30
30
|
/* @__PURE__ */ n(
|
|
31
31
|
"div",
|
|
32
32
|
{
|
|
@@ -37,75 +37,84 @@ function nt(s) {
|
|
|
37
37
|
),
|
|
38
38
|
document.body
|
|
39
39
|
) : null;
|
|
40
|
-
return { bind:
|
|
40
|
+
return { bind: y, tip: q };
|
|
41
41
|
}
|
|
42
|
-
function
|
|
42
|
+
function lt({
|
|
43
43
|
collection: s,
|
|
44
44
|
value: r,
|
|
45
45
|
onChange: d,
|
|
46
|
-
disabled:
|
|
46
|
+
disabled: y,
|
|
47
47
|
placeholder: q,
|
|
48
|
-
extraFilter:
|
|
49
|
-
autoSelectSingle:
|
|
50
|
-
optionSort:
|
|
51
|
-
requiredParent:
|
|
48
|
+
extraFilter: g,
|
|
49
|
+
autoSelectSingle: p,
|
|
50
|
+
optionSort: m,
|
|
51
|
+
requiredParent: F,
|
|
52
52
|
facets: i,
|
|
53
53
|
fieldKey: C,
|
|
54
54
|
narrowedBy: l,
|
|
55
|
-
pinned:
|
|
56
|
-
missPlacement: _
|
|
55
|
+
pinned: f,
|
|
56
|
+
missPlacement: _,
|
|
57
|
+
defaultOpen: Re,
|
|
58
|
+
onClose: le
|
|
57
59
|
}) {
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
const T = ae(), de = je(), [c, P] = $(Re ?? !1), [v, ce] = $(""), z = I(le);
|
|
61
|
+
z.current = le;
|
|
62
|
+
const ue = I(c);
|
|
63
|
+
j(() => {
|
|
64
|
+
var e;
|
|
65
|
+
ue.current && !c && ((e = z.current) == null || e.call(z)), ue.current = c;
|
|
66
|
+
}, [c]);
|
|
67
|
+
const [Fe, Te] = $(!1), L = st(v, Fe), me = I(null), H = I(null);
|
|
68
|
+
j(() => {
|
|
69
|
+
c ? setTimeout(() => {
|
|
61
70
|
var e;
|
|
62
|
-
return (e =
|
|
63
|
-
}, 30) :
|
|
64
|
-
}, [
|
|
65
|
-
if (!
|
|
71
|
+
return (e = me.current) == null ? void 0 : e.focus();
|
|
72
|
+
}, 30) : ce("");
|
|
73
|
+
}, [c]), j(() => {
|
|
74
|
+
if (!c) return;
|
|
66
75
|
const e = (o) => {
|
|
67
76
|
var a;
|
|
68
77
|
const t = o.target;
|
|
69
|
-
(a = t == null ? void 0 : t.closest) != null && a.call(t, "[data-nvr-combobox-panel]") ||
|
|
78
|
+
(a = t == null ? void 0 : t.closest) != null && a.call(t, "[data-nvr-combobox-panel]") || H.current && !H.current.contains(o.target) && P(!1);
|
|
70
79
|
};
|
|
71
80
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
72
|
-
}, [
|
|
73
|
-
const [
|
|
74
|
-
|
|
75
|
-
if (!
|
|
76
|
-
|
|
81
|
+
}, [c]);
|
|
82
|
+
const [pe, ee] = $(null), [fe, Ee] = $(null);
|
|
83
|
+
Ye(() => {
|
|
84
|
+
if (!c) {
|
|
85
|
+
ee(null);
|
|
77
86
|
return;
|
|
78
87
|
}
|
|
79
88
|
const e = () => {
|
|
80
|
-
const o =
|
|
89
|
+
const o = H.current;
|
|
81
90
|
if (!o) return;
|
|
82
91
|
const t = o.getBoundingClientRect(), a = o.closest('[role="dialog"]') ?? document.body;
|
|
83
|
-
|
|
84
|
-
const
|
|
92
|
+
Ee(a);
|
|
93
|
+
const Ne = window.innerHeight - t.bottom < 340 && t.top > window.innerHeight - t.bottom, ke = t.left, Se = Ne ? t.top - 4 : t.bottom + 4, qe = {
|
|
85
94
|
minWidth: t.width,
|
|
86
95
|
zIndex: 120,
|
|
87
|
-
...
|
|
96
|
+
...Ne ? { transform: "translateY(-100%)" } : {}
|
|
88
97
|
};
|
|
89
98
|
if (a === document.body)
|
|
90
|
-
|
|
99
|
+
ee({ position: "fixed", left: ke, top: Se, ...qe });
|
|
91
100
|
else {
|
|
92
|
-
const
|
|
93
|
-
|
|
101
|
+
const _e = a.getBoundingClientRect();
|
|
102
|
+
ee({ position: "absolute", left: ke - _e.left, top: Se - _e.top, ...qe });
|
|
94
103
|
}
|
|
95
104
|
};
|
|
96
105
|
return e(), window.addEventListener("scroll", e, !0), window.addEventListener("resize", e), () => {
|
|
97
106
|
window.removeEventListener("scroll", e, !0), window.removeEventListener("resize", e);
|
|
98
107
|
};
|
|
99
|
-
}, [
|
|
100
|
-
const { data:
|
|
108
|
+
}, [c]);
|
|
109
|
+
const { data: te, isPending: Oe } = S({
|
|
101
110
|
queryKey: ["col-meta", s],
|
|
102
|
-
queryFn: () =>
|
|
111
|
+
queryFn: () => T.request(R(`/collections/${s}`)).then((e) => e.data),
|
|
103
112
|
staleTime: 3e5,
|
|
104
113
|
retry: !1
|
|
105
|
-
}), [
|
|
114
|
+
}), [re, Ie] = $({}), { data: he = [] } = S({
|
|
106
115
|
queryKey: ["collection-meta", s],
|
|
107
|
-
queryFn: () =>
|
|
108
|
-
|
|
116
|
+
queryFn: () => T.request(
|
|
117
|
+
R(`/collections/${s}`)
|
|
109
118
|
).then(
|
|
110
119
|
(e) => {
|
|
111
120
|
var o;
|
|
@@ -114,53 +123,53 @@ function st({
|
|
|
114
123
|
),
|
|
115
124
|
enabled: !!(i != null && i.length),
|
|
116
125
|
staleTime: 10 * 6e4
|
|
117
|
-
}),
|
|
126
|
+
}), Ke = K(() => {
|
|
118
127
|
const e = {};
|
|
119
128
|
for (const o of i ?? []) {
|
|
120
|
-
const t =
|
|
129
|
+
const t = he.find(
|
|
121
130
|
(a) => a.many_collection === s && a.many_field === o.field && !a.junction_field
|
|
122
131
|
);
|
|
123
132
|
t != null && t.one_collection && (e[o.field] = t.one_collection);
|
|
124
133
|
}
|
|
125
134
|
return e;
|
|
126
|
-
}, [i,
|
|
135
|
+
}, [i, he, s]), E = s === "nivaro_users", Pe = Ze(E), ge = We().isAdmin, ne = K(() => {
|
|
127
136
|
const e = [];
|
|
128
|
-
|
|
129
|
-
for (const [o, t] of Object.entries(
|
|
137
|
+
E && e.push(et(ge)), g && e.push(g);
|
|
138
|
+
for (const [o, t] of Object.entries(re))
|
|
130
139
|
t != null && t !== "" && e.push({ [o]: { _eq: t } });
|
|
131
140
|
if (e.length !== 0)
|
|
132
141
|
return e.length === 1 ? e[0] : { _and: e };
|
|
133
|
-
}, [
|
|
134
|
-
if (!
|
|
135
|
-
const e = [...
|
|
142
|
+
}, [g, re, ge]), Y = (te == null ? void 0 : te.display_template) ?? (E ? "{{first_name}} {{last_name}} ({{email}})" : null), b = K(() => {
|
|
143
|
+
if (!Y) return;
|
|
144
|
+
const e = [...Y.matchAll(/\{\{([\w.]+)\}\}/g)].map((o) => o[1]);
|
|
136
145
|
if (e.length)
|
|
137
146
|
return ["id", ...e].join(",");
|
|
138
|
-
}, [
|
|
139
|
-
data:
|
|
140
|
-
isFetching:
|
|
141
|
-
isPlaceholderData:
|
|
147
|
+
}, [Y]), N = ne ? JSON.stringify(ne) : void 0, U = m && !/^-?label$/.test(m) ? m : void 0, {
|
|
148
|
+
data: h,
|
|
149
|
+
isFetching: O,
|
|
150
|
+
isPlaceholderData: be
|
|
142
151
|
} = S({
|
|
143
152
|
queryKey: [
|
|
144
153
|
"relation-opts",
|
|
145
154
|
s,
|
|
146
155
|
L,
|
|
147
156
|
N,
|
|
148
|
-
|
|
149
|
-
|
|
157
|
+
b,
|
|
158
|
+
U ?? ""
|
|
150
159
|
],
|
|
151
|
-
queryFn: () =>
|
|
152
|
-
|
|
160
|
+
queryFn: () => T.request(
|
|
161
|
+
R(`/items/${s}`, {
|
|
153
162
|
limit: 200,
|
|
154
163
|
picker: "1",
|
|
155
164
|
...L ? { search: L } : {},
|
|
156
165
|
...N ? { filter: N } : {},
|
|
157
|
-
...
|
|
158
|
-
...
|
|
166
|
+
...b ? { fields: b } : {},
|
|
167
|
+
...U ? { sort: U } : {}
|
|
159
168
|
})
|
|
160
169
|
).then((e) => e.data ?? []),
|
|
161
170
|
// Wait for the display template: it decides `fields`, and starting before
|
|
162
171
|
// it lands sent the whole first page twice.
|
|
163
|
-
enabled:
|
|
172
|
+
enabled: c && !Oe,
|
|
164
173
|
staleTime: N ? 0 : 3e4,
|
|
165
174
|
// A new SEARCH keeps the previous answer on screen (narrowed locally below)
|
|
166
175
|
// instead of blanking the list behind a spinner. A changed filter, sort or
|
|
@@ -168,33 +177,33 @@ function st({
|
|
|
168
177
|
placeholderData: (e, o) => {
|
|
169
178
|
const t = o == null ? void 0 : o.queryKey;
|
|
170
179
|
if (!(!e || !t))
|
|
171
|
-
return t[1] === s && t[3] === N && t[4] ===
|
|
180
|
+
return t[1] === s && t[3] === N && t[4] === b && t[5] === (U ?? "") ? e : void 0;
|
|
172
181
|
}
|
|
173
182
|
});
|
|
174
|
-
|
|
183
|
+
j(() => Te(O), [O]), nt({
|
|
175
184
|
placement: _,
|
|
176
|
-
open:
|
|
185
|
+
open: c,
|
|
177
186
|
search: L,
|
|
178
|
-
settled: !
|
|
179
|
-
count: (
|
|
187
|
+
settled: !O && !be && h !== void 0,
|
|
188
|
+
count: (h == null ? void 0 : h.length) ?? 0
|
|
180
189
|
});
|
|
181
|
-
const { data:
|
|
182
|
-
queryKey: ["relation-single", s, String(r),
|
|
183
|
-
queryFn: () =>
|
|
190
|
+
const { data: W, isLoading: Ue } = S({
|
|
191
|
+
queryKey: ["relation-single", s, String(r), b],
|
|
192
|
+
queryFn: () => de(s, r, b),
|
|
184
193
|
enabled: !!r,
|
|
185
194
|
staleTime: 6e4
|
|
186
|
-
}),
|
|
187
|
-
queryKey: ["relation-single", s,
|
|
188
|
-
queryFn: () =>
|
|
195
|
+
}), x = (f == null ? void 0 : f.id) != null && f.id !== "" ? String(f.id) : null, { data: A } = S({
|
|
196
|
+
queryKey: ["relation-single", s, x ?? "", b],
|
|
197
|
+
queryFn: () => de(s, x, b).catch(
|
|
189
198
|
() => null
|
|
190
199
|
),
|
|
191
|
-
enabled: !!
|
|
200
|
+
enabled: !!x && c,
|
|
192
201
|
staleTime: 6e4
|
|
193
|
-
}),
|
|
202
|
+
}), Ae = JSON.stringify(g ? { _and: [{ id: { _eq: r } }, g] } : { id: { _eq: r } }), { data: X } = S({
|
|
194
203
|
queryKey: ["relation-avail", s, String(r), N],
|
|
195
|
-
queryFn: () =>
|
|
196
|
-
|
|
197
|
-
filter:
|
|
204
|
+
queryFn: () => T.request(
|
|
205
|
+
R(`/items/${s}`, {
|
|
206
|
+
filter: Ae,
|
|
198
207
|
picker: "1",
|
|
199
208
|
limit: 1,
|
|
200
209
|
fields: "id"
|
|
@@ -203,18 +212,18 @@ function st({
|
|
|
203
212
|
// The pinned option is offered OUTSIDE the option filter (a type's generic
|
|
204
213
|
// item is excluded from the general list on purpose), so a value that IS
|
|
205
214
|
// the pin is available by construction — never probe it, never flag it.
|
|
206
|
-
enabled: !!r && !!
|
|
215
|
+
enabled: !!r && !!W && String(r) !== x,
|
|
207
216
|
staleTime: 3e4
|
|
208
|
-
}),
|
|
209
|
-
|
|
210
|
-
},
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
}, [
|
|
214
|
-
if (!
|
|
215
|
-
const e =
|
|
216
|
-
|
|
217
|
-
|
|
217
|
+
}), M = !!r && String(r) !== x && X !== void 0 && X.length === 0, G = I(null), se = I(!1), xe = `${s}|${N ?? ""}`, Me = () => {
|
|
218
|
+
se.current = !0, G.current = xe, d(null);
|
|
219
|
+
}, V = r == null || r === "";
|
|
220
|
+
j(() => {
|
|
221
|
+
V || (se.current = !1);
|
|
222
|
+
}, [V]), j(() => {
|
|
223
|
+
if (!p || y || !V || se.current) return;
|
|
224
|
+
const e = xe;
|
|
225
|
+
G.current !== e && (G.current = e, T.request(
|
|
226
|
+
R(`/items/${s}`, {
|
|
218
227
|
limit: 2,
|
|
219
228
|
picker: "1",
|
|
220
229
|
fields: "id",
|
|
@@ -225,120 +234,120 @@ function st({
|
|
|
225
234
|
const t = o.data ?? [];
|
|
226
235
|
t.length === 1 && ((a = t[0]) == null ? void 0 : a.id) != null && d(t[0].id);
|
|
227
236
|
}).catch(() => {
|
|
228
|
-
|
|
237
|
+
G.current = null;
|
|
229
238
|
}));
|
|
230
|
-
}, [
|
|
231
|
-
const w =
|
|
232
|
-
() =>
|
|
233
|
-
|
|
239
|
+
}, [p, y, V, s, N]);
|
|
240
|
+
const w = Y, ye = r && W ? k(w, W) : null, oe = !be && v === L, Z = K(
|
|
241
|
+
() => ot(
|
|
242
|
+
h ?? [],
|
|
234
243
|
(e) => k(w, e) || `#${e.id}`,
|
|
235
244
|
v,
|
|
236
|
-
|
|
245
|
+
oe
|
|
237
246
|
),
|
|
238
|
-
[
|
|
239
|
-
),
|
|
240
|
-
() =>
|
|
241
|
-
[
|
|
242
|
-
), { data:
|
|
243
|
-
queryKey: ["relation-opts-dups", s,
|
|
244
|
-
queryFn: () =>
|
|
245
|
-
|
|
246
|
-
limit:
|
|
247
|
+
[h, w, v, oe]
|
|
248
|
+
), Q = K(
|
|
249
|
+
() => tt(h ?? [], (e) => k(w, e) || `#${e.id}`),
|
|
250
|
+
[h, w]
|
|
251
|
+
), { data: D } = S({
|
|
252
|
+
queryKey: ["relation-opts-dups", s, Q.join(",")],
|
|
253
|
+
queryFn: () => T.request(
|
|
254
|
+
R(`/items/${s}`, {
|
|
255
|
+
limit: Q.length,
|
|
247
256
|
picker: "1",
|
|
248
|
-
filter: JSON.stringify({ id: { _in:
|
|
257
|
+
filter: JSON.stringify({ id: { _in: Q } }),
|
|
249
258
|
fields: "*"
|
|
250
259
|
})
|
|
251
260
|
).then((e) => e.data ?? []),
|
|
252
|
-
enabled:
|
|
261
|
+
enabled: c && Q.length > 0 && !E,
|
|
253
262
|
staleTime: 6e4
|
|
254
|
-
}),
|
|
255
|
-
if (!(
|
|
263
|
+
}), we = K(() => {
|
|
264
|
+
if (!(D != null && D.length)) return /* @__PURE__ */ new Map();
|
|
256
265
|
const e = new Map(
|
|
257
|
-
(
|
|
266
|
+
(h ?? []).map((t) => [
|
|
258
267
|
String(t.id),
|
|
259
268
|
(k(w, t) || `#${t.id}`).trim().toLowerCase()
|
|
260
269
|
])
|
|
261
270
|
), o = /* @__PURE__ */ new Map();
|
|
262
|
-
for (const t of
|
|
271
|
+
for (const t of D) {
|
|
263
272
|
const a = e.get(String(t.id));
|
|
264
273
|
a !== void 0 && o.set(a, [...o.get(a) ?? [], t]);
|
|
265
274
|
}
|
|
266
|
-
return
|
|
275
|
+
return rt(
|
|
267
276
|
[...o.values()],
|
|
268
|
-
((
|
|
277
|
+
((b == null ? void 0 : b.split(",")) ?? []).map((t) => t.split(".")[0])
|
|
269
278
|
);
|
|
270
|
-
}, [
|
|
271
|
-
return
|
|
272
|
-
!
|
|
273
|
-
}, [
|
|
279
|
+
}, [D, h, w, b]), De = !!r && Ue && !W, ve = at(M), ie = Xe();
|
|
280
|
+
return j(() => {
|
|
281
|
+
!ie || !C || X === void 0 || ie(C, M);
|
|
282
|
+
}, [ie, C, M, X]), F ? /* @__PURE__ */ u(
|
|
274
283
|
"button",
|
|
275
284
|
{
|
|
276
285
|
type: "button",
|
|
277
286
|
disabled: !0,
|
|
278
287
|
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",
|
|
279
288
|
children: [
|
|
280
|
-
/* @__PURE__ */
|
|
289
|
+
/* @__PURE__ */ u("span", { className: "truncate text-muted-foreground", children: [
|
|
281
290
|
"Select ",
|
|
282
|
-
|
|
291
|
+
F,
|
|
283
292
|
" first"
|
|
284
293
|
] }),
|
|
285
|
-
/* @__PURE__ */ n(
|
|
294
|
+
/* @__PURE__ */ n($e, { className: "h-4 w-4 shrink-0 opacity-50" })
|
|
286
295
|
]
|
|
287
296
|
}
|
|
288
297
|
) : (
|
|
289
298
|
// Stale tooltip binds on the WRAPPER: a disabled trigger button swallows
|
|
290
299
|
// mouse events, so a locked-but-stale field would never show the hint.
|
|
291
|
-
/* @__PURE__ */
|
|
292
|
-
/* @__PURE__ */
|
|
300
|
+
/* @__PURE__ */ u("div", { ref: H, className: "relative", ...ve.bind, children: [
|
|
301
|
+
/* @__PURE__ */ u(
|
|
293
302
|
"button",
|
|
294
303
|
{
|
|
295
304
|
type: "button",
|
|
296
|
-
disabled:
|
|
297
|
-
onClick: () =>
|
|
298
|
-
className:
|
|
305
|
+
disabled: y,
|
|
306
|
+
onClick: () => P((e) => !e),
|
|
307
|
+
className: J(
|
|
299
308
|
"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 disabled:pointer-events-none disabled:opacity-50",
|
|
300
|
-
|
|
309
|
+
M ? "border-amber-300 dark:border-amber-600" : "border-input"
|
|
301
310
|
),
|
|
302
311
|
children: [
|
|
303
|
-
|
|
312
|
+
De ? /* @__PURE__ */ n(B, { className: "h-3.5 w-3.5 animate-spin text-muted-foreground" }) : /* @__PURE__ */ u(
|
|
304
313
|
"span",
|
|
305
314
|
{
|
|
306
|
-
className:
|
|
315
|
+
className: J(
|
|
307
316
|
"flex items-center gap-1.5 truncate min-w-0",
|
|
308
|
-
!
|
|
317
|
+
!ye && "text-muted-foreground"
|
|
309
318
|
),
|
|
310
319
|
children: [
|
|
311
|
-
|
|
312
|
-
/* @__PURE__ */ n("span", { className: "truncate", children:
|
|
320
|
+
M && /* @__PURE__ */ n(Je, { className: "h-3.5 w-3.5 shrink-0 text-amber-500" }),
|
|
321
|
+
/* @__PURE__ */ n("span", { className: "truncate", children: ye ?? q ?? "Select…" })
|
|
313
322
|
]
|
|
314
323
|
}
|
|
315
324
|
),
|
|
316
|
-
/* @__PURE__ */ n(
|
|
325
|
+
/* @__PURE__ */ n($e, { className: "h-4 w-4 shrink-0 opacity-50" })
|
|
317
326
|
]
|
|
318
327
|
}
|
|
319
328
|
),
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
/* @__PURE__ */
|
|
329
|
+
ve.tip,
|
|
330
|
+
c && pe && fe && Le(
|
|
331
|
+
/* @__PURE__ */ u(
|
|
323
332
|
"div",
|
|
324
333
|
{
|
|
325
334
|
"data-nvr-combobox-panel": "",
|
|
326
|
-
style:
|
|
327
|
-
className:
|
|
335
|
+
style: pe,
|
|
336
|
+
className: J(
|
|
328
337
|
"nvr-pop-in rounded-md border border-border bg-popover shadow-md",
|
|
329
338
|
i != null && i.length ? "w-[560px] max-w-[92vw]" : "min-w-[240px] w-max max-w-[360px]"
|
|
330
339
|
),
|
|
331
340
|
children: [
|
|
332
341
|
!!(i != null && i.length) && /* @__PURE__ */ n("div", { className: "grid grid-cols-2 gap-2 border-b border-border bg-slate-50/60 p-2 dark:bg-muted/40", children: i.map((e) => {
|
|
333
|
-
const o =
|
|
334
|
-
return o ? /* @__PURE__ */
|
|
342
|
+
const o = Ke[e.field];
|
|
343
|
+
return o ? /* @__PURE__ */ u("div", { children: [
|
|
335
344
|
/* @__PURE__ */ n("p", { className: "mb-0.5 text-[10px] font-medium uppercase tracking-wide text-slate-400", children: e.label ?? e.field }),
|
|
336
345
|
/* @__PURE__ */ n(
|
|
337
|
-
|
|
346
|
+
lt,
|
|
338
347
|
{
|
|
339
348
|
collection: o,
|
|
340
|
-
value:
|
|
341
|
-
onChange: (t) =>
|
|
349
|
+
value: re[e.field] ?? null,
|
|
350
|
+
onChange: (t) => Ie((a) => ({ ...a, [e.field]: t })),
|
|
342
351
|
placeholder: "Any",
|
|
343
352
|
optionSort: e.sort,
|
|
344
353
|
extraFilter: e.filter
|
|
@@ -346,74 +355,74 @@ function st({
|
|
|
346
355
|
)
|
|
347
356
|
] }, e.field) : null;
|
|
348
357
|
}) }),
|
|
349
|
-
/* @__PURE__ */
|
|
350
|
-
/* @__PURE__ */ n(
|
|
358
|
+
/* @__PURE__ */ u("div", { className: "flex items-center border-b px-3", children: [
|
|
359
|
+
/* @__PURE__ */ n(ze, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }),
|
|
351
360
|
/* @__PURE__ */ n(
|
|
352
361
|
"input",
|
|
353
362
|
{
|
|
354
|
-
ref:
|
|
363
|
+
ref: me,
|
|
355
364
|
value: v,
|
|
356
|
-
onChange: (e) =>
|
|
365
|
+
onChange: (e) => ce(e.target.value),
|
|
357
366
|
placeholder: "Search…",
|
|
358
367
|
className: "flex h-9 w-full bg-transparent py-3 text-[13px] outline-none placeholder:text-muted-foreground"
|
|
359
368
|
}
|
|
360
369
|
),
|
|
361
|
-
|
|
362
|
-
|
|
370
|
+
O && h !== void 0 && /* @__PURE__ */ n(
|
|
371
|
+
B,
|
|
363
372
|
{
|
|
364
373
|
"data-picker-searching": !0,
|
|
365
374
|
className: "ml-2 h-3.5 w-3.5 shrink-0 animate-spin text-muted-foreground"
|
|
366
375
|
}
|
|
367
376
|
)
|
|
368
377
|
] }),
|
|
369
|
-
/* @__PURE__ */
|
|
370
|
-
!!r && !
|
|
378
|
+
/* @__PURE__ */ u("div", { className: "max-h-52 overflow-y-auto py-1", children: [
|
|
379
|
+
!!r && !y && /* @__PURE__ */ u(
|
|
371
380
|
"button",
|
|
372
381
|
{
|
|
373
382
|
type: "button",
|
|
374
383
|
onClick: () => {
|
|
375
|
-
|
|
384
|
+
Me(), P(!1);
|
|
376
385
|
},
|
|
377
386
|
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",
|
|
378
387
|
children: [
|
|
379
|
-
/* @__PURE__ */ n(
|
|
388
|
+
/* @__PURE__ */ n(He, { className: "h-3.5 w-3.5 text-slate-400" }),
|
|
380
389
|
"Clear selection"
|
|
381
390
|
]
|
|
382
391
|
}
|
|
383
392
|
),
|
|
384
|
-
|
|
393
|
+
x && /* @__PURE__ */ u(
|
|
385
394
|
"button",
|
|
386
395
|
{
|
|
387
396
|
type: "button",
|
|
388
397
|
"data-nvr-pinned-option": !0,
|
|
389
398
|
onClick: () => {
|
|
390
|
-
d((
|
|
399
|
+
d((A == null ? void 0 : A.id) ?? (f == null ? void 0 : f.id)), P(!1);
|
|
391
400
|
},
|
|
392
401
|
className: "flex w-full items-center gap-2 border-b border-slate-100 bg-nvr-cyan/5 px-3 py-1.5 text-left text-[13px] hover:bg-nvr-cyan/10 dark:border-border",
|
|
393
402
|
children: [
|
|
394
403
|
/* @__PURE__ */ n(
|
|
395
404
|
"div",
|
|
396
405
|
{
|
|
397
|
-
className:
|
|
406
|
+
className: J(
|
|
398
407
|
"flex h-4 w-4 shrink-0 items-center justify-center rounded-full border transition-colors",
|
|
399
|
-
String(r) ===
|
|
408
|
+
String(r) === x ? "border-nvr-cyan bg-nvr-cyan" : "border-slate-300"
|
|
400
409
|
),
|
|
401
|
-
children: String(r) ===
|
|
410
|
+
children: String(r) === x && /* @__PURE__ */ n(Ce, { className: "h-2.5 w-2.5 text-white" })
|
|
402
411
|
}
|
|
403
412
|
),
|
|
404
|
-
/* @__PURE__ */ n("span", { className: "min-w-0 flex-1 truncate", children:
|
|
405
|
-
/* @__PURE__ */ n("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: (
|
|
413
|
+
/* @__PURE__ */ n("span", { className: "min-w-0 flex-1 truncate", children: A ? k(w, A) || `#${x}` : `#${x}` }),
|
|
414
|
+
/* @__PURE__ */ n("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" })
|
|
406
415
|
]
|
|
407
416
|
}
|
|
408
417
|
),
|
|
409
|
-
|
|
410
|
-
/* @__PURE__ */
|
|
418
|
+
h === void 0 && O ? /* @__PURE__ */ n("div", { className: "flex items-center justify-center py-4", children: /* @__PURE__ */ n(B, { className: "h-4 w-4 animate-spin text-muted-foreground" }) }) : Z.length === 0 && !oe ? /* @__PURE__ */ n("p", { className: "px-3 py-2 text-[13px] text-muted-foreground", children: "Searching…" }) : Z.length === 0 ? l && l.labels.length > 0 && !v.trim() ? /* @__PURE__ */ u("div", { className: "px-3 py-2 text-[12px] leading-5 text-muted-foreground", children: [
|
|
419
|
+
/* @__PURE__ */ u("p", { children: [
|
|
411
420
|
"No options for",
|
|
412
421
|
" ",
|
|
413
422
|
/* @__PURE__ */ n("span", { className: "font-medium text-foreground", children: l.labels.join(" · ") }),
|
|
414
423
|
l.onClear ? " — clear one to widen the list:" : "."
|
|
415
424
|
] }),
|
|
416
|
-
l.onClear && /* @__PURE__ */ n("div", { className: "mt-1.5 flex flex-wrap gap-1.5", children: l.keys.map((e, o) => /* @__PURE__ */
|
|
425
|
+
l.onClear && /* @__PURE__ */ n("div", { className: "mt-1.5 flex flex-wrap gap-1.5", children: l.keys.map((e, o) => /* @__PURE__ */ u(
|
|
417
426
|
"button",
|
|
418
427
|
{
|
|
419
428
|
type: "button",
|
|
@@ -429,56 +438,56 @@ function st({
|
|
|
429
438
|
},
|
|
430
439
|
e
|
|
431
440
|
)) })
|
|
432
|
-
] }) : /* @__PURE__ */ n("p", { className: "px-3 py-2 text-[13px] text-muted-foreground", children: v.trim() ? `No results for “${v.trim()}”` : "No results" }) : (
|
|
433
|
-
(e, o) =>
|
|
441
|
+
] }) : /* @__PURE__ */ n("p", { className: "px-3 py-2 text-[13px] text-muted-foreground", children: v.trim() ? `No results for “${v.trim()}”` : "No results" }) : (U ? [...Z] : [...Z].sort(
|
|
442
|
+
(e, o) => Ve(
|
|
434
443
|
k(w, e),
|
|
435
444
|
k(w, o),
|
|
436
445
|
v,
|
|
437
|
-
|
|
446
|
+
m === "-label"
|
|
438
447
|
)
|
|
439
|
-
)).filter((e) => !
|
|
448
|
+
)).filter((e) => !x || String(e.id) !== x).map((e) => {
|
|
440
449
|
const o = k(w, e) || `#${e.id}`, t = String(e.id) === String(r);
|
|
441
|
-
return /* @__PURE__ */
|
|
450
|
+
return /* @__PURE__ */ u(
|
|
442
451
|
"button",
|
|
443
452
|
{
|
|
444
453
|
type: "button",
|
|
445
454
|
onClick: () => {
|
|
446
|
-
d(e.id),
|
|
455
|
+
d(e.id), P(!1);
|
|
447
456
|
},
|
|
448
457
|
className: "flex w-full items-center gap-2 px-3 py-1.5 text-[13px] text-left hover:bg-muted",
|
|
449
458
|
children: [
|
|
450
459
|
/* @__PURE__ */ n(
|
|
451
460
|
"div",
|
|
452
461
|
{
|
|
453
|
-
className:
|
|
462
|
+
className: J(
|
|
454
463
|
"flex h-4 w-4 shrink-0 items-center justify-center rounded-full border transition-colors",
|
|
455
464
|
t ? "border-nvr-cyan bg-nvr-cyan" : "border-slate-300"
|
|
456
465
|
),
|
|
457
|
-
children: t && /* @__PURE__ */ n(
|
|
466
|
+
children: t && /* @__PURE__ */ n(Ce, { className: "h-2.5 w-2.5 text-white" })
|
|
458
467
|
}
|
|
459
468
|
),
|
|
460
|
-
|
|
461
|
-
|
|
469
|
+
E && /* @__PURE__ */ n(
|
|
470
|
+
Be,
|
|
462
471
|
{
|
|
463
472
|
userId: e.id,
|
|
464
473
|
className: "h-4 w-4",
|
|
465
|
-
fallback: /* @__PURE__ */ n("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:
|
|
474
|
+
fallback: /* @__PURE__ */ n("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: it(o) })
|
|
466
475
|
}
|
|
467
476
|
),
|
|
468
|
-
|
|
477
|
+
E && Pe.has(String(e.id).toUpperCase()) && /* @__PURE__ */ n(
|
|
469
478
|
"span",
|
|
470
479
|
{
|
|
471
480
|
className: "h-1.5 w-1.5 shrink-0 rounded-full bg-emerald-500",
|
|
472
481
|
"data-tip": "Online now"
|
|
473
482
|
}
|
|
474
483
|
),
|
|
475
|
-
/* @__PURE__ */ n(
|
|
476
|
-
|
|
484
|
+
/* @__PURE__ */ n(Qe, { text: o, query: v }),
|
|
485
|
+
we.has(String(e.id)) && /* @__PURE__ */ n(
|
|
477
486
|
"span",
|
|
478
487
|
{
|
|
479
488
|
className: "ml-auto max-w-[45%] shrink-0 truncate pl-2 text-[11.5px] text-muted-foreground",
|
|
480
489
|
"data-option-detail": !0,
|
|
481
|
-
children:
|
|
490
|
+
children: we.get(String(e.id))
|
|
482
491
|
}
|
|
483
492
|
)
|
|
484
493
|
]
|
|
@@ -487,47 +496,47 @@ function st({
|
|
|
487
496
|
);
|
|
488
497
|
})
|
|
489
498
|
] }),
|
|
490
|
-
!
|
|
491
|
-
|
|
499
|
+
!O && /* @__PURE__ */ n(
|
|
500
|
+
dt,
|
|
492
501
|
{
|
|
493
502
|
collection: s,
|
|
494
503
|
search: L,
|
|
495
|
-
filter:
|
|
504
|
+
filter: ne,
|
|
496
505
|
narrowedLabels: (l == null ? void 0 : l.labels) ?? [],
|
|
497
|
-
auto: (
|
|
506
|
+
auto: (h ?? []).length === 0 && !!L
|
|
498
507
|
}
|
|
499
508
|
)
|
|
500
509
|
]
|
|
501
510
|
}
|
|
502
511
|
),
|
|
503
|
-
|
|
512
|
+
fe
|
|
504
513
|
)
|
|
505
514
|
] })
|
|
506
515
|
);
|
|
507
516
|
}
|
|
508
|
-
function
|
|
517
|
+
function dt({
|
|
509
518
|
collection: s,
|
|
510
519
|
search: r,
|
|
511
520
|
filter: d,
|
|
512
|
-
narrowedLabels:
|
|
521
|
+
narrowedLabels: y,
|
|
513
522
|
auto: q
|
|
514
523
|
}) {
|
|
515
|
-
const
|
|
516
|
-
queryKey: ["picker-narrowing", s, r,
|
|
517
|
-
queryFn: () =>
|
|
518
|
-
|
|
524
|
+
const g = ae(), [p, m] = $(!1), F = d ? JSON.stringify(d) : "", { data: i, isFetching: C } = S({
|
|
525
|
+
queryKey: ["picker-narrowing", s, r, F],
|
|
526
|
+
queryFn: () => g.request(
|
|
527
|
+
Ge("/picker-narrowing", { collection: s, search: r, filter: d ?? null })
|
|
519
528
|
).then((_) => _.data),
|
|
520
|
-
enabled:
|
|
529
|
+
enabled: p || q,
|
|
521
530
|
staleTime: 3e4,
|
|
522
531
|
retry: !1
|
|
523
532
|
});
|
|
524
|
-
if (!
|
|
533
|
+
if (!p && !q)
|
|
525
534
|
return /* @__PURE__ */ n(
|
|
526
535
|
"button",
|
|
527
536
|
{
|
|
528
537
|
type: "button",
|
|
529
538
|
onClick: (_) => {
|
|
530
|
-
_.stopPropagation(),
|
|
539
|
+
_.stopPropagation(), m(!0);
|
|
531
540
|
},
|
|
532
541
|
className: "w-full border-t border-border px-3 py-1.5 text-left text-[11px] text-muted-foreground hover:text-foreground",
|
|
533
542
|
"data-picker-narrowing-ask": !0,
|
|
@@ -537,9 +546,9 @@ function ot({
|
|
|
537
546
|
if (C && !i)
|
|
538
547
|
return /* @__PURE__ */ n("p", { className: "border-t border-border px-3 py-1.5 text-[11px] text-muted-foreground", children: "Checking what narrows this list…" });
|
|
539
548
|
if (!i) return null;
|
|
540
|
-
const l = [],
|
|
549
|
+
const l = [], f = r ? `match “${r}”` : "exist";
|
|
541
550
|
return i.by_field_filter > 0 && l.push(
|
|
542
|
-
`${i.by_field_filter.toLocaleString()} more ${
|
|
551
|
+
`${i.by_field_filter.toLocaleString()} more ${f} but this field only offers ${y.length ? `records that fit ${y.join(" · ")}` : "records its filter allows"}.`
|
|
543
552
|
), i.by_exclusions > 0 && l.push(
|
|
544
553
|
`${i.by_exclusions.toLocaleString()} ${i.by_exclusions === 1 ? "is" : "are"} hidden from pickers by an admin.`
|
|
545
554
|
), i.scopes.length > 0 && l.push(`Your ${i.scopes.join(", ")} access narrows what you can pick here.`), i.row_filter && l.push("Your role only sees some of these records."), l.length === 0 && l.push(
|
|
@@ -555,38 +564,38 @@ function ot({
|
|
|
555
564
|
}
|
|
556
565
|
);
|
|
557
566
|
}
|
|
558
|
-
function
|
|
567
|
+
function $t({
|
|
559
568
|
collection: s,
|
|
560
569
|
id: r,
|
|
561
570
|
displayTemplate: d
|
|
562
571
|
}) {
|
|
563
|
-
const
|
|
572
|
+
const y = ae(), q = je(), g = s === "nivaro_files" || s === "directus_files", p = (() => {
|
|
564
573
|
if (!d || !d.includes(".")) return null;
|
|
565
574
|
const i = [...d.matchAll(/\{\{([^}]+)\}\}/g)].map((C) => C[1].trim());
|
|
566
575
|
return i.length > 0 ? ["id", ...i].join(",") : null;
|
|
567
|
-
})(), { data:
|
|
568
|
-
queryKey: ["relation-single", s, String(r),
|
|
569
|
-
queryFn: () =>
|
|
576
|
+
})(), { data: m, isLoading: F } = S({
|
|
577
|
+
queryKey: ["relation-single", s, String(r), p ?? ""],
|
|
578
|
+
queryFn: () => g ? (
|
|
570
579
|
// The file's row, not its bytes: GET /files/:id downloads the whole
|
|
571
580
|
// file (twice with the retry, 404 when storage lost it) only to read
|
|
572
581
|
// its name, and a missing object left the raw id as the label.
|
|
573
|
-
|
|
574
|
-
|
|
582
|
+
y.request(
|
|
583
|
+
R(`/files/${encodeURIComponent(String(r))}/meta`)
|
|
575
584
|
).then((i) => i.data)
|
|
576
|
-
) : q(s, r,
|
|
585
|
+
) : q(s, r, p),
|
|
577
586
|
enabled: !!r && !!s,
|
|
578
587
|
staleTime: 6e4
|
|
579
588
|
});
|
|
580
|
-
if (
|
|
581
|
-
if (!
|
|
582
|
-
if (
|
|
583
|
-
const i =
|
|
589
|
+
if (F) return /* @__PURE__ */ n(B, { className: "h-3 w-3 animate-spin text-slate-400" });
|
|
590
|
+
if (!m) return /* @__PURE__ */ n("span", { children: String(r ?? "") });
|
|
591
|
+
if (g) {
|
|
592
|
+
const i = m.title || m.filename_download || m.filename_disk || String(r);
|
|
584
593
|
return /* @__PURE__ */ n("span", { children: i });
|
|
585
594
|
}
|
|
586
|
-
return /* @__PURE__ */ n("span", { children: k(d,
|
|
595
|
+
return /* @__PURE__ */ n("span", { children: k(d, m) });
|
|
587
596
|
}
|
|
588
597
|
export {
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
598
|
+
$t as RelatedItemLabel,
|
|
599
|
+
lt as RelationCombobox,
|
|
600
|
+
at as useStaleTip
|
|
592
601
|
};
|