48 lines
1.5 KiB
TypeScript
48 lines
1.5 KiB
TypeScript
import { VisibilityRulesService } from '../../visibility-rules/visibility-rules.service';
|
|
import { VisibilityRuleSource } from '../../visibility-rules/models/VisibilityRuleSource';
|
|
import { Field } from '../../models/Field';
|
|
import { Component, Input, OnInit } from '@angular/core';
|
|
import { FormGroup, ValidatorFn, AbstractControl, Validators } from '@angular/forms';
|
|
import { ActivatedRoute } from '@angular/router';
|
|
|
|
import { FieldBase } from './field-base';
|
|
import { RuleStyle } from '../../entities/common/rulestyle';
|
|
|
|
|
|
@Component({
|
|
selector: 'df-field',
|
|
templateUrl: './dynamic-form-field.component.html',
|
|
styles: ['.checkBoxLabelCustom {font-weight: 700;}']
|
|
})
|
|
|
|
export class DynamicFormFieldComponent {
|
|
@Input() field: Field;
|
|
@Input() form: FormGroup;
|
|
@Input() pathName:string;
|
|
|
|
private fragment: string;
|
|
|
|
constructor(private route: ActivatedRoute,private visibilityRulesService:VisibilityRulesService) { }
|
|
|
|
ngOnChanges(changeRecord) {
|
|
}
|
|
|
|
|
|
get isValid() {
|
|
return this.form.get("value").valid;
|
|
}
|
|
get isValidRequired() {
|
|
return this.form.get("value").hasError("required");
|
|
}
|
|
get isValidPattern() {
|
|
return this.form.get("value").hasError("pattern");
|
|
}
|
|
get isValidCustom() {
|
|
return this.form.get("value").hasError("forbiddenName");
|
|
}
|
|
|
|
public ngOnInit() {
|
|
this.route.fragment.subscribe(fragment => { this.fragment = fragment; }); //navigate to certain section of the page
|
|
}
|
|
|
|
} |