bpmn-js 3.4.0 → 3.5.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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * bpmn-js - bpmn-viewer v3.4.0
2
+ * bpmn-js - bpmn-viewer v3.5.0
3
3
  *
4
4
  * Copyright (c) 2014-present, camunda Services GmbH
5
5
  *
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * Source Code: https://github.com/bpmn-io/bpmn-js
10
10
  *
11
- * Date: 2019-04-25
11
+ * Date: 2019-06-28
12
12
  */
13
13
  (function (global, factory) {
14
14
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -18340,9 +18340,7 @@
18340
18340
  return done(err, parseWarnings);
18341
18341
  }
18342
18342
 
18343
- self._setDefinitions(definitions);
18344
-
18345
- self.open(bpmnDiagram, function(err, importWarnings) {
18343
+ self.importDefinitions(definitions, bpmnDiagram, function(err, importWarnings) {
18346
18344
  var allWarnings = [].concat(parseWarnings, importWarnings || []);
18347
18345
 
18348
18346
  self._emit('import.done', { error: err, warnings: allWarnings });
@@ -18352,6 +18350,40 @@
18352
18350
  });
18353
18351
  };
18354
18352
 
18353
+ /**
18354
+ * Import parsed definitions and render a BPMN 2.0 diagram.
18355
+ *
18356
+ * Once finished the viewer reports back the result to the
18357
+ * provided callback function with (err, warnings).
18358
+ *
18359
+ * ## Life-Cycle Events
18360
+ *
18361
+ * During import the viewer will fire life-cycle events:
18362
+ *
18363
+ * * import.render.start (graphical import start)
18364
+ * * import.render.complete (graphical import finished)
18365
+ *
18366
+ * You can use these events to hook into the life-cycle.
18367
+ *
18368
+ * @param {ModdleElement<Definitions>} definitions parsed BPMN 2.0 definitions
18369
+ * @param {ModdleElement<BPMNDiagram>|String} [bpmnDiagram] BPMN diagram or id of diagram to render (if not provided, the first one will be rendered)
18370
+ * @param {Function} [done] invoked with (err, warnings=[])
18371
+ */
18372
+ Viewer.prototype.importDefinitions = function(definitions, bpmnDiagram, done) {
18373
+
18374
+ if (isFunction(bpmnDiagram)) {
18375
+ done = bpmnDiagram;
18376
+ bpmnDiagram = null;
18377
+ }
18378
+
18379
+ // done is optional
18380
+ done = done || function() {};
18381
+
18382
+ this._setDefinitions(definitions);
18383
+
18384
+ return this.open(bpmnDiagram, done);
18385
+ };
18386
+
18355
18387
  /**
18356
18388
  * Open diagram of previously imported XML.
18357
18389
  *