[ADF-1327] Fix group form field type to be treated as a container (#2225)

* Add group to container types

* Usage of FormFieldTypes.isReadOnlyType
This commit is contained in:
Popovics András
2017-08-16 22:08:34 +02:00
committed by Eugenio Romano
parent 5305b44096
commit d6b15110b9
3 changed files with 25 additions and 2 deletions

View File

@@ -47,4 +47,8 @@ export class FormFieldTypes {
static isReadOnlyType(type: string) {
return FormFieldTypes.READONLY_TYPES.indexOf(type) > -1;
}
static isContainerType(type: string) {
return type === FormFieldTypes.CONTAINER || type === FormFieldTypes.GROUP;
}
}

View File

@@ -356,4 +356,23 @@ describe('FormFieldModel', () => {
expect(field.hasOptions()).toBeFalsy();
});
it('should calculate the columns in case of container type', () => {
let form = new FormModel();
let field = new FormFieldModel(form, {
type: FormFieldTypes.CONTAINER,
numberOfColumns: 888
});
expect(field.numberOfColumns).toBe(888);
});
it('should calculate the columns in case of group type', () => {
let form = new FormModel();
let field = new FormFieldModel(form, {
type: FormFieldTypes.GROUP,
numberOfColumns: 999
});
expect(field.numberOfColumns).toBe(999);
});
});

View File

@@ -166,13 +166,13 @@ export class FormFieldModel extends FormWidgetModel {
this.placeholder = json.placeholder;
}
if (json.type === 'readonly') {
if (FormFieldTypes.isReadOnlyType(json.type)) {
if (json.params && json.params.field && json.params.field.responseVariable) {
this.value = this.getVariablesValue(json.params.field.name, form);
}
}
if (json.type === 'container') {
if (FormFieldTypes.isContainerType(json.type)) {
this.containerFactory(json, form);
}
}