|
1 | 1 | import { |
2 | 2 | Dynamic, |
3 | 3 | NullableVariable, |
4 | | - ValueKnownType, |
| 4 | + booleanValueModel, |
5 | 5 | branchesValueModel, |
6 | 6 | choiceValueModel, |
7 | 7 | createBranchedStepModel, |
8 | 8 | dynamicValueModel, |
9 | | - nullableVariableValueModel, |
10 | | - numberValueModel |
| 9 | + nullableAnyVariableValueModel, |
| 10 | + numberValueModel, |
| 11 | + stringValueModel |
11 | 12 | } from 'sequential-workflow-editor-model'; |
12 | 13 | import { BranchedStep } from 'sequential-workflow-model'; |
13 | 14 |
|
14 | 15 | export interface IfStep extends BranchedStep { |
15 | 16 | type: 'if'; |
16 | 17 | componentType: 'switch'; |
17 | 18 | properties: { |
18 | | - a: Dynamic<number | NullableVariable>; |
| 19 | + a: Dynamic<number | string | boolean | NullableVariable>; |
19 | 20 | operator: string; |
20 | | - b: Dynamic<number | NullableVariable>; |
| 21 | + b: Dynamic<number | string | boolean | NullableVariable>; |
21 | 22 | }; |
22 | 23 | } |
23 | 24 |
|
24 | 25 | export const ifStepModel = createBranchedStepModel<IfStep>('if', 'switch', step => { |
25 | | - const val = dynamicValueModel({ |
| 26 | + const ab = dynamicValueModel({ |
26 | 27 | models: [ |
27 | 28 | numberValueModel({}), |
28 | | - nullableVariableValueModel({ |
29 | | - isRequired: true, |
30 | | - valueType: ValueKnownType.number |
| 29 | + stringValueModel({}), |
| 30 | + booleanValueModel({}), |
| 31 | + nullableAnyVariableValueModel({ |
| 32 | + isRequired: true |
31 | 33 | }) |
32 | 34 | ] |
33 | 35 | }); |
34 | 36 |
|
35 | | - step.property('a').value(val).label('A'); |
| 37 | + step.property('a').value(ab).label('A'); |
36 | 38 |
|
37 | 39 | step.property('operator') |
38 | 40 | .label('Operator') |
39 | 41 | .value( |
40 | 42 | choiceValueModel({ |
41 | | - choices: ['=', '!=', '>', '>=', '<', '<='] |
| 43 | + choices: ['==', '===', '!=', '!==', '>', '>=', '<', '<='] |
42 | 44 | }) |
43 | 45 | ); |
44 | 46 |
|
45 | | - step.property('b').value(val).label('B'); |
| 47 | + step.property('b').value(ab).label('B'); |
46 | 48 |
|
47 | 49 | step.branches().value( |
48 | 50 | branchesValueModel({ |
|
0 commit comments