import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; import { InputRegexService } from '@core/services/input-regex.service'; import { ReferenceFieldsService } from '@features/reference-fields/services/reference-fields.service'; @Component({ selector: 'gc-regex-validation-setting', templateUrl: './regex-validation-setting.component.html', styleUrls: ['./regex-validation-setting.component.scss'] }) export class RegexValidationSettingComponent implements OnInit { @Input() pattern: string; @Input() compType: string; @Output() onChange = new EventEmitter(); formatTypeName: string; constructor ( private referenceFieldService: ReferenceFieldsService, private inputRegexService: InputRegexService ) { } ngOnInit () { const field = this.referenceFieldService.getReferenceFieldFromCompType( this.compType ); if (field?.formatType) { const { name } = this.inputRegexService.getSelectedFormattingDetails( field.formatType ); this.formatTypeName = name; } } }