@topconsultnpm/sdkui-react 6.21.0-dev2.3 → 6.21.0-dev2.31

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.
Files changed (50) hide show
  1. package/lib/components/base/TMAccordionNew.d.ts +1 -0
  2. package/lib/components/base/TMAccordionNew.js +6 -5
  3. package/lib/components/base/TMAreaManager.js +19 -3
  4. package/lib/components/base/TMDataGrid.js +2 -2
  5. package/lib/components/base/TMPanel.d.ts +7 -4
  6. package/lib/components/base/TMPanel.js +58 -26
  7. package/lib/components/choosers/TMDistinctValues.js +35 -21
  8. package/lib/components/editors/TMDateBox.js +4 -2
  9. package/lib/components/editors/TMFormulaEditor.d.ts +2 -0
  10. package/lib/components/editors/TMFormulaEditor.js +75 -21
  11. package/lib/components/editors/TMMetadataValues.js +2 -1
  12. package/lib/components/editors/TMRadioButton.js +2 -1
  13. package/lib/components/editors/TMTextArea.d.ts +2 -0
  14. package/lib/components/editors/TMTextArea.js +6 -3
  15. package/lib/components/features/documents/TMDcmtForm.d.ts +1 -0
  16. package/lib/components/features/documents/TMDcmtForm.js +105 -27
  17. package/lib/components/features/documents/TMDcmtFormActionButtons.js +17 -2
  18. package/lib/components/features/documents/TMDcmtPreview.d.ts +1 -0
  19. package/lib/components/features/documents/TMDcmtPreview.js +2 -2
  20. package/lib/components/features/documents/TMDcmtTasks.d.ts +1 -0
  21. package/lib/components/features/documents/TMDcmtTasks.js +2 -2
  22. package/lib/components/features/search/SignatureParamsManager.d.ts +70 -0
  23. package/lib/components/features/search/SignatureParamsManager.js +145 -0
  24. package/lib/components/features/search/TMSavedQuerySelector.d.ts +2 -2
  25. package/lib/components/features/search/TMSavedQuerySelector.js +3 -2
  26. package/lib/components/features/search/TMSearch.d.ts +2 -1
  27. package/lib/components/features/search/TMSearch.js +15 -9
  28. package/lib/components/features/search/TMSearchQueryPanel.js +1 -1
  29. package/lib/components/features/search/TMSearchResult.js +65 -18
  30. package/lib/components/features/search/TMViewHistoryDcmt.js +1 -2
  31. package/lib/components/features/workflow/diagram/queryDescriptorParser.js +3 -6
  32. package/lib/components/grids/TMBlogAttachments.d.ts +1 -0
  33. package/lib/components/grids/TMBlogAttachments.js +38 -12
  34. package/lib/components/grids/TMBlogsPost.js +7 -1
  35. package/lib/components/grids/TMBlogsPostUtils.js +11 -17
  36. package/lib/components/index.d.ts +1 -0
  37. package/lib/components/index.js +1 -0
  38. package/lib/components/pages/TMPage.js +3 -1
  39. package/lib/components/viewers/TMTidViewer.js +1 -1
  40. package/lib/helper/GlobalStyles.js +6 -0
  41. package/lib/helper/SDKUI_Localizator.d.ts +49 -0
  42. package/lib/helper/SDKUI_Localizator.js +492 -0
  43. package/lib/helper/TMPdfViewer.js +25 -24
  44. package/lib/hooks/useDataUserIdItem.js +6 -4
  45. package/lib/hooks/useDocumentOperations.d.ts +1 -0
  46. package/lib/hooks/useDocumentOperations.js +8 -6
  47. package/lib/hooks/useForm.js +5 -2
  48. package/lib/hooks/useResizeObserver.d.ts +1 -1
  49. package/lib/hooks/useResizeObserver.js +16 -15
  50. package/package.json +2 -2
