mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-4710] - adapt visibility condition to the new schema (#4884)
* [ADF-4710] - adapt new visibility condition schema * [ADF-4710] - fix unit tests * [ADF-4710] - support visibility for APS1 and APS2
This commit is contained in:
committed by
Eugenio Romano
parent
ffd4413335
commit
72b3a75a85
@@ -16,13 +16,90 @@
|
||||
*/
|
||||
|
||||
export class WidgetVisibilityModel {
|
||||
leftFormFieldId: string;
|
||||
leftRestResponseId: string;
|
||||
rightRestResponseId?: string;
|
||||
rightFormFieldId?: string;
|
||||
leftRestResponseId?: string;
|
||||
leftFormFieldId?: string;
|
||||
operator: string;
|
||||
nextCondition: WidgetVisibilityModel;
|
||||
nextConditionOperator: string;
|
||||
operator: string;
|
||||
rightFormFieldId: string;
|
||||
rightRestResponseId: string;
|
||||
rightType: string;
|
||||
rightValue: string;
|
||||
|
||||
constructor(private json?: any) {
|
||||
if (json) {
|
||||
this.operator = json.operator;
|
||||
this.nextCondition = new WidgetVisibilityModel(json.nextCondition);
|
||||
this.nextConditionOperator = json.nextConditionOperator;
|
||||
this.rightRestResponseId = json.rightRestResponseId;
|
||||
this.rightFormFieldId = json.rightFormFieldId;
|
||||
this.leftFormFieldId = json.leftFormFieldId;
|
||||
this.leftRestResponseId = json.leftRestResponseId;
|
||||
} else {
|
||||
this.json = {};
|
||||
}
|
||||
}
|
||||
|
||||
set leftType(leftType: string) {
|
||||
this.json.leftType = leftType;
|
||||
}
|
||||
|
||||
set rightType(rightType: string) {
|
||||
this.json.rightType = rightType;
|
||||
}
|
||||
|
||||
set leftValue(leftValue: string) {
|
||||
this.json.leftValue = leftValue;
|
||||
}
|
||||
|
||||
set rightValue(rightValue: string) {
|
||||
this.json.rightValue = rightValue;
|
||||
}
|
||||
|
||||
get leftType() {
|
||||
if (this.leftFormFieldId) {
|
||||
return WidgetTypeEnum.field;
|
||||
} else if (this.leftRestResponseId) {
|
||||
return WidgetTypeEnum.variable;
|
||||
} else if ( !!this.json.leftType) {
|
||||
return this.json.leftType;
|
||||
}
|
||||
}
|
||||
|
||||
get leftValue() {
|
||||
if ( this.json.leftValue ) {
|
||||
return this.json.leftValue;
|
||||
} else if (this.leftFormFieldId) {
|
||||
return this.leftFormFieldId;
|
||||
} else {
|
||||
return this.leftRestResponseId;
|
||||
}
|
||||
}
|
||||
|
||||
get rightType() {
|
||||
if ( !!this.json.rightType ) {
|
||||
return this.json.rightType;
|
||||
} else if (this.json.rightValue) {
|
||||
return WidgetTypeEnum.value;
|
||||
} else if (this.rightRestResponseId) {
|
||||
return WidgetTypeEnum.variable;
|
||||
} else if (this.rightFormFieldId) {
|
||||
return WidgetTypeEnum.field;
|
||||
}
|
||||
}
|
||||
|
||||
get rightValue() {
|
||||
if (this.json.rightValue) {
|
||||
return this.json.rightValue;
|
||||
} else if (this.rightFormFieldId) {
|
||||
return this.rightFormFieldId;
|
||||
} else {
|
||||
return this.rightRestResponseId;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export enum WidgetTypeEnum {
|
||||
field = 'field',
|
||||
variable = 'variable',
|
||||
value = 'value'
|
||||
}
|
||||
|
Reference in New Issue
Block a user