@nivaro/react 0.3.61 → 0.3.63

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.
@@ -1,36 +1,39 @@
1
- import { jsx as n, jsxs as o } from "react/jsx-runtime";
1
+ import { jsx as u, jsxs as i } from "react/jsx-runtime";
2
2
  import { ArrowLeft as a } from "lucide-react";
3
3
  import { useNavigation as s } from "../../context.js";
4
- const r = "nvr:queue-return", u = 360 * 60 * 1e3;
5
- function i() {
4
+ const r = "nvr:queue-return", c = 360 * 60 * 1e3;
5
+ function l() {
6
6
  try {
7
7
  const t = sessionStorage.getItem(r);
8
8
  if (!t) return null;
9
9
  const e = JSON.parse(t);
10
- return !e || typeof e != "object" || !e.path || Date.now() - Number(e.at ?? 0) > u ? null : e;
10
+ return !e || typeof e != "object" || !e.path || Date.now() - Number(e.at ?? 0) > c ? null : e;
11
11
  } catch {
12
12
  return null;
13
13
  }
14
14
  }
15
- function c(t) {
15
+ function f(t) {
16
16
  try {
17
17
  t ? sessionStorage.setItem(r, JSON.stringify(t)) : sessionStorage.removeItem(r);
18
18
  } catch {
19
19
  }
20
20
  }
21
- function f() {
22
- const t = s(), e = i();
23
- return e ? /* @__PURE__ */ n("div", { className: "flex items-center", "data-queue-return": e.queue_id, children: /* @__PURE__ */ o(
21
+ function v(t, e, n, o) {
22
+ return t.queue_id !== e ? !1 : t.restore || t.entry && n && t.entry === n ? !0 : o;
23
+ }
24
+ function x() {
25
+ const t = s(), e = l();
26
+ return e ? /* @__PURE__ */ u("div", { className: "flex items-center", "data-queue-return": e.queue_id, children: /* @__PURE__ */ i(
24
27
  "button",
25
28
  {
26
29
  type: "button",
27
30
  onClick: () => {
28
- c({ ...e, restore: !0 }), t.navigate(e.path);
31
+ f({ ...e, restore: !0 }), t.navigate(e.path);
29
32
  },
30
33
  className: "inline-flex items-center gap-1.5 rounded-full border border-slate-200 bg-white px-2.5 py-1 text-[11.5px] font-medium text-slate-600 transition-colors hover:border-nvr-cyan/50 hover:text-nvr-navy dark:border-border dark:bg-card dark:text-slate-300 dark:hover:text-nvr-cyan",
31
34
  "data-tip": "Return to the queue with its filters and scroll position",
32
35
  children: [
33
- /* @__PURE__ */ n(a, { className: "h-3.5 w-3.5" }),
36
+ /* @__PURE__ */ u(a, { className: "h-3.5 w-3.5" }),
34
37
  "Back to ",
35
38
  e.name
36
39
  ]
@@ -39,7 +42,8 @@ function f() {
39
42
  }
40
43
  export {
41
44
  r as QUEUE_RETURN_KEY,
42
- f as QueueReturnChip,
43
- i as readQueueReturn,
44
- c as writeQueueReturn
45
+ x as QueueReturnChip,
46
+ v as queueReturnApplies,
47
+ l as readQueueReturn,
48
+ f as writeQueueReturn
45
49
  };
@@ -1,4 +1,4 @@
1
- import { m2aWriteMeta as C } from "./M2MCombobox.js";
1
+ import { m2aWriteMeta as x } from "./M2MCombobox.js";
2
2
  function F(n, l, s) {
3
3
  var r;
4
4
  let e = l.find((o) => o.one_collection === n && o.one_field === s);
@@ -13,14 +13,14 @@ function F(n, l, s) {
13
13
  if (!c) return null;
14
14
  const d = l.find(
15
15
  (o) => o.many_collection === e.many_collection && o.many_field === c && o.id !== e.id
16
- ), _ = C(d);
16
+ ), _ = x(d);
17
17
  return { field: e.one_field, junctionField: c, m2aCollection: (_ == null ? void 0 : _.value) ?? null };
18
18
  }
19
- function O(n) {
19
+ function L(n) {
20
20
  return n == null || n === "" ? [] : Array.isArray(n) ? n : typeof n == "object" ? [] : [n];
21
21
  }
22
- const b = (n) => n && typeof n == "object" ? `${String(n.collection ?? "")}:${String(n.id ?? "")}` : `:${String(n)}`;
23
- function E(n) {
22
+ const C = (n) => n && typeof n == "object" ? `${String(n.collection ?? "").toLowerCase()}:${String(n.id ?? "").toLowerCase()}` : `:${String(n).toLowerCase()}`;
23
+ function A(n) {
24
24
  var i;
25
25
  const { collection: l, relations: s, links: e, unlinks: c, payload: d, isNew: _ } = n, r = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set([...e.keys(), ...c.keys()]);
26
26
  for (const f of o) {
@@ -32,38 +32,38 @@ function E(n) {
32
32
  if (_) {
33
33
  if (y.size > 0) continue;
34
34
  const t = [], m = /* @__PURE__ */ new Set();
35
- for (const a of [...O(d[u.field]), ...g.map(p)]) {
36
- const S = b(a);
35
+ for (const a of [...L(d[u.field]), ...g.map(p)]) {
36
+ const S = C(a);
37
37
  m.has(S) || (m.add(S), t.push(a));
38
38
  }
39
39
  d[u.field] = t, r.add(f);
40
40
  continue;
41
41
  }
42
- const h = (i = n.committed) == null ? void 0 : i.call(n, f);
43
- let w = [];
42
+ const w = (i = n.committed) == null ? void 0 : i.call(n, f);
43
+ let h = [];
44
44
  if (y.size > 0) {
45
- if (!h) continue;
46
- const t = new Map(h.map((a) => [String(a.id), a])), m = [...y].map((a) => {
45
+ if (!w) continue;
46
+ const t = new Map(w.map((a) => [String(a.id), a])), m = [...y].map((a) => {
47
47
  var S;
48
48
  return (S = t.get(String(a))) == null ? void 0 : S[u.junctionField];
49
49
  });
50
50
  if (m.some((a) => a == null)) continue;
51
- w = m.map(p);
51
+ h = m.map(p);
52
52
  }
53
- const x = (h ?? []).filter((t) => !y.has(t.id) && !y.has(String(t.id))).map((t) => t[u.junctionField]).filter((t) => t != null), k = [], j = /* @__PURE__ */ new Set();
54
- for (const t of [...x.map(p), ...g.map(p)]) {
55
- const m = b(t);
53
+ const b = (w ?? []).filter((t) => !y.has(t.id) && !y.has(String(t.id))).map((t) => t[u.junctionField]).filter((t) => t != null), k = [], j = /* @__PURE__ */ new Set();
54
+ for (const t of [...b.map(p), ...g.map(p)]) {
55
+ const m = C(t);
56
56
  j.has(m) || (j.add(m), k.push(t));
57
57
  }
58
58
  d[u.field] = {
59
59
  ...k.length ? { create: k } : {},
60
- ...w.length ? { delete: w } : {}
60
+ ...h.length ? { delete: h } : {}
61
61
  }, r.add(f);
62
62
  }
63
63
  return r;
64
64
  }
65
- const z = 500;
66
- function W(n) {
65
+ const O = 500;
66
+ function E(n) {
67
67
  var s;
68
68
  const l = /* @__PURE__ */ new Set();
69
69
  for (const [e, c] of n.rows) {
@@ -73,7 +73,7 @@ function W(n) {
73
73
  const _ = e.slice(0, d), r = e.slice(d + 1), o = n.relations.find(
74
74
  (i) => i.one_collection === n.collection && i.many_collection === _ && i.many_field === r && !!i.one_field && i.junction_field == null
75
75
  );
76
- o != null && o.one_field && (c.length > z || c.some((i) => Object.keys(i).some((f) => f.startsWith("__o2m_"))) || (n.payload[o.one_field] = c.map((i) => {
76
+ o != null && o.one_field && (c.length > O || c.some((i) => Object.keys(i).some((f) => f.startsWith("__o2m_"))) || (n.payload[o.one_field] = c.map((i) => {
77
77
  const { id: f, ...g } = i;
78
78
  return g;
79
79
  }), l.add(e)));
@@ -81,6 +81,6 @@ function W(n) {
81
81
  return l;
82
82
  }
83
83
  export {
84
- E as foldStagedLinks,
85
- W as foldStagedRows
84
+ A as foldStagedLinks,
85
+ E as foldStagedRows
86
86
  };