Skip to content

Commit

Permalink
[dsfr-ui] fix dsfr-select-multiple count & selection
Browse files Browse the repository at this point in the history
  • Loading branch information
ppinette committed Jan 21, 2025
1 parent f02c76f commit d1b2e88
Show file tree
Hide file tree
Showing 6 changed files with 136 additions and 132 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ const selectAllText = computed(() => {
})
const selectionDisplay = computed(() => {
let result = `${props.modelValue.length} options séléctionnées`
const count = props.options.filter(o => props.modelValue.includes(o.value)).length;
let result = `${count} options séléctionnées`
if (props.modelValue.length > 2) {
return result;
} else {
Expand All @@ -92,7 +93,8 @@ let selectAll = function () {
if (props.modelValue.length >= localOptions.value.length) {
props.modelValue.length = 0;
} else {
for (let opt of localOptions.value) {
const unduplicatedOptions = localOptions.value.filter(o => !props.modelValue.includes(o.value));
for (let opt of unduplicatedOptions) {
props.modelValue.push(opt.value)
}
}
Expand Down
Loading

0 comments on commit d1b2e88

Please sign in to comment.