Skip to content

Commit

Permalink
Refactor #3965 - Refactor on Dropdown
Browse files Browse the repository at this point in the history
  • Loading branch information
tugcekucukoglu committed Jun 22, 2023
1 parent ff40389 commit af5a0b0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions components/lib/dropdown/BaseDropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions components/lib/dropdown/Dropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<slot name="value" :value="modelValue" :placeholder="placeholder">{{ label === 'p-emptylabel' ? '&nbsp;' : 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')">
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit af5a0b0

Please sign in to comment.