@nivaro/react 0.3.65 → 0.3.66
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +13 -4
- package/dist/shared/components/CollectionBrowserView.js +2509 -2668
- package/dist/shared/components/ItemEditForm.js +3910 -3771
- package/dist/shared/components/MyWorkView.js +124 -113
- package/dist/shared/components/ProfileView.js +483 -472
- package/dist/shared/components/ReportView.js +1100 -1094
- package/dist/shared/components/bulk/BulkCompareButton.js +62 -0
- package/dist/shared/components/bulk/MessageStakeholders.js +235 -0
- package/dist/shared/components/item-edit/CatalogPickerField.js +240 -238
- package/dist/shared/components/item-edit/GroupSection.js +555 -538
- package/dist/shared/components/item-edit/M2MCombobox.js +414 -349
- package/dist/shared/components/item-edit/MidairCollisionDialog.js +211 -187
- package/dist/shared/components/item-edit/RelationCombobox.js +327 -311
- package/dist/shared/components/item-edit/SummaryPanel.js +146 -144
- package/dist/shared/components/item-edit/UserChip.js +264 -229
- package/dist/shared/components/item-edit/cascade-clear-notice.js +23 -19
- package/dist/shared/components/item-edit/header-path-preview.js +52 -0
- package/dist/shared/components/item-edit/line-merge.js +73 -47
- package/dist/shared/components/item-edit/picker-search.js +25 -21
- package/dist/shared/components/queue/QueueWorklist.js +799 -772
- package/dist/shared/lib/obligation-reason-text.js +1 -1
- package/dist/shared/lib/quick-filter-cascade.js +29 -19
- package/package.json +1 -1
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { jsxs as A, Fragment as g, jsx as u } from "react/jsx-runtime";
|
|
2
|
+
import { useQuery as d } from "@tanstack/react-query";
|
|
3
|
+
import { useState as q } from "react";
|
|
4
|
+
import { useNivaroClient as k } from "../../context.js";
|
|
5
|
+
import { get as m } from "../../lib/commands.js";
|
|
6
|
+
import { RecordCompareDialog as M } from "../RecordCompare.js";
|
|
7
|
+
const x = 2, F = 3;
|
|
8
|
+
function O(o) {
|
|
9
|
+
const r = [...new Set(o.map((n) => n.collection))];
|
|
10
|
+
return r.length !== 1 || o.length < x || o.length > F ? null : { collection: r[0], ids: o.map((n) => n.id) };
|
|
11
|
+
}
|
|
12
|
+
function K({
|
|
13
|
+
targets: o,
|
|
14
|
+
renderValue: r,
|
|
15
|
+
fields: n,
|
|
16
|
+
relations: a,
|
|
17
|
+
disabled: f,
|
|
18
|
+
className: p
|
|
19
|
+
}) {
|
|
20
|
+
const c = k(), [i, s] = q(!1), e = O(o), l = (e == null ? void 0 : e.collection) ?? "", y = d({
|
|
21
|
+
queryKey: ["bulk-fields-config", l],
|
|
22
|
+
queryFn: () => c.request(m(`/field-config/${l}`)).then((t) => Array.isArray(t.data) ? t.data : []),
|
|
23
|
+
enabled: i && !!e && !n,
|
|
24
|
+
staleTime: 6e4
|
|
25
|
+
}), C = d({
|
|
26
|
+
queryKey: ["bulk-fields-relations", l],
|
|
27
|
+
queryFn: () => c.request(m(`/data-model/relations/for/${l}`)).then((t) => Array.isArray(t.data) ? t.data : []),
|
|
28
|
+
enabled: i && !!e && !a,
|
|
29
|
+
staleTime: 6e4
|
|
30
|
+
});
|
|
31
|
+
if (!e) return null;
|
|
32
|
+
const b = a ?? C.data ?? [];
|
|
33
|
+
return /* @__PURE__ */ A(g, { children: [
|
|
34
|
+
/* @__PURE__ */ u(
|
|
35
|
+
"button",
|
|
36
|
+
{
|
|
37
|
+
type: "button",
|
|
38
|
+
disabled: f,
|
|
39
|
+
onClick: () => s(!0),
|
|
40
|
+
"data-bulk-compare": !0,
|
|
41
|
+
className: p,
|
|
42
|
+
children: "Compare"
|
|
43
|
+
}
|
|
44
|
+
),
|
|
45
|
+
i && /* @__PURE__ */ u(
|
|
46
|
+
M,
|
|
47
|
+
{
|
|
48
|
+
collection: e.collection,
|
|
49
|
+
ids: e.ids,
|
|
50
|
+
fields: n ?? y.data ?? [],
|
|
51
|
+
renderValue: (t, h) => r(b, t, h),
|
|
52
|
+
onClose: () => s(!1)
|
|
53
|
+
}
|
|
54
|
+
)
|
|
55
|
+
] });
|
|
56
|
+
}
|
|
57
|
+
export {
|
|
58
|
+
K as BulkCompareButton,
|
|
59
|
+
F as COMPARE_MAX,
|
|
60
|
+
x as COMPARE_MIN,
|
|
61
|
+
O as compareTargets
|
|
62
|
+
};
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import { jsx as r, jsxs as l } from "react/jsx-runtime";
|
|
2
|
+
import { useQuery as L } from "@tanstack/react-query";
|
|
3
|
+
import { useState as n } from "react";
|
|
4
|
+
import { toast as Q } from "sonner";
|
|
5
|
+
import { useNivaroClient as R } from "../../context.js";
|
|
6
|
+
import { post as $ } from "../../lib/commands.js";
|
|
7
|
+
import { userErrorMessage as X } from "../../lib/safe-error.js";
|
|
8
|
+
import { cn as a } from "../../lib/utils.js";
|
|
9
|
+
import { Popover as J, PopoverTrigger as U, PopoverContent as V } from "../ui/popover.js";
|
|
10
|
+
const w = 200;
|
|
11
|
+
function W({
|
|
12
|
+
collection: o,
|
|
13
|
+
selectedIds: p,
|
|
14
|
+
onDone: x,
|
|
15
|
+
onCancel: m,
|
|
16
|
+
layout: i = "inline"
|
|
17
|
+
}) {
|
|
18
|
+
var q;
|
|
19
|
+
const h = R(), [s, A] = n(""), [g, C] = n(""), [c, F] = n(!0), [d, P] = n(!0), [N, B] = n(!1), [M, D] = n(!1), [S, j] = n(!1), [E, O] = n(null), v = p.slice(0, w), K = p.length > w, { data: u } = L({
|
|
20
|
+
queryKey: ["cbv-msg-preview", o, v.join(","), c, d],
|
|
21
|
+
queryFn: () => h.request(
|
|
22
|
+
$("/notifications/message-stakeholders", {
|
|
23
|
+
collection: o,
|
|
24
|
+
ids: v,
|
|
25
|
+
include: { owners: c, creators: d },
|
|
26
|
+
preview: !0
|
|
27
|
+
})
|
|
28
|
+
),
|
|
29
|
+
enabled: c || d
|
|
30
|
+
}), f = c || d ? (u == null ? void 0 : u.count) ?? null : 0, T = async () => {
|
|
31
|
+
if (!(!s.trim() || !g.trim())) {
|
|
32
|
+
j(!0), O(null);
|
|
33
|
+
try {
|
|
34
|
+
const e = await h.request(
|
|
35
|
+
$("/notifications/message-stakeholders", {
|
|
36
|
+
collection: o,
|
|
37
|
+
ids: v,
|
|
38
|
+
subject: M ? `Critical: ${s.trim()}` : s.trim(),
|
|
39
|
+
message: g.trim(),
|
|
40
|
+
include: { owners: c, creators: d },
|
|
41
|
+
email: N
|
|
42
|
+
})
|
|
43
|
+
);
|
|
44
|
+
x(`Messaged ${e.sent} stakeholder(s) across ${e.records} record(s)`);
|
|
45
|
+
} catch (e) {
|
|
46
|
+
O(X(e, "Failed to send")), j(!1);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}, t = i === "stacked", _ = t ? "flex cursor-pointer items-center gap-1.5 text-[12px] text-foreground" : "flex cursor-pointer items-center gap-1 text-[12px] text-slate-300 dark:text-muted-foreground", y = t ? "h-8 w-full rounded-md border border-input bg-background px-2 text-[12.5px] text-foreground placeholder:text-muted-foreground focus-visible:border-nvr-cyan focus-visible:outline-none" : "h-8 rounded-md border border-white/20 dark:border-border bg-white/10 dark:bg-background px-2 text-[12.5px] text-white dark:text-foreground placeholder:text-slate-400 dark:placeholder:text-muted-foreground", b = (e, z, G, k = {}) => /* @__PURE__ */ l("label", { className: _, ..."tip" in k ? { "data-tip": k.tip } : {}, children: [
|
|
50
|
+
/* @__PURE__ */ r(
|
|
51
|
+
"input",
|
|
52
|
+
{
|
|
53
|
+
type: "checkbox",
|
|
54
|
+
checked: e,
|
|
55
|
+
onChange: (H) => z(H.target.checked),
|
|
56
|
+
className: "h-3.5 w-3.5",
|
|
57
|
+
..."data" in k ? { [k.data]: "" } : {}
|
|
58
|
+
}
|
|
59
|
+
),
|
|
60
|
+
G
|
|
61
|
+
] });
|
|
62
|
+
return /* @__PURE__ */ l(
|
|
63
|
+
"form",
|
|
64
|
+
{
|
|
65
|
+
className: a(t ? "flex flex-col gap-2" : "flex flex-wrap items-center gap-1.5"),
|
|
66
|
+
"data-message-stakeholders": i,
|
|
67
|
+
onSubmit: (e) => {
|
|
68
|
+
e.preventDefault(), T();
|
|
69
|
+
},
|
|
70
|
+
children: [
|
|
71
|
+
/* @__PURE__ */ l("div", { className: a("flex flex-wrap items-center", t ? "gap-x-3 gap-y-1" : "gap-1.5"), children: [
|
|
72
|
+
b(c, F, "Owners"),
|
|
73
|
+
b(d, P, "Creators"),
|
|
74
|
+
b(N, B, "Also email"),
|
|
75
|
+
b(M, D, "Critical", {
|
|
76
|
+
tip: "Marks the message critical: it lands in the Critical lane, gets past mutes and quiet hours, and you can see who has read it under Notifications → Sent.",
|
|
77
|
+
data: "data-msg-critical"
|
|
78
|
+
}),
|
|
79
|
+
/* @__PURE__ */ r(
|
|
80
|
+
"span",
|
|
81
|
+
{
|
|
82
|
+
className: a("text-[11.5px]", t ? "text-muted-foreground" : "text-nvr-cyan"),
|
|
83
|
+
"data-tip": (q = u == null ? void 0 : u.users) == null ? void 0 : q.map((e) => e.name).join(", "),
|
|
84
|
+
children: f == null ? "…" : `${f} recipient${f === 1 ? "" : "s"}`
|
|
85
|
+
}
|
|
86
|
+
)
|
|
87
|
+
] }),
|
|
88
|
+
K && /* @__PURE__ */ l(
|
|
89
|
+
"p",
|
|
90
|
+
{
|
|
91
|
+
className: a(
|
|
92
|
+
"text-[11px]",
|
|
93
|
+
t ? "text-amber-700 dark:text-amber-300" : "text-amber-200"
|
|
94
|
+
),
|
|
95
|
+
children: [
|
|
96
|
+
"Messages the people on the first ",
|
|
97
|
+
w,
|
|
98
|
+
" of ",
|
|
99
|
+
p.length,
|
|
100
|
+
" ",
|
|
101
|
+
"records."
|
|
102
|
+
]
|
|
103
|
+
}
|
|
104
|
+
),
|
|
105
|
+
/* @__PURE__ */ r(
|
|
106
|
+
"input",
|
|
107
|
+
{
|
|
108
|
+
autoFocus: !0,
|
|
109
|
+
value: s,
|
|
110
|
+
onChange: (e) => A(e.target.value),
|
|
111
|
+
placeholder: "Subject",
|
|
112
|
+
"aria-label": "Subject",
|
|
113
|
+
className: a(y, !t && "w-44")
|
|
114
|
+
}
|
|
115
|
+
),
|
|
116
|
+
t ? /* @__PURE__ */ r(
|
|
117
|
+
"textarea",
|
|
118
|
+
{
|
|
119
|
+
value: g,
|
|
120
|
+
onChange: (e) => C(e.target.value),
|
|
121
|
+
placeholder: "Message",
|
|
122
|
+
"aria-label": "Message",
|
|
123
|
+
rows: 3,
|
|
124
|
+
className: a(y, "h-auto resize-none py-1.5")
|
|
125
|
+
}
|
|
126
|
+
) : /* @__PURE__ */ r(
|
|
127
|
+
"input",
|
|
128
|
+
{
|
|
129
|
+
value: g,
|
|
130
|
+
onChange: (e) => C(e.target.value),
|
|
131
|
+
placeholder: "Message",
|
|
132
|
+
"aria-label": "Message",
|
|
133
|
+
className: a(y, "w-64")
|
|
134
|
+
}
|
|
135
|
+
),
|
|
136
|
+
E && /* @__PURE__ */ r("span", { className: a("text-[11.5px]", t ? "text-destructive" : "text-red-300"), children: E }),
|
|
137
|
+
/* @__PURE__ */ l("div", { className: a("flex items-center gap-1.5", t && "justify-end"), children: [
|
|
138
|
+
t && /* @__PURE__ */ r(
|
|
139
|
+
"button",
|
|
140
|
+
{
|
|
141
|
+
type: "button",
|
|
142
|
+
onClick: m,
|
|
143
|
+
className: "h-8 rounded-md px-2.5 text-[12.5px] text-muted-foreground hover:bg-muted hover:text-foreground",
|
|
144
|
+
children: "Cancel"
|
|
145
|
+
}
|
|
146
|
+
),
|
|
147
|
+
/* @__PURE__ */ r(
|
|
148
|
+
"button",
|
|
149
|
+
{
|
|
150
|
+
type: "submit",
|
|
151
|
+
disabled: S || !s.trim() || !g.trim() || f === 0,
|
|
152
|
+
className: a(
|
|
153
|
+
"h-8 rounded-md bg-nvr-cyan px-3 text-[12.5px] font-semibold disabled:opacity-50",
|
|
154
|
+
t ? "text-white" : "text-[#0f1e2d]"
|
|
155
|
+
),
|
|
156
|
+
children: S ? "Sending…" : "Send"
|
|
157
|
+
}
|
|
158
|
+
),
|
|
159
|
+
!t && /* @__PURE__ */ r(
|
|
160
|
+
"button",
|
|
161
|
+
{
|
|
162
|
+
type: "button",
|
|
163
|
+
onClick: m,
|
|
164
|
+
className: "h-8 px-2 text-[12.5px] text-slate-300 dark:text-muted-foreground hover:text-white dark:hover:text-foreground",
|
|
165
|
+
children: "Cancel"
|
|
166
|
+
}
|
|
167
|
+
)
|
|
168
|
+
] })
|
|
169
|
+
]
|
|
170
|
+
}
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
function ne({
|
|
174
|
+
targets: o,
|
|
175
|
+
disabled: p,
|
|
176
|
+
className: x
|
|
177
|
+
}) {
|
|
178
|
+
const [m, i] = n(!1), h = [...new Set(o.map((s) => s.collection))];
|
|
179
|
+
return o.length === 0 ? null : h.length !== 1 ? /* @__PURE__ */ r(
|
|
180
|
+
"button",
|
|
181
|
+
{
|
|
182
|
+
type: "button",
|
|
183
|
+
disabled: !0,
|
|
184
|
+
"data-tip": "Pick records of one kind to message their people together",
|
|
185
|
+
className: x,
|
|
186
|
+
children: "Message…"
|
|
187
|
+
}
|
|
188
|
+
) : /* @__PURE__ */ l(J, { open: m, onOpenChange: i, children: [
|
|
189
|
+
/* @__PURE__ */ r(U, { asChild: !0, children: /* @__PURE__ */ r(
|
|
190
|
+
"button",
|
|
191
|
+
{
|
|
192
|
+
type: "button",
|
|
193
|
+
disabled: p,
|
|
194
|
+
className: x,
|
|
195
|
+
"data-bulk-message": !0,
|
|
196
|
+
"aria-haspopup": "dialog",
|
|
197
|
+
children: "Message…"
|
|
198
|
+
}
|
|
199
|
+
) }),
|
|
200
|
+
/* @__PURE__ */ l(
|
|
201
|
+
V,
|
|
202
|
+
{
|
|
203
|
+
side: "top",
|
|
204
|
+
align: "center",
|
|
205
|
+
sideOffset: 8,
|
|
206
|
+
className: "w-[360px] max-w-[calc(100vw-24px)] p-3",
|
|
207
|
+
children: [
|
|
208
|
+
/* @__PURE__ */ l("p", { className: "mb-2 text-[13px] font-semibold text-foreground", children: [
|
|
209
|
+
"Message the people on ",
|
|
210
|
+
o.length,
|
|
211
|
+
" record",
|
|
212
|
+
o.length === 1 ? "" : "s"
|
|
213
|
+
] }),
|
|
214
|
+
m && /* @__PURE__ */ r(
|
|
215
|
+
W,
|
|
216
|
+
{
|
|
217
|
+
collection: h[0],
|
|
218
|
+
selectedIds: o.map((s) => s.id),
|
|
219
|
+
layout: "stacked",
|
|
220
|
+
onCancel: () => i(!1),
|
|
221
|
+
onDone: (s) => {
|
|
222
|
+
i(!1), Q.success(s);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
)
|
|
226
|
+
]
|
|
227
|
+
}
|
|
228
|
+
)
|
|
229
|
+
] });
|
|
230
|
+
}
|
|
231
|
+
export {
|
|
232
|
+
ne as BulkMessageButton,
|
|
233
|
+
w as MESSAGE_STAKEHOLDERS_MAX,
|
|
234
|
+
W as MessageStakeholdersForm
|
|
235
|
+
};
|