{"version":3,"sources":["ng://primeng/splitbutton/splitbutton.ts"],"names":["SplitButton","el","renderer","router","cd","this","iconPos","onClick","EventEmitter","onDropdownClick","showTransitionOptions","hideTransitionOptions","overlayVisible","ariaId","UniqueComponentId","prototype","onDefaultButtonClick","event","emit","itemClick","item","disabled","preventDefault","url","command","originalEvent","show","onOverlayAnimationStart","toState","overlay","element","appendOverlay","style","zIndex","String","DomHandler","zindex","alignOverlay","bindDocumentClickListener","bindDocumentResizeListener","onOverlayHide","onDropdownButtonClick","dropdownClick","appendTo","absolutePosition","containerViewChild","nativeElement","relativePosition","document","body","appendChild","minWidth","getWidth","children","restoreOverlayAppend","_this","documentClickListener","listen","unbindDocumentClickListener","markForCheck","documentResizeListener","onWindowResize","bind","window","addEventListener","unbindDocumentResizeListener","removeEventListener","ngOnDestroy","ElementRef","Renderer2","Router","ChangeDetectorRef","__decorate","Input","Output","ViewChild","Component","selector","template","animations","trigger","state","transform","opacity","transition","animate","changeDetection","ChangeDetectionStrategy","Default","SplitButtonModule","NgModule","imports","CommonModule","ButtonModule","RouterModule","exports","declarations"],"mappings":"kgCAAAA,EAAA,WA2GI,SAAAA,EAAmBC,EAAuBC,EAA4BC,EAAuBC,GAA1EC,KAAAJ,GAAAA,EAAuBI,KAAAH,SAAAA,EAA4BG,KAAAF,OAAAA,EAAuBE,KAAAD,GAAAA,EA9CpFC,KAAAC,QAAkB,OAIjBD,KAAAE,QAA6B,IAAIC,EAAAA,aAEjCH,KAAAI,gBAAqC,IAAID,EAAAA,aAkB1CH,KAAAK,sBAAgC,iBAEhCL,KAAAM,sBAAgC,gBAQlCN,KAAAO,gBAA0B,EAa7BP,KAAKQ,OAASC,EAAAA,oBAAsB,QAgI5C,OA7HId,EAAAe,UAAAC,qBAAA,SAAqBC,GACjBZ,KAAKE,QAAQW,KAAKD,IAGtBjB,EAAAe,UAAAI,UAAA,SAAUF,EAAcG,GAChBA,EAAKC,SACLJ,EAAMK,kBAILF,EAAKG,KACNN,EAAMK,iBA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,qDApCF3E,EAAWwE,EAAA,CA7CvBI,EAAAA,UAAU,CACPC,SAAU,gBACVC,SAAU,2vFA2BVC,WAAY,CACRC,EAAAA,QAAQ,mBAAoB,CACxBC,EAAAA,MAAM,OAAQjD,EAAAA,MAAM,CAChBkD,UAAW,iBACXC,QAAS,KAEbF,EAAAA,MAAM,UAAWjD,EAAAA,MAAM,CACnBkD,UAAW,gBACXC,QAAS,KAEbC,EAAAA,WAAW,kBAAmBC,EAAAA,QAAQ,6BACtCD,EAAAA,WAAW,kBAAmBC,EAAAA,QAAQ,gCAG9CC,gBAAiBC,EAAAA,wBAAwBC,WAEhCxF,GAvDb,gBAmPA,SAAAyF,KAAiC,OAApBA,EAAiBjB,EAAA,CAL7BkB,EAAAA,SAAS,CACNC,QAAS,CAACC,EAAAA,aAAaC,EAAAA,aAAaC,EAAAA,cACpCC,QAAS,CAAC/F,EAAY6F,EAAAA,aAAaC,EAAAA,cACnCE,aAAc,CAAChG,MAENyF","sourcesContent":["import {NgModule,Component,ElementRef,OnDestroy,Input,Output,EventEmitter,Renderer2,ChangeDetectorRef,ViewChild,ChangeDetectionStrategy} from '@angular/core';\nimport {trigger,state,style,transition,animate,AnimationEvent} from '@angular/animations';\nimport {CommonModule} from '@angular/common';\nimport {DomHandler} from 'primeng/dom';\nimport {MenuItem} from 'primeng/api';\nimport {ButtonModule} from 'primeng/button';\nimport {Router} from '@angular/router';\nimport {RouterModule} from '@angular/router';\nimport { UniqueComponentId } from 'primeng/utils';\n\n@Component({\n selector: 'p-splitButton',\n template: `\n
\n \n
\n \n
\n
\n `,\n animations: [\n trigger('overlayAnimation', [\n state('void', style({\n transform: 'translateY(5%)',\n opacity: 0\n })),\n state('visible', style({\n transform: 'translateY(0)',\n opacity: 1\n })),\n transition('void => visible', animate('{{showTransitionParams}}')),\n transition('visible => void', animate('{{hideTransitionParams}}'))\n ])\n ],\n changeDetection: ChangeDetectionStrategy.Default\n})\nexport class SplitButton implements OnDestroy {\n\n @Input() model: MenuItem[];\n\n @Input() icon: string;\n\n @Input() iconPos: string = 'left';\n \n @Input() label: string;\n \n @Output() onClick: EventEmitter = new EventEmitter();\n \n @Output() onDropdownClick: EventEmitter = new EventEmitter();\n \n @Input() style: any;\n \n @Input() styleClass: string;\n \n @Input() menuStyle: any;\n \n @Input() menuStyleClass: string;\n \n @Input() disabled: boolean;\n\n @Input() tabindex: number;\n \n @Input() appendTo: any;\n \n @Input() dir: string;\n\n @Input() showTransitionOptions: string = '225ms ease-out';\n\n @Input() hideTransitionOptions: string = '195ms ease-in';\n\n @ViewChild('container') containerViewChild: ElementRef;\n \n @ViewChild('defaultbtn') buttonViewChild: ElementRef;\n\n overlay: HTMLDivElement;\n \n public overlayVisible: boolean = false;\n \n public documentClickListener: any;\n \n public dropdownClick: boolean;\n \n public shown: boolean;\n\n ariaId: string;\n\n documentResizeListener: any;\n\n constructor(public el: ElementRef, public renderer: Renderer2, public router: Router, public cd: ChangeDetectorRef) {\n this.ariaId = UniqueComponentId() + '_list';\n }\n \n onDefaultButtonClick(event: Event) {\n this.onClick.emit(event);\n }\n \n itemClick(event: Event, item: MenuItem) {\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 this.overlayVisible = false;\n }\n \n show() {\n this.overlayVisible = !this.overlayVisible;\n }\n\n onOverlayAnimationStart(event: AnimationEvent) {\n switch (event.toState) {\n case 'visible':\n this.overlay = event.element;\n this.appendOverlay();\n this.overlay.style.zIndex = String(++DomHandler.zindex);\n this.alignOverlay();\n this.bindDocumentClickListener();\n this.bindDocumentResizeListener();\n break;\n\n case 'void':\n this.onOverlayHide();\n break;\n }\n }\n \n onDropdownButtonClick(event: Event) {\n this.onDropdownClick.emit(event);\n this.dropdownClick = true;\n this.show();\n }\n\n alignOverlay() {\n if (this.appendTo)\n DomHandler.absolutePosition(this.overlay, this.containerViewChild.nativeElement);\n else\n DomHandler.relativePosition(this.overlay, this.containerViewChild.nativeElement);\n }\n\n appendOverlay() {\n if (this.appendTo) {\n if (this.appendTo === 'body')\n document.body.appendChild(this.overlay);\n else\n DomHandler.appendChild(this.overlay, this.appendTo);\n\n if (!this.overlay.style.minWidth) {\n this.overlay.style.minWidth = DomHandler.getWidth(this.el.nativeElement.children[0]) + 'px';\n }\n }\n }\n\n restoreOverlayAppend() {\n if (this.overlay && this.appendTo) {\n this.el.nativeElement.appendChild(this.overlay);\n }\n }\n \n bindDocumentClickListener() {\n if (!this.documentClickListener) {\n this.documentClickListener = this.renderer.listen('document', 'click', () => {\n if (this.dropdownClick) {\n this.dropdownClick = false;\n }\n else {\n this.overlayVisible = false;\n this.unbindDocumentClickListener();\n this.cd.markForCheck();\n }\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 onWindowResize() {\n this.overlayVisible = false;\n }\n\n onOverlayHide() {\n this.unbindDocumentClickListener();\n this.unbindDocumentResizeListener();\n this.overlay = null;\n }\n \n ngOnDestroy() {\n this.restoreOverlayAppend();\n this.onOverlayHide();\n }\n}\n\n@NgModule({\n imports: [CommonModule,ButtonModule,RouterModule],\n exports: [SplitButton,ButtonModule,RouterModule],\n declarations: [SplitButton]\n})\nexport class SplitButtonModule { }\n"]}