@nivaro/react 0.3.49 → 0.3.51
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/components/InlineGridField.js +166 -105
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +38 -4
- package/dist/shared/components/ItemEditForm.js +5258 -5034
- package/dist/shared/components/QueryTable.js +489 -347
- 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 +1230 -1175
- package/dist/shared/components/item-edit/CloneDialog.js +192 -142
- package/dist/shared/components/item-edit/DraftRecoveryBanner.js +58 -53
- package/dist/shared/components/item-edit/FieldRenderer.js +249 -244
- package/dist/shared/components/item-edit/FieldRow.js +402 -370
- package/dist/shared/components/item-edit/FilePickerField.js +315 -307
- package/dist/shared/components/item-edit/InlineGridField.js +92 -90
- package/dist/shared/components/item-edit/InlineTableField.js +3119 -2951
- package/dist/shared/components/item-edit/MidairCollisionDialog.js +175 -0
- package/dist/shared/components/item-edit/PlanGrid.js +162 -162
- package/dist/shared/components/item-edit/PolishFields.js +169 -162
- 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 +198 -191
- package/dist/shared/components/item-edit/SummaryPanel.js +282 -259
- package/dist/shared/components/item-edit/UserChip.js +233 -200
- package/dist/shared/components/item-edit/ValidationSummary.js +64 -47
- package/dist/shared/components/item-edit/header-midair.js +51 -0
- package/dist/shared/components/item-edit/helpers.js +181 -155
- package/dist/shared/components/item-edit/line-midair.js +207 -0
- package/dist/shared/components/item-edit/soft-rules.js +27 -0
- package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
- package/dist/shared/components/panels/CommentPanel.js +290 -284
- package/dist/shared/components/panels/ItemLockBanner.js +414 -358
- package/dist/shared/components/panels/PipelinePanel.js +1241 -992
- package/dist/shared/components/panels/RecordIntegrityBanner.js +1 -1
- 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 +925 -871
- package/dist/shared/components/queue/column-chooser.js +21 -0
- package/dist/shared/components/queue/live-state-aspect.js +6 -0
- package/dist/shared/components/ui/number-draft-input.js +93 -0
- package/dist/shared/components/widgets/ReviewListWidget.js +191 -166
- package/dist/shared/lib/draft-store.js +48 -34
- package/dist/shared/lib/error-hints.js +1 -0
- package/dist/shared/lib/query-stats.js +60 -60
- 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
|
|
5
|
-
import { useNivaroClient as
|
|
6
|
-
import { post as
|
|
7
|
-
import { formatDateTime as
|
|
8
|
-
import { TooltipProvider as oe, Tooltip as
|
|
9
|
-
function
|
|
1
|
+
import { jsx as a, jsxs as m } from "react/jsx-runtime";
|
|
2
|
+
import { useQuery as ee } from "@tanstack/react-query";
|
|
3
|
+
import { ChevronRight as te, AlertCircle as re } from "lucide-react";
|
|
4
|
+
import { useState as T, useMemo as V } from "react";
|
|
5
|
+
import { useNivaroClient as le, useItemEditAuth as ae } from "../../context.js";
|
|
6
|
+
import { post as z, patch as ne } from "../../lib/commands.js";
|
|
7
|
+
import { formatDateTime as B, cn as K, formatDate as se } from "../../lib/utils.js";
|
|
8
|
+
import { TooltipProvider as oe, Tooltip as ie, TooltipTrigger as de, TooltipContent as ue } from "../ui/tooltip.js";
|
|
9
|
+
function L(t) {
|
|
10
10
|
return t === !0 || t === 1 || t === "1" || t === "true";
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function D(t, r) {
|
|
13
13
|
if (t == null || t === "") return "—";
|
|
14
14
|
if (r === "currency" || r === "number") {
|
|
15
|
-
const
|
|
16
|
-
return Number.isNaN(
|
|
15
|
+
const i = Number(t);
|
|
16
|
+
return Number.isNaN(i) ? String(t) : r === "currency" ? new Intl.NumberFormat(void 0, { style: "currency", currency: "USD" }).format(i) : new Intl.NumberFormat().format(i);
|
|
17
17
|
}
|
|
18
18
|
if (r === "date" || r === "datetime") {
|
|
19
|
-
const
|
|
20
|
-
return Number.isNaN(
|
|
19
|
+
const i = new Date(t);
|
|
20
|
+
return Number.isNaN(i.getTime()) ? String(t) : r === "date" ? se(i) : B(i);
|
|
21
21
|
}
|
|
22
22
|
return String(t);
|
|
23
23
|
}
|
|
24
|
-
const
|
|
24
|
+
const P = {
|
|
25
25
|
green: "#16a34a",
|
|
26
26
|
red: "#dc2626",
|
|
27
27
|
amber: "#d97706",
|
|
@@ -37,12 +37,12 @@ function ce(t) {
|
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
39
|
function E({ label: t, color: r }) {
|
|
40
|
-
const
|
|
41
|
-
return /* @__PURE__ */
|
|
40
|
+
const i = r ? P[r] ?? null : null;
|
|
41
|
+
return /* @__PURE__ */ a(
|
|
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: ce(
|
|
45
|
+
style: ce(i),
|
|
46
46
|
children: t
|
|
47
47
|
}
|
|
48
48
|
);
|
|
@@ -50,202 +50,198 @@ function E({ label: t, color: r }) {
|
|
|
50
50
|
function me(t, r) {
|
|
51
51
|
if (t == null || t === "")
|
|
52
52
|
return r.empty_label ? { label: r.empty_label, color: r.empty_color ?? "blue" } : { label: "—", color: null };
|
|
53
|
-
const
|
|
54
|
-
return
|
|
53
|
+
const i = r.options.find((f) => f.value === String(t));
|
|
54
|
+
return i ? { label: i.label, color: i.color } : { label: String(t), color: null };
|
|
55
55
|
}
|
|
56
|
-
function
|
|
57
|
-
const
|
|
58
|
-
for (const
|
|
59
|
-
const
|
|
60
|
-
|
|
56
|
+
function pe(t, r) {
|
|
57
|
+
const i = /* @__PURE__ */ new Map();
|
|
58
|
+
for (const x of t.rows) {
|
|
59
|
+
const s = String(x.group ?? ""), g = i.get(s);
|
|
60
|
+
g ? g.push(x) : i.set(s, [x]);
|
|
61
61
|
}
|
|
62
|
-
const
|
|
63
|
-
const
|
|
64
|
-
let
|
|
65
|
-
return r &&
|
|
62
|
+
const f = Array.from(i.entries()).map(([x, s]) => {
|
|
63
|
+
const h = new Set(s.map((q) => String(q.status ?? ""))).size > 1, $ = h ? null : s[0].status;
|
|
64
|
+
let N = null;
|
|
65
|
+
return r && s.every((v) => r in v.values) && (N = s.reduce((v, A) => v + (Number(A.values[r]) || 0), 0)), { key: x, rows: s, count: s.length, sum: N, uniformStatus: $, mixedStatus: h };
|
|
66
66
|
});
|
|
67
|
-
return
|
|
67
|
+
return f.sort((x, s) => x.key.localeCompare(s.key, void 0, { numeric: !0 })), f;
|
|
68
68
|
}
|
|
69
|
-
function
|
|
70
|
-
let
|
|
71
|
-
for (const
|
|
72
|
-
const
|
|
73
|
-
if (
|
|
74
|
-
const
|
|
75
|
-
Number.isFinite(
|
|
69
|
+
function W(t, r, i) {
|
|
70
|
+
let f = null;
|
|
71
|
+
for (const x of t) {
|
|
72
|
+
const s = x.values[r];
|
|
73
|
+
if (s == null || s === "") continue;
|
|
74
|
+
const g = typeof s == "number" ? s : Date.parse(String(s)), h = Number.isNaN(g) ? Number(s) : g;
|
|
75
|
+
Number.isFinite(h) && (f == null || (i ? h > f : h < f)) && (f = h);
|
|
76
76
|
}
|
|
77
|
-
return
|
|
77
|
+
return f;
|
|
78
78
|
}
|
|
79
|
-
function
|
|
79
|
+
function Ne({
|
|
80
80
|
data: t,
|
|
81
81
|
config: r,
|
|
82
|
-
loading:
|
|
83
|
-
error:
|
|
84
|
-
onRefetch:
|
|
85
|
-
hostRecordId:
|
|
86
|
-
emptyLabel:
|
|
82
|
+
loading: i,
|
|
83
|
+
error: f,
|
|
84
|
+
onRefetch: x,
|
|
85
|
+
hostRecordId: s,
|
|
86
|
+
emptyLabel: g
|
|
87
87
|
}) {
|
|
88
|
-
const
|
|
89
|
-
const e = t ?
|
|
90
|
-
if (!(
|
|
91
|
-
const
|
|
92
|
-
return [...e].sort((k,
|
|
93
|
-
const c =
|
|
94
|
-
return c == null &&
|
|
88
|
+
const h = le(), { userId: $ } = ae(), [N, q] = T(() => /* @__PURE__ */ new Set()), [v, A] = T(null), [G, H] = T({}), [b, _] = T(null), [F, M] = T(""), I = V(() => {
|
|
89
|
+
const e = t ? pe(t, r.aggregate_sum) : [], o = r.group_sort;
|
|
90
|
+
if (!(o != null && o.field)) return e;
|
|
91
|
+
const p = o.direction === "desc";
|
|
92
|
+
return [...e].sort((k, d) => {
|
|
93
|
+
const c = W(k.rows, o.field, p), y = W(d.rows, o.field, p);
|
|
94
|
+
return c == null && y == null ? 0 : c == null ? 1 : y == null ? -1 : p ? y - c : c - y;
|
|
95
95
|
});
|
|
96
|
-
}, [t, r.aggregate_sum, r.group_sort]), j =
|
|
96
|
+
}, [t, r.aggregate_sum, r.group_sort]), j = V(() => ((t == null ? void 0 : t.rows) ?? []).map((e) => String(e.id)), [t]), { data: S } = ee({
|
|
97
97
|
queryKey: ["review-list-enrich", r.enrich_endpoint ?? "", j.join(",")],
|
|
98
|
-
queryFn: () =>
|
|
99
|
-
|
|
98
|
+
queryFn: () => h.request(
|
|
99
|
+
z(r.enrich_endpoint, { ids: j })
|
|
100
100
|
).then((e) => {
|
|
101
|
-
var
|
|
102
|
-
return ((
|
|
101
|
+
var o;
|
|
102
|
+
return ((o = e == null ? void 0 : e.data) == null ? void 0 : o.rows) ?? {};
|
|
103
103
|
}).catch(() => ({})),
|
|
104
104
|
enabled: !!r.enrich_endpoint && j.length > 0,
|
|
105
105
|
staleTime: 3e4
|
|
106
|
-
}),
|
|
107
|
-
var
|
|
108
|
-
return (((
|
|
106
|
+
}), O = (e) => S == null ? void 0 : S[String(e)], R = !!S && Object.values(S).some((e) => {
|
|
107
|
+
var o;
|
|
108
|
+
return (((o = e.chips) == null ? void 0 : o.length) ?? 0) > 0;
|
|
109
109
|
}), Q = I.length === 1;
|
|
110
|
-
if (
|
|
111
|
-
return /* @__PURE__ */
|
|
110
|
+
if (i)
|
|
111
|
+
return /* @__PURE__ */ a("div", { className: "space-y-2", children: [0, 1].map((e) => /* @__PURE__ */ a(
|
|
112
112
|
"div",
|
|
113
113
|
{
|
|
114
114
|
className: "animate-pulse h-12 rounded-md bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]"
|
|
115
115
|
},
|
|
116
116
|
e
|
|
117
117
|
)) });
|
|
118
|
-
if (
|
|
119
|
-
return /* @__PURE__ */
|
|
118
|
+
if (f)
|
|
119
|
+
return /* @__PURE__ */ a("p", { className: "text-[12px] text-red-500", children: f });
|
|
120
120
|
if (!t || t.rows.length === 0)
|
|
121
|
-
return /* @__PURE__ */
|
|
121
|
+
return /* @__PURE__ */ a("p", { className: "text-[12px] italic text-slate-400", children: g ? `No ${g.toLowerCase()} yet` : "Nothing here yet" });
|
|
122
122
|
const X = (e) => {
|
|
123
|
-
|
|
124
|
-
const
|
|
125
|
-
return
|
|
123
|
+
q((o) => {
|
|
124
|
+
const p = new Set(o);
|
|
125
|
+
return p.has(e) ? p.delete(e) : p.add(e), p;
|
|
126
126
|
});
|
|
127
|
-
}, J = (e,
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
}
|
|
132
|
-
V(e, a, null);
|
|
133
|
-
}, V = async (e, a, m) => {
|
|
134
|
-
$(e.key);
|
|
127
|
+
}, J = (e, o) => {
|
|
128
|
+
M(""), _({ group: e, option: o });
|
|
129
|
+
}, Y = async (e, o, p) => {
|
|
130
|
+
A(e.key);
|
|
135
131
|
let k = null;
|
|
136
132
|
if (r.status.action_endpoint)
|
|
137
133
|
try {
|
|
138
|
-
await
|
|
139
|
-
|
|
140
|
-
ids: e.rows.map((
|
|
141
|
-
status:
|
|
134
|
+
await h.request(
|
|
135
|
+
z(r.status.action_endpoint, {
|
|
136
|
+
ids: e.rows.map((d) => d.id),
|
|
137
|
+
status: o.value,
|
|
142
138
|
// The status each row showed: the endpoint may refuse (409) rows
|
|
143
139
|
// someone changed since this list loaded instead of overwriting
|
|
144
140
|
// them. The refetch below shows what they are now.
|
|
145
141
|
expected: Object.fromEntries(
|
|
146
|
-
e.rows.map((
|
|
142
|
+
e.rows.map((d) => [String(d.id), d.status == null ? null : String(d.status)])
|
|
147
143
|
),
|
|
148
|
-
...
|
|
149
|
-
...
|
|
144
|
+
...p ? { note: p } : {},
|
|
145
|
+
...s != null && s !== "" ? { workflow_id: Number(s) } : {}
|
|
150
146
|
})
|
|
151
147
|
);
|
|
152
|
-
} catch (
|
|
153
|
-
const c =
|
|
148
|
+
} catch (d) {
|
|
149
|
+
const c = d == null ? void 0 : d.response;
|
|
154
150
|
k = (c == null ? void 0 : c.error) ?? "Failed to update";
|
|
155
151
|
}
|
|
156
152
|
else {
|
|
157
|
-
const
|
|
158
|
-
e.rows.map(async (
|
|
159
|
-
const l = { [r.status.field]:
|
|
160
|
-
r.status.stamp_user_field &&
|
|
153
|
+
const d = r.status.stamp_date_field ? (/* @__PURE__ */ new Date()).toISOString() : void 0, y = (await Promise.all(
|
|
154
|
+
e.rows.map(async (w) => {
|
|
155
|
+
const l = { [r.status.field]: o.value };
|
|
156
|
+
r.status.stamp_user_field && $ && (l[r.status.stamp_user_field] = $), r.status.stamp_date_field && (l[r.status.stamp_date_field] = d), p && (l._change_reason = p);
|
|
161
157
|
try {
|
|
162
|
-
return await
|
|
158
|
+
return await h.request(ne(`/items/${r.collection}/${w.id}`, l)), { ok: !0 };
|
|
163
159
|
} catch (u) {
|
|
164
160
|
const n = u == null ? void 0 : u.response;
|
|
165
161
|
return { ok: !1, error: (n == null ? void 0 : n.error) ?? "Failed to update" };
|
|
166
162
|
}
|
|
167
163
|
})
|
|
168
|
-
)).filter((
|
|
169
|
-
|
|
164
|
+
)).filter((w) => !w.ok);
|
|
165
|
+
y.length > 0 && (k = `${y.length} of ${e.rows.length} row(s) failed to update`);
|
|
170
166
|
}
|
|
171
|
-
|
|
172
|
-
const c = { ...
|
|
167
|
+
A(null), H((d) => {
|
|
168
|
+
const c = { ...d };
|
|
173
169
|
return k ? c[e.key] = k : delete c[e.key], c;
|
|
174
|
-
}),
|
|
175
|
-
},
|
|
176
|
-
return /* @__PURE__ */
|
|
177
|
-
t.truncated && /* @__PURE__ */
|
|
170
|
+
}), x();
|
|
171
|
+
}, U = t.columns.line_columns, Z = t.columns.group_meta;
|
|
172
|
+
return /* @__PURE__ */ a(oe, { delayDuration: 200, children: /* @__PURE__ */ m("div", { className: "space-y-2", children: [
|
|
173
|
+
t.truncated && /* @__PURE__ */ a("p", { className: "text-[11px] text-amber-600 dark:text-amber-400", children: "Showing first 2000 rows — some rows may be missing." }),
|
|
178
174
|
I.map((e) => {
|
|
179
|
-
const
|
|
175
|
+
const o = Q ? !N.has(e.key) : N.has(e.key), p = e.rows.every((l) => {
|
|
180
176
|
var u;
|
|
181
|
-
return ((u =
|
|
182
|
-
}), k = e.mixedStatus ? { label: "Mixed", color: null } : me(e.uniformStatus, r.status),
|
|
177
|
+
return ((u = O(l.id)) == null ? void 0 : u.can_act) !== !1;
|
|
178
|
+
}), k = e.mixedStatus ? { label: "Mixed", color: null } : me(e.uniformStatus, r.status), d = e.rows[0], c = d.stamp_user, y = d.stamp_date, w = e.rows.reduce((l, u) => {
|
|
183
179
|
var n;
|
|
184
|
-
for (const
|
|
185
|
-
if (
|
|
186
|
-
|
|
180
|
+
for (const C of ((n = O(u.id)) == null ? void 0 : n.chips) ?? []) {
|
|
181
|
+
if (C.tone === "danger") return "danger";
|
|
182
|
+
C.tone === "warn" && l == null && (l = "warn");
|
|
187
183
|
}
|
|
188
184
|
return l;
|
|
189
185
|
}, null);
|
|
190
|
-
return /* @__PURE__ */
|
|
186
|
+
return /* @__PURE__ */ m(
|
|
191
187
|
"div",
|
|
192
188
|
{
|
|
193
189
|
"data-review-group": e.key,
|
|
194
|
-
"data-review-tone":
|
|
195
|
-
className:
|
|
190
|
+
"data-review-tone": w ?? void 0,
|
|
191
|
+
className: K(
|
|
196
192
|
"rounded-md border",
|
|
197
|
-
|
|
193
|
+
w === "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" : w === "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"
|
|
198
194
|
),
|
|
199
195
|
children: [
|
|
200
|
-
/* @__PURE__ */
|
|
201
|
-
/* @__PURE__ */
|
|
196
|
+
/* @__PURE__ */ m("div", { className: "flex w-full flex-wrap items-center gap-2 px-3 py-2", children: [
|
|
197
|
+
/* @__PURE__ */ m(
|
|
202
198
|
"button",
|
|
203
199
|
{
|
|
204
200
|
type: "button",
|
|
205
201
|
onClick: () => X(e.key),
|
|
206
202
|
className: "flex min-w-0 flex-1 flex-wrap items-center gap-2 text-left",
|
|
207
203
|
children: [
|
|
208
|
-
/* @__PURE__ */
|
|
209
|
-
|
|
204
|
+
/* @__PURE__ */ a(
|
|
205
|
+
te,
|
|
210
206
|
{
|
|
211
|
-
className: `h-3.5 w-3.5 shrink-0 text-slate-400 transition-transform ${
|
|
207
|
+
className: `h-3.5 w-3.5 shrink-0 text-slate-400 transition-transform ${o ? "rotate-90" : ""}`
|
|
212
208
|
}
|
|
213
209
|
),
|
|
214
|
-
/* @__PURE__ */
|
|
215
|
-
/* @__PURE__ */
|
|
210
|
+
/* @__PURE__ */ a("span", { className: "text-[12px] font-medium text-slate-700 dark:text-slate-200", children: e.key || "—" }),
|
|
211
|
+
/* @__PURE__ */ m("span", { className: "text-[11px] text-slate-400", children: [
|
|
216
212
|
e.count,
|
|
217
213
|
" row",
|
|
218
214
|
e.count === 1 ? "" : "s",
|
|
219
|
-
e.sum != null ? ` · ${
|
|
215
|
+
e.sum != null ? ` · ${D(e.sum, r.aggregate_sum_format ?? "number")}` : ""
|
|
220
216
|
] }),
|
|
221
|
-
|
|
222
|
-
const u =
|
|
223
|
-
return l.format === "flag" ?
|
|
217
|
+
Z.map((l) => {
|
|
218
|
+
const u = d.values[l.field];
|
|
219
|
+
return l.format === "flag" ? L(u) ? /* @__PURE__ */ a(E, { label: l.label, color: l.color ?? "amber" }, l.field) : null : u == null || u === "" ? null : /* @__PURE__ */ m(
|
|
224
220
|
"span",
|
|
225
221
|
{
|
|
226
222
|
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",
|
|
227
223
|
children: [
|
|
228
224
|
l.label,
|
|
229
225
|
": ",
|
|
230
|
-
|
|
226
|
+
D(u, l.format)
|
|
231
227
|
]
|
|
232
228
|
},
|
|
233
229
|
l.field
|
|
234
230
|
);
|
|
235
231
|
}),
|
|
236
|
-
/* @__PURE__ */
|
|
237
|
-
c && /* @__PURE__ */
|
|
238
|
-
/* @__PURE__ */
|
|
239
|
-
/* @__PURE__ */
|
|
240
|
-
/* @__PURE__ */
|
|
241
|
-
|
|
232
|
+
/* @__PURE__ */ a(E, { label: k.label, color: k.color }),
|
|
233
|
+
c && /* @__PURE__ */ m(ie, { children: [
|
|
234
|
+
/* @__PURE__ */ a(de, { asChild: !0, children: /* @__PURE__ */ a("span", { className: "cursor-default text-[11px] text-slate-400 underline decoration-dotted", children: c.label }) }),
|
|
235
|
+
/* @__PURE__ */ m(ue, { side: "top", className: "text-[12px]", children: [
|
|
236
|
+
/* @__PURE__ */ a("p", { className: "font-medium", children: c.label }),
|
|
237
|
+
y && /* @__PURE__ */ a("p", { className: "text-muted-foreground", children: B(y) })
|
|
242
238
|
] })
|
|
243
239
|
] })
|
|
244
240
|
]
|
|
245
241
|
}
|
|
246
242
|
),
|
|
247
|
-
/* @__PURE__ */
|
|
248
|
-
!
|
|
243
|
+
/* @__PURE__ */ m("span", { className: "flex flex-wrap items-center gap-1.5", children: [
|
|
244
|
+
!p && /* @__PURE__ */ a(
|
|
249
245
|
"span",
|
|
250
246
|
{
|
|
251
247
|
className: "text-[11px] text-slate-400",
|
|
@@ -253,13 +249,13 @@ function we({
|
|
|
253
249
|
children: "View only"
|
|
254
250
|
}
|
|
255
251
|
),
|
|
256
|
-
|
|
257
|
-
const u = !e.mixedStatus && String(e.uniformStatus) === l.value, n =
|
|
258
|
-
return /* @__PURE__ */
|
|
252
|
+
p && r.status.options.map((l) => {
|
|
253
|
+
const u = !e.mixedStatus && String(e.uniformStatus) === l.value, n = P[l.color] ?? P.slate, C = v === e.key;
|
|
254
|
+
return /* @__PURE__ */ a(
|
|
259
255
|
"button",
|
|
260
256
|
{
|
|
261
257
|
type: "button",
|
|
262
|
-
disabled:
|
|
258
|
+
disabled: C || u,
|
|
263
259
|
onClick: () => J(e, l),
|
|
264
260
|
className: "rounded-md border px-2.5 py-1 text-[11px] font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50",
|
|
265
261
|
style: {
|
|
@@ -267,38 +263,38 @@ function we({
|
|
|
267
263
|
borderColor: `${n}55`,
|
|
268
264
|
color: n
|
|
269
265
|
},
|
|
270
|
-
children:
|
|
266
|
+
children: C ? "…" : l.label
|
|
271
267
|
},
|
|
272
268
|
l.value
|
|
273
269
|
);
|
|
274
270
|
})
|
|
275
271
|
] })
|
|
276
272
|
] }),
|
|
277
|
-
|
|
278
|
-
/* @__PURE__ */
|
|
279
|
-
|
|
273
|
+
G[e.key] && /* @__PURE__ */ m("p", { className: "flex items-center gap-1 px-3 pb-2 text-[11px] text-red-600", children: [
|
|
274
|
+
/* @__PURE__ */ a(re, { className: "h-3 w-3 shrink-0" }),
|
|
275
|
+
G[e.key]
|
|
280
276
|
] }),
|
|
281
|
-
|
|
282
|
-
/* @__PURE__ */
|
|
283
|
-
|
|
284
|
-
|
|
277
|
+
o && /* @__PURE__ */ a("div", { className: "overflow-x-auto border-t border-slate-100 dark:border-border/50", children: /* @__PURE__ */ m("table", { className: "w-full border-collapse text-[12px]", children: [
|
|
278
|
+
/* @__PURE__ */ a("thead", { children: /* @__PURE__ */ m("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: [
|
|
279
|
+
U.map((l) => /* @__PURE__ */ a("th", { className: "px-2.5 py-1.5 font-medium", children: l.label }, l.field)),
|
|
280
|
+
R && /* @__PURE__ */ a("th", { className: "px-2.5 py-1.5 font-medium", children: "Match" })
|
|
285
281
|
] }) }),
|
|
286
|
-
/* @__PURE__ */
|
|
282
|
+
/* @__PURE__ */ a("tbody", { children: e.rows.map((l) => {
|
|
287
283
|
var u;
|
|
288
|
-
return /* @__PURE__ */
|
|
284
|
+
return /* @__PURE__ */ m(
|
|
289
285
|
"tr",
|
|
290
286
|
{
|
|
291
287
|
className: "border-b border-slate-100 last:border-b-0 dark:border-border/50",
|
|
292
288
|
children: [
|
|
293
|
-
|
|
289
|
+
U.map((n) => /* @__PURE__ */ a(
|
|
294
290
|
"td",
|
|
295
291
|
{
|
|
296
292
|
className: "px-2.5 py-1.5 text-slate-600 dark:text-slate-300",
|
|
297
|
-
children: n.format === "flag" ?
|
|
293
|
+
children: n.format === "flag" ? L(l.values[n.field]) ? /* @__PURE__ */ a(E, { label: n.label, color: n.color ?? "amber" }) : "—" : D(l.values[n.field], n.format)
|
|
298
294
|
},
|
|
299
295
|
n.field
|
|
300
296
|
)),
|
|
301
|
-
|
|
297
|
+
R && /* @__PURE__ */ a("td", { className: "px-2.5 py-1.5", children: /* @__PURE__ */ a("span", { className: "flex flex-wrap gap-1", children: (((u = O(l.id)) == null ? void 0 : u.chips) ?? []).map((n) => /* @__PURE__ */ a(
|
|
302
298
|
"span",
|
|
303
299
|
{
|
|
304
300
|
title: n.title,
|
|
@@ -318,54 +314,83 @@ function we({
|
|
|
318
314
|
e.key
|
|
319
315
|
);
|
|
320
316
|
}),
|
|
321
|
-
|
|
317
|
+
b && /* @__PURE__ */ a(
|
|
322
318
|
"div",
|
|
323
319
|
{
|
|
324
320
|
className: "fixed inset-0 z-[130] flex items-center justify-center bg-black/40 p-4",
|
|
325
|
-
onClick: () =>
|
|
326
|
-
|
|
321
|
+
onClick: () => _(null),
|
|
322
|
+
onKeyDown: (e) => {
|
|
323
|
+
e.key === "Escape" && (e.stopPropagation(), _(null));
|
|
324
|
+
},
|
|
325
|
+
children: /* @__PURE__ */ m(
|
|
327
326
|
"div",
|
|
328
327
|
{
|
|
328
|
+
role: "dialog",
|
|
329
|
+
"aria-modal": "true",
|
|
330
|
+
"aria-labelledby": "review-confirm-title",
|
|
331
|
+
"data-review-confirm": b.option.value,
|
|
329
332
|
className: "w-full max-w-md rounded-lg border border-slate-200 bg-white p-4 shadow-xl dark:border-border dark:bg-card",
|
|
330
333
|
onClick: (e) => e.stopPropagation(),
|
|
331
334
|
children: [
|
|
332
|
-
/* @__PURE__ */
|
|
333
|
-
|
|
334
|
-
|
|
335
|
+
/* @__PURE__ */ m(
|
|
336
|
+
"p",
|
|
337
|
+
{
|
|
338
|
+
id: "review-confirm-title",
|
|
339
|
+
className: "text-[13px] font-medium text-slate-700 dark:text-slate-200",
|
|
340
|
+
children: [
|
|
341
|
+
b.option.label,
|
|
342
|
+
" ",
|
|
343
|
+
b.group.key || "these rows",
|
|
344
|
+
"?"
|
|
345
|
+
]
|
|
346
|
+
}
|
|
347
|
+
),
|
|
348
|
+
/* @__PURE__ */ m("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: [
|
|
349
|
+
b.group.count,
|
|
350
|
+
" row",
|
|
351
|
+
b.group.count === 1 ? "" : "s",
|
|
352
|
+
b.group.sum != null ? ` · ${D(b.group.sum, r.aggregate_sum_format ?? "number")}` : ""
|
|
335
353
|
] }),
|
|
336
|
-
/* @__PURE__ */
|
|
337
|
-
/* @__PURE__ */
|
|
354
|
+
/* @__PURE__ */ a("p", { className: "mt-1.5 text-[11px] text-slate-500 dark:text-slate-400", children: b.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." }),
|
|
355
|
+
/* @__PURE__ */ a(
|
|
338
356
|
"textarea",
|
|
339
357
|
{
|
|
340
358
|
value: F,
|
|
341
|
-
onChange: (e) =>
|
|
359
|
+
onChange: (e) => M(e.target.value),
|
|
342
360
|
rows: 3,
|
|
343
361
|
autoFocus: !0,
|
|
362
|
+
"aria-label": b.option.require_note ? "Reason" : "Note (optional)",
|
|
363
|
+
"data-review-confirm-note": !0,
|
|
344
364
|
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",
|
|
345
|
-
placeholder: "Why is this being rejected?"
|
|
365
|
+
placeholder: b.option.require_note ? "Why is this being rejected?" : "Note (optional)"
|
|
346
366
|
}
|
|
347
367
|
),
|
|
348
|
-
/* @__PURE__ */
|
|
349
|
-
/* @__PURE__ */
|
|
368
|
+
/* @__PURE__ */ m("div", { className: "mt-3 flex items-center justify-end gap-1.5", children: [
|
|
369
|
+
/* @__PURE__ */ a(
|
|
350
370
|
"button",
|
|
351
371
|
{
|
|
352
372
|
type: "button",
|
|
353
|
-
|
|
373
|
+
"data-review-confirm-cancel": !0,
|
|
374
|
+
onClick: () => _(null),
|
|
354
375
|
className: "rounded px-2.5 py-1 text-[11px] text-slate-500 hover:bg-slate-100 dark:hover:bg-muted",
|
|
355
376
|
children: "Cancel"
|
|
356
377
|
}
|
|
357
378
|
),
|
|
358
|
-
/* @__PURE__ */
|
|
379
|
+
/* @__PURE__ */ a(
|
|
359
380
|
"button",
|
|
360
381
|
{
|
|
361
382
|
type: "button",
|
|
362
|
-
|
|
383
|
+
"data-review-confirm-submit": !0,
|
|
384
|
+
disabled: !!b.option.require_note && !F.trim(),
|
|
363
385
|
onClick: () => {
|
|
364
|
-
const e =
|
|
365
|
-
|
|
386
|
+
const e = b;
|
|
387
|
+
_(null), Y(e.group, e.option, F.trim() || null);
|
|
366
388
|
},
|
|
367
|
-
className:
|
|
368
|
-
|
|
389
|
+
className: K(
|
|
390
|
+
"rounded px-3 py-1 text-[11px] font-medium hover:brightness-110 disabled:opacity-50",
|
|
391
|
+
b.option.require_note ? "bg-red-600 text-white" : "bg-nvr-cyan text-white"
|
|
392
|
+
),
|
|
393
|
+
children: b.option.label
|
|
369
394
|
}
|
|
370
395
|
)
|
|
371
396
|
] })
|
|
@@ -377,7 +402,7 @@ function we({
|
|
|
377
402
|
] }) });
|
|
378
403
|
}
|
|
379
404
|
export {
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
405
|
+
Ne as ReviewListWidget,
|
|
406
|
+
P as STATUS_COLOR_HEX,
|
|
407
|
+
D as formatValue
|
|
383
408
|
};
|