This commit is contained in:
2021-10-05 23:51:43 +00:00
parent 918b0040f9
commit 38ccc858af
2 changed files with 34 additions and 7 deletions

View File

@@ -1,6 +1,6 @@
<template>
<div>
<span class="text-caption">
<span class="text-caption" v-if="!noLabel">
{{ title }}
</span>
<v-autocomplete
@@ -9,7 +9,7 @@
:readonly="readonly"
:items="sourcetags"
:loading="tagSearchUnderway"
:placeholder="$ay.t('TypeToSearchOrAdd')"
:placeholder="placeHolderText"
:no-data-text="$ay.t('NoData')"
:search-input.sync="tagSearchEntry"
hide-selected
@@ -63,7 +63,13 @@ export default {
},
readonly: { type: Boolean, default: false },
rules: { type: Array, default: undefined },
errorMessages: { type: Array, default: null }
errorMessages: { type: Array, default: null },
selectOnly: { type: Boolean, default: false },
noLabel: { type: Boolean, default: false },
placeHolder: {
type: String,
default: null
}
},
watch: {
async tagSearchEntry(val) {
@@ -93,11 +99,21 @@ export default {
return this.label;
}
return this.$ay.t("Tags");
},
placeHolderText() {
if (this.placeHolder) {
return this.placeHolder;
}
return this.$ay.t("TypeToSearchOrAdd");
}
},
methods: {
offerAdd() {
if (this.tagSearchEntry == null || this.tagSearchEntry == "") {
if (
this.selectOnly ||
this.tagSearchEntry == null ||
this.tagSearchEntry == ""
) {
return false;
}
const searchTag = this.normalizeTag(this.tagSearchEntry);