chore(project): pull bpmn-moddle changes
This commit is contained in:
parent
9e2ad175df
commit
925fbc98b8
|
@ -1,7 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var Diagram = require('diagram-js'),
|
var Diagram = require('diagram-js'),
|
||||||
BpmnModel = require('bpmn-moddle'),
|
BpmnModdle = require('bpmn-moddle'),
|
||||||
$ = require('jquery'),
|
$ = require('jquery'),
|
||||||
_ = require('lodash');
|
_ = require('lodash');
|
||||||
|
|
||||||
|
@ -72,6 +72,7 @@ function Viewer(options) {
|
||||||
// unwrap jquery
|
// unwrap jquery
|
||||||
this.container = container.get(0);
|
this.container = container.get(0);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The code in the <project-logo></project-logo> area
|
* The code in the <project-logo></project-logo> area
|
||||||
* must not be changed, see http://bpmn.io/license for more information
|
* must not be changed, see http://bpmn.io/license for more information
|
||||||
|
@ -104,7 +105,9 @@ Viewer.prototype.importXML = function(xml, done) {
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
BpmnModel.fromXML(xml, 'bpmn:Definitions', function(err, definitions) {
|
this.moddle = this.createModdle();
|
||||||
|
|
||||||
|
this.moddle.fromXML(xml, 'bpmn:Definitions', function(err, definitions) {
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
err = checkValidationError(err);
|
err = checkValidationError(err);
|
||||||
|
@ -128,11 +131,14 @@ Viewer.prototype.saveXML = function(options, done) {
|
||||||
return done(new Error('no definitions loaded'));
|
return done(new Error('no definitions loaded'));
|
||||||
}
|
}
|
||||||
|
|
||||||
BpmnModel.toXML(definitions, options, function(err, xml) {
|
this.moddle.toXML(definitions, options, function(err, xml) {
|
||||||
done(err, xml);
|
done(err, xml);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Viewer.prototype.createModdle = function() {
|
||||||
|
return new BpmnModdle();
|
||||||
|
};
|
||||||
|
|
||||||
var SVG_HEADER =
|
var SVG_HEADER =
|
||||||
'<?xml version="1.0" encoding="utf-8"?>\n' +
|
'<?xml version="1.0" encoding="utf-8"?>\n' +
|
||||||
|
@ -209,7 +215,8 @@ Viewer.prototype._createDiagram = function(options) {
|
||||||
|
|
||||||
// add self as an available service
|
// add self as an available service
|
||||||
modules.unshift({
|
modules.unshift({
|
||||||
bpmnjs: [ 'value', this ]
|
bpmnjs: [ 'value', this ],
|
||||||
|
moddle: [ 'value', this.moddle ]
|
||||||
});
|
});
|
||||||
|
|
||||||
options = _.omit(options, 'additionalModules');
|
options = _.omit(options, 'additionalModules');
|
||||||
|
|
|
@ -2,15 +2,13 @@
|
||||||
|
|
||||||
var _ = require('lodash');
|
var _ = require('lodash');
|
||||||
|
|
||||||
var BpmnModdle = require('bpmn-moddle');
|
|
||||||
|
|
||||||
|
function BpmnFactory(moddle) {
|
||||||
function BpmnFactory() {
|
this._model = moddle;
|
||||||
this._model = BpmnModdle.instance();
|
|
||||||
this._uuid = 1;
|
this._uuid = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
BpmnFactory.$inject = [ ];
|
BpmnFactory.$inject = [ 'moddle' ];
|
||||||
|
|
||||||
|
|
||||||
BpmnFactory.prototype._needsId = function(element) {
|
BpmnFactory.prototype._needsId = function(element) {
|
||||||
|
|
|
@ -9,17 +9,17 @@ var Matchers = require('../../Matchers'),
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
|
|
||||||
var Diagram = require('diagram-js/lib/Diagram'),
|
var Diagram = require('diagram-js/lib/Diagram'),
|
||||||
BpmnModel = require('bpmn-moddle'),
|
BpmnModdle = require('bpmn-moddle'),
|
||||||
Importer = require('../../../lib/import/Importer'),
|
Importer = require('../../../lib/import/Importer'),
|
||||||
Viewer = require('../../../lib/Viewer');
|
Viewer = require('../../../lib/Viewer');
|
||||||
|
|
||||||
|
|
||||||
describe('import - importer', function() {
|
describe('import - importer', function() {
|
||||||
|
|
||||||
var bpmnModel = BpmnModel.instance();
|
var moddle = new BpmnModdle();
|
||||||
|
|
||||||
function read(xml, opts, callback) {
|
function read(xml, opts, callback) {
|
||||||
return BpmnModel.fromXML(xml, 'bpmn:Definitions', opts, callback);
|
return moddle.fromXML(xml, 'bpmn:Definitions', opts, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
beforeEach(Matchers.addDeepEquals);
|
beforeEach(Matchers.addDeepEquals);
|
||||||
|
@ -47,7 +47,7 @@ describe('import - importer', function() {
|
||||||
|
|
||||||
|
|
||||||
function runImport(diagram, xml, done) {
|
function runImport(diagram, xml, done) {
|
||||||
BpmnModel.fromXML(xml, function(err, definitions) {
|
moddle.fromXML(xml, function(err, definitions) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
var BpmnModel = require('bpmn-moddle');
|
var BpmnModdle = require('bpmn-moddle');
|
||||||
|
|
||||||
describe('model - browser support', function() {
|
describe('model - browser support', function() {
|
||||||
|
|
||||||
|
var moddle = new BpmnModdle();
|
||||||
|
|
||||||
function read(xml, callback, done) {
|
function read(xml, callback, done) {
|
||||||
|
|
||||||
BpmnModel.fromXML(xml, 'bpmn:Definitions', function(err, definitions) {
|
moddle.fromXML(xml, 'bpmn:Definitions', function(err, definitions) {
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
done(err);
|
done(err);
|
||||||
|
@ -15,6 +17,7 @@ describe('model - browser support', function() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
it('should parse simple xml', function(done) {
|
it('should parse simple xml', function(done) {
|
||||||
|
|
||||||
var xml =
|
var xml =
|
||||||
|
|
Loading…
Reference in New Issue