Commit 427b869297e36780c062ebd9a5e6e672bffc4ac8

Authored by Aresn
Committed by GitHub
2 parents a7713a76 d20b4e1a

Merge pull request #3747 from SergioCrisostomo/select-patches

Select fixes
src/components/select/option.vue
... ... @@ -2,6 +2,7 @@
2 2 <li
3 3 :class="classes"
4 4 @click.stop="select"
  5 + @touchend.stop="select"
5 6 @mousedown.prevent
6 7 @touchstart.prevent
7 8 ><slot>{{ showLabel }}</slot></li>
... ...
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 },
... ...