[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:
Silviu Popa 2019-07-11 19:07:27 +03:00 committed by Eugenio Romano
parent ffd4413335
commit 72b3a75a85
8 changed files with 2014 additions and 65 deletions

View File

@ -136,7 +136,6 @@ export class FormFieldModel extends FormWidgetModel {
constructor(form: FormModel, json?: any) {
super(form, json);
if (json) {
this.fieldType = json.fieldType;
this.id = json.id;
@ -163,7 +162,7 @@ export class FormFieldModel extends FormWidgetModel {
this.params = <FormFieldMetadata> json.params || {};
this.hyperlinkUrl = json.hyperlinkUrl;
this.displayText = json.displayText;
this.visibilityCondition = <WidgetVisibilityModel> json.visibilityCondition;
this.visibilityCondition = json.visibilityCondition ? new WidgetVisibilityModel(json.visibilityCondition) : undefined;
this.enableFractions = <boolean> json.enableFractions;
this.currency = json.currency;
this.dateDisplayFormat = json.dateDisplayFormat || this.getDefaultDateFormat(json);

View File

@ -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'
}

File diff suppressed because it is too large Load Diff

View File

@ -25,20 +25,16 @@ import {
} from './../components/widgets/core/index';
import { TaskProcessVariableModel } from './../models/task-process-variable.model';
import { WidgetVisibilityModel } from './../models/widget-visibility.model';
import {
fakeFormJson,
complexVisibilityJsonVisible,
complexVisibilityJsonNotVisible,
fakeTaskProcessVariableModels,
formTest,
formValues
} from '../../mock';
import { WidgetVisibilityService } from './widget-visibility.service';
import { setupTestBed } from '../../testing/setupTestBed';
import { CoreModule } from '../../core.module';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { AlfrescoApiService } from '../../services/alfresco-api.service';
import { AlfrescoApiServiceMock } from '../../mock/alfresco-api.service.mock';
import { fakeTaskProcessVariableModels,
fakeFormJson, formTest,
formValues, complexVisibilityJsonVisible,
complexVisibilityJsonNotVisible } from 'core/mock/form/widget-visibility.service.mock';
declare let jasmine: any;
@ -196,10 +192,10 @@ describe('WidgetVisibilityService', () => {
describe('should retrieve the process variables', () => {
const fakeFormWithField = new FormModel(fakeFormJson);
let visibilityObjTest: WidgetVisibilityModel;
const chainedVisibilityObj = new WidgetVisibilityModel();
const chainedVisibilityObj = new WidgetVisibilityModel({});
beforeEach(() => {
visibilityObjTest = new WidgetVisibilityModel();
visibilityObjTest = new WidgetVisibilityModel({});
});
it('should return the process variables for task', (done) => {
@ -294,7 +290,7 @@ describe('WidgetVisibilityService', () => {
visibilityObjTest.leftFormFieldId = 'LEFT_FORM_FIELD_ID';
visibilityObjTest.operator = '!=';
visibilityObjTest.rightRestResponseId = 'TEST_VAR_2';
const isVisible = service.isFieldVisible(fakeFormWithField, visibilityObjTest);
const isVisible = service.isFieldVisible(fakeFormWithField, new WidgetVisibilityModel(visibilityObjTest));
expect(isVisible).toBeTruthy();
done();
@ -459,7 +455,7 @@ describe('WidgetVisibilityService', () => {
expect(leftValue).toBe('value_2');
});
it('should return an empty string for a value that is not on variable or form', () => {
it('should return empty string for a value that is not on variable or form', () => {
const leftValue = service.getLeftValue(fakeFormWithField, visibilityObjTest);
expect(leftValue).toBe('');
@ -943,9 +939,8 @@ describe('WidgetVisibilityService', () => {
});
it('should be able to analyze a complex visibility JSON false', () => {
const isVisible = service.isFieldVisible(complexVisibilityJsonNotVisibleModel,
complexVisibilityJsonNotVisible.formDefinition.fields[2].fields[2][0].visibilityCondition);
const formField = new FormFieldModel(complexVisibilityJsonNotVisibleModel, complexVisibilityJsonNotVisible.formDefinition.fields[2].fields[2][0]);
const isVisible = service.isFieldVisible(complexVisibilityJsonNotVisibleModel, new WidgetVisibilityModel(formField.visibilityCondition));
expect(isVisible).toBe(false);
});

View File

@ -22,7 +22,7 @@ import moment from 'moment-es6';
import { Observable, from, throwError } from 'rxjs';
import { FormFieldModel, FormModel, TabModel } from '../components/widgets/core/index';
import { TaskProcessVariableModel } from '../models/task-process-variable.model';
import { WidgetVisibilityModel } from '../models/widget-visibility.model';
import { WidgetVisibilityModel, WidgetTypeEnum } from '../models/widget-visibility.model';
import { map, catchError } from 'rxjs/operators';
@Injectable({
@ -52,7 +52,7 @@ export class WidgetVisibilityService {
}
evaluateVisibility(form: FormModel, visibilityObj: WidgetVisibilityModel): boolean {
const isLeftFieldPresent = visibilityObj && (visibilityObj.leftFormFieldId || visibilityObj.leftRestResponseId);
const isLeftFieldPresent = visibilityObj && (visibilityObj.leftType || visibilityObj.leftValue);
if (!isLeftFieldPresent || isLeftFieldPresent === 'null') {
return true;
} else {
@ -64,43 +64,43 @@ export class WidgetVisibilityService {
const leftValue = this.getLeftValue(form, visibilityObj);
const rightValue = this.getRightValue(form, visibilityObj);
const actualResult = this.evaluateCondition(leftValue, rightValue, visibilityObj.operator);
accumulator.push({ value: actualResult, operator: visibilityObj.nextConditionOperator });
if (visibilityObj.nextCondition) {
result = this.isFieldVisible(form, visibilityObj.nextCondition, accumulator);
} else {
result = accumulator[0].value;
result = accumulator[0].value ? accumulator[0].value : result;
for (let i = 1; i < accumulator.length; i++) {
result = this.evaluateLogicalOperation(
accumulator[i - 1].operator,
result,
accumulator[i].value
);
if (accumulator[i - 1].operator && accumulator[i].value) {
result = this.evaluateLogicalOperation(
accumulator[i - 1].operator,
result,
accumulator[i].value
);
}
}
}
return result;
return !!result;
}
getLeftValue(form: FormModel, visibilityObj: WidgetVisibilityModel): string {
let leftValue = '';
if (visibilityObj.leftRestResponseId && visibilityObj.leftRestResponseId !== 'null') {
leftValue = this.getVariableValue(form, visibilityObj.leftRestResponseId, this.processVarList);
} else if (visibilityObj.leftFormFieldId) {
leftValue = this.getFormValue(form, visibilityObj.leftFormFieldId);
leftValue = leftValue ? leftValue : this.getVariableValue(form, visibilityObj.leftFormFieldId, this.processVarList);
if (visibilityObj.leftType && visibilityObj.leftType === WidgetTypeEnum.variable) {
leftValue = this.getVariableValue(form, visibilityObj.leftValue, this.processVarList);
} else if (visibilityObj.leftType && visibilityObj.leftType === WidgetTypeEnum.field) {
leftValue = this.getFormValue(form, visibilityObj.leftValue);
leftValue = leftValue ? leftValue : this.getVariableValue(form, visibilityObj.leftValue, this.processVarList);
}
return leftValue;
}
getRightValue(form: FormModel, visibilityObj: WidgetVisibilityModel): string {
let valueFound = '';
if (visibilityObj.rightRestResponseId) {
valueFound = this.getVariableValue(form, visibilityObj.rightRestResponseId, this.processVarList);
} else if (visibilityObj.rightFormFieldId) {
valueFound = this.getFormValue(form, visibilityObj.rightFormFieldId);
if (visibilityObj.rightType === WidgetTypeEnum.variable) {
valueFound = this.getVariableValue(form, visibilityObj.rightValue, this.processVarList);
} else if (visibilityObj.rightType === WidgetTypeEnum.field) {
valueFound = this.getFormValue(form, visibilityObj.rightValue);
} else {
if (moment(visibilityObj.rightValue, 'YYYY-MM-DD', true).isValid()) {
valueFound = visibilityObj.rightValue + 'T00:00:00.000Z';
@ -117,7 +117,6 @@ export class WidgetVisibilityService {
if (!value) {
value = this.searchValueInForm(form, fieldId);
}
return value;
}
@ -178,16 +177,7 @@ export class WidgetVisibilityService {
}
private isSearchedField(field: FormFieldModel, fieldToFind: string): boolean {
const formattedFieldName = this.removeLabel(field, fieldToFind);
return field.id ? field.id.toUpperCase() === formattedFieldName.toUpperCase() : false;
}
private removeLabel(field: FormFieldModel, fieldToFind): string {
let formattedFieldName = fieldToFind || '';
if (field.fieldType === 'RestFieldRepresentation' && fieldToFind.indexOf('_LABEL') > 0) {
formattedFieldName = fieldToFind.substring(0, fieldToFind.length - 6);
}
return formattedFieldName;
return (field.id && fieldToFind) ? field.id.toUpperCase() === fieldToFind.toUpperCase() : false;
}
getVariableValue(form: FormModel, name: string, processVarList: TaskProcessVariableModel[]): string {

View File

@ -110,11 +110,10 @@ export let formDefVisibilitiFieldDependsOnNextOne = {
row: -1,
col: -1,
visibilityCondition: {
leftFormFieldId: 'name',
leftRestResponseId: null,
leftType: 'field',
leftValue: 'name',
operator: '==',
rightValue: 'italy',
rightType: null,
rightFormFieldId: '',
rightRestResponseId: '',
nextConditionOperator: '',
@ -320,11 +319,10 @@ export let formDefVisibilitiFieldDependsOnPreviousOne = {
row: -1,
col: -1,
visibilityCondition: {
leftFormFieldId: 'name',
leftRestResponseId: null,
leftType: 'field',
leftValue: 'name',
operator: '==',
rightValue: 'italy',
rightType: null,
rightFormFieldId: '',
rightRestResponseId: '',
nextConditionOperator: '',

View File

@ -0,0 +1,865 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { FormModel, FormValues } from '../../form/components/widgets/core/index';
export let formTest = new FormModel({});
export let fakeTaskProcessVariableModels = [
{ id: 'TEST_VAR_1', type: 'string', value: 'test_value_1' },
{ id: 'TEST_VAR_2', type: 'string', value: 'test_value_2' },
{ id: 'TEST_VAR_3', type: 'string', value: 'test_value_3' }
];
export let formValues: FormValues = {
'test_1': 'value_1',
'test_2': 'value_2',
'test_3': 'value_1',
'test_4': 'dropdown_id',
'test_5': 'dropdown_label',
'dropdown': { 'id': 'dropdown_id', 'name': 'dropdown_label' }
};
export let fakeFormJson = {
id: '9999',
name: 'FORM_VISIBILITY',
processDefinitionId: 'PROCESS_TEST:9:9999',
processDefinitionName: 'PROCESS_TEST',
processDefinitionKey: 'PROCESS_TEST',
taskId: '999',
taskName: 'TEST',
fields: [
{
fieldType: 'ContainerRepresentation',
id: '000000000000000000',
name: 'Label',
type: 'container',
value: null,
numberOfColumns: 2,
fields: {
1: [
{
fieldType: 'FormFieldRepresentation',
id: 'FIELD_TEST',
name: 'FIELD_TEST',
type: 'text',
value: 'RIGHT_FORM_FIELD_VALUE',
visibilityCondition: null,
isVisible: true
},
{
fieldType: 'FormFieldRepresentation',
id: 'FIELD_WITH_CONDITION',
name: 'FIELD_WITH_CONDITION',
type: 'text',
value: 'field_with_condition_value',
visibilityCondition: null,
isVisible: true
},
{
fieldType: 'FormFieldRepresentation',
id: 'LEFT_FORM_FIELD_ID',
name: 'LEFT_FORM_FIELD_NAME',
type: 'text',
value: 'LEFT_FORM_FIELD_VALUE',
visibilityCondition: null,
isVisible: true
}
],
2: [
{
fieldType: 'FormFieldRepresentation',
id: 'RIGHT_FORM_FIELD_ID',
name: 'RIGHT_FORM_FIELD_NAME',
type: 'text',
value: 'RIGHT_FORM_FIELD_VALUE',
visibilityCondition: null,
isVisible: true
}
]
}
}
],
variables: [
{
'id': 'e621e8ff-42a6-499c-8121-33c7c35d8641',
'name': 'age',
'type': 'integer',
'value': 11
},
{
'id': '4f8aa99e-8526-429c-9d99-809978489d96',
'name': 'name',
'type': 'string',
'value': 'abc'
},
{
'id': '0207b649-ff07-4f3a-a589-d10afa507b9b',
'name': 'dob',
'type': 'date',
'value': '2019-05-13'
}
]
};
export let complexVisibilityJsonVisible = {
'id': 47591,
'name': 'Test-visibility',
'description': '',
'version': 4,
'lastUpdatedBy': 13,
'lastUpdatedByFullName': 'romano romano',
'lastUpdated': '2019-06-11T11:04:36.870+0000',
'stencilSetId': 0,
'referenceId': null,
'formDefinition': {
'tabs': [],
'fields': [{
'fieldType': 'ContainerRepresentation',
'id': '1560246123312',
'name': 'Label',
'type': 'container',
'value': null,
'required': false,
'readOnly': false,
'overrideId': false,
'colspan': 1,
'placeholder': null,
'minLength': 0,
'maxLength': 0,
'minValue': null,
'maxValue': null,
'regexPattern': null,
'optionType': null,
'hasEmptyValue': null,
'options': null,
'restUrl': null,
'restResponsePath': null,
'restIdProperty': null,
'restLabelProperty': null,
'tab': null,
'className': null,
'dateDisplayFormat': null,
'layout': null,
'sizeX': 2,
'sizeY': 1,
'row': -1,
'col': -1,
'visibilityCondition': null,
'numberOfColumns': 2,
'fields': {
'1': [{
'fieldType': 'FormFieldRepresentation',
'id': 'label',
'name': 'Label',
'type': 'text',
'value': null,
'required': false,
'readOnly': false,
'overrideId': false,
'colspan': 1,
'placeholder': null,
'minLength': 0,
'maxLength': 0,
'minValue': null,
'maxValue': null,
'regexPattern': null,
'optionType': null,
'hasEmptyValue': null,
'options': null,
'restUrl': null,
'restResponsePath': null,
'restIdProperty': null,
'restLabelProperty': null,
'tab': null,
'className': null,
'params': { 'existingColspan': 1, 'maxColspan': 2 },
'dateDisplayFormat': null,
'layout': { 'row': -1, 'column': -1, 'colspan': 1 },
'sizeX': 1,
'sizeY': 1,
'row': -1,
'col': -1,
'visibilityCondition': null
}],
'2': [{
'fieldType': 'FormFieldRepresentation',
'id': 'label1',
'name': 'Label1',
'type': 'text',
'value': null,
'required': false,
'readOnly': false,
'overrideId': false,
'colspan': 1,
'placeholder': null,
'minLength': 0,
'maxLength': 0,
'minValue': null,
'maxValue': null,
'regexPattern': null,
'optionType': null,
'hasEmptyValue': null,
'options': null,
'restUrl': null,
'restResponsePath': null,
'restIdProperty': null,
'restLabelProperty': null,
'tab': null,
'className': null,
'params': { 'existingColspan': 1, 'maxColspan': 1 },
'dateDisplayFormat': null,
'layout': { 'row': -1, 'column': -1, 'colspan': 1 },
'sizeX': 1,
'sizeY': 1,
'row': -1,
'col': -1,
'visibilityCondition': null
}]
}
}, {
'fieldType': 'ContainerRepresentation',
'id': '1560246128696',
'name': 'Label',
'type': 'container',
'value': null,
'required': false,
'readOnly': false,
'overrideId': false,
'colspan': 1,
'placeholder': null,
'minLength': 0,
'maxLength': 0,
'minValue': null,
'maxValue': null,
'regexPattern': null,
'optionType': null,
'hasEmptyValue': null,
'options': null,
'restUrl': null,
'restResponsePath': null,
'restIdProperty': null,
'restLabelProperty': null,
'tab': null,
'className': null,
'dateDisplayFormat': null,
'layout': null,
'sizeX': 2,
'sizeY': 1,
'row': -1,
'col': -1,
'visibilityCondition': null,
'numberOfColumns': 2,
'fields': {
'1': [{
'fieldType': 'FormFieldRepresentation',
'id': 'label4',
'name': 'Label4',
'type': 'text',
'value': null,
'required': false,
'readOnly': false,
'overrideId': false,
'colspan': 1,
'placeholder': null,
'minLength': 0,
'maxLength': 0,
'minValue': null,
'maxValue': null,
'regexPattern': null,
'optionType': null,
'hasEmptyValue': null,
'options': null,
'restUrl': null,
'restResponsePath': null,
'restIdProperty': null,
'restLabelProperty': null,
'tab': null,
'className': null,
'params': { 'existingColspan': 1, 'maxColspan': 2 },
'dateDisplayFormat': null,
'layout': { 'row': -1, 'column': -1, 'colspan': 1 },
'sizeX': 1,
'sizeY': 1,
'row': -1,
'col': -1,
'visibilityCondition': null
}],
'2': [{
'fieldType': 'FormFieldRepresentation',
'id': 'label3',
'name': 'Label3',
'type': 'text',
'value': '',
'required': false,
'readOnly': false,
'overrideId': false,
'colspan': 1,
'placeholder': null,
'minLength': 0,
'maxLength': 0,
'minValue': null,
'maxValue': null,
'regexPattern': null,
'optionType': null,
'hasEmptyValue': null,
'options': null,
'restUrl': null,
'restResponsePath': null,
'restIdProperty': null,
'restLabelProperty': null,
'tab': null,
'className': null,
'params': { 'existingColspan': 1, 'maxColspan': 1 },
'dateDisplayFormat': null,
'layout': { 'row': -1, 'column': -1, 'colspan': 1 },
'sizeX': 1,
'sizeY': 1,
'row': -1,
'col': -1,
'visibilityCondition': null
}]
}
}, {
'fieldType': 'ContainerRepresentation',
'id': '1560246126964',
'name': 'Label',
'type': 'container',
'value': null,
'required': false,
'readOnly': false,
'overrideId': false,
'colspan': 1,
'placeholder': null,
'minLength': 0,
'maxLength': 0,
'minValue': null,
'maxValue': null,
'regexPattern': null,
'optionType': null,
'hasEmptyValue': null,
'options': null,
'restUrl': null,
'restResponsePath': null,
'restIdProperty': null,
'restLabelProperty': null,
'tab': null,
'className': null,
'dateDisplayFormat': null,
'layout': null,
'sizeX': 2,
'sizeY': 1,
'row': -1,
'col': -1,
'visibilityCondition': null,
'numberOfColumns': 2,
'fields': {
'1': [{
'fieldType': 'FormFieldRepresentation',
'id': 'label2',
'name': 'Label2',
'type': 'text',
'value': null,
'required': false,
'readOnly': false,
'overrideId': false,
'colspan': 1,
'placeholder': null,
'minLength': 0,
'maxLength': 0,
'minValue': null,
'maxValue': null,
'regexPattern': null,
'optionType': null,
'hasEmptyValue': null,
'options': null,
'restUrl': null,
'restResponsePath': null,
'restIdProperty': null,
'restLabelProperty': null,
'tab': null,
'className': null,
'params': { 'existingColspan': 1, 'maxColspan': 2 },
'dateDisplayFormat': null,
'layout': { 'row': -1, 'column': -1, 'colspan': 1 },
'sizeX': 1,
'sizeY': 1,
'row': -1,
'col': -1,
'visibilityCondition': null
}],
'2': [{
'fieldType': 'FormFieldRepresentation',
'id': 'label5',
'name': 'Label5',
'type': 'boolean',
'value': null,
'required': false,
'readOnly': false,
'overrideId': false,
'colspan': 1,
'placeholder': null,
'minLength': 0,
'maxLength': 0,
'minValue': null,
'maxValue': null,
'regexPattern': null,
'optionType': null,
'hasEmptyValue': null,
'options': null,
'restUrl': null,
'restResponsePath': null,
'restIdProperty': null,
'restLabelProperty': null,
'tab': null,
'className': null,
'params': { 'existingColspan': 1, 'maxColspan': 1 },
'dateDisplayFormat': null,
'layout': { 'row': -1, 'column': -1, 'colspan': 1 },
'sizeX': 1,
'sizeY': 1,
'row': -1,
'col': -1,
'visibilityCondition': {
'leftType': 'label',
'leftValue': null,
'operator': '==',
'rightValue': 'aaa',
'rightType': null,
'nextConditionOperator': 'and',
'nextCondition': {
'leftType': 'label1',
'leftValue': null,
'operator': '!=',
'rightValue': 'aaa',
'rightType': null,
'nextConditionOperator': 'and',
'nextCondition': {
'leftType': 'label2',
'leftValue': null,
'operator': '!empty',
'rightValue': null,
'rightType': null,
'nextConditionOperator': 'or',
'nextCondition': {
'leftType': 'label3',
'leftValue': null,
'operator': 'empty',
'rightValue': null,
'rightType': null,
'nextConditionOperator': null,
'nextCondition': null
}
}
}
}
}]
}
}],
'outcomes': [],
'javascriptEvents': [],
'className': '',
'style': '',
'customFieldTemplates': {},
'metadata': {},
'variables': [],
'customFieldsValueInfo': {},
'gridsterForm': false
}
};
export let complexVisibilityJsonNotVisible = {
'id': 47591,
'name': 'Test-visibility',
'description': '',
'version': 4,
'lastUpdatedBy': 13,
'lastUpdatedByFullName': 'romano romano',
'lastUpdated': '2019-06-11T11:04:36.870+0000',
'stencilSetId': 0,
'referenceId': null,
'formDefinition': {
'tabs': [],
'fields': [{
'fieldType': 'ContainerRepresentation',
'id': '1560246123312',
'name': 'Label',
'type': 'container',
'value': null,
'required': false,
'readOnly': false,
'overrideId': false,
'colspan': 1,
'placeholder': null,
'minLength': 0,
'maxLength': 0,
'minValue': null,
'maxValue': null,
'regexPattern': null,
'optionType': null,
'hasEmptyValue': null,
'options': null,
'restUrl': null,
'restResponsePath': null,
'restIdProperty': null,
'restLabelProperty': null,
'tab': null,
'className': null,
'dateDisplayFormat': null,
'layout': null,
'sizeX': 2,
'sizeY': 1,
'row': -1,
'col': -1,
'visibilityCondition': null,
'numberOfColumns': 2,
'fields': {
'1': [{
'fieldType': 'FormFieldRepresentation',
'id': 'label',
'name': 'Label',
'type': 'text',
'value': null,
'required': false,
'readOnly': false,
'overrideId': false,
'colspan': 1,
'placeholder': null,
'minLength': 0,
'maxLength': 0,
'minValue': null,
'maxValue': null,
'regexPattern': null,
'optionType': null,
'hasEmptyValue': null,
'options': null,
'restUrl': null,
'restResponsePath': null,
'restIdProperty': null,
'restLabelProperty': null,
'tab': null,
'className': null,
'params': { 'existingColspan': 1, 'maxColspan': 2 },
'dateDisplayFormat': null,
'layout': { 'row': -1, 'column': -1, 'colspan': 1 },
'sizeX': 1,
'sizeY': 1,
'row': -1,
'col': -1,
'visibilityCondition': null
}],
'2': [{
'fieldType': 'FormFieldRepresentation',
'id': 'label1',
'name': 'Label1',
'type': 'text',
'value': null,
'required': false,
'readOnly': false,
'overrideId': false,
'colspan': 1,
'placeholder': null,
'minLength': 0,
'maxLength': 0,
'minValue': null,
'maxValue': null,
'regexPattern': null,
'optionType': null,
'hasEmptyValue': null,
'options': null,
'restUrl': null,
'restResponsePath': null,
'restIdProperty': null,
'restLabelProperty': null,
'tab': null,
'className': null,
'params': { 'existingColspan': 1, 'maxColspan': 1 },
'dateDisplayFormat': null,
'layout': { 'row': -1, 'column': -1, 'colspan': 1 },
'sizeX': 1,
'sizeY': 1,
'row': -1,
'col': -1,
'visibilityCondition': null
}]
}
}, {
'fieldType': 'ContainerRepresentation',
'id': '1560246128696',
'name': 'Label',
'type': 'container',
'value': null,
'required': false,
'readOnly': false,
'overrideId': false,
'colspan': 1,
'placeholder': null,
'minLength': 0,
'maxLength': 0,
'minValue': null,
'maxValue': null,
'regexPattern': null,
'optionType': null,
'hasEmptyValue': null,
'options': null,
'restUrl': null,
'restResponsePath': null,
'restIdProperty': null,
'restLabelProperty': null,
'tab': null,
'className': null,
'dateDisplayFormat': null,
'layout': null,
'sizeX': 2,
'sizeY': 1,
'row': -1,
'col': -1,
'visibilityCondition': null,
'numberOfColumns': 2,
'fields': {
'1': [{
'fieldType': 'FormFieldRepresentation',
'id': 'label4',
'name': 'Label4',
'type': 'text',
'value': null,
'required': false,
'readOnly': false,
'overrideId': false,
'colspan': 1,
'placeholder': null,
'minLength': 0,
'maxLength': 0,
'minValue': null,
'maxValue': null,
'regexPattern': null,
'optionType': null,
'hasEmptyValue': null,
'options': null,
'restUrl': null,
'restResponsePath': null,
'restIdProperty': null,
'restLabelProperty': null,
'tab': null,
'className': null,
'params': { 'existingColspan': 1, 'maxColspan': 2 },
'dateDisplayFormat': null,
'layout': { 'row': -1, 'column': -1, 'colspan': 1 },
'sizeX': 1,
'sizeY': 1,
'row': -1,
'col': -1,
'visibilityCondition': null
}],
'2': [{
'fieldType': 'FormFieldRepresentation',
'id': 'label3',
'name': 'Label3',
'type': 'text',
'value': 'OPSSS',
'required': false,
'readOnly': false,
'overrideId': false,
'colspan': 1,
'placeholder': null,
'minLength': 0,
'maxLength': 0,
'minValue': null,
'maxValue': null,
'regexPattern': null,
'optionType': null,
'hasEmptyValue': null,
'options': null,
'restUrl': null,
'restResponsePath': null,
'restIdProperty': null,
'restLabelProperty': null,
'tab': null,
'className': null,
'params': { 'existingColspan': 1, 'maxColspan': 1 },
'dateDisplayFormat': null,
'layout': { 'row': -1, 'column': -1, 'colspan': 1 },
'sizeX': 1,
'sizeY': 1,
'row': -1,
'col': -1,
'visibilityCondition': null
}]
}
}, {
'fieldType': 'ContainerRepresentation',
'id': '1560246126964',
'name': 'Label',
'type': 'container',
'value': null,
'required': false,
'readOnly': false,
'overrideId': false,
'colspan': 1,
'placeholder': null,
'minLength': 0,
'maxLength': 0,
'minValue': null,
'maxValue': null,
'regexPattern': null,
'optionType': null,
'hasEmptyValue': null,
'options': null,
'restUrl': null,
'restResponsePath': null,
'restIdProperty': null,
'restLabelProperty': null,
'tab': null,
'className': null,
'dateDisplayFormat': null,
'layout': null,
'sizeX': 2,
'sizeY': 1,
'row': -1,
'col': -1,
'visibilityCondition': null,
'numberOfColumns': 2,
'fields': {
'1': [{
'fieldType': 'FormFieldRepresentation',
'id': 'label2',
'name': 'Label2',
'type': 'text',
'value': null,
'required': false,
'readOnly': false,
'overrideId': false,
'colspan': 1,
'placeholder': null,
'minLength': 0,
'maxLength': 0,
'minValue': null,
'maxValue': null,
'regexPattern': null,
'optionType': null,
'hasEmptyValue': null,
'options': null,
'restUrl': null,
'restResponsePath': null,
'restIdProperty': null,
'restLabelProperty': null,
'tab': null,
'className': null,
'params': { 'existingColspan': 1, 'maxColspan': 2 },
'dateDisplayFormat': null,
'layout': { 'row': -1, 'column': -1, 'colspan': 1 },
'sizeX': 1,
'sizeY': 1,
'row': -1,
'col': -1,
'visibilityCondition': null
}],
'2': [{
'fieldType': 'FormFieldRepresentation',
'id': 'label5',
'name': 'Label5',
'type': 'boolean',
'value': null,
'required': false,
'readOnly': false,
'overrideId': false,
'colspan': 1,
'placeholder': null,
'minLength': 0,
'maxLength': 0,
'minValue': null,
'maxValue': null,
'regexPattern': null,
'optionType': null,
'hasEmptyValue': null,
'options': null,
'restUrl': null,
'restResponsePath': null,
'restIdProperty': null,
'restLabelProperty': null,
'tab': null,
'className': null,
'params': { 'existingColspan': 1, 'maxColspan': 1 },
'dateDisplayFormat': null,
'layout': { 'row': -1, 'column': -1, 'colspan': 1 },
'sizeX': 1,
'sizeY': 1,
'row': -1,
'col': -1,
'visibilityCondition': {
'leftType': 'label',
'leftValue': 'label',
'operator': '==',
'rightValue': 'aaa',
'rightType': 'variable',
'nextConditionOperator': 'and',
'nextCondition': {
'leftType': 'field',
'leftValue': 'label1',
'operator': '!=',
'rightValue': 'aaa',
'rightType': 'variable',
'nextConditionOperator': 'and',
'nextCondition': {
'leftType': 'field',
'leftValue': 'label2',
'operator': '!empty',
'rightValue': null,
'rightType': 'variable',
'nextConditionOperator': 'or',
'nextCondition': {
'leftType': 'field',
'leftValue': 'label3',
'operator': 'empty',
'rightValue': 'variable',
'rightType': null,
'nextConditionOperator': null,
'nextCondition': null
}
}
}
}
}]
}
}],
'outcomes': [],
'javascriptEvents': [],
'className': '',
'style': '',
'customFieldTemplates': {},
'metadata': {},
'variables': [],
'customFieldsValueInfo': {},
'gridsterForm': false
}
};

View File

@ -829,7 +829,6 @@ export let complexVisibilityJsonNotVisible = {
'leftRestResponseId': null,
'operator': '==',
'rightValue': 'aaa',
'rightType': null,
'rightFormFieldId': '',
'rightRestResponseId': '',
'nextConditionOperator': 'and',
@ -838,7 +837,6 @@ export let complexVisibilityJsonNotVisible = {
'leftRestResponseId': null,
'operator': '!=',
'rightValue': 'aaa',
'rightType': null,
'rightFormFieldId': '',
'rightRestResponseId': '',
'nextConditionOperator': 'and',
@ -847,7 +845,6 @@ export let complexVisibilityJsonNotVisible = {
'leftRestResponseId': null,
'operator': '!empty',
'rightValue': null,
'rightType': null,
'rightFormFieldId': '',
'rightRestResponseId': '',
'nextConditionOperator': 'or',
@ -856,7 +853,6 @@ export let complexVisibilityJsonNotVisible = {
'leftRestResponseId': null,
'operator': 'empty',
'rightValue': null,
'rightType': null,
'rightFormFieldId': '',
'rightRestResponseId': '',
'nextConditionOperator': null,