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
  *
@@ -8002,7 +8017,7 @@
8002
8017
  collapsedElements.push(bo);
8003
8018
  }
8004
8019
 
8005
- if (is(parent, 'bpmn:SubProcess') && parent !== plane.bpmnElement) {
8020
+ if (shouldMoveToPlane(bo, plane)) {
8006
8021
 
8007
8022
  // don't change the array while we iterate over it
8008
8023
  elementsToMove.push({ diElement: diElement, parent: parent });
@@ -8091,7 +8106,7 @@
8091
8106
  SubprocessCompatibility.$inject = [ 'eventBus', 'moddle' ];
8092
8107
 
8093
8108
 
8094
- // helpers
8109
+ // helpers //////////////////////////
8095
8110
 
8096
8111
  function findRootDiagram(element) {
8097
8112
  if (is(element, 'bpmndi:BPMNDiagram')) {
@@ -8123,6 +8138,23 @@
8123
8138
  return asBounds(planeTrbl);
8124
8139
  }
8125
8140
 
8141
+ function shouldMoveToPlane(bo, plane) {
8142
+ var parent = bo.$parent;
8143
+
8144
+ // don't move elements that are already on the plane
8145
+ if (!is(parent, 'bpmn:SubProcess') || parent === plane.bpmnElement) {
8146
+ return false;
8147
+ }
8148
+
8149
+ // dataAssociations are children of the subprocess but rendered on process level
8150
+ // cf. https://github.com/bpmn-io/bpmn-js/issues/1619
8151
+ if (isAny(bo, ['bpmn:DataInputAssociation', 'bpmn:DataOutputAssociation'])) {
8152
+ return false;
8153
+ }
8154
+
8155
+ return true;
8156
+ }
8157
+
8126
8158
  var LOW_PRIORITY$3 = 250;
8127
8159
  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>';
8128
8160
 
@@ -8198,7 +8230,7 @@
8198
8230
  }, true);
8199
8231
 
8200
8232
 
8201
- eventBus.on('import.done', function() {
8233
+ eventBus.on('import.render.complete', function() {
8202
8234
  elementRegistry.filter(function(e) {
8203
8235
  return self.canDrillDown(e);
8204
8236
  }).map(function(el) {
@@ -20248,7 +20280,7 @@
20248
20280
  }
20249
20281
 
20250
20282
  /**
20251
- * Returns all diagrams in the same hirarchy as the requested diagram.
20283
+ * Returns all diagrams in the same hierarchy as the requested diagram.
20252
20284
  * Includes all parent and sub process diagrams.
20253
20285
  *
20254
20286
  * @param {Array} definitions
@@ -21226,93 +21258,6 @@
21226
21258
  // default moddle extensions the viewer is composed of
21227
21259
  Viewer.prototype._moddleExtensions = {};
21228
21260
 
21229
- var DEFAULT_RENDER_PRIORITY$2 = 1000;
21230
-
21231
- /**
21232
- * The base implementation of shape and connection renderers.
21233
- *
21234
- * @param {EventBus} eventBus
21235
- * @param {number} [renderPriority=1000]
21236
- */
21237
- function BaseRenderer$1(eventBus, renderPriority) {
21238
- var self = this;
21239
-
21240
- renderPriority = renderPriority || DEFAULT_RENDER_PRIORITY$2;
21241
-
21242
- eventBus.on([ 'render.shape', 'render.connection' ], renderPriority, function(evt, context) {
21243
- var type = evt.type,
21244
- element = context.element,
21245
- visuals = context.gfx,
21246
- attrs = context.attrs;
21247
-
21248
- if (self.canRender(element)) {
21249
- if (type === 'render.shape') {
21250
- return self.drawShape(visuals, element, attrs);
21251
- } else {
21252
- return self.drawConnection(visuals, element, attrs);
21253
- }
21254
- }
21255
- });
21256
-
21257
- eventBus.on([ 'render.getShapePath', 'render.getConnectionPath' ], renderPriority, function(evt, element) {
21258
- if (self.canRender(element)) {
21259
- if (evt.type === 'render.getShapePath') {
21260
- return self.getShapePath(element);
21261
- } else {
21262
- return self.getConnectionPath(element);
21263
- }
21264
- }
21265
- });
21266
- }
21267
-
21268
- /**
21269
- * Should check whether *this* renderer can render
21270
- * the element/connection.
21271
- *
21272
- * @param {element} element
21273
- *
21274
- * @returns {boolean}
21275
- */
21276
- BaseRenderer$1.prototype.canRender = function() {};
21277
-
21278
- /**
21279
- * Provides the shape's snap svg element to be drawn on the `canvas`.
21280
- *
21281
- * @param {djs.Graphics} visuals
21282
- * @param {Shape} shape
21283
- *
21284
- * @returns {Snap.svg} [returns a Snap.svg paper element ]
21285
- */
21286
- BaseRenderer$1.prototype.drawShape = function() {};
21287
-
21288
- /**
21289
- * Provides the shape's snap svg element to be drawn on the `canvas`.
21290
- *
21291
- * @param {djs.Graphics} visuals
21292
- * @param {Connection} connection
21293
- *
21294
- * @returns {Snap.svg} [returns a Snap.svg paper element ]
21295
- */
21296
- BaseRenderer$1.prototype.drawConnection = function() {};
21297
-
21298
- /**
21299
- * Gets the SVG path of a shape that represents it's visual bounds.
21300
- *
21301
- * @param {Shape} shape
21302
- *
21303
- * @return {string} svg path
21304
- */
21305
- BaseRenderer$1.prototype.getShapePath = function() {};
21306
-
21307
- /**
21308
- * Gets the SVG path of a connection that represents it's visual bounds.
21309
- *
21310
- * @param {Connection} connection
21311
- *
21312
- * @return {string} svg path
21313
- */
21314
- BaseRenderer$1.prototype.getConnectionPath = function() {};
21315
-
21316
21261
  function ensureImported$1(element, target) {
21317
21262
 
21318
21263
  if (element.ownerDocument !== target.ownerDocument) {
@@ -21593,10 +21538,10 @@
21593
21538
  ) {
21594
21539
  this._bpmnRenderer = bpmnRenderer;
21595
21540
 
21596
- BaseRenderer$1.call(this, eventBus, HIGH_PRIORITY);
21541
+ BaseRenderer.call(this, eventBus, HIGH_PRIORITY);
21597
21542
  }
21598
21543
 
21599
- inherits_browser(IconsRenderer, BaseRenderer$1);
21544
+ inherits_browser(IconsRenderer, BaseRenderer);
21600
21545
 
21601
21546
  IconsRenderer.prototype.canRender = function(element) {
21602
21547
 
@@ -21621,8 +21566,10 @@
21621
21566
  var icon = create$2('image');
21622
21567
  attr$2(icon, {
21623
21568
  href: modelerTemplateIcon,
21624
- x: 4,
21625
- y: 4
21569
+ x: 5,
21570
+ y: 5,
21571
+ width: 18,
21572
+ height: 18
21626
21573
  });
21627
21574
 
21628
21575
  append$1(parentGfx, icon);