bpmn-js 9.3.2 → 10.0.0-alpha.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.
- package/CHANGELOG.md +11 -0
- package/dist/assets/diagram-js.css +18 -8
- package/dist/bpmn-modeler.development.js +533 -356
- package/dist/bpmn-modeler.production.min.js +6 -6
- package/dist/bpmn-navigated-viewer.development.js +78 -73
- package/dist/bpmn-navigated-viewer.production.min.js +6 -6
- package/dist/bpmn-viewer.development.js +20 -17
- package/dist/bpmn-viewer.production.min.js +6 -6
- package/lib/features/copy-paste/BpmnCopyPaste.js +75 -69
- package/lib/features/copy-paste/ModdleCopy.js +26 -13
- package/lib/features/grid-snapping/behavior/{AutoPlaceBehavior.js → GridSnappingAutoPlaceBehavior.js} +2 -2
- package/lib/features/grid-snapping/behavior/{LayoutConnectionBehavior.js → GridSnappingLayoutConnectionBehavior.js} +4 -4
- package/lib/features/grid-snapping/behavior/{CreateParticipantBehavior.js → GridSnappingParticipantBehavior.js} +2 -2
- package/lib/features/grid-snapping/behavior/index.js +7 -7
- package/lib/features/label-editing/LabelEditingProvider.js +0 -22
- package/lib/features/modeling/ElementFactory.js +18 -8
- package/lib/features/modeling/behavior/BoundaryEventBehavior.js +1 -16
- package/lib/features/modeling/behavior/GroupBehavior.js +205 -93
- package/lib/features/modeling/behavior/ResizeBehavior.js +2 -0
- package/lib/features/modeling/behavior/RootElementReferenceBehavior.js +7 -8
- package/lib/features/modeling/behavior/SpaceToolBehavior.js +5 -0
- package/lib/features/modeling/behavior/util/CategoryUtil.js +66 -13
- package/lib/features/modeling/cmd/UpdateModdlePropertiesHandler.js +3 -0
- package/package.json +2 -2
|
@@ -24,67 +24,52 @@ function copyProperties(source, target, properties) {
|
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
function removeProperties(element, properties) {
|
|
28
|
-
if (!isArray(properties)) {
|
|
29
|
-
properties = [ properties ];
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
forEach(properties, function(property) {
|
|
33
|
-
if (element[property]) {
|
|
34
|
-
delete element[property];
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
|
|
39
27
|
var LOW_PRIORITY = 750;
|
|
40
28
|
|
|
41
29
|
|
|
42
30
|
export default function BpmnCopyPaste(bpmnFactory, eventBus, moddleCopy) {
|
|
43
31
|
|
|
44
|
-
|
|
45
|
-
var
|
|
46
|
-
element = context.element;
|
|
32
|
+
function copy(bo, clone) {
|
|
33
|
+
var targetBo = bpmnFactory.create(bo.$type);
|
|
47
34
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
descriptor.type = element.type;
|
|
52
|
-
|
|
53
|
-
copyProperties(businessObject, descriptor, 'name');
|
|
35
|
+
return moddleCopy.copyElement(bo, targetBo, null, clone);
|
|
36
|
+
}
|
|
54
37
|
|
|
55
|
-
|
|
38
|
+
eventBus.on('copyPaste.copyElement', LOW_PRIORITY, function(context) {
|
|
39
|
+
var descriptor = context.descriptor,
|
|
40
|
+
element = context.element,
|
|
41
|
+
businessObject = getBusinessObject(element);
|
|
56
42
|
|
|
57
|
-
|
|
43
|
+
// do not copy business object + di for labels;
|
|
44
|
+
// will be pulled from the referenced label target
|
|
45
|
+
if (isLabel(element)) {
|
|
58
46
|
return descriptor;
|
|
59
47
|
}
|
|
60
48
|
|
|
49
|
+
var businessObjectCopy = descriptor.businessObject = copy(businessObject, true);
|
|
50
|
+
var diCopy = descriptor.di = copy(getDi(element), true);
|
|
51
|
+
diCopy.bpmnElement = businessObjectCopy;
|
|
52
|
+
|
|
53
|
+
copyProperties(businessObjectCopy, descriptor, 'name');
|
|
54
|
+
copyProperties(diCopy, descriptor, 'isExpanded');
|
|
55
|
+
|
|
61
56
|
// default sequence flow
|
|
62
57
|
if (businessObject.default) {
|
|
63
58
|
descriptor.default = businessObject.default.id;
|
|
64
59
|
}
|
|
65
60
|
});
|
|
66
61
|
|
|
67
|
-
|
|
68
|
-
var parent = context.parent,
|
|
69
|
-
property = context.property,
|
|
70
|
-
propertyName = context.propertyName,
|
|
71
|
-
bpmnProcess;
|
|
72
|
-
|
|
73
|
-
if (
|
|
74
|
-
propertyName === 'processRef' &&
|
|
75
|
-
is(parent, 'bpmn:Participant') &&
|
|
76
|
-
is(property, 'bpmn:Process')
|
|
77
|
-
) {
|
|
78
|
-
bpmnProcess = bpmnFactory.create('bpmn:Process');
|
|
79
|
-
|
|
80
|
-
// return copy of process
|
|
81
|
-
return moddleCopy.copyElement(property, bpmnProcess);
|
|
82
|
-
}
|
|
83
|
-
});
|
|
62
|
+
var referencesKey = '-bpmn-js-refs';
|
|
84
63
|
|
|
85
|
-
|
|
64
|
+
function getReferences(cache) {
|
|
65
|
+
return (cache[referencesKey] = cache[referencesKey] || {});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function setReferences(cache, references) {
|
|
69
|
+
cache[referencesKey] = references;
|
|
70
|
+
}
|
|
86
71
|
|
|
87
|
-
function resolveReferences(descriptor, cache) {
|
|
72
|
+
function resolveReferences(descriptor, cache, references) {
|
|
88
73
|
var businessObject = getBusinessObject(descriptor);
|
|
89
74
|
|
|
90
75
|
// default sequence flows
|
|
@@ -104,7 +89,7 @@ export default function BpmnCopyPaste(bpmnFactory, eventBus, moddleCopy) {
|
|
|
104
89
|
getBusinessObject(descriptor).attachedToRef = getBusinessObject(cache[ descriptor.host ]);
|
|
105
90
|
}
|
|
106
91
|
|
|
107
|
-
|
|
92
|
+
return omit(references, reduce(references, function(array, reference, key) {
|
|
108
93
|
var element = reference.element,
|
|
109
94
|
property = reference.property;
|
|
110
95
|
|
|
@@ -118,18 +103,13 @@ export default function BpmnCopyPaste(bpmnFactory, eventBus, moddleCopy) {
|
|
|
118
103
|
}, []));
|
|
119
104
|
}
|
|
120
105
|
|
|
121
|
-
eventBus.on('copyPaste.pasteElements', function() {
|
|
122
|
-
references = {};
|
|
123
|
-
});
|
|
124
|
-
|
|
125
106
|
eventBus.on('copyPaste.pasteElement', function(context) {
|
|
126
107
|
var cache = context.cache,
|
|
127
108
|
descriptor = context.descriptor,
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
newBusinessObject, newDi;
|
|
109
|
+
businessObject = descriptor.businessObject,
|
|
110
|
+
di = descriptor.di;
|
|
131
111
|
|
|
132
|
-
//
|
|
112
|
+
// wire existing di + businessObject for external label
|
|
133
113
|
if (isLabel(descriptor)) {
|
|
134
114
|
descriptor.businessObject = getBusinessObject(cache[ descriptor.labelTarget ]);
|
|
135
115
|
descriptor.di = getDi(cache[ descriptor.labelTarget ]);
|
|
@@ -137,30 +117,56 @@ export default function BpmnCopyPaste(bpmnFactory, eventBus, moddleCopy) {
|
|
|
137
117
|
return;
|
|
138
118
|
}
|
|
139
119
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
descriptor.businessObject = moddleCopy.copyElement(
|
|
143
|
-
oldBusinessObject,
|
|
144
|
-
newBusinessObject
|
|
145
|
-
);
|
|
146
|
-
|
|
147
|
-
newDi = bpmnFactory.create(oldDi.$type);
|
|
148
|
-
newDi.bpmnElement = newBusinessObject;
|
|
149
|
-
|
|
150
|
-
descriptor.di = moddleCopy.copyElement(
|
|
151
|
-
oldDi,
|
|
152
|
-
newDi
|
|
153
|
-
);
|
|
120
|
+
businessObject = descriptor.businessObject = copy(businessObject);
|
|
154
121
|
|
|
155
|
-
|
|
156
|
-
|
|
122
|
+
di = descriptor.di = copy(di);
|
|
123
|
+
di.bpmnElement = businessObject;
|
|
157
124
|
|
|
158
|
-
copyProperties(descriptor,
|
|
125
|
+
copyProperties(descriptor, businessObject, [
|
|
159
126
|
'isExpanded',
|
|
160
127
|
'name'
|
|
161
128
|
]);
|
|
162
129
|
|
|
163
|
-
|
|
130
|
+
descriptor.type = businessObject.$type;
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
// copy + paste processRef with participant
|
|
134
|
+
|
|
135
|
+
eventBus.on('copyPaste.copyElement', LOW_PRIORITY, function(context) {
|
|
136
|
+
var descriptor = context.descriptor,
|
|
137
|
+
element = context.element;
|
|
138
|
+
|
|
139
|
+
if (!is(element, 'bpmn:Participant')) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
var participantBo = getBusinessObject(element);
|
|
144
|
+
|
|
145
|
+
if (participantBo.processRef) {
|
|
146
|
+
descriptor.processRef = copy(participantBo.processRef, true);
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
eventBus.on('copyPaste.pasteElement', function(context) {
|
|
151
|
+
var descriptor = context.descriptor,
|
|
152
|
+
processRef = descriptor.processRef;
|
|
153
|
+
|
|
154
|
+
if (processRef) {
|
|
155
|
+
descriptor.processRef = copy(processRef);
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
// resolve references
|
|
160
|
+
|
|
161
|
+
eventBus.on('copyPaste.pasteElement', LOW_PRIORITY, function(context) {
|
|
162
|
+
var cache = context.cache,
|
|
163
|
+
descriptor = context.descriptor;
|
|
164
|
+
|
|
165
|
+
// resolve references e.g. default sequence flow
|
|
166
|
+
setReferences(
|
|
167
|
+
cache,
|
|
168
|
+
resolveReferences(descriptor, cache, getReferences(cache))
|
|
169
|
+
);
|
|
164
170
|
});
|
|
165
171
|
|
|
166
172
|
}
|
|
@@ -18,7 +18,8 @@ var DISALLOWED_PROPERTIES = [
|
|
|
18
18
|
'flowElements',
|
|
19
19
|
'lanes',
|
|
20
20
|
'incoming',
|
|
21
|
-
'outgoing'
|
|
21
|
+
'outgoing',
|
|
22
|
+
'categoryValue'
|
|
22
23
|
];
|
|
23
24
|
|
|
24
25
|
/**
|
|
@@ -127,10 +128,11 @@ ModdleCopy.$inject = [
|
|
|
127
128
|
* @param {ModdleElement} sourceElement
|
|
128
129
|
* @param {ModdleElement} targetElement
|
|
129
130
|
* @param {Array<string>} [propertyNames]
|
|
131
|
+
* @param {boolean} clone
|
|
130
132
|
*
|
|
131
133
|
* @param {ModdleElement}
|
|
132
134
|
*/
|
|
133
|
-
ModdleCopy.prototype.copyElement = function(sourceElement, targetElement, propertyNames) {
|
|
135
|
+
ModdleCopy.prototype.copyElement = function(sourceElement, targetElement, propertyNames, clone) {
|
|
134
136
|
var self = this;
|
|
135
137
|
|
|
136
138
|
if (propertyNames && !isArray(propertyNames)) {
|
|
@@ -142,7 +144,8 @@ ModdleCopy.prototype.copyElement = function(sourceElement, targetElement, proper
|
|
|
142
144
|
var canCopyProperties = this._eventBus.fire('moddleCopy.canCopyProperties', {
|
|
143
145
|
propertyNames: propertyNames,
|
|
144
146
|
sourceElement: sourceElement,
|
|
145
|
-
targetElement: targetElement
|
|
147
|
+
targetElement: targetElement,
|
|
148
|
+
clone: clone
|
|
146
149
|
});
|
|
147
150
|
|
|
148
151
|
if (canCopyProperties === false) {
|
|
@@ -161,7 +164,11 @@ ModdleCopy.prototype.copyElement = function(sourceElement, targetElement, proper
|
|
|
161
164
|
sourceProperty = sourceElement.get(propertyName);
|
|
162
165
|
}
|
|
163
166
|
|
|
164
|
-
var copiedProperty = self.copyProperty(sourceProperty, targetElement, propertyName);
|
|
167
|
+
var copiedProperty = self.copyProperty(sourceProperty, targetElement, propertyName, clone);
|
|
168
|
+
|
|
169
|
+
if (!isDefined(copiedProperty)) {
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
165
172
|
|
|
166
173
|
var canSetProperty = self._eventBus.fire('moddleCopy.canSetCopiedProperty', {
|
|
167
174
|
parent: targetElement,
|
|
@@ -173,9 +180,9 @@ ModdleCopy.prototype.copyElement = function(sourceElement, targetElement, proper
|
|
|
173
180
|
return;
|
|
174
181
|
}
|
|
175
182
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
183
|
+
// TODO(nikku): unclaim old IDs if ID property is copied over
|
|
184
|
+
// this._moddle.getPropertyDescriptor(parent, propertyName)
|
|
185
|
+
targetElement.set(propertyName, copiedProperty);
|
|
179
186
|
});
|
|
180
187
|
|
|
181
188
|
return targetElement;
|
|
@@ -187,17 +194,19 @@ ModdleCopy.prototype.copyElement = function(sourceElement, targetElement, proper
|
|
|
187
194
|
* @param {*} property
|
|
188
195
|
* @param {ModdleElement} parent
|
|
189
196
|
* @param {string} propertyName
|
|
197
|
+
* @param {boolean} clone
|
|
190
198
|
*
|
|
191
199
|
* @returns {*}
|
|
192
200
|
*/
|
|
193
|
-
ModdleCopy.prototype.copyProperty = function(property, parent, propertyName) {
|
|
201
|
+
ModdleCopy.prototype.copyProperty = function(property, parent, propertyName, clone) {
|
|
194
202
|
var self = this;
|
|
195
203
|
|
|
196
204
|
// allow others to copy property
|
|
197
205
|
var copiedProperty = this._eventBus.fire('moddleCopy.canCopyProperty', {
|
|
198
206
|
parent: parent,
|
|
199
207
|
property: property,
|
|
200
|
-
propertyName: propertyName
|
|
208
|
+
propertyName: propertyName,
|
|
209
|
+
clone: clone
|
|
201
210
|
});
|
|
202
211
|
|
|
203
212
|
// return if copying is NOT allowed
|
|
@@ -222,7 +231,7 @@ ModdleCopy.prototype.copyProperty = function(property, parent, propertyName) {
|
|
|
222
231
|
|
|
223
232
|
// copy id
|
|
224
233
|
if (propertyDescriptor.isId) {
|
|
225
|
-
return this._copyId(property, parent);
|
|
234
|
+
return property && this._copyId(property, parent, clone);
|
|
226
235
|
}
|
|
227
236
|
|
|
228
237
|
// copy arrays
|
|
@@ -230,7 +239,7 @@ ModdleCopy.prototype.copyProperty = function(property, parent, propertyName) {
|
|
|
230
239
|
return reduce(property, function(childProperties, childProperty) {
|
|
231
240
|
|
|
232
241
|
// recursion
|
|
233
|
-
copiedProperty = self.copyProperty(childProperty, parent, propertyName);
|
|
242
|
+
copiedProperty = self.copyProperty(childProperty, parent, propertyName, clone);
|
|
234
243
|
|
|
235
244
|
// copying might NOT be allowed
|
|
236
245
|
if (copiedProperty) {
|
|
@@ -252,7 +261,7 @@ ModdleCopy.prototype.copyProperty = function(property, parent, propertyName) {
|
|
|
252
261
|
copiedProperty.$parent = parent;
|
|
253
262
|
|
|
254
263
|
// recursion
|
|
255
|
-
copiedProperty = self.copyElement(property, copiedProperty);
|
|
264
|
+
copiedProperty = self.copyElement(property, copiedProperty, null, clone);
|
|
256
265
|
|
|
257
266
|
return copiedProperty;
|
|
258
267
|
}
|
|
@@ -261,7 +270,11 @@ ModdleCopy.prototype.copyProperty = function(property, parent, propertyName) {
|
|
|
261
270
|
return property;
|
|
262
271
|
};
|
|
263
272
|
|
|
264
|
-
ModdleCopy.prototype._copyId = function(id, element) {
|
|
273
|
+
ModdleCopy.prototype._copyId = function(id, element, clone) {
|
|
274
|
+
|
|
275
|
+
if (clone) {
|
|
276
|
+
return id;
|
|
277
|
+
}
|
|
265
278
|
|
|
266
279
|
// disallow if already taken
|
|
267
280
|
if (this._moddle.ids.assigned(id)) {
|
|
@@ -6,7 +6,7 @@ import { is } from '../../../util/ModelUtil';
|
|
|
6
6
|
var HIGH_PRIORITY = 2000;
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
export default function
|
|
9
|
+
export default function GridSnappingAutoPlaceBehavior(eventBus, gridSnapping) {
|
|
10
10
|
eventBus.on('autoPlace', HIGH_PRIORITY, function(context) {
|
|
11
11
|
var source = context.source,
|
|
12
12
|
sourceMid = getMid(source),
|
|
@@ -47,7 +47,7 @@ export default function AutoPlaceBehavior(eventBus, gridSnapping) {
|
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
GridSnappingAutoPlaceBehavior.$inject = [
|
|
51
51
|
'eventBus',
|
|
52
52
|
'gridSnapping'
|
|
53
53
|
];
|
|
@@ -14,7 +14,7 @@ var HIGH_PRIORITY = 3000;
|
|
|
14
14
|
/**
|
|
15
15
|
* Snaps connections with Manhattan layout.
|
|
16
16
|
*/
|
|
17
|
-
export default function
|
|
17
|
+
export default function GridSnappingLayoutConnectionBehavior(eventBus, gridSnapping, modeling) {
|
|
18
18
|
CommandInterceptor.call(this, eventBus);
|
|
19
19
|
|
|
20
20
|
this._gridSnapping = gridSnapping;
|
|
@@ -42,13 +42,13 @@ export default function LayoutConnectionBehavior(eventBus, gridSnapping, modelin
|
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
GridSnappingLayoutConnectionBehavior.$inject = [
|
|
46
46
|
'eventBus',
|
|
47
47
|
'gridSnapping',
|
|
48
48
|
'modeling'
|
|
49
49
|
];
|
|
50
50
|
|
|
51
|
-
inherits(
|
|
51
|
+
inherits(GridSnappingLayoutConnectionBehavior, CommandInterceptor);
|
|
52
52
|
|
|
53
53
|
/**
|
|
54
54
|
* Snap middle segments of a given connection.
|
|
@@ -57,7 +57,7 @@ inherits(LayoutConnectionBehavior, CommandInterceptor);
|
|
|
57
57
|
*
|
|
58
58
|
* @returns {Array<Point>}
|
|
59
59
|
*/
|
|
60
|
-
|
|
60
|
+
GridSnappingLayoutConnectionBehavior.prototype.snapMiddleSegments = function(waypoints) {
|
|
61
61
|
var gridSnapping = this._gridSnapping,
|
|
62
62
|
snapped;
|
|
63
63
|
|
|
@@ -3,7 +3,7 @@ import { is } from '../../../util/ModelUtil';
|
|
|
3
3
|
var HIGHER_PRIORITY = 1750;
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
export default function
|
|
6
|
+
export default function GridSnappingParticipantBehavior(canvas, eventBus, gridSnapping) {
|
|
7
7
|
eventBus.on([
|
|
8
8
|
'create.start',
|
|
9
9
|
'shape.move.start'
|
|
@@ -29,7 +29,7 @@ export default function CreateParticipantBehavior(canvas, eventBus, gridSnapping
|
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
GridSnappingParticipantBehavior.$inject = [
|
|
33
33
|
'canvas',
|
|
34
34
|
'eventBus',
|
|
35
35
|
'gridSnapping'
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import GridSnappingAutoPlaceBehavior from './GridSnappingAutoPlaceBehavior';
|
|
2
|
+
import GridSnappingParticipantBehavior from './GridSnappingParticipantBehavior';
|
|
3
|
+
import GridSnappingLayoutConnectionBehavior from './GridSnappingLayoutConnectionBehavior';
|
|
4
4
|
|
|
5
5
|
export default {
|
|
6
6
|
__init__: [
|
|
7
7
|
'gridSnappingAutoPlaceBehavior',
|
|
8
|
-
'
|
|
8
|
+
'gridSnappingParticipantBehavior',
|
|
9
9
|
'gridSnappingLayoutConnectionBehavior',
|
|
10
10
|
],
|
|
11
|
-
gridSnappingAutoPlaceBehavior: [ 'type',
|
|
12
|
-
|
|
13
|
-
gridSnappingLayoutConnectionBehavior: [ 'type',
|
|
11
|
+
gridSnappingAutoPlaceBehavior: [ 'type', GridSnappingAutoPlaceBehavior ],
|
|
12
|
+
gridSnappingParticipantBehavior: [ 'type', GridSnappingParticipantBehavior ],
|
|
13
|
+
gridSnappingLayoutConnectionBehavior: [ 'type', GridSnappingLayoutConnectionBehavior ]
|
|
14
14
|
};
|
|
@@ -7,14 +7,9 @@ import {
|
|
|
7
7
|
} from './LabelUtil';
|
|
8
8
|
|
|
9
9
|
import {
|
|
10
|
-
getBusinessObject,
|
|
11
10
|
is
|
|
12
11
|
} from '../../util/ModelUtil';
|
|
13
12
|
|
|
14
|
-
import {
|
|
15
|
-
createCategoryValue
|
|
16
|
-
} from '../modeling/behavior/util/CategoryUtil';
|
|
17
|
-
|
|
18
13
|
import { isAny } from '../modeling/util/ModelingUtil';
|
|
19
14
|
import { isExpanded } from '../../util/DiUtil';
|
|
20
15
|
|
|
@@ -399,23 +394,6 @@ LabelEditingProvider.prototype.update = function(
|
|
|
399
394
|
};
|
|
400
395
|
}
|
|
401
396
|
|
|
402
|
-
if (is(element, 'bpmn:Group')) {
|
|
403
|
-
|
|
404
|
-
var businessObject = getBusinessObject(element);
|
|
405
|
-
|
|
406
|
-
// initialize categoryValue if not existing
|
|
407
|
-
if (!businessObject.categoryValueRef) {
|
|
408
|
-
|
|
409
|
-
var rootElement = this._canvas.getRootElement(),
|
|
410
|
-
definitions = getBusinessObject(rootElement).$parent;
|
|
411
|
-
|
|
412
|
-
var categoryValue = createCategoryValue(definitions, this._bpmnFactory);
|
|
413
|
-
|
|
414
|
-
getBusinessObject(element).categoryValueRef = categoryValue;
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
}
|
|
418
|
-
|
|
419
397
|
if (isEmptyText(newLabel)) {
|
|
420
398
|
newLabel = null;
|
|
421
399
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
assign,
|
|
3
3
|
forEach,
|
|
4
|
-
isObject
|
|
4
|
+
isObject,
|
|
5
|
+
omit
|
|
5
6
|
} from 'min-dash';
|
|
6
7
|
|
|
7
8
|
import inherits from 'inherits-browser';
|
|
@@ -69,7 +70,7 @@ ElementFactory.prototype.createBpmnElement = function(elementType, attrs) {
|
|
|
69
70
|
var size,
|
|
70
71
|
translate = this._translate;
|
|
71
72
|
|
|
72
|
-
attrs = attrs || {};
|
|
73
|
+
attrs = assign({}, attrs || {});
|
|
73
74
|
|
|
74
75
|
var businessObject = attrs.businessObject,
|
|
75
76
|
di = attrs.di;
|
|
@@ -86,6 +87,7 @@ ElementFactory.prototype.createBpmnElement = function(elementType, attrs) {
|
|
|
86
87
|
|
|
87
88
|
if (!isModdleDi(di)) {
|
|
88
89
|
var diAttrs = assign(
|
|
90
|
+
{},
|
|
89
91
|
di || {},
|
|
90
92
|
{ id: businessObject.id + '_di' }
|
|
91
93
|
);
|
|
@@ -106,7 +108,7 @@ ElementFactory.prototype.createBpmnElement = function(elementType, attrs) {
|
|
|
106
108
|
}, attrs);
|
|
107
109
|
}
|
|
108
110
|
|
|
109
|
-
applyAttributes(businessObject, attrs, [
|
|
111
|
+
attrs = applyAttributes(businessObject, attrs, [
|
|
110
112
|
'processRef',
|
|
111
113
|
'isInterrupting',
|
|
112
114
|
'associationDirection',
|
|
@@ -114,7 +116,7 @@ ElementFactory.prototype.createBpmnElement = function(elementType, attrs) {
|
|
|
114
116
|
]);
|
|
115
117
|
|
|
116
118
|
if (attrs.isExpanded) {
|
|
117
|
-
applyAttribute(di, attrs, 'isExpanded');
|
|
119
|
+
attrs = applyAttribute(di, attrs, 'isExpanded');
|
|
118
120
|
}
|
|
119
121
|
|
|
120
122
|
if (is(businessObject, 'bpmn:SubProcess')) {
|
|
@@ -247,14 +249,16 @@ ElementFactory.prototype.createParticipantShape = function(attrs) {
|
|
|
247
249
|
* @param {Base} element
|
|
248
250
|
* @param {Object} attrs (in/out map of attributes)
|
|
249
251
|
* @param {Array<string>} attributeNames name of attributes to apply
|
|
252
|
+
*
|
|
253
|
+
* @return {Object} changed attrs
|
|
250
254
|
*/
|
|
251
255
|
function applyAttributes(element, attrs, attributeNames) {
|
|
252
256
|
|
|
253
257
|
forEach(attributeNames, function(property) {
|
|
254
|
-
|
|
255
|
-
applyAttribute(element, attrs, property);
|
|
256
|
-
}
|
|
258
|
+
attrs = applyAttribute(element, attrs, property);
|
|
257
259
|
});
|
|
260
|
+
|
|
261
|
+
return attrs;
|
|
258
262
|
}
|
|
259
263
|
|
|
260
264
|
/**
|
|
@@ -264,11 +268,17 @@ function applyAttributes(element, attrs, attributeNames) {
|
|
|
264
268
|
* @param {Base} element
|
|
265
269
|
* @param {Object} attrs (in/out map of attributes)
|
|
266
270
|
* @param {string} attributeName to apply
|
|
271
|
+
*
|
|
272
|
+
* @return {Object} changed attrs
|
|
267
273
|
*/
|
|
268
274
|
function applyAttribute(element, attrs, attributeName) {
|
|
275
|
+
if (attrs[attributeName] === undefined) {
|
|
276
|
+
return attrs;
|
|
277
|
+
}
|
|
278
|
+
|
|
269
279
|
element[attributeName] = attrs[attributeName];
|
|
270
280
|
|
|
271
|
-
|
|
281
|
+
return omit(attrs, [ attributeName ]);
|
|
272
282
|
}
|
|
273
283
|
|
|
274
284
|
|
|
@@ -9,13 +9,11 @@ import {
|
|
|
9
9
|
forEach
|
|
10
10
|
} from 'min-dash';
|
|
11
11
|
|
|
12
|
-
var HIGH_PRIORITY = 2000;
|
|
13
|
-
|
|
14
12
|
|
|
15
13
|
/**
|
|
16
14
|
* BPMN specific boundary event behavior
|
|
17
15
|
*/
|
|
18
|
-
export default function BoundaryEventBehavior(eventBus,
|
|
16
|
+
export default function BoundaryEventBehavior(eventBus, modeling) {
|
|
19
17
|
|
|
20
18
|
CommandInterceptor.call(this, eventBus);
|
|
21
19
|
|
|
@@ -60,23 +58,10 @@ export default function BoundaryEventBehavior(eventBus, moddle, modeling) {
|
|
|
60
58
|
}
|
|
61
59
|
});
|
|
62
60
|
|
|
63
|
-
// copy reference to root element on replace
|
|
64
|
-
eventBus.on('moddleCopy.canCopyProperty', HIGH_PRIORITY, function(context) {
|
|
65
|
-
var parent = context.parent,
|
|
66
|
-
property = context.property,
|
|
67
|
-
propertyName = context.propertyName;
|
|
68
|
-
|
|
69
|
-
var propertyDescriptor = moddle.getPropertyDescriptor(parent, propertyName);
|
|
70
|
-
|
|
71
|
-
if (propertyDescriptor && propertyDescriptor.isReference && is(property, 'bpmn:RootElement')) {
|
|
72
|
-
parent.set(propertyName, property);
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
61
|
}
|
|
76
62
|
|
|
77
63
|
BoundaryEventBehavior.$inject = [
|
|
78
64
|
'eventBus',
|
|
79
|
-
'moddle',
|
|
80
65
|
'modeling'
|
|
81
66
|
];
|
|
82
67
|
|