@eclipse-glsp-examples/workflow-glsp 0.9.0-next.d9bed812 → 0.9.0-next.e99d24cc
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/LICENSE +642 -277
- package/README.md +1 -2
- package/css/diagram.css +58 -38
- package/lib/di.config.d.ts +4 -19
- package/lib/di.config.d.ts.map +1 -1
- package/lib/di.config.js +21 -25
- package/lib/di.config.js.map +1 -1
- package/lib/direct-task-editing/di.config.d.ts +1 -1
- package/lib/direct-task-editing/di.config.js +4 -4
- package/lib/direct-task-editing/di.config.js.map +1 -1
- package/lib/direct-task-editing/direct-task-editor.d.ts +4 -4
- package/lib/direct-task-editing/direct-task-editor.d.ts.map +1 -1
- package/lib/direct-task-editing/direct-task-editor.js +88 -184
- package/lib/direct-task-editing/direct-task-editor.js.map +1 -1
- package/lib/index.d.ts +5 -5
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/model.d.ts +8 -3
- package/lib/model.d.ts.map +1 -1
- package/lib/model.js +73 -68
- package/lib/model.js.map +1 -1
- package/lib/workflow-views.d.ts +5 -15
- package/lib/workflow-views.d.ts.map +1 -1
- package/lib/workflow-views.js +31 -108
- package/lib/workflow-views.js.map +1 -1
- package/package.json +22 -25
- package/scripts/download.ts +19 -16
- package/src/di.config.ts +29 -78
- package/src/direct-task-editing/di.config.ts +3 -3
- package/src/direct-task-editing/direct-task-editor.ts +28 -22
- package/src/index.ts +5 -6
- package/src/model.ts +46 -10
- package/src/workflow-views.tsx +31 -76
package/src/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2019 EclipseSource and others.
|
|
2
|
+
* Copyright (c) 2019-2021 EclipseSource and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -13,10 +13,9 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
-
import createWorkflowDiagramContainer from
|
|
16
|
+
import createWorkflowDiagramContainer from './di.config';
|
|
17
17
|
|
|
18
|
-
export * from
|
|
19
|
-
export * from
|
|
20
|
-
export * from
|
|
18
|
+
export * from './model';
|
|
19
|
+
export * from './workflow-views';
|
|
20
|
+
export * from './direct-task-editing/direct-task-editor';
|
|
21
21
|
export { createWorkflowDiagramContainer };
|
|
22
|
-
|
package/src/model.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2020 EclipseSource and others.
|
|
2
|
+
* Copyright (c) 2020-2021 EclipseSource and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
connectableFeature,
|
|
19
19
|
deletableFeature,
|
|
20
20
|
DiamondNode,
|
|
21
|
+
EditableLabel,
|
|
21
22
|
fadeFeature,
|
|
22
23
|
hoverFeedbackFeature,
|
|
23
24
|
isEditableLabel,
|
|
@@ -29,24 +30,35 @@ import {
|
|
|
29
30
|
nameFeature,
|
|
30
31
|
popupFeature,
|
|
31
32
|
RectangularNode,
|
|
33
|
+
SChildElement,
|
|
32
34
|
SEdge,
|
|
33
35
|
selectFeature,
|
|
34
36
|
SModelElement,
|
|
35
37
|
SShapeElement,
|
|
36
38
|
WithEditableLabel,
|
|
37
39
|
withEditLabelFeature
|
|
38
|
-
} from
|
|
39
|
-
|
|
40
|
+
} from '@eclipse-glsp/client';
|
|
40
41
|
|
|
41
42
|
export class TaskNode extends RectangularNode implements Nameable, WithEditableLabel {
|
|
42
|
-
static readonly DEFAULT_FEATURES = [
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
static readonly DEFAULT_FEATURES = [
|
|
44
|
+
connectableFeature,
|
|
45
|
+
deletableFeature,
|
|
46
|
+
selectFeature,
|
|
47
|
+
boundsFeature,
|
|
48
|
+
moveFeature,
|
|
49
|
+
layoutContainerFeature,
|
|
50
|
+
fadeFeature,
|
|
51
|
+
hoverFeedbackFeature,
|
|
52
|
+
popupFeature,
|
|
53
|
+
nameFeature,
|
|
54
|
+
withEditLabelFeature
|
|
55
|
+
];
|
|
56
|
+
name = '';
|
|
45
57
|
duration?: number;
|
|
46
58
|
taskType?: string;
|
|
47
59
|
reference?: string;
|
|
48
60
|
|
|
49
|
-
get editableLabel() {
|
|
61
|
+
get editableLabel(): (SChildElement & EditableLabel) | undefined {
|
|
50
62
|
const headerComp = this.children.find(element => element.type === 'comp:header');
|
|
51
63
|
if (headerComp) {
|
|
52
64
|
const label = headerComp.children.find(element => element.type === 'label:heading');
|
|
@@ -66,7 +78,6 @@ export class WeightedEdge extends SEdge {
|
|
|
66
78
|
probability?: string;
|
|
67
79
|
}
|
|
68
80
|
|
|
69
|
-
|
|
70
81
|
export class ActivityNode extends DiamondNode {
|
|
71
82
|
nodeType: string = ActivityNode.Type.UNDEFINED;
|
|
72
83
|
size = {
|
|
@@ -84,7 +95,7 @@ export namespace ActivityNode {
|
|
|
84
95
|
export const MERGE = 'mergeNode';
|
|
85
96
|
export const JOIN = 'joinNode';
|
|
86
97
|
export const FORK = 'forkNode';
|
|
87
|
-
export const UNDEFINED =
|
|
98
|
+
export const UNDEFINED = 'undefined';
|
|
88
99
|
}
|
|
89
100
|
}
|
|
90
101
|
|
|
@@ -92,9 +103,34 @@ export class Icon extends SShapeElement implements LayoutContainer {
|
|
|
92
103
|
static readonly DEFAULT_FEATURES = [boundsFeature, layoutContainerFeature, layoutableChildFeature, fadeFeature];
|
|
93
104
|
|
|
94
105
|
layout: string;
|
|
95
|
-
layoutOptions?: { [key: string]: string | number | boolean
|
|
106
|
+
layoutOptions?: { [key: string]: string | number | boolean };
|
|
96
107
|
size = {
|
|
97
108
|
width: 32,
|
|
98
109
|
height: 32
|
|
99
110
|
};
|
|
100
111
|
}
|
|
112
|
+
|
|
113
|
+
export class CategoryNode extends RectangularNode implements Nameable, WithEditableLabel {
|
|
114
|
+
static readonly DEFAULT_FEATURES = [
|
|
115
|
+
deletableFeature,
|
|
116
|
+
selectFeature,
|
|
117
|
+
boundsFeature,
|
|
118
|
+
moveFeature,
|
|
119
|
+
layoutContainerFeature,
|
|
120
|
+
fadeFeature,
|
|
121
|
+
hoverFeedbackFeature,
|
|
122
|
+
popupFeature,
|
|
123
|
+
nameFeature,
|
|
124
|
+
withEditLabelFeature
|
|
125
|
+
];
|
|
126
|
+
|
|
127
|
+
name = '';
|
|
128
|
+
|
|
129
|
+
get editableLabel(): (SChildElement & EditableLabel) | undefined {
|
|
130
|
+
const label = this.children.find(element => element.type === 'label:heading');
|
|
131
|
+
if (label && isEditableLabel(label)) {
|
|
132
|
+
return label;
|
|
133
|
+
}
|
|
134
|
+
return undefined;
|
|
135
|
+
}
|
|
136
|
+
}
|
package/src/workflow-views.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2019 EclipseSource and others.
|
|
2
|
+
* Copyright (c) 2019-2021 EclipseSource and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -17,84 +17,37 @@ import {
|
|
|
17
17
|
angleOfPoint,
|
|
18
18
|
IView,
|
|
19
19
|
Point,
|
|
20
|
-
|
|
21
|
-
RectangularNodeView,
|
|
20
|
+
PolylineEdgeViewWithGapsOnIntersections,
|
|
22
21
|
RenderingContext,
|
|
23
22
|
SEdge,
|
|
24
|
-
SShapeElement,
|
|
25
23
|
toDegrees
|
|
26
|
-
} from
|
|
27
|
-
import { injectable } from
|
|
28
|
-
import
|
|
29
|
-
import {
|
|
24
|
+
} from '@eclipse-glsp/client';
|
|
25
|
+
import { injectable } from 'inversify';
|
|
26
|
+
import { VNode } from 'snabbdom';
|
|
27
|
+
import { svg } from 'sprotty';
|
|
28
|
+
import { Icon } from './model';
|
|
30
29
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const JSX = { createElement: snabbdom.svg };
|
|
34
|
-
|
|
35
|
-
@injectable()
|
|
36
|
-
export class TaskNodeView extends RectangularNodeView {
|
|
37
|
-
render(node: TaskNode, context: RenderingContext): VNode {
|
|
38
|
-
const rcr = this.getRoundedCornerRadius(node);
|
|
39
|
-
const graph = <g>
|
|
40
|
-
<rect class-sprotty-node={true} class-task={true}
|
|
41
|
-
class-automated={node.taskType === 'automated'}
|
|
42
|
-
class-manual={node.taskType === 'manual'}
|
|
43
|
-
class-mouseover={node.hoverFeedback} class-selected={node.selected}
|
|
44
|
-
x={0} y={0} rx={rcr} ry={rcr}
|
|
45
|
-
width={Math.max(0, node.bounds.width)} height={Math.max(0, node.bounds.height)}></rect>
|
|
46
|
-
{context.renderChildren(node)}
|
|
47
|
-
</g>;
|
|
48
|
-
return graph;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
protected getRoundedCornerRadius(node: SShapeElement): number {
|
|
52
|
-
return 5;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
@injectable()
|
|
57
|
-
export class ForkOrJoinNodeView extends RectangularNodeView {
|
|
58
|
-
render(node: ActivityNode, context: RenderingContext): VNode {
|
|
59
|
-
const graph = <g>
|
|
60
|
-
<rect class-sprotty-node={true} class-forkOrJoin={true}
|
|
61
|
-
class-mouseover={node.hoverFeedback} class-selected={node.selected}
|
|
62
|
-
width={10} height={Math.max(50, node.bounds.height)}></rect>
|
|
63
|
-
</g>;
|
|
64
|
-
return graph;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
30
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
31
|
+
const JSX = { createElement: svg };
|
|
67
32
|
|
|
68
33
|
@injectable()
|
|
69
|
-
export class WorkflowEdgeView extends
|
|
34
|
+
export class WorkflowEdgeView extends PolylineEdgeViewWithGapsOnIntersections {
|
|
70
35
|
protected renderAdditionals(edge: SEdge, segments: Point[], context: RenderingContext): VNode[] {
|
|
36
|
+
const additionals = super.renderAdditionals(edge, segments, context);
|
|
71
37
|
const p1 = segments[segments.length - 2];
|
|
72
38
|
const p2 = segments[segments.length - 1];
|
|
73
|
-
|
|
74
|
-
<path
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
if (route.length === 0)
|
|
86
|
-
return this.renderDanglingEdge("Cannot compute route", edge, context);
|
|
87
|
-
|
|
88
|
-
return <g class-sprotty-edge={true}
|
|
89
|
-
class-weighted={true}
|
|
90
|
-
class-low={edge.probability === 'low'}
|
|
91
|
-
class-medium={edge.probability === 'medium'}
|
|
92
|
-
class-high={edge.probability === 'high'}
|
|
93
|
-
class-mouseover={edge.hoverFeedback}>
|
|
94
|
-
{this.renderLine(edge, route, context)}
|
|
95
|
-
{this.renderAdditionals(edge, route, context)}
|
|
96
|
-
{context.renderChildren(edge, { route })}
|
|
97
|
-
</g>;
|
|
39
|
+
const arrow = (
|
|
40
|
+
<path
|
|
41
|
+
class-sprotty-edge={true}
|
|
42
|
+
class-arrow={true}
|
|
43
|
+
d='M 1.5,0 L 10,-4 L 10,4 Z'
|
|
44
|
+
transform={`rotate(${toDegrees(angleOfPoint({ x: p1.x - p2.x, y: p1.y - p2.y }))} ${p2.x} ${p2.y}) translate(${p2.x} ${
|
|
45
|
+
p2.y
|
|
46
|
+
})`}
|
|
47
|
+
/>
|
|
48
|
+
);
|
|
49
|
+
additionals.push(arrow);
|
|
50
|
+
return additionals;
|
|
98
51
|
}
|
|
99
52
|
}
|
|
100
53
|
|
|
@@ -102,13 +55,15 @@ export class WeightedEdgeView extends WorkflowEdgeView {
|
|
|
102
55
|
export class IconView implements IView {
|
|
103
56
|
render(element: Icon, context: RenderingContext): VNode {
|
|
104
57
|
const radius = this.getRadius();
|
|
105
|
-
return
|
|
106
|
-
<
|
|
107
|
-
|
|
108
|
-
|
|
58
|
+
return (
|
|
59
|
+
<g>
|
|
60
|
+
<circle class-sprotty-icon={true} r={radius} cx={radius + 2} cy={radius + 2}></circle>
|
|
61
|
+
{context.renderChildren(element)}
|
|
62
|
+
</g>
|
|
63
|
+
);
|
|
109
64
|
}
|
|
110
65
|
|
|
111
|
-
getRadius() {
|
|
112
|
-
return
|
|
66
|
+
getRadius(): number {
|
|
67
|
+
return 14;
|
|
113
68
|
}
|
|
114
69
|
}
|