Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Allow adding the same dataset multiple times to a bouquet. #507

Merged
merged 11 commits into from
Sep 12, 2024
25 changes: 23 additions & 2 deletions src/components/forms/dataset/SelectDataset.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const search = debounce(async (query: string) => {
await new SearchAPI().search(query, null, 1, {
page_size: 10
})
).data.filter((dataset) => !alreadySelected(dataset.id))
).data
options.value = datasets
isLoading.value = false
}, 400)
Expand All @@ -69,7 +69,6 @@ const clear = () => {
:loading="isLoading"
:clear-on-select="true"
:close-on-select="true"
:max-height="600"
:show-no-results="false"
:hide-selected="true"
@search-change="search"
Expand All @@ -82,11 +81,33 @@ const clear = () => {
></div>
</template>
<template #singleLabel="slotProps">
<DsfrBadge
v-if="alreadySelected(slotProps.option.id)"
type="warning"
label="Déjà sélectionné"
small
class="dsfr-badge-warning"
/>
<DatasetCardForSelect :dataset="slotProps.option" />
</template>
<template #option="slotProps">
<DsfrBadge
v-if="alreadySelected(slotProps.option.id)"
type="warning"
label="Déjà sélectionné"
small
class="dsfr-badge-warning"
/>
<DatasetCardForSelect :dataset="slotProps.option" />
</template>
<template #noOptions> Précisez ou élargissez votre recherche </template>
</Multiselect>
</template>

<style scoped>
/* specificity override fix for badge icon */
.dsfr-badge-warning.dsfr-badge-warning::before {
-webkit-mask-image: url(/node_modules/@gouvfr/dsfr/dist/icons/system/fr--warning-fill.svg);
mask-image: url(/node_modules/@gouvfr/dsfr/dist/icons/system/fr--warning-fill.svg);
}
</style>
Loading