'use strict'; var Diagram = require('diagram-js'), BpmnModdle = require('bpmn-moddle'), IdSupport = require('bpmn-moddle/lib/id-support'), Ids = require('ids'); var Viewer = require('./Viewer'); var initialDiagram = '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + ''; /** * A modeler for BPMN 2.0 diagrams. * * @class * * @inheritDoc djs.Viewer */ function Modeler(options) { Viewer.call(this, options); } Modeler.prototype = Object.create(Viewer.prototype); Modeler.prototype.createDiagram = function(done) { return this.importXML(initialDiagram, done); }; Modeler.prototype.createModdle = function() { var moddle = new BpmnModdle(); IdSupport.extend(moddle, new Ids([ 32, 36, 1 ])); return moddle; }; Modeler.prototype._interactionModules = [ // non-modeling components require('./features/label-editing'), require('./features/zoomscroll'), require('./features/touch'), require('./features/movecanvas') ]; Modeler.prototype._modelingModules = [ // modeling components require('bpmn-js-cli'), require('./features/modeling'), require('diagram-js/lib/features/move'), require('./features/context-pad') ]; // modules the modeler is composed of // // - viewer modules // - interaction modules // - modeling modules Modeler.prototype._modules = [].concat( Modeler.prototype._modules, Modeler.prototype._interactionModules, Modeler.prototype._modelingModules); module.exports = Modeler;