import { AbstractControl } from '@angular/forms'; import { Component, Input, OnInit } from '@angular/core'; import { JsonSchemaFormService } from '../../json-schema-form.service'; @Component({ // tslint:disable-next-line:component-selector selector: 'material-input-widget', template: ` {{word}} `, styles: [` mat-error { font-size: 75%; margin-top: -1rem; margin-bottom: 0.5rem; } ::ng-deep json-schema-form mat-form-field .mat-form-field-wrapper .mat-form-field-flex .mat-form-field-infix { width: initial; } `], }) export class MaterialInputComponent implements OnInit { formControl: AbstractControl; controlName: string; controlValue: string; controlDisabled = false; boundControl = false; options: any; autoCompleteList: string[] = []; @Input() layoutNode: any; @Input() layoutIndex: number[]; @Input() dataIndex: number[]; constructor( private jsf: JsonSchemaFormService ) { } ngOnInit() { this.options = this.layoutNode.options || {}; this.jsf.initializeControl(this); if (!this.options.notitle && !this.options.description && this.options.placeholder) { this.options.description = this.options.placeholder; } } updateValue(event) { this.jsf.updateValue(this, event.target.value); } }