|
115 | 115 | float: left;
|
116 | 116 | line-height: 24px;
|
117 | 117 | }
|
118 |
| - .v-select .selected-tag.single { |
| 118 | + .v-select.single .selected-tag { |
119 | 119 | background-color: transparent;
|
120 | 120 | border-color: transparent;
|
121 | 121 | }
|
122 |
| - .v-select.open .selected-tag.single { |
| 122 | + .v-select.single.open .selected-tag { |
123 | 123 | position: absolute;
|
124 |
| - opacity: 0.5; |
| 124 | + opacity: .5; |
| 125 | + } |
| 126 | + .v-select.single.open.searching .selected-tag, |
| 127 | + .v-select.single.loading .selected-tag { |
| 128 | + display: none; |
125 | 129 | }
|
126 | 130 | .v-select .selected-tag .close {
|
127 | 131 | float: none;
|
|
139 | 143 | filter: alpha(opacity=20);
|
140 | 144 | opacity: .2;
|
141 | 145 | }
|
| 146 | + .v-select.single.searching:not(.open):not(.loading) input[type="search"] { |
| 147 | + opacity: .2; |
| 148 | + } |
142 | 149 | /* Search Input */
|
143 | 150 | .v-select input[type="search"]::-webkit-search-decoration,
|
144 | 151 | .v-select input[type="search"]::-webkit-search-cancel-button,
|
|
262 | 269 | <div class="dropdown v-select" :class="dropdownClasses">
|
263 | 270 | <div ref="toggle" @mousedown.prevent="toggleDropdown" class="dropdown-toggle">
|
264 | 271 |
|
265 |
| - <span class="selected-tag" :class="selectedTagClasses" v-for="option in valueAsArray" v-bind:key="option.index"> |
| 272 | + <span class="selected-tag" v-for="option in valueAsArray" v-bind:key="option.index"> |
266 | 273 | {{ getOptionLabel(option) }}
|
267 | 274 | <button v-if="multiple" @click="deselect(option)" type="button" class="close">
|
268 | 275 | <span aria-hidden="true">×</span>
|
|
702 | 709 | * @return {void}
|
703 | 710 | */
|
704 | 711 | onSearchBlur() {
|
| 712 | + if (this.clearSearchOnBlur) { |
| 713 | + this.search = '' |
| 714 | + } |
705 | 715 | this.open = false
|
706 | 716 | this.$emit('search:blur')
|
707 | 717 | },
|
|
771 | 781 | dropdownClasses() {
|
772 | 782 | return {
|
773 | 783 | open: this.dropdownOpen,
|
| 784 | + single: !this.multiple, |
| 785 | + searching: this.searching, |
774 | 786 | searchable: this.searchable,
|
775 | 787 | unsearchable: !this.searchable,
|
776 | 788 | loading: this.mutableLoading
|
777 | 789 | }
|
778 | 790 | },
|
779 | 791 |
|
780 | 792 | /**
|
781 |
| - * Classes to be output on .selected-tag |
782 |
| - * @return {Object} |
| 793 | + * If search text should clear on blur |
| 794 | + * @return {Boolean} True when single and clearSearchOnSelect |
783 | 795 | */
|
784 |
| - selectedTagClasses() { |
785 |
| - return { |
786 |
| - single: !this.multiple |
787 |
| - } |
| 796 | + clearSearchOnBlur() { |
| 797 | + return this.clearSearchOnSelect && !this.multiple |
| 798 | + }, |
| 799 | +
|
| 800 | + /** |
| 801 | + * Return the current state of the |
| 802 | + * search input |
| 803 | + * @return {Boolean} True if non empty value |
| 804 | + */ |
| 805 | + searching() { |
| 806 | + return !!this.search |
788 | 807 | },
|
789 | 808 |
|
790 | 809 | /**
|
|
0 commit comments