diff --git a/src/components/form-generator/inputs/ChoiceInput.vue b/src/components/form-generator/inputs/ChoiceInput.vue index 9259a59d4..6eb027dcc 100644 --- a/src/components/form-generator/inputs/ChoiceInput.vue +++ b/src/components/form-generator/inputs/ChoiceInput.vue @@ -5,16 +5,14 @@ :label-placeholder="labelPlaceholder" v-model="value" @input="update()"/> - + @input="update($event)" + entityFormat + /> import { formatters, useSelectSmart } from '@/utils'; import FetchChoiceInput from './FetchChoiceInput'; +import Autocomplete from '../../Autocomplete.vue'; export default { components: { FetchChoiceInput, + Autocomplete, }, props: { choices: { @@ -61,12 +61,9 @@ export default { }, computed: { filteredChoices() { - if (!this.value || this.value.length === 0) { return this.choices; } - const search = new RegExp(formatters.bothubItemKey()(this.value.toLowerCase())); - return this.choices - .filter( - choice => search.test(formatters.bothubItemKey()(choice.display_name.toLowerCase())), - ); + return this.choices.map((choice) => + formatters.bothubItemKey()(choice.display_name.toLowerCase()), + ); }, choicesSelectSmart() { @@ -83,25 +80,6 @@ export default { this.update(); }, methods: { - updateInput() { - const search = formatters.bothubItemKey()(this.value.toLowerCase()); - const option = this.choices.find( - choice => formatters.bothubItemKey()(choice.display_name.toLowerCase()) - === search, - ); - if (option) { - this.$emit('input', option.value); - } else { - this.$emit('input', ''); - } - }, - selectOption(option) { - if (option) { - this.$emit('input', option.value); - } else { - this.$emit('input', ''); - } - }, update(value) { this.value = value; this.$emit('input', this.value); diff --git a/src/components/inputs/EntitiesInput/EntityForm.vue b/src/components/inputs/EntitiesInput/EntityForm.vue index 6e1f4d1cd..4fe884c22 100644 --- a/src/components/inputs/EntitiesInput/EntityForm.vue +++ b/src/components/inputs/EntitiesInput/EntityForm.vue @@ -10,17 +10,13 @@ {{ $t('webapp.result.is') }}

- + @@ -29,12 +25,16 @@