{"version":3,"file":"primeng-sidebar.umd.js","sources":["../../src/app/components/sidebar/sidebar.ts","../../src/app/components/sidebar/primeng-sidebar.ts"],"sourcesContent":["import {NgModule,Component,AfterViewInit,AfterViewChecked,OnDestroy,Input,Output,EventEmitter,ViewChild,ElementRef,Renderer2,ChangeDetectionStrategy, ViewEncapsulation, ContentChildren, QueryList, AfterContentInit, TemplateRef, ChangeDetectorRef} from '@angular/core';\nimport {trigger, state, style, transition, animate} from '@angular/animations';\nimport {CommonModule} from '@angular/common';\nimport {RippleModule} from 'primeng/ripple';\nimport {DomHandler} from 'primeng/dom';\nimport {PrimeTemplate} from 'primeng/api';\n\n@Component({\n selector: 'p-sidebar',\n template: `\n
\n
\n \n \n \n
\n
\n `,\n animations: [\n trigger('panelState', [\n state('hidden', style({\n opacity: 0\n })),\n state('visible', style({\n opacity: 1\n })),\n transition('visible => hidden', animate('300ms ease-in')),\n transition('hidden => visible', animate('300ms ease-out'))\n ])\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n styleUrls: ['./sidebar.css']\n})\nexport class Sidebar implements AfterViewInit, AfterContentInit, AfterViewChecked, OnDestroy {\n\n @Input() position: string = 'left';\n\n @Input() fullScreen: boolean;\n\n @Input() appendTo: string;\n\n @Input() blockScroll: boolean = false;\n\n @Input() style: any;\n\n @Input() styleClass: string;\n\n @Input() ariaCloseLabel: string;\n\n @Input() autoZIndex: boolean = true;\n\n @Input() baseZIndex: number = 0;\n\n @Input() modal: boolean = true;\n\n @Input() dismissible: boolean = true;\n\n @Input() showCloseIcon: boolean = true;\n\n @Input() closeOnEscape: boolean = true;\n\n @ViewChild('container') containerViewChild: ElementRef;\n\n @ContentChildren(PrimeTemplate) templates: QueryList;\n\n @Output() onShow: EventEmitter = new EventEmitter();\n\n @Output() onHide: EventEmitter = new EventEmitter();\n\n @Output() visibleChange:EventEmitter = new EventEmitter();\n\n initialized: boolean;\n\n _visible: boolean;\n\n preventVisibleChangePropagation: boolean;\n\n mask: HTMLDivElement;\n\n maskClickListener: Function;\n\n documentEscapeListener: Function;\n\n executePostDisplayActions: boolean;\n\n contentTemplate: TemplateRef;\n\n constructor(public el: ElementRef, public renderer: Renderer2, public cd: ChangeDetectorRef) {}\n\n ngAfterViewInit() {\n this.initialized = true;\n\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 if (this.visible) {\n this.show();\n }\n }\n\n ngAfterContentInit() {\n this.templates.forEach((item) => {\n switch(item.getType()) {\n case 'content':\n this.contentTemplate = item.template;\n break;\n\n default:\n this.contentTemplate = item.template;\n break;\n }\n });\n }\n\n @Input() get visible(): boolean {\n return this._visible;\n }\n\n set visible(val:boolean) {\n this._visible = val;\n\n if (this.initialized && this.containerViewChild && this.containerViewChild.nativeElement) {\n if (this._visible)\n this.show();\n else {\n if (this.preventVisibleChangePropagation)\n this.preventVisibleChangePropagation = false;\n else\n this.hide();\n }\n }\n }\n\n ngAfterViewChecked() {\n if (this.executePostDisplayActions) {\n this.onShow.emit({});\n this.executePostDisplayActions = false;\n }\n }\n\n show() {\n this.executePostDisplayActions = true;\n if (this.autoZIndex) {\n this.containerViewChild.nativeElement.style.zIndex = String(this.baseZIndex + (++DomHandler.zindex));\n }\n\n if (this.modal) {\n this.enableModality();\n }\n }\n\n hide() {\n this.onHide.emit({});\n\n if (this.modal) {\n this.disableModality();\n }\n }\n\n close(event: Event) {\n this.preventVisibleChangePropagation = true;\n this.hide();\n this.visibleChange.emit(false);\n event.preventDefault();\n }\n\n enableModality() {\n if (!this.mask) {\n this.mask = document.createElement('div');\n this.mask.style.zIndex = String(parseInt(this.containerViewChild.nativeElement.style.zIndex) - 1);\n DomHandler.addMultipleClasses(this.mask, 'p-component-overlay p-sidebar-mask');\n\n if (this.dismissible){\n this.maskClickListener = this.renderer.listen(this.mask, 'click', (event: any) => {\n if (this.dismissible) {\n this.close(event);\n }\n });\n }\n\n document.body.appendChild(this.mask);\n if (this.blockScroll) {\n DomHandler.addClass(document.body, 'p-overflow-hidden');\n }\n }\n }\n\n disableModality() {\n if (this.mask) {\n this.unbindMaskClickListener();\n document.body.removeChild(this.mask);\n if (this.blockScroll) {\n DomHandler.removeClass(document.body, 'p-overflow-hidden');\n }\n this.mask = null;\n }\n }\n\n onAnimationStart(event){\n switch(event.toState) {\n case 'visible':\n if (this.closeOnEscape) {\n this.bindDocumentEscapeListener();\n }\n break;\n\n case 'hidden':\n this.unbindGlobalListeners();\n break;\n }\n }\n\n bindDocumentEscapeListener() {\n const documentTarget: any = this.el ? this.el.nativeElement.ownerDocument : 'document';\n\n this.documentEscapeListener = this.renderer.listen(documentTarget, 'keydown', (event) => {\n if (event.which == 27) {\n if (parseInt(this.containerViewChild.nativeElement.style.zIndex) === (DomHandler.zindex + this.baseZIndex)) {\n this.close(event);\n }\n }\n });\n }\n\n unbindDocumentEscapeListener() {\n if (this.documentEscapeListener) {\n this.documentEscapeListener();\n this.documentEscapeListener = null;\n }\n }\n\n unbindMaskClickListener() {\n if (this.maskClickListener) {\n this.maskClickListener();\n this.maskClickListener = null;\n }\n }\n\n unbindGlobalListeners() {\n this.unbindMaskClickListener();\n this.unbindDocumentEscapeListener();\n }\n\n ngOnDestroy() {\n this.initialized = false;\n\n if (this.visible) {\n this.hide();\n }\n\n if (this.appendTo) {\n this.el.nativeElement.appendChild(this.containerViewChild.nativeElement);\n }\n\n\t\tthis.unbindGlobalListeners();\n }\n}\n\n@NgModule({\n imports: [CommonModule,RippleModule],\n exports: [Sidebar],\n declarations: [Sidebar]\n})\nexport class SidebarModule { }\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["EventEmitter","DomHandler","Component","trigger","state","style","transition","animate","ChangeDetectionStrategy","ViewEncapsulation","ElementRef","Renderer2","ChangeDetectorRef","Input","ViewChild","ContentChildren","PrimeTemplate","Output","NgModule","CommonModule","RippleModule"],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