12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- import inherits from 'inherits';
- import CoreModule from './core';
- import TranslateModule from 'diagram-js/lib/i18n/translate';
- import SelectionModule from 'diagram-js/lib/features/selection';
- import OverlaysModule from 'diagram-js/lib/features/overlays';
- import BaseViewer from './BaseViewer';
- /**
- * A viewer for BPMN 2.0 diagrams.
- *
- * Have a look at {@link NavigatedViewer} or {@link Modeler} for bundles that include
- * additional features.
- *
- *
- * ## 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(...);
- * ```
- *
- * @param {Object} [options] configuration options to pass to the viewer
- * @param {DOMElement} [options.container] the container to render the viewer in, defaults to body.
- * @param {string|number} [options.width] the width of the viewer
- * @param {string|number} [options.height] the height of the viewer
- * @param {Object} [options.moddleExtensions] extension packages to provide
- * @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
- */
- export default function Viewer(options) {
- BaseViewer.call(this, options);
- }
- inherits(Viewer, BaseViewer);
- // modules the viewer is composed of
- Viewer.prototype._modules = [
- CoreModule,
- TranslateModule,
- SelectionModule,
- OverlaysModule
- ];
- // default moddle extensions the viewer is composed of
- Viewer.prototype._moddleExtensions = {};
|