2018-04-02 19:01:53 +00:00
|
|
|
import inherits from 'inherits';
|
2014-04-09 08:50:20 +00:00
|
|
|
|
2018-04-02 19:01:53 +00:00
|
|
|
import CoreModule from './core';
|
|
|
|
import TranslateModule from 'diagram-js/lib/i18n/translate';
|
|
|
|
import SelectionModule from 'diagram-js/lib/features/selection';
|
2018-09-03 06:57:25 +00:00
|
|
|
import OverlaysModule from 'diagram-js/lib/features/overlays';
|
2014-03-26 16:45:04 +00:00
|
|
|
|
2019-12-01 14:18:09 +00:00
|
|
|
import BaseViewer from './BaseViewer';
|
2014-03-26 16:45:04 +00:00
|
|
|
|
2019-04-04 14:17:43 +00:00
|
|
|
|
2014-04-08 13:23:52 +00:00
|
|
|
/**
|
2015-01-10 11:04:26 +00:00
|
|
|
* A viewer for BPMN 2.0 diagrams.
|
2014-04-25 14:14:36 +00:00
|
|
|
*
|
2015-01-10 11:04:26 +00:00
|
|
|
* Have a look at {@link NavigatedViewer} or {@link Modeler} for bundles that include
|
|
|
|
* additional features.
|
2014-08-01 05:55:47 +00:00
|
|
|
*
|
2015-05-04 12:49:48 +00:00
|
|
|
*
|
|
|
|
* ## Extending the Viewer
|
|
|
|
*
|
|
|
|
* In order to extend the viewer pass extension modules to bootstrap via the
|
|
|
|
* `additionalModules` option. An extension module is an object that exposes
|
|
|
|
* named services.
|
|
|
|
*
|
|
|
|
* The following example depicts the integration of a simple
|
|
|
|
* logging component that integrates with interaction events:
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* ```javascript
|
|
|
|
*
|
|
|
|
* // logging component
|
|
|
|
* function InteractionLogger(eventBus) {
|
|
|
|
* eventBus.on('element.hover', function(event) {
|
|
|
|
* console.log()
|
|
|
|
* })
|
|
|
|
* }
|
|
|
|
*
|
|
|
|
* InteractionLogger.$inject = [ 'eventBus' ]; // minification save
|
|
|
|
*
|
|
|
|
* // extension module
|
|
|
|
* var extensionModule = {
|
|
|
|
* __init__: [ 'interactionLogger' ],
|
|
|
|
* interactionLogger: [ 'type', InteractionLogger ]
|
|
|
|
* };
|
|
|
|
*
|
|
|
|
* // extend the viewer
|
|
|
|
* var bpmnViewer = new Viewer({ additionalModules: [ extensionModule ] });
|
|
|
|
* bpmnViewer.importXML(...);
|
|
|
|
* ```
|
|
|
|
*
|
2014-04-08 13:23:52 +00:00
|
|
|
* @param {Object} [options] configuration options to pass to the viewer
|
|
|
|
* @param {DOMElement} [options.container] the container to render the viewer in, defaults to body.
|
2020-04-06 08:25:03 +00:00
|
|
|
* @param {string|number} [options.width] the width of the viewer
|
|
|
|
* @param {string|number} [options.height] the height of the viewer
|
2015-02-12 14:50:23 +00:00
|
|
|
* @param {Object} [options.moddleExtensions] extension packages to provide
|
2014-08-01 05:55:47 +00:00
|
|
|
* @param {Array<didi.Module>} [options.modules] a list of modules to override the default modules
|
|
|
|
* @param {Array<didi.Module>} [options.additionalModules] a list of modules to use with the default modules
|
2014-04-08 13:23:52 +00:00
|
|
|
*/
|
2018-04-02 19:01:53 +00:00
|
|
|
export default function Viewer(options) {
|
2019-12-01 14:18:09 +00:00
|
|
|
BaseViewer.call(this, options);
|
2014-03-18 16:01:24 +00:00
|
|
|
}
|
|
|
|
|
2019-12-01 14:18:09 +00:00
|
|
|
inherits(Viewer, BaseViewer);
|
2014-03-26 16:45:04 +00:00
|
|
|
|
2014-06-24 13:50:51 +00:00
|
|
|
// modules the viewer is composed of
|
2014-06-17 09:19:31 +00:00
|
|
|
Viewer.prototype._modules = [
|
2018-04-02 19:01:53 +00:00
|
|
|
CoreModule,
|
|
|
|
TranslateModule,
|
|
|
|
SelectionModule,
|
2018-09-03 06:57:25 +00:00
|
|
|
OverlaysModule
|
2014-06-11 12:41:55 +00:00
|
|
|
];
|
|
|
|
|
2016-02-18 00:16:10 +00:00
|
|
|
// default moddle extensions the viewer is composed of
|
2019-12-01 14:18:09 +00:00
|
|
|
Viewer.prototype._moddleExtensions = {};
|