@nivaro/react 0.3.47 → 0.3.49
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/shared/components/CellCopyLayer.js +81 -44
- package/dist/shared/components/CollectionBrowserView.js +306 -297
- package/dist/shared/components/DataTable.js +3 -3
- package/dist/shared/components/FulfilmentPill.js +98 -78
- package/dist/shared/components/ItemEditForm.js +2830 -2815
- package/dist/shared/components/NotificationSourcesCard.js +151 -147
- package/dist/shared/components/ProfileView.js +72 -70
- package/dist/shared/components/QueryTable.js +3 -3
- package/dist/shared/components/imports/ImportConsole.js +4 -4
- package/dist/shared/components/integrations/console/IntegrationsConsole.js +58 -50
- package/dist/shared/components/item-edit/HeaderTools.js +118 -113
- package/dist/shared/components/item-edit/InlineTableField.js +874 -868
- package/dist/shared/components/layout-editor/settings/ResolveSettings.js +65 -65
- package/dist/shared/components/layout-editor/settings/settings-registry.js +4 -4
- package/dist/shared/components/notifications/DeliveryChips.js +9 -9
- package/dist/shared/components/panels/PipelinePanel.js +73 -71
- package/dist/shared/components/panels/SlaBreachBanner.js +2 -2
- package/dist/shared/components/panels/TransitionRequirementsDialog.js +384 -380
- package/dist/shared/components/profile/PersonProfile.js +23 -21
- package/dist/shared/components/profile/SignedInDevices.js +126 -0
- package/dist/shared/components/queue/QueueItemSheet.js +38 -37
- package/dist/shared/components/support/SupportView.js +1 -1
- package/dist/shared/lib/edit-lock-fields.js +7 -0
- package/dist/shared/lib/reimport-visibility.js +10 -0
- package/package.json +1 -1
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useQueryClient as
|
|
3
|
-
import { AlertCircle as z, CopyPlus as
|
|
4
|
-
import { useState as
|
|
5
|
-
import { createPortal as
|
|
1
|
+
import { jsx as l, jsxs as h, Fragment as ye } from "react/jsx-runtime";
|
|
2
|
+
import { useQueryClient as ke, useQuery as ce } from "@tanstack/react-query";
|
|
3
|
+
import { AlertCircle as z, CopyPlus as we, Loader2 as H, ChevronDown as de, Check as ue, Paperclip as ee, X as ve } from "lucide-react";
|
|
4
|
+
import { useState as R, useRef as F, Fragment as Ne, useEffect as me, useLayoutEffect as _e } from "react";
|
|
5
|
+
import { createPortal as Se } from "react-dom";
|
|
6
6
|
import { useNivaroClient as I } from "../../context.js";
|
|
7
|
-
import { get as
|
|
8
|
-
import { cn as
|
|
9
|
-
import { Button as
|
|
10
|
-
import { Dialog as
|
|
11
|
-
import { Input as
|
|
12
|
-
|
|
7
|
+
import { get as T, patch as te, del as ne, post as re } from "../../lib/commands.js";
|
|
8
|
+
import { cn as O } from "../../lib/utils.js";
|
|
9
|
+
import { Button as W } from "../ui/button.js";
|
|
10
|
+
import { Dialog as Ae, DialogContent as Ce, DialogHeader as je, DialogTitle as $e, DialogBody as qe, DialogFooter as Ee } from "../ui/dialog.js";
|
|
11
|
+
import { Input as U } from "../ui/input.js";
|
|
12
|
+
const Le = "x-nivaro-requirements-for";
|
|
13
|
+
function D(i, u) {
|
|
13
14
|
return `${i}::${String(u)}`;
|
|
14
15
|
}
|
|
15
|
-
const
|
|
16
|
+
const Re = [
|
|
16
17
|
"integer",
|
|
17
18
|
"bigInteger",
|
|
18
19
|
"float",
|
|
@@ -28,447 +29,450 @@ const qe = [
|
|
|
28
29
|
"double",
|
|
29
30
|
"number"
|
|
30
31
|
];
|
|
31
|
-
function
|
|
32
|
-
if (u &&
|
|
33
|
-
const
|
|
34
|
-
if (!Number.isNaN(
|
|
32
|
+
function le(i, u) {
|
|
33
|
+
if (u && Re.includes(u)) {
|
|
34
|
+
const b = Number(i.trim());
|
|
35
|
+
if (!Number.isNaN(b)) return b;
|
|
35
36
|
}
|
|
36
37
|
return i;
|
|
37
38
|
}
|
|
38
|
-
function
|
|
39
|
+
function J(i) {
|
|
39
40
|
return i == null ? "" : String(i);
|
|
40
41
|
}
|
|
41
|
-
function
|
|
42
|
-
const
|
|
43
|
-
if (!u ||
|
|
44
|
-
const
|
|
45
|
-
return Number.isNaN(
|
|
42
|
+
function ie(i, u) {
|
|
43
|
+
const b = J(i);
|
|
44
|
+
if (!u || b === "") return b;
|
|
45
|
+
const _ = Number(b);
|
|
46
|
+
return Number.isNaN(_) ? b : u === "currency" ? _.toLocaleString("en-US", { style: "currency", currency: "USD" }) : _.toLocaleString("en-US");
|
|
46
47
|
}
|
|
47
|
-
const
|
|
48
|
-
function
|
|
49
|
-
return
|
|
48
|
+
const X = (i) => i.kind === "m2m" || i.kind === "files";
|
|
49
|
+
function M(i) {
|
|
50
|
+
return D(i.collection, `record:${i.item}`);
|
|
50
51
|
}
|
|
51
|
-
function
|
|
52
|
-
var
|
|
53
|
-
const
|
|
54
|
-
for (const
|
|
55
|
-
if (
|
|
56
|
-
const
|
|
57
|
-
for (const
|
|
58
|
-
const
|
|
59
|
-
f
|
|
52
|
+
function se(i, u = !1) {
|
|
53
|
+
var _;
|
|
54
|
+
const b = {};
|
|
55
|
+
for (const m of i) {
|
|
56
|
+
if (m.type === "record_fields") {
|
|
57
|
+
const v = {};
|
|
58
|
+
for (const f of m.fields) {
|
|
59
|
+
const p = m.values[f.field];
|
|
60
|
+
v[f.field] = X(f) ? Array.isArray(p) ? p.map(String) : [] : J(p);
|
|
60
61
|
}
|
|
61
|
-
|
|
62
|
+
b[M(m)] = v;
|
|
62
63
|
continue;
|
|
63
64
|
}
|
|
64
|
-
for (const
|
|
65
|
-
const
|
|
66
|
-
for (const
|
|
67
|
-
let
|
|
68
|
-
if (u && ((
|
|
69
|
-
const
|
|
70
|
-
|
|
65
|
+
for (const v of m.rows) {
|
|
66
|
+
const f = {};
|
|
67
|
+
for (const p of m.fields) {
|
|
68
|
+
let d = p.kind === "m2m" ? Array.isArray(v.values[p.field]) ? v.values[p.field].map(String) : [] : J(v.values[p.field]);
|
|
69
|
+
if (u && ((_ = m.prefill_values) == null ? void 0 : _[p.field]) != null) {
|
|
70
|
+
const q = m.prefill_values[p.field];
|
|
71
|
+
p.kind === "m2m" && Array.isArray(d) && d.length === 0 ? d = [String(q)] : p.kind !== "m2m" && d === "" && (d = String(q));
|
|
71
72
|
}
|
|
72
|
-
|
|
73
|
+
f[p.field] = d;
|
|
73
74
|
}
|
|
74
|
-
|
|
75
|
+
b[D(m.collection, v.id)] = f;
|
|
75
76
|
}
|
|
76
77
|
}
|
|
77
|
-
return
|
|
78
|
+
return b;
|
|
78
79
|
}
|
|
79
|
-
function
|
|
80
|
+
function De(i) {
|
|
80
81
|
if (Array.isArray(i)) {
|
|
81
82
|
const u = {};
|
|
82
|
-
for (const
|
|
83
|
-
(
|
|
83
|
+
for (const b of i)
|
|
84
|
+
(b == null ? void 0 : b.id) != null && (u[String(b.id)] = String(b.name ?? b.id));
|
|
84
85
|
return u;
|
|
85
86
|
}
|
|
86
87
|
return typeof i == "string" ? { __single__: i } : {};
|
|
87
88
|
}
|
|
88
|
-
function
|
|
89
|
+
function Oe({
|
|
89
90
|
multiple: i,
|
|
90
91
|
ids: u,
|
|
91
|
-
initialNames:
|
|
92
|
-
onChange:
|
|
92
|
+
initialNames: b,
|
|
93
|
+
onChange: _
|
|
93
94
|
}) {
|
|
94
|
-
const
|
|
95
|
-
async function
|
|
96
|
-
if (!(
|
|
97
|
-
|
|
95
|
+
const m = I(), v = F(null), [f, p] = R({}), [d, q] = R(!1), [w, c] = R(null), x = (y) => f[y] ?? b[y] ?? (i ? void 0 : b.__single__) ?? y;
|
|
96
|
+
async function C(y) {
|
|
97
|
+
if (!(y != null && y.length)) return;
|
|
98
|
+
q(!0), c(null);
|
|
98
99
|
const E = [];
|
|
99
100
|
try {
|
|
100
|
-
for (const
|
|
101
|
-
const
|
|
102
|
-
E.push(
|
|
101
|
+
for (const P of Array.from(y).slice(0, i ? 20 : 1)) {
|
|
102
|
+
const V = await m.upload(P), L = String(V.id);
|
|
103
|
+
E.push(L), p((B) => ({ ...B, [L]: P.name }));
|
|
103
104
|
}
|
|
104
105
|
} catch {
|
|
105
|
-
|
|
106
|
+
c("A file could not be uploaded");
|
|
106
107
|
} finally {
|
|
107
|
-
|
|
108
|
+
q(!1), v.current && (v.current.value = "");
|
|
108
109
|
}
|
|
109
|
-
E.length &&
|
|
110
|
+
E.length && _(i ? [...u, ...E] : E.slice(0, 1));
|
|
110
111
|
}
|
|
111
|
-
return /* @__PURE__ */
|
|
112
|
-
u.length > 0 && /* @__PURE__ */
|
|
112
|
+
return /* @__PURE__ */ h("div", { className: "space-y-1.5", "data-requirement-file": i ? "files" : "file", children: [
|
|
113
|
+
u.length > 0 && /* @__PURE__ */ l("ul", { className: "space-y-1", children: u.map((y) => /* @__PURE__ */ h(
|
|
113
114
|
"li",
|
|
114
115
|
{
|
|
115
116
|
className: "flex items-center gap-1.5 rounded border border-slate-200 px-2 py-1 text-[12px] text-slate-700 dark:border-border dark:text-slate-200",
|
|
116
117
|
children: [
|
|
117
|
-
/* @__PURE__ */
|
|
118
|
-
/* @__PURE__ */
|
|
119
|
-
/* @__PURE__ */
|
|
118
|
+
/* @__PURE__ */ l(ee, { className: "h-3 w-3 shrink-0 text-slate-400" }),
|
|
119
|
+
/* @__PURE__ */ l("span", { className: "min-w-0 flex-1 truncate", children: x(y) }),
|
|
120
|
+
/* @__PURE__ */ l(
|
|
120
121
|
"button",
|
|
121
122
|
{
|
|
122
123
|
type: "button",
|
|
123
|
-
"aria-label": `Remove ${
|
|
124
|
-
onClick: () =>
|
|
124
|
+
"aria-label": `Remove ${x(y)}`,
|
|
125
|
+
onClick: () => _(u.filter((E) => E !== y)),
|
|
125
126
|
className: "rounded p-0.5 text-slate-400 hover:bg-slate-100 hover:text-slate-700 dark:hover:bg-muted",
|
|
126
|
-
children: /* @__PURE__ */
|
|
127
|
+
children: /* @__PURE__ */ l(ve, { className: "h-3 w-3" })
|
|
127
128
|
}
|
|
128
129
|
)
|
|
129
130
|
]
|
|
130
131
|
},
|
|
131
|
-
|
|
132
|
+
y
|
|
132
133
|
)) }),
|
|
133
|
-
(i || u.length === 0) && /* @__PURE__ */
|
|
134
|
-
/* @__PURE__ */
|
|
134
|
+
(i || u.length === 0) && /* @__PURE__ */ h(ye, { children: [
|
|
135
|
+
/* @__PURE__ */ l(
|
|
135
136
|
"input",
|
|
136
137
|
{
|
|
137
|
-
ref:
|
|
138
|
+
ref: v,
|
|
138
139
|
type: "file",
|
|
139
140
|
multiple: i,
|
|
140
141
|
className: "hidden",
|
|
141
|
-
onChange: (
|
|
142
|
+
onChange: (y) => void C(y.target.files)
|
|
142
143
|
}
|
|
143
144
|
),
|
|
144
|
-
/* @__PURE__ */
|
|
145
|
-
|
|
145
|
+
/* @__PURE__ */ h(
|
|
146
|
+
W,
|
|
146
147
|
{
|
|
147
148
|
type: "button",
|
|
148
149
|
variant: "outline",
|
|
149
150
|
size: "sm",
|
|
150
|
-
disabled:
|
|
151
|
+
disabled: d,
|
|
151
152
|
onClick: () => {
|
|
152
|
-
var
|
|
153
|
-
return (
|
|
153
|
+
var y;
|
|
154
|
+
return (y = v.current) == null ? void 0 : y.click();
|
|
154
155
|
},
|
|
155
156
|
className: "h-8 gap-1.5 text-[12px]",
|
|
156
157
|
"data-requirement-upload": !0,
|
|
157
158
|
children: [
|
|
158
|
-
|
|
159
|
-
|
|
159
|
+
d ? /* @__PURE__ */ l(H, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ l(ee, { className: "h-3.5 w-3.5" }),
|
|
160
|
+
d ? "Uploading…" : i ? "Add files" : "Upload a file"
|
|
160
161
|
]
|
|
161
162
|
}
|
|
162
163
|
)
|
|
163
164
|
] }),
|
|
164
|
-
|
|
165
|
+
w && /* @__PURE__ */ l("p", { className: "text-[11px] text-red-600", children: w })
|
|
165
166
|
] });
|
|
166
167
|
}
|
|
167
|
-
function
|
|
168
|
+
function fe({
|
|
168
169
|
anchor: i,
|
|
169
170
|
panelRef: u,
|
|
170
|
-
children:
|
|
171
|
+
children: b
|
|
171
172
|
}) {
|
|
172
|
-
const
|
|
173
|
-
return
|
|
174
|
-
if (!
|
|
175
|
-
const
|
|
176
|
-
const
|
|
177
|
-
|
|
178
|
-
|
|
173
|
+
const _ = i.closest('[role="dialog"]'), [m, v] = R(null);
|
|
174
|
+
return _e(() => {
|
|
175
|
+
if (!_) return;
|
|
176
|
+
const f = () => {
|
|
177
|
+
const p = i.getBoundingClientRect(), d = _.getBoundingClientRect(), q = p.bottom + 208 > window.innerHeight && p.top > 216;
|
|
178
|
+
v(
|
|
179
|
+
q ? { bottom: d.bottom - p.top + 4, left: p.left - d.left, width: p.width } : { top: p.bottom - d.top + 4, left: p.left - d.left, width: p.width }
|
|
179
180
|
);
|
|
180
181
|
};
|
|
181
|
-
return
|
|
182
|
-
window.removeEventListener("scroll",
|
|
182
|
+
return f(), window.addEventListener("scroll", f, !0), window.addEventListener("resize", f), () => {
|
|
183
|
+
window.removeEventListener("scroll", f, !0), window.removeEventListener("resize", f);
|
|
183
184
|
};
|
|
184
|
-
}, [i,
|
|
185
|
-
/* @__PURE__ */
|
|
185
|
+
}, [i, _]), !m || !_ ? null : Se(
|
|
186
|
+
/* @__PURE__ */ l(
|
|
186
187
|
"div",
|
|
187
188
|
{
|
|
188
189
|
ref: u,
|
|
189
190
|
role: "listbox",
|
|
190
191
|
className: "absolute z-[120] max-h-48 w-56 overflow-y-auto rounded-md border border-slate-200 bg-white py-1 shadow-lg dark:border-border dark:bg-card",
|
|
191
|
-
style: { top:
|
|
192
|
-
children:
|
|
192
|
+
style: { top: m.top, bottom: m.bottom, left: m.left, minWidth: m.width },
|
|
193
|
+
children: b
|
|
193
194
|
}
|
|
194
195
|
),
|
|
195
|
-
|
|
196
|
+
_
|
|
196
197
|
);
|
|
197
198
|
}
|
|
198
|
-
function
|
|
199
|
+
function ae({
|
|
199
200
|
meta: i,
|
|
200
201
|
selected: u,
|
|
201
|
-
onChange:
|
|
202
|
+
onChange: b
|
|
202
203
|
}) {
|
|
203
|
-
const
|
|
204
|
+
const _ = I(), [m, v] = R(!1), f = F(null), p = F(null), { data: d = [] } = ce({
|
|
204
205
|
queryKey: ["req-m2m-options", i.related_collection],
|
|
205
|
-
queryFn: () =>
|
|
206
|
-
|
|
206
|
+
queryFn: () => _.request(
|
|
207
|
+
T(`/items/${i.related_collection}`, { limit: 500 })
|
|
207
208
|
).then(
|
|
208
|
-
(
|
|
209
|
-
id: String(
|
|
210
|
-
label: String(
|
|
209
|
+
(w) => (w.data ?? []).map((c) => ({
|
|
210
|
+
id: String(c.id),
|
|
211
|
+
label: String(c.name ?? c.title ?? c.label ?? c.short_name ?? c.id)
|
|
211
212
|
}))
|
|
212
213
|
).catch(() => []),
|
|
213
214
|
enabled: !!i.related_collection,
|
|
214
215
|
staleTime: 3e5
|
|
215
216
|
});
|
|
216
|
-
|
|
217
|
-
if (!
|
|
218
|
-
const
|
|
219
|
-
var
|
|
220
|
-
const
|
|
221
|
-
(
|
|
217
|
+
me(() => {
|
|
218
|
+
if (!m) return;
|
|
219
|
+
const w = (c) => {
|
|
220
|
+
var C, y;
|
|
221
|
+
const x = c.target;
|
|
222
|
+
(C = f.current) != null && C.contains(x) || (y = p.current) != null && y.contains(x) || v(!1);
|
|
222
223
|
};
|
|
223
|
-
return window.addEventListener("mousedown",
|
|
224
|
-
}, [
|
|
225
|
-
const
|
|
226
|
-
var
|
|
227
|
-
return ((
|
|
224
|
+
return window.addEventListener("mousedown", w), () => window.removeEventListener("mousedown", w);
|
|
225
|
+
}, [m]);
|
|
226
|
+
const q = u.length === 0 ? `Select ${i.label.toLowerCase()}…` : u.map((w) => {
|
|
227
|
+
var c;
|
|
228
|
+
return ((c = d.find((x) => x.id === w)) == null ? void 0 : c.label) ?? w;
|
|
228
229
|
}).join(", ");
|
|
229
|
-
return /* @__PURE__ */
|
|
230
|
-
/* @__PURE__ */
|
|
230
|
+
return /* @__PURE__ */ h("div", { ref: f, className: "relative", children: [
|
|
231
|
+
/* @__PURE__ */ h(
|
|
231
232
|
"button",
|
|
232
233
|
{
|
|
233
234
|
type: "button",
|
|
234
|
-
onClick: () =>
|
|
235
|
+
onClick: () => v((w) => !w),
|
|
235
236
|
"aria-haspopup": "listbox",
|
|
236
|
-
"aria-expanded":
|
|
237
|
-
className:
|
|
237
|
+
"aria-expanded": m,
|
|
238
|
+
className: O(
|
|
238
239
|
"flex h-8 w-full min-w-[10rem] items-center justify-between gap-1 rounded-md border border-slate-200 bg-white px-2 text-left text-[12px] dark:border-border dark:bg-card",
|
|
239
240
|
u.length === 0 && "text-slate-400"
|
|
240
241
|
),
|
|
241
242
|
children: [
|
|
242
|
-
/* @__PURE__ */
|
|
243
|
-
/* @__PURE__ */
|
|
243
|
+
/* @__PURE__ */ l("span", { className: "truncate", children: q }),
|
|
244
|
+
/* @__PURE__ */ l(de, { className: "h-3 w-3 shrink-0 text-slate-400" })
|
|
244
245
|
]
|
|
245
246
|
}
|
|
246
247
|
),
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
const
|
|
250
|
-
return /* @__PURE__ */
|
|
248
|
+
m && f.current && /* @__PURE__ */ h(fe, { anchor: f.current, panelRef: p, children: [
|
|
249
|
+
d.map((w) => {
|
|
250
|
+
const c = u.includes(w.id), x = i.max_values === 1;
|
|
251
|
+
return /* @__PURE__ */ h(
|
|
251
252
|
"button",
|
|
252
253
|
{
|
|
253
254
|
type: "button",
|
|
254
255
|
role: "option",
|
|
255
|
-
"aria-selected":
|
|
256
|
+
"aria-selected": c,
|
|
256
257
|
onClick: () => {
|
|
257
|
-
if (
|
|
258
|
-
|
|
258
|
+
if (x) {
|
|
259
|
+
b([w.id]), v(!1);
|
|
259
260
|
return;
|
|
260
261
|
}
|
|
261
|
-
|
|
262
|
+
b(c ? u.filter((C) => C !== w.id) : [...u, w.id]);
|
|
262
263
|
},
|
|
263
|
-
className:
|
|
264
|
+
className: O(
|
|
264
265
|
"flex w-full items-center justify-between px-2.5 py-1.5 text-left text-[12px] hover:bg-slate-50 dark:hover:bg-muted/50",
|
|
265
|
-
|
|
266
|
+
c ? "font-semibold text-nvr-navy dark:text-nvr-cyan" : "text-slate-700 dark:text-slate-200"
|
|
266
267
|
),
|
|
267
268
|
children: [
|
|
268
|
-
/* @__PURE__ */
|
|
269
|
-
|
|
269
|
+
/* @__PURE__ */ l("span", { className: "truncate", children: w.label }),
|
|
270
|
+
c && /* @__PURE__ */ l(ue, { className: "h-3 w-3 shrink-0" })
|
|
270
271
|
]
|
|
271
272
|
},
|
|
272
|
-
|
|
273
|
+
w.id
|
|
273
274
|
);
|
|
274
275
|
}),
|
|
275
|
-
|
|
276
|
+
d.length === 0 && /* @__PURE__ */ l("p", { className: "px-2.5 py-2 text-[11px] text-slate-400", children: "No options" })
|
|
276
277
|
] })
|
|
277
278
|
] });
|
|
278
279
|
}
|
|
279
|
-
function
|
|
280
|
+
function oe({
|
|
280
281
|
meta: i,
|
|
281
282
|
selected: u,
|
|
282
|
-
onChange:
|
|
283
|
+
onChange: b
|
|
283
284
|
}) {
|
|
284
|
-
var
|
|
285
|
-
const
|
|
285
|
+
var w;
|
|
286
|
+
const _ = I(), [m, v] = R(!1), f = F(null), p = F(null), { data: d = [] } = ce({
|
|
286
287
|
queryKey: ["req-m2m-options", i.related_collection],
|
|
287
|
-
queryFn: () =>
|
|
288
|
-
|
|
288
|
+
queryFn: () => _.request(
|
|
289
|
+
T(`/items/${i.related_collection}`, { limit: 500 })
|
|
289
290
|
).then(
|
|
290
|
-
(
|
|
291
|
-
id: String(
|
|
292
|
-
label: String(
|
|
291
|
+
(c) => (c.data ?? []).map((x) => ({
|
|
292
|
+
id: String(x.id),
|
|
293
|
+
label: String(x.name ?? x.title ?? x.label ?? x.short_name ?? x.id)
|
|
293
294
|
}))
|
|
294
295
|
).catch(() => []),
|
|
295
296
|
enabled: !!i.related_collection,
|
|
296
297
|
staleTime: 3e5
|
|
297
298
|
});
|
|
298
|
-
|
|
299
|
-
if (!
|
|
300
|
-
const
|
|
301
|
-
var
|
|
302
|
-
const
|
|
303
|
-
(
|
|
299
|
+
me(() => {
|
|
300
|
+
if (!m) return;
|
|
301
|
+
const c = (x) => {
|
|
302
|
+
var y, E;
|
|
303
|
+
const C = x.target;
|
|
304
|
+
(y = f.current) != null && y.contains(C) || (E = p.current) != null && E.contains(C) || v(!1);
|
|
304
305
|
};
|
|
305
|
-
return window.addEventListener("mousedown",
|
|
306
|
-
}, [
|
|
307
|
-
const
|
|
308
|
-
return /* @__PURE__ */
|
|
309
|
-
/* @__PURE__ */
|
|
306
|
+
return window.addEventListener("mousedown", c), () => window.removeEventListener("mousedown", c);
|
|
307
|
+
}, [m]);
|
|
308
|
+
const q = u ? ((w = d.find((c) => c.id === u)) == null ? void 0 : w.label) ?? u : `Select ${i.label.toLowerCase()}…`;
|
|
309
|
+
return /* @__PURE__ */ h("div", { ref: f, className: "relative", children: [
|
|
310
|
+
/* @__PURE__ */ h(
|
|
310
311
|
"button",
|
|
311
312
|
{
|
|
312
313
|
type: "button",
|
|
313
|
-
onClick: () =>
|
|
314
|
+
onClick: () => v((c) => !c),
|
|
314
315
|
"aria-haspopup": "listbox",
|
|
315
|
-
"aria-expanded":
|
|
316
|
-
className:
|
|
316
|
+
"aria-expanded": m,
|
|
317
|
+
className: O(
|
|
317
318
|
"flex h-8 w-full min-w-[10rem] items-center justify-between gap-1 rounded-md border border-slate-200 bg-white px-2 text-left text-[12px] dark:border-border dark:bg-card",
|
|
318
319
|
!u && "text-slate-400"
|
|
319
320
|
),
|
|
320
321
|
children: [
|
|
321
|
-
/* @__PURE__ */
|
|
322
|
-
/* @__PURE__ */
|
|
322
|
+
/* @__PURE__ */ l("span", { className: "truncate", children: q }),
|
|
323
|
+
/* @__PURE__ */ l(de, { className: "h-3 w-3 shrink-0 text-slate-400" })
|
|
323
324
|
]
|
|
324
325
|
}
|
|
325
326
|
),
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
const
|
|
329
|
-
return /* @__PURE__ */
|
|
327
|
+
m && f.current && /* @__PURE__ */ h(fe, { anchor: f.current, panelRef: p, children: [
|
|
328
|
+
d.map((c) => {
|
|
329
|
+
const x = u === c.id;
|
|
330
|
+
return /* @__PURE__ */ h(
|
|
330
331
|
"button",
|
|
331
332
|
{
|
|
332
333
|
type: "button",
|
|
333
334
|
role: "option",
|
|
334
|
-
"aria-selected":
|
|
335
|
+
"aria-selected": x,
|
|
335
336
|
onClick: () => {
|
|
336
|
-
|
|
337
|
+
b(c.id), v(!1);
|
|
337
338
|
},
|
|
338
|
-
className:
|
|
339
|
+
className: O(
|
|
339
340
|
"flex w-full items-center justify-between px-2.5 py-1.5 text-left text-[12px] hover:bg-slate-50 dark:hover:bg-muted/50",
|
|
340
|
-
|
|
341
|
+
x ? "font-semibold text-nvr-navy dark:text-nvr-cyan" : "text-slate-700 dark:text-slate-200"
|
|
341
342
|
),
|
|
342
343
|
children: [
|
|
343
|
-
/* @__PURE__ */
|
|
344
|
-
|
|
344
|
+
/* @__PURE__ */ l("span", { className: "truncate", children: c.label }),
|
|
345
|
+
x && /* @__PURE__ */ l(ue, { className: "h-3 w-3 shrink-0" })
|
|
345
346
|
]
|
|
346
347
|
},
|
|
347
|
-
|
|
348
|
+
c.id
|
|
348
349
|
);
|
|
349
350
|
}),
|
|
350
|
-
|
|
351
|
+
d.length === 0 && /* @__PURE__ */ l("p", { className: "px-2.5 py-2 text-[11px] text-slate-400", children: "No options" })
|
|
351
352
|
] })
|
|
352
353
|
] });
|
|
353
354
|
}
|
|
354
|
-
function
|
|
355
|
+
function He({
|
|
355
356
|
payload: i,
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
357
|
+
transitionId: u,
|
|
358
|
+
isRetry: b,
|
|
359
|
+
onSubmitted: _,
|
|
360
|
+
executing: m = !1,
|
|
361
|
+
onClose: v
|
|
360
362
|
}) {
|
|
361
|
-
var
|
|
362
|
-
const f = I(),
|
|
363
|
-
() =>
|
|
364
|
-
),
|
|
365
|
-
|
|
366
|
-
if (!(
|
|
363
|
+
var Z;
|
|
364
|
+
const f = I(), p = ke(), [d, q] = R(
|
|
365
|
+
() => se(i, !0)
|
|
366
|
+
), w = F(se(i)), [c, x] = R({}), [C, y] = R(!1), [E, P] = R("save"), V = (r) => u ? { ...r, _headers: { [Le]: u } } : r, L = (r, N, a) => {
|
|
367
|
+
q((e) => ({ ...e, [r]: { ...e[r], [N]: a } })), x((e) => {
|
|
368
|
+
if (!(r in e)) return e;
|
|
367
369
|
const t = { ...e };
|
|
368
|
-
return delete t[
|
|
370
|
+
return delete t[r], t;
|
|
369
371
|
});
|
|
370
|
-
},
|
|
371
|
-
const a =
|
|
372
|
+
}, B = (r, N) => {
|
|
373
|
+
const a = r.rows.map((e) => {
|
|
372
374
|
var t;
|
|
373
|
-
return (t =
|
|
375
|
+
return (t = d[D(r.collection, e.id)]) == null ? void 0 : t[N.field];
|
|
374
376
|
}).find(
|
|
375
|
-
(e) =>
|
|
377
|
+
(e) => N.kind === "m2m" ? Array.isArray(e) && e.length > 0 : typeof e == "string" && e.trim()
|
|
376
378
|
);
|
|
377
|
-
a != null && (
|
|
379
|
+
a != null && (q((e) => {
|
|
378
380
|
const t = { ...e };
|
|
379
|
-
for (const n of
|
|
380
|
-
const g =
|
|
381
|
-
t[g] = { ...t[g], [
|
|
381
|
+
for (const n of r.rows) {
|
|
382
|
+
const g = D(r.collection, n.id);
|
|
383
|
+
t[g] = { ...t[g], [N.field]: Array.isArray(a) ? [...a] : a };
|
|
382
384
|
}
|
|
383
385
|
return t;
|
|
384
|
-
}),
|
|
385
|
-
},
|
|
386
|
+
}), x({}));
|
|
387
|
+
}, K = (r, N) => {
|
|
386
388
|
var g;
|
|
387
|
-
const a =
|
|
389
|
+
const a = N.optional_when;
|
|
388
390
|
if (!a) return !1;
|
|
389
|
-
const e = (g =
|
|
390
|
-
return (Array.isArray(e) ? e : [e]).some((
|
|
391
|
-
}, [
|
|
392
|
-
|
|
391
|
+
const e = (g = d[r]) == null ? void 0 : g[a.field], t = new Set(a.in.map(String));
|
|
392
|
+
return (Array.isArray(e) ? e : [e]).some((k) => k != null && k !== "" && t.has(String(k)));
|
|
393
|
+
}, [pe, he] = R({}), Y = (r, N) => {
|
|
394
|
+
r.trim() && (q((a) => {
|
|
393
395
|
var t;
|
|
394
396
|
const e = { ...a };
|
|
395
397
|
for (const n of i) {
|
|
396
398
|
if (n.type !== "child_fields") continue;
|
|
397
|
-
const g = n.fields.find((
|
|
399
|
+
const g = n.fields.find((k) => k.field === N);
|
|
398
400
|
if (!(!g || g.kind === "m2m"))
|
|
399
|
-
for (const
|
|
400
|
-
const s =
|
|
401
|
+
for (const k of n.rows) {
|
|
402
|
+
const s = D(n.collection, k.id), o = g.optional_when;
|
|
401
403
|
if (o) {
|
|
402
|
-
const S = (t = e[s]) == null ? void 0 : t[o.field],
|
|
403
|
-
if ((Array.isArray(S) ? S : [S]).some((A) => A != null && A !== "" &&
|
|
404
|
+
const S = (t = e[s]) == null ? void 0 : t[o.field], j = new Set(o.in.map(String));
|
|
405
|
+
if ((Array.isArray(S) ? S : [S]).some((A) => A != null && A !== "" && j.has(String(A)))) continue;
|
|
404
406
|
}
|
|
405
|
-
e[s] = { ...e[s], [
|
|
407
|
+
e[s] = { ...e[s], [N]: r };
|
|
406
408
|
}
|
|
407
409
|
}
|
|
408
410
|
return e;
|
|
409
|
-
}),
|
|
410
|
-
},
|
|
411
|
-
if (
|
|
412
|
-
if (
|
|
413
|
-
const
|
|
414
|
-
return
|
|
411
|
+
}), x({}));
|
|
412
|
+
}, be = i.some((r) => {
|
|
413
|
+
if (r.type === "record_fields") {
|
|
414
|
+
if (r.optional) return !1;
|
|
415
|
+
const N = M(r);
|
|
416
|
+
return r.fields.some((a) => {
|
|
415
417
|
var t;
|
|
416
|
-
if (
|
|
417
|
-
const e = (t =
|
|
418
|
-
return
|
|
418
|
+
if (K(N, a)) return !1;
|
|
419
|
+
const e = (t = d[N]) == null ? void 0 : t[a.field];
|
|
420
|
+
return X(a) ? !Array.isArray(e) || e.length === 0 : !(typeof e == "string" ? e : "").trim();
|
|
419
421
|
});
|
|
420
422
|
}
|
|
421
|
-
return
|
|
422
|
-
const a =
|
|
423
|
-
return
|
|
423
|
+
return r.rows.some((N) => {
|
|
424
|
+
const a = D(r.collection, N.id);
|
|
425
|
+
return r.fields.some((e) => {
|
|
424
426
|
var n;
|
|
425
|
-
if (
|
|
426
|
-
const t = (n =
|
|
427
|
+
if (K(a, e)) return !1;
|
|
428
|
+
const t = (n = d[a]) == null ? void 0 : n[e.field];
|
|
427
429
|
return e.kind === "m2m" ? !Array.isArray(t) || t.length === 0 : !(typeof t == "string" ? t : "").trim();
|
|
428
430
|
});
|
|
429
431
|
});
|
|
430
|
-
}),
|
|
431
|
-
|
|
432
|
-
const
|
|
432
|
+
}), G = ((Z = i.find((r) => r.type === "child_fields" && !!r.review)) == null ? void 0 : Z.review_message) ?? null, ge = async () => {
|
|
433
|
+
y(!0);
|
|
434
|
+
const r = await Promise.all(
|
|
433
435
|
i.flatMap((a) => {
|
|
434
436
|
if (a.type === "record_fields") {
|
|
435
|
-
const e =
|
|
437
|
+
const e = M(a);
|
|
436
438
|
return [
|
|
437
439
|
(async () => {
|
|
438
|
-
const t =
|
|
440
|
+
const t = d[e] ?? {}, n = w.current[e] ?? {}, g = {}, k = [];
|
|
439
441
|
for (const s of a.fields) {
|
|
440
|
-
if (
|
|
441
|
-
const o = Array.isArray(t[s.field]) ? t[s.field] : [], S = Array.isArray(n[s.field]) ? n[s.field] : [],
|
|
442
|
-
(
|
|
442
|
+
if (X(s)) {
|
|
443
|
+
const o = Array.isArray(t[s.field]) ? t[s.field] : [], S = Array.isArray(n[s.field]) ? n[s.field] : [], j = o.filter((A) => !S.includes(A)), $ = S.filter((A) => !o.includes(A));
|
|
444
|
+
(j.length > 0 || $.length > 0) && k.push({ meta: s, add: j, remove: $ });
|
|
443
445
|
continue;
|
|
444
446
|
}
|
|
445
|
-
t[s.field] !== n[s.field] && (g[s.field] = s.kind === "m2o" || s.kind === "file" ? String(t[s.field] ?? "") || null :
|
|
447
|
+
t[s.field] !== n[s.field] && (g[s.field] = s.kind === "m2o" || s.kind === "file" ? String(t[s.field] ?? "") || null : le(String(t[s.field] ?? ""), s.type));
|
|
446
448
|
}
|
|
447
|
-
if (Object.keys(g).length === 0 &&
|
|
449
|
+
if (Object.keys(g).length === 0 && k.length === 0)
|
|
448
450
|
return { rk: e, ok: !0 };
|
|
449
451
|
try {
|
|
450
|
-
Object.keys(g).length > 0 && await f.request(
|
|
451
|
-
|
|
452
|
+
Object.keys(g).length > 0 && await f.request(
|
|
453
|
+
V(te(`/items/${a.collection}/${a.item}`, g))
|
|
454
|
+
);
|
|
455
|
+
for (const { meta: s, add: o, remove: S } of k)
|
|
452
456
|
if (!(!s.junction || !s.fk_to_child || !s.junction_field)) {
|
|
453
457
|
if (S.length > 0) {
|
|
454
|
-
const
|
|
455
|
-
|
|
458
|
+
const j = await f.request(
|
|
459
|
+
T(`/items/${s.junction}`, {
|
|
456
460
|
limit: 500,
|
|
457
461
|
filter: JSON.stringify({ [s.fk_to_child]: { _eq: a.item } })
|
|
458
462
|
})
|
|
459
463
|
);
|
|
460
|
-
for (const
|
|
461
|
-
S.includes(String(
|
|
464
|
+
for (const $ of j.data ?? [])
|
|
465
|
+
S.includes(String($[s.junction_field])) && await f.request(ne(`/items/${s.junction}/${$.id}`));
|
|
462
466
|
}
|
|
463
|
-
for (const
|
|
467
|
+
for (const j of o)
|
|
464
468
|
await f.request(
|
|
465
|
-
|
|
469
|
+
re(`/items/${s.junction}`, {
|
|
466
470
|
[s.fk_to_child]: a.item,
|
|
467
|
-
[s.junction_field]:
|
|
471
|
+
[s.junction_field]: j
|
|
468
472
|
})
|
|
469
473
|
);
|
|
470
474
|
}
|
|
471
|
-
return
|
|
475
|
+
return p.invalidateQueries({
|
|
472
476
|
queryKey: ["item", a.collection, String(a.item)]
|
|
473
477
|
}), { rk: e, ok: !0, saved: { ...n, ...t } };
|
|
474
478
|
} catch (s) {
|
|
@@ -479,130 +483,130 @@ function Be({
|
|
|
479
483
|
];
|
|
480
484
|
}
|
|
481
485
|
return a.rows.map(async (e) => {
|
|
482
|
-
const t =
|
|
486
|
+
const t = D(a.collection, e.id), n = d[t] ?? {}, g = w.current[t] ?? {}, k = {}, s = [];
|
|
483
487
|
for (const o of a.fields) {
|
|
484
488
|
if (o.kind === "m2m") {
|
|
485
|
-
const S = Array.isArray(n[o.field]) ? n[o.field] : [],
|
|
486
|
-
(
|
|
489
|
+
const S = Array.isArray(n[o.field]) ? n[o.field] : [], j = Array.isArray(g[o.field]) ? g[o.field] : [], $ = S.filter((Q) => !j.includes(Q)), A = j.filter((Q) => !S.includes(Q));
|
|
490
|
+
($.length > 0 || A.length > 0) && s.push({ meta: o, add: $, remove: A });
|
|
487
491
|
continue;
|
|
488
492
|
}
|
|
489
|
-
|
|
493
|
+
K(t, o) || n[o.field] !== g[o.field] && (k[o.field] = o.kind === "m2o" ? String(n[o.field] ?? "") || null : le(String(n[o.field] ?? ""), o.type));
|
|
490
494
|
}
|
|
491
|
-
if (Object.keys(
|
|
495
|
+
if (Object.keys(k).length === 0 && s.length === 0)
|
|
492
496
|
return { rk: t, ok: !0 };
|
|
493
497
|
try {
|
|
494
|
-
Object.keys(
|
|
495
|
-
for (const { meta: o, add: S, remove:
|
|
498
|
+
Object.keys(k).length > 0 && await f.request(V(te(`/items/${a.collection}/${e.id}`, k)));
|
|
499
|
+
for (const { meta: o, add: S, remove: j } of s)
|
|
496
500
|
if (!(!o.junction || !o.fk_to_child || !o.junction_field)) {
|
|
497
|
-
if (
|
|
498
|
-
const
|
|
499
|
-
|
|
501
|
+
if (j.length > 0) {
|
|
502
|
+
const $ = await f.request(
|
|
503
|
+
T(`/items/${o.junction}`, {
|
|
500
504
|
limit: 500,
|
|
501
505
|
filter: JSON.stringify({ [o.fk_to_child]: { _eq: e.id } })
|
|
502
506
|
})
|
|
503
507
|
);
|
|
504
|
-
for (const A of
|
|
505
|
-
|
|
508
|
+
for (const A of $.data ?? [])
|
|
509
|
+
j.includes(String(A[o.junction_field])) && await f.request(ne(`/items/${o.junction}/${A.id}`));
|
|
506
510
|
}
|
|
507
|
-
for (const
|
|
511
|
+
for (const $ of S)
|
|
508
512
|
await f.request(
|
|
509
|
-
|
|
513
|
+
re(`/items/${o.junction}`, {
|
|
510
514
|
[o.fk_to_child]: e.id,
|
|
511
|
-
[o.junction_field]:
|
|
515
|
+
[o.junction_field]: $
|
|
512
516
|
})
|
|
513
517
|
);
|
|
514
518
|
}
|
|
515
|
-
return
|
|
519
|
+
return p.invalidateQueries({ queryKey: ["item", a.collection, String(e.id)] }), { rk: t, ok: !0, saved: { ...g, ...n } };
|
|
516
520
|
} catch (o) {
|
|
517
521
|
const S = o == null ? void 0 : o.response;
|
|
518
522
|
return { rk: t, ok: !1, error: (S == null ? void 0 : S.error) ?? "Failed to save" };
|
|
519
523
|
}
|
|
520
524
|
});
|
|
521
525
|
})
|
|
522
|
-
),
|
|
523
|
-
for (const a of
|
|
524
|
-
a.ok && a.saved && (
|
|
525
|
-
if (
|
|
526
|
-
|
|
526
|
+
), N = r.filter((a) => !a.ok);
|
|
527
|
+
for (const a of r)
|
|
528
|
+
a.ok && a.saved && (w.current[a.rk] = a.saved);
|
|
529
|
+
if (N.length > 0) {
|
|
530
|
+
y(!1), x(Object.fromEntries(N.map((a) => [a.rk, a.ok ? "" : a.error])));
|
|
527
531
|
return;
|
|
528
532
|
}
|
|
529
|
-
|
|
533
|
+
x({}), P("transition");
|
|
530
534
|
try {
|
|
531
|
-
await
|
|
535
|
+
await _();
|
|
532
536
|
} catch {
|
|
533
537
|
} finally {
|
|
534
|
-
|
|
538
|
+
y(!1), P("save");
|
|
535
539
|
}
|
|
536
|
-
},
|
|
537
|
-
return /* @__PURE__ */
|
|
538
|
-
|
|
540
|
+
}, xe = i.length === 1 && i[0].title ? i[0].title : "Required before continuing";
|
|
541
|
+
return /* @__PURE__ */ l(Ae, { open: !0, onOpenChange: (r) => !r && !C && !m && v(), children: /* @__PURE__ */ h(
|
|
542
|
+
Ce,
|
|
539
543
|
{
|
|
540
|
-
className:
|
|
544
|
+
className: O(
|
|
541
545
|
"max-w-2xl",
|
|
542
546
|
i.some(
|
|
543
|
-
(
|
|
547
|
+
(r) => r.type === "child_fields" && (r.display_fields ?? []).length + r.fields.length > 3
|
|
544
548
|
) && "max-w-5xl"
|
|
545
549
|
),
|
|
546
550
|
style: (() => {
|
|
547
|
-
var
|
|
548
|
-
const
|
|
551
|
+
var N;
|
|
552
|
+
const r = (N = i.find(
|
|
549
553
|
(a) => a.type === "child_fields" && !!a.width
|
|
550
|
-
)) == null ? void 0 :
|
|
551
|
-
return
|
|
554
|
+
)) == null ? void 0 : N.width;
|
|
555
|
+
return r ? { width: r, maxWidth: r } : void 0;
|
|
552
556
|
})(),
|
|
553
557
|
children: [
|
|
554
|
-
/* @__PURE__ */
|
|
555
|
-
/* @__PURE__ */
|
|
556
|
-
|
|
558
|
+
/* @__PURE__ */ l(je, { children: /* @__PURE__ */ l($e, { className: "text-[15px]", children: xe }) }),
|
|
559
|
+
/* @__PURE__ */ h(
|
|
560
|
+
qe,
|
|
557
561
|
{
|
|
558
|
-
className:
|
|
562
|
+
className: O(
|
|
559
563
|
"max-h-[60vh] space-y-5 overflow-y-auto",
|
|
560
|
-
(
|
|
564
|
+
(C || m) && "pointer-events-none opacity-60 transition-opacity"
|
|
561
565
|
),
|
|
562
566
|
children: [
|
|
563
|
-
|
|
564
|
-
/* @__PURE__ */
|
|
567
|
+
b && /* @__PURE__ */ h("p", { className: "flex items-center gap-2 rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-[12px] text-amber-700 dark:border-amber-500/20 dark:bg-amber-500/10 dark:text-amber-400", children: [
|
|
568
|
+
/* @__PURE__ */ l("span", { className: "h-1.5 w-1.5 shrink-0 rounded-full bg-amber-400" }),
|
|
565
569
|
"Values changed since your last attempt — review the highlighted rows."
|
|
566
570
|
] }),
|
|
567
|
-
|
|
568
|
-
/* @__PURE__ */
|
|
569
|
-
|
|
571
|
+
G && !b && /* @__PURE__ */ h("p", { className: "flex items-center gap-2 rounded-md border border-red-200 bg-red-50 px-3 py-2 text-[12px] text-red-700 dark:border-red-500/20 dark:bg-red-500/10 dark:text-red-400", children: [
|
|
572
|
+
/* @__PURE__ */ l(z, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
573
|
+
G
|
|
570
574
|
] }),
|
|
571
|
-
i.map((
|
|
572
|
-
if (
|
|
573
|
-
const e =
|
|
574
|
-
return /* @__PURE__ */
|
|
575
|
-
i.length > 1 && /* @__PURE__ */
|
|
576
|
-
/* @__PURE__ */
|
|
577
|
-
var g,
|
|
578
|
-
const n = (g =
|
|
579
|
-
return /* @__PURE__ */
|
|
580
|
-
/* @__PURE__ */
|
|
581
|
-
t.kind === "m2o" ? /* @__PURE__ */
|
|
582
|
-
|
|
575
|
+
i.map((r) => {
|
|
576
|
+
if (r.type === "record_fields") {
|
|
577
|
+
const e = M(r);
|
|
578
|
+
return /* @__PURE__ */ h("div", { className: "space-y-2", children: [
|
|
579
|
+
i.length > 1 && /* @__PURE__ */ l("h4", { className: "text-[12px] font-semibold text-slate-500", children: r.title }),
|
|
580
|
+
/* @__PURE__ */ l("div", { className: "grid grid-cols-1 gap-3 rounded-md border border-slate-200 p-3 sm:grid-cols-2 dark:border-border", children: r.fields.map((t) => {
|
|
581
|
+
var g, k;
|
|
582
|
+
const n = (g = d[e]) == null ? void 0 : g[t.field];
|
|
583
|
+
return /* @__PURE__ */ h("div", { className: "space-y-1", children: [
|
|
584
|
+
/* @__PURE__ */ l("label", { className: "text-[11px] font-medium text-slate-500", children: t.label }),
|
|
585
|
+
t.kind === "m2o" ? /* @__PURE__ */ l(
|
|
586
|
+
oe,
|
|
583
587
|
{
|
|
584
588
|
meta: t,
|
|
585
589
|
selected: typeof n == "string" ? n : "",
|
|
586
590
|
onChange: (s) => L(e, t.field, s)
|
|
587
591
|
}
|
|
588
|
-
) : t.kind === "m2m" ? /* @__PURE__ */
|
|
589
|
-
|
|
592
|
+
) : t.kind === "m2m" ? /* @__PURE__ */ l(
|
|
593
|
+
ae,
|
|
590
594
|
{
|
|
591
595
|
meta: t,
|
|
592
596
|
selected: Array.isArray(n) ? n : [],
|
|
593
597
|
onChange: (s) => L(e, t.field, s)
|
|
594
598
|
}
|
|
595
|
-
) : t.kind === "file" || t.kind === "files" ? /* @__PURE__ */
|
|
596
|
-
|
|
599
|
+
) : t.kind === "file" || t.kind === "files" ? /* @__PURE__ */ l(
|
|
600
|
+
Oe,
|
|
597
601
|
{
|
|
598
602
|
multiple: t.kind === "files",
|
|
599
603
|
ids: Array.isArray(n) ? n : typeof n == "string" && n ? [n] : [],
|
|
600
|
-
initialNames:
|
|
604
|
+
initialNames: De(r.display[t.field]),
|
|
601
605
|
onChange: (s) => L(e, t.field, t.kind === "files" ? s : s[0] ?? "")
|
|
602
606
|
}
|
|
603
|
-
) : (
|
|
604
|
-
/* @__PURE__ */
|
|
605
|
-
|
|
607
|
+
) : (k = r.copy_to_lines) != null && k[t.field] ? /* @__PURE__ */ h("div", { className: "flex items-center gap-1.5", children: [
|
|
608
|
+
/* @__PURE__ */ l(
|
|
609
|
+
U,
|
|
606
610
|
{
|
|
607
611
|
value: typeof n == "string" ? n : "",
|
|
608
612
|
onChange: (s) => L(e, t.field, s.target.value),
|
|
@@ -610,16 +614,16 @@ function Be({
|
|
|
610
614
|
className: "h-8 w-full text-[12px]"
|
|
611
615
|
}
|
|
612
616
|
),
|
|
613
|
-
/* @__PURE__ */
|
|
617
|
+
/* @__PURE__ */ l(
|
|
614
618
|
"button",
|
|
615
619
|
{
|
|
616
620
|
type: "button",
|
|
617
621
|
disabled: !(typeof n == "string" && n.trim()),
|
|
618
622
|
onClick: () => {
|
|
619
623
|
var s;
|
|
620
|
-
return
|
|
624
|
+
return Y(
|
|
621
625
|
typeof n == "string" ? n : "",
|
|
622
|
-
(s =
|
|
626
|
+
(s = r.copy_to_lines) == null ? void 0 : s[t.field]
|
|
623
627
|
);
|
|
624
628
|
},
|
|
625
629
|
title: "Copy this value to every available line",
|
|
@@ -627,8 +631,8 @@ function Be({
|
|
|
627
631
|
children: "Apply to lines ↓"
|
|
628
632
|
}
|
|
629
633
|
)
|
|
630
|
-
] }) : /* @__PURE__ */
|
|
631
|
-
|
|
634
|
+
] }) : /* @__PURE__ */ l(
|
|
635
|
+
U,
|
|
632
636
|
{
|
|
633
637
|
value: typeof n == "string" ? n : "",
|
|
634
638
|
onChange: (s) => L(e, t.field, s.target.value),
|
|
@@ -638,42 +642,42 @@ function Be({
|
|
|
638
642
|
)
|
|
639
643
|
] }, t.field);
|
|
640
644
|
}) }),
|
|
641
|
-
|
|
642
|
-
/* @__PURE__ */
|
|
643
|
-
|
|
645
|
+
c[e] && /* @__PURE__ */ h("p", { className: "flex items-center gap-1 text-[11px] text-red-600", children: [
|
|
646
|
+
/* @__PURE__ */ l(z, { className: "h-3 w-3 shrink-0" }),
|
|
647
|
+
c[e]
|
|
644
648
|
] })
|
|
645
649
|
] }, e);
|
|
646
650
|
}
|
|
647
|
-
const
|
|
648
|
-
return /* @__PURE__ */
|
|
651
|
+
const N = r.display_fields ?? [], a = 1 + N.length + r.fields.length;
|
|
652
|
+
return /* @__PURE__ */ h(
|
|
649
653
|
"div",
|
|
650
654
|
{
|
|
651
655
|
className: "space-y-2",
|
|
652
656
|
children: [
|
|
653
|
-
i.length > 1 && /* @__PURE__ */
|
|
654
|
-
(
|
|
655
|
-
const t = `__bulk__:${
|
|
656
|
-
return /* @__PURE__ */
|
|
657
|
+
i.length > 1 && /* @__PURE__ */ l("h4", { className: "text-[12px] font-semibold text-slate-500", children: r.title }),
|
|
658
|
+
(r.apply_all ?? []).map((e) => r.fields.find((t) => t.field === e)).filter((e) => !!e && e.kind !== "m2m").map((e) => {
|
|
659
|
+
const t = `__bulk__:${r.collection}:${e.field}`, n = pe[t] ?? "";
|
|
660
|
+
return /* @__PURE__ */ h(
|
|
657
661
|
"div",
|
|
658
662
|
{
|
|
659
663
|
className: "flex items-center gap-2 rounded-md border border-slate-200 bg-slate-50/60 px-3 py-2 dark:border-border dark:bg-white/[0.03]",
|
|
660
664
|
children: [
|
|
661
|
-
/* @__PURE__ */
|
|
662
|
-
/* @__PURE__ */
|
|
663
|
-
|
|
665
|
+
/* @__PURE__ */ l("label", { className: "shrink-0 text-[11px] font-medium text-slate-500", children: e.label }),
|
|
666
|
+
/* @__PURE__ */ l(
|
|
667
|
+
U,
|
|
664
668
|
{
|
|
665
669
|
value: n,
|
|
666
|
-
onChange: (g) =>
|
|
670
|
+
onChange: (g) => he((k) => ({ ...k, [t]: g.target.value })),
|
|
667
671
|
placeholder: `${e.label} for every line…`,
|
|
668
672
|
className: "h-8 w-full max-w-xs text-[12px]"
|
|
669
673
|
}
|
|
670
674
|
),
|
|
671
|
-
/* @__PURE__ */
|
|
675
|
+
/* @__PURE__ */ l(
|
|
672
676
|
"button",
|
|
673
677
|
{
|
|
674
678
|
type: "button",
|
|
675
679
|
disabled: !n.trim(),
|
|
676
|
-
onClick: () =>
|
|
680
|
+
onClick: () => Y(n, e.field),
|
|
677
681
|
className: "h-8 shrink-0 whitespace-nowrap rounded-md bg-nvr-cyan px-3 text-[11px] font-medium text-white transition-colors hover:opacity-90 disabled:opacity-40",
|
|
678
682
|
children: "Apply to all lines"
|
|
679
683
|
}
|
|
@@ -683,34 +687,34 @@ function Be({
|
|
|
683
687
|
t
|
|
684
688
|
);
|
|
685
689
|
}),
|
|
686
|
-
/* @__PURE__ */
|
|
687
|
-
/* @__PURE__ */
|
|
688
|
-
/* @__PURE__ */
|
|
689
|
-
|
|
690
|
-
|
|
690
|
+
/* @__PURE__ */ l("div", { className: "overflow-x-auto rounded-md border border-slate-200 dark:border-border", children: /* @__PURE__ */ h("table", { className: "w-full border-collapse text-[12px]", children: [
|
|
691
|
+
/* @__PURE__ */ l("thead", { children: /* @__PURE__ */ h("tr", { className: "border-b border-slate-200 bg-slate-50/60 text-left text-[11px] font-medium text-slate-400 dark:border-border dark:bg-white/[0.02]", children: [
|
|
692
|
+
/* @__PURE__ */ l("th", { className: "px-2.5 py-1.5 font-medium", children: "Row" }),
|
|
693
|
+
N.map((e) => /* @__PURE__ */ l("th", { className: "px-2.5 py-1.5 font-medium", children: e.label }, e.field)),
|
|
694
|
+
r.fields.map((e) => /* @__PURE__ */ l("th", { className: "w-40 px-2.5 py-1.5 font-medium", children: /* @__PURE__ */ h("span", { className: "flex items-center gap-1.5", children: [
|
|
691
695
|
e.label,
|
|
692
|
-
|
|
696
|
+
r.rows.length > 1 && /* @__PURE__ */ l(
|
|
693
697
|
"button",
|
|
694
698
|
{
|
|
695
699
|
type: "button",
|
|
696
|
-
onClick: () =>
|
|
700
|
+
onClick: () => B(r, e),
|
|
697
701
|
title: `Apply the first ${e.label} to all lines`,
|
|
698
702
|
className: "rounded p-0.5 text-slate-300 transition-colors hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-muted/50",
|
|
699
|
-
children: /* @__PURE__ */
|
|
703
|
+
children: /* @__PURE__ */ l(we, { className: "h-3 w-3" })
|
|
700
704
|
}
|
|
701
705
|
)
|
|
702
706
|
] }) }, e.field))
|
|
703
707
|
] }) }),
|
|
704
|
-
/* @__PURE__ */
|
|
705
|
-
const t =
|
|
706
|
-
return /* @__PURE__ */
|
|
707
|
-
/* @__PURE__ */
|
|
708
|
-
/* @__PURE__ */
|
|
709
|
-
!e.complete && /* @__PURE__ */
|
|
710
|
-
/* @__PURE__ */
|
|
708
|
+
/* @__PURE__ */ l("tbody", { children: r.rows.map((e) => {
|
|
709
|
+
const t = D(r.collection, e.id);
|
|
710
|
+
return /* @__PURE__ */ h(Ne, { children: [
|
|
711
|
+
/* @__PURE__ */ h("tr", { className: "border-b border-slate-100 last:border-b-0 dark:border-border/50", children: [
|
|
712
|
+
/* @__PURE__ */ l("td", { className: "max-w-[220px] px-2.5 py-1.5", children: /* @__PURE__ */ h("span", { className: "flex items-center gap-1.5", children: [
|
|
713
|
+
!e.complete && /* @__PURE__ */ l("span", { className: "h-1.5 w-1.5 shrink-0 rounded-full bg-amber-400 animate-pulse" }),
|
|
714
|
+
/* @__PURE__ */ l(
|
|
711
715
|
"span",
|
|
712
716
|
{
|
|
713
|
-
className:
|
|
717
|
+
className: O(
|
|
714
718
|
"truncate",
|
|
715
719
|
e.complete ? "text-slate-400" : "font-medium text-slate-700"
|
|
716
720
|
),
|
|
@@ -719,32 +723,32 @@ function Be({
|
|
|
719
723
|
}
|
|
720
724
|
)
|
|
721
725
|
] }) }),
|
|
722
|
-
|
|
723
|
-
var g,
|
|
724
|
-
return /* @__PURE__ */
|
|
726
|
+
N.map((n) => {
|
|
727
|
+
var g, k;
|
|
728
|
+
return /* @__PURE__ */ l(
|
|
725
729
|
"td",
|
|
726
730
|
{
|
|
727
|
-
className:
|
|
731
|
+
className: O(
|
|
728
732
|
"max-w-[200px] truncate px-2.5 py-1.5 text-slate-500",
|
|
729
733
|
n.format && "text-right tabular-nums"
|
|
730
734
|
),
|
|
731
|
-
title:
|
|
732
|
-
children:
|
|
735
|
+
title: ie((g = e.display) == null ? void 0 : g[n.field], n.format),
|
|
736
|
+
children: ie((k = e.display) == null ? void 0 : k[n.field], n.format) || "—"
|
|
733
737
|
},
|
|
734
738
|
n.field
|
|
735
739
|
);
|
|
736
740
|
}),
|
|
737
|
-
|
|
738
|
-
var g,
|
|
739
|
-
return /* @__PURE__ */
|
|
740
|
-
|
|
741
|
+
r.fields.map((n) => {
|
|
742
|
+
var g, k, s, o, S, j, $;
|
|
743
|
+
return /* @__PURE__ */ l("td", { className: "px-2 py-1", children: n.kind === "m2m" ? /* @__PURE__ */ l(
|
|
744
|
+
ae,
|
|
741
745
|
{
|
|
742
746
|
meta: n,
|
|
743
|
-
selected: Array.isArray((g =
|
|
747
|
+
selected: Array.isArray((g = d[t]) == null ? void 0 : g[n.field]) ? (k = d[t]) == null ? void 0 : k[n.field] : [],
|
|
744
748
|
onChange: (A) => L(t, n.field, A)
|
|
745
749
|
}
|
|
746
|
-
) :
|
|
747
|
-
|
|
750
|
+
) : K(t, n) ? /* @__PURE__ */ l(
|
|
751
|
+
U,
|
|
748
752
|
{
|
|
749
753
|
value: "",
|
|
750
754
|
disabled: !0,
|
|
@@ -753,17 +757,17 @@ function Be({
|
|
|
753
757
|
title: "Assigned automatically after submission",
|
|
754
758
|
className: "h-8 w-full min-w-[9rem] bg-slate-50 text-[12px] italic dark:bg-muted/50"
|
|
755
759
|
}
|
|
756
|
-
) : n.kind === "m2o" ? /* @__PURE__ */
|
|
757
|
-
|
|
760
|
+
) : n.kind === "m2o" ? /* @__PURE__ */ l(
|
|
761
|
+
oe,
|
|
758
762
|
{
|
|
759
763
|
meta: n,
|
|
760
|
-
selected: typeof ((o =
|
|
764
|
+
selected: typeof ((o = d[t]) == null ? void 0 : o[n.field]) == "string" ? (S = d[t]) == null ? void 0 : S[n.field] : "",
|
|
761
765
|
onChange: (A) => L(t, n.field, A)
|
|
762
766
|
}
|
|
763
|
-
) : /* @__PURE__ */
|
|
764
|
-
|
|
767
|
+
) : /* @__PURE__ */ l(
|
|
768
|
+
U,
|
|
765
769
|
{
|
|
766
|
-
value: typeof ((
|
|
770
|
+
value: typeof ((j = d[t]) == null ? void 0 : j[n.field]) == "string" ? ($ = d[t]) == null ? void 0 : $[n.field] : "",
|
|
767
771
|
onChange: (A) => L(t, n.field, A.target.value),
|
|
768
772
|
placeholder: n.label,
|
|
769
773
|
className: "h-8 w-full min-w-[9rem] text-[12px]"
|
|
@@ -771,45 +775,45 @@ function Be({
|
|
|
771
775
|
) }, n.field);
|
|
772
776
|
})
|
|
773
777
|
] }),
|
|
774
|
-
|
|
775
|
-
/* @__PURE__ */
|
|
776
|
-
|
|
778
|
+
c[t] && /* @__PURE__ */ l("tr", { children: /* @__PURE__ */ l("td", { colSpan: a, className: "px-2.5 pb-1.5", children: /* @__PURE__ */ h("p", { className: "flex items-center gap-1 text-[11px] text-red-600", children: [
|
|
779
|
+
/* @__PURE__ */ l(z, { className: "h-3 w-3 shrink-0" }),
|
|
780
|
+
c[t]
|
|
777
781
|
] }) }) })
|
|
778
782
|
] }, t);
|
|
779
783
|
}) })
|
|
780
784
|
] }) })
|
|
781
785
|
]
|
|
782
786
|
},
|
|
783
|
-
`${
|
|
787
|
+
`${r.collection}-${r.fk_field}-${r.title}`
|
|
784
788
|
);
|
|
785
789
|
})
|
|
786
790
|
]
|
|
787
791
|
}
|
|
788
792
|
),
|
|
789
|
-
/* @__PURE__ */
|
|
790
|
-
(
|
|
791
|
-
/* @__PURE__ */
|
|
792
|
-
|
|
793
|
+
/* @__PURE__ */ h(Ee, { className: "items-center", children: [
|
|
794
|
+
(C || m) && /* @__PURE__ */ h("span", { className: "mr-auto flex items-center gap-2 text-[12px] text-slate-500 dark:text-slate-400", children: [
|
|
795
|
+
/* @__PURE__ */ l(H, { className: "h-3.5 w-3.5 animate-spin text-nvr-cyan" }),
|
|
796
|
+
C ? "Saving line values…" : "Submitting — contacting external systems, this can take a few seconds…"
|
|
793
797
|
] }),
|
|
794
|
-
/* @__PURE__ */
|
|
795
|
-
|
|
798
|
+
/* @__PURE__ */ l(
|
|
799
|
+
W,
|
|
796
800
|
{
|
|
797
801
|
type: "button",
|
|
798
802
|
variant: "outline",
|
|
799
|
-
onClick:
|
|
800
|
-
disabled:
|
|
803
|
+
onClick: v,
|
|
804
|
+
disabled: C || m,
|
|
801
805
|
children: "Cancel"
|
|
802
806
|
}
|
|
803
807
|
),
|
|
804
|
-
/* @__PURE__ */
|
|
805
|
-
|
|
808
|
+
/* @__PURE__ */ l(
|
|
809
|
+
W,
|
|
806
810
|
{
|
|
807
811
|
type: "button",
|
|
808
|
-
onClick:
|
|
809
|
-
disabled:
|
|
810
|
-
children:
|
|
811
|
-
/* @__PURE__ */
|
|
812
|
-
|
|
812
|
+
onClick: ge,
|
|
813
|
+
disabled: C || m || be,
|
|
814
|
+
children: C || m ? /* @__PURE__ */ h("span", { className: "flex items-center gap-1.5", children: [
|
|
815
|
+
/* @__PURE__ */ l(H, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
816
|
+
C && E === "save" ? "Saving…" : "Submitting…"
|
|
813
817
|
] }) : "Submit"
|
|
814
818
|
}
|
|
815
819
|
)
|
|
@@ -819,5 +823,5 @@ function Be({
|
|
|
819
823
|
) });
|
|
820
824
|
}
|
|
821
825
|
export {
|
|
822
|
-
|
|
826
|
+
He as TransitionRequirementsDialog
|
|
823
827
|
};
|