-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathCustomContextPadProvider.js
54 lines (40 loc) · 1.26 KB
/
CustomContextPadProvider.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import inherits from 'inherits-browser';
import ContextPadProvider from 'bpmn-js/lib/features/context-pad/ContextPadProvider';
import {
isAny
} from 'bpmn-js/lib/features/modeling/util/ModelingUtil';
import {
assign,
bind
} from 'min-dash';
export default function CustomContextPadProvider(injector, connect, translate) {
injector.invoke(ContextPadProvider, this);
var cached = bind(this.getContextPadEntries, this);
this.getContextPadEntries = function(element) {
var actions = cached(element);
var businessObject = element.businessObject;
function startConnect(event, element, autoActivate) {
connect.start(event, element, autoActivate);
}
if (isAny(businessObject, [ 'custom:triangle', 'custom:circle' ])) {
assign(actions, {
'connect': {
group: 'connect',
className: 'bpmn-icon-connection-multi',
title: translate('Connect using custom connection'),
action: {
click: startConnect,
dragstart: startConnect
}
}
});
}
return actions;
};
}
inherits(CustomContextPadProvider, ContextPadProvider);
CustomContextPadProvider.$inject = [
'injector',
'connect',
'translate'
];