1 line
8.2 KiB
Plaintext
1 line
8.2 KiB
Plaintext
{"version":3,"file":"primeng-inputtextarea.mjs","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, AfterViewChecked, booleanAttribute } from '@angular/core';\nimport { NgModel, NgControl, FormControl } from '@angular/forms';\nimport { CommonModule } from '@angular/common';\nimport { Subscription } from 'rxjs';\nimport { PrimeNGConfig } from 'primeng/api';\n/**\n * InputTextarea adds styling and autoResize functionality to standard textarea element.\n * @group Components\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 '[class.p-variant-filled]': 'variant === \"filled\" || config.inputStyle() === \"filled\"'\n }\n})\nexport class InputTextarea implements OnInit, AfterViewInit, OnDestroy {\n /**\n * When present, textarea size changes as being typed.\n * @group Props\n */\n @Input({ transform: booleanAttribute }) autoResize: boolean | undefined;\n /**\n * Specifies the input variant of the component.\n * @group Props\n */\n @Input() variant: 'filled' | 'outlined' = 'outlined';\n /**\n * Callback to invoke on textarea resize.\n * @param {(Event | {})} event - Custom resize event.\n * @group Emits\n */\n @Output() onResize: EventEmitter<Event | {}> = new EventEmitter<Event | {}>();\n\n filled: boolean | undefined;\n\n cachedScrollHeight: number | undefined;\n\n ngModelSubscription: Subscription | undefined;\n\n ngControlSubscription: Subscription | undefined;\n\n constructor(public el: ElementRef, @Optional() public ngModel: NgModel, @Optional() public control: NgControl, private cd: ChangeDetectorRef, public config: PrimeNGConfig) {}\n\n ngOnInit() {\n if (this.ngModel) {\n this.ngModelSubscription = (this.ngModel as any).valueChanges.subscribe(() => {\n this.updateState();\n });\n }\n\n if (this.control) {\n this.ngControlSubscription = (this.control as any).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\n @HostListener('input', ['$event'])\n onInput(e: Event) {\n this.updateState();\n }\n\n updateFilledState() {\n this.filled = this.el.nativeElement.value && this.el.nativeElement.value.length;\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":";;;;;;AAKA;;;AAGG;MAUU,aAAa,CAAA;AA0BH,IAAA,EAAA,CAAA;AAAmC,IAAA,OAAA,CAAA;AAAqC,IAAA,OAAA,CAAA;AAA4B,IAAA,EAAA,CAAA;AAA8B,IAAA,MAAA,CAAA;AAzBrJ;;;AAGG;AACqC,IAAA,UAAU,CAAsB;AACxE;;;AAGG;IACM,OAAO,GAA0B,UAAU,CAAC;AACrD;;;;AAIG;AACO,IAAA,QAAQ,GAA6B,IAAI,YAAY,EAAc,CAAC;AAE9E,IAAA,MAAM,CAAsB;AAE5B,IAAA,kBAAkB,CAAqB;AAEvC,IAAA,mBAAmB,CAA2B;AAE9C,IAAA,qBAAqB,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