The <import.parse.complete> event is now invoked with
{
error,
definitions,
elementsById,
references,
warnings
}
The old payload is deprecated:
{
error,
definitions,
context: { elementsById, references, warnings }
}
This commit promisifies following APIs:
BaseViewer#importXML
BaseViewer#importDefinitions
BaseViewer#open
BaseViewer#saveXML
BaseViewer#saveSVG
Modeler#createDiagram
Related to https://github.com/bpmn-io/bpmn-js/issues/812
BREAKING CHANGES:
* Users are now expected to have Promises either by default or
polyfilled as the APIs return a Promise now.
This was removed in f8f9334, but it occurred that
the method is used productively by some of the clients.
This commit restores the method as part of public API.
Use `Viewer#importDefinitions` to import previously
parsed definitions. Now it is also possible to pass
the diagram or diagram id to be rendered during
graphical import.
This adds a method to switch displayed diagram without reimporting
xml via
```
var viewer = new Viewer({ container: container });
viewer.importXML(xml, diagramId, done);
var diagrams = viewer.getDefinitions().diagrams;
viewer.open(diagrams[1], done);
```
This introduces a new parameter to `Viewer#importXML`
which enables to choose the diagram to display.
```
var viewer = new Viewer({ container: container });
viewer.importXML(xml, diagramId, done);
```
Closes#87
This makes the viewer emit events during SVG and XML export.
These events allow others to hook in, i.e. to trigger additional _save_
actions.
Closes#811
* use ES6 import / export
* UTILS: export individual utilities
* TESTS: localize TestHelper includes
BREAKING CHANGE:
* all utilities export independent functions
* library sources got ported to ES6. You must now use
a ES module bundler such as Browserify + babelify or
Webpack to consume this library (or parts of it).
Async utilities properly propagate _all_ errors to the
specified _done_ callback. Failing in _done_ does not
re-invoke it.
Adjustments made in
* Viewer#importXML
* Viewer#saveSVG
* Importer#importBpmnDiagram
Tests cleaned up to remove un-necessary `if (err) { ...` snippets.
This improves the import and export of BPMN 2.0 XML documents
+ improves di prefix collision handling
+ proper deconflicting of prefixes during export
+ validate and detect non-BPMN root elements
+ replace underlying XML parser for higher speed and smaller
bundle size
+ pass parse warnings with errors
NOTE:
* some error messages on broken XML may have changed
due to changes in the underlying XML parser
Closes#655
BREAKING CHANGE:
* Viewer / Modeler do not attach to `body` anymore per
default. Use `new Viewer({ container: 'body' })` to
restore the old behavior.
This commit adds more life-cycle events users can
plug into during xml parsing and rendering:
* import.parse.start
* import.parse.complete
* import.render.start
* import.render.complete
* import.done
Some other events had to go because of that, namely
* import.start
* import.(success|error)
BREAKING CHANGE:
* the event import.start got renamed to import.render.start
* the events import.success and import.error got removed
in favour of import.render.complete (passing err, warnings)
* simplifies event handling
* relies on Diagram#clear to reset the diagram before
successive imports
* allows diagram services to be re-used across imports
* allows diagram services to be injected (or retrieved)
before import
Closes#237