Initiated MegaMenu Structure
parent
136a31b993
commit
582a726e40
|
@ -129,6 +129,7 @@
|
|||
<router-link to="/menumodel">● MenuModel</router-link>
|
||||
<router-link to="/breadcrumb">● Breadcrumb</router-link>
|
||||
<router-link to="/contextmenu">● ContextMenu</router-link>
|
||||
<router-link to="/megamenu">● MegaMenu</router-link>
|
||||
<router-link to="/menu">● Menu</router-link>
|
||||
<router-link to="/menubar">● Menubar</router-link>
|
||||
<router-link to="/tieredmenu">● TieredMenu</router-link>
|
||||
|
|
|
@ -0,0 +1,179 @@
|
|||
<template>
|
||||
<div :class="containerClass">
|
||||
<ul class="p-megamenu-root-list">
|
||||
<li v-for="(category,index) of model" :key="category.label + '_' + index" :class="getCategoryClass(category)" :style="category.style"
|
||||
@mouseenter="onCategoryMouseEnter($event, category)">
|
||||
<a :href="category.url||'#'" class="p-menuitem-link" :target="category.target" @click="onCategoryClick($event, category)" @keydown="onCategoryKeydown($event, category)">
|
||||
<span v-if="category.icon" :class="getCategoryIcon(category)"></span>
|
||||
<span class="p-menuitem-text">{{category.label}}</span>
|
||||
<span v-if="category.items" :class="getCategorySubMenuIcon(category)"></span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="p-menubar-custom" v-if="$slots.default">
|
||||
<slot></slot>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
model: {
|
||||
type: Array,
|
||||
default: null
|
||||
},
|
||||
orientation: {
|
||||
type: String,
|
||||
default: 'horizontal'
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
activeItem: null
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
itemClick(event) {
|
||||
|
||||
},
|
||||
onCategoryMouseEnter(event, category) {
|
||||
|
||||
},
|
||||
onCategoryClick(event, category) {
|
||||
|
||||
},
|
||||
onCategoryKeydown(event, category) {
|
||||
|
||||
},
|
||||
getCategoryClass(category) {
|
||||
return ['p-menuitem', {
|
||||
'p-menuitem-active': category === this.activeItem,
|
||||
'p-disabled': category.disabled
|
||||
}, category.class];
|
||||
},
|
||||
getCategorySubMenuIcon(category) {
|
||||
return ['p-submenu-icon pi pi-fw', {
|
||||
'pi-caret-down': this.horizontal,
|
||||
'pi-caret-right': this.vertical
|
||||
}];
|
||||
},
|
||||
getCategoryIcon(category) {
|
||||
return ['p-menuitem-icon', category.icon];
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
containerClass() {
|
||||
return ['p-megamenu p-component', {
|
||||
'p-megamenu-horizontal': this.horizontal,
|
||||
'p-megamenu-vertical': this.vertical
|
||||
}];
|
||||
},
|
||||
horizontal() {
|
||||
return this.orientation === 'horizontal';
|
||||
},
|
||||
vertical() {
|
||||
return this.orientation === 'vertical';
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.p-megamenu {
|
||||
padding: .25em;
|
||||
}
|
||||
|
||||
.p-megamenu-root-list {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.p-megamenu-root-list > .p-menuitem {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.p-megamenu .p-menuitem-link {
|
||||
padding: .25em;
|
||||
display: block;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.p-megamenu .p-menuitem-icon {
|
||||
margin-right: .25em;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.p-megamenu .p-menuitem-text {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.p-megamenu-panel {
|
||||
display: none;
|
||||
position: absolute;
|
||||
width: auto;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.p-megamenu-root-list > .p-menuitem-active > .p-megamenu-panel {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.p-megamenu-panel .p-menuitem {
|
||||
margin: .125em 0;
|
||||
}
|
||||
|
||||
.p-megamenu-submenu {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
width: 12.5em;
|
||||
}
|
||||
|
||||
.p-megamenu-submenu-header {
|
||||
padding: .25em;
|
||||
}
|
||||
|
||||
/* Horizontal */
|
||||
.p-megamenu-horizontal .p-megamenu-root-list > .p-menuitem {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.p-megamenu-horizontal .p-megamenu-root-list > .p-menuitem > .p-menuitem-link > .p-submenu-icon {
|
||||
vertical-align: middle;
|
||||
margin-left: .25em;
|
||||
}
|
||||
|
||||
/* Vertical */
|
||||
.p-megamenu-vertical {
|
||||
width: 12.5em;
|
||||
}
|
||||
|
||||
.p-megamenu-vertical .p-megamenu-root-list > .p-menuitem {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.p-megamenu-vertical .p-megamenu-root-list > .p-menuitem > .p-menuitem-link {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.p-megamenu-vertical .p-megamenu-root-list > .p-menuitem-active > .p-megamenu-panel {
|
||||
left: 100%;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.p-megamenu-vertical .p-megamenu-root-list > .p-menuitem > .p-menuitem-link > .p-submenu-icon {
|
||||
position: absolute;
|
||||
width: 1em;
|
||||
height: 1em;
|
||||
top: 50%;
|
||||
right: 0;
|
||||
margin-top: -.5em;
|
||||
}
|
||||
|
||||
.p-megamenu .p-grid {
|
||||
-ms-flex-wrap: nowrap;
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
</style>
|
|
@ -29,6 +29,7 @@ import Inplace from './components/inplace/Inplace';
|
|||
import InputSwitch from './components/inputswitch/InputSwitch';
|
||||
import InputText from './components/inputtext/InputText';
|
||||
import Listbox from './components/listbox/Listbox';
|
||||
import MegaMenu from './components/megamenu/MegaMenu';
|
||||
import Menu from './components/menu/Menu';
|
||||
import Menubar from './components/menubar/Menubar';
|
||||
import Message from './components/message/Message';
|
||||
|
@ -106,6 +107,7 @@ Vue.component('Inplace', Inplace);
|
|||
Vue.component('InputSwitch', InputSwitch);
|
||||
Vue.component('InputText', InputText);
|
||||
Vue.component('Listbox', Listbox);
|
||||
Vue.component('MegaMenu', MegaMenu);
|
||||
Vue.component('Menu', Menu);
|
||||
Vue.component('Menubar', Menubar);
|
||||
Vue.component('Message', Message);
|
||||
|
|
|
@ -296,6 +296,11 @@ export default new Router({
|
|||
name: 'listbox',
|
||||
component: () => import('./views/listbox/ListboxDemo.vue')
|
||||
},
|
||||
{
|
||||
path: '/megamenu',
|
||||
name: 'megamenu',
|
||||
component: () => import('./views/megamenu/MegaMenuDemo.vue')
|
||||
},
|
||||
{
|
||||
path: '/menu',
|
||||
name: 'menu',
|
||||
|
|
|
@ -0,0 +1,142 @@
|
|||
<template>
|
||||
<div>
|
||||
<div class="content-section introduction">
|
||||
<div class="feature-intro">
|
||||
<h1>MegaMenu</h1>
|
||||
<p>MegaMenu is navigation component that displays submenus together.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="content-section implementation">
|
||||
<MegaMenu :model="items" />
|
||||
</div>
|
||||
|
||||
<MegaMenuDoc />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import MegaMenuDoc from './MegaMenuDoc';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
items: [
|
||||
{
|
||||
label: 'Videos', icon: 'pi pi-fw pi-video',
|
||||
items: [
|
||||
[
|
||||
{
|
||||
label: 'Video 1',
|
||||
items: [{label: 'Video 1.1'}, {label: 'Video 1.2'}]
|
||||
},
|
||||
{
|
||||
label: 'Video 2',
|
||||
items: [{label: 'Video 2.1'}, {label: 'Video 2.2'}]
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
label: 'Video 3',
|
||||
items: [{label: 'Video 3.1'}, {label: 'Video 3.2'}]
|
||||
},
|
||||
{
|
||||
label: 'Video 4',
|
||||
items: [{label: 'Video 4.1'}, {label: 'Video 4.2'}]
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'Users', icon: 'pi pi-fw pi-users',
|
||||
items: [
|
||||
[
|
||||
{
|
||||
label: 'User 1',
|
||||
items: [{label: 'User 1.1'}, {label: 'User 1.2'}]
|
||||
},
|
||||
{
|
||||
label: 'User 2',
|
||||
items: [{label: 'User 2.1'}, {label: 'User 2.2'}]
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
label: 'User 3',
|
||||
items: [{label: 'User 3.1'}, {label: 'User 3.2'}]
|
||||
},
|
||||
{
|
||||
label: 'User 4',
|
||||
items: [{label: 'User 4.1'}, {label: 'User 4.2'}]
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
label: 'User 5',
|
||||
items: [{label: 'User 5.1'}, {label: 'User 5.2'}]
|
||||
},
|
||||
{
|
||||
label: 'User 6',
|
||||
items: [{label: 'User 6.1'}, {label: 'User 6.2'}]
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'Events', icon: 'pi pi-fw pi-calendar',
|
||||
items: [
|
||||
[
|
||||
{
|
||||
label: 'Event 1',
|
||||
items: [{label: 'Event 1.1'}, {label: 'Event 1.2'}]
|
||||
},
|
||||
{
|
||||
label: 'Event 2',
|
||||
items: [{label: 'Event 2.1'}, {label: 'Event 2.2'}]
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
label: 'Event 3',
|
||||
items: [{label: 'Event 3.1'}, {label: 'Event 3.2'}]
|
||||
},
|
||||
{
|
||||
label: 'Event 4',
|
||||
items: [{label: 'Event 4.1'}, {label: 'Event 4.2'}]
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'Settings', icon: 'pi pi-fw pi-cog',
|
||||
items: [
|
||||
[
|
||||
{
|
||||
label: 'Setting 1',
|
||||
items: [{label: 'Setting 1.1'}, {label: 'Setting 1.2'}]
|
||||
},
|
||||
{
|
||||
label: 'Setting 2',
|
||||
items: [{label: 'Setting 2.1'}, {label: 'Setting 2.2'}]
|
||||
},
|
||||
{
|
||||
label: 'Setting 3',
|
||||
items: [{label: 'Setting 3.1'}, {label: 'Setting 3.2'}]
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
label: 'Technology 4',
|
||||
items: [{label: 'Setting 4.1'}, {label: 'Setting 4.2'}]
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
components: {
|
||||
'MegaMenuDoc': MegaMenuDoc
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,378 @@
|
|||
<template>
|
||||
<div class="content-section documentation">
|
||||
<TabView>
|
||||
<TabPanel header="Documentation">
|
||||
<h3>Import</h3>
|
||||
<CodeHighlight lang="javascript">
|
||||
import Menubar from 'primevue/menubar';
|
||||
</CodeHighlight>
|
||||
|
||||
<h3>MenuModel</h3>
|
||||
<p>Menubar uses the common MenuModel API to define the items, visit <router-link to="/menumodel">MenuModel API</router-link> for details.</p>
|
||||
|
||||
<h3>Getting Started</h3>
|
||||
<p>Menubar requires a collection of menuitems as its model.</p>
|
||||
<CodeHighlight>
|
||||
<Menubar :model="items" />
|
||||
</CodeHighlight>
|
||||
|
||||
<CodeHighlight lang="js">
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
items: [
|
||||
{
|
||||
label:'File',
|
||||
icon:'pi pi-fw pi-file',
|
||||
items:[
|
||||
{
|
||||
label:'New',
|
||||
icon:'pi pi-fw pi-plus',
|
||||
items:[
|
||||
{
|
||||
label:'Bookmark',
|
||||
icon:'pi pi-fw pi-bookmark'
|
||||
},
|
||||
{
|
||||
label:'Video',
|
||||
icon:'pi pi-fw pi-video'
|
||||
},
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
label:'Delete',
|
||||
icon:'pi pi-fw pi-trash'
|
||||
},
|
||||
{
|
||||
separator:true
|
||||
},
|
||||
{
|
||||
label:'Export',
|
||||
icon:'pi pi-fw pi-external-link'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label:'Edit',
|
||||
icon:'pi pi-fw pi-pencil',
|
||||
items:[
|
||||
{
|
||||
label:'Left',
|
||||
icon:'pi pi-fw pi-align-left'
|
||||
},
|
||||
{
|
||||
label:'Right',
|
||||
icon:'pi pi-fw pi-align-right'
|
||||
},
|
||||
{
|
||||
label:'Center',
|
||||
icon:'pi pi-fw pi-align-center'
|
||||
},
|
||||
{
|
||||
label:'Justify',
|
||||
icon:'pi pi-fw pi-align-justify'
|
||||
},
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
label:'Users',
|
||||
icon:'pi pi-fw pi-user',
|
||||
items:[
|
||||
{
|
||||
label:'New',
|
||||
icon:'pi pi-fw pi-user-plus',
|
||||
|
||||
},
|
||||
{
|
||||
label:'Delete',
|
||||
icon:'pi pi-fw pi-user-minus',
|
||||
|
||||
},
|
||||
{
|
||||
label:'Search',
|
||||
icon:'pi pi-fw pi-users',
|
||||
items:[
|
||||
{
|
||||
label:'Filter',
|
||||
icon:'pi pi-fw pi-filter',
|
||||
items:[
|
||||
{
|
||||
label:'Print',
|
||||
icon:'pi pi-fw pi-print'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
icon:'pi pi-fw pi-bars',
|
||||
label:'List'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label:'Events',
|
||||
icon:'pi pi-fw pi-calendar',
|
||||
items:[
|
||||
{
|
||||
label:'Edit',
|
||||
icon:'pi pi-fw pi-pencil',
|
||||
items:[
|
||||
{
|
||||
label:'Save',
|
||||
icon:'pi pi-fw pi-calendar-plus'
|
||||
},
|
||||
{
|
||||
label:'Delete',
|
||||
icon:'pi pi-fw pi-calendar-minus'
|
||||
},
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
label:'Archieve',
|
||||
icon:'pi pi-fw pi-calendar-times',
|
||||
items:[
|
||||
{
|
||||
label:'Remove',
|
||||
icon:'pi pi-fw pi-calendar-minus'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label:'Quit',
|
||||
icon:'pi pi-fw pi-power-off'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
</CodeHighlight>
|
||||
|
||||
<h3>Properties</h3>
|
||||
<p>Any attribute such as style and class are passed to the main container element. Following are the additional properties to configure the component.</p>
|
||||
<div class="doc-tablewrapper">
|
||||
<table class="doc-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Default</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>model</td>
|
||||
<td>array</td>
|
||||
<td>null</td>
|
||||
<td>An array of menuitems.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<h3>Styling</h3>
|
||||
<p>Following is the list of structural style classes, for theming classes visit <router-link to="/theming">theming</router-link> page.</p>
|
||||
<div class="doc-tablewrapper">
|
||||
<table class="doc-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Element</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>p-menubar</td>
|
||||
<td>Container element.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>p-menubar-root-list</td>
|
||||
<td>Root list element.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>p-submenu-list</td>
|
||||
<td>Submenu list element.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>p-menuitem</td>
|
||||
<td>Menuitem element.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>p-menuitem-text</td>
|
||||
<td>Label of a menuitem.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>p-menuitem-icon</td>
|
||||
<td>Icon of a menuitem.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>p-submenu-icon</td>
|
||||
<td>Arrow icon of a submenu.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<h3>Dependencies</h3>
|
||||
<p>None.</p>
|
||||
</TabPanel>
|
||||
|
||||
<TabPanel header="Source">
|
||||
<a href="https://github.com/primefaces/primevue/tree/master/src/views/menubar" class="btn-viewsource" target="_blank" rel="noopener noreferrer">
|
||||
<span>View on GitHub</span>
|
||||
</a>
|
||||
<CodeHighlight>
|
||||
<template v-pre>
|
||||
<Menubar :model="items">
|
||||
<InputText placeholder="Search" type="text" />
|
||||
<Button label="Logout" icon="pi pi-power-off" :style="{'margin-left': '.25em'}"/>
|
||||
</Menubar>
|
||||
</template>
|
||||
</CodeHighlight>
|
||||
|
||||
<CodeHighlight lang="javascript">
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
items: [
|
||||
{
|
||||
label:'File',
|
||||
icon:'pi pi-fw pi-file',
|
||||
items:[
|
||||
{
|
||||
label:'New',
|
||||
icon:'pi pi-fw pi-plus',
|
||||
items:[
|
||||
{
|
||||
label:'Bookmark',
|
||||
icon:'pi pi-fw pi-bookmark'
|
||||
},
|
||||
{
|
||||
label:'Video',
|
||||
icon:'pi pi-fw pi-video'
|
||||
},
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
label:'Delete',
|
||||
icon:'pi pi-fw pi-trash'
|
||||
},
|
||||
{
|
||||
separator:true
|
||||
},
|
||||
{
|
||||
label:'Export',
|
||||
icon:'pi pi-fw pi-external-link'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label:'Edit',
|
||||
icon:'pi pi-fw pi-pencil',
|
||||
items:[
|
||||
{
|
||||
label:'Left',
|
||||
icon:'pi pi-fw pi-align-left'
|
||||
},
|
||||
{
|
||||
label:'Right',
|
||||
icon:'pi pi-fw pi-align-right'
|
||||
},
|
||||
{
|
||||
label:'Center',
|
||||
icon:'pi pi-fw pi-align-center'
|
||||
},
|
||||
{
|
||||
label:'Justify',
|
||||
icon:'pi pi-fw pi-align-justify'
|
||||
},
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
label:'Users',
|
||||
icon:'pi pi-fw pi-user',
|
||||
items:[
|
||||
{
|
||||
label:'New',
|
||||
icon:'pi pi-fw pi-user-plus',
|
||||
|
||||
},
|
||||
{
|
||||
label:'Delete',
|
||||
icon:'pi pi-fw pi-user-minus',
|
||||
|
||||
},
|
||||
{
|
||||
label:'Search',
|
||||
icon:'pi pi-fw pi-users',
|
||||
items:[
|
||||
{
|
||||
label:'Filter',
|
||||
icon:'pi pi-fw pi-filter',
|
||||
items:[
|
||||
{
|
||||
label:'Print',
|
||||
icon:'pi pi-fw pi-print'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
icon:'pi pi-fw pi-bars',
|
||||
label:'List'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label:'Events',
|
||||
icon:'pi pi-fw pi-calendar',
|
||||
items:[
|
||||
{
|
||||
label:'Edit',
|
||||
icon:'pi pi-fw pi-pencil',
|
||||
items:[
|
||||
{
|
||||
label:'Save',
|
||||
icon:'pi pi-fw pi-calendar-plus'
|
||||
},
|
||||
{
|
||||
label:'Delete',
|
||||
icon:'pi pi-fw pi-calendar-minus'
|
||||
},
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
label:'Archieve',
|
||||
icon:'pi pi-fw pi-calendar-times',
|
||||
items:[
|
||||
{
|
||||
label:'Remove',
|
||||
icon:'pi pi-fw pi-calendar-minus'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label:'Quit',
|
||||
icon:'pi pi-fw pi-power-off'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
</CodeHighlight>
|
||||
</TabPanel>
|
||||
</TabView>
|
||||
</div>
|
||||
</template>
|
Loading…
Reference in New Issue