2023-10-02 10:46:09 +00:00
|
|
|
import BaseStyle from 'primevue/base/style';
|
|
|
|
|
|
|
|
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 }) => [
|
2024-04-09 13:51:16 +00:00
|
|
|
'p-megamenu-submenu-item',
|
2023-10-02 10:46:09 +00:00
|
|
|
{
|
|
|
|
'p-disabled': instance.isItemDisabled(processedItem)
|
|
|
|
}
|
|
|
|
],
|
|
|
|
menuitem: ({ instance, processedItem }) => [
|
2024-04-09 13:51:16 +00:00
|
|
|
'p-megamenu-item',
|
2023-10-02 10:46:09 +00:00
|
|
|
{
|
2024-04-09 13:51:16 +00:00
|
|
|
'p-megamenu-item-active': instance.isItemActive(processedItem),
|
2023-10-02 10:46:09 +00:00
|
|
|
'p-focus': instance.isItemFocused(processedItem),
|
|
|
|
'p-disabled': instance.isItemDisabled(processedItem)
|
|
|
|
}
|
|
|
|
],
|
2024-04-09 13:51:16 +00:00
|
|
|
content: 'p-megamenu-item-content',
|
|
|
|
action: 'p-megamenu-item-link',
|
|
|
|
icon: 'p-megamenu-item-icon',
|
|
|
|
label: 'p-megamenu-item-text',
|
|
|
|
submenuIcon: 'p-megamenu-submenu-icon',
|
2023-10-02 10:46:09 +00:00
|
|
|
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;
|
|
|
|
},
|
2024-04-09 13:51:16 +00:00
|
|
|
submenu: 'p-megamenu-submenu',
|
|
|
|
submenuLabel: 'p-megamenu-submenu-item-label',
|
|
|
|
separator: 'p-megamenu-separator',
|
2023-10-02 10:46:09 +00:00
|
|
|
end: 'p-megamenu-end'
|
|
|
|
};
|
|
|
|
|
|
|
|
export default BaseStyle.extend({
|
|
|
|
name: 'megamenu',
|
|
|
|
classes,
|
|
|
|
inlineStyles
|
|
|
|
});
|