{"version":3,"sources":["../../src/app/components/panel/panel.ts"],"names":["idx","Panel","el","this","collapsed","expandIcon","collapseIcon","showHeader","toggler","collapsedChange","EventEmitter","onBeforeToggle","onAfterToggle","transitionOptions","id","prototype","ngAfterContentInit","_this","templates","forEach","item","getType","headerTemplate","template","contentTemplate","footerTemplate","iconTemplate","onHeaderClick","event","toggle","onIconClick","animating","emit","originalEvent","toggleable","expand","collapse","preventDefault","getBlockableElement","nativeElement","children","onToggleDone","Component","args","selector","animations","trigger","state","style","height","overflow","params","transition","animate","changeDetection","ChangeDetectionStrategy","OnPush","encapsulation","ViewEncapsulation","None","ElementRef","Input","Output","ContentChild","Footer","ContentChildren","PrimeTemplate","NgModule","imports","CommonModule","SharedModule","RippleModule","exports","declarations"],"mappings":"ykBAOA,IAAIA,EAAc,eAiGd,SAAAC,EAAoBC,GAAAC,KAAAD,GAAAA,EAtCXC,KAAAC,WAAqB,EAMrBD,KAAAE,WAAqB,aAErBF,KAAAG,aAAuB,cAEvBH,KAAAI,YAAsB,EAEtBJ,KAAAK,QAAkB,OAEjBL,KAAAM,gBAAqC,IAAIC,EAAAA,aAEzCP,KAAAQ,eAAoC,IAAID,EAAAA,aAExCP,KAAAS,cAAmC,IAAIF,EAAAA,aAExCP,KAAAU,kBAA4B,uCAgBrCV,KAAAW,GAAa,WAAWd,WAIxBC,EAAAc,UAAAC,mBAAA,WAAA,IAAAC,EAAAd,KACIA,KAAKe,UAAUC,SAAQ,SAACC,GACpB,OAAOA,EAAKC,WACR,IAAK,SACDJ,EAAKK,eAAiBF,EAAKG,SAC/B,MAEA,IAAK,UACDN,EAAKO,gBAAkBJ,EAAKG,SAChC,MAEA,IAAK,SACDN,EAAKQ,eAAiBL,EAAKG,SAC/B,MAEA,IAAK,QACDN,EAAKS,aAAeN,EAAKG,SAC7B,MAEA,QACIN,EAAKO,gBAAkBJ,EAAKG,cAM5CtB,EAAAc,UAAAY,cAAA,SAAcC,GACW,WAAjBzB,KAAKK,SACLL,KAAK0B,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/CC,gBAAiBC,EAAAA,wBAAwBC,OACxCC,cAAeC,EAAAA,kBAAkBC,kUAzDgBC,EAAAA,kDA8DhDC,EAAAA,sBAEAA,EAAAA,yBAEAA,EAAAA,qBAEAA,EAAAA,0BAEAA,EAAAA,0BAEAA,EAAAA,4BAEAA,EAAAA,0BAEAA,EAAAA,uBAEAA,EAAAA,+BAEAC,EAAAA,+BAEAA,EAAAA,8BAEAA,EAAAA,kCAEAD,EAAAA,2BAEAE,EAAAA,aAAYpB,KAAA,CAACqB,EAAAA,2BAEbC,EAAAA,gBAAetB,KAAA,CAACuB,EAAAA,wBAkGrB,iCALCC,EAAAA,SAAQxB,KAAA,CAAC,CACNyB,QAAS,CAACC,EAAAA,aAAaC,EAAAA,aAAaC,EAAAA,cACpCC,QAAS,CAACvE,EAAMqE,EAAAA,cAChBG,aAAc,CAACxE","sourcesContent":["import {NgModule,Component,Input,Output,EventEmitter,ElementRef,ContentChild,ChangeDetectionStrategy, ViewEncapsulation, ContentChildren, QueryList, TemplateRef, AfterContentInit} from '@angular/core';\nimport {CommonModule} from '@angular/common';\nimport {SharedModule,Footer, PrimeTemplate} from 'primeng/api';\nimport {BlockableUI} from 'primeng/api';\nimport {RippleModule} from 'primeng/ripple';\nimport {trigger,state,style,transition,animate} from '@angular/animations';\n\nlet idx: number = 0;\n\n@Component({\n selector: 'p-panel',\n template: `\n
\n
\n {{header}}\n \n \n
\n \n \n
\n
\n
\n
\n \n \n
\n \n
\n \n \n
\n
\n
\n `,\n animations: [\n trigger('panelContent', [\n state('hidden', style({\n height: '0',\n overflow: 'hidden'\n })),\n state('void', style({\n height: '{{height}}'\n }), {params: {height: '0'}}),\n state('visible', style({\n height: '*'\n })),\n transition('visible <=> hidden', [style({ overflow: 'hidden'}), animate('{{transitionParams}}')]),\n transition('void => hidden', animate('{{transitionParams}}')),\n transition('void => visible', animate('{{transitionParams}}'))\n ])\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n styleUrls: ['./panel.css']\n})\nexport class Panel implements AfterContentInit,BlockableUI {\n\n @Input() toggleable: boolean;\n\n @Input() header: string;\n\n @Input() collapsed: boolean = false;\n \n @Input() style: any;\n \n @Input() styleClass: string;\n \n @Input() expandIcon: string = 'pi pi-plus';\n \n @Input() collapseIcon: string = 'pi pi-minus';\n \n @Input() showHeader: boolean = true;\n\n @Input() toggler: string = \"icon\";\n \n @Output() collapsedChange: EventEmitter = new EventEmitter();\n\n @Output() onBeforeToggle: EventEmitter = new EventEmitter();\n\n @Output() onAfterToggle: EventEmitter = new EventEmitter();\n \n @Input() transitionOptions: string = '400ms cubic-bezier(0.86, 0, 0.07, 1)';\n\n @ContentChild(Footer) footerFacet;\n\n @ContentChildren(PrimeTemplate) templates: QueryList;\n\n public iconTemplate: TemplateRef;\n \n animating: boolean;\n\n headerTemplate: TemplateRef;\n\n contentTemplate: TemplateRef;\n\n footerTemplate: TemplateRef;\n \n id: string = `p-panel-${idx++}`;\n \n constructor(private el: ElementRef) { }\n\n ngAfterContentInit() {\n this.templates.forEach((item) => {\n switch(item.getType()) {\n case 'header':\n this.headerTemplate = item.template;\n break;\n\n case 'content':\n this.contentTemplate = item.template;\n break;\n\n case 'footer':\n this.footerTemplate = item.template;\n break;\n\n case 'icons':\n this.iconTemplate = item.template;\n break;\n\n default:\n this.contentTemplate = item.template;\n break;\n }\n });\n }\n\n onHeaderClick(event: Event) {\n if (this.toggler === 'header') {\n this.toggle(event);\n }\n }\n\n onIconClick(event: Event) {\n if (this.toggler === 'icon') {\n this.toggle(event);\n }\n }\n \n toggle(event: Event) {\n if (this.animating) {\n return false;\n }\n \n this.animating = true;\n this.onBeforeToggle.emit({originalEvent: event, collapsed: this.collapsed});\n \n if (this.toggleable) {\n if (this.collapsed)\n this.expand(event);\n else\n this.collapse(event);\n }\n \n event.preventDefault();\n }\n \n expand(event) {\n this.collapsed = false;\n this.collapsedChange.emit(this.collapsed);\n }\n \n collapse(event) {\n this.collapsed = true;\n this.collapsedChange.emit(this.collapsed);\n }\n \n getBlockableElement(): HTMLElement {\n return this.el.nativeElement.children[0];\n }\n \n onToggleDone(event: Event) {\n this.animating = false;\n this.onAfterToggle.emit({originalEvent: event, collapsed: this.collapsed});\n }\n\n}\n\n@NgModule({\n imports: [CommonModule,SharedModule,RippleModule],\n exports: [Panel,SharedModule],\n declarations: [Panel]\n})\nexport class PanelModule { }\n"]}