@topconsultnpm/sdkui-react 6.22.0-dev2.9 → 6.22.0-dev3.11

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 (314) hide show
  1. package/lib/components/NewComponents/ContextMenu/TMContextMenu.js +3 -3
  2. package/lib/components/NewComponents/ContextMenu/hooks.d.ts +1 -1
  3. package/lib/components/NewComponents/ContextMenu/styles.d.ts +45 -43
  4. package/lib/components/NewComponents/FloatingMenuBar/TMFloatingMenuBar.js +6 -6
  5. package/lib/components/NewComponents/FloatingMenuBar/styles.d.ts +80 -73
  6. package/lib/components/base/Styled.d.ts +93 -77
  7. package/lib/components/base/Styled.js +7 -5
  8. package/lib/components/base/TMAccordionNew.js +7 -7
  9. package/lib/components/base/TMAlert.d.ts +32 -32
  10. package/lib/components/base/TMAreaManager.js +1 -1
  11. package/lib/components/base/TMButton.js +4 -4
  12. package/lib/components/base/TMClosableList.js +3 -3
  13. package/lib/components/base/TMCounterBar.d.ts +2 -2
  14. package/lib/components/base/TMCounterContainer.d.ts +2 -1
  15. package/lib/components/base/TMCustomButton.d.ts +1 -1
  16. package/lib/components/base/TMCustomButton.js +1 -1
  17. package/lib/components/base/TMDataGrid.d.ts +4 -0
  18. package/lib/components/base/TMDataGrid.js +292 -12
  19. package/lib/components/base/TMDataGridExportForm.d.ts +2 -1
  20. package/lib/components/base/TMDropDownMenu.js +1 -1
  21. package/lib/components/base/TMEditorBase.d.ts +2 -0
  22. package/lib/components/base/TMFileManager.d.ts +2 -1
  23. package/lib/components/base/TMFileManager.js +5 -3
  24. package/lib/components/base/TMFileManagerDataGridView.d.ts +2 -1
  25. package/lib/components/base/TMFileManagerDataGridView.js +12 -3
  26. package/lib/components/base/TMFileManagerThumbnailItems.d.ts +1 -1
  27. package/lib/components/base/TMFileManagerThumbnailItems.js +20 -10
  28. package/lib/components/base/TMFileManagerThumbnailsView.d.ts +1 -1
  29. package/lib/components/base/TMFileManagerUtils.d.ts +6 -6
  30. package/lib/components/base/TMFileManagerUtils.js +37 -1
  31. package/lib/components/base/TMLayout.d.ts +6 -6
  32. package/lib/components/base/TMLayout.js +3 -3
  33. package/lib/components/base/TMList.d.ts +2 -1
  34. package/lib/components/base/TMList.js +1 -1
  35. package/lib/components/base/TMListView.d.ts +1 -1
  36. package/lib/components/base/TMListView.js +3 -3
  37. package/lib/components/base/TMModal.d.ts +11 -0
  38. package/lib/components/base/TMModal.js +47 -13
  39. package/lib/components/base/TMPanel.d.ts +6 -0
  40. package/lib/components/base/TMPanel.js +224 -111
  41. package/lib/components/base/TMPopUp.js +5 -2
  42. package/lib/components/base/TMResizableMenu.js +2 -2
  43. package/lib/components/base/TMRightSidebar.js +1 -1
  44. package/lib/components/base/TMShowAllOrMaxItemsButton.js +1 -1
  45. package/lib/components/base/TMSpinner.d.ts +2 -1
  46. package/lib/components/base/TMSpinner.js +2 -2
  47. package/lib/components/base/TMTab.d.ts +4 -3
  48. package/lib/components/base/TMTab.js +2 -2
  49. package/lib/components/base/TMTabControl.d.ts +101 -0
  50. package/lib/components/base/TMTabControl.js +653 -0
  51. package/lib/components/base/TMToggleButton.js +2 -2
  52. package/lib/components/base/TMToolbarCard.js +3 -3
  53. package/lib/components/base/TMTooltip.d.ts +2 -1
  54. package/lib/components/base/TMTooltip.js +24 -8
  55. package/lib/components/base/TMTreeView.d.ts +14 -8
  56. package/lib/components/base/TMTreeView.js +123 -70
  57. package/lib/components/base/TMUserAvatar.d.ts +2 -1
  58. package/lib/components/base/TMVilViewer.d.ts +2 -1
  59. package/lib/components/base/TMWaitPanel.d.ts +3 -2
  60. package/lib/components/base/TMWaitPanel.js +2 -2
  61. package/lib/components/choosers/TMCultureIDPicker.js +2 -2
  62. package/lib/components/choosers/TMDataListItemChooser.js +1 -1
  63. package/lib/components/choosers/TMDataListItemPicker.js +2 -2
  64. package/lib/components/choosers/TMDcmtTypeChooser.js +5 -4
  65. package/lib/components/choosers/TMDiskChooser.js +1 -1
  66. package/lib/components/choosers/TMDistinctValues.d.ts +9 -7
  67. package/lib/components/choosers/TMDistinctValues.js +157 -141
  68. package/lib/components/choosers/TMDynDataListItemChooser.d.ts +1 -1
  69. package/lib/components/choosers/TMDynDataListItemChooser.js +1 -1
  70. package/lib/components/choosers/TMImageIDChooser.js +1 -1
  71. package/lib/components/choosers/TMInvoiceRetrieveFormats.d.ts +2 -1
  72. package/lib/components/choosers/TMMetadataChooser.js +3 -3
  73. package/lib/components/choosers/TMOrderRetrieveFormats.d.ts +2 -1
  74. package/lib/components/choosers/TMQuickSearchInfo.d.ts +13 -0
  75. package/lib/components/choosers/TMQuickSearchInfo.js +279 -0
  76. package/lib/components/choosers/TMQuickSearchSettingsForm.d.ts +16 -0
  77. package/lib/components/choosers/TMQuickSearchSettingsForm.js +94 -0
  78. package/lib/components/choosers/TMRelationChooser.d.ts +3 -3
  79. package/lib/components/choosers/TMRelationChooser.js +1 -1
  80. package/lib/components/choosers/TMSelectedValuesSummary.d.ts +13 -0
  81. package/lib/components/choosers/TMSelectedValuesSummary.js +89 -0
  82. package/lib/components/choosers/TMUserChooser.d.ts +2 -2
  83. package/lib/components/choosers/TMUserChooser.js +1 -1
  84. package/lib/components/editors/TMCheckBox.js +1 -1
  85. package/lib/components/editors/TMDropDown.d.ts +3 -0
  86. package/lib/components/editors/TMDropDown.js +197 -5
  87. package/lib/components/editors/TMEditorStyled.d.ts +21 -43
  88. package/lib/components/editors/TMFormulaEditor.d.ts +1 -1
  89. package/lib/components/editors/TMFormulaEditor.js +1 -1
  90. package/lib/components/editors/TMHtmlContentDisplay.d.ts +2 -1
  91. package/lib/components/editors/TMHtmlContentDisplay.js +1 -1
  92. package/lib/components/editors/TMHtmlEditor.d.ts +2 -1
  93. package/lib/components/editors/TMLocalizedTextBox.js +1 -1
  94. package/lib/components/editors/TMMetadataValues.js +6 -6
  95. package/lib/components/editors/TMRadioButton.js +2 -2
  96. package/lib/components/editors/TMSummary.js +3 -3
  97. package/lib/components/editors/TMTextArea.js +3 -3
  98. package/lib/components/editors/TMTextBox.js +3 -3
  99. package/lib/components/editors/TMTextExpression.js +1 -1
  100. package/lib/components/editors/TMTreeDropDown.d.ts +1 -1
  101. package/lib/components/features/archive/TMArchive.js +17 -3
  102. package/lib/components/features/assistant/TMToppyDraggableHelpCenter.d.ts +1 -1
  103. package/lib/components/features/assistant/TMToppyDraggableHelpCenter.js +2 -2
  104. package/lib/components/features/assistant/TMToppySpeechBubble.js +1 -1
  105. package/lib/components/features/blog/TMBlogCommentForm.d.ts +2 -1
  106. package/lib/components/features/documents/TMBatchUpdateForm.js +20 -6
  107. package/lib/components/features/documents/TMCopyToFolderForm.js +61 -22
  108. package/lib/components/features/documents/TMDcmtBlog.d.ts +3 -0
  109. package/lib/components/features/documents/TMDcmtBlog.js +4 -4
  110. package/lib/components/features/documents/TMDcmtForm.d.ts +7 -0
  111. package/lib/components/features/documents/TMDcmtForm.js +181 -54
  112. package/lib/components/features/documents/TMDcmtFormActionButtons.d.ts +12 -1
  113. package/lib/components/features/documents/TMDcmtFormActionButtons.js +79 -9
  114. package/lib/components/features/documents/TMDcmtIcon.d.ts +2 -1
  115. package/lib/components/features/documents/TMDcmtIcon.js +5 -3
  116. package/lib/components/features/documents/TMDcmtPreview.d.ts +8 -6
  117. package/lib/components/features/documents/TMDcmtPreview.js +12 -8
  118. package/lib/components/features/documents/TMDcmtTasks.d.ts +2 -1
  119. package/lib/components/features/documents/TMDownloadRelationViewerSection.js +1 -1
  120. package/lib/components/features/documents/TMDragDropOverlay.d.ts +1 -1
  121. package/lib/components/features/documents/TMFileUploader.js +28 -28
  122. package/lib/components/features/documents/TMMasterDetailDcmts.js +116 -34
  123. package/lib/components/features/documents/TMMasterInfoFields.d.ts +20 -0
  124. package/lib/components/features/documents/TMMasterInfoFields.js +184 -0
  125. package/lib/components/features/documents/TMMergeToPdfForm.d.ts +3 -3
  126. package/lib/components/features/documents/TMMergeToPdfForm.js +42 -10
  127. package/lib/components/features/documents/TMMultiMasterDetailDcmtsForm.d.ts +46 -0
  128. package/lib/components/features/documents/TMMultiMasterDetailDcmtsForm.js +321 -0
  129. package/lib/components/features/documents/TMMultiMasterDetailDcmtsUtils.d.ts +370 -0
  130. package/lib/components/features/documents/TMMultiMasterDetailDcmtsUtils.js +283 -0
  131. package/lib/components/features/documents/TMRelationViewer.d.ts +24 -3
  132. package/lib/components/features/documents/TMRelationViewer.js +110 -52
  133. package/lib/components/features/documents/copyAndMergeDcmtsShared.d.ts +1 -1
  134. package/lib/components/features/search/TMDcmtCheckoutInfoForm.d.ts +2 -1
  135. package/lib/components/features/search/TMMetadataOutputForm.d.ts +2 -1
  136. package/lib/components/features/search/TMMetadataOutputForm.js +1 -1
  137. package/lib/components/features/search/TMMetadataSorterForm.d.ts +2 -1
  138. package/lib/components/features/search/TMMetadataSorterForm.js +1 -1
  139. package/lib/components/features/search/TMSavedQuerySelector.d.ts +2 -2
  140. package/lib/components/features/search/TMSavedQuerySelector.js +2 -2
  141. package/lib/components/features/search/TMSearch.d.ts +1 -1
  142. package/lib/components/features/search/TMSearch.js +146 -21
  143. package/lib/components/features/search/TMSearchQueryEditor.js +7 -5
  144. package/lib/components/features/search/TMSearchQueryPanel.d.ts +13 -3
  145. package/lib/components/features/search/TMSearchQueryPanel.js +142 -68
  146. package/lib/components/features/search/TMSearchResult.d.ts +16 -0
  147. package/lib/components/features/search/TMSearchResult.js +517 -188
  148. package/lib/components/features/search/TMSearchResultFloatingActionButton.d.ts +1 -1
  149. package/lib/components/features/search/TMSignatureInfoContent.d.ts +2 -1
  150. package/lib/components/features/search/TMSignatureInfoContent.js +1 -1
  151. package/lib/components/features/search/TMTreeSelector.js +121 -70
  152. package/lib/components/features/search/TMViewHistoryDcmt.d.ts +2 -1
  153. package/lib/components/features/tasks/TMTaskForm.d.ts +1 -1
  154. package/lib/components/features/tasks/TMTaskForm.js +1 -1
  155. package/lib/components/features/tasks/TMTaskFormUtils.d.ts +10 -10
  156. package/lib/components/features/tasks/TMTaskFormUtils.js +3 -3
  157. package/lib/components/features/tasks/TMTasksAgenda.d.ts +1 -1
  158. package/lib/components/features/tasks/TMTasksAgenda.js +1 -1
  159. package/lib/components/features/tasks/TMTasksCalendar.d.ts +1 -1
  160. package/lib/components/features/tasks/TMTasksCalendar.js +1 -1
  161. package/lib/components/features/tasks/TMTasksHeader.d.ts +1 -1
  162. package/lib/components/features/tasks/TMTasksHeader.js +1 -1
  163. package/lib/components/features/tasks/TMTasksPanelContent.d.ts +1 -1
  164. package/lib/components/features/tasks/TMTasksUtilsView.d.ts +5 -5
  165. package/lib/components/features/tasks/TMTasksUtilsView.js +1 -1
  166. package/lib/components/features/tasks/TMTasksView.d.ts +1 -1
  167. package/lib/components/features/tasks/TMTasksView.js +7 -13
  168. package/lib/components/features/wg/TMWGsCopyMoveForm.d.ts +3 -2
  169. package/lib/components/features/wg/TMWGsCopyMoveForm.js +1 -1
  170. package/lib/components/features/workflow/TMWorkflowPopup.d.ts +18 -7
  171. package/lib/components/features/workflow/TMWorkflowPopup.js +9 -5
  172. package/lib/components/features/workflow/diagram/ConnectionComponent.js +3 -3
  173. package/lib/components/features/workflow/diagram/DiagramItemComponent.js +3 -3
  174. package/lib/components/features/workflow/diagram/DiagramItemForm.js +1 -1
  175. package/lib/components/features/workflow/diagram/DiagramItemSvgContent.js +1 -1
  176. package/lib/components/features/workflow/diagram/RecipientList.js +1 -1
  177. package/lib/components/features/workflow/diagram/WFDiagram.js +4 -4
  178. package/lib/components/features/workflow/diagram/WorkitemRecipientsEditor.d.ts +3 -1
  179. package/lib/components/forms/Login/ChangePasswordInputs.d.ts +3 -1
  180. package/lib/components/forms/Login/Chooser.d.ts +2 -2
  181. package/lib/components/forms/Login/Menu.js +1 -1
  182. package/lib/components/forms/Login/OTPReader.js +1 -1
  183. package/lib/components/forms/Login/PasswordStrengthChecker.js +1 -1
  184. package/lib/components/forms/Login/RapidAccessLogin.js +2 -2
  185. package/lib/components/forms/Login/RecoverPasswordFlow.js +2 -2
  186. package/lib/components/forms/Login/SelectBox.js +1 -1
  187. package/lib/components/forms/Login/StepIndicator.js +1 -1
  188. package/lib/components/forms/Login/TMLoginForm.js +7 -7
  189. package/lib/components/forms/Login/TextBox.js +1 -1
  190. package/lib/components/forms/TMApplyForm.js +3 -3
  191. package/lib/components/forms/TMChooserForm.d.ts +2 -1
  192. package/lib/components/forms/TMChooserForm.js +1 -1
  193. package/lib/components/forms/TMSaveForm.d.ts +4 -4
  194. package/lib/components/forms/TMSaveForm.js +3 -3
  195. package/lib/components/grids/TMBlogAttachments.d.ts +2 -1
  196. package/lib/components/grids/TMBlogAttachments.js +14 -3
  197. package/lib/components/grids/TMBlogHeader.d.ts +1 -1
  198. package/lib/components/grids/TMBlogHeader.js +5 -1
  199. package/lib/components/grids/TMBlogsPost.d.ts +3 -1
  200. package/lib/components/grids/TMBlogsPost.js +31 -4
  201. package/lib/components/grids/TMBlogsPostUtils.d.ts +10 -9
  202. package/lib/components/grids/TMBlogsPostUtils.js +15 -4
  203. package/lib/components/grids/TMRecentsManager.js +4 -4
  204. package/lib/components/grids/TMValidationItemsList.d.ts +2 -1
  205. package/lib/components/grids/TMValidationItemsList.js +1 -1
  206. package/lib/components/index.d.ts +2 -0
  207. package/lib/components/index.js +2 -0
  208. package/lib/components/layout/panelManager/TMPanelManagerContainer.d.ts +3 -1
  209. package/lib/components/layout/panelManager/TMPanelManagerContainer.js +25 -15
  210. package/lib/components/layout/panelManager/TMPanelManagerContext.d.ts +2 -2
  211. package/lib/components/layout/panelManager/TMPanelManagerContext.js +68 -93
  212. package/lib/components/layout/panelManager/TMPanelManagerToolbar.d.ts +5 -6
  213. package/lib/components/layout/panelManager/TMPanelManagerToolbar.js +1 -1
  214. package/lib/components/layout/panelManager/TMPanelManagerWithPersistenceProvider.d.ts +2 -2
  215. package/lib/components/layout/panelManager/TMPanelWrapper.d.ts +2 -2
  216. package/lib/components/layout/panelManager/TMPanelWrapper.js +3 -3
  217. package/lib/components/layout/panelManager/types.d.ts +3 -0
  218. package/lib/components/layout/panelManager/utils.js +13 -11
  219. package/lib/components/pages/TMPage.d.ts +1 -1
  220. package/lib/components/pages/TMPage.js +1 -1
  221. package/lib/components/query/TMQueryCountButton.js +1 -1
  222. package/lib/components/query/TMQueryEditor.d.ts +14 -10
  223. package/lib/components/query/TMQueryEditor.js +7 -7
  224. package/lib/components/settings/SettingsAppearance.d.ts +2 -1
  225. package/lib/components/sidebar/TMAboutApp.d.ts +2 -1
  226. package/lib/components/sidebar/TMCommandsPanel.d.ts +4 -4
  227. package/lib/components/sidebar/TMCommandsPanel.js +1 -1
  228. package/lib/components/sidebar/TMHeader.d.ts +3 -3
  229. package/lib/components/sidebar/TMHeader.js +36 -26
  230. package/lib/components/sidebar/TMSidebar.js +1 -1
  231. package/lib/components/sidebar/TMSidebarItem.js +1 -1
  232. package/lib/components/viewers/TMDataListItemViewer.d.ts +3 -2
  233. package/lib/components/viewers/TMDataUserIdItemViewer.d.ts +3 -2
  234. package/lib/components/viewers/TMMidViewer.d.ts +2 -2
  235. package/lib/components/viewers/TMMidViewer.js +6 -3
  236. package/lib/components/viewers/TMTidViewer.d.ts +2 -2
  237. package/lib/components/viewers/TMTidViewer.js +89 -28
  238. package/lib/components/wizard/TMStepIndicator.js +3 -3
  239. package/lib/css/tm-sdkui.css +1 -1
  240. package/lib/devextreme-license.d.ts +1 -0
  241. package/lib/devextreme-license.js +3 -0
  242. package/lib/helper/Enum_Localizator.d.ts +4 -4
  243. package/lib/helper/Enum_Localizator.js +1 -0
  244. package/lib/helper/Globalization.d.ts +1 -1
  245. package/lib/helper/SDKUI_Globals.d.ts +110 -0
  246. package/lib/helper/SDKUI_Globals.js +151 -0
  247. package/lib/helper/SDKUI_Localizator.d.ts +735 -687
  248. package/lib/helper/SDKUI_Localizator.js +480 -0
  249. package/lib/helper/TMAppUpdatedModal.d.ts +2 -0
  250. package/lib/helper/TMAppUpdatedModal.js +134 -0
  251. package/lib/helper/TMCommandsContextMenu.d.ts +1 -1
  252. package/lib/helper/TMIcons.d.ts +280 -279
  253. package/lib/helper/TMIcons.js +4 -3
  254. package/lib/helper/TMPdfViewer.d.ts +2 -1
  255. package/lib/helper/TMPdfViewer.js +1 -1
  256. package/lib/helper/TMToppyMessage.d.ts +2 -2
  257. package/lib/helper/TMToppyMessage.js +1 -1
  258. package/lib/helper/TMUtils.d.ts +23 -4
  259. package/lib/helper/TMUtils.js +25 -3
  260. package/lib/helper/checkinCheckoutManager.d.ts +1 -1
  261. package/lib/helper/checkinCheckoutManager.js +1 -1
  262. package/lib/helper/dataGridSearchHelper.d.ts +28 -0
  263. package/lib/helper/dataGridSearchHelper.js +51 -0
  264. package/lib/helper/dcmtsHelper.d.ts +20 -0
  265. package/lib/helper/dcmtsHelper.js +58 -1
  266. package/lib/helper/helpers.d.ts +13 -2
  267. package/lib/helper/helpers.js +27 -3
  268. package/lib/helper/index.d.ts +2 -0
  269. package/lib/helper/index.js +2 -0
  270. package/lib/helper/queryHelper.d.ts +6 -1
  271. package/lib/helper/queryHelper.js +8 -3
  272. package/lib/hooks/tmDistinctValuesGridHelper.d.ts +16 -0
  273. package/lib/hooks/tmDistinctValuesGridHelper.js +31 -0
  274. package/lib/hooks/useArchiveListForm.d.ts +39 -0
  275. package/lib/hooks/useArchiveListForm.js +46 -0
  276. package/lib/hooks/useCaseFlowApprove.d.ts +56 -0
  277. package/lib/hooks/useCaseFlowApprove.js +157 -0
  278. package/lib/hooks/useDataUserIdItem.d.ts +1 -0
  279. package/lib/hooks/useDataUserIdItem.js +1 -0
  280. package/lib/hooks/useDcmtOperations.d.ts +7 -0
  281. package/lib/hooks/useDcmtOperations.js +141 -71
  282. package/lib/hooks/useDocumentOperations.d.ts +4 -0
  283. package/lib/hooks/useDocumentOperations.js +53 -11
  284. package/lib/hooks/useInputDialog.d.ts +2 -1
  285. package/lib/hooks/useInputDialog.js +1 -1
  286. package/lib/hooks/useMultiMasterDetailDcmts.d.ts +113 -0
  287. package/lib/hooks/useMultiMasterDetailDcmts.js +760 -0
  288. package/lib/hooks/useQueryParametersDialog.js +1 -1
  289. package/lib/hooks/useRelatedDocuments.d.ts +1 -0
  290. package/lib/hooks/useRelatedDocuments.js +22 -27
  291. package/lib/hooks/useShowDossiersV5.d.ts +12 -0
  292. package/lib/hooks/useShowDossiersV5.js +37 -0
  293. package/lib/hooks/useTMDistinctValuesMetadataDisplay.d.ts +18 -0
  294. package/lib/hooks/useTMDistinctValuesMetadataDisplay.js +103 -0
  295. package/lib/hooks/useTMDistinctValuesQuickSearch.d.ts +49 -0
  296. package/lib/hooks/useTMDistinctValuesQuickSearch.js +307 -0
  297. package/lib/hooks/useTMDistinctValuesSelection.d.ts +42 -0
  298. package/lib/hooks/useTMDistinctValuesSelection.js +103 -0
  299. package/lib/hooks/useTMDistinctValuesSource.d.ts +29 -0
  300. package/lib/hooks/useTMDistinctValuesSource.js +105 -0
  301. package/lib/index.d.ts +2 -0
  302. package/lib/index.js +5 -2
  303. package/lib/services/caseflow/CaseFlowService.d.ts +247 -0
  304. package/lib/services/caseflow/CaseFlowService.js +720 -0
  305. package/lib/services/caseflow/CaseFlowTemplateCacheService.d.ts +28 -0
  306. package/lib/services/caseflow/CaseFlowTemplateCacheService.js +121 -0
  307. package/lib/services/caseflow/caseFlowNameCache.d.ts +32 -0
  308. package/lib/services/caseflow/caseFlowNameCache.js +116 -0
  309. package/lib/services/caseflow/caseFlowWorkItemUtils.d.ts +61 -0
  310. package/lib/services/caseflow/caseFlowWorkItemUtils.js +113 -0
  311. package/lib/services/index.d.ts +4 -0
  312. package/lib/services/index.js +4 -0
  313. package/lib/services/platform_services.d.ts +7 -6
  314. package/package.json +16 -13
