@flowuent-org/diagramming-core 1.0.8 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/apps/diagramming/src/AutomationDiagramData.ts +22 -0
  2. package/apps/diagramming/src/components/AddNodeView.tsx +252 -252
  3. package/apps/diagramming/src/main.tsx +463 -463
  4. package/apps/diagramming/src/node-data.ts +664 -664
  5. package/apps/diagramming/src/stencil-items.ts +31 -31
  6. package/apps/diagramming/src/vite-env.d.ts +1 -1
  7. package/package.json +1 -1
  8. package/packages/diagrams/NODE_DATA_UPDATE_API.md +430 -430
  9. package/packages/diagrams/README.md +7 -463
  10. package/packages/diagrams/UNDO_REDO_API.md +306 -306
  11. package/packages/diagrams/package.json +27 -27
  12. package/packages/diagrams/project.json +42 -42
  13. package/packages/diagrams/rollup.config.js +26 -26
  14. package/packages/diagrams/src/DiagramFlow.tsx +7 -7
  15. package/packages/diagrams/src/index.ts +116 -116
  16. package/packages/diagrams/src/index.ts.bak +99 -99
  17. package/packages/diagrams/src/lib/atoms/CardEditableTitle.tsx +76 -76
  18. package/packages/diagrams/src/lib/atoms/ExpressionInput.tsx +437 -437
  19. package/packages/diagrams/src/lib/components/DiagramPanel.tsx +331 -331
  20. package/packages/diagrams/src/lib/components/automation/AISuggestionsModal.tsx +269 -0
  21. package/packages/diagrams/src/lib/components/automation/AISuggestionsPanel.tsx +227 -0
  22. package/packages/diagrams/src/lib/components/automation/AutomationAISuggestionNode.tsx +178 -115
  23. package/packages/diagrams/src/lib/components/automation/AutomationApiNode.tsx +133 -27
  24. package/packages/diagrams/src/lib/components/automation/AutomationEndNode.tsx +134 -28
  25. package/packages/diagrams/src/lib/components/automation/AutomationFormattingNode.tsx +132 -27
  26. package/packages/diagrams/src/lib/components/automation/AutomationNoteNode.tsx +124 -17
  27. package/packages/diagrams/src/lib/components/automation/AutomationSheetsNode.tsx +122 -15
  28. package/packages/diagrams/src/lib/components/automation/index.ts +3 -0
  29. package/packages/diagrams/src/lib/contexts/onWorkflowNodeDelete.ts +65 -65
  30. package/packages/diagrams/src/lib/organisms/CustomEdge/useCreateBendPoint.tsx +121 -121
  31. package/packages/diagrams/src/lib/organisms/WorkFlowNode/NodeActionButtons.tsx +45 -45
  32. package/packages/diagrams/src/lib/templates/node-forms/CallForm.tsx +370 -370
  33. package/packages/diagrams/src/lib/templates/systemFlow/components/FloatingEdge.tsx +219 -219
  34. package/packages/diagrams/src/lib/types/card-node.ts +68 -68
  35. package/packages/diagrams/src/lib/types/node-types.ts +29 -29
  36. package/packages/diagrams/src/lib/utils/AutomationExecutionEngine.ts +1179 -1179
  37. package/packages/diagrams/tsconfig.lib.json +25 -25
  38. package/tsconfig.base.json +29 -30
  39. package/TRANSLATION_FIX_SUMMARY.md +0 -118
  40. package/packages/diagrams/I18N_SETUP.md +0 -126
