@nivaro/react 0.3.65 → 0.3.66
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +13 -4
- package/dist/shared/components/CollectionBrowserView.js +2509 -2668
- package/dist/shared/components/ItemEditForm.js +3910 -3771
- package/dist/shared/components/MyWorkView.js +124 -113
- package/dist/shared/components/ProfileView.js +483 -472
- package/dist/shared/components/ReportView.js +1100 -1094
- package/dist/shared/components/bulk/BulkCompareButton.js +62 -0
- package/dist/shared/components/bulk/MessageStakeholders.js +235 -0
- package/dist/shared/components/item-edit/CatalogPickerField.js +240 -238
- package/dist/shared/components/item-edit/GroupSection.js +555 -538
- package/dist/shared/components/item-edit/M2MCombobox.js +414 -349
- package/dist/shared/components/item-edit/MidairCollisionDialog.js +211 -187
- package/dist/shared/components/item-edit/RelationCombobox.js +327 -311
- package/dist/shared/components/item-edit/SummaryPanel.js +146 -144
- package/dist/shared/components/item-edit/UserChip.js +264 -229
- package/dist/shared/components/item-edit/cascade-clear-notice.js +23 -19
- package/dist/shared/components/item-edit/header-path-preview.js +52 -0
- package/dist/shared/components/item-edit/line-merge.js +73 -47
- package/dist/shared/components/item-edit/picker-search.js +25 -21
- package/dist/shared/components/queue/QueueWorklist.js +799 -772
- package/dist/shared/lib/obligation-reason-text.js +1 -1
- package/dist/shared/lib/quick-filter-cascade.js +29 -19
- package/package.json +1 -1
|
@@ -1,161 +1,163 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as r, jsxs as c } from "react/jsx-runtime";
|
|
2
2
|
import { useQuery as q } from "@tanstack/react-query";
|
|
3
|
-
import { ChevronDown as
|
|
4
|
-
import { useState as
|
|
5
|
-
import { useNivaroClient as
|
|
6
|
-
import { parseAllowedCollections as
|
|
3
|
+
import { ChevronDown as ae, Loader2 as ue, AlertTriangle as he, X as me, Check as ye } from "lucide-react";
|
|
4
|
+
import { useState as E, useRef as fe, useEffect as pe } from "react";
|
|
5
|
+
import { useNivaroClient as be, useItemEditAuth as xe, useDrilldown as Ee } from "../../context.js";
|
|
6
|
+
import { parseAllowedCollections as Re } from "../../lib/allowed-collections.js";
|
|
7
7
|
import { get as U } from "../../lib/commands.js";
|
|
8
|
-
import { compareByMatch as
|
|
9
|
-
import { useRecordReader as
|
|
10
|
-
import { useOnlineUsers as
|
|
11
|
-
import { cn as
|
|
12
|
-
import { UserAvatar as
|
|
13
|
-
import { Command as
|
|
14
|
-
import { Popover as
|
|
15
|
-
import { applyDisplayTemplate as
|
|
16
|
-
import { useM2MStaging as
|
|
17
|
-
import {
|
|
18
|
-
|
|
8
|
+
import { compareByMatch as ge } from "../../lib/picker-rank.js";
|
|
9
|
+
import { useRecordReader as ze } from "../../lib/record-loader.js";
|
|
10
|
+
import { useOnlineUsers as ve } from "../../lib/use-online-users.js";
|
|
11
|
+
import { cn as X, userOptionFilter as ke, matchesAllTokens as Ge } from "../../lib/utils.js";
|
|
12
|
+
import { UserAvatar as we } from "../UserAvatar.js";
|
|
13
|
+
import { Command as Se, CommandInput as Ne, CommandList as _e, CommandEmpty as Ce, CommandGroup as Le, CommandItem as Oe } from "../ui/command.js";
|
|
14
|
+
import { Popover as Fe, PopoverTrigger as qe, PopoverContent as je } from "../ui/popover.js";
|
|
15
|
+
import { applyDisplayTemplate as Te } from "./helpers.js";
|
|
16
|
+
import { useM2MStaging as Ae } from "./M2MStagingContext.js";
|
|
17
|
+
import { onlyCloseMatches as Ve } from "./picker-search.js";
|
|
18
|
+
import { useStaleTip as Be, RelatedItemLabel as de } from "./RelationCombobox.js";
|
|
19
|
+
function Ie(n) {
|
|
19
20
|
return n.replace(/\(.*$/, "").trim().split(/\s+/).map((i) => i[0]).filter(Boolean).slice(0, 2).join("").toUpperCase() || "?";
|
|
20
21
|
}
|
|
21
|
-
function
|
|
22
|
-
return
|
|
22
|
+
function Ue(n) {
|
|
23
|
+
return Re(n == null ? void 0 : n.one_allowed_collections);
|
|
23
24
|
}
|
|
24
|
-
function
|
|
25
|
+
function Ke(n) {
|
|
25
26
|
if (!n) return null;
|
|
26
27
|
if (n.one_collection) return n.one_collection;
|
|
27
|
-
const i =
|
|
28
|
-
return i.length === 0 ? null : i.some((
|
|
28
|
+
const i = Ue(n);
|
|
29
|
+
return i.length === 0 ? null : i.some((f) => f === "directus_users" || f === "nivaro_users") ? "nivaro_users" : i[0];
|
|
29
30
|
}
|
|
30
|
-
function
|
|
31
|
+
function ft(n) {
|
|
31
32
|
if (!n || n.one_collection) return null;
|
|
32
|
-
const i =
|
|
33
|
+
const i = Ue(n);
|
|
33
34
|
if (i.length === 0) return null;
|
|
34
|
-
const
|
|
35
|
-
return { field: n.one_collection_field ?? "collection", value:
|
|
35
|
+
const f = i.includes("directus_users") ? "directus_users" : i.includes("nivaro_users") ? "nivaro_users" : i[0];
|
|
36
|
+
return { field: n.one_collection_field ?? "collection", value: f };
|
|
36
37
|
}
|
|
37
|
-
function
|
|
38
|
+
function Q(n) {
|
|
38
39
|
return String(n).toLowerCase();
|
|
39
40
|
}
|
|
40
|
-
function
|
|
41
|
+
function pt({
|
|
41
42
|
relation: n,
|
|
42
43
|
parentId: i,
|
|
43
|
-
allRelations:
|
|
44
|
-
extraFilter:
|
|
45
|
-
optionSort:
|
|
46
|
-
requiredParent:
|
|
47
|
-
onCountChange:
|
|
48
|
-
drilldown:
|
|
44
|
+
allRelations: f,
|
|
45
|
+
extraFilter: d,
|
|
46
|
+
optionSort: p,
|
|
47
|
+
requiredParent: w,
|
|
48
|
+
onCountChange: x,
|
|
49
|
+
drilldown: b
|
|
49
50
|
}) {
|
|
50
|
-
const
|
|
51
|
+
const v = be(), A = Ee(), t = Ae(), [N, S] = E(!1), [m, L] = E(""), j = f.find(
|
|
51
52
|
(e) => e.many_collection === n.many_collection && e.many_field === n.junction_field && e.id !== n.id
|
|
52
|
-
), s =
|
|
53
|
+
), s = Ke(j), O = n.junction_field ?? "", R = n.many_field ?? "", h = n.one_field ?? `${n.many_collection}.${O}`, { data: o } = q({
|
|
53
54
|
queryKey: ["col-meta", s],
|
|
54
|
-
queryFn: () =>
|
|
55
|
+
queryFn: () => v.request(U(`/collections/${s}`)).then((e) => e.data),
|
|
55
56
|
enabled: !!s,
|
|
56
57
|
staleTime: 3e5,
|
|
57
58
|
retry: !1
|
|
58
|
-
}), { data:
|
|
59
|
-
queryKey: ["m2m-items", n.many_collection,
|
|
60
|
-
queryFn: () =>
|
|
59
|
+
}), { data: H = [] } = q({
|
|
60
|
+
queryKey: ["m2m-items", n.many_collection, R, i],
|
|
61
|
+
queryFn: () => v.request(
|
|
61
62
|
U(`/items/${n.many_collection}`, {
|
|
62
|
-
filter: JSON.stringify({ [
|
|
63
|
+
filter: JSON.stringify({ [R]: { _eq: i } }),
|
|
63
64
|
limit: 200,
|
|
64
|
-
fields: `id,${
|
|
65
|
+
fields: `id,${O}`
|
|
65
66
|
})
|
|
66
67
|
).then((e) => e.data ?? []),
|
|
67
68
|
staleTime: 3e4,
|
|
68
69
|
enabled: !!i && i !== "new"
|
|
69
|
-
}),
|
|
70
|
+
}), ce = xe().isAdmin, z = s === "nivaro_users" ? ke(ce) : null, G = ve(s === "nivaro_users"), Y = d ? z ? { _and: [d, z] } : d : z, V = Y ? JSON.stringify(Y) : void 0, B = p && !/^-?label$/.test(p) ? p : void 0, Z = (() => {
|
|
70
71
|
const e = o == null ? void 0 : o.display_template;
|
|
71
72
|
if (!e || !e.includes(".")) return null;
|
|
72
|
-
const a = [...e.matchAll(/\{\{([^}]+)\}\}/g)].map((
|
|
73
|
+
const a = [...e.matchAll(/\{\{([^}]+)\}\}/g)].map((u) => u[1].trim());
|
|
73
74
|
return a.length === 0 ? null : ["id", ...a].join(",");
|
|
74
75
|
})(), {
|
|
75
|
-
options:
|
|
76
|
-
isLoading:
|
|
77
|
-
localSearch:
|
|
78
|
-
|
|
79
|
-
|
|
76
|
+
options: ee,
|
|
77
|
+
isLoading: K,
|
|
78
|
+
localSearch: $,
|
|
79
|
+
closeMatches: te
|
|
80
|
+
} = $e({
|
|
81
|
+
client: v,
|
|
80
82
|
relatedCollection: s,
|
|
81
|
-
search:
|
|
82
|
-
filterParam:
|
|
83
|
-
serverSort:
|
|
84
|
-
templateNestedFields:
|
|
85
|
-
enabled:
|
|
86
|
-
labelOf:
|
|
87
|
-
}),
|
|
88
|
-
queryKey: ["m2m-avail", s,
|
|
89
|
-
queryFn: () =>
|
|
83
|
+
search: m,
|
|
84
|
+
filterParam: V,
|
|
85
|
+
serverSort: B,
|
|
86
|
+
templateNestedFields: Z,
|
|
87
|
+
enabled: N && !!s,
|
|
88
|
+
labelOf: _
|
|
89
|
+
}), ne = Pe(!!te, m), re = (t == null ? void 0 : t.getStagedLinks(h)) ?? [], F = (t == null ? void 0 : t.getStagedUnlinks(h)) ?? /* @__PURE__ */ new Set(), D = H.filter((e) => !F.has(e.id)), k = new Set(D.map((e) => String(e[O]))), T = [...k], le = JSON.stringify(d ? { _and: [{ id: { _in: T } }, d] } : { id: { _in: T } }), { data: y } = q({
|
|
90
|
+
queryKey: ["m2m-avail", s, T.join(","), V],
|
|
91
|
+
queryFn: () => v.request(
|
|
90
92
|
U(`/items/${s}`, {
|
|
91
|
-
filter:
|
|
93
|
+
filter: le,
|
|
92
94
|
picker: "1",
|
|
93
95
|
limit: 200,
|
|
94
96
|
fields: "id"
|
|
95
97
|
})
|
|
96
98
|
).then((e) => e.data ?? []),
|
|
97
|
-
enabled: !!s &&
|
|
99
|
+
enabled: !!s && T.length > 0,
|
|
98
100
|
staleTime: 3e4
|
|
99
|
-
}),
|
|
100
|
-
|
|
101
|
+
}), se = new Set((y ?? []).map((e) => String(e.id))), P = y !== void 0 ? new Set(T.filter((e) => !se.has(e))) : /* @__PURE__ */ new Set(), J = new Set(re.map(Q)), M = /* @__PURE__ */ new Set([...[...k].map(Q), ...J]), I = fe(x);
|
|
102
|
+
I.current = x, pe(() => {
|
|
101
103
|
var e;
|
|
102
|
-
(e =
|
|
103
|
-
}, [
|
|
104
|
-
function
|
|
105
|
-
const a =
|
|
106
|
-
if (
|
|
107
|
-
t == null || t.unstageLink(
|
|
104
|
+
(e = I.current) == null || e.call(I, M.size);
|
|
105
|
+
}, [M.size]);
|
|
106
|
+
function W(e) {
|
|
107
|
+
const a = Q(e);
|
|
108
|
+
if (J.has(a)) {
|
|
109
|
+
t == null || t.unstageLink(h, e);
|
|
108
110
|
return;
|
|
109
111
|
}
|
|
110
|
-
const
|
|
111
|
-
if (
|
|
112
|
-
|
|
112
|
+
const u = H.find((C) => Q(C[O]) === a);
|
|
113
|
+
if (u) {
|
|
114
|
+
F.has(u.id) ? t == null || t.unstageUnlink(h, u.id) : t == null || t.stageUnlink(h, u.id);
|
|
113
115
|
return;
|
|
114
116
|
}
|
|
115
|
-
t == null || t.stageLink(
|
|
117
|
+
t == null || t.stageLink(h, e);
|
|
116
118
|
}
|
|
117
|
-
function
|
|
119
|
+
function _(e) {
|
|
118
120
|
const a = (o == null ? void 0 : o.display_template) ?? null;
|
|
119
|
-
return a ?
|
|
121
|
+
return a ? Te(a, e) : String(e._display ?? e.id ?? "");
|
|
120
122
|
}
|
|
121
|
-
return
|
|
123
|
+
return w ? /* @__PURE__ */ c(
|
|
122
124
|
"button",
|
|
123
125
|
{
|
|
124
126
|
type: "button",
|
|
125
127
|
disabled: !0,
|
|
126
128
|
className: "flex h-9 w-full items-center justify-between gap-2 rounded-md border border-input bg-background px-3 text-sm text-muted-foreground opacity-50 cursor-not-allowed",
|
|
127
129
|
children: [
|
|
128
|
-
/* @__PURE__ */
|
|
130
|
+
/* @__PURE__ */ c("span", { className: "truncate", children: [
|
|
129
131
|
"Select ",
|
|
130
|
-
|
|
132
|
+
w,
|
|
131
133
|
" first"
|
|
132
134
|
] }),
|
|
133
|
-
/* @__PURE__ */
|
|
135
|
+
/* @__PURE__ */ r(ae, { className: "h-4 w-4 shrink-0 opacity-50" })
|
|
134
136
|
]
|
|
135
137
|
}
|
|
136
|
-
) : /* @__PURE__ */
|
|
137
|
-
|
|
138
|
+
) : /* @__PURE__ */ r("div", { children: /* @__PURE__ */ c(
|
|
139
|
+
Fe,
|
|
138
140
|
{
|
|
139
|
-
open:
|
|
141
|
+
open: N,
|
|
140
142
|
onOpenChange: (e) => {
|
|
141
|
-
|
|
143
|
+
S(e), e || L("");
|
|
142
144
|
},
|
|
143
145
|
children: [
|
|
144
|
-
/* @__PURE__ */
|
|
146
|
+
/* @__PURE__ */ r(qe, { asChild: !0, children: /* @__PURE__ */ c(
|
|
145
147
|
"div",
|
|
146
148
|
{
|
|
147
149
|
role: "button",
|
|
148
150
|
tabIndex: 0,
|
|
149
151
|
onKeyDown: (e) => {
|
|
150
|
-
if (e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey && (
|
|
152
|
+
if (e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey && (N || m !== "" || e.key !== " ")) {
|
|
151
153
|
e.preventDefault();
|
|
152
|
-
const
|
|
153
|
-
L((
|
|
154
|
-
} else (e.key === "Enter" || e.key === " " || !
|
|
154
|
+
const u = e.key;
|
|
155
|
+
L((C) => u === " " && (C === "" || C.endsWith(" ")) ? C : C + u), N || S(!0);
|
|
156
|
+
} else (e.key === "Enter" || e.key === " " || !N && e.key === "ArrowDown") && (e.preventDefault(), S((u) => !u));
|
|
155
157
|
},
|
|
156
158
|
className: "flex min-h-9 w-full cursor-pointer items-center justify-between gap-2 rounded-md border border-input bg-background px-3 py-1 text-sm text-left font-normal hover:bg-muted",
|
|
157
159
|
children: [
|
|
158
|
-
|
|
160
|
+
M.size > 0 ? /* @__PURE__ */ c(
|
|
159
161
|
"span",
|
|
160
162
|
{
|
|
161
163
|
className: "flex min-w-0 flex-1 flex-wrap items-center gap-1",
|
|
@@ -163,32 +165,32 @@ function ct({
|
|
|
163
165
|
e.target.closest("button") && e.stopPropagation();
|
|
164
166
|
},
|
|
165
167
|
children: [
|
|
166
|
-
|
|
167
|
-
const a = e[
|
|
168
|
-
return /* @__PURE__ */
|
|
168
|
+
D.map((e) => {
|
|
169
|
+
const a = e[O], u = P.has(String(a));
|
|
170
|
+
return /* @__PURE__ */ c(
|
|
169
171
|
"span",
|
|
170
172
|
{
|
|
171
|
-
title:
|
|
172
|
-
className:
|
|
173
|
+
title: u ? "This record is no longer an available option" : void 0,
|
|
174
|
+
className: X(
|
|
173
175
|
"inline-flex items-center gap-1 rounded-full border pl-2.5 pr-1.5 py-0.5 text-[12px]",
|
|
174
|
-
|
|
176
|
+
u ? "border-amber-300 bg-amber-50 text-amber-700 dark:border-amber-600 dark:bg-amber-950/30 dark:text-amber-400" : "border-slate-200 bg-slate-50 text-slate-700 dark:border-border dark:bg-muted dark:text-slate-200"
|
|
175
177
|
),
|
|
176
178
|
children: [
|
|
177
|
-
|
|
178
|
-
s && (
|
|
179
|
+
u && /* @__PURE__ */ r(he, { className: "h-3 w-3 shrink-0 text-amber-500" }),
|
|
180
|
+
s && (b && A ? /* @__PURE__ */ r(
|
|
179
181
|
"button",
|
|
180
182
|
{
|
|
181
183
|
type: "button",
|
|
182
184
|
title: "Open detail panel",
|
|
183
|
-
onClick: () =>
|
|
185
|
+
onClick: () => A.open({
|
|
184
186
|
collection: s,
|
|
185
187
|
itemId: String(a),
|
|
186
|
-
layoutId:
|
|
187
|
-
width:
|
|
188
|
+
layoutId: b.layout_id,
|
|
189
|
+
width: b.width
|
|
188
190
|
}),
|
|
189
191
|
className: "underline decoration-slate-300 decoration-dotted underline-offset-2 hover:text-[#172940] hover:decoration-nvr-cyan dark:hover:text-nvr-cyan",
|
|
190
|
-
children: /* @__PURE__ */
|
|
191
|
-
|
|
192
|
+
children: /* @__PURE__ */ r(
|
|
193
|
+
de,
|
|
192
194
|
{
|
|
193
195
|
collection: s,
|
|
194
196
|
id: a,
|
|
@@ -196,22 +198,22 @@ function ct({
|
|
|
196
198
|
}
|
|
197
199
|
)
|
|
198
200
|
}
|
|
199
|
-
) : /* @__PURE__ */
|
|
200
|
-
|
|
201
|
+
) : /* @__PURE__ */ r(
|
|
202
|
+
de,
|
|
201
203
|
{
|
|
202
204
|
collection: s,
|
|
203
205
|
id: a,
|
|
204
206
|
displayTemplate: o == null ? void 0 : o.display_template
|
|
205
207
|
}
|
|
206
208
|
)),
|
|
207
|
-
/* @__PURE__ */
|
|
209
|
+
/* @__PURE__ */ r(
|
|
208
210
|
"button",
|
|
209
211
|
{
|
|
210
212
|
type: "button",
|
|
211
213
|
"aria-label": "Remove",
|
|
212
|
-
onClick: () => t == null ? void 0 : t.stageUnlink(
|
|
214
|
+
onClick: () => t == null ? void 0 : t.stageUnlink(h, e.id),
|
|
213
215
|
className: "rounded-full p-0.5 text-slate-400 hover:text-red-500",
|
|
214
|
-
children: /* @__PURE__ */
|
|
216
|
+
children: /* @__PURE__ */ r(me, { className: "h-3 w-3" })
|
|
215
217
|
}
|
|
216
218
|
)
|
|
217
219
|
]
|
|
@@ -219,27 +221,27 @@ function ct({
|
|
|
219
221
|
String(e.id)
|
|
220
222
|
);
|
|
221
223
|
}),
|
|
222
|
-
|
|
224
|
+
re.map((e) => /* @__PURE__ */ c(
|
|
223
225
|
"span",
|
|
224
226
|
{
|
|
225
227
|
className: "inline-flex items-center gap-1 rounded-full border border-dashed border-nvr-cyan/50 bg-nvr-cyan/5 pl-2.5 pr-1.5 py-0.5 text-[12px] text-slate-600 dark:text-slate-300",
|
|
226
228
|
children: [
|
|
227
|
-
s ? /* @__PURE__ */
|
|
228
|
-
|
|
229
|
+
s ? /* @__PURE__ */ r(
|
|
230
|
+
de,
|
|
229
231
|
{
|
|
230
232
|
collection: s,
|
|
231
233
|
id: e,
|
|
232
234
|
displayTemplate: o == null ? void 0 : o.display_template
|
|
233
235
|
}
|
|
234
236
|
) : String(e),
|
|
235
|
-
/* @__PURE__ */
|
|
237
|
+
/* @__PURE__ */ r(
|
|
236
238
|
"button",
|
|
237
239
|
{
|
|
238
240
|
type: "button",
|
|
239
241
|
"aria-label": "Remove",
|
|
240
|
-
onClick: () => t == null ? void 0 : t.unstageLink(
|
|
242
|
+
onClick: () => t == null ? void 0 : t.unstageLink(h, e),
|
|
241
243
|
className: "rounded-full p-0.5 text-slate-400 hover:text-red-500",
|
|
242
|
-
children: /* @__PURE__ */
|
|
244
|
+
children: /* @__PURE__ */ r(me, { className: "h-3 w-3" })
|
|
243
245
|
}
|
|
244
246
|
)
|
|
245
247
|
]
|
|
@@ -248,327 +250,390 @@ function ct({
|
|
|
248
250
|
))
|
|
249
251
|
]
|
|
250
252
|
}
|
|
251
|
-
) : /* @__PURE__ */
|
|
252
|
-
/* @__PURE__ */
|
|
253
|
+
) : /* @__PURE__ */ r("span", { className: "truncate text-muted-foreground", children: "Select items…" }),
|
|
254
|
+
/* @__PURE__ */ r(ae, { className: "h-4 w-4 shrink-0 opacity-50" })
|
|
253
255
|
]
|
|
254
256
|
}
|
|
255
257
|
) }),
|
|
256
|
-
/* @__PURE__ */
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
}
|
|
265
|
-
),
|
|
266
|
-
/* @__PURE__ */ d(Se, { children: [
|
|
267
|
-
B ? /* @__PURE__ */ l("div", { className: "flex items-center justify-center py-4", children: /* @__PURE__ */ l(ce, { className: "h-4 w-4 animate-spin text-muted-foreground" }) }) : /* @__PURE__ */ l(Ne, { className: "py-3 text-left text-[12px] text-muted-foreground px-3", children: "No results" }),
|
|
268
|
-
/* @__PURE__ */ l(_e, { children: !B && (M ? [...ie(Z, y, G, w)] : [...ie(Z, y, G, w)].sort(
|
|
269
|
-
(e, a) => ye(w(e), w(a), y, h === "-label")
|
|
270
|
-
)).map((e) => {
|
|
271
|
-
const a = String(e.id), c = J.has(W(a));
|
|
272
|
-
return /* @__PURE__ */ d(
|
|
273
|
-
Le,
|
|
258
|
+
/* @__PURE__ */ r(je, { className: "w-[320px] p-0", align: "start", children: /* @__PURE__ */ c(
|
|
259
|
+
Se,
|
|
260
|
+
{
|
|
261
|
+
shouldFilter: !1,
|
|
262
|
+
...ne,
|
|
263
|
+
children: [
|
|
264
|
+
/* @__PURE__ */ r(
|
|
265
|
+
Ne,
|
|
274
266
|
{
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
267
|
+
placeholder: "Search…",
|
|
268
|
+
value: m,
|
|
269
|
+
onValueChange: L,
|
|
270
|
+
className: "h-9 text-[13px]"
|
|
271
|
+
}
|
|
272
|
+
),
|
|
273
|
+
/* @__PURE__ */ c(_e, { children: [
|
|
274
|
+
K ? /* @__PURE__ */ r("div", { className: "flex items-center justify-center py-4", children: /* @__PURE__ */ r(ue, { className: "h-4 w-4 animate-spin text-muted-foreground" }) }) : /* @__PURE__ */ r(Ce, { className: "py-3 text-left text-[12px] text-muted-foreground px-3", children: "No results" }),
|
|
275
|
+
!K && te && /* @__PURE__ */ c(
|
|
276
|
+
"p",
|
|
277
|
+
{
|
|
278
|
+
"data-picker-close-matches": !0,
|
|
279
|
+
className: "px-3 pb-1 pt-2 text-[11.5px] text-muted-foreground",
|
|
280
|
+
children: [
|
|
281
|
+
"No exact match for “",
|
|
282
|
+
m.trim(),
|
|
283
|
+
"” — did you mean:"
|
|
284
|
+
]
|
|
285
|
+
}
|
|
286
|
+
),
|
|
287
|
+
/* @__PURE__ */ r(Le, { children: !K && (B ? [...oe(ee, m, $, _)] : [...oe(ee, m, $, _)].sort(
|
|
288
|
+
(e, a) => ge(_(e), _(a), m, p === "-label")
|
|
289
|
+
)).map((e) => {
|
|
290
|
+
const a = String(e.id), u = M.has(Q(a));
|
|
291
|
+
return /* @__PURE__ */ c(
|
|
292
|
+
Oe,
|
|
293
|
+
{
|
|
294
|
+
value: a,
|
|
295
|
+
onSelect: () => W(e.id),
|
|
296
|
+
className: "flex items-center gap-2 text-[13px]",
|
|
297
|
+
children: [
|
|
298
|
+
/* @__PURE__ */ r(
|
|
299
|
+
"div",
|
|
300
|
+
{
|
|
301
|
+
className: X(
|
|
302
|
+
"flex h-4 w-4 shrink-0 items-center justify-center rounded border",
|
|
303
|
+
u ? "border-nvr-cyan bg-nvr-cyan" : "border-slate-300 dark:border-slate-500"
|
|
304
|
+
),
|
|
305
|
+
children: u && /* @__PURE__ */ r(ye, { className: "h-2.5 w-2.5 text-white" })
|
|
306
|
+
}
|
|
285
307
|
),
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
"
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
] }) })
|
|
308
|
+
s === "nivaro_users" && /* @__PURE__ */ r(
|
|
309
|
+
we,
|
|
310
|
+
{
|
|
311
|
+
userId: a,
|
|
312
|
+
className: "h-4 w-4",
|
|
313
|
+
fallback: /* @__PURE__ */ r("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: Ie(_(e)) })
|
|
314
|
+
}
|
|
315
|
+
),
|
|
316
|
+
s === "nivaro_users" && G.has(a.toUpperCase()) && /* @__PURE__ */ r(
|
|
317
|
+
"span",
|
|
318
|
+
{
|
|
319
|
+
className: "h-1.5 w-1.5 shrink-0 rounded-full bg-emerald-500",
|
|
320
|
+
"data-tip": "Online now"
|
|
321
|
+
}
|
|
322
|
+
),
|
|
323
|
+
/* @__PURE__ */ r("span", { className: "truncate", children: _(e) })
|
|
324
|
+
]
|
|
325
|
+
},
|
|
326
|
+
a
|
|
327
|
+
);
|
|
328
|
+
}) })
|
|
329
|
+
] })
|
|
330
|
+
]
|
|
331
|
+
}
|
|
332
|
+
) })
|
|
312
333
|
]
|
|
313
334
|
}
|
|
314
335
|
) });
|
|
315
336
|
}
|
|
316
|
-
function
|
|
317
|
-
const { client: i, relatedCollection:
|
|
318
|
-
U(`/items/${
|
|
319
|
-
limit:
|
|
320
|
-
search:
|
|
321
|
-
|
|
337
|
+
function $e(n) {
|
|
338
|
+
const { client: i, relatedCollection: f, search: d, filterParam: p, serverSort: w, templateNestedFields: x } = n, b = (j) => i.request(
|
|
339
|
+
U(`/items/${f}`, {
|
|
340
|
+
limit: De,
|
|
341
|
+
search: j || void 0,
|
|
342
|
+
// Typo pass (fix11-search): close matches only when the exact search finds nothing.
|
|
343
|
+
...j ? { typo: "1" } : {},
|
|
344
|
+
filter: p,
|
|
322
345
|
picker: "1",
|
|
323
346
|
// A dotted display template ({{core_category.name}}) needs the
|
|
324
347
|
// nested expansion — a bare row only carries the FK id.
|
|
325
|
-
...
|
|
326
|
-
...
|
|
348
|
+
...x ? { fields: x } : {},
|
|
349
|
+
...w ? { sort: w } : {}
|
|
327
350
|
})
|
|
328
|
-
).then((s) => s.data ?? []),
|
|
351
|
+
).then((s) => s.data ?? []), v = (j) => [
|
|
329
352
|
"m2m-options",
|
|
353
|
+
f,
|
|
354
|
+
j,
|
|
330
355
|
p,
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
queryKey: x(""),
|
|
337
|
-
queryFn: () => F(""),
|
|
356
|
+
w ?? "",
|
|
357
|
+
x ?? ""
|
|
358
|
+
], A = p ? 0 : 3e4, { data: t, isFetching: N } = q({
|
|
359
|
+
queryKey: v(""),
|
|
360
|
+
queryFn: () => b(""),
|
|
338
361
|
enabled: n.enabled,
|
|
339
|
-
staleTime:
|
|
340
|
-
}),
|
|
341
|
-
queryKey:
|
|
342
|
-
queryFn: () =>
|
|
343
|
-
enabled: n.enabled &&
|
|
344
|
-
staleTime:
|
|
362
|
+
staleTime: A
|
|
363
|
+
}), S = We(t, d, n.labelOf), { data: m, isFetching: L } = q({
|
|
364
|
+
queryKey: v(d),
|
|
365
|
+
queryFn: () => b(d),
|
|
366
|
+
enabled: n.enabled && S,
|
|
367
|
+
staleTime: A
|
|
345
368
|
});
|
|
346
|
-
return
|
|
369
|
+
return S ? {
|
|
370
|
+
options: m ?? [],
|
|
371
|
+
isLoading: !m && L,
|
|
372
|
+
localSearch: !1,
|
|
373
|
+
closeMatches: Ve(m)
|
|
374
|
+
} : { options: t ?? [], isLoading: !t && N, localSearch: !!d };
|
|
347
375
|
}
|
|
348
|
-
const
|
|
349
|
-
function
|
|
350
|
-
return i.trim() ? !n || n.length >=
|
|
376
|
+
const De = 200;
|
|
377
|
+
function We(n, i, f) {
|
|
378
|
+
return i.trim() ? !n || n.length >= De ? !0 : oe(n, i, !0, f).length === 0 : !1;
|
|
351
379
|
}
|
|
352
|
-
function
|
|
353
|
-
return !
|
|
380
|
+
function oe(n, i, f, d) {
|
|
381
|
+
return !f || !i.trim() ? n : n.filter((p) => Ge(d(p), i));
|
|
354
382
|
}
|
|
355
|
-
function
|
|
383
|
+
function ht({
|
|
356
384
|
relation: n,
|
|
357
385
|
parentId: i,
|
|
358
|
-
allRelations:
|
|
359
|
-
extraFilter:
|
|
360
|
-
optionSort:
|
|
361
|
-
requiredParent:
|
|
362
|
-
onCountChange:
|
|
363
|
-
readOnly:
|
|
386
|
+
allRelations: f,
|
|
387
|
+
extraFilter: d,
|
|
388
|
+
optionSort: p,
|
|
389
|
+
requiredParent: w,
|
|
390
|
+
onCountChange: x,
|
|
391
|
+
readOnly: b
|
|
364
392
|
}) {
|
|
365
|
-
const
|
|
366
|
-
(
|
|
367
|
-
), s =
|
|
393
|
+
const v = be(), A = ze(), t = Ae(), [N, S] = E(!1), [m, L] = E(""), j = f.find(
|
|
394
|
+
(l) => l.many_collection === n.many_collection && l.many_field === n.junction_field && l.id !== n.id
|
|
395
|
+
), s = Ke(j), O = n.junction_field ?? "", R = n.many_field ?? "", h = n.one_field ?? `${n.many_collection}.${O}`, { data: o } = q({
|
|
368
396
|
queryKey: ["col-meta", s],
|
|
369
|
-
queryFn: () =>
|
|
397
|
+
queryFn: () => v.request(U(`/collections/${s}`)).then((l) => l.data),
|
|
370
398
|
enabled: !!s,
|
|
371
399
|
staleTime: 3e5,
|
|
372
400
|
retry: !1
|
|
373
|
-
}), { data:
|
|
374
|
-
queryKey: ["m2m-items", n.many_collection,
|
|
375
|
-
queryFn: () =>
|
|
401
|
+
}), { data: H = [], isFetching: ce } = q({
|
|
402
|
+
queryKey: ["m2m-items", n.many_collection, R, i],
|
|
403
|
+
queryFn: () => v.request(
|
|
376
404
|
U(`/items/${n.many_collection}`, {
|
|
377
|
-
filter: JSON.stringify({ [
|
|
405
|
+
filter: JSON.stringify({ [R]: { _eq: i } }),
|
|
378
406
|
limit: 1,
|
|
379
|
-
fields: `id,${
|
|
407
|
+
fields: `id,${O}`
|
|
380
408
|
})
|
|
381
|
-
).then((
|
|
409
|
+
).then((l) => l.data ?? []),
|
|
382
410
|
staleTime: 3e4,
|
|
383
411
|
enabled: !!i && i !== "new"
|
|
384
|
-
}),
|
|
385
|
-
const
|
|
386
|
-
if (!
|
|
387
|
-
const
|
|
388
|
-
return
|
|
412
|
+
}), z = xe().isAdmin, G = s === "nivaro_users" ? ke(z) : null, Y = ve(s === "nivaro_users"), V = d ? G ? { _and: [d, G] } : d : G, B = V ? JSON.stringify(V) : void 0, Z = p && !/^-?label$/.test(p) ? p : void 0, ee = (() => {
|
|
413
|
+
const l = o == null ? void 0 : o.display_template;
|
|
414
|
+
if (!l || !l.includes(".")) return null;
|
|
415
|
+
const g = [...l.matchAll(/\{\{([^}]+)\}\}/g)].map((ie) => ie[1].trim());
|
|
416
|
+
return g.length === 0 ? null : ["id", ...g].join(",");
|
|
389
417
|
})(), {
|
|
390
|
-
options:
|
|
391
|
-
isLoading:
|
|
392
|
-
localSearch:
|
|
393
|
-
|
|
394
|
-
|
|
418
|
+
options: K,
|
|
419
|
+
isLoading: $,
|
|
420
|
+
localSearch: te,
|
|
421
|
+
closeMatches: ne
|
|
422
|
+
} = $e({
|
|
423
|
+
client: v,
|
|
395
424
|
relatedCollection: s,
|
|
396
|
-
search:
|
|
397
|
-
filterParam:
|
|
398
|
-
serverSort:
|
|
399
|
-
templateNestedFields:
|
|
400
|
-
enabled:
|
|
425
|
+
search: m,
|
|
426
|
+
filterParam: B,
|
|
427
|
+
serverSort: Z,
|
|
428
|
+
templateNestedFields: ee,
|
|
429
|
+
enabled: N && !!s,
|
|
401
430
|
labelOf: e
|
|
402
|
-
}),
|
|
403
|
-
|
|
404
|
-
var
|
|
405
|
-
(
|
|
406
|
-
}, [
|
|
407
|
-
const { data:
|
|
408
|
-
queryKey: ["relation-single", s, String(
|
|
409
|
-
queryFn: () =>
|
|
410
|
-
enabled: !!s &&
|
|
431
|
+
}), re = Pe(!!ne, m), F = (t == null ? void 0 : t.getStagedLinks(h)) ?? [], D = (t == null ? void 0 : t.getStagedUnlinks(h)) ?? /* @__PURE__ */ new Set(), k = H.find((l) => !D.has(l.id)) ?? null, T = k ? k[O] : null, le = F.length > 0 ? F[F.length - 1] : null, y = le ?? T, se = F.length > 0 || D.size > 0, P = fe(x);
|
|
432
|
+
P.current = x, pe(() => {
|
|
433
|
+
var l;
|
|
434
|
+
(l = P.current) == null || l.call(P, y != null ? 1 : 0);
|
|
435
|
+
}, [y]);
|
|
436
|
+
const { data: J } = q({
|
|
437
|
+
queryKey: ["relation-single", s, String(y)],
|
|
438
|
+
queryFn: () => A(s, y),
|
|
439
|
+
enabled: !!s && y != null,
|
|
411
440
|
staleTime: 6e4
|
|
412
|
-
}),
|
|
413
|
-
queryKey: ["relation-avail", s, String(
|
|
414
|
-
queryFn: () =>
|
|
441
|
+
}), M = JSON.stringify(d ? { _and: [{ id: { _eq: y } }, d] } : { id: { _eq: y } }), { data: I } = q({
|
|
442
|
+
queryKey: ["relation-avail", s, String(y), B],
|
|
443
|
+
queryFn: () => v.request(
|
|
415
444
|
U(`/items/${s}`, {
|
|
416
|
-
filter:
|
|
445
|
+
filter: M,
|
|
417
446
|
picker: "1",
|
|
418
447
|
limit: 1,
|
|
419
448
|
fields: "id"
|
|
420
449
|
})
|
|
421
|
-
).then((
|
|
422
|
-
enabled: !!s &&
|
|
450
|
+
).then((l) => l.data ?? []),
|
|
451
|
+
enabled: !!s && y != null && !!J,
|
|
423
452
|
staleTime: 3e4
|
|
424
|
-
}),
|
|
425
|
-
function e(
|
|
426
|
-
const
|
|
427
|
-
return
|
|
453
|
+
}), W = I !== void 0 && I.length === 0, _ = Be(W);
|
|
454
|
+
function e(l) {
|
|
455
|
+
const g = (o == null ? void 0 : o.display_template) ?? null;
|
|
456
|
+
return g ? Te(g, l) : String(l.name ?? l.title ?? l.label ?? l.id ?? "");
|
|
428
457
|
}
|
|
429
|
-
const a =
|
|
430
|
-
if (
|
|
431
|
-
return /* @__PURE__ */
|
|
432
|
-
function
|
|
433
|
-
for (const
|
|
434
|
-
|
|
458
|
+
const a = K.find((l) => String(l.id) === String(y)) ?? J, u = y != null && !J && !a, C = a ? e(a) : null;
|
|
459
|
+
if (b)
|
|
460
|
+
return /* @__PURE__ */ r("span", { className: "block truncate text-[12px] text-slate-700 dark:text-slate-200", children: u ? "…" : C ?? "—" });
|
|
461
|
+
function Je(l) {
|
|
462
|
+
for (const g of F) t == null || t.unstageLink(h, g);
|
|
463
|
+
k && !D.has(k.id) && (t == null || t.stageUnlink(h, k.id)), String(l) === String(T) && k ? t == null || t.unstageUnlink(h, k.id) : String(l) !== String(y) && (t == null || t.stageLink(h, l)), S(!1), L("");
|
|
435
464
|
}
|
|
436
|
-
function
|
|
437
|
-
for (const
|
|
438
|
-
|
|
465
|
+
function Me() {
|
|
466
|
+
for (const l of F) t == null || t.unstageLink(h, l);
|
|
467
|
+
k && (t == null || t.stageUnlink(h, k.id)), S(!1);
|
|
439
468
|
}
|
|
440
|
-
return
|
|
469
|
+
return w ? /* @__PURE__ */ c(
|
|
441
470
|
"button",
|
|
442
471
|
{
|
|
443
472
|
type: "button",
|
|
444
473
|
disabled: !0,
|
|
445
474
|
className: "w-full h-9 px-3 text-[12px] border border-input rounded-md bg-background text-left flex items-center justify-between opacity-50 cursor-not-allowed",
|
|
446
475
|
children: [
|
|
447
|
-
/* @__PURE__ */
|
|
476
|
+
/* @__PURE__ */ c("span", { className: "truncate text-muted-foreground", children: [
|
|
448
477
|
"Select ",
|
|
449
|
-
|
|
478
|
+
w,
|
|
450
479
|
" first"
|
|
451
480
|
] }),
|
|
452
|
-
/* @__PURE__ */
|
|
481
|
+
/* @__PURE__ */ r(ae, { className: "h-4 w-4 shrink-0 opacity-50" })
|
|
453
482
|
]
|
|
454
483
|
}
|
|
455
|
-
) : /* @__PURE__ */
|
|
456
|
-
/* @__PURE__ */
|
|
457
|
-
|
|
484
|
+
) : /* @__PURE__ */ c("div", { ..._.bind, children: [
|
|
485
|
+
/* @__PURE__ */ c(
|
|
486
|
+
Fe,
|
|
458
487
|
{
|
|
459
|
-
open:
|
|
460
|
-
onOpenChange: (
|
|
461
|
-
|
|
488
|
+
open: N,
|
|
489
|
+
onOpenChange: (l) => {
|
|
490
|
+
S(l), l || L("");
|
|
462
491
|
},
|
|
463
492
|
children: [
|
|
464
|
-
/* @__PURE__ */
|
|
493
|
+
/* @__PURE__ */ r(qe, { asChild: !0, children: /* @__PURE__ */ c(
|
|
465
494
|
"button",
|
|
466
495
|
{
|
|
467
496
|
type: "button",
|
|
468
|
-
className:
|
|
497
|
+
className: X(
|
|
469
498
|
"w-full h-9 px-3 text-[12px] border rounded-md bg-background text-left flex items-center justify-between hover:bg-muted cursor-pointer transition-colors disabled:pointer-events-none disabled:opacity-50",
|
|
470
|
-
|
|
499
|
+
W ? "border-amber-300 dark:border-amber-600" : se ? "border-nvr-cyan/50" : "border-input"
|
|
471
500
|
),
|
|
472
501
|
children: [
|
|
473
|
-
|
|
502
|
+
u || ce && le == null && i !== "new" ? /* @__PURE__ */ r(ue, { className: "h-3.5 w-3.5 animate-spin text-muted-foreground" }) : /* @__PURE__ */ c(
|
|
474
503
|
"span",
|
|
475
504
|
{
|
|
476
|
-
className:
|
|
505
|
+
className: X(
|
|
477
506
|
"flex items-center gap-1.5 truncate min-w-0",
|
|
478
|
-
|
|
507
|
+
C ? se ? "text-nvr-cyan" : "text-slate-800 dark:text-slate-100" : "text-muted-foreground"
|
|
479
508
|
),
|
|
480
509
|
children: [
|
|
481
|
-
|
|
482
|
-
/* @__PURE__ */
|
|
510
|
+
W && /* @__PURE__ */ r(he, { className: "h-3.5 w-3.5 shrink-0 text-amber-500" }),
|
|
511
|
+
/* @__PURE__ */ r("span", { className: "truncate", children: C ?? "Select…" })
|
|
483
512
|
]
|
|
484
513
|
}
|
|
485
514
|
),
|
|
486
|
-
/* @__PURE__ */
|
|
515
|
+
/* @__PURE__ */ r(ae, { className: "h-4 w-4 shrink-0 opacity-50" })
|
|
487
516
|
]
|
|
488
517
|
}
|
|
489
518
|
) }),
|
|
490
|
-
/* @__PURE__ */
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
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",
|
|
508
|
-
children: [
|
|
509
|
-
/* @__PURE__ */ l(de, { className: "h-3.5 w-3.5 text-slate-400" }),
|
|
510
|
-
"Clear selection"
|
|
511
|
-
]
|
|
512
|
-
}
|
|
513
|
-
),
|
|
514
|
-
/* @__PURE__ */ d(Se, { children: [
|
|
515
|
-
G ? /* @__PURE__ */ l("div", { className: "flex items-center justify-center py-4", children: /* @__PURE__ */ l(ce, { className: "h-4 w-4 animate-spin text-muted-foreground" }) }) : /* @__PURE__ */ l(Ne, { className: "py-3 text-left text-[12px] text-muted-foreground px-3", children: "No results" }),
|
|
516
|
-
!G && /* @__PURE__ */ l(_e, { children: [...ie(B, y, ee, e)].sort(
|
|
517
|
-
(r, b) => Y ? 0 : ye(e(r), e(b), y, h === "-label")
|
|
518
|
-
).map((r) => {
|
|
519
|
-
const b = String(r.id), le = String(f) === b;
|
|
520
|
-
return /* @__PURE__ */ d(
|
|
521
|
-
Le,
|
|
519
|
+
/* @__PURE__ */ r(je, { className: "w-[320px] p-0", align: "start", children: /* @__PURE__ */ c(
|
|
520
|
+
Se,
|
|
521
|
+
{
|
|
522
|
+
shouldFilter: !1,
|
|
523
|
+
...re,
|
|
524
|
+
children: [
|
|
525
|
+
/* @__PURE__ */ r(
|
|
526
|
+
Ne,
|
|
527
|
+
{
|
|
528
|
+
placeholder: "Search…",
|
|
529
|
+
value: m,
|
|
530
|
+
onValueChange: L,
|
|
531
|
+
className: "h-9 text-[12px]"
|
|
532
|
+
}
|
|
533
|
+
),
|
|
534
|
+
y != null && /* @__PURE__ */ c(
|
|
535
|
+
"button",
|
|
522
536
|
{
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
537
|
+
type: "button",
|
|
538
|
+
onClick: () => {
|
|
539
|
+
Me(), S(!1);
|
|
540
|
+
},
|
|
541
|
+
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",
|
|
526
542
|
children: [
|
|
527
|
-
/* @__PURE__ */
|
|
528
|
-
|
|
529
|
-
{
|
|
530
|
-
className: Q(
|
|
531
|
-
"flex h-4 w-4 shrink-0 items-center justify-center rounded-full border transition-colors",
|
|
532
|
-
le ? "border-nvr-cyan bg-nvr-cyan" : "border-slate-300 dark:border-slate-500"
|
|
533
|
-
),
|
|
534
|
-
children: le && /* @__PURE__ */ l(me, { className: "h-2.5 w-2.5 text-white" })
|
|
535
|
-
}
|
|
536
|
-
),
|
|
537
|
-
s === "nivaro_users" && /* @__PURE__ */ l(
|
|
538
|
-
ve,
|
|
539
|
-
{
|
|
540
|
-
userId: b,
|
|
541
|
-
className: "h-4 w-4",
|
|
542
|
-
fallback: /* @__PURE__ */ l("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: Te(e(r)) })
|
|
543
|
-
}
|
|
544
|
-
),
|
|
545
|
-
s === "nivaro_users" && H.has(b.toUpperCase()) && /* @__PURE__ */ l(
|
|
546
|
-
"span",
|
|
547
|
-
{
|
|
548
|
-
className: "h-1.5 w-1.5 shrink-0 rounded-full bg-emerald-500",
|
|
549
|
-
"data-tip": "Online now"
|
|
550
|
-
}
|
|
551
|
-
),
|
|
552
|
-
/* @__PURE__ */ l("span", { className: "truncate", children: e(r) })
|
|
543
|
+
/* @__PURE__ */ r(me, { className: "h-3.5 w-3.5 text-slate-400" }),
|
|
544
|
+
"Clear selection"
|
|
553
545
|
]
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
546
|
+
}
|
|
547
|
+
),
|
|
548
|
+
/* @__PURE__ */ c(_e, { children: [
|
|
549
|
+
$ ? /* @__PURE__ */ r("div", { className: "flex items-center justify-center py-4", children: /* @__PURE__ */ r(ue, { className: "h-4 w-4 animate-spin text-muted-foreground" }) }) : /* @__PURE__ */ r(Ce, { className: "py-3 text-left text-[12px] text-muted-foreground px-3", children: "No results" }),
|
|
550
|
+
!$ && ne && /* @__PURE__ */ c(
|
|
551
|
+
"p",
|
|
552
|
+
{
|
|
553
|
+
"data-picker-close-matches": !0,
|
|
554
|
+
className: "px-3 pb-1 pt-2 text-[11.5px] text-muted-foreground",
|
|
555
|
+
children: [
|
|
556
|
+
"No exact match for “",
|
|
557
|
+
m.trim(),
|
|
558
|
+
"” — did you mean:"
|
|
559
|
+
]
|
|
560
|
+
}
|
|
561
|
+
),
|
|
562
|
+
!$ && /* @__PURE__ */ r(Le, { children: [...oe(K, m, te, e)].sort(
|
|
563
|
+
(l, g) => Z ? 0 : ge(e(l), e(g), m, p === "-label")
|
|
564
|
+
).map((l) => {
|
|
565
|
+
const g = String(l.id), ie = String(y) === g;
|
|
566
|
+
return /* @__PURE__ */ c(
|
|
567
|
+
Oe,
|
|
568
|
+
{
|
|
569
|
+
value: g,
|
|
570
|
+
onSelect: () => Je(l.id),
|
|
571
|
+
className: "flex items-center gap-2 text-[12px]",
|
|
572
|
+
children: [
|
|
573
|
+
/* @__PURE__ */ r(
|
|
574
|
+
"div",
|
|
575
|
+
{
|
|
576
|
+
className: X(
|
|
577
|
+
"flex h-4 w-4 shrink-0 items-center justify-center rounded-full border transition-colors",
|
|
578
|
+
ie ? "border-nvr-cyan bg-nvr-cyan" : "border-slate-300 dark:border-slate-500"
|
|
579
|
+
),
|
|
580
|
+
children: ie && /* @__PURE__ */ r(ye, { className: "h-2.5 w-2.5 text-white" })
|
|
581
|
+
}
|
|
582
|
+
),
|
|
583
|
+
s === "nivaro_users" && /* @__PURE__ */ r(
|
|
584
|
+
we,
|
|
585
|
+
{
|
|
586
|
+
userId: g,
|
|
587
|
+
className: "h-4 w-4",
|
|
588
|
+
fallback: /* @__PURE__ */ r("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: Ie(e(l)) })
|
|
589
|
+
}
|
|
590
|
+
),
|
|
591
|
+
s === "nivaro_users" && Y.has(g.toUpperCase()) && /* @__PURE__ */ r(
|
|
592
|
+
"span",
|
|
593
|
+
{
|
|
594
|
+
className: "h-1.5 w-1.5 shrink-0 rounded-full bg-emerald-500",
|
|
595
|
+
"data-tip": "Online now"
|
|
596
|
+
}
|
|
597
|
+
),
|
|
598
|
+
/* @__PURE__ */ r("span", { className: "truncate", children: e(l) })
|
|
599
|
+
]
|
|
600
|
+
},
|
|
601
|
+
g
|
|
602
|
+
);
|
|
603
|
+
}) })
|
|
604
|
+
] })
|
|
605
|
+
]
|
|
606
|
+
}
|
|
607
|
+
) })
|
|
560
608
|
]
|
|
561
609
|
}
|
|
562
610
|
),
|
|
563
|
-
|
|
611
|
+
_.tip
|
|
564
612
|
] });
|
|
565
613
|
}
|
|
614
|
+
function Pe(n, i) {
|
|
615
|
+
const [f, d] = E(null), [p, w] = E(!1), x = fe(!1);
|
|
616
|
+
return pe(() => {
|
|
617
|
+
d(null), x.current = !1;
|
|
618
|
+
}, [i]), n ? {
|
|
619
|
+
value: f ?? (p ? " " : ""),
|
|
620
|
+
onValueChange: (b) => {
|
|
621
|
+
x.current ? d(b) : w((v) => !v);
|
|
622
|
+
},
|
|
623
|
+
onKeyDownCapture: (b) => {
|
|
624
|
+
b.key === "ArrowDown" || b.key === "ArrowUp" ? x.current = !0 : b.key === "Enter" && !x.current && (b.preventDefault(), b.stopPropagation());
|
|
625
|
+
},
|
|
626
|
+
onPointerMoveCapture: () => {
|
|
627
|
+
x.current = !0;
|
|
628
|
+
}
|
|
629
|
+
} : {};
|
|
630
|
+
}
|
|
566
631
|
export {
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
632
|
+
pt as M2MCombobox,
|
|
633
|
+
ht as M2MSingleSelectCombobox,
|
|
634
|
+
ft as m2aWriteMeta,
|
|
635
|
+
We as m2mAsksServer,
|
|
636
|
+
Q as m2mIdKey,
|
|
637
|
+
oe as narrowM2MOptions,
|
|
638
|
+
Ke as resolveM2MRelatedCollection
|
|
574
639
|
};
|