diff --git a/src/main/resources/assets/admin/common/js/ui/selector/list/ListSelectionController.ts b/src/main/resources/assets/admin/common/js/ui/selector/list/ListSelectionController.ts index 37d1b0e78..b28600a88 100644 --- a/src/main/resources/assets/admin/common/js/ui/selector/list/ListSelectionController.ts +++ b/src/main/resources/assets/admin/common/js/ui/selector/list/ListSelectionController.ts @@ -47,6 +47,7 @@ export class ListSelectionController if (this.isChecked() || this.isPartial()) { this.selectableListBox.deselectAll(); } else { + this.selectableListBox.setSelectionMode(SelectionMode.SELECT); this.selectableListBox.selectAll(); } } diff --git a/src/main/resources/assets/admin/common/js/ui/selector/list/SelectableListBoxWrapper.ts b/src/main/resources/assets/admin/common/js/ui/selector/list/SelectableListBoxWrapper.ts index 59901bfd8..f8337b37c 100644 --- a/src/main/resources/assets/admin/common/js/ui/selector/list/SelectableListBoxWrapper.ts +++ b/src/main/resources/assets/admin/common/js/ui/selector/list/SelectableListBoxWrapper.ts @@ -131,12 +131,7 @@ export class SelectableListBoxWrapper const itemId = this.listBox.getIdOfItem(item); const actualItem = this.listBox.getItem(itemId) || item; // making sure we work with actual list item value - if (!this.isMultiSelect() || this.selectionMode === SelectionMode.HIGHLIGHT) { // unselect all other items - this.getCurrentlySelectedItems().filter((selectedItem) => this.listBox.getIdOfItem(selectedItem) !== itemId).forEach( - (selectedItem: I) => { - this.handleUserDeselected(selectedItem); - }); - } + this.unSelectOtherItems(itemId); if (this.isSelected(itemId)) { this.handleUserDeselected(actualItem); @@ -145,6 +140,15 @@ export class SelectableListBoxWrapper } } + private unSelectOtherItems(itemId: string): void { + if (!this.isMultiSelect() || this.selectionMode === SelectionMode.HIGHLIGHT) { // unselect all other items + this.getCurrentlySelectedItems().filter((selectedItem) => this.listBox.getIdOfItem(selectedItem) !== itemId).forEach( + (selectedItem: I) => { + this.handleUserDeselected(selectedItem); + }); + } + } + protected getCurrentlySelectedItems(): I[] { return Array.from(this.selectedItems.values()); }