camunda-bpmn-js 1.3.0 → 1.4.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.
@@ -17671,7 +17671,11 @@
17671
17671
  ...shapeStyle({
17672
17672
  fill: fill,
17673
17673
  stroke: stroke,
17674
- strokeWidth: 1
17674
+ strokeWidth: 1,
17675
+
17676
+ // fix for safari / chrome / firefox bug not correctly
17677
+ // resetting stroke dash array
17678
+ strokeDasharray: [ 10000, 1 ]
17675
17679
  })
17676
17680
  });
17677
17681
 
@@ -17687,7 +17691,11 @@
17687
17691
  ...shapeStyle({
17688
17692
  fill: fill,
17689
17693
  stroke: stroke,
17690
- strokeWidth: 1
17694
+ strokeWidth: 1,
17695
+
17696
+ // fix for safari / chrome / firefox bug not correctly
17697
+ // resetting stroke dash array
17698
+ strokeDasharray: [ 10000, 1 ]
17691
17699
  })
17692
17700
  });
17693
17701
 
@@ -17703,7 +17711,11 @@
17703
17711
  ...lineStyle({
17704
17712
  fill: 'none',
17705
17713
  stroke: stroke,
17706
- strokeWidth: 1.5
17714
+ strokeWidth: 1.5,
17715
+
17716
+ // fix for safari / chrome / firefox bug not correctly
17717
+ // resetting stroke dash array
17718
+ strokeDasharray: [ 10000, 1 ]
17707
17719
  })
17708
17720
  });
17709
17721
 
@@ -17720,7 +17732,11 @@
17720
17732
  ...lineStyle({
17721
17733
  fill: 'none',
17722
17734
  stroke: stroke,
17723
- strokeWidth: 1.5
17735
+ strokeWidth: 1.5,
17736
+
17737
+ // fix for safari / chrome / firefox bug not correctly
17738
+ // resetting stroke dash array
17739
+ strokeDasharray: [ 10000, 1 ]
17724
17740
  })
17725
17741
  });
17726
17742
 
@@ -20968,7 +20984,7 @@
20968
20984
  return isPrimaryButton(event) || isAuxiliaryButton(event);
20969
20985
  }
20970
20986
 
20971
- var LOW_PRIORITY$t = 500;
20987
+ var LOW_PRIORITY$u = 500;
20972
20988
 
20973
20989
 
