This repository was archived by the owner on Jan 19, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
api-editor/gui/src/features/packageData/treeView Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change 9
9
HeatMapMode ,
10
10
selectHeatMapMode ,
11
11
selectIsExpandedInTreeView ,
12
+ setAllCollapsedInTreeView ,
12
13
toggleIsExpandedInTreeView ,
13
14
} from '../../ui/uiSlice' ;
14
15
import { VisibilityIndicator } from './VisibilityIndicator' ;
@@ -60,16 +61,24 @@ export const TreeNode: React.FC<TreeNodeProps> = function ({
60
61
61
62
const fontWeight = filter . shouldKeepDeclaration ( declaration , annotations , usages ) ? 'bold' : undefined ;
62
63
64
+ const toggleExpanded = ( ) => {
65
+ if ( showChildren ) {
66
+ dispatch ( setAllCollapsedInTreeView ( [ ...declaration . descendantsOrSelf ( ) ] . map ( ( d ) => d . id ) ) ) ;
67
+ } else {
68
+ dispatch ( toggleIsExpandedInTreeView ( declaration . id ) ) ;
69
+ }
70
+ } ;
71
+
63
72
const handleNodeClick = ( event : MouseEvent ) => {
64
73
if ( event . shiftKey ) {
65
- dispatch ( toggleIsExpandedInTreeView ( declaration . id ) ) ;
74
+ toggleExpanded ( ) ;
66
75
} else {
67
76
navigate ( `/${ declaration . id } ` ) ;
68
77
}
69
78
} ;
70
79
71
80
const handleVisibilityIndicatorClick = ( event : MouseEvent ) => {
72
- dispatch ( toggleIsExpandedInTreeView ( declaration . id ) ) ;
81
+ toggleExpanded ( ) ;
73
82
event . stopPropagation ( ) ;
74
83
} ;
75
84
You can’t perform that action at this time.
0 commit comments