Newer
Older
import {
Component, Output, EventEmitter, Input
} from '@angular/core';
import { FormElementComponent } from '../../directives/form-element-component.directive';
import { TextAreaElement } from '../../interfaces/elements';
selector: 'aspect-text-area',
<mat-form-field
[ngClass]="{ 'no-label' : !elementModel.label}"
[style.width.%]="100"
[style.height.%]="100"
[style.min-height.%]="100"
aspectInputBackgroundColor [backgroundColor]="elementModel.styles.backgroundColor"
[style.color]="elementModel.styles.fontColor"
[style.font-family]="elementModel.styles.font"
[style.font-size.px]="elementModel.styles.fontSize"
[style.font-weight]="elementModel.styles.bold ? 'bold' : ''"
[style.font-style]="elementModel.styles.italic ? 'italic' : ''"
[style.text-decoration]="elementModel.styles.underline ? 'underline' : ''"
[appearance]="$any(elementModel.appearance)">
<mat-label *ngIf="elementModel.label">{{elementModel.label}}</mat-label>
autocomplete="off" rows="{{elementModel.rowCount}}"
[readonly]="elementModel.readOnly"
[style.resize]="elementModel.resizeEnabled ? 'both' : 'none'"
(focus)="elementModel.inputAssistancePreset !== 'none' ? onFocusChanged.emit(input) : null"
(blur)="elementModel.inputAssistancePreset !== 'none' ? onFocusChanged.emit(null): null">
</textarea>
<mat-error *ngIf="elementFormControl.errors">
{{elementFormControl.errors | errorTransform: elementModel}}
</mat-error>
`,
styles: [
':host ::ng-deep div.mat-form-field-infix {padding-top: 0.2em; padding-bottom: 0.2em;}',
':host ::ng-deep .no-label .mat-form-field-outline-gap {border-top-color: unset !important}'
]
})
export class TextAreaComponent extends FormElementComponent {
@Input() elementModel!: TextAreaElement;
@Output() onFocusChanged = new EventEmitter<HTMLElement | null>();