2023-05-29 14:06:26 +00:00
|
|
|
<script>
|
|
|
|
import BaseComponent from 'primevue/basecomponent';
|
|
|
|
import { useStyle } from 'primevue/usestyle';
|
|
|
|
|
|
|
|
const styles = `
|
|
|
|
.p-menubar {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-menubar ul {
|
|
|
|
margin: 0;
|
|
|
|
padding: 0;
|
|
|
|
list-style: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-menubar .p-menuitem-link {
|
|
|
|
cursor: pointer;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
text-decoration: none;
|
|
|
|
overflow: hidden;
|
|
|
|
position: relative;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-menubar .p-menuitem-text {
|
|
|
|
line-height: 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-menubar .p-menuitem {
|
|
|
|
position: relative;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-menubar-root-list {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
flex-wrap: wrap;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-menubar-root-list > li ul {
|
|
|
|
display: none;
|
|
|
|
z-index: 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-menubar-root-list > .p-menuitem-active > .p-submenu-list {
|
|
|
|
display: block;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-menubar .p-submenu-list {
|
|
|
|
display: none;
|
|
|
|
position: absolute;
|
|
|
|
z-index: 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-menubar .p-submenu-list > .p-menuitem-active > .p-submenu-list {
|
|
|
|
display: block;
|
|
|
|
left: 100%;
|
|
|
|
top: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-menubar .p-submenu-list .p-menuitem .p-menuitem-content .p-menuitem-link .p-submenu-icon {
|
|
|
|
margin-left: auto;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-menubar .p-menubar-end {
|
|
|
|
margin-left: auto;
|
|
|
|
align-self: center;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-menubar-button {
|
|
|
|
display: none;
|
|
|
|
cursor: pointer;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
|
|
|
text-decoration: none;
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
const inlineStyles = {
|
2023-05-30 11:06:57 +00:00
|
|
|
submenu: ({ instance, processedItem }) => ({ display: instance.isItemActive(processedItem) ? 'block' : 'none' })
|
2023-05-29 14:06:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
const classes = {
|
|
|
|
root: ({ instance }) => [
|
|
|
|
'p-menubar p-component',
|
|
|
|
{
|
|
|
|
'p-menubar-mobile-active': instance.mobileActive
|
|
|
|
}
|
|
|
|
],
|
|
|
|
start: 'p-menubar-start',
|
|
|
|
button: 'p-menubar-button',
|
|
|
|
menu: 'p-menubar-root-list',
|
2023-05-30 11:06:57 +00:00
|
|
|
menuitem: ({ instance, processedItem }) => [
|
2023-05-29 14:06:26 +00:00
|
|
|
'p-menuitem',
|
|
|
|
{
|
2023-05-30 11:06:57 +00:00
|
|
|
'p-menuitem-active p-highlight': instance.isItemActive(processedItem),
|
|
|
|
'p-focus': instance.isItemFocused(processedItem),
|
|
|
|
'p-disabled': instance.isItemDisabled(processedItem)
|
2023-05-29 14:06:26 +00:00
|
|
|
}
|
|
|
|
],
|
|
|
|
content: 'p-menuitem-content',
|
2023-05-30 11:06:57 +00:00
|
|
|
action: ({ instance, isActive, isExactActive }) => [
|
2023-05-29 14:06:26 +00:00
|
|
|
'p-menuitem-link',
|
|
|
|
{
|
|
|
|
'router-link-active': isActive,
|
2023-05-30 11:06:57 +00:00
|
|
|
'router-link-active-exact': instance.exact && isExactActive
|
2023-05-29 14:06:26 +00:00
|
|
|
}
|
|
|
|
],
|
2023-05-30 05:56:53 +00:00
|
|
|
icon: 'p-menuitem-icon',
|
2023-05-29 14:06:26 +00:00
|
|
|
label: 'p-menuitem-text',
|
|
|
|
submenuIcon: 'p-submenu-icon',
|
|
|
|
submenu: 'p-submenu-list',
|
2023-05-30 05:56:53 +00:00
|
|
|
separator: 'p-menuitem-separator',
|
2023-05-29 14:06:26 +00:00
|
|
|
end: 'p-menubar-end'
|
|
|
|
};
|
|
|
|
|
2023-05-30 11:06:57 +00:00
|
|
|
const { load: loadStyle } = useStyle(styles, { id: 'primevue_menubar_style', manual: true });
|
2023-05-29 14:06:26 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'BaseMenubar',
|
|
|
|
extends: BaseComponent,
|
|
|
|
props: {
|
|
|
|
model: {
|
|
|
|
type: Array,
|
|
|
|
default: null
|
|
|
|
},
|
|
|
|
exact: {
|
|
|
|
type: Boolean,
|
|
|
|
default: true
|
|
|
|
},
|
|
|
|
buttonProps: {
|
|
|
|
type: null,
|
|
|
|
default: null
|
|
|
|
},
|
|
|
|
'aria-labelledby': {
|
|
|
|
type: String,
|
|
|
|
default: null
|
|
|
|
},
|
|
|
|
'aria-label': {
|
|
|
|
type: String,
|
|
|
|
default: null
|
|
|
|
}
|
|
|
|
},
|
|
|
|
css: {
|
|
|
|
classes,
|
2023-05-30 11:06:57 +00:00
|
|
|
inlineStyles,
|
|
|
|
loadStyle
|
2023-05-29 14:06:26 +00:00
|
|
|
},
|
2023-05-30 11:06:57 +00:00
|
|
|
provide() {
|
|
|
|
return {
|
|
|
|
$parentInstance: this
|
|
|
|
};
|
2023-05-29 14:06:26 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|