|
|
|
@ -5,7 +5,7 @@ |
|
|
|
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. |
|
|
|
*/ |
|
|
|
|
|
|
|
import { Component, Input, OnChanges } from '@angular/core'; |
|
|
|
import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core'; |
|
|
|
import { FormControl, FormGroup } from '@angular/forms'; |
|
|
|
|
|
|
|
import { FieldDto } from '@app/shared'; |
|
|
|
@ -15,7 +15,7 @@ import { FieldDto } from '@app/shared'; |
|
|
|
styleUrls: ['field-form-common.component.scss'], |
|
|
|
templateUrl: 'field-form-common.component.html' |
|
|
|
}) |
|
|
|
export class FieldFormCommonComponent implements OnChanges { |
|
|
|
export class FieldFormCommonComponent implements OnChanges, OnInit { |
|
|
|
@Input() |
|
|
|
public editForm: FormGroup; |
|
|
|
|
|
|
|
@ -28,7 +28,7 @@ export class FieldFormCommonComponent implements OnChanges { |
|
|
|
@Input() |
|
|
|
public field: FieldDto; |
|
|
|
|
|
|
|
public ngOnChanges() { |
|
|
|
public ngOnInit() { |
|
|
|
this.editForm.setControl('isRequired', |
|
|
|
new FormControl(this.field.properties.isRequired)); |
|
|
|
|
|
|
|
@ -47,4 +47,10 @@ export class FieldFormCommonComponent implements OnChanges { |
|
|
|
this.editForm.setControl('label', |
|
|
|
new FormControl(this.field.properties.label)); |
|
|
|
} |
|
|
|
|
|
|
|
public ngOnChanges(changes: SimpleChanges) { |
|
|
|
if (changes['field']) { |
|
|
|
this.editForm.reset(this.field.properties); |
|
|
|
} |
|
|
|
} |
|
|
|
} |