@@ -1,9 +1,9 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
3
3
  import { DcmtTypeListCacheService, LayoutModes, ObjectClasses, SDK_Globals, SDK_Localizator } from '@topconsultnpm/sdk-ts';
4
4
  import TMRelationViewer from './TMRelationViewer';
5
5
  import TMContextMenu from '../../NewComponents/ContextMenu/TMContextMenu';
6
- import { IconMultipleSelection, IconCheckFile, IconDetailDcmts, SDKUI_Localizator, IconMenuVertical, IconDataList, IconPreview, IconSearchCheck, IconBoard, IconDcmtTypeSys, IconShow, getMoreInfoTasksForDocument, isApprovalWorkflowView, searchResultToMetadataValues, IconRefresh } from '../../../helper';
6
+ import { IconMultipleSelection, IconCheckFile, IconDetailDcmts, SDKUI_Localizator, IconMenuVertical, IconDataList, IconPreview, IconSearchCheck, IconBoard, IconDcmtTypeSys, IconShow, getMoreInfoTasksForDocument, isApprovalWorkflowView, searchResultToMetadataValues, IconRefresh, SDKUI_Globals } from '../../../helper';
7
7
  import { FormModes, SearchResultContext } from '../../../ts';
8
8
  import { TMColors } from '../../../utils/theme';