@@ -1,76 +1,76 @@
1
- import React, { useCallback, useEffect, useRef, useState } from 'react';
2
- import { Box, TextField } from '@mui/material';
3
- import { ICardNode } from '../types/card-node';
4
- import { useCustomReactFlow } from '../hooks/customUseReactFlow';
5
- import { useNodeId, useNodeTitle } from '@flowuent-labs/diagrams';
6
-
7
- export const CardEditableTitle = React.memo(() => {
8
- const title = useNodeTitle()
9
- const nodeId = useNodeId()
10
- const { getNodes, setNodes } = useCustomReactFlow();
11
- const [text, setText] = useState(title);
12
- const inputRef = useRef<HTMLInputElement>(null);
13
-
14
- useEffect(() => {
15
- if (title !== text) setText(title);
16
- }, [title]);
17
-
18
- const changeTitle = useCallback(
19
- (val: string) => {
20
- const prevNodes = [...getNodes()] as ICardNode[];
21
- const newNodes: ICardNode[] = prevNodes.map((node) => {
22
- if (node.id === nodeId) {
23
- return {
24
- ...node,
25
- data: { ...node.data, title: val },
26
- };
27
- } else return node;
28
- });
29
- setNodes(newNodes);
30
- },
31
- [getNodes, setNodes, nodeId],
32
- );
33
-
34
- const handleSave = useCallback(() => {
35
- changeTitle(text ?? '');
36
- }, [text, changeTitle]);
37
-
38
- const handleKeyDown = useCallback(
39
- (e: React.KeyboardEvent<HTMLInputElement>) => {
40
- if (e.key === 'Enter') {
41
- handleSave();
42
- } else if (e.key === 'Escape') {
43
- setText(title);
44
- }
45
- },
46
- [handleSave, title],
47
- );
48
-
49
- return (
50
- <Box
51
- sx={{
52
- display: 'flex',
53
- justifyContent: 'center',
54
- width: '100%',
55
- my: 1,
56
- backgroundColor: '#6B04F1',
57
- borderRadius: '3px',
58
- }}
59
- >
60
- <TextField
61
- size={'small'}
62
- inputProps={{
63
- style: { fontSize: '18px', fontWeight: 'bold', textAlign: 'center', color: '#fff' },
64
- }}
65
- variant="outlined"
66
- value={text}
67
- onChange={(e) => setText(e.target.value)}
68
- onKeyDown={handleKeyDown}
69
- inputRef={inputRef}
70
- fullWidth
71
- />
72
- </Box>
73
- );
74
- });
75
-
76
- export default CardEditableTitle;
1
+ import React, { useCallback, useEffect, useRef, useState } from 'react';
2
+ import { Box, TextField } from '@mui/material';
3
+ import { ICardNode } from '../types/card-node';
4
+ import { useCustomReactFlow } from '../hooks/customUseReactFlow';
5
+ import { useNodeId, useNodeTitle } from '@flowuent-labs/diagrams';
6
+
7
+ export const CardEditableTitle = React.memo(() => {
8
+ const title = useNodeTitle()
9
+ const nodeId = useNodeId()
10
+ const { getNodes, setNodes } = useCustomReactFlow();
11
+ const [text, setText] = useState(title);
12
+ const inputRef = useRef<HTMLInputElement>(null);
13
+
14
+ useEffect(() => {
15
+ if (title !== text) setText(title);
16
+ }, [title]);
17
+
18
+ const changeTitle = useCallback(
19
+ (val: string) => {
20
+ const prevNodes = [...getNodes()] as ICardNode[];
21
+ const newNodes: ICardNode[] = prevNodes.map((node) => {
22
+ if (node.id === nodeId) {
23
+ return {
24
+ ...node,
25
+ data: { ...node.data, title: val },
26
+ };
27
+ } else return node;
28
+ });
29
+ setNodes(newNodes);
30
+ },
31
+ [getNodes, setNodes, nodeId],
32
+ );
33
+
34
+ const handleSave = useCallback(() => {
35
+ changeTitle(text ?? '');
36
+ }, [text, changeTitle]);
37
+
38
+ const handleKeyDown = useCallback(
39
+ (e: React.KeyboardEvent<HTMLInputElement>) => {
40
+ if (e.key === 'Enter') {
41
+ handleSave();
42
+ } else if (e.key === 'Escape') {
43
+ setText(title);
44
+ }
45
+ },
46
+ [handleSave, title],
47
+ );
48
+
49
+ return (
50
+ <Box
51
+ sx={{
52
+ display: 'flex',
53
+ justifyContent: 'center',
54
+ width: '100%',
55
+ my: 1,
56
+ backgroundColor: '#6B04F1',
57
+ borderRadius: '3px',
58
+ }}
59
+ >
60
+ <TextField
61
+ size={'small'}
62
+ inputProps={{
63
+ style: { fontSize: '18px', fontWeight: 'bold', textAlign: 'center', color: '#fff' },
64
+ }}
65
+ variant="outlined"
66
+ value={text}
67
+ onChange={(e) => setText(e.target.value)}
68
+ onKeyDown={handleKeyDown}
69
+ inputRef={inputRef}
70
+ fullWidth
71
+ />
72
+ </Box>
73
+ );
74
+ });
75
+
76
+ export default CardEditableTitle;