@nivaro/react 0.3.64 → 0.3.65

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 (64) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +49 -4
  4. package/dist/shared/components/CollectionBrowserView.js +3029 -2947
  5. package/dist/shared/components/ConformanceView.js +235 -221
  6. package/dist/shared/components/DataTable.js +478 -459
  7. package/dist/shared/components/ItemEditForm.js +4469 -4266
  8. package/dist/shared/components/PageRenderer.js +146 -138
  9. package/dist/shared/components/RecordDrilldownSheet.js +73 -65
  10. package/dist/shared/components/bulk/BulkActionButtons.js +72 -72
  11. package/dist/shared/components/bulk/BulkFieldUpdate.js +114 -103
  12. package/dist/shared/components/bulk/BulkFieldUpdateButton.js +73 -0
  13. package/dist/shared/components/bulk/bulk-field-options.js +29 -23
  14. package/dist/shared/components/integrations/IntegrationObligationsView.js +191 -173
  15. package/dist/shared/components/integrations/IntegrationStatusLines.js +101 -85
  16. package/dist/shared/components/integrations/RecordIntegrationPreview.js +11 -9
  17. package/dist/shared/components/integrations/SendCurrentData.js +126 -0
  18. package/dist/shared/components/item-edit/CatalogPickerField.js +1530 -1437
  19. package/dist/shared/components/item-edit/FieldRenderer.js +49 -45
  20. package/dist/shared/components/item-edit/FieldRow.js +413 -403
  21. package/dist/shared/components/item-edit/InlineTableField.js +2903 -2816
  22. package/dist/shared/components/item-edit/M2MCombobox.js +172 -168
  23. package/dist/shared/components/item-edit/MidairCollisionDialog.js +341 -114
  24. package/dist/shared/components/item-edit/NestedRelationEditor.js +171 -163
  25. package/dist/shared/components/item-edit/PlanGrid.js +783 -724
  26. package/dist/shared/components/item-edit/QuickCreateButton.js +291 -224
  27. package/dist/shared/components/item-edit/RecordInsights.js +113 -111
  28. package/dist/shared/components/item-edit/RecordLiveSync.js +4 -1
  29. package/dist/shared/components/item-edit/RelationCombobox.js +332 -314
  30. package/dist/shared/components/item-edit/cascade-clear-notice.js +52 -0
  31. package/dist/shared/components/item-edit/collision-format.js +37 -0
  32. package/dist/shared/components/item-edit/field-a11y.js +25 -0
  33. package/dist/shared/components/item-edit/line-merge.js +58 -0
  34. package/dist/shared/components/item-edit/line-midair.js +94 -87
  35. package/dist/shared/components/item-edit/move-guard.js +17 -0
  36. package/dist/shared/components/item-edit/picker-search.js +22 -15
  37. package/dist/shared/components/item-edit/rail-width.js +8 -0
  38. package/dist/shared/components/monitoring/InactiveUserLinksView.js +126 -124
  39. package/dist/shared/components/panels/AccessDeniedPanel.js +96 -55
  40. package/dist/shared/components/panels/CommentPanel.js +142 -136
  41. package/dist/shared/components/panels/ItemLockBanner.js +246 -240
  42. package/dist/shared/components/panels/PipelinePanel.js +1366 -1194
  43. package/dist/shared/components/panels/RevisionsPanel.js +106 -102
  44. package/dist/shared/components/panels/SlaBreachBanner.js +16 -20
  45. package/dist/shared/components/panels/SlaClock.js +90 -68
  46. package/dist/shared/components/queue/QueueItemSheet.js +94 -87
  47. package/dist/shared/components/queue/QueueWorklist.js +1502 -1354
  48. package/dist/shared/components/queue/worklist-csv.js +75 -0
  49. package/dist/shared/components/queue/worklist-helpers.js +20 -0
  50. package/dist/shared/components/widgets/ReviewListWidget.js +226 -207
  51. package/dist/shared/lib/bulk-copy.js +17 -0
  52. package/dist/shared/lib/cbv-export.js +122 -0
  53. package/dist/shared/lib/delete-offer.js +13 -0
  54. package/dist/shared/lib/error-hints.js +1 -0
  55. package/dist/shared/lib/leave-guard.js +41 -26
  56. package/dist/shared/lib/list-link.js +72 -56
  57. package/dist/shared/lib/live-queries.js +32 -30
  58. package/dist/shared/lib/moved-notice.js +25 -0
  59. package/dist/shared/lib/notification-target.js +56 -54
  60. package/dist/shared/lib/obligation-banner.js +11 -8
  61. package/dist/shared/lib/obligation-reason-text.js +6 -6
  62. package/dist/shared/lib/sort-cycle.js +6 -0
  63. package/dist/shared/lib/summary-mode.js +59 -41
  64. package/package.json +1 -1