20974
20990
  /**
@@ -21163,7 +21179,7 @@
21163
21179
  eventBus.on([
21164
21180
  'shape.changed',
21165
21181
  'connection.changed'
21166
- ], LOW_PRIORITY$t, function(event) {
21182
+ ], LOW_PRIORITY$u, function(event) {
21167
21183
 
21168
21184
  var element = event.element,
21169
21185
  gfx = event.gfx;
@@ -21171,7 +21187,7 @@
21171
21187
  eventBus.fire('interactionEvents.updateHit', { element: element, gfx: gfx });
21172
21188
  });
21173
21189
 
21174
- eventBus.on('interactionEvents.createHit', LOW_PRIORITY$t, function(event) {
21190
+ eventBus.on('interactionEvents.createHit', LOW_PRIORITY$u, function(event) {
21175
21191
  var element = event.element,
21176
21192
  gfx = event.gfx;
21177
21193
 
@@ -21448,7 +21464,7 @@
21448
21464
  interactionEvents: [ 'type', InteractionEvents ]
21449
21465
  };
21450
21466
 
21451
- var LOW_PRIORITY$s = 500;
21467
+ var LOW_PRIORITY$t = 500;
21452
21468
 
21453
21469
 
21454
21470
  /**
@@ -21487,7 +21503,7 @@
21487
21503
 
21488
21504
  // A low priortity is necessary, because outlines of labels have to be updated
21489
21505
  // after the label bounds have been updated in the renderer.
21490
- eventBus.on([ 'shape.added', 'shape.changed' ], LOW_PRIORITY$s, function(event) {
21506
+ eventBus.on([ 'shape.added', 'shape.changed' ], LOW_PRIORITY$t, function(event) {
21491
21507
  var element = event.element,
21492
21508
  gfx = event.gfx;
21493
21509
 
@@ -21933,7 +21949,7 @@
21933
21949
  // document wide unique overlay ids
21934
21950
  var ids$2 = new IdGenerator('ov');
21935
21951
 
21936
- var LOW_PRIORITY$r = 500;
21952
+ var LOW_PRIORITY$s = 500;
21937
21953
 
21938
21954
 
21939
21955
  /**
@@ -22505,7 +22521,7 @@
22505
22521
 
22506
22522
  // move integration
22507
22523
 
22508
- eventBus.on('element.changed', LOW_PRIORITY$r, function(e) {
22524
+ eventBus.on('element.changed', LOW_PRIORITY$s, function(e) {
22509
22525
  var element = e.element;
22510
22526
 
22511
22527
  var container = self._getOverlayContainer(element, true);
@@ -23465,7 +23481,7 @@
23465
23481
  return true;
23466
23482
  }
23467
23483
 
23468
- var LOW_PRIORITY$q = 250;
23484
+ var LOW_PRIORITY$r = 250;
23469
23485
  var ARROW_DOWN_SVG = '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M4.81801948,3.50735931 L10.4996894,9.1896894 L10.5,4 L12,4 L12,12 L4,12 L4,10.5 L9.6896894,10.4996894 L3.75735931,4.56801948 C3.46446609,4.27512627 3.46446609,3.80025253 3.75735931,3.50735931 C4.05025253,3.21446609 4.52512627,3.21446609 4.81801948,3.50735931 Z"/></svg>';
23470
23486
 
23471
23487
  var EMPTY_MARKER = 'bjs-drilldown-empty';
@@ -23482,7 +23498,7 @@
23482
23498
 
23483
23499
  var self = this;
23484
23500
 
23485
- this.executed('shape.toggleCollapse', LOW_PRIORITY$q, function(context) {
23501
+ this.executed('shape.toggleCollapse', LOW_PRIORITY$r, function(context) {
23486
23502
  var shape = context.shape;
23487
23503
 
23488
23504
  // Add overlay to the collapsed shape
@@ -23494,7 +23510,7 @@
23494
23510
  }, true);
23495
23511
 
23496
23512
 
23497
- this.reverted('shape.toggleCollapse', LOW_PRIORITY$q, function(context) {
23513
+ this.reverted('shape.toggleCollapse', LOW_PRIORITY$r, function(context) {
23498
23514
  var shape = context.shape;
23499
23515
 
23500
23516
  // Add overlay to the collapsed shape
@@ -23506,7 +23522,7 @@
23506
23522
  }, true);
23507
23523
 
23508
23524
 
23509
- this.executed([ 'shape.create', 'shape.move', 'shape.delete' ], LOW_PRIORITY$q,
23525
+ this.executed([ 'shape.create', 'shape.move', 'shape.delete' ], LOW_PRIORITY$r,
23510
23526
  function(context) {
23511
23527
  var oldParent = context.oldParent,
23512
23528
  newParent = context.newParent || context.parent,
@@ -23523,7 +23539,7 @@
23523
23539
  }, true);
23524
23540
 
23525
23541
 
23526
- this.reverted([ 'shape.create', 'shape.move', 'shape.delete' ], LOW_PRIORITY$q,
23542
+ this.reverted([ 'shape.create', 'shape.move', 'shape.delete' ], LOW_PRIORITY$r,
23527
23543
  function(context) {
23528
23544
  var oldParent = context.oldParent,
23529
23545
  newParent = context.newParent || context.parent,
@@ -23976,7 +23992,7 @@
23976
23992
  return target && (matches(target, 'input, textarea') || target.contentEditable === 'true');
23977
23993
  }
23978
23994
 
23979
- var LOW_PRIORITY$p = 500;
23995
+ var LOW_PRIORITY$q = 500;
23980
23996
 
23981
23997
 
23982
23998
  /**
@@ -23992,7 +24008,7 @@
23992
24008
 
23993
24009
  var self = this;
23994
24010
 
23995
- eventBus.on('editorActions.init', LOW_PRIORITY$p, function(event) {
24011
+ eventBus.on('editorActions.init', LOW_PRIORITY$q, function(event) {
23996
24012
 
23997
24013
  var editorActions = event.editorActions;
23998
24014
 
@@ -29473,14 +29489,14 @@
29473
29489
 
29474
29490
  var ICONS$1 = icons$1;
29475
29491
 
29476
- var LOW_PRIORITY$o = 900;
29492
+ var LOW_PRIORITY$p = 900;
29477
29493
 
29478
29494
  /**
29479
29495
  * A provider for align elements context pad button
29480
29496
  */
