1 | /**
|
2 | * A modeler for BPMN 2.0 diagrams.
|
3 | *
|
4 | *
|
5 | * ## Extending the Modeler
|
6 | *
|
7 | * In order to extend the viewer pass extension modules to bootstrap via the
|
8 | * `additionalModules` option. An extension module is an object that exposes
|
9 | * named services.
|
10 | *
|
11 | * The following example depicts the integration of a simple
|
12 | * logging component that integrates with interaction events:
|
13 | *
|
14 | *
|
15 | * ```javascript
|
16 | *
|
17 | * // logging component
|
18 | * function InteractionLogger(eventBus) {
|
19 | * eventBus.on('element.hover', function(event) {
|
20 | * console.log()
|
21 | * })
|
22 | * }
|
23 | *
|
24 | * InteractionLogger.$inject = [ 'eventBus' ]; // minification save
|
25 | *
|
26 | * // extension module
|
27 | * var extensionModule = {
|
28 | * __init__: [ 'interactionLogger' ],
|
29 | * interactionLogger: [ 'type', InteractionLogger ]
|
30 | * };
|
31 | *
|
32 | * // extend the viewer
|
33 | * var bpmnModeler = new Modeler({ additionalModules: [ extensionModule ] });
|
34 | * bpmnModeler.importXML(...);
|
35 | * ```
|
36 | *
|
37 | *
|
38 | * ## Customizing / Replacing Components
|
39 | *
|
40 | * You can replace individual diagram components by redefining them in override modules.
|
41 | * This works for all components, including those defined in the core.
|
42 | *
|
43 | * Pass in override modules via the `options.additionalModules` flag like this:
|
44 | *
|
45 | * ```javascript
|
46 | * function CustomContextPadProvider(contextPad) {
|
47 | *
|
48 | * contextPad.registerProvider(this);
|
49 | *
|
50 | * this.getContextPadEntries = function(element) {
|
51 | * // no entries, effectively disable the context pad
|
52 | * return {};
|
53 | * };
|
54 | * }
|
55 | *
|
56 | * CustomContextPadProvider.$inject = [ 'contextPad' ];
|
57 | *
|
58 | * var overrideModule = {
|
59 | * contextPadProvider: [ 'type', CustomContextPadProvider ]
|
60 | * };
|
61 | *
|
62 | * var bpmnModeler = new Modeler({ additionalModules: [ overrideModule ]});
|
63 | * ```
|
64 | *
|
65 | */
|
66 | export default class Modeler extends BaseModeler {
|
67 | static Viewer: typeof Viewer;
|
68 | static NavigatedViewer: typeof NavigatedViewer;
|
69 |
|
70 | /**
|
71 | * Create a new diagram to start modeling.
|
72 | *
|
73 | * @throws {ImportXMLError} An error thrown during the import of the XML.
|
74 | *
|
75 | * @return A promise resolving with warnings that were produced during the import.
|
76 | */
|
77 | createDiagram(): Promise<ImportXMLResult>;
|
78 | }
|
79 |
|
80 | type BaseViewerOptions = import('./BaseViewer').BaseViewerOptions;
|
81 | type ImportXMLResult = import('./BaseViewer').ImportXMLResult;
|
82 | import BaseModeler from './BaseModeler';
|
83 | import Viewer from './Viewer';
|
84 | import NavigatedViewer from './NavigatedViewer';
|