File tree Expand file tree Collapse file tree 2 files changed +6
-27
lines changed
src/platform/plugins/shared/controls/public/controls/data_controls/options_list_control Expand file tree Collapse file tree 2 files changed +6
-27
lines changed Original file line number Diff line number Diff line change @@ -119,8 +119,9 @@ export const OptionsListPopoverActionBar = ({
119119 size = "s"
120120 isDisabled = { ! availableOptions || totalCardinality < 0 || totalCardinality > 100 }
121121 onClick = { ( ) => {
122- const availableOptionValues =
123- availableOptions ?. map ( ( { value } ) => value ) ?? [ ] ;
122+ const availableOptionValues = (
123+ availableOptions ?. map ( ( { value } ) => value ) ?? [ ]
124+ ) . filter ( ( value ) => ! selectedOptions . includes ( value ) ) ;
124125 availableOptionValues ?. forEach ( ( value : string ) => {
125126 api . makeSelection ( value , showOnlySelected ) ;
126127 } ) ;
@@ -133,7 +134,9 @@ export const OptionsListPopoverActionBar = ({
133134 size = "s"
134135 isDisabled = { totalCardinality > 100 }
135136 onClick = { ( ) => {
136- const availableOptionValues = availableOptions ?. map ( ( { value } ) => value ) ?? [ ] ;
137+ const availableOptionValues = (
138+ availableOptions ?. map ( ( { value } ) => value ) ?? [ ]
139+ ) . filter ( ( value ) => selectedOptions . includes ( value ) ) ;
137140 availableOptionValues ?. forEach ( ( value : string ) => {
138141 api . makeSelection ( value , showOnlySelected ) ;
139142 } ) ;
Original file line number Diff line number Diff line change @@ -422,30 +422,6 @@ export const getOptionsListControlFactory = (): DataControlFactory<
422422 ) ;
423423 }
424424 } ,
425- selectAll : ( keys : string [ ] , showOnlySelected : boolean ) => {
426- const field = api . field$ . getValue ( ) ;
427- if ( ! keys || ! field ) {
428- api . setBlockingError (
429- new Error ( OptionsListStrings . control . getInvalidSelectionMessage ( ) )
430- ) ;
431- return ;
432- }
433-
434- const keyAsType = keys . map ( ( key ) => getSelectionAsFieldType ( field , key ) ) ;
435- selections . internalApi . setSelectedOptions ( keyAsType ) ;
436- } ,
437- deselectAll : ( keys : string [ ] , showOnlySelected : boolean ) => {
438- const field = api . field$ . getValue ( ) ;
439- if ( ! keys || ! field ) {
440- api . setBlockingError (
441- new Error ( OptionsListStrings . control . getInvalidSelectionMessage ( ) )
442- ) ;
443- return ;
444- }
445-
446- const keyAsType = keys . map ( ( key ) => getSelectionAsFieldType ( field , key ) ) ;
447- selections . internalApi . setSelectedOptions ( keyAsType ) ;
448- } ,
449425 } ;
450426
451427 if ( selections . internalApi . hasInitialSelections ) {
You can’t perform that action at this time.
0 commit comments