2023-05-30 08:25:54 +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-panelmenu .p-panelmenu-header-action {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
user-select: none;
|
|
|
|
cursor: pointer;
|
|
|
|
position: relative;
|
|
|
|
text-decoration: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-panelmenu .p-panelmenu-header-action:focus {
|
|
|
|
z-index: 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-panelmenu .p-submenu-list {
|
|
|
|
margin: 0;
|
|
|
|
padding: 0;
|
|
|
|
list-style: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-panelmenu .p-menuitem-link {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
user-select: none;
|
|
|
|
cursor: pointer;
|
|
|
|
text-decoration: none;
|
|
|
|
position: relative;
|
|
|
|
overflow: hidden;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-panelmenu .p-menuitem-text {
|
|
|
|
line-height: 1;
|
|
|
|
}
|
2023-05-30 08:25:54 +00:00
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
const classes = {
|
|
|
|
root: 'p-panelmenu p-component',
|
|
|
|
panel: 'p-panelmenu-panel',
|
|
|
|
header: ({ instance, item }) => [
|
|
|
|
'p-panelmenu-header',
|
|
|
|
{
|
|
|
|
'p-highlight': instance.isItemActive(item),
|
|
|
|
'p-disabled': instance.isItemDisabled(item)
|
|
|
|
}
|
|
|
|
],
|
|
|
|
headerContent: 'p-panelmenu-header-content',
|
|
|
|
headerAction: ({ instance, isActive, isExactActive }) => [
|
|
|
|
'p-panelmenu-header-action',
|
|
|
|
{
|
|
|
|
'router-link-active': isActive,
|
|
|
|
'router-link-active-exact': instance.exact && isExactActive
|
|
|
|
}
|
|
|
|
],
|
|
|
|
headerIcon: 'p-menuitem-icon',
|
|
|
|
headerLabel: 'p-menuitem-text',
|
|
|
|
toggleableContent: 'p-toggleable-content',
|
|
|
|
menuContent: 'p-panelmenu-content',
|
|
|
|
menu: 'p-panelmenu-root-list',
|
2023-05-30 11:06:57 +00:00
|
|
|
menuitem: ({ instance, processedItem }) => [
|
2023-05-30 08:25:54 +00:00
|
|
|
'p-menuitem',
|
|
|
|
{
|
2023-05-30 11:06:57 +00:00
|
|
|
'p-focus': instance.isItemFocused(processedItem),
|
|
|
|
'p-disabled': instance.isItemDisabled(processedItem)
|
2023-05-30 08:25:54 +00:00
|
|
|
}
|
|
|
|
],
|
|
|
|
content: 'p-menuitem-content',
|
2023-05-30 12:02:59 +00:00
|
|
|
action: ({ props, isActive, isExactActive }) => [
|
2023-05-30 08:25:54 +00:00
|
|
|
'p-menuitem-link',
|
|
|
|
{
|
|
|
|
'router-link-active': isActive,
|
2023-05-30 12:02:59 +00:00
|
|
|
'router-link-active-exact': props.exact && isExactActive
|
2023-05-30 08:25:54 +00:00
|
|
|
}
|
|
|
|
],
|
|
|
|
icon: 'p-menuitem-icon',
|
|
|
|
label: 'p-menuitem-text',
|
|
|
|
submenuIcon: 'p-submenu-icon',
|
|
|
|
submenu: 'p-submenu-list',
|
|
|
|
separator: 'p-menuitem-separator'
|
|
|
|
};
|
|
|
|
|
2023-07-03 22:20:35 +00:00
|
|
|
const { load: loadStyle } = useStyle(styles, { name: 'panelmenu', manual: true });
|
2023-05-30 08:25:54 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'BasePanelMenu',
|
|
|
|
extends: BaseComponent,
|
|
|
|
props: {
|
|
|
|
model: {
|
|
|
|
type: Array,
|
|
|
|
default: null
|
|
|
|
},
|
|
|
|
expandedKeys: {
|
|
|
|
type: Object,
|
|
|
|
default: null
|
|
|
|
},
|
|
|
|
exact: {
|
|
|
|
type: Boolean,
|
|
|
|
default: true
|
|
|
|
},
|
|
|
|
tabindex: {
|
|
|
|
type: Number,
|
|
|
|
default: 0
|
|
|
|
}
|
|
|
|
},
|
|
|
|
css: {
|
2023-05-30 11:06:57 +00:00
|
|
|
classes,
|
|
|
|
loadStyle
|
2023-05-30 08:25:54 +00:00
|
|
|
},
|
2023-05-30 11:06:57 +00:00
|
|
|
provide() {
|
|
|
|
return {
|
|
|
|
$parentInstance: this
|
|
|
|
};
|
2023-05-30 08:25:54 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|