@aiszlab/relax 1.2.62 → 1.2.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.
|
@@ -12,9 +12,9 @@ var useClickAway = function useClickAway(onClickAway, target) {
|
|
|
12
12
|
onClickAway(event);
|
|
13
13
|
});
|
|
14
14
|
useEffect(function () {
|
|
15
|
-
|
|
15
|
+
document.addEventListener("click", clickAway);
|
|
16
16
|
return function () {
|
|
17
|
-
|
|
17
|
+
document.removeEventListener("click", clickAway);
|
|
18
18
|
};
|
|
19
19
|
}, []);
|
|
20
20
|
};
|
|
@@ -41,13 +41,21 @@ var Tree = /*#__PURE__*/function () {
|
|
|
41
41
|
}
|
|
42
42
|
}, {
|
|
43
43
|
key: "toggleBy",
|
|
44
|
-
value: function toggleBy(key, isToggled,
|
|
44
|
+
value: function toggleBy(key, isToggled, _toggledKeys) {
|
|
45
45
|
var _classPrivateFieldGet2$1;
|
|
46
|
+
var toggledKeys = new Set(_toggledKeys);
|
|
47
|
+
// toggle current leaf
|
|
48
|
+
if (isToggled) {
|
|
49
|
+
toggledKeys.add(key);
|
|
50
|
+
} else {
|
|
51
|
+
toggledKeys["delete"](key);
|
|
52
|
+
}
|
|
46
53
|
return Array.from((_classPrivateFieldGet2$1 = _classPrivateFieldGet2(_groupedLeaves, this).get(key)) !== null && _classPrivateFieldGet2$1 !== void 0 ? _classPrivateFieldGet2$1 : []).reduce(function (prev, leaf) {
|
|
47
54
|
// deep fall, add or remove child key
|
|
55
|
+
return leaf.rise(
|
|
48
56
|
// deep rise, add or remove parent key
|
|
49
|
-
|
|
50
|
-
},
|
|
57
|
+
leaf.fall(isToggled, prev));
|
|
58
|
+
}, toggledKeys);
|
|
51
59
|
}
|
|
52
60
|
}]);
|
|
53
61
|
}();
|
|
@@ -92,17 +100,19 @@ var Leaf = /*#__PURE__*/function () {
|
|
|
92
100
|
}
|
|
93
101
|
}, {
|
|
94
102
|
key: "rise",
|
|
95
|
-
value: function rise(
|
|
96
|
-
var rised = new Set(
|
|
97
|
-
if (
|
|
98
|
-
|
|
103
|
+
value: function rise(_toggledKeys) {
|
|
104
|
+
var rised = new Set(_toggledKeys);
|
|
105
|
+
if (!_classPrivateFieldGet2(_parent, this)) return rised;
|
|
106
|
+
var isChildrenToggled = _classPrivateFieldGet2(_children, _classPrivateFieldGet2(_parent, this)).every(function (child) {
|
|
107
|
+
return rised.has(child.key);
|
|
108
|
+
});
|
|
109
|
+
if (isChildrenToggled) {
|
|
110
|
+
rised.add(_classPrivateFieldGet2(_parent, this).key);
|
|
99
111
|
} else {
|
|
100
|
-
rised["delete"](_classPrivateFieldGet2(
|
|
101
|
-
}
|
|
102
|
-
if (_classPrivateFieldGet2(_parent, this)) {
|
|
103
|
-
return _classPrivateFieldGet2(_parent, this).rise(isToggled, rised);
|
|
112
|
+
rised["delete"](_classPrivateFieldGet2(_parent, this).key);
|
|
104
113
|
}
|
|
105
|
-
|
|
114
|
+
// go on parent
|
|
115
|
+
return _classPrivateFieldGet2(_parent, this).rise(rised);
|
|
106
116
|
}
|
|
107
117
|
}, {
|
|
108
118
|
key: "fall",
|