Skip to content

Commit a0697d6

Browse files
authored
0.3.0. (#6)
1 parent 53c8656 commit a0697d6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+359
-64
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
## 0.3.0
2+
3+
* Added new value model: nullable any variable (`nullableAnyVariableValueModel({ ... })`). This value model allows you to select any variable. Additionally, you can specify a variable type that can be selected by a user.
4+
* Added new optional property: `valueTypes` to `VariableDefinitionsValueModelConfiguration` interface. Now it's possible to force the types of variables during creation of variables by a user.
5+
6+
**Breaking changes:**
7+
8+
* Renamed the `variableType` property to `valueType` in the `NullableVariableValueModelConfiguration` interface.
9+
* Renamed the `variableType` property to `valueType` in the `NullableVariableDefinitionValueModelConfiguration` interface.
10+
111
## 0.2.1
212

313
Fixed bug with removing a message about an empty list.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ import { EditorProvider } from 'sequential-workflow-editor';
9696
import { Uid } from 'sequential-workflow-designer';
9797

9898
export const editorProvider = EditorProvider.create(definitionModel, {
99-
uidGenerator: Uid.next
99+
uidGenerator: Uid.next
100100
});
101101
```
102102

demos/webpack-app/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
"dependencies": {
1717
"xstate": "^4.37.2",
1818
"sequential-workflow-model": "^0.1.3",
19-
"sequential-workflow-designer": "^0.13.0",
19+
"sequential-workflow-designer": "^0.13.2",
2020
"sequential-workflow-machine": "^0.2.0",
21-
"sequential-workflow-editor-model": "^0.2.1",
22-
"sequential-workflow-editor": "^0.2.1"
21+
"sequential-workflow-editor-model": "^0.3.0",
22+
"sequential-workflow-editor": "^0.3.0"
2323
},
2424
"devDependencies": {
2525
"ts-loader": "^9.4.2",
@@ -33,4 +33,4 @@
3333
"@typescript-eslint/parser": "^5.47.0",
3434
"eslint": "^8.30.0"
3535
}
36-
}
36+
}

demos/webpack-app/public/assets/icon-calculate.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

demos/webpack-app/public/assets/icon-log.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

demos/webpack-app/public/assets/icon-setStringValue.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Loading

demos/webpack-app/src/playground/app.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ export class App {
2828
root: editorProvider.createRootValidator()
2929
},
3030
steps: {
31-
iconUrlProvider: (_, type: string) => `./assets/icon-${type}.svg`
31+
iconUrlProvider: (componentType: string, type: string) => {
32+
return componentType === 'task' ? './assets/icon-task.svg' : `./assets/icon-${type}.svg`;
33+
}
3234
},
3335
toolbox: {
3436
groups: [
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import { createAtomActivity } from 'sequential-workflow-machine';
2+
import { GlobalState } from '../global-state';
3+
import { ConvertValueStep } from '../../model/convert-value-step-model';
4+
5+
export const convertValueActivity = createAtomActivity<ConvertValueStep, GlobalState>({
6+
init: () => ({}),
7+
stepType: 'convertValue',
8+
handler: async (step: ConvertValueStep, { $variables }: GlobalState) => {
9+
if (!step.properties.source) {
10+
throw new Error('Source variable is required');
11+
}
12+
if (!step.properties.target) {
13+
throw new Error('Target variable is required');
14+
}
15+
16+
const value = $variables.read(step.properties.source.name);
17+
18+
let convertedValue: unknown;
19+
switch (step.properties.target.type) {
20+
case 'number':
21+
convertedValue = Number(value);
22+
break;
23+
case 'string':
24+
convertedValue = String(value);
25+
break;
26+
default:
27+
throw new Error(`Unsupported target type: ${step.properties.target.type}`);
28+
}
29+
30+
$variables.set(step.properties.target.name, convertedValue);
31+
}
32+
});

demos/webpack-app/src/playground/machine/activities/set-string-value-activity.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { createAtomActivity } from 'sequential-workflow-machine';
22
import { GlobalState } from '../global-state';
3-
import { SetStringValueStep } from '../../model/set-string-value-model';
3+
import { SetStringValueStep } from '../../model/set-string-value-step-model';
44

55
export const setStringValueActivity = createAtomActivity<SetStringValueStep, GlobalState>({
66
init: () => ({}),

0 commit comments

Comments
 (0)