primeng
Version:
[](https://opensource.org/licenses/MIT) [](https://badge.fury.io/js/primeng) [ • 12.1 kB
JavaScript
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@angular/core"),require("@angular/animations"),require("@angular/common"),require("@angular/router")):"function"==typeof define&&define.amd?define("primeng/panelmenu",["exports","@angular/core","@angular/animations","@angular/common","@angular/router"],n):n(((e="undefined"!=typeof globalThis?globalThis:e||self).primeng=e.primeng||{},e.primeng.panelmenu={}),e.ng.core,e.ng.animations,e.ng.common,e.ng.router)}(this,(function(e,n,t,i,a){"use strict";
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var l=function(e,n){return(l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])})(e,n)};function r(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function t(){this.constructor=e}l(e,n),e.prototype=null===n?Object.create(n):(t.prototype=n.prototype,new t)}Object.create;function s(e){var n="function"==typeof Symbol&&Symbol.iterator,t=n&&e[n],i=0;if(t)return t.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")}Object.create;var o=function(){function e(e){this.ref=e}return e.prototype.handleClick=function(e,n){n.disabled?e.preventDefault():(n.expanded=!n.expanded,this.ref.detectChanges(),n.url||e.preventDefault(),n.command&&n.command({originalEvent:e,item:n}))},e}(),p=function(e){function n(n){return e.call(this,n)||this}return r(n,e),n}(o);p.decorators=[{type:n.Component,args:[{selector:"p-panelMenuSub",template:'\n <ul [ngClass]="{\'p-submenu-list\': true, \'p-panelmenu-root-submenu\': root}" []="expanded ? {value: \'visible\', params: {transitionParams: transitionOptions, height: \'*\'}} : {value: \'hidden\', params: {transitionParams: transitionOptions, height: \'0\'}}" role="tree">\n <ng-template ngFor let-child [ngForOf]="item.items">\n <li *ngIf="child.separator" class="p-menu-separator" role="separator">\n <li *ngIf="!child.separator" class="p-menuitem" [ngClass]="child.styleClass" [class.p-hidden]="child.visible === false" [ngStyle]="child.style">\n <a *ngIf="!child.routerLink" [attr.href]="child.url" class="p-menuitem-link" [attr.tabindex]="!item.expanded ? null : child.disabled ? null : \'0\'" [attr.id]="child.id"\n [ngClass]="{\'p-disabled\':child.disabled}" role="treeitem" [attr.aria-expanded]="child.expanded"\n (click)="handleClick($event,child)" [attr.target]="child.target" [attr.title]="child.title">\n <span class="p-panelmenu-icon pi pi-fw" [ngClass]="{\'pi-angle-right\':!child.expanded,\'pi-angle-down\':child.expanded}" *ngIf="child.items"></span>\n <span class="p-menuitem-icon" [ngClass]="child.icon" *ngIf="child.icon"></span>\n <span class="p-menuitem-text" *ngIf="child.escape !== false; else htmlLabel">{{child.label}}</span>\n <ng-template #htmlLabel><span class="p-menuitem-text" [innerHTML]="child.label"></span></ng-template>\n </a>\n <a *ngIf="child.routerLink" [routerLink]="child.routerLink" [queryParams]="child.queryParams" [routerLinkActive]="\'p-menuitem-link-active\'" [routerLinkActiveOptions]="child.routerLinkActiveOptions||{exact:false}" class="p-menuitem-link" \n [ngClass]="{\'p-disabled\':child.disabled}" [attr.tabindex]="!item.expanded ? null : child.disabled ? null : \'0\'" [attr.id]="child.id" role="treeitem" [attr.aria-expanded]="child.expanded"\n (click)="handleClick($event,child)" [attr.target]="child.target" [attr.title]="child.title"\n [fragment]="child.fragment" [queryParamsHandling]="child.queryParamsHandling" [preserveFragment]="child.preserveFragment" [skipLocationChange]="child.skipLocationChange" [replaceUrl]="child.replaceUrl" [state]="child.state">\n <span class="p-panelmenu-icon pi pi-fw" [ngClass]="{\'pi-angle-right\':!child.expanded,\'pi-angle-down\':child.expanded}" *ngIf="child.items"></span>\n <span class="p-menuitem-icon" [ngClass]="child.icon" *ngIf="child.icon"></span>\n <span class="p-menuitem-text" *ngIf="child.escape !== false; else htmlRouteLabel">{{child.label}}</span>\n <ng-template #htmlRouteLabel><span class="p-menuitem-text" [innerHTML]="child.label"></span></ng-template>\n </a>\n <p-panelMenuSub [item]="child" [expanded]="child.expanded" [transitionOptions]="transitionOptions" *ngIf="child.items"></p-panelMenuSub>\n </li>\n </ng-template>\n </ul>\n ',animations:[t.trigger("submenu",[t.state("hidden",t.style({height:"0",overflow:"hidden"})),t.state("visible",t.style({height:"*"})),t.transition("visible <=> hidden",[t.style({overflow:"hidden"}),t.animate("{{transitionParams}}")]),t.transition("void => *",t.animate(0))])],encapsulation:n.ViewEncapsulation.None}]}],p.ctorParameters=function(){return[{type:n.ChangeDetectorRef}]},p.propDecorators={item:[{type:n.Input}],expanded:[{type:n.Input}],transitionOptions:[{type:n.Input}],root:[{type:n.Input}]};var d=function(e){function n(n){var t=e.call(this,n)||this;return t.multiple=!0,t.transitionOptions="400ms cubic-bezier(0.86, 0, 0.07, 1)",t}return r(n,e),n.prototype.collapseAll=function(){var e,n;try{for(var t=s(this.model),i=t.next();!i.done;i=t.next()){var a=i.value;a.expanded&&(a.expanded=!1)}}catch(n){e={error:n}}finally{try{i&&!i.done&&(n=t.return)&&n.call(t)}finally{if(e)throw e.error}}},n.prototype.handleClick=function(n,t){var i,a;if(!this.multiple)try{for(var l=s(this.model),r=l.next();!r.done;r=l.next()){var o=r.value;t!==o&&o.expanded&&(o.expanded=!1)}}catch(e){i={error:e}}finally{try{r&&!r.done&&(a=l.return)&&a.call(l)}finally{if(i)throw i.error}}this.animating=!0,e.prototype.handleClick.call(this,n,t)},n.prototype.onToggleDone=function(){this.animating=!1},n}(o);d.decorators=[{type:n.Component,args:[{selector:"p-panelMenu",template:'\n <div [class]="styleClass" [ngStyle]="style" [ngClass]="\'p-panelmenu p-component\'">\n <ng-container *ngFor="let item of model;let f=first;let l=last;">\n <div class="p-panelmenu-panel" [ngClass]="{\'p-hidden\': item.visible === false}">\n <div [ngClass]="{\'p-component p-panelmenu-header\':true, \'p-highlight\':item.expanded,\'p-disabled\':item.disabled}" [class]="item.styleClass" [ngStyle]="item.style">\n <a *ngIf="!item.routerLink" [attr.href]="item.url" (click)="handleClick($event,item)" [attr.tabindex]="item.disabled ? null : \'0\'" [attr.id]="item.id"\n [attr.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\'">\n <span *ngIf="item.items" class="p-panelmenu-icon pi" [ngClass]="{\'pi-chevron-right\':!item.expanded,\'pi-chevron-down\':item.expanded}"></span>\n <span class="p-menuitem-icon" [ngClass]="item.icon" *ngIf="item.icon"></span>\n <span class="p-menuitem-text" *ngIf="item.escape !== false; else htmlLabel">{{item.label}}</span>\n <ng-template #htmlLabel><span class="p-menuitem-text" [innerHTML]="item.label"></span></ng-template>\n </a>\n <a *ngIf="item.routerLink" [routerLink]="item.routerLink" [queryParams]="item.queryParams" [routerLinkActive]="\'p-menuitem-link-active\'" [routerLinkActiveOptions]="item.routerLinkActiveOptions||{exact:false}"\n (click)="handleClick($event,item)" [attr.target]="item.target" [attr.title]="item.title" class="p-panelmenu-header-link" [attr.id]="item.id" [attr.tabindex]="item.disabled ? null : \'0\'"\n [fragment]="item.fragment" [queryParamsHandling]="item.queryParamsHandling" [preserveFragment]="item.preserveFragment" [skipLocationChange]="item.skipLocationChange" [replaceUrl]="item.replaceUrl" [state]="item.state">\n <span *ngIf="item.items" class="p-panelmenu-icon pi" [ngClass]="{\'pi-chevron-right\':!item.expanded,\'pi-chevron-down\':item.expanded}"></span>\n <span class="p-menuitem-icon" [ngClass]="item.icon" *ngIf="item.icon"></span>\n <span class="p-menuitem-text" *ngIf="item.escape !== false; else htmlRouteLabel">{{item.label}}</span>\n <ng-template #htmlRouteLabel><span class="p-menuitem-text" [innerHTML]="item.label"></span></ng-template>\n </a>\n </div>\n <div *ngIf="item.items" class="p-toggleable-content" []="item.expanded ? {value: \'visible\', params: {transitionParams: animating ? transitionOptions : \'0ms\', height: \'*\'}} : {value: \'hidden\', params: {transitionParams: transitionOptions, height: \'0\'}}" (.done)="onToggleDone()">\n <div class="p-panelmenu-content" role="region" [attr.id]="item.id +\'_content\' " [attr.aria-labelledby]="item.id +\'_header\'">\n <p-panelMenuSub [item]="item" [expanded]="true" [transitionOptions]="transitionOptions" [root]="true"></p-panelMenuSub>\n </div>\n </div>\n </div>\n </ng-container>\n </div>\n ',animations:[t.trigger("rootItem",[t.state("hidden",t.style({height:"0",overflow:"hidden"})),t.state("visible",t.style({height:"*"})),t.transition("visible <=> hidden",[t.style({overflow:"hidden"}),t.animate("{{transitionParams}}")]),t.transition("void => *",t.animate(0))])],changeDetection:n.ChangeDetectionStrategy.OnPush,encapsulation:n.ViewEncapsulation.None,styles:[".p-panelmenu .p-panelmenu-header-link{-ms-user-select:none;-webkit-user-select:none;align-items:center;cursor:pointer;display:flex;position:relative;text-decoration:none;user-select:none}.p-panelmenu .p-panelmenu-header-link:focus{z-index:1}.p-panelmenu .p-submenu-list{list-style:none;margin:0;padding:0}.p-panelmenu .p-menuitem-link{-ms-user-select:none;-webkit-user-select:none;align-items:center;cursor:pointer;display:flex;text-decoration:none;user-select:none}.p-panelmenu .p-menuitem-text{line-height:1}"]}]}],d.ctorParameters=function(){return[{type:n.ChangeDetectorRef}]},d.propDecorators={model:[{type:n.Input}],style:[{type:n.Input}],styleClass:[{type:n.Input}],multiple:[{type:n.Input}],transitionOptions:[{type:n.Input}]};var c=function(){};c.decorators=[{type:n.NgModule,args:[{imports:[i.CommonModule,a.RouterModule],exports:[d,a.RouterModule],declarations:[d,p]}]}],e.BasePanelMenuItem=o,e.PanelMenu=d,e.PanelMenuModule=c,e.PanelMenuSub=p,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=primeng-panelmenu.umd.min.js.map