@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.
- package/apps/diagramming/src/AutomationDiagramData.ts +22 -0
- package/apps/diagramming/src/components/AddNodeView.tsx +252 -252
- package/apps/diagramming/src/main.tsx +463 -463
- package/apps/diagramming/src/node-data.ts +664 -664
- package/apps/diagramming/src/stencil-items.ts +31 -31
- package/apps/diagramming/src/vite-env.d.ts +1 -1
- package/package.json +1 -1
- package/packages/diagrams/NODE_DATA_UPDATE_API.md +430 -430
- package/packages/diagrams/README.md +7 -463
- package/packages/diagrams/UNDO_REDO_API.md +306 -306
- package/packages/diagrams/package.json +27 -27
- package/packages/diagrams/project.json +42 -42
- package/packages/diagrams/rollup.config.js +26 -26
- package/packages/diagrams/src/DiagramFlow.tsx +7 -7
- package/packages/diagrams/src/index.ts +116 -116
- package/packages/diagrams/src/index.ts.bak +99 -99
- package/packages/diagrams/src/lib/atoms/CardEditableTitle.tsx +76 -76
- package/packages/diagrams/src/lib/atoms/ExpressionInput.tsx +437 -437
- package/packages/diagrams/src/lib/components/DiagramPanel.tsx +331 -331
- package/packages/diagrams/src/lib/components/automation/AISuggestionsModal.tsx +269 -0
- package/packages/diagrams/src/lib/components/automation/AISuggestionsPanel.tsx +227 -0
- package/packages/diagrams/src/lib/components/automation/AutomationAISuggestionNode.tsx +178 -115
- package/packages/diagrams/src/lib/components/automation/AutomationApiNode.tsx +133 -27
- package/packages/diagrams/src/lib/components/automation/AutomationEndNode.tsx +134 -28
- package/packages/diagrams/src/lib/components/automation/AutomationFormattingNode.tsx +132 -27
- package/packages/diagrams/src/lib/components/automation/AutomationNoteNode.tsx +124 -17
- package/packages/diagrams/src/lib/components/automation/AutomationSheetsNode.tsx +122 -15
- package/packages/diagrams/src/lib/components/automation/index.ts +3 -0
- package/packages/diagrams/src/lib/contexts/onWorkflowNodeDelete.ts +65 -65
- package/packages/diagrams/src/lib/organisms/CustomEdge/useCreateBendPoint.tsx +121 -121
- package/packages/diagrams/src/lib/organisms/WorkFlowNode/NodeActionButtons.tsx +45 -45
- package/packages/diagrams/src/lib/templates/node-forms/CallForm.tsx +370 -370
- package/packages/diagrams/src/lib/templates/systemFlow/components/FloatingEdge.tsx +219 -219
- package/packages/diagrams/src/lib/types/card-node.ts +68 -68
- package/packages/diagrams/src/lib/types/node-types.ts +29 -29
- package/packages/diagrams/src/lib/utils/AutomationExecutionEngine.ts +1179 -1179
- package/packages/diagrams/tsconfig.lib.json +25 -25
- package/tsconfig.base.json +29 -30
- package/TRANSLATION_FIX_SUMMARY.md +0 -118
- package/packages/diagrams/I18N_SETUP.md +0 -126
|
@@ -1,463 +1,463 @@
|
|
|
1
|
-
import '../../workflow/i18n';
|
|
2
|
-
import ReactDOM from 'react-dom/client';
|
|
3
|
-
import {
|
|
4
|
-
Change,
|
|
5
|
-
Controls,
|
|
6
|
-
DiagrammingPage,
|
|
7
|
-
DownloadPanel,
|
|
8
|
-
HistoryPane,
|
|
9
|
-
MiniMap,
|
|
10
|
-
PropertiesPane,
|
|
11
|
-
SmartDynamicFormField,
|
|
12
|
-
Stencil,
|
|
13
|
-
} from '@flowuent-labs/diagrams';
|
|
14
|
-
import { BrowserRouter as Router, Route, Routes } from 'react-router-dom';
|
|
15
|
-
import {
|
|
16
|
-
archEdges,
|
|
17
|
-
archNodes,
|
|
18
|
-
classDefaultEdges,
|
|
19
|
-
classDefaultNodes,
|
|
20
|
-
workflowDefaultNodesAndEdges,
|
|
21
|
-
} from './node-data';
|
|
22
|
-
import { stencilItems } from './stencil-items';
|
|
23
|
-
import React from 'react';
|
|
24
|
-
import DiagramTabs from './DiagramTabs';
|
|
25
|
-
import {
|
|
26
|
-
useCaseDefaultEdges,
|
|
27
|
-
useCaseDefaultNodes,
|
|
28
|
-
} from './UseCaseDiagramData';
|
|
29
|
-
import {
|
|
30
|
-
sequenceDiagramEdges,
|
|
31
|
-
sequenceDiagramNodes,
|
|
32
|
-
} from './SequenceDiagramData';
|
|
33
|
-
import {
|
|
34
|
-
stateMachineDefaultNodes,
|
|
35
|
-
stateMachineDefaultEdges,
|
|
36
|
-
} from './StateMachineDiagramData';
|
|
37
|
-
import {
|
|
38
|
-
systemFlowDefaultNodes,
|
|
39
|
-
systemFlowDefaultEdges,
|
|
40
|
-
} from '../../../packages/diagrams/src/lib/templates/systemFlow/data/template-data';
|
|
41
|
-
import HomePage from './Pages/Home';
|
|
42
|
-
import { cloudInitialEdges, cloudInitialNodes } from './cloud-data';
|
|
43
|
-
import { collaborationNodes, collaborationEdges } from './CollaborationDiagramData';
|
|
44
|
-
import { automationDefaultNodes, automationDefaultEdges } from './AutomationDiagramData';
|
|
45
|
-
import { NodeForm } from '@flowuent-labs/diagrams';
|
|
46
|
-
import { AddNodeView } from './components/AddNodeView';
|
|
47
|
-
import { colorMap } from '../../../packages/diagrams/src/lib/types/colors';
|
|
48
|
-
import MiniMapCommon from '../../../packages/diagrams/src/lib/components/MiniMapCommon';
|
|
49
|
-
import { ICardNodeData } from '../../../packages/diagrams/src/lib/types/card-node';
|
|
50
|
-
import { AutomationExecutionPanel } from '../../../packages/diagrams/src/lib/components/automation';
|
|
51
|
-
|
|
52
|
-
const edgePropertiesConfig: SmartDynamicFormField[] = [
|
|
53
|
-
{
|
|
54
|
-
type: 'Select',
|
|
55
|
-
props: {
|
|
56
|
-
name: 'markerStart',
|
|
57
|
-
label: 'Marker Start',
|
|
58
|
-
options: 'getMarkerOptions',
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
type: 'Select',
|
|
63
|
-
props: {
|
|
64
|
-
name: 'markerEnd',
|
|
65
|
-
label: 'Marker End',
|
|
66
|
-
options: 'getMarkerOptions',
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
type: 'NumberField',
|
|
71
|
-
props: {
|
|
72
|
-
name: 'style.strokeWidth',
|
|
73
|
-
label: 'Stroke Width',
|
|
74
|
-
validation: {
|
|
75
|
-
type: 'number',
|
|
76
|
-
required: true,
|
|
77
|
-
message: 'Stroke width is required',
|
|
78
|
-
},
|
|
79
|
-
},
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
type: 'Select',
|
|
83
|
-
props: {
|
|
84
|
-
name: 'style.stroke',
|
|
85
|
-
label: 'Stroke Color',
|
|
86
|
-
options: 'getColorOptions',
|
|
87
|
-
validation: {
|
|
88
|
-
type: 'string',
|
|
89
|
-
required: true,
|
|
90
|
-
message: 'Stroke color is required',
|
|
91
|
-
},
|
|
92
|
-
},
|
|
93
|
-
},
|
|
94
|
-
];
|
|
95
|
-
|
|
96
|
-
const nodePropertiesConfig: SmartDynamicFormField[] = [
|
|
97
|
-
{
|
|
98
|
-
type: 'TextField',
|
|
99
|
-
props: {
|
|
100
|
-
name: 'data.title',
|
|
101
|
-
label: 'Title',
|
|
102
|
-
validation: {
|
|
103
|
-
type: 'string',
|
|
104
|
-
required: true,
|
|
105
|
-
message: 'Title is required',
|
|
106
|
-
},
|
|
107
|
-
},
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
type: 'NumberField',
|
|
111
|
-
props: {
|
|
112
|
-
name: 'position.x',
|
|
113
|
-
label: 'X',
|
|
114
|
-
validation: {
|
|
115
|
-
type: 'number',
|
|
116
|
-
required: true,
|
|
117
|
-
message: 'X coordinate is required',
|
|
118
|
-
},
|
|
119
|
-
},
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
type: 'NumberField',
|
|
123
|
-
props: {
|
|
124
|
-
name: 'position.y',
|
|
125
|
-
label: 'Y',
|
|
126
|
-
validation: {
|
|
127
|
-
type: 'number',
|
|
128
|
-
required: true,
|
|
129
|
-
message: 'Y coordinate is required',
|
|
130
|
-
},
|
|
131
|
-
},
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
type: 'Select',
|
|
135
|
-
props: {
|
|
136
|
-
name: 'data.color',
|
|
137
|
-
label: 'Color',
|
|
138
|
-
options: 'getColorOptions',
|
|
139
|
-
validation: {
|
|
140
|
-
type: 'string',
|
|
141
|
-
required: true,
|
|
142
|
-
message: 'Color is required',
|
|
143
|
-
},
|
|
144
|
-
},
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
type: 'NumberField',
|
|
148
|
-
props: {
|
|
149
|
-
name: 'width',
|
|
150
|
-
label: 'Width',
|
|
151
|
-
validation: {
|
|
152
|
-
type: 'number',
|
|
153
|
-
required: true,
|
|
154
|
-
message: 'Width is required',
|
|
155
|
-
},
|
|
156
|
-
},
|
|
157
|
-
},
|
|
158
|
-
{
|
|
159
|
-
type: 'NumberField',
|
|
160
|
-
props: {
|
|
161
|
-
name: 'height',
|
|
162
|
-
label: 'Height',
|
|
163
|
-
validation: {
|
|
164
|
-
type: 'number',
|
|
165
|
-
required: true,
|
|
166
|
-
message: 'Height is required',
|
|
167
|
-
},
|
|
168
|
-
},
|
|
169
|
-
},
|
|
170
|
-
{
|
|
171
|
-
type: 'Switch',
|
|
172
|
-
props: {
|
|
173
|
-
name: 'data.isBlock',
|
|
174
|
-
label: 'Is Block',
|
|
175
|
-
},
|
|
176
|
-
},
|
|
177
|
-
];
|
|
178
|
-
// Common children for DiagrammingPage
|
|
179
|
-
const commonChildren = (
|
|
180
|
-
<>
|
|
181
|
-
{/* <MiniMap
|
|
182
|
-
position="bottom-left"
|
|
183
|
-
pannable
|
|
184
|
-
bgColor="#181818"
|
|
185
|
-
maskColor="rgba(40,40,40,0.6)"
|
|
186
|
-
maskStrokeColor="#888"
|
|
187
|
-
style={{
|
|
188
|
-
border: '1px solid #232323',
|
|
189
|
-
marginBottom: '3rem',
|
|
190
|
-
borderRadius: '10px',
|
|
191
|
-
}}
|
|
192
|
-
nodeColor={() => '#232323'}
|
|
193
|
-
nodeBorderRadius={30}
|
|
194
|
-
|
|
195
|
-
/> */}
|
|
196
|
-
<MiniMapCommon />
|
|
197
|
-
<DownloadPanel />
|
|
198
|
-
{/* <Controls /> */}
|
|
199
|
-
<Stencil stencilItems={stencilItems} />
|
|
200
|
-
<PropertiesPane
|
|
201
|
-
nodeSchema={nodePropertiesConfig}
|
|
202
|
-
edgeSchema={edgePropertiesConfig}
|
|
203
|
-
onNodeUpdate={(values) => console.log('Node updated', values)}
|
|
204
|
-
/>
|
|
205
|
-
<HistoryPane />
|
|
206
|
-
</>
|
|
207
|
-
);
|
|
208
|
-
|
|
209
|
-
// Automation-specific children with execution panel
|
|
210
|
-
const automationChildren = (
|
|
211
|
-
<>
|
|
212
|
-
<MiniMapCommon />
|
|
213
|
-
{/* <DownloadPanel />
|
|
214
|
-
<Stencil stencilItems={stencilItems} />
|
|
215
|
-
<PropertiesPane
|
|
216
|
-
nodeSchema={nodePropertiesConfig}
|
|
217
|
-
edgeSchema={edgePropertiesConfig}
|
|
218
|
-
onNodeUpdate={(values) => console.log('Node updated', values)}
|
|
219
|
-
/>
|
|
220
|
-
<HistoryPane />
|
|
221
|
-
<AutomationExecutionPanel
|
|
222
|
-
nodes={automationDefaultNodes}
|
|
223
|
-
edges={automationDefaultEdges}
|
|
224
|
-
workflowId="automation-workflow-1"
|
|
225
|
-
onNodeUpdate={(nodeId, updatedData) => {
|
|
226
|
-
console.log('Node updated with execution result:', nodeId, updatedData);
|
|
227
|
-
}}
|
|
228
|
-
/> */}
|
|
229
|
-
</>
|
|
230
|
-
);
|
|
231
|
-
|
|
232
|
-
const onChange = (change: Change) =>
|
|
233
|
-
console.log('Logging change from on change', change);
|
|
234
|
-
ReactDOM.createRoot(document.getElementById('root')!).render(
|
|
235
|
-
<Router>
|
|
236
|
-
<Routes>
|
|
237
|
-
<Route path="/" element={<HomePage />} />
|
|
238
|
-
<Route
|
|
239
|
-
path="/erd"
|
|
240
|
-
element={
|
|
241
|
-
<DiagramTabs
|
|
242
|
-
defaultEdges={classDefaultEdges}
|
|
243
|
-
defaultNodes={classDefaultNodes}
|
|
244
|
-
diagramType={'erd'}
|
|
245
|
-
>
|
|
246
|
-
{commonChildren}
|
|
247
|
-
</DiagramTabs>
|
|
248
|
-
}
|
|
249
|
-
/>
|
|
250
|
-
<Route
|
|
251
|
-
path="/flow"
|
|
252
|
-
element={
|
|
253
|
-
<DiagramTabs
|
|
254
|
-
defaultEdges={classDefaultEdges}
|
|
255
|
-
defaultNodes={classDefaultNodes}
|
|
256
|
-
diagramType="flow"
|
|
257
|
-
>
|
|
258
|
-
{commonChildren}
|
|
259
|
-
</DiagramTabs>
|
|
260
|
-
}
|
|
261
|
-
/>
|
|
262
|
-
<Route
|
|
263
|
-
path="/sequence"
|
|
264
|
-
element={
|
|
265
|
-
<DiagramTabs
|
|
266
|
-
defaultEdges={sequenceDiagramEdges}
|
|
267
|
-
defaultNodes={sequenceDiagramNodes}
|
|
268
|
-
diagramType={'sequence'}
|
|
269
|
-
diagramPageProps={{
|
|
270
|
-
onChange,
|
|
271
|
-
availableFunctions: [],
|
|
272
|
-
id: 3,
|
|
273
|
-
}}
|
|
274
|
-
>
|
|
275
|
-
{commonChildren}
|
|
276
|
-
</DiagramTabs>
|
|
277
|
-
}
|
|
278
|
-
/>
|
|
279
|
-
<Route
|
|
280
|
-
path="/arch"
|
|
281
|
-
element={
|
|
282
|
-
<DiagramTabs
|
|
283
|
-
defaultEdges={archEdges}
|
|
284
|
-
defaultNodes={archNodes}
|
|
285
|
-
diagramType={'arch'}
|
|
286
|
-
diagramPageProps={{
|
|
287
|
-
onChange,
|
|
288
|
-
availableFunctions: [],
|
|
289
|
-
id: 4,
|
|
290
|
-
}}
|
|
291
|
-
>
|
|
292
|
-
{commonChildren}
|
|
293
|
-
</DiagramTabs>
|
|
294
|
-
}
|
|
295
|
-
/>
|
|
296
|
-
<Route
|
|
297
|
-
path="/cloud-architecture"
|
|
298
|
-
element={
|
|
299
|
-
<DiagramTabs
|
|
300
|
-
defaultEdges={cloudInitialEdges}
|
|
301
|
-
defaultNodes={cloudInitialNodes}
|
|
302
|
-
diagramType={'cloud-architecture'}
|
|
303
|
-
diagramPageProps={{
|
|
304
|
-
onChange,
|
|
305
|
-
availableFunctions: [],
|
|
306
|
-
id: 4,
|
|
307
|
-
}}
|
|
308
|
-
>
|
|
309
|
-
{commonChildren}
|
|
310
|
-
</DiagramTabs>
|
|
311
|
-
}
|
|
312
|
-
/>
|
|
313
|
-
<Route
|
|
314
|
-
path="/case"
|
|
315
|
-
element={
|
|
316
|
-
<DiagramTabs
|
|
317
|
-
defaultEdges={useCaseDefaultEdges}
|
|
318
|
-
defaultNodes={useCaseDefaultNodes}
|
|
319
|
-
diagramType={'case'}
|
|
320
|
-
diagramPageProps={{
|
|
321
|
-
onChange,
|
|
322
|
-
availableFunctions: [],
|
|
323
|
-
id: 5,
|
|
324
|
-
}}
|
|
325
|
-
>
|
|
326
|
-
{commonChildren}
|
|
327
|
-
</DiagramTabs>
|
|
328
|
-
}
|
|
329
|
-
/>
|
|
330
|
-
<Route
|
|
331
|
-
path="/collaboration"
|
|
332
|
-
element={
|
|
333
|
-
<DiagramTabs
|
|
334
|
-
defaultEdges={collaborationEdges}
|
|
335
|
-
defaultNodes={collaborationNodes}
|
|
336
|
-
diagramType={'collaboration'}
|
|
337
|
-
diagramPageProps={{
|
|
338
|
-
onChange,
|
|
339
|
-
availableFunctions: [],
|
|
340
|
-
id: 6,
|
|
341
|
-
}}
|
|
342
|
-
>
|
|
343
|
-
{commonChildren}
|
|
344
|
-
</DiagramTabs>
|
|
345
|
-
}
|
|
346
|
-
/>
|
|
347
|
-
<Route
|
|
348
|
-
path="/workflow"
|
|
349
|
-
element={
|
|
350
|
-
<DiagramTabs
|
|
351
|
-
defaultEdges={workflowDefaultNodesAndEdges.edges}
|
|
352
|
-
defaultNodes={workflowDefaultNodesAndEdges.nodes}
|
|
353
|
-
diagramType="workflow"
|
|
354
|
-
diagramPageProps={{
|
|
355
|
-
onChange,
|
|
356
|
-
availableFunctions: [{ id: '1', code: 'return a + b;', args: [{ name: 'a', type: 'number' }, { name: 'b', type: 'number' }], name: 'add' },],
|
|
357
|
-
id: 1,
|
|
358
|
-
workflowNodeContent: (data: ICardNodeData, setNodeData: (data: ICardNodeData) => void) => (
|
|
359
|
-
<NodeForm data={data} setNodeData={setNodeData} />
|
|
360
|
-
),
|
|
361
|
-
renderAddNodeView: (addNode: (type: string) => void, open: boolean, setOpen: (open: boolean) => void) => (
|
|
362
|
-
<AddNodeView addNode={addNode} open={open} setOpen={setOpen} />
|
|
363
|
-
),
|
|
364
|
-
getDefaultNodeData: (type: string) => {
|
|
365
|
-
switch (type) {
|
|
366
|
-
case 'function':
|
|
367
|
-
return { formData: { type: 'function', parameters: [], name: 'New Function', body: [] } };
|
|
368
|
-
case 'let':
|
|
369
|
-
return { formData: { type: 'let', mode: 'simple', bindings: [] } };
|
|
370
|
-
case 'api':
|
|
371
|
-
return {
|
|
372
|
-
formData: {
|
|
373
|
-
type: 'api',
|
|
374
|
-
method: 'GET',
|
|
375
|
-
url: '',
|
|
376
|
-
headers: [],
|
|
377
|
-
queryParams: [],
|
|
378
|
-
body: '',
|
|
379
|
-
bodyType: 'json',
|
|
380
|
-
responseVariable: 'apiResponse',
|
|
381
|
-
responseDataType: 'Object'
|
|
382
|
-
}
|
|
383
|
-
};
|
|
384
|
-
case 'graphql':
|
|
385
|
-
return {
|
|
386
|
-
formData: {
|
|
387
|
-
type: 'graphql',
|
|
388
|
-
mode: 'normal',
|
|
389
|
-
operationType: 'query',
|
|
390
|
-
operationName: '',
|
|
391
|
-
rootField: '',
|
|
392
|
-
url: '',
|
|
393
|
-
headers: [],
|
|
394
|
-
arguments: [],
|
|
395
|
-
fields: [],
|
|
396
|
-
variables: [],
|
|
397
|
-
responseVariable: 'graphqlResponse',
|
|
398
|
-
responseDataType: 'Object',
|
|
399
|
-
customQuery: ''
|
|
400
|
-
}
|
|
401
|
-
};
|
|
402
|
-
default:
|
|
403
|
-
return {};
|
|
404
|
-
}
|
|
405
|
-
},
|
|
406
|
-
}}
|
|
407
|
-
>
|
|
408
|
-
{commonChildren}
|
|
409
|
-
</DiagramTabs>
|
|
410
|
-
}
|
|
411
|
-
/>
|
|
412
|
-
<Route
|
|
413
|
-
path="/stateMachine"
|
|
414
|
-
element={
|
|
415
|
-
<DiagramTabs
|
|
416
|
-
defaultEdges={stateMachineDefaultEdges}
|
|
417
|
-
defaultNodes={stateMachineDefaultNodes}
|
|
418
|
-
diagramType={'stateMachine'}
|
|
419
|
-
diagramPageProps={{
|
|
420
|
-
onChange,
|
|
421
|
-
availableFunctions: [],
|
|
422
|
-
id: 4,
|
|
423
|
-
}}
|
|
424
|
-
>
|
|
425
|
-
{commonChildren}
|
|
426
|
-
</DiagramTabs>
|
|
427
|
-
}
|
|
428
|
-
/>
|
|
429
|
-
<Route
|
|
430
|
-
path="/systemFlow"
|
|
431
|
-
element={
|
|
432
|
-
<DiagramTabs
|
|
433
|
-
defaultEdges={systemFlowDefaultEdges}
|
|
434
|
-
defaultNodes={systemFlowDefaultNodes}
|
|
435
|
-
diagramType={'systemFlow'}
|
|
436
|
-
diagramPageProps={{
|
|
437
|
-
onChange,
|
|
438
|
-
availableFunctions: [],
|
|
439
|
-
id: 7,
|
|
440
|
-
}}
|
|
441
|
-
>
|
|
442
|
-
{commonChildren}
|
|
443
|
-
</DiagramTabs>
|
|
444
|
-
}
|
|
445
|
-
/>
|
|
446
|
-
<Route
|
|
447
|
-
path="/automation"
|
|
448
|
-
element={
|
|
449
|
-
<DiagrammingPage
|
|
450
|
-
defaultEdges={automationDefaultEdges}
|
|
451
|
-
defaultNodes={automationDefaultNodes}
|
|
452
|
-
diagramType={'automation'}
|
|
453
|
-
onChange={onChange}
|
|
454
|
-
availableFunctions={[]}
|
|
455
|
-
id={8}
|
|
456
|
-
>
|
|
457
|
-
{/* {automationChildren} */}
|
|
458
|
-
</DiagrammingPage>
|
|
459
|
-
}
|
|
460
|
-
/>
|
|
461
|
-
</Routes>
|
|
462
|
-
</Router>,
|
|
463
|
-
);
|
|
1
|
+
import '../../workflow/i18n';
|
|
2
|
+
import ReactDOM from 'react-dom/client';
|
|
3
|
+
import {
|
|
4
|
+
Change,
|
|
5
|
+
Controls,
|
|
6
|
+
DiagrammingPage,
|
|
7
|
+
DownloadPanel,
|
|
8
|
+
HistoryPane,
|
|
9
|
+
MiniMap,
|
|
10
|
+
PropertiesPane,
|
|
11
|
+
SmartDynamicFormField,
|
|
12
|
+
Stencil,
|
|
13
|
+
} from '@flowuent-labs/diagrams';
|
|
14
|
+
import { BrowserRouter as Router, Route, Routes } from 'react-router-dom';
|
|
15
|
+
import {
|
|
16
|
+
archEdges,
|
|
17
|
+
archNodes,
|
|
18
|
+
classDefaultEdges,
|
|
19
|
+
classDefaultNodes,
|
|
20
|
+
workflowDefaultNodesAndEdges,
|
|
21
|
+
} from './node-data';
|
|
22
|
+
import { stencilItems } from './stencil-items';
|
|
23
|
+
import React from 'react';
|
|
24
|
+
import DiagramTabs from './DiagramTabs';
|
|
25
|
+
import {
|
|
26
|
+
useCaseDefaultEdges,
|
|
27
|
+
useCaseDefaultNodes,
|
|
28
|
+
} from './UseCaseDiagramData';
|
|
29
|
+
import {
|
|
30
|
+
sequenceDiagramEdges,
|
|
31
|
+
sequenceDiagramNodes,
|
|
32
|
+
} from './SequenceDiagramData';
|
|
33
|
+
import {
|
|
34
|
+
stateMachineDefaultNodes,
|
|
35
|
+
stateMachineDefaultEdges,
|
|
36
|
+
} from './StateMachineDiagramData';
|
|
37
|
+
import {
|
|
38
|
+
systemFlowDefaultNodes,
|
|
39
|
+
systemFlowDefaultEdges,
|
|
40
|
+
} from '../../../packages/diagrams/src/lib/templates/systemFlow/data/template-data';
|
|
41
|
+
import HomePage from './Pages/Home';
|
|
42
|
+
import { cloudInitialEdges, cloudInitialNodes } from './cloud-data';
|
|
43
|
+
import { collaborationNodes, collaborationEdges } from './CollaborationDiagramData';
|
|
44
|
+
import { automationDefaultNodes, automationDefaultEdges } from './AutomationDiagramData';
|
|
45
|
+
import { NodeForm } from '@flowuent-labs/diagrams';
|
|
46
|
+
import { AddNodeView } from './components/AddNodeView';
|
|
47
|
+
import { colorMap } from '../../../packages/diagrams/src/lib/types/colors';
|
|
48
|
+
import MiniMapCommon from '../../../packages/diagrams/src/lib/components/MiniMapCommon';
|
|
49
|
+
import { ICardNodeData } from '../../../packages/diagrams/src/lib/types/card-node';
|
|
50
|
+
import { AutomationExecutionPanel } from '../../../packages/diagrams/src/lib/components/automation';
|
|
51
|
+
|
|
52
|
+
const edgePropertiesConfig: SmartDynamicFormField[] = [
|
|
53
|
+
{
|
|
54
|
+
type: 'Select',
|
|
55
|
+
props: {
|
|
56
|
+
name: 'markerStart',
|
|
57
|
+
label: 'Marker Start',
|
|
58
|
+
options: 'getMarkerOptions',
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
type: 'Select',
|
|
63
|
+
props: {
|
|
64
|
+
name: 'markerEnd',
|
|
65
|
+
label: 'Marker End',
|
|
66
|
+
options: 'getMarkerOptions',
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
type: 'NumberField',
|
|
71
|
+
props: {
|
|
72
|
+
name: 'style.strokeWidth',
|
|
73
|
+
label: 'Stroke Width',
|
|
74
|
+
validation: {
|
|
75
|
+
type: 'number',
|
|
76
|
+
required: true,
|
|
77
|
+
message: 'Stroke width is required',
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
type: 'Select',
|
|
83
|
+
props: {
|
|
84
|
+
name: 'style.stroke',
|
|
85
|
+
label: 'Stroke Color',
|
|
86
|
+
options: 'getColorOptions',
|
|
87
|
+
validation: {
|
|
88
|
+
type: 'string',
|
|
89
|
+
required: true,
|
|
90
|
+
message: 'Stroke color is required',
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
];
|
|
95
|
+
|
|
96
|
+
const nodePropertiesConfig: SmartDynamicFormField[] = [
|
|
97
|
+
{
|
|
98
|
+
type: 'TextField',
|
|
99
|
+
props: {
|
|
100
|
+
name: 'data.title',
|
|
101
|
+
label: 'Title',
|
|
102
|
+
validation: {
|
|
103
|
+
type: 'string',
|
|
104
|
+
required: true,
|
|
105
|
+
message: 'Title is required',
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
type: 'NumberField',
|
|
111
|
+
props: {
|
|
112
|
+
name: 'position.x',
|
|
113
|
+
label: 'X',
|
|
114
|
+
validation: {
|
|
115
|
+
type: 'number',
|
|
116
|
+
required: true,
|
|
117
|
+
message: 'X coordinate is required',
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
type: 'NumberField',
|
|
123
|
+
props: {
|
|
124
|
+
name: 'position.y',
|
|
125
|
+
label: 'Y',
|
|
126
|
+
validation: {
|
|
127
|
+
type: 'number',
|
|
128
|
+
required: true,
|
|
129
|
+
message: 'Y coordinate is required',
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
type: 'Select',
|
|
135
|
+
props: {
|
|
136
|
+
name: 'data.color',
|
|
137
|
+
label: 'Color',
|
|
138
|
+
options: 'getColorOptions',
|
|
139
|
+
validation: {
|
|
140
|
+
type: 'string',
|
|
141
|
+
required: true,
|
|
142
|
+
message: 'Color is required',
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
type: 'NumberField',
|
|
148
|
+
props: {
|
|
149
|
+
name: 'width',
|
|
150
|
+
label: 'Width',
|
|
151
|
+
validation: {
|
|
152
|
+
type: 'number',
|
|
153
|
+
required: true,
|
|
154
|
+
message: 'Width is required',
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
type: 'NumberField',
|
|
160
|
+
props: {
|
|
161
|
+
name: 'height',
|
|
162
|
+
label: 'Height',
|
|
163
|
+
validation: {
|
|
164
|
+
type: 'number',
|
|
165
|
+
required: true,
|
|
166
|
+
message: 'Height is required',
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
type: 'Switch',
|
|
172
|
+
props: {
|
|
173
|
+
name: 'data.isBlock',
|
|
174
|
+
label: 'Is Block',
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
];
|
|
178
|
+
// Common children for DiagrammingPage
|
|
179
|
+
const commonChildren = (
|
|
180
|
+
<>
|
|
181
|
+
{/* <MiniMap
|
|
182
|
+
position="bottom-left"
|
|
183
|
+
pannable
|
|
184
|
+
bgColor="#181818"
|
|
185
|
+
maskColor="rgba(40,40,40,0.6)"
|
|
186
|
+
maskStrokeColor="#888"
|
|
187
|
+
style={{
|
|
188
|
+
border: '1px solid #232323',
|
|
189
|
+
marginBottom: '3rem',
|
|
190
|
+
borderRadius: '10px',
|
|
191
|
+
}}
|
|
192
|
+
nodeColor={() => '#232323'}
|
|
193
|
+
nodeBorderRadius={30}
|
|
194
|
+
|
|
195
|
+
/> */}
|
|
196
|
+
<MiniMapCommon />
|
|
197
|
+
<DownloadPanel />
|
|
198
|
+
{/* <Controls /> */}
|
|
199
|
+
<Stencil stencilItems={stencilItems} />
|
|
200
|
+
<PropertiesPane
|
|
201
|
+
nodeSchema={nodePropertiesConfig}
|
|
202
|
+
edgeSchema={edgePropertiesConfig}
|
|
203
|
+
onNodeUpdate={(values) => console.log('Node updated', values)}
|
|
204
|
+
/>
|
|
205
|
+
<HistoryPane />
|
|
206
|
+
</>
|
|
207
|
+
);
|
|
208
|
+
|
|
209
|
+
// Automation-specific children with execution panel
|
|
210
|
+
const automationChildren = (
|
|
211
|
+
<>
|
|
212
|
+
<MiniMapCommon />
|
|
213
|
+
{/* <DownloadPanel />
|
|
214
|
+
<Stencil stencilItems={stencilItems} />
|
|
215
|
+
<PropertiesPane
|
|
216
|
+
nodeSchema={nodePropertiesConfig}
|
|
217
|
+
edgeSchema={edgePropertiesConfig}
|
|
218
|
+
onNodeUpdate={(values) => console.log('Node updated', values)}
|
|
219
|
+
/>
|
|
220
|
+
<HistoryPane />
|
|
221
|
+
<AutomationExecutionPanel
|
|
222
|
+
nodes={automationDefaultNodes}
|
|
223
|
+
edges={automationDefaultEdges}
|
|
224
|
+
workflowId="automation-workflow-1"
|
|
225
|
+
onNodeUpdate={(nodeId, updatedData) => {
|
|
226
|
+
console.log('Node updated with execution result:', nodeId, updatedData);
|
|
227
|
+
}}
|
|
228
|
+
/> */}
|
|
229
|
+
</>
|
|
230
|
+
);
|
|
231
|
+
|
|
232
|
+
const onChange = (change: Change) =>
|
|
233
|
+
console.log('Logging change from on change', change);
|
|
234
|
+
ReactDOM.createRoot(document.getElementById('root')!).render(
|
|
235
|
+
<Router>
|
|
236
|
+
<Routes>
|
|
237
|
+
<Route path="/" element={<HomePage />} />
|
|
238
|
+
<Route
|
|
239
|
+
path="/erd"
|
|
240
|
+
element={
|
|
241
|
+
<DiagramTabs
|
|
242
|
+
defaultEdges={classDefaultEdges}
|
|
243
|
+
defaultNodes={classDefaultNodes}
|
|
244
|
+
diagramType={'erd'}
|
|
245
|
+
>
|
|
246
|
+
{commonChildren}
|
|
247
|
+
</DiagramTabs>
|
|
248
|
+
}
|
|
249
|
+
/>
|
|
250
|
+
<Route
|
|
251
|
+
path="/flow"
|
|
252
|
+
element={
|
|
253
|
+
<DiagramTabs
|
|
254
|
+
defaultEdges={classDefaultEdges}
|
|
255
|
+
defaultNodes={classDefaultNodes}
|
|
256
|
+
diagramType="flow"
|
|
257
|
+
>
|
|
258
|
+
{commonChildren}
|
|
259
|
+
</DiagramTabs>
|
|
260
|
+
}
|
|
261
|
+
/>
|
|
262
|
+
<Route
|
|
263
|
+
path="/sequence"
|
|
264
|
+
element={
|
|
265
|
+
<DiagramTabs
|
|
266
|
+
defaultEdges={sequenceDiagramEdges}
|
|
267
|
+
defaultNodes={sequenceDiagramNodes}
|
|
268
|
+
diagramType={'sequence'}
|
|
269
|
+
diagramPageProps={{
|
|
270
|
+
onChange,
|
|
271
|
+
availableFunctions: [],
|
|
272
|
+
id: 3,
|
|
273
|
+
}}
|
|
274
|
+
>
|
|
275
|
+
{commonChildren}
|
|
276
|
+
</DiagramTabs>
|
|
277
|
+
}
|
|
278
|
+
/>
|
|
279
|
+
<Route
|
|
280
|
+
path="/arch"
|
|
281
|
+
element={
|
|
282
|
+
<DiagramTabs
|
|
283
|
+
defaultEdges={archEdges}
|
|
284
|
+
defaultNodes={archNodes}
|
|
285
|
+
diagramType={'arch'}
|
|
286
|
+
diagramPageProps={{
|
|
287
|
+
onChange,
|
|
288
|
+
availableFunctions: [],
|
|
289
|
+
id: 4,
|
|
290
|
+
}}
|
|
291
|
+
>
|
|
292
|
+
{commonChildren}
|
|
293
|
+
</DiagramTabs>
|
|
294
|
+
}
|
|
295
|
+
/>
|
|
296
|
+
<Route
|
|
297
|
+
path="/cloud-architecture"
|
|
298
|
+
element={
|
|
299
|
+
<DiagramTabs
|
|
300
|
+
defaultEdges={cloudInitialEdges}
|
|
301
|
+
defaultNodes={cloudInitialNodes}
|
|
302
|
+
diagramType={'cloud-architecture'}
|
|
303
|
+
diagramPageProps={{
|
|
304
|
+
onChange,
|
|
305
|
+
availableFunctions: [],
|
|
306
|
+
id: 4,
|
|
307
|
+
}}
|
|
308
|
+
>
|
|
309
|
+
{commonChildren}
|
|
310
|
+
</DiagramTabs>
|
|
311
|
+
}
|
|
312
|
+
/>
|
|
313
|
+
<Route
|
|
314
|
+
path="/case"
|
|
315
|
+
element={
|
|
316
|
+
<DiagramTabs
|
|
317
|
+
defaultEdges={useCaseDefaultEdges}
|
|
318
|
+
defaultNodes={useCaseDefaultNodes}
|
|
319
|
+
diagramType={'case'}
|
|
320
|
+
diagramPageProps={{
|
|
321
|
+
onChange,
|
|
322
|
+
availableFunctions: [],
|
|
323
|
+
id: 5,
|
|
324
|
+
}}
|
|
325
|
+
>
|
|
326
|
+
{commonChildren}
|
|
327
|
+
</DiagramTabs>
|
|
328
|
+
}
|
|
329
|
+
/>
|
|
330
|
+
<Route
|
|
331
|
+
path="/collaboration"
|
|
332
|
+
element={
|
|
333
|
+
<DiagramTabs
|
|
334
|
+
defaultEdges={collaborationEdges}
|
|
335
|
+
defaultNodes={collaborationNodes}
|
|
336
|
+
diagramType={'collaboration'}
|
|
337
|
+
diagramPageProps={{
|
|
338
|
+
onChange,
|
|
339
|
+
availableFunctions: [],
|
|
340
|
+
id: 6,
|
|
341
|
+
}}
|
|
342
|
+
>
|
|
343
|
+
{commonChildren}
|
|
344
|
+
</DiagramTabs>
|
|
345
|
+
}
|
|
346
|
+
/>
|
|
347
|
+
<Route
|
|
348
|
+
path="/workflow"
|
|
349
|
+
element={
|
|
350
|
+
<DiagramTabs
|
|
351
|
+
defaultEdges={workflowDefaultNodesAndEdges.edges}
|
|
352
|
+
defaultNodes={workflowDefaultNodesAndEdges.nodes}
|
|
353
|
+
diagramType="workflow"
|
|
354
|
+
diagramPageProps={{
|
|
355
|
+
onChange,
|
|
356
|
+
availableFunctions: [{ id: '1', code: 'return a + b;', args: [{ name: 'a', type: 'number' }, { name: 'b', type: 'number' }], name: 'add' },],
|
|
357
|
+
id: 1,
|
|
358
|
+
workflowNodeContent: (data: ICardNodeData, setNodeData: (data: ICardNodeData) => void) => (
|
|
359
|
+
<NodeForm data={data} setNodeData={setNodeData} />
|
|
360
|
+
),
|
|
361
|
+
renderAddNodeView: (addNode: (type: string) => void, open: boolean, setOpen: (open: boolean) => void) => (
|
|
362
|
+
<AddNodeView addNode={addNode} open={open} setOpen={setOpen} />
|
|
363
|
+
),
|
|
364
|
+
getDefaultNodeData: (type: string) => {
|
|
365
|
+
switch (type) {
|
|
366
|
+
case 'function':
|
|
367
|
+
return { formData: { type: 'function', parameters: [], name: 'New Function', body: [] } };
|
|
368
|
+
case 'let':
|
|
369
|
+
return { formData: { type: 'let', mode: 'simple', bindings: [] } };
|
|
370
|
+
case 'api':
|
|
371
|
+
return {
|
|
372
|
+
formData: {
|
|
373
|
+
type: 'api',
|
|
374
|
+
method: 'GET',
|
|
375
|
+
url: '',
|
|
376
|
+
headers: [],
|
|
377
|
+
queryParams: [],
|
|
378
|
+
body: '',
|
|
379
|
+
bodyType: 'json',
|
|
380
|
+
responseVariable: 'apiResponse',
|
|
381
|
+
responseDataType: 'Object'
|
|
382
|
+
}
|
|
383
|
+
};
|
|
384
|
+
case 'graphql':
|
|
385
|
+
return {
|
|
386
|
+
formData: {
|
|
387
|
+
type: 'graphql',
|
|
388
|
+
mode: 'normal',
|
|
389
|
+
operationType: 'query',
|
|
390
|
+
operationName: '',
|
|
391
|
+
rootField: '',
|
|
392
|
+
url: '',
|
|
393
|
+
headers: [],
|
|
394
|
+
arguments: [],
|
|
395
|
+
fields: [],
|
|
396
|
+
variables: [],
|
|
397
|
+
responseVariable: 'graphqlResponse',
|
|
398
|
+
responseDataType: 'Object',
|
|
399
|
+
customQuery: ''
|
|
400
|
+
}
|
|
401
|
+
};
|
|
402
|
+
default:
|
|
403
|
+
return {};
|
|
404
|
+
}
|
|
405
|
+
},
|
|
406
|
+
}}
|
|
407
|
+
>
|
|
408
|
+
{commonChildren}
|
|
409
|
+
</DiagramTabs>
|
|
410
|
+
}
|
|
411
|
+
/>
|
|
412
|
+
<Route
|
|
413
|
+
path="/stateMachine"
|
|
414
|
+
element={
|
|
415
|
+
<DiagramTabs
|
|
416
|
+
defaultEdges={stateMachineDefaultEdges}
|
|
417
|
+
defaultNodes={stateMachineDefaultNodes}
|
|
418
|
+
diagramType={'stateMachine'}
|
|
419
|
+
diagramPageProps={{
|
|
420
|
+
onChange,
|
|
421
|
+
availableFunctions: [],
|
|
422
|
+
id: 4,
|
|
423
|
+
}}
|
|
424
|
+
>
|
|
425
|
+
{commonChildren}
|
|
426
|
+
</DiagramTabs>
|
|
427
|
+
}
|
|
428
|
+
/>
|
|
429
|
+
<Route
|
|
430
|
+
path="/systemFlow"
|
|
431
|
+
element={
|
|
432
|
+
<DiagramTabs
|
|
433
|
+
defaultEdges={systemFlowDefaultEdges}
|
|
434
|
+
defaultNodes={systemFlowDefaultNodes}
|
|
435
|
+
diagramType={'systemFlow'}
|
|
436
|
+
diagramPageProps={{
|
|
437
|
+
onChange,
|
|
438
|
+
availableFunctions: [],
|
|
439
|
+
id: 7,
|
|
440
|
+
}}
|
|
441
|
+
>
|
|
442
|
+
{commonChildren}
|
|
443
|
+
</DiagramTabs>
|
|
444
|
+
}
|
|
445
|
+
/>
|
|
446
|
+
<Route
|
|
447
|
+
path="/automation"
|
|
448
|
+
element={
|
|
449
|
+
<DiagrammingPage
|
|
450
|
+
defaultEdges={automationDefaultEdges}
|
|
451
|
+
defaultNodes={automationDefaultNodes}
|
|
452
|
+
diagramType={'automation'}
|
|
453
|
+
onChange={onChange}
|
|
454
|
+
availableFunctions={[]}
|
|
455
|
+
id={8}
|
|
456
|
+
>
|
|
457
|
+
{/* {automationChildren} */}
|
|
458
|
+
</DiagrammingPage>
|
|
459
|
+
}
|
|
460
|
+
/>
|
|
461
|
+
</Routes>
|
|
462
|
+
</Router>,
|
|
463
|
+
);
|