mirror of
https://github.com/sartography/bpmn-js.git
synced 2025-01-11 17:44:12 +00: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:
parent
56a644177d
commit
d3449ca87c
2
index.js
2
index.js
@ -1 +1 @@
|
||||
module.exports = require('./lib/Viewer');
|
||||
export default './lib/Viewer';
|
@ -1,12 +1,32 @@
|
||||
'use strict';
|
||||
|
||||
var inherits = require('inherits');
|
||||
import inherits from 'inherits';
|
||||
|
||||
var Ids = require('ids');
|
||||
import Ids from 'ids';
|
||||
|
||||
var Viewer = require('./Viewer');
|
||||
import Viewer from './Viewer';
|
||||
|
||||
import NavigatedViewer from './NavigatedViewer';
|
||||
|
||||
import MoveCanvasModule from 'diagram-js/lib/navigation/movecanvas';
|
||||
import TouchModule from 'diagram-js/lib/navigation/touch';
|
||||
import ZoomScrollModule from 'diagram-js/lib/navigation/zoomscroll';
|
||||
|
||||
import AutoScrollModule from 'diagram-js/lib/features/auto-scroll';
|
||||
import BendpointsModule from 'diagram-js/lib/features/bendpoints';
|
||||
import MoveModule from 'diagram-js/lib/features/move';
|
||||
import ResizeModule from 'diagram-js/lib/features/resize';
|
||||
import AutoResizeModule from './features/auto-resize';
|
||||
import AutoPlaceModule from './features/auto-place';
|
||||
import EditorActionsModule from './features/editor-actions';
|
||||
import ContextPadModule from './features/context-pad';
|
||||
import KeyboardModule from './features/keyboard';
|
||||
import LabelEditingModule from './features/label-editing';
|
||||
import ModelingModule from './features/modeling';
|
||||
import PaletteModule from './features/palette';
|
||||
import ReplacePreviewModule from './features/replace-preview';
|
||||
import SnappingModule from './features/snapping';
|
||||
|
||||
var NavigatedViewer = require('./NavigatedViewer');
|
||||
|
||||
var initialDiagram =
|
||||
'<?xml version="1.0" encoding="UTF-8"?>' +
|
||||
@ -101,7 +121,7 @@ var initialDiagram =
|
||||
* @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) {
|
||||
export default function Modeler(options) {
|
||||
Viewer.call(this, options);
|
||||
|
||||
// hook ID collection into the modeler
|
||||
@ -118,11 +138,8 @@ function Modeler(options) {
|
||||
|
||||
inherits(Modeler, Viewer);
|
||||
|
||||
module.exports = Modeler;
|
||||
|
||||
module.exports.Viewer = Viewer;
|
||||
|
||||
module.exports.NavigatedViewer = NavigatedViewer;
|
||||
Modeler.Viewer = Viewer;
|
||||
Modeler.NavigatedViewer = NavigatedViewer;
|
||||
|
||||
/**
|
||||
* Create a new diagram to start modeling.
|
||||
@ -170,30 +187,29 @@ Modeler.prototype._collectIds = function(definitions, context) {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Modeler.prototype._interactionModules = [
|
||||
// non-modeling components
|
||||
require('diagram-js/lib/navigation/movecanvas'),
|
||||
require('diagram-js/lib/navigation/touch'),
|
||||
require('diagram-js/lib/navigation/zoomscroll')
|
||||
MoveCanvasModule,
|
||||
TouchModule,
|
||||
ZoomScrollModule
|
||||
];
|
||||
|
||||
Modeler.prototype._modelingModules = [
|
||||
// modeling components
|
||||
require('diagram-js/lib/features/auto-scroll'),
|
||||
require('diagram-js/lib/features/bendpoints'),
|
||||
require('diagram-js/lib/features/move'),
|
||||
require('diagram-js/lib/features/resize'),
|
||||
require('./features/auto-resize'),
|
||||
require('./features/auto-place'),
|
||||
require('./features/editor-actions'),
|
||||
require('./features/context-pad'),
|
||||
require('./features/keyboard'),
|
||||
require('./features/label-editing'),
|
||||
require('./features/modeling'),
|
||||
require('./features/palette'),
|
||||
require('./features/replace-preview'),
|
||||
require('./features/snapping')
|
||||
AutoScrollModule,
|
||||
BendpointsModule,
|
||||
MoveModule,
|
||||
ResizeModule,
|
||||
AutoResizeModule,
|
||||
AutoPlaceModule,
|
||||
EditorActionsModule,
|
||||
ContextPadModule,
|
||||
KeyboardModule,
|
||||
LabelEditingModule,
|
||||
ModelingModule,
|
||||
PaletteModule,
|
||||
ReplacePreviewModule,
|
||||
SnappingModule
|
||||
];
|
||||
|
||||
|
||||
|
@ -1,26 +1,26 @@
|
||||
'use strict';
|
||||
|
||||
var inherits = require('inherits');
|
||||
import inherits from 'inherits';
|
||||
|
||||
var Viewer = require('./Viewer');
|
||||
import Viewer from './Viewer';
|
||||
|
||||
import MoveCanvasModule from 'diagram-js/lib/navigation/movecanvas';
|
||||
import ZoomScrollModule from 'diagram-js/lib/navigation/zoomscroll';
|
||||
|
||||
/**
|
||||
* A viewer that includes mouse navigation facilities
|
||||
*
|
||||
* @param {Object} options
|
||||
*/
|
||||
function NavigatedViewer(options) {
|
||||
export default function NavigatedViewer(options) {
|
||||
Viewer.call(this, options);
|
||||
}
|
||||
|
||||
inherits(NavigatedViewer, Viewer);
|
||||
|
||||
module.exports = NavigatedViewer;
|
||||
|
||||
NavigatedViewer.prototype._navigationModules = [
|
||||
require('diagram-js/lib/navigation/zoomscroll'),
|
||||
require('diagram-js/lib/navigation/movecanvas')
|
||||
MoveCanvasModule,
|
||||
ZoomScrollModule
|
||||
];
|
||||
|
||||
NavigatedViewer.prototype._modules = [].concat(
|
||||
|
@ -6,23 +6,35 @@
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
var assign = require('min-dash').assign,
|
||||
isNumber = require('min-dash').isNumber,
|
||||
omit = require('min-dash').omit;
|
||||
import {
|
||||
assign,
|
||||
isNumber,
|
||||
omit
|
||||
} from 'min-dash';
|
||||
|
||||
var domify = require('min-dom').domify,
|
||||
domQuery = require('min-dom').query,
|
||||
domRemove = require('min-dom').remove;
|
||||
import {
|
||||
domify,
|
||||
query as domQuery,
|
||||
remove as domRemove
|
||||
} from 'min-dom';
|
||||
|
||||
var innerSVG = require('tiny-svg').innerSVG;
|
||||
import {
|
||||
innerSVG
|
||||
} from 'tiny-svg';
|
||||
|
||||
var Diagram = require('diagram-js'),
|
||||
BpmnModdle = require('bpmn-moddle');
|
||||
import Diagram from 'diagram-js';
|
||||
import BpmnModdle from 'bpmn-moddle';
|
||||
|
||||
import inherits from 'inherits';
|
||||
|
||||
var inherits = require('inherits');
|
||||
import {
|
||||
importBpmnDiagram
|
||||
} from './import/Importer';
|
||||
|
||||
var importBpmnDiagram = require('./import/Importer').importBpmnDiagram;
|
||||
import CoreModule from './core';
|
||||
import TranslateModule from 'diagram-js/lib/i18n/translate';
|
||||
import SelectionModule from 'diagram-js/lib/features/selection';
|
||||
import OveraysModule from 'diagram-js/lib/features/overlays';
|
||||
|
||||
|
||||
function checkValidationError(err) {
|
||||
@ -103,7 +115,7 @@ function ensureUnit(val) {
|
||||
* @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 Viewer(options) {
|
||||
export default function Viewer(options) {
|
||||
|
||||
options = assign({}, DEFAULT_OPTIONS, options);
|
||||
|
||||
@ -122,8 +134,6 @@ function Viewer(options) {
|
||||
|
||||
inherits(Viewer, Diagram);
|
||||
|
||||
module.exports = Viewer;
|
||||
|
||||
|
||||
/**
|
||||
* Parse and render a BPMN 2.0 diagram.
|
||||
@ -457,13 +467,12 @@ Viewer.prototype._createModdle = function(options) {
|
||||
return new BpmnModdle(moddleOptions);
|
||||
};
|
||||
|
||||
|
||||
// modules the viewer is composed of
|
||||
Viewer.prototype._modules = [
|
||||
require('./core'),
|
||||
require('diagram-js/lib/i18n/translate'),
|
||||
require('diagram-js/lib/features/selection'),
|
||||
require('diagram-js/lib/features/overlays')
|
||||
CoreModule,
|
||||
TranslateModule,
|
||||
SelectionModule,
|
||||
OveraysModule
|
||||
];
|
||||
|
||||
// default moddle extensions the viewer is composed of
|
||||
@ -471,8 +480,14 @@ Viewer.prototype._moddleExtensions = {};
|
||||
|
||||
/* <project-logo> */
|
||||
|
||||
var PoweredBy = require('./util/PoweredByUtil'),
|
||||
domEvent = require('min-dom').event;
|
||||
import {
|
||||
open as openPoweredBy,
|
||||
BPMNIO_IMG
|
||||
} from './util/PoweredByUtil';
|
||||
|
||||
import {
|
||||
event as domEvent
|
||||
} from 'min-dom';
|
||||
|
||||
/**
|
||||
* Adds the project logo to the diagram container as
|
||||
@ -483,7 +498,7 @@ var PoweredBy = require('./util/PoweredByUtil'),
|
||||
* @param {Element} container
|
||||
*/
|
||||
function addProjectLogo(container) {
|
||||
var img = PoweredBy.BPMNIO_IMG;
|
||||
var img = BPMNIO_IMG;
|
||||
|
||||
var linkMarkup =
|
||||
'<a href="http://bpmn.io" ' +
|
||||
@ -499,7 +514,7 @@ function addProjectLogo(container) {
|
||||
container.appendChild(linkElement);
|
||||
|
||||
domEvent.bind(linkElement, 'click', function(event) {
|
||||
PoweredBy.open();
|
||||
openPoweredBy();
|
||||
|
||||
event.preventDefault();
|
||||
});
|
||||
|
@ -1,6 +1,9 @@
|
||||
module.exports = {
|
||||
import DrawModule from '../draw';
|
||||
import ImportModule from '../import';
|
||||
|
||||
export default {
|
||||
__depends__: [
|
||||
require('../draw'),
|
||||
require('../import')
|
||||
DrawModule,
|
||||
ImportModule
|
||||
]
|
||||
};
|
@ -1,9 +1,13 @@
|
||||
'use strict';
|
||||
|
||||
var every = require('min-dash').every,
|
||||
some = require('min-dash').some;
|
||||
import {
|
||||
every,
|
||||
some
|
||||
} from 'min-dash';
|
||||
|
||||
var componentsToPath = require('diagram-js/lib/util/RenderUtil').componentsToPath;
|
||||
import {
|
||||
componentsToPath
|
||||
} from 'diagram-js/lib/util/RenderUtil';
|
||||
|
||||
|
||||
// element utils //////////////////////
|
||||
@ -13,7 +17,7 @@ var componentsToPath = require('diagram-js/lib/util/RenderUtil').componentsToPat
|
||||
*
|
||||
* @return {boolean} true if element is of the given semantic type
|
||||
*/
|
||||
function isTypedEvent(event, eventDefinitionType, filter) {
|
||||
export function isTypedEvent(event, eventDefinitionType, filter) {
|
||||
|
||||
function matches(definition, filter) {
|
||||
return every(filter, function(val, key) {
|
||||
@ -30,53 +34,39 @@ function isTypedEvent(event, eventDefinitionType, filter) {
|
||||
});
|
||||
}
|
||||
|
||||
module.exports.isTypedEvent = isTypedEvent;
|
||||
|
||||
function isThrowEvent(event) {
|
||||
export function isThrowEvent(event) {
|
||||
return (event.$type === 'bpmn:IntermediateThrowEvent') || (event.$type === 'bpmn:EndEvent');
|
||||
}
|
||||
|
||||
module.exports.isThrowEvent = isThrowEvent;
|
||||
|
||||
function isCollection(element) {
|
||||
export function isCollection(element) {
|
||||
var dataObject = element.dataObjectRef;
|
||||
|
||||
return element.isCollection || (dataObject && dataObject.isCollection);
|
||||
}
|
||||
|
||||
module.exports.isCollection = isCollection;
|
||||
|
||||
function getDi(element) {
|
||||
export function getDi(element) {
|
||||
return element.businessObject.di;
|
||||
}
|
||||
|
||||
module.exports.getDi = getDi;
|
||||
|
||||
function getSemantic(element) {
|
||||
export function getSemantic(element) {
|
||||
return element.businessObject;
|
||||
}
|
||||
|
||||
module.exports.getSemantic = getSemantic;
|
||||
|
||||
|
||||
// color access //////////////////////
|
||||
|
||||
function getFillColor(element, defaultColor) {
|
||||
export function getFillColor(element, defaultColor) {
|
||||
return getDi(element).get('bioc:fill') || defaultColor || 'white';
|
||||
}
|
||||
|
||||
module.exports.getFillColor = getFillColor;
|
||||
|
||||
function getStrokeColor(element, defaultColor) {
|
||||
export function getStrokeColor(element, defaultColor) {
|
||||
return getDi(element).get('bioc:stroke') || defaultColor || 'black';
|
||||
}
|
||||
|
||||
module.exports.getStrokeColor = getStrokeColor;
|
||||
|
||||
|
||||
// cropping path customizations //////////////////////
|
||||
|
||||
function getCirclePath(shape) {
|
||||
export function getCirclePath(shape) {
|
||||
|
||||
var cx = shape.x + shape.width / 2,
|
||||
cy = shape.y + shape.height / 2,
|
||||
@ -93,9 +83,7 @@ function getCirclePath(shape) {
|
||||
return componentsToPath(circlePath);
|
||||
}
|
||||
|
||||
module.exports.getCirclePath = getCirclePath;
|
||||
|
||||
function getRoundRectPath(shape, borderRadius) {
|
||||
export function getRoundRectPath(shape, borderRadius) {
|
||||
|
||||
var x = shape.x,
|
||||
y = shape.y,
|
||||
@ -118,9 +106,7 @@ function getRoundRectPath(shape, borderRadius) {
|
||||
return componentsToPath(roundRectPath);
|
||||
}
|
||||
|
||||
module.exports.getRoundRectPath = getRoundRectPath;
|
||||
|
||||
function getDiamondPath(shape) {
|
||||
export function getDiamondPath(shape) {
|
||||
|
||||
var width = shape.width,
|
||||
height = shape.height,
|
||||
@ -140,9 +126,7 @@ function getDiamondPath(shape) {
|
||||
return componentsToPath(diamondPath);
|
||||
}
|
||||
|
||||
module.exports.getDiamondPath = getDiamondPath;
|
||||
|
||||
function getRectPath(shape) {
|
||||
export function getRectPath(shape) {
|
||||
var x = shape.x,
|
||||
y = shape.y,
|
||||
width = shape.width,
|
||||
@ -158,5 +142,3 @@ function getRectPath(shape) {
|
||||
|
||||
return componentsToPath(rectPath);
|
||||
}
|
||||
|
||||
module.exports.getRectPath = getRectPath;
|
@ -1,46 +1,61 @@
|
||||
'use strict';
|
||||
|
||||
var inherits = require('inherits'),
|
||||
isObject = require('min-dash').isObject,
|
||||
assign = require('min-dash').assign,
|
||||
forEach = require('min-dash').forEach;
|
||||
import inherits from 'inherits';
|
||||
|
||||
var BaseRenderer = require('diagram-js/lib/draw/BaseRenderer'),
|
||||
TextUtil = require('diagram-js/lib/util/Text'),
|
||||
DiUtil = require('../util/DiUtil');
|
||||
import {
|
||||
isObject,
|
||||
assign,
|
||||
forEach
|
||||
} from 'min-dash';
|
||||
|
||||
var is = require('../util/ModelUtil').is;
|
||||
import BaseRenderer from 'diagram-js/lib/draw/BaseRenderer';
|
||||
import TextUtil from 'diagram-js/lib/util/Text';
|
||||
|
||||
var createLine = require('diagram-js/lib/util/RenderUtil').createLine;
|
||||
import {
|
||||
isExpanded,
|
||||
isEventSubProcess
|
||||
} from '../util/DiUtil';
|
||||
|
||||
var BpmnRenderUtil = require('./BpmnRenderUtil');
|
||||
import { is } from '../util/ModelUtil';
|
||||
|
||||
var isTypedEvent = BpmnRenderUtil.isTypedEvent,
|
||||
isThrowEvent = BpmnRenderUtil.isThrowEvent,
|
||||
isCollection = BpmnRenderUtil.isCollection,
|
||||
getDi = BpmnRenderUtil.getDi,
|
||||
getSemantic = BpmnRenderUtil.getSemantic;
|
||||
import {
|
||||
createLine
|
||||
} from 'diagram-js/lib/util/RenderUtil';
|
||||
|
||||
var getCirclePath = BpmnRenderUtil.getCirclePath,
|
||||
getRoundRectPath = BpmnRenderUtil.getRoundRectPath,
|
||||
getDiamondPath = BpmnRenderUtil.getDiamondPath,
|
||||
getRectPath = BpmnRenderUtil.getRectPath,
|
||||
getFillColor = BpmnRenderUtil.getFillColor,
|
||||
getStrokeColor = BpmnRenderUtil.getStrokeColor;
|
||||
import {
|
||||
isTypedEvent,
|
||||
isThrowEvent,
|
||||
isCollection,
|
||||
getDi,
|
||||
getSemantic,
|
||||
getCirclePath,
|
||||
getRoundRectPath,
|
||||
getDiamondPath,
|
||||
getRectPath,
|
||||
getFillColor,
|
||||
getStrokeColor
|
||||
} from './BpmnRenderUtil';
|
||||
|
||||
var domQuery = require('min-dom').query;
|
||||
import {
|
||||
query as domQuery
|
||||
} from 'min-dom';
|
||||
|
||||
var svgAppend = require('tiny-svg').append,
|
||||
svgAttr = require('tiny-svg').attr,
|
||||
svgCreate = require('tiny-svg').create,
|
||||
svgClasses = require('tiny-svg').classes;
|
||||
import {
|
||||
append as svgAppend,
|
||||
attr as svgAttr,
|
||||
create as svgCreate,
|
||||
classes as svgClasses
|
||||
} from 'tiny-svg';
|
||||
|
||||
var rotate = require('diagram-js/lib/util/SvgTransformUtil').rotate,
|
||||
transform = require('diagram-js/lib/util/SvgTransformUtil').transform,
|
||||
translate = require('diagram-js/lib/util/SvgTransformUtil').translate;
|
||||
import {
|
||||
rotate,
|
||||
transform,
|
||||
translate
|
||||
} from 'diagram-js/lib/util/SvgTransformUtil';
|
||||
|
||||
var Ids = require('ids'),
|
||||
RENDERER_IDS = new Ids();
|
||||
import Ids from 'ids';
|
||||
|
||||
var RENDERER_IDS = new Ids();
|
||||
|
||||
var TASK_BORDER_RADIUS = 10;
|
||||
var INNER_OUTER_DIST = 3;
|
||||
@ -54,7 +69,9 @@ var DEFAULT_FILL_OPACITY = .95,
|
||||
HIGH_FILL_OPACITY = .35;
|
||||
|
||||
|
||||
function BpmnRenderer(eventBus, styles, pathMap, canvas, priority) {
|
||||
export default function BpmnRenderer(
|
||||
eventBus, styles, pathMap,
|
||||
canvas, priority) {
|
||||
|
||||
BaseRenderer.call(this, eventBus, priority);
|
||||
|
||||
@ -1056,11 +1073,9 @@ function BpmnRenderer(eventBus, styles, pathMap, canvas, priority) {
|
||||
|
||||
var rect = renderer('bpmn:Activity')(parentGfx, element, attrs);
|
||||
|
||||
var expanded = DiUtil.isExpanded(element);
|
||||
var expanded = isExpanded(element);
|
||||
|
||||
var isEventSubProcess = DiUtil.isEventSubProcess(element);
|
||||
|
||||
if (isEventSubProcess) {
|
||||
if (isEventSubProcess(element)) {
|
||||
svgAttr(rect, {
|
||||
strokeDasharray: '1,2'
|
||||
});
|
||||
@ -1105,7 +1120,7 @@ function BpmnRenderer(eventBus, styles, pathMap, canvas, priority) {
|
||||
|
||||
var lane = renderer('bpmn:Lane')(parentGfx, element, attrs);
|
||||
|
||||
var expandedPool = DiUtil.isExpanded(element);
|
||||
var expandedPool = isExpanded(element);
|
||||
|
||||
if (expandedPool) {
|
||||
drawLine(parentGfx, [
|
||||
@ -1778,9 +1793,12 @@ function BpmnRenderer(eventBus, styles, pathMap, canvas, priority) {
|
||||
|
||||
inherits(BpmnRenderer, BaseRenderer);
|
||||
|
||||
BpmnRenderer.$inject = [ 'eventBus', 'styles', 'pathMap', 'canvas' ];
|
||||
|
||||
module.exports = BpmnRenderer;
|
||||
BpmnRenderer.$inject = [
|
||||
'eventBus',
|
||||
'styles',
|
||||
'pathMap',
|
||||
'canvas'
|
||||
];
|
||||
|
||||
|
||||
BpmnRenderer.prototype.canRender = function(element) {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Map containing SVG paths needed by BpmnRenderer.
|
||||
*/
|
||||
|
||||
function PathMap() {
|
||||
export default function PathMap() {
|
||||
|
||||
/**
|
||||
* Contains a map of path elements
|
||||
@ -447,8 +447,6 @@ function PathMap() {
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = PathMap;
|
||||
|
||||
// helpers //////////////////////
|
||||
|
||||
// copied from https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js
|
||||
|
@ -1,5 +1,8 @@
|
||||
module.exports = {
|
||||
import BpmnRenderer from './BpmnRenderer';
|
||||
import PathMap from './PathMap';
|
||||
|
||||
export default {
|
||||
__init__: [ 'bpmnRenderer' ],
|
||||
bpmnRenderer: [ 'type', require('./BpmnRenderer') ],
|
||||
pathMap: [ 'type', require('./PathMap') ]
|
||||
bpmnRenderer: [ 'type', BpmnRenderer ],
|
||||
pathMap: [ 'type', PathMap ]
|
||||
};
|
||||
|
@ -1,12 +1,15 @@
|
||||
'use strict';
|
||||
|
||||
var is = require('../../util/ModelUtil').is;
|
||||
var isAny = require('../modeling/util/ModelingUtil').isAny;
|
||||
import { is } from '../../util/ModelUtil';
|
||||
import { isAny } from '../modeling/util/ModelingUtil';
|
||||
|
||||
import {
|
||||
getTextAnnotationPosition,
|
||||
getDataElementPosition,
|
||||
getFlowNodePosition,
|
||||
getDefaultPosition
|
||||
} from './AutoPlaceUtil';
|
||||
|
||||
var getTextAnnotationPosition = require('./AutoPlaceUtil').getTextAnnotationPosition,
|
||||
getDataElementPosition = require('./AutoPlaceUtil').getDataElementPosition,
|
||||
getFlowNodePosition = require('./AutoPlaceUtil').getFlowNodePosition,
|
||||
getDefaultPosition = require('./AutoPlaceUtil').getDefaultPosition;
|
||||
|
||||
/**
|
||||
* A service that places elements connected to existing ones
|
||||
@ -15,7 +18,7 @@ var getTextAnnotationPosition = require('./AutoPlaceUtil').getTextAnnotationPosi
|
||||
* @param {EventBus} eventBus
|
||||
* @param {Modeling} modeling
|
||||
*/
|
||||
function AutoPlace(eventBus, modeling) {
|
||||
export default function AutoPlace(eventBus, modeling) {
|
||||
|
||||
function emit(event, payload) {
|
||||
return eventBus.fire(event, payload);
|
||||
@ -59,8 +62,6 @@ AutoPlace.$inject = [
|
||||
'modeling'
|
||||
];
|
||||
|
||||
module.exports = AutoPlace;
|
||||
|
||||
|
||||
// helpers //////////////////////
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
* @param {EventBus} eventBus
|
||||
* @param {Selection} selection
|
||||
*/
|
||||
function AutoPlaceSelectionBehavior(eventBus, selection) {
|
||||
export default function AutoPlaceSelectionBehavior(eventBus, selection) {
|
||||
|
||||
eventBus.on('autoPlace.end', 500, function(e) {
|
||||
selection.select(e.shape);
|
||||
@ -18,5 +18,3 @@ AutoPlaceSelectionBehavior.$inject = [
|
||||
'eventBus',
|
||||
'selection'
|
||||
];
|
||||
|
||||
module.exports = AutoPlaceSelectionBehavior;
|
||||
|
@ -1,13 +1,17 @@
|
||||
'use strict';
|
||||
|
||||
var is = require('../../util/ModelUtil').is;
|
||||
import { is } from '../../util/ModelUtil';
|
||||
|
||||
var getMid = require('diagram-js/lib/layout/LayoutUtil').getMid,
|
||||
asTRBL = require('diagram-js/lib/layout/LayoutUtil').asTRBL,
|
||||
getOrientation = require('diagram-js/lib/layout/LayoutUtil').getOrientation;
|
||||
import {
|
||||
getMid,
|
||||
asTRBL,
|
||||
getOrientation
|
||||
} from 'diagram-js/lib/layout/LayoutUtil';
|
||||
|
||||
var find = require('min-dash').find,
|
||||
reduce = require('min-dash').reduce;
|
||||
import {
|
||||
find,
|
||||
reduce
|
||||
} from 'min-dash';
|
||||
|
||||
var DEFAULT_HORIZONTAL_DISTANCE = 50;
|
||||
|
||||
@ -21,7 +25,7 @@ var PLACEMENT_DETECTION_PAD = 10;
|
||||
* Always try to place element right of source;
|
||||
* compute actual distance from previous nodes in flow.
|
||||
*/
|
||||
function getFlowNodePosition(source, element) {
|
||||
export function getFlowNodePosition(source, element) {
|
||||
|
||||
var sourceTrbl = asTRBL(source);
|
||||
var sourceMid = getMid(source);
|
||||
@ -62,8 +66,6 @@ function getFlowNodePosition(source, element) {
|
||||
return deconflictPosition(source, element, position, escapeDirection);
|
||||
}
|
||||
|
||||
module.exports.getFlowNodePosition = getFlowNodePosition;
|
||||
|
||||
|
||||
/**
|
||||
* Compute best distance between source and target,
|
||||
@ -74,7 +76,7 @@ module.exports.getFlowNodePosition = getFlowNodePosition;
|
||||
*
|
||||
* @return {Number} distance
|
||||
*/
|
||||
function getFlowNodeDistance(source, element) {
|
||||
export function getFlowNodeDistance(source, element) {
|
||||
|
||||
var sourceTrbl = asTRBL(source);
|
||||
|
||||
@ -174,13 +176,11 @@ function getFlowNodeDistance(source, element) {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.getFlowNodeDistance = getFlowNodeDistance;
|
||||
|
||||
|
||||
/**
|
||||
* Always try to place text annotations top right of source.
|
||||
*/
|
||||
function getTextAnnotationPosition(source, element) {
|
||||
export function getTextAnnotationPosition(source, element) {
|
||||
|
||||
var sourceTrbl = asTRBL(source);
|
||||
|
||||
@ -199,13 +199,11 @@ function getTextAnnotationPosition(source, element) {
|
||||
return deconflictPosition(source, element, position, escapeDirection);
|
||||
}
|
||||
|
||||
module.exports.getTextAnnotationPosition = getTextAnnotationPosition;
|
||||
|
||||
|
||||
/**
|
||||
* Always put element bottom right of source.
|
||||
*/
|
||||
function getDataElementPosition(source, element) {
|
||||
export function getDataElementPosition(source, element) {
|
||||
|
||||
var sourceTrbl = asTRBL(source);
|
||||
|
||||
@ -224,13 +222,11 @@ function getDataElementPosition(source, element) {
|
||||
return deconflictPosition(source, element, position, escapeDirection);
|
||||
}
|
||||
|
||||
module.exports.getDataElementPosition = getDataElementPosition;
|
||||
|
||||
|
||||
/**
|
||||
* Always put element right of source per default.
|
||||
*/
|
||||
function getDefaultPosition(source, element) {
|
||||
export function getDefaultPosition(source, element) {
|
||||
|
||||
var sourceTrbl = asTRBL(source);
|
||||
|
||||
@ -243,8 +239,6 @@ function getDefaultPosition(source, element) {
|
||||
};
|
||||
}
|
||||
|
||||
module.exports.getDefaultPosition = getDefaultPosition;
|
||||
|
||||
|
||||
/**
|
||||
* Returns all connected elements around the given source.
|
||||
@ -283,7 +277,7 @@ function getAutoPlaceClosure(source, element) {
|
||||
* This takes connected elements from host and attachers
|
||||
* into account, too.
|
||||
*/
|
||||
function getConnectedAtPosition(source, position, element) {
|
||||
export function getConnectedAtPosition(source, position, element) {
|
||||
|
||||
var bounds = {
|
||||
x: position.x - (element.width / 2),
|
||||
@ -306,8 +300,6 @@ function getConnectedAtPosition(source, position, element) {
|
||||
});
|
||||
}
|
||||
|
||||
module.exports.getConnectedAtPosition = getConnectedAtPosition;
|
||||
|
||||
|
||||
/**
|
||||
* Returns a new, position for the given element
|
||||
@ -324,7 +316,7 @@ module.exports.getConnectedAtPosition = getConnectedAtPosition;
|
||||
*
|
||||
* @return {Point}
|
||||
*/
|
||||
function deconflictPosition(source, element, position, escapeDelta) {
|
||||
export function deconflictPosition(source, element, position, escapeDelta) {
|
||||
|
||||
function nextPosition(existingElement) {
|
||||
|
||||
@ -372,9 +364,6 @@ function deconflictPosition(source, element, position, escapeDelta) {
|
||||
return position;
|
||||
}
|
||||
|
||||
module.exports.deconflictPosition = deconflictPosition;
|
||||
|
||||
|
||||
|
||||
|
||||
// helpers //////////////////////
|
||||
|
@ -1,5 +1,8 @@
|
||||
module.exports = {
|
||||
import AutoPlace from './AutoPlace';
|
||||
import AutoPlaceSelectionBehavior from './AutoPlaceSelectionBehavior';
|
||||
|
||||
export default {
|
||||
__init__: [ 'autoPlaceSelectionBehavior' ],
|
||||
autoPlace: [ 'type', require('./AutoPlace') ],
|
||||
autoPlaceSelectionBehavior: [ 'type', require('./AutoPlaceSelectionBehavior') ]
|
||||
autoPlace: [ 'type', AutoPlace ],
|
||||
autoPlaceSelectionBehavior: [ 'type', AutoPlaceSelectionBehavior ]
|
||||
};
|
@ -1,23 +1,25 @@
|
||||
var AutoResize = require('diagram-js/lib/features/auto-resize/AutoResize');
|
||||
import AutoResize from 'diagram-js/lib/features/auto-resize/AutoResize';
|
||||
|
||||
var inherits = require('inherits');
|
||||
import inherits from 'inherits';
|
||||
|
||||
import { is } from '../../util/ModelUtil';
|
||||
|
||||
var is = require('../../util/ModelUtil').is;
|
||||
|
||||
/**
|
||||
* Sub class of the AutoResize module which implements a BPMN
|
||||
* specific resize function.
|
||||
*/
|
||||
function BpmnAutoResize(eventBus, elementRegistry, modeling, rules) {
|
||||
AutoResize.call(this, eventBus, elementRegistry, modeling, rules);
|
||||
export default function BpmnAutoResize(injector) {
|
||||
|
||||
injector.invoke(AutoResize, this);
|
||||
}
|
||||
|
||||
BpmnAutoResize.$inject = [ 'eventBus', 'elementRegistry', 'modeling', 'rules' ];
|
||||
BpmnAutoResize.$inject = [
|
||||
'injector'
|
||||
];
|
||||
|
||||
inherits(BpmnAutoResize, AutoResize);
|
||||
|
||||
module.exports = BpmnAutoResize;
|
||||
|
||||
|
||||
/**
|
||||
* Resize shapes and lanes
|
||||
|
@ -1,17 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
var is = require('../../util/ModelUtil').is;
|
||||
import { is } from '../../util/ModelUtil';
|
||||
|
||||
var inherits = require('inherits');
|
||||
import inherits from 'inherits';
|
||||
|
||||
var forEach = require('min-dash').forEach;
|
||||
import { forEach } from 'min-dash';
|
||||
|
||||
import AutoResizeProvider from 'diagram-js/lib/features/auto-resize/AutoResizeProvider';
|
||||
|
||||
var AutoResizeProvider = require('diagram-js/lib/features/auto-resize/AutoResizeProvider');
|
||||
|
||||
/**
|
||||
* This module is a provider for automatically resizing parent BPMN elements
|
||||
*/
|
||||
function BpmnAutoResizeProvider(eventBus, modeling) {
|
||||
export default function BpmnAutoResizeProvider(eventBus, modeling) {
|
||||
AutoResizeProvider.call(this, eventBus);
|
||||
|
||||
this._modeling = modeling;
|
||||
@ -19,9 +20,10 @@ function BpmnAutoResizeProvider(eventBus, modeling) {
|
||||
|
||||
inherits(BpmnAutoResizeProvider, AutoResizeProvider);
|
||||
|
||||
BpmnAutoResizeProvider.$inject = [ 'eventBus', 'modeling' ];
|
||||
|
||||
module.exports = BpmnAutoResizeProvider;
|
||||
BpmnAutoResizeProvider.$inject = [
|
||||
'eventBus',
|
||||
'modeling'
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
|
@ -1,5 +1,12 @@
|
||||
module.exports = {
|
||||
__init__: [ 'bpmnAutoResize', 'bpmnAutoResizeProvider' ],
|
||||
bpmnAutoResize: [ 'type', require('./BpmnAutoResize') ],
|
||||
bpmnAutoResizeProvider: [ 'type', require('./BpmnAutoResizeProvider') ]
|
||||
import BpmnAutoResize from './BpmnAutoResize';
|
||||
import BpmnAutoResizeProvider from './BpmnAutoResizeProvider';
|
||||
|
||||
|
||||
export default {
|
||||
__init__: [
|
||||
'bpmnAutoResize',
|
||||
'bpmnAutoResizeProvider'
|
||||
],
|
||||
bpmnAutoResize: [ 'type', BpmnAutoResize ],
|
||||
bpmnAutoResizeProvider: [ 'type', BpmnAutoResizeProvider ]
|
||||
};
|
||||
|
@ -1,22 +1,40 @@
|
||||
'use strict';
|
||||
|
||||
import {
|
||||
assign,
|
||||
forEach,
|
||||
isArray
|
||||
} from 'min-dash';
|
||||
|
||||
import {
|
||||
is
|
||||
} from '../../util/ModelUtil';
|
||||
|
||||
import {
|
||||
isExpanded,
|
||||
isEventSubProcess
|
||||
} from '../../util/DiUtil';
|
||||
|
||||
import {
|
||||
isAny
|
||||
} from '../modeling/util/ModelingUtil';
|
||||
|
||||
import {
|
||||
getChildLanes
|
||||
} from '../modeling/util/LaneUtil';
|
||||
|
||||
import {
|
||||
hasPrimaryModifier
|
||||
} from 'diagram-js/lib/util/Mouse';
|
||||
|
||||
var assign = require('min-dash').assign,
|
||||
forEach = require('min-dash').forEach,
|
||||
isArray = require('min-dash').isArray,
|
||||
is = require('../../util/ModelUtil').is,
|
||||
isExpanded = require('../../util/DiUtil').isExpanded,
|
||||
isAny = require('../modeling/util/ModelingUtil').isAny,
|
||||
getChildLanes = require('../modeling/util/LaneUtil').getChildLanes,
|
||||
isEventSubProcess = require('../../util/DiUtil').isEventSubProcess,
|
||||
hasPrimaryModifier = require('diagram-js/lib/util/Mouse').hasPrimaryModifier;
|
||||
|
||||
/**
|
||||
* A provider for BPMN 2.0 elements context pad
|
||||
*/
|
||||
function ContextPadProvider(
|
||||
config, injector, eventBus, contextPad, modeling,
|
||||
elementFactory, connect, create, popupMenu,
|
||||
export default function ContextPadProvider(
|
||||
config, injector, eventBus,
|
||||
contextPad, modeling, elementFactory,
|
||||
connect, create, popupMenu,
|
||||
canvas, rules, translate) {
|
||||
|
||||
config = config || {};
|
||||
@ -69,8 +87,6 @@ ContextPadProvider.$inject = [
|
||||
'translate'
|
||||
];
|
||||
|
||||
module.exports = ContextPadProvider;
|
||||
|
||||
|
||||
ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
||||
|
||||
|
@ -1,12 +1,21 @@
|
||||
module.exports = {
|
||||
import DirectEditingModule from 'diagram-js-direct-editing';
|
||||
import ContextPadModule from 'diagram-js/lib/features/context-pad';
|
||||
import SelectionModule from 'diagram-js/lib/features/selection';
|
||||
import ConnectModule from 'diagram-js/lib/features/connect';
|
||||
import CreateModule from 'diagram-js/lib/features/create';
|
||||
import PopupMenuModule from '../popup-menu';
|
||||
|
||||
import ContextPadProvider from './ContextPadProvider';
|
||||
|
||||
export default {
|
||||
__depends__: [
|
||||
require('diagram-js-direct-editing'),
|
||||
require('diagram-js/lib/features/context-pad'),
|
||||
require('diagram-js/lib/features/selection'),
|
||||
require('diagram-js/lib/features/connect'),
|
||||
require('diagram-js/lib/features/create'),
|
||||
require('../popup-menu')
|
||||
DirectEditingModule,
|
||||
ContextPadModule,
|
||||
SelectionModule,
|
||||
ConnectModule,
|
||||
CreateModule,
|
||||
PopupMenuModule
|
||||
],
|
||||
__init__: [ 'contextPadProvider' ],
|
||||
contextPadProvider: [ 'type', require('./ContextPadProvider') ]
|
||||
contextPadProvider: [ 'type', ContextPadProvider ]
|
||||
};
|
@ -1,18 +1,21 @@
|
||||
'use strict';
|
||||
|
||||
var ModelUtil = require('../../util/ModelUtil'),
|
||||
getBusinessObject = ModelUtil.getBusinessObject,
|
||||
is = ModelUtil.is;
|
||||
import {
|
||||
getBusinessObject,
|
||||
is
|
||||
} from '../../util/ModelUtil';
|
||||
|
||||
var ModelCloneHelper = require('../../util/model/ModelCloneHelper');
|
||||
import ModelCloneHelper from '../../util/model/ModelCloneHelper';
|
||||
|
||||
var ModelCloneUtils = require('../../util/model/ModelCloneUtils'),
|
||||
getProperties = ModelCloneUtils.getProperties;
|
||||
import {
|
||||
getProperties,
|
||||
IGNORED_PROPERTIES
|
||||
} from '../../util/model/ModelCloneUtils';
|
||||
|
||||
var IGNORED_PROPERTIES = ModelCloneUtils.IGNORED_PROPERTIES;
|
||||
|
||||
var filter = require('min-dash').filter,
|
||||
forEach = require('min-dash').forEach;
|
||||
import {
|
||||
filter,
|
||||
forEach
|
||||
} from 'min-dash';
|
||||
|
||||
function setProperties(descriptor, data, properties) {
|
||||
forEach(properties, function(property) {
|
||||
@ -30,7 +33,7 @@ function removeProperties(element, properties) {
|
||||
});
|
||||
}
|
||||
|
||||
function BpmnCopyPaste(
|
||||
export default function BpmnCopyPaste(
|
||||
bpmnFactory, eventBus, copyPaste,
|
||||
clipboard, canvas, bpmnRules) {
|
||||
|
||||
@ -152,5 +155,3 @@ BpmnCopyPaste.$inject = [
|
||||
'canvas',
|
||||
'bpmnRules'
|
||||
];
|
||||
|
||||
module.exports = BpmnCopyPaste;
|
||||
|
@ -1,7 +1,11 @@
|
||||
module.exports = {
|
||||
import CopyPasteModule from 'diagram-js/lib/features/copy-paste';
|
||||
|
||||
import BpmnCopyPaste from './BpmnCopyPaste';
|
||||
|
||||
export default {
|
||||
__depends__: [
|
||||
require('diagram-js/lib/features/copy-paste')
|
||||
CopyPasteModule
|
||||
],
|
||||
__init__: [ 'bpmnCopyPaste' ],
|
||||
bpmnCopyPaste: [ 'type', require('./BpmnCopyPaste') ]
|
||||
bpmnCopyPaste: [ 'type', BpmnCopyPaste ]
|
||||
};
|
||||
|
@ -1,14 +1,19 @@
|
||||
'use strict';
|
||||
|
||||
var filter = require('min-dash').filter;
|
||||
import {
|
||||
filter
|
||||
} from 'min-dash';
|
||||
|
||||
import {
|
||||
isAny
|
||||
} from '../modeling/util/ModelingUtil';
|
||||
|
||||
var isAny = require('../modeling/util/ModelingUtil').isAny;
|
||||
|
||||
/**
|
||||
* Registers element exclude filters for elements that
|
||||
* currently do not support distribution.
|
||||
*/
|
||||
function BpmnDistributeElements(distributeElements) {
|
||||
export default function BpmnDistributeElements(distributeElements) {
|
||||
|
||||
distributeElements.registerFilter(function(elements) {
|
||||
return filter(elements, function(element) {
|
||||
@ -30,5 +35,3 @@ function BpmnDistributeElements(distributeElements) {
|
||||
}
|
||||
|
||||
BpmnDistributeElements.$inject = [ 'distributeElements' ];
|
||||
|
||||
module.exports = BpmnDistributeElements;
|
||||
|
@ -1,7 +1,12 @@
|
||||
module.exports = {
|
||||
import DistributeElementsModule from 'diagram-js/lib/features/distribute-elements';
|
||||
|
||||
import BpmnDistributeElements from './BpmnDistributeElements';
|
||||
|
||||
|
||||
export default {
|
||||
__depends__: [
|
||||
require('diagram-js/lib/features/distribute-elements')
|
||||
DistributeElementsModule
|
||||
],
|
||||
__init__: [ 'bpmnDistributeElements' ],
|
||||
bpmnDistributeElements: [ 'type', require('./BpmnDistributeElements') ]
|
||||
bpmnDistributeElements: [ 'type', BpmnDistributeElements ]
|
||||
};
|
||||
|
@ -1,21 +1,27 @@
|
||||
'use strict';
|
||||
|
||||
var inherits = require('inherits');
|
||||
import inherits from 'inherits';
|
||||
|
||||
var EditorActions = require('diagram-js/lib/features/editor-actions/EditorActions');
|
||||
import EditorActions from 'diagram-js/lib/features/editor-actions/EditorActions';
|
||||
|
||||
var filter = require('min-dash').filter;
|
||||
import { filter } from 'min-dash';
|
||||
|
||||
var is = require('../../util/ModelUtil').is;
|
||||
import { is } from '../../util/ModelUtil';
|
||||
|
||||
var getBBox = require('diagram-js/lib/util/Elements').getBBox;
|
||||
import {
|
||||
getBBox
|
||||
} from 'diagram-js/lib/util/Elements';
|
||||
|
||||
|
||||
function BpmnEditorActions(
|
||||
/**
|
||||
* Registers and executes BPMN specific editor actions.
|
||||
*/
|
||||
export default function BpmnEditorActions(
|
||||
injector, canvas, elementRegistry,
|
||||
selection, spaceTool, lassoTool, handTool,
|
||||
globalConnect, distributeElements, alignElements,
|
||||
directEditing, searchPad, modeling) {
|
||||
selection, spaceTool, lassoTool,
|
||||
handTool, globalConnect, distributeElements,
|
||||
alignElements, directEditing, searchPad,
|
||||
modeling) {
|
||||
|
||||
injector.invoke(EditorActions, this);
|
||||
|
||||
@ -122,5 +128,3 @@ BpmnEditorActions.$inject = [
|
||||
'searchPad',
|
||||
'modeling'
|
||||
];
|
||||
|
||||
module.exports = BpmnEditorActions;
|
||||
|
@ -1,15 +1,28 @@
|
||||
module.exports = {
|
||||
import AlignElementsModule from 'diagram-js/lib/features/align-elements';
|
||||
import EditorActionsModule from 'diagram-js/lib/features/editor-actions';
|
||||
import HandToolModule from 'diagram-js/lib/features/hand-tool';
|
||||
import LassoToolModule from 'diagram-js/lib/features/lasso-tool';
|
||||
import SpaceToolModule from 'diagram-js/lib/features/space-tool';
|
||||
import DirectEditingModule from 'diagram-js-direct-editing';
|
||||
import GlobalConnectModule from '../global-connect';
|
||||
import CopyPasteModule from '../copy-paste';
|
||||
import DistributeElementsModule from '../distribute-elements';
|
||||
import SearchModule from '../search';
|
||||
|
||||
import BpmnEditorActions from './BpmnEditorActions';
|
||||
|
||||
export default {
|
||||
__depends__: [
|
||||
require('diagram-js/lib/features/align-elements'),
|
||||
require('diagram-js/lib/features/editor-actions'),
|
||||
require('diagram-js/lib/features/hand-tool'),
|
||||
require('diagram-js/lib/features/lasso-tool'),
|
||||
require('diagram-js/lib/features/space-tool'),
|
||||
require('diagram-js-direct-editing'),
|
||||
require('../global-connect'),
|
||||
require('../copy-paste'),
|
||||
require('../distribute-elements'),
|
||||
require('../search')
|
||||
AlignElementsModule,
|
||||
EditorActionsModule,
|
||||
HandToolModule,
|
||||
LassoToolModule,
|
||||
SpaceToolModule,
|
||||
DirectEditingModule,
|
||||
GlobalConnectModule,
|
||||
CopyPasteModule,
|
||||
DistributeElementsModule,
|
||||
SearchModule
|
||||
],
|
||||
editorActions: [ 'type', require('./BpmnEditorActions') ]
|
||||
editorActions: [ 'type', BpmnEditorActions ]
|
||||
};
|
||||
|
@ -1,19 +1,20 @@
|
||||
'use strict';
|
||||
|
||||
var isAny = require('../modeling/util/ModelingUtil').isAny;
|
||||
import {
|
||||
isAny
|
||||
} from '../modeling/util/ModelingUtil';
|
||||
|
||||
|
||||
/**
|
||||
* Extention of GlobalConnect tool that implements BPMN specific rules about
|
||||
* connection start elements.
|
||||
*/
|
||||
function BpmnGlobalConnect(globalConnect) {
|
||||
export default function BpmnGlobalConnect(globalConnect) {
|
||||
globalConnect.registerProvider(this);
|
||||
}
|
||||
|
||||
BpmnGlobalConnect.$inject = [ 'globalConnect' ];
|
||||
|
||||
module.exports = BpmnGlobalConnect;
|
||||
|
||||
|
||||
/**
|
||||
* Checks if given element can be used for starting connection.
|
||||
|
@ -1,7 +1,11 @@
|
||||
module.exports = {
|
||||
import GlobalConnectModule from 'diagram-js/lib/features/global-connect';
|
||||
|
||||
import BpmnGlobalConnect from './BpmnGlobalConnect';
|
||||
|
||||
export default {
|
||||
__depends__: [
|
||||
require('diagram-js/lib/features/global-connect')
|
||||
GlobalConnectModule
|
||||
],
|
||||
__init__: [ 'bpmnGlobalConnect' ],
|
||||
bpmnGlobalConnect: [ 'type', require('./BpmnGlobalConnect') ]
|
||||
bpmnGlobalConnect: [ 'type', BpmnGlobalConnect ]
|
||||
};
|
||||
|
@ -6,7 +6,7 @@
|
||||
* @param {Keyboard} keyboard
|
||||
* @param {EditorActions} editorActions
|
||||
*/
|
||||
function BpmnKeyBindings(keyboard, editorActions) {
|
||||
export default function BpmnKeyBindings(keyboard, editorActions) {
|
||||
|
||||
keyboard.addListener(function(key, modifiers) {
|
||||
|
||||
@ -69,5 +69,3 @@ BpmnKeyBindings.$inject = [
|
||||
'keyboard',
|
||||
'editorActions'
|
||||
];
|
||||
|
||||
module.exports = BpmnKeyBindings;
|
@ -1,7 +1,11 @@
|
||||
module.exports = {
|
||||
import KeyboardModule from 'diagram-js/lib/features/keyboard';
|
||||
|
||||
import BpmnKeyBindings from './BpmnKeyBindings';
|
||||
|
||||
export default {
|
||||
__depends__: [
|
||||
require('diagram-js/lib/features/keyboard')
|
||||
KeyboardModule
|
||||
],
|
||||
__init__: [ 'bpmnKeyBindings' ],
|
||||
bpmnKeyBindings: [ 'type', require('./BpmnKeyBindings') ]
|
||||
bpmnKeyBindings: [ 'type', BpmnKeyBindings ]
|
||||
};
|
||||
|
@ -1,23 +1,27 @@
|
||||
var svgAppend = require('tiny-svg').append,
|
||||
svgAttr = require('tiny-svg').attr,
|
||||
svgCreate = require('tiny-svg').create,
|
||||
svgRemove = require('tiny-svg').remove;
|
||||
import {
|
||||
append as svgAppend,
|
||||
attr as svgAttr,
|
||||
create as svgCreate,
|
||||
remove as svgRemove
|
||||
} from 'tiny-svg';
|
||||
|
||||
var getBusinessObject = require('../../util/ModelUtil').getBusinessObject,
|
||||
is = require('../../util/ModelUtil').is;
|
||||
import {
|
||||
getBusinessObject,
|
||||
is
|
||||
} from '../../util/ModelUtil';
|
||||
|
||||
var translate = require('diagram-js/lib/util/SvgTransformUtil').translate;
|
||||
import {
|
||||
translate
|
||||
} from 'diagram-js/lib/util/SvgTransformUtil';
|
||||
|
||||
var MARKER_HIDDEN = 'djs-element-hidden',
|
||||
MARKER_LABEL_HIDDEN = 'djs-label-hidden';
|
||||
|
||||
function getStrokeColor(element, defaultColor) {
|
||||
var bo = getBusinessObject(element);
|
||||
|
||||
return bo.di.get('stroke') || defaultColor || 'black';
|
||||
}
|
||||
export default function LabelEditingPreview(
|
||||
eventBus, canvas, elementRegistry,
|
||||
pathMap) {
|
||||
|
||||
function LabelEditingPreview(eventBus, canvas, elementRegistry, pathMap) {
|
||||
var self = this;
|
||||
|
||||
var defaultLayer = canvas.getDefaultLayer();
|
||||
@ -117,6 +121,18 @@ function LabelEditingPreview(eventBus, canvas, elementRegistry, pathMap) {
|
||||
});
|
||||
}
|
||||
|
||||
LabelEditingPreview.$inject = [ 'eventBus', 'canvas', 'elementRegistry', 'pathMap' ];
|
||||
LabelEditingPreview.$inject = [
|
||||
'eventBus',
|
||||
'canvas',
|
||||
'elementRegistry',
|
||||
'pathMap'
|
||||
];
|
||||
|
||||
module.exports = LabelEditingPreview;
|
||||
|
||||
// helpers ///////////////////
|
||||
|
||||
function getStrokeColor(element, defaultColor) {
|
||||
var bo = getBusinessObject(element);
|
||||
|
||||
return bo.di.get('stroke') || defaultColor || 'black';
|
||||
}
|
@ -1,12 +1,16 @@
|
||||
'use strict';
|
||||
|
||||
var assign = require('min-dash').assign;
|
||||
import {
|
||||
assign
|
||||
} from 'min-dash';
|
||||
|
||||
var LabelUtil = require('./LabelUtil');
|
||||
import {
|
||||
getLabel
|
||||
} from './LabelUtil';
|
||||
|
||||
var is = require('../../util/ModelUtil').is,
|
||||
isAny = require('../modeling/util/ModelingUtil').isAny,
|
||||
isExpanded = require('../../util/DiUtil').isExpanded;
|
||||
import { is } from '../../util/ModelUtil';
|
||||
import { isAny } from '../modeling/util/ModelingUtil';
|
||||
import { isExpanded } from '../../util/DiUtil';
|
||||
|
||||
var SMALL_FONT_SIZE = 11,
|
||||
SMALL_LINE_HEIGHT = 13,
|
||||
@ -14,7 +18,7 @@ var SMALL_FONT_SIZE = 11,
|
||||
MEDIUM_LINE_HEIGHT = 14;
|
||||
|
||||
|
||||
function LabelEditingProvider(
|
||||
export default function LabelEditingProvider(
|
||||
eventBus, canvas, directEditing,
|
||||
modeling, resizeHandles) {
|
||||
|
||||
@ -97,8 +101,6 @@ LabelEditingProvider.$inject = [
|
||||
'resizeHandles'
|
||||
];
|
||||
|
||||
module.exports = LabelEditingProvider;
|
||||
|
||||
|
||||
/**
|
||||
* Activate direct editing for activities and text annotations.
|
||||
@ -110,7 +112,7 @@ module.exports = LabelEditingProvider;
|
||||
LabelEditingProvider.prototype.activate = function(element) {
|
||||
|
||||
// text
|
||||
var text = LabelUtil.getLabel(element);
|
||||
var text = getLabel(element);
|
||||
|
||||
if (text === undefined) {
|
||||
return;
|
||||
|
@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
var is = require('../../util/ModelUtil').is;
|
||||
import { is } from '../../util/ModelUtil';
|
||||
|
||||
function getLabelAttr(semantic) {
|
||||
if (is(semantic, 'bpmn:FlowElement') ||
|
||||
@ -17,17 +17,17 @@ function getLabelAttr(semantic) {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.getLabel = function(element) {
|
||||
export function getLabel(element) {
|
||||
var semantic = element.businessObject,
|
||||
attr = getLabelAttr(semantic);
|
||||
|
||||
if (attr) {
|
||||
return semantic[attr] || '';
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
module.exports.setLabel = function(element, text, isExternal) {
|
||||
export function setLabel(element, text, isExternal) {
|
||||
var semantic = element.businessObject,
|
||||
attr = getLabelAttr(semantic);
|
||||
|
||||
@ -41,4 +41,4 @@ module.exports.setLabel = function(element, text, isExternal) {
|
||||
}
|
||||
|
||||
return element;
|
||||
};
|
||||
}
|
@ -1,13 +1,20 @@
|
||||
'use strict';
|
||||
|
||||
var LabelUtil = require('../LabelUtil');
|
||||
import {
|
||||
setLabel,
|
||||
getLabel
|
||||
} from '../LabelUtil';
|
||||
|
||||
var TextUtil = require('diagram-js/lib/util/Text');
|
||||
import TextUtil from 'diagram-js/lib/util/Text';
|
||||
|
||||
var hasExternalLabel = require('../../../util/LabelUtil').hasExternalLabel;
|
||||
import {
|
||||
hasExternalLabel
|
||||
} from '../../../util/LabelUtil';
|
||||
|
||||
var getBusinessObject = require('../../../util/ModelUtil').getBusinessObject,
|
||||
is = require('../../../util/ModelUtil').is;
|
||||
import {
|
||||
getBusinessObject,
|
||||
is
|
||||
} from '../../../util/ModelUtil';
|
||||
|
||||
var NULL_DIMENSIONS = {
|
||||
width: 0,
|
||||
@ -18,7 +25,7 @@ var NULL_DIMENSIONS = {
|
||||
/**
|
||||
* A handler that updates the text of a BPMN element.
|
||||
*/
|
||||
function UpdateLabelHandler(modeling) {
|
||||
export default function UpdateLabelHandler(modeling) {
|
||||
|
||||
var textUtil = new TextUtil();
|
||||
|
||||
@ -37,13 +44,13 @@ function UpdateLabelHandler(modeling) {
|
||||
|
||||
var labelTarget = element.labelTarget || element;
|
||||
|
||||
LabelUtil.setLabel(label, text, labelTarget !== label);
|
||||
setLabel(label, text, labelTarget !== label);
|
||||
|
||||
return [ label, labelTarget ];
|
||||
}
|
||||
|
||||
function execute(ctx) {
|
||||
ctx.oldLabel = LabelUtil.getLabel(ctx.element);
|
||||
ctx.oldLabel = getLabel(ctx.element);
|
||||
return setText(ctx.element, ctx.newLabel);
|
||||
}
|
||||
|
||||
@ -91,8 +98,6 @@ function UpdateLabelHandler(modeling) {
|
||||
|
||||
UpdateLabelHandler.$inject = [ 'modeling' ];
|
||||
|
||||
module.exports = UpdateLabelHandler;
|
||||
|
||||
|
||||
// TODO(nikku): repeating code (search for <getLayoutedBounds>)
|
||||
|
||||
|
@ -1,13 +1,21 @@
|
||||
module.exports = {
|
||||
import ChangeSupportModule from 'diagram-js/lib/features/change-support';
|
||||
import ResizeModule from 'diagram-js/lib/features/resize';
|
||||
import DirectEditingModule from 'diagram-js-direct-editing';
|
||||
|
||||
import LabelEditingProvider from './LabelEditingProvider';
|
||||
import LabelEditingPreview from './LabelEditingPreview';
|
||||
|
||||
|
||||
export default {
|
||||
__depends__: [
|
||||
require('diagram-js/lib/features/change-support'),
|
||||
require('diagram-js/lib/features/resize'),
|
||||
require('diagram-js-direct-editing')
|
||||
ChangeSupportModule,
|
||||
ResizeModule,
|
||||
DirectEditingModule
|
||||
],
|
||||
__init__: [
|
||||
'labelEditingProvider',
|
||||
'labelEditingPreview'
|
||||
],
|
||||
labelEditingProvider: [ 'type', require('./LabelEditingProvider') ],
|
||||
labelEditingPreview: [ 'type', require('./LabelEditingPreview') ]
|
||||
labelEditingProvider: [ 'type', LabelEditingProvider ],
|
||||
labelEditingPreview: [ 'type', LabelEditingPreview ]
|
||||
};
|
||||
|
@ -1,11 +1,13 @@
|
||||
'use strict';
|
||||
|
||||
var map = require('min-dash').map,
|
||||
assign = require('min-dash').assign,
|
||||
pick = require('min-dash').pick;
|
||||
import {
|
||||
map,
|
||||
assign,
|
||||
pick
|
||||
} from 'min-dash';
|
||||
|
||||
|
||||
function BpmnFactory(moddle) {
|
||||
export default function BpmnFactory(moddle) {
|
||||
this._model = moddle;
|
||||
}
|
||||
|
||||
@ -95,5 +97,3 @@ BpmnFactory.prototype.createDiPlane = function(semantic) {
|
||||
bpmnElement: semantic
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = BpmnFactory;
|
||||
|
@ -1,30 +1,37 @@
|
||||
'use strict';
|
||||
|
||||
var inherits = require('inherits');
|
||||
import inherits from 'inherits';
|
||||
|
||||
var assign = require('min-dash').assign;
|
||||
import {
|
||||
assign
|
||||
} from 'min-dash';
|
||||
|
||||
var BaseLayouter = require('diagram-js/lib/layout/BaseLayouter'),
|
||||
ManhattanLayout = require('diagram-js/lib/layout/ManhattanLayout');
|
||||
import BaseLayouter from 'diagram-js/lib/layout/BaseLayouter';
|
||||
|
||||
var LayoutUtil = require('diagram-js/lib/layout/LayoutUtil');
|
||||
import {
|
||||
repairConnection
|
||||
} from 'diagram-js/lib/layout/ManhattanLayout';
|
||||
|
||||
var pointsOnLine = require('diagram-js/lib/util/Geometry').pointsOnLine;
|
||||
import {
|
||||
getMid,
|
||||
getOrientation
|
||||
} from 'diagram-js/lib/layout/LayoutUtil';
|
||||
|
||||
var isExpanded = require('../../util/DiUtil').isExpanded;
|
||||
import {
|
||||
pointsOnLine
|
||||
} from 'diagram-js/lib/util/Geometry';
|
||||
|
||||
var getMid = LayoutUtil.getMid,
|
||||
getOrientation = LayoutUtil.getOrientation;
|
||||
import {
|
||||
isExpanded
|
||||
} from '../../util/DiUtil';
|
||||
|
||||
var is = require('../../util/ModelUtil').is;
|
||||
import { is } from '../../util/ModelUtil';
|
||||
|
||||
|
||||
function BpmnLayouter() {}
|
||||
export default function BpmnLayouter() {}
|
||||
|
||||
inherits(BpmnLayouter, BaseLayouter);
|
||||
|
||||
module.exports = BpmnLayouter;
|
||||
|
||||
|
||||
BpmnLayouter.prototype.layoutConnection = function(connection, hints) {
|
||||
|
||||
@ -154,7 +161,7 @@ BpmnLayouter.prototype.layoutConnection = function(connection, hints) {
|
||||
manhattanOptions = assign(manhattanOptions, hints);
|
||||
|
||||
updatedWaypoints =
|
||||
ManhattanLayout.repairConnection(
|
||||
repairConnection(
|
||||
source, target,
|
||||
start, end,
|
||||
waypoints,
|
||||
|
@ -1,22 +1,35 @@
|
||||
'use strict';
|
||||
|
||||
var assign = require('min-dash').assign,
|
||||
forEach = require('min-dash').forEach,
|
||||
inherits = require('inherits');
|
||||
import {
|
||||
assign,
|
||||
forEach
|
||||
} from 'min-dash';
|
||||
|
||||
var Collections = require('diagram-js/lib/util/Collections'),
|
||||
Model = require('diagram-js/lib/model');
|
||||
import inherits from 'inherits';
|
||||
|
||||
var getBusinessObject = require('../../util/ModelUtil').getBusinessObject,
|
||||
is = require('../../util/ModelUtil').is;
|
||||
import {
|
||||
remove as collectionRemove,
|
||||
add as collectionAdd
|
||||
} from 'diagram-js/lib/util/Collections';
|
||||
|
||||
var CommandInterceptor = require('diagram-js/lib/command/CommandInterceptor');
|
||||
import {
|
||||
Label
|
||||
} from 'diagram-js/lib/model';
|
||||
|
||||
import {
|
||||
getBusinessObject,
|
||||
is
|
||||
} from '../../util/ModelUtil';
|
||||
|
||||
import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
|
||||
|
||||
/**
|
||||
* A handler responsible for updating the underlying BPMN 2.0 XML + DI
|
||||
* once changes on the diagram happen
|
||||
*/
|
||||
function BpmnUpdater(eventBus, bpmnFactory, connectionDocking, translate) {
|
||||
export default function BpmnUpdater(
|
||||
eventBus, bpmnFactory, connectionDocking,
|
||||
translate) {
|
||||
|
||||
CommandInterceptor.call(this, eventBus);
|
||||
|
||||
@ -285,9 +298,12 @@ function BpmnUpdater(eventBus, bpmnFactory, connectionDocking, translate) {
|
||||
|
||||
inherits(BpmnUpdater, CommandInterceptor);
|
||||
|
||||
module.exports = BpmnUpdater;
|
||||
|
||||
BpmnUpdater.$inject = [ 'eventBus', 'bpmnFactory', 'connectionDocking', 'translate' ];
|
||||
BpmnUpdater.$inject = [
|
||||
'eventBus',
|
||||
'bpmnFactory',
|
||||
'connectionDocking',
|
||||
'translate'
|
||||
];
|
||||
|
||||
|
||||
// implementation //////////////////////
|
||||
@ -303,7 +319,7 @@ BpmnUpdater.prototype.updateAttachment = function(context) {
|
||||
|
||||
BpmnUpdater.prototype.updateParent = function(element, oldParent) {
|
||||
// do not update BPMN 2.0 label parent
|
||||
if (element instanceof Model.Label) {
|
||||
if (element instanceof Label) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -347,7 +363,7 @@ BpmnUpdater.prototype.updateBounds = function(shape) {
|
||||
|
||||
var di = shape.businessObject.di;
|
||||
|
||||
var bounds = (shape instanceof Model.Label) ? this._getLabel(di).bounds : di.bounds;
|
||||
var bounds = (shape instanceof Label) ? this._getLabel(di).bounds : di.bounds;
|
||||
|
||||
assign(bounds, {
|
||||
x: shape.x,
|
||||
@ -367,12 +383,12 @@ BpmnUpdater.prototype.updateFlowNodeRefs = function(businessObject, newContainme
|
||||
|
||||
if (is (oldContainment, 'bpmn:Lane')) {
|
||||
oldRefs = oldContainment.get('flowNodeRef');
|
||||
Collections.remove(oldRefs, businessObject);
|
||||
collectionRemove(oldRefs, businessObject);
|
||||
}
|
||||
|
||||
if (is(newContainment, 'bpmn:Lane')) {
|
||||
newRefs = newContainment.get('flowNodeRef');
|
||||
Collections.add(newRefs, businessObject);
|
||||
collectionAdd(newRefs, businessObject);
|
||||
}
|
||||
};
|
||||
|
||||
@ -407,7 +423,7 @@ BpmnUpdater.prototype.updateDiParent = function(di, parentDi) {
|
||||
planeElements.push(di);
|
||||
di.$parent = parentDi;
|
||||
} else {
|
||||
Collections.remove(planeElements, di);
|
||||
collectionRemove(planeElements, di);
|
||||
di.$parent = null;
|
||||
}
|
||||
};
|
||||
@ -530,12 +546,12 @@ BpmnUpdater.prototype.updateSemanticParent = function(businessObject, newParent,
|
||||
definitions = getDefinitions(businessObject.$parent || newParent);
|
||||
|
||||
if (businessObject.$parent) {
|
||||
Collections.remove(definitions.get('rootElements'), process);
|
||||
collectionRemove(definitions.get('rootElements'), process);
|
||||
process.$parent = null;
|
||||
}
|
||||
|
||||
if (newParent) {
|
||||
Collections.add(definitions.get('rootElements'), process);
|
||||
collectionAdd(definitions.get('rootElements'), process);
|
||||
process.$parent = definitions;
|
||||
}
|
||||
}
|
||||
@ -564,7 +580,7 @@ BpmnUpdater.prototype.updateSemanticParent = function(businessObject, newParent,
|
||||
if (businessObject.$parent) {
|
||||
// remove from old parent
|
||||
children = businessObject.$parent.get(containment);
|
||||
Collections.remove(children, businessObject);
|
||||
collectionRemove(children, businessObject);
|
||||
}
|
||||
|
||||
if (!newParent) {
|
||||
@ -579,7 +595,7 @@ BpmnUpdater.prototype.updateSemanticParent = function(businessObject, newParent,
|
||||
if (visualParent) {
|
||||
var diChildren = visualParent.get(containment);
|
||||
|
||||
Collections.remove(children, businessObject);
|
||||
collectionRemove(children, businessObject);
|
||||
|
||||
if (newParent) {
|
||||
|
||||
@ -613,7 +629,7 @@ BpmnUpdater.prototype.updateConnection = function(context) {
|
||||
|
||||
if (businessObject.sourceRef !== newSource) {
|
||||
if (inverseSet) {
|
||||
Collections.remove(businessObject.sourceRef && businessObject.sourceRef.get('outgoing'), businessObject);
|
||||
collectionRemove(businessObject.sourceRef && businessObject.sourceRef.get('outgoing'), businessObject);
|
||||
|
||||
if (newSource && newSource.get('outgoing')) {
|
||||
newSource.get('outgoing').push(businessObject);
|
||||
@ -625,7 +641,7 @@ BpmnUpdater.prototype.updateConnection = function(context) {
|
||||
|
||||
if (businessObject.targetRef !== newTarget) {
|
||||
if (inverseSet) {
|
||||
Collections.remove(businessObject.targetRef && businessObject.targetRef.get('incoming'), businessObject);
|
||||
collectionRemove(businessObject.targetRef && businessObject.targetRef.get('incoming'), businessObject);
|
||||
|
||||
if (newTarget && newTarget.get('incoming')) {
|
||||
newTarget.get('incoming').push(businessObject);
|
||||
|
@ -1,20 +1,29 @@
|
||||
'use strict';
|
||||
|
||||
var assign = require('min-dash').assign,
|
||||
forEach = require('min-dash').forEach,
|
||||
inherits = require('inherits');
|
||||
import {
|
||||
assign,
|
||||
forEach
|
||||
} from 'min-dash';
|
||||
|
||||
var is = require('../../util/ModelUtil').is;
|
||||
import inherits from 'inherits';
|
||||
|
||||
var isExpanded = require('../../util/DiUtil').isExpanded;
|
||||
import { is } from '../../util/ModelUtil';
|
||||
|
||||
import {
|
||||
isExpanded
|
||||
} from '../../util/DiUtil';
|
||||
|
||||
import BaseElementFactory from 'diagram-js/lib/core/ElementFactory';
|
||||
|
||||
import {
|
||||
DEFAULT_LABEL_SIZE
|
||||
} from '../../util/LabelUtil';
|
||||
|
||||
var BaseElementFactory = require('diagram-js/lib/core/ElementFactory'),
|
||||
LabelUtil = require('../../util/LabelUtil');
|
||||
|
||||
/**
|
||||
* A bpmn-aware factory for diagram-js shapes
|
||||
*/
|
||||
function ElementFactory(bpmnFactory, moddle, translate) {
|
||||
export default function ElementFactory(bpmnFactory, moddle, translate) {
|
||||
BaseElementFactory.call(this);
|
||||
|
||||
this._bpmnFactory = bpmnFactory;
|
||||
@ -24,10 +33,11 @@ function ElementFactory(bpmnFactory, moddle, translate) {
|
||||
|
||||
inherits(ElementFactory, BaseElementFactory);
|
||||
|
||||
|
||||
ElementFactory.$inject = [ 'bpmnFactory', 'moddle', 'translate' ];
|
||||
|
||||
module.exports = ElementFactory;
|
||||
ElementFactory.$inject = [
|
||||
'bpmnFactory',
|
||||
'moddle',
|
||||
'translate'
|
||||
];
|
||||
|
||||
ElementFactory.prototype.baseCreate = BaseElementFactory.prototype.create;
|
||||
|
||||
@ -36,7 +46,7 @@ ElementFactory.prototype.create = function(elementType, attrs) {
|
||||
// we assume their businessObjects have already been created
|
||||
// and wired via attrs
|
||||
if (elementType === 'label') {
|
||||
return this.baseCreate(elementType, assign({ type: 'label' }, LabelUtil.DEFAULT_LABEL_SIZE, attrs));
|
||||
return this.baseCreate(elementType, assign({ type: 'label' }, DEFAULT_LABEL_SIZE, attrs));
|
||||
}
|
||||
|
||||
return this.createBpmnElement(elementType, attrs);
|
||||
|
@ -1,19 +1,19 @@
|
||||
'use strict';
|
||||
|
||||
var inherits = require('inherits');
|
||||
import inherits from 'inherits';
|
||||
|
||||
var BaseModeling = require('diagram-js/lib/features/modeling/Modeling');
|
||||
import BaseModeling from 'diagram-js/lib/features/modeling/Modeling';
|
||||
|
||||
var UpdatePropertiesHandler = require('./cmd/UpdatePropertiesHandler'),
|
||||
UpdateCanvasRootHandler = require('./cmd/UpdateCanvasRootHandler'),
|
||||
AddLaneHandler = require('./cmd/AddLaneHandler'),
|
||||
SplitLaneHandler = require('./cmd/SplitLaneHandler'),
|
||||
ResizeLaneHandler = require('./cmd/ResizeLaneHandler'),
|
||||
UpdateFlowNodeRefsHandler = require('./cmd/UpdateFlowNodeRefsHandler'),
|
||||
IdClaimHandler = require('./cmd/IdClaimHandler'),
|
||||
SetColorHandler = require('./cmd/SetColorHandler');
|
||||
import UpdatePropertiesHandler from './cmd/UpdatePropertiesHandler';
|
||||
import UpdateCanvasRootHandler from './cmd/UpdateCanvasRootHandler';
|
||||
import AddLaneHandler from './cmd/AddLaneHandler';
|
||||
import SplitLaneHandler from './cmd/SplitLaneHandler';
|
||||
import ResizeLaneHandler from './cmd/ResizeLaneHandler';
|
||||
import UpdateFlowNodeRefsHandler from './cmd/UpdateFlowNodeRefsHandler';
|
||||
import IdClaimHandler from './cmd/IdClaimHandler';
|
||||
import SetColorHandler from './cmd/SetColorHandler';
|
||||
|
||||
var UpdateLabelHandler = require('../label-editing/cmd/UpdateLabelHandler');
|
||||
import UpdateLabelHandler from '../label-editing/cmd/UpdateLabelHandler';
|
||||
|
||||
|
||||
/**
|
||||
@ -24,7 +24,10 @@ var UpdateLabelHandler = require('../label-editing/cmd/UpdateLabelHandler');
|
||||
* @param {CommandStack} commandStack
|
||||
* @param {BpmnRules} bpmnRules
|
||||
*/
|
||||
function Modeling(eventBus, elementFactory, commandStack, bpmnRules) {
|
||||
export default function Modeling(
|
||||
eventBus, elementFactory, commandStack,
|
||||
bpmnRules) {
|
||||
|
||||
BaseModeling.call(this, eventBus, elementFactory, commandStack);
|
||||
|
||||
this._bpmnRules = bpmnRules;
|
||||
@ -32,9 +35,12 @@ function Modeling(eventBus, elementFactory, commandStack, bpmnRules) {
|
||||
|
||||
inherits(Modeling, BaseModeling);
|
||||
|
||||
Modeling.$inject = [ 'eventBus', 'elementFactory', 'commandStack', 'bpmnRules' ];
|
||||
|
||||
module.exports = Modeling;
|
||||
Modeling.$inject = [
|
||||
'eventBus',
|
||||
'elementFactory',
|
||||
'commandStack',
|
||||
'bpmnRules'
|
||||
];
|
||||
|
||||
|
||||
Modeling.prototype.getHandlers = function() {
|
||||
|
@ -1,17 +1,22 @@
|
||||
'use strict';
|
||||
|
||||
var inherits = require('inherits');
|
||||
import inherits from 'inherits';
|
||||
|
||||
var getOrientation = require('diagram-js/lib/layout/LayoutUtil').getOrientation,
|
||||
getMid = require('diagram-js/lib/layout/LayoutUtil').getMid,
|
||||
asTRBL = require('diagram-js/lib/layout/LayoutUtil').asTRBL,
|
||||
substract = require('diagram-js/lib/util/Math').substract;
|
||||
import {
|
||||
getOrientation,
|
||||
getMid,
|
||||
asTRBL
|
||||
} from 'diagram-js/lib/layout/LayoutUtil';
|
||||
|
||||
var LabelUtil = require('../../../util/LabelUtil');
|
||||
import {
|
||||
substract
|
||||
} from 'diagram-js/lib/util/Math';
|
||||
|
||||
var hasExternalLabel = LabelUtil.hasExternalLabel;
|
||||
import {
|
||||
hasExternalLabel
|
||||
} from '../../../util/LabelUtil';
|
||||
|
||||
var CommandInterceptor = require('diagram-js/lib/command/CommandInterceptor');
|
||||
import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
|
||||
|
||||
|
||||
/**
|
||||
@ -22,7 +27,7 @@ var CommandInterceptor = require('diagram-js/lib/command/CommandInterceptor');
|
||||
* @param {EventBus} eventBus
|
||||
* @param {Modeling} modeling
|
||||
*/
|
||||
function AdaptiveLabelPositioningBehavior(eventBus, modeling) {
|
||||
export default function AdaptiveLabelPositioningBehavior(eventBus, modeling) {
|
||||
|
||||
CommandInterceptor.call(this, eventBus);
|
||||
|
||||
@ -119,7 +124,6 @@ function AdaptiveLabelPositioningBehavior(eventBus, modeling) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
inherits(AdaptiveLabelPositioningBehavior, CommandInterceptor);
|
||||
|
||||
AdaptiveLabelPositioningBehavior.$inject = [
|
||||
@ -127,7 +131,6 @@ AdaptiveLabelPositioningBehavior.$inject = [
|
||||
'modeling'
|
||||
];
|
||||
|
||||
module.exports = AdaptiveLabelPositioningBehavior;
|
||||
|
||||
/**
|
||||
* Return the optimal label position around an element
|
||||
|
@ -1,13 +1,13 @@
|
||||
'use strict';
|
||||
|
||||
var inherits = require('inherits');
|
||||
import inherits from 'inherits';
|
||||
|
||||
var is = require('../../../util/ModelUtil').is;
|
||||
import { is } from '../../../util/ModelUtil';
|
||||
|
||||
var CommandInterceptor = require('diagram-js/lib/command/CommandInterceptor');
|
||||
import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
|
||||
|
||||
|
||||
function AppendBehavior(eventBus, elementFactory, bpmnRules) {
|
||||
export default function AppendBehavior(eventBus, elementFactory, bpmnRules) {
|
||||
|
||||
CommandInterceptor.call(this, eventBus);
|
||||
|
||||
@ -35,9 +35,10 @@ function AppendBehavior(eventBus, elementFactory, bpmnRules) {
|
||||
}, true);
|
||||
}
|
||||
|
||||
|
||||
AppendBehavior.$inject = [ 'eventBus', 'elementFactory', 'bpmnRules' ];
|
||||
|
||||
inherits(AppendBehavior, CommandInterceptor);
|
||||
|
||||
module.exports = AppendBehavior;
|
||||
AppendBehavior.$inject = [
|
||||
'eventBus',
|
||||
'elementFactory',
|
||||
'bpmnRules'
|
||||
];
|
@ -1,15 +1,17 @@
|
||||
'use strict';
|
||||
|
||||
var inherits = require('inherits');
|
||||
import inherits from 'inherits';
|
||||
|
||||
var forEach = require('min-dash').forEach;
|
||||
import {
|
||||
forEach
|
||||
} from 'min-dash';
|
||||
|
||||
var is = require('../../../util/ModelUtil').is;
|
||||
import { is } from '../../../util/ModelUtil';
|
||||
|
||||
var CommandInterceptor = require('diagram-js/lib/command/CommandInterceptor');
|
||||
import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
|
||||
|
||||
|
||||
function CopyPasteBehavior(eventBus, modeling, canvas) {
|
||||
export default function CopyPasteBehavior(eventBus, modeling, canvas) {
|
||||
|
||||
CommandInterceptor.call(this, eventBus);
|
||||
|
||||
@ -62,8 +64,10 @@ function CopyPasteBehavior(eventBus, modeling, canvas) {
|
||||
}
|
||||
|
||||
|
||||
CopyPasteBehavior.$inject = [ 'eventBus', 'modeling', 'canvas' ];
|
||||
CopyPasteBehavior.$inject = [
|
||||
'eventBus',
|
||||
'modeling',
|
||||
'canvas'
|
||||
];
|
||||
|
||||
inherits(CopyPasteBehavior, CommandInterceptor);
|
||||
|
||||
module.exports = CopyPasteBehavior;
|
||||
|
@ -1,16 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
var inherits = require('inherits');
|
||||
import inherits from 'inherits';
|
||||
|
||||
var CommandInterceptor = require('diagram-js/lib/command/CommandInterceptor');
|
||||
import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
|
||||
|
||||
var is = require('../../../util/ModelUtil').is;
|
||||
import { is } from '../../../util/ModelUtil';
|
||||
|
||||
|
||||
/**
|
||||
* BPMN specific create boundary event behavior
|
||||
*/
|
||||
function CreateBoundaryEventBehavior(eventBus, modeling, elementFactory, bpmnFactory) {
|
||||
export default function CreateBoundaryEventBehavior(
|
||||
eventBus, modeling, elementFactory,
|
||||
bpmnFactory) {
|
||||
|
||||
CommandInterceptor.call(this, eventBus);
|
||||
|
||||
@ -44,8 +46,11 @@ function CreateBoundaryEventBehavior(eventBus, modeling, elementFactory, bpmnFac
|
||||
}, true);
|
||||
}
|
||||
|
||||
CreateBoundaryEventBehavior.$inject = [ 'eventBus', 'modeling', 'elementFactory', 'bpmnFactory' ];
|
||||
CreateBoundaryEventBehavior.$inject = [
|
||||
'eventBus',
|
||||
'modeling',
|
||||
'elementFactory',
|
||||
'bpmnFactory'
|
||||
];
|
||||
|
||||
inherits(CreateBoundaryEventBehavior, CommandInterceptor);
|
||||
|
||||
module.exports = CreateBoundaryEventBehavior;
|
||||
|
@ -1,15 +1,16 @@
|
||||
'use strict';
|
||||
|
||||
var inherits = require('inherits');
|
||||
import inherits from 'inherits';
|
||||
|
||||
var CommandInterceptor = require('diagram-js/lib/command/CommandInterceptor');
|
||||
import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
|
||||
|
||||
import { is } from '../../../util/ModelUtil';
|
||||
|
||||
var is = require('../../../util/ModelUtil').is;
|
||||
|
||||
/**
|
||||
* BPMN specific create data object behavior
|
||||
*/
|
||||
function CreateDataObjectBehavior(eventBus, bpmnFactory, moddle) {
|
||||
export default function CreateDataObjectBehavior(eventBus, bpmnFactory, moddle) {
|
||||
|
||||
CommandInterceptor.call(this, eventBus);
|
||||
|
||||
@ -30,8 +31,10 @@ function CreateDataObjectBehavior(eventBus, bpmnFactory, moddle) {
|
||||
|
||||
}
|
||||
|
||||
CreateDataObjectBehavior.$inject = [ 'eventBus', 'bpmnFactory', 'moddle' ];
|
||||
CreateDataObjectBehavior.$inject = [
|
||||
'eventBus',
|
||||
'bpmnFactory',
|
||||
'moddle'
|
||||
];
|
||||
|
||||
inherits(CreateDataObjectBehavior, CommandInterceptor);
|
||||
|
||||
module.exports = CreateDataObjectBehavior;
|
||||
|
@ -1,15 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
var inherits = require('inherits');
|
||||
import inherits from 'inherits';
|
||||
|
||||
var CommandInterceptor = require('diagram-js/lib/command/CommandInterceptor');
|
||||
import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
|
||||
|
||||
import { is } from '../../../util/ModelUtil';
|
||||
|
||||
var is = require('../../../util/ModelUtil').is;
|
||||
|
||||
/**
|
||||
* BPMN specific create participant behavior
|
||||
*/
|
||||
function CreateParticipantBehavior(eventBus, modeling, elementFactory, bpmnFactory, canvas) {
|
||||
export default function CreateParticipantBehavior(
|
||||
eventBus, modeling, elementFactory,
|
||||
bpmnFactory, canvas) {
|
||||
|
||||
CommandInterceptor.call(this, eventBus);
|
||||
|
||||
@ -26,7 +29,11 @@ function CreateParticipantBehavior(eventBus, modeling, elementFactory, bpmnFacto
|
||||
|
||||
var rootElement = canvas.getRootElement();
|
||||
|
||||
if (is(parent, 'bpmn:Process') && is(shape, 'bpmn:Participant') && !is(rootElement, 'bpmn:Collaboration')) {
|
||||
if (
|
||||
is(parent, 'bpmn:Process') &&
|
||||
is(shape, 'bpmn:Participant') &&
|
||||
!is(rootElement, 'bpmn:Collaboration')
|
||||
) {
|
||||
|
||||
// this is going to detach the process root
|
||||
// and set the returned collaboration element
|
||||
@ -84,8 +91,12 @@ function CreateParticipantBehavior(eventBus, modeling, elementFactory, bpmnFacto
|
||||
|
||||
}
|
||||
|
||||
CreateParticipantBehavior.$inject = [ 'eventBus', 'modeling', 'elementFactory', 'bpmnFactory', 'canvas' ];
|
||||
CreateParticipantBehavior.$inject = [
|
||||
'eventBus',
|
||||
'modeling',
|
||||
'elementFactory',
|
||||
'bpmnFactory',
|
||||
'canvas'
|
||||
];
|
||||
|
||||
inherits(CreateParticipantBehavior, CommandInterceptor);
|
||||
|
||||
module.exports = CreateParticipantBehavior;
|
||||
|
@ -1,14 +1,21 @@
|
||||
'use strict';
|
||||
|
||||
var inherits = require('inherits');
|
||||
import inherits from 'inherits';
|
||||
|
||||
var CommandInterceptor = require('diagram-js/lib/command/CommandInterceptor');
|
||||
import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
|
||||
|
||||
var Collections = require('diagram-js/lib/util/Collections');
|
||||
import {
|
||||
add as collectionAdd,
|
||||
remove as collectionRemove
|
||||
} from 'diagram-js/lib/util/Collections';
|
||||
|
||||
var find = require('min-dash').find;
|
||||
import {
|
||||
find
|
||||
} from 'min-dash';
|
||||
|
||||
var is = require('../../../util/ModelUtil').is;
|
||||
import {
|
||||
is
|
||||
} from '../../../util/ModelUtil';
|
||||
|
||||
var TARGET_REF_PLACEHOLDER_NAME = '__targetRef_placeholder';
|
||||
|
||||
@ -25,7 +32,7 @@ var TARGET_REF_PLACEHOLDER_NAME = '__targetRef_placeholder';
|
||||
* @param {EventBus} eventBus
|
||||
* @param {BpmnFactory} bpmnFactory
|
||||
*/
|
||||
function DataInputAssociationBehavior(eventBus, bpmnFactory) {
|
||||
export default function DataInputAssociationBehavior(eventBus, bpmnFactory) {
|
||||
|
||||
CommandInterceptor.call(this, eventBus);
|
||||
|
||||
@ -68,7 +75,7 @@ function DataInputAssociationBehavior(eventBus, bpmnFactory) {
|
||||
name: TARGET_REF_PLACEHOLDER_NAME
|
||||
});
|
||||
|
||||
Collections.add(properties, targetRefProp);
|
||||
collectionAdd(properties, targetRefProp);
|
||||
}
|
||||
|
||||
return targetRefProp;
|
||||
@ -83,7 +90,7 @@ function DataInputAssociationBehavior(eventBus, bpmnFactory) {
|
||||
}
|
||||
|
||||
if (!usesTargetRef(element, targetRefProp, connection)) {
|
||||
Collections.remove(element.get('properties'), targetRefProp);
|
||||
collectionRemove(element.get('properties'), targetRefProp);
|
||||
}
|
||||
}
|
||||
|
||||
@ -125,12 +132,13 @@ function DataInputAssociationBehavior(eventBus, bpmnFactory) {
|
||||
}
|
||||
}
|
||||
|
||||
DataInputAssociationBehavior.$inject = [ 'eventBus', 'bpmnFactory' ];
|
||||
DataInputAssociationBehavior.$inject = [
|
||||
'eventBus',
|
||||
'bpmnFactory'
|
||||
];
|
||||
|
||||
inherits(DataInputAssociationBehavior, CommandInterceptor);
|
||||
|
||||
module.exports = DataInputAssociationBehavior;
|
||||
|
||||
|
||||
/**
|
||||
* Only call the given function when the event
|
||||
|
@ -1,14 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
var inherits = require('inherits');
|
||||
import inherits from 'inherits';
|
||||
|
||||
var CommandInterceptor = require('diagram-js/lib/command/CommandInterceptor');
|
||||
import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
|
||||
|
||||
var is = require('../../../util/ModelUtil').is;
|
||||
import { is } from '../../../util/ModelUtil';
|
||||
|
||||
var getChildLanes = require('../util/LaneUtil').getChildLanes;
|
||||
import {
|
||||
getChildLanes
|
||||
} from '../util/LaneUtil';
|
||||
|
||||
var eachElement = require('diagram-js/lib/util/Elements').eachElement;
|
||||
import {
|
||||
eachElement
|
||||
} from 'diagram-js/lib/util/Elements';
|
||||
|
||||
|
||||
var LOW_PRIORITY = 500;
|
||||
@ -17,7 +21,7 @@ var LOW_PRIORITY = 500;
|
||||
/**
|
||||
* BPMN specific delete lane behavior
|
||||
*/
|
||||
function DeleteLaneBehavior(eventBus, modeling, spaceTool) {
|
||||
export default function DeleteLaneBehavior(eventBus, modeling, spaceTool) {
|
||||
|
||||
CommandInterceptor.call(this, eventBus);
|
||||
|
||||
@ -101,8 +105,10 @@ function DeleteLaneBehavior(eventBus, modeling, spaceTool) {
|
||||
});
|
||||
}
|
||||
|
||||
DeleteLaneBehavior.$inject = [ 'eventBus', 'modeling', 'spaceTool' ];
|
||||
DeleteLaneBehavior.$inject = [
|
||||
'eventBus',
|
||||
'modeling',
|
||||
'spaceTool'
|
||||
];
|
||||
|
||||
inherits(DeleteLaneBehavior, CommandInterceptor);
|
||||
|
||||
module.exports = DeleteLaneBehavior;
|
@ -1,37 +1,20 @@
|
||||
'use strict';
|
||||
|
||||
var inherits = require('inherits');
|
||||
import inherits from 'inherits';
|
||||
|
||||
var assign = require('min-dash').assign,
|
||||
find = require('min-dash').find;
|
||||
import {
|
||||
assign,
|
||||
find
|
||||
} from 'min-dash';
|
||||
|
||||
var CommandInterceptor = require('diagram-js/lib/command/CommandInterceptor');
|
||||
import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
|
||||
|
||||
var getApproxIntersection = require('diagram-js/lib/util/LineIntersection').getApproxIntersection;
|
||||
import {
|
||||
getApproxIntersection
|
||||
} from 'diagram-js/lib/util/LineIntersection';
|
||||
|
||||
function isPointInsideBBox(bbox, point) {
|
||||
var x = point.x,
|
||||
y = point.y;
|
||||
|
||||
return x >= bbox.x &&
|
||||
x <= bbox.x + bbox.width &&
|
||||
y >= bbox.y &&
|
||||
y <= bbox.y + bbox.height;
|
||||
}
|
||||
|
||||
function copy(obj) {
|
||||
return assign({}, obj);
|
||||
}
|
||||
|
||||
function getMid(bounds) {
|
||||
|
||||
return {
|
||||
x: Math.round(bounds.x + bounds.width / 2),
|
||||
y: Math.round(bounds.y + bounds.height / 2)
|
||||
};
|
||||
}
|
||||
|
||||
function DropOnFlow(eventBus, bpmnRules, modeling) {
|
||||
export default function DropOnFlowBehavior(eventBus, bpmnRules, modeling) {
|
||||
|
||||
CommandInterceptor.call(this, eventBus);
|
||||
|
||||
@ -162,8 +145,36 @@ function DropOnFlow(eventBus, bpmnRules, modeling) {
|
||||
}, true);
|
||||
}
|
||||
|
||||
inherits(DropOnFlow, CommandInterceptor);
|
||||
inherits(DropOnFlowBehavior, CommandInterceptor);
|
||||
|
||||
DropOnFlow.$inject = [ 'eventBus', 'bpmnRules', 'modeling' ];
|
||||
DropOnFlowBehavior.$inject = [
|
||||
'eventBus',
|
||||
'bpmnRules',
|
||||
'modeling'
|
||||
];
|
||||
|
||||
|
||||
// helpers /////////////////////
|
||||
|
||||
function isPointInsideBBox(bbox, point) {
|
||||
var x = point.x,
|
||||
y = point.y;
|
||||
|
||||
return x >= bbox.x &&
|
||||
x <= bbox.x + bbox.width &&
|
||||
y >= bbox.y &&
|
||||
y <= bbox.y + bbox.height;
|
||||
}
|
||||
|
||||
function copy(obj) {
|
||||
return assign({}, obj);
|
||||
}
|
||||
|
||||
function getMid(bounds) {
|
||||
|
||||
return {
|
||||
x: Math.round(bounds.x + bounds.width / 2),
|
||||
y: Math.round(bounds.y + bounds.height / 2)
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = DropOnFlow;
|
@ -1,8 +1,10 @@
|
||||
'use strict';
|
||||
|
||||
var getMid = require('diagram-js/lib/layout/LayoutUtil').getMid;
|
||||
import {
|
||||
getMid
|
||||
} from 'diagram-js/lib/layout/LayoutUtil';
|
||||
|
||||
var lineIntersect = require('./util/LineIntersect');
|
||||
import lineIntersect from './util/LineIntersect';
|
||||
|
||||
|
||||
/**
|
||||
@ -10,7 +12,7 @@ var lineIntersect = require('./util/LineIntersect');
|
||||
*
|
||||
* @param {EventBus} eventBus
|
||||
*/
|
||||
function ImportDockingFix(eventBus) {
|
||||
export default function ImportDockingFix(eventBus) {
|
||||
|
||||
function adjustDocking(startPoint, nextPoint, elementMid) {
|
||||
|
||||
@ -69,9 +71,9 @@ function ImportDockingFix(eventBus) {
|
||||
});
|
||||
}
|
||||
|
||||
ImportDockingFix.$inject = [ 'eventBus' ];
|
||||
|
||||
module.exports = ImportDockingFix;
|
||||
ImportDockingFix.$inject = [
|
||||
'eventBus'
|
||||
];
|
||||
|
||||
|
||||
// helpers //////////////////////
|
||||
|
@ -1,21 +1,28 @@
|
||||
'use strict';
|
||||
|
||||
var assign = require('min-dash').assign,
|
||||
inherits = require('inherits');
|
||||
import {
|
||||
assign
|
||||
} from 'min-dash';
|
||||
|
||||
var LabelUtil = require('../../../util/LabelUtil'),
|
||||
LabelLayoutUtil = require('./util/LabelLayoutUtil'),
|
||||
ModelUtil = require('../../../util/ModelUtil'),
|
||||
is = ModelUtil.is,
|
||||
getBusinessObject = ModelUtil.getBusinessObject;
|
||||
import inherits from 'inherits';
|
||||
|
||||
var hasExternalLabel = LabelUtil.hasExternalLabel,
|
||||
getExternalLabelMid = LabelUtil.getExternalLabelMid,
|
||||
getLabelAdjustment = LabelLayoutUtil.getLabelAdjustment;
|
||||
import {
|
||||
is,
|
||||
getBusinessObject
|
||||
} from '../../../util/ModelUtil';
|
||||
|
||||
var CommandInterceptor = require('diagram-js/lib/command/CommandInterceptor');
|
||||
import {
|
||||
hasExternalLabel,
|
||||
getExternalLabelMid,
|
||||
} from '../../../util/LabelUtil';
|
||||
|
||||
var TextUtil = require('diagram-js/lib/util/Text');
|
||||
import {
|
||||
getLabelAdjustment
|
||||
} from './util/LabelLayoutUtil';
|
||||
|
||||
import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
|
||||
|
||||
import TextUtil from 'diagram-js/lib/util/Text';
|
||||
|
||||
var DEFAULT_LABEL_DIMENSIONS = {
|
||||
width: 90,
|
||||
@ -32,7 +39,7 @@ var DEFAULT_LABEL_DIMENSIONS = {
|
||||
* @param {Modeling} modeling
|
||||
* @param {BpmnFactory} bpmnFactory
|
||||
*/
|
||||
function LabelSupport(eventBus, modeling, bpmnFactory) {
|
||||
export default function LabelBehavior(eventBus, modeling, bpmnFactory) {
|
||||
|
||||
CommandInterceptor.call(this, eventBus);
|
||||
|
||||
@ -186,11 +193,13 @@ function LabelSupport(eventBus, modeling, bpmnFactory) {
|
||||
|
||||
}
|
||||
|
||||
inherits(LabelSupport, CommandInterceptor);
|
||||
inherits(LabelBehavior, CommandInterceptor);
|
||||
|
||||
LabelSupport.$inject = [ 'eventBus', 'modeling', 'bpmnFactory' ];
|
||||
|
||||
module.exports = LabelSupport;
|
||||
LabelBehavior.$inject = [
|
||||
'eventBus',
|
||||
'modeling',
|
||||
'bpmnFactory'
|
||||
];
|
||||
|
||||
|
||||
// TODO(nikku): repeating code (search for <getLayoutedBounds>)
|
||||
|
@ -1,11 +1,12 @@
|
||||
'use strict';
|
||||
|
||||
var is = require('../../../util/ModelUtil').is;
|
||||
import { is } from '../../../util/ModelUtil';
|
||||
|
||||
var COLLAB_ERR_MSG = 'flow elements must be children of pools/participants',
|
||||
PROCESS_ERR_MSG = 'participants cannot be pasted onto a non-empty process diagram';
|
||||
|
||||
function ModelingFeedback(eventBus, tooltips, translate) {
|
||||
|
||||
export default function ModelingFeedback(eventBus, tooltips, translate) {
|
||||
|
||||
function showError(position, message, timeout) {
|
||||
tooltips.add({
|
||||
@ -44,7 +45,8 @@ function ModelingFeedback(eventBus, tooltips, translate) {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
ModelingFeedback.$inject = [ 'eventBus', 'tooltips', 'translate' ];
|
||||
|
||||
module.exports = ModelingFeedback;
|
||||
ModelingFeedback.$inject = [
|
||||
'eventBus',
|
||||
'tooltips',
|
||||
'translate'
|
||||
];
|
||||
|
@ -1,13 +1,13 @@
|
||||
'use strict';
|
||||
|
||||
var inherits = require('inherits');
|
||||
import inherits from 'inherits';
|
||||
|
||||
var CommandInterceptor = require('diagram-js/lib/command/CommandInterceptor');
|
||||
import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
|
||||
|
||||
var lineIntersect = require('./util/LineIntersect');
|
||||
import lineIntersect from './util/LineIntersect';
|
||||
|
||||
|
||||
function RemoveElementBehavior(eventBus, bpmnRules, modeling) {
|
||||
export default function RemoveElementBehavior(eventBus, bpmnRules, modeling) {
|
||||
|
||||
CommandInterceptor.call(this, eventBus);
|
||||
|
||||
@ -40,9 +40,11 @@ function RemoveElementBehavior(eventBus, bpmnRules, modeling) {
|
||||
|
||||
inherits(RemoveElementBehavior, CommandInterceptor);
|
||||
|
||||
RemoveElementBehavior.$inject = [ 'eventBus', 'bpmnRules', 'modeling' ];
|
||||
|
||||
module.exports = RemoveElementBehavior;
|
||||
RemoveElementBehavior.$inject = [
|
||||
'eventBus',
|
||||
'bpmnRules',
|
||||
'modeling'
|
||||
];
|
||||
|
||||
|
||||
// helpers //////////////////////
|
||||
|
@ -1,16 +1,16 @@
|
||||
'use strict';
|
||||
|
||||
var inherits = require('inherits');
|
||||
import inherits from 'inherits';
|
||||
|
||||
var CommandInterceptor = require('diagram-js/lib/command/CommandInterceptor');
|
||||
import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
|
||||
|
||||
var is = require('../../../util/ModelUtil').is;
|
||||
import { is } from '../../../util/ModelUtil';
|
||||
|
||||
|
||||
/**
|
||||
* BPMN specific remove behavior
|
||||
*/
|
||||
function RemoveParticipantBehavior(eventBus, modeling) {
|
||||
export default function RemoveParticipantBehavior(eventBus, modeling) {
|
||||
|
||||
CommandInterceptor.call(this, eventBus);
|
||||
|
||||
@ -47,5 +47,3 @@ function RemoveParticipantBehavior(eventBus, modeling) {
|
||||
RemoveParticipantBehavior.$inject = [ 'eventBus', 'modeling' ];
|
||||
|
||||
inherits(RemoveParticipantBehavior, CommandInterceptor);
|
||||
|
||||
module.exports = RemoveParticipantBehavior;
|
@ -1,17 +1,19 @@
|
||||
'use strict';
|
||||
|
||||
var forEach = require('min-dash').forEach,
|
||||
find = require('min-dash').find,
|
||||
matchPattern = require('min-dash').matchPattern;
|
||||
import {
|
||||
forEach,
|
||||
find,
|
||||
matchPattern
|
||||
} from 'min-dash';
|
||||
|
||||
var inherits = require('inherits');
|
||||
import inherits from 'inherits';
|
||||
|
||||
var CommandInterceptor = require('diagram-js/lib/command/CommandInterceptor');
|
||||
import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
|
||||
|
||||
var is = require('../../../util/ModelUtil').is;
|
||||
import { is } from '../../../util/ModelUtil';
|
||||
|
||||
|
||||
function ReplaceConnectionBehavior(eventBus, modeling, bpmnRules) {
|
||||
export default function ReplaceConnectionBehavior(eventBus, modeling, bpmnRules) {
|
||||
|
||||
CommandInterceptor.call(this, eventBus);
|
||||
|
||||
@ -129,6 +131,8 @@ function ReplaceConnectionBehavior(eventBus, modeling, bpmnRules) {
|
||||
|
||||
inherits(ReplaceConnectionBehavior, CommandInterceptor);
|
||||
|
||||
ReplaceConnectionBehavior.$inject = [ 'eventBus', 'modeling', 'bpmnRules' ];
|
||||
|
||||
module.exports = ReplaceConnectionBehavior;
|
||||
ReplaceConnectionBehavior.$inject = [
|
||||
'eventBus',
|
||||
'modeling',
|
||||
'bpmnRules'
|
||||
];
|
||||
|
@ -1,22 +1,28 @@
|
||||
'use strict';
|
||||
|
||||
var inherits = require('inherits');
|
||||
import inherits from 'inherits';
|
||||
|
||||
var CommandInterceptor = require('diagram-js/lib/command/CommandInterceptor');
|
||||
import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
|
||||
|
||||
var forEach = require('min-dash').forEach;
|
||||
import {
|
||||
forEach
|
||||
} from 'min-dash';
|
||||
|
||||
import {
|
||||
isEventSubProcess
|
||||
} from '../../../util/DiUtil';
|
||||
|
||||
import { is } from '../../../util/ModelUtil';
|
||||
|
||||
var isEventSubProcess = require('../../../util/DiUtil').isEventSubProcess;
|
||||
var is = require('../../../util/ModelUtil').is;
|
||||
|
||||
/**
|
||||
* Defines the behaviour of what happens to the elements inside a container
|
||||
* that morphs into another BPMN element
|
||||
*/
|
||||
function ReplaceElementBehaviour(
|
||||
export default function ReplaceElementBehaviour(
|
||||
eventBus, bpmnReplace, bpmnRules,
|
||||
elementRegistry, selection, modeling
|
||||
) {
|
||||
elementRegistry, selection, modeling) {
|
||||
|
||||
CommandInterceptor.call(this, eventBus);
|
||||
|
||||
this._bpmnReplace = bpmnReplace;
|
||||
@ -114,8 +120,10 @@ ReplaceElementBehaviour.prototype.replaceElements = function(elements, newElemen
|
||||
};
|
||||
|
||||
ReplaceElementBehaviour.$inject = [
|
||||
'eventBus', 'bpmnReplace', 'bpmnRules',
|
||||
'elementRegistry', 'selection', 'modeling'
|
||||
'eventBus',
|
||||
'bpmnReplace',
|
||||
'bpmnRules',
|
||||
'elementRegistry',
|
||||
'selection',
|
||||
'modeling'
|
||||
];
|
||||
|
||||
module.exports = ReplaceElementBehaviour;
|
||||
|
@ -1,10 +1,14 @@
|
||||
'use strict';
|
||||
|
||||
var is = require('../../../util/ModelUtil').is;
|
||||
import { is } from '../../../util/ModelUtil';
|
||||
|
||||
var roundBounds = require('diagram-js/lib/layout/LayoutUtil').roundBounds;
|
||||
import {
|
||||
roundBounds
|
||||
} from 'diagram-js/lib/layout/LayoutUtil';
|
||||
|
||||
var hasPrimaryModifier = require('diagram-js/lib/util/Mouse').hasPrimaryModifier;
|
||||
import {
|
||||
hasPrimaryModifier
|
||||
} from 'diagram-js/lib/util/Mouse';
|
||||
|
||||
var SLIGHTLY_HIGHER_PRIORITY = 1001;
|
||||
|
||||
@ -14,7 +18,7 @@ var SLIGHTLY_HIGHER_PRIORITY = 1001;
|
||||
* {@link Modeling#resizeShape} when resizing a Lane
|
||||
* or Participant shape.
|
||||
*/
|
||||
function ResizeLaneBehavior(eventBus, modeling) {
|
||||
export default function ResizeLaneBehavior(eventBus, modeling) {
|
||||
|
||||
eventBus.on('resize.start', SLIGHTLY_HIGHER_PRIORITY + 500, function(event) {
|
||||
var context = event.context,
|
||||
@ -54,6 +58,7 @@ function ResizeLaneBehavior(eventBus, modeling) {
|
||||
});
|
||||
}
|
||||
|
||||
ResizeLaneBehavior.$inject = [ 'eventBus', 'modeling' ];
|
||||
|
||||
module.exports = ResizeLaneBehavior;
|
||||
ResizeLaneBehavior.$inject = [
|
||||
'eventBus',
|
||||
'modeling'
|
||||
];
|
||||
|
@ -1,17 +1,26 @@
|
||||
'use strict';
|
||||
|
||||
var inherits = require('inherits');
|
||||
import inherits from 'inherits';
|
||||
|
||||
var CommandInterceptor = require('diagram-js/lib/command/CommandInterceptor'),
|
||||
getBusinessObject = require('../../../util/ModelUtil').getBusinessObject,
|
||||
is = require('../../../util/ModelUtil').is,
|
||||
computeChildrenBBox = require('diagram-js/lib/features/resize/ResizeUtil').computeChildrenBBox;
|
||||
import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
|
||||
|
||||
import {
|
||||
getBusinessObject,
|
||||
is
|
||||
} from '../../../util/ModelUtil';
|
||||
|
||||
import {
|
||||
computeChildrenBBox
|
||||
} from 'diagram-js/lib/features/resize/ResizeUtil';
|
||||
|
||||
|
||||
var LOW_PRIORITY = 500;
|
||||
|
||||
|
||||
function ToggleElementCollapseBehaviour(eventBus, elementFactory, modeling, resize) {
|
||||
export default function ToggleElementCollapseBehaviour(
|
||||
eventBus, elementFactory, modeling,
|
||||
resize) {
|
||||
|
||||
CommandInterceptor.call(this, eventBus);
|
||||
|
||||
|
||||
@ -126,9 +135,6 @@ ToggleElementCollapseBehaviour.$inject = [
|
||||
'modeling'
|
||||
];
|
||||
|
||||
module.exports = ToggleElementCollapseBehaviour;
|
||||
|
||||
|
||||
|
||||
// helpers //////////////////////
|
||||
|
||||
|
@ -1,12 +1,21 @@
|
||||
'use strict';
|
||||
|
||||
var forEach = require('min-dash').forEach;
|
||||
import {
|
||||
forEach
|
||||
} from 'min-dash';
|
||||
|
||||
var inherits = require('inherits');
|
||||
import inherits from 'inherits';
|
||||
|
||||
var CommandInterceptor = require('diagram-js/lib/command/CommandInterceptor');
|
||||
import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
|
||||
|
||||
function UnclaimIdBehavior(eventBus, modeling) {
|
||||
|
||||
/**
|
||||
* Unclaims model IDs on element deletion.
|
||||
*
|
||||
* @param {EventBus} eventBus
|
||||
* @param {Modeling} modeling
|
||||
*/
|
||||
export default function UnclaimIdBehavior(eventBus, modeling) {
|
||||
|
||||
CommandInterceptor.call(this, eventBus);
|
||||
|
||||
@ -24,5 +33,3 @@ function UnclaimIdBehavior(eventBus, modeling) {
|
||||
inherits(UnclaimIdBehavior, CommandInterceptor);
|
||||
|
||||
UnclaimIdBehavior.$inject = [ 'eventBus', 'modeling' ];
|
||||
|
||||
module.exports = UnclaimIdBehavior;
|
@ -1,11 +1,14 @@
|
||||
'use strict';
|
||||
|
||||
var inherits = require('inherits');
|
||||
import inherits from 'inherits';
|
||||
|
||||
var CommandInterceptor = require('diagram-js/lib/command/CommandInterceptor');
|
||||
import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
|
||||
|
||||
import {
|
||||
getBusinessObject,
|
||||
is
|
||||
} from '../../../util/ModelUtil';
|
||||
|
||||
var is = require('../../../util/ModelUtil').is,
|
||||
getBusinessObject = require('../../../util/ModelUtil').getBusinessObject;
|
||||
|
||||
/**
|
||||
* A behavior that unsets the Default property of
|
||||
@ -15,7 +18,7 @@ var is = require('../../../util/ModelUtil').is,
|
||||
* @param {EventBus} eventBus
|
||||
* @param {Modeling} modeling
|
||||
*/
|
||||
function DeleteSequenceFlowBehavior(eventBus, modeling) {
|
||||
export default function DeleteSequenceFlowBehavior(eventBus, modeling) {
|
||||
|
||||
CommandInterceptor.call(this, eventBus);
|
||||
|
||||
@ -35,9 +38,10 @@ function DeleteSequenceFlowBehavior(eventBus, modeling) {
|
||||
|
||||
inherits(DeleteSequenceFlowBehavior, CommandInterceptor);
|
||||
|
||||
DeleteSequenceFlowBehavior.$inject = [ 'eventBus', 'modeling' ];
|
||||
|
||||
module.exports = DeleteSequenceFlowBehavior;
|
||||
DeleteSequenceFlowBehavior.$inject = [
|
||||
'eventBus',
|
||||
'modeling'
|
||||
];
|
||||
|
||||
|
||||
// helpers //////////////////////
|
||||
|
@ -1,11 +1,12 @@
|
||||
'use strict';
|
||||
|
||||
import inherits from 'inherits';
|
||||
|
||||
var inherits = require('inherits');
|
||||
import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
|
||||
|
||||
var CommandInterceptor = require('diagram-js/lib/command/CommandInterceptor');
|
||||
|
||||
var is = require('../../../util/ModelUtil').is;
|
||||
import {
|
||||
is
|
||||
} from '../../../util/ModelUtil';
|
||||
|
||||
var LOW_PRIORITY = 500,
|
||||
HIGH_PRIORITY = 5000;
|
||||
@ -14,7 +15,7 @@ var LOW_PRIORITY = 500,
|
||||
/**
|
||||
* BPMN specific delete lane behavior
|
||||
*/
|
||||
function UpdateFlowNodeRefsBehavior(eventBus, modeling, translate) {
|
||||
export default function UpdateFlowNodeRefsBehavior(eventBus, modeling, translate) {
|
||||
|
||||
CommandInterceptor.call(this, eventBus);
|
||||
|
||||
@ -122,13 +123,14 @@ function UpdateFlowNodeRefsBehavior(eventBus, modeling, translate) {
|
||||
});
|
||||
}
|
||||
|
||||
UpdateFlowNodeRefsBehavior.$inject = [ 'eventBus', 'modeling' , 'translate'];
|
||||
UpdateFlowNodeRefsBehavior.$inject = [
|
||||
'eventBus',
|
||||
'modeling' ,
|
||||
'translate'
|
||||
];
|
||||
|
||||
inherits(UpdateFlowNodeRefsBehavior, CommandInterceptor);
|
||||
|
||||
module.exports = UpdateFlowNodeRefsBehavior;
|
||||
|
||||
|
||||
|
||||
function UpdateContext() {
|
||||
|
||||
|
@ -1,4 +1,26 @@
|
||||
module.exports = {
|
||||
import AdaptiveLabelPositioningBehavior from './AdaptiveLabelPositioningBehavior';
|
||||
import AppendBehavior from './AppendBehavior';
|
||||
import CopyPasteBehavior from './CopyPasteBehavior';
|
||||
import CreateBoundaryEventBehavior from './CreateBoundaryEventBehavior';
|
||||
import CreateDataObjectBehavior from './CreateDataObjectBehavior';
|
||||
import CreateParticipantBehavior from './CreateParticipantBehavior';
|
||||
import DataInputAssociationBehavior from './DataInputAssociationBehavior';
|
||||
import DeleteLaneBehavior from './DeleteLaneBehavior';
|
||||
import DropOnFlowBehavior from './DropOnFlowBehavior';
|
||||
import ImportDockingFix from './ImportDockingFix';
|
||||
import LabelBehavior from './LabelBehavior';
|
||||
import ModelingFeedback from './ModelingFeedback';
|
||||
import ReplaceConnectionBehavior from './ReplaceConnectionBehavior';
|
||||
import RemoveParticipantBehavior from './RemoveParticipantBehavior';
|
||||
import ReplaceElementBehaviour from './ReplaceElementBehaviour';
|
||||
import ResizeLaneBehavior from './ResizeLaneBehavior';
|
||||
import RemoveElementBehavior from './RemoveElementBehavior';
|
||||
import ToggleElementCollapseBehaviour from './ToggleElementCollapseBehaviour';
|
||||
import UnclaimIdBehavior from './UnclaimIdBehavior';
|
||||
import UpdateFlowNodeRefsBehavior from './UpdateFlowNodeRefsBehavior';
|
||||
import UnsetDefaultFlowBehavior from './UnsetDefaultFlowBehavior';
|
||||
|
||||
export default {
|
||||
__init__: [
|
||||
'adaptiveLabelPositioningBehavior',
|
||||
'appendBehavior',
|
||||
@ -22,25 +44,25 @@ module.exports = {
|
||||
'unsetDefaultFlowBehavior',
|
||||
'updateFlowNodeRefsBehavior'
|
||||
],
|
||||
adaptiveLabelPositioningBehavior: [ 'type', require('./AdaptiveLabelPositioningBehavior') ],
|
||||
appendBehavior: [ 'type', require('./AppendBehavior') ],
|
||||
copyPasteBehavior: [ 'type', require('./CopyPasteBehavior') ],
|
||||
createBoundaryEventBehavior: [ 'type', require('./CreateBoundaryEventBehavior') ],
|
||||
createDataObjectBehavior: [ 'type', require('./CreateDataObjectBehavior') ],
|
||||
createParticipantBehavior: [ 'type', require('./CreateParticipantBehavior') ],
|
||||
dataInputAssociationBehavior: [ 'type', require('./DataInputAssociationBehavior') ],
|
||||
deleteLaneBehavior: [ 'type', require('./DeleteLaneBehavior') ],
|
||||
dropOnFlowBehavior: [ 'type', require('./DropOnFlowBehavior') ],
|
||||
importDockingFix: [ 'type', require('./ImportDockingFix') ],
|
||||
labelBehavior: [ 'type', require('./LabelBehavior') ],
|
||||
modelingFeedback: [ 'type', require('./ModelingFeedback') ],
|
||||
replaceConnectionBehavior: [ 'type', require('./ReplaceConnectionBehavior') ],
|
||||
removeParticipantBehavior: [ 'type', require('./RemoveParticipantBehavior') ],
|
||||
replaceElementBehaviour: [ 'type', require('./ReplaceElementBehaviour') ],
|
||||
resizeLaneBehavior: [ 'type', require('./ResizeLaneBehavior') ],
|
||||
removeElementBehavior: [ 'type', require('./RemoveElementBehavior') ],
|
||||
toggleElementCollapseBehaviour : [ 'type', require('./ToggleElementCollapseBehaviour') ],
|
||||
unclaimIdBehavior: [ 'type', require('./UnclaimIdBehavior') ],
|
||||
updateFlowNodeRefsBehavior: [ 'type', require('./UpdateFlowNodeRefsBehavior') ],
|
||||
unsetDefaultFlowBehavior: [ 'type', require('./UnsetDefaultFlowBehavior') ]
|
||||
adaptiveLabelPositioningBehavior: [ 'type', AdaptiveLabelPositioningBehavior ],
|
||||
appendBehavior: [ 'type', AppendBehavior ],
|
||||
copyPasteBehavior: [ 'type', CopyPasteBehavior ],
|
||||
createBoundaryEventBehavior: [ 'type', CreateBoundaryEventBehavior ],
|
||||
createDataObjectBehavior: [ 'type', CreateDataObjectBehavior ],
|
||||
createParticipantBehavior: [ 'type', CreateParticipantBehavior ],
|
||||
dataInputAssociationBehavior: [ 'type', DataInputAssociationBehavior ],
|
||||
deleteLaneBehavior: [ 'type', DeleteLaneBehavior ],
|
||||
dropOnFlowBehavior: [ 'type', DropOnFlowBehavior ],
|
||||
importDockingFix: [ 'type', ImportDockingFix ],
|
||||
labelBehavior: [ 'type', LabelBehavior ],
|
||||
modelingFeedback: [ 'type', ModelingFeedback ],
|
||||
replaceConnectionBehavior: [ 'type', ReplaceConnectionBehavior ],
|
||||
removeParticipantBehavior: [ 'type', RemoveParticipantBehavior ],
|
||||
replaceElementBehaviour: [ 'type', ReplaceElementBehaviour ],
|
||||
resizeLaneBehavior: [ 'type', ResizeLaneBehavior ],
|
||||
removeElementBehavior: [ 'type', RemoveElementBehavior ],
|
||||
toggleElementCollapseBehaviour : [ 'type', ToggleElementCollapseBehaviour ],
|
||||
unclaimIdBehavior: [ 'type', UnclaimIdBehavior ],
|
||||
updateFlowNodeRefsBehavior: [ 'type', UpdateFlowNodeRefsBehavior ],
|
||||
unsetDefaultFlowBehavior: [ 'type', UnsetDefaultFlowBehavior ]
|
||||
};
|
||||
|
@ -6,11 +6,10 @@
|
||||
* @param {Vector}
|
||||
* @return {Float}
|
||||
*/
|
||||
function vectorLength(v) {
|
||||
export function vectorLength(v) {
|
||||
return Math.sqrt(Math.pow(v.x, 2) + Math.pow(v.y, 2));
|
||||
}
|
||||
|
||||
module.exports.vectorLength = vectorLength;
|
||||
|
||||
/**
|
||||
* Calculates the angle between a line a the yAxis
|
||||
@ -18,13 +17,12 @@ module.exports.vectorLength = vectorLength;
|
||||
* @param {Array}
|
||||
* @return {Float}
|
||||
*/
|
||||
function getAngle(line) {
|
||||
export function getAngle(line) {
|
||||
// return value is between 0, 180 and -180, -0
|
||||
// @janstuemmel: maybe replace return a/b with b/a
|
||||
return Math.atan((line[1].y - line[0].y) / (line[1].x - line[0].x));
|
||||
}
|
||||
|
||||
module.exports.getAngle = getAngle;
|
||||
|
||||
/**
|
||||
* Rotates a vector by a given angle
|
||||
@ -33,14 +31,13 @@ module.exports.getAngle = getAngle;
|
||||
* @param {Float} Angle in radians
|
||||
* @return {Vector}
|
||||
*/
|
||||
function rotateVector(vector, angle) {
|
||||
export function rotateVector(vector, angle) {
|
||||
return (!angle) ? vector : {
|
||||
x: Math.cos(angle) * vector.x - Math.sin(angle) * vector.y,
|
||||
y: Math.sin(angle) * vector.x + Math.cos(angle) * vector.y
|
||||
};
|
||||
}
|
||||
|
||||
module.exports.rotateVector = rotateVector;
|
||||
|
||||
/**
|
||||
* Solves a 2D equation system
|
||||
@ -66,6 +63,7 @@ function solveLambaSystem(a, b, c) {
|
||||
return -n/l;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Position of perpendicular foot
|
||||
*
|
||||
@ -73,7 +71,7 @@ function solveLambaSystem(a, b, c) {
|
||||
* @param [ {Point}, {Point} ] line defined throug two points
|
||||
* @return {Point} the perpendicular foot position
|
||||
*/
|
||||
function perpendicularFoot(point, line) {
|
||||
export function perpendicularFoot(point, line) {
|
||||
|
||||
var a = line[0], b = line[1];
|
||||
|
||||
@ -84,10 +82,8 @@ function perpendicularFoot(point, line) {
|
||||
var r = solveLambaSystem([ a.x, a.y ], [ bd.x, bd.y ], [ point.x, point.y ]);
|
||||
|
||||
return { x: a.x + r*bd.x, y: a.y + r*bd.y };
|
||||
|
||||
}
|
||||
|
||||
module.exports.perpendicularFoot = perpendicularFoot;
|
||||
|
||||
/**
|
||||
* Calculates the distance between a point and a line
|
||||
@ -96,7 +92,7 @@ module.exports.perpendicularFoot = perpendicularFoot;
|
||||
* @param [ {Point}, {Point} ] line defined throug two points
|
||||
* @return {Float} distance
|
||||
*/
|
||||
function getDistancePointLine(point, line) {
|
||||
export function getDistancePointLine(point, line) {
|
||||
|
||||
var pfPoint = perpendicularFoot(point, line);
|
||||
|
||||
@ -109,7 +105,6 @@ function getDistancePointLine(point, line) {
|
||||
return vectorLength(connectionVector);
|
||||
}
|
||||
|
||||
module.exports.getDistancePointLine = getDistancePointLine;
|
||||
|
||||
/**
|
||||
* Calculates the distance between two points
|
||||
@ -118,12 +113,10 @@ module.exports.getDistancePointLine = getDistancePointLine;
|
||||
* @param {Point}
|
||||
* @return {Float} distance
|
||||
*/
|
||||
function getDistancePointPoint(point1, point2) {
|
||||
export function getDistancePointPoint(point1, point2) {
|
||||
|
||||
return vectorLength({
|
||||
x: point1.x - point2.x,
|
||||
y: point1.y - point2.y
|
||||
});
|
||||
}
|
||||
|
||||
module.exports.getDistancePointPoint = getDistancePointPoint;
|
||||
|
@ -1,15 +1,21 @@
|
||||
'use strict';
|
||||
|
||||
var getDistancePointPoint = require('./GeometricUtil').getDistancePointPoint,
|
||||
rotateVector = require('./GeometricUtil').rotateVector,
|
||||
getAngle = require('./GeometricUtil').getAngle;
|
||||
import {
|
||||
getDistancePointPoint,
|
||||
rotateVector,
|
||||
getAngle
|
||||
} from './GeometricUtil';
|
||||
|
||||
var getAttachment = require('./LineAttachmentUtil').getAttachment;
|
||||
import {
|
||||
getAttachment
|
||||
} from './LineAttachmentUtil';
|
||||
|
||||
var roundPoint = require('diagram-js/lib/layout/LayoutUtil').roundPoint;
|
||||
import {
|
||||
roundPoint
|
||||
} from 'diagram-js/lib/layout/LayoutUtil';
|
||||
|
||||
|
||||
function findNewLabelLineStartIndex(oldWaypoints, newWaypoints, attachment, hints) {
|
||||
export function findNewLabelLineStartIndex(oldWaypoints, newWaypoints, attachment, hints) {
|
||||
|
||||
var index = attachment.segmentIndex;
|
||||
|
||||
@ -88,8 +94,6 @@ function findNewLabelLineStartIndex(oldWaypoints, newWaypoints, attachment, hint
|
||||
return null;
|
||||
}
|
||||
|
||||
module.exports.findNewLabelLineStartIndex = findNewLabelLineStartIndex;
|
||||
|
||||
|
||||
/**
|
||||
* Calculate the required adjustment (move delta) for the given label
|
||||
@ -102,7 +106,7 @@ module.exports.findNewLabelLineStartIndex = findNewLabelLineStartIndex;
|
||||
*
|
||||
* @return {Point} delta
|
||||
*/
|
||||
function getLabelAdjustment(label, newWaypoints, oldWaypoints, hints) {
|
||||
export function getLabelAdjustment(label, newWaypoints, oldWaypoints, hints) {
|
||||
|
||||
var x = 0,
|
||||
y = 0;
|
||||
@ -181,8 +185,6 @@ function getLabelAdjustment(label, newWaypoints, oldWaypoints, hints) {
|
||||
});
|
||||
}
|
||||
|
||||
module.exports.getLabelAdjustment = getLabelAdjustment;
|
||||
|
||||
|
||||
// HELPERS //////////////////////
|
||||
|
||||
|
@ -54,7 +54,7 @@ function getDistance(p1, p2) {
|
||||
*
|
||||
* @return {Object} attachment
|
||||
*/
|
||||
function getAttachment(point, line) {
|
||||
export function getAttachment(point, line) {
|
||||
|
||||
var idx = 0,
|
||||
segmentStart,
|
||||
@ -123,8 +123,6 @@ function getAttachment(point, line) {
|
||||
return closestAttachment;
|
||||
}
|
||||
|
||||
module.exports.getAttachment = getAttachment;
|
||||
|
||||
/**
|
||||
* Gets the intersection between a circle and a line segment.
|
||||
*
|
||||
|
@ -10,7 +10,7 @@
|
||||
*
|
||||
* @return {Point}
|
||||
*/
|
||||
module.exports = function lineIntersect(l1s, l1e, l2s, l2e) {
|
||||
export default function lineIntersect(l1s, l1e, l2s, l2e) {
|
||||
// if the lines intersect, the result contains the x and y of the
|
||||
// intersection (treating the lines as infinite) and booleans for
|
||||
// whether line segment 1 or line segment 2 contain the point
|
||||
@ -34,4 +34,4 @@ module.exports = function lineIntersect(l1s, l1e, l2s, l2e) {
|
||||
x: Math.round(l1s.x + (c * (l1e.x - l1s.x))),
|
||||
y: Math.round(l1s.y + (c * (l1e.y - l1s.y)))
|
||||
};
|
||||
};
|
||||
}
|
@ -1,12 +1,19 @@
|
||||
'use strict';
|
||||
|
||||
var filter = require('min-dash').filter;
|
||||
import {
|
||||
filter
|
||||
} from 'min-dash';
|
||||
|
||||
var Elements = require('diagram-js/lib/util/Elements');
|
||||
import {
|
||||
eachElement
|
||||
} from 'diagram-js/lib/util/Elements';
|
||||
|
||||
import {
|
||||
getLanesRoot,
|
||||
getChildLanes,
|
||||
LANE_INDENTATION
|
||||
} from '../util/LaneUtil';
|
||||
|
||||
var getLanesRoot = require('../util/LaneUtil').getLanesRoot,
|
||||
getChildLanes = require('../util/LaneUtil').getChildLanes,
|
||||
LANE_INDENTATION = require('../util/LaneUtil').LANE_INDENTATION;
|
||||
|
||||
/**
|
||||
* A handler that allows us to add a new lane
|
||||
@ -14,14 +21,15 @@ var getLanesRoot = require('../util/LaneUtil').getLanesRoot,
|
||||
*
|
||||
* @param {Modeling} modeling
|
||||
*/
|
||||
function AddLaneHandler(modeling, spaceTool) {
|
||||
export default function AddLaneHandler(modeling, spaceTool) {
|
||||
this._modeling = modeling;
|
||||
this._spaceTool = spaceTool;
|
||||
}
|
||||
|
||||
AddLaneHandler.$inject = [ 'modeling', 'spaceTool' ];
|
||||
|
||||
module.exports = AddLaneHandler;
|
||||
AddLaneHandler.$inject = [
|
||||
'modeling',
|
||||
'spaceTool'
|
||||
];
|
||||
|
||||
|
||||
AddLaneHandler.prototype.preExecute = function(context) {
|
||||
@ -52,7 +60,7 @@ AddLaneHandler.prototype.preExecute = function(context) {
|
||||
// (1) collect affected elements to create necessary space
|
||||
var allAffected = [];
|
||||
|
||||
Elements.eachElement(lanesRoot, function(element) {
|
||||
eachElement(lanesRoot, function(element) {
|
||||
allAffected.push(element);
|
||||
|
||||
if (element === shape) {
|
||||
|
@ -1,14 +1,11 @@
|
||||
'use strict';
|
||||
|
||||
|
||||
function IdClaimHandler(moddle) {
|
||||
export default function IdClaimHandler(moddle) {
|
||||
this._moddle = moddle;
|
||||
}
|
||||
|
||||
IdClaimHandler.$inject = [ 'moddle' ];
|
||||
|
||||
module.exports = IdClaimHandler;
|
||||
|
||||
|
||||
IdClaimHandler.prototype.execute = function(context) {
|
||||
var ids = this._moddle.ids,
|
||||
|
@ -1,14 +1,23 @@
|
||||
'use strict';
|
||||
|
||||
var is = require('../../../util/ModelUtil').is;
|
||||
import { is } from '../../../util/ModelUtil';
|
||||
|
||||
var getLanesRoot = require('../util/LaneUtil').getLanesRoot,
|
||||
computeLanesResize = require('../util/LaneUtil').computeLanesResize;
|
||||
import {
|
||||
getLanesRoot,
|
||||
computeLanesResize
|
||||
} from '../util/LaneUtil';
|
||||
|
||||
var eachElement = require('diagram-js/lib/util/Elements').eachElement;
|
||||
import {
|
||||
eachElement
|
||||
} from 'diagram-js/lib/util/Elements';
|
||||
|
||||
var asTRBL = require('diagram-js/lib/layout/LayoutUtil').asTRBL,
|
||||
substractTRBL = require('diagram-js/lib/features/resize/ResizeUtil').substractTRBL;
|
||||
import {
|
||||
asTRBL
|
||||
} from 'diagram-js/lib/layout/LayoutUtil';
|
||||
|
||||
import {
|
||||
substractTRBL
|
||||
} from 'diagram-js/lib/features/resize/ResizeUtil';
|
||||
|
||||
|
||||
/**
|
||||
@ -16,14 +25,15 @@ var asTRBL = require('diagram-js/lib/layout/LayoutUtil').asTRBL,
|
||||
*
|
||||
* @param {Modeling} modeling
|
||||
*/
|
||||
function ResizeLaneHandler(modeling, spaceTool) {
|
||||
export default function ResizeLaneHandler(modeling, spaceTool) {
|
||||
this._modeling = modeling;
|
||||
this._spaceTool = spaceTool;
|
||||
}
|
||||
|
||||
ResizeLaneHandler.$inject = [ 'modeling', 'spaceTool' ];
|
||||
|
||||
module.exports = ResizeLaneHandler;
|
||||
ResizeLaneHandler.$inject = [
|
||||
'modeling',
|
||||
'spaceTool'
|
||||
];
|
||||
|
||||
|
||||
ResizeLaneHandler.prototype.preExecute = function(context) {
|
||||
|
@ -1,7 +1,10 @@
|
||||
'use strict';
|
||||
|
||||
var assign = require('min-dash').assign,
|
||||
forEach = require('min-dash').forEach;
|
||||
import {
|
||||
assign,
|
||||
forEach
|
||||
} from 'min-dash';
|
||||
|
||||
|
||||
var DEFAULT_COLORS = {
|
||||
fill: undefined,
|
||||
@ -9,7 +12,7 @@ var DEFAULT_COLORS = {
|
||||
};
|
||||
|
||||
|
||||
function SetColorHandler(commandStack) {
|
||||
export default function SetColorHandler(commandStack) {
|
||||
this._commandStack = commandStack;
|
||||
}
|
||||
|
||||
@ -17,7 +20,6 @@ SetColorHandler.$inject = [
|
||||
'commandStack'
|
||||
];
|
||||
|
||||
module.exports = SetColorHandler;
|
||||
|
||||
SetColorHandler.prototype.postExecute = function(context) {
|
||||
var elements = context.elements,
|
||||
|
@ -1,8 +1,10 @@
|
||||
'use strict';
|
||||
|
||||
var getChildLanes = require('../util/LaneUtil').getChildLanes;
|
||||
import {
|
||||
getChildLanes,
|
||||
LANE_INDENTATION
|
||||
} from '../util/LaneUtil';
|
||||
|
||||
var LANE_INDENTATION = require('../util/LaneUtil').LANE_INDENTATION;
|
||||
|
||||
/**
|
||||
* A handler that splits a lane into a number of sub-lanes,
|
||||
@ -10,14 +12,15 @@ var LANE_INDENTATION = require('../util/LaneUtil').LANE_INDENTATION;
|
||||
*
|
||||
* @param {Modeling} modeling
|
||||
*/
|
||||
function SplitLaneHandler(modeling, translate) {
|
||||
export default function SplitLaneHandler(modeling, translate) {
|
||||
this._modeling = modeling;
|
||||
this._translate = translate;
|
||||
}
|
||||
|
||||
SplitLaneHandler.$inject = [ 'modeling', 'translate'];
|
||||
|
||||
module.exports = SplitLaneHandler;
|
||||
SplitLaneHandler.$inject = [
|
||||
'modeling',
|
||||
'translate'
|
||||
];
|
||||
|
||||
|
||||
SplitLaneHandler.prototype.preExecute = function(context) {
|
||||
|
@ -1,16 +1,20 @@
|
||||
'use strict';
|
||||
|
||||
var Collections = require('diagram-js/lib/util/Collections');
|
||||
import {
|
||||
add as collectionAdd,
|
||||
remove as collectionRemove
|
||||
} from 'diagram-js/lib/util/Collections';
|
||||
|
||||
|
||||
function UpdateCanvasRootHandler(canvas, modeling) {
|
||||
export default function UpdateCanvasRootHandler(canvas, modeling) {
|
||||
this._canvas = canvas;
|
||||
this._modeling = modeling;
|
||||
}
|
||||
|
||||
UpdateCanvasRootHandler.$inject = [ 'canvas', 'modeling' ];
|
||||
|
||||
module.exports = UpdateCanvasRootHandler;
|
||||
UpdateCanvasRootHandler.$inject = [
|
||||
'canvas',
|
||||
'modeling'
|
||||
];
|
||||
|
||||
|
||||
UpdateCanvasRootHandler.prototype.execute = function(context) {
|
||||
@ -28,10 +32,10 @@ UpdateCanvasRootHandler.prototype.execute = function(context) {
|
||||
canvas.setRootElement(newRoot, true);
|
||||
|
||||
// (2) update root elements
|
||||
Collections.add(bpmnDefinitions.rootElements, newRootBusinessObject);
|
||||
collectionAdd(bpmnDefinitions.rootElements, newRootBusinessObject);
|
||||
newRootBusinessObject.$parent = bpmnDefinitions;
|
||||
|
||||
Collections.remove(bpmnDefinitions.rootElements, oldRootBusinessObject);
|
||||
collectionRemove(bpmnDefinitions.rootElements, oldRootBusinessObject);
|
||||
oldRootBusinessObject.$parent = null;
|
||||
|
||||
// (3) wire di
|
||||
@ -62,10 +66,10 @@ UpdateCanvasRootHandler.prototype.revert = function(context) {
|
||||
canvas.setRootElement(oldRoot, true);
|
||||
|
||||
// (2) update root elements
|
||||
Collections.remove(bpmnDefinitions.rootElements, newRootBusinessObject);
|
||||
collectionRemove(bpmnDefinitions.rootElements, newRootBusinessObject);
|
||||
newRootBusinessObject.$parent = null;
|
||||
|
||||
Collections.add(bpmnDefinitions.rootElements, oldRootBusinessObject);
|
||||
collectionAdd(bpmnDefinitions.rootElements, oldRootBusinessObject);
|
||||
oldRootBusinessObject.$parent = bpmnDefinitions;
|
||||
|
||||
// (3) wire di
|
||||
|
@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -1,13 +1,17 @@
|
||||
'use strict';
|
||||
|
||||
var reduce = require('min-dash').reduce,
|
||||
keys = require('min-dash').keys,
|
||||
forEach = require('min-dash').forEach,
|
||||
assign = require('min-dash').assign;
|
||||
import {
|
||||
reduce,
|
||||
keys,
|
||||
forEach,
|
||||
assign
|
||||
} from 'min-dash';
|
||||
|
||||
var getBusinessObject = require('../../../util/ModelUtil').getBusinessObject;
|
||||
import {
|
||||
getBusinessObject
|
||||
} from '../../../util/ModelUtil';
|
||||
|
||||
var TextUtil = require('diagram-js/lib/util/Text');
|
||||
import TextUtil from 'diagram-js/lib/util/Text';
|
||||
|
||||
var DEFAULT_FLOW = 'default',
|
||||
NAME = 'name',
|
||||
@ -28,7 +32,7 @@ var NULL_DIMENSIONS = {
|
||||
* Use respective diagram-js provided handlers if you would
|
||||
* like to perform automated modeling.
|
||||
*/
|
||||
function UpdatePropertiesHandler(elementRegistry, moddle, translate, modeling) {
|
||||
export default function UpdatePropertiesHandler(elementRegistry, moddle, translate, modeling) {
|
||||
this._elementRegistry = elementRegistry;
|
||||
this._moddle = moddle;
|
||||
this._translate = translate;
|
||||
@ -37,9 +41,12 @@ function UpdatePropertiesHandler(elementRegistry, moddle, translate, modeling) {
|
||||
this._textUtil = new TextUtil();
|
||||
}
|
||||
|
||||
UpdatePropertiesHandler.$inject = [ 'elementRegistry', 'moddle', 'translate', 'modeling' ];
|
||||
|
||||
module.exports = UpdatePropertiesHandler;
|
||||
UpdatePropertiesHandler.$inject = [
|
||||
'elementRegistry',
|
||||
'moddle',
|
||||
'translate',
|
||||
'modeling'
|
||||
];
|
||||
|
||||
|
||||
// api //////////////////////
|
||||
|
@ -1,22 +1,46 @@
|
||||
module.exports = {
|
||||
__init__: [ 'modeling', 'bpmnUpdater' ],
|
||||
__depends__: [
|
||||
require('./behavior'),
|
||||
require('../rules'),
|
||||
require('../ordering'),
|
||||
require('../replace'),
|
||||
require('diagram-js/lib/command'),
|
||||
require('diagram-js/lib/features/tooltips'),
|
||||
require('diagram-js/lib/features/label-support'),
|
||||
require('diagram-js/lib/features/attach-support'),
|
||||
require('diagram-js/lib/features/selection'),
|
||||
require('diagram-js/lib/features/change-support'),
|
||||
require('diagram-js/lib/features/space-tool')
|
||||
import BehaviorModule from './behavior';
|
||||
import RulesModule from '../rules';
|
||||
import OrderingModule from '../ordering';
|
||||
import ReplaceModule from '../replace';
|
||||
|
||||
import CommandModule from 'diagram-js/lib/command';
|
||||
import TooltipsModule from 'diagram-js/lib/features/tooltips';
|
||||
import LabelSupportModule from 'diagram-js/lib/features/label-support';
|
||||
import AttachSupportModule from 'diagram-js/lib/features/attach-support';
|
||||
import SelectionModule from 'diagram-js/lib/features/selection';
|
||||
import ChangeSupportModule from 'diagram-js/lib/features/change-support';
|
||||
import SpaceToolModule from 'diagram-js/lib/features/space-tool';
|
||||
|
||||
import BpmnFactory from './BpmnFactory';
|
||||
import BpmnUpdater from './BpmnUpdater';
|
||||
import ElementFactory from './ElementFactory';
|
||||
import Modeling from './Modeling';
|
||||
import BpmnLayouter from './BpmnLayouter';
|
||||
import CroppingConnectionDocking from 'diagram-js/lib/layout/CroppingConnectionDocking';
|
||||
|
||||
|
||||
export default {
|
||||
__init__: [
|
||||
'modeling',
|
||||
'bpmnUpdater'
|
||||
],
|
||||
bpmnFactory: [ 'type', require('./BpmnFactory') ],
|
||||
bpmnUpdater: [ 'type', require('./BpmnUpdater') ],
|
||||
elementFactory: [ 'type', require('./ElementFactory') ],
|
||||
modeling: [ 'type', require('./Modeling') ],
|
||||
layouter: [ 'type', require('./BpmnLayouter') ],
|
||||
connectionDocking: [ 'type', require('diagram-js/lib/layout/CroppingConnectionDocking') ]
|
||||
__depends__: [
|
||||
BehaviorModule,
|
||||
RulesModule,
|
||||
OrderingModule,
|
||||
ReplaceModule,
|
||||
CommandModule,
|
||||
TooltipsModule,
|
||||
LabelSupportModule,
|
||||
AttachSupportModule,
|
||||
SelectionModule,
|
||||
ChangeSupportModule,
|
||||
SpaceToolModule
|
||||
],
|
||||
bpmnFactory: [ 'type', BpmnFactory ],
|
||||
bpmnUpdater: [ 'type', BpmnUpdater ],
|
||||
elementFactory: [ 'type', ElementFactory ],
|
||||
modeling: [ 'type', Modeling ],
|
||||
layouter: [ 'type', BpmnLayouter ],
|
||||
connectionDocking: [ 'type', CroppingConnectionDocking ]
|
||||
};
|
@ -1,12 +1,19 @@
|
||||
'use strict';
|
||||
|
||||
var is = require('../../../util/ModelUtil').is;
|
||||
import { is } from '../../../util/ModelUtil';
|
||||
|
||||
var getParent = require('./ModelingUtil').getParent;
|
||||
import {
|
||||
getParent
|
||||
} from './ModelingUtil';
|
||||
|
||||
var asTRBL = require('diagram-js/lib/layout/LayoutUtil').asTRBL,
|
||||
substractTRBL = require('diagram-js/lib/features/resize/ResizeUtil').substractTRBL,
|
||||
resizeTRBL = require('diagram-js/lib/features/resize/ResizeUtil').resizeTRBL;
|
||||
import {
|
||||
asTRBL
|
||||
} from 'diagram-js/lib/layout/LayoutUtil';
|
||||
|
||||
import {
|
||||
substractTRBL,
|
||||
resizeTRBL
|
||||
} from 'diagram-js/lib/features/resize/ResizeUtil';
|
||||
|
||||
var abs = Math.abs;
|
||||
|
||||
@ -22,9 +29,7 @@ var LANE_PARENTS = [
|
||||
'bpmn:SubProcess'
|
||||
];
|
||||
|
||||
var LANE_INDENTATION = 30;
|
||||
|
||||
module.exports.LANE_INDENTATION = LANE_INDENTATION;
|
||||
export var LANE_INDENTATION = 30;
|
||||
|
||||
|
||||
/**
|
||||
@ -35,7 +40,7 @@ module.exports.LANE_INDENTATION = LANE_INDENTATION;
|
||||
*
|
||||
* @return {Array<djs.model.Base>}
|
||||
*/
|
||||
function collectLanes(shape, collectedShapes) {
|
||||
export function collectLanes(shape, collectedShapes) {
|
||||
|
||||
collectedShapes = collectedShapes || [];
|
||||
|
||||
@ -50,7 +55,6 @@ function collectLanes(shape, collectedShapes) {
|
||||
return collectedShapes;
|
||||
}
|
||||
|
||||
module.exports.collectLanes = collectLanes;
|
||||
|
||||
/**
|
||||
* Return the lane children of the given element.
|
||||
@ -59,13 +63,12 @@ module.exports.collectLanes = collectLanes;
|
||||
*
|
||||
* @return {Array<djs.model.Shape>}
|
||||
*/
|
||||
function getChildLanes(shape) {
|
||||
export function getChildLanes(shape) {
|
||||
return shape.children.filter(function(c) {
|
||||
return is(c, 'bpmn:Lane');
|
||||
});
|
||||
}
|
||||
|
||||
module.exports.getChildLanes = getChildLanes;
|
||||
|
||||
/**
|
||||
* Return the root element containing the given lane shape
|
||||
@ -74,12 +77,10 @@ module.exports.getChildLanes = getChildLanes;
|
||||
*
|
||||
* @return {djs.model.Shape}
|
||||
*/
|
||||
function getLanesRoot(shape) {
|
||||
export function getLanesRoot(shape) {
|
||||
return getParent(shape, LANE_PARENTS) || shape;
|
||||
}
|
||||
|
||||
module.exports.getLanesRoot = getLanesRoot;
|
||||
|
||||
|
||||
/**
|
||||
* Compute the required resize operations for lanes
|
||||
@ -91,7 +92,7 @@ module.exports.getLanesRoot = getLanesRoot;
|
||||
*
|
||||
* @return {Array<Object>}
|
||||
*/
|
||||
function computeLanesResize(shape, newBounds) {
|
||||
export function computeLanesResize(shape, newBounds) {
|
||||
|
||||
var rootElement = getLanesRoot(shape);
|
||||
|
||||
@ -153,5 +154,3 @@ function computeLanesResize(shape, newBounds) {
|
||||
|
||||
return resizeNeeded;
|
||||
}
|
||||
|
||||
module.exports.computeLanesResize = computeLanesResize;
|
||||
|
@ -1,8 +1,10 @@
|
||||
'use strict';
|
||||
|
||||
var some = require('min-dash').some;
|
||||
import {
|
||||
some
|
||||
} from 'min-dash';
|
||||
|
||||
var is = require('../../../util/ModelUtil').is;
|
||||
import { is } from '../../../util/ModelUtil';
|
||||
|
||||
|
||||
/**
|
||||
@ -13,14 +15,12 @@ var is = require('../../../util/ModelUtil').is;
|
||||
*
|
||||
* @return {Boolean}
|
||||
*/
|
||||
function isAny(element, types) {
|
||||
export function isAny(element, types) {
|
||||
return some(types, function(t) {
|
||||
return is(element, t);
|
||||
});
|
||||
}
|
||||
|
||||
module.exports.isAny = isAny;
|
||||
|
||||
|
||||
/**
|
||||
* Return the parent of the element with any of the given types.
|
||||
@ -30,7 +30,7 @@ module.exports.isAny = isAny;
|
||||
*
|
||||
* @return {djs.model.Base}
|
||||
*/
|
||||
function getParent(element, anyType) {
|
||||
export function getParent(element, anyType) {
|
||||
|
||||
if (typeof anyType === 'string') {
|
||||
anyType = [ anyType ];
|
||||
@ -44,5 +44,3 @@ function getParent(element, anyType) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
module.exports.getParent = getParent;
|
||||
|
@ -1,14 +1,17 @@
|
||||
'use strict';
|
||||
|
||||
var inherits = require('inherits');
|
||||
import inherits from 'inherits';
|
||||
|
||||
var OrderingProvider = require('diagram-js/lib/features/ordering/OrderingProvider');
|
||||
import OrderingProvider from 'diagram-js/lib/features/ordering/OrderingProvider';
|
||||
|
||||
var isAny = require('../modeling/util/ModelingUtil').isAny;
|
||||
import {
|
||||
isAny
|
||||
} from '../modeling/util/ModelingUtil';
|
||||
|
||||
var findIndex = require('min-dash').findIndex;
|
||||
|
||||
var find = require('min-dash').find;
|
||||
import {
|
||||
findIndex,
|
||||
find
|
||||
} from 'min-dash';
|
||||
|
||||
|
||||
/**
|
||||
@ -17,7 +20,7 @@ var find = require('min-dash').find;
|
||||
* (1) elements are ordered by a {level} property
|
||||
* (2) elements with {alwaysOnTop} are always added to the root
|
||||
*/
|
||||
function BpmnOrderingProvider(eventBus, translate) {
|
||||
export default function BpmnOrderingProvider(eventBus, translate) {
|
||||
|
||||
OrderingProvider.call(this, eventBus);
|
||||
|
||||
@ -158,5 +161,3 @@ function BpmnOrderingProvider(eventBus, translate) {
|
||||
BpmnOrderingProvider.$inject = [ 'eventBus', 'translate' ];
|
||||
|
||||
inherits(BpmnOrderingProvider, OrderingProvider);
|
||||
|
||||
module.exports = BpmnOrderingProvider;
|
||||
|
@ -1,7 +1,11 @@
|
||||
module.exports = {
|
||||
__init__: [ 'bpmnOrderingProvider' ],
|
||||
import translate from 'diagram-js/lib/i18n/translate';
|
||||
|
||||
import BpmnOrderingProvider from './BpmnOrderingProvider';
|
||||
|
||||
export default {
|
||||
__depends__: [
|
||||
require('diagram-js/lib/i18n/translate')
|
||||
translate
|
||||
],
|
||||
bpmnOrderingProvider: [ 'type', require('./BpmnOrderingProvider') ]
|
||||
__init__: [ 'bpmnOrderingProvider' ],
|
||||
bpmnOrderingProvider: [ 'type', BpmnOrderingProvider ]
|
||||
};
|
@ -1,11 +1,14 @@
|
||||
'use strict';
|
||||
|
||||
var assign = require('min-dash').assign;
|
||||
import {
|
||||
assign
|
||||
} from 'min-dash';
|
||||
|
||||
|
||||
/**
|
||||
* A palette provider for BPMN 2.0 elements.
|
||||
*/
|
||||
function PaletteProvider(
|
||||
export default function PaletteProvider(
|
||||
palette, create, elementFactory,
|
||||
spaceTool, lassoTool, handTool,
|
||||
globalConnect, translate) {
|
||||
@ -22,8 +25,6 @@ function PaletteProvider(
|
||||
palette.registerProvider(this);
|
||||
}
|
||||
|
||||
module.exports = PaletteProvider;
|
||||
|
||||
PaletteProvider.$inject = [
|
||||
'palette',
|
||||
'create',
|
||||
|
@ -1,13 +1,24 @@
|
||||
module.exports = {
|
||||
import PaletteModule from 'diagram-js/lib/features/palette';
|
||||
import CreateModule from 'diagram-js/lib/features/create';
|
||||
import SpaceToolModule from 'diagram-js/lib/features/space-tool';
|
||||
import LassoToolModule from 'diagram-js/lib/features/lasso-tool';
|
||||
import HandToolModule from 'diagram-js/lib/features/hand-tool';
|
||||
import translate from 'diagram-js/lib/i18n/translate';
|
||||
|
||||
import GlobalConnectModule from '../global-connect';
|
||||
|
||||
import PaletteProvider from './PaletteProvider';
|
||||
|
||||
export default {
|
||||
__depends__: [
|
||||
require('diagram-js/lib/features/palette'),
|
||||
require('diagram-js/lib/features/create'),
|
||||
require('diagram-js/lib/features/space-tool'),
|
||||
require('diagram-js/lib/features/lasso-tool'),
|
||||
require('diagram-js/lib/features/hand-tool'),
|
||||
require('diagram-js/lib/i18n/translate'),
|
||||
require('../global-connect')
|
||||
PaletteModule,
|
||||
CreateModule,
|
||||
SpaceToolModule,
|
||||
LassoToolModule,
|
||||
HandToolModule,
|
||||
translate,
|
||||
GlobalConnectModule
|
||||
],
|
||||
__init__: [ 'paletteProvider' ],
|
||||
paletteProvider: [ 'type', require('./PaletteProvider') ]
|
||||
paletteProvider: [ 'type', PaletteProvider ]
|
||||
};
|
||||
|
@ -1,21 +1,31 @@
|
||||
'use strict';
|
||||
|
||||
var is = require('../../util/ModelUtil').is,
|
||||
isEventSubProcess = require('../../util/DiUtil').isEventSubProcess,
|
||||
getBusinessObject = require('../../util/ModelUtil').getBusinessObject,
|
||||
isExpanded = require('../../util/DiUtil').isExpanded,
|
||||
isDifferentType = require('./util/TypeUtil').isDifferentType;
|
||||
import {
|
||||
getBusinessObject,
|
||||
is
|
||||
} from '../../util/ModelUtil';
|
||||
|
||||
var forEach = require('min-dash').forEach,
|
||||
filter = require('min-dash').filter;
|
||||
import {
|
||||
isEventSubProcess,
|
||||
isExpanded
|
||||
} from '../../util/DiUtil';
|
||||
|
||||
var replaceOptions = require ('../replace/ReplaceOptions');
|
||||
import {
|
||||
isDifferentType
|
||||
} from './util/TypeUtil';
|
||||
|
||||
import {
|
||||
forEach,
|
||||
filter
|
||||
} from 'min-dash';
|
||||
|
||||
import * as replaceOptions from '../replace/ReplaceOptions';
|
||||
|
||||
|
||||
/**
|
||||
* This module is an element agnostic replace menu provider for the popup menu.
|
||||
*/
|
||||
function ReplaceMenuProvider(
|
||||
export default function ReplaceMenuProvider(
|
||||
popupMenu, modeling, moddle,
|
||||
bpmnReplace, rules, translate) {
|
||||
|
||||
@ -483,5 +493,3 @@ ReplaceMenuProvider.prototype._getAdHocEntry = function(element) {
|
||||
|
||||
return adHocEntry;
|
||||
};
|
||||
|
||||
module.exports = ReplaceMenuProvider;
|
||||
|
@ -1,8 +1,14 @@
|
||||
module.exports = {
|
||||
import PopupMenuModule from 'diagram-js/lib/features/popup-menu';
|
||||
import ReplaceModule from '../replace';
|
||||
|
||||
import ReplaceMenuProvider from './ReplaceMenuProvider';
|
||||
|
||||
|
||||
export default {
|
||||
__depends__: [
|
||||
require('diagram-js/lib/features/popup-menu'),
|
||||
require('../replace')
|
||||
PopupMenuModule,
|
||||
ReplaceModule
|
||||
],
|
||||
__init__: [ 'replaceMenuProvider' ],
|
||||
replaceMenuProvider: [ 'type', require('./ReplaceMenuProvider') ]
|
||||
replaceMenuProvider: [ 'type', ReplaceMenuProvider ]
|
||||
};
|
@ -1,7 +1,13 @@
|
||||
'use strict';
|
||||
|
||||
var getBusinessObject = require('../../../util/ModelUtil').getBusinessObject;
|
||||
var isExpanded = require('../../../util/DiUtil').isExpanded;
|
||||
import {
|
||||
getBusinessObject
|
||||
} from '../../../util/ModelUtil';
|
||||
|
||||
import {
|
||||
isExpanded
|
||||
} from '../../../util/DiUtil';
|
||||
|
||||
|
||||
/**
|
||||
* Returns true, if an element is from a different type
|
||||
@ -12,7 +18,7 @@ var isExpanded = require('../../../util/DiUtil').isExpanded;
|
||||
*
|
||||
* @return {Boolean}
|
||||
*/
|
||||
function isDifferentType(element) {
|
||||
export function isDifferentType(element) {
|
||||
|
||||
return function(entry) {
|
||||
var target = entry.target;
|
||||
@ -38,5 +44,3 @@ function isDifferentType(element) {
|
||||
return !isTypeEqual || !isEventDefinitionEqual || !isTriggeredByEventEqual || !isExpandedEqual;
|
||||
};
|
||||
}
|
||||
|
||||
module.exports.isDifferentType = isDifferentType;
|
@ -1,19 +1,28 @@
|
||||
'use strict';
|
||||
|
||||
var CommandInterceptor = require('diagram-js/lib/command/CommandInterceptor');
|
||||
import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
|
||||
|
||||
var inherits = require('inherits');
|
||||
import inherits from 'inherits';
|
||||
|
||||
var assign = require('min-dash').assign,
|
||||
forEach = require('min-dash').forEach;
|
||||
import {
|
||||
assign,
|
||||
forEach
|
||||
} from 'min-dash';
|
||||
|
||||
var domQuery = require('min-dom').query;
|
||||
import {
|
||||
query as domQuery
|
||||
} from 'min-dom';
|
||||
|
||||
var svgAttr = require('tiny-svg').attr;
|
||||
import {
|
||||
attr as svgAttr
|
||||
} from 'tiny-svg';
|
||||
|
||||
var LOW_PRIORITY = 250;
|
||||
|
||||
function BpmnReplacePreview(eventBus, elementRegistry, elementFactory, canvas, previewSupport) {
|
||||
|
||||
export default function BpmnReplacePreview(
|
||||
eventBus, elementRegistry, elementFactory,
|
||||
canvas, previewSupport) {
|
||||
|
||||
CommandInterceptor.call(this, eventBus);
|
||||
|
||||
@ -106,8 +115,12 @@ function BpmnReplacePreview(eventBus, elementRegistry, elementFactory, canvas, p
|
||||
});
|
||||
}
|
||||
|
||||
BpmnReplacePreview.$inject = [ 'eventBus', 'elementRegistry', 'elementFactory', 'canvas', 'previewSupport' ];
|
||||
BpmnReplacePreview.$inject = [
|
||||
'eventBus',
|
||||
'elementRegistry',
|
||||
'elementFactory',
|
||||
'canvas',
|
||||
'previewSupport'
|
||||
];
|
||||
|
||||
inherits(BpmnReplacePreview, CommandInterceptor);
|
||||
|
||||
module.exports = BpmnReplacePreview;
|
||||
|
@ -1,5 +1,11 @@
|
||||
module.exports = {
|
||||
__depends__: [ require('diagram-js/lib/features/preview-support') ],
|
||||
import PreviewSupportModule from 'diagram-js/lib/features/preview-support';
|
||||
|
||||
import BpmnReplacePreview from './BpmnReplacePreview';
|
||||
|
||||
export default {
|
||||
__depends__: [
|
||||
PreviewSupportModule
|
||||
],
|
||||
__init__: [ 'bpmnReplacePreview' ],
|
||||
bpmnReplacePreview: [ 'type', require('./BpmnReplacePreview') ]
|
||||
bpmnReplacePreview: [ 'type', BpmnReplacePreview ]
|
||||
};
|
||||
|
@ -1,22 +1,33 @@
|
||||
'use strict';
|
||||
|
||||
var pick = require('min-dash').pick,
|
||||
assign = require('min-dash').assign,
|
||||
uniqueBy = require('min-dash').uniqueBy,
|
||||
findIndex = require('min-dash').findIndex,
|
||||
filter = require('min-dash').filter,
|
||||
has = require('min-dash').has;
|
||||
import {
|
||||
pick,
|
||||
assign,
|
||||
uniqueBy,
|
||||
findIndex,
|
||||
filter,
|
||||
has
|
||||
} from 'min-dash';
|
||||
|
||||
var is = require('../../util/ModelUtil').is,
|
||||
isAny = require('../modeling/util/ModelingUtil').isAny,
|
||||
isExpanded = require('../../util/DiUtil').isExpanded,
|
||||
isEventSubProcess = require('../../util/DiUtil').isEventSubProcess,
|
||||
ModelCloneUtils = require('../../util/model/ModelCloneUtils'),
|
||||
getProperties = ModelCloneUtils.getProperties;
|
||||
import {
|
||||
is,
|
||||
} from '../../util/ModelUtil';
|
||||
|
||||
var IGNORED_PROPERTIES = ModelCloneUtils.IGNORED_PROPERTIES;
|
||||
import {
|
||||
isAny
|
||||
} from '../modeling/util/ModelingUtil';
|
||||
|
||||
var ModelCloneHelper = require('../../util/model/ModelCloneHelper');
|
||||
import {
|
||||
isExpanded,
|
||||
isEventSubProcess
|
||||
} from '../../util/DiUtil';
|
||||
|
||||
import {
|
||||
getProperties,
|
||||
IGNORED_PROPERTIES
|
||||
} from '../../util/model/ModelCloneUtils';
|
||||
|
||||
import ModelCloneHelper from '../../util/model/ModelCloneHelper';
|
||||
|
||||
var CUSTOM_PROPERTIES = [
|
||||
'cancelActivity',
|
||||
@ -58,7 +69,9 @@ function toggeling(element, target) {
|
||||
/**
|
||||
* This module takes care of replacing BPMN elements
|
||||
*/
|
||||
function BpmnReplace(bpmnFactory, replace, selection, modeling, eventBus) {
|
||||
export default function BpmnReplace(
|
||||
bpmnFactory, replace, selection,
|
||||
modeling, eventBus) {
|
||||
|
||||
var helper = new ModelCloneHelper(eventBus, bpmnFactory);
|
||||
|
||||
@ -218,8 +231,6 @@ BpmnReplace.$inject = [
|
||||
'eventBus'
|
||||
];
|
||||
|
||||
module.exports = BpmnReplace;
|
||||
|
||||
|
||||
function isSubProcess(bo) {
|
||||
return is(bo, 'bpmn:SubProcess');
|
||||
|
@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
module.exports.START_EVENT = [
|
||||
export var START_EVENT = [
|
||||
{
|
||||
label: 'Start Event',
|
||||
actionName: 'replace-with-none-start',
|
||||
@ -63,7 +63,7 @@ module.exports.START_EVENT = [
|
||||
}
|
||||
];
|
||||
|
||||
module.exports.INTERMEDIATE_EVENT = [
|
||||
export var INTERMEDIATE_EVENT = [
|
||||
{
|
||||
label: 'Start Event',
|
||||
actionName: 'replace-with-none-start',
|
||||
@ -180,7 +180,7 @@ module.exports.INTERMEDIATE_EVENT = [
|
||||
}
|
||||
];
|
||||
|
||||
module.exports.END_EVENT = [
|
||||
export var END_EVENT = [
|
||||
{
|
||||
label: 'Start Event',
|
||||
actionName: 'replace-with-none-start',
|
||||
@ -270,7 +270,7 @@ module.exports.END_EVENT = [
|
||||
}
|
||||
];
|
||||
|
||||
module.exports.GATEWAY = [
|
||||
export var GATEWAY = [
|
||||
{
|
||||
label: 'Exclusive Gateway',
|
||||
actionName: 'replace-with-exclusive-gateway',
|
||||
@ -338,7 +338,7 @@ module.exports.GATEWAY = [
|
||||
// }
|
||||
];
|
||||
|
||||
module.exports.SUBPROCESS_EXPANDED = [
|
||||
export var SUBPROCESS_EXPANDED = [
|
||||
{
|
||||
label: 'Transaction',
|
||||
actionName: 'replace-with-transaction',
|
||||
@ -369,7 +369,7 @@ module.exports.SUBPROCESS_EXPANDED = [
|
||||
}
|
||||
];
|
||||
|
||||
module.exports.TRANSACTION = [
|
||||
export var TRANSACTION = [
|
||||
{
|
||||
label: 'Sub Process',
|
||||
actionName: 'replace-with-subprocess',
|
||||
@ -391,7 +391,7 @@ module.exports.TRANSACTION = [
|
||||
}
|
||||
];
|
||||
|
||||
module.exports.EVENT_SUB_PROCESS = [
|
||||
export var EVENT_SUB_PROCESS = [
|
||||
{
|
||||
label: 'Sub Process',
|
||||
actionName: 'replace-with-subprocess',
|
||||
@ -412,7 +412,7 @@ module.exports.EVENT_SUB_PROCESS = [
|
||||
}
|
||||
];
|
||||
|
||||
module.exports.TASK = [
|
||||
export var TASK = [
|
||||
{
|
||||
label: 'Task',
|
||||
actionName: 'replace-with-task',
|
||||
@ -505,7 +505,7 @@ module.exports.TASK = [
|
||||
}
|
||||
];
|
||||
|
||||
module.exports.BOUNDARY_EVENT = [
|
||||
export var BOUNDARY_EVENT = [
|
||||
{
|
||||
label: 'Message Boundary Event',
|
||||
actionName: 'replace-with-message-boundary',
|
||||
@ -630,7 +630,7 @@ module.exports.BOUNDARY_EVENT = [
|
||||
}
|
||||
];
|
||||
|
||||
module.exports.EVENT_SUB_PROCESS_START_EVENT = [
|
||||
export var EVENT_SUB_PROCESS_START_EVENT = [
|
||||
{
|
||||
label: 'Message Start Event',
|
||||
actionName: 'replace-with-message-start',
|
||||
@ -746,7 +746,7 @@ module.exports.EVENT_SUB_PROCESS_START_EVENT = [
|
||||
}
|
||||
];
|
||||
|
||||
module.exports.SEQUENCE_FLOW = [
|
||||
export var SEQUENCE_FLOW = [
|
||||
{
|
||||
label: 'Sequence Flow',
|
||||
actionName: 'replace-with-sequence-flow',
|
||||
@ -764,7 +764,7 @@ module.exports.SEQUENCE_FLOW = [
|
||||
}
|
||||
];
|
||||
|
||||
module.exports.PARTICIPANT = [
|
||||
export var PARTICIPANT = [
|
||||
{
|
||||
label: 'Expanded Pool',
|
||||
actionName: 'replace-with-expanded-pool',
|
||||
|
@ -1,7 +1,12 @@
|
||||
module.exports = {
|
||||
import SelectionModule from 'diagram-js/lib/features/selection';
|
||||
import ReplaceModule from 'diagram-js/lib/features/replace';
|
||||
|
||||
import BpmnReplace from './BpmnReplace';
|
||||
|
||||
export default {
|
||||
__depends__: [
|
||||
require('diagram-js/lib/features/replace'),
|
||||
require('diagram-js/lib/features/selection')
|
||||
SelectionModule,
|
||||
ReplaceModule
|
||||
],
|
||||
bpmnReplace: [ 'type', require('./BpmnReplace') ]
|
||||
bpmnReplace: [ 'type', BpmnReplace ]
|
||||
};
|
||||
|
@ -1,32 +1,44 @@
|
||||
'use strict';
|
||||
|
||||
var find = require('min-dash').find,
|
||||
some = require('min-dash').some,
|
||||
every = require('min-dash').every,
|
||||
filter = require('min-dash').filter,
|
||||
forEach = require('min-dash').forEach,
|
||||
inherits = require('inherits');
|
||||
import {
|
||||
find,
|
||||
some,
|
||||
every,
|
||||
filter,
|
||||
forEach
|
||||
} from 'min-dash';
|
||||
|
||||
var is = require('../../util/ModelUtil').is,
|
||||
isAny = require('../modeling/util/ModelingUtil').isAny,
|
||||
getBusinessObject = require('../../util/ModelUtil').getBusinessObject,
|
||||
isExpanded = require('../../util/DiUtil').isExpanded,
|
||||
isEventSubProcess = require('../../util/DiUtil').isEventSubProcess,
|
||||
isInterrupting = require('../../util/DiUtil').isInterrupting,
|
||||
hasErrorEventDefinition = require('../../util/DiUtil').hasErrorEventDefinition,
|
||||
hasEscalationEventDefinition = require('../../util/DiUtil').hasEscalationEventDefinition,
|
||||
hasCompensateEventDefinition = require('../../util/DiUtil').hasCompensateEventDefinition;
|
||||
import inherits from 'inherits';
|
||||
|
||||
import {
|
||||
is,
|
||||
getBusinessObject
|
||||
} from '../../util/ModelUtil';
|
||||
|
||||
var RuleProvider = require('diagram-js/lib/features/rules/RuleProvider');
|
||||
import {
|
||||
isAny
|
||||
} from '../modeling/util/ModelingUtil';
|
||||
|
||||
var isBoundaryAttachment = require('../snapping/BpmnSnappingUtil').getBoundaryAttachment;
|
||||
import {
|
||||
isExpanded,
|
||||
isEventSubProcess,
|
||||
isInterrupting,
|
||||
hasErrorEventDefinition,
|
||||
hasEscalationEventDefinition,
|
||||
hasCompensateEventDefinition
|
||||
} from '../../util/DiUtil';
|
||||
|
||||
import RuleProvider from 'diagram-js/lib/features/rules/RuleProvider';
|
||||
|
||||
import {
|
||||
getBoundaryAttachment as isBoundaryAttachment
|
||||
} from '../snapping/BpmnSnappingUtil';
|
||||
|
||||
|
||||
/**
|
||||
* BPMN specific modeling rule
|
||||
*/
|
||||
function BpmnRules(eventBus) {
|
||||
export default function BpmnRules(eventBus) {
|
||||
RuleProvider.call(this, eventBus);
|
||||
}
|
||||
|
||||
@ -34,8 +46,6 @@ inherits(BpmnRules, RuleProvider);
|
||||
|
||||
BpmnRules.$inject = [ 'eventBus' ];
|
||||
|
||||
module.exports = BpmnRules;
|
||||
|
||||
BpmnRules.prototype.init = function() {
|
||||
|
||||
this.addRule('connection.create', function(context) {
|
||||
|
@ -1,7 +1,11 @@
|
||||
module.exports = {
|
||||
import RulesModule from 'diagram-js/lib/features/rules';
|
||||
|
||||
import BpmnRules from './BpmnRules';
|
||||
|
||||
export default {
|
||||
__depends__: [
|
||||
require('diagram-js/lib/features/rules')
|
||||
RulesModule
|
||||
],
|
||||
__init__: [ 'bpmnRules' ],
|
||||
bpmnRules: [ 'type', require('./BpmnRules') ]
|
||||
bpmnRules: [ 'type', BpmnRules ]
|
||||
};
|
||||
|
@ -1,16 +1,20 @@
|
||||
'use strict';
|
||||
|
||||
var map = require('min-dash').map,
|
||||
filter = require('min-dash').filter,
|
||||
sortBy = require('min-dash').sortBy;
|
||||
import {
|
||||
map,
|
||||
filter,
|
||||
sortBy
|
||||
} from 'min-dash';
|
||||
|
||||
var labelUtil = require('../label-editing/LabelUtil');
|
||||
import {
|
||||
getLabel
|
||||
} from '../label-editing/LabelUtil';
|
||||
|
||||
|
||||
/**
|
||||
* Provides ability to search through BPMN elements
|
||||
*/
|
||||
function BpmnSearchProvider(elementRegistry, searchPad, canvas) {
|
||||
export default function BpmnSearchProvider(elementRegistry, searchPad, canvas) {
|
||||
|
||||
this._elementRegistry = elementRegistry;
|
||||
this._canvas = canvas;
|
||||
@ -18,8 +22,6 @@ function BpmnSearchProvider(elementRegistry, searchPad, canvas) {
|
||||
searchPad.registerProvider(this);
|
||||
}
|
||||
|
||||
module.exports = BpmnSearchProvider;
|
||||
|
||||
BpmnSearchProvider.$inject = [
|
||||
'elementRegistry',
|
||||
'searchPad',
|
||||
@ -62,7 +64,7 @@ BpmnSearchProvider.prototype.find = function(pattern) {
|
||||
|
||||
elements = map(elements, function(element) {
|
||||
return {
|
||||
primaryTokens: matchAndSplit(labelUtil.getLabel(element), pattern),
|
||||
primaryTokens: matchAndSplit(getLabel(element), pattern),
|
||||
secondaryTokens: matchAndSplit(element.id, pattern),
|
||||
element: element
|
||||
};
|
||||
@ -74,7 +76,7 @@ BpmnSearchProvider.prototype.find = function(pattern) {
|
||||
});
|
||||
|
||||
elements = sortBy(elements, function(element) {
|
||||
return labelUtil.getLabel(element.element) + element.element.id;
|
||||
return getLabel(element.element) + element.element.id;
|
||||
});
|
||||
|
||||
return elements;
|
||||
|
@ -1,7 +1,12 @@
|
||||
module.exports = {
|
||||
import SearchPadModule from 'diagram-js/lib/features/search-pad';
|
||||
|
||||
import BpmnSearchProvider from './BpmnSearchProvider';
|
||||
|
||||
|
||||
export default {
|
||||
__depends__: [
|
||||
require('diagram-js/lib/features/search-pad')
|
||||
SearchPadModule
|
||||
],
|
||||
__init__: [ 'bpmnSearch'],
|
||||
bpmnSearch: [ 'type', require('./BpmnSearchProvider') ]
|
||||
bpmnSearch: [ 'type', BpmnSearchProvider ]
|
||||
};
|
||||
|
@ -1,33 +1,50 @@
|
||||
'use strict';
|
||||
|
||||
var inherits = require('inherits');
|
||||
import inherits from 'inherits';
|
||||
|
||||
var forEach = require('min-dash').forEach,
|
||||
assign = require('min-dash').assign;
|
||||
import {
|
||||
forEach,
|
||||
assign
|
||||
} from 'min-dash';
|
||||
|
||||
var getBoundingBox = require('diagram-js/lib/util/Elements').getBBox;
|
||||
import {
|
||||
getBBox as getBoundingBox
|
||||
} from 'diagram-js/lib/util/Elements';
|
||||
|
||||
var is = require('../../util/ModelUtil').is,
|
||||
isAny = require('../modeling/util/ModelingUtil').isAny,
|
||||
isExpanded = require('../../util/DiUtil').isExpanded;
|
||||
import { is } from '../../util/ModelUtil';
|
||||
|
||||
var Snapping = require('diagram-js/lib/features/snapping/Snapping'),
|
||||
SnapUtil = require('diagram-js/lib/features/snapping/SnapUtil');
|
||||
import { isAny } from '../modeling/util/ModelingUtil';
|
||||
|
||||
var asTRBL = require('diagram-js/lib/layout/LayoutUtil').asTRBL;
|
||||
import {
|
||||
isExpanded
|
||||
} from '../../util/DiUtil';
|
||||
|
||||
import Snapping from 'diagram-js/lib/features/snapping/Snapping';
|
||||
|
||||
import {
|
||||
mid,
|
||||
topLeft,
|
||||
bottomRight,
|
||||
isSnapped,
|
||||
setSnapped
|
||||
} from 'diagram-js/lib/features/snapping/SnapUtil';
|
||||
|
||||
import {
|
||||
asTRBL
|
||||
} from 'diagram-js/lib/layout/LayoutUtil';
|
||||
|
||||
|
||||
import {
|
||||
getBoundaryAttachment,
|
||||
getParticipantSizeConstraints
|
||||
} from './BpmnSnappingUtil';
|
||||
|
||||
import {
|
||||
getLanesRoot
|
||||
} from '../modeling/util/LaneUtil';
|
||||
|
||||
var round = Math.round;
|
||||
|
||||
var mid = SnapUtil.mid,
|
||||
topLeft = SnapUtil.topLeft,
|
||||
bottomRight = SnapUtil.bottomRight,
|
||||
isSnapped = SnapUtil.isSnapped,
|
||||
setSnapped = SnapUtil.setSnapped;
|
||||
|
||||
var getBoundaryAttachment = require('./BpmnSnappingUtil').getBoundaryAttachment,
|
||||
getParticipantSizeConstraints = require('./BpmnSnappingUtil').getParticipantSizeConstraints,
|
||||
getLanesRoot = require('../modeling/util/LaneUtil').getLanesRoot;
|
||||
|
||||
var HIGH_PRIORITY = 1500;
|
||||
|
||||
|
||||
@ -40,7 +57,7 @@ var HIGH_PRIORITY = 1500;
|
||||
* @param {EventBus} eventBus
|
||||
* @param {Canvas} canvas
|
||||
*/
|
||||
function BpmnSnapping(eventBus, canvas, bpmnRules, elementRegistry) {
|
||||
export default function BpmnSnapping(eventBus, canvas, bpmnRules, elementRegistry) {
|
||||
|
||||
// instantiate super
|
||||
Snapping.call(this, eventBus, canvas);
|
||||
@ -204,8 +221,6 @@ BpmnSnapping.$inject = [
|
||||
'elementRegistry'
|
||||
];
|
||||
|
||||
module.exports = BpmnSnapping;
|
||||
|
||||
|
||||
BpmnSnapping.prototype.initSnap = function(event) {
|
||||
|
||||
|
@ -1,9 +1,11 @@
|
||||
'use strict';
|
||||
|
||||
var getOrientation = require('diagram-js/lib/layout/LayoutUtil').getOrientation;
|
||||
import {
|
||||
getOrientation
|
||||
} from 'diagram-js/lib/layout/LayoutUtil';
|
||||
|
||||
|
||||
function getBoundaryAttachment(position, targetBounds) {
|
||||
export function getBoundaryAttachment(position, targetBounds) {
|
||||
|
||||
var orientation = getOrientation(position, targetBounds, -15);
|
||||
|
||||
@ -14,18 +16,19 @@ function getBoundaryAttachment(position, targetBounds) {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.getBoundaryAttachment = getBoundaryAttachment;
|
||||
|
||||
|
||||
|
||||
// participant snapping box implementation //////////////////////
|
||||
|
||||
var is = require('../../util/ModelUtil').is;
|
||||
import { is } from '../../util/ModelUtil';
|
||||
|
||||
var asTRBL = require('diagram-js/lib/layout/LayoutUtil').asTRBL;
|
||||
import {
|
||||
asTRBL
|
||||
} from 'diagram-js/lib/layout/LayoutUtil';
|
||||
|
||||
var collectLanes = require('../modeling/util/LaneUtil').collectLanes,
|
||||
getLanesRoot = require('../modeling/util/LaneUtil').getLanesRoot;
|
||||
import {
|
||||
collectLanes,
|
||||
getLanesRoot
|
||||
} from '../modeling/util/LaneUtil';
|
||||
|
||||
var abs = Math.abs,
|
||||
min = Math.min,
|
||||
@ -59,7 +62,7 @@ var LANE_MIN_HEIGHT = 60,
|
||||
LANE_BOTTOM_PADDING = 20;
|
||||
|
||||
|
||||
function getParticipantSizeConstraints(laneShape, resizeDirection, balanced) {
|
||||
export function getParticipantSizeConstraints(laneShape, resizeDirection, balanced) {
|
||||
|
||||
var lanesRoot = getLanesRoot(laneShape);
|
||||
|
||||
@ -155,6 +158,3 @@ function getParticipantSizeConstraints(laneShape, resizeDirection, balanced) {
|
||||
max: maxTrbl
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
module.exports.getParticipantSizeConstraints = getParticipantSizeConstraints;
|
@ -1,4 +1,6 @@
|
||||
module.exports = {
|
||||
import BpmnSnapping from './BpmnSnapping';
|
||||
|
||||
export default {
|
||||
__init__: [ 'snapping' ],
|
||||
snapping: [ 'type', require('./BpmnSnapping') ]
|
||||
snapping: [ 'type', BpmnSnapping ]
|
||||
};
|
@ -1,18 +1,26 @@
|
||||
'use strict';
|
||||
|
||||
var assign = require('min-dash').assign,
|
||||
map = require('min-dash').map;
|
||||
import {
|
||||
assign,
|
||||
map
|
||||
} from 'min-dash';
|
||||
|
||||
var LabelUtil = require('../util/LabelUtil');
|
||||
import TextUtil from 'diagram-js/lib/util/Text';
|
||||
|
||||
var TextUtil = require('diagram-js/lib/util/Text');
|
||||
import { is } from '../util/ModelUtil';
|
||||
|
||||
var is = require('../util/ModelUtil').is;
|
||||
import {
|
||||
hasExternalLabel,
|
||||
getExternalLabelBounds
|
||||
} from '../util/LabelUtil';
|
||||
|
||||
var hasExternalLabel = LabelUtil.hasExternalLabel,
|
||||
getExternalLabelBounds = LabelUtil.getExternalLabelBounds,
|
||||
isExpanded = require('../util/DiUtil').isExpanded,
|
||||
elementToString = require('./Util').elementToString;
|
||||
import {
|
||||
isExpanded
|
||||
} from '../util/DiUtil';
|
||||
|
||||
import {
|
||||
elementToString
|
||||
} from './Util';
|
||||
|
||||
|
||||
function elementData(semantic, attrs) {
|
||||
@ -45,8 +53,12 @@ function notYetDrawn(translate, semantic, refSemantic, property) {
|
||||
* @param {Canvas} canvas
|
||||
* @param {ElementFactory} elementFactory
|
||||
* @param {ElementRegistry} elementRegistry
|
||||
* @param {Function} translate
|
||||
*/
|
||||
function BpmnImporter(eventBus, canvas, elementFactory, elementRegistry, translate) {
|
||||
export default function BpmnImporter(
|
||||
eventBus, canvas, elementFactory,
|
||||
elementRegistry, translate) {
|
||||
|
||||
this._eventBus = eventBus;
|
||||
this._canvas = canvas;
|
||||
|
||||
@ -57,9 +69,13 @@ function BpmnImporter(eventBus, canvas, elementFactory, elementRegistry, transla
|
||||
this._textUtil = new TextUtil();
|
||||
}
|
||||
|
||||
BpmnImporter.$inject = [ 'eventBus', 'canvas', 'elementFactory', 'elementRegistry', 'translate' ];
|
||||
|
||||
module.exports = BpmnImporter;
|
||||
BpmnImporter.$inject = [
|
||||
'eventBus',
|
||||
'canvas',
|
||||
'elementFactory',
|
||||
'elementRegistry',
|
||||
'translate'
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
|
@ -1,12 +1,16 @@
|
||||
'use strict';
|
||||
|
||||
var filter = require('min-dash').filter,
|
||||
find = require('min-dash').find,
|
||||
forEach = require('min-dash').forEach;
|
||||
import {
|
||||
filter,
|
||||
find,
|
||||
forEach
|
||||
} from 'min-dash';
|
||||
|
||||
var Refs = require('object-refs');
|
||||
import Refs from 'object-refs';
|
||||
|
||||
var elementToString = require('./Util').elementToString;
|
||||
import {
|
||||
elementToString
|
||||
} from './Util';
|
||||
|
||||
var diRefs = new Refs({ name: 'bpmnElement', enumerable: true }, { name: 'di' });
|
||||
|
||||
@ -34,7 +38,7 @@ function findDisplayCandidate(definitions) {
|
||||
}
|
||||
|
||||
|
||||
function BpmnTreeWalker(handler, translate) {
|
||||
export default function BpmnTreeWalker(handler, translate) {
|
||||
|
||||
// list of containers already walked
|
||||
var handledElements = {};
|
||||
@ -454,5 +458,3 @@ function BpmnTreeWalker(handler, translate) {
|
||||
handleDefinitions: handleDefinitions
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = BpmnTreeWalker;
|
@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
var BpmnTreeWalker = require('./BpmnTreeWalker');
|
||||
import BpmnTreeWalker from './BpmnTreeWalker';
|
||||
|
||||
|
||||
/**
|
||||
@ -12,7 +12,7 @@ var BpmnTreeWalker = require('./BpmnTreeWalker');
|
||||
* @param {ModdleElement} definitions
|
||||
* @param {Function} done the callback, invoked with (err, [ warning ]) once the import is done
|
||||
*/
|
||||
function importBpmnDiagram(diagram, definitions, done) {
|
||||
export function importBpmnDiagram(diagram, definitions, done) {
|
||||
|
||||
var importer,
|
||||
eventBus,
|
||||
@ -70,5 +70,3 @@ function importBpmnDiagram(diagram, definitions, done) {
|
||||
|
||||
done(error, warnings);
|
||||
}
|
||||
|
||||
module.exports.importBpmnDiagram = importBpmnDiagram;
|
@ -1,9 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
module.exports.elementToString = function(e) {
|
||||
export function elementToString(e) {
|
||||
if (!e) {
|
||||
return '<null>';
|
||||
}
|
||||
|
||||
return '<' + e.$type + (e.id ? ' id="' + e.id : '') + '" />';
|
||||
};
|
||||
}
|
@ -1,6 +1,10 @@
|
||||
module.exports = {
|
||||
import translate from 'diagram-js/lib/i18n/translate';
|
||||
|
||||
import BpmnImporter from './BpmnImporter';
|
||||
|
||||
export default {
|
||||
__depends__: [
|
||||
require('diagram-js/lib/i18n/translate')
|
||||
translate
|
||||
],
|
||||
bpmnImporter: [ 'type', require('./BpmnImporter') ]
|
||||
bpmnImporter: [ 'type', BpmnImporter ]
|
||||
};
|
@ -1,11 +1,16 @@
|
||||
'use strict';
|
||||
|
||||
var is = require('./ModelUtil').is,
|
||||
getBusinessObject = require('./ModelUtil').getBusinessObject;
|
||||
import {
|
||||
is,
|
||||
getBusinessObject
|
||||
} from './ModelUtil';
|
||||
|
||||
var forEach = require('min-dash').forEach;
|
||||
import {
|
||||
forEach
|
||||
} from 'min-dash';
|
||||
|
||||
module.exports.isExpanded = function(element) {
|
||||
|
||||
export function isExpanded(element) {
|
||||
|
||||
if (is(element, 'bpmn:CallActivity')) {
|
||||
return false;
|
||||
@ -20,17 +25,17 @@ module.exports.isExpanded = function(element) {
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
module.exports.isInterrupting = function(element) {
|
||||
export function isInterrupting(element) {
|
||||
return element && getBusinessObject(element).isInterrupting !== false;
|
||||
};
|
||||
}
|
||||
|
||||
module.exports.isEventSubProcess = function(element) {
|
||||
export function isEventSubProcess(element) {
|
||||
return element && !!getBusinessObject(element).triggeredByEvent;
|
||||
};
|
||||
}
|
||||
|
||||
function hasEventDefinition(element, eventType) {
|
||||
export function hasEventDefinition(element, eventType) {
|
||||
var bo = getBusinessObject(element),
|
||||
hasEventDefinition = false;
|
||||
|
||||
@ -45,16 +50,14 @@ function hasEventDefinition(element, eventType) {
|
||||
return hasEventDefinition;
|
||||
}
|
||||
|
||||
module.exports.hasEventDefinition = hasEventDefinition;
|
||||
|
||||
module.exports.hasErrorEventDefinition = function(element) {
|
||||
export function hasErrorEventDefinition(element) {
|
||||
return hasEventDefinition(element, 'bpmn:ErrorEventDefinition');
|
||||
};
|
||||
}
|
||||
|
||||
module.exports.hasEscalationEventDefinition = function(element) {
|
||||
export function hasEscalationEventDefinition(element) {
|
||||
return hasEventDefinition(element, 'bpmn:EscalationEventDefinition');
|
||||
};
|
||||
}
|
||||
|
||||
module.exports.hasCompensateEventDefinition = function(element) {
|
||||
export function hasCompensateEventDefinition(element) {
|
||||
return hasEventDefinition(element, 'bpmn:CompensateEventDefinition');
|
||||
};
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user