@nivaro/react 0.3.49 → 0.3.51

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 (46) hide show
  1. package/dist/components/InlineGridField.js +166 -105
  2. package/dist/full.css +1 -1
  3. package/dist/hooks/useSessionRecorder.js +1 -1
  4. package/dist/index.d.ts +38 -4
  5. package/dist/shared/components/ItemEditForm.js +5258 -5034
  6. package/dist/shared/components/QueryTable.js +489 -347
  7. package/dist/shared/components/ReportView.js +105 -99
  8. package/dist/shared/components/alerts/AlertManagerView.js +327 -301
  9. package/dist/shared/components/item-edit/CatalogPickerField.js +1230 -1175
  10. package/dist/shared/components/item-edit/CloneDialog.js +192 -142
  11. package/dist/shared/components/item-edit/DraftRecoveryBanner.js +58 -53
  12. package/dist/shared/components/item-edit/FieldRenderer.js +249 -244
  13. package/dist/shared/components/item-edit/FieldRow.js +402 -370
  14. package/dist/shared/components/item-edit/FilePickerField.js +315 -307
  15. package/dist/shared/components/item-edit/InlineGridField.js +92 -90
  16. package/dist/shared/components/item-edit/InlineTableField.js +3119 -2951
  17. package/dist/shared/components/item-edit/MidairCollisionDialog.js +175 -0
  18. package/dist/shared/components/item-edit/PlanGrid.js +162 -162
  19. package/dist/shared/components/item-edit/PolishFields.js +169 -162
  20. package/dist/shared/components/item-edit/RecordHeaderActions.js +76 -75
  21. package/dist/shared/components/item-edit/RecordLiveSync.js +93 -91
  22. package/dist/shared/components/item-edit/RelationCombobox.js +198 -191
  23. package/dist/shared/components/item-edit/SummaryPanel.js +282 -259
  24. package/dist/shared/components/item-edit/UserChip.js +233 -200
  25. package/dist/shared/components/item-edit/ValidationSummary.js +64 -47
  26. package/dist/shared/components/item-edit/header-midair.js +51 -0
  27. package/dist/shared/components/item-edit/helpers.js +181 -155
  28. package/dist/shared/components/item-edit/line-midair.js +207 -0
  29. package/dist/shared/components/item-edit/soft-rules.js +27 -0
  30. package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
  31. package/dist/shared/components/panels/CommentPanel.js +290 -284
  32. package/dist/shared/components/panels/ItemLockBanner.js +414 -358
  33. package/dist/shared/components/panels/PipelinePanel.js +1241 -992
  34. package/dist/shared/components/panels/RecordIntegrityBanner.js +1 -1
  35. package/dist/shared/components/panels/TaskPanel.js +71 -61
  36. package/dist/shared/components/panels/TransitionRequirementsDialog.js +569 -439
  37. package/dist/shared/components/panels/requirement-side-effects.js +40 -0
  38. package/dist/shared/components/queue/QueueWorklist.js +925 -871
  39. package/dist/shared/components/queue/column-chooser.js +21 -0
  40. package/dist/shared/components/queue/live-state-aspect.js +6 -0
  41. package/dist/shared/components/ui/number-draft-input.js +93 -0
  42. package/dist/shared/components/widgets/ReviewListWidget.js +191 -166
  43. package/dist/shared/lib/draft-store.js +48 -34
  44. package/dist/shared/lib/error-hints.js +1 -0
  45. package/dist/shared/lib/query-stats.js +60 -60
  46. package/package.json +1 -1
