Merge pull request #6085 from qburst/master

fix: #6084, SELECT: hide clear button when options is empty in Dropdown
pull/6101/head
Tuğçe Küçükoğlu 2024-07-22 16:08:47 +03:00 committed by GitHub
commit c02defa960
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 1 deletions

View File

@ -48,7 +48,7 @@
> >
<slot name="value" :value="modelValue" :placeholder="placeholder">{{ label === 'p-emptylabel' ? '&nbsp;' : label || 'empty' }}</slot> <slot name="value" :value="modelValue" :placeholder="placeholder">{{ label === 'p-emptylabel' ? '&nbsp;' : label || 'empty' }}</slot>
</span> </span>
<slot v-if="showClear && modelValue != null" name="clearicon" :class="cx('clearIcon')" :clearCallback="onClearClick"> <slot v-if="isClearIconVisible()" name="clearicon" :class="cx('clearIcon')" :clearCallback="onClearClick">
<component :is="clearIcon ? 'i' : 'TimesIcon'" ref="clearIcon" :class="[cx('clearIcon'), clearIcon]" @click="onClearClick" v-bind="ptm('clearIcon')" data-pc-section="clearicon" /> <component :is="clearIcon ? 'i' : 'TimesIcon'" ref="clearIcon" :class="[cx('clearIcon'), clearIcon]" @click="onClearClick" v-bind="ptm('clearIcon')" data-pc-section="clearicon" />
</slot> </slot>
<div :class="cx('dropdown')" v-bind="ptm('dropdown')"> <div :class="cx('dropdown')" v-bind="ptm('dropdown')">
@ -432,6 +432,9 @@ export default {
this.clicked = false; this.clicked = false;
}, },
isClearIconVisible() {
return this.showClear && this.modelValue != null && isNotEmpty(this.options);
},
onEditableInput(event) { onEditableInput(event) {
const value = event.target.value; const value = event.target.value;