|
1 | 1 | <script lang="ts" setup generic="T extends Object | string | number"> |
2 | | -import { getRandomId } from '@/utils/random-utils' |
3 | 2 | import { computed, onUnmounted, ref } from 'vue' |
4 | 3 |
|
5 | 4 | import { useCollapsable } from '../../composables' |
6 | 5 | import DsfrButton from '../DsfrButton/DsfrButton.vue' |
7 | 6 | import DsfrCheckbox from '../DsfrCheckbox/DsfrCheckbox.vue' |
8 | 7 | import DsfrFieldset from '../DsfrFieldset/DsfrFieldset.vue' |
9 | | -
|
10 | 8 | import DsfrInput from '../DsfrInput/DsfrInput.vue' |
| 9 | +
|
11 | 10 | import type { DsfrMultiSelectProps, DsfrMultiSelectSlots } from './DsfrMultiselect.types' |
12 | 11 |
|
| 12 | +import { getRandomId } from '@/utils/random-utils' |
| 13 | +
|
13 | 14 | const props = withDefaults( |
14 | 15 | defineProps<DsfrMultiSelectProps<T>>(), |
15 | 16 | { |
@@ -285,10 +286,13 @@ onUnmounted(() => { |
285 | 286 |
|
286 | 287 | const defaultButtonLabel = computed(() => { |
287 | 288 | const nbElements = model.value?.length |
288 | | - if (nbElements === 0) { |
| 289 | + const noElements = nbElements === 0 |
| 290 | + const severalElements = nbElements > 1 |
| 291 | +
|
| 292 | + if (noElements) { |
289 | 293 | return 'Sélectionner une option' |
290 | 294 | } |
291 | | - return `${nbElements} option${nbElements > 1 ? 's' : ''} sélectionnée${nbElements > 1 ? 's' : ''}` |
| 295 | + return `${nbElements} option${severalElements ? 's' : ''} sélectionnée${severalElements ? 's' : ''}` |
292 | 296 | }) |
293 | 297 |
|
294 | 298 | const finalLabelClass = computed(() => [ |
@@ -507,14 +511,12 @@ const finalLabelClass = computed(() => [ |
507 | 511 | } |
508 | 512 |
|
509 | 513 | .fr-multiselect__collapse { |
510 | | - z-index: 20000; |
| 514 | + z-index: 1; |
511 | 515 | position: absolute; |
512 | 516 | transform-origin: left top; |
513 | 517 | width: var(--width-host); |
514 | | - left: var(--left-position); |
515 | | - top: var(--top-position); |
516 | 518 | padding: 1rem; |
517 | | - margin-top: 4px; |
| 519 | + margin-top: 0.25rem; |
518 | 520 | background-color: var(--background-overlap-grey); |
519 | 521 | filter: drop-shadow(var(--overlap-shadow)); |
520 | 522 | } |
|
0 commit comments