@topconsultnpm/sdkui-react 6.20.0-dev1.97 → 6.20.0-dev1.98
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/components/NewComponents/FloatingMenuBar/styles.js +1 -1
- package/lib/components/features/documents/TMDcmtForm.js +3 -5
- package/lib/components/features/search/TMSearchResult.js +1 -1
- package/lib/components/features/workflow/diagram/DiagramItemComponent.d.ts +1 -0
- package/lib/components/features/workflow/diagram/DiagramItemComponent.js +11 -5
- package/lib/components/features/workflow/diagram/WFDiagram.d.ts +1 -0
- package/lib/components/features/workflow/diagram/WFDiagram.js +10 -4
- package/lib/hooks/useDataListItem.js +3 -2
- package/lib/ts/types.d.ts +1 -1
- package/package.json +1 -1
|
@@ -37,7 +37,7 @@ export const FloatingContainer = styled.div.attrs(props => ({
|
|
|
37
37
|
},
|
|
38
38
|
})) `
|
|
39
39
|
position: ${props => props.$isConstrained ? 'absolute' : 'fixed'};
|
|
40
|
-
z-index: ${props => props.$isConfigMode ? 9999 :
|
|
40
|
+
z-index: ${props => props.$isConfigMode ? 9999 : 1500};
|
|
41
41
|
display: flex;
|
|
42
42
|
flex-direction: ${props => props.$orientation === 'horizontal' ? 'row' : 'column'};
|
|
43
43
|
align-items: center;
|
|
@@ -587,14 +587,12 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
587
587
|
return;
|
|
588
588
|
}
|
|
589
589
|
try {
|
|
590
|
-
// Estrai i dati necessari dal primo workItem
|
|
591
|
-
const firstWorkItem = workItems[0];
|
|
592
590
|
// Costruisci WFInstanceDescriptor dai dati disponibili
|
|
593
591
|
const wfInstance = {
|
|
594
592
|
wfid: workflows[0].id,
|
|
595
|
-
tid:
|
|
596
|
-
did: DID,
|
|
597
|
-
instanceId:
|
|
593
|
+
tid: workflows[0].mtid,
|
|
594
|
+
did: DID ? Number(DID) : 0,
|
|
595
|
+
instanceId: undefined,
|
|
598
596
|
rowIndex: 0,
|
|
599
597
|
values: []
|
|
600
598
|
};
|
|
@@ -618,7 +618,7 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
|
|
|
618
618
|
setIsOpenBatchUpdate(false);
|
|
619
619
|
setIsModifiedBatchUpdate(false);
|
|
620
620
|
await refreshSelectionDataRowsAsync();
|
|
621
|
-
}, onStatusChanged: (isModified) => { setIsModifiedBatchUpdate(isModified); } }), _jsx(TMToppyDraggableHelpCenter, { usePortal:
|
|
621
|
+
}, onStatusChanged: (isModified) => { setIsModifiedBatchUpdate(isModified); } }), _jsx(TMToppyDraggableHelpCenter, { usePortal: true, isVisible: isToppyHelpCenterVisible, content: _jsx("div", { style: { display: 'flex', flexDirection: 'column', gap: '10px' }, children: _jsx(WorkFlowOperationButtons, { deviceType: deviceType, onApprove: () => {
|
|
622
622
|
setShowApprovePopup(true);
|
|
623
623
|
}, onSignApprove: () => {
|
|
624
624
|
handleSignApprove();
|
|
@@ -6,6 +6,7 @@ interface DiagramItemComponentProps {
|
|
|
6
6
|
isSelected: boolean;
|
|
7
7
|
isCurrent: boolean;
|
|
8
8
|
readOnly: boolean;
|
|
9
|
+
allowItemClick?: boolean;
|
|
9
10
|
onClick: (id: string, event: React.MouseEvent) => void;
|
|
10
11
|
onDrag: (id: string, newX: number, newY: number) => void;
|
|
11
12
|
onDragEnd: (id: string, finalX: number, finalY: number) => void;
|
|
@@ -38,7 +38,13 @@ const AnimatingGroup = styled.g `
|
|
|
38
38
|
`}
|
|
39
39
|
`;
|
|
40
40
|
const StyledDiagramItem = styled.g `
|
|
41
|
-
cursor: ${props =>
|
|
41
|
+
cursor: ${props => {
|
|
42
|
+
if (props.$isReadOnly && props.$allowItemClick)
|
|
43
|
+
return 'pointer';
|
|
44
|
+
if (props.$isReadOnly)
|
|
45
|
+
return 'default';
|
|
46
|
+
return props.$isDragging ? 'grabbing' : 'grab';
|
|
47
|
+
}};
|
|
42
48
|
filter: ${props => (props.$isSelected || props.$isDragging || props.$isHovered ? 'drop-shadow(2px 4px 6px rgba(0,0,0,0.4))' : 'none')};
|
|
43
49
|
|
|
44
50
|
& .item-main-shape {
|
|
@@ -81,7 +87,7 @@ const ConnectorHitArea = styled.circle `
|
|
|
81
87
|
opacity: 0;
|
|
82
88
|
pointer-events: all;
|
|
83
89
|
`;
|
|
84
|
-
const DiagramItemComponent = ({ wf, item, isSelected, isCurrent, readOnly, onClick, onDrag, onDragEnd, onConnectorMouseDown, onConnectorMouseUp, onDimensionsChange, onDoubleClick, backgroundColor, }) => {
|
|
90
|
+
const DiagramItemComponent = ({ wf, item, isSelected, isCurrent, readOnly, allowItemClick = false, onClick, onDrag, onDragEnd, onConnectorMouseDown, onConnectorMouseUp, onDimensionsChange, onDoubleClick, backgroundColor, }) => {
|
|
85
91
|
const diagramItemRef = useRef(null);
|
|
86
92
|
const textRef = useRef(null);
|
|
87
93
|
const [isDragging, setIsDragging] = useState(false);
|
|
@@ -206,12 +212,12 @@ const DiagramItemComponent = ({ wf, item, isSelected, isCurrent, readOnly, onCli
|
|
|
206
212
|
};
|
|
207
213
|
}, [isDragging, handleMouseMove, handleMouseUp, readOnly]);
|
|
208
214
|
const handleItemClick = useCallback((event) => {
|
|
209
|
-
if (readOnly)
|
|
215
|
+
if (readOnly && !allowItemClick)
|
|
210
216
|
return;
|
|
211
217
|
if (!isDragging) {
|
|
212
218
|
onClick(item.ID, event);
|
|
213
219
|
}
|
|
214
|
-
}, [item.ID, onClick, isDragging, readOnly]);
|
|
220
|
+
}, [item.ID, onClick, isDragging, readOnly, allowItemClick]);
|
|
215
221
|
const handleMouseEnter = useCallback(() => {
|
|
216
222
|
setIsHovered(true);
|
|
217
223
|
}, []);
|
|
@@ -258,6 +264,6 @@ const DiagramItemComponent = ({ wf, item, isSelected, isCurrent, readOnly, onCli
|
|
|
258
264
|
}
|
|
259
265
|
return (_jsxs(_Fragment, { children: [isTruncated && _jsx("title", { children: item.ItemName }), backgroundColor && (_jsx("rect", { x: "-5", y: "-5", width: calculatedWidth + 10, height: calculatedHeight + 10, rx: "12", ry: "12", fill: backgroundColor, opacity: "0.4", style: { filter: 'blur(3px)' } })), _jsx("rect", { x: "0", y: "0", width: calculatedWidth, height: calculatedHeight, className: "item-main-shape", fill: "transparent" }), _jsx("g", { transform: `translate(${svgX}, ${svgY})`, children: _jsx(DiagramItemSvgContent, { itemType: item.Type, width: iconRenderWidth, height: iconRenderHeight, statusData: statusData }) }), textLines.length > 0 && (_jsx("text", { ref: textRef, x: calculatedWidth / 2, dominantBaseline: "central", className: "item-text", children: textLines.map((line, index) => (_jsx("tspan", { x: calculatedWidth / 2, dy: index === 0 ? PADDING_TOP + SVG_ICON_SIZE + SPACING_SVG_TEXT : FONT_SIZE + 1, children: line }, index))) })), connectors] }));
|
|
260
266
|
};
|
|
261
|
-
return (_jsx(StyledDiagramItem, { ref: diagramItemRef, transform: `translate(${currentPosition.x}, ${currentPosition.y})`, "$isSelected": isSelected, "$itemType": item.Type, "$isDragging": isDragging, "$isHovered": isHovered, "$isReadOnly": readOnly, onMouseDown: handleMouseDown, onClick: handleItemClick, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, onDoubleClick: handleDoubleClick, children: _jsx(AnimatingGroup, { "$isCurrent": isCurrent, children: renderContent() }) }));
|
|
267
|
+
return (_jsx(StyledDiagramItem, { ref: diagramItemRef, transform: `translate(${currentPosition.x}, ${currentPosition.y})`, "$isSelected": isSelected, "$itemType": item.Type, "$isDragging": isDragging, "$isHovered": isHovered, "$isReadOnly": readOnly, "$allowItemClick": allowItemClick, onMouseDown: handleMouseDown, onClick: handleItemClick, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, onDoubleClick: handleDoubleClick, children: _jsx(AnimatingGroup, { "$isCurrent": isCurrent, children: renderContent() }) }));
|
|
262
268
|
};
|
|
263
269
|
export default React.memo(DiagramItemComponent);
|
|
@@ -7,6 +7,7 @@ interface IWFDiagramProps {
|
|
|
7
7
|
onDiagramChange?: (newXmlDiagram: string) => void;
|
|
8
8
|
workitems?: IWorkItemData[];
|
|
9
9
|
defaultAutoZoom?: boolean;
|
|
10
|
+
onDiagramItemClick?: (itemId: string, event: React.MouseEvent) => void;
|
|
10
11
|
}
|
|
11
12
|
declare const WFDiagram: React.FC<IWFDiagramProps>;
|
|
12
13
|
export default WFDiagram;
|
|
@@ -319,7 +319,7 @@ const DiagramMessage = styled.div `
|
|
|
319
319
|
color: #555;
|
|
320
320
|
text-align: center;
|
|
321
321
|
`;
|
|
322
|
-
const WFDiagram = ({ xmlDiagramString, currentSetID, allowEdit = true, onDiagramChange, workitems, defaultAutoZoom = false }) => {
|
|
322
|
+
const WFDiagram = ({ xmlDiagramString, currentSetID, allowEdit = true, onDiagramChange, workitems, defaultAutoZoom = false, onDiagramItemClick }) => {
|
|
323
323
|
const [isReadOnly, setIsReadOnly] = useState(true);
|
|
324
324
|
const [isFullScreen, setIsFullScreen] = useState(false);
|
|
325
325
|
const [zoomLevel, setZoomLevel] = useState(1);
|
|
@@ -1258,6 +1258,12 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, allowEdit = true, onDiagram
|
|
|
1258
1258
|
setDraggedItemType(null);
|
|
1259
1259
|
}, [isDrawingConnection, tempConnectionSource, tempConnectionEnd, isDrawingSelectionRect, selectionRectStart, selectionRectEnd, wfDiagram, zoomLevel, translateX, translateY, isReadOnly, isDraggingExistingConnectionEndpoint, draggingConnectionId, draggingEndpointType, draggingConnectionFixedPoint]);
|
|
1260
1260
|
const handleDiagramItemClick = useCallback((id, event) => {
|
|
1261
|
+
// Se allowEdit è false e ci sono workitems, delega al parent se la callback è definita
|
|
1262
|
+
if (!allowEdit && workitems && workitems.length > 0 && onDiagramItemClick) {
|
|
1263
|
+
event.stopPropagation();
|
|
1264
|
+
onDiagramItemClick(id, event);
|
|
1265
|
+
return;
|
|
1266
|
+
}
|
|
1261
1267
|
if (isReadOnly)
|
|
1262
1268
|
return;
|
|
1263
1269
|
event.stopPropagation();
|
|
@@ -1280,7 +1286,7 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, allowEdit = true, onDiagram
|
|
|
1280
1286
|
});
|
|
1281
1287
|
if (!isCtrlPressed)
|
|
1282
1288
|
setSelectedConnections(new Set());
|
|
1283
|
-
}, [isReadOnly]);
|
|
1289
|
+
}, [isReadOnly, allowEdit, workitems, onDiagramItemClick]);
|
|
1284
1290
|
const handleConnectionClick = useCallback((id, event) => {
|
|
1285
1291
|
if (isReadOnly)
|
|
1286
1292
|
return;
|
|
@@ -1816,7 +1822,7 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, allowEdit = true, onDiagram
|
|
|
1816
1822
|
}, [isFullScreen]);
|
|
1817
1823
|
const diagramContent = (_jsxs(CanvasContainer, { onDoubleClick: handleCanvasDoubleClick, children: [_jsx("input", { ref: fileInputRef, type: "file", accept: ".xml" // Filtra per file XML
|
|
1818
1824
|
, onChange: handleFileChange, style: { display: 'none' } }), SDK_Globals.tmSession?.SessionDescr?.appModuleID === AppModules.SURFER ?
|
|
1819
|
-
_jsx(TMFloatingMenuBar, { containerRef: diagramRef, defaultPosition: { x:
|
|
1825
|
+
_jsx(TMFloatingMenuBar, { containerRef: diagramRef, defaultPosition: { x: 45, y: 85 }, disbaleConfigMode: true, defaultItems: [
|
|
1820
1826
|
{ icon: _jsx(IconZoomIn, {}), name: SDKUI_Localizator.ZoomIn, disabled: isAutoZoomEnabled, onClick: () => { handleZoomIn(); }, id: 'zoom-in', isPinned: true },
|
|
1821
1827
|
{ icon: _jsx(IconZoomOut, {}), name: SDKUI_Localizator.ZoomOut, disabled: isAutoZoomEnabled, onClick: () => { handleZoomOut(); }, id: 'zoom-out', isPinned: true },
|
|
1822
1828
|
{ icon: _jsx(IconZoomAuto, {}), name: 'AutoZoom', onClick: () => { handleToggleAutoZoom(); }, id: 'zoom-auto', isPinned: true, isToggle: isAutoZoomEnabled },
|
|
@@ -1826,7 +1832,7 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, allowEdit = true, onDiagram
|
|
|
1826
1832
|
(_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, style: {
|
|
1827
1833
|
opacity: (defaultAutoZoom && !isInitialZoomCalculated) ? 0 : 1,
|
|
1828
1834
|
transition: 'opacity 0.15s ease-in'
|
|
1829
|
-
}, 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, backgroundColor: getWorkItemBackgroundColor(item.ID) }, item.ID))), calculatedConnections.map(connection => {
|
|
1835
|
+
}, children: _jsxs(ScalableGroup, { "$scale": zoomLevel, "$translateX": translateX, "$translateY": translateY, children: [wfDiagram?.DiagramItems.map(item => (_jsx(DiagramItemComponent, { wf: wfDiagram?.Info, readOnly: isReadOnly, allowItemClick: !allowEdit && workitems && workitems.length > 0 && !!onDiagramItemClick, 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, backgroundColor: getWorkItemBackgroundColor(item.ID) }, item.ID))), calculatedConnections.map(connection => {
|
|
1830
1836
|
const sourceItem = wfDiagram?.DiagramItems.find(item => item.ID === connection.Source.ParentDiagramItem.ID);
|
|
1831
1837
|
const sinkItem = wfDiagram?.DiagramItems.find(item => item.ID === connection.Sink.ParentDiagramItem.ID);
|
|
1832
1838
|
if (!sourceItem || !sinkItem)
|
|
@@ -95,6 +95,7 @@ export const useDataListItem = () => {
|
|
|
95
95
|
const renderDataListCell = useCallback((value, dataListID, dataListViewMode) => {
|
|
96
96
|
const stringValue = convertToDataListValue(value);
|
|
97
97
|
const showIcon = dataListViewMode !== DataListViewModes.Description;
|
|
98
|
+
const showText = dataListViewMode !== DataListViewModes.Image;
|
|
98
99
|
const dataListItem = getDataListItem(dataListID, stringValue);
|
|
99
100
|
const getIcon = () => {
|
|
100
101
|
if (!showIcon)
|
|
@@ -107,7 +108,7 @@ export const useDataListItem = () => {
|
|
|
107
108
|
? _jsx(TMImageLibrary, { imageID: dataListItem.imageID })
|
|
108
109
|
: _jsx(IconWarning, { color: TMColors.warning });
|
|
109
110
|
};
|
|
110
|
-
return (_jsxs(StyledDivHorizontal, { style: { width: '100%' }, title: dataListItem ? dataListItem.value : SDKUI_Localizator.ValueNotPresent, children: [getIcon(), _jsx("p", { style: {
|
|
111
|
+
return (_jsxs(StyledDivHorizontal, { style: { width: '100%' }, title: dataListItem ? dataListItem.value : SDKUI_Localizator.ValueNotPresent, children: [getIcon(), showText && (_jsx("p", { style: {
|
|
111
112
|
textAlign: 'left',
|
|
112
113
|
marginLeft: showIcon ? '5px' : '',
|
|
113
114
|
opacity: dataListItem ? 1 : 0.5,
|
|
@@ -116,7 +117,7 @@ export const useDataListItem = () => {
|
|
|
116
117
|
textOverflow: 'ellipsis',
|
|
117
118
|
flexGrow: 1,
|
|
118
119
|
minWidth: 0
|
|
119
|
-
}, children: dataListItem ? dataListItem.name : convertToDataListDisplayValue(value) })] }));
|
|
120
|
+
}, children: dataListItem ? dataListItem.name : convertToDataListDisplayValue(value) }))] }));
|
|
120
121
|
}, [getDataListItem]);
|
|
121
122
|
return {
|
|
122
123
|
loadDataListsAsync,
|
package/lib/ts/types.d.ts
CHANGED
|
@@ -316,7 +316,7 @@ export declare enum buildTypes {
|
|
|
316
316
|
*/
|
|
317
317
|
export interface WFInstanceDescriptor {
|
|
318
318
|
/** ID dell'istanza */
|
|
319
|
-
instanceId: string;
|
|
319
|
+
instanceId: string | undefined;
|
|
320
320
|
/** Indice della riga nel search result */
|
|
321
321
|
rowIndex: number;
|
|
322
322
|
/** Struttura metadati completa da searchResultToDataSource: { [key: string]: { md: MetadataDescriptor, value: any } } */
|