@snack-uikit/tree 0.9.5 → 0.9.6-preview-ce317cd6.0
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/cjs/helpers.js +5 -4
- package/dist/esm/helpers.js +5 -4
- package/package.json +2 -2
- package/src/helpers.ts +5 -5
package/dist/cjs/helpers.js
CHANGED
|
@@ -71,15 +71,16 @@ function lookupTreeForSelectedNodes(_ref) {
|
|
|
71
71
|
while (parent) {
|
|
72
72
|
if ((_a = parent.nested) === null || _a === void 0 ? void 0 : _a.length) {
|
|
73
73
|
const parentNestedSelection = checkNestedNodesSelection(parent.nested, updatedSelectedNodes);
|
|
74
|
+
const parentId = parent.id;
|
|
74
75
|
if (isSelected) {
|
|
75
|
-
if (parentNestedSelection.allSelected
|
|
76
|
-
const parentIdIndex = updatedSelectedNodes.
|
|
76
|
+
if (!parentNestedSelection.allSelected) {
|
|
77
|
+
const parentIdIndex = updatedSelectedNodes.indexOf(parentId);
|
|
77
78
|
if (parentIdIndex > -1) {
|
|
78
79
|
updatedSelectedNodes.splice(parentIdIndex, 1);
|
|
79
80
|
}
|
|
80
81
|
}
|
|
81
|
-
} else if (
|
|
82
|
-
updatedSelectedNodes.push(
|
|
82
|
+
} else if (parentNestedSelection.allSelected) {
|
|
83
|
+
updatedSelectedNodes.push(parentId);
|
|
83
84
|
}
|
|
84
85
|
}
|
|
85
86
|
parent = parent.parentNode;
|
package/dist/esm/helpers.js
CHANGED
|
@@ -59,16 +59,17 @@ export function lookupTreeForSelectedNodes({ node, selectedNodes, parentNode, })
|
|
|
59
59
|
while (parent) {
|
|
60
60
|
if ((_a = parent.nested) === null || _a === void 0 ? void 0 : _a.length) {
|
|
61
61
|
const parentNestedSelection = checkNestedNodesSelection(parent.nested, updatedSelectedNodes);
|
|
62
|
+
const parentId = parent.id;
|
|
62
63
|
if (isSelected) {
|
|
63
|
-
if (parentNestedSelection.allSelected
|
|
64
|
-
const parentIdIndex = updatedSelectedNodes.
|
|
64
|
+
if (!parentNestedSelection.allSelected) {
|
|
65
|
+
const parentIdIndex = updatedSelectedNodes.indexOf(parentId);
|
|
65
66
|
if (parentIdIndex > -1) {
|
|
66
67
|
updatedSelectedNodes.splice(parentIdIndex, 1);
|
|
67
68
|
}
|
|
68
69
|
}
|
|
69
70
|
}
|
|
70
|
-
else if (
|
|
71
|
-
updatedSelectedNodes.push(
|
|
71
|
+
else if (parentNestedSelection.allSelected) {
|
|
72
|
+
updatedSelectedNodes.push(parentId);
|
|
72
73
|
}
|
|
73
74
|
}
|
|
74
75
|
parent = parent.parentNode;
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
6
|
"title": "Tree",
|
|
7
|
-
"version": "0.9.
|
|
7
|
+
"version": "0.9.6-preview-ce317cd6.0",
|
|
8
8
|
"sideEffects": [
|
|
9
9
|
"*.css",
|
|
10
10
|
"*.woff",
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"react-transition-state": "2.1.1",
|
|
48
48
|
"uncontrollable": "8.0.4"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "f9c3c17c82847579589b329cd6f22c62fd82dd78"
|
|
51
51
|
}
|
package/src/helpers.ts
CHANGED
|
@@ -85,17 +85,17 @@ export function lookupTreeForSelectedNodes({
|
|
|
85
85
|
while (parent) {
|
|
86
86
|
if (parent.nested?.length) {
|
|
87
87
|
const parentNestedSelection = checkNestedNodesSelection(parent.nested, updatedSelectedNodes);
|
|
88
|
+
const parentId = parent.id;
|
|
88
89
|
|
|
89
90
|
if (isSelected) {
|
|
90
|
-
if (parentNestedSelection.allSelected
|
|
91
|
-
const parentIdIndex = updatedSelectedNodes.
|
|
92
|
-
|
|
91
|
+
if (!parentNestedSelection.allSelected) {
|
|
92
|
+
const parentIdIndex = updatedSelectedNodes.indexOf(parentId);
|
|
93
93
|
if (parentIdIndex > -1) {
|
|
94
94
|
updatedSelectedNodes.splice(parentIdIndex, 1);
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
|
-
} else if (
|
|
98
|
-
updatedSelectedNodes.push(
|
|
97
|
+
} else if (parentNestedSelection.allSelected) {
|
|
98
|
+
updatedSelectedNodes.push(parentId);
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
|