{"version":3,"sources":["../../src/app/components/fieldset/fieldset.ts"],"names":["idx","Fieldset","el","this","collapsed","collapsedChange","EventEmitter","onBeforeToggle","onAfterToggle","transitionOptions","id","prototype","ngAfterContentInit","_this","templates","forEach","item","getType","headerTemplate","template","contentTemplate","toggle","event","animating","emit","originalEvent","expand","collapse","preventDefault","getBlockableElement","nativeElement","children","onToggleDone","Component","args","selector","animations","trigger","state","style","height","overflow","transition","animate","changeDetection","ChangeDetectionStrategy","OnPush","encapsulation","ViewEncapsulation","None","ElementRef","Input","Output","ContentChildren","PrimeTemplate","NgModule","imports","CommonModule","RippleModule","exports","SharedModule","declarations"],"mappings":"+kBAOA,IAAIA,EAAc,eA0Ed,SAAAC,EAAoBC,GAAAC,KAAAD,GAAAA,EAtBXC,KAAAC,WAAqB,EAEpBD,KAAAE,gBAAqC,IAAIC,EAAAA,aAEzCH,KAAAI,eAAoC,IAAID,EAAAA,aAExCH,KAAAK,cAAmC,IAAIF,EAAAA,aAMxCH,KAAAM,kBAA4B,uCAYrCN,KAAAO,GAAa,cAAcV,WAE3BC,EAAAU,UAAAC,mBAAA,WAAA,IAAAC,EAAAV,KACIA,KAAKW,UAAUC,SAAQ,SAACC,GACpB,OAAOA,EAAKC,WACR,IAAK,SACDJ,EAAKK,eAAiBF,EAAKG,SAC/B,MAEA,IAAK,UACDN,EAAKO,gBAAkBJ,EAAKG,cAM5ClB,EAAAU,UAAAU,OAAA,SAAOC,GACH,GAAInB,KAAKoB,UACL,OAAO,EAGXpB,KAAKoB,WAAY,EACjBpB,KAAKI,eAAeiB,KAAK,CAACC,cAAeH,EAAOlB,UAAWD,KAAKC,YAE5DD,KAAKC,UACLD,KAAKuB,OAAOJ,GAEZnB,KAAKwB,SAASL,GAElBnB,KAAKK,cAAcgB,KAAK,CAACC,cAAeH,EAAOlB,UAAWD,KAAKC,YAC/DkB,EAAMM,kBAGV3B,EAAAU,UAAAe,OAAA,SAAOJ,GACHnB,KAAKC,WAAY,EACjBD,KAAKE,gBAAgBmB,KAAKrB,KAAKC,YAGnCH,EAAAU,UAAAgB,SAAA,SAASL,GACLnB,KAAKC,WAAY,EACjBD,KAAKE,gBAAgBmB,KAAKrB,KAAKC,YAGnCH,EAAAU,UAAAkB,oBAAA,WACI,OAAO1B,KAAKD,GAAG4B,cAAcC,SAAS,IAG1C9B,EAAAU,UAAAqB,aAAA,SAAaV,GACTnB,KAAKoB,WAAY,4BA1HxBU,EAAAA,UAASC,KAAA,CAAC,CACPC,SAAU,aACVhB,SAAU,qxDAyBViB,WAAY,CACRC,EAAAA,QAAQ,kBAAmB,CACvBC,EAAAA,MAAM,SAAUC,EAAAA,MAAM,CAClBC,OAAQ,IACRC,SAAU,YAEdH,EAAAA,MAAM,UAAWC,EAAAA,MAAM,CACnBC,OAAQ,OAEZE,EAAAA,WAAW,qBAAsB,CAACH,EAAAA,MAAM,CAACE,SAAU,WAAYE,EAAAA,QAAQ,0BACvED,EAAAA,WAAW,YAAaC,EAAAA,QAAQ,OAGxCC,gBAAiBC,EAAAA,wBAAwBC,OACzCC,cAAeC,EAAAA,kBAAkBC,oWAlDgBC,EAAAA,8CAuDhDC,EAAAA,0BAEAA,EAAAA,yBAEAA,EAAAA,+BAEAC,EAAAA,+BAEAA,EAAAA,8BAEAA,EAAAA,sBAEAD,EAAAA,0BAEAA,EAAAA,iCAEAA,EAAAA,yBAEAE,EAAAA,gBAAenB,KAAA,CAACoB,EAAAA,wBAoErB,iCALCC,EAAAA,SAAQrB,KAAA,CAAC,CACNsB,QAAS,CAACC,EAAAA,aAAaC,EAAAA,cACvBC,QAAS,CAAC1D,EAAS2D,EAAAA,cACnBC,aAAc,CAAC5D","sourcesContent":["import {NgModule,Component,Input,Output,EventEmitter,ElementRef,ChangeDetectionStrategy, ViewEncapsulation, AfterContentInit, QueryList, ContentChildren, TemplateRef} from '@angular/core';\nimport {trigger,state,style,transition,animate} from '@angular/animations';\nimport {CommonModule} from '@angular/common';\nimport {SharedModule, PrimeTemplate} from 'primeng/api';\nimport {BlockableUI} from 'primeng/api';\nimport {RippleModule} from 'primeng/ripple'; \n\nlet idx: number = 0;\n\n@Component({\n selector: 'p-fieldset',\n template: `\n
\n \n \n \n \n \n \n \n \n {{legend}}\n \n \n \n \n
\n
\n \n \n
\n
\n
\n `,\n animations: [\n trigger('fieldsetContent', [\n state('hidden', style({\n height: '0',\n overflow: 'hidden'\n })),\n state('visible', style({\n height: '*'\n })),\n transition('visible <=> hidden', [style({overflow: 'hidden'}), animate('{{transitionParams}}')]),\n transition('void => *', animate(0))\n ])\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n styleUrls: ['./fieldset.css']\n})\nexport class Fieldset implements AfterContentInit,BlockableUI {\n\n @Input() legend: string;\n\n @Input() toggleable: boolean;\n\n @Input() collapsed: boolean = false;\n\n @Output() collapsedChange: EventEmitter = new EventEmitter();\n \n @Output() onBeforeToggle: EventEmitter = new EventEmitter();\n\n @Output() onAfterToggle: EventEmitter = new EventEmitter();\n \n @Input() style: any;\n \n @Input() styleClass: string;\n\n @Input() transitionOptions: string = '400ms cubic-bezier(0.86, 0, 0.07, 1)';\n\n @ContentChildren(PrimeTemplate) templates: QueryList;\n \n public animating: boolean;\n\n headerTemplate: TemplateRef;\n\n contentTemplate: TemplateRef;\n \n constructor(private el: ElementRef) {}\n \n id: string = `p-fieldset-${idx++}`;\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 });\n }\n \n toggle(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.collapsed)\n this.expand(event);\n else\n this.collapse(event);\n \n this.onAfterToggle.emit({originalEvent: event, collapsed: this.collapsed}); \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 }\n\n}\n\n@NgModule({\n imports: [CommonModule,RippleModule],\n exports: [Fieldset,SharedModule],\n declarations: [Fieldset]\n})\nexport class FieldsetModule { }"]}