verben-workflow-ui 0.7.7 → 0.7.9

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.
Files changed (85) hide show
  1. package/esm2022/src/lib/components/actors/actors.component.mjs +4 -3
  2. package/esm2022/src/lib/components/designer/components/label-editor.component.mjs +9 -4
  3. package/esm2022/src/lib/components/designer/components/swimlane-label.component.mjs +1 -1
  4. package/esm2022/src/lib/components/designer/components/wf-canvas.component.mjs +2 -2
  5. package/esm2022/src/lib/components/designer/models/types.mjs +1 -1
  6. package/esm2022/src/lib/components/designer/services/connection.service.mjs +260 -29
  7. package/esm2022/src/lib/components/designer/services/wf-mapper.service.mjs +16 -2
  8. package/esm2022/src/lib/components/flowable-status/flowable-status.component.mjs +4 -3
  9. package/esm2022/src/lib/components/form-response/form-response.component.mjs +4 -3
  10. package/esm2022/src/lib/components/form-response/form-response.module.mjs +7 -3
  11. package/esm2022/src/lib/components/form-values/form-values.component.mjs +4 -3
  12. package/esm2022/src/lib/components/forms/forms.component.mjs +4 -3
  13. package/esm2022/src/lib/components/my-queue/my-queue.columns.mjs +6 -1
  14. package/esm2022/src/lib/components/my-queue/my-queue.component.mjs +4 -3
  15. package/esm2022/src/lib/components/my-queue/tasks.form.component.mjs +29 -7
  16. package/esm2022/src/lib/components/task-history/task-history.component.mjs +37 -8
  17. package/esm2022/src/lib/components/task-notification/task-notification.component.mjs +3 -3
  18. package/esm2022/src/lib/components/tasks/tasks.columns.mjs +6 -1
  19. package/esm2022/src/lib/components/tasks/tasks.component.mjs +4 -3
  20. package/esm2022/src/lib/components/tasks/tasks.form.component.mjs +13 -3
  21. package/esm2022/src/lib/components/workflow-designer/action-dialog/action-dialog.component.mjs +13 -3
  22. package/esm2022/src/lib/components/workflow-designer/designer-canvas/designer-canvas.component.mjs +400 -25
  23. package/esm2022/src/lib/components/workflow-designer/services/transformer.service.mjs +3 -1
  24. package/esm2022/src/lib/components/workflow-designer/workflow-data.service.mjs +67 -2
  25. package/esm2022/src/lib/components/workflow-designer/workflow-designer.component.mjs +92 -31
  26. package/esm2022/src/lib/components/workflow-designer/workflow-designer.state.mjs +3 -1
  27. package/esm2022/src/lib/components/workflow-designer/workflow-designer.types.mjs +1 -1
  28. package/esm2022/src/lib/components/workflow-stage/workflow-stage.component.mjs +75 -14
  29. package/esm2022/src/lib/models/WorkflowAction.mjs +1 -1
  30. package/esm2022/src/lib/pipes/company-date.pipe.mjs +34 -0
  31. package/esm2022/src/lib/pipes/public-api.mjs +2 -1
  32. package/esm2022/src/lib/services/public-api.mjs +2 -1
  33. package/esm2022/src/lib/services/util.service.mjs +7 -1
  34. package/esm2022/src/lib/services/workflow-form.helper.mjs +58 -0
  35. package/esm2022/src/lib/shared/shared.module.mjs +7 -5
  36. package/fesm2022/verben-workflow-ui-src-lib-components-actors.mjs +3 -2
  37. package/fesm2022/verben-workflow-ui-src-lib-components-actors.mjs.map +1 -1
  38. package/fesm2022/verben-workflow-ui-src-lib-components-designer.mjs +284 -34
  39. package/fesm2022/verben-workflow-ui-src-lib-components-designer.mjs.map +1 -1
  40. package/fesm2022/verben-workflow-ui-src-lib-components-flowable-status.mjs +3 -2
  41. package/fesm2022/verben-workflow-ui-src-lib-components-flowable-status.mjs.map +1 -1
  42. package/fesm2022/verben-workflow-ui-src-lib-components-form-response.mjs +9 -4
  43. package/fesm2022/verben-workflow-ui-src-lib-components-form-response.mjs.map +1 -1
  44. package/fesm2022/verben-workflow-ui-src-lib-components-form-values.mjs +3 -2
  45. package/fesm2022/verben-workflow-ui-src-lib-components-form-values.mjs.map +1 -1
  46. package/fesm2022/verben-workflow-ui-src-lib-components-forms.mjs +3 -2
  47. package/fesm2022/verben-workflow-ui-src-lib-components-forms.mjs.map +1 -1
  48. package/fesm2022/verben-workflow-ui-src-lib-components-my-queue.mjs +36 -8
  49. package/fesm2022/verben-workflow-ui-src-lib-components-my-queue.mjs.map +1 -1
  50. package/fesm2022/verben-workflow-ui-src-lib-components-task-history.mjs +37 -8
  51. package/fesm2022/verben-workflow-ui-src-lib-components-task-history.mjs.map +1 -1
  52. package/fesm2022/verben-workflow-ui-src-lib-components-task-notification.mjs +2 -2
  53. package/fesm2022/verben-workflow-ui-src-lib-components-task-notification.mjs.map +1 -1
  54. package/fesm2022/verben-workflow-ui-src-lib-components-tasks.mjs +20 -4
  55. package/fesm2022/verben-workflow-ui-src-lib-components-tasks.mjs.map +1 -1
  56. package/fesm2022/verben-workflow-ui-src-lib-components-workflow-designer.mjs +572 -57
  57. package/fesm2022/verben-workflow-ui-src-lib-components-workflow-designer.mjs.map +1 -1
  58. package/fesm2022/verben-workflow-ui-src-lib-components-workflow-stage.mjs +74 -13
  59. package/fesm2022/verben-workflow-ui-src-lib-components-workflow-stage.mjs.map +1 -1
  60. package/fesm2022/verben-workflow-ui-src-lib-pipes.mjs +32 -1
  61. package/fesm2022/verben-workflow-ui-src-lib-pipes.mjs.map +1 -1
  62. package/fesm2022/verben-workflow-ui-src-lib-services.mjs +65 -1
  63. package/fesm2022/verben-workflow-ui-src-lib-services.mjs.map +1 -1
  64. package/fesm2022/verben-workflow-ui-src-lib-shared.mjs +6 -4
  65. package/fesm2022/verben-workflow-ui-src-lib-shared.mjs.map +1 -1
  66. package/package.json +31 -31
  67. package/src/lib/components/designer/components/label-editor.component.d.ts +2 -1
  68. package/src/lib/components/designer/models/types.d.ts +1 -0
  69. package/src/lib/components/designer/services/connection.service.d.ts +15 -0
  70. package/src/lib/components/form-response/form-response.module.d.ts +2 -1
  71. package/src/lib/components/my-queue/tasks.form.component.d.ts +3 -1
  72. package/src/lib/components/task-history/task-history.component.d.ts +3 -1
  73. package/src/lib/components/workflow-designer/action-dialog/action-dialog.component.d.ts +4 -2
  74. package/src/lib/components/workflow-designer/designer-canvas/designer-canvas.component.d.ts +5 -0
  75. package/src/lib/components/workflow-designer/workflow-data.service.d.ts +7 -0
  76. package/src/lib/components/workflow-designer/workflow-designer.component.d.ts +1 -0
  77. package/src/lib/components/workflow-designer/workflow-designer.types.d.ts +1 -0
  78. package/src/lib/components/workflow-stage/workflow-stage.component.d.ts +4 -1
  79. package/src/lib/models/WorkflowAction.d.ts +1 -0
  80. package/src/lib/pipes/company-date.pipe.d.ts +11 -0
  81. package/src/lib/pipes/public-api.d.ts +1 -0
  82. package/src/lib/services/public-api.d.ts +1 -0
  83. package/src/lib/services/util.service.d.ts +4 -0
  84. package/src/lib/services/workflow-form.helper.d.ts +17 -0
  85. package/src/lib/shared/shared.module.d.ts +1 -1
