@nivaro/react 0.3.51 → 0.3.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +47 -3
- package/dist/shared/components/ItemEditForm.js +3885 -3847
- package/dist/shared/components/NotificationBell.js +163 -150
- package/dist/shared/components/PageRenderer.js +600 -549
- package/dist/shared/components/ProfileView.js +36 -34
- package/dist/shared/components/QueryStatStrip.js +96 -89
- package/dist/shared/components/QueryTable.js +214 -215
- package/dist/shared/components/ReportView.js +548 -529
- package/dist/shared/components/alerts/AlertManagerView.js +346 -320
- package/dist/shared/components/item-edit/CatalogPickerField.js +1300 -1219
- package/dist/shared/components/item-edit/FieldAffordances.js +145 -136
- package/dist/shared/components/item-edit/FieldRenderer.js +366 -326
- package/dist/shared/components/item-edit/InlineTableField.js +3047 -2932
- package/dist/shared/components/item-edit/NestedRelationEditor.js +149 -143
- package/dist/shared/components/item-edit/PlanGrid.js +718 -705
- package/dist/shared/components/item-edit/SummaryPanel.js +351 -337
- package/dist/shared/components/item-edit/line-qty.js +115 -53
- package/dist/shared/components/item-edit/save-refusal.js +18 -18
- package/dist/shared/components/item-edit/usePersonalDefaults.js +210 -207
- package/dist/shared/components/panels/CommentPanel.js +204 -197
- package/dist/shared/components/panels/ItemLockBanner.js +318 -291
- package/dist/shared/components/panels/PipelinePanel.js +1388 -1218
- package/dist/shared/components/panels/RecordIntegrityBanner.js +201 -172
- package/dist/shared/components/panels/RevisionsPanel.js +101 -106
- package/dist/shared/components/panels/TransitionRequirementsDialog.js +564 -534
- package/dist/shared/components/panels/requirement-side-effects.js +46 -29
- package/dist/shared/components/queue/QueueItemSheet.js +219 -146
- package/dist/shared/components/queue/QueueWorklist.js +738 -730
- package/dist/shared/components/widgets/ReviewListWidget.js +236 -201
- package/dist/shared/lib/activity-sentence.js +236 -227
- package/dist/shared/lib/record-ref.js +43 -34
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { evaluateNumeric as
|
|
2
|
-
import { applyValidationRule as
|
|
1
|
+
import { evaluateNumeric as d } from "../../lib/expression.js";
|
|
2
|
+
import { applyValidationRule as b } from "../../lib/validation-rules.js";
|
|
3
3
|
const f = {
|
|
4
4
|
tinyint: 255,
|
|
5
5
|
smallint: 32767,
|
|
@@ -7,7 +7,7 @@ const f = {
|
|
|
7
7
|
int: 2147483647,
|
|
8
8
|
bigInteger: Number.MAX_SAFE_INTEGER,
|
|
9
9
|
bigint: Number.MAX_SAFE_INTEGER
|
|
10
|
-
},
|
|
10
|
+
}, c = /* @__PURE__ */ new Set([
|
|
11
11
|
...Object.keys(f),
|
|
12
12
|
"decimal",
|
|
13
13
|
"float",
|
|
@@ -18,75 +18,137 @@ const f = {
|
|
|
18
18
|
"smallmoney",
|
|
19
19
|
"number"
|
|
20
20
|
]);
|
|
21
|
-
function
|
|
22
|
-
return
|
|
21
|
+
function m(t) {
|
|
22
|
+
return t != null && Object.hasOwn(f, t);
|
|
23
23
|
}
|
|
24
|
-
function
|
|
25
|
-
const
|
|
26
|
-
if (
|
|
24
|
+
function v(t, e = {}) {
|
|
25
|
+
const r = e.label ?? "Value";
|
|
26
|
+
if (t == null || typeof t == "string" && t.trim() === "")
|
|
27
27
|
return { ok: !0, value: null };
|
|
28
|
-
const
|
|
29
|
-
if (Number.isNaN(
|
|
30
|
-
const
|
|
31
|
-
return !Number.isFinite(
|
|
28
|
+
const i = typeof t == "number" ? t : Number(t);
|
|
29
|
+
if (Number.isNaN(i)) return { ok: !1, message: `${r} must be a number` };
|
|
30
|
+
const u = m(e.type) ? f[e.type] : Number.MAX_SAFE_INTEGER;
|
|
31
|
+
return !Number.isFinite(i) || Math.abs(i) > u ? { ok: !1, message: `${r} can't be more than ${u.toLocaleString("en-US")}` } : m(e.type) && !Number.isInteger(i) ? { ok: !1, message: `${r} must be a whole number` } : e.min !== void 0 && i < e.min ? {
|
|
32
32
|
ok: !1,
|
|
33
|
-
message: e.min === 0 ? `${
|
|
34
|
-
} : { ok: !0, value:
|
|
33
|
+
message: e.min === 0 ? `${r} can't be negative` : `${r} can't be below ${e.min}`
|
|
34
|
+
} : { ok: !0, value: i };
|
|
35
35
|
}
|
|
36
|
-
function
|
|
37
|
-
const
|
|
38
|
-
for (const
|
|
39
|
-
n
|
|
40
|
-
for (const [
|
|
41
|
-
const o =
|
|
42
|
-
o !== null && (
|
|
36
|
+
function E(t, e, r, i = {}) {
|
|
37
|
+
const u = { ...t, ...e };
|
|
38
|
+
for (const n of r)
|
|
39
|
+
t[n] != null && t[n] !== "" && (u[n] = t[n]);
|
|
40
|
+
for (const [n, l] of Object.entries(i)) {
|
|
41
|
+
const o = d(l, u);
|
|
42
|
+
o !== null && (u[n] = o);
|
|
43
43
|
}
|
|
44
|
-
return
|
|
44
|
+
return u;
|
|
45
45
|
}
|
|
46
|
-
function
|
|
47
|
-
const
|
|
48
|
-
for (const [
|
|
49
|
-
|
|
50
|
-
return
|
|
46
|
+
function $(t, e, r) {
|
|
47
|
+
const i = {};
|
|
48
|
+
for (const [u, n] of Object.entries(t))
|
|
49
|
+
r.has(u) && (e && u !== "_change_reason" && String(n ?? "") === String(e[u] ?? "") || (i[u] = n));
|
|
50
|
+
return i;
|
|
51
51
|
}
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
const g = 999999999999e-2;
|
|
53
|
+
function S(t, e, r, i) {
|
|
54
|
+
const u = [];
|
|
55
|
+
for (const n of t) {
|
|
56
|
+
if (n.computed_type !== "write" || !n.computed_formula || n.type && !c.has(n.type)) continue;
|
|
57
|
+
const l = e[n.field];
|
|
58
|
+
if (l == null || l === "") continue;
|
|
59
|
+
const o = Number(l);
|
|
60
|
+
if (!Number.isFinite(o) || r && String(r[n.field] ?? "") === String(l)) continue;
|
|
61
|
+
const s = n.label || n.field, a = N(
|
|
62
|
+
[{ field: n.field, label: s, type: n.type ?? "decimal", validation_rules: n.validation_rules }],
|
|
63
|
+
{ [n.field]: o },
|
|
64
|
+
{ ...e, [n.field]: o }
|
|
65
|
+
)[0];
|
|
66
|
+
if (a) {
|
|
67
|
+
u.push({ field: n.field, message: `${i}: ${a.message}` });
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
Math.abs(o) > g && u.push({
|
|
71
|
+
field: n.field,
|
|
72
|
+
message: `${i}: ${s} must be smaller than $10,000,000,000`
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
return u;
|
|
76
|
+
}
|
|
77
|
+
function k(t, e) {
|
|
78
|
+
const r = t.find(
|
|
79
|
+
(u) => /^(qty|quantity)$/i.test(u.field) && c.has(u.type ?? "")
|
|
80
|
+
);
|
|
81
|
+
if (!r) return null;
|
|
82
|
+
const i = e[r.field];
|
|
83
|
+
return i == null || typeof i == "string" && i.trim() === "" ? null : Number(i) === 0 ? r.label || r.field : null;
|
|
84
|
+
}
|
|
85
|
+
function R(t, e, r = 2) {
|
|
86
|
+
if (t == null) return null;
|
|
87
|
+
const i = String(t).trim();
|
|
88
|
+
if (i === "" || Number.isNaN(Number(i))) return null;
|
|
89
|
+
const u = /e/i.test(i) ? Number(i).toFixed(20).replace(/0+$/, "") : i;
|
|
90
|
+
return (u.includes(".") ? u.split(".")[1].replace(/0+$/, "") : "").length <= r ? null : `${e} takes ${r} decimal${r === 1 ? "" : "s"}`;
|
|
91
|
+
}
|
|
92
|
+
function F(t, e, r) {
|
|
93
|
+
if (!t) return { rest: {}, reverted: [] };
|
|
94
|
+
if (!r) return { rest: { ...t }, reverted: [] };
|
|
95
|
+
const i = {}, u = [];
|
|
96
|
+
for (const [n, l] of Object.entries(t)) {
|
|
97
|
+
if (!(n === "_change_reason" || n.startsWith("__")) && n in e && String(e[n] ?? "") === String(r[n] ?? "")) {
|
|
98
|
+
u.push(n);
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
i[n] = l;
|
|
102
|
+
}
|
|
103
|
+
return { rest: i, reverted: u };
|
|
104
|
+
}
|
|
105
|
+
function I(t) {
|
|
106
|
+
return Object.keys(t).some((e) => e !== "_change_reason" && e !== "__flush_early");
|
|
107
|
+
}
|
|
108
|
+
function y(t) {
|
|
109
|
+
let e = t;
|
|
54
110
|
if (typeof e == "string")
|
|
55
111
|
try {
|
|
56
112
|
e = JSON.parse(e);
|
|
57
113
|
} catch {
|
|
58
114
|
return [];
|
|
59
115
|
}
|
|
60
|
-
return Array.isArray(e) ? e.filter((
|
|
116
|
+
return Array.isArray(e) ? e.filter((r) => r && typeof r.type == "string") : [];
|
|
61
117
|
}
|
|
62
|
-
function
|
|
63
|
-
const
|
|
64
|
-
for (const
|
|
65
|
-
for (const
|
|
66
|
-
if (
|
|
67
|
-
const l =
|
|
68
|
-
if (!(
|
|
69
|
-
const o =
|
|
118
|
+
function N(t, e, r) {
|
|
119
|
+
const i = [];
|
|
120
|
+
for (const u of t)
|
|
121
|
+
for (const n of y(u.validation_rules)) {
|
|
122
|
+
if (n.soft) continue;
|
|
123
|
+
const l = n.type === "gte_field" || n.type === "lte_field";
|
|
124
|
+
if (!(u.field in e) && !(l && n.field && n.field in e)) continue;
|
|
125
|
+
const o = _(u.type, r[u.field]), s = b(n, o, u.label || u.field, r);
|
|
70
126
|
if (s) {
|
|
71
|
-
|
|
127
|
+
i.push({ field: u.field, message: s });
|
|
72
128
|
break;
|
|
73
129
|
}
|
|
74
130
|
}
|
|
75
|
-
return
|
|
131
|
+
return i;
|
|
76
132
|
}
|
|
77
|
-
function
|
|
78
|
-
if (typeof e != "string" || !
|
|
79
|
-
const
|
|
80
|
-
if (
|
|
81
|
-
const
|
|
82
|
-
return Number.isNaN(
|
|
133
|
+
function _(t, e) {
|
|
134
|
+
if (typeof e != "string" || !c.has(t ?? "")) return e;
|
|
135
|
+
const r = e.trim();
|
|
136
|
+
if (r === "") return e;
|
|
137
|
+
const i = Number(r);
|
|
138
|
+
return Number.isNaN(i) ? e : i;
|
|
83
139
|
}
|
|
84
140
|
export {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
141
|
+
g as MAX_LINE_MONEY,
|
|
142
|
+
c as NUMBER_FIELD_TYPES,
|
|
143
|
+
$ as changedRowFields,
|
|
144
|
+
v as checkNumberEntry,
|
|
145
|
+
S as computedColumnErrors,
|
|
146
|
+
R as decimalPlacesProblem,
|
|
147
|
+
F as dropRevertedFields,
|
|
148
|
+
m as isIntegerFieldType,
|
|
149
|
+
I as isRealLineEdit,
|
|
150
|
+
N as lineRuleErrors,
|
|
151
|
+
E as mergePendingQtyRow,
|
|
152
|
+
_ as ruleValueFor,
|
|
153
|
+
k as zeroQtyColumn
|
|
92
154
|
};
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
function
|
|
2
|
-
const
|
|
3
|
-
if (!
|
|
4
|
-
const
|
|
5
|
-
return
|
|
1
|
+
function y(r) {
|
|
2
|
+
const e = r == null ? void 0 : r.response;
|
|
3
|
+
if (!e || typeof e != "object") return null;
|
|
4
|
+
const t = e.data;
|
|
5
|
+
return t && typeof t == "object" && !Array.isArray(t) ? t : e;
|
|
6
6
|
}
|
|
7
|
-
const
|
|
8
|
-
function
|
|
9
|
-
const
|
|
10
|
-
if (!
|
|
11
|
-
const
|
|
12
|
-
if (
|
|
13
|
-
const
|
|
14
|
-
return { field:
|
|
7
|
+
const f = /^([A-Za-z0-9_]+)\[([^\]]*)\]:\s*/, g = /^(Bad Request|Unprocessable Entity|Conflict|Forbidden|Not Found|Error)$/, l = /\s+—\s+nothing was changed.*$/s;
|
|
8
|
+
function p(r, e) {
|
|
9
|
+
const t = y(r);
|
|
10
|
+
if (!t) return null;
|
|
11
|
+
const c = [t.message, t.error].filter((n) => typeof n == "string"), i = c.find((n) => f.test(n)) ?? c.find((n) => !g.test(n)) ?? "", s = f.exec(i);
|
|
12
|
+
if (s && e.has(s[1])) {
|
|
13
|
+
const n = i.slice(s[0].length).replace(l, "").trim(), u = /^\d{1,4}$/.test(s[2]) ? `Line ${Number(s[2]) + 1}: ` : "";
|
|
14
|
+
return { field: s[1], message: `${u}${n || "A line was refused"}` };
|
|
15
15
|
}
|
|
16
|
-
const
|
|
17
|
-
if (typeof
|
|
18
|
-
const
|
|
19
|
-
return { field:
|
|
16
|
+
const o = Array.isArray(t.violations) ? t.violations[0] : void 0, a = typeof t.field == "string" ? t.field : o == null ? void 0 : o.field;
|
|
17
|
+
if (typeof a != "string" || !e.has(a)) return null;
|
|
18
|
+
const d = String((o == null ? void 0 : o.message) ?? (i.replace(l, "").trim() || "Invalid"));
|
|
19
|
+
return { field: a, message: d };
|
|
20
20
|
}
|
|
21
21
|
export {
|
|
22
|
-
|
|
22
|
+
p as refusedFieldOf
|
|
23
23
|
};
|