@nivaro/react 0.3.63 → 0.3.65
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 +54 -5
- package/dist/shared/components/CollectionBrowserView.js +3029 -2947
- package/dist/shared/components/ConformanceView.js +235 -221
- package/dist/shared/components/DataTable.js +478 -459
- package/dist/shared/components/ItemEditForm.js +4469 -4266
- package/dist/shared/components/PageRenderer.js +146 -138
- package/dist/shared/components/RecordDrilldownSheet.js +73 -65
- package/dist/shared/components/bulk/BulkActionButtons.js +72 -72
- package/dist/shared/components/bulk/BulkFieldUpdate.js +114 -103
- package/dist/shared/components/bulk/BulkFieldUpdateButton.js +73 -0
- package/dist/shared/components/bulk/bulk-field-options.js +29 -23
- package/dist/shared/components/integrations/IntegrationObligationsView.js +191 -173
- package/dist/shared/components/integrations/IntegrationStatusLines.js +101 -85
- package/dist/shared/components/integrations/RecordIntegrationPreview.js +11 -9
- package/dist/shared/components/integrations/SendCurrentData.js +126 -0
- package/dist/shared/components/item-edit/CatalogPickerField.js +1530 -1437
- package/dist/shared/components/item-edit/FieldRenderer.js +49 -45
- package/dist/shared/components/item-edit/FieldRow.js +413 -403
- package/dist/shared/components/item-edit/InlineTableField.js +2903 -2816
- package/dist/shared/components/item-edit/M2MCombobox.js +172 -168
- package/dist/shared/components/item-edit/MidairCollisionDialog.js +341 -114
- package/dist/shared/components/item-edit/NestedRelationEditor.js +171 -163
- package/dist/shared/components/item-edit/PlanGrid.js +783 -724
- package/dist/shared/components/item-edit/QuickCreateButton.js +291 -224
- package/dist/shared/components/item-edit/RecordInsights.js +113 -111
- package/dist/shared/components/item-edit/RecordLiveSync.js +4 -1
- package/dist/shared/components/item-edit/RelationCombobox.js +332 -314
- package/dist/shared/components/item-edit/cascade-clear-notice.js +52 -0
- package/dist/shared/components/item-edit/collision-format.js +37 -0
- package/dist/shared/components/item-edit/field-a11y.js +25 -0
- package/dist/shared/components/item-edit/line-merge.js +58 -0
- package/dist/shared/components/item-edit/line-midair.js +94 -87
- package/dist/shared/components/item-edit/move-guard.js +17 -0
- package/dist/shared/components/item-edit/picker-search.js +22 -15
- package/dist/shared/components/item-edit/rail-width.js +8 -0
- package/dist/shared/components/monitoring/InactiveUserLinksView.js +322 -291
- package/dist/shared/components/panels/AccessDeniedPanel.js +96 -55
- package/dist/shared/components/panels/CommentPanel.js +142 -136
- package/dist/shared/components/panels/ItemLockBanner.js +246 -240
- package/dist/shared/components/panels/PipelinePanel.js +1366 -1194
- package/dist/shared/components/panels/RevisionsPanel.js +106 -102
- package/dist/shared/components/panels/SlaBreachBanner.js +16 -20
- package/dist/shared/components/panels/SlaClock.js +90 -68
- package/dist/shared/components/queue/QueueItemSheet.js +94 -87
- package/dist/shared/components/queue/QueueWorklist.js +1502 -1354
- package/dist/shared/components/queue/worklist-csv.js +75 -0
- package/dist/shared/components/queue/worklist-helpers.js +20 -0
- package/dist/shared/components/widgets/ReviewListWidget.js +226 -207
- package/dist/shared/lib/bulk-copy.js +17 -0
- package/dist/shared/lib/cbv-export.js +122 -0
- package/dist/shared/lib/delete-offer.js +13 -0
- package/dist/shared/lib/error-hints.js +1 -0
- package/dist/shared/lib/leave-guard.js +41 -26
- package/dist/shared/lib/list-link.js +72 -56
- package/dist/shared/lib/live-queries.js +32 -30
- package/dist/shared/lib/moved-notice.js +25 -0
- package/dist/shared/lib/notification-target.js +56 -54
- package/dist/shared/lib/obligation-banner.js +11 -8
- package/dist/shared/lib/obligation-reason-text.js +6 -6
- package/dist/shared/lib/sort-cycle.js +6 -0
- package/dist/shared/lib/summary-mode.js +59 -41
- package/package.json +1 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useQuery as
|
|
1
|
+
import { jsx as s, jsxs as w } from "react/jsx-runtime";
|
|
2
|
+
import { useQuery as ae } from "@tanstack/react-query";
|
|
3
3
|
import { ChevronRight as oe, AlertCircle as ie } from "lucide-react";
|
|
4
|
-
import { useState as
|
|
4
|
+
import { useState as F, useMemo as H } from "react";
|
|
5
5
|
import { useNivaroClient as de, useItemEditAuth as ue } from "../../context.js";
|
|
6
6
|
import { useBackCloses as ce } from "../../lib/back-closes.js";
|
|
7
|
-
import { post as
|
|
8
|
-
import { formatDateTime as
|
|
7
|
+
import { post as Q, patch as me } from "../../lib/commands.js";
|
|
8
|
+
import { formatDateTime as te, cn as X, formatDate as pe } from "../../lib/utils.js";
|
|
9
9
|
import { TooltipProvider as be, Tooltip as fe, TooltipTrigger as xe, TooltipContent as he } from "../ui/tooltip.js";
|
|
10
|
-
function
|
|
10
|
+
function J(r) {
|
|
11
11
|
return r === !0 || r === 1 || r === "1" || r === "true";
|
|
12
12
|
}
|
|
13
|
-
function
|
|
13
|
+
function O(r, t) {
|
|
14
14
|
if (r == null || r === "") return "—";
|
|
15
15
|
if (t === "currency" || t === "number") {
|
|
16
16
|
const a = Number(r);
|
|
@@ -18,11 +18,11 @@ function F(r, t) {
|
|
|
18
18
|
}
|
|
19
19
|
if (t === "date" || t === "datetime") {
|
|
20
20
|
const a = new Date(r);
|
|
21
|
-
return Number.isNaN(a.getTime()) ? String(r) : t === "date" ? pe(typeof r == "string" ? r : a) :
|
|
21
|
+
return Number.isNaN(a.getTime()) ? String(r) : t === "date" ? pe(typeof r == "string" ? r : a) : te(a);
|
|
22
22
|
}
|
|
23
23
|
return String(r);
|
|
24
24
|
}
|
|
25
|
-
const
|
|
25
|
+
const U = {
|
|
26
26
|
green: "#16a34a",
|
|
27
27
|
red: "#dc2626",
|
|
28
28
|
amber: "#d97706",
|
|
@@ -37,9 +37,9 @@ function we(r) {
|
|
|
37
37
|
border: `1px solid ${r ? `${r}44` : "#e2e8f0"}`
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
|
-
function
|
|
41
|
-
const a = t ?
|
|
42
|
-
return /* @__PURE__ */
|
|
40
|
+
function L({ label: r, color: t }) {
|
|
41
|
+
const a = t ? U[t] ?? null : null;
|
|
42
|
+
return /* @__PURE__ */ s(
|
|
43
43
|
"span",
|
|
44
44
|
{
|
|
45
45
|
className: "inline-flex items-center gap-1.5 rounded-full px-2 py-0.5 text-[11px] font-medium",
|
|
@@ -48,87 +48,105 @@ function I({ label: r, color: t }) {
|
|
|
48
48
|
}
|
|
49
49
|
);
|
|
50
50
|
}
|
|
51
|
-
function
|
|
51
|
+
function ke(r, t) {
|
|
52
52
|
if (r == null || r === "")
|
|
53
53
|
return t.empty_label ? { label: t.empty_label, color: t.empty_color ?? "blue" } : { label: "—", color: null };
|
|
54
54
|
const a = t.options.find((b) => b.value === String(r));
|
|
55
55
|
return a ? { label: a.status_label || a.label, color: a.color } : { label: String(r), color: null };
|
|
56
56
|
}
|
|
57
|
-
function
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
const
|
|
61
|
-
|
|
57
|
+
function ye(r, t) {
|
|
58
|
+
if (!(t != null && t.field)) return r;
|
|
59
|
+
const a = t.direction === "desc" ? -1 : 1, b = (o) => {
|
|
60
|
+
const n = o.values[t.field];
|
|
61
|
+
if (n == null || n === "") return null;
|
|
62
|
+
const i = typeof n == "number" ? n : Number(n);
|
|
63
|
+
if (Number.isFinite(i)) return i;
|
|
64
|
+
const c = Date.parse(String(n));
|
|
65
|
+
return Number.isNaN(c) ? String(n) : c;
|
|
66
|
+
};
|
|
67
|
+
return r.map((o, n) => ({ r: o, i: n, k: b(o) })).sort((o, n) => {
|
|
68
|
+
if (o.k == null || n.k == null)
|
|
69
|
+
return o.k == null && n.k == null ? o.i - n.i : o.k == null ? 1 : -1;
|
|
70
|
+
const i = typeof o.k == "number" && typeof n.k == "number" ? o.k - n.k : String(o.k).localeCompare(String(n.k), void 0, { numeric: !0 });
|
|
71
|
+
return i === 0 ? o.i - n.i : i * a;
|
|
72
|
+
}).map((o) => o.r);
|
|
73
|
+
}
|
|
74
|
+
function ge(r, t, a) {
|
|
75
|
+
const b = /* @__PURE__ */ new Map();
|
|
76
|
+
for (const n of r.rows) {
|
|
77
|
+
const i = String(n.group ?? ""), c = b.get(i);
|
|
78
|
+
c ? c.push(n) : b.set(i, [n]);
|
|
62
79
|
}
|
|
63
|
-
const
|
|
64
|
-
const
|
|
65
|
-
let
|
|
66
|
-
return t &&
|
|
80
|
+
const o = Array.from(b.entries()).map(([n, i]) => {
|
|
81
|
+
const c = ye(i, a), q = new Set(c.map((T) => String(T.status ?? ""))).size > 1, G = q ? null : c[0].status;
|
|
82
|
+
let j = null;
|
|
83
|
+
return t && c.every((_) => t in _.values) && (j = c.reduce((_, P) => _ + (Number(P.values[t]) || 0), 0)), { key: n, rows: c, count: c.length, sum: j, uniformStatus: G, mixedStatus: q };
|
|
67
84
|
});
|
|
68
|
-
return
|
|
85
|
+
return o.sort((n, i) => n.key.localeCompare(i.key, void 0, { numeric: !0 })), o;
|
|
69
86
|
}
|
|
70
|
-
function
|
|
87
|
+
function Y(r, t, a) {
|
|
71
88
|
let b = null;
|
|
72
|
-
for (const
|
|
73
|
-
const
|
|
74
|
-
if (
|
|
75
|
-
const
|
|
76
|
-
Number.isFinite(
|
|
89
|
+
for (const o of r) {
|
|
90
|
+
const n = o.values[t];
|
|
91
|
+
if (n == null || n === "") continue;
|
|
92
|
+
const i = typeof n == "number" ? n : Date.parse(String(n)), c = Number.isNaN(i) ? Number(n) : i;
|
|
93
|
+
Number.isFinite(c) && (b == null || (a ? c > b : c < b)) && (b = c);
|
|
77
94
|
}
|
|
78
95
|
return b;
|
|
79
96
|
}
|
|
80
|
-
function
|
|
81
|
-
const a = r.rows[0], b = (
|
|
82
|
-
const
|
|
83
|
-
if (!
|
|
84
|
-
const
|
|
85
|
-
return
|
|
97
|
+
function Z(r, t) {
|
|
98
|
+
const a = r.rows[0], b = (o) => {
|
|
99
|
+
const n = t.find((c) => c.role === o);
|
|
100
|
+
if (!n || !a) return null;
|
|
101
|
+
const i = a.values[n.field];
|
|
102
|
+
return i == null || i === "" ? null : `${n.prefix ?? ""}${O(i, n.format)}`;
|
|
86
103
|
};
|
|
87
104
|
return { title: b("title") ?? (r.key || "—"), subtitle: b("subtitle") };
|
|
88
105
|
}
|
|
89
|
-
function
|
|
106
|
+
function ee(r, t) {
|
|
90
107
|
const a = (t == null ? void 0 : t.trim()) || "row";
|
|
91
108
|
return `${r} ${a}${r === 1 ? "" : "s"}`;
|
|
92
109
|
}
|
|
93
|
-
function
|
|
94
|
-
|
|
95
|
-
|
|
110
|
+
function Ne(r, t, a) {
|
|
111
|
+
var i;
|
|
112
|
+
const o = `${a != null && a.trim() ? `${a.trim()} ` : ""}${t.title}${t.subtitle ? ` · ${t.subtitle}` : ""}`, n = (i = r.confirm_title) == null ? void 0 : i.trim();
|
|
113
|
+
return n != null && n.includes("{name}") ? n.replace("{name}", o) : `${r.label} ${o}?`;
|
|
96
114
|
}
|
|
97
|
-
function
|
|
115
|
+
function Fe({
|
|
98
116
|
data: r,
|
|
99
117
|
config: t,
|
|
100
118
|
loading: a,
|
|
101
119
|
error: b,
|
|
102
|
-
onRefetch:
|
|
103
|
-
hostRecordId:
|
|
104
|
-
emptyLabel:
|
|
120
|
+
onRefetch: o,
|
|
121
|
+
hostRecordId: n,
|
|
122
|
+
emptyLabel: i
|
|
105
123
|
}) {
|
|
106
|
-
const
|
|
107
|
-
ce(() =>
|
|
108
|
-
const
|
|
109
|
-
const e = r ?
|
|
110
|
-
if (!(
|
|
111
|
-
const
|
|
112
|
-
return [...e].sort((
|
|
113
|
-
const
|
|
114
|
-
return
|
|
124
|
+
const c = de(), { userId: E } = ue(), [q, G] = F(() => /* @__PURE__ */ new Set()), [j, T] = F(null), [_, P] = F({}), [f, S] = F(null), [M, V] = F("");
|
|
125
|
+
ce(() => S(null), f != null);
|
|
126
|
+
const z = H(() => {
|
|
127
|
+
const e = r ? ge(r, t.aggregate_sum, t.line_sort) : [], d = t.group_sort;
|
|
128
|
+
if (!(d != null && d.field)) return e;
|
|
129
|
+
const x = d.direction === "desc";
|
|
130
|
+
return [...e].sort((k, m) => {
|
|
131
|
+
const h = Y(k.rows, d.field, x), y = Y(m.rows, d.field, x);
|
|
132
|
+
return h == null && y == null ? 0 : h == null ? 1 : y == null ? -1 : x ? y - h : h - y;
|
|
115
133
|
});
|
|
116
|
-
}, [r, t.aggregate_sum, t.group_sort]),
|
|
117
|
-
queryKey: ["review-list-enrich", t.enrich_endpoint ?? "",
|
|
118
|
-
queryFn: () =>
|
|
119
|
-
|
|
134
|
+
}, [r, t.aggregate_sum, t.group_sort, t.line_sort]), R = H(() => ((r == null ? void 0 : r.rows) ?? []).map((e) => String(e.id)), [r]), { data: A } = ae({
|
|
135
|
+
queryKey: ["review-list-enrich", t.enrich_endpoint ?? "", R.join(",")],
|
|
136
|
+
queryFn: () => c.request(
|
|
137
|
+
Q(t.enrich_endpoint, { ids: R })
|
|
120
138
|
).then((e) => {
|
|
121
|
-
var
|
|
122
|
-
return ((
|
|
139
|
+
var d;
|
|
140
|
+
return ((d = e == null ? void 0 : e.data) == null ? void 0 : d.rows) ?? {};
|
|
123
141
|
}).catch(() => ({})),
|
|
124
|
-
enabled: !!t.enrich_endpoint &&
|
|
142
|
+
enabled: !!t.enrich_endpoint && R.length > 0,
|
|
125
143
|
staleTime: 3e4
|
|
126
|
-
}),
|
|
127
|
-
var
|
|
128
|
-
return (((
|
|
129
|
-
}), re =
|
|
144
|
+
}), $ = (e) => A == null ? void 0 : A[String(e)], B = !!A && Object.values(A).some((e) => {
|
|
145
|
+
var d;
|
|
146
|
+
return (((d = e.chips) == null ? void 0 : d.length) ?? 0) > 0;
|
|
147
|
+
}), re = z.length === 1;
|
|
130
148
|
if (a)
|
|
131
|
-
return /* @__PURE__ */
|
|
149
|
+
return /* @__PURE__ */ s("div", { className: "space-y-2", children: [0, 1].map((e) => /* @__PURE__ */ s(
|
|
132
150
|
"div",
|
|
133
151
|
{
|
|
134
152
|
className: "animate-pulse h-12 rounded-md bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]"
|
|
@@ -136,221 +154,221 @@ function De({
|
|
|
136
154
|
e
|
|
137
155
|
)) });
|
|
138
156
|
if (b)
|
|
139
|
-
return /* @__PURE__ */
|
|
157
|
+
return /* @__PURE__ */ s("p", { className: "text-[12px] text-red-500", children: b });
|
|
140
158
|
if (!r || r.rows.length === 0)
|
|
141
|
-
return /* @__PURE__ */
|
|
142
|
-
const
|
|
143
|
-
|
|
144
|
-
const
|
|
145
|
-
return
|
|
159
|
+
return /* @__PURE__ */ s("p", { className: "text-[12px] italic text-slate-400", children: i ? `No ${i.toLowerCase()} yet` : "Nothing here yet" });
|
|
160
|
+
const ne = (e) => {
|
|
161
|
+
G((d) => {
|
|
162
|
+
const x = new Set(d);
|
|
163
|
+
return x.has(e) ? x.delete(e) : x.add(e), x;
|
|
146
164
|
});
|
|
147
|
-
},
|
|
148
|
-
var
|
|
149
|
-
return (
|
|
150
|
-
}).find((
|
|
151
|
-
|
|
152
|
-
},
|
|
153
|
-
|
|
154
|
-
let
|
|
165
|
+
}, K = (e, d) => e.rows.map((x) => {
|
|
166
|
+
var k, m, h;
|
|
167
|
+
return (h = (m = (k = $(x.id)) == null ? void 0 : k.confirm_notices) == null ? void 0 : m[d.value]) == null ? void 0 : h.trim();
|
|
168
|
+
}).find((x) => !!x) ?? d.confirm_notice ?? null, le = (e, d) => {
|
|
169
|
+
V(""), S({ group: e, option: d });
|
|
170
|
+
}, se = async (e, d, x) => {
|
|
171
|
+
T(e.key);
|
|
172
|
+
let k = null;
|
|
155
173
|
if (t.status.action_endpoint)
|
|
156
174
|
try {
|
|
157
|
-
await
|
|
158
|
-
|
|
159
|
-
ids: e.rows.map((
|
|
160
|
-
status:
|
|
175
|
+
await c.request(
|
|
176
|
+
Q(t.status.action_endpoint, {
|
|
177
|
+
ids: e.rows.map((m) => m.id),
|
|
178
|
+
status: d.value,
|
|
161
179
|
// The status each row showed: the endpoint may refuse (409) rows
|
|
162
180
|
// someone changed since this list loaded instead of overwriting
|
|
163
181
|
// them. The refetch below shows what they are now.
|
|
164
182
|
expected: Object.fromEntries(
|
|
165
|
-
e.rows.map((
|
|
183
|
+
e.rows.map((m) => [String(m.id), m.status == null ? null : String(m.status)])
|
|
166
184
|
),
|
|
167
|
-
...
|
|
168
|
-
...
|
|
185
|
+
...x ? { note: x } : {},
|
|
186
|
+
...n != null && n !== "" ? { workflow_id: Number(n) } : {}
|
|
169
187
|
})
|
|
170
188
|
);
|
|
171
|
-
} catch (
|
|
172
|
-
const
|
|
173
|
-
|
|
189
|
+
} catch (m) {
|
|
190
|
+
const h = m == null ? void 0 : m.response;
|
|
191
|
+
k = (h == null ? void 0 : h.error) ?? "Failed to update";
|
|
174
192
|
}
|
|
175
193
|
else {
|
|
176
|
-
const
|
|
194
|
+
const m = t.status.stamp_date_field ? (/* @__PURE__ */ new Date()).toISOString() : void 0, y = (await Promise.all(
|
|
177
195
|
e.rows.map(async (N) => {
|
|
178
|
-
const g = { [t.status.field]:
|
|
179
|
-
t.status.stamp_user_field &&
|
|
196
|
+
const g = { [t.status.field]: d.value };
|
|
197
|
+
t.status.stamp_user_field && E && (g[t.status.stamp_user_field] = E), t.status.stamp_date_field && (g[t.status.stamp_date_field] = m), x && (g._change_reason = x);
|
|
180
198
|
try {
|
|
181
|
-
return await
|
|
182
|
-
} catch (
|
|
183
|
-
const v =
|
|
199
|
+
return await c.request(me(`/items/${t.collection}/${N.id}`, g)), { ok: !0 };
|
|
200
|
+
} catch (C) {
|
|
201
|
+
const v = C == null ? void 0 : C.response;
|
|
184
202
|
return { ok: !1, error: (v == null ? void 0 : v.error) ?? "Failed to update" };
|
|
185
203
|
}
|
|
186
204
|
})
|
|
187
205
|
)).filter((N) => !N.ok);
|
|
188
|
-
|
|
206
|
+
y.length > 0 && (k = `${y.length} of ${e.rows.length} row(s) failed to update`);
|
|
189
207
|
}
|
|
190
|
-
|
|
191
|
-
const
|
|
192
|
-
return
|
|
193
|
-
}),
|
|
194
|
-
},
|
|
195
|
-
return /* @__PURE__ */
|
|
196
|
-
r.truncated && /* @__PURE__ */
|
|
197
|
-
|
|
198
|
-
const
|
|
199
|
-
var
|
|
200
|
-
return ((
|
|
201
|
-
}),
|
|
208
|
+
T(null), P((m) => {
|
|
209
|
+
const h = { ...m };
|
|
210
|
+
return k ? h[e.key] = k : delete h[e.key], h;
|
|
211
|
+
}), o();
|
|
212
|
+
}, W = r.columns.line_columns, I = r.columns.group_meta;
|
|
213
|
+
return /* @__PURE__ */ s(be, { delayDuration: 200, children: /* @__PURE__ */ w("div", { className: "space-y-2", children: [
|
|
214
|
+
r.truncated && /* @__PURE__ */ s("p", { className: "text-[11px] text-amber-600 dark:text-amber-400", children: "Showing first 2000 rows — some rows may be missing." }),
|
|
215
|
+
z.map((e) => {
|
|
216
|
+
const d = re ? !q.has(e.key) : q.has(e.key), x = e.rows.every((l) => {
|
|
217
|
+
var p;
|
|
218
|
+
return ((p = $(l.id)) == null ? void 0 : p.can_act) !== !1;
|
|
219
|
+
}), k = e.rows.map((l) => {
|
|
220
|
+
var p;
|
|
221
|
+
return (p = $(l.id)) == null ? void 0 : p.reason;
|
|
222
|
+
}).find((l) => !!l) ?? "Only the workflow contact chain (or the PO requestor for invalid holds) can decide this", m = e.rows.map((l) => {
|
|
223
|
+
var p, u;
|
|
224
|
+
return (u = (p = $(l.id)) == null ? void 0 : p.note) == null ? void 0 : u.trim();
|
|
225
|
+
}).find((l) => !!l) ?? null, h = Z(e, I), y = e.mixedStatus ? { label: "Mixed", color: null } : ke(e.uniformStatus, t.status), N = e.rows[0], g = N.stamp_user, C = N.stamp_date, v = e.rows.reduce((l, p) => {
|
|
202
226
|
var u;
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
return (i = (u = S(l.id)) == null ? void 0 : u.note) == null ? void 0 : i.trim();
|
|
207
|
-
}).find((l) => !!l) ?? null, p = Y(e, M), k = e.mixedStatus ? { label: "Mixed", color: null } : ye(e.uniformStatus, t.status), N = e.rows[0], g = N.stamp_user, $ = N.stamp_date, v = e.rows.reduce((l, u) => {
|
|
208
|
-
var i;
|
|
209
|
-
for (const A of ((i = S(u.id)) == null ? void 0 : i.chips) ?? []) {
|
|
210
|
-
if (A.tone === "danger") return "danger";
|
|
211
|
-
A.tone === "warn" && l == null && (l = "warn");
|
|
227
|
+
for (const D of ((u = $(p.id)) == null ? void 0 : u.chips) ?? []) {
|
|
228
|
+
if (D.tone === "danger") return "danger";
|
|
229
|
+
D.tone === "warn" && l == null && (l = "warn");
|
|
212
230
|
}
|
|
213
231
|
return l;
|
|
214
232
|
}, null);
|
|
215
|
-
return /* @__PURE__ */
|
|
233
|
+
return /* @__PURE__ */ w(
|
|
216
234
|
"div",
|
|
217
235
|
{
|
|
218
236
|
"data-review-group": e.key,
|
|
219
237
|
"data-review-tone": v ?? void 0,
|
|
220
|
-
className:
|
|
238
|
+
className: X(
|
|
221
239
|
"rounded-md border",
|
|
222
240
|
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"
|
|
223
241
|
),
|
|
224
242
|
children: [
|
|
225
|
-
/* @__PURE__ */
|
|
226
|
-
/* @__PURE__ */
|
|
243
|
+
/* @__PURE__ */ w("div", { className: "flex w-full flex-wrap items-center gap-2 px-3 py-2", children: [
|
|
244
|
+
/* @__PURE__ */ w(
|
|
227
245
|
"button",
|
|
228
246
|
{
|
|
229
247
|
type: "button",
|
|
230
|
-
onClick: () =>
|
|
248
|
+
onClick: () => ne(e.key),
|
|
231
249
|
className: "flex min-w-0 flex-1 flex-wrap items-center gap-2 text-left",
|
|
232
250
|
children: [
|
|
233
|
-
/* @__PURE__ */
|
|
251
|
+
/* @__PURE__ */ s(
|
|
234
252
|
oe,
|
|
235
253
|
{
|
|
236
|
-
className: `h-3.5 w-3.5 shrink-0 text-slate-400 transition-transform ${
|
|
254
|
+
className: `h-3.5 w-3.5 shrink-0 text-slate-400 transition-transform ${d ? "rotate-90" : ""}`
|
|
237
255
|
}
|
|
238
256
|
),
|
|
239
|
-
/* @__PURE__ */
|
|
257
|
+
/* @__PURE__ */ s(
|
|
240
258
|
"span",
|
|
241
259
|
{
|
|
242
260
|
className: "text-[12px] font-medium text-slate-700 dark:text-slate-200",
|
|
243
261
|
"data-review-group-title": !0,
|
|
244
|
-
children:
|
|
262
|
+
children: h.title
|
|
245
263
|
}
|
|
246
264
|
),
|
|
247
|
-
|
|
248
|
-
/* @__PURE__ */
|
|
249
|
-
|
|
250
|
-
e.sum != null ? ` · ${
|
|
265
|
+
h.subtitle && /* @__PURE__ */ s("span", { className: "text-[11.5px] text-slate-500 dark:text-slate-400", children: h.subtitle }),
|
|
266
|
+
/* @__PURE__ */ w("span", { className: "text-[11px] text-slate-400", children: [
|
|
267
|
+
ee(e.count, t.row_noun),
|
|
268
|
+
e.sum != null ? ` · ${O(e.sum, t.aggregate_sum_format ?? "number")}` : ""
|
|
251
269
|
] }),
|
|
252
|
-
|
|
270
|
+
I.map((l) => {
|
|
253
271
|
if (l.role) return null;
|
|
254
|
-
const
|
|
255
|
-
return l.format === "flag" ?
|
|
272
|
+
const p = N.values[l.field];
|
|
273
|
+
return l.format === "flag" ? J(p) ? /* @__PURE__ */ s(L, { label: l.label, color: l.color ?? "amber" }, l.field) : null : p == null || p === "" ? null : /* @__PURE__ */ w(
|
|
256
274
|
"span",
|
|
257
275
|
{
|
|
258
276
|
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",
|
|
259
277
|
children: [
|
|
260
278
|
l.label,
|
|
261
279
|
": ",
|
|
262
|
-
|
|
280
|
+
O(p, l.format)
|
|
263
281
|
]
|
|
264
282
|
},
|
|
265
283
|
l.field
|
|
266
284
|
);
|
|
267
285
|
}),
|
|
268
|
-
/* @__PURE__ */
|
|
269
|
-
g && /* @__PURE__ */
|
|
270
|
-
/* @__PURE__ */
|
|
271
|
-
/* @__PURE__ */
|
|
272
|
-
/* @__PURE__ */
|
|
273
|
-
|
|
286
|
+
/* @__PURE__ */ s(L, { label: y.label, color: y.color }),
|
|
287
|
+
g && /* @__PURE__ */ w(fe, { children: [
|
|
288
|
+
/* @__PURE__ */ s(xe, { asChild: !0, children: /* @__PURE__ */ s("span", { className: "cursor-default text-[11px] text-slate-400 underline decoration-dotted", children: g.label }) }),
|
|
289
|
+
/* @__PURE__ */ w(he, { side: "top", className: "text-[12px]", children: [
|
|
290
|
+
/* @__PURE__ */ s("p", { className: "font-medium", children: g.label }),
|
|
291
|
+
C && /* @__PURE__ */ s("p", { className: "text-muted-foreground", children: te(C) })
|
|
274
292
|
] })
|
|
275
293
|
] })
|
|
276
294
|
]
|
|
277
295
|
}
|
|
278
296
|
),
|
|
279
|
-
/* @__PURE__ */
|
|
280
|
-
!
|
|
297
|
+
/* @__PURE__ */ w("span", { className: "flex flex-wrap items-center gap-1.5", children: [
|
|
298
|
+
!x && /* @__PURE__ */ s(
|
|
281
299
|
"span",
|
|
282
300
|
{
|
|
283
301
|
className: "text-[11px] text-slate-400",
|
|
284
|
-
title:
|
|
302
|
+
title: k,
|
|
285
303
|
"data-review-view-only": !0,
|
|
286
304
|
children: "View only"
|
|
287
305
|
}
|
|
288
306
|
),
|
|
289
|
-
|
|
290
|
-
const
|
|
291
|
-
return /* @__PURE__ */
|
|
307
|
+
x && t.status.options.map((l) => {
|
|
308
|
+
const p = !e.mixedStatus && String(e.uniformStatus) === l.value, u = U[l.color] ?? U.slate, D = j === e.key;
|
|
309
|
+
return /* @__PURE__ */ s(
|
|
292
310
|
"button",
|
|
293
311
|
{
|
|
294
312
|
type: "button",
|
|
295
|
-
disabled:
|
|
296
|
-
onClick: () =>
|
|
313
|
+
disabled: D || p,
|
|
314
|
+
onClick: () => le(e, l),
|
|
297
315
|
className: "rounded-md border px-2.5 py-1 text-[11px] font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50",
|
|
298
316
|
style: {
|
|
299
|
-
backgroundColor:
|
|
300
|
-
borderColor: `${
|
|
301
|
-
color:
|
|
317
|
+
backgroundColor: p ? `${u}22` : "transparent",
|
|
318
|
+
borderColor: `${u}55`,
|
|
319
|
+
color: u
|
|
302
320
|
},
|
|
303
|
-
children:
|
|
321
|
+
children: D ? "…" : l.label
|
|
304
322
|
},
|
|
305
323
|
l.value
|
|
306
324
|
);
|
|
307
325
|
})
|
|
308
326
|
] })
|
|
309
327
|
] }),
|
|
310
|
-
|
|
328
|
+
m && /* @__PURE__ */ w(
|
|
311
329
|
"p",
|
|
312
330
|
{
|
|
313
331
|
"data-review-decision-note": !0,
|
|
314
332
|
className: "border-t border-slate-100 px-3 py-1.5 text-[11.5px] text-red-700 dark:border-border dark:text-red-300",
|
|
315
333
|
children: [
|
|
316
|
-
/* @__PURE__ */
|
|
334
|
+
/* @__PURE__ */ s("span", { className: "font-medium", children: "Reason:" }),
|
|
317
335
|
" ",
|
|
318
|
-
/* @__PURE__ */
|
|
336
|
+
/* @__PURE__ */ s("span", { className: "whitespace-pre-line", children: m })
|
|
319
337
|
]
|
|
320
338
|
}
|
|
321
339
|
),
|
|
322
|
-
|
|
323
|
-
/* @__PURE__ */
|
|
324
|
-
|
|
340
|
+
_[e.key] && /* @__PURE__ */ w("p", { className: "flex items-center gap-1 px-3 pb-2 text-[11px] text-red-600", children: [
|
|
341
|
+
/* @__PURE__ */ s(ie, { className: "h-3 w-3 shrink-0" }),
|
|
342
|
+
_[e.key]
|
|
325
343
|
] }),
|
|
326
|
-
|
|
327
|
-
/* @__PURE__ */
|
|
328
|
-
|
|
329
|
-
|
|
344
|
+
d && /* @__PURE__ */ s("div", { className: "overflow-x-auto border-t border-slate-100 dark:border-border/50", children: /* @__PURE__ */ w("table", { className: "w-full border-collapse text-[12px]", children: [
|
|
345
|
+
/* @__PURE__ */ s("thead", { children: /* @__PURE__ */ w("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: [
|
|
346
|
+
W.map((l) => /* @__PURE__ */ s("th", { className: "px-2.5 py-1.5 font-medium", children: l.label }, l.field)),
|
|
347
|
+
B && /* @__PURE__ */ s("th", { className: "px-2.5 py-1.5 font-medium", children: "Match" })
|
|
330
348
|
] }) }),
|
|
331
|
-
/* @__PURE__ */
|
|
332
|
-
var
|
|
333
|
-
return /* @__PURE__ */
|
|
349
|
+
/* @__PURE__ */ s("tbody", { children: e.rows.map((l) => {
|
|
350
|
+
var p;
|
|
351
|
+
return /* @__PURE__ */ w(
|
|
334
352
|
"tr",
|
|
335
353
|
{
|
|
336
354
|
className: "border-b border-slate-100 last:border-b-0 dark:border-border/50",
|
|
337
355
|
children: [
|
|
338
|
-
|
|
356
|
+
W.map((u) => /* @__PURE__ */ s(
|
|
339
357
|
"td",
|
|
340
358
|
{
|
|
341
359
|
className: "px-2.5 py-1.5 text-slate-600 dark:text-slate-300",
|
|
342
|
-
children:
|
|
360
|
+
children: u.format === "flag" ? J(l.values[u.field]) ? /* @__PURE__ */ s(L, { label: u.label, color: u.color ?? "amber" }) : "—" : O(l.values[u.field], u.format)
|
|
343
361
|
},
|
|
344
|
-
|
|
362
|
+
u.field
|
|
345
363
|
)),
|
|
346
|
-
|
|
364
|
+
B && /* @__PURE__ */ s("td", { className: "px-2.5 py-1.5", children: /* @__PURE__ */ s("span", { className: "flex flex-wrap gap-1", children: (((p = $(l.id)) == null ? void 0 : p.chips) ?? []).map((u) => /* @__PURE__ */ s(
|
|
347
365
|
"span",
|
|
348
366
|
{
|
|
349
|
-
title:
|
|
350
|
-
className:
|
|
351
|
-
children:
|
|
367
|
+
title: u.title,
|
|
368
|
+
className: u.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" : u.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" : u.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",
|
|
369
|
+
children: u.label
|
|
352
370
|
},
|
|
353
|
-
|
|
371
|
+
u.label
|
|
354
372
|
)) }) })
|
|
355
373
|
]
|
|
356
374
|
},
|
|
@@ -363,87 +381,87 @@ function De({
|
|
|
363
381
|
e.key
|
|
364
382
|
);
|
|
365
383
|
}),
|
|
366
|
-
|
|
384
|
+
f && /* @__PURE__ */ s(
|
|
367
385
|
"div",
|
|
368
386
|
{
|
|
369
387
|
className: "fixed inset-0 z-[130] flex items-center justify-center bg-black/40 p-4",
|
|
370
|
-
onClick: () =>
|
|
388
|
+
onClick: () => S(null),
|
|
371
389
|
onKeyDown: (e) => {
|
|
372
|
-
e.key === "Escape" && (e.stopPropagation(),
|
|
390
|
+
e.key === "Escape" && (e.stopPropagation(), S(null));
|
|
373
391
|
},
|
|
374
|
-
children: /* @__PURE__ */
|
|
392
|
+
children: /* @__PURE__ */ w(
|
|
375
393
|
"div",
|
|
376
394
|
{
|
|
377
395
|
role: "dialog",
|
|
378
396
|
"aria-modal": "true",
|
|
379
397
|
"aria-labelledby": "review-confirm-title",
|
|
380
|
-
"data-review-confirm":
|
|
398
|
+
"data-review-confirm": f.option.value,
|
|
381
399
|
className: "w-full max-w-md rounded-lg border border-slate-200 bg-white p-4 shadow-xl dark:border-border dark:bg-card",
|
|
382
400
|
onClick: (e) => e.stopPropagation(),
|
|
383
401
|
children: [
|
|
384
|
-
/* @__PURE__ */
|
|
402
|
+
/* @__PURE__ */ s(
|
|
385
403
|
"p",
|
|
386
404
|
{
|
|
387
405
|
id: "review-confirm-title",
|
|
388
406
|
className: "text-[13px] font-medium text-slate-700 dark:text-slate-200",
|
|
389
|
-
children:
|
|
390
|
-
|
|
391
|
-
|
|
407
|
+
children: Ne(
|
|
408
|
+
f.option,
|
|
409
|
+
Z(f.group, I),
|
|
392
410
|
t.group_noun
|
|
393
411
|
)
|
|
394
412
|
}
|
|
395
413
|
),
|
|
396
|
-
/* @__PURE__ */
|
|
397
|
-
|
|
398
|
-
|
|
414
|
+
/* @__PURE__ */ w("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: [
|
|
415
|
+
ee(f.group.count, t.row_noun),
|
|
416
|
+
f.group.sum != null ? ` · ${O(f.group.sum, t.aggregate_sum_format ?? "number")}` : ""
|
|
399
417
|
] }),
|
|
400
|
-
/* @__PURE__ */
|
|
418
|
+
/* @__PURE__ */ s(
|
|
401
419
|
"p",
|
|
402
420
|
{
|
|
403
421
|
className: "mt-1.5 text-[11px] text-slate-500 dark:text-slate-400",
|
|
404
422
|
"data-review-confirm-notice": !0,
|
|
405
|
-
children:
|
|
423
|
+
children: K(f.group, f.option) ? `${K(f.group, f.option)}${f.option.require_note ? " A reason is required." : ""}` : f.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."
|
|
406
424
|
}
|
|
407
425
|
),
|
|
408
|
-
/* @__PURE__ */
|
|
426
|
+
/* @__PURE__ */ s(
|
|
409
427
|
"textarea",
|
|
410
428
|
{
|
|
411
|
-
value:
|
|
412
|
-
onChange: (e) =>
|
|
429
|
+
value: M,
|
|
430
|
+
onChange: (e) => V(e.target.value),
|
|
413
431
|
rows: 3,
|
|
414
432
|
autoFocus: !0,
|
|
415
|
-
"aria-label":
|
|
433
|
+
"aria-label": f.option.require_note ? "Reason" : "Note (optional)",
|
|
416
434
|
"data-review-confirm-note": !0,
|
|
417
435
|
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",
|
|
418
|
-
placeholder:
|
|
436
|
+
placeholder: f.option.require_note ? "Why is this being rejected?" : "Note (optional)"
|
|
419
437
|
}
|
|
420
438
|
),
|
|
421
|
-
/* @__PURE__ */
|
|
422
|
-
/* @__PURE__ */
|
|
439
|
+
/* @__PURE__ */ w("div", { className: "mt-3 flex items-center justify-end gap-1.5", children: [
|
|
440
|
+
/* @__PURE__ */ s(
|
|
423
441
|
"button",
|
|
424
442
|
{
|
|
425
443
|
type: "button",
|
|
426
444
|
"data-review-confirm-cancel": !0,
|
|
427
|
-
onClick: () =>
|
|
445
|
+
onClick: () => S(null),
|
|
428
446
|
className: "rounded px-2.5 py-1 text-[11px] text-slate-500 hover:bg-slate-100 dark:hover:bg-muted",
|
|
429
447
|
children: "Cancel"
|
|
430
448
|
}
|
|
431
449
|
),
|
|
432
|
-
/* @__PURE__ */
|
|
450
|
+
/* @__PURE__ */ s(
|
|
433
451
|
"button",
|
|
434
452
|
{
|
|
435
453
|
type: "button",
|
|
436
454
|
"data-review-confirm-submit": !0,
|
|
437
|
-
disabled: !!
|
|
455
|
+
disabled: !!f.option.require_note && !M.trim(),
|
|
438
456
|
onClick: () => {
|
|
439
|
-
const e =
|
|
440
|
-
|
|
457
|
+
const e = f;
|
|
458
|
+
S(null), se(e.group, e.option, M.trim() || null);
|
|
441
459
|
},
|
|
442
|
-
className:
|
|
460
|
+
className: X(
|
|
443
461
|
"rounded px-3 py-1 text-[11px] font-medium hover:brightness-110 disabled:opacity-50",
|
|
444
|
-
|
|
462
|
+
f.option.require_note ? "bg-red-600 text-white" : "bg-nvr-cyan text-white"
|
|
445
463
|
),
|
|
446
|
-
children:
|
|
464
|
+
children: f.option.label
|
|
447
465
|
}
|
|
448
466
|
)
|
|
449
467
|
] })
|
|
@@ -455,10 +473,11 @@ function De({
|
|
|
455
473
|
] }) });
|
|
456
474
|
}
|
|
457
475
|
export {
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
476
|
+
Fe as ReviewListWidget,
|
|
477
|
+
U as STATUS_COLOR_HEX,
|
|
478
|
+
Ne as confirmTitle,
|
|
479
|
+
ee as countLabel,
|
|
480
|
+
O as formatValue,
|
|
481
|
+
Z as groupName,
|
|
482
|
+
ye as sortGroupRows
|
|
464
483
|
};
|