@topconsultnpm/sdkui-react-beta 6.16.96 → 6.16.97
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/lib/components/features/workflow/diagram/WFDiagram.js +3 -28
- package/lib/components/features/workflow/diagram/workflowHelpers.d.ts +2 -1
- package/lib/components/features/workflow/diagram/workflowHelpers.js +40 -1
- package/lib/components/index.d.ts +2 -0
- package/lib/components/index.js +2 -0
- package/package.json +1 -1
|
@@ -7,7 +7,7 @@ import { CultureIDs, SearchEngine, WFAppTypes, WorkItemStatus } from "@topconsul
|
|
|
7
7
|
import ConnectionComponent from './ConnectionComponent';
|
|
8
8
|
import DiagramItemComponent from './DiagramItemComponent';
|
|
9
9
|
import DiagramItemSvgContent from './DiagramItemSvgContent';
|
|
10
|
-
import { calculateArrowAngle, downloadFile, getConnectionPoint, isConnectionNonLinear, validateDiagram } from './workflowHelpers';
|
|
10
|
+
import { calculateArrowAngle, downloadFile, getConnectionPoint, getNewWfDiagram, isConnectionNonLinear, validateDiagram } from './workflowHelpers';
|
|
11
11
|
import { IconFlowChart, IconUndo, IconRestore, IconAdjust, IconCopy, IconCut, IconPaste, IconPin, IconUnpin, IconChevronRight, IconCloseOutline, IconNew, SDKUI_Localizator, generateUUID, IconExport, IconImport, IconWindowMaximize, IconZoomIn, IconZoomOut, IconPencil, IconLock } from '../../../../helper';
|
|
12
12
|
import { ButtonNames, TMExceptionBoxManager, TMMessageBoxManager } from '../../../base/TMPopUp';
|
|
13
13
|
import { StyledLoadingContainer, StyledSpinner } from '../../../base/Styled';
|
|
@@ -548,33 +548,8 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, allowEdit = true, onDiagram
|
|
|
548
548
|
const handleNew = useCallback(() => {
|
|
549
549
|
if (isReadOnly)
|
|
550
550
|
return;
|
|
551
|
-
const
|
|
552
|
-
|
|
553
|
-
Left: 100,
|
|
554
|
-
Top: 100,
|
|
555
|
-
Width: 64,
|
|
556
|
-
Height: 64,
|
|
557
|
-
Type: DiagramItemTypes.Start,
|
|
558
|
-
ItemName: '',
|
|
559
|
-
Description: '',
|
|
560
|
-
};
|
|
561
|
-
const endItem = {
|
|
562
|
-
ID: generateUUID(),
|
|
563
|
-
Left: 300,
|
|
564
|
-
Top: 100,
|
|
565
|
-
Width: 64,
|
|
566
|
-
Height: 64,
|
|
567
|
-
Type: DiagramItemTypes.End,
|
|
568
|
-
ItemName: '',
|
|
569
|
-
Description: '',
|
|
570
|
-
};
|
|
571
|
-
const newWfDiagram = {
|
|
572
|
-
DiagramItems: [startItem, endItem],
|
|
573
|
-
Connections: [],
|
|
574
|
-
Info: wfDiagram?.Info || null,
|
|
575
|
-
};
|
|
576
|
-
setWfDiagram(newWfDiagram);
|
|
577
|
-
initialDiagramRef.current = newWfDiagram;
|
|
551
|
+
const newWfDiagram = getNewWfDiagram(wfDiagram?.Info || null);
|
|
552
|
+
updateDiagram(newWfDiagram);
|
|
578
553
|
setWfDiagramHistory([newWfDiagram]);
|
|
579
554
|
setHistoryIndex(0);
|
|
580
555
|
setSelectedItems(new Set());
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WorkItemStatus } from '@topconsultnpm/sdk-ts-beta';
|
|
2
|
-
import { Point, Rect, DiagramItem, WfDiagram, TextDimensions, Connection } from './interfaces';
|
|
2
|
+
import { Point, Rect, DiagramItem, WfDiagram, TextDimensions, Connection, WfInfo } from './interfaces';
|
|
3
3
|
/**
|
|
4
4
|
* Calculates the angle in degrees of an arrow based on two points.
|
|
5
5
|
* @param prevPoint The previous point on the trajectory.
|
|
@@ -66,3 +66,4 @@ export declare const calculateDiagramItemFullDimensions: (item: DiagramItem, tex
|
|
|
66
66
|
export declare const getConnectionColor: (status: WorkItemStatus) => string;
|
|
67
67
|
export declare const validateDiagram: (diagram: WfDiagram, newConnection?: Connection) => void;
|
|
68
68
|
export declare const downloadFile: (data: string, filename: string, type: string) => void;
|
|
69
|
+
export declare const getNewWfDiagram: (info: WfInfo | null) => WfDiagram;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { WorkItemStatus } from '@topconsultnpm/sdk-ts-beta';
|
|
2
|
-
import { DiagramItemTypes } from './interfaces'; // Assicurati che il percorso sia corretto
|
|
2
|
+
import { DiagramItemTypes, ArrowSymbol } from './interfaces'; // Assicurati che il percorso sia corretto
|
|
3
|
+
import { generateUUID } from '../../../../helper';
|
|
3
4
|
/**
|
|
4
5
|
* Calculates the angle in degrees of an arrow based on two points.
|
|
5
6
|
* @param prevPoint The previous point on the trajectory.
|
|
@@ -253,3 +254,41 @@ export const downloadFile = (data, filename, type) => {
|
|
|
253
254
|
document.body.removeChild(a);
|
|
254
255
|
window.URL.revokeObjectURL(url);
|
|
255
256
|
};
|
|
257
|
+
export const getNewWfDiagram = (info) => {
|
|
258
|
+
const startItem = {
|
|
259
|
+
ID: generateUUID(),
|
|
260
|
+
Left: 100,
|
|
261
|
+
Top: 100,
|
|
262
|
+
Width: 64,
|
|
263
|
+
Height: 64,
|
|
264
|
+
Type: DiagramItemTypes.Start,
|
|
265
|
+
ItemName: '',
|
|
266
|
+
Description: '',
|
|
267
|
+
};
|
|
268
|
+
const endItem = {
|
|
269
|
+
ID: generateUUID(),
|
|
270
|
+
Left: 300,
|
|
271
|
+
Top: 100,
|
|
272
|
+
Width: 64,
|
|
273
|
+
Height: 64,
|
|
274
|
+
Type: DiagramItemTypes.End,
|
|
275
|
+
ItemName: '',
|
|
276
|
+
Description: '',
|
|
277
|
+
};
|
|
278
|
+
const newConnection = {
|
|
279
|
+
ID: generateUUID(),
|
|
280
|
+
Source: { ParentDiagramItem: { ID: startItem.ID }, ConnectorName: 'Right' },
|
|
281
|
+
Sink: { ParentDiagramItem: { ID: endItem.ID }, ConnectorName: 'Left' },
|
|
282
|
+
OutputStatus: WorkItemStatus.New,
|
|
283
|
+
Description: "New Connection",
|
|
284
|
+
PathGeometry: "",
|
|
285
|
+
SourceArrowSymbol: ArrowSymbol.None,
|
|
286
|
+
SinkArrowSymbol: ArrowSymbol.Arrow,
|
|
287
|
+
};
|
|
288
|
+
const newWfDiagram = {
|
|
289
|
+
DiagramItems: [startItem, endItem],
|
|
290
|
+
Connections: [newConnection],
|
|
291
|
+
Info: info,
|
|
292
|
+
};
|
|
293
|
+
return newWfDiagram;
|
|
294
|
+
};
|
|
@@ -92,4 +92,6 @@ export * from "./layout/panelManager/TMPanelWrapper";
|
|
|
92
92
|
export * from "./layout/panelManager/types";
|
|
93
93
|
export * from "./layout/panelManager/utils";
|
|
94
94
|
export * from "./features/workflow/diagram/WFDiagram";
|
|
95
|
+
export * from "./features/workflow/diagram/workflowHelpers";
|
|
96
|
+
export * from "./features/workflow/diagram/xmlParser";
|
|
95
97
|
export * from "./features/workflow/diagram/interfaces";
|
package/lib/components/index.js
CHANGED
|
@@ -112,4 +112,6 @@ export * from "./layout/panelManager/types";
|
|
|
112
112
|
export * from "./layout/panelManager/utils";
|
|
113
113
|
// workflow
|
|
114
114
|
export * from "./features/workflow/diagram/WFDiagram";
|
|
115
|
+
export * from "./features/workflow/diagram/workflowHelpers";
|
|
116
|
+
export * from "./features/workflow/diagram/xmlParser";
|
|
115
117
|
export * from "./features/workflow/diagram/interfaces";
|