@nivaro/react 0.3.111 → 0.3.112
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 +170 -2
- package/dist/index.js +745 -728
- package/dist/shared/components/CollectionBrowserView.js +3097 -2972
- package/dist/shared/components/CollectionImportBanner.js +135 -0
- package/dist/shared/components/ItemEditForm.js +2235 -2218
- package/dist/shared/components/JobsTray.js +54 -47
- package/dist/shared/components/ViewAsPersonButton.js +109 -0
- package/dist/shared/components/bulk/BulkFieldUpdate.js +228 -150
- package/dist/shared/components/bulk/BulkFieldUpdateButton.js +35 -41
- package/dist/shared/components/bulk/BulkLinksValue.js +91 -0
- package/dist/shared/components/bulk/bulk-field-options.js +20 -19
- package/dist/shared/components/bulk/bulk-update-preview.js +39 -0
- package/dist/shared/components/cbv/ColumnHeaderMenu.js +113 -0
- package/dist/shared/components/cbv/column-totals.js +66 -0
- package/dist/shared/components/collections-directory/CollectionHoverCard.js +108 -81
- package/dist/shared/components/collections-directory/CollectionRow.js +164 -148
- package/dist/shared/components/collections-directory/CollectionsDirectory.js +167 -166
- package/dist/shared/components/collections-directory/directory-data.js +70 -58
- package/dist/shared/components/imports/CollectionImportPanel.js +120 -118
- package/dist/shared/components/imports/DefinitionsPanel.js +24 -24
- package/dist/shared/components/imports/ImportDuplicatesNotice.js +65 -0
- package/dist/shared/components/item-edit/CatalogPickerField.js +631 -639
- package/dist/shared/components/item-edit/DuplicateNotice.js +168 -0
- package/dist/shared/components/item-edit/FieldRow.js +248 -246
- package/dist/shared/components/item-edit/InlineGridField.js +34 -33
- package/dist/shared/components/item-edit/InlineTableField.js +3064 -2882
- package/dist/shared/components/item-edit/MembershipSetField.js +165 -169
- package/dist/shared/components/item-edit/NestedRelationEditor.js +184 -189
- package/dist/shared/components/item-edit/PlanGrid.js +2 -1
- package/dist/shared/components/item-edit/QuickPickerDialog.js +35 -34
- package/dist/shared/components/item-edit/RecordLiveSync.js +32 -30
- package/dist/shared/components/item-edit/RelationCombobox.js +101 -100
- package/dist/shared/components/item-edit/RowHistorySheet.js +28 -27
- package/dist/shared/components/item-edit/SummaryPanel.js +133 -135
- package/dist/shared/components/item-edit/ViewAsRole.js +129 -52
- package/dist/shared/components/item-edit/grid-search.js +345 -0
- package/dist/shared/components/item-edit/render-stability.js +61 -54
- package/dist/shared/components/notifications/NotificationRulesEditor.js +25 -20
- package/dist/shared/components/ops-report/DigestSections.js +163 -144
- package/dist/shared/components/ops-report/drill.js +97 -97
- package/dist/shared/components/panels/AddendumLinesDiff.js +52 -51
- package/dist/shared/components/panels/AddendumPanel.js +92 -91
- package/dist/shared/components/panels/AsyncUserPicker.js +108 -0
- package/dist/shared/components/panels/CommentPanel.js +265 -252
- package/dist/shared/components/panels/OwnersSlot.js +47 -35
- package/dist/shared/components/panels/PipelineInsight.js +186 -0
- package/dist/shared/components/panels/PipelinePanel.js +1529 -1492
- package/dist/shared/components/panels/RecordIntegrityBanner.js +39 -38
- package/dist/shared/components/panels/RevisionsPanel.js +261 -260
- package/dist/shared/components/pipeline/FieldPicker.js +41 -40
- package/dist/shared/components/pipeline/OwnerMatrix.js +829 -700
- package/dist/shared/components/pipeline/OwnerRecordTrial.js +362 -0
- package/dist/shared/components/pipeline/PipelineEditorView.js +483 -467
- package/dist/shared/components/pipeline/PipelineStateOwners.js +65 -64
- package/dist/shared/components/pipeline/owner-matrix-draft.js +178 -0
- package/dist/shared/components/profile/MyDefaultsCard.js +36 -35
- package/dist/shared/components/profile/PersonHeader.js +29 -29
- package/dist/shared/components/profile/PersonProfile.js +30 -28
- package/dist/shared/components/profile/SlowScreensCard.js +286 -0
- package/dist/shared/components/queue/QueueWorklist.js +1090 -1071
- package/dist/shared/components/quick-filters/useQuickFilterEditing.js +45 -44
- package/dist/shared/components/support/TicketDetailSheet.js +25 -16
- package/dist/shared/components/support/TicketSlowScreens.js +32 -0
- package/dist/shared/lib/activity-sentence.js +224 -178
- package/dist/shared/lib/collection-import-banner.js +27 -0
- package/dist/shared/lib/crash-report.js +112 -0
- package/dist/shared/lib/export-runs.js +99 -0
- package/dist/shared/lib/jobs-tray.js +89 -67
- package/dist/shared/lib/list-link.js +76 -69
- package/dist/shared/lib/nav-trail.js +180 -76
- package/dist/shared/lib/query-keys.js +26 -0
- package/dist/shared/lib/view-as.js +16 -11
- package/package.json +1 -1
|
@@ -1,200 +1,196 @@
|
|
|
1
|
-
import { jsxs as b, jsx as
|
|
2
|
-
import { useQueryClient as ye, useQuery as
|
|
3
|
-
import { Search as ge, X as ve, Check as
|
|
4
|
-
import { useState as
|
|
5
|
-
import { useNivaroClient as
|
|
6
|
-
import { get as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
import { jsxs as b, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { useQueryClient as ye, useQuery as T } from "@tanstack/react-query";
|
|
3
|
+
import { Search as ge, X as ve, Check as R, ChevronsUpDown as we } from "lucide-react";
|
|
4
|
+
import { useState as q, useMemo as S } from "react";
|
|
5
|
+
import { useNivaroClient as ie } from "../../context.js";
|
|
6
|
+
import { get as ke, patch as Ne, post as le, del as se } from "../../lib/commands.js";
|
|
7
|
+
import { fetchCollectionRelations as Ce, queryKeys as ce, fetchCollectionMeta as Se } from "../../lib/query-keys.js";
|
|
8
|
+
import { userErrorMessage as _e } from "../../lib/safe-error.js";
|
|
9
|
+
import { matchesAllTokens as de, titleCase as O, cn as C } from "../../lib/utils.js";
|
|
10
|
+
import { Popover as $e, PopoverTrigger as qe, PopoverContent as Le } from "../ui/popover.js";
|
|
11
|
+
import { applyDisplayTemplate as Ke } from "./helpers.js";
|
|
12
|
+
import { RelationCombobox as Te } from "./RelationCombobox.js";
|
|
13
|
+
const ne = (r, l) => `${r ?? ""}\0${l ?? ""}`;
|
|
14
|
+
function Me(r, l) {
|
|
15
|
+
const u = new Map(l.map((y) => [ne(y[0], y[1]), y])), c = /* @__PURE__ */ new Set(), o = [];
|
|
16
|
+
for (const y of r) {
|
|
17
|
+
const h = ne(y.value, y.value2);
|
|
18
|
+
u.has(h) && !c.has(h) ? c.add(h) : o.push(y.id);
|
|
18
19
|
}
|
|
19
20
|
const m = [], g = [];
|
|
20
21
|
for (const [y, h] of u) {
|
|
21
|
-
if (
|
|
22
|
-
const
|
|
23
|
-
|
|
22
|
+
if (c.has(y)) continue;
|
|
23
|
+
const i = o.shift();
|
|
24
|
+
i !== void 0 ? m.push({ id: i, pair: h }) : g.push(h);
|
|
24
25
|
}
|
|
25
26
|
return { repoint: m, create: g, remove: o };
|
|
26
27
|
}
|
|
27
|
-
const
|
|
28
|
-
const u =
|
|
29
|
-
return u.flatMap((o) =>
|
|
30
|
-
},
|
|
31
|
-
async function
|
|
32
|
-
const
|
|
28
|
+
const je = (r, l) => {
|
|
29
|
+
const u = r.size ? [...r] : [null], c = l.size ? [...l] : [null];
|
|
30
|
+
return u.flatMap((o) => c.map((m) => [o, m]));
|
|
31
|
+
}, Fe = 10;
|
|
32
|
+
async function A(r, l, u) {
|
|
33
|
+
const c = [];
|
|
33
34
|
for (let o = 1; o <= 50; o++) {
|
|
34
|
-
const m = await
|
|
35
|
-
if (
|
|
35
|
+
const m = await r.request(ke(l, { ...u, limit: 1e3, page: o })).then((g) => g.data ?? []);
|
|
36
|
+
if (c.push(...m), m.length < 1e3) break;
|
|
36
37
|
}
|
|
37
|
-
return
|
|
38
|
+
return c;
|
|
38
39
|
}
|
|
39
|
-
const
|
|
40
|
-
function
|
|
41
|
-
const u =
|
|
42
|
-
queryKey:
|
|
43
|
-
queryFn: () => u
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}),
|
|
47
|
-
enabled: !!a,
|
|
40
|
+
const Re = (r) => [...(r ?? "").matchAll(/\{\{([\w.]+)\}\}/g)].map((l) => l[1]);
|
|
41
|
+
function P(r, l) {
|
|
42
|
+
const u = ie(), { data: c } = T({
|
|
43
|
+
queryKey: ce.collectionDisplayMeta(r),
|
|
44
|
+
queryFn: () => Se(u, r),
|
|
45
|
+
select: (i) => (i == null ? void 0 : i.display_template) ?? null,
|
|
46
|
+
enabled: !!r,
|
|
48
47
|
staleTime: 10 * 6e4
|
|
49
|
-
}), o =
|
|
50
|
-
queryKey: ["membership-set-labels",
|
|
48
|
+
}), o = c ?? null, m = l === "all" ? "all" : [...l].sort().join(","), { data: g = [], isLoading: y } = T({
|
|
49
|
+
queryKey: ["membership-set-labels", r, o, m],
|
|
51
50
|
queryFn: async () => {
|
|
52
|
-
const
|
|
53
|
-
if (l === "all") return
|
|
51
|
+
const i = Re(o), n = i.length ? { fields: ["id", ...i].join(",") } : {};
|
|
52
|
+
if (l === "all") return A(u, `/items/${r}`, n);
|
|
54
53
|
const f = [];
|
|
55
54
|
for (let w = 0; w < l.length; w += 150)
|
|
56
55
|
f.push(
|
|
57
|
-
...await
|
|
58
|
-
...
|
|
56
|
+
...await A(u, `/items/${r}`, {
|
|
57
|
+
...n,
|
|
59
58
|
filter: JSON.stringify({ id: { _in: l.slice(w, w + 150) } })
|
|
60
59
|
})
|
|
61
60
|
);
|
|
62
61
|
return f;
|
|
63
62
|
},
|
|
64
|
-
enabled: !!
|
|
63
|
+
enabled: !!r && c !== void 0 && (l === "all" || l.length > 0),
|
|
65
64
|
staleTime: 6e4
|
|
66
65
|
});
|
|
67
|
-
return { labels:
|
|
68
|
-
const
|
|
69
|
-
for (const
|
|
70
|
-
const f = String(
|
|
71
|
-
|
|
66
|
+
return { labels: S(() => {
|
|
67
|
+
const i = /* @__PURE__ */ new Map();
|
|
68
|
+
for (const n of g) {
|
|
69
|
+
const f = String(n.name ?? n.title ?? n.label ?? `#${n.id}`);
|
|
70
|
+
i.set(String(n.id), (o ? Ke(o, n) : "").trim() || f);
|
|
72
71
|
}
|
|
73
|
-
return
|
|
72
|
+
return i;
|
|
74
73
|
}, [g, o]), isLoading: y };
|
|
75
74
|
}
|
|
76
|
-
function
|
|
77
|
-
relatedCollection:
|
|
75
|
+
function Xe({
|
|
76
|
+
relatedCollection: r,
|
|
78
77
|
manyField: l,
|
|
79
78
|
parentId: u,
|
|
80
|
-
config:
|
|
79
|
+
config: c,
|
|
81
80
|
readOnly: o
|
|
82
81
|
}) {
|
|
83
|
-
const m =
|
|
84
|
-
queryKey:
|
|
85
|
-
queryFn: () => m
|
|
86
|
-
var r;
|
|
87
|
-
return ((r = e.data) == null ? void 0 : r.relations) ?? [];
|
|
88
|
-
}),
|
|
82
|
+
const m = ie(), g = ye(), y = u === "new", { key_field: h, value_field: i } = c, n = c.value_field_2 || null, f = c.empty_label ?? "All", w = c.empty_label_2 ?? f, [_, p] = q(""), [k, Q] = q(null), [z, D] = q(null), { data: ue = [] } = T({
|
|
83
|
+
queryKey: ce.collectionRelations(r),
|
|
84
|
+
queryFn: () => Ce(m, r),
|
|
89
85
|
staleTime: 10 * 6e4
|
|
90
86
|
}), M = (e) => {
|
|
91
|
-
var
|
|
92
|
-
return ((
|
|
93
|
-
}, L = M(h),
|
|
94
|
-
queryKey:
|
|
95
|
-
queryFn: async () => (await
|
|
96
|
-
fields: ["id", h,
|
|
87
|
+
var a;
|
|
88
|
+
return ((a = ue.find((t) => t.many_collection === r && t.many_field === e)) == null ? void 0 : a.one_collection) ?? null;
|
|
89
|
+
}, L = M(h), B = M(i), E = n ? M(n) : null, J = ["membership-set-rows", r, l, String(u)], { data: V = [], isLoading: me } = T({
|
|
90
|
+
queryKey: J,
|
|
91
|
+
queryFn: async () => (await A(m, `/items/${r}`, {
|
|
92
|
+
fields: ["id", h, i, ...n ? [n] : []].join(","),
|
|
97
93
|
filter: JSON.stringify({ [l]: { _eq: u } })
|
|
98
94
|
})).filter((e) => e[h] != null).map((e) => ({
|
|
99
95
|
id: e.id,
|
|
100
96
|
key: String(e[h]),
|
|
101
|
-
value: e[
|
|
102
|
-
value2: !
|
|
97
|
+
value: e[i] == null ? null : String(e[i]),
|
|
98
|
+
value2: !n || e[n] == null ? null : String(e[n])
|
|
103
99
|
})),
|
|
104
100
|
enabled: !y,
|
|
105
101
|
staleTime: 15e3
|
|
106
|
-
}), N =
|
|
102
|
+
}), N = S(() => {
|
|
107
103
|
const e = /* @__PURE__ */ new Map();
|
|
108
|
-
for (const
|
|
104
|
+
for (const a of V) e.set(a.key, [...e.get(a.key) ?? [], a]);
|
|
109
105
|
return e;
|
|
110
|
-
}, [
|
|
111
|
-
g.invalidateQueries({ queryKey:
|
|
112
|
-
}, j = async (e,
|
|
113
|
-
|
|
106
|
+
}, [V]), v = S(() => [...N.keys()], [N]), { labels: H } = P(L, v), { labels: U } = P(B, "all"), { labels: X } = P(E, "all"), G = (e) => [...e.entries()].map(([a, t]) => ({ id: a, label: t })).sort((a, t) => a.label.localeCompare(t.label, void 0, { numeric: !0 })), pe = S(() => G(U), [U]), be = S(() => G(X), [X]), he = () => {
|
|
107
|
+
g.invalidateQueries({ queryKey: J }), g.invalidateQueries({ queryKey: ["o2m-rows", r] });
|
|
108
|
+
}, j = async (e, a) => {
|
|
109
|
+
Q(e), D(null);
|
|
114
110
|
try {
|
|
115
|
-
await
|
|
111
|
+
await a();
|
|
116
112
|
} catch (t) {
|
|
117
113
|
const x = t == null ? void 0 : t.response;
|
|
118
|
-
D((x == null ? void 0 : x.error) ??
|
|
114
|
+
D((x == null ? void 0 : x.error) ?? _e(t, "Could not save"));
|
|
119
115
|
} finally {
|
|
120
|
-
|
|
116
|
+
Q(null), he();
|
|
121
117
|
}
|
|
122
|
-
},
|
|
123
|
-
const
|
|
118
|
+
}, W = (e) => {
|
|
119
|
+
const a = N.get(e) ?? [];
|
|
124
120
|
return {
|
|
125
|
-
a: new Set(
|
|
126
|
-
b: new Set(
|
|
121
|
+
a: new Set(a.filter((t) => t.value !== null).map((t) => t.value)),
|
|
122
|
+
b: new Set(a.filter((t) => t.value2 !== null).map((t) => t.value2))
|
|
127
123
|
};
|
|
128
|
-
}, F = ([e,
|
|
129
|
-
[
|
|
130
|
-
...
|
|
131
|
-
}),
|
|
132
|
-
const x =
|
|
124
|
+
}, F = ([e, a]) => ({
|
|
125
|
+
[i]: e,
|
|
126
|
+
...n ? { [n]: a } : {}
|
|
127
|
+
}), K = (e, a, t) => j(e, async () => {
|
|
128
|
+
const x = Me(N.get(e) ?? [], je(a, t));
|
|
133
129
|
for (const d of x.repoint)
|
|
134
|
-
await m.request(
|
|
130
|
+
await m.request(Ne(`/items/${r}/${d.id}`, F(d.pair)));
|
|
135
131
|
for (const d of x.create)
|
|
136
132
|
await m.request(
|
|
137
|
-
|
|
133
|
+
le(`/items/${r}`, {
|
|
138
134
|
[l]: u,
|
|
139
135
|
[h]: e,
|
|
140
136
|
...F(d)
|
|
141
137
|
})
|
|
142
138
|
);
|
|
143
|
-
for (const d of x.remove) await m.request(
|
|
144
|
-
}),
|
|
139
|
+
for (const d of x.remove) await m.request(se(`/items/${r}/${d}`));
|
|
140
|
+
}), Y = (e, a) => {
|
|
145
141
|
const t = new Set(e);
|
|
146
|
-
return t.has(
|
|
147
|
-
},
|
|
148
|
-
const { a: x, b: d } =
|
|
149
|
-
return t === 1 ?
|
|
150
|
-
},
|
|
151
|
-
const { a: t, b: x } =
|
|
152
|
-
if ((
|
|
153
|
-
return
|
|
142
|
+
return t.has(a) ? t.delete(a) : t.add(a), t;
|
|
143
|
+
}, Z = (e, a, t = 1) => {
|
|
144
|
+
const { a: x, b: d } = W(e);
|
|
145
|
+
return t === 1 ? K(e, Y(x, a), d) : K(e, x, Y(d, a));
|
|
146
|
+
}, I = (e, a = 1) => {
|
|
147
|
+
const { a: t, b: x } = W(e);
|
|
148
|
+
if ((a === 1 ? t : x).size !== 0)
|
|
149
|
+
return a === 1 ? K(e, /* @__PURE__ */ new Set(), x) : K(e, t, /* @__PURE__ */ new Set());
|
|
154
150
|
}, fe = (e) => j(e, async () => {
|
|
155
|
-
for (const
|
|
156
|
-
await m.request(
|
|
151
|
+
for (const a of N.get(e) ?? [])
|
|
152
|
+
await m.request(se(`/items/${r}/${a.id}`));
|
|
157
153
|
}), xe = (e) => {
|
|
158
154
|
e == null || e === "" || N.has(String(e)) || j(
|
|
159
155
|
String(e),
|
|
160
156
|
() => m.request(
|
|
161
|
-
|
|
157
|
+
le(`/items/${r}`, {
|
|
162
158
|
[l]: u,
|
|
163
159
|
[h]: e,
|
|
164
160
|
...F([null, null])
|
|
165
161
|
})
|
|
166
162
|
)
|
|
167
163
|
);
|
|
168
|
-
},
|
|
169
|
-
const e = v.map((t) => ({ key: t, label:
|
|
170
|
-
return
|
|
171
|
-
}, [v,
|
|
164
|
+
}, ee = S(() => {
|
|
165
|
+
const e = v.map((t) => ({ key: t, label: H.get(t) ?? `#${t}` })).sort((t, x) => t.label.localeCompare(x.label, void 0, { numeric: !0 })), a = _.trim();
|
|
166
|
+
return a ? e.filter((t) => de(t.label, a)) : e;
|
|
167
|
+
}, [v, H, _]), $ = c.key_label ?? O(L ?? h), te = c.value_label ?? O(B ?? i), re = n ? c.value_label_2 ?? O(E ?? n) : "", ae = n ? "grid-cols-[minmax(140px,1fr)_minmax(0,1.5fr)_minmax(0,1.5fr)_28px]" : "grid-cols-[minmax(140px,1fr)_minmax(0,2fr)_28px]";
|
|
172
168
|
return y ? /* @__PURE__ */ b("p", { className: "rounded-lg border border-dashed border-slate-200 px-3 py-4 text-[12px] text-slate-500 dark:border-border dark:text-muted-foreground", children: [
|
|
173
169
|
"Save this record first, then add ",
|
|
174
|
-
|
|
170
|
+
$.toLowerCase(),
|
|
175
171
|
" here."
|
|
176
|
-
] }) : /* @__PURE__ */ b("div", { "data-membership-set": `${
|
|
172
|
+
] }) : /* @__PURE__ */ b("div", { "data-membership-set": `${r}:${l}`, className: "space-y-2", children: [
|
|
177
173
|
!o && L && /* @__PURE__ */ b("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
178
|
-
/* @__PURE__ */
|
|
179
|
-
|
|
174
|
+
/* @__PURE__ */ s("div", { className: "w-[320px] max-w-full", children: /* @__PURE__ */ s(
|
|
175
|
+
Te,
|
|
180
176
|
{
|
|
181
177
|
collection: L,
|
|
182
178
|
value: null,
|
|
183
179
|
onChange: xe,
|
|
184
|
-
placeholder: `Add ${
|
|
180
|
+
placeholder: `Add ${$.toLowerCase()}…`,
|
|
185
181
|
extraFilter: v.length && v.length <= 400 ? { id: { _nin: v } } : void 0
|
|
186
182
|
},
|
|
187
183
|
v.length
|
|
188
184
|
) }),
|
|
189
185
|
v.length > 8 && /* @__PURE__ */ b("label", { className: "relative ml-auto block w-[220px] max-w-full", children: [
|
|
190
|
-
/* @__PURE__ */
|
|
191
|
-
/* @__PURE__ */
|
|
186
|
+
/* @__PURE__ */ s(ge, { className: "pointer-events-none absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-400" }),
|
|
187
|
+
/* @__PURE__ */ s(
|
|
192
188
|
"input",
|
|
193
189
|
{
|
|
194
|
-
value:
|
|
190
|
+
value: _,
|
|
195
191
|
onChange: (e) => p(e.target.value),
|
|
196
192
|
placeholder: `Filter ${v.length}…`,
|
|
197
|
-
"aria-label": `Filter ${
|
|
193
|
+
"aria-label": `Filter ${$}`,
|
|
198
194
|
className: "h-8 w-full rounded-md border border-slate-200 bg-background pl-7 pr-2 text-[12px] outline-none focus:border-nvr-cyan dark:border-border"
|
|
199
195
|
}
|
|
200
196
|
)
|
|
@@ -204,49 +200,49 @@ function Je({
|
|
|
204
200
|
/* @__PURE__ */ b(
|
|
205
201
|
"div",
|
|
206
202
|
{
|
|
207
|
-
className:
|
|
208
|
-
|
|
203
|
+
className: C(
|
|
204
|
+
ae,
|
|
209
205
|
"grid gap-3 border-b border-slate-200 bg-slate-50 px-3 py-1.5 text-[10.5px] font-medium uppercase tracking-wide text-slate-500 dark:border-border dark:bg-muted dark:text-muted-foreground"
|
|
210
206
|
),
|
|
211
207
|
children: [
|
|
212
|
-
/* @__PURE__ */
|
|
208
|
+
/* @__PURE__ */ s("span", { children: $ }),
|
|
213
209
|
/* @__PURE__ */ b("span", { children: [
|
|
214
|
-
|
|
210
|
+
te,
|
|
215
211
|
" ",
|
|
216
212
|
/* @__PURE__ */ b("span", { className: "normal-case tracking-normal text-slate-400", children: [
|
|
217
213
|
"· none picked = ",
|
|
218
214
|
f.toLowerCase()
|
|
219
215
|
] })
|
|
220
216
|
] }),
|
|
221
|
-
|
|
222
|
-
|
|
217
|
+
n && /* @__PURE__ */ b("span", { children: [
|
|
218
|
+
re,
|
|
223
219
|
" ",
|
|
224
220
|
/* @__PURE__ */ b("span", { className: "normal-case tracking-normal text-slate-400", children: [
|
|
225
221
|
"· none picked = ",
|
|
226
222
|
w.toLowerCase()
|
|
227
223
|
] })
|
|
228
224
|
] }),
|
|
229
|
-
/* @__PURE__ */
|
|
225
|
+
/* @__PURE__ */ s("span", {})
|
|
230
226
|
]
|
|
231
227
|
}
|
|
232
228
|
),
|
|
233
|
-
me ? /* @__PURE__ */
|
|
234
|
-
const
|
|
235
|
-
|
|
229
|
+
me ? /* @__PURE__ */ s("div", { className: "space-y-2 p-3", children: [0, 1, 2].map((e) => /* @__PURE__ */ s("div", { className: "h-6 animate-pulse rounded bg-[hsl(var(--nvr-skeleton))]" }, e)) }) : ee.length === 0 ? /* @__PURE__ */ s("p", { className: "px-3 py-5 text-center text-[12px] text-slate-500 dark:text-muted-foreground", children: v.length ? "Nothing matches that filter." : `No ${$.toLowerCase()} yet.` }) : /* @__PURE__ */ s("ul", { className: "max-h-[480px] divide-y divide-slate-100 overflow-y-auto dark:divide-border", children: ee.map((e) => {
|
|
230
|
+
const a = N.get(e.key) ?? [], t = new Set(
|
|
231
|
+
a.filter((d) => d.value !== null).map((d) => d.value)
|
|
236
232
|
), x = new Set(
|
|
237
|
-
|
|
233
|
+
a.filter((d) => d.value2 !== null).map((d) => d.value2)
|
|
238
234
|
);
|
|
239
235
|
return /* @__PURE__ */ b(
|
|
240
236
|
"li",
|
|
241
237
|
{
|
|
242
238
|
"data-membership-key": e.key,
|
|
243
|
-
className:
|
|
244
|
-
|
|
239
|
+
className: C(
|
|
240
|
+
ae,
|
|
245
241
|
"grid items-center gap-3 px-3 py-1.5 text-[12px]",
|
|
246
242
|
k === e.key && "opacity-60"
|
|
247
243
|
),
|
|
248
244
|
children: [
|
|
249
|
-
/* @__PURE__ */
|
|
245
|
+
/* @__PURE__ */ s(
|
|
250
246
|
"span",
|
|
251
247
|
{
|
|
252
248
|
className: "truncate font-medium text-slate-800 dark:text-foreground",
|
|
@@ -254,31 +250,31 @@ function Je({
|
|
|
254
250
|
children: e.label
|
|
255
251
|
}
|
|
256
252
|
),
|
|
257
|
-
/* @__PURE__ */
|
|
258
|
-
|
|
253
|
+
/* @__PURE__ */ s(
|
|
254
|
+
oe,
|
|
259
255
|
{
|
|
260
256
|
options: pe,
|
|
261
257
|
picked: t,
|
|
262
258
|
emptyLabel: f,
|
|
263
|
-
valueTitle:
|
|
259
|
+
valueTitle: te,
|
|
264
260
|
disabled: !!o || k === e.key,
|
|
265
|
-
onToggle: (d) =>
|
|
266
|
-
onClear: () =>
|
|
261
|
+
onToggle: (d) => Z(e.key, d),
|
|
262
|
+
onClear: () => I(e.key)
|
|
267
263
|
}
|
|
268
264
|
),
|
|
269
|
-
|
|
270
|
-
|
|
265
|
+
n && /* @__PURE__ */ s(
|
|
266
|
+
oe,
|
|
271
267
|
{
|
|
272
268
|
options: be,
|
|
273
269
|
picked: x,
|
|
274
270
|
emptyLabel: w,
|
|
275
|
-
valueTitle:
|
|
271
|
+
valueTitle: re,
|
|
276
272
|
disabled: !!o || k === e.key,
|
|
277
|
-
onToggle: (d) =>
|
|
278
|
-
onClear: () =>
|
|
273
|
+
onToggle: (d) => Z(e.key, d, 2),
|
|
274
|
+
onClear: () => I(e.key, 2)
|
|
279
275
|
}
|
|
280
276
|
),
|
|
281
|
-
o ? /* @__PURE__ */
|
|
277
|
+
o ? /* @__PURE__ */ s("span", {}) : /* @__PURE__ */ s(
|
|
282
278
|
"button",
|
|
283
279
|
{
|
|
284
280
|
type: "button",
|
|
@@ -287,7 +283,7 @@ function Je({
|
|
|
287
283
|
"aria-label": `Remove ${e.label}`,
|
|
288
284
|
"data-tip": "Remove",
|
|
289
285
|
className: "flex h-6 w-6 items-center justify-center rounded text-slate-400 hover:bg-red-50 hover:text-red-600 dark:hover:bg-red-500/10",
|
|
290
|
-
children: /* @__PURE__ */
|
|
286
|
+
children: /* @__PURE__ */ s(ve, { className: "h-3.5 w-3.5" })
|
|
291
287
|
}
|
|
292
288
|
)
|
|
293
289
|
]
|
|
@@ -296,36 +292,36 @@ function Je({
|
|
|
296
292
|
);
|
|
297
293
|
}) })
|
|
298
294
|
] }),
|
|
299
|
-
|
|
295
|
+
z && /* @__PURE__ */ s("p", { className: "text-[12px] text-red-600 dark:text-red-400", children: z })
|
|
300
296
|
] });
|
|
301
297
|
}
|
|
302
|
-
function
|
|
303
|
-
options:
|
|
298
|
+
function oe({
|
|
299
|
+
options: r,
|
|
304
300
|
picked: l,
|
|
305
301
|
emptyLabel: u,
|
|
306
|
-
valueTitle:
|
|
302
|
+
valueTitle: c,
|
|
307
303
|
disabled: o,
|
|
308
304
|
onToggle: m,
|
|
309
305
|
onClear: g
|
|
310
306
|
}) {
|
|
311
|
-
const [y, h] =
|
|
312
|
-
if (
|
|
307
|
+
const [y, h] = q(!1), [i, n] = q(""), f = l.size === 0;
|
|
308
|
+
if (r.length <= Fe)
|
|
313
309
|
return /* @__PURE__ */ b("div", { className: "flex flex-wrap items-center gap-1", "data-membership-values": !0, children: [
|
|
314
|
-
/* @__PURE__ */
|
|
310
|
+
/* @__PURE__ */ s(
|
|
315
311
|
"button",
|
|
316
312
|
{
|
|
317
313
|
type: "button",
|
|
318
314
|
disabled: o || f,
|
|
319
315
|
"aria-pressed": f,
|
|
320
316
|
onClick: g,
|
|
321
|
-
className:
|
|
317
|
+
className: C(
|
|
322
318
|
"h-6 rounded-full border px-2 text-[11px] transition-colors",
|
|
323
319
|
f ? "border-nvr-cyan/40 bg-nvr-cyan/10 font-medium text-slate-800 dark:text-foreground" : "border-slate-200 text-slate-500 hover:bg-muted dark:border-border dark:text-muted-foreground"
|
|
324
320
|
),
|
|
325
321
|
children: u
|
|
326
322
|
}
|
|
327
323
|
),
|
|
328
|
-
|
|
324
|
+
r.map((p) => {
|
|
329
325
|
const k = l.has(p.id);
|
|
330
326
|
return /* @__PURE__ */ b(
|
|
331
327
|
"button",
|
|
@@ -335,12 +331,12 @@ function ie({
|
|
|
335
331
|
"aria-pressed": k,
|
|
336
332
|
"data-membership-value": p.id,
|
|
337
333
|
onClick: () => m(p.id),
|
|
338
|
-
className:
|
|
334
|
+
className: C(
|
|
339
335
|
"inline-flex h-6 items-center gap-1 rounded-full border px-2 text-[11px] transition-colors",
|
|
340
336
|
k ? "border-nvr-cyan/40 bg-nvr-cyan/10 font-medium text-slate-800 dark:text-foreground" : "border-slate-200 text-slate-500 hover:bg-muted dark:border-border dark:text-muted-foreground"
|
|
341
337
|
),
|
|
342
338
|
children: [
|
|
343
|
-
k && /* @__PURE__ */
|
|
339
|
+
k && /* @__PURE__ */ s(R, { className: "h-3 w-3" }),
|
|
344
340
|
p.label
|
|
345
341
|
]
|
|
346
342
|
},
|
|
@@ -348,32 +344,32 @@ function ie({
|
|
|
348
344
|
);
|
|
349
345
|
})
|
|
350
346
|
] });
|
|
351
|
-
const w =
|
|
352
|
-
return /* @__PURE__ */ b(
|
|
353
|
-
/* @__PURE__ */
|
|
347
|
+
const w = i.trim() ? r.filter((p) => de(p.label, i)) : r, _ = f ? u : r.filter((p) => l.has(p.id)).map((p) => p.label).join(", ");
|
|
348
|
+
return /* @__PURE__ */ b($e, { open: y, onOpenChange: h, children: [
|
|
349
|
+
/* @__PURE__ */ s(qe, { asChild: !0, children: /* @__PURE__ */ b(
|
|
354
350
|
"button",
|
|
355
351
|
{
|
|
356
352
|
type: "button",
|
|
357
353
|
disabled: o,
|
|
358
354
|
className: "flex h-7 w-full items-center justify-between gap-2 rounded-md border border-slate-200 bg-background px-2 text-left text-[12px] dark:border-border",
|
|
359
355
|
children: [
|
|
360
|
-
/* @__PURE__ */
|
|
361
|
-
/* @__PURE__ */
|
|
356
|
+
/* @__PURE__ */ s("span", { className: C("truncate", f && "text-slate-500 dark:text-muted-foreground"), children: _ }),
|
|
357
|
+
/* @__PURE__ */ s(we, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" })
|
|
362
358
|
]
|
|
363
359
|
}
|
|
364
360
|
) }),
|
|
365
|
-
/* @__PURE__ */ b(
|
|
366
|
-
/* @__PURE__ */
|
|
361
|
+
/* @__PURE__ */ b(Le, { align: "start", className: "w-[260px] p-1", children: [
|
|
362
|
+
/* @__PURE__ */ s(
|
|
367
363
|
"input",
|
|
368
364
|
{
|
|
369
|
-
value:
|
|
370
|
-
onChange: (p) =>
|
|
371
|
-
placeholder: `Search ${
|
|
365
|
+
value: i,
|
|
366
|
+
onChange: (p) => n(p.target.value),
|
|
367
|
+
placeholder: `Search ${c.toLowerCase()}…`,
|
|
372
368
|
className: "mb-1 h-7 w-full rounded border border-slate-200 bg-background px-2 text-[12px] outline-none dark:border-border"
|
|
373
369
|
}
|
|
374
370
|
),
|
|
375
371
|
/* @__PURE__ */ b("ul", { className: "max-h-[240px] overflow-y-auto", children: [
|
|
376
|
-
!
|
|
372
|
+
!i.trim() && /* @__PURE__ */ s("li", { className: "mb-1 border-b border-slate-100 pb-1 dark:border-border", children: /* @__PURE__ */ b(
|
|
377
373
|
"button",
|
|
378
374
|
{
|
|
379
375
|
type: "button",
|
|
@@ -384,22 +380,22 @@ function ie({
|
|
|
384
380
|
"data-membership-clear": !0,
|
|
385
381
|
className: "flex w-full items-center gap-2 rounded px-2 py-1 text-left text-[12px] font-medium hover:bg-muted",
|
|
386
382
|
children: [
|
|
387
|
-
/* @__PURE__ */
|
|
383
|
+
/* @__PURE__ */ s(R, { className: C("h-3.5 w-3.5", f ? "opacity-100" : "opacity-0") }),
|
|
388
384
|
u
|
|
389
385
|
]
|
|
390
386
|
}
|
|
391
387
|
) }),
|
|
392
|
-
w.map((p) => /* @__PURE__ */
|
|
388
|
+
w.map((p) => /* @__PURE__ */ s("li", { children: /* @__PURE__ */ b(
|
|
393
389
|
"button",
|
|
394
390
|
{
|
|
395
391
|
type: "button",
|
|
396
392
|
onClick: () => m(p.id),
|
|
397
393
|
className: "flex w-full items-center gap-2 rounded px-2 py-1 text-left text-[12px] hover:bg-muted",
|
|
398
394
|
children: [
|
|
399
|
-
/* @__PURE__ */
|
|
400
|
-
|
|
395
|
+
/* @__PURE__ */ s(
|
|
396
|
+
R,
|
|
401
397
|
{
|
|
402
|
-
className:
|
|
398
|
+
className: C("h-3.5 w-3.5", l.has(p.id) ? "opacity-100" : "opacity-0")
|
|
403
399
|
}
|
|
404
400
|
),
|
|
405
401
|
p.label
|
|
@@ -411,6 +407,6 @@ function ie({
|
|
|
411
407
|
] });
|
|
412
408
|
}
|
|
413
409
|
export {
|
|
414
|
-
|
|
415
|
-
|
|
410
|
+
Xe as MembershipSetField,
|
|
411
|
+
Me as planMembershipRows
|
|
416
412
|
};
|