2023-05-29 09:09:48 +00:00
|
|
|
<script>
|
|
|
|
import BaseComponent from 'primevue/basecomponent';
|
|
|
|
import { useStyle } from 'primevue/usestyle';
|
|
|
|
|
|
|
|
const styles = `
|
2023-09-26 09:14:27 +00:00
|
|
|
@layer primevue {
|
2023-09-25 19:11:55 +00:00
|
|
|
.p-menu ul {
|
|
|
|
margin: 0;
|
|
|
|
padding: 0;
|
|
|
|
list-style: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-menu .p-menuitem-link {
|
|
|
|
cursor: pointer;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
text-decoration: none;
|
|
|
|
overflow: hidden;
|
|
|
|
position: relative;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-menu .p-menuitem-text {
|
|
|
|
line-height: 1;
|
|
|
|
}
|
2023-05-29 09:09:48 +00:00
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
const classes = {
|
|
|
|
root: ({ instance, props }) => [
|
|
|
|
'p-menu p-component',
|
|
|
|
{
|
|
|
|
'p-menu-overlay': props.popup,
|
|
|
|
'p-input-filled': instance.$primevue.config.inputStyle === 'filled',
|
|
|
|
'p-ripple-disabled': instance.$primevue.config.ripple === false
|
|
|
|
}
|
|
|
|
],
|
|
|
|
start: 'p-menu-start',
|
|
|
|
menu: 'p-menu-list p-reset',
|
|
|
|
submenuHeader: 'p-submenu-header',
|
2023-05-30 05:51:28 +00:00
|
|
|
separator: 'p-menuitem-separator',
|
2023-05-29 09:09:48 +00:00
|
|
|
end: 'p-menu-end',
|
2023-05-30 11:06:57 +00:00
|
|
|
menuitem: ({ instance }) => [
|
2023-05-29 09:09:48 +00:00
|
|
|
'p-menuitem',
|
|
|
|
{
|
2023-05-30 11:06:57 +00:00
|
|
|
'p-focus': instance.id === instance.focusedOptionId,
|
|
|
|
'p-disabled': instance.disabled()
|
2023-05-29 09:09:48 +00:00
|
|
|
}
|
|
|
|
],
|
|
|
|
content: 'p-menuitem-content',
|
2023-05-30 12:02:59 +00:00
|
|
|
action: ({ props, isActive, isExactActive }) => [
|
2023-05-29 09:09:48 +00:00
|
|
|
'p-menuitem-link',
|
|
|
|
{
|
2023-05-29 11:13:36 +00:00
|
|
|
'router-link-active': isActive,
|
2023-05-30 12:02:59 +00:00
|
|
|
'router-link-active-exact': props.exact && isExactActive
|
2023-05-29 09:09:48 +00:00
|
|
|
}
|
|
|
|
],
|
2023-05-30 05:51:28 +00:00
|
|
|
icon: 'p-menuitem-icon',
|
2023-05-29 09:09:48 +00:00
|
|
|
label: 'p-menuitem-text'
|
|
|
|
};
|
|
|
|
|
2023-07-03 22:20:35 +00:00
|
|
|
const { load: loadStyle } = useStyle(styles, { name: 'menu', manual: true });
|
2023-05-29 09:09:48 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'BaseMenu',
|
|
|
|
extends: BaseComponent,
|
|
|
|
props: {
|
|
|
|
popup: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false
|
|
|
|
},
|
|
|
|
model: {
|
|
|
|
type: Array,
|
|
|
|
default: null
|
|
|
|
},
|
|
|
|
appendTo: {
|
|
|
|
type: String,
|
|
|
|
default: 'body'
|
|
|
|
},
|
|
|
|
autoZIndex: {
|
|
|
|
type: Boolean,
|
|
|
|
default: true
|
|
|
|
},
|
|
|
|
baseZIndex: {
|
|
|
|
type: Number,
|
|
|
|
default: 0
|
|
|
|
},
|
|
|
|
exact: {
|
|
|
|
type: Boolean,
|
|
|
|
default: true
|
|
|
|
},
|
|
|
|
tabindex: {
|
|
|
|
type: Number,
|
|
|
|
default: 0
|
|
|
|
},
|
|
|
|
'aria-label': {
|
|
|
|
type: String,
|
|
|
|
default: null
|
|
|
|
},
|
|
|
|
'aria-labelledby': {
|
|
|
|
type: String,
|
|
|
|
default: null
|
|
|
|
}
|
|
|
|
},
|
|
|
|
css: {
|
2023-05-30 11:06:57 +00:00
|
|
|
classes,
|
|
|
|
loadStyle
|
2023-05-29 09:09:48 +00:00
|
|
|
},
|
2023-05-30 11:06:57 +00:00
|
|
|
provide() {
|
|
|
|
return {
|
|
|
|
$parentInstance: this
|
|
|
|
};
|
2023-05-29 09:09:48 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|