bpmn-js 9.1.0 → 9.2.2
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/CHANGELOG.md +34 -0
- package/dist/assets/diagram-js.css +47 -35
- package/dist/bpmn-modeler.development.js +56707 -56636
- package/dist/bpmn-modeler.production.min.js +28 -28
- package/dist/bpmn-navigated-viewer.development.js +21591 -21939
- package/dist/bpmn-navigated-viewer.production.min.js +20 -20
- package/dist/bpmn-viewer.development.js +20785 -21133
- package/dist/bpmn-viewer.production.min.js +20 -20
- package/lib/BaseModeler.js +1 -1
- package/lib/BaseViewer.js +1 -1
- package/lib/Modeler.js +1 -1
- package/lib/NavigatedViewer.js +1 -1
- package/lib/Viewer.js +1 -1
- package/lib/draw/BpmnRenderUtil.js +3 -1
- package/lib/draw/BpmnRenderer.js +11 -9
- package/lib/features/auto-place/BpmnAutoPlaceUtil.js +10 -0
- package/lib/features/auto-resize/BpmnAutoResize.js +1 -1
- package/lib/features/auto-resize/BpmnAutoResizeProvider.js +1 -1
- package/lib/features/context-pad/ContextPadProvider.js +57 -3
- package/lib/features/copy-paste/ModdleCopy.js +0 -2
- package/lib/features/drilldown/DrilldownOverlayBehavior.js +1 -1
- package/lib/features/editor-actions/BpmnEditorActions.js +1 -1
- package/lib/features/grid-snapping/behavior/LayoutConnectionBehavior.js +1 -1
- package/lib/features/keyboard/BpmnKeyboardBindings.js +1 -1
- package/lib/features/label-editing/LabelEditingProvider.js +12 -0
- package/lib/features/modeling/BpmnLayouter.js +1 -1
- package/lib/features/modeling/BpmnUpdater.js +1 -1
- package/lib/features/modeling/ElementFactory.js +1 -1
- package/lib/features/modeling/Modeling.js +1 -1
- package/lib/features/modeling/behavior/AdaptiveLabelPositioningBehavior.js +1 -1
- package/lib/features/modeling/behavior/AppendBehavior.js +1 -1
- package/lib/features/modeling/behavior/AssociationBehavior.js +1 -1
- package/lib/features/modeling/behavior/AttachEventBehavior.js +1 -1
- package/lib/features/modeling/behavior/BoundaryEventBehavior.js +1 -1
- package/lib/features/modeling/behavior/CreateBehavior.js +1 -1
- package/lib/features/modeling/behavior/CreateDataObjectBehavior.js +1 -1
- package/lib/features/modeling/behavior/CreateParticipantBehavior.js +1 -1
- package/lib/features/modeling/behavior/DataInputAssociationBehavior.js +1 -1
- package/lib/features/modeling/behavior/DataStoreBehavior.js +1 -1
- package/lib/features/modeling/behavior/DeleteLaneBehavior.js +1 -1
- package/lib/features/modeling/behavior/DetachEventBehavior.js +1 -1
- package/lib/features/modeling/behavior/DropOnFlowBehavior.js +1 -1
- package/lib/features/modeling/behavior/EventBasedGatewayBehavior.js +1 -1
- package/lib/features/modeling/behavior/GroupBehavior.js +1 -1
- package/lib/features/modeling/behavior/IsHorizontalFix.js +1 -1
- package/lib/features/modeling/behavior/LabelBehavior.js +1 -1
- package/lib/features/modeling/behavior/LayoutConnectionBehavior.js +117 -0
- package/lib/features/modeling/behavior/MessageFlowBehavior.js +1 -1
- package/lib/features/modeling/behavior/RemoveElementBehavior.js +1 -1
- package/lib/features/modeling/behavior/RemoveEmbeddedLabelBoundsBehavior.js +1 -1
- package/lib/features/modeling/behavior/RemoveParticipantBehavior.js +1 -1
- package/lib/features/modeling/behavior/ReplaceConnectionBehavior.js +1 -1
- package/lib/features/modeling/behavior/ReplaceElementBehaviour.js +1 -1
- package/lib/features/modeling/behavior/RootElementReferenceBehavior.js +1 -1
- package/lib/features/modeling/behavior/SubProcessPlaneBehavior.js +1 -1
- package/lib/features/modeling/behavior/SubProcessStartEventBehavior.js +1 -1
- package/lib/features/modeling/behavior/ToggleCollapseConnectionBehaviour.js +1 -1
- package/lib/features/modeling/behavior/ToggleElementCollapseBehaviour.js +1 -1
- package/lib/features/modeling/behavior/UnclaimIdBehavior.js +1 -1
- package/lib/features/modeling/behavior/UnsetDefaultFlowBehavior.js +1 -1
- package/lib/features/modeling/behavior/UpdateFlowNodeRefsBehavior.js +1 -1
- package/lib/features/modeling/behavior/index.js +3 -0
- package/lib/features/modeling/behavior/util/ConnectionLayoutUtil.js +16 -0
- package/lib/features/modeling/behavior/util/GeometricUtil.js +1 -121
- package/lib/features/modeling/behavior/util/LabelLayoutUtil.js +3 -192
- package/lib/features/modeling/behavior/util/LayoutUtil.js +230 -0
- package/lib/features/modeling/cmd/SetColorHandler.js +6 -2
- package/lib/features/ordering/BpmnOrderingProvider.js +1 -1
- package/lib/features/popup-menu/ReplaceMenuProvider.js +7 -6
- package/lib/features/replace-preview/BpmnReplacePreview.js +1 -1
- package/lib/features/rules/BpmnRules.js +1 -6
- package/lib/features/snapping/BpmnCreateMoveSnapping.js +1 -1
- package/package.json +4 -4
- package/test/util/custom-rules/CustomRules.js +1 -1
package/lib/BaseModeler.js
CHANGED
package/lib/BaseViewer.js
CHANGED
package/lib/Modeler.js
CHANGED
package/lib/NavigatedViewer.js
CHANGED
package/lib/Viewer.js
CHANGED
|
@@ -14,6 +14,8 @@ import {
|
|
|
14
14
|
// re-export getDi for compatibility
|
|
15
15
|
export { getDi };
|
|
16
16
|
|
|
17
|
+
export var black = 'hsl(225, 10%, 15%)';
|
|
18
|
+
|
|
17
19
|
// element utils //////////////////////
|
|
18
20
|
|
|
19
21
|
/**
|
|
@@ -64,7 +66,7 @@ export function getFillColor(element, defaultColor) {
|
|
|
64
66
|
export function getStrokeColor(element, defaultColor) {
|
|
65
67
|
var di = getDi(element);
|
|
66
68
|
|
|
67
|
-
return di.get('color:border-color') || di.get('bioc:stroke') || defaultColor ||
|
|
69
|
+
return di.get('color:border-color') || di.get('bioc:stroke') || defaultColor || black;
|
|
68
70
|
}
|
|
69
71
|
|
|
70
72
|
export function getLabelColor(element, defaultColor, defaultStrokeColor) {
|
package/lib/draw/BpmnRenderer.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import inherits from 'inherits';
|
|
1
|
+
import inherits from 'inherits-browser';
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
isObject,
|
|
@@ -57,6 +57,8 @@ import {
|
|
|
57
57
|
|
|
58
58
|
import Ids from 'ids';
|
|
59
59
|
|
|
60
|
+
import { black } from './BpmnRenderUtil';
|
|
61
|
+
|
|
60
62
|
var RENDERER_IDS = new Ids();
|
|
61
63
|
|
|
62
64
|
var TASK_BORDER_RADIUS = 10;
|
|
@@ -85,7 +87,7 @@ export default function BpmnRenderer(
|
|
|
85
87
|
|
|
86
88
|
function addMarker(id, options) {
|
|
87
89
|
var attrs = assign({
|
|
88
|
-
fill:
|
|
90
|
+
fill: black,
|
|
89
91
|
strokeWidth: 1,
|
|
90
92
|
strokeLinecap: 'round',
|
|
91
93
|
strokeDasharray: 'none'
|
|
@@ -264,7 +266,7 @@ export default function BpmnRenderer(
|
|
|
264
266
|
offset = offset || 0;
|
|
265
267
|
|
|
266
268
|
attrs = computeStyle(attrs, {
|
|
267
|
-
stroke:
|
|
269
|
+
stroke: black,
|
|
268
270
|
strokeWidth: 2,
|
|
269
271
|
fill: 'white'
|
|
270
272
|
});
|
|
@@ -299,7 +301,7 @@ export default function BpmnRenderer(
|
|
|
299
301
|
offset = offset || 0;
|
|
300
302
|
|
|
301
303
|
attrs = computeStyle(attrs, {
|
|
302
|
-
stroke:
|
|
304
|
+
stroke: black,
|
|
303
305
|
strokeWidth: 2,
|
|
304
306
|
fill: 'white'
|
|
305
307
|
});
|
|
@@ -332,7 +334,7 @@ export default function BpmnRenderer(
|
|
|
332
334
|
}).join(' ');
|
|
333
335
|
|
|
334
336
|
attrs = computeStyle(attrs, {
|
|
335
|
-
stroke:
|
|
337
|
+
stroke: black,
|
|
336
338
|
strokeWidth: 2,
|
|
337
339
|
fill: 'white'
|
|
338
340
|
});
|
|
@@ -350,7 +352,7 @@ export default function BpmnRenderer(
|
|
|
350
352
|
|
|
351
353
|
function drawLine(parentGfx, waypoints, attrs) {
|
|
352
354
|
attrs = computeStyle(attrs, [ 'no-fill' ], {
|
|
353
|
-
stroke:
|
|
355
|
+
stroke: black,
|
|
354
356
|
strokeWidth: 2,
|
|
355
357
|
fill: 'none'
|
|
356
358
|
});
|
|
@@ -366,7 +368,7 @@ export default function BpmnRenderer(
|
|
|
366
368
|
|
|
367
369
|
attrs = computeStyle(attrs, [ 'no-fill' ], {
|
|
368
370
|
strokeWidth: 2,
|
|
369
|
-
stroke:
|
|
371
|
+
stroke: black
|
|
370
372
|
});
|
|
371
373
|
|
|
372
374
|
var path = svgCreate('path');
|
|
@@ -1471,7 +1473,7 @@ export default function BpmnRenderer(
|
|
|
1471
1473
|
|
|
1472
1474
|
if (di.messageVisibleKind === 'initiating') {
|
|
1473
1475
|
messageAttrs.fill = 'white';
|
|
1474
|
-
messageAttrs.stroke =
|
|
1476
|
+
messageAttrs.stroke = black;
|
|
1475
1477
|
} else {
|
|
1476
1478
|
messageAttrs.fill = '#888';
|
|
1477
1479
|
messageAttrs.stroke = 'white';
|
|
@@ -1546,7 +1548,7 @@ export default function BpmnRenderer(
|
|
|
1546
1548
|
|
|
1547
1549
|
/* output arrow path */ drawPath(parentGfx, arrowPathData, {
|
|
1548
1550
|
strokeWidth: 1,
|
|
1549
|
-
fill:
|
|
1551
|
+
fill: black
|
|
1550
1552
|
});
|
|
1551
1553
|
|
|
1552
1554
|
return elementObject;
|
|
@@ -104,6 +104,12 @@ export function getTextAnnotationPosition(source, element) {
|
|
|
104
104
|
y: sourceTrbl.top - 50 - element.height / 2
|
|
105
105
|
};
|
|
106
106
|
|
|
107
|
+
if (isConnection(source)) {
|
|
108
|
+
position = getMid(source);
|
|
109
|
+
position.x += 100;
|
|
110
|
+
position.y -= 50;
|
|
111
|
+
}
|
|
112
|
+
|
|
107
113
|
var nextPositionDirection = {
|
|
108
114
|
y: {
|
|
109
115
|
margin: -30,
|
|
@@ -135,4 +141,8 @@ export function getDataElementPosition(source, element) {
|
|
|
135
141
|
};
|
|
136
142
|
|
|
137
143
|
return findFreePosition(source, element, position, generateGetNextPosition(nextPositionDirection));
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function isConnection(element) {
|
|
147
|
+
return !!element.waypoints;
|
|
138
148
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
assign,
|
|
3
3
|
forEach,
|
|
4
|
-
isArray
|
|
4
|
+
isArray,
|
|
5
|
+
every
|
|
5
6
|
} from 'min-dash';
|
|
6
7
|
|
|
7
8
|
import {
|
|
@@ -86,9 +87,49 @@ ContextPadProvider.$inject = [
|
|
|
86
87
|
'translate'
|
|
87
88
|
];
|
|
88
89
|
|
|
90
|
+
ContextPadProvider.prototype.getMultiElementContextPadEntries = function(elements) {
|
|
91
|
+
var modeling = this._modeling;
|
|
89
92
|
|
|
90
|
-
|
|
93
|
+
var actions = {};
|
|
94
|
+
|
|
95
|
+
if (this._isDeleteAllowed(elements)) {
|
|
96
|
+
assign(actions, {
|
|
97
|
+
'delete': {
|
|
98
|
+
group: 'edit',
|
|
99
|
+
className: 'bpmn-icon-trash',
|
|
100
|
+
title: this._translate('Remove'),
|
|
101
|
+
action: {
|
|
102
|
+
click: function(event, elements) {
|
|
103
|
+
modeling.removeElements(elements.slice());
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
}
|
|
91
109
|
|
|
110
|
+
return actions;
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* @param {djs.model.Base[]} elements
|
|
115
|
+
* @return {boolean}
|
|
116
|
+
*/
|
|
117
|
+
ContextPadProvider.prototype._isDeleteAllowed = function(elements) {
|
|
118
|
+
|
|
119
|
+
var baseAllowed = this._rules.allowed('elements.delete', {
|
|
120
|
+
elements: elements
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
if (isArray(baseAllowed)) {
|
|
124
|
+
return every(baseAllowed, function(element) {
|
|
125
|
+
return includes(baseAllowed, element);
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return baseAllowed;
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
|
92
133
|
var contextPad = this._contextPad,
|
|
93
134
|
modeling = this._modeling,
|
|
94
135
|
|
|
@@ -113,7 +154,7 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
|
|
113
154
|
connect.start(event, element);
|
|
114
155
|
}
|
|
115
156
|
|
|
116
|
-
function removeElement(e) {
|
|
157
|
+
function removeElement(e, element) {
|
|
117
158
|
modeling.removeElements([ element ]);
|
|
118
159
|
}
|
|
119
160
|
|
|
@@ -362,6 +403,15 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
|
|
362
403
|
});
|
|
363
404
|
}
|
|
364
405
|
|
|
406
|
+
if (is(businessObject, 'bpmn:SequenceFlow')) {
|
|
407
|
+
assign(actions, {
|
|
408
|
+
'append.text-annotation': appendAction(
|
|
409
|
+
'bpmn:TextAnnotation',
|
|
410
|
+
'bpmn-icon-text-annotation'
|
|
411
|
+
)
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
|
|
365
415
|
if (
|
|
366
416
|
isAny(businessObject, [
|
|
367
417
|
'bpmn:FlowNode',
|
|
@@ -470,3 +520,7 @@ function isEventType(eventBo, type, definition) {
|
|
|
470
520
|
|
|
471
521
|
return isType && isDefinition;
|
|
472
522
|
}
|
|
523
|
+
|
|
524
|
+
function includes(array, item) {
|
|
525
|
+
return array.indexOf(item) !== -1;
|
|
526
|
+
}
|
|
@@ -25,6 +25,8 @@ import {
|
|
|
25
25
|
isLabel
|
|
26
26
|
} from '../../util/LabelUtil';
|
|
27
27
|
|
|
28
|
+
var HIGH_PRIORITY = 2000;
|
|
29
|
+
|
|
28
30
|
|
|
29
31
|
export default function LabelEditingProvider(
|
|
30
32
|
eventBus, bpmnFactory, canvas, directEditing,
|
|
@@ -58,6 +60,16 @@ export default function LabelEditingProvider(
|
|
|
58
60
|
}
|
|
59
61
|
});
|
|
60
62
|
|
|
63
|
+
eventBus.on([
|
|
64
|
+
'shape.remove',
|
|
65
|
+
'connection.remove'
|
|
66
|
+
], HIGH_PRIORITY, function(event) {
|
|
67
|
+
|
|
68
|
+
if (directEditing.isActive(event.element)) {
|
|
69
|
+
directEditing.cancel();
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
|
|
61
73
|
// cancel on command stack changes
|
|
62
74
|
eventBus.on([ 'commandStack.changed' ], function(e) {
|
|
63
75
|
if (directEditing.isActive()) {
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import {
|
|
2
|
+
assign
|
|
3
|
+
} from 'min-dash';
|
|
4
|
+
|
|
5
|
+
import inherits from 'inherits-browser';
|
|
6
|
+
|
|
7
|
+
import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
|
|
8
|
+
|
|
9
|
+
import { getConnectionAdjustment as getConnectionAnchorPoint } from './util/ConnectionLayoutUtil';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* A component that makes sure that Associations connected to Connections
|
|
13
|
+
* are updated together with the Connection.
|
|
14
|
+
*
|
|
15
|
+
* @param {EventBus} eventBus
|
|
16
|
+
* @param {Modeling} modeling
|
|
17
|
+
*/
|
|
18
|
+
export default function LayoutConnectionBehavior(
|
|
19
|
+
eventBus, modeling) {
|
|
20
|
+
|
|
21
|
+
CommandInterceptor.call(this, eventBus);
|
|
22
|
+
|
|
23
|
+
function getnewAnchorPoint(event, point) {
|
|
24
|
+
|
|
25
|
+
var context = event.context,
|
|
26
|
+
connection = context.connection,
|
|
27
|
+
hints = assign({}, context.hints),
|
|
28
|
+
newWaypoints = context.newWaypoints || connection.waypoints,
|
|
29
|
+
oldWaypoints = context.oldWaypoints;
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
if (typeof hints.startChanged === 'undefined') {
|
|
33
|
+
hints.startChanged = !!hints.connectionStart;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (typeof hints.endChanged === 'undefined') {
|
|
37
|
+
hints.endChanged = !!hints.connectionEnd;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return getConnectionAnchorPoint(point, newWaypoints, oldWaypoints, hints);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
this.postExecute([
|
|
44
|
+
'connection.layout',
|
|
45
|
+
'connection.updateWaypoints'
|
|
46
|
+
], function(event) {
|
|
47
|
+
var context = event.context;
|
|
48
|
+
|
|
49
|
+
var connection = context.connection,
|
|
50
|
+
outgoing = connection.outgoing,
|
|
51
|
+
incoming = connection.incoming;
|
|
52
|
+
|
|
53
|
+
incoming.forEach(function(connection) {
|
|
54
|
+
var endPoint = connection.waypoints[connection.waypoints.length - 1];
|
|
55
|
+
var newEndpoint = getnewAnchorPoint(event, endPoint);
|
|
56
|
+
|
|
57
|
+
var newWaypoints = [].concat(connection.waypoints.slice(0, -1), [ newEndpoint ]);
|
|
58
|
+
|
|
59
|
+
modeling.updateWaypoints(connection, newWaypoints);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
outgoing.forEach(function(connection) {
|
|
63
|
+
var startpoint = connection.waypoints[0];
|
|
64
|
+
var newStartpoint = getnewAnchorPoint(event, startpoint);
|
|
65
|
+
|
|
66
|
+
var newWaypoints = [].concat([ newStartpoint ], connection.waypoints.slice(1));
|
|
67
|
+
|
|
68
|
+
modeling.updateWaypoints(connection, newWaypoints);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
this.postExecute([
|
|
75
|
+
'connection.move'
|
|
76
|
+
], function(event) {
|
|
77
|
+
var context = event.context;
|
|
78
|
+
|
|
79
|
+
var connection = context.connection,
|
|
80
|
+
outgoing = connection.outgoing,
|
|
81
|
+
incoming = connection.incoming,
|
|
82
|
+
delta = context.delta;
|
|
83
|
+
|
|
84
|
+
incoming.forEach(function(connection) {
|
|
85
|
+
var endPoint = connection.waypoints[connection.waypoints.length - 1];
|
|
86
|
+
var newEndpoint = {
|
|
87
|
+
x: endPoint.x + delta.x,
|
|
88
|
+
y: endPoint.y + delta.y
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
var newWaypoints = [].concat(connection.waypoints.slice(0, -1), [ newEndpoint ]);
|
|
92
|
+
|
|
93
|
+
modeling.updateWaypoints(connection, newWaypoints);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
outgoing.forEach(function(connection) {
|
|
97
|
+
var startpoint = connection.waypoints[0];
|
|
98
|
+
var newStartpoint = {
|
|
99
|
+
x: startpoint.x + delta.x,
|
|
100
|
+
y: startpoint.y + delta.y
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
var newWaypoints = [].concat([ newStartpoint ], connection.waypoints.slice(1));
|
|
104
|
+
|
|
105
|
+
modeling.updateWaypoints(connection, newWaypoints);
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
inherits(LayoutConnectionBehavior, CommandInterceptor);
|
|
113
|
+
|
|
114
|
+
LayoutConnectionBehavior.$inject = [
|
|
115
|
+
'eventBus',
|
|
116
|
+
'modeling'
|
|
117
|
+
];
|