mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +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
Eugenio Romano
parent
5305b44096
commit
d6b15110b9
@@ -47,4 +47,8 @@ export class FormFieldTypes {
|
|||||||
static isReadOnlyType(type: string) {
|
static isReadOnlyType(type: string) {
|
||||||
return FormFieldTypes.READONLY_TYPES.indexOf(type) > -1;
|
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();
|
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;
|
this.placeholder = json.placeholder;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (json.type === 'readonly') {
|
if (FormFieldTypes.isReadOnlyType(json.type)) {
|
||||||
if (json.params && json.params.field && json.params.field.responseVariable) {
|
if (json.params && json.params.field && json.params.field.responseVariable) {
|
||||||
this.value = this.getVariablesValue(json.params.field.name, form);
|
this.value = this.getVariablesValue(json.params.field.name, form);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (json.type === 'container') {
|
if (FormFieldTypes.isContainerType(json.type)) {
|
||||||
this.containerFactory(json, form);
|
this.containerFactory(json, form);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user