2023-10-02 10:46:09 +00:00
|
|
|
import BaseStyle from 'primevue/base/style';
|
|
|
|
|
|
|
|
const css = `
|
|
|
|
@layer primevue {
|
|
|
|
.p-megamenu {
|
|
|
|
display: flex;
|
2023-11-08 18:16:31 +00:00
|
|
|
position: relative;
|
2023-10-02 10:46:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-megamenu-root-list {
|
|
|
|
margin: 0;
|
|
|
|
padding: 0;
|
|
|
|
list-style: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-megamenu .p-menuitem-link {
|
|
|
|
cursor: pointer;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
text-decoration: none;
|
|
|
|
overflow: hidden;
|
|
|
|
position: relative;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-megamenu .p-menuitem-text {
|
|
|
|
line-height: 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-megamenu-panel {
|
|
|
|
display: none;
|
|
|
|
width: auto;
|
|
|
|
z-index: 1;
|
2023-11-08 18:16:31 +00:00
|
|
|
left: 0;
|
|
|
|
min-width: 100%;
|
2023-10-02 10:46:09 +00:00
|
|
|
}
|
|
|
|
|
2023-11-16 14:30:11 +00:00
|
|
|
.p-megamenu-panel:not(.p-megamenu-mobile) {
|
|
|
|
position: absolute;
|
|
|
|
}
|
|
|
|
|
2023-10-02 10:46:09 +00:00
|
|
|
.p-megamenu-root-list > .p-menuitem-active > .p-megamenu-panel {
|
|
|
|
display: block;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-megamenu-submenu {
|
|
|
|
margin: 0;
|
|
|
|
padding: 0;
|
|
|
|
list-style: none;
|
|
|
|
}
|
|
|
|
|
2023-11-15 11:30:23 +00:00
|
|
|
.p-megamenu-button {
|
|
|
|
display: none;
|
|
|
|
cursor: pointer;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
|
|
|
text-decoration: none;
|
|
|
|
}
|
|
|
|
|
2023-10-02 10:46:09 +00:00
|
|
|
/* Horizontal */
|
|
|
|
.p-megamenu-horizontal {
|
|
|
|
align-items: center;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-megamenu-horizontal .p-megamenu-root-list {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
flex-wrap: wrap;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-megamenu-horizontal .p-megamenu-end {
|
|
|
|
margin-left: auto;
|
|
|
|
align-self: center;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Vertical */
|
|
|
|
.p-megamenu-vertical {
|
|
|
|
flex-direction: column;
|
|
|
|
}
|
2023-11-23 07:25:58 +00:00
|
|
|
|
|
|
|
.p-megamenu-vertical:not(.p-megamenu-mobile) {
|
|
|
|
display: inline-flex;
|
|
|
|
}
|
2023-10-02 10:46:09 +00:00
|
|
|
|
|
|
|
.p-megamenu-vertical .p-megamenu-root-list {
|
|
|
|
flex-direction: column;
|
|
|
|
}
|
|
|
|
|
2023-11-16 14:30:11 +00:00
|
|
|
.p-megamenu-vertical:not(.p-megamenu-mobile) .p-megamenu-root-list > .p-menuitem-active > .p-megamenu-panel {
|
2023-10-02 10:46:09 +00:00
|
|
|
left: 100%;
|
|
|
|
top: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-megamenu-vertical .p-megamenu-root-list > .p-menuitem > .p-menuitem-content > .p-menuitem-link > .p-submenu-icon {
|
|
|
|
margin-left: auto;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-megamenu-grid {
|
|
|
|
display: flex;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-megamenu-col-2,
|
|
|
|
.p-megamenu-col-3,
|
|
|
|
.p-megamenu-col-4,
|
|
|
|
.p-megamenu-col-6,
|
|
|
|
.p-megamenu-col-12 {
|
|
|
|
flex: 0 0 auto;
|
|
|
|
padding: 0.5rem;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-megamenu-col-2 {
|
|
|
|
width: 16.6667%;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-megamenu-col-3 {
|
|
|
|
width: 25%;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-megamenu-col-4 {
|
|
|
|
width: 33.3333%;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-megamenu-col-6 {
|
|
|
|
width: 50%;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-megamenu-col-12 {
|
|
|
|
width: 100%;
|
|
|
|
}
|
2023-11-15 10:16:57 +00:00
|
|
|
|
2023-11-16 14:30:11 +00:00
|
|
|
.p-megamenu.p-megamenu-mobile .p-megamenu-button {
|
2023-11-15 11:30:23 +00:00
|
|
|
display: flex;
|
|
|
|
}
|
|
|
|
|
2023-11-16 14:30:11 +00:00
|
|
|
.p-megamenu.p-megamenu-mobile .p-megamenu-root-list {
|
2023-11-15 11:30:23 +00:00
|
|
|
position: absolute;
|
|
|
|
display: none;
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-megamenu.p-megamenu-mobile .p-submenu-list {
|
|
|
|
width: 100%;
|
|
|
|
position: static;
|
|
|
|
box-shadow: none;
|
|
|
|
border: 0 none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-megamenu.p-megamenu-mobile .p-megamenu-root-list .p-menuitem {
|
|
|
|
width: 100%;
|
|
|
|
position: static;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-megamenu.p-megamenu-mobile-active .p-megamenu-root-list {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
top: 100%;
|
|
|
|
left: 0;
|
|
|
|
z-index: 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-megamenu.p-megamenu-mobile .p-megamenu-grid {
|
2023-11-15 10:16:57 +00:00
|
|
|
flex-wrap: wrap;
|
|
|
|
overflow: auto;
|
|
|
|
max-height: 90%;
|
|
|
|
}
|
2023-10-02 10:46:09 +00:00
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
const inlineStyles = {
|
|
|
|
submenu: ({ instance, processedItem }) => ({ display: instance.isItemActive(processedItem) ? 'block' : 'none' })
|
|
|
|
};
|
|
|
|
|
|
|
|
const classes = {
|
|
|
|
root: ({ instance }) => [
|
|
|
|
'p-megamenu p-component',
|
|
|
|
{
|
2023-11-15 10:16:57 +00:00
|
|
|
'p-megamenu-mobile': instance.queryMatches,
|
2023-11-15 11:30:23 +00:00
|
|
|
'p-megamenu-mobile-active': instance.mobileActive,
|
2023-10-02 10:46:09 +00:00
|
|
|
'p-megamenu-horizontal': instance.horizontal,
|
|
|
|
'p-megamenu-vertical': instance.vertical
|
|
|
|
}
|
|
|
|
],
|
|
|
|
start: 'p-megamenu-start',
|
2023-11-15 11:30:23 +00:00
|
|
|
menubutton: 'p-megamenu-button',
|
2023-10-02 10:46:09 +00:00
|
|
|
menu: 'p-megamenu-root-list',
|
|
|
|
submenuHeader: ({ instance, processedItem }) => [
|
|
|
|
'p-megamenu-submenu-header p-submenu-header',
|
|
|
|
{
|
|
|
|
'p-disabled': instance.isItemDisabled(processedItem)
|
|
|
|
}
|
|
|
|
],
|
|
|
|
menuitem: ({ instance, processedItem }) => [
|
|
|
|
'p-menuitem',
|
|
|
|
{
|
|
|
|
'p-menuitem-active p-highlight': instance.isItemActive(processedItem),
|
|
|
|
'p-focus': instance.isItemFocused(processedItem),
|
|
|
|
'p-disabled': instance.isItemDisabled(processedItem)
|
|
|
|
}
|
|
|
|
],
|
|
|
|
content: 'p-menuitem-content',
|
2023-11-08 12:48:37 +00:00
|
|
|
action: 'p-menuitem-link',
|
2023-10-02 10:46:09 +00:00
|
|
|
icon: 'p-menuitem-icon',
|
|
|
|
label: 'p-menuitem-text',
|
|
|
|
submenuIcon: 'p-submenu-icon',
|
|
|
|
panel: 'p-megamenu-panel',
|
|
|
|
grid: 'p-megamenu-grid',
|
|
|
|
column: ({ instance, processedItem }) => {
|
|
|
|
let length = instance.isItemGroup(processedItem) ? processedItem.items.length : 0;
|
|
|
|
let columnClass;
|
|
|
|
|
2023-11-15 10:16:57 +00:00
|
|
|
if (instance.$parentInstance.queryMatches) columnClass = 'p-megamenu-col-12';
|
|
|
|
else {
|
|
|
|
switch (length) {
|
|
|
|
case 2:
|
|
|
|
columnClass = 'p-megamenu-col-6';
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
columnClass = 'p-megamenu-col-4';
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 4:
|
|
|
|
columnClass = 'p-megamenu-col-3';
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 6:
|
|
|
|
columnClass = 'p-megamenu-col-2';
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
columnClass = 'p-megamenu-col-12';
|
|
|
|
break;
|
|
|
|
}
|
2023-10-02 10:46:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return columnClass;
|
|
|
|
},
|
|
|
|
submenu: 'p-submenu-list p-megamenu-submenu',
|
2023-10-25 12:20:58 +00:00
|
|
|
submenuLabel: 'p-menuitem-text',
|
2023-10-02 10:46:09 +00:00
|
|
|
separator: 'p-menuitem-separator',
|
|
|
|
end: 'p-megamenu-end'
|
|
|
|
};
|
|
|
|
|
|
|
|
export default BaseStyle.extend({
|
|
|
|
name: 'megamenu',
|
|
|
|
css,
|
|
|
|
classes,
|
|
|
|
inlineStyles
|
|
|
|
});
|