mirror of
https://github.com/bpmn-io/bpmn-js.git
synced 2025-08-14 19:25:06 +08:00
chore(project): es6ify source code
* use ES6 import / export * UTILS: export individual utilities * TESTS: localize TestHelper includes BREAKING CHANGE: * all utilities export independent functions * library sources got ported to ES6. You must now use a ES module bundler such as Browserify + babelify or Webpack to consume this library (or parts of it).
This commit is contained in:
@ -1,28 +1,37 @@
|
||||
'use strict';
|
||||
|
||||
var collectLanes = require('../util/LaneUtil').collectLanes;
|
||||
import {
|
||||
collectLanes,
|
||||
getLanesRoot
|
||||
} from '../util/LaneUtil';
|
||||
|
||||
var getLanesRoot = require('../util/LaneUtil').getLanesRoot;
|
||||
import {
|
||||
is
|
||||
} from '../../../util/ModelUtil';
|
||||
|
||||
var is = require('../../../util/ModelUtil').is;
|
||||
import {
|
||||
add as collectionAdd,
|
||||
remove as collectionRemove
|
||||
} from 'diagram-js/lib/util/Collections';
|
||||
|
||||
var Collections = require('diagram-js/lib/util/Collections');
|
||||
|
||||
var asTRBL = require('diagram-js/lib/layout/LayoutUtil').asTRBL;
|
||||
import {
|
||||
asTRBL
|
||||
} from 'diagram-js/lib/layout/LayoutUtil';
|
||||
|
||||
var FLOW_NODE_REFS_ATTR = 'flowNodeRef',
|
||||
LANES_ATTR = 'lanes';
|
||||
|
||||
|
||||
/**
|
||||
* A handler that updates lane refs on changed elements
|
||||
*/
|
||||
function UpdateFlowNodeRefsHandler(elementRegistry) {
|
||||
export default function UpdateFlowNodeRefsHandler(elementRegistry) {
|
||||
this._elementRegistry = elementRegistry;
|
||||
}
|
||||
|
||||
UpdateFlowNodeRefsHandler.$inject = [ 'elementRegistry' ];
|
||||
|
||||
module.exports = UpdateFlowNodeRefsHandler;
|
||||
UpdateFlowNodeRefsHandler.$inject = [
|
||||
'elementRegistry'
|
||||
];
|
||||
|
||||
|
||||
UpdateFlowNodeRefsHandler.prototype.computeUpdates = function(flowNodeShapes, laneShapes) {
|
||||
@ -143,14 +152,14 @@ UpdateFlowNodeRefsHandler.prototype.execute = function(context) {
|
||||
|
||||
// unwire old
|
||||
update.remove.forEach(function(oldLane) {
|
||||
Collections.remove(lanes, oldLane);
|
||||
Collections.remove(oldLane.get(FLOW_NODE_REFS_ATTR), flowNode);
|
||||
collectionRemove(lanes, oldLane);
|
||||
collectionRemove(oldLane.get(FLOW_NODE_REFS_ATTR), flowNode);
|
||||
});
|
||||
|
||||
// wire new
|
||||
update.add.forEach(function(newLane) {
|
||||
Collections.add(lanes, newLane);
|
||||
Collections.add(newLane.get(FLOW_NODE_REFS_ATTR), flowNode);
|
||||
collectionAdd(lanes, newLane);
|
||||
collectionAdd(newLane.get(FLOW_NODE_REFS_ATTR), flowNode);
|
||||
});
|
||||
});
|
||||
|
||||
@ -170,14 +179,14 @@ UpdateFlowNodeRefsHandler.prototype.revert = function(context) {
|
||||
|
||||
// unwire new
|
||||
update.add.forEach(function(newLane) {
|
||||
Collections.remove(lanes, newLane);
|
||||
Collections.remove(newLane.get(FLOW_NODE_REFS_ATTR), flowNode);
|
||||
collectionRemove(lanes, newLane);
|
||||
collectionRemove(newLane.get(FLOW_NODE_REFS_ATTR), flowNode);
|
||||
});
|
||||
|
||||
// wire old
|
||||
update.remove.forEach(function(oldLane) {
|
||||
Collections.add(lanes, oldLane);
|
||||
Collections.add(oldLane.get(FLOW_NODE_REFS_ATTR), flowNode);
|
||||
collectionAdd(lanes, oldLane);
|
||||
collectionAdd(oldLane.get(FLOW_NODE_REFS_ATTR), flowNode);
|
||||
});
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user