@aranzatech/diagrams-bpmn 0.2.12 → 0.2.14
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/{catalog-BKdtbOQT.d.ts → catalog-CK3_4cOb.d.ts} +1 -1
- package/dist/{catalog-DUfPajtM.d.cts → catalog-xOMF2ifW.d.cts} +1 -1
- package/dist/chunk-FBTGIYZS.js +218 -0
- package/dist/chunk-FBTGIYZS.js.map +1 -0
- package/dist/{chunk-O3NWJ5H7.js → chunk-QSMP34CT.js} +38 -5
- package/dist/chunk-QSMP34CT.js.map +1 -0
- package/dist/{chunk-MZVDC6FU.js → chunk-YUE5EM3W.js} +76 -10
- package/dist/chunk-YUE5EM3W.js.map +1 -0
- package/dist/edges/index.cjs +35 -2
- package/dist/edges/index.cjs.map +1 -1
- package/dist/edges/index.js +1 -1
- package/dist/elements/index.cjs +217 -0
- package/dist/elements/index.cjs.map +1 -1
- package/dist/elements/index.d.cts +15 -16
- package/dist/elements/index.d.ts +15 -16
- package/dist/elements/index.js +1 -1
- package/dist/guards-C70uIY_O.d.cts +16 -0
- package/dist/guards-foB6XIfZ.d.ts +16 -0
- package/dist/index.cjs +109 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +3 -3
- package/dist/layout/index.cjs +55 -19
- package/dist/layout/index.cjs.map +1 -1
- package/dist/layout/index.d.cts +17 -11
- package/dist/layout/index.d.ts +17 -11
- package/dist/layout/index.js +55 -19
- package/dist/layout/index.js.map +1 -1
- package/dist/modeling/index.d.cts +3 -3
- package/dist/modeling/index.d.ts +3 -3
- package/dist/{types-kI1SiQB4.d.ts → types-DG5yPKld.d.ts} +1 -1
- package/dist/{types-44yNtMtO.d.cts → types-jIDz306Y.d.cts} +1 -1
- package/dist/{types-hgmLfRA9.d.cts → types-y-ZbX-ff.d.cts} +32 -1
- package/dist/{types-hgmLfRA9.d.ts → types-y-ZbX-ff.d.ts} +32 -1
- package/dist/validation/index.d.cts +2 -2
- package/dist/validation/index.d.ts +2 -2
- package/dist/xml/index.cjs +74 -8
- package/dist/xml/index.cjs.map +1 -1
- package/dist/xml/index.d.cts +3 -3
- package/dist/xml/index.d.ts +3 -3
- package/dist/xml/index.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-MZVDC6FU.js.map +0 -1
- package/dist/chunk-O3NWJ5H7.js.map +0 -1
- package/dist/chunk-OZKTOILD.js +0 -3
- package/dist/chunk-OZKTOILD.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var react = require('@xyflow/react');
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
var react$1 = require('react');
|
|
5
6
|
var routing = require('@aranzatech/diagrams-core/routing');
|
|
6
7
|
var diagramsCore = require('@aranzatech/diagrams-core');
|
|
7
8
|
var serialization = require('@aranzatech/diagrams-core/serialization');
|
|
@@ -2291,6 +2292,33 @@ function SequenceFlowEdge({
|
|
|
2291
2292
|
const path = points && points.length >= 2 ? routing.pointsToSvgPath([{ x: sourceX, y: sourceY }, ...points.slice(1, -1), { x: targetX, y: targetY }]) : routing.getOrthogonalPath(sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition);
|
|
2292
2293
|
const midpoint = getPolylineMidpoint(polyline);
|
|
2293
2294
|
const defaultMarkerPath = d?.isDefault ? getDefaultFlowMarkerPath(polyline) : null;
|
|
2295
|
+
const labelX = midpoint.x + (d?.labelOffsetX ?? 0);
|
|
2296
|
+
const labelY = midpoint.y + (d?.labelOffsetY ?? 0);
|
|
2297
|
+
const { updateEdgeData, getViewport } = react.useReactFlow();
|
|
2298
|
+
const dragStartRef = react$1.useRef(null);
|
|
2299
|
+
const handleLabelPointerDown = react$1.useCallback((e) => {
|
|
2300
|
+
e.stopPropagation();
|
|
2301
|
+
e.currentTarget.setPointerCapture(e.pointerId);
|
|
2302
|
+
dragStartRef.current = {
|
|
2303
|
+
mx: e.clientX,
|
|
2304
|
+
my: e.clientY,
|
|
2305
|
+
ox: d?.labelOffsetX ?? 0,
|
|
2306
|
+
oy: d?.labelOffsetY ?? 0
|
|
2307
|
+
};
|
|
2308
|
+
}, [d?.labelOffsetX, d?.labelOffsetY]);
|
|
2309
|
+
const handleLabelPointerMove = react$1.useCallback((e) => {
|
|
2310
|
+
if (!dragStartRef.current) return;
|
|
2311
|
+
const { zoom } = getViewport();
|
|
2312
|
+
const dx = (e.clientX - dragStartRef.current.mx) / zoom;
|
|
2313
|
+
const dy = (e.clientY - dragStartRef.current.my) / zoom;
|
|
2314
|
+
updateEdgeData(id, {
|
|
2315
|
+
labelOffsetX: dragStartRef.current.ox + dx,
|
|
2316
|
+
labelOffsetY: dragStartRef.current.oy + dy
|
|
2317
|
+
});
|
|
2318
|
+
}, [id, updateEdgeData, getViewport]);
|
|
2319
|
+
const handleLabelPointerUp = react$1.useCallback(() => {
|
|
2320
|
+
dragStartRef.current = null;
|
|
2321
|
+
}, []);
|
|
2294
2322
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2295
2323
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2296
2324
|
react.BaseEdge,
|
|
@@ -2320,15 +2348,20 @@ function SequenceFlowEdge({
|
|
|
2320
2348
|
(label ?? d?.label) && /* @__PURE__ */ jsxRuntime.jsx(react.EdgeLabelRenderer, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2321
2349
|
"div",
|
|
2322
2350
|
{
|
|
2351
|
+
onPointerDown: handleLabelPointerDown,
|
|
2352
|
+
onPointerMove: handleLabelPointerMove,
|
|
2353
|
+
onPointerUp: handleLabelPointerUp,
|
|
2323
2354
|
style: {
|
|
2324
2355
|
position: "absolute",
|
|
2325
|
-
transform: `translate(-50%,-50%) translate(${
|
|
2356
|
+
transform: `translate(-50%,-50%) translate(${labelX}px,${labelY}px)`,
|
|
2326
2357
|
fontSize: 11,
|
|
2327
2358
|
fontFamily: "Inter, system-ui, sans-serif",
|
|
2328
2359
|
background: "rgba(255,255,255,0.85)",
|
|
2329
2360
|
padding: "1px 4px",
|
|
2330
2361
|
borderRadius: 2,
|
|
2331
|
-
pointerEvents: "all"
|
|
2362
|
+
pointerEvents: "all",
|
|
2363
|
+
cursor: "grab",
|
|
2364
|
+
userSelect: "none"
|
|
2332
2365
|
},
|
|
2333
2366
|
className: "nodrag nopan",
|
|
2334
2367
|
children: label ?? d?.label
|
|
@@ -2524,6 +2557,24 @@ var ARANZA_DESCRIPTOR = {
|
|
|
2524
2557
|
{ name: "skipExpression", isAttr: true, type: "String" },
|
|
2525
2558
|
{ name: "businessCalendarName", isAttr: true, type: "String" }
|
|
2526
2559
|
]
|
|
2560
|
+
},
|
|
2561
|
+
{
|
|
2562
|
+
// BusinessRuleTask: simplified inline decision table (JSON-serialized)
|
|
2563
|
+
name: "InlineDecision",
|
|
2564
|
+
superClass: ["Element"],
|
|
2565
|
+
properties: [
|
|
2566
|
+
{ name: "hitPolicy", isAttr: true, type: "String" },
|
|
2567
|
+
{ name: "tableJson", isAttr: true, type: "String" }
|
|
2568
|
+
]
|
|
2569
|
+
},
|
|
2570
|
+
{
|
|
2571
|
+
// MessageFlow: payload schema + correlation key for executable BPMN
|
|
2572
|
+
name: "MessageFlowConfig",
|
|
2573
|
+
superClass: ["Element"],
|
|
2574
|
+
properties: [
|
|
2575
|
+
{ name: "payloadSchema", isAttr: true, type: "String" },
|
|
2576
|
+
{ name: "correlationKey", isAttr: true, type: "String" }
|
|
2577
|
+
]
|
|
2527
2578
|
}
|
|
2528
2579
|
],
|
|
2529
2580
|
enumerations: [],
|
|
@@ -2813,7 +2864,20 @@ function extractAranzaExtensions(el) {
|
|
|
2813
2864
|
}
|
|
2814
2865
|
const ext = el.extensionElements;
|
|
2815
2866
|
if (!ext) return result;
|
|
2816
|
-
const
|
|
2867
|
+
const extValues = asElements(ext.values);
|
|
2868
|
+
const inlineDecision = extValues.find((v) => v.$type === "aranza:InlineDecision");
|
|
2869
|
+
if (inlineDecision) {
|
|
2870
|
+
const hitPolicy = asString(inlineDecision.hitPolicy) ?? "UNIQUE";
|
|
2871
|
+
const tableJson = asString(inlineDecision.tableJson);
|
|
2872
|
+
if (tableJson) {
|
|
2873
|
+
try {
|
|
2874
|
+
const parsed = JSON.parse(tableJson);
|
|
2875
|
+
result.inlineDecisionTable = { hitPolicy, ...parsed };
|
|
2876
|
+
} catch {
|
|
2877
|
+
}
|
|
2878
|
+
}
|
|
2879
|
+
}
|
|
2880
|
+
const taskConfig = extValues.find((v) => v.$type === "aranza:TaskConfig");
|
|
2817
2881
|
if (!taskConfig) return result;
|
|
2818
2882
|
const priority = asString(taskConfig.priority);
|
|
2819
2883
|
if (priority === "critical" || priority === "high" || priority === "medium" || priority === "low") {
|
|
@@ -2971,12 +3035,26 @@ function buildEdge(el, edgeType, ctx, edges) {
|
|
|
2971
3035
|
const condExpr = el.conditionExpression;
|
|
2972
3036
|
const rawDir = asString(el.associationDirection);
|
|
2973
3037
|
const associationDirection = edgeType === "association" && rawDir ? rawDir.toLowerCase() : void 0;
|
|
3038
|
+
let payloadSchema;
|
|
3039
|
+
let correlationKey;
|
|
3040
|
+
if (edgeType === "messageFlow") {
|
|
3041
|
+
const mfExt = el.extensionElements;
|
|
3042
|
+
if (mfExt) {
|
|
3043
|
+
const mfConfig = asElements(mfExt.values).find((v) => v.$type === "aranza:MessageFlowConfig");
|
|
3044
|
+
if (mfConfig) {
|
|
3045
|
+
payloadSchema = asString(mfConfig.payloadSchema) || void 0;
|
|
3046
|
+
correlationKey = asString(mfConfig.correlationKey) || void 0;
|
|
3047
|
+
}
|
|
3048
|
+
}
|
|
3049
|
+
}
|
|
2974
3050
|
const data = {
|
|
2975
3051
|
edgeType,
|
|
2976
3052
|
...label ? { label } : {},
|
|
2977
3053
|
...documentation ? { documentation } : {},
|
|
2978
3054
|
...condExpr?.body ? { conditionExpression: condExpr.body } : {},
|
|
2979
|
-
...associationDirection ? { associationDirection } : {}
|
|
3055
|
+
...associationDirection ? { associationDirection } : {},
|
|
3056
|
+
...payloadSchema ? { payloadSchema } : {},
|
|
3057
|
+
...correlationKey ? { correlationKey } : {}
|
|
2980
3058
|
};
|
|
2981
3059
|
const waypoints = ctx.waypoints.get(id);
|
|
2982
3060
|
if (waypoints?.length) data.routingPoints = waypoints;
|
|
@@ -3263,8 +3341,19 @@ function buildAranzaExtensionElements(moddle, node) {
|
|
|
3263
3341
|
if (dueDate) configAttrs.dueDate = dueDate;
|
|
3264
3342
|
if (skipExpression) configAttrs.skipExpression = skipExpression;
|
|
3265
3343
|
if (businessCalendarName) configAttrs.businessCalendarName = businessCalendarName;
|
|
3266
|
-
const
|
|
3267
|
-
|
|
3344
|
+
const values = [moddle.create("aranza:TaskConfig", configAttrs)];
|
|
3345
|
+
const inlineDecisionTable = node.data.inlineDecisionTable;
|
|
3346
|
+
if (inlineDecisionTable && typeof inlineDecisionTable === "object") {
|
|
3347
|
+
const tbl = inlineDecisionTable;
|
|
3348
|
+
const { hitPolicy, ...rest } = tbl;
|
|
3349
|
+
values.push(
|
|
3350
|
+
moddle.create("aranza:InlineDecision", {
|
|
3351
|
+
hitPolicy: hitPolicy ?? "UNIQUE",
|
|
3352
|
+
tableJson: JSON.stringify(rest)
|
|
3353
|
+
})
|
|
3354
|
+
);
|
|
3355
|
+
}
|
|
3356
|
+
return moddle.create("bpmn:ExtensionElements", { values });
|
|
3268
3357
|
}
|
|
3269
3358
|
var ARTIFACT_ELEMENT_TYPES = /* @__PURE__ */ new Set(["Annotation", "Group"]);
|
|
3270
3359
|
function buildSemanticModel(moddle, nodes, edges, opts) {
|
|
@@ -3301,14 +3390,24 @@ function buildSemanticModel(moddle, nodes, edges, opts) {
|
|
|
3301
3390
|
}
|
|
3302
3391
|
const messageFlowEdges = edges.filter((e) => e.data?.edgeType === "messageFlow");
|
|
3303
3392
|
const conversationLinkEdges = edges.filter((e) => e.data?.edgeType === "conversationLink");
|
|
3304
|
-
const messageFlows = messageFlowEdges.map(
|
|
3305
|
-
|
|
3393
|
+
const messageFlows = messageFlowEdges.map((e) => {
|
|
3394
|
+
const ps = typeof e.data?.payloadSchema === "string" ? e.data.payloadSchema : void 0;
|
|
3395
|
+
const ck = typeof e.data?.correlationKey === "string" ? e.data.correlationKey : void 0;
|
|
3396
|
+
const mfAttrs = {
|
|
3306
3397
|
id: e.id,
|
|
3307
3398
|
name: e.data?.label ?? "",
|
|
3308
3399
|
sourceRef: { id: e.source },
|
|
3309
3400
|
targetRef: { id: e.target }
|
|
3310
|
-
}
|
|
3311
|
-
|
|
3401
|
+
};
|
|
3402
|
+
if (ps || ck) {
|
|
3403
|
+
const cfg = moddle.create("aranza:MessageFlowConfig", {
|
|
3404
|
+
...ps ? { payloadSchema: ps } : {},
|
|
3405
|
+
...ck ? { correlationKey: ck } : {}
|
|
3406
|
+
});
|
|
3407
|
+
mfAttrs.extensionElements = moddle.create("bpmn:ExtensionElements", { values: [cfg] });
|
|
3408
|
+
}
|
|
3409
|
+
return moddle.create("bpmn:MessageFlow", mfAttrs);
|
|
3410
|
+
});
|
|
3312
3411
|
const conversationLinks = conversationLinkEdges.map(
|
|
3313
3412
|
(e) => moddle.create("bpmn:ConversationLink", {
|
|
3314
3413
|
id: e.id,
|