mirror of https://github.com/Squidex/squidex.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.3 KiB
49 lines
1.3 KiB
/*
|
|
* Squidex Headless CMS
|
|
*
|
|
* @license
|
|
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved.
|
|
*/
|
|
|
|
import { ChangeDetectionStrategy, Component, Input, QueryList, ViewChildren } from '@angular/core';
|
|
import { AppLanguageDto, EditContentForm, FieldArrayItemForm, FieldSection, NestedFieldDto } from '@app/shared';
|
|
import { FieldEditorComponent } from './field-editor.component';
|
|
|
|
@Component({
|
|
selector: 'sqx-array-section',
|
|
styleUrls: ['./array-section.component.scss'],
|
|
templateUrl: './array-section.component.html',
|
|
changeDetection: ChangeDetectionStrategy.OnPush
|
|
})
|
|
export class ArraySectionComponent {
|
|
@Input()
|
|
public form: EditContentForm;
|
|
|
|
@Input()
|
|
public formContext: any;
|
|
|
|
@Input()
|
|
public formSection: FieldSection<NestedFieldDto, FieldArrayItemForm>;
|
|
|
|
@Input()
|
|
public language: AppLanguageDto;
|
|
|
|
@Input()
|
|
public languages: ReadonlyArray<AppLanguageDto>;
|
|
|
|
@Input()
|
|
public canUnset: boolean;
|
|
|
|
@ViewChildren(FieldEditorComponent)
|
|
public editors: QueryList<FieldEditorComponent>;
|
|
|
|
public reset() {
|
|
this.editors.forEach(editor => {
|
|
editor.reset();
|
|
});
|
|
}
|
|
|
|
public trackByField(_index: number, field: FieldArrayItemForm) {
|
|
return field.field.fieldId;
|
|
}
|
|
}
|