2018-04-02 19:01:53 +00:00
|
|
|
import {
|
|
|
|
assign,
|
|
|
|
forEach,
|
|
|
|
isArray
|
|
|
|
} from 'min-dash';
|
|
|
|
|
|
|
|
import {
|
|
|
|
is
|
|
|
|
} from '../../util/ModelUtil';
|
|
|
|
|
|
|
|
import {
|
|
|
|
isExpanded,
|
|
|
|
isEventSubProcess
|
|
|
|
} from '../../util/DiUtil';
|
|
|
|
|
|
|
|
import {
|
|
|
|
isAny
|
|
|
|
} from '../modeling/util/ModelingUtil';
|
|
|
|
|
|
|
|
import {
|
|
|
|
getChildLanes
|
|
|
|
} from '../modeling/util/LaneUtil';
|
|
|
|
|
|
|
|
import {
|
|
|
|
hasPrimaryModifier
|
|
|
|
} from 'diagram-js/lib/util/Mouse';
|
2015-02-05 15:00:05 +00:00
|
|
|
|
2014-06-27 15:52:34 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* A provider for BPMN 2.0 elements context pad
|
|
|
|
*/
|
2018-04-02 19:01:53 +00:00
|
|
|
export default function ContextPadProvider(
|
|
|
|
config, injector, eventBus,
|
|
|
|
contextPad, modeling, elementFactory,
|
|
|
|
connect, create, popupMenu,
|
2018-01-05 13:32:52 +00:00
|
|
|
canvas, rules, translate) {
|
2014-06-27 15:52:34 +00:00
|
|
|
|
2017-12-08 20:06:08 +00:00
|
|
|
config = config || {};
|
|
|
|
|
2014-06-27 15:52:34 +00:00
|
|
|
contextPad.registerProvider(this);
|
|
|
|
|
2015-02-05 15:00:05 +00:00
|
|
|
this._contextPad = contextPad;
|
2014-12-07 12:08:50 +00:00
|
|
|
|
2014-07-23 16:53:33 +00:00
|
|
|
this._modeling = modeling;
|
2014-09-11 14:44:56 +00:00
|
|
|
|
2014-12-07 12:08:50 +00:00
|
|
|
this._elementFactory = elementFactory;
|
2014-09-11 14:44:56 +00:00
|
|
|
this._connect = connect;
|
2014-12-07 12:08:50 +00:00
|
|
|
this._create = create;
|
2015-12-10 11:48:40 +00:00
|
|
|
this._popupMenu = popupMenu;
|
2018-02-27 09:08:31 +00:00
|
|
|
this._canvas = canvas;
|
2015-12-02 11:12:04 +00:00
|
|
|
this._rules = rules;
|
2016-02-25 16:40:56 +00:00
|
|
|
this._translate = translate;
|
2016-08-18 13:23:19 +00:00
|
|
|
|
2017-12-08 20:06:08 +00:00
|
|
|
if (config.autoPlace !== false) {
|
|
|
|
this._autoPlace = injector.get('autoPlace', false);
|
|
|
|
}
|
2016-08-18 13:23:19 +00:00
|
|
|
|
2016-08-31 09:02:04 +00:00
|
|
|
eventBus.on('create.end', 250, function(event) {
|
2019-12-10 13:19:11 +00:00
|
|
|
var context = event.context,
|
|
|
|
shape = context.shape;
|
2016-08-18 13:23:19 +00:00
|
|
|
|
2019-12-10 13:19:11 +00:00
|
|
|
if (!hasPrimaryModifier(event) || !contextPad.isOpen(shape)) {
|
2016-09-19 09:39:33 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
var entries = contextPad.getEntries(shape);
|
|
|
|
|
|
|
|
if (entries.replace) {
|
2016-08-31 09:02:04 +00:00
|
|
|
entries.replace.action.click(event, shape);
|
2016-08-18 13:23:19 +00:00
|
|
|
}
|
|
|
|
});
|
2014-06-27 15:52:34 +00:00
|
|
|
}
|
|
|
|
|
2014-12-07 14:10:02 +00:00
|
|
|
ContextPadProvider.$inject = [
|
2017-12-08 20:06:08 +00:00
|
|
|
'config.contextPad',
|
|
|
|
'injector',
|
2016-08-18 13:23:19 +00:00
|
|
|
'eventBus',
|
2014-12-07 14:10:02 +00:00
|
|
|
'contextPad',
|
|
|
|
'modeling',
|
|
|
|
'elementFactory',
|
|
|
|
'connect',
|
2015-02-05 15:00:05 +00:00
|
|
|
'create',
|
2015-12-10 11:48:40 +00:00
|
|
|
'popupMenu',
|
2015-12-02 11:12:04 +00:00
|
|
|
'canvas',
|
2016-02-25 16:40:56 +00:00
|
|
|
'rules',
|
|
|
|
'translate'
|
2014-12-07 14:10:02 +00:00
|
|
|
];
|
2014-06-27 15:52:34 +00:00
|
|
|
|
2015-10-09 23:28:04 +00:00
|
|
|
|
2014-06-27 15:52:34 +00:00
|
|
|
ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
|
|
|
|
2015-02-05 15:00:05 +00:00
|
|
|
var contextPad = this._contextPad,
|
|
|
|
modeling = this._modeling,
|
|
|
|
|
2014-12-07 12:08:50 +00:00
|
|
|
elementFactory = this._elementFactory,
|
|
|
|
connect = this._connect,
|
2015-02-05 15:00:05 +00:00
|
|
|
create = this._create,
|
2015-12-10 11:48:40 +00:00
|
|
|
popupMenu = this._popupMenu,
|
2015-12-02 11:12:04 +00:00
|
|
|
canvas = this._canvas,
|
2016-02-25 16:40:56 +00:00
|
|
|
rules = this._rules,
|
2017-12-08 20:06:08 +00:00
|
|
|
autoPlace = this._autoPlace,
|
2016-02-25 16:40:56 +00:00
|
|
|
translate = this._translate;
|
2014-06-27 15:52:34 +00:00
|
|
|
|
|
|
|
var actions = {};
|
|
|
|
|
|
|
|
if (element.type === 'label') {
|
|
|
|
return actions;
|
|
|
|
}
|
|
|
|
|
2015-10-09 23:28:04 +00:00
|
|
|
var businessObject = element.businessObject;
|
2014-06-27 15:52:34 +00:00
|
|
|
|
2017-12-08 10:40:55 +00:00
|
|
|
function startConnect(event, element) {
|
|
|
|
connect.start(event, element);
|
2014-09-11 14:44:56 +00:00
|
|
|
}
|
|
|
|
|
2015-02-05 15:00:05 +00:00
|
|
|
function removeElement(e) {
|
2015-10-15 21:48:14 +00:00
|
|
|
modeling.removeElements([ element ]);
|
2015-02-05 15:00:05 +00:00
|
|
|
}
|
|
|
|
|
2015-03-11 15:17:19 +00:00
|
|
|
function getReplaceMenuPosition(element) {
|
2015-02-05 15:00:05 +00:00
|
|
|
|
2015-03-04 14:27:13 +00:00
|
|
|
var Y_OFFSET = 5;
|
2015-02-05 15:00:05 +00:00
|
|
|
|
2015-03-04 14:27:13 +00:00
|
|
|
var diagramContainer = canvas.getContainer(),
|
|
|
|
pad = contextPad.getPad(element).html;
|
2015-02-05 15:00:05 +00:00
|
|
|
|
2015-03-04 14:27:13 +00:00
|
|
|
var diagramRect = diagramContainer.getBoundingClientRect(),
|
|
|
|
padRect = pad.getBoundingClientRect();
|
|
|
|
|
|
|
|
var top = padRect.top - diagramRect.top;
|
2015-05-08 12:26:05 +00:00
|
|
|
var left = padRect.left - diagramRect.left;
|
2015-02-05 15:00:05 +00:00
|
|
|
|
|
|
|
var pos = {
|
2015-05-08 12:26:05 +00:00
|
|
|
x: left,
|
2015-03-04 14:27:13 +00:00
|
|
|
y: top + padRect.height + Y_OFFSET
|
2015-02-05 15:00:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
return pos;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-01-21 10:17:11 +00:00
|
|
|
/**
|
|
|
|
* Create an append action
|
|
|
|
*
|
2020-04-03 13:51:45 +00:00
|
|
|
* @param {string} type
|
|
|
|
* @param {string} className
|
|
|
|
* @param {string} [title]
|
2016-01-21 10:17:11 +00:00
|
|
|
* @param {Object} [options]
|
|
|
|
*
|
|
|
|
* @return {Object} descriptor
|
|
|
|
*/
|
|
|
|
function appendAction(type, className, title, options) {
|
|
|
|
|
|
|
|
if (typeof title !== 'string') {
|
|
|
|
options = title;
|
2018-01-05 13:32:52 +00:00
|
|
|
title = translate('Append {type}', { type: type.replace(/^bpmn:/, '') });
|
2016-01-21 10:17:11 +00:00
|
|
|
}
|
2014-07-18 13:29:41 +00:00
|
|
|
|
2017-12-08 20:06:08 +00:00
|
|
|
function appendStart(event, element) {
|
2015-03-06 08:27:18 +00:00
|
|
|
|
|
|
|
var shape = elementFactory.createShape(assign({ type: type }, options));
|
2019-08-06 16:57:30 +00:00
|
|
|
create.start(event, shape, {
|
|
|
|
source: element
|
|
|
|
});
|
2014-12-23 15:48:12 +00:00
|
|
|
}
|
2014-06-27 15:52:34 +00:00
|
|
|
|
2017-12-08 20:06:08 +00:00
|
|
|
|
|
|
|
var append = autoPlace ? function(event, element) {
|
|
|
|
var shape = elementFactory.createShape(assign({ type: type }, options));
|
|
|
|
|
|
|
|
autoPlace.append(element, shape);
|
|
|
|
} : appendStart;
|
|
|
|
|
|
|
|
|
2014-12-07 12:08:50 +00:00
|
|
|
return {
|
|
|
|
group: 'model',
|
|
|
|
className: className,
|
2016-01-21 10:17:11 +00:00
|
|
|
title: title,
|
2014-12-07 12:08:50 +00:00
|
|
|
action: {
|
2017-12-08 20:06:08 +00:00
|
|
|
dragstart: appendStart,
|
|
|
|
click: append
|
2014-06-27 15:52:34 +00:00
|
|
|
}
|
2014-12-07 12:08:50 +00:00
|
|
|
};
|
|
|
|
}
|
2014-06-27 15:52:34 +00:00
|
|
|
|
2015-10-20 14:29:13 +00:00
|
|
|
function splitLaneHandler(count) {
|
|
|
|
|
|
|
|
return function(event, element) {
|
2019-08-19 08:39:20 +00:00
|
|
|
|
2015-10-20 14:29:13 +00:00
|
|
|
// actual split
|
|
|
|
modeling.splitLane(element, count);
|
|
|
|
|
|
|
|
// refresh context pad after split to
|
|
|
|
// get rid of split icons
|
|
|
|
contextPad.open(element, true);
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2016-03-08 16:21:41 +00:00
|
|
|
|
|
|
|
if (isAny(businessObject, [ 'bpmn:Lane', 'bpmn:Participant' ]) && isExpanded(businessObject)) {
|
2014-12-07 12:08:50 +00:00
|
|
|
|
2015-10-09 23:28:04 +00:00
|
|
|
var childLanes = getChildLanes(element);
|
|
|
|
|
|
|
|
assign(actions, {
|
|
|
|
'lane-insert-above': {
|
|
|
|
group: 'lane-insert-above',
|
2015-11-16 14:28:18 +00:00
|
|
|
className: 'bpmn-icon-lane-insert-above',
|
2016-02-25 16:40:56 +00:00
|
|
|
title: translate('Add Lane above'),
|
2015-10-09 23:28:04 +00:00
|
|
|
action: {
|
|
|
|
click: function(event, element) {
|
|
|
|
modeling.addLane(element, 'top');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
if (childLanes.length < 2) {
|
2015-10-20 15:57:41 +00:00
|
|
|
|
|
|
|
if (element.height >= 120) {
|
|
|
|
assign(actions, {
|
|
|
|
'lane-divide-two': {
|
|
|
|
group: 'lane-divide',
|
2015-11-16 14:28:18 +00:00
|
|
|
className: 'bpmn-icon-lane-divide-two',
|
2016-02-25 16:40:56 +00:00
|
|
|
title: translate('Divide into two Lanes'),
|
2015-10-20 15:57:41 +00:00
|
|
|
action: {
|
|
|
|
click: splitLaneHandler(2)
|
|
|
|
}
|
2015-10-09 23:28:04 +00:00
|
|
|
}
|
2015-10-20 15:57:41 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
if (element.height >= 180) {
|
|
|
|
assign(actions, {
|
|
|
|
'lane-divide-three': {
|
|
|
|
group: 'lane-divide',
|
2015-11-16 14:28:18 +00:00
|
|
|
className: 'bpmn-icon-lane-divide-three',
|
2016-02-25 16:40:56 +00:00
|
|
|
title: translate('Divide into three Lanes'),
|
2015-10-20 15:57:41 +00:00
|
|
|
action: {
|
|
|
|
click: splitLaneHandler(3)
|
|
|
|
}
|
2015-10-09 23:28:04 +00:00
|
|
|
}
|
2015-10-20 15:57:41 +00:00
|
|
|
});
|
|
|
|
}
|
2015-10-09 23:28:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
assign(actions, {
|
|
|
|
'lane-insert-below': {
|
|
|
|
group: 'lane-insert-below',
|
2015-11-16 14:28:18 +00:00
|
|
|
className: 'bpmn-icon-lane-insert-below',
|
2016-02-25 16:40:56 +00:00
|
|
|
title: translate('Add Lane below'),
|
2015-10-09 23:28:04 +00:00
|
|
|
action: {
|
|
|
|
click: function(event, element) {
|
|
|
|
modeling.addLane(element, 'bottom');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (is(businessObject, 'bpmn:FlowNode')) {
|
|
|
|
|
|
|
|
if (is(businessObject, 'bpmn:EventBasedGateway')) {
|
2015-02-26 15:19:34 +00:00
|
|
|
|
2015-02-24 15:21:12 +00:00
|
|
|
assign(actions, {
|
2018-01-05 13:32:52 +00:00
|
|
|
'append.receive-task': appendAction(
|
|
|
|
'bpmn:ReceiveTask',
|
2019-12-31 07:54:50 +00:00
|
|
|
'bpmn-icon-receive-task',
|
|
|
|
translate('Append ReceiveTask')
|
2018-01-05 13:32:52 +00:00
|
|
|
),
|
|
|
|
'append.message-intermediate-event': appendAction(
|
|
|
|
'bpmn:IntermediateCatchEvent',
|
|
|
|
'bpmn-icon-intermediate-event-catch-message',
|
2018-10-01 14:37:45 +00:00
|
|
|
translate('Append MessageIntermediateCatchEvent'),
|
2018-01-05 13:32:52 +00:00
|
|
|
{ eventDefinitionType: 'bpmn:MessageEventDefinition' }
|
|
|
|
),
|
|
|
|
'append.timer-intermediate-event': appendAction(
|
|
|
|
'bpmn:IntermediateCatchEvent',
|
|
|
|
'bpmn-icon-intermediate-event-catch-timer',
|
2018-10-01 14:37:45 +00:00
|
|
|
translate('Append TimerIntermediateCatchEvent'),
|
2018-01-05 13:32:52 +00:00
|
|
|
{ eventDefinitionType: 'bpmn:TimerEventDefinition' }
|
|
|
|
),
|
2019-09-08 12:16:21 +00:00
|
|
|
'append.condition-intermediate-event': appendAction(
|
2018-01-05 13:32:52 +00:00
|
|
|
'bpmn:IntermediateCatchEvent',
|
|
|
|
'bpmn-icon-intermediate-event-catch-condition',
|
2018-10-01 14:37:45 +00:00
|
|
|
translate('Append ConditionIntermediateCatchEvent'),
|
2018-01-05 13:32:52 +00:00
|
|
|
{ eventDefinitionType: 'bpmn:ConditionalEventDefinition' }
|
|
|
|
),
|
|
|
|
'append.signal-intermediate-event': appendAction(
|
|
|
|
'bpmn:IntermediateCatchEvent',
|
|
|
|
'bpmn-icon-intermediate-event-catch-signal',
|
2018-10-01 14:37:45 +00:00
|
|
|
translate('Append SignalIntermediateCatchEvent'),
|
2018-01-05 13:32:52 +00:00
|
|
|
{ eventDefinitionType: 'bpmn:SignalEventDefinition' }
|
|
|
|
)
|
2016-01-21 10:17:11 +00:00
|
|
|
});
|
|
|
|
} else
|
|
|
|
|
|
|
|
if (isEventType(businessObject, 'bpmn:BoundaryEvent', 'bpmn:CompensateEventDefinition')) {
|
|
|
|
|
|
|
|
assign(actions, {
|
|
|
|
'append.compensation-activity':
|
2018-04-09 12:33:26 +00:00
|
|
|
appendAction(
|
|
|
|
'bpmn:Task',
|
|
|
|
'bpmn-icon-task',
|
|
|
|
translate('Append compensation activity'),
|
|
|
|
{
|
|
|
|
isForCompensation: true
|
|
|
|
}
|
|
|
|
)
|
2016-01-21 10:17:11 +00:00
|
|
|
});
|
|
|
|
} else
|
|
|
|
|
|
|
|
if (!is(businessObject, 'bpmn:EndEvent') &&
|
|
|
|
!businessObject.isForCompensation &&
|
|
|
|
!isEventType(businessObject, 'bpmn:IntermediateThrowEvent', 'bpmn:LinkEventDefinition') &&
|
|
|
|
!isEventSubProcess(businessObject)) {
|
|
|
|
|
|
|
|
assign(actions, {
|
2018-01-05 13:32:52 +00:00
|
|
|
'append.end-event': appendAction(
|
|
|
|
'bpmn:EndEvent',
|
2019-05-13 13:47:40 +00:00
|
|
|
'bpmn-icon-end-event-none',
|
|
|
|
translate('Append EndEvent')
|
2018-01-05 13:32:52 +00:00
|
|
|
),
|
|
|
|
'append.gateway': appendAction(
|
|
|
|
'bpmn:ExclusiveGateway',
|
2018-04-09 12:33:26 +00:00
|
|
|
'bpmn-icon-gateway-none',
|
|
|
|
translate('Append Gateway')
|
2018-01-05 13:32:52 +00:00
|
|
|
),
|
|
|
|
'append.append-task': appendAction(
|
|
|
|
'bpmn:Task',
|
2019-05-13 13:47:40 +00:00
|
|
|
'bpmn-icon-task',
|
|
|
|
translate('Append Task')
|
2018-01-05 13:32:52 +00:00
|
|
|
),
|
|
|
|
'append.intermediate-event': appendAction(
|
|
|
|
'bpmn:IntermediateThrowEvent',
|
2018-04-09 12:33:26 +00:00
|
|
|
'bpmn-icon-intermediate-event-none',
|
|
|
|
translate('Append Intermediate/Boundary Event')
|
2018-01-05 13:32:52 +00:00
|
|
|
)
|
2014-12-07 12:08:50 +00:00
|
|
|
});
|
|
|
|
}
|
2015-09-29 05:58:26 +00:00
|
|
|
}
|
2014-12-07 12:08:50 +00:00
|
|
|
|
2018-05-09 14:48:42 +00:00
|
|
|
if (!popupMenu.isEmpty(element, 'bpmn-replace')) {
|
2019-08-19 08:39:20 +00:00
|
|
|
|
2015-02-05 15:00:05 +00:00
|
|
|
// Replace menu entry
|
2015-07-03 08:48:32 +00:00
|
|
|
assign(actions, {
|
|
|
|
'replace': {
|
|
|
|
group: 'edit',
|
2015-11-16 14:28:18 +00:00
|
|
|
className: 'bpmn-icon-screw-wrench',
|
2016-02-25 16:40:56 +00:00
|
|
|
title: translate('Change type'),
|
2015-07-03 08:48:32 +00:00
|
|
|
action: {
|
|
|
|
click: function(event, element) {
|
2018-05-09 14:48:42 +00:00
|
|
|
|
|
|
|
var position = assign(getReplaceMenuPosition(element), {
|
2016-01-05 13:37:30 +00:00
|
|
|
cursor: { x: event.x, y: event.y }
|
2018-05-09 14:48:42 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
popupMenu.open(element, 'bpmn-replace', position);
|
2015-02-05 15:00:05 +00:00
|
|
|
}
|
|
|
|
}
|
2015-07-03 08:48:32 +00:00
|
|
|
}
|
|
|
|
});
|
2014-12-23 15:48:12 +00:00
|
|
|
}
|
|
|
|
|
2021-04-07 09:48:35 +00:00
|
|
|
if (
|
|
|
|
isAny(businessObject, [
|
|
|
|
'bpmn:FlowNode',
|
|
|
|
'bpmn:InteractionNode',
|
|
|
|
'bpmn:DataObjectReference',
|
|
|
|
'bpmn:DataStoreReference',
|
|
|
|
])
|
|
|
|
) {
|
2015-04-16 07:11:04 +00:00
|
|
|
assign(actions, {
|
2021-04-07 09:48:35 +00:00
|
|
|
'append.text-annotation': appendAction(
|
|
|
|
'bpmn:TextAnnotation',
|
|
|
|
'bpmn-icon-text-annotation'
|
|
|
|
),
|
2015-04-16 07:11:04 +00:00
|
|
|
|
|
|
|
'connect': {
|
|
|
|
group: 'connect',
|
2015-11-16 14:28:18 +00:00
|
|
|
className: 'bpmn-icon-connection-multi',
|
2021-04-07 09:48:35 +00:00
|
|
|
title: translate(
|
|
|
|
'Connect using ' +
|
|
|
|
(businessObject.isForCompensation
|
|
|
|
? ''
|
|
|
|
: 'Sequence/MessageFlow or ') +
|
|
|
|
'Association'
|
|
|
|
),
|
2015-04-16 07:11:04 +00:00
|
|
|
action: {
|
|
|
|
click: startConnect,
|
2021-04-07 09:48:35 +00:00
|
|
|
dragstart: startConnect,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
if (is(businessObject, 'bpmn:TextAnnotation')) {
|
|
|
|
assign(actions, {
|
|
|
|
'connect': {
|
|
|
|
group: 'connect',
|
|
|
|
className: 'bpmn-icon-connection-multi',
|
|
|
|
title: translate('Connect using Association'),
|
|
|
|
action: {
|
|
|
|
click: startConnect,
|
|
|
|
dragstart: startConnect,
|
|
|
|
},
|
|
|
|
},
|
2015-04-16 07:11:04 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2016-01-25 20:26:46 +00:00
|
|
|
if (isAny(businessObject, [ 'bpmn:DataObjectReference', 'bpmn:DataStoreReference' ])) {
|
2015-10-06 10:33:21 +00:00
|
|
|
assign(actions, {
|
|
|
|
'connect': {
|
|
|
|
group: 'connect',
|
2015-11-16 14:28:18 +00:00
|
|
|
className: 'bpmn-icon-connection-multi',
|
2016-02-25 16:40:56 +00:00
|
|
|
title: translate('Connect using DataInputAssociation'),
|
2015-10-06 10:33:21 +00:00
|
|
|
action: {
|
|
|
|
click: startConnect,
|
|
|
|
dragstart: startConnect
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2020-06-03 12:34:27 +00:00
|
|
|
if (is(businessObject, 'bpmn:Group')) {
|
|
|
|
assign(actions, {
|
|
|
|
'append.text-annotation': appendAction('bpmn:TextAnnotation', 'bpmn-icon-text-annotation')
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2015-12-02 11:12:04 +00:00
|
|
|
// delete element entry, only show if allowed by rules
|
2016-06-07 06:46:45 +00:00
|
|
|
var deleteAllowed = rules.allowed('elements.delete', { elements: [ element ] });
|
2015-12-02 11:12:04 +00:00
|
|
|
|
|
|
|
if (isArray(deleteAllowed)) {
|
2019-08-19 08:39:20 +00:00
|
|
|
|
2015-12-02 11:12:04 +00:00
|
|
|
// was the element returned as a deletion candidate?
|
|
|
|
deleteAllowed = deleteAllowed[0] === element;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (deleteAllowed) {
|
|
|
|
assign(actions, {
|
|
|
|
'delete': {
|
|
|
|
group: 'edit',
|
|
|
|
className: 'bpmn-icon-trash',
|
2016-02-25 16:40:56 +00:00
|
|
|
title: translate('Remove'),
|
2015-12-02 11:12:04 +00:00
|
|
|
action: {
|
2017-12-06 22:30:43 +00:00
|
|
|
click: removeElement
|
2015-12-02 11:12:04 +00:00
|
|
|
}
|
2014-09-04 11:28:35 +00:00
|
|
|
}
|
2015-12-02 11:12:04 +00:00
|
|
|
});
|
|
|
|
}
|
2014-09-04 11:28:35 +00:00
|
|
|
|
2014-06-27 15:52:34 +00:00
|
|
|
return actions;
|
|
|
|
};
|
|
|
|
|
2019-12-10 13:19:11 +00:00
|
|
|
|
|
|
|
// helpers /////////
|
|
|
|
|
2015-03-07 11:59:22 +00:00
|
|
|
function isEventType(eventBo, type, definition) {
|
|
|
|
|
|
|
|
var isType = eventBo.$instanceOf(type);
|
|
|
|
var isDefinition = false;
|
|
|
|
|
|
|
|
var definitions = eventBo.eventDefinitions || [];
|
|
|
|
forEach(definitions, function(def) {
|
|
|
|
if (def.$type === definition) {
|
|
|
|
isDefinition = true;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
return isType && isDefinition;
|
2019-12-31 07:54:50 +00:00
|
|
|
}
|