parent
1f86a9b8bb
commit
3ed2355a45
|
@ -27,6 +27,14 @@ const PanelMenuSlots = [
|
||||||
{
|
{
|
||||||
name: 'submenuicon',
|
name: 'submenuicon',
|
||||||
description: 'Custom submenu icon template.'
|
description: 'Custom submenu icon template.'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'headericon',
|
||||||
|
description: 'Custom header icon template.'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'itemicon',
|
||||||
|
description: 'Custom item icon template.'
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -89,6 +89,34 @@ export interface PanelMenuSlots {
|
||||||
*/
|
*/
|
||||||
active: boolean;
|
active: boolean;
|
||||||
}): VNode[];
|
}): VNode[];
|
||||||
|
/**
|
||||||
|
* Custom header icon template.
|
||||||
|
* @param {Object} scope - header icon slot's params.
|
||||||
|
*/
|
||||||
|
headericon(scope: {
|
||||||
|
/**
|
||||||
|
* Menuitem instance
|
||||||
|
*/
|
||||||
|
item: MenuItem;
|
||||||
|
/**
|
||||||
|
* Style class of the item icon element.
|
||||||
|
*/
|
||||||
|
class: any;
|
||||||
|
}): VNode[];
|
||||||
|
/**
|
||||||
|
* Custom item icon template.
|
||||||
|
* @param {Object} scope - item icon slot's params.
|
||||||
|
*/
|
||||||
|
itemicon(scope: {
|
||||||
|
/**
|
||||||
|
* Menuitem instance
|
||||||
|
*/
|
||||||
|
item: MenuItem;
|
||||||
|
/**
|
||||||
|
* Style class of the item icon element.
|
||||||
|
*/
|
||||||
|
class: any;
|
||||||
|
}): VNode[];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
<template v-if="!$slots.item">
|
<template v-if="!$slots.item">
|
||||||
<router-link v-if="getItemProp(item, 'to') && !isItemDisabled(item)" v-slot="{ navigate, href, isActive, isExactActive }" :to="getItemProp(item, 'to')" custom>
|
<router-link v-if="getItemProp(item, 'to') && !isItemDisabled(item)" v-slot="{ navigate, href, isActive, isExactActive }" :to="getItemProp(item, 'to')" custom>
|
||||||
<a :href="href" :class="getHeaderActionClass(item, { isActive, isExactActive })" :tabindex="-1" @click="onHeaderActionClick($event, navigate)">
|
<a :href="href" :class="getHeaderActionClass(item, { isActive, isExactActive })" :tabindex="-1" @click="onHeaderActionClick($event, navigate)">
|
||||||
<span v-if="getItemProp(item, 'icon')" :class="getHeaderIconClass(item)"></span>
|
<component :is="templates.headericon || (getItemProp(item, 'icon') ? 'span' : undefined)" :item="item" :class="getHeaderIconClass(item)" />
|
||||||
<span class="p-menuitem-text">{{ getItemLabel(item) }}</span>
|
<span class="p-menuitem-text">{{ getItemLabel(item) }}</span>
|
||||||
</a>
|
</a>
|
||||||
</router-link>
|
</router-link>
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
<slot v-if="getItemProp(item, 'items')" name="submenuicon" :active="isItemActive(item)">
|
<slot v-if="getItemProp(item, 'items')" name="submenuicon" :active="isItemActive(item)">
|
||||||
<component :is="isItemActive(item) ? 'ChevronDownIcon' : 'ChevronRightIcon'" class="p-submenu-icon" />
|
<component :is="isItemActive(item) ? 'ChevronDownIcon' : 'ChevronRightIcon'" class="p-submenu-icon" />
|
||||||
</slot>
|
</slot>
|
||||||
<span v-if="getItemProp(item, 'icon')" :class="getHeaderIconClass(item)"></span>
|
<component :is="templates.headericon || (getItemProp(item, 'icon') ? 'span' : undefined)" :item="item" :class="getHeaderIconClass(item)" />
|
||||||
<span class="p-menuitem-text">{{ getItemLabel(item) }}</span>
|
<span class="p-menuitem-text">{{ getItemLabel(item) }}</span>
|
||||||
</a>
|
</a>
|
||||||
</template>
|
</template>
|
||||||
|
@ -36,7 +36,7 @@
|
||||||
<transition name="p-toggleable-content">
|
<transition name="p-toggleable-content">
|
||||||
<div v-show="isItemActive(item)" :id="getContentId(index)" class="p-toggleable-content" role="region" :aria-labelledby="getHeaderId(index)">
|
<div v-show="isItemActive(item)" :id="getContentId(index)" class="p-toggleable-content" role="region" :aria-labelledby="getHeaderId(index)">
|
||||||
<div v-if="getItemProp(item, 'items')" class="p-panelmenu-content">
|
<div v-if="getItemProp(item, 'items')" class="p-panelmenu-content">
|
||||||
<PanelMenuList :panelId="getPanelId(index)" :items="getItemProp(item, 'items')" :template="$slots" :expandedKeys="expandedKeys" @item-toggle="changeExpandedKeys" @header-focus="updateFocusedHeader" :exact="exact" />
|
<PanelMenuList :panelId="getPanelId(index)" :items="getItemProp(item, 'items')" :templates="$slots" :expandedKeys="expandedKeys" @item-toggle="changeExpandedKeys" @header-focus="updateFocusedHeader" :exact="exact" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</transition>
|
</transition>
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
:panelId="panelId"
|
:panelId="panelId"
|
||||||
:focusedItemId="focused ? focusedItemId : undefined"
|
:focusedItemId="focused ? focusedItemId : undefined"
|
||||||
:items="processedItems"
|
:items="processedItems"
|
||||||
:template="template"
|
:templates="templates"
|
||||||
:activeItemPath="activeItemPath"
|
:activeItemPath="activeItemPath"
|
||||||
:exact="exact"
|
:exact="exact"
|
||||||
@focus="onFocus"
|
@focus="onFocus"
|
||||||
|
@ -34,7 +34,7 @@ export default {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: null
|
default: null
|
||||||
},
|
},
|
||||||
template: {
|
templates: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: null
|
default: null
|
||||||
},
|
},
|
||||||
|
|
|
@ -14,20 +14,20 @@
|
||||||
:aria-posinset="getAriaPosInset(index)"
|
:aria-posinset="getAriaPosInset(index)"
|
||||||
>
|
>
|
||||||
<div class="p-menuitem-content" @click="onItemClick($event, processedItem)">
|
<div class="p-menuitem-content" @click="onItemClick($event, processedItem)">
|
||||||
<template v-if="!template.item">
|
<template v-if="!templates.item">
|
||||||
<router-link v-if="getItemProp(processedItem, 'to') && !isItemDisabled(processedItem)" v-slot="{ navigate, href, isActive, isExactActive }" :to="getItemProp(processedItem, 'to')" custom>
|
<router-link v-if="getItemProp(processedItem, 'to') && !isItemDisabled(processedItem)" v-slot="{ navigate, href, isActive, isExactActive }" :to="getItemProp(processedItem, 'to')" custom>
|
||||||
<a v-ripple :href="href" :class="getItemActionClass(processedItem, { isActive, isExactActive })" tabindex="-1" aria-hidden="true" @click="onItemActionClick($event, navigate)">
|
<a v-ripple :href="href" :class="getItemActionClass(processedItem, { isActive, isExactActive })" tabindex="-1" aria-hidden="true" @click="onItemActionClick($event, navigate)">
|
||||||
<span v-if="getItemProp(processedItem, 'icon')" :class="getItemIconClass(processedItem)"></span>
|
<component :is="templates.itemicon || (getItemProp(processedItem, 'icon') ? 'span' : undefined)" :item="processedItem.item" :class="getItemIconClass(processedItem)" />
|
||||||
<span class="p-menuitem-text">{{ getItemLabel(processedItem) }}</span>
|
<span class="p-menuitem-text">{{ getItemLabel(processedItem) }}</span>
|
||||||
</a>
|
</a>
|
||||||
</router-link>
|
</router-link>
|
||||||
<a v-else v-ripple :href="getItemProp(processedItem, 'url')" :class="getItemActionClass(processedItem)" :target="getItemProp(processedItem, 'target')" tabindex="-1" aria-hidden="true">
|
<a v-else v-ripple :href="getItemProp(processedItem, 'url')" :class="getItemActionClass(processedItem)" :target="getItemProp(processedItem, 'target')" tabindex="-1" aria-hidden="true">
|
||||||
<component v-if="isItemGroup(processedItem)" :is="template.submenuicon || (isItemActive(processedItem) ? 'ChevronDownIcon' : 'ChevronRightIcon')" class="p-submenu-icon" :active="isItemActive(processedItem)" />
|
<component v-if="isItemGroup(processedItem)" :is="templates.submenuicon || (isItemActive(processedItem) ? 'ChevronDownIcon' : 'ChevronRightIcon')" class="p-submenu-icon" :active="isItemActive(processedItem)" />
|
||||||
<span v-if="getItemProp(processedItem, 'icon')" :class="getItemIconClass(processedItem)"></span>
|
<component :is="templates.itemicon || (getItemProp(processedItem, 'icon') ? 'span' : undefined)" :item="processedItem.item" :class="getItemIconClass(processedItem)" />
|
||||||
<span class="p-menuitem-text">{{ getItemLabel(processedItem) }}</span>
|
<span class="p-menuitem-text">{{ getItemLabel(processedItem) }}</span>
|
||||||
</a>
|
</a>
|
||||||
</template>
|
</template>
|
||||||
<component v-else :is="template.item" :item="processedItem.item"></component>
|
<component v-else :is="templates.item" :item="processedItem.item"></component>
|
||||||
</div>
|
</div>
|
||||||
<transition name="p-toggleable-content">
|
<transition name="p-toggleable-content">
|
||||||
<div v-show="isItemActive(processedItem)" class="p-toggleable-content">
|
<div v-show="isItemActive(processedItem)" class="p-toggleable-content">
|
||||||
|
@ -39,7 +39,7 @@
|
||||||
:focusedItemId="focusedItemId"
|
:focusedItemId="focusedItemId"
|
||||||
:items="processedItem.items"
|
:items="processedItem.items"
|
||||||
:level="level + 1"
|
:level="level + 1"
|
||||||
:template="template"
|
:templates="templates"
|
||||||
:activeItemPath="activeItemPath"
|
:activeItemPath="activeItemPath"
|
||||||
:exact="exact"
|
:exact="exact"
|
||||||
@item-toggle="onItemToggle"
|
@item-toggle="onItemToggle"
|
||||||
|
@ -78,7 +78,7 @@ export default {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 0
|
default: 0
|
||||||
},
|
},
|
||||||
template: {
|
templates: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: null
|
default: null
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue