mirror of
https://github.com/sartography/bpmn-js.git
synced 2025-02-23 14:18:10 +00:00
chore(replace): minor reformat
This commit is contained in:
parent
ef52dff84c
commit
c96741df03
@ -7,6 +7,7 @@ var pick = require('lodash/object/pick'),
|
|||||||
has = require('lodash/object/has');
|
has = require('lodash/object/has');
|
||||||
|
|
||||||
var is = require('../../util/ModelUtil').is,
|
var is = require('../../util/ModelUtil').is,
|
||||||
|
isAny = require('../modeling/util/ModelingUtil').isAny,
|
||||||
isExpanded = require('../../util/DiUtil').isExpanded,
|
isExpanded = require('../../util/DiUtil').isExpanded,
|
||||||
isEventSubProcess = require('../../util/DiUtil').isEventSubProcess,
|
isEventSubProcess = require('../../util/DiUtil').isEventSubProcess,
|
||||||
ModelCloneUtils = require('../../util/model/ModelCloneUtils'),
|
ModelCloneUtils = require('../../util/model/ModelCloneUtils'),
|
||||||
@ -77,7 +78,7 @@ function BpmnReplace(bpmnFactory, replace, selection, modeling, eventBus) {
|
|||||||
var type = target.type,
|
var type = target.type,
|
||||||
oldBusinessObject = element.businessObject;
|
oldBusinessObject = element.businessObject;
|
||||||
|
|
||||||
if (is(oldBusinessObject, 'bpmn:SubProcess')) {
|
if (isSubProcess(oldBusinessObject)) {
|
||||||
if (type === 'bpmn:SubProcess') {
|
if (type === 'bpmn:SubProcess') {
|
||||||
if (toggeling(element, target)) {
|
if (toggeling(element, target)) {
|
||||||
// expanding or collapsing process
|
// expanding or collapsing process
|
||||||
@ -133,7 +134,7 @@ function BpmnReplace(bpmnFactory, replace, selection, modeling, eventBus) {
|
|||||||
|
|
||||||
if (is(oldBusinessObject, 'bpmn:Activity')) {
|
if (is(oldBusinessObject, 'bpmn:Activity')) {
|
||||||
|
|
||||||
if (is(oldBusinessObject, 'bpmn:SubProcess')) {
|
if (isSubProcess(oldBusinessObject)) {
|
||||||
// no toggeling, so keep old state
|
// no toggeling, so keep old state
|
||||||
newElement.isExpanded = isExpanded(oldBusinessObject);
|
newElement.isExpanded = isExpanded(oldBusinessObject);
|
||||||
}
|
}
|
||||||
@ -152,9 +153,7 @@ function BpmnReplace(bpmnFactory, replace, selection, modeling, eventBus) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// remove children if not expanding sub process
|
// remove children if not expanding sub process
|
||||||
if (is(oldBusinessObject, 'bpmn:SubProcess')
|
if (isSubProcess(oldBusinessObject) && !isSubProcess(newBusinessObject)) {
|
||||||
&& !isExpanded(oldBusinessObject)
|
|
||||||
&& !is(newBusinessObject, 'bpmn:SubProcess')) {
|
|
||||||
hints.moveChildren = false;
|
hints.moveChildren = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,11 +176,18 @@ function BpmnReplace(bpmnFactory, replace, selection, modeling, eventBus) {
|
|||||||
newBusinessObject.name = oldBusinessObject.name;
|
newBusinessObject.name = oldBusinessObject.name;
|
||||||
|
|
||||||
// retain default flow's reference between inclusive <-> exclusive gateways and activities
|
// retain default flow's reference between inclusive <-> exclusive gateways and activities
|
||||||
if ((is(oldBusinessObject, 'bpmn:ExclusiveGateway') || is(oldBusinessObject, 'bpmn:InclusiveGateway') ||
|
if (
|
||||||
is(oldBusinessObject, 'bpmn:Activity')) &&
|
isAny(oldBusinessObject, [
|
||||||
(is(newBusinessObject, 'bpmn:ExclusiveGateway') || is(newBusinessObject, 'bpmn:InclusiveGateway') ||
|
'bpmn:ExclusiveGateway',
|
||||||
is(newBusinessObject, 'bpmn:Activity')))
|
'bpmn:InclusiveGateway',
|
||||||
{
|
'bpmn:Activity'
|
||||||
|
]) &&
|
||||||
|
isAny(newBusinessObject, [
|
||||||
|
'bpmn:ExclusiveGateway',
|
||||||
|
'bpmn:InclusiveGateway',
|
||||||
|
'bpmn:Activity'
|
||||||
|
])
|
||||||
|
) {
|
||||||
newBusinessObject.default = oldBusinessObject.default;
|
newBusinessObject.default = oldBusinessObject.default;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,6 +207,17 @@ function BpmnReplace(bpmnFactory, replace, selection, modeling, eventBus) {
|
|||||||
this.replaceElement = replaceElement;
|
this.replaceElement = replaceElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
BpmnReplace.$inject = [ 'bpmnFactory', 'replace', 'selection', 'modeling', 'eventBus' ];
|
BpmnReplace.$inject = [
|
||||||
|
'bpmnFactory',
|
||||||
|
'replace',
|
||||||
|
'selection',
|
||||||
|
'modeling',
|
||||||
|
'eventBus'
|
||||||
|
];
|
||||||
|
|
||||||
module.exports = BpmnReplace;
|
module.exports = BpmnReplace;
|
||||||
|
|
||||||
|
|
||||||
|
function isSubProcess(bo) {
|
||||||
|
return is(bo, 'bpmn:SubProcess');
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user