Skip to content

Commit

Permalink
feat: support conditions in dropdown choices
Browse files Browse the repository at this point in the history
  • Loading branch information
smbea committed Aug 24, 2023
1 parent ba2fc75 commit 6fea64c
Show file tree
Hide file tree
Showing 4 changed files with 119 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@
"$id": "#/properties/property/choices/item/value",
"type": "string",
"description": "The value of a choice."
},
"condition": {
"$ref": "condition.json"
}
},
"required": [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
export const template = {
'name': 'Condition',
'id': 'example.com.condition',
'appliesTo': [
'bpmn:ServiceTask'
],
'properties': [
{
'id': 'myId',
'label': 'input 1',
'type': 'String',
'binding': {
'type': 'property',
'name': 'input1'
}
},
{
'label': 'Dropdown',
'type': 'Dropdown',
'choices': [
{
'value': 'opt1',
'name':'opt1'
},
{
'value': 'opt2',
'name': 'opt2'
},
{
'value': 'opt3',
'name': 'opt3',
'condition': 'myId == 2'
}
],
'binding': {
'type': 'zeebe:property',
'name': 'method'
}
}
]
};

export const errors = [
{
keyword: 'type',
dataPath: '/properties/1/choices/2/condition',
schemaPath: '#/type',
params: { type: 'object' },
message: 'should be object'
},
{
keyword: 'type',
dataPath: '',
schemaPath: '#/oneOf/1/type',
params: { type: 'array' },
message: 'should be array'
},
{
keyword: 'oneOf',
dataPath: '',
schemaPath: '#/oneOf',
params: { passingSchemas: null },
message: 'should match exactly one schema in oneOf'
}
];
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
export const template = {
'name': 'Condition',
'id': 'example.com.condition',
'appliesTo': [
'bpmn:ServiceTask'
],
'properties': [
{
'id': 'myId',
'label': 'input 1',
'type': 'String',
'binding': {
'type': 'property',
'name': 'input1'
}
},
{
'label': 'Dropdown',
'type': 'Dropdown',
'choices': [
{
'value': 'opt1',
'name':'opt1'
},
{
'value': 'opt2',
'name': 'opt2'
},
{
'value': 'opt3',
'name': 'opt3',
'condition': {
'property': 'myId',
'equals': 'text'
}
}
],
'binding': {
'type': 'zeebe:property',
'name': 'method'
}
}
]
};

export const errors = null;
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,11 @@ describe('validation', function() {

testTemplate('condition-allMatch-one-condition');


testTemplate('condition-dropdown-choices');


testTemplate('condition-dropdown-choices-invalid');
});


Expand Down

0 comments on commit 6fea64c

Please sign in to comment.