@@ -1,129 +1,131 @@
1
- import { canOpenChatRoom as v, openChatRoom as g } from "../components/chat/chat-core.js";
2
- const S = /* @__PURE__ */ new Set([
1
+ import { canOpenChatRoom as g, openChatRoom as S } from "../components/chat/chat-core.js";
2
+ const u = /* @__PURE__ */ new Set([
3
3
  "nivaro_metric_alert_log",
4
4
  "nivaro_anomaly_log",
5
5
  "nivaro_alert_definitions",
6
6
  "nivaro_alert_log"
7
7
  ]), q = /* @__PURE__ */ new Set(["nivaro_import_queue", "nivaro_import_jobs"]);
8
- function u(i, n, a) {
9
- var h, f, d, _, y, m, b;
10
- const c = i == null ? void 0 : i.trim();
8
+ function C(l, n, a) {
9
+ var f, d, _, y, m, b, k;
10
+ const c = l == null ? void 0 : l.trim();
11
11
  if (!c) return null;
12
- const r = n != null && String(n).trim() !== "" ? String(n) : null;
12
+ const t = n != null && String(n).trim() !== "" ? String(n) : null;
13
13
  if (c === "__chat__")
14
- return r && v() ? { type: "chat", room: r } : null;
14
+ return t && g() ? { type: "chat", room: t } : null;
15
15
  if (c === "nivaro_report_defs") {
16
- const l = r ? (h = a.report) == null ? void 0 : h.call(a, r) : null;
17
- return l ? { type: "path", path: l } : null;
16
+ const i = t ? (f = a.report) == null ? void 0 : f.call(a, t) : null;
17
+ return i ? { type: "path", path: i } : null;
18
18
  }
19
19
  if (c === "nivaro_queues") {
20
- const l = r ? (f = a.queue) == null ? void 0 : f.call(a, r) : null;
21
- return l ? { type: "path", path: l } : null;
20
+ const i = t ? (d = a.queue) == null ? void 0 : d.call(a, t) : null;
21
+ return i ? { type: "path", path: i } : null;
22
22
  }
23
23
  if (c === "nivaro_dashboards") {
24
- const l = r ? (d = a.dashboard) == null ? void 0 : d.call(a, r) : null;
25
- return l ? { type: "path", path: l } : null;
24
+ const i = t ? (_ = a.dashboard) == null ? void 0 : _.call(a, t) : null;
25
+ return i ? { type: "path", path: i } : null;
26
26
  }
27
- if (S.has(c)) {
28
- const l = (_ = a.alerts) == null ? void 0 : _.call(a);
29
- return l ? { type: "path", path: l } : null;
27
+ if (u.has(c)) {
28
+ const i = (y = a.alerts) == null ? void 0 : y.call(a);
29
+ return i ? { type: "path", path: i } : null;
30
30
  }
31
31
  if (q.has(c)) {
32
- const l = (y = a.imports) == null ? void 0 : y.call(a);
33
- return l ? { type: "path", path: l } : null;
32
+ const i = (m = a.imports) == null ? void 0 : m.call(a);
33
+ return i ? { type: "path", path: i } : null;
34
34
  }
35
35
  if (c === "nivaro_issues") {
36
- const l = (m = a.issues) == null ? void 0 : m.call(a);
37
- return l ? { type: "path", path: l } : null;
36
+ const i = (b = a.issues) == null ? void 0 : b.call(a);
37
+ return i ? { type: "path", path: i } : null;
38
38
  }
39
39
  if (/^nivaro_/i.test(c) || /^directus_/i.test(c)) return null;
40
- if (r) {
41
- const l = a.record(c, r);
42
- return l ? { type: "path", path: l } : null;
40
+ if (t) {
41
+ const i = a.record(c, t);
42
+ return i ? { type: "path", path: i } : null;
43
43
  }
44
- const e = (b = a.list) == null ? void 0 : b.call(a, c);
45
- return e ? { type: "path", path: e } : null;
44
+ const h = (k = a.list) == null ? void 0 : k.call(a, c);
45
+ return h ? { type: "path", path: h } : null;
46
46
  }
47
- const C = (i, n) => {
47
+ const $ = (l, n) => {
48
48
  const a = [];
49
- return n.query && a.push(n.query), n.tab && a.push(`tab=${encodeURIComponent(n.tab)}`), n.focus && a.push(`focus=${encodeURIComponent(n.focus)}`), a.length === 0 ? i : `${i}${i.includes("?") ? "&" : "?"}${a.join("&")}`;
49
+ return n.query && a.push(n.query), n.tab && a.push(`tab=${encodeURIComponent(n.tab)}`), n.focus && a.push(`focus=${encodeURIComponent(n.focus)}`), a.length === 0 ? l : `${l}${l.includes("?") ? "&" : "?"}${a.join("&")}`;
50
50
  };
51
- function $(i) {
51
+ function v(l) {
52
52
  try {
53
53
  if (typeof window > "u") return null;
54
- const n = new URL(i, window.location.origin);
54
+ const n = new URL(l, window.location.origin);
55
55
  return n.origin !== window.location.origin ? null : `${n.pathname}${n.search}${n.hash}`;
56
56
  } catch {
57
57
  return null;
58
58
  }
59
59
  }
60
- function R(i, n) {
61
- var c, r, e, h, f, d, _, y, m, b, l, o, w;
62
- const a = i.target ?? null;
60
+ function R(l, n) {
61
+ var c, t, h, f, d, _, y, m, b, k, i, o, w;
62
+ const a = l.target ?? null;
63
63
  if (a) {
64
- const t = (k) => k ? { type: "path", path: C(k, a) } : null;
64
+ const r = (e) => e ? { type: "path", path: $(e, a) } : null;
65
65
  let p = null;
66
66
  switch (a.kind) {
67
67
  case "record":
68
68
  case "sla":
69
69
  case "approval": {
70
- a.collection && a.id != null ? p = t(n.record(a.collection, String(a.id))) : a.collection ? p = t((c = n.list) == null ? void 0 : c.call(n, a.collection)) : a.kind === "approval" && (p = t((r = n.approvals) == null ? void 0 : r.call(n)));
70
+ a.collection && a.id != null ? p = r(n.record(a.collection, String(a.id))) : a.collection ? p = r((c = n.list) == null ? void 0 : c.call(n, a.collection)) : a.kind === "approval" && (p = r((t = n.approvals) == null ? void 0 : t.call(n)));
71
71
  break;
72
72
  }
73
73
  case "task":
74
- p = t(((e = n.tasks) == null ? void 0 : e.call(n, a.id != null ? String(a.id) : null)) ?? ((h = n.my_work) == null ? void 0 : h.call(n)));
74
+ p = r(((h = n.tasks) == null ? void 0 : h.call(n, a.id != null ? String(a.id) : null)) ?? ((f = n.my_work) == null ? void 0 : f.call(n)));
75
75
  break;
76
76
  case "access_request":
77
- p = t((f = n.access_requests) == null ? void 0 : f.call(n));
77
+ p = r((d = n.access_requests) == null ? void 0 : d.call(n));
78
78
  break;
79
79
  case "support":
80
- p = t((d = n.support) == null ? void 0 : d.call(n, a.id != null ? String(a.id) : null));
80
+ p = r((_ = n.support) == null ? void 0 : _.call(n, a.id != null ? String(a.id) : null));
81
81
  break;
82
82
  case "chat":
83
- p = a.room && v() ? { type: "chat", room: a.room } : null;
83
+ p = a.room && g() ? { type: "chat", room: a.room } : null;
84
84
  break;
85
85
  case "queue":
86
- p = a.id != null ? t((_ = n.queue) == null ? void 0 : _.call(n, String(a.id))) : null;
86
+ p = a.id != null ? r((y = n.queue) == null ? void 0 : y.call(n, String(a.id))) : null;
87
87
  break;
88
88
  case "report":
89
- p = a.id != null ? t((y = n.report) == null ? void 0 : y.call(n, String(a.id))) : null;
89
+ p = a.id != null ? r((m = n.report) == null ? void 0 : m.call(n, String(a.id))) : null;
90
90
  break;
91
91
  case "dashboard":
92
- p = a.id != null ? t((m = n.dashboard) == null ? void 0 : m.call(n, String(a.id))) : null;
92
+ p = a.id != null ? r((b = n.dashboard) == null ? void 0 : b.call(n, String(a.id))) : null;
93
93
  break;
94
94
  case "alerts":
95
- p = t((b = n.alerts) == null ? void 0 : b.call(n));
95
+ p = r((k = n.alerts) == null ? void 0 : k.call(n));
96
96
  break;
97
97
  case "import":
98
- p = t((l = n.imports) == null ? void 0 : l.call(n));
98
+ p = r((i = n.imports) == null ? void 0 : i.call(n));
99
99
  break;
100
100
  case "issue":
101
- p = t((o = n.issues) == null ? void 0 : o.call(n));
101
+ p = r((o = n.issues) == null ? void 0 : o.call(n));
102
102
  break;
103
103
  case "my_work":
104
- p = t((w = n.my_work) == null ? void 0 : w.call(n));
104
+ p = r((w = n.my_work) == null ? void 0 : w.call(n));
105
105
  break;
106
106
  case "home":
107
107
  p = { type: "path", path: "/" };
108
108
  break;
109
- case "external":
110
- p = a.url ? { type: "external", url: a.url } : null;
109
+ case "external": {
110
+ const e = a.url ? v(a.url) : null;
111
+ p = e ? { type: "path", path: e } : a.url ? { type: "external", url: a.url } : null;
111
112
  break;
113
+ }
112
114
  }
113
115
  if (p) return p;
114
- if (i.url) {
115
- const k = $(i.url);
116
- return k ? { type: "path", path: k } : { type: "external", url: i.url };
116
+ if (l.url) {
117
+ const e = v(l.url);
118
+ return e ? { type: "path", path: e } : { type: "external", url: l.url };
117
119
  }
118
120
  return null;
119
121
  }
120
- return u(i.collection, i.item, n);
122
+ return C(l.collection, l.item, n);
121
123
  }
122
- function T(i, n) {
123
- return i ? i.type === "chat" ? (g(i.room), !0) : i.type === "external" ? (typeof window < "u" && window.open(i.url, "_blank", "noopener"), !0) : (n(i.path), !0) : !1;
124
+ function T(l, n) {
125
+ return l ? l.type === "chat" ? (S(l.room), !0) : l.type === "external" ? (typeof window < "u" && window.open(l.url, "_blank", "noopener"), !0) : (n(l.path), !0) : !1;
124
126
  }
125
127
  export {
126
- u as resolveNotificationTarget,
128
+ C as resolveNotificationTarget,
127
129
  R as resolveNotificationTargetFor,
128
130
  T as runNotificationTarget
129
131
  };
@@ -9,7 +9,7 @@ const g = (o) => {
9
9
  ...t ? { timeZone: t } : {}
10
10
  }).format(new Date(o));
11
11
  };
12
- function h(o, t) {
12
+ function _(o, t) {
13
13
  const l = t.getTime() - new Date(o).getTime(), e = Math.floor(l / 6e4);
14
14
  if (e < 1) return "just now";
15
15
  if (e < 60) return `${e}m ago`;
@@ -18,7 +18,7 @@ function h(o, t) {
18
18
  const i = Math.floor(n / 24);
19
19
  return i < 7 ? `${i}d ago` : $(o);
20
20
  }
21
- function w(o) {
21
+ function h(o) {
22
22
  return o.split(/[._-]+/).filter(Boolean).map((t) => t[0].toUpperCase() + t.slice(1)).join(" ");
23
23
  }
24
24
  function T(o, t = /* @__PURE__ */ new Date()) {
@@ -29,14 +29,14 @@ function T(o, t = /* @__PURE__ */ new Date()) {
29
29
  (!n || e.id > n.id) && l.set(e.api, e);
30
30
  }
31
31
  return [...l.values()].map((e) => {
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}` : "";
32
+ var c;
33
+ const n = e.resolved_at ?? e.due_at, i = `${_(n, t)} (${g(n)})`, r = e.reason ? ` — ${f(e.reason)}` : "", u = ((c = e.label) == null ? void 0 : c.trim()) || (e.trigger === "transition" ? h(e.kind) : ""), a = u ? ` · ${u}` : "";
34
34
  let s;
35
35
  if (e.outcome === "sent") s = `told ${i}${a}`;
36
36
  else if (e.outcome === "pending") {
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}`;
37
+ const m = Math.round((t.getTime() - new Date(e.due_at).getTime()) / 6e4);
38
+ s = `sent ${i}${a}, awaiting acknowledgement (${m} min)`;
39
+ } else e.outcome === "skipped" ? s = `should have been told ${i}${a}${r}` : e.outcome === "failed" ? s = `send failed ${i}${a}${r}` : e.outcome === "missing" ? s = `never told${a}${r}` : s = `still not told${a}${r}`;
40
40
  return {
41
41
  api: e.api,
42
42
  tone: d(e.outcome),
@@ -45,7 +45,10 @@ function T(o, t = /* @__PURE__ */ new Date()) {
45
45
  outcome: e.outcome,
46
46
  submission_id: e.submission_id ?? null,
47
47
  transition_id: e.transition_id ?? null,
48
- transition_label: e.transition_label ?? null
48
+ transition_label: e.transition_label ?? null,
49
+ // An older server sends neither: keep the one button it always had.
50
+ can_resend: e.can_resend ?? !0,
51
+ can_send_current: e.can_send_current ?? !1
49
52
  };
50
53
  });
51
54
  }
@@ -1,13 +1,13 @@
1
- const o = /* @__PURE__ */ new Set(["id", "po", "req", "url", "sku", "uom", "erp", "api", "ids"]);
2
- function i(n) {
1
+ const i = /* @__PURE__ */ new Set(["id", "po", "req", "url", "sku", "uom", "erp", "api", "ids"]);
2
+ function r(n) {
3
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(" ");
4
+ return t.length === 0 ? n : t.map((e, s) => i.has(e) ? e === "ids" ? "IDs" : e.toUpperCase() : s === 0 ? e.charAt(0).toUpperCase() + e.slice(1) : e).join(" ");
5
5
  }
6
- function s(n) {
6
+ function o(n) {
7
7
  const t = String(n ?? "").trim();
8
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)))));
9
+ return e ? `this record has no ${r(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(r).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` : /^no send was ever attempted\b/.test(t) ? "nothing was sent when this changed" : t)))));
10
10
  }
11
11
  export {
12
- s as plainObligationReason
12
+ o as plainObligationReason
13
13
  };
@@ -0,0 +1,6 @@
1
+ function t(i, n, r) {
2
+ return i === n ? `-${n}` : i === `-${n}` ? r ? r === `-${n}` ? n : r : "" : n;
3
+ }
4
+ export {
5
+ t as nextSortValue
6
+ };
@@ -1,55 +1,73 @@
1
- import { normalizeRecordConditions as a, recordMatchesAll as d } from "./record-conditions.js";
2
- const m = "__none__", c = { default: "edit", rules: [] };
3
- function p(e) {
1
+ import { normalizeRecordConditions as a, recordMatchesAll as m } from "./record-conditions.js";
2
+ const d = "__none__", c = { default: "edit", rules: [] };
3
+ function _(e) {
4
4
  if (!e || typeof e != "object") return c;
5
- const o = e, s = o.default === "summary" ? "summary" : "edit", r = [];
6
- if (Array.isArray(o.rules))
7
- for (const n of o.rules) {
8
- if (!n || typeof n != "object") continue;
9
- const t = n;
10
- r.push({
11
- roles: Array.isArray(t.roles) ? t.roles.map(String) : null,
12
- states: Array.isArray(t.states) ? t.states.map(String) : null,
13
- states_op: t.states_op === "not_in" ? "not_in" : "in",
14
- conditions: a(t.conditions),
15
- mode: t.mode === "summary" ? "summary" : "edit"
5
+ const t = e, o = t.default === "summary" ? "summary" : "edit", n = [];
6
+ if (Array.isArray(t.rules))
7
+ for (const r of t.rules) {
8
+ if (!r || typeof r != "object") continue;
9
+ const s = r;
10
+ n.push({
11
+ roles: Array.isArray(s.roles) ? s.roles.map(String) : null,
12
+ states: Array.isArray(s.states) ? s.states.map(String) : null,
13
+ states_op: s.states_op === "not_in" ? "not_in" : "in",
14
+ conditions: a(s.conditions),
15
+ mode: s.mode === "summary" ? "summary" : "edit"
16
16
  });
17
17
  }
18
- return { default: s, rules: r, ...o.edit_lock ? { edit_lock: o.edit_lock } : {} };
18
+ return { default: o, rules: n, ...t.edit_lock ? { edit_lock: t.edit_lock } : {} };
19
19
  }
20
- const f = (e) => !!(e != null && e.rules.some((o) => {
21
- var s;
22
- return (((s = o.roles) == null ? void 0 : s.length) ?? 0) > 0;
23
- })), A = (e) => !!(e != null && e.rules.some((o) => {
24
- var s;
25
- return (((s = o.states) == null ? void 0 : s.length) ?? 0) > 0;
26
- })), R = (e) => !!(e != null && e.rules.some((o) => {
27
- var s;
28
- return (((s = o.conditions) == null ? void 0 : s.length) ?? 0) > 0;
20
+ const S = (e) => !!(e != null && e.rules.some((t) => {
21
+ var o;
22
+ return (((o = t.roles) == null ? void 0 : o.length) ?? 0) > 0;
23
+ })), p = (e) => !!(e != null && e.rules.some((t) => {
24
+ var o;
25
+ return (((o = t.states) == null ? void 0 : o.length) ?? 0) > 0;
26
+ })), R = (e) => !!(e != null && e.rules.some((t) => {
27
+ var o;
28
+ return (((o = t.conditions) == null ? void 0 : o.length) ?? 0) > 0;
29
29
  }));
30
- function S(e, o) {
31
- var n;
32
- if (o.isNew || !e) return "edit";
33
- const s = o.role ? o.role.toLowerCase() : null, r = o.stateKey ?? m;
34
- for (const t of e.rules) {
35
- const l = t.roles ?? [];
36
- if (l.length > 0 && (!s || !l.some((i) => i.toLowerCase() === s))) continue;
37
- const u = t.states ?? [];
30
+ function A(e, t) {
31
+ var r;
32
+ if (t.isNew || !e) return "edit";
33
+ const o = t.role ? t.role.toLowerCase() : null, n = t.stateKey ?? d;
34
+ for (const s of e.rules) {
35
+ const l = s.roles ?? [];
36
+ if (l.length > 0 && (!o || !l.some((i) => i.toLowerCase() === o))) continue;
37
+ const u = s.states ?? [];
38
38
  if (u.length > 0) {
39
- const i = u.includes(r);
40
- if (!(t.states_op === "not_in" ? !i : i)) continue;
39
+ const i = u.includes(n);
40
+ if (!(s.states_op === "not_in" ? !i : i)) continue;
41
41
  }
42
- if (!((((n = t.conditions) == null ? void 0 : n.length) ?? 0) > 0 && (!o.record || !d(o.record, t.conditions))))
43
- return t.mode;
42
+ if (!((((r = s.conditions) == null ? void 0 : r.length) ?? 0) > 0 && (!t.record || !m(t.record, s.conditions))))
43
+ return s.mode;
44
44
  }
45
45
  return e.default;
46
46
  }
47
+ function h(e, t, o) {
48
+ return JSON.stringify([e, t ?? null, o ? o.toLowerCase() : null]);
49
+ }
50
+ function N(e, t) {
51
+ if (!e) return !1;
52
+ try {
53
+ const o = JSON.parse(e);
54
+ return Array.isArray(o) && o[0] === t;
55
+ } catch {
56
+ return !1;
57
+ }
58
+ }
59
+ function M(e) {
60
+ return !e.first && (e.unsaved || e.lineDrafts > 0);
61
+ }
47
62
  export {
48
63
  c as EMPTY_SUMMARY_RULES,
49
- m as NO_STATE,
50
- p as normalizeSummaryModeRules,
51
- S as resolveSummaryMode,
64
+ d as NO_STATE,
65
+ M as holdSummaryReresolve,
66
+ _ as normalizeSummaryModeRules,
67
+ A as resolveSummaryMode,
68
+ N as sameSummaryRecord,
69
+ h as summaryResolveSignature,
52
70
  R as summaryRulesNeedRecord,
53
- f as summaryRulesNeedRole,
54
- A as summaryRulesNeedState
71
+ S as summaryRulesNeedRole,
72
+ p as summaryRulesNeedState
55
73
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nivaro/react",
3
- "version": "0.3.64",
3
+ "version": "0.3.65",
4
4
  "description": "React hooks and components for Nivaro CMS forms",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",