@nivaro/react 0.3.10 → 0.3.11
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/useNivaroForm.js +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +34 -3
- package/dist/shared/components/CollectionBrowserView.js +1546 -1477
- package/dist/shared/components/ItemEditForm.js +4332 -4195
- package/dist/shared/components/PageRenderer.js +512 -465
- package/dist/shared/components/QueryStatStrip.js +74 -70
- package/dist/shared/components/ReportView.js +818 -827
- package/dist/shared/components/SheetHeaderBody.js +16 -14
- package/dist/shared/components/item-edit/CatalogPickerField.js +1029 -933
- package/dist/shared/components/item-edit/FieldRenderer.js +161 -156
- package/dist/shared/components/item-edit/FieldRow.js +20 -19
- package/dist/shared/components/item-edit/FilePickerField.js +52 -40
- package/dist/shared/components/item-edit/GroupSection.js +221 -221
- package/dist/shared/components/item-edit/InlineGridField.js +41 -41
- package/dist/shared/components/item-edit/InlineTableField.js +2249 -2238
- package/dist/shared/components/item-edit/M2MCombobox.js +46 -44
- package/dist/shared/components/item-edit/NestedRelationEditor.js +11 -11
- package/dist/shared/components/item-edit/QuickPicker.js +263 -216
- package/dist/shared/components/item-edit/RelationCombobox.js +285 -245
- package/dist/shared/components/item-edit/RichTextEditorImpl.js +42 -32
- package/dist/shared/components/item-edit/RowHistorySheet.js +130 -134
- package/dist/shared/components/item-edit/SummaryPanel.js +305 -279
- package/dist/shared/components/item-edit/helpers.js +133 -134
- package/dist/shared/components/item-edit/line-qty.js +57 -0
- package/dist/shared/components/item-edit/option-disambiguate.js +53 -0
- package/dist/shared/components/panels/AddendumLinesDiff.js +87 -90
- package/dist/shared/components/panels/CommentPanel.js +350 -315
- package/dist/shared/components/panels/ItemLockBanner.js +297 -230
- package/dist/shared/components/panels/PipelinePanel.js +719 -701
- package/dist/shared/components/queue/QueueQuickFilters.js +43 -41
- package/dist/shared/components/queue/QueueWorklist.js +1005 -935
- package/dist/shared/components/widgets/ReviewListWidget.js +99 -93
- package/dist/shared/lib/obligation-banner.js +14 -13
- package/dist/shared/lib/obligation-reason-text.js +13 -0
- package/dist/shared/lib/query-filter-seed.js +34 -11
- package/dist/shared/lib/sanitize-html.js +24 -15
- package/dist/shared/lib/sheet-def.js +38 -22
- package/dist/shared/lib/unique-options.js +10 -0
- package/dist/shared/lib/utils.js +57 -43
- package/dist/shared/lib/validation-rules.js +58 -34
- package/package.json +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsx as s, jsxs as
|
|
1
|
+
import { jsx as s, jsxs as b } from "react/jsx-runtime";
|
|
2
2
|
import { useQuery as Z } from "@tanstack/react-query";
|
|
3
3
|
import { ChevronRight as ee, AlertCircle as te } from "lucide-react";
|
|
4
4
|
import { useState as S, useMemo as L } from "react";
|
|
5
5
|
import { useNivaroClient as re, useItemEditAuth as le } from "../../context.js";
|
|
6
6
|
import { post as R, patch as se } from "../../lib/commands.js";
|
|
7
|
-
import { formatDateTime as H, cn as
|
|
7
|
+
import { formatDateTime as H, cn as ne, formatDate as ae } from "../../lib/utils.js";
|
|
8
8
|
import { TooltipProvider as oe, Tooltip as de, TooltipTrigger as ie, TooltipContent as ue } from "../ui/tooltip.js";
|
|
9
9
|
function W(t) {
|
|
10
10
|
return t === !0 || t === 1 || t === "1" || t === "true";
|
|
@@ -17,11 +17,11 @@ function O(t, r) {
|
|
|
17
17
|
}
|
|
18
18
|
if (r === "date" || r === "datetime") {
|
|
19
19
|
const d = new Date(t);
|
|
20
|
-
return Number.isNaN(d.getTime()) ? String(t) : r === "date" ?
|
|
20
|
+
return Number.isNaN(d.getTime()) ? String(t) : r === "date" ? ae(d) : H(d);
|
|
21
21
|
}
|
|
22
22
|
return String(t);
|
|
23
23
|
}
|
|
24
|
-
const
|
|
24
|
+
const G = {
|
|
25
25
|
green: "#16a34a",
|
|
26
26
|
red: "#dc2626",
|
|
27
27
|
amber: "#d97706",
|
|
@@ -36,8 +36,8 @@ function ce(t) {
|
|
|
36
36
|
border: `1px solid ${t ? `${t}44` : "#e2e8f0"}`
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
|
-
function
|
|
40
|
-
const d = r ?
|
|
39
|
+
function E({ label: t, color: r }) {
|
|
40
|
+
const d = r ? G[r] ?? null : null;
|
|
41
41
|
return /* @__PURE__ */ s(
|
|
42
42
|
"span",
|
|
43
43
|
{
|
|
@@ -85,27 +85,27 @@ function we({
|
|
|
85
85
|
hostRecordId: o,
|
|
86
86
|
emptyLabel: y
|
|
87
87
|
}) {
|
|
88
|
-
const x = re(), { userId: C } = le(), [g, T] = S(() => /* @__PURE__ */ new Set()), [w, $] = S(null), [
|
|
89
|
-
const e = t ? be(t, r.aggregate_sum) : [],
|
|
90
|
-
if (!(
|
|
91
|
-
const
|
|
92
|
-
return [...e].sort((k,
|
|
93
|
-
const
|
|
94
|
-
return
|
|
88
|
+
const x = re(), { userId: C } = le(), [g, T] = S(() => /* @__PURE__ */ new Set()), [w, $] = S(null), [M, K] = S({}), [A, D] = S(null), [F, P] = S(""), I = L(() => {
|
|
89
|
+
const e = t ? be(t, r.aggregate_sum) : [], a = r.group_sort;
|
|
90
|
+
if (!(a != null && a.field)) return e;
|
|
91
|
+
const m = a.direction === "desc";
|
|
92
|
+
return [...e].sort((k, i) => {
|
|
93
|
+
const c = B(k.rows, a.field, m), h = B(i.rows, a.field, m);
|
|
94
|
+
return c == null && h == null ? 0 : c == null ? 1 : h == null ? -1 : m ? h - c : c - h;
|
|
95
95
|
});
|
|
96
|
-
}, [t, r.aggregate_sum, r.group_sort]),
|
|
97
|
-
queryKey: ["review-list-enrich", r.enrich_endpoint ?? "",
|
|
96
|
+
}, [t, r.aggregate_sum, r.group_sort]), j = L(() => ((t == null ? void 0 : t.rows) ?? []).map((e) => String(e.id)), [t]), { data: v } = Z({
|
|
97
|
+
queryKey: ["review-list-enrich", r.enrich_endpoint ?? "", j.join(",")],
|
|
98
98
|
queryFn: () => x.request(
|
|
99
|
-
R(r.enrich_endpoint, { ids:
|
|
99
|
+
R(r.enrich_endpoint, { ids: j })
|
|
100
100
|
).then((e) => {
|
|
101
|
-
var
|
|
102
|
-
return ((
|
|
101
|
+
var a;
|
|
102
|
+
return ((a = e == null ? void 0 : e.data) == null ? void 0 : a.rows) ?? {};
|
|
103
103
|
}).catch(() => ({})),
|
|
104
|
-
enabled: !!r.enrich_endpoint &&
|
|
104
|
+
enabled: !!r.enrich_endpoint && j.length > 0,
|
|
105
105
|
staleTime: 3e4
|
|
106
|
-
}),
|
|
107
|
-
var
|
|
108
|
-
return (((
|
|
106
|
+
}), q = (e) => v == null ? void 0 : v[String(e)], U = !!v && Object.values(v).some((e) => {
|
|
107
|
+
var a;
|
|
108
|
+
return (((a = e.chips) == null ? void 0 : a.length) ?? 0) > 0;
|
|
109
109
|
}), Q = I.length === 1;
|
|
110
110
|
if (d)
|
|
111
111
|
return /* @__PURE__ */ s("div", { className: "space-y-2", children: [0, 1].map((e) => /* @__PURE__ */ s(
|
|
@@ -120,79 +120,85 @@ function we({
|
|
|
120
120
|
if (!t || t.rows.length === 0)
|
|
121
121
|
return /* @__PURE__ */ s("p", { className: "text-[12px] italic text-slate-400", children: y ? `No ${y.toLowerCase()} yet` : "Nothing here yet" });
|
|
122
122
|
const X = (e) => {
|
|
123
|
-
T((
|
|
124
|
-
const
|
|
125
|
-
return
|
|
123
|
+
T((a) => {
|
|
124
|
+
const m = new Set(a);
|
|
125
|
+
return m.has(e) ? m.delete(e) : m.add(e), m;
|
|
126
126
|
});
|
|
127
|
-
}, J = (e,
|
|
128
|
-
if (
|
|
129
|
-
|
|
127
|
+
}, J = (e, a) => {
|
|
128
|
+
if (a.require_note) {
|
|
129
|
+
P(""), D({ group: e, option: a });
|
|
130
130
|
return;
|
|
131
131
|
}
|
|
132
|
-
V(e,
|
|
133
|
-
}, V = async (e,
|
|
132
|
+
V(e, a, null);
|
|
133
|
+
}, V = async (e, a, m) => {
|
|
134
134
|
$(e.key);
|
|
135
135
|
let k = null;
|
|
136
136
|
if (r.status.action_endpoint)
|
|
137
137
|
try {
|
|
138
138
|
await x.request(
|
|
139
139
|
R(r.status.action_endpoint, {
|
|
140
|
-
ids: e.rows.map((
|
|
141
|
-
status:
|
|
142
|
-
|
|
140
|
+
ids: e.rows.map((i) => i.id),
|
|
141
|
+
status: a.value,
|
|
142
|
+
// The status each row showed: the endpoint may refuse (409) rows
|
|
143
|
+
// someone changed since this list loaded instead of overwriting
|
|
144
|
+
// them. The refetch below shows what they are now.
|
|
145
|
+
expected: Object.fromEntries(
|
|
146
|
+
e.rows.map((i) => [String(i.id), i.status == null ? null : String(i.status)])
|
|
147
|
+
),
|
|
148
|
+
...m ? { note: m } : {},
|
|
143
149
|
...o != null && o !== "" ? { workflow_id: Number(o) } : {}
|
|
144
150
|
})
|
|
145
151
|
);
|
|
146
|
-
} catch (
|
|
147
|
-
const
|
|
148
|
-
k = (
|
|
152
|
+
} catch (i) {
|
|
153
|
+
const c = i == null ? void 0 : i.response;
|
|
154
|
+
k = (c == null ? void 0 : c.error) ?? "Failed to update";
|
|
149
155
|
}
|
|
150
156
|
else {
|
|
151
|
-
const
|
|
157
|
+
const i = r.status.stamp_date_field ? (/* @__PURE__ */ new Date()).toISOString() : void 0, h = (await Promise.all(
|
|
152
158
|
e.rows.map(async (N) => {
|
|
153
|
-
const l = { [r.status.field]:
|
|
154
|
-
r.status.stamp_user_field && C && (l[r.status.stamp_user_field] = C), r.status.stamp_date_field && (l[r.status.stamp_date_field] =
|
|
159
|
+
const l = { [r.status.field]: a.value };
|
|
160
|
+
r.status.stamp_user_field && C && (l[r.status.stamp_user_field] = C), r.status.stamp_date_field && (l[r.status.stamp_date_field] = i), m && (l._change_reason = m);
|
|
155
161
|
try {
|
|
156
162
|
return await x.request(se(`/items/${r.collection}/${N.id}`, l)), { ok: !0 };
|
|
157
|
-
} catch (
|
|
158
|
-
const
|
|
159
|
-
return { ok: !1, error: (
|
|
163
|
+
} catch (u) {
|
|
164
|
+
const n = u == null ? void 0 : u.response;
|
|
165
|
+
return { ok: !1, error: (n == null ? void 0 : n.error) ?? "Failed to update" };
|
|
160
166
|
}
|
|
161
167
|
})
|
|
162
168
|
)).filter((N) => !N.ok);
|
|
163
169
|
h.length > 0 && (k = `${h.length} of ${e.rows.length} row(s) failed to update`);
|
|
164
170
|
}
|
|
165
|
-
$(null), K((
|
|
166
|
-
const
|
|
167
|
-
return k ?
|
|
171
|
+
$(null), K((i) => {
|
|
172
|
+
const c = { ...i };
|
|
173
|
+
return k ? c[e.key] = k : delete c[e.key], c;
|
|
168
174
|
}), f();
|
|
169
175
|
}, z = t.columns.line_columns, Y = t.columns.group_meta;
|
|
170
|
-
return /* @__PURE__ */ s(oe, { delayDuration: 200, children: /* @__PURE__ */
|
|
176
|
+
return /* @__PURE__ */ s(oe, { delayDuration: 200, children: /* @__PURE__ */ b("div", { className: "space-y-2", children: [
|
|
171
177
|
t.truncated && /* @__PURE__ */ s("p", { className: "text-[11px] text-amber-600 dark:text-amber-400", children: "Showing first 2000 rows — some rows may be missing." }),
|
|
172
178
|
I.map((e) => {
|
|
173
|
-
const
|
|
174
|
-
var
|
|
175
|
-
return ((
|
|
176
|
-
}), k = e.mixedStatus ? { label: "Mixed", color: null } : me(e.uniformStatus, r.status),
|
|
177
|
-
var
|
|
178
|
-
for (const _ of ((
|
|
179
|
+
const a = Q ? !g.has(e.key) : g.has(e.key), m = e.rows.every((l) => {
|
|
180
|
+
var u;
|
|
181
|
+
return ((u = q(l.id)) == null ? void 0 : u.can_act) !== !1;
|
|
182
|
+
}), k = e.mixedStatus ? { label: "Mixed", color: null } : me(e.uniformStatus, r.status), i = e.rows[0], c = i.stamp_user, h = i.stamp_date, N = e.rows.reduce((l, u) => {
|
|
183
|
+
var n;
|
|
184
|
+
for (const _ of ((n = q(u.id)) == null ? void 0 : n.chips) ?? []) {
|
|
179
185
|
if (_.tone === "danger") return "danger";
|
|
180
186
|
_.tone === "warn" && l == null && (l = "warn");
|
|
181
187
|
}
|
|
182
188
|
return l;
|
|
183
189
|
}, null);
|
|
184
|
-
return /* @__PURE__ */
|
|
190
|
+
return /* @__PURE__ */ b(
|
|
185
191
|
"div",
|
|
186
192
|
{
|
|
187
193
|
"data-review-group": e.key,
|
|
188
194
|
"data-review-tone": N ?? void 0,
|
|
189
|
-
className:
|
|
195
|
+
className: ne(
|
|
190
196
|
"rounded-md border",
|
|
191
197
|
N === "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" : N === "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"
|
|
192
198
|
),
|
|
193
199
|
children: [
|
|
194
|
-
/* @__PURE__ */
|
|
195
|
-
/* @__PURE__ */
|
|
200
|
+
/* @__PURE__ */ b("div", { className: "flex w-full flex-wrap items-center gap-2 px-3 py-2", children: [
|
|
201
|
+
/* @__PURE__ */ b(
|
|
196
202
|
"button",
|
|
197
203
|
{
|
|
198
204
|
type: "button",
|
|
@@ -202,44 +208,44 @@ function we({
|
|
|
202
208
|
/* @__PURE__ */ s(
|
|
203
209
|
ee,
|
|
204
210
|
{
|
|
205
|
-
className: `h-3.5 w-3.5 shrink-0 text-slate-400 transition-transform ${
|
|
211
|
+
className: `h-3.5 w-3.5 shrink-0 text-slate-400 transition-transform ${a ? "rotate-90" : ""}`
|
|
206
212
|
}
|
|
207
213
|
),
|
|
208
214
|
/* @__PURE__ */ s("span", { className: "text-[12px] font-medium text-slate-700 dark:text-slate-200", children: e.key || "—" }),
|
|
209
|
-
/* @__PURE__ */
|
|
215
|
+
/* @__PURE__ */ b("span", { className: "text-[11px] text-slate-400", children: [
|
|
210
216
|
e.count,
|
|
211
217
|
" row",
|
|
212
218
|
e.count === 1 ? "" : "s",
|
|
213
219
|
e.sum != null ? ` · ${O(e.sum, r.aggregate_sum_format ?? "number")}` : ""
|
|
214
220
|
] }),
|
|
215
221
|
Y.map((l) => {
|
|
216
|
-
const
|
|
217
|
-
return l.format === "flag" ? W(
|
|
222
|
+
const u = i.values[l.field];
|
|
223
|
+
return l.format === "flag" ? W(u) ? /* @__PURE__ */ s(E, { label: l.label, color: l.color ?? "amber" }, l.field) : null : u == null || u === "" ? null : /* @__PURE__ */ b(
|
|
218
224
|
"span",
|
|
219
225
|
{
|
|
220
226
|
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",
|
|
221
227
|
children: [
|
|
222
228
|
l.label,
|
|
223
229
|
": ",
|
|
224
|
-
O(
|
|
230
|
+
O(u, l.format)
|
|
225
231
|
]
|
|
226
232
|
},
|
|
227
233
|
l.field
|
|
228
234
|
);
|
|
229
235
|
}),
|
|
230
|
-
/* @__PURE__ */ s(
|
|
231
|
-
|
|
232
|
-
/* @__PURE__ */ s(ie, { asChild: !0, children: /* @__PURE__ */ s("span", { className: "cursor-default text-[11px] text-slate-400 underline decoration-dotted", children:
|
|
233
|
-
/* @__PURE__ */
|
|
234
|
-
/* @__PURE__ */ s("p", { className: "font-medium", children:
|
|
236
|
+
/* @__PURE__ */ s(E, { label: k.label, color: k.color }),
|
|
237
|
+
c && /* @__PURE__ */ b(de, { children: [
|
|
238
|
+
/* @__PURE__ */ s(ie, { asChild: !0, children: /* @__PURE__ */ s("span", { className: "cursor-default text-[11px] text-slate-400 underline decoration-dotted", children: c.label }) }),
|
|
239
|
+
/* @__PURE__ */ b(ue, { side: "top", className: "text-[12px]", children: [
|
|
240
|
+
/* @__PURE__ */ s("p", { className: "font-medium", children: c.label }),
|
|
235
241
|
h && /* @__PURE__ */ s("p", { className: "text-muted-foreground", children: H(h) })
|
|
236
242
|
] })
|
|
237
243
|
] })
|
|
238
244
|
]
|
|
239
245
|
}
|
|
240
246
|
),
|
|
241
|
-
/* @__PURE__ */
|
|
242
|
-
!
|
|
247
|
+
/* @__PURE__ */ b("span", { className: "flex flex-wrap items-center gap-1.5", children: [
|
|
248
|
+
!m && /* @__PURE__ */ s(
|
|
243
249
|
"span",
|
|
244
250
|
{
|
|
245
251
|
className: "text-[11px] text-slate-400",
|
|
@@ -247,19 +253,19 @@ function we({
|
|
|
247
253
|
children: "View only"
|
|
248
254
|
}
|
|
249
255
|
),
|
|
250
|
-
|
|
251
|
-
const
|
|
256
|
+
m && r.status.options.map((l) => {
|
|
257
|
+
const u = !e.mixedStatus && String(e.uniformStatus) === l.value, n = G[l.color] ?? G.slate, _ = w === e.key;
|
|
252
258
|
return /* @__PURE__ */ s(
|
|
253
259
|
"button",
|
|
254
260
|
{
|
|
255
261
|
type: "button",
|
|
256
|
-
disabled: _ ||
|
|
262
|
+
disabled: _ || u,
|
|
257
263
|
onClick: () => J(e, l),
|
|
258
264
|
className: "rounded-md border px-2.5 py-1 text-[11px] font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50",
|
|
259
265
|
style: {
|
|
260
|
-
backgroundColor:
|
|
261
|
-
borderColor: `${
|
|
262
|
-
color:
|
|
266
|
+
backgroundColor: u ? `${n}22` : "transparent",
|
|
267
|
+
borderColor: `${n}55`,
|
|
268
|
+
color: n
|
|
263
269
|
},
|
|
264
270
|
children: _ ? "…" : l.label
|
|
265
271
|
},
|
|
@@ -268,38 +274,38 @@ function we({
|
|
|
268
274
|
})
|
|
269
275
|
] })
|
|
270
276
|
] }),
|
|
271
|
-
|
|
277
|
+
M[e.key] && /* @__PURE__ */ b("p", { className: "flex items-center gap-1 px-3 pb-2 text-[11px] text-red-600", children: [
|
|
272
278
|
/* @__PURE__ */ s(te, { className: "h-3 w-3 shrink-0" }),
|
|
273
|
-
|
|
279
|
+
M[e.key]
|
|
274
280
|
] }),
|
|
275
|
-
|
|
276
|
-
/* @__PURE__ */ s("thead", { children: /* @__PURE__ */
|
|
281
|
+
a && /* @__PURE__ */ s("div", { className: "overflow-x-auto border-t border-slate-100 dark:border-border/50", children: /* @__PURE__ */ b("table", { className: "w-full border-collapse text-[12px]", children: [
|
|
282
|
+
/* @__PURE__ */ s("thead", { children: /* @__PURE__ */ b("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: [
|
|
277
283
|
z.map((l) => /* @__PURE__ */ s("th", { className: "px-2.5 py-1.5 font-medium", children: l.label }, l.field)),
|
|
278
284
|
U && /* @__PURE__ */ s("th", { className: "px-2.5 py-1.5 font-medium", children: "Match" })
|
|
279
285
|
] }) }),
|
|
280
286
|
/* @__PURE__ */ s("tbody", { children: e.rows.map((l) => {
|
|
281
|
-
var
|
|
282
|
-
return /* @__PURE__ */
|
|
287
|
+
var u;
|
|
288
|
+
return /* @__PURE__ */ b(
|
|
283
289
|
"tr",
|
|
284
290
|
{
|
|
285
291
|
className: "border-b border-slate-100 last:border-b-0 dark:border-border/50",
|
|
286
292
|
children: [
|
|
287
|
-
z.map((
|
|
293
|
+
z.map((n) => /* @__PURE__ */ s(
|
|
288
294
|
"td",
|
|
289
295
|
{
|
|
290
296
|
className: "px-2.5 py-1.5 text-slate-600 dark:text-slate-300",
|
|
291
|
-
children:
|
|
297
|
+
children: n.format === "flag" ? W(l.values[n.field]) ? /* @__PURE__ */ s(E, { label: n.label, color: n.color ?? "amber" }) : "—" : O(l.values[n.field], n.format)
|
|
292
298
|
},
|
|
293
|
-
|
|
299
|
+
n.field
|
|
294
300
|
)),
|
|
295
|
-
U && /* @__PURE__ */ s("td", { className: "px-2.5 py-1.5", children: /* @__PURE__ */ s("span", { className: "flex flex-wrap gap-1", children: (((
|
|
301
|
+
U && /* @__PURE__ */ s("td", { className: "px-2.5 py-1.5", children: /* @__PURE__ */ s("span", { className: "flex flex-wrap gap-1", children: (((u = q(l.id)) == null ? void 0 : u.chips) ?? []).map((n) => /* @__PURE__ */ s(
|
|
296
302
|
"span",
|
|
297
303
|
{
|
|
298
|
-
title:
|
|
299
|
-
className:
|
|
300
|
-
children:
|
|
304
|
+
title: n.title,
|
|
305
|
+
className: n.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" : n.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" : n.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",
|
|
306
|
+
children: n.label
|
|
301
307
|
},
|
|
302
|
-
|
|
308
|
+
n.label
|
|
303
309
|
)) }) })
|
|
304
310
|
]
|
|
305
311
|
},
|
|
@@ -317,13 +323,13 @@ function we({
|
|
|
317
323
|
{
|
|
318
324
|
className: "fixed inset-0 z-[130] flex items-center justify-center bg-black/40 p-4",
|
|
319
325
|
onClick: () => D(null),
|
|
320
|
-
children: /* @__PURE__ */
|
|
326
|
+
children: /* @__PURE__ */ b(
|
|
321
327
|
"div",
|
|
322
328
|
{
|
|
323
329
|
className: "w-full max-w-md rounded-lg border border-slate-200 bg-white p-4 shadow-xl dark:border-border dark:bg-card",
|
|
324
330
|
onClick: (e) => e.stopPropagation(),
|
|
325
331
|
children: [
|
|
326
|
-
/* @__PURE__ */
|
|
332
|
+
/* @__PURE__ */ b("p", { className: "text-[13px] font-medium text-slate-700 dark:text-slate-200", children: [
|
|
327
333
|
A.option.label,
|
|
328
334
|
" — add a note"
|
|
329
335
|
] }),
|
|
@@ -332,14 +338,14 @@ function we({
|
|
|
332
338
|
"textarea",
|
|
333
339
|
{
|
|
334
340
|
value: F,
|
|
335
|
-
onChange: (e) =>
|
|
341
|
+
onChange: (e) => P(e.target.value),
|
|
336
342
|
rows: 3,
|
|
337
343
|
autoFocus: !0,
|
|
338
344
|
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",
|
|
339
345
|
placeholder: "Why is this being rejected?"
|
|
340
346
|
}
|
|
341
347
|
),
|
|
342
|
-
/* @__PURE__ */
|
|
348
|
+
/* @__PURE__ */ b("div", { className: "mt-3 flex items-center justify-end gap-1.5", children: [
|
|
343
349
|
/* @__PURE__ */ s(
|
|
344
350
|
"button",
|
|
345
351
|
{
|
|
@@ -372,6 +378,6 @@ function we({
|
|
|
372
378
|
}
|
|
373
379
|
export {
|
|
374
380
|
we as ReviewListWidget,
|
|
375
|
-
|
|
381
|
+
G as STATUS_COLOR_HEX,
|
|
376
382
|
O as formatValue
|
|
377
383
|
};
|
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
import { toneForOutcome as d } from "./obligation-filters.js";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { plainObligationReason as f } from "./obligation-reason-text.js";
|
|
3
|
+
import { formatDate as $, getDisplayTimezone as p } from "./utils.js";
|
|
4
|
+
const g = (o) => {
|
|
5
|
+
const t = p();
|
|
5
6
|
return new Intl.DateTimeFormat("en-US", {
|
|
6
7
|
hour: "numeric",
|
|
7
8
|
minute: "2-digit",
|
|
8
9
|
...t ? { timeZone: t } : {}
|
|
9
10
|
}).format(new Date(o));
|
|
10
11
|
};
|
|
11
|
-
function
|
|
12
|
+
function h(o, t) {
|
|
12
13
|
const l = t.getTime() - new Date(o).getTime(), e = Math.floor(l / 6e4);
|
|
13
14
|
if (e < 1) return "just now";
|
|
14
15
|
if (e < 60) return `${e}m ago`;
|
|
15
16
|
const n = Math.floor(e / 60);
|
|
16
17
|
if (n < 24) return `${n}h ago`;
|
|
17
18
|
const i = Math.floor(n / 24);
|
|
18
|
-
return i < 7 ? `${i}d ago` :
|
|
19
|
+
return i < 7 ? `${i}d ago` : $(o);
|
|
19
20
|
}
|
|
20
|
-
function
|
|
21
|
+
function w(o) {
|
|
21
22
|
return o.split(/[._-]+/).filter(Boolean).map((t) => t[0].toUpperCase() + t.slice(1)).join(" ");
|
|
22
23
|
}
|
|
23
|
-
function
|
|
24
|
+
function T(o, t = /* @__PURE__ */ new Date()) {
|
|
24
25
|
const l = /* @__PURE__ */ new Map();
|
|
25
26
|
for (const e of o) {
|
|
26
27
|
if (e.outcome === "superseded") continue;
|
|
@@ -28,14 +29,14 @@ function b(o, t = /* @__PURE__ */ new Date()) {
|
|
|
28
29
|
(!n || e.id > n.id) && l.set(e.api, e);
|
|
29
30
|
}
|
|
30
31
|
return [...l.values()].map((e) => {
|
|
31
|
-
var
|
|
32
|
-
const n = e.resolved_at ?? e.due_at, i = `${
|
|
32
|
+
var r;
|
|
33
|
+
const n = e.resolved_at ?? e.due_at, i = `${h(n, t)} (${g(n)})`, m = e.reason ? ` — ${f(e.reason)}` : "", u = ((r = e.label) == null ? void 0 : r.trim()) || (e.trigger === "transition" ? w(e.kind) : ""), a = u ? ` · ${u}` : "";
|
|
33
34
|
let s;
|
|
34
35
|
if (e.outcome === "sent") s = `told ${i}${a}`;
|
|
35
36
|
else if (e.outcome === "pending") {
|
|
36
|
-
const
|
|
37
|
-
s = `sent ${i}${a}, awaiting acknowledgement (${
|
|
38
|
-
} else e.outcome === "skipped" ? s = `should have been told ${i}${a}${
|
|
37
|
+
const c = Math.round((t.getTime() - new Date(e.due_at).getTime()) / 6e4);
|
|
38
|
+
s = `sent ${i}${a}, awaiting acknowledgement (${c} min)`;
|
|
39
|
+
} else e.outcome === "skipped" ? s = `should have been told ${i}${a}${m}` : e.outcome === "failed" ? s = `send failed ${i}${a}${m}` : e.outcome === "missing" ? s = `never told${a}${m}` : s = `still not told${a}${m}`;
|
|
39
40
|
return {
|
|
40
41
|
api: e.api,
|
|
41
42
|
tone: d(e.outcome),
|
|
@@ -49,5 +50,5 @@ function b(o, t = /* @__PURE__ */ new Date()) {
|
|
|
49
50
|
});
|
|
50
51
|
}
|
|
51
52
|
export {
|
|
52
|
-
|
|
53
|
+
T as bannerLines
|
|
53
54
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const o = /* @__PURE__ */ new Set(["id", "po", "req", "url", "sku", "uom", "erp", "api", "ids"]);
|
|
2
|
+
function i(n) {
|
|
3
|
+
const t = n.trim().replace(/([a-z0-9])([A-Z])/g, "$1 $2").split(/[_\s.-]+/).filter(Boolean).map((e) => e.toLowerCase());
|
|
4
|
+
return t.length === 0 ? n : t.map((e, r) => o.has(e) ? e === "ids" ? "IDs" : e.toUpperCase() : r === 0 ? e.charAt(0).toUpperCase() + e.slice(1) : e).join(" ");
|
|
5
|
+
}
|
|
6
|
+
function s(n) {
|
|
7
|
+
const t = String(n ?? "").trim();
|
|
8
|
+
let e = /^skip_when_empty: (.+) empty$/.exec(t);
|
|
9
|
+
return e ? `this record has no ${i(e[1])} yet` : (e = /^skip_unless_any: none of (.+) is set$/.exec(t), e ? `this record has none of ${e[1].split(/,\s*/).filter(Boolean).map(i).join(", ")} yet` : (e = /^guard unmet: (.+)$/.exec(t), e ? `its send condition was not met (${e[1]})` : (e = /^not configured: (.+) missing on the action$/.exec(t), e ? `the send is not set up yet (${e[1]} is missing)` : (e = /^payload template error: (.+)$/.exec(t), e ? `the message could not be built (${e[1]})` : (e = /^flow condition rejected at "(.+)"$/.exec(t), e ? `a flow step ("${e[1]}") stopped it` : t)))));
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
s as plainObligationReason
|
|
13
|
+
};
|
|
@@ -1,18 +1,41 @@
|
|
|
1
|
-
function
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
function f(n, l) {
|
|
2
|
+
return n.getAll(l).flatMap((e) => e.split(",")).map((e) => e.trim()).filter(Boolean);
|
|
3
|
+
}
|
|
4
|
+
function p(n, l) {
|
|
5
|
+
const e = new URLSearchParams(l), t = /* @__PURE__ */ new Set();
|
|
6
|
+
for (const r of n ?? [])
|
|
7
|
+
r.url_param && e.has(r.url_param) && f(e, r.url_param).length === 0 && t.add(r.param);
|
|
8
|
+
return t;
|
|
9
|
+
}
|
|
10
|
+
function _(n, l, e) {
|
|
11
|
+
const t = new URLSearchParams(e);
|
|
12
|
+
for (const o of n ?? []) {
|
|
13
|
+
if (!o.url_param) continue;
|
|
14
|
+
const u = o.value_field ?? "id", a = (l[o.param] ?? []).map((i) => String(i[u] ?? "")).filter(Boolean);
|
|
15
|
+
t.set(o.url_param, a.join(","));
|
|
16
|
+
}
|
|
17
|
+
const r = t.toString();
|
|
18
|
+
return r ? `?${r}` : "";
|
|
19
|
+
}
|
|
20
|
+
function d(n, l, e = /* @__PURE__ */ new Date()) {
|
|
21
|
+
var u;
|
|
22
|
+
const t = {}, r = new URLSearchParams(l), o = p(n, l);
|
|
23
|
+
for (const a of n ?? []) {
|
|
24
|
+
const i = a.value_field ?? "id", s = a.url_param ? f(r, a.url_param) : [];
|
|
25
|
+
if (s.length) {
|
|
26
|
+
t[a.param] = (a.single ? s.slice(0, 1) : s).map((c) => ({ [i]: c }));
|
|
8
27
|
continue;
|
|
9
28
|
}
|
|
10
|
-
(
|
|
11
|
-
|
|
12
|
-
|
|
29
|
+
if (o.has(a.param) || !((u = a.default_values) != null && u.length)) continue;
|
|
30
|
+
const m = a.single ? a.default_values.slice(0, 1) : a.default_values;
|
|
31
|
+
t[a.param] = m.map((c) => ({
|
|
32
|
+
[i]: c === "$current_year" ? e.getFullYear() : c
|
|
33
|
+
}));
|
|
13
34
|
}
|
|
14
35
|
return t;
|
|
15
36
|
}
|
|
16
37
|
export {
|
|
17
|
-
|
|
38
|
+
p as explicitAllUrlParams,
|
|
39
|
+
_ as filterSelectionToSearch,
|
|
40
|
+
d as initialFilterSelection
|
|
18
41
|
};
|
|
@@ -38,7 +38,7 @@ const l = /* @__PURE__ */ new Set([
|
|
|
38
38
|
"th",
|
|
39
39
|
"td",
|
|
40
40
|
"caption"
|
|
41
|
-
]),
|
|
41
|
+
]), c = /* @__PURE__ */ new Set([
|
|
42
42
|
"script",
|
|
43
43
|
"style",
|
|
44
44
|
"iframe",
|
|
@@ -52,37 +52,46 @@ const l = /* @__PURE__ */ new Set([
|
|
|
52
52
|
"template",
|
|
53
53
|
"base",
|
|
54
54
|
"noscript"
|
|
55
|
-
]),
|
|
55
|
+
]), f = /* @__PURE__ */ new Set(["href", "title", "colspan", "rowspan", "start", "type"]), p = /^(https?:|mailto:|tel:)/i, u = (n) => {
|
|
56
56
|
let e = "";
|
|
57
|
-
for (const
|
|
58
|
-
return e = e.toLowerCase(), !e ||
|
|
57
|
+
for (const r of n) r.charCodeAt(0) > 32 && (e += r);
|
|
58
|
+
return e = e.toLowerCase(), !e || p.test(e) ? !0 : !/^[a-z][a-z0-9+.-]*:/.test(e);
|
|
59
59
|
};
|
|
60
|
+
function h(n) {
|
|
61
|
+
if (typeof DOMParser < "u") {
|
|
62
|
+
const e = new DOMParser().parseFromString(n, "text/html");
|
|
63
|
+
for (const r of e.body.querySelectorAll("script,style,template,noscript")) r.remove();
|
|
64
|
+
return (e.body.textContent || "").replace(/\s+/g, " ");
|
|
65
|
+
}
|
|
66
|
+
return n.replace(/<(script|style|template|noscript)\b[\s\S]*?<\/\1>/gi, " ").replace(/<[^>]+>/g, " ").replace(/ /g, " ").replace(/\s+/g, " ");
|
|
67
|
+
}
|
|
60
68
|
function m(n) {
|
|
61
69
|
if (typeof DOMParser > "u") return "";
|
|
62
|
-
const e = new DOMParser().parseFromString(n, "text/html"),
|
|
70
|
+
const e = new DOMParser().parseFromString(n, "text/html"), r = (i) => {
|
|
63
71
|
for (const t of [...i.children]) {
|
|
64
72
|
const s = t.tagName.toLowerCase();
|
|
65
73
|
if (!l.has(s)) {
|
|
66
|
-
if (
|
|
74
|
+
if (c.has(s)) {
|
|
67
75
|
t.remove();
|
|
68
76
|
continue;
|
|
69
77
|
}
|
|
70
|
-
const
|
|
71
|
-
if (
|
|
72
|
-
for (; t.firstChild; )
|
|
73
|
-
|
|
78
|
+
const o = t.parentNode;
|
|
79
|
+
if (o) {
|
|
80
|
+
for (; t.firstChild; ) o.insertBefore(t.firstChild, t);
|
|
81
|
+
o.removeChild(t);
|
|
74
82
|
}
|
|
75
83
|
continue;
|
|
76
84
|
}
|
|
77
|
-
for (const
|
|
78
|
-
const a =
|
|
79
|
-
(!
|
|
85
|
+
for (const o of [...t.attributes]) {
|
|
86
|
+
const a = o.name.toLowerCase();
|
|
87
|
+
(!f.has(a) || a === "href" && !u(o.value)) && t.removeAttribute(o.name);
|
|
80
88
|
}
|
|
81
|
-
s === "a" && (t.setAttribute("rel", "noopener noreferrer"), t.setAttribute("target", "_blank")),
|
|
89
|
+
s === "a" && (t.setAttribute("rel", "noopener noreferrer"), t.setAttribute("target", "_blank")), r(t);
|
|
82
90
|
}
|
|
83
91
|
};
|
|
84
|
-
return
|
|
92
|
+
return r(e.body), e.body.innerHTML;
|
|
85
93
|
}
|
|
86
94
|
export {
|
|
95
|
+
h as htmlToText,
|
|
87
96
|
m as sanitizeHtml
|
|
88
97
|
};
|