@@ -69,6 +69,7 @@ class LabelEditorComponent {
69
69
  x = 0;
70
70
  y = 0;
71
71
  isConnection = false;
72
+ hasForm = false;
72
73
  isSwimlane = false;
73
74
  labelChange = new EventEmitter();
74
75
  openDialog = new EventEmitter();
@@ -117,7 +118,7 @@ class LabelEditorComponent {
117
118
  this.cancelEditing();
118
119
  }
119
120
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LabelEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
120
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: LabelEditorComponent, isStandalone: true, selector: "wf-label-editor", inputs: { label: "label", x: "x", y: "y", isConnection: "isConnection", isSwimlane: "isSwimlane" }, outputs: { labelChange: "labelChange", openDialog: "openDialog" }, host: { listeners: { "document:keydown.escape": "onEscapePress()" } }, viewQueries: [{ propertyName: "labelInput", first: true, predicate: ["labelInput"], descendants: true }], ngImport: i0, template: `
121
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: LabelEditorComponent, isStandalone: true, selector: "wf-label-editor", inputs: { label: "label", x: "x", y: "y", isConnection: "isConnection", hasForm: "hasForm", isSwimlane: "isSwimlane" }, outputs: { labelChange: "labelChange", openDialog: "openDialog" }, host: { listeners: { "document:keydown.escape": "onEscapePress()" } }, viewQueries: [{ propertyName: "labelInput", first: true, predicate: ["labelInput"], descendants: true }], ngImport: i0, template: `
121
122
  <div
122
123
  class="label-container"
123
124
  [class.editing]="isEditing"
@@ -140,6 +141,7 @@ class LabelEditorComponent {
140
141
  (dblclick)="startEditing()"
141
142
  class="label-text"
142
143
  [class.connection-label]="isConnection"
144
+ [class.has-form]="hasForm"
143
145
  [class.swimlane-text]="isSwimlane"
144
146
  >
145
147
  {{ label }}
@@ -149,7 +151,7 @@ class LabelEditorComponent {
149
151
  </span>
150
152
  }
151
153
  </div>
152
- `, isInline: true, styles: [":host{display:block;width:100%;height:100%}.label-container{display:flex;align-items:center;justify-content:center;min-width:50px;z-index:1000}.label-container.editing{background:#fff;padding:2px;border-radius:4px;box-shadow:0 2px 4px #0000001a}.label-input{padding:2px 4px;border:1px solid #d36cff;border-radius:2px;font-size:12px;font-family:inherit;outline:none;&.swimlane-input{font-size:14px;font-weight:500;min-width:150px}}.label-text{cursor:text;-webkit-user-select:none;user-select:none;font-size:12px;pointer-events:all;display:inline-block;min-width:20px;min-height:14px;position:relative}.connection-label{background:#fff;padding:2px 4px;border:1px solid #e5e7eb;border-radius:2px}.swimlane-text{font-size:14px;font-weight:500;color:#64748b}.swimlane-label{position:absolute;left:20px}.edit-icon{position:absolute;right:-14px;top:-14px;cursor:pointer}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }] });
154
+ `, isInline: true, styles: [":host{display:block;width:100%;height:100%}.label-container{display:flex;align-items:center;justify-content:center;min-width:50px;z-index:1000}.label-container.editing{background:#fff;padding:2px;border-radius:4px;box-shadow:0 2px 4px #0000001a}.label-input{padding:2px 4px;border:1px solid #d36cff;border-radius:2px;font-size:12px;font-family:inherit;outline:none;&.swimlane-input{font-size:14px;font-weight:500;min-width:150px}}.label-text{cursor:text;-webkit-user-select:none;user-select:none;font-size:12px;pointer-events:all;display:inline-block;min-width:20px;min-height:14px;position:relative}.connection-label{background:#fff;padding:2px 4px;border:1px solid #e5e7eb;border-radius:2px}.connection-label.has-form{border-color:#d36cff}.swimlane-text{font-size:14px;font-weight:500;color:#64748b}.swimlane-label{position:absolute;left:20px}.edit-icon{position:absolute;right:-14px;top:-14px;cursor:pointer}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }] });
153
155
  }
154
156
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LabelEditorComponent, decorators: [{
155
157
  type: Component,
@@ -176,6 +178,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
176
178
  (dblclick)="startEditing()"
177
179
  class="label-text"
178
180
  [class.connection-label]="isConnection"
181
+ [class.has-form]="hasForm"
179
182
  [class.swimlane-text]="isSwimlane"
180
183
  >
181
184
  {{ label }}
@@ -185,7 +188,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
185
188
  </span>
186
189
  }
187
190
  </div>
188
- `, styles: [":host{display:block;width:100%;height:100%}.label-container{display:flex;align-items:center;justify-content:center;min-width:50px;z-index:1000}.label-container.editing{background:#fff;padding:2px;border-radius:4px;box-shadow:0 2px 4px #0000001a}.label-input{padding:2px 4px;border:1px solid #d36cff;border-radius:2px;font-size:12px;font-family:inherit;outline:none;&.swimlane-input{font-size:14px;font-weight:500;min-width:150px}}.label-text{cursor:text;-webkit-user-select:none;user-select:none;font-size:12px;pointer-events:all;display:inline-block;min-width:20px;min-height:14px;position:relative}.connection-label{background:#fff;padding:2px 4px;border:1px solid #e5e7eb;border-radius:2px}.swimlane-text{font-size:14px;font-weight:500;color:#64748b}.swimlane-label{position:absolute;left:20px}.edit-icon{position:absolute;right:-14px;top:-14px;cursor:pointer}\n"] }]
191
+ `, styles: [":host{display:block;width:100%;height:100%}.label-container{display:flex;align-items:center;justify-content:center;min-width:50px;z-index:1000}.label-container.editing{background:#fff;padding:2px;border-radius:4px;box-shadow:0 2px 4px #0000001a}.label-input{padding:2px 4px;border:1px solid #d36cff;border-radius:2px;font-size:12px;font-family:inherit;outline:none;&.swimlane-input{font-size:14px;font-weight:500;min-width:150px}}.label-text{cursor:text;-webkit-user-select:none;user-select:none;font-size:12px;pointer-events:all;display:inline-block;min-width:20px;min-height:14px;position:relative}.connection-label{background:#fff;padding:2px 4px;border:1px solid #e5e7eb;border-radius:2px}.connection-label.has-form{border-color:#d36cff}.swimlane-text{font-size:14px;font-weight:500;color:#64748b}.swimlane-label{position:absolute;left:20px}.edit-icon{position:absolute;right:-14px;top:-14px;cursor:pointer}\n"] }]
189
192
  }], propDecorators: { label: [{
190
193
  type: Input
191
194
  }], x: [{
@@ -194,6 +197,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
194
197
  type: Input
195
198
  }], isConnection: [{
196
199
  type: Input
200
+ }], hasForm: [{
201
+ type: Input
197
202
  }], isSwimlane: [{
198
203
  type: Input
199
204
  }], labelChange: [{
@@ -455,7 +460,7 @@ class SwimlaneLabelComponent {
455
460
  </svg:text>
456
461
  </svg:g>
457
462
  </svg:g>
458
- `, isInline: true, styles: [":host{display:block}circle:hover{fill:#f3e8ff}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: LabelEditorComponent, selector: "wf-label-editor", inputs: ["label", "x", "y", "isConnection", "isSwimlane"], outputs: ["labelChange", "openDialog"] }] });
463
+ `, isInline: true, styles: [":host{display:block}circle:hover{fill:#f3e8ff}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: LabelEditorComponent, selector: "wf-label-editor", inputs: ["label", "x", "y", "isConnection", "hasForm", "isSwimlane"], outputs: ["labelChange", "openDialog"] }] });
459
464
  }
460
465
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: SwimlaneLabelComponent, decorators: [{
461
466
  type: Component,
@@ -1442,6 +1447,7 @@ class ConnectionService {
1442
1447
  points: routePoints,
1443
1448
  order: sourceNode.order,
1444
1449
  caption: sourceNode.caption,
1450
+ form: sourceNode.form,
1445
1451
  };
1446
1452
  // Store the connection endpoints for later use
1447
1453
  this.connectionEndpoints.set(newConnection.id, {
@@ -1456,38 +1462,19 @@ class ConnectionService {
1456
1462
  const node = this.workflowState.getObjectById(nodeId);
1457
1463
  if (!node)
1458
1464
  return;
1459
- const connections = this.workflowState
1465
+ const allConnections = this.workflowState
1460
1466
  .connections()
1461
- .filter((conn) => conn.fromId === nodeId || conn.toId === nodeId);
1462
- connections.forEach((connection) => {
1463
- const sourceNode = this.workflowState.getObjectById(connection.fromId);
1464
- const targetNode = this.workflowState.getObjectById(connection.toId);
1465
- if (sourceNode && targetNode) {
1466
- // Determine connection points based on current node positions
1467
- const startPoint = {
1468
- ...this.orthogonalRouter.findConnectionPoint(sourceNode, {
1469
- x: sourceNode.position.x + sourceNode.size.width / 2,
1470
- y: sourceNode.position.y + sourceNode.size.height / 2,
1471
- }),
1472
- type: 'start',
1473
- position: sourceNode.position,
1474
- };
1475
- const endPoint = {
1476
- ...this.orthogonalRouter.findConnectionPoint(targetNode, {
1477
- x: targetNode.position.x + targetNode.size.width / 2,
1478
- y: targetNode.position.y + targetNode.size.height / 2,
1479
- }),
1480
- type: 'end',
1481
- position: targetNode.position,
1482
- };
1483
- // Calculate completely new route
1484
- const newPoints = this.orthogonalRouter.calculateRoute(sourceNode, targetNode, startPoint, endPoint);
1485
- // Update connection
1467
+ .map((c) => c)
1468
+ .filter((c) => !!c.fromId && !!c.toId);
1469
+ const routed = this.layoutConnections(allConnections, (id) => this.workflowState.getObjectById(id));
1470
+ allConnections
1471
+ .filter((conn) => conn.fromId === nodeId || conn.toId === nodeId)
1472
+ .forEach((connection) => {
1473
+ const newPoints = routed.get(connection.id);
1474
+ if (newPoints) {
1486
1475
  this.workflowState.updateObject(connection.id, {
1487
1476
  points: newPoints,
1488
1477
  });
1489
- // Store new endpoints
1490
- this.connectionEndpoints.set(connection.id, { startPoint, endPoint });
1491
1478
  }
1492
1479
  });
1493
1480
  }
@@ -1595,6 +1582,255 @@ class ConnectionService {
1595
1582
  : { x: node.position.x + node.size.width, y: center.y };
1596
1583
  }
1597
1584
  }
1585
+ getPairKey(fromId, toId) {
1586
+ return fromId <= toId ? `${fromId}::${toId}` : `${toId}::${fromId}`;
1587
+ }
1588
+ /**
1589
+ * Computes non-overlapping connection routes across all connections:
1590
+ * - Chooses the facing side on each node based on relative node centers.
1591
+ * - Spreads all incoming and outgoing anchors sharing a node side evenly,
1592
+ * ordered by the opposite endpoint's position to avoid crossings.
1593
+ * - Staggers bend coordinates for multi-branch connections and separates
1594
+ * parallel/bidirectional pairs into distinct 44px lanes.
1595
+ */
1596
+ layoutConnections(connections, nodeLookup) {
1597
+ const result = new Map();
1598
+ const sideBuckets = new Map();
1599
+ const pairGroups = new Map();
1600
+ const selfLoops = new Map();
1601
+ const connSides = new Map();
1602
+ for (const conn of connections) {
1603
+ if (!conn.fromId || !conn.toId)
1604
+ continue;
1605
+ const source = nodeLookup(conn.fromId);
1606
+ const target = nodeLookup(conn.toId);
1607
+ if (!source || !target)
1608
+ continue;
1609
+ if (conn.fromId === conn.toId) {
1610
+ const list = selfLoops.get(conn.fromId) || [];
1611
+ list.push(conn);
1612
+ selfLoops.set(conn.fromId, list);
1613
+ continue;
1614
+ }
1615
+ const pairKey = this.getPairKey(conn.fromId, conn.toId);
1616
+ const pairList = pairGroups.get(pairKey) || [];
1617
+ pairList.push(conn);
1618
+ pairGroups.set(pairKey, pairList);
1619
+ const sCx = source.position.x + source.size.width / 2;
1620
+ const sCy = source.position.y + source.size.height / 2;
1621
+ const tCx = target.position.x + target.size.width / 2;
1622
+ const tCy = target.position.y + target.size.height / 2;
1623
+ const dx = tCx - sCx;
1624
+ const dy = tCy - sCy;
1625
+ let startSide;
1626
+ let endSide;
1627
+ if (Math.abs(dx) >= Math.abs(dy)) {
1628
+ startSide = dx >= 0 ? 'right' : 'left';
1629
+ endSide = dx >= 0 ? 'left' : 'right';
1630
+ }
1631
+ else {
1632
+ startSide = dy >= 0 ? 'bottom' : 'top';
1633
+ endSide = dy >= 0 ? 'top' : 'bottom';
1634
+ }
1635
+ connSides.set(conn.id, { startSide, endSide, source, target });
1636
+ const sKey = `${source.id}::${startSide}`;
1637
+ const sBucket = sideBuckets.get(sKey) || [];
1638
+ sBucket.push({
1639
+ connId: conn.id,
1640
+ isStart: true,
1641
+ node: source,
1642
+ side: startSide,
1643
+ sortCoord: startSide === 'left' || startSide === 'right' ? tCy : tCx,
1644
+ });
1645
+ sideBuckets.set(sKey, sBucket);
1646
+ const eKey = `${target.id}::${endSide}`;
1647
+ const eBucket = sideBuckets.get(eKey) || [];
1648
+ eBucket.push({
1649
+ connId: conn.id,
1650
+ isStart: false,
1651
+ node: target,
1652
+ side: endSide,
1653
+ sortCoord: endSide === 'left' || endSide === 'right' ? sCy : sCx,
1654
+ });
1655
+ sideBuckets.set(eKey, eBucket);
1656
+ }
1657
+ // Assign evenly spaced anchor points along each node side
1658
+ const startAnchors = new Map();
1659
+ const endAnchors = new Map();
1660
+ for (const bucket of sideBuckets.values()) {
1661
+ bucket.sort((a, b) => a.sortCoord - b.sortCoord || a.connId.localeCompare(b.connId));
1662
+ const count = bucket.length;
1663
+ bucket.forEach((slot, idx) => {
1664
+ const { node, side } = slot;
1665
+ const t = (idx + 1) / (count + 1);
1666
+ const padX = Math.min(10, node.size.width * 0.2);
1667
+ const padY = Math.min(10, node.size.height * 0.2);
1668
+ let point;
1669
+ if (side === 'left' || side === 'right') {
1670
+ const minY = node.position.y + padY;
1671
+ const maxY = node.position.y + node.size.height - padY;
1672
+ point = {
1673
+ x: side === 'left'
1674
+ ? node.position.x
1675
+ : node.position.x + node.size.width,
1676
+ y: count === 1
1677
+ ? node.position.y + node.size.height / 2
1678
+ : minY + t * Math.max(0, maxY - minY),
1679
+ };
1680
+ }
1681
+ else {
1682
+ const minX = node.position.x + padX;
1683
+ const maxX = node.position.x + node.size.width - padX;
1684
+ point = {
1685
+ x: count === 1
1686
+ ? node.position.x + node.size.width / 2
1687
+ : minX + t * Math.max(0, maxX - minX),
1688
+ y: side === 'top'
1689
+ ? node.position.y
1690
+ : node.position.y + node.size.height,
1691
+ };
1692
+ }
1693
+ const entry = { point, slotIndex: idx, slotCount: count };
1694
+ if (slot.isStart) {
1695
+ startAnchors.set(slot.connId, entry);
1696
+ }
1697
+ else {
1698
+ endAnchors.set(slot.connId, entry);
1699
+ }
1700
+ });
1701
+ }
1702
+ // Route self-loops
1703
+ for (const loops of selfLoops.values()) {
1704
+ loops.forEach((conn, idx) => {
1705
+ const node = nodeLookup(conn.fromId);
1706
+ if (!node)
1707
+ return;
1708
+ const loopHeight = 35 + idx * 36;
1709
+ const x1 = node.position.x + node.size.width * 0.35;
1710
+ const x2 = node.position.x + node.size.width * 0.65;
1711
+ const topY = node.position.y;
1712
+ result.set(conn.id, [
1713
+ { x: x1, y: topY },
1714
+ { x: x1, y: topY - loopHeight },
1715
+ { x: x2, y: topY - loopHeight },
1716
+ { x: x2, y: topY },
1717
+ ]);
1718
+ });
1719
+ }
1720
+ // Route node-to-node connections
1721
+ for (const conn of connections) {
1722
+ const info = connSides.get(conn.id);
1723
+ const sAnchor = startAnchors.get(conn.id);
1724
+ const eAnchor = endAnchors.get(conn.id);
1725
+ if (!info || !sAnchor || !eAnchor)
1726
+ continue;
1727
+ const pairKey = this.getPairKey(conn.fromId, conn.toId);
1728
+ const group = pairGroups.get(pairKey) || [conn];
1729
+ if (group.length > 1) {
1730
+ const laneIndex = Math.max(0, group.indexOf(conn));
1731
+ result.set(conn.id, this.calculateSeparatedRoute(info.source, info.target, laneIndex, group.length, sAnchor.point, eAnchor.point));
1732
+ continue;
1733
+ }
1734
+ const start = sAnchor.point;
1735
+ const end = eAnchor.point;
1736
+ const isHorizontal = info.startSide === 'left' || info.startSide === 'right';
1737
+ if (isHorizontal) {
1738
+ if (Math.abs(start.y - end.y) < 4) {
1739
+ result.set(conn.id, [start, end]);
1740
+ }
1741
+ else {
1742
+ const t = sAnchor.slotCount > 1
1743
+ ? 0.3 + (sAnchor.slotIndex / (sAnchor.slotCount - 1)) * 0.4
1744
+ : 0.5;
1745
+ const midX = start.x + (end.x - start.x) * t;
1746
+ result.set(conn.id, [
1747
+ start,
1748
+ { x: midX, y: start.y },
1749
+ { x: midX, y: end.y },
1750
+ end,
1751
+ ]);
1752
+ }
1753
+ }
1754
+ else {
1755
+ if (Math.abs(start.x - end.x) < 4) {
1756
+ result.set(conn.id, [start, end]);
1757
+ }
1758
+ else {
1759
+ const t = sAnchor.slotCount > 1
1760
+ ? 0.3 + (sAnchor.slotIndex / (sAnchor.slotCount - 1)) * 0.4
1761
+ : 0.5;
1762
+ const midY = start.y + (end.y - start.y) * t;
1763
+ result.set(conn.id, [
1764
+ start,
1765
+ { x: start.x, y: midY },
1766
+ { x: end.x, y: midY },
1767
+ end,
1768
+ ]);
1769
+ }
1770
+ }
1771
+ }
1772
+ return result;
1773
+ }
1774
+ /**
1775
+ * Computes separated parallel lanes for multiple or bidirectional connections
1776
+ * sharing the same pair of nodes (and distinct loops for self-connections).
1777
+ */
1778
+ calculateSeparatedRoute(source, target, laneIndex = 0, totalInGroup = 1, customStart, customEnd) {
1779
+ if (source.id === target.id) {
1780
+ const loopHeight = 35 + laneIndex * 36;
1781
+ const x1 = source.position.x + source.size.width * 0.35;
1782
+ const x2 = source.position.x + source.size.width * 0.65;
1783
+ const topY = source.position.y;
1784
+ return [
1785
+ { x: x1, y: topY },
1786
+ { x: x1, y: topY - loopHeight },
1787
+ { x: x2, y: topY - loopHeight },
1788
+ { x: x2, y: topY },
1789
+ ];
1790
+ }
1791
+ const start = customStart || this.getConnectionPoint(source, 'output');
1792
+ const end = customEnd || this.getConnectionPoint(target, 'input');
1793
+ if (totalInGroup <= 1) {
1794
+ return [start, end];
1795
+ }
1796
+ const LANE_SPACING = 44;
1797
+ const offset = (laneIndex - (totalInGroup - 1) / 2) * LANE_SPACING;
1798
+ if (Math.abs(offset) < 0.01) {
1799
+ return [start, end];
1800
+ }
1801
+ // Use a canonical node order so A->B and B->A shift along opposite sides
1802
+ const [canonA, canonB] = source.id <= target.id ? [source, target] : [target, source];
1803
+ const cAx = canonA.position.x + canonA.size.width / 2;
1804
+ const cAy = canonA.position.y + canonA.size.height / 2;
1805
+ const cBx = canonB.position.x + canonB.size.width / 2;
1806
+ const cBy = canonB.position.y + canonB.size.height / 2;
1807
+ const cdx = cBx - cAx;
1808
+ const cdy = cBy - cAy;
1809
+ const cLen = Math.hypot(cdx, cdy) || 1;
1810
+ const nx = -cdy / cLen;
1811
+ const ny = cdx / cLen;
1812
+ const pad = 8;
1813
+ const clamp = (val, min, max) => min <= max ? Math.min(Math.max(val, min), max) : (min + max) / 2;
1814
+ const p0 = {
1815
+ x: start.x,
1816
+ y: clamp(start.y + offset * ny, source.position.y + pad, source.position.y + source.size.height - pad),
1817
+ };
1818
+ const p3 = {
1819
+ x: end.x,
1820
+ y: clamp(end.y + offset * ny, target.position.y + pad, target.position.y + target.size.height - pad),
1821
+ };
1822
+ const dx = end.x - start.x;
1823
+ const dy = end.y - start.y;
1824
+ const p1 = {
1825
+ x: start.x + dx * 0.2 + offset * nx,
1826
+ y: start.y + dy * 0.2 + offset * ny,
1827
+ };
1828
+ const p2 = {
1829
+ x: start.x + dx * 0.8 + offset * nx,
1830
+ y: start.y + dy * 0.8 + offset * ny,
1831
+ };
1832
+ return [p0, p1, p2, p3];
1833
+ }
1598
1834
  recalculateConnectionPoints(source, target, existingPoints) {
1599
1835
  // Start and end points
1600
1836
  const startPoint = this.getConnectionPoint(source, 'output');
@@ -1766,6 +2002,7 @@ class WorkflowMapperService {
1766
2002
  TenantId: frontendAction.tenantId || '',
1767
2003
  Position: frontendAction.order,
1768
2004
  Caption: frontendAction.caption,
2005
+ Form: frontendAction.form,
1769
2006
  ServiceName: 'Workflow',
1770
2007
  CreatedAt: frontendAction.createdAt || new Date(),
1771
2008
  UpdatedAt: new Date(),
@@ -1893,8 +2130,20 @@ class WorkflowMapperService {
1893
2130
  createdAt: action.CreatedAt,
1894
2131
  position: action.Position,
1895
2132
  caption: action.Caption,
2133
+ form: action.Form,
1896
2134
  }));
1897
2135
  });
2136
+ // Compute separated routes across all connections (entry + stage actions)
2137
+ const stageMap = new Map();
2138
+ stages.forEach((s) => stageMap.set(s.id, s));
2139
+ const startNode = this.createStartNode();
2140
+ const routed = this.connectionService.layoutConnections(connections, (id) => stageMap.get(id) || (id === startNodeId ? startNode : undefined));
2141
+ connections.forEach((conn) => {
2142
+ const pts = routed.get(conn.id);
2143
+ if (pts) {
2144
+ conn.points = pts;
2145
+ }
2146
+ });
1898
2147
  return connections;
1899
2148
  }
1900
2149
  createConnection(id, fromId, toId, label, stages, properties) {
@@ -1914,7 +2163,7 @@ class WorkflowMapperService {
1914
2163
  ...properties,
1915
2164
  };
1916
2165
  }
1917
- const points = this.connectionService.recalculateConnectionPoints(sourceNode, targetNode, []);
2166
+ const points = this.connectionService.calculateSeparatedRoute(sourceNode, targetNode, properties?.laneIndex ?? 0, properties?.totalInGroup ?? 1);
1918
2167
  return {
1919
2168
  id,
1920
2169
  type: 'action',
@@ -1934,6 +2183,7 @@ class WorkflowMapperService {
1934
2183
  properties: properties?.properties,
1935
2184
  order: properties?.position,
1936
2185
  caption: properties?.caption,
2186
+ form: properties?.form,
1937
2187
  };
1938
2188
  }
1939
2189
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: WorkflowMapperService, deps: [{ token: ConnectionService }], target: i0.ɵɵFactoryTarget.Injectable });
@@ -3438,7 +3688,7 @@ class WFCanvasComponent {
3438
3688
  (select)="onNodeSelected($event)"
3439
3689
  (cancel)="onNodeSelectionCancelled()"
3440
3690
  />
3441
- `, isInline: true, styles: [".canvas-container{flex:1;overflow:auto;position:relative;background:#fff;&.connecting{cursor:crosshair}}.connection{path{stroke:#d36cff;stroke-width:2;fill:none;pointer-events:none}&.selected path{stroke-width:3}}.selected{:not(text){stroke-width:3}}.dragging{cursor:grabbing}.connection{pointer-events:none}.segment-group{pointer-events:all}.segment-hitarea{stroke:transparent;stroke-width:10;fill:none}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: LabelEditorComponent, selector: "wf-label-editor", inputs: ["label", "x", "y", "isConnection", "isSwimlane"], outputs: ["labelChange", "openDialog"] }, { kind: "component", type: SwimlaneLabelComponent, selector: "[wf-swimlane-label]", inputs: ["label", "count"], outputs: ["addClick", "labelChange"] }, { kind: "component", type: SwimLanePopupComponent, selector: "wf-swimlane-popup", inputs: ["position"], outputs: ["close", "actionSelected"] }, { kind: "component", type: NodeSelectorComponent, selector: "wf-node-selector", outputs: ["select"] }] });
3691
+ `, isInline: true, styles: [".canvas-container{flex:1;overflow:auto;position:relative;background:#fff;&.connecting{cursor:crosshair}}.connection{path{stroke:#d36cff;stroke-width:2;fill:none;pointer-events:none}&.selected path{stroke-width:3}}.selected{:not(text){stroke-width:3}}.dragging{cursor:grabbing}.connection{pointer-events:none}.segment-group{pointer-events:all}.segment-hitarea{stroke:transparent;stroke-width:10;fill:none}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: LabelEditorComponent, selector: "wf-label-editor", inputs: ["label", "x", "y", "isConnection", "hasForm", "isSwimlane"], outputs: ["labelChange", "openDialog"] }, { kind: "component", type: SwimlaneLabelComponent, selector: "[wf-swimlane-label]", inputs: ["label", "count"], outputs: ["addClick", "labelChange"] }, { kind: "component", type: SwimLanePopupComponent, selector: "wf-swimlane-popup", inputs: ["position"], outputs: ["close", "actionSelected"] }, { kind: "component", type: NodeSelectorComponent, selector: "wf-node-selector", outputs: ["select"] }] });
3442
3692
  }
3443
3693
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: WFCanvasComponent, decorators: [{
3444
3694
  type: Component,