@eclipse-glsp-examples/workflow-glsp 0.9.0-rc-01 → 0.9.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/LICENSE +642 -277
- package/README.md +6 -4
- package/css/diagram.css +58 -38
- package/lib/di.config.d.ts +2 -17
- package/lib/di.config.d.ts.map +1 -1
- package/lib/di.config.js +14 -13
- package/lib/di.config.js.map +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 +1 -1
- package/lib/direct-task-editing/direct-task-editor.d.ts.map +1 -1
- package/lib/direct-task-editing/direct-task-editor.js +86 -186
- package/lib/direct-task-editing/direct-task-editor.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/model.d.ts +6 -1
- package/lib/model.d.ts.map +1 -1
- package/lib/model.js +72 -68
- package/lib/model.js.map +1 -1
- package/lib/workflow-views.d.ts +4 -4
- package/lib/workflow-views.d.ts.map +1 -1
- package/lib/workflow-views.js +29 -50
- package/lib/workflow-views.js.map +1 -1
- package/package.json +7 -16
- package/scripts/download.ts +19 -16
- package/src/di.config.ts +14 -53
- package/src/direct-task-editing/direct-task-editor.ts +11 -9
- package/src/index.ts +1 -2
- package/src/model.ts +39 -4
- package/src/workflow-views.tsx +23 -14
package/lib/workflow-views.js
CHANGED
|
@@ -1,17 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
extendStatics(d, b);
|
|
11
|
-
function __() { this.constructor = d; }
|
|
12
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
|
-
};
|
|
14
|
-
})();
|
|
15
2
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
16
3
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
17
4
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -21,7 +8,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
21
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
9
|
exports.IconView = exports.WorkflowEdgeView = void 0;
|
|
23
10
|
/********************************************************************************
|
|
24
|
-
* Copyright (c) 2019 EclipseSource and others.
|
|
11
|
+
* Copyright (c) 2019-2021 EclipseSource and others.
|
|
25
12
|
*
|
|
26
13
|
* This program and the accompanying materials are made available under the
|
|
27
14
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -35,46 +22,38 @@ exports.IconView = exports.WorkflowEdgeView = void 0;
|
|
|
35
22
|
*
|
|
36
23
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
37
24
|
********************************************************************************/
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
25
|
+
const client_1 = require("@eclipse-glsp/client");
|
|
26
|
+
const inversify_1 = require("inversify");
|
|
27
|
+
const sprotty_1 = require("sprotty");
|
|
41
28
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
var additionals = _super.prototype.renderAdditionals.call(this, edge, segments, context);
|
|
50
|
-
var p1 = segments[segments.length - 2];
|
|
51
|
-
var p2 = segments[segments.length - 1];
|
|
52
|
-
var arrow = JSX.createElement("path", { "class-sprotty-edge": true, "class-arrow": true, d: 'M 1.5,0 L 10,-4 L 10,4 Z', transform: "rotate(" + client_1.toDegrees(client_1.angleOfPoint({ x: p1.x - p2.x, y: p1.y - p2.y })) + " " + p2.x + " " + p2.y + ") translate(" + p2.x + " " + p2.y + ")" });
|
|
29
|
+
const JSX = { createElement: sprotty_1.svg };
|
|
30
|
+
let WorkflowEdgeView = class WorkflowEdgeView extends client_1.PolylineEdgeViewWithGapsOnIntersections {
|
|
31
|
+
renderAdditionals(edge, segments, context) {
|
|
32
|
+
const additionals = super.renderAdditionals(edge, segments, context);
|
|
33
|
+
const p1 = segments[segments.length - 2];
|
|
34
|
+
const p2 = segments[segments.length - 1];
|
|
35
|
+
const arrow = (JSX.createElement("path", { "class-sprotty-edge": true, "class-arrow": true, d: 'M 1.5,0 L 10,-4 L 10,4 Z', transform: `rotate(${client_1.toDegrees(client_1.angleOfPoint({ x: p1.x - p2.x, y: p1.y - p2.y }))} ${p2.x} ${p2.y}) translate(${p2.x} ${p2.y})` }));
|
|
53
36
|
additionals.push(arrow);
|
|
54
37
|
return additionals;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}(client_1.GEdgeView));
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
WorkflowEdgeView = __decorate([
|
|
41
|
+
inversify_1.injectable()
|
|
42
|
+
], WorkflowEdgeView);
|
|
61
43
|
exports.WorkflowEdgeView = WorkflowEdgeView;
|
|
62
|
-
|
|
63
|
-
|
|
44
|
+
let IconView = class IconView {
|
|
45
|
+
render(element, context) {
|
|
46
|
+
const radius = this.getRadius();
|
|
47
|
+
return (JSX.createElement("g", null,
|
|
48
|
+
JSX.createElement("circle", { "class-sprotty-icon": true, r: radius, cx: radius + 2, cy: radius + 2 }),
|
|
49
|
+
context.renderChildren(element)));
|
|
64
50
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
return 16;
|
|
73
|
-
};
|
|
74
|
-
IconView = __decorate([
|
|
75
|
-
inversify_1.injectable()
|
|
76
|
-
], IconView);
|
|
77
|
-
return IconView;
|
|
78
|
-
}());
|
|
51
|
+
getRadius() {
|
|
52
|
+
return 14;
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
IconView = __decorate([
|
|
56
|
+
inversify_1.injectable()
|
|
57
|
+
], IconView);
|
|
79
58
|
exports.IconView = IconView;
|
|
80
59
|
//# sourceMappingURL=workflow-views.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-views.js","sourceRoot":"","sources":["../src/workflow-views.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"workflow-views.js","sourceRoot":"","sources":["../src/workflow-views.tsx"],"names":[],"mappings":";;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,iDAQ8B;AAC9B,yCAAuC;AAEvC,qCAA8B;AAG9B,6DAA6D;AAC7D,MAAM,GAAG,GAAG,EAAE,aAAa,EAAE,aAAG,EAAE,CAAC;AAGnC,IAAa,gBAAgB,GAA7B,MAAa,gBAAiB,SAAQ,gDAAuC;IAC/D,iBAAiB,CAAC,IAAW,EAAE,QAAiB,EAAE,OAAyB;QACjF,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,0BAA0B,EAC5B,SAAS,EAAE,UAAU,kBAAS,CAAC,qBAAY,CAAC,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,sBAAU,EAAE;GACA,gBAAgB,CAkB5B;AAlBY,4CAAgB;AAqB7B,IAAa,QAAQ,GAArB,MAAa,QAAQ;IACjB,MAAM,CAAC,OAAa,EAAE,OAAyB;QAC3C,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;QAChC,OAAO,CACH;YACI,oDAA4B,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,CAAC,EAAE,EAAE,EAAE,MAAM,GAAG,CAAC,GAAW;YACrF,OAAO,CAAC,cAAc,CAAC,OAAO,CAAC,CAChC,CACP,CAAC;IACN,CAAC;IAED,SAAS;QACL,OAAO,EAAE,CAAC;IACd,CAAC;CACJ,CAAA;AAdY,QAAQ;IADpB,sBAAU,EAAE;GACA,QAAQ,CAcpB;AAdY,4BAAQ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eclipse-glsp-examples/workflow-glsp",
|
|
3
|
-
"version": "0.9.0
|
|
3
|
+
"version": "0.9.0",
|
|
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": [
|
|
@@ -20,23 +20,13 @@
|
|
|
20
20
|
"bugs": "https://github.com/eclipse-glsp/glsp/issues",
|
|
21
21
|
"contributors": [
|
|
22
22
|
{
|
|
23
|
-
"name": "
|
|
24
|
-
"email": "
|
|
25
|
-
"url": "https://
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
"name": "Tobias Ortmayr",
|
|
29
|
-
"email": "tortmayr@eclipsesource.com",
|
|
30
|
-
"url": "https://www.eclipsesource.com"
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
"name": "Martin Fleck",
|
|
34
|
-
"email": "mfleck@eclipsesource.com",
|
|
35
|
-
"url": "https://www.eclipsesource.com"
|
|
23
|
+
"name": "Eclipse GLSP Project",
|
|
24
|
+
"email": "glsp-dev@eclipse.org",
|
|
25
|
+
"url": "https://projects.eclipse.org/projects/ecd.glsp"
|
|
36
26
|
}
|
|
37
27
|
],
|
|
38
28
|
"dependencies": {
|
|
39
|
-
"@eclipse-glsp/client": "0.9.0
|
|
29
|
+
"@eclipse-glsp/client": "0.9.0",
|
|
40
30
|
"balloon-css": "^0.5.0"
|
|
41
31
|
},
|
|
42
32
|
"devDependencies": {
|
|
@@ -62,5 +52,6 @@
|
|
|
62
52
|
"types": "lib/index",
|
|
63
53
|
"publishConfig": {
|
|
64
54
|
"access": "public"
|
|
65
|
-
}
|
|
55
|
+
},
|
|
56
|
+
"gitHead": "5e12ddb7e7da0e1b55555d95607645e24555f6b4"
|
|
66
57
|
}
|
package/scripts/download.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
|
|
@@ -13,20 +13,23 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
-
import download from
|
|
17
|
-
import { join, resolve } from
|
|
16
|
+
import download from 'mvn-artifact-download';
|
|
17
|
+
import { join, resolve } from 'path';
|
|
18
18
|
|
|
19
|
-
const downloadDir = resolve(join(__dirname)) +
|
|
20
|
-
const mavenRepository =
|
|
21
|
-
const groupId =
|
|
22
|
-
const artifactId =
|
|
23
|
-
const version =
|
|
24
|
-
const classifier =
|
|
19
|
+
const downloadDir = resolve(join(__dirname)) + '/../../..';
|
|
20
|
+
const mavenRepository = 'https://oss.sonatype.org/content/repositories/snapshots/';
|
|
21
|
+
const groupId = 'org.eclipse.glsp.example';
|
|
22
|
+
const artifactId = 'org.eclipse.glsp.example.workflow';
|
|
23
|
+
const version = '0.9.0';
|
|
24
|
+
const classifier = 'glsp';
|
|
25
25
|
|
|
26
|
-
console.log(
|
|
27
|
-
download({ groupId, artifactId, version, classifier, isSnapShot: true }, downloadDir, mavenRepository)
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
26
|
+
console.log('Downloading latest version of the Workflow Example Java Server from the maven repository...');
|
|
27
|
+
download({ groupId, artifactId, version, classifier, isSnapShot: true }, downloadDir, mavenRepository).then(() =>
|
|
28
|
+
console.log(
|
|
29
|
+
'Download completed. Start the server using this command: \njava -jar org.eclipse.glsp.example.workflow-' +
|
|
30
|
+
version +
|
|
31
|
+
'-SNAPSHOT-glsp.jar org.eclipse.glsp.example.workflow.launch.ExampleServerLauncher --port=8081 --websocket\n\n' +
|
|
32
|
+
'After starting the server, access the following file locally in your browser to see the running example:\n' +
|
|
33
|
+
'./examples/workflow-standalone/app/diagram.html'
|
|
34
|
+
)
|
|
35
|
+
);
|
package/src/di.config.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,74 +13,40 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
-
import '../css/diagram.css';
|
|
17
|
-
import 'balloon-css/balloon.min.css';
|
|
18
|
-
import 'sprotty/css/edit-label.css';
|
|
19
|
-
|
|
20
16
|
import {
|
|
21
|
-
boundsModule,
|
|
22
|
-
buttonModule,
|
|
23
17
|
configureDefaultModelElements,
|
|
24
18
|
configureModelElement,
|
|
25
19
|
ConsoleLogger,
|
|
26
|
-
|
|
27
|
-
defaultModule,
|
|
28
|
-
DefaultTypes,
|
|
20
|
+
createClientContainer,
|
|
29
21
|
DeleteElementContextMenuItemProvider,
|
|
30
22
|
DiamondNodeView,
|
|
31
|
-
edgeLayoutModule,
|
|
32
23
|
editLabelFeature,
|
|
33
|
-
expandModule,
|
|
34
|
-
exportModule,
|
|
35
|
-
fadeModule,
|
|
36
|
-
GLSP_TYPES,
|
|
37
|
-
glspCommandPaletteModule,
|
|
38
|
-
glspContextMenuModule,
|
|
39
|
-
glspDecorationModule,
|
|
40
|
-
glspEditLabelModule,
|
|
41
|
-
glspHoverModule,
|
|
42
|
-
glspMouseToolModule,
|
|
43
|
-
glspSelectModule,
|
|
44
|
-
glspServerCopyPasteModule,
|
|
45
|
-
glspViewportModule,
|
|
46
24
|
GridSnapper,
|
|
47
|
-
labelEditUiModule,
|
|
48
|
-
layoutCommandsModule,
|
|
49
25
|
LogLevel,
|
|
50
|
-
markerNavigatorModule,
|
|
51
|
-
modelHintsModule,
|
|
52
|
-
modelSourceModule,
|
|
53
|
-
modelSourceWatcherModule,
|
|
54
|
-
navigationModule,
|
|
55
|
-
NoOverlapMovmentRestrictor,
|
|
56
|
-
openModule,
|
|
57
26
|
overrideViewerOptions,
|
|
58
|
-
|
|
27
|
+
RectangularNodeView,
|
|
59
28
|
RevealNamedElementActionProvider,
|
|
60
29
|
RoundedCornerNodeView,
|
|
61
|
-
routingModule,
|
|
62
30
|
SCompartment,
|
|
63
31
|
SCompartmentView,
|
|
64
32
|
SEdge,
|
|
65
33
|
SLabel,
|
|
66
34
|
SLabelView,
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
TYPES,
|
|
70
|
-
validationModule,
|
|
71
|
-
zorderModule,
|
|
72
|
-
RectangularNodeView
|
|
35
|
+
StructureCompartmentView,
|
|
36
|
+
TYPES
|
|
73
37
|
} from '@eclipse-glsp/client';
|
|
38
|
+
import { DefaultTypes } from '@eclipse-glsp/protocol';
|
|
39
|
+
import 'balloon-css/balloon.min.css';
|
|
74
40
|
import { Container, ContainerModule } from 'inversify';
|
|
75
|
-
|
|
41
|
+
import 'sprotty/css/edit-label.css';
|
|
42
|
+
import '../css/diagram.css';
|
|
76
43
|
import { directTaskEditor } from './direct-task-editing/di.config';
|
|
77
|
-
import { ActivityNode, Icon, TaskNode, WeightedEdge } from './model';
|
|
44
|
+
import { ActivityNode, CategoryNode, Icon, TaskNode, WeightedEdge } from './model';
|
|
78
45
|
import { IconView, WorkflowEdgeView } from './workflow-views';
|
|
79
46
|
|
|
80
47
|
const workflowDiagramModule = new ContainerModule((bind, unbind, isBound, rebind) => {
|
|
81
48
|
rebind(TYPES.ILogger).to(ConsoleLogger).inSingletonScope();
|
|
82
49
|
rebind(TYPES.LogLevel).toConstantValue(LogLevel.warn);
|
|
83
|
-
bind(GLSP_TYPES.IMovementRestrictor).to(NoOverlapMovmentRestrictor).inSingletonScope();
|
|
84
50
|
bind(TYPES.ISnapper).to(GridSnapper);
|
|
85
51
|
bind(TYPES.ICommandPaletteActionProvider).to(RevealNamedElementActionProvider);
|
|
86
52
|
bind(TYPES.IContextMenuItemProvider).to(DeleteElementContextMenuItemProvider);
|
|
@@ -100,21 +66,16 @@ const workflowDiagramModule = new ContainerModule((bind, unbind, isBound, rebind
|
|
|
100
66
|
configureModelElement(context, 'activityNode:decision', ActivityNode, DiamondNodeView);
|
|
101
67
|
configureModelElement(context, 'activityNode:fork', ActivityNode, RectangularNodeView);
|
|
102
68
|
configureModelElement(context, 'activityNode:join', ActivityNode, RectangularNodeView);
|
|
69
|
+
|
|
70
|
+
configureModelElement(context, 'category', CategoryNode, RoundedCornerNodeView);
|
|
71
|
+
configureModelElement(context, 'struct', SCompartment, StructureCompartmentView);
|
|
103
72
|
});
|
|
104
73
|
|
|
105
74
|
export default function createContainer(widgetId: string): Container {
|
|
106
|
-
const container =
|
|
107
|
-
|
|
108
|
-
container.load(defaultModule, defaultGLSPModule, glspMouseToolModule, validationModule, glspSelectModule, boundsModule, glspViewportModule, toolsModule,
|
|
109
|
-
glspHoverModule, fadeModule, exportModule, expandModule, openModule, buttonModule, modelSourceModule, labelEditUiModule, glspEditLabelModule,
|
|
110
|
-
workflowDiagramModule, toolFeedbackModule, modelHintsModule, glspContextMenuModule, glspServerCopyPasteModule, modelSourceWatcherModule,
|
|
111
|
-
glspCommandPaletteModule, paletteModule, routingModule, glspDecorationModule, edgeLayoutModule, zorderModule,
|
|
112
|
-
layoutCommandsModule, directTaskEditor, navigationModule, markerNavigatorModule);
|
|
113
|
-
|
|
75
|
+
const container = createClientContainer(workflowDiagramModule, directTaskEditor);
|
|
114
76
|
overrideViewerOptions(container, {
|
|
115
77
|
baseDiv: widgetId,
|
|
116
78
|
hiddenDiv: widgetId + '_hidden'
|
|
117
79
|
});
|
|
118
|
-
|
|
119
80
|
return container;
|
|
120
81
|
}
|
|
@@ -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
|
|
@@ -42,12 +42,11 @@ import { isTaskNode, TaskNode } from '../model';
|
|
|
42
42
|
export class ApplyTaskEditOperation implements Action {
|
|
43
43
|
static readonly KIND = 'applyTaskEdit';
|
|
44
44
|
readonly kind = ApplyTaskEditOperation.KIND;
|
|
45
|
-
constructor(readonly taskId: string, readonly expression: string) {
|
|
45
|
+
constructor(readonly taskId: string, readonly expression: string) {}
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
@injectable()
|
|
49
49
|
export class TaskEditor extends AbstractUIExtension {
|
|
50
|
-
|
|
51
50
|
static readonly ID = 'task-editor';
|
|
52
51
|
readonly autoSuggestionSettings = {
|
|
53
52
|
noSuggestionsMessage: 'No suggestions available',
|
|
@@ -86,14 +85,16 @@ export class TaskEditor extends AbstractUIExtension {
|
|
|
86
85
|
this.autoSuggestionSettings,
|
|
87
86
|
{ provideSuggestions: input => this.retrieveSuggestions(input) },
|
|
88
87
|
{ executeFromSuggestion: input => this.executeFromSuggestion(input) },
|
|
89
|
-
() => this.hide(),
|
|
88
|
+
() => this.hide(),
|
|
89
|
+
this.logger
|
|
90
|
+
);
|
|
90
91
|
this.autoSuggestion.configureValidation(
|
|
91
92
|
{ validate: input => this.validateInput(input) },
|
|
92
93
|
new ValidationDecorator(containerElement)
|
|
93
94
|
);
|
|
94
|
-
this.autoSuggestion.configureTextSubmitHandler(
|
|
95
|
-
|
|
96
|
-
);
|
|
95
|
+
this.autoSuggestion.configureTextSubmitHandler({
|
|
96
|
+
executeFromTextOnlyInput: (input: string) => this.executeFromTextOnlyInput(input)
|
|
97
|
+
});
|
|
97
98
|
this.autoSuggestion.initialize(containerElement);
|
|
98
99
|
}
|
|
99
100
|
|
|
@@ -124,8 +125,9 @@ export class TaskEditor extends AbstractUIExtension {
|
|
|
124
125
|
}
|
|
125
126
|
|
|
126
127
|
protected async retrieveSuggestions(input: string): Promise<LabeledAction[]> {
|
|
127
|
-
const response = await this.actionDispatcher.request(
|
|
128
|
-
this.editorContextService.get({ ['text']: input }))
|
|
128
|
+
const response = await this.actionDispatcher.request(
|
|
129
|
+
new RequestContextActions(TaskEditor.ID, this.editorContextService.get({ ['text']: input }))
|
|
130
|
+
);
|
|
129
131
|
if (isSetContextActionsAction(response)) {
|
|
130
132
|
return response.actions;
|
|
131
133
|
}
|
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
|
|
@@ -19,4 +19,3 @@ export * from './model';
|
|
|
19
19
|
export * from './workflow-views';
|
|
20
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
|
|
@@ -40,8 +40,19 @@ import {
|
|
|
40
40
|
} from '@eclipse-glsp/client';
|
|
41
41
|
|
|
42
42
|
export class TaskNode extends RectangularNode implements Nameable, WithEditableLabel {
|
|
43
|
-
static readonly DEFAULT_FEATURES = [
|
|
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
|
+
];
|
|
45
56
|
name = '';
|
|
46
57
|
duration?: number;
|
|
47
58
|
taskType?: string;
|
|
@@ -76,7 +87,6 @@ export class ActivityNode extends DiamondNode {
|
|
|
76
87
|
strokeWidth = 1;
|
|
77
88
|
}
|
|
78
89
|
|
|
79
|
-
// eslint-disable-next-line no-redeclare
|
|
80
90
|
export namespace ActivityNode {
|
|
81
91
|
export namespace Type {
|
|
82
92
|
export const INITIAL = 'initalNode';
|
|
@@ -99,3 +109,28 @@ export class Icon extends SShapeElement implements LayoutContainer {
|
|
|
99
109
|
height: 32
|
|
100
110
|
};
|
|
101
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
|
|
@@ -15,30 +15,37 @@
|
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
import {
|
|
17
17
|
angleOfPoint,
|
|
18
|
-
GEdgeView,
|
|
19
18
|
IView,
|
|
20
19
|
Point,
|
|
20
|
+
PolylineEdgeViewWithGapsOnIntersections,
|
|
21
21
|
RenderingContext,
|
|
22
22
|
SEdge,
|
|
23
23
|
toDegrees
|
|
24
24
|
} from '@eclipse-glsp/client';
|
|
25
25
|
import { injectable } from 'inversify';
|
|
26
|
-
import
|
|
27
|
-
import {
|
|
28
|
-
|
|
26
|
+
import { VNode } from 'snabbdom';
|
|
27
|
+
import { svg } from 'sprotty';
|
|
29
28
|
import { Icon } from './model';
|
|
30
29
|
|
|
31
30
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
32
|
-
const JSX = { createElement:
|
|
31
|
+
const JSX = { createElement: svg };
|
|
33
32
|
|
|
34
33
|
@injectable()
|
|
35
|
-
export class WorkflowEdgeView extends
|
|
34
|
+
export class WorkflowEdgeView extends PolylineEdgeViewWithGapsOnIntersections {
|
|
36
35
|
protected renderAdditionals(edge: SEdge, segments: Point[], context: RenderingContext): VNode[] {
|
|
37
36
|
const additionals = super.renderAdditionals(edge, segments, context);
|
|
38
37
|
const p1 = segments[segments.length - 2];
|
|
39
38
|
const p2 = segments[segments.length - 1];
|
|
40
|
-
const arrow =
|
|
41
|
-
|
|
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
|
+
);
|
|
42
49
|
additionals.push(arrow);
|
|
43
50
|
return additionals;
|
|
44
51
|
}
|
|
@@ -48,13 +55,15 @@ export class WorkflowEdgeView extends GEdgeView {
|
|
|
48
55
|
export class IconView implements IView {
|
|
49
56
|
render(element: Icon, context: RenderingContext): VNode {
|
|
50
57
|
const radius = this.getRadius();
|
|
51
|
-
return
|
|
52
|
-
<
|
|
53
|
-
|
|
54
|
-
|
|
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
|
+
);
|
|
55
64
|
}
|
|
56
65
|
|
|
57
66
|
getRadius(): number {
|
|
58
|
-
return
|
|
67
|
+
return 14;
|
|
59
68
|
}
|
|
60
69
|
}
|