mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[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:
committed by
Mario Romano
parent
ac55704220
commit
f4a8ccc461
@@ -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;
|
||||
}
|
||||
}
|
||||
|
@@ -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);
|
||||
});
|
||||
});
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user