Skip to content

Commit

Permalink
Merge f0307c3 into 4f13bd9
Browse files Browse the repository at this point in the history
  • Loading branch information
kadirkahraman committed Aug 28, 2020
2 parents 4f13bd9 + f0307c3 commit 8553e7a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
10 changes: 8 additions & 2 deletions src/components/select/MultiSelect.js
@@ -1,10 +1,10 @@
import Local from '../../mixins/locale.mixin'
import Dropdown from '../dropdown/Dropdown.js'
import { onlyUnique } from '../../utils/array.utils'
import {onlyUnique} from '../../utils/array.utils'

export default {
mixins: [Local],
components: { Dropdown },
components: {Dropdown},
props: {
value: {
type: Array,
Expand Down Expand Up @@ -141,6 +141,9 @@ export default {
} else {
return this.placeholder || this.t('uiv.multiSelect.placeholder')
}
},
customOptionsVisible () {
return !!this.$slots['custom-option'] || !!this.$scopedSlots['custom-option']
}
},
watch: {
Expand Down Expand Up @@ -219,6 +222,9 @@ export default {
this.$emit('limit-exceed')
}
}
},
searchClicked () {
this.$emit('search', this.filterInput)
}
}
}
9 changes: 8 additions & 1 deletion src/components/select/MultiSelect.vue
Expand Up @@ -37,6 +37,7 @@
type="text"
:placeholder="filterPlaceholder || t('uiv.multiSelect.filterPlaceholder')"
v-model="filterInput"
@keyup.enter="searchClicked"
@keydown.prevent.stop.down="goNextOption"
@keydown.prevent.stop.up="goPrevOption"
@keydown.prevent.stop.enter="selectOption"
Expand All @@ -53,7 +54,13 @@
@click.stop="toggle(_item)"
@mouseenter="currentActive=-1"
style="outline: 0">
<a role="button" v-if="isItemSelected(_item)" style="outline: 0">
<a role="button" v-if="customOptionsVisible" style="outline: 0">
<slot name="custom-option"
:item="_item">
</slot>
<span v-if="selectedIcon && isItemSelected(_item)" :class="selectedIconClasses"></span>
</a>
<a role="button" v-else-if="isItemSelected(_item)" style="outline: 0">
<b>{{ _item[labelKey] }}</b>
<span v-if="selectedIcon" :class="selectedIconClasses"></span>
</a>
Expand Down

0 comments on commit 8553e7a

Please sign in to comment.