2018-04-02 21:01:53 +02:00
|
|
|
import inherits from 'inherits';
|
2014-04-09 10:50:20 +02:00
|
|
|
|
2018-04-02 21:01:53 +02:00
|
|
|
import CoreModule from './core';
|
|
|
|
import TranslateModule from 'diagram-js/lib/i18n/translate';
|
|
|
|
import SelectionModule from 'diagram-js/lib/features/selection';
|
2018-09-03 13:57:25 +07:00
|
|
|
import OverlaysModule from 'diagram-js/lib/features/overlays';
|
2021-11-03 10:29:54 +01:00
|
|
|
import DrilldownModdule from './features/drilldown';
|
2014-03-26 17:45:04 +01:00
|
|
|
|
2019-12-01 15:18:09 +01:00
|
|
|
import BaseViewer from './BaseViewer';
|
2014-03-26 17:45:04 +01:00
|
|
|
|
2019-04-04 16:17:43 +02:00
|
|
|
|
2014-04-08 15:23:52 +02:00
|
|
|
/**
|
2015-01-10 12:04:26 +01:00
|
|
|
* A viewer for BPMN 2.0 diagrams.
|
2014-04-25 16:14:36 +02:00
|
|
|
*
|
2015-01-10 12:04:26 +01:00
|
|
|
* Have a look at {@link NavigatedViewer} or {@link Modeler} for bundles that include
|
|
|
|
* additional features.
|
2014-08-01 07:55:47 +02:00
|
|
|
*
|
2015-05-04 14:49:48 +02: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 15:23:52 +02: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 10:25:03 +02:00
|
|
|
* @param {string|number} [options.width] the width of the viewer
|
|
|
|
* @param {string|number} [options.height] the height of the viewer
|
2015-02-12 15:50:23 +01:00
|
|
|
* @param {Object} [options.moddleExtensions] extension packages to provide
|
2014-08-01 07:55:47 +02: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 15:23:52 +02:00
|
|
|
*/
|
2018-04-02 21:01:53 +02:00
|
|
|
export default function Viewer(options) {
|
2019-12-01 15:18:09 +01:00
|
|
|
BaseViewer.call(this, options);
|
2014-03-18 17:01:24 +01:00
|
|
|
}
|
|
|
|
|
2019-12-01 15:18:09 +01:00
|
|
|
inherits(Viewer, BaseViewer);
|
2014-03-26 17:45:04 +01:00
|
|
|
|
2014-06-24 15:50:51 +02:00
|
|
|
// modules the viewer is composed of
|
2014-06-17 11:19:31 +02:00
|
|
|
Viewer.prototype._modules = [
|
2018-04-02 21:01:53 +02:00
|
|
|
CoreModule,
|
|
|
|
TranslateModule,
|
|
|
|
SelectionModule,
|
2021-10-18 10:28:36 +02:00
|
|
|
OverlaysModule,
|
2021-11-03 10:29:54 +01:00
|
|
|
DrilldownModdule
|
2014-06-11 14:41:55 +02:00
|
|
|
];
|
|
|
|
|
2016-02-17 18:16:10 -06:00
|
|
|
// default moddle extensions the viewer is composed of
|
2019-12-01 15:18:09 +01:00
|
|
|
Viewer.prototype._moddleExtensions = {};
|