{"version":3,"sources":["../../src/app/components/slidemenu/slidemenu.ts"],"names":["SlideMenuSub","slideMenu","this","backLabel","easing","prototype","itemClick","event","item","listitem","_this","disabled","preventDefault","url","command","originalEvent","items","animating","left","menuWidth","activeItem","setTimeout","effectDuration","popup","hide","ngOnDestroy","Component","args","selector","template","encapsulation","ViewEncapsulation","None","Inject","forwardRef","SlideMenu","Input","el","renderer","cd","viewportHeight","autoZIndex","baseZIndex","showTransitionOptions","hideTransitionOptions","onShow","EventEmitter","onHide","ngAfterViewChecked","viewportUpdated","containerViewChild","updateViewPort","Object","defineProperty","element","backwardViewChild","slideMenuContentViewChild","nativeElement","style","height","DomHandler","getHiddenElementOuterHeight","toggle","visible","show","preventDocumentDefault","target","currentTarget","markForCheck","onOverlayAnimationStart","toState","moveOnTop","emit","appendOverlay","absolutePosition","bindDocumentClickListener","bindDocumentResizeListener","bindScrollListener","onOverlayHide","appendTo","document","body","appendChild","restoreOverlayAppend","container","zIndex","String","zindex","onWindowResize","onClick","goBack","documentClickListener","documentTarget","ownerDocument","listen","detectChanges","unbindDocumentClickListener","documentResizeListener","bind","window","addEventListener","unbindDocumentResizeListener","removeEventListener","scrollHandler","ConnectedOverlayScrollHandler","unbindScrollListener","destroy","animations","trigger","transition","opacity","transform","animate","changeDetection","ChangeDetectionStrategy","OnPush","ElementRef","Renderer2","ChangeDetectorRef","Output","ViewChild","NgModule","imports","CommonModule","RouterModule","exports","declarations"],"mappings":"+lBA2DI,SAAAA,EAAiDC,GAZxCC,KAAAC,UAAoB,OAMpBD,KAAAE,OAAiB,WAOtBF,KAAKD,UAAYA,SAKrBD,EAAAK,UAAAC,UAAA,SAAUC,EAAOC,EAAgBC,GAAjC,IAAAC,EAAAR,KACQM,EAAKG,SACLJ,EAAMK,kBAILJ,EAAKK,KACNN,EAAMK,iBAGNJ,EAAKM,SACLN,EAAKM,QAAQ,CACTC,cAAeR,EACfC,KAAMA,IAIVA,EAAKQ,QAAUd,KAAKD,UAAUgB,YAC9Bf,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,EAAAA,aAAaC,EAAAA,cACvBC,QAAS,CAAC1F,EAAUyF,EAAAA,cACpBE,aAAc,CAAC3F,EAAUnC","sourcesContent":["import {NgModule,Component,ElementRef,AfterViewChecked,OnDestroy,Input,Renderer2,Inject,forwardRef,ViewChild,Output,EventEmitter,ChangeDetectorRef,ChangeDetectionStrategy, ViewEncapsulation} from '@angular/core';\nimport {trigger,state,style,transition,animate,AnimationEvent} from '@angular/animations';\nimport {CommonModule} from '@angular/common';\nimport {DomHandler, ConnectedOverlayScrollHandler} from 'primeng/dom';\nimport {MenuItem} from 'primeng/api';\nimport {RouterModule} from '@angular/router';\n\n@Component({\n selector: 'p-slideMenuSub',\n template: `\n \n `,\n encapsulation: ViewEncapsulation.None\n})\nexport class SlideMenuSub implements OnDestroy {\n\n @Input() item: MenuItem;\n\n @Input() root: boolean;\n\n @Input() backLabel: string = 'Back';\n\n @Input() menuWidth: number;\n\n @Input() effectDuration: any;\n\n @Input() easing: string = 'ease-out';\n\n @Input() index: number;\n\n slideMenu: SlideMenu;\n\n constructor(@Inject(forwardRef(() => SlideMenu)) slideMenu) {\n this.slideMenu = slideMenu as SlideMenu;\n }\n\n activeItem: any;\n\n itemClick(event, item: MenuItem, listitem: any) {\n if (item.disabled) {\n event.preventDefault();\n return;\n }\n\n if (!item.url) {\n event.preventDefault();\n }\n\n if (item.command) {\n item.command({\n originalEvent: event,\n item: item\n });\n }\n\n if (item.items && !this.slideMenu.animating) {\n this.slideMenu.left -= this.slideMenu.menuWidth;\n\n this.activeItem = listitem;\n this.slideMenu.animating = true;\n setTimeout(() => this.slideMenu.animating = false, this.effectDuration);\n }\n\n if (!item.items && this.slideMenu.popup) {\n this.slideMenu.hide();\n }\n }\n\n ngOnDestroy() {\n this.activeItem = null;\n }\n}\n\n@Component({\n selector: 'p-slideMenu',\n template: `\n
\n
\n
\n \n
\n
\n {{backLabel}}\n
\n
\n
\n `,\n animations: [\n trigger('overlayAnimation', [\n transition(':enter', [\n style({opacity: 0, transform: 'scaleY(0.8)'}),\n animate('{{showTransitionParams}}')\n ]),\n transition(':leave', [\n animate('{{hideTransitionParams}}', style({ opacity: 0 }))\n ])\n ])\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n styleUrls: ['./slidemenu.css']\n})\nexport class SlideMenu implements AfterViewChecked, OnDestroy {\n\n @Input() model: MenuItem[];\n\n @Input() popup: boolean;\n\n @Input() style: any;\n\n @Input() styleClass: string;\n\n @Input() menuWidth: number = 190;\n\n @Input() viewportHeight: number = 180;\n\n @Input() effectDuration: any = 250;\n\n @Input() easing: string = 'ease-out';\n\n @Input() backLabel: string = 'Back';\n\n @Input() appendTo: any;\n\n @Input() autoZIndex: boolean = true;\n\n @Input() baseZIndex: number = 0;\n\n @Input() showTransitionOptions: string = '.12s cubic-bezier(0, 0, 0.2, 1)';\n\n @Input() hideTransitionOptions: string = '.1s linear';\n\n @Output() onShow: EventEmitter = new EventEmitter();\n\n @Output() onHide: EventEmitter = new EventEmitter();\n\n containerViewChild: ElementRef;\n\n backwardViewChild: ElementRef;\n\n slideMenuContentViewChild: ElementRef;\n\n documentClickListener: any;\n\n documentResizeListener: any;\n\n preventDocumentDefault: boolean;\n\n scrollHandler: any;\n\n left: number = 0;\n\n animating: boolean = false;\n\n target: any;\n\n visible: boolean;\n\n viewportUpdated: boolean;\n\n constructor(public el: ElementRef, public renderer: Renderer2, public cd: ChangeDetectorRef) {}\n\n ngAfterViewChecked() {\n if (!this.viewportUpdated && !this.popup && this.containerViewChild) {\n this.updateViewPort();\n this.viewportUpdated = true;\n }\n }\n\n @ViewChild('container') set container(element: ElementRef) {\n this.containerViewChild = element;\n }\n\n @ViewChild('backward') set backward(element: ElementRef) {\n this.backwardViewChild = element;\n }\n\n @ViewChild('slideMenuContent') set slideMenuContent(element: ElementRef) {\n this.slideMenuContentViewChild = element;\n }\n\n updateViewPort() {\n this.slideMenuContentViewChild.nativeElement.style.height = this.viewportHeight - DomHandler.getHiddenElementOuterHeight(this.backwardViewChild.nativeElement) + 'px';\n }\n\n toggle(event) {\n if (this.visible)\n this.hide();\n else\n this.show(event);\n\n this.preventDocumentDefault = true;\n }\n\n show(event) {\n this.target = event.currentTarget;\n this.visible = true;\n this.preventDocumentDefault = true;\n this.cd.markForCheck();\n }\n\n onOverlayAnimationStart(event: AnimationEvent) {\n switch(event.toState) {\n case 'visible':\n if (this.popup) {\n this.updateViewPort();\n this.moveOnTop();\n this.onShow.emit({});\n this.appendOverlay();\n DomHandler.absolutePosition(this.containerViewChild.nativeElement, this.target);\n this.bindDocumentClickListener();\n this.bindDocumentResizeListener();\n this.bindScrollListener();\n }\n break;\n\n case 'void':\n this.onOverlayHide();\n this.onHide.emit({});\n break;\n }\n }\n\n appendOverlay() {\n if (this.appendTo) {\n if (this.appendTo === 'body')\n document.body.appendChild(this.containerViewChild.nativeElement);\n else\n DomHandler.appendChild(this.containerViewChild.nativeElement, this.appendTo);\n }\n }\n\n restoreOverlayAppend() {\n if (this.container && this.appendTo) {\n this.el.nativeElement.appendChild(this.containerViewChild.nativeElement);\n }\n }\n\n moveOnTop() {\n if (this.autoZIndex) {\n this.containerViewChild.nativeElement.style.zIndex = String(this.baseZIndex + (++DomHandler.zindex));\n }\n }\n\n hide() {\n this.visible = false;\n this.cd.markForCheck();\n }\n\n onWindowResize() {\n this.hide();\n }\n\n onClick(event) {\n this.preventDocumentDefault = true;\n }\n\n goBack() {\n this.left += this.menuWidth;\n }\n\n bindDocumentClickListener() {\n if (!this.documentClickListener) {\n const documentTarget: any = this.el ? this.el.nativeElement.ownerDocument : 'document';\n\n this.documentClickListener = this.renderer.listen(documentTarget, 'click', () => {\n if (!this.preventDocumentDefault) {\n this.hide();\n this.cd.detectChanges();\n }\n\n this.preventDocumentDefault = false;\n });\n }\n }\n\n unbindDocumentClickListener() {\n if (this.documentClickListener) {\n this.documentClickListener();\n this.documentClickListener = null;\n }\n }\n\n bindDocumentResizeListener() {\n this.documentResizeListener = this.onWindowResize.bind(this);\n window.addEventListener('resize', this.documentResizeListener);\n }\n\n unbindDocumentResizeListener() {\n if (this.documentResizeListener) {\n window.removeEventListener('resize', this.documentResizeListener);\n this.documentResizeListener = null;\n }\n }\n\n bindScrollListener() {\n if (!this.scrollHandler) {\n this.scrollHandler = new ConnectedOverlayScrollHandler(this.target, () => {\n if (this.visible) {\n this.hide();\n }\n });\n }\n\n this.scrollHandler.bindScrollListener();\n }\n\n unbindScrollListener() {\n if (this.scrollHandler) {\n this.scrollHandler.unbindScrollListener();\n }\n }\n\n onOverlayHide() {\n this.unbindDocumentClickListener();\n this.unbindDocumentResizeListener();\n this.unbindScrollListener();\n this.preventDocumentDefault = false;\n this.target = null;\n this.left = 0;\n }\n\n ngOnDestroy() {\n if (this.popup) {\n if (this.scrollHandler) {\n this.scrollHandler.destroy();\n this.scrollHandler = null;\n }\n\n this.restoreOverlayAppend();\n this.onOverlayHide();\n }\n }\n\n}\n\n@NgModule({\n imports: [CommonModule,RouterModule],\n exports: [SlideMenu,RouterModule],\n declarations: [SlideMenu,SlideMenuSub]\n})\nexport class SlideMenuModule { }\n"]}