1
1
import React from 'react' ;
2
- import ReactDOMServer from 'react-dom/server' ;
3
2
import classNames from 'classnames' ;
4
3
5
4
const renderer = ( node , treeOptions ) => {
@@ -9,7 +8,7 @@ const renderer = (node, treeOptions) => {
9
8
const childrenLength = Object . keys ( children ) . length ;
10
9
const more = node . hasChildren ( ) ;
11
10
12
- return ReactDOMServer . renderToString (
11
+ return (
13
12
< div
14
13
className = { classNames (
15
14
'infinite-tree-item' ,
@@ -28,31 +27,21 @@ const renderer = (node, treeOptions) => {
28
27
className = "infinite-tree-node"
29
28
style = { { marginLeft : depth * 18 } }
30
29
>
31
- < a
32
- className = { ( ( ) => {
33
- if ( ! more && loadOnDemand ) {
34
- return classNames ( treeOptions . togglerClass , 'infinite-tree-closed' ) ;
35
- }
36
- if ( more && open ) {
37
- return classNames ( treeOptions . togglerClass ) ;
38
- }
39
- if ( more && ! open ) {
40
- return classNames ( treeOptions . togglerClass , 'infinite-tree-closed' ) ;
41
- }
42
- return '' ;
43
- } ) ( ) }
44
- >
45
- { ! more && loadOnDemand &&
30
+ { ! more && loadOnDemand &&
31
+ < a className = { classNames ( treeOptions . togglerClass , 'infinite-tree-closed' ) } >
46
32
< i className = "glyphicon glyphicon-triangle-right" />
47
- }
48
- { more && open &&
33
+ </ a >
34
+ }
35
+ { more && open &&
36
+ < a className = { classNames ( treeOptions . togglerClass ) } >
49
37
< i className = "glyphicon glyphicon-triangle-bottom" />
50
- }
51
- { more && ! open &&
38
+ </ a >
39
+ }
40
+ { more && ! open &&
41
+ < a className = { classNames ( treeOptions . togglerClass , 'infinite-tree-closed' ) } >
52
42
< i className = "glyphicon glyphicon-triangle-right" />
53
- }
54
- </ a >
55
-
43
+ </ a >
44
+ }
56
45
< i
57
46
className = { classNames (
58
47
'infinite-tree-folder-icon' ,
@@ -61,11 +50,8 @@ const renderer = (node, treeOptions) => {
61
50
{ 'glyphicon-folder-close' : more && ! open } ,
62
51
{ 'glyphicon-file' : ! more }
63
52
) }
64
- >
65
- </ i >
66
-
53
+ />
67
54
< span className = "infinite-tree-title" > { name } </ span >
68
-
69
55
< i
70
56
style = { { marginLeft : 5 } }
71
57
className = { classNames (
@@ -75,7 +61,6 @@ const renderer = (node, treeOptions) => {
75
61
{ 'rotating' : loading }
76
62
) }
77
63
/>
78
-
79
64
< span className = "count" > { childrenLength } </ span >
80
65
</ div >
81
66
</ div >
0 commit comments