Skip to content

Commit 3c0a749

Browse files
committed
0.5.4.
1 parent d0e6758 commit 3c0a749

Some content is hidden

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

48 files changed

+18120
-4025
lines changed

.github/workflows/demos.sh

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
set -e
3+
4+
SCRIPT_DIR=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)
5+
6+
cd "$SCRIPT_DIR/../../demos/angular-app"
7+
yarn install
8+
yarn build
9+
yarn prettier
10+
11+
cd "$SCRIPT_DIR/../../demos/react-app"
12+
yarn install
13+
yarn build
14+
yarn eslint
15+
yarn prettier

.github/workflows/main.yml

+4-10
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,7 @@ jobs:
1919
uses: actions/setup-node@v2
2020
with:
2121
node-version: '16'
22-
- name: Install
23-
run: yarn install
24-
- name: Build
25-
run: yarn build
26-
- name: Test
27-
run: yarn test:single
28-
- name: Eslint
29-
run: yarn eslint
30-
- name: Prettier
31-
run: yarn prettier
22+
- name: Packages
23+
run: bash .github/workflows/packages.sh
24+
- name: Demos
25+
run: bash .github/workflows/demos.sh

.github/workflows/packages.sh

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
set -e
3+
4+
SCRIPT_DIR=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)
5+
6+
cd "$SCRIPT_DIR"
7+
yarn install
8+
yarn build
9+
yarn eslint
10+
yarn prettier

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.5.4
2+
3+
This version introduces the first release of the [Sequential Workflow Designer for Angular](./angular/designer/) package.
4+
15
## 0.5.3
26

37
* The disabled drag mode doesn't block the step selecting anymore.

README.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Features:
1414
* works on modern browsers,
1515
* works on mobile,
1616
* the definition is stored as JSON,
17-
* has support for [React](./react/).
17+
* has support for [React](./react/) and [Angular](./angular/designer/).
1818

1919
🤩 Don't miss [the pro version](https://github.com/nocode-js/sequential-workflow-designer-pro-demo).
2020

@@ -32,9 +32,9 @@ Features:
3232

3333
Pro:
3434

