mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
Added changes due PR
This commit is contained in:
committed by
Mario Romano
parent
1f491f0c15
commit
9c3fa30a0b
@@ -125,20 +125,10 @@ export class WidgetVisibilityService {
|
|||||||
let fieldValue = '';
|
let fieldValue = '';
|
||||||
form.fields.forEach((containerModel: ContainerModel) => {
|
form.fields.forEach((containerModel: ContainerModel) => {
|
||||||
containerModel.field.columns.forEach((containerColumnModel: ContainerColumnModel) => {
|
containerModel.field.columns.forEach((containerColumnModel: ContainerColumnModel) => {
|
||||||
let fieldFound = containerColumnModel.fields.find(field => this.findFieldByValue(field, name));
|
let fieldFound = containerColumnModel.fields.find(field => this.isSearchedField(field, name));
|
||||||
if (fieldFound) {
|
if (fieldFound) {
|
||||||
if (name.indexOf('_LABEL') > 0) {
|
fieldValue = this.getObjectValue(fieldFound);
|
||||||
if (fieldFound.value && fieldFound.value.name) {
|
if (!fieldValue && fieldFound.value && fieldFound.value.id) {
|
||||||
fieldValue = fieldFound.value.name;
|
|
||||||
} else if (fieldFound.options) {
|
|
||||||
let option = fieldFound.options.find(option => option.id === fieldFound.value);
|
|
||||||
if (option) {
|
|
||||||
fieldValue = option.name;
|
|
||||||
} else {
|
|
||||||
fieldValue = fieldFound.value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (fieldFound.value && fieldFound.value && fieldFound.value.id) {
|
|
||||||
fieldValue = fieldFound.value.id;
|
fieldValue = fieldFound.value.id;
|
||||||
} else {
|
} else {
|
||||||
fieldValue = fieldFound.value;
|
fieldValue = fieldFound.value;
|
||||||
@@ -149,21 +139,32 @@ export class WidgetVisibilityService {
|
|||||||
return fieldValue;
|
return fieldValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
findFieldByValue(field: FormFieldModel, fieldToFind: string) {
|
private getObjectValue(field: FormFieldModel) {
|
||||||
let isFound = false;
|
let value = '';
|
||||||
switch (field.fieldType) {
|
if (field.value && field.value.name) {
|
||||||
case 'RestFieldRepresentation' :
|
value = field.value.name;
|
||||||
if (fieldToFind.indexOf('_LABEL') > 0) {
|
} else if (field.options) {
|
||||||
isFound = (fieldToFind.substring(0, fieldToFind.length - 6) === field.name);
|
let option = field.options.find(option => option.id === field.value);
|
||||||
} else {
|
if (option) {
|
||||||
isFound = (field.name === fieldToFind);
|
value = option.name;
|
||||||
}
|
} else {
|
||||||
break;
|
value = field.value;
|
||||||
default:
|
}
|
||||||
isFound = (field.name === fieldToFind);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return isFound;
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private isSearchedField(field: FormFieldModel, fieldToFind: string) {
|
||||||
|
let forrmattedFieldName = this.removeLabel(field, fieldToFind);
|
||||||
|
return field.name === forrmattedFieldName;
|
||||||
|
}
|
||||||
|
|
||||||
|
private removeLabel(field: FormFieldModel, fieldToFind) {
|
||||||
|
let formattedFieldName = fieldToFind;
|
||||||
|
if (field.fieldType === 'RestFieldRepresentation' && fieldToFind.indexOf('_LABEL') > 0) {
|
||||||
|
formattedFieldName = fieldToFind.substring(0, fieldToFind.length - 6);
|
||||||
|
}
|
||||||
|
return formattedFieldName;
|
||||||
}
|
}
|
||||||
|
|
||||||
getVariableValue(form: FormModel, name: string, processVarList: TaskProcessVariableModel[]) {
|
getVariableValue(form: FormModel, name: string, processVarList: TaskProcessVariableModel[]) {
|
||||||
|
Reference in New Issue
Block a user