1 import { assign } from 'min-dash';
4 * A palette that allows you to create BPMN _and_ custom elements.
6 export default function PaletteProvider(
16 this._create = create;
17 this._elementFactory = elementFactory;
18 this._spaceTool = spaceTool;
19 this._lassoTool = lassoTool;
20 this._handTool = handTool;
21 this._globalConnect = globalConnect;
22 this._translate = translate;
24 palette.registerProvider(this);
27 PaletteProvider.$inject = [
38 PaletteProvider.prototype.getPaletteEntries = function() {
40 create = this._create,
41 elementFactory = this._elementFactory,
42 spaceTool = this._spaceTool,
43 lassoTool = this._lassoTool,
44 handTool = this._handTool,
45 globalConnect = this._globalConnect,
46 translate = this._translate;
48 function createAction(type, group, className, title, options) {
49 function createListener(event) {
50 var shape = elementFactory.createShape(
51 assign({ type: type }, options)
55 shape.businessObject.di.isExpanded = options.isExpanded;
58 create.start(event, shape);
61 var shortType = type.replace(/^bpmn:/, '');
66 title: title || 'Create ' + shortType,
68 dragstart: createListener,
77 className: 'bpmn-icon-hand-tool',
78 title: translate('Activate the hand tool'),
80 click: function(event) {
81 handTool.activateHand(event);
87 className: 'bpmn-icon-lasso-tool',
88 title: translate('Activate the lasso tool'),
90 click: function(event) {
91 lassoTool.activateSelection(event);
97 className: 'bpmn-icon-space-tool',
98 title: translate('Activate the create/remove space tool'),
100 click: function(event) {
101 spaceTool.activateSelection(event);
105 'global-connect-tool': {
107 className: 'bpmn-icon-connection-multi',
108 title: translate('Activate the global connect tool'),
110 click: function(event) {
111 globalConnect.toggle(event);
119 'create.start-event': createAction(
122 'bpmn-icon-start-event-none'
124 'create.intermediate-event': createAction(
125 'bpmn:IntermediateThrowEvent',
127 'bpmn-icon-intermediate-event-none',
128 translate('Create Intermediate/Boundary Event')
130 'create.end-event': createAction(
133 'bpmn-icon-end-event-none'
135 'create.exclusive-gateway': createAction(
136 'bpmn:ExclusiveGateway',
138 'bpmn-icon-gateway-none',
139 translate('Create Gateway')
141 'create.task': createAction('bpmn:Task', 'activity', 'bpmn-icon-task'),
142 'create.subprocess-expanded': createAction(
145 'bpmn-icon-subprocess-expanded',
146 translate('Create expanded SubProcess'),