@nivaro/react 0.3.52 → 0.3.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +47 -3
- package/dist/shared/components/ItemEditForm.js +4196 -4163
- package/dist/shared/components/NotificationBell.js +163 -150
- package/dist/shared/components/PageRenderer.js +645 -593
- package/dist/shared/components/ProfileView.js +36 -34
- package/dist/shared/components/QueryStatStrip.js +96 -89
- package/dist/shared/components/QueryTable.js +214 -215
- package/dist/shared/components/ReportView.js +548 -529
- package/dist/shared/components/alerts/AlertManagerView.js +346 -320
- package/dist/shared/components/item-edit/CatalogPickerField.js +1300 -1219
- package/dist/shared/components/item-edit/DraftRecoveryBanner.js +52 -54
- package/dist/shared/components/item-edit/FieldAffordances.js +145 -136
- package/dist/shared/components/item-edit/FieldRenderer.js +366 -326
- package/dist/shared/components/item-edit/InlineTableField.js +3047 -2932
- package/dist/shared/components/item-edit/NestedRelationEditor.js +149 -143
- package/dist/shared/components/item-edit/PersonalDefaultControl.js +12 -11
- package/dist/shared/components/item-edit/PlanGrid.js +718 -705
- package/dist/shared/components/item-edit/RelationCombobox.js +23 -20
- package/dist/shared/components/item-edit/SummaryPanel.js +415 -361
- package/dist/shared/components/item-edit/line-qty.js +115 -53
- package/dist/shared/components/item-edit/save-outcome.js +48 -0
- package/dist/shared/components/item-edit/save-refusal.js +18 -18
- package/dist/shared/components/item-edit/stale-banner.js +13 -0
- package/dist/shared/components/item-edit/usePersonalDefaults.js +225 -220
- package/dist/shared/components/panels/CommentPanel.js +204 -197
- package/dist/shared/components/panels/ItemLockBanner.js +318 -291
- package/dist/shared/components/panels/PipelinePanel.js +1388 -1218
- package/dist/shared/components/panels/RecordIntegrityBanner.js +201 -172
- package/dist/shared/components/panels/RevisionsPanel.js +101 -106
- package/dist/shared/components/panels/TransitionRequirementsDialog.js +564 -534
- package/dist/shared/components/panels/requirement-side-effects.js +46 -29
- package/dist/shared/components/queue/QueueItemSheet.js +219 -146
- package/dist/shared/components/queue/QueueWorklist.js +738 -730
- package/dist/shared/components/widgets/ReviewListWidget.js +236 -201
- package/dist/shared/lib/activity-sentence.js +236 -227
- package/dist/shared/lib/draft-store.js +35 -29
- package/dist/shared/lib/page-widget-access.js +11 -0
- package/dist/shared/lib/record-ref.js +43 -34
- package/package.json +1 -1
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useQuery as
|
|
3
|
-
import { ChevronRight as
|
|
4
|
-
import { useState as T, useMemo as
|
|
5
|
-
import { useNivaroClient as
|
|
6
|
-
import { post as
|
|
7
|
-
import { formatDateTime as
|
|
8
|
-
import { TooltipProvider as
|
|
9
|
-
function
|
|
10
|
-
return
|
|
1
|
+
import { jsx as n, jsxs as f } from "react/jsx-runtime";
|
|
2
|
+
import { useQuery as ne } from "@tanstack/react-query";
|
|
3
|
+
import { ChevronRight as ae, AlertCircle as se } from "lucide-react";
|
|
4
|
+
import { useState as T, useMemo as K } from "react";
|
|
5
|
+
import { useNivaroClient as oe, useItemEditAuth as ie } from "../../context.js";
|
|
6
|
+
import { post as W, patch as de } from "../../lib/commands.js";
|
|
7
|
+
import { formatDateTime as Y, cn as B, formatDate as ue } from "../../lib/utils.js";
|
|
8
|
+
import { TooltipProvider as ce, Tooltip as me, TooltipTrigger as pe, TooltipContent as be } from "../ui/tooltip.js";
|
|
9
|
+
function H(r) {
|
|
10
|
+
return r === !0 || r === 1 || r === "1" || r === "true";
|
|
11
11
|
}
|
|
12
|
-
function
|
|
13
|
-
if (
|
|
14
|
-
if (
|
|
15
|
-
const
|
|
16
|
-
return Number.isNaN(
|
|
12
|
+
function A(r, t) {
|
|
13
|
+
if (r == null || r === "") return "—";
|
|
14
|
+
if (t === "currency" || t === "number") {
|
|
15
|
+
const a = Number(r);
|
|
16
|
+
return Number.isNaN(a) ? String(r) : t === "currency" ? new Intl.NumberFormat(void 0, { style: "currency", currency: "USD" }).format(a) : new Intl.NumberFormat().format(a);
|
|
17
17
|
}
|
|
18
|
-
if (
|
|
19
|
-
const
|
|
20
|
-
return Number.isNaN(
|
|
18
|
+
if (t === "date" || t === "datetime") {
|
|
19
|
+
const a = new Date(r);
|
|
20
|
+
return Number.isNaN(a.getTime()) ? String(r) : t === "date" ? ue(typeof r == "string" ? r : a) : Y(a);
|
|
21
21
|
}
|
|
22
|
-
return String(
|
|
22
|
+
return String(r);
|
|
23
23
|
}
|
|
24
|
-
const
|
|
24
|
+
const I = {
|
|
25
25
|
green: "#16a34a",
|
|
26
26
|
red: "#dc2626",
|
|
27
27
|
amber: "#d97706",
|
|
@@ -29,110 +29,127 @@ const P = {
|
|
|
29
29
|
purple: "#9333ea",
|
|
30
30
|
slate: "#64748b"
|
|
31
31
|
};
|
|
32
|
-
function
|
|
32
|
+
function fe(r) {
|
|
33
33
|
return {
|
|
34
|
-
backgroundColor:
|
|
35
|
-
color:
|
|
36
|
-
border: `1px solid ${
|
|
34
|
+
backgroundColor: r ? `${r}22` : "#f1f5f9",
|
|
35
|
+
color: r ?? "#475569",
|
|
36
|
+
border: `1px solid ${r ? `${r}44` : "#e2e8f0"}`
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
|
-
function
|
|
40
|
-
const
|
|
41
|
-
return /* @__PURE__ */
|
|
39
|
+
function M({ label: r, color: t }) {
|
|
40
|
+
const a = t ? I[t] ?? null : null;
|
|
41
|
+
return /* @__PURE__ */ n(
|
|
42
42
|
"span",
|
|
43
43
|
{
|
|
44
44
|
className: "inline-flex items-center gap-1.5 rounded-full px-2 py-0.5 text-[11px] font-medium",
|
|
45
|
-
style:
|
|
46
|
-
children:
|
|
45
|
+
style: fe(a),
|
|
46
|
+
children: r
|
|
47
47
|
}
|
|
48
48
|
);
|
|
49
49
|
}
|
|
50
|
-
function
|
|
51
|
-
if (
|
|
52
|
-
return
|
|
53
|
-
const
|
|
54
|
-
return
|
|
50
|
+
function xe(r, t) {
|
|
51
|
+
if (r == null || r === "")
|
|
52
|
+
return t.empty_label ? { label: t.empty_label, color: t.empty_color ?? "blue" } : { label: "—", color: null };
|
|
53
|
+
const a = t.options.find((u) => u.value === String(r));
|
|
54
|
+
return a ? { label: a.status_label || a.label, color: a.color } : { label: String(r), color: null };
|
|
55
55
|
}
|
|
56
|
-
function
|
|
57
|
-
const
|
|
58
|
-
for (const x of
|
|
59
|
-
const s = String(x.group ?? ""),
|
|
60
|
-
|
|
56
|
+
function he(r, t) {
|
|
57
|
+
const a = /* @__PURE__ */ new Map();
|
|
58
|
+
for (const x of r.rows) {
|
|
59
|
+
const s = String(x.group ?? ""), h = a.get(s);
|
|
60
|
+
h ? h.push(x) : a.set(s, [x]);
|
|
61
61
|
}
|
|
62
|
-
const
|
|
63
|
-
const
|
|
64
|
-
let
|
|
65
|
-
return
|
|
62
|
+
const u = Array.from(a.entries()).map(([x, s]) => {
|
|
63
|
+
const y = new Set(s.map((F) => String(F.status ?? ""))).size > 1, D = y ? null : s[0].status;
|
|
64
|
+
let _ = null;
|
|
65
|
+
return t && s.every((S) => t in S.values) && (_ = s.reduce((S, O) => S + (Number(O.values[t]) || 0), 0)), { key: x, rows: s, count: s.length, sum: _, uniformStatus: D, mixedStatus: y };
|
|
66
66
|
});
|
|
67
|
-
return
|
|
67
|
+
return u.sort((x, s) => x.key.localeCompare(s.key, void 0, { numeric: !0 })), u;
|
|
68
68
|
}
|
|
69
|
-
function
|
|
70
|
-
let
|
|
71
|
-
for (const x of
|
|
72
|
-
const s = x.values[
|
|
69
|
+
function Q(r, t, a) {
|
|
70
|
+
let u = null;
|
|
71
|
+
for (const x of r) {
|
|
72
|
+
const s = x.values[t];
|
|
73
73
|
if (s == null || s === "") continue;
|
|
74
|
-
const
|
|
75
|
-
Number.isFinite(
|
|
74
|
+
const h = typeof s == "number" ? s : Date.parse(String(s)), y = Number.isNaN(h) ? Number(s) : h;
|
|
75
|
+
Number.isFinite(y) && (u == null || (a ? y > u : y < u)) && (u = y);
|
|
76
76
|
}
|
|
77
|
-
return
|
|
77
|
+
return u;
|
|
78
78
|
}
|
|
79
|
-
function
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
79
|
+
function X(r, t) {
|
|
80
|
+
const a = r.rows[0], u = (x) => {
|
|
81
|
+
const s = t.find((y) => y.role === x);
|
|
82
|
+
if (!s || !a) return null;
|
|
83
|
+
const h = a.values[s.field];
|
|
84
|
+
return h == null || h === "" ? null : `${s.prefix ?? ""}${A(h, s.format)}`;
|
|
85
|
+
};
|
|
86
|
+
return { title: u("title") ?? (r.key || "—"), subtitle: u("subtitle") };
|
|
87
|
+
}
|
|
88
|
+
function J(r, t) {
|
|
89
|
+
const a = (t == null ? void 0 : t.trim()) || "row";
|
|
90
|
+
return `${r} ${a}${r === 1 ? "" : "s"}`;
|
|
91
|
+
}
|
|
92
|
+
function ye(r, t, a) {
|
|
93
|
+
const u = a != null && a.trim() ? `${a.trim()} ` : "";
|
|
94
|
+
return `${r.label} ${u}${t.title}${t.subtitle ? ` · ${t.subtitle}` : ""}?`;
|
|
95
|
+
}
|
|
96
|
+
function Ce({
|
|
97
|
+
data: r,
|
|
98
|
+
config: t,
|
|
99
|
+
loading: a,
|
|
100
|
+
error: u,
|
|
84
101
|
onRefetch: x,
|
|
85
102
|
hostRecordId: s,
|
|
86
|
-
emptyLabel:
|
|
103
|
+
emptyLabel: h
|
|
87
104
|
}) {
|
|
88
|
-
const
|
|
89
|
-
const e =
|
|
105
|
+
const y = oe(), { userId: D } = ie(), [_, F] = T(() => /* @__PURE__ */ new Set()), [S, O] = T(null), [R, Z] = T({}), [m, $] = T(null), [E, L] = T(""), U = K(() => {
|
|
106
|
+
const e = r ? he(r, t.aggregate_sum) : [], o = t.group_sort;
|
|
90
107
|
if (!(o != null && o.field)) return e;
|
|
91
108
|
const p = o.direction === "desc";
|
|
92
109
|
return [...e].sort((k, d) => {
|
|
93
|
-
const
|
|
94
|
-
return
|
|
110
|
+
const b = Q(k.rows, o.field, p), w = Q(d.rows, o.field, p);
|
|
111
|
+
return b == null && w == null ? 0 : b == null ? 1 : w == null ? -1 : p ? w - b : b - w;
|
|
95
112
|
});
|
|
96
|
-
}, [
|
|
97
|
-
queryKey: ["review-list-enrich",
|
|
98
|
-
queryFn: () =>
|
|
99
|
-
|
|
113
|
+
}, [r, t.aggregate_sum, t.group_sort]), P = K(() => ((r == null ? void 0 : r.rows) ?? []).map((e) => String(e.id)), [r]), { data: C } = ne({
|
|
114
|
+
queryKey: ["review-list-enrich", t.enrich_endpoint ?? "", P.join(",")],
|
|
115
|
+
queryFn: () => y.request(
|
|
116
|
+
W(t.enrich_endpoint, { ids: P })
|
|
100
117
|
).then((e) => {
|
|
101
118
|
var o;
|
|
102
119
|
return ((o = e == null ? void 0 : e.data) == null ? void 0 : o.rows) ?? {};
|
|
103
120
|
}).catch(() => ({})),
|
|
104
|
-
enabled: !!
|
|
121
|
+
enabled: !!t.enrich_endpoint && P.length > 0,
|
|
105
122
|
staleTime: 3e4
|
|
106
|
-
}),
|
|
123
|
+
}), j = (e) => C == null ? void 0 : C[String(e)], V = !!C && Object.values(C).some((e) => {
|
|
107
124
|
var o;
|
|
108
125
|
return (((o = e.chips) == null ? void 0 : o.length) ?? 0) > 0;
|
|
109
|
-
}),
|
|
110
|
-
if (
|
|
111
|
-
return /* @__PURE__ */
|
|
126
|
+
}), ee = U.length === 1;
|
|
127
|
+
if (a)
|
|
128
|
+
return /* @__PURE__ */ n("div", { className: "space-y-2", children: [0, 1].map((e) => /* @__PURE__ */ n(
|
|
112
129
|
"div",
|
|
113
130
|
{
|
|
114
131
|
className: "animate-pulse h-12 rounded-md bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]"
|
|
115
132
|
},
|
|
116
133
|
e
|
|
117
134
|
)) });
|
|
118
|
-
if (
|
|
119
|
-
return /* @__PURE__ */
|
|
120
|
-
if (!
|
|
121
|
-
return /* @__PURE__ */
|
|
122
|
-
const
|
|
123
|
-
|
|
135
|
+
if (u)
|
|
136
|
+
return /* @__PURE__ */ n("p", { className: "text-[12px] text-red-500", children: u });
|
|
137
|
+
if (!r || r.rows.length === 0)
|
|
138
|
+
return /* @__PURE__ */ n("p", { className: "text-[12px] italic text-slate-400", children: h ? `No ${h.toLowerCase()} yet` : "Nothing here yet" });
|
|
139
|
+
const te = (e) => {
|
|
140
|
+
F((o) => {
|
|
124
141
|
const p = new Set(o);
|
|
125
142
|
return p.has(e) ? p.delete(e) : p.add(e), p;
|
|
126
143
|
});
|
|
127
|
-
},
|
|
128
|
-
|
|
129
|
-
},
|
|
130
|
-
|
|
144
|
+
}, re = (e, o) => {
|
|
145
|
+
L(""), $({ group: e, option: o });
|
|
146
|
+
}, le = async (e, o, p) => {
|
|
147
|
+
O(e.key);
|
|
131
148
|
let k = null;
|
|
132
|
-
if (
|
|
149
|
+
if (t.status.action_endpoint)
|
|
133
150
|
try {
|
|
134
|
-
await
|
|
135
|
-
|
|
151
|
+
await y.request(
|
|
152
|
+
W(t.status.action_endpoint, {
|
|
136
153
|
ids: e.rows.map((d) => d.id),
|
|
137
154
|
status: o.value,
|
|
138
155
|
// The status each row showed: the endpoint may refuse (409) rows
|
|
@@ -146,162 +163,173 @@ function Ne({
|
|
|
146
163
|
})
|
|
147
164
|
);
|
|
148
165
|
} catch (d) {
|
|
149
|
-
const
|
|
150
|
-
k = (
|
|
166
|
+
const b = d == null ? void 0 : d.response;
|
|
167
|
+
k = (b == null ? void 0 : b.error) ?? "Failed to update";
|
|
151
168
|
}
|
|
152
169
|
else {
|
|
153
|
-
const d =
|
|
154
|
-
e.rows.map(async (
|
|
155
|
-
const
|
|
156
|
-
|
|
170
|
+
const d = t.status.stamp_date_field ? (/* @__PURE__ */ new Date()).toISOString() : void 0, w = (await Promise.all(
|
|
171
|
+
e.rows.map(async (g) => {
|
|
172
|
+
const N = { [t.status.field]: o.value };
|
|
173
|
+
t.status.stamp_user_field && D && (N[t.status.stamp_user_field] = D), t.status.stamp_date_field && (N[t.status.stamp_date_field] = d), p && (N._change_reason = p);
|
|
157
174
|
try {
|
|
158
|
-
return await
|
|
159
|
-
} catch (
|
|
160
|
-
const
|
|
161
|
-
return { ok: !1, error: (
|
|
175
|
+
return await y.request(de(`/items/${t.collection}/${g.id}`, N)), { ok: !0 };
|
|
176
|
+
} catch (v) {
|
|
177
|
+
const l = v == null ? void 0 : v.response;
|
|
178
|
+
return { ok: !1, error: (l == null ? void 0 : l.error) ?? "Failed to update" };
|
|
162
179
|
}
|
|
163
180
|
})
|
|
164
|
-
)).filter((
|
|
165
|
-
|
|
181
|
+
)).filter((g) => !g.ok);
|
|
182
|
+
w.length > 0 && (k = `${w.length} of ${e.rows.length} row(s) failed to update`);
|
|
166
183
|
}
|
|
167
|
-
|
|
168
|
-
const
|
|
169
|
-
return k ?
|
|
184
|
+
O(null), Z((d) => {
|
|
185
|
+
const b = { ...d };
|
|
186
|
+
return k ? b[e.key] = k : delete b[e.key], b;
|
|
170
187
|
}), x();
|
|
171
|
-
},
|
|
172
|
-
return /* @__PURE__ */
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
const o =
|
|
176
|
-
var
|
|
177
|
-
return ((
|
|
178
|
-
}), k = e.
|
|
179
|
-
var
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
188
|
+
}, z = r.columns.line_columns, G = r.columns.group_meta;
|
|
189
|
+
return /* @__PURE__ */ n(ce, { delayDuration: 200, children: /* @__PURE__ */ f("div", { className: "space-y-2", children: [
|
|
190
|
+
r.truncated && /* @__PURE__ */ n("p", { className: "text-[11px] text-amber-600 dark:text-amber-400", children: "Showing first 2000 rows — some rows may be missing." }),
|
|
191
|
+
U.map((e) => {
|
|
192
|
+
const o = ee ? !_.has(e.key) : _.has(e.key), p = e.rows.every((l) => {
|
|
193
|
+
var c;
|
|
194
|
+
return ((c = j(l.id)) == null ? void 0 : c.can_act) !== !1;
|
|
195
|
+
}), k = e.rows.map((l) => {
|
|
196
|
+
var c;
|
|
197
|
+
return (c = j(l.id)) == null ? void 0 : c.reason;
|
|
198
|
+
}).find((l) => !!l) ?? "Only the workflow contact chain (or the PO requestor for invalid holds) can decide this", d = X(e, G), b = e.mixedStatus ? { label: "Mixed", color: null } : xe(e.uniformStatus, t.status), w = e.rows[0], g = w.stamp_user, N = w.stamp_date, v = e.rows.reduce((l, c) => {
|
|
199
|
+
var i;
|
|
200
|
+
for (const q of ((i = j(c.id)) == null ? void 0 : i.chips) ?? []) {
|
|
201
|
+
if (q.tone === "danger") return "danger";
|
|
202
|
+
q.tone === "warn" && l == null && (l = "warn");
|
|
183
203
|
}
|
|
184
204
|
return l;
|
|
185
205
|
}, null);
|
|
186
|
-
return /* @__PURE__ */
|
|
206
|
+
return /* @__PURE__ */ f(
|
|
187
207
|
"div",
|
|
188
208
|
{
|
|
189
209
|
"data-review-group": e.key,
|
|
190
|
-
"data-review-tone":
|
|
191
|
-
className:
|
|
210
|
+
"data-review-tone": v ?? void 0,
|
|
211
|
+
className: B(
|
|
192
212
|
"rounded-md border",
|
|
193
|
-
|
|
213
|
+
v === "danger" ? "border-l-2 border-l-red-500 border-red-200 bg-red-50/40 dark:border-red-500/40 dark:bg-red-500/5" : v === "warn" ? "border-l-2 border-l-amber-500 border-amber-200 bg-amber-50/40 dark:border-amber-500/40 dark:bg-amber-500/5" : "border-slate-200 dark:border-border"
|
|
194
214
|
),
|
|
195
215
|
children: [
|
|
196
|
-
/* @__PURE__ */
|
|
197
|
-
/* @__PURE__ */
|
|
216
|
+
/* @__PURE__ */ f("div", { className: "flex w-full flex-wrap items-center gap-2 px-3 py-2", children: [
|
|
217
|
+
/* @__PURE__ */ f(
|
|
198
218
|
"button",
|
|
199
219
|
{
|
|
200
220
|
type: "button",
|
|
201
|
-
onClick: () =>
|
|
221
|
+
onClick: () => te(e.key),
|
|
202
222
|
className: "flex min-w-0 flex-1 flex-wrap items-center gap-2 text-left",
|
|
203
223
|
children: [
|
|
204
|
-
/* @__PURE__ */
|
|
205
|
-
|
|
224
|
+
/* @__PURE__ */ n(
|
|
225
|
+
ae,
|
|
206
226
|
{
|
|
207
227
|
className: `h-3.5 w-3.5 shrink-0 text-slate-400 transition-transform ${o ? "rotate-90" : ""}`
|
|
208
228
|
}
|
|
209
229
|
),
|
|
210
|
-
/* @__PURE__ */
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
230
|
+
/* @__PURE__ */ n(
|
|
231
|
+
"span",
|
|
232
|
+
{
|
|
233
|
+
className: "text-[12px] font-medium text-slate-700 dark:text-slate-200",
|
|
234
|
+
"data-review-group-title": !0,
|
|
235
|
+
children: d.title
|
|
236
|
+
}
|
|
237
|
+
),
|
|
238
|
+
d.subtitle && /* @__PURE__ */ n("span", { className: "text-[11.5px] text-slate-500 dark:text-slate-400", children: d.subtitle }),
|
|
239
|
+
/* @__PURE__ */ f("span", { className: "text-[11px] text-slate-400", children: [
|
|
240
|
+
J(e.count, t.row_noun),
|
|
241
|
+
e.sum != null ? ` · ${A(e.sum, t.aggregate_sum_format ?? "number")}` : ""
|
|
216
242
|
] }),
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
243
|
+
G.map((l) => {
|
|
244
|
+
if (l.role) return null;
|
|
245
|
+
const c = w.values[l.field];
|
|
246
|
+
return l.format === "flag" ? H(c) ? /* @__PURE__ */ n(M, { label: l.label, color: l.color ?? "amber" }, l.field) : null : c == null || c === "" ? null : /* @__PURE__ */ f(
|
|
220
247
|
"span",
|
|
221
248
|
{
|
|
222
249
|
className: "rounded-full bg-slate-100 px-2 py-0.5 text-[10px] font-medium text-slate-500 dark:bg-slate-800 dark:text-slate-400",
|
|
223
250
|
children: [
|
|
224
251
|
l.label,
|
|
225
252
|
": ",
|
|
226
|
-
|
|
253
|
+
A(c, l.format)
|
|
227
254
|
]
|
|
228
255
|
},
|
|
229
256
|
l.field
|
|
230
257
|
);
|
|
231
258
|
}),
|
|
232
|
-
/* @__PURE__ */
|
|
233
|
-
|
|
234
|
-
/* @__PURE__ */
|
|
235
|
-
/* @__PURE__ */
|
|
236
|
-
/* @__PURE__ */
|
|
237
|
-
|
|
259
|
+
/* @__PURE__ */ n(M, { label: b.label, color: b.color }),
|
|
260
|
+
g && /* @__PURE__ */ f(me, { children: [
|
|
261
|
+
/* @__PURE__ */ n(pe, { asChild: !0, children: /* @__PURE__ */ n("span", { className: "cursor-default text-[11px] text-slate-400 underline decoration-dotted", children: g.label }) }),
|
|
262
|
+
/* @__PURE__ */ f(be, { side: "top", className: "text-[12px]", children: [
|
|
263
|
+
/* @__PURE__ */ n("p", { className: "font-medium", children: g.label }),
|
|
264
|
+
N && /* @__PURE__ */ n("p", { className: "text-muted-foreground", children: Y(N) })
|
|
238
265
|
] })
|
|
239
266
|
] })
|
|
240
267
|
]
|
|
241
268
|
}
|
|
242
269
|
),
|
|
243
|
-
/* @__PURE__ */
|
|
244
|
-
!p && /* @__PURE__ */
|
|
270
|
+
/* @__PURE__ */ f("span", { className: "flex flex-wrap items-center gap-1.5", children: [
|
|
271
|
+
!p && /* @__PURE__ */ n(
|
|
245
272
|
"span",
|
|
246
273
|
{
|
|
247
274
|
className: "text-[11px] text-slate-400",
|
|
248
|
-
title:
|
|
275
|
+
title: k,
|
|
276
|
+
"data-review-view-only": !0,
|
|
249
277
|
children: "View only"
|
|
250
278
|
}
|
|
251
279
|
),
|
|
252
|
-
p &&
|
|
253
|
-
const
|
|
254
|
-
return /* @__PURE__ */
|
|
280
|
+
p && t.status.options.map((l) => {
|
|
281
|
+
const c = !e.mixedStatus && String(e.uniformStatus) === l.value, i = I[l.color] ?? I.slate, q = S === e.key;
|
|
282
|
+
return /* @__PURE__ */ n(
|
|
255
283
|
"button",
|
|
256
284
|
{
|
|
257
285
|
type: "button",
|
|
258
|
-
disabled:
|
|
259
|
-
onClick: () =>
|
|
286
|
+
disabled: q || c,
|
|
287
|
+
onClick: () => re(e, l),
|
|
260
288
|
className: "rounded-md border px-2.5 py-1 text-[11px] font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50",
|
|
261
289
|
style: {
|
|
262
|
-
backgroundColor:
|
|
263
|
-
borderColor: `${
|
|
264
|
-
color:
|
|
290
|
+
backgroundColor: c ? `${i}22` : "transparent",
|
|
291
|
+
borderColor: `${i}55`,
|
|
292
|
+
color: i
|
|
265
293
|
},
|
|
266
|
-
children:
|
|
294
|
+
children: q ? "…" : l.label
|
|
267
295
|
},
|
|
268
296
|
l.value
|
|
269
297
|
);
|
|
270
298
|
})
|
|
271
299
|
] })
|
|
272
300
|
] }),
|
|
273
|
-
|
|
274
|
-
/* @__PURE__ */
|
|
275
|
-
|
|
301
|
+
R[e.key] && /* @__PURE__ */ f("p", { className: "flex items-center gap-1 px-3 pb-2 text-[11px] text-red-600", children: [
|
|
302
|
+
/* @__PURE__ */ n(se, { className: "h-3 w-3 shrink-0" }),
|
|
303
|
+
R[e.key]
|
|
276
304
|
] }),
|
|
277
|
-
o && /* @__PURE__ */
|
|
278
|
-
/* @__PURE__ */
|
|
279
|
-
|
|
280
|
-
|
|
305
|
+
o && /* @__PURE__ */ n("div", { className: "overflow-x-auto border-t border-slate-100 dark:border-border/50", children: /* @__PURE__ */ f("table", { className: "w-full border-collapse text-[12px]", children: [
|
|
306
|
+
/* @__PURE__ */ n("thead", { children: /* @__PURE__ */ f("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: [
|
|
307
|
+
z.map((l) => /* @__PURE__ */ n("th", { className: "px-2.5 py-1.5 font-medium", children: l.label }, l.field)),
|
|
308
|
+
V && /* @__PURE__ */ n("th", { className: "px-2.5 py-1.5 font-medium", children: "Match" })
|
|
281
309
|
] }) }),
|
|
282
|
-
/* @__PURE__ */
|
|
283
|
-
var
|
|
284
|
-
return /* @__PURE__ */
|
|
310
|
+
/* @__PURE__ */ n("tbody", { children: e.rows.map((l) => {
|
|
311
|
+
var c;
|
|
312
|
+
return /* @__PURE__ */ f(
|
|
285
313
|
"tr",
|
|
286
314
|
{
|
|
287
315
|
className: "border-b border-slate-100 last:border-b-0 dark:border-border/50",
|
|
288
316
|
children: [
|
|
289
|
-
|
|
317
|
+
z.map((i) => /* @__PURE__ */ n(
|
|
290
318
|
"td",
|
|
291
319
|
{
|
|
292
320
|
className: "px-2.5 py-1.5 text-slate-600 dark:text-slate-300",
|
|
293
|
-
children:
|
|
321
|
+
children: i.format === "flag" ? H(l.values[i.field]) ? /* @__PURE__ */ n(M, { label: i.label, color: i.color ?? "amber" }) : "—" : A(l.values[i.field], i.format)
|
|
294
322
|
},
|
|
295
|
-
|
|
323
|
+
i.field
|
|
296
324
|
)),
|
|
297
|
-
|
|
325
|
+
V && /* @__PURE__ */ n("td", { className: "px-2.5 py-1.5", children: /* @__PURE__ */ n("span", { className: "flex flex-wrap gap-1", children: (((c = j(l.id)) == null ? void 0 : c.chips) ?? []).map((i) => /* @__PURE__ */ n(
|
|
298
326
|
"span",
|
|
299
327
|
{
|
|
300
|
-
title:
|
|
301
|
-
className:
|
|
302
|
-
children:
|
|
328
|
+
title: i.title,
|
|
329
|
+
className: i.tone === "ok" ? "rounded-full bg-emerald-50 px-2 py-0.5 text-[10.5px] font-medium text-emerald-700 dark:bg-emerald-500/10 dark:text-emerald-400" : i.tone === "danger" ? "rounded-full bg-red-50 px-2 py-0.5 text-[10.5px] font-medium text-red-700 dark:bg-red-500/10 dark:text-red-400" : i.tone === "warn" ? "rounded-full bg-amber-50 px-2 py-0.5 text-[10.5px] font-medium text-amber-700 dark:bg-amber-500/10 dark:text-amber-400" : "rounded-full bg-slate-100 px-2 py-0.5 text-[10.5px] font-medium text-slate-600 dark:bg-slate-800 dark:text-slate-300",
|
|
330
|
+
children: i.label
|
|
303
331
|
},
|
|
304
|
-
|
|
332
|
+
i.label
|
|
305
333
|
)) }) })
|
|
306
334
|
]
|
|
307
335
|
},
|
|
@@ -314,83 +342,87 @@ function Ne({
|
|
|
314
342
|
e.key
|
|
315
343
|
);
|
|
316
344
|
}),
|
|
317
|
-
|
|
345
|
+
m && /* @__PURE__ */ n(
|
|
318
346
|
"div",
|
|
319
347
|
{
|
|
320
348
|
className: "fixed inset-0 z-[130] flex items-center justify-center bg-black/40 p-4",
|
|
321
|
-
onClick: () =>
|
|
349
|
+
onClick: () => $(null),
|
|
322
350
|
onKeyDown: (e) => {
|
|
323
|
-
e.key === "Escape" && (e.stopPropagation(),
|
|
351
|
+
e.key === "Escape" && (e.stopPropagation(), $(null));
|
|
324
352
|
},
|
|
325
|
-
children: /* @__PURE__ */
|
|
353
|
+
children: /* @__PURE__ */ f(
|
|
326
354
|
"div",
|
|
327
355
|
{
|
|
328
356
|
role: "dialog",
|
|
329
357
|
"aria-modal": "true",
|
|
330
358
|
"aria-labelledby": "review-confirm-title",
|
|
331
|
-
"data-review-confirm":
|
|
359
|
+
"data-review-confirm": m.option.value,
|
|
332
360
|
className: "w-full max-w-md rounded-lg border border-slate-200 bg-white p-4 shadow-xl dark:border-border dark:bg-card",
|
|
333
361
|
onClick: (e) => e.stopPropagation(),
|
|
334
362
|
children: [
|
|
335
|
-
/* @__PURE__ */
|
|
363
|
+
/* @__PURE__ */ n(
|
|
336
364
|
"p",
|
|
337
365
|
{
|
|
338
366
|
id: "review-confirm-title",
|
|
339
367
|
className: "text-[13px] font-medium text-slate-700 dark:text-slate-200",
|
|
340
|
-
children:
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
]
|
|
368
|
+
children: ye(
|
|
369
|
+
m.option,
|
|
370
|
+
X(m.group, G),
|
|
371
|
+
t.group_noun
|
|
372
|
+
)
|
|
346
373
|
}
|
|
347
374
|
),
|
|
348
|
-
/* @__PURE__ */
|
|
349
|
-
|
|
350
|
-
"
|
|
351
|
-
b.group.count === 1 ? "" : "s",
|
|
352
|
-
b.group.sum != null ? ` · ${D(b.group.sum, r.aggregate_sum_format ?? "number")}` : ""
|
|
375
|
+
/* @__PURE__ */ f("p", { className: "mt-1 rounded-md border border-slate-200 bg-slate-50 px-2.5 py-1.5 text-[12px] tabular-nums text-slate-600 dark:border-border dark:bg-white/[0.03] dark:text-slate-300", children: [
|
|
376
|
+
J(m.group.count, t.row_noun),
|
|
377
|
+
m.group.sum != null ? ` · ${A(m.group.sum, t.aggregate_sum_format ?? "number")}` : ""
|
|
353
378
|
] }),
|
|
354
|
-
/* @__PURE__ */
|
|
355
|
-
|
|
379
|
+
/* @__PURE__ */ n(
|
|
380
|
+
"p",
|
|
381
|
+
{
|
|
382
|
+
className: "mt-1.5 text-[11px] text-slate-500 dark:text-slate-400",
|
|
383
|
+
"data-review-confirm-notice": !0,
|
|
384
|
+
children: m.option.confirm_notice ? `${m.option.confirm_notice}${m.option.require_note ? " A reason is required." : ""}` : m.option.require_note ? "A reason is required for this decision. It is recorded with the record." : "Nothing changes until you confirm. A note is optional and is recorded with the decision."
|
|
385
|
+
}
|
|
386
|
+
),
|
|
387
|
+
/* @__PURE__ */ n(
|
|
356
388
|
"textarea",
|
|
357
389
|
{
|
|
358
|
-
value:
|
|
359
|
-
onChange: (e) =>
|
|
390
|
+
value: E,
|
|
391
|
+
onChange: (e) => L(e.target.value),
|
|
360
392
|
rows: 3,
|
|
361
393
|
autoFocus: !0,
|
|
362
|
-
"aria-label":
|
|
394
|
+
"aria-label": m.option.require_note ? "Reason" : "Note (optional)",
|
|
363
395
|
"data-review-confirm-note": !0,
|
|
364
396
|
className: "mt-2 w-full rounded-md border border-slate-200 bg-white px-2.5 py-1.5 text-[12px] text-slate-700 outline-none focus:border-nvr-cyan dark:border-border dark:bg-background dark:text-slate-200",
|
|
365
|
-
placeholder:
|
|
397
|
+
placeholder: m.option.require_note ? "Why is this being rejected?" : "Note (optional)"
|
|
366
398
|
}
|
|
367
399
|
),
|
|
368
|
-
/* @__PURE__ */
|
|
369
|
-
/* @__PURE__ */
|
|
400
|
+
/* @__PURE__ */ f("div", { className: "mt-3 flex items-center justify-end gap-1.5", children: [
|
|
401
|
+
/* @__PURE__ */ n(
|
|
370
402
|
"button",
|
|
371
403
|
{
|
|
372
404
|
type: "button",
|
|
373
405
|
"data-review-confirm-cancel": !0,
|
|
374
|
-
onClick: () =>
|
|
406
|
+
onClick: () => $(null),
|
|
375
407
|
className: "rounded px-2.5 py-1 text-[11px] text-slate-500 hover:bg-slate-100 dark:hover:bg-muted",
|
|
376
408
|
children: "Cancel"
|
|
377
409
|
}
|
|
378
410
|
),
|
|
379
|
-
/* @__PURE__ */
|
|
411
|
+
/* @__PURE__ */ n(
|
|
380
412
|
"button",
|
|
381
413
|
{
|
|
382
414
|
type: "button",
|
|
383
415
|
"data-review-confirm-submit": !0,
|
|
384
|
-
disabled: !!
|
|
416
|
+
disabled: !!m.option.require_note && !E.trim(),
|
|
385
417
|
onClick: () => {
|
|
386
|
-
const e =
|
|
387
|
-
|
|
418
|
+
const e = m;
|
|
419
|
+
$(null), le(e.group, e.option, E.trim() || null);
|
|
388
420
|
},
|
|
389
|
-
className:
|
|
421
|
+
className: B(
|
|
390
422
|
"rounded px-3 py-1 text-[11px] font-medium hover:brightness-110 disabled:opacity-50",
|
|
391
|
-
|
|
423
|
+
m.option.require_note ? "bg-red-600 text-white" : "bg-nvr-cyan text-white"
|
|
392
424
|
),
|
|
393
|
-
children:
|
|
425
|
+
children: m.option.label
|
|
394
426
|
}
|
|
395
427
|
)
|
|
396
428
|
] })
|
|
@@ -402,7 +434,10 @@ function Ne({
|
|
|
402
434
|
] }) });
|
|
403
435
|
}
|
|
404
436
|
export {
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
437
|
+
Ce as ReviewListWidget,
|
|
438
|
+
I as STATUS_COLOR_HEX,
|
|
439
|
+
ye as confirmTitle,
|
|
440
|
+
J as countLabel,
|
|
441
|
+
A as formatValue,
|
|
442
|
+
X as groupName
|
|
408
443
|
};
|