@bpmnkit/core 0.1.0 → 0.1.1
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/bpmn-builder.js +7 -0
- package/dist/bpmn/bpmn-model.d.ts +35 -2
- package/dist/bpmn/bpmn-parser.js +39 -1
- package/dist/bpmn/bpmn-serializer.js +27 -0
- package/dist/bpmn/compact.js +11 -1
- package/dist/bpmn/di-planes.d.ts +13 -0
- package/dist/bpmn/di-planes.js +20 -0
- package/dist/bpmn/optimize/tasks.js +1 -0
- package/dist/bpmn/svg.js +22 -3
- package/dist/bpmn/type-guards.d.ts +7 -1
- package/dist/bpmn/type-guards.js +13 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +2 -1
- package/package.json +1 -1
|
@@ -127,6 +127,7 @@ function makeFlowElement(id, type, options) {
|
|
|
127
127
|
sequenceFlows: [],
|
|
128
128
|
textAnnotations: [],
|
|
129
129
|
associations: [],
|
|
130
|
+
groups: [],
|
|
130
131
|
};
|
|
131
132
|
case "adHocSubProcess":
|
|
132
133
|
return {
|
|
@@ -136,6 +137,7 @@ function makeFlowElement(id, type, options) {
|
|
|
136
137
|
sequenceFlows: [],
|
|
137
138
|
textAnnotations: [],
|
|
138
139
|
associations: [],
|
|
140
|
+
groups: [],
|
|
139
141
|
};
|
|
140
142
|
case "eventSubProcess":
|
|
141
143
|
return {
|
|
@@ -145,6 +147,7 @@ function makeFlowElement(id, type, options) {
|
|
|
145
147
|
sequenceFlows: [],
|
|
146
148
|
textAnnotations: [],
|
|
147
149
|
associations: [],
|
|
150
|
+
groups: [],
|
|
148
151
|
};
|
|
149
152
|
case "transaction":
|
|
150
153
|
return {
|
|
@@ -154,7 +157,10 @@ function makeFlowElement(id, type, options) {
|
|
|
154
157
|
sequenceFlows: [],
|
|
155
158
|
textAnnotations: [],
|
|
156
159
|
associations: [],
|
|
160
|
+
groups: [],
|
|
157
161
|
};
|
|
162
|
+
default:
|
|
163
|
+
return { ...base, type };
|
|
158
164
|
}
|
|
159
165
|
}
|
|
160
166
|
function buildMultiInstance(options) {
|
|
@@ -1855,6 +1861,7 @@ export class ProcessBuilder {
|
|
|
1855
1861
|
sequenceFlows: this.sequenceFlows,
|
|
1856
1862
|
textAnnotations: this._textAnnotations,
|
|
1857
1863
|
associations: this._associations,
|
|
1864
|
+
groups: [],
|
|
1858
1865
|
unknownAttributes: {},
|
|
1859
1866
|
};
|
|
1860
1867
|
const defs = {
|
|
@@ -5,7 +5,7 @@ import type { XmlElement } from "../types/xml-element.js";
|
|
|
5
5
|
* exhaustive `switch` statements and type-narrowing with the type guard helpers
|
|
6
6
|
* exported from `@bpmnkit/core`.
|
|
7
7
|
*/
|
|
8
|
-
export type BpmnElementType = "startEvent" | "endEvent" | "intermediateThrowEvent" | "intermediateCatchEvent" | "boundaryEvent" | "task" | "serviceTask" | "scriptTask" | "userTask" | "sendTask" | "receiveTask" | "businessRuleTask" | "manualTask" | "callActivity" | "exclusiveGateway" | "parallelGateway" | "inclusiveGateway" | "eventBasedGateway" | "complexGateway" | "subProcess" | "adHocSubProcess" | "eventSubProcess" | "transaction";
|
|
8
|
+
export type BpmnElementType = "startEvent" | "endEvent" | "intermediateThrowEvent" | "intermediateCatchEvent" | "boundaryEvent" | "task" | "serviceTask" | "scriptTask" | "userTask" | "sendTask" | "receiveTask" | "businessRuleTask" | "manualTask" | "callActivity" | "exclusiveGateway" | "parallelGateway" | "inclusiveGateway" | "eventBasedGateway" | "complexGateway" | "subProcess" | "adHocSubProcess" | "eventSubProcess" | "transaction" | "dataObject" | "dataObjectReference" | "dataStoreReference";
|
|
9
9
|
/** Axis-aligned bounding box used by BPMN diagram interchange (BPMNDi). */
|
|
10
10
|
export interface BpmnBounds {
|
|
11
11
|
x: number;
|
|
@@ -150,6 +150,26 @@ export interface BpmnCallActivity extends BpmnFlowNodeBase {
|
|
|
150
150
|
type: "callActivity";
|
|
151
151
|
loopCharacteristics?: BpmnMultiInstanceLoopCharacteristics;
|
|
152
152
|
}
|
|
153
|
+
/** A data object — a piece of information flowing through the process. */
|
|
154
|
+
export interface BpmnDataObject extends BpmnFlowNodeBase {
|
|
155
|
+
type: "dataObject";
|
|
156
|
+
/** When true, represents a collection of items. */
|
|
157
|
+
isCollection?: boolean;
|
|
158
|
+
}
|
|
159
|
+
/** A visual reference to a {@link BpmnDataObject} (the shape drawn on the canvas). */
|
|
160
|
+
export interface BpmnDataObjectReference extends BpmnFlowNodeBase {
|
|
161
|
+
type: "dataObjectReference";
|
|
162
|
+
/** Id of the referenced `dataObject`. */
|
|
163
|
+
dataObjectRef?: string;
|
|
164
|
+
/** When true, drawn with the collection (parallel-bars) marker. */
|
|
165
|
+
isCollection?: boolean;
|
|
166
|
+
}
|
|
167
|
+
/** A visual reference to a data store (drawn as a cylinder). */
|
|
168
|
+
export interface BpmnDataStoreReference extends BpmnFlowNodeBase {
|
|
169
|
+
type: "dataStoreReference";
|
|
170
|
+
/** Id of the referenced `dataStore`. */
|
|
171
|
+
dataStoreRef?: string;
|
|
172
|
+
}
|
|
153
173
|
export interface BpmnSendTask extends BpmnFlowNodeBase {
|
|
154
174
|
type: "sendTask";
|
|
155
175
|
messageRef?: string;
|
|
@@ -167,6 +187,7 @@ export interface BpmnAdHocSubProcess extends BpmnFlowNodeBase {
|
|
|
167
187
|
sequenceFlows: BpmnSequenceFlow[];
|
|
168
188
|
textAnnotations: BpmnTextAnnotation[];
|
|
169
189
|
associations: BpmnAssociation[];
|
|
190
|
+
groups: BpmnGroup[];
|
|
170
191
|
}
|
|
171
192
|
export interface BpmnSubProcess extends BpmnFlowNodeBase {
|
|
172
193
|
type: "subProcess";
|
|
@@ -176,6 +197,7 @@ export interface BpmnSubProcess extends BpmnFlowNodeBase {
|
|
|
176
197
|
sequenceFlows: BpmnSequenceFlow[];
|
|
177
198
|
textAnnotations: BpmnTextAnnotation[];
|
|
178
199
|
associations: BpmnAssociation[];
|
|
200
|
+
groups: BpmnGroup[];
|
|
179
201
|
}
|
|
180
202
|
export interface BpmnEventSubProcess extends BpmnFlowNodeBase {
|
|
181
203
|
type: "eventSubProcess";
|
|
@@ -183,6 +205,7 @@ export interface BpmnEventSubProcess extends BpmnFlowNodeBase {
|
|
|
183
205
|
sequenceFlows: BpmnSequenceFlow[];
|
|
184
206
|
textAnnotations: BpmnTextAnnotation[];
|
|
185
207
|
associations: BpmnAssociation[];
|
|
208
|
+
groups: BpmnGroup[];
|
|
186
209
|
}
|
|
187
210
|
export interface BpmnExclusiveGateway extends BpmnFlowNodeBase {
|
|
188
211
|
type: "exclusiveGateway";
|
|
@@ -217,6 +240,7 @@ export interface BpmnTransaction extends BpmnFlowNodeBase {
|
|
|
217
240
|
sequenceFlows: BpmnSequenceFlow[];
|
|
218
241
|
textAnnotations: BpmnTextAnnotation[];
|
|
219
242
|
associations: BpmnAssociation[];
|
|
243
|
+
groups: BpmnGroup[];
|
|
220
244
|
}
|
|
221
245
|
/**
|
|
222
246
|
* Discriminated union of every BPMN flow node that can appear inside a
|
|
@@ -233,7 +257,7 @@ export interface BpmnTransaction extends BpmnFlowNodeBase {
|
|
|
233
257
|
* }
|
|
234
258
|
* ```
|
|
235
259
|
*/
|
|
236
|
-
export type BpmnFlowElement = BpmnStartEvent | BpmnEndEvent | BpmnIntermediateCatchEvent | BpmnIntermediateThrowEvent | BpmnBoundaryEvent | BpmnTask | BpmnServiceTask | BpmnScriptTask | BpmnUserTask | BpmnSendTask | BpmnReceiveTask | BpmnBusinessRuleTask | BpmnManualTask | BpmnCallActivity | BpmnSubProcess | BpmnAdHocSubProcess | BpmnEventSubProcess | BpmnTransaction | BpmnExclusiveGateway | BpmnParallelGateway | BpmnInclusiveGateway | BpmnEventBasedGateway | BpmnComplexGateway;
|
|
260
|
+
export type BpmnFlowElement = BpmnStartEvent | BpmnEndEvent | BpmnIntermediateCatchEvent | BpmnIntermediateThrowEvent | BpmnBoundaryEvent | BpmnTask | BpmnServiceTask | BpmnScriptTask | BpmnUserTask | BpmnSendTask | BpmnReceiveTask | BpmnBusinessRuleTask | BpmnManualTask | BpmnCallActivity | BpmnSubProcess | BpmnAdHocSubProcess | BpmnEventSubProcess | BpmnTransaction | BpmnExclusiveGateway | BpmnParallelGateway | BpmnInclusiveGateway | BpmnEventBasedGateway | BpmnComplexGateway | BpmnDataObject | BpmnDataObjectReference | BpmnDataStoreReference;
|
|
237
261
|
/** Backward-compat alias used by the layout module. */
|
|
238
262
|
export type BpmnFlowNode = BpmnFlowElement;
|
|
239
263
|
/**
|
|
@@ -264,6 +288,13 @@ export interface BpmnAssociation {
|
|
|
264
288
|
associationDirection?: string;
|
|
265
289
|
unknownAttributes: Record<string, string>;
|
|
266
290
|
}
|
|
291
|
+
/** A group artifact — a dashed rounded rectangle visually grouping elements. */
|
|
292
|
+
export interface BpmnGroup {
|
|
293
|
+
id: string;
|
|
294
|
+
/** Id of the `categoryValue` supplying the group's label, if any. */
|
|
295
|
+
categoryValueRef?: string;
|
|
296
|
+
unknownAttributes: Record<string, string>;
|
|
297
|
+
}
|
|
267
298
|
/** A swim lane within a pool (organises flow nodes visually). */
|
|
268
299
|
export interface BpmnLane {
|
|
269
300
|
id: string;
|
|
@@ -294,6 +325,7 @@ export interface BpmnProcess {
|
|
|
294
325
|
sequenceFlows: BpmnSequenceFlow[];
|
|
295
326
|
textAnnotations: BpmnTextAnnotation[];
|
|
296
327
|
associations: BpmnAssociation[];
|
|
328
|
+
groups: BpmnGroup[];
|
|
297
329
|
laneSet?: BpmnLaneSet;
|
|
298
330
|
unknownAttributes: Record<string, string>;
|
|
299
331
|
}
|
|
@@ -319,6 +351,7 @@ export interface BpmnCollaboration {
|
|
|
319
351
|
messageFlows: BpmnMessageFlow[];
|
|
320
352
|
textAnnotations: BpmnTextAnnotation[];
|
|
321
353
|
associations: BpmnAssociation[];
|
|
354
|
+
groups: BpmnGroup[];
|
|
322
355
|
extensionElements: XmlElement[];
|
|
323
356
|
unknownAttributes: Record<string, string>;
|
|
324
357
|
}
|
package/dist/bpmn/bpmn-parser.js
CHANGED
|
@@ -59,6 +59,10 @@ const KNOWN_ATTRS = new Set([
|
|
|
59
59
|
"exporter",
|
|
60
60
|
"exporterVersion",
|
|
61
61
|
"processRef",
|
|
62
|
+
"dataObjectRef",
|
|
63
|
+
"dataStoreRef",
|
|
64
|
+
"isCollection",
|
|
65
|
+
"categoryValueRef",
|
|
62
66
|
]);
|
|
63
67
|
/** Extract unknown (namespace-qualified) attributes from an element. */
|
|
64
68
|
function unknownAttrs(element) {
|
|
@@ -261,6 +265,9 @@ const FLOW_ELEMENT_TYPES = new Set([
|
|
|
261
265
|
"inclusiveGateway",
|
|
262
266
|
"eventBasedGateway",
|
|
263
267
|
"complexGateway",
|
|
268
|
+
"dataObject",
|
|
269
|
+
"dataObjectReference",
|
|
270
|
+
"dataStoreReference",
|
|
264
271
|
]);
|
|
265
272
|
function parseFlowElement(element) {
|
|
266
273
|
const ln = localName(element.name);
|
|
@@ -361,6 +368,25 @@ function parseFlowElement(element) {
|
|
|
361
368
|
return { ...base, type: "eventBasedGateway" };
|
|
362
369
|
case "complexGateway":
|
|
363
370
|
return { ...base, type: "complexGateway", default: attr(element, "default") };
|
|
371
|
+
case "dataObject":
|
|
372
|
+
return {
|
|
373
|
+
...base,
|
|
374
|
+
type: "dataObject",
|
|
375
|
+
...(attr(element, "isCollection") === "true" ? { isCollection: true } : {}),
|
|
376
|
+
};
|
|
377
|
+
case "dataObjectReference":
|
|
378
|
+
return {
|
|
379
|
+
...base,
|
|
380
|
+
type: "dataObjectReference",
|
|
381
|
+
dataObjectRef: attr(element, "dataObjectRef"),
|
|
382
|
+
...(attr(element, "isCollection") === "true" ? { isCollection: true } : {}),
|
|
383
|
+
};
|
|
384
|
+
case "dataStoreReference":
|
|
385
|
+
return {
|
|
386
|
+
...base,
|
|
387
|
+
type: "dataStoreReference",
|
|
388
|
+
dataStoreRef: attr(element, "dataStoreRef"),
|
|
389
|
+
};
|
|
364
390
|
default:
|
|
365
391
|
return undefined;
|
|
366
392
|
}
|
|
@@ -407,6 +433,13 @@ function parseAssociation(element) {
|
|
|
407
433
|
unknownAttributes: unknownAttrs(element),
|
|
408
434
|
};
|
|
409
435
|
}
|
|
436
|
+
function parseGroup(element) {
|
|
437
|
+
return {
|
|
438
|
+
id: requiredAttr(element, "id"),
|
|
439
|
+
categoryValueRef: attr(element, "categoryValueRef"),
|
|
440
|
+
unknownAttributes: unknownAttrs(element),
|
|
441
|
+
};
|
|
442
|
+
}
|
|
410
443
|
// ---------------------------------------------------------------------------
|
|
411
444
|
// Process contents (shared between process and adHocSubProcess)
|
|
412
445
|
// ---------------------------------------------------------------------------
|
|
@@ -415,6 +448,7 @@ function parseProcessContents(element) {
|
|
|
415
448
|
const sequenceFlows = [];
|
|
416
449
|
const textAnnotations = [];
|
|
417
450
|
const associations = [];
|
|
451
|
+
const groups = [];
|
|
418
452
|
for (const child of element.children) {
|
|
419
453
|
const ln = localName(child.name);
|
|
420
454
|
if (FLOW_ELEMENT_TYPES.has(ln)) {
|
|
@@ -431,8 +465,11 @@ function parseProcessContents(element) {
|
|
|
431
465
|
else if (ln === "association") {
|
|
432
466
|
associations.push(parseAssociation(child));
|
|
433
467
|
}
|
|
468
|
+
else if (ln === "group") {
|
|
469
|
+
groups.push(parseGroup(child));
|
|
470
|
+
}
|
|
434
471
|
}
|
|
435
|
-
return { flowElements, sequenceFlows, textAnnotations, associations };
|
|
472
|
+
return { flowElements, sequenceFlows, textAnnotations, associations, groups };
|
|
436
473
|
}
|
|
437
474
|
// ---------------------------------------------------------------------------
|
|
438
475
|
// Lanes
|
|
@@ -498,6 +535,7 @@ function parseCollaboration(element) {
|
|
|
498
535
|
messageFlows: findChildren(element, "messageFlow").map(parseMessageFlow),
|
|
499
536
|
textAnnotations: findChildren(element, "textAnnotation").map(parseTextAnnotation),
|
|
500
537
|
associations: findChildren(element, "association").map(parseAssociation),
|
|
538
|
+
groups: findChildren(element, "group").map(parseGroup),
|
|
501
539
|
extensionElements: parseExtensionElements(element),
|
|
502
540
|
unknownAttributes: unknownAttrs(element),
|
|
503
541
|
};
|
|
@@ -233,6 +233,20 @@ function serializeFlowElement(fe, ns) {
|
|
|
233
233
|
case "parallelGateway":
|
|
234
234
|
case "eventBasedGateway":
|
|
235
235
|
break;
|
|
236
|
+
case "dataObject":
|
|
237
|
+
if (fe.isCollection)
|
|
238
|
+
attrs.isCollection = "true";
|
|
239
|
+
break;
|
|
240
|
+
case "dataObjectReference":
|
|
241
|
+
if (fe.dataObjectRef !== undefined)
|
|
242
|
+
attrs.dataObjectRef = fe.dataObjectRef;
|
|
243
|
+
if (fe.isCollection)
|
|
244
|
+
attrs.isCollection = "true";
|
|
245
|
+
break;
|
|
246
|
+
case "dataStoreReference":
|
|
247
|
+
if (fe.dataStoreRef !== undefined)
|
|
248
|
+
attrs.dataStoreRef = fe.dataStoreRef;
|
|
249
|
+
break;
|
|
236
250
|
}
|
|
237
251
|
return el(`${bp}:${fe.type}`, attrs, children);
|
|
238
252
|
}
|
|
@@ -276,6 +290,12 @@ function serializeAssociation(a, bp) {
|
|
|
276
290
|
attrs.associationDirection = a.associationDirection;
|
|
277
291
|
return el(`${bp}:association`, attrs, []);
|
|
278
292
|
}
|
|
293
|
+
function serializeGroup(g, bp) {
|
|
294
|
+
const attrs = { id: g.id, ...g.unknownAttributes };
|
|
295
|
+
if (g.categoryValueRef !== undefined)
|
|
296
|
+
attrs.categoryValueRef = g.categoryValueRef;
|
|
297
|
+
return el(`${bp}:group`, attrs, []);
|
|
298
|
+
}
|
|
279
299
|
// ---------------------------------------------------------------------------
|
|
280
300
|
// Process contents
|
|
281
301
|
// ---------------------------------------------------------------------------
|
|
@@ -294,6 +314,10 @@ function serializeProcessContents(p, ns) {
|
|
|
294
314
|
for (const a of p.associations) {
|
|
295
315
|
children.push(serializeAssociation(a, bp));
|
|
296
316
|
}
|
|
317
|
+
// `groups` may be absent on hand-constructed partial models.
|
|
318
|
+
for (const g of p.groups ?? []) {
|
|
319
|
+
children.push(serializeGroup(g, bp));
|
|
320
|
+
}
|
|
297
321
|
return children;
|
|
298
322
|
}
|
|
299
323
|
// ---------------------------------------------------------------------------
|
|
@@ -370,6 +394,9 @@ function serializeCollaboration(c, ns) {
|
|
|
370
394
|
for (const a of c.associations) {
|
|
371
395
|
children.push(serializeAssociation(a, bp));
|
|
372
396
|
}
|
|
397
|
+
for (const g of c.groups ?? []) {
|
|
398
|
+
children.push(serializeGroup(g, bp));
|
|
399
|
+
}
|
|
373
400
|
return el(`${bp}:collaboration`, { id: c.id, ...c.unknownAttributes }, children);
|
|
374
401
|
}
|
|
375
402
|
// ---------------------------------------------------------------------------
|
package/dist/bpmn/compact.js
CHANGED
|
@@ -192,7 +192,13 @@ function makeExtensions(el) {
|
|
|
192
192
|
}
|
|
193
193
|
function buildSubContent(children) {
|
|
194
194
|
if (!children || children.elements.length === 0) {
|
|
195
|
-
return {
|
|
195
|
+
return {
|
|
196
|
+
flowElements: [],
|
|
197
|
+
sequenceFlows: [],
|
|
198
|
+
textAnnotations: [],
|
|
199
|
+
associations: [],
|
|
200
|
+
groups: [],
|
|
201
|
+
};
|
|
196
202
|
}
|
|
197
203
|
const inc = new Map();
|
|
198
204
|
const out = new Map();
|
|
@@ -217,6 +223,7 @@ function buildSubContent(children) {
|
|
|
217
223
|
})),
|
|
218
224
|
textAnnotations: [],
|
|
219
225
|
associations: [],
|
|
226
|
+
groups: [],
|
|
220
227
|
};
|
|
221
228
|
}
|
|
222
229
|
function buildFlowElement(el, incoming, outgoing) {
|
|
@@ -284,6 +291,8 @@ function buildFlowElement(el, incoming, outgoing) {
|
|
|
284
291
|
return { ...base, type: "eventBasedGateway" };
|
|
285
292
|
case "complexGateway":
|
|
286
293
|
return { ...base, type: "complexGateway" };
|
|
294
|
+
default:
|
|
295
|
+
return { ...base, type: "task" };
|
|
287
296
|
}
|
|
288
297
|
}
|
|
289
298
|
function buildDiagram(processId, process) {
|
|
@@ -342,6 +351,7 @@ function expandProcess(compact) {
|
|
|
342
351
|
sequenceFlows,
|
|
343
352
|
textAnnotations: [],
|
|
344
353
|
associations: [],
|
|
354
|
+
groups: [],
|
|
345
355
|
unknownAttributes: {},
|
|
346
356
|
};
|
|
347
357
|
return { process, diagram: buildDiagram(compact.id, process) };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { BpmnDefinitions, BpmnDiPlane } from "./bpmn-model.js";
|
|
2
|
+
/**
|
|
3
|
+
* Returns the DI plane whose `bpmnElement` matches `elementId`, if any.
|
|
4
|
+
*
|
|
5
|
+
* The primary plane's `bpmnElement` is a process or collaboration id; a
|
|
6
|
+
* collapsed sub-process that carries its own layout has a separate
|
|
7
|
+
* `BPMNDiagram` whose plane `bpmnElement` is the sub-process id. This resolves
|
|
8
|
+
* either.
|
|
9
|
+
*/
|
|
10
|
+
export declare function planeForElement(defs: BpmnDefinitions, elementId: string): BpmnDiPlane | undefined;
|
|
11
|
+
/** Lists every DI plane's `bpmnElement` id, in document order. */
|
|
12
|
+
export declare function listPlaneElementIds(defs: BpmnDefinitions): string[];
|
|
13
|
+
//# sourceMappingURL=di-planes.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the DI plane whose `bpmnElement` matches `elementId`, if any.
|
|
3
|
+
*
|
|
4
|
+
* The primary plane's `bpmnElement` is a process or collaboration id; a
|
|
5
|
+
* collapsed sub-process that carries its own layout has a separate
|
|
6
|
+
* `BPMNDiagram` whose plane `bpmnElement` is the sub-process id. This resolves
|
|
7
|
+
* either.
|
|
8
|
+
*/
|
|
9
|
+
export function planeForElement(defs, elementId) {
|
|
10
|
+
for (const diagram of defs.diagrams) {
|
|
11
|
+
if (diagram.plane.bpmnElement === elementId)
|
|
12
|
+
return diagram.plane;
|
|
13
|
+
}
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
/** Lists every DI plane's `bpmnElement` id, in document order. */
|
|
17
|
+
export function listPlaneElementIds(defs) {
|
|
18
|
+
return defs.diagrams.map((d) => d.plane.bpmnElement);
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=di-planes.js.map
|
package/dist/bpmn/svg.js
CHANGED
|
@@ -155,7 +155,18 @@ export function exportSvg(defs, options) {
|
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
157
|
else {
|
|
158
|
-
|
|
158
|
+
// An expanded sub-process/transaction draws an opaque body rect that must
|
|
159
|
+
// render before (under) its own internal edges and child shapes, the same
|
|
160
|
+
// reason pools/lanes are treated as containers above — otherwise the body
|
|
161
|
+
// paints over everything nested inside it.
|
|
162
|
+
const isExpandedContainer = (type === "subProcess" ||
|
|
163
|
+
type === "adHocSubProcess" ||
|
|
164
|
+
type === "eventSubProcess" ||
|
|
165
|
+
type === "transaction") &&
|
|
166
|
+
shape.isExpanded === true;
|
|
167
|
+
inner = renderTask(el, width, height, t, { expanded: isExpandedContainer });
|
|
168
|
+
if (isExpandedContainer)
|
|
169
|
+
isContainer = true;
|
|
159
170
|
}
|
|
160
171
|
if (inner) {
|
|
161
172
|
const g = `<g transform="translate(${x} ${y})">${inner}</g>`;
|
|
@@ -442,7 +453,7 @@ function renderEvent(el, width, height, t) {
|
|
|
442
453
|
}
|
|
443
454
|
return out;
|
|
444
455
|
}
|
|
445
|
-
function renderTask(el, width, height, t) {
|
|
456
|
+
function renderTask(el, width, height, t, options) {
|
|
446
457
|
const type = el?.type ?? "";
|
|
447
458
|
let sw = 1.5;
|
|
448
459
|
let dash;
|
|
@@ -461,7 +472,15 @@ function renderTask(el, width, height, t) {
|
|
|
461
472
|
out += iconGroup(icon, 4, 4, t);
|
|
462
473
|
}
|
|
463
474
|
if (el?.name) {
|
|
464
|
-
|
|
475
|
+
// An expanded container's name sits in a top label, like a modeler's pool/
|
|
476
|
+
// subprocess header, so it doesn't collide with the child shapes drawn
|
|
477
|
+
// inside it (a centered label would land right where children are placed).
|
|
478
|
+
if (options?.expanded) {
|
|
479
|
+
out += labelSvg(el.name, width / 2, 14, width - 16, t, true);
|
|
480
|
+
}
|
|
481
|
+
else {
|
|
482
|
+
out += labelSvg(el.name, width / 2, height / 2, width - 16, t);
|
|
483
|
+
}
|
|
465
484
|
}
|
|
466
485
|
if (type === "subProcess" ||
|
|
467
486
|
type === "adHocSubProcess" ||
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BpmnAdHocSubProcess, BpmnBoundaryEvent, BpmnBusinessRuleTask, BpmnCallActivity, BpmnComplexGateway, BpmnEndEvent, BpmnEventBasedGateway, BpmnEventSubProcess, BpmnExclusiveGateway, BpmnFlowElement, BpmnInclusiveGateway, BpmnIntermediateCatchEvent, BpmnIntermediateThrowEvent, BpmnManualTask, BpmnParallelGateway, BpmnReceiveTask, BpmnScriptTask, BpmnSendTask, BpmnServiceTask, BpmnStartEvent, BpmnSubProcess, BpmnTask, BpmnTransaction, BpmnUserTask } from "./bpmn-model.js";
|
|
1
|
+
import type { BpmnAdHocSubProcess, BpmnBoundaryEvent, BpmnBusinessRuleTask, BpmnCallActivity, BpmnComplexGateway, BpmnDataObject, BpmnDataObjectReference, BpmnDataStoreReference, BpmnEndEvent, BpmnEventBasedGateway, BpmnEventSubProcess, BpmnExclusiveGateway, BpmnFlowElement, BpmnInclusiveGateway, BpmnIntermediateCatchEvent, BpmnIntermediateThrowEvent, BpmnManualTask, BpmnParallelGateway, BpmnReceiveTask, BpmnScriptTask, BpmnSendTask, BpmnServiceTask, BpmnStartEvent, BpmnSubProcess, BpmnTask, BpmnTransaction, BpmnUserTask } from "./bpmn-model.js";
|
|
2
2
|
/**
|
|
3
3
|
* Narrows a flow element to {@link BpmnStartEvent}.
|
|
4
4
|
*
|
|
@@ -133,4 +133,10 @@ export declare function isBpmnComplexGateway(el: BpmnFlowElement): el is BpmnCom
|
|
|
133
133
|
* ```
|
|
134
134
|
*/
|
|
135
135
|
export declare function isBpmnGateway(el: BpmnFlowElement): el is BpmnExclusiveGateway | BpmnParallelGateway | BpmnInclusiveGateway | BpmnEventBasedGateway | BpmnComplexGateway;
|
|
136
|
+
/** Narrows a flow element to {@link BpmnDataObject}. */
|
|
137
|
+
export declare function isBpmnDataObject(el: BpmnFlowElement): el is BpmnDataObject;
|
|
138
|
+
/** Narrows a flow element to {@link BpmnDataObjectReference}. */
|
|
139
|
+
export declare function isBpmnDataObjectReference(el: BpmnFlowElement): el is BpmnDataObjectReference;
|
|
140
|
+
/** Narrows a flow element to {@link BpmnDataStoreReference}. */
|
|
141
|
+
export declare function isBpmnDataStoreReference(el: BpmnFlowElement): el is BpmnDataStoreReference;
|
|
136
142
|
//# sourceMappingURL=type-guards.d.ts.map
|
package/dist/bpmn/type-guards.js
CHANGED
|
@@ -208,4 +208,17 @@ export function isBpmnGateway(el) {
|
|
|
208
208
|
el.type === "eventBasedGateway" ||
|
|
209
209
|
el.type === "complexGateway");
|
|
210
210
|
}
|
|
211
|
+
// ── Data ──────────────────────────────────────────────────────────────────────
|
|
212
|
+
/** Narrows a flow element to {@link BpmnDataObject}. */
|
|
213
|
+
export function isBpmnDataObject(el) {
|
|
214
|
+
return el.type === "dataObject";
|
|
215
|
+
}
|
|
216
|
+
/** Narrows a flow element to {@link BpmnDataObjectReference}. */
|
|
217
|
+
export function isBpmnDataObjectReference(el) {
|
|
218
|
+
return el.type === "dataObjectReference";
|
|
219
|
+
}
|
|
220
|
+
/** Narrows a flow element to {@link BpmnDataStoreReference}. */
|
|
221
|
+
export function isBpmnDataStoreReference(el) {
|
|
222
|
+
return el.type === "dataStoreReference";
|
|
223
|
+
}
|
|
211
224
|
//# sourceMappingURL=type-guards.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
export { BpmnSdkError, ParseError, ValidationError } from "./errors.js";
|
|
2
2
|
export type { ErrorCode } from "./errors.js";
|
|
3
|
-
export { isBpmnActivity, isBpmnAdHocSubProcess, isBpmnBoundaryEvent, isBpmnBusinessRuleTask, isBpmnCallActivity, isBpmnComplexGateway, isBpmnEndEvent, isBpmnEvent, isBpmnEventBasedGateway, isBpmnEventSubProcess, isBpmnExclusiveGateway, isBpmnGateway, isBpmnInclusiveGateway, isBpmnIntermediateCatchEvent, isBpmnIntermediateThrowEvent, isBpmnManualTask, isBpmnParallelGateway, isBpmnReceiveTask, isBpmnScriptTask, isBpmnSendTask, isBpmnServiceTask, isBpmnStartEvent, isBpmnSubProcess, isBpmnTask, isBpmnTransaction, isBpmnUserTask, } from "./bpmn/type-guards.js";
|
|
3
|
+
export { isBpmnActivity, isBpmnAdHocSubProcess, isBpmnBoundaryEvent, isBpmnBusinessRuleTask, isBpmnCallActivity, isBpmnComplexGateway, isBpmnDataObject, isBpmnDataObjectReference, isBpmnDataStoreReference, isBpmnEndEvent, isBpmnEvent, isBpmnEventBasedGateway, isBpmnEventSubProcess, isBpmnExclusiveGateway, isBpmnGateway, isBpmnInclusiveGateway, isBpmnIntermediateCatchEvent, isBpmnIntermediateThrowEvent, isBpmnManualTask, isBpmnParallelGateway, isBpmnReceiveTask, isBpmnScriptTask, isBpmnSendTask, isBpmnServiceTask, isBpmnStartEvent, isBpmnSubProcess, isBpmnTask, isBpmnTransaction, isBpmnUserTask, } from "./bpmn/type-guards.js";
|
|
4
4
|
export { findElement, findElementInProcess, findProcess, findSequenceFlow, getAllElements, getElementType, getZeebeExtensions, } from "./bpmn/utils.js";
|
|
5
5
|
export { Bpmn, SAMPLE_BPMN_XML } from "./bpmn/index.js";
|
|
6
6
|
export { applyAutoLayout } from "./bpmn/auto-layout.js";
|
|
7
7
|
export { checkDiCompleteness } from "./bpmn/di-check.js";
|
|
8
8
|
export type { DiCompleteness } from "./bpmn/di-check.js";
|
|
9
|
+
export { planeForElement, listPlaneElementIds } from "./bpmn/di-planes.js";
|
|
9
10
|
export { DiagramBuilder } from "./bpmn/bpmn-builder.js";
|
|
10
11
|
export type { ProcessBuilder, BranchBuilder, SubProcessContentBuilder, ServiceTaskOptions, ScriptTaskOptions, UserTaskOptions, CallActivityOptions, BusinessRuleTaskOptions, ElementOptions, GatewayOptions, MultiInstanceOptions, SubProcessOptions, StartEventOptions, IntermediateCatchEventOptions, IntermediateThrowEventOptions, EndEventOptions, BoundaryEventOptions, AdHocSubProcessOptions, } from "./bpmn/bpmn-builder.js";
|
|
11
|
-
export type { BpmnDefinitions, BpmnProcess, BpmnFlowNode, BpmnFlowElement, BpmnSequenceFlow, BpmnBoundaryEvent, BpmnElementType, BpmnStartEvent, BpmnEndEvent, BpmnIntermediateCatchEvent, BpmnIntermediateThrowEvent, BpmnTask, BpmnServiceTask, BpmnScriptTask, BpmnUserTask, BpmnSendTask, BpmnReceiveTask, BpmnBusinessRuleTask, BpmnManualTask, BpmnCallActivity, BpmnSubProcess, BpmnAdHocSubProcess, BpmnEventSubProcess, BpmnTransaction, BpmnExclusiveGateway, BpmnParallelGateway, BpmnInclusiveGateway, BpmnEventBasedGateway, BpmnComplexGateway, BpmnCollaboration, BpmnParticipant, BpmnMessageFlow, BpmnLane, BpmnLaneSet, BpmnError, BpmnEscalation, BpmnMessage, BpmnSignal, BpmnTextAnnotation, BpmnAssociation, BpmnConditionExpression, BpmnEventDefinition, BpmnTimerEventDefinition, BpmnErrorEventDefinition, BpmnEscalationEventDefinition, BpmnMessageEventDefinition, BpmnSignalEventDefinition, BpmnConditionalEventDefinition, BpmnLinkEventDefinition, BpmnCancelEventDefinition, BpmnTerminateEventDefinition, BpmnCompensateEventDefinition, BpmnMultiInstanceLoopCharacteristics, BpmnDiagram, BpmnDiPlane, BpmnDiShape, BpmnDiEdge, BpmnDiLabel, BpmnBounds, BpmnWaypoint, } from "./bpmn/bpmn-model.js";
|
|
12
|
+
export type { BpmnDefinitions, BpmnProcess, BpmnFlowNode, BpmnFlowElement, BpmnSequenceFlow, BpmnBoundaryEvent, BpmnElementType, BpmnStartEvent, BpmnEndEvent, BpmnIntermediateCatchEvent, BpmnIntermediateThrowEvent, BpmnTask, BpmnServiceTask, BpmnScriptTask, BpmnUserTask, BpmnSendTask, BpmnReceiveTask, BpmnBusinessRuleTask, BpmnManualTask, BpmnCallActivity, BpmnSubProcess, BpmnAdHocSubProcess, BpmnEventSubProcess, BpmnTransaction, BpmnExclusiveGateway, BpmnParallelGateway, BpmnInclusiveGateway, BpmnEventBasedGateway, BpmnComplexGateway, BpmnCollaboration, BpmnParticipant, BpmnMessageFlow, BpmnLane, BpmnLaneSet, BpmnError, BpmnEscalation, BpmnMessage, BpmnSignal, BpmnTextAnnotation, BpmnAssociation, BpmnGroup, BpmnDataObject, BpmnDataObjectReference, BpmnDataStoreReference, BpmnConditionExpression, BpmnEventDefinition, BpmnTimerEventDefinition, BpmnErrorEventDefinition, BpmnEscalationEventDefinition, BpmnMessageEventDefinition, BpmnSignalEventDefinition, BpmnConditionalEventDefinition, BpmnLinkEventDefinition, BpmnCancelEventDefinition, BpmnTerminateEventDefinition, BpmnCompensateEventDefinition, BpmnMultiInstanceLoopCharacteristics, BpmnDiagram, BpmnDiPlane, BpmnDiShape, BpmnDiEdge, BpmnDiLabel, BpmnBounds, BpmnWaypoint, } from "./bpmn/bpmn-model.js";
|
|
12
13
|
export type { RestConnectorConfig, RestAuthentication, HttpMethod, } from "./bpmn/rest-connector.js";
|
|
13
14
|
export type { ZeebeExtensions, ZeebeTaskDefinition, ZeebeIoMapping, ZeebeIoMappingEntry, ZeebeTaskHeaders, ZeebeTaskHeaderEntry, ZeebeProperties, ZeebePropertyEntry, ZeebeFormDefinition, ZeebeCalledDecision, } from "./bpmn/zeebe-extensions.js";
|
|
14
15
|
export { zeebeExtensionsToXmlElements } from "./bpmn/zeebe-extensions.js";
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
export { BpmnSdkError, ParseError, ValidationError } from "./errors.js";
|
|
2
|
-
export { isBpmnActivity, isBpmnAdHocSubProcess, isBpmnBoundaryEvent, isBpmnBusinessRuleTask, isBpmnCallActivity, isBpmnComplexGateway, isBpmnEndEvent, isBpmnEvent, isBpmnEventBasedGateway, isBpmnEventSubProcess, isBpmnExclusiveGateway, isBpmnGateway, isBpmnInclusiveGateway, isBpmnIntermediateCatchEvent, isBpmnIntermediateThrowEvent, isBpmnManualTask, isBpmnParallelGateway, isBpmnReceiveTask, isBpmnScriptTask, isBpmnSendTask, isBpmnServiceTask, isBpmnStartEvent, isBpmnSubProcess, isBpmnTask, isBpmnTransaction, isBpmnUserTask, } from "./bpmn/type-guards.js";
|
|
2
|
+
export { isBpmnActivity, isBpmnAdHocSubProcess, isBpmnBoundaryEvent, isBpmnBusinessRuleTask, isBpmnCallActivity, isBpmnComplexGateway, isBpmnDataObject, isBpmnDataObjectReference, isBpmnDataStoreReference, isBpmnEndEvent, isBpmnEvent, isBpmnEventBasedGateway, isBpmnEventSubProcess, isBpmnExclusiveGateway, isBpmnGateway, isBpmnInclusiveGateway, isBpmnIntermediateCatchEvent, isBpmnIntermediateThrowEvent, isBpmnManualTask, isBpmnParallelGateway, isBpmnReceiveTask, isBpmnScriptTask, isBpmnSendTask, isBpmnServiceTask, isBpmnStartEvent, isBpmnSubProcess, isBpmnTask, isBpmnTransaction, isBpmnUserTask, } from "./bpmn/type-guards.js";
|
|
3
3
|
export { findElement, findElementInProcess, findProcess, findSequenceFlow, getAllElements, getElementType, getZeebeExtensions, } from "./bpmn/utils.js";
|
|
4
4
|
export { Bpmn, SAMPLE_BPMN_XML } from "./bpmn/index.js";
|
|
5
5
|
export { applyAutoLayout } from "./bpmn/auto-layout.js";
|
|
6
6
|
export { checkDiCompleteness } from "./bpmn/di-check.js";
|
|
7
|
+
export { planeForElement, listPlaneElementIds } from "./bpmn/di-planes.js";
|
|
7
8
|
export { DiagramBuilder } from "./bpmn/bpmn-builder.js";
|
|
8
9
|
export { zeebeExtensionsToXmlElements } from "./bpmn/zeebe-extensions.js";
|
|
9
10
|
export { Dmn, layoutDmn, benchmarkDmnLayout, compactifyDmn, expandDmn } from "./dmn/index.js";
|