9
9
  import ShowAlert from '../../base/TMAlert';
@@ -23,7 +23,7 @@ const TMMasterDetailDcmts = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallba
23
23
  const floatingBarContainerRef = useRef(null);
24
24
  const [focusedItem, setFocusedItem] = useState();
25
25
  const [selectedItems, setSelectedItems] = useState([]);
26
- const [showZeroDcmts, setShowZeroDcmts] = useState(false);
26
+ const [showZeroDcmts, setShowZeroDcmts] = useState(() => SDKUI_Globals.userSettings?.searchSettings?.relationShowZeroDcmts ?? false);
27
27
  const [allowMultipleSelection, setAllowMultipleSelection] = useState(false);
28
28
  const [dtdMaster, setDtdMaster] = useState();
29
29
  const [noRelationsOnFirstLoad, setNoRelationsOnFirstLoad] = useState(false);
@@ -32,6 +32,11 @@ const TMMasterDetailDcmts = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallba
32
32
  const [contextMenuPosition, setContextMenuPosition] = useState({ x: 0, y: 0 });
33
33
  // Track if TMRelationViewer is loading (used to disable context menu during loading)
34
34
  const [isRelationViewerLoading, setIsRelationViewerLoading] = useState(false);
35
+ // Funzione fornita da TMRelationViewer per interrompere il calcolo delle correlazioni
36
+ // (nessuna ulteriore chiamata GetMetadata). È sincrona: invocabile anche subito prima di uscire.
37
+ const stopRelationsCalculationRef = useRef(undefined);
38
+ // True quando si sta uscendo dalla maschera: evita l'alert sui risultati parziali
39
+ const isLeavingRef = useRef(false);
35
40
  // Track if loading has ever been TRUE (to distinguish initial false from post-load false)
36
41
  const hasLoadingBeenTrueRef = useRef(false);
37
42
  // Track the previous loading state to detect transitions
@@ -63,6 +68,46 @@ const TMMasterDetailDcmts = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallba
63
68
  const onRefreshOperationsDatagrid = useCallback(async () => {
64
69
  setRefreshOperationsTrigger(prev => prev + 1);
65
70
  }, []);
71
+ // Riceve da TMRelationViewer la funzione per interrompere il calcolo
72
+ const handleStopCalculationReady = useCallback((stopCalculation) => {
73
+ stopRelationsCalculationRef.current = stopCalculation;
74
+ }, []);
75
+ // Interrompe il calcolo delle correlazioni: mostra subito quelle già calcolate
76
+ // senza attendere le restanti chiamate GetMetadata
77
+ const handleStopRelationsCalculation = useCallback(() => {
78
+ stopRelationsCalculationRef.current?.();
79
+ setIsCheckingFirstLoad(false); // Nasconde l'overlay e mostra l'albero (parziale)
80
+ }, []);
81
+ // Esce dalla maschera interrompendo anche le chiamate GetMetadata ancora in coda:
82
+ // l'interruzione è invocata in modo sincrono perché onBack può smontare il componente
83
+ // (un effect non farebbe in tempo a propagare l'interruzione)
84
+ const handleBack = useCallback(() => {
85
+ isLeavingRef.current = true;
86
+ stopRelationsCalculationRef.current?.();
87
+ onBack?.();
88
+ }, [onBack]);
89
+ const handleCancelFirstLoad = useCallback(() => {
90
+ setIsCheckingFirstLoad(false);
91
+ handleBack();
92
+ }, [handleBack]);
93
+ // Avanzamento del calcolo correlazioni, mostrato nell'overlay di primo caricamento
94
+ const [relationsProgress, setRelationsProgress] = useState({ value: 0, max: 0 });
95
+ const handleRelationsProgress = useCallback((value, max) => {
96
+ setRelationsProgress({ value, max });
97
+ }, []);
98
+ // Notifica all'utente che i dati mostrati sono parziali (non quando si sta uscendo)
99
+ const handleRelationsCalculationStopped = useCallback((loadedCount, totalCount) => {
100
+ if (isLeavingRef.current)
101
+ return;
102
+ // Con piu' documenti in input, indica quanti sono stati completati (es. "3/10")
103
+ const progress = totalCount > 1 ? ` (${loadedCount}/${totalCount})` : '';
104
+ ShowAlert({
105
+ message: `${SDKUI_Localizator.RelationsCalculationStopped}${progress}`,
106
+ title: SDKUI_Localizator.Attention,
107
+ duration: 4000,
108
+ mode: 'info',
109
+ });
110
+ }, []);
66
111
  // Refresh ALL panels (tree view + search results) with fade-out -> update -> fade-in transition
67
112
  const onRefreshAllPanels = async () => {
68
113
  await dcmtUtility?.onRefreshPreviewForm?.(); // Refresh preview form data
@@ -238,6 +283,12 @@ const TMMasterDetailDcmts = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallba
238
283
  },
239
284
  });
240
285
  const { dcmtOperations: { abortController, showWaitPanel, showPrimary, waitPanelTitle, waitPanelTextPrimary, waitPanelValuePrimary, waitPanelMaxValuePrimary, showSecondary, waitPanelTextSecondary, waitPanelValueSecondary, waitPanelMaxValueSecondary, }, } = features;
