65 Commits

Author SHA1 Message Date
Maciej Barelkowski
9c063f867b feat(Viewer): restore Viewer#importDefinitions
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.
2019-06-28 10:26:58 +02:00
Maciej Barelkowski
ff45cab7c1 test(Viewer): correctly call done 2019-06-28 10:26:58 +02:00
Maciej Barelkowski
0affb3b3bc test(Viewer): simplify multiple-diagrams test cases 2019-04-16 15:20:12 +02:00
Maciej Barelkowski
87c1d2d142 test(Viewer): expect no warnings when DIs use same elements 2019-04-16 15:20:12 +02:00
Maciej Barelkowski
a7c0bb8f57 test(Viewer): make sure it opens only selected diagram 2019-04-16 15:20:12 +02:00
Nico Rehwaldt
7b03e5289a test(import): verify duplicate DI import behavior 2019-04-16 15:20:12 +02:00
Nico Rehwaldt
ba987734f8 test(Viewer): make diagram names human readable 2019-04-16 15:20:12 +02:00
Nico Rehwaldt
2f99cff34a test(Viewer): verify non-args #open 2019-04-16 15:20:12 +02:00
Nico Rehwaldt
b1ee678fe3 test(Viewer): split config -> container handling into own describe 2019-04-16 15:20:12 +02:00
Nico Rehwaldt
a78f8037c7 test(Viewer): group multiple diagram handling 2019-04-16 15:20:12 +02:00
Valerio Spadaro
3f0583ad5f feat(Viewer): add #open method
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);
```
2019-04-16 15:20:12 +02:00
Valerio Spadaro
1c0585aaaf feat(Viewer): allow to select diagram to view
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
2019-04-16 15:20:12 +02:00
Maciej Barelkowski
0c71ad30a0 feat(Viewer): remove businessObject#di binding on #clear
Closes #978
2019-04-16 15:10:43 +02:00
Nico Rehwaldt
b60feba531 test(Viewer): verify editor action support 2018-10-29 14:52:41 +00:00
Nico Rehwaldt
3c87716895 feat(viewer): emit export events
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
2018-06-12 15:44:52 +02:00
Nico Rehwaldt
6c9d37da12 fix(project): correct library default export 2018-04-05 09:47:37 +02:00
Nico Rehwaldt
9be61259bd chore(project): drop 'use strict'
We use ES modules, so 'use strict' is not necessary anymore.
2018-04-03 18:09:53 +02:00
Nico Rehwaldt
d3449ca87c chore(project): es6ify source code
* 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).
2018-04-03 16:32:14 +02:00
Nico Rehwaldt
8c92800bd2 test(Viewer): bump SVG export timeout 2018-02-14 22:22:30 +01:00
Nico Rehwaldt
37a06a378d chore(tests): use absolute lib requires 2018-01-24 11:41:21 +01:00
Nico Rehwaldt
7ffb865023 chore(project): consistent async error handling
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.
2017-12-09 22:31:15 +01:00
Nico Rehwaldt
50da47e1e1 fix(Viewer): trigger resized on attach
Ensure components get notified on `canvas.resized`, whenever
the Viewer instance gets attached.
2017-12-07 11:59:25 +01:00
Nico Rehwaldt
9b2a07d958 style(test): re-format test case 2017-11-23 11:00:23 +01:00
Nico Rehwaldt
2ef82970fd chore(Viewer): re-expose loaded definitions
The previous release kinda removed access to the currently
loaded definitions.

This restores access by exposing it by `Viewer#getDefinitions()`.
2017-11-23 09:49:54 +01:00
Nico Rehwaldt
642d7b88af chore(Viewer+Modeler): consistently name private instance variables
BREAKING CHANGE:

* definitions, container and moddle have been prefixed with
  an underscore (_) to denote they are private use.
2017-11-20 15:28:29 +01:00
Nico Rehwaldt
ce45e9081b chore(project): bump bpmn-moddle dep
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
2017-11-15 19:55:34 +01:00
Christian Kaps
6dc4af5396 feat(Viewer): allow dynamic attach / detach from DOM
Closes #655

BREAKING CHANGE:

