@nivaro/react 0.3.61 → 0.3.62
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/hooks/useSessionRecorder.js +1 -1
- package/dist/shared/components/CollectionBrowserView.js +259 -259
- package/dist/shared/components/ItemEditForm.js +3576 -3561
- package/dist/shared/components/import/reimportDiff.js +67 -46
- package/dist/shared/components/item-edit/QueueReturnChip.js +17 -13
- package/dist/shared/components/item-edit/staged-links.js +21 -21
- package/dist/shared/components/queue/QueueWorklist.js +224 -222
- package/dist/shared/lib/list-page-memory.js +40 -32
- package/package.json +1 -1
|
@@ -1,71 +1,92 @@
|
|
|
1
|
-
const
|
|
2
|
-
function
|
|
1
|
+
const k = "__o2m_";
|
|
2
|
+
function f(n) {
|
|
3
3
|
return String(n ?? "").trim();
|
|
4
4
|
}
|
|
5
|
-
function
|
|
6
|
-
const
|
|
7
|
-
if (
|
|
8
|
-
const o = Number(
|
|
9
|
-
if (Number.isFinite(o) && Number.isFinite(
|
|
10
|
-
return o ===
|
|
5
|
+
function w(n, i) {
|
|
6
|
+
const e = f(n), r = f(i);
|
|
7
|
+
if (e !== "" && r !== "") {
|
|
8
|
+
const o = Number(e), s = Number(r);
|
|
9
|
+
if (Number.isFinite(o) && Number.isFinite(s))
|
|
10
|
+
return o === s;
|
|
11
11
|
}
|
|
12
|
-
return
|
|
12
|
+
return e === r;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
15
|
-
const i =
|
|
14
|
+
function S(n) {
|
|
15
|
+
const i = f(n);
|
|
16
16
|
if (i !== "") {
|
|
17
|
-
const
|
|
18
|
-
if (Number.isFinite(
|
|
17
|
+
const e = Number(i);
|
|
18
|
+
if (Number.isFinite(e)) return String(e);
|
|
19
19
|
}
|
|
20
20
|
return i;
|
|
21
21
|
}
|
|
22
|
-
function
|
|
23
|
-
return i.map((
|
|
22
|
+
function d(n, i) {
|
|
23
|
+
return i.map((e) => S(n[e])).join("\0");
|
|
24
24
|
}
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
const N = d;
|
|
26
|
+
function _(n, i, e, r) {
|
|
27
|
+
if (r.size === 0 || e.length === 0) return [];
|
|
28
|
+
const o = new Set(n.map((c) => d(c, e))), s = [];
|
|
29
|
+
for (const c of i) {
|
|
30
|
+
const a = String(c.id);
|
|
31
|
+
r.has(a) && o.has(d(c, e)) && s.push(a);
|
|
32
|
+
}
|
|
33
|
+
return s;
|
|
34
|
+
}
|
|
35
|
+
function E(n) {
|
|
36
|
+
const { headerDirty: i, pendingRows: e, pendingEdits: r, pendingDeletes: o, restored: s } = n;
|
|
37
|
+
if (!(i || e > 0 || r > 0 || o > 0)) return null;
|
|
38
|
+
const a = ["Your unsaved changes on this record stay in place; the file is applied on top."];
|
|
39
|
+
return s > 0 && a.push(
|
|
40
|
+
s === 1 ? "One line you removed is still in the file, so it comes back." : `${s} lines you removed are still in the file, so they come back.`
|
|
41
|
+
), a.join(" ");
|
|
42
|
+
}
|
|
43
|
+
function v(n, i, e) {
|
|
44
|
+
if (e.lines === "replace")
|
|
27
45
|
return {
|
|
28
|
-
creates: n.map((
|
|
46
|
+
creates: n.map((t) => ({ ...t })),
|
|
29
47
|
updates: [],
|
|
30
|
-
deletes: i.map((
|
|
48
|
+
deletes: i.map((t) => String(t.id)),
|
|
31
49
|
matchedUnchanged: 0
|
|
32
50
|
};
|
|
33
|
-
if (
|
|
51
|
+
if (e.lines === "append")
|
|
34
52
|
return {
|
|
35
|
-
creates: n.map((
|
|
53
|
+
creates: n.map((t) => ({ ...t })),
|
|
36
54
|
updates: [],
|
|
37
55
|
deletes: [],
|
|
38
56
|
matchedUnchanged: 0
|
|
39
57
|
};
|
|
40
|
-
const
|
|
41
|
-
for (const
|
|
42
|
-
const
|
|
43
|
-
if (
|
|
44
|
-
throw new Error(`Duplicate match key among existing lines: ${
|
|
45
|
-
|
|
58
|
+
const r = /* @__PURE__ */ new Map();
|
|
59
|
+
for (const t of i) {
|
|
60
|
+
const u = d(t, e.match_by);
|
|
61
|
+
if (r.has(u))
|
|
62
|
+
throw new Error(`Duplicate match key among existing lines: ${u}`);
|
|
63
|
+
r.set(u, t);
|
|
46
64
|
}
|
|
47
|
-
const o = /* @__PURE__ */ new Set(),
|
|
48
|
-
let
|
|
49
|
-
for (const
|
|
50
|
-
const
|
|
51
|
-
if (o.has(
|
|
52
|
-
throw new Error(`Duplicate match key: ${
|
|
53
|
-
o.add(
|
|
54
|
-
const
|
|
55
|
-
if (!
|
|
56
|
-
|
|
65
|
+
const o = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), c = [], a = [];
|
|
66
|
+
let p = 0;
|
|
67
|
+
for (const t of n) {
|
|
68
|
+
const u = d(t, e.match_by);
|
|
69
|
+
if (o.has(u))
|
|
70
|
+
throw new Error(`Duplicate match key: ${u}`);
|
|
71
|
+
o.add(u);
|
|
72
|
+
const m = r.get(u);
|
|
73
|
+
if (!m) {
|
|
74
|
+
c.push({ ...t });
|
|
57
75
|
continue;
|
|
58
76
|
}
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
const
|
|
62
|
-
for (const [
|
|
63
|
-
|
|
64
|
-
Object.keys(
|
|
77
|
+
const g = String(m.id);
|
|
78
|
+
s.add(g);
|
|
79
|
+
const l = {};
|
|
80
|
+
for (const [h, y] of Object.entries(t))
|
|
81
|
+
h.startsWith(k) || w(y, m[h]) || (l[h] = y);
|
|
82
|
+
Object.keys(l).length > 0 ? a.push({ id: g, changes: l }) : p += 1;
|
|
65
83
|
}
|
|
66
|
-
const
|
|
67
|
-
return { creates:
|
|
84
|
+
const b = e.lines === "upsert_delete" ? i.map((t) => String(t.id)).filter((t) => !s.has(t)) : [];
|
|
85
|
+
return { creates: c, updates: a, deletes: b, matchedUnchanged: p };
|
|
68
86
|
}
|
|
69
87
|
export {
|
|
70
|
-
|
|
88
|
+
v as diffReimportLines,
|
|
89
|
+
N as reimportMatchKey,
|
|
90
|
+
E as reimportPendingNotice,
|
|
91
|
+
_ as reimportRestoredDeletes
|
|
71
92
|
};
|
|
@@ -1,36 +1,39 @@
|
|
|
1
|
-
import { jsx as
|
|
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",
|
|
5
|
-
function
|
|
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) >
|
|
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
|
|
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
|
|
22
|
-
|
|
23
|
-
|
|
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
|
-
|
|
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__ */
|
|
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
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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
|
|
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
|
-
), _ =
|
|
16
|
+
), _ = x(d);
|
|
17
17
|
return { field: e.one_field, junctionField: c, m2aCollection: (_ == null ? void 0 : _.value) ?? null };
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function L(n) {
|
|
20
20
|
return n == null || n === "" ? [] : Array.isArray(n) ? n : typeof n == "object" ? [] : [n];
|
|
21
21
|
}
|
|
22
|
-
const
|
|
23
|
-
function
|
|
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 [...
|
|
36
|
-
const S =
|
|
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
|
|
43
|
-
let
|
|
42
|
+
const w = (i = n.committed) == null ? void 0 : i.call(n, f);
|
|
43
|
+
let h = [];
|
|
44
44
|
if (y.size > 0) {
|
|
45
|
-
if (!
|
|
46
|
-
const t = new Map(
|
|
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
|
-
|
|
51
|
+
h = m.map(p);
|
|
52
52
|
}
|
|
53
|
-
const
|
|
54
|
-
for (const t of [...
|
|
55
|
-
const m =
|
|
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
|
-
...
|
|
60
|
+
...h.length ? { delete: h } : {}
|
|
61
61
|
}, r.add(f);
|
|
62
62
|
}
|
|
63
63
|
return r;
|
|
64
64
|
}
|
|
65
|
-
const
|
|
66
|
-
function
|
|
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 >
|
|
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
|
-
|
|
85
|
-
|
|
84
|
+
A as foldStagedLinks,
|
|
85
|
+
E as foldStagedRows
|
|
86
86
|
};
|