@topconsultnpm/sdkui-react-beta 6.14.97 → 6.14.99

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.
@@ -3,6 +3,7 @@ import { DeviceType } from '../../base/TMDeviceProvider';
3
3
  interface ToppyHelpCenterProps {
4
4
  content?: React.ReactNode;
5
5
  deviceType?: DeviceType;
6
+ usePortal?: boolean;
6
7
  }
7
8
  declare const ToppyHelpCenter: React.FC<ToppyHelpCenterProps>;
8
9
  export default ToppyHelpCenter;
@@ -4,7 +4,7 @@ import ReactDOM from 'react-dom';
4
4
  import styled, { keyframes, css } from 'styled-components';
5
5
  import Toppy from '../../../assets/Toppy-generico.png'; // Assicurati che il percorso dell'immagine sia corretto
6
6
  import { DeviceType } from '../../base/TMDeviceProvider'; // Assicurati che il percorso del tipo sia corretto
7
- import { IconChevronDown, IconChevronRight } from '../../../helper';
7
+ import { IconWindowMinimize, IconWindowMaximize } from '../../../helper';
8
8
  const toppyEntrance = keyframes `
9
9
  0% { right: -200px; opacity: 0; }
10
10
  60% { opacity: 1; }
@@ -41,14 +41,14 @@ const wiggle = keyframes `
41
41
  `;
42
42
  // Styled Components
43
43
  const ToppyContainer = styled.div `
44
- position: fixed;
45
- bottom: ${({ $isCollapsed }) => ($isCollapsed ? '5px' : '-20px')};
44
+ position: ${({ $fixed }) => ($fixed ? 'fixed' : 'absolute')};
45
+ bottom: ${({ $isCollapsed, $isMobile }) => $isMobile ? '70px' : $isCollapsed ? '5px' : '-20px'};
46
46
  right: ${({ $isCollapsed }) => ($isCollapsed ? '5px' : '10px')};
47
47
  display: flex;
48
- flex-direction: column-reverse; /* Impila l'immagine sotto il contenuto */
49
- align-items: flex-end; /* Allinea gli elementi a destra all'interno della colonna */
50
- animation: ${toppyEntrance} 0.5s cubic-bezier(0.23, 1, 0.32, 1);
51
- z-index: 2147483647; /* massimo valore possibile */
48
+ flex-direction: column-reverse;
49
+ align-items: flex-end;
50
+ animation: ${({ $fixed }) => $fixed && css `${toppyEntrance} 0.5s cubic-bezier(0.23, 1, 0.32, 1)`};
51
+ z-index: ${({ $fixed }) => ($fixed ? 2147483647 : 10)};
52
52
  `;
53
53
  const ToppyImage = styled.img `
54
54
  width: ${({ $isMobile, $isCollapsed }) => $isCollapsed ? '60px' : $isMobile ? '90px' : '120px'};
@@ -69,6 +69,7 @@ const ToppyImage = styled.img `
69
69
  `;
70
70
  const ToppyContent = styled.div `
71
71
  margin-bottom: ${props => props.$isMobile ? '10px' : '20px'};
72
+ display: ${props => (props.$isCollapsed ? 'none' : 'block')};
72
73
  width: max-content;
73
74
  max-width: 250px;
74
75
  background: linear-gradient(
@@ -77,7 +78,7 @@ const ToppyContent = styled.div `
77
78
  rgba(27, 20, 100, 0.65) 100%
78
79
  );
79
80
  color: white;
80
- padding: 20px;
81
+ padding: 10px;
81
82
  border-radius: 10px;
82
83
  border: 1px solid #FFFFFF;
83
84
  opacity: ${props => (props.$isCollapsed ? 0 : 1)};
@@ -107,28 +108,35 @@ const CollapseButton = styled.button `
107
108
  cursor: pointer;
108
109
  font-size: 1.2rem;
109
110
  `;
110
- const ToppyHelpCenter = ({ content, deviceType }) => {
111
+ const ToppyHelpCenter = ({ content, deviceType, usePortal = true }) => {
111
112
  const [isCollapsed, setIsCollapsed] = useState(false);
112
113
  const [portalContainer, setPortalContainer] = useState(null);
113
114
  useEffect(() => {
115
+ if (deviceType === DeviceType.MOBILE)
116
+ setIsCollapsed(true);
117
+ }, [deviceType]);
118
+ useEffect(() => {
119
+ if (!usePortal)
120
+ return;
114
121
  const portalRoot = document.createElement('div');
115
122
  portalRoot.setAttribute('id', 'toppy-portal-root');
116
123
  document.body.appendChild(portalRoot);
117
124
  setPortalContainer(portalRoot);
118
- // viene eseguita quando il componente viene smontato
119
125
  return () => {
120
126
  document.body.removeChild(portalRoot);
121
127
  };
122
- }, []);
128
+ }, [usePortal]);
123
129
  const toggleCollapse = (e) => {
124
130
  e.stopPropagation();
125
131
  setIsCollapsed(!isCollapsed);
126
132
  };
127
- if (!portalContainer) {
128
- return null;
129
- }
130
133
  const isMobile = deviceType === DeviceType.MOBILE;
131
- const toppyComponent = (_jsxs(ToppyContainer, { "$isMobile": isMobile, "$isCollapsed": isCollapsed, children: [_jsx(ToppyImage, { "$isMobile": isMobile, "$isCollapsed": isCollapsed, onClick: toggleCollapse, src: Toppy, alt: "Toppy" }), _jsxs(ToppyContent, { "$isCollapsed": isCollapsed, "$isMobile": isMobile, children: [_jsx(CollapseButton, { onClick: toggleCollapse, children: isCollapsed ? _jsx(IconChevronRight, {}) : _jsx(IconChevronDown, {}) }), content] })] }));
132
- return ReactDOM.createPortal(toppyComponent, portalContainer);
134
+ const toppyComponent = (_jsxs(ToppyContainer, { "$isMobile": isMobile, "$isCollapsed": isCollapsed, "$fixed": usePortal, children: [_jsx(ToppyImage, { "$isMobile": isMobile, "$isCollapsed": isCollapsed, onClick: toggleCollapse, src: Toppy, alt: "Toppy" }), _jsxs(ToppyContent, { "$isCollapsed": isCollapsed, "$isMobile": isMobile, children: [_jsx(CollapseButton, { onClick: toggleCollapse, children: isCollapsed ? _jsx(IconWindowMaximize, {}) : _jsx(IconWindowMinimize, {}) }), content] })] }));
135
+ if (usePortal) {
136
+ if (!portalContainer)
137
+ return null;
138
+ return ReactDOM.createPortal(toppyComponent, portalContainer);
139
+ }
140
+ return toppyComponent;
133
141
  };
134
142
  export default ToppyHelpCenter;
@@ -638,7 +638,7 @@ const TMDcmtForm = ({ showHeader = true, onSaveRecents, layoutMode = LayoutModes
638
638
  isEditable: true,
639
639
  value: FormulaHelper.addFormulaTag(newFormula.expression)
640
640
  }));
641
- } }), 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) }), (isModal && onClose) && _jsx("div", { id: "TMDcmtFormShowConfirmForClose-" + id })] }), showToppyForApprove && (_jsx(ToppyHelpCenter, { deviceType: deviceType, content: workItems.length === 1 ?
641
+ } }), 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) }), (isModal && onClose) && _jsx("div", { id: "TMDcmtFormShowConfirmForClose-" + id })] }), showToppyForApprove && (_jsx(ToppyHelpCenter, { deviceType: deviceType, usePortal: false, content: workItems.length === 1 ?
642
642
  _jsx("div", { style: { display: 'flex', flexDirection: 'column', gap: '10px' }, children: _jsx(WorkFlowOperationButtons, { deviceType: deviceType, onApprove: () => setShowApprovePopup(true), onSignApprove: () => ShowAlert({ message: 'TODO', mode: 'info', title: SDKUI_Localizator.SignatureAndApprove, duration: 3000 }), onReject: () => { setShowRejectPopup(true); }, onReAssign: () => { setShowReAssignPopup(true); }, onMoreInfo: () => {
643
643
  const did = Number(DID);
644
644
  openTaskFormHandler((task) => {
@@ -44,12 +44,12 @@ const CommandsContextMenu = React.memo(({ target, menuItems, allowPin }) => {
44
44
  //#endregion Internal Components
45
45
  //#region Helper Methods
46
46
  export const getSearchResultCountersSingleCategory = (searchResults) => {
47
- let totDcmtTypes = searchResults.length;
47
+ // let totDcmtTypes = searchResults.length;
48
48
  let totDcmts = 0;
49
49
  for (let dcmt of searchResults) {
50
50
  totDcmts += dcmt.dcmtsFound ?? 0;
51
51
  }
52
- return ` (${totDcmtTypes} / ${totDcmts})`;
52
+ return ` (${totDcmts})`;
53
53
  };
54
54
  const orderByName = (array) => {
55
55
  let arr = [...array];
@@ -34,7 +34,7 @@ export const BlogPostContainer = styled.div `
34
34
  cursor: ${(props) => (props.$canNavigate ? "pointer" : "default")};
35
35
  border-radius: 5px;
36
36
  margin: 5px 0;
37
- padding: '10px';
37
+ padding: 10px;
38
38
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
39
39
  word-wrap: break-word;
40
40
  white-space: pre-wrap;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react-beta",
3
- "version": "6.14.97",
3
+ "version": "6.14.99",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",