@@ -24,9 +24,10 @@ class SortChildren extends Component {
24
24
} // end constrcutor
25
25
26
26
setLocalArray = ( ) => {
27
- const localArray = this . props . focusComponent . childrenArray . map ( ( child , idx ) => {
28
- return { childId : child . childId , childSort : child . childSort } ;
29
- } ) ;
27
+ const localArray = this . props . focusComponent . childrenArray . map ( ( child , idx ) => ( {
28
+ childId : child . childId ,
29
+ childSort : child . childSort ,
30
+ } ) ) ;
30
31
return localArray ;
31
32
} ;
32
33
@@ -62,11 +63,12 @@ class SortChildren extends Component {
62
63
// put back the dragge item after the dragged Over
63
64
currentSortValues . splice ( this . state . draggedOverIndex , 0 , draggedBaby ) ;
64
65
65
- currentSortValues = currentSortValues . map ( ( child , idx ) => {
66
- return { childId : child . childId , childSort : idx + 1 } ;
67
- } ) ;
66
+ currentSortValues = currentSortValues . map ( ( child , idx ) => ( {
67
+ childId : child . childId ,
68
+ childSort : idx + 1 ,
69
+ } ) ) ;
68
70
69
- console . log ( ` currentSortValues after updating the sort ` , JSON . stringify ( currentSortValues ) ) ;
71
+ console . log ( ' currentSortValues after updating the sort ' , JSON . stringify ( currentSortValues ) ) ;
70
72
71
73
this . props . updateChildrenSort ( { newSortValues : currentSortValues } ) ;
72
74
@@ -89,25 +91,23 @@ class SortChildren extends Component {
89
91
lineHeight : 1 ,
90
92
cursor : 'move' ,
91
93
} ;
92
- //const children = this.props.focusComponent.childrenArray;
94
+ // const children = this.props.focusComponent.childrenArray;
93
95
// const List = children
94
96
const List = cloneDeep ( this . props . focusComponent . childrenArray )
95
97
. sort ( ( a , b ) => a . childSort - b . childSort )
96
- . map ( ( child , idx ) => {
97
- return (
98
- < li style = { liStyle } id = { child . childId } key = { idx } >
99
- < div
100
- className = "drag"
101
- draggable
102
- onDragStart = { e => this . onDragStart ( e , idx ) }
103
- onDragOver = { e => this . onDragOver ( idx ) }
104
- onDragEnd = { e => this . onDragEnd ( ) }
105
- >
106
- { child . componentName + child . childId }
107
- </ div >
108
- </ li >
109
- ) ;
110
- } ) ;
98
+ . map ( ( child , idx ) => (
99
+ < li style = { liStyle } id = { child . childId } key = { idx } >
100
+ < div
101
+ className = "drag"
102
+ draggable
103
+ onDragStart = { e => this . onDragStart ( e , idx ) }
104
+ onDragOver = { e => this . onDragOver ( idx ) }
105
+ onDragEnd = { e => this . onDragEnd ( ) }
106
+ >
107
+ { child . componentName + child . childId }
108
+ </ div >
109
+ </ li >
110
+ ) ) ;
111
111
return (
112
112
< div
113
113
style = { {
@@ -122,21 +122,19 @@ class SortChildren extends Component {
122
122
< ul style = { ulStyle } >
123
123
{ cloneDeep ( this . props . focusComponent . childrenArray )
124
124
. sort ( ( a , b ) => a . childSort - b . childSort )
125
- . map ( ( child , idx ) => {
126
- return (
127
- < li style = { liStyle } id = { child . childId } key = { idx } >
128
- < div
129
- className = "drag"
130
- draggable
131
- onDragStart = { e => this . onDragStart ( e , idx ) }
132
- onDragOver = { e => this . onDragOver ( idx ) }
133
- onDragEnd = { e => this . onDragEnd ( ) }
134
- >
135
- { child . componentName + child . childId }
136
- </ div >
137
- </ li >
138
- ) ;
139
- } ) }
125
+ . map ( ( child , idx ) => (
126
+ < li style = { liStyle } id = { child . childId } key = { idx } >
127
+ < div
128
+ className = "drag"
129
+ draggable
130
+ onDragStart = { e => this . onDragStart ( e , idx ) }
131
+ onDragOver = { e => this . onDragOver ( idx ) }
132
+ onDragEnd = { e => this . onDragEnd ( ) }
133
+ >
134
+ { child . componentName + child . childId }
135
+ </ div >
136
+ </ li >
137
+ ) ) }
140
138
141
139
{ /* {List} */ }
142
140
</ ul >
0 commit comments