|
@@ -3,29 +3,28 @@ import {
|
|
|
forEach,
|
|
forEach,
|
|
|
isArray,
|
|
isArray,
|
|
|
every
|
|
every
|
|
|
-} from 'min-dash';
|
|
|
|
|
|
|
+} from 'min-dash'
|
|
|
|
|
|
|
|
import {
|
|
import {
|
|
|
is
|
|
is
|
|
|
-} from 'bpmn-js/lib/util/ModelUtil';
|
|
|
|
|
|
|
+} from 'bpmn-js/lib/util/ModelUtil'
|
|
|
|
|
|
|
|
import {
|
|
import {
|
|
|
isExpanded,
|
|
isExpanded,
|
|
|
isEventSubProcess
|
|
isEventSubProcess
|
|
|
-} from 'bpmn-js/lib/util/DiUtil';
|
|
|
|
|
|
|
+} from 'bpmn-js/lib/util/DiUtil'
|
|
|
|
|
|
|
|
import {
|
|
import {
|
|
|
isAny
|
|
isAny
|
|
|
-} from 'bpmn-js/lib/features/modeling/util/ModelingUtil';
|
|
|
|
|
|
|
+} from 'bpmn-js/lib/features/modeling/util/ModelingUtil'
|
|
|
|
|
|
|
|
import {
|
|
import {
|
|
|
getChildLanes
|
|
getChildLanes
|
|
|
-} from 'bpmn-js/lib/features/modeling/util/LaneUtil';
|
|
|
|
|
|
|
+} from 'bpmn-js/lib/features/modeling/util/LaneUtil'
|
|
|
|
|
|
|
|
import {
|
|
import {
|
|
|
hasPrimaryModifier
|
|
hasPrimaryModifier
|
|
|
-} from 'diagram-js/lib/util/Mouse';
|
|
|
|
|
-
|
|
|
|
|
|
|
+} from 'diagram-js/lib/util/Mouse'
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* A provider for BPMN 2.0 elements context pad
|
|
* A provider for BPMN 2.0 elements context pad
|
|
@@ -35,41 +34,40 @@ export default function ContextPadProvider(
|
|
|
contextPad, modeling, elementFactory,
|
|
contextPad, modeling, elementFactory,
|
|
|
connect, create, popupMenu,
|
|
connect, create, popupMenu,
|
|
|
canvas, rules, translate) {
|
|
canvas, rules, translate) {
|
|
|
|
|
+ config = config || {}
|
|
|
|
|
|
|
|
- config = config || {};
|
|
|
|
|
-
|
|
|
|
|
- contextPad.registerProvider(this);
|
|
|
|
|
|
|
+ contextPad.registerProvider(this)
|
|
|
|
|
|
|
|
- this._contextPad = contextPad;
|
|
|
|
|
|
|
+ this._contextPad = contextPad
|
|
|
|
|
|
|
|
- this._modeling = modeling;
|
|
|
|
|
|
|
+ this._modeling = modeling
|
|
|
|
|
|
|
|
- this._elementFactory = elementFactory;
|
|
|
|
|
- this._connect = connect;
|
|
|
|
|
- this._create = create;
|
|
|
|
|
- this._popupMenu = popupMenu;
|
|
|
|
|
- this._canvas = canvas;
|
|
|
|
|
- this._rules = rules;
|
|
|
|
|
- this._translate = translate;
|
|
|
|
|
|
|
+ this._elementFactory = elementFactory
|
|
|
|
|
+ this._connect = connect
|
|
|
|
|
+ this._create = create
|
|
|
|
|
+ this._popupMenu = popupMenu
|
|
|
|
|
+ this._canvas = canvas
|
|
|
|
|
+ this._rules = rules
|
|
|
|
|
+ this._translate = translate
|
|
|
|
|
|
|
|
if (config.autoPlace !== false) {
|
|
if (config.autoPlace !== false) {
|
|
|
- this._autoPlace = injector.get('autoPlace', false);
|
|
|
|
|
|
|
+ this._autoPlace = injector.get('autoPlace', false)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
eventBus.on('create.end', 250, function(event) {
|
|
eventBus.on('create.end', 250, function(event) {
|
|
|
var context = event.context,
|
|
var context = event.context,
|
|
|
- shape = context.shape;
|
|
|
|
|
|
|
+ shape = context.shape
|
|
|
|
|
|
|
|
if (!hasPrimaryModifier(event) || !contextPad.isOpen(shape)) {
|
|
if (!hasPrimaryModifier(event) || !contextPad.isOpen(shape)) {
|
|
|
- return;
|
|
|
|
|
|
|
+ return
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- var entries = contextPad.getEntries(shape);
|
|
|
|
|
|
|
+ var entries = contextPad.getEntries(shape)
|
|
|
|
|
|
|
|
if (entries.replace) {
|
|
if (entries.replace) {
|
|
|
- entries.replace.action.click(event, shape);
|
|
|
|
|
|
|
+ entries.replace.action.click(event, shape)
|
|
|
}
|
|
}
|
|
|
- });
|
|
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
ContextPadProvider.$inject = [
|
|
ContextPadProvider.$inject = [
|
|
@@ -85,12 +83,12 @@ ContextPadProvider.$inject = [
|
|
|
'canvas',
|
|
'canvas',
|
|
|
'rules',
|
|
'rules',
|
|
|
'translate'
|
|
'translate'
|
|
|
-];
|
|
|
|
|
|
|
+]
|
|
|
|
|
|
|
|
ContextPadProvider.prototype.getMultiElementContextPadEntries = function(elements) {
|
|
ContextPadProvider.prototype.getMultiElementContextPadEntries = function(elements) {
|
|
|
- var modeling = this._modeling;
|
|
|
|
|
|
|
+ var modeling = this._modeling
|
|
|
|
|
|
|
|
- var actions = {};
|
|
|
|
|
|
|
+ var actions = {}
|
|
|
|
|
|
|
|
if (this._isDeleteAllowed(elements)) {
|
|
if (this._isDeleteAllowed(elements)) {
|
|
|
assign(actions, {
|
|
assign(actions, {
|
|
@@ -100,34 +98,33 @@ ContextPadProvider.prototype.getMultiElementContextPadEntries = function(element
|
|
|
title: this._translate('Remove'),
|
|
title: this._translate('Remove'),
|
|
|
action: {
|
|
action: {
|
|
|
click: function(event, elements) {
|
|
click: function(event, elements) {
|
|
|
- modeling.removeElements(elements.slice());
|
|
|
|
|
|
|
+ modeling.removeElements(elements.slice())
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- });
|
|
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- return actions;
|
|
|
|
|
-};
|
|
|
|
|
|
|
+ return actions
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* @param {djs.model.Base[]} elements
|
|
* @param {djs.model.Base[]} elements
|
|
|
* @return {boolean}
|
|
* @return {boolean}
|
|
|
*/
|
|
*/
|
|
|
ContextPadProvider.prototype._isDeleteAllowed = function(elements) {
|
|
ContextPadProvider.prototype._isDeleteAllowed = function(elements) {
|
|
|
-
|
|
|
|
|
var baseAllowed = this._rules.allowed('elements.delete', {
|
|
var baseAllowed = this._rules.allowed('elements.delete', {
|
|
|
elements: elements
|
|
elements: elements
|
|
|
- });
|
|
|
|
|
|
|
+ })
|
|
|
|
|
|
|
|
if (isArray(baseAllowed)) {
|
|
if (isArray(baseAllowed)) {
|
|
|
return every(baseAllowed, function(element) {
|
|
return every(baseAllowed, function(element) {
|
|
|
- return includes(baseAllowed, element);
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ return includes(baseAllowed, element)
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- return baseAllowed;
|
|
|
|
|
-};
|
|
|
|
|
|
|
+ return baseAllowed
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
|
ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
|
|
var contextPad = this._contextPad,
|
|
var contextPad = this._contextPad,
|
|
@@ -139,41 +136,39 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
|
|
popupMenu = this._popupMenu,
|
|
popupMenu = this._popupMenu,
|
|
|
rules = this._rules,
|
|
rules = this._rules,
|
|
|
autoPlace = this._autoPlace,
|
|
autoPlace = this._autoPlace,
|
|
|
- translate = this._translate;
|
|
|
|
|
|
|
+ translate = this._translate
|
|
|
|
|
|
|
|
- var actions = {};
|
|
|
|
|
|
|
+ var actions = {}
|
|
|
|
|
|
|
|
if (element.type === 'label') {
|
|
if (element.type === 'label') {
|
|
|
- return actions;
|
|
|
|
|
|
|
+ return actions
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- var businessObject = element.businessObject;
|
|
|
|
|
|
|
+ var businessObject = element.businessObject
|
|
|
|
|
|
|
|
function startConnect(event, element) {
|
|
function startConnect(event, element) {
|
|
|
- connect.start(event, element);
|
|
|
|
|
|
|
+ connect.start(event, element)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function removeElement(e, element) {
|
|
function removeElement(e, element) {
|
|
|
- modeling.removeElements([ element ]);
|
|
|
|
|
|
|
+ modeling.removeElements([element])
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function getReplaceMenuPosition(element) {
|
|
function getReplaceMenuPosition(element) {
|
|
|
|
|
+ var Y_OFFSET = 5
|
|
|
|
|
|
|
|
- var Y_OFFSET = 5;
|
|
|
|
|
|
|
+ var pad = contextPad.getPad(element).html
|
|
|
|
|
|
|
|
- var pad = contextPad.getPad(element).html;
|
|
|
|
|
-
|
|
|
|
|
- var padRect = pad.getBoundingClientRect();
|
|
|
|
|
|
|
+ var padRect = pad.getBoundingClientRect()
|
|
|
|
|
|
|
|
var pos = {
|
|
var pos = {
|
|
|
x: padRect.left,
|
|
x: padRect.left,
|
|
|
y: padRect.bottom + Y_OFFSET
|
|
y: padRect.bottom + Y_OFFSET
|
|
|
- };
|
|
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- return pos;
|
|
|
|
|
|
|
+ return pos
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
/**
|
|
/**
|
|
|
* Create an append action
|
|
* Create an append action
|
|
|
*
|
|
*
|
|
@@ -185,27 +180,23 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
|
|
* @return {Object} descriptor
|
|
* @return {Object} descriptor
|
|
|
*/
|
|
*/
|
|
|
function appendAction(type, className, title, options) {
|
|
function appendAction(type, className, title, options) {
|
|
|
-
|
|
|
|
|
if (typeof title !== 'string') {
|
|
if (typeof title !== 'string') {
|
|
|
- options = title;
|
|
|
|
|
- title = translate('Append {type}', { type: type.replace(/^bpmn:/, '') });
|
|
|
|
|
|
|
+ options = title
|
|
|
|
|
+ title = translate('Append {type}', { type: type.replace(/^bpmn:/, '') })
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function appendStart(event, element) {
|
|
function appendStart(event, element) {
|
|
|
-
|
|
|
|
|
- var shape = elementFactory.createShape(assign({ type: type }, options));
|
|
|
|
|
|
|
+ var shape = elementFactory.createShape(assign({ type: type }, options))
|
|
|
create.start(event, shape, {
|
|
create.start(event, shape, {
|
|
|
source: element
|
|
source: element
|
|
|
- });
|
|
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
var append = autoPlace ? function(event, element) {
|
|
var append = autoPlace ? function(event, element) {
|
|
|
- var shape = elementFactory.createShape(assign({ type: type }, options));
|
|
|
|
|
-
|
|
|
|
|
- autoPlace.append(element, shape);
|
|
|
|
|
- } : appendStart;
|
|
|
|
|
|
|
+ var shape = elementFactory.createShape(assign({ type: type }, options))
|
|
|
|
|
|
|
|
|
|
+ autoPlace.append(element, shape)
|
|
|
|
|
+ } : appendStart
|
|
|
|
|
|
|
|
return {
|
|
return {
|
|
|
group: 'model',
|
|
group: 'model',
|
|
@@ -215,26 +206,22 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
|
|
dragstart: appendStart,
|
|
dragstart: appendStart,
|
|
|
click: append
|
|
click: append
|
|
|
}
|
|
}
|
|
|
- };
|
|
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function splitLaneHandler(count) {
|
|
function splitLaneHandler(count) {
|
|
|
-
|
|
|
|
|
return function(event, element) {
|
|
return function(event, element) {
|
|
|
-
|
|
|
|
|
// actual split
|
|
// actual split
|
|
|
- modeling.splitLane(element, count);
|
|
|
|
|
|
|
+ modeling.splitLane(element, count)
|
|
|
|
|
|
|
|
// refresh context pad after split to
|
|
// refresh context pad after split to
|
|
|
// get rid of split icons
|
|
// get rid of split icons
|
|
|
- contextPad.open(element, true);
|
|
|
|
|
- };
|
|
|
|
|
|
|
+ contextPad.open(element, true)
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
- if (isAny(businessObject, [ 'bpmn:Lane', 'bpmn:Participant' ]) && isExpanded(element)) {
|
|
|
|
|
-
|
|
|
|
|
- var childLanes = getChildLanes(element);
|
|
|
|
|
|
|
+ if (isAny(businessObject, ['bpmn:Lane', 'bpmn:Participant']) && isExpanded(element)) {
|
|
|
|
|
+ var childLanes = getChildLanes(element)
|
|
|
|
|
|
|
|
assign(actions, {
|
|
assign(actions, {
|
|
|
'lane-insert-above': {
|
|
'lane-insert-above': {
|
|
@@ -243,14 +230,13 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
|
|
title: translate('Add Lane above'),
|
|
title: translate('Add Lane above'),
|
|
|
action: {
|
|
action: {
|
|
|
click: function(event, element) {
|
|
click: function(event, element) {
|
|
|
- modeling.addLane(element, 'top');
|
|
|
|
|
|
|
+ modeling.addLane(element, 'top')
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- });
|
|
|
|
|
|
|
+ })
|
|
|
|
|
|
|
|
if (childLanes.length < 2) {
|
|
if (childLanes.length < 2) {
|
|
|
-
|
|
|
|
|
if (element.height >= 120) {
|
|
if (element.height >= 120) {
|
|
|
assign(actions, {
|
|
assign(actions, {
|
|
|
'lane-divide-two': {
|
|
'lane-divide-two': {
|
|
@@ -261,7 +247,7 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
|
|
click: splitLaneHandler(2)
|
|
click: splitLaneHandler(2)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- });
|
|
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (element.height >= 180) {
|
|
if (element.height >= 180) {
|
|
@@ -274,7 +260,7 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
|
|
click: splitLaneHandler(3)
|
|
click: splitLaneHandler(3)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- });
|
|
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -285,18 +271,15 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
|
|
title: translate('Add Lane below'),
|
|
title: translate('Add Lane below'),
|
|
|
action: {
|
|
action: {
|
|
|
click: function(event, element) {
|
|
click: function(event, element) {
|
|
|
- modeling.addLane(element, 'bottom');
|
|
|
|
|
|
|
+ modeling.addLane(element, 'bottom')
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (is(businessObject, 'bpmn:FlowNode')) {
|
|
if (is(businessObject, 'bpmn:FlowNode')) {
|
|
|
-
|
|
|
|
|
if (is(businessObject, 'bpmn:EventBasedGateway')) {
|
|
if (is(businessObject, 'bpmn:EventBasedGateway')) {
|
|
|
-
|
|
|
|
|
assign(actions, {
|
|
assign(actions, {
|
|
|
'append.receive-task': appendAction(
|
|
'append.receive-task': appendAction(
|
|
|
'bpmn:ReceiveTask',
|
|
'bpmn:ReceiveTask',
|
|
@@ -327,11 +310,10 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
|
|
translate('Append SignalIntermediateCatchEvent'),
|
|
translate('Append SignalIntermediateCatchEvent'),
|
|
|
{ eventDefinitionType: 'bpmn:SignalEventDefinition' }
|
|
{ eventDefinitionType: 'bpmn:SignalEventDefinition' }
|
|
|
)
|
|
)
|
|
|
- });
|
|
|
|
|
|
|
+ })
|
|
|
} else
|
|
} else
|
|
|
|
|
|
|
|
if (isEventType(businessObject, 'bpmn:BoundaryEvent', 'bpmn:CompensateEventDefinition')) {
|
|
if (isEventType(businessObject, 'bpmn:BoundaryEvent', 'bpmn:CompensateEventDefinition')) {
|
|
|
-
|
|
|
|
|
assign(actions, {
|
|
assign(actions, {
|
|
|
'append.compensation-activity':
|
|
'append.compensation-activity':
|
|
|
appendAction(
|
|
appendAction(
|
|
@@ -342,14 +324,13 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
|
|
isForCompensation: true
|
|
isForCompensation: true
|
|
|
}
|
|
}
|
|
|
)
|
|
)
|
|
|
- });
|
|
|
|
|
|
|
+ })
|
|
|
} else
|
|
} else
|
|
|
|
|
|
|
|
if (!is(businessObject, 'bpmn:EndEvent') &&
|
|
if (!is(businessObject, 'bpmn:EndEvent') &&
|
|
|
!businessObject.isForCompensation &&
|
|
!businessObject.isForCompensation &&
|
|
|
!isEventType(businessObject, 'bpmn:IntermediateThrowEvent', 'bpmn:LinkEventDefinition') &&
|
|
!isEventType(businessObject, 'bpmn:IntermediateThrowEvent', 'bpmn:LinkEventDefinition') &&
|
|
|
!isEventSubProcess(businessObject)) {
|
|
!isEventSubProcess(businessObject)) {
|
|
|
-
|
|
|
|
|
assign(actions, {
|
|
assign(actions, {
|
|
|
'append.end-event': appendAction(
|
|
'append.end-event': appendAction(
|
|
|
'bpmn:EndEvent',
|
|
'bpmn:EndEvent',
|
|
@@ -371,12 +352,11 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
|
|
'bpmn-icon-intermediate-event-none',
|
|
'bpmn-icon-intermediate-event-none',
|
|
|
translate('Append Intermediate/Boundary Event')
|
|
translate('Append Intermediate/Boundary Event')
|
|
|
)
|
|
)
|
|
|
- });
|
|
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (!popupMenu.isEmpty(element, 'bpmn-replace')) {
|
|
if (!popupMenu.isEmpty(element, 'bpmn-replace')) {
|
|
|
-
|
|
|
|
|
// Replace menu entry
|
|
// Replace menu entry
|
|
|
assign(actions, {
|
|
assign(actions, {
|
|
|
'replace': {
|
|
'replace': {
|
|
@@ -385,20 +365,19 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
|
|
title: translate('Change type'),
|
|
title: translate('Change type'),
|
|
|
action: {
|
|
action: {
|
|
|
click: function(event, element) {
|
|
click: function(event, element) {
|
|
|
-
|
|
|
|
|
var position = assign(getReplaceMenuPosition(element), {
|
|
var position = assign(getReplaceMenuPosition(element), {
|
|
|
cursor: { x: event.x, y: event.y }
|
|
cursor: { x: event.x, y: event.y }
|
|
|
- });
|
|
|
|
|
|
|
+ })
|
|
|
|
|
|
|
|
popupMenu.open(element, 'bpmn-replace', position, {
|
|
popupMenu.open(element, 'bpmn-replace', position, {
|
|
|
title: translate('Change element'),
|
|
title: translate('Change element'),
|
|
|
width: 300,
|
|
width: 300,
|
|
|
search: true
|
|
search: true
|
|
|
- });
|
|
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- });
|
|
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (is(businessObject, 'bpmn:SequenceFlow')) {
|
|
if (is(businessObject, 'bpmn:SequenceFlow')) {
|
|
@@ -407,7 +386,7 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
|
|
'bpmn:TextAnnotation',
|
|
'bpmn:TextAnnotation',
|
|
|
'bpmn-icon-text-annotation'
|
|
'bpmn-icon-text-annotation'
|
|
|
)
|
|
)
|
|
|
- });
|
|
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (
|
|
if (
|
|
@@ -415,7 +394,7 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
|
|
'bpmn:FlowNode',
|
|
'bpmn:FlowNode',
|
|
|
'bpmn:InteractionNode',
|
|
'bpmn:InteractionNode',
|
|
|
'bpmn:DataObjectReference',
|
|
'bpmn:DataObjectReference',
|
|
|
- 'bpmn:DataStoreReference',
|
|
|
|
|
|
|
+ 'bpmn:DataStoreReference'
|
|
|
])
|
|
])
|
|
|
) {
|
|
) {
|
|
|
assign(actions, {
|
|
assign(actions, {
|
|
@@ -436,10 +415,10 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
|
|
),
|
|
),
|
|
|
action: {
|
|
action: {
|
|
|
click: startConnect,
|
|
click: startConnect,
|
|
|
- dragstart: startConnect,
|
|
|
|
|
- },
|
|
|
|
|
- },
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ dragstart: startConnect
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (is(businessObject, 'bpmn:TextAnnotation')) {
|
|
if (is(businessObject, 'bpmn:TextAnnotation')) {
|
|
@@ -450,13 +429,13 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
|
|
title: translate('Connect using Association'),
|
|
title: translate('Connect using Association'),
|
|
|
action: {
|
|
action: {
|
|
|
click: startConnect,
|
|
click: startConnect,
|
|
|
- dragstart: startConnect,
|
|
|
|
|
- },
|
|
|
|
|
- },
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ dragstart: startConnect
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if (isAny(businessObject, [ 'bpmn:DataObjectReference', 'bpmn:DataStoreReference' ])) {
|
|
|
|
|
|
|
+ if (isAny(businessObject, ['bpmn:DataObjectReference', 'bpmn:DataStoreReference'])) {
|
|
|
assign(actions, {
|
|
assign(actions, {
|
|
|
'connect': {
|
|
'connect': {
|
|
|
group: 'connect',
|
|
group: 'connect',
|
|
@@ -467,22 +446,21 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
|
|
dragstart: startConnect
|
|
dragstart: startConnect
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- });
|
|
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (is(businessObject, 'bpmn:Group')) {
|
|
if (is(businessObject, 'bpmn:Group')) {
|
|
|
assign(actions, {
|
|
assign(actions, {
|
|
|
'append.text-annotation': appendAction('bpmn:TextAnnotation', 'bpmn-icon-text-annotation')
|
|
'append.text-annotation': appendAction('bpmn:TextAnnotation', 'bpmn-icon-text-annotation')
|
|
|
- });
|
|
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// delete element entry, only show if allowed by rules
|
|
// delete element entry, only show if allowed by rules
|
|
|
- var deleteAllowed = rules.allowed('elements.delete', { elements: [ element ] });
|
|
|
|
|
|
|
+ var deleteAllowed = rules.allowed('elements.delete', { elements: [element] })
|
|
|
|
|
|
|
|
if (isArray(deleteAllowed)) {
|
|
if (isArray(deleteAllowed)) {
|
|
|
-
|
|
|
|
|
// was the element returned as a deletion candidate?
|
|
// was the element returned as a deletion candidate?
|
|
|
- deleteAllowed = deleteAllowed[0] === element;
|
|
|
|
|
|
|
+ deleteAllowed = deleteAllowed[0] === element
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (deleteAllowed) {
|
|
if (deleteAllowed) {
|
|
@@ -495,30 +473,28 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
|
|
click: removeElement
|
|
click: removeElement
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- });
|
|
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- return actions;
|
|
|
|
|
-};
|
|
|
|
|
-
|
|
|
|
|
|
|
+ return actions
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
// helpers /////////
|
|
// helpers /////////
|
|
|
|
|
|
|
|
function isEventType(eventBo, type, definition) {
|
|
function isEventType(eventBo, type, definition) {
|
|
|
|
|
+ var isType = eventBo.$instanceOf(type)
|
|
|
|
|
+ var isDefinition = false
|
|
|
|
|
|
|
|
- var isType = eventBo.$instanceOf(type);
|
|
|
|
|
- var isDefinition = false;
|
|
|
|
|
-
|
|
|
|
|
- var definitions = eventBo.eventDefinitions || [];
|
|
|
|
|
|
|
+ var definitions = eventBo.eventDefinitions || []
|
|
|
forEach(definitions, function(def) {
|
|
forEach(definitions, function(def) {
|
|
|
if (def.$type === definition) {
|
|
if (def.$type === definition) {
|
|
|
- isDefinition = true;
|
|
|
|
|
|
|
+ isDefinition = true
|
|
|
}
|
|
}
|
|
|
- });
|
|
|
|
|
|
|
+ })
|
|
|
|
|
|
|
|
- return isType && isDefinition;
|
|
|
|
|
|
|
+ return isType && isDefinition
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function includes(array, item) {
|
|
function includes(array, item) {
|
|
|
- return array.indexOf(item) !== -1;
|
|
|
|
|
|
|
+ return array.indexOf(item) !== -1
|
|
|
}
|
|
}
|