29481
29497
  function AlignElementsContextPadProvider(contextPad, popupMenu, translate, canvas) {
29482
29498
 
29483
- contextPad.registerProvider(LOW_PRIORITY$o, this);
29499
+ contextPad.registerProvider(LOW_PRIORITY$p, this);
29484
29500
 
29485
29501
  this._contextPad = contextPad;
29486
29502
  this._popupMenu = popupMenu;
@@ -30034,7 +30050,7 @@
30034
30050
  return true;
30035
30051
  }
30036
30052
 
30037
- var LOW_PRIORITY$n = 100;
30053
+ var LOW_PRIORITY$o = 100;
30038
30054
 
30039
30055
 
30040
30056
  /**
@@ -30046,7 +30062,7 @@
30046
30062
  */
30047
30063
  function AutoPlace$1(eventBus, modeling, canvas) {
30048
30064
 
30049
- eventBus.on('autoPlace', LOW_PRIORITY$n, function(context) {
30065
+ eventBus.on('autoPlace', LOW_PRIORITY$o, function(context) {
30050
30066
  var shape = context.shape,
30051
30067
  source = context.source;
30052
30068
 
@@ -33758,7 +33774,7 @@
33758
33774
  }
33759
33775
 
33760
33776
  var HIGH_PRIORITY$n = 1100,
33761
- LOW_PRIORITY$m = 900;
33777
+ LOW_PRIORITY$n = 900;
33762
33778
 
33763
33779
  var MARKER_OK$3 = 'connect-ok',
33764
33780
  MARKER_NOT_OK$3 = 'connect-not-ok';
@@ -33802,7 +33818,7 @@
33802
33818
  });
33803
33819
  });
33804
33820
 
