Commit 427b869297e36780c062ebd9a5e6e672bffc4ac8
Committed by
GitHub
Merge pull request #3747 from SergioCrisostomo/select-patches
Select fixes
Showing
2 changed files
with
13 additions
and
2 deletions
Show diff stats
src/components/select/option.vue
src/components/select/select.vue
... | ... | @@ -411,7 +411,7 @@ |
411 | 411 | clearSingleSelect(){ // PUBLIC API |
412 | 412 | this.$emit('on-clear'); |
413 | 413 | this.hideMenu(); |
414 | - if (this.clearable) this.values = []; | |
414 | + if (this.clearable) this.reset(); | |
415 | 415 | }, |
416 | 416 | getOptionData(value){ |
417 | 417 | const option = this.flatOptions.find(({componentOptions}) => componentOptions.propsData.value === value); |
... | ... | @@ -427,7 +427,7 @@ |
427 | 427 | let initialValue = Array.isArray(value) ? value : [value]; |
428 | 428 | if (!multiple && (typeof initialValue[0] === 'undefined' || (String(initialValue[0]).trim() === '' && !Number.isFinite(initialValue[0])))) initialValue = []; |
429 | 429 | return initialValue.filter((item) => { |
430 | - return Boolean(item) || item === 0 | |
430 | + return Boolean(item) || item === 0; | |
431 | 431 | }); |
432 | 432 | }, |
433 | 433 | processOption(option, values, isFocused){ |
... | ... | @@ -488,6 +488,14 @@ |
488 | 488 | return; |
489 | 489 | } |
490 | 490 | |
491 | + if (this.transfer) { | |
492 | + const {$el} = this.$refs.dropdown; | |
493 | + if ($el === event.target || $el.contains(event.target)) { | |
494 | + return; | |
495 | + } | |
496 | + } | |
497 | + | |
498 | + | |
491 | 499 | if (this.filterable) { |
492 | 500 | const input = this.$el.querySelector('input[type="text"]'); |
493 | 501 | this.caretPosition = input.selectionStart; |
... | ... | @@ -507,6 +515,8 @@ |
507 | 515 | } |
508 | 516 | }, |
509 | 517 | reset(){ |
518 | + this.query = ''; | |
519 | + this.focusIndex = -1; | |
510 | 520 | this.unchangedQuery = true; |
511 | 521 | this.values = []; |
512 | 522 | }, | ... | ... |