* Viewer / Modeler do not attach to `body` anymore per
  default. Use `new Viewer({ container: 'body' })` to
  restore the old behavior.
2017-01-27 13:28:27 +01:00
Nico Rehwaldt
a2d7140cdf fix(Viewer): correctly export SVG
Use upstream patch of tiny-svg to address this.

Closes #631
2016-11-18 15:11:31 +01:00
Nico Rehwaldt
791ccb75b2 test(project): increase single test timeout to pass on FF 2016-11-18 14:50:45 +01:00
Nico Rehwaldt
6ae4c3d0c3 test(import): verify duplicate id behavior 2016-07-26 10:53:45 +02:00
Nico Rehwaldt
0ba239bbce chore(project): switch to eslint
Use eslint instead of jshint for linting.

* better linting results
* test files linted, too
* consistent code style checks

Closes #568
2016-06-07 09:55:32 +02:00
Nico Rehwaldt
37eca38dac feat(Viewer): make importXML callback optional
People could be hooking up with import via events, too.
2016-03-17 17:44:56 +01:00
Nico Rehwaldt
46d8abdd70 feat(import): allow users to hook into via events
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)
2016-03-17 17:44:56 +01:00
Nico Rehwaldt
ff0d88bb90 chore(Viewer+Modeler): inherit from Diagram
* 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
2016-03-17 17:44:32 +01:00
Vladimirs Katusenoks
c728f7a812 test(viewer): add extra moddle test, correct assertions
Relates to #471
2016-02-25 14:57:50 +01:00
Vladimirs Katusenoks
c793c01169 fix(viewer): moddle extensions
Remove .only from test, replace merge with assign, add extra test

Relates to #471
2016-02-25 14:18:29 +01:00
davcs86
0fb1bf616e feat: add additional (default!) moddle descriptor to viewer
Closes #471
2016-02-25 13:10:56 +01:00
pedesen
7f5aefbc02 test(Viewer): remove test isolation 2016-02-22 11:47:25 +01:00
Nico Rehwaldt
d09ec1c19d feat(Viewer): add #off to remove event listeners
Closes #470
2016-02-16 10:36:21 +01:00
Nico Rehwaldt
0ad02aa780 test(Viewer): verify saveXML works 2016-02-11 17:20:27 +01:00
Nico Rehwaldt
22686f7614 fix(Viewer): allow canvas configuration
Closes #444
2016-01-08 14:42:09 +01:00
David Luis Wiegandt
6e2ec62b00 feat(Viewer): indicate empty model through an error
Fail import with an error message if the XML does not contain
a valid diagram.

Closes #417
2015-12-08 15:18:13 +01:00
Nico Rehwaldt
e00197d67a chore(tests): migrate to (.not).exist matcher
Migrate parts of our test suite that rely on legacy
`.to.be.(un)defined` matchers to Chai's `.to(.not).exist`.

Closes #423
Closes #422
2015-12-03 13:08:56 +01:00
Ricardo Matias
4930fd72d4 fix(viewer): add priority and context arguments to events
Closes #393
2015-10-22 14:08:45 +02:00
Nico Rehwaldt
f8d6658c10 fix(import): import elements with missing #flowNodeRef
We now properly import lane children with missing #flowNodeRef.

Closes #340
2015-08-25 15:49:00 +02:00
Nico Rehwaldt
b9f30d77bb test(import+export): increase timeouts 2015-07-20 17:13:47 +02:00
pedesen
c3e4ad3e40 test(project): replace jasmine with mocha
Closes #204
2015-07-15 17:42:37 +02:00
Ricardo Matias
6f8999b8ae fix(modeling/BpmnUpdater): restore children di when changing diagram type
closes #253
2015-05-04 15:08:32 +02:00
Nico Rehwaldt
e6a51f4181 test(Viewer): make sure we can bootstrap without options 2015-05-04 14:58:46 +02:00
Nico Rehwaldt
e6885eaebc test(project): replace brfs with stringify
This _could_ fix the various bundle building issues we are seeing on
travis-ci and locally.

Closes #234
2015-03-31 14:22:53 +02:00