Files
bpmn-js/lib/util/DiUtil.js
Nico Rehwaldt d3449ca87c chore(project): es6ify source code
* use ES6 import / export
* UTILS: export individual utilities
* TESTS: localize TestHelper includes

BREAKING CHANGE:

* all utilities export independent functions
* library sources got ported to ES6. You must now use
  a ES module bundler such as Browserify + babelify or
  Webpack to consume this library (or parts of it).
2018-04-03 16:32:14 +02:00

64 lines
1.3 KiB
JavaScript

'use strict';
import {
is,
getBusinessObject
} from './ModelUtil';
import {
forEach
} from 'min-dash';
export function isExpanded(element) {
if (is(element, 'bpmn:CallActivity')) {
return false;
}
if (is(element, 'bpmn:SubProcess')) {
return !!getBusinessObject(element).di.isExpanded;
}
if (is(element, 'bpmn:Participant')) {
return !!getBusinessObject(element).processRef;
}
return true;
}
export function isInterrupting(element) {
return element && getBusinessObject(element).isInterrupting !== false;
}
export function isEventSubProcess(element) {
return element && !!getBusinessObject(element).triggeredByEvent;
}
export function hasEventDefinition(element, eventType) {
var bo = getBusinessObject(element),
hasEventDefinition = false;
if (bo.eventDefinitions) {
forEach(bo.eventDefinitions, function(event) {
if (is(event, eventType)) {
hasEventDefinition = true;
}
});
}
return hasEventDefinition;
}
export function hasErrorEventDefinition(element) {
return hasEventDefinition(element, 'bpmn:ErrorEventDefinition');
}
export function hasEscalationEventDefinition(element) {
return hasEventDefinition(element, 'bpmn:EscalationEventDefinition');
}
export function hasCompensateEventDefinition(element) {
return hasEventDefinition(element, 'bpmn:CompensateEventDefinition');
}