chore(replace): minor reformat

This commit is contained in:
Nico Rehwaldt 2018-02-14 22:06:22 +01:00
parent ef52dff84c
commit c96741df03
1 changed files with 28 additions and 11 deletions

View File

@ -7,6 +7,7 @@ var pick = require('lodash/object/pick'),
has = require('lodash/object/has');
var is = require('../../util/ModelUtil').is,
isAny = require('../modeling/util/ModelingUtil').isAny,
isExpanded = require('../../util/DiUtil').isExpanded,
isEventSubProcess = require('../../util/DiUtil').isEventSubProcess,
ModelCloneUtils = require('../../util/model/ModelCloneUtils'),
@ -77,7 +78,7 @@ function BpmnReplace(bpmnFactory, replace, selection, modeling, eventBus) {
var type = target.type,
oldBusinessObject = element.businessObject;
if (is(oldBusinessObject, 'bpmn:SubProcess')) {
if (isSubProcess(oldBusinessObject)) {
if (type === 'bpmn:SubProcess') {
if (toggeling(element, target)) {
// expanding or collapsing process
@ -133,7 +134,7 @@ function BpmnReplace(bpmnFactory, replace, selection, modeling, eventBus) {
if (is(oldBusinessObject, 'bpmn:Activity')) {
if (is(oldBusinessObject, 'bpmn:SubProcess')) {
if (isSubProcess(oldBusinessObject)) {
// no toggeling, so keep old state
newElement.isExpanded = isExpanded(oldBusinessObject);
}
@ -152,9 +153,7 @@ function BpmnReplace(bpmnFactory, replace, selection, modeling, eventBus) {
}
// remove children if not expanding sub process
if (is(oldBusinessObject, 'bpmn:SubProcess')
&& !isExpanded(oldBusinessObject)
&& !is(newBusinessObject, 'bpmn:SubProcess')) {
if (isSubProcess(oldBusinessObject) && !isSubProcess(newBusinessObject)) {
hints.moveChildren = false;
}
@ -177,11 +176,18 @@ function BpmnReplace(bpmnFactory, replace, selection, modeling, eventBus) {
newBusinessObject.name = oldBusinessObject.name;
// retain default flow's reference between inclusive <-> exclusive gateways and activities
if ((is(oldBusinessObject, 'bpmn:ExclusiveGateway') || is(oldBusinessObject, 'bpmn:InclusiveGateway') ||
is(oldBusinessObject, 'bpmn:Activity')) &&
(is(newBusinessObject, 'bpmn:ExclusiveGateway') || is(newBusinessObject, 'bpmn:InclusiveGateway') ||
is(newBusinessObject, 'bpmn:Activity')))
{
if (
isAny(oldBusinessObject, [
'bpmn:ExclusiveGateway',
'bpmn:InclusiveGateway',
'bpmn:Activity'
]) &&
isAny(newBusinessObject, [
'bpmn:ExclusiveGateway',
'bpmn:InclusiveGateway',
'bpmn:Activity'
])
) {
newBusinessObject.default = oldBusinessObject.default;
}
@ -201,6 +207,17 @@ function BpmnReplace(bpmnFactory, replace, selection, modeling, eventBus) {
this.replaceElement = replaceElement;
}
BpmnReplace.$inject = [ 'bpmnFactory', 'replace', 'selection', 'modeling', 'eventBus' ];
BpmnReplace.$inject = [
'bpmnFactory',
'replace',
'selection',
'modeling',
'eventBus'
];
module.exports = BpmnReplace;
function isSubProcess(bo) {
return is(bo, 'bpmn:SubProcess');
}