Refactor #3965 - Refactor on Dropdown
parent
ff403897d2
commit
af5a0b090d
|
@ -98,13 +98,13 @@ input.p-dropdown-label {
|
|||
`;
|
||||
|
||||
const classes = {
|
||||
root: ({ props, state }) => [
|
||||
root: ({ instance, props, state }) => [
|
||||
'p-dropdown p-component p-inputwrapper',
|
||||
{
|
||||
'p-disabled': props.disabled,
|
||||
'p-dropdown-clearable': props.showClear && !props.disabled,
|
||||
'p-focus': state.focused,
|
||||
'p-inputwrapper-filled': props.hasSelectedOption,
|
||||
'p-inputwrapper-filled': instance.hasSelectedOption,
|
||||
'p-inputwrapper-focus': state.focused || state.overlayVisible,
|
||||
'p-overlay-open': state.overlayVisible
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
<slot name="value" :value="modelValue" :placeholder="placeholder">{{ label === 'p-emptylabel' ? ' ' : label || 'empty' }}</slot>
|
||||
</span>
|
||||
<slot v-if="showClear && modelValue != null" name="clearicon" :class="cx('clearIcon')" :onClick="onClearClick">
|
||||
<component :is="clearIcon ? 'i' : 'TimesIcon'" ref="clearIcon" :class="[cx('clearIcon'), clearIcon]" @click="onClearClick" v-bind="{ ...clearIconProps, ...ptm('clearIcon') }" />
|
||||
<component :is="clearIcon ? 'i' : 'TimesIcon'" ref="clearIcon" :class="[cx('clearIcon'), clearIcon]" @click="onClearClick" v-bind="{ ...clearIconProps, ...ptm('clearIcon') }" data-pc-section="clearicon" />
|
||||
</slot>
|
||||
<div :class="cx('trigger')" v-bind="ptm('trigger')">
|
||||
<slot v-if="loading" name="loadingicon" :class="cx('loadingIcon')">
|
||||
|
@ -422,7 +422,7 @@ export default {
|
|||
return;
|
||||
}
|
||||
|
||||
if ((this.$refs.clearIcon && this.$refs.clearIcon.isSameNode(event.target)) || event.target.tagName === 'INPUT') {
|
||||
if (event.target.tagName === 'INPUT' || event.target.getAttribute('data-pc-section') === 'clearicon' || event.target.tagName === 'path') {
|
||||
return;
|
||||
} else if (!this.overlay || !this.overlay.contains(event.target)) {
|
||||
this.overlayVisible ? this.hide(true) : this.show(true);
|
||||
|
|
Loading…
Reference in New Issue