fix(Select/SelectMenu): prevent empty string display when multiple

Regression of 7df7ee336a
This commit is contained in:
Benjamin Canac
2025-05-28 17:33:59 +02:00
parent 5835eb5f0f
commit 483e473e3f
7 changed files with 19 additions and 10 deletions

View File

@@ -225,9 +225,10 @@ const ui = computed(() => tv({ extend: tv(theme), ...(appConfig.ui?.selectMenu |
buttonGroup: orientation.value
}))
function displayValue(value: GetItemValue<T, VK> | GetItemValue<T, VK>[]): string {
function displayValue(value: GetItemValue<T, VK> | GetItemValue<T, VK>[]): string | undefined {
if (props.multiple && Array.isArray(value)) {
return value.map(v => displayValue(v)).filter(Boolean).join(', ')
const values = value.map(v => displayValue(v)).filter(Boolean)
return values?.length ? values.join(', ') : undefined
}
if (!props.valueKey) {