286
+ // Nuovi documenti in input: il componente non sta più uscendo dalla maschera
287
+ // (chiave stabile: l'array inputDcmts può essere ricreato a ogni render)
288
+ const inputDcmtsKey = useMemo(() => (inputDcmts ?? []).map(d => `${d.TID}-${d.DID}`).join('|'), [inputDcmts]);
289
+ useEffect(() => {
290
+ isLeavingRef.current = false;
291
+ }, [inputDcmtsKey]);
241
292
  // Load dtdMaster when inputDcmts changes
242
293
  useEffect(() => {
243
294
  const loadDtdMaster = async () => {
@@ -300,7 +351,11 @@ const TMMasterDetailDcmts = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallba
300
351
  icon: _jsx(IconCheckFile, { color: showZeroDcmts ? TMColors.tertiary : TMColors.text_normal }),
301
352
  name: showZeroDcmts ? SDKUI_Localizator.HideDetailsWithZeroDocs : SDKUI_Localizator.ShowDetailsWithZeroDocs,
302
353
  onClick: () => {
303
- setShowZeroDcmts(prev => !prev);
354
+ setShowZeroDcmts(prev => {
355
+ const newValue = !prev;
356
+ SDKUI_Globals.userSettings.searchSettings.relationShowZeroDcmts = newValue;
357
+ return newValue;
358
+ });
304
359
  }
305
360
  },
306
361
  {
@@ -331,11 +386,11 @@ const TMMasterDetailDcmts = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallba
331
386
  setContextMenuVisible(true);
332
387
  }, children: [_jsx(TMRelationViewerWrapper, { refreshKey: refreshKey, inputDcmts: inputDcmts, isForMaster: isForMaster, showCurrentDcmtIndicator: showCurrentDcmtIndicator, showZeroDcmts: showZeroDcmts,
333
388
  // customItemRender={customItemRender}
334
- allowMultipleSelection: allowMultipleSelection, focusedItem: focusedItem, selectedItems: selectedItems, onFocusedItemChanged: handleFocusedItemChanged, onSelectedItemsChanged: handleSelectedItemsChanged, onNoRelationsFound: handleNoRelationsFound, onItemContextMenu: isRelationViewerLoading ? undefined : onItemContextMenu, focusedItemFormData: focusedItemFormData, onLoadingStateChanged: setIsRelationViewerLoading }), _jsx(TMContextMenu, { items: operationItems, externalControl: {
389
+ allowMultipleSelection: allowMultipleSelection, focusedItem: focusedItem, selectedItems: selectedItems, onFocusedItemChanged: handleFocusedItemChanged, onSelectedItemsChanged: handleSelectedItemsChanged, onNoRelationsFound: handleNoRelationsFound, onItemContextMenu: isRelationViewerLoading ? undefined : onItemContextMenu, focusedItemFormData: focusedItemFormData, onLoadingStateChanged: setIsRelationViewerLoading, onLoadingProgress: handleRelationsProgress, onStopCalculationReady: handleStopCalculationReady, onCalculationStopped: handleRelationsCalculationStopped }), _jsx(TMContextMenu, { items: operationItems, externalControl: {
335
390
  visible: contextMenuVisible,
336
391
  position: contextMenuPosition,
337
392
  onClose: () => setContextMenuVisible(false)
338
- } })] }) }), [inputDcmts, isForMaster, showCurrentDcmtIndicator, showZeroDcmts, allowMultipleSelection, focusedItem, selectedItems, handleFocusedItemChanged, handleSelectedItemsChanged, handleNoRelationsFound, onItemContextMenu, contextMenuVisible, contextMenuPosition, refreshKey, focusedItemFormData, isRelationViewerLoading]);
393
+ } })] }) }), [inputDcmts, isForMaster, showCurrentDcmtIndicator, showZeroDcmts, allowMultipleSelection, focusedItem, selectedItems, handleFocusedItemChanged, handleSelectedItemsChanged, handleNoRelationsFound, onItemContextMenu, contextMenuVisible, contextMenuPosition, refreshKey, focusedItemFormData, isRelationViewerLoading, handleStopCalculationReady, handleRelationsCalculationStopped]);
339
394
  const tmFormOrResult = useMemo(() => _jsx(TMFormOrResultWrapper, { refreshKey: refreshKeyFormOrResult, deviceType: deviceType, focusedItem: focusedItem, onTaskCreateRequest: onTaskCreateRequest, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, handleNavigateToReference: handleNavigateToReference, onRefreshAfterAddDcmtToFavs: onRefreshAfterAddDcmtToFavs, editPdfForm: editPdfForm, openS4TViewer: openS4TViewer, onOpenS4TViewerRequest: onOpenS4TViewerRequest, onOpenPdfEditorRequest: onOpenPdfEditorRequest, onRefreshSearchResults: onRefreshAllPanels }), [focusedItem, deviceType, allTasks, handleNavigateToWGs, handleNavigateToDossiers, handleNavigateToReference, editPdfForm, openS4TViewer, onOpenS4TViewerRequest, onOpenPdfEditorRequest, onRefreshAfterAddDcmtToFavs, refreshKeyFormOrResult]);
340
395
  const initialPanelDimensions = {
341
396
  'tmTreeView': { width: '50%', height: '100%' },
@@ -366,7 +421,9 @@ const TMMasterDetailDcmts = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallba
366
421
  title: getTitle(),
367
422
  toolbar: toolbar,
368
423
  allowMaximize: !isMobile,
369
- onBack: onBack
424
+ // handleBack interrompe il calcolo prima di uscire.
425
+ // Resta undefined se il padre non ha passato onBack (nessun pulsante indietro)
426
+ onBack: onBack ? handleBack : undefined
370
427
  }
371
428
  },
372
429
  toolbarOptions: {
@@ -413,10 +470,12 @@ const TMMasterDetailDcmts = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallba
413
470
  toolbarOptions: { icon: _jsx(IconSearchCheck, { fontSize: 24 }), visible: false, orderNumber: 2, isActive: allInitialPanelVisibility['tmFormOrResult'] }
414
471
  }
415
472
  ], [tmTreeView, tmFormOrResult, focusedItem?.isDcmt, dtdMaster]);
416
- return (_jsxs("div", { style: { width: '100%', height: '100%', position: 'relative' }, children: [isCheckingFirstLoad && (_jsx(TMLoadingOverlay, { onCancel: () => {
417
- setIsCheckingFirstLoad(false);
418
- onBack?.();
419
- } })), _jsxs("div", { style: isCheckingFirstLoad ? { position: 'absolute', width: 0, height: 0, overflow: 'hidden', opacity: 0, pointerEvents: 'none' } : { width: '100%', height: '100%' }, children: [_jsx(TMLayoutWaitingContainer, { direction: 'vertical', showWaitPanel: showWaitPanel, showWaitPanelPrimary: showPrimary, showWaitPanelSecondary: showSecondary, waitPanelTitle: waitPanelTitle, waitPanelTextPrimary: waitPanelTextPrimary, waitPanelValuePrimary: waitPanelValuePrimary, waitPanelMaxValuePrimary: waitPanelMaxValuePrimary, waitPanelTextSecondary: waitPanelTextSecondary, waitPanelValueSecondary: waitPanelValueSecondary, waitPanelMaxValueSecondary: waitPanelMaxValueSecondary, isCancelable: true, abortController: abortController, children: _jsx(TMPanelManagerProvider, { panels: initialPanels, initialVisibility: allInitialPanelVisibility, defaultDimensions: initialPanelDimensions, initialDimensions: initialPanelDimensions, initialMobilePanelId: 'tmTreeView', children: _jsx(TMPanelManagerContainer, { panels: initialPanels, direction: "horizontal", showToolbar: true }) }) }), renderDcmtOperations, renderFloatingBar] })] }));
473
+ return (_jsxs("div", { style: { width: '100%', height: '100%', position: 'relative' }, children: [isCheckingFirstLoad && (_jsx(TMLoadingOverlay, { onCancel: handleCancelFirstLoad, onStop: handleStopRelationsCalculation, description: relationsProgress.max > 1
474
+ ? `${isForMaster ? SDKUI_Localizator.LoadingMasterDocuments : SDKUI_Localizator.LoadingDetailDocuments} (${relationsProgress.value}/${relationsProgress.max})`
475
+ : undefined, progressValue: relationsProgress.value, progressMax: relationsProgress.max,
476
+ // Con un solo documento in input la chiamata è unica: non ci sono
477
+ // risultati parziali da mostrare, quindi il pulsante resta disabilitato
478
+ stopDisabled: (inputDcmts?.length ?? 0) <= 1 })), _jsxs("div", { style: isCheckingFirstLoad ? { position: 'absolute', width: 0, height: 0, overflow: 'hidden', opacity: 0, pointerEvents: 'none' } : { width: '100%', height: '100%' }, children: [_jsx(TMLayoutWaitingContainer, { direction: 'vertical', showWaitPanel: showWaitPanel, showWaitPanelPrimary: showPrimary, showWaitPanelSecondary: showSecondary, waitPanelTitle: waitPanelTitle, waitPanelTextPrimary: waitPanelTextPrimary, waitPanelValuePrimary: waitPanelValuePrimary, waitPanelMaxValuePrimary: waitPanelMaxValuePrimary, waitPanelTextSecondary: waitPanelTextSecondary, waitPanelValueSecondary: waitPanelValueSecondary, waitPanelMaxValueSecondary: waitPanelMaxValueSecondary, isCancelable: true, abortController: abortController, children: _jsx(TMPanelManagerProvider, { panels: initialPanels, initialVisibility: allInitialPanelVisibility, defaultDimensions: initialPanelDimensions, initialDimensions: initialPanelDimensions, initialMobilePanelId: 'tmTreeView', children: _jsx(TMPanelManagerContainer, { panels: initialPanels, direction: "horizontal", showToolbar: true }) }) }), renderDcmtOperations, renderFloatingBar] })] }));
420
479
  };
421
480
  export default TMMasterDetailDcmts;
422
481
  /**
@@ -425,7 +484,7 @@ export default TMMasterDetailDcmts;
425
484
  * - Panel visibility toggling
426
485
  * - Focus delay handling
427
486
  */
