Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | 1x 10x 6x 6x 12x 5x 1x 5x 6x 6x | /** * Copyright (c) Siemens 2016 - 2025 * SPDX-License-Identifier: MIT */ import { AfterViewInit, Component, ElementRef, OnInit, viewChild } from '@angular/core'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { FieldType, FieldTypeConfig, FormlyModule } from '@ngx-formly/core'; import { SiValidationErrorIdPipe } from '../../utils'; @Component({ selector: 'si-formly-textarea', imports: [FormsModule, ReactiveFormsModule, FormlyModule, SiValidationErrorIdPipe], templateUrl: './si-formly-textarea.component.html', styleUrl: './si-formly-textarea.component.scss' }) export class SiFormlyTextareaComponent extends FieldType<FieldTypeConfig> implements OnInit, AfterViewInit { private readonly textArea = viewChild.required<ElementRef>('textArea'); protected contentGrowTextarea(): string { return this.props.autoGrow ? `attr(data-replicated-value) ' '` : 'none'; } protected resizeConfiguration(): string { return this.props.resizable ? 'vertical' : 'none'; } protected maxHeightConfiguration(): string { return this.props.maxHeight ?? 'auto'; } ngOnInit(): void { this.formControl.valueChanges.subscribe(() => { this.assignValueToParent(); }); } ngAfterViewInit(): void { this.assignValueToParent(); } private assignValueToParent(): void { this.model.i = (this.model.i ?? 0) + 1; this.textArea().nativeElement.parentNode.dataset.replicatedValue = this.textArea().nativeElement.value; } } |