33805
- eventBus.on('connect.hover', LOW_PRIORITY$m, function(event) {
33821
+ eventBus.on('connect.hover', LOW_PRIORITY$n, function(event) {
33806
33822
  var context = event.context,
33807
33823
  hover = event.hover,
33808
33824
  canExecute = context.canExecute;
@@ -35360,7 +35376,7 @@
35360
35376
  return !!element.labelTarget;
35361
35377
  }
35362
35378
 
35363
- var LOW_PRIORITY$l = 750;
35379
+ var LOW_PRIORITY$m = 750;
35364
35380
 
35365
35381
 
35366
35382
  function CreatePreview(
@@ -35405,7 +35421,7 @@
35405
35421
  return dragGroup;
35406
35422
  }
35407
35423
 
35408
- eventBus.on('create.move', LOW_PRIORITY$l, function(event) {
35424
+ eventBus.on('create.move', LOW_PRIORITY$m, function(event) {
35409
35425
 
35410
35426
  var hover = event.hover,
35411
35427
  context = event.context,
@@ -36187,7 +36203,7 @@
36187
36203
  });
36188
36204
  }
36189
36205
 
36190
- var LOW_PRIORITY$k = 750;
36206
+ var LOW_PRIORITY$l = 750;
36191
36207
 
36192
36208
 
36193
36209
  function BpmnCopyPaste(bpmnFactory, eventBus, moddleCopy) {
@@ -36198,7 +36214,7 @@
36198
36214
  return moddleCopy.copyElement(bo, targetBo, null, clone);
36199
36215
  }
36200
36216
 
36201
- eventBus.on('copyPaste.copyElement', LOW_PRIORITY$k, function(context) {
36217
+ eventBus.on('copyPaste.copyElement', LOW_PRIORITY$l, function(context) {
36202
36218
  var descriptor = context.descriptor,
36203
36219
  element = context.element,
36204
36220
  businessObject = getBusinessObject$1(element);
@@ -36295,7 +36311,7 @@
36295
36311
 
36296
36312
  // copy + paste processRef with participant
36297
36313
 
36298
- eventBus.on('copyPaste.copyElement', LOW_PRIORITY$k, function(context) {
36314
+ eventBus.on('copyPaste.copyElement', LOW_PRIORITY$l, function(context) {
36299
36315
  var descriptor = context.descriptor,
36300
36316
  element = context.element;
36301
36317
 
@@ -36321,7 +36337,7 @@
36321
36337
 
36322
36338
  // resolve references
36323
36339
 
36324
- eventBus.on('copyPaste.pasteElement', LOW_PRIORITY$k, function(context) {
36340
+ eventBus.on('copyPaste.pasteElement', LOW_PRIORITY$l, function(context) {
36325
36341
  var cache = context.cache,
36326
36342
  descriptor = context.descriptor;
36327
36343
 
@@ -40600,12 +40616,13 @@
40600
40616
  * A palette provider for the create elements menu.
40601
40617
  */
40602
40618
  function CreatePaletteProvider(palette, translate, popupMenu, canvas, mouse) {
40619
+
40603
40620
  this._translate = translate;
40604
40621
  this._popupMenu = popupMenu;
40605
40622
  this._canvas = canvas;
40606
40623
  this._mouse = mouse;
40607
40624
 
40608
- palette.registerProvider(this);
40625
+ palette.registerProvider(800,this);
40609
40626
  }
40610
40627
 
40611
40628
  CreatePaletteProvider.$inject = [
@@ -40618,8 +40635,7 @@
40618
40635
 
40619
40636
 
40620
40637
  CreatePaletteProvider.prototype.getPaletteEntries = function(element) {
40621
- const actions = {},
40622
- translate = this._translate,
40638
+ const translate = this._translate,
40623
40639
  popupMenu = this._popupMenu,
40624
40640
  canvas = this._canvas,
40625
40641
  mouse = this._mouse;
@@ -40642,7 +40658,7 @@
40642
40658
  };
40643
40659
  };
40644
40660
 
40645
- assign$1(actions, {
40661
+ return {
40646
40662
  'create': {
40647
40663
  group: 'create',
40648
40664
  imageUrl: createIcon,
@@ -40660,10 +40676,8 @@
40660
40676
  });
40661
40677
  }
40662
40678
  }
40663
- },
40664
- });
40665
-
40666
- return actions;
40679
+ }
40680
+ };
40667
40681
  };
40668
40682
 
40669
40683
  /**
@@ -40691,16 +40705,23 @@
40691
40705
  var selection = this._injector.get('selection', false);
40692
40706
  var contextPad = this._injector.get('contextPad', false);
40693
40707
  var palette = this._injector.get('palette', false);
40708
+ var popupMenu = this._injector.get('popupMenu', false);
40694
40709
 
40695
40710
  const actions = {};
40696
40711
 
40697
40712
  // append
40698
- if (selection && contextPad) {
40713
+ if (selection && contextPad && palette && popupMenu && palette) {
40699
40714
  assign$1(actions, {
40700
40715
  'appendElement': function(event) {
40701
- contextPad.triggerEntry('append', 'click', event);
40702
- } }
40703
- );
40716
+ const selected = selection && selection.get();
40717
+
40718
+ if (selected.length == 1 && !popupMenu.isEmpty(selected[0], 'bpmn-append')) {
40719
+ contextPad.triggerEntry('append', 'click', event);
40720
+ } else {
40721
+ palette.triggerEntry('create', 'click', event);
40722
+ }
40723
+ }
40724
+ });
40704
40725
  }
40705
40726
 
40706
40727
  // create
@@ -40726,7 +40747,6 @@
40726
40747
  this._injector = injector;
40727
40748
  this._keyboard = this._injector.get('keyboard', false);
40728
40749
  this._editorActions = this._injector.get('editorActions', false);
40729
- this._selection = this._injector.get('selection', false);
40730
40750
 
40731
40751
  if (this._keyboard) {
40732
40752
  this._injector.invoke(KeyboardBindings, this);
@@ -40750,7 +40770,6 @@
40750
40770
 
40751
40771
  var keyboard = this._keyboard;
40752
40772
  var editorActions = this._editorActions;
40753
- var selection = this._selection;
40754
40773
 
40755
40774
  // inherit default bindings
40756
40775
  KeyboardBindings.prototype.registerBindings.call(this, keyboard, editorActions);
@@ -40781,12 +40800,7 @@
40781
40800
 
40782
40801
  if (keyboard && keyboard.isKey([ 'a', 'A' ], event)) {
40783
40802
 
40784
- if (selection && selection.get().length == 1) {
40785
- editorActions && editorActions.trigger('appendElement', event);
40786
- } else {
40787
- editorActions && editorActions.trigger('createElement', event);
40788
- }
40789
-
40803
+ editorActions && editorActions.trigger('appendElement', event);
40790
40804
  return true;
40791
40805
  }
40792
40806
  });
@@ -40818,7 +40832,8 @@
40818
40832
  create,
40819
40833
  autoPlace,
40820
40834
  rules,
40821
- mouse
40835
+ mouse,
40836
+ translate
40822
40837
  ) {
40823
40838
  this._elementFactory = elementFactory;
40824
40839
  this._popupMenu = popupMenu;
@@ -40827,6 +40842,7 @@
40827
40842
  this._rules = rules;
40828
40843
  this._create = create;
40829
40844
  this._mouse = mouse;
40845
+ this._translate = translate;
40830
40846
 
40831
40847
  this.register();
40832
40848
  }
@@ -40837,7 +40853,8 @@
40837
40853
  'create',
40838
40854
  'autoPlace',
40839
40855
  'rules',
40840
- 'mouse'
40856
+ 'mouse',
40857
+ 'translate'
40841
40858
  ];
40842
40859
 
40843
40860
  /**
@@ -40856,6 +40873,8 @@
40856
40873
  */
40857
40874
  AppendMenuProvider.prototype.getPopupMenuEntries = function(element) {
40858
40875
  const rules = this._rules;
40876
+ const translate = this._translate;
40877
+
40859
40878
  const entries = {};
40860
40879
 
40861
40880
  if (!rules.allowed('shape.append', { element: element })) {
@@ -40879,10 +40898,13 @@
40879
40898
  } = option;
40880
40899
 
40881
40900
  entries[`append-${actionName}`] = {
40882
- label,
40901
+ label: label && translate(label),
40883
40902
  className,
40884
40903
  description,
40885
- group,
40904
+ group: group && {
40905
+ ...group,
40906
+ name: translate(group.name)
40907
+ },
40886
40908
  search,
40887
40909
  rank,
40888
40910
  action: this._createEntryAction(element, target)
@@ -40950,7 +40972,9 @@
40950
40972
  event = mouse.getLastMoveEvent();
40951
40973
  }
40952
40974
 
40953
- return create.start(event, newElement);
40975
+ return create.start(event, newElement, {
40976
+ source: element
40977
+ });
40954
40978
  };
40955
40979
 
40956
40980
  return {
@@ -40984,16 +41008,18 @@
40984
41008
  return true;
40985
41009
  };
40986
41010
 
41011
+ var LOW_PRIORITY$k = 900;
41012
+
40987
41013
  /**
40988
41014
  * A provider for align elements context pad button
40989
41015
  */
40990
41016
  function AppendContextPadProvider(contextPad, popupMenu, translate, canvas) {
41017
+ contextPad.registerProvider(LOW_PRIORITY$k, this);
41018
+
40991
41019
  this._contextPad = contextPad;
40992
41020
  this._popupMenu = popupMenu;
40993
41021
  this._translate = translate;
40994
41022
  this._canvas = canvas;
40995
-
40996
- contextPad.registerProvider(this);
40997
41023
  }
40998
41024
 
40999
41025
  AppendContextPadProvider.$inject = [
@@ -41010,7 +41036,7 @@
41010
41036
 
41011
41037
  if (!popupMenu.isEmpty(element, 'bpmn-append')) {
41012
41038
 
41013
- // Replace menu entry
41039
+ // append menu entry
41014
41040
  return {
41015
41041
  'append': {
41016
41042
  group: 'model',
@@ -43842,7 +43868,7 @@
43842
43868
 
43843
43869
  function activateDirectEdit(element, force) {
43844
43870
  if (force ||
43845
- isAny(element, [ 'bpmn:Task', 'bpmn:TextAnnotation' ]) ||
43871
+ isAny(element, [ 'bpmn:Task', 'bpmn:TextAnnotation', 'bpmn:Participant' ]) ||
43846
43872
  isCollapsedSubProcess(element)) {
43847
43873
 
43848
43874
  directEditing.activate(element);
@@ -104990,6 +105016,288 @@
104990
105016
  colorPopupProvider: [ 'type', ColorPopupProvider ]
104991
105017
  };
104992
105018
 
105019
+ /**
105020
+ * A popup menu provider that allows to append elements with
105021
+ * element templates.
105022
+ */
105023
+ function ElementTemplatesAppendProvider(
105024
+ popupMenu, translate, elementTemplates,
105025
+ autoPlace, create, mouse, rules) {
105026
+
105027
+ this._popupMenu = popupMenu;
105028
+ this._translate = translate;
105029
+ this._elementTemplates = elementTemplates;
105030
+ this._autoPlace = autoPlace;
105031
+ this._create = create;
105032
+ this._mouse = mouse;
105033
+ this._rules = rules;
105034
+
105035
+ this.register();
105036
+ }
105037
+
105038
+ ElementTemplatesAppendProvider.$inject = [
105039
+ 'popupMenu',
105040
+ 'translate',
105041
+ 'elementTemplates',
105042
+ 'autoPlace',
105043
+ 'create',
105044
+ 'move',
105045
+ 'rules'
105046
+ ];
105047
+
105048
+ /**
105049
+ * Register append menu provider in the popup menu
105050
+ */
105051
+ ElementTemplatesAppendProvider.prototype.register = function() {
105052
+ this._popupMenu.registerProvider('bpmn-append', this);
105053
+ };
105054
+
105055
+ /**
105056
+ * Adds the element templates to the append menu.
105057
+ * @param {djs.model.Base} element
105058
+ *
105059
+ * @returns {Object}
105060
+ */
105061
+ ElementTemplatesAppendProvider.prototype.getPopupMenuEntries = function(element) {
105062
+ return (entries) => {
105063
+
105064
+ if (!this._rules.allowed('shape.append', { element: element })) {
105065
+ return [];
105066
+ }
105067
+
105068
+ const filteredTemplates = this._filterTemplates(this._elementTemplates.getLatest());
105069
+
105070
+ // add template entries
105071
+ assign$1(entries, this.getTemplateEntries(element, filteredTemplates));
105072
+
105073
+ return entries;
105074
+ };
105075
+ };
105076
+
105077
+ /**
105078
+ * Get all element templates.
105079
+ *
105080
+ * @param {djs.model.Base} element
105081
+ *
105082
+ * @return {Object} element templates as menu entries
105083
+ */
105084
+ ElementTemplatesAppendProvider.prototype.getTemplateEntries = function(element, templates) {
105085
+
105086
+ const templateEntries = {};
105087
+
105088
+ templates.map(template => {
105089
+
105090
+ const {
105091
+ icon = {},
105092
+ category,
105093
+ } = template;
105094
+
105095
+ const entryId = `append.template-${template.id}`;
105096
+
105097
+ const defaultGroup = {
105098
+ id: 'templates',
105099
+ name: this._translate('Templates')
105100
+ };
105101
+
105102
+ templateEntries[entryId] = {
105103
+ label: template.name,
105104
+ description: template.description,
105105
+ documentationRef: template.documentationRef,
105106
+ imageUrl: icon.contents,
105107
+ group: category || defaultGroup,
105108
+ action: this._getEntryAction(element, template)
105109
+ };
105110
+ });
105111
+
105112
+ return templateEntries;
105113
+ };
105114
+
105115
+ /**
105116
+ * Filter out templates from the options.
105117
+ *
105118
+ * @param {Array<Object>} templates
105119
+ *
105120
+ * @returns {Array<Object>}
105121
+ */
105122
+ ElementTemplatesAppendProvider.prototype._filterTemplates = function(templates) {
105123
+ return templates.filter(template => {
105124
+ const {
105125
+ appliesTo,
105126
+ elementType
105127
+ } = template;
105128
+
105129
+ const type = (elementType && elementType.value) || appliesTo[0];
105130
+
105131
+ // elements that can not be appended
105132
+ if ([
105133
+ 'bpmn:StartEvent',
105134
+ 'bpmn:Participant'
105135
+ ].includes(type)) {
105136
+ return false;
105137
+ }
105138
+
105139
+ // sequence flow templates are supported
105140
+ // but connections are not appendable
105141
+ if ('bpmn:SequenceFlow' === type) {
105142
+ return false;
105143
+ }
105144
+
105145
+ return true;
105146
+ });
105147
+ };
105148
+
105149
+ /**
105150
+ * Create an action for a given template.
105151
+ *
105152
+ * @param {djs.model.Base} element
105153
+ * @param {Object} template
105154
+ *
105155
+ * @returns {Object}
105156
+ */
105157
+ ElementTemplatesAppendProvider.prototype._getEntryAction = function(element, template) {
105158
+ return {
105159
+
105160
+ click: () => {
105161
+ const newElement = this._elementTemplates.createElement(template);
105162
+ this._autoPlace.append(element, newElement);
105163
+ },
105164
+
105165
+ dragstart: (event) => {
105166
+ const newElement = this._elementTemplates.createElement(template);
105167
+
105168
+ if (event instanceof KeyboardEvent) {
105169
+ event = this._mouse.getLastMoveEvent();
105170
+ }
105171
+
105172
+ this._create.start(event, newElement, {
105173
+ source: element
105174
+ });
105175
+ }
105176
+ };
105177
+ };
105178
+
105179
+ /**
105180
+ * A popup menu provider that allows to create elements with
105181
+ * element templates.
105182
+ */
105183
+ function ElementTemplatesCreateProvider(
105184
+ popupMenu, translate, elementTemplates,
105185
+ mouse, create) {
105186
+
105187
+ this._popupMenu = popupMenu;
105188
+ this._translate = translate;
105189
+ this._elementTemplates = elementTemplates;
105190
+ this._mouse = mouse;
105191
+ this._create = create;
105192
+
105193
+ this.register();
105194
+ }
105195
+
105196
+ ElementTemplatesCreateProvider.$inject = [
105197
+ 'popupMenu',
105198
+ 'translate',
105199
+ 'elementTemplates',
105200
+ 'mouse',
105201
+ 'create'
105202
+ ];
105203
+
105204
+ /**
105205
+ * Register create menu provider in the popup menu
105206
+ */
105207
+ ElementTemplatesCreateProvider.prototype.register = function() {
105208
+ this._popupMenu.registerProvider('bpmn-create', this);
105209
+ };
105210
+
105211
+ /**
105212
+ * Adds the element templates to the create menu.
105213
+ * @param {djs.model.Base} element
105214
+ *
105215
+ * @returns {Object}
105216
+ */
105217
+ ElementTemplatesCreateProvider.prototype.getPopupMenuEntries = function(element) {
105218
+ return (entries) => {
105219
+
105220
+ // add template entries
105221
+ assign$1(entries, this.getTemplateEntries(element));
105222
+
105223
+ return entries;
105224
+ };
105225
+ };
105226
+
105227
+ /**
105228
+ * Get all element templates.
105229
+ *
105230
+ * @param {djs.model.Base} element
105231
+ *
105232
+ * @return {Array<Object>} a list of element templates as menu entries
105233
+ */
105234
+ ElementTemplatesCreateProvider.prototype.getTemplateEntries = function() {
105235
+
105236
+ const templates = this._elementTemplates.getLatest();
105237
+ const templateEntries = {};
105238
+
105239
+ templates.map(template => {
105240
+
105241
+ const {
105242
+ icon = {},
105243
+ category,
105244
+ } = template;
105245
+
105246
+ const entryId = `create.template-${template.id}`;
105247
+
105248
+ const defaultGroup = {
105249
+ id: 'templates',
105250
+ name: this._translate('Templates')
105251
+ };
105252
+
105253
+ templateEntries[entryId] = {
105254
+ label: template.name,
105255
+ description: template.description,
105256
+ documentationRef: template.documentationRef,
105257
+ imageUrl: icon.contents,
105258
+ group: category || defaultGroup,
105259
+ action: {
105260
+ click: this._getEntryAction(template),
105261
+ dragstart: this._getEntryAction(template)
105262
+ }
105263
+ };
105264
+ });
105265
+
105266
+ return templateEntries;
105267
+ };
105268
+
105269
+
105270
+ ElementTemplatesCreateProvider.prototype._getEntryAction = function(template) {
105271
+ const create = this._create;
105272
+ const popupMenu = this._popupMenu;
105273
+ const elementTemplates = this._elementTemplates;
105274
+ const mouse = this._mouse;
105275
+
105276
+ return (event) => {
105277
+
105278
+ popupMenu.close();
105279
+
105280
+ // create the new element
105281
+ let newElement = elementTemplates.createElement(template);
105282
+
105283
+ // use last mouse event if triggered via keyboard
105284
+ if (event instanceof KeyboardEvent) {
105285
+ event = mouse.getLastMoveEvent();
105286
+ }
105287
+
105288
+ return create.start(event, newElement);
105289
+ };
105290
+ };
105291
+
105292
+ var createAppendElementTemplatesModule = {
105293
+ __init__: [
105294
+ 'elementTemplatesAppendProvider',
105295
+ 'elementTemplatesCreateProvider'
105296
+ ],
105297
+ elementTemplatesAppendProvider: [ 'type', ElementTemplatesAppendProvider ],
105298
+ elementTemplatesCreateProvider: [ 'type', ElementTemplatesCreateProvider ]
105299
+ };
105300
+
104993
105301
  var inherits_browser = {exports: {}};
104994
105302
 
104995
105303
  if (typeof Object.create === 'function') {
@@ -105571,6 +105879,7 @@
105571
105879
  rulesModule,
105572
105880
  zeebePropertiesProviderModule,
105573
105881
  index$1,
105882
+ createAppendElementTemplatesModule,
105574
105883
  replaceModule,
105575
105884
  sharedReplaceModule,
105576
105885
  colorPickerModule