2023-10-02 10:46:09 +00:00
|
|
|
import BaseStyle from 'primevue/base/style';
|
|
|
|
|
2024-05-01 08:26:48 +00:00
|
|
|
const theme = ({ dt }) => `
|
|
|
|
.p-cascadeselect {
|
|
|
|
display: inline-flex;
|
|
|
|
cursor: pointer;
|
|
|
|
position: relative;
|
|
|
|
user-select: none;
|
|
|
|
background: ${dt('cascadeselect.background')};
|
|
|
|
border: 1px solid ${dt('cascadeselect.border.color')};
|
2024-05-08 09:42:15 +00:00
|
|
|
transition: background ${dt('transition.duration')}, color ${dt('transition.duration')}, border-color ${dt('transition.duration')}, outline-color ${dt('transition.duration')}, box-shadow ${dt('transition.duration')};
|
|
|
|
border-radius: ${dt('cascadeselect.border.radius')};
|
2024-05-01 08:26:48 +00:00
|
|
|
outline-color: transparent;
|
2024-05-06 21:23:42 +00:00
|
|
|
box-shadow: ${dt('cascadeselect.shadow')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-cascadeselect:not(.p-disabled):hover {
|
|
|
|
border-color: ${dt('cascadeselect.hover.border.color')};
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-cascadeselect:not(.p-disabled).p-focus {
|
|
|
|
border-color: ${dt('cascadeselect.focus.border.color')};
|
2024-05-08 09:42:15 +00:00
|
|
|
box-shadow: ${dt('cascadeselect.focus.ring.shadow')};
|
|
|
|
outline: ${dt('cascadeselect.focus.ring.width')} ${dt('cascadeselect.focus.ring.style')} ${dt('cascadeselect.focus.ring.color')};
|
|
|
|
outline-offset: ${dt('multiscascadeselectelect.focus.ring.offset')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-cascadeselect.p-variant-filled {
|
|
|
|
background: ${dt('cascadeselect.filled.background')};
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-cascadeselect.p-variant-filled.p-focus {
|
|
|
|
background: ${dt('cascadeselect.filled.focus.background')};
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-cascadeselect.p-invalid {
|
|
|
|
border-color: ${dt('cascadeselect.invalid.border.color')};
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-cascadeselect.p-disabled {
|
|
|
|
opacity: 1;
|
|
|
|
background: ${dt('cascadeselect.disabled.background')};
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-cascadeselect-dropdown {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
|
|
|
flex-shrink: 0;
|
|
|
|
background: transparent;
|
2024-05-05 15:46:45 +00:00
|
|
|
color: ${dt('cascadeselect.dropdown.color')};
|
2024-05-08 09:42:15 +00:00
|
|
|
width: ${dt('cascadeselect.dropdown.width')};
|
2024-05-06 21:18:22 +00:00
|
|
|
border-top-right-radius: ${dt('border.radius.md')};
|
|
|
|
border-bottom-right-radius: ${dt('border.radius.md')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-cascadeselect-label {
|
|
|
|
display: block;
|
|
|
|
white-space: nowrap;
|
|
|
|
overflow: hidden;
|
|
|
|
flex: 1 1 auto;
|
|
|
|
width: 1%;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
cursor: pointer;
|
2024-05-08 09:42:15 +00:00
|
|
|
padding: ${dt('cascadeselect.padding.y')} ${dt('cascadeselect.padding.x')};
|
2024-05-01 08:26:48 +00:00
|
|
|
background: transparent;
|
|
|
|
border: 0 none;
|
|
|
|
outline: 0 none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-cascadeselect-label.p-placeholder {
|
|
|
|
color: ${dt('cascadeselect.placeholder.color')};
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-cascadeselect-clearable .p-cascadeselect-label {
|
|
|
|
padding-right: 1.75rem;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-cascadeselect.p-disabled .p-cascadeselect-label {
|
|
|
|
color: ${dt('cascadeselect.disabled.color')};
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-cascadeselect-label-empty {
|
|
|
|
overflow: hidden;
|
|
|
|
visibility: hidden;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-fluid .p-cascadeselect {
|
|
|
|
display: flex;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-fluid .p-cascadeselect .p-cascadeselect-label {
|
|
|
|
width: 1%;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-cascadeselect-overlay {
|
|
|
|
background: ${dt('cascadeselect.overlay.background')};
|
2024-05-05 15:46:45 +00:00
|
|
|
color: ${dt('cascadeselect.overlay.color')};
|
2024-05-08 09:42:15 +00:00
|
|
|
border: 1px solid ${dt('cascadeselect.overlay.border.color')};
|
|
|
|
border-radius: ${dt('cascadeselect.overlay.border.radius')};
|
|
|
|
box-shadow: ${dt('cascadeselect.overlay.shadow')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-cascadeselect .p-cascadeselect-overlay {
|
|
|
|
min-width: 100%;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-cascadeselect-item-list {
|
2024-05-05 15:46:45 +00:00
|
|
|
display: none;
|
2024-05-01 08:26:48 +00:00
|
|
|
min-width: 100%;
|
2024-05-05 15:46:45 +00:00
|
|
|
position: absolute;
|
2024-05-01 08:26:48 +00:00
|
|
|
z-index: 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-cascadeselect-list {
|
|
|
|
min-width: 100%;
|
2024-05-08 09:42:15 +00:00
|
|
|
margin: 0;
|
|
|
|
padding: 0;
|
|
|
|
list-style-type: none;
|
|
|
|
padding: ${dt('cascadeselect.list.padding')};
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
gap: ${dt('cascadeselect.list.gap')}
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-cascadeselect-item {
|
|
|
|
cursor: pointer;
|
|
|
|
font-weight: normal;
|
|
|
|
white-space: nowrap;
|
|
|
|
border: 0 none;
|
2024-05-05 15:46:45 +00:00
|
|
|
color: ${dt('cascadeselect.option.color')};
|
2024-05-01 08:26:48 +00:00
|
|
|
background: transparent;
|
|
|
|
transition: background-color ${dt('transition.duration')}, color ${dt('transition.duration')}, border-color ${dt('transition.duration')}, box-shadow ${dt('transition.duration')}, outline-color ${dt('transition.duration')};
|
2024-05-08 09:42:15 +00:00
|
|
|
border-radius: ${dt('cascadeselect.option.border.radius')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-cascadeselect-item:not(.p-cascadeselect-item-selected):not(.p-disabled).p-focus {
|
2024-05-05 15:46:45 +00:00
|
|
|
background: ${dt('cascadeselect.option.focus.background')};
|
|
|
|
color: ${dt('cascadeselect.option.focus.color')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-cascadeselect-item:not(.p-cascadeselect-item-selected):not(.p-disabled).p-focus .p-cascadeselect-group-icon {
|
2024-05-05 15:46:45 +00:00
|
|
|
color: ${dt('cascadeselect.option.icon.focus.color')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-cascadeselect-item-selected {
|
2024-05-05 15:46:45 +00:00
|
|
|
background: ${dt('cascadeselect.option.selected.background')};
|
|
|
|
color: ${dt('cascadeselect.option.selected.color')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-cascadeselect-item-selected.p-focus {
|
2024-05-05 15:46:45 +00:00
|
|
|
background: ${dt('cascadeselect.option.selected.focus.background')};
|
|
|
|
color: ${dt('cascadeselect.option.selected.focus.color')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-cascadeselect-item-active {
|
|
|
|
overflow: visible;
|
2024-05-05 15:46:45 +00:00
|
|
|
background: ${dt('cascadeselect.option.focus.background')};
|
|
|
|
color: ${dt('cascadeselect.option.focus.color')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-cascadeselect-item-active > .p-cascadeselect-item-list {
|
|
|
|
display: block;
|
|
|
|
left: 100%;
|
|
|
|
top: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-cascadeselect-item-content {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
overflow: hidden;
|
|
|
|
position: relative;
|
2024-05-08 09:42:15 +00:00
|
|
|
padding: ${dt('cascadeselect.option.padding')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-cascadeselect-group-icon {
|
|
|
|
margin-left: auto;
|
2024-05-08 09:42:15 +00:00
|
|
|
font-size: ${dt('cascadeselect.option.icon.size')};
|
|
|
|
width: ${dt('cascadeselect.option.icon.size')};
|
|
|
|
height: ${dt('cascadeselect.option.icon.size')};
|
2024-05-05 15:46:45 +00:00
|
|
|
color: ${dt('cascadeselect.option.icon.color')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2023-10-02 10:46:09 +00:00
|
|
|
const inlineStyles = {
|
|
|
|
root: ({ props }) => ({ position: props.appendTo === 'self' ? 'relative' : undefined })
|
|
|
|
};
|
|
|
|
|
|
|
|
const classes = {
|
|
|
|
root: ({ instance, props }) => [
|
|
|
|
'p-cascadeselect p-component p-inputwrapper',
|
|
|
|
{
|
|
|
|
'p-disabled': props.disabled,
|
2024-01-30 11:27:56 +00:00
|
|
|
'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',
|
2023-10-02 10:46:09 +00:00
|
|
|
'p-focus': instance.focused,
|
|
|
|
'p-inputwrapper-filled': props.modelValue,
|
|
|
|
'p-inputwrapper-focus': instance.focused || instance.overlayVisible,
|
2024-04-06 23:14:45 +00:00
|
|
|
'p-cascadeselect-open': instance.overlayVisible
|
2023-10-02 10:46:09 +00:00
|
|
|
}
|
|
|
|
],
|
|
|
|
label: ({ instance, props }) => [
|
2024-03-22 08:53:44 +00:00
|
|
|
'p-cascadeselect-label',
|
2023-10-02 10:46:09 +00:00
|
|
|
{
|
|
|
|
'p-placeholder': instance.label === props.placeholder,
|
|
|
|
'p-cascadeselect-label-empty': !instance.$slots['value'] && (instance.label === 'p-emptylabel' || instance.label.length === 0)
|
|
|
|
}
|
|
|
|
],
|
2024-05-03 11:46:02 +00:00
|
|
|
dropdown: 'p-cascadeselect-dropdown',
|
2024-04-06 23:14:45 +00:00
|
|
|
loadingIcon: 'p-cascadeselect-loading-icon',
|
|
|
|
dropdownIcon: 'p-cascadeselect-dropdown-icon',
|
2024-05-03 11:46:02 +00:00
|
|
|
overlay: ({ instance }) => [
|
2024-04-06 23:14:45 +00:00
|
|
|
'p-cascadeselect-overlay p-component',
|
2023-10-02 10:46:09 +00:00
|
|
|
{
|
|
|
|
'p-ripple-disabled': instance.$primevue.config.ripple === false
|
|
|
|
}
|
|
|
|
],
|
2024-05-03 11:46:02 +00:00
|
|
|
listContainer: 'p-cascadeselect-list-container',
|
|
|
|
list: 'p-cascadeselect-list',
|
2023-10-02 10:46:09 +00:00
|
|
|
item: ({ instance, processedOption }) => [
|
|
|
|
'p-cascadeselect-item',
|
|
|
|
{
|
2024-03-25 15:19:22 +00:00
|
|
|
'p-cascadeselect-item-active': instance.isOptionActive(processedOption),
|
2024-04-06 23:14:45 +00:00
|
|
|
'p-cascadeselect-item-selected': instance.isOptionSelected(processedOption),
|
2023-10-02 10:46:09 +00:00
|
|
|
'p-focus': instance.isOptionFocused(processedOption),
|
|
|
|
'p-disabled': instance.isOptionDisabled(processedOption)
|
|
|
|
}
|
|
|
|
],
|
2024-05-03 11:46:02 +00:00
|
|
|
itemContent: 'p-cascadeselect-item-content',
|
|
|
|
itemText: 'p-cascadeselect-item-text',
|
2023-10-02 10:46:09 +00:00
|
|
|
groupIcon: 'p-cascadeselect-group-icon',
|
2024-05-03 11:46:02 +00:00
|
|
|
itemList: 'p-cascadeselect-overlay p-cascadeselect-item-list'
|
2023-10-02 10:46:09 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export default BaseStyle.extend({
|
|
|
|
name: 'cascadeselect',
|
2024-05-01 08:26:48 +00:00
|
|
|
theme,
|
2023-10-02 10:46:09 +00:00
|
|
|
classes,
|
|
|
|
inlineStyles
|
|
|
|
});
|