{"version":3,"file":"primeng-inputtextarea.mjs","sources":["../../src/app/components/inputtextarea/inputtextarea.ts","../../src/app/components/inputtextarea/primeng-inputtextarea.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport { AfterViewInit, ChangeDetectorRef, Directive, ElementRef, EventEmitter, HostListener, Input, NgModule, OnDestroy, OnInit, Optional, Output } from '@angular/core';\nimport { NgControl, NgModel } from '@angular/forms';\nimport { LicenseManager } from 'primeng/api';\nimport { Subscription } from 'rxjs';\n\n@Directive({\n selector: '[pInputTextarea]',\n host: {\n class: 'p-inputtextarea p-inputtext p-component p-element',\n '[class.p-filled]': 'filled',\n '[class.p-inputtextarea-resizable]': 'autoResize'\n }\n})\nexport class InputTextarea implements OnInit, AfterViewInit, OnDestroy {\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) this.resize();\n\n this.updateFilledState();\n this.cd.detectChanges();\n\n LicenseManager.check();\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;\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 } 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":[],"mappings":";;;;;;MAca,aAAa,CAAA;AAatB,IAAA,WAAA,CAAmB,EAAc,EAAqB,OAAgB,EAAqB,OAAkB,EAAU,EAAqB,EAAA;AAAzH,QAAA,IAAE,CAAA,EAAA,GAAF,EAAE,CAAY;AAAqB,QAAA,IAAO,CAAA,OAAA,GAAP,OAAO,CAAS;AAAqB,QAAA,IAAO,CAAA,OAAA,GAAP,OAAO,CAAW;AAAU,QAAA,IAAE,CAAA,EAAA,GAAF,EAAE,CAAmB;AAVlI,QAAA,IAAA,CAAA,QAAQ,GAAsB,IAAI,YAAY,EAAE,CAAC;KAUqF;IAEhJ,QAAQ,GAAA;QACJ,IAAI,IAAI,CAAC,OAAO,EAAE;AACd,YAAA,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,SAAS,CAAC,MAAK;gBAChE,IAAI,CAAC,WAAW,EAAE,CAAC;AACvB,aAAC,CAAC,CAAC;AACN,SAAA;QAED,IAAI,IAAI,CAAC,OAAO,EAAE;AACd,YAAA,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC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