camunda-bpmn-js 0.13.2 → 0.14.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.
@@ -507,6 +507,21 @@
507
507
  return bo && (typeof bo.$instanceOf === 'function') && bo.$instanceOf(type);
508
508
  }
509
509
 
510
+
511
+ /**
512
+ * Return true if element has any of the given types.
513
+ *
514
+ * @param {djs.model.Base} element
515
+ * @param {Array<string>} types
516
+ *
517
+ * @return {boolean}
518
+ */
519
+ function isAny(element, types) {
520
+ return some(types, function(t) {
521
+ return is(element, t);
522
+ });
523
+ }
524
+
510
525
  /**
511
526
  * Return the business object for a given element.
512
527
  *
@@ -8019,7 +8034,7 @@
8019
8034
  collapsedElements.push(bo);
8020
8035
  }
8021
8036
 
8022
- if (is(parent, 'bpmn:SubProcess') && parent !== plane.bpmnElement) {
8037
+ if (shouldMoveToPlane(bo, plane)) {
8023
8038
 
8024
8039
  // don't change the array while we iterate over it
8025
8040
  elementsToMove.push({ diElement: diElement, parent: parent });
@@ -8108,7 +8123,7 @@
8108
8123
  SubprocessCompatibility.$inject = [ 'eventBus', 'moddle' ];
8109
8124
 
8110
8125
 
8111
- // helpers
8126
+ // helpers //////////////////////////
8112
8127
 
8113
8128
  function findRootDiagram(element) {
8114
8129
  if (is(element, 'bpmndi:BPMNDiagram')) {
@@ -8140,6 +8155,23 @@
8140
8155
  return asBounds(planeTrbl);
8141
8156
  }
8142
8157
 
8158
+ function shouldMoveToPlane(bo, plane) {
8159
+ var parent = bo.$parent;
8160
+
8161
+ // don't move elements that are already on the plane
8162
+ if (!is(parent, 'bpmn:SubProcess') || parent === plane.bpmnElement) {
8163
+ return false;
8164
+ }
8165
+
8166
+ // dataAssociations are children of the subprocess but rendered on process level
8167
+ // cf. https://github.com/bpmn-io/bpmn-js/issues/1619
8168
+ if (isAny(bo, ['bpmn:DataInputAssociation', 'bpmn:DataOutputAssociation'])) {
8169
+ return false;
8170
+ }
8171
+
8172
+ return true;
8173
+ }
8174
+
8143
8175
  var LOW_PRIORITY$3 = 250;
8144
8176
  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>';
8145
8177
 
@@ -8215,7 +8247,7 @@
8215
8247
  }, true);
8216
8248
 
8217
8249
 
8218
- eventBus.on('import.done', function() {
8250
+ eventBus.on('import.render.complete', function() {
8219
8251
  elementRegistry.filter(function(e) {
8220
8252
  return self.canDrillDown(e);
8221
8253
  }).map(function(el) {
@@ -20265,7 +20297,7 @@
20265
20297
  }
20266
20298
 
20267
20299
  /**
20268
- * Returns all diagrams in the same hirarchy as the requested diagram.
20300
+ * Returns all diagrams in the same hierarchy as the requested diagram.
20269
20301
  * Includes all parent and sub process diagrams.
20270
20302
  *
20271
20303
  * @param {Array} definitions
@@ -22217,93 +22249,6 @@
22217
22249
  NavigatedViewer.prototype._navigationModules
22218
22250
  );
22219
22251
 
22220
- var DEFAULT_RENDER_PRIORITY$2 = 1000;
22221
-
22222
- /**
22223
- * The base implementation of shape and connection renderers.
22224
- *
22225
- * @param {EventBus} eventBus
22226
- * @param {number} [renderPriority=1000]
22227
- */
22228
- function BaseRenderer$1(eventBus, renderPriority) {
22229
- var self = this;
22230
-
22231
- renderPriority = renderPriority || DEFAULT_RENDER_PRIORITY$2;
22232
-
22233
- eventBus.on([ 'render.shape', 'render.connection' ], renderPriority, function(evt, context) {
22234
- var type = evt.type,
22235
- element = context.element,
22236
- visuals = context.gfx,
22237
- attrs = context.attrs;
22238
-
22239
- if (self.canRender(element)) {
22240
- if (type === 'render.shape') {
22241
- return self.drawShape(visuals, element, attrs);
22242
- } else {
22243
- return self.drawConnection(visuals, element, attrs);
22244
- }
22245
- }
22246
- });
22247
-
22248
- eventBus.on([ 'render.getShapePath', 'render.getConnectionPath' ], renderPriority, function(evt, element) {
22249
- if (self.canRender(element)) {
22250
- if (evt.type === 'render.getShapePath') {
22251
- return self.getShapePath(element);
22252
- } else {
22253
- return self.getConnectionPath(element);
22254
- }
22255
- }
22256
- });
22257
- }
22258
-
22259
- /**
22260
- * Should check whether *this* renderer can render
22261
- * the element/connection.
22262
- *
22263
- * @param {element} element
22264
- *
22265
- * @returns {boolean}
22266
- */
22267
- BaseRenderer$1.prototype.canRender = function() {};
22268
-
22269
- /**
22270
- * Provides the shape's snap svg element to be drawn on the `canvas`.
22271
- *
22272
- * @param {djs.Graphics} visuals
22273
- * @param {Shape} shape
22274
- *
22275
- * @returns {Snap.svg} [returns a Snap.svg paper element ]
22276
- */
22277
- BaseRenderer$1.prototype.drawShape = function() {};
22278
-
22279
- /**
22280
- * Provides the shape's snap svg element to be drawn on the `canvas`.
22281
- *
22282
- * @param {djs.Graphics} visuals
22283
- * @param {Connection} connection
22284
- *
22285
- * @returns {Snap.svg} [returns a Snap.svg paper element ]
22286
- */
22287
- BaseRenderer$1.prototype.drawConnection = function() {};
22288
-
22289
- /**
22290
- * Gets the SVG path of a shape that represents it's visual bounds.
22291
- *
22292
- * @param {Shape} shape
22293
- *
22294
- * @return {string} svg path
22295
- */
22296
- BaseRenderer$1.prototype.getShapePath = function() {};
22297
-
22298
- /**
22299
- * Gets the SVG path of a connection that represents it's visual bounds.
22300
- *
22301
- * @param {Connection} connection
22302
- *
22303
- * @return {string} svg path
22304
- */
22305
- BaseRenderer$1.prototype.getConnectionPath = function() {};
22306
-
22307
22252
  function ensureImported$1(element, target) {
22308
22253
 
22309
22254
  if (element.ownerDocument !== target.ownerDocument) {
@@ -22584,10 +22529,10 @@
22584
22529
  ) {
22585
22530
  this._bpmnRenderer = bpmnRenderer;
22586
22531
 
22587
- BaseRenderer$1.call(this, eventBus, HIGH_PRIORITY);
22532
+ BaseRenderer.call(this, eventBus, HIGH_PRIORITY);
22588
22533
  }
22589
22534
 
22590
- inherits_browser(IconsRenderer, BaseRenderer$1);
22535
+ inherits_browser(IconsRenderer, BaseRenderer);
22591
22536
 
22592
22537
  IconsRenderer.prototype.canRender = function(element) {
22593
22538
 
@@ -22612,8 +22557,10 @@
22612
22557
  var icon = create$2('image');
22613
22558
  attr$2(icon, {
22614
22559
  href: modelerTemplateIcon,
22615
- x: 4,
22616
- y: 4
22560
+ x: 5,
22561
+ y: 5,
22562
+ width: 18,
22563
+ height: 18
22617
22564
  });
22618
22565
 
22619
22566
  append$1(parentGfx, icon);