@topconsultnpm/sdkui-react 6.22.0-t1 → 6.22.0-t3
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.
- package/lib/components/NewComponents/ContextMenu/TMContextMenu.js +3 -3
- package/lib/components/NewComponents/ContextMenu/hooks.d.ts +1 -1
- package/lib/components/NewComponents/ContextMenu/styles.d.ts +45 -43
- package/lib/components/NewComponents/FloatingMenuBar/TMFloatingMenuBar.js +6 -6
- package/lib/components/NewComponents/FloatingMenuBar/styles.d.ts +80 -73
- package/lib/components/base/Styled.d.ts +92 -76
- package/lib/components/base/Styled.js +7 -5
- package/lib/components/base/TMAccordionNew.js +7 -7
- package/lib/components/base/TMAlert.d.ts +32 -32
- package/lib/components/base/TMAlert.js +6 -8
- package/lib/components/base/TMAreaManager.js +53 -55
- package/lib/components/base/TMButton.d.ts +13 -0
- package/lib/components/base/TMButton.js +139 -7
- package/lib/components/base/TMClosableList.js +3 -3
- package/lib/components/base/TMCustomButton.js +40 -48
- package/lib/components/base/TMDataGrid.d.ts +4 -0
- package/lib/components/base/TMDataGrid.js +292 -12
- package/lib/components/base/TMDataGridExportForm.js +39 -30
- package/lib/components/base/TMDropDownMenu.js +1 -1
- package/lib/components/base/TMEditorBase.d.ts +2 -0
- package/lib/components/base/TMFileManager.js +5 -3
- package/lib/components/base/TMFileManagerDataGridView.js +12 -3
- package/lib/components/base/TMFileManagerThumbnailItems.js +20 -10
- package/lib/components/base/TMFileManagerUtils.d.ts +6 -6
- package/lib/components/base/TMFileManagerUtils.js +37 -1
- package/lib/components/base/TMLayout.d.ts +2 -2
- package/lib/components/base/TMLayout.js +3 -3
- package/lib/components/base/TMList.js +1 -1
- package/lib/components/base/TMListView.js +3 -3
- package/lib/components/base/TMModal.d.ts +11 -0
- package/lib/components/base/TMModal.js +47 -13
- package/lib/components/base/TMPanel.d.ts +6 -0
- package/lib/components/base/TMPanel.js +141 -28
- package/lib/components/base/TMPopUp.js +5 -2
- package/lib/components/base/TMResizableMenu.js +2 -2
- package/lib/components/base/TMRightSidebar.js +1 -1
- package/lib/components/base/TMShowAllOrMaxItemsButton.js +1 -1
- package/lib/components/base/TMSpinner.d.ts +2 -1
- package/lib/components/base/TMSpinner.js +9 -7
- package/lib/components/base/TMTab.js +2 -2
- package/lib/components/base/TMTabControl.d.ts +106 -0
- package/lib/components/base/TMTabControl.js +664 -0
- package/lib/components/base/TMToggleButton.js +2 -2
- package/lib/components/base/TMToolbarCard.js +3 -3
- package/lib/components/base/TMTooltip.d.ts +2 -1
- package/lib/components/base/TMTooltip.js +24 -8
- package/lib/components/base/TMTreeView.d.ts +13 -7
- package/lib/components/base/TMTreeView.js +143 -70
- package/lib/components/base/TMWaitPanel.js +3 -3
- package/lib/components/base/waitPanel/TMWaitPanelConfirm.d.ts +12 -0
- package/lib/components/base/waitPanel/TMWaitPanelConfirm.js +185 -0
- package/lib/components/base/waitPanel/TMWaitPanelManager.d.ts +169 -0
- package/lib/components/base/waitPanel/TMWaitPanelManager.js +320 -0
- package/lib/components/base/waitPanel/TMWaitPanelView.d.ts +53 -0
- package/lib/components/base/waitPanel/TMWaitPanelView.js +274 -0
- package/lib/components/base/waitPanel/index.d.ts +1 -0
- package/lib/components/base/waitPanel/index.js +1 -0
- package/lib/components/choosers/TMCultureIDPicker.js +2 -2
- package/lib/components/choosers/TMDataListItemChooser.js +1 -1
- package/lib/components/choosers/TMDataListItemPicker.js +2 -2
- package/lib/components/choosers/TMDcmtTypeChooser.js +5 -4
- package/lib/components/choosers/TMDiskChooser.js +1 -1
- package/lib/components/choosers/TMDistinctValues.d.ts +9 -7
- package/lib/components/choosers/TMDistinctValues.js +157 -141
- package/lib/components/choosers/TMDynDataListItemChooser.js +1 -1
- package/lib/components/choosers/TMImageIDChooser.js +1 -1
- package/lib/components/choosers/TMMetadataChooser.js +3 -3
- package/lib/components/choosers/TMPathChooser.js +17 -34
- package/lib/components/choosers/TMQuickSearchInfo.d.ts +13 -0
- package/lib/components/choosers/TMQuickSearchInfo.js +279 -0
- package/lib/components/choosers/TMQuickSearchSettingsForm.d.ts +16 -0
- package/lib/components/choosers/TMQuickSearchSettingsForm.js +94 -0
- package/lib/components/choosers/TMRelationChooser.js +1 -1
- package/lib/components/choosers/TMSelectedValuesSummary.d.ts +13 -0
- package/lib/components/choosers/TMSelectedValuesSummary.js +89 -0
- package/lib/components/choosers/TMUserChooser.js +1 -1
- package/lib/components/editors/TMCheckBox.js +1 -1
- package/lib/components/editors/TMDateBox.d.ts +16 -1
- package/lib/components/editors/TMDateBox.js +90 -22
- package/lib/components/editors/TMDropDown.d.ts +3 -0
- package/lib/components/editors/TMDropDown.js +197 -5
- package/lib/components/editors/TMEditorStyled.d.ts +21 -43
- package/lib/components/editors/TMFormulaEditor.js +1 -1
- package/lib/components/editors/TMHtmlContentDisplay.js +1 -1
- package/lib/components/editors/TMLocalizedTextBox.js +1 -1
- package/lib/components/editors/TMMetadataEditor.d.ts +5 -1
- package/lib/components/editors/TMMetadataEditor.js +27 -23
- package/lib/components/editors/TMMetadataValues.js +6 -6
- package/lib/components/editors/TMRadioButton.js +2 -2
- package/lib/components/editors/TMSummary.js +3 -3
- package/lib/components/editors/TMTextArea.d.ts +1 -0
- package/lib/components/editors/TMTextArea.js +25 -17
- package/lib/components/editors/TMTextBox.d.ts +2 -0
- package/lib/components/editors/TMTextBox.js +32 -21
- package/lib/components/editors/TMTextExpression.js +1 -1
- package/lib/components/features/archive/TMArchive.js +24 -5
- package/lib/components/features/assistant/TMHelpOnLineChat.d.ts +29 -0
- package/lib/components/features/assistant/TMHelpOnLineChat.js +1384 -0
- package/lib/components/features/assistant/TMToppyDraggableHelpCenter.js +4 -4
- package/lib/components/features/assistant/TMToppySpeechBubble.js +1 -1
- package/lib/components/features/assistant/dataset/Designer-Suggested-Questions.json +102 -0
- package/lib/components/features/assistant/dataset/Login-Suggested-Questions.json +32 -0
- package/lib/components/features/assistant/dataset/Surfer-Suggested-Questions.json +102 -0
- package/lib/components/features/documents/TMBatchUpdateForm.js +22 -9
- package/lib/components/features/documents/TMCopyToFolderForm.js +50 -42
- package/lib/components/features/documents/TMDcmtBlog.d.ts +3 -0
- package/lib/components/features/documents/TMDcmtBlog.js +4 -4
- package/lib/components/features/documents/TMDcmtForm.d.ts +7 -0
- package/lib/components/features/documents/TMDcmtForm.js +281 -113
- package/lib/components/features/documents/TMDcmtFormActionButtons.d.ts +11 -0
- package/lib/components/features/documents/TMDcmtFormActionButtons.js +79 -9
- package/lib/components/features/documents/TMDcmtIcon.d.ts +1 -3
- package/lib/components/features/documents/TMDcmtIcon.js +8 -8
- package/lib/components/features/documents/TMDcmtPreview.d.ts +7 -5
- package/lib/components/features/documents/TMDcmtPreview.js +16 -10
- package/lib/components/features/documents/TMDcmtTasks.js +2 -9
- package/lib/components/features/documents/TMDownloadRelationViewerSection.js +1 -1
- package/lib/components/features/documents/TMFileUploader.js +7 -7
- package/lib/components/features/documents/TMMasterDetailDcmts.d.ts +2 -0
- package/lib/components/features/documents/TMMasterDetailDcmts.js +95 -108
- package/lib/components/features/documents/TMMasterInfoFields.d.ts +20 -0
- package/lib/components/features/documents/TMMasterInfoFields.js +185 -0
- package/lib/components/features/documents/TMMergeToPdfForm.d.ts +1 -2
- package/lib/components/features/documents/TMMergeToPdfForm.js +83 -56
- package/lib/components/features/documents/TMMultiMasterDetailDcmtsForm.d.ts +46 -0
- package/lib/components/features/documents/TMMultiMasterDetailDcmtsForm.js +320 -0
- package/lib/components/features/documents/TMMultiMasterDetailDcmtsUtils.d.ts +370 -0
- package/lib/components/features/documents/TMMultiMasterDetailDcmtsUtils.js +283 -0
- package/lib/components/features/documents/TMRelationViewer.d.ts +29 -9
- package/lib/components/features/documents/TMRelationViewer.js +310 -208
- package/lib/components/features/documents/copyAndMergeDcmtsShared.d.ts +1 -1
- package/lib/components/features/documents/relationTreeState.d.ts +32 -0
- package/lib/components/features/documents/relationTreeState.js +89 -0
- package/lib/components/features/search/TMMetadataOutputForm.js +1 -1
- package/lib/components/features/search/TMMetadataSorterForm.js +1 -1
- package/lib/components/features/search/TMSavedQuerySelector.js +2 -2
- package/lib/components/features/search/TMSearch.d.ts +1 -1
- package/lib/components/features/search/TMSearch.js +172 -34
- package/lib/components/features/search/TMSearchQueryEditor.js +7 -5
- package/lib/components/features/search/TMSearchQueryPanel.d.ts +14 -4
- package/lib/components/features/search/TMSearchQueryPanel.js +153 -62
- package/lib/components/features/search/TMSearchResult.d.ts +21 -0
- package/lib/components/features/search/TMSearchResult.js +461 -152
- package/lib/components/features/search/TMSignatureInfoContent.js +1 -1
- package/lib/components/features/search/TMTreeSelector.js +130 -83
- package/lib/components/features/search/TMViewHistoryDcmt.js +14 -25
- package/lib/components/features/tasks/TMTaskForm.js +1 -1
- package/lib/components/features/tasks/TMTaskFormUtils.js +3 -3
- package/lib/components/features/tasks/TMTasksAgenda.js +1 -1
- package/lib/components/features/tasks/TMTasksCalendar.js +1 -1
- package/lib/components/features/tasks/TMTasksHeader.js +1 -1
- package/lib/components/features/tasks/TMTasksUtilsView.js +1 -1
- package/lib/components/features/tasks/TMTasksView.js +97 -102
- package/lib/components/features/wg/TMWGsCopyMoveForm.js +92 -92
- package/lib/components/features/workflow/TMWorkflowPopup.d.ts +10 -0
- package/lib/components/features/workflow/TMWorkflowPopup.js +9 -5
- package/lib/components/features/workflow/diagram/ConnectionComponent.js +3 -3
- package/lib/components/features/workflow/diagram/DiagramItemComponent.js +3 -3
- package/lib/components/features/workflow/diagram/DiagramItemForm.js +1 -1
- package/lib/components/features/workflow/diagram/DiagramItemSvgContent.js +1 -1
- package/lib/components/features/workflow/diagram/RecipientList.js +1 -1
- package/lib/components/features/workflow/diagram/WFDiagram.js +4 -4
- package/lib/components/features/workflow/diagram/WorkitemRecipientsEditor.d.ts +3 -1
- package/lib/components/forms/Login/ChangePasswordInputs.d.ts +3 -1
- package/lib/components/forms/Login/Menu.js +1 -1
- package/lib/components/forms/Login/OTPReader.js +1 -1
- package/lib/components/forms/Login/PasswordStrengthChecker.js +1 -1
- package/lib/components/forms/Login/RapidAccessLogin.js +2 -2
- package/lib/components/forms/Login/RecoverPasswordFlow.js +2 -2
- package/lib/components/forms/Login/SelectBox.js +1 -1
- package/lib/components/forms/Login/StepIndicator.js +1 -1
- package/lib/components/forms/Login/TMLoginForm.js +7 -7
- package/lib/components/forms/Login/TextBox.js +1 -1
- package/lib/components/forms/TMApplyForm.js +3 -3
- package/lib/components/forms/TMChooserForm.js +1 -1
- package/lib/components/forms/TMResultDialog.js +1 -1
- package/lib/components/forms/TMSaveForm.js +3 -3
- package/lib/components/grids/TMBlogAttachments.js +14 -3
- package/lib/components/grids/TMBlogHeader.js +5 -1
- package/lib/components/grids/TMBlogsPost.d.ts +2 -0
- package/lib/components/grids/TMBlogsPost.js +122 -99
- package/lib/components/grids/TMBlogsPostUtils.d.ts +1 -0
- package/lib/components/grids/TMBlogsPostUtils.js +15 -4
- package/lib/components/grids/TMRecentsManager.js +4 -4
- package/lib/components/grids/TMValidationItemsList.js +1 -1
- package/lib/components/index.d.ts +6 -0
- package/lib/components/index.js +5 -0
- package/lib/components/layout/panelManager/TMPanelManagerContainer.d.ts +1 -0
- package/lib/components/layout/panelManager/TMPanelManagerContainer.js +25 -15
- package/lib/components/layout/panelManager/TMPanelManagerContext.js +68 -93
- package/lib/components/layout/panelManager/TMPanelManagerToolbar.d.ts +4 -5
- package/lib/components/layout/panelManager/TMPanelManagerToolbar.js +1 -1
- package/lib/components/layout/panelManager/TMPanelWrapper.js +3 -3
- package/lib/components/layout/panelManager/types.d.ts +3 -0
- package/lib/components/layout/panelManager/utils.js +13 -11
- package/lib/components/pages/TMPage.js +30 -32
- package/lib/components/query/TMQueryCountButton.js +1 -1
- package/lib/components/query/TMQueryEditor.d.ts +17 -10
- package/lib/components/query/TMQueryEditor.js +9 -8
- package/lib/components/sidebar/TMCommandsPanel.d.ts +4 -4
- package/lib/components/sidebar/TMCommandsPanel.js +1 -1
- package/lib/components/sidebar/TMHeader.d.ts +1 -0
- package/lib/components/sidebar/TMHeader.js +37 -27
- package/lib/components/sidebar/TMSidebar.js +1 -1
- package/lib/components/sidebar/TMSidebarItem.js +1 -1
- package/lib/components/viewers/TMMidViewer.js +6 -3
- package/lib/components/viewers/TMTidViewer.js +89 -28
- package/lib/components/wizard/TMStepIndicator.js +3 -3
- package/lib/css/tm-sdkui.css +1 -1
- package/lib/devextreme-license.d.ts +1 -0
- package/lib/devextreme-license.js +3 -0
- package/lib/helper/Enum_Localizator.d.ts +4 -4
- package/lib/helper/Enum_Localizator.js +1 -0
- package/lib/helper/Globalization.d.ts +1 -1
- package/lib/helper/SDKUI_Globals.d.ts +110 -0
- package/lib/helper/SDKUI_Globals.js +151 -0
- package/lib/helper/SDKUI_Localizator.d.ts +756 -677
- package/lib/helper/SDKUI_Localizator.js +790 -0
- package/lib/helper/TMAppUpdatedModal.d.ts +2 -0
- package/lib/helper/TMAppUpdatedModal.js +134 -0
- package/lib/helper/TMIcons.d.ts +1 -0
- package/lib/helper/TMIcons.js +4 -3
- package/lib/helper/TMPdfViewer.js +1 -1
- package/lib/helper/TMToppyMessage.js +1 -1
- package/lib/helper/TMUtils.d.ts +51 -4
- package/lib/helper/TMUtils.js +273 -12
- package/lib/helper/ZipManager.d.ts +1 -1
- package/lib/helper/ZipManager.js +2 -1
- package/lib/helper/checkinCheckoutManager.d.ts +1 -1
- package/lib/helper/checkinCheckoutManager.js +1 -1
- package/lib/helper/dataGridSearchHelper.d.ts +28 -0
- package/lib/helper/dataGridSearchHelper.js +51 -0
- package/lib/helper/dcmtsHelper.d.ts +22 -0
- package/lib/helper/dcmtsHelper.js +60 -1
- package/lib/helper/helpers.d.ts +24 -2
- package/lib/helper/helpers.js +59 -3
- package/lib/helper/index.d.ts +2 -0
- package/lib/helper/index.js +2 -0
- package/lib/helper/queryHelper.d.ts +6 -1
- package/lib/helper/queryHelper.js +8 -3
- package/lib/hooks/tmDistinctValuesGridHelper.d.ts +16 -0
- package/lib/hooks/tmDistinctValuesGridHelper.js +31 -0
- package/lib/hooks/useArchiveListForm.d.ts +39 -0
- package/lib/hooks/useArchiveListForm.js +46 -0
- package/lib/hooks/useCaseFlowApprove.d.ts +56 -0
- package/lib/hooks/useCaseFlowApprove.js +157 -0
- package/lib/hooks/useCheckInOutOperations.d.ts +0 -6
- package/lib/hooks/useCheckInOutOperations.js +14 -34
- package/lib/hooks/useDataUserIdItem.d.ts +1 -0
- package/lib/hooks/useDataUserIdItem.js +1 -0
- package/lib/hooks/useDcmtOperations.d.ts +3 -12
- package/lib/hooks/useDcmtOperations.js +187 -179
- package/lib/hooks/useDocumentOperations.d.ts +5 -0
- package/lib/hooks/useDocumentOperations.js +64 -33
- package/lib/hooks/useInputDialog.js +1 -1
- package/lib/hooks/useMultiMasterDetailDcmts.d.ts +98 -0
- package/lib/hooks/useMultiMasterDetailDcmts.js +758 -0
- package/lib/hooks/usePreventFileDrop.js +9 -0
- package/lib/hooks/useQueryParametersDialog.js +1 -1
- package/lib/hooks/useRelatedDocuments.d.ts +1 -0
- package/lib/hooks/useRelatedDocuments.js +22 -27
- package/lib/hooks/useShowDossiersV5.d.ts +12 -0
- package/lib/hooks/useShowDossiersV5.js +37 -0
- package/lib/hooks/useTMDistinctValuesMetadataDisplay.d.ts +18 -0
- package/lib/hooks/useTMDistinctValuesMetadataDisplay.js +103 -0
- package/lib/hooks/useTMDistinctValuesQuickSearch.d.ts +49 -0
- package/lib/hooks/useTMDistinctValuesQuickSearch.js +307 -0
- package/lib/hooks/useTMDistinctValuesSelection.d.ts +42 -0
- package/lib/hooks/useTMDistinctValuesSelection.js +103 -0
- package/lib/hooks/useTMDistinctValuesSource.d.ts +29 -0
- package/lib/hooks/useTMDistinctValuesSource.js +105 -0
- package/lib/hooks/useWorkflowApprove.js +33 -17
- package/lib/index.d.ts +2 -0
- package/lib/index.js +5 -2
- package/lib/services/caseflow/CaseFlowService.d.ts +277 -0
- package/lib/services/caseflow/CaseFlowService.js +761 -0
- package/lib/services/caseflow/CaseFlowTemplateCacheService.d.ts +28 -0
- package/lib/services/caseflow/CaseFlowTemplateCacheService.js +121 -0
- package/lib/services/caseflow/caseFlowNameCache.d.ts +32 -0
- package/lib/services/caseflow/caseFlowNameCache.js +116 -0
- package/lib/services/caseflow/caseFlowWorkItemUtils.d.ts +61 -0
- package/lib/services/caseflow/caseFlowWorkItemUtils.js +113 -0
- package/lib/services/index.d.ts +4 -0
- package/lib/services/index.js +4 -0
- package/lib/services/platform_services.d.ts +4 -4
- package/package.json +16 -13
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useEffect, useRef } from 'react';
|
|
2
2
|
import { LocalizeDcmtOperationTypes } from '../helper/Enum_Localizator';
|
|
3
3
|
import { SDK_Globals, RetrieveFileOptions, DcmtOpers, ResultTypes, RecentCategories, MetadataDataTypes, MetadataDataDomains, DataListCacheService, DcmtTypeListCacheService, TemplateTIDs } from '@topconsultnpm/sdk-ts';
|
|
4
|
-
import { ShowAlert, TMResultManager, FormulaHelper, TMExceptionBoxManager, TMSpinner } from '../components';
|
|
4
|
+
import { ShowAlert, TMResultManager, FormulaHelper, TMExceptionBoxManager, TMSpinner, TMWaitPanelManager } from '../components';
|
|
5
5
|
import { Globalization, getExceptionMessage, dialogConfirmOperation, extensionHandler, downloadBase64File, SDKUI_Globals, dcmtsFileCacheDownload, CACHE_SIZE_LIMIT, clearDcmtsFileCache, dcmtsFileCachePreview, isDcmtFileInCache, removeDcmtsFileCache, SDKUI_Localizator, ZipManager } from '../helper';
|
|
6
6
|
import { DcmtOperationTypes, DownloadTypes, FileExtensionHandler } from '../ts';
|
|
7
7
|
import { useFileDialog, useFileSourceDialog } from './useInputDialog';
|
|
@@ -107,16 +107,22 @@ const getDownloadFileName = (file, dcmtInfo, useInputFileName = false) => {
|
|
|
107
107
|
return `${baseFileName.slice(0, firstDot)}(${count})${baseFileName.slice(firstDot)}`;
|
|
108
108
|
};
|
|
109
109
|
export const useDcmtOperations = () => {
|
|
110
|
-
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
const
|
|
110
|
+
// Pannello imperativo: l'avanzamento non passa da uno stato React.
|
|
111
|
+
const waitPanelRef = useRef(null);
|
|
112
|
+
/** Apre il wait panel dell'operazione. Interrompi agisce sull'abortController del ciclo. */
|
|
113
|
+
const openWaitPanel = (options) => {
|
|
114
|
+
waitPanelRef.current?.close();
|
|
115
|
+
const panel = TMWaitPanelManager.show({ cancelable: true, onAbort: () => abortController.abort(), ...options });
|
|
116
|
+
waitPanelRef.current = panel;
|
|
117
|
+
return panel;
|
|
118
|
+
};
|
|
119
|
+
const closeWaitPanel = (panel) => {
|
|
120
|
+
panel.close();
|
|
121
|
+
if (waitPanelRef.current === panel)
|
|
122
|
+
waitPanelRef.current = null;
|
|
123
|
+
};
|
|
124
|
+
// Il pannello vive fuori dall'albero del chiamante: allo smontaggio va chiuso a mano.
|
|
125
|
+
useEffect(() => () => { waitPanelRef.current?.close(); waitPanelRef.current = null; }, []);
|
|
120
126
|
const { OpenFileDialog } = useFileDialog();
|
|
121
127
|
const [selectFileSource, FileSourceDialog] = useFileSourceDialog();
|
|
122
128
|
const copyCompliantDcmtsAsync = async (inputDcmt, onFileDownloaded) => {
|
|
@@ -129,8 +135,14 @@ export const useDcmtOperations = () => {
|
|
|
129
135
|
let returnDcmtInfos = [];
|
|
130
136
|
const rfo = new RetrieveFileOptions();
|
|
131
137
|
rfo.retrieveReason = DcmtOpers.ShowFile;
|
|
132
|
-
|
|
133
|
-
|
|
138
|
+
// Gira dentro runOperationAsync: i byte vanno sulla barra secondaria del pannello gia' aperto.
|
|
139
|
+
const publishSecondary = (pd, label) => {
|
|
140
|
+
const max = pd.ProgressBarMaximum ?? 0;
|
|
141
|
+
const completed = pd.ProgressBarValue === pd.ProgressBarMaximum;
|
|
142
|
+
waitPanelRef.current?.setSecondary(completed
|
|
143
|
+
? { value: 0, max: 0, text: '' }
|
|
144
|
+
: { value: pd.ProgressBarValue, max, text: `${label} ${Globalization.getNumberDisplayValue(pd.ProgressBarValue, true)} / ${Globalization.getNumberDisplayValue(max, true)}` });
|
|
145
|
+
};
|
|
134
146
|
let signerInfoDescriptor = undefined;
|
|
135
147
|
if (inputDcmt?.FILEEXT == undefined || inputDcmt.FILEEXT == '') {
|
|
136
148
|
throw new Error('WARNING#' + SDKUI_Localizator.MetadataOnlyDocument);
|
|
@@ -179,21 +191,7 @@ export const useDcmtOperations = () => {
|
|
|
179
191
|
else
|
|
180
192
|
throw new Error('IdC non firmato e non marcato temporalmente!');
|
|
181
193
|
//Ricerca dell'impronta SHA256 nel contenuto dell'IdC
|
|
182
|
-
let fileIdC = await SDK_Globals.tmSession?.NewSearchEngine().RetrieveFileAsync(serachResultIdC.dtdResult.rows[0][0], serachResultIdC.dtdResult.rows[0][1], rfo, abortController.signal, (pd) =>
|
|
183
|
-
if (firstBlock) {
|
|
184
|
-
maxFileSize = pd.ProgressBarMaximum ?? 0;
|
|
185
|
-
setWaitPanelMaxValueSecondary(maxFileSize);
|
|
186
|
-
firstBlock = false;
|
|
187
|
-
}
|
|
188
|
-
setWaitPanelValueSecondary(pd.ProgressBarValue);
|
|
189
|
-
setWaitPanelTextSecondary(`Downloading IdC... ${Globalization.getNumberDisplayValue(pd.ProgressBarValue, true)} / ${Globalization.getNumberDisplayValue(maxFileSize, true)}`);
|
|
190
|
-
if (pd.ProgressBarValue === pd.ProgressBarMaximum) {
|
|
191
|
-
setWaitPanelMaxValueSecondary(0);
|
|
192
|
-
setWaitPanelValueSecondary(0);
|
|
193
|
-
setWaitPanelTextSecondary('');
|
|
194
|
-
firstBlock = true;
|
|
195
|
-
}
|
|
196
|
-
});
|
|
194
|
+
let fileIdC = await SDK_Globals.tmSession?.NewSearchEngine().RetrieveFileAsync(serachResultIdC.dtdResult.rows[0][0], serachResultIdC.dtdResult.rows[0][1], rfo, abortController.signal, (pd) => publishSecondary(pd, 'Downloading IdC...'));
|
|
197
195
|
let hashOk = false;
|
|
198
196
|
if (fileIdC) {
|
|
199
197
|
try {
|
|
@@ -210,21 +208,7 @@ export const useDcmtOperations = () => {
|
|
|
210
208
|
throw new Error('Impronta non trovata nel file IdC o non corrispondente a quella del documento');
|
|
211
209
|
}
|
|
212
210
|
let file;
|
|
213
|
-
file = await SDK_Globals.tmSession?.NewSearchEngine().RetrieveFileAsync(inputDcmt.TID, inputDcmt.DID, rfo, abortController.signal, (pd) =>
|
|
214
|
-
if (firstBlock) {
|
|
215
|
-
maxFileSize = pd.ProgressBarMaximum ?? 0;
|
|
216
|
-
setWaitPanelMaxValueSecondary(maxFileSize);
|
|
217
|
-
firstBlock = false;
|
|
218
|
-
}
|
|
219
|
-
setWaitPanelValueSecondary(pd.ProgressBarValue);
|
|
220
|
-
setWaitPanelTextSecondary(`Downloading... ${Globalization.getNumberDisplayValue(pd.ProgressBarValue, true)} / ${Globalization.getNumberDisplayValue(maxFileSize, true)}`);
|
|
221
|
-
if (pd.ProgressBarValue === pd.ProgressBarMaximum) {
|
|
222
|
-
setWaitPanelMaxValueSecondary(0);
|
|
223
|
-
setWaitPanelValueSecondary(0);
|
|
224
|
-
setWaitPanelTextSecondary('');
|
|
225
|
-
firstBlock = true;
|
|
226
|
-
}
|
|
227
|
-
});
|
|
211
|
+
file = await SDK_Globals.tmSession?.NewSearchEngine().RetrieveFileAsync(inputDcmt.TID, inputDcmt.DID, rfo, abortController.signal, (pd) => publishSecondary(pd, 'Downloading...'));
|
|
228
212
|
if (file && fileIdC) {
|
|
229
213
|
returnDcmtFiles.push(file);
|
|
230
214
|
returnDcmtInfos.push(inputDcmt);
|
|
@@ -281,11 +265,20 @@ export const useDcmtOperations = () => {
|
|
|
281
265
|
}
|
|
282
266
|
}
|
|
283
267
|
let operationTitle = 'Download File';
|
|
284
|
-
setShowWaitPanel(true);
|
|
285
|
-
setShowPrimary(inputDcmts.length > 1);
|
|
286
|
-
setShowSecondary(true);
|
|
287
|
-
setWaitPanelTitle(operationTitle);
|
|
288
268
|
abortController = new AbortController();
|
|
269
|
+
// Riferimento const: il narrowing su inputDcmts non sopravvive dentro le closure.
|
|
270
|
+
const dcmts = inputDcmts;
|
|
271
|
+
// Con un solo documento c'e' un avanzamento solo, quello dei byte, e sta sulla barra
|
|
272
|
+
// principale: la doppia barra (documenti + byte) serve solo all'elaborazione multipla.
|
|
273
|
+
const isBatch = dcmts.length > 1;
|
|
274
|
+
const panel = openWaitPanel({
|
|
275
|
+
title: operationTitle,
|
|
276
|
+
max: isBatch ? dcmts.length : 0,
|
|
277
|
+
showSecondary: isBatch,
|
|
278
|
+
showCounters: isBatch,
|
|
279
|
+
primaryLabel: isBatch ? SDKUI_Localizator.Documents : undefined,
|
|
280
|
+
secondaryLabel: isBatch ? 'File corrente' : undefined,
|
|
281
|
+
});
|
|
289
282
|
const rfo = new RetrieveFileOptions();
|
|
290
283
|
rfo.retrieveReason = retrieveOptions?.retrieveReason ?? DcmtOpers.ShowFile;
|
|
291
284
|
if (retrieveOptions?.cvtFormat !== undefined)
|
|
@@ -294,85 +287,100 @@ export const useDcmtOperations = () => {
|
|
|
294
287
|
rfo.generalRetrieveFormat = retrieveOptions.generalRetrieveFormat;
|
|
295
288
|
rfo.invoiceRetrieveFormat = retrieveOptions?.invoiceRetrieveFormat ?? SDKUI_Globals.userSettings.searchSettings.invoiceRetrieveFormat;
|
|
296
289
|
rfo.orderRetrieveFormat = retrieveOptions?.orderRetrieveFormat ?? SDKUI_Globals.userSettings.searchSettings.orderRetrieveFormat;
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
290
|
+
const results = [];
|
|
291
|
+
// Il pannello coalesce le scritture in un flush per frame: nessun throttle serve.
|
|
292
|
+
const publishBytes = (loaded, total) => {
|
|
293
|
+
const text = total > 0
|
|
294
|
+
? `Downloading... ${Globalization.getNumberDisplayValue(loaded, true)} / ${Globalization.getNumberDisplayValue(total, true)}`
|
|
295
|
+
: '';
|
|
296
|
+
if (isBatch)
|
|
297
|
+
panel.setSecondary({ value: loaded, max: total, text });
|
|
298
|
+
else
|
|
299
|
+
panel.update({ value: loaded, max: total, subtitle: text });
|
|
300
|
+
};
|
|
301
|
+
// ---- Download sequenziale: un documento per volta ----
|
|
302
|
+
let completed = 0;
|
|
303
|
+
const downloadOne = async (i) => {
|
|
304
|
+
if (isBatch)
|
|
305
|
+
panel.setSubtitle(`Download file ${i + 1} di ${dcmts.length}`);
|
|
306
|
+
let file;
|
|
307
|
+
const cacheKey = `${dcmts[i].TID}-${dcmts[i].DID}`;
|
|
308
|
+
if (useCache && dcmtsFileCacheDownload.has(cacheKey)) {
|
|
309
|
+
file = dcmtsFileCacheDownload.get(cacheKey);
|
|
305
310
|
}
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
311
|
+
else {
|
|
312
|
+
try {
|
|
313
|
+
file = await SDK_Globals.tmSession?.NewSearchEngine().RetrieveFileAsync(dcmts[i].TID, dcmts[i].DID, rfo, abortController.signal, (pd) => publishBytes(pd.ProgressBarValue, pd.ProgressBarMaximum ?? 0));
|
|
314
|
+
}
|
|
315
|
+
finally {
|
|
316
|
+
if (isBatch)
|
|
317
|
+
publishBytes(0, 0);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
completed++;
|
|
321
|
+
if (isBatch)
|
|
322
|
+
panel.setValue(completed);
|
|
323
|
+
if (downloadMode === "openInNewWindow") {
|
|
324
|
+
if (onFileDownloaded && file) {
|
|
325
|
+
onFileDownloaded(file, dcmts[i]);
|
|
312
326
|
}
|
|
313
327
|
else {
|
|
314
|
-
|
|
315
|
-
if (firstBlock) {
|
|
316
|
-
maxFileSize = pd.ProgressBarMaximum ?? 0;
|
|
317
|
-
setWaitPanelMaxValueSecondary(maxFileSize);
|
|
318
|
-
firstBlock = false;
|
|
319
|
-
}
|
|
320
|
-
setWaitPanelValueSecondary(pd.ProgressBarValue);
|
|
321
|
-
setWaitPanelTextSecondary(`Downloading... ${Globalization.getNumberDisplayValue(pd.ProgressBarValue, true)} / ${Globalization.getNumberDisplayValue(maxFileSize, true)}`);
|
|
322
|
-
if (pd.ProgressBarValue === pd.ProgressBarMaximum) {
|
|
323
|
-
setWaitPanelMaxValueSecondary(0);
|
|
324
|
-
setWaitPanelValueSecondary(0);
|
|
325
|
-
setWaitPanelTextSecondary('');
|
|
326
|
-
firstBlock = true;
|
|
327
|
-
}
|
|
328
|
-
});
|
|
328
|
+
window.open(window.URL.createObjectURL(file), '_blank', 'noopener');
|
|
329
329
|
}
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
if (
|
|
333
|
-
(
|
|
334
|
-
? onFileDownloaded(file, inputDcmts[i])
|
|
335
|
-
: window.open(fileURL, '_blank', 'noopener');
|
|
330
|
+
}
|
|
331
|
+
else {
|
|
332
|
+
if (onFileDownloaded && file) {
|
|
333
|
+
await onFileDownloaded(file, dcmts[i]);
|
|
336
334
|
}
|
|
337
335
|
else {
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
336
|
+
// L'object URL serve solo in questo ramo: creato qui e revocato dopo il
|
|
337
|
+
// click, così i blob non restano agganciati al documento per sempre.
|
|
338
|
+
const fileURL = window.URL.createObjectURL(file);
|
|
339
|
+
const alink2 = document.createElement('a');
|
|
340
|
+
alink2.href = fileURL;
|
|
341
|
+
// Usa useInputFileName per determinare la priorità del nome file
|
|
342
|
+
alink2.download = getDownloadFileName(file, dcmts[i], useInputFileName);
|
|
343
|
+
alink2.target = "_blank";
|
|
344
|
+
alink2.rel = "noreferrer";
|
|
345
|
+
alink2.click();
|
|
346
|
+
// 60s come per l'iframe di stampa: revocare troppo presto può far fallire
|
|
347
|
+
// il download se il browser non ha ancora risolto il blob URL.
|
|
348
|
+
setTimeout(() => window.URL.revokeObjectURL(fileURL), 60000);
|
|
350
349
|
}
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
dcmtsFileCacheDownload.set(cacheKey, file);
|
|
350
|
+
}
|
|
351
|
+
if (useCache) {
|
|
352
|
+
if (dcmtsFileCacheDownload.size >= CACHE_SIZE_LIMIT) {
|
|
353
|
+
const oldestKey = dcmtsFileCacheDownload.keys().next().value;
|
|
354
|
+
dcmtsFileCacheDownload.delete(oldestKey);
|
|
357
355
|
}
|
|
358
|
-
|
|
356
|
+
dcmtsFileCacheDownload.set(cacheKey, file);
|
|
357
|
+
}
|
|
358
|
+
results.push({ rowIndex: i, id1: dcmts[i].TID, id2: dcmts[i].DID, resultType: ResultTypes.SUCCESS });
|
|
359
|
+
};
|
|
360
|
+
for (let i = 0; i < dcmts.length; i++) {
|
|
361
|
+
// Con la conferma di interruzione aperta il ciclo si ferma qui invece di
|
|
362
|
+
// continuare a scaricare dietro al dialogo.
|
|
363
|
+
await panel.waitWhilePaused();
|
|
364
|
+
if (abortController.signal.aborted) {
|
|
365
|
+
results.push({ rowIndex: i, id1: dcmts[i].TID, id2: dcmts[i].DID, resultType: ResultTypes.WARNING, description: `Operazione interrotta. Elaborati ${completed} documenti` });
|
|
366
|
+
panel.warning();
|
|
367
|
+
break;
|
|
368
|
+
}
|
|
369
|
+
try {
|
|
370
|
+
await downloadOne(i);
|
|
371
|
+
panel.ok();
|
|
359
372
|
}
|
|
360
373
|
catch (ex) {
|
|
361
|
-
|
|
374
|
+
results.push({ rowIndex: i, id1: dcmts[i].TID, id2: dcmts[i].DID, resultType: ResultTypes.ERROR, description: getExceptionMessage(ex) });
|
|
375
|
+
panel.error();
|
|
362
376
|
const err = ex;
|
|
363
377
|
if (err.name === 'CanceledError') {
|
|
364
378
|
ShowAlert({ message: err.message, mode: 'warning', duration: 3000, title: 'Abort' });
|
|
365
379
|
}
|
|
366
380
|
}
|
|
367
381
|
}
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
setWaitPanelValuePrimary(0);
|
|
371
|
-
setWaitPanelTextSecondary('');
|
|
372
|
-
setWaitPanelMaxValueSecondary(0);
|
|
373
|
-
setWaitPanelValueSecondary(0);
|
|
374
|
-
setShowWaitPanel(false);
|
|
375
|
-
TMResultManager.show(result, operationTitle, "TID", "DID", undefined, undefined, showSuccessAlert);
|
|
382
|
+
closeWaitPanel(panel);
|
|
383
|
+
TMResultManager.show(results, operationTitle, "TID", "DID", undefined, undefined, showSuccessAlert);
|
|
376
384
|
};
|
|
377
385
|
const _downloadAttachmentsAsync = async (inputDcmts, confirmAttachments, showSuccessAlert = true) => {
|
|
378
386
|
if (inputDcmts === undefined)
|
|
@@ -506,22 +514,37 @@ export const useDcmtOperations = () => {
|
|
|
506
514
|
}
|
|
507
515
|
if (!file)
|
|
508
516
|
return;
|
|
509
|
-
setShowWaitPanel(true);
|
|
510
|
-
setShowPrimary(inputDcmts.length > 1);
|
|
511
|
-
setShowSecondary(true);
|
|
512
|
-
setWaitPanelTitle(operationTitle);
|
|
513
517
|
abortController = new AbortController();
|
|
518
|
+
// Come nel download: con un solo documento resta il solo avanzamento in byte.
|
|
519
|
+
const isBatch = inputDcmts.length > 1;
|
|
520
|
+
const panel = openWaitPanel({
|
|
521
|
+
title: operationTitle,
|
|
522
|
+
max: isBatch ? inputDcmts.length : 0,
|
|
523
|
+
showSecondary: isBatch,
|
|
524
|
+
showCounters: isBatch,
|
|
525
|
+
primaryLabel: isBatch ? SDKUI_Localizator.Documents : undefined,
|
|
526
|
+
secondaryLabel: isBatch ? 'File corrente' : undefined,
|
|
527
|
+
});
|
|
528
|
+
const publishBytes = (loaded, total) => {
|
|
529
|
+
const text = total > 0
|
|
530
|
+
? `Uploading... ${Globalization.getNumberDisplayValue(loaded, true)} / ${Globalization.getNumberDisplayValue(total, true)}`
|
|
531
|
+
: '';
|
|
532
|
+
if (isBatch)
|
|
533
|
+
panel.setSecondary({ value: loaded, max: total, text });
|
|
534
|
+
else
|
|
535
|
+
panel.update({ value: loaded, max: total, subtitle: text });
|
|
536
|
+
};
|
|
514
537
|
let result = [];
|
|
515
|
-
setWaitPanelMaxValuePrimary(inputDcmts.length);
|
|
516
|
-
let firstBlock = true;
|
|
517
|
-
let maxFileSize = 0;
|
|
518
538
|
for (let i = 0; i < inputDcmts.length; i++) {
|
|
539
|
+
await panel.waitWhilePaused();
|
|
519
540
|
if (abortController.signal.aborted) {
|
|
520
541
|
result.push({ rowIndex: i, id1: inputDcmts[i].TID, id2: inputDcmts[i].DID, resultType: ResultTypes.WARNING, description: `Operazione interrotta. Elaborati ${i + 1} documenti` });
|
|
542
|
+
panel.warning();
|
|
521
543
|
break;
|
|
522
544
|
}
|
|
523
545
|
try {
|
|
524
|
-
|
|
546
|
+
if (isBatch)
|
|
547
|
+
panel.setSubtitle(`${SDKUI_Localizator.FileUpload} ${i + 1} di ${inputDcmts.length}`);
|
|
525
548
|
const cacheKey = `${inputDcmts[i].TID}-${inputDcmts[i].DID}`;
|
|
526
549
|
if (dcmtsFileCachePreview.has(cacheKey))
|
|
527
550
|
removeDcmtsFileCache(cacheKey);
|
|
@@ -529,41 +552,30 @@ export const useDcmtOperations = () => {
|
|
|
529
552
|
if (ue) {
|
|
530
553
|
ue.TID = inputDcmts[i].TID;
|
|
531
554
|
ue.DID = inputDcmts[i].DID;
|
|
532
|
-
await ue.SubstituteFileAsync(file, operType, undefined, abortController.signal,
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
setWaitPanelMaxValueSecondary(0);
|
|
542
|
-
setWaitPanelValueSecondary(0);
|
|
543
|
-
setWaitPanelTextSecondary('');
|
|
544
|
-
firstBlock = true;
|
|
545
|
-
}
|
|
546
|
-
});
|
|
555
|
+
await ue.SubstituteFileAsync(file, operType, undefined, abortController.signal,
|
|
556
|
+
// Byte finiti ma il server elabora ancora: la barra si azzera invece di restare al 100%.
|
|
557
|
+
(pd) => pd.ProgressBarValue === pd.ProgressBarMaximum
|
|
558
|
+
? publishBytes(0, 0)
|
|
559
|
+
: publishBytes(pd.ProgressBarValue, pd.ProgressBarMaximum ?? 0));
|
|
560
|
+
}
|
|
561
|
+
if (isBatch) {
|
|
562
|
+
publishBytes(0, 0);
|
|
563
|
+
panel.setValue(i + 1);
|
|
547
564
|
}
|
|
548
|
-
setWaitPanelValuePrimary(i + 1);
|
|
549
565
|
result.push({ rowIndex: i, id1: inputDcmts[i].TID, id2: inputDcmts[i].DID, resultType: ResultTypes.SUCCESS });
|
|
566
|
+
panel.ok();
|
|
550
567
|
}
|
|
551
568
|
catch (ex) {
|
|
552
569
|
result.push({ rowIndex: i, id1: inputDcmts[i].TID, id2: inputDcmts[i].DID, resultType: ResultTypes.ERROR, description: getExceptionMessage(ex) });
|
|
570
|
+
panel.error();
|
|
553
571
|
const err = ex;
|
|
554
572
|
if (err.name === 'CanceledError') {
|
|
555
573
|
ShowAlert({ message: err.message, mode: 'warning', duration: 3000, title: 'Abort' });
|
|
556
574
|
}
|
|
557
575
|
}
|
|
558
576
|
}
|
|
559
|
-
|
|
560
|
-
setWaitPanelMaxValuePrimary(0);
|
|
561
|
-
setWaitPanelValuePrimary(0);
|
|
562
|
-
setWaitPanelTextSecondary('');
|
|
563
|
-
setWaitPanelMaxValueSecondary(0);
|
|
564
|
-
setWaitPanelValueSecondary(0);
|
|
577
|
+
closeWaitPanel(panel);
|
|
565
578
|
actionAfterOperationAsync?.();
|
|
566
|
-
setShowWaitPanel(false);
|
|
567
579
|
TMResultManager.show(result, operationTitle, "TID", "DID");
|
|
568
580
|
};
|
|
569
581
|
const getDcmtFileAsync = async (inputDcmt, rfo, operationTitle, keepWaitPanelPrimary, bypassCache = false) => {
|
|
@@ -574,29 +586,21 @@ export const useDcmtOperations = () => {
|
|
|
574
586
|
const cacheKey = `${inputDcmt.TID}-${inputDcmt.DID}`;
|
|
575
587
|
if (!bypassCache && dcmtsFileCachePreview.has(cacheKey))
|
|
576
588
|
return { file: dcmtsFileCachePreview.get(cacheKey), isFromCache: true };
|
|
577
|
-
setShowWaitPanel(true);
|
|
578
|
-
setShowPrimary(keepWaitPanelPrimary);
|
|
579
|
-
setShowSecondary(true);
|
|
580
|
-
setWaitPanelTitle(operationTitle);
|
|
581
589
|
abortController = new AbortController();
|
|
582
|
-
|
|
583
|
-
|
|
590
|
+
// Un file solo: l'unico avanzamento e' quello in byte e sta sulla barra principale.
|
|
591
|
+
const panel = openWaitPanel({
|
|
592
|
+
title: operationTitle,
|
|
593
|
+
subtitle: extensionHandler(inputDcmt.FILEEXT ?? '') === FileExtensionHandler.CONVERTIBLE ? 'Conversione file in corso...' : 'Recupero file in corso...',
|
|
594
|
+
showCounters: false,
|
|
595
|
+
});
|
|
584
596
|
try {
|
|
585
|
-
setWaitPanelTextSecondary(extensionHandler(inputDcmt.FILEEXT ?? '') === FileExtensionHandler.CONVERTIBLE ? 'Conversione file in corso...' : 'Recupero file in corso...');
|
|
586
597
|
const file = await SDK_Globals.tmSession?.NewSearchEngine().RetrieveFileAsync(inputDcmt?.TID, inputDcmt?.DID, rfo, abortController.signal, (pd) => {
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
setWaitPanelTextSecondary(`Downloading... ${Globalization.getNumberDisplayValue(pd.ProgressBarValue, true)} / ${Globalization.getNumberDisplayValue(maxFileSize, true)}`);
|
|
594
|
-
if (pd.ProgressBarValue === pd.ProgressBarMaximum) {
|
|
595
|
-
setWaitPanelMaxValueSecondary(0);
|
|
596
|
-
setWaitPanelValueSecondary(0);
|
|
597
|
-
setWaitPanelTextSecondary('');
|
|
598
|
-
firstBlock = true;
|
|
599
|
-
}
|
|
598
|
+
const max = pd.ProgressBarMaximum ?? 0;
|
|
599
|
+
panel.update({
|
|
600
|
+
value: pd.ProgressBarValue,
|
|
601
|
+
max,
|
|
602
|
+
subtitle: `Downloading... ${Globalization.getNumberDisplayValue(pd.ProgressBarValue, true)} / ${Globalization.getNumberDisplayValue(max, true)}`,
|
|
603
|
+
});
|
|
600
604
|
});
|
|
601
605
|
if (dcmtsFileCachePreview.size >= CACHE_SIZE_LIMIT) {
|
|
602
606
|
const oldestKey = dcmtsFileCachePreview.keys().next().value;
|
|
@@ -608,10 +612,7 @@ export const useDcmtOperations = () => {
|
|
|
608
612
|
return { file: file, isFromCache: false };
|
|
609
613
|
}
|
|
610
614
|
finally {
|
|
611
|
-
|
|
612
|
-
setWaitPanelMaxValueSecondary(0);
|
|
613
|
-
setWaitPanelValueSecondary(0);
|
|
614
|
-
setShowWaitPanel(false);
|
|
615
|
+
closeWaitPanel(panel);
|
|
615
616
|
}
|
|
616
617
|
};
|
|
617
618
|
const getDisplayValueMetadataValueDescriptor = async (mvd) => {
|
|
@@ -668,19 +669,26 @@ export const useDcmtOperations = () => {
|
|
|
668
669
|
return;
|
|
669
670
|
}
|
|
670
671
|
let zipEntries = [];
|
|
671
|
-
setShowWaitPanel(true);
|
|
672
|
-
setShowPrimary(true);
|
|
673
|
-
setShowSecondary(false);
|
|
674
|
-
setWaitPanelTitle(operationTitle);
|
|
675
672
|
abortController = new AbortController();
|
|
673
|
+
// La copia conforme scarica due file per documento: e' l'unica operazione del ciclo
|
|
674
|
+
// con un avanzamento di dettaglio, e gli serve la seconda barra.
|
|
675
|
+
const isCopyCompliant = dcmtOperationType === DcmtOperationTypes.CopyCompliant;
|
|
676
|
+
const panel = openWaitPanel({
|
|
677
|
+
title: operationTitle,
|
|
678
|
+
max: inputDcmts.length,
|
|
679
|
+
showSecondary: isCopyCompliant,
|
|
680
|
+
primaryLabel: isCopyCompliant ? SDKUI_Localizator.Documents : undefined,
|
|
681
|
+
secondaryLabel: isCopyCompliant ? 'File corrente' : undefined,
|
|
682
|
+
});
|
|
676
683
|
let result = [];
|
|
677
|
-
setWaitPanelMaxValuePrimary(inputDcmts.length);
|
|
678
684
|
for (let i = 0; i < inputDcmts.length; i++) {
|
|
685
|
+
await panel.waitWhilePaused();
|
|
679
686
|
if (abortController.signal.aborted) {
|
|
680
687
|
result.push({ rowIndex: i, id1: inputDcmts[i].TID, id2: inputDcmts[i].DID, resultType: ResultTypes.WARNING, description: `Operazione interrotta. Elaborati ${i + 1} documenti` });
|
|
688
|
+
panel.warning();
|
|
681
689
|
break;
|
|
682
690
|
}
|
|
683
|
-
|
|
691
|
+
panel.setSubtitle(`Documento ${i + 1} di ${inputDcmts.length}`);
|
|
684
692
|
try {
|
|
685
693
|
switch (dcmtOperationType) {
|
|
686
694
|
case DcmtOperationTypes.AddToFavs:
|
|
@@ -790,28 +798,29 @@ export const useDcmtOperations = () => {
|
|
|
790
798
|
}
|
|
791
799
|
}
|
|
792
800
|
result.push({ rowIndex: i, id1: inputDcmts[i].TID, id2: inputDcmts[i].DID, resultType: ResultTypes.SUCCESS });
|
|
801
|
+
panel.ok();
|
|
793
802
|
}
|
|
794
803
|
catch (ex) {
|
|
795
804
|
let msg = getExceptionMessage(ex);
|
|
796
805
|
if (msg.startsWith('WARNING#')) {
|
|
797
806
|
result.push({ rowIndex: i, id1: inputDcmts[i].TID, id2: inputDcmts[i].DID, resultType: ResultTypes.WARNING, description: msg.replace('WARNING#', '') });
|
|
807
|
+
panel.warning();
|
|
798
808
|
}
|
|
799
|
-
else
|
|
809
|
+
else {
|
|
800
810
|
result.push({ rowIndex: i, id1: inputDcmts[i].TID, id2: inputDcmts[i].DID, resultType: ResultTypes.ERROR, description: msg });
|
|
811
|
+
panel.error();
|
|
812
|
+
}
|
|
801
813
|
const err = ex;
|
|
802
814
|
if (err.name === 'CanceledError') {
|
|
803
815
|
ShowAlert({ message: err.message, mode: 'warning', duration: 3000, title: 'Abort' });
|
|
804
816
|
}
|
|
805
817
|
}
|
|
806
|
-
|
|
818
|
+
panel.setValue(i + 1);
|
|
807
819
|
}
|
|
808
820
|
if (zipEntries.length > 0) {
|
|
809
821
|
await zipDocuments(zipEntries, dcmtOperationType, inputDcmts[0].TID);
|
|
810
822
|
}
|
|
811
|
-
|
|
812
|
-
setWaitPanelValuePrimary(0);
|
|
813
|
-
setWaitPanelTextPrimary('');
|
|
814
|
-
setShowWaitPanel(false);
|
|
823
|
+
closeWaitPanel(panel);
|
|
815
824
|
actionAfterOperationAsync?.();
|
|
816
825
|
TMResultManager.show(result, operationTitle, "TID", "DID");
|
|
817
826
|
};
|
|
@@ -824,7 +833,6 @@ export const useDcmtOperations = () => {
|
|
|
824
833
|
}
|
|
825
834
|
};
|
|
826
835
|
return {
|
|
827
|
-
abortController, showWaitPanel, showPrimary, waitPanelTitle, waitPanelTextPrimary, waitPanelValuePrimary, waitPanelMaxValuePrimary, showSecondary, waitPanelTextSecondary, waitPanelValueSecondary, waitPanelMaxValueSecondary,
|
|
828
836
|
downloadDcmtsAsync, getDcmtFileAsync, clearDcmtsFileCache, removeDcmtsFileCache, isDcmtFileInCache, runOperationAsync, FileSourceDialog
|
|
829
837
|
};
|
|
830
838
|
};
|
|
@@ -63,6 +63,7 @@ export interface UIConfigProps {
|
|
|
63
63
|
toppyHelpCenterUsePortal?: boolean;
|
|
64
64
|
inputDcmtFormLayoutMode?: LayoutModes;
|
|
65
65
|
graphometricManager?: IGraphometricManagerProp;
|
|
66
|
+
showSelector?: boolean;
|
|
66
67
|
}
|
|
67
68
|
export interface TasksProps {
|
|
68
69
|
allTasks?: Array<TaskDescriptor>;
|
|
@@ -105,10 +106,13 @@ interface UseDocumentOperationsProps {
|
|
|
105
106
|
}
|
|
106
107
|
export interface UseDocumentOperationsResult {
|
|
107
108
|
operationItems: Array<TMContextMenuItemProps>;
|
|
109
|
+
selectedDcmtInfos: Array<DcmtInfo>;
|
|
108
110
|
renderFloatingBar: React.ReactNode;
|
|
109
111
|
renderDcmtOperations: React.ReactNode;
|
|
110
112
|
features: {
|
|
111
113
|
isOpenDcmtForm: boolean;
|
|
114
|
+
/** Il form del documento è aperto come popup sopra il contenuto, che resta visibile sotto */
|
|
115
|
+
isDcmtFormModal: boolean;
|
|
112
116
|
openFormHandler: (layoutMode: LayoutModes) => void;
|
|
113
117
|
dcmtFormLayoutMode: LayoutModes;
|
|
114
118
|
onDcmtFormOpenChange: (isOpen: boolean, layoutMode: LayoutModes) => void;
|
|
@@ -118,6 +122,7 @@ export interface UseDocumentOperationsResult {
|
|
|
118
122
|
closeDcmtFormHandler: () => void;
|
|
119
123
|
handleSignApprove: () => void;
|
|
120
124
|
showSearchTMDatagrid: boolean;
|
|
125
|
+
showDcmtTypesSelection: boolean;
|
|
121
126
|
showExportForm: boolean;
|
|
122
127
|
checkoutInfo: UseCheckInOutOperationsReturn;
|
|
123
128
|
relatedDocumentsInfo: UseRelatedDocumentsReturn;
|