bpmn-js 0.20.6 → 0.20.7
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/.travis.yml +2 -0
- package/lib/features/copy-paste/BpmnCopyPaste.js +11 -2
- package/lib/features/modeling/BpmnUpdater.js +17 -13
- package/lib/features/modeling/behavior/ReplaceElementBehaviour.js +4 -2
- package/lib/features/rules/BpmnRules.js +23 -22
- package/package.json +20 -20
- package/test/spec/features/copy-paste/BpmnCopyPasteSpec.js +33 -0
- package/test/spec/features/rules/BpmnRulesSpec.js +44 -0
package/.travis.yml
CHANGED
|
@@ -30,7 +30,9 @@ function removeProperties(element, properties) {
|
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
function BpmnCopyPaste(
|
|
33
|
+
function BpmnCopyPaste(
|
|
34
|
+
bpmnFactory, eventBus, copyPaste,
|
|
35
|
+
clipboard, canvas, bpmnRules) {
|
|
34
36
|
|
|
35
37
|
var helper = new ModelCloneHelper(eventBus);
|
|
36
38
|
|
|
@@ -138,6 +140,14 @@ function BpmnCopyPaste(bpmnFactory, eventBus, copyPaste, clipboard, moddle, canv
|
|
|
138
140
|
'triggeredByEvent'
|
|
139
141
|
]);
|
|
140
142
|
});
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
eventBus.on('commandStack.elements.paste.postExecuted', function() {
|
|
146
|
+
// temporarily disable multi paste until #686
|
|
147
|
+
// is addressed
|
|
148
|
+
clipboard.clear();
|
|
149
|
+
});
|
|
150
|
+
|
|
141
151
|
}
|
|
142
152
|
|
|
143
153
|
|
|
@@ -146,7 +156,6 @@ BpmnCopyPaste.$inject = [
|
|
|
146
156
|
'eventBus',
|
|
147
157
|
'copyPaste',
|
|
148
158
|
'clipboard',
|
|
149
|
-
'moddle',
|
|
150
159
|
'canvas',
|
|
151
160
|
'bpmnRules'
|
|
152
161
|
];
|
|
@@ -74,19 +74,23 @@ function BpmnUpdater(eventBus, bpmnFactory, connectionDocking, translate) {
|
|
|
74
74
|
self.updateParent(element, oldParent);
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
this.executed([
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
77
|
+
this.executed([
|
|
78
|
+
'shape.move',
|
|
79
|
+
'shape.create',
|
|
80
|
+
'shape.delete',
|
|
81
|
+
'connection.create',
|
|
82
|
+
'connection.move',
|
|
83
|
+
'connection.delete'
|
|
84
|
+
], ifBpmn(updateParent));
|
|
85
|
+
|
|
86
|
+
this.reverted([
|
|
87
|
+
'shape.move',
|
|
88
|
+
'shape.create',
|
|
89
|
+
'shape.delete',
|
|
90
|
+
'connection.create',
|
|
91
|
+
'connection.move',
|
|
92
|
+
'connection.delete'
|
|
93
|
+
], ifBpmn(reverseUpdateParent));
|
|
90
94
|
|
|
91
95
|
/*
|
|
92
96
|
* ## Updating Parent
|
|
@@ -110,7 +110,9 @@ ReplaceElementBehaviour.prototype.replaceElements = function(elements, newElemen
|
|
|
110
110
|
}
|
|
111
111
|
};
|
|
112
112
|
|
|
113
|
-
ReplaceElementBehaviour.$inject = [
|
|
114
|
-
'
|
|
113
|
+
ReplaceElementBehaviour.$inject = [
|
|
114
|
+
'eventBus', 'bpmnReplace', 'bpmnRules',
|
|
115
|
+
'elementRegistry', 'selection', 'modeling'
|
|
116
|
+
];
|
|
115
117
|
|
|
116
118
|
module.exports = ReplaceElementBehaviour;
|
|
@@ -190,22 +190,6 @@ function isTextAnnotation(element) {
|
|
|
190
190
|
return is(element, 'bpmn:TextAnnotation');
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
-
function isArtifact(element) {
|
|
194
|
-
return isAny(element, [
|
|
195
|
-
'bpmn:DataObjectReference',
|
|
196
|
-
'bpmn:DataStoreReference',
|
|
197
|
-
'bpmn:Group',
|
|
198
|
-
'bpmn:TextAnnotation'
|
|
199
|
-
]);
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
function isDataObject(element) {
|
|
203
|
-
return isAny(element, [
|
|
204
|
-
'bpmn:DataObjectReference',
|
|
205
|
-
'bpmn:DataStoreReference'
|
|
206
|
-
]);
|
|
207
|
-
}
|
|
208
|
-
|
|
209
193
|
function isCompensationBoundary(element) {
|
|
210
194
|
return is(element, 'bpmn:BoundaryEvent') &&
|
|
211
195
|
hasEventDefinition(element, 'bpmn:CompensateEventDefinition');
|
|
@@ -714,6 +698,22 @@ function canResize(shape, newBounds) {
|
|
|
714
698
|
return false;
|
|
715
699
|
}
|
|
716
700
|
|
|
701
|
+
/**
|
|
702
|
+
* Check, whether one side of the relationship
|
|
703
|
+
* is a text annotation.
|
|
704
|
+
*/
|
|
705
|
+
function isOneTextAnnotation(source, target) {
|
|
706
|
+
|
|
707
|
+
var sourceTextAnnotation = isTextAnnotation(source),
|
|
708
|
+
targetTextAnnotation = isTextAnnotation(target);
|
|
709
|
+
|
|
710
|
+
return (
|
|
711
|
+
(sourceTextAnnotation || targetTextAnnotation) &&
|
|
712
|
+
(sourceTextAnnotation !== targetTextAnnotation)
|
|
713
|
+
);
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
|
|
717
717
|
function canConnectAssociation(source, target) {
|
|
718
718
|
|
|
719
719
|
// do not connect connections
|
|
@@ -726,12 +726,13 @@ function canConnectAssociation(source, target) {
|
|
|
726
726
|
return true;
|
|
727
727
|
}
|
|
728
728
|
|
|
729
|
-
//
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
729
|
+
// don't connect parent <-> child
|
|
730
|
+
if (isParent(target, source) || isParent(source, target)) {
|
|
731
|
+
return false;
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
// allow connection of associations between <!TextAnnotation> and <TextAnnotation>
|
|
735
|
+
return isOneTextAnnotation(source, target);
|
|
735
736
|
}
|
|
736
737
|
|
|
737
738
|
function canConnectMessageFlow(source, target) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bpmn-js",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.7",
|
|
4
4
|
"description": "A bpmn 2.0 toolkit and web modeler",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"all": "grunt",
|
|
@@ -37,34 +37,34 @@
|
|
|
37
37
|
"browserify": "^13.0.0",
|
|
38
38
|
"browserify-derequire": "^0.9.1",
|
|
39
39
|
"bundle-collapser": "^1.1.1",
|
|
40
|
-
"chai": "
|
|
41
|
-
"eslint": "^
|
|
42
|
-
"eslint-plugin-mocha": "^
|
|
40
|
+
"chai": "^3.5.0",
|
|
41
|
+
"eslint": "^3.19.0",
|
|
42
|
+
"eslint-plugin-mocha": "^4.9.0",
|
|
43
43
|
"grunt": "^0.4.4",
|
|
44
44
|
"grunt-cli": "^0.1.13",
|
|
45
45
|
"grunt-contrib-copy": "^0.7.0",
|
|
46
|
-
"grunt-eslint": "^
|
|
47
|
-
"grunt-karma": "^0.
|
|
46
|
+
"grunt-eslint": "^19.0.0",
|
|
47
|
+
"grunt-karma": "^2.0.0",
|
|
48
48
|
"grunt-release": "^0.7.0",
|
|
49
49
|
"jsondiffpatch": "^0.1.26",
|
|
50
|
-
"karma": "^
|
|
51
|
-
"karma-browserify": "^5.
|
|
50
|
+
"karma": "^1.7.0",
|
|
51
|
+
"karma-browserify": "^5.1.1",
|
|
52
52
|
"karma-chai": "^0.1.0",
|
|
53
|
-
"karma-chrome-launcher": "^
|
|
53
|
+
"karma-chrome-launcher": "^2.1.1",
|
|
54
54
|
"karma-env-preprocessor": "^0.1.1",
|
|
55
|
-
"karma-firefox-launcher": "^0.1
|
|
56
|
-
"karma-ie-launcher": "^0.
|
|
57
|
-
"karma-mocha": "
|
|
58
|
-
"karma-phantomjs-launcher": "^1.0.
|
|
59
|
-
"karma-safari-launcher": "^0.
|
|
60
|
-
"karma-sinon-chai": "
|
|
61
|
-
"karma-spec-reporter": "0.0.
|
|
55
|
+
"karma-firefox-launcher": "^1.0.1",
|
|
56
|
+
"karma-ie-launcher": "^1.0.0",
|
|
57
|
+
"karma-mocha": "^1.3.0",
|
|
58
|
+
"karma-phantomjs-launcher": "^1.0.4",
|
|
59
|
+
"karma-safari-launcher": "^1.0.0",
|
|
60
|
+
"karma-sinon-chai": "^1.3.1",
|
|
61
|
+
"karma-spec-reporter": "0.0.31",
|
|
62
62
|
"load-grunt-tasks": "^0.3.0",
|
|
63
|
-
"mocha": "^
|
|
63
|
+
"mocha": "^3.4.1",
|
|
64
64
|
"mocha-test-container-support": "0.2.0",
|
|
65
65
|
"phantomjs-prebuilt": "^2.1.12",
|
|
66
|
-
"sinon": "
|
|
67
|
-
"sinon-chai": "
|
|
66
|
+
"sinon": "^2.2.0",
|
|
67
|
+
"sinon-chai": "^2.10.0",
|
|
68
68
|
"source-map-concat": "^1.0.0",
|
|
69
69
|
"stringify": "^3.1.0",
|
|
70
70
|
"time-grunt": "^0.3.2",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
75
|
"bpmn-moddle": "^0.14.0",
|
|
76
|
-
"diagram-js": "^0.19.
|
|
76
|
+
"diagram-js": "^0.19.6",
|
|
77
77
|
"diagram-js-direct-editing": "^0.17.1",
|
|
78
78
|
"diagram-js-origin": "^0.15.1",
|
|
79
79
|
"ids": "^0.2.0",
|
|
@@ -58,6 +58,38 @@ describe('features/copy-paste', function() {
|
|
|
58
58
|
});
|
|
59
59
|
|
|
60
60
|
|
|
61
|
+
it('should forbid multi paste', inject(
|
|
62
|
+
function(elementRegistry, canvas, copyPaste) {
|
|
63
|
+
// given
|
|
64
|
+
var element = elementRegistry.get('SubProcess_1kd6ist'),
|
|
65
|
+
rootElement = canvas.getRootElement();
|
|
66
|
+
|
|
67
|
+
// when
|
|
68
|
+
copyPaste.copy(element);
|
|
69
|
+
|
|
70
|
+
copyPaste.paste({
|
|
71
|
+
element: rootElement,
|
|
72
|
+
point: {
|
|
73
|
+
x: 600,
|
|
74
|
+
y: 100
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
copyPaste.paste({
|
|
79
|
+
element: rootElement,
|
|
80
|
+
point: {
|
|
81
|
+
x: 600,
|
|
82
|
+
y: 275
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
// then
|
|
87
|
+
// pasted was only once
|
|
88
|
+
expect(rootElement.children).to.have.length(2);
|
|
89
|
+
}
|
|
90
|
+
));
|
|
91
|
+
|
|
92
|
+
|
|
61
93
|
describe('integration', function() {
|
|
62
94
|
|
|
63
95
|
it('should retain label\'s relative position',
|
|
@@ -489,6 +521,7 @@ describe('features/copy-paste', function() {
|
|
|
489
521
|
it('multiple participants', inject(integrationTest([ 'Participant_0pgdgt4', 'Participant_1id96b4' ])));
|
|
490
522
|
|
|
491
523
|
it('multiple participants', inject(integrationTest([ 'Participant_0pgdgt4', 'Participant_1id96b4' ])));
|
|
524
|
+
|
|
492
525
|
});
|
|
493
526
|
|
|
494
527
|
});
|
|
@@ -207,6 +207,50 @@ describe('features/modeling/rules - BpmnRules', function() {
|
|
|
207
207
|
}));
|
|
208
208
|
|
|
209
209
|
|
|
210
|
+
it('connect DataObjectReference -> TextAnnotation', inject(function() {
|
|
211
|
+
|
|
212
|
+
expectCanConnect('DataObjectReference', 'TextAnnotation', {
|
|
213
|
+
sequenceFlow: false,
|
|
214
|
+
messageFlow: false,
|
|
215
|
+
association: true,
|
|
216
|
+
dataAssociation: false
|
|
217
|
+
});
|
|
218
|
+
}));
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
it('connect TextAnnotation -> DataObjectReference', inject(function() {
|
|
222
|
+
|
|
223
|
+
expectCanConnect('TextAnnotation', 'DataObjectReference', {
|
|
224
|
+
sequenceFlow: false,
|
|
225
|
+
messageFlow: false,
|
|
226
|
+
association: true,
|
|
227
|
+
dataAssociation: false
|
|
228
|
+
});
|
|
229
|
+
}));
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
it('connect DataStoreReference -> TextAnnotation', inject(function() {
|
|
233
|
+
|
|
234
|
+
expectCanConnect('DataStoreReference', 'TextAnnotation', {
|
|
235
|
+
sequenceFlow: false,
|
|
236
|
+
messageFlow: false,
|
|
237
|
+
association: true,
|
|
238
|
+
dataAssociation: false
|
|
239
|
+
});
|
|
240
|
+
}));
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
it('connect TextAnnotation -> DataStoreReference', inject(function() {
|
|
244
|
+
|
|
245
|
+
expectCanConnect('TextAnnotation', 'DataStoreReference', {
|
|
246
|
+
sequenceFlow: false,
|
|
247
|
+
messageFlow: false,
|
|
248
|
+
association: true,
|
|
249
|
+
dataAssociation: false
|
|
250
|
+
});
|
|
251
|
+
}));
|
|
252
|
+
|
|
253
|
+
|
|
210
254
|
it('connect StartEvent_None -> DataStoreReference', inject(function() {
|
|
211
255
|
|
|
212
256
|
expectCanConnect('StartEvent_None', 'DataStoreReference', {
|