@nivaro/react 0.3.122 → 0.3.124
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/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +10 -0
- package/dist/shared/components/CollectionBrowserView.js +93 -91
- package/dist/shared/components/DataTable.js +240 -228
- package/dist/shared/components/ItemEditForm.js +2712 -2696
- package/dist/shared/components/RecordReadView.js +1 -1
- package/dist/shared/components/TipLayer.js +86 -63
- package/dist/shared/components/integrations/IntegrationDots.js +1 -0
- package/dist/shared/components/item-edit/HeaderRollupExplainer.js +156 -119
- package/dist/shared/components/item-edit/InlineGridField.js +1 -1
- package/dist/shared/components/item-edit/M2MCombobox.js +387 -376
- package/dist/shared/components/item-edit/RichTextEditorImpl.js +154 -179
- package/dist/shared/components/item-edit/UserChip.js +248 -232
- package/dist/shared/components/item-edit/cascade-clear-notice.js +49 -41
- package/dist/shared/components/item-edit/staged-links.js +38 -37
- package/dist/shared/components/panels/PipelinePanel.js +252 -243
- package/dist/shared/components/panels/RevisionsPanel.js +1788 -662
- package/dist/shared/components/panels/revision-changes.js +229 -0
- package/dist/shared/components/panels/revision-table-parts.js +448 -0
- package/dist/shared/lib/activity-sentence.js +74 -68
- package/dist/shared/lib/editorjs.js +68 -0
- package/dist/shared/lib/error-hints.js +1 -1
- package/dist/shared/lib/revision-prefs.js +81 -0
- package/dist/shared/lib/xlsx-lite.js +125 -0
- package/package.json +1 -1
|
@@ -1,60 +1,68 @@
|
|
|
1
|
-
import { useRef as
|
|
2
|
-
import { toast as
|
|
3
|
-
const p = h(null),
|
|
4
|
-
function
|
|
5
|
-
const
|
|
6
|
-
return
|
|
7
|
-
}
|
|
8
|
-
function
|
|
9
|
-
const r =
|
|
10
|
-
return
|
|
11
|
-
}
|
|
12
|
-
function
|
|
13
|
-
const r = new Set(
|
|
14
|
-
return
|
|
15
|
-
}
|
|
16
|
-
const
|
|
17
|
-
function
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
const r =
|
|
1
|
+
import { useRef as s, useEffect as f, useCallback as d, createContext as h, useContext as C } from "react";
|
|
2
|
+
import { toast as m } from "sonner";
|
|
3
|
+
const p = h(null), $ = () => C(p);
|
|
4
|
+
function k(e) {
|
|
5
|
+
const t = [...new Set(e.filter(Boolean))];
|
|
6
|
+
return t.length <= 1 ? t[0] ?? "" : `${t.slice(0, -1).join(", ")} and ${t[t.length - 1]}`;
|
|
7
|
+
}
|
|
8
|
+
function g(e, t) {
|
|
9
|
+
const r = k(e);
|
|
10
|
+
return t ? `${r} cleared — not available for the ${t} you picked` : `${r} cleared — no longer available for what you picked`;
|
|
11
|
+
}
|
|
12
|
+
function S(e, t) {
|
|
13
|
+
const r = new Set(e.map((n) => n.field)), c = [...new Set(e.flatMap((n) => n.parents))].filter((n) => !r.has(n));
|
|
14
|
+
return c.length === 0 ? null : c.reduce((n, o) => t(o) > t(n) ? o : n, c[0]);
|
|
15
|
+
}
|
|
16
|
+
const T = 4e3, w = 500, P = "nvr-cascade-clear";
|
|
17
|
+
function M(e) {
|
|
18
|
+
const t = s(e);
|
|
19
|
+
t.current = e;
|
|
20
|
+
const r = s([]), c = s(0), n = s(null);
|
|
21
21
|
return f(
|
|
22
22
|
() => () => {
|
|
23
23
|
n.current && clearTimeout(n.current);
|
|
24
24
|
},
|
|
25
25
|
[]
|
|
26
|
-
), d((
|
|
27
|
-
const
|
|
28
|
-
|
|
26
|
+
), d((o) => {
|
|
27
|
+
const i = Date.now();
|
|
28
|
+
i - c.current > T && (r.current = []), c.current = i, r.current.some((a) => a.field === o.field) || r.current.push(o), n.current && clearTimeout(n.current), n.current = setTimeout(() => {
|
|
29
29
|
const a = r.current;
|
|
30
30
|
if (a.length === 0) return;
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
a.map((
|
|
35
|
-
|
|
31
|
+
const u = S(a, t.current.editSeq);
|
|
32
|
+
m.info(
|
|
33
|
+
g(
|
|
34
|
+
a.map((l) => l.label),
|
|
35
|
+
u ? t.current.labelOf(u) : null
|
|
36
36
|
),
|
|
37
37
|
{
|
|
38
|
-
id:
|
|
38
|
+
id: P,
|
|
39
39
|
description: "Pick them again from the narrowed lists."
|
|
40
40
|
}
|
|
41
41
|
);
|
|
42
|
-
},
|
|
42
|
+
}, w);
|
|
43
43
|
}, []);
|
|
44
44
|
}
|
|
45
|
-
function
|
|
46
|
-
return r.crossFill > 0 || r.notPerson > 0 ? !1 : (
|
|
45
|
+
function v(e, t, r) {
|
|
46
|
+
return r.crossFill > 0 || r.notPerson > 0 ? !1 : (e.touched.add(t), e.seq.set(t, e.next()), !0);
|
|
47
|
+
}
|
|
48
|
+
function A(e, t) {
|
|
49
|
+
t.leftWorkStaged || e.clear();
|
|
50
|
+
}
|
|
51
|
+
function E(e) {
|
|
52
|
+
return `Pick a ${e}`;
|
|
47
53
|
}
|
|
48
|
-
function N(
|
|
49
|
-
e
|
|
54
|
+
function N(e) {
|
|
55
|
+
return typeof e == "string" && e.startsWith("Pick a ");
|
|
50
56
|
}
|
|
51
57
|
export {
|
|
52
58
|
p as CascadeClearNoticeContext,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
S as
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
59
|
+
g as cascadeClearText,
|
|
60
|
+
E as cascadePickMessage,
|
|
61
|
+
S as cascadeRootParent,
|
|
62
|
+
N as isCascadePickMessage,
|
|
63
|
+
k as joinLabels,
|
|
64
|
+
v as notePersonLinkEdit,
|
|
65
|
+
A as settleTouchedAfterSave,
|
|
66
|
+
M as useCascadeClearNotices,
|
|
67
|
+
$ as useCascadeClearNotifier
|
|
60
68
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { m2aWriteMeta as
|
|
2
|
-
function
|
|
1
|
+
import { m2aWriteMeta as E, parseM2aToken as L } from "./M2MCombobox.js";
|
|
2
|
+
function O(n, r, a) {
|
|
3
3
|
var _;
|
|
4
4
|
let e = r.find((t) => t.one_collection === n && t.one_field === a);
|
|
5
5
|
if (!e && a.includes(".")) {
|
|
@@ -13,7 +13,7 @@ function L(n, r, a) {
|
|
|
13
13
|
if (!s) return null;
|
|
14
14
|
const u = r.find(
|
|
15
15
|
(t) => t.many_collection === e.many_collection && t.many_field === s && t.id !== e.id
|
|
16
|
-
), d =
|
|
16
|
+
), d = E(u);
|
|
17
17
|
return {
|
|
18
18
|
field: e.one_field,
|
|
19
19
|
junctionField: s,
|
|
@@ -21,64 +21,65 @@ function L(n, r, a) {
|
|
|
21
21
|
m2aField: (d == null ? void 0 : d.field) ?? null
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
-
function
|
|
24
|
+
function z(n) {
|
|
25
25
|
return n == null || n === "" ? [] : Array.isArray(n) ? n : typeof n == "object" ? [] : [n];
|
|
26
26
|
}
|
|
27
|
-
const
|
|
28
|
-
function
|
|
27
|
+
const S = (n) => n && typeof n == "object" ? `${String(n.collection ?? "").toLowerCase()}:${String(n.id ?? "").toLowerCase()}` : `:${String(n).toLowerCase()}`;
|
|
28
|
+
function W(n) {
|
|
29
29
|
var i;
|
|
30
30
|
const { collection: r, relations: a, links: e, unlinks: s, payload: u, isNew: d } = n, _ = /* @__PURE__ */ new Set(), t = /* @__PURE__ */ new Set([...e.keys(), ...s.keys()]);
|
|
31
31
|
for (const m of t) {
|
|
32
|
-
const g = e.get(m) ?? [],
|
|
33
|
-
if (g.length === 0 &&
|
|
34
|
-
const f =
|
|
32
|
+
const g = e.get(m) ?? [], w = s.get(m) ?? /* @__PURE__ */ new Set();
|
|
33
|
+
if (g.length === 0 && w.size === 0) continue;
|
|
34
|
+
const f = O(r, a, m);
|
|
35
35
|
if (!f) continue;
|
|
36
|
-
const
|
|
36
|
+
const p = (o) => {
|
|
37
37
|
if (!f.m2aCollection) return o;
|
|
38
|
-
const l =
|
|
38
|
+
const l = L(o);
|
|
39
39
|
return l ? { collection: l.collection, id: l.id } : { collection: f.m2aCollection, id: o };
|
|
40
|
-
},
|
|
40
|
+
}, j = (o) => {
|
|
41
41
|
const l = o[f.junctionField];
|
|
42
42
|
if (l == null) return null;
|
|
43
43
|
if (!f.m2aCollection) return l;
|
|
44
|
-
const
|
|
45
|
-
return typeof
|
|
44
|
+
const y = f.m2aField ? o[f.m2aField] : null;
|
|
45
|
+
return typeof y == "string" && y ? { collection: y, id: l } : null;
|
|
46
46
|
};
|
|
47
47
|
if (d) {
|
|
48
|
-
if (
|
|
48
|
+
if (w.size > 0) continue;
|
|
49
49
|
const o = [], l = /* @__PURE__ */ new Set();
|
|
50
|
-
for (const
|
|
51
|
-
const
|
|
52
|
-
l.has(
|
|
50
|
+
for (const y of [...z(u[f.field]), ...g.map(p)]) {
|
|
51
|
+
const c = S(y);
|
|
52
|
+
l.has(c) || (l.add(c), o.push(y));
|
|
53
53
|
}
|
|
54
54
|
u[f.field] = o, _.add(m);
|
|
55
55
|
continue;
|
|
56
56
|
}
|
|
57
|
-
const
|
|
58
|
-
let
|
|
59
|
-
if (
|
|
60
|
-
if (!
|
|
61
|
-
const o = new Map(
|
|
62
|
-
const
|
|
63
|
-
return
|
|
57
|
+
const h = (i = n.committed) == null ? void 0 : i.call(n, m);
|
|
58
|
+
let k = [];
|
|
59
|
+
if (w.size > 0) {
|
|
60
|
+
if (!h) continue;
|
|
61
|
+
const o = new Map(h.map((c) => [String(c.id), c])), l = [...w].map((c) => {
|
|
62
|
+
const b = o.get(String(c));
|
|
63
|
+
return b ? j(b) : null;
|
|
64
64
|
});
|
|
65
65
|
if (l.some((c) => c == null)) continue;
|
|
66
|
-
|
|
66
|
+
const y = new Set(g.map((c) => S(p(c))));
|
|
67
|
+
k = l.filter((c) => !y.has(S(c)));
|
|
67
68
|
}
|
|
68
|
-
const
|
|
69
|
-
for (const o of [...
|
|
70
|
-
const l =
|
|
71
|
-
|
|
69
|
+
const x = (h ?? []).filter((o) => !w.has(o.id) && !w.has(String(o.id))).map(j).filter((o) => o != null), C = [], F = /* @__PURE__ */ new Set();
|
|
70
|
+
for (const o of [...x, ...g.map(p)]) {
|
|
71
|
+
const l = S(o);
|
|
72
|
+
F.has(l) || (F.add(l), C.push(o));
|
|
72
73
|
}
|
|
73
74
|
u[f.field] = {
|
|
74
|
-
...
|
|
75
|
-
...
|
|
75
|
+
...C.length ? { create: C } : {},
|
|
76
|
+
...k.length ? { delete: k } : {}
|
|
76
77
|
}, _.add(m);
|
|
77
78
|
}
|
|
78
79
|
return _;
|
|
79
80
|
}
|
|
80
|
-
const
|
|
81
|
-
function
|
|
81
|
+
const A = 500;
|
|
82
|
+
function $(n) {
|
|
82
83
|
var a;
|
|
83
84
|
const r = /* @__PURE__ */ new Set();
|
|
84
85
|
for (const [e, s] of n.rows) {
|
|
@@ -88,7 +89,7 @@ function W(n) {
|
|
|
88
89
|
const d = e.slice(0, u), _ = e.slice(u + 1), t = n.relations.find(
|
|
89
90
|
(i) => i.one_collection === n.collection && i.many_collection === d && i.many_field === _ && !!i.one_field && i.junction_field == null
|
|
90
91
|
);
|
|
91
|
-
t != null && t.one_field && (s.length >
|
|
92
|
+
t != null && t.one_field && (s.length > A || s.some((i) => Object.keys(i).some((m) => m.startsWith("__o2m_"))) || (n.payload[t.one_field] = s.map((i) => {
|
|
92
93
|
const { id: m, ...g } = i;
|
|
93
94
|
return g;
|
|
94
95
|
}), r.add(e)));
|
|
@@ -96,6 +97,6 @@ function W(n) {
|
|
|
96
97
|
return r;
|
|
97
98
|
}
|
|
98
99
|
export {
|
|
99
|
-
|
|
100
|
-
|
|
100
|
+
W as foldStagedLinks,
|
|
101
|
+
$ as foldStagedRows
|
|
101
102
|
};
|