428
- const TMRelationViewerWrapper = ({ refreshKey, inputDcmts, isForMaster, showCurrentDcmtIndicator, showZeroDcmts, customItemRender, allowMultipleSelection, focusedItem, selectedItems, onFocusedItemChanged, onSelectedItemsChanged, onNoRelationsFound, onItemContextMenu, focusedItemFormData, onLoadingStateChanged }) => {
487
+ const TMRelationViewerWrapper = ({ refreshKey, inputDcmts, isForMaster, showCurrentDcmtIndicator, showZeroDcmts, customItemRender, allowMultipleSelection, focusedItem, selectedItems, onFocusedItemChanged, onSelectedItemsChanged, onNoRelationsFound, onItemContextMenu, focusedItemFormData, onLoadingStateChanged, onLoadingProgress, onStopCalculationReady, onCalculationStopped }) => {
429
488
  const { setPanelVisibilityById, setToolbarButtonVisibility } = useTMPanelManagerContext();
430
489
  // Monitor device type changes to restore panel visibility when switching from mobile to desktop
431
490
  const deviceType = useDeviceType();
@@ -485,7 +544,7 @@ const TMRelationViewerWrapper = ({ refreshKey, inputDcmts, isForMaster, showCurr
485
544
  onItemContextMenu?.(item, e);
486
545
  }, 100);
487
546
  }, [onItemContextMenu, handleFocusedItemChanged]);
488
- return (_jsx(TMRelationViewer, { inputDcmts: inputDcmts, isForMaster: isForMaster, showCurrentDcmtIndicator: showCurrentDcmtIndicator, initialShowZeroDcmts: showZeroDcmts, customItemRender: customItemRender, allowMultipleSelection: allowMultipleSelection, focusedItem: focusedItem, selectedItems: selectedItems, onFocusedItemChanged: handleFocusedItemChanged, onSelectedItemsChanged: onSelectedItemsChanged, maxDepthLevel: 1, invertMasterNavigation: false, showExpandAllButton: true, onNoRelationsFound: onNoRelationsFound, onItemContextMenu: onContextMenu, focusedItemFormData: focusedItemFormData, onLoadingStateChanged: onLoadingStateChanged }, refreshKey));
547
+ return (_jsx(TMRelationViewer, { inputDcmts: inputDcmts, isForMaster: isForMaster, showCurrentDcmtIndicator: showCurrentDcmtIndicator, initialShowZeroDcmts: showZeroDcmts, customItemRender: customItemRender, allowMultipleSelection: allowMultipleSelection, focusedItem: focusedItem, selectedItems: selectedItems, onFocusedItemChanged: handleFocusedItemChanged, onSelectedItemsChanged: onSelectedItemsChanged, maxDepthLevel: 1, invertMasterNavigation: false, showExpandAllButton: true, onNoRelationsFound: onNoRelationsFound, onItemContextMenu: onContextMenu, focusedItemFormData: focusedItemFormData, onLoadingStateChanged: onLoadingStateChanged, onLoadingProgress: onLoadingProgress, onStopCalculationReady: onStopCalculationReady, onCalculationStopped: onCalculationStopped }, refreshKey));
489
548
  };
490
549
  const TMFormOrResultWrapper = ({ refreshKey, deviceType, focusedItem, onTaskCreateRequest, allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, handleNavigateToWGs, handleNavigateToDossiers, onRefreshAfterAddDcmtToFavs, editPdfForm, openS4TViewer, onOpenS4TViewerRequest, onOpenPdfEditorRequest, onRefreshSearchAsyncDatagrid, onRefreshSearchResults, handleNavigateToReference, fetchRemoteCertificates }) => {
491
550
  const { setPanelVisibilityById } = useTMPanelManagerContext();
@@ -495,7 +554,11 @@ const TMFormOrResultWrapper = ({ refreshKey, deviceType, focusedItem, onTaskCrea
495
554
  }, fetchRemoteCertificates: fetchRemoteCertificates }, refreshKey) :
496
555
  focusedItem?.searchResult === undefined ? (_jsx(TMPanel, { title: SDKUI_Localizator.SearchResult, children: _jsx(TMToppyMessage, { message: SDKUI_Localizator.SelectDocumentToViewSearchResults }) })) : (_jsx(TMSearchResult, { groupId: 'tmFormOrResult', isClosable: deviceType !== DeviceType.MOBILE, context: SearchResultContext.METADATA_SEARCH, allowFloatingBar: false, allowRelations: false, openDcmtFormAsModal: true, searchResults: focusedItem?.searchResult ?? [], showSearchResultSidebar: false, showDcmtFormSidebar: false, autoFocusFirstRow: false, onTaskCreateRequest: onTaskCreateRequest, onClose: () => { setPanelVisibilityById('tmTreeView', true); }, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, editPdfForm: editPdfForm, onOpenPdfEditorRequest: onOpenPdfEditorRequest, openS4TViewer: openS4TViewer, onOpenS4TViewerRequest: onOpenS4TViewerRequest, enablePinIcons: false, onRefreshAfterAddDcmtToFavs: onRefreshAfterAddDcmtToFavs, showBackButton: false, onRefreshSearchAsyncDatagrid: onRefreshSearchResults, onReferenceClick: handleNavigateToReference, fetchRemoteCertificates: fetchRemoteCertificates }, refreshKey)) }));
497
556
  };
