verben-workflow-ui 0.7.7 → 0.7.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2022/src/lib/components/actors/actors.component.mjs +4 -3
- package/esm2022/src/lib/components/designer/components/label-editor.component.mjs +9 -4
- package/esm2022/src/lib/components/designer/components/swimlane-label.component.mjs +1 -1
- package/esm2022/src/lib/components/designer/components/wf-canvas.component.mjs +2 -2
- package/esm2022/src/lib/components/designer/models/types.mjs +1 -1
- package/esm2022/src/lib/components/designer/services/connection.service.mjs +260 -29
- package/esm2022/src/lib/components/designer/services/wf-mapper.service.mjs +16 -2
- package/esm2022/src/lib/components/flowable-status/flowable-status.component.mjs +4 -3
- package/esm2022/src/lib/components/form-response/form-response.component.mjs +4 -3
- package/esm2022/src/lib/components/form-response/form-response.module.mjs +7 -3
- package/esm2022/src/lib/components/form-values/form-values.component.mjs +4 -3
- package/esm2022/src/lib/components/forms/forms.component.mjs +4 -3
- package/esm2022/src/lib/components/my-queue/my-queue.columns.mjs +6 -1
- package/esm2022/src/lib/components/my-queue/my-queue.component.mjs +4 -3
- package/esm2022/src/lib/components/my-queue/tasks.form.component.mjs +29 -7
- package/esm2022/src/lib/components/task-history/task-history.component.mjs +37 -8
- package/esm2022/src/lib/components/task-notification/task-notification.component.mjs +3 -3
- package/esm2022/src/lib/components/tasks/tasks.columns.mjs +6 -1
- package/esm2022/src/lib/components/tasks/tasks.component.mjs +4 -3
- package/esm2022/src/lib/components/tasks/tasks.form.component.mjs +13 -3
- package/esm2022/src/lib/components/workflow-designer/action-dialog/action-dialog.component.mjs +13 -3
- package/esm2022/src/lib/components/workflow-designer/designer-canvas/designer-canvas.component.mjs +400 -25
- package/esm2022/src/lib/components/workflow-designer/services/transformer.service.mjs +3 -1
- package/esm2022/src/lib/components/workflow-designer/workflow-data.service.mjs +67 -2
- package/esm2022/src/lib/components/workflow-designer/workflow-designer.component.mjs +92 -31
- package/esm2022/src/lib/components/workflow-designer/workflow-designer.state.mjs +3 -1
- package/esm2022/src/lib/components/workflow-designer/workflow-designer.types.mjs +1 -1
- package/esm2022/src/lib/components/workflow-stage/workflow-stage.component.mjs +75 -14
- package/esm2022/src/lib/models/WorkflowAction.mjs +1 -1
- package/esm2022/src/lib/pipes/company-date.pipe.mjs +34 -0
- package/esm2022/src/lib/pipes/public-api.mjs +2 -1
- package/esm2022/src/lib/services/public-api.mjs +2 -1
- package/esm2022/src/lib/services/util.service.mjs +7 -1
- package/esm2022/src/lib/services/workflow-form.helper.mjs +58 -0
- package/esm2022/src/lib/shared/shared.module.mjs +7 -5
- package/fesm2022/verben-workflow-ui-src-lib-components-actors.mjs +3 -2
- package/fesm2022/verben-workflow-ui-src-lib-components-actors.mjs.map +1 -1
- package/fesm2022/verben-workflow-ui-src-lib-components-designer.mjs +284 -34
- package/fesm2022/verben-workflow-ui-src-lib-components-designer.mjs.map +1 -1
- package/fesm2022/verben-workflow-ui-src-lib-components-flowable-status.mjs +3 -2
- package/fesm2022/verben-workflow-ui-src-lib-components-flowable-status.mjs.map +1 -1
- package/fesm2022/verben-workflow-ui-src-lib-components-form-response.mjs +9 -4
- package/fesm2022/verben-workflow-ui-src-lib-components-form-response.mjs.map +1 -1
- package/fesm2022/verben-workflow-ui-src-lib-components-form-values.mjs +3 -2
- package/fesm2022/verben-workflow-ui-src-lib-components-form-values.mjs.map +1 -1
- package/fesm2022/verben-workflow-ui-src-lib-components-forms.mjs +3 -2
- package/fesm2022/verben-workflow-ui-src-lib-components-forms.mjs.map +1 -1
- package/fesm2022/verben-workflow-ui-src-lib-components-my-queue.mjs +36 -8
- package/fesm2022/verben-workflow-ui-src-lib-components-my-queue.mjs.map +1 -1
- package/fesm2022/verben-workflow-ui-src-lib-components-task-history.mjs +37 -8
- 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 +2 -2
- package/fesm2022/verben-workflow-ui-src-lib-components-task-notification.mjs.map +1 -1
- package/fesm2022/verben-workflow-ui-src-lib-components-tasks.mjs +20 -4
- package/fesm2022/verben-workflow-ui-src-lib-components-tasks.mjs.map +1 -1
- package/fesm2022/verben-workflow-ui-src-lib-components-workflow-designer.mjs +572 -57
- package/fesm2022/verben-workflow-ui-src-lib-components-workflow-designer.mjs.map +1 -1
- package/fesm2022/verben-workflow-ui-src-lib-components-workflow-stage.mjs +74 -13
- package/fesm2022/verben-workflow-ui-src-lib-components-workflow-stage.mjs.map +1 -1
- package/fesm2022/verben-workflow-ui-src-lib-pipes.mjs +32 -1
- package/fesm2022/verben-workflow-ui-src-lib-pipes.mjs.map +1 -1
- package/fesm2022/verben-workflow-ui-src-lib-services.mjs +65 -1
- package/fesm2022/verben-workflow-ui-src-lib-services.mjs.map +1 -1
- package/fesm2022/verben-workflow-ui-src-lib-shared.mjs +6 -4
- package/fesm2022/verben-workflow-ui-src-lib-shared.mjs.map +1 -1
- package/package.json +31 -31
- package/src/lib/components/designer/components/label-editor.component.d.ts +2 -1
- package/src/lib/components/designer/models/types.d.ts +1 -0
- package/src/lib/components/designer/services/connection.service.d.ts +15 -0
- package/src/lib/components/form-response/form-response.module.d.ts +2 -1
- package/src/lib/components/my-queue/tasks.form.component.d.ts +3 -1
- package/src/lib/components/task-history/task-history.component.d.ts +3 -1
- package/src/lib/components/workflow-designer/action-dialog/action-dialog.component.d.ts +4 -2
- package/src/lib/components/workflow-designer/designer-canvas/designer-canvas.component.d.ts +5 -0
- package/src/lib/components/workflow-designer/workflow-data.service.d.ts +7 -0
- package/src/lib/components/workflow-designer/workflow-designer.component.d.ts +1 -0
- package/src/lib/components/workflow-designer/workflow-designer.types.d.ts +1 -0
- package/src/lib/components/workflow-stage/workflow-stage.component.d.ts +4 -1
- package/src/lib/models/WorkflowAction.d.ts +1 -0
- package/src/lib/pipes/company-date.pipe.d.ts +11 -0
- package/src/lib/pipes/public-api.d.ts +1 -0
- package/src/lib/services/public-api.d.ts +1 -0
- package/src/lib/services/util.service.d.ts +4 -0
- package/src/lib/services/workflow-form.helper.d.ts +17 -0
- package/src/lib/shared/shared.module.d.ts +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { Injectable, EventEmitter, Component, Input, Output, input, effect, signal, ViewChild, HostListener, NgModule } from '@angular/core';
|
|
3
|
-
import { ObjectState, TaskAssignmentType, Status, StageActorRule,
|
|
3
|
+
import { ObjectState, TaskAssignmentType, Status, StageActorRule, SearchOperator, SearchPropertySign, ErrorResponse, SortDirection, EscalationType, TaskNotificationType } from 'verben-workflow-ui/src/lib/models';
|
|
4
4
|
import * as i1 from 'verben-workflow-ui/src/lib/services';
|
|
5
5
|
import * as i3 from '@angular/common';
|
|
6
6
|
import { CommonModule } from '@angular/common';
|
|
@@ -778,6 +778,7 @@ class WorkflowDesignerState {
|
|
|
778
778
|
updatedAction.OperationAction = conn.action;
|
|
779
779
|
updatedAction.Position = conn.position;
|
|
780
780
|
updatedAction.Caption = conn.caption;
|
|
781
|
+
updatedAction.Form = conn.form;
|
|
781
782
|
updatedAction.IsParallel = targetNode?.stageData?.IsParallel || false;
|
|
782
783
|
updatedAction.PassOnRule = conn.condition || '';
|
|
783
784
|
updatedAction.TargetStatus = conn.targetStatus || undefined;
|
|
@@ -803,6 +804,7 @@ class WorkflowDesignerState {
|
|
|
803
804
|
OperationAction: conn.action,
|
|
804
805
|
Position: conn.position,
|
|
805
806
|
Caption: conn.caption,
|
|
807
|
+
Form: conn.form,
|
|
806
808
|
TargetStatus: conn.targetStatus,
|
|
807
809
|
FromStage: conn.sourceNodeId,
|
|
808
810
|
ToStage: conn.targetNodeId,
|
|
@@ -999,10 +1001,75 @@ class WorkflowDataService {
|
|
|
999
1001
|
const url = `GetWorkflows/${skip}/${limit}`;
|
|
1000
1002
|
return this.withLoader(() => this.httpService.get(url, this.envSvc.environment.WorkFlowAPI));
|
|
1001
1003
|
}
|
|
1004
|
+
formPageSize = 10;
|
|
1002
1005
|
getForms(skip = 0, limit = 0) {
|
|
1003
1006
|
const url = `GetForms/${skip}/${limit}`;
|
|
1004
1007
|
return this.withLoader(() => this.httpService.get(url, this.envSvc.environment.WorkFlowAPI));
|
|
1005
1008
|
}
|
|
1009
|
+
async getAllForms() {
|
|
1010
|
+
return this.loadFormsDynamic(null);
|
|
1011
|
+
}
|
|
1012
|
+
async loadMoreForms(event) {
|
|
1013
|
+
return this.loadFormsDynamic(event);
|
|
1014
|
+
}
|
|
1015
|
+
async searchForms(param, event) {
|
|
1016
|
+
const payload = {
|
|
1017
|
+
Fields: ['Code', 'Name'],
|
|
1018
|
+
SearchKeyValues: ['Code', 'Name'].map((prop) => ({
|
|
1019
|
+
PropertyName: prop,
|
|
1020
|
+
EntityValue: param,
|
|
1021
|
+
Operator: SearchOperator.Or,
|
|
1022
|
+
Sign: SearchPropertySign.EQ,
|
|
1023
|
+
})),
|
|
1024
|
+
};
|
|
1025
|
+
const skip = event ? event.loadTimes * this.formPageSize : 0;
|
|
1026
|
+
const res = await this.httpService.post(`SearchDynamicForm/${skip}/${this.formPageSize}`, payload, this.envSvc.environment.WorkFlowAPI);
|
|
1027
|
+
if (res instanceof ErrorResponse) {
|
|
1028
|
+
return [];
|
|
1029
|
+
}
|
|
1030
|
+
return res.Result || [];
|
|
1031
|
+
}
|
|
1032
|
+
async getAsyncFormLabel(value) {
|
|
1033
|
+
if (!value)
|
|
1034
|
+
return '';
|
|
1035
|
+
const payload = {
|
|
1036
|
+
Fields: ['Name'],
|
|
1037
|
+
SearchKeyValues: [
|
|
1038
|
+
{
|
|
1039
|
+
PropertyName: 'Code',
|
|
1040
|
+
EntityValue: value,
|
|
1041
|
+
Operator: SearchOperator.And,
|
|
1042
|
+
Sign: SearchPropertySign.EQ,
|
|
1043
|
+
},
|
|
1044
|
+
],
|
|
1045
|
+
};
|
|
1046
|
+
const res = await this.httpService.post('SearchDynamicForm/0/1', payload, this.envSvc.environment.WorkFlowAPI);
|
|
1047
|
+
if (res instanceof ErrorResponse) {
|
|
1048
|
+
return value;
|
|
1049
|
+
}
|
|
1050
|
+
const result = res.Result || [];
|
|
1051
|
+
return result.length > 0 ? result[0] : '';
|
|
1052
|
+
}
|
|
1053
|
+
async loadFormsDynamic(event) {
|
|
1054
|
+
const payload = {
|
|
1055
|
+
Fields: ['Code', 'Name'],
|
|
1056
|
+
SearchKeyValues: [
|
|
1057
|
+
{
|
|
1058
|
+
PropertyName: 'Code',
|
|
1059
|
+
EntityValue: '',
|
|
1060
|
+
Operator: SearchOperator.And,
|
|
1061
|
+
Sign: SearchPropertySign.EQ,
|
|
1062
|
+
Sort: SortDirection.Asc,
|
|
1063
|
+
},
|
|
1064
|
+
],
|
|
1065
|
+
};
|
|
1066
|
+
const skip = event ? event.loadTimes * this.formPageSize : 0;
|
|
1067
|
+
const res = await this.httpService.post(`SearchDynamicForm/${skip}/${this.formPageSize}`, payload, this.envSvc.environment.WorkFlowAPI);
|
|
1068
|
+
if (res instanceof ErrorResponse) {
|
|
1069
|
+
return [];
|
|
1070
|
+
}
|
|
1071
|
+
return res.Result || [];
|
|
1072
|
+
}
|
|
1006
1073
|
getTags(skip = 0, limit = 0) {
|
|
1007
1074
|
const url = `GetTags/${skip}/${limit}`;
|
|
1008
1075
|
return this.withLoader(() => this.httpService.get(url, this.envSvc.environment.AuthAPI));
|
|
@@ -2691,6 +2758,7 @@ class ActionDialogComponent {
|
|
|
2691
2758
|
actionForm;
|
|
2692
2759
|
operationActions = signal([]);
|
|
2693
2760
|
flowableStatuses = signal([]);
|
|
2761
|
+
forms = [];
|
|
2694
2762
|
constructor(fb, dataService, state) {
|
|
2695
2763
|
this.fb = fb;
|
|
2696
2764
|
this.dataService = dataService;
|
|
@@ -2701,6 +2769,7 @@ class ActionDialogComponent {
|
|
|
2701
2769
|
TargetStatus: [null],
|
|
2702
2770
|
Position: 1,
|
|
2703
2771
|
Caption: '',
|
|
2772
|
+
Form: [null],
|
|
2704
2773
|
});
|
|
2705
2774
|
effect(() => {
|
|
2706
2775
|
// If actionData changes, update the form
|
|
@@ -2712,6 +2781,7 @@ class ActionDialogComponent {
|
|
|
2712
2781
|
TargetStatus: actionData.targetStatus || null,
|
|
2713
2782
|
Position: actionData.position,
|
|
2714
2783
|
Caption: actionData.caption || '',
|
|
2784
|
+
Form: actionData.form || null,
|
|
2715
2785
|
});
|
|
2716
2786
|
}
|
|
2717
2787
|
});
|
|
@@ -2719,6 +2789,7 @@ class ActionDialogComponent {
|
|
|
2719
2789
|
ngOnInit() {
|
|
2720
2790
|
this.loadOperationActions();
|
|
2721
2791
|
this.loadFlowableStatuses();
|
|
2792
|
+
this.loadForms();
|
|
2722
2793
|
}
|
|
2723
2794
|
saveAction() {
|
|
2724
2795
|
if (this.actionForm.valid) {
|
|
@@ -2735,6 +2806,7 @@ class ActionDialogComponent {
|
|
|
2735
2806
|
targetStatus: formData.TargetStatus,
|
|
2736
2807
|
position: formData.Position,
|
|
2737
2808
|
caption: formData.Caption,
|
|
2809
|
+
form: formData.Form || '',
|
|
2738
2810
|
});
|
|
2739
2811
|
}
|
|
2740
2812
|
}
|
|
@@ -2771,16 +2843,21 @@ class ActionDialogComponent {
|
|
|
2771
2843
|
this.flowableStatuses.set(data.Result);
|
|
2772
2844
|
});
|
|
2773
2845
|
}
|
|
2846
|
+
loadForms() {
|
|
2847
|
+
this.dataService.getAllForms().then((data) => {
|
|
2848
|
+
this.forms = data || [];
|
|
2849
|
+
});
|
|
2850
|
+
}
|
|
2774
2851
|
onDialogClose(eventData) {
|
|
2775
2852
|
this.closed.emit();
|
|
2776
2853
|
}
|
|
2777
2854
|
onDialogOpen(eventData) { }
|
|
2778
2855
|
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 });
|
|
2779
|
-
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\n [showCloseIcon]=\"true\"\n [dismissOutsideClick]=\"true\"\n [closeOnEscape]=\"true\"\n [size]=\"'medium'\"\n [mode]=\"'drawer'\"\n [disableFooter]=\"false\"\n [isVisible]=\"visible()\"\n [headerTemplate]=\"headerTemplate\"\n [bodyTemplate]=\"bodyTemplate\"\n [footerTemplate]=\"footerTemplate\"\n (openModal)=\"onDialogOpen($event)\"\n (closeModal)=\"onDialogClose($event)\"\n>\n</verben-dialogue>\n\n<ng-template #headerTemplate>\n <div\n class=\"flex items-center justify-between p-3 text-xs border-b-4 border-[var(--vbn-color-primary)]\"\n >\n <button class=\"mr-4\" type=\"button\" (click)=\"onDialogClose($event)\">\n <span\n class=\"block w-2.5 h-2.5 border-t border-l border-[var(--vbn-color-text)]/70 transform -rotate-45\"\n ></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\n name=\"Name\"\n label=\"Name\"\n formControlName=\"Name\"\n placeHolder=\"Enter Name\"\n />\n\n <div class=\"space-y-1\">\n <label\n for=\"operation-action\"\n class=\"text-sm font-semibold text-[var(--vbn-color-text)]\"\n >\n Operation Action\n </label>\n <verben-drop-down\n id=\"operation-action\"\n styleClass=\"w-full\"\n width=\"100%\"\n [multiselect]=\"false\"\n filterBy=\"Name\"\n placeholder=\"Select Operation Action\"\n [options]=\"operationActions()\"\n optionLabel=\"Name\"\n optionValue=\"Code\"\n formControlName=\"OperationAction\"\n class=\"form-control\"\n [showClear]=\"true\"\n [filter]=\"true\"\n ></verben-drop-down>\n </div>\n\n <div class=\"space-y-1\">\n <label\n for=\"target-status\"\n class=\"text-sm font-semibold text-[var(--vbn-color-text)]\"\n >\n Target Status\n </label>\n <verben-drop-down\n id=\"target-status\"\n styleClass=\"w-full\"\n width=\"100%\"\n [multiselect]=\"false\"\n filterBy=\"Description\"\n placeholder=\"Select Target Status\"\n [options]=\"flowableStatuses()\"\n optionLabel=\"Description\"\n optionValue=\"Name\"\n formControlName=\"TargetStatus\"\n class=\"form-control\"\n [showClear]=\"true\"\n [filter]=\"true\"\n ></verben-drop-down>\n </div>\n\n <div class=\"space-y-1\">\n <label\n for=\"position\"\n class=\"text-sm font-semibold text-[var(--vbn-color-text)]\"\n >\n Position\n </label>\n <verben-number-input\n id=\"position\"\n name=\"Position\"\n class=\"form-control\"\n formControlName=\"Position\"\n placeholder=\"Enter Position\"\n ></verben-number-input>\n </div>\n <div class=\"space-y-1\">\n <label\n for=\"caption\"\n class=\"text-sm font-semibold text-[var(--vbn-color-text)]\"\n >\n Caption\n </label>\n <verbena-input\n id=\"caption\"\n name=\"Caption\"\n class=\"form-control\"\n formControlName=\"Caption\"\n placeholder=\"Enter Caption\"\n />\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\n (click)=\"onDialogClose($event)\"\n text=\"Cancel\"\n styleType=\"ylw-outline\"\n class=\"ml-auto\"\n ></verbena-button>\n <verbena-button\n type=\"submit\"\n text=\"Save\"\n bgColor=\"var(--vbn-color-primary)\"\n textColor=\"var(--vbn-color-on-primary)\"\n borderRadius=\"10px\"\n pd=\"10px 20px\"\n width=\"114px\"\n height=\"39px\"\n (click)=\"saveAction()\"\n [disable]=\"actionForm.invalid\"\n ></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", 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", "styleType", "size", "block", "disable", "disabled", "isLoading", "spinnerSize", "spinnerColor", "svg", "svgPosition", "svgWidth", "svgHeight", "svgSize", "svgColor", "icon", "useIcon", "iconPosition", "iconColor", "variant", "weight", "bgColor", "textColor", "border", "borderRadius", "pd", "width", "height", "fontSize", "fontWeight", "buttonClass", "buttonTextClass"] }, { 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", "autoScrollToCurrentItem", "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"] }, { kind: "component", type: i5.NumberInputComponent, selector: "verben-number-input", inputs: ["min", "max", "step", "value", "label", "controlButton", "disabled", "thousandSeparator", "separator", "decimalPlaces", "prefix", "suffix"], outputs: ["valueChange", "keyUp"] }] });
|
|
2856
|
+
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\n [showCloseIcon]=\"true\"\n [dismissOutsideClick]=\"true\"\n [closeOnEscape]=\"true\"\n [size]=\"'medium'\"\n [mode]=\"'drawer'\"\n [disableFooter]=\"false\"\n [isVisible]=\"visible()\"\n [headerTemplate]=\"headerTemplate\"\n [bodyTemplate]=\"bodyTemplate\"\n [footerTemplate]=\"footerTemplate\"\n (openModal)=\"onDialogOpen($event)\"\n (closeModal)=\"onDialogClose($event)\"\n>\n</verben-dialogue>\n\n<ng-template #headerTemplate>\n <div\n class=\"flex items-center justify-between p-3 text-xs border-b-4 border-[var(--vbn-color-primary)]\"\n >\n <button class=\"mr-4\" type=\"button\" (click)=\"onDialogClose($event)\">\n <span\n class=\"block w-2.5 h-2.5 border-t border-l border-[var(--vbn-color-text)]/70 transform -rotate-45\"\n ></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\n name=\"Name\"\n label=\"Name\"\n formControlName=\"Name\"\n placeHolder=\"Enter Name\"\n />\n\n <div class=\"space-y-1\">\n <label\n for=\"operation-action\"\n class=\"text-sm font-semibold text-[var(--vbn-color-text)]\"\n >\n Operation Action\n </label>\n <verben-drop-down\n id=\"operation-action\"\n styleClass=\"w-full\"\n width=\"100%\"\n [multiselect]=\"false\"\n filterBy=\"Name\"\n placeholder=\"Select Operation Action\"\n [options]=\"operationActions()\"\n optionLabel=\"Name\"\n optionValue=\"Code\"\n formControlName=\"OperationAction\"\n class=\"form-control\"\n [showClear]=\"true\"\n [filter]=\"true\"\n ></verben-drop-down>\n </div>\n\n <div class=\"space-y-1\">\n <label\n for=\"target-status\"\n class=\"text-sm font-semibold text-[var(--vbn-color-text)]\"\n >\n Target Status\n </label>\n <verben-drop-down\n id=\"target-status\"\n styleClass=\"w-full\"\n width=\"100%\"\n [multiselect]=\"false\"\n filterBy=\"Description\"\n placeholder=\"Select Target Status\"\n [options]=\"flowableStatuses()\"\n optionLabel=\"Description\"\n optionValue=\"Name\"\n formControlName=\"TargetStatus\"\n class=\"form-control\"\n [showClear]=\"true\"\n [filter]=\"true\"\n ></verben-drop-down>\n </div>\n\n <div class=\"space-y-1\">\n <label\n for=\"position\"\n class=\"text-sm font-semibold text-[var(--vbn-color-text)]\"\n >\n Position\n </label>\n <verben-number-input\n id=\"position\"\n name=\"Position\"\n class=\"form-control\"\n formControlName=\"Position\"\n placeholder=\"Enter Position\"\n ></verben-number-input>\n </div>\n <div class=\"space-y-1\">\n <label\n for=\"caption\"\n class=\"text-sm font-semibold text-[var(--vbn-color-text)]\"\n >\n Caption\n </label>\n <verbena-input\n id=\"caption\"\n name=\"Caption\"\n class=\"form-control\"\n formControlName=\"Caption\"\n placeholder=\"Enter Caption\"\n />\n </div>\n\n <div class=\"space-y-1\">\n <label\n for=\"action-form\"\n class=\"text-sm font-semibold text-[var(--vbn-color-text)]\"\n >\n Form\n </label>\n <verben-drop-down\n id=\"action-form\"\n styleClass=\"w-full\"\n width=\"100%\"\n [multiselect]=\"false\"\n [filter]=\"true\"\n filterBy=\"Name\"\n [lazyLoad]=\"true\"\n [load]=\"dataService.loadMoreForms.bind(dataService)\"\n [search]=\"dataService.searchForms.bind(dataService)\"\n [asyncLabel]=\"dataService.getAsyncFormLabel.bind(dataService)\"\n placeholder=\"Select Form\"\n [(options)]=\"forms\"\n optionLabel=\"Name\"\n optionValue=\"Code\"\n formControlName=\"Form\"\n class=\"form-control\"\n [showClear]=\"true\"\n ></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\n (click)=\"onDialogClose($event)\"\n text=\"Cancel\"\n styleType=\"ylw-outline\"\n class=\"ml-auto\"\n ></verbena-button>\n <verbena-button\n type=\"submit\"\n text=\"Save\"\n bgColor=\"var(--vbn-color-primary)\"\n textColor=\"var(--vbn-color-on-primary)\"\n borderRadius=\"10px\"\n pd=\"10px 20px\"\n width=\"114px\"\n height=\"39px\"\n (click)=\"saveAction()\"\n [disable]=\"actionForm.invalid\"\n ></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", 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", "styleType", "size", "block", "disable", "disabled", "isLoading", "spinnerSize", "spinnerColor", "svg", "svgPosition", "svgWidth", "svgHeight", "svgSize", "svgColor", "icon", "useIcon", "iconPosition", "iconColor", "variant", "weight", "bgColor", "textColor", "border", "borderRadius", "pd", "width", "height", "fontSize", "fontWeight", "buttonClass", "buttonTextClass"] }, { 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", "autoScrollToCurrentItem", "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"] }, { kind: "component", type: i5.NumberInputComponent, selector: "verben-number-input", inputs: ["min", "max", "step", "value", "label", "controlButton", "disabled", "thousandSeparator", "separator", "decimalPlaces", "prefix", "suffix"], outputs: ["valueChange", "keyUp"] }] });
|
|
2780
2857
|
}
|
|
2781
2858
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ActionDialogComponent, decorators: [{
|
|
2782
2859
|
type: Component,
|
|
2783
|
-
args: [{ selector: 'lib-action-dialog', template: "<verben-dialogue\n [showCloseIcon]=\"true\"\n [dismissOutsideClick]=\"true\"\n [closeOnEscape]=\"true\"\n [size]=\"'medium'\"\n [mode]=\"'drawer'\"\n [disableFooter]=\"false\"\n [isVisible]=\"visible()\"\n [headerTemplate]=\"headerTemplate\"\n [bodyTemplate]=\"bodyTemplate\"\n [footerTemplate]=\"footerTemplate\"\n (openModal)=\"onDialogOpen($event)\"\n (closeModal)=\"onDialogClose($event)\"\n>\n</verben-dialogue>\n\n<ng-template #headerTemplate>\n <div\n class=\"flex items-center justify-between p-3 text-xs border-b-4 border-[var(--vbn-color-primary)]\"\n >\n <button class=\"mr-4\" type=\"button\" (click)=\"onDialogClose($event)\">\n <span\n class=\"block w-2.5 h-2.5 border-t border-l border-[var(--vbn-color-text)]/70 transform -rotate-45\"\n ></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\n name=\"Name\"\n label=\"Name\"\n formControlName=\"Name\"\n placeHolder=\"Enter Name\"\n />\n\n <div class=\"space-y-1\">\n <label\n for=\"operation-action\"\n class=\"text-sm font-semibold text-[var(--vbn-color-text)]\"\n >\n Operation Action\n </label>\n <verben-drop-down\n id=\"operation-action\"\n styleClass=\"w-full\"\n width=\"100%\"\n [multiselect]=\"false\"\n filterBy=\"Name\"\n placeholder=\"Select Operation Action\"\n [options]=\"operationActions()\"\n optionLabel=\"Name\"\n optionValue=\"Code\"\n formControlName=\"OperationAction\"\n class=\"form-control\"\n [showClear]=\"true\"\n [filter]=\"true\"\n ></verben-drop-down>\n </div>\n\n <div class=\"space-y-1\">\n <label\n for=\"target-status\"\n class=\"text-sm font-semibold text-[var(--vbn-color-text)]\"\n >\n Target Status\n </label>\n <verben-drop-down\n id=\"target-status\"\n styleClass=\"w-full\"\n width=\"100%\"\n [multiselect]=\"false\"\n filterBy=\"Description\"\n placeholder=\"Select Target Status\"\n [options]=\"flowableStatuses()\"\n optionLabel=\"Description\"\n optionValue=\"Name\"\n formControlName=\"TargetStatus\"\n class=\"form-control\"\n [showClear]=\"true\"\n [filter]=\"true\"\n ></verben-drop-down>\n </div>\n\n <div class=\"space-y-1\">\n <label\n for=\"position\"\n class=\"text-sm font-semibold text-[var(--vbn-color-text)]\"\n >\n Position\n </label>\n <verben-number-input\n id=\"position\"\n name=\"Position\"\n class=\"form-control\"\n formControlName=\"Position\"\n placeholder=\"Enter Position\"\n ></verben-number-input>\n </div>\n <div class=\"space-y-1\">\n <label\n for=\"caption\"\n class=\"text-sm font-semibold text-[var(--vbn-color-text)]\"\n >\n Caption\n </label>\n <verbena-input\n id=\"caption\"\n name=\"Caption\"\n class=\"form-control\"\n formControlName=\"Caption\"\n placeholder=\"Enter Caption\"\n />\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\n (click)=\"onDialogClose($event)\"\n text=\"Cancel\"\n styleType=\"ylw-outline\"\n class=\"ml-auto\"\n ></verbena-button>\n <verbena-button\n type=\"submit\"\n text=\"Save\"\n bgColor=\"var(--vbn-color-primary)\"\n textColor=\"var(--vbn-color-on-primary)\"\n borderRadius=\"10px\"\n pd=\"10px 20px\"\n width=\"114px\"\n height=\"39px\"\n (click)=\"saveAction()\"\n [disable]=\"actionForm.invalid\"\n ></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", styles: ["::ng-deep .modal-footer{display:flex;justify-content:space-between!important}::ng-deep button,button{cursor:pointer}\n"] }]
|
|
2860
|
+
args: [{ selector: 'lib-action-dialog', template: "<verben-dialogue\n [showCloseIcon]=\"true\"\n [dismissOutsideClick]=\"true\"\n [closeOnEscape]=\"true\"\n [size]=\"'medium'\"\n [mode]=\"'drawer'\"\n [disableFooter]=\"false\"\n [isVisible]=\"visible()\"\n [headerTemplate]=\"headerTemplate\"\n [bodyTemplate]=\"bodyTemplate\"\n [footerTemplate]=\"footerTemplate\"\n (openModal)=\"onDialogOpen($event)\"\n (closeModal)=\"onDialogClose($event)\"\n>\n</verben-dialogue>\n\n<ng-template #headerTemplate>\n <div\n class=\"flex items-center justify-between p-3 text-xs border-b-4 border-[var(--vbn-color-primary)]\"\n >\n <button class=\"mr-4\" type=\"button\" (click)=\"onDialogClose($event)\">\n <span\n class=\"block w-2.5 h-2.5 border-t border-l border-[var(--vbn-color-text)]/70 transform -rotate-45\"\n ></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\n name=\"Name\"\n label=\"Name\"\n formControlName=\"Name\"\n placeHolder=\"Enter Name\"\n />\n\n <div class=\"space-y-1\">\n <label\n for=\"operation-action\"\n class=\"text-sm font-semibold text-[var(--vbn-color-text)]\"\n >\n Operation Action\n </label>\n <verben-drop-down\n id=\"operation-action\"\n styleClass=\"w-full\"\n width=\"100%\"\n [multiselect]=\"false\"\n filterBy=\"Name\"\n placeholder=\"Select Operation Action\"\n [options]=\"operationActions()\"\n optionLabel=\"Name\"\n optionValue=\"Code\"\n formControlName=\"OperationAction\"\n class=\"form-control\"\n [showClear]=\"true\"\n [filter]=\"true\"\n ></verben-drop-down>\n </div>\n\n <div class=\"space-y-1\">\n <label\n for=\"target-status\"\n class=\"text-sm font-semibold text-[var(--vbn-color-text)]\"\n >\n Target Status\n </label>\n <verben-drop-down\n id=\"target-status\"\n styleClass=\"w-full\"\n width=\"100%\"\n [multiselect]=\"false\"\n filterBy=\"Description\"\n placeholder=\"Select Target Status\"\n [options]=\"flowableStatuses()\"\n optionLabel=\"Description\"\n optionValue=\"Name\"\n formControlName=\"TargetStatus\"\n class=\"form-control\"\n [showClear]=\"true\"\n [filter]=\"true\"\n ></verben-drop-down>\n </div>\n\n <div class=\"space-y-1\">\n <label\n for=\"position\"\n class=\"text-sm font-semibold text-[var(--vbn-color-text)]\"\n >\n Position\n </label>\n <verben-number-input\n id=\"position\"\n name=\"Position\"\n class=\"form-control\"\n formControlName=\"Position\"\n placeholder=\"Enter Position\"\n ></verben-number-input>\n </div>\n <div class=\"space-y-1\">\n <label\n for=\"caption\"\n class=\"text-sm font-semibold text-[var(--vbn-color-text)]\"\n >\n Caption\n </label>\n <verbena-input\n id=\"caption\"\n name=\"Caption\"\n class=\"form-control\"\n formControlName=\"Caption\"\n placeholder=\"Enter Caption\"\n />\n </div>\n\n <div class=\"space-y-1\">\n <label\n for=\"action-form\"\n class=\"text-sm font-semibold text-[var(--vbn-color-text)]\"\n >\n Form\n </label>\n <verben-drop-down\n id=\"action-form\"\n styleClass=\"w-full\"\n width=\"100%\"\n [multiselect]=\"false\"\n [filter]=\"true\"\n filterBy=\"Name\"\n [lazyLoad]=\"true\"\n [load]=\"dataService.loadMoreForms.bind(dataService)\"\n [search]=\"dataService.searchForms.bind(dataService)\"\n [asyncLabel]=\"dataService.getAsyncFormLabel.bind(dataService)\"\n placeholder=\"Select Form\"\n [(options)]=\"forms\"\n optionLabel=\"Name\"\n optionValue=\"Code\"\n formControlName=\"Form\"\n class=\"form-control\"\n [showClear]=\"true\"\n ></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\n (click)=\"onDialogClose($event)\"\n text=\"Cancel\"\n styleType=\"ylw-outline\"\n class=\"ml-auto\"\n ></verbena-button>\n <verbena-button\n type=\"submit\"\n text=\"Save\"\n bgColor=\"var(--vbn-color-primary)\"\n textColor=\"var(--vbn-color-on-primary)\"\n borderRadius=\"10px\"\n pd=\"10px 20px\"\n width=\"114px\"\n height=\"39px\"\n (click)=\"saveAction()\"\n [disable]=\"actionForm.invalid\"\n ></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", styles: ["::ng-deep .modal-footer{display:flex;justify-content:space-between!important}::ng-deep button,button{cursor:pointer}\n"] }]
|
|
2784
2861
|
}], ctorParameters: () => [{ type: i1$1.FormBuilder }, { type: WorkflowDataService }, { type: WorkflowDesignerState }], propDecorators: { closed: [{
|
|
2785
2862
|
type: Output
|
|
2786
2863
|
}], saved: [{
|
|
@@ -3037,6 +3114,7 @@ class DesignerCanvasComponent {
|
|
|
3037
3114
|
connection.targetStatus = actionData.targetStatus;
|
|
3038
3115
|
connection.position = actionData.position;
|
|
3039
3116
|
connection.caption = actionData.caption;
|
|
3117
|
+
connection.form = actionData.form;
|
|
3040
3118
|
}
|
|
3041
3119
|
return connection;
|
|
3042
3120
|
});
|
|
@@ -3682,44 +3760,38 @@ class DesignerCanvasComponent {
|
|
|
3682
3760
|
if (!sourcePoint) {
|
|
3683
3761
|
return '';
|
|
3684
3762
|
}
|
|
3685
|
-
|
|
3763
|
+
const layout = this.getConnectionLayout(connection);
|
|
3764
|
+
return this.pointsToSvgPath(layout.points);
|
|
3686
3765
|
}
|
|
3687
3766
|
catch (error) {
|
|
3688
3767
|
return '';
|
|
3689
3768
|
}
|
|
3690
3769
|
}
|
|
3770
|
+
pointsToSvgPath(points) {
|
|
3771
|
+
if (!points || points.length < 2)
|
|
3772
|
+
return '';
|
|
3773
|
+
return points
|
|
3774
|
+
.map((p, i) => `${i === 0 ? 'M' : 'L'} ${p.x} ${p.y}`)
|
|
3775
|
+
.join(' ');
|
|
3776
|
+
}
|
|
3691
3777
|
getOrthogonalPath(startX, startY, endX, endY, pointType) {
|
|
3692
|
-
|
|
3693
|
-
|
|
3694
|
-
// For side points (left/right), start with horizontal line
|
|
3695
|
-
if (pointType === 'left' || pointType === 'right') {
|
|
3696
|
-
// Calculate horizontal distance
|
|
3778
|
+
const startHorizontal = pointType === 'left' || pointType === 'right';
|
|
3779
|
+
if (startHorizontal) {
|
|
3697
3780
|
const horizontalDist = endX - startX;
|
|
3698
|
-
// If the end point is very close horizontally, use a simple 3-segment path
|
|
3699
3781
|
if (Math.abs(horizontalDist) < 30) {
|
|
3700
3782
|
const midY = (startY + endY) / 2;
|
|
3701
|
-
|
|
3702
|
-
}
|
|
3703
|
-
// Otherwise, create a path with horizontal segment first, then vertical, then horizontal
|
|
3704
|
-
else {
|
|
3705
|
-
path = `M ${startX} ${startY} H ${startX + horizontalDist / 2} V ${endY} H ${endX}`;
|
|
3783
|
+
return `M ${startX} ${startY} H ${endX} V ${midY} V ${endY}`;
|
|
3706
3784
|
}
|
|
3785
|
+
return `M ${startX} ${startY} H ${startX + horizontalDist / 2} V ${endY} H ${endX}`;
|
|
3707
3786
|
}
|
|
3708
|
-
|
|
3709
|
-
else if (pointType === 'top' || pointType === 'bottom') {
|
|
3710
|
-
// Calculate vertical distance
|
|
3787
|
+
else {
|
|
3711
3788
|
const verticalDist = endY - startY;
|
|
3712
|
-
// If the end point is very close vertically, use a simple 3-segment path
|
|
3713
3789
|
if (Math.abs(verticalDist) < 30) {
|
|
3714
3790
|
const midX = (startX + endX) / 2;
|
|
3715
|
-
|
|
3716
|
-
}
|
|
3717
|
-
// Otherwise, create a path with vertical segment first, then horizontal, then vertical
|
|
3718
|
-
else {
|
|
3719
|
-
path = `M ${startX} ${startY} V ${startY + verticalDist / 2} H ${endX} V ${endY}`;
|
|
3791
|
+
return `M ${startX} ${startY} V ${endY} H ${midX} H ${endX}`;
|
|
3720
3792
|
}
|
|
3793
|
+
return `M ${startX} ${startY} V ${startY + verticalDist / 2} H ${endX} V ${endY}`;
|
|
3721
3794
|
}
|
|
3722
|
-
return path;
|
|
3723
3795
|
}
|
|
3724
3796
|
selectFormForStage(form, node) {
|
|
3725
3797
|
// If form is null, we're clearing the selection
|
|
@@ -3952,7 +4024,371 @@ class DesignerCanvasComponent {
|
|
|
3952
4024
|
this.canvasHeight = requiredHeight;
|
|
3953
4025
|
}
|
|
3954
4026
|
}
|
|
4027
|
+
connectionLayoutCache = new Map();
|
|
4028
|
+
lastLabelLayoutSignature = '';
|
|
3955
4029
|
getLabelPosition(connection) {
|
|
4030
|
+
return this.getConnectionLayout(connection).labelPos;
|
|
4031
|
+
}
|
|
4032
|
+
getConnectionLayout(connection) {
|
|
4033
|
+
const validConnections = this.state.connections.filter((c) => c.sourceNodeId && c.targetNodeId);
|
|
4034
|
+
const stageBoxes = [];
|
|
4035
|
+
this.state.swimlanes.forEach((lane, laneIdx) => {
|
|
4036
|
+
(lane.nodes || []).forEach((n) => {
|
|
4037
|
+
const gy = n.y + laneIdx * 263;
|
|
4038
|
+
stageBoxes.push({
|
|
4039
|
+
id: n.id,
|
|
4040
|
+
left: n.x,
|
|
4041
|
+
right: n.x + n.width,
|
|
4042
|
+
top: gy,
|
|
4043
|
+
bottom: gy + n.height,
|
|
4044
|
+
});
|
|
4045
|
+
});
|
|
4046
|
+
});
|
|
4047
|
+
const items = validConnections.map((c) => {
|
|
4048
|
+
const pathData = this.state.getConnectionData(c);
|
|
4049
|
+
const sourceNode = this.state.findNodeById(c.sourceNodeId)?.node;
|
|
4050
|
+
const targetNode = this.state.findNodeById(c.targetNodeId)?.node;
|
|
4051
|
+
const sourcePoint = sourceNode?.connectionPoints?.find((p) => p.id === c.sourcePointId);
|
|
4052
|
+
const targetPoint = targetNode?.connectionPoints?.find((p) => p.id === c.targetPointId);
|
|
4053
|
+
return { conn: c, pathData, sourcePoint, targetPoint };
|
|
4054
|
+
});
|
|
4055
|
+
const stageSig = stageBoxes
|
|
4056
|
+
.map((b) => `${b.id}:${Math.round(b.left)}:${Math.round(b.top)}`)
|
|
4057
|
+
.join(',');
|
|
4058
|
+
const connSig = items
|
|
4059
|
+
.map(({ conn, pathData }) => `${conn.id}:${conn.label || ''}:${Math.round(pathData?.startX || 0)}:${Math.round(pathData?.startY || 0)}:${Math.round(pathData?.endX || 0)}:${Math.round(pathData?.endY || 0)}`)
|
|
4060
|
+
.join('|');
|
|
4061
|
+
const signature = `${stageSig}||${connSig}`;
|
|
4062
|
+
if (signature !== this.lastLabelLayoutSignature) {
|
|
4063
|
+
this.lastLabelLayoutSignature = signature;
|
|
4064
|
+
this.connectionLayoutCache.clear();
|
|
4065
|
+
const STAGE_MARGIN = 12;
|
|
4066
|
+
const segHitsStage = (x1, y1, x2, y2, excludeIds) => {
|
|
4067
|
+
const minX = Math.min(x1, x2);
|
|
4068
|
+
const maxX = Math.max(x1, x2);
|
|
4069
|
+
const minY = Math.min(y1, y2);
|
|
4070
|
+
const maxY = Math.max(y1, y2);
|
|
4071
|
+
return stageBoxes.some((b) => {
|
|
4072
|
+
const margin = excludeIds.has(b.id) ? -2 : STAGE_MARGIN;
|
|
4073
|
+
return (maxX > b.left - margin &&
|
|
4074
|
+
minX < b.right + margin &&
|
|
4075
|
+
maxY > b.top - margin &&
|
|
4076
|
+
minY < b.bottom + margin);
|
|
4077
|
+
});
|
|
4078
|
+
};
|
|
4079
|
+
const pointHitsAnyStage = (cx, cy, halfW, halfH) => stageBoxes.some((b) => cx + halfW > b.left &&
|
|
4080
|
+
cx - halfW < b.right &&
|
|
4081
|
+
cy + halfH > b.top &&
|
|
4082
|
+
cy - halfH < b.bottom);
|
|
4083
|
+
const buildPolyline = (startX, startY, endX, endY, sType, tType) => {
|
|
4084
|
+
const OUT = 28;
|
|
4085
|
+
const startH = sType === 'left' || sType === 'right';
|
|
4086
|
+
const endH = tType === 'left' || tType === 'right';
|
|
4087
|
+
const outX = startX + (sType === 'right' ? OUT : sType === 'left' ? -OUT : 0);
|
|
4088
|
+
const outY = startY + (sType === 'bottom' ? OUT : sType === 'top' ? -OUT : 0);
|
|
4089
|
+
const inX = endX + (tType === 'right' ? OUT : tType === 'left' ? -OUT : 0);
|
|
4090
|
+
const inY = endY + (tType === 'bottom' ? OUT : tType === 'top' ? -OUT : 0);
|
|
4091
|
+
if (startH && endH) {
|
|
4092
|
+
const forward = (sType === 'right' && tType === 'left' && endX >= startX) ||
|
|
4093
|
+
(sType === 'left' && tType === 'right' && startX >= endX);
|
|
4094
|
+
if (forward) {
|
|
4095
|
+
const midX = (startX + endX) / 2;
|
|
4096
|
+
const pts = [
|
|
4097
|
+
{ x: startX, y: startY },
|
|
4098
|
+
{ x: midX, y: startY },
|
|
4099
|
+
{ x: midX, y: endY },
|
|
4100
|
+
{ x: endX, y: endY },
|
|
4101
|
+
];
|
|
4102
|
+
return { pts, segIndex: 1 };
|
|
4103
|
+
}
|
|
4104
|
+
const midY = (startY + endY) / 2;
|
|
4105
|
+
const pts = [
|
|
4106
|
+
{ x: startX, y: startY },
|
|
4107
|
+
{ x: outX, y: startY },
|
|
4108
|
+
{ x: outX, y: midY },
|
|
4109
|
+
{ x: inX, y: midY },
|
|
4110
|
+
{ x: inX, y: endY },
|
|
4111
|
+
{ x: endX, y: endY },
|
|
4112
|
+
];
|
|
4113
|
+
return { pts, segIndex: 2 };
|
|
4114
|
+
}
|
|
4115
|
+
if (!startH && !endH) {
|
|
4116
|
+
const forward = (sType === 'bottom' && tType === 'top' && endY >= startY + 20) ||
|
|
4117
|
+
(sType === 'top' && tType === 'bottom' && startY >= endY + 20);
|
|
4118
|
+
if (forward) {
|
|
4119
|
+
const midY = (startY + endY) / 2;
|
|
4120
|
+
const pts = [
|
|
4121
|
+
{ x: startX, y: startY },
|
|
4122
|
+
{ x: startX, y: midY },
|
|
4123
|
+
{ x: endX, y: midY },
|
|
4124
|
+
{ x: endX, y: endY },
|
|
4125
|
+
];
|
|
4126
|
+
return { pts, segIndex: 1 };
|
|
4127
|
+
}
|
|
4128
|
+
const midY = sType === 'bottom'
|
|
4129
|
+
? Math.max(outY, inY) + 12
|
|
4130
|
+
: Math.min(outY, inY) - 12;
|
|
4131
|
+
const pts = [
|
|
4132
|
+
{ x: startX, y: startY },
|
|
4133
|
+
{ x: startX, y: midY },
|
|
4134
|
+
{ x: endX, y: midY },
|
|
4135
|
+
{ x: endX, y: endY },
|
|
4136
|
+
];
|
|
4137
|
+
return { pts, segIndex: 1 };
|
|
4138
|
+
}
|
|
4139
|
+
// Perpendicular: startH !== endH
|
|
4140
|
+
if (startH) {
|
|
4141
|
+
const clearX = sType === 'right' ? endX >= startX + 10 : endX <= startX - 10;
|
|
4142
|
+
const clearY = tType === 'bottom' ? startY >= endY + 10 : startY <= endY - 10;
|
|
4143
|
+
if (clearX && clearY) {
|
|
4144
|
+
// Keep a movable middle horizontal segment by stepping to endX via outX or direct L
|
|
4145
|
+
const pts = [
|
|
4146
|
+
{ x: startX, y: startY },
|
|
4147
|
+
{ x: endX, y: startY },
|
|
4148
|
+
{ x: endX, y: endY },
|
|
4149
|
+
];
|
|
4150
|
+
const hLen = Math.abs(endX - startX);
|
|
4151
|
+
const vLen = Math.abs(endY - startY);
|
|
4152
|
+
return { pts, segIndex: hLen >= vLen ? 0 : 1 };
|
|
4153
|
+
}
|
|
4154
|
+
const pts = [
|
|
4155
|
+
{ x: startX, y: startY },
|
|
4156
|
+
{ x: outX, y: startY },
|
|
4157
|
+
{ x: outX, y: inY },
|
|
4158
|
+
{ x: endX, y: inY },
|
|
4159
|
+
{ x: endX, y: endY },
|
|
4160
|
+
];
|
|
4161
|
+
const seg2Len = Math.abs(inY - startY);
|
|
4162
|
+
const seg3Len = Math.abs(endX - outX);
|
|
4163
|
+
return { pts, segIndex: seg3Len >= seg2Len ? 2 : 1 };
|
|
4164
|
+
}
|
|
4165
|
+
else {
|
|
4166
|
+
const clearY = sType === 'bottom' ? endY >= startY + 10 : endY <= startY - 10;
|
|
4167
|
+
const clearX = tType === 'right' ? startX >= endX + 10 : startX <= endX - 10;
|
|
4168
|
+
if (clearY && clearX) {
|
|
4169
|
+
const pts = [
|
|
4170
|
+
{ x: startX, y: startY },
|
|
4171
|
+
{ x: startX, y: endY },
|
|
4172
|
+
{ x: endX, y: endY },
|
|
4173
|
+
];
|
|
4174
|
+
const vLen = Math.abs(endY - startY);
|
|
4175
|
+
const hLen = Math.abs(endX - startX);
|
|
4176
|
+
return { pts, segIndex: hLen >= vLen ? 1 : 0 };
|
|
4177
|
+
}
|
|
4178
|
+
const pts = [
|
|
4179
|
+
{ x: startX, y: startY },
|
|
4180
|
+
{ x: startX, y: outY },
|
|
4181
|
+
{ x: inX, y: outY },
|
|
4182
|
+
{ x: inX, y: endY },
|
|
4183
|
+
{ x: endX, y: endY },
|
|
4184
|
+
];
|
|
4185
|
+
const seg2Len = Math.abs(inX - startX);
|
|
4186
|
+
const seg3Len = Math.abs(endY - outY);
|
|
4187
|
+
return { pts, segIndex: seg2Len >= seg3Len ? 1 : 2 };
|
|
4188
|
+
}
|
|
4189
|
+
};
|
|
4190
|
+
const prepared = items.map(({ conn, pathData, sourcePoint, targetPoint }) => {
|
|
4191
|
+
if (!pathData || !sourcePoint || !targetPoint) {
|
|
4192
|
+
return {
|
|
4193
|
+
conn,
|
|
4194
|
+
pts: [],
|
|
4195
|
+
segIndex: 0,
|
|
4196
|
+
baseLabel: { x: 0, y: 0 },
|
|
4197
|
+
};
|
|
4198
|
+
}
|
|
4199
|
+
const { pts, segIndex } = buildPolyline(pathData.startX, pathData.startY, pathData.endX, pathData.endY, sourcePoint.type, targetPoint.type);
|
|
4200
|
+
const pA = pts[segIndex];
|
|
4201
|
+
const pB = pts[segIndex + 1];
|
|
4202
|
+
return {
|
|
4203
|
+
conn,
|
|
4204
|
+
pts,
|
|
4205
|
+
segIndex,
|
|
4206
|
+
baseLabel: { x: (pA.x + pB.x) / 2, y: (pA.y + pB.y) / 2 },
|
|
4207
|
+
};
|
|
4208
|
+
});
|
|
4209
|
+
prepared.sort((a, b) => a.baseLabel.y - b.baseLabel.y ||
|
|
4210
|
+
a.baseLabel.x - b.baseLabel.x ||
|
|
4211
|
+
a.conn.id.localeCompare(b.conn.id));
|
|
4212
|
+
const placed = [];
|
|
4213
|
+
const STEP_Y = 42;
|
|
4214
|
+
const STEP_X = 80;
|
|
4215
|
+
const overlapsAny = (cx, cy, halfW, halfH) => placed.some((b) => Math.abs(cx - b.cx) < halfW + b.halfW &&
|
|
4216
|
+
Math.abs(cy - b.cy) < halfH + b.halfH);
|
|
4217
|
+
for (const item of prepared) {
|
|
4218
|
+
const { conn, pts, segIndex } = item;
|
|
4219
|
+
if (pts.length < 2) {
|
|
4220
|
+
this.connectionLayoutCache.set(conn.id, {
|
|
4221
|
+
points: pts,
|
|
4222
|
+
labelPos: { x: 0, y: 0 },
|
|
4223
|
+
});
|
|
4224
|
+
continue;
|
|
4225
|
+
}
|
|
4226
|
+
const excludeIds = new Set([conn.sourceNodeId, conn.targetNodeId]);
|
|
4227
|
+
const text = conn.label || 'New Action';
|
|
4228
|
+
const width = Math.max(120, text.length * 7.5 + 56);
|
|
4229
|
+
const height = 38;
|
|
4230
|
+
const halfW = width / 2;
|
|
4231
|
+
const halfH = height / 2;
|
|
4232
|
+
// If the chosen segment is an endpoint segment (segIndex === 0 or last) and needs shifting,
|
|
4233
|
+
// promote it to a 4-point segment so endpoints stay pinned to the stage connection points.
|
|
4234
|
+
const ensureMovableSegment = () => {
|
|
4235
|
+
if (segIndex > 0 && segIndex < pts.length - 2) {
|
|
4236
|
+
return segIndex;
|
|
4237
|
+
}
|
|
4238
|
+
const a = pts[segIndex];
|
|
4239
|
+
const b = pts[segIndex + 1];
|
|
4240
|
+
const isHoriz = Math.abs(a.y - b.y) < 1;
|
|
4241
|
+
if (isHoriz) {
|
|
4242
|
+
const mx = (a.x + b.x) / 2;
|
|
4243
|
+
const sy = a.y;
|
|
4244
|
+
pts.splice(segIndex + 1, 0, { x: a.x + (mx - a.x) * 0.4, y: sy }, { x: a.x + (mx - a.x) * 0.4, y: sy }, { x: b.x - (b.x - mx) * 0.4, y: sy }, { x: b.x - (b.x - mx) * 0.4, y: sy });
|
|
4245
|
+
return segIndex + 2;
|
|
4246
|
+
}
|
|
4247
|
+
else {
|
|
4248
|
+
const my = (a.y + b.y) / 2;
|
|
4249
|
+
const sx = a.x;
|
|
4250
|
+
pts.splice(segIndex + 1, 0, { x: sx, y: a.y + (my - a.y) * 0.4 }, { x: sx, y: a.y + (my - a.y) * 0.4 }, { x: sx, y: b.y - (b.y - my) * 0.4 }, { x: sx, y: b.y - (b.y - my) * 0.4 });
|
|
4251
|
+
return segIndex + 2;
|
|
4252
|
+
}
|
|
4253
|
+
};
|
|
4254
|
+
let activeSeg = segIndex;
|
|
4255
|
+
let pA = pts[activeSeg];
|
|
4256
|
+
let pB = pts[activeSeg + 1];
|
|
4257
|
+
const isHoriz = Math.abs(pA.y - pB.y) < 1;
|
|
4258
|
+
const baseCx = (pA.x + pB.x) / 2;
|
|
4259
|
+
const baseCy = (pA.y + pB.y) / 2;
|
|
4260
|
+
const segBlocked = segHitsStage(pA.x, pA.y, pB.x, pB.y, excludeIds);
|
|
4261
|
+
const labelBlocked = overlapsAny(baseCx, baseCy, halfW, halfH) ||
|
|
4262
|
+
pointHitsAnyStage(baseCx, baseCy, halfW, halfH);
|
|
4263
|
+
let chosenLabelX = baseCx;
|
|
4264
|
+
let chosenLabelY = baseCy;
|
|
4265
|
+
if (segBlocked || labelBlocked) {
|
|
4266
|
+
let resolved = false;
|
|
4267
|
+
// 1. If the segment itself doesn't hit any stage, try sliding the label along the segment first
|
|
4268
|
+
if (!segBlocked) {
|
|
4269
|
+
if (!isHoriz) {
|
|
4270
|
+
const minY = Math.min(pA.y, pB.y) + 20;
|
|
4271
|
+
const maxY = Math.max(pA.y, pB.y) - 20;
|
|
4272
|
+
for (let ring = 1; ring <= 10 && !resolved; ring++) {
|
|
4273
|
+
for (const dy of [ring * STEP_Y, -ring * STEP_Y]) {
|
|
4274
|
+
const ny = baseCy + dy;
|
|
4275
|
+
if (ny >= minY &&
|
|
4276
|
+
ny <= maxY &&
|
|
4277
|
+
!overlapsAny(baseCx, ny, halfW, halfH) &&
|
|
4278
|
+
!pointHitsAnyStage(baseCx, ny, halfW, halfH)) {
|
|
4279
|
+
chosenLabelY = ny;
|
|
4280
|
+
resolved = true;
|
|
4281
|
+
break;
|
|
4282
|
+
}
|
|
4283
|
+
}
|
|
4284
|
+
}
|
|
4285
|
+
}
|
|
4286
|
+
else {
|
|
4287
|
+
const minX = Math.min(pA.x, pB.x) + 30;
|
|
4288
|
+
const maxX = Math.max(pA.x, pB.x) - 30;
|
|
4289
|
+
for (let ring = 1; ring <= 10 && !resolved; ring++) {
|
|
4290
|
+
for (const dx of [ring * STEP_X, -ring * STEP_X]) {
|
|
4291
|
+
const nx = baseCx + dx;
|
|
4292
|
+
if (nx >= minX &&
|
|
4293
|
+
nx <= maxX &&
|
|
4294
|
+
!overlapsAny(nx, baseCy, halfW, halfH) &&
|
|
4295
|
+
!pointHitsAnyStage(nx, baseCy, halfW, halfH)) {
|
|
4296
|
+
chosenLabelX = nx;
|
|
4297
|
+
resolved = true;
|
|
4298
|
+
break;
|
|
4299
|
+
}
|
|
4300
|
+
}
|
|
4301
|
+
}
|
|
4302
|
+
}
|
|
4303
|
+
}
|
|
4304
|
+
// 2. Otherwise promote to a movable segment and shift the segment itself into a stage-free, label-free lane
|
|
4305
|
+
if (!resolved) {
|
|
4306
|
+
activeSeg = ensureMovableSegment();
|
|
4307
|
+
pA = pts[activeSeg];
|
|
4308
|
+
pB = pts[activeSeg + 1];
|
|
4309
|
+
if (isHoriz) {
|
|
4310
|
+
for (let ring = 1; ring <= 12 && !resolved; ring++) {
|
|
4311
|
+
for (const dy of [ring * STEP_Y, -ring * STEP_Y]) {
|
|
4312
|
+
const ny = baseCy + dy;
|
|
4313
|
+
if (!overlapsAny(baseCx, ny, halfW, halfH) &&
|
|
4314
|
+
!segHitsStage(pA.x, ny, pB.x, ny, excludeIds) &&
|
|
4315
|
+
!pointHitsAnyStage(baseCx, ny, halfW, halfH)) {
|
|
4316
|
+
pA.y = ny;
|
|
4317
|
+
pB.y = ny;
|
|
4318
|
+
chosenLabelY = ny;
|
|
4319
|
+
resolved = true;
|
|
4320
|
+
break;
|
|
4321
|
+
}
|
|
4322
|
+
}
|
|
4323
|
+
}
|
|
4324
|
+
}
|
|
4325
|
+
else {
|
|
4326
|
+
const startEndMinX = Math.min(pts[0].x, pts[pts.length - 1].x);
|
|
4327
|
+
const startEndMaxX = Math.max(pts[0].x, pts[pts.length - 1].x);
|
|
4328
|
+
const keepWithinCorridor = startEndMaxX - startEndMinX >= 60 &&
|
|
4329
|
+
baseCx >= startEndMinX &&
|
|
4330
|
+
baseCx <= startEndMaxX;
|
|
4331
|
+
for (let ring = 1; ring <= 10 && !resolved; ring++) {
|
|
4332
|
+
for (const dx of [ring * STEP_X, -ring * STEP_X]) {
|
|
4333
|
+
const nx = baseCx + dx;
|
|
4334
|
+
if (keepWithinCorridor &&
|
|
4335
|
+
(nx < startEndMinX + 8 || nx > startEndMaxX - 8)) {
|
|
4336
|
+
continue;
|
|
4337
|
+
}
|
|
4338
|
+
if (!overlapsAny(nx, baseCy, halfW, halfH) &&
|
|
4339
|
+
!segHitsStage(nx, pA.y, nx, pB.y, excludeIds) &&
|
|
4340
|
+
!pointHitsAnyStage(nx, baseCy, halfW, halfH)) {
|
|
4341
|
+
pA.x = nx;
|
|
4342
|
+
pB.x = nx;
|
|
4343
|
+
chosenLabelX = nx;
|
|
4344
|
+
resolved = true;
|
|
4345
|
+
break;
|
|
4346
|
+
}
|
|
4347
|
+
}
|
|
4348
|
+
}
|
|
4349
|
+
}
|
|
4350
|
+
}
|
|
4351
|
+
// 3. Final fallback: slide label vertically without bending the arrow through stages
|
|
4352
|
+
if (!resolved) {
|
|
4353
|
+
for (let ring = 1; ring <= 12 && !resolved; ring++) {
|
|
4354
|
+
for (const d of [ring * STEP_Y, -ring * STEP_Y]) {
|
|
4355
|
+
if (isHoriz) {
|
|
4356
|
+
const ny = baseCy + d;
|
|
4357
|
+
if (!overlapsAny(baseCx, ny, halfW, halfH) &&
|
|
4358
|
+
!segHitsStage(pA.x, ny, pB.x, ny, excludeIds)) {
|
|
4359
|
+
pA.y = ny;
|
|
4360
|
+
pB.y = ny;
|
|
4361
|
+
chosenLabelY = ny;
|
|
4362
|
+
resolved = true;
|
|
4363
|
+
break;
|
|
4364
|
+
}
|
|
4365
|
+
}
|
|
4366
|
+
else {
|
|
4367
|
+
const ny = baseCy + d;
|
|
4368
|
+
if (!overlapsAny(baseCx, ny, halfW, halfH)) {
|
|
4369
|
+
chosenLabelY = ny;
|
|
4370
|
+
resolved = true;
|
|
4371
|
+
break;
|
|
4372
|
+
}
|
|
4373
|
+
}
|
|
4374
|
+
}
|
|
4375
|
+
}
|
|
4376
|
+
}
|
|
4377
|
+
}
|
|
4378
|
+
const labelPos = {
|
|
4379
|
+
x: chosenLabelX,
|
|
4380
|
+
y: chosenLabelY,
|
|
4381
|
+
};
|
|
4382
|
+
placed.push({ cx: labelPos.x, cy: labelPos.y, halfW, halfH });
|
|
4383
|
+
this.connectionLayoutCache.set(conn.id, { points: pts, labelPos });
|
|
4384
|
+
}
|
|
4385
|
+
}
|
|
4386
|
+
return (this.connectionLayoutCache.get(connection.id) || {
|
|
4387
|
+
points: [],
|
|
4388
|
+
labelPos: this.getBaseLabelPosition(connection),
|
|
4389
|
+
});
|
|
4390
|
+
}
|
|
4391
|
+
getBaseLabelPosition(connection) {
|
|
3956
4392
|
try {
|
|
3957
4393
|
const pathData = this.state.getConnectionData(connection);
|
|
3958
4394
|
if (!pathData) {
|
|
@@ -3968,6 +4404,22 @@ class DesignerCanvasComponent {
|
|
|
3968
4404
|
if (!sourcePoint) {
|
|
3969
4405
|
return { x: 0, y: 0 };
|
|
3970
4406
|
}
|
|
4407
|
+
const targetNode = this.state.findNodeById(connection.targetNodeId)?.node;
|
|
4408
|
+
const targetPoint = targetNode?.connectionPoints?.find((p) => p.id === connection.targetPointId);
|
|
4409
|
+
const startHorizontal = sourcePoint.type === 'left' || sourcePoint.type === 'right';
|
|
4410
|
+
const endHorizontal = targetPoint?.type === 'left' || targetPoint?.type === 'right';
|
|
4411
|
+
if (targetPoint && startHorizontal !== endHorizontal) {
|
|
4412
|
+
if (Math.abs(endX - startX) >= Math.abs(endY - startY)) {
|
|
4413
|
+
return {
|
|
4414
|
+
x: (startX + endX) / 2,
|
|
4415
|
+
y: startHorizontal ? startY : endY,
|
|
4416
|
+
};
|
|
4417
|
+
}
|
|
4418
|
+
return {
|
|
4419
|
+
x: startHorizontal ? endX : startX,
|
|
4420
|
+
y: (startY + endY) / 2,
|
|
4421
|
+
};
|
|
4422
|
+
}
|
|
3971
4423
|
// Calculate midpoint based on the connection point type
|
|
3972
4424
|
if (sourcePoint.type === 'left' || sourcePoint.type === 'right') {
|
|
3973
4425
|
const horizontalDist = endX - startX;
|
|
@@ -4028,11 +4480,11 @@ class DesignerCanvasComponent {
|
|
|
4028
4480
|
});
|
|
4029
4481
|
}
|
|
4030
4482
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: DesignerCanvasComponent, deps: [{ token: WorkflowDesignerState }, { token: WorkflowDataService }], target: i0.ɵɵFactoryTarget.Component });
|
|
4031
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: DesignerCanvasComponent, selector: "lib-designer-canvas", inputs: { selectedTool: "selectedTool" }, outputs: { clickedPosition: "clickedPosition", subflowSelected: "subflowSelected", stagePropertiesUpdated: "stagePropertiesUpdated", actionPropertiesUpdated: "actionPropertiesUpdated" }, host: { listeners: { "window:mouseup": "onWindowMouseUp($event)" } }, viewQueries: [{ propertyName: "canvasRef", first: true, predicate: ["canvas"], descendants: true, static: true }], ngImport: i0, template: "<div class=\"canvas-container\">\n <svg #canvas [attr.width]=\"canvasWidth\" [attr.height]=\"canvasHeight\" class=\"designer-canvas\"\n (click)=\"onCanvasClick($event)\">\n <defs>\n <!-- Grid pattern definition -->\n\n <pattern id=\"grid\" [attr.width]=\"gridSize\" [attr.height]=\"gridSize\" patternUnits=\"userSpaceOnUse\">\n <path d=\"M 20 0 L 0 0 0 20\" fill=\"none\" stroke=\"#e2e8f0\" stroke-width=\"0.5\" />\n </pattern>\n\n <!-- Arrow head marker definition -->\n <marker id=\"arrowhead\" markerWidth=\"10\" markerHeight=\"7\" refX=\"9\" refY=\"3.5\" orient=\"auto\">\n <polygon points=\"0 0, 10 3.5, 0 7\" fill=\"#D36CFF\" />\n </marker>\n\n <!-- Connection point: outer transparent ring expands the hit target so a\n connection drag can be started without pixel-precise aim. The visible\n circle stays at r=5. The hit ring extends inward up to the node's\n drag-handle edge so clicks near the edge fall to the connection point\n (rendered topmost) rather than to the drag handle beneath. -->\n <g id=\"connection-point-template\">\n <circle r=\"12\" fill=\"transparent\" />\n <circle r=\"5\" fill=\"#D36CFF\" stroke=\"#FFFFFF\" stroke-width=\"1\" />\n </g>\n\n <!-- Dashed line style for connection preview -->\n <pattern id=\"dashed-line\" width=\"10\" height=\"10\" patternUnits=\"userSpaceOnUse\">\n <line x1=\"0\" y1=\"5\" x2=\"10\" y2=\"5\" stroke=\"#D36CFF\" stroke-width=\"2\" stroke-dasharray=\"5,5\" />\n </pattern>\n\n @for (swimlane of state.swimlanes; track swimlane.order) {\n <clipPath [attr.id]=\"'swimlane-clip-' + swimlane.order\">\n <rect x=\"0\" y=\"0\" [attr.width]=\"canvasWidth\" height=\"263\" />\n </clipPath>\n }\n </defs>\n\n <!-- Background grid -->\n <rect width=\"100%\" height=\"100%\" fill=\"url(#grid)\" />\n\n <!-- Display a message when no swimlanes exist -->\n @if (state.swimlanes.length === 0) {\n <text x=\"50%\" y=\"50%\" font-family=\"sans-serif\" font-size=\"16\" fill=\"#94a3b8\" text-anchor=\"middle\">\n Select the Swimlane tool and click on the canvas to add a swimlane\n </text>\n }\n\n <!-- This is where workflow elements will be added later -->\n @for (swimlane of state.swimlanes; track swimlane.order) {\n <!-- <g\n [attr.transform]=\"'translate(0,' + swimlane.order * 263 + ')'\"\n [attr.clip-path]=\"'url(#swimlane-clip-' + swimlane.order + ')'\"\n >\n <rect\n x=\"0\"\n y=\"0\"\n [attr.width]=\"canvasWidth\"\n [attr.height]=\"263\"\n fill=\"#ffffff\"\n stroke=\"#e2e8f0\"\n stroke-width=\"1\"\n ></rect>\n\n <rect\n x=\"0\"\n y=\"0\"\n [attr.width]=\"canvasWidth\"\n height=\"40\"\n fill=\"#f8fafc\"\n stroke=\"#e2e8f0\"\n stroke-width=\"1\"\n ></rect>\n\n <text\n x=\"20\"\n y=\"25\"\n font-family=\"sans-serif\"\n font-size=\"14\"\n fill=\"#333333\"\n font-weight=\"bold\"\n >\n {{ swimlane.label }}\n </text>\n\n <g\n class=\"edit-swimlane-button\"\n [attr.transform]=\"'translate(100, 20)'\"\n (click)=\"\n onEditSwimlane($event, swimlane, swimlane.order);\n $event.stopPropagation()\n \"\n >\n <rect\n x=\"-5\"\n y=\"-15\"\n width=\"40\"\n height=\"20\"\n fill=\"#f3e8ff\"\n rx=\"3\"\n ry=\"3\"\n stroke=\"#d8b4fe\"\n stroke-width=\"1\"\n ></rect>\n <text\n x=\"15\"\n y=\"0\"\n font-family=\"sans-serif\"\n font-size=\"12\"\n fill=\"#7e22ce\"\n text-anchor=\"middle\"\n >\n Edit\n </text>\n </g>\n\n <g [attr.transform]=\"'translate(200, 20)'\">\n @for (tag of swimlane.tags.slice(0, 3); track tag.Name; let i = $index)\n {\n <text\n [attr.x]=\"i * 100\"\n y=\"5\"\n font-family=\"sans-serif\"\n font-size=\"12\"\n fill=\"#666666\"\n >\n {{ tag.Name }}\n </text>\n } @if (swimlane.tags.length > 3) {\n <text\n [attr.x]=\"3 * 100 + 10\"\n y=\"5\"\n font-family=\"sans-serif\"\n font-size=\"12\"\n fill=\"#666666\"\n >\n +{{ swimlane.tags.length - 3 }} more\n </text>\n }\n </g>\n </g> -->\n\n <g [attr.transform]=\"'translate(0,' + swimlane.order * 263 + ')'\">\n <!-- Swimlane container - remove stroke to make it purely background -->\n <rect x=\"0\" y=\"0\" [attr.width]=\"canvasWidth\" [attr.height]=\"263\"\n [attr.fill]=\"swimlane.order % 2 === 0 ? '#FCF3FF' : '#ECFFF5'\" stroke=\"none\"></rect>\n\n <!-- Vertical swimlane label on the left -->\n <g class=\"swimlane-label\">\n <!-- Purple background for the label -->\n <rect x=\"0.5\" y=\"0.5\" width=\"43\" height=\"215\" rx=\"10.5\" fill=\"white\" stroke=\"#D36CFF\"></rect>\n\n <!-- Plus button at the top -->\n <g (click)=\"\n onEditSwimlane($event, swimlane, swimlane.order);\n $event.stopPropagation()\n \">\n <rect x=\"12.5\" y=\"10\" width=\"18\" height=\"18\" fill=\"transparent\" style=\"cursor: pointer\"></rect>\n\n <path d=\"M22.52 12.174V17.08H27.47V18.51H22.52V23.394H21.2V18.51H16.25V17.08H21.2V12.174H22.52Z\"\n fill=\"#0000FF\" class=\"plus-icon\" style=\"cursor: pointer\"></path>\n </g>\n\n <!-- Swimlane label -->\n <text x=\"22\" y=\"106\" font-family=\"sans-serif\" font-size=\"14\" fill=\"#333333\" text-anchor=\"middle\"\n transform=\"rotate(-90, 22, 100)\">\n {{\n swimlane.label.length > 12\n ? swimlane.label.substring(0, 10) + \"...\"\n : swimlane.label\n }}\n </text>\n\n <!-- Tag count indicator at the bottom -->\n <rect x=\"11.5\" y=\"187\" width=\"21\" height=\"19\" rx=\"9.5\" fill=\"#9E9E9E\"></rect>\n <text x=\"24\" y=\"206\" font-family=\"sans-serif\" font-size=\"12\" fill=\"black\" text-anchor=\"middle\"\n transform=\"rotate(-90, 22, 200)\">\n {{ swimlane.tags.length }}\n </text>\n </g>\n </g>\n\n }\n\n <!-- Nodes -->\n @for (swimlane of state.swimlanes; track swimlane.order) {\n <!-- Render nodes in this swimlane -->\n @for (node of swimlane.nodes; track node.id) {\n <g class=\"node-element\" [attr.transform]=\"\n 'translate(' + node.x + ',' + (node.y + swimlane.order * 263) + ')'\"\n (mouseenter)=\"showConnectionPoints(node.id, swimlane.order)\"\n (mouseleave)=\"hideConnectionPoints(node.id)\">\n <!-- Start node indicator (circle and arrow) for the first node -->\n @if (node.isStartNode) {\n <!-- Circle -->\n <circle cx=\"-50\" cy=\"50\" r=\"30\" fill=\"none\" stroke=\"#D36CFF\" stroke-width=\"1\"></circle>\n <!-- Form icon for start node -->\n <svg:g (click)=\"\n toggleStartNodeFormPopup($event, node.x, node.y, swimlane.order)\n \" class=\"stage-icon\" transform=\"translate(-45, 42)\" style=\"cursor: pointer; pointer-events: all\">\n <!-- Transparent rectangle to capture clicks -->\n <svg:rect x=\"-2\" y=\"-2\" width=\"24\" height=\"24\" fill=\"transparent\" style=\"cursor: pointer\" />\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]=\"state.workflowFormId ? '#D36CFF' : 'black'\" transform=\"scale(0.7)\" />\n </svg:g>\n <!-- Arrow from circle to node -->\n <path d=\"M -20 50 L 0 50\" stroke=\"#D36CFF\" stroke-width=\"1\" marker-end=\"url(#arrowhead)\"></path>\n }\n\n <!-- Exit point indicator (circle and arrow) -->\n @if (node.stageData?.IsExitPoint) {\n <!-- Arrow from node to circle -->\n <path [attr.d]=\"'M ' + node.width + ' 50 L ' + (node.width + 20) + ' 50'\" stroke=\"#D36CFF\" stroke-width=\"1\"\n marker-end=\"url(#arrowhead)\"></path>\n <!-- Circle -->\n <circle [attr.cx]=\"node.width + 50\" cy=\"50\" r=\"30\" fill=\"none\" stroke=\"#D36CFF\" stroke-width=\"2\"></circle>\n }\n\n <!-- Inner drag-handle: inset 12px so the node edge ring stays drag-free.\n Rendered BEFORE the node shapes/icons so the clickable icons paint on\n top of it and win pointer events; the node body still falls through to\n this handle because its shape/label use pointer-events:none.\n Connection point <use> elements are rendered after everything so they\n stay topmost and win pointer events at the node edges. -->\n <rect class=\"node-drag-handle\"\n [attr.x]=\"12\" [attr.y]=\"12\"\n [attr.width]=\"node.width - 24\" [attr.height]=\"node.height - 24\"\n fill=\"transparent\"\n [style.cursor]=\"getCursorForNode(node.id)\"\n (mousedown)=\"onNodeMouseDown($event, node, swimlane.order)\" />\n\n <!-- Stage node -->\n @if (node.type === 'stage') {\n <!-- <rect\n x=\"0\"\n y=\"0\"\n [attr.width]=\"node.width\"\n [attr.height]=\"node.height\"\n fill=\"none\"\n stroke=\"#D36CFF\"\n stroke-width=\"1\"\n ></rect> -->\n <svg:g lib-stage-node [node]=\"node\" [isStartNode]=\"node.isStartNode\"\n (stagePropertiesUpdated)=\"onStagePropertiesUpdated($event)\" (showShieldDialog)=\"onShowShieldDialog($event)\"\n (showEscalationDialog)=\"onShowEscalationDialog($event)\" (showFormDialog)=\"\n toggleStartNodeFormPopup($event, node.x, node.y, swimlane.order, node)\n \"></svg:g>\n }\n\n <!-- Decision node -->\n @if (node.type === 'decision') {\n <path [attr.d]=\"\n 'M 0 ' +\n node.height / 2 +\n ' L ' +\n node.width / 2 +\n ' 0' +\n ' L ' +\n node.width +\n ' ' +\n node.height / 2 +\n ' L ' +\n node.width / 2 +\n ' ' +\n node.height +\n ' Z'\n \" fill=\"none\" stroke=\"#D36CFF\" stroke-width=\"1\" style=\"pointer-events: none\"></path>\n\n <!-- Decision node condition indicator icon -->\n <svg:g (click)=\"showDecisionConditionsPopup($event, node, swimlane.order)\" class=\"decision-condition-icon\"\n [attr.transform]=\"\n 'translate(' +\n (node.width / 2 - 10) +\n ',' +\n (node.height / 2 - 10) +\n ')'\n \">\n <svg:rect x=\"-5\" y=\"-5\" width=\"30\" height=\"30\" fill=\"transparent\" style=\"cursor: pointer\" />\n <svg:path d=\"M10 0H20V2H10V0ZM10 8H20V10H10V8ZM10 4H20V6H10V4ZM0 0H8V2H0V0ZM0 8H8V10H0V8ZM0 4H8V6H0V4Z\"\n fill=\"#D36CFF\" />\n </svg:g>\n }\n\n <!-- Form node -->\n @if (node.type === 'form') {\n <path\n d=\"M95.0625 50.5591V95.0625C95.0625 97.9716 93.9069 100.762 91.8498 102.819C89.7928 104.876 87.0028 106.031 84.0938 106.031H32.9062C29.9972 106.031 27.2072 104.876 25.1502 102.819C23.0931 100.762 21.9375 97.9716 21.9375 95.0625V21.9375C21.9375 19.0284 23.0931 16.2385 25.1502 14.1814C27.2072 12.1244 29.9972 10.9688 32.9062 10.9688H55.4722C57.4109 10.969 59.2701 11.7392 60.6412 13.1099L92.9213 45.3901C94.292 46.7611 95.0622 48.6204 95.0625 50.5591Z\"\n transform=\"scale(0.7)\" fill=\"none\" stroke=\"#D36CFF\" stroke-linejoin=\"round\" style=\"pointer-events: none\" />\n <path\n d=\"M58.5 12.7969V40.2188C58.5 42.1581 59.2704 44.0181 60.6418 45.3895C62.0131 46.7608 63.8731 47.5312 65.8125 47.5312H93.2344\"\n transform=\"scale(0.7)\" stroke=\"#D36CFF\" stroke-linecap=\"round\" stroke-linejoin=\"round\" style=\"pointer-events: none\" />\n <text x=\"50%\" y=\"50%\" text-anchor=\"middle\" dominant-baseline=\"middle\" font-family=\"sans-serif\" font-size=\"14\"\n fill=\"#D36CFF\" style=\"pointer-events: none\">\n Form\n </text>\n }\n\n <!-- Subflow node -->\n @if (node.type === 'subflow') {\n <svg:g lib-stage-node [node]=\"node\" [isStartNode]=\"node.isStartNode\" [isSubflow]=\"true\"\n (stagePropertiesUpdated)=\"onStagePropertiesUpdated($event)\" (showShieldDialog)=\"onShowShieldDialog($event)\"\n (showEscalationDialog)=\"onShowEscalationDialog($event)\" (showFormDialog)=\"\n toggleStartNodeFormPopup($event, node.x, node.y, swimlane.order, node)\n \"></svg:g>\n }\n\n <!-- Connection points for this node (rendered last = topmost) -->\n @for (point of node.connectionPoints || []; track point.id) {\n @if (isConnectionPointVisible(node.id)) {\n <use class=\"connection-point\" [attr.href]=\"'#connection-point-template'\" [attr.x]=\"point.x\" [attr.y]=\"point.y\"\n [attr.id]=\"point.id\" (mousedown)=\"startConnectionDrag($event, point, swimlane.order)\" />\n }\n }\n </g>\n <!-- A transparent hover area for improved hover detection -->\n <rect [attr.x]=\"node.x - 10\" [attr.y]=\"node.y - 10\" [attr.width]=\"node.width + 20\" [attr.height]=\"node.height + 20\"\n fill=\"transparent\" (mouseover)=\"showConnectionPoints(node.id, swimlane.order)\"\n (mouseout)=\"hideConnectionPoints(node.id)\" style=\"pointer-events: none\" />\n } }\n\n <!-- Connections -->\n @for (connection of state.connections; track connection.id) {\n <g class=\"connection-element\">\n <path [attr.d]=\"getConnectionPathForSavedConnection(connection)\" stroke=\"#D36CFF\" stroke-width=\"2\" fill=\"none\"\n marker-end=\"url(#arrowhead)\"></path>\n\n <!-- Connection Label -->\n @if (connection.sourceNodeId && connection.targetNodeId) {\n <foreignObject [attr.x]=\"getLabelPosition(connection).x\" [attr.y]=\"getLabelPosition(connection).y\" width=\"150\"\n height=\"40\" style=\"overflow: visible; pointer-events: all;\" [attr.transform]=\"'translate(-75, -10)'\">\n <wf-label-editor [label]=\"connection.label || 'New Action'\" [x]=\"0\" [y]=\"0\" [isConnection]=\"true\"\n (labelChange)=\"saveConnectionLabel(connection, $event)\" (openDialog)=\"onShowActionDialog(connection)\" />\n </foreignObject>\n }\n </g>\n }\n\n <!-- Connection preview line -->\n @if (state.isConnectionDragging()) {\n <g>\n <path [attr.d]=\"getConnectionPath()\" stroke=\"#D36CFF\" stroke-width=\"2\" stroke-dasharray=\"5,5\" fill=\"none\"></path>\n </g>\n }\n </svg>\n\n <div *ngIf=\"popupVisible\" [style.position]=\"'absolute'\" [style.left.px]=\"popupX\" [style.top.px]=\"popupY\">\n <verben-pop-Up [dropdownOpen]=\"true\" [customStyles]=\"{ 'z-index': '99' }\" [enableMouseLeave]=\"false\"\n (dropdownOpenChange)=\"$event ? null : hideConnectionPopup()\">\n <div dropdown-trigger style=\"display: none\">\n <!-- Hidden trigger element -->\n </div>\n <div class=\"p-3 bg-white border border-gray-200 rounded shadow-md\" dropdown-content>\n <h4 class=\"mb-2 font-medium\">Create Connection</h4>\n <div class=\"flex flex-col gap-2\">\n <ng-container *ngFor=\"let type of allowedNodeTypes\">\n <button class=\"px-3 py-2 bg-white border border-gray-200 rounded text-sm hover:bg-gray-50\"\n (click)=\"createNodeConnection(type)\">\n Create {{ type | titlecase }}\n </button>\n </ng-container>\n <button class=\"px-3 py-2 bg-white border border-gray-200 rounded text-sm hover:bg-gray-50\"\n (click)=\"hideConnectionPopup()\">\n Cancel\n </button>\n </div>\n </div>\n </verben-pop-Up>\n </div>\n\n <div *ngIf=\"showStartNodeFormPopup\" [style.position]=\"'absolute'\" [style.left.px]=\"startNodeFormPopupX\"\n [style.top.px]=\"startNodeFormPopupY\">\n <verben-pop-Up [dropdownOpen]=\"true\" [customStyles]=\"{ 'z-index': '100' }\">\n <div dropdown-trigger style=\"display: none\">\n <!-- Hidden trigger element -->\n </div>\n <div class=\"p-3 bg-white border border-gray-200 rounded shadow-md w-64\" dropdown-content\n style=\"background-color: white; z-index: 1000\">\n <h4 class=\"mb-2 font-medium\">Select Workflow Form</h4>\n <div *ngIf=\"isLoadingStartNodeForms\" class=\"text-center py-2\">\n Loading forms...\n </div>\n <div *ngIf=\"!isLoadingStartNodeForms\" class=\"max-h-48 overflow-y-auto\" style=\"max-height: 192px; overflow-y: auto;\">\n <div class=\"mb-3\">\n <button\n class=\"w-full px-3 py-2 bg-gray-50 border border-gray-200 rounded text-sm hover:bg-gray-50 text-left\"\n (click)=\"selectStartNodeForm(null)\">\n Clear form selection\n </button>\n </div>\n <div *ngFor=\"let form of startNodeFormsList\" class=\"mb-1\">\n <button class=\"w-full px-3 py-2 bg-white border border-gray-200 rounded text-sm hover:bg-gray-50 text-left\"\n [ngClass]=\"{ 'bg-blue-50 !border-blue-500 !border-2 font-semibold': form?.Code === activeNodeForFormSelection?.stageData?.formId}\"\n (click)=\"selectStartNodeForm(form)\">\n {{ form.Name }}\n </button>\n </div>\n <div *ngIf=\"startNodeFormsList.length === 0\" class=\"text-center py-2 text-gray-500\">\n No forms available\n </div>\n </div>\n </div>\n </verben-pop-Up>\n </div>\n\n <div *ngIf=\"showSubflowPopup\" [style.position]=\"'absolute'\" [style.left.px]=\"subflowPopupX\"\n [style.top.px]=\"subflowPopupY\">\n <verben-pop-Up [dropdownOpen]=\"true\" [customStyles]=\"{ 'z-index': '100' }\">\n <div dropdown-trigger style=\"display: none\">\n <!-- Hidden trigger element -->\n </div>\n <div class=\"p-3 bg-white border border-gray-200 rounded shadow-md w-64\" dropdown-content\n style=\"background-color: white; z-index: 1000\">\n <h4 class=\"mb-2 font-medium\">Select Workflow</h4>\n <div *ngIf=\"isLoadingWorkflows\" class=\"text-center py-2\">\n Loading workflows...\n </div>\n <div *ngIf=\"!isLoadingWorkflows\" class=\"max-h-48 overflow-y-auto\" style=\"max-height: 192px; overflow-y: auto;\">\n <div *ngFor=\"let workflow of workflowsList\" class=\"mb-1\">\n <button class=\"w-full px-3 py-2 bg-white border border-gray-200 rounded text-sm hover:bg-gray-50 text-left\"\n (click)=\"selectSubflowWorkflow(workflow)\">\n {{ workflow.Name }}\n </button>\n </div>\n <div *ngIf=\"workflowsList.length === 0\" class=\"text-center py-2 text-gray-500\">\n No workflows available\n </div>\n </div>\n </div>\n </verben-pop-Up>\n </div>\n\n <lib-conditions-popup [visible]=\"showDecisionConditionDialog\" [decisionNodeId]=\"activeDecisionNodeId\"\n [newConnectionId]=\"activeConnectionId\" [popupX]=\"decisionConditionPopupX\" [popupY]=\"decisionConditionPopupY\"\n (closed)=\"onDecisionConditionCancelled()\" (saved)=\"onDecisionConditionSaved($event)\"></lib-conditions-popup>\n\n <!-- <lib-decision-popup\n [visible]=\"showConditionsDialog\"\n [decisionNodeId]=\"activeDecisionNodeId\"\n [popupX]=\"decisionConditionPopupX\"\n [popupY]=\"decisionConditionPopupY\"\n (closed)=\"onDecisionConditionCancelled()\"\n ></lib-decision-popup> -->\n\n <lib-stage-dialog [visible]=\"showStageDialogLocal\" [stageData]=\"activeStageData || {}\"\n (closed)=\"onStageDialogClosed()\" (saved)=\"onStageDialogSaved($event)\"></lib-stage-dialog>\n\n <lib-action-dialog [visible]=\"showActionDialogLocal\" [actionData]=\"activeActionData\" (closed)=\"onActionDialogClosed()\"\n (saved)=\"onActionDialogSaved($event)\" (deleted)=\"onActionDialogDeleted($event)\"></lib-action-dialog>\n\n\n <lib-escalation-dialog [visible]=\"showEscalationDialogLocal\" [type]=\"activeEscalationType()!\"\n [stageCode]=\"activeStageCode() || ''\" [workflowCode]=\"state.workflow?.Code || ''\"\n (closed)=\"onEscalationDialogClosed()\"></lib-escalation-dialog>\n</div>\n", styles: [".canvas-container{flex:1;overflow:auto;background-color:#fff}.designer-canvas{min-width:100%;min-height:100%;cursor:default}.designer-canvas:focus{outline:none}.edit-swimlane-button{cursor:pointer}.edit-swimlane-button:hover rect{fill:#ddd6fe}.decision-condition-icon{cursor:pointer}.decision-condition-icon:hover path{fill:#c084fc}.swimlane-label{z-index:10;cursor:default}.plus-icon:hover{fill:#d36cff}.swimlane-container{pointer-events:none}.swimlane-container>*{pointer-events:auto}.node-element{z-index:10}.connection-element{z-index:5}.node-drag-handle{pointer-events:all;-webkit-user-select:none;user-select:none}.connection-point{cursor:crosshair}\n"], dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i5.VerbenPopUpComponent, selector: "verben-pop-Up", inputs: ["dropdownOpen", "dropdownWidth", "color", "customStyles", "popUpClass", "border", "borderRadius", "enableMouseLeave", "cdkPosition"], outputs: ["dropdownOpenChange", "close"] }, { kind: "component", type: i5$1.LabelEditorComponent, selector: "wf-label-editor", inputs: ["label", "x", "y", "isConnection", "isSwimlane"], outputs: ["labelChange", "openDialog"] }, { kind: "component", type: StageNodeComponent, selector: "svg:g[lib-stage-node]", inputs: ["node", "isStartNode", "isSubflow", "stageData"], outputs: ["stagePropertiesUpdated", "parallelExecutionToggled", "showShieldDialog", "showEscalationDialog", "showFormDialog"] }, { kind: "component", type: StageDialogComponent, selector: "lib-stage-dialog", inputs: ["visible", "stageData"], outputs: ["closed", "saved"] }, { kind: "component", type: ConditionsPopupComponent, selector: "lib-conditions-popup", inputs: ["visible", "decisionNodeId", "newConnectionId", "popupX", "popupY"], outputs: ["closed", "saved"] }, { kind: "component", type: EscalationDialogComponent, selector: "lib-escalation-dialog", inputs: ["visible", "workflowCode", "stageCode", "type"], outputs: ["closed", "created"] }, { kind: "component", type: ActionDialogComponent, selector: "lib-action-dialog", inputs: ["visible", "actionData"], outputs: ["closed", "saved", "deleted"] }, { kind: "pipe", type: i3.TitleCasePipe, name: "titlecase" }] });
|
|
4483
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: DesignerCanvasComponent, selector: "lib-designer-canvas", inputs: { selectedTool: "selectedTool" }, outputs: { clickedPosition: "clickedPosition", subflowSelected: "subflowSelected", stagePropertiesUpdated: "stagePropertiesUpdated", actionPropertiesUpdated: "actionPropertiesUpdated" }, host: { listeners: { "window:mouseup": "onWindowMouseUp($event)" } }, viewQueries: [{ propertyName: "canvasRef", first: true, predicate: ["canvas"], descendants: true, static: true }], ngImport: i0, template: "<div class=\"canvas-container\">\n <svg #canvas [attr.width]=\"canvasWidth\" [attr.height]=\"canvasHeight\" class=\"designer-canvas\"\n (click)=\"onCanvasClick($event)\">\n <defs>\n <!-- Grid pattern definition -->\n\n <pattern id=\"grid\" [attr.width]=\"gridSize\" [attr.height]=\"gridSize\" patternUnits=\"userSpaceOnUse\">\n <path d=\"M 20 0 L 0 0 0 20\" fill=\"none\" stroke=\"#e2e8f0\" stroke-width=\"0.5\" />\n </pattern>\n\n <!-- Arrow head marker definition -->\n <marker id=\"arrowhead\" markerWidth=\"10\" markerHeight=\"7\" refX=\"9\" refY=\"3.5\" orient=\"auto\">\n <polygon points=\"0 0, 10 3.5, 0 7\" fill=\"#D36CFF\" />\n </marker>\n\n <!-- Connection point: outer transparent ring expands the hit target so a\n connection drag can be started without pixel-precise aim. The visible\n circle stays at r=5. The hit ring extends inward up to the node's\n drag-handle edge so clicks near the edge fall to the connection point\n (rendered topmost) rather than to the drag handle beneath. -->\n <g id=\"connection-point-template\">\n <circle r=\"12\" fill=\"transparent\" />\n <circle r=\"5\" fill=\"#D36CFF\" stroke=\"#FFFFFF\" stroke-width=\"1\" />\n </g>\n\n <!-- Dashed line style for connection preview -->\n <pattern id=\"dashed-line\" width=\"10\" height=\"10\" patternUnits=\"userSpaceOnUse\">\n <line x1=\"0\" y1=\"5\" x2=\"10\" y2=\"5\" stroke=\"#D36CFF\" stroke-width=\"2\" stroke-dasharray=\"5,5\" />\n </pattern>\n\n @for (swimlane of state.swimlanes; track swimlane.order) {\n <clipPath [attr.id]=\"'swimlane-clip-' + swimlane.order\">\n <rect x=\"0\" y=\"0\" [attr.width]=\"canvasWidth\" height=\"263\" />\n </clipPath>\n }\n </defs>\n\n <!-- Background grid -->\n <rect width=\"100%\" height=\"100%\" fill=\"url(#grid)\" />\n\n <!-- Display a message when no swimlanes exist -->\n @if (state.swimlanes.length === 0) {\n <text x=\"50%\" y=\"50%\" font-family=\"sans-serif\" font-size=\"16\" fill=\"#94a3b8\" text-anchor=\"middle\">\n Select the Swimlane tool and click on the canvas to add a swimlane\n </text>\n }\n\n <!-- This is where workflow elements will be added later -->\n @for (swimlane of state.swimlanes; track swimlane.order) {\n <!-- <g\n [attr.transform]=\"'translate(0,' + swimlane.order * 263 + ')'\"\n [attr.clip-path]=\"'url(#swimlane-clip-' + swimlane.order + ')'\"\n >\n <rect\n x=\"0\"\n y=\"0\"\n [attr.width]=\"canvasWidth\"\n [attr.height]=\"263\"\n fill=\"#ffffff\"\n stroke=\"#e2e8f0\"\n stroke-width=\"1\"\n ></rect>\n\n <rect\n x=\"0\"\n y=\"0\"\n [attr.width]=\"canvasWidth\"\n height=\"40\"\n fill=\"#f8fafc\"\n stroke=\"#e2e8f0\"\n stroke-width=\"1\"\n ></rect>\n\n <text\n x=\"20\"\n y=\"25\"\n font-family=\"sans-serif\"\n font-size=\"14\"\n fill=\"#333333\"\n font-weight=\"bold\"\n >\n {{ swimlane.label }}\n </text>\n\n <g\n class=\"edit-swimlane-button\"\n [attr.transform]=\"'translate(100, 20)'\"\n (click)=\"\n onEditSwimlane($event, swimlane, swimlane.order);\n $event.stopPropagation()\n \"\n >\n <rect\n x=\"-5\"\n y=\"-15\"\n width=\"40\"\n height=\"20\"\n fill=\"#f3e8ff\"\n rx=\"3\"\n ry=\"3\"\n stroke=\"#d8b4fe\"\n stroke-width=\"1\"\n ></rect>\n <text\n x=\"15\"\n y=\"0\"\n font-family=\"sans-serif\"\n font-size=\"12\"\n fill=\"#7e22ce\"\n text-anchor=\"middle\"\n >\n Edit\n </text>\n </g>\n\n <g [attr.transform]=\"'translate(200, 20)'\">\n @for (tag of swimlane.tags.slice(0, 3); track tag.Name; let i = $index)\n {\n <text\n [attr.x]=\"i * 100\"\n y=\"5\"\n font-family=\"sans-serif\"\n font-size=\"12\"\n fill=\"#666666\"\n >\n {{ tag.Name }}\n </text>\n } @if (swimlane.tags.length > 3) {\n <text\n [attr.x]=\"3 * 100 + 10\"\n y=\"5\"\n font-family=\"sans-serif\"\n font-size=\"12\"\n fill=\"#666666\"\n >\n +{{ swimlane.tags.length - 3 }} more\n </text>\n }\n </g>\n </g> -->\n\n <g [attr.transform]=\"'translate(0,' + swimlane.order * 263 + ')'\">\n <!-- Swimlane container - remove stroke to make it purely background -->\n <rect x=\"0\" y=\"0\" [attr.width]=\"canvasWidth\" [attr.height]=\"263\"\n [attr.fill]=\"swimlane.order % 2 === 0 ? '#FCF3FF' : '#ECFFF5'\" stroke=\"none\"></rect>\n\n <!-- Vertical swimlane label on the left -->\n <g class=\"swimlane-label\">\n <!-- Purple background for the label -->\n <rect x=\"0.5\" y=\"0.5\" width=\"43\" height=\"215\" rx=\"10.5\" fill=\"white\" stroke=\"#D36CFF\"></rect>\n\n <!-- Plus button at the top -->\n <g (click)=\"\n onEditSwimlane($event, swimlane, swimlane.order);\n $event.stopPropagation()\n \">\n <rect x=\"12.5\" y=\"10\" width=\"18\" height=\"18\" fill=\"transparent\" style=\"cursor: pointer\"></rect>\n\n <path d=\"M22.52 12.174V17.08H27.47V18.51H22.52V23.394H21.2V18.51H16.25V17.08H21.2V12.174H22.52Z\"\n fill=\"#0000FF\" class=\"plus-icon\" style=\"cursor: pointer\"></path>\n </g>\n\n <!-- Swimlane label -->\n <text x=\"22\" y=\"106\" font-family=\"sans-serif\" font-size=\"14\" fill=\"#333333\" text-anchor=\"middle\"\n transform=\"rotate(-90, 22, 100)\">\n {{\n swimlane.label.length > 12\n ? swimlane.label.substring(0, 10) + \"...\"\n : swimlane.label\n }}\n </text>\n\n <!-- Tag count indicator at the bottom -->\n <rect x=\"11.5\" y=\"187\" width=\"21\" height=\"19\" rx=\"9.5\" fill=\"#9E9E9E\"></rect>\n <text x=\"24\" y=\"206\" font-family=\"sans-serif\" font-size=\"12\" fill=\"black\" text-anchor=\"middle\"\n transform=\"rotate(-90, 22, 200)\">\n {{ swimlane.tags.length }}\n </text>\n </g>\n </g>\n\n }\n\n <!-- Nodes -->\n @for (swimlane of state.swimlanes; track swimlane.order) {\n <!-- Render nodes in this swimlane -->\n @for (node of swimlane.nodes; track node.id) {\n <g class=\"node-element\" [attr.transform]=\"\n 'translate(' + node.x + ',' + (node.y + swimlane.order * 263) + ')'\"\n (mouseenter)=\"showConnectionPoints(node.id, swimlane.order)\"\n (mouseleave)=\"hideConnectionPoints(node.id)\">\n <!-- Start node indicator (circle and arrow) for the first node -->\n @if (node.isStartNode) {\n <!-- Circle -->\n <circle cx=\"-50\" cy=\"50\" r=\"30\" fill=\"none\" stroke=\"#D36CFF\" stroke-width=\"1\"></circle>\n <!-- Form icon for start node -->\n <svg:g (click)=\"\n toggleStartNodeFormPopup($event, node.x, node.y, swimlane.order)\n \" class=\"stage-icon\" transform=\"translate(-45, 42)\" style=\"cursor: pointer; pointer-events: all\">\n <!-- Transparent rectangle to capture clicks -->\n <svg:rect x=\"-2\" y=\"-2\" width=\"24\" height=\"24\" fill=\"transparent\" style=\"cursor: pointer\" />\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]=\"state.workflowFormId ? '#D36CFF' : 'black'\" transform=\"scale(0.7)\" />\n </svg:g>\n <!-- Arrow from circle to node -->\n <path d=\"M -20 50 L 0 50\" stroke=\"#D36CFF\" stroke-width=\"1\" marker-end=\"url(#arrowhead)\"></path>\n }\n\n <!-- Exit point indicator (circle and arrow) -->\n @if (node.stageData?.IsExitPoint) {\n <!-- Arrow from node to circle -->\n <path [attr.d]=\"'M ' + node.width + ' 50 L ' + (node.width + 20) + ' 50'\" stroke=\"#D36CFF\" stroke-width=\"1\"\n marker-end=\"url(#arrowhead)\"></path>\n <!-- Circle -->\n <circle [attr.cx]=\"node.width + 50\" cy=\"50\" r=\"30\" fill=\"none\" stroke=\"#D36CFF\" stroke-width=\"2\"></circle>\n }\n\n <!-- Inner drag-handle: inset 12px so the node edge ring stays drag-free.\n Rendered BEFORE the node shapes/icons so the clickable icons paint on\n top of it and win pointer events; the node body still falls through to\n this handle because its shape/label use pointer-events:none.\n Connection point <use> elements are rendered after everything so they\n stay topmost and win pointer events at the node edges. -->\n <rect class=\"node-drag-handle\"\n [attr.x]=\"12\" [attr.y]=\"12\"\n [attr.width]=\"node.width - 24\" [attr.height]=\"node.height - 24\"\n fill=\"transparent\"\n [style.cursor]=\"getCursorForNode(node.id)\"\n (mousedown)=\"onNodeMouseDown($event, node, swimlane.order)\" />\n\n <!-- Stage node -->\n @if (node.type === 'stage') {\n <!-- <rect\n x=\"0\"\n y=\"0\"\n [attr.width]=\"node.width\"\n [attr.height]=\"node.height\"\n fill=\"none\"\n stroke=\"#D36CFF\"\n stroke-width=\"1\"\n ></rect> -->\n <svg:g lib-stage-node [node]=\"node\" [isStartNode]=\"node.isStartNode\"\n (stagePropertiesUpdated)=\"onStagePropertiesUpdated($event)\" (showShieldDialog)=\"onShowShieldDialog($event)\"\n (showEscalationDialog)=\"onShowEscalationDialog($event)\" (showFormDialog)=\"\n toggleStartNodeFormPopup($event, node.x, node.y, swimlane.order, node)\n \"></svg:g>\n }\n\n <!-- Decision node -->\n @if (node.type === 'decision') {\n <path [attr.d]=\"\n 'M 0 ' +\n node.height / 2 +\n ' L ' +\n node.width / 2 +\n ' 0' +\n ' L ' +\n node.width +\n ' ' +\n node.height / 2 +\n ' L ' +\n node.width / 2 +\n ' ' +\n node.height +\n ' Z'\n \" fill=\"none\" stroke=\"#D36CFF\" stroke-width=\"1\" style=\"pointer-events: none\"></path>\n\n <!-- Decision node condition indicator icon -->\n <svg:g (click)=\"showDecisionConditionsPopup($event, node, swimlane.order)\" class=\"decision-condition-icon\"\n [attr.transform]=\"\n 'translate(' +\n (node.width / 2 - 10) +\n ',' +\n (node.height / 2 - 10) +\n ')'\n \">\n <svg:rect x=\"-5\" y=\"-5\" width=\"30\" height=\"30\" fill=\"transparent\" style=\"cursor: pointer\" />\n <svg:path d=\"M10 0H20V2H10V0ZM10 8H20V10H10V8ZM10 4H20V6H10V4ZM0 0H8V2H0V0ZM0 8H8V10H0V8ZM0 4H8V6H0V4Z\"\n fill=\"#D36CFF\" />\n </svg:g>\n }\n\n <!-- Form node -->\n @if (node.type === 'form') {\n <path\n d=\"M95.0625 50.5591V95.0625C95.0625 97.9716 93.9069 100.762 91.8498 102.819C89.7928 104.876 87.0028 106.031 84.0938 106.031H32.9062C29.9972 106.031 27.2072 104.876 25.1502 102.819C23.0931 100.762 21.9375 97.9716 21.9375 95.0625V21.9375C21.9375 19.0284 23.0931 16.2385 25.1502 14.1814C27.2072 12.1244 29.9972 10.9688 32.9062 10.9688H55.4722C57.4109 10.969 59.2701 11.7392 60.6412 13.1099L92.9213 45.3901C94.292 46.7611 95.0622 48.6204 95.0625 50.5591Z\"\n transform=\"scale(0.7)\" fill=\"none\" stroke=\"#D36CFF\" stroke-linejoin=\"round\" style=\"pointer-events: none\" />\n <path\n d=\"M58.5 12.7969V40.2188C58.5 42.1581 59.2704 44.0181 60.6418 45.3895C62.0131 46.7608 63.8731 47.5312 65.8125 47.5312H93.2344\"\n transform=\"scale(0.7)\" stroke=\"#D36CFF\" stroke-linecap=\"round\" stroke-linejoin=\"round\" style=\"pointer-events: none\" />\n <text x=\"50%\" y=\"50%\" text-anchor=\"middle\" dominant-baseline=\"middle\" font-family=\"sans-serif\" font-size=\"14\"\n fill=\"#D36CFF\" style=\"pointer-events: none\">\n Form\n </text>\n }\n\n <!-- Subflow node -->\n @if (node.type === 'subflow') {\n <svg:g lib-stage-node [node]=\"node\" [isStartNode]=\"node.isStartNode\" [isSubflow]=\"true\"\n (stagePropertiesUpdated)=\"onStagePropertiesUpdated($event)\" (showShieldDialog)=\"onShowShieldDialog($event)\"\n (showEscalationDialog)=\"onShowEscalationDialog($event)\" (showFormDialog)=\"\n toggleStartNodeFormPopup($event, node.x, node.y, swimlane.order, node)\n \"></svg:g>\n }\n\n <!-- Connection points for this node (rendered last = topmost) -->\n @for (point of node.connectionPoints || []; track point.id) {\n @if (isConnectionPointVisible(node.id)) {\n <use class=\"connection-point\" [attr.href]=\"'#connection-point-template'\" [attr.x]=\"point.x\" [attr.y]=\"point.y\"\n [attr.id]=\"point.id\" (mousedown)=\"startConnectionDrag($event, point, swimlane.order)\" />\n }\n }\n </g>\n <!-- A transparent hover area for improved hover detection -->\n <rect [attr.x]=\"node.x - 10\" [attr.y]=\"node.y - 10\" [attr.width]=\"node.width + 20\" [attr.height]=\"node.height + 20\"\n fill=\"transparent\" (mouseover)=\"showConnectionPoints(node.id, swimlane.order)\"\n (mouseout)=\"hideConnectionPoints(node.id)\" style=\"pointer-events: none\" />\n } }\n\n <!-- Connections -->\n @for (connection of state.connections; track connection.id) {\n <g class=\"connection-element\">\n <path [attr.d]=\"getConnectionPathForSavedConnection(connection)\" stroke=\"#D36CFF\" stroke-width=\"2\" fill=\"none\"\n marker-end=\"url(#arrowhead)\"></path>\n\n <!-- Connection Label -->\n @if (connection.sourceNodeId && connection.targetNodeId) {\n <foreignObject [attr.x]=\"getLabelPosition(connection).x\" [attr.y]=\"getLabelPosition(connection).y\" width=\"150\"\n height=\"40\" style=\"overflow: visible; pointer-events: all;\" [attr.transform]=\"'translate(-75, -10)'\">\n <wf-label-editor [label]=\"connection.label || 'New Action'\" [x]=\"0\" [y]=\"0\" [isConnection]=\"true\"\n [hasForm]=\"!!(connection.form && connection.form.trim().length > 0)\"\n (labelChange)=\"saveConnectionLabel(connection, $event)\" (openDialog)=\"onShowActionDialog(connection)\" />\n </foreignObject>\n }\n </g>\n }\n\n <!-- Connection preview line -->\n @if (state.isConnectionDragging()) {\n <g>\n <path [attr.d]=\"getConnectionPath()\" stroke=\"#D36CFF\" stroke-width=\"2\" stroke-dasharray=\"5,5\" fill=\"none\"></path>\n </g>\n }\n </svg>\n\n <div *ngIf=\"popupVisible\" [style.position]=\"'absolute'\" [style.left.px]=\"popupX\" [style.top.px]=\"popupY\">\n <verben-pop-Up [dropdownOpen]=\"true\" [customStyles]=\"{ 'z-index': '99' }\" [enableMouseLeave]=\"false\"\n (dropdownOpenChange)=\"$event ? null : hideConnectionPopup()\">\n <div dropdown-trigger style=\"display: none\">\n <!-- Hidden trigger element -->\n </div>\n <div class=\"p-3 bg-white border border-gray-200 rounded shadow-md\" dropdown-content>\n <h4 class=\"mb-2 font-medium\">Create Connection</h4>\n <div class=\"flex flex-col gap-2\">\n <ng-container *ngFor=\"let type of allowedNodeTypes\">\n <button class=\"px-3 py-2 bg-white border border-gray-200 rounded text-sm hover:bg-gray-50\"\n (click)=\"createNodeConnection(type)\">\n Create {{ type | titlecase }}\n </button>\n </ng-container>\n <button class=\"px-3 py-2 bg-white border border-gray-200 rounded text-sm hover:bg-gray-50\"\n (click)=\"hideConnectionPopup()\">\n Cancel\n </button>\n </div>\n </div>\n </verben-pop-Up>\n </div>\n\n <div *ngIf=\"showStartNodeFormPopup\" [style.position]=\"'absolute'\" [style.left.px]=\"startNodeFormPopupX\"\n [style.top.px]=\"startNodeFormPopupY\">\n <verben-pop-Up [dropdownOpen]=\"true\" [customStyles]=\"{ 'z-index': '100' }\">\n <div dropdown-trigger style=\"display: none\">\n <!-- Hidden trigger element -->\n </div>\n <div class=\"p-3 bg-white border border-gray-200 rounded shadow-md w-64\" dropdown-content\n style=\"background-color: white; z-index: 1000\">\n <h4 class=\"mb-2 font-medium\">Select Workflow Form</h4>\n <div *ngIf=\"isLoadingStartNodeForms\" class=\"text-center py-2\">\n Loading forms...\n </div>\n <div *ngIf=\"!isLoadingStartNodeForms\" class=\"max-h-48 overflow-y-auto\" style=\"max-height: 192px; overflow-y: auto;\">\n <div class=\"mb-3\">\n <button\n class=\"w-full px-3 py-2 bg-gray-50 border border-gray-200 rounded text-sm hover:bg-gray-50 text-left\"\n (click)=\"selectStartNodeForm(null)\">\n Clear form selection\n </button>\n </div>\n <div *ngFor=\"let form of startNodeFormsList\" class=\"mb-1\">\n <button class=\"w-full px-3 py-2 bg-white border border-gray-200 rounded text-sm hover:bg-gray-50 text-left\"\n [ngClass]=\"{ 'bg-blue-50 !border-blue-500 !border-2 font-semibold': form?.Code === activeNodeForFormSelection?.stageData?.formId}\"\n (click)=\"selectStartNodeForm(form)\">\n {{ form.Name }}\n </button>\n </div>\n <div *ngIf=\"startNodeFormsList.length === 0\" class=\"text-center py-2 text-gray-500\">\n No forms available\n </div>\n </div>\n </div>\n </verben-pop-Up>\n </div>\n\n <div *ngIf=\"showSubflowPopup\" [style.position]=\"'absolute'\" [style.left.px]=\"subflowPopupX\"\n [style.top.px]=\"subflowPopupY\">\n <verben-pop-Up [dropdownOpen]=\"true\" [customStyles]=\"{ 'z-index': '100' }\">\n <div dropdown-trigger style=\"display: none\">\n <!-- Hidden trigger element -->\n </div>\n <div class=\"p-3 bg-white border border-gray-200 rounded shadow-md w-64\" dropdown-content\n style=\"background-color: white; z-index: 1000\">\n <h4 class=\"mb-2 font-medium\">Select Workflow</h4>\n <div *ngIf=\"isLoadingWorkflows\" class=\"text-center py-2\">\n Loading workflows...\n </div>\n <div *ngIf=\"!isLoadingWorkflows\" class=\"max-h-48 overflow-y-auto\" style=\"max-height: 192px; overflow-y: auto;\">\n <div *ngFor=\"let workflow of workflowsList\" class=\"mb-1\">\n <button class=\"w-full px-3 py-2 bg-white border border-gray-200 rounded text-sm hover:bg-gray-50 text-left\"\n (click)=\"selectSubflowWorkflow(workflow)\">\n {{ workflow.Name }}\n </button>\n </div>\n <div *ngIf=\"workflowsList.length === 0\" class=\"text-center py-2 text-gray-500\">\n No workflows available\n </div>\n </div>\n </div>\n </verben-pop-Up>\n </div>\n\n <lib-conditions-popup [visible]=\"showDecisionConditionDialog\" [decisionNodeId]=\"activeDecisionNodeId\"\n [newConnectionId]=\"activeConnectionId\" [popupX]=\"decisionConditionPopupX\" [popupY]=\"decisionConditionPopupY\"\n (closed)=\"onDecisionConditionCancelled()\" (saved)=\"onDecisionConditionSaved($event)\"></lib-conditions-popup>\n\n <!-- <lib-decision-popup\n [visible]=\"showConditionsDialog\"\n [decisionNodeId]=\"activeDecisionNodeId\"\n [popupX]=\"decisionConditionPopupX\"\n [popupY]=\"decisionConditionPopupY\"\n (closed)=\"onDecisionConditionCancelled()\"\n ></lib-decision-popup> -->\n\n <lib-stage-dialog [visible]=\"showStageDialogLocal\" [stageData]=\"activeStageData || {}\"\n (closed)=\"onStageDialogClosed()\" (saved)=\"onStageDialogSaved($event)\"></lib-stage-dialog>\n\n <lib-action-dialog [visible]=\"showActionDialogLocal\" [actionData]=\"activeActionData\" (closed)=\"onActionDialogClosed()\"\n (saved)=\"onActionDialogSaved($event)\" (deleted)=\"onActionDialogDeleted($event)\"></lib-action-dialog>\n\n\n <lib-escalation-dialog [visible]=\"showEscalationDialogLocal\" [type]=\"activeEscalationType()!\"\n [stageCode]=\"activeStageCode() || ''\" [workflowCode]=\"state.workflow?.Code || ''\"\n (closed)=\"onEscalationDialogClosed()\"></lib-escalation-dialog>\n</div>\n", styles: [".canvas-container{flex:1;overflow:auto;background-color:#fff}.designer-canvas{min-width:100%;min-height:100%;cursor:default}.designer-canvas:focus{outline:none}.edit-swimlane-button{cursor:pointer}.edit-swimlane-button:hover rect{fill:#ddd6fe}.decision-condition-icon{cursor:pointer}.decision-condition-icon:hover path{fill:#c084fc}.swimlane-label{z-index:10;cursor:default}.plus-icon:hover{fill:#d36cff}.swimlane-container{pointer-events:none}.swimlane-container>*{pointer-events:auto}.node-element{z-index:10}.connection-element{z-index:5}.node-drag-handle{pointer-events:all;-webkit-user-select:none;user-select:none}.connection-point{cursor:crosshair}\n"], dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i5.VerbenPopUpComponent, selector: "verben-pop-Up", inputs: ["dropdownOpen", "dropdownWidth", "color", "customStyles", "popUpClass", "border", "borderRadius", "enableMouseLeave", "cdkPosition"], outputs: ["dropdownOpenChange", "close"] }, { kind: "component", type: i5$1.LabelEditorComponent, selector: "wf-label-editor", inputs: ["label", "x", "y", "isConnection", "hasForm", "isSwimlane"], outputs: ["labelChange", "openDialog"] }, { kind: "component", type: StageNodeComponent, selector: "svg:g[lib-stage-node]", inputs: ["node", "isStartNode", "isSubflow", "stageData"], outputs: ["stagePropertiesUpdated", "parallelExecutionToggled", "showShieldDialog", "showEscalationDialog", "showFormDialog"] }, { kind: "component", type: StageDialogComponent, selector: "lib-stage-dialog", inputs: ["visible", "stageData"], outputs: ["closed", "saved"] }, { kind: "component", type: ConditionsPopupComponent, selector: "lib-conditions-popup", inputs: ["visible", "decisionNodeId", "newConnectionId", "popupX", "popupY"], outputs: ["closed", "saved"] }, { kind: "component", type: EscalationDialogComponent, selector: "lib-escalation-dialog", inputs: ["visible", "workflowCode", "stageCode", "type"], outputs: ["closed", "created"] }, { kind: "component", type: ActionDialogComponent, selector: "lib-action-dialog", inputs: ["visible", "actionData"], outputs: ["closed", "saved", "deleted"] }, { kind: "pipe", type: i3.TitleCasePipe, name: "titlecase" }] });
|
|
4032
4484
|
}
|
|
4033
4485
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: DesignerCanvasComponent, decorators: [{
|
|
4034
4486
|
type: Component,
|
|
4035
|
-
args: [{ selector: 'lib-designer-canvas', template: "<div class=\"canvas-container\">\n <svg #canvas [attr.width]=\"canvasWidth\" [attr.height]=\"canvasHeight\" class=\"designer-canvas\"\n (click)=\"onCanvasClick($event)\">\n <defs>\n <!-- Grid pattern definition -->\n\n <pattern id=\"grid\" [attr.width]=\"gridSize\" [attr.height]=\"gridSize\" patternUnits=\"userSpaceOnUse\">\n <path d=\"M 20 0 L 0 0 0 20\" fill=\"none\" stroke=\"#e2e8f0\" stroke-width=\"0.5\" />\n </pattern>\n\n <!-- Arrow head marker definition -->\n <marker id=\"arrowhead\" markerWidth=\"10\" markerHeight=\"7\" refX=\"9\" refY=\"3.5\" orient=\"auto\">\n <polygon points=\"0 0, 10 3.5, 0 7\" fill=\"#D36CFF\" />\n </marker>\n\n <!-- Connection point: outer transparent ring expands the hit target so a\n connection drag can be started without pixel-precise aim. The visible\n circle stays at r=5. The hit ring extends inward up to the node's\n drag-handle edge so clicks near the edge fall to the connection point\n (rendered topmost) rather than to the drag handle beneath. -->\n <g id=\"connection-point-template\">\n <circle r=\"12\" fill=\"transparent\" />\n <circle r=\"5\" fill=\"#D36CFF\" stroke=\"#FFFFFF\" stroke-width=\"1\" />\n </g>\n\n <!-- Dashed line style for connection preview -->\n <pattern id=\"dashed-line\" width=\"10\" height=\"10\" patternUnits=\"userSpaceOnUse\">\n <line x1=\"0\" y1=\"5\" x2=\"10\" y2=\"5\" stroke=\"#D36CFF\" stroke-width=\"2\" stroke-dasharray=\"5,5\" />\n </pattern>\n\n @for (swimlane of state.swimlanes; track swimlane.order) {\n <clipPath [attr.id]=\"'swimlane-clip-' + swimlane.order\">\n <rect x=\"0\" y=\"0\" [attr.width]=\"canvasWidth\" height=\"263\" />\n </clipPath>\n }\n </defs>\n\n <!-- Background grid -->\n <rect width=\"100%\" height=\"100%\" fill=\"url(#grid)\" />\n\n <!-- Display a message when no swimlanes exist -->\n @if (state.swimlanes.length === 0) {\n <text x=\"50%\" y=\"50%\" font-family=\"sans-serif\" font-size=\"16\" fill=\"#94a3b8\" text-anchor=\"middle\">\n Select the Swimlane tool and click on the canvas to add a swimlane\n </text>\n }\n\n <!-- This is where workflow elements will be added later -->\n @for (swimlane of state.swimlanes; track swimlane.order) {\n <!-- <g\n [attr.transform]=\"'translate(0,' + swimlane.order * 263 + ')'\"\n [attr.clip-path]=\"'url(#swimlane-clip-' + swimlane.order + ')'\"\n >\n <rect\n x=\"0\"\n y=\"0\"\n [attr.width]=\"canvasWidth\"\n [attr.height]=\"263\"\n fill=\"#ffffff\"\n stroke=\"#e2e8f0\"\n stroke-width=\"1\"\n ></rect>\n\n <rect\n x=\"0\"\n y=\"0\"\n [attr.width]=\"canvasWidth\"\n height=\"40\"\n fill=\"#f8fafc\"\n stroke=\"#e2e8f0\"\n stroke-width=\"1\"\n ></rect>\n\n <text\n x=\"20\"\n y=\"25\"\n font-family=\"sans-serif\"\n font-size=\"14\"\n fill=\"#333333\"\n font-weight=\"bold\"\n >\n {{ swimlane.label }}\n </text>\n\n <g\n class=\"edit-swimlane-button\"\n [attr.transform]=\"'translate(100, 20)'\"\n (click)=\"\n onEditSwimlane($event, swimlane, swimlane.order);\n $event.stopPropagation()\n \"\n >\n <rect\n x=\"-5\"\n y=\"-15\"\n width=\"40\"\n height=\"20\"\n fill=\"#f3e8ff\"\n rx=\"3\"\n ry=\"3\"\n stroke=\"#d8b4fe\"\n stroke-width=\"1\"\n ></rect>\n <text\n x=\"15\"\n y=\"0\"\n font-family=\"sans-serif\"\n font-size=\"12\"\n fill=\"#7e22ce\"\n text-anchor=\"middle\"\n >\n Edit\n </text>\n </g>\n\n <g [attr.transform]=\"'translate(200, 20)'\">\n @for (tag of swimlane.tags.slice(0, 3); track tag.Name; let i = $index)\n {\n <text\n [attr.x]=\"i * 100\"\n y=\"5\"\n font-family=\"sans-serif\"\n font-size=\"12\"\n fill=\"#666666\"\n >\n {{ tag.Name }}\n </text>\n } @if (swimlane.tags.length > 3) {\n <text\n [attr.x]=\"3 * 100 + 10\"\n y=\"5\"\n font-family=\"sans-serif\"\n font-size=\"12\"\n fill=\"#666666\"\n >\n +{{ swimlane.tags.length - 3 }} more\n </text>\n }\n </g>\n </g> -->\n\n <g [attr.transform]=\"'translate(0,' + swimlane.order * 263 + ')'\">\n <!-- Swimlane container - remove stroke to make it purely background -->\n <rect x=\"0\" y=\"0\" [attr.width]=\"canvasWidth\" [attr.height]=\"263\"\n [attr.fill]=\"swimlane.order % 2 === 0 ? '#FCF3FF' : '#ECFFF5'\" stroke=\"none\"></rect>\n\n <!-- Vertical swimlane label on the left -->\n <g class=\"swimlane-label\">\n <!-- Purple background for the label -->\n <rect x=\"0.5\" y=\"0.5\" width=\"43\" height=\"215\" rx=\"10.5\" fill=\"white\" stroke=\"#D36CFF\"></rect>\n\n <!-- Plus button at the top -->\n <g (click)=\"\n onEditSwimlane($event, swimlane, swimlane.order);\n $event.stopPropagation()\n \">\n <rect x=\"12.5\" y=\"10\" width=\"18\" height=\"18\" fill=\"transparent\" style=\"cursor: pointer\"></rect>\n\n <path d=\"M22.52 12.174V17.08H27.47V18.51H22.52V23.394H21.2V18.51H16.25V17.08H21.2V12.174H22.52Z\"\n fill=\"#0000FF\" class=\"plus-icon\" style=\"cursor: pointer\"></path>\n </g>\n\n <!-- Swimlane label -->\n <text x=\"22\" y=\"106\" font-family=\"sans-serif\" font-size=\"14\" fill=\"#333333\" text-anchor=\"middle\"\n transform=\"rotate(-90, 22, 100)\">\n {{\n swimlane.label.length > 12\n ? swimlane.label.substring(0, 10) + \"...\"\n : swimlane.label\n }}\n </text>\n\n <!-- Tag count indicator at the bottom -->\n <rect x=\"11.5\" y=\"187\" width=\"21\" height=\"19\" rx=\"9.5\" fill=\"#9E9E9E\"></rect>\n <text x=\"24\" y=\"206\" font-family=\"sans-serif\" font-size=\"12\" fill=\"black\" text-anchor=\"middle\"\n transform=\"rotate(-90, 22, 200)\">\n {{ swimlane.tags.length }}\n </text>\n </g>\n </g>\n\n }\n\n <!-- Nodes -->\n @for (swimlane of state.swimlanes; track swimlane.order) {\n <!-- Render nodes in this swimlane -->\n @for (node of swimlane.nodes; track node.id) {\n <g class=\"node-element\" [attr.transform]=\"\n 'translate(' + node.x + ',' + (node.y + swimlane.order * 263) + ')'\"\n (mouseenter)=\"showConnectionPoints(node.id, swimlane.order)\"\n (mouseleave)=\"hideConnectionPoints(node.id)\">\n <!-- Start node indicator (circle and arrow) for the first node -->\n @if (node.isStartNode) {\n <!-- Circle -->\n <circle cx=\"-50\" cy=\"50\" r=\"30\" fill=\"none\" stroke=\"#D36CFF\" stroke-width=\"1\"></circle>\n <!-- Form icon for start node -->\n <svg:g (click)=\"\n toggleStartNodeFormPopup($event, node.x, node.y, swimlane.order)\n \" class=\"stage-icon\" transform=\"translate(-45, 42)\" style=\"cursor: pointer; pointer-events: all\">\n <!-- Transparent rectangle to capture clicks -->\n <svg:rect x=\"-2\" y=\"-2\" width=\"24\" height=\"24\" fill=\"transparent\" style=\"cursor: pointer\" />\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]=\"state.workflowFormId ? '#D36CFF' : 'black'\" transform=\"scale(0.7)\" />\n </svg:g>\n <!-- Arrow from circle to node -->\n <path d=\"M -20 50 L 0 50\" stroke=\"#D36CFF\" stroke-width=\"1\" marker-end=\"url(#arrowhead)\"></path>\n }\n\n <!-- Exit point indicator (circle and arrow) -->\n @if (node.stageData?.IsExitPoint) {\n <!-- Arrow from node to circle -->\n <path [attr.d]=\"'M ' + node.width + ' 50 L ' + (node.width + 20) + ' 50'\" stroke=\"#D36CFF\" stroke-width=\"1\"\n marker-end=\"url(#arrowhead)\"></path>\n <!-- Circle -->\n <circle [attr.cx]=\"node.width + 50\" cy=\"50\" r=\"30\" fill=\"none\" stroke=\"#D36CFF\" stroke-width=\"2\"></circle>\n }\n\n <!-- Inner drag-handle: inset 12px so the node edge ring stays drag-free.\n Rendered BEFORE the node shapes/icons so the clickable icons paint on\n top of it and win pointer events; the node body still falls through to\n this handle because its shape/label use pointer-events:none.\n Connection point <use> elements are rendered after everything so they\n stay topmost and win pointer events at the node edges. -->\n <rect class=\"node-drag-handle\"\n [attr.x]=\"12\" [attr.y]=\"12\"\n [attr.width]=\"node.width - 24\" [attr.height]=\"node.height - 24\"\n fill=\"transparent\"\n [style.cursor]=\"getCursorForNode(node.id)\"\n (mousedown)=\"onNodeMouseDown($event, node, swimlane.order)\" />\n\n <!-- Stage node -->\n @if (node.type === 'stage') {\n <!-- <rect\n x=\"0\"\n y=\"0\"\n [attr.width]=\"node.width\"\n [attr.height]=\"node.height\"\n fill=\"none\"\n stroke=\"#D36CFF\"\n stroke-width=\"1\"\n ></rect> -->\n <svg:g lib-stage-node [node]=\"node\" [isStartNode]=\"node.isStartNode\"\n (stagePropertiesUpdated)=\"onStagePropertiesUpdated($event)\" (showShieldDialog)=\"onShowShieldDialog($event)\"\n (showEscalationDialog)=\"onShowEscalationDialog($event)\" (showFormDialog)=\"\n toggleStartNodeFormPopup($event, node.x, node.y, swimlane.order, node)\n \"></svg:g>\n }\n\n <!-- Decision node -->\n @if (node.type === 'decision') {\n <path [attr.d]=\"\n 'M 0 ' +\n node.height / 2 +\n ' L ' +\n node.width / 2 +\n ' 0' +\n ' L ' +\n node.width +\n ' ' +\n node.height / 2 +\n ' L ' +\n node.width / 2 +\n ' ' +\n node.height +\n ' Z'\n \" fill=\"none\" stroke=\"#D36CFF\" stroke-width=\"1\" style=\"pointer-events: none\"></path>\n\n <!-- Decision node condition indicator icon -->\n <svg:g (click)=\"showDecisionConditionsPopup($event, node, swimlane.order)\" class=\"decision-condition-icon\"\n [attr.transform]=\"\n 'translate(' +\n (node.width / 2 - 10) +\n ',' +\n (node.height / 2 - 10) +\n ')'\n \">\n <svg:rect x=\"-5\" y=\"-5\" width=\"30\" height=\"30\" fill=\"transparent\" style=\"cursor: pointer\" />\n <svg:path d=\"M10 0H20V2H10V0ZM10 8H20V10H10V8ZM10 4H20V6H10V4ZM0 0H8V2H0V0ZM0 8H8V10H0V8ZM0 4H8V6H0V4Z\"\n fill=\"#D36CFF\" />\n </svg:g>\n }\n\n <!-- Form node -->\n @if (node.type === 'form') {\n <path\n d=\"M95.0625 50.5591V95.0625C95.0625 97.9716 93.9069 100.762 91.8498 102.819C89.7928 104.876 87.0028 106.031 84.0938 106.031H32.9062C29.9972 106.031 27.2072 104.876 25.1502 102.819C23.0931 100.762 21.9375 97.9716 21.9375 95.0625V21.9375C21.9375 19.0284 23.0931 16.2385 25.1502 14.1814C27.2072 12.1244 29.9972 10.9688 32.9062 10.9688H55.4722C57.4109 10.969 59.2701 11.7392 60.6412 13.1099L92.9213 45.3901C94.292 46.7611 95.0622 48.6204 95.0625 50.5591Z\"\n transform=\"scale(0.7)\" fill=\"none\" stroke=\"#D36CFF\" stroke-linejoin=\"round\" style=\"pointer-events: none\" />\n <path\n d=\"M58.5 12.7969V40.2188C58.5 42.1581 59.2704 44.0181 60.6418 45.3895C62.0131 46.7608 63.8731 47.5312 65.8125 47.5312H93.2344\"\n transform=\"scale(0.7)\" stroke=\"#D36CFF\" stroke-linecap=\"round\" stroke-linejoin=\"round\" style=\"pointer-events: none\" />\n <text x=\"50%\" y=\"50%\" text-anchor=\"middle\" dominant-baseline=\"middle\" font-family=\"sans-serif\" font-size=\"14\"\n fill=\"#D36CFF\" style=\"pointer-events: none\">\n Form\n </text>\n }\n\n <!-- Subflow node -->\n @if (node.type === 'subflow') {\n <svg:g lib-stage-node [node]=\"node\" [isStartNode]=\"node.isStartNode\" [isSubflow]=\"true\"\n (stagePropertiesUpdated)=\"onStagePropertiesUpdated($event)\" (showShieldDialog)=\"onShowShieldDialog($event)\"\n (showEscalationDialog)=\"onShowEscalationDialog($event)\" (showFormDialog)=\"\n toggleStartNodeFormPopup($event, node.x, node.y, swimlane.order, node)\n \"></svg:g>\n }\n\n <!-- Connection points for this node (rendered last = topmost) -->\n @for (point of node.connectionPoints || []; track point.id) {\n @if (isConnectionPointVisible(node.id)) {\n <use class=\"connection-point\" [attr.href]=\"'#connection-point-template'\" [attr.x]=\"point.x\" [attr.y]=\"point.y\"\n [attr.id]=\"point.id\" (mousedown)=\"startConnectionDrag($event, point, swimlane.order)\" />\n }\n }\n </g>\n <!-- A transparent hover area for improved hover detection -->\n <rect [attr.x]=\"node.x - 10\" [attr.y]=\"node.y - 10\" [attr.width]=\"node.width + 20\" [attr.height]=\"node.height + 20\"\n fill=\"transparent\" (mouseover)=\"showConnectionPoints(node.id, swimlane.order)\"\n (mouseout)=\"hideConnectionPoints(node.id)\" style=\"pointer-events: none\" />\n } }\n\n <!-- Connections -->\n @for (connection of state.connections; track connection.id) {\n <g class=\"connection-element\">\n <path [attr.d]=\"getConnectionPathForSavedConnection(connection)\" stroke=\"#D36CFF\" stroke-width=\"2\" fill=\"none\"\n marker-end=\"url(#arrowhead)\"></path>\n\n <!-- Connection Label -->\n @if (connection.sourceNodeId && connection.targetNodeId) {\n <foreignObject [attr.x]=\"getLabelPosition(connection).x\" [attr.y]=\"getLabelPosition(connection).y\" width=\"150\"\n height=\"40\" style=\"overflow: visible; pointer-events: all;\" [attr.transform]=\"'translate(-75, -10)'\">\n <wf-label-editor [label]=\"connection.label || 'New Action'\" [x]=\"0\" [y]=\"0\" [isConnection]=\"true\"\n (labelChange)=\"saveConnectionLabel(connection, $event)\" (openDialog)=\"onShowActionDialog(connection)\" />\n </foreignObject>\n }\n </g>\n }\n\n <!-- Connection preview line -->\n @if (state.isConnectionDragging()) {\n <g>\n <path [attr.d]=\"getConnectionPath()\" stroke=\"#D36CFF\" stroke-width=\"2\" stroke-dasharray=\"5,5\" fill=\"none\"></path>\n </g>\n }\n </svg>\n\n <div *ngIf=\"popupVisible\" [style.position]=\"'absolute'\" [style.left.px]=\"popupX\" [style.top.px]=\"popupY\">\n <verben-pop-Up [dropdownOpen]=\"true\" [customStyles]=\"{ 'z-index': '99' }\" [enableMouseLeave]=\"false\"\n (dropdownOpenChange)=\"$event ? null : hideConnectionPopup()\">\n <div dropdown-trigger style=\"display: none\">\n <!-- Hidden trigger element -->\n </div>\n <div class=\"p-3 bg-white border border-gray-200 rounded shadow-md\" dropdown-content>\n <h4 class=\"mb-2 font-medium\">Create Connection</h4>\n <div class=\"flex flex-col gap-2\">\n <ng-container *ngFor=\"let type of allowedNodeTypes\">\n <button class=\"px-3 py-2 bg-white border border-gray-200 rounded text-sm hover:bg-gray-50\"\n (click)=\"createNodeConnection(type)\">\n Create {{ type | titlecase }}\n </button>\n </ng-container>\n <button class=\"px-3 py-2 bg-white border border-gray-200 rounded text-sm hover:bg-gray-50\"\n (click)=\"hideConnectionPopup()\">\n Cancel\n </button>\n </div>\n </div>\n </verben-pop-Up>\n </div>\n\n <div *ngIf=\"showStartNodeFormPopup\" [style.position]=\"'absolute'\" [style.left.px]=\"startNodeFormPopupX\"\n [style.top.px]=\"startNodeFormPopupY\">\n <verben-pop-Up [dropdownOpen]=\"true\" [customStyles]=\"{ 'z-index': '100' }\">\n <div dropdown-trigger style=\"display: none\">\n <!-- Hidden trigger element -->\n </div>\n <div class=\"p-3 bg-white border border-gray-200 rounded shadow-md w-64\" dropdown-content\n style=\"background-color: white; z-index: 1000\">\n <h4 class=\"mb-2 font-medium\">Select Workflow Form</h4>\n <div *ngIf=\"isLoadingStartNodeForms\" class=\"text-center py-2\">\n Loading forms...\n </div>\n <div *ngIf=\"!isLoadingStartNodeForms\" class=\"max-h-48 overflow-y-auto\" style=\"max-height: 192px; overflow-y: auto;\">\n <div class=\"mb-3\">\n <button\n class=\"w-full px-3 py-2 bg-gray-50 border border-gray-200 rounded text-sm hover:bg-gray-50 text-left\"\n (click)=\"selectStartNodeForm(null)\">\n Clear form selection\n </button>\n </div>\n <div *ngFor=\"let form of startNodeFormsList\" class=\"mb-1\">\n <button class=\"w-full px-3 py-2 bg-white border border-gray-200 rounded text-sm hover:bg-gray-50 text-left\"\n [ngClass]=\"{ 'bg-blue-50 !border-blue-500 !border-2 font-semibold': form?.Code === activeNodeForFormSelection?.stageData?.formId}\"\n (click)=\"selectStartNodeForm(form)\">\n {{ form.Name }}\n </button>\n </div>\n <div *ngIf=\"startNodeFormsList.length === 0\" class=\"text-center py-2 text-gray-500\">\n No forms available\n </div>\n </div>\n </div>\n </verben-pop-Up>\n </div>\n\n <div *ngIf=\"showSubflowPopup\" [style.position]=\"'absolute'\" [style.left.px]=\"subflowPopupX\"\n [style.top.px]=\"subflowPopupY\">\n <verben-pop-Up [dropdownOpen]=\"true\" [customStyles]=\"{ 'z-index': '100' }\">\n <div dropdown-trigger style=\"display: none\">\n <!-- Hidden trigger element -->\n </div>\n <div class=\"p-3 bg-white border border-gray-200 rounded shadow-md w-64\" dropdown-content\n style=\"background-color: white; z-index: 1000\">\n <h4 class=\"mb-2 font-medium\">Select Workflow</h4>\n <div *ngIf=\"isLoadingWorkflows\" class=\"text-center py-2\">\n Loading workflows...\n </div>\n <div *ngIf=\"!isLoadingWorkflows\" class=\"max-h-48 overflow-y-auto\" style=\"max-height: 192px; overflow-y: auto;\">\n <div *ngFor=\"let workflow of workflowsList\" class=\"mb-1\">\n <button class=\"w-full px-3 py-2 bg-white border border-gray-200 rounded text-sm hover:bg-gray-50 text-left\"\n (click)=\"selectSubflowWorkflow(workflow)\">\n {{ workflow.Name }}\n </button>\n </div>\n <div *ngIf=\"workflowsList.length === 0\" class=\"text-center py-2 text-gray-500\">\n No workflows available\n </div>\n </div>\n </div>\n </verben-pop-Up>\n </div>\n\n <lib-conditions-popup [visible]=\"showDecisionConditionDialog\" [decisionNodeId]=\"activeDecisionNodeId\"\n [newConnectionId]=\"activeConnectionId\" [popupX]=\"decisionConditionPopupX\" [popupY]=\"decisionConditionPopupY\"\n (closed)=\"onDecisionConditionCancelled()\" (saved)=\"onDecisionConditionSaved($event)\"></lib-conditions-popup>\n\n <!-- <lib-decision-popup\n [visible]=\"showConditionsDialog\"\n [decisionNodeId]=\"activeDecisionNodeId\"\n [popupX]=\"decisionConditionPopupX\"\n [popupY]=\"decisionConditionPopupY\"\n (closed)=\"onDecisionConditionCancelled()\"\n ></lib-decision-popup> -->\n\n <lib-stage-dialog [visible]=\"showStageDialogLocal\" [stageData]=\"activeStageData || {}\"\n (closed)=\"onStageDialogClosed()\" (saved)=\"onStageDialogSaved($event)\"></lib-stage-dialog>\n\n <lib-action-dialog [visible]=\"showActionDialogLocal\" [actionData]=\"activeActionData\" (closed)=\"onActionDialogClosed()\"\n (saved)=\"onActionDialogSaved($event)\" (deleted)=\"onActionDialogDeleted($event)\"></lib-action-dialog>\n\n\n <lib-escalation-dialog [visible]=\"showEscalationDialogLocal\" [type]=\"activeEscalationType()!\"\n [stageCode]=\"activeStageCode() || ''\" [workflowCode]=\"state.workflow?.Code || ''\"\n (closed)=\"onEscalationDialogClosed()\"></lib-escalation-dialog>\n</div>\n", styles: [".canvas-container{flex:1;overflow:auto;background-color:#fff}.designer-canvas{min-width:100%;min-height:100%;cursor:default}.designer-canvas:focus{outline:none}.edit-swimlane-button{cursor:pointer}.edit-swimlane-button:hover rect{fill:#ddd6fe}.decision-condition-icon{cursor:pointer}.decision-condition-icon:hover path{fill:#c084fc}.swimlane-label{z-index:10;cursor:default}.plus-icon:hover{fill:#d36cff}.swimlane-container{pointer-events:none}.swimlane-container>*{pointer-events:auto}.node-element{z-index:10}.connection-element{z-index:5}.node-drag-handle{pointer-events:all;-webkit-user-select:none;user-select:none}.connection-point{cursor:crosshair}\n"] }]
|
|
4487
|
+
args: [{ selector: 'lib-designer-canvas', template: "<div class=\"canvas-container\">\n <svg #canvas [attr.width]=\"canvasWidth\" [attr.height]=\"canvasHeight\" class=\"designer-canvas\"\n (click)=\"onCanvasClick($event)\">\n <defs>\n <!-- Grid pattern definition -->\n\n <pattern id=\"grid\" [attr.width]=\"gridSize\" [attr.height]=\"gridSize\" patternUnits=\"userSpaceOnUse\">\n <path d=\"M 20 0 L 0 0 0 20\" fill=\"none\" stroke=\"#e2e8f0\" stroke-width=\"0.5\" />\n </pattern>\n\n <!-- Arrow head marker definition -->\n <marker id=\"arrowhead\" markerWidth=\"10\" markerHeight=\"7\" refX=\"9\" refY=\"3.5\" orient=\"auto\">\n <polygon points=\"0 0, 10 3.5, 0 7\" fill=\"#D36CFF\" />\n </marker>\n\n <!-- Connection point: outer transparent ring expands the hit target so a\n connection drag can be started without pixel-precise aim. The visible\n circle stays at r=5. The hit ring extends inward up to the node's\n drag-handle edge so clicks near the edge fall to the connection point\n (rendered topmost) rather than to the drag handle beneath. -->\n <g id=\"connection-point-template\">\n <circle r=\"12\" fill=\"transparent\" />\n <circle r=\"5\" fill=\"#D36CFF\" stroke=\"#FFFFFF\" stroke-width=\"1\" />\n </g>\n\n <!-- Dashed line style for connection preview -->\n <pattern id=\"dashed-line\" width=\"10\" height=\"10\" patternUnits=\"userSpaceOnUse\">\n <line x1=\"0\" y1=\"5\" x2=\"10\" y2=\"5\" stroke=\"#D36CFF\" stroke-width=\"2\" stroke-dasharray=\"5,5\" />\n </pattern>\n\n @for (swimlane of state.swimlanes; track swimlane.order) {\n <clipPath [attr.id]=\"'swimlane-clip-' + swimlane.order\">\n <rect x=\"0\" y=\"0\" [attr.width]=\"canvasWidth\" height=\"263\" />\n </clipPath>\n }\n </defs>\n\n <!-- Background grid -->\n <rect width=\"100%\" height=\"100%\" fill=\"url(#grid)\" />\n\n <!-- Display a message when no swimlanes exist -->\n @if (state.swimlanes.length === 0) {\n <text x=\"50%\" y=\"50%\" font-family=\"sans-serif\" font-size=\"16\" fill=\"#94a3b8\" text-anchor=\"middle\">\n Select the Swimlane tool and click on the canvas to add a swimlane\n </text>\n }\n\n <!-- This is where workflow elements will be added later -->\n @for (swimlane of state.swimlanes; track swimlane.order) {\n <!-- <g\n [attr.transform]=\"'translate(0,' + swimlane.order * 263 + ')'\"\n [attr.clip-path]=\"'url(#swimlane-clip-' + swimlane.order + ')'\"\n >\n <rect\n x=\"0\"\n y=\"0\"\n [attr.width]=\"canvasWidth\"\n [attr.height]=\"263\"\n fill=\"#ffffff\"\n stroke=\"#e2e8f0\"\n stroke-width=\"1\"\n ></rect>\n\n <rect\n x=\"0\"\n y=\"0\"\n [attr.width]=\"canvasWidth\"\n height=\"40\"\n fill=\"#f8fafc\"\n stroke=\"#e2e8f0\"\n stroke-width=\"1\"\n ></rect>\n\n <text\n x=\"20\"\n y=\"25\"\n font-family=\"sans-serif\"\n font-size=\"14\"\n fill=\"#333333\"\n font-weight=\"bold\"\n >\n {{ swimlane.label }}\n </text>\n\n <g\n class=\"edit-swimlane-button\"\n [attr.transform]=\"'translate(100, 20)'\"\n (click)=\"\n onEditSwimlane($event, swimlane, swimlane.order);\n $event.stopPropagation()\n \"\n >\n <rect\n x=\"-5\"\n y=\"-15\"\n width=\"40\"\n height=\"20\"\n fill=\"#f3e8ff\"\n rx=\"3\"\n ry=\"3\"\n stroke=\"#d8b4fe\"\n stroke-width=\"1\"\n ></rect>\n <text\n x=\"15\"\n y=\"0\"\n font-family=\"sans-serif\"\n font-size=\"12\"\n fill=\"#7e22ce\"\n text-anchor=\"middle\"\n >\n Edit\n </text>\n </g>\n\n <g [attr.transform]=\"'translate(200, 20)'\">\n @for (tag of swimlane.tags.slice(0, 3); track tag.Name; let i = $index)\n {\n <text\n [attr.x]=\"i * 100\"\n y=\"5\"\n font-family=\"sans-serif\"\n font-size=\"12\"\n fill=\"#666666\"\n >\n {{ tag.Name }}\n </text>\n } @if (swimlane.tags.length > 3) {\n <text\n [attr.x]=\"3 * 100 + 10\"\n y=\"5\"\n font-family=\"sans-serif\"\n font-size=\"12\"\n fill=\"#666666\"\n >\n +{{ swimlane.tags.length - 3 }} more\n </text>\n }\n </g>\n </g> -->\n\n <g [attr.transform]=\"'translate(0,' + swimlane.order * 263 + ')'\">\n <!-- Swimlane container - remove stroke to make it purely background -->\n <rect x=\"0\" y=\"0\" [attr.width]=\"canvasWidth\" [attr.height]=\"263\"\n [attr.fill]=\"swimlane.order % 2 === 0 ? '#FCF3FF' : '#ECFFF5'\" stroke=\"none\"></rect>\n\n <!-- Vertical swimlane label on the left -->\n <g class=\"swimlane-label\">\n <!-- Purple background for the label -->\n <rect x=\"0.5\" y=\"0.5\" width=\"43\" height=\"215\" rx=\"10.5\" fill=\"white\" stroke=\"#D36CFF\"></rect>\n\n <!-- Plus button at the top -->\n <g (click)=\"\n onEditSwimlane($event, swimlane, swimlane.order);\n $event.stopPropagation()\n \">\n <rect x=\"12.5\" y=\"10\" width=\"18\" height=\"18\" fill=\"transparent\" style=\"cursor: pointer\"></rect>\n\n <path d=\"M22.52 12.174V17.08H27.47V18.51H22.52V23.394H21.2V18.51H16.25V17.08H21.2V12.174H22.52Z\"\n fill=\"#0000FF\" class=\"plus-icon\" style=\"cursor: pointer\"></path>\n </g>\n\n <!-- Swimlane label -->\n <text x=\"22\" y=\"106\" font-family=\"sans-serif\" font-size=\"14\" fill=\"#333333\" text-anchor=\"middle\"\n transform=\"rotate(-90, 22, 100)\">\n {{\n swimlane.label.length > 12\n ? swimlane.label.substring(0, 10) + \"...\"\n : swimlane.label\n }}\n </text>\n\n <!-- Tag count indicator at the bottom -->\n <rect x=\"11.5\" y=\"187\" width=\"21\" height=\"19\" rx=\"9.5\" fill=\"#9E9E9E\"></rect>\n <text x=\"24\" y=\"206\" font-family=\"sans-serif\" font-size=\"12\" fill=\"black\" text-anchor=\"middle\"\n transform=\"rotate(-90, 22, 200)\">\n {{ swimlane.tags.length }}\n </text>\n </g>\n </g>\n\n }\n\n <!-- Nodes -->\n @for (swimlane of state.swimlanes; track swimlane.order) {\n <!-- Render nodes in this swimlane -->\n @for (node of swimlane.nodes; track node.id) {\n <g class=\"node-element\" [attr.transform]=\"\n 'translate(' + node.x + ',' + (node.y + swimlane.order * 263) + ')'\"\n (mouseenter)=\"showConnectionPoints(node.id, swimlane.order)\"\n (mouseleave)=\"hideConnectionPoints(node.id)\">\n <!-- Start node indicator (circle and arrow) for the first node -->\n @if (node.isStartNode) {\n <!-- Circle -->\n <circle cx=\"-50\" cy=\"50\" r=\"30\" fill=\"none\" stroke=\"#D36CFF\" stroke-width=\"1\"></circle>\n <!-- Form icon for start node -->\n <svg:g (click)=\"\n toggleStartNodeFormPopup($event, node.x, node.y, swimlane.order)\n \" class=\"stage-icon\" transform=\"translate(-45, 42)\" style=\"cursor: pointer; pointer-events: all\">\n <!-- Transparent rectangle to capture clicks -->\n <svg:rect x=\"-2\" y=\"-2\" width=\"24\" height=\"24\" fill=\"transparent\" style=\"cursor: pointer\" />\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]=\"state.workflowFormId ? '#D36CFF' : 'black'\" transform=\"scale(0.7)\" />\n </svg:g>\n <!-- Arrow from circle to node -->\n <path d=\"M -20 50 L 0 50\" stroke=\"#D36CFF\" stroke-width=\"1\" marker-end=\"url(#arrowhead)\"></path>\n }\n\n <!-- Exit point indicator (circle and arrow) -->\n @if (node.stageData?.IsExitPoint) {\n <!-- Arrow from node to circle -->\n <path [attr.d]=\"'M ' + node.width + ' 50 L ' + (node.width + 20) + ' 50'\" stroke=\"#D36CFF\" stroke-width=\"1\"\n marker-end=\"url(#arrowhead)\"></path>\n <!-- Circle -->\n <circle [attr.cx]=\"node.width + 50\" cy=\"50\" r=\"30\" fill=\"none\" stroke=\"#D36CFF\" stroke-width=\"2\"></circle>\n }\n\n <!-- Inner drag-handle: inset 12px so the node edge ring stays drag-free.\n Rendered BEFORE the node shapes/icons so the clickable icons paint on\n top of it and win pointer events; the node body still falls through to\n this handle because its shape/label use pointer-events:none.\n Connection point <use> elements are rendered after everything so they\n stay topmost and win pointer events at the node edges. -->\n <rect class=\"node-drag-handle\"\n [attr.x]=\"12\" [attr.y]=\"12\"\n [attr.width]=\"node.width - 24\" [attr.height]=\"node.height - 24\"\n fill=\"transparent\"\n [style.cursor]=\"getCursorForNode(node.id)\"\n (mousedown)=\"onNodeMouseDown($event, node, swimlane.order)\" />\n\n <!-- Stage node -->\n @if (node.type === 'stage') {\n <!-- <rect\n x=\"0\"\n y=\"0\"\n [attr.width]=\"node.width\"\n [attr.height]=\"node.height\"\n fill=\"none\"\n stroke=\"#D36CFF\"\n stroke-width=\"1\"\n ></rect> -->\n <svg:g lib-stage-node [node]=\"node\" [isStartNode]=\"node.isStartNode\"\n (stagePropertiesUpdated)=\"onStagePropertiesUpdated($event)\" (showShieldDialog)=\"onShowShieldDialog($event)\"\n (showEscalationDialog)=\"onShowEscalationDialog($event)\" (showFormDialog)=\"\n toggleStartNodeFormPopup($event, node.x, node.y, swimlane.order, node)\n \"></svg:g>\n }\n\n <!-- Decision node -->\n @if (node.type === 'decision') {\n <path [attr.d]=\"\n 'M 0 ' +\n node.height / 2 +\n ' L ' +\n node.width / 2 +\n ' 0' +\n ' L ' +\n node.width +\n ' ' +\n node.height / 2 +\n ' L ' +\n node.width / 2 +\n ' ' +\n node.height +\n ' Z'\n \" fill=\"none\" stroke=\"#D36CFF\" stroke-width=\"1\" style=\"pointer-events: none\"></path>\n\n <!-- Decision node condition indicator icon -->\n <svg:g (click)=\"showDecisionConditionsPopup($event, node, swimlane.order)\" class=\"decision-condition-icon\"\n [attr.transform]=\"\n 'translate(' +\n (node.width / 2 - 10) +\n ',' +\n (node.height / 2 - 10) +\n ')'\n \">\n <svg:rect x=\"-5\" y=\"-5\" width=\"30\" height=\"30\" fill=\"transparent\" style=\"cursor: pointer\" />\n <svg:path d=\"M10 0H20V2H10V0ZM10 8H20V10H10V8ZM10 4H20V6H10V4ZM0 0H8V2H0V0ZM0 8H8V10H0V8ZM0 4H8V6H0V4Z\"\n fill=\"#D36CFF\" />\n </svg:g>\n }\n\n <!-- Form node -->\n @if (node.type === 'form') {\n <path\n d=\"M95.0625 50.5591V95.0625C95.0625 97.9716 93.9069 100.762 91.8498 102.819C89.7928 104.876 87.0028 106.031 84.0938 106.031H32.9062C29.9972 106.031 27.2072 104.876 25.1502 102.819C23.0931 100.762 21.9375 97.9716 21.9375 95.0625V21.9375C21.9375 19.0284 23.0931 16.2385 25.1502 14.1814C27.2072 12.1244 29.9972 10.9688 32.9062 10.9688H55.4722C57.4109 10.969 59.2701 11.7392 60.6412 13.1099L92.9213 45.3901C94.292 46.7611 95.0622 48.6204 95.0625 50.5591Z\"\n transform=\"scale(0.7)\" fill=\"none\" stroke=\"#D36CFF\" stroke-linejoin=\"round\" style=\"pointer-events: none\" />\n <path\n d=\"M58.5 12.7969V40.2188C58.5 42.1581 59.2704 44.0181 60.6418 45.3895C62.0131 46.7608 63.8731 47.5312 65.8125 47.5312H93.2344\"\n transform=\"scale(0.7)\" stroke=\"#D36CFF\" stroke-linecap=\"round\" stroke-linejoin=\"round\" style=\"pointer-events: none\" />\n <text x=\"50%\" y=\"50%\" text-anchor=\"middle\" dominant-baseline=\"middle\" font-family=\"sans-serif\" font-size=\"14\"\n fill=\"#D36CFF\" style=\"pointer-events: none\">\n Form\n </text>\n }\n\n <!-- Subflow node -->\n @if (node.type === 'subflow') {\n <svg:g lib-stage-node [node]=\"node\" [isStartNode]=\"node.isStartNode\" [isSubflow]=\"true\"\n (stagePropertiesUpdated)=\"onStagePropertiesUpdated($event)\" (showShieldDialog)=\"onShowShieldDialog($event)\"\n (showEscalationDialog)=\"onShowEscalationDialog($event)\" (showFormDialog)=\"\n toggleStartNodeFormPopup($event, node.x, node.y, swimlane.order, node)\n \"></svg:g>\n }\n\n <!-- Connection points for this node (rendered last = topmost) -->\n @for (point of node.connectionPoints || []; track point.id) {\n @if (isConnectionPointVisible(node.id)) {\n <use class=\"connection-point\" [attr.href]=\"'#connection-point-template'\" [attr.x]=\"point.x\" [attr.y]=\"point.y\"\n [attr.id]=\"point.id\" (mousedown)=\"startConnectionDrag($event, point, swimlane.order)\" />\n }\n }\n </g>\n <!-- A transparent hover area for improved hover detection -->\n <rect [attr.x]=\"node.x - 10\" [attr.y]=\"node.y - 10\" [attr.width]=\"node.width + 20\" [attr.height]=\"node.height + 20\"\n fill=\"transparent\" (mouseover)=\"showConnectionPoints(node.id, swimlane.order)\"\n (mouseout)=\"hideConnectionPoints(node.id)\" style=\"pointer-events: none\" />\n } }\n\n <!-- Connections -->\n @for (connection of state.connections; track connection.id) {\n <g class=\"connection-element\">\n <path [attr.d]=\"getConnectionPathForSavedConnection(connection)\" stroke=\"#D36CFF\" stroke-width=\"2\" fill=\"none\"\n marker-end=\"url(#arrowhead)\"></path>\n\n <!-- Connection Label -->\n @if (connection.sourceNodeId && connection.targetNodeId) {\n <foreignObject [attr.x]=\"getLabelPosition(connection).x\" [attr.y]=\"getLabelPosition(connection).y\" width=\"150\"\n height=\"40\" style=\"overflow: visible; pointer-events: all;\" [attr.transform]=\"'translate(-75, -10)'\">\n <wf-label-editor [label]=\"connection.label || 'New Action'\" [x]=\"0\" [y]=\"0\" [isConnection]=\"true\"\n [hasForm]=\"!!(connection.form && connection.form.trim().length > 0)\"\n (labelChange)=\"saveConnectionLabel(connection, $event)\" (openDialog)=\"onShowActionDialog(connection)\" />\n </foreignObject>\n }\n </g>\n }\n\n <!-- Connection preview line -->\n @if (state.isConnectionDragging()) {\n <g>\n <path [attr.d]=\"getConnectionPath()\" stroke=\"#D36CFF\" stroke-width=\"2\" stroke-dasharray=\"5,5\" fill=\"none\"></path>\n </g>\n }\n </svg>\n\n <div *ngIf=\"popupVisible\" [style.position]=\"'absolute'\" [style.left.px]=\"popupX\" [style.top.px]=\"popupY\">\n <verben-pop-Up [dropdownOpen]=\"true\" [customStyles]=\"{ 'z-index': '99' }\" [enableMouseLeave]=\"false\"\n (dropdownOpenChange)=\"$event ? null : hideConnectionPopup()\">\n <div dropdown-trigger style=\"display: none\">\n <!-- Hidden trigger element -->\n </div>\n <div class=\"p-3 bg-white border border-gray-200 rounded shadow-md\" dropdown-content>\n <h4 class=\"mb-2 font-medium\">Create Connection</h4>\n <div class=\"flex flex-col gap-2\">\n <ng-container *ngFor=\"let type of allowedNodeTypes\">\n <button class=\"px-3 py-2 bg-white border border-gray-200 rounded text-sm hover:bg-gray-50\"\n (click)=\"createNodeConnection(type)\">\n Create {{ type | titlecase }}\n </button>\n </ng-container>\n <button class=\"px-3 py-2 bg-white border border-gray-200 rounded text-sm hover:bg-gray-50\"\n (click)=\"hideConnectionPopup()\">\n Cancel\n </button>\n </div>\n </div>\n </verben-pop-Up>\n </div>\n\n <div *ngIf=\"showStartNodeFormPopup\" [style.position]=\"'absolute'\" [style.left.px]=\"startNodeFormPopupX\"\n [style.top.px]=\"startNodeFormPopupY\">\n <verben-pop-Up [dropdownOpen]=\"true\" [customStyles]=\"{ 'z-index': '100' }\">\n <div dropdown-trigger style=\"display: none\">\n <!-- Hidden trigger element -->\n </div>\n <div class=\"p-3 bg-white border border-gray-200 rounded shadow-md w-64\" dropdown-content\n style=\"background-color: white; z-index: 1000\">\n <h4 class=\"mb-2 font-medium\">Select Workflow Form</h4>\n <div *ngIf=\"isLoadingStartNodeForms\" class=\"text-center py-2\">\n Loading forms...\n </div>\n <div *ngIf=\"!isLoadingStartNodeForms\" class=\"max-h-48 overflow-y-auto\" style=\"max-height: 192px; overflow-y: auto;\">\n <div class=\"mb-3\">\n <button\n class=\"w-full px-3 py-2 bg-gray-50 border border-gray-200 rounded text-sm hover:bg-gray-50 text-left\"\n (click)=\"selectStartNodeForm(null)\">\n Clear form selection\n </button>\n </div>\n <div *ngFor=\"let form of startNodeFormsList\" class=\"mb-1\">\n <button class=\"w-full px-3 py-2 bg-white border border-gray-200 rounded text-sm hover:bg-gray-50 text-left\"\n [ngClass]=\"{ 'bg-blue-50 !border-blue-500 !border-2 font-semibold': form?.Code === activeNodeForFormSelection?.stageData?.formId}\"\n (click)=\"selectStartNodeForm(form)\">\n {{ form.Name }}\n </button>\n </div>\n <div *ngIf=\"startNodeFormsList.length === 0\" class=\"text-center py-2 text-gray-500\">\n No forms available\n </div>\n </div>\n </div>\n </verben-pop-Up>\n </div>\n\n <div *ngIf=\"showSubflowPopup\" [style.position]=\"'absolute'\" [style.left.px]=\"subflowPopupX\"\n [style.top.px]=\"subflowPopupY\">\n <verben-pop-Up [dropdownOpen]=\"true\" [customStyles]=\"{ 'z-index': '100' }\">\n <div dropdown-trigger style=\"display: none\">\n <!-- Hidden trigger element -->\n </div>\n <div class=\"p-3 bg-white border border-gray-200 rounded shadow-md w-64\" dropdown-content\n style=\"background-color: white; z-index: 1000\">\n <h4 class=\"mb-2 font-medium\">Select Workflow</h4>\n <div *ngIf=\"isLoadingWorkflows\" class=\"text-center py-2\">\n Loading workflows...\n </div>\n <div *ngIf=\"!isLoadingWorkflows\" class=\"max-h-48 overflow-y-auto\" style=\"max-height: 192px; overflow-y: auto;\">\n <div *ngFor=\"let workflow of workflowsList\" class=\"mb-1\">\n <button class=\"w-full px-3 py-2 bg-white border border-gray-200 rounded text-sm hover:bg-gray-50 text-left\"\n (click)=\"selectSubflowWorkflow(workflow)\">\n {{ workflow.Name }}\n </button>\n </div>\n <div *ngIf=\"workflowsList.length === 0\" class=\"text-center py-2 text-gray-500\">\n No workflows available\n </div>\n </div>\n </div>\n </verben-pop-Up>\n </div>\n\n <lib-conditions-popup [visible]=\"showDecisionConditionDialog\" [decisionNodeId]=\"activeDecisionNodeId\"\n [newConnectionId]=\"activeConnectionId\" [popupX]=\"decisionConditionPopupX\" [popupY]=\"decisionConditionPopupY\"\n (closed)=\"onDecisionConditionCancelled()\" (saved)=\"onDecisionConditionSaved($event)\"></lib-conditions-popup>\n\n <!-- <lib-decision-popup\n [visible]=\"showConditionsDialog\"\n [decisionNodeId]=\"activeDecisionNodeId\"\n [popupX]=\"decisionConditionPopupX\"\n [popupY]=\"decisionConditionPopupY\"\n (closed)=\"onDecisionConditionCancelled()\"\n ></lib-decision-popup> -->\n\n <lib-stage-dialog [visible]=\"showStageDialogLocal\" [stageData]=\"activeStageData || {}\"\n (closed)=\"onStageDialogClosed()\" (saved)=\"onStageDialogSaved($event)\"></lib-stage-dialog>\n\n <lib-action-dialog [visible]=\"showActionDialogLocal\" [actionData]=\"activeActionData\" (closed)=\"onActionDialogClosed()\"\n (saved)=\"onActionDialogSaved($event)\" (deleted)=\"onActionDialogDeleted($event)\"></lib-action-dialog>\n\n\n <lib-escalation-dialog [visible]=\"showEscalationDialogLocal\" [type]=\"activeEscalationType()!\"\n [stageCode]=\"activeStageCode() || ''\" [workflowCode]=\"state.workflow?.Code || ''\"\n (closed)=\"onEscalationDialogClosed()\"></lib-escalation-dialog>\n</div>\n", styles: [".canvas-container{flex:1;overflow:auto;background-color:#fff}.designer-canvas{min-width:100%;min-height:100%;cursor:default}.designer-canvas:focus{outline:none}.edit-swimlane-button{cursor:pointer}.edit-swimlane-button:hover rect{fill:#ddd6fe}.decision-condition-icon{cursor:pointer}.decision-condition-icon:hover path{fill:#c084fc}.swimlane-label{z-index:10;cursor:default}.plus-icon:hover{fill:#d36cff}.swimlane-container{pointer-events:none}.swimlane-container>*{pointer-events:auto}.node-element{z-index:10}.connection-element{z-index:5}.node-drag-handle{pointer-events:all;-webkit-user-select:none;user-select:none}.connection-point{cursor:crosshair}\n"] }]
|
|
4036
4488
|
}], ctorParameters: () => [{ type: WorkflowDesignerState }, { type: WorkflowDataService }], propDecorators: { selectedTool: [{
|
|
4037
4489
|
type: Input
|
|
4038
4490
|
}], clickedPosition: [{
|
|
@@ -4475,6 +4927,30 @@ class WorkflowDesignerComponent {
|
|
|
4475
4927
|
}
|
|
4476
4928
|
// Process connections/actions
|
|
4477
4929
|
if (workflow.Actions && workflow.Actions.length) {
|
|
4930
|
+
const usedAsSource = new Set();
|
|
4931
|
+
const usedAsTarget = new Set();
|
|
4932
|
+
const pickConnectionPoint = (nodeInfo, otherInfo, preferredTypes, oppositeUsed) => {
|
|
4933
|
+
const { node, swimlaneIndex } = nodeInfo;
|
|
4934
|
+
const candidates = (node.connectionPoints || []).filter((p) => preferredTypes.includes(p.type));
|
|
4935
|
+
if (candidates.length === 0)
|
|
4936
|
+
return undefined;
|
|
4937
|
+
const nonOpposite = candidates.filter((p) => !oppositeUsed.has(p.id));
|
|
4938
|
+
const pool = nonOpposite.length > 0 ? nonOpposite : candidates;
|
|
4939
|
+
const nodeGlobalY = node.y + swimlaneIndex * 263;
|
|
4940
|
+
const otherCenterX = otherInfo.node.x + otherInfo.node.width / 2;
|
|
4941
|
+
const otherCenterY = otherInfo.node.y +
|
|
4942
|
+
otherInfo.swimlaneIndex * 263 +
|
|
4943
|
+
otherInfo.node.height / 2;
|
|
4944
|
+
return pool.reduce((best, p) => {
|
|
4945
|
+
const distP = p.type === 'top' || p.type === 'bottom'
|
|
4946
|
+
? Math.abs(node.x + p.x - otherCenterX)
|
|
4947
|
+
: Math.abs(nodeGlobalY + p.y - otherCenterY);
|
|
4948
|
+
const distBest = best.type === 'top' || best.type === 'bottom'
|
|
4949
|
+
? Math.abs(node.x + best.x - otherCenterX)
|
|
4950
|
+
: Math.abs(nodeGlobalY + best.y - otherCenterY);
|
|
4951
|
+
return distP < distBest ? p : best;
|
|
4952
|
+
}, pool[0]);
|
|
4953
|
+
};
|
|
4478
4954
|
workflow.Actions.forEach((action) => {
|
|
4479
4955
|
// Store original action in record
|
|
4480
4956
|
this.state.actionRecord[action.Code] = action;
|
|
@@ -4482,39 +4958,37 @@ class WorkflowDesignerComponent {
|
|
|
4482
4958
|
const sourceNodeInfo = this.state.findNodeById(action.FromStage);
|
|
4483
4959
|
const targetNodeInfo = this.state.findNodeById(action.ToStage);
|
|
4484
4960
|
if (sourceNodeInfo && targetNodeInfo) {
|
|
4485
|
-
|
|
4486
|
-
|
|
4487
|
-
|
|
4488
|
-
|
|
4489
|
-
|
|
4490
|
-
|
|
4491
|
-
|
|
4492
|
-
|
|
4493
|
-
//
|
|
4494
|
-
|
|
4495
|
-
|
|
4496
|
-
|
|
4497
|
-
if (action.SourcePointType) {
|
|
4498
|
-
// Find a point with matching type
|
|
4499
|
-
const sourcePoint = sourceNode.connectionPoints?.find((p) => p.type === action.SourcePointType?.toLowerCase());
|
|
4500
|
-
sourcePointId = sourcePoint?.id;
|
|
4961
|
+
const sNode = sourceNodeInfo.node;
|
|
4962
|
+
const tNode = targetNodeInfo.node;
|
|
4963
|
+
const sTop = sNode.y + sourceNodeInfo.swimlaneIndex * 263;
|
|
4964
|
+
const sBottom = sTop + sNode.height;
|
|
4965
|
+
const tTop = tNode.y + targetNodeInfo.swimlaneIndex * 263;
|
|
4966
|
+
const tBottom = tTop + tNode.height;
|
|
4967
|
+
const rawSourceType = action.SourcePointType?.toLowerCase();
|
|
4968
|
+
let rawTargetType = action.TargetPointType?.toLowerCase();
|
|
4969
|
+
// Override target side when the stored side faces away from an approach above/below
|
|
4970
|
+
if (rawTargetType === 'bottom' &&
|
|
4971
|
+
(sBottom <= tTop || (rawSourceType === 'top' && tTop >= sTop - 40))) {
|
|
4972
|
+
rawTargetType = 'top';
|
|
4501
4973
|
}
|
|
4502
|
-
else
|
|
4503
|
-
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
}
|
|
4507
|
-
if (action.TargetPointType) {
|
|
4508
|
-
// Find a point with matching type
|
|
4509
|
-
const targetPoint = targetNode.connectionPoints?.find((p) => p.type === action.TargetPointType?.toLowerCase());
|
|
4510
|
-
targetPointId = targetPoint?.id;
|
|
4511
|
-
}
|
|
4512
|
-
else {
|
|
4513
|
-
// Fallback to finding a suitable point
|
|
4514
|
-
const targetPoint = targetNode.connectionPoints?.find((p) => p.type === 'left' || p.type === 'top');
|
|
4515
|
-
targetPointId = targetPoint?.id;
|
|
4974
|
+
else if (rawTargetType === 'top' &&
|
|
4975
|
+
(sTop >= tBottom ||
|
|
4976
|
+
(rawSourceType === 'bottom' && tBottom <= sBottom + 40))) {
|
|
4977
|
+
rawTargetType = 'bottom';
|
|
4516
4978
|
}
|
|
4979
|
+
const sourceTypes = rawSourceType
|
|
4980
|
+
? [rawSourceType]
|
|
4981
|
+
: ['right', 'bottom'];
|
|
4982
|
+
const targetTypes = rawTargetType
|
|
4983
|
+
? [rawTargetType]
|
|
4984
|
+
: ['left', 'top'];
|
|
4985
|
+
const sourcePoint = pickConnectionPoint(sourceNodeInfo, targetNodeInfo, sourceTypes, usedAsTarget);
|
|
4986
|
+
const targetPoint = pickConnectionPoint(targetNodeInfo, sourceNodeInfo, targetTypes, usedAsSource);
|
|
4987
|
+
const sourcePointId = sourcePoint?.id;
|
|
4988
|
+
const targetPointId = targetPoint?.id;
|
|
4517
4989
|
if (sourcePointId && targetPointId) {
|
|
4990
|
+
usedAsSource.add(sourcePointId);
|
|
4991
|
+
usedAsTarget.add(targetPointId);
|
|
4518
4992
|
const connection = {
|
|
4519
4993
|
id: action.Code, // Use original ID
|
|
4520
4994
|
sourceNodeId: action.FromStage,
|
|
@@ -4529,6 +5003,7 @@ class WorkflowDesignerComponent {
|
|
|
4529
5003
|
targetStatus: action.TargetStatus || undefined,
|
|
4530
5004
|
position: action.Position || 1,
|
|
4531
5005
|
caption: action.Caption || '',
|
|
5006
|
+
form: action.Form || undefined,
|
|
4532
5007
|
};
|
|
4533
5008
|
this.state.connections.push(connection);
|
|
4534
5009
|
// Register loaded action
|
|
@@ -4536,6 +5011,44 @@ class WorkflowDesignerComponent {
|
|
|
4536
5011
|
}
|
|
4537
5012
|
}
|
|
4538
5013
|
});
|
|
5014
|
+
this.ensureHorizontalArrowClearance();
|
|
5015
|
+
}
|
|
5016
|
+
}
|
|
5017
|
+
ensureHorizontalArrowClearance() {
|
|
5018
|
+
const MIN_GAP = 120;
|
|
5019
|
+
const allNodes = this.state.swimlanes.flatMap((lane) => lane.nodes || []);
|
|
5020
|
+
for (let pass = 0; pass < 3; pass++) {
|
|
5021
|
+
let shifted = false;
|
|
5022
|
+
const sortedConns = [...this.state.connections].sort((a, b) => {
|
|
5023
|
+
const ax = this.state.findNodeById(a.sourceNodeId)?.node.x ?? 0;
|
|
5024
|
+
const bx = this.state.findNodeById(b.sourceNodeId)?.node.x ?? 0;
|
|
5025
|
+
return ax - bx;
|
|
5026
|
+
});
|
|
5027
|
+
for (const conn of sortedConns) {
|
|
5028
|
+
const src = this.state.findNodeById(conn.sourceNodeId)?.node;
|
|
5029
|
+
const tgt = this.state.findNodeById(conn.targetNodeId)?.node;
|
|
5030
|
+
if (!src || !tgt || src.id === tgt.id)
|
|
5031
|
+
continue;
|
|
5032
|
+
const srcPt = src.connectionPoints?.find((p) => p.id === conn.sourcePointId);
|
|
5033
|
+
const tgtPt = tgt.connectionPoints?.find((p) => p.id === conn.targetPointId);
|
|
5034
|
+
if (srcPt?.type !== 'right' || tgtPt?.type !== 'left')
|
|
5035
|
+
continue;
|
|
5036
|
+
if (tgt.x < src.x)
|
|
5037
|
+
continue;
|
|
5038
|
+
const gap = tgt.x - (src.x + src.width);
|
|
5039
|
+
if (gap < MIN_GAP) {
|
|
5040
|
+
const delta = MIN_GAP - gap;
|
|
5041
|
+
const thresholdX = tgt.x;
|
|
5042
|
+
allNodes.forEach((n) => {
|
|
5043
|
+
if (n.x >= thresholdX) {
|
|
5044
|
+
n.x += delta;
|
|
5045
|
+
}
|
|
5046
|
+
});
|
|
5047
|
+
shifted = true;
|
|
5048
|
+
}
|
|
5049
|
+
}
|
|
5050
|
+
if (!shifted)
|
|
5051
|
+
break;
|
|
4539
5052
|
}
|
|
4540
5053
|
}
|
|
4541
5054
|
// Helper method to find swimlane index by Lane ID
|
|
@@ -5175,6 +5688,7 @@ class TransformerService {
|
|
|
5175
5688
|
PassOnRule: '', // Optional property
|
|
5176
5689
|
Position: conn.position,
|
|
5177
5690
|
Caption: conn.caption,
|
|
5691
|
+
Form: conn.form,
|
|
5178
5692
|
};
|
|
5179
5693
|
});
|
|
5180
5694
|
workflow.Stages = stages;
|
|
@@ -5252,6 +5766,7 @@ class TransformerService {
|
|
|
5252
5766
|
action: action.OperationAction,
|
|
5253
5767
|
position: action.Position,
|
|
5254
5768
|
caption: action.Caption,
|
|
5769
|
+
form: action.Form,
|
|
5255
5770
|
};
|
|
5256
5771
|
this.state.connections.push(connection);
|
|
5257
5772
|
// Register loaded action
|