Compare commits

...

1 Commits

Author SHA1 Message Date
kolaente ee68227065
feat: allow selecting multiple labels at once 2021-11-03 22:30:05 +01:00
2 changed files with 15 additions and 4 deletions

View File

@ -7,7 +7,9 @@
@focus="focus" @focus="focus"
> >
<div class="control" :class="{'is-loading': loading || localLoading}"> <div class="control" :class="{'is-loading': loading || localLoading}">
<div class="input-wrapper input" :class="{'has-multiple': multiple && Array.isArray(internalValue) && internalValue.length > 0}"> <div
class="input-wrapper input"
:class="{'has-multiple': multiple && Array.isArray(internalValue) && internalValue.length > 0}">
<template v-if="Array.isArray(internalValue)"> <template v-if="Array.isArray(internalValue)">
<template v-for="(item, key) in internalValue"> <template v-for="(item, key) in internalValue">
<slot name="tag" :item="item"> <slot name="tag" :item="item">
@ -81,7 +83,7 @@
</template> </template>
<script> <script>
import { i18n } from '@/i18n' import {i18n} from '@/i18n'
import {closeWhenClickedOutside} from '@/helpers/closeWhenClickedOutside' import {closeWhenClickedOutside} from '@/helpers/closeWhenClickedOutside'
export default { export default {
@ -180,8 +182,14 @@ export default {
return 200 return 200
}, },
}, },
closeAfterSelect: {
type: Boolean,
default() {
return true
},
},
}, },
/** /**
* Available events: * Available events:
* @search: Triggered every time the search query input changes * @search: Triggered every time the search query input changes
@ -285,7 +293,9 @@ export default {
this.$emit('update:modelValue', this.internalValue) this.$emit('update:modelValue', this.internalValue)
this.$emit('select', object) this.$emit('select', object)
this.setSelectedObject(object) this.setSelectedObject(object)
this.closeSearchResults() if (this.closeAfterSelect && this.filteredSearchResults.length > 0 && !this.creatableAvailable) {
this.closeSearchResults()
}
}, },
setSelectedObject(object, resetOnly = false) { setSelectedObject(object, resetOnly = false) {
this.internalValue = object this.internalValue = object

View File

@ -12,6 +12,7 @@
:create-placeholder="$t('task.label.createPlaceholder')" :create-placeholder="$t('task.label.createPlaceholder')"
v-model="labels" v-model="labels"
:search-delay="10" :search-delay="10"
:close-after-select="false"
> >
<template #tag="props"> <template #tag="props">
<span <span