This commit is contained in:
vishesh92 2025-11-14 13:31:32 +05:30
parent c7d282cd2e
commit f317e9cc16
No known key found for this signature in database
GPG Key ID: 4E395186CBFA790B
1 changed files with 14 additions and 1 deletions

View File

@ -78,7 +78,7 @@
</div>
</div>
</template>
<a-select-option v-for="option in options" :key="option.id" :value="option[optionValueKey]">
<a-select-option v-for="option in selectableOptions" :key="option.id" :value="option[optionValueKey]">
<span>
<span v-if="showIcon && option.id !== null && option.id !== undefined">
<resource-icon v-if="option.icon && option.icon.base64image" :image="option.icon.base64image" size="1x" style="margin-right: 5px"/>
@ -178,6 +178,19 @@ export default {
},
formattedSearchFooterMessage () {
return `${this.$t('label.showing.results.for').replace('%x', this.searchQuery)}`
},
selectableOptions () {
const currentValue = this.$attrs.value
// Only filter out null/empty options when the current value is also null/undefined/empty
// This prevents such options from being selected and allows the placeholder to show instead
if (currentValue === null || currentValue === undefined || currentValue === '') {
return this.options.filter(option => {
const optionValue = option[this.optionValueKey]
return optionValue !== null && optionValue !== undefined && optionValue !== ''
})
}
// When a valid value is selected, show all options
return this.options
}
},
watch: {