@nivaro/react 0.3.57 → 0.3.59
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/fields/RelationField.js +110 -80
- package/dist/full.css +1 -1
- package/dist/hooks/useRelationOptions.js +1 -0
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +37 -2
- package/dist/index.js +523 -520
- package/dist/shared/components/CollectionBrowserView.js +2693 -2619
- package/dist/shared/components/DataTable.js +538 -495
- package/dist/shared/components/ItemEditForm.js +4559 -4386
- package/dist/shared/components/PageRenderer.js +537 -508
- package/dist/shared/components/ProfileView.js +716 -715
- package/dist/shared/components/QueryTable.js +74 -74
- package/dist/shared/components/RecordReadView.js +367 -364
- package/dist/shared/components/ReportView.js +64 -39
- package/dist/shared/components/WidgetSlot.js +543 -520
- package/dist/shared/components/alerts/AlertManagerView.js +324 -317
- package/dist/shared/components/alerts/types.js +37 -14
- package/dist/shared/components/cbv/row-focus.js +19 -0
- package/dist/shared/components/help-videos/HelpVideoPlayer.js +152 -147
- package/dist/shared/components/integrations/console/SignalCard.js +59 -59
- package/dist/shared/components/integrations/console/tone.js +52 -30
- package/dist/shared/components/item-edit/CatalogPickerField.js +525 -505
- package/dist/shared/components/item-edit/FieldRenderer.js +22 -20
- package/dist/shared/components/item-edit/FieldRow.js +175 -173
- package/dist/shared/components/item-edit/GridBulkEditDialog.js +55 -54
- package/dist/shared/components/item-edit/InlineTableField.js +2487 -2442
- package/dist/shared/components/item-edit/M2MCombobox.js +321 -295
- package/dist/shared/components/item-edit/MidairCollisionDialog.js +1 -1
- package/dist/shared/components/item-edit/PlanGrid.js +973 -894
- package/dist/shared/components/item-edit/QuickCreateButton.js +335 -106
- package/dist/shared/components/item-edit/RecordLiveSync.js +77 -75
- package/dist/shared/components/item-edit/RelationCombobox.js +452 -335
- package/dist/shared/components/item-edit/RelationGroupedCombobox.js +262 -141
- package/dist/shared/components/item-edit/SummaryPanel.js +385 -358
- package/dist/shared/components/item-edit/duplicate-rehearsal.js +47 -0
- package/dist/shared/components/item-edit/line-midair.js +82 -75
- package/dist/shared/components/item-edit/option-disambiguate.js +44 -32
- package/dist/shared/components/item-edit/related-missing.js +45 -0
- package/dist/shared/components/item-edit/save-outcome.js +9 -7
- package/dist/shared/components/notifications/NotificationRulesEditor.js +130 -123
- package/dist/shared/components/panels/AccessDeniedPanel.js +52 -48
- package/dist/shared/components/panels/ItemLockBanner.js +213 -211
- package/dist/shared/components/panels/PipelinePanel.js +1140 -1053
- package/dist/shared/components/panels/RecordIntegrityBanner.js +114 -86
- package/dist/shared/components/panels/RevisionsPanel.js +316 -299
- package/dist/shared/components/panels/TaskPanel.js +265 -249
- package/dist/shared/components/panels/landing-state.js +27 -0
- package/dist/shared/components/pipeline/PipelineEditorView.js +110 -92
- package/dist/shared/components/profile/AiMemoryCard.js +12 -10
- package/dist/shared/components/queue/OwnerAvatars.js +80 -41
- package/dist/shared/components/queue/QueueQuickFilters.js +52 -52
- package/dist/shared/components/queue/QueueWorklist.js +1050 -1026
- package/dist/shared/components/queue/group-sums.js +27 -0
- package/dist/shared/components/queue/live-state-aspect.js +9 -5
- package/dist/shared/components/widgets/ReviewListWidget.js +175 -154
- package/dist/shared/lib/back-closes.js +25 -0
- package/dist/shared/lib/display-prefs.js +60 -52
- package/dist/shared/lib/draft-store.js +71 -48
- package/dist/shared/lib/expression.js +53 -53
- package/dist/shared/lib/form-usage-beacon.js +7 -7
- package/dist/shared/lib/list-page-memory.js +63 -0
- package/dist/shared/lib/live.js +44 -44
- package/dist/shared/lib/money-input.js +45 -0
- package/dist/shared/lib/own-writes.js +76 -28
- package/dist/shared/lib/request-gate.js +110 -109
- package/dist/shared/lib/sanitize-html.js +10 -6
- package/dist/shared/lib/staged-row-labels.js +18 -0
- package/dist/shared/lib/validation-rules.js +34 -19
- package/package.json +1 -1
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { jsx as n, jsxs as f } from "react/jsx-runtime";
|
|
2
|
-
import { useQuery as
|
|
3
|
-
import { ChevronRight as
|
|
4
|
-
import { useState as
|
|
5
|
-
import { useNivaroClient as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
2
|
+
import { useQuery as se } from "@tanstack/react-query";
|
|
3
|
+
import { ChevronRight as oe, AlertCircle as ie } from "lucide-react";
|
|
4
|
+
import { useState as D, useMemo as W } from "react";
|
|
5
|
+
import { useNivaroClient as de, useItemEditAuth as ue } from "../../context.js";
|
|
6
|
+
import { useBackCloses as ce } from "../../lib/back-closes.js";
|
|
7
|
+
import { post as H, patch as me } from "../../lib/commands.js";
|
|
8
|
+
import { formatDateTime as ee, cn as Q, formatDate as pe } from "../../lib/utils.js";
|
|
9
|
+
import { TooltipProvider as be, Tooltip as fe, TooltipTrigger as xe, TooltipContent as he } from "../ui/tooltip.js";
|
|
10
|
+
function X(r) {
|
|
10
11
|
return r === !0 || r === 1 || r === "1" || r === "true";
|
|
11
12
|
}
|
|
12
|
-
function
|
|
13
|
+
function F(r, t) {
|
|
13
14
|
if (r == null || r === "") return "—";
|
|
14
15
|
if (t === "currency" || t === "number") {
|
|
15
16
|
const a = Number(r);
|
|
@@ -17,11 +18,11 @@ function A(r, t) {
|
|
|
17
18
|
}
|
|
18
19
|
if (t === "date" || t === "datetime") {
|
|
19
20
|
const a = new Date(r);
|
|
20
|
-
return Number.isNaN(a.getTime()) ? String(r) : t === "date" ?
|
|
21
|
+
return Number.isNaN(a.getTime()) ? String(r) : t === "date" ? pe(typeof r == "string" ? r : a) : ee(a);
|
|
21
22
|
}
|
|
22
23
|
return String(r);
|
|
23
24
|
}
|
|
24
|
-
const
|
|
25
|
+
const R = {
|
|
25
26
|
green: "#16a34a",
|
|
26
27
|
red: "#dc2626",
|
|
27
28
|
amber: "#d97706",
|
|
@@ -29,101 +30,103 @@ const I = {
|
|
|
29
30
|
purple: "#9333ea",
|
|
30
31
|
slate: "#64748b"
|
|
31
32
|
};
|
|
32
|
-
function
|
|
33
|
+
function we(r) {
|
|
33
34
|
return {
|
|
34
35
|
backgroundColor: r ? `${r}22` : "#f1f5f9",
|
|
35
36
|
color: r ?? "#475569",
|
|
36
37
|
border: `1px solid ${r ? `${r}44` : "#e2e8f0"}`
|
|
37
38
|
};
|
|
38
39
|
}
|
|
39
|
-
function
|
|
40
|
-
const a = t ?
|
|
40
|
+
function I({ label: r, color: t }) {
|
|
41
|
+
const a = t ? R[t] ?? null : null;
|
|
41
42
|
return /* @__PURE__ */ n(
|
|
42
43
|
"span",
|
|
43
44
|
{
|
|
44
45
|
className: "inline-flex items-center gap-1.5 rounded-full px-2 py-0.5 text-[11px] font-medium",
|
|
45
|
-
style:
|
|
46
|
+
style: we(a),
|
|
46
47
|
children: r
|
|
47
48
|
}
|
|
48
49
|
);
|
|
49
50
|
}
|
|
50
|
-
function
|
|
51
|
+
function ye(r, t) {
|
|
51
52
|
if (r == null || r === "")
|
|
52
53
|
return t.empty_label ? { label: t.empty_label, color: t.empty_color ?? "blue" } : { label: "—", color: null };
|
|
53
|
-
const a = t.options.find((
|
|
54
|
+
const a = t.options.find((b) => b.value === String(r));
|
|
54
55
|
return a ? { label: a.status_label || a.label, color: a.color } : { label: String(r), color: null };
|
|
55
56
|
}
|
|
56
|
-
function
|
|
57
|
+
function ke(r, t) {
|
|
57
58
|
const a = /* @__PURE__ */ new Map();
|
|
58
59
|
for (const x of r.rows) {
|
|
59
60
|
const s = String(x.group ?? ""), h = a.get(s);
|
|
60
61
|
h ? h.push(x) : a.set(s, [x]);
|
|
61
62
|
}
|
|
62
|
-
const
|
|
63
|
-
const
|
|
64
|
-
let
|
|
65
|
-
return t && s.every((
|
|
63
|
+
const b = Array.from(a.entries()).map(([x, s]) => {
|
|
64
|
+
const w = new Set(s.map((j) => String(j.status ?? ""))).size > 1, O = w ? null : s[0].status;
|
|
65
|
+
let C = null;
|
|
66
|
+
return t && s.every((q) => t in q.values) && (C = s.reduce((q, E) => q + (Number(E.values[t]) || 0), 0)), { key: x, rows: s, count: s.length, sum: C, uniformStatus: O, mixedStatus: w };
|
|
66
67
|
});
|
|
67
|
-
return
|
|
68
|
+
return b.sort((x, s) => x.key.localeCompare(s.key, void 0, { numeric: !0 })), b;
|
|
68
69
|
}
|
|
69
|
-
function
|
|
70
|
-
let
|
|
70
|
+
function J(r, t, a) {
|
|
71
|
+
let b = null;
|
|
71
72
|
for (const x of r) {
|
|
72
73
|
const s = x.values[t];
|
|
73
74
|
if (s == null || s === "") continue;
|
|
74
|
-
const h = typeof s == "number" ? s : Date.parse(String(s)),
|
|
75
|
-
Number.isFinite(
|
|
75
|
+
const h = typeof s == "number" ? s : Date.parse(String(s)), w = Number.isNaN(h) ? Number(s) : h;
|
|
76
|
+
Number.isFinite(w) && (b == null || (a ? w > b : w < b)) && (b = w);
|
|
76
77
|
}
|
|
77
|
-
return
|
|
78
|
+
return b;
|
|
78
79
|
}
|
|
79
|
-
function
|
|
80
|
-
const a = r.rows[0],
|
|
81
|
-
const s = t.find((
|
|
80
|
+
function Y(r, t) {
|
|
81
|
+
const a = r.rows[0], b = (x) => {
|
|
82
|
+
const s = t.find((w) => w.role === x);
|
|
82
83
|
if (!s || !a) return null;
|
|
83
84
|
const h = a.values[s.field];
|
|
84
|
-
return h == null || h === "" ? null : `${s.prefix ?? ""}${
|
|
85
|
+
return h == null || h === "" ? null : `${s.prefix ?? ""}${F(h, s.format)}`;
|
|
85
86
|
};
|
|
86
|
-
return { title:
|
|
87
|
+
return { title: b("title") ?? (r.key || "—"), subtitle: b("subtitle") };
|
|
87
88
|
}
|
|
88
|
-
function
|
|
89
|
+
function Z(r, t) {
|
|
89
90
|
const a = (t == null ? void 0 : t.trim()) || "row";
|
|
90
91
|
return `${r} ${a}${r === 1 ? "" : "s"}`;
|
|
91
92
|
}
|
|
92
|
-
function
|
|
93
|
-
const
|
|
94
|
-
return `${r.label} ${
|
|
93
|
+
function ge(r, t, a) {
|
|
94
|
+
const b = a != null && a.trim() ? `${a.trim()} ` : "";
|
|
95
|
+
return `${r.label} ${b}${t.title}${t.subtitle ? ` · ${t.subtitle}` : ""}?`;
|
|
95
96
|
}
|
|
96
|
-
function
|
|
97
|
+
function De({
|
|
97
98
|
data: r,
|
|
98
99
|
config: t,
|
|
99
100
|
loading: a,
|
|
100
|
-
error:
|
|
101
|
+
error: b,
|
|
101
102
|
onRefetch: x,
|
|
102
103
|
hostRecordId: s,
|
|
103
104
|
emptyLabel: h
|
|
104
105
|
}) {
|
|
105
|
-
const
|
|
106
|
-
|
|
106
|
+
const w = de(), { userId: O } = ue(), [C, j] = D(() => /* @__PURE__ */ new Set()), [q, E] = D(null), [L, te] = D({}), [c, _] = D(null), [P, U] = D("");
|
|
107
|
+
ce(() => _(null), c != null);
|
|
108
|
+
const V = W(() => {
|
|
109
|
+
const e = r ? ke(r, t.aggregate_sum) : [], o = t.group_sort;
|
|
107
110
|
if (!(o != null && o.field)) return e;
|
|
108
|
-
const
|
|
109
|
-
return [...e].sort((
|
|
110
|
-
const
|
|
111
|
-
return
|
|
111
|
+
const m = o.direction === "desc";
|
|
112
|
+
return [...e].sort((y, d) => {
|
|
113
|
+
const p = J(y.rows, o.field, m), k = J(d.rows, o.field, m);
|
|
114
|
+
return p == null && k == null ? 0 : p == null ? 1 : k == null ? -1 : m ? k - p : p - k;
|
|
112
115
|
});
|
|
113
|
-
}, [r, t.aggregate_sum, t.group_sort]),
|
|
114
|
-
queryKey: ["review-list-enrich", t.enrich_endpoint ?? "",
|
|
115
|
-
queryFn: () =>
|
|
116
|
-
|
|
116
|
+
}, [r, t.aggregate_sum, t.group_sort]), G = W(() => ((r == null ? void 0 : r.rows) ?? []).map((e) => String(e.id)), [r]), { data: T } = se({
|
|
117
|
+
queryKey: ["review-list-enrich", t.enrich_endpoint ?? "", G.join(",")],
|
|
118
|
+
queryFn: () => w.request(
|
|
119
|
+
H(t.enrich_endpoint, { ids: G })
|
|
117
120
|
).then((e) => {
|
|
118
121
|
var o;
|
|
119
122
|
return ((o = e == null ? void 0 : e.data) == null ? void 0 : o.rows) ?? {};
|
|
120
123
|
}).catch(() => ({})),
|
|
121
|
-
enabled: !!t.enrich_endpoint &&
|
|
124
|
+
enabled: !!t.enrich_endpoint && G.length > 0,
|
|
122
125
|
staleTime: 3e4
|
|
123
|
-
}),
|
|
126
|
+
}), S = (e) => T == null ? void 0 : T[String(e)], z = !!T && Object.values(T).some((e) => {
|
|
124
127
|
var o;
|
|
125
128
|
return (((o = e.chips) == null ? void 0 : o.length) ?? 0) > 0;
|
|
126
|
-
}),
|
|
129
|
+
}), re = V.length === 1;
|
|
127
130
|
if (a)
|
|
128
131
|
return /* @__PURE__ */ n("div", { className: "space-y-2", children: [0, 1].map((e) => /* @__PURE__ */ n(
|
|
129
132
|
"div",
|
|
@@ -132,24 +135,27 @@ function Ce({
|
|
|
132
135
|
},
|
|
133
136
|
e
|
|
134
137
|
)) });
|
|
135
|
-
if (
|
|
136
|
-
return /* @__PURE__ */ n("p", { className: "text-[12px] text-red-500", children:
|
|
138
|
+
if (b)
|
|
139
|
+
return /* @__PURE__ */ n("p", { className: "text-[12px] text-red-500", children: b });
|
|
137
140
|
if (!r || r.rows.length === 0)
|
|
138
141
|
return /* @__PURE__ */ n("p", { className: "text-[12px] italic text-slate-400", children: h ? `No ${h.toLowerCase()} yet` : "Nothing here yet" });
|
|
139
|
-
const
|
|
140
|
-
|
|
141
|
-
const
|
|
142
|
-
return
|
|
142
|
+
const le = (e) => {
|
|
143
|
+
j((o) => {
|
|
144
|
+
const m = new Set(o);
|
|
145
|
+
return m.has(e) ? m.delete(e) : m.add(e), m;
|
|
143
146
|
});
|
|
144
|
-
},
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
147
|
+
}, B = (e, o) => e.rows.map((m) => {
|
|
148
|
+
var y, d, p;
|
|
149
|
+
return (p = (d = (y = S(m.id)) == null ? void 0 : y.confirm_notices) == null ? void 0 : d[o.value]) == null ? void 0 : p.trim();
|
|
150
|
+
}).find((m) => !!m) ?? o.confirm_notice ?? null, ne = (e, o) => {
|
|
151
|
+
U(""), _({ group: e, option: o });
|
|
152
|
+
}, ae = async (e, o, m) => {
|
|
153
|
+
E(e.key);
|
|
154
|
+
let y = null;
|
|
149
155
|
if (t.status.action_endpoint)
|
|
150
156
|
try {
|
|
151
|
-
await
|
|
152
|
-
|
|
157
|
+
await w.request(
|
|
158
|
+
H(t.status.action_endpoint, {
|
|
153
159
|
ids: e.rows.map((d) => d.id),
|
|
154
160
|
status: o.value,
|
|
155
161
|
// The status each row showed: the endpoint may refuse (409) rows
|
|
@@ -158,48 +164,51 @@ function Ce({
|
|
|
158
164
|
expected: Object.fromEntries(
|
|
159
165
|
e.rows.map((d) => [String(d.id), d.status == null ? null : String(d.status)])
|
|
160
166
|
),
|
|
161
|
-
...
|
|
167
|
+
...m ? { note: m } : {},
|
|
162
168
|
...s != null && s !== "" ? { workflow_id: Number(s) } : {}
|
|
163
169
|
})
|
|
164
170
|
);
|
|
165
171
|
} catch (d) {
|
|
166
|
-
const
|
|
167
|
-
|
|
172
|
+
const p = d == null ? void 0 : d.response;
|
|
173
|
+
y = (p == null ? void 0 : p.error) ?? "Failed to update";
|
|
168
174
|
}
|
|
169
175
|
else {
|
|
170
|
-
const d = t.status.stamp_date_field ? (/* @__PURE__ */ new Date()).toISOString() : void 0,
|
|
171
|
-
e.rows.map(async (
|
|
172
|
-
const
|
|
173
|
-
t.status.stamp_user_field &&
|
|
176
|
+
const d = t.status.stamp_date_field ? (/* @__PURE__ */ new Date()).toISOString() : void 0, k = (await Promise.all(
|
|
177
|
+
e.rows.map(async (N) => {
|
|
178
|
+
const g = { [t.status.field]: o.value };
|
|
179
|
+
t.status.stamp_user_field && O && (g[t.status.stamp_user_field] = O), t.status.stamp_date_field && (g[t.status.stamp_date_field] = d), m && (g._change_reason = m);
|
|
174
180
|
try {
|
|
175
|
-
return await
|
|
176
|
-
} catch (
|
|
177
|
-
const
|
|
178
|
-
return { ok: !1, error: (
|
|
181
|
+
return await w.request(me(`/items/${t.collection}/${N.id}`, g)), { ok: !0 };
|
|
182
|
+
} catch ($) {
|
|
183
|
+
const v = $ == null ? void 0 : $.response;
|
|
184
|
+
return { ok: !1, error: (v == null ? void 0 : v.error) ?? "Failed to update" };
|
|
179
185
|
}
|
|
180
186
|
})
|
|
181
|
-
)).filter((
|
|
182
|
-
|
|
187
|
+
)).filter((N) => !N.ok);
|
|
188
|
+
k.length > 0 && (y = `${k.length} of ${e.rows.length} row(s) failed to update`);
|
|
183
189
|
}
|
|
184
|
-
|
|
185
|
-
const
|
|
186
|
-
return
|
|
190
|
+
E(null), te((d) => {
|
|
191
|
+
const p = { ...d };
|
|
192
|
+
return y ? p[e.key] = y : delete p[e.key], p;
|
|
187
193
|
}), x();
|
|
188
|
-
},
|
|
189
|
-
return /* @__PURE__ */ n(
|
|
194
|
+
}, K = r.columns.line_columns, M = r.columns.group_meta;
|
|
195
|
+
return /* @__PURE__ */ n(be, { delayDuration: 200, children: /* @__PURE__ */ f("div", { className: "space-y-2", children: [
|
|
190
196
|
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
|
-
|
|
192
|
-
const o =
|
|
193
|
-
var
|
|
194
|
-
return ((
|
|
195
|
-
}),
|
|
196
|
-
var
|
|
197
|
-
return (
|
|
198
|
-
}).find((l) => !!l) ?? "Only the workflow contact chain (or the PO requestor for invalid holds) can decide this", d =
|
|
197
|
+
V.map((e) => {
|
|
198
|
+
const o = re ? !C.has(e.key) : C.has(e.key), m = e.rows.every((l) => {
|
|
199
|
+
var u;
|
|
200
|
+
return ((u = S(l.id)) == null ? void 0 : u.can_act) !== !1;
|
|
201
|
+
}), y = e.rows.map((l) => {
|
|
202
|
+
var u;
|
|
203
|
+
return (u = S(l.id)) == null ? void 0 : u.reason;
|
|
204
|
+
}).find((l) => !!l) ?? "Only the workflow contact chain (or the PO requestor for invalid holds) can decide this", d = e.rows.map((l) => {
|
|
205
|
+
var u, i;
|
|
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) => {
|
|
199
208
|
var i;
|
|
200
|
-
for (const
|
|
201
|
-
if (
|
|
202
|
-
|
|
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");
|
|
203
212
|
}
|
|
204
213
|
return l;
|
|
205
214
|
}, null);
|
|
@@ -208,7 +217,7 @@ function Ce({
|
|
|
208
217
|
{
|
|
209
218
|
"data-review-group": e.key,
|
|
210
219
|
"data-review-tone": v ?? void 0,
|
|
211
|
-
className:
|
|
220
|
+
className: Q(
|
|
212
221
|
"rounded-md border",
|
|
213
222
|
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"
|
|
214
223
|
),
|
|
@@ -218,11 +227,11 @@ function Ce({
|
|
|
218
227
|
"button",
|
|
219
228
|
{
|
|
220
229
|
type: "button",
|
|
221
|
-
onClick: () =>
|
|
230
|
+
onClick: () => le(e.key),
|
|
222
231
|
className: "flex min-w-0 flex-1 flex-wrap items-center gap-2 text-left",
|
|
223
232
|
children: [
|
|
224
233
|
/* @__PURE__ */ n(
|
|
225
|
-
|
|
234
|
+
oe,
|
|
226
235
|
{
|
|
227
236
|
className: `h-3.5 w-3.5 shrink-0 text-slate-400 transition-transform ${o ? "rotate-90" : ""}`
|
|
228
237
|
}
|
|
@@ -232,97 +241,109 @@ function Ce({
|
|
|
232
241
|
{
|
|
233
242
|
className: "text-[12px] font-medium text-slate-700 dark:text-slate-200",
|
|
234
243
|
"data-review-group-title": !0,
|
|
235
|
-
children:
|
|
244
|
+
children: p.title
|
|
236
245
|
}
|
|
237
246
|
),
|
|
238
|
-
|
|
247
|
+
p.subtitle && /* @__PURE__ */ n("span", { className: "text-[11.5px] text-slate-500 dark:text-slate-400", children: p.subtitle }),
|
|
239
248
|
/* @__PURE__ */ f("span", { className: "text-[11px] text-slate-400", children: [
|
|
240
|
-
|
|
241
|
-
e.sum != null ? ` · ${
|
|
249
|
+
Z(e.count, t.row_noun),
|
|
250
|
+
e.sum != null ? ` · ${F(e.sum, t.aggregate_sum_format ?? "number")}` : ""
|
|
242
251
|
] }),
|
|
243
|
-
|
|
252
|
+
M.map((l) => {
|
|
244
253
|
if (l.role) return null;
|
|
245
|
-
const
|
|
246
|
-
return l.format === "flag" ?
|
|
254
|
+
const u = N.values[l.field];
|
|
255
|
+
return l.format === "flag" ? X(u) ? /* @__PURE__ */ n(I, { label: l.label, color: l.color ?? "amber" }, l.field) : null : u == null || u === "" ? null : /* @__PURE__ */ f(
|
|
247
256
|
"span",
|
|
248
257
|
{
|
|
249
258
|
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",
|
|
250
259
|
children: [
|
|
251
260
|
l.label,
|
|
252
261
|
": ",
|
|
253
|
-
|
|
262
|
+
F(u, l.format)
|
|
254
263
|
]
|
|
255
264
|
},
|
|
256
265
|
l.field
|
|
257
266
|
);
|
|
258
267
|
}),
|
|
259
|
-
/* @__PURE__ */ n(
|
|
260
|
-
g && /* @__PURE__ */ f(
|
|
261
|
-
/* @__PURE__ */ n(
|
|
262
|
-
/* @__PURE__ */ f(
|
|
268
|
+
/* @__PURE__ */ n(I, { label: k.label, color: k.color }),
|
|
269
|
+
g && /* @__PURE__ */ f(fe, { children: [
|
|
270
|
+
/* @__PURE__ */ n(xe, { asChild: !0, children: /* @__PURE__ */ n("span", { className: "cursor-default text-[11px] text-slate-400 underline decoration-dotted", children: g.label }) }),
|
|
271
|
+
/* @__PURE__ */ f(he, { side: "top", className: "text-[12px]", children: [
|
|
263
272
|
/* @__PURE__ */ n("p", { className: "font-medium", children: g.label }),
|
|
264
|
-
|
|
273
|
+
$ && /* @__PURE__ */ n("p", { className: "text-muted-foreground", children: ee($) })
|
|
265
274
|
] })
|
|
266
275
|
] })
|
|
267
276
|
]
|
|
268
277
|
}
|
|
269
278
|
),
|
|
270
279
|
/* @__PURE__ */ f("span", { className: "flex flex-wrap items-center gap-1.5", children: [
|
|
271
|
-
!
|
|
280
|
+
!m && /* @__PURE__ */ n(
|
|
272
281
|
"span",
|
|
273
282
|
{
|
|
274
283
|
className: "text-[11px] text-slate-400",
|
|
275
|
-
title:
|
|
284
|
+
title: y,
|
|
276
285
|
"data-review-view-only": !0,
|
|
277
286
|
children: "View only"
|
|
278
287
|
}
|
|
279
288
|
),
|
|
280
|
-
|
|
281
|
-
const
|
|
289
|
+
m && t.status.options.map((l) => {
|
|
290
|
+
const u = !e.mixedStatus && String(e.uniformStatus) === l.value, i = R[l.color] ?? R.slate, A = q === e.key;
|
|
282
291
|
return /* @__PURE__ */ n(
|
|
283
292
|
"button",
|
|
284
293
|
{
|
|
285
294
|
type: "button",
|
|
286
|
-
disabled:
|
|
287
|
-
onClick: () =>
|
|
295
|
+
disabled: A || u,
|
|
296
|
+
onClick: () => ne(e, l),
|
|
288
297
|
className: "rounded-md border px-2.5 py-1 text-[11px] font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50",
|
|
289
298
|
style: {
|
|
290
|
-
backgroundColor:
|
|
299
|
+
backgroundColor: u ? `${i}22` : "transparent",
|
|
291
300
|
borderColor: `${i}55`,
|
|
292
301
|
color: i
|
|
293
302
|
},
|
|
294
|
-
children:
|
|
303
|
+
children: A ? "…" : l.label
|
|
295
304
|
},
|
|
296
305
|
l.value
|
|
297
306
|
);
|
|
298
307
|
})
|
|
299
308
|
] })
|
|
300
309
|
] }),
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
310
|
+
d && /* @__PURE__ */ f(
|
|
311
|
+
"p",
|
|
312
|
+
{
|
|
313
|
+
"data-review-decision-note": !0,
|
|
314
|
+
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
|
+
children: [
|
|
316
|
+
/* @__PURE__ */ n("span", { className: "font-medium", children: "Reason:" }),
|
|
317
|
+
" ",
|
|
318
|
+
/* @__PURE__ */ n("span", { className: "whitespace-pre-line", children: d })
|
|
319
|
+
]
|
|
320
|
+
}
|
|
321
|
+
),
|
|
322
|
+
L[e.key] && /* @__PURE__ */ f("p", { className: "flex items-center gap-1 px-3 pb-2 text-[11px] text-red-600", children: [
|
|
323
|
+
/* @__PURE__ */ n(ie, { className: "h-3 w-3 shrink-0" }),
|
|
324
|
+
L[e.key]
|
|
304
325
|
] }),
|
|
305
326
|
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
327
|
/* @__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
|
-
|
|
308
|
-
|
|
328
|
+
K.map((l) => /* @__PURE__ */ n("th", { className: "px-2.5 py-1.5 font-medium", children: l.label }, l.field)),
|
|
329
|
+
z && /* @__PURE__ */ n("th", { className: "px-2.5 py-1.5 font-medium", children: "Match" })
|
|
309
330
|
] }) }),
|
|
310
331
|
/* @__PURE__ */ n("tbody", { children: e.rows.map((l) => {
|
|
311
|
-
var
|
|
332
|
+
var u;
|
|
312
333
|
return /* @__PURE__ */ f(
|
|
313
334
|
"tr",
|
|
314
335
|
{
|
|
315
336
|
className: "border-b border-slate-100 last:border-b-0 dark:border-border/50",
|
|
316
337
|
children: [
|
|
317
|
-
|
|
338
|
+
K.map((i) => /* @__PURE__ */ n(
|
|
318
339
|
"td",
|
|
319
340
|
{
|
|
320
341
|
className: "px-2.5 py-1.5 text-slate-600 dark:text-slate-300",
|
|
321
|
-
children: i.format === "flag" ?
|
|
342
|
+
children: i.format === "flag" ? X(l.values[i.field]) ? /* @__PURE__ */ n(I, { label: i.label, color: i.color ?? "amber" }) : "—" : F(l.values[i.field], i.format)
|
|
322
343
|
},
|
|
323
344
|
i.field
|
|
324
345
|
)),
|
|
325
|
-
|
|
346
|
+
z && /* @__PURE__ */ n("td", { className: "px-2.5 py-1.5", children: /* @__PURE__ */ n("span", { className: "flex flex-wrap gap-1", children: (((u = S(l.id)) == null ? void 0 : u.chips) ?? []).map((i) => /* @__PURE__ */ n(
|
|
326
347
|
"span",
|
|
327
348
|
{
|
|
328
349
|
title: i.title,
|
|
@@ -342,13 +363,13 @@ function Ce({
|
|
|
342
363
|
e.key
|
|
343
364
|
);
|
|
344
365
|
}),
|
|
345
|
-
|
|
366
|
+
c && /* @__PURE__ */ n(
|
|
346
367
|
"div",
|
|
347
368
|
{
|
|
348
369
|
className: "fixed inset-0 z-[130] flex items-center justify-center bg-black/40 p-4",
|
|
349
|
-
onClick: () =>
|
|
370
|
+
onClick: () => _(null),
|
|
350
371
|
onKeyDown: (e) => {
|
|
351
|
-
e.key === "Escape" && (e.stopPropagation(),
|
|
372
|
+
e.key === "Escape" && (e.stopPropagation(), _(null));
|
|
352
373
|
},
|
|
353
374
|
children: /* @__PURE__ */ f(
|
|
354
375
|
"div",
|
|
@@ -356,7 +377,7 @@ function Ce({
|
|
|
356
377
|
role: "dialog",
|
|
357
378
|
"aria-modal": "true",
|
|
358
379
|
"aria-labelledby": "review-confirm-title",
|
|
359
|
-
"data-review-confirm":
|
|
380
|
+
"data-review-confirm": c.option.value,
|
|
360
381
|
className: "w-full max-w-md rounded-lg border border-slate-200 bg-white p-4 shadow-xl dark:border-border dark:bg-card",
|
|
361
382
|
onClick: (e) => e.stopPropagation(),
|
|
362
383
|
children: [
|
|
@@ -365,36 +386,36 @@ function Ce({
|
|
|
365
386
|
{
|
|
366
387
|
id: "review-confirm-title",
|
|
367
388
|
className: "text-[13px] font-medium text-slate-700 dark:text-slate-200",
|
|
368
|
-
children:
|
|
369
|
-
|
|
370
|
-
|
|
389
|
+
children: ge(
|
|
390
|
+
c.option,
|
|
391
|
+
Y(c.group, M),
|
|
371
392
|
t.group_noun
|
|
372
393
|
)
|
|
373
394
|
}
|
|
374
395
|
),
|
|
375
396
|
/* @__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
|
-
|
|
377
|
-
|
|
397
|
+
Z(c.group.count, t.row_noun),
|
|
398
|
+
c.group.sum != null ? ` · ${F(c.group.sum, t.aggregate_sum_format ?? "number")}` : ""
|
|
378
399
|
] }),
|
|
379
400
|
/* @__PURE__ */ n(
|
|
380
401
|
"p",
|
|
381
402
|
{
|
|
382
403
|
className: "mt-1.5 text-[11px] text-slate-500 dark:text-slate-400",
|
|
383
404
|
"data-review-confirm-notice": !0,
|
|
384
|
-
children:
|
|
405
|
+
children: B(c.group, c.option) ? `${B(c.group, c.option)}${c.option.require_note ? " A reason is required." : ""}` : c.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
406
|
}
|
|
386
407
|
),
|
|
387
408
|
/* @__PURE__ */ n(
|
|
388
409
|
"textarea",
|
|
389
410
|
{
|
|
390
|
-
value:
|
|
391
|
-
onChange: (e) =>
|
|
411
|
+
value: P,
|
|
412
|
+
onChange: (e) => U(e.target.value),
|
|
392
413
|
rows: 3,
|
|
393
414
|
autoFocus: !0,
|
|
394
|
-
"aria-label":
|
|
415
|
+
"aria-label": c.option.require_note ? "Reason" : "Note (optional)",
|
|
395
416
|
"data-review-confirm-note": !0,
|
|
396
417
|
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",
|
|
397
|
-
placeholder:
|
|
418
|
+
placeholder: c.option.require_note ? "Why is this being rejected?" : "Note (optional)"
|
|
398
419
|
}
|
|
399
420
|
),
|
|
400
421
|
/* @__PURE__ */ f("div", { className: "mt-3 flex items-center justify-end gap-1.5", children: [
|
|
@@ -403,7 +424,7 @@ function Ce({
|
|
|
403
424
|
{
|
|
404
425
|
type: "button",
|
|
405
426
|
"data-review-confirm-cancel": !0,
|
|
406
|
-
onClick: () =>
|
|
427
|
+
onClick: () => _(null),
|
|
407
428
|
className: "rounded px-2.5 py-1 text-[11px] text-slate-500 hover:bg-slate-100 dark:hover:bg-muted",
|
|
408
429
|
children: "Cancel"
|
|
409
430
|
}
|
|
@@ -413,16 +434,16 @@ function Ce({
|
|
|
413
434
|
{
|
|
414
435
|
type: "button",
|
|
415
436
|
"data-review-confirm-submit": !0,
|
|
416
|
-
disabled: !!
|
|
437
|
+
disabled: !!c.option.require_note && !P.trim(),
|
|
417
438
|
onClick: () => {
|
|
418
|
-
const e =
|
|
419
|
-
|
|
439
|
+
const e = c;
|
|
440
|
+
_(null), ae(e.group, e.option, P.trim() || null);
|
|
420
441
|
},
|
|
421
|
-
className:
|
|
442
|
+
className: Q(
|
|
422
443
|
"rounded px-3 py-1 text-[11px] font-medium hover:brightness-110 disabled:opacity-50",
|
|
423
|
-
|
|
444
|
+
c.option.require_note ? "bg-red-600 text-white" : "bg-nvr-cyan text-white"
|
|
424
445
|
),
|
|
425
|
-
children:
|
|
446
|
+
children: c.option.label
|
|
426
447
|
}
|
|
427
448
|
)
|
|
428
449
|
] })
|
|
@@ -434,10 +455,10 @@ function Ce({
|
|
|
434
455
|
] }) });
|
|
435
456
|
}
|
|
436
457
|
export {
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
458
|
+
De as ReviewListWidget,
|
|
459
|
+
R as STATUS_COLOR_HEX,
|
|
460
|
+
ge as confirmTitle,
|
|
461
|
+
Z as countLabel,
|
|
462
|
+
F as formatValue,
|
|
463
|
+
Y as groupName
|
|
443
464
|
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { useRef as a, useEffect as w } from "react";
|
|
2
|
+
let d = 0;
|
|
3
|
+
function f(e, t = !0) {
|
|
4
|
+
const o = a(e);
|
|
5
|
+
o.current = e, w(() => {
|
|
6
|
+
if (!t || typeof window > "u") return;
|
|
7
|
+
const r = `nvr-dialog-${++d}`, n = () => {
|
|
8
|
+
var u;
|
|
9
|
+
return ((u = window.history.state) == null ? void 0 : u.nvrDialog) === r;
|
|
10
|
+
};
|
|
11
|
+
window.history.pushState({ ...window.history.state ?? {}, nvrDialog: r }, "");
|
|
12
|
+
let s = !1;
|
|
13
|
+
const i = () => {
|
|
14
|
+
n() || (s = !0, o.current());
|
|
15
|
+
};
|
|
16
|
+
return window.addEventListener("popstate", i), () => {
|
|
17
|
+
window.removeEventListener("popstate", i), s || setTimeout(() => {
|
|
18
|
+
n() && window.history.back();
|
|
19
|
+
}, 0);
|
|
20
|
+
};
|
|
21
|
+
}, [t]);
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
f as useBackCloses
|
|
25
|
+
};
|