{"version":3,"file":"primeng-inputtextarea.umd.js","sources":["../../src/app/components/inputtextarea/inputtextarea.ts","../../src/app/components/inputtextarea/primeng-inputtextarea.ts"],"sourcesContent":["import {NgModule,Directive,ElementRef,HostListener,Input,Output, EventEmitter,Optional, AfterViewInit, OnInit, OnDestroy, ChangeDetectorRef} from '@angular/core';\nimport {NgModel, NgControl} from '@angular/forms';\nimport {CommonModule} from '@angular/common';\nimport { Subscription } from 'rxjs';\n\n@Directive({\n selector: '[pInputTextarea]',\n host: {\n '[class.p-inputtextarea]': 'true',\n '[class.p-inputtext]': 'true',\n '[class.p-component]': 'true',\n '[class.p-filled]': 'filled',\n '[class.p-inputtextarea-resizable]': 'autoResize'\n }\n})\nexport class InputTextarea implements OnInit, AfterViewInit, OnDestroy {\n \n @Input() autoResize: boolean;\n \n @Output() onResize: EventEmitter = new EventEmitter();\n \n filled: boolean;\n\n cachedScrollHeight:number;\n\n ngModelSubscription: Subscription;\n\n ngControlSubscription: Subscription;\n\n constructor(public el: ElementRef, @Optional() public ngModel: NgModel, @Optional() public control : NgControl, private cd: ChangeDetectorRef) {}\n \n ngOnInit() {\n if (this.ngModel) {\n this.ngModelSubscription = this.ngModel.valueChanges.subscribe(() =>{\n this.updateState();\n })\n }\n\n if (this.control) {\n this.ngControlSubscription = this.control.valueChanges.subscribe(() => {\n this.updateState();\n });\n }\n }\n\n ngAfterViewInit() {\n if (this.autoResize)\n this.resize();\n\n this.updateFilledState();\n this.cd.detectChanges();\n }\n\n @HostListener('input', ['$event'])\n onInput(e) {\n this.updateState();\n }\n \n updateFilledState() {\n this.filled = (this.el.nativeElement.value && this.el.nativeElement.value.length) || (this.ngModel && this.ngModel.model);\n }\n \n @HostListener('focus', ['$event'])\n onFocus(e) {\n if (this.autoResize) {\n this.resize(e);\n }\n }\n \n @HostListener('blur', ['$event'])\n onBlur(e) {\n if (this.autoResize) {\n this.resize(e);\n }\n }\n \n resize(event?: Event) {\n this.el.nativeElement.style.height = 'auto';\n this.el.nativeElement.style.height = this.el.nativeElement.scrollHeight + 'px';\n\n if (parseFloat(this.el.nativeElement.style.height) >= parseFloat(this.el.nativeElement.style.maxHeight)) {\n this.el.nativeElement.style.overflowY = \"scroll\";\n this.el.nativeElement.style.height = this.el.nativeElement.style.maxHeight;\n }\n else {\n this.el.nativeElement.style.overflow = \"hidden\";\n }\n\n this.onResize.emit(event||{});\n }\n\n updateState() {\n this.updateFilledState();\n \n if (this.autoResize) {\n this.resize();\n }\n }\n\n ngOnDestroy() {\n if (this.ngModelSubscription) {\n this.ngModelSubscription.unsubscribe();\n }\n\n if (this.ngControlSubscription) {\n this.ngControlSubscription.unsubscribe();\n }\n }\n}\n\n@NgModule({\n imports: [CommonModule],\n exports: [InputTextarea],\n declarations: [InputTextarea]\n})\nexport class InputTextareaModule { }\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["EventEmitter","Directive","ElementRef","NgModel","Optional","NgControl","ChangeDetectorRef","Input","Output","HostListener","NgModule","CommonModule"],"mappings":";;;;;;;QA6BI,uBAAmB,EAAc,EAAqB,OAAgB,EAAqB,OAAmB,EAAU,EAAqB;YAA1H,OAAE,GAAF,EAAE,CAAY;YAAqB,YAAO,GAAP,OAAO,CAAS;YAAqB,YAAO,GAAP,OAAO,CAAY;YAAU,OAAE,GAAF,EAAE,CAAmB;YAVnI,aAAQ,GAAsB,IAAIA,iBAAY,EAAE,CAAC;SAUsF;QAEjJ,gCAAQ,GAAR;YAAA,iBAYC;YAXG,IAAI,IAAI,CAAC,OAAO,EAAE;gBACd,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,SAAS,CAAC;oBAC3D,KAAI,CAAC,WAAW,EAAE,CAAC;iBACtB,CAAC,CAAA;aACL;YAED,IAAI,IAAI,CAAC,OAAO,EAAE;gBACd,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,SAAS,CAAC;oBAC7D,KAAI,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