bpmn-js 15.2.2 → 16.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,6 +10,7 @@ import BaseRenderer from 'diagram-js/lib/draw/BaseRenderer';
10
10
 
11
11
  import {
12
12
  isExpanded,
13
+ isHorizontal,
13
14
  isEventSubProcess
14
15
  } from '../util/DiUtil';
15
16
 
@@ -1063,10 +1064,12 @@ export default function BpmnRenderer(
1063
1064
  }
1064
1065
 
1065
1066
  function renderLaneLabel(parentGfx, text, element, attrs = {}) {
1067
+ var isHorizontalLane = isHorizontal(element);
1068
+
1066
1069
  var textBox = renderLabel(parentGfx, text, {
1067
1070
  box: {
1068
1071
  height: 30,
1069
- width: getHeight(element, attrs),
1072
+ width: isHorizontalLane ? getHeight(element, attrs) : getWidth(element, attrs),
1070
1073
  },
1071
1074
  align: 'center-middle',
1072
1075
  style: {
@@ -1074,9 +1077,10 @@ export default function BpmnRenderer(
1074
1077
  }
1075
1078
  });
1076
1079
 
1077
- var top = -1 * getHeight(element, attrs);
1078
-
1079
- transform(textBox, 0, -top, 270);
1080
+ if (isHorizontalLane) {
1081
+ var top = -1 * getHeight(element, attrs);
1082
+ transform(textBox, 0, -top, 270);
1083
+ }
1080
1084
  }
1081
1085
 
1082
1086
  function renderActivity(parentGfx, element, attrs = {}) {
@@ -1794,12 +1798,13 @@ export default function BpmnRenderer(
1794
1798
  var participant = renderLane(parentGfx, element, attrs);
1795
1799
 
1796
1800
  var expandedParticipant = isExpanded(element);
1801
+ var horizontalParticipant = isHorizontal(element);
1797
1802
 
1798
1803
  var semantic = getSemantic(element),
1799
1804
  name = semantic.get('name');
1800
1805
 
1801
1806
  if (expandedParticipant) {
1802
- drawLine(parentGfx, [
1807
+ var waypoints = horizontalParticipant ? [
1803
1808
  {
1804
1809
  x: 30,
1805
1810
  y: 0
@@ -1808,20 +1813,43 @@ export default function BpmnRenderer(
1808
1813
  x: 30,
1809
1814
  y: getHeight(element, attrs)
1810
1815
  }
1811
- ], {
1816
+ ] : [
1817
+ {
1818
+ x: 0,
1819
+ y: 30
1820
+ },
1821
+ {
1822
+ x: getWidth(element, attrs),
1823
+ y: 30
1824
+ }
1825
+ ];
1826
+
1827
+ drawLine(parentGfx, waypoints, {
1812
1828
  stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
1813
1829
  strokeWidth: PARTICIPANT_STROKE_WIDTH
1814
1830
  });
1815
1831
 
1816
1832
  renderLaneLabel(parentGfx, name, element, attrs);
1817
1833
  } else {
1818
- renderLabel(parentGfx, name, {
1819
- box: getBounds(element, attrs),
1834
+ var bounds = getBounds(element, attrs);
1835
+
1836
+ if (!horizontalParticipant) {
1837
+ bounds.height = getWidth(element, attrs);
1838
+ bounds.width = getHeight(element, attrs);
1839
+ }
1840
+
1841
+ var textBox = renderLabel(parentGfx, name, {
1842
+ box: bounds,
1820
1843
  align: 'center-middle',
1821
1844
  style: {
1822
1845
  fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
1823
1846
  }
1824
1847
  });
1848
+
1849
+ if (!horizontalParticipant) {
1850
+ var top = -1 * getHeight(element, attrs);
1851
+ transform(textBox, 0, -top, 270);
1852
+ }
1825
1853
  }
1826
1854
 
1827
1855
  if (semantic.get('participantMultiplicity')) {
@@ -229,18 +229,13 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
229
229
  *
230
230
  * @param {string} type
231
231
  * @param {string} className
232
- * @param {string} [title]
232
+ * @param {string} title
233
233
  * @param {Object} [options]
234
234
  *
235
235
  * @return {ContextPadEntry}
236
236
  */
237
237
  function appendAction(type, className, title, options) {
238
238
 
239
- if (typeof title !== 'string') {
240
- options = title;
241
- title = translate('Append {type}', { type: type.replace(/^bpmn:/, '') });
242
- }
243
-
244
239
  function appendStart(event, element) {
245
240
 
246
241
  var shape = elementFactory.createShape(assign({ type: type }, options));
@@ -306,7 +301,7 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
306
301
  'lane-insert-above': {
307
302
  group: 'lane-insert-above',
308
303
  className: 'bpmn-icon-lane-insert-above',
309
- title: translate('Add Lane above'),
304
+ title: translate('Add lane above'),
310
305
  action: {
311
306
  click: function(event, element) {
312
307
  modeling.addLane(element, 'top');
@@ -322,7 +317,7 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
322
317
  'lane-divide-two': {
323
318
  group: 'lane-divide',
324
319
  className: 'bpmn-icon-lane-divide-two',
325
- title: translate('Divide into two Lanes'),
320
+ title: translate('Divide into two lanes'),
326
321
  action: {
327
322
  click: splitLaneHandler(2)
328
323
  }
@@ -335,7 +330,7 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
335
330
  'lane-divide-three': {
336
331
  group: 'lane-divide',
337
332
  className: 'bpmn-icon-lane-divide-three',
338
- title: translate('Divide into three Lanes'),
333
+ title: translate('Divide into three lanes'),
339
334
  action: {
340
335
  click: splitLaneHandler(3)
341
336
  }
@@ -348,7 +343,7 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
348
343
  'lane-insert-below': {
349
344
  group: 'lane-insert-below',
350
345
  className: 'bpmn-icon-lane-insert-below',
351
- title: translate('Add Lane below'),
346
+ title: translate('Add lane below'),
352
347
  action: {
353
348
  click: function(event, element) {
354
349
  modeling.addLane(element, 'bottom');
@@ -367,30 +362,30 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
367
362
  'append.receive-task': appendAction(
368
363
  'bpmn:ReceiveTask',
369
364
  'bpmn-icon-receive-task',
370
- translate('Append ReceiveTask')
365
+ translate('Append receive task')
371
366
  ),
372
367
  'append.message-intermediate-event': appendAction(
373
368
  'bpmn:IntermediateCatchEvent',
374
369
  'bpmn-icon-intermediate-event-catch-message',
375
- translate('Append MessageIntermediateCatchEvent'),
370
+ translate('Append message intermediate catch event'),
376
371
  { eventDefinitionType: 'bpmn:MessageEventDefinition' }
377
372
  ),
378
373
  'append.timer-intermediate-event': appendAction(
379
374
  'bpmn:IntermediateCatchEvent',
380
375
  'bpmn-icon-intermediate-event-catch-timer',
381
- translate('Append TimerIntermediateCatchEvent'),
376
+ translate('Append timer intermediate catch event'),
382
377
  { eventDefinitionType: 'bpmn:TimerEventDefinition' }
383
378
  ),
384
379
  'append.condition-intermediate-event': appendAction(
385
380
  'bpmn:IntermediateCatchEvent',
386
381
  'bpmn-icon-intermediate-event-catch-condition',
387
- translate('Append ConditionIntermediateCatchEvent'),
382
+ translate('Append conditional intermediate catch event'),
388
383
  { eventDefinitionType: 'bpmn:ConditionalEventDefinition' }
389
384
  ),
390
385
  'append.signal-intermediate-event': appendAction(
391
386
  'bpmn:IntermediateCatchEvent',
392
387
  'bpmn-icon-intermediate-event-catch-signal',
393
- translate('Append SignalIntermediateCatchEvent'),
388
+ translate('Append signal intermediate catch event'),
394
389
  { eventDefinitionType: 'bpmn:SignalEventDefinition' }
395
390
  )
396
391
  });
@@ -420,22 +415,22 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
420
415
  'append.end-event': appendAction(
421
416
  'bpmn:EndEvent',
422
417
  'bpmn-icon-end-event-none',
423
- translate('Append EndEvent')
418
+ translate('Append end event')
424
419
  ),
425
420
  'append.gateway': appendAction(
426
421
  'bpmn:ExclusiveGateway',
427
422
  'bpmn-icon-gateway-none',
428
- translate('Append Gateway')
423
+ translate('Append gateway')
429
424
  ),
430
425
  'append.append-task': appendAction(
431
426
  'bpmn:Task',
432
427
  'bpmn-icon-task',
433
- translate('Append Task')
428
+ translate('Append task')
434
429
  ),
435
430
  'append.intermediate-event': appendAction(
436
431
  'bpmn:IntermediateThrowEvent',
437
432
  'bpmn-icon-intermediate-event-none',
438
- translate('Append Intermediate/Boundary Event')
433
+ translate('Append intermediate/boundary event')
439
434
  )
440
435
  });
441
436
  }
@@ -472,7 +467,7 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
472
467
  'append.text-annotation': appendAction(
473
468
  'bpmn:TextAnnotation',
474
469
  'bpmn-icon-text-annotation',
475
- translate('Append TextAnnotation')
470
+ translate('Append text annotation')
476
471
  )
477
472
  });
478
473
  }
@@ -489,7 +484,7 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
489
484
  'append.text-annotation': appendAction(
490
485
  'bpmn:TextAnnotation',
491
486
  'bpmn-icon-text-annotation',
492
- translate('Append TextAnnotation')
487
+ translate('Append text annotation')
493
488
  ),
494
489
 
495
490
  'connect': {
@@ -499,8 +494,8 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
499
494
  'Connect using ' +
500
495
  (businessObject.isForCompensation
501
496
  ? ''
502
- : 'Sequence/MessageFlow or ') +
503
- 'Association'
497
+ : 'sequence/message flow or ') +
498
+ 'association'
504
499
  ),
505
500
  action: {
506
501
  click: startConnect,
@@ -515,7 +510,7 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
515
510
  'connect': {
516
511
  group: 'connect',
517
512
  className: 'bpmn-icon-connection-multi',
518
- title: translate('Connect using Association'),
513
+ title: translate('Connect using association'),
519
514
  action: {
520
515
  click: startConnect,
521
516
  dragstart: startConnect,
@@ -529,7 +524,7 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
529
524
  'connect': {
530
525
  group: 'connect',
531
526
  className: 'bpmn-icon-connection-multi',
532
- title: translate('Connect using DataInputAssociation'),
527
+ title: translate('Connect using data input association'),
533
528
  action: {
534
529
  click: startConnect,
535
530
  dragstart: startConnect
@@ -543,7 +538,7 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
543
538
  'append.text-annotation': appendAction(
544
539
  'bpmn:TextAnnotation',
545
540
  'bpmn-icon-text-annotation',
546
- translate('Append TextAnnotation')
541
+ translate('Append text annotation')
547
542
  )
548
543
  });
549
544
  }
@@ -11,7 +11,11 @@ import {
11
11
  } from '../../util/ModelUtil';
12
12
 
13
13
  import { isAny } from '../modeling/util/ModelingUtil';
14
- import { isExpanded } from '../../util/DiUtil';
14
+
15
+ import {
16
+ isExpanded,
17
+ isHorizontal
18
+ } from '../../util/DiUtil';
15
19
 
16
20
  import {
17
21
  getExternalLabelMid,
@@ -277,13 +281,47 @@ LabelEditingProvider.prototype.getEditingBBox = function(element) {
277
281
 
278
282
  // adjust for expanded pools AND lanes
279
283
  if (is(element, 'bpmn:Lane') || isExpandedPool(element)) {
284
+ var isHorizontalLane = isHorizontal(element);
280
285
 
281
- assign(bounds, {
286
+ var laneBounds = isHorizontalLane ? {
282
287
  width: bbox.height,
283
288
  height: 30 * zoom,
284
289
  x: bbox.x - bbox.height / 2 + (15 * zoom),
285
290
  y: mid.y - (30 * zoom) / 2
291
+ } : {
292
+ width: bbox.width,
293
+ height: 30 * zoom
294
+ };
295
+
296
+ assign(bounds, laneBounds);
297
+
298
+ assign(style, {
299
+ fontSize: defaultFontSize + 'px',
300
+ lineHeight: defaultLineHeight,
301
+ paddingTop: (7 * zoom) + 'px',
302
+ paddingBottom: (7 * zoom) + 'px',
303
+ paddingLeft: (5 * zoom) + 'px',
304
+ paddingRight: (5 * zoom) + 'px',
305
+ transform: isHorizontalLane ? 'rotate(-90deg)' : null
286
306
  });
307
+ }
308
+
309
+
310
+ // internal labels for collapsed participants
311
+ if (isCollapsedPool(element)) {
312
+ var isHorizontalPool = isHorizontal(element);
313
+
314
+ var poolBounds = isHorizontalPool ? {
315
+ width: bbox.width,
316
+ height: bbox.height
317
+ } : {
318
+ width: bbox.height,
319
+ height: bbox.width,
320
+ x: mid.x - bbox.height / 2,
321
+ y: mid.y - bbox.width / 2
322
+ };
323
+
324
+ assign(bounds, poolBounds);
287
325
 
288
326
  assign(style, {
289
327
  fontSize: defaultFontSize + 'px',
@@ -292,15 +330,14 @@ LabelEditingProvider.prototype.getEditingBBox = function(element) {
292
330
  paddingBottom: (7 * zoom) + 'px',
293
331
  paddingLeft: (5 * zoom) + 'px',
294
332
  paddingRight: (5 * zoom) + 'px',
295
- transform: 'rotate(-90deg)'
333
+ transform: isHorizontalPool ? null : 'rotate(-90deg)'
296
334
  });
297
335
  }
298
336
 
299
337
 
300
- // internal labels for tasks and collapsed call activities,
301
- // sub processes and participants
338
+ // internal labels for tasks and collapsed call activities
339
+ // and sub processes
302
340
  if (isAny(element, [ 'bpmn:Task', 'bpmn:CallActivity' ]) ||
303
- isCollapsedPool(element) ||
304
341
  isCollapsedSubProcess(element)) {
305
342
 
306
343
  assign(bounds, {
@@ -35,10 +35,15 @@ export default function IsHorizontalFix(eventBus) {
35
35
  bo = getBusinessObject(shape),
36
36
  di = getDi(shape);
37
37
 
38
- if (isAny(bo, elementTypesToUpdate) && !di.get('isHorizontal')) {
38
+ if (isAny(bo, elementTypesToUpdate)) {
39
+ var isHorizontal = di.get('isHorizontal');
40
+
41
+ if (isHorizontal === undefined) {
42
+ isHorizontal = true;
43
+ }
39
44
 
40
45
  // set attribute directly to avoid modeling#updateProperty side effects
41
- di.set('isHorizontal', true);
46
+ di.set('isHorizontal', isHorizontal);
42
47
  }
43
48
  });
44
49
 
@@ -84,12 +84,10 @@ PaletteProvider.prototype.getPaletteEntries = function() {
84
84
  create.start(event, shape);
85
85
  }
86
86
 
87
- var shortType = type.replace(/^bpmn:/, '');
88
-
89
87
  return {
90
88
  group: group,
91
89
  className: className,
92
- title: title || translate('Create {type}', { type: shortType }),
90
+ title: title,
93
91
  action: {
94
92
  dragstart: createListener,
95
93
  click: createListener
@@ -127,7 +125,7 @@ PaletteProvider.prototype.getPaletteEntries = function() {
127
125
  'hand-tool': {
128
126
  group: 'tools',
129
127
  className: 'bpmn-icon-hand-tool',
130
- title: translate('Activate the hand tool'),
128
+ title: translate('Activate hand tool'),
131
129
  action: {
132
130
  click: function(event) {
133
131
  handTool.activateHand(event);
@@ -137,7 +135,7 @@ PaletteProvider.prototype.getPaletteEntries = function() {
137
135
  'lasso-tool': {
138
136
  group: 'tools',
139
137
  className: 'bpmn-icon-lasso-tool',
140
- title: translate('Activate the lasso tool'),
138
+ title: translate('Activate lasso tool'),
141
139
  action: {
142
140
  click: function(event) {
143
141
  lassoTool.activateSelection(event);
@@ -147,7 +145,7 @@ PaletteProvider.prototype.getPaletteEntries = function() {
147
145
  'space-tool': {
148
146
  group: 'tools',
149
147
  className: 'bpmn-icon-space-tool',
150
- title: translate('Activate the create/remove space tool'),
148
+ title: translate('Activate create/remove space tool'),
151
149
  action: {
152
150
  click: function(event) {
153
151
  spaceTool.activateSelection(event);
@@ -157,7 +155,7 @@ PaletteProvider.prototype.getPaletteEntries = function() {
157
155
  'global-connect-tool': {
158
156
  group: 'tools',
159
157
  className: 'bpmn-icon-connection-multi',
160
- title: translate('Activate the global connect tool'),
158
+ title: translate('Activate global connect tool'),
161
159
  action: {
162
160
  click: function(event) {
163
161
  globalConnect.start(event);
@@ -170,36 +168,36 @@ PaletteProvider.prototype.getPaletteEntries = function() {
170
168
  },
171
169
  'create.start-event': createAction(
172
170
  'bpmn:StartEvent', 'event', 'bpmn-icon-start-event-none',
173
- translate('Create StartEvent')
171
+ translate('Create start event')
174
172
  ),
175
173
  'create.intermediate-event': createAction(
176
174
  'bpmn:IntermediateThrowEvent', 'event', 'bpmn-icon-intermediate-event-none',
177
- translate('Create Intermediate/Boundary Event')
175
+ translate('Create intermediate/boundary event')
178
176
  ),
179
177
  'create.end-event': createAction(
180
178
  'bpmn:EndEvent', 'event', 'bpmn-icon-end-event-none',
181
- translate('Create EndEvent')
179
+ translate('Create end event')
182
180
  ),
183
181
  'create.exclusive-gateway': createAction(
184
182
  'bpmn:ExclusiveGateway', 'gateway', 'bpmn-icon-gateway-none',
185
- translate('Create Gateway')
183
+ translate('Create gateway')
186
184
  ),
187
185
  'create.task': createAction(
188
186
  'bpmn:Task', 'activity', 'bpmn-icon-task',
189
- translate('Create Task')
187
+ translate('Create task')
190
188
  ),
191
189
  'create.data-object': createAction(
192
190
  'bpmn:DataObjectReference', 'data-object', 'bpmn-icon-data-object',
193
- translate('Create DataObjectReference')
191
+ translate('Create data object reference')
194
192
  ),
195
193
  'create.data-store': createAction(
196
194
  'bpmn:DataStoreReference', 'data-store', 'bpmn-icon-data-store',
197
- translate('Create DataStoreReference')
195
+ translate('Create data store reference')
198
196
  ),
199
197
  'create.subprocess-expanded': {
200
198
  group: 'activity',
201
199
  className: 'bpmn-icon-subprocess-expanded',
202
- title: translate('Create expanded SubProcess'),
200
+ title: translate('Create expanded sub-process'),
203
201
  action: {
204
202
  dragstart: createSubprocess,
205
203
  click: createSubprocess
@@ -208,7 +206,7 @@ PaletteProvider.prototype.getPaletteEntries = function() {
208
206
  'create.participant-expanded': {
209
207
  group: 'collaboration',
210
208
  className: 'bpmn-icon-participant',
211
- title: translate('Create Pool/Participant'),
209
+ title: translate('Create pool/participant'),
212
210
  action: {
213
211
  dragstart: createParticipant,
214
212
  click: createParticipant
@@ -216,7 +214,7 @@ PaletteProvider.prototype.getPaletteEntries = function() {
216
214
  },
217
215
  'create.group': createAction(
218
216
  'bpmn:Group', 'artifact', 'bpmn-icon-group',
219
- translate('Create Group')
217
+ translate('Create group')
220
218
  ),
221
219
  });
222
220
 
@@ -268,7 +268,7 @@ ReplaceMenuProvider.prototype.getPopupMenuEntries = function(target) {
268
268
  // collapsed sub process cannot be replaced with itself
269
269
  if (is(businessObject, 'bpmn:SubProcess') && !isExpanded(target)) {
270
270
  filteredReplaceOptions = filter(filteredReplaceOptions, function(replaceOption) {
271
- return replaceOption.label !== 'Sub Process (collapsed)';
271
+ return replaceOption.label !== 'Sub-process (collapsed)';
272
272
  });
273
273
  }
274
274
 
@@ -511,7 +511,7 @@ ReplaceMenuProvider.prototype._getLoopCharacteristicsHeaderEntries = function(ta
511
511
  return {
512
512
  'toggle-parallel-mi' : {
513
513
  className: 'bpmn-icon-parallel-mi-marker',
514
- title: translate('Parallel Multi Instance'),
514
+ title: translate('Parallel multi-instance'),
515
515
  active: isParallel,
516
516
  action: toggleLoopEntry,
517
517
  options: {
@@ -521,7 +521,7 @@ ReplaceMenuProvider.prototype._getLoopCharacteristicsHeaderEntries = function(ta
521
521
  },
522
522
  'toggle-sequential-mi': {
523
523
  className: 'bpmn-icon-sequential-mi-marker',
524
- title: translate('Sequential Multi Instance'),
524
+ title: translate('Sequential multi-instance'),
525
525
  active: isSequential,
526
526
  action: toggleLoopEntry,
527
527
  options: {
@@ -609,7 +609,7 @@ ReplaceMenuProvider.prototype._getParticipantMultiplicityHeaderEntries = functio
609
609
  return {
610
610
  'toggle-participant-multiplicity': {
611
611
  className: 'bpmn-icon-parallel-mi-marker',
612
- title: translate('Participant Multiplicity'),
612
+ title: translate('Participant multiplicity'),
613
613
  active: !!participantMultiplicity,
614
614
  action: toggleParticipantMultiplicity,
615
615
  }
@@ -668,7 +668,7 @@ ReplaceMenuProvider.prototype._getNonInterruptingHeaderEntries = function(elemen
668
668
  return {
669
669
  'toggle-non-interrupting': {
670
670
  imageHtml: icon,
671
- title: translate('Toggle Non-Interrupting'),
671
+ title: translate('Toggle non-interrupting'),
672
672
  active: isNonInterrupting,
673
673
  action: function() {
674
674
  self._modeling.updateProperties(element, {