playbook_ui 12.26.0.pre.alpha.alphafix812 → 12.26.0.pre.alpha.multiselectfixes795
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_multi_level_select/_helper_functions.tsx +16 -0
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +4 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_default.jsx +727 -61
- data/dist/playbook-rails.js +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24795b41021899f723ab47809e4987e826064828a5d04c4c6632f41e209e568b
|
4
|
+
data.tar.gz: 5ea835ee66ecfcb7c757d3210bda91b4fc934df28c645351ced49d81a67c8e36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e84b9df359d0ea6233755ce067b1941b1496d4f2604de1aa5c817b46dff1e1b1010279cadb899c0dfdb0094ae85ef955dd3dd73e2743b82a1c1dec70c390592
|
7
|
+
data.tar.gz: 1f51d591dd29ea949f2c2d67d081d16dfe6d3a12203041f7aea5558a9a98c9fc0b126e92cf4424b1e96c9174f1e618c3192d7726d0586d33d7805c96208e3b7a
|
@@ -210,3 +210,19 @@ export const removeChildrenIfParentChecked = (
|
|
210
210
|
);
|
211
211
|
setDefaultReturn([...filteredDefaultArray, items]);
|
212
212
|
};
|
213
|
+
|
214
|
+
export const areAllCheckedFalse = (data:any) => {
|
215
|
+
for (const item of data) {
|
216
|
+
if (item.checked !== false) {
|
217
|
+
return false; // Return false if any item is not checked: false
|
218
|
+
}
|
219
|
+
|
220
|
+
if (Array.isArray(item.children && item.children.length > 0)) {
|
221
|
+
if (!areAllCheckedFalse(item.children)) {
|
222
|
+
return false; // Return false if any nested item is not checked: false
|
223
|
+
}
|
224
|
+
}
|
225
|
+
}
|
226
|
+
|
227
|
+
return true; // Return true if all items are checked: false
|
228
|
+
};
|
@@ -18,6 +18,7 @@ import {
|
|
18
18
|
recursiveReturnOnlyParent,
|
19
19
|
removeChildrenIfParentChecked,
|
20
20
|
getChildIds,
|
21
|
+
areAllCheckedFalse
|
21
22
|
} from "./_helper_functions";
|
22
23
|
|
23
24
|
type MultiLevelSelectProps = {
|
@@ -94,8 +95,11 @@ const MultiLevelSelect = (props: MultiLevelSelectProps) => {
|
|
94
95
|
};
|
95
96
|
//if any items already checked in first render, set return accordingly
|
96
97
|
const initialChecked = getCheckedItems(treeData)
|
98
|
+
const initialUnchecked = areAllCheckedFalse(treeData)
|
97
99
|
initialChecked && returnAllSelected && setReturnedArray(initialChecked)
|
98
100
|
initialChecked && !returnAllSelected && setDefaultReturn(initialChecked)
|
101
|
+
initialUnchecked && returnAllSelected && setReturnedArray([])
|
102
|
+
initialUnchecked && !returnAllSelected && setDefaultReturn([])
|
99
103
|
|
100
104
|
// Attach the event listener
|
101
105
|
window.addEventListener("click", handleClickOutside);
|