change :data to :options for TagInput

Related to #1917
This commit is contained in:
Massedil
2026-01-08 18:56:00 +01:00
parent 2f48829e2d
commit f1a3a5e27c
2 changed files with 13 additions and 11 deletions

View File

@@ -16,10 +16,9 @@
<o-taginput <o-taginput
:modelValue="tagsStrings" :modelValue="tagsStrings"
@update:modelValue="updateTags" @update:modelValue="updateTags"
:data="filteredTags" :options="filteredTags"
:allow-autocomplete="true" :allow-autocomplete="true"
:allow-new="true" :allow-new="true"
:field="'title'"
icon="label" icon="label"
:maxlength="20" :maxlength="20"
:maxitems="10" :maxitems="10"
@@ -40,6 +39,7 @@ import HelpCircleOutline from "vue-material-design-icons/HelpCircleOutline.vue";
import { useFetchTags } from "@/composition/apollo/tags"; import { useFetchTags } from "@/composition/apollo/tags";
import { FILTER_TAGS } from "@/graphql/tags"; import { FILTER_TAGS } from "@/graphql/tags";
import { useI18n } from "vue-i18n"; import { useI18n } from "vue-i18n";
import { OptionsPropItem } from "@oruga-ui/oruga-next";
const props = defineProps<{ const props = defineProps<{
modelValue: ITag[]; modelValue: ITag[];
@@ -83,14 +83,17 @@ const getFilteredTags = async (newText: string): Promise<void> => {
} }
}; };
const filteredTags = computed((): ITag[] => { const filteredTags = computed<OptionsPropItem<string>[]>(() => {
return differenceBy(tags.value, propsValue.value, "id").filter( return differenceBy(tags.value, propsValue.value, "id")
(option) => .filter(
option.title.toString().toLowerCase().indexOf(text.value.toLowerCase()) >= (tag) =>
0 || tag.title.toLowerCase().includes(text.value.toLowerCase()) ||
option.slug.toString().toLowerCase().indexOf(text.value.toLowerCase()) >= tag.slug.toLowerCase().includes(text.value.toLowerCase())
0 )
); .map((tag) => ({
label: tag.title,
value: tag.slug,
}));
}); });
const updateTags = (newTagsStrings: string[]) => { const updateTags = (newTagsStrings: string[]) => {

View File

@@ -181,7 +181,6 @@
:options="filteredLanguages" :options="filteredLanguages"
allow-autocomplete allow-autocomplete
:open-on-focus="true" :open-on-focus="true"
field="name"
icon="label" icon="label"
:disabled="languageLoading" :disabled="languageLoading"
:placeholder="t('Select languages')" :placeholder="t('Select languages')"