1- import  cn  from  'classnames/bind' 
21import  PropTypes  from  'prop-types' 
32import  React ,  {  PureComponent  }  from  'react' 
43
@@ -7,9 +6,7 @@ import Actions from './actions'
76import  NodeLabel  from  './node-label' 
87import  Toggle  from  './toggle' 
98
10- import  styles  from  './index.css' 
11- 
12- const  cx  =  cn . bind ( styles ) 
9+ import  './index.css' 
1310
1411const  isLeaf  =  children  =>  isEmpty ( children ) 
1512
@@ -30,22 +27,22 @@ const getNodeCx = props => {
3027    _focused : focused , 
3128  }  =  props 
3229
33-   return  cx ( 
30+   return  [ 
3431    'node' , 
35-     { 
36-        leaf :  isLeaf ( _children ) , 
37-        tree :  ! isLeaf ( _children ) , 
38-       disabled , 
39-       hide , 
40-        'match-in-children'  :  keepTreeOnSearch   &&   matchInChildren , 
41-        'match-in-parent' :  keepTreeOnSearch   &&  keepChildrenOnSearch  &&  matchInParent , 
42-        partial :  showPartiallySelected   &&  partial , 
43-       readOnly , 
44-       checked , 
45-       focused , 
46-      } , 
47-     className 
48-   ) 
32+     isLeaf ( _children )   &&   'leaf' , 
33+     ! isLeaf ( _children )   &&   'tree' , 
34+     disabled   &&   'disabled' , 
35+     hide   &&   'hide' , 
36+     keepTreeOnSearch   &&   matchInChildren   &&   'match-in-children' , 
37+     keepTreeOnSearch   &&   keepChildrenOnSearch   &&   matchInParent   &&   'match-in-parent'  , 
38+     showPartiallySelected   &&  partial  &&  'partial' , 
39+     readOnly   &&  'readOnly' , 
40+     checked   &&   'checked' , 
41+     focused   &&   'focused' , 
42+     className , 
43+   ] 
44+     . filter ( Boolean ) 
45+      . join ( ' ' ) 
4946} 
5047
5148class  TreeNode  extends  PureComponent  { 
0 commit comments