@nivaro/react 0.3.81 → 0.3.82
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,56 +1,60 @@
|
|
|
1
|
-
import { useRef as
|
|
1
|
+
import { useRef as l, useEffect as f, useCallback as d, createContext as h, useContext as m } from "react";
|
|
2
2
|
import { toast as C } from "sonner";
|
|
3
|
-
const p =
|
|
4
|
-
function
|
|
5
|
-
const e = [...new Set(
|
|
3
|
+
const p = h(null), v = () => m(p);
|
|
4
|
+
function S(t) {
|
|
5
|
+
const e = [...new Set(t.filter(Boolean))];
|
|
6
6
|
return e.length <= 1 ? e[0] ?? "" : `${e.slice(0, -1).join(", ")} and ${e[e.length - 1]}`;
|
|
7
7
|
}
|
|
8
|
-
function T(
|
|
9
|
-
const r =
|
|
8
|
+
function T(t, e) {
|
|
9
|
+
const r = S(t);
|
|
10
10
|
return e ? `${r} cleared — not available for the ${e} you picked` : `${r} cleared — no longer available for what you picked`;
|
|
11
11
|
}
|
|
12
|
-
function
|
|
13
|
-
const r = new Set(
|
|
14
|
-
return o.length === 0 ? null : o.reduce((
|
|
12
|
+
function w(t, e) {
|
|
13
|
+
const r = new Set(t.map((n) => n.field)), o = [...new Set(t.flatMap((n) => n.parents))].filter((n) => !r.has(n));
|
|
14
|
+
return o.length === 0 ? null : o.reduce((n, c) => e(c) > e(n) ? c : n, o[0]);
|
|
15
15
|
}
|
|
16
|
-
const
|
|
17
|
-
function
|
|
18
|
-
const e =
|
|
19
|
-
e.current =
|
|
20
|
-
const r =
|
|
16
|
+
const g = 4e3, x = 500, k = "nvr-cascade-clear";
|
|
17
|
+
function A(t) {
|
|
18
|
+
const e = l(t);
|
|
19
|
+
e.current = t;
|
|
20
|
+
const r = l([]), o = l(0), n = l(null);
|
|
21
21
|
return f(
|
|
22
22
|
() => () => {
|
|
23
|
-
|
|
23
|
+
n.current && clearTimeout(n.current);
|
|
24
24
|
},
|
|
25
25
|
[]
|
|
26
26
|
), d((c) => {
|
|
27
|
-
const
|
|
28
|
-
|
|
27
|
+
const u = Date.now();
|
|
28
|
+
u - o.current > g && (r.current = []), o.current = u, r.current.some((a) => a.field === c.field) || r.current.push(c), n.current && clearTimeout(n.current), n.current = setTimeout(() => {
|
|
29
29
|
const a = r.current;
|
|
30
30
|
if (a.length === 0) return;
|
|
31
|
-
const
|
|
31
|
+
const s = w(a, e.current.editSeq);
|
|
32
32
|
C.info(
|
|
33
33
|
T(
|
|
34
34
|
a.map((i) => i.label),
|
|
35
|
-
|
|
35
|
+
s ? e.current.labelOf(s) : null
|
|
36
36
|
),
|
|
37
37
|
{
|
|
38
|
-
id:
|
|
38
|
+
id: k,
|
|
39
39
|
description: "Pick them again from the narrowed lists."
|
|
40
40
|
}
|
|
41
41
|
);
|
|
42
|
-
},
|
|
42
|
+
}, x);
|
|
43
43
|
}, []);
|
|
44
44
|
}
|
|
45
|
-
function
|
|
46
|
-
return r.crossFill > 0 || r.notPerson > 0 ? !1 : (
|
|
45
|
+
function E(t, e, r) {
|
|
46
|
+
return r.crossFill > 0 || r.notPerson > 0 ? !1 : (t.touched.add(e), t.seq.set(e, t.next()), !0);
|
|
47
|
+
}
|
|
48
|
+
function N(t, e) {
|
|
49
|
+
e.leftWorkStaged || t.clear();
|
|
47
50
|
}
|
|
48
51
|
export {
|
|
49
52
|
p as CascadeClearNoticeContext,
|
|
50
53
|
T as cascadeClearText,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
N as
|
|
55
|
-
|
|
54
|
+
w as cascadeRootParent,
|
|
55
|
+
S as joinLabels,
|
|
56
|
+
E as notePersonLinkEdit,
|
|
57
|
+
N as settleTouchedAfterSave,
|
|
58
|
+
A as useCascadeClearNotices,
|
|
59
|
+
v as useCascadeClearNotifier
|
|
56
60
|
};
|