@@ -1,40 +1,40 @@
1
- const u = "nivaro-drafts", l = "drafts";
2
- function g(e) {
1
+ const f = "nivaro-drafts", i = "drafts";
2
+ function m(e) {
3
3
  if (e == null) return null;
4
4
  const t = JSON.stringify(
5
5
  e,
6
- (o, r) => r && typeof r == "object" && !Array.isArray(r) ? Object.fromEntries(Object.entries(r).sort(([a], [c]) => a < c ? -1 : a > c ? 1 : 0)) : r
6
+ (o, r) => r && typeof r == "object" && !Array.isArray(r) ? Object.fromEntries(Object.entries(r).sort(([a], [s]) => a < s ? -1 : a > s ? 1 : 0)) : r
7
7
  );
8
8
  if (!t || t === "{}" || t === "[]") return null;
9
9
  let n = 5381;
10
10
  for (let o = 0; o < t.length; o++) n = (n << 5) + n + t.charCodeAt(o) | 0;
11
11
  return `p${(n >>> 0).toString(36)}:${t.length}`;
12
12
  }
13
- function m(e, t) {
13
+ function y(e, t) {
14
14
  return (e.prefill_sig ?? null) === t;
15
15
  }
16
- function y(e, t, n) {
16
+ function b(e, t, n) {
17
17
  return `${e}:${t && t !== "new" ? t : "new"}:${n || "anon"}`;
18
18
  }
19
- function f() {
19
+ function d() {
20
20
  return new Promise((e) => {
21
21
  try {
22
22
  if (typeof indexedDB > "u") return e(null);
23
- const t = indexedDB.open(u, 1);
23
+ const t = indexedDB.open(f, 1);
24
24
  t.onupgradeneeded = () => {
25
25
  const n = t.result;
26
- n.objectStoreNames.contains(l) || n.createObjectStore(l, { keyPath: "key" });
26
+ n.objectStoreNames.contains(i) || n.createObjectStore(i, { keyPath: "key" });
27
27
  }, t.onsuccess = () => e(t.result), t.onerror = () => e(null), t.onblocked = () => e(null);
28
28
  } catch {
29
29
  e(null);
30
30
  }
31
31
  });
32
32
  }
33
- async function i(e, t) {
34
- const n = await f();
33
+ async function c(e, t) {
34
+ const n = await d();
35
35
  return n ? new Promise((o) => {
36
36
  try {
37
- const r = n.transaction(l, e), a = t(r.objectStore(l));
37
+ const r = n.transaction(i, e), a = t(r.objectStore(i));
38
38
  a.onsuccess = () => o(a.result), a.onerror = () => o(null), r.oncomplete = () => n.close(), r.onerror = () => {
39
39
  n.close(), o(null);
40
40
  };
@@ -43,37 +43,37 @@ async function i(e, t) {
43
43
  }
44
44
  }) : null;
45
45
  }
46
- async function b(e) {
47
- return await i("readwrite", (n) => n.put(e)) != null;
46
+ async function S(e) {
47
+ return await c("readwrite", (n) => n.put(e)) != null;
48
48
  }
49
- async function p(e) {
50
- const t = await i("readonly", (n) => n.get(e));
49
+ async function _(e) {
50
+ const t = await c("readonly", (n) => n.get(e));
51
51
  return t && typeof t == "object" && t.key === e ? t : null;
52
52
  }
53
- async function h(e) {
54
- await i("readwrite", (t) => t.delete(e));
53
+ async function O(e) {
54
+ await c("readwrite", (t) => t.delete(e));
55
55
  }
56
- const s = "nvr:draft-created:", d = 7 * 864e5;
57
- function O(e, t, n = /* @__PURE__ */ new Date()) {
56
+ const l = "nvr:draft-created:", g = 7 * 864e5;
57
+ function h(e, t, n = /* @__PURE__ */ new Date()) {
58
58
  try {
59
59
  localStorage.setItem(
60
- s + e,
60
+ l + e,
61
61
  JSON.stringify({ id: t, at: n.toISOString() })
62
62
  );
63
63
  } catch {
64
64
  }
65
65
  }
66
- function S(e, t, n = /* @__PURE__ */ new Date()) {
66
+ function p(e, t, n = /* @__PURE__ */ new Date()) {
67
67
  try {
68
- const o = localStorage.getItem(s + e);
68
+ const o = localStorage.getItem(l + e);
69
69
  if (!o) return null;
70
70
  const r = JSON.parse(o);
71
71
  if (!r || typeof r.id != "string" || typeof r.at != "string") return null;
72
72
  const a = Date.parse(r.at);
73
- if (!Number.isFinite(a) || n.getTime() - a > d)
74
- return localStorage.removeItem(s + e), null;
75
- const c = t ? Date.parse(t) : Number.NaN;
76
- return !Number.isFinite(c) || c > a ? null : { id: r.id, at: r.at };
73
+ if (!Number.isFinite(a) || n.getTime() - a > g)
74
+ return localStorage.removeItem(l + e), null;
75
+ const s = t ? Date.parse(t) : Number.NaN;
76
+ return !Number.isFinite(s) || s > a ? null : { id: r.id, at: r.at };
77
77
  } catch {
78
78
  return null;
79
79
  }
@@ -81,14 +81,28 @@ function S(e, t, n = /* @__PURE__ */ new Date()) {
81
81
  function w(e) {
82
82
  return Object.keys(e.fields ?? {}).length > 0 || Object.values(e.pending_rows ?? {}).some((t) => t.length > 0) || Object.values(e.pending_edits ?? {}).some((t) => Object.keys(t).length > 0) || Object.values(e.pending_deletes ?? {}).some((t) => t.length > 0) || Object.values(e.m2m_links ?? {}).some((t) => t.length > 0) || Object.values(e.m2m_unlinks ?? {}).some((t) => t.length > 0);
83
83
  }
84
+ function u(e) {
85
+ return JSON.stringify([
86
+ e.fields ?? {},
87
+ e.pending_rows ?? {},
88
+ e.pending_edits ?? {},
89
+ e.pending_deletes ?? {},
90
+ e.m2m_links ?? {},
91
+ e.m2m_unlinks ?? {}
92
+ ]);
93
+ }
94
+ function D(e, t) {
95
+ return !(t != null && t.saved_at) || t.key !== e.key ? e : u(t) === u(e) ? { ...e, saved_at: t.saved_at } : e;
96
+ }
84
97
  export {
85
- h as deleteDraft,
86
- S as draftCreatedAs,
98
+ O as deleteDraft,
99
+ p as draftCreatedAs,
87
100
  w as draftHasContent,
88
- y as draftKey,
89
- m as draftMatchesPrefill,
90
- p as loadDraft,
91
- O as markDraftCreated,
92
- g as prefillSignature,
93
- b as saveDraft
101
+ b as draftKey,
102
+ y as draftMatchesPrefill,
103
+ D as keepDraftSavedAt,
104
+ _ as loadDraft,
105
+ h as markDraftCreated,
106
+ m as prefillSignature,
107
+ S as saveDraft
94
108
  };
@@ -45,6 +45,7 @@ const h = {
45
45
  VALUE_OUT_OF_RANGE: "Use a smaller number, then save again.",
46
46
  DELETE_GUARDED: "This record is protected from deletion. Sort out what the message names first.",
47
47
  TRANSITION_DUPLICATE: "This move was already made. Reload the record to see where it is now.",
48
+ PRIORITY_REQUIRED: "Flag the workflow as Priority, then approve.",
48
49
  NESTED_ROW_REFUSED: "Fix the line the message names, then save again.",
49
50
  NESTED_ROW_NOT_OWNED: "That line belongs to another record. Reload, then try again.",
50
51
  NESTED_ROWS_LIMIT: "Save fewer lines at once, then add the rest in another save.",
@@ -1,88 +1,88 @@
1
- import { evaluateNumeric as s, extractExpressionTokens as g } from "./expression.js";
2
- import { formatDate as d } from "./utils.js";
3
- function m(r, n) {
4
- return r.reduce((t, e) => {
5
- const i = Number(e[n]);
6
- return e[n] === null || e[n] === void 0 || e[n] === "" || !Number.isFinite(i) ? t : t + i;
1
+ import { evaluateNumeric as s, extractExpressionTokens as d } from "./expression.js";
2
+ import { formatDate as b } from "./utils.js";
3
+ function l(e, n) {
4
+ return e.reduce((i, r) => {
5
+ const t = Number(r[n]);
6
+ return r[n] === null || r[n] === void 0 || r[n] === "" || !Number.isFinite(t) ? i : i + t;
7
7
  }, 0);
8
8
  }
9
- function l(r) {
10
- return r != null && r !== "" && Number.isFinite(Number(r));
9
+ function f(e) {
10
+ return e != null && e !== "" && Number.isFinite(Number(e));
11
11
  }
12
- function b(r, n) {
13
- return r.some((t) => l(t[n]));
12
+ function m(e, n) {
13
+ return e.some((i) => f(i[n]));
14
14
  }
15
- function f(r, n) {
16
- const t = g(r);
17
- return n.filter((e) => t.every((i) => l(e[i])));
15
+ function a(e, n) {
16
+ const i = d(e);
17
+ return n.filter((r) => i.every((t) => f(r[t])));
18
18
  }
19
- function F(r, n) {
20
- if (r.query || r.format === "date" || r.format === "text") return null;
21
- const t = a(n, r.row_match);
22
- if (r.formula)
23
- return { reporting: f(r.formula, t).length, total: t.length };
24
- if (r.field) {
25
- const e = r.field;
26
- return { reporting: t.filter((i) => l(i[e])).length, total: t.length };
19
+ function F(e, n) {
20
+ if (e.query || e.format === "date" || e.format === "text") return null;
21
+ const i = g(n, e.row_match);
22
+ if (e.formula)
23
+ return { reporting: a(e.formula, i).length, total: i.length };
24
+ if (e.field) {
25
+ const r = e.field;
26
+ return { reporting: i.filter((t) => f(t[r])).length, total: i.length };
27
27
  }
28
28
  return null;
29
29
  }
30
- function a(r, n) {
31
- if (!n) return r;
32
- const t = Object.entries(n);
33
- return r.filter((e) => t.every(([i, o]) => String(e[i] ?? "") === String(o)));
30
+ function g(e, n) {
31
+ if (!n) return e;
32
+ const i = Object.entries(n);
33
+ return e.filter((r) => i.every(([t, u]) => String(r[t] ?? "") === String(u)));
34
34
  }
35
- function h(r, n, t) {
36
- var i;
37
- if (r.query) {
38
- const o = t ?? [];
39
- if (r.format === "date" || r.format === "text") {
40
- const u = (i = o[0]) == null ? void 0 : i[r.query.value_field];
41
- return u == null || u === "" ? null : String(u);
35
+ function h(e, n, i) {
36
+ var t;
37
+ if (e.query) {
38
+ const u = i ?? [];
39
+ if (e.format === "date" || e.format === "text") {
40
+ const o = (t = u[0]) == null ? void 0 : t[e.query.value_field];
41
+ return o == null || o === "" ? null : String(o);
42
42
  }
43
- return m(o, r.query.value_field);
43
+ return m(u, e.query.value_field) ? l(u, e.query.value_field) : null;
44
44
  }
45
- if (r.format === "date" || r.format === "text") return null;
46
- const e = a(n, r.row_match);
47
- if (r.formula) {
48
- const o = f(r.formula, e), u = s(
49
- r.formula,
50
- (c) => b(o, c) ? m(o, c) : null,
45
+ if (e.format === "date" || e.format === "text") return null;
46
+ const r = g(n, e.row_match);
47
+ if (e.formula) {
48
+ const u = a(e.formula, r), o = s(
49
+ e.formula,
50
+ (c) => m(u, c) ? l(u, c) : null,
51
51
  { missing: "null" }
52
52
  );
53
- return u === null || !Number.isFinite(u) ? null : u;
53
+ return o === null || !Number.isFinite(o) ? null : o;
54
54
  }
55
- return r.field ? m(e, r.field) - (r.field_subtract ? m(e, r.field_subtract) : 0) : null;
55
+ return e.field ? r.length > 0 && !m(r, e.field) ? null : l(r, e.field) - (e.field_subtract ? l(r, e.field_subtract) : 0) : null;
56
56
  }
57
- function N(r, n, t = "—") {
58
- if (r == null || r === "") return t;
59
- if (n === "text") return String(r);
57
+ function N(e, n, i = "—") {
58
+ if (e == null || e === "") return i;
59
+ if (n === "text") return String(e);
60
60
  if (n === "date") {
61
- const i = new Date(r);
62
- return Number.isNaN(i.getTime()) ? t : d(typeof r == "number" ? i : r);
61
+ const t = new Date(e);
62
+ return Number.isNaN(t.getTime()) ? i : b(typeof e == "number" ? t : e);
63
63
  }
64
- const e = typeof r == "number" ? r : Number(r);
65
- return Number.isFinite(e) ? n === "number" ? e.toLocaleString("en-US", { maximumFractionDigits: 2 }) : n === "percent" ? `${e.toLocaleString("en-US", { maximumFractionDigits: 1 })}%` : e.toLocaleString("en-US", {
64
+ const r = typeof e == "number" ? e : Number(e);
65
+ return Number.isFinite(r) ? n === "number" ? r.toLocaleString("en-US", { maximumFractionDigits: 2 }) : n === "percent" ? `${r.toLocaleString("en-US", { maximumFractionDigits: 1 })}%` : r.toLocaleString("en-US", {
66
66
  style: "currency",
67
67
  currency: "USD",
68
- minimumFractionDigits: Number.isInteger(e) ? 0 : 2,
68
+ minimumFractionDigits: Number.isInteger(r) ? 0 : 2,
69
69
  maximumFractionDigits: 2
70
- }) : t;
70
+ }) : i;
71
71
  }
72
- function p(r, n) {
73
- const t = Math.abs(r);
74
- if (t < 1e4) return N(r, n);
75
- const e = new Intl.NumberFormat("en-US", {
72
+ function y(e, n) {
73
+ const i = Math.abs(e);
74
+ if (i < 1e4) return N(e, n);
75
+ const r = new Intl.NumberFormat("en-US", {
76
76
  notation: "compact",
77
- maximumFractionDigits: t < 1e6 ? 0 : 1
78
- }).format(r);
79
- return n === "number" ? e : r < 0 ? `-$${e.slice(1)}` : `$${e}`;
77
+ maximumFractionDigits: i < 1e6 ? 0 : 1
78
+ }).format(e);
79
+ return n === "number" ? r : e < 0 ? `-$${r.slice(1)}` : `$${r}`;
80
80
  }
81
81
  export {
82
- p as compactStat,
82
+ y as compactStat,
83
83
  N as fmtStat,
84
- a as matchRows,
84
+ g as matchRows,
85
85
  F as statCoverage,
86
86
  h as statValue,
87
- m as sumField
87
+ l as sumField
88
88
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nivaro/react",
3
- "version": "0.3.49",
3
+ "version": "0.3.51",
4
4
  "description": "React hooks and components for Nivaro CMS forms",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",