@topconsultnpm/sdkui-react 6.21.0-dev2.9 → 6.21.0-dev3.2
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/base/TMAccordionNew.js +1 -0
- package/lib/components/base/TMAreaManager.js +19 -3
- package/lib/components/base/TMDataGrid.js +2 -2
- package/lib/components/base/TMModal.d.ts +1 -0
- package/lib/components/base/TMModal.js +2 -2
- package/lib/components/base/TMPanel.d.ts +7 -4
- package/lib/components/base/TMPanel.js +58 -26
- package/lib/components/base/TMTreeView.js +12 -2
- package/lib/components/base/TMWaitPanel.d.ts +3 -1
- package/lib/components/base/TMWaitPanel.js +14 -9
- package/lib/components/choosers/TMDistinctValues.js +35 -21
- package/lib/components/choosers/TMUserChooser.d.ts +4 -0
- package/lib/components/choosers/TMUserChooser.js +7 -5
- package/lib/components/editors/TMFormulaEditor.d.ts +2 -0
- package/lib/components/editors/TMFormulaEditor.js +75 -21
- package/lib/components/editors/TMMetadataValues.js +2 -1
- package/lib/components/editors/TMRadioButton.js +7 -5
- package/lib/components/editors/TMTextBox.d.ts +2 -0
- package/lib/components/editors/TMTextBox.js +3 -3
- package/lib/components/features/archive/TMArchive.js +1 -1
- package/lib/components/features/documents/TMCopyToFolderForm.d.ts +24 -0
- package/lib/components/features/documents/TMCopyToFolderForm.js +401 -0
- package/lib/components/features/documents/TMDcmtForm.d.ts +1 -0
- package/lib/components/features/documents/TMDcmtForm.js +126 -38
- package/lib/components/features/documents/TMDcmtPreview.d.ts +1 -0
- package/lib/components/features/documents/TMDcmtPreview.js +2 -2
- package/lib/components/features/documents/TMDcmtTasks.d.ts +1 -0
- package/lib/components/features/documents/TMDcmtTasks.js +2 -2
- package/lib/components/features/documents/TMDownloadRelationViewerSection.d.ts +23 -0
- package/lib/components/features/documents/TMDownloadRelationViewerSection.js +173 -0
- package/lib/components/features/documents/TMFileUploader.js +1 -1
- package/lib/components/features/documents/TMMasterDetailDcmts.d.ts +2 -0
- package/lib/components/features/documents/TMMasterDetailDcmts.js +28 -9
- package/lib/components/features/documents/TMMergeToPdfForm.d.ts +24 -0
- package/lib/components/features/documents/TMMergeToPdfForm.js +309 -0
- package/lib/components/features/documents/TMRelationViewer.d.ts +13 -0
- package/lib/components/features/documents/TMRelationViewer.js +75 -6
- package/lib/components/features/documents/copyAndMergeDcmtsShared.d.ts +71 -0
- package/lib/components/features/documents/copyAndMergeDcmtsShared.js +304 -0
- package/lib/components/features/search/SignatureParamsManager.d.ts +70 -0
- package/lib/components/features/search/SignatureParamsManager.js +145 -0
- package/lib/components/features/search/TMSavedQuerySelector.d.ts +2 -2
- package/lib/components/features/search/TMSavedQuerySelector.js +3 -2
- package/lib/components/features/search/TMSearch.d.ts +4 -1
- package/lib/components/features/search/TMSearch.js +16 -10
- package/lib/components/features/search/TMSearchQueryPanel.js +1 -1
- package/lib/components/features/search/TMSearchResult.d.ts +2 -0
- package/lib/components/features/search/TMSearchResult.js +117 -22
- package/lib/components/features/workflow/diagram/queryDescriptorParser.js +3 -6
- package/lib/components/forms/Login/TMLoginForm.d.ts +9 -0
- package/lib/components/forms/Login/TMLoginForm.js +61 -0
- package/lib/components/forms/TMResultDialog.d.ts +1 -1
- package/lib/components/forms/TMResultDialog.js +4 -2
- package/lib/components/index.d.ts +1 -0
- package/lib/components/index.js +1 -0
- package/lib/components/pages/TMPage.js +3 -1
- package/lib/components/query/TMQueryEditor.js +1 -1
- package/lib/components/viewers/TMTidViewer.js +1 -1
- package/lib/helper/MergePdfManager.d.ts +45 -0
- package/lib/helper/MergePdfManager.js +145 -0
- package/lib/helper/SDKUI_Globals.d.ts +15 -0
- package/lib/helper/SDKUI_Globals.js +15 -1
- package/lib/helper/SDKUI_Localizator.d.ts +107 -2
- package/lib/helper/SDKUI_Localizator.js +1070 -12
- package/lib/helper/TMPdfViewer.js +25 -24
- package/lib/helper/TMUtils.d.ts +1 -0
- package/lib/helper/TMUtils.js +17 -0
- package/lib/helper/ZipManager.d.ts +56 -0
- package/lib/helper/ZipManager.js +127 -0
- package/lib/helper/index.d.ts +1 -0
- package/lib/helper/index.js +1 -0
- package/lib/hooks/useDataUserIdItem.js +6 -4
- package/lib/hooks/useDcmtOperations.d.ts +9 -2
- package/lib/hooks/useDcmtOperations.js +77 -34
- package/lib/hooks/useDocumentOperations.d.ts +3 -0
- package/lib/hooks/useDocumentOperations.js +233 -24
- package/lib/hooks/useForm.js +5 -2
- package/lib/hooks/useResizeObserver.d.ts +1 -1
- package/lib/hooks/useResizeObserver.js +16 -15
- package/package.json +4 -2
|
@@ -57,7 +57,7 @@ export var InvocationContext;
|
|
|
57
57
|
let abortControllerLocal = new AbortController();
|
|
58
58
|
;
|
|
59
59
|
//#endregion
|
|
60
|
-
const TMDcmtForm = ({ TID, DID, groupId, layoutMode = LayoutModes.Update, formMode = FormModes.Update, invocationContext = InvocationContext.Default, showHeader = true, showBackButton = true, showDcmtFormSidebar = true, isClosable = false, isExpertMode = SDKUI_Globals.userSettings.advancedSettings.expertMode === 1, isModal = false, titleModal, widthModal = "100%", heightModal = "100%", allowNavigation = true, canNext, canPrev, count, itemIndex, onNext, onPrev, inputFile = null, inputMids = [], connectorFileSave = undefined, isSharedDcmt = false, sharedSourceTID, sharedSourceDID, allowRelations = true, allowButtonsRefs = false, openS4TViewer = false, enableDragDropOverlay = false, onClose, onSavedAsyncCallback, onSaveRecents, onWFOperationCompleted, allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, onTaskCompleted, onTaskCreateRequest, moreInfoTasks, taskFormDialogComponent, handleNavigateToWGs, handleNavigateToDossiers, onReferenceClick, onOpenS4TViewerRequest, onOpenPdfEditorRequest, openFileUploaderPdfEditor, s4TViewerDialogComponent, onScanRequest, passToSearch, datagridUtility }) => {
|
|
60
|
+
const TMDcmtForm = ({ TID, DID, groupId, layoutMode = LayoutModes.Update, formMode = FormModes.Update, invocationContext = InvocationContext.Default, showHeader = true, showBackButton = true, showDcmtFormSidebar = true, isClosable = false, showTodoDcmtForm = false, isExpertMode = SDKUI_Globals.userSettings.advancedSettings.expertMode === 1, isModal = false, titleModal, widthModal = "100%", heightModal = "100%", allowNavigation = true, canNext, canPrev, count, itemIndex, onNext, onPrev, inputFile = null, inputMids = [], connectorFileSave = undefined, isSharedDcmt = false, sharedSourceTID, sharedSourceDID, allowRelations = true, allowButtonsRefs = false, openS4TViewer = false, enableDragDropOverlay = false, onClose, onSavedAsyncCallback, onSaveRecents, onWFOperationCompleted, allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, onTaskCompleted, onTaskCreateRequest, moreInfoTasks, taskFormDialogComponent, handleNavigateToWGs, handleNavigateToDossiers, onReferenceClick, onOpenS4TViewerRequest, onOpenPdfEditorRequest, openFileUploaderPdfEditor, s4TViewerDialogComponent, onScanRequest, passToSearch, datagridUtility }) => {
|
|
61
61
|
const { onRefreshSearchAsyncDatagrid, onRefreshBlogDatagrid, onRefreshPreviewDatagrid } = datagridUtility || {};
|
|
62
62
|
const floatingBarContainerRef = useRef(null);
|
|
63
63
|
const [id, setID] = useState('');
|
|
@@ -91,6 +91,7 @@ const TMDcmtForm = ({ TID, DID, groupId, layoutMode = LayoutModes.Update, formMo
|
|
|
91
91
|
const formDataRef = useRef([]);
|
|
92
92
|
const fromDTDRef = useRef();
|
|
93
93
|
const dcmtFileRef = useRef(null);
|
|
94
|
+
const metadataDcmtOriginRef = useRef(null);
|
|
94
95
|
const [isOpenDistinctValues, setIsOpenDistinctValues] = useState(false);
|
|
95
96
|
const [isOpenFormulaEditor, setIsOpenFormulaEditor] = useState(false);
|
|
96
97
|
const [currentTIDHasDetailRelations, setCurrentTIDHasDetailRelations] = useState();
|
|
@@ -135,7 +136,30 @@ const TMDcmtForm = ({ TID, DID, groupId, layoutMode = LayoutModes.Update, formMo
|
|
|
135
136
|
if (!did)
|
|
136
137
|
return;
|
|
137
138
|
TMSpinner.show({ description: 'Loading Metadata...' });
|
|
138
|
-
let res = getMetadataResult
|
|
139
|
+
let res = getMetadataResult;
|
|
140
|
+
if (!res) {
|
|
141
|
+
try {
|
|
142
|
+
res = await SDK_Globals.tmSession?.NewSearchEngine().GetMetadataAsync(TID, did, true);
|
|
143
|
+
}
|
|
144
|
+
catch (metadataError) {
|
|
145
|
+
// Estrai ErrorCode dal campo detail se disponibile
|
|
146
|
+
let errorCode = undefined;
|
|
147
|
+
if (metadataError?.isApiException && metadataError?.response?.detail) {
|
|
148
|
+
try {
|
|
149
|
+
const detailObj = JSON.parse(metadataError.response.detail);
|
|
150
|
+
errorCode = detailObj?.ErrorCode;
|
|
151
|
+
}
|
|
152
|
+
catch (parseError) {
|
|
153
|
+
console.log("Impossibile parsare il detail dell'eccezione:", parseError);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
// Se ErrorCode è -5, ignora silenziosamente, altrimenti mostra l'eccezione originale
|
|
157
|
+
if (errorCode !== -5) {
|
|
158
|
+
TMExceptionBoxManager.show({ exception: metadataError });
|
|
159
|
+
}
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
139
163
|
const origin = { fromName: res?.fromName, fromTID: res?.fromTID };
|
|
140
164
|
let dtd = res?.dtdResult;
|
|
141
165
|
let rows = dtd.rows ? dtd.rows[0] : [];
|
|
@@ -307,7 +331,7 @@ const TMDcmtForm = ({ TID, DID, groupId, layoutMode = LayoutModes.Update, formMo
|
|
|
307
331
|
}
|
|
308
332
|
else {
|
|
309
333
|
const renderedMetadata = dtd?.metadata?.filter((metadata) => handleArchiveVisibility(metadata)) ?? [];
|
|
310
|
-
const metadataList = searchResultToMetadataValues(dtd?.id, undefined, [], [], renderedMetadata, layoutMode, isReadOnlyOriginCallback(
|
|
334
|
+
const metadataList = searchResultToMetadataValues(dtd?.id, undefined, [], [], renderedMetadata, layoutMode, isReadOnlyOriginCallback(metadataDcmtOriginRef.current?.fromTID));
|
|
311
335
|
setFormDataOrig(structuredClone(metadataList));
|
|
312
336
|
setFormData(structuredClone(metadataList));
|
|
313
337
|
formDataOrigRef.current = structuredClone(metadataList);
|
|
@@ -322,7 +346,7 @@ const TMDcmtForm = ({ TID, DID, groupId, layoutMode = LayoutModes.Update, formMo
|
|
|
322
346
|
setIsInitialLoading(false);
|
|
323
347
|
setIsNavigating(false);
|
|
324
348
|
}
|
|
325
|
-
}, [TID, DID, layoutMode, inputFile, setMetadataList, handleReset, allowButtonsRefs, isReadOnlyOriginCallback
|
|
349
|
+
}, [TID, DID, layoutMode, inputFile, setMetadataList, handleReset, allowButtonsRefs, isReadOnlyOriginCallback]);
|
|
326
350
|
const currentSearchResults = useMemo(() => {
|
|
327
351
|
if (!formData || formData.length === 0 || !TID || !DID)
|
|
328
352
|
return [];
|
|
@@ -477,6 +501,9 @@ const TMDcmtForm = ({ TID, DID, groupId, layoutMode = LayoutModes.Update, formMo
|
|
|
477
501
|
useEffect(() => {
|
|
478
502
|
dcmtFileRef.current = dcmtFile;
|
|
479
503
|
}, [dcmtFile]);
|
|
504
|
+
useEffect(() => {
|
|
505
|
+
metadataDcmtOriginRef.current = metadataDcmtOrigin;
|
|
506
|
+
}, [metadataDcmtOrigin]);
|
|
480
507
|
useEffect(() => {
|
|
481
508
|
if (!inputFile || inputFile === null)
|
|
482
509
|
return;
|
|
@@ -775,7 +802,7 @@ const TMDcmtForm = ({ TID, DID, groupId, layoutMode = LayoutModes.Update, formMo
|
|
|
775
802
|
// Verifica che ci siano riferimenti renderizzabili (solo Dossier o WorkingGroup)
|
|
776
803
|
return dcmtReferences.some(ref => ref.objClass === ObjectClasses.Dossier || ref.objClass === ObjectClasses.WorkingGroup);
|
|
777
804
|
}, [allowButtonsRefs, layoutMode, dcmtReferences, isOpenDetails, isOpenMaster]);
|
|
778
|
-
const isToppyVisible = useMemo(() => Boolean((showToppyForApprove || showToppyForCompleteMoreInfo || showToppyForReferences) && !openS4TViewer), [showToppyForApprove, showToppyForCompleteMoreInfo, showToppyForReferences, openS4TViewer]);
|
|
805
|
+
const isToppyVisible = useMemo(() => Boolean((showToppyForApprove || showToppyForCompleteMoreInfo || showToppyForReferences) && !openS4TViewer && !showTodoDcmtForm), [showToppyForApprove, showToppyForCompleteMoreInfo, showToppyForReferences, openS4TViewer, showTodoDcmtForm]);
|
|
779
806
|
const isModified = useMemo(() => calcIsModified(formData, formDataOrig), [formData, formDataOrig]);
|
|
780
807
|
const formToolbar = useMemo(() => _jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: '10px' }, children: [allowNavigation && canPrev != undefined && _jsx("p", { style: { textAlign: 'center', padding: '1px 4px', display: 'flex' }, children: `${itemIndex}/${count}` }), allowNavigation && canPrev != undefined && _jsx(TMSaveFormButtonPrevious, { btnStyle: 'icon', iconColor: 'white', isModified: isModified, formMode: formMode, canPrev: canPrev, onPrev: onPrev }), allowNavigation && canNext != undefined && _jsx(TMSaveFormButtonNext, { btnStyle: 'icon', iconColor: 'white', isModified: isModified, formMode: formMode, canNext: canNext, onNext: onNext }), layoutMode === LayoutModes.Update &&
|
|
781
808
|
_jsx(ContextMenu, { items: operationItems, trigger: "left", children: _jsx(IconMenuVertical, { color: 'white', cursor: 'pointer' }) }), layoutMode === LayoutModes.Ark &&
|
|
@@ -844,7 +871,7 @@ const TMDcmtForm = ({ TID, DID, groupId, layoutMode = LayoutModes.Update, formMo
|
|
|
844
871
|
const handleArchiveCompleted = useCallback(async () => {
|
|
845
872
|
let firstBlock = true;
|
|
846
873
|
let maxFileSize = 0;
|
|
847
|
-
let operationTitle =
|
|
874
|
+
let operationTitle = SDKUI_Localizator.Archiving;
|
|
848
875
|
setUseWaitPanelLocalState(true);
|
|
849
876
|
setShowWaitPanelLocal(true);
|
|
850
877
|
setShowPrimaryLocal(false);
|
|
@@ -893,11 +920,16 @@ const TMDcmtForm = ({ TID, DID, groupId, layoutMode = LayoutModes.Update, formMo
|
|
|
893
920
|
firstBlock = false;
|
|
894
921
|
}
|
|
895
922
|
setWaitPanelValueSecondaryLocal(pd.ProgressBarValue);
|
|
896
|
-
setWaitPanelTextSecondaryLocal(
|
|
923
|
+
setWaitPanelTextSecondaryLocal(`${SDKUI_Localizator.Archiving}... ${Globalization.getNumberDisplayValue(pd.ProgressBarValue, true)} / ${Globalization.getNumberDisplayValue(maxFileSize, true)}`);
|
|
897
924
|
if (pd.ProgressBarValue === pd.ProgressBarMaximum) {
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
925
|
+
// Cambia subito il titolo alla fase 2 quando l'upload termina
|
|
926
|
+
// e mostra la progress bar primaria con valore iniziale 20%
|
|
927
|
+
setWaitPanelTitleLocal(SDKUI_Localizator.ArchivingCompletionInProgress);
|
|
928
|
+
setShowSecondaryLocal(false);
|
|
929
|
+
setShowPrimaryLocal(true);
|
|
930
|
+
setWaitPanelMaxValuePrimaryLocal(3);
|
|
931
|
+
setWaitPanelValuePrimaryLocal(0.6); // 20% di 3
|
|
932
|
+
setWaitPanelTextPrimaryLocal(SDKUI_Localizator.ArchivingCompletionInProgress);
|
|
901
933
|
firstBlock = true;
|
|
902
934
|
}
|
|
903
935
|
});
|
|
@@ -906,11 +938,22 @@ const TMDcmtForm = ({ TID, DID, groupId, layoutMode = LayoutModes.Update, formMo
|
|
|
906
938
|
const savedFormData = structuredClone(formDataRef.current);
|
|
907
939
|
setFormDataOrig(savedFormData);
|
|
908
940
|
formDataOrigRef.current = savedFormData;
|
|
941
|
+
// Fase 2: Completamento archiviazione (la progress bar primaria è già visibile dal callback)
|
|
942
|
+
// Imposta il titolo anche qui per sicurezza, nel caso il callback non venga eseguito
|
|
943
|
+
setWaitPanelTitleLocal(SDKUI_Localizator.ArchivingCompletionInProgress);
|
|
944
|
+
// Step 1/3: Aggiornamento griglia di ricerca
|
|
945
|
+
setWaitPanelValuePrimaryLocal(1);
|
|
909
946
|
await onRefreshSearchAsyncDatagrid?.();
|
|
947
|
+
// Step 2/3: Callback di salvataggio
|
|
948
|
+
setWaitPanelValuePrimaryLocal(2);
|
|
910
949
|
await onSavedAsyncCallback?.(ae.TID, newDID);
|
|
950
|
+
// Step 3/3: Aggiornamento lista metadati
|
|
951
|
+
setWaitPanelValuePrimaryLocal(3);
|
|
911
952
|
// Usa fromDTDRef.current invece di fromDTD per evitare stale closure,
|
|
912
953
|
// garantendo di avere il descrittore del tipo documento corrente.
|
|
913
954
|
await setMetadataList(fromDTDRef.current?.metadata ?? [], undefined, true, newDID);
|
|
955
|
+
// Breve pausa per mostrare il completamento al 100%
|
|
956
|
+
await new Promise(resolve => setTimeout(resolve, 200));
|
|
914
957
|
handleReset();
|
|
915
958
|
let newMruTIDS = updateMruTids(SDKUI_Globals.userSettings.archivingSettings.mruTIDs, TID);
|
|
916
959
|
SDKUI_Globals.userSettings.archivingSettings.mruTIDs = newMruTIDS;
|
|
@@ -924,12 +967,6 @@ const TMDcmtForm = ({ TID, DID, groupId, layoutMode = LayoutModes.Update, formMo
|
|
|
924
967
|
TMExceptionBoxManager.show({ exception: err });
|
|
925
968
|
}
|
|
926
969
|
finally {
|
|
927
|
-
setWaitPanelTextPrimaryLocal('');
|
|
928
|
-
setWaitPanelMaxValuePrimaryLocal(0);
|
|
929
|
-
setWaitPanelValuePrimaryLocal(0);
|
|
930
|
-
setWaitPanelTextSecondaryLocal('');
|
|
931
|
-
setWaitPanelMaxValueSecondaryLocal(0);
|
|
932
|
-
setWaitPanelValueSecondaryLocal(0);
|
|
933
970
|
setShowWaitPanelLocal(false);
|
|
934
971
|
setUseWaitPanelLocalState(false);
|
|
935
972
|
}
|
|
@@ -1016,6 +1053,21 @@ const TMDcmtForm = ({ TID, DID, groupId, layoutMode = LayoutModes.Update, formMo
|
|
|
1016
1053
|
fd.tid = TID;
|
|
1017
1054
|
return fd;
|
|
1018
1055
|
}, [focusedMetadataValue?.value, focusedMetadataValue?.mid, TID]);
|
|
1056
|
+
/**
|
|
1057
|
+
* Restituisce l'handler onBack per i pannelli, evitando duplicazione di codice.
|
|
1058
|
+
* @param isMainPanel - Se true, è il pannello principale (tmDcmtForm)
|
|
1059
|
+
*/
|
|
1060
|
+
const getOnBackHandler = (isMainPanel = false) => {
|
|
1061
|
+
// Se showBackButton è false, non mostrare mai il back
|
|
1062
|
+
if (showBackButton === false)
|
|
1063
|
+
return undefined;
|
|
1064
|
+
// Mobile: mostra back su tutti i pannelli (se showBackButton è definito e non è closable)
|
|
1065
|
+
if (isMobile) {
|
|
1066
|
+
return (showBackButton !== undefined && !isClosable) ? handleClose : undefined;
|
|
1067
|
+
}
|
|
1068
|
+
// Desktop: mostra back solo sul pannello principale (se showBackButton è definito e non è closable)
|
|
1069
|
+
return (showBackButton !== undefined && isMainPanel && !isClosable) ? handleClose : undefined;
|
|
1070
|
+
};
|
|
1019
1071
|
// Determina se showAll deve essere automaticamente true
|
|
1020
1072
|
// Best practice: usa useMemo per calcolare valori derivati invece di useEffect con setState
|
|
1021
1073
|
const shouldShowAll = useMemo(() => {
|
|
@@ -1100,7 +1152,7 @@ const TMDcmtForm = ({ TID, DID, groupId, layoutMode = LayoutModes.Update, formMo
|
|
|
1100
1152
|
]);
|
|
1101
1153
|
const tmBlog = useMemo(() => _jsx(TMDcmtBlog, { tid: TID, did: DID, fetchBlogDataTrigger: refreshBlogTrigger, onRefreshBlogDatagrid: onRefreshBlogDatagrid, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }), [TID, DID, allTasks, refreshBlogTrigger, handleNavigateToWGs, handleNavigateToDossiers]);
|
|
1102
1154
|
const tmSysMetadata = useMemo(() => _jsx(TMMetadataValues, { layoutMode: layoutMode, openChooserBySingleClick: !isOpenDistinctValues, TID: TID, isReadOnly: true, deviceType: deviceType, metadataValues: formData.filter(o => (o.mid != undefined && o.mid <= 100)), metadataValuesOrig: formData.filter(o => (o.mid != undefined && o.mid <= 100)), validationItems: [], inputMids: inputMids }), [TID, layoutMode, formData, deviceType, inputMids]);
|
|
1103
|
-
const tmDcmtPreview = useMemo(() => _jsx(TMDcmtPreviewWrapper, { refreshPreviewTrigger: refreshPreviewTrigger, fromDTD: fromDTD, currentDcmt: currentDcmt, dcmtFile: dcmtFile ?? inputFile, deviceType: deviceType, layoutMode: layoutMode, onFileUpload: (file) => { setDcmtFile(file); }, openFileUploaderPdfEditor: openFileUploaderPdfEditor, enableDragDropOverlay: enableDragDropOverlay, onScanRequest: onScanRequest }), [currentDcmt, dcmtFile, deviceType, fromDTD, layoutMode, inputFile, enableDragDropOverlay, setDcmtFile, onScanRequest, openFileUploaderPdfEditor, refreshPreviewTrigger]);
|
|
1155
|
+
const tmDcmtPreview = useMemo(() => _jsx(TMDcmtPreviewWrapper, { refreshPreviewTrigger: refreshPreviewTrigger, fromDTD: fromDTD, currentDcmt: currentDcmt, dcmtFile: dcmtFile ?? inputFile, deviceType: deviceType, onBack: getOnBackHandler(), layoutMode: layoutMode, onFileUpload: (file) => { setDcmtFile(file); }, openFileUploaderPdfEditor: openFileUploaderPdfEditor, enableDragDropOverlay: enableDragDropOverlay, onScanRequest: onScanRequest }), [currentDcmt, dcmtFile, deviceType, fromDTD, layoutMode, inputFile, enableDragDropOverlay, setDcmtFile, onScanRequest, openFileUploaderPdfEditor, refreshPreviewTrigger]);
|
|
1104
1156
|
const tmWF = useMemo(() => {
|
|
1105
1157
|
if (isWFDataLoading) {
|
|
1106
1158
|
return (_jsx("div", { style: {
|
|
@@ -1171,7 +1223,7 @@ const TMDcmtForm = ({ TID, DID, groupId, layoutMode = LayoutModes.Update, formMo
|
|
|
1171
1223
|
did: Number(DID),
|
|
1172
1224
|
name: fromDTD?.nameLoc ?? SDKUI_Localizator.Widget_Activities,
|
|
1173
1225
|
},
|
|
1174
|
-
}, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, afterTaskSaved: afterTaskSaved, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }));
|
|
1226
|
+
}, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, afterTaskSaved: afterTaskSaved, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, onBack: getOnBackHandler() }));
|
|
1175
1227
|
}, [allTasks, TID, DID, fromDTD]);
|
|
1176
1228
|
const normalizedTID = TID !== undefined ? Number(TID) : undefined;
|
|
1177
1229
|
const defaultPanelDimensions = {
|
|
@@ -1230,7 +1282,7 @@ const TMDcmtForm = ({ TID, DID, groupId, layoutMode = LayoutModes.Update, formMo
|
|
|
1230
1282
|
showHeader: showHeader,
|
|
1231
1283
|
title: titleDcmtFormPanel,
|
|
1232
1284
|
allowMaximize: !isMobile,
|
|
1233
|
-
onBack:
|
|
1285
|
+
onBack: getOnBackHandler(true),
|
|
1234
1286
|
onClose: isClosable ? () => { } : undefined,
|
|
1235
1287
|
toolbar: allowNavigation ? formToolbar : _jsx(_Fragment, {})
|
|
1236
1288
|
},
|
|
@@ -1245,7 +1297,14 @@ const TMDcmtForm = ({ TID, DID, groupId, layoutMode = LayoutModes.Update, formMo
|
|
|
1245
1297
|
{
|
|
1246
1298
|
id: 'tmBlog',
|
|
1247
1299
|
name: SDKUI_Localizator.BlogCase,
|
|
1248
|
-
contentOptions: {
|
|
1300
|
+
contentOptions: {
|
|
1301
|
+
component: tmBlog,
|
|
1302
|
+
panelContainer: {
|
|
1303
|
+
title: SDKUI_Localizator.BlogCase,
|
|
1304
|
+
allowMaximize: !isMobile,
|
|
1305
|
+
onBack: getOnBackHandler(),
|
|
1306
|
+
}
|
|
1307
|
+
},
|
|
1249
1308
|
toolbarOptions: {
|
|
1250
1309
|
icon: _jsx(IconBoard, { fontSize: 24 }),
|
|
1251
1310
|
visible: getDcmtFormToolbarVisibility(SDK_Globals.tmSession?.SessionDescr?.appModuleID ?? AppModules.SURFER).tmBlog,
|
|
@@ -1257,7 +1316,14 @@ const TMDcmtForm = ({ TID, DID, groupId, layoutMode = LayoutModes.Update, formMo
|
|
|
1257
1316
|
{
|
|
1258
1317
|
id: 'tmSysMetadata',
|
|
1259
1318
|
name: SDKUI_Localizator.MetadataSystem,
|
|
1260
|
-
contentOptions: {
|
|
1319
|
+
contentOptions: {
|
|
1320
|
+
component: tmSysMetadata,
|
|
1321
|
+
panelContainer: {
|
|
1322
|
+
title: SDKUI_Localizator.MetadataSystem,
|
|
1323
|
+
allowMaximize: !isMobile,
|
|
1324
|
+
onBack: getOnBackHandler(),
|
|
1325
|
+
}
|
|
1326
|
+
},
|
|
1261
1327
|
toolbarOptions: { icon: _jsx(IconDcmtTypeSys, { fontSize: 24 }), visible: getDcmtFormToolbarVisibility(SDK_Globals.tmSession?.SessionDescr?.appModuleID ?? AppModules.SURFER).tmSysMetadata, disabled: isSysMetadataDisabled, orderNumber: 3, isActive: allInitialPanelVisibility['tmSysMetadata'] }
|
|
1262
1328
|
},
|
|
1263
1329
|
{
|
|
@@ -1278,7 +1344,8 @@ const TMDcmtForm = ({ TID, DID, groupId, layoutMode = LayoutModes.Update, formMo
|
|
|
1278
1344
|
contentOptions: {
|
|
1279
1345
|
component: tmWF,
|
|
1280
1346
|
panelContainer: {
|
|
1281
|
-
title: "Workflow", allowMaximize: !isMobile
|
|
1347
|
+
title: "Workflow", allowMaximize: !isMobile,
|
|
1348
|
+
onBack: getOnBackHandler(),
|
|
1282
1349
|
}
|
|
1283
1350
|
},
|
|
1284
1351
|
toolbarOptions: {
|
|
@@ -1537,38 +1604,59 @@ const validateMaxLength = (mvd, value, validationItems) => {
|
|
|
1537
1604
|
//#endregion Validation
|
|
1538
1605
|
// Synchronizes panel visibility and toolbar button disabled states when panels become disabled
|
|
1539
1606
|
const PanelDisabledStateHandler = ({ isWFDisabled, isSysMetadataDisabled, isBoardDisabled, isDcmtTasksDisabled, isPreviewDisabled }) => {
|
|
1540
|
-
const { setPanelVisibilityById, setToolbarButtonDisabled
|
|
1607
|
+
const { setPanelVisibilityById, setToolbarButtonDisabled } = useTMPanelManagerContext();
|
|
1541
1608
|
useEffect(() => {
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
setToolbarButtonDisabled('tmBlog', isBoardDisabled);
|
|
1545
|
-
setToolbarButtonDisabled('tmWF', isWFDisabled);
|
|
1546
|
-
setToolbarButtonDisabled('tmDcmtTasks', isDcmtTasksDisabled);
|
|
1547
|
-
setToolbarButtonDisabled('tmDcmtPreview', isPreviewDisabled);
|
|
1548
|
-
// Chiude il pannello solo se è attualmente visibile e deve essere disabilitato
|
|
1549
|
-
if (isSysMetadataDisabled && panelVisibility['tmSysMetadata']) {
|
|
1609
|
+
if (isSysMetadataDisabled) {
|
|
1610
|
+
setToolbarButtonDisabled('tmSysMetadata', true);
|
|
1550
1611
|
setPanelVisibilityById('tmSysMetadata', false);
|
|
1551
1612
|
}
|
|
1552
|
-
|
|
1613
|
+
else {
|
|
1614
|
+
setToolbarButtonDisabled('tmSysMetadata', false);
|
|
1615
|
+
}
|
|
1616
|
+
}, [isSysMetadataDisabled]);
|
|
1617
|
+
useEffect(() => {
|
|
1618
|
+
if (isBoardDisabled) {
|
|
1619
|
+
setToolbarButtonDisabled('tmBlog', true);
|
|
1553
1620
|
setPanelVisibilityById('tmBlog', false);
|
|
1554
1621
|
}
|
|
1555
|
-
|
|
1622
|
+
else {
|
|
1623
|
+
setToolbarButtonDisabled('tmBlog', false);
|
|
1624
|
+
}
|
|
1625
|
+
}, [isBoardDisabled]);
|
|
1626
|
+
useEffect(() => {
|
|
1627
|
+
if (isWFDisabled) {
|
|
1628
|
+
setToolbarButtonDisabled('tmWF', true);
|
|
1556
1629
|
setPanelVisibilityById('tmWF', false);
|
|
1557
1630
|
}
|
|
1558
|
-
|
|
1631
|
+
else {
|
|
1632
|
+
setToolbarButtonDisabled('tmWF', false);
|
|
1633
|
+
}
|
|
1634
|
+
}, [isWFDisabled]);
|
|
1635
|
+
useEffect(() => {
|
|
1636
|
+
if (isDcmtTasksDisabled) {
|
|
1637
|
+
setToolbarButtonDisabled('tmDcmtTasks', true);
|
|
1559
1638
|
setPanelVisibilityById('tmDcmtTasks', false);
|
|
1560
1639
|
}
|
|
1561
|
-
|
|
1640
|
+
else {
|
|
1641
|
+
setToolbarButtonDisabled('tmDcmtTasks', false);
|
|
1642
|
+
}
|
|
1643
|
+
}, [isDcmtTasksDisabled]);
|
|
1644
|
+
useEffect(() => {
|
|
1645
|
+
if (isPreviewDisabled) {
|
|
1646
|
+
setToolbarButtonDisabled('tmDcmtPreview', true);
|
|
1562
1647
|
setPanelVisibilityById('tmDcmtPreview', false);
|
|
1563
1648
|
}
|
|
1564
|
-
|
|
1649
|
+
else {
|
|
1650
|
+
setToolbarButtonDisabled('tmDcmtPreview', false);
|
|
1651
|
+
}
|
|
1652
|
+
}, [isPreviewDisabled]);
|
|
1565
1653
|
return null;
|
|
1566
1654
|
};
|
|
1567
|
-
const TMDcmtPreviewWrapper = ({ refreshPreviewTrigger, fromDTD, currentDcmt, layoutMode, dcmtFile, deviceType, isVisible, onFileUpload, openFileUploaderPdfEditor, enableDragDropOverlay = false, onScanRequest }) => {
|
|
1655
|
+
const TMDcmtPreviewWrapper = ({ refreshPreviewTrigger, fromDTD, currentDcmt, layoutMode, dcmtFile, deviceType, isVisible, onFileUpload, openFileUploaderPdfEditor, enableDragDropOverlay = false, onScanRequest, onBack }) => {
|
|
1568
1656
|
const { setPanelVisibilityById, toggleMaximize, isResizingActive, countVisibleLeafPanels, panelVisibility } = useTMPanelManagerContext();
|
|
1569
1657
|
const isMobile = deviceType === DeviceType.MOBILE;
|
|
1570
1658
|
return (layoutMode === LayoutModes.Update ?
|
|
1571
|
-
_jsx(TMDcmtPreview, { dcmtData: currentDcmt, isVisible: isVisible, onClosePanel: (!isMobile && countVisibleLeafPanels() > 1) ? () => setPanelVisibilityById('tmDcmtPreview', false) : undefined, allowMaximize: !isMobile && countVisibleLeafPanels() > 1, onMaximizePanel: (!isMobile && countVisibleLeafPanels() > 1) ? () => toggleMaximize("tmDcmtPreview") : undefined, isResizingActive: isResizingActive }, refreshPreviewTrigger) :
|
|
1659
|
+
_jsx(TMDcmtPreview, { dcmtData: currentDcmt, isVisible: isVisible, onClosePanel: (!isMobile && countVisibleLeafPanels() > 1) ? () => setPanelVisibilityById('tmDcmtPreview', false) : undefined, allowMaximize: !isMobile && countVisibleLeafPanels() > 1, onMaximizePanel: (!isMobile && countVisibleLeafPanels() > 1) ? () => toggleMaximize("tmDcmtPreview") : undefined, onBack: onBack, isResizingActive: isResizingActive }, refreshPreviewTrigger) :
|
|
1572
1660
|
_jsx(TMFileUploader, { fromDTD: fromDTD, onFileUpload: onFileUpload, openFileUploaderPdfEditor: openFileUploaderPdfEditor, onClose: (!isMobile && countVisibleLeafPanels() > 1) ? () => setPanelVisibilityById('tmDcmtPreview', false) : undefined, isRequired: fromDTD?.archiveConstraint === ArchiveConstraints.ContentCompulsory && dcmtFile === null, defaultBlob: dcmtFile, deviceType: deviceType, isResizingActive: isResizingActive, enableDragDropOverlay: panelVisibility['tmDcmtPreview'] && enableDragDropOverlay, onScanRequest: onScanRequest }));
|
|
1573
1661
|
};
|
|
1574
1662
|
const Ribbon = styled.div `
|
|
@@ -22,7 +22,7 @@ const ErrorContent = ({ error, isAbortError, onRetry }) => {
|
|
|
22
22
|
}
|
|
23
23
|
return _jsx(TMNothingToShow, { icon: _jsx(IconCloseOutline, { fontSize: 92, color: TMColors.error }), text: error });
|
|
24
24
|
};
|
|
25
|
-
const TMDcmtPreview = ({ dcmtData, isResizingActive, isVisible, canNext, canPrev, onClosePanel, onNext, onPrev, allowMaximize = true, onMaximizePanel }) => {
|
|
25
|
+
const TMDcmtPreview = ({ dcmtData, isResizingActive, isVisible, canNext, canPrev, onClosePanel, onBack, onNext, onPrev, allowMaximize = true, onMaximizePanel }) => {
|
|
26
26
|
const [dcmtBlob, setDcmtBlob] = useState(undefined);
|
|
27
27
|
const [showPreview, setShowPreview] = useState(false);
|
|
28
28
|
const [isFromCache, setIsFromCache] = useState(false);
|
|
@@ -183,7 +183,7 @@ const TMDcmtPreview = ({ dcmtData, isResizingActive, isVisible, canNext, canPrev
|
|
|
183
183
|
{ icon: _jsx(IconCloseCircle, {}), name: SDKUI_Localizator.RemoveFromCache, onClick: () => { removeDcmtsFileCache(cacheKey); setIsFromCache(false); } },
|
|
184
184
|
{ icon: _jsx(IconClear, {}), name: SDKUI_Localizator.ClearCache, onClick: () => { clearDcmtsFileCache(); setIsFromCache(false); } },
|
|
185
185
|
], [cacheKey, removeDcmtsFileCache, clearDcmtsFileCache, setIsFromCache]);
|
|
186
|
-
return (_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(TMPanel, { padding: '0', title: titleHandler(), onClose: onClosePanel, allowMaximize: allowMaximize, onMaximize: onMaximizePanel, onHeaderDoubleClick: onMaximizePanel, toolbar: _jsxs("div", { style: { width: 'max-content', display: 'flex', alignItems: 'center', gap: '10px' }, children: [onPrev && _jsx(TMSaveFormButtonPrevious, { btnStyle: 'icon', isModified: false, formMode: FormModes.ReadOnly, canPrev: canPrev, onPrev: onPrev }), onNext && _jsx(TMSaveFormButtonNext, { btnStyle: 'icon', isModified: false, formMode: FormModes.ReadOnly, canNext: canNext, onNext: onNext }), _jsx(StyledHeaderIcon, { "$color": TMColors.primaryColor, children: _jsx(ContextMenu, { items: cacheMenuItems, trigger: "left", children: _jsx(IconMenuVertical, {}) }) }), _jsx(StyledHeaderIcon, { onClick: reOpenDcmt, "$color": TMColors.primaryColor, children: _jsx(TMTooltip, { content: SDKUI_Localizator.ReopenDocument, children: _jsx(IconRefresh, {}) }) })] }), children: error
|
|
186
|
+
return (_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(TMPanel, { padding: '0', title: titleHandler(), onClose: onClosePanel, onBack: onBack, allowMaximize: allowMaximize, onMaximize: onMaximizePanel, onHeaderDoubleClick: onMaximizePanel, toolbar: _jsxs("div", { style: { width: 'max-content', display: 'flex', alignItems: 'center', gap: '10px' }, children: [onPrev && _jsx(TMSaveFormButtonPrevious, { btnStyle: 'icon', isModified: false, formMode: FormModes.ReadOnly, canPrev: canPrev, onPrev: onPrev }), onNext && _jsx(TMSaveFormButtonNext, { btnStyle: 'icon', isModified: false, formMode: FormModes.ReadOnly, canNext: canNext, onNext: onNext }), _jsx(StyledHeaderIcon, { "$color": TMColors.primaryColor, children: _jsx(ContextMenu, { items: cacheMenuItems, trigger: "left", children: _jsx(IconMenuVertical, {}) }) }), _jsx(StyledHeaderIcon, { onClick: reOpenDcmt, "$color": TMColors.primaryColor, children: _jsx(TMTooltip, { content: SDKUI_Localizator.ReopenDocument, children: _jsx(IconRefresh, {}) }) })] }), children: error
|
|
187
187
|
? _jsx(ErrorContent, { error: error, isAbortError: isAbortError, onRetry: reOpenDcmt })
|
|
188
188
|
: renderedPreview(dcmtData?.tid, dcmtData?.did, dcmtData?.fileExt, dcmtData?.fileSize, dcmtData?.fileCount, extensionHandler(dcmtData?.fileExt), showPreview, isResizingActive, () => { isBasketMode ? loadBasketFile() : loadDocumentWithCache(); setShowPreview(true); }, dcmtBlob, isBasketMode) }) }));
|
|
189
189
|
};
|
|
@@ -10,6 +10,7 @@ interface TMDcmtTasksProps {
|
|
|
10
10
|
afterTaskSaved: (task: TaskDescriptor | undefined, formMode: FormModes | undefined, forceRefresh?: boolean) => Promise<void>;
|
|
11
11
|
handleNavigateToWGs?: (value: HomeBlogPost | number) => Promise<void>;
|
|
12
12
|
handleNavigateToDossiers?: (value: HomeBlogPost | number) => Promise<void>;
|
|
13
|
+
onBack?: () => void;
|
|
13
14
|
}
|
|
14
15
|
declare const TMDcmtTasks: (props: TMDcmtTasksProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
16
|
export default TMDcmtTasks;
|
|
@@ -6,7 +6,7 @@ import { useTMPanelManagerContext } from "../../layout/panelManager/TMPanelManag
|
|
|
6
6
|
import TMPanel from "../../base/TMPanel";
|
|
7
7
|
import TMTasksPanelContent from "../tasks/TMTasksPanelContent";
|
|
8
8
|
const TMDcmtTasks = (props) => {
|
|
9
|
-
const { taskContext, allTasks, getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, afterTaskSaved, handleNavigateToWGs, handleNavigateToDossiers } = props;
|
|
9
|
+
const { taskContext, allTasks, getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, afterTaskSaved, handleNavigateToWGs, handleNavigateToDossiers, onBack } = props;
|
|
10
10
|
// Get the current device type (e.g., mobile, tablet, desktop) using a custom hook.
|
|
11
11
|
const deviceType = useDeviceType();
|
|
12
12
|
// This avoids unnecessary re-renders by only recalculating when deviceType changes.
|
|
@@ -19,6 +19,6 @@ const TMDcmtTasks = (props) => {
|
|
|
19
19
|
text: SDKUI_Localizator.Refresh,
|
|
20
20
|
},
|
|
21
21
|
], children: _jsx(IconMenuVertical, { id: "TMTaksPanel-Commands-Header", color: 'white', cursor: 'pointer' }) }), []);
|
|
22
|
-
return _jsx("div", { style: { width: "100%", height: "100%", position: 'relative' }, children: _jsx(TMPanel, { title: SDKUI_Localizator.Widget_Activities, allowMaximize: !isMobile && countVisibleLeafPanels() > 1, onClose: countVisibleLeafPanels() > 1 ? () => togglePanelVisibility("tmDcmtTasks") : undefined, onMaximize: countVisibleLeafPanels() > 1 ? () => toggleMaximize("tmDcmtTasks") : undefined, toolbar: toolbar, children: _jsx(TMTasksPanelContent, { id: "dcmtTasks", taskContext: taskContext, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs ? handleNavigateToWGs : () => { return Promise.resolve(); }, handleNavigateToDossiers: handleNavigateToDossiers ? handleNavigateToDossiers : () => { return Promise.resolve(); }, afterTaskSaved: afterTaskSaved }) }) });
|
|
22
|
+
return _jsx("div", { style: { width: "100%", height: "100%", position: 'relative' }, children: _jsx(TMPanel, { title: SDKUI_Localizator.Widget_Activities, allowMaximize: !isMobile && countVisibleLeafPanels() > 1, onClose: countVisibleLeafPanels() > 1 ? () => togglePanelVisibility("tmDcmtTasks") : undefined, onMaximize: countVisibleLeafPanels() > 1 ? () => toggleMaximize("tmDcmtTasks") : undefined, toolbar: toolbar, onBack: onBack, children: _jsx(TMTasksPanelContent, { id: "dcmtTasks", taskContext: taskContext, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs ? handleNavigateToWGs : () => { return Promise.resolve(); }, handleNavigateToDossiers: handleNavigateToDossiers ? handleNavigateToDossiers : () => { return Promise.resolve(); }, afterTaskSaved: afterTaskSaved }) }) });
|
|
23
23
|
};
|
|
24
24
|
export default TMDcmtTasks;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { HomeBlogPost, TaskDescriptor } from '@topconsultnpm/sdk-ts';
|
|
3
|
+
import { DcmtInfo } from '../../../ts';
|
|
4
|
+
import { IRelatedDcmt } from './TMMasterDetailDcmts';
|
|
5
|
+
interface ITMDownloadRelationViewerSectionProps {
|
|
6
|
+
selectedDcmtInfos: Array<DcmtInfo>;
|
|
7
|
+
/** Notifica al parent la lista dei documenti correlati selezionati (deduplicati) */
|
|
8
|
+
onSelectionChanged: (items: Array<IRelatedDcmt>) => void;
|
|
9
|
+
allTasks?: Array<TaskDescriptor>;
|
|
10
|
+
getAllTasks?: () => Promise<void>;
|
|
11
|
+
deleteTaskByIdsCallback?: (deletedTaskIds: Array<number>) => Promise<void>;
|
|
12
|
+
addTaskCallback?: (task: TaskDescriptor) => Promise<void>;
|
|
13
|
+
editTaskCallback?: (task: TaskDescriptor) => Promise<void>;
|
|
14
|
+
handleNavigateToWGs?: (value: HomeBlogPost | number) => Promise<void>;
|
|
15
|
+
handleNavigateToDossiers?: (value: HomeBlogPost | number) => Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Sezione condivisa tra TMCopyToFolderForm e TMMergeToPdfForm
|
|
19
|
+
* che mostra l'elenco dei documenti correlati e il tree di selezione
|
|
20
|
+
* per tipo documento / "solo metadati".
|
|
21
|
+
*/
|
|
22
|
+
declare const TMDownloadRelationViewerSection: React.FC<ITMDownloadRelationViewerSectionProps>;
|
|
23
|
+
export default TMDownloadRelationViewerSection;
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useRef, useState } from 'react';
|
|
3
|
+
import TreeView from 'devextreme-react/tree-view';
|
|
4
|
+
import { LayoutModes } from '@topconsultnpm/sdk-ts';
|
|
5
|
+
import { SDKUI_Localizator } from '../../../helper';
|
|
6
|
+
import { TMColors } from '../../../utils/theme';
|
|
7
|
+
import { TMSplitterLayout } from '../../base/TMLayout';
|
|
8
|
+
import TMRelationViewer from './TMRelationViewer';
|
|
9
|
+
import TMDcmtForm from './TMDcmtForm';
|
|
10
|
+
import { dedupeByTidDid, getDcmtKey, getFloatingLabelStyle, } from './copyAndMergeDcmtsShared';
|
|
11
|
+
/**
|
|
12
|
+
* Sezione condivisa tra TMCopyToFolderForm e TMMergeToPdfForm
|
|
13
|
+
* che mostra l'elenco dei documenti correlati e il tree di selezione
|
|
14
|
+
* per tipo documento / "solo metadati".
|
|
15
|
+
*/
|
|
16
|
+
const TMDownloadRelationViewerSection = ({ selectedDcmtInfos, onSelectionChanged, allTasks, getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, handleNavigateToWGs, handleNavigateToDossiers }) => {
|
|
17
|
+
const [focusedItem, setFocusedItem] = useState(null);
|
|
18
|
+
const [selectedItems, setSelectedItems] = useState([]);
|
|
19
|
+
const [allItems, setAllItems] = useState([]);
|
|
20
|
+
const didInitSelectionRef = useRef(false);
|
|
21
|
+
// State for TMDcmtForm modal
|
|
22
|
+
const [isOpenDcmtForm, setIsOpenDcmtForm] = useState(false);
|
|
23
|
+
const [dcmtFormTID, setDcmtFormTID] = useState(undefined);
|
|
24
|
+
const [dcmtFormDID, setDcmtFormDID] = useState(undefined);
|
|
25
|
+
const [dcmtFormTitle, setDcmtFormTitle] = useState('');
|
|
26
|
+
const updateSelection = useCallback((items) => {
|
|
27
|
+
const deduped = dedupeByTidDid(items);
|
|
28
|
+
setSelectedItems(deduped);
|
|
29
|
+
onSelectionChanged(deduped);
|
|
30
|
+
}, [onSelectionChanged]);
|
|
31
|
+
const handleFocusedItemChanged = useCallback((item) => {
|
|
32
|
+
setFocusedItem(item);
|
|
33
|
+
}, []);
|
|
34
|
+
const handleSelectedItemsChanged = useCallback((items) => {
|
|
35
|
+
updateSelection(items);
|
|
36
|
+
}, [updateSelection]);
|
|
37
|
+
const handleAllItemsChanged = useCallback((items) => {
|
|
38
|
+
setAllItems(items);
|
|
39
|
+
if (!didInitSelectionRef.current && items.some(i => i.isDcmt)) {
|
|
40
|
+
didInitSelectionRef.current = true;
|
|
41
|
+
updateSelection(items.filter(i => i.isDcmt));
|
|
42
|
+
}
|
|
43
|
+
}, [updateSelection]);
|
|
44
|
+
const handleDocumentDoubleClick = useCallback((tid, did, name) => {
|
|
45
|
+
setDcmtFormTID(tid);
|
|
46
|
+
setDcmtFormDID(did);
|
|
47
|
+
setDcmtFormTitle(name ?? '');
|
|
48
|
+
setIsOpenDcmtForm(true);
|
|
49
|
+
}, []);
|
|
50
|
+
return (_jsxs("div", { style: {
|
|
51
|
+
position: 'relative',
|
|
52
|
+
height: '100%',
|
|
53
|
+
minHeight: 0,
|
|
54
|
+
display: 'flex',
|
|
55
|
+
flexDirection: 'column',
|
|
56
|
+
boxSizing: 'border-box'
|
|
57
|
+
}, children: [_jsx("div", { style: { flex: 1, minHeight: 0, overflow: 'visible', paddingTop: '10px' }, children: _jsxs(TMSplitterLayout, { direction: 'horizontal', showSeparator: true, separatorSize: 8, separatorColor: 'transparent', separatorActiveColor: 'transparent', overflow: 'visible', min: ["50", "50"], start: ["75%", "25%"], children: [_jsxs("div", { style: {
|
|
58
|
+
position: 'relative',
|
|
59
|
+
height: '100%',
|
|
60
|
+
minHeight: 0,
|
|
61
|
+
overflow: 'visible',
|
|
62
|
+
border: `1px solid ${TMColors.border_normal}`,
|
|
63
|
+
borderRadius: '8px',
|
|
64
|
+
padding: '4px 2px 2px 2px',
|
|
65
|
+
backgroundColor: '#fff',
|
|
66
|
+
boxSizing: 'border-box',
|
|
67
|
+
display: 'flex',
|
|
68
|
+
flexDirection: 'column'
|
|
69
|
+
}, children: [_jsxs("span", { style: getFloatingLabelStyle(), title: `Documenti correlati (${SDKUI_Localizator.Selected}: ${selectedItems.filter(item => item.isDcmt).length})`, children: ["Documenti correlati (", SDKUI_Localizator.Selected, ": ", selectedItems.filter(item => item.isDcmt).length, ")"] }), _jsx("div", { style: { flex: 1, minHeight: 0, overflowX: 'auto', overflowY: 'auto' }, children: _jsx("div", { style: { minWidth: 'max-content', height: '100%' }, children: _jsx(TMRelationViewer, { inputDcmts: selectedDcmtInfos, isForMaster: false, defaultExpandAll: true, showMetadataNames: true, allowMultipleSelection: true, showExpandAllButton: true, focusedItem: focusedItem, selectedItems: selectedItems, onFocusedItemChanged: handleFocusedItemChanged, onSelectedItemsChanged: handleSelectedItemsChanged, onAllItemsChanged: handleAllItemsChanged, onDocumentDoubleClick: handleDocumentDoubleClick }) }) })] }), _jsxs("div", { style: {
|
|
70
|
+
position: 'relative',
|
|
71
|
+
height: '100%',
|
|
72
|
+
minHeight: 0,
|
|
73
|
+
overflow: 'visible',
|
|
74
|
+
border: `1px solid ${TMColors.border_normal}`,
|
|
75
|
+
borderRadius: '8px',
|
|
76
|
+
padding: '4px 2px 2px 2px',
|
|
77
|
+
backgroundColor: '#fff',
|
|
78
|
+
boxSizing: 'border-box',
|
|
79
|
+
display: 'flex',
|
|
80
|
+
flexDirection: 'column'
|
|
81
|
+
}, children: [_jsx("span", { style: getFloatingLabelStyle(), title: "Tipo documento o vista", children: "Tipo documento o vista" }), _jsx("div", { style: { flex: 1, minHeight: 0, overflow: 'auto', padding: '8px', display: 'flex', flexDirection: 'column', gap: '6px' }, children: (() => {
|
|
82
|
+
const dcmtItems = dedupeByTidDid(allItems.filter(item => item.isDcmt));
|
|
83
|
+
const metadataOnlyItems = dcmtItems.filter(item => item.fileExt === null || item.fileExt === undefined);
|
|
84
|
+
const totalDcmts = dcmtItems.length;
|
|
85
|
+
const totalMetadataOnly = metadataOnlyItems.length;
|
|
86
|
+
const selectedDcmtsList = selectedItems.filter(item => item.isDcmt);
|
|
87
|
+
const selectedDcmts = selectedDcmtsList.length;
|
|
88
|
+
const allSelected = totalDcmts > 0 && selectedDcmts === totalDcmts;
|
|
89
|
+
const selectedMetadataOnlyCount = selectedDcmtsList.filter(item => item.fileExt === null || item.fileExt === undefined).length;
|
|
90
|
+
const allMetadataOnlySelected = totalMetadataOnly > 0 && selectedMetadataOnlyCount === totalMetadataOnly;
|
|
91
|
+
// Raggruppa per nome del DcmtTypeDescriptor (campo dtd.name)
|
|
92
|
+
const getDtdName = (item) => item.dtd?.name ?? undefined;
|
|
93
|
+
const dtdGroups = new Map();
|
|
94
|
+
for (const item of dcmtItems) {
|
|
95
|
+
const name = getDtdName(item);
|
|
96
|
+
if (!name)
|
|
97
|
+
continue;
|
|
98
|
+
const arr = dtdGroups.get(name);
|
|
99
|
+
if (arr)
|
|
100
|
+
arr.push(item);
|
|
101
|
+
else
|
|
102
|
+
dtdGroups.set(name, [item]);
|
|
103
|
+
}
|
|
104
|
+
const sortedDtdNames = Array.from(dtdGroups.keys()).sort((a, b) => a.localeCompare(b));
|
|
105
|
+
const selectedKeysSet = new Set(selectedDcmtsList.map(getDcmtKey));
|
|
106
|
+
const dtdGroupInfos = sortedDtdNames.map((name) => {
|
|
107
|
+
const items = dtdGroups.get(name) ?? [];
|
|
108
|
+
const selectedCount = items.filter(it => selectedKeysSet.has(getDcmtKey(it))).length;
|
|
109
|
+
return {
|
|
110
|
+
name,
|
|
111
|
+
items,
|
|
112
|
+
total: items.length,
|
|
113
|
+
allSelected: items.length > 0 && selectedCount === items.length,
|
|
114
|
+
};
|
|
115
|
+
});
|
|
116
|
+
const treeItems = [
|
|
117
|
+
{
|
|
118
|
+
id: 'all',
|
|
119
|
+
text: `Seleziona tutti (${totalDcmts})`,
|
|
120
|
+
expanded: true,
|
|
121
|
+
selected: allSelected,
|
|
122
|
+
items: [
|
|
123
|
+
...dtdGroupInfos.map((g) => ({
|
|
124
|
+
id: `dtd::${g.name}`,
|
|
125
|
+
text: `${g.name} (${g.total})`,
|
|
126
|
+
selected: g.allSelected,
|
|
127
|
+
})),
|
|
128
|
+
{
|
|
129
|
+
id: 'metadataOnly',
|
|
130
|
+
text: `Documenti di soli metadati (${totalMetadataOnly})`,
|
|
131
|
+
selected: allMetadataOnlySelected,
|
|
132
|
+
},
|
|
133
|
+
]
|
|
134
|
+
}
|
|
135
|
+
];
|
|
136
|
+
const handleItemSelectionChanged = (e) => {
|
|
137
|
+
const itemData = e.itemData;
|
|
138
|
+
if (!itemData)
|
|
139
|
+
return;
|
|
140
|
+
if (itemData.id === 'all') {
|
|
141
|
+
updateSelection(itemData.selected ? dcmtItems : []);
|
|
142
|
+
}
|
|
143
|
+
else if (itemData.id === 'metadataOnly') {
|
|
144
|
+
if (itemData.selected) {
|
|
145
|
+
updateSelection([...selectedItems, ...metadataOnlyItems]);
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
const metadataKeys = new Set(metadataOnlyItems.map(getDcmtKey));
|
|
149
|
+
updateSelection(selectedItems.filter(item => !metadataKeys.has(getDcmtKey(item))));
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
else if (typeof itemData.id === 'string' && itemData.id.startsWith('dtd::')) {
|
|
153
|
+
const dtdName = itemData.id.substring('dtd::'.length);
|
|
154
|
+
const groupItems = dtdGroups.get(dtdName) ?? [];
|
|
155
|
+
if (itemData.selected) {
|
|
156
|
+
updateSelection([...selectedItems, ...groupItems]);
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
const groupKeys = new Set(groupItems.map(getDcmtKey));
|
|
160
|
+
updateSelection(selectedItems.filter(item => !groupKeys.has(getDcmtKey(item))));
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
const dtdSignature = dtdGroupInfos.map(g => `${g.name}:${g.total}:${g.allSelected ? 1 : 0}`).join('|');
|
|
165
|
+
return (_jsx("div", { style: { minWidth: '280px', width: 'max-content', flexShrink: 0 }, children: _jsx(TreeView, { items: treeItems, showCheckBoxesMode: 'normal', selectionMode: 'multiple', selectNodesRecursive: false, selectByClick: true, onItemSelectionChanged: handleItemSelectionChanged }, `tv-${allSelected}-${allMetadataOnlySelected}-${totalDcmts}-${totalMetadataOnly}-${dtdSignature}`) }));
|
|
166
|
+
})() })] })] }, "TMDocumentDownload-relation-horizontal") }), isOpenDcmtForm && dcmtFormTID !== undefined && dcmtFormDID !== undefined && (_jsx(TMDcmtForm, { isModal: true, titleModal: dcmtFormTitle, TID: dcmtFormTID, DID: dcmtFormDID, layoutMode: LayoutModes.Update, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, onClose: () => {
|
|
167
|
+
setIsOpenDcmtForm(false);
|
|
168
|
+
setDcmtFormTID(undefined);
|
|
169
|
+
setDcmtFormDID(undefined);
|
|
170
|
+
setDcmtFormTitle('');
|
|
171
|
+
} }))] }));
|
|
172
|
+
};
|
|
173
|
+
export default TMDownloadRelationViewerSection;
|
|
@@ -97,7 +97,7 @@ const TMFileUploader = ({ fromDTD, deviceType = DeviceType.DESKTOP, onClose, onF
|
|
|
97
97
|
document.getElementById('fileInput')?.click();
|
|
98
98
|
}, []);
|
|
99
99
|
let content = !uploadedFile ?
|
|
100
|
-
_jsxs("div", { style: { display: 'flex', gap: 10, width: '100%', height: '100%' }, children: [_jsx(HiddenInput, { id: "fileInput", type: "file", onChange: handleInputChange }), _jsxs(UploadContainer, { ref: uploaderRef, tabIndex: 0, onDragOver: handleDragOver, onDragLeave: handleDragLeave, onDrop: handleDrop, style: { backgroundColor: dragOver ? '#76b1e6' : 'white' }, onDoubleClick: browseHandler, "$isRequired": isRequired, children: [_jsxs("div", { style: { display: 'flex', gap: '10px', flexDirection: 'column', position: 'absolute', right: 5, top: 5 }, children: [_jsx(TMButton, { btnStyle: 'icon', caption: 'Sfoglia', color: isRequired && !uploadedFile ? 'error' : 'primary', onClick: browseHandler, icon: _jsx(IconFolderOpen, { fontSize: 22 }) }), showScannerIcon && isScannerLicenseConfigured() && onScanRequest && _jsx(TMButton, { btnStyle: 'icon', caption: 'Scanner', color: 'primary', onClick: () => { onScanRequest((file) => { onFileUpload?.(file); }); }, icon: _jsx(IconScanner, { fontSize: 22 }) }), showScannerIcon && isScannerLicenseConfigured() && !onScanRequest && _jsx(TMButton, { btnStyle: 'icon', caption: 'Scanner', color: 'primary', onClick: () => { ShowAlert({ message: SDKUI_Localizator.ScanFeatureUnavailableInThisContext, mode: 'info', duration: 3000, title: 'Scanner' }); }, icon: _jsx(IconScanner, { fontSize: 22 }) })] }), _jsx("p", { style: { fontSize: '1.2rem', fontWeight: 'bold' }, children: deviceType === DeviceType.MOBILE ?
|
|
100
|
+
_jsxs("div", { style: { display: 'flex', gap: 10, width: '100%', height: '100%' }, children: [_jsx(HiddenInput, { id: "fileInput", type: "file", onChange: handleInputChange }), _jsxs(UploadContainer, { ref: uploaderRef, tabIndex: 0, onDragOver: handleDragOver, onDragLeave: handleDragLeave, onDrop: handleDrop, style: { backgroundColor: dragOver ? '#76b1e6' : 'white' }, onDoubleClick: browseHandler, "$isRequired": isRequired, children: [_jsxs("div", { style: { display: 'flex', gap: '10px', flexDirection: 'column', position: 'absolute', right: 5, top: 5 }, children: [_jsx(TMButton, { btnStyle: 'icon', caption: 'Sfoglia', color: isRequired && !uploadedFile ? 'error' : 'primary', onClick: browseHandler, icon: _jsx(IconFolderOpen, { fontSize: 22 }) }), showScannerIcon && isScannerLicenseConfigured() && onScanRequest && _jsx(TMButton, { btnStyle: 'icon', caption: 'Scanner', color: 'primary', onClick: () => { onScanRequest((file) => { onFileUpload?.(file); }); }, icon: _jsx(IconScanner, { fontSize: 22 }) }), showScannerIcon && isScannerLicenseConfigured() && !onScanRequest && _jsx(TMButton, { btnStyle: 'icon', caption: 'Scanner', color: 'primary', onClick: () => { ShowAlert({ message: SDKUI_Localizator.ScanFeatureUnavailableInThisContext, mode: 'info', duration: 3000, title: 'Scanner' }); }, icon: _jsx(IconScanner, { fontSize: 22 }) })] }), _jsx("p", { style: { fontSize: '1.2rem', fontWeight: 'bold' }, children: deviceType === DeviceType.MOBILE ? SDKUI_Localizator.ClickToBrowseFile : SDKUI_Localizator.DragOrDoubleClickToBrowseFile }), isRequired && _jsxs("p", { style: { fontWeight: 'bold' }, children: [" ", SDKUI_Localizator.RequiredField, " "] })] })] }) :
|
|
101
101
|
_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: 10, width: '100%', height: '100%' }, children: [_jsxs("div", { style: { backgroundColor: 'white', padding: '5px 10px', borderRadius: 8, display: 'flex', alignItems: 'center', justifyContent: 'space-between', color: TMColors.primaryColor }, children: [_jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: 5 }, children: [_jsx("p", { children: "File name:" }), _jsxs("div", { style: { fontWeight: 'bold' }, children: [fileName, " ", _jsxs("span", { children: [" ", ` (${formatBytes(fileSize)})`, " "] })] })] }), uploadedFile && _jsx(TMButton, { btnStyle: 'icon', color: 'error', caption: 'Pulisci', onClick: () => clearFile(true), icon: _jsx(IconClear, { fontSize: 22 }) })] }), extensionHandler(fileExt) === FileExtensionHandler.READY_TO_SHOW ? _jsx(TMFileViewer, { fileBlob: uploadedFile, isResizingActive: isResizingActive }) :
|
|
102
102
|
_jsx("div", { style: { backgroundColor: '#f6dbdb', padding: '5px 10px', borderRadius: 8, display: 'flex', alignItems: 'center', justifyContent: 'space-between', color: TMColors.error }, children: _jsxs("div", { children: [" ", 'Anteprima non disponibile.', fileExt && _jsx("b", { children: ` (*.${fileExt})` })] }) })] });
|
|
103
103
|
const innerContent = (_jsxs("div", { style: { width: '100%', height: '100%', padding: '2px', display: 'flex', flexDirection: 'column', gap: 10 }, children: [enableDragDropOverlay && _jsx(TMDragDropOverlay, { handleFile: handleFile, refocusAfterFileInput: refocusAfterFileInput }), content] }));
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { HomeBlogPost, SearchResultDescriptor, TaskDescriptor } from '@topconsultnpm/sdk-ts';
|
|
3
|
+
import { RelationTreeItem } from './TMRelationViewer';
|
|
3
4
|
import { DcmtInfo, TaskContext, MetadataValueDescriptorEx } from '../../../ts';
|
|
4
5
|
import { DeviceContextProps } from '../../base/TMDeviceProvider';
|
|
6
|
+
export type IRelatedDcmt = RelationTreeItem;
|
|
5
7
|
interface ITMMasterDetailDcmtsProps extends DeviceContextProps {
|
|
6
8
|
allTasks?: Array<TaskDescriptor>;
|
|
7
9
|
getAllTasks?: () => Promise<void>;
|