@@ -10,6 +10,7 @@ class TreeNode extends React.Component {
1010 expanded : PropTypes . bool . isRequired ,
1111 label : PropTypes . string . isRequired ,
1212 optimisticToggle : PropTypes . bool . isRequired ,
13+ showNodeIcon : PropTypes . bool . isRequired ,
1314 treeId : PropTypes . string . isRequired ,
1415 value : PropTypes . string . isRequired ,
1516 onCheck : PropTypes . func . isRequired ,
@@ -64,14 +65,6 @@ class TreeNode extends React.Component {
6465 return this . props . rawChildren !== null ;
6566 }
6667
67- renderCollapseIcon ( ) {
68- if ( ! this . props . expanded ) {
69- return < span className = "rct-icon rct-icon-expand-close" /> ;
70- }
71-
72- return < span className = "rct-icon rct-icon-expand-open" /> ;
73- }
74-
7568 renderCollapseButton ( ) {
7669 if ( ! this . hasChildren ( ) ) {
7770 return (
@@ -94,6 +87,14 @@ class TreeNode extends React.Component {
9487 ) ;
9588 }
9689
90+ renderCollapseIcon ( ) {
91+ if ( ! this . props . expanded ) {
92+ return < span className = "rct-icon rct-icon-expand-close" /> ;
93+ }
94+
95+ return < span className = "rct-icon rct-icon-expand-open" /> ;
96+ }
97+
9798 renderCheckboxIcon ( ) {
9899 if ( this . props . checked === 0 ) {
99100 return < span className = "rct-icon rct-icon-uncheck" /> ;
@@ -131,7 +132,7 @@ class TreeNode extends React.Component {
131132 }
132133
133134 render ( ) {
134- const { checked, treeId, label, value } = this . props ;
135+ const { checked, treeId, label, showNodeIcon , value } = this . props ;
135136 const inputId = `${ treeId } -${ value } ` ;
136137 const nodeClass = classNames ( {
137138 'rct-node' : true ,
@@ -148,9 +149,11 @@ class TreeNode extends React.Component {
148149 < span className = "rct-checkbox" >
149150 { this . renderCheckboxIcon ( ) }
150151 </ span >
151- < span className = "rct-node-icon" >
152- { this . renderNodeIcon ( ) }
153- </ span >
152+ { showNodeIcon ? (
153+ < span className = "rct-node-icon" >
154+ { this . renderNodeIcon ( ) }
155+ </ span >
156+ ) : null }
154157 < span className = "rct-title" >
155158 { label }
156159 </ span >
0 commit comments