bpmn-js 14.2.0 → 15.0.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.
- package/dist/bpmn-modeler.development.js +22264 -21402
- package/dist/bpmn-modeler.production.min.js +40 -40
- package/dist/bpmn-navigated-viewer.development.js +1519 -1126
- package/dist/bpmn-navigated-viewer.production.min.js +5 -5
- package/dist/bpmn-viewer.development.js +1519 -1126
- package/dist/bpmn-viewer.production.min.js +5 -5
- package/lib/Modeler.js +2 -0
- package/lib/draw/BpmnRenderUtil.d.ts +49 -3
- package/lib/draw/BpmnRenderUtil.js +53 -6
- package/lib/draw/BpmnRenderer.d.ts +50 -62
- package/lib/draw/BpmnRenderer.js +1294 -973
- package/lib/features/append-preview/AppendPreview.d.ts +36 -0
- package/lib/features/append-preview/AppendPreview.js +109 -0
- package/lib/features/append-preview/index.d.ts +16 -0
- package/lib/features/append-preview/index.js +15 -0
- package/lib/features/context-pad/ContextPadProvider.d.ts +14 -1
- package/lib/features/context-pad/ContextPadProvider.js +26 -7
- package/lib/features/context-pad/index.js +2 -0
- package/lib/features/modeling/index.d.ts +2 -2
- package/lib/features/outline/OutlineProvider.d.ts +34 -0
- package/lib/features/outline/OutlineProvider.js +163 -0
- package/lib/features/outline/OutlineUtil.d.ts +18 -0
- package/lib/features/outline/OutlineUtil.js +32 -0
- package/lib/features/outline/index.d.ts +7 -0
- package/lib/features/outline/index.js +10 -0
- package/package.json +3 -3
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A preview for appending.
|
|
3
|
+
*
|
|
4
|
+
*/
|
|
5
|
+
export default class AppendPreview {
|
|
6
|
+
static $inject: string[];
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @param complexPreview
|
|
10
|
+
* @param connectionDocking
|
|
11
|
+
* @param elementFactory
|
|
12
|
+
* @param eventBus
|
|
13
|
+
* @param layouter
|
|
14
|
+
* @param rules
|
|
15
|
+
*/
|
|
16
|
+
constructor(complexPreview: ComplexPreview, connectionDocking: ConnectionDocking, elementFactory: ElementFactory, eventBus: EventBus, layouter: any, rules: Rules);
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Create a preview of appending a shape of the given type to the given source.
|
|
20
|
+
*
|
|
21
|
+
* @param source
|
|
22
|
+
* @param type
|
|
23
|
+
* @param options
|
|
24
|
+
*/
|
|
25
|
+
create(source: Shape, type: string, options: Partial<Shape>): void;
|
|
26
|
+
|
|
27
|
+
cleanUp(): void;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
type ComplexPreview = import('diagram-js/lib/features/complex-preview/ComplexPreview').default;
|
|
31
|
+
type ConnectionDocking = import('diagram-js/lib/layout/ConnectionDocking').default;
|
|
32
|
+
type ElementFactory = import('../modeling/ElementFactory').default;
|
|
33
|
+
type EventBus = import('diagram-js/lib/core/EventBus').default;
|
|
34
|
+
type ManhattanLayout = import('diagram-js/lib/layout/ManhattanLayout').default;
|
|
35
|
+
type Rules = import('diagram-js/lib/features/rules/Rules').default;
|
|
36
|
+
type Shape = import('../../model/Types').Shape;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import {
|
|
2
|
+
assign,
|
|
3
|
+
isNil
|
|
4
|
+
} from 'min-dash';
|
|
5
|
+
|
|
6
|
+
const round = Math.round;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @typedef {import('diagram-js/lib/features/complex-preview/ComplexPreview').default} ComplexPreview
|
|
10
|
+
* @typedef {import('diagram-js/lib/layout/ConnectionDocking').default} ConnectionDocking
|
|
11
|
+
* @typedef {import('../modeling/ElementFactory').default} ElementFactory
|
|
12
|
+
* @typedef {import('diagram-js/lib/core/EventBus').default} EventBus
|
|
13
|
+
* @typedef {import('diagram-js/lib/layout/ManhattanLayout').default} ManhattanLayout
|
|
14
|
+
* @typedef {import('diagram-js/lib/features/rules/Rules').default} Rules
|
|
15
|
+
*
|
|
16
|
+
* @typedef {import('../../model/Types').Shape} Shape
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* A preview for appending.
|
|
21
|
+
*
|
|
22
|
+
* @param {ComplexPreview} complexPreview
|
|
23
|
+
* @param {ConnectionDocking} connectionDocking
|
|
24
|
+
* @param {ElementFactory} elementFactory
|
|
25
|
+
* @param {EventBus} eventBus
|
|
26
|
+
* @param {ManhattanLayout} layouter
|
|
27
|
+
* @param {Rules} rules
|
|
28
|
+
*/
|
|
29
|
+
export default function AppendPreview(complexPreview, connectionDocking, elementFactory, eventBus, layouter, rules) {
|
|
30
|
+
this._complexPreview = complexPreview;
|
|
31
|
+
this._connectionDocking = connectionDocking;
|
|
32
|
+
this._elementFactory = elementFactory;
|
|
33
|
+
this._eventBus = eventBus;
|
|
34
|
+
this._layouter = layouter;
|
|
35
|
+
this._rules = rules;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Create a preview of appending a shape of the given type to the given source.
|
|
40
|
+
*
|
|
41
|
+
* @param {Shape} source
|
|
42
|
+
* @param {string} type
|
|
43
|
+
* @param {Partial<Shape>} options
|
|
44
|
+
*/
|
|
45
|
+
AppendPreview.prototype.create = function(source, type, options) {
|
|
46
|
+
const complexPreview = this._complexPreview,
|
|
47
|
+
connectionDocking = this._connectionDocking,
|
|
48
|
+
elementFactory = this._elementFactory,
|
|
49
|
+
eventBus = this._eventBus,
|
|
50
|
+
layouter = this._layouter,
|
|
51
|
+
rules = this._rules;
|
|
52
|
+
|
|
53
|
+
const shape = elementFactory.createShape(assign({ type }, options));
|
|
54
|
+
|
|
55
|
+
const position = eventBus.fire('autoPlace', {
|
|
56
|
+
source,
|
|
57
|
+
shape
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
if (!position) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
assign(shape, {
|
|
65
|
+
x: position.x - round(shape.width / 2),
|
|
66
|
+
y: position.y - round(shape.height / 2)
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
const connectionCreateAllowed = rules.allowed('connection.create', {
|
|
70
|
+
source,
|
|
71
|
+
target: shape,
|
|
72
|
+
hints: {
|
|
73
|
+
targetParent: source.parent
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
let connection = null;
|
|
78
|
+
|
|
79
|
+
if (connectionCreateAllowed) {
|
|
80
|
+
connection = elementFactory.createConnection(connectionCreateAllowed);
|
|
81
|
+
|
|
82
|
+
connection.waypoints = layouter.layoutConnection(connection, {
|
|
83
|
+
source,
|
|
84
|
+
target: shape
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
connection.waypoints = connectionDocking.getCroppedWaypoints(connection, source, shape);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
complexPreview.create({
|
|
91
|
+
created: [
|
|
92
|
+
shape,
|
|
93
|
+
connection
|
|
94
|
+
].filter((element) => !isNil(element))
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
AppendPreview.prototype.cleanUp = function() {
|
|
99
|
+
this._complexPreview.cleanUp();
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
AppendPreview.$inject = [
|
|
103
|
+
'complexPreview',
|
|
104
|
+
'connectionDocking',
|
|
105
|
+
'elementFactory',
|
|
106
|
+
'eventBus',
|
|
107
|
+
'layouter',
|
|
108
|
+
'rules'
|
|
109
|
+
];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
const __depends__: (import("didi").ModuleDeclaration | {
|
|
3
|
+
bpmnAutoPlace: (string | typeof import("../auto-place/BpmnAutoPlace").default)[];
|
|
4
|
+
} | {
|
|
5
|
+
bpmnFactory: (string | typeof import("../modeling/BpmnFactory").default)[];
|
|
6
|
+
bpmnUpdater: (string | typeof import("../modeling/BpmnUpdater").default)[];
|
|
7
|
+
elementFactory: (string | typeof import("../modeling/ElementFactory").default)[];
|
|
8
|
+
modeling: (string | typeof import("../modeling/Modeling").default)[];
|
|
9
|
+
layouter: (string | typeof import("../modeling/BpmnLayouter").default)[];
|
|
10
|
+
connectionDocking: (string | typeof import("diagram-js/lib/layout/CroppingConnectionDocking").default)[];
|
|
11
|
+
})[];
|
|
12
|
+
const __init__: string[];
|
|
13
|
+
const appendPreview: (string | typeof AppendPreview)[];
|
|
14
|
+
}
|
|
15
|
+
export default _default;
|
|
16
|
+
import AppendPreview from './AppendPreview';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import AutoPlaceModule from '../auto-place';
|
|
2
|
+
import ComplexPreviewModule from 'diagram-js/lib/features/complex-preview';
|
|
3
|
+
import ModelingModule from '../modeling';
|
|
4
|
+
|
|
5
|
+
import AppendPreview from './AppendPreview';
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
__depends__: [
|
|
9
|
+
AutoPlaceModule,
|
|
10
|
+
ComplexPreviewModule,
|
|
11
|
+
ModelingModule
|
|
12
|
+
],
|
|
13
|
+
__init__: [ 'appendPreview' ],
|
|
14
|
+
appendPreview: [ 'type', AppendPreview ]
|
|
15
|
+
};
|
|
@@ -21,7 +21,20 @@ export default class ContextPadProvider implements BaseContextPadProvider {
|
|
|
21
21
|
* @param rules
|
|
22
22
|
* @param translate
|
|
23
23
|
*/
|
|
24
|
-
constructor(
|
|
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
38
|
|
|
26
39
|
/**
|
|
27
40
|
* @param elements
|
|
@@ -71,7 +71,7 @@ export default function ContextPadProvider(
|
|
|
71
71
|
config, injector, eventBus,
|
|
72
72
|
contextPad, modeling, elementFactory,
|
|
73
73
|
connect, create, popupMenu,
|
|
74
|
-
canvas, rules, translate) {
|
|
74
|
+
canvas, rules, translate, appendPreview) {
|
|
75
75
|
|
|
76
76
|
config = config || {};
|
|
77
77
|
|
|
@@ -88,6 +88,8 @@ export default function ContextPadProvider(
|
|
|
88
88
|
this._canvas = canvas;
|
|
89
89
|
this._rules = rules;
|
|
90
90
|
this._translate = translate;
|
|
91
|
+
this._eventBus = eventBus;
|
|
92
|
+
this._appendPreview = appendPreview;
|
|
91
93
|
|
|
92
94
|
if (config.autoPlace !== false) {
|
|
93
95
|
this._autoPlace = injector.get('autoPlace', false);
|
|
@@ -121,7 +123,8 @@ ContextPadProvider.$inject = [
|
|
|
121
123
|
'popupMenu',
|
|
122
124
|
'canvas',
|
|
123
125
|
'rules',
|
|
124
|
-
'translate'
|
|
126
|
+
'translate',
|
|
127
|
+
'appendPreview'
|
|
125
128
|
];
|
|
126
129
|
|
|
127
130
|
/**
|
|
@@ -180,14 +183,14 @@ ContextPadProvider.prototype._isDeleteAllowed = function(elements) {
|
|
|
180
183
|
ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
|
181
184
|
var contextPad = this._contextPad,
|
|
182
185
|
modeling = this._modeling,
|
|
183
|
-
|
|
184
186
|
elementFactory = this._elementFactory,
|
|
185
187
|
connect = this._connect,
|
|
186
188
|
create = this._create,
|
|
187
189
|
popupMenu = this._popupMenu,
|
|
188
190
|
rules = this._rules,
|
|
189
191
|
autoPlace = this._autoPlace,
|
|
190
|
-
translate = this._translate
|
|
192
|
+
translate = this._translate,
|
|
193
|
+
appendPreview = this._appendPreview;
|
|
191
194
|
|
|
192
195
|
var actions = {};
|
|
193
196
|
|
|
@@ -241,18 +244,33 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
|
|
241
244
|
function appendStart(event, element) {
|
|
242
245
|
|
|
243
246
|
var shape = elementFactory.createShape(assign({ type: type }, options));
|
|
247
|
+
|
|
244
248
|
create.start(event, shape, {
|
|
245
249
|
source: element
|
|
246
250
|
});
|
|
247
|
-
}
|
|
248
251
|
|
|
252
|
+
appendPreview.cleanUp();
|
|
253
|
+
}
|
|
249
254
|
|
|
250
|
-
var append = autoPlace ? function(
|
|
255
|
+
var append = autoPlace ? function(_, element) {
|
|
251
256
|
var shape = elementFactory.createShape(assign({ type: type }, options));
|
|
252
257
|
|
|
253
258
|
autoPlace.append(element, shape);
|
|
259
|
+
|
|
260
|
+
appendPreview.cleanUp();
|
|
254
261
|
} : appendStart;
|
|
255
262
|
|
|
263
|
+
var previewAppend = autoPlace ? function(_, element) {
|
|
264
|
+
|
|
265
|
+
// mouseover
|
|
266
|
+
appendPreview.create(element, type, options);
|
|
267
|
+
|
|
268
|
+
return () => {
|
|
269
|
+
|
|
270
|
+
// mouseout
|
|
271
|
+
appendPreview.cleanUp();
|
|
272
|
+
};
|
|
273
|
+
} : null;
|
|
256
274
|
|
|
257
275
|
return {
|
|
258
276
|
group: 'model',
|
|
@@ -260,7 +278,8 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
|
|
260
278
|
title: title,
|
|
261
279
|
action: {
|
|
262
280
|
dragstart: appendStart,
|
|
263
|
-
click: append
|
|
281
|
+
click: append,
|
|
282
|
+
hover: previewAppend
|
|
264
283
|
}
|
|
265
284
|
};
|
|
266
285
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import AppendPreviewModule from '../append-preview';
|
|
1
2
|
import DirectEditingModule from 'diagram-js-direct-editing';
|
|
2
3
|
import ContextPadModule from 'diagram-js/lib/features/context-pad';
|
|
3
4
|
import SelectionModule from 'diagram-js/lib/features/selection';
|
|
@@ -9,6 +10,7 @@ import ContextPadProvider from './ContextPadProvider';
|
|
|
9
10
|
|
|
10
11
|
export default {
|
|
11
12
|
__depends__: [
|
|
13
|
+
AppendPreviewModule,
|
|
12
14
|
DirectEditingModule,
|
|
13
15
|
ContextPadModule,
|
|
14
16
|
SelectionModule,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
declare namespace _default {
|
|
2
2
|
const __init__: string[];
|
|
3
3
|
const __depends__: (import("didi").ModuleDeclaration | {
|
|
4
|
-
bpmnReplace: (string | typeof import("../replace/BpmnReplace").default)[];
|
|
5
|
-
} | {
|
|
6
4
|
bpmnRules: (string | typeof import("../rules/BpmnRules").default)[];
|
|
7
5
|
} | {
|
|
8
6
|
bpmnDiOrdering: (string | typeof import("../di-ordering/BpmnDiOrdering").default)[];
|
|
9
7
|
} | {
|
|
10
8
|
bpmnOrderingProvider: (string | typeof import("../ordering/BpmnOrderingProvider").default)[];
|
|
9
|
+
} | {
|
|
10
|
+
bpmnReplace: (string | typeof import("../replace/BpmnReplace").default)[];
|
|
11
11
|
} | {
|
|
12
12
|
spaceTool: (string | typeof import("../space-tool/BpmnSpaceTool").default)[];
|
|
13
13
|
})[];
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BPMN-specific outline provider.
|
|
3
|
+
*
|
|
4
|
+
* @implements {BaseOutlineProvider}
|
|
5
|
+
*
|
|
6
|
+
*/
|
|
7
|
+
export default class OutlineProvider implements BaseOutlineProvider {
|
|
8
|
+
static $inject: string[];
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @param outline
|
|
12
|
+
* @param styles
|
|
13
|
+
*/
|
|
14
|
+
constructor(outline: Outline, styles: Styles);
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Returns outline for a given element.
|
|
18
|
+
*
|
|
19
|
+
* @param element
|
|
20
|
+
*
|
|
21
|
+
* @return
|
|
22
|
+
*/
|
|
23
|
+
getOutline(element: Element): Outline;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Updates the outline for a given element.
|
|
27
|
+
* Returns true if the update for the given element was handled by this provider.
|
|
28
|
+
*
|
|
29
|
+
* @param element
|
|
30
|
+
* @param outline
|
|
31
|
+
* @returns
|
|
32
|
+
*/
|
|
33
|
+
updateOutline(element: Element, outline: Outline): boolean;
|
|
34
|
+
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { assign } from 'min-dash';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
attr as svgAttr,
|
|
5
|
+
create as svgCreate
|
|
6
|
+
} from 'tiny-svg';
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
is,
|
|
10
|
+
isAny
|
|
11
|
+
} from '../../util/ModelUtil';
|
|
12
|
+
|
|
13
|
+
import { isLabel } from '../../util/LabelUtil';
|
|
14
|
+
|
|
15
|
+
import {
|
|
16
|
+
DATA_OBJECT_REFERENCE_OUTLINE_PATH,
|
|
17
|
+
DATA_STORE_REFERENCE_OUTLINE_PATH,
|
|
18
|
+
DATA_OBJECT_REFERENCE_STANDARD_SIZE,
|
|
19
|
+
DATA_STORE_REFERENCE_STANDARD_SIZE,
|
|
20
|
+
createPath
|
|
21
|
+
} from './OutlineUtil';
|
|
22
|
+
|
|
23
|
+
const DEFAULT_OFFSET = 5;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* BPMN-specific outline provider.
|
|
27
|
+
*
|
|
28
|
+
* @implements {BaseOutlineProvider}
|
|
29
|
+
*
|
|
30
|
+
* @param {Outline} outline
|
|
31
|
+
* @param {Styles} styles
|
|
32
|
+
*/
|
|
33
|
+
export default function OutlineProvider(outline, styles) {
|
|
34
|
+
|
|
35
|
+
this._styles = styles;
|
|
36
|
+
outline.registerProvider(this);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
OutlineProvider.$inject = [
|
|
40
|
+
'outline',
|
|
41
|
+
'styles'
|
|
42
|
+
];
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Returns outline for a given element.
|
|
46
|
+
*
|
|
47
|
+
* @param {Element} element
|
|
48
|
+
*
|
|
49
|
+
* @return {Outline}
|
|
50
|
+
*/
|
|
51
|
+
OutlineProvider.prototype.getOutline = function(element) {
|
|
52
|
+
|
|
53
|
+
const OUTLINE_STYLE = this._styles.cls('djs-outline', [ 'no-fill' ]);
|
|
54
|
+
|
|
55
|
+
var outline;
|
|
56
|
+
|
|
57
|
+
if (isLabel(element)) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (is(element, 'bpmn:Gateway')) {
|
|
62
|
+
outline = svgCreate('rect');
|
|
63
|
+
|
|
64
|
+
assign(outline.style, {
|
|
65
|
+
'transform-box': 'fill-box',
|
|
66
|
+
'transform': 'rotate(45deg)',
|
|
67
|
+
'transform-origin': 'center'
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
svgAttr(outline, assign({
|
|
71
|
+
x: 2,
|
|
72
|
+
y: 2,
|
|
73
|
+
rx: 4,
|
|
74
|
+
width: element.width - 4,
|
|
75
|
+
height: element.height - 4,
|
|
76
|
+
}, OUTLINE_STYLE));
|
|
77
|
+
|
|
78
|
+
} else if (isAny(element, [ 'bpmn:Task', 'bpmn:SubProcess', 'bpmn:Group' ])) {
|
|
79
|
+
outline = svgCreate('rect');
|
|
80
|
+
|
|
81
|
+
svgAttr(outline, assign({
|
|
82
|
+
x: -DEFAULT_OFFSET,
|
|
83
|
+
y: -DEFAULT_OFFSET,
|
|
84
|
+
rx: 14,
|
|
85
|
+
width: element.width + DEFAULT_OFFSET * 2,
|
|
86
|
+
height: element.height + DEFAULT_OFFSET * 2
|
|
87
|
+
}, OUTLINE_STYLE));
|
|
88
|
+
|
|
89
|
+
} else if (is(element, 'bpmn:Event')) {
|
|
90
|
+
outline = svgCreate('circle');
|
|
91
|
+
|
|
92
|
+
svgAttr(outline, assign({
|
|
93
|
+
cx: element.width / 2,
|
|
94
|
+
cy: element.height / 2,
|
|
95
|
+
r: element.width / 2 + DEFAULT_OFFSET
|
|
96
|
+
}, OUTLINE_STYLE));
|
|
97
|
+
|
|
98
|
+
} else if (is(element, 'bpmn:DataObjectReference') && isStandardSize(element, 'bpmn:DataObjectReference')) {
|
|
99
|
+
|
|
100
|
+
outline = createPath(
|
|
101
|
+
DATA_OBJECT_REFERENCE_OUTLINE_PATH,
|
|
102
|
+
{ x: -6, y: -6 },
|
|
103
|
+
OUTLINE_STYLE
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
} else if (is(element, 'bpmn:DataStoreReference') && isStandardSize(element, 'bpmn:DataStoreReference')) {
|
|
107
|
+
|
|
108
|
+
outline = createPath(
|
|
109
|
+
DATA_STORE_REFERENCE_OUTLINE_PATH,
|
|
110
|
+
{ x: -6, y: -6 },
|
|
111
|
+
OUTLINE_STYLE
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return outline;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Updates the outline for a given element.
|
|
120
|
+
* Returns true if the update for the given element was handled by this provider.
|
|
121
|
+
*
|
|
122
|
+
* @param {Element} element
|
|
123
|
+
* @param {Outline} outline
|
|
124
|
+
* @returns {boolean}
|
|
125
|
+
*/
|
|
126
|
+
OutlineProvider.prototype.updateOutline = function(element, outline) {
|
|
127
|
+
|
|
128
|
+
if (isAny(element, [ 'bpmn:SubProcess', 'bpmn:Group' ])) {
|
|
129
|
+
|
|
130
|
+
svgAttr(outline, {
|
|
131
|
+
width: element.width + DEFAULT_OFFSET * 2,
|
|
132
|
+
height: element.height + DEFAULT_OFFSET * 2
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
return true;
|
|
136
|
+
|
|
137
|
+
} else if (isAny(element, [
|
|
138
|
+
'bpmn:Event',
|
|
139
|
+
'bpmn:Gateway',
|
|
140
|
+
'bpmn:DataStoreReference',
|
|
141
|
+
'bpmn:DataObjectReference'
|
|
142
|
+
])) {
|
|
143
|
+
return true;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
return false;
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
// helpers //////////
|
|
151
|
+
|
|
152
|
+
function isStandardSize(element, type) {
|
|
153
|
+
var standardSize;
|
|
154
|
+
|
|
155
|
+
if (type === 'bpmn:DataObjectReference') {
|
|
156
|
+
standardSize = DATA_OBJECT_REFERENCE_STANDARD_SIZE;
|
|
157
|
+
} else if (type === 'bpmn:DataStoreReference') {
|
|
158
|
+
standardSize = DATA_STORE_REFERENCE_STANDARD_SIZE;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
return element.width === standardSize.width
|
|
162
|
+
&& element.height === standardSize.height;
|
|
163
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create a path element with given attributes.
|
|
3
|
+
* @param path
|
|
4
|
+
* @param attrs
|
|
5
|
+
* @param OUTLINE_STYLE
|
|
6
|
+
* @return
|
|
7
|
+
*/
|
|
8
|
+
export function createPath(path: string, attrs: any, OUTLINE_STYLE: any): SVGElement;
|
|
9
|
+
export const DATA_OBJECT_REFERENCE_OUTLINE_PATH: "M44.7648 11.3263L36.9892 2.64074C36.0451 1.58628 34.5651 0.988708 33.1904 0.988708H5.98667C3.22688 0.988708 0.989624 3.34892 0.989624 6.26039V55.0235C0.989624 57.9349 3.22688 60.2952 5.98667 60.2952H40.966C43.7257 60.2952 45.963 57.9349 45.963 55.0235V14.9459C45.963 13.5998 45.6407 12.3048 44.7648 11.3263Z";
|
|
10
|
+
export const DATA_STORE_REFERENCE_OUTLINE_PATH: "M1.03845 48.1347C1.03845 49.3511 1.07295 50.758 1.38342 52.064C1.69949 53.3938 2.32428 54.7154 3.56383 55.6428C6.02533 57.4841 10.1161 58.7685 14.8212 59.6067C19.5772 60.4538 25.1388 60.8738 30.6831 60.8738C36.2276 60.8738 41.7891 60.4538 46.545 59.6067C51.2504 58.7687 55.3412 57.4842 57.8028 55.6429C59.0424 54.7156 59.6673 53.3938 59.9834 52.064C60.2938 50.7579 60.3285 49.351 60.3285 48.1344V13.8415C60.3285 12.6249 60.2938 11.218 59.9834 9.91171C59.6673 8.58194 59.0423 7.2602 57.8027 6.33294C55.341 4.49168 51.2503 3.20723 46.545 2.36914C41.7891 1.522 36.2276 1.10204 30.6831 1.10205C25.1388 1.10206 19.5772 1.52206 14.8213 2.36923C10.1162 3.20734 6.02543 4.49183 3.5639 6.33314C2.32433 7.26038 1.69951 8.58206 1.38343 9.91181C1.07295 11.2179 1.03845 12.6247 1.03845 13.8411V48.1347Z";
|
|
11
|
+
/**
|
|
12
|
+
* @type {Dimensions}
|
|
13
|
+
*/
|
|
14
|
+
export const DATA_OBJECT_REFERENCE_STANDARD_SIZE: Dimensions;
|
|
15
|
+
/**
|
|
16
|
+
* @type {Dimensions}
|
|
17
|
+
*/
|
|
18
|
+
export const DATA_STORE_REFERENCE_STANDARD_SIZE: Dimensions;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {
|
|
2
|
+
create as svgCreate
|
|
3
|
+
} from 'tiny-svg';
|
|
4
|
+
|
|
5
|
+
export const DATA_OBJECT_REFERENCE_OUTLINE_PATH = 'M44.7648 11.3263L36.9892 2.64074C36.0451 1.58628 34.5651 0.988708 33.1904 0.988708H5.98667C3.22688 0.988708 0.989624 3.34892 0.989624 6.26039V55.0235C0.989624 57.9349 3.22688 60.2952 5.98667 60.2952H40.966C43.7257 60.2952 45.963 57.9349 45.963 55.0235V14.9459C45.963 13.5998 45.6407 12.3048 44.7648 11.3263Z';
|
|
6
|
+
export const DATA_STORE_REFERENCE_OUTLINE_PATH = 'M1.03845 48.1347C1.03845 49.3511 1.07295 50.758 1.38342 52.064C1.69949 53.3938 2.32428 54.7154 3.56383 55.6428C6.02533 57.4841 10.1161 58.7685 14.8212 59.6067C19.5772 60.4538 25.1388 60.8738 30.6831 60.8738C36.2276 60.8738 41.7891 60.4538 46.545 59.6067C51.2504 58.7687 55.3412 57.4842 57.8028 55.6429C59.0424 54.7156 59.6673 53.3938 59.9834 52.064C60.2938 50.7579 60.3285 49.351 60.3285 48.1344V13.8415C60.3285 12.6249 60.2938 11.218 59.9834 9.91171C59.6673 8.58194 59.0423 7.2602 57.8027 6.33294C55.341 4.49168 51.2503 3.20723 46.545 2.36914C41.7891 1.522 36.2276 1.10204 30.6831 1.10205C25.1388 1.10206 19.5772 1.52206 14.8213 2.36923C10.1162 3.20734 6.02543 4.49183 3.5639 6.33314C2.32433 7.26038 1.69951 8.58206 1.38343 9.91181C1.07295 11.2179 1.03845 12.6247 1.03845 13.8411V48.1347Z';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @type {Dimensions}
|
|
10
|
+
*/
|
|
11
|
+
export const DATA_OBJECT_REFERENCE_STANDARD_SIZE = { width: 36, height: 50 };
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @type {Dimensions}
|
|
15
|
+
*/
|
|
16
|
+
export const DATA_STORE_REFERENCE_STANDARD_SIZE = { width: 50, height: 50 };
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Create a path element with given attributes.
|
|
20
|
+
* @param {string} path
|
|
21
|
+
* @param {Object} attrs
|
|
22
|
+
* @param {Object} OUTLINE_STYLE
|
|
23
|
+
* @return {SVGElement}
|
|
24
|
+
*/
|
|
25
|
+
export function createPath(path, attrs, OUTLINE_STYLE) {
|
|
26
|
+
return svgCreate('path', {
|
|
27
|
+
d: path,
|
|
28
|
+
strokeWidth: 2,
|
|
29
|
+
transform: `translate(${attrs.x}, ${attrs.y})`,
|
|
30
|
+
...OUTLINE_STYLE
|
|
31
|
+
});
|
|
32
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bpmn-js",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "15.0.0",
|
|
4
4
|
"description": "A bpmn 2.0 toolkit and web modeler",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"files": [
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
"remark-preset-bpmn-io": "^0.2.1",
|
|
104
104
|
"rollup": "^3.19.1",
|
|
105
105
|
"rollup-plugin-license": "^3.0.0",
|
|
106
|
-
"sinon": "^
|
|
106
|
+
"sinon": "^17.0.0",
|
|
107
107
|
"sinon-chai": "^3.7.0",
|
|
108
108
|
"ts-expect": "^1.3.0",
|
|
109
109
|
"typescript": "^5.0.0",
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
},
|
|
112
112
|
"dependencies": {
|
|
113
113
|
"bpmn-moddle": "^8.0.1",
|
|
114
|
-
"diagram-js": "^12.
|
|
114
|
+
"diagram-js": "^12.6.0",
|
|
115
115
|
"diagram-js-direct-editing": "^2.0.0",
|
|
116
116
|
"ids": "^1.0.5",
|
|
117
117
|
"inherits-browser": "^0.1.0",
|