35-
* 🤩 [Pro Components](https://nocode-js.github.io/sequential-workflow-designer-pro-demo/examples/webpack/public/pro-components.html)
36-
* 👈 [Goto](https://nocode-js.github.io/sequential-workflow-designer-pro-demo/examples/webpack/public/goto.html)
37-
* 📁 [Folders](https://nocode-js.github.io/sequential-workflow-designer-pro-demo/examples/webpack/public/folders.html)
35+
* [🤩 Pro Components](https://nocode-js.github.io/sequential-workflow-designer-pro-demo/examples/webpack/public/pro-components.html)
36+
* [👈 Goto](https://nocode-js.github.io/sequential-workflow-designer-pro-demo/examples/webpack/public/goto.html)
37+
* [📁 Folders](https://nocode-js.github.io/sequential-workflow-designer-pro-demo/examples/webpack/public/folders.html)
3838

3939
## 🚀 Installation
4040

@@ -74,10 +74,10 @@ Add the below code to your head section in HTML document.
7474
```html
7575
<head>
7676
...
77-
<link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.5.3/css/designer.css" rel="stylesheet">
78-
<link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.5.3/css/designer-light.css" rel="stylesheet">
79-
<link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.5.3/css/designer-dark.css" rel="stylesheet">
80-
<script src="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.5.3/dist/index.umd.js"></script>
77+
<link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.5.4/css/designer.css" rel="stylesheet">
78+
<link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.5.4/css/designer-light.css" rel="stylesheet">
79+
<link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.5.4/css/designer-dark.css" rel="stylesheet">
80+
<script src="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.5.4/dist/index.umd.js"></script>
8181
```
8282

8383
Call the designer by:

angular/.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/.angular
2+
/.vscode
3+
/designer-dist

angular/angular.json

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3+
"version": 1,
4+
"newProjectRoot": "projects",
5+
"projects": {
6+
"designer-lib": {
7+
"projectType": "library",
8+
"root": "designer",
9+
"sourceRoot": "designer/src",
10+
"prefix": "sqd",
11+
"architect": {
12+
"build": {
13+
"builder": "@angular-devkit/build-angular:ng-packagr",
14+
"options": {
15+
"project": "designer/ng-package.json"
16+
},
17+
"configurations": {
18+
"production": {
19+
"tsConfig": "designer/tsconfig.lib.prod.json"
20+
},
21+
"development": {
22+
"tsConfig": "designer/tsconfig.lib.json"
23+
}
24+
},
25+
"defaultConfiguration": "production"
26+
},
27+
"test": {
28+
"builder": "@angular-devkit/build-angular:karma",
29+
"options": {
30+
"tsConfig": "designer/tsconfig.spec.json",
31+
"polyfills": [
32+
"zone.js",
33+
"zone.js/testing"
34+
]
35+
}
36+
}
37+
}
38+
}
39+
}
40+
}

angular/designer/README.md

+162
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
![Sequential Workflow Designer for Angular](https://raw.githubusercontent.com/nocode-js/sequential-workflow-designer/main/.github/cover.png)
2+
3+
# Sequential Workflow Designer for Angular
4+
5+
[![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fb4rtaz%2Fsequential-workflow-designer%2Fbadge%3Fref%3Dmain&style=flat-square)](https://actions-badge.atrox.dev/b4rtaz/sequential-workflow-designer/goto?ref=main) [![License: MIT](https://img.shields.io/github/license/mashape/apistatus.svg?style=flat-square)](/LICENSE) [![View this project on NPM](https://img.shields.io/npm/v/sequential-workflow-designer-angular.svg?style=flat-square)](https://npmjs.org/package/sequential-workflow-designer-angular)
6+
7+
Angular wrapper for the [Sequential Workflow Designer](https://github.com/nocode-js/sequential-workflow-designer) component.
8+
9+
## 🚀 Installation
10+
11+
Install the following packages by [NPM](https://www.npmjs.com/) command:
12+
13+
`npm i sequential-workflow-designer sequential-workflow-designer-angular`
14+
15+
Add CSS files to your `angular.json` file.
16+
17+
```json
18+
{
19+
"projects": {
20+
"YOUR_APP": {
21+
"architect": {
22+
"build": {
23+
"styles": [
24+
"./node_modules/sequential-workflow-designer/css/designer.css",
25+
"./node_modules/sequential-workflow-designer/css/designer-light.css",
26+
"./node_modules/sequential-workflow-designer/css/designer-dark.css"
27+
]
28+
}
29+
}
30+
}
31+
}
32+
}
33+
```
34+
35+
## 🎬 Usage
36+
37+
Import the module:
38+
39+
```ts
40+
import { SequentialWorkflowDesignerModule } from 'sequential-workflow-designer-angular';
41+
42+
@NgModule({
43+
imports: [
44+
SequentialWorkflowDesignerModule,
45+
// ...
46+
],
47+
// ...
48+
})
49+
export class AppModule {}
50+
```
51+
52+
Define a definition and a configuration.
53+
54+
```ts
55+
export class AppComponent {
56+
private designer?: Designer;
57+
public definition: Definition = { /* ... */ };
58+
public toolboxConfiguration: ToolboxConfiguration = { /* ... */ };
59+
public stepsConfiguration: StepsConfiguration = { /* ... */ };
60+
// ...
61+
}
62+
```
63+
64+
Define the following methods to handle the designer's events.
65+
66+
```ts
67+
export class AppComponent {
68+
//...
69+
public onDesignerReady(designer: Designer) {
70+
this.designer = designer;
71+
}
72+
73+
public onDefinitionChanged(definition: Definition) {
74+
this.definition = definition;
75+
}
76+
}
77+
```
78+
79+
Additionally we need to define a few utils methods to handle the editor's logic.
80+
81+
```ts
82+
export class AppComponent {
83+
// ...
84+
public updateName(step: Step, event: Event, context: StepEditorContext) {
85+
step.name = (event.target as HTMLInputElement).value;
86+
context.notifyNameChanged();
87+
}
88+
89+
public updateProperty(properties: Properties, name: string, event: Event, context: GlobalEditorContext | StepEditorContext) {
90+
properties[name] = (event.target as HTMLInputElement).value;
91+
context.notifyPropertiesChanged();
92+
}
93+
}
94+
```
95+
96+
Create a template for the global editor. The value of the `editor` variable implements the `GlobalEditorWrapper` interface.
97+
98+
```html
99+
<ng-template #globalEditor let-editor>
100+
<h2>Global Editor</h2>
101+
102+
<h3>Velocity</h3>
103+
<input type="number"
104+
[value]="editor.definition.properties.velocity"
105+
(input)="updateProperty(editor.definition.properties, 'velocity', $event, editor.context)" />
106+
</ng-template>
107+
```
108+
109+
```ts
110+
interface GlobalEditorWrapper {
111+
definition: Definition;
112+
context: GlobalEditorContext;
113+
}
114+
```
115+
116+
Create a template for the step editor. The value of the `editor` variable implements the `StepEditorWrapper` interface.
117+
118+
```html
119+
<ng-template #stepEditor let-editor>
120+
<h2>Step Editor</h2>
121+
122+
<h3>Name</h3>
123+
<input type="text"
124+
[value]="editor.step.name"
125+
(input)="updateName(editor.step, $event, editor.context)" />
126+
127+
<h3>Velocity</h3>
128+
<input type="number"
129+
[value]="editor.step.properties.velocity"
130+
(input)="updateProperty(editor.step.properties, 'velocity', $event, editor.context)" />
131+
</ng-template>
132+
```
133+
134+
```ts
135+
interface StepEditorWrapper {
136+
step: Step;
137+
context: StepEditorContext;
138+
}
139+
```
140+
141+
At the end attach the designer:
142+
143+
```html
144+
<sqd-designer
145+
theme="light"
146+
[undoStackSize]="10"
147+
[definition]="startDefinition"
148+
[toolboxConfiguration]="toolboxConfiguration"
149+
[stepsConfiguration]="stepsConfiguration"
150+
[areEditorsHidden]="false"
151+
[globalEditor]="globalEditor"
152+
[stepEditor]="stepEditor"
153+
(onReady)="onDesignerReady($event)"
154+
(onDefinitionChanged)="onDefinitionChanged($event)">
155+
</sqd-designer>
156+
```
157+
158+
Check the [demo project](https://github.com/nocode-js/sequential-workflow-designer/tree/main/demos/angular-app).
159+
160+
## 💡 License
161+
162+
This project is released under the MIT license.

angular/designer/ng-package.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
3+
"dest": "../designer-dist",
4+
"lib": {
5+
"entryFile": "src/public-api.ts"
6+
}
7+
}

angular/designer/package.json

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"name": "sequential-workflow-designer-angular",
3+
"description": "Angular wrapper for Sequential Workflow Designer component.",
4+
"version": "0.5.4",
5+
"author": "N4NO.com",
6+
"license": "MIT",
7+
"repository": {
8+
"type": "git",
9+
"url": "https://github.com/nocode-js/sequential-workflow-designer.git"
10+
},
11+
"peerDependencies": {
12+
"@angular/common": "^15.1.0",
13+
"@angular/core": "^15.1.0",
14+
"sequential-workflow-designer": "^0.5.4"
15+
},
16+
"dependencies": {
17+
"tslib": "^2.3.0"
18+
},
19+
"sideEffects": false,
20+
"keywords": [
21+
"workflow",
22+
"designer",
23+
"builder",
24+
"nocode",
25+
"lowcode",
26+
"flow",
27+
"angular",
28+
"angularjs"
29+
]
30+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<div #placeholder class="sqd-designer-angular"></div>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { TestBed } from '@angular/core/testing';
2+
import { DesignerComponent } from './designer.component';
3+
4+
describe('DesignerComponent', () => {
5+
beforeEach(async () => {
6+
await TestBed.configureTestingModule({
7+
declarations: [DesignerComponent]
8+
}).compileComponents();
9+
});
10+
11+
it('should create the app', () => {
12+
const fixture = TestBed.createComponent(DesignerComponent);
13+
const app = fixture.componentInstance;
14+
expect(app).toBeTruthy();
15+
});
16+
});

0 commit comments

Comments
 (0)