fix: #6084, SELECT: hide clear button when options is empty in Dropdown
parent
6bca2a8b46
commit
5c461c9aec
|
@ -48,7 +48,7 @@
|
||||||
>
|
>
|
||||||
<slot name="value" :value="modelValue" :placeholder="placeholder">{{ label === 'p-emptylabel' ? ' ' : label || 'empty' }}</slot>
|
<slot name="value" :value="modelValue" :placeholder="placeholder">{{ label === 'p-emptylabel' ? ' ' : 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')">
|
||||||
|
@ -191,7 +191,7 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { absolutePosition, addStyle, findSingle, focus, getFirstFocusableElement, getFocusableElements, getLastFocusableElement, getOuterWidth, isAndroid, isTouchDevice, isVisible, relativePosition } from '@primeuix/utils/dom';
|
import { absolutePosition, addStyle, findSingle, focus, getFirstFocusableElement, getFocusableElements, getLastFocusableElement, getOuterWidth, isAndroid, isTouchDevice, isVisible, relativePosition } from '@primeuix/utils/dom';
|
||||||
import { equals, findLastIndex, isNotEmpty, isPrintableCharacter, resolveFieldData } from '@primeuix/utils/object';
|
import { equals, findLastIndex, isEmpty, isNotEmpty, isPrintableCharacter, resolveFieldData } from '@primeuix/utils/object';
|
||||||
import { ZIndex } from '@primeuix/utils/zindex';
|
import { ZIndex } from '@primeuix/utils/zindex';
|
||||||
import { FilterService } from '@primevue/core/api';
|
import { FilterService } from '@primevue/core/api';
|
||||||
import { ConnectedOverlayScrollHandler, UniqueComponentId } from '@primevue/core/utils';
|
import { ConnectedOverlayScrollHandler, UniqueComponentId } from '@primevue/core/utils';
|
||||||
|
@ -432,6 +432,9 @@ export default {
|
||||||
|
|
||||||
this.clicked = false;
|
this.clicked = false;
|
||||||
},
|
},
|
||||||
|
isClearIconVisible() {
|
||||||
|
return this.showClear && this.modelValue != null && !isEmpty(this.options);
|
||||||
|
},
|
||||||
onEditableInput(event) {
|
onEditableInput(event) {
|
||||||
const value = event.target.value;
|
const value = event.target.value;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue