Skip to content

Commit 6d9829d

Browse files
authored
0.18.4. (#117)
1 parent 957b90d commit 6d9829d

24 files changed

+157
-85
lines changed

CHANGELOG.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
1-
## 0.18.3
1+
## 0.18.4
22

3-
Added a feature to the sequential-workflow-designer-react package that enables re-rendering the canvas when you pass a new instance of the wrapped definition. The instance of the definition must remain the same. This enables easy manipulation of the definition from outside the designer in your React application.
3+
This version removes the features introduced in the previous release. We noticed that the proposed solution did not update the undo stack. As a result, we removed that feature in this version. Instead, we added a new method to the Designer class called `replaceDefinition`, which allows for the replacement of the entire definition and updates the undo stack.
44

5-
```tsx
6-
function action() {
5+
```ts
6+
function appendStep() {
77
const newStep: Step = { /* ... */ };
88

9-
definition.value.sequence.push(newStep);
10-
setDefinition({ ...definition });
9+
const newDefinition = ObjectCloner.deepClone(designer.getDefinition());
10+
newDefinition.sequence.push(newStep);
11+
await designer.replaceDefinition(newDefinition);
1112
}
1213
```
1314

15+
## 0.18.3
16+
17+
Edited: changes are reverted in the 0.18.4 version.
18+
1419
## 0.18.2
1520

1621
This version corrects a bug in the `moveViewportToStep` method that caused the viewport to move to the incorrect position.

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,10 @@ Add the below code to your head section in HTML document.
9696
```html
9797
<head>
9898
...
99-
<link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.18.3/css/designer.css" rel="stylesheet">
100-
<link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.18.3/css/designer-light.css" rel="stylesheet">
101-
<link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.18.3/css/designer-dark.css" rel="stylesheet">
102-
<script src="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.18.3/dist/index.umd.js"></script>
99+
<link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.18.4/css/designer.css" rel="stylesheet">
100+
<link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.18.4/css/designer-light.css" rel="stylesheet">
101+
<link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.18.4/css/designer-dark.css" rel="stylesheet">
102+
<script src="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.18.4/dist/index.umd.js"></script>
103103
```
104104

105105
Call the designer by:

angular/designer/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "sequential-workflow-designer-angular",
33
"description": "Angular wrapper for Sequential Workflow Designer component.",
4-
"version": "0.18.3",
4+
"version": "0.18.4",
55
"author": {
66
"name": "NoCode JS",
77
"url": "https://nocode-js.com/"
@@ -15,7 +15,7 @@
1515
"peerDependencies": {
1616
"@angular/common": "12 - 16",
1717
"@angular/core": "12 - 16",
18-
"sequential-workflow-designer": "^0.18.3"
18+
"sequential-workflow-designer": "^0.18.4"
1919
},
2020
"dependencies": {
2121
"tslib": "^2.3.0"

demos/angular-app/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
"@angular/platform-browser-dynamic": "^15.2.9",
2727
"@angular/router": "^15.2.9",
2828
"rxjs": "~7.8.0",
29-
"sequential-workflow-designer": "^0.18.3",
30-
"sequential-workflow-designer-angular": "^0.18.3",
29+
"sequential-workflow-designer": "^0.18.4",
30+
"sequential-workflow-designer-angular": "^0.18.4",
3131
"tslib": "^2.3.0",
3232
"zone.js": "~0.13.0"
3333
},

demos/angular-app/yarn.lock

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5956,17 +5956,17 @@ send@0.18.0:
59565956
range-parser "~1.2.1"
59575957
statuses "2.0.1"
59585958

5959-
sequential-workflow-designer-angular@^0.18.3:
5960-
version "0.18.3"
5961-
resolved "https://registry.yarnpkg.com/sequential-workflow-designer-angular/-/sequential-workflow-designer-angular-0.18.3.tgz#4bfb9943c987ac6b609c657a34d48701d10484f0"
5962-
integrity sha512-mJGok8qR0xDffn+tNBS3O8wCK9xgu8n/xiIVCurwqcPJ46jvHiQdjnJfS4Ea8bj5MGC1uRQvle9zO8puNlRzbw==
5959+
sequential-workflow-designer-angular@^0.18.4:
5960+
version "0.18.4"
5961+
resolved "https://registry.yarnpkg.com/sequential-workflow-designer-angular/-/sequential-workflow-designer-angular-0.18.4.tgz#552062a04c84e294e940858a2c99b843b0ac4705"
5962+
integrity sha512-K4ZxmbNGQhvJqYqC4ZszHYswViDKTHTKbc3YmqtVpGA5asVJ0fbhNEsfZyRzvI3N7F5/BAQtWvPRA1FKjvOXxg==
59635963
dependencies:
59645964
tslib "^2.3.0"
59655965

5966-
sequential-workflow-designer@^0.18.3:
5967-
version "0.18.3"
5968-
resolved "https://registry.yarnpkg.com/sequential-workflow-designer/-/sequential-workflow-designer-0.18.3.tgz#3c2165550160216fb40e2eb945c654d5ae5d505c"
5969-
integrity sha512-IchagYDpIYNvIVv4HleKn+x+ZfItVDxoQqQbBF1Ms7vEZdd0CwfvB17NBZLfz02LTGyGE/GGGPc8IEvqkajvMQ==
5966+
sequential-workflow-designer@^0.18.4:
5967+
version "0.18.4"
5968+
resolved "https://registry.yarnpkg.com/sequential-workflow-designer/-/sequential-workflow-designer-0.18.4.tgz#da4d3924fab044391c2d0c26244ca164a8b2d659"
5969+
integrity sha512-JdLXiAjsqovJOHJEDXrk+FXcm/GHsoaNAAiaCNx3LqXHimpRMaH+Cy9DdL6L6KNsrLsWQcxWay+B6pokNTUFeg==
59705970
dependencies:
59715971
sequential-workflow-model "^0.2.0"
59725972

demos/react-app/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
"dependencies": {
77
"react": "^18.2.0",
88
"react-dom": "^18.2.0",
9-
"sequential-workflow-designer": "^0.18.3",
10-
"sequential-workflow-designer-react": "^0.18.3"
9+
"sequential-workflow-designer": "^0.18.4",
10+
"sequential-workflow-designer-react": "^0.18.4"
1111
},
1212
"devDependencies": {
1313
"@types/jest": "^29.2.5",

demos/react-app/src/playground/Playground.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,13 @@ export function Playground() {
8686
}
8787
}
8888

89-
function appendStepClicked() {
89+
async function appendStepClicked() {
9090
const newStep = createTaskStep();
9191

92-
// We need to keep the same reference to the definition, but the wrapped definition must be a new instance.
93-
definition.value.sequence.push(newStep);
94-
setDefinition({ ...definition });
92+
const newDefinition = ObjectCloner.deepClone(definition.value);
93+
newDefinition.sequence.push(newStep);
94+
// We need to wait for the controller to finish the operation before we can select the new step
95+
await controller.replaceDefinition(newDefinition);
9596

9697
setSelectedStepId(newStep.id);
9798
setMoveViewportToStep(newStep.id);

demos/svelte-app/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
"eslint": "eslint ./src --ext .ts"
1717
},
1818
"dependencies": {
19-
"sequential-workflow-designer": "^0.18.3",
20-
"sequential-workflow-designer-svelte": "^0.18.3"
19+
"sequential-workflow-designer": "^0.18.4",
20+
"sequential-workflow-designer-svelte": "^0.18.4"
2121
},
2222
"devDependencies": {
2323
"@sveltejs/adapter-static": "^2.0.3",

designer/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "sequential-workflow-designer",
33
"description": "Customizable no-code component for building flow-based programming applications.",
4-
"version": "0.18.3",
4+
"version": "0.18.4",
55
"type": "module",
66
"main": "./lib/esm/index.js",
77
"types": "./lib/index.d.ts",

designer/src/api/control-bar-api.ts

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,40 @@
1+
import { SimpleEvent } from '../core';
12
import { DefinitionModifier } from '../definition-modifier';
23
import { DesignerState } from '../designer-state';
34
import { HistoryController } from '../history-controller';
45
import { ViewportApi } from './viewport-api';
56

67
export class ControlBarApi {
7-
public constructor(
8+
public static create(
9+
state: DesignerState,
10+
historyController: HistoryController | undefined,
11+
definitionModifier: DefinitionModifier,
12+
viewportApi: ViewportApi
13+
): ControlBarApi {
14+
const api = new ControlBarApi(state, historyController, definitionModifier, viewportApi);
15+
state.onIsReadonlyChanged.subscribe(api.onStateChanged.forward);
16+
state.onSelectedStepIdChanged.subscribe(api.onStateChanged.forward);
17+
state.onIsDragDisabledChanged.subscribe(api.onStateChanged.forward);
18+
if (api.isUndoRedoSupported()) {
19+
state.onDefinitionChanged.subscribe(api.onStateChanged.forward);
20+
}
21+
return api;
22+
}
23+
24+
private constructor(
825
private readonly state: DesignerState,
926
private readonly historyController: HistoryController | undefined,
1027
private readonly definitionModifier: DefinitionModifier,
1128
private readonly viewportApi: ViewportApi
1229
) {}
1330

31+
public readonly onStateChanged = new SimpleEvent<unknown>();
32+
1433
/**
1534
* @deprecated Don't use this method
1635
*/
1736
public subscribe(handler: () => void) {
18-
// TODO: this should be refactored
19-
20-
this.state.onIsReadonlyChanged.subscribe(handler);
21-
this.state.onSelectedStepIdChanged.subscribe(handler);
22-
this.state.onIsDragDisabledChanged.subscribe(handler);
23-
if (this.isUndoRedoSupported()) {
24-
this.state.onDefinitionChanged.subscribe(handler);
25-
}
37+
this.onStateChanged.subscribe(handler);
2638
}
2739

2840
public resetViewport() {

0 commit comments

Comments
 (0)