@topconsultnpm/sdkui-react-beta 6.16.68 → 6.16.69

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.
@@ -189,7 +189,7 @@ const TMFileManager = (props) => {
189
189
  const handleDragLeave = (e) => {
190
190
  setIsDragging(false);
191
191
  };
192
- return _jsx(TMPanel, { title: SDKUI_Localizator.Drafts, totalItems: dcmtsFound ?? 0, showHeader: showPanel, onBack: (isMobile && openDraftList) ? onBackCallback : undefined, onClose: onClosePanel, allowMaximize: !isMobile ? allowMaximize : false, onMaximize: !isMobile ? onMaximizePanel : undefined, onHeaderDoubleClick: !isMobile ? onMaximizePanel : undefined, toolbar: toolbar, children: _jsx("div", { style: { flexDirection: "column", height: "100%", width: "100%", }, children: _jsxs(TMConditionalWrapper, { condition: !isMobile, wrapper: children => _jsx("div", { style: { display: "flex", flexGrow: 1, height: "100%" }, children: _jsx(TMSplitterLayout, { direction: 'horizontal', showSeparator: true, separatorColor: 'transparent', separatorActiveColor: 'transparent', min: ['0', '0'], start: [isLeftPanelCollapsed ? '0%' : "32.5%", isLeftPanelCollapsed ? '100%' : "67.5%"], children: children }, "TMWGs-panels-treeView") }), children: [_jsxs("div", { style: {
192
+ return _jsx(TMPanel, { title: SDKUI_Localizator.Drafts, totalItems: dcmtsFound ?? 0, showHeader: showPanel, onBack: (isMobile && openDraftList) ? onBackCallback : undefined, onClose: onClosePanel, allowMaximize: !isMobile ? allowMaximize : false, onMaximize: !isMobile ? onMaximizePanel : undefined, onHeaderDoubleClick: !isMobile ? onMaximizePanel : undefined, toolbar: toolbar, children: _jsx("div", { style: { flexDirection: "column", height: "100%", width: "100%", }, children: _jsxs(TMConditionalWrapper, { condition: !isMobile, wrapper: children => _jsx("div", { style: { display: "flex", flexGrow: 1, height: "100%" }, children: _jsx(TMSplitterLayout, { direction: 'horizontal', showSeparator: true, separatorColor: 'transparent', separatorActiveColor: 'transparent', min: ['0', '0'], start: [isLeftPanelCollapsed ? '0%' : "32%", isLeftPanelCollapsed ? '100%' : "68%"], children: children }, "TMWGs-panels-treeView") }), children: [_jsxs("div", { style: {
193
193
  height: "100%",
194
194
  width: "100%",
195
195
  ...(isMobile && { display: openDraftList ? 'none' : 'block', transition: "opacity 0.3s ease-in-out" }),
@@ -6,7 +6,6 @@ interface IWFDiagramProps {
6
6
  translateX?: number;
7
7
  translateY?: number;
8
8
  currentSetID?: string;
9
- onDiagramImport?: (newXmlString: string) => void;
10
9
  }
11
10
  declare const WFDiagram: React.FC<IWFDiagramProps>;
12
11
  export default WFDiagram;
@@ -205,7 +205,7 @@ const DiagramMessage = styled.div `
205
205
  color: #555;
206
206
  text-align: center;
207
207
  `;
208
- const WFDiagram = ({ xmlDiagramString, currentSetID, readOnly = false, zoomLevel = 1, translateX = 0, translateY = 0, onDiagramImport }) => {
208
+ const WFDiagram = ({ xmlDiagramString, currentSetID, readOnly = false, zoomLevel = 1, translateX = 0, translateY = 0 }) => {
209
209
  const [isLoading, setIsLoading] = useState(true);
210
210
  const [wfDiagram, setWfDiagram] = useState(null);
211
211
  const [selectedItems, setSelectedItems] = useState(new Set());
@@ -270,31 +270,6 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, readOnly = false, zoomLevel
270
270
  const totalHeight = finalMaxY - finalMinY;
271
271
  return { svgWidth: Math.max(0, totalWidth * zoomLevel), svgHeight: Math.max(0, totalHeight * zoomLevel) };
272
272
  }, [wfDiagram, zoomLevel]);
273
- // const updateWfDiagram = useCallback((newDiagram: WfDiagram) => {
274
- // if (readOnly) return;
275
- // try {
276
- // validateDiagram(newDiagram);
277
- // setWfDiagram(newDiagram);
278
- // if (!isUndoingRedoing.current) {
279
- // setWfDiagramHistory(prevHistory => {
280
- // const newHistory = prevHistory.slice(0, historyIndex + 1);
281
- // return [...newHistory, newDiagram];
282
- // });
283
- // setHistoryIndex(prevIndex => prevIndex + 1);
284
- // }
285
- // } catch (e: any) {
286
- // TMExceptionBoxManager.show({ exception: e });
287
- // }
288
- // }, [historyIndex, readOnly]);
289
- // const updateDiagramAndHistory = useCallback((newDiagram: WfDiagram) => {
290
- // if (readOnly) return;
291
- // if (!isUndoingRedoing.current) {
292
- // const newHistory = wfDiagramHistory.slice(0, historyIndex + 1);
293
- // setWfDiagramHistory([...newHistory, newDiagram]);
294
- // setHistoryIndex(newHistory.length);
295
- // }
296
- // setWfDiagram(newDiagram);
297
- // }, [wfDiagramHistory, historyIndex, isUndoingRedoing, setWfDiagramHistory, setHistoryIndex, setWfDiagram, readOnly]);
298
273
  const updateDiagram = useCallback((newDiagram, validate = true) => {
299
274
  if (readOnly)
300
275
  return;
@@ -615,6 +590,7 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, readOnly = false, zoomLevel
615
590
  }
616
591
  }, []);
617
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)
618
594
  const handleFileChange = useCallback((event) => {
619
595
  const file = event.target.files?.[0];
620
596
  if (!file) {
@@ -624,15 +600,13 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, readOnly = false, zoomLevel
624
600
  reader.onload = (e) => {
625
601
  try {
626
602
  const xmlContent = e.target?.result;
627
- // 1. Esegui il parse per validare il file.
628
- // parseWfDiagramXml lancerà un errore se l'XML è invalido o malformato,
629
- // intercettato nel blocco catch.
630
- // NON ASSEGNIAMO wfDiagram QUI, MA CHIAMIAMO SOLO PER VERIFICA.
631
- parseWfDiagramXml(xmlContent);
632
- // 2. Se il parsing ha successo, comunichiamo la nuova stringa XML al genitore.
633
- // Il genitore sarà responsabile di aggiornare lo stato di xmlDiagramString,
634
- // il che farà re-renderizzare questo componente con il nuovo diagramma.
635
- onDiagramImport?.(xmlContent);
603
+ // 1. Esegui il parse per ottenere il nuovo oggetto WfDiagram.
604
+ 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
+ updateDiagram(newWfDiagram, false);
636
610
  // 3. Resetta l'input per permettere re-import dello stesso file
637
611
  if (fileInputRef.current) {
638
612
  fileInputRef.current.value = '';
@@ -649,7 +623,7 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, readOnly = false, zoomLevel
649
623
  }
650
624
  };
651
625
  reader.readAsText(file, 'UTF-8');
652
- }, [onDiagramImport]);
626
+ }, [updateDiagram]);
653
627
  const calculateConnectionPath = useCallback((connection, sourceItem, sinkItem) => {
654
628
  const sourcePoint = getConnectionPoint(sourceItem, connection.Source.ConnectorName);
655
629
  const sinkPoint = getConnectionPoint(sinkItem, connection.Sink.ConnectorName);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react-beta",
3
- "version": "6.16.68",
3
+ "version": "6.16.69",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",