1
- import cn from 'classnames/bind'
2
1
import PropTypes from 'prop-types'
3
2
import React , { PureComponent } from 'react'
4
3
@@ -7,9 +6,7 @@ import Actions from './actions'
7
6
import NodeLabel from './node-label'
8
7
import Toggle from './toggle'
9
8
10
- import styles from './index.css'
11
-
12
- const cx = cn . bind ( styles )
9
+ import './index.css'
13
10
14
11
const isLeaf = children => isEmpty ( children )
15
12
@@ -30,22 +27,22 @@ const getNodeCx = props => {
30
27
_focused : focused ,
31
28
} = props
32
29
33
- return cx (
30
+ return [
34
31
'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 ( ' ' )
49
46
}
50
47
51
48
class TreeNode extends PureComponent {
0 commit comments