Headless CMS and Content Managment Hub
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.
 
 
 
 
 

55 lines
1.4 KiB

/*
* Squidex Headless CMS
*
* @license
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved.
*/
import { ChangeDetectionStrategy, Component, Input, QueryList, ViewChildren } from '@angular/core';
import { AbstractContentForm, AppLanguageDto, EditContentForm, FieldDto, FieldSection } from '@app/shared';
import { FieldEditorComponent } from './field-editor.component';
@Component({
selector: 'sqx-component-section[form][formContext][formLevel][formSection][language][languages]',
styleUrls: ['./component-section.component.scss'],
templateUrl: './component-section.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class ComponentSectionComponent {
@Input()
public form: EditContentForm;
@Input()
public formContext: any;
@Input()
public formLevel: number;
@Input()
public formSection: FieldSection<FieldDto, any>;
@Input()
public language: AppLanguageDto;
@Input()
public languages: ReadonlyArray<AppLanguageDto>;
@Input()
public index: number | null | undefined;
@Input()
public canUnset?: boolean | null;
@ViewChildren(FieldEditorComponent)
public editors: QueryList<FieldEditorComponent>;
public reset() {
this.editors.forEach(editor => {
editor.reset();
});
}
public trackByField(_index: number, field: AbstractContentForm<any, any>) {
return field.field.fieldId;
}
}