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