diff --git a/lib/core/src/lib/form/components/form-renderer.component.html b/lib/core/src/lib/form/components/form-renderer.component.html index 706b27c578..f7179d2688 100644 --- a/lib/core/src/lib/form/components/form-renderer.component.html +++ b/lib/core/src/lib/form/components/form-renderer.component.html @@ -40,7 +40,12 @@ *ngFor="let column of currentRootElement?.columns" [style.width.%]="getColumnWith(currentRootElement)">
- + + to be implemented + + + +
diff --git a/lib/core/src/lib/form/components/widgets/core/form-field-types.ts b/lib/core/src/lib/form/components/widgets/core/form-field-types.ts index 3bda51016d..a5384a0a1d 100644 --- a/lib/core/src/lib/form/components/widgets/core/form-field-types.ts +++ b/lib/core/src/lib/form/components/widgets/core/form-field-types.ts @@ -20,6 +20,7 @@ export class FormFieldTypes { static CONTAINER: string = 'container'; static GROUP: string = 'group'; + static SECTION: string = 'section'; static DYNAMIC_TABLE: string = 'dynamic-table'; static TEXT: string = 'text'; static STRING: string = 'string'; @@ -58,11 +59,11 @@ export class FormFieldTypes { static CONSTANT_VALUE_TYPES: string[] = [FormFieldTypes.DISPLAY_EXTERNAL_PROPERTY]; - static isReadOnlyType(type: string) { + static isReadOnlyType(type: string): boolean { return FormFieldTypes.READONLY_TYPES.includes(type); } - static isValidatableType(type: string) { + static isValidatableType(type: string): boolean { return FormFieldTypes.VALIDATABLE_TYPES.includes(type); } @@ -70,11 +71,15 @@ export class FormFieldTypes { return FormFieldTypes.REACTIVE_TYPES.includes(type); } - static isConstantValueType(type: string) { + static isConstantValueType(type: string): boolean { return FormFieldTypes.CONSTANT_VALUE_TYPES.includes(type); } - static isContainerType(type: string) { + static isContainerType(type: string): boolean { return type === FormFieldTypes.CONTAINER || type === FormFieldTypes.GROUP; } + + static isSectionType(type: string): boolean { + return type === FormFieldTypes.SECTION; + } } diff --git a/lib/core/src/lib/form/components/widgets/core/form-field.model.ts b/lib/core/src/lib/form/components/widgets/core/form-field.model.ts index 463d044d24..840903cbf8 100644 --- a/lib/core/src/lib/form/components/widgets/core/form-field.model.ts +++ b/lib/core/src/lib/form/components/widgets/core/form-field.model.ts @@ -234,7 +234,7 @@ export class FormFieldModel extends FormWidgetModel { } } - if (FormFieldTypes.isContainerType(this.type)) { + if (FormFieldTypes.isContainerType(this.type) || FormFieldTypes.isSectionType(this.type)) { this.containerFactory(json, form); } } @@ -292,7 +292,7 @@ export class FormFieldModel extends FormWidgetModel { if (json.fields) { for (const currentField in json.fields) { if (Object.prototype.hasOwnProperty.call(json.fields, currentField)) { - const col = new ContainerColumnModel(); + const col = new ContainerColumnModel(); // TODO: Make sure this model is suitable for the section col.fields = (json.fields[currentField] || []).map((field) => new FormFieldModel(form, field)); col.rowspan = json.fields[currentField].length;