@topconsultnpm/sdkui-react-beta 6.16.76 → 6.16.77
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/assets/icomoon.svg +96 -96
- package/lib/assets/italy.svg +16 -16
- package/lib/assets/topmedia-six.svg +65 -65
- package/lib/assets/topmeida-six-bianco.svg +65 -65
- package/lib/components/features/documents/TMDcmtForm.js +1 -1
- package/lib/components/features/workflow/diagram/WFDiagram.d.ts +1 -4
- package/lib/components/features/workflow/diagram/WFDiagram.js +201 -79
- package/lib/components/forms/Login/PasswordStrengthChecker.js +1 -1
- package/lib/helper/SDKUI_Localizator.d.ts +2 -2
- package/lib/helper/SDKUI_Localizator.js +12 -12
- package/lib/hooks/useForm.js +1 -26
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useEffect, useCallback, useRef, useMemo } from 'react';
|
|
3
3
|
import { DiagramItemTypes, ArrowSymbol } from './interfaces';
|
|
4
4
|
import { parseWfDiagramXml, serializeWfDiagramToXml } from './xmlParser';
|
|
@@ -8,10 +8,69 @@ import ConnectionComponent from './ConnectionComponent';
|
|
|
8
8
|
import DiagramItemComponent from './DiagramItemComponent';
|
|
9
9
|
import DiagramItemSvgContent from './DiagramItemSvgContent';
|
|
10
10
|
import { calculateArrowAngle, downloadFile, getConnectionPoint, isConnectionNonLinear, validateDiagram } from './workflowHelpers';
|
|
11
|
-
import { IconFlowChart, IconUndo, IconRestore, IconAdjust, IconCopy, IconCut, IconPaste, IconPin, IconUnpin, IconChevronRight, IconCloseOutline, IconNew, SDKUI_Localizator, generateUUID, IconExport, IconImport } from '../../../../helper';
|
|
12
|
-
import { TMExceptionBoxManager } from '../../../base/TMPopUp';
|
|
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
|
+
import { ButtonNames, TMExceptionBoxManager, TMMessageBoxManager } from '../../../base/TMPopUp';
|
|
13
13
|
import { StyledLoadingContainer, StyledSpinner } from '../../../base/Styled';
|
|
14
14
|
import DiagramItemForm from './DiagramItemForm';
|
|
15
|
+
import ReactDOM from 'react-dom';
|
|
16
|
+
const ZoomLevelText = styled.span `
|
|
17
|
+
font-size: 0.9em;
|
|
18
|
+
color: #555;
|
|
19
|
+
white-space: nowrap;
|
|
20
|
+
background-color: white;
|
|
21
|
+
padding: 2px 4px; /* Aggiunto un leggero padding per chiarezza */
|
|
22
|
+
border-radius: 4px;
|
|
23
|
+
|
|
24
|
+
/* A. Modalità Compressa (non Floating & Collapsed) */
|
|
25
|
+
${props => !props.$isFloating && props.$isCollapsed
|
|
26
|
+
? `
|
|
27
|
+
padding: 0 2px;
|
|
28
|
+
margin: 0;
|
|
29
|
+
display: inline-block;
|
|
30
|
+
line-height: 20px;
|
|
31
|
+
`
|
|
32
|
+
// B. Modalità Flottante (Verticale)
|
|
33
|
+
: props.$isFloating
|
|
34
|
+
? `
|
|
35
|
+
display: block;
|
|
36
|
+
text-align: center;
|
|
37
|
+
margin: 4px 0;
|
|
38
|
+
padding: 2px 4px;
|
|
39
|
+
`
|
|
40
|
+
// C. Modalità Standard (Orizzontale & non Collapsed)
|
|
41
|
+
: `
|
|
42
|
+
display: flex;
|
|
43
|
+
align-items: center;
|
|
44
|
+
margin: 0 8px;
|
|
45
|
+
padding: 2px 4px;
|
|
46
|
+
`}
|
|
47
|
+
`;
|
|
48
|
+
const DiagramWrapper = styled.div `
|
|
49
|
+
height: 100%;
|
|
50
|
+
width: 100%;
|
|
51
|
+
border: 1px solid #ddd;
|
|
52
|
+
border-radius: 8px;
|
|
53
|
+
overflow: hidden;
|
|
54
|
+
background-color: white;
|
|
55
|
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
|
56
|
+
display: flex;
|
|
57
|
+
flex-direction: column;
|
|
58
|
+
position: relative;
|
|
59
|
+
transition: all 0.3s ease-in-out;
|
|
60
|
+
`;
|
|
61
|
+
const FullScreenContainer = styled.div `
|
|
62
|
+
position: fixed;
|
|
63
|
+
top: 0;
|
|
64
|
+
left: 0;
|
|
65
|
+
width: 100vw;
|
|
66
|
+
height: 100vh;
|
|
67
|
+
z-index: 1500;
|
|
68
|
+
background-color: white;
|
|
69
|
+
display: flex;
|
|
70
|
+
flex-direction: column;
|
|
71
|
+
justify-content: center;
|
|
72
|
+
align-items: center;
|
|
73
|
+
`;
|
|
15
74
|
const CanvasContainer = styled.div `
|
|
16
75
|
position: relative;
|
|
17
76
|
width: 100%;
|
|
@@ -24,7 +83,9 @@ const CanvasContainer = styled.div `
|
|
|
24
83
|
const ToolbarContainer = styled.div `
|
|
25
84
|
display: flex;
|
|
26
85
|
gap: 5px;
|
|
27
|
-
background:
|
|
86
|
+
background: ${props => props.$isReadOnly
|
|
87
|
+
? 'transparent linear-gradient(180deg, #007bff 0%, #1E90FF 45%, #0056b3 100%) 0% 0% no-repeat padding-box'
|
|
88
|
+
: 'transparent linear-gradient(180deg, #E03A8B 9%, #C2388B 34%, #A63B8D 60%, #943C8D 83%, #8F3C8D 100%) 0% 0% no-repeat padding-box'};
|
|
28
89
|
padding: 8px;
|
|
29
90
|
border-radius: 4px;
|
|
30
91
|
z-index: 10;
|
|
@@ -34,14 +95,14 @@ const ToolbarContainer = styled.div `
|
|
|
34
95
|
${props => props.$isFloating ? `
|
|
35
96
|
position: absolute;
|
|
36
97
|
bottom: 20px;
|
|
37
|
-
left: ${props.$isToolboxVisible ? '160px' : '20px'};
|
|
38
|
-
flex-direction: row;
|
|
39
|
-
width: auto;
|
|
98
|
+
left: ${props.$isReadOnly ? '20px' : props.$isToolboxVisible ? '160px' : '20px'};
|
|
99
|
+
flex-direction: row;
|
|
100
|
+
width: auto;
|
|
40
101
|
box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2);
|
|
41
|
-
padding: 5px 8px;
|
|
102
|
+
padding: 5px 8px;
|
|
42
103
|
` : `
|
|
43
|
-
position: relative;
|
|
44
|
-
flex-direction: column;
|
|
104
|
+
position: relative;
|
|
105
|
+
flex-direction: column;
|
|
45
106
|
width: ${props.$isCollapsed ? '40px' : 'auto'};
|
|
46
107
|
`}
|
|
47
108
|
overflow-y: auto;
|
|
@@ -205,7 +266,12 @@ const DiagramMessage = styled.div `
|
|
|
205
266
|
color: #555;
|
|
206
267
|
text-align: center;
|
|
207
268
|
`;
|
|
208
|
-
const WFDiagram = ({ xmlDiagramString, currentSetID,
|
|
269
|
+
const WFDiagram = ({ xmlDiagramString, currentSetID, onDiagramChange }) => {
|
|
270
|
+
const [isReadOnly, setIsReadOnly] = useState(true);
|
|
271
|
+
const [isFullScreen, setIsFullScreen] = useState(false);
|
|
272
|
+
const [zoomLevel, setZoomLevel] = useState(1);
|
|
273
|
+
const [translateX, setTranslateX] = useState(0);
|
|
274
|
+
const [translateY, setTranslateY] = useState(0);
|
|
209
275
|
const [isLoading, setIsLoading] = useState(true);
|
|
210
276
|
const [wfDiagram, setWfDiagram] = useState(null);
|
|
211
277
|
const [selectedItems, setSelectedItems] = useState(new Set());
|
|
@@ -214,6 +280,7 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, readOnly = false, zoomLevel
|
|
|
214
280
|
const [historyIndex, setHistoryIndex] = useState(-1);
|
|
215
281
|
const isUndoingRedoing = useRef(false);
|
|
216
282
|
const initialDiagramRef = useRef(null);
|
|
283
|
+
const notifiedXmlRef = useRef(null);
|
|
217
284
|
const svgRef = useRef(null);
|
|
218
285
|
const [isDrawingConnection, setIsDrawingConnection] = useState(false);
|
|
219
286
|
const [tempConnectionSource, setTempConnectionSource] = useState(null);
|
|
@@ -271,7 +338,7 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, readOnly = false, zoomLevel
|
|
|
271
338
|
return { svgWidth: Math.max(0, totalWidth * zoomLevel), svgHeight: Math.max(0, totalHeight * zoomLevel) };
|
|
272
339
|
}, [wfDiagram, zoomLevel]);
|
|
273
340
|
const updateDiagram = useCallback((newDiagram, validate = true) => {
|
|
274
|
-
if (
|
|
341
|
+
if (isReadOnly)
|
|
275
342
|
return;
|
|
276
343
|
try {
|
|
277
344
|
if (validate) {
|
|
@@ -283,13 +350,28 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, readOnly = false, zoomLevel
|
|
|
283
350
|
setHistoryIndex(newHistory.length);
|
|
284
351
|
}
|
|
285
352
|
setWfDiagram(newDiagram);
|
|
353
|
+
(async () => {
|
|
354
|
+
try {
|
|
355
|
+
// await è necessario per attendere il risultato stringa
|
|
356
|
+
const newXml = await serializeWfDiagramToXml(newDiagram);
|
|
357
|
+
notifiedXmlRef.current = newXml;
|
|
358
|
+
// Chiama il callback per notificare TMWFEditor
|
|
359
|
+
// L'invio dell'XML al genitore avviene solo a serializzazione completata.
|
|
360
|
+
onDiagramChange?.(newXml);
|
|
361
|
+
}
|
|
362
|
+
catch (e) {
|
|
363
|
+
console.error("Errore durante la serializzazione del diagramma:", e);
|
|
364
|
+
// Puoi gestire l'errore di serializzazione qui, ad esempio mostrando una notifica
|
|
365
|
+
// TMExceptionBoxManager.show({ exception: new Error("Errore serializzazione WF") });
|
|
366
|
+
}
|
|
367
|
+
})();
|
|
286
368
|
}
|
|
287
369
|
catch (e) {
|
|
288
370
|
TMExceptionBoxManager.show({ exception: e });
|
|
289
371
|
}
|
|
290
|
-
}, [wfDiagramHistory, historyIndex, isUndoingRedoing, setWfDiagramHistory, setHistoryIndex, setWfDiagram,
|
|
372
|
+
}, [wfDiagramHistory, historyIndex, isUndoingRedoing, setWfDiagramHistory, setHistoryIndex, setWfDiagram, isReadOnly]);
|
|
291
373
|
const handleUndo = useCallback(() => {
|
|
292
|
-
if (
|
|
374
|
+
if (isReadOnly)
|
|
293
375
|
return;
|
|
294
376
|
if (historyIndex > 0) {
|
|
295
377
|
isUndoingRedoing.current = true;
|
|
@@ -297,9 +379,9 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, readOnly = false, zoomLevel
|
|
|
297
379
|
setHistoryIndex(newIndex);
|
|
298
380
|
setWfDiagram(wfDiagramHistory[newIndex]);
|
|
299
381
|
}
|
|
300
|
-
}, [historyIndex, wfDiagramHistory, setHistoryIndex, setWfDiagram,
|
|
382
|
+
}, [historyIndex, wfDiagramHistory, setHistoryIndex, setWfDiagram, isReadOnly]);
|
|
301
383
|
const handleRedo = useCallback(() => {
|
|
302
|
-
if (
|
|
384
|
+
if (isReadOnly)
|
|
303
385
|
return;
|
|
304
386
|
if (historyIndex < wfDiagramHistory.length - 1) {
|
|
305
387
|
isUndoingRedoing.current = true;
|
|
@@ -307,9 +389,9 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, readOnly = false, zoomLevel
|
|
|
307
389
|
setHistoryIndex(newIndex);
|
|
308
390
|
setWfDiagram(wfDiagramHistory[newIndex]);
|
|
309
391
|
}
|
|
310
|
-
}, [historyIndex, wfDiagramHistory, setHistoryIndex, setWfDiagram,
|
|
392
|
+
}, [historyIndex, wfDiagramHistory, setHistoryIndex, setWfDiagram, isReadOnly]);
|
|
311
393
|
const handleDelete = useCallback(() => {
|
|
312
|
-
if (
|
|
394
|
+
if (isReadOnly)
|
|
313
395
|
return;
|
|
314
396
|
if (!wfDiagram || (selectedItems.size === 0 && selectedConnections.size === 0)) {
|
|
315
397
|
return;
|
|
@@ -338,9 +420,9 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, readOnly = false, zoomLevel
|
|
|
338
420
|
setSelectedItems(new Set([...deletableSelectedItems, ...[...selectedItems].filter(id => nonDeletableItems.some(item => item.ID === id))]));
|
|
339
421
|
setSelectedConnections(new Set());
|
|
340
422
|
updateDiagram(newWfDiagram, false);
|
|
341
|
-
}, [wfDiagram, selectedItems, selectedConnections, setWfDiagram, setSelectedItems, setSelectedConnections, updateDiagram,
|
|
423
|
+
}, [wfDiagram, selectedItems, selectedConnections, setWfDiagram, setSelectedItems, setSelectedConnections, updateDiagram, isReadOnly]);
|
|
342
424
|
const handleCopy = useCallback(() => {
|
|
343
|
-
if (
|
|
425
|
+
if (isReadOnly)
|
|
344
426
|
return;
|
|
345
427
|
if (!wfDiagram || selectedItems.size === 0) {
|
|
346
428
|
return;
|
|
@@ -351,9 +433,9 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, readOnly = false, zoomLevel
|
|
|
351
433
|
setCopiedItems(itemsToCopy);
|
|
352
434
|
setCopiedConnections(connectionsToCopy);
|
|
353
435
|
setIsCutOperation(false);
|
|
354
|
-
}, [wfDiagram, selectedItems,
|
|
436
|
+
}, [wfDiagram, selectedItems, isReadOnly]);
|
|
355
437
|
const handleCut = useCallback(() => {
|
|
356
|
-
if (
|
|
438
|
+
if (isReadOnly)
|
|
357
439
|
return;
|
|
358
440
|
if (!wfDiagram || selectedItems.size === 0) {
|
|
359
441
|
return;
|
|
@@ -375,9 +457,9 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, readOnly = false, zoomLevel
|
|
|
375
457
|
setSelectedItems(new Set());
|
|
376
458
|
setSelectedConnections(new Set());
|
|
377
459
|
updateDiagram(newWfDiagram, false);
|
|
378
|
-
}, [wfDiagram, selectedItems, setSelectedItems, setSelectedConnections, updateDiagram,
|
|
460
|
+
}, [wfDiagram, selectedItems, setSelectedItems, setSelectedConnections, updateDiagram, isReadOnly]);
|
|
379
461
|
const handlePaste = useCallback(() => {
|
|
380
|
-
if (
|
|
462
|
+
if (isReadOnly)
|
|
381
463
|
return;
|
|
382
464
|
if (!wfDiagram || (copiedItems.length === 0 && copiedConnections.length === 0)) {
|
|
383
465
|
return;
|
|
@@ -425,9 +507,9 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, readOnly = false, zoomLevel
|
|
|
425
507
|
Connections: combinedConnections,
|
|
426
508
|
};
|
|
427
509
|
updateDiagram(newWfDiagram, false);
|
|
428
|
-
}, [wfDiagram, copiedItems, copiedConnections, isCutOperation, updateDiagram, setSelectedItems, setSelectedConnections,
|
|
510
|
+
}, [wfDiagram, copiedItems, copiedConnections, isCutOperation, updateDiagram, setSelectedItems, setSelectedConnections, isReadOnly]);
|
|
429
511
|
const handleNew = useCallback(() => {
|
|
430
|
-
if (
|
|
512
|
+
if (isReadOnly)
|
|
431
513
|
return;
|
|
432
514
|
const startItem = {
|
|
433
515
|
ID: generateUUID(),
|
|
@@ -463,7 +545,7 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, readOnly = false, zoomLevel
|
|
|
463
545
|
setCopiedItems([]);
|
|
464
546
|
setCopiedConnections([]);
|
|
465
547
|
setIsCutOperation(false);
|
|
466
|
-
}, [wfDiagram,
|
|
548
|
+
}, [wfDiagram, isReadOnly]);
|
|
467
549
|
const handleToggleToolbarMode = () => {
|
|
468
550
|
setIsToolbarFloating(prev => !prev);
|
|
469
551
|
};
|
|
@@ -471,23 +553,23 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, readOnly = false, zoomLevel
|
|
|
471
553
|
setIsToolboxVisible(prev => !prev);
|
|
472
554
|
};
|
|
473
555
|
const handleDoubleClickItem = useCallback((itemId) => {
|
|
474
|
-
if (
|
|
556
|
+
if (isReadOnly)
|
|
475
557
|
return;
|
|
476
558
|
const itemFound = wfDiagram?.DiagramItems.find(item => item.ID === itemId);
|
|
477
559
|
if (itemFound) {
|
|
478
560
|
setItemToEdit(itemFound);
|
|
479
561
|
setIsModalOpen(true);
|
|
480
562
|
}
|
|
481
|
-
}, [wfDiagram,
|
|
563
|
+
}, [wfDiagram, isReadOnly]);
|
|
482
564
|
const handleCloseModal = useCallback(() => {
|
|
483
|
-
if (
|
|
565
|
+
if (isReadOnly)
|
|
484
566
|
return;
|
|
485
567
|
setIsModalOpen(prevIsModalOpen => {
|
|
486
568
|
return false;
|
|
487
569
|
});
|
|
488
|
-
}, [
|
|
570
|
+
}, [isReadOnly]);
|
|
489
571
|
const handleKeyDown = useCallback((event) => {
|
|
490
|
-
if (
|
|
572
|
+
if (isReadOnly)
|
|
491
573
|
return;
|
|
492
574
|
if (['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight', 'Delete', 'Backspace', 'z', 'y'].includes(event.key)) {
|
|
493
575
|
// Prevent the event from bubbling up to parent components (like the TabPanel)
|
|
@@ -563,7 +645,7 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, readOnly = false, zoomLevel
|
|
|
563
645
|
handleDelete();
|
|
564
646
|
return;
|
|
565
647
|
}
|
|
566
|
-
}, [wfDiagram, selectedItems, selectedConnections, handleUndo, handleRedo, handleDelete, updateDiagram, handleCopy, handleCut, handlePaste,
|
|
648
|
+
}, [wfDiagram, selectedItems, selectedConnections, handleUndo, handleRedo, handleDelete, updateDiagram, handleCopy, handleCut, handlePaste, isReadOnly]);
|
|
567
649
|
const handleExportDiagram = useCallback(async () => {
|
|
568
650
|
if (!wfDiagram) {
|
|
569
651
|
// Visualizza un errore se il diagramma non è stato caricato o è vuoto
|
|
@@ -581,16 +663,13 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, readOnly = false, zoomLevel
|
|
|
581
663
|
catch (e) {
|
|
582
664
|
TMExceptionBoxManager.show({ exception: e });
|
|
583
665
|
}
|
|
584
|
-
}, [wfDiagram]);
|
|
666
|
+
}, [wfDiagram]);
|
|
585
667
|
const fileInputRef = useRef(null);
|
|
586
|
-
// Gestore dell'evento click sul bottone (apre la finestra di selezione file)
|
|
587
668
|
const handleImportDiagramClick = useCallback(() => {
|
|
588
669
|
if (fileInputRef.current) {
|
|
589
670
|
fileInputRef.current.click();
|
|
590
671
|
}
|
|
591
672
|
}, []);
|
|
592
|
-
// Gestore dell'evento di selezione file (esegue il parse e chiama il genitore)
|
|
593
|
-
// Gestore dell'evento di selezione file (esegue il parse e chiama il genitore)
|
|
594
673
|
const handleFileChange = useCallback((event) => {
|
|
595
674
|
const file = event.target.files?.[0];
|
|
596
675
|
if (!file) {
|
|
@@ -600,23 +679,15 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, readOnly = false, zoomLevel
|
|
|
600
679
|
reader.onload = (e) => {
|
|
601
680
|
try {
|
|
602
681
|
const xmlContent = e.target?.result;
|
|
603
|
-
// 1. Esegui il parse per ottenere il nuovo oggetto WfDiagram.
|
|
604
682
|
const newWfDiagram = parseWfDiagramXml(xmlContent);
|
|
605
|
-
// 2. TRATTA L'IMPORT COME UNA MODIFICA:
|
|
606
|
-
// Usa updateDiagram per aggiornare lo stato interno (wfDiagram) e la history (wfDiagramHistory).
|
|
607
|
-
// L'originale xmlDiagramString del genitore resta intatto.
|
|
608
|
-
// Passiamo false per 'validate' in quanto il file importato è già stato validato da parseWfDiagramXml.
|
|
609
683
|
updateDiagram(newWfDiagram, false);
|
|
610
|
-
// 3. Resetta l'input per permettere re-import dello stesso file
|
|
611
684
|
if (fileInputRef.current) {
|
|
612
685
|
fileInputRef.current.value = '';
|
|
613
686
|
}
|
|
614
687
|
}
|
|
615
688
|
catch (error) {
|
|
616
|
-
// Gestione dell'errore di parsing (es. file non valido)
|
|
617
689
|
const errorMessage = 'Error importing diagram. Invalid XML format.';
|
|
618
690
|
TMExceptionBoxManager.show({ exception: new Error(errorMessage + `\n${error.message}`) });
|
|
619
|
-
// Resetta l'input anche in caso di errore
|
|
620
691
|
if (fileInputRef.current) {
|
|
621
692
|
fileInputRef.current.value = '';
|
|
622
693
|
}
|
|
@@ -851,14 +922,14 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, readOnly = false, zoomLevel
|
|
|
851
922
|
return "";
|
|
852
923
|
}, [isDrawingConnection, tempConnectionSource, tempConnectionEnd, wfDiagram, isDraggingExistingConnectionEndpoint, draggingConnectionFixedPoint]);
|
|
853
924
|
const handleRestore = useCallback(() => {
|
|
854
|
-
if (
|
|
925
|
+
if (isReadOnly)
|
|
855
926
|
return;
|
|
856
927
|
if (initialDiagramRef.current) {
|
|
857
928
|
setWfDiagram(initialDiagramRef.current);
|
|
858
929
|
setWfDiagramHistory([initialDiagramRef.current]);
|
|
859
930
|
setHistoryIndex(0);
|
|
860
931
|
}
|
|
861
|
-
}, [
|
|
932
|
+
}, [isReadOnly]);
|
|
862
933
|
const autoAdjustDiagram = (diagram) => {
|
|
863
934
|
if (!diagram)
|
|
864
935
|
return diagram;
|
|
@@ -974,13 +1045,13 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, readOnly = false, zoomLevel
|
|
|
974
1045
|
return { ...adjustedItemsDiagram, Connections: adjustedConnections };
|
|
975
1046
|
}, [calculateConnectionPath]);
|
|
976
1047
|
const handleAutoAdjust = useCallback(() => {
|
|
977
|
-
if (
|
|
1048
|
+
if (isReadOnly || !wfDiagram)
|
|
978
1049
|
return;
|
|
979
1050
|
const finalDiagram = getAdjustedAndRecalculatedDiagram(wfDiagram);
|
|
980
1051
|
updateDiagram(finalDiagram, false);
|
|
981
|
-
}, [wfDiagram,
|
|
1052
|
+
}, [wfDiagram, isReadOnly, updateDiagram, getAdjustedAndRecalculatedDiagram]);
|
|
982
1053
|
const handleMouseDown = useCallback((event) => {
|
|
983
|
-
if (
|
|
1054
|
+
if (isReadOnly)
|
|
984
1055
|
return;
|
|
985
1056
|
if (event.target === svgRef.current) {
|
|
986
1057
|
setSelectedItems(new Set());
|
|
@@ -989,9 +1060,9 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, readOnly = false, zoomLevel
|
|
|
989
1060
|
setSelectionRectStart({ x: event.nativeEvent.offsetX, y: event.nativeEvent.offsetY });
|
|
990
1061
|
setSelectionRectEnd(null);
|
|
991
1062
|
}
|
|
992
|
-
}, [
|
|
1063
|
+
}, [isReadOnly]);
|
|
993
1064
|
const handleMouseMove = useCallback((event) => {
|
|
994
|
-
if (
|
|
1065
|
+
if (isReadOnly)
|
|
995
1066
|
return;
|
|
996
1067
|
// Questa parte gestisce la transizione da "clic potenziale" a "trascinamento".
|
|
997
1068
|
// Viene eseguita solo se un mousedown è avvenuto ma il drag non è ancora iniziato.
|
|
@@ -1070,9 +1141,9 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, readOnly = false, zoomLevel
|
|
|
1070
1141
|
// Logica per il trascinamento di un elemento dalla toolbox.
|
|
1071
1142
|
setTempConnectionEnd({ x: event.nativeEvent.offsetX, y: event.nativeEvent.offsetY });
|
|
1072
1143
|
}
|
|
1073
|
-
}, [isDrawingConnection, tempConnectionSource, isDrawingSelectionRect, selectionRectStart, wfDiagram, zoomLevel, translateX, translateY, isDraggingFromToolbox, draggedItemType,
|
|
1144
|
+
}, [isDrawingConnection, tempConnectionSource, isDrawingSelectionRect, selectionRectStart, wfDiagram, zoomLevel, translateX, translateY, isDraggingFromToolbox, draggedItemType, isReadOnly, isDraggingExistingConnectionEndpoint, draggingConnectionFixedPoint, mouseDownPos]);
|
|
1074
1145
|
const handleMouseUp = useCallback((event) => {
|
|
1075
|
-
if (
|
|
1146
|
+
if (isReadOnly)
|
|
1076
1147
|
return;
|
|
1077
1148
|
if (isDrawingConnection) {
|
|
1078
1149
|
// Logica per una nuova connessione, rimane invariata
|
|
@@ -1097,9 +1168,9 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, readOnly = false, zoomLevel
|
|
|
1097
1168
|
}
|
|
1098
1169
|
setIsDraggingFromToolbox(false);
|
|
1099
1170
|
setDraggedItemType(null);
|
|
1100
|
-
}, [isDrawingConnection, tempConnectionSource, tempConnectionEnd, isDrawingSelectionRect, selectionRectStart, selectionRectEnd, wfDiagram, zoomLevel, translateX, translateY,
|
|
1171
|
+
}, [isDrawingConnection, tempConnectionSource, tempConnectionEnd, isDrawingSelectionRect, selectionRectStart, selectionRectEnd, wfDiagram, zoomLevel, translateX, translateY, isReadOnly, isDraggingExistingConnectionEndpoint, draggingConnectionId, draggingEndpointType, draggingConnectionFixedPoint]);
|
|
1101
1172
|
const handleDiagramItemClick = useCallback((id, event) => {
|
|
1102
|
-
if (
|
|
1173
|
+
if (isReadOnly)
|
|
1103
1174
|
return;
|
|
1104
1175
|
event.stopPropagation();
|
|
1105
1176
|
const isCtrlPressed = event.ctrlKey || event.metaKey;
|
|
@@ -1121,9 +1192,9 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, readOnly = false, zoomLevel
|
|
|
1121
1192
|
});
|
|
1122
1193
|
if (!isCtrlPressed)
|
|
1123
1194
|
setSelectedConnections(new Set());
|
|
1124
|
-
}, [
|
|
1195
|
+
}, [isReadOnly]);
|
|
1125
1196
|
const handleConnectionClick = useCallback((id, event) => {
|
|
1126
|
-
if (
|
|
1197
|
+
if (isReadOnly)
|
|
1127
1198
|
return;
|
|
1128
1199
|
event.stopPropagation();
|
|
1129
1200
|
const isCtrlPressed = event.ctrlKey || event.metaKey;
|
|
@@ -1145,9 +1216,9 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, readOnly = false, zoomLevel
|
|
|
1145
1216
|
});
|
|
1146
1217
|
if (!isCtrlPressed)
|
|
1147
1218
|
setSelectedItems(new Set());
|
|
1148
|
-
}, [
|
|
1219
|
+
}, [isReadOnly]);
|
|
1149
1220
|
const handleDrag = useCallback((id, newX, newY) => {
|
|
1150
|
-
if (
|
|
1221
|
+
if (isReadOnly)
|
|
1151
1222
|
return;
|
|
1152
1223
|
setWfDiagram(prevDiagram => {
|
|
1153
1224
|
if (!prevDiagram)
|
|
@@ -1157,9 +1228,9 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, readOnly = false, zoomLevel
|
|
|
1157
1228
|
DiagramItems: prevDiagram.DiagramItems.map(item => item.ID === id ? { ...item, Left: newX, Top: newY } : item),
|
|
1158
1229
|
};
|
|
1159
1230
|
});
|
|
1160
|
-
}, [
|
|
1231
|
+
}, [isReadOnly]);
|
|
1161
1232
|
const handleDragEnd = useCallback((id, finalX, finalY) => {
|
|
1162
|
-
if (
|
|
1233
|
+
if (isReadOnly)
|
|
1163
1234
|
return;
|
|
1164
1235
|
setWfDiagram(prevDiagram => {
|
|
1165
1236
|
if (!prevDiagram)
|
|
@@ -1171,9 +1242,9 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, readOnly = false, zoomLevel
|
|
|
1171
1242
|
updateDiagram(updatedDiagram);
|
|
1172
1243
|
return updatedDiagram;
|
|
1173
1244
|
});
|
|
1174
|
-
}, [updateDiagram,
|
|
1245
|
+
}, [updateDiagram, isReadOnly]);
|
|
1175
1246
|
const handleConnectorMouseDown = useCallback((itemId, connectorName, event) => {
|
|
1176
|
-
if (
|
|
1247
|
+
if (isReadOnly || !wfDiagram)
|
|
1177
1248
|
return;
|
|
1178
1249
|
event.stopPropagation();
|
|
1179
1250
|
// Salva la posizione iniziale del mouse.
|
|
@@ -1181,9 +1252,9 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, readOnly = false, zoomLevel
|
|
|
1181
1252
|
// Imposta il connettore di partenza per un potenziale drag.
|
|
1182
1253
|
setTempConnectionSource({ item: wfDiagram.DiagramItems.find(i => i.ID === itemId), connectorName });
|
|
1183
1254
|
// NON avviare il drag qui. Lo faremo in base al movimento del mouse.
|
|
1184
|
-
}, [wfDiagram,
|
|
1255
|
+
}, [wfDiagram, isReadOnly]);
|
|
1185
1256
|
const handleConnectionEndpointMouseDown = useCallback((connectionId, endpointType, event) => {
|
|
1186
|
-
if (
|
|
1257
|
+
if (isReadOnly)
|
|
1187
1258
|
return;
|
|
1188
1259
|
event.stopPropagation();
|
|
1189
1260
|
setIsDraggingExistingConnectionEndpoint(true);
|
|
@@ -1209,9 +1280,9 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, readOnly = false, zoomLevel
|
|
|
1209
1280
|
}
|
|
1210
1281
|
}
|
|
1211
1282
|
setTempConnectionEnd({ x: event.nativeEvent.offsetX, y: event.nativeEvent.offsetY });
|
|
1212
|
-
}, [wfDiagram,
|
|
1283
|
+
}, [wfDiagram, isReadOnly]);
|
|
1213
1284
|
const handleConnectorMouseUp = useCallback((targetItemId, targetConnectorName) => {
|
|
1214
|
-
if (
|
|
1285
|
+
if (isReadOnly)
|
|
1215
1286
|
return;
|
|
1216
1287
|
// Se isDrawingConnection è false, significa che il mouseup è avvenuto
|
|
1217
1288
|
// prima che il drag fosse avviato (cioè, il mouse non si è mosso oltre la soglia).
|
|
@@ -1275,16 +1346,16 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, readOnly = false, zoomLevel
|
|
|
1275
1346
|
setTempConnectionSource(null);
|
|
1276
1347
|
setTempConnectionEnd(null);
|
|
1277
1348
|
setMouseDownPos(null);
|
|
1278
|
-
}, [isDrawingConnection, tempConnectionSource, wfDiagram, updateDiagram,
|
|
1349
|
+
}, [isDrawingConnection, tempConnectionSource, wfDiagram, updateDiagram, isReadOnly, isDraggingExistingConnectionEndpoint, draggingConnectionId, draggingEndpointType, draggingConnectionFixedPoint]);
|
|
1279
1350
|
const handleDragOver = useCallback((event) => {
|
|
1280
|
-
if (
|
|
1351
|
+
if (isReadOnly) {
|
|
1281
1352
|
event.preventDefault();
|
|
1282
1353
|
return;
|
|
1283
1354
|
}
|
|
1284
1355
|
event.preventDefault();
|
|
1285
|
-
}, [
|
|
1356
|
+
}, [isReadOnly]);
|
|
1286
1357
|
const handleDropOnCanvas = useCallback((event) => {
|
|
1287
|
-
if (
|
|
1358
|
+
if (isReadOnly)
|
|
1288
1359
|
return;
|
|
1289
1360
|
event.preventDefault();
|
|
1290
1361
|
if (isDraggingFromToolbox && draggedItemType !== null && wfDiagram) {
|
|
@@ -1319,7 +1390,7 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, readOnly = false, zoomLevel
|
|
|
1319
1390
|
setIsDraggingFromToolbox(false);
|
|
1320
1391
|
setDraggedItemType(null);
|
|
1321
1392
|
}
|
|
1322
|
-
}, [isDraggingFromToolbox, draggedItemType, wfDiagram, updateDiagram, zoomLevel,
|
|
1393
|
+
}, [isDraggingFromToolbox, draggedItemType, wfDiagram, updateDiagram, zoomLevel, isReadOnly]);
|
|
1323
1394
|
const currentSelectionRect = useMemo(() => {
|
|
1324
1395
|
if (isDrawingSelectionRect && selectionRectStart && selectionRectEnd) {
|
|
1325
1396
|
const x = Math.min(selectionRectStart.x, selectionRectEnd.x);
|
|
@@ -1331,16 +1402,16 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, readOnly = false, zoomLevel
|
|
|
1331
1402
|
return null;
|
|
1332
1403
|
}, [isDrawingSelectionRect, selectionRectStart, selectionRectEnd]);
|
|
1333
1404
|
const handleToolboxDragStart = useCallback((event, itemType) => {
|
|
1334
|
-
if (
|
|
1405
|
+
if (isReadOnly) {
|
|
1335
1406
|
event.preventDefault();
|
|
1336
1407
|
return;
|
|
1337
1408
|
}
|
|
1338
1409
|
setIsDraggingFromToolbox(true);
|
|
1339
1410
|
setDraggedItemType(itemType);
|
|
1340
1411
|
event.dataTransfer.setData("text/plain", itemType.toString());
|
|
1341
|
-
}, [
|
|
1412
|
+
}, [isReadOnly]);
|
|
1342
1413
|
const handleToolboxDragEnd = () => {
|
|
1343
|
-
if (
|
|
1414
|
+
if (isReadOnly)
|
|
1344
1415
|
return;
|
|
1345
1416
|
setIsDraggingFromToolbox(false);
|
|
1346
1417
|
setDraggedItemType(null);
|
|
@@ -1388,7 +1459,56 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, readOnly = false, zoomLevel
|
|
|
1388
1459
|
// DiagramItemTypes.SignAndTimeStamp
|
|
1389
1460
|
];
|
|
1390
1461
|
}, []);
|
|
1462
|
+
const toggleReadOnlyMode = useCallback(() => {
|
|
1463
|
+
if (isReadOnly) {
|
|
1464
|
+
setIsReadOnly(false);
|
|
1465
|
+
return;
|
|
1466
|
+
}
|
|
1467
|
+
// Condizione per mostrare il messaggio di conferma
|
|
1468
|
+
const hasPendingState = wfDiagramHistory.length > 1 || selectedItems.size > 0 || selectedConnections.size > 0;
|
|
1469
|
+
if (hasPendingState) {
|
|
1470
|
+
TMMessageBoxManager.show({
|
|
1471
|
+
title: "Progettazione diagramma",
|
|
1472
|
+
message: "Attenzione: Stai uscendo dalla modalità di progettazione. Tutte le selezioni attive verranno annullate. Vuoi continuare?",
|
|
1473
|
+
buttons: [ButtonNames.YES, ButtonNames.NO],
|
|
1474
|
+
onButtonClick: async (e) => {
|
|
1475
|
+
try {
|
|
1476
|
+
if (e !== ButtonNames.YES)
|
|
1477
|
+
return;
|
|
1478
|
+
setIsReadOnly(true);
|
|
1479
|
+
setSelectedItems(new Set());
|
|
1480
|
+
setSelectedConnections(new Set());
|
|
1481
|
+
}
|
|
1482
|
+
catch (error) {
|
|
1483
|
+
console.error("Errore nel cambio modalità:", error);
|
|
1484
|
+
}
|
|
1485
|
+
}
|
|
1486
|
+
});
|
|
1487
|
+
}
|
|
1488
|
+
else {
|
|
1489
|
+
// Nessuna modifica pendente o elemento selezionato, cambia direttamente
|
|
1490
|
+
setIsReadOnly(true);
|
|
1491
|
+
}
|
|
1492
|
+
}, [isReadOnly, wfDiagramHistory, selectedItems, selectedConnections]);
|
|
1493
|
+
const toggleFullScreenMode = useCallback(() => {
|
|
1494
|
+
setIsFullScreen(prev => !prev);
|
|
1495
|
+
}, []);
|
|
1496
|
+
const handleZoomIn = useCallback(() => {
|
|
1497
|
+
setZoomLevel(prev => Math.min(prev + 0.1, 2.0)); // Limite max a 2.0
|
|
1498
|
+
}, []);
|
|
1499
|
+
const handleZoomOut = useCallback(() => {
|
|
1500
|
+
setZoomLevel(prev => Math.max(prev - 0.1, 0.5)); // Limite min a 0.5
|
|
1501
|
+
}, []);
|
|
1502
|
+
const formattedZoomLevel = useMemo(() => {
|
|
1503
|
+
return `${Math.round(zoomLevel * 100)}%`;
|
|
1504
|
+
}, [zoomLevel]);
|
|
1391
1505
|
useEffect(() => {
|
|
1506
|
+
// Se l'XML che ho appena ricevuto (xmlDiagramString) è lo stesso che ho notificato al genitore,
|
|
1507
|
+
// significa che la modifica è partita da me ed è solo un ciclo di riconciliazione.
|
|
1508
|
+
if (xmlDiagramString && notifiedXmlRef.current === xmlDiagramString) {
|
|
1509
|
+
notifiedXmlRef.current = null;
|
|
1510
|
+
return;
|
|
1511
|
+
}
|
|
1392
1512
|
// se undo/redo, il `xmlDiagramString` è cambiato ma la storia non deve essere resettata.
|
|
1393
1513
|
if (isUndoingRedoing.current) {
|
|
1394
1514
|
isUndoingRedoing.current = false;
|
|
@@ -1427,9 +1547,9 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, readOnly = false, zoomLevel
|
|
|
1427
1547
|
isUndoingRedoing.current = false;
|
|
1428
1548
|
}
|
|
1429
1549
|
}, [wfDiagram]);
|
|
1430
|
-
|
|
1431
|
-
, onChange: handleFileChange, style: { display: 'none' } }),
|
|
1432
|
-
(_jsxs(StyledLoadingContainer, { children: [_jsx(StyledSpinner, {}), _jsx("span", { children: `${'Caricamento diagramma'}...` })] })) : wfDiagram ? (_jsx(StyledSvg, { ref: svgRef, tabIndex: 0, onKeyDownCapture: handleKeyDown, onMouseMove: handleMouseMove, onMouseUp: handleMouseUp, onMouseDown: handleMouseDown, onDrop: handleDropOnCanvas, onDragOver: handleDragOver, width: svgWidth, height: svgHeight, children: _jsxs(ScalableGroup, { "$scale": zoomLevel, "$translateX": translateX, "$translateY": translateY, children: [wfDiagram?.DiagramItems.map(item => (_jsx(DiagramItemComponent, { wf: wfDiagram?.Info, readOnly:
|
|
1550
|
+
const diagramContent = (_jsxs(CanvasContainer, { children: [_jsx("input", { ref: fileInputRef, type: "file", accept: ".xml" // Filtra per file XML
|
|
1551
|
+
, onChange: handleFileChange, style: { display: 'none' } }), _jsxs(ToolbarContainer, { "$isCollapsed": isToolbarCollapsed, "$isFloating": isToolbarFloating, "$isToolboxVisible": isToolboxVisible, "$isReadOnly": isReadOnly, children: [_jsx(ButtonGroup, { "$isFloating": isToolbarFloating, children: _jsxs("button", { onClick: toggleReadOnlyMode, title: "Progettazione", children: [isReadOnly ? _jsx(IconPencil, {}) : _jsx(IconLock, {}), !isToolbarCollapsed && _jsx("span", { children: isReadOnly ? 'Progettazione' : 'Sola lettura' })] }) }), _jsxs(ButtonGroup, { "$isFloating": isToolbarFloating, children: [!isReadOnly && _jsxs("button", { onClick: handleToggleToolboxVisibility, title: "Show toolbox", children: [_jsx(IconFlowChart, {}), !isToolbarCollapsed && _jsx("span", { children: "Mostra/nascondi toolbox" })] }), _jsxs("button", { onClick: toggleFullScreenMode, title: "Show full screen", children: [_jsx(IconWindowMaximize, {}), !isToolbarCollapsed && _jsx("span", { children: "Mostra tutto schermo" })] })] }), _jsxs(ButtonGroup, { "$isFloating": isToolbarFloating, children: [_jsxs("button", { onClick: handleZoomIn, title: "Zoom in", children: [_jsx(IconZoomIn, {}), !isToolbarCollapsed && _jsx("span", { children: "Zoom in" })] }), _jsxs("button", { onClick: handleZoomOut, title: "Zoom out", children: [_jsx(IconZoomOut, {}), !isToolbarCollapsed && _jsx("span", { children: "Zoom out" })] }), _jsx(ZoomLevelText, { "$isFloating": isToolbarFloating, "$isCollapsed": isToolbarCollapsed, children: formattedZoomLevel })] }), !isReadOnly && _jsxs(ButtonGroup, { "$isFloating": isToolbarFloating, children: [_jsxs("button", { onClick: handleUndo, disabled: historyIndex === 0, title: "Undo", children: [_jsx(IconUndo, {}), " ", !isToolbarCollapsed && _jsx("span", { children: "Undo" })] }), _jsxs("button", { onClick: handleRedo, disabled: historyIndex === wfDiagramHistory.length - 1, title: "Redo", children: [_jsx(IconUndo, { style: { transform: 'scaleX(-1)' } }), " ", !isToolbarCollapsed && _jsx("span", { children: "Redo" })] }), _jsxs("button", { onClick: handleRestore, title: "Restore", children: [_jsx(IconRestore, {}), " ", !isToolbarCollapsed && _jsx("span", { children: "Restore" })] }), _jsxs("button", { onClick: handleNew, title: "New diagram", disabled: isReadOnly, children: [_jsx(IconNew, {}), " ", !isToolbarCollapsed && _jsx("span", { children: "New" })] }), _jsxs("button", { onClick: handleExportDiagram, disabled: isReadOnly || !wfDiagram, title: SDKUI_Localizator.Export || 'Export Diagram', children: [_jsx(IconExport, {}), _jsx("span", { children: SDKUI_Localizator.Export || 'Export' })] }), _jsxs("button", { onClick: handleImportDiagramClick, disabled: isReadOnly, title: SDKUI_Localizator.Import || 'Import Diagram', children: [_jsx(IconImport, {}), _jsx("span", { children: SDKUI_Localizator.Import || 'Import' })] })] }), !isReadOnly && _jsx(ButtonGroup, { "$isFloating": isToolbarFloating, children: _jsxs("button", { onClick: handleAutoAdjust, title: "Auto adjust", children: [_jsx(IconAdjust, {}), " ", !isToolbarCollapsed && _jsx("span", { children: "Auto Adjust" })] }) }), !isReadOnly && _jsxs(ButtonGroup, { "$isFloating": isToolbarFloating, children: [_jsxs("button", { onClick: handleCopy, disabled: selectedItems.size === 0, title: "Copy", children: [_jsx(IconCopy, {}), " ", !isToolbarCollapsed && _jsx("span", { children: "Copy" })] }), _jsxs("button", { onClick: handleCut, disabled: selectedItems.size === 0, title: "Cut", children: [_jsx(IconCut, {}), " ", !isToolbarCollapsed && _jsx("span", { children: "Cut" })] }), _jsxs("button", { onClick: handlePaste, disabled: copiedItems.length === 0 && copiedConnections.length === 0, title: "Paste", children: [_jsx(IconPaste, {}), " ", !isToolbarCollapsed && _jsx("span", { children: "Paste" })] })] }), _jsxs("button", { onClick: handleToggleToolbarMode, title: isToolbarFloating ? "Dock Toolbar" : "Float Toolbar", children: [isToolbarFloating ? _jsx(IconPin, {}) : _jsx(IconUnpin, {}), !isToolbarCollapsed && !isToolbarFloating && _jsx("span", { children: "Toggle Mode" })] }), !isToolbarFloating && _jsx(ToolbarToggle, { onClick: () => setIsToolbarCollapsed(!isToolbarCollapsed), title: isToolbarCollapsed ? "Expand Toolbar" : "Collapse Toolbar", children: isToolbarCollapsed ? _jsx(IconChevronRight, {}) : _jsx(IconCloseOutline, {}) })] }), !isReadOnly && (_jsx(ToolboxContainer, { "$isVisible": isToolboxVisible, children: isToolboxVisible && availableItemTypes.map(type => (_jsxs(ToolboxItem, { draggable: true, onDragStart: (e) => handleToolboxDragStart(e, type), onDragEnd: handleToolboxDragEnd, children: [_jsx(DiagramItemSvgContent, { itemType: type, width: 40, height: 40, isToolboxPreview: true }), _jsx("span", { children: DiagramItemTypes[type] })] }, type))) })), _jsx(SvgScrollContainer, { children: isLoading ?
|
|
1552
|
+
(_jsxs(StyledLoadingContainer, { children: [_jsx(StyledSpinner, {}), _jsx("span", { children: `${'Caricamento diagramma'}...` })] })) : wfDiagram ? (_jsx(StyledSvg, { ref: svgRef, tabIndex: 0, onKeyDownCapture: handleKeyDown, onMouseMove: handleMouseMove, onMouseUp: handleMouseUp, onMouseDown: handleMouseDown, onDrop: handleDropOnCanvas, onDragOver: handleDragOver, width: svgWidth, height: svgHeight, children: _jsxs(ScalableGroup, { "$scale": zoomLevel, "$translateX": translateX, "$translateY": translateY, children: [wfDiagram?.DiagramItems.map(item => (_jsx(DiagramItemComponent, { wf: wfDiagram?.Info, readOnly: isReadOnly, item: item, isSelected: selectedItems.has(item.ID), isCurrent: item.ID === currentSetID, onClick: handleDiagramItemClick, onDrag: handleDrag, onDragEnd: handleDragEnd, onConnectorMouseDown: handleConnectorMouseDown, onConnectorMouseUp: handleConnectorMouseUp, onDimensionsChange: handleItemDimensionsChange, onDoubleClick: handleDoubleClickItem }, item.ID))), calculatedConnections.map(connection => {
|
|
1433
1553
|
const sourceItem = wfDiagram?.DiagramItems.find(item => item.ID === connection.Source.ParentDiagramItem.ID);
|
|
1434
1554
|
const sinkItem = wfDiagram?.DiagramItems.find(item => item.ID === connection.Sink.ParentDiagramItem.ID);
|
|
1435
1555
|
if (!sourceItem || !sinkItem)
|
|
@@ -1441,5 +1561,7 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, readOnly = false, zoomLevel
|
|
|
1441
1561
|
const isThisConnectionBeingDragged = isDraggingExistingConnectionEndpoint && draggingConnectionId === connection.ID;
|
|
1442
1562
|
return (_jsx(ConnectionComponent, { connection: connection, isSelected: selectedConnections.has(connection.ID), sourcePoint: sourcePoint, sinkPoint: sinkPoint, isTemporary: isThisConnectionBeingDragged, onClick: handleConnectionClick, onConnectionEndpointMouseDown: handleConnectionEndpointMouseDown }, connection.ID));
|
|
1443
1563
|
}), isDrawingConnection && tempConnectionPathData && (_jsx(TempConnectionPath, { d: tempConnectionPathData })), isDraggingExistingConnectionEndpoint && tempConnectionPathData && (_jsx(TempConnectionPath, { d: tempConnectionPathData })), isDrawingSelectionRect && currentSelectionRect && (_jsx(SelectionRect, { x: currentSelectionRect.x, y: currentSelectionRect.y, width: currentSelectionRect.width, height: currentSelectionRect.height }))] }) })) : (_jsx(DiagramMessage, { children: `${SDKUI_Localizator.WorkflowDiagramMissingOrInvalid} ...` })) }), isModalOpen && itemToEdit && (_jsx(DiagramItemForm, { itemToEdit: itemToEdit, wf: wfDiagram?.Info, onClose: handleCloseModal, onApply: handleUpdateDiagramItem }))] }));
|
|
1564
|
+
const diagramRef = useRef(null);
|
|
1565
|
+
return (_jsxs(_Fragment, { children: [!isFullScreen && (_jsx(DiagramWrapper, { ref: diagramRef, children: diagramContent })), isFullScreen && ReactDOM.createPortal(_jsx(FullScreenContainer, { children: diagramContent }), document.body)] }));
|
|
1444
1566
|
};
|
|
1445
1567
|
export default WFDiagram;
|
|
@@ -8,7 +8,7 @@ const PasswordStrengthChecker = ({ password, onValidationChange }) => {
|
|
|
8
8
|
return [
|
|
9
9
|
{
|
|
10
10
|
label: SDKUI_Localizator.PasswordRule_Length,
|
|
11
|
-
test: (pw) => pw.length >=
|
|
11
|
+
test: (pw) => pw.length >= 16 && pw.length <= 128,
|
|
12
12
|
},
|
|
13
13
|
{
|
|
14
14
|
label: SDKUI_Localizator.PasswordRule_Lowercase,
|
|
@@ -359,13 +359,13 @@ export declare class SDKUI_Localizator {
|
|
|
359
359
|
static get PasswordContainsUsernameError(): "Das Passwort darf den Benutzernamen nicht enthalten" | "The password cannot contain the username" | "La contraseña no puede contener el nombre de usuario" | "Le mot de passe ne peut pas contenir le nom d'utilisateur" | "A senha não pode conter o nome de usuário" | "La password non può contenere il nome utente";
|
|
360
360
|
static get PasswordConfirmError(): "Entspricht nicht dem neuen Passwort" | "Does not match the new password" | "No coincide con la nueva contraseña" | "Ne correspond pas au nouveau mot de passe" | "Não corresponde à nova senha" | "Non corrisponde alla nuova password";
|
|
361
361
|
static get PasswordEqualsUsernameError(): "Das Passwort darf nicht mit dem Benutzernamen identisch sein" | "The password cannot be the same as the username" | "La contraseña no puede ser la misma que el nombre de usuario" | "Le mot de passe ne peut pas être identique au nom d'utilisateur" | "A senha não pode ser igual ao nome do usuário" | "La password non può coincidere con il nome utente";
|
|
362
|
-
static get PasswordLengthError(): "Das Passwort muss zwischen
|
|
362
|
+
static get PasswordLengthError(): "Das Passwort muss zwischen 16 und 128 Zeichen enthalten" | "Password must contain between 16 and 128 characters" | "La contraseña debe contener entre 16 y 128 caracteres" | "Le mot de passe doit contenir entre 16 et 128 caractères" | "A senha deve conter entre 16 e 128 caracteres" | "La password deve contenere tra 16 e 128 caratteri";
|
|
363
363
|
static get PasswordLowercaseError(): "Das Passwort muss Kleinbuchstaben enthalten (a-z)" | "Password must include lowercase character (a-z)" | "La contraseña debe incluir caracteres en minúscula (a-z)" | "Le mot de passe doit inclure un caractère minuscule (a-z)" | "A senha deve incluir caracteres minúsculos (a-z)" | "La password deve includere caratteri minuscoli (a-z)";
|
|
364
364
|
static get PasswordNumberError(): "Das Passwort muss Zahlen enthalten (0-9)" | "Password must include number (0-9)" | "La contraseña debe incluir números (0-9)" | "Le mot de passe doit inclure des chiffres (0-9)" | "A senha deve incluir números (0-9)" | "La password deve includere numeri (0-9)";
|
|
365
365
|
static get PasswordSymbolError(): "Das Passwort muss mindestens ein Sonderzeichen enthalten (!\"#$%&'()*+,-./:;<=>?@[]^_{|})" | "The password must contain at least one special character (!\"#$%&'()*+,-./:;<=>?@[]^_{|})" | "La contraseña debe contener al menos un carácter especial. (!\"#$%&'()*+,-./:;<=>?@[]^_{|})" | "Le mot de passe doit contenir au moins un caractère spécial (!\"#$%&'()*+,-./:;<=>?@[]^_{|})" | "A senha deve conter pelo menos um caractere especial (!\"#$%&'()*+,-./:;<=>?@[]^_{|})" | "La password deve contenere almeno un carattere speciale (!\"#$%&'()*+,-./:;<=>?@[]^_{|})";
|
|
366
366
|
static get PasswordUppercaseError(): "Das Passwort muss Großbuchstaben enthalten (A-Z)" | "Password must include uppercase character (A-Z)" | "La contraseña debe incluir caracteres en mayúscula (A-Z)" | "Le mot de passe doit inclure un caractère majuscule (A-Z)" | "A senha deve incluir caracteres maiúsculos (A-Z)" | "La password deve includere caratteri maiuscoli (A-Z)";
|
|
367
367
|
static get PasswordRule_Requirement(): "Das neue Passwort muss enthalten:" | "The new password must contain:" | "La nueva contraseña debe contener:" | "Le nouveau mot de passe doit contenir :" | "A nova senha deve conter:" | "La nuova password deve contenere:";
|
|
368
|
-
static get PasswordRule_Length(): "Zwischen
|
|
368
|
+
static get PasswordRule_Length(): "Zwischen 16 und 128 Zeichen." | "Between 16 and 128 characters." | "Entre 16 y 128 caracteres." | "Entre 16 et 128 caractères." | "Entre 16 e 128 caracteres." | "Tra 16 e 128 caratteri.";
|
|
369
369
|
static get PasswordRule_Lowercase(): "Kleinbuchstaben (a–z)." | "Lowercase characters (a–z)." | "Letras minúsculas (a–z)." | "Caractères minuscules (a–z)." | "Lettere minuscole (a–z).";
|
|
370
370
|
static get PasswordRule_Uppercase(): "Großbuchstaben (A–Z)." | "Uppercase character (A–Z)." | "Letra mayúscula (A–Z)." | "Caractère majuscule (A–Z)." | "Letra maiúscula (A–Z)." | "Lettere maiuscole (A–Z).";
|
|
371
371
|
static get PasswordRule_Number(): "Zahlen (0–9)." | "Number (0–9)." | "Números (0–9)." | "Chiffre (0–9)." | "Numeri (0–9).";
|