|
|
|
@ -5,7 +5,7 @@ |
|
|
|
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. |
|
|
|
*/ |
|
|
|
|
|
|
|
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, Input, OnChanges, OnDestroy, Output, SimpleChanges } from '@angular/core'; |
|
|
|
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, Input, OnChanges, OnDestroy, Output, QueryList, SimpleChanges, ViewChildren } from '@angular/core'; |
|
|
|
import { AbstractControl, FormGroup } from '@angular/forms'; |
|
|
|
import { Observable, Subscription } from 'rxjs'; |
|
|
|
import { startWith } from 'rxjs/operators'; |
|
|
|
@ -19,6 +19,8 @@ import { |
|
|
|
RootFieldDto |
|
|
|
} from '@app/shared'; |
|
|
|
|
|
|
|
import { FieldEditorComponent } from './field-editor.component'; |
|
|
|
|
|
|
|
type FieldControl = { field: FieldDto, control: AbstractControl }; |
|
|
|
|
|
|
|
@Component({ |
|
|
|
@ -69,6 +71,9 @@ export class ArrayItemComponent implements OnChanges, OnDestroy { |
|
|
|
@Input() |
|
|
|
public languages: ReadonlyArray<AppLanguageDto>; |
|
|
|
|
|
|
|
@ViewChildren(FieldEditorComponent) |
|
|
|
public editors: QueryList<FieldEditorComponent>; |
|
|
|
|
|
|
|
public isHidden = false; |
|
|
|
public isInvalid: Observable<boolean>; |
|
|
|
|
|
|
|
@ -174,6 +179,12 @@ export class ArrayItemComponent implements OnChanges, OnDestroy { |
|
|
|
this.move.emit(99999); |
|
|
|
} |
|
|
|
|
|
|
|
public reset() { |
|
|
|
this.editors.forEach(editor => { |
|
|
|
editor.reset(); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
public trackByField(index: number, control: FieldControl) { |
|
|
|
return control.field.name; |
|
|
|
} |
|
|
|
|