sequential-workflow-designer-react 0.13.4 → 0.13.6
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 +2 -2
- package/lib/cjs/index.cjs +5 -3
- package/lib/esm/index.js +5 -3
- package/lib/index.d.ts +16 -11
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -63,7 +63,7 @@ Create the global editor component:
|
|
|
63
63
|
|
|
64
64
|
```tsx
|
|
65
65
|
function GlobalEditor() {
|
|
66
|
-
const { properties, setProperty } = useGlobalEditor();
|
|
66
|
+
const { properties, setProperty, definition } = useGlobalEditor();
|
|
67
67
|
|
|
68
68
|
function onSpeedChanged(e) {
|
|
69
69
|
setProperty('speed', e.target.value);
|
|
@@ -82,7 +82,7 @@ Create the step editor component:
|
|
|
82
82
|
|
|
83
83
|
```tsx
|
|
84
84
|
function StepEditor() {
|
|
85
|
-
const { type, componentType, name, setName, properties, setProperty } = useStepEditor();
|
|
85
|
+
const { type, componentType, name, setName, properties, setProperty, definition } = useStepEditor();
|
|
86
86
|
|
|
87
87
|
function onNameChanged(e) {
|
|
88
88
|
setName(e.target.value);
|
package/lib/cjs/index.cjs
CHANGED
|
@@ -68,6 +68,7 @@ function GlobalEditorWrapperContext(props) {
|
|
|
68
68
|
function createWrapper() {
|
|
69
69
|
return {
|
|
70
70
|
properties: props.definition.properties,
|
|
71
|
+
definition: props.definition,
|
|
71
72
|
setProperty: setProperty
|
|
72
73
|
};
|
|
73
74
|
}
|
|
@@ -103,6 +104,7 @@ function StepEditorWrapperContext(props) {
|
|
|
103
104
|
name: props.step.name,
|
|
104
105
|
properties: props.step.properties,
|
|
105
106
|
step: props.step,
|
|
107
|
+
definition: props.definition,
|
|
106
108
|
setName: setName,
|
|
107
109
|
setProperty: setProperty,
|
|
108
110
|
notifyPropertiesChanged: notifyPropertiesChanged,
|
|
@@ -185,14 +187,14 @@ function SequentialWorkflowDesigner(props) {
|
|
|
185
187
|
}
|
|
186
188
|
return globalEditorRef.current(def, context);
|
|
187
189
|
}
|
|
188
|
-
function stepEditorProvider(step, context) {
|
|
190
|
+
function stepEditorProvider(step, context, def) {
|
|
189
191
|
if (!stepEditorRef.current) {
|
|
190
192
|
throw new Error('Step editor is not provided');
|
|
191
193
|
}
|
|
192
194
|
if (react.isValidElement(stepEditorRef.current)) {
|
|
193
|
-
return Presenter.render(externalEditorClassName, editorRootRef, jsxRuntime.jsx(StepEditorWrapperContext, __assign({ step: step, context: context }, { children: stepEditorRef.current })));
|
|
195
|
+
return Presenter.render(externalEditorClassName, editorRootRef, jsxRuntime.jsx(StepEditorWrapperContext, __assign({ step: step, definition: def, context: context }, { children: stepEditorRef.current })));
|
|
194
196
|
}
|
|
195
|
-
return stepEditorRef.current(step, context);
|
|
197
|
+
return stepEditorRef.current(step, context, def);
|
|
196
198
|
}
|
|
197
199
|
function customActionHandler(action, step, sequence, context) {
|
|
198
200
|
if (customActionHandlerRef.current) {
|
package/lib/esm/index.js
CHANGED
|
@@ -66,6 +66,7 @@ function GlobalEditorWrapperContext(props) {
|
|
|
66
66
|
function createWrapper() {
|
|
67
67
|
return {
|
|
68
68
|
properties: props.definition.properties,
|
|
69
|
+
definition: props.definition,
|
|
69
70
|
setProperty: setProperty
|
|
70
71
|
};
|
|
71
72
|
}
|
|
@@ -101,6 +102,7 @@ function StepEditorWrapperContext(props) {
|
|
|
101
102
|
name: props.step.name,
|
|
102
103
|
properties: props.step.properties,
|
|
103
104
|
step: props.step,
|
|
105
|
+
definition: props.definition,
|
|
104
106
|
setName: setName,
|
|
105
107
|
setProperty: setProperty,
|
|
106
108
|
notifyPropertiesChanged: notifyPropertiesChanged,
|
|
@@ -183,14 +185,14 @@ function SequentialWorkflowDesigner(props) {
|
|
|
183
185
|
}
|
|
184
186
|
return globalEditorRef.current(def, context);
|
|
185
187
|
}
|
|
186
|
-
function stepEditorProvider(step, context) {
|
|
188
|
+
function stepEditorProvider(step, context, def) {
|
|
187
189
|
if (!stepEditorRef.current) {
|
|
188
190
|
throw new Error('Step editor is not provided');
|
|
189
191
|
}
|
|
190
192
|
if (isValidElement(stepEditorRef.current)) {
|
|
191
|
-
return Presenter.render(externalEditorClassName, editorRootRef, jsx(StepEditorWrapperContext, __assign({ step: step, context: context }, { children: stepEditorRef.current })));
|
|
193
|
+
return Presenter.render(externalEditorClassName, editorRootRef, jsx(StepEditorWrapperContext, __assign({ step: step, definition: def, context: context }, { children: stepEditorRef.current })));
|
|
192
194
|
}
|
|
193
|
-
return stepEditorRef.current(step, context);
|
|
195
|
+
return stepEditorRef.current(step, context, def);
|
|
194
196
|
}
|
|
195
197
|
function customActionHandler(action, step, sequence, context) {
|
|
196
198
|
if (customActionHandlerRef.current) {
|
package/lib/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { MutableRefObject, Context, DependencyList } from 'react';
|
|
2
|
+
import { MutableRefObject, Context, ReactNode, DependencyList } from 'react';
|
|
3
3
|
import ReactDOM from 'react-dom/client';
|
|
4
4
|
import { Definition, GlobalEditorContext, Designer, ToolboxConfiguration, GlobalEditorProvider, StepEditorProvider, StepsConfiguration, ValidatorConfiguration, CustomActionHandler, DesignerExtension, Step, StepEditorContext } from 'sequential-workflow-designer';
|
|
5
5
|
|
|
@@ -15,14 +15,16 @@ declare global {
|
|
|
15
15
|
}
|
|
16
16
|
interface GlobalEditorWrapper<TDefinition extends Definition> {
|
|
17
17
|
readonly properties: TDefinition['properties'];
|
|
18
|
+
readonly definition: TDefinition;
|
|
18
19
|
setProperty(name: keyof TDefinition['properties'], value: TDefinition['properties'][typeof name]): void;
|
|
19
20
|
}
|
|
20
21
|
declare function useGlobalEditor<TDefinition extends Definition = Definition>(): GlobalEditorWrapper<TDefinition>;
|
|
21
|
-
|
|
22
|
-
children:
|
|
22
|
+
interface GlobalEditorWrapperContextProps {
|
|
23
|
+
children: ReactNode;
|
|
23
24
|
definition: Definition;
|
|
24
25
|
context: GlobalEditorContext;
|
|
25
|
-
}
|
|
26
|
+
}
|
|
27
|
+
declare function GlobalEditorWrapperContext(props: GlobalEditorWrapperContextProps): JSX.Element;
|
|
26
28
|
|
|
27
29
|
interface WrappedDefinition<TDefinition extends Definition = Definition> {
|
|
28
30
|
readonly value: TDefinition;
|
|
@@ -85,26 +87,29 @@ declare function SequentialWorkflowDesigner<TDefinition extends Definition>(prop
|
|
|
85
87
|
|
|
86
88
|
declare global {
|
|
87
89
|
interface Window {
|
|
88
|
-
sqdStepEditorContext?: Context<StepEditorWrapper
|
|
90
|
+
sqdStepEditorContext?: Context<StepEditorWrapper | null>;
|
|
89
91
|
}
|
|
90
92
|
}
|
|
91
|
-
interface StepEditorWrapper<TStep extends Step> {
|
|
93
|
+
interface StepEditorWrapper<TStep extends Step = Step, TDefinition extends Definition = Definition> {
|
|
92
94
|
readonly id: string;
|
|
93
95
|
readonly type: TStep['type'];
|
|
94
96
|
readonly componentType: TStep['componentType'];
|
|
95
97
|
readonly name: string;
|
|
96
98
|
readonly properties: TStep['properties'];
|
|
97
99
|
readonly step: TStep;
|
|
100
|
+
readonly definition: TDefinition;
|
|
98
101
|
setName(name: string): void;
|
|
99
102
|
setProperty(name: keyof TStep['properties'], value: TStep['properties'][typeof name]): void;
|
|
100
103
|
notifyPropertiesChanged(): void;
|
|
101
104
|
notifyChildrenChanged(): void;
|
|
102
105
|
}
|
|
103
|
-
declare function useStepEditor<TStep extends Step = Step>(): StepEditorWrapper<TStep>;
|
|
104
|
-
|
|
105
|
-
children:
|
|
106
|
+
declare function useStepEditor<TStep extends Step = Step, TDefinition extends Definition = Definition>(): StepEditorWrapper<TStep, TDefinition>;
|
|
107
|
+
interface StepEditorWrapperContextProps {
|
|
108
|
+
children: ReactNode;
|
|
106
109
|
step: Step;
|
|
110
|
+
definition: Definition;
|
|
107
111
|
context: StepEditorContext;
|
|
108
|
-
}
|
|
112
|
+
}
|
|
113
|
+
declare function StepEditorWrapperContext(props: StepEditorWrapperContextProps): JSX.Element;
|
|
109
114
|
|
|
110
|
-
export { GlobalEditorWrapper, GlobalEditorWrapperContext, Presenter, ReactToolboxConfiguration, SequentialWorkflowDesigner, SequentialWorkflowDesignerController, SequentialWorkflowDesignerProps, StepEditorWrapper, StepEditorWrapperContext, WrappedDefinition, useGlobalEditor, useSequentialWorkflowDesignerController, useStepEditor, wrapDefinition };
|
|
115
|
+
export { GlobalEditorWrapper, GlobalEditorWrapperContext, GlobalEditorWrapperContextProps, Presenter, ReactToolboxConfiguration, SequentialWorkflowDesigner, SequentialWorkflowDesignerController, SequentialWorkflowDesignerProps, StepEditorWrapper, StepEditorWrapperContext, StepEditorWrapperContextProps, WrappedDefinition, useGlobalEditor, useSequentialWorkflowDesignerController, useStepEditor, wrapDefinition };
|
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.13.
|
|
4
|
+
"version": "0.13.6",
|
|
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.13.
|
|
50
|
+
"sequential-workflow-designer": "^0.13.6"
|
|
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.13.
|
|
66
|
+
"sequential-workflow-designer": "^0.13.6",
|
|
67
67
|
"rollup": "^3.18.0",
|
|
68
68
|
"rollup-plugin-dts": "^5.2.0",
|
|
69
69
|
"rollup-plugin-typescript2": "^0.34.1",
|