{"version":3,"sources":["../../src/app/components/inplace/inplace.ts"],"names":["Component","args","selector","template","Inplace","cd","this","closeIcon","onActivate","EventEmitter","onDeactivate","prototype","ngAfterContentInit","_this","templates","forEach","item","getType","displayTemplate","contentTemplate","onActivateClick","event","preventClick","activate","onDeactivateClick","deactivate","disabled","active","emit","markForCheck","hover","onKeydown","which","preventDefault","changeDetection","ChangeDetectionStrategy","OnPush","encapsulation","ViewEncapsulation","None","ChangeDetectorRef","Input","ContentChildren","PrimeTemplate","Output","NgModule","imports","CommonModule","ButtonModule","exports","InplaceDisplay","InplaceContent","declarations"],"mappings":"4gBASA,iCAJCA,EAAAA,UAASC,KAAA,CAAC,CACPC,SAAU,mBACVC,SAAU,sCAQd,iCAJCH,EAAAA,UAASC,KAAA,CAAC,CACPC,SAAU,mBACVC,SAAU,iDAoDV,SAAAC,EAAmBC,GAAAC,KAAAD,GAAAA,EAdVC,KAAAC,UAAoB,cAInBD,KAAAE,WAAgC,IAAIC,EAAAA,aAEpCH,KAAAI,aAAkC,IAAID,EAAAA,oBAUhDL,EAAAO,UAAAC,mBAAA,WAAA,IAAAC,EAAAP,KACIA,KAAKQ,UAAUC,SAAQ,SAACC,GACpB,OAAOA,EAAKC,WACR,IAAK,UACDJ,EAAKK,gBAAkBF,EAAKb,SAChC,MAEA,IAAK,UACDU,EAAKM,gBAAkBH,EAAKb,cAM5CC,EAAAO,UAAAS,gBAAA,SAAgBC,GACPf,KAAKgB,cACNhB,KAAKiB,SAASF,IAGtBjB,EAAAO,UAAAa,kBAAA,SAAkBH,GACTf,KAAKgB,cACNhB,KAAKmB,WAAWJ,IAGxBjB,EAAAO,UAAAY,SAAA,SAASF,GACAf,KAAKoB,WACNpB,KAAKqB,QAAS,EACdrB,KAAKE,WAAWoB,KAAKP,GACrBf,KAAKD,GAAGwB,iBAIhBzB,EAAAO,UAAAc,WAAA,SAAWJ,GACFf,KAAKoB,WACNpB,KAAKqB,QAAS,EACdrB,KAAKwB,OAAQ,EACbxB,KAAKI,aAAakB,KAAKP,GACvBf,KAAKD,GAAGwB,iBAIhBzB,EAAAO,UAAAoB,UAAA,SAAUV,GACc,KAAhBA,EAAMW,QACN1B,KAAKiB,SAASF,GACdA,EAAMY,4CA9FjBjC,EAAAA,UAASC,KAAA,CAAC,CACPC,SAAU,YACVC,SAAU,03BAcV+B,gBAAiBC,EAAAA,wBAAwBC,OACzCC,cAAeC,EAAAA,kBAAkBC,4UAlC4DC,EAAAA,qDAuC5FC,EAAAA,wBAEAA,EAAAA,wBAEAA,EAAAA,4BAEAA,EAAAA,qBAEAA,EAAAA,0BAEAA,EAAAA,yBAEAA,EAAAA,yBAEAC,EAAAA,gBAAezC,KAAA,CAAC0C,EAAAA,mCAEhBC,EAAAA,6BAEAA,EAAAA,gBAgEL,iCALCC,EAAAA,SAAQ5C,KAAA,CAAC,CACN6C,QAAS,CAACC,EAAAA,aAAaC,EAAAA,cACvBC,QAAS,CAAC7C,EAAQ8C,EAAeC,EAAeH,EAAAA,cAChDI,aAAc,CAAChD,EAAQ8C,EAAeC","sourcesContent":["import {NgModule,Component,Input,Output,EventEmitter,ChangeDetectionStrategy, ViewEncapsulation, ChangeDetectorRef, AfterContentInit, TemplateRef, QueryList, ContentChildren} from '@angular/core';\nimport {CommonModule} from '@angular/common';\nimport {ButtonModule} from 'primeng/button';\nimport {PrimeTemplate} from 'primeng/api';\n\n@Component({\n selector: 'p-inplaceDisplay',\n template: ''\n})\nexport class InplaceDisplay {}\n\n@Component({\n selector: 'p-inplaceContent',\n template: ''\n})\nexport class InplaceContent {}\n\n@Component({\n selector: 'p-inplace',\n template: `\n
\n
\n \n \n
\n
\n \n \n \n
\n
\n `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n styleUrls: ['./inplace.css']\n})\nexport class Inplace implements AfterContentInit {\n\n @Input() active: boolean;\n\n @Input() closable: boolean;\n\n @Input() disabled: boolean;\n\n @Input() preventClick: boolean;\n\n @Input() style: any;\n\n @Input() styleClass: string;\n\n @Input() closeIcon: string = 'pi pi-times';\n\n @ContentChildren(PrimeTemplate) templates: QueryList;\n\n @Output() onActivate: EventEmitter = new EventEmitter();\n\n @Output() onDeactivate: EventEmitter = new EventEmitter();\n\n hover: boolean;\n\n displayTemplate: TemplateRef;\n\n contentTemplate: TemplateRef;\n\n constructor(public cd: ChangeDetectorRef) {}\n\n ngAfterContentInit() {\n this.templates.forEach((item) => {\n switch(item.getType()) {\n case 'display':\n this.displayTemplate = item.template;\n break;\n\n case 'content':\n this.contentTemplate = item.template;\n break;\n }\n });\n }\n\n onActivateClick(event) {\n if (!this.preventClick)\n this.activate(event);\n }\n\n onDeactivateClick(event) {\n if (!this.preventClick)\n this.deactivate(event);\n }\n\n activate(event?: Event) {\n if (!this.disabled) {\n this.active = true;\n this.onActivate.emit(event);\n this.cd.markForCheck();\n }\n }\n\n deactivate(event?: Event) {\n if (!this.disabled) {\n this.active = false;\n this.hover = false;\n this.onDeactivate.emit(event);\n this.cd.markForCheck();\n }\n }\n\n onKeydown(event: KeyboardEvent) {\n if (event.which === 13) {\n this.activate(event);\n event.preventDefault();\n }\n }\n}\n\n@NgModule({\n imports: [CommonModule,ButtonModule],\n exports: [Inplace,InplaceDisplay,InplaceContent,ButtonModule],\n declarations: [Inplace,InplaceDisplay,InplaceContent]\n})\nexport class InplaceModule { }\n"]}