primeng
Version:
[](https://opensource.org/licenses/MIT) [](https://badge.fury.io/js/primeng) [{"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/animations"),require("@angular/common"),require("primeng/dom"),require("@angular/router")):"function"==typeof define&&define.amd?define("primeng/slidemenu",["exports","@angular/core","@angular/animations","@angular/common","primeng/dom","@angular/router"],t):t(((e=e||self).primeng=e.primeng||{},e.primeng.slidemenu={}),e.ng.core,e.ng.animations,e.ng.common,e.primeng.dom,e.ng.router)}(this,(function(e,t,i,n,o,s){"use strict";var r=this&&this.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},a=this&&this.__param||function(e,t){return function(i,n){t(i,n,e)}},l=function(){function e(e){this.backLabel="Back",this.easing="ease-out",this.slideMenu=e}return e.prototype.itemClick=function(e,t,i){var n=this;t.disabled?e.preventDefault():(t.url||e.preventDefault(),t.command&&t.command({originalEvent:e,item:t}),t.items&&!this.slideMenu.animating&&(this.slideMenu.left-=this.slideMenu.menuWidth,this.activeItem=i,this.slideMenu.animating=!0,setTimeout((function(){return n.slideMenu.animating=!1}),this.effectDuration)),!t.items&&this.slideMenu.popup&&this.slideMenu.hide())},e.prototype.ngOnDestroy=function(){this.activeItem=null},e.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Inject,args:[t.forwardRef((function(){return u}))]}]}]},r([t.Input()],e.prototype,"item",void 0),r([t.Input()],e.prototype,"root",void 0),r([t.Input()],e.prototype,"backLabel",void 0),r([t.Input()],e.prototype,"menuWidth",void 0),r([t.Input()],e.prototype,"effectDuration",void 0),r([t.Input()],e.prototype,"easing",void 0),r([t.Input()],e.prototype,"index",void 0),e=r([t.Component({selector:"p-slideMenuSub",template:'\n <ul [ngClass]="{\'ui-slidemenu-rootlist\':root, \'ui-submenu-list\':!root, \'ui-active-submenu\': (-slideMenu.left == (index * menuWidth))}"\n [style.width.px]="menuWidth" [style.left.px]="root ? slideMenu.left : slideMenu.menuWidth"\n [style.transitionProperty]="root ? \'left\' : \'none\'" [style.transitionDuration]="effectDuration + \'ms\'" [style.transitionTimingFunction]="easing">\n <ng-template ngFor let-child [ngForOf]="(root ? item : item.items)">\n <li *ngIf="child.separator" class="ui-menu-separator ui-widget-content" [ngClass]="{\'ui-helper-hidden\': child.visible === false}">\n <li *ngIf="!child.separator" #listitem [ngClass]="{\'ui-menuitem ui-widget ui-corner-all\':true,\'ui-menuitem-active\':listitem==activeItem,\'ui-helper-hidden\': child.visible === false}"\n [class]="child.styleClass" [ngStyle]="child.style">\n <a *ngIf="!child.routerLink" [href]="child.url||\'#\'" class="ui-menuitem-link ui-corner-all" [attr.target]="child.target" [attr.title]="child.title" [attr.id]="child.id"\n [ngClass]="{\'ui-state-disabled\':child.disabled}" [attr.tabindex]="child.tabindex ? child.tabindex : \'0\'" \n (click)="itemClick($event, child, listitem)">\n <span class="ui-menuitem-icon" *ngIf="child.icon" [ngClass]="child.icon"></span>\n <span class="ui-menuitem-text">{{child.label}}</span>\n <span class="ui-submenu-icon pi pi-fw pi-caret-right" *ngIf="child.items"></span>\n </a>\n <a *ngIf="child.routerLink" [routerLink]="child.routerLink" [queryParams]="child.queryParams" [routerLinkActive]="\'ui-menuitem-link-active\'" \n [routerLinkActiveOptions]="child.routerLinkActiveOptions||{exact:false}" [href]="child.url||\'#\'" class="ui-menuitem-link ui-corner-all" \n [attr.target]="child.target" [attr.title]="child.title" [attr.id]="child.id" [attr.tabindex]="child.tabindex ? child.tabindex : \'0\'" \n [ngClass]="{\'ui-state-disabled\':child.disabled}" \n (click)="itemClick($event, child, listitem)"\n [fragment]="child.fragment" [queryParamsHandling]="child.queryParamsHandling" [preserveFragment]="child.preserveFragment" [skipLocationChange]="child.skipLocationChange" [replaceUrl]="child.replaceUrl" [state]="child.state">\n <span class="ui-menuitem-icon" *ngIf="child.icon" [ngClass]="child.icon"></span>\n <span class="ui-menuitem-text">{{child.label}}</span>\n <span class="ui-submenu-icon pi pi-fw pi-caret-right" *ngIf="child.items"></span>\n </a>\n <p-slideMenuSub class="ui-submenu" [item]="child" [index]="index + 1" [menuWidth]="menuWidth" *ngIf="child.items"></p-slideMenuSub>\n </li>\n </ng-template>\n </ul>\n '}),a(0,t.Inject(t.forwardRef((function(){return u}))))],e)}(),u=function(){function e(e,i,n){this.el=e,this.renderer=i,this.cd=n,this.menuWidth=190,this.viewportHeight=180,this.effectDuration=250,this.easing="ease-out",this.backLabel="Back",this.autoZIndex=!0,this.baseZIndex=0,this.showTransitionOptions="225ms ease-out",this.hideTransitionOptions="195ms ease-in",this.onShow=new t.EventEmitter,this.onHide=new t.EventEmitter,this.left=0,this.animating=!1}return e.prototype.ngAfterViewChecked=function(){this.viewportUpdated||this.popup||!this.containerViewChild||(this.updateViewPort(),this.viewportUpdated=!0)},Object.defineProperty(e.prototype,"container",{set:function(e){this.containerViewChild=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"backward",{set:function(e){this.backwardViewChild=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"slideMenuContent",{set:function(e){this.slideMenuContentViewChild=e},enumerable:!0,configurable:!0}),e.prototype.updateViewPort=function(){this.slideMenuContentViewChild.nativeElement.style.height=this.viewportHeight-o.DomHandler.getHiddenElementOuterHeight(this.backwardViewChild.nativeElement)+"px"},e.prototype.toggle=function(e){this.visible?this.hide():this.show(e),this.preventDocumentDefault=!0,this.cd.detectChanges()},e.prototype.show=function(e){this.target=e.currentTarget,this.visible=!0,this.preventDocumentDefault=!0},e.prototype.onOverlayAnimationStart=function(e){switch(e.toState){case"visible":this.popup&&(this.updateViewPort(),this.moveOnTop(),this.onShow.emit({}),this.appendOverlay(),o.DomHandler.absolutePosition(this.containerViewChild.nativeElement,this.target),this.bindDocumentClickListener(),this.bindDocumentResizeListener());break;case"void":this.onOverlayHide(),this.onHide.emit({})}},e.prototype.appendOverlay=function(){this.appendTo&&("body"===this.appendTo?document.body.appendChild(this.containerViewChild.nativeElement):o.DomHandler.appendChild(this.containerViewChild.nativeElement,this.appendTo))},e.prototype.restoreOverlayAppend=function(){this.container&&this.appendTo&&this.el.nativeElement.appendChild(this.containerViewChild.nativeElement)},e.prototype.moveOnTop=function(){this.autoZIndex&&(this.containerViewChild.nativeElement.style.zIndex=String(this.baseZIndex+ ++o.DomHandler.zindex))},e.prototype.hide=function(){this.visible=!1},e.prototype.onWindowResize=function(){this.hide()},e.prototype.onClick=function(e){this.preventDocumentDefault=!0},e.prototype.goBack=function(){this.left+=this.menuWidth},e.prototype.bindDocumentClickListener=function(){var e=this;this.documentClickListener||(this.documentClickListener=this.renderer.listen("document","click",(function(){e.preventDocumentDefault||(e.hide(),e.cd.detectChanges()),e.preventDocumentDefault=!1})))},e.prototype.unbindDocumentClickListener=function(){this.documentClickListener&&(this.documentClickListener(),this.documentClickListener=null)},e.prototype.bindDocumentResizeListener=function(){this.documentResizeListener=this.onWindowResize.bind(this),window.addEventListener("resize",this.documentResizeListener)},e.prototype.unbindDocumentResizeListener=function(){this.documentResizeListener&&(window.removeEventListener("resize",this.documentResizeListener),this.documentResizeListener=null)},e.prototype.onOverlayHide=function(){this.unbindDocumentClickListener(),this.unbindDocumentResizeListener(),this.preventDocumentDefault=!1,this.target=null,this.left=0},e.prototype.ngOnDestroy=function(){this.popup&&(this.restoreOverlayAppend(),this.onOverlayHide())},e.ctorParameters=function(){return[{type:t.ElementRef},{type:t.Renderer2},{type:t.ChangeDetectorRef}]},r([t.Input()],e.prototype,"model",void 0),r([t.Input()],e.prototype,"popup",void 0),r([t.Input()],e.prototype,"style",void 0),r([t.Input()],e.prototype,"styleClass",void 0),r([t.Input()],e.prototype,"menuWidth",void 0),r([t.Input()],e.prototype,"viewportHeight",void 0),r([t.Input()],e.prototype,"effectDuration",void 0),r([t.Input()],e.prototype,"easing",void 0),r([t.Input()],e.prototype,"backLabel",void 0),r([t.Input()],e.prototype,"appendTo",void 0),r([t.Input()],e.prototype,"autoZIndex",void 0),r([t.Input()],e.prototype,"baseZIndex",void 0),r([t.Input()],e.prototype,"showTransitionOptions",void 0),r([t.Input()],e.prototype,"hideTransitionOptions",void 0),r([t.Output()],e.prototype,"onShow",void 0),r([t.Output()],e.prototype,"onHide",void 0),r([t.ViewChild("container")],e.prototype,"container",null),r([t.ViewChild("backward")],e.prototype,"backward",null),r([t.ViewChild("slideMenuContent")],e.prototype,"slideMenuContent",null),e=r([t.Component({selector:"p-slideMenu",template:'\n <div #container [ngClass]="{\'ui-slidemenu ui-widget ui-widget-content ui-corner-all\':true, \'ui-slidemenu-dynamic ui-shadow\':popup}" \n [class]="styleClass" [ngStyle]="style" (click)="onClick($event)"\n [@overlayAnimation]="{value: \'visible\', params: {showTransitionParams: showTransitionOptions, hideTransitionParams: hideTransitionOptions}}" [@.disabled]="popup !== true" (@overlayAnimation.start)="onOverlayAnimationStart($event)" *ngIf="!popup || visible">\n <div class="ui-slidemenu-wrapper" [style.height]="left ? viewportHeight + \'px\' : \'auto\'">\n <div #slideMenuContent class="ui-slidemenu-content">\n <p-slideMenuSub [item]="model" root="root" [index]="0" [menuWidth]="menuWidth" [effectDuration]="effectDuration" [easing]="easing"></p-slideMenuSub>\n </div>\n <div #backward class="ui-slidemenu-backward ui-widget-header ui-corner-all" [style.display]="left ? \'block\' : \'none\'" (click)="goBack()">\n <span class="ui-slidemenu-backward-icon pi pi-fw pi-caret-left"></span><span>{{backLabel}}</span>\n </div>\n </div>\n </div>\n ',animations:[i.trigger("overlayAnimation",[i.state("void",i.style({transform:"translateY(5%)",opacity:0})),i.state("visible",i.style({transform:"translateY(0)",opacity:1})),i.transition("void => visible",i.animate("{{showTransitionParams}}")),i.transition("visible => void",i.animate("{{hideTransitionParams}}"))])],changeDetection:t.ChangeDetectionStrategy.Default})],e)}(),d=function(){function e(){}return e=r([t.NgModule({imports:[n.CommonModule,s.RouterModule],exports:[u,s.RouterModule],declarations:[u,l]})],e)}();e.SlideMenu=u,e.SlideMenuModule=d,e.SlideMenuSub=l,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=primeng-slidemenu.umd.min.js.map