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-treeselect {
|
|
|
|
display: inline-flex;
|
|
|
|
cursor: pointer;
|
|
|
|
position: relative;
|
|
|
|
user-select: none;
|
|
|
|
background: ${dt('treeselect.background')};
|
|
|
|
border: 1px solid ${dt('treeselect.border.color')};
|
2024-05-26 21:38:39 +00:00
|
|
|
transition: background ${dt('treeselect.transition.duration')}, color ${dt('treeselect.transition.duration')}, border-color ${dt('treeselect.transition.duration')}, outline-color ${dt('treeselect.transition.duration')}, box-shadow ${dt(
|
|
|
|
'treeselect.transition.duration'
|
|
|
|
)};
|
2024-05-08 09:58:43 +00:00
|
|
|
border-radius: ${dt('treeselect.border.radius')};
|
2024-05-01 08:26:48 +00:00
|
|
|
outline-color: transparent;
|
2024-05-06 21:23:42 +00:00
|
|
|
box-shadow: ${dt('treeselect.shadow')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-treeselect:not(.p-disabled):hover {
|
|
|
|
border-color: ${dt('treeselect.hover.border.color')};
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-treeselect:not(.p-disabled).p-focus {
|
|
|
|
border-color: ${dt('treeselect.focus.border.color')};
|
2024-05-08 09:58:43 +00:00
|
|
|
box-shadow: ${dt('treeselect.focus.ring.shadow')};
|
|
|
|
outline: ${dt('treeselect.focus.ring.width')} ${dt('treeselect.focus.ring.style')} ${dt('treeselect.focus.ring.color')};
|
|
|
|
outline-offset: ${dt('treeselect.focus.ring.offset')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-treeselect.p-variant-filled {
|
|
|
|
background: ${dt('treeselect.filled.background')};
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-treeselect.p-variant-filled.p-focus {
|
|
|
|
background: ${dt('treeselect.filled.focus.background')};
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-treeselect.p-invalid {
|
|
|
|
border-color: ${dt('treeselect.invalid.border.color')};
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-treeselect.p-disabled {
|
|
|
|
opacity: 1;
|
|
|
|
background: ${dt('treeselect.disabled.background')};
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-treeselect-dropdown {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
|
|
|
flex-shrink: 0;
|
|
|
|
background: transparent;
|
2024-05-05 17:12:09 +00:00
|
|
|
color: ${dt('treeselect.dropdown.color')};
|
2024-05-08 09:58:43 +00:00
|
|
|
width: ${dt('treeselect.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-treeselect-label-container {
|
|
|
|
overflow: hidden;
|
|
|
|
flex: 1 1 auto;
|
|
|
|
cursor: pointer;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-treeselect-label {
|
2024-05-08 09:58:43 +00:00
|
|
|
display: flex;
|
|
|
|
align-items-center;
|
|
|
|
gap: calc(${dt('treeselect.padding.y')} / 2);
|
2024-05-01 08:26:48 +00:00
|
|
|
white-space: nowrap;
|
|
|
|
cursor: pointer;
|
|
|
|
overflow: hidden;
|
|
|
|
text-overflow: ellipsis;
|
2024-05-08 09:58:43 +00:00
|
|
|
padding: ${dt('treeselect.padding.y')} ${dt('treeselect.padding.x')};
|
2024-05-01 08:26:48 +00:00
|
|
|
color: ${dt('treeselect.color')};
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-treeselect-label.p-placeholder {
|
|
|
|
color: ${dt('treeselect.placeholder.color')};
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-treeselect.p-disabled .p-treeselect-label {
|
|
|
|
color: ${dt('treeselect.disabled.color')};
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-treeselect-label-empty {
|
|
|
|
overflow: hidden;
|
|
|
|
visibility: hidden;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-treeselect .p-treeselect-overlay {
|
|
|
|
min-width: 100%;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-treeselect-overlay {
|
|
|
|
position: absolute;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
background: ${dt('treeselect.overlay.background')};
|
|
|
|
color: ${dt('treeselect.overlay.color')};
|
|
|
|
border: 1px solid ${dt('treeselect.overlay.border.color')};
|
2024-05-08 09:58:43 +00:00
|
|
|
border-radius: ${dt('treeselect.overlay.border.radius')};
|
|
|
|
box-shadow: ${dt('treeselect.overlay.shadow')};
|
2024-05-30 08:02:28 +00:00
|
|
|
overflow: hidden;
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
2024-05-30 08:08:49 +00:00
|
|
|
|
|
|
|
.p-treeselect-tree-container {
|
|
|
|
overflow: auto;
|
|
|
|
}
|
|
|
|
|
2024-05-01 08:26:48 +00:00
|
|
|
.p-treeselect-empty-message {
|
2024-05-08 09:58:43 +00:00
|
|
|
padding: ${dt('treeselect.empty.message.padding')};
|
2024-05-01 08:26:48 +00:00
|
|
|
background: transparent;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-fluid .p-treeselect {
|
|
|
|
display: flex;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-treeselect-overlay .p-tree {
|
2024-05-08 09:58:43 +00:00
|
|
|
padding: ${dt('treeselect.tree.padding')};
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-treeselect-label .p-chip {
|
|
|
|
padding-top: calc(${dt('treeselect.padding.y')} / 2);
|
|
|
|
padding-bottom: calc(${dt('treeselect.padding.y')} / 2);
|
|
|
|
border-radius: ${dt('treeselect.chip.border.radius')};
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-treeselect-label:has(.p-chip) {
|
|
|
|
padding: calc(${dt('treeselect.padding.y')} / 2) calc(${dt('treeselect.padding.x')} / 2);
|
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-treeselect p-component p-inputwrapper',
|
|
|
|
{
|
2024-04-07 11:02:54 +00:00
|
|
|
'p-treeselect-display-chip': props.display === 'chip',
|
2023-10-02 10:46:09 +00:00
|
|
|
'p-disabled': props.disabled,
|
2024-01-30 11:27:56 +00:00
|
|
|
'p-invalid': props.invalid,
|
2023-10-02 10:46:09 +00:00
|
|
|
'p-focus': instance.focused,
|
2024-05-27 10:28:07 +00:00
|
|
|
'p-variant-filled': props.variant ? props.variant === 'filled' : instance.$primevue.config.inputStyle === 'filled' || instance.$primevue.config.inputVariant === 'filled',
|
2023-10-02 10:46:09 +00:00
|
|
|
'p-inputwrapper-filled': !instance.emptyValue,
|
2024-04-07 11:02:54 +00:00
|
|
|
'p-inputwrapper-focus': instance.focused || instance.overlayVisible,
|
|
|
|
'p-treeselect-open': instance.overlayVisible
|
2023-10-02 10:46:09 +00:00
|
|
|
}
|
|
|
|
],
|
|
|
|
labelContainer: 'p-treeselect-label-container',
|
|
|
|
label: ({ instance, props }) => [
|
|
|
|
'p-treeselect-label',
|
|
|
|
{
|
|
|
|
'p-placeholder': instance.label === props.placeholder,
|
|
|
|
'p-treeselect-label-empty': !props.placeholder && instance.emptyValue
|
|
|
|
}
|
|
|
|
],
|
2024-05-15 07:35:36 +00:00
|
|
|
chip: 'p-treeselect-chip-item',
|
|
|
|
pcChip: 'p-treeselect-chip',
|
2024-05-03 11:46:02 +00:00
|
|
|
dropdown: 'p-treeselect-dropdown',
|
|
|
|
dropdownIcon: 'p-treeselect-dropdown-icon',
|
2024-05-08 15:58:22 +00:00
|
|
|
panel: 'p-treeselect-overlay p-component',
|
2024-05-06 13:10:13 +00:00
|
|
|
treeContainer: 'p-treeselect-tree-container',
|
2023-10-02 10:46:09 +00:00
|
|
|
emptyMessage: 'p-treeselect-empty-message'
|
|
|
|
};
|
|
|
|
|
|
|
|
export default BaseStyle.extend({
|
|
|
|
name: 'treeselect',
|
2024-05-01 08:26:48 +00:00
|
|
|
theme,
|
2023-10-02 10:46:09 +00:00
|
|
|
classes,
|
|
|
|
inlineStyles
|
|
|
|
});
|