parent
800f0a3a5a
commit
6b23d181d5
|
@ -27,12 +27,78 @@ var initialDiagram =
|
|||
'</bpmndi:BPMNDiagram>' +
|
||||
'</bpmn:definitions>';
|
||||
|
||||
|
||||
/**
|
||||
* A modeler for BPMN 2.0 diagrams.
|
||||
*
|
||||
* @class
|
||||
*
|
||||
* @inheritDoc djs.Viewer
|
||||
* ## Extending the Modeler
|
||||
*
|
||||
* 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 bpmnModeler = new Modeler({ additionalModules: [ extensionModule ] });
|
||||
* bpmnModeler.importXML(...);
|
||||
* ```
|
||||
*
|
||||
*
|
||||
* ## Customizing / Replacing Components
|
||||
*
|
||||
* You can replace individual diagram components by redefining them in override modules.
|
||||
* This works for all components, including those defined in the core.
|
||||
*
|
||||
* Pass in override modules via the `options.additionalModules` flag like this:
|
||||
*
|
||||
* ```javascript
|
||||
* function CustomContextPadProvider(contextPad) {
|
||||
*
|
||||
* contextPad.registerProvider(this);
|
||||
*
|
||||
* this.getContextPadEntries = function(element) {
|
||||
* // no entries, effectively disable the context pad
|
||||
* return {};
|
||||
* };
|
||||
* }
|
||||
*
|
||||
* CustomContextPadProvider.$inject = [ 'contextPad' ];
|
||||
*
|
||||
* var overrideModule = {
|
||||
* contextPadProvider: [ 'type', CustomContextPadProvider ]
|
||||
* };
|
||||
*
|
||||
* var bpmnModeler = new Modeler({ additionalModules: [ overrideModule ]});
|
||||
* ```
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
function Modeler(options) {
|
||||
Viewer.call(this, options);
|
||||
|
|
Loading…
Reference in New Issue