2023-05-29 12:31:43 +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-tieredmenu ul {
|
|
|
|
margin: 0;
|
|
|
|
padding: 0;
|
|
|
|
list-style: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-tieredmenu .p-submenu-list {
|
|
|
|
position: absolute;
|
|
|
|
min-width: 100%;
|
|
|
|
z-index: 1;
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-tieredmenu .p-menuitem-link {
|
|
|
|
cursor: pointer;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
text-decoration: none;
|
|
|
|
overflow: hidden;
|
|
|
|
position: relative;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-tieredmenu .p-menuitem-text {
|
|
|
|
line-height: 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-tieredmenu .p-menuitem {
|
|
|
|
position: relative;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-tieredmenu .p-menuitem-link .p-submenu-icon {
|
|
|
|
margin-left: auto;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-tieredmenu .p-menuitem-active > .p-submenu-list {
|
|
|
|
display: block;
|
|
|
|
left: 100%;
|
|
|
|
top: 0;
|
|
|
|
}
|
2023-05-29 12:31:43 +00:00
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
const inlineStyles = {
|
2023-05-30 11:06:57 +00:00
|
|
|
submenu: ({ instance, processedItem }) => ({ display: instance.isItemActive(processedItem) ? 'block' : 'none' })
|
2023-05-29 12:31:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
const classes = {
|
|
|
|
root: ({ instance, props }) => [
|
|
|
|
'p-tieredmenu p-component',
|
|
|
|
{
|
|
|
|
'p-tieredmenu-overlay': props.popup,
|
|
|
|
'p-input-filled': instance.$primevue.config.inputStyle === 'filled',
|
|
|
|
'p-ripple-disabled': instance.$primevue.config.ripple === false
|
|
|
|
}
|
|
|
|
],
|
|
|
|
menu: 'p-tieredmenu-root-list',
|
2023-05-30 11:06:57 +00:00
|
|
|
menuitem: ({ instance, processedItem }) => [
|
2023-05-29 12:31:43 +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 12:31:43 +00:00
|
|
|
}
|
|
|
|
],
|
|
|
|
content: 'p-menuitem-content',
|
2023-05-30 12:02:59 +00:00
|
|
|
action: ({ props, isActive, isExactActive }) => [
|
2023-05-29 12:31:43 +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-29 12:31:43 +00:00
|
|
|
}
|
|
|
|
],
|
2023-05-30 05:51:28 +00:00
|
|
|
icon: 'p-menuitem-icon',
|
2023-05-29 12:31:43 +00:00
|
|
|
text: 'p-menuitem-text',
|
|
|
|
submenuIcon: 'p-submenu-icon',
|
2023-05-30 05:56:53 +00:00
|
|
|
submenu: 'p-submenu-list',
|
|
|
|
separator: 'p-menuitem-separator'
|
2023-05-29 12:31:43 +00:00
|
|
|
};
|
|
|
|
|
2023-07-03 22:20:35 +00:00
|
|
|
const { load: loadStyle } = useStyle(styles, { name: 'tieredmenu', manual: true });
|
2023-05-29 12:31:43 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'BaseTieredMenu',
|
|
|
|
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
|
|
|
|
},
|
|
|
|
disabled: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false
|
|
|
|
},
|
|
|
|
tabindex: {
|
|
|
|
type: Number,
|
|
|
|
default: 0
|
|
|
|
},
|
|
|
|
'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 12:31:43 +00:00
|
|
|
},
|
2023-05-30 11:06:57 +00:00
|
|
|
provide() {
|
|
|
|
return {
|
|
|
|
$parentInstance: this
|
|
|
|
};
|
2023-05-29 12:31:43 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|