@@ -278,10 +278,10 @@ export default class ProjectExportsCreator extends React.Component {
278
278
}
279
279
280
280
onAnyInputChange ( statePropName , newValue ) {
281
+ this . clearSelectedDefinedExport ( ) ;
281
282
const newStateObj = { } ;
282
283
newStateObj [ statePropName ] = newValue ;
283
284
this . setState ( newStateObj ) ;
284
- this . clearSelectedDefinedExport ( ) ;
285
285
}
286
286
287
287
onSelectedExportTypeChange ( newValue ) {
@@ -290,6 +290,7 @@ export default class ProjectExportsCreator extends React.Component {
290
290
}
291
291
292
292
onSelectedRowsChange ( newRowsArray ) {
293
+ this . clearSelectedDefinedExport ( ) ;
293
294
const newSelectedRows = new Set ( ) ;
294
295
newRowsArray . forEach ( ( item ) => {
295
296
if ( item . checked ) {
@@ -301,11 +302,13 @@ export default class ProjectExportsCreator extends React.Component {
301
302
302
303
selectAllRows ( evt ) {
303
304
evt . preventDefault ( ) ;
305
+ this . clearSelectedDefinedExport ( ) ;
304
306
this . setState ( { selectedRows : new Set ( this . getAllSelectableRows ( ) ) } ) ;
305
307
}
306
308
307
309
clearSelectedRows ( evt ) {
308
310
evt . preventDefault ( ) ;
311
+ this . clearSelectedDefinedExport ( ) ;
309
312
this . setState ( { selectedRows : new Set ( ) } ) ;
310
313
}
311
314
@@ -392,7 +395,8 @@ export default class ProjectExportsCreator extends React.Component {
392
395
payload . name = this . state . customExportName || this . generateExportName ( ) ;
393
396
}
394
397
395
- // unless custom selection is enabled, we send empty fields (it means "all fields" for backend)
398
+ // unless custom selection is enabled, we send empty fields (it means "all
399
+ // fields" for backend); otherwise we send the selected rows
396
400
if ( this . state . isCustomSelectionEnabled ) {
397
401
payload . export_settings . fields = Array . from ( this . state . selectedRows ) ;
398
402
}
@@ -603,7 +607,10 @@ export default class ProjectExportsCreator extends React.Component {
603
607
/>
604
608
605
609
< bem . ProjectDownloads__textButton
606
- disabled = { ! this . state . isCustomSelectionEnabled }
610
+ disabled = { (
611
+ ! this . state . isCustomSelectionEnabled ||
612
+ this . state . selectedRows . size === this . state . selectableRowsCount
613
+ ) }
607
614
onClick = { this . selectAllRows }
608
615
>
609
616
{ t ( 'Select all' ) }
@@ -612,7 +619,10 @@ export default class ProjectExportsCreator extends React.Component {
612
619
< span className = 'project-downloads__vr' />
613
620
614
621
< bem . ProjectDownloads__textButton
615
- disabled = { ! this . state . isCustomSelectionEnabled }
622
+ disabled = { (
623
+ ! this . state . isCustomSelectionEnabled ||
624
+ this . state . selectedRows . size === 0
625
+ ) }
616
626
onClick = { this . clearSelectedRows }
617
627
>
618
628
{ t ( 'Deselect all' ) }
0 commit comments