@@ -47,16 +47,8 @@ export default class TransferPanel extends Component {
47
47
dragValue : null ,
48
48
dragOverValue : null ,
49
49
} ;
50
- this . footerId = props . baseId
51
- ? htmlId . escapeForId (
52
- `${ props . baseId } -panel-footer-${ props . position } `
53
- )
54
- : '' ;
55
- this . headerId = props . baseId
56
- ? htmlId . escapeForId (
57
- `${ props . baseId } -panel-header-${ props . position } `
58
- )
59
- : '' ;
50
+ this . footerId = props . baseId ? htmlId . escapeForId ( `${ props . baseId } -panel-footer-${ props . position } ` ) : '' ;
51
+ this . headerId = props . baseId ? htmlId . escapeForId ( `${ props . baseId } -panel-header-${ props . position } ` ) : '' ;
60
52
61
53
bindCtx ( this , [
62
54
'handleCheck' ,
@@ -76,10 +68,7 @@ export default class TransferPanel extends Component {
76
68
}
77
69
78
70
componentDidUpdate ( prevProps ) {
79
- if (
80
- prevProps . dataSource . length !== this . props . dataSource . length &&
81
- this . list
82
- ) {
71
+ if ( prevProps . dataSource . length !== this . props . dataSource . length && this . list ) {
83
72
if ( this . list . scrollTop > 0 ) {
84
73
this . list . scrollTop = 0 ;
85
74
}
@@ -93,16 +82,7 @@ export default class TransferPanel extends Component {
93
82
}
94
83
95
84
getListData ( dataSource , disableHighlight ) {
96
- const {
97
- prefix,
98
- position,
99
- mode,
100
- value,
101
- onMove,
102
- disabled,
103
- itemRender,
104
- sortable,
105
- } = this . props ;
85
+ const { prefix, position, mode, value, onMove, disabled, itemRender, sortable } = this . props ;
106
86
const { dragPosition, dragValue, dragOverValue } = this . state ;
107
87
return dataSource . map ( item => {
108
88
const others =
@@ -122,9 +102,7 @@ export default class TransferPanel extends Component {
122
102
item = { item }
123
103
onCheck = { this . handleCheck }
124
104
onClick = { onMove }
125
- needHighlight = {
126
- ! this . firstRender && ! this . searched && ! disableHighlight
127
- }
105
+ needHighlight = { ! this . firstRender && ! this . searched && ! disableHighlight }
128
106
itemRender = { itemRender }
129
107
draggable = { sortable }
130
108
onDragStart = { this . handleItemDragStart }
@@ -209,10 +187,7 @@ export default class TransferPanel extends Component {
209
187
const { title, prefix } = this . props ;
210
188
211
189
return (
212
- < div
213
- id = { this . headerId }
214
- className = { `${ prefix } transfer-panel-header` }
215
- >
190
+ < div id = { this . headerId } className = { `${ prefix } transfer-panel-header` } >
216
191
{ title }
217
192
</ div >
218
193
) ;
@@ -232,13 +207,7 @@ export default class TransferPanel extends Component {
232
207
}
233
208
234
209
renderList ( dataSource ) {
235
- const {
236
- prefix,
237
- listClassName,
238
- listStyle,
239
- customerList,
240
- useVirtual,
241
- } = this . props ;
210
+ const { prefix, listClassName, listStyle, customerList, useVirtual } = this . props ;
242
211
const newClassName = cx ( {
243
212
[ `${ prefix } transfer-panel-list` ] : true ,
244
213
[ listClassName ] : ! ! listClassName ,
@@ -247,11 +216,7 @@ export default class TransferPanel extends Component {
247
216
const customerPanel = customerList && customerList ( this . props ) ;
248
217
if ( customerPanel ) {
249
218
return (
250
- < div
251
- className = { newClassName }
252
- style = { listStyle }
253
- ref = { this . getListDOM }
254
- >
219
+ < div className = { newClassName } style = { listStyle } ref = { this . getListDOM } >
255
220
{ customerPanel }
256
221
</ div >
257
222
) ;
@@ -267,10 +232,7 @@ export default class TransferPanel extends Component {
267
232
268
233
if ( useVirtual ) {
269
234
return (
270
- < div
271
- className = { newClassName }
272
- style = { { position : 'relative' , ...listStyle } }
273
- >
235
+ < div className = { newClassName } style = { { position : 'relative' , ...listStyle } } >
274
236
< VirtualList
275
237
itemsRenderer = { ( items , ref ) => (
276
238
< Menu style = { { border : 'none' } } ref = { ref } >
@@ -285,11 +247,7 @@ export default class TransferPanel extends Component {
285
247
}
286
248
287
249
return (
288
- < Menu
289
- className = { newClassName }
290
- style = { listStyle }
291
- ref = { this . getListDOM }
292
- >
250
+ < Menu className = { newClassName } style = { listStyle } ref = { this . getListDOM } >
293
251
{ this . getListData ( dataSource ) }
294
252
</ Menu >
295
253
) ;
@@ -300,22 +258,13 @@ export default class TransferPanel extends Component {
300
258
301
259
return (
302
260
< div className = { `${ prefix } transfer-panel-not-found-container` } >
303
- < div className = { `${ prefix } transfer-panel-not-found` } >
304
- { notFoundContent }
305
- </ div >
261
+ < div className = { `${ prefix } transfer-panel-not-found` } > { notFoundContent } </ div >
306
262
</ div >
307
263
) ;
308
264
}
309
265
310
266
renderFooter ( ) {
311
- const {
312
- prefix,
313
- position,
314
- mode,
315
- disabled,
316
- locale,
317
- showCheckAll,
318
- } = this . props ;
267
+ const { prefix, position, mode, disabled, locale, showCheckAll } = this . props ;
319
268
if ( mode === 'simple' ) {
320
269
const { onMoveAll } = this . props ;
321
270
const classNames = cx ( {
@@ -324,13 +273,7 @@ export default class TransferPanel extends Component {
324
273
} ) ;
325
274
return (
326
275
< div className = { `${ prefix } transfer-panel-footer` } >
327
- < a
328
- className = { classNames }
329
- onClick = { onMoveAll . bind (
330
- this ,
331
- position === 'left' ? 'right' : 'left'
332
- ) }
333
- >
276
+ < a className = { classNames } onClick = { onMoveAll . bind ( this , position === 'left' ? 'right' : 'left' ) } >
334
277
{ locale . moveAll }
335
278
</ a >
336
279
</ div >
@@ -342,13 +285,9 @@ export default class TransferPanel extends Component {
342
285
const totalCount = dataSource . length ;
343
286
const totalEnabledCount = this . enabledDatasource . length ;
344
287
const checked = checkedCount > 0 && checkedCount >= totalEnabledCount ;
345
- const indeterminate =
346
- checkedCount > 0 && checkedCount < totalEnabledCount ;
288
+ const indeterminate = checkedCount > 0 && checkedCount < totalEnabledCount ;
347
289
const items = totalCount > 1 ? locale . items : locale . item ;
348
- const countLabel =
349
- checkedCount === 0
350
- ? `${ totalCount } ${ items } `
351
- : `${ checkedCount } /${ totalCount } ${ items } ` ;
290
+ const countLabel = checkedCount === 0 ? `${ totalCount } ${ items } ` : `${ checkedCount } /${ totalCount } ${ items } ` ;
352
291
353
292
return (
354
293
< div className = { `${ prefix } transfer-panel-footer` } >
@@ -361,10 +300,7 @@ export default class TransferPanel extends Component {
361
300
aria-labelledby = { this . footerId }
362
301
/>
363
302
) }
364
- < span
365
- className = { `${ prefix } transfer-panel-count` }
366
- id = { this . footerId }
367
- >
303
+ < span className = { `${ prefix } transfer-panel-count` } id = { this . footerId } >
368
304
{ countLabel }
369
305
</ span >
370
306
</ div >
0 commit comments