Fixed #5435 - Autocomplete: isSelected(option) doesn't work correctly when 'multiple' is true

pull/5456/head
tugcekucukoglu 2024-03-19 11:02:12 +03:00
parent 8c3ff4c5ec
commit 37a565535e
1 changed files with 6 additions and 1 deletions

View File

@ -771,8 +771,13 @@ export default {
isValidSelectedOption(option) {
return this.isValidOption(option) && this.isSelected(option);
},
isEquals(value1, value2) {
return ObjectUtils.equals(value1, value2, this.equalityKey);
},
isSelected(option) {
return ObjectUtils.equals(this.modelValue, this.getOptionValue(option), this.equalityKey);
const optionValue = this.getOptionValue(option);
return (this.modelValue || []).some((value) => this.isEquals(value, optionValue));
},
findFirstOptionIndex() {
return this.visibleOptions.findIndex((option) => this.isValidOption(option));