bpmn-js 0.14.0 → 0.14.1
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.
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var find = require('lodash/collection/find'),
|
|
4
4
|
any = require('lodash/collection/any'),
|
|
5
|
+
filter = require('lodash/collection/filter'),
|
|
5
6
|
forEach = require('lodash/collection/forEach'),
|
|
6
7
|
inherits = require('inherits');
|
|
7
8
|
|
|
@@ -91,6 +92,13 @@ BpmnRules.prototype.init = function() {
|
|
|
91
92
|
return canAttach([ shape ], target, source, position) || canCreate(shape, target, source, position);
|
|
92
93
|
});
|
|
93
94
|
|
|
95
|
+
this.addRule([ 'elements.delete' ], function(context) {
|
|
96
|
+
|
|
97
|
+
// do not allow deletion of labels
|
|
98
|
+
return filter(context.elements, function(e) {
|
|
99
|
+
return !isLabel(e);
|
|
100
|
+
});
|
|
101
|
+
});
|
|
94
102
|
};
|
|
95
103
|
|
|
96
104
|
BpmnRules.prototype.canConnectMessageFlow = canConnectMessageFlow;
|
package/package.json
CHANGED
|
@@ -64,7 +64,7 @@ describe('features - context-pad', function() {
|
|
|
64
64
|
inject(function (elementRegistry, contextPad, customRules) {
|
|
65
65
|
|
|
66
66
|
// given
|
|
67
|
-
customRules.addRule('elements.delete', function() {
|
|
67
|
+
customRules.addRule('elements.delete', 1500, function() {
|
|
68
68
|
return true;
|
|
69
69
|
});
|
|
70
70
|
|
|
@@ -82,7 +82,7 @@ describe('features - context-pad', function() {
|
|
|
82
82
|
inject(function(elementRegistry, contextPad, customRules) {
|
|
83
83
|
|
|
84
84
|
// given
|
|
85
|
-
customRules.addRule('elements.delete', function() {
|
|
85
|
+
customRules.addRule('elements.delete', 1500, function() {
|
|
86
86
|
return false;
|
|
87
87
|
});
|
|
88
88
|
|
|
@@ -101,7 +101,7 @@ describe('features - context-pad', function() {
|
|
|
101
101
|
// given
|
|
102
102
|
var element = elementRegistry.get('StartEvent_1');
|
|
103
103
|
|
|
104
|
-
customRules.addRule('elements.delete', function(context) {
|
|
104
|
+
customRules.addRule('elements.delete', 1500, function(context) {
|
|
105
105
|
|
|
106
106
|
// element array is actually passed
|
|
107
107
|
expect(context.elements).to.eql([ element ]);
|
|
@@ -120,7 +120,7 @@ describe('features - context-pad', function() {
|
|
|
120
120
|
inject(function(elementRegistry, contextPad, customRules) {
|
|
121
121
|
|
|
122
122
|
// given
|
|
123
|
-
customRules.addRule('elements.delete', function(context) {
|
|
123
|
+
customRules.addRule('elements.delete', 1500, function(context) {
|
|
124
124
|
return context.elements;
|
|
125
125
|
});
|
|
126
126
|
|
|
@@ -138,7 +138,7 @@ describe('features - context-pad', function() {
|
|
|
138
138
|
inject(function(elementRegistry, contextPad, customRules) {
|
|
139
139
|
|
|
140
140
|
// given
|
|
141
|
-
customRules.addRule('elements.delete', function() {
|
|
141
|
+
customRules.addRule('elements.delete', 1500, function() {
|
|
142
142
|
return [];
|
|
143
143
|
});
|
|
144
144
|
|
|
@@ -1317,4 +1317,29 @@ describe('features/modeling/rules - BpmnRules', function() {
|
|
|
1317
1317
|
|
|
1318
1318
|
});
|
|
1319
1319
|
|
|
1320
|
+
|
|
1321
|
+
describe('labels', function() {
|
|
1322
|
+
|
|
1323
|
+
var testXML = require('./BpmnRules.process.bpmn');
|
|
1324
|
+
|
|
1325
|
+
beforeEach(bootstrapModeler(testXML, { modules: testModules }));
|
|
1326
|
+
|
|
1327
|
+
|
|
1328
|
+
it('should filter labels', inject(function(elementRegistry, rules) {
|
|
1329
|
+
|
|
1330
|
+
// given
|
|
1331
|
+
var startEventShape = elementRegistry.get('StartEvent_None'),
|
|
1332
|
+
startEventLabel = startEventShape.label;
|
|
1333
|
+
|
|
1334
|
+
// when
|
|
1335
|
+
var allowed = rules.allowed('elements.delete', {
|
|
1336
|
+
elements: [ startEventShape, startEventLabel ]
|
|
1337
|
+
});
|
|
1338
|
+
|
|
1339
|
+
// then
|
|
1340
|
+
expect(allowed).to.eql([ startEventShape ]);
|
|
1341
|
+
}));
|
|
1342
|
+
|
|
1343
|
+
});
|
|
1344
|
+
|
|
1320
1345
|
});
|
|
@@ -374,10 +374,15 @@ describe('features/snapping - BpmnSnapping', function() {
|
|
|
374
374
|
|
|
375
375
|
describe('on SubProcess resize', function() {
|
|
376
376
|
|
|
377
|
-
|
|
378
377
|
var diagramXML = require('./BpmnSnapping.subProcess-resize.bpmn');
|
|
379
378
|
|
|
380
|
-
var testResizeModules = [
|
|
379
|
+
var testResizeModules = [
|
|
380
|
+
coreModule,
|
|
381
|
+
modelingModule,
|
|
382
|
+
resizeModule,
|
|
383
|
+
rulesModule,
|
|
384
|
+
snappingModule
|
|
385
|
+
];
|
|
381
386
|
|
|
382
387
|
beforeEach(bootstrapModeler(diagramXML, { modules: testResizeModules }));
|
|
383
388
|
|
|
@@ -399,15 +404,20 @@ describe('features/snapping - BpmnSnapping', function() {
|
|
|
399
404
|
|
|
400
405
|
describe('on TextAnnotation resize', function() {
|
|
401
406
|
|
|
402
|
-
|
|
403
407
|
var diagramXML = require('./BpmnSnapping.textAnnotation-resize.bpmn');
|
|
404
408
|
|
|
405
|
-
var testResizeModules = [
|
|
409
|
+
var testResizeModules = [
|
|
410
|
+
coreModule,
|
|
411
|
+
modelingModule,
|
|
412
|
+
resizeModule,
|
|
413
|
+
rulesModule,
|
|
414
|
+
snappingModule
|
|
415
|
+
];
|
|
406
416
|
|
|
407
417
|
beforeEach(bootstrapModeler(diagramXML, { modules: testResizeModules }));
|
|
408
418
|
|
|
409
419
|
|
|
410
|
-
it('should snap
|
|
420
|
+
it('should snap to minimum bounds', inject(function(elementRegistry, resize, dragging) {
|
|
411
421
|
|
|
412
422
|
var textAnnotation = elementRegistry.get('TextAnnotation');
|
|
413
423
|
|