camunda-bpmn-js 1.3.1 → 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
 
@@ -40689,16 +40705,23 @@
40689
40705
  var selection = this._injector.get('selection', false);
40690
40706
  var contextPad = this._injector.get('contextPad', false);
40691
40707
  var palette = this._injector.get('palette', false);
40708
+ var popupMenu = this._injector.get('popupMenu', false);
40692
40709
 
40693
40710
  const actions = {};
40694
40711
 
40695
40712
  // append
40696
- if (selection && contextPad) {
40713
+ if (selection && contextPad && palette && popupMenu && palette) {
40697
40714
  assign$1(actions, {
40698
40715
  'appendElement': function(event) {
40699
- contextPad.triggerEntry('append', 'click', event);
40700
- } }
40701
- );
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
+ });
40702
40725
  }
40703
40726
 
40704
40727
  // create
@@ -40724,7 +40747,6 @@
40724
40747
  this._injector = injector;
40725
40748
  this._keyboard = this._injector.get('keyboard', false);
40726
40749
  this._editorActions = this._injector.get('editorActions', false);
40727
- this._selection = this._injector.get('selection', false);
40728
40750
 
40729
40751
  if (this._keyboard) {
40730
40752
  this._injector.invoke(KeyboardBindings, this);
@@ -40748,7 +40770,6 @@
40748
40770
 
40749
40771
  var keyboard = this._keyboard;
40750
40772
  var editorActions = this._editorActions;
40751
- var selection = this._selection;
40752
40773
 
40753
40774
  // inherit default bindings
40754
40775
  KeyboardBindings.prototype.registerBindings.call(this, keyboard, editorActions);
@@ -40779,12 +40800,7 @@
40779
40800
 
40780
40801
  if (keyboard && keyboard.isKey([ 'a', 'A' ], event)) {
40781
40802
 
40782
- if (selection && selection.get().length == 1) {
40783
- editorActions && editorActions.trigger('appendElement', event);
40784
- } else {
40785
- editorActions && editorActions.trigger('createElement', event);
40786
- }
40787
-
40803
+ editorActions && editorActions.trigger('appendElement', event);
40788
40804
  return true;
40789
40805
  }
40790
40806
  });
@@ -40816,7 +40832,8 @@
40816
40832
  create,
40817
40833
  autoPlace,
40818
40834
  rules,
40819
- mouse
40835
+ mouse,
40836
+ translate
40820
40837
  ) {
40821
40838
  this._elementFactory = elementFactory;
40822
40839
  this._popupMenu = popupMenu;
@@ -40825,6 +40842,7 @@
40825
40842
  this._rules = rules;
40826
40843
  this._create = create;
40827
40844
  this._mouse = mouse;
40845
+ this._translate = translate;
40828
40846
 
40829
40847
  this.register();
40830
40848
  }
@@ -40835,7 +40853,8 @@
40835
40853
  'create',
40836
40854
  'autoPlace',
40837
40855
  'rules',
40838
- 'mouse'
40856
+ 'mouse',
40857
+ 'translate'
40839
40858
  ];
40840
40859
 
40841
40860
  /**
@@ -40854,6 +40873,8 @@
40854
40873
  */
40855
40874
  AppendMenuProvider.prototype.getPopupMenuEntries = function(element) {
40856
40875
  const rules = this._rules;
40876
+ const translate = this._translate;
40877
+
40857
40878
  const entries = {};
40858
40879
 
40859
40880
  if (!rules.allowed('shape.append', { element: element })) {
@@ -40877,10 +40898,13 @@
40877
40898
  } = option;
40878
40899
 
40879
40900
  entries[`append-${actionName}`] = {
40880
- label,
40901
+ label: label && translate(label),
40881
40902
  className,
40882
40903
  description,
40883
- group,
40904
+ group: group && {
40905
+ ...group,
40906
+ name: translate(group.name)
40907
+ },
40884
40908
  search,
40885
40909
  rank,
40886
40910
  action: this._createEntryAction(element, target)
@@ -40948,7 +40972,9 @@
40948
40972
  event = mouse.getLastMoveEvent();
40949
40973
  }
40950
40974
 
40951
- return create.start(event, newElement);
40975
+ return create.start(event, newElement, {
40976
+ source: element
40977
+ });
40952
40978
  };
40953
40979
 
40954
40980
  return {
@@ -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