verben-workflow-ui 0.5.83 → 0.5.84
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/README.md +33 -2
- package/esm2022/src/lib/base/core/base-data-page.facade.mjs +412 -0
- package/esm2022/src/lib/base/core/base-data-page.service.mjs +140 -0
- package/esm2022/src/lib/base/core/base-data-page.state.mjs +216 -0
- package/esm2022/src/lib/base/handlers/filter-handler.service.mjs +138 -0
- package/esm2022/src/lib/base/handlers/search-handler.service.mjs +31 -0
- package/esm2022/src/lib/base/handlers/sort-handler.service.mjs +73 -0
- package/esm2022/src/lib/base/index.mjs +2 -0
- package/esm2022/src/lib/base/models/api-payload.mjs +7 -0
- package/esm2022/src/lib/base/models/page-config.interface.mjs +2 -0
- package/esm2022/src/lib/base/models/page-filter-tab-option.interface.mjs +2 -0
- package/esm2022/src/lib/base/public-api.mjs +14 -0
- package/esm2022/src/lib/base/utils/column-helpers.mjs +55 -0
- package/esm2022/src/lib/base/verben-workflow-ui-src-lib-base.mjs +5 -0
- package/esm2022/src/lib/components/actors/actors.component.mjs +156 -110
- package/esm2022/src/lib/components/actors/actors.config.mjs +49 -0
- package/esm2022/src/lib/components/actors/actors.facade.mjs +46 -242
- package/esm2022/src/lib/components/actors/actors.form.component.mjs +20 -24
- package/esm2022/src/lib/components/actors/actors.service.mjs +49 -62
- package/esm2022/src/lib/components/actors/actors.state.mjs +11 -80
- package/esm2022/src/lib/components/designer/components/node-selector.component.mjs +1 -3
- package/esm2022/src/lib/components/designer/components/wf-designer.component.mjs +1 -4
- package/esm2022/src/lib/components/designer/services/node-precondition.service.mjs +1 -2
- package/esm2022/src/lib/components/designer/services/wf-mapper.service.mjs +1 -2
- package/esm2022/src/lib/components/designer/services/wf-persistence.service.mjs +27 -25
- package/esm2022/src/lib/components/flowable-status/flowable-status.component.mjs +169 -102
- package/esm2022/src/lib/components/flowable-status/flowable-status.config.mjs +47 -0
- package/esm2022/src/lib/components/flowable-status/flowable-status.facade.mjs +56 -203
- package/esm2022/src/lib/components/flowable-status/flowable-status.service.mjs +25 -44
- package/esm2022/src/lib/components/flowable-status/flowable-status.state.mjs +10 -80
- package/esm2022/src/lib/components/form-control/form-control.component.mjs +1 -3
- package/esm2022/src/lib/components/form-group/form-fields/form-fields.component.mjs +2 -8
- package/esm2022/src/lib/components/form-group/form-group.component.mjs +2 -10
- package/esm2022/src/lib/components/form-response/form-response.component.mjs +1 -5
- package/esm2022/src/lib/components/form-timer/form-timer.component.mjs +1 -4
- package/esm2022/src/lib/components/forms/forms.component.mjs +1 -1
- package/esm2022/src/lib/components/my-queue/my-queue.component.mjs +1 -1
- package/esm2022/src/lib/components/my-queue/my-queue.facade.mjs +1 -20
- package/esm2022/src/lib/components/my-queue/tasks.form.component.mjs +1 -4
- package/esm2022/src/lib/components/operation-popup/operation-popup.component.mjs +1 -13
- package/esm2022/src/lib/components/operation-popup/operation-popup.facade.mjs +1 -15
- package/esm2022/src/lib/components/stage-details/stage-details.component.mjs +1 -3
- package/esm2022/src/lib/components/task-history/task-history.component.mjs +1 -5
- package/esm2022/src/lib/components/task-notification/task-notification.component.mjs +1 -1
- package/esm2022/src/lib/components/tasks/tasks.component.mjs +1 -1
- package/esm2022/src/lib/components/tasks/tasks.facade.mjs +1 -16
- package/esm2022/src/lib/components/tasks/tasks.form.component.mjs +1 -4
- package/esm2022/src/lib/components/wf/wf.component.mjs +1 -2
- package/esm2022/src/lib/components/workflow/workflow.component.mjs +2 -8
- package/esm2022/src/lib/components/workflow-designer/action-dialog/action-dialog.component.mjs +16 -10
- package/esm2022/src/lib/components/workflow-designer/actor-tags-dialog/actor-tags-dialog.component.mjs +10 -2
- package/esm2022/src/lib/components/workflow-designer/conditions-popup/conditions-popup.component.mjs +12 -1
- package/esm2022/src/lib/components/workflow-designer/decision-popup/decision-popup.component.mjs +20 -1
- package/esm2022/src/lib/components/workflow-designer/designer-canvas/designer-canvas.component.mjs +105 -66
- package/esm2022/src/lib/components/workflow-designer/designer-toolbar/designer-toolbar.component.mjs +14 -1
- package/esm2022/src/lib/components/workflow-designer/escalation-dialog/escalation-dialog.component.mjs +16 -12
- package/esm2022/src/lib/components/workflow-designer/services/connection.service.mjs +17 -2
- package/esm2022/src/lib/components/workflow-designer/services/node-management.service.mjs +23 -2
- package/esm2022/src/lib/components/workflow-designer/services/popup.service.mjs +10 -5
- package/esm2022/src/lib/components/workflow-designer/services/swimlane.service.mjs +16 -3
- package/esm2022/src/lib/components/workflow-designer/services/transformer.service.mjs +16 -1
- package/esm2022/src/lib/components/workflow-designer/stage-dialog/stage-dialog.component.mjs +16 -14
- package/esm2022/src/lib/components/workflow-designer/stage-node/stage-node.component.mjs +15 -6
- package/esm2022/src/lib/components/workflow-designer/swimlane-dialog/swimlane-dialog.component.mjs +15 -8
- package/esm2022/src/lib/components/workflow-designer/workflow-data.service.mjs +25 -1
- package/esm2022/src/lib/components/workflow-designer/workflow-designer.component.mjs +75 -23
- package/esm2022/src/lib/components/workflow-designer/workflow-designer.module.mjs +20 -1
- package/esm2022/src/lib/components/workflow-designer/workflow-designer.state.mjs +181 -18
- package/esm2022/src/lib/components/workflow-designer/workflow-designer.types.mjs +1 -1
- package/esm2022/src/lib/components/workflows/public-api.mjs +4 -1
- package/esm2022/src/lib/components/workflows/workflow-form/workflow-form.component.mjs +1 -5
- package/esm2022/src/lib/components/workflows/workflows.api.mjs +63 -0
- package/esm2022/src/lib/components/workflows/workflows.component.mjs +194 -148
- package/esm2022/src/lib/components/workflows/workflows.config.mjs +50 -0
- package/esm2022/src/lib/components/workflows/workflows.facade.mjs +106 -298
- package/esm2022/src/lib/components/workflows/workflows.service.mjs +58 -117
- package/esm2022/src/lib/components/workflows/workflows.state.mjs +12 -81
- package/esm2022/src/lib/services/environment.service.mjs +1 -2
- package/esm2022/src/lib/services/http-web-request.service.mjs +12 -10
- package/esm2022/src/lib/services/util.service.mjs +18 -16
- package/esm2022/src/lib/shared/components/base-data-view.component.mjs +1 -5
- package/fesm2022/verben-workflow-ui-src-lib-base.mjs +1055 -0
- package/fesm2022/verben-workflow-ui-src-lib-base.mjs.map +1 -0
- package/fesm2022/verben-workflow-ui-src-lib-components-actors.mjs +314 -508
- package/fesm2022/verben-workflow-ui-src-lib-components-actors.mjs.map +1 -1
- package/fesm2022/verben-workflow-ui-src-lib-components-designer.mjs +26 -31
- package/fesm2022/verben-workflow-ui-src-lib-components-designer.mjs.map +1 -1
- package/fesm2022/verben-workflow-ui-src-lib-components-flowable-status.mjs +289 -417
- package/fesm2022/verben-workflow-ui-src-lib-components-flowable-status.mjs.map +1 -1
- package/fesm2022/verben-workflow-ui-src-lib-components-form-control.mjs +0 -2
- package/fesm2022/verben-workflow-ui-src-lib-components-form-control.mjs.map +1 -1
- package/fesm2022/verben-workflow-ui-src-lib-components-form-group.mjs +2 -16
- package/fesm2022/verben-workflow-ui-src-lib-components-form-group.mjs.map +1 -1
- package/fesm2022/verben-workflow-ui-src-lib-components-form-response.mjs +0 -4
- package/fesm2022/verben-workflow-ui-src-lib-components-form-response.mjs.map +1 -1
- package/fesm2022/verben-workflow-ui-src-lib-components-form-timer.mjs +0 -3
- package/fesm2022/verben-workflow-ui-src-lib-components-form-timer.mjs.map +1 -1
- package/fesm2022/verben-workflow-ui-src-lib-components-forms.mjs +1 -1
- package/fesm2022/verben-workflow-ui-src-lib-components-forms.mjs.map +1 -1
- package/fesm2022/verben-workflow-ui-src-lib-components-my-queue.mjs +1 -23
- package/fesm2022/verben-workflow-ui-src-lib-components-my-queue.mjs.map +1 -1
- package/fesm2022/verben-workflow-ui-src-lib-components-operation-popup.mjs +0 -26
- package/fesm2022/verben-workflow-ui-src-lib-components-operation-popup.mjs.map +1 -1
- package/fesm2022/verben-workflow-ui-src-lib-components-stage-details.mjs +0 -2
- package/fesm2022/verben-workflow-ui-src-lib-components-stage-details.mjs.map +1 -1
- package/fesm2022/verben-workflow-ui-src-lib-components-task-history.mjs +0 -4
- package/fesm2022/verben-workflow-ui-src-lib-components-task-history.mjs.map +1 -1
- package/fesm2022/verben-workflow-ui-src-lib-components-task-notification.mjs +1 -1
- package/fesm2022/verben-workflow-ui-src-lib-components-task-notification.mjs.map +1 -1
- package/fesm2022/verben-workflow-ui-src-lib-components-tasks.mjs +1 -19
- package/fesm2022/verben-workflow-ui-src-lib-components-tasks.mjs.map +1 -1
- package/fesm2022/verben-workflow-ui-src-lib-components-wf.mjs +0 -1
- package/fesm2022/verben-workflow-ui-src-lib-components-wf.mjs.map +1 -1
- package/fesm2022/verben-workflow-ui-src-lib-components-workflow-designer.mjs +603 -158
- package/fesm2022/verben-workflow-ui-src-lib-components-workflow-designer.mjs.map +1 -1
- package/fesm2022/verben-workflow-ui-src-lib-components-workflow.mjs +1 -7
- package/fesm2022/verben-workflow-ui-src-lib-components-workflow.mjs.map +1 -1
- package/fesm2022/verben-workflow-ui-src-lib-components-workflows.mjs +427 -623
- package/fesm2022/verben-workflow-ui-src-lib-components-workflows.mjs.map +1 -1
- package/fesm2022/verben-workflow-ui-src-lib-services.mjs +28 -25
- package/fesm2022/verben-workflow-ui-src-lib-services.mjs.map +1 -1
- package/fesm2022/verben-workflow-ui-src-lib-shared.mjs +0 -4
- package/fesm2022/verben-workflow-ui-src-lib-shared.mjs.map +1 -1
- package/package.json +47 -41
- package/src/lib/base/README.md +146 -0
- package/src/lib/base/core/base-data-page.facade.d.ts +138 -0
- package/src/lib/base/core/base-data-page.service.d.ts +61 -0
- package/src/lib/base/core/base-data-page.state.d.ts +73 -0
- package/src/lib/base/handlers/filter-handler.service.d.ts +34 -0
- package/src/lib/base/handlers/search-handler.service.d.ts +20 -0
- package/src/lib/base/handlers/sort-handler.service.d.ts +30 -0
- package/src/lib/base/index.d.ts +1 -0
- package/src/lib/base/models/api-payload.d.ts +2 -0
- package/src/lib/base/models/page-config.interface.d.ts +24 -0
- package/src/lib/base/models/page-filter-tab-option.interface.d.ts +19 -0
- package/src/lib/base/public-api.d.ts +9 -0
- package/src/lib/base/utils/column-helpers.d.ts +24 -0
- package/src/lib/components/actors/actors.component.d.ts +66 -18
- package/src/lib/components/actors/actors.config.d.ts +10 -0
- package/src/lib/components/actors/actors.facade.d.ts +19 -27
- package/src/lib/components/actors/actors.form.component.d.ts +8 -8
- package/src/lib/components/actors/actors.service.d.ts +23 -43
- package/src/lib/components/actors/actors.state.d.ts +10 -27
- package/src/lib/components/flowable-status/flowable-status.component.d.ts +64 -18
- package/src/lib/components/flowable-status/flowable-status.config.d.ts +11 -0
- package/src/lib/components/flowable-status/flowable-status.facade.d.ts +19 -25
- package/src/lib/components/flowable-status/flowable-status.service.d.ts +17 -29
- package/src/lib/components/flowable-status/flowable-status.state.d.ts +7 -26
- package/src/lib/components/workflow-designer/action-dialog/action-dialog.component.d.ts +4 -0
- package/src/lib/components/workflow-designer/actor-tags-dialog/actor-tags-dialog.component.d.ts +1 -0
- package/src/lib/components/workflow-designer/conditions-popup/conditions-popup.component.d.ts +4 -0
- package/src/lib/components/workflow-designer/decision-popup/decision-popup.component.d.ts +3 -0
- package/src/lib/components/workflow-designer/designer-canvas/designer-canvas.component.d.ts +104 -0
- package/src/lib/components/workflow-designer/designer-toolbar/designer-toolbar.component.d.ts +6 -0
- package/src/lib/components/workflow-designer/escalation-dialog/escalation-dialog.component.d.ts +4 -0
- package/src/lib/components/workflow-designer/services/connection.service.d.ts +16 -0
- package/src/lib/components/workflow-designer/services/node-management.service.d.ts +22 -1
- package/src/lib/components/workflow-designer/services/popup.service.d.ts +9 -1
- package/src/lib/components/workflow-designer/services/swimlane.service.d.ts +15 -0
- package/src/lib/components/workflow-designer/services/transformer.service.d.ts +15 -0
- package/src/lib/components/workflow-designer/stage-dialog/stage-dialog.component.d.ts +3 -0
- package/src/lib/components/workflow-designer/stage-node/stage-node.component.d.ts +4 -0
- package/src/lib/components/workflow-designer/swimlane-dialog/swimlane-dialog.component.d.ts +4 -0
- package/src/lib/components/workflow-designer/workflow-data.service.d.ts +24 -0
- package/src/lib/components/workflow-designer/workflow-designer.component.d.ts +74 -0
- package/src/lib/components/workflow-designer/workflow-designer.module.d.ts +19 -0
- package/src/lib/components/workflow-designer/workflow-designer.state.d.ts +179 -0
- package/src/lib/components/workflow-designer/workflow-designer.types.d.ts +80 -0
- package/src/lib/components/workflows/public-api.d.ts +1 -0
- package/src/lib/components/workflows/workflows.api.d.ts +38 -0
- package/src/lib/components/workflows/workflows.component.d.ts +78 -29
- package/src/lib/components/workflows/workflows.config.d.ts +10 -0
- package/src/lib/components/workflows/workflows.facade.d.ts +31 -28
- package/src/lib/components/workflows/workflows.service.d.ts +28 -74
- package/src/lib/components/workflows/workflows.state.d.ts +8 -26
- package/src/lib/services/http-web-request.service.d.ts +1 -1
- package/src/lib/services/util.service.d.ts +8 -0
- package/esm2022/src/lib/components/workflows/workflows.helper.mjs +0 -21
- package/src/lib/components/workflows/workflows.helper.d.ts +0 -3
|
@@ -14,22 +14,77 @@ import { BehaviorSubject } from 'rxjs';
|
|
|
14
14
|
import * as i6 from 'verben-reporting-ui';
|
|
15
15
|
import { EditorMode, EditorModule } from 'verben-reporting-ui';
|
|
16
16
|
|
|
17
|
+
/**
|
|
18
|
+
* The designer's single source of truth — and, in practice, its domain-logic
|
|
19
|
+
* god object. Holds the entire editing model plus most of the behaviour that
|
|
20
|
+
* operates on it: node placement, connection creation and routing, connection
|
|
21
|
+
* rules, swimlane management, and the whole save-time transform.
|
|
22
|
+
*
|
|
23
|
+
* ## How mutation works here
|
|
24
|
+
*
|
|
25
|
+
* This is a `providedIn: 'root'` singleton injected **by reference** into every
|
|
26
|
+
* component that touches the model. Components mutate its arrays directly
|
|
27
|
+
* (`state.connections.push(...)`) — there is no store, reducer, or action
|
|
28
|
+
* indirection. Change detection works because templates iterate
|
|
29
|
+
* `state.swimlanes` / `state.connections` with `@for`.
|
|
30
|
+
*
|
|
31
|
+
* The one deliberate exception is {@link moveNodeToSwimlane}, which reassigns
|
|
32
|
+
* arrays immutably so `@for` re-renders **both** the source and target lanes.
|
|
33
|
+
* In-place mutation is fine everywhere else, but not across two lanes at once.
|
|
34
|
+
*
|
|
35
|
+
* ## Before you change this class
|
|
36
|
+
*
|
|
37
|
+
* A parallel implementation exists under `services/` (`NodeManagementService`,
|
|
38
|
+
* `ConnectionService`, `TransformerService`, ...) that duplicates much of this
|
|
39
|
+
* logic. It is only partially wired in, and the copies have **drifted** — the
|
|
40
|
+
* two disagree on node placement offsets, connection endpoint offsets, and
|
|
41
|
+
* which node types may connect. This class is the live path; the services are
|
|
42
|
+
* mostly not. Change this one.
|
|
43
|
+
*
|
|
44
|
+
* @see ./docs/01-architecture.md — the split-brain problem in full
|
|
45
|
+
* @see ./docs/02-coordinate-system.md — read before touching any coordinate math
|
|
46
|
+
* @see ./docs/06-known-issues.md — the catalogued divergences
|
|
47
|
+
*/
|
|
17
48
|
class WorkflowDesignerState {
|
|
49
|
+
/** Ordered lanes. Each owns its own nodes; there is no flat node list. */
|
|
18
50
|
swimlanes = [];
|
|
19
|
-
|
|
51
|
+
/** Id of the workflow's entry-point node. */
|
|
52
|
+
startNodeId = null;
|
|
53
|
+
/** All edges, flat across lanes. */
|
|
20
54
|
connections = [];
|
|
21
55
|
draggingConnectionData = {};
|
|
22
56
|
workflowFormId = null;
|
|
23
57
|
workflowFormName = null;
|
|
24
58
|
workflowId = null;
|
|
59
|
+
/**
|
|
60
|
+
* The workflow exactly as loaded from the API.
|
|
61
|
+
*
|
|
62
|
+
* This and the three `*Record` maps below are kept so that save can tell new
|
|
63
|
+
* objects from changed ones and emit the correct `ObjectState`. Losing them
|
|
64
|
+
* makes every entity look new on the next save.
|
|
65
|
+
*/
|
|
25
66
|
workflow = null;
|
|
67
|
+
/** Originally-loaded lanes, keyed by id. */
|
|
26
68
|
swimlaneRecord = {};
|
|
69
|
+
/** Originally-loaded stages, keyed by id. */
|
|
27
70
|
stageRecord = {};
|
|
71
|
+
/** Originally-loaded actions, keyed by id. */
|
|
28
72
|
actionRecord = {};
|
|
29
73
|
setWorkflowId(id) {
|
|
30
74
|
this.workflowId = id;
|
|
31
75
|
}
|
|
32
76
|
laneIdToIndexMap = new Map();
|
|
77
|
+
/**
|
|
78
|
+
* Which node types each source type may connect to. Consulted by
|
|
79
|
+
* {@link canConnect} and {@link getAllowedTargetNodeTypes}.
|
|
80
|
+
*
|
|
81
|
+
* Forms are terminal sinks — they accept incoming edges but have no outgoing
|
|
82
|
+
* ones, which is why `form` maps to an empty list.
|
|
83
|
+
*
|
|
84
|
+
* ⚠️ `ConnectionService` holds a **different** copy of this table that also
|
|
85
|
+
* allows `stage → form`. The two have drifted; this one is the live path.
|
|
86
|
+
* See `./docs/06-known-issues.md` section A.
|
|
87
|
+
*/
|
|
33
88
|
connectionRules = {
|
|
34
89
|
stage: ['stage', 'decision', 'subflow'],
|
|
35
90
|
decision: ['stage'], // Decisions can only connect to Stages
|
|
@@ -40,7 +95,6 @@ class WorkflowDesignerState {
|
|
|
40
95
|
setWorkflowForm(formId, formName) {
|
|
41
96
|
this.workflowFormId = formId;
|
|
42
97
|
this.workflowFormName = formName;
|
|
43
|
-
console.log(this.workflowFormId, this.workflowFormName);
|
|
44
98
|
}
|
|
45
99
|
addSwimlane(name, tags) {
|
|
46
100
|
// Generate a unique key for this swimlane
|
|
@@ -58,7 +112,19 @@ class WorkflowDesignerState {
|
|
|
58
112
|
registerLaneMapping(laneId, swimlaneIndex) {
|
|
59
113
|
this.laneIdToIndexMap.set(laneId, swimlaneIndex);
|
|
60
114
|
}
|
|
61
|
-
|
|
115
|
+
/**
|
|
116
|
+
* Builds the attachment points for a node, laid out to match its rendered
|
|
117
|
+
* shape. Returned coordinates are **relative to the node's own origin**.
|
|
118
|
+
*
|
|
119
|
+
* Layout per type:
|
|
120
|
+
* - **stage** — points every 50px along all four edges.
|
|
121
|
+
* - **decision** — one point at each of the diamond's four edge midpoints.
|
|
122
|
+
* - **form** — `left` (input) points only; forms are terminal sinks.
|
|
123
|
+
* - **subflow** — top, bottom, and two points on each of left and right.
|
|
124
|
+
*
|
|
125
|
+
* Regenerate these whenever a node's size or type changes, or connections
|
|
126
|
+
* will reference point ids that no longer exist.
|
|
127
|
+
*/
|
|
62
128
|
generateConnectionPoints(node) {
|
|
63
129
|
const points = [];
|
|
64
130
|
const spacing = 50; // Space between connection points
|
|
@@ -196,6 +262,43 @@ class WorkflowDesignerState {
|
|
|
196
262
|
}
|
|
197
263
|
return points;
|
|
198
264
|
}
|
|
265
|
+
/**
|
|
266
|
+
* Creates a node in a swimlane and returns it (or `null` if the lane or type
|
|
267
|
+
* is invalid).
|
|
268
|
+
*
|
|
269
|
+
* ## Coordinate contract — callers must obey both halves
|
|
270
|
+
*
|
|
271
|
+
* 1. `y` must be an **absolute canvas Y**, not lane-relative. This method
|
|
272
|
+
* converts it internally (`y - swimlaneIndex * 263`).
|
|
273
|
+
* 2. `swimlaneIndex` must be the **drop-target** lane — the lane the node is
|
|
274
|
+
* landing in — not the lane a drag started from.
|
|
275
|
+
*
|
|
276
|
+
* Violating either half double-subtracts the lane offset and the node renders
|
|
277
|
+
* roughly one lane too high, attached to the wrong swimlane. That was the
|
|
278
|
+
* connection-drop bug; `designer-canvas.connection-drop.spec.ts` pins it.
|
|
279
|
+
*
|
|
280
|
+
* The canonical correct caller is toolbar placement in
|
|
281
|
+
* `workflow-designer.component.ts`:
|
|
282
|
+
*
|
|
283
|
+
* ```ts
|
|
284
|
+
* const swimlaneIndex = Math.floor(event.y / 263); // target lane from drop Y
|
|
285
|
+
* this.state.addNode(swimlaneIndex, 'stage', event.x, event.y /* absolute *\/);
|
|
286
|
+
* ```
|
|
287
|
+
*
|
|
288
|
+
* The first node created in an empty workflow is automatically marked as the
|
|
289
|
+
* start node.
|
|
290
|
+
*
|
|
291
|
+
* ⚠️ `NodeManagementService.addNode` applies an extra `- 40` that this method
|
|
292
|
+
* and the render template do not. See `./docs/06-known-issues.md` section A.
|
|
293
|
+
*
|
|
294
|
+
* @param swimlaneIndex Target lane index (the lane the node lands in).
|
|
295
|
+
* @param type Node type; `'swimlane'` and `'action'` are rejected.
|
|
296
|
+
* @param x Canvas X.
|
|
297
|
+
* @param y **Absolute** canvas Y.
|
|
298
|
+
* @param useExistingId Reuse `stageData.Code` as the node id instead of
|
|
299
|
+
* generating one — used when rebuilding nodes from a loaded workflow so
|
|
300
|
+
* they keep their backend identity.
|
|
301
|
+
*/
|
|
199
302
|
addNode(swimlaneIndex, type, x, y, stageData, workflowData, useExistingId = false) {
|
|
200
303
|
if (!this.swimlanes[swimlaneIndex] ||
|
|
201
304
|
!type ||
|
|
@@ -273,13 +376,19 @@ class WorkflowDesignerState {
|
|
|
273
376
|
}
|
|
274
377
|
}
|
|
275
378
|
endConnectionDrag() {
|
|
276
|
-
console.log('Ending connection drag, clearing data');
|
|
277
379
|
// Clear dragging data
|
|
278
380
|
this.draggingConnectionData = {};
|
|
279
381
|
}
|
|
280
382
|
isConnectionDragging() {
|
|
281
383
|
return !!this.draggingConnectionData.sourcePoint;
|
|
282
384
|
}
|
|
385
|
+
/**
|
|
386
|
+
* Endpoints for the **in-progress** connection preview line: from the source
|
|
387
|
+
* point (resolved to absolute canvas space) to the current cursor position.
|
|
388
|
+
*
|
|
389
|
+
* Returns `null` when no drag is active. For a *saved* connection's
|
|
390
|
+
* endpoints, use {@link getConnectionData} instead.
|
|
391
|
+
*/
|
|
283
392
|
getConnectionPathData() {
|
|
284
393
|
if (!this.draggingConnectionData.sourcePoint)
|
|
285
394
|
return null;
|
|
@@ -298,10 +407,20 @@ class WorkflowDesignerState {
|
|
|
298
407
|
sourceSwimlaneIndex,
|
|
299
408
|
};
|
|
300
409
|
}
|
|
410
|
+
/**
|
|
411
|
+
* Completes the in-progress drag by pushing a `Connection` from the recorded
|
|
412
|
+
* source point to the given target, and returns it.
|
|
413
|
+
*
|
|
414
|
+
* Reads the source from {@link draggingConnectionData}, so it is only valid
|
|
415
|
+
* during a drag — returns `null` if no source was recorded.
|
|
416
|
+
*
|
|
417
|
+
* Note this does **not** check {@link canConnect}; callers are expected to
|
|
418
|
+
* have validated the pairing before calling. The new connection has an empty
|
|
419
|
+
* label and no action — those are filled in afterwards via the action dialog.
|
|
420
|
+
*/
|
|
301
421
|
createConnection(targetNodeId, targetPointId, targetSwimlaneIndex) {
|
|
302
422
|
const { sourcePoint, sourceSwimlaneIndex } = this.draggingConnectionData;
|
|
303
423
|
if (!sourcePoint || sourceSwimlaneIndex === undefined) {
|
|
304
|
-
console.error('Missing source data for connection');
|
|
305
424
|
return null;
|
|
306
425
|
}
|
|
307
426
|
const connection = {
|
|
@@ -316,11 +435,29 @@ class WorkflowDesignerState {
|
|
|
316
435
|
action: null,
|
|
317
436
|
};
|
|
318
437
|
this.connections.push(connection);
|
|
319
|
-
console.log('Created connection:', connection);
|
|
320
|
-
console.log('Connections array now has', this.connections.length, 'connections');
|
|
321
438
|
return connection;
|
|
322
439
|
}
|
|
323
|
-
|
|
440
|
+
/**
|
|
441
|
+
* Resolves a saved connection's endpoints into **absolute canvas
|
|
442
|
+
* coordinates** for rendering:
|
|
443
|
+
*
|
|
444
|
+
* ```
|
|
445
|
+
* startY = sourceNode.y + sourcePoint.y + connection.sourceSwimlaneIndex * 263
|
|
446
|
+
* endY = targetNode.y + targetPoint.y + connection.targetSwimlaneIndex * 263
|
|
447
|
+
* ```
|
|
448
|
+
*
|
|
449
|
+
* Both offsets are needed because `node.y` is lane-relative and `point.y` is
|
|
450
|
+
* node-relative.
|
|
451
|
+
*
|
|
452
|
+
* Returns `null` if either endpoint's node no longer exists — callers should
|
|
453
|
+
* treat that as "skip rendering this edge", not as an error.
|
|
454
|
+
*
|
|
455
|
+
* ⚠️ Relies on the connection's denormalised lane indices being current. A
|
|
456
|
+
* node moved between lanes without its connections updated renders detached.
|
|
457
|
+
*
|
|
458
|
+
* ⚠️ `ConnectionService.getConnectionData` adds a further `+ 40` here. The two
|
|
459
|
+
* disagree; this is the live path. See `./docs/06-known-issues.md` section A.
|
|
460
|
+
*/
|
|
324
461
|
getConnectionData(connection) {
|
|
325
462
|
const sourceNodeInfo = this.findNodeById(connection.sourceNodeId);
|
|
326
463
|
const targetNodeInfo = this.findNodeById(connection.targetNodeId);
|
|
@@ -349,11 +486,18 @@ class WorkflowDesignerState {
|
|
|
349
486
|
targetSwimlaneIndex: connection.targetSwimlaneIndex,
|
|
350
487
|
};
|
|
351
488
|
}
|
|
352
|
-
|
|
489
|
+
/**
|
|
490
|
+
* Whether an edge from `sourceNodeType` to `targetNodeType` is permitted by
|
|
491
|
+
* {@link connectionRules}. Unknown types return `false`.
|
|
492
|
+
*/
|
|
353
493
|
canConnect(sourceNodeType, targetNodeType) {
|
|
354
494
|
return (this.connectionRules[sourceNodeType]?.includes(targetNodeType) || false);
|
|
355
495
|
}
|
|
356
|
-
|
|
496
|
+
/**
|
|
497
|
+
* Node types the in-progress drag is allowed to land on. Drives the choices
|
|
498
|
+
* offered in the node-type popup when a connection is dropped on empty
|
|
499
|
+
* canvas. Empty when no drag is active.
|
|
500
|
+
*/
|
|
357
501
|
getAllowedTargetNodeTypes() {
|
|
358
502
|
if (!this.draggingConnectionData.sourcePoint) {
|
|
359
503
|
return [];
|
|
@@ -385,7 +529,6 @@ class WorkflowDesignerState {
|
|
|
385
529
|
return false;
|
|
386
530
|
}
|
|
387
531
|
if (this.swimlanes[index].nodes?.length) {
|
|
388
|
-
console.warn('Cannot delete a swimlane that still has stages; move them out first.');
|
|
389
532
|
return false;
|
|
390
533
|
}
|
|
391
534
|
this.swimlanes = this.swimlanes
|
|
@@ -403,19 +546,40 @@ class WorkflowDesignerState {
|
|
|
403
546
|
return true;
|
|
404
547
|
}
|
|
405
548
|
updateSwimlane(index, name, tags) {
|
|
406
|
-
console.log('State: Updating swimlane at index', index, 'with name', name, 'and tags', tags);
|
|
407
549
|
if (index >= 0 && index < this.swimlanes.length) {
|
|
408
550
|
this.swimlanes[index] = {
|
|
409
551
|
...this.swimlanes[index],
|
|
410
552
|
label: name,
|
|
411
553
|
tags: tags,
|
|
412
554
|
};
|
|
413
|
-
console.log('Swimlane updated:', this.swimlanes[index]);
|
|
414
|
-
}
|
|
415
|
-
else {
|
|
416
|
-
console.error('Invalid swimlane index:', index);
|
|
417
555
|
}
|
|
418
556
|
}
|
|
557
|
+
/**
|
|
558
|
+
* Rebuilds the full `Workflow` API model from the current editing state —
|
|
559
|
+
* the save-side counterpart to `parseWorkflowData` in
|
|
560
|
+
* `workflow-designer.component.ts`.
|
|
561
|
+
*
|
|
562
|
+
* Mapping:
|
|
563
|
+
* - swimlanes → `Lanes`
|
|
564
|
+
* - stage **and subflow** nodes → `Stages` (subflows carry `IsSubProcess: true`)
|
|
565
|
+
* - connections → `Actions`
|
|
566
|
+
*
|
|
567
|
+
* Each entity's `DataState` is derived by looking it up in `swimlaneRecord` /
|
|
568
|
+
* `stageRecord` / `actionRecord`: found means `Changed`, absent means `New`.
|
|
569
|
+
* Clearing those maps therefore makes everything save as new.
|
|
570
|
+
*
|
|
571
|
+
* ⚠️ Decision and form nodes are **not** emitted as stages — only `stage` and
|
|
572
|
+
* `subflow` are. Decision semantics survive through the conditions on their
|
|
573
|
+
* connections.
|
|
574
|
+
*
|
|
575
|
+
* ⚠️ When no workflow was loaded, the header is hard-coded (`Name: 'New
|
|
576
|
+
* Workflow'`, empty description, default assignment and status) because the
|
|
577
|
+
* designer has no UI for editing it. See `./docs/06-known-issues.md` section G.
|
|
578
|
+
*
|
|
579
|
+
* This only builds the payload; `WorkflowDataService.saveWorkflows` sends it.
|
|
580
|
+
* Deletions are not part of this — they are issued eagerly at the point of
|
|
581
|
+
* user action. See `./docs/08-api-reference.md` section 3.
|
|
582
|
+
*/
|
|
419
583
|
transformToWorkflowModel() {
|
|
420
584
|
// Use stored workflow if available, otherwise create a new one
|
|
421
585
|
const workflow = this.workflow
|
|
@@ -494,7 +658,6 @@ class WorkflowDesignerState {
|
|
|
494
658
|
this.swimlanes.forEach((swimlane, swimlaneIndex) => {
|
|
495
659
|
swimlane.nodes?.forEach((node) => {
|
|
496
660
|
if (node.type === 'stage' || node.type === 'subflow') {
|
|
497
|
-
console.log(node);
|
|
498
661
|
// Check if this is an existing stage
|
|
499
662
|
if (this.stageRecord[node.id]) {
|
|
500
663
|
// Update existing stage with changed values
|
|
@@ -770,10 +933,34 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
770
933
|
}]
|
|
771
934
|
}] });
|
|
772
935
|
|
|
936
|
+
/**
|
|
937
|
+
* HTTP layer for the workflow designer — a thin wrapper over
|
|
938
|
+
* `HttpWebRequestService` that picks an API base per call from
|
|
939
|
+
* `EnvironmentService.environment`.
|
|
940
|
+
*
|
|
941
|
+
* Bases used:
|
|
942
|
+
* - `WorkFlowAPI` — workflows, stages, actions, swimlanes, escalations, tags
|
|
943
|
+
* - `AuthAPI` — `GetTags` (actor tags) only
|
|
944
|
+
* - `ReportingAPI` — `GetReportSchedules` only
|
|
945
|
+
*
|
|
946
|
+
* Every method routes through {@link withLoader}, so the busy indicator is
|
|
947
|
+
* handled centrally; callers should not toggle it themselves.
|
|
948
|
+
*
|
|
949
|
+
* ## Save is batched, deletes are not
|
|
950
|
+
*
|
|
951
|
+
* `saveWorkflows` persists the whole workflow at the user's explicit save. The
|
|
952
|
+
* `delete*` methods fire immediately when the user confirms, from whichever
|
|
953
|
+
* component owns that UI. A delete is therefore **already committed** and is
|
|
954
|
+
* not undone by navigating away without saving.
|
|
955
|
+
*
|
|
956
|
+
* @see ./docs/08-api-reference.md — the full endpoint table
|
|
957
|
+
* @see ./docs/05-persistence.md — how the models map on load and save
|
|
958
|
+
*/
|
|
773
959
|
class WorkflowDataService {
|
|
774
960
|
httpService;
|
|
775
961
|
envSvc;
|
|
776
962
|
utilService;
|
|
963
|
+
/** In-flight request count backing the shared busy indicator. */
|
|
777
964
|
pendingRequests = 0;
|
|
778
965
|
constructor(httpService, envSvc, utilService) {
|
|
779
966
|
this.httpService = httpService;
|
|
@@ -952,13 +1139,34 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
952
1139
|
}]
|
|
953
1140
|
}], ctorParameters: () => [{ type: i1.HttpWebRequestService }, { type: i1.EnvironmentService }, { type: i1.UtilService }] });
|
|
954
1141
|
|
|
1142
|
+
/**
|
|
1143
|
+
* Node helpers used by `DesignerToolbarComponent` and `StageDialogComponent`.
|
|
1144
|
+
*
|
|
1145
|
+
* ⚠️ **Partially adopted, and it has drifted from `WorkflowDesignerState`.**
|
|
1146
|
+
* Most components use `state` directly; this service duplicates a subset of its
|
|
1147
|
+
* logic. The copies are not identical — see {@link addNode} below and
|
|
1148
|
+
* `./docs/06-known-issues.md` section A.
|
|
1149
|
+
*
|
|
1150
|
+
* Prefer `WorkflowDesignerState` for new work. If you must change behaviour
|
|
1151
|
+
* here, check whether `state` needs the same change.
|
|
1152
|
+
*/
|
|
955
1153
|
class NodeManagementService {
|
|
956
1154
|
state;
|
|
957
1155
|
constructor(state) {
|
|
958
1156
|
this.state = state;
|
|
959
1157
|
}
|
|
960
1158
|
/**
|
|
961
|
-
* Adds a new node to the specified swimlane
|
|
1159
|
+
* Adds a new node to the specified swimlane.
|
|
1160
|
+
*
|
|
1161
|
+
* ⚠️ **This disagrees with `WorkflowDesignerState.addNode` by 40px.** It
|
|
1162
|
+
* subtracts an extra `- 40` "header height" that neither `state.addNode` nor
|
|
1163
|
+
* the render template applies, so a node placed through this method lands
|
|
1164
|
+
* 40px higher than one placed through the canvas.
|
|
1165
|
+
*
|
|
1166
|
+
* `state.addNode` is the correct one. Do not copy the `- 40` outward; the fix
|
|
1167
|
+
* is to remove it here, which is tracked in `./docs/06-known-issues.md`.
|
|
1168
|
+
*
|
|
1169
|
+
* @param y **Absolute** canvas Y — same contract as `state.addNode`.
|
|
962
1170
|
*/
|
|
963
1171
|
addNode(swimlaneIndex, type, x, y, stageData, workflowData) {
|
|
964
1172
|
if (!this.state.swimlanes[swimlaneIndex] ||
|
|
@@ -1249,8 +1457,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
1249
1457
|
}]
|
|
1250
1458
|
}], ctorParameters: () => [{ type: WorkflowDesignerState }] });
|
|
1251
1459
|
|
|
1460
|
+
/**
|
|
1461
|
+
* Swimlane helpers used by `DesignerToolbarComponent` and
|
|
1462
|
+
* `SwimlaneDialogComponent`. Delegates to `WorkflowDesignerState`, which also
|
|
1463
|
+
* implements much of this directly — see `./docs/01-architecture.md` for why
|
|
1464
|
+
* both exist.
|
|
1465
|
+
*/
|
|
1252
1466
|
class SwimlaneService {
|
|
1253
1467
|
state;
|
|
1468
|
+
/**
|
|
1469
|
+
* Swimlane band height in pixels.
|
|
1470
|
+
*
|
|
1471
|
+
* ⚠️ One of **four** separate declarations of this constant
|
|
1472
|
+
* (`WorkflowDesignerState`, `DesignerCanvasComponent`,
|
|
1473
|
+
* `NodeManagementService`, and here), plus bare `263` literals in templates.
|
|
1474
|
+
* They agree today; nothing enforces that. Tracked in
|
|
1475
|
+
* `./docs/06-known-issues.md` section B.
|
|
1476
|
+
*/
|
|
1254
1477
|
swimlaneHeight = 263;
|
|
1255
1478
|
constructor(state) {
|
|
1256
1479
|
this.state = state;
|
|
@@ -1273,7 +1496,6 @@ class SwimlaneService {
|
|
|
1273
1496
|
*/
|
|
1274
1497
|
updateSwimlane(index, name, tags) {
|
|
1275
1498
|
if (index < 0 || index >= this.state.swimlanes.length) {
|
|
1276
|
-
console.error('Invalid swimlane index:', index);
|
|
1277
1499
|
return false;
|
|
1278
1500
|
}
|
|
1279
1501
|
this.state.swimlanes[index] = {
|
|
@@ -1312,7 +1534,6 @@ class SwimlaneService {
|
|
|
1312
1534
|
}
|
|
1313
1535
|
// Check if the swimlane has nodes
|
|
1314
1536
|
if (this.state.swimlanes[index].nodes?.length) {
|
|
1315
|
-
console.error('Cannot delete swimlane with nodes');
|
|
1316
1537
|
return false;
|
|
1317
1538
|
}
|
|
1318
1539
|
// Remove the swimlane
|
|
@@ -1391,14 +1612,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
1391
1612
|
}]
|
|
1392
1613
|
}], ctorParameters: () => [{ type: WorkflowDesignerState }] });
|
|
1393
1614
|
|
|
1615
|
+
/**
|
|
1616
|
+
* The tool palette. Emits the chosen tool upward; the parent decides what a
|
|
1617
|
+
* subsequent canvas click means. Also hosts the save button and the actor-tags
|
|
1618
|
+
* entry point.
|
|
1619
|
+
*
|
|
1620
|
+
* Selection is a toggle — re-selecting the active tool clears it to `null`.
|
|
1621
|
+
*/
|
|
1394
1622
|
class DesignerToolbarComponent {
|
|
1395
1623
|
nodeService;
|
|
1396
1624
|
swimlaneService;
|
|
1625
|
+
/** Currently active tool, owned by the parent. */
|
|
1397
1626
|
selectedTool = null;
|
|
1627
|
+
/** Drives the save button's busy state. */
|
|
1398
1628
|
isSaving = false;
|
|
1629
|
+
/** Workflow being edited; used for actor-tag scoping. */
|
|
1399
1630
|
workflowCode = null;
|
|
1631
|
+
/** Request to open the actor-tags dialog. */
|
|
1400
1632
|
openActorTags = new EventEmitter();
|
|
1633
|
+
/** A palette item was clicked; `null` when the active tool is deselected. */
|
|
1401
1634
|
toolSelected = new EventEmitter();
|
|
1635
|
+
/** The save button was pressed. */
|
|
1402
1636
|
saveWorkflow = new EventEmitter();
|
|
1403
1637
|
// Simple array of toolbar items
|
|
1404
1638
|
toolbarItems = [
|
|
@@ -1468,12 +1702,26 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
1468
1702
|
type: Output
|
|
1469
1703
|
}] } });
|
|
1470
1704
|
|
|
1705
|
+
/**
|
|
1706
|
+
* Renders a single stage or subflow node's chrome inside the canvas SVG —
|
|
1707
|
+
* body, label, and the action icons along its edge.
|
|
1708
|
+
*
|
|
1709
|
+
* Uses an **attribute selector** (`[lib-stage-node]`) because it attaches to an
|
|
1710
|
+
* SVG `<g>` element; it cannot be used as a standalone element.
|
|
1711
|
+
*
|
|
1712
|
+
* Positioning is the canvas template's job, not this component's — it renders
|
|
1713
|
+
* in its parent group's local space and knows nothing about swimlane offsets.
|
|
1714
|
+
*/
|
|
1471
1715
|
class StageNodeComponent {
|
|
1472
1716
|
state;
|
|
1473
1717
|
dataService;
|
|
1718
|
+
/** The node to render. */
|
|
1474
1719
|
node;
|
|
1720
|
+
/** Draws the entry-point indicator. */
|
|
1475
1721
|
isStartNode = false;
|
|
1722
|
+
/** Renders the hexagonal subflow shape instead of the stage rectangle. */
|
|
1476
1723
|
isSubflow = false;
|
|
1724
|
+
/** Backing stage record, for the label and icon states. */
|
|
1477
1725
|
stageData = {};
|
|
1478
1726
|
get displayName() {
|
|
1479
1727
|
if (this.isSubflow) {
|
|
@@ -1506,7 +1754,6 @@ class StageNodeComponent {
|
|
|
1506
1754
|
this.dataService = dataService;
|
|
1507
1755
|
}
|
|
1508
1756
|
ngOnInit() {
|
|
1509
|
-
console.log('Stage node initialized with:', this.node);
|
|
1510
1757
|
this.updateConnectedStagesInfo();
|
|
1511
1758
|
}
|
|
1512
1759
|
// Method to check if this stage has multiple outgoing connections to other stages
|
|
@@ -1579,8 +1826,6 @@ class StageNodeComponent {
|
|
|
1579
1826
|
event.preventDefault();
|
|
1580
1827
|
event.stopPropagation();
|
|
1581
1828
|
}
|
|
1582
|
-
console.log('Shield icon clicked for node:', this.node.id);
|
|
1583
|
-
console.log(this.stageData, this.node);
|
|
1584
1829
|
this.showShieldDialog.emit(this.node.id);
|
|
1585
1830
|
}
|
|
1586
1831
|
toggleTimerPopup(event) {
|
|
@@ -1639,7 +1884,6 @@ class StageNodeComponent {
|
|
|
1639
1884
|
});
|
|
1640
1885
|
return sw;
|
|
1641
1886
|
});
|
|
1642
|
-
console.log(`Parallel execution ${newParallelState ? 'enabled' : 'disabled'} for node:`, this.node.id);
|
|
1643
1887
|
}
|
|
1644
1888
|
// This method should be called whenever connections change
|
|
1645
1889
|
refreshState() {
|
|
@@ -1651,7 +1895,6 @@ class StageNodeComponent {
|
|
|
1651
1895
|
nodeId: this.node.id,
|
|
1652
1896
|
stageData: stageData,
|
|
1653
1897
|
});
|
|
1654
|
-
console.log('Stage properties updated:', stageData);
|
|
1655
1898
|
}
|
|
1656
1899
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: StageNodeComponent, deps: [{ token: WorkflowDesignerState }, { token: WorkflowDataService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1657
1900
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: StageNodeComponent, selector: "svg:g[lib-stage-node]", inputs: { node: "node", isStartNode: "isStartNode", isSubflow: "isSubflow", stageData: "stageData" }, outputs: { stagePropertiesUpdated: "stagePropertiesUpdated", parallelExecutionToggled: "parallelExecutionToggled", showShieldDialog: "showShieldDialog", showEscalationDialog: "showEscalationDialog", showFormDialog: "showFormDialog" }, ngImport: i0, template: "<svg:g>\n <!-- Shape: Rectangle for stage, Hexagon for subflow -->\n @if (isSubflow) {\n <svg:path [attr.d]=\"\n 'M 1 ' +\n node.height / 4 +\n ' L ' +\n node.width / 2 +\n ' 1 L ' +\n (node.width - 1) +\n ' ' +\n node.height / 4 +\n ' V ' +\n (node.height * 3) / 4 +\n ' L ' +\n node.width / 2 +\n ' ' +\n (node.height - 1) +\n ' L 1 ' +\n (node.height * 3) / 4 +\n ' Z'\n \" fill=\"transparent\" stroke=\"#D36CFF\" stroke-width=\"1\"></svg:path>\n } @else {\n <svg:rect x=\"0\" y=\"0\" [attr.width]=\"node.width\" [attr.height]=\"node.height\" fill=\"transparent\" stroke=\"#D36CFF\"\n stroke-width=\"1\"></svg:rect>\n }\n\n <!-- Top-left icon: Stage form -->\n <svg:g (click)=\"toggleFormPopup($event)\" class=\"stage-icon\" transform=\"translate(6, 6)\">\n <!-- Transparent rectangle to capture clicks -->\n <svg:rect x=\"-2\" y=\"-2\" width=\"24\" height=\"24\" fill=\"transparent\" style=\"cursor: pointer\" />\n\n <svg:path\n d=\"M16.5 20.475V17.475H13.5V16.475H16.5V13.475H17.5V16.475H20.5V17.475H17.5V20.475H16.5ZM3.5 17.5V16.5H4.5V17.5H3.5ZM6.5 17.5V16.5H11.517C11.5057 16.6767 11.5043 16.845 11.513 17.005C11.521 17.165 11.531 17.33 11.543 17.5H6.5ZM3.5 13.5V12.5H4.5V13.5H3.5ZM6.5 13.5V12.5H13.804C13.6127 12.6387 13.4333 12.7913 13.266 12.958C13.0993 13.1247 12.9377 13.3053 12.781 13.5H6.5ZM3.5 9.5V8.5H4.5V9.5H3.5ZM6.5 9.5V8.5H18.5V9.5H6.5ZM3.5 5.5V4.5H4.5V5.5H3.5ZM6.5 5.5V4.5H18.5V5.5H6.5Z\"\n [attr.fill]=\"node.stageData?.formId ? '#D36CFF' : 'black'\" />\n </svg:g>\n\n <!-- Top-right icon: Shield -->\n <svg:g (click)=\"toggleShieldPopup($event)\" class=\"stage-icon\"\n [attr.transform]=\"'translate(' + (node.width - 30) + ', 6)'\">\n <!-- Transparent rectangle to capture clicks -->\n <svg:rect x=\"-2\" y=\"-2\" width=\"24\" height=\"24\" fill=\"transparent\" style=\"cursor: pointer\" />\n\n <svg:path d=\"M7.5 12H16.5V13.5H7.5V12ZM7.5 7.5H16.5V9H7.5V7.5Z\" fill=\"black\" />\n <svg:path\n d=\"M12 22.5L7.36801 20.0303C6.0474 19.3279 4.94303 18.2791 4.17348 16.9964C3.40393 15.7138 2.99825 14.2458 3.00001 12.75V3C3.00001 2.60218 3.15804 2.22064 3.43935 1.93934C3.72065 1.65804 4.10218 1.5 4.50001 1.5H19.5C19.8978 1.5 20.2794 1.65804 20.5607 1.93934C20.842 2.22064 21 2.60218 21 3V12.75C21.0018 14.2458 20.5961 15.7138 19.8265 16.9964C19.057 18.2791 17.9526 19.3279 16.632 20.0303L12 22.5ZM4.50001 3V12.75C4.49917 13.9738 4.83141 15.1747 5.46111 16.224C6.09082 17.2733 6.99423 18.1315 8.07451 18.7065L12 20.7997L15.9255 18.7073C17.0059 18.1322 17.9094 17.2739 18.5391 16.2244C19.1688 15.175 19.501 13.9739 19.5 12.75V3H4.50001Z\"\n fill=\"black\" />\n </svg:g>\n\n @if (node.stageData?.Code) {\n <!-- Left-center icon: Thunderbolt -->\n <svg:g (click)=\"toggleActionPopup('left', $event)\" class=\"stage-icon\" transform=\"translate(6, 38)\">\n <svg:path d=\"M11 15H6L13 1V9H18L11 23V15Z\" fill=\"black\" />\n </svg:g>\n\n <!-- Right-center icon: Thunderbolt -->\n <svg:g (click)=\"toggleActionPopup('right', $event)\" class=\"stage-icon\"\n [attr.transform]=\"'translate(' + (node.width - 30) + ', 38)'\">\n <svg:path d=\"M11 15H6L13 1V9H18L11 23V15Z\" fill=\"black\" />\n </svg:g>\n }\n\n <!-- Bottom-left icon: Double slash text -->\n <svg:g *ngIf=\"hasMultipleConnectedStages\" (click)=\"toggleCodePopup($event)\" class=\"stage-icon\"\n [attr.transform]=\"'translate(6, ' + (node.height - 16) + ')'\">\n <svg:text font-family=\"'Plus Jakarta Sans', sans-serif\" font-weight=\"500\" font-size=\"16px\"\n dominant-baseline=\"middle\" [attr.fill]=\"isParallelExecution ? '#D36CFF' : 'black'\">\n //\n </svg:text>\n </svg:g>\n\n <!-- Bottom-right icon: Timer -->\n <svg:g (click)=\"toggleTimerPopup($event)\" class=\"stage-icon\" [attr.transform]=\"\n 'translate(' + (node.width - 30) + ', ' + (node.height - 30) + ')'\n \">\n <svg:path\n d=\"M11.5 3C14.0196 3 16.4359 4.00089 18.2175 5.78249C19.9991 7.56408 21 9.98044 21 12.5C21 15.0196 19.9991 17.4359 18.2175 19.2175C16.4359 20.9991 14.0196 22 11.5 22C8.98044 22 6.56408 20.9991 4.78249 19.2175C3.00089 17.4359 2 15.0196 2 12.5C2 9.98044 3.00089 7.56408 4.78249 5.78249C6.56408 4.00089 8.98044 3 11.5 3ZM11.5 4C9.24566 4 7.08365 4.89553 5.48959 6.48959C3.89553 8.08365 3 10.2457 3 12.5C3 14.7543 3.89553 16.9163 5.48959 18.5104C7.08365 20.1045 9.24566 21 11.5 21C12.6162 21 13.7215 20.7801 14.7528 20.353C15.7841 19.9258 16.7211 19.2997 17.5104 18.5104C18.2997 17.7211 18.9258 16.7841 19.353 15.7528C19.7801 14.7215 20 13.6162 20 12.5C20 10.2457 19.1045 8.08365 17.5104 6.48959C15.9163 4.89553 13.7543 4 11.5 4ZM11 7H12V12.42L16.7 15.13L16.2 16L11 13V7Z\"\n fill=\"black\" />\n </svg:g>\n\n <!-- Label in the center -->\n <svg:text [attr.x]=\"node.width / 2\" [attr.y]=\"node.height / 2\" text-anchor=\"middle\" dominant-baseline=\"middle\"\n [attr.font-size]=\"isSubflow ? '10' : '14'\" fill=\"var(--vbn-color-text)\">\n {{ truncatedDisplayName }}\n </svg:text>\n</svg:g>\n\n<!-- <lib-stage-dialog\n [visible]=\"showShieldPopup()\"\n [stageData]=\"node.stageData || {}\"\n (closed)=\"showShieldPopup.set(false)\"\n (saved)=\"onStagePropertiesSaved($event)\"\n></lib-stage-dialog> -->\n", styles: [":host{pointer-events:none}.stage-icon{cursor:pointer;pointer-events:all}.stage-icon:hover path{fill:#d36cff}\n"], dependencies: [{ kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
@@ -1680,7 +1923,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
1680
1923
|
}] } });
|
|
1681
1924
|
|
|
1682
1925
|
/**
|
|
1683
|
-
*
|
|
1926
|
+
* RxJS-based popup state manager for the workflow designer.
|
|
1927
|
+
*
|
|
1928
|
+
* ⚠️ **Barely adopted.** Only `StageDialogComponent` consumes this; the canvas
|
|
1929
|
+
* re-implements popup visibility with local booleans. Two mechanisms coexist,
|
|
1930
|
+
* so a popup change made here may not affect the popup you are looking at —
|
|
1931
|
+
* check whether the component in question actually injects this service.
|
|
1932
|
+
*
|
|
1933
|
+
* Consolidating onto one mechanism is tracked in
|
|
1934
|
+
* `./docs/06-known-issues.md` section C.
|
|
1684
1935
|
*/
|
|
1685
1936
|
class PopupService {
|
|
1686
1937
|
dataService;
|
|
@@ -1810,7 +2061,6 @@ class PopupService {
|
|
|
1810
2061
|
this._formsList.next(response.Result);
|
|
1811
2062
|
}
|
|
1812
2063
|
catch (error) {
|
|
1813
|
-
console.error('Error loading forms:', error);
|
|
1814
2064
|
this._formsList.next([]);
|
|
1815
2065
|
}
|
|
1816
2066
|
finally {
|
|
@@ -1837,7 +2087,6 @@ class PopupService {
|
|
|
1837
2087
|
this._formsList.next(response.Result);
|
|
1838
2088
|
}
|
|
1839
2089
|
catch (error) {
|
|
1840
|
-
console.error('Error loading forms:', error);
|
|
1841
2090
|
this._formsList.next([]);
|
|
1842
2091
|
}
|
|
1843
2092
|
finally {
|
|
@@ -1864,7 +2113,6 @@ class PopupService {
|
|
|
1864
2113
|
this._workflowsList.next(response.Result);
|
|
1865
2114
|
}
|
|
1866
2115
|
catch (error) {
|
|
1867
|
-
console.error('Error loading workflows:', error);
|
|
1868
2116
|
this._workflowsList.next([]);
|
|
1869
2117
|
}
|
|
1870
2118
|
finally {
|
|
@@ -1910,15 +2158,28 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
1910
2158
|
}]
|
|
1911
2159
|
}], ctorParameters: () => [{ type: WorkflowDataService }] });
|
|
1912
2160
|
|
|
2161
|
+
/**
|
|
2162
|
+
* Editor for a stage's properties — name, description, duration, actor rules,
|
|
2163
|
+
* tags, entry/exit flags, and the attached form.
|
|
2164
|
+
*
|
|
2165
|
+
* Serves both creation and editing; the caller distinguishes them by what it
|
|
2166
|
+
* passes as `stageData`. Deleting a stage from here issues
|
|
2167
|
+
* `deleteWorkflowStages` **immediately**, not at next save.
|
|
2168
|
+
*
|
|
2169
|
+
* Note: uses signal inputs (`this.visible()`, `this.stageData()`), not
|
|
2170
|
+
* decorator inputs. It is also the only consumer of `PopupService`.
|
|
2171
|
+
*/
|
|
1913
2172
|
class StageDialogComponent {
|
|
1914
2173
|
fb;
|
|
1915
2174
|
dataService;
|
|
1916
2175
|
nodeService;
|
|
1917
2176
|
popupService;
|
|
1918
|
-
|
|
2177
|
+
/** Signal input — read as `this.visible()`. */
|
|
1919
2178
|
visible = input(false);
|
|
1920
|
-
|
|
2179
|
+
/** Stage being edited; empty object when creating. Read as `this.stageData()`. */
|
|
2180
|
+
stageData = input.required({});
|
|
1921
2181
|
closed = new EventEmitter();
|
|
2182
|
+
/** Emits the edited stage properties for the parent to apply. */
|
|
1922
2183
|
saved = new EventEmitter();
|
|
1923
2184
|
stageForm;
|
|
1924
2185
|
tags = [];
|
|
@@ -1981,7 +2242,6 @@ class StageDialogComponent {
|
|
|
1981
2242
|
*/
|
|
1982
2243
|
initFormWithStageData() {
|
|
1983
2244
|
if (this.stageData()) {
|
|
1984
|
-
console.log('Initializing form with stage data:', this.stageData());
|
|
1985
2245
|
this.stageForm.patchValue({
|
|
1986
2246
|
Name: this.stageData().Name || '',
|
|
1987
2247
|
Description: this.stageData().Description || '',
|
|
@@ -2025,30 +2285,23 @@ class StageDialogComponent {
|
|
|
2025
2285
|
}
|
|
2026
2286
|
}
|
|
2027
2287
|
onDialogOpen(event) {
|
|
2028
|
-
console.log('Dialog opened:', event);
|
|
2029
2288
|
}
|
|
2030
2289
|
deleteStage() {
|
|
2031
2290
|
const stageData = this.stageData();
|
|
2032
|
-
console.log(stageData);
|
|
2033
2291
|
if (stageData) {
|
|
2034
2292
|
const stageCode = stageData.Code;
|
|
2035
2293
|
if (stageCode) {
|
|
2036
2294
|
this.dataService
|
|
2037
2295
|
.deleteWorkflowStages([stageCode])
|
|
2038
2296
|
.then((response) => {
|
|
2039
|
-
console.log('Stage deleted successfully:', response);
|
|
2040
2297
|
// Call the node service to delete the stage
|
|
2041
2298
|
const deleted = this.nodeService.deleteNode(stageCode);
|
|
2042
2299
|
if (deleted) {
|
|
2043
2300
|
// Emit an event to notify parent component
|
|
2044
2301
|
this.closed.emit();
|
|
2045
2302
|
}
|
|
2046
|
-
else {
|
|
2047
|
-
console.error('Failed to delete stage:', stageCode);
|
|
2048
|
-
}
|
|
2049
2303
|
})
|
|
2050
2304
|
.catch((error) => {
|
|
2051
|
-
console.error('Error deleting stage:', error);
|
|
2052
2305
|
});
|
|
2053
2306
|
}
|
|
2054
2307
|
else if (stageData.id) {
|
|
@@ -2058,9 +2311,6 @@ class StageDialogComponent {
|
|
|
2058
2311
|
// Emit an event to notify parent component
|
|
2059
2312
|
this.closed.emit();
|
|
2060
2313
|
}
|
|
2061
|
-
else {
|
|
2062
|
-
console.error('Failed to delete stage:', stageData.Code);
|
|
2063
|
-
}
|
|
2064
2314
|
}
|
|
2065
2315
|
}
|
|
2066
2316
|
}
|
|
@@ -2076,12 +2326,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
2076
2326
|
type: Output
|
|
2077
2327
|
}] } });
|
|
2078
2328
|
|
|
2329
|
+
/**
|
|
2330
|
+
* Prompts for the branch condition on an edge leaving a decision node, when
|
|
2331
|
+
* that edge is first created.
|
|
2332
|
+
*
|
|
2333
|
+
* Rendered as HTML overlaid on the SVG, so `popupX` / `popupY` are **viewport**
|
|
2334
|
+
* coordinates from `getViewportPosition` — not canvas coordinates.
|
|
2335
|
+
*/
|
|
2079
2336
|
class ConditionsPopupComponent {
|
|
2080
2337
|
state;
|
|
2081
2338
|
visible = false;
|
|
2339
|
+
/** Decision node the branch leaves from. */
|
|
2082
2340
|
decisionNodeId = '';
|
|
2341
|
+
/** Connection awaiting a condition. */
|
|
2083
2342
|
newConnectionId = '';
|
|
2343
|
+
/** Viewport X — not canvas X. */
|
|
2084
2344
|
popupX = 0;
|
|
2345
|
+
/** Viewport Y — not canvas Y. */
|
|
2085
2346
|
popupY = 0;
|
|
2086
2347
|
closed = new EventEmitter();
|
|
2087
2348
|
saved = new EventEmitter();
|
|
@@ -2146,15 +2407,30 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
2146
2407
|
type: Output
|
|
2147
2408
|
}] } });
|
|
2148
2409
|
|
|
2410
|
+
/**
|
|
2411
|
+
* Configures escalation rules for a single stage — what happens when the stage
|
|
2412
|
+
* overruns its duration.
|
|
2413
|
+
*
|
|
2414
|
+
* Escalations are persisted through their **own** endpoints
|
|
2415
|
+
* (`SaveEscalations` / `DeleteEscalation`), independently of the workflow save.
|
|
2416
|
+
* Changes here take effect without the user pressing Save.
|
|
2417
|
+
*
|
|
2418
|
+
* ⚠️ **Mixed input styles.** `visible` is a decorator input; the rest are
|
|
2419
|
+
* signal inputs (`this.workflowCode()`, `this.stageCode()`, `this.type()`).
|
|
2420
|
+
*/
|
|
2149
2421
|
class EscalationDialogComponent {
|
|
2150
2422
|
fb;
|
|
2151
2423
|
dataService;
|
|
2152
2424
|
utilService;
|
|
2153
2425
|
visible = false;
|
|
2426
|
+
/** Owning workflow. Signal input. */
|
|
2154
2427
|
workflowCode = input.required();
|
|
2428
|
+
/** Stage the escalation attaches to. Signal input. */
|
|
2155
2429
|
stageCode = input.required();
|
|
2430
|
+
/** Which escalation kind is being configured. Signal input. */
|
|
2156
2431
|
type = input();
|
|
2157
2432
|
closed = new EventEmitter();
|
|
2433
|
+
/** Emitted after an escalation is successfully saved. */
|
|
2158
2434
|
created = new EventEmitter();
|
|
2159
2435
|
escalation = signal(null);
|
|
2160
2436
|
// escalationForm;
|
|
@@ -2203,7 +2479,6 @@ class EscalationDialogComponent {
|
|
|
2203
2479
|
const stageCode = this.stageCode();
|
|
2204
2480
|
const workflowCode = this.workflowCode();
|
|
2205
2481
|
const type = this.type();
|
|
2206
|
-
console.log('Stage code changed:', stageCode);
|
|
2207
2482
|
if (workflowCode && stageCode && type) {
|
|
2208
2483
|
// this.loadEscalation(stageCode);
|
|
2209
2484
|
this.searchEscalation(workflowCode, stageCode, type);
|
|
@@ -2231,7 +2506,6 @@ class EscalationDialogComponent {
|
|
|
2231
2506
|
if (this.selectedMessages.length === 0) {
|
|
2232
2507
|
this.addMessage();
|
|
2233
2508
|
}
|
|
2234
|
-
console.log('EscalationDialogComponent initialized with stageCode:', this.stageCode);
|
|
2235
2509
|
// console.log('EscalationDialogComponent type:', this.type);
|
|
2236
2510
|
}
|
|
2237
2511
|
// get messages() {
|
|
@@ -2244,7 +2518,6 @@ class EscalationDialogComponent {
|
|
|
2244
2518
|
this.selectedMessages = this.selectedMessages.splice(lessonIndex, 1);
|
|
2245
2519
|
}
|
|
2246
2520
|
onMessageSelected(reportSchedule, index) {
|
|
2247
|
-
console.log('Selected message:', reportSchedule, 'at index:', index);
|
|
2248
2521
|
this.selectedMessages = this.selectedMessages.map((msg, i) => {
|
|
2249
2522
|
if (i === index) {
|
|
2250
2523
|
return { ...reportSchedule, IsTaskDataSource: false, IsMessageId: true };
|
|
@@ -2256,7 +2529,6 @@ class EscalationDialogComponent {
|
|
|
2256
2529
|
return this.selectedMessages.every((msg) => !!msg);
|
|
2257
2530
|
}
|
|
2258
2531
|
async saveMessages() {
|
|
2259
|
-
console.log(this.selectedMessages);
|
|
2260
2532
|
const taskNotifications = this.selectedMessages
|
|
2261
2533
|
.filter((msg) => !!msg)
|
|
2262
2534
|
.map((msg) => ({
|
|
@@ -2280,7 +2552,6 @@ class EscalationDialogComponent {
|
|
|
2280
2552
|
}));
|
|
2281
2553
|
// if (taskNotifications.length) {
|
|
2282
2554
|
// this.created.emit(taskNotifications);
|
|
2283
|
-
console.log(taskNotifications);
|
|
2284
2555
|
this.onDialogClose(null);
|
|
2285
2556
|
const data = {
|
|
2286
2557
|
...(this.escalation() ?? {
|
|
@@ -2300,9 +2571,7 @@ class EscalationDialogComponent {
|
|
|
2300
2571
|
Messages: taskNotifications.map(({ Code }) => Code),
|
|
2301
2572
|
FullMessages: taskNotifications,
|
|
2302
2573
|
};
|
|
2303
|
-
console.log("Saving escalation data:", data);
|
|
2304
2574
|
this.dataService.saveEscalations([data]).then((data) => {
|
|
2305
|
-
console.log("Escalation saved:", data);
|
|
2306
2575
|
this.escalation.set(data?.[0] ?? null);
|
|
2307
2576
|
this.utilService.showSuccess('Escalation saved successfully');
|
|
2308
2577
|
this.onDialogClose(null);
|
|
@@ -2313,7 +2582,6 @@ class EscalationDialogComponent {
|
|
|
2313
2582
|
const escalation = this.escalation();
|
|
2314
2583
|
if (escalation) {
|
|
2315
2584
|
this.dataService.deleteEscalations([escalation.Code]).then((data) => {
|
|
2316
|
-
console.log("Escalation deleted:", data);
|
|
2317
2585
|
this.escalation.set(null);
|
|
2318
2586
|
this.onDialogClose(null);
|
|
2319
2587
|
});
|
|
@@ -2333,7 +2601,6 @@ class EscalationDialogComponent {
|
|
|
2333
2601
|
})
|
|
2334
2602
|
.then((data) => {
|
|
2335
2603
|
this.escalation.set(data.Result[0] ?? null);
|
|
2336
|
-
console.log("Escalation loaded:", this.escalation());
|
|
2337
2604
|
// this.selectedOperationAction.next(data.Result[0]?.OperationAction ?? null);
|
|
2338
2605
|
});
|
|
2339
2606
|
}
|
|
@@ -2348,13 +2615,11 @@ class EscalationDialogComponent {
|
|
|
2348
2615
|
// });
|
|
2349
2616
|
// }
|
|
2350
2617
|
onDialogClose(eventData) {
|
|
2351
|
-
console.log('Dialog closed, received data:', eventData);
|
|
2352
2618
|
this.escalation.set(null);
|
|
2353
2619
|
this.selectedMessages = [];
|
|
2354
2620
|
this.closed.emit();
|
|
2355
2621
|
}
|
|
2356
2622
|
onDialogOpen(eventData) {
|
|
2357
|
-
console.log('Dialog opened, received data:', eventData);
|
|
2358
2623
|
}
|
|
2359
2624
|
isNotNew() {
|
|
2360
2625
|
const escalation = this.escalation();
|
|
@@ -2374,15 +2639,28 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
2374
2639
|
type: Output
|
|
2375
2640
|
}] } });
|
|
2376
2641
|
|
|
2642
|
+
/**
|
|
2643
|
+
* Editor for a connection (workflow action) — its label, the operation it
|
|
2644
|
+
* triggers, and the flowable status applied when it is traversed.
|
|
2645
|
+
*
|
|
2646
|
+
* Deleting from here issues `deleteWorkflowActions` **immediately**, not at
|
|
2647
|
+
* next save.
|
|
2648
|
+
*
|
|
2649
|
+
* Note: uses signal inputs (`this.visible()`, `this.actionData()`).
|
|
2650
|
+
*/
|
|
2377
2651
|
class ActionDialogComponent {
|
|
2378
2652
|
fb;
|
|
2379
2653
|
dataService;
|
|
2380
2654
|
state;
|
|
2655
|
+
/** Signal input — read as `this.visible()`. */
|
|
2381
2656
|
visible = input(false);
|
|
2382
|
-
|
|
2657
|
+
/** Connection being edited. Read as `this.actionData()`. */
|
|
2658
|
+
actionData = input.required();
|
|
2383
2659
|
closed = new EventEmitter();
|
|
2660
|
+
/** Emits the edited connection for the parent to apply. */
|
|
2384
2661
|
saved = new EventEmitter();
|
|
2385
|
-
|
|
2662
|
+
/** Emits the deleted connection's id. */
|
|
2663
|
+
deleted = new EventEmitter();
|
|
2386
2664
|
actionForm;
|
|
2387
2665
|
operationActions = signal([]);
|
|
2388
2666
|
flowableStatuses = signal([]);
|
|
@@ -2399,7 +2677,6 @@ class ActionDialogComponent {
|
|
|
2399
2677
|
// If actionData changes, update the form
|
|
2400
2678
|
const actionData = this.actionData();
|
|
2401
2679
|
if (actionData) {
|
|
2402
|
-
console.log("ACTION_DATA", actionData);
|
|
2403
2680
|
this.actionForm.patchValue({
|
|
2404
2681
|
Name: actionData.label || '',
|
|
2405
2682
|
OperationAction: actionData.action || null,
|
|
@@ -2419,8 +2696,6 @@ class ActionDialogComponent {
|
|
|
2419
2696
|
this.actionForm.reset();
|
|
2420
2697
|
// Emit the saved data to the parent component
|
|
2421
2698
|
const prevData = this.actionData();
|
|
2422
|
-
console.log("PREV_DATA", prevData);
|
|
2423
|
-
console.log("FORM_DATA", formData);
|
|
2424
2699
|
if (prevData) {
|
|
2425
2700
|
this.saved.emit({
|
|
2426
2701
|
...prevData,
|
|
@@ -2441,12 +2716,10 @@ class ActionDialogComponent {
|
|
|
2441
2716
|
// Path A: backend-persisted action — call API first
|
|
2442
2717
|
this.dataService.deleteWorkflowActions([backendRecord.Code])
|
|
2443
2718
|
.then(() => {
|
|
2444
|
-
console.log('Action deleted from backend:', backendRecord.Code);
|
|
2445
2719
|
this.deleted.emit(connectionId);
|
|
2446
2720
|
this.closed.emit();
|
|
2447
2721
|
})
|
|
2448
2722
|
.catch((error) => {
|
|
2449
|
-
console.error('Error deleting action:', error);
|
|
2450
2723
|
});
|
|
2451
2724
|
}
|
|
2452
2725
|
else {
|
|
@@ -2466,11 +2739,9 @@ class ActionDialogComponent {
|
|
|
2466
2739
|
});
|
|
2467
2740
|
}
|
|
2468
2741
|
onDialogClose(eventData) {
|
|
2469
|
-
console.log('Dialog closed, received data:', eventData);
|
|
2470
2742
|
this.closed.emit();
|
|
2471
2743
|
}
|
|
2472
2744
|
onDialogOpen(eventData) {
|
|
2473
|
-
console.log('Dialog opened, received data:', eventData);
|
|
2474
2745
|
}
|
|
2475
2746
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ActionDialogComponent, deps: [{ token: i1$1.FormBuilder }, { token: WorkflowDataService }, { token: WorkflowDesignerState }], target: i0.ɵɵFactoryTarget.Component });
|
|
2476
2747
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.14", type: ActionDialogComponent, selector: "lib-action-dialog", inputs: { visible: { classPropertyName: "visible", publicName: "visible", isSignal: true, isRequired: false, transformFunction: null }, actionData: { classPropertyName: "actionData", publicName: "actionData", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { closed: "closed", saved: "saved", deleted: "deleted" }, ngImport: i0, template: "<verben-dialogue [showCloseIcon]=\"true\" [dismissOutsideClick]=\"true\" [closeOnEscape]=\"true\" [size]=\"'medium'\"\n [mode]=\"'drawer'\" [disableFooter]=\"false\" [isVisible]=\"visible()\" [headerTemplate]=\"headerTemplate\"\n [bodyTemplate]=\"bodyTemplate\" [footerTemplate]=\"footerTemplate\" (openModal)=\"onDialogOpen($event)\"\n (closeModal)=\"onDialogClose($event)\">\n</verben-dialogue>\n\n<ng-template #headerTemplate>\n <div class=\"flex items-center justify-between p-3 text-xs border-b-4 border-[var(--vbn-color-primary)]\">\n <button class=\"mr-4\" type=\"button\" (click)=\"onDialogClose($event)\">\n <span class=\"block w-2.5 h-2.5 border-t border-l border-[var(--vbn-color-text)]/70 transform -rotate-45\"></span>\n </button>\n </div>\n</ng-template>\n\n<ng-template #bodyTemplate>\n <form [formGroup]=\"actionForm\" class=\"mb-4 space-y-4\">\n <verbena-input name=\"Name\" label=\"Name\" formControlName=\"Name\" placeHolder=\"Enter Name\" />\n\n <div class=\"space-y-1\">\n <label for=\"operation-action\" class=\"text-sm font-semibold text-[var(--vbn-color-text)]\">\n Operation Action\n </label>\n <verben-drop-down id=\"operation-action\" styleClass=\"w-full\" width=\"100%\" [multiselect]=\"false\" filterBy=\"Name\"\n placeholder=\"Select Operation Action\" [options]=\"operationActions()\" optionLabel=\"Name\" optionValue=\"Code\"\n formControlName=\"OperationAction\" class=\"form-control\" [showClear]=\"true\" [filter]=\"true\"></verben-drop-down>\n </div>\n\n <div class=\"space-y-1\">\n <label for=\"target-status\" class=\"text-sm font-semibold text-[var(--vbn-color-text)]\">\n Target Status\n </label>\n <verben-drop-down id=\"target-status\" styleClass=\"w-full\" width=\"100%\" [multiselect]=\"false\" filterBy=\"Description\"\n placeholder=\"Select Target Status\" [options]=\"flowableStatuses()\" optionLabel=\"Description\" optionValue=\"Name\"\n formControlName=\"TargetStatus\" class=\"form-control\" [showClear]=\"true\" [filter]=\"true\"></verben-drop-down>\n </div>\n </form>\n</ng-template>\n\n<ng-template #footerTemplate>\n <div class=\"flex gap-2 items-center justify-end\">\n <verbena-button (click)=\"onDialogClose($event)\" text=\"Cancel\" styleType=\"ylw-outline\"\n class=\"ml-auto\"></verbena-button>\n <verbena-button type=\"submit\" text=\"Save\" bgColor=\"var(--vbn-color-primary)\" textColor=\"var(--vbn-color-on-primary)\" borderRadius=\"10px\" pd=\"10px 20px\"\n width=\"114px\" height=\"39px\" (click)=\"saveAction()\" [disable]=\"actionForm.invalid\"></verbena-button>\n <verbena-button\n width=\"114px\"\n height=\"39px\"\n text=\"Delete\"\n bgColor=\"var(--vbn-color-text-muted)\"\n textColor=\"var(--vbn-color-on-primary)\"\n borderRadius=\"10px\"\n (click)=\"deleteAction()\"\n ></verbena-button>\n </div>\n</ng-template>\n\n", styles: ["::ng-deep .modal-footer{display:flex;justify-content:space-between!important}::ng-deep button,button{cursor:pointer}\n"], dependencies: [{ kind: "component", type: i5.VerbenDialogueComponent, selector: "verben-dialogue", inputs: ["dialogueWidth", "headerTemplate", "bodyTemplate", "footerTemplate", "showCloseIcon", "dismissOutsideClick", "closeOnEscape", "isVisible", "size", "backdropColor", "customClass", "disableFooter", "margin", "padding", "borderRadius", "dialogueBgColor", "width", "closeIconClass", "boxShadow", "enableTransition", "modalData", "mode", "position", "drawerWidth"], outputs: ["openModal", "closeModal"] }, { kind: "directive", type: i1$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: i5.VerbenaButtonComponent, selector: "verbena-button", inputs: ["type", "text", "icon", "useIcon", "svgPosition", "iconPosition", "bgColor", "textColor", "border", "borderRadius", "pd", "width", "height", "fontSize", "fontWeight", "disable", "svgSize", "weight", "variant", "styleType", "svg", "svgWidth", "svgHeight", "iconColor", "svgColor", "buttonClass", "buttonTextClass", "isLoading", "spinnerSize", "spinnerColor"] }, { kind: "component", type: i5.DropDownComponent, selector: "verben-drop-down", inputs: ["options", "width", "overlayWidth", "showHorizontalLine", "horizontalLineColor", "optionLabel", "optionSubLabel", "optionValue", "placeholder", "invalidMessage", "errorPosition", "loadMoreCaption", "display", "showClear", "lazyLoad", "selectKey", "styleClass", "group", "multiselect", "filter", "avoidDuplication", "filterBy", "debounceTime", "minChar", "refPageSize", "disabled", "required", "load", "asyncLabel", "search"], outputs: ["optionsChange", "onChange", "onClick", "onClear"] }, { kind: "component", type: i5.VerbenaInputComponent, selector: "verbena-input", inputs: ["disabled", "label", "placeHolder", "required", "svgPosition", "minLength", "maxLength", "type", "bgColor", "border", "borderRadius", "textColor", "value", "labelPosition", "labelColor", "disable", "readOnly", "min", "max", "showBorder", "showErrorMessage", "errorMessageColor", "errorBorderColor", "errorPosition", "svg", "fontSize", "svgWidth", "svgHeight", "svgColor", "capitalization", "inputContainerClass", "inputFieldClass", "passLength", "inputWrapperClass", "passwordToggle", "customErrorMessages", "icon", "textPass"], outputs: ["valueChange"] }] });
|
|
@@ -2486,16 +2757,55 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
2486
2757
|
type: Output
|
|
2487
2758
|
}] } });
|
|
2488
2759
|
|
|
2760
|
+
/**
|
|
2761
|
+
* The SVG editing surface. Renders the entire scene — swimlanes, nodes,
|
|
2762
|
+
* connections, and overlaid popups — from {@link WorkflowDesignerState}, and
|
|
2763
|
+
* owns nearly all pointer interaction: placing nodes, dragging them within and
|
|
2764
|
+
* between lanes, and the connection drag/drop pipeline.
|
|
2765
|
+
*
|
|
2766
|
+
* This is the largest file in the module. It reads and mutates the shared
|
|
2767
|
+
* `state` singleton directly rather than holding its own model.
|
|
2768
|
+
*
|
|
2769
|
+
* ## Coordinate spaces used here
|
|
2770
|
+
*
|
|
2771
|
+
* - {@link getMousePosition} returns **absolute canvas** coordinates — the space
|
|
2772
|
+
* `state.addNode` and `Math.floor(y / 263)` expect.
|
|
2773
|
+
* - {@link getViewportPosition} additionally subtracts scroll offsets and is
|
|
2774
|
+
* used **only** to position HTML popups over the SVG. Never feed its output
|
|
2775
|
+
* into node or connection math.
|
|
2776
|
+
*
|
|
2777
|
+
* Read `../docs/02-coordinate-system.md` before changing anything positional.
|
|
2778
|
+
*
|
|
2779
|
+
* ## Popups
|
|
2780
|
+
*
|
|
2781
|
+
* Popup visibility is tracked with local booleans here, even though a
|
|
2782
|
+
* `PopupService` exists. Only `StageDialogComponent` uses that service; the two
|
|
2783
|
+
* mechanisms coexist. See `../docs/06-known-issues.md` section C.
|
|
2784
|
+
*
|
|
2785
|
+
* @see ../docs/04-interactions.md — the user-facing flows this component implements
|
|
2786
|
+
*/
|
|
2489
2787
|
class DesignerCanvasComponent {
|
|
2490
2788
|
state;
|
|
2491
2789
|
dataService;
|
|
2790
|
+
/** Active toolbar tool; `null` means pointer mode. */
|
|
2492
2791
|
selectedTool = null;
|
|
2792
|
+
/**
|
|
2793
|
+
* Canvas click position in **absolute** coordinates, for the parent to act on
|
|
2794
|
+
* per the selected tool.
|
|
2795
|
+
*
|
|
2796
|
+
* Also carries a sentinel: `{ x: -1, y: laneIndex }` means "edit the swimlane
|
|
2797
|
+
* at `laneIndex`" (the lane's pencil button), not a placement.
|
|
2798
|
+
*/
|
|
2493
2799
|
clickedPosition = new EventEmitter();
|
|
2800
|
+
/** Emitted when a workflow is chosen for a subflow node. */
|
|
2494
2801
|
subflowSelected = new EventEmitter();
|
|
2802
|
+
/** Where a stage will be created once the stage dialog is confirmed. */
|
|
2495
2803
|
pendingStagePosition = null;
|
|
2804
|
+
/** A stage node's properties were edited on the canvas. */
|
|
2496
2805
|
stagePropertiesUpdated = new EventEmitter();
|
|
2806
|
+
/** A connection's action properties were edited on the canvas. */
|
|
2497
2807
|
actionPropertiesUpdated = new EventEmitter();
|
|
2498
|
-
|
|
2808
|
+
/** The SVG root; its bounding box defines absolute canvas space. */
|
|
2499
2809
|
canvasRef;
|
|
2500
2810
|
onWindowMouseUp(event) {
|
|
2501
2811
|
// If we have a popup open but the mouse is released outside, clean up
|
|
@@ -2503,7 +2813,6 @@ class DesignerCanvasComponent {
|
|
|
2503
2813
|
!this.showStartNodeFormPopup &&
|
|
2504
2814
|
!this.popupVisible && // Only end drag if no popup is visible
|
|
2505
2815
|
this.state.isConnectionDragging()) {
|
|
2506
|
-
console.log('External mouseup detected - cleaning up connection drag');
|
|
2507
2816
|
this.state.endConnectionDrag();
|
|
2508
2817
|
}
|
|
2509
2818
|
}
|
|
@@ -2574,7 +2883,6 @@ class DesignerCanvasComponent {
|
|
|
2574
2883
|
}
|
|
2575
2884
|
// Get the position where the click occurred
|
|
2576
2885
|
const position = this.getMousePosition(event);
|
|
2577
|
-
console.log('Canvas clicked at:', position, 'with tool:', this.selectedTool);
|
|
2578
2886
|
// Calculate the swimlane index based on position
|
|
2579
2887
|
// const swimlaneIndex = Math.floor(position.y / this.swimlaneHeight);
|
|
2580
2888
|
// Only emit the position if we have a tool selected and it's a valid click area
|
|
@@ -2598,18 +2906,15 @@ class DesignerCanvasComponent {
|
|
|
2598
2906
|
IsEntryPoint: nodeInfo.node.isStartNode,
|
|
2599
2907
|
id: stageId,
|
|
2600
2908
|
};
|
|
2601
|
-
console.log(this.activeStageData, "ACTIVE STAGE DATA");
|
|
2602
2909
|
this.showStageDialogLocal = true;
|
|
2603
2910
|
}
|
|
2604
2911
|
}
|
|
2605
2912
|
onShowActionDialog(connectionInfo) {
|
|
2606
|
-
console.log("CONECTION", connectionInfo);
|
|
2607
2913
|
// Find the node
|
|
2608
2914
|
// const connectionInfo = this.state.findActionById(actionId);
|
|
2609
2915
|
if (connectionInfo) {
|
|
2610
2916
|
this.activeActionId = connectionInfo.id;
|
|
2611
2917
|
this.activeActionData = connectionInfo;
|
|
2612
|
-
console.log(this.activeActionData);
|
|
2613
2918
|
this.showActionDialogLocal = true;
|
|
2614
2919
|
}
|
|
2615
2920
|
}
|
|
@@ -2623,8 +2928,6 @@ class DesignerCanvasComponent {
|
|
|
2623
2928
|
};
|
|
2624
2929
|
this.activeEscalationType.set(event.type);
|
|
2625
2930
|
this.activeStageCode.set(this.activeStageData?.Code || '');
|
|
2626
|
-
console.log('Active Stage Data:', this.activeStageData);
|
|
2627
|
-
console.log('Escalation Type:', this.activeEscalationType());
|
|
2628
2931
|
this.showEscalationDialogLocal = true;
|
|
2629
2932
|
}
|
|
2630
2933
|
}
|
|
@@ -2664,7 +2967,6 @@ class DesignerCanvasComponent {
|
|
|
2664
2967
|
...nodeInfo.node.stageData,
|
|
2665
2968
|
...stageData,
|
|
2666
2969
|
};
|
|
2667
|
-
console.log('Updated stage data:', nodeInfo.node.stageData);
|
|
2668
2970
|
// Sync the entry-point flag onto node.isStartNode, which drives both the
|
|
2669
2971
|
// start circle and the IsEntryPoint value serialized to the API.
|
|
2670
2972
|
if (stageData.IsEntryPoint) {
|
|
@@ -2701,7 +3003,6 @@ class DesignerCanvasComponent {
|
|
|
2701
3003
|
connection.label = actionData.label;
|
|
2702
3004
|
connection.action = actionData.action;
|
|
2703
3005
|
connection.targetStatus = actionData.targetStatus;
|
|
2704
|
-
console.log('Updated action data:', connection);
|
|
2705
3006
|
}
|
|
2706
3007
|
return connection;
|
|
2707
3008
|
});
|
|
@@ -2726,7 +3027,14 @@ class DesignerCanvasComponent {
|
|
|
2726
3027
|
});
|
|
2727
3028
|
}, 0);
|
|
2728
3029
|
}
|
|
2729
|
-
|
|
3030
|
+
/**
|
|
3031
|
+
* Converts a DOM mouse event into **absolute canvas coordinates**, relative
|
|
3032
|
+
* to the SVG's bounding box.
|
|
3033
|
+
*
|
|
3034
|
+
* This is the space that `state.addNode`, `Math.floor(y / 263)`, and all
|
|
3035
|
+
* connection math expect. Use this — not {@link getViewportPosition} — for
|
|
3036
|
+
* anything positional.
|
|
3037
|
+
*/
|
|
2730
3038
|
getMousePosition(event) {
|
|
2731
3039
|
// Use clientX/Y and getBoundingClientRect() for cross-browser compatibility
|
|
2732
3040
|
const rect = this.canvasRef.nativeElement.getBoundingClientRect();
|
|
@@ -2735,8 +3043,14 @@ class DesignerCanvasComponent {
|
|
|
2735
3043
|
y: event.clientY - rect.top,
|
|
2736
3044
|
};
|
|
2737
3045
|
}
|
|
2738
|
-
|
|
2739
|
-
|
|
3046
|
+
/**
|
|
3047
|
+
* Converts absolute canvas coordinates into **viewport coordinates** by
|
|
3048
|
+
* subtracting the scroll container's offsets.
|
|
3049
|
+
*
|
|
3050
|
+
* Used **only** to position HTML popups overlaid on the SVG. Feeding this
|
|
3051
|
+
* into node or connection math produces elements that drift as the canvas
|
|
3052
|
+
* scrolls.
|
|
3053
|
+
*/
|
|
2740
3054
|
getViewportPosition(canvasX, canvasY) {
|
|
2741
3055
|
const parentElement = this.canvasRef.nativeElement.parentElement;
|
|
2742
3056
|
const scrollLeft = parentElement?.scrollLeft || 0;
|
|
@@ -2787,7 +3101,6 @@ class DesignerCanvasComponent {
|
|
|
2787
3101
|
nodeInfo.node.type === 'stage' &&
|
|
2788
3102
|
nodeInfo.node.stageData?.IsExitPoint) {
|
|
2789
3103
|
// Don't allow connections from exit points
|
|
2790
|
-
console.log('Cannot create connections from exit points');
|
|
2791
3104
|
return;
|
|
2792
3105
|
}
|
|
2793
3106
|
const position = this.getMousePosition(event);
|
|
@@ -2953,12 +3266,25 @@ class DesignerCanvasComponent {
|
|
|
2953
3266
|
}
|
|
2954
3267
|
}
|
|
2955
3268
|
}
|
|
3269
|
+
/**
|
|
3270
|
+
* Terminates a connection drag. Three outcomes, evaluated in order:
|
|
3271
|
+
*
|
|
3272
|
+
* 1. **Dropped on an existing connection point** — if the source and target
|
|
3273
|
+
* are different nodes and `state.canConnect` allows the type pairing, the
|
|
3274
|
+
* connection is created immediately.
|
|
3275
|
+
* 2. **Dropped inside a swimlane but not on a point** — opens the node-type
|
|
3276
|
+
* popup ({@link showConnectionPopup}), offering only the types permitted by
|
|
3277
|
+
* `state.getAllowedTargetNodeTypes()`. The node is created later, by
|
|
3278
|
+
* {@link createNodeConnection}.
|
|
3279
|
+
* 3. **Dropped outside every swimlane** — the drag is cancelled.
|
|
3280
|
+
*
|
|
3281
|
+
* Always detaches the document-level move/up listeners first, so an early
|
|
3282
|
+
* return cannot leave them attached.
|
|
3283
|
+
*/
|
|
2956
3284
|
onMouseUp = (event) => {
|
|
2957
3285
|
document.removeEventListener('mousemove', this.onMouseMove);
|
|
2958
3286
|
document.removeEventListener('mouseup', this.onMouseUp);
|
|
2959
3287
|
const position = this.getMousePosition(event);
|
|
2960
|
-
console.log('Mouse up at position:', position);
|
|
2961
|
-
console.log('Is connection dragging:', this.state.isConnectionDragging());
|
|
2962
3288
|
// Only proceed if we are dragging a connection
|
|
2963
3289
|
if (!this.state.isConnectionDragging()) {
|
|
2964
3290
|
return;
|
|
@@ -2967,7 +3293,6 @@ class DesignerCanvasComponent {
|
|
|
2967
3293
|
const targetPointInfo = this.findConnectionPointAtPosition(position.x, position.y);
|
|
2968
3294
|
if (targetPointInfo) {
|
|
2969
3295
|
// We found a target connection point
|
|
2970
|
-
console.log('Found target connection point:', targetPointInfo);
|
|
2971
3296
|
// Get the source point and swimlane index
|
|
2972
3297
|
const sourcePoint = this.state.draggingConnectionData.sourcePoint;
|
|
2973
3298
|
const sourceSwimlaneIndex = this.state.draggingConnectionData.sourceSwimlaneIndex;
|
|
@@ -2994,16 +3319,9 @@ class DesignerCanvasComponent {
|
|
|
2994
3319
|
};
|
|
2995
3320
|
// Add to connections array
|
|
2996
3321
|
this.state.connections.push(connection);
|
|
2997
|
-
console.log('Created direct connection between nodes:', connection);
|
|
2998
3322
|
// Notify about connection creation
|
|
2999
3323
|
this.onConnectionCreated(connection);
|
|
3000
3324
|
}
|
|
3001
|
-
else {
|
|
3002
|
-
console.log('Cannot connect these node types:', sourceNodeInfo?.node.type, '->', targetNodeInfo?.node.type);
|
|
3003
|
-
}
|
|
3004
|
-
}
|
|
3005
|
-
else {
|
|
3006
|
-
console.log('Cannot connect a node to itself');
|
|
3007
3325
|
}
|
|
3008
3326
|
}
|
|
3009
3327
|
// End the connection drag
|
|
@@ -3012,18 +3330,28 @@ class DesignerCanvasComponent {
|
|
|
3012
3330
|
}
|
|
3013
3331
|
// Check if the position is within any swimlane
|
|
3014
3332
|
const isInsideSwimlane = this.isPositionInsideSwimlane(position.y);
|
|
3015
|
-
console.log('Is inside swimlane:', isInsideSwimlane);
|
|
3016
3333
|
// Only show popup if within a swimlane
|
|
3017
3334
|
if (isInsideSwimlane && this.state.isConnectionDragging()) {
|
|
3018
|
-
console.log('Showing connection popup');
|
|
3019
3335
|
this.showConnectionPopup(position.x, position.y);
|
|
3020
3336
|
}
|
|
3021
3337
|
else {
|
|
3022
3338
|
// End the connection drag if outside a swimlane
|
|
3023
|
-
console.log('Ending connection drag without showing popup');
|
|
3024
3339
|
this.state.endConnectionDrag();
|
|
3025
3340
|
}
|
|
3026
3341
|
};
|
|
3342
|
+
/**
|
|
3343
|
+
* Hit-tests an absolute canvas position against every node's connection
|
|
3344
|
+
* points, resolving each to absolute space as
|
|
3345
|
+
* `node.y + swimlaneIndex * 263 + point.y` — the inverse of the render
|
|
3346
|
+
* formula.
|
|
3347
|
+
*
|
|
3348
|
+
* Returns the first point within `tolerance` pixels, or `null`. Scans all
|
|
3349
|
+
* lanes and all nodes linearly.
|
|
3350
|
+
*
|
|
3351
|
+
* @param x Absolute canvas X (from {@link getMousePosition}).
|
|
3352
|
+
* @param y Absolute canvas Y.
|
|
3353
|
+
* @param tolerance Hit radius in pixels.
|
|
3354
|
+
*/
|
|
3027
3355
|
findConnectionPointAtPosition(x, y, tolerance = 10) {
|
|
3028
3356
|
// Iterate through all swimlanes and nodes to find connection points
|
|
3029
3357
|
for (let swimlaneIndex = 0; swimlaneIndex < this.state.swimlanes.length; swimlaneIndex++) {
|
|
@@ -3065,31 +3393,23 @@ class DesignerCanvasComponent {
|
|
|
3065
3393
|
return y >= 0 && y < totalSwimlaneHeight;
|
|
3066
3394
|
}
|
|
3067
3395
|
showConnectionPopup(x, y) {
|
|
3068
|
-
console.log('Showing connection popup at:', x, y);
|
|
3069
3396
|
// Convert canvas coordinates to viewport coordinates for popup positioning
|
|
3070
3397
|
const viewportPos = this.getViewportPosition(x, y);
|
|
3071
3398
|
this.popupX = viewportPos.x;
|
|
3072
3399
|
this.popupY = viewportPos.y;
|
|
3073
3400
|
// Get allowed node types based on the source node type
|
|
3074
3401
|
this.allowedNodeTypes = this.state.getAllowedTargetNodeTypes();
|
|
3075
|
-
console.log('Allowed node types:', this.allowedNodeTypes);
|
|
3076
3402
|
// Only show the popup if we have allowed node types
|
|
3077
3403
|
if (this.allowedNodeTypes.length > 0) {
|
|
3078
3404
|
this.popupVisible = true;
|
|
3079
|
-
console.log('Popup visibility set to true');
|
|
3080
3405
|
// Force the popup to be visible in the next tick
|
|
3081
|
-
setTimeout(() => {
|
|
3082
|
-
console.log('Is popup visible in next tick:', this.popupVisible);
|
|
3083
|
-
}, 0);
|
|
3084
3406
|
}
|
|
3085
3407
|
else {
|
|
3086
3408
|
// No allowed node types, just end the drag
|
|
3087
|
-
console.log('No allowed node types, ending drag');
|
|
3088
3409
|
this.state.endConnectionDrag();
|
|
3089
3410
|
}
|
|
3090
3411
|
}
|
|
3091
3412
|
hideConnectionPopup() {
|
|
3092
|
-
console.log('Call to hide');
|
|
3093
3413
|
this.popupVisible = false;
|
|
3094
3414
|
this.state.endConnectionDrag();
|
|
3095
3415
|
}
|
|
@@ -3103,6 +3423,26 @@ class DesignerCanvasComponent {
|
|
|
3103
3423
|
// }
|
|
3104
3424
|
// }
|
|
3105
3425
|
// }
|
|
3426
|
+
/**
|
|
3427
|
+
* Creates a new node at the drop point and connects the dragged edge to it —
|
|
3428
|
+
* the path taken when the user picks a type from the node-type popup.
|
|
3429
|
+
*
|
|
3430
|
+
* ## The coordinate contract this method must honour
|
|
3431
|
+
*
|
|
3432
|
+
* The target swimlane is derived from the **drop** Y
|
|
3433
|
+
* (`Math.floor(endY / 263)`, clamped to the lane range), and `endY` is passed
|
|
3434
|
+
* to `state.addNode` **absolute and unconverted**. `addNode` performs the
|
|
3435
|
+
* lane-relative conversion itself.
|
|
3436
|
+
*
|
|
3437
|
+
* This method previously did the opposite — pre-converting `endY` and passing
|
|
3438
|
+
* the *source* lane — which made `addNode` subtract the lane offset twice, so
|
|
3439
|
+
* the new stage rendered one lane too high and attached to the wrong
|
|
3440
|
+
* swimlane. `designer-canvas.connection-drop.spec.ts` guards against the
|
|
3441
|
+
* regression. Do not reintroduce a conversion here.
|
|
3442
|
+
*
|
|
3443
|
+
* Connecting a decision to a stage defers node creation until the branch
|
|
3444
|
+
* condition is supplied, via {@link pendingDecisionConnection}.
|
|
3445
|
+
*/
|
|
3106
3446
|
createNodeConnection(nodeType) {
|
|
3107
3447
|
const pathData = this.state.getConnectionPathData();
|
|
3108
3448
|
if (!pathData) {
|
|
@@ -3112,7 +3452,6 @@ class DesignerCanvasComponent {
|
|
|
3112
3452
|
// Check if this node type is allowed to be created
|
|
3113
3453
|
const allowedTypes = this.state.getAllowedTargetNodeTypes();
|
|
3114
3454
|
if (!allowedTypes.includes(nodeType)) {
|
|
3115
|
-
console.error(`Cannot create connection to ${nodeType} from current node type`);
|
|
3116
3455
|
this.hideConnectionPopup();
|
|
3117
3456
|
return;
|
|
3118
3457
|
}
|
|
@@ -3182,7 +3521,6 @@ class DesignerCanvasComponent {
|
|
|
3182
3521
|
return;
|
|
3183
3522
|
}
|
|
3184
3523
|
else if (nodeType === 'subflow') {
|
|
3185
|
-
console.log('Creating subflow from connection at:', endX, endY, 'swimlane:', targetSwimlaneIndex);
|
|
3186
3524
|
// Show workflow selection popup and store connection data for later use
|
|
3187
3525
|
this.showSubflowSelectionPopup(endX, endY, targetSwimlaneIndex);
|
|
3188
3526
|
this.hideConnectionPopup();
|
|
@@ -3265,7 +3603,6 @@ class DesignerCanvasComponent {
|
|
|
3265
3603
|
};
|
|
3266
3604
|
// Add connection to the state
|
|
3267
3605
|
this.state.connections.push(connection);
|
|
3268
|
-
console.log('Created decision connection with condition:', connection);
|
|
3269
3606
|
}
|
|
3270
3607
|
}
|
|
3271
3608
|
}
|
|
@@ -3294,25 +3631,21 @@ class DesignerCanvasComponent {
|
|
|
3294
3631
|
try {
|
|
3295
3632
|
const pathData = this.state.getConnectionData(connection);
|
|
3296
3633
|
if (!pathData) {
|
|
3297
|
-
console.error('No path data for connection:', connection);
|
|
3298
3634
|
return '';
|
|
3299
3635
|
}
|
|
3300
3636
|
const { startX, startY, endX, endY } = pathData;
|
|
3301
3637
|
const sourceNodeInfo = this.state.findNodeById(connection.sourceNodeId);
|
|
3302
3638
|
if (!sourceNodeInfo) {
|
|
3303
|
-
console.error('Source node not found for connection:', connection);
|
|
3304
3639
|
return '';
|
|
3305
3640
|
}
|
|
3306
3641
|
const sourceNode = sourceNodeInfo.node;
|
|
3307
3642
|
const sourcePoint = sourceNode.connectionPoints?.find((p) => p.id === connection.sourcePointId);
|
|
3308
3643
|
if (!sourcePoint) {
|
|
3309
|
-
console.error('Source point not found for connection:', connection);
|
|
3310
3644
|
return '';
|
|
3311
3645
|
}
|
|
3312
3646
|
return this.getOrthogonalPath(startX, startY, endX, endY, sourcePoint.type);
|
|
3313
3647
|
}
|
|
3314
3648
|
catch (error) {
|
|
3315
|
-
console.error('Error generating path for connection:', connection, error);
|
|
3316
3649
|
return '';
|
|
3317
3650
|
}
|
|
3318
3651
|
}
|
|
@@ -3383,7 +3716,6 @@ class DesignerCanvasComponent {
|
|
|
3383
3716
|
...swimlane.nodes[nodeIndex].stageData,
|
|
3384
3717
|
...event.stageData,
|
|
3385
3718
|
};
|
|
3386
|
-
console.log('Updated stage data in swimlane:', i, 'node:', nodeIndex, 'data:', swimlane.nodes[nodeIndex].stageData);
|
|
3387
3719
|
}
|
|
3388
3720
|
break;
|
|
3389
3721
|
}
|
|
@@ -3411,7 +3743,6 @@ class DesignerCanvasComponent {
|
|
|
3411
3743
|
onEditSwimlane(event, swimlane, swimlaneIndex) {
|
|
3412
3744
|
event.stopPropagation(); // Prevent the canvas click event from firing
|
|
3413
3745
|
event.preventDefault();
|
|
3414
|
-
console.log('Edit swimlane button clicked for swimlane:', swimlaneIndex);
|
|
3415
3746
|
// Emit a special event for editing a swimlane
|
|
3416
3747
|
this.clickedPosition.emit({
|
|
3417
3748
|
x: -1, // Special value to indicate edit mode
|
|
@@ -3447,13 +3778,11 @@ class DesignerCanvasComponent {
|
|
|
3447
3778
|
this.isLoadingStartNodeForms = false;
|
|
3448
3779
|
})
|
|
3449
3780
|
.catch((error) => {
|
|
3450
|
-
console.error('Error loading forms:', error);
|
|
3451
3781
|
this.isLoadingStartNodeForms = false;
|
|
3452
3782
|
});
|
|
3453
3783
|
}
|
|
3454
3784
|
if (node) {
|
|
3455
3785
|
this.activeNodeForFormSelection = node;
|
|
3456
|
-
console.log('Active node for form selection:', node);
|
|
3457
3786
|
}
|
|
3458
3787
|
else {
|
|
3459
3788
|
this.activeNodeForFormSelection = null;
|
|
@@ -3488,10 +3817,6 @@ class DesignerCanvasComponent {
|
|
|
3488
3817
|
this.state.draggingConnectionData.sourcePoint ?? null;
|
|
3489
3818
|
this.pendingConnectionSourceSwimlaneIndex =
|
|
3490
3819
|
this.state.draggingConnectionData.sourceSwimlaneIndex ?? null;
|
|
3491
|
-
console.log('Stored connection data for subflow:', {
|
|
3492
|
-
sourcePoint: this.pendingConnectionSourcePoint,
|
|
3493
|
-
sourceSwimlaneIndex: this.pendingConnectionSourceSwimlaneIndex,
|
|
3494
|
-
});
|
|
3495
3820
|
}
|
|
3496
3821
|
// Load workflows
|
|
3497
3822
|
this.isLoadingWorkflows = true;
|
|
@@ -3502,27 +3827,18 @@ class DesignerCanvasComponent {
|
|
|
3502
3827
|
this.isLoadingWorkflows = false;
|
|
3503
3828
|
})
|
|
3504
3829
|
.catch((error) => {
|
|
3505
|
-
console.error('Error loading workflows:', error);
|
|
3506
3830
|
this.isLoadingWorkflows = false;
|
|
3507
3831
|
});
|
|
3508
3832
|
this.showSubflowPopup = true;
|
|
3509
3833
|
}
|
|
3510
3834
|
selectSubflowWorkflow(workflow) {
|
|
3511
|
-
console.log('Selecting workflow for subflow:', workflow.Name);
|
|
3512
|
-
console.log('Pending connection data:', {
|
|
3513
|
-
sourcePoint: this.pendingConnectionSourcePoint,
|
|
3514
|
-
sourceSwimlaneIndex: this.pendingConnectionSourceSwimlaneIndex,
|
|
3515
|
-
position: this.pendingSubflowPosition,
|
|
3516
|
-
});
|
|
3517
3835
|
if (this.pendingSubflowPosition) {
|
|
3518
3836
|
const { swimlaneIndex, x, y } = this.pendingSubflowPosition;
|
|
3519
3837
|
// Create the subflow node with the selected workflow data
|
|
3520
3838
|
const node = this.state.addNode(swimlaneIndex, 'subflow', x, y, { Name: workflow.Name }, // Initialize stage name from workflow
|
|
3521
3839
|
{ id: workflow.Code, name: workflow.Name });
|
|
3522
|
-
console.log('Created subflow node:', node);
|
|
3523
3840
|
// If this was created from a connection, create the connection
|
|
3524
3841
|
if (node && this.pendingConnectionSourcePoint) {
|
|
3525
|
-
console.log('Creating connection to new subflow node');
|
|
3526
3842
|
// Find a suitable connection point on the new node
|
|
3527
3843
|
if (node.connectionPoints && node.connectionPoints.length > 0) {
|
|
3528
3844
|
const sourcePoint = this.pendingConnectionSourcePoint;
|
|
@@ -3549,8 +3865,6 @@ class DesignerCanvasComponent {
|
|
|
3549
3865
|
};
|
|
3550
3866
|
// Add connection directly to the state's connections array
|
|
3551
3867
|
this.state.connections.push(connection);
|
|
3552
|
-
console.log('Added connection to state:', connection);
|
|
3553
|
-
console.log('Connections after adding:', this.state.connections);
|
|
3554
3868
|
this.onConnectionCreated(connection);
|
|
3555
3869
|
}
|
|
3556
3870
|
}
|
|
@@ -3601,19 +3915,16 @@ class DesignerCanvasComponent {
|
|
|
3601
3915
|
try {
|
|
3602
3916
|
const pathData = this.state.getConnectionData(connection);
|
|
3603
3917
|
if (!pathData) {
|
|
3604
|
-
console.error('No path data for connection:', connection);
|
|
3605
3918
|
return { x: 0, y: 0 };
|
|
3606
3919
|
}
|
|
3607
3920
|
const { startX, startY, endX, endY } = pathData;
|
|
3608
3921
|
const sourceNodeInfo = this.state.findNodeById(connection.sourceNodeId);
|
|
3609
3922
|
if (!sourceNodeInfo) {
|
|
3610
|
-
console.error('Source node not found for connection:', connection);
|
|
3611
3923
|
return { x: 0, y: 0 };
|
|
3612
3924
|
}
|
|
3613
3925
|
const sourceNode = sourceNodeInfo.node;
|
|
3614
3926
|
const sourcePoint = sourceNode.connectionPoints?.find((p) => p.id === connection.sourcePointId);
|
|
3615
3927
|
if (!sourcePoint) {
|
|
3616
|
-
console.error('Source point not found for connection:', connection);
|
|
3617
3928
|
return { x: 0, y: 0 };
|
|
3618
3929
|
}
|
|
3619
3930
|
// Calculate midpoint based on the connection point type
|
|
@@ -3660,7 +3971,6 @@ class DesignerCanvasComponent {
|
|
|
3660
3971
|
}
|
|
3661
3972
|
}
|
|
3662
3973
|
catch (error) {
|
|
3663
|
-
console.error('Error calculating label position for connection:', connection, error);
|
|
3664
3974
|
return { x: 0, y: 0 };
|
|
3665
3975
|
}
|
|
3666
3976
|
}
|
|
@@ -3700,15 +4010,29 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
3700
4010
|
args: ['window:mouseup', ['$event']]
|
|
3701
4011
|
}] } });
|
|
3702
4012
|
|
|
4013
|
+
/**
|
|
4014
|
+
* Create/edit dialog for a swimlane: its name and the actor tags that own it.
|
|
4015
|
+
*
|
|
4016
|
+
* Serves both modes — `isEditing` selects between them, and `swimlaneData`
|
|
4017
|
+
* carries the current values when editing.
|
|
4018
|
+
*
|
|
4019
|
+
* ⚠️ **Mixed input styles.** `visible` and `isEditing` are decorator inputs
|
|
4020
|
+
* (`this.visible`) while `swimlaneData` is a signal input
|
|
4021
|
+
* (`this.swimlaneData()`). Check before use.
|
|
4022
|
+
*/
|
|
3703
4023
|
class SwimlaneDialogComponent {
|
|
3704
4024
|
fb;
|
|
3705
4025
|
dataService;
|
|
3706
4026
|
swimlaneService;
|
|
3707
4027
|
visible = false;
|
|
4028
|
+
/** Edit mode when true; create mode when false. */
|
|
3708
4029
|
isEditing = false;
|
|
4030
|
+
/** Current values when editing. Signal input — read as `this.swimlaneData()`. */
|
|
3709
4031
|
swimlaneData = input(null);
|
|
3710
4032
|
closed = new EventEmitter();
|
|
4033
|
+
/** Emits the confirmed name and tags, for both create and edit. */
|
|
3711
4034
|
created = new EventEmitter();
|
|
4035
|
+
/** Requests deletion of the lane being edited. */
|
|
3712
4036
|
deleted = new EventEmitter();
|
|
3713
4037
|
searchQuery = '';
|
|
3714
4038
|
workflowName = '';
|
|
@@ -3732,7 +4056,6 @@ class SwimlaneDialogComponent {
|
|
|
3732
4056
|
});
|
|
3733
4057
|
}
|
|
3734
4058
|
ngOnInit() {
|
|
3735
|
-
console.log('Swimlane dialog initialized with data:', this.swimlaneData);
|
|
3736
4059
|
// Reset form fields when dialog opens
|
|
3737
4060
|
// this.selectedTagNames = [];
|
|
3738
4061
|
this.workflowName = '';
|
|
@@ -3781,21 +4104,15 @@ class SwimlaneDialogComponent {
|
|
|
3781
4104
|
this.deleted.emit();
|
|
3782
4105
|
}
|
|
3783
4106
|
onDialogClose(eventData) {
|
|
3784
|
-
console.log('Dialog closed, received data:', eventData);
|
|
3785
4107
|
this.searchQuery = '';
|
|
3786
4108
|
this.workflowName = '';
|
|
3787
4109
|
this.selectedTagNames = [];
|
|
3788
4110
|
this.closed.emit();
|
|
3789
4111
|
}
|
|
3790
4112
|
onDialogOpen(eventData) {
|
|
3791
|
-
console.log('Dialog opened, received data:', eventData);
|
|
3792
4113
|
}
|
|
3793
4114
|
applySelection() {
|
|
3794
4115
|
const selectedTags = this.tags.filter((tag) => this.selectedTagNames.includes(tag.Name));
|
|
3795
|
-
console.log('Submitting swimlane data:', {
|
|
3796
|
-
name: this.workflowName,
|
|
3797
|
-
tags: selectedTags,
|
|
3798
|
-
});
|
|
3799
4116
|
this.created.emit({
|
|
3800
4117
|
tags: this.selectedTags,
|
|
3801
4118
|
name: this.workflowName,
|
|
@@ -3824,10 +4141,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
3824
4141
|
type: Output
|
|
3825
4142
|
}] } });
|
|
3826
4143
|
|
|
4144
|
+
/**
|
|
4145
|
+
* Manages the actor tags available to a workflow — the pool that swimlanes
|
|
4146
|
+
* draw from to define who owns each lane.
|
|
4147
|
+
*
|
|
4148
|
+
* Opened from the toolbar rather than from a node, since tags are
|
|
4149
|
+
* workflow-scoped. Persists via `saveActorTags` immediately, independently of
|
|
4150
|
+
* the workflow save.
|
|
4151
|
+
*/
|
|
3827
4152
|
class ActorTagsDialogComponent {
|
|
3828
4153
|
dataService;
|
|
3829
4154
|
utilService;
|
|
3830
4155
|
visible = false;
|
|
4156
|
+
/** Workflow whose tags are being managed. */
|
|
3831
4157
|
workflowCode = null;
|
|
3832
4158
|
closed = new EventEmitter();
|
|
3833
4159
|
tags = [];
|
|
@@ -3865,7 +4191,6 @@ class ActorTagsDialogComponent {
|
|
|
3865
4191
|
// For now, casting as any to avoid strict type checks if BaseModel has mandatory fields not relevant for creation
|
|
3866
4192
|
};
|
|
3867
4193
|
this.dataService.saveActorTags([actorTag]).then(() => {
|
|
3868
|
-
console.log('Actor tag saved');
|
|
3869
4194
|
this.utilService.showSuccess('Actor tags saved successfully');
|
|
3870
4195
|
this.onDialogClose(null);
|
|
3871
4196
|
});
|
|
@@ -3888,13 +4213,40 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
3888
4213
|
type: Output
|
|
3889
4214
|
}] } });
|
|
3890
4215
|
|
|
4216
|
+
/**
|
|
4217
|
+
* The workflow designer's root component and **the only thing
|
|
4218
|
+
* `WorkflowDesignerModule` exports** — everything else in this folder is
|
|
4219
|
+
* internal.
|
|
4220
|
+
*
|
|
4221
|
+
* ```html
|
|
4222
|
+
* <lib-workflow-designer [workflowCode]="'WOR-QG2LCX'"></lib-workflow-designer>
|
|
4223
|
+
* ```
|
|
4224
|
+
*
|
|
4225
|
+
* Responsibilities are deliberately narrow: load and save the workflow, host
|
|
4226
|
+
* the toolbar and the lane/actor-tag dialogs, and translate toolbar tool
|
|
4227
|
+
* selection plus canvas clicks into state mutations. The heavy lifting —
|
|
4228
|
+
* rendering and all pointer interaction — belongs to
|
|
4229
|
+
* {@link DesignerCanvasComponent}.
|
|
4230
|
+
*
|
|
4231
|
+
* ## Integration requirements
|
|
4232
|
+
*
|
|
4233
|
+
* Consuming apps must provide the `ENVIRONMENT` injection token and have a
|
|
4234
|
+
* reachable Workflow API; the designer throws on construction without the
|
|
4235
|
+
* former and renders empty without the latter. Note there are **no outputs** —
|
|
4236
|
+
* saving is driven by the built-in toolbar button, and the host is not notified
|
|
4237
|
+
* when it happens.
|
|
4238
|
+
*
|
|
4239
|
+
* @see ./docs/07-integration.md — full setup guide
|
|
4240
|
+
* @see ./docs/01-architecture.md — how this fits with the canvas and state
|
|
4241
|
+
*/
|
|
3891
4242
|
class WorkflowDesignerComponent {
|
|
3892
4243
|
state;
|
|
3893
4244
|
dataService;
|
|
3894
4245
|
utilService;
|
|
3895
4246
|
canvasRef;
|
|
4247
|
+
/** Code of the workflow to load. `null` renders an empty canvas. */
|
|
3896
4248
|
workflowCode = null;
|
|
3897
|
-
|
|
4249
|
+
/** Active toolbar tool; `null` means pointer mode. */
|
|
3898
4250
|
selectedTool = null;
|
|
3899
4251
|
showSwimlaneDialog = false;
|
|
3900
4252
|
showActorTagsDialog = false;
|
|
@@ -3941,12 +4293,20 @@ class WorkflowDesignerComponent {
|
|
|
3941
4293
|
}
|
|
3942
4294
|
})
|
|
3943
4295
|
.catch((error) => {
|
|
3944
|
-
console.error('Error saving workflow:', error);
|
|
3945
4296
|
this.isSaving = false;
|
|
3946
4297
|
// Handle error - show a notification, etc.
|
|
3947
4298
|
});
|
|
3948
4299
|
}
|
|
3949
4300
|
}
|
|
4301
|
+
/**
|
|
4302
|
+
* Fetches a workflow by code and hands the first result to
|
|
4303
|
+
* {@link parseWorkflowData}. Called from `ngOnInit` when `workflowCode` is
|
|
4304
|
+
* set.
|
|
4305
|
+
*
|
|
4306
|
+
* Failures are logged and swallowed — the canvas simply stays empty. If the
|
|
4307
|
+
* designer renders blank, check the `ENVIRONMENT` provider and the
|
|
4308
|
+
* `WorkFlowAPI` base URL before suspecting the code itself.
|
|
4309
|
+
*/
|
|
3950
4310
|
loadWorkflow(code) {
|
|
3951
4311
|
this.isLoading = true;
|
|
3952
4312
|
this.dataService
|
|
@@ -3961,11 +4321,31 @@ class WorkflowDesignerComponent {
|
|
|
3961
4321
|
this.isLoading = false;
|
|
3962
4322
|
})
|
|
3963
4323
|
.catch((error) => {
|
|
3964
|
-
console.error('Error loading workflow:', error);
|
|
3965
4324
|
this.isLoading = false;
|
|
3966
4325
|
});
|
|
3967
4326
|
}
|
|
3968
|
-
|
|
4327
|
+
/**
|
|
4328
|
+
* Maps an API `Workflow` into the designer's editing model — the load-side
|
|
4329
|
+
* counterpart to `WorkflowDesignerState.transformToWorkflowModel`.
|
|
4330
|
+
*
|
|
4331
|
+
* Steps, in order:
|
|
4332
|
+
* 1. Reset `swimlanes`, `connections`, and the `*Record` maps, and stash the
|
|
4333
|
+
* full workflow for save-time state derivation.
|
|
4334
|
+
* 2. Rebuild lanes sorted by `Position`, registering lane-id → index mappings.
|
|
4335
|
+
* 3. Rebuild nodes from `Stages`, keyed by `IsSubProcess` into `subflow` or
|
|
4336
|
+
* `stage` type, then generate their connection points.
|
|
4337
|
+
* 4. Rebuild connections from `Actions`.
|
|
4338
|
+
*
|
|
4339
|
+
* Nodes are constructed **literally here** rather than through
|
|
4340
|
+
* `state.addNode`, so that `stage.Code` is preserved as the node id and
|
|
4341
|
+
* identity survives the round trip. That also means this path bypasses
|
|
4342
|
+
* `addNode`'s coordinate conversion — stage coordinates come back from the
|
|
4343
|
+
* API already lane-relative and are used as-is.
|
|
4344
|
+
*
|
|
4345
|
+
* ⚠️ **This is the live parser.** `TransformerService.parseWorkflowData` is a
|
|
4346
|
+
* dead duplicate reached by nothing — edit this one. See
|
|
4347
|
+
* `./docs/06-known-issues.md` section A.
|
|
4348
|
+
*/
|
|
3969
4349
|
parseWorkflowData(workflow) {
|
|
3970
4350
|
// Store the complete workflow
|
|
3971
4351
|
this.state.workflow = workflow;
|
|
@@ -4061,7 +4441,6 @@ class WorkflowDesignerComponent {
|
|
|
4061
4441
|
// Find source and target nodes
|
|
4062
4442
|
const sourceNodeInfo = this.state.findNodeById(action.FromStage);
|
|
4063
4443
|
const targetNodeInfo = this.state.findNodeById(action.ToStage);
|
|
4064
|
-
console.log(sourceNodeInfo, targetNodeInfo);
|
|
4065
4444
|
if (sourceNodeInfo && targetNodeInfo) {
|
|
4066
4445
|
// Find suitable connection points
|
|
4067
4446
|
// const sourceNode = sourceNodeInfo.node;
|
|
@@ -4075,7 +4454,6 @@ class WorkflowDesignerComponent {
|
|
|
4075
4454
|
const sourceNode = sourceNodeInfo.node;
|
|
4076
4455
|
const targetNode = targetNodeInfo.node;
|
|
4077
4456
|
let sourcePointId, targetPointId;
|
|
4078
|
-
console.log(action.SourcePointType, action.TargetPointType);
|
|
4079
4457
|
if (action.SourcePointType) {
|
|
4080
4458
|
// Find a point with matching type
|
|
4081
4459
|
const sourcePoint = sourceNode.connectionPoints?.find((p) => p.type === action.SourcePointType?.toLowerCase());
|
|
@@ -4096,8 +4474,6 @@ class WorkflowDesignerComponent {
|
|
|
4096
4474
|
const targetPoint = targetNode.connectionPoints?.find((p) => p.type === 'left' || p.type === 'top');
|
|
4097
4475
|
targetPointId = targetPoint?.id;
|
|
4098
4476
|
}
|
|
4099
|
-
console.log('Source point:', sourcePointId);
|
|
4100
|
-
console.log('Target point:', targetPointId);
|
|
4101
4477
|
if (sourcePointId && targetPointId) {
|
|
4102
4478
|
const connection = {
|
|
4103
4479
|
id: action.Code, // Use original ID
|
|
@@ -4140,27 +4516,36 @@ class WorkflowDesignerComponent {
|
|
|
4140
4516
|
onToolSelected(tool) {
|
|
4141
4517
|
// Toggle selection if the same tool is clicked again
|
|
4142
4518
|
this.selectedTool = this.selectedTool === tool ? null : tool;
|
|
4143
|
-
console.log('Selected tool:', this.selectedTool);
|
|
4144
4519
|
}
|
|
4145
4520
|
openSwimlaneDialog() {
|
|
4146
|
-
console.log('SML INDEX', this.editingSwimlaneIndex);
|
|
4147
4521
|
if (this.editingSwimlaneIndex !== null) {
|
|
4148
|
-
console.log('SML', this.state.swimlanes[this.editingSwimlaneIndex]);
|
|
4149
4522
|
this.editingSwimlane.set({
|
|
4150
4523
|
name: this.state.swimlanes[this.editingSwimlaneIndex].label,
|
|
4151
4524
|
tags: this.state.swimlanes[this.editingSwimlaneIndex].tags,
|
|
4152
4525
|
});
|
|
4153
|
-
console.log('SML_EDT', this.editingSwimlane());
|
|
4154
4526
|
}
|
|
4155
4527
|
this.showSwimlaneDialog = true;
|
|
4156
4528
|
}
|
|
4529
|
+
/**
|
|
4530
|
+
* Handles a canvas click by branching on the active tool: opening the
|
|
4531
|
+
* swimlane dialog, placing a stage/decision/form node, or starting the
|
|
4532
|
+
* subflow picker. The tool resets to `null` after a successful placement.
|
|
4533
|
+
*
|
|
4534
|
+
* ⚠️ **Sentinel value.** `{ x: -1, y: laneIndex }` is not a position — it
|
|
4535
|
+
* means "edit the swimlane at `laneIndex`", emitted by the lane's pencil
|
|
4536
|
+
* button. It is intercepted before any placement logic runs. Any change to
|
|
4537
|
+
* this method must preserve that check, and callers must never emit a
|
|
4538
|
+
* genuine click with `x === -1`.
|
|
4539
|
+
*
|
|
4540
|
+
* Node placement passes the click Y through **absolute**, with the target
|
|
4541
|
+
* lane derived as `Math.floor(event.y / 263)` — the canonical coordinate
|
|
4542
|
+
* contract described in `./docs/02-coordinate-system.md`.
|
|
4543
|
+
*/
|
|
4157
4544
|
handleCanvasPositionClick(event) {
|
|
4158
|
-
console.log(event);
|
|
4159
4545
|
// Check if this is an edit swimlane event
|
|
4160
4546
|
if (event.x === -1 &&
|
|
4161
4547
|
event.y >= 0 &&
|
|
4162
4548
|
event.y < this.state.swimlanes.length) {
|
|
4163
|
-
console.log('Editing swimlane', event.y);
|
|
4164
4549
|
this.editingSwimlaneIndex = event.y;
|
|
4165
4550
|
this.openSwimlaneDialog();
|
|
4166
4551
|
return;
|
|
@@ -4169,14 +4554,12 @@ class WorkflowDesignerComponent {
|
|
|
4169
4554
|
const swimlaneIndex = Math.floor(event.y / 263);
|
|
4170
4555
|
switch (this.selectedTool) {
|
|
4171
4556
|
case 'swimlane':
|
|
4172
|
-
console.log('Opening swimlane dialog for new swimlane');
|
|
4173
4557
|
this.editingSwimlaneIndex = null; // Set to null to indicate creating a new swimlane
|
|
4174
4558
|
this.openSwimlaneDialog();
|
|
4175
4559
|
this.selectedTool = null;
|
|
4176
4560
|
break;
|
|
4177
4561
|
case 'stage':
|
|
4178
4562
|
if (swimlaneIndex >= 0 && swimlaneIndex < this.state.swimlanes.length) {
|
|
4179
|
-
console.log(`Adding ${this.selectedTool} to swimlane ${swimlaneIndex}`);
|
|
4180
4563
|
// Create the stage directly with default properties
|
|
4181
4564
|
const node = this.state.addNode(swimlaneIndex, 'stage', event.x, event.y, { Name: 'New Stage' } // Add default properties
|
|
4182
4565
|
);
|
|
@@ -4189,7 +4572,6 @@ class WorkflowDesignerComponent {
|
|
|
4189
4572
|
case 'decision':
|
|
4190
4573
|
case 'form':
|
|
4191
4574
|
if (swimlaneIndex >= 0 && swimlaneIndex < this.state.swimlanes.length) {
|
|
4192
|
-
console.log(`Adding ${this.selectedTool} to swimlane ${swimlaneIndex}`);
|
|
4193
4575
|
const node = this.state.addNode(swimlaneIndex, this.selectedTool, event.x, event.y);
|
|
4194
4576
|
if (node) {
|
|
4195
4577
|
// Reset the selected tool after placing a node
|
|
@@ -4199,7 +4581,6 @@ class WorkflowDesignerComponent {
|
|
|
4199
4581
|
break;
|
|
4200
4582
|
case 'subflow':
|
|
4201
4583
|
if (swimlaneIndex >= 0 && swimlaneIndex < this.state.swimlanes.length) {
|
|
4202
|
-
console.log(`Adding ${this.selectedTool} to swimlane ${swimlaneIndex}`);
|
|
4203
4584
|
// Show subflow workflow selection popup
|
|
4204
4585
|
this.canvasRef.showSubflowSelectionPopup(event.x, event.y, swimlaneIndex);
|
|
4205
4586
|
}
|
|
@@ -4209,15 +4590,12 @@ class WorkflowDesignerComponent {
|
|
|
4209
4590
|
}
|
|
4210
4591
|
}
|
|
4211
4592
|
onSwimlaneDialogFilled(event) {
|
|
4212
|
-
console.log('Swimlane dialog filled:', event, 'Editing index:', this.editingSwimlaneIndex);
|
|
4213
4593
|
if (this.editingSwimlaneIndex !== null) {
|
|
4214
4594
|
// Update existing swimlane
|
|
4215
|
-
console.log('Updating existing swimlane at index:', this.editingSwimlaneIndex);
|
|
4216
4595
|
this.state.updateSwimlane(this.editingSwimlaneIndex, event.name, event.tags);
|
|
4217
4596
|
}
|
|
4218
4597
|
else {
|
|
4219
4598
|
// Create new swimlane
|
|
4220
|
-
console.log('Creating new swimlane');
|
|
4221
4599
|
this.state.addSwimlane(event.name, event.tags);
|
|
4222
4600
|
}
|
|
4223
4601
|
this.showSwimlaneDialog = false;
|
|
@@ -4246,7 +4624,6 @@ class WorkflowDesignerComponent {
|
|
|
4246
4624
|
this.finishSwimlaneDelete(index);
|
|
4247
4625
|
})
|
|
4248
4626
|
.catch((error) => {
|
|
4249
|
-
console.error('Error deleting swimlane:', error);
|
|
4250
4627
|
this.utilService.showError('Failed to delete swimlane');
|
|
4251
4628
|
});
|
|
4252
4629
|
}
|
|
@@ -4285,11 +4662,30 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
4285
4662
|
type: Input
|
|
4286
4663
|
}] } });
|
|
4287
4664
|
|
|
4665
|
+
/**
|
|
4666
|
+
* Read-only summary of a decision node's existing branches: each outgoing
|
|
4667
|
+
* connection, its target stage, and its condition. Its only output is
|
|
4668
|
+
* `closed` — editing happens elsewhere.
|
|
4669
|
+
*
|
|
4670
|
+
* Distinct from `ConditionsPopupComponent`, which prompts for a condition on a
|
|
4671
|
+
* *newly created* branch; this one reviews the branches already there.
|
|
4672
|
+
*
|
|
4673
|
+
* ⚠️ `getConnectionConditions` substitutes a hard-coded placeholder
|
|
4674
|
+
* (`'order.amount > 500,000'`) for connections with no condition set, so the
|
|
4675
|
+
* popup can display a condition that does not exist in the model. Likewise
|
|
4676
|
+
* `getDuration` falls back to `120`.
|
|
4677
|
+
*
|
|
4678
|
+
* Rendered as HTML overlaid on the SVG, so `popupX` / `popupY` are **viewport**
|
|
4679
|
+
* coordinates, not canvas coordinates.
|
|
4680
|
+
*/
|
|
4288
4681
|
class DecisionPopupComponent {
|
|
4289
4682
|
state;
|
|
4290
4683
|
visible = false;
|
|
4684
|
+
/** Decision node whose branches are shown. */
|
|
4291
4685
|
decisionNodeId = '';
|
|
4686
|
+
/** Viewport X — not canvas X. */
|
|
4292
4687
|
popupX = 0;
|
|
4688
|
+
/** Viewport Y — not canvas Y. */
|
|
4293
4689
|
popupY = 0;
|
|
4294
4690
|
closed = new EventEmitter();
|
|
4295
4691
|
showDuration = true;
|
|
@@ -4345,6 +4741,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
4345
4741
|
type: Output
|
|
4346
4742
|
}] } });
|
|
4347
4743
|
|
|
4744
|
+
/**
|
|
4745
|
+
* ⚠️ **NOT ON THE LIVE PATH.** The only class that injects this is
|
|
4746
|
+
* `TransformerService`, which is itself injected by nothing.
|
|
4747
|
+
*
|
|
4748
|
+
* It duplicates connection logic that lives in `WorkflowDesignerState`, and the
|
|
4749
|
+
* two copies have **drifted apart**:
|
|
4750
|
+
*
|
|
4751
|
+
* - `connectionRules` here additionally allows `stage → form`; `state` does not.
|
|
4752
|
+
* - `getConnectionData` / `getConnectionPathData` here add `+ 40` to the
|
|
4753
|
+
* swimlane offset; `state` and the render template do not.
|
|
4754
|
+
*
|
|
4755
|
+
* Neither divergence is currently visible to users, precisely because this file
|
|
4756
|
+
* does not run. Make connection changes in `WorkflowDesignerState`.
|
|
4757
|
+
*
|
|
4758
|
+
* @see ./docs/06-known-issues.md section A
|
|
4759
|
+
*/
|
|
4348
4760
|
class ConnectionService {
|
|
4349
4761
|
state;
|
|
4350
4762
|
nodeService;
|
|
@@ -4422,7 +4834,6 @@ class ConnectionService {
|
|
|
4422
4834
|
createConnection(targetNodeId, targetPointId, targetSwimlaneIndex) {
|
|
4423
4835
|
const { sourcePoint, sourceSwimlaneIndex } = this.draggingConnectionData;
|
|
4424
4836
|
if (!sourcePoint || sourceSwimlaneIndex === undefined) {
|
|
4425
|
-
console.error('Missing source data for connection');
|
|
4426
4837
|
return null;
|
|
4427
4838
|
}
|
|
4428
4839
|
const connection = {
|
|
@@ -4563,6 +4974,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
4563
4974
|
}]
|
|
4564
4975
|
}], ctorParameters: () => [{ type: WorkflowDesignerState }, { type: NodeManagementService }] });
|
|
4565
4976
|
|
|
4977
|
+
/**
|
|
4978
|
+
* ⚠️ **NOT ON THE LIVE PATH — injected by nothing.**
|
|
4979
|
+
*
|
|
4980
|
+
* This service appears in `WorkflowDesignerModule`'s `providers` array, which
|
|
4981
|
+
* makes it look wired up, but no component injects it. Its
|
|
4982
|
+
* `parseWorkflowData` and `transformToWorkflowModel` are stale duplicates of
|
|
4983
|
+
* the implementations that actually run:
|
|
4984
|
+
*
|
|
4985
|
+
* - load → `WorkflowDesignerComponent.parseWorkflowData`
|
|
4986
|
+
* - save → `WorkflowDesignerState.transformToWorkflowModel`
|
|
4987
|
+
*
|
|
4988
|
+
* Edit those. Changes here will pass review and do nothing at runtime.
|
|
4989
|
+
*
|
|
4990
|
+
* @see ./docs/06-known-issues.md section A — the split-brain problem
|
|
4991
|
+
*/
|
|
4566
4992
|
class TransformerService {
|
|
4567
4993
|
state;
|
|
4568
4994
|
swimlaneService;
|
|
@@ -4816,6 +5242,25 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
4816
5242
|
}]
|
|
4817
5243
|
}], ctorParameters: () => [{ type: WorkflowDesignerState }, { type: SwimlaneService }, { type: NodeManagementService }, { type: ConnectionService }] });
|
|
4818
5244
|
|
|
5245
|
+
/**
|
|
5246
|
+
* The workflow designer feature module.
|
|
5247
|
+
*
|
|
5248
|
+
* 📖 **Documentation: [`./docs/README.md`](./docs/README.md)** — architecture,
|
|
5249
|
+
* the coordinate system, data model, interactions, persistence, known issues,
|
|
5250
|
+
* integration guide, API reference, and development workflow.
|
|
5251
|
+
*
|
|
5252
|
+
* Declares eleven components and exports exactly one,
|
|
5253
|
+
* {@link WorkflowDesignerComponent}; everything else is internal.
|
|
5254
|
+
*
|
|
5255
|
+
* Requires `verben-ng-ui` (seven modules) and `verben-reporting-ui`
|
|
5256
|
+
* (`EditorModule`) at runtime, and an `ENVIRONMENT` provider in the host app.
|
|
5257
|
+
* See `./docs/07-integration.md`.
|
|
5258
|
+
*
|
|
5259
|
+
* Note: the five `services/` classes listed in `providers` are all
|
|
5260
|
+
* `providedIn: 'root'` already, so those entries are redundant. Two of them
|
|
5261
|
+
* (`TransformerService`, `ConnectionService`) are not reached from any UI path
|
|
5262
|
+
* at all — see `./docs/06-known-issues.md`.
|
|
5263
|
+
*/
|
|
4819
5264
|
class WorkflowDesignerModule {
|
|
4820
5265
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: WorkflowDesignerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
4821
5266
|
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: WorkflowDesignerModule, declarations: [WorkflowDesignerComponent,
|