Add toggleItemSelection callback
authorMichal Klobukowski <michal.klobukowski@contractors.roche.com>
Thu, 11 Oct 2018 16:09:45 +0000 (18:09 +0200)
committerMichal Klobukowski <michal.klobukowski@contractors.roche.com>
Thu, 11 Oct 2018 16:09:45 +0000 (18:09 +0200)
Feature #13862

Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski@contractors.roche.com>

src/views-components/projects-tree-picker/generic-projects-tree-picker.tsx
src/views-components/projects-tree-picker/projects-tree-picker.tsx

index 21839ff51e7d2e9c792ec93312ca7a6bd2fd26fe..77f831fafd10432fc1ec86513b1f9fa23cbdb646 100644 (file)
@@ -63,8 +63,11 @@ const mapDispatchToProps = (dispatch: Dispatch, { loadRootItem, includeCollectio
             dispatch(treePickerActions.TOGGLE_TREE_PICKER_NODE_COLLAPSE({ id, pickerId }));
         }
     },
-    toggleItemSelection: (_, { id }, pickerId) => {
-        dispatch<any>(treePickerActions.TOGGLE_TREE_PICKER_NODE_SELECTION({ id, pickerId }));
+    toggleItemSelection: (event, item, pickerId) => {
+        dispatch<any>(treePickerActions.TOGGLE_TREE_PICKER_NODE_SELECTION({ id: item.id, pickerId }));
+        if(props.toggleItemSelection){
+            props.toggleItemSelection(event, item, pickerId);
+        }
     },
 });
 
index 5d6bb78c7df4b69fc84c62303c0c1e459e9d13de..ba29be82c275cd37573f0056e33f9462f9bf86f1 100644 (file)
@@ -16,6 +16,7 @@ export interface ProjectsTreePickerProps {
     includeFiles?: boolean;
     showSelection?: boolean;
     toggleItemActive?: (event: React.MouseEvent<HTMLElement>, item: TreeItem<ProjectsTreePickerItem>, pickerId: string) => void;
+    toggleItemSelection?: (event: React.MouseEvent<HTMLElement>, item: TreeItem<ProjectsTreePickerItem>, pickerId: string) => void;
 }
 
 export const ProjectsTreePicker = ({ pickerId, ...props }: ProjectsTreePickerProps) => {