verben-workflow-ui 0.5.70 → 0.5.71

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.
@@ -3030,7 +3030,12 @@ class DesignerCanvasComponent {
3030
3030
  this.hideConnectionPopup();
3031
3031
  return;
3032
3032
  }
3033
- const { endX, endY, sourceSwimlaneIndex } = pathData;
3033
+ const { endX, endY } = pathData;
3034
+ // Determine the target swimlane from the drop position (NOT the source
3035
+ // swimlane). `addNode` expects an absolute canvas Y plus the target
3036
+ // swimlane index, and performs the swimlane-relative conversion itself.
3037
+ let targetSwimlaneIndex = Math.floor(endY / this.swimlaneHeight);
3038
+ targetSwimlaneIndex = Math.max(0, Math.min(targetSwimlaneIndex, this.state.swimlanes.length - 1));
3034
3039
  // Get source node info
3035
3040
  const sourcePoint = this.state.draggingConnectionData.sourcePoint;
3036
3041
  if (!sourcePoint) {
@@ -3047,12 +3052,10 @@ class DesignerCanvasComponent {
3047
3052
  // Store information for later stage creation
3048
3053
  this.pendingDecisionConnection = {
3049
3054
  decisionNodeId: sourceNodeInfo.node.id,
3050
- swimlaneIndex: sourceSwimlaneIndex,
3055
+ swimlaneIndex: targetSwimlaneIndex,
3051
3056
  x: endX,
3052
3057
  y: endY,
3053
3058
  };
3054
- // Calculate popup position - position it near the decision node
3055
- const swimlaneOffsetY = sourceSwimlaneIndex * 263;
3056
3059
  // Center the popup over the connection endpoint
3057
3060
  this.decisionConditionPopupX = endX;
3058
3061
  this.decisionConditionPopupY = endY - 150; // Position above the endpoint
@@ -3063,26 +3066,11 @@ class DesignerCanvasComponent {
3063
3066
  this.hideConnectionPopup();
3064
3067
  return;
3065
3068
  }
3066
- const swimlaneIndex = Math.floor(endY / this.swimlaneHeight);
3067
- const swimlaneTop = swimlaneIndex * this.swimlaneHeight;
3068
- // Calculate swimlane-relative position
3069
- const swimlaneOffsetY = sourceSwimlaneIndex * 263;
3070
- let relativeY = endY - swimlaneOffsetY - 50; // Add half node height for better alignment
3071
- const swimlaneBottom = swimlaneTop + 263;
3072
- // Clamp nodeY so node stays within swimlane
3073
- console.log(endY, swimlaneIndex, swimlaneOffsetY, swimlaneBottom);
3074
- if (endY - 50 < swimlaneTop) {
3075
- console.log('Less');
3076
- relativeY = swimlaneTop; // Node would overflow above, so align to top
3077
- }
3078
- else if (endY + 50 > swimlaneBottom) {
3079
- console.log('More');
3080
- relativeY = swimlaneBottom - 100; // Node would overflow below, so align to bottom
3081
- }
3082
3069
  // Handle preconditions based on node type
3083
3070
  if (nodeType === 'stage') {
3084
- // Create the stage directly with default properties
3085
- const newNode = this.state.addNode(sourceSwimlaneIndex, 'stage', endX, relativeY, { Name: 'New Stage' } // Add default properties
3071
+ // Create the stage in the target swimlane. `addNode` converts the
3072
+ // absolute endY to a swimlane-relative position internally.
3073
+ const newNode = this.state.addNode(targetSwimlaneIndex, 'stage', endX, endY, { Name: 'New Stage' } // Add default properties
3086
3074
  );
3087
3075
  if (newNode &&
3088
3076
  newNode.connectionPoints &&
@@ -3098,7 +3086,7 @@ class DesignerCanvasComponent {
3098
3086
  const targetPoint = newNode.connectionPoints.find((p) => p.type === opposingType);
3099
3087
  if (targetPoint) {
3100
3088
  // Create the connection
3101
- const connection = this.state.createConnection(newNode.id, targetPoint.id, sourceSwimlaneIndex);
3089
+ const connection = this.state.createConnection(newNode.id, targetPoint.id, targetSwimlaneIndex);
3102
3090
  if (connection) {
3103
3091
  this.onConnectionCreated(connection);
3104
3092
  }
@@ -3108,14 +3096,14 @@ class DesignerCanvasComponent {
3108
3096
  return;
3109
3097
  }
3110
3098
  else if (nodeType === 'subflow') {
3111
- console.log('Creating subflow from connection at:', endX, endY, 'swimlane:', sourceSwimlaneIndex);
3099
+ console.log('Creating subflow from connection at:', endX, endY, 'swimlane:', targetSwimlaneIndex);
3112
3100
  // Show workflow selection popup and store connection data for later use
3113
- this.showSubflowSelectionPopup(endX, endY, sourceSwimlaneIndex);
3101
+ this.showSubflowSelectionPopup(endX, endY, targetSwimlaneIndex);
3114
3102
  this.hideConnectionPopup();
3115
3103
  return;
3116
3104
  }
3117
3105
  // For other nodes Create the new node at the end position of the connection
3118
- const newNode = this.state.addNode(sourceSwimlaneIndex, nodeType, endX, relativeY);
3106
+ const newNode = this.state.addNode(targetSwimlaneIndex, nodeType, endX, endY);
3119
3107
  if (newNode &&
3120
3108
  newNode.connectionPoints &&
3121
3109
  newNode.connectionPoints.length > 0) {
@@ -3134,7 +3122,7 @@ class DesignerCanvasComponent {
3134
3122
  targetPoint = newNode.connectionPoints.find((p) => p.type === opposingType);
3135
3123
  if (targetPoint) {
3136
3124
  // Create the connection
3137
- const connection = this.state.createConnection(newNode.id, targetPoint.id, sourceSwimlaneIndex);
3125
+ const connection = this.state.createConnection(newNode.id, targetPoint.id, targetSwimlaneIndex);
3138
3126
  if (connection) {
3139
3127
  this.onConnectionCreated(connection);
3140
3128
  }