498
- const TMLoadingOverlay = ({ onCancel, description, cancelText }) => {
557
+ const TMLoadingOverlay = ({ onCancel, onStop, description, cancelText, stopText, progressValue, progressMax, stopDisabled }) => {
558
+ // Stesso calcolo di TMWaitPanel: 0 quando il massimo non è ancora noto
559
+ const progressPercent = (progressMax ?? 0) > 0
560
+ ? Math.min(100, ((progressValue ?? 0) / (progressMax ?? 1)) * 100)
561
+ : 0;
499
562
  return (_jsx("div", { style: {
500
563
  position: 'absolute',
501
564
  top: 0,
@@ -565,24 +628,43 @@ const TMLoadingOverlay = ({ onCancel, description, cancelText }) => {
565
628
  .tm-spinner-animation div:nth-child(7):after { top: 63px; left: 17px; background: #782b7d; }
566
629
  .tm-spinner-animation div:nth-child(8) { animation-delay: -0.288s; }
567
630
  .tm-spinner-animation div:nth-child(8):after { top: 56px; left: 12px; background: #782b7d; }
568
- ` }), _jsxs("div", { className: "tm-spinner-animation", children: [_jsx("div", {}), _jsx("div", {}), _jsx("div", {}), _jsx("div", {}), _jsx("div", {}), _jsx("div", {}), _jsx("div", {}), _jsx("div", {})] })] }), _jsx("span", { style: { fontSize: '14px', color: '#334155', textAlign: 'center' }, children: description ?? SDKUI_Localizator.Loading }), onCancel && (_jsx("button", { onClick: onCancel, style: {
569
- marginTop: '4px',
570
- padding: '8px 24px',
571
- fontSize: '13px',
572
- fontWeight: 500,
573
- color: '#64748b',
574
- background: 'transparent',
575
- border: '1.5px solid #cbd5e1',
576
- borderRadius: '6px',
577
- cursor: 'pointer',
578
- transition: 'all 0.2s ease',
579
- }, onMouseEnter: (e) => {
580
- e.currentTarget.style.background = '#f1f5f9';
581
- e.currentTarget.style.borderColor = '#94a3b8';
582
- e.currentTarget.style.color = '#475569';
583
- }, onMouseLeave: (e) => {
584
- e.currentTarget.style.background = 'transparent';
585
- e.currentTarget.style.borderColor = '#cbd5e1';
586
- e.currentTarget.style.color = '#64748b';
587
- }, children: cancelText ?? SDKUI_Localizator.Cancel }))] }) }));
631
+ ` }), _jsxs("div", { className: "tm-spinner-animation", children: [_jsx("div", {}), _jsx("div", {}), _jsx("div", {}), _jsx("div", {}), _jsx("div", {}), _jsx("div", {}), _jsx("div", {}), _jsx("div", {})] })] }), _jsx("span", { style: { fontSize: '14px', color: '#334155', textAlign: 'center' }, children: description ?? SDKUI_Localizator.Loading }), (progressMax ?? 0) > 1 && (_jsxs("div", { style: { width: '260px' }, children: [_jsx("div", { style: { width: '100%', height: '20px', background: '#e0e0e0', borderRadius: '10px', overflow: 'hidden' }, children: _jsx("div", { style: { width: `${progressPercent.toFixed(2)}%`, height: '100%', background: '#4caf50', transition: 'width 0.3s ease' } }) }), _jsxs("p", { style: { fontWeight: 'bold', color: '#333', margin: '8px 0 0', textAlign: 'center' }, children: [progressPercent.toFixed(2), "%"] })] })), (onStop || onCancel) && (_jsxs("div", { style: { marginTop: '4px', display: 'flex', alignItems: 'center', justifyContent: 'center', flexWrap: 'wrap', gap: '10px' }, children: [onStop && (_jsx("button", { onClick: onStop, disabled: stopDisabled, title: SDKUI_Localizator.StopRelationsCalculation, style: {
632
+ padding: '8px 24px',
633
+ fontSize: '13px',
634
+ fontWeight: 500,
635
+ color: stopDisabled ? '#94a3b8' : 'white',
636
+ background: stopDisabled ? '#e2e8f0' : '#0c448e',
637
+ border: `1.5px solid ${stopDisabled ? '#e2e8f0' : '#0c448e'}`,
638
+ borderRadius: '6px',
639
+ cursor: stopDisabled ? 'not-allowed' : 'pointer',
640
+ transition: 'all 0.2s ease',
641
+ }, onMouseEnter: (e) => {
642
+ if (stopDisabled)
643
+ return;
644
+ e.currentTarget.style.background = '#0a3872';
645
+ e.currentTarget.style.borderColor = '#0a3872';
646
+ }, onMouseLeave: (e) => {
647
+ if (stopDisabled)
648
+ return;
649
+ e.currentTarget.style.background = '#0c448e';
650
+ e.currentTarget.style.borderColor = '#0c448e';
651
+ }, children: stopText ?? SDKUI_Localizator.ShowPartialResults })), onCancel && (_jsx("button", { onClick: onCancel, style: {
652
+ padding: '8px 24px',
653
+ fontSize: '13px',
654
+ fontWeight: 500,
655
+ color: '#64748b',
656
+ background: 'transparent',
657
+ border: '1.5px solid #cbd5e1',
658
+ borderRadius: '6px',
659
+ cursor: 'pointer',
660
+ transition: 'all 0.2s ease',
661
+ }, onMouseEnter: (e) => {
662
+ e.currentTarget.style.background = '#f1f5f9';
663
+ e.currentTarget.style.borderColor = '#94a3b8';
664
+ e.currentTarget.style.color = '#475569';
665
+ }, onMouseLeave: (e) => {
666
+ e.currentTarget.style.background = 'transparent';
667
+ e.currentTarget.style.borderColor = '#cbd5e1';
668
+ e.currentTarget.style.color = '#64748b';
669
+ }, children: cancelText ?? SDKUI_Localizator.Back }))] }))] }) }));
588
670
  };
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import { DcmtTypeDescriptor } from '@topconsultnpm/sdk-ts';
3
+ import { DcmtInfo } from '../../../ts';
4
+ interface TMMasterInfoFieldsProps {
5
+ /** Tipo documento: definisce i metadati (utente) da mostrare e come formattarli */
6
+ dtd: DcmtTypeDescriptor | undefined;
7
+ /** Documento di cui mostrare i metadati: se cambia, i valori vengono riletti */
8
+ dcmt: DcmtInfo | undefined;
9
+ /** Legge i valori del documento indicizzati per mid (il chiamante li tiene in cache) */
10
+ getValuesByMidAsync: () => Promise<Map<number, any>>;
11
+ /** Incrementare per forzare la rilettura dei valori (es. dopo il salvataggio del documento) */
12
+ reloadToken?: number;
13
+ /**
14
+ * Vista a tutto schermo: c'è spazio per tutti i metadati, quindi niente limite dell'anteprima
15
+ * ed è qui che compare la ricerca per nome/valore.
16
+ */
17
+ isExpandedView?: boolean;
18
+ }
19
+ declare const TMMasterInfoFields: ({ dtd, dcmt, getValuesByMidAsync, reloadToken, isExpandedView }: TMMasterInfoFieldsProps) => React.JSX.Element;
20
+ export default TMMasterInfoFields;
@@ -0,0 +1,184 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useMemo, useState } from 'react';
3
+ import { DataListViewModes, MetadataDataDomains, SDK_Globals } from '@topconsultnpm/sdk-ts';
4
+ import { hoverStyle, IconChevronDown, IconClearButton, IconCopy, IconSearch, IconSuccess, SDKUI_Localizator } from '../../../helper';
5
+ import { formatScalarValue, getUserMetadataSorted } from '../../../helper/dcmtsHelper';
6
+ import { useDataListItem } from '../../../hooks/useDataListItem';
7
+ import { TMColors } from '../../../utils/theme';
8
+ import ShowAlert from '../../base/TMAlert';
9
+ import TMTooltip from '../../base/TMTooltip';
10
+ // Metadati mostrati in linea prima del pulsante "mostra tutti".
11
+ const PREVIEW_COUNT = 12;
12
+ const styles = {
13
+ wrapper: { display: 'flex', flexDirection: 'column', flex: 1, minHeight: 0, borderTop: `1px solid ${TMColors.card_background}` },
14
+ body: { flex: 1, minHeight: 0, padding: '13px 10px 9px', display: 'grid', gridTemplateColumns: 'repeat(auto-fill, minmax(185px, 1fr))', gridAutoRows: 'max-content', alignContent: 'start', columnGap: '10px', rowGap: '13px', overflow: 'auto' },
15
+ item: { position: 'relative', display: 'flex', alignItems: 'center', minWidth: 0, minHeight: '30px', padding: '5px 10px 4px', borderRadius: '8px', border: `1px solid ${TMColors.card_background}`, background: TMColors.default_background, transition: 'border-color 0.15s ease, box-shadow 0.15s ease' },
16
+ // Come per il pulsante copia, la posizione sta sull'ancora del tooltip; il troncamento con i
17
+ // puntini deve invece stare sull'elemento che contiene il testo
18
+ label: { position: 'absolute', top: '-7px', left: '8px', maxWidth: 'calc(100% - 16px)', minWidth: 0, padding: '0 5px', background: TMColors.default_background },
19
+ labelText: { maxWidth: '100%', fontSize: '9px', fontWeight: 700, lineHeight: '13px', letterSpacing: '0.5px', textTransform: 'uppercase', color: TMColors.label_normal, whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' },
20
+ value: { display: 'block', width: '100%', fontSize: '12.5px', fontWeight: 500, color: TMColors.text_normal, whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', userSelect: 'text', cursor: 'text', minHeight: '17px', lineHeight: '17px' },
21
+ emptyValue: { color: TMColors.disabled, fontWeight: 400 },
22
+ // Pulsante di copia: pastiglia sul bordo superiore della card, come la caption
23
+ // La posizione sta sull'ancora e non sul pulsante: è il contenitore del tooltip, che deve stare
24
+ // dove si vede il pulsante, altrimenti il tooltip si aprirebbe altrove
25
+ copyBtnAnchor: { position: 'absolute', top: '-9px', right: '6px', transition: 'opacity 0.15s ease' },
26
+ copyBtn: { display: 'flex', alignItems: 'center', justifyContent: 'center', width: '18px', height: '18px', padding: 0, borderRadius: '50%', border: `1px solid ${TMColors.card_background}`, background: TMColors.default_background, color: TMColors.label_normal, cursor: 'pointer', transition: 'background 0.15s ease, color 0.15s ease, border-color 0.15s ease' },
27
+ placeholder: { gridColumn: '1 / -1', padding: '6px 2px', color: TMColors.label_normal, fontSize: '12px' },
28
+ // Barra di ricerca
29
+ searchBar: { display: 'flex', alignItems: 'center', gap: '8px', padding: '12px 14px 0', flexShrink: 0 },
30
+ searchBox: { position: 'relative', display: 'flex', alignItems: 'center', flex: 1, minWidth: 0, maxWidth: '300px', height: '26px', borderRadius: '13px', border: `1px solid ${TMColors.card_background}`, background: TMColors.toolbar_background, transition: 'border-color 0.15s ease, box-shadow 0.15s ease' },
31
+ searchIcon: { flexShrink: 0, margin: '0 3px 0 9px', color: TMColors.label_normal, display: 'flex' },
32
+ searchInput: { flex: 1, minWidth: 0, height: '100%', padding: '0 2px', margin: 0, border: 'none', outline: 'none', background: 'transparent', fontSize: '12px', color: TMColors.text_normal },
33
+ searchClear: { display: 'flex', alignItems: 'center', justifyContent: 'center', width: '18px', height: '18px', marginRight: '5px', padding: 0, border: 'none', borderRadius: '50%', background: 'transparent', color: TMColors.label_normal, cursor: 'pointer', flexShrink: 0, transition: 'background 0.15s ease, color 0.15s ease' },
34
+ searchCount: { fontSize: '11px', fontWeight: 600, color: TMColors.label_normal, whiteSpace: 'nowrap', flexShrink: 0 },
35
+ // Pulsante "mostra tutti / comprimi"
36
+ footer: { display: 'flex', alignItems: 'center', justifyContent: 'center', padding: '2px 10px 9px', flexShrink: 0 },
37
+ showAllBtn: { display: 'inline-flex', alignItems: 'center', gap: '6px', height: '24px', padding: '0 13px', borderRadius: '12px', border: `1px solid ${TMColors.primary_container}`, background: TMColors.primary_container, color: TMColors.primary, fontSize: '11.5px', fontWeight: 700, letterSpacing: '0.2px', cursor: 'pointer', transition: 'background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease' },
38
+ };
39
+ // Sui dispositivi touch l'hover non esiste: il pulsante di copia deve restare sempre visibile
40
+ const SUPPORTS_HOVER = typeof window === 'undefined' || window.matchMedia?.('(hover: hover)')?.matches !== false;
41
+ // Colori del pulsante di copia nei suoi tre stati
42
+ const COPY_BTN_IDLE = { background: TMColors.default_background, borderColor: TMColors.card_background, color: TMColors.label_normal };
43
+ const COPY_BTN_HOVER = { background: TMColors.primary_container, borderColor: TMColors.primary, color: TMColors.primary };
44
+ const COPY_BTN_COPIED = { background: TMColors.default_background, borderColor: TMColors.success, color: TMColors.success };
45
+ // Card di un singolo metadato: hover e feedback della copia sono locali, così non si ridisegna tutta la griglia
46
+ const MetadataCard = ({ caption, copyText, children }) => {
47
+ const [isHovered, setIsHovered] = useState(false);
48
+ const [isCopied, setIsCopied] = useState(false);
49
+ // Il feedback "copiato" si spegne da solo: il timer va annullato se la card sparisce prima
50
+ useEffect(() => {
51
+ if (!isCopied)
52
+ return;
53
+ const timerID = setTimeout(() => setIsCopied(false), 1400);
54
+ return () => clearTimeout(timerID);
55
+ }, [isCopied]);
56
+ const copyAsync = async () => {
57
+ try {
58
+ await navigator.clipboard.writeText(copyText);
59
+ setIsCopied(true);
60
+ }
61
+ catch {
62
+ ShowAlert({ message: SDKUI_Localizator.FailedToCopyToClipboard, mode: 'error', title: SDKUI_Localizator.CopyToClipboard, duration: 3000 });
63
+ }
64
+ };
65
+ // Il pulsante resta visibile durante il feedback e quando ha il focus (accessibilità da tastiera)
66
+ const isCopyVisible = copyText !== '' && (!SUPPORTS_HOVER || isHovered || isCopied);
67
+ return (_jsxs("div", { style: styles.item, onMouseEnter: (e) => { setIsHovered(true); Object.assign(e.currentTarget.style, { borderColor: TMColors.primary, boxShadow: '0 2px 8px rgba(37, 89, 165, 0.14)' }); }, onMouseLeave: (e) => { setIsHovered(false); Object.assign(e.currentTarget.style, { borderColor: TMColors.card_background, boxShadow: 'none' }); }, children: [_jsx(TMTooltip, { content: caption, parentStyle: { ...styles.label, maxWidth: isCopyVisible ? 'calc(100% - 38px)' : 'calc(100% - 16px)' }, childStyle: { maxWidth: '100%', minWidth: 0 }, children: _jsx("span", { style: styles.labelText, children: caption }) }), children, copyText !== '' && (_jsx(TMTooltip, { content: isCopied ? SDKUI_Localizator.CopiedSuccessfully : SDKUI_Localizator.CopyToClipboard, parentStyle: { ...styles.copyBtnAnchor, opacity: isCopyVisible ? 1 : 0, pointerEvents: isCopyVisible ? 'auto' : 'none' }, children: _jsx("button", { type: 'button', style: { ...styles.copyBtn, ...(isCopied ? COPY_BTN_COPIED : COPY_BTN_IDLE) }, "aria-label": SDKUI_Localizator.CopyToClipboard, onClick: copyAsync, onFocus: () => setIsHovered(true), onBlur: () => setIsHovered(false), ...hoverStyle(isCopied ? COPY_BTN_COPIED : COPY_BTN_HOVER, isCopied ? COPY_BTN_COPIED : COPY_BTN_IDLE), children: isCopied ? _jsx(IconSuccess, { fontSize: 11 }) : _jsx(IconCopy, { fontSize: 11 }) }) }))] }));
68
+ };
69
+ // Riepilogo dei metadati di un documento in card compatte
70
+ const TMMasterInfoFields = ({ dtd, dcmt, getValuesByMidAsync, reloadToken, isExpandedView = false }) => {
71
+ const { renderDataListCell, loadDataListsAsync, getDataListItem } = useDataListItem();
72
+ const [rows, setRows] = useState([]);
73
+ // Finché la prima lettura non è conclusa non si mostra "nessun dato" (evita il lampo al primo render)
74
+ const [isLoaded, setIsLoaded] = useState(false);
75
+ const [filter, setFilter] = useState('');
76
+ const [showAll, setShowAll] = useState(false);
77
+ // Carica i metadati del documento (valori + liste dati referenziate).
78
+ // getValuesByMidAsync è volutamente fuori dalle dipendenze: il chiamante la ricrea a ogni render
79
+ useEffect(() => {
80
+ let cancelled = false;
81
+ const loadAsync = async () => {
82
+ try {
83
+ if (!dcmt?.TID || !dcmt?.DID) {
84
+ setRows([]);
85
+ return;
86
+ }
87
+ const metadata = getUserMetadataSorted(dtd);
88
+ // Precarica le liste dati referenziate dai metadati, così le card mostrano subito il valore leggibile
89
+ const dataListIDs = new Set();
90
+ metadata.forEach(md => { if (md.dataDomain === MetadataDataDomains.DataList && md.dataListID)
91
+ dataListIDs.add(md.dataListID); });
92
+ await loadDataListsAsync(dataListIDs);
93
+ const valueByMid = await getValuesByMidAsync();
94
+ if (cancelled)
95
+ return;
96
+ setRows(metadata.map(md => ({
97
+ mid: md.id,
98
+ caption: (SDK_Globals.useLocalizedName ? md.nameLoc : md.name) ?? md.name ?? '',
99
+ value: valueByMid.get(md.id),
100
+ dataListID: (md.dataDomain === MetadataDataDomains.DataList && md.dataListID) ? md.dataListID : 0,
101
+ viewMode: md.dataListViewMode ?? DataListViewModes.None,
102
+ dataType: md.dataType,
103
+ format: md.format?.format,
104
+ formatCulture: md.format?.formatCulture,
105
+ })));
106
+ }
107
+ catch {
108
+ if (!cancelled)
109
+ setRows([]);
110
+ }
111
+ finally {
112
+ if (!cancelled)
113
+ setIsLoaded(true);
114
+ }
115
+ };
116
+ // Cambiando documento/tipo documento il filtro non ha più senso: si riparte dall'anteprima
117
+ setFilter('');
118
+ setShowAll(false);
119
+ loadAsync();
120
+ return () => { cancelled = true; };
121
+ }, [dtd?.id, dcmt?.TID, dcmt?.DID, reloadToken]);
122
+ // La barra di ricerca esiste solo nella vista ingrandita: tornando in linea il filtro non è più
123
+ // visibile e resterebbe attivo, nascondendo i primi metadati dell'anteprima
124
+ useEffect(() => {
125
+ if (isExpandedView)
126
+ return;
127
+ setFilter('');
128
+ setShowAll(false);
129
+ }, [isExpandedView]);
130
+ // Testo su cui cerca il filtro: valore visualizzato del metadato (per le liste dati il nome dell'item)
131
+ const getSearchText = (item) => {
132
+ if (item.value === undefined || item.value === null || item.value === '')
133
+ return '';
134
+ if (item.dataListID > 0) {
135
+ const dataListItem = getDataListItem(item.dataListID, item.value);
136
+ return dataListItem ? `${dataListItem.name ?? ''} ${dataListItem.value ?? ''}` : String(item.value);
137
+ }
138
+ return formatScalarValue(item.value, item.dataType, item.format, item.formatCulture);
139
+ };
140
+ // Testo copiato negli appunti: quello che l'utente vede nella card (per le liste dati il nome dell'item)
141
+ const getCopyText = (item) => {
142
+ if (item.value === undefined || item.value === null || item.value === '')
143
+ return '';
144
+ if (item.dataListID > 0) {
145
+ const dataListItem = getDataListItem(item.dataListID, item.value);
146
+ return dataListItem?.name ?? String(item.value);
147
+ }
148
+ return formatScalarValue(item.value, item.dataType, item.format, item.formatCulture);
149
+ };
150
+ // Ricerca case insensitive su nome e valore del metadato
151
+ const query = filter.trim().toLowerCase();
152
+ const filteredRows = useMemo(() => {
153
+ if (!query)
154
+ return rows;
155
+ return rows.filter(item => item.caption.toLowerCase().includes(query) || getSearchText(item).toLowerCase().includes(query));
156
+ }, [rows, query]);
157
+ const renderCard = (item) => {
158
+ const hasValue = item.value !== undefined && item.value !== null && item.value !== '';
159
+ const displayNode = item.dataListID > 0 && hasValue ? renderDataListCell(item.value, item.dataListID, item.viewMode) : (hasValue ? formatScalarValue(item.value, item.dataType, item.format, item.formatCulture) : '');
160
+ return (_jsx(MetadataCard, { caption: item.caption, copyText: getCopyText(item), children: hasValue
161
+ ? (_jsx(TMTooltip, { content: displayNode, parentStyle: { flex: 1, minWidth: 0 }, childStyle: { maxWidth: '100%', minWidth: 0 }, children: _jsx("span", { style: { ...styles.value, minWidth: 0 }, children: displayNode }) }))
162
+ // Segnaposto per i metadati vuoti: la card mantiene la stessa altezza
163
+ : _jsx("span", { style: { ...styles.value, ...styles.emptyValue }, children: "\u2014" }) }, item.mid));
164
+ };
165
+ // Ricerca dei metadati: solo nella vista ingrandita e solo quando sono troppi per essere trovati a vista
166
+ const renderSearchBar = () => (_jsxs("div", { style: styles.searchBar, children: [_jsxs("div", { style: styles.searchBox, children: [_jsx(IconSearch, { fontSize: 13, style: styles.searchIcon }), _jsx("input", { type: 'text', value: filter, placeholder: `${SDKUI_Localizator.SearchAction}...`, style: styles.searchInput, onChange: (e) => setFilter(e.target.value),
167
+ // Esc svuota il filtro senza propagare la chiusura del modale
168
+ onKeyDown: (e) => { if (e.key === 'Escape' && filter !== '') {
169
+ e.preventDefault();
170
+ e.stopPropagation();
171
+ setFilter('');
172
+ } }, onFocus: (e) => Object.assign(e.currentTarget.parentElement?.style ?? {}, { borderColor: TMColors.primary, boxShadow: '0 0 0 2px rgba(37, 89, 165, 0.14)' }), onBlur: (e) => Object.assign(e.currentTarget.parentElement?.style ?? {}, { borderColor: TMColors.card_background, boxShadow: 'none' }) }), filter !== '' && (_jsx(TMTooltip, { content: SDKUI_Localizator.Clear, parentStyle: { display: 'flex', flexShrink: 0 }, children: _jsx("button", { type: 'button', style: styles.searchClear, "aria-label": SDKUI_Localizator.Clear, onClick: () => setFilter(''), ...hoverStyle({ background: TMColors.primary_container, color: TMColors.primary }, { background: 'transparent', color: TMColors.label_normal }), children: _jsx(IconClearButton, { fontSize: 13 }) }) }))] }), _jsxs("span", { style: styles.searchCount, children: [filteredRows.length, "/", rows.length] })] }));
173
+ // La ricerca sta solo nella vista ingrandita: in linea lo spazio è poco e l'elenco è limitato
174
+ // all'anteprima, con il pulsante per aprirlo tutto
175
+ const hasSearch = isExpandedView && rows.length > PREVIEW_COUNT;
176
+ const isCapped = !isExpandedView && !showAll && filteredRows.length > PREVIEW_COUNT;
177
+ const canCollapse = !isExpandedView && showAll && filteredRows.length > PREVIEW_COUNT;
178
+ const visibleRows = isCapped ? filteredRows.slice(0, PREVIEW_COUNT) : filteredRows;
179
+ const hiddenCount = filteredRows.length - visibleRows.length;
180
+ return (_jsxs("div", { style: { ...styles.wrapper, ...(isExpandedView ? { borderTop: 'none' } : {}) }, children: [hasSearch && renderSearchBar(), _jsx("div", { style: { ...styles.body, ...(isExpandedView ? { padding: '18px 14px 14px' } : {}) }, children: visibleRows.length > 0
181
+ ? visibleRows.map(renderCard)
182
+ : (isLoaded && _jsx("span", { style: styles.placeholder, children: SDKUI_Localizator.NoDataToDisplay })) }), (isCapped || canCollapse) && (_jsx("div", { style: styles.footer, children: _jsxs("button", { type: 'button', style: styles.showAllBtn, onClick: () => setShowAll(!showAll), ...hoverStyle({ background: TMColors.primary, borderColor: TMColors.primary, color: '#ffffff', boxShadow: '0 2px 6px rgba(37, 89, 165, 0.25)' }, { background: TMColors.primary_container, borderColor: TMColors.primary_container, color: TMColors.primary, boxShadow: 'none' }), children: [isCapped ? `${SDKUI_Localizator.ShowAll} (+${hiddenCount})` : SDKUI_Localizator.Collapse, _jsx(IconChevronDown, { fontSize: 13, style: { transform: isCapped ? 'none' : 'rotate(180deg)', transition: 'transform 0.2s ease' } })] }) }))] }));
183
+ };
184
+ export default TMMasterInfoFields;
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import { DcmtInfo } from '../../../ts';
2
3
  import { HomeBlogPost, TaskDescriptor } from '@topconsultnpm/sdk-ts';
3
4
  import { TMCopyToFolderMode } from '../../../hooks/useDocumentOperations';
@@ -17,8 +18,7 @@ interface ITMMergeToPdfFormProps {
17
18
  }
18
19
  /**
19
20
  * Form per l'unione di più documenti PDF in un singolo file.
20
- * Condivide TMDownloadRelationViewerSection e gli helper in copyAndMergeDcmtsShared
21
- * con TMCopyToFolderForm.
21
+ * Condivide TMDownloadRelationViewerSection e gli helper in copyAndMergeDcmtsShared con TMCopyToFolderForm.
22
22
  */
23
- declare const TMMergeToPdfForm: (props: ITMMergeToPdfFormProps) => import("react/jsx-runtime").JSX.Element;
23
+ declare const TMMergeToPdfForm: (props: ITMMergeToPdfFormProps) => React.JSX.Element;
24
24
  export default TMMergeToPdfForm;
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useRef, useState } from 'react';
3
3
  import { DownloadTypes } from '../../../ts';
4
4
  import { calcResponsiveSizes, getExceptionMessage, IconFolderOpen, IconPlay, IconUndo, SDKUI_Globals, SDKUI_Localizator, } from '../../../helper';
5
- import { DcmtOpers, FileFormats, GeneralRetrieveFormats, ResultTypes, RetrieveFileOptions, ValidationItem, } from '@topconsultnpm/sdk-ts';
5
+ import { DcmtOpers, FileFormats, GeneralRetrieveFormats, InvoiceRetrieveFormats, OrderRetrieveFormats, ResultTypes, ValidationItem, } from '@topconsultnpm/sdk-ts';
6
6
  import TMModal from '../../base/TMModal';
7
7
  import { useDeviceType } from '../../base/TMDeviceProvider';
8
8
  import TMTextBox from '../../editors/TMTextBox';
@@ -18,10 +18,41 @@ import ShowAlert from '../../base/TMAlert';
18
18
  import TMTooltip from '../../base/TMTooltip';
19
19
  import MergePdfManager from '../../../helper/MergePdfManager';
20
20
  import { TMResultManager } from '../../forms/TMResultDialog';
21
+ /**
22
+ * Numero di documenti scaricati in parallelo durante l'unione.
23
+ * I file vengono consumati via callback (nessun click su <a download>), quindi il
24
+ * parallelismo è sicuro; il riordino finale è garantito da pdfFilesMap.
25
+ */
26
+ const MERGE_DOWNLOAD_CONCURRENCY = 5;
27
+ /**
28
+ * Converte il formato di visualizzazione fatture impostato dall'utente nel corrispondente formato PDF:
29
+ * il foglio di stile SDI resta SDI, in tutti gli altri casi si usa ASW.
30
+ */
31
+ const toPdfInvoiceRetrieveFormat = (format) => {
32
+ switch (format) {
33
+ case InvoiceRetrieveFormats.SDI_HTML:
34
+ case InvoiceRetrieveFormats.SDI_PDF:
35
+ return InvoiceRetrieveFormats.SDI_PDF;
36
+ default:
37
+ return InvoiceRetrieveFormats.ASW_PDF;
38
+ }
39
+ };
40
+ /**
41
+ * Converte il formato di visualizzazione ordini impostato dall'utente nel corrispondente formato PDF:
42
+ * il foglio di stile NSO resta NSO, in tutti gli altri casi si usa ER.
43
+ */
44
+ const toPdfOrderRetrieveFormat = (format) => {
45
+ switch (format) {
46
+ case OrderRetrieveFormats.NSO_HTML:
47
+ case OrderRetrieveFormats.NSO_PDF:
48
+ return OrderRetrieveFormats.NSO_PDF;
49
+ default:
50
+ return OrderRetrieveFormats.ER_PDF;
51
+ }
52
+ };
21
53
  /**
22
54
  * Form per l'unione di più documenti PDF in un singolo file.
23
- * Condivide TMDownloadRelationViewerSection e gli helper in copyAndMergeDcmtsShared
24
- * con TMCopyToFolderForm.
55
+ * Condivide TMDownloadRelationViewerSection e gli helper in copyAndMergeDcmtsShared con TMCopyToFolderForm.
25
56
  */
26
57
  const TMMergeToPdfForm = (props) => {
27
58
  const { mode, selectedDcmtInfos, selectedItemsFull, onClose, showTMRelationViewer, allTasks, getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, handleNavigateToWGs, handleNavigateToDossiers } = props;
@@ -165,16 +196,17 @@ const TMMergeToPdfForm = (props) => {
165
196
  }
166
197
  // Per i documenti con file, usa il download normale
167
198
  if (dcmtsWithFile.length > 0) {
168
- const rfo = new RetrieveFileOptions();
169
- rfo.retrieveReason = DcmtOpers.None;
170
- rfo.generalRetrieveFormat = GeneralRetrieveFormats.OriginalUnsigned;
171
- rfo.cvtFormat = FileFormats.PDF;
172
- rfo.invoiceRetrieveFormat = SDKUI_Globals.userSettings?.searchSettings.invoiceRetrieveFormat;
173
- rfo.orderRetrieveFormat = SDKUI_Globals.userSettings?.searchSettings.orderRetrieveFormat;
199
+ const rfo = {
200
+ retrieveReason: DcmtOpers.None,
201
+ generalRetrieveFormat: GeneralRetrieveFormats.OriginalUnsigned,
202
+ cvtFormat: FileFormats.PDF,
203
+ invoiceRetrieveFormat: toPdfInvoiceRetrieveFormat(SDKUI_Globals.userSettings?.searchSettings.invoiceRetrieveFormat),
204
+ orderRetrieveFormat: toPdfOrderRetrieveFormat(SDKUI_Globals.userSettings?.searchSettings.orderRetrieveFormat),
205
+ };
174
206
  const collectFileForMerge = async (file, dcmtInfo) => {
175
207
  pdfFilesMap.set(`${dcmtInfo.TID}_${dcmtInfo.DID}`, file);
176
208
  };
177
- await downloadDcmtsAsync({ inputDcmts: dcmtsWithFile, downloadType: DownloadTypes.Dcmt, downloadMode: 'download', onFileDownloaded: collectFileForMerge, skipConfirmation: true, retrieveOptions: rfo, useCache: false });
209
+ await downloadDcmtsAsync({ inputDcmts: dcmtsWithFile, downloadType: DownloadTypes.Dcmt, downloadMode: 'download', onFileDownloaded: collectFileForMerge, skipConfirmation: true, retrieveOptions: rfo, useCache: false, downloadConcurrency: MERGE_DOWNLOAD_CONCURRENCY });
178
210
  }
179
211
  // Ricostruisci l'array pdfFiles nell'ordine originale di selezione
180
212
  const pdfFiles = [];
@@ -0,0 +1,46 @@
1
+ import React from "react";
2
+ import { DcmtTypeDescriptor, HomeBlogPost, ObjectRef, TaskDescriptor } from "@topconsultnpm/sdk-ts";
3
+ import { DcmtInfo, IGraphometricManagerProp, TaskContext } from "../../../ts";
4
+ import { IntesiCertificateData } from "../../../helper";
5
+ interface TMMultiMasterDetailDcmtsFormProps {
6
+ /** Tipo documento del master (per individuare le relazioni di dettaglio) */
7
+ dtd: DcmtTypeDescriptor;
8
+ /** Documento master da cui parte l'archiviazione dei dettagli */
9
+ masterDcmt: DcmtInfo;
10
+ /** Funzione per la chiusura del modale */
11
+ onClose: () => void;
12
+ /** true se nella lista da cui è stato aperto il modale c'è un documento precedente/successivo */
13
+ canNavigateMaster?: (dir: 'next' | 'prev') => boolean;
14
+ /** Sposta il focus della lista di provenienza: il master del modale segue quel documento.
15
+ * Senza questa callback le frecce di navigazione non si mostrano */
16
+ onNavigateMaster?: (dir: 'next' | 'prev') => void;
17
+ allTasks?: Array<TaskDescriptor>;
18
+ getAllTasks?: () => Promise<void>;
19
+ deleteTaskByIdsCallback?: (deletedTaskIds: Array<number>) => Promise<void>;
20
+ addTaskCallback?: (task: TaskDescriptor) => Promise<void>;
21
+ editTaskCallback?: (task: TaskDescriptor) => Promise<void>;
22
+ handleNavigateToWGs?: (value: HomeBlogPost | number) => Promise<void>;
23
+ handleNavigateToDossiers?: (value: HomeBlogPost | number) => Promise<void>;
24
+ showDcmtFormSidebar?: boolean;
25
+ showTodoDcmtForm?: boolean;
26
+ openFileUploaderPdfEditor?: (fromDTD?: DcmtTypeDescriptor, file?: File | null, handleFile?: (file: File) => void) => void;
27
+ graphometricManager?: IGraphometricManagerProp;
28
+ editPdfForm?: boolean;
29
+ openS4TViewer?: boolean;
30
+ showToppyDraggableHelpCenter?: boolean;
31
+ toppyHelpCenterUsePortal?: boolean;
32
+ fetchRemoteCertificates?: (email: string) => Promise<IntesiCertificateData[]>;
33
+ onOpenS4TViewerRequest?: (dcmtInfo: Array<DcmtInfo>, refreshDocumentPreview?: () => Promise<void>) => void;
34
+ onOpenPdfEditorRequest?: (dcmtInfo: Array<DcmtInfo>, refreshDocumentPreview?: () => Promise<void>) => void;
35
+ onReferenceClick?: (ref: ObjectRef) => void;
36
+ onTaskCreateRequest?: (taskContext: TaskContext, onTaskCreated?: (task?: TaskDescriptor) => void) => void;
37
+ onRefreshAfterAddDcmtToFavs?: () => void;
38
+ onFileOpened?: (blob: File | undefined) => void;
39
+ passToArchiveCallback?: (outputMids: Array<{
40
+ mid: number;
41
+ value: string;
42
+ }>, tid?: number) => void;
43
+ openWGsCopyMoveForm?: (mode: "copyToWgDraft" | "copyToWgArchivedDoc", dcmtTypeDescriptor: DcmtTypeDescriptor, documents: Array<DcmtInfo>) => void;
44
+ }
45
+ declare const TMMultiMasterDetailDcmtsForm: (props: TMMultiMasterDetailDcmtsFormProps) => React.JSX.Element | null;
46
+ export default TMMultiMasterDetailDcmtsForm;