@topconsultnpm/sdkui-react 6.22.0-dev3.23 → 6.22.0-dev3.25
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/styles.d.ts +45 -43
- package/lib/components/NewComponents/FloatingMenuBar/styles.d.ts +67 -60
- package/lib/components/base/Styled.d.ts +93 -77
- package/lib/components/base/TMAlert.js +6 -8
- package/lib/components/base/TMAreaManager.js +53 -55
- package/lib/components/base/TMCounterBar.d.ts +2 -2
- package/lib/components/base/TMCounterContainer.d.ts +2 -1
- package/lib/components/base/TMCustomButton.d.ts +1 -1
- package/lib/components/base/TMCustomButton.js +39 -48
- package/lib/components/base/TMDataGridExportForm.d.ts +2 -1
- package/lib/components/base/TMFileManager.d.ts +2 -1
- package/lib/components/base/TMFileManagerDataGridView.d.ts +2 -1
- package/lib/components/base/TMFileManagerThumbnailItems.d.ts +1 -1
- package/lib/components/base/TMFileManagerThumbnailsView.d.ts +1 -1
- package/lib/components/base/TMFileManagerUtils.d.ts +4 -6
- package/lib/components/base/TMLayout.d.ts +4 -4
- package/lib/components/base/TMList.d.ts +2 -1
- package/lib/components/base/TMListView.d.ts +1 -1
- package/lib/components/base/TMPanel.js +167 -167
- package/lib/components/base/TMSpinner.d.ts +2 -1
- package/lib/components/base/TMTab.d.ts +4 -3
- package/lib/components/base/TMTabControl.js +208 -208
- package/lib/components/base/TMTooltip.d.ts +1 -1
- package/lib/components/base/TMTreeView.d.ts +14 -8
- package/lib/components/base/TMTreeView.js +14 -0
- package/lib/components/base/TMUserAvatar.d.ts +2 -1
- package/lib/components/base/TMVilViewer.d.ts +2 -1
- package/lib/components/base/TMWaitPanel.d.ts +3 -2
- 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/TMDynDataListItemChooser.d.ts +1 -1
- package/lib/components/choosers/TMInvoiceRetrieveFormats.d.ts +2 -1
- package/lib/components/choosers/TMOrderRetrieveFormats.d.ts +2 -1
- package/lib/components/choosers/TMPathChooser.js +17 -34
- package/lib/components/choosers/TMQuickSearchInfo.d.ts +2 -1
- package/lib/components/choosers/TMRelationChooser.d.ts +3 -3
- package/lib/components/choosers/TMUserChooser.d.ts +2 -2
- package/lib/components/editors/TMEditorStyled.d.ts +20 -42
- package/lib/components/editors/TMFormulaEditor.d.ts +1 -1
- package/lib/components/editors/TMHtmlContentDisplay.d.ts +2 -1
- package/lib/components/editors/TMHtmlEditor.d.ts +2 -1
- package/lib/components/editors/TMTreeDropDown.d.ts +1 -1
- package/lib/components/features/assistant/TMToppyDraggableHelpCenter.d.ts +1 -1
- package/lib/components/features/assistant/TMToppyDraggableHelpCenter.js +2 -2
- package/lib/components/features/blog/TMBlogCommentForm.d.ts +2 -1
- package/lib/components/features/documents/TMBatchUpdateForm.js +3 -4
- package/lib/components/features/documents/TMCopyToFolderForm.js +32 -35
- package/lib/components/features/documents/TMDcmtForm.js +48 -60
- package/lib/components/features/documents/TMDcmtFormActionButtons.d.ts +1 -1
- package/lib/components/features/documents/TMDcmtIcon.d.ts +2 -3
- package/lib/components/features/documents/TMDcmtIcon.js +3 -5
- package/lib/components/features/documents/TMDcmtPreview.d.ts +8 -6
- package/lib/components/features/documents/TMDcmtPreview.js +5 -3
- package/lib/components/features/documents/TMDcmtTasks.d.ts +2 -1
- package/lib/components/features/documents/TMDragDropOverlay.d.ts +1 -1
- package/lib/components/features/documents/TMFileUploader.js +21 -21
- package/lib/components/features/documents/TMMasterDetailDcmts.d.ts +2 -0
- package/lib/components/features/documents/TMMasterDetailDcmts.js +45 -147
- package/lib/components/features/documents/TMMasterInfoFields.d.ts +2 -1
- package/lib/components/features/documents/TMMasterInfoFields.js +3 -2
- package/lib/components/features/documents/TMMergeToPdfForm.d.ts +2 -1
- package/lib/components/features/documents/TMMergeToPdfForm.js +48 -47
- package/lib/components/features/documents/TMMultiMasterDetailDcmtsForm.d.ts +2 -1
- package/lib/components/features/documents/TMMultiMasterDetailDcmtsForm.js +14 -15
- package/lib/components/features/documents/TMMultiMasterDetailDcmtsUtils.d.ts +5 -5
- package/lib/components/features/documents/TMMultiMasterDetailDcmtsUtils.js +3 -3
- package/lib/components/features/documents/TMRelationViewer.d.ts +3 -14
- package/lib/components/features/documents/TMRelationViewer.js +115 -79
- package/lib/components/features/search/TMDcmtCheckoutInfoForm.d.ts +2 -1
- package/lib/components/features/search/TMMetadataOutputForm.d.ts +2 -1
- package/lib/components/features/search/TMMetadataSorterForm.d.ts +2 -1
- package/lib/components/features/search/TMSavedQuerySelector.d.ts +2 -2
- package/lib/components/features/search/TMSearch.d.ts +2 -1
- package/lib/components/features/search/TMSearchQueryPanel.d.ts +9 -3
- package/lib/components/features/search/TMSearchResult.js +6 -8
- package/lib/components/features/search/TMSearchResultFloatingActionButton.d.ts +1 -1
- package/lib/components/features/search/TMSignatureInfoContent.d.ts +2 -1
- package/lib/components/features/search/TMViewHistoryDcmt.d.ts +2 -1
- package/lib/components/features/search/TMViewHistoryDcmt.js +14 -25
- package/lib/components/features/tasks/TMTaskForm.d.ts +1 -1
- package/lib/components/features/tasks/TMTaskFormUtils.d.ts +10 -10
- package/lib/components/features/tasks/TMTasksAgenda.d.ts +1 -1
- package/lib/components/features/tasks/TMTasksCalendar.d.ts +1 -1
- package/lib/components/features/tasks/TMTasksHeader.d.ts +1 -1
- package/lib/components/features/tasks/TMTasksPanelContent.d.ts +1 -1
- package/lib/components/features/tasks/TMTasksUtilsView.d.ts +5 -5
- package/lib/components/features/tasks/TMTasksView.d.ts +1 -1
- package/lib/components/features/tasks/TMTasksView.js +91 -90
- package/lib/components/features/wg/TMWGsCopyMoveForm.d.ts +3 -2
- package/lib/components/features/wg/TMWGsCopyMoveForm.js +91 -91
- package/lib/components/features/workflow/TMWorkflowPopup.d.ts +8 -7
- 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/Chooser.d.ts +2 -2
- package/lib/components/forms/TMChooserForm.d.ts +2 -1
- package/lib/components/forms/TMSaveForm.d.ts +4 -4
- package/lib/components/grids/TMBlogAttachments.d.ts +2 -1
- package/lib/components/grids/TMBlogHeader.d.ts +1 -1
- package/lib/components/grids/TMBlogsPost.d.ts +1 -1
- package/lib/components/grids/TMBlogsPost.js +92 -96
- package/lib/components/grids/TMBlogsPostUtils.d.ts +9 -9
- package/lib/components/grids/TMValidationItemsList.d.ts +2 -1
- package/lib/components/index.d.ts +2 -0
- package/lib/components/index.js +2 -0
- package/lib/components/layout/panelManager/TMPanelManagerContainer.d.ts +2 -1
- package/lib/components/layout/panelManager/TMPanelManagerContext.d.ts +2 -2
- package/lib/components/layout/panelManager/TMPanelManagerToolbar.d.ts +5 -6
- package/lib/components/layout/panelManager/TMPanelManagerWithPersistenceProvider.d.ts +2 -2
- package/lib/components/layout/panelManager/TMPanelWrapper.d.ts +2 -2
- package/lib/components/pages/TMPage.d.ts +1 -1
- package/lib/components/pages/TMPage.js +29 -31
- package/lib/components/query/TMQueryEditor.d.ts +14 -10
- package/lib/components/settings/SettingsAppearance.d.ts +2 -1
- package/lib/components/sidebar/TMAboutApp.d.ts +2 -1
- package/lib/components/sidebar/TMCommandsPanel.d.ts +4 -4
- package/lib/components/sidebar/TMHeader.d.ts +3 -3
- package/lib/components/viewers/TMDataListItemViewer.d.ts +3 -2
- package/lib/components/viewers/TMDataUserIdItemViewer.d.ts +3 -2
- package/lib/components/viewers/TMMidViewer.d.ts +2 -2
- package/lib/components/viewers/TMTidViewer.d.ts +2 -2
- package/lib/helper/SDKUI_Localizator.d.ts +7 -0
- package/lib/helper/SDKUI_Localizator.js +70 -0
- package/lib/helper/TMAppUpdatedModal.d.ts +2 -1
- package/lib/helper/TMAppUpdatedModal.js +93 -93
- package/lib/helper/TMCommandsContextMenu.d.ts +1 -1
- package/lib/helper/TMIcons.d.ts +280 -280
- package/lib/helper/TMPdfViewer.d.ts +2 -1
- package/lib/helper/TMToppyMessage.d.ts +2 -2
- package/lib/helper/TMUtils.d.ts +10 -4
- package/lib/helper/ZipManager.d.ts +1 -1
- package/lib/helper/ZipManager.js +2 -1
- package/lib/helper/dcmtsHelper.d.ts +2 -0
- package/lib/helper/dcmtsHelper.js +3 -1
- package/lib/helper/helpers.d.ts +1 -1
- package/lib/hooks/useCheckInOutOperations.d.ts +0 -6
- package/lib/hooks/useCheckInOutOperations.js +14 -34
- package/lib/hooks/useDcmtOperations.d.ts +3 -12
- package/lib/hooks/useDcmtOperations.js +130 -160
- package/lib/hooks/useDocumentOperations.js +12 -23
- package/lib/hooks/useInputDialog.d.ts +2 -1
- package/lib/hooks/useMultiMasterDetailDcmts.d.ts +0 -15
- package/lib/hooks/useMultiMasterDetailDcmts.js +65 -67
- package/lib/hooks/useWorkflowApprove.js +33 -17
- package/lib/services/platform_services.d.ts +3 -2
- package/package.json +1 -1
|
@@ -2,9 +2,10 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
|
2
2
|
import { AccessLevels, ArchiveConstraints, ArchiveEngineByID, DcmtOpers, GeneralRetrieveFormats, MetadataDataDomains, MetadataDataTypes, RelationCacheService, RelationTypes, ResultTypes, RetrieveFileOptions, SDK_Globals, SystemMIDsAsNumber } from '@topconsultnpm/sdk-ts';
|
|
3
3
|
import { MetadataValueDescriptorEx } from '../ts';
|
|
4
4
|
import { clearMultiDetailLayout, Globalization, getExceptionMessage, getMultiDetailSectionsOpen, handleArchiveVisibility, hasMultiDetailLayout, saveMultiDetailSectionsOpen, SDKUI_Localizator } from '../helper';
|
|
5
|
-
import { getDcmtMetadataByMid, getUserMetadataSorted, mapAssociationsFromMetadata } from '../helper/dcmtsHelper';
|
|
5
|
+
import { canViewMetadata, getDcmtMetadataByMid, getUserMetadataSorted, mapAssociationsFromMetadata } from '../helper/dcmtsHelper';
|
|
6
6
|
import { ButtonNames, TMExceptionBoxManager, TMMessageBoxManager } from '../components/base/TMPopUp';
|
|
7
7
|
import TMSpinner from '../components/base/TMSpinner';
|
|
8
|
+
import { TMWaitPanelManager } from '../components/base/waitPanel';
|
|
8
9
|
import ShowAlert from '../components/base/TMAlert';
|
|
9
10
|
import { TMResultManager } from '../components/forms/TMResultDialog';
|
|
10
11
|
import { useDataListItem } from './useDataListItem';
|
|
@@ -17,18 +18,6 @@ export var MultiDetailArchivePhase;
|
|
|
17
18
|
/** Riepilogo delle archiviazioni */
|
|
18
19
|
MultiDetailArchivePhase[MultiDetailArchivePhase["ArchiveSummary"] = 1] = "ArchiveSummary";
|
|
19
20
|
})(MultiDetailArchivePhase || (MultiDetailArchivePhase = {}));
|
|
20
|
-
const CLOSED_WAIT_PANEL = {
|
|
21
|
-
showWaitPanel: false,
|
|
22
|
-
waitPanelTitle: '',
|
|
23
|
-
showWaitPanelPrimary: false,
|
|
24
|
-
waitPanelTextPrimary: '',
|
|
25
|
-
waitPanelValuePrimary: 0,
|
|
26
|
-
waitPanelMaxValuePrimary: 0,
|
|
27
|
-
showWaitPanelSecondary: false,
|
|
28
|
-
waitPanelTextSecondary: '',
|
|
29
|
-
waitPanelValueSecondary: 0,
|
|
30
|
-
waitPanelMaxValueSecondary: 0,
|
|
31
|
-
};
|
|
32
21
|
/**
|
|
33
22
|
* Logica dell'archiviazione multipla dei dettagli: relazioni, sezioni, righe del riepilogo e
|
|
34
23
|
* archiviazione. Il rendering sta in TMMultiMasterDetailDcmtsForm
|
|
@@ -76,12 +65,11 @@ export const useMultiMasterDetailDcmts = ({ dtd, masterDcmt, onClose, canNavigat
|
|
|
76
65
|
// Archiviazione finale
|
|
77
66
|
const [stopOnFirstError, setStopOnFirstError] = useState(true);
|
|
78
67
|
const [isArchiving, setIsArchiving] = useState(false);
|
|
79
|
-
const [waitPanel, setWaitPanel] = useState(CLOSED_WAIT_PANEL);
|
|
80
|
-
const abortControllerRef = useRef(undefined);
|
|
81
68
|
const selectedItem = detailRelationItems.find(item => item.relation === selectedRelation);
|
|
82
69
|
const hasMultipleTypes = detailRelationItems.length > 1;
|
|
83
70
|
const canUpdateMaster = canUpdateMasterCallback(dtd, masterDcmt);
|
|
84
|
-
|
|
71
|
+
// Stessi metadati delle card del master (vedi TMMasterInfoFields): quelli non visibili non contano
|
|
72
|
+
const masterFieldsCount = useMemo(() => getUserMetadataSorted(dtd).filter(canViewMetadata).length, [dtd]);
|
|
85
73
|
// Nel riepilogo si mostrano solo le righe del tipo selezionato
|
|
86
74
|
const currentRows = useMemo(() => archiveRows.filter(r => r.__tid === selectedRelation?.detailTID), [archiveRows, selectedRelation?.detailTID]);
|
|
87
75
|
const archivedDetailsCount = archivedDetailResults.reduce((total, r) => total + (r.dcmtsFound ?? r.jsonResult?.length ?? 0), 0);
|
|
@@ -619,44 +607,68 @@ export const useMultiMasterDetailDcmts = ({ dtd, masterDcmt, onClose, canNavigat
|
|
|
619
607
|
dataTypeByMid.set(md.id, md.dataType); });
|
|
620
608
|
// Collegamenti della relazione valorizzati dal master (prevalgono sui valori del form)
|
|
621
609
|
const associationMids = await getMasterAssociationsForDetailAsync(selectedRelation);
|
|
622
|
-
//
|
|
623
|
-
const
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
610
|
+
// Con piu' righe: primaria sui documenti, secondaria sui byte. Con una riga sola solo i byte.
|
|
611
|
+
const isBatch = rowsToArchive.length > 1;
|
|
612
|
+
const waitPanel = TMWaitPanelManager.show({
|
|
613
|
+
title: SDKUI_Localizator.Archiving,
|
|
614
|
+
max: isBatch ? rowsToArchive.length : 0,
|
|
615
|
+
cancelable: true,
|
|
616
|
+
showSecondary: isBatch,
|
|
617
|
+
showCounters: isBatch,
|
|
618
|
+
primaryLabel: isBatch ? SDKUI_Localizator.Documents : undefined,
|
|
619
|
+
secondaryLabel: isBatch ? 'File corrente' : undefined,
|
|
632
620
|
});
|
|
621
|
+
const publishBytes = (loaded, total) => {
|
|
622
|
+
const text = total > 0
|
|
623
|
+
? `Uploading... ${Globalization.getNumberDisplayValue(loaded, true)} / ${Globalization.getNumberDisplayValue(total, true)}`
|
|
624
|
+
: '';
|
|
625
|
+
if (isBatch)
|
|
626
|
+
waitPanel.setSecondary({ value: loaded, max: total, text });
|
|
627
|
+
else
|
|
628
|
+
waitPanel.update({ value: loaded, max: total, subtitle: text });
|
|
629
|
+
};
|
|
633
630
|
const result = [];
|
|
634
631
|
const archivedRowIds = new Set();
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
const rowData = rowsToArchive[i];
|
|
641
|
-
try {
|
|
642
|
-
setWaitPanel(prev => ({ ...prev, waitPanelTextPrimary: `${SDKUI_Localizator.Archiving} ${i + 1} / ${rowsToArchive.length}` }));
|
|
643
|
-
const newDID = await archiveRowAsync(rowData, detailTID, dataTypeByMid, associationMids, abortController.signal);
|
|
644
|
-
setWaitPanel(prev => ({ ...prev, waitPanelValuePrimary: i + 1 }));
|
|
645
|
-
archivedRowIds.add(rowData.id);
|
|
646
|
-
result.push({ rowIndex: i, id1: detailTID, id2: newDID, resultType: ResultTypes.SUCCESS });
|
|
647
|
-
}
|
|
648
|
-
catch (error) {
|
|
649
|
-
const err = error;
|
|
650
|
-
// Annullamento richiesto dall'utente: interrompe senza mostrare l'errore
|
|
651
|
-
if (err?.name === 'CanceledError' || abortController.signal.aborted) {
|
|
632
|
+
try {
|
|
633
|
+
for (let i = 0; i < rowsToArchive.length; i++) {
|
|
634
|
+
// Con la conferma di interruzione aperta il loop resta in pausa qui
|
|
635
|
+
await waitPanel.waitWhilePaused();
|
|
636
|
+
if (waitPanel.aborted) {
|
|
652
637
|
result.push({ rowIndex: i, id1: detailTID, id2: undefined, resultType: ResultTypes.WARNING, description: `Operazione interrotta. Elaborati ${i} documenti` });
|
|
638
|
+
waitPanel.warning();
|
|
653
639
|
break;
|
|
654
640
|
}
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
641
|
+
if (isBatch)
|
|
642
|
+
waitPanel.setSubtitle(`${SDKUI_Localizator.Archiving} ${i + 1} / ${rowsToArchive.length}`);
|
|
643
|
+
const rowData = rowsToArchive[i];
|
|
644
|
+
try {
|
|
645
|
+
const newDID = await archiveRowAsync(rowData, detailTID, dataTypeByMid, associationMids, waitPanel.signal, publishBytes);
|
|
646
|
+
archivedRowIds.add(rowData.id);
|
|
647
|
+
result.push({ rowIndex: i, id1: detailTID, id2: newDID, resultType: ResultTypes.SUCCESS });
|
|
648
|
+
waitPanel.ok();
|
|
649
|
+
}
|
|
650
|
+
catch (error) {
|
|
651
|
+
const err = error;
|
|
652
|
+
// Annullamento richiesto dall'utente: interrompe senza mostrare l'errore
|
|
653
|
+
if (err?.name === 'CanceledError' || waitPanel.aborted) {
|
|
654
|
+
result.push({ rowIndex: i, id1: detailTID, id2: undefined, resultType: ResultTypes.WARNING, description: `Operazione interrotta. Elaborati ${i} documenti` });
|
|
655
|
+
waitPanel.warning();
|
|
656
|
+
break;
|
|
657
|
+
}
|
|
658
|
+
result.push({ rowIndex: i, id1: detailTID, id2: undefined, resultType: ResultTypes.ERROR, description: getExceptionMessage(error) });
|
|
659
|
+
waitPanel.error();
|
|
660
|
+
if (stopOnFirstError)
|
|
661
|
+
break;
|
|
662
|
+
}
|
|
663
|
+
// Avanza a elaborazione conclusa: la barra non arriva al 100% prima dell'ultimo documento
|
|
664
|
+
if (isBatch)
|
|
665
|
+
await waitPanel.step();
|
|
658
666
|
}
|
|
659
667
|
}
|
|
668
|
+
finally {
|
|
669
|
+
// Chiuso prima del riepilogo dei risultati
|
|
670
|
+
waitPanel.close();
|
|
671
|
+
}
|
|
660
672
|
// Le righe archiviate escono dal riepilogo
|
|
661
673
|
if (archivedRowIds.size > 0) {
|
|
662
674
|
setArchiveRows(prev => prev.filter(r => !archivedRowIds.has(r.id)));
|
|
@@ -676,13 +688,11 @@ export const useMultiMasterDetailDcmts = ({ dtd, masterDcmt, onClose, canNavigat
|
|
|
676
688
|
TMExceptionBoxManager.show({ exception: error });
|
|
677
689
|
}
|
|
678
690
|
finally {
|
|
679
|
-
abortControllerRef.current = undefined;
|
|
680
|
-
setWaitPanel(CLOSED_WAIT_PANEL);
|
|
681
691
|
setIsArchiving(false);
|
|
682
692
|
}
|
|
683
693
|
};
|
|
684
|
-
// Archiviazione di una singola riga, con avanzamento dell'upload
|
|
685
|
-
const archiveRowAsync = async (row, detailTID, dataTypeByMid, associationMids, signal) => {
|
|
694
|
+
// Archiviazione di una singola riga, con avanzamento dell'upload notificato a onBytes
|
|
695
|
+
const archiveRowAsync = async (row, detailTID, dataTypeByMid, associationMids, signal, onBytes) => {
|
|
686
696
|
const ae = new ArchiveEngineByID(SDK_Globals.tmSession);
|
|
687
697
|
ae.TID = detailTID;
|
|
688
698
|
ae.Metadata_ClearAll();
|
|
@@ -714,23 +724,12 @@ export const useMultiMasterDetailDcmts = ({ dtd, masterDcmt, onClose, canNavigat
|
|
|
714
724
|
});
|
|
715
725
|
if (row.__file)
|
|
716
726
|
ae.ArchivingFile = row.__file;
|
|
717
|
-
let firstBlock = true;
|
|
718
|
-
let maxFileSize = 0;
|
|
719
727
|
return ae.ArchiveAsync(signal, (pd) => {
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
setWaitPanel(prev => ({
|
|
726
|
-
...prev,
|
|
727
|
-
waitPanelValueSecondary: pd.ProgressBarValue,
|
|
728
|
-
waitPanelTextSecondary: `Uploading... ${Globalization.getNumberDisplayValue(pd.ProgressBarValue, true)} / ${Globalization.getNumberDisplayValue(maxFileSize, true)}`,
|
|
729
|
-
}));
|
|
730
|
-
if (pd.ProgressBarValue === pd.ProgressBarMaximum) {
|
|
731
|
-
setWaitPanel(prev => ({ ...prev, waitPanelValueSecondary: 0, waitPanelMaxValueSecondary: 0, waitPanelTextSecondary: '' }));
|
|
732
|
-
firstBlock = true;
|
|
733
|
-
}
|
|
728
|
+
// Upload completato: la barra si azzera per il file successivo
|
|
729
|
+
if (pd.ProgressBarValue === pd.ProgressBarMaximum)
|
|
730
|
+
onBytes(0, 0);
|
|
731
|
+
else
|
|
732
|
+
onBytes(pd.ProgressBarValue ?? 0, pd.ProgressBarMaximum ?? 0);
|
|
734
733
|
});
|
|
735
734
|
};
|
|
736
735
|
return {
|
|
@@ -755,6 +754,5 @@ export const useMultiMasterDetailDcmts = ({ dtd, masterDcmt, onClose, canNavigat
|
|
|
755
754
|
openAddForm, openEditForm, closeAddForm, deleteRow, duplicateRow, upsertRow, updateRowValues, copyArchivedDetailToRows,
|
|
756
755
|
// Archiviazione
|
|
757
756
|
stopOnFirstError, setStopOnFirstError, isArchiving, archiveAllAsync,
|
|
758
|
-
waitPanel, abortController: abortControllerRef.current,
|
|
759
757
|
};
|
|
760
758
|
};
|
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
import { useState, useEffect, useCallback } from 'react';
|
|
2
2
|
import { SDK_Globals } from '@topconsultnpm/sdk-ts';
|
|
3
|
+
const WORKFLOW_APPROVE_CHANGED_EVENT = 'onWorkflowApproveChange';
|
|
4
|
+
/** Totale dei documenti da approvare: somma dei dcmtsFound delle singole categorie. */
|
|
5
|
+
const calcTotalDcmtsFound = (data) => {
|
|
6
|
+
return data.reduce((sum, item) => sum + (item.dcmtsFound || 0), 0);
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Fetch in corso.
|
|
10
|
+
*
|
|
11
|
+
* La WFAppr non porta un contatore ma l'intera lista di approvazione con le righe
|
|
12
|
+
* dei documenti, ed è chiesta da più istanze del hook a ridosso l'una dell'altra
|
|
13
|
+
* (coda del login, pagina di approvazione, widget della home). Chi arriva mentre
|
|
14
|
+
* è già in volo aspetta la stessa risposta invece di aprire una seconda richiesta.
|
|
15
|
+
*/
|
|
16
|
+
let inFlight;
|
|
17
|
+
/** Ricarica i dati e notifica tutte le istanze del hook. */
|
|
18
|
+
const load = async () => {
|
|
19
|
+
const result = await SDK_Globals.tmSession?.NewWorkflowEngine().WFApprAsync(1);
|
|
20
|
+
SDK_Globals.currentWorkflowApproveData = result ?? [];
|
|
21
|
+
window.dispatchEvent(new CustomEvent(WORKFLOW_APPROVE_CHANGED_EVENT));
|
|
22
|
+
};
|
|
3
23
|
/**
|
|
4
24
|
* Hook per gestire i dati di approvazione del workflow.
|
|
5
25
|
* Fornisce il dataSource, lo stato di caricamento e una funzione per aggiornare i dati.
|
|
@@ -7,13 +27,10 @@ import { SDK_Globals } from '@topconsultnpm/sdk-ts';
|
|
|
7
27
|
export const useWorkflowApprove = () => {
|
|
8
28
|
const [workflowApproveData, setWorkflowApproveData] = useState(SDK_Globals.currentWorkflowApproveData);
|
|
9
29
|
const [isLoading, setIsLoading] = useState(false);
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const calculateTotalDcmtsFound = useCallback((data) => {
|
|
15
|
-
return data.reduce((sum, item) => sum + (item.dcmtsFound || 0), 0);
|
|
16
|
-
}, []);
|
|
30
|
+
// Seminato dai dati già in cache: un'istanza montata a login concluso parte dal
|
|
31
|
+
// totale reale e non da zero, altrimenti chi confronta questo valore con il
|
|
32
|
+
// contatore della home vede una differenza inesistente e ricarica a vuoto.
|
|
33
|
+
const [totalDcmtsFound, setTotalDcmtsFound] = useState(() => calcTotalDcmtsFound(SDK_Globals.currentWorkflowApproveData));
|
|
17
34
|
/**
|
|
18
35
|
* Ottiene tutti i work items che corrispondono a un determinato DID.
|
|
19
36
|
* Restituisce un array di oggetti { tid, did }.
|
|
@@ -40,12 +57,10 @@ export const useWorkflowApprove = () => {
|
|
|
40
57
|
}
|
|
41
58
|
setIsLoading(true);
|
|
42
59
|
try {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
// Notifica tutte le istanze del hook che i dati sono cambiati.
|
|
48
|
-
window.dispatchEvent(new CustomEvent('onWorkflowApproveChange'));
|
|
60
|
+
if (!inFlight) {
|
|
61
|
+
inFlight = load().finally(() => { inFlight = undefined; });
|
|
62
|
+
}
|
|
63
|
+
await inFlight;
|
|
49
64
|
}
|
|
50
65
|
catch (error) {
|
|
51
66
|
console.error("Errore durante il fetch dei dati di approvazione workflow:", error);
|
|
@@ -53,18 +68,19 @@ export const useWorkflowApprove = () => {
|
|
|
53
68
|
finally {
|
|
54
69
|
setIsLoading(false);
|
|
55
70
|
}
|
|
56
|
-
}, [
|
|
71
|
+
}, []);
|
|
57
72
|
// Questo useEffect serve a sincronizzare lo stato tra diverse istanze del hook.
|
|
58
73
|
// Se il componente A chiama refreshWorkflowApprove, il componente B (che usa lo stesso hook)
|
|
59
74
|
// riceverà l'evento e aggiornerà il suo stato locale.
|
|
60
75
|
useEffect(() => {
|
|
61
76
|
const handleUpdate = () => {
|
|
62
77
|
setWorkflowApproveData(SDK_Globals.currentWorkflowApproveData);
|
|
78
|
+
setTotalDcmtsFound(calcTotalDcmtsFound(SDK_Globals.currentWorkflowApproveData));
|
|
63
79
|
};
|
|
64
|
-
window.addEventListener(
|
|
80
|
+
window.addEventListener(WORKFLOW_APPROVE_CHANGED_EVENT, handleUpdate);
|
|
65
81
|
return () => {
|
|
66
|
-
window.removeEventListener(
|
|
82
|
+
window.removeEventListener(WORKFLOW_APPROVE_CHANGED_EVENT, handleUpdate);
|
|
67
83
|
};
|
|
68
|
-
}, [
|
|
84
|
+
}, []);
|
|
69
85
|
return { workflowApproveData, isLoading, refreshWorkflowApprove, totalDcmtsFound, getWorkItemsByDID };
|
|
70
86
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import { JobTypes, ObjectClasses, ProcessDescriptor, DcmtTypeDescriptor } from "@topconsultnpm/sdk-ts";
|
|
2
3
|
export declare class PlatformObjectService {
|
|
3
4
|
static readonly retrieveAllAsync: (objClass: ObjectClasses, refreshCache?: boolean) => Promise<import("@topconsultnpm/sdk-ts").AreaDescriptor[] | import("@topconsultnpm/sdk-ts").NotificationDescriptor[] | import("@topconsultnpm/sdk-ts").RelationDescriptor[] | import("@topconsultnpm/sdk-ts").TaskDescriptor[] | import("@topconsultnpm/sdk-ts").WorkingGroupDescriptor[] | undefined>;
|
|
@@ -13,6 +14,6 @@ export declare class PlatformObjectService {
|
|
|
13
14
|
static readonly createAsync: (objClass: ObjectClasses, jobType: JobTypes, d: any) => Promise<number | undefined>;
|
|
14
15
|
static readonly deleteAsync: (objClass: ObjectClasses, id: number) => Promise<number | undefined>;
|
|
15
16
|
static readonly getName: (objClass: ObjectClasses, jobType?: JobTypes, isPlural?: boolean) => string;
|
|
16
|
-
static readonly getIcon: (objClass: ObjectClasses, d: any) =>
|
|
17
|
-
static readonly getTooltip: (objClass: ObjectClasses, d: any) =>
|
|
17
|
+
static readonly getIcon: (objClass: ObjectClasses, d: any) => React.JSX.Element;
|
|
18
|
+
static readonly getTooltip: (objClass: ObjectClasses, d: any) => React.JSX.Element | null;
|
|
18
19
|
}
|