{"version":3,"file":"primeng-slidemenu.js","sources":["../../src/app/components/slidemenu/slidemenu.ts","../../src/app/components/slidemenu/primeng-slidemenu.ts"],"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","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;MAyCa,YAAY;IAkBrB,YAAiD,SAAS;QAZjD,cAAS,GAAW,MAAM,CAAC;QAM3B,WAAM,GAAW,UAAU,CAAC;QAOjC,IAAI,CAAC,SAAS,GAAG,SAAsB,CAAC;KAC3C;IAID,SAAS,CAAC,KAAK,EAAE,IAAc,EAAE,QAAa;QAC1C,IAAI,IAAI,CAAC,QAAQ,EAAE;YACf,KAAK,CAAC,cAAc,EAAE,CAAC;YACvB,OAAO;SACV;QAED,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE;YACX,KAAK,CAAC,cAAc,EAAE,CAAC;SAC1B;QAED,IAAI,IAAI,CAAC,OAAO,EAAE;YACd,IAAI,CAAC,OAAO,CAAC;gBACT,aAAa,EAAE,KAAK;gBACpB,IAAI,EAAE,IAA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