sequential-workflow-designer-react 0.10.2 → 0.12.0
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 +4 -1
- package/lib/cjs/index.cjs +11 -3
- package/lib/esm/index.js +11 -3
- package/lib/index.d.ts +6 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -28,7 +28,8 @@ Import types:
|
|
|
28
28
|
import {
|
|
29
29
|
Definition,
|
|
30
30
|
ToolboxConfiguration,
|
|
31
|
-
StepsConfiguration
|
|
31
|
+
StepsConfiguration,
|
|
32
|
+
ValidatorConfiguration
|
|
32
33
|
} from 'sequential-workflow-designer';
|
|
33
34
|
import {
|
|
34
35
|
SequentialWorkflowDesigner,
|
|
@@ -55,6 +56,7 @@ Configure the designer.
|
|
|
55
56
|
```ts
|
|
56
57
|
const toolboxConfiguration: ToolboxConfiguration = { /* ... */ };
|
|
57
58
|
const stepsConfiguration: StepsConfiguration = { /* ... */ };
|
|
59
|
+
const validatorConfiguration: ValidatorConfiguration = { /* ... */ };
|
|
58
60
|
```
|
|
59
61
|
|
|
60
62
|
Create the global editor component:
|
|
@@ -102,6 +104,7 @@ At the end attach the designer.
|
|
|
102
104
|
definition={definition}
|
|
103
105
|
onDefinitionChange={setDefinition}
|
|
104
106
|
stepsConfiguration={stepsConfiguration}
|
|
107
|
+
validatorConfiguration={validatorConfiguration}
|
|
105
108
|
toolboxConfiguration={toolboxConfiguration}
|
|
106
109
|
controlBar={true}
|
|
107
110
|
globalEditor={<GlobalEditor />}
|
package/lib/cjs/index.cjs
CHANGED
|
@@ -159,6 +159,7 @@ function SequentialWorkflowDesigner(props) {
|
|
|
159
159
|
var theme = props.theme;
|
|
160
160
|
var undoStackSize = props.undoStackSize;
|
|
161
161
|
var steps = props.stepsConfiguration;
|
|
162
|
+
var validator = props.validatorConfiguration;
|
|
162
163
|
var toolbox = props.toolboxConfiguration;
|
|
163
164
|
var controlBar = props.controlBar;
|
|
164
165
|
var extensions = props.extensions;
|
|
@@ -183,9 +184,9 @@ function SequentialWorkflowDesigner(props) {
|
|
|
183
184
|
}
|
|
184
185
|
return Presenter.render(externalEditorClassName, editorRootRef, jsxRuntime.jsx(StepEditorWrapperContext, __assign({ step: step, context: context }, { children: stepEditorRef.current })));
|
|
185
186
|
}
|
|
186
|
-
function customActionHandler(action, step) {
|
|
187
|
+
function customActionHandler(action, step, sequence, context) {
|
|
187
188
|
if (customActionHandlerRef.current) {
|
|
188
|
-
customActionHandlerRef.current(action, step);
|
|
189
|
+
customActionHandlerRef.current(action, step, sequence, context);
|
|
189
190
|
}
|
|
190
191
|
}
|
|
191
192
|
function tryDestroy() {
|
|
@@ -243,6 +244,7 @@ function SequentialWorkflowDesigner(props) {
|
|
|
243
244
|
undoStackSize: undoStackSize,
|
|
244
245
|
toolbox: toolbox,
|
|
245
246
|
steps: steps,
|
|
247
|
+
validator: validator,
|
|
246
248
|
controlBar: controlBar,
|
|
247
249
|
editors: globalEditorRef.current && stepEditorRef.current
|
|
248
250
|
? {
|
|
@@ -271,7 +273,7 @@ function SequentialWorkflowDesigner(props) {
|
|
|
271
273
|
}
|
|
272
274
|
});
|
|
273
275
|
designerRef.current = designer;
|
|
274
|
-
}, [placeholder, definition, selectedStepId, isReadonly, theme, undoStackSize, toolbox, controlBar, steps, extensions]);
|
|
276
|
+
}, [placeholder, definition, selectedStepId, isReadonly, theme, undoStackSize, toolbox, controlBar, steps, validator, extensions]);
|
|
275
277
|
react.useEffect(function () {
|
|
276
278
|
return tryDestroy;
|
|
277
279
|
}, []);
|
|
@@ -294,6 +296,12 @@ var SequentialWorkflowDesignerController = /** @class */ (function () {
|
|
|
294
296
|
this.updateBadges = function () {
|
|
295
297
|
_this.getDesigner().updateBadges();
|
|
296
298
|
};
|
|
299
|
+
/**
|
|
300
|
+
* @description Rerender the root component and all its children.
|
|
301
|
+
*/
|
|
302
|
+
this.updateRootComponent = function () {
|
|
303
|
+
_this.getDesigner().updateRootComponent();
|
|
304
|
+
};
|
|
297
305
|
// Nothing...
|
|
298
306
|
}
|
|
299
307
|
SequentialWorkflowDesignerController.create = function () {
|
package/lib/esm/index.js
CHANGED
|
@@ -157,6 +157,7 @@ function SequentialWorkflowDesigner(props) {
|
|
|
157
157
|
var theme = props.theme;
|
|
158
158
|
var undoStackSize = props.undoStackSize;
|
|
159
159
|
var steps = props.stepsConfiguration;
|
|
160
|
+
var validator = props.validatorConfiguration;
|
|
160
161
|
var toolbox = props.toolboxConfiguration;
|
|
161
162
|
var controlBar = props.controlBar;
|
|
162
163
|
var extensions = props.extensions;
|
|
@@ -181,9 +182,9 @@ function SequentialWorkflowDesigner(props) {
|
|
|
181
182
|
}
|
|
182
183
|
return Presenter.render(externalEditorClassName, editorRootRef, jsx(StepEditorWrapperContext, __assign({ step: step, context: context }, { children: stepEditorRef.current })));
|
|
183
184
|
}
|
|
184
|
-
function customActionHandler(action, step) {
|
|
185
|
+
function customActionHandler(action, step, sequence, context) {
|
|
185
186
|
if (customActionHandlerRef.current) {
|
|
186
|
-
customActionHandlerRef.current(action, step);
|
|
187
|
+
customActionHandlerRef.current(action, step, sequence, context);
|
|
187
188
|
}
|
|
188
189
|
}
|
|
189
190
|
function tryDestroy() {
|
|
@@ -241,6 +242,7 @@ function SequentialWorkflowDesigner(props) {
|
|
|
241
242
|
undoStackSize: undoStackSize,
|
|
242
243
|
toolbox: toolbox,
|
|
243
244
|
steps: steps,
|
|
245
|
+
validator: validator,
|
|
244
246
|
controlBar: controlBar,
|
|
245
247
|
editors: globalEditorRef.current && stepEditorRef.current
|
|
246
248
|
? {
|
|
@@ -269,7 +271,7 @@ function SequentialWorkflowDesigner(props) {
|
|
|
269
271
|
}
|
|
270
272
|
});
|
|
271
273
|
designerRef.current = designer;
|
|
272
|
-
}, [placeholder, definition, selectedStepId, isReadonly, theme, undoStackSize, toolbox, controlBar, steps, extensions]);
|
|
274
|
+
}, [placeholder, definition, selectedStepId, isReadonly, theme, undoStackSize, toolbox, controlBar, steps, validator, extensions]);
|
|
273
275
|
useEffect(function () {
|
|
274
276
|
return tryDestroy;
|
|
275
277
|
}, []);
|
|
@@ -292,6 +294,12 @@ var SequentialWorkflowDesignerController = /** @class */ (function () {
|
|
|
292
294
|
this.updateBadges = function () {
|
|
293
295
|
_this.getDesigner().updateBadges();
|
|
294
296
|
};
|
|
297
|
+
/**
|
|
298
|
+
* @description Rerender the root component and all its children.
|
|
299
|
+
*/
|
|
300
|
+
this.updateRootComponent = function () {
|
|
301
|
+
_this.getDesigner().updateRootComponent();
|
|
302
|
+
};
|
|
295
303
|
// Nothing...
|
|
296
304
|
}
|
|
297
305
|
SequentialWorkflowDesignerController.create = function () {
|
package/lib/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { MutableRefObject, Context, DependencyList } from 'react';
|
|
3
3
|
import ReactDOM from 'react-dom/client';
|
|
4
|
-
import { Definition, GlobalEditorContext, Designer, StepsConfiguration, ToolboxConfiguration, CustomActionHandler, DesignerExtension, Step, StepEditorContext } from 'sequential-workflow-designer';
|
|
4
|
+
import { Definition, GlobalEditorContext, Designer, StepsConfiguration, ValidatorConfiguration, ToolboxConfiguration, CustomActionHandler, DesignerExtension, Step, StepEditorContext } from 'sequential-workflow-designer';
|
|
5
5
|
|
|
6
6
|
declare class Presenter {
|
|
7
7
|
static render(className: string, rootRef: MutableRefObject<ReactDOM.Root | null>, element: JSX.Element): HTMLElement;
|
|
@@ -42,6 +42,10 @@ declare class SequentialWorkflowDesignerController {
|
|
|
42
42
|
* @description Updates all badges.
|
|
43
43
|
*/
|
|
44
44
|
readonly updateBadges: () => void;
|
|
45
|
+
/**
|
|
46
|
+
* @description Rerender the root component and all its children.
|
|
47
|
+
*/
|
|
48
|
+
readonly updateRootComponent: () => void;
|
|
45
49
|
/**
|
|
46
50
|
* @returns `true` if the controller is ready to be used, `false` otherwise.
|
|
47
51
|
*/
|
|
@@ -62,6 +66,7 @@ interface SequentialWorkflowDesignerProps<TDefinition extends Definition> {
|
|
|
62
66
|
theme?: string;
|
|
63
67
|
undoStackSize?: number;
|
|
64
68
|
stepsConfiguration: StepsConfiguration;
|
|
69
|
+
validatorConfiguration?: ValidatorConfiguration;
|
|
65
70
|
toolboxConfiguration: false | ToolboxConfiguration;
|
|
66
71
|
/**
|
|
67
72
|
* @description If true, the control bar will be displayed.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sequential-workflow-designer-react",
|
|
3
3
|
"description": "React wrapper for Sequential Workflow Designer component.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.12.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/esm/index.js",
|
|
7
7
|
"types": "./lib/index.d.ts",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"react": "^18.2.0",
|
|
49
49
|
"react-dom": "^18.2.0",
|
|
50
|
-
"sequential-workflow-designer": "^0.
|
|
50
|
+
"sequential-workflow-designer": "^0.12.0"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@rollup/plugin-node-resolve": "^15.0.1",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"prettier": "^2.8.2",
|
|
64
64
|
"react": "^18.2.0",
|
|
65
65
|
"react-dom": "^18.2.0",
|
|
66
|
-
"sequential-workflow-designer": "^0.
|
|
66
|
+
"sequential-workflow-designer": "^0.12.0",
|
|
67
67
|
"rollup": "^3.18.0",
|
|
68
68
|
"rollup-plugin-dts": "^5.2.0",
|
|
69
69
|
"rollup-plugin-typescript2": "^0.34.1",
|