sequential-workflow-designer-svelte 0.16.6 → 0.16.8
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
|
@@ -79,17 +79,17 @@ The global editor:
|
|
|
79
79
|
|
|
80
80
|
```svelte
|
|
81
81
|
<script lang="ts">
|
|
82
|
-
|
|
82
|
+
import type { RootEditorContext, Definition } from 'sequential-workflow-designer';
|
|
83
83
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
export let context: RootEditorContext;
|
|
85
|
+
export let definition: Definition;
|
|
86
|
+
let velocity = definition.properties.velocity;
|
|
87
87
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
88
|
+
function onVelocityChanged(event: Event) {
|
|
89
|
+
velocity = parseInt((event.target as HTMLInputElement).value);
|
|
90
|
+
definition.properties.velocity = velocity;
|
|
91
|
+
context.notifyPropertiesChanged();
|
|
92
|
+
}
|
|
93
93
|
</script>
|
|
94
94
|
|
|
95
95
|
<input type="number" value={String(velocity)} on:input={onVelocityChanged} />
|
|
@@ -99,19 +99,19 @@ The step editor:
|
|
|
99
99
|
|
|
100
100
|
```svelte
|
|
101
101
|
<script lang="ts">
|
|
102
|
-
|
|
102
|
+
import type { StepEditorContext, Definition, Step } from 'sequential-workflow-designer';
|
|
103
103
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
104
|
+
export let context: StepEditorContext;
|
|
105
|
+
export let definition: Definition;
|
|
106
|
+
export let step: Step;
|
|
107
107
|
|
|
108
|
-
|
|
108
|
+
let name = step.name;
|
|
109
109
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
110
|
+
function onNameChanged(event: Event) {
|
|
111
|
+
name = (event.target as HTMLInputElement).value;
|
|
112
|
+
step.name = name;
|
|
113
|
+
context.notifyNameChanged();
|
|
114
|
+
}
|
|
115
115
|
</script>
|
|
116
116
|
|
|
117
117
|
<input value={name} on:input={onNameChanged} />
|
|
@@ -17,8 +17,11 @@ export let validator = void 0;
|
|
|
17
17
|
export let uidGenerator = void 0;
|
|
18
18
|
export let definitionWalker = void 0;
|
|
19
19
|
export let extensions = void 0;
|
|
20
|
+
export let customActionHandler = void 0;
|
|
20
21
|
export let stepEditor = null;
|
|
22
|
+
export let nativeStepEditor = null;
|
|
21
23
|
export let rootEditor = null;
|
|
24
|
+
export let nativeRootEditor = null;
|
|
22
25
|
export let isEditorCollapsed = false;
|
|
23
26
|
export let isReadonly = false;
|
|
24
27
|
export let selectedStepId = null;
|
|
@@ -26,29 +29,35 @@ let isFirstChange = true;
|
|
|
26
29
|
let designer = null;
|
|
27
30
|
let placeholder;
|
|
28
31
|
function init() {
|
|
29
|
-
const editors = stepEditor && rootEditor ? {
|
|
32
|
+
const editors = (stepEditor || nativeStepEditor) && (rootEditor || nativeRootEditor) ? {
|
|
30
33
|
isCollapsed: isEditorCollapsed,
|
|
31
34
|
stepEditorProvider: (step, context, def) => {
|
|
32
|
-
if (
|
|
33
|
-
|
|
35
|
+
if (stepEditor) {
|
|
36
|
+
const root = document.createElement("div");
|
|
37
|
+
new stepEditor({
|
|
38
|
+
target: root,
|
|
39
|
+
props: { step, context, definition: def }
|
|
40
|
+
});
|
|
41
|
+
return root;
|
|
34
42
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
});
|
|
40
|
-
return root;
|
|
43
|
+
if (nativeStepEditor) {
|
|
44
|
+
return nativeStepEditor(step, context, def);
|
|
45
|
+
}
|
|
46
|
+
throw new Error("No step editor provided");
|
|
41
47
|
},
|
|
42
48
|
globalEditorProvider: (def, context) => {
|
|
43
|
-
if (
|
|
44
|
-
|
|
49
|
+
if (rootEditor) {
|
|
50
|
+
const root = document.createElement("div");
|
|
51
|
+
new rootEditor({
|
|
52
|
+
target: root,
|
|
53
|
+
props: { definition: def, context }
|
|
54
|
+
});
|
|
55
|
+
return root;
|
|
56
|
+
}
|
|
57
|
+
if (nativeRootEditor) {
|
|
58
|
+
return nativeRootEditor(def, context);
|
|
45
59
|
}
|
|
46
|
-
|
|
47
|
-
new rootEditor({
|
|
48
|
-
target: root,
|
|
49
|
-
props: { definition: def, context }
|
|
50
|
-
});
|
|
51
|
-
return root;
|
|
60
|
+
throw new Error("No root editor provided");
|
|
52
61
|
}
|
|
53
62
|
} : false;
|
|
54
63
|
const _toolbox = toolbox ? {
|
|
@@ -65,20 +74,27 @@ function init() {
|
|
|
65
74
|
undoStackSize,
|
|
66
75
|
undoStack,
|
|
67
76
|
validator,
|
|
68
|
-
uidGenerator,
|
|
69
77
|
definitionWalker,
|
|
70
78
|
extensions,
|
|
71
|
-
isReadonly
|
|
79
|
+
isReadonly,
|
|
80
|
+
uidGenerator,
|
|
81
|
+
customActionHandler
|
|
72
82
|
});
|
|
73
|
-
d.onReady.subscribe(
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
83
|
+
d.onReady.subscribe(
|
|
84
|
+
() => dispatch("definitionChanged", {
|
|
85
|
+
definition: d.getDefinition(),
|
|
86
|
+
isValid: d.isValid()
|
|
87
|
+
})
|
|
88
|
+
);
|
|
89
|
+
d.onDefinitionChanged.subscribe(
|
|
90
|
+
(definition2) => dispatch("definitionChanged", {
|
|
91
|
+
definition: definition2,
|
|
92
|
+
isValid: d.isValid()
|
|
93
|
+
})
|
|
94
|
+
);
|
|
81
95
|
d.onSelectedStepIdChanged.subscribe((stepId) => dispatch("selectedStepIdChanged", { stepId }));
|
|
96
|
+
d.onIsToolboxCollapsedChanged.subscribe((isCollapsed) => dispatch("isToolboxCollapsedChanged", { isCollapsed }));
|
|
97
|
+
d.onIsEditorCollapsedChanged.subscribe((isCollapsed) => dispatch("isEditorCollapsedChanged", { isCollapsed }));
|
|
82
98
|
if (selectedStepId) {
|
|
83
99
|
d.selectStepById(selectedStepId);
|
|
84
100
|
}
|
|
@@ -122,4 +138,4 @@ onDestroy(() => {
|
|
|
122
138
|
});
|
|
123
139
|
</script>
|
|
124
140
|
|
|
125
|
-
<div bind:this={placeholder} class="sqd-designer-svelte"
|
|
141
|
+
<div bind:this={placeholder} class="sqd-designer-svelte" />
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
|
-
import { DefinitionWalker, type Definition, type StepsConfiguration, type ToolboxConfiguration, type UndoStack, type ValidatorConfiguration, type UidGenerator, type DesignerExtension } from 'sequential-workflow-designer';
|
|
2
|
+
import { DefinitionWalker, type Definition, type StepsConfiguration, type ToolboxConfiguration, type UndoStack, type ValidatorConfiguration, type UidGenerator, type DesignerExtension, type CustomActionHandler, type StepEditorProvider, type RootEditorProvider } from 'sequential-workflow-designer';
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
5
|
definition: Definition;
|
|
@@ -15,15 +15,37 @@ declare const __propDef: {
|
|
|
15
15
|
uidGenerator?: UidGenerator | undefined;
|
|
16
16
|
definitionWalker?: DefinitionWalker | undefined;
|
|
17
17
|
extensions?: DesignerExtension[] | undefined;
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
customActionHandler?: CustomActionHandler | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* @description Svelte component that will be used to render the step editor. If this property is set, the `nativeStepEditor` property will be ignored.
|
|
21
|
+
*/ stepEditor?: ConstructorOfATypedSvelteComponent | null | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* @description Function that will be used to render the step editor.
|
|
24
|
+
*/ nativeStepEditor?: StepEditorProvider | null | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* @description Svelte component that will be used to render the root editor. If this property is set, the `nativeRootEditor` property will be ignored.
|
|
27
|
+
*/ rootEditor?: ConstructorOfATypedSvelteComponent | null | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* @description Function that will be used to render the root editor.
|
|
30
|
+
*/ nativeRootEditor?: RootEditorProvider | null | undefined;
|
|
20
31
|
isEditorCollapsed?: boolean | undefined;
|
|
21
32
|
isReadonly?: boolean | undefined;
|
|
22
33
|
selectedStepId?: string | null | undefined;
|
|
23
34
|
};
|
|
24
35
|
events: {
|
|
25
|
-
definitionChanged: CustomEvent<
|
|
26
|
-
|
|
36
|
+
definitionChanged: CustomEvent<{
|
|
37
|
+
definition: Definition;
|
|
38
|
+
isValid: boolean;
|
|
39
|
+
}>;
|
|
40
|
+
selectedStepIdChanged: CustomEvent<{
|
|
41
|
+
stepId: string | null;
|
|
42
|
+
}>;
|
|
43
|
+
isToolboxCollapsedChanged: CustomEvent<{
|
|
44
|
+
isCollapsed: boolean;
|
|
45
|
+
}>;
|
|
46
|
+
isEditorCollapsedChanged: CustomEvent<{
|
|
47
|
+
isCollapsed: boolean;
|
|
48
|
+
}>;
|
|
27
49
|
} & {
|
|
28
50
|
[evt: string]: CustomEvent<any>;
|
|
29
51
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sequential-workflow-designer-svelte",
|
|
3
3
|
"description": "Svelte wrapper for Sequential Workflow Designer component.",
|
|
4
|
-
"version": "0.16.
|
|
4
|
+
"version": "0.16.8",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"prepare": "cp ../LICENSE LICENSE",
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
|
12
12
|
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
|
13
13
|
"test:single": "echo \"No tests yet\"",
|
|
14
|
-
"prettier": "prettier --check ./src",
|
|
15
|
-
"prettier:fix": "prettier --write ./src",
|
|
14
|
+
"prettier": "prettier --plugin prettier-plugin-svelte --check ./src",
|
|
15
|
+
"prettier:fix": "prettier --plugin prettier-plugin-svelte --write ./src",
|
|
16
16
|
"eslint": "eslint ./src --ext .ts"
|
|
17
17
|
},
|
|
18
18
|
"exports": {
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
],
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"svelte": "^4.0.0",
|
|
31
|
-
"sequential-workflow-designer": "^0.16.
|
|
31
|
+
"sequential-workflow-designer": "^0.16.8"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"sequential-workflow-designer": "^0.16.
|
|
34
|
+
"sequential-workflow-designer": "^0.16.8",
|
|
35
35
|
"@sveltejs/adapter-static": "^2.0.3",
|
|
36
36
|
"@sveltejs/kit": "^1.20.4",
|
|
37
37
|
"@sveltejs/package": "^2.0.0",
|
|
@@ -41,11 +41,22 @@
|
|
|
41
41
|
"typescript": "^5.0.0",
|
|
42
42
|
"vite": "^4.4.2",
|
|
43
43
|
"prettier": "^2.8.2",
|
|
44
|
+
"prettier-plugin-svelte": "^2.8.0",
|
|
44
45
|
"@typescript-eslint/eslint-plugin": "^5.47.0",
|
|
45
46
|
"@typescript-eslint/parser": "^5.47.0",
|
|
46
47
|
"eslint": "^8.30.0"
|
|
47
48
|
},
|
|
48
49
|
"svelte": "./dist/index.js",
|
|
49
50
|
"types": "./dist/index.d.ts",
|
|
50
|
-
"type": "module"
|
|
51
|
-
|
|
51
|
+
"type": "module",
|
|
52
|
+
"keywords": [
|
|
53
|
+
"workflow",
|
|
54
|
+
"designer",
|
|
55
|
+
"builder",
|
|
56
|
+
"nocode",
|
|
57
|
+
"lowcode",
|
|
58
|
+
"flow",
|
|
59
|
+
"svelte",
|
|
60
|
+
"sveltejs"
|
|
61
|
+
]
|
|
62
|
+
}
|