@flowuent-org/diagramming-core 1.0.5 → 1.0.7
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/TRANSLATION_FIX_SUMMARY.md +118 -0
- package/apps/diagramming/src/DiagramTabs.tsx +205 -205
- package/apps/diagramming/src/sample-workflow-content.ts +55 -54
- package/package.json +116 -116
- package/packages/diagrams/I18N_SETUP.md +126 -0
- package/packages/diagrams/NODE_DATA_UPDATE_API.md +430 -430
- package/packages/diagrams/README.md +443 -3
- package/packages/diagrams/UNDO_REDO_API.md +306 -306
- package/packages/diagrams/locales/en/translation.json +713 -0
- package/packages/diagrams/package.json +5 -23
- package/packages/diagrams/pnpm-lock.yaml +2606 -0
- package/packages/diagrams/project.json +42 -38
- package/packages/diagrams/rollup.config.js +5 -10
- package/packages/diagrams/src/index.ts +116 -113
- package/packages/diagrams/src/lib/atoms/CardEditableTitle.tsx +76 -76
- package/packages/diagrams/src/lib/components/automation/AutomationApiNode.tsx +24 -3
- package/packages/diagrams/src/lib/components/automation/AutomationEndNode.tsx +23 -2
- package/packages/diagrams/src/lib/components/automation/AutomationFormattingNode.tsx +24 -3
- package/packages/diagrams/src/lib/components/automation/AutomationStartNode.tsx +24 -3
- package/packages/diagrams/src/lib/contexts/onWorkflowNodeDelete.ts +1 -1
- package/packages/diagrams/src/lib/i18n.ts +42 -0
- package/packages/diagrams/src/lib/organisms/CustomEdge/useCreateBendPoint.tsx +121 -119
- package/packages/diagrams/src/lib/organisms/WorkFlowNode/NodeActionButtons.tsx +1 -1
- package/packages/diagrams/src/lib/templates/node-forms/CallForm.tsx +370 -370
- package/packages/diagrams/src/lib/types/node-types.ts +29 -29
- package/packages/diagrams/src/lib/utils/AutomationExecutionEngine.ts +1168 -1162
- package/packages/diagrams/tsconfig.lib.json +1 -3
- package/tsconfig.base.json +1 -1
|
@@ -43,7 +43,7 @@ export const AutomationStartNode: React.FC<AutomationStartNodeProps> = ({ data,
|
|
|
43
43
|
// Get the icon component based on the iconName
|
|
44
44
|
const IconComponent = getIconByName(data.iconName);
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
|
|
47
47
|
|
|
48
48
|
const handleJsonClick = () => {
|
|
49
49
|
if (nodeId) setSelectedNode(nodeId);
|
|
@@ -208,6 +208,19 @@ export const AutomationStartNode: React.FC<AutomationStartNodeProps> = ({ data,
|
|
|
208
208
|
transition: 'all 0.2s ease',
|
|
209
209
|
cursor: 'pointer',
|
|
210
210
|
overflow: 'hidden',
|
|
211
|
+
...(data.status === 'Running' && {
|
|
212
|
+
animation: 'pulse-glow 2s ease-in-out infinite',
|
|
213
|
+
'@keyframes pulse-glow': {
|
|
214
|
+
'0%, 100%': {
|
|
215
|
+
boxShadow: '0 0 20px rgba(251, 191, 36, 0.4), 0 0 40px rgba(251, 191, 36, 0.2)',
|
|
216
|
+
borderColor: 'rgba(251, 191, 36, 0.6)',
|
|
217
|
+
},
|
|
218
|
+
'50%': {
|
|
219
|
+
boxShadow: '0 0 30px rgba(251, 191, 36, 0.6), 0 0 60px rgba(251, 191, 36, 0.3)',
|
|
220
|
+
borderColor: 'rgba(251, 191, 36, 0.9)',
|
|
221
|
+
},
|
|
222
|
+
},
|
|
223
|
+
}),
|
|
211
224
|
}}
|
|
212
225
|
onClick={handleJsonClick}
|
|
213
226
|
>
|
|
@@ -252,8 +265,16 @@ export const AutomationStartNode: React.FC<AutomationStartNodeProps> = ({ data,
|
|
|
252
265
|
label={data.status}
|
|
253
266
|
size="small"
|
|
254
267
|
sx={{
|
|
255
|
-
backgroundColor:
|
|
256
|
-
|
|
268
|
+
backgroundColor: data.status === 'Completed'
|
|
269
|
+
? 'rgba(37, 99, 235, 0.1)'
|
|
270
|
+
: data.status === 'Running'
|
|
271
|
+
? 'rgba(251, 191, 36, 0.1)'
|
|
272
|
+
: 'rgba(16, 185, 129, 0.1)',
|
|
273
|
+
color: data.status === 'Completed'
|
|
274
|
+
? '#93C5FD'
|
|
275
|
+
: data.status === 'Running'
|
|
276
|
+
? '#FCD34D'
|
|
277
|
+
: '#86EFAC',
|
|
257
278
|
fontWeight: 500,
|
|
258
279
|
fontSize: '12px',
|
|
259
280
|
height: '24px',
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import i18n from 'i18next';
|
|
2
|
+
import { initReactI18next } from 'react-i18next';
|
|
3
|
+
|
|
4
|
+
// Import translation resources
|
|
5
|
+
import translationEN from '../../locales/en/translation.json';
|
|
6
|
+
|
|
7
|
+
// Initialize i18next for the diagrams library
|
|
8
|
+
export const initDiagramsI18n = (customResources?: any) => {
|
|
9
|
+
// Only initialize if not already initialized
|
|
10
|
+
if (!i18n.isInitialized) {
|
|
11
|
+
i18n.use(initReactI18next).init({
|
|
12
|
+
resources: customResources || {
|
|
13
|
+
en: {
|
|
14
|
+
translation: translationEN,
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
fallbackLng: 'en',
|
|
18
|
+
debug: false,
|
|
19
|
+
interpolation: {
|
|
20
|
+
escapeValue: false,
|
|
21
|
+
},
|
|
22
|
+
// Add namespace for the library to avoid conflicts
|
|
23
|
+
defaultNS: 'translation',
|
|
24
|
+
});
|
|
25
|
+
} else if (customResources) {
|
|
26
|
+
// If already initialized, add resources to existing instance
|
|
27
|
+
Object.keys(customResources).forEach((lng) => {
|
|
28
|
+
Object.keys(customResources[lng]).forEach((ns) => {
|
|
29
|
+
i18n.addResourceBundle(lng, ns, customResources[lng][ns], true, true);
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return i18n;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// Export translation resources for manual initialization
|
|
38
|
+
export { translationEN };
|
|
39
|
+
|
|
40
|
+
// Export configured i18n instance
|
|
41
|
+
export default i18n;
|
|
42
|
+
|
|
@@ -1,119 +1,121 @@
|
|
|
1
|
-
import { Edge } from '@xyflow/react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
import
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
1
|
+
import { Edge } from '@xyflow/react';
|
|
2
|
+
import {
|
|
3
|
+
closestPoint,
|
|
4
|
+
DiagramStore,
|
|
5
|
+
EdgeTypes,
|
|
6
|
+
HistoryEvent,
|
|
7
|
+
ICardNode,
|
|
8
|
+
useCustomReactFlow,
|
|
9
|
+
useDiagram,
|
|
10
|
+
} from '@flowuent-labs/diagrams';
|
|
11
|
+
import React, { useCallback } from 'react';
|
|
12
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
13
|
+
import addToHistory from '../../utils/addToHistory';
|
|
14
|
+
|
|
15
|
+
export const useCreateBendPoint = (
|
|
16
|
+
currentEdge: Edge,
|
|
17
|
+
sourceNode: ICardNode,
|
|
18
|
+
targetNode: ICardNode,
|
|
19
|
+
pathRef: React.RefObject<SVGPathElement>,
|
|
20
|
+
) => {
|
|
21
|
+
const { setEdges, getEdge, screenToFlowPosition, addNodes } =
|
|
22
|
+
useCustomReactFlow();
|
|
23
|
+
const store = useDiagram<DiagramStore>();
|
|
24
|
+
const { diagramType, nodes, edges, setStore } = store;
|
|
25
|
+
|
|
26
|
+
return useCallback(
|
|
27
|
+
(evt: React.MouseEvent<SVGPathElement, MouseEvent>) => {
|
|
28
|
+
if (diagramType === 'workflow') {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
evt.preventDefault();
|
|
32
|
+
evt.stopPropagation();
|
|
33
|
+
if (!pathRef.current) return;
|
|
34
|
+
|
|
35
|
+
const position = screenToFlowPosition({
|
|
36
|
+
x: evt.clientX,
|
|
37
|
+
y: evt.clientY,
|
|
38
|
+
});
|
|
39
|
+
const cpoint = closestPoint(pathRef.current, [position.x, position.y]);
|
|
40
|
+
if (!currentEdge || !sourceNode || !targetNode)
|
|
41
|
+
throw new Error(
|
|
42
|
+
'Invalid Edge found with source, target or curr edge missing',
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
const nodesAndEdgesBefore = {
|
|
46
|
+
nodes: [...nodes],
|
|
47
|
+
edges: [...edges],
|
|
48
|
+
};
|
|
49
|
+
const nodeId = uuidv4();
|
|
50
|
+
const newBendPoint: ICardNode = {
|
|
51
|
+
id: nodeId,
|
|
52
|
+
position: { x: cpoint[0], y: cpoint[1] },
|
|
53
|
+
data: { nodeId: nodeId },
|
|
54
|
+
type: 'bendPoint',
|
|
55
|
+
};
|
|
56
|
+
const newEdge: Edge = {
|
|
57
|
+
id: uuidv4(),
|
|
58
|
+
source: newBendPoint.id,
|
|
59
|
+
target: currentEdge.target,
|
|
60
|
+
type:
|
|
61
|
+
currentEdge.type === EdgeTypes.Default ||
|
|
62
|
+
currentEdge.type === EdgeTypes.Bend2Target
|
|
63
|
+
? EdgeTypes.Bend2Target
|
|
64
|
+
: EdgeTypes.Bend2Bend,
|
|
65
|
+
};
|
|
66
|
+
newEdge.markerEnd =
|
|
67
|
+
newEdge.type === EdgeTypes.Bend2Target
|
|
68
|
+
? currentEdge.markerEnd
|
|
69
|
+
: undefined;
|
|
70
|
+
currentEdge.target = newBendPoint.id;
|
|
71
|
+
currentEdge.type =
|
|
72
|
+
currentEdge.type === EdgeTypes.Default ||
|
|
73
|
+
currentEdge.type === EdgeTypes.Source2Bend
|
|
74
|
+
? EdgeTypes.Source2Bend
|
|
75
|
+
: EdgeTypes.Bend2Bend;
|
|
76
|
+
delete currentEdge.markerEnd;
|
|
77
|
+
currentEdge.markerStart =
|
|
78
|
+
currentEdge.type === EdgeTypes.Source2Bend
|
|
79
|
+
? currentEdge.markerStart
|
|
80
|
+
: undefined;
|
|
81
|
+
|
|
82
|
+
const newEdges = [
|
|
83
|
+
...edges.filter((e) => e.id !== currentEdge.id),
|
|
84
|
+
currentEdge,
|
|
85
|
+
newEdge,
|
|
86
|
+
];
|
|
87
|
+
const newNodes = [...nodes, newBendPoint];
|
|
88
|
+
const nodesAndEdgesAfter = {
|
|
89
|
+
nodes: newNodes,
|
|
90
|
+
edges: newEdges,
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
const event: HistoryEvent = {
|
|
94
|
+
forward: {
|
|
95
|
+
t: 'complex-change',
|
|
96
|
+
type: 'complex',
|
|
97
|
+
nodesAndEdges: nodesAndEdgesAfter,
|
|
98
|
+
},
|
|
99
|
+
backward: {
|
|
100
|
+
t: 'complex-change',
|
|
101
|
+
type: 'complex',
|
|
102
|
+
nodesAndEdges: nodesAndEdgesBefore,
|
|
103
|
+
},
|
|
104
|
+
title: 'Bend point created in the middle of ' + currentEdge.id,
|
|
105
|
+
};
|
|
106
|
+
setStore({
|
|
107
|
+
...addToHistory(store, [event]),
|
|
108
|
+
...nodesAndEdgesAfter,
|
|
109
|
+
});
|
|
110
|
+
},
|
|
111
|
+
[
|
|
112
|
+
pathRef.current,
|
|
113
|
+
currentEdge.id,
|
|
114
|
+
getEdge,
|
|
115
|
+
setEdges,
|
|
116
|
+
addNodes,
|
|
117
|
+
sourceNode,
|
|
118
|
+
targetNode,
|
|
119
|
+
],
|
|
120
|
+
);
|
|
121
|
+
};
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { Button } from '@mui/material';
|
|
3
3
|
import { WorkflowNodeActionButtons } from '../../molecules/WorkflowNodeActionButtons';
|
|
4
4
|
import { ICardNode } from '../../types/card-node';
|
|
5
|
-
import { useNodeType } from '
|
|
5
|
+
import { useNodeType } from '@flowuent-labs/diagrams';
|
|
6
6
|
|
|
7
7
|
interface NodeActionButtonsProps {
|
|
8
8
|
addButtonVisible: boolean;
|