@nivaro/react 0.3.116 → 0.3.118
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +140 -14
- package/dist/index.js +488 -485
- package/dist/shared/components/ActivityEntry.js +130 -125
- package/dist/shared/components/AgentPresenceChip.js +36 -26
- package/dist/shared/components/CellCopyLayer.js +50 -45
- package/dist/shared/components/CollectionBrowserView.js +3855 -3785
- package/dist/shared/components/FilePreviewLightbox.js +96 -58
- package/dist/shared/components/InStep.js +18 -17
- package/dist/shared/components/ItemEditForm.js +4220 -4175
- package/dist/shared/components/JobsTray.js +8 -8
- package/dist/shared/components/LiveNewMatchesPill.js +21 -14
- package/dist/shared/components/LiveOffNote.js +3 -2
- package/dist/shared/components/LiveRowMark.js +53 -23
- package/dist/shared/components/LiveTraceView.js +162 -123
- package/dist/shared/components/MyWorkView.js +320 -299
- package/dist/shared/components/NotificationBell.js +14 -14
- package/dist/shared/components/OverflowRail.js +1 -1
- package/dist/shared/components/PageRenderer.js +120 -116
- package/dist/shared/components/ProfileView.js +203 -202
- package/dist/shared/components/RealtimeStatusBanner.js +31 -29
- package/dist/shared/components/RecordDrilldownSheet.js +7 -7
- package/dist/shared/components/RecordHoverCard.js +102 -84
- package/dist/shared/components/RecordReadView.js +146 -146
- package/dist/shared/components/ReportView.js +1086 -1091
- package/dist/shared/components/ScreenRefreshButton.js +34 -32
- package/dist/shared/components/TipLayer.js +65 -58
- package/dist/shared/components/WidgetImageMenu.js +83 -43
- package/dist/shared/components/activity/RecordActivityStream.js +175 -173
- package/dist/shared/components/bulk/BulkSelectionNotices.js +142 -119
- package/dist/shared/components/cbv/column-totals.js +62 -57
- package/dist/shared/components/change-proposals/ChangeProposalsPanel.js +158 -143
- package/dist/shared/components/change-proposals/ProposeChangeButton.js +17 -11
- package/dist/shared/components/change-proposals/ProposeChangeDialog.js +201 -173
- package/dist/shared/components/charts/category-axis.js +93 -0
- package/dist/shared/components/chat/ChatAnalyticsView.js +27 -27
- package/dist/shared/components/chat/HuddleAnalyticsTab.js +17 -17
- package/dist/shared/components/collections-directory/CollectionsToolbar.js +39 -41
- package/dist/shared/components/collections-directory/page-model.js +72 -67
- package/dist/shared/components/integrations/RecordIntegrationPreview.js +48 -56
- package/dist/shared/components/integrations/SendStatus.js +65 -59
- package/dist/shared/components/integrations/console/ReadyToSendView.js +275 -209
- package/dist/shared/components/integrations/console/SignalCard.js +237 -230
- package/dist/shared/components/item-edit/CatalogPickerField.js +227 -205
- package/dist/shared/components/item-edit/ChangedAfterApprovalBadge.js +131 -92
- package/dist/shared/components/item-edit/CloneDialog.js +191 -161
- package/dist/shared/components/item-edit/DerivedCauseNote.js +44 -30
- package/dist/shared/components/item-edit/DraftRecoveryBanner.js +153 -134
- package/dist/shared/components/item-edit/FieldComments.js +54 -53
- package/dist/shared/components/item-edit/FieldPointer.js +82 -67
- package/dist/shared/components/item-edit/FieldRow.js +106 -100
- package/dist/shared/components/item-edit/FieldSourceBadge.js +58 -56
- package/dist/shared/components/item-edit/FilePickerField.js +452 -387
- package/dist/shared/components/item-edit/HeaderSummaryChip.js +78 -56
- package/dist/shared/components/item-edit/HeaderTools.js +94 -85
- package/dist/shared/components/item-edit/InlineTableField.js +1242 -1218
- package/dist/shared/components/item-edit/ListNeighborNav.js +47 -50
- package/dist/shared/components/item-edit/LiveTraceSheet.js +15 -10
- package/dist/shared/components/item-edit/MembershipSetField.js +285 -254
- package/dist/shared/components/item-edit/OutboxReviewTray.js +155 -144
- package/dist/shared/components/item-edit/QueueReturnChip.js +15 -36
- package/dist/shared/components/item-edit/RecalcValue.js +57 -32
- package/dist/shared/components/item-edit/RecordHelpChip.js +21 -22
- package/dist/shared/components/item-edit/RecordLiveSync.js +283 -231
- package/dist/shared/components/item-edit/RelationCombobox.js +439 -393
- package/dist/shared/components/item-edit/RemoteChangeUi.js +292 -224
- package/dist/shared/components/item-edit/RemoteUploads.js +26 -20
- package/dist/shared/components/item-edit/RemovedLineNote.js +77 -67
- package/dist/shared/components/item-edit/RichTextEditorImpl.js +184 -179
- package/dist/shared/components/item-edit/ScheduledChangeChip.js +168 -134
- package/dist/shared/components/item-edit/SectionPresence.js +18 -10
- package/dist/shared/components/item-edit/SplitLinesButton.js +163 -139
- package/dist/shared/components/item-edit/UserChip.js +1 -1
- package/dist/shared/components/item-edit/file-live.js +69 -54
- package/dist/shared/components/item-edit/layout-switch.js +98 -89
- package/dist/shared/components/item-edit/partner-needs.js +12 -12
- package/dist/shared/components/item-edit/removed-line.js +31 -25
- package/dist/shared/components/layout-editor/pickers/field-picker.js +112 -104
- package/dist/shared/components/list/ListViewers.js +46 -35
- package/dist/shared/components/notifications/NotificationCenterView.js +479 -437
- package/dist/shared/components/panels/AccessDeniedPanel.js +176 -101
- package/dist/shared/components/panels/AlertBanners.js +82 -72
- package/dist/shared/components/panels/BranchLanes.js +22 -22
- package/dist/shared/components/panels/CommentImages.js +123 -102
- package/dist/shared/components/panels/CommentPanel.js +186 -185
- package/dist/shared/components/panels/ExternalRequestsChip.js +111 -119
- package/dist/shared/components/panels/OwnerOpenedLine.js +31 -24
- package/dist/shared/components/panels/PipelinePanel.js +2037 -1885
- package/dist/shared/components/panels/ResubmissionDiff.js +163 -142
- package/dist/shared/components/pipeline/BindingStartStateSettings.js +163 -0
- package/dist/shared/components/pipeline/OwnerMatrixSheet.js +400 -288
- package/dist/shared/components/pipeline/PipelineEditorView.js +320 -299
- package/dist/shared/components/profile/AgentNameField.js +107 -81
- package/dist/shared/components/profile/AgentsPanel.js +184 -184
- package/dist/shared/components/profile/PersonAccess.js +599 -495
- package/dist/shared/components/profile/SignInTroubleshooter.js +160 -127
- package/dist/shared/components/profile/SignedInDevices.js +17 -17
- package/dist/shared/components/profile/primitives.js +1 -1
- package/dist/shared/components/queue/OwnerAvatars.js +91 -54
- package/dist/shared/components/queue/QueueTeamStrip.js +56 -46
- package/dist/shared/components/queue/QueueWorklist.js +1002 -983
- package/dist/shared/components/support/AssignRules.js +1733 -0
- package/dist/shared/components/support/PersonPick.js +88 -0
- package/dist/shared/components/support/RequestList.js +790 -0
- package/dist/shared/components/support/ScreenShare.js +158 -152
- package/dist/shared/components/support/SupportRequestDialog.js +50 -48
- package/dist/shared/components/support/SupportView.js +140 -246
- package/dist/shared/components/support/TicketDetailSheet.js +82 -75
- package/dist/shared/components/support/TicketSlowScreens.js +9 -9
- package/dist/shared/components/support/assign-rules-text.js +171 -0
- package/dist/shared/components/support/support-list.js +125 -0
- package/dist/shared/components/ui/SimpleSelect.js +28 -20
- package/dist/shared/components/ui/checkbox.js +6 -6
- package/dist/shared/components/ui/select.js +43 -39
- package/dist/shared/components/ui/sheet.js +9 -9
- package/dist/shared/components/ui/switch.js +12 -11
- package/dist/shared/components/watch-list/WatchDock.js +532 -459
- package/dist/shared/components/watch-list/WatchExtras.js +332 -286
- package/dist/shared/components/watch-list/WatchRows.js +164 -140
- package/dist/shared/lib/activity-sentence.js +103 -91
- package/dist/shared/lib/agent-presence.js +27 -21
- package/dist/shared/lib/approval-progress.js +2 -2
- package/dist/shared/lib/copy-rules.js +31 -24
- package/dist/shared/lib/derived-causes.js +113 -78
- package/dist/shared/lib/grid-cursors.js +26 -26
- package/dist/shared/lib/label-flash.js +27 -0
- package/dist/shared/lib/list-return.js +137 -125
- package/dist/shared/lib/live-deltas.js +40 -34
- package/dist/shared/lib/live-groups.js +56 -52
- package/dist/shared/lib/live-preference.js +64 -59
- package/dist/shared/lib/live-screen.js +223 -192
- package/dist/shared/lib/partner-failure.js +11 -11
- package/dist/shared/lib/rollup-recalc.js +68 -64
- package/dist/shared/lib/screen-refresh.js +74 -68
- package/dist/shared/lib/screen-share.js +108 -104
- package/dist/shared/lib/send-status.js +77 -61
- package/dist/shared/lib/text-diff-window.js +29 -0
- package/dist/shared/lib/use-query-entry.js +17 -0
- package/dist/shared/lib/watch-list.js +210 -209
- package/dist/shared/lib/widget-image-render.js +72 -49
- package/package.json +1 -1
|
@@ -1,223 +1,246 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useQueryClient as
|
|
3
|
-
import { Search as
|
|
4
|
-
import { useState as
|
|
5
|
-
import { useNivaroClient as
|
|
6
|
-
import { get as
|
|
7
|
-
import { fetchCollectionRelations as
|
|
8
|
-
import { userErrorMessage as
|
|
9
|
-
import { matchesAllTokens as
|
|
10
|
-
import { Popover as
|
|
11
|
-
import { applyDisplayTemplate as
|
|
12
|
-
import { RelationCombobox as
|
|
13
|
-
const
|
|
14
|
-
function
|
|
15
|
-
const
|
|
16
|
-
for (const
|
|
17
|
-
const
|
|
18
|
-
|
|
1
|
+
import { jsxs as h, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { useQueryClient as Ne, useQuery as M } from "@tanstack/react-query";
|
|
3
|
+
import { Search as Se, X as Ce, Check as O, ChevronsUpDown as $e } from "lucide-react";
|
|
4
|
+
import { useState as $, useRef as qe, useMemo as C, useEffect as _e } from "react";
|
|
5
|
+
import { useNivaroClient as pe } from "../../context.js";
|
|
6
|
+
import { get as Ke, patch as Te, post as ce, del as de } from "../../lib/commands.js";
|
|
7
|
+
import { fetchCollectionRelations as Le, queryKeys as be, fetchCollectionMeta as Me } from "../../lib/query-keys.js";
|
|
8
|
+
import { userErrorMessage as Fe } from "../../lib/safe-error.js";
|
|
9
|
+
import { matchesAllTokens as he, titleCase as P, cn as S } from "../../lib/utils.js";
|
|
10
|
+
import { Popover as Re, PopoverTrigger as je, PopoverContent as Ae } from "../ui/popover.js";
|
|
11
|
+
import { applyDisplayTemplate as Oe } from "./helpers.js";
|
|
12
|
+
import { RelationCombobox as Pe } from "./RelationCombobox.js";
|
|
13
|
+
const ue = (a, l) => `${a ?? ""}\0${l ?? ""}`;
|
|
14
|
+
function Qe(a, l) {
|
|
15
|
+
const m = new Map(l.map((x) => [ue(x[0], x[1]), x])), d = /* @__PURE__ */ new Set(), o = [];
|
|
16
|
+
for (const x of a) {
|
|
17
|
+
const f = ue(x.value, x.value2);
|
|
18
|
+
m.has(f) && !d.has(f) ? d.add(f) : o.push(x.id);
|
|
19
19
|
}
|
|
20
|
-
const
|
|
21
|
-
for (const [
|
|
22
|
-
if (
|
|
20
|
+
const p = [], g = [];
|
|
21
|
+
for (const [x, f] of m) {
|
|
22
|
+
if (d.has(x)) continue;
|
|
23
23
|
const i = o.shift();
|
|
24
|
-
i !== void 0 ?
|
|
24
|
+
i !== void 0 ? p.push({ id: i, pair: f }) : g.push(f);
|
|
25
25
|
}
|
|
26
|
-
return { repoint:
|
|
26
|
+
return { repoint: p, create: g, remove: o };
|
|
27
27
|
}
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
return
|
|
31
|
-
},
|
|
32
|
-
async function
|
|
33
|
-
const
|
|
28
|
+
const ze = (a, l) => {
|
|
29
|
+
const m = a.size ? [...a] : [null], d = l.size ? [...l] : [null];
|
|
30
|
+
return m.flatMap((o) => d.map((p) => [o, p]));
|
|
31
|
+
}, De = 10;
|
|
32
|
+
async function z(a, l, m) {
|
|
33
|
+
const d = [];
|
|
34
34
|
for (let o = 1; o <= 50; o++) {
|
|
35
|
-
const
|
|
36
|
-
if (
|
|
35
|
+
const p = await a.request(Ke(l, { ...m, limit: 1e3, page: o })).then((g) => g.data ?? []);
|
|
36
|
+
if (d.push(...p), p.length < 1e3) break;
|
|
37
37
|
}
|
|
38
|
-
return
|
|
38
|
+
return d;
|
|
39
39
|
}
|
|
40
|
-
const
|
|
41
|
-
function
|
|
42
|
-
const
|
|
43
|
-
queryKey:
|
|
44
|
-
queryFn: () =>
|
|
40
|
+
const Ee = (a) => [...(a ?? "").matchAll(/\{\{([\w.]+)\}\}/g)].map((l) => l[1]);
|
|
41
|
+
function Q(a, l) {
|
|
42
|
+
const m = pe(), { data: d } = M({
|
|
43
|
+
queryKey: be.collectionDisplayMeta(a),
|
|
44
|
+
queryFn: () => Me(m, a),
|
|
45
45
|
select: (i) => (i == null ? void 0 : i.display_template) ?? null,
|
|
46
|
-
enabled: !!
|
|
46
|
+
enabled: !!a,
|
|
47
47
|
staleTime: 10 * 6e4
|
|
48
|
-
}), o =
|
|
49
|
-
queryKey: ["membership-set-labels",
|
|
48
|
+
}), o = d ?? null, p = l === "all" ? "all" : [...l].sort().join(","), { data: g = [], isLoading: x } = M({
|
|
49
|
+
queryKey: ["membership-set-labels", a, o, p],
|
|
50
50
|
queryFn: async () => {
|
|
51
|
-
const i =
|
|
52
|
-
if (l === "all") return
|
|
53
|
-
const
|
|
51
|
+
const i = Ee(o), n = i.length ? { fields: ["id", ...i].join(",") } : {};
|
|
52
|
+
if (l === "all") return z(m, `/items/${a}`, n);
|
|
53
|
+
const y = [];
|
|
54
54
|
for (let w = 0; w < l.length; w += 150)
|
|
55
|
-
|
|
56
|
-
...await
|
|
55
|
+
y.push(
|
|
56
|
+
...await z(m, `/items/${a}`, {
|
|
57
57
|
...n,
|
|
58
58
|
filter: JSON.stringify({ id: { _in: l.slice(w, w + 150) } })
|
|
59
59
|
})
|
|
60
60
|
);
|
|
61
|
-
return
|
|
61
|
+
return y;
|
|
62
62
|
},
|
|
63
|
-
enabled: !!
|
|
63
|
+
enabled: !!a && d !== void 0 && (l === "all" || l.length > 0),
|
|
64
64
|
staleTime: 6e4
|
|
65
65
|
});
|
|
66
|
-
return { labels:
|
|
66
|
+
return { labels: C(() => {
|
|
67
67
|
const i = /* @__PURE__ */ new Map();
|
|
68
68
|
for (const n of g) {
|
|
69
|
-
const
|
|
70
|
-
i.set(String(n.id), (o ?
|
|
69
|
+
const y = String(n.name ?? n.title ?? n.label ?? `#${n.id}`);
|
|
70
|
+
i.set(String(n.id), (o ? Oe(o, n) : "").trim() || y);
|
|
71
71
|
}
|
|
72
72
|
return i;
|
|
73
|
-
}, [g, o]), isLoading:
|
|
73
|
+
}, [g, o]), isLoading: x };
|
|
74
74
|
}
|
|
75
|
-
function
|
|
76
|
-
relatedCollection:
|
|
75
|
+
function tt({
|
|
76
|
+
relatedCollection: a,
|
|
77
77
|
manyField: l,
|
|
78
|
-
parentId:
|
|
79
|
-
config:
|
|
78
|
+
parentId: m,
|
|
79
|
+
config: d,
|
|
80
80
|
readOnly: o
|
|
81
81
|
}) {
|
|
82
|
-
const
|
|
83
|
-
queryKey:
|
|
84
|
-
queryFn: () =>
|
|
82
|
+
const p = pe(), g = Ne(), x = m === "new", { key_field: f, value_field: i } = d, n = d.value_field_2 || null, y = d.empty_label ?? "All", w = d.empty_label_2 ?? y, [q, u] = $(""), [k, D] = $(null), E = qe(null), [K, V] = $(null), [B, J] = $(null), { data: fe = [] } = M({
|
|
83
|
+
queryKey: be.collectionRelations(a),
|
|
84
|
+
queryFn: () => Le(p, a),
|
|
85
85
|
staleTime: 10 * 6e4
|
|
86
|
-
}),
|
|
87
|
-
var
|
|
88
|
-
return ((
|
|
89
|
-
},
|
|
90
|
-
queryKey:
|
|
91
|
-
queryFn: async () => (await
|
|
92
|
-
fields: ["id",
|
|
93
|
-
filter: JSON.stringify({ [l]: { _eq:
|
|
94
|
-
})).filter((e) => e[
|
|
86
|
+
}), F = (e) => {
|
|
87
|
+
var r;
|
|
88
|
+
return ((r = fe.find((t) => t.many_collection === a && t.many_field === e)) == null ? void 0 : r.one_collection) ?? null;
|
|
89
|
+
}, T = F(f), H = F(i), U = n ? F(n) : null, X = ["membership-set-rows", a, l, String(m)], { data: G = [], isLoading: ye } = M({
|
|
90
|
+
queryKey: X,
|
|
91
|
+
queryFn: async () => (await z(p, `/items/${a}`, {
|
|
92
|
+
fields: ["id", f, i, ...n ? [n] : []].join(","),
|
|
93
|
+
filter: JSON.stringify({ [l]: { _eq: m } })
|
|
94
|
+
})).filter((e) => e[f] != null).map((e) => ({
|
|
95
95
|
id: e.id,
|
|
96
|
-
key: String(e[
|
|
96
|
+
key: String(e[f]),
|
|
97
97
|
value: e[i] == null ? null : String(e[i]),
|
|
98
98
|
value2: !n || e[n] == null ? null : String(e[n])
|
|
99
99
|
})),
|
|
100
|
-
enabled: !
|
|
100
|
+
enabled: !x,
|
|
101
101
|
staleTime: 15e3
|
|
102
|
-
}), N =
|
|
102
|
+
}), N = C(() => {
|
|
103
103
|
const e = /* @__PURE__ */ new Map();
|
|
104
|
-
for (const
|
|
104
|
+
for (const r of G) e.set(r.key, [...e.get(r.key) ?? [], r]);
|
|
105
105
|
return e;
|
|
106
|
-
}, [
|
|
107
|
-
g.invalidateQueries({ queryKey:
|
|
108
|
-
}, j = async (e,
|
|
109
|
-
|
|
106
|
+
}, [G]), v = C(() => [...N.keys()], [N]), { labels: R } = Q(T, v), { labels: I } = Q(H, "all"), { labels: W } = Q(U, "all"), Y = (e) => [...e.entries()].map(([r, t]) => ({ id: r, label: t })).sort((r, t) => r.label.localeCompare(t.label, void 0, { numeric: !0 })), xe = C(() => Y(I), [I]), ge = C(() => Y(W), [W]), ve = () => {
|
|
107
|
+
g.invalidateQueries({ queryKey: X }), g.invalidateQueries({ queryKey: ["o2m-rows", a] });
|
|
108
|
+
}, j = async (e, r) => {
|
|
109
|
+
V(e), J(null);
|
|
110
110
|
try {
|
|
111
|
-
await
|
|
111
|
+
await r();
|
|
112
112
|
} catch (t) {
|
|
113
|
-
const
|
|
114
|
-
|
|
113
|
+
const b = t == null ? void 0 : t.response;
|
|
114
|
+
J((b == null ? void 0 : b.error) ?? Fe(t, "Could not save"));
|
|
115
115
|
} finally {
|
|
116
|
-
|
|
116
|
+
V(null), ve();
|
|
117
117
|
}
|
|
118
|
-
},
|
|
119
|
-
const
|
|
118
|
+
}, Z = (e) => {
|
|
119
|
+
const r = N.get(e) ?? [];
|
|
120
120
|
return {
|
|
121
|
-
a: new Set(
|
|
122
|
-
b: new Set(
|
|
121
|
+
a: new Set(r.filter((t) => t.value !== null).map((t) => t.value)),
|
|
122
|
+
b: new Set(r.filter((t) => t.value2 !== null).map((t) => t.value2))
|
|
123
123
|
};
|
|
124
|
-
},
|
|
124
|
+
}, A = ([e, r]) => ({
|
|
125
125
|
[i]: e,
|
|
126
|
-
...n ? { [n]:
|
|
127
|
-
}),
|
|
128
|
-
const
|
|
129
|
-
for (const
|
|
130
|
-
await
|
|
131
|
-
for (const
|
|
132
|
-
await
|
|
133
|
-
|
|
134
|
-
[l]:
|
|
135
|
-
[
|
|
136
|
-
...
|
|
126
|
+
...n ? { [n]: r } : {}
|
|
127
|
+
}), L = (e, r, t) => j(e, async () => {
|
|
128
|
+
const b = Qe(N.get(e) ?? [], ze(r, t));
|
|
129
|
+
for (const c of b.repoint)
|
|
130
|
+
await p.request(Te(`/items/${a}/${c.id}`, A(c.pair)));
|
|
131
|
+
for (const c of b.create)
|
|
132
|
+
await p.request(
|
|
133
|
+
ce(`/items/${a}`, {
|
|
134
|
+
[l]: m,
|
|
135
|
+
[f]: e,
|
|
136
|
+
...A(c)
|
|
137
137
|
})
|
|
138
138
|
);
|
|
139
|
-
for (const
|
|
140
|
-
}),
|
|
139
|
+
for (const c of b.remove) await p.request(de(`/items/${a}/${c}`));
|
|
140
|
+
}), ee = (e, r) => {
|
|
141
141
|
const t = new Set(e);
|
|
142
|
-
return t.has(
|
|
143
|
-
},
|
|
144
|
-
const { a:
|
|
145
|
-
return t === 1 ?
|
|
146
|
-
},
|
|
147
|
-
const { a: t, b
|
|
148
|
-
if ((
|
|
149
|
-
return
|
|
150
|
-
},
|
|
151
|
-
for (const
|
|
152
|
-
await
|
|
153
|
-
}),
|
|
142
|
+
return t.has(r) ? t.delete(r) : t.add(r), t;
|
|
143
|
+
}, te = (e, r, t = 1) => {
|
|
144
|
+
const { a: b, b: c } = Z(e);
|
|
145
|
+
return t === 1 ? L(e, ee(b, r), c) : L(e, b, ee(c, r));
|
|
146
|
+
}, re = (e, r = 1) => {
|
|
147
|
+
const { a: t, b } = Z(e);
|
|
148
|
+
if ((r === 1 ? t : b).size !== 0)
|
|
149
|
+
return r === 1 ? L(e, /* @__PURE__ */ new Set(), b) : L(e, t, /* @__PURE__ */ new Set());
|
|
150
|
+
}, we = (e) => j(e, async () => {
|
|
151
|
+
for (const r of N.get(e) ?? [])
|
|
152
|
+
await p.request(de(`/items/${a}/${r.id}`));
|
|
153
|
+
}), ke = (e) => {
|
|
154
154
|
e == null || e === "" || N.has(String(e)) || j(
|
|
155
155
|
String(e),
|
|
156
|
-
() =>
|
|
157
|
-
|
|
158
|
-
[l]:
|
|
159
|
-
[
|
|
160
|
-
...
|
|
156
|
+
() => p.request(
|
|
157
|
+
ce(`/items/${a}`, {
|
|
158
|
+
[l]: m,
|
|
159
|
+
[f]: e,
|
|
160
|
+
...A([null, null])
|
|
161
161
|
})
|
|
162
162
|
)
|
|
163
163
|
);
|
|
164
|
-
},
|
|
165
|
-
const e = v.map((t) => ({ key: t, label:
|
|
166
|
-
return
|
|
167
|
-
}, [v,
|
|
168
|
-
|
|
164
|
+
}, ae = C(() => {
|
|
165
|
+
const e = v.map((t) => ({ key: t, label: R.get(t) ?? `#${t}` })).sort((t, b) => t.label.localeCompare(b.label, void 0, { numeric: !0 })), r = q.trim();
|
|
166
|
+
return r ? e.filter((t) => he(t.label, r)) : e;
|
|
167
|
+
}, [v, R, q]);
|
|
168
|
+
_e(() => {
|
|
169
|
+
if (!k) return;
|
|
170
|
+
const e = requestAnimationFrame(() => {
|
|
171
|
+
var c, oe, ie;
|
|
172
|
+
const t = (c = E.current) == null ? void 0 : c.querySelector(
|
|
173
|
+
`[data-membership-key="${CSS.escape(k)}"]`
|
|
174
|
+
);
|
|
175
|
+
if (!t) return;
|
|
176
|
+
const b = (oe = window.matchMedia) == null ? void 0 : oe.call(window, "(prefers-reduced-motion: reduce)").matches;
|
|
177
|
+
t.scrollIntoView({ block: "nearest", behavior: b ? "auto" : "smooth" }), (ie = t.querySelector("button:not([disabled])")) == null || ie.focus({ preventScroll: !0 });
|
|
178
|
+
}), r = window.setTimeout(() => D(null), 2200);
|
|
179
|
+
return () => {
|
|
180
|
+
cancelAnimationFrame(e), window.clearTimeout(r);
|
|
181
|
+
};
|
|
182
|
+
}, [k]);
|
|
183
|
+
const _ = d.key_label ?? P(T ?? f), le = d.value_label ?? P(H ?? i), se = n ? d.value_label_2 ?? P(U ?? n) : "", ne = n ? "grid-cols-[minmax(140px,1fr)_minmax(0,1.5fr)_minmax(0,1.5fr)_28px]" : "grid-cols-[minmax(140px,1fr)_minmax(0,2fr)_28px]";
|
|
184
|
+
return x ? /* @__PURE__ */ h("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: [
|
|
169
185
|
"Save this record first, then add ",
|
|
170
|
-
|
|
186
|
+
_.toLowerCase(),
|
|
171
187
|
" here."
|
|
172
|
-
] }) : /* @__PURE__ */
|
|
173
|
-
!o &&
|
|
188
|
+
] }) : /* @__PURE__ */ h("div", { "data-membership-set": `${a}:${l}`, className: "space-y-2", children: [
|
|
189
|
+
!o && T && /* @__PURE__ */ h("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
174
190
|
/* @__PURE__ */ s("div", { className: "w-[320px] max-w-full", children: /* @__PURE__ */ s(
|
|
175
|
-
|
|
191
|
+
Pe,
|
|
176
192
|
{
|
|
177
|
-
collection:
|
|
193
|
+
collection: T,
|
|
178
194
|
value: null,
|
|
179
|
-
onChange:
|
|
180
|
-
placeholder: `Add ${
|
|
181
|
-
extraFilter: v.length && v.length <= 400 ? { id: { _nin: v } } : void 0
|
|
195
|
+
onChange: ke,
|
|
196
|
+
placeholder: `Add ${_.toLowerCase()}…`,
|
|
197
|
+
extraFilter: v.length && v.length <= 400 ? { id: { _nin: v } } : void 0,
|
|
198
|
+
alreadyAdded: {
|
|
199
|
+
items: v.map((e) => ({ id: e, label: R.get(e) ?? `#${e}` })),
|
|
200
|
+
where: "in this table",
|
|
201
|
+
onShow: (e) => {
|
|
202
|
+
u(""), D(e);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
182
205
|
},
|
|
183
206
|
v.length
|
|
184
207
|
) }),
|
|
185
|
-
v.length > 8 && /* @__PURE__ */
|
|
186
|
-
/* @__PURE__ */ s(
|
|
208
|
+
v.length > 8 && /* @__PURE__ */ h("label", { className: "relative ml-auto block w-[220px] max-w-full", children: [
|
|
209
|
+
/* @__PURE__ */ s(Se, { className: "pointer-events-none absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-400" }),
|
|
187
210
|
/* @__PURE__ */ s(
|
|
188
211
|
"input",
|
|
189
212
|
{
|
|
190
|
-
value:
|
|
191
|
-
onChange: (e) =>
|
|
213
|
+
value: q,
|
|
214
|
+
onChange: (e) => u(e.target.value),
|
|
192
215
|
placeholder: `Filter ${v.length}…`,
|
|
193
|
-
"aria-label": `Filter ${
|
|
216
|
+
"aria-label": `Filter ${_}`,
|
|
194
217
|
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"
|
|
195
218
|
}
|
|
196
219
|
)
|
|
197
220
|
] })
|
|
198
221
|
] }),
|
|
199
|
-
/* @__PURE__ */
|
|
200
|
-
/* @__PURE__ */
|
|
222
|
+
/* @__PURE__ */ h("div", { className: "overflow-hidden rounded-lg border border-slate-200 dark:border-border", children: [
|
|
223
|
+
/* @__PURE__ */ h(
|
|
201
224
|
"div",
|
|
202
225
|
{
|
|
203
|
-
className:
|
|
204
|
-
|
|
226
|
+
className: S(
|
|
227
|
+
ne,
|
|
205
228
|
"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"
|
|
206
229
|
),
|
|
207
230
|
children: [
|
|
208
|
-
/* @__PURE__ */ s("span", { children:
|
|
209
|
-
/* @__PURE__ */
|
|
210
|
-
|
|
231
|
+
/* @__PURE__ */ s("span", { children: _ }),
|
|
232
|
+
/* @__PURE__ */ h("span", { children: [
|
|
233
|
+
le,
|
|
211
234
|
" ",
|
|
212
|
-
/* @__PURE__ */
|
|
235
|
+
/* @__PURE__ */ h("span", { className: "normal-case tracking-normal text-slate-400", children: [
|
|
213
236
|
"· none picked = ",
|
|
214
|
-
|
|
237
|
+
y.toLowerCase()
|
|
215
238
|
] })
|
|
216
239
|
] }),
|
|
217
|
-
n && /* @__PURE__ */
|
|
218
|
-
|
|
240
|
+
n && /* @__PURE__ */ h("span", { children: [
|
|
241
|
+
se,
|
|
219
242
|
" ",
|
|
220
|
-
/* @__PURE__ */
|
|
243
|
+
/* @__PURE__ */ h("span", { className: "normal-case tracking-normal text-slate-400", children: [
|
|
221
244
|
"· none picked = ",
|
|
222
245
|
w.toLowerCase()
|
|
223
246
|
] })
|
|
@@ -226,187 +249,195 @@ function Xe({
|
|
|
226
249
|
]
|
|
227
250
|
}
|
|
228
251
|
),
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
"
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
"
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
252
|
+
ye ? /* @__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)) }) : ae.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(
|
|
253
|
+
"ul",
|
|
254
|
+
{
|
|
255
|
+
ref: E,
|
|
256
|
+
className: "max-h-[480px] divide-y divide-slate-100 overflow-y-auto dark:divide-border",
|
|
257
|
+
children: ae.map((e) => {
|
|
258
|
+
const r = N.get(e.key) ?? [], t = new Set(
|
|
259
|
+
r.filter((c) => c.value !== null).map((c) => c.value)
|
|
260
|
+
), b = new Set(
|
|
261
|
+
r.filter((c) => c.value2 !== null).map((c) => c.value2)
|
|
262
|
+
);
|
|
263
|
+
return /* @__PURE__ */ h(
|
|
264
|
+
"li",
|
|
265
|
+
{
|
|
266
|
+
"data-membership-key": e.key,
|
|
267
|
+
className: S(
|
|
268
|
+
ne,
|
|
269
|
+
"grid items-center gap-3 px-3 py-1.5 text-[12px] transition-colors duration-700 ease-out",
|
|
270
|
+
K === e.key && "opacity-60",
|
|
271
|
+
k === e.key && "bg-nvr-cyan/10"
|
|
272
|
+
),
|
|
273
|
+
children: [
|
|
274
|
+
/* @__PURE__ */ s(
|
|
275
|
+
"span",
|
|
276
|
+
{
|
|
277
|
+
className: "truncate font-medium text-slate-800 dark:text-foreground",
|
|
278
|
+
"data-tip": e.label,
|
|
279
|
+
children: e.label
|
|
280
|
+
}
|
|
281
|
+
),
|
|
282
|
+
/* @__PURE__ */ s(
|
|
283
|
+
me,
|
|
284
|
+
{
|
|
285
|
+
options: xe,
|
|
286
|
+
picked: t,
|
|
287
|
+
emptyLabel: y,
|
|
288
|
+
valueTitle: le,
|
|
289
|
+
disabled: !!o || K === e.key,
|
|
290
|
+
onToggle: (c) => te(e.key, c),
|
|
291
|
+
onClear: () => re(e.key)
|
|
292
|
+
}
|
|
293
|
+
),
|
|
294
|
+
n && /* @__PURE__ */ s(
|
|
295
|
+
me,
|
|
296
|
+
{
|
|
297
|
+
options: ge,
|
|
298
|
+
picked: b,
|
|
299
|
+
emptyLabel: w,
|
|
300
|
+
valueTitle: se,
|
|
301
|
+
disabled: !!o || K === e.key,
|
|
302
|
+
onToggle: (c) => te(e.key, c, 2),
|
|
303
|
+
onClear: () => re(e.key, 2)
|
|
304
|
+
}
|
|
305
|
+
),
|
|
306
|
+
o ? /* @__PURE__ */ s("span", {}) : /* @__PURE__ */ s(
|
|
307
|
+
"button",
|
|
308
|
+
{
|
|
309
|
+
type: "button",
|
|
310
|
+
onClick: () => we(e.key),
|
|
311
|
+
disabled: K === e.key,
|
|
312
|
+
"aria-label": `Remove ${e.label}`,
|
|
313
|
+
"data-tip": "Remove",
|
|
314
|
+
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",
|
|
315
|
+
children: /* @__PURE__ */ s(Ce, { className: "h-3.5 w-3.5" })
|
|
316
|
+
}
|
|
317
|
+
)
|
|
318
|
+
]
|
|
319
|
+
},
|
|
320
|
+
e.key
|
|
321
|
+
);
|
|
322
|
+
})
|
|
323
|
+
}
|
|
324
|
+
)
|
|
294
325
|
] }),
|
|
295
|
-
|
|
326
|
+
B && /* @__PURE__ */ s("p", { className: "text-[12px] text-red-600 dark:text-red-400", children: B })
|
|
296
327
|
] });
|
|
297
328
|
}
|
|
298
|
-
function
|
|
299
|
-
options:
|
|
329
|
+
function me({
|
|
330
|
+
options: a,
|
|
300
331
|
picked: l,
|
|
301
|
-
emptyLabel:
|
|
302
|
-
valueTitle:
|
|
332
|
+
emptyLabel: m,
|
|
333
|
+
valueTitle: d,
|
|
303
334
|
disabled: o,
|
|
304
|
-
onToggle:
|
|
335
|
+
onToggle: p,
|
|
305
336
|
onClear: g
|
|
306
337
|
}) {
|
|
307
|
-
const [
|
|
308
|
-
if (
|
|
309
|
-
return /* @__PURE__ */
|
|
338
|
+
const [x, f] = $(!1), [i, n] = $(""), y = l.size === 0;
|
|
339
|
+
if (a.length <= De)
|
|
340
|
+
return /* @__PURE__ */ h("div", { className: "flex flex-wrap items-center gap-1", "data-membership-values": !0, children: [
|
|
310
341
|
/* @__PURE__ */ s(
|
|
311
342
|
"button",
|
|
312
343
|
{
|
|
313
344
|
type: "button",
|
|
314
|
-
disabled: o ||
|
|
315
|
-
"aria-pressed":
|
|
345
|
+
disabled: o || y,
|
|
346
|
+
"aria-pressed": y,
|
|
316
347
|
onClick: g,
|
|
317
|
-
className:
|
|
348
|
+
className: S(
|
|
318
349
|
"h-6 rounded-full border px-2 text-[11px] transition-colors",
|
|
319
|
-
|
|
350
|
+
y ? "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"
|
|
320
351
|
),
|
|
321
|
-
children:
|
|
352
|
+
children: m
|
|
322
353
|
}
|
|
323
354
|
),
|
|
324
|
-
|
|
325
|
-
const k = l.has(
|
|
326
|
-
return /* @__PURE__ */
|
|
355
|
+
a.map((u) => {
|
|
356
|
+
const k = l.has(u.id);
|
|
357
|
+
return /* @__PURE__ */ h(
|
|
327
358
|
"button",
|
|
328
359
|
{
|
|
329
360
|
type: "button",
|
|
330
361
|
disabled: o,
|
|
331
362
|
"aria-pressed": k,
|
|
332
|
-
"data-membership-value":
|
|
333
|
-
onClick: () =>
|
|
334
|
-
className:
|
|
363
|
+
"data-membership-value": u.id,
|
|
364
|
+
onClick: () => p(u.id),
|
|
365
|
+
className: S(
|
|
335
366
|
"inline-flex h-6 items-center gap-1 rounded-full border px-2 text-[11px] transition-colors",
|
|
336
367
|
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"
|
|
337
368
|
),
|
|
338
369
|
children: [
|
|
339
|
-
k && /* @__PURE__ */ s(
|
|
340
|
-
|
|
370
|
+
k && /* @__PURE__ */ s(O, { className: "h-3 w-3" }),
|
|
371
|
+
u.label
|
|
341
372
|
]
|
|
342
373
|
},
|
|
343
|
-
|
|
374
|
+
u.id
|
|
344
375
|
);
|
|
345
376
|
})
|
|
346
377
|
] });
|
|
347
|
-
const w = i.trim() ?
|
|
348
|
-
return /* @__PURE__ */
|
|
349
|
-
/* @__PURE__ */ s(
|
|
378
|
+
const w = i.trim() ? a.filter((u) => he(u.label, i)) : a, q = y ? m : a.filter((u) => l.has(u.id)).map((u) => u.label).join(", ");
|
|
379
|
+
return /* @__PURE__ */ h(Re, { open: x, onOpenChange: f, children: [
|
|
380
|
+
/* @__PURE__ */ s(je, { asChild: !0, children: /* @__PURE__ */ h(
|
|
350
381
|
"button",
|
|
351
382
|
{
|
|
352
383
|
type: "button",
|
|
353
384
|
disabled: o,
|
|
354
385
|
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",
|
|
355
386
|
children: [
|
|
356
|
-
/* @__PURE__ */ s("span", { className:
|
|
357
|
-
/* @__PURE__ */ s(
|
|
387
|
+
/* @__PURE__ */ s("span", { className: S("truncate", y && "text-slate-500 dark:text-muted-foreground"), children: q }),
|
|
388
|
+
/* @__PURE__ */ s($e, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" })
|
|
358
389
|
]
|
|
359
390
|
}
|
|
360
391
|
) }),
|
|
361
|
-
/* @__PURE__ */
|
|
392
|
+
/* @__PURE__ */ h(Ae, { align: "start", className: "w-[260px] p-1", children: [
|
|
362
393
|
/* @__PURE__ */ s(
|
|
363
394
|
"input",
|
|
364
395
|
{
|
|
365
396
|
value: i,
|
|
366
|
-
onChange: (
|
|
367
|
-
placeholder: `Search ${
|
|
397
|
+
onChange: (u) => n(u.target.value),
|
|
398
|
+
placeholder: `Search ${d.toLowerCase()}…`,
|
|
368
399
|
className: "mb-1 h-7 w-full rounded border border-slate-200 bg-background px-2 text-[12px] outline-none dark:border-border"
|
|
369
400
|
}
|
|
370
401
|
),
|
|
371
|
-
/* @__PURE__ */
|
|
372
|
-
!i.trim() && /* @__PURE__ */ s("li", { className: "mb-1 border-b border-slate-100 pb-1 dark:border-border", children: /* @__PURE__ */
|
|
402
|
+
/* @__PURE__ */ h("ul", { className: "max-h-[240px] overflow-y-auto", children: [
|
|
403
|
+
!i.trim() && /* @__PURE__ */ s("li", { className: "mb-1 border-b border-slate-100 pb-1 dark:border-border", children: /* @__PURE__ */ h(
|
|
373
404
|
"button",
|
|
374
405
|
{
|
|
375
406
|
type: "button",
|
|
376
407
|
onClick: () => {
|
|
377
|
-
|
|
408
|
+
y || g();
|
|
378
409
|
},
|
|
379
|
-
"aria-pressed":
|
|
410
|
+
"aria-pressed": y,
|
|
380
411
|
"data-membership-clear": !0,
|
|
381
412
|
className: "flex w-full items-center gap-2 rounded px-2 py-1 text-left text-[12px] font-medium hover:bg-muted",
|
|
382
413
|
children: [
|
|
383
|
-
/* @__PURE__ */ s(
|
|
384
|
-
|
|
414
|
+
/* @__PURE__ */ s(O, { className: S("h-3.5 w-3.5", y ? "opacity-100" : "opacity-0") }),
|
|
415
|
+
m
|
|
385
416
|
]
|
|
386
417
|
}
|
|
387
418
|
) }),
|
|
388
|
-
w.map((
|
|
419
|
+
w.map((u) => /* @__PURE__ */ s("li", { children: /* @__PURE__ */ h(
|
|
389
420
|
"button",
|
|
390
421
|
{
|
|
391
422
|
type: "button",
|
|
392
|
-
onClick: () =>
|
|
423
|
+
onClick: () => p(u.id),
|
|
393
424
|
className: "flex w-full items-center gap-2 rounded px-2 py-1 text-left text-[12px] hover:bg-muted",
|
|
394
425
|
children: [
|
|
395
426
|
/* @__PURE__ */ s(
|
|
396
|
-
|
|
427
|
+
O,
|
|
397
428
|
{
|
|
398
|
-
className:
|
|
429
|
+
className: S("h-3.5 w-3.5", l.has(u.id) ? "opacity-100" : "opacity-0")
|
|
399
430
|
}
|
|
400
431
|
),
|
|
401
|
-
|
|
432
|
+
u.label
|
|
402
433
|
]
|
|
403
434
|
}
|
|
404
|
-
) },
|
|
435
|
+
) }, u.id))
|
|
405
436
|
] })
|
|
406
437
|
] })
|
|
407
438
|
] });
|
|
408
439
|
}
|
|
409
440
|
export {
|
|
410
|
-
|
|
411
|
-
|
|
441
|
+
tt as MembershipSetField,
|
|
442
|
+
Qe as planMembershipRows
|
|
412
443
|
};
|