@@ -154,11 +154,11 @@ const TMPdfViewer = (props) => {
154
154
  // Pattern specifici per rilevare JavaScript effettivo nelle strutture PDF
155
155
  const jsPatterns = [
156
156
  // Esempio: /JavaScript [ (app.alert('Hello');) ]
157
- { name: 'JavaScript Dictionary Entry', pattern: /\/JavaScript\s*[(\[<][\s\S]*?[)\]>]/i },
157
+ { name: 'JavaScript Dictionary Entry', pattern: /\/JavaScript\s+[(\[<][\s\S]*?[)\]>]/i },
158
158
  // Esempio: /JS 15 0 R (riferimento a un oggetto JavaScript)
159
159
  { name: 'JavaScript Object Reference', pattern: /\/JS\s+\d+\s+\d+\s+R/i },
160
160
  // Esempio: /JS (app.alert('Click');) o /JS <hexstring>
161
- { name: 'Inline JavaScript Code', pattern: /\/JS\s*[(<][\s\S]*?[)>]/i },
161
+ { name: 'Inline JavaScript Code', pattern: /\/JS\s+[(<][\s\S]*?[)>]/i },
162
162
  // Esempio: /AA << /O << /S /JavaScript /JS (app.alert('Open');) >> >>
163
163
  { name: 'Additional Actions (AA) with JavaScript', pattern: /\/AA\s*<<[\s\S]*?\/JS[\s\S]*?>>/is },
164
164
  // Esempio: /OpenAction << /S /JavaScript /JS (this.print();) >>
@@ -258,11 +258,11 @@ const TMPdfViewer = (props) => {
258
258
  const normalizedIndex = normalizedContext.indexOf(normalizedMatch);
259
259
  if (normalizedIndex === -1) {
260
260
  // Se ancora non trova, mostra tutto in grassetto rosso
261
- return _jsx("strong", { style: { color: '#d32f2f', fontWeight: 'bold' }, children: context });
261
+ return _jsx("strong", { style: { color: '#e65100', fontWeight: 'bold' }, children: context });
262
262
  }
263
- return (_jsxs(_Fragment, { children: [normalizedContext.substring(0, normalizedIndex), _jsx("strong", { style: { color: '#d32f2f', fontWeight: 'bold', background: '#ffebee' }, children: normalizedContext.substring(normalizedIndex, normalizedIndex + normalizedMatch.length) }), normalizedContext.substring(normalizedIndex + normalizedMatch.length)] }));
263
+ return (_jsxs(_Fragment, { children: [normalizedContext.substring(0, normalizedIndex), _jsx("strong", { style: { color: '#e65100', fontWeight: 'bold', background: '#fff3e0' }, children: normalizedContext.substring(normalizedIndex, normalizedIndex + normalizedMatch.length) }), normalizedContext.substring(normalizedIndex + normalizedMatch.length)] }));
264
264
  }
265
- return (_jsxs(_Fragment, { children: [context.substring(0, matchIndex), _jsx("strong", { style: { color: '#d32f2f', fontWeight: 'bold', background: '#ffebee' }, children: context.substring(matchIndex, matchIndex + matchText.length) }), context.substring(matchIndex + matchText.length)] }));
265
+ return (_jsxs(_Fragment, { children: [context.substring(0, matchIndex), _jsx("strong", { style: { color: '#e65100', fontWeight: 'bold', background: '#fff3e0' }, children: context.substring(matchIndex, matchIndex + matchText.length) }), context.substring(matchIndex + matchText.length)] }));
266
266
  };
267
267
  TMMessageBoxManager.show({
268
268
  title: `${SDKUI_Localizator.Attention}: ${SDKUI_Localizator.PotentiallyUnsafeContent}`,
@@ -273,8 +273,8 @@ const TMPdfViewer = (props) => {
273
273
  message: (_jsxs("div", { style: { maxHeight: '500px', overflowY: 'auto', padding: '10px', lineHeight: '1.6' }, children: [_jsxs("div", { style: {
274
274
  marginBottom: '20px',
275
275
  padding: '12px',
276
- background: '#fff3cd',
277
- border: '1px solid #ffc107',
276
+ background: '#fff8e1',
277
+ border: '1px solid #ffe0b2',
278
278
  borderRadius: '6px',
279
279
  fontSize: '14px',
280
280
  wordBreak: 'normal',
@@ -282,22 +282,22 @@ const TMPdfViewer = (props) => {
282
282
  }, children: [_jsxs("strong", { children: [SDKUI_Localizator.Attention, ":"] }), " ", SDKUI_Localizator.PotentiallyUnsafeCodePatternsDetected.replaceParams(jsMatches.length.toString())] }), jsMatches.length > 0 ? (jsMatches.map((match, index) => (_jsxs("div", { style: {
283
283
  marginBottom: '16px',
284
284
  padding: '16px',
285
- border: '1px solid #ffcdd2',
285
+ border: '1px solid #ffe0b2',
286
286
  borderRadius: '8px',
287
287
  background: '#fff',
288
288
  boxShadow: '0 1px 3px rgba(0,0,0,0.1)'
289
289
  }, children: [_jsx("div", { style: {
290
290
  marginBottom: '12px',
291
291
  paddingBottom: '8px',
292
- borderBottom: '2px solid #f44336'
292
+ borderBottom: '2px solid #ffb74d'
293
293
  }, children: _jsxs("strong", { style: {
294
- color: '#d32f2f',
294
+ color: '#e65100',
295
295
  fontSize: '15px',
296
296
  display: 'flex',
297
297
  alignItems: 'center',
298
298
  gap: '8px'
299
299
  }, children: [_jsx("span", { style: {
300
- background: '#f44336',
300
+ background: '#ff9800',
301
301
  color: '#fff',
302
302
  borderRadius: '50%',
303
303
  width: '24px',
@@ -311,7 +311,7 @@ const TMPdfViewer = (props) => {
311
311
  background: '#f5f5f5',
312
312
  padding: '10px',
313
313
  borderRadius: '4px',
314
- borderLeft: '3px solid #f44336',
314
+ borderLeft: '3px solid #ff9800',
315
315
  fontFamily: 'Consolas, Monaco, monospace',
316
316
  fontSize: '12px',
317
317
  wordBreak: 'break-all',
@@ -408,23 +408,24 @@ const TMPdfViewer = (props) => {
408
408
  display: 'flex',
409
409
  justifyContent: 'center',
410
410
  alignItems: 'center',
411
- padding: '12px 20px',
412
- background: '#fff3cd',
413
- borderTop: '2px solid #ffc107',
414
- gap: '8px',
411
+ padding: '8px 16px',
412
+ background: '#fff8e1',
413
+ borderTop: '1px solid #ffe0b2',
414
+ gap: '5px',
415
415
  flexShrink: 0
416
- }, children: [_jsxs("span", { style: {
416
+ }, children: [jsMatches.length > 0 && (_jsx("span", { className: "dx-icon-info", style: {
417
+ fontSize: '18px',
418
+ color: '#e65100',
419
+ cursor: 'pointer',
420
+ transition: 'color 0.2s',
421
+ flexShrink: 0
422
+ }, onClick: showMatchDetails, title: "Clicca per vedere i dettagli", onMouseEnter: (e) => e.currentTarget.style.color = '#bf360c', onMouseLeave: (e) => e.currentTarget.style.color = '#e65100' })), _jsxs("span", { style: {
417
423
  color: '#856404',
424
+ fontSize: '13px',
418
425
  whiteSpace: 'nowrap',
419
426
  overflow: 'hidden',
420
427
  textOverflow: 'ellipsis',
421
428
  flex: 1
422
- }, children: [_jsx("strong", { children: "Attenzione:" }), " Questo documento contiene contenuti potenzialmente non sicuri."] }), jsMatches.length > 0 && (_jsx("span", { className: "dx-icon-info", style: {
423
- fontSize: '20px',
424
- color: '#d32f2f',
425
- cursor: 'pointer',
426
- transition: 'color 0.2s',
427
- marginLeft: '4px'
428
- }, onClick: showMatchDetails, title: "Clicca per vedere i dettagli", onMouseEnter: (e) => e.currentTarget.style.color = '#b71c1c', onMouseLeave: (e) => e.currentTarget.style.color = '#d32f2f' }))] }))] }) }));
429
+ }, children: [_jsx("strong", { children: "Attenzione:" }), " Questo documento contiene contenuti potenzialmente non sicuri."] })] }))] }) }));
429
430
  };
430
431
  export default TMPdfViewer;
@@ -15,7 +15,7 @@ export const useDataUserIdItem = () => {
15
15
  if (userIDs.size === 0)
16
16
  return;
17
17
  try {
18
- const results = await Promise.all(Array.from(userIDs).map(id => UserListCacheService.GetAsync(id).then(user => ({ id, user }))
18
+ const results = await Promise.all(Array.from(userIDs).filter(id => id > 0).map(id => UserListCacheService.GetAsync(id).then(user => ({ id, user }))
19
19
  .catch(() => ({ id, user: undefined }))));
20
20
  const newCache = new Map();
21
21
  results.forEach(({ id, user }) => {
@@ -70,17 +70,19 @@ export const useDataUserIdItem = () => {
70
70
  * @returns Elemento React per visualizzare l'utente
71
71
  */
72
72
  const renderUserIdViewer = useCallback((userId, showIcon = false, showTitile = true) => {
73
- const ud = userId && userId > 0 ? getUserItem(userId) : undefined;
73
+ const ud = userId !== undefined && userId > 0 ? getUserItem(userId) : undefined;
74
74
  const getIcon = () => {
75
75
  if (!showIcon)
76
76
  return null;
77
- if (!userId)
77
+ if (userId === undefined)
78
78
  return null;
79
79
  return ud ? _jsx(TMUserIcon, { ud: ud }) : _jsx("span", { title: showTitile ? SDKUI_Localizator.ValueNotPresent : undefined, style: { display: 'inline-flex', alignItems: 'center' }, children: _jsx(IconWarning, { color: TMColors.warning }) });
80
80
  };
81
81
  const getDescription = () => {
82
- if (!userId)
82
+ if (userId == null)
83
83
  return undefined;
84
+ if (userId === 0)
85
+ return SDKUI_Localizator.SystemUser;
84
86
  return ud ? getCompleteUserName(ud.domain, ud.name) : userId.toString() ?? SDKUI_Localizator.NoneSelection;
85
87
  };
86
88
  return (_jsxs("span", { style: { display: 'inline-flex', alignItems: 'center', gap: '4px', lineHeight: 1 }, children: [getIcon(), _jsx("span", { style: { lineHeight: 'normal' }, children: getDescription() })] }));
@@ -110,6 +110,7 @@ export interface UseDocumentOperationsResult {
110
110
  isOpenBatchUpdate: boolean;
111
111
  isModifiedBatchUpdate: boolean;
112
112
  updateBatchUpdateForm: (value: boolean) => void;
113
+ closeDcmtFormHandler: () => void;
113
114
  handleSignApprove: () => void;
114
115
  showSearchTMDatagrid: boolean;
115
116
  showExportForm: boolean;
@@ -182,6 +182,9 @@ export const useDocumentOperations = (props) => {
182
182
  setIsOpenDcmtForm(isOpen);
183
183
  setDcmtFormLayoutMode(layoutMode);
184
184
  };
185
+ const closeDcmtFormHandler = () => {
186
+ setIsOpenDcmtForm(false);
187
+ };
185
188
  const handleAddItem = (tid, did) => {
186
189
  let newItem = { TID: tid ?? 0, DID: did ?? 0 };
187
190
  setSecondaryMasterDcmts((prevItems) => [...prevItems, newItem]);
@@ -542,12 +545,10 @@ export const useDocumentOperations = (props) => {
542
545
  const firstDoc = selectedDcmtInfos?.[0];
543
546
  // Check if the selected document is a PDF
544
547
  const isPdf = firstDoc?.FILEEXT?.toLowerCase() === "pdf";
545
- // Check if the document has been signed
546
- const isSigned = firstDoc?.ISSIGNED === 1;
547
548
  // Check if the user has permission to substitute files
548
549
  const canSubstitute = dtd?.perm?.canSubstFile === AccessLevels.Yes;
549
550
  // Determine whether the menu item should be disabled
550
- const isDisabled = !canSubstitute || isDisabledForSingleRow() || !isPdf || isSigned;
551
+ const isDisabled = !canSubstitute || isDisabledForSingleRow() || !isPdf;
551
552
  return {
552
553
  id: 'pdf-ed',
553
554
  icon: _jsx(IconEdit, {}),
@@ -975,7 +976,7 @@ export const useDocumentOperations = (props) => {
975
976
  };
976
977
  const handleWFOperationCompleted = async () => {
977
978
  await onWFOperationCompleted?.();
978
- if (context !== SearchResultContext.DCMT_FORM && !showMoreInfoPopup) {
979
+ if (!showMoreInfoPopup) {
979
980
  onCloseDcmtForm?.();
980
981
  }
981
982
  };
@@ -1128,7 +1129,7 @@ export const useDocumentOperations = (props) => {
1128
1129
  };
1129
1130
  const renderFloatingBar = (floatingBarContainerRef && floatingBarContainerRef.current && allowFloatingBar && showFloatingBar && deviceType !== DeviceType.MOBILE) ? (_jsx(TMFloatingMenuBar, { containerRef: floatingBarContainerRef, contextMenuItems: operationItems(), isConstrained: true, defaultPosition: { x: 1, y: 88 }, defaultPinnedItems: ['rel-det', 'rel-mst', 'dl'], defaultOrientation: 'horizontal', hasContextMenu: false, pinnedItemIds: pinnedItemIds, onPinChange: setPinnedItemIds })) : null;
1130
1131
  const renderDcmtOperations = (_jsxs(_Fragment, { children: [(showExportForm && searchResult && dataColumns && dataSource && selectedRowKeys) && (_jsx(TMDataGridExportForm, { dataColumns: dataColumns, dataSource: dataSource, selectedRowKeys: selectedRowKeys, onCloseExportForm: () => setShowExportForm(false), searchResult: searchResult })), _jsx(StyledMultiViewPanel, { "$isVisible": isOpenDcmtForm, children: ((isOpenDcmtForm && focusedItem?.TID !== undefined && focusedItem?.DID !== undefined) &&
1131
- _jsx(TMDcmtForm, { isModal: openDcmtFormAsModal || (dcmtFormLayoutMode === LayoutModes.Ark && focusedItem?.DID !== undefined), titleModal: dtd?.name ?? '', TID: focusedItem.TID, DID: focusedItem.DID, allowButtonsRefs: true, layoutMode: dcmtFormLayoutMode, count: visibleItems?.length, itemIndex: visibleItems ? visibleItems.findIndex(o => o.rowIndex === focusedItem?.rowIndex) + 1 : undefined, canNext: canNavigateHandler ? canNavigateHandler('next') : false, canPrev: canNavigateHandler ? canNavigateHandler('prev') : false, onNext: () => onNavigateHandler && onNavigateHandler('next'), onPrev: () => onNavigateHandler && onNavigateHandler('prev'), onClose: () => { (false); onDcmtFormOpenChange(false, LayoutModes.Update); }, onWFOperationCompleted: onWFOperationCompleted, onTaskCreateRequest: onTaskCreateRequest, onSavedAsyncCallback: onSavedAsyncCallback, openS4TViewer: openS4TViewer, onOpenS4TViewerRequest: onOpenS4TViewerRequest, onOpenPdfEditorRequest: onOpenPdfEditorRequest, openFileUploaderPdfEditor: openFileUploaderPdfEditor, onReferenceClick: onReferenceClick, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, moreInfoTasks: getMoreInfoTasksForDocument(allTasks, focusedItem?.TID, focusedItem?.DID), showDcmtFormSidebar: showDcmtFormSidebar, datagridUtility: {
1132
+ _jsx(TMDcmtForm, { isModal: openDcmtFormAsModal || (dcmtFormLayoutMode === LayoutModes.Ark && focusedItem?.DID !== undefined), titleModal: dtd?.name ?? '', TID: focusedItem.TID, DID: focusedItem.DID, allowButtonsRefs: true, showTodoDcmtForm: showTodoDcmtForm, layoutMode: dcmtFormLayoutMode, count: visibleItems?.length, itemIndex: visibleItems ? visibleItems.findIndex(o => o.rowIndex === focusedItem?.rowIndex) + 1 : undefined, canNext: canNavigateHandler ? canNavigateHandler('next') : false, canPrev: canNavigateHandler ? canNavigateHandler('prev') : false, onNext: () => onNavigateHandler && onNavigateHandler('next'), onPrev: () => onNavigateHandler && onNavigateHandler('prev'), onClose: () => { (false); onDcmtFormOpenChange(false, LayoutModes.Update); }, onWFOperationCompleted: onWFOperationCompleted, onTaskCreateRequest: onTaskCreateRequest, onSavedAsyncCallback: onSavedAsyncCallback, openS4TViewer: openS4TViewer, onOpenS4TViewerRequest: onOpenS4TViewerRequest, onOpenPdfEditorRequest: onOpenPdfEditorRequest, openFileUploaderPdfEditor: openFileUploaderPdfEditor, onReferenceClick: onReferenceClick, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, moreInfoTasks: getMoreInfoTasksForDocument(allTasks, focusedItem?.TID, focusedItem?.DID), showDcmtFormSidebar: showDcmtFormSidebar, datagridUtility: {
1132
1133
  onRefreshSearchAsyncDatagrid,
1133
1134
  onRefreshDataRowsAsync,
1134
1135
  refreshFocusedDataRowAsync,
@@ -1148,7 +1149,7 @@ export const useDocumentOperations = (props) => {
1148
1149
  setArchiveRelatedDcmtFormTID(undefined);
1149
1150
  setArchiveRelatedDcmtFormMids([]);
1150
1151
  await onRefreshSearchAsyncDatagrid?.();
1151
- }, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, showDcmtFormSidebar: showDcmtFormSidebar, openFileUploaderPdfEditor: openFileUploaderPdfEditor }), showRelatedDcmtsChooser &&
1152
+ }, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, showDcmtFormSidebar: showDcmtFormSidebar, openFileUploaderPdfEditor: openFileUploaderPdfEditor, showTodoDcmtForm: showTodoDcmtForm }), showRelatedDcmtsChooser &&
1152
1153
  _jsx(TMChooserForm, { dataSource: relatedDcmtsChooserDataSource, onChoose: async (selectedRelation) => {
1153
1154
  try {
1154
1155
  setShowRelatedDcmtsChooser(false);
@@ -1209,6 +1210,7 @@ export const useDocumentOperations = (props) => {
1209
1210
  isOpenBatchUpdate,
1210
1211
  isModifiedBatchUpdate,
1211
1212
  updateBatchUpdateForm,
1213
+ closeDcmtFormHandler,
1212
1214
  handleSignApprove,
1213
1215
  checkoutInfo: {
1214
1216
  showHistory,
@@ -1,7 +1,7 @@
1
1
  import { useEffect, useState } from "react";
2
2
  import { FormModes } from "../ts";
3
3
  import { TMExceptionBoxManager, TMSpinner } from "../components";
4
- import { AreaEngine, BasketTypeEngine, DataListEngine, DcmtTypeEngine, DiskEngine, GroupEngine, JobEngine, JobTypes, LDAPDescriptor, LDAPProviders, NumeratorDescriptor, ObjectClasses, ProcessEngine, RelationEngine, ResultTypes, SAPEngine, SavedQueryEngine, SignCertDescriptor, TaskEngine, TreeDescriptor, TSADescriptor, UserEngine, WorkingGroupDescriptor } from "@topconsultnpm/sdk-ts";
4
+ import { AreaEngine, BasketTypeEngine, DataListEngine, DcmtTypeEngine, DiskEngine, GroupEngine, JobEngine, JobTypes, LDAPDescriptor, LDAPProviders, NumeratorEngine, ObjectClasses, ProcessEngine, RelationEngine, ResultTypes, SAPEngine, SavedQueryEngine, SignCertDescriptor, TaskEngine, TreeDescriptor, TSADescriptor, UserEngine, WorkingGroupDescriptor } from "@topconsultnpm/sdk-ts";
5
5
  import { PlatformObjectService } from "../services";
6
6
  import { SDKUI_Localizator, calcIsModified } from "../helper";
7
7
  export class SaveFormOptions {
@@ -42,7 +42,7 @@ export function useSaveForm(formMode, id, sfo, validator, onSaved, onStatusChang
42
42
  case ObjectClasses.Disk: return DiskEngine.NewDiskDescriptor();
43
43
  case ObjectClasses.Group: return GroupEngine.NewGroupDescriptor();
44
44
  case ObjectClasses.LDAP: return normalizeLDAP(new LDAPDescriptor());
45
- case ObjectClasses.Numerator: return new NumeratorDescriptor();
45
+ case ObjectClasses.Numerator: return NumeratorEngine.NewNormalizeNumeratorDescriptor();
46
46
  case ObjectClasses.SignCert: return normalizeSignCert(new SignCertDescriptor());
47
47
  case ObjectClasses.Tree: return new TreeDescriptor();
48
48
  case ObjectClasses.TSA: return new TSADescriptor();
@@ -101,6 +101,9 @@ export function useSaveForm(formMode, id, sfo, validator, onSaved, onStatusChang
101
101
  newId = await saveCustomAsync();
102
102
  else
103
103
  newId = await setDataAsync?.(formMode, formData, ...args);
104
+ if (newId <= 0) {
105
+ return;
106
+ }
104
107
  let newData;
105
108
  if (sfo.loadDataAfterSave)
106
109
  newData = await loadDataAsync(newId, FormModes.Update);
@@ -1,4 +1,4 @@
1
1
  export declare const useResizeObserver: () => {
2
- ref: import("react").RefObject<HTMLDivElement>;
2
+ ref: (node: HTMLDivElement | null) => void;
3
3
  width: number;
4
4
  };
@@ -1,22 +1,23 @@
1
- import { useEffect, useRef, useState } from 'react';
1
+ import { useCallback, useEffect, useState } from 'react';
2
2
  export const useResizeObserver = () => {
3
3
  const [width, setWidth] = useState(0);
4
- const ref = useRef(null);
4
+ const [element, setElement] = useState(null);
5
+ // Callback ref: viene invocato quando l'elemento viene montato/smontato
6
+ const ref = useCallback((node) => {
7
+ setElement(node);
8
+ }, []);
5
9
  useEffect(() => {
6
- const handleResize = (entries) => {
7
- if (entries[0].contentRect) {
10
+ if (!element)
11
+ return;
12
+ // Imposta la larghezza iniziale
13
+ setWidth(element.getBoundingClientRect().width);
14
+ const observer = new ResizeObserver((entries) => {
15
+ if (entries[0]?.contentRect) {
8
16
  setWidth(entries[0].contentRect.width);
9
17
  }
10
- };
11
- const observer = new ResizeObserver(handleResize);
12
- if (ref.current) {
13
- observer.observe(ref.current);
14
- }
15
- return () => {
16
- if (ref.current) {
17
- observer.unobserve(ref.current);
18
- }
19
- };
20
- }, []);
18
+ });
19
+ observer.observe(element);
20
+ return () => observer.disconnect();
21
+ }, [element]);
21
22
  return { ref, width };
22
23
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react",
3
- "version": "6.21.0-dev2.3",
3
+ "version": "6.21.0-dev2.31",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",
@@ -40,7 +40,7 @@
40
40
  "lib"
41
41
  ],
42
42
  "dependencies": {
43
- "@topconsultnpm/sdk-ts": "6.21.0-dev2.2",
43
+ "@topconsultnpm/sdk-ts": "6.21.0-dev2.5",
44
44
  "buffer": "^6.0.3",
45
45
  "devextreme": "^25.2.6",
46
46
  "devextreme-react": "^25.2.6",