@optimajet/workflow-designer 5.2.0 → 5.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,217 +1,229 @@
1
- # WorkflowEngine Designer
2
-
3
- ## Introduction
4
-
5
- WorkflowEngine Designer is a library developed to facilitate the use of this component. It provides a convenient way to interact and create the Workflow Designer on your web page.
6
-
7
- ## Prerequisites
8
-
9
- To run the example below, you should create the WorkflowEngine backend capable of handling requests from the Workflow Designer.
10
-
11
- ## Installation
12
-
13
- ```shell
14
- npm install @optimajet/workflow-designer
15
- ```
16
-
17
- ## Basic Usage
18
-
19
- ```javascript
20
- import WorkflowDesigner from '@optimajet/workflow-designer'
21
- //import '@optimajet/workflow-designer/localization/workflowdesigner.localization_ru'
22
-
23
- const data = {
24
- schemecode: "<YOUR_SCHEME_CODE_VALUE>",
25
- processid: undefined
26
- };
27
-
28
- var wfdesigner = new WorkflowDesigner({
29
- apiurl: '<YOUR_API_URL_VALUE>',
30
- renderTo: 'root',
31
- graphwidth: window.innerWidth,
32
- graphheight: window.innerHeight,
33
- });
34
-
35
- if (wfdesigner.exists(data)) {
36
- wfdesigner.load(data);
37
- } else {
38
- wfdesigner.create();
39
- }
40
- ```
41
-
42
- This code snippet is everything you need to initially display the Workflow Designer on your web page. Let's analyze it in more detail:
43
-
44
- ```javascript
45
- import WorkflowDesigner from '@optimajet/workflow-designer'
46
- //import '@optimajet/workflow-designer/localization/workflowdesigner.localization_ru'
47
- ```
48
-
49
- This section is responsible for importing the `WorkflowDesigner` constructor. By uncommenting line 2, you can localize the workflow designer. By default, the workflow designer has the English localization.
50
-
51
- ```javascript
52
- const data = {
53
- schemecode: "<YOUR_SCHEME_CODE_VALUE>",
54
- processid: undefined
55
- };
56
-
57
- var wfdesigner = new WorkflowDesigner({
58
- apiurl: '<YOUR_API_URL_VALUE>',
59
- renderTo: 'root',
60
- graphwidth: window.innerWidth,
61
- graphheight: window.innerHeight,
62
- });
63
- ```
64
-
65
- In this section:
66
-
67
- - `schemecode` - is the code for the Workflow diagram to be displayed in the Workflow Designer.
68
- - `processid` - is the identifier of the WorkflowEngine process.
69
-
70
- - the `WorkflowDesigner` constructor takes an object with the designer settings and creates a new instance of the WorkflowDesigner class. The example specifies all the necessary parameters of the designer, namely: the HTTP address of the WorkflowAPI for interacting with the back-end of the application (`apiurl`), the available width (` graphwidth`) and height (`graphheight`) for displaying the WorkflowDesigner window, and the element ID, inside which the entire WorkflowDesigner interface is rendered (`renderTo`). For a more detailed list of the parameters, see the **Designer** section of the documentation page about the WorkflowEngine.
71
-
72
-
73
- If you want to display the Workflow scheme in the Workflow Designer interface, set the required value to the `schemeсode` variable, and assign the `undefined` value to the `processid`. In case you want to display the Workflow process, set the `undefined` value to the `schemecode`, and the required value to the `processid` variable of the WorkflowEngine process identifier.
74
-
75
- ```javascript
76
- if (wfdesigner.exists(data)) {
77
- wfdesigner.load(data);
78
- } else {
79
- wfdesigner.create();
80
- }
81
- ```
82
-
83
- This section checks whether the above data exist and available for loading and displaying in the WorkflowDesigner. If the specified data exist, then they are loaded and rendered. Otherwise, a new empty Workflow diagram will be created.
84
-
85
- ## Building and Running the Example
86
-
87
- We use the webpack package to build our example.
88
-
89
- ```shell
90
- npm i -D webpack webpack-cli
91
- ```
92
-
93
- Next, add the packages necessary for the correct webpack setup
94
-
95
- ```shell
96
- npm i -D @babel/preset-env @babel/core babel-loader css-loader html-webpack-plugin mini-css-extract-plugin uglifyjs-webpack-plugin
97
- ```
98
-
99
- The basic webpack configuration looks like this:
100
-
101
- ```js
102
- const HtmlWebpackPlugin = require('html-webpack-plugin'); // for generate an HTML5 file
103
- const path = require('path')
104
- const MiniCssExtractPlugin = require("mini-css-extract-plugin"); // to extract CSS into separate files
105
- const UglifyJsPlugin = require('uglifyjs-webpack-plugin'); // to minify your JavaScript
106
- const webpack = require('webpack');
107
-
108
-
109
- module.exports = () => ({
110
- entry: {
111
- wfesample: './src/index.js',
112
- },
113
- output: {
114
- path: path.resolve(__dirname, 'dist'),
115
- filename: '[name].min.js',
116
- libraryTarget: "umd",
117
- },
118
- mode:'production',
119
-
120
- optimization: {
121
- minimizer: [new UglifyJsPlugin()],
122
- },
123
- module: {
124
- rules: [
125
- {
126
- test: /\.css$/i,
127
- use: [MiniCssExtractPlugin.loader, "css-loader"],
128
- },
129
- {
130
- test: /\.m?js$/,
131
- exclude: /(node_modules|bower_components)/,
132
- use: {
133
- loader: 'babel-loader',
134
- options: {
135
- presets: ['@babel/preset-env']
136
- },
137
- },
138
- },
139
- ],
140
- },
141
- plugins: [
142
- new HtmlWebpackPlugin({ template: './src/index.html' }),
143
- new MiniCssExtractPlugin(),
144
- new webpack.ContextReplacementPlugin(/moment[/\\]locale$/, /en/),
145
- ]
146
- });
147
- ```
148
-
149
- ## IE11 Support
150
-
151
- To support successful performance of the designer in IE11, we should slightly modify the webpack configuration in `webpack.config.js`, but first we should add another package to transpile and modify our JavaScript.
152
-
153
- ```shell
154
- npm i -D @babel/plugin-proposal-decorators
155
- ```
156
-
157
- Now, add the `target: ['web', 'es5']` property in the webpack config, and change the `babel-loader` rule in`module.rules` to the following:
158
-
159
- ```js
160
- //...
161
- rules: [
162
- //...
163
- {
164
- test: /\.(js|jsx)$/,
165
- exclude: /@babel(?:\/|\\{1,2})runtime|core-js/,
166
- use: {
167
- loader: 'babel-loader',
168
- options: {
169
- babelrc: false,
170
- configFile: path.resolve(__dirname, 'babel.config.js'),
171
- compact: false,
172
- cacheDirectory: true,
173
- sourceMaps: false,
174
- },
175
- },
176
- },
177
- ],
178
- //...
179
- ```
180
-
181
- The only thing left to do is to create the `babel.config.js` file in the project root. The file should contain the following babel configuration:
182
-
183
- ```js
184
- module.exports = function (api) {
185
- api.cache(true);
186
- const presets = [
187
- [
188
- '@babel/preset-env',
189
- {
190
- corejs:"3",
191
- useBuiltIns: 'entry',
192
- targets: {
193
- browsers: [
194
- "edge >= 16",
195
- "safari >= 9",
196
- "firefox >= 57",
197
- "ie >= 11",
198
- "ios >= 9",
199
- "chrome >= 49"
200
- ]
201
- }
202
- }
203
- ]
204
- ];
205
- const plugins= [
206
- ["@babel/plugin-proposal-decorators", { decoratorsBeforeExport: true }],
207
- ["@babel/plugin-proposal-class-properties", { "loose": true }],
208
- ["@babel/plugin-transform-spread"]
209
- ];
210
- return {
211
- presets,
212
- plugins
213
- }
214
- }
215
- ```
216
-
217
- The configuration is completed successfully, so you can enjoy using the WorkflowDesigner in IE11.
1
+ # WorkflowEngine Designer
2
+
3
+ ## Introduction
4
+
5
+ WorkflowEngine Designer is a library developed to facilitate the use of this component. It provides a convenient way to interact and create the Workflow Designer on your web page.
6
+
7
+ ## Prerequisites
8
+
9
+ To run the example below, you should create the WorkflowEngine backend capable of handling requests from the Workflow Designer.
10
+
11
+ ## Installation
12
+
13
+ ```shell
14
+ npm install @optimajet/workflow-designer
15
+ ```
16
+
17
+ ## Basic Usage
18
+
19
+ ```javascript
20
+ import WorkflowDesigner from '@optimajet/workflow-designer'
21
+ //import '@optimajet/workflow-designer/localization/workflowdesigner.localization_ru'
22
+
23
+ const data = {
24
+ schemecode: "<YOUR_SCHEME_CODE_VALUE>",
25
+ processid: undefined
26
+ };
27
+
28
+ var wfdesigner = new WorkflowDesigner({
29
+ apiurl: '<YOUR_API_URL_VALUE>',
30
+ renderTo: 'root',
31
+ graphwidth: window.innerWidth,
32
+ graphheight: window.innerHeight,
33
+ });
34
+
35
+ if (wfdesigner.exists(data)) {
36
+ wfdesigner.load(data);
37
+ } else {
38
+ wfdesigner.create();
39
+ }
40
+ ```
41
+
42
+ This code snippet is everything you need to initially display the Workflow Designer on your web page. Let's analyze it in more detail:
43
+
44
+ ```javascript
45
+ import WorkflowDesigner from '@optimajet/workflow-designer'
46
+ //import '@optimajet/workflow-designer/localization/workflowdesigner.localization_ru'
47
+ ```
48
+
49
+ This section is responsible for importing the `WorkflowDesigner` constructor. By uncommenting line 2, you can localize the workflow designer. By default, the workflow designer has the English localization.
50
+
51
+ ```javascript
52
+ const data = {
53
+ schemecode: "<YOUR_SCHEME_CODE_VALUE>",
54
+ processid: undefined
55
+ };
56
+
57
+ var wfdesigner = new WorkflowDesigner({
58
+ apiurl: '<YOUR_API_URL_VALUE>',
59
+ renderTo: 'root',
60
+ graphwidth: window.innerWidth,
61
+ graphheight: window.innerHeight,
62
+ });
63
+ ```
64
+
65
+ In this section:
66
+
67
+ - `schemecode` - is the code for the Workflow diagram to be displayed in the Workflow Designer.
68
+ - `processid` - is the identifier of the WorkflowEngine process.
69
+
70
+ - the `WorkflowDesigner` constructor takes an object with the designer settings and creates a new instance of the WorkflowDesigner class. The example specifies all the necessary parameters of the designer, namely: the HTTP address of the WorkflowAPI for interacting with the back-end of the application (`apiurl`), the available width (` graphwidth`) and height (`graphheight`) for displaying the WorkflowDesigner window, and the element ID, inside which the entire WorkflowDesigner interface is rendered (`renderTo`). For a more detailed list of the parameters, see the **Designer** section of the documentation page about the WorkflowEngine.
71
+
72
+
73
+ If you want to display the Workflow scheme in the Workflow Designer interface, set the required value to the `schemeсode` variable, and assign the `undefined` value to the `processid`. In case you want to display the Workflow process, set the `undefined` value to the `schemecode`, and the required value to the `processid` variable of the WorkflowEngine process identifier.
74
+
75
+ ```javascript
76
+ if (wfdesigner.exists(data)) {
77
+ wfdesigner.load(data);
78
+ } else {
79
+ wfdesigner.create();
80
+ }
81
+ ```
82
+
83
+ This section checks whether the above data exist and available for loading and displaying in the WorkflowDesigner. If the specified data exist, then they are loaded and rendered. Otherwise, a new empty Workflow diagram will be created.
84
+
85
+ ## Building and Running the Example
86
+
87
+ We use the webpack package to build our example.
88
+
89
+ ```shell
90
+ npm i -D webpack webpack-cli
91
+ ```
92
+
93
+ Next, add the packages necessary for the correct webpack setup
94
+
95
+ ```shell
96
+ npm i -D @babel/preset-env @babel/core babel-loader css-loader html-webpack-plugin mini-css-extract-plugin uglifyjs-webpack-plugin
97
+ ```
98
+
99
+ The basic webpack configuration looks like this:
100
+
101
+ ```js
102
+ const HtmlWebpackPlugin = require('html-webpack-plugin'); // for generate an HTML5 file
103
+ const path = require('path')
104
+ const MiniCssExtractPlugin = require("mini-css-extract-plugin"); // to extract CSS into separate files
105
+ const UglifyJsPlugin = require('uglifyjs-webpack-plugin'); // to minify your JavaScript
106
+ const webpack = require('webpack');
107
+
108
+
109
+ module.exports = () => ({
110
+ entry: {
111
+ wfesample: './src/index.js',
112
+ },
113
+ output: {
114
+ path: path.resolve(__dirname, 'dist'),
115
+ filename: '[name].min.js',
116
+ libraryTarget: "umd",
117
+ },
118
+ mode:'production',
119
+
120
+ optimization: {
121
+ minimizer: [new UglifyJsPlugin()],
122
+ },
123
+ module: {
124
+ rules: [
125
+ {
126
+ test: /\.css$/i,
127
+ use: [MiniCssExtractPlugin.loader, "css-loader"],
128
+ },
129
+ {
130
+ test: /\.m?js$/,
131
+ exclude: /(node_modules|bower_components)/,
132
+ use: {
133
+ loader: 'babel-loader',
134
+ options: {
135
+ presets: ['@babel/preset-env']
136
+ },
137
+ },
138
+ },
139
+ ],
140
+ },
141
+ plugins: [
142
+ new HtmlWebpackPlugin({ template: './src/index.html' }),
143
+ new MiniCssExtractPlugin(),
144
+ new webpack.ContextReplacementPlugin(/moment[/\\]locale$/, /en/),
145
+ ]
146
+ });
147
+ ```
148
+
149
+ ## IE11 Support
150
+
151
+ To support successful performance of the designer in IE11, we should slightly modify the webpack configuration in `webpack.config.js`, but first we should add another package to transpile and modify our JavaScript.
152
+
153
+ ```shell
154
+ npm i -D @babel/plugin-proposal-decorators
155
+ ```
156
+
157
+ Now, add the `target: ['web', 'es5']` property in the webpack config, and change the `babel-loader` rule in`module.rules` to the following:
158
+
159
+ ```js
160
+ //...
161
+ rules: [
162
+ //...
163
+ {
164
+ test: /\.(js|jsx)$/,
165
+ exclude: /@babel(?:\/|\\{1,2})runtime|core-js/,
166
+ use: {
167
+ loader: 'babel-loader',
168
+ options: {
169
+ babelrc: false,
170
+ configFile: path.resolve(__dirname, 'babel.config.js'),
171
+ compact: false,
172
+ cacheDirectory: true,
173
+ sourceMaps: false,
174
+ },
175
+ },
176
+ },
177
+ ],
178
+ //...
179
+ ```
180
+
181
+ The only thing left to do is to create the `babel.config.js` file in the project root. The file should contain the following babel configuration:
182
+
183
+ ```js
184
+ module.exports = function (api) {
185
+ api.cache(true);
186
+ const presets = [
187
+ [
188
+ '@babel/preset-env',
189
+ {
190
+ corejs:"3",
191
+ useBuiltIns: 'entry',
192
+ targets: {
193
+ browsers: [
194
+ "edge >= 16",
195
+ "safari >= 9",
196
+ "firefox >= 57",
197
+ "ie >= 11",
198
+ "ios >= 9",
199
+ "chrome >= 49"
200
+ ]
201
+ }
202
+ }
203
+ ]
204
+ ];
205
+ const plugins= [
206
+ ["@babel/plugin-proposal-decorators", { decoratorsBeforeExport: true }],
207
+ ["@babel/plugin-proposal-class-properties", { "loose": true }],
208
+ ["@babel/plugin-transform-spread"]
209
+ ];
210
+ return {
211
+ presets,
212
+ plugins
213
+ }
214
+ }
215
+ ```
216
+
217
+ The configuration is completed successfully, so you can enjoy using the WorkflowDesigner in IE11.
218
+
219
+ ## Hotkeys:
220
+ Ctrl + A - Select All
221
+ Ctrl + C - Copy selected items
222
+ Ctrl + E - New Activity
223
+ Ctrl + I - Extended info
224
+ Ctrl + Y - Redo
225
+ Ctrl + Z - Undo
226
+ Arrows - Moving selected items
227
+ Delete - Delete
228
+ Alt + Enter - Full Screen Mode
229
+ Ctrl + M - Move mode