diff --git a/src/components/autocomplete/AutoComplete.vue b/src/components/autocomplete/AutoComplete.vue index 7b3a38923..0c4677dc9 100755 --- a/src/components/autocomplete/AutoComplete.vue +++ b/src/components/autocomplete/AutoComplete.vue @@ -10,7 +10,7 @@ {{getOptionLabel(option)}} - +
  • 0) { - this.focusedMultipleOptionIndex = this.focusedMultipleOptionIndex < 1 ? 0 : this.focusedMultipleOptionIndex - 1; - } + this.focusedMultipleOptionIndex = this.focusedMultipleOptionIndex < 1 ? 0 : this.focusedMultipleOptionIndex - 1; }, onArrowRightKeyOnMultiple() { - if (!ObjectUtils.isNotEmpty(this.inputText) && this.modelValue && this.modelValue.length > 0) { - this.focusedMultipleOptionIndex++; + this.focusedMultipleOptionIndex++; - if (this.focusedMultipleOptionIndex > (this.modelValue.length - 1)) { - this.focusedMultipleOptionIndex = -1; - this.$refs.focusInput.focus(); - } - } - else { + if (this.focusedMultipleOptionIndex > (this.modelValue.length - 1)) { + this.focusedMultipleOptionIndex = -1; this.$refs.focusInput.focus(); } }, onBackspaceKeyOnMultiple(event) { if (this.focusedMultipleOptionIndex !== -1) { - this.removeOption(event, this.modelValue[this.focusedMultipleOptionIndex], this.focusedMultipleOptionIndex); + this.removeOption(event, this.focusedMultipleOptionIndex); } }, onOverlayEnter(el) { @@ -752,9 +750,9 @@ export default { this.searching = true; this.$emit('complete', { originalEvent: event, query }); }, - removeOption(event, option, index) { + removeOption(event, index) { const removedOption = this.modelValue[index]; - const value = this.modelValue.filter(val => !ObjectUtils.equals(val, this.getOptionValue(option), this.equalityKey)).map(option => this.getOptionValue(option)); + const value = this.modelValue.filter((_, i) => i !== index).map(option => this.getOptionValue(option)); this.updateModel(event, value); this.$emit('item-unselect', { originalEvent: event, value: removedOption }); @@ -792,8 +790,6 @@ export default { updateModel(event, value) { this.$emit('update:modelValue', value); this.$emit('change', { originalEvent: event, value }); - - this.inputText = null; }, flatOptions(options) { return (options || []).reduce((result, option, index) => {