{"version":3,"sources":["../../src/app/components/confirmdialog/confirmdialog.ts"],"names":["showAnimation","animation","style","transform","opacity","animate","hideAnimation","ConfirmDialog","el","renderer","confirmationService","zone","cd","config","_this","this","acceptIcon","acceptVisible","rejectIcon","rejectVisible","closeOnEscape","blockScroll","closable","autoZIndex","baseZIndex","transitionOptions","focusTrap","defaultFocus","onHide","EventEmitter","_position","transformOptions","subscription","requireConfirmation$","subscribe","confirmation","key","confirmationOptions","message","icon","header","acceptLabel","rejectLabel","acceptButtonStyleClass","rejectButtonStyleClass","dismissableMask","accept","acceptEvent","reject","rejectEvent","visible","hide","Object","defineProperty","prototype","_visible","value","maskVisible","markForCheck","ngAfterContentInit","templates","forEach","item","getType","footerTemplate","template","option","name","source","hasOwnProperty","onAnimationStart","event","toState","container","element","wrapper","parentElement","contentContainer","DomHandler","findSingle","getElementToFocus","focus","appendContainer","moveOnTop","bindGlobalListeners","enableModality","onAnimationEnd","onOverlayHide","appendTo","document","body","appendChild","restoreAppend","nativeElement","addClass","maskClickListener","listen","isSameNode","target","close","disableModality","removeClass","unbindMaskClickListener","detectChanges","emit","ConfirmEventType","CANCEL","preventDefault","type","zIndex","String","zindex","getMaskClass","maskClass","p-dialog-mask p-component-overlay","p-dialog-mask-scrollblocker","getPositionClass","toString","pos","find","position","documentEscapeListener","documentTarget","ownerDocument","which","parseInt","focusableElements","getFocusableElements","length","activeElement","focusedIndex","indexOf","shiftKey","unbindGlobalListeners","ngOnDestroy","unsubscribe","ACCEPT","REJECT","getTranslation","TranslationKeys","Component","args","selector","animations","trigger","transition","useAnimation","changeDetection","ChangeDetectionStrategy","OnPush","encapsulation","ViewEncapsulation","None","ElementRef","Renderer2","ConfirmationService","NgZone","ChangeDetectorRef","PrimeNGConfig","Input","Output","ContentChild","Footer","ViewChild","ContentChildren","PrimeTemplate","NgModule","imports","CommonModule","ButtonModule","exports","SharedModule","declarations"],"mappings":"8oBAUA,IAAMA,EAAgBC,EAAAA,UAAU,CAC5BC,EAAAA,MA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y,Input,EventEmitter,Renderer2,ContentChild,NgZone,ViewChild,ChangeDetectorRef,ChangeDetectionStrategy, ViewEncapsulation, ContentChildren, QueryList, TemplateRef, AfterContentInit, Output} from '@angular/core';\nimport {trigger,style,transition,animate,AnimationEvent, useAnimation, animation} from '@angular/animations';\nimport {CommonModule} from '@angular/common';\nimport {DomHandler} from 'primeng/dom';\nimport {Footer,SharedModule, PrimeTemplate, PrimeNGConfig, TranslationKeys, ConfirmEventType} from 'primeng/api';\nimport {ButtonModule} from 'primeng/button';\nimport {Confirmation} from 'primeng/api';\nimport {ConfirmationService} from 'primeng/api';\nimport {Subscription} from 'rxjs';\n\nconst showAnimation = animation([\n style({ transform: '{{transform}}', opacity: 0 }),\n animate('{{transition}}', style({ transform: 'none', opacity: 1 }))\n]);\n\nconst hideAnimation = animation([\n animate('{{transition}}', style({ transform: '{{transform}}', opacity: 0 }))\n]);\n\n@Component({\n selector: 'p-confirmDialog',\n template: `\n
\n
\n
\n {{option('header')}}\n
\n \n
\n
\n
\n \n \n
\n
\n \n \n
\n
\n \n \n
\n
\n
\n `,\n animations: [\n trigger('animation', [\n transition('void => visible', [\n useAnimation(showAnimation)\n ]),\n transition('visible => void', [\n useAnimation(hideAnimation)\n ])\n ])\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n styleUrls: ['../dialog/dialog.css']\n})\nexport class ConfirmDialog implements AfterContentInit,OnDestroy {\n\n @Input() header: string;\n\n @Input() icon: string;\n\n @Input() message: string;\n\n @Input() style: any;\n\n @Input() styleClass: string;\n\n @Input() maskStyleClass: string;\n\n @Input() acceptIcon: string = 'pi pi-check';\n\n @Input() acceptLabel: string;\n\n @Input() acceptAriaLabel: string;\n\n @Input() acceptVisible: boolean = true;\n\n @Input() rejectIcon: string = 'pi pi-times';\n\n @Input() rejectLabel: string;\n\n @Input() rejectAriaLabel: string;\n\n @Input() rejectVisible: boolean = true;\n\n @Input() acceptButtonStyleClass: string;\n\n @Input() rejectButtonStyleClass: string;\n\n @Input() closeOnEscape: boolean = true;\n\n @Input() dismissableMask: boolean;\n\n @Input() blockScroll: boolean = true;\n\n @Input() rtl: boolean;\n\n @Input() closable: boolean = true;\n\n @Input() appendTo: any;\n\n @Input() key: string;\n\n @Input() autoZIndex: boolean = true;\n\n @Input() baseZIndex: number = 0;\n\n @Input() transitionOptions: string = '150ms cubic-bezier(0, 0, 0.2, 1)';\n\n @Input() focusTrap: boolean = true;\n\n @Input() defaultFocus: string = 'accept';\n\n @Input() get visible(): any {\n return this._visible;\n }\n set visible(value:any) {\n this._visible = value;\n\n if (this._visible && !this.maskVisible) {\n this.maskVisible = true;\n }\n\n this.cd.markForCheck();\n }\n\n @Input() get position(): string {\n return this._position;\n };\n\n set position(value: string) {\n this._position = value;\n\n switch (value) {\n case 'top-left':\n case 'bottom-left':\n case 'left':\n this.transformOptions = \"translate3d(-100%, 0px, 0px)\";\n break;\n case 'top-right':\n case 'bottom-right':\n case 'right':\n this.transformOptions = \"translate3d(100%, 0px, 0px)\";\n break;\n case 'bottom':\n this.transformOptions = \"translate3d(0px, 100%, 0px)\";\n break;\n case 'top':\n this.transformOptions = \"translate3d(0px, -100%, 0px)\";\n break;\n default:\n this.transformOptions = \"scale(0.7)\";\n break;\n }\n }\n\n @Output() onHide: EventEmitter = new EventEmitter();\n\n @ContentChild(Footer) footer;\n\n @ViewChild('content') contentViewChild: ElementRef;\n\n @ContentChildren(PrimeTemplate) templates: QueryList;\n\n ngAfterContentInit() {\n this.templates.forEach((item) => {\n switch(item.getType()) {\n case 'footerTemplate':\n this.footerTemplate = item.template;\n break;\n }\n });\n }\n\n footerTemplate: TemplateRef;\n\n confirmation: Confirmation;\n\n _visible: boolean;\n\n maskVisible: boolean;\n\n documentEscapeListener: any;\n\n container: HTMLDivElement;\n\n wrapper: HTMLElement;\n\n contentContainer: HTMLDivElement;\n\n subscription: Subscription;\n\n maskClickListener: Function;\n\n preWidth: number;\n\n _position: string = \"center\";\n\n transformOptions: any = \"scale(0.7)\";\n\n confirmationOptions: Confirmation;\n\n constructor(public el: ElementRef, public renderer: Renderer2, private confirmationService: ConfirmationService, public zone: NgZone, private cd: ChangeDetectorRef, public config: PrimeNGConfig) {\n this.subscription = this.confirmationService.requireConfirmation$.subscribe(confirmation => {\n if (!confirmation) {\n this.hide();\n return;\n }\n\n if (confirmation.key === this.key) {\n this.confirmation = confirmation;\n this.confirmationOptions = {\n message: this.confirmation.message||this.message,\n icon: this.confirmation.icon||this.icon,\n header: this.confirmation.header||this.header,\n rejectVisible: this.confirmation.rejectVisible == null ? this.rejectVisible : this.confirmation.rejectVisible,\n acceptVisible: this.confirmation.acceptVisible == null ? this.acceptVisible : this.confirmation.acceptVisible,\n acceptLabel: this.confirmation.acceptLabel||this.acceptLabel,\n rejectLabel: this.confirmation.rejectLabel||this.rejectLabel,\n acceptIcon: this.confirmation.acceptIcon || this.acceptIcon,\n rejectIcon: this.confirmation.rejectIcon || this.rejectIcon,\n acceptButtonStyleClass: this.confirmation.acceptButtonStyleClass || this.acceptButtonStyleClass,\n rejectButtonStyleClass: this.confirmation.rejectButtonStyleClass || this.rejectButtonStyleClass,\n defaultFocus: this.confirmation.defaultFocus || this.defaultFocus,\n blockScroll: (this.confirmation.blockScroll === false || this.confirmation.blockScroll === true) ? this.confirmation.blockScroll : this.blockScroll,\n closeOnEscape: (this.confirmation.closeOnEscape === false || this.confirmation.closeOnEscape === true) ? this.confirmation.closeOnEscape : this.closeOnEscape,\n dismissableMask: (this.confirmation.dismissableMask === false || this.confirmation.dismissableMask === true) ? this.confirmation.dismissableMask : this.dismissableMask\n };\n\n if (this.confirmation.accept) {\n this.confirmation.acceptEvent = new EventEmitter();\n this.confirmation.acceptEvent.subscribe(this.confirmation.accept);\n }\n\n if (this.confirmation.reject) {\n this.confirmation.rejectEvent = new EventEmitter();\n this.confirmation.rejectEvent.subscribe(this.confirmation.reject);\n }\n\n this.visible = true;\n }\n });\n }\n\n option(name: string) {\n const source = this.confirmationOptions || this;\n if (source.hasOwnProperty(name)) {\n return source[name];\n }\n return undefined;\n }\n\n onAnimationStart(event: AnimationEvent) {\n switch(event.toState) {\n case 'visible':\n this.container = event.element;\n this.wrapper = this.container.parentElement;\n this.contentContainer = DomHandler.findSingle(this.container, '.p-dialog-content');\n\n const element = this.getElementToFocus();\n if (element) {\n element.focus();\n }\n\n this.appendContainer();\n this.moveOnTop();\n this.bindGlobalListeners();\n this.enableModality();\n break;\n }\n }\n\n onAnimationEnd(event: AnimationEvent) {\n switch(event.toState) {\n case 'void':\n this.onOverlayHide();\n break;\n }\n }\n\n getElementToFocus() {\n switch(this.option('defaultFocus')) {\n case 'accept':\n return DomHandler.findSingle(this.container, '.p-confirm-dialog-accept');\n\n case 'reject':\n return DomHandler.findSingle(this.container, '.p-confirm-dialog-reject');\n\n case 'close':\n return DomHandler.findSingle(this.container, '.p-dialog-header-close');\n\n case 'none':\n return null;\n\n //backward compatibility\n default:\n return DomHandler.findSingle(this.container, '.p-confirm-dialog-accept');\n }\n }\n\n appendContainer() {\n if (this.appendTo) {\n if (this.appendTo === 'body')\n document.body.appendChild(this.wrapper);\n else\n DomHandler.appendChild(this.wrapper, this.appendTo);\n }\n }\n\n restoreAppend() {\n if (this.wrapper && this.appendTo) {\n this.el.nativeElement.appendChild(this.wrapper);\n }\n }\n\n enableModality() {\n if (this.option('blockScroll')) {\n DomHandler.addClass(document.body, 'p-overflow-hidden');\n }\n\n if (this.option('dismissableMask')) {\n this.maskClickListener = this.renderer.listen(this.wrapper, 'mousedown', (event: any) => {\n if (this.wrapper && this.wrapper.isSameNode(event.target)) {\n this.close(event);\n }\n });\n }\n }\n\n disableModality() {\n this.maskVisible = false;\n\n if (this.option('blockScroll')) {\n DomHandler.removeClass(document.body, 'p-overflow-hidden');\n }\n\n if (this.dismissableMask) {\n this.unbindMaskClickListener();\n }\n\n if (this.container && !this.cd['destroyed']) {\n this.cd.detectChanges();\n }\n }\n\n close(event: Event) {\n if (this.confirmation.rejectEvent) {\n this.confirmation.rejectEvent.emit(ConfirmEventType.CANCEL);\n }\n\n this.hide(ConfirmEventType.CANCEL);\n event.preventDefault();\n }\n\n hide(type?) {\n this.onHide.emit(type);\n this.visible = false;\n this.confirmation = null;\n this.confirmationOptions = null;\n }\n\n moveOnTop() {\n if (this.autoZIndex) {\n this.container.style.zIndex = String(this.baseZIndex + (++DomHandler.zindex));\n this.wrapper.style.zIndex = String(this.baseZIndex + (DomHandler.zindex - 1));\n }\n }\n\n getMaskClass() {\n let maskClass = {'p-dialog-mask p-component-overlay': true, 'p-dialog-mask-scrollblocker': this.blockScroll};\n maskClass[this.getPositionClass().toString()] = true;\n return maskClass;\n }\n\n getPositionClass() {\n const positions = ['left', 'right', 'top', 'top-left', 'top-right', 'bottom', 'bottom-left', 'bottom-right'];\n const pos = positions.find(item => item === this.position);\n\n return pos ? `p-dialog-${pos}` : '';\n }\n\n bindGlobalListeners() {\n if ((this.option('closeOnEscape') && this.closable) || this.focusTrap && !this.documentEscapeListener) {\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 && (this.option('closeOnEscape') && this.closable)) {\n if (parseInt(this.container.style.zIndex) === (DomHandler.zindex + this.baseZIndex) && this.visible) {\n this.close(event);\n }\n }\n\n if (event.which === 9 && this.focusTrap) {\n event.preventDefault();\n\n let focusableElements = DomHandler.getFocusableElements(this.container);\n\n if (focusableElements && focusableElements.length > 0) {\n if (!focusableElements[0].ownerDocument.activeElement) {\n focusableElements[0].focus();\n }\n else {\n let focusedIndex = focusableElements.indexOf(focusableElements[0].ownerDocument.activeElement);\n\n if (event.shiftKey) {\n if (focusedIndex == -1 || focusedIndex === 0)\n focusableElements[focusableElements.length - 1].focus();\n else\n focusableElements[focusedIndex - 1].focus();\n }\n else {\n if (focusedIndex == -1 || focusedIndex === (focusableElements.length - 1))\n focusableElements[0].focus();\n else\n focusableElements[focusedIndex + 1].focus();\n }\n }\n }\n }\n });\n }\n }\n\n unbindGlobalListeners() {\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 onOverlayHide() {\n this.disableModality();\n this.unbindGlobalListeners();\n this.container = null;\n }\n\n ngOnDestroy() {\n this.restoreAppend();\n this.onOverlayHide();\n this.subscription.unsubscribe();\n }\n\n accept() {\n if (this.confirmation && this.confirmation.acceptEvent) {\n this.confirmation.acceptEvent.emit();\n }\n\n this.hide(ConfirmEventType.ACCEPT);\n }\n\n reject() {\n if (this.confirmation && this.confirmation.rejectEvent) {\n this.confirmation.rejectEvent.emit(ConfirmEventType.REJECT);\n }\n\n this.hide(ConfirmEventType.REJECT);\n }\n\n get acceptButtonLabel(): string {\n return this.option('acceptLabel') || this.config.getTranslation(TranslationKeys.ACCEPT);\n }\n\n get rejectButtonLabel(): string {\n return this.option('rejectLabel') || this.config.getTranslation(TranslationKeys.REJECT);\n }\n}\n\n@NgModule({\n imports: [CommonModule,ButtonModule],\n exports: [ConfirmDialog,ButtonModule,SharedModule],\n declarations: [ConfirmDialog]\n})\nexport class ConfirmDialogModule { }\n"]}