@eclipse-glsp-examples/workflow-glsp 0.10.0-next.ca17587.154 → 1.1.0-RC01
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/css/diagram.css +35 -145
- package/lib/di.config.d.ts.map +1 -1
- package/lib/di.config.js +19 -18
- package/lib/di.config.js.map +1 -1
- package/lib/direct-task-editing/di.config.d.ts +0 -15
- package/lib/direct-task-editing/di.config.d.ts.map +1 -1
- package/lib/direct-task-editing/di.config.js +3 -3
- package/lib/direct-task-editing/di.config.js.map +1 -1
- package/lib/direct-task-editing/direct-task-editor.d.ts +24 -8
- package/lib/direct-task-editing/direct-task-editor.d.ts.map +1 -1
- package/lib/direct-task-editing/direct-task-editor.js +28 -26
- package/lib/direct-task-editing/direct-task-editor.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/model.d.ts +2 -2
- package/lib/model.d.ts.map +1 -1
- package/lib/model.js +10 -12
- package/lib/model.js.map +1 -1
- package/lib/workflow-views.d.ts +4 -5
- package/lib/workflow-views.d.ts.map +1 -1
- package/lib/workflow-views.js +35 -13
- package/lib/workflow-views.js.map +1 -1
- package/package.json +7 -8
- package/scripts/config.json +9 -0
- package/scripts/download.ts +9 -8
- package/src/di.config.ts +3 -1
- package/src/direct-task-editing/di.config.ts +2 -3
- package/src/direct-task-editing/direct-task-editor.ts +53 -22
- package/src/model.ts +15 -14
- package/src/workflow-views.tsx +43 -14
package/lib/model.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CategoryNode = exports.Icon = exports.ActivityNode = exports.WeightedEdge = exports.isTaskNode = exports.TaskNode = void 0;
|
|
4
4
|
/********************************************************************************
|
|
5
|
-
* Copyright (c) 2020-
|
|
5
|
+
* Copyright (c) 2020-2022 EclipseSource and others.
|
|
6
6
|
*
|
|
7
7
|
* This program and the accompanying materials are made available under the
|
|
8
8
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -18,20 +18,18 @@ exports.CategoryNode = exports.Icon = exports.ActivityNode = exports.WeightedEdg
|
|
|
18
18
|
********************************************************************************/
|
|
19
19
|
const client_1 = require("@eclipse-glsp/client");
|
|
20
20
|
class TaskNode extends client_1.RectangularNode {
|
|
21
|
-
constructor() {
|
|
22
|
-
super(...arguments);
|
|
23
|
-
this.name = '';
|
|
24
|
-
}
|
|
25
21
|
get editableLabel() {
|
|
26
|
-
const
|
|
27
|
-
if (
|
|
28
|
-
|
|
29
|
-
if (label && client_1.isEditableLabel(label)) {
|
|
30
|
-
return label;
|
|
31
|
-
}
|
|
22
|
+
const label = this.children.find(element => element.type === 'label:heading');
|
|
23
|
+
if (label && (0, client_1.isEditableLabel)(label)) {
|
|
24
|
+
return label;
|
|
32
25
|
}
|
|
33
26
|
return undefined;
|
|
34
27
|
}
|
|
28
|
+
get name() {
|
|
29
|
+
var _a;
|
|
30
|
+
const labelText = (_a = this.editableLabel) === null || _a === void 0 ? void 0 : _a.text;
|
|
31
|
+
return labelText ? labelText : '<unknown>';
|
|
32
|
+
}
|
|
35
33
|
}
|
|
36
34
|
exports.TaskNode = TaskNode;
|
|
37
35
|
TaskNode.DEFAULT_FEATURES = [
|
|
@@ -96,7 +94,7 @@ class CategoryNode extends client_1.RectangularNode {
|
|
|
96
94
|
}
|
|
97
95
|
get editableLabel() {
|
|
98
96
|
const label = this.children.find(element => element.type === 'label:heading');
|
|
99
|
-
if (label && client_1.isEditableLabel(label)) {
|
|
97
|
+
if (label && (0, client_1.isEditableLabel)(label)) {
|
|
100
98
|
return label;
|
|
101
99
|
}
|
|
102
100
|
return undefined;
|
package/lib/model.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,iDAwB8B;AAE9B,MAAa,QAAS,SAAQ,wBAAe;
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,iDAwB8B;AAE9B,MAAa,QAAS,SAAQ,wBAAe;IAkBzC,IAAI,aAAa;QACb,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,eAAe,CAAC,CAAC;QAC9E,IAAI,KAAK,IAAI,IAAA,wBAAe,EAAC,KAAK,CAAC,EAAE;YACjC,OAAO,KAAK,CAAC;SAChB;QACD,OAAO,SAAS,CAAC;IACrB,CAAC;IAED,IAAI,IAAI;;QACJ,MAAM,SAAS,GAAG,MAAA,IAAI,CAAC,aAAa,0CAAE,IAAI,CAAC;QAC3C,OAAO,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC;IAC/C,CAAC;;AA7BL,4BA8BC;AA7B4B,yBAAgB,GAAG;IACxC,2BAAkB;IAClB,yBAAgB;IAChB,sBAAa;IACb,sBAAa;IACb,oBAAW;IACX,+BAAsB;IACtB,oBAAW;IACX,6BAAoB;IACpB,qBAAY;IACZ,oBAAW;IACX,6BAAoB;CACvB,CAAC;AAmBN,SAAgB,UAAU,CAAC,OAAsB;IAC7C,OAAO,OAAO,YAAY,QAAQ,IAAI,KAAK,CAAC;AAChD,CAAC;AAFD,gCAEC;AAED,MAAa,YAAa,SAAQ,cAAK;CAEtC;AAFD,oCAEC;AAED,MAAa,YAAa,SAAQ,oBAAW;IAA7C;;QACI,aAAQ,GAAW,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC;QACtC,SAAI,GAAG;YACZ,KAAK,EAAE,EAAE;YACT,MAAM,EAAE,EAAE;SACb,CAAC;QACO,gBAAW,GAAG,CAAC,CAAC;IAC7B,CAAC;CAAA;AAPD,oCAOC;AAED,WAAiB,YAAY;IACzB,IAAiB,IAAI,CAQpB;IARD,WAAiB,IAAI;QACJ,YAAO,GAAG,YAAY,CAAC;QACvB,UAAK,GAAG,WAAW,CAAC;QACpB,aAAQ,GAAG,cAAc,CAAC;QAC1B,UAAK,GAAG,WAAW,CAAC;QACpB,SAAI,GAAG,UAAU,CAAC;QAClB,SAAI,GAAG,UAAU,CAAC;QAClB,cAAS,GAAG,WAAW,CAAC;IACzC,CAAC,EARgB,IAAI,GAAJ,iBAAI,KAAJ,iBAAI,QAQpB;AACL,CAAC,EAVgB,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAU5B;AAED,MAAa,IAAK,SAAQ,sBAAa;IAAvC;;QAKa,SAAI,GAAG;YACZ,KAAK,EAAE,EAAE;YACT,MAAM,EAAE,EAAE;SACb,CAAC;IACN,CAAC;;AATD,oBASC;AARmB,qBAAgB,GAAG,CAAC,sBAAa,EAAE,+BAAsB,EAAE,+BAAsB,EAAE,oBAAW,CAAC,CAAC;AAUpH,MAAa,YAAa,SAAQ,wBAAe;IAAjD;;QAcI,SAAI,GAAG,EAAE,CAAC;IASd,CAAC;IAPG,IAAI,aAAa;QACb,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,eAAe,CAAC,CAAC;QAC9E,IAAI,KAAK,IAAI,IAAA,wBAAe,EAAC,KAAK,CAAC,EAAE;YACjC,OAAO,KAAK,CAAC;SAChB;QACD,OAAO,SAAS,CAAC;IACrB,CAAC;;AAtBL,oCAuBC;AAtB4B,6BAAgB,GAAG;IACxC,yBAAgB;IAChB,sBAAa;IACb,sBAAa;IACb,oBAAW;IACX,+BAAsB;IACtB,oBAAW;IACX,6BAAoB;IACpB,qBAAY;IACZ,oBAAW;IACX,6BAAoB;CACvB,CAAC"}
|
package/lib/workflow-views.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2019-
|
|
2
|
+
* Copyright (c) 2019-2022 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,14 +13,13 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
-
import {
|
|
16
|
+
import { Point, PolylineEdgeViewWithGapsOnIntersections, RenderingContext, SEdge, ShapeView } from '@eclipse-glsp/client';
|
|
17
17
|
import { VNode } from 'snabbdom';
|
|
18
18
|
import { Icon } from './model';
|
|
19
19
|
export declare class WorkflowEdgeView extends PolylineEdgeViewWithGapsOnIntersections {
|
|
20
20
|
protected renderAdditionals(edge: SEdge, segments: Point[], context: RenderingContext): VNode[];
|
|
21
21
|
}
|
|
22
|
-
export declare class IconView
|
|
23
|
-
render(element: Icon, context: RenderingContext): VNode;
|
|
24
|
-
getRadius(): number;
|
|
22
|
+
export declare class IconView extends ShapeView {
|
|
23
|
+
render(element: Icon, context: RenderingContext): VNode | undefined;
|
|
25
24
|
}
|
|
26
25
|
//# sourceMappingURL=workflow-views.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-views.d.ts","sourceRoot":"","sources":["../src/workflow-views.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,
|
|
1
|
+
{"version":3,"file":"workflow-views.d.ts","sourceRoot":"","sources":["../src/workflow-views.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAIH,KAAK,EACL,uCAAuC,EACvC,gBAAgB,EAChB,KAAK,EAEL,SAAS,EAGZ,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,IAAI,EAAc,MAAM,SAAS,CAAC;AAK3C,qBACa,gBAAiB,SAAQ,uCAAuC;cACtD,iBAAiB,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,gBAAgB,GAAG,KAAK,EAAE;CAiB3G;AAED,qBACa,QAAS,SAAQ,SAAS;IACnC,MAAM,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,gBAAgB,GAAG,KAAK,GAAG,SAAS;CAuCtE"}
|
package/lib/workflow-views.js
CHANGED
|
@@ -8,7 +8,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.IconView = exports.WorkflowEdgeView = void 0;
|
|
10
10
|
/********************************************************************************
|
|
11
|
-
* Copyright (c) 2019-
|
|
11
|
+
* Copyright (c) 2019-2022 EclipseSource and others.
|
|
12
12
|
*
|
|
13
13
|
* This program and the accompanying materials are made available under the
|
|
14
14
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -24,36 +24,58 @@ exports.IconView = exports.WorkflowEdgeView = void 0;
|
|
|
24
24
|
********************************************************************************/
|
|
25
25
|
const client_1 = require("@eclipse-glsp/client");
|
|
26
26
|
const inversify_1 = require("inversify");
|
|
27
|
-
const
|
|
27
|
+
const model_1 = require("./model");
|
|
28
28
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
29
|
-
const JSX = { createElement:
|
|
29
|
+
const JSX = { createElement: client_1.svg };
|
|
30
30
|
let WorkflowEdgeView = class WorkflowEdgeView extends client_1.PolylineEdgeViewWithGapsOnIntersections {
|
|
31
31
|
renderAdditionals(edge, segments, context) {
|
|
32
32
|
const additionals = super.renderAdditionals(edge, segments, context);
|
|
33
33
|
const p1 = segments[segments.length - 2];
|
|
34
34
|
const p2 = segments[segments.length - 1];
|
|
35
|
-
const arrow = (JSX.createElement("path", { "class-sprotty-edge": true, "class-arrow": true, d: 'M 1
|
|
35
|
+
const arrow = (JSX.createElement("path", { "class-sprotty-edge": true, "class-arrow": true, d: 'M 1,0 L 10,-4 L 10,4 Z', transform: `rotate(${(0, client_1.toDegrees)((0, client_1.angleOfPoint)({ x: p1.x - p2.x, y: p1.y - p2.y }))} ${p2.x} ${p2.y}) translate(${p2.x} ${p2.y})` }));
|
|
36
36
|
additionals.push(arrow);
|
|
37
37
|
return additionals;
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
40
|
WorkflowEdgeView = __decorate([
|
|
41
|
-
inversify_1.injectable()
|
|
41
|
+
(0, inversify_1.injectable)()
|
|
42
42
|
], WorkflowEdgeView);
|
|
43
43
|
exports.WorkflowEdgeView = WorkflowEdgeView;
|
|
44
|
-
let IconView = class IconView {
|
|
44
|
+
let IconView = class IconView extends client_1.ShapeView {
|
|
45
45
|
render(element, context) {
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
const taskNode = (0, client_1.findParentByFeature)(element, model_1.isTaskNode);
|
|
47
|
+
if (!taskNode || !this.isVisible(element, context)) {
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
50
|
+
let icon;
|
|
51
|
+
if (taskNode.type === 'task:manual') {
|
|
52
|
+
// From codicons: https://github.com/microsoft/vscode-codicons/blob/main/src/icons/account.svg?short_path=8135b2d
|
|
53
|
+
icon =
|
|
54
|
+
// eslint-disable-next-line max-len
|
|
55
|
+
'M16 7.992C16 3.58 12.416 0 8 0S0 3.58 0 7.992c0 2.43 1.104 4.62 2.832 6.09.016.016.032.016.032.032.144.112.288.224.448.336.08.048.144.111.224.175A7.98 7.98 0 0 0 8.016 16a7.98 7.98 0 0 0 4.48-1.375c.08-.048.144-.111.224-.16.144-.111.304-.223.448-.335.016-.016.032-.016.032-.032 1.696-1.487 2.8-3.676 2.8-6.106zm-8 7.001c-1.504 0-2.88-.48-4.016-1.279.016-.128.048-.255.08-.383a4.17 4.17 0 0 1 .416-.991c.176-.304.384-.576.64-.816.24-.24.528-.463.816-.639.304-.176.624-.304.976-.4A4.15 4.15 0 0 1 8 10.342a4.185 4.185 0 0 1 2.928 1.166c.368.368.656.8.864 1.295.112.288.192.592.24.911A7.03 7.03 0 0 1 8 14.993zm-2.448-7.4a2.49 2.49 0 0 1-.208-1.024c0-.351.064-.703.208-1.023.144-.32.336-.607.576-.847.24-.24.528-.431.848-.575.32-.144.672-.208 1.024-.208.368 0 .704.064 1.024.208.32.144.608.336.848.575.24.24.432.528.576.847.144.32.208.672.208 1.023 0 .368-.064.704-.208 1.023a2.84 2.84 0 0 1-.576.848 2.84 2.84 0 0 1-.848.575 2.715 2.715 0 0 1-2.064 0 2.84 2.84 0 0 1-.848-.575 2.526 2.526 0 0 1-.56-.848zm7.424 5.306c0-.032-.016-.048-.016-.08a5.22 5.22 0 0 0-.688-1.406 4.883 4.883 0 0 0-1.088-1.135 5.207 5.207 0 0 0-1.04-.608 2.82 2.82 0 0 0 .464-.383 4.2 4.2 0 0 0 .624-.784 3.624 3.624 0 0 0 .528-1.934 3.71 3.71 0 0 0-.288-1.47 3.799 3.799 0 0 0-.816-1.199 3.845 3.845 0 0 0-1.2-.8 3.72 3.72 0 0 0-1.472-.287 3.72 3.72 0 0 0-1.472.288 3.631 3.631 0 0 0-1.2.815 3.84 3.84 0 0 0-.8 1.199 3.71 3.71 0 0 0-.288 1.47c0 .352.048.688.144 1.007.096.336.224.64.4.927.16.288.384.544.624.784.144.144.304.271.48.383a5.12 5.12 0 0 0-1.04.624c-.416.32-.784.703-1.088 1.119a4.999 4.999 0 0 0-.688 1.406c-.016.032-.016.064-.016.08C1.776 11.636.992 9.91.992 7.992.992 4.14 4.144.991 8 .991s7.008 3.149 7.008 7.001a6.96 6.96 0 0 1-2.032 4.907z';
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
// From codicons: https://github.com/microsoft/vscode-codicons/blob/main/src/icons/gear.svg?short_path=8ee3ec4
|
|
59
|
+
icon =
|
|
60
|
+
// eslint-disable-next-line max-len
|
|
61
|
+
'M9.1 4.4L8.6 2H7.4l-.5 2.4-.7.3-2-1.3-.9.8 1.3 2-.2.7-2.4.5v1.2l2.4.5.3.8-1.3 2 .8.8 2-1.3.8.3.4 2.3h1.2l.5-2.4.8-.3 2 1.3.8-.8-1.3-2 .3-.8 2.3-.4V7.4l-2.4-.5-.3-.8 1.3-2-.8-.8-2 1.3-.7-.2zM9.4 1l.5 2.4L12 2.1l2 2-1.4 2.1 2.4.4v2.8l-2.4.5L14 12l-2 2-2.1-1.4-.5 2.4H6.6l-.5-2.4L4 13.9l-2-2 1.4-2.1L1 9.4V6.6l2.4-.5L2.1 4l2-2 2.1 1.4.4-2.4h2.8zm.6 7c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zM8 9c.6 0 1-.4 1-1s-.4-1-1-1-1 .4-1 1 .4 1 1 1z';
|
|
62
|
+
}
|
|
63
|
+
const vnode = (JSX.createElement("g", null,
|
|
64
|
+
JSX.createElement("path", { transform: 'scale(1.15),translate(0.75,0.75)',
|
|
65
|
+
// From codicons: https://github.com/microsoft/vscode-codicons/blob/main/src/icons/terminal.svg?short_path=2ffc08e
|
|
66
|
+
// eslint-disable-next-line max-len
|
|
67
|
+
d: icon }),
|
|
68
|
+
JSX.createElement("rect", { "class-icon-background": true, x: 0, y: 0, width: 25, height: 20 }),
|
|
49
69
|
context.renderChildren(element)));
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
70
|
+
const subType = (0, client_1.getSubType)(element);
|
|
71
|
+
if (subType) {
|
|
72
|
+
(0, client_1.setAttr)(vnode, 'class', subType);
|
|
73
|
+
}
|
|
74
|
+
return vnode;
|
|
53
75
|
}
|
|
54
76
|
};
|
|
55
77
|
IconView = __decorate([
|
|
56
|
-
inversify_1.injectable()
|
|
78
|
+
(0, inversify_1.injectable)()
|
|
57
79
|
], IconView);
|
|
58
80
|
exports.IconView = IconView;
|
|
59
81
|
//# sourceMappingURL=workflow-views.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-views.js","sourceRoot":"","sources":["../src/workflow-views.tsx"],"names":[],"mappings":";;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,
|
|
1
|
+
{"version":3,"file":"workflow-views.js","sourceRoot":"","sources":["../src/workflow-views.tsx"],"names":[],"mappings":";;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,iDAY8B;AAC9B,yCAAuC;AAEvC,mCAA2C;AAE3C,6DAA6D;AAC7D,MAAM,GAAG,GAAG,EAAE,aAAa,EAAE,YAAG,EAAE,CAAC;AAGnC,IAAa,gBAAgB,GAA7B,MAAa,gBAAiB,SAAQ,gDAAuC;IACtD,iBAAiB,CAAC,IAAW,EAAE,QAAiB,EAAE,OAAyB;QAC1F,MAAM,WAAW,GAAG,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;QACrE,MAAM,EAAE,GAAG,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACzC,MAAM,EAAE,GAAG,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACzC,MAAM,KAAK,GAAG,CACV,kDACwB,IAAI,iBACX,IAAI,EACjB,CAAC,EAAC,wBAAwB,EAC1B,SAAS,EAAE,UAAU,IAAA,kBAAS,EAAC,IAAA,qBAAY,EAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,eAAe,EAAE,CAAC,CAAC,IAC/G,EAAE,CAAC,CACP,GAAG,GACL,CACL,CAAC;QACF,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACxB,OAAO,WAAW,CAAC;IACvB,CAAC;CACJ,CAAA;AAlBY,gBAAgB;IAD5B,IAAA,sBAAU,GAAE;GACA,gBAAgB,CAkB5B;AAlBY,4CAAgB;AAqB7B,IAAa,QAAQ,GAArB,MAAa,QAAS,SAAQ,kBAAS;IACnC,MAAM,CAAC,OAAa,EAAE,OAAyB;QAC3C,MAAM,QAAQ,GAAG,IAAA,4BAAmB,EAAC,OAAO,EAAE,kBAAU,CAAC,CAAC;QAC1D,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE;YAChD,OAAO,SAAS,CAAC;SACpB;QAED,IAAI,IAAI,CAAC;QACT,IAAI,QAAQ,CAAC,IAAI,KAAK,aAAa,EAAE;YACjC,iHAAiH;YACjH,IAAI;gBACA,mCAAmC;gBACnC,ksDAAksD,CAAC;SAC1sD;aAAM;YACH,8GAA8G;YAC9G,IAAI;gBACA,mCAAmC;gBACnC,wbAAwb,CAAC;SAChc;QAED,MAAM,KAAK,GAAG,CACV;YACI,4BACI,SAAS,EAAE,kCAAkC;gBAC7C,kHAAkH;gBAClH,mCAAmC;gBACnC,CAAC,EAAE,IAAI,GACT;YACF,2DAA4B,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,GAAI;YAChE,OAAO,CAAC,cAAc,CAAC,OAAO,CAAC,CAChC,CACP,CAAC;QAEF,MAAM,OAAO,GAAG,IAAA,mBAAU,EAAC,OAAO,CAAC,CAAC;QACpC,IAAI,OAAO,EAAE;YACT,IAAA,gBAAO,EAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SACpC;QAED,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ,CAAA;AAxCY,QAAQ;IADpB,IAAA,sBAAU,GAAE;GACA,QAAQ,CAwCpB;AAxCY,4BAAQ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eclipse-glsp-examples/workflow-glsp",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.1.0-RC01",
|
|
4
4
|
"description": "GLSP diagrams for the Workflow DSL",
|
|
5
5
|
"license": "(EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0)",
|
|
6
6
|
"keywords": [
|
|
@@ -26,19 +26,18 @@
|
|
|
26
26
|
}
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@eclipse-glsp/client": "
|
|
29
|
+
"@eclipse-glsp/client": "1.1.0-RC01",
|
|
30
30
|
"balloon-css": "^0.5.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"mvn-artifact-download": "5.1.0"
|
|
34
|
-
"rimraf": "^2.6.1",
|
|
35
|
-
"typescript": "^3.9.2"
|
|
33
|
+
"mvn-artifact-download": "5.1.0"
|
|
36
34
|
},
|
|
37
35
|
"scripts": {
|
|
38
36
|
"prepare": "yarn clean && yarn build && yarn lint",
|
|
39
|
-
"clean": "rimraf lib",
|
|
37
|
+
"clean": "rimraf tsconfig.tsbuildinfo lib",
|
|
40
38
|
"build": "tsc",
|
|
41
|
-
"lint": "eslint
|
|
39
|
+
"lint": "eslint --ext .ts,.tsx ./src",
|
|
40
|
+
"lint:fix": "eslint --fix --ext .ts,.tsx ./src",
|
|
42
41
|
"watch": "tsc -w"
|
|
43
42
|
},
|
|
44
43
|
"files": [
|
|
@@ -53,5 +52,5 @@
|
|
|
53
52
|
"publishConfig": {
|
|
54
53
|
"access": "public"
|
|
55
54
|
},
|
|
56
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "1c856971c77dbb9dbb86f7cc1e252bf04f817703"
|
|
57
56
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"releaseRepository": "https://repo1.maven.org/maven2/",
|
|
3
|
+
"snapshotRepository": "https://oss.sonatype.org/content/repositories/snapshots/",
|
|
4
|
+
"groupId": "org.eclipse.glsp.example",
|
|
5
|
+
"artifactId": "org.eclipse.glsp.example.workflow",
|
|
6
|
+
"version": "1.1.0.RC01",
|
|
7
|
+
"isSnapshot": false,
|
|
8
|
+
"classifier": "glsp"
|
|
9
|
+
}
|
package/scripts/download.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2020-
|
|
2
|
+
* Copyright (c) 2020-2022 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
|
|
@@ -15,20 +15,21 @@
|
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
import download from 'mvn-artifact-download';
|
|
17
17
|
import { join, resolve } from 'path';
|
|
18
|
+
import * as config from './config.json';
|
|
18
19
|
|
|
19
20
|
const downloadDir = resolve(join(__dirname)) + '/../../..';
|
|
20
|
-
|
|
21
|
-
const groupId =
|
|
22
|
-
const
|
|
23
|
-
const version = '0.9.0';
|
|
24
|
-
const classifier = 'glsp';
|
|
21
|
+
|
|
22
|
+
const { groupId, artifactId, classifier, version, isSnapshot } = config;
|
|
23
|
+
const mavenRepository = isSnapshot ? config.snapshotRepository : config.releaseRepository;
|
|
25
24
|
|
|
26
25
|
console.log('Downloading latest version of the Workflow Example Java Server from the maven repository...');
|
|
27
|
-
|
|
26
|
+
const isSnapShot = true;
|
|
27
|
+
download({ groupId, artifactId, version, classifier, isSnapShot }, downloadDir, mavenRepository).then(() =>
|
|
28
28
|
console.log(
|
|
29
29
|
'Download completed. Start the server using this command: \njava -jar org.eclipse.glsp.example.workflow-' +
|
|
30
30
|
version +
|
|
31
|
-
'-SNAPSHOT
|
|
31
|
+
`${isSnapShot ? '-SNAPSHOT' : ''}` +
|
|
32
|
+
'-glsp.jar org.eclipse.glsp.example.workflow.launch.ExampleServerLauncher --port=8081 --websocket\n\n' +
|
|
32
33
|
'After starting the server, access the following file locally in your browser to see the running example:\n' +
|
|
33
34
|
'./examples/workflow-standalone/app/diagram.html'
|
|
34
35
|
)
|
package/src/di.config.ts
CHANGED
|
@@ -21,6 +21,8 @@ import {
|
|
|
21
21
|
DeleteElementContextMenuItemProvider,
|
|
22
22
|
DiamondNodeView,
|
|
23
23
|
editLabelFeature,
|
|
24
|
+
GLSPGraph,
|
|
25
|
+
GLSPProjectionView,
|
|
24
26
|
GridSnapper,
|
|
25
27
|
LogLevel,
|
|
26
28
|
overrideViewerOptions,
|
|
@@ -66,7 +68,7 @@ const workflowDiagramModule = new ContainerModule((bind, unbind, isBound, rebind
|
|
|
66
68
|
configureModelElement(context, 'activityNode:decision', ActivityNode, DiamondNodeView);
|
|
67
69
|
configureModelElement(context, 'activityNode:fork', ActivityNode, RectangularNodeView);
|
|
68
70
|
configureModelElement(context, 'activityNode:join', ActivityNode, RectangularNodeView);
|
|
69
|
-
|
|
71
|
+
configureModelElement(context, DefaultTypes.GRAPH, GLSPGraph, GLSPProjectionView);
|
|
70
72
|
configureModelElement(context, 'category', CategoryNode, RoundedCornerNodeView);
|
|
71
73
|
configureModelElement(context, 'struct', SCompartment, StructureCompartmentView);
|
|
72
74
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2020 EclipseSource and others.
|
|
2
|
+
* Copyright (c) 2020-2022 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,9 +13,8 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
+
import { TYPES } from '@eclipse-glsp/client';
|
|
16
17
|
import { ContainerModule } from 'inversify';
|
|
17
|
-
import { TYPES } from 'sprotty';
|
|
18
|
-
|
|
19
18
|
import { TaskEditor } from './direct-task-editor';
|
|
20
19
|
|
|
21
20
|
export const directTaskEditor = new ContainerModule((bind, _unbind, isBound) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2020-
|
|
2
|
+
* Copyright (c) 2020-2022 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
|
|
@@ -20,29 +20,58 @@ import {
|
|
|
20
20
|
EditorContextService,
|
|
21
21
|
getAbsoluteClientBounds,
|
|
22
22
|
GLSPActionDispatcher,
|
|
23
|
+
hasStringProp,
|
|
23
24
|
ILogger,
|
|
24
|
-
isSetContextActionsAction,
|
|
25
|
-
isSetEditValidationResultAction,
|
|
26
25
|
LabeledAction,
|
|
26
|
+
ModelIndexImpl,
|
|
27
|
+
Operation,
|
|
27
28
|
RequestContextActions,
|
|
28
29
|
RequestEditValidationAction,
|
|
29
|
-
|
|
30
|
+
SetContextActions,
|
|
31
|
+
SetEditValidationResultAction,
|
|
30
32
|
SModelRoot,
|
|
31
33
|
toActionArray,
|
|
34
|
+
TYPES,
|
|
32
35
|
ValidationDecorator,
|
|
33
36
|
ValidationStatus,
|
|
34
37
|
ViewerOptions
|
|
35
38
|
} from '@eclipse-glsp/client';
|
|
36
39
|
import { inject, injectable } from 'inversify';
|
|
37
|
-
import { TYPES } from 'sprotty/lib';
|
|
38
40
|
import { DOMHelper } from 'sprotty/lib/base/views/dom-helper';
|
|
39
|
-
|
|
40
41
|
import { isTaskNode, TaskNode } from '../model';
|
|
41
42
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
/**
|
|
44
|
+
* Is send from the {@link TaskEditor} to the GLSP server
|
|
45
|
+
* to execute a task edit operation.
|
|
46
|
+
*/
|
|
47
|
+
export interface ApplyTaskEditOperation extends Operation {
|
|
48
|
+
kind: typeof ApplyTaskEditOperation.KIND;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Id of the task that should be edited
|
|
52
|
+
*/
|
|
53
|
+
taskId: string;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* The edit expression
|
|
57
|
+
*/
|
|
58
|
+
expression: string;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export namespace ApplyTaskEditOperation {
|
|
62
|
+
export const KIND = 'applyTaskEdit';
|
|
63
|
+
|
|
64
|
+
export function is(object: any): object is ApplyTaskEditOperation {
|
|
65
|
+
return Operation.hasKind(object, KIND) && hasStringProp(object, 'taskId') && hasStringProp(object, 'expression');
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export function create(options: { taskId: string; expression: string }): ApplyTaskEditOperation {
|
|
69
|
+
return {
|
|
70
|
+
kind: KIND,
|
|
71
|
+
isOperation: true,
|
|
72
|
+
...options
|
|
73
|
+
};
|
|
74
|
+
}
|
|
46
75
|
}
|
|
47
76
|
|
|
48
77
|
@injectable()
|
|
@@ -68,7 +97,7 @@ export class TaskEditor extends AbstractUIExtension {
|
|
|
68
97
|
protected domHelper: DOMHelper;
|
|
69
98
|
|
|
70
99
|
@inject(TYPES.ILogger)
|
|
71
|
-
protected logger: ILogger;
|
|
100
|
+
protected override logger: ILogger;
|
|
72
101
|
|
|
73
102
|
protected task: TaskNode;
|
|
74
103
|
protected autoSuggestion: AutoCompleteWidget;
|
|
@@ -98,13 +127,13 @@ export class TaskEditor extends AbstractUIExtension {
|
|
|
98
127
|
this.autoSuggestion.initialize(containerElement);
|
|
99
128
|
}
|
|
100
129
|
|
|
101
|
-
show(root: Readonly<SModelRoot>, ...contextElementIds: string[]): void {
|
|
130
|
+
override show(root: Readonly<SModelRoot>, ...contextElementIds: string[]): void {
|
|
102
131
|
super.show(root, ...contextElementIds);
|
|
103
132
|
this.autoSuggestion.open(root);
|
|
104
133
|
}
|
|
105
134
|
|
|
106
|
-
protected onBeforeShow(containerElement: HTMLElement, root: Readonly<SModelRoot>, ...contextElementIds: string[]): void {
|
|
107
|
-
this.task = getTask(contextElementIds, root)[0];
|
|
135
|
+
protected override onBeforeShow(containerElement: HTMLElement, root: Readonly<SModelRoot>, ...contextElementIds: string[]): void {
|
|
136
|
+
this.task = getTask(contextElementIds, root.index)[0];
|
|
108
137
|
this.autoSuggestion.inputField.value = '';
|
|
109
138
|
this.setPosition(containerElement);
|
|
110
139
|
}
|
|
@@ -126,17 +155,19 @@ export class TaskEditor extends AbstractUIExtension {
|
|
|
126
155
|
|
|
127
156
|
protected async retrieveSuggestions(input: string): Promise<LabeledAction[]> {
|
|
128
157
|
const response = await this.actionDispatcher.request(
|
|
129
|
-
|
|
158
|
+
RequestContextActions.create({ contextId: TaskEditor.ID, editorContext: this.editorContextService.get({ ['text']: input }) })
|
|
130
159
|
);
|
|
131
|
-
if (
|
|
160
|
+
if (SetContextActions.is(response)) {
|
|
132
161
|
return response.actions;
|
|
133
162
|
}
|
|
134
163
|
return Promise.reject();
|
|
135
164
|
}
|
|
136
165
|
|
|
137
166
|
protected async validateInput(input: string): Promise<ValidationStatus> {
|
|
138
|
-
const response = await this.actionDispatcher.request(
|
|
139
|
-
|
|
167
|
+
const response = await this.actionDispatcher.request(
|
|
168
|
+
RequestEditValidationAction.create({ contextId: TaskEditor.ID, modelElementId: this.task.id, text: input })
|
|
169
|
+
);
|
|
170
|
+
if (SetEditValidationResultAction.is(response)) {
|
|
140
171
|
return response.status;
|
|
141
172
|
}
|
|
142
173
|
return Promise.reject();
|
|
@@ -147,16 +178,16 @@ export class TaskEditor extends AbstractUIExtension {
|
|
|
147
178
|
}
|
|
148
179
|
|
|
149
180
|
protected executeFromTextOnlyInput(input: string): void {
|
|
150
|
-
const action =
|
|
181
|
+
const action = ApplyTaskEditOperation.create({ taskId: this.task.id, expression: input });
|
|
151
182
|
this.actionDispatcher.dispatch(action);
|
|
152
183
|
}
|
|
153
184
|
|
|
154
|
-
hide(): void {
|
|
185
|
+
override hide(): void {
|
|
155
186
|
this.autoSuggestion.dispose();
|
|
156
187
|
super.hide();
|
|
157
188
|
}
|
|
158
189
|
}
|
|
159
190
|
|
|
160
|
-
function getTask(ids: string[],
|
|
161
|
-
return ids.map(id =>
|
|
191
|
+
function getTask(ids: string[], index: ModelIndexImpl): TaskNode[] {
|
|
192
|
+
return ids.map(id => index.getById(id)).filter(element => element && isTaskNode(element)) as TaskNode[];
|
|
162
193
|
}
|
package/src/model.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2020-
|
|
2
|
+
* Copyright (c) 2020-2022 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
|
|
@@ -40,7 +40,7 @@ import {
|
|
|
40
40
|
} from '@eclipse-glsp/client';
|
|
41
41
|
|
|
42
42
|
export class TaskNode extends RectangularNode implements Nameable, WithEditableLabel {
|
|
43
|
-
static readonly DEFAULT_FEATURES = [
|
|
43
|
+
static override readonly DEFAULT_FEATURES = [
|
|
44
44
|
connectableFeature,
|
|
45
45
|
deletableFeature,
|
|
46
46
|
selectFeature,
|
|
@@ -53,21 +53,22 @@ export class TaskNode extends RectangularNode implements Nameable, WithEditableL
|
|
|
53
53
|
nameFeature,
|
|
54
54
|
withEditLabelFeature
|
|
55
55
|
];
|
|
56
|
-
name = '';
|
|
57
56
|
duration?: number;
|
|
58
57
|
taskType?: string;
|
|
59
58
|
reference?: string;
|
|
60
59
|
|
|
61
60
|
get editableLabel(): (SChildElement & EditableLabel) | undefined {
|
|
62
|
-
const
|
|
63
|
-
if (
|
|
64
|
-
|
|
65
|
-
if (label && isEditableLabel(label)) {
|
|
66
|
-
return label;
|
|
67
|
-
}
|
|
61
|
+
const label = this.children.find(element => element.type === 'label:heading');
|
|
62
|
+
if (label && isEditableLabel(label)) {
|
|
63
|
+
return label;
|
|
68
64
|
}
|
|
69
65
|
return undefined;
|
|
70
66
|
}
|
|
67
|
+
|
|
68
|
+
get name(): string {
|
|
69
|
+
const labelText = this.editableLabel?.text;
|
|
70
|
+
return labelText ? labelText : '<unknown>';
|
|
71
|
+
}
|
|
71
72
|
}
|
|
72
73
|
|
|
73
74
|
export function isTaskNode(element: SModelElement): element is TaskNode {
|
|
@@ -80,11 +81,11 @@ export class WeightedEdge extends SEdge {
|
|
|
80
81
|
|
|
81
82
|
export class ActivityNode extends DiamondNode {
|
|
82
83
|
nodeType: string = ActivityNode.Type.UNDEFINED;
|
|
83
|
-
size = {
|
|
84
|
+
override size = {
|
|
84
85
|
width: 32,
|
|
85
86
|
height: 32
|
|
86
87
|
};
|
|
87
|
-
strokeWidth = 1;
|
|
88
|
+
override strokeWidth = 1;
|
|
88
89
|
}
|
|
89
90
|
|
|
90
91
|
export namespace ActivityNode {
|
|
@@ -103,15 +104,15 @@ export class Icon extends SShapeElement implements LayoutContainer {
|
|
|
103
104
|
static readonly DEFAULT_FEATURES = [boundsFeature, layoutContainerFeature, layoutableChildFeature, fadeFeature];
|
|
104
105
|
|
|
105
106
|
layout: string;
|
|
106
|
-
layoutOptions?: { [key: string]: string | number | boolean };
|
|
107
|
-
size = {
|
|
107
|
+
override layoutOptions?: { [key: string]: string | number | boolean };
|
|
108
|
+
override size = {
|
|
108
109
|
width: 32,
|
|
109
110
|
height: 32
|
|
110
111
|
};
|
|
111
112
|
}
|
|
112
113
|
|
|
113
114
|
export class CategoryNode extends RectangularNode implements Nameable, WithEditableLabel {
|
|
114
|
-
static readonly DEFAULT_FEATURES = [
|
|
115
|
+
static override readonly DEFAULT_FEATURES = [
|
|
115
116
|
deletableFeature,
|
|
116
117
|
selectFeature,
|
|
117
118
|
boundsFeature,
|
package/src/workflow-views.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2019-
|
|
2
|
+
* Copyright (c) 2019-2022 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
|
|
@@ -15,24 +15,27 @@
|
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
import {
|
|
17
17
|
angleOfPoint,
|
|
18
|
-
|
|
18
|
+
findParentByFeature,
|
|
19
|
+
getSubType,
|
|
19
20
|
Point,
|
|
20
21
|
PolylineEdgeViewWithGapsOnIntersections,
|
|
21
22
|
RenderingContext,
|
|
22
23
|
SEdge,
|
|
24
|
+
setAttr,
|
|
25
|
+
ShapeView,
|
|
26
|
+
svg,
|
|
23
27
|
toDegrees
|
|
24
28
|
} from '@eclipse-glsp/client';
|
|
25
29
|
import { injectable } from 'inversify';
|
|
26
30
|
import { VNode } from 'snabbdom';
|
|
27
|
-
import {
|
|
28
|
-
import { Icon } from './model';
|
|
31
|
+
import { Icon, isTaskNode } from './model';
|
|
29
32
|
|
|
30
33
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
31
34
|
const JSX = { createElement: svg };
|
|
32
35
|
|
|
33
36
|
@injectable()
|
|
34
37
|
export class WorkflowEdgeView extends PolylineEdgeViewWithGapsOnIntersections {
|
|
35
|
-
protected renderAdditionals(edge: SEdge, segments: Point[], context: RenderingContext): VNode[] {
|
|
38
|
+
protected override renderAdditionals(edge: SEdge, segments: Point[], context: RenderingContext): VNode[] {
|
|
36
39
|
const additionals = super.renderAdditionals(edge, segments, context);
|
|
37
40
|
const p1 = segments[segments.length - 2];
|
|
38
41
|
const p2 = segments[segments.length - 1];
|
|
@@ -40,7 +43,7 @@ export class WorkflowEdgeView extends PolylineEdgeViewWithGapsOnIntersections {
|
|
|
40
43
|
<path
|
|
41
44
|
class-sprotty-edge={true}
|
|
42
45
|
class-arrow={true}
|
|
43
|
-
d='M 1
|
|
46
|
+
d='M 1,0 L 10,-4 L 10,4 Z'
|
|
44
47
|
transform={`rotate(${toDegrees(angleOfPoint({ x: p1.x - p2.x, y: p1.y - p2.y }))} ${p2.x} ${p2.y}) translate(${p2.x} ${
|
|
45
48
|
p2.y
|
|
46
49
|
})`}
|
|
@@ -52,18 +55,44 @@ export class WorkflowEdgeView extends PolylineEdgeViewWithGapsOnIntersections {
|
|
|
52
55
|
}
|
|
53
56
|
|
|
54
57
|
@injectable()
|
|
55
|
-
export class IconView
|
|
56
|
-
render(element: Icon, context: RenderingContext): VNode {
|
|
57
|
-
const
|
|
58
|
-
|
|
58
|
+
export class IconView extends ShapeView {
|
|
59
|
+
render(element: Icon, context: RenderingContext): VNode | undefined {
|
|
60
|
+
const taskNode = findParentByFeature(element, isTaskNode);
|
|
61
|
+
if (!taskNode || !this.isVisible(element, context)) {
|
|
62
|
+
return undefined;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
let icon;
|
|
66
|
+
if (taskNode.type === 'task:manual') {
|
|
67
|
+
// From codicons: https://github.com/microsoft/vscode-codicons/blob/main/src/icons/account.svg?short_path=8135b2d
|
|
68
|
+
icon =
|
|
69
|
+
// eslint-disable-next-line max-len
|
|
70
|
+
'M16 7.992C16 3.58 12.416 0 8 0S0 3.58 0 7.992c0 2.43 1.104 4.62 2.832 6.09.016.016.032.016.032.032.144.112.288.224.448.336.08.048.144.111.224.175A7.98 7.98 0 0 0 8.016 16a7.98 7.98 0 0 0 4.48-1.375c.08-.048.144-.111.224-.16.144-.111.304-.223.448-.335.016-.016.032-.016.032-.032 1.696-1.487 2.8-3.676 2.8-6.106zm-8 7.001c-1.504 0-2.88-.48-4.016-1.279.016-.128.048-.255.08-.383a4.17 4.17 0 0 1 .416-.991c.176-.304.384-.576.64-.816.24-.24.528-.463.816-.639.304-.176.624-.304.976-.4A4.15 4.15 0 0 1 8 10.342a4.185 4.185 0 0 1 2.928 1.166c.368.368.656.8.864 1.295.112.288.192.592.24.911A7.03 7.03 0 0 1 8 14.993zm-2.448-7.4a2.49 2.49 0 0 1-.208-1.024c0-.351.064-.703.208-1.023.144-.32.336-.607.576-.847.24-.24.528-.431.848-.575.32-.144.672-.208 1.024-.208.368 0 .704.064 1.024.208.32.144.608.336.848.575.24.24.432.528.576.847.144.32.208.672.208 1.023 0 .368-.064.704-.208 1.023a2.84 2.84 0 0 1-.576.848 2.84 2.84 0 0 1-.848.575 2.715 2.715 0 0 1-2.064 0 2.84 2.84 0 0 1-.848-.575 2.526 2.526 0 0 1-.56-.848zm7.424 5.306c0-.032-.016-.048-.016-.08a5.22 5.22 0 0 0-.688-1.406 4.883 4.883 0 0 0-1.088-1.135 5.207 5.207 0 0 0-1.04-.608 2.82 2.82 0 0 0 .464-.383 4.2 4.2 0 0 0 .624-.784 3.624 3.624 0 0 0 .528-1.934 3.71 3.71 0 0 0-.288-1.47 3.799 3.799 0 0 0-.816-1.199 3.845 3.845 0 0 0-1.2-.8 3.72 3.72 0 0 0-1.472-.287 3.72 3.72 0 0 0-1.472.288 3.631 3.631 0 0 0-1.2.815 3.84 3.84 0 0 0-.8 1.199 3.71 3.71 0 0 0-.288 1.47c0 .352.048.688.144 1.007.096.336.224.64.4.927.16.288.384.544.624.784.144.144.304.271.48.383a5.12 5.12 0 0 0-1.04.624c-.416.32-.784.703-1.088 1.119a4.999 4.999 0 0 0-.688 1.406c-.016.032-.016.064-.016.08C1.776 11.636.992 9.91.992 7.992.992 4.14 4.144.991 8 .991s7.008 3.149 7.008 7.001a6.96 6.96 0 0 1-2.032 4.907z';
|
|
71
|
+
} else {
|
|
72
|
+
// From codicons: https://github.com/microsoft/vscode-codicons/blob/main/src/icons/gear.svg?short_path=8ee3ec4
|
|
73
|
+
icon =
|
|
74
|
+
// eslint-disable-next-line max-len
|
|
75
|
+
'M9.1 4.4L8.6 2H7.4l-.5 2.4-.7.3-2-1.3-.9.8 1.3 2-.2.7-2.4.5v1.2l2.4.5.3.8-1.3 2 .8.8 2-1.3.8.3.4 2.3h1.2l.5-2.4.8-.3 2 1.3.8-.8-1.3-2 .3-.8 2.3-.4V7.4l-2.4-.5-.3-.8 1.3-2-.8-.8-2 1.3-.7-.2zM9.4 1l.5 2.4L12 2.1l2 2-1.4 2.1 2.4.4v2.8l-2.4.5L14 12l-2 2-2.1-1.4-.5 2.4H6.6l-.5-2.4L4 13.9l-2-2 1.4-2.1L1 9.4V6.6l2.4-.5L2.1 4l2-2 2.1 1.4.4-2.4h2.8zm.6 7c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zM8 9c.6 0 1-.4 1-1s-.4-1-1-1-1 .4-1 1 .4 1 1 1z';
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const vnode = (
|
|
59
79
|
<g>
|
|
60
|
-
<
|
|
80
|
+
<path
|
|
81
|
+
transform={'scale(1.15),translate(0.75,0.75)'}
|
|
82
|
+
// From codicons: https://github.com/microsoft/vscode-codicons/blob/main/src/icons/terminal.svg?short_path=2ffc08e
|
|
83
|
+
// eslint-disable-next-line max-len
|
|
84
|
+
d={icon}
|
|
85
|
+
/>
|
|
86
|
+
<rect class-icon-background x={0} y={0} width={25} height={20} />
|
|
61
87
|
{context.renderChildren(element)}
|
|
62
88
|
</g>
|
|
63
89
|
);
|
|
64
|
-
}
|
|
65
90
|
|
|
66
|
-
|
|
67
|
-
|
|
91
|
+
const subType = getSubType(element);
|
|
92
|
+
if (subType) {
|
|
93
|
+
setAttr(vnode, 'class', subType);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return vnode;
|
|
68
97
|
}
|
|
69
98
|
}
|