@topconsultnpm/sdkui-react 6.19.0-dev2.47 → 6.19.0-dev2.49

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.
@@ -1,14 +1,14 @@
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 { useRef, useState, useEffect } from 'react';
3
3
  import styled from 'styled-components';
4
4
  import Toppy from '../../../assets/Toppy-generico.png';
5
5
  import { DeviceType } from '../../base/TMDeviceProvider';
6
6
  import ToppySpeechBubble from './ToppySpeechBubble';
7
7
  /**
8
- * Styled component per il pulsante di Toppy
8
+ * Styled component per il contenitore di Toppy
9
9
  * Gestisce il posizionamento, le dimensioni e le animazioni
10
10
  */
11
- const ToppyButton = styled.button.attrs((props) => ({
11
+ const ToppyButton = styled.div.attrs((props) => ({
12
12
  style: {
13
13
  // Applica left/top come stili inline per evitare la generazione di troppe classi CSS
14
14
  ...(props.$x !== undefined && props.$y !== undefined
@@ -30,7 +30,7 @@ const ToppyButton = styled.button.attrs((props) => ({
30
30
  /* Posizionamento di default quando non è draggato (x e y non sono definiti) */
31
31
  ${(props) => props.$x === undefined || props.$y === undefined
32
32
  ? `
33
- bottom: -20px;
33
+ bottom: ${props.$isMobile ? '0px' : '-20px'};
34
34
  ${props.$align === 'left' ? 'left: 10px;' : 'right: 10px;'};
35
35
  `
36
36
  : ''}
@@ -39,6 +39,8 @@ const ToppyButton = styled.button.attrs((props) => ({
39
39
  z-index: 2147483647;
40
40
  background-color: transparent;
41
41
  border: none;
42
+ padding: 0;
43
+ outline: none;
42
44
 
43
45
  /* Dimensioni dinamiche in base allo stato collassato e al tipo di dispositivo
44
46
  Usa min() per adattarsi su schermi piccoli */
@@ -73,17 +75,14 @@ const ToppyButton = styled.button.attrs((props) => ({
73
75
  }
74
76
  return props.$isCollapsed ? '60px' : '140px';
75
77
  }};
76
- pointer-events: none;
78
+ pointer-events: ${(props) => (props.$isMobile ? 'auto' : 'none')};
77
79
  border-radius: 50%; /* Rende l'immagine circolare */
78
80
  /* Rotazione leggera in base all'allineamento */
79
81
  transform: ${(props) => props.$align === 'left' ? 'rotate(20deg)' : 'rotate(-20deg)'};
80
82
  transition: transform 0.2s ease, box-shadow 0.2s ease;
81
83
 
82
84
  /* Animazione di pulsazione quando è collassato per attirare l'attenzione */
83
- ${(props) => props.$isCollapsed &&
84
- `
85
- animation: toppyPulse 1.5s infinite;
86
- `}
85
+ ${(props) => props.$isCollapsed && `animation: toppyPulse 1.5s infinite;`}
87
86
  }
88
87
 
89
88
  /* Keyframes per l'animazione di pulsazione */
@@ -105,6 +104,19 @@ const ToppyButton = styled.button.attrs((props) => ({
105
104
  }
106
105
  }
107
106
  `;
107
+ /**
108
+ * Overlay trasparente per bloccare le interazioni durante il drag
109
+ * Previene problemi di performance con iframe e altri elementi interattivi
110
+ */
111
+ const DragOverlay = styled.div `
112
+ position: fixed;
113
+ top: 0;
114
+ left: 0;
115
+ right: 0;
116
+ bottom: 0;
117
+ z-index: 2147483646;
118
+ cursor: grabbing;
119
+ `;
108
120
  /**
109
121
  * Componente ToppyDraggableHelpCenter
110
122
  *
@@ -113,7 +125,7 @@ const ToppyButton = styled.button.attrs((props) => ({
113
125
  * contenitore e può essere collassato/espanso con un doppio click.
114
126
  */
115
127
  const ToppyDraggableHelpCenter = ({ content, deviceType, align = 'right', onToppyImageClick, initialIsCollapsed, isVisible = true, }) => {
116
- // Ref per il pulsante principale
128
+ // Ref per il contenitore principale
117
129
  const buttonRef = useRef(null);
118
130
  // Stato per controllare se il componente è collassato o espanso
119
131
  const [isCollapsed, setIsCollapsed] = useState(initialIsCollapsed ?? false);
@@ -168,11 +180,12 @@ const ToppyDraggableHelpCenter = ({ content, deviceType, align = 'right', onTopp
168
180
  maxX = Math.min(maxX, parentRect.width - extraWidth);
169
181
  }
170
182
  }
171
- const maxY = parentRect.height - rect.height;
183
+ const bubbleBuffer = 5; // Buffer per evitare che la bubble esca leggermente dai bordi
184
+ const maxY = parentRect.height - rect.height + 20; // +20px per permettere bottom: -20px
172
185
  // Verifica se la posizione corrente è fuori dai limiti
173
186
  const isOutOfBounds = position.x < minX ||
174
187
  position.x > maxX ||
175
- position.y < extraHeight ||
188
+ position.y < extraHeight + bubbleBuffer ||
176
189
  position.y > maxY;
177
190
  // Se è fuori dai limiti, resetta alla posizione default
178
191
  if (isOutOfBounds) {
@@ -260,8 +273,11 @@ const ToppyDraggableHelpCenter = ({ content, deviceType, align = 'right', onTopp
260
273
  // Calcola la nuova posizione X rispettando i limiti
261
274
  const newX = Math.max(minX, Math.min(e.clientX - parentRect.left - dragOffset.current.x, maxX));
262
275
  // Calcola la nuova posizione Y rispettando i limiti
263
- // Il limite superiore tiene conto dell'altezza della bubble
264
- const newY = Math.max(extraHeight, Math.min(e.clientY - parentRect.top - dragOffset.current.y, parentRect.height - rect.height));
276
+ // Il limite superiore tiene conto dell'altezza della bubble + buffer di sicurezza
277
+ // Il limite inferiore include 20px extra per permettere bottom: -20px
278
+ const bubbleBuffer = 5; // Buffer per evitare che la bubble esca leggermente dai bordi
279
+ const maxY = parentRect.height - rect.height + 20;
280
+ const newY = Math.max(extraHeight + bubbleBuffer, Math.min(e.clientY - parentRect.top - dragOffset.current.y, maxY));
265
281
  setPosition({ x: newX, y: newY });
266
282
  };
267
283
  /**
@@ -299,7 +315,8 @@ const ToppyDraggableHelpCenter = ({ content, deviceType, align = 'right', onTopp
299
315
  }
300
316
  return undefined;
301
317
  }, [isDragging]);
302
- return (_jsxs(ToppyButton, { ref: buttonRef, "$align": align, "$isDragging": isDragging, "$x": position?.x, "$y": position?.y, "$isVisible": isVisible, "$isCollapsed": isCollapsed, "$isMobile": isMobile, onMouseDown: handleMouseDown, onContextMenu: (e) => e.preventDefault(), onClick: (e) => { if (isMobile)
303
- toggleCollapse(e); }, onDoubleClick: toggleCollapse, children: [(content && !isCollapsed) && (_jsx(ToppySpeechBubble, { ref: bubbleRef, align: align, children: content })), _jsx("img", { src: Toppy, alt: "Toppy Help", draggable: false })] }));
318
+ // Renderizza l'overlay solo durante il drag
319
+ const renderDragOverlay = isDragging && _jsx(DragOverlay, {});
320
+ return (_jsxs(_Fragment, { children: [renderDragOverlay, _jsxs(ToppyButton, { ref: buttonRef, "$align": align, "$isDragging": isDragging, "$x": position?.x, "$y": position?.y, "$isVisible": isVisible, "$isCollapsed": isCollapsed, "$isMobile": isMobile, onMouseDown: !isMobile ? handleMouseDown : undefined, onContextMenu: (e) => e.preventDefault(), onDoubleClick: !isMobile ? toggleCollapse : undefined, children: [(content && !isCollapsed) && (_jsx(ToppySpeechBubble, { ref: bubbleRef, align: align, children: content })), _jsx("img", { src: Toppy, alt: "Toppy Help", draggable: false, onClick: isMobile ? toggleCollapse : undefined })] })] }));
304
321
  };
305
322
  export default ToppyDraggableHelpCenter;
@@ -1353,7 +1353,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
1353
1353
  isEditable: true,
1354
1354
  value: FormulaHelper.addFormulaTag(newFormula.expression)
1355
1355
  }));
1356
- } }), showApprovePopup && _jsx(WorkFlowApproveRejectPopUp, { deviceType: deviceType, onCompleted: handleWFOperationCompleted, TID: approvalVID, DID: DID, isReject: 0, onClose: () => setShowApprovePopup(false) }), showRejectPopup && _jsx(WorkFlowApproveRejectPopUp, { deviceType: deviceType, onCompleted: handleWFOperationCompleted, TID: approvalVID, DID: DID, isReject: 1, onClose: () => setShowRejectPopup(false) }), showReAssignPopup && _jsx(WorkFlowReAssignPopUp, { deviceType: deviceType, onCompleted: handleWFOperationCompleted, TID: approvalVID, DID: DID, onClose: () => setShowReAssignPopup(false) }), showMoreInfoPopup && _jsx(WorkFlowMoreInfoPopUp, { deviceType: deviceType, onCompleted: handleWFOperationCompleted, TID: approvalVID, DID: DID, onClose: () => setShowMoreInfoPopup(false) }), (isModal && onClose) && _jsx("div", { id: "TMDcmtFormShowConfirmForClose-" + id })] }), (showToppyForApprove || showToppyForCompleteMoreInfo || showToppyForReferences) && (_jsx(ToppyDraggableHelpCenter, { deviceType: deviceType, content: _jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '10px' }, children: [showToppyForApprove && (workItems.length === 1 ?
1356
+ } }), showApprovePopup && _jsx(WorkFlowApproveRejectPopUp, { deviceType: deviceType, onCompleted: handleWFOperationCompleted, TID: approvalVID, DID: DID, isReject: 0, onClose: () => setShowApprovePopup(false) }), showRejectPopup && _jsx(WorkFlowApproveRejectPopUp, { deviceType: deviceType, onCompleted: handleWFOperationCompleted, TID: approvalVID, DID: DID, isReject: 1, onClose: () => setShowRejectPopup(false) }), showReAssignPopup && _jsx(WorkFlowReAssignPopUp, { deviceType: deviceType, onCompleted: handleWFOperationCompleted, TID: approvalVID, DID: DID, onClose: () => setShowReAssignPopup(false) }), showMoreInfoPopup && _jsx(WorkFlowMoreInfoPopUp, { deviceType: deviceType, onCompleted: handleWFOperationCompleted, TID: approvalVID, DID: DID, onClose: () => setShowMoreInfoPopup(false) }), (isModal && onClose) && _jsx("div", { id: "TMDcmtFormShowConfirmForClose-" + id })] }), (showToppyForApprove || showToppyForCompleteMoreInfo || showToppyForReferences) && (_jsx(ToppyDraggableHelpCenter, { initialIsCollapsed: false, deviceType: deviceType, content: _jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '10px' }, children: [showToppyForApprove && (workItems.length === 1 ?
1357
1357
  _jsx(WorkFlowOperationButtons, { deviceType: deviceType, onApprove: () => setShowApprovePopup(true), onSignApprove: handleSignApprove, onReject: () => setShowRejectPopup(true), onReAssign: () => setShowReAssignPopup(true), onMoreInfo: () => setShowMoreInfoPopup(true), dtd: fromDTD })
1358
1358
  :
1359
1359
  _jsxs("div", { style: { padding: 10, color: 'white', maxWidth: '180px', borderRadius: 10, background: '#1B1464 0% 0% no-repeat padding-box', border: '1px solid #FFFFFF' }, children: [`Devi approvare ${workItems.length} workitem(s) per questo documento.`, `Vai alla sezione di approvazione.`] })), showToppyForCompleteMoreInfo && (_jsxs(_Fragment, { children: [_jsx("div", { style: { padding: 10, color: 'white', maxWidth: '180px', borderRadius: 10, background: '#1B1464 0% 0% no-repeat padding-box', border: '1px solid #FFFFFF' }, children: `${SDKUI_Localizator.MoreInfoCompleteRequestSentBy} ${taskMoreInfo?.fromName}!` }), _jsx(TMButton, { caption: SDKUI_Localizator.CommentAndComplete, color: 'success', showTooltip: false, onClick: () => {
@@ -585,7 +585,7 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
585
585
  setIsModifiedBatchUpdate(false);
586
586
  await refreshSelectionDataRowsAsync();
587
587
  }, onStatusChanged: (isModified) => { setIsModifiedBatchUpdate(isModified); } }), (showToppyForApprove && !showApprovePopup && !showRejectPopup && !showReAssignPopup && !showMoreInfoPopup && !openS4TViewer && !showTodoDcmtForm) &&
588
- _jsx(ToppyDraggableHelpCenter, { deviceType: deviceType, content: _jsx("div", { style: { display: 'flex', flexDirection: 'column', gap: '10px' }, children: _jsx(WorkFlowOperationButtons, { deviceType: deviceType, onApprove: () => {
588
+ _jsx(ToppyDraggableHelpCenter, { initialIsCollapsed: false, deviceType: deviceType, content: _jsx("div", { style: { display: 'flex', flexDirection: 'column', gap: '10px' }, children: _jsx(WorkFlowOperationButtons, { deviceType: deviceType, onApprove: () => {
589
589
  setShowApprovePopup(true);
590
590
  }, onSignApprove: () => {
591
591
  handleSignApprove();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react",
3
- "version": "6.19.0-dev2.47",
3
+ "version": "6.19.0-dev2.49",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",