@nivaro/react 0.3.12 → 0.3.14
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/slots/pipeline/OwnersSection.js +79 -75
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +50 -2
- package/dist/index.js +601 -596
- package/dist/shared/components/CollectionBrowserView.js +2373 -2298
- package/dist/shared/components/DataTable.js +347 -335
- package/dist/shared/components/ItemEditForm.js +5278 -5149
- package/dist/shared/components/ListLoadError.js +33 -0
- package/dist/shared/components/PageRenderer.js +562 -529
- package/dist/shared/components/ProfileView.js +53 -51
- package/dist/shared/components/RecordReadView.js +119 -117
- package/dist/shared/components/ReportView.js +1268 -1241
- package/dist/shared/components/cbv/export-rows.js +69 -0
- package/dist/shared/components/cbv/saved-view-risk.js +35 -0
- package/dist/shared/components/cbv/unknown-fields.js +18 -0
- package/dist/shared/components/integrations/console/AlertsView.js +27 -25
- package/dist/shared/components/integrations/console/EventsView.js +244 -209
- package/dist/shared/components/item-edit/CatalogPickerField.js +946 -878
- package/dist/shared/components/item-edit/DraftRecoveryBanner.js +84 -57
- package/dist/shared/components/item-edit/FieldAffordances.js +63 -61
- package/dist/shared/components/item-edit/FieldRow.js +195 -179
- package/dist/shared/components/item-edit/FilePickerField.js +257 -254
- package/dist/shared/components/item-edit/HeaderTools.js +139 -95
- package/dist/shared/components/item-edit/InlineTableField.js +2087 -2075
- package/dist/shared/components/item-edit/RecordLiveSync.js +196 -181
- package/dist/shared/components/item-edit/RowComments.js +1 -3
- package/dist/shared/components/item-edit/SummaryPanel.js +62 -62
- package/dist/shared/components/item-edit/UserChip.js +113 -113
- package/dist/shared/components/item-edit/file-download.js +18 -0
- package/dist/shared/components/item-edit/line-qty.js +67 -32
- package/dist/shared/components/item-edit/save-refusal.js +23 -0
- package/dist/shared/components/monitoring/TrafficMiniMap.js +9 -9
- package/dist/shared/components/panels/CommentPanel.js +30 -30
- package/dist/shared/components/panels/ItemLockBanner.js +207 -185
- package/dist/shared/components/panels/PipelinePanel.js +915 -786
- package/dist/shared/components/pipeline/PipelineEditorView.js +45 -25
- package/dist/shared/components/profile/DelegationCard.js +1 -1
- package/dist/shared/components/profile/session-actions.js +24 -24
- package/dist/shared/components/queue/QueueItemSheet.js +18 -18
- package/dist/shared/components/queue/QueueWorklist.js +517 -504
- package/dist/shared/components/ui/dropdown-menu.js +8 -7
- package/dist/shared/context.js +71 -66
- package/dist/shared/lib/draft-store.js +60 -33
- package/dist/shared/lib/leave-guard.js +38 -0
- package/dist/shared/lib/load-error.js +38 -17
- package/dist/shared/lib/summary-mode.js +25 -25
- package/dist/shared/lib/table-pins.js +23 -0
- package/dist/shared/lib/validation-rules.js +55 -51
- package/package.json +1 -1
|
@@ -1,109 +1,113 @@
|
|
|
1
|
-
function
|
|
1
|
+
function o(t) {
|
|
2
2
|
return t == null || t === "" || Array.isArray(t) && t.length === 0;
|
|
3
3
|
}
|
|
4
|
-
function
|
|
4
|
+
function d(t) {
|
|
5
5
|
if (t == null || t === "") return null;
|
|
6
|
+
const e = /* @__PURE__ */ new Date(), r = Date.UTC(e.getFullYear(), e.getMonth(), e.getDate()), s = String(t).match(
|
|
7
|
+
/^(\d{4})-(\d{2})-(\d{2})(?:[T ]00:00:00(?:\.0+)?(?:Z|[+-]00:?00)?)?$/
|
|
8
|
+
);
|
|
9
|
+
if (s) return Math.round((Date.UTC(+s[1], +s[2] - 1, +s[3]) - r) / 864e5);
|
|
6
10
|
const n = new Date(String(t));
|
|
7
11
|
if (Number.isNaN(n.getTime())) return null;
|
|
8
|
-
const
|
|
9
|
-
return Math.round((
|
|
12
|
+
const i = Date.UTC(n.getFullYear(), n.getMonth(), n.getDate());
|
|
13
|
+
return Math.round((i - r) / 864e5);
|
|
10
14
|
}
|
|
11
|
-
function
|
|
12
|
-
const
|
|
13
|
-
if (!
|
|
14
|
-
const r =
|
|
15
|
-
if (s.length === 0) return { stored: null, display:
|
|
16
|
-
const
|
|
17
|
-
return
|
|
18
|
-
stored: `+1${
|
|
19
|
-
display: `+1 (${
|
|
15
|
+
function c(t) {
|
|
16
|
+
const e = String(t ?? "").trim();
|
|
17
|
+
if (!e) return { stored: null, display: "", valid: !0 };
|
|
18
|
+
const r = e.startsWith("+"), s = e.replace(/\D/g, "");
|
|
19
|
+
if (s.length === 0) return { stored: null, display: e, valid: !1 };
|
|
20
|
+
const n = s.length === 10 && !r ? s : s.length === 11 && s.startsWith("1") ? s.slice(1) : null;
|
|
21
|
+
return n ? {
|
|
22
|
+
stored: `+1${n}`,
|
|
23
|
+
display: `+1 (${n.slice(0, 3)}) ${n.slice(3, 6)}-${n.slice(6)}`,
|
|
20
24
|
valid: !0
|
|
21
|
-
} : r && s.length >= 8 && s.length <= 15 ? { stored: `+${s}`, display: `+${s}`, valid: !0 } : { stored: r ? `+${s}` : s, display:
|
|
25
|
+
} : r && s.length >= 8 && s.length <= 15 ? { stored: `+${s}`, display: `+${s}`, valid: !0 } : { stored: r ? `+${s}` : s, display: e, valid: !1 };
|
|
22
26
|
}
|
|
23
27
|
function y(t) {
|
|
24
|
-
const
|
|
25
|
-
return
|
|
28
|
+
const e = c(t);
|
|
29
|
+
return e.valid && e.stored ? e.display : String(t ?? "");
|
|
26
30
|
}
|
|
27
|
-
function f(t,
|
|
28
|
-
switch (
|
|
31
|
+
function f(t, e, r) {
|
|
32
|
+
switch (e) {
|
|
29
33
|
case "null":
|
|
30
|
-
return
|
|
34
|
+
return o(t);
|
|
31
35
|
case "nnull":
|
|
32
|
-
return !
|
|
36
|
+
return !o(t);
|
|
33
37
|
case "neq":
|
|
34
38
|
return String(t ?? "") !== String(r ?? "");
|
|
35
39
|
case "in":
|
|
36
|
-
return (Array.isArray(r) ? r : String(r ?? "").split(",")).some((
|
|
40
|
+
return (Array.isArray(r) ? r : String(r ?? "").split(",")).some((n) => String(n).trim() === String(t ?? ""));
|
|
37
41
|
default:
|
|
38
42
|
return String(t ?? "") === String(r ?? "");
|
|
39
43
|
}
|
|
40
44
|
}
|
|
41
|
-
function m(t,
|
|
42
|
-
const r = (
|
|
43
|
-
if (s !== null &&
|
|
44
|
-
const
|
|
45
|
-
return
|
|
45
|
+
function m(t, e) {
|
|
46
|
+
const r = (u) => typeof u == "number" ? u : typeof u == "string" && /^\s*-?(\d+\.?\d*|\.\d+)\s*$/.test(u) ? Number(u) : null, s = r(t), n = r(e);
|
|
47
|
+
if (s !== null && n !== null && Number.isFinite(s) && Number.isFinite(n)) return s - n;
|
|
48
|
+
const i = (u) => u instanceof Date ? Number.isNaN(u.getTime()) ? null : u.toISOString().slice(0, 10) : typeof u == "string" && /^\d{4}-\d{2}-\d{2}/.test(u) ? u.slice(0, 10) : null, l = i(t), a = i(e);
|
|
49
|
+
return l === null || a === null ? null : l < a ? -1 : l > a ? 1 : 0;
|
|
46
50
|
}
|
|
47
|
-
function g(t,
|
|
51
|
+
function g(t, e, r, s, n, i) {
|
|
48
52
|
if (!r || !s) return null;
|
|
49
|
-
const
|
|
50
|
-
if (
|
|
51
|
-
const a = m(
|
|
53
|
+
const l = s[r];
|
|
54
|
+
if (o(e) || o(l)) return null;
|
|
55
|
+
const a = m(e, l);
|
|
52
56
|
if (a === null) return null;
|
|
53
|
-
const
|
|
54
|
-
return t === "gte_field" && a < 0 ?
|
|
57
|
+
const u = r.replace(/_/g, " ");
|
|
58
|
+
return t === "gte_field" && a < 0 ? i ?? `${n} must be on or after ${u}` : t === "lte_field" && a > 0 ? i ?? `${n} must be on or before ${u}` : null;
|
|
55
59
|
}
|
|
56
|
-
function $(t,
|
|
60
|
+
function $(t, e, r, s) {
|
|
57
61
|
if (t.type === "required_if") {
|
|
58
|
-
const
|
|
59
|
-
return !
|
|
62
|
+
const n = t.field;
|
|
63
|
+
return !n || !s || !f(s[n], String(t.op ?? "eq"), t.value) ? null : o(e) ? t.message ?? `${r} is required when ${n} matches this condition` : null;
|
|
60
64
|
}
|
|
61
65
|
if (t.type === "gte_field" || t.type === "lte_field")
|
|
62
66
|
return g(
|
|
63
67
|
t.type,
|
|
64
|
-
|
|
68
|
+
e,
|
|
65
69
|
t.field,
|
|
66
70
|
s,
|
|
67
71
|
r,
|
|
68
72
|
t.message
|
|
69
73
|
);
|
|
70
|
-
if (
|
|
74
|
+
if (o(e) && t.type !== "required") return null;
|
|
71
75
|
switch (t.type) {
|
|
72
76
|
case "required":
|
|
73
|
-
return
|
|
77
|
+
return o(e) ? t.message ?? `${r} is required` : null;
|
|
74
78
|
case "min": {
|
|
75
|
-
const
|
|
76
|
-
return typeof
|
|
79
|
+
const n = Number(t.value);
|
|
80
|
+
return typeof e == "number" && e < n ? t.message ?? `${r} must be at least ${n}` : typeof e == "string" && e.length < n ? t.message ?? `${r} must be at least ${n} characters` : null;
|
|
77
81
|
}
|
|
78
82
|
case "max": {
|
|
79
|
-
const
|
|
80
|
-
return typeof
|
|
83
|
+
const n = Number(t.value);
|
|
84
|
+
return typeof e == "number" && e > n ? t.message ?? `${r} must be at most ${n}` : typeof e == "string" && e.length > n ? t.message ?? `${r} must be at most ${n} characters` : null;
|
|
81
85
|
}
|
|
82
86
|
case "regex":
|
|
83
87
|
try {
|
|
84
|
-
return new RegExp(String(t.value)).test(String(
|
|
88
|
+
return new RegExp(String(t.value)).test(String(e)) ? null : t.message ?? `${r} is invalid`;
|
|
85
89
|
} catch {
|
|
86
90
|
return null;
|
|
87
91
|
}
|
|
88
92
|
case "email":
|
|
89
|
-
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(
|
|
93
|
+
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(e)) ? null : t.message ?? `${r} must be a valid email`;
|
|
90
94
|
case "phone":
|
|
91
|
-
return
|
|
95
|
+
return c(e).valid ? null : t.message ?? `${r} must be a valid phone number`;
|
|
92
96
|
case "url":
|
|
93
97
|
try {
|
|
94
|
-
return new URL(String(
|
|
98
|
+
return new URL(String(e)), null;
|
|
95
99
|
} catch {
|
|
96
100
|
return t.message ?? `${r} must be a valid URL`;
|
|
97
101
|
}
|
|
98
102
|
// Date must be at least N calendar days from today (e.g. delivery-date
|
|
99
103
|
// minimums). max_days_from_today caps how far out a date may be.
|
|
100
104
|
case "min_days_from_today": {
|
|
101
|
-
const
|
|
102
|
-
return
|
|
105
|
+
const n = d(e), i = Number(t.value);
|
|
106
|
+
return n === null || Number.isNaN(i) || n >= i ? null : t.message ?? `${r} must be at least ${i} days from today`;
|
|
103
107
|
}
|
|
104
108
|
case "max_days_from_today": {
|
|
105
|
-
const
|
|
106
|
-
return
|
|
109
|
+
const n = d(e), i = Number(t.value);
|
|
110
|
+
return n === null || Number.isNaN(i) || n <= i ? null : t.message ?? `${r} must be within ${i} days of today`;
|
|
107
111
|
}
|
|
108
112
|
default:
|
|
109
113
|
return null;
|
|
@@ -112,5 +116,5 @@ function $(t, n, r, s) {
|
|
|
112
116
|
export {
|
|
113
117
|
$ as applyValidationRule,
|
|
114
118
|
y as formatPhone,
|
|
115
|
-
|
|
119
|
+
c as normalizePhone
|
|
116
120
|
};
|