mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[MNT-22348] - Fixed visibility when complex cases are appling (#7176)
* [MNT-22348] - Fixed visibility when complex cases are appling * [MNT-22348] - Fixed lint errrors * [MNT-22461] Unit test for visibility condition behaviour for checkxox expression is added * fixed unit test for visibility condition * [MNT-22348] - Fixed wrong form definition * [MNT-22348] - Fixed wrong quote * [MNT-22348] - Fixed wrong form definition * [MNT-22348] - fixed form definition Co-authored-by: Ketevani Kvirikashvili <qqetikv@gmail.com>
This commit is contained in:
@@ -116,6 +116,700 @@ export const fakeFormJson: any = {
|
||||
]
|
||||
};
|
||||
|
||||
export const fakeFormCheckBoxVisibilityJson: any = {
|
||||
referenceId: '33033',
|
||||
name: 'test_condition_form',
|
||||
description: '',
|
||||
tabs: [],
|
||||
fields: [
|
||||
{
|
||||
fieldType: 'ContainerRepresentation',
|
||||
id: '1623514352532',
|
||||
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: 'a',
|
||||
name: 'A',
|
||||
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: '2'
|
||||
},
|
||||
dateDisplayFormat: 'null',
|
||||
layout: {
|
||||
row: '-1',
|
||||
column: '-1',
|
||||
colspan: '1'
|
||||
},
|
||||
sizeX: '1',
|
||||
sizeY: '1',
|
||||
row: '-1',
|
||||
col: '-1',
|
||||
visibilityCondition: 'null'
|
||||
}
|
||||
],
|
||||
2: [
|
||||
{
|
||||
fieldType: 'FormFieldRepresentation',
|
||||
id: 'b',
|
||||
name: 'B',
|
||||
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: 'null'
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
fieldType: 'ContainerRepresentation',
|
||||
id: '1623514356352',
|
||||
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: 'c',
|
||||
name: 'C',
|
||||
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: '2'
|
||||
},
|
||||
dateDisplayFormat: 'null',
|
||||
layout: {
|
||||
row: '-1',
|
||||
column: '-1',
|
||||
colspan: '1'
|
||||
},
|
||||
sizeX: '1',
|
||||
sizeY: '1',
|
||||
row: '-1',
|
||||
col: '-1',
|
||||
visibilityCondition: 'null'
|
||||
}],
|
||||
2: [
|
||||
{
|
||||
fieldType: 'FormFieldRepresentation',
|
||||
id: 'd',
|
||||
name: 'D',
|
||||
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: 'null'
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
fieldType: 'ContainerRepresentation',
|
||||
id: '1623514409166',
|
||||
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: 'a_b_c_d',
|
||||
name: 'Textfield ( A && B || C && D)',
|
||||
type: 'text',
|
||||
value: 'null',
|
||||
required: 'false',
|
||||
readOnly: 'false',
|
||||
overrideId: 'true',
|
||||
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: {
|
||||
leftFormFieldId: 'a',
|
||||
leftRestResponseId: 'null',
|
||||
operator: '==',
|
||||
rightValue: 'true',
|
||||
rightType: 'null',
|
||||
rightFormFieldId: '',
|
||||
rightRestResponseId: '',
|
||||
nextConditionOperator: 'and',
|
||||
nextCondition: {
|
||||
leftFormFieldId: 'b',
|
||||
leftRestResponseId: 'null',
|
||||
operator: '==',
|
||||
rightValue: 'true',
|
||||
rightType: 'null',
|
||||
rightFormFieldId: '',
|
||||
rightRestResponseId: '',
|
||||
nextConditionOperator: 'or',
|
||||
nextCondition: {
|
||||
leftFormFieldId: 'c',
|
||||
leftRestResponseId: 'null',
|
||||
operator: '==',
|
||||
rightValue: 'true',
|
||||
rightType: 'null',
|
||||
rightFormFieldId: '',
|
||||
rightRestResponseId: '',
|
||||
nextConditionOperator: 'and',
|
||||
nextCondition: {
|
||||
leftFormFieldId: 'd',
|
||||
leftRestResponseId: 'null',
|
||||
operator: '==',
|
||||
rightValue: 'true',
|
||||
rightType: 'null',
|
||||
rightFormFieldId: '',
|
||||
rightRestResponseId: '',
|
||||
nextConditionOperator: '',
|
||||
nextCondition: 'null'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
2: []
|
||||
}
|
||||
}
|
||||
],
|
||||
outcomes: [],
|
||||
javascriptEvents: [],
|
||||
className: '',
|
||||
style: '',
|
||||
customFieldTemplates: {},
|
||||
metadata: {},
|
||||
variables: [],
|
||||
customFieldsValueInfo: {},
|
||||
gridsterForm: 'false'
|
||||
};
|
||||
|
||||
export const fakeFormChainedVisibilityJson: any = {
|
||||
id: '8800',
|
||||
name: 'FORM_VISIBILITYl_CHAIN',
|
||||
processDefinitionId: 'PROCESS_TEST: 9: 9999',
|
||||
processDefinitionName: 'PROCESS_TEST',
|
||||
processDefinitionKey: 'PROCESS_TEST',
|
||||
taskId: '999',
|
||||
taskName: 'TEST',
|
||||
fields: [
|
||||
{
|
||||
fieldType: 'ContainerRepresentation',
|
||||
id: '1615506402205',
|
||||
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: 'installments',
|
||||
name: 'Installments',
|
||||
type: 'integer',
|
||||
value: null,
|
||||
required: true,
|
||||
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: 'RestFieldRepresentation',
|
||||
id: 'schedule',
|
||||
name: 'Schedule',
|
||||
type: 'dropdown',
|
||||
value: 'Choose one...',
|
||||
required: false,
|
||||
readOnly: false,
|
||||
overrideId: false,
|
||||
colspan: 1,
|
||||
placeholder: null,
|
||||
minLength: 0,
|
||||
maxLength: 0,
|
||||
minValue: null,
|
||||
maxValue: null,
|
||||
regexPattern: null,
|
||||
optionType: null,
|
||||
hasEmptyValue: true,
|
||||
options: [
|
||||
{
|
||||
id: 'empty',
|
||||
name: 'Choose one...'
|
||||
},
|
||||
{
|
||||
id: 'ANNUAL',
|
||||
name: 'Annual'
|
||||
},
|
||||
{
|
||||
id: 'QUARTERLY',
|
||||
name: 'Quarterly'
|
||||
},
|
||||
{
|
||||
id: 'MONTHLY',
|
||||
name: 'Monthly'
|
||||
}
|
||||
],
|
||||
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,
|
||||
endpoint: null,
|
||||
requestHeaders: null
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
fieldType: 'ContainerRepresentation',
|
||||
id: 1615506384790,
|
||||
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: 'showtext',
|
||||
name: 'Show text',
|
||||
type: 'readonly-text',
|
||||
value: 'This test is shown when the visibility logic is displayed.\nThis should only show under the following conditions:\nAnnual and installment > 5\nQuarterly and installment > 20\nMonthly and installment > 60',
|
||||
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: {
|
||||
leftFormFieldId: 'schedule',
|
||||
leftRestResponseId: null,
|
||||
operator: '==',
|
||||
rightValue: 'ANNUAL',
|
||||
rightType: null,
|
||||
rightFormFieldId: '',
|
||||
rightRestResponseId: '',
|
||||
nextConditionOperator: 'and',
|
||||
nextCondition: {
|
||||
leftFormFieldId: 'installments',
|
||||
leftRestResponseId: null,
|
||||
operator: '>',
|
||||
rightValue: 5,
|
||||
rightType: null,
|
||||
rightFormFieldId: '',
|
||||
rightRestResponseId: '',
|
||||
nextConditionOperator: 'or',
|
||||
nextCondition: {
|
||||
leftFormFieldId: 'schedule',
|
||||
leftRestResponseId: null,
|
||||
operator: '==',
|
||||
rightValue: 'QUARTERLY',
|
||||
rightType: null,
|
||||
rightFormFieldId: '',
|
||||
rightRestResponseId: '',
|
||||
nextConditionOperator: 'and',
|
||||
nextCondition: {
|
||||
leftFormFieldId: 'installments',
|
||||
leftRestResponseId: null,
|
||||
operator: '>',
|
||||
rightValue: 20,
|
||||
rightType: null,
|
||||
rightFormFieldId: '',
|
||||
rightRestResponseId: '',
|
||||
nextConditionOperator: 'or',
|
||||
nextCondition: {
|
||||
leftFormFieldId: 'schedule',
|
||||
leftRestResponseId: null,
|
||||
operator: '==',
|
||||
rightValue: 'MONTHLY',
|
||||
rightType: null,
|
||||
rightFormFieldId: '',
|
||||
rightRestResponseId: '',
|
||||
nextConditionOperator: 'and',
|
||||
nextCondition: {
|
||||
leftFormFieldId: 'installments',
|
||||
leftRestResponseId: null,
|
||||
operator: '>',
|
||||
rightValue: 60,
|
||||
rightType: null,
|
||||
rightFormFieldId: '',
|
||||
rightRestResponseId: '',
|
||||
nextConditionOperator: '',
|
||||
nextCondition: null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
2: []
|
||||
}
|
||||
}
|
||||
],
|
||||
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 const complexVisibilityJsonVisible: any = {
|
||||
'id': 47591,
|
||||
'name': 'Test-visibility',
|
||||
|
Reference in New Issue
Block a user