@topconsultnpm/sdkui-react-beta 6.11.38 → 6.11.39
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.
|
@@ -24,22 +24,24 @@ const TMTreeDropDown = (props) => {
|
|
|
24
24
|
};
|
|
25
25
|
// Synchronizes the selection in the TreeView when the dropdown value changes
|
|
26
26
|
const syncTreeViewSelection = useCallback((e) => {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
setTimeout(() => {
|
|
28
|
+
const treeView = (e.component.selectItem && e.component) || (treeViewRef.current && treeViewRef.current.instance());
|
|
29
|
+
if (treeView) {
|
|
30
|
+
// If the value is null, unselect all items in the tree view
|
|
31
|
+
if (e.value === null) {
|
|
32
|
+
treeView.unselectAll();
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
// Otherwise, select the items corresponding to the selected values
|
|
36
|
+
const treeValues = e.value || values;
|
|
37
|
+
treeValues && treeValues.forEach((value) => { treeView.selectItem(value); });
|
|
38
|
+
}
|
|
32
39
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
treeValues && treeValues.forEach((value) => { treeView.selectItem(value); });
|
|
40
|
+
// Update the selected values in the state if the event contains a value
|
|
41
|
+
if (e.value !== undefined) {
|
|
42
|
+
setValues(e.value);
|
|
37
43
|
}
|
|
38
|
-
}
|
|
39
|
-
// Update the selected values in the state if the event contains a value
|
|
40
|
-
if (e.value !== undefined) {
|
|
41
|
-
setValues(e.value);
|
|
42
|
-
}
|
|
44
|
+
});
|
|
43
45
|
}, [values]); // Dependency on 'values' state to update selection
|
|
44
46
|
// Event handler for when item selection changes in the TreeView
|
|
45
47
|
const treeViewItemSelectionChanged = useCallback((e) => {
|