primeng
Version:
[](https://badge.fury.io/js/primeng) [](https://www.npmjs.com/package/primeng) [ • 38.8 kB
JavaScript
import { trigger, state, style, transition, animate } from '@angular/animations';
import * as i1 from '@angular/common';
import { CommonModule } from '@angular/common';
import * as i0 from '@angular/core';
import { Component, ViewEncapsulation, Input, ChangeDetectionStrategy, ContentChildren, NgModule } from '@angular/core';
import * as i2 from '@angular/router';
import { RouterModule } from '@angular/router';
import { PrimeTemplate, SharedModule } from 'primeng/api';
import { DomHandler } from 'primeng/dom';
import { AngleDownIcon } from 'primeng/icons/angledown';
import { AngleRightIcon } from 'primeng/icons/angleright';
import { ChevronDownIcon } from 'primeng/icons/chevrondown';
import { ChevronRightIcon } from 'primeng/icons/chevronright';
import * as i3 from 'primeng/tooltip';
import { TooltipModule } from 'primeng/tooltip';
class BasePanelMenuItem {
ref;
constructor(ref) {
this.ref = ref;
}
handleClick(event, item) {
if (item.disabled) {
event.preventDefault();
return;
}
item.expanded = !item.expanded;
this.ref.detectChanges();
if (!item.url && !item.routerLink) {
event.preventDefault();
}
if (item.command) {
item.command({
originalEvent: event,
item: item
});
}
}
}
class PanelMenuSub extends BasePanelMenuItem {
panelMenu;
item;
expanded;
parentExpanded;
transitionOptions;
root;
constructor(ref, panelMenu) {
super(ref);
this.panelMenu = panelMenu;
}
onItemKeyDown(event) {
let listItem = event.currentTarget;
switch (event.code) {
case 'Space':
case 'Enter':
if (listItem && !DomHandler.hasClass(listItem, 'p-disabled')) {
listItem.click();
}
event.preventDefault();
break;
default:
break;
}
}
getAnimation() {
return this.expanded ? { value: 'visible', params: { transitionParams: this.transitionOptions, height: '*' } } : { value: 'hidden', params: { transitionParams: this.transitionOptions, height: '0' } };
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: PanelMenuSub, deps: [{ token: i0.ChangeDetectorRef }, { token: PanelMenu }], target: i0.ɵɵFactoryTarget.Component });
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.2", type: PanelMenuSub, selector: "p-panelMenuSub", inputs: { item: "item", expanded: "expanded", parentExpanded: "parentExpanded", transitionOptions: "transitionOptions", root: "root" }, host: { classAttribute: "p-element" }, usesInheritance: true, ngImport: i0, template: `
<ul [ngClass]="{ 'p-submenu-list': true, 'p-panelmenu-root-submenu': root, 'p-submenu-expanded': expanded }" []="getAnimation()" role="tree">
<ng-template ngFor let-child [ngForOf]="item?.items">
<li *ngIf="child.separator" class="p-menu-separator" role="separator"></li>
<li *ngIf="!child.separator" class="p-menuitem" [ngClass]="child.styleClass" [class.p-hidden]="child.visible === false" [ngStyle]="child.style" pTooltip [tooltipOptions]="child.tooltipOptions">
<a
*ngIf="!child.routerLink"
(keydown)="onItemKeyDown($event)"
[attr.href]="child.url"
class="p-menuitem-link"
[attr.tabindex]="!item.expanded || !parentExpanded ? null : child.disabled ? null : '0'"
[attr.id]="child.id"
[ngClass]="{ 'p-disabled': child.disabled }"
role="treeitem"
[attr.aria-expanded]="child.expanded"
(click)="handleClick($event, child)"
[target]="child.target"
[attr.title]="child.title"
>
<ng-container *ngIf="child.items">
<ng-container *ngIf="!panelMenu.submenuIconTemplate">
<AngleDownIcon [styleClass]="'p-panelmenu-icon'" *ngIf="child.expanded" [ngStyle]="child.iconStyle" />
<AngleRightIcon [styleClass]="'p-panelmenu-icon'" *ngIf="!child.expanded" [ngStyle]="child.iconStyle" />
</ng-container>
<ng-template *ngTemplateOutlet="panelMenu.submenuIconTemplate"></ng-template>
</ng-container>
<span class="p-menuitem-icon" [ngClass]="child.icon" *ngIf="child.icon" [ngStyle]="child.iconStyle"></span>
<span class="p-menuitem-text" *ngIf="child.escape !== false; else htmlLabel">{{ child.label }}</span>
<ng-template #htmlLabel><span class="p-menuitem-text" [innerHTML]="child.label"></span></ng-template>
<span class="p-menuitem-badge" *ngIf="child.badge" [ngClass]="child.badgeStyleClass">{{ child.badge }}</span>
</a>
<a
*ngIf="child.routerLink"
(keydown)="onItemKeyDown($event)"
[routerLink]="child.routerLink"
[queryParams]="child.queryParams"
[routerLinkActive]="'p-menuitem-link-active'"
[routerLinkActiveOptions]="child.routerLinkActiveOptions || { exact: false }"
class="p-menuitem-link"
[ngClass]="{ 'p-disabled': child.disabled }"
[attr.tabindex]="!item.expanded || !parentExpanded ? null : child.disabled ? null : '0'"
[attr.id]="child.id"
role="treeitem"
[attr.aria-expanded]="child.expanded"
(click)="handleClick($event, child)"
[target]="child.target"
[attr.title]="child.title"
[fragment]="child.fragment"
[queryParamsHandling]="child.queryParamsHandling"
[preserveFragment]="child.preserveFragment"
[skipLocationChange]="child.skipLocationChange"
[replaceUrl]="child.replaceUrl"
[state]="child.state"
>
<ng-container *ngIf="child.items">
<ng-container *ngIf="!panelMenu.submenuIconTemplate">
<AngleDownIcon *ngIf="child.expanded" [styleClass]="'p-panelmenu-icon'" [ngStyle]="child.iconStyle" />
<AngleRightIcon *ngIf="!child.expanded" [styleClass]="'p-panelmenu-icon'" [ngStyle]="child.iconStyle" />
</ng-container>
<ng-template *ngTemplateOutlet="panelMenu.submenuIconTemplate"></ng-template>
</ng-container>
<span class="p-menuitem-icon" [ngClass]="child.icon" *ngIf="child.icon" [ngStyle]="child.iconStyle"></span>
<span class="p-menuitem-text" *ngIf="child.escape !== false; else htmlRouteLabel">{{ child.label }}</span>
<ng-template #htmlRouteLabel><span class="p-menuitem-text" [innerHTML]="child.label"></span></ng-template>
<span class="p-menuitem-badge" *ngIf="child.badge" [ngClass]="child.badgeStyleClass">{{ child.badge }}</span>
</a>
<p-panelMenuSub [item]="child" [parentExpanded]="expanded && parentExpanded" [expanded]="child.expanded" [transitionOptions]="transitionOptions" *ngIf="child.items"></p-panelMenuSub>
</li>
</ng-template>
</ul>
`, isInline: true, dependencies: [{ kind: "directive", type: i0.forwardRef(function () { return i1.NgClass; }), selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i0.forwardRef(function () { return i1.NgForOf; }), selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i0.forwardRef(function () { return i1.NgIf; }), selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i0.forwardRef(function () { return i1.NgTemplateOutlet; }), selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i0.forwardRef(function () { return i1.NgStyle; }), selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i0.forwardRef(function () { return i2.RouterLink; }), selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "directive", type: i0.forwardRef(function () { return i2.RouterLinkActive; }), selector: "[routerLinkActive]", inputs: ["routerLinkActiveOptions", "ariaCurrentWhenActive", "routerLinkActive"], outputs: ["isActiveChange"], exportAs: ["routerLinkActive"] }, { kind: "directive", type: i0.forwardRef(function () { return i3.Tooltip; }), selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "autoHide", "fitContent", "hideOnEscape", "pTooltip", "tooltipDisabled", "tooltipOptions"] }, { kind: "component", type: i0.forwardRef(function () { return AngleDownIcon; }), selector: "AngleDownIcon" }, { kind: "component", type: i0.forwardRef(function () { return AngleRightIcon; }), selector: "AngleRightIcon" }, { kind: "component", type: i0.forwardRef(function () { return PanelMenuSub; }), selector: "p-panelMenuSub", inputs: ["item", "expanded", "parentExpanded", "transitionOptions", "root"] }], animations: [
trigger('submenu', [
state('hidden', style({
height: '0'
})),
state('visible', style({
height: '*'
})),
transition('visible <=> hidden', [animate('{{transitionParams}}')]),
transition('void => *', animate(0))
])
], encapsulation: i0.ViewEncapsulation.None });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: PanelMenuSub, decorators: [{
type: Component,
args: [{
selector: 'p-panelMenuSub',
template: `
<ul [ngClass]="{ 'p-submenu-list': true, 'p-panelmenu-root-submenu': root, 'p-submenu-expanded': expanded }" []="getAnimation()" role="tree">
<ng-template ngFor let-child [ngForOf]="item?.items">
<li *ngIf="child.separator" class="p-menu-separator" role="separator"></li>
<li *ngIf="!child.separator" class="p-menuitem" [ngClass]="child.styleClass" [class.p-hidden]="child.visible === false" [ngStyle]="child.style" pTooltip [tooltipOptions]="child.tooltipOptions">
<a
*ngIf="!child.routerLink"
(keydown)="onItemKeyDown($event)"
[attr.href]="child.url"
class="p-menuitem-link"
[attr.tabindex]="!item.expanded || !parentExpanded ? null : child.disabled ? null : '0'"
[attr.id]="child.id"
[ngClass]="{ 'p-disabled': child.disabled }"
role="treeitem"
[attr.aria-expanded]="child.expanded"
(click)="handleClick($event, child)"
[target]="child.target"
[attr.title]="child.title"
>
<ng-container *ngIf="child.items">
<ng-container *ngIf="!panelMenu.submenuIconTemplate">
<AngleDownIcon [styleClass]="'p-panelmenu-icon'" *ngIf="child.expanded" [ngStyle]="child.iconStyle" />
<AngleRightIcon [styleClass]="'p-panelmenu-icon'" *ngIf="!child.expanded" [ngStyle]="child.iconStyle" />
</ng-container>
<ng-template *ngTemplateOutlet="panelMenu.submenuIconTemplate"></ng-template>
</ng-container>
<span class="p-menuitem-icon" [ngClass]="child.icon" *ngIf="child.icon" [ngStyle]="child.iconStyle"></span>
<span class="p-menuitem-text" *ngIf="child.escape !== false; else htmlLabel">{{ child.label }}</span>
<ng-template #htmlLabel><span class="p-menuitem-text" [innerHTML]="child.label"></span></ng-template>
<span class="p-menuitem-badge" *ngIf="child.badge" [ngClass]="child.badgeStyleClass">{{ child.badge }}</span>
</a>
<a
*ngIf="child.routerLink"
(keydown)="onItemKeyDown($event)"
[routerLink]="child.routerLink"
[queryParams]="child.queryParams"
[routerLinkActive]="'p-menuitem-link-active'"
[routerLinkActiveOptions]="child.routerLinkActiveOptions || { exact: false }"
class="p-menuitem-link"
[ngClass]="{ 'p-disabled': child.disabled }"
[attr.tabindex]="!item.expanded || !parentExpanded ? null : child.disabled ? null : '0'"
[attr.id]="child.id"
role="treeitem"
[attr.aria-expanded]="child.expanded"
(click)="handleClick($event, child)"
[target]="child.target"
[attr.title]="child.title"
[fragment]="child.fragment"
[queryParamsHandling]="child.queryParamsHandling"
[preserveFragment]="child.preserveFragment"
[skipLocationChange]="child.skipLocationChange"
[replaceUrl]="child.replaceUrl"
[state]="child.state"
>
<ng-container *ngIf="child.items">
<ng-container *ngIf="!panelMenu.submenuIconTemplate">
<AngleDownIcon *ngIf="child.expanded" [styleClass]="'p-panelmenu-icon'" [ngStyle]="child.iconStyle" />
<AngleRightIcon *ngIf="!child.expanded" [styleClass]="'p-panelmenu-icon'" [ngStyle]="child.iconStyle" />
</ng-container>
<ng-template *ngTemplateOutlet="panelMenu.submenuIconTemplate"></ng-template>
</ng-container>
<span class="p-menuitem-icon" [ngClass]="child.icon" *ngIf="child.icon" [ngStyle]="child.iconStyle"></span>
<span class="p-menuitem-text" *ngIf="child.escape !== false; else htmlRouteLabel">{{ child.label }}</span>
<ng-template #htmlRouteLabel><span class="p-menuitem-text" [innerHTML]="child.label"></span></ng-template>
<span class="p-menuitem-badge" *ngIf="child.badge" [ngClass]="child.badgeStyleClass">{{ child.badge }}</span>
</a>
<p-panelMenuSub [item]="child" [parentExpanded]="expanded && parentExpanded" [expanded]="child.expanded" [transitionOptions]="transitionOptions" *ngIf="child.items"></p-panelMenuSub>
</li>
</ng-template>
</ul>
`,
animations: [
trigger('submenu', [
state('hidden', style({
height: '0'
})),
state('visible', style({
height: '*'
})),
transition('visible <=> hidden', [animate('{{transitionParams}}')]),
transition('void => *', animate(0))
])
],
encapsulation: ViewEncapsulation.None,
host: {
class: 'p-element'
}
}]
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: PanelMenu }]; }, propDecorators: { item: [{
type: Input
}], expanded: [{
type: Input
}], parentExpanded: [{
type: Input
}], transitionOptions: [{
type: Input
}], root: [{
type: Input
}] } });
/**
* PanelMenu is a hybrid of Accordion and Tree components.
* @group Components
*/
class PanelMenu extends BasePanelMenuItem {
/**
* An array of menuitems.
* @group Props
*/
model;
/**
* Inline style of the component.
* @group Props
*/
style;
/**
* Style class of the component.
* @group Props
*/
styleClass;
/**
* Whether multiple tabs can be activated at the same time or not.
* @group Props
*/
multiple = true;
/**
* Transition options of the animation.
* @group Props
*/
transitionOptions = '400ms cubic-bezier(0.86, 0, 0.07, 1)';
templates;
submenuIconTemplate;
animating;
constructor(ref) {
super(ref);
}
ngAfterContentInit() {
this.templates?.forEach((item) => {
switch (item.getType()) {
case 'submenuicon':
this.submenuIconTemplate = item.template;
break;
}
});
}
collapseAll() {
for (let item of this.model) {
if (item.expanded) {
item.expanded = false;
}
}
}
handleClick(event, item) {
if (!this.multiple) {
for (let modelItem of this.model) {
if (item !== modelItem && modelItem.expanded) {
modelItem.expanded = false;
}
}
}
this.animating = true;
super.handleClick(event, item);
}
onToggleDone() {
this.animating = false;
}
onItemKeyDown(event) {
let listItem = event.currentTarget;
switch (event.code) {
case 'Space':
case 'Enter':
if (listItem && !DomHandler.hasClass(listItem, 'p-disabled')) {
listItem.click();
}
event.preventDefault();
break;
default:
break;
}
}
visible(item) {
return item.visible !== false;
}
getAnimation(item) {
return item.expanded ? { value: 'visible', params: { transitionParams: this.animating ? this.transitionOptions : '0ms', height: '*' } } : { value: 'hidden', params: { transitionParams: this.transitionOptions, height: '0' } };
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: PanelMenu, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.2", type: PanelMenu, selector: "p-panelMenu", inputs: { model: "model", style: "style", styleClass: "styleClass", multiple: "multiple", transitionOptions: "transitionOptions" }, host: { classAttribute: "p-element" }, queries: [{ propertyName: "templates", predicate: PrimeTemplate }], usesInheritance: true, ngImport: i0, template: `
<div [class]="styleClass" [ngStyle]="style" [ngClass]="'p-panelmenu p-component'">
<ng-container *ngFor="let item of model; let f = first; let l = last">
<div class="p-panelmenu-panel" *ngIf="visible(item)">
<div [ngClass]="{ 'p-component p-panelmenu-header': true, 'p-highlight': item.expanded, 'p-disabled': item.disabled }" [class]="item.styleClass" [ngStyle]="item.style" pTooltip [tooltipOptions]="item.tooltipOptions">
<a
*ngIf="!item.routerLink"
[attr.href]="item.url"
(click)="handleClick($event, item)"
(keydown)="onItemKeyDown($event)"
[attr.tabindex]="item.disabled ? null : '0'"
[attr.id]="item.id"
[target]="item.target"
[attr.title]="item.title"
class="p-panelmenu-header-link"
[attr.aria-expanded]="item.expanded"
[attr.id]="item.id + '_header'"
[attr.aria-controls]="item.id + '_content'"
>
<!--
<span *ngIf="item.items" class="p-panelmenu-icon pi" [ngClass]="{ 'pi-chevron-right': !item.expanded, 'pi-chevron-down': item.expanded }"></span>
-->
<ng-container *ngIf="item.items">
<ng-container *ngIf="!submenuIconTemplate">
<ChevronDownIcon [styleClass]="'p-panelmenu-icon'" *ngIf="item.expanded" />
<ChevronRightIcon [styleClass]="'p-panelmenu-icon'" *ngIf="!item.expanded" />
</ng-container>
<ng-template *ngTemplateOutlet="submenuIconTemplate"></ng-template>
</ng-container>
<span class="p-menuitem-icon" [ngClass]="item.icon" *ngIf="item.icon" [ngStyle]="item.iconStyle"></span>
<span class="p-menuitem-text" *ngIf="item.escape !== false; else htmlLabel">{{ item.label }}</span>
<ng-template #htmlLabel><span class="p-menuitem-text" [innerHTML]="item.label"></span></ng-template>
<span class="p-menuitem-badge" *ngIf="item.badge" [ngClass]="item.badgeStyleClass">{{ item.badge }}</span>
</a>
<a
*ngIf="item.routerLink"
[routerLink]="item.routerLink"
[queryParams]="item.queryParams"
[routerLinkActive]="'p-menuitem-link-active'"
[routerLinkActiveOptions]="item.routerLinkActiveOptions || { exact: false }"
(click)="handleClick($event, item)"
(keydown)="onItemKeyDown($event)"
[target]="item.target"
[attr.title]="item.title"
class="p-panelmenu-header-link"
[attr.id]="item.id"
[attr.tabindex]="item.disabled ? null : '0'"
[fragment]="item.fragment"
[queryParamsHandling]="item.queryParamsHandling"
[preserveFragment]="item.preserveFragment"
[skipLocationChange]="item.skipLocationChange"
[replaceUrl]="item.replaceUrl"
[state]="item.state"
>
<!--
<span *ngIf="item.items" class="p-panelmenu-icon pi" [ngClass]="{ 'pi-chevron-right': !item.expanded, 'pi-chevron-down': item.expanded }"></span>
-->
<ng-container *ngIf="item.items">
<ng-container *ngIf="!submenuIconTemplate">
<ChevronDownIcon [styleClass]="'p-panelmenu-icon'" *ngIf="item.expanded" />
<ChevronRightIcon [styleClass]="'p-panelmenu-icon'" *ngIf="!item.expanded" />
</ng-container>
<ng-template *ngTemplateOutlet="submenuIconTemplate"></ng-template>
</ng-container>
<span class="p-menuitem-icon" [ngClass]="item.icon" *ngIf="item.icon" [ngStyle]="item.iconStyle"></span>
<span class="p-menuitem-text" *ngIf="item.escape !== false; else htmlRouteLabel">{{ item.label }}</span>
<ng-template #htmlRouteLabel><span class="p-menuitem-text" [innerHTML]="item.label"></span></ng-template>
<span class="p-menuitem-badge" *ngIf="item.badge" [ngClass]="item.badgeStyleClass">{{ item.badge }}</span>
</a>
</div>
<div *ngIf="item.items" class="p-toggleable-content" [ngClass]="{ 'p-panelmenu-expanded': item.expanded }" []="getAnimation(item)" (.done)="onToggleDone()">
<div class="p-panelmenu-content" role="region" [attr.id]="item.id + '_content'" [attr.aria-labelledby]="item.id + '_header'">
<p-panelMenuSub [item]="item" [parentExpanded]="item.expanded" [expanded]="true" [transitionOptions]="transitionOptions" [root]="true"></p-panelMenuSub>
</div>
</div>
</div>
</ng-container>
</div>
`, isInline: true, styles: [".p-panelmenu .p-panelmenu-header-link{display:flex;align-items:center;-webkit-user-select:none;user-select:none;cursor:pointer;position:relative;text-decoration:none}.p-panelmenu .p-panelmenu-header-link: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;-webkit-user-select:none;user-select:none;cursor:pointer;text-decoration:none}.p-panelmenu .p-menuitem-text{line-height:1}.p-panelmenu-expanded.p-toggleable-content:not(.ng-animating),.p-panelmenu .p-submenu-expanded:not(.ng-animating){overflow:visible}.p-panelmenu .p-toggleable-content,.p-panelmenu .p-submenu-list{overflow:hidden}\n"], dependencies: [{ kind: "directive", type: i0.forwardRef(function () { return i1.NgClass; }), selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i0.forwardRef(function () { return i1.NgForOf; }), selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i0.forwardRef(function () { return i1.NgIf; }), selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i0.forwardRef(function () { return i1.NgTemplateOutlet; }), selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i0.forwardRef(function () { return i1.NgStyle; }), selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i0.forwardRef(function () { return i2.RouterLink; }), selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "directive", type: i0.forwardRef(function () { return i2.RouterLinkActive; }), selector: "[routerLinkActive]", inputs: ["routerLinkActiveOptions", "ariaCurrentWhenActive", "routerLinkActive"], outputs: ["isActiveChange"], exportAs: ["routerLinkActive"] }, { kind: "directive", type: i0.forwardRef(function () { return i3.Tooltip; }), selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "autoHide", "fitContent", "hideOnEscape", "pTooltip", "tooltipDisabled", "tooltipOptions"] }, { kind: "component", type: i0.forwardRef(function () { return ChevronDownIcon; }), selector: "ChevronDownIcon" }, { kind: "component", type: i0.forwardRef(function () { return ChevronRightIcon; }), selector: "ChevronRightIcon" }, { kind: "component", type: i0.forwardRef(function () { return PanelMenuSub; }), selector: "p-panelMenuSub", inputs: ["item", "expanded", "parentExpanded", "transitionOptions", "root"] }], animations: [
trigger('rootItem', [
state('hidden', style({
height: '0'
})),
state('visible', style({
height: '*'
})),
transition('visible <=> hidden', [animate('{{transitionParams}}')]),
transition('void => *', animate(0))
])
], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: PanelMenu, decorators: [{
type: Component,
args: [{ selector: 'p-panelMenu', template: `
<div [class]="styleClass" [ngStyle]="style" [ngClass]="'p-panelmenu p-component'">
<ng-container *ngFor="let item of model; let f = first; let l = last">
<div class="p-panelmenu-panel" *ngIf="visible(item)">
<div [ngClass]="{ 'p-component p-panelmenu-header': true, 'p-highlight': item.expanded, 'p-disabled': item.disabled }" [class]="item.styleClass" [ngStyle]="item.style" pTooltip [tooltipOptions]="item.tooltipOptions">
<a
*ngIf="!item.routerLink"
[attr.href]="item.url"
(click)="handleClick($event, item)"
(keydown)="onItemKeyDown($event)"
[attr.tabindex]="item.disabled ? null : '0'"
[attr.id]="item.id"
[target]="item.target"
[attr.title]="item.title"
class="p-panelmenu-header-link"
[attr.aria-expanded]="item.expanded"
[attr.id]="item.id + '_header'"
[attr.aria-controls]="item.id + '_content'"
>
<!--
<span *ngIf="item.items" class="p-panelmenu-icon pi" [ngClass]="{ 'pi-chevron-right': !item.expanded, 'pi-chevron-down': item.expanded }"></span>
-->
<ng-container *ngIf="item.items">
<ng-container *ngIf="!submenuIconTemplate">
<ChevronDownIcon [styleClass]="'p-panelmenu-icon'" *ngIf="item.expanded" />
<ChevronRightIcon [styleClass]="'p-panelmenu-icon'" *ngIf="!item.expanded" />
</ng-container>
<ng-template *ngTemplateOutlet="submenuIconTemplate"></ng-template>
</ng-container>
<span class="p-menuitem-icon" [ngClass]="item.icon" *ngIf="item.icon" [ngStyle]="item.iconStyle"></span>
<span class="p-menuitem-text" *ngIf="item.escape !== false; else htmlLabel">{{ item.label }}</span>
<ng-template #htmlLabel><span class="p-menuitem-text" [innerHTML]="item.label"></span></ng-template>
<span class="p-menuitem-badge" *ngIf="item.badge" [ngClass]="item.badgeStyleClass">{{ item.badge }}</span>
</a>
<a
*ngIf="item.routerLink"
[routerLink]="item.routerLink"
[queryParams]="item.queryParams"
[routerLinkActive]="'p-menuitem-link-active'"
[routerLinkActiveOptions]="item.routerLinkActiveOptions || { exact: false }"
(click)="handleClick($event, item)"
(keydown)="onItemKeyDown($event)"
[target]="item.target"
[attr.title]="item.title"
class="p-panelmenu-header-link"
[attr.id]="item.id"
[attr.tabindex]="item.disabled ? null : '0'"
[fragment]="item.fragment"
[queryParamsHandling]="item.queryParamsHandling"
[preserveFragment]="item.preserveFragment"
[skipLocationChange]="item.skipLocationChange"
[replaceUrl]="item.replaceUrl"
[state]="item.state"
>
<!--
<span *ngIf="item.items" class="p-panelmenu-icon pi" [ngClass]="{ 'pi-chevron-right': !item.expanded, 'pi-chevron-down': item.expanded }"></span>
-->
<ng-container *ngIf="item.items">
<ng-container *ngIf="!submenuIconTemplate">
<ChevronDownIcon [styleClass]="'p-panelmenu-icon'" *ngIf="item.expanded" />
<ChevronRightIcon [styleClass]="'p-panelmenu-icon'" *ngIf="!item.expanded" />
</ng-container>
<ng-template *ngTemplateOutlet="submenuIconTemplate"></ng-template>
</ng-container>
<span class="p-menuitem-icon" [ngClass]="item.icon" *ngIf="item.icon" [ngStyle]="item.iconStyle"></span>
<span class="p-menuitem-text" *ngIf="item.escape !== false; else htmlRouteLabel">{{ item.label }}</span>
<ng-template #htmlRouteLabel><span class="p-menuitem-text" [innerHTML]="item.label"></span></ng-template>
<span class="p-menuitem-badge" *ngIf="item.badge" [ngClass]="item.badgeStyleClass">{{ item.badge }}</span>
</a>
</div>
<div *ngIf="item.items" class="p-toggleable-content" [ngClass]="{ 'p-panelmenu-expanded': item.expanded }" []="getAnimation(item)" (.done)="onToggleDone()">
<div class="p-panelmenu-content" role="region" [attr.id]="item.id + '_content'" [attr.aria-labelledby]="item.id + '_header'">
<p-panelMenuSub [item]="item" [parentExpanded]="item.expanded" [expanded]="true" [transitionOptions]="transitionOptions" [root]="true"></p-panelMenuSub>
</div>
</div>
</div>
</ng-container>
</div>
`, animations: [
trigger('rootItem', [
state('hidden', style({
height: '0'
})),
state('visible', style({
height: '*'
})),
transition('visible <=> hidden', [animate('{{transitionParams}}')]),
transition('void => *', animate(0))
])
], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
class: 'p-element'
}, styles: [".p-panelmenu .p-panelmenu-header-link{display:flex;align-items:center;-webkit-user-select:none;user-select:none;cursor:pointer;position:relative;text-decoration:none}.p-panelmenu .p-panelmenu-header-link: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;-webkit-user-select:none;user-select:none;cursor:pointer;text-decoration:none}.p-panelmenu .p-menuitem-text{line-height:1}.p-panelmenu-expanded.p-toggleable-content:not(.ng-animating),.p-panelmenu .p-submenu-expanded:not(.ng-animating){overflow:visible}.p-panelmenu .p-toggleable-content,.p-panelmenu .p-submenu-list{overflow:hidden}\n"] }]
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { model: [{
type: Input
}], style: [{
type: Input
}], styleClass: [{
type: Input
}], multiple: [{
type: Input
}], transitionOptions: [{
type: Input
}], templates: [{
type: ContentChildren,
args: [PrimeTemplate]
}] } });
class PanelMenuModule {
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: PanelMenuModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.0.2", ngImport: i0, type: PanelMenuModule, declarations: [PanelMenu, PanelMenuSub], imports: [CommonModule, RouterModule, TooltipModule, SharedModule, AngleDownIcon, AngleRightIcon, ChevronDownIcon, ChevronRightIcon], exports: [PanelMenu, RouterModule, TooltipModule, SharedModule] });
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: PanelMenuModule, imports: [CommonModule, RouterModule, TooltipModule, SharedModule, AngleDownIcon, AngleRightIcon, ChevronDownIcon, ChevronRightIcon, RouterModule, TooltipModule, SharedModule] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: PanelMenuModule, decorators: [{
type: NgModule,
args: [{
imports: [CommonModule, RouterModule, TooltipModule, SharedModule, AngleDownIcon, AngleRightIcon, ChevronDownIcon, ChevronRightIcon],
exports: [PanelMenu, RouterModule, TooltipModule, SharedModule],
declarations: [PanelMenu, PanelMenuSub]
}]
}] });
/**
* Generated bundle index. Do not edit.
*/
export { BasePanelMenuItem, PanelMenu, PanelMenuModule, PanelMenuSub };
//# sourceMappingURL=primeng-panelmenu.mjs.map