|
|
@ -5,7 +5,7 @@ |
|
|
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. |
|
|
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
|
|
|
import { Component, Input, OnInit } from '@angular/core'; |
|
|
import { Component, Input, OnChanges, SimpleChanges } from '@angular/core'; |
|
|
import { FormBuilder } from '@angular/forms'; |
|
|
import { FormBuilder } from '@angular/forms'; |
|
|
import { onErrorResumeNext } from 'rxjs/operators'; |
|
|
import { onErrorResumeNext } from 'rxjs/operators'; |
|
|
|
|
|
|
|
|
@ -32,7 +32,7 @@ import { |
|
|
fadeAnimation |
|
|
fadeAnimation |
|
|
] |
|
|
] |
|
|
}) |
|
|
}) |
|
|
export class FieldComponent implements OnInit { |
|
|
export class FieldComponent implements OnChanges { |
|
|
@Input() |
|
|
@Input() |
|
|
public field: NestedFieldDto | RootFieldDto; |
|
|
public field: NestedFieldDto | RootFieldDto; |
|
|
|
|
|
|
|
|
@ -50,7 +50,7 @@ export class FieldComponent implements OnInit { |
|
|
public isEditing = false; |
|
|
public isEditing = false; |
|
|
public selectedTab = 0; |
|
|
public selectedTab = 0; |
|
|
|
|
|
|
|
|
public editForm: EditFieldForm; |
|
|
public editForm = new EditFieldForm(this.formBuilder); |
|
|
|
|
|
|
|
|
public addFieldDialog = new DialogModel(); |
|
|
public addFieldDialog = new DialogModel(); |
|
|
|
|
|
|
|
|
@ -60,25 +60,33 @@ export class FieldComponent implements OnInit { |
|
|
) { |
|
|
) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public ngOnInit() { |
|
|
public ngOnChanges(changes: SimpleChanges) { |
|
|
this.editForm = new EditFieldForm(this.formBuilder); |
|
|
if (changes['field']) { |
|
|
this.editForm.load(this.field.properties); |
|
|
this.editForm.load(this.field.properties); |
|
|
|
|
|
|
|
|
if (this.field.isLocked) { |
|
|
if (this.field.isLocked) { |
|
|
this.editForm.form.disable(); |
|
|
this.editForm.form.disable(); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public toggleEditing() { |
|
|
if (changes['schema']) { |
|
|
this.isEditing = !this.isEditing; |
|
|
this.isEditing = false; |
|
|
|
|
|
|
|
|
|
|
|
this.selectedTab = 0; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public selectTab(tab: number) { |
|
|
public selectTab(tab: number) { |
|
|
this.selectedTab = tab; |
|
|
this.selectedTab = tab; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public toggleEditing() { |
|
|
|
|
|
this.isEditing = !this.isEditing; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public cancel() { |
|
|
public cancel() { |
|
|
this.isEditing = false; |
|
|
this.isEditing = false; |
|
|
|
|
|
|
|
|
this.editForm.load(this.field); |
|
|
this.editForm.load(this.field); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|