bpmn-js 17.9.2 → 17.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/README.md +2 -0
  2. package/dist/assets/diagram-js.css +51 -46
  3. package/dist/bpmn-modeler.development.js +611 -273
  4. package/dist/bpmn-modeler.production.min.js +37 -37
  5. package/dist/bpmn-navigated-viewer.development.js +43 -21
  6. package/dist/bpmn-navigated-viewer.production.min.js +2 -2
  7. package/dist/bpmn-viewer.development.js +43 -21
  8. package/dist/bpmn-viewer.production.min.js +2 -2
  9. package/lib/draw/BpmnRenderer.d.ts +8 -6
  10. package/lib/draw/BpmnRenderer.js +19 -17
  11. package/lib/features/align-elements/AlignElementsContextPadProvider.d.ts +1 -1
  12. package/lib/features/align-elements/AlignElementsContextPadProvider.js +1 -1
  13. package/lib/features/append-preview/AppendPreview.d.ts +2 -2
  14. package/lib/features/append-preview/AppendPreview.js +2 -2
  15. package/lib/features/auto-place/BpmnAutoPlace.d.ts +3 -1
  16. package/lib/features/auto-place/BpmnAutoPlace.js +5 -3
  17. package/lib/features/auto-place/BpmnAutoPlaceUtil.d.ts +9 -4
  18. package/lib/features/auto-place/BpmnAutoPlaceUtil.js +14 -13
  19. package/lib/features/context-pad/ContextPadProvider.d.ts +3 -14
  20. package/lib/features/context-pad/ContextPadProvider.js +3 -1
  21. package/lib/features/grid-snapping/behavior/GridSnappingAutoPlaceBehavior.d.ts +3 -1
  22. package/lib/features/grid-snapping/behavior/GridSnappingAutoPlaceBehavior.js +6 -3
  23. package/lib/features/label-editing/LabelEditingPreview.js +2 -1
  24. package/lib/features/modeling/BpmnLayouter.d.ts +13 -9
  25. package/lib/features/modeling/BpmnLayouter.js +10 -3
  26. package/lib/features/modeling/Modeling.d.ts +1 -1
  27. package/lib/features/modeling/Modeling.js +1 -1
  28. package/lib/features/modeling/behavior/ResizeBehavior.js +25 -19
  29. package/lib/features/modeling/behavior/SetCompensationActivityAfterPasteBehavior.d.ts +16 -0
  30. package/lib/features/modeling/behavior/SetCompensationActivityAfterPasteBehavior.js +67 -0
  31. package/lib/features/modeling/behavior/index.js +5 -2
  32. package/lib/features/modeling/util/ModelingUtil.d.ts +3 -1
  33. package/lib/features/modeling/util/ModelingUtil.js +38 -4
  34. package/lib/features/outline/OutlineProvider.d.ts +5 -0
  35. package/lib/features/outline/OutlineProvider.js +10 -0
  36. package/lib/features/outline/OutlineUtil.d.ts +5 -0
  37. package/lib/features/outline/OutlineUtil.js +4 -0
  38. package/lib/features/search/BpmnSearchProvider.js +114 -47
  39. package/package.json +4 -4
@@ -69,32 +69,32 @@ export default class BpmnRenderer extends BaseRenderer {
69
69
  * Draw shape into parentGfx.
70
70
  *
71
71
  * @param parentGfx
72
- * @param element
72
+ * @param shape
73
73
  * @param attrs
74
74
  *
75
75
  * @return mainGfx
76
76
  */
77
- drawShape(parentGfx: SVGElement, element: Element, attrs?: Attrs): SVGElement;
77
+ drawShape(parentGfx: SVGElement, shape: Shape, attrs?: Attrs): SVGElement;
78
78
 
79
79
  /**
80
80
  * Draw connection into parentGfx.
81
81
  *
82
82
  * @param parentGfx
83
- * @param element
83
+ * @param connection
84
84
  * @param attrs
85
85
  *
86
86
  * @return mainGfx
87
87
  */
88
- drawConnection(parentGfx: SVGElement, element: Element, attrs?: Attrs): SVGElement;
88
+ drawConnection(parentGfx: SVGElement, connection: Connection, attrs?: Attrs): SVGElement;
89
89
 
90
90
  /**
91
91
  * Get shape path.
92
92
  *
93
- * @param element
93
+ * @param shape
94
94
  *
95
95
  * @return path
96
96
  */
97
- getShapePath(element: Element): string;
97
+ getShapePath(shape: Shape): string;
98
98
  }
99
99
 
100
100
  export type BpmnRendererConfig = Partial<{
@@ -111,4 +111,6 @@ export type Attrs = Partial<{
111
111
  }>;
112
112
 
113
113
  type Element = import('../model/Types').Element;
114
+ type Shape = import('../model/Types').Shape;
115
+ type Connection = import('../model/Types').Connection;
114
116
  import BaseRenderer from 'diagram-js/lib/draw/BaseRenderer';
@@ -93,6 +93,8 @@ var DEFAULT_OPACITY = 0.95,
93
93
 
94
94
  /**
95
95
  * @typedef { import('../model/Types').Element } Element
96
+ * @typedef { import('../model/Types').Shape } Shape
97
+ * @typedef { import('../model/Types').Connection } Connection
96
98
  */
97
99
 
98
100
  /**
@@ -2266,57 +2268,57 @@ BpmnRenderer.prototype.canRender = function(element) {
2266
2268
  * Draw shape into parentGfx.
2267
2269
  *
2268
2270
  * @param {SVGElement} parentGfx
2269
- * @param {Element} element
2271
+ * @param {Shape} shape
2270
2272
  * @param {Attrs} [attrs]
2271
2273
  *
2272
2274
  * @return {SVGElement} mainGfx
2273
2275
  */
2274
- BpmnRenderer.prototype.drawShape = function(parentGfx, element, attrs = {}) {
2275
- var { type } = element;
2276
+ BpmnRenderer.prototype.drawShape = function(parentGfx, shape, attrs = {}) {
2277
+ var { type } = shape;
2276
2278
 
2277
2279
  var handler = this._renderer(type);
2278
2280
 
2279
- return handler(parentGfx, element, attrs);
2281
+ return handler(parentGfx, shape, attrs);
2280
2282
  };
2281
2283
 
2282
2284
  /**
2283
2285
  * Draw connection into parentGfx.
2284
2286
  *
2285
2287
  * @param {SVGElement} parentGfx
2286
- * @param {Element} element
2288
+ * @param {Connection} connection
2287
2289
  * @param {Attrs} [attrs]
2288
2290
  *
2289
2291
  * @return {SVGElement} mainGfx
2290
2292
  */
2291
- BpmnRenderer.prototype.drawConnection = function(parentGfx, element, attrs = {}) {
2292
- var { type } = element;
2293
+ BpmnRenderer.prototype.drawConnection = function(parentGfx, connection, attrs = {}) {
2294
+ var { type } = connection;
2293
2295
 
2294
2296
  var handler = this._renderer(type);
2295
2297
 
2296
- return handler(parentGfx, element, attrs);
2298
+ return handler(parentGfx, connection, attrs);
2297
2299
  };
2298
2300
 
2299
2301
  /**
2300
2302
  * Get shape path.
2301
2303
  *
2302
- * @param {Element} element
2304
+ * @param {Shape} shape
2303
2305
  *
2304
2306
  * @return {string} path
2305
2307
  */
2306
- BpmnRenderer.prototype.getShapePath = function(element) {
2307
- if (is(element, 'bpmn:Event')) {
2308
- return getCirclePath(element);
2308
+ BpmnRenderer.prototype.getShapePath = function(shape) {
2309
+ if (is(shape, 'bpmn:Event')) {
2310
+ return getCirclePath(shape);
2309
2311
  }
2310
2312
 
2311
- if (is(element, 'bpmn:Activity')) {
2312
- return getRoundRectPath(element, TASK_BORDER_RADIUS);
2313
+ if (is(shape, 'bpmn:Activity')) {
2314
+ return getRoundRectPath(shape, TASK_BORDER_RADIUS);
2313
2315
  }
2314
2316
 
2315
- if (is(element, 'bpmn:Gateway')) {
2316
- return getDiamondPath(element);
2317
+ if (is(shape, 'bpmn:Gateway')) {
2318
+ return getDiamondPath(shape);
2317
2319
  }
2318
2320
 
2319
- return getRectPath(element);
2321
+ return getRectPath(shape);
2320
2322
  };
2321
2323
 
2322
2324
  /**
@@ -29,4 +29,4 @@ type PopupMenu = import('diagram-js/lib/features/popup-menu/PopupMenu').default;
29
29
  export type Translate = typeof import("diagram-js/lib/i18n/translate/translate").default;
30
30
  type Element = import('../../model/Types').Element;
31
31
  type ContextPadEntries = import('diagram-js/lib/features/context-pad/ContextPad').ContextPadEntries;
32
- type ContextPadProvider = import('diagram-js/lib/features/context-pad/ContextPadProvider').default;
32
+ type ContextPadProvider = import('diagram-js/lib/features/context-pad/ContextPadProvider').default<Element>;
@@ -12,7 +12,7 @@ import ICONS from './AlignElementsIcons';
12
12
  *
13
13
  * @typedef {import('../../model/Types').Element} Element
14
14
  * @typedef {import('diagram-js/lib/features/context-pad/ContextPad').ContextPadEntries} ContextPadEntries
15
- * @typedef {import('diagram-js/lib/features/context-pad/ContextPadProvider').default} ContextPadProvider
15
+ * @typedef {import('diagram-js/lib/features/context-pad/ContextPadProvider').default<Element>} ContextPadProvider
16
16
  */
17
17
 
18
18
  var LOW_PRIORITY = 900;
@@ -13,7 +13,7 @@ export default class AppendPreview {
13
13
  * @param layouter
14
14
  * @param rules
15
15
  */
16
- constructor(complexPreview: ComplexPreview, connectionDocking: ConnectionDocking, elementFactory: ElementFactory, eventBus: EventBus, layouter: any, rules: Rules);
16
+ constructor(complexPreview: ComplexPreview, connectionDocking: ConnectionDocking, elementFactory: ElementFactory, eventBus: EventBus, layouter: BpmnLayouter, rules: Rules);
17
17
 
18
18
  /**
19
19
  * Create a preview of appending a shape of the given type to the given source.
@@ -31,6 +31,6 @@ type ComplexPreview = import('diagram-js/lib/features/complex-preview/ComplexPre
31
31
  type ConnectionDocking = import('diagram-js/lib/layout/ConnectionDocking').default;
32
32
  type ElementFactory = import('../modeling/ElementFactory').default;
33
33
  type EventBus = import('diagram-js/lib/core/EventBus').default;
34
- type ManhattanLayout = import('diagram-js/lib/layout/ManhattanLayout').default;
34
+ type BpmnLayouter = import('../modeling/BpmnLayouter').default;
35
35
  type Rules = import('diagram-js/lib/features/rules/Rules').default;
36
36
  type Shape = import('../../model/Types').Shape;
@@ -10,7 +10,7 @@ const round = Math.round;
10
10
  * @typedef {import('diagram-js/lib/layout/ConnectionDocking').default} ConnectionDocking
11
11
  * @typedef {import('../modeling/ElementFactory').default} ElementFactory
12
12
  * @typedef {import('diagram-js/lib/core/EventBus').default} EventBus
13
- * @typedef {import('diagram-js/lib/layout/ManhattanLayout').default} ManhattanLayout
13
+ * @typedef {import('../modeling/BpmnLayouter').default} BpmnLayouter
14
14
  * @typedef {import('diagram-js/lib/features/rules/Rules').default} Rules
15
15
  *
16
16
  * @typedef {import('../../model/Types').Shape} Shape
@@ -23,7 +23,7 @@ const round = Math.round;
23
23
  * @param {ConnectionDocking} connectionDocking
24
24
  * @param {ElementFactory} elementFactory
25
25
  * @param {EventBus} eventBus
26
- * @param {ManhattanLayout} layouter
26
+ * @param {BpmnLayouter} layouter
27
27
  * @param {Rules} rules
28
28
  */
29
29
  export default function AppendPreview(complexPreview, connectionDocking, elementFactory, eventBus, layouter, rules) {
@@ -6,8 +6,10 @@ export default class AutoPlace {
6
6
  static $inject: string[];
7
7
  /**
8
8
  * @param eventBus
9
+ * @param elementRegistry
9
10
  */
10
- constructor(eventBus: EventBus);
11
+ constructor(eventBus: EventBus, elementRegistry: ElementRegistry);
11
12
  }
12
13
 
13
14
  type EventBus = import('diagram-js/lib/core/EventBus').default;
15
+ type ElementRegistry = import('diagram-js/lib/core/ElementRegistry').default;
@@ -2,20 +2,22 @@ import { getNewShapePosition } from './BpmnAutoPlaceUtil';
2
2
 
3
3
  /**
4
4
  * @typedef {import('diagram-js/lib/core/EventBus').default} EventBus
5
+ * @typedef {import('diagram-js/lib/core/ElementRegistry').default} ElementRegistry
5
6
  */
6
7
 
7
8
  /**
8
9
  * BPMN auto-place behavior.
9
10
  *
10
11
  * @param {EventBus} eventBus
12
+ * @param {ElementRegistry} elementRegistry
11
13
  */
12
- export default function AutoPlace(eventBus) {
14
+ export default function AutoPlace(eventBus, elementRegistry) {
13
15
  eventBus.on('autoPlace', function(context) {
14
16
  var shape = context.shape,
15
17
  source = context.source;
16
18
 
17
- return getNewShapePosition(source, shape);
19
+ return getNewShapePosition(source, shape, elementRegistry);
18
20
  });
19
21
  }
20
22
 
21
- AutoPlace.$inject = [ 'eventBus' ];
23
+ AutoPlace.$inject = [ 'eventBus', 'elementRegistry' ];
@@ -4,10 +4,11 @@
4
4
  *
5
5
  * @param source
6
6
  * @param element
7
+ * @param elementRegistry
7
8
  *
8
9
  * @return
9
10
  */
10
- export function getNewShapePosition(source: Shape, element: Shape): Point;
11
+ export function getNewShapePosition(source: Shape, element: Shape, elementRegistry: ElementRegistry): Point;
11
12
 
12
13
  /**
13
14
  * Get the position for given new flow node. Try placing the flow node right/bottom of
@@ -15,10 +16,11 @@ export function getNewShapePosition(source: Shape, element: Shape): Point;
15
16
  *
16
17
  * @param source
17
18
  * @param element
19
+ * @param placeHorizontally Whether to place the new element horizontally
18
20
  *
19
21
  * @return
20
22
  */
21
- export function getFlowNodePosition(source: Shape, element: Shape): Point;
23
+ export function getFlowNodePosition(source: Shape, element: Shape, placeHorizontally: boolean): Point;
22
24
 
23
25
  /**
24
26
  * Get the position for given text annotation. Try placing the text annotation
@@ -26,10 +28,11 @@ export function getFlowNodePosition(source: Shape, element: Shape): Point;
26
28
  *
27
29
  * @param source
28
30
  * @param element
31
+ * @param placeHorizontally Whether to place the new element horizontally
29
32
  *
30
33
  * @return
31
34
  */
32
- export function getTextAnnotationPosition(source: Shape, element: Shape): Point;
35
+ export function getTextAnnotationPosition(source: Shape, element: Shape, placeHorizontally: boolean): Point;
33
36
 
34
37
  /**
35
38
  * Get the position for given new data element. Try placing the data element
@@ -37,11 +40,13 @@ export function getTextAnnotationPosition(source: Shape, element: Shape): Point;
37
40
  *
38
41
  * @param source
39
42
  * @param element
43
+ * @param placeHorizontally Whether to place the new element horizontally
40
44
  *
41
45
  * @return
42
46
  */
43
- export function getDataElementPosition(source: Shape, element: Shape): Point;
47
+ export function getDataElementPosition(source: Shape, element: Shape, placeHorizontally: boolean): Point;
44
48
 
45
49
  type Shape = import('../../model/Types').Shape;
50
+ type ElementRegistry = import('diagram-js/lib/core/ElementRegistry').default;
46
51
  type Point = import('diagram-js/lib/util/Types').Point;
47
52
  type DirectionTRBL = import('diagram-js/lib/util/Types').DirectionTRBL;
@@ -22,6 +22,7 @@ import { isConnection } from 'diagram-js/lib/util/ModelUtil';
22
22
  /**
23
23
  * @typedef {import('../../model/Types').Shape} Shape
24
24
  *
25
+ * @typedef {import('diagram-js/lib/core/ElementRegistry').default} ElementRegistry
25
26
  * @typedef {import('diagram-js/lib/util/Types').Point} Point
26
27
  * @typedef {import('diagram-js/lib/util/Types').DirectionTRBL} DirectionTRBL
27
28
  */
@@ -32,21 +33,24 @@ import { isConnection } from 'diagram-js/lib/util/ModelUtil';
32
33
  *
33
34
  * @param {Shape} source
34
35
  * @param {Shape} element
36
+ * @param {ElementRegistry} elementRegistry
35
37
  *
36
38
  * @return {Point}
37
39
  */
38
- export function getNewShapePosition(source, element) {
40
+ export function getNewShapePosition(source, element, elementRegistry) {
41
+
42
+ var placeHorizontally = isDirectionHorizontal(source, elementRegistry);
39
43
 
40
44
  if (is(element, 'bpmn:TextAnnotation')) {
41
- return getTextAnnotationPosition(source, element);
45
+ return getTextAnnotationPosition(source, element, placeHorizontally);
42
46
  }
43
47
 
44
48
  if (isAny(element, [ 'bpmn:DataObjectReference', 'bpmn:DataStoreReference' ])) {
45
- return getDataElementPosition(source, element);
49
+ return getDataElementPosition(source, element, placeHorizontally);
46
50
  }
47
51
 
48
52
  if (is(element, 'bpmn:FlowNode')) {
49
- return getFlowNodePosition(source, element);
53
+ return getFlowNodePosition(source, element, placeHorizontally);
50
54
  }
51
55
  }
52
56
 
@@ -56,16 +60,15 @@ export function getNewShapePosition(source, element) {
56
60
  *
57
61
  * @param {Shape} source
58
62
  * @param {Shape} element
63
+ * @param {boolean} placeHorizontally Whether to place the new element horizontally
59
64
  *
60
65
  * @return {Point}
61
66
  */
62
- export function getFlowNodePosition(source, element) {
67
+ export function getFlowNodePosition(source, element, placeHorizontally) {
63
68
 
64
69
  var sourceTrbl = asTRBL(source);
65
70
  var sourceMid = getMid(source);
66
71
 
67
- var placeHorizontally = isDirectionHorizontal(source);
68
-
69
72
  var placement = placeHorizontally ? {
70
73
  directionHint: 'e',
71
74
  minDistance: 80,
@@ -147,15 +150,14 @@ function getDistance(orientation, minDistance, placement) {
147
150
  *
148
151
  * @param {Shape} source
149
152
  * @param {Shape} element
153
+ * @param {boolean} placeHorizontally Whether to place the new element horizontally
150
154
  *
151
155
  * @return {Point}
152
156
  */
153
- export function getTextAnnotationPosition(source, element) {
157
+ export function getTextAnnotationPosition(source, element, placeHorizontally) {
154
158
 
155
159
  var sourceTrbl = asTRBL(source);
156
160
 
157
- var placeHorizontally = isDirectionHorizontal(source);
158
-
159
161
  var position = placeHorizontally ? {
160
162
  x: sourceTrbl.right + element.width / 2,
161
163
  y: sourceTrbl.top - 50 - element.height / 2
@@ -195,15 +197,14 @@ export function getTextAnnotationPosition(source, element) {
195
197
  *
196
198
  * @param {Shape} source
197
199
  * @param {Shape} element
200
+ * @param {boolean} placeHorizontally Whether to place the new element horizontally
198
201
  *
199
202
  * @return {Point}
200
203
  */
201
- export function getDataElementPosition(source, element) {
204
+ export function getDataElementPosition(source, element, placeHorizontally) {
202
205
 
203
206
  var sourceTrbl = asTRBL(source);
204
207
 
205
- var placeHorizontally = isDirectionHorizontal(source);
206
-
207
208
  var position = placeHorizontally ? {
208
209
  x: sourceTrbl.right - 10 + element.width / 2,
209
210
  y: sourceTrbl.bottom + 40 + element.width / 2
@@ -20,21 +20,9 @@ export default class ContextPadProvider implements BaseContextPadProvider {
20
20
  * @param canvas
21
21
  * @param rules
22
22
  * @param translate
23
+ * @param appendPreview
23
24
  */
24
- constructor(
25
- config: ContextPadConfig,
26
- injector: Injector,
27
- eventBus: EventBus,
28
- contextPad: ContextPad,
29
- modeling: Modeling,
30
- elementFactory: ElementFactory,
31
- connect: Connect,
32
- create: Create,
33
- popupMenu: PopupMenu,
34
- canvas: any,
35
- rules: Rules,
36
- translate: Translate
37
- );
25
+ constructor(config: ContextPadConfig, injector: Injector, eventBus: EventBus, contextPad: ContextPad, modeling: Modeling, elementFactory: ElementFactory, connect: Connect, create: Create, popupMenu: PopupMenu, canvas: any, rules: Rules, translate: Translate, appendPreview: AppendPreview);
38
26
 
39
27
  /**
40
28
  * @param elements
@@ -56,6 +44,7 @@ type EventBus = import('diagram-js/lib/core/EventBus').default;
56
44
  type ContextPad = import('diagram-js/lib/features/context-pad/ContextPad').default;
57
45
  type Modeling = import('../modeling/Modeling').default;
58
46
  type ElementFactory = import('../modeling/ElementFactory').default;
47
+ type AppendPreview = import('../append-preview/AppendPreview').default;
59
48
  type Connect = import('diagram-js/lib/features/connect/Connect').default;
60
49
  type Create = import('diagram-js/lib/features/create/Create').default;
61
50
  type PopupMenu = import('diagram-js/lib/features/popup-menu/PopupMenu').default;
@@ -33,6 +33,7 @@ import {
33
33
  * @typedef {import('diagram-js/lib/features/context-pad/ContextPad').default} ContextPad
34
34
  * @typedef {import('../modeling/Modeling').default} Modeling
35
35
  * @typedef {import('../modeling/ElementFactory').default} ElementFactory
36
+ * @typedef {import('../append-preview/AppendPreview').default} AppendPreview
36
37
  * @typedef {import('diagram-js/lib/features/connect/Connect').default} Connect
37
38
  * @typedef {import('diagram-js/lib/features/create/Create').default} Create
38
39
  * @typedef {import('diagram-js/lib/features/popup-menu/PopupMenu').default} PopupMenu
@@ -67,6 +68,7 @@ import {
67
68
  * @param {Canvas} canvas
68
69
  * @param {Rules} rules
69
70
  * @param {Translate} translate
71
+ * @param {AppendPreview} appendPreview
70
72
  */
71
73
  export default function ContextPadProvider(
72
74
  config, injector, eventBus,
@@ -581,4 +583,4 @@ function isEventType(businessObject, type, eventDefinitionType) {
581
583
  });
582
584
 
583
585
  return isType && isDefinition;
584
- }
586
+ }
@@ -3,10 +3,12 @@ export default class GridSnappingAutoPlaceBehavior {
3
3
  /**
4
4
  * @param eventBus
5
5
  * @param gridSnapping
6
+ * @param elementRegistry
6
7
  */
7
- constructor(eventBus: EventBus, gridSnapping: GridSnapping);
8
+ constructor(eventBus: EventBus, gridSnapping: GridSnapping, elementRegistry: ElementRegistry);
8
9
  }
9
10
 
10
11
  type EventBus = import('diagram-js/lib/core/EventBus').default;
12
+ type ElementRegistry = import('diagram-js/lib/core/ElementRegistry').default;
11
13
  type GridSnapping = import('diagram-js/lib/features/grid-snapping/GridSnapping').default;
12
14
  type Axis = import('diagram-js/lib/util/Types').Axis;
@@ -5,6 +5,7 @@ import { is } from '../../../util/ModelUtil';
5
5
 
6
6
  /**
7
7
  * @typedef {import('diagram-js/lib/core/EventBus').default} EventBus
8
+ * @typedef {import('diagram-js/lib/core/ElementRegistry').default} ElementRegistry
8
9
  * @typedef {import('diagram-js/lib/features/grid-snapping/GridSnapping').default} GridSnapping
9
10
  *
10
11
  * @typedef {import('diagram-js/lib/util/Types').Axis} Axis
@@ -15,14 +16,15 @@ var HIGH_PRIORITY = 2000;
15
16
  /**
16
17
  * @param {EventBus} eventBus
17
18
  * @param {GridSnapping} gridSnapping
19
+ * @param {ElementRegistry} elementRegistry
18
20
  */
19
- export default function GridSnappingAutoPlaceBehavior(eventBus, gridSnapping) {
21
+ export default function GridSnappingAutoPlaceBehavior(eventBus, gridSnapping, elementRegistry) {
20
22
  eventBus.on('autoPlace', HIGH_PRIORITY, function(context) {
21
23
  var source = context.source,
22
24
  sourceMid = getMid(source),
23
25
  shape = context.shape;
24
26
 
25
- var position = getNewShapePosition(source, shape);
27
+ var position = getNewShapePosition(source, shape, elementRegistry);
26
28
 
27
29
  [ 'x', 'y' ].forEach(function(axis) {
28
30
  var options = {};
@@ -59,7 +61,8 @@ export default function GridSnappingAutoPlaceBehavior(eventBus, gridSnapping) {
59
61
 
60
62
  GridSnappingAutoPlaceBehavior.$inject = [
61
63
  'eventBus',
62
- 'gridSnapping'
64
+ 'gridSnapping',
65
+ 'elementRegistry'
63
66
  ];
64
67
 
65
68
  // helpers //////////
@@ -79,7 +79,8 @@ export default function LabelEditingPreview(eventBus, canvas, pathMap) {
79
79
  } else if (is(element, 'bpmn:Task') ||
80
80
  is(element, 'bpmn:CallActivity') ||
81
81
  is(element, 'bpmn:SubProcess') ||
82
- is(element, 'bpmn:Participant')) {
82
+ is(element, 'bpmn:Participant') ||
83
+ is(element, 'bpmn:Lane')) {
83
84
  canvas.addMarker(element, MARKER_LABEL_HIDDEN);
84
85
  }
85
86
  });
@@ -1,15 +1,19 @@
1
1
  export default class BpmnLayouter extends BaseLayouter {
2
- /**
3
- * Returns waypoints of laid out connection.
4
- *
5
- * @param connection
6
- * @param hints
7
- *
8
- * @return
9
- */
10
- layoutConnection(connection: Connection, hints?: BpmnLayoutConnectionHints): Point[];
2
+ static $inject: string[];
3
+ constructor(elementRegistry: any);
4
+
5
+ /**
6
+ * Returns waypoints of laid out connection.
7
+ *
8
+ * @param connection
9
+ * @param hints
10
+ *
11
+ * @return
12
+ */
13
+ layoutConnection(connection: Connection, hints?: BpmnLayoutConnectionHints): Point[];
11
14
  }
12
15
 
16
+ type ElementRegistry = import('diagram-js/lib/core/ElementRegistry').default;
13
17
  type Point = import('diagram-js/lib/util/Types').Point;
14
18
  type Connection = import('../../model/Types').Connection;
15
19
  type Element = import('../../model/Types').Element;
@@ -25,6 +25,8 @@ import { is } from '../../util/ModelUtil';
25
25
  import { isDirectionHorizontal } from './util/ModelingUtil';
26
26
 
27
27
  /**
28
+ * @typedef {import('diagram-js/lib/core/ElementRegistry').default} ElementRegistry
29
+ *
28
30
  * @typedef {import('diagram-js/lib/util/Types').Point} Point
29
31
  *
30
32
  * @typedef {import('../../model/Types').Connection} Connection
@@ -107,7 +109,9 @@ var orientationDirectionMapping = {
107
109
  left: 'l'
108
110
  };
109
111
 
110
- export default function BpmnLayouter() {}
112
+ export default function BpmnLayouter(elementRegistry) {
113
+ this._elementRegistry = elementRegistry;
114
+ }
111
115
 
112
116
  inherits(BpmnLayouter, BaseLayouter);
113
117
 
@@ -128,7 +132,8 @@ BpmnLayouter.prototype.layoutConnection = function(connection, hints) {
128
132
  target = hints.target || connection.target,
129
133
  waypoints = hints.waypoints || connection.waypoints,
130
134
  connectionStart = hints.connectionStart,
131
- connectionEnd = hints.connectionEnd;
135
+ connectionEnd = hints.connectionEnd,
136
+ elementRegistry = this._elementRegistry;
132
137
 
133
138
  var manhattanOptions,
134
139
  updatedWaypoints;
@@ -149,7 +154,7 @@ BpmnLayouter.prototype.layoutConnection = function(connection, hints) {
149
154
  }
150
155
  }
151
156
 
152
- var layout = isDirectionHorizontal(source) ? PREFERRED_LAYOUTS_HORIZONTAL : PREFERRED_LAYOUTS_VERTICAL;
157
+ var layout = isDirectionHorizontal(source, elementRegistry) ? PREFERRED_LAYOUTS_HORIZONTAL : PREFERRED_LAYOUTS_VERTICAL;
153
158
 
154
159
  if (is(connection, 'bpmn:MessageFlow')) {
155
160
  manhattanOptions = getMessageFlowManhattanOptions(source, target, layout);
@@ -479,3 +484,5 @@ function getBoundaryEventTargetLayout(attachOrientation, targetOrientation, atta
479
484
  }
480
485
  }
481
486
  }
487
+
488
+ BpmnLayouter.$inject = [ 'elementRegistry' ];
@@ -34,7 +34,7 @@ export default class Modeling<T extends import("../../model/Types").Connection =
34
34
  *
35
35
  * @return
36
36
  */
37
- connect(source: Element, target: Element, attrs: Partial<Connection>, hints?: ModelingHints): T;
37
+ connect(source: Element, target: Element, attrs?: Partial<Connection>, hints?: ModelingHints): T;
38
38
 
39
39
  /**
40
40
  * Update a model element's properties.
@@ -114,7 +114,7 @@ Modeling.prototype.updateLabel = function(element, newLabel, newBounds, hints) {
114
114
  /**
115
115
  * @param {Element} source
116
116
  * @param {Element} target
117
- * @param {Partial<Connection>} attrs
117
+ * @param {Partial<Connection>} [attrs]
118
118
  * @param {ModelingHints} [hints]
119
119
  *
120
120
  * @return {T}