@nivaro/react 0.3.60 → 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 +4236 -4213
- 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/RecordHeaderActions.js +8 -8
- package/dist/shared/components/item-edit/staged-links.js +21 -21
- package/dist/shared/components/panels/AddendumPanel.js +464 -466
- package/dist/shared/components/panels/PipelinePanel.js +391 -364
- package/dist/shared/components/panels/landing-state.js +32 -19
- package/dist/shared/components/queue/QueueWorklist.js +224 -222
- package/dist/shared/lib/list-page-memory.js +40 -32
- package/dist/shared/lib/request-gate.js +159 -144
- 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
|
};
|
|
@@ -5,16 +5,16 @@ import { useMemo as y, useState as j } from "react";
|
|
|
5
5
|
import { toast as p } from "sonner";
|
|
6
6
|
import { useNivaroClient as x } from "../../context.js";
|
|
7
7
|
import { get as A, post as v } from "../../lib/commands.js";
|
|
8
|
-
import { errorToastOptions as
|
|
9
|
-
import { userErrorMessage as
|
|
10
|
-
import { cn as
|
|
11
|
-
import { useAvailableBulkActions as
|
|
8
|
+
import { errorToastOptions as P } from "../../lib/error-toast.js";
|
|
9
|
+
import { userErrorMessage as S } from "../../lib/safe-error.js";
|
|
10
|
+
import { cn as T } from "../../lib/utils.js";
|
|
11
|
+
import { useAvailableBulkActions as B, guardMatches as D } from "../bulk/BulkActionButtons.js";
|
|
12
12
|
import { Button as k } from "../ui/button.js";
|
|
13
13
|
import { Dialog as H, DialogContent as M, DialogHeader as Q, DialogTitle as _, DialogDescription as E, DialogBody as J, DialogFooter as K } from "../ui/dialog.js";
|
|
14
14
|
import { Textarea as L } from "../ui/textarea.js";
|
|
15
15
|
import { invalidateRecordQueries as O } from "./RecordLiveSync.js";
|
|
16
16
|
function de(e, n, t, m = {}) {
|
|
17
|
-
const f = x(), h = !!n && n !== "new", { data: u } =
|
|
17
|
+
const f = x(), h = !!n && n !== "new", { data: u } = B(h ? [e] : []), a = y(
|
|
18
18
|
() => ((u == null ? void 0 : u[e]) ?? []).filter(
|
|
19
19
|
(r) => r.header === !0 && (r.kind === "update_fields" || r.kind === "transition")
|
|
20
20
|
),
|
|
@@ -32,7 +32,7 @@ function de(e, n, t, m = {}) {
|
|
|
32
32
|
fields: d.join(",")
|
|
33
33
|
})
|
|
34
34
|
).then((r) => r.data ?? {}).catch(() => ({})),
|
|
35
|
-
enabled: h && d.length > 0,
|
|
35
|
+
enabled: h && d.length > 0 && m.valuesPending !== !0,
|
|
36
36
|
staleTime: 0
|
|
37
37
|
}), c = m.fieldsLocked === !0;
|
|
38
38
|
return y(() => {
|
|
@@ -67,7 +67,7 @@ function ue({
|
|
|
67
67
|
"data-record-header-action": t.key,
|
|
68
68
|
"data-tip": W(t),
|
|
69
69
|
onClick: () => n(t),
|
|
70
|
-
className:
|
|
70
|
+
className: T(
|
|
71
71
|
"shrink-0 gap-1.5 text-[12px]",
|
|
72
72
|
t.variant === "danger" && "border-red-300 text-red-600 hover:bg-red-50 hover:text-red-700 dark:border-red-500/40 dark:text-red-400 dark:hover:bg-red-500/10"
|
|
73
73
|
),
|
|
@@ -96,7 +96,7 @@ function le({
|
|
|
96
96
|
var o;
|
|
97
97
|
(o = i.errors) != null && o.length ? p.error(i.errors[0].error) : !i.succeeded && i.skipped ? p.info(`${r.label}: nothing to change on this record`) : p.success(`${r.label} — done`), O(u, n, [t]), u.invalidateQueries({ queryKey: ["record-header-action-guard", n] }), d(""), f == null || f(), m();
|
|
98
98
|
},
|
|
99
|
-
onError: (r) => p.error(
|
|
99
|
+
onError: (r) => p.error(S(r, "The action did not run"), P(r))
|
|
100
100
|
});
|
|
101
101
|
return /* @__PURE__ */ s(
|
|
102
102
|
H,
|
|
@@ -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
|
};
|