@nivaro/react 0.3.64 → 0.3.66
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +62 -8
- package/dist/shared/components/CollectionBrowserView.js +3127 -3204
- package/dist/shared/components/ConformanceView.js +235 -221
- package/dist/shared/components/DataTable.js +478 -459
- package/dist/shared/components/ItemEditForm.js +4842 -4500
- package/dist/shared/components/MyWorkView.js +124 -113
- package/dist/shared/components/PageRenderer.js +146 -138
- package/dist/shared/components/ProfileView.js +483 -472
- package/dist/shared/components/RecordDrilldownSheet.js +73 -65
- package/dist/shared/components/ReportView.js +1100 -1094
- package/dist/shared/components/bulk/BulkActionButtons.js +72 -72
- package/dist/shared/components/bulk/BulkCompareButton.js +62 -0
- package/dist/shared/components/bulk/BulkFieldUpdate.js +114 -103
- package/dist/shared/components/bulk/BulkFieldUpdateButton.js +73 -0
- package/dist/shared/components/bulk/MessageStakeholders.js +235 -0
- package/dist/shared/components/bulk/bulk-field-options.js +29 -23
- package/dist/shared/components/integrations/IntegrationObligationsView.js +191 -173
- package/dist/shared/components/integrations/IntegrationStatusLines.js +101 -85
- package/dist/shared/components/integrations/RecordIntegrationPreview.js +11 -9
- package/dist/shared/components/integrations/SendCurrentData.js +126 -0
- package/dist/shared/components/item-edit/CatalogPickerField.js +1535 -1440
- package/dist/shared/components/item-edit/FieldRenderer.js +49 -45
- package/dist/shared/components/item-edit/FieldRow.js +413 -403
- package/dist/shared/components/item-edit/GroupSection.js +555 -538
- package/dist/shared/components/item-edit/InlineTableField.js +2903 -2816
- package/dist/shared/components/item-edit/M2MCombobox.js +407 -338
- package/dist/shared/components/item-edit/MidairCollisionDialog.js +367 -116
- package/dist/shared/components/item-edit/NestedRelationEditor.js +171 -163
- package/dist/shared/components/item-edit/PlanGrid.js +783 -724
- package/dist/shared/components/item-edit/QuickCreateButton.js +291 -224
- package/dist/shared/components/item-edit/RecordInsights.js +113 -111
- package/dist/shared/components/item-edit/RecordLiveSync.js +4 -1
- package/dist/shared/components/item-edit/RelationCombobox.js +398 -364
- package/dist/shared/components/item-edit/SummaryPanel.js +146 -144
- package/dist/shared/components/item-edit/UserChip.js +264 -229
- package/dist/shared/components/item-edit/cascade-clear-notice.js +56 -0
- package/dist/shared/components/item-edit/collision-format.js +37 -0
- package/dist/shared/components/item-edit/field-a11y.js +25 -0
- package/dist/shared/components/item-edit/header-path-preview.js +52 -0
- package/dist/shared/components/item-edit/line-merge.js +84 -0
- package/dist/shared/components/item-edit/line-midair.js +94 -87
- package/dist/shared/components/item-edit/move-guard.js +17 -0
- package/dist/shared/components/item-edit/picker-search.js +27 -16
- package/dist/shared/components/item-edit/rail-width.js +8 -0
- package/dist/shared/components/monitoring/InactiveUserLinksView.js +126 -124
- package/dist/shared/components/panels/AccessDeniedPanel.js +96 -55
- package/dist/shared/components/panels/CommentPanel.js +142 -136
- package/dist/shared/components/panels/ItemLockBanner.js +246 -240
- package/dist/shared/components/panels/PipelinePanel.js +1366 -1194
- package/dist/shared/components/panels/RevisionsPanel.js +106 -102
- package/dist/shared/components/panels/SlaBreachBanner.js +16 -20
- package/dist/shared/components/panels/SlaClock.js +90 -68
- package/dist/shared/components/queue/QueueItemSheet.js +94 -87
- package/dist/shared/components/queue/QueueWorklist.js +1522 -1347
- package/dist/shared/components/queue/worklist-csv.js +75 -0
- package/dist/shared/components/queue/worklist-helpers.js +20 -0
- package/dist/shared/components/widgets/ReviewListWidget.js +226 -207
- package/dist/shared/lib/bulk-copy.js +17 -0
- package/dist/shared/lib/cbv-export.js +122 -0
- package/dist/shared/lib/delete-offer.js +13 -0
- package/dist/shared/lib/error-hints.js +1 -0
- package/dist/shared/lib/leave-guard.js +41 -26
- package/dist/shared/lib/list-link.js +72 -56
- package/dist/shared/lib/live-queries.js +32 -30
- package/dist/shared/lib/moved-notice.js +25 -0
- package/dist/shared/lib/notification-target.js +56 -54
- package/dist/shared/lib/obligation-banner.js +11 -8
- package/dist/shared/lib/obligation-reason-text.js +6 -6
- package/dist/shared/lib/quick-filter-cascade.js +29 -19
- package/dist/shared/lib/sort-cycle.js +6 -0
- package/dist/shared/lib/summary-mode.js +59 -41
- package/package.json +1 -1
|
@@ -1,124 +1,126 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useQuery as
|
|
3
|
-
import { ChevronDown as
|
|
4
|
-
import { useState as
|
|
5
|
-
import { useNivaroClient as
|
|
6
|
-
import { parseAllowedCollections as
|
|
1
|
+
import { jsx as r, jsxs as c } from "react/jsx-runtime";
|
|
2
|
+
import { useQuery as q } from "@tanstack/react-query";
|
|
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
|
-
|
|
19
|
-
return n.replace(/\(.*$/, "").trim().split(/\s+/).map((i) => i[0]).filter(Boolean).slice(0, 2).join("").toUpperCase() || "?";
|
|
20
|
-
}
|
|
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";
|
|
21
19
|
function Ie(n) {
|
|
22
|
-
return
|
|
20
|
+
return n.replace(/\(.*$/, "").trim().split(/\s+/).map((i) => i[0]).filter(Boolean).slice(0, 2).join("").toUpperCase() || "?";
|
|
23
21
|
}
|
|
24
22
|
function Ue(n) {
|
|
23
|
+
return Re(n == null ? void 0 : n.one_allowed_collections);
|
|
24
|
+
}
|
|
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
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
|
+
allRelations: f,
|
|
44
45
|
extraFilter: d,
|
|
45
|
-
optionSort:
|
|
46
|
-
requiredParent:
|
|
47
|
-
onCountChange:
|
|
48
|
-
drilldown:
|
|
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
|
-
I.current =
|
|
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 = I.current) == null || e.call(I,
|
|
103
|
-
}, [
|
|
104
|
-
function
|
|
104
|
+
(e = I.current) == null || e.call(I, M.size);
|
|
105
|
+
}, [M.size]);
|
|
106
|
+
function W(e) {
|
|
105
107
|
const a = Q(e);
|
|
106
|
-
if (
|
|
107
|
-
t == null || t.unstageLink(
|
|
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",
|
|
@@ -127,31 +129,35 @@ function ct({
|
|
|
127
129
|
children: [
|
|
128
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
|
-
(e.key ===
|
|
152
|
+
if (e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey && (N || m !== "" || e.key !== " ")) {
|
|
153
|
+
e.preventDefault();
|
|
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));
|
|
151
157
|
},
|
|
152
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",
|
|
153
159
|
children: [
|
|
154
|
-
|
|
160
|
+
M.size > 0 ? /* @__PURE__ */ c(
|
|
155
161
|
"span",
|
|
156
162
|
{
|
|
157
163
|
className: "flex min-w-0 flex-1 flex-wrap items-center gap-1",
|
|
@@ -159,32 +165,32 @@ function ct({
|
|
|
159
165
|
e.target.closest("button") && e.stopPropagation();
|
|
160
166
|
},
|
|
161
167
|
children: [
|
|
162
|
-
|
|
163
|
-
const a = e[
|
|
168
|
+
D.map((e) => {
|
|
169
|
+
const a = e[O], u = P.has(String(a));
|
|
164
170
|
return /* @__PURE__ */ c(
|
|
165
171
|
"span",
|
|
166
172
|
{
|
|
167
|
-
title:
|
|
168
|
-
className:
|
|
173
|
+
title: u ? "This record is no longer an available option" : void 0,
|
|
174
|
+
className: X(
|
|
169
175
|
"inline-flex items-center gap-1 rounded-full border pl-2.5 pr-1.5 py-0.5 text-[12px]",
|
|
170
|
-
|
|
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"
|
|
171
177
|
),
|
|
172
178
|
children: [
|
|
173
|
-
|
|
174
|
-
s && (
|
|
179
|
+
u && /* @__PURE__ */ r(he, { className: "h-3 w-3 shrink-0 text-amber-500" }),
|
|
180
|
+
s && (b && A ? /* @__PURE__ */ r(
|
|
175
181
|
"button",
|
|
176
182
|
{
|
|
177
183
|
type: "button",
|
|
178
184
|
title: "Open detail panel",
|
|
179
|
-
onClick: () =>
|
|
185
|
+
onClick: () => A.open({
|
|
180
186
|
collection: s,
|
|
181
187
|
itemId: String(a),
|
|
182
|
-
layoutId:
|
|
183
|
-
width:
|
|
188
|
+
layoutId: b.layout_id,
|
|
189
|
+
width: b.width
|
|
184
190
|
}),
|
|
185
191
|
className: "underline decoration-slate-300 decoration-dotted underline-offset-2 hover:text-[#172940] hover:decoration-nvr-cyan dark:hover:text-nvr-cyan",
|
|
186
|
-
children: /* @__PURE__ */
|
|
187
|
-
|
|
192
|
+
children: /* @__PURE__ */ r(
|
|
193
|
+
de,
|
|
188
194
|
{
|
|
189
195
|
collection: s,
|
|
190
196
|
id: a,
|
|
@@ -192,22 +198,22 @@ function ct({
|
|
|
192
198
|
}
|
|
193
199
|
)
|
|
194
200
|
}
|
|
195
|
-
) : /* @__PURE__ */
|
|
196
|
-
|
|
201
|
+
) : /* @__PURE__ */ r(
|
|
202
|
+
de,
|
|
197
203
|
{
|
|
198
204
|
collection: s,
|
|
199
205
|
id: a,
|
|
200
206
|
displayTemplate: o == null ? void 0 : o.display_template
|
|
201
207
|
}
|
|
202
208
|
)),
|
|
203
|
-
/* @__PURE__ */
|
|
209
|
+
/* @__PURE__ */ r(
|
|
204
210
|
"button",
|
|
205
211
|
{
|
|
206
212
|
type: "button",
|
|
207
213
|
"aria-label": "Remove",
|
|
208
|
-
onClick: () => t == null ? void 0 : t.stageUnlink(
|
|
214
|
+
onClick: () => t == null ? void 0 : t.stageUnlink(h, e.id),
|
|
209
215
|
className: "rounded-full p-0.5 text-slate-400 hover:text-red-500",
|
|
210
|
-
children: /* @__PURE__ */
|
|
216
|
+
children: /* @__PURE__ */ r(me, { className: "h-3 w-3" })
|
|
211
217
|
}
|
|
212
218
|
)
|
|
213
219
|
]
|
|
@@ -215,27 +221,27 @@ function ct({
|
|
|
215
221
|
String(e.id)
|
|
216
222
|
);
|
|
217
223
|
}),
|
|
218
|
-
|
|
224
|
+
re.map((e) => /* @__PURE__ */ c(
|
|
219
225
|
"span",
|
|
220
226
|
{
|
|
221
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",
|
|
222
228
|
children: [
|
|
223
|
-
s ? /* @__PURE__ */
|
|
224
|
-
|
|
229
|
+
s ? /* @__PURE__ */ r(
|
|
230
|
+
de,
|
|
225
231
|
{
|
|
226
232
|
collection: s,
|
|
227
233
|
id: e,
|
|
228
234
|
displayTemplate: o == null ? void 0 : o.display_template
|
|
229
235
|
}
|
|
230
236
|
) : String(e),
|
|
231
|
-
/* @__PURE__ */
|
|
237
|
+
/* @__PURE__ */ r(
|
|
232
238
|
"button",
|
|
233
239
|
{
|
|
234
240
|
type: "button",
|
|
235
241
|
"aria-label": "Remove",
|
|
236
|
-
onClick: () => t == null ? void 0 : t.unstageLink(
|
|
242
|
+
onClick: () => t == null ? void 0 : t.unstageLink(h, e),
|
|
237
243
|
className: "rounded-full p-0.5 text-slate-400 hover:text-red-500",
|
|
238
|
-
children: /* @__PURE__ */
|
|
244
|
+
children: /* @__PURE__ */ r(me, { className: "h-3 w-3" })
|
|
239
245
|
}
|
|
240
246
|
)
|
|
241
247
|
]
|
|
@@ -244,196 +250,223 @@ function ct({
|
|
|
244
250
|
))
|
|
245
251
|
]
|
|
246
252
|
}
|
|
247
|
-
) : /* @__PURE__ */
|
|
248
|
-
/* @__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" })
|
|
249
255
|
]
|
|
250
256
|
}
|
|
251
257
|
) }),
|
|
252
|
-
/* @__PURE__ */
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
}
|
|
261
|
-
),
|
|
262
|
-
/* @__PURE__ */ c(we, { children: [
|
|
263
|
-
M ? /* @__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" }),
|
|
264
|
-
/* @__PURE__ */ l(_e, { children: !M && (z ? [...ie(Z, y, B, k)] : [...ie(Z, y, B, k)].sort(
|
|
265
|
-
(e, a) => ye(k(e), k(a), y, h === "-label")
|
|
266
|
-
)).map((e) => {
|
|
267
|
-
const a = String(e.id), f = J.has(Q(a));
|
|
268
|
-
return /* @__PURE__ */ c(
|
|
269
|
-
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,
|
|
270
266
|
{
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
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
|
+
}
|
|
281
307
|
),
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
"
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
] }) })
|
|
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
|
+
) })
|
|
308
333
|
]
|
|
309
334
|
}
|
|
310
335
|
) });
|
|
311
336
|
}
|
|
312
|
-
function
|
|
313
|
-
const { client: i, relatedCollection:
|
|
314
|
-
U(`/items/${
|
|
315
|
-
limit:
|
|
316
|
-
search:
|
|
317
|
-
|
|
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,
|
|
318
345
|
picker: "1",
|
|
319
346
|
// A dotted display template ({{core_category.name}}) needs the
|
|
320
347
|
// nested expansion — a bare row only carries the FK id.
|
|
321
|
-
...
|
|
322
|
-
...
|
|
348
|
+
...x ? { fields: x } : {},
|
|
349
|
+
...w ? { sort: w } : {}
|
|
323
350
|
})
|
|
324
|
-
).then((s) => s.data ?? []),
|
|
351
|
+
).then((s) => s.data ?? []), v = (j) => [
|
|
325
352
|
"m2m-options",
|
|
353
|
+
f,
|
|
354
|
+
j,
|
|
326
355
|
p,
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
queryKey: x(""),
|
|
333
|
-
queryFn: () => C(""),
|
|
356
|
+
w ?? "",
|
|
357
|
+
x ?? ""
|
|
358
|
+
], A = p ? 0 : 3e4, { data: t, isFetching: N } = q({
|
|
359
|
+
queryKey: v(""),
|
|
360
|
+
queryFn: () => b(""),
|
|
334
361
|
enabled: n.enabled,
|
|
335
|
-
staleTime:
|
|
336
|
-
}),
|
|
337
|
-
queryKey:
|
|
338
|
-
queryFn: () =>
|
|
339
|
-
enabled: n.enabled &&
|
|
340
|
-
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
|
|
341
368
|
});
|
|
342
|
-
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 };
|
|
343
375
|
}
|
|
344
|
-
const
|
|
345
|
-
function
|
|
346
|
-
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;
|
|
347
379
|
}
|
|
348
|
-
function
|
|
349
|
-
return !
|
|
380
|
+
function oe(n, i, f, d) {
|
|
381
|
+
return !f || !i.trim() ? n : n.filter((p) => Ge(d(p), i));
|
|
350
382
|
}
|
|
351
|
-
function
|
|
383
|
+
function ht({
|
|
352
384
|
relation: n,
|
|
353
385
|
parentId: i,
|
|
354
|
-
allRelations:
|
|
386
|
+
allRelations: f,
|
|
355
387
|
extraFilter: d,
|
|
356
|
-
optionSort:
|
|
357
|
-
requiredParent:
|
|
358
|
-
onCountChange:
|
|
359
|
-
readOnly:
|
|
388
|
+
optionSort: p,
|
|
389
|
+
requiredParent: w,
|
|
390
|
+
onCountChange: x,
|
|
391
|
+
readOnly: b
|
|
360
392
|
}) {
|
|
361
|
-
const
|
|
362
|
-
(
|
|
363
|
-
), 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({
|
|
364
396
|
queryKey: ["col-meta", s],
|
|
365
|
-
queryFn: () =>
|
|
397
|
+
queryFn: () => v.request(U(`/collections/${s}`)).then((l) => l.data),
|
|
366
398
|
enabled: !!s,
|
|
367
399
|
staleTime: 3e5,
|
|
368
400
|
retry: !1
|
|
369
|
-
}), { data:
|
|
370
|
-
queryKey: ["m2m-items", n.many_collection,
|
|
371
|
-
queryFn: () =>
|
|
401
|
+
}), { data: H = [], isFetching: ce } = q({
|
|
402
|
+
queryKey: ["m2m-items", n.many_collection, R, i],
|
|
403
|
+
queryFn: () => v.request(
|
|
372
404
|
U(`/items/${n.many_collection}`, {
|
|
373
|
-
filter: JSON.stringify({ [
|
|
405
|
+
filter: JSON.stringify({ [R]: { _eq: i } }),
|
|
374
406
|
limit: 1,
|
|
375
|
-
fields: `id,${
|
|
407
|
+
fields: `id,${O}`
|
|
376
408
|
})
|
|
377
|
-
).then((
|
|
409
|
+
).then((l) => l.data ?? []),
|
|
378
410
|
staleTime: 3e4,
|
|
379
411
|
enabled: !!i && i !== "new"
|
|
380
|
-
}),
|
|
381
|
-
const
|
|
382
|
-
if (!
|
|
383
|
-
const
|
|
384
|
-
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(",");
|
|
385
417
|
})(), {
|
|
386
|
-
options:
|
|
387
|
-
isLoading:
|
|
388
|
-
localSearch:
|
|
389
|
-
|
|
390
|
-
|
|
418
|
+
options: K,
|
|
419
|
+
isLoading: $,
|
|
420
|
+
localSearch: te,
|
|
421
|
+
closeMatches: ne
|
|
422
|
+
} = $e({
|
|
423
|
+
client: v,
|
|
391
424
|
relatedCollection: s,
|
|
392
|
-
search:
|
|
393
|
-
filterParam:
|
|
394
|
-
serverSort:
|
|
395
|
-
templateNestedFields:
|
|
396
|
-
enabled:
|
|
425
|
+
search: m,
|
|
426
|
+
filterParam: B,
|
|
427
|
+
serverSort: Z,
|
|
428
|
+
templateNestedFields: ee,
|
|
429
|
+
enabled: N && !!s,
|
|
397
430
|
labelOf: e
|
|
398
|
-
}),
|
|
399
|
-
|
|
400
|
-
var
|
|
401
|
-
(
|
|
402
|
-
}, [
|
|
403
|
-
const { data:
|
|
404
|
-
queryKey: ["relation-single", s, String(
|
|
405
|
-
queryFn: () =>
|
|
406
|
-
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,
|
|
407
440
|
staleTime: 6e4
|
|
408
|
-
}),
|
|
409
|
-
queryKey: ["relation-avail", s, String(
|
|
410
|
-
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(
|
|
411
444
|
U(`/items/${s}`, {
|
|
412
|
-
filter:
|
|
445
|
+
filter: M,
|
|
413
446
|
picker: "1",
|
|
414
447
|
limit: 1,
|
|
415
448
|
fields: "id"
|
|
416
449
|
})
|
|
417
|
-
).then((
|
|
418
|
-
enabled: !!s &&
|
|
450
|
+
).then((l) => l.data ?? []),
|
|
451
|
+
enabled: !!s && y != null && !!J,
|
|
419
452
|
staleTime: 3e4
|
|
420
|
-
}),
|
|
421
|
-
function e(
|
|
422
|
-
const
|
|
423
|
-
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 ?? "");
|
|
424
457
|
}
|
|
425
|
-
const a =
|
|
426
|
-
if (
|
|
427
|
-
return /* @__PURE__ */
|
|
428
|
-
function
|
|
429
|
-
for (const
|
|
430
|
-
|
|
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("");
|
|
431
464
|
}
|
|
432
|
-
function
|
|
433
|
-
for (const
|
|
434
|
-
|
|
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);
|
|
435
468
|
}
|
|
436
|
-
return
|
|
469
|
+
return w ? /* @__PURE__ */ c(
|
|
437
470
|
"button",
|
|
438
471
|
{
|
|
439
472
|
type: "button",
|
|
@@ -442,129 +475,165 @@ function dt({
|
|
|
442
475
|
children: [
|
|
443
476
|
/* @__PURE__ */ c("span", { className: "truncate text-muted-foreground", children: [
|
|
444
477
|
"Select ",
|
|
445
|
-
|
|
478
|
+
w,
|
|
446
479
|
" first"
|
|
447
480
|
] }),
|
|
448
|
-
/* @__PURE__ */
|
|
481
|
+
/* @__PURE__ */ r(ae, { className: "h-4 w-4 shrink-0 opacity-50" })
|
|
449
482
|
]
|
|
450
483
|
}
|
|
451
|
-
) : /* @__PURE__ */ c("div", { ...
|
|
484
|
+
) : /* @__PURE__ */ c("div", { ..._.bind, children: [
|
|
452
485
|
/* @__PURE__ */ c(
|
|
453
|
-
|
|
486
|
+
Fe,
|
|
454
487
|
{
|
|
455
|
-
open:
|
|
456
|
-
onOpenChange: (
|
|
457
|
-
|
|
488
|
+
open: N,
|
|
489
|
+
onOpenChange: (l) => {
|
|
490
|
+
S(l), l || L("");
|
|
458
491
|
},
|
|
459
492
|
children: [
|
|
460
|
-
/* @__PURE__ */
|
|
493
|
+
/* @__PURE__ */ r(qe, { asChild: !0, children: /* @__PURE__ */ c(
|
|
461
494
|
"button",
|
|
462
495
|
{
|
|
463
496
|
type: "button",
|
|
464
|
-
className:
|
|
497
|
+
className: X(
|
|
465
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",
|
|
466
|
-
|
|
499
|
+
W ? "border-amber-300 dark:border-amber-600" : se ? "border-nvr-cyan/50" : "border-input"
|
|
467
500
|
),
|
|
468
501
|
children: [
|
|
469
|
-
|
|
502
|
+
u || ce && le == null && i !== "new" ? /* @__PURE__ */ r(ue, { className: "h-3.5 w-3.5 animate-spin text-muted-foreground" }) : /* @__PURE__ */ c(
|
|
470
503
|
"span",
|
|
471
504
|
{
|
|
472
|
-
className:
|
|
505
|
+
className: X(
|
|
473
506
|
"flex items-center gap-1.5 truncate min-w-0",
|
|
474
|
-
|
|
507
|
+
C ? se ? "text-nvr-cyan" : "text-slate-800 dark:text-slate-100" : "text-muted-foreground"
|
|
475
508
|
),
|
|
476
509
|
children: [
|
|
477
|
-
|
|
478
|
-
/* @__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…" })
|
|
479
512
|
]
|
|
480
513
|
}
|
|
481
514
|
),
|
|
482
|
-
/* @__PURE__ */
|
|
515
|
+
/* @__PURE__ */ r(ae, { className: "h-4 w-4 shrink-0 opacity-50" })
|
|
483
516
|
]
|
|
484
517
|
}
|
|
485
518
|
) }),
|
|
486
|
-
/* @__PURE__ */
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
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",
|
|
504
|
-
children: [
|
|
505
|
-
/* @__PURE__ */ l(de, { className: "h-3.5 w-3.5 text-slate-400" }),
|
|
506
|
-
"Clear selection"
|
|
507
|
-
]
|
|
508
|
-
}
|
|
509
|
-
),
|
|
510
|
-
/* @__PURE__ */ c(we, { children: [
|
|
511
|
-
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" }),
|
|
512
|
-
!B && /* @__PURE__ */ l(_e, { children: [...ie(M, y, ee, e)].sort(
|
|
513
|
-
(r, b) => Y ? 0 : ye(e(r), e(b), y, h === "-label")
|
|
514
|
-
).map((r) => {
|
|
515
|
-
const b = String(r.id), le = String(m) === b;
|
|
516
|
-
return /* @__PURE__ */ c(
|
|
517
|
-
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",
|
|
518
536
|
{
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
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",
|
|
522
542
|
children: [
|
|
523
|
-
/* @__PURE__ */
|
|
524
|
-
|
|
525
|
-
{
|
|
526
|
-
className: W(
|
|
527
|
-
"flex h-4 w-4 shrink-0 items-center justify-center rounded-full border transition-colors",
|
|
528
|
-
le ? "border-nvr-cyan bg-nvr-cyan" : "border-slate-300 dark:border-slate-500"
|
|
529
|
-
),
|
|
530
|
-
children: le && /* @__PURE__ */ l(me, { className: "h-2.5 w-2.5 text-white" })
|
|
531
|
-
}
|
|
532
|
-
),
|
|
533
|
-
s === "nivaro_users" && /* @__PURE__ */ l(
|
|
534
|
-
ve,
|
|
535
|
-
{
|
|
536
|
-
userId: b,
|
|
537
|
-
className: "h-4 w-4",
|
|
538
|
-
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)) })
|
|
539
|
-
}
|
|
540
|
-
),
|
|
541
|
-
s === "nivaro_users" && H.has(b.toUpperCase()) && /* @__PURE__ */ l(
|
|
542
|
-
"span",
|
|
543
|
-
{
|
|
544
|
-
className: "h-1.5 w-1.5 shrink-0 rounded-full bg-emerald-500",
|
|
545
|
-
"data-tip": "Online now"
|
|
546
|
-
}
|
|
547
|
-
),
|
|
548
|
-
/* @__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"
|
|
549
545
|
]
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
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
|
+
) })
|
|
556
608
|
]
|
|
557
609
|
}
|
|
558
610
|
),
|
|
559
|
-
|
|
611
|
+
_.tip
|
|
560
612
|
] });
|
|
561
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
|
+
}
|
|
562
631
|
export {
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
632
|
+
pt as M2MCombobox,
|
|
633
|
+
ht as M2MSingleSelectCombobox,
|
|
634
|
+
ft as m2aWriteMeta,
|
|
635
|
+
We as m2mAsksServer,
|
|
567
636
|
Q as m2mIdKey,
|
|
568
|
-
|
|
569
|
-
|
|
637
|
+
oe as narrowM2MOptions,
|
|
638
|
+
Ke as resolveM2MRelatedCollection
|
|
570
639
|
};
|