@aranzatech/diagrams-bpmn 0.2.1 → 0.2.3
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-OVnBDD8R.d.ts → catalog-DIBySQqA.d.ts} +1 -1
- package/dist/{catalog-OWfI_yHU.d.cts → catalog-m8fHIiKH.d.cts} +1 -1
- package/dist/{chunk-YQTIODXH.js → chunk-7MKU37XQ.js} +144 -5
- package/dist/chunk-7MKU37XQ.js.map +1 -0
- package/dist/{chunk-57LA2WSJ.js → chunk-QOGZITWB.js} +10 -6
- package/dist/chunk-QOGZITWB.js.map +1 -0
- package/dist/elements/index.d.cts +1 -1
- package/dist/elements/index.d.ts +1 -1
- package/dist/index.cjs +158 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/modeling/index.cjs +150 -1
- package/dist/modeling/index.cjs.map +1 -1
- package/dist/modeling/index.d.cts +46 -2
- package/dist/modeling/index.d.ts +46 -2
- package/dist/modeling/index.js +1 -1
- package/dist/simulation/index.cjs +8 -4
- package/dist/simulation/index.cjs.map +1 -1
- package/dist/simulation/index.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-57LA2WSJ.js.map +0 -1
- package/dist/chunk-YQTIODXH.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { B as BPMN_ELEMENT_CATALOG, a as BPMN_RESIZABLE_ELEMENT_TYPES, g as getBpmnElementSize, b as getElementMeta, i as isBpmnElementResizable } from './catalog-
|
|
1
|
+
export { B as BPMN_ELEMENT_CATALOG, a as BPMN_RESIZABLE_ELEMENT_TYPES, g as getBpmnElementSize, b as getElementMeta, i as isBpmnElementResizable } from './catalog-m8fHIiKH.cjs';
|
|
2
2
|
export { acceptsBoundaryEvents, getHandlePolicy, getOrientation, isChoreographyType, isContainerType, isConversationType, isDataType, isEventType, isGatewayType, isTaskType, supportsCollapse, supportsMarkers } from './elements/index.cjs';
|
|
3
3
|
export { B as BpmnCategory, a as BpmnEdgeData, b as BpmnEdgeType, c as BpmnElementMeta, d as BpmnElementSize, e as BpmnElementType, f as BpmnEventSemantics, g as BpmnHandlePolicy, h as BpmnNodeData, i as BpmnOrientation, E as EventTrigger, S as SubProcessVariant, T as TaskMarker } from './types-DznxZxpV.cjs';
|
|
4
4
|
export { AnnotationNode, BPMN_NODE_TYPES, BoundaryEventNode, CallChoreographyNode, CallConversationNode, ChoreographyTaskNode, ConversationNode, DataInputNode, DataObjectNode, DataObjectReferenceNode, DataOutputNode, DataStoreNode, DataStoreReferenceNode, EndEventNode, GatewayNode, GroupNode, IntermediateCatchEventNode, IntermediateThrowEventNode, LaneNode, PoolNode, StartEventNode, SubChoreographyNode, SubConversationNode, SubProcessNode, TaskNode } from './nodes/index.cjs';
|
|
@@ -6,7 +6,7 @@ export { AssociationEdge, BPMN_EDGE_TYPES, ConversationLinkEdge, DataAssociation
|
|
|
6
6
|
export { parseBpmnXml, serializeBpmnXml } from './xml/index.cjs';
|
|
7
7
|
export { B as BpmnExportOptions, a as BpmnImportResult, b as BpmnRFEdge, c as BpmnRFNode } from './types-vVi5T7qj.cjs';
|
|
8
8
|
export { SimDiagram, SimEdge, SimLogEntry, SimLogType, SimNode, SimStatus, SimToken, SimVariables, SimulationState, createSimulation, fire, getFireable, isCompleted, setVariable, tick } from './simulation/index.cjs';
|
|
9
|
-
export { BPMN_EDGE_CONNECTION_RULES, BPMN_MODELING_RULES, BPMN_POOL_LANE_LAYOUT, BPMN_ROUTABLE_EDGE_TYPES, BPMN_SELECTION_STYLE, BpmnClipboardState, BpmnConnectionRule, BpmnDiagramDocument, BpmnDiagramState, ConnectBpmnOptions, CreateBpmnNodeOptions, MoveBpmnLaneOptions, PasteBpmnOptions, ReorderBpmnLaneOptions, ReparentBpmnNodeOptions, ReplaceBpmnNodeOptions, ResizeBpmnNodeOptions, RouteBpmnEdgeOptions, attachBoundaryEventCommand, bpmnConnectionValidators, canContainBpmnElement, connectBpmnCommand, copyBpmnElements, createBpmnDiagramDocument, createBpmnNode, createBpmnNodeCommand, deleteBpmnElementsCommand, deserializeBpmnDiagram, getBpmnDragHandleSelector, getBpmnLaneIndexAtPosition, getBpmnPoolLanes, inferBpmnEdgeType, isBpmnEdgeRoutingEditable, isBpmnProcessNode, layoutBpmnPoolLanes, moveBpmnLaneCommand, parseBpmnDiagramDocument, pasteBpmnElementsCommand, reorderBpmnLane, reorderBpmnLaneCommand, reparentBpmnNodeCommand, replaceBpmnNodeCommand, resizeBpmnNodeCommand, routeBpmnEdgeCommand, runBpmnCommand, runBpmnCommands, selectBpmnElementsCommand, serializeBpmnDiagram, validateBpmnConnectionForEdgeType } from './modeling/index.cjs';
|
|
9
|
+
export { BPMN_EDGE_CONNECTION_RULES, BPMN_MODELING_RULES, BPMN_POOL_LANE_LAYOUT, BPMN_ROUTABLE_EDGE_TYPES, BPMN_SELECTION_STYLE, BpmnClipboardState, BpmnConnectionRule, BpmnDiagramDocument, BpmnDiagramState, ConnectBpmnOptions, CreateBpmnNodeOptions, FindBpmnContainerAtOptions, MoveBpmnLaneOptions, PasteBpmnOptions, ReorderBpmnLaneOptions, ReparentBpmnNodeAtPositionOptions, ReparentBpmnNodeOptions, ReplaceBpmnNodeOptions, ResizeBpmnNodeOptions, RouteBpmnEdgeOptions, attachBoundaryEventCommand, bpmnConnectionValidators, canContainBpmnElement, connectBpmnCommand, copyBpmnElements, createBpmnDiagramDocument, createBpmnNode, createBpmnNodeCommand, deleteBpmnElementsCommand, deserializeBpmnDiagram, findBpmnContainerAt, getBpmnDragHandleSelector, getBpmnLaneIndexAtPosition, getBpmnNodeAbsolutePosition, getBpmnNodeCenter, getBpmnNodeSize, getBpmnNodeZIndex, getBpmnPoolLanes, inferBpmnEdgeType, isBpmnEdgeRoutingEditable, isBpmnProcessNode, layoutBpmnPoolLaneNodes, layoutBpmnPoolLanes, moveBpmnLaneCommand, parseBpmnDiagramDocument, pasteBpmnElementsCommand, reorderBpmnLane, reorderBpmnLaneAfterDrop, reorderBpmnLaneCommand, reparentBpmnNodeAtPosition, reparentBpmnNodeCommand, replaceBpmnNodeCommand, resizeBpmnNodeCommand, routeBpmnEdgeCommand, runBpmnCommand, runBpmnCommands, selectBpmnElementsCommand, serializeBpmnDiagram, toBpmnRelativePosition, validateBpmnConnectionForEdgeType, withBpmnNodeZIndexes } from './modeling/index.cjs';
|
|
10
10
|
export { BpmnValidationIssue, BpmnValidationOptions, BpmnValidationResult, BpmnValidationSeverity, validateBpmnDiagram } from './validation/index.cjs';
|
|
11
11
|
import 'react/jsx-runtime';
|
|
12
12
|
import '@xyflow/react';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { B as BPMN_ELEMENT_CATALOG, a as BPMN_RESIZABLE_ELEMENT_TYPES, g as getBpmnElementSize, b as getElementMeta, i as isBpmnElementResizable } from './catalog-
|
|
1
|
+
export { B as BPMN_ELEMENT_CATALOG, a as BPMN_RESIZABLE_ELEMENT_TYPES, g as getBpmnElementSize, b as getElementMeta, i as isBpmnElementResizable } from './catalog-DIBySQqA.js';
|
|
2
2
|
export { acceptsBoundaryEvents, getHandlePolicy, getOrientation, isChoreographyType, isContainerType, isConversationType, isDataType, isEventType, isGatewayType, isTaskType, supportsCollapse, supportsMarkers } from './elements/index.js';
|
|
3
3
|
export { B as BpmnCategory, a as BpmnEdgeData, b as BpmnEdgeType, c as BpmnElementMeta, d as BpmnElementSize, e as BpmnElementType, f as BpmnEventSemantics, g as BpmnHandlePolicy, h as BpmnNodeData, i as BpmnOrientation, E as EventTrigger, S as SubProcessVariant, T as TaskMarker } from './types-DznxZxpV.js';
|
|
4
4
|
export { AnnotationNode, BPMN_NODE_TYPES, BoundaryEventNode, CallChoreographyNode, CallConversationNode, ChoreographyTaskNode, ConversationNode, DataInputNode, DataObjectNode, DataObjectReferenceNode, DataOutputNode, DataStoreNode, DataStoreReferenceNode, EndEventNode, GatewayNode, GroupNode, IntermediateCatchEventNode, IntermediateThrowEventNode, LaneNode, PoolNode, StartEventNode, SubChoreographyNode, SubConversationNode, SubProcessNode, TaskNode } from './nodes/index.js';
|
|
@@ -6,7 +6,7 @@ export { AssociationEdge, BPMN_EDGE_TYPES, ConversationLinkEdge, DataAssociation
|
|
|
6
6
|
export { parseBpmnXml, serializeBpmnXml } from './xml/index.js';
|
|
7
7
|
export { B as BpmnExportOptions, a as BpmnImportResult, b as BpmnRFEdge, c as BpmnRFNode } from './types-BxjCV2oX.js';
|
|
8
8
|
export { SimDiagram, SimEdge, SimLogEntry, SimLogType, SimNode, SimStatus, SimToken, SimVariables, SimulationState, createSimulation, fire, getFireable, isCompleted, setVariable, tick } from './simulation/index.js';
|
|
9
|
-
export { BPMN_EDGE_CONNECTION_RULES, BPMN_MODELING_RULES, BPMN_POOL_LANE_LAYOUT, BPMN_ROUTABLE_EDGE_TYPES, BPMN_SELECTION_STYLE, BpmnClipboardState, BpmnConnectionRule, BpmnDiagramDocument, BpmnDiagramState, ConnectBpmnOptions, CreateBpmnNodeOptions, MoveBpmnLaneOptions, PasteBpmnOptions, ReorderBpmnLaneOptions, ReparentBpmnNodeOptions, ReplaceBpmnNodeOptions, ResizeBpmnNodeOptions, RouteBpmnEdgeOptions, attachBoundaryEventCommand, bpmnConnectionValidators, canContainBpmnElement, connectBpmnCommand, copyBpmnElements, createBpmnDiagramDocument, createBpmnNode, createBpmnNodeCommand, deleteBpmnElementsCommand, deserializeBpmnDiagram, getBpmnDragHandleSelector, getBpmnLaneIndexAtPosition, getBpmnPoolLanes, inferBpmnEdgeType, isBpmnEdgeRoutingEditable, isBpmnProcessNode, layoutBpmnPoolLanes, moveBpmnLaneCommand, parseBpmnDiagramDocument, pasteBpmnElementsCommand, reorderBpmnLane, reorderBpmnLaneCommand, reparentBpmnNodeCommand, replaceBpmnNodeCommand, resizeBpmnNodeCommand, routeBpmnEdgeCommand, runBpmnCommand, runBpmnCommands, selectBpmnElementsCommand, serializeBpmnDiagram, validateBpmnConnectionForEdgeType } from './modeling/index.js';
|
|
9
|
+
export { BPMN_EDGE_CONNECTION_RULES, BPMN_MODELING_RULES, BPMN_POOL_LANE_LAYOUT, BPMN_ROUTABLE_EDGE_TYPES, BPMN_SELECTION_STYLE, BpmnClipboardState, BpmnConnectionRule, BpmnDiagramDocument, BpmnDiagramState, ConnectBpmnOptions, CreateBpmnNodeOptions, FindBpmnContainerAtOptions, MoveBpmnLaneOptions, PasteBpmnOptions, ReorderBpmnLaneOptions, ReparentBpmnNodeAtPositionOptions, ReparentBpmnNodeOptions, ReplaceBpmnNodeOptions, ResizeBpmnNodeOptions, RouteBpmnEdgeOptions, attachBoundaryEventCommand, bpmnConnectionValidators, canContainBpmnElement, connectBpmnCommand, copyBpmnElements, createBpmnDiagramDocument, createBpmnNode, createBpmnNodeCommand, deleteBpmnElementsCommand, deserializeBpmnDiagram, findBpmnContainerAt, getBpmnDragHandleSelector, getBpmnLaneIndexAtPosition, getBpmnNodeAbsolutePosition, getBpmnNodeCenter, getBpmnNodeSize, getBpmnNodeZIndex, getBpmnPoolLanes, inferBpmnEdgeType, isBpmnEdgeRoutingEditable, isBpmnProcessNode, layoutBpmnPoolLaneNodes, layoutBpmnPoolLanes, moveBpmnLaneCommand, parseBpmnDiagramDocument, pasteBpmnElementsCommand, reorderBpmnLane, reorderBpmnLaneAfterDrop, reorderBpmnLaneCommand, reparentBpmnNodeAtPosition, reparentBpmnNodeCommand, replaceBpmnNodeCommand, resizeBpmnNodeCommand, routeBpmnEdgeCommand, runBpmnCommand, runBpmnCommands, selectBpmnElementsCommand, serializeBpmnDiagram, toBpmnRelativePosition, validateBpmnConnectionForEdgeType, withBpmnNodeZIndexes } from './modeling/index.js';
|
|
10
10
|
export { BpmnValidationIssue, BpmnValidationOptions, BpmnValidationResult, BpmnValidationSeverity, validateBpmnDiagram } from './validation/index.js';
|
|
11
11
|
import 'react/jsx-runtime';
|
|
12
12
|
import '@xyflow/react';
|
package/dist/index.js
CHANGED
|
@@ -3,8 +3,8 @@ export { AnnotationNode, BPMN_NODE_TYPES, BoundaryEventNode, CallChoreographyNod
|
|
|
3
3
|
export { AssociationEdge, BPMN_EDGE_TYPES, ConversationLinkEdge, DataAssociationEdge, MessageFlowEdge, SequenceFlowEdge } from './chunk-ECTJRD7Z.js';
|
|
4
4
|
import './chunk-KALSGH4D.js';
|
|
5
5
|
export { parseBpmnXml, serializeBpmnXml } from './chunk-33AR3PXF.js';
|
|
6
|
-
export { createSimulation, fire, getFireable, isCompleted, setVariable, tick } from './chunk-
|
|
7
|
-
export { BPMN_EDGE_CONNECTION_RULES, BPMN_MODELING_RULES, BPMN_POOL_LANE_LAYOUT, BPMN_ROUTABLE_EDGE_TYPES, BPMN_SELECTION_STYLE, attachBoundaryEventCommand, bpmnConnectionValidators, canContainBpmnElement, connectBpmnCommand, copyBpmnElements, createBpmnDiagramDocument, createBpmnNode, createBpmnNodeCommand, deleteBpmnElementsCommand, deserializeBpmnDiagram, getBpmnDragHandleSelector, getBpmnLaneIndexAtPosition, getBpmnPoolLanes, inferBpmnEdgeType, isBpmnEdgeRoutingEditable, isBpmnProcessNode, layoutBpmnPoolLanes, moveBpmnLaneCommand, parseBpmnDiagramDocument, pasteBpmnElementsCommand, reorderBpmnLane, reorderBpmnLaneCommand, reparentBpmnNodeCommand, replaceBpmnNodeCommand, resizeBpmnNodeCommand, routeBpmnEdgeCommand, runBpmnCommand, runBpmnCommands, selectBpmnElementsCommand, serializeBpmnDiagram, validateBpmnConnectionForEdgeType } from './chunk-
|
|
6
|
+
export { createSimulation, fire, getFireable, isCompleted, setVariable, tick } from './chunk-QOGZITWB.js';
|
|
7
|
+
export { BPMN_EDGE_CONNECTION_RULES, BPMN_MODELING_RULES, BPMN_POOL_LANE_LAYOUT, BPMN_ROUTABLE_EDGE_TYPES, BPMN_SELECTION_STYLE, attachBoundaryEventCommand, bpmnConnectionValidators, canContainBpmnElement, connectBpmnCommand, copyBpmnElements, createBpmnDiagramDocument, createBpmnNode, createBpmnNodeCommand, deleteBpmnElementsCommand, deserializeBpmnDiagram, findBpmnContainerAt, getBpmnDragHandleSelector, getBpmnLaneIndexAtPosition, getBpmnNodeAbsolutePosition, getBpmnNodeCenter, getBpmnNodeSize, getBpmnNodeZIndex, getBpmnPoolLanes, inferBpmnEdgeType, isBpmnEdgeRoutingEditable, isBpmnProcessNode, layoutBpmnPoolLaneNodes, layoutBpmnPoolLanes, moveBpmnLaneCommand, parseBpmnDiagramDocument, pasteBpmnElementsCommand, reorderBpmnLane, reorderBpmnLaneAfterDrop, reorderBpmnLaneCommand, reparentBpmnNodeAtPosition, reparentBpmnNodeCommand, replaceBpmnNodeCommand, resizeBpmnNodeCommand, routeBpmnEdgeCommand, runBpmnCommand, runBpmnCommands, selectBpmnElementsCommand, serializeBpmnDiagram, toBpmnRelativePosition, validateBpmnConnectionForEdgeType, withBpmnNodeZIndexes } from './chunk-7MKU37XQ.js';
|
|
8
8
|
export { validateBpmnDiagram } from './chunk-ZFGQVLHB.js';
|
|
9
9
|
export { acceptsBoundaryEvents, getHandlePolicy, getOrientation, isChoreographyType, isContainerType, isConversationType, isDataType, isEventType, isGatewayType, isTaskType, supportsCollapse, supportsMarkers } from './chunk-RLAJNRF2.js';
|
|
10
10
|
export { BPMN_ELEMENT_CATALOG, BPMN_RESIZABLE_ELEMENT_TYPES, getBpmnElementSize, getElementMeta, isBpmnElementResizable } from './chunk-L5Z22RLX.js';
|
package/dist/modeling/index.cjs
CHANGED
|
@@ -692,14 +692,30 @@ function createBpmnNode(options) {
|
|
|
692
692
|
},
|
|
693
693
|
width: options.width ?? size.width,
|
|
694
694
|
height: options.height ?? size.height,
|
|
695
|
+
zIndex: getBpmnNodeZIndex(options.elementType),
|
|
695
696
|
...options.parentId ? { parentId: options.parentId } : {},
|
|
697
|
+
...options.elementType === "Lane" && options.parentId ? { extent: "parent" } : {},
|
|
696
698
|
...dragHandle ? { dragHandle } : {}
|
|
697
699
|
};
|
|
698
700
|
}
|
|
701
|
+
function getBpmnNodeZIndex(elementType) {
|
|
702
|
+
if (elementType === "Pool") return 0;
|
|
703
|
+
if (elementType === "Lane") return 1;
|
|
704
|
+
if (elementType === "BoundaryEvent") return 4;
|
|
705
|
+
return 3;
|
|
706
|
+
}
|
|
707
|
+
function withBpmnNodeZIndexes(nodes) {
|
|
708
|
+
return nodes.map((node) => {
|
|
709
|
+
const zIndex = getBpmnNodeZIndex(node.data.elementType);
|
|
710
|
+
return node.zIndex === zIndex ? node : { ...node, zIndex };
|
|
711
|
+
});
|
|
712
|
+
}
|
|
699
713
|
var BPMN_POOL_LANE_LAYOUT = {
|
|
700
714
|
poolHeaderSize: 30,
|
|
701
715
|
laneHeaderSize: 24,
|
|
702
|
-
laneGap: 0
|
|
716
|
+
laneGap: 0,
|
|
717
|
+
verticalPoolHeaderSize: 28,
|
|
718
|
+
minLaneSize: 96
|
|
703
719
|
};
|
|
704
720
|
function getBpmnDragHandleSelector(elementType) {
|
|
705
721
|
if (elementType === "Pool") return ".pool-drag-handle";
|
|
@@ -820,6 +836,116 @@ function getBpmnPoolLanes(state, poolId) {
|
|
|
820
836
|
function getNodeDimension(node, axis) {
|
|
821
837
|
return node[axis] ?? node.measured?.[axis] ?? getBpmnElementSize(node.data.elementType)[axis];
|
|
822
838
|
}
|
|
839
|
+
function getBpmnLaneOrderPosition(lane, orientation) {
|
|
840
|
+
const size = getBpmnNodeSize(lane);
|
|
841
|
+
return orientation === "vertical" ? lane.position.x + size.width / 2 : lane.position.y + size.height / 2;
|
|
842
|
+
}
|
|
843
|
+
function resizeHorizontalBpmnLanes(lanes, pool) {
|
|
844
|
+
const poolSize = getBpmnNodeSize(pool);
|
|
845
|
+
const laneWidth = Math.max(BPMN_POOL_LANE_LAYOUT.minLaneSize, poolSize.width - BPMN_POOL_LANE_LAYOUT.poolHeaderSize);
|
|
846
|
+
const laneHeight = Math.max(BPMN_POOL_LANE_LAYOUT.minLaneSize, poolSize.height / Math.max(1, lanes.length));
|
|
847
|
+
return lanes.map((lane, index) => ({
|
|
848
|
+
...lane,
|
|
849
|
+
position: { x: BPMN_POOL_LANE_LAYOUT.poolHeaderSize, y: index * laneHeight },
|
|
850
|
+
width: laneWidth,
|
|
851
|
+
height: laneHeight,
|
|
852
|
+
parentId: pool.id,
|
|
853
|
+
extent: "parent",
|
|
854
|
+
zIndex: getBpmnNodeZIndex("Lane"),
|
|
855
|
+
data: { ...lane.data, orientation: "horizontal", laneIndex: index }
|
|
856
|
+
}));
|
|
857
|
+
}
|
|
858
|
+
function resizeVerticalBpmnLanes(lanes, pool) {
|
|
859
|
+
const poolSize = getBpmnNodeSize(pool);
|
|
860
|
+
const laneWidth = Math.max(BPMN_POOL_LANE_LAYOUT.minLaneSize, poolSize.width / Math.max(1, lanes.length));
|
|
861
|
+
const laneHeight = Math.max(BPMN_POOL_LANE_LAYOUT.minLaneSize, poolSize.height - BPMN_POOL_LANE_LAYOUT.verticalPoolHeaderSize);
|
|
862
|
+
return lanes.map((lane, index) => ({
|
|
863
|
+
...lane,
|
|
864
|
+
position: { x: index * laneWidth, y: BPMN_POOL_LANE_LAYOUT.verticalPoolHeaderSize },
|
|
865
|
+
width: laneWidth,
|
|
866
|
+
height: laneHeight,
|
|
867
|
+
parentId: pool.id,
|
|
868
|
+
extent: "parent",
|
|
869
|
+
zIndex: getBpmnNodeZIndex("Lane"),
|
|
870
|
+
data: { ...lane.data, orientation: "vertical", laneIndex: index }
|
|
871
|
+
}));
|
|
872
|
+
}
|
|
873
|
+
function layoutBpmnPoolLaneNodes(nodes, poolId) {
|
|
874
|
+
const pool = nodes.find((node) => node.id === poolId && node.data.elementType === "Pool");
|
|
875
|
+
if (!pool) return nodes;
|
|
876
|
+
const orientation = pool.data.orientation === "vertical" ? "vertical" : "horizontal";
|
|
877
|
+
const lanes = nodes.filter((node) => node.parentId === pool.id && node.data.elementType === "Lane").sort((a, b) => {
|
|
878
|
+
const aIndex = typeof a.data.laneIndex === "number" ? a.data.laneIndex : void 0;
|
|
879
|
+
const bIndex = typeof b.data.laneIndex === "number" ? b.data.laneIndex : void 0;
|
|
880
|
+
if (aIndex !== void 0 || bIndex !== void 0) return (aIndex ?? 0) - (bIndex ?? 0);
|
|
881
|
+
return getBpmnLaneOrderPosition(a, orientation) - getBpmnLaneOrderPosition(b, orientation);
|
|
882
|
+
});
|
|
883
|
+
if (lanes.length === 0) return withBpmnNodeZIndexes(nodes);
|
|
884
|
+
const laneMap = new Map(
|
|
885
|
+
(orientation === "vertical" ? resizeVerticalBpmnLanes(lanes, pool) : resizeHorizontalBpmnLanes(lanes, pool)).map((lane) => [lane.id, lane])
|
|
886
|
+
);
|
|
887
|
+
return withBpmnNodeZIndexes(nodes.map((node) => laneMap.get(node.id) ?? node));
|
|
888
|
+
}
|
|
889
|
+
function reorderBpmnLaneAfterDrop(nodes, laneId) {
|
|
890
|
+
const lane = nodes.find((node) => node.id === laneId && node.data.elementType === "Lane");
|
|
891
|
+
if (!lane?.parentId) return nodes;
|
|
892
|
+
const pool = nodes.find((node) => node.id === lane.parentId && node.data.elementType === "Pool");
|
|
893
|
+
if (!pool) return nodes;
|
|
894
|
+
const orientation = pool.data.orientation === "vertical" ? "vertical" : "horizontal";
|
|
895
|
+
const lanes = nodes.filter((node) => node.parentId === pool.id && node.data.elementType === "Lane").sort((a, b) => getBpmnLaneOrderPosition(a, orientation) - getBpmnLaneOrderPosition(b, orientation));
|
|
896
|
+
const moved = lanes.find((candidate) => candidate.id === lane.id);
|
|
897
|
+
if (!moved) return layoutBpmnPoolLaneNodes(nodes, pool.id);
|
|
898
|
+
const withoutMoved = lanes.filter((candidate) => candidate.id !== lane.id);
|
|
899
|
+
const movedCenter = getBpmnLaneOrderPosition(lane, orientation);
|
|
900
|
+
const insertIndex = withoutMoved.findIndex(
|
|
901
|
+
(candidate) => movedCenter < getBpmnLaneOrderPosition(candidate, orientation)
|
|
902
|
+
);
|
|
903
|
+
const ordered = [...withoutMoved];
|
|
904
|
+
ordered.splice(insertIndex === -1 ? ordered.length : insertIndex, 0, moved);
|
|
905
|
+
const orderedMap = new Map(ordered.map((candidate, index) => [candidate.id, index]));
|
|
906
|
+
const sortedByDrop = nodes.map((node) => {
|
|
907
|
+
if (node.parentId !== pool.id || node.data.elementType !== "Lane") return node;
|
|
908
|
+
return { ...node, data: { ...node.data, laneIndex: orderedMap.get(node.id) ?? 0 } };
|
|
909
|
+
});
|
|
910
|
+
return layoutBpmnPoolLaneNodes(sortedByDrop, pool.id);
|
|
911
|
+
}
|
|
912
|
+
function getBpmnNodeSize(node) {
|
|
913
|
+
return diagramsCore.getNodeSize(node, getBpmnElementSize(node.data.elementType));
|
|
914
|
+
}
|
|
915
|
+
function getBpmnNodeAbsolutePosition(state, nodeOrId) {
|
|
916
|
+
const nodeId = typeof nodeOrId === "string" ? nodeOrId : nodeOrId.id;
|
|
917
|
+
return diagramsCore.getNodeAbsolutePosition(state, nodeId);
|
|
918
|
+
}
|
|
919
|
+
function toBpmnRelativePosition(state, absolutePosition, parentOrId) {
|
|
920
|
+
return diagramsCore.toRelativeNodePosition(state, absolutePosition, parentOrId);
|
|
921
|
+
}
|
|
922
|
+
var BPMN_CONTAINER_PRIORITY = [
|
|
923
|
+
"Lane",
|
|
924
|
+
"SubProcess",
|
|
925
|
+
"EventSubProcess",
|
|
926
|
+
"Transaction",
|
|
927
|
+
"AdHocSubProcess",
|
|
928
|
+
"Pool"
|
|
929
|
+
];
|
|
930
|
+
function findBpmnContainerAt(state, options) {
|
|
931
|
+
return diagramsCore.findContainingNode(state, {
|
|
932
|
+
point: options.position,
|
|
933
|
+
excludeId: options.excludeId,
|
|
934
|
+
fallbackSize: (node) => getBpmnElementSize(node.data.elementType),
|
|
935
|
+
predicate: (node) => BPMN_CONTAINER_PRIORITY.includes(node.data.elementType),
|
|
936
|
+
sort: (a, b) => {
|
|
937
|
+
const aPriority = BPMN_CONTAINER_PRIORITY.indexOf(a.data.elementType);
|
|
938
|
+
const bPriority = BPMN_CONTAINER_PRIORITY.indexOf(b.data.elementType);
|
|
939
|
+
if (aPriority !== bPriority) return aPriority - bPriority;
|
|
940
|
+
const aSize = getBpmnNodeSize(a);
|
|
941
|
+
const bSize = getBpmnNodeSize(b);
|
|
942
|
+
return aSize.width * aSize.height - bSize.width * bSize.height;
|
|
943
|
+
}
|
|
944
|
+
});
|
|
945
|
+
}
|
|
946
|
+
function getBpmnNodeCenter(node, absolutePosition) {
|
|
947
|
+
return diagramsCore.getNodeCenterPosition(absolutePosition, getBpmnNodeSize(node));
|
|
948
|
+
}
|
|
823
949
|
function resolvePoolLaneDirection(pool) {
|
|
824
950
|
return pool.data.orientation === "vertical" ? "horizontal" : "vertical";
|
|
825
951
|
}
|
|
@@ -1082,6 +1208,19 @@ function reparentBpmnNodeCommand(options) {
|
|
|
1082
1208
|
}
|
|
1083
1209
|
};
|
|
1084
1210
|
}
|
|
1211
|
+
function reparentBpmnNodeAtPosition(state, options) {
|
|
1212
|
+
const node = diagramsCore.getNode(state, options.id);
|
|
1213
|
+
if (!node) throw new Error(`Element "${options.id}" does not exist.`);
|
|
1214
|
+
const hitPoint = getBpmnNodeCenter(node, options.position);
|
|
1215
|
+
const parent = isBpmnProcessNode(node.data.elementType) ? findBpmnContainerAt(state, { position: hitPoint, excludeId: node.id }) : void 0;
|
|
1216
|
+
const containment = canContainBpmnElement(parent?.data.elementType, node.data.elementType);
|
|
1217
|
+
if (containment !== true) throw new Error(containment);
|
|
1218
|
+
const nextPosition = parent ? toBpmnRelativePosition(state, options.position, parent) : options.position;
|
|
1219
|
+
return diagramsCore.reparentNode(state, node.id, {
|
|
1220
|
+
...parent ? { parentId: parent.id } : { parentId: void 0 },
|
|
1221
|
+
position: nextPosition
|
|
1222
|
+
});
|
|
1223
|
+
}
|
|
1085
1224
|
function resizeBpmnNodeCommand(options) {
|
|
1086
1225
|
return {
|
|
1087
1226
|
id: `bpmn.resize.${options.id}`,
|
|
@@ -1214,20 +1353,28 @@ exports.createBpmnNode = createBpmnNode;
|
|
|
1214
1353
|
exports.createBpmnNodeCommand = createBpmnNodeCommand;
|
|
1215
1354
|
exports.deleteBpmnElementsCommand = deleteBpmnElementsCommand;
|
|
1216
1355
|
exports.deserializeBpmnDiagram = deserializeBpmnDiagram;
|
|
1356
|
+
exports.findBpmnContainerAt = findBpmnContainerAt;
|
|
1217
1357
|
exports.getBpmnDragHandleSelector = getBpmnDragHandleSelector;
|
|
1218
1358
|
exports.getBpmnElementSize = getBpmnElementSize;
|
|
1219
1359
|
exports.getBpmnLaneIndexAtPosition = getBpmnLaneIndexAtPosition;
|
|
1360
|
+
exports.getBpmnNodeAbsolutePosition = getBpmnNodeAbsolutePosition;
|
|
1361
|
+
exports.getBpmnNodeCenter = getBpmnNodeCenter;
|
|
1362
|
+
exports.getBpmnNodeSize = getBpmnNodeSize;
|
|
1363
|
+
exports.getBpmnNodeZIndex = getBpmnNodeZIndex;
|
|
1220
1364
|
exports.getBpmnPoolLanes = getBpmnPoolLanes;
|
|
1221
1365
|
exports.inferBpmnEdgeType = inferBpmnEdgeType;
|
|
1222
1366
|
exports.isBpmnEdgeRoutingEditable = isBpmnEdgeRoutingEditable;
|
|
1223
1367
|
exports.isBpmnElementResizable = isBpmnElementResizable;
|
|
1224
1368
|
exports.isBpmnProcessNode = isBpmnProcessNode;
|
|
1369
|
+
exports.layoutBpmnPoolLaneNodes = layoutBpmnPoolLaneNodes;
|
|
1225
1370
|
exports.layoutBpmnPoolLanes = layoutBpmnPoolLanes;
|
|
1226
1371
|
exports.moveBpmnLaneCommand = moveBpmnLaneCommand;
|
|
1227
1372
|
exports.parseBpmnDiagramDocument = parseBpmnDiagramDocument;
|
|
1228
1373
|
exports.pasteBpmnElementsCommand = pasteBpmnElementsCommand;
|
|
1229
1374
|
exports.reorderBpmnLane = reorderBpmnLane;
|
|
1375
|
+
exports.reorderBpmnLaneAfterDrop = reorderBpmnLaneAfterDrop;
|
|
1230
1376
|
exports.reorderBpmnLaneCommand = reorderBpmnLaneCommand;
|
|
1377
|
+
exports.reparentBpmnNodeAtPosition = reparentBpmnNodeAtPosition;
|
|
1231
1378
|
exports.reparentBpmnNodeCommand = reparentBpmnNodeCommand;
|
|
1232
1379
|
exports.replaceBpmnNodeCommand = replaceBpmnNodeCommand;
|
|
1233
1380
|
exports.resizeBpmnNodeCommand = resizeBpmnNodeCommand;
|
|
@@ -1236,6 +1383,8 @@ exports.runBpmnCommand = runBpmnCommand;
|
|
|
1236
1383
|
exports.runBpmnCommands = runBpmnCommands;
|
|
1237
1384
|
exports.selectBpmnElementsCommand = selectBpmnElementsCommand;
|
|
1238
1385
|
exports.serializeBpmnDiagram = serializeBpmnDiagram;
|
|
1386
|
+
exports.toBpmnRelativePosition = toBpmnRelativePosition;
|
|
1239
1387
|
exports.validateBpmnConnectionForEdgeType = validateBpmnConnectionForEdgeType;
|
|
1388
|
+
exports.withBpmnNodeZIndexes = withBpmnNodeZIndexes;
|
|
1240
1389
|
//# sourceMappingURL=index.cjs.map
|
|
1241
1390
|
//# sourceMappingURL=index.cjs.map
|