2023-10-02 10:46:09 +00:00
|
|
|
import BaseStyle from 'primevue/base/style';
|
|
|
|
|
|
|
|
const css = `
|
|
|
|
@layer primevue {
|
|
|
|
.p-dropdown {
|
|
|
|
display: inline-flex;
|
|
|
|
cursor: pointer;
|
|
|
|
position: relative;
|
|
|
|
user-select: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-dropdown-clear-icon {
|
|
|
|
position: absolute;
|
|
|
|
top: 50%;
|
|
|
|
margin-top: -0.5rem;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-dropdown-trigger {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
|
|
|
flex-shrink: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-dropdown-label {
|
|
|
|
display: block;
|
|
|
|
white-space: nowrap;
|
|
|
|
overflow: hidden;
|
|
|
|
flex: 1 1 auto;
|
|
|
|
width: 1%;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
cursor: pointer;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-dropdown-label-empty {
|
|
|
|
overflow: hidden;
|
|
|
|
opacity: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
input.p-dropdown-label {
|
|
|
|
cursor: default;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-dropdown .p-dropdown-panel {
|
|
|
|
min-width: 100%;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-dropdown-panel {
|
|
|
|
position: absolute;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-dropdown-items-wrapper {
|
|
|
|
overflow: auto;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-dropdown-item {
|
|
|
|
cursor: pointer;
|
|
|
|
font-weight: normal;
|
|
|
|
white-space: nowrap;
|
|
|
|
position: relative;
|
|
|
|
overflow: hidden;
|
2024-01-24 10:44:00 +00:00
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
2023-10-02 10:46:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-dropdown-item-group {
|
|
|
|
cursor: auto;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-dropdown-items {
|
|
|
|
margin: 0;
|
|
|
|
padding: 0;
|
|
|
|
list-style-type: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-dropdown-filter {
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-dropdown-filter-container {
|
|
|
|
position: relative;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-dropdown-filter-icon {
|
|
|
|
position: absolute;
|
|
|
|
top: 50%;
|
|
|
|
margin-top: -0.5rem;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-fluid .p-dropdown {
|
|
|
|
display: flex;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-fluid .p-dropdown .p-dropdown-label {
|
|
|
|
width: 1%;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
const classes = {
|
|
|
|
root: ({ instance, props, state }) => [
|
|
|
|
'p-dropdown p-component p-inputwrapper',
|
|
|
|
{
|
|
|
|
'p-disabled': props.disabled,
|
2024-01-30 11:27:56 +00:00
|
|
|
'p-invalid': props.invalid,
|
2024-01-31 08:02:53 +00:00
|
|
|
'p-variant': props.variant === 'filled',
|
2023-12-07 11:09:01 +00:00
|
|
|
'p-dropdown-clearable': props.showClear,
|
2023-10-02 10:46:09 +00:00
|
|
|
'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 }) => [
|
2023-10-02 10:46:09 +00:00
|
|
|
'p-dropdown-panel p-component',
|
|
|
|
{
|
2024-01-31 08:02:53 +00:00
|
|
|
'p-input-filled': props.variant === 'filled' || instance.$primevue.config.inputStyle === 'filled',
|
2023-10-02 10:46:09 +00:00
|
|
|
'p-ripple-disabled': instance.$primevue.config.ripple === false
|
|
|
|
}
|
|
|
|
],
|
|
|
|
header: 'p-dropdown-header',
|
|
|
|
filterContainer: 'p-dropdown-filter-container',
|
|
|
|
filterInput: 'p-dropdown-filter p-inputtext p-component',
|
|
|
|
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',
|
2024-01-24 10:44:00 +00:00
|
|
|
item: ({ instance, props, state, option, focusedOption }) => [
|
2023-10-02 10:46:09 +00:00
|
|
|
'p-dropdown-item',
|
|
|
|
{
|
2024-01-24 10:44:00 +00:00
|
|
|
'p-highlight': instance.isSelected(option) && props.highlightOnSelect,
|
2023-10-02 10:46:09 +00:00
|
|
|
'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',
|
2024-01-24 10:44:00 +00:00
|
|
|
blankIcon: 'p-dropdown-blank-icon',
|
2023-10-02 10:46:09 +00:00
|
|
|
emptyMessage: 'p-dropdown-empty-message'
|
|
|
|
};
|
|
|
|
|
|
|
|
export default BaseStyle.extend({
|
|
|
|
name: 'dropdown',
|
|
|
|
css,
|
|
|
|
classes
|
|
|
|
});
|