@topconsultnpm/sdkui-react-beta 6.14.80 → 6.14.81

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.
@@ -67,17 +67,17 @@ const TMDcmtForm = ({ showHeader = true, onSaveRecents, layoutMode = LayoutModes
67
67
  const [dcmtFile, setDcmtFile] = useState(null);
68
68
  const [focusedMetadataValue, setFocusedMetadataValue] = useState();
69
69
  const [showAll, setShowAll] = useState(layoutMode === LayoutModes.Ark);
70
- const [fetchError, setFetchError] = useState(null);
70
+ const [fetchError, setFetchError] = useState(false);
71
71
  const [workItems, setWorkItems] = useState([]);
72
72
  const { openConfirmAttachmentsDialog, ConfirmAttachmentsDialog } = useInputAttachmentsDialog();
73
73
  const { abortController, showWaitPanel, waitPanelTitle, showPrimary, waitPanelTextPrimary, waitPanelValuePrimary, waitPanelMaxValuePrimary, showSecondary, waitPanelTextSecondary, waitPanelValueSecondary, waitPanelMaxValueSecondary, downloadDcmtsAsync } = useDcmtOperations();
74
74
  // Custom hook to manage workflow approval data
75
- const { workflowApproveData, refreshWorkflowApprove } = useWorkflowApprove();
75
+ const { workflowApproveData } = useWorkflowApprove();
76
76
  const deviceType = useDeviceType();
77
77
  const getDcmts = () => { return [{ TID: currentDcmt?.tid, DID: currentDcmt?.did, FILEEXT: currentDcmt?.fileExt }]; };
78
78
  const fetchData = async () => {
79
79
  try {
80
- setFetchError(null); // reset errore prima del fetch
80
+ setFetchError(false);
81
81
  if (!TID)
82
82
  return;
83
83
  if (!DID && layoutMode === LayoutModes.Update)
@@ -99,8 +99,9 @@ const TMDcmtForm = ({ showHeader = true, onSaveRecents, layoutMode = LayoutModes
99
99
  }
100
100
  layoutMode === LayoutModes.Ark && resetHandler();
101
101
  }
102
- catch (err) {
103
- setFetchError(err);
102
+ catch (e) {
103
+ setFetchError(true);
104
+ throw e;
104
105
  }
105
106
  finally {
106
107
  TMSpinner.hide();
@@ -156,7 +157,15 @@ const TMDcmtForm = ({ showHeader = true, onSaveRecents, layoutMode = LayoutModes
156
157
  setDcmtFile(fileFromConnector);
157
158
  }, [fileFromConnector]);
158
159
  useEffect(() => {
159
- fetchData();
160
+ const run = async () => {
161
+ try {
162
+ await fetchData();
163
+ }
164
+ catch (e) {
165
+ TMExceptionBoxManager.show({ exception: e });
166
+ }
167
+ };
168
+ run();
160
169
  }, [TID, DID]);
161
170
  useEffect(() => {
162
171
  if (formData.length > 0) {
@@ -230,7 +239,7 @@ const TMDcmtForm = ({ showHeader = true, onSaveRecents, layoutMode = LayoutModes
230
239
  const isSysMetadataDisabled = layoutMode !== LayoutModes.Update;
231
240
  const isDetailsDisabled = layoutMode !== LayoutModes.Update || !DID;
232
241
  const isMasterDisabled = layoutMode !== LayoutModes.Update || !DID;
233
- const showToppyForApprove = layoutMode === LayoutModes.Update && workItems.length > 0 && !isOpenDetails && !isOpenMaster;
242
+ const showToppyForApprove = layoutMode === LayoutModes.Update && !fetchError && workItems.length > 0 && !isOpenDetails && !isOpenMaster;
234
243
  const approvalVID = workItems.length > 0
235
244
  ? Number(workItems[0].tid) : -1;
236
245
  const commandsMenuItems = [
@@ -605,9 +614,6 @@ const TMDcmtForm = ({ showHeader = true, onSaveRecents, layoutMode = LayoutModes
605
614
  }
606
615
  };
607
616
  const renderDcmtForm = () => {
608
- if (fetchError) {
609
- return (_jsxs("div", { style: { color: 'red', padding: 24, display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 24 }, children: [_jsx("h2", { children: SDKUI_Localizator.ErrorLoadingDocument }), _jsx("pre", { style: { whiteSpace: 'pre-wrap', color: 'black', background: '#f8d7da', padding: 16, borderRadius: 8, maxWidth: 600, overflowX: 'auto' }, children: JSON.stringify(fetchError, Object.getOwnPropertyNames(fetchError), 2) }), _jsx("img", { src: Toppy, alt: "Errore", style: { width: 120, height: 'auto', marginBottom: 16 } })] }));
610
- }
611
617
  return (_jsxs("div", { style: {
612
618
  display: 'flex',
613
619
  flexDirection: deviceType === DeviceType.MOBILE ? 'column' : 'row',
@@ -24,26 +24,25 @@ const StyledSqdItem = styled.div `
24
24
  position: relative;
25
25
  white-space: nowrap;
26
26
  text-overflow: ellipsis;
27
- /* border-bottom: 1px solid #00A99D; // separator line */
28
27
 
29
28
  &:hover {
30
29
  cursor: pointer;
31
30
  }
32
31
 
33
32
  .info-icon {
34
- position: absolute;
35
- left: -2px;
36
- top: calc(50% - 5px);
37
- transform: translateY(-50%);
38
33
  opacity: 0;
39
- transition: opacity 0.2s;
40
34
  pointer-events: none;
41
- // On mobile, never show
35
+ transition: opacity 0.2s;
42
36
  ${({ $isMobile }) => $isMobile && `
43
37
  display: none !important;
44
38
  `}
45
39
  }
46
40
 
41
+ &:hover .info-icon {
42
+ opacity: 1;
43
+ pointer-events: auto;
44
+ }
45
+
47
46
  &::after {
48
47
  content: '';
49
48
  display: block;
@@ -53,11 +52,6 @@ const StyledSqdItem = styled.div `
53
52
  margin-top: 8px;
54
53
  }
55
54
 
56
- &:hover .info-icon {
57
- opacity: 1;
58
- pointer-events: auto;
59
- }
60
-
61
55
  &:last-child {
62
56
  border-bottom: none; // remove border for last item
63
57
  margin-bottom: 0;
@@ -181,40 +175,42 @@ const TMSavedQuerySelector = React.memo(({ items, selectedId, allowShowSearch =
181
175
  padding: '5px 10px',
182
176
  gap: '3px',
183
177
  overflow: 'auto'
184
- }, children: dataSource.slice(0, showAllRoot || searchText.length > 0 ? dataSource.length : initialSQDsMaxItems).filter(o => searchText.length <= 0 || (searchText.length > 0 && o.name?.toLocaleLowerCase().includes(searchText.toLocaleLowerCase())) || o.description?.toLocaleLowerCase().includes(searchText.toLocaleLowerCase())).map((sqd, index) => (_jsxs(StyledSqdItem, { id: `sqd-item-${sqd.id}`, "$isMobile": isMobile, onClick: () => {
185
- setSelectedItem(sqd);
186
- onItemClick?.(sqd);
187
- }, children: [_jsx("span", { className: "info-icon", children: _jsx(TMTooltip, { content: getTooltipBySqd(sqd), children: _jsx(IconInfo, { color: TMColors.primaryColor }) }) }), _jsxs("div", { style: {
188
- display: 'flex',
189
- flexDirection: 'row',
190
- justifyContent: 'center',
191
- width: '100%',
192
- whiteSpace: 'nowrap',
193
- overflow: 'hidden',
194
- textOverflow: 'ellipsis',
195
- gap: '5px'
196
- }, children: [_jsx("p", { style: {
197
- fontSize: '1rem',
198
- fontWeight: sqd.id === 1 ? 600 : 'normal',
199
- whiteSpace: 'nowrap',
200
- overflow: 'hidden',
201
- textOverflow: 'ellipsis',
202
- color: TMColors.primaryColor,
203
- paddingRight: '15px'
204
- }, children: sqd.name }), manageDefault && sqd.isDefault == 1 && _jsx(IconStar, { fontSize: 16, color: 'rgb(248, 215, 117)' })] }), selectedItem?.id == sqd.id &&
205
- _jsx("div", { style: {
206
- width: '24px',
207
- height: '24px',
208
- borderRadius: '24px',
209
- position: 'absolute',
210
- top: '4px',
211
- right: '0px',
212
- display: 'flex',
213
- alignItems: 'center',
214
- justifyContent: 'center',
215
- fontSize: '1rem',
216
- fontWeight: 'bold'
217
- }, children: _jsx(IconApply, { fontSize: 24, color: 'green' }) }), _jsx(SavedQueryContexMenu, { sqd: sqd, manageDefault: manageDefault, isMobile: isMobile, setInfoSQD: setInfoSQD, setDefaultAsync: () => setDefaultSQDAsync(sqd), deleteAsync: () => deleteSQDAsync(sqd), favManageAsync: () => favManageSQDAsync(sqd) })] }, sqd.id))) }), dataSource.length > initialSQDsMaxItems && searchText.length <= 0 &&
178
+ }, children: dataSource.slice(0, showAllRoot || searchText.length > 0 ? dataSource.length : initialSQDsMaxItems).filter(o => searchText.length <= 0 || (searchText.length > 0 && o.name?.toLocaleLowerCase().includes(searchText.toLocaleLowerCase())) || o.description?.toLocaleLowerCase().includes(searchText.toLocaleLowerCase())).map((sqd, index) => {
179
+ const isCurrent = selectedItem?.id == sqd.id;
180
+ return (_jsxs(StyledSqdItem, { id: `sqd-item-${sqd.id}`, "$isMobile": isMobile, onClick: () => {
181
+ setSelectedItem(sqd);
182
+ onItemClick?.(sqd);
183
+ }, children: [_jsxs(StyledDivHorizontal, { style: { alignItems: 'center', gap: 8, width: '100%' }, children: [!isMobile && (_jsx("span", { className: "info-icon", style: {
184
+ marginRight: 4,
185
+ display: 'flex',
186
+ alignItems: 'center'
187
+ }, children: _jsx(TMTooltip, { content: getTooltipBySqd(sqd), children: _jsx(IconInfo, { color: TMColors.primaryColor }) }) })), _jsxs("div", { style: {
188
+ flex: 1,
189
+ display: 'flex',
190
+ alignItems: 'center',
191
+ justifyContent: 'center',
192
+ minWidth: 0
193
+ }, children: [_jsx("p", { style: {
194
+ fontSize: '1rem',
195
+ fontWeight: sqd.id === 1 ? 600 : 'normal',
196
+ whiteSpace: 'nowrap',
197
+ overflow: 'hidden',
198
+ textOverflow: 'ellipsis',
199
+ color: TMColors.primaryColor,
200
+ paddingRight: '15px'
201
+ }, children: sqd.name }), manageDefault && sqd.isDefault == 1 && _jsx(IconStar, { fontSize: 16, color: 'rgb(248, 215, 117)' })] }), _jsx("span", { style: {
202
+ width: 24,
203
+ height: 24,
204
+ borderRadius: 24,
205
+ display: 'flex',
206
+ alignItems: 'center',
207
+ justifyContent: 'center',
208
+ fontSize: '1rem',
209
+ fontWeight: 'bold',
210
+ marginLeft: 8,
211
+ visibility: isCurrent ? 'visible' : 'hidden'
212
+ }, children: _jsx(IconApply, { fontSize: 24, color: 'green' }) })] }), _jsx(SavedQueryContexMenu, { sqd: sqd, manageDefault: manageDefault, isMobile: isMobile, setInfoSQD: setInfoSQD, setDefaultAsync: () => setDefaultSQDAsync(sqd), deleteAsync: () => deleteSQDAsync(sqd), favManageAsync: () => favManageSQDAsync(sqd) })] }, sqd.id));
213
+ }) }), dataSource.length > initialSQDsMaxItems && searchText.length <= 0 &&
218
214
  _jsx("div", { style: { display: 'flex', justifyContent: 'flex-end', padding: '10px', position: 'relative' }, children: _jsx(TMShowAllOrMaxItemsButton, { showAll: showAllRoot, dataSourceLength: dataSource.length, onClick: () => { setShowAllRoot(!showAllRoot); } }) }), _jsxs(StyledOffCanvasPanel, { ref: panelRef, "$isOpen": isMobile && infoSQD !== undefined, children: [_jsxs(StyledDivHorizontal, { style: { gap: 10, padding: '10px 8px', width: '100%', alignItems: 'center' }, children: [_jsx("p", { style: { fontSize: '1.1rem', fontWeight: 'bold' }, children: `${SDK_Localizator.SavedQuery} - ${SDKUI_Localizator.About}` }), _jsx(IconCloseOutline, { style: { marginLeft: 'auto', cursor: 'pointer' }, onClick: () => setInfoSQD(undefined) })] }), getTooltipBySqd(infoSQD)] })] }));
219
215
  });
220
216
  export default TMSavedQuerySelector;
@@ -88,7 +88,7 @@ const TMRecentsManager = ({ deviceType, mruTIDs, currentMruTID, onSelectedTID, o
88
88
  alignItems: 'center',
89
89
  justifyContent: 'center',
90
90
  minWidth: 0
91
- }, children: _jsx(TMTidViewer, { tid: dtd.id, color: TMColors.primaryColor, showIcon: false }) }), isCurrent && (_jsx("span", { style: {
91
+ }, children: _jsx(TMTidViewer, { tid: dtd.id, color: TMColors.primaryColor, showIcon: false }) }), _jsx("span", { style: {
92
92
  width: 24,
93
93
  height: 24,
94
94
  borderRadius: 24,
@@ -97,8 +97,9 @@ const TMRecentsManager = ({ deviceType, mruTIDs, currentMruTID, onSelectedTID, o
97
97
  justifyContent: 'center',
98
98
  fontSize: '1rem',
99
99
  fontWeight: 'bold',
100
- marginLeft: 8
101
- }, children: _jsx(IconApply, { fontSize: 24, color: 'green' }) }))] }), _jsx(ContextMenu, { dataSource: [
100
+ marginLeft: 8,
101
+ visibility: isCurrent ? 'visible' : 'hidden'
102
+ }, children: _jsx(IconApply, { fontSize: 24, color: 'green' }) })] }), _jsx(ContextMenu, { dataSource: [
102
103
  {
103
104
  text: SDKUI_Localizator.Remove,
104
105
  icon: iconDelete(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react-beta",
3
- "version": "6.14.80",
3
+ "version": "6.14.81",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",
@@ -42,7 +42,7 @@
42
42
  "lib"
43
43
  ],
44
44
  "dependencies": {
45
- "@topconsultnpm/sdk-ts-beta": "6.14.16",
45
+ "@topconsultnpm/sdk-ts-beta": "6.14.17",
46
46
  "buffer": "^6.0.3",
47
47
  "devextreme": "24.2.6",
48
48
  "devextreme-react": "24.2.6",