Skip to content

Commit

Permalink
Refactor #5612 - Dropdown / Select
Browse files Browse the repository at this point in the history
  • Loading branch information
tugcekucukoglu committed Apr 18, 2024
1 parent def5d06 commit 55ae990
Show file tree
Hide file tree
Showing 16 changed files with 1,915 additions and 1,778 deletions.
693 changes: 17 additions & 676 deletions components/lib/dropdown/Dropdown.d.ts

Large diffs are not rendered by default.

986 changes: 3 additions & 983 deletions components/lib/dropdown/Dropdown.vue

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions components/lib/dropdown/style/DropdownStyle.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { BaseStyle } from '../../base/style';
import { SelectStyle } from '../../select/style/SelectStyle';

export interface DropdownStyle extends BaseStyle {}
export interface DropdownStyle extends SelectStyle {}
55 changes: 1 addition & 54 deletions components/lib/dropdown/style/DropdownStyle.js
Original file line number Diff line number Diff line change
@@ -1,58 +1,5 @@
import BaseStyle from 'primevue/base/style';

const classes = {
root: ({ instance, props, state }) => [
'p-select p-component p-inputwrapper',
{
'p-disabled': props.disabled,
'p-invalid': props.invalid,
'p-variant-filled': props.variant ? props.variant === 'filled' : instance.$primevue.config.inputStyle === 'filled',
'p-focus': state.focused,
'p-inputwrapper-filled': instance.hasSelectedOption,
'p-inputwrapper-focus': state.focused || state.overlayVisible,
'p-select-open': state.overlayVisible
}
],
input: ({ instance, props }) => [
'p-select-label',
{
'p-placeholder': !props.editable && instance.label === props.placeholder,
'p-select-label-empty': !props.editable && !instance.$slots['value'] && (instance.label === 'p-emptylabel' || instance.label.length === 0)
}
],
clearIcon: 'p-select-clear-icon',
trigger: 'p-select-dropdown',
loadingicon: 'p-select-loading-icon',
dropdownIcon: 'p-select-dropdown-icon',
panel: ({ instance }) => [
'p-select-overlay p-component',
{
'p-ripple-disabled': instance.$primevue.config.ripple === false
}
],
header: 'p-select-header',
filterContainer: 'p-select-filter-container',
filterInput: 'p-select-filter',
filterIcon: 'p-select-filter-icon',
wrapper: 'p-select-list-container',
list: 'p-select-list',
itemGroup: 'p-select-option-group',
itemGroupLabel: 'p-select-option-group-label',
item: ({ instance, props, state, option, focusedOption }) => [
'p-select-option',
{
'p-select-option-selected': instance.isSelected(option) && props.highlightOnSelect,
'p-focus': state.focusedOptionIndex === focusedOption,
'p-disabled': instance.isOptionDisabled(option)
}
],
itemLabel: 'p-select-option-label',
checkIcon: 'p-select-option-check-icon',
blankIcon: 'p-select-option-blank-icon',
emptyMessage: 'p-select-empty-message'
};

export default BaseStyle.extend({
name: 'dropdown',
classes
name: 'dropdown'
});
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<script>
import BaseComponent from 'primevue/basecomponent';
import DropdownStyle from 'primevue/dropdown/style';
import SelectStyle from 'primevue/select/style';
export default {
name: 'BaseDropdown',
name: 'BaseSelect',
extends: BaseComponent,
props: {
modelValue: null,
Expand Down Expand Up @@ -163,7 +163,7 @@ export default {
default: null
}
},
style: DropdownStyle,
style: SelectStyle,
provide() {
return {
$parentInstance: this
Expand Down
Loading

0 comments on commit 55ae990

Please sign in to comment.