primevue-mirror/components/lib/dropdown/style/DropdownStyle.js

65 lines
2.4 KiB
JavaScript
Raw Normal View History

import BaseStyle from 'primevue/base/style';
const classes = {
root: ({ instance, props, state }) => [
'p-dropdown p-component p-inputwrapper',
{
'p-disabled': props.disabled,
'p-invalid': props.invalid,
2024-02-02 11:46:26 +00:00
'p-variant-filled': props.variant ? props.variant === 'filled' : instance.$primevue.config.inputStyle === 'filled',
'p-dropdown-clearable': props.showClear,
'p-focus': state.focused,
'p-inputwrapper-filled': instance.hasSelectedOption,
'p-inputwrapper-focus': state.focused || state.overlayVisible,
'p-overlay-open': state.overlayVisible
}
],
input: ({ instance, props }) => [
'p-dropdown-label p-inputtext',
{
'p-placeholder': !props.editable && instance.label === props.placeholder,
'p-dropdown-label-empty': !props.editable && !instance.$slots['value'] && (instance.label === 'p-emptylabel' || instance.label?.length === 0)
}
],
clearIcon: 'p-dropdown-clear-icon',
trigger: 'p-dropdown-trigger',
loadingicon: 'p-dropdown-trigger-icon',
dropdownIcon: 'p-dropdown-trigger-icon',
2024-01-31 08:02:53 +00:00
panel: ({ props, instance }) => [
'p-dropdown-panel p-component',
{
'p-ripple-disabled': instance.$primevue.config.ripple === false
}
],
header: 'p-dropdown-header',
filterContainer: 'p-dropdown-filter-container',
2024-02-02 11:46:26 +00:00
filterInput: ({ props, instance }) => [
'p-dropdown-filter p-inputtext p-component',
{
'p-variant-filled': props.variant ? props.variant === 'filled' : instance.$primevue.config.inputStyle === 'filled'
}
],
filterIcon: 'p-dropdown-filter-icon',
wrapper: 'p-dropdown-items-wrapper',
list: 'p-dropdown-items',
itemGroup: 'p-dropdown-item-group',
2024-01-24 10:50:41 +00:00
itemGroupLabel: 'p-dropdown-item-group-label',
item: ({ instance, props, state, option, focusedOption }) => [
'p-dropdown-item',
{
'p-highlight': instance.isSelected(option) && props.highlightOnSelect,
'p-focus': state.focusedOptionIndex === focusedOption,
'p-disabled': instance.isOptionDisabled(option)
}
],
2024-01-24 10:50:41 +00:00
itemLabel: 'p-dropdown-item-label',
2024-01-24 12:30:47 +00:00
checkIcon: 'p-dropdown-check-icon',
blankIcon: 'p-dropdown-blank-icon',
emptyMessage: 'p-dropdown-empty-message'
};
export default BaseStyle.extend({
name: 'dropdown',
classes
});