@nivaro/react 0.3.52 → 0.3.54

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.
Files changed (41) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +47 -3
  4. package/dist/shared/components/ItemEditForm.js +4196 -4163
  5. package/dist/shared/components/NotificationBell.js +163 -150
  6. package/dist/shared/components/PageRenderer.js +645 -593
  7. package/dist/shared/components/ProfileView.js +36 -34
  8. package/dist/shared/components/QueryStatStrip.js +96 -89
  9. package/dist/shared/components/QueryTable.js +214 -215
  10. package/dist/shared/components/ReportView.js +548 -529
  11. package/dist/shared/components/alerts/AlertManagerView.js +346 -320
  12. package/dist/shared/components/item-edit/CatalogPickerField.js +1300 -1219
  13. package/dist/shared/components/item-edit/DraftRecoveryBanner.js +52 -54
  14. package/dist/shared/components/item-edit/FieldAffordances.js +145 -136
  15. package/dist/shared/components/item-edit/FieldRenderer.js +366 -326
  16. package/dist/shared/components/item-edit/InlineTableField.js +3047 -2932
  17. package/dist/shared/components/item-edit/NestedRelationEditor.js +149 -143
  18. package/dist/shared/components/item-edit/PersonalDefaultControl.js +12 -11
  19. package/dist/shared/components/item-edit/PlanGrid.js +718 -705
  20. package/dist/shared/components/item-edit/RelationCombobox.js +23 -20
  21. package/dist/shared/components/item-edit/SummaryPanel.js +415 -361
  22. package/dist/shared/components/item-edit/line-qty.js +115 -53
  23. package/dist/shared/components/item-edit/save-outcome.js +48 -0
  24. package/dist/shared/components/item-edit/save-refusal.js +18 -18
  25. package/dist/shared/components/item-edit/stale-banner.js +13 -0
  26. package/dist/shared/components/item-edit/usePersonalDefaults.js +225 -220
  27. package/dist/shared/components/panels/CommentPanel.js +204 -197
  28. package/dist/shared/components/panels/ItemLockBanner.js +318 -291
  29. package/dist/shared/components/panels/PipelinePanel.js +1388 -1218
  30. package/dist/shared/components/panels/RecordIntegrityBanner.js +201 -172
  31. package/dist/shared/components/panels/RevisionsPanel.js +101 -106
  32. package/dist/shared/components/panels/TransitionRequirementsDialog.js +564 -534
  33. package/dist/shared/components/panels/requirement-side-effects.js +46 -29
  34. package/dist/shared/components/queue/QueueItemSheet.js +219 -146
  35. package/dist/shared/components/queue/QueueWorklist.js +738 -730
  36. package/dist/shared/components/widgets/ReviewListWidget.js +236 -201
  37. package/dist/shared/lib/activity-sentence.js +236 -227
  38. package/dist/shared/lib/draft-store.js +35 -29
  39. package/dist/shared/lib/page-widget-access.js +11 -0
  40. package/dist/shared/lib/record-ref.js +43 -34
  41. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
- import { evaluateNumeric as a } from "../../lib/expression.js";
2
- import { applyValidationRule as m } from "../../lib/validation-rules.js";
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
- }, b = /* @__PURE__ */ new Set([
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 c(n) {
22
- return n != null && Object.hasOwn(f, n);
21
+ function m(t) {
22
+ return t != null && Object.hasOwn(f, t);
23
23
  }
24
- function E(n, e = {}) {
25
- const i = e.label ?? "Value";
26
- if (n == null || typeof n == "string" && n.trim() === "")
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 r = typeof n == "number" ? n : Number(n);
29
- if (Number.isNaN(r)) return { ok: !1, message: `${i} must be a number` };
30
- const t = c(e.type) ? f[e.type] : Number.MAX_SAFE_INTEGER;
31
- return !Number.isFinite(r) || Math.abs(r) > t ? { ok: !1, message: `${i} can't be more than ${t.toLocaleString("en-US")}` } : c(e.type) && !Number.isInteger(r) ? { ok: !1, message: `${i} must be a whole number` } : e.min !== void 0 && r < e.min ? {
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 ? `${i} can't be negative` : `${i} can't be below ${e.min}`
34
- } : { ok: !0, value: r };
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 _(n, e, i, r = {}) {
37
- const t = { ...n, ...e };
38
- for (const u of i)
39
- n[u] != null && n[u] !== "" && (t[u] = n[u]);
40
- for (const [u, l] of Object.entries(r)) {
41
- const o = a(l, t);
42
- o !== null && (t[u] = o);
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 t;
44
+ return u;
45
45
  }
46
- function p(n, e, i) {
47
- const r = {};
48
- for (const [t, u] of Object.entries(n))
49
- i.has(t) && (e && t !== "_change_reason" && String(u ?? "") === String(e[t] ?? "") || (r[t] = u));
50
- return r;
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
- function g(n) {
53
- let e = n;
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((i) => i && typeof i.type == "string") : [];
116
+ return Array.isArray(e) ? e.filter((r) => r && typeof r.type == "string") : [];
61
117
  }
62
- function h(n, e, i) {
63
- const r = [];
64
- for (const t of n)
65
- for (const u of g(t.validation_rules)) {
66
- if (u.soft) continue;
67
- const l = u.type === "gte_field" || u.type === "lte_field";
68
- if (!(t.field in e) && !(l && u.field && u.field in e)) continue;
69
- const o = y(t.type, i[t.field]), s = m(u, o, t.label || t.field, i);
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
- r.push({ field: t.field, message: s });
127
+ i.push({ field: u.field, message: s });
72
128
  break;
73
129
  }
74
130
  }
75
- return r;
131
+ return i;
76
132
  }
77
- function y(n, e) {
78
- if (typeof e != "string" || !b.has(n ?? "")) return e;
79
- const i = e.trim();
80
- if (i === "") return e;
81
- const r = Number(i);
82
- return Number.isNaN(r) ? e : r;
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
- b as NUMBER_FIELD_TYPES,
86
- p as changedRowFields,
87
- E as checkNumberEntry,
88
- c as isIntegerFieldType,
89
- h as lineRuleErrors,
90
- _ as mergePendingQtyRow,
91
- y as ruleValueFor
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
  };
@@ -0,0 +1,48 @@
1
+ function r(e) {
2
+ return e.childFailed === !0 || e.reasonWaiting === !0;
3
+ }
4
+ function a(e, s) {
5
+ const { isNew: t } = s, i = s.noun.toLowerCase();
6
+ if (e.childFailed) {
7
+ const n = e.childErrors ?? [];
8
+ return n.length === 0 && e.linkProblems.length > 0 ? null : {
9
+ kind: "error",
10
+ text: n.length > 0 ? `Not everything saved — ${n.join(" · ")}` : "Not everything saved — some lines did not save",
11
+ duration: 2e4
12
+ };
13
+ }
14
+ if (e.reasonWaiting)
15
+ return {
16
+ kind: "warning",
17
+ text: "Not saved yet — give a reason for the change to finish saving",
18
+ duration: 1e4
19
+ };
20
+ if (e.hidden) {
21
+ const n = e.hidden.reason ? ` (${e.hidden.reason})` : "";
22
+ return {
23
+ kind: "warning",
24
+ text: t ? `The new ${i} was created, but it’s outside what you can see${n}.` : `Saved, but this ${i} is now outside what you can see${n}.`,
25
+ duration: 15e3
26
+ };
27
+ }
28
+ if (e.lineConflicts) {
29
+ const n = e.lineConflicts;
30
+ return {
31
+ kind: "warning",
32
+ text: `Saved, except ${n} ${n === 1 ? "line" : "lines"} someone else changed — pick which value wins`,
33
+ duration: 1e4
34
+ };
35
+ }
36
+ if (!t && e.keptTheirs) {
37
+ const n = e.keptTheirs;
38
+ return {
39
+ kind: "success",
40
+ text: e.noFieldWrite && e.onlyMain ? `Kept the newer ${n === 1 ? "value" : "values"} — nothing of yours left to save` : `Changes saved — kept the newer ${n === 1 ? "value" : "values"} for ${n} ${n === 1 ? "field" : "fields"}`
41
+ };
42
+ }
43
+ return !t && e.noFieldWrite && e.onlyMain ? { kind: "plain", text: "Nothing to save — no changes" } : { kind: "success", text: t ? "Record created" : "Changes saved" };
44
+ }
45
+ export {
46
+ a as saveClosingMessage,
47
+ r as saveLeftWorkStaged
48
+ };
@@ -1,23 +1,23 @@
1
- function d(o) {
2
- const t = o == null ? void 0 : o.response;
3
- if (!t || typeof t != "object") return null;
4
- const e = t.data;
5
- return e && typeof e == "object" && !Array.isArray(e) ? e : t;
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 u = /^([A-Za-z0-9_]+)\[([^\]]*)\]:\s*/, a = /\s+—\s+nothing was changed.*$/s;
8
- function g(o, t) {
9
- const e = d(o);
10
- if (!e) return null;
11
- const r = String(e.error ?? e.message ?? ""), n = u.exec(r);
12
- if (n && t.has(n[1])) {
13
- const l = r.slice(n[0].length).replace(a, "").trim(), f = /^\d{1,4}$/.test(n[2]) ? `Line ${Number(n[2]) + 1}: ` : "";
14
- return { field: n[1], message: `${f}${l || "A line was refused"}` };
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 s = Array.isArray(e.violations) ? e.violations[0] : void 0, i = typeof e.field == "string" ? e.field : s == null ? void 0 : s.field;
17
- if (typeof i != "string" || !t.has(i)) return null;
18
- const c = String((s == null ? void 0 : s.message) ?? (r.replace(a, "").trim() || "Invalid"));
19
- return { field: i, message: c };
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
- g as refusedFieldOf
22
+ p as refusedFieldOf
23
23
  };
@@ -0,0 +1,13 @@
1
+ function n(r, f, t, i) {
2
+ for (const e of r)
3
+ if (!e.startsWith("__") && (!t || !i(f[e], t[e])))
4
+ return !0;
5
+ return !1;
6
+ }
7
+ function u(r) {
8
+ return r.dirty ? r.editsDiffer ? "review" : "refresh" : "auto-refresh";
9
+ }
10
+ export {
11
+ u as staleBannerMode,
12
+ n as touchedEditsDiffer
13
+ };