@topconsultnpm/sdkui-react 6.21.0-dev3.4 → 6.21.0-dev3.41
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 +22 -1
- package/lib/components/NewComponents/ContextMenu/styles.d.ts +4 -4
- package/lib/components/NewComponents/FloatingMenuBar/styles.d.ts +6 -6
- package/lib/components/base/TMAreaManager.js +11 -0
- package/lib/components/base/TMDataGrid.js +12 -2
- package/lib/components/base/TMDataGridExportForm.js +19 -8
- package/lib/components/base/TMFileManagerDataGridView.js +4 -4
- package/lib/components/base/TMFileManagerThumbnailItems.js +3 -3
- package/lib/components/base/TMFileManagerUtils.d.ts +7 -0
- package/lib/components/base/TMFileManagerUtils.js +14 -1
- package/lib/components/base/TMModal.js +2 -2
- package/lib/components/base/TMPopUp.d.ts +1 -0
- package/lib/components/base/TMPopUp.js +59 -2
- package/lib/components/base/TMSpinner.d.ts +4 -2
- package/lib/components/base/TMSpinner.js +33 -6
- package/lib/components/base/TMTreeView.js +12 -15
- package/lib/components/choosers/TMDynDataListItemChooser.js +6 -1
- package/lib/components/choosers/TMGroupChooser.js +1 -1
- package/lib/components/editors/TMEditorStyled.d.ts +6 -6
- package/lib/components/editors/TMFormulaEditor.d.ts +1 -0
- package/lib/components/editors/TMFormulaEditor.js +98 -49
- package/lib/components/editors/TMMetadataEditor.js +6 -2
- package/lib/components/editors/TMMetadataValues.js +23 -6
- package/lib/components/features/blog/TMBlogCommentForm.js +5 -2
- package/lib/components/features/documents/TMCopyToFolderForm.js +2 -2
- package/lib/components/features/documents/TMDcmtIcon.js +1 -1
- package/lib/components/features/documents/TMMasterDetailDcmts.js +1 -1
- package/lib/components/features/documents/TMMergeToPdfForm.js +1 -1
- package/lib/components/features/documents/TMRelationViewer.js +8 -3
- package/lib/components/features/documents/copyAndMergeDcmtsShared.d.ts +0 -13
- package/lib/components/features/documents/copyAndMergeDcmtsShared.js +1 -39
- package/lib/components/features/search/TMMetadataOutputForm.d.ts +17 -0
- package/lib/components/features/search/TMMetadataOutputForm.js +225 -0
- package/lib/components/features/search/TMMetadataSorterForm.d.ts +17 -0
- package/lib/components/features/search/TMMetadataSorterForm.js +243 -0
- package/lib/components/features/search/TMSearchQueryEditor.js +14 -8
- package/lib/components/features/search/TMSearchQueryPanel.js +249 -58
- package/lib/components/features/search/TMSearchResult.d.ts +1 -0
- package/lib/components/features/search/TMSearchResult.js +39 -18
- package/lib/components/features/search/TMViewHistoryDcmt.js +1 -1
- package/lib/components/features/search/metadataFormHelper.d.ts +16 -0
- package/lib/components/features/search/metadataFormHelper.js +77 -0
- package/lib/components/forms/Login/TMLoginForm.js +15 -3
- package/lib/components/grids/TMBlogAttachments.js +2 -2
- package/lib/components/grids/TMBlogsPost.js +5 -3
- package/lib/components/grids/TMBlogsPostUtils.d.ts +1 -0
- package/lib/components/grids/TMBlogsPostUtils.js +3 -1
- package/lib/components/wizard/TMWizard.d.ts +1 -0
- package/lib/components/wizard/TMWizard.js +5 -3
- package/lib/helper/Enum_Localizator.js +1 -0
- package/lib/helper/SDKUI_Localizator.d.ts +4 -0
- package/lib/helper/SDKUI_Localizator.js +40 -0
- package/lib/helper/TMUtils.d.ts +23 -0
- package/lib/helper/TMUtils.js +55 -0
- package/lib/helper/checkinCheckoutManager.d.ts +4 -3
- package/lib/helper/checkinCheckoutManager.js +29 -11
- package/lib/helper/helpers.d.ts +2 -1
- package/lib/helper/helpers.js +1 -0
- package/lib/hooks/useCheckInOutOperations.d.ts +4 -3
- package/lib/hooks/useDataUserIdItem.js +1 -1
- package/lib/hooks/useDcmtOperations.d.ts +18 -1
- package/lib/hooks/useDcmtOperations.js +235 -24
- package/lib/hooks/useDocumentOperations.js +22 -3
- package/lib/services/platform_services.d.ts +4 -4
- package/lib/ts/types.d.ts +2 -1
- package/lib/ts/types.js +1 -0
- package/package.json +13 -7
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
2
|
import { LocalizeDcmtOperationTypes } from '../helper/Enum_Localizator';
|
|
3
|
-
import { SDK_Globals, RetrieveFileOptions, DcmtOpers, ResultTypes, RecentCategories, MetadataDataTypes, MetadataDataDomains, DataListCacheService } from '@topconsultnpm/sdk-ts';
|
|
3
|
+
import { SDK_Globals, RetrieveFileOptions, DcmtOpers, ResultTypes, RecentCategories, MetadataDataTypes, MetadataDataDomains, DataListCacheService, DcmtTypeListCacheService, TemplateTIDs } from '@topconsultnpm/sdk-ts';
|
|
4
4
|
import { ShowAlert, TMResultManager, FormulaHelper, TMExceptionBoxManager, TMSpinner } from '../components';
|
|
5
|
-
import { Globalization, getExceptionMessage, dialogConfirmOperation, extensionHandler, downloadBase64File, SDKUI_Globals, dcmtsFileCacheDownload, CACHE_SIZE_LIMIT, clearDcmtsFileCache, dcmtsFileCachePreview, isDcmtFileInCache, removeDcmtsFileCache, SDKUI_Localizator } from '../helper';
|
|
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';
|
|
8
8
|
import { isXMLFileExt } from '../helper/dcmtsHelper';
|
|
9
9
|
import { ShowConfirm } from '../components/base/TMConfirm';
|
|
10
|
+
import { generateTargetFileName } from '../components/features/documents/copyAndMergeDcmtsShared';
|
|
10
11
|
const isScannerLicenseConfigured = () => {
|
|
11
12
|
try {
|
|
12
13
|
const scannerLicense = SDKUI_Globals.userSettings.advancedSettings.scannerLicense;
|
|
@@ -19,30 +20,72 @@ const isScannerLicenseConfigured = () => {
|
|
|
19
20
|
let abortController = new AbortController();
|
|
20
21
|
const downloadCountMap = new Map();
|
|
21
22
|
/**
|
|
22
|
-
* Genera il nome file per il download con
|
|
23
|
-
*
|
|
23
|
+
* Genera il nome file per il download con logica di priorità configurabile.
|
|
24
|
+
*
|
|
25
|
+
* @param file - File recuperato dal backend (può contenere il nome originale)
|
|
26
|
+
* @param dcmtInfo - Informazioni del documento (fileName, DID, FILEEXT)
|
|
27
|
+
* @param useInputFileName - Controlla la priorità del nome:
|
|
28
|
+
* - true: priorità a dcmtInfo.fileName → file.name → DID
|
|
29
|
+
* - false (default): priorità a file.name → dcmtInfo.fileName → DID
|
|
30
|
+
*
|
|
31
|
+
* Gestisce anche:
|
|
32
|
+
* - Aggiunta automatica dell'estensione se mancante
|
|
33
|
+
* - Duplicati per file con estensioni multiple (es: file.pdf.p7m)
|
|
24
34
|
*/
|
|
25
|
-
const getDownloadFileName = (file, dcmtInfo) => {
|
|
35
|
+
const getDownloadFileName = (file, dcmtInfo, useInputFileName = false) => {
|
|
26
36
|
// === FASE 1: Costruzione nome base con fallback ===
|
|
27
|
-
// Determina l'estensione con fallback
|
|
37
|
+
// Determina l'estensione con fallback: prima dal backend, poi dal documento
|
|
28
38
|
const fileExtFromBackend = file?.name?.split('.').pop()?.toLowerCase();
|
|
29
39
|
const fileExtFromDcmt = dcmtInfo.FILEEXT?.toLowerCase();
|
|
30
40
|
const fileExtension = fileExtFromBackend ?? fileExtFromDcmt ?? '';
|
|
31
41
|
let baseFileName;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
/**
|
|
43
|
+
* Logica di priorità per il nome file:
|
|
44
|
+
*
|
|
45
|
+
* Se useInputFileName = true:
|
|
46
|
+
* 1. Usa dcmtInfo.fileName (nome passato nell'input)
|
|
47
|
+
* 2. Fallback a file.name (nome dal backend)
|
|
48
|
+
* 3. Fallback finale a DID
|
|
49
|
+
*
|
|
50
|
+
* Se useInputFileName = false (default):
|
|
51
|
+
* 1. Usa file.name (nome recuperato dal backend)
|
|
52
|
+
* 2. Fallback a dcmtInfo.fileName (nome salvato nel documento)
|
|
53
|
+
* 3. Fallback finale a DID
|
|
54
|
+
*/
|
|
55
|
+
if (useInputFileName) {
|
|
56
|
+
// Priorità al nome da inputDcmts (dcmtInfo.fileName)
|
|
57
|
+
if (dcmtInfo.fileName) {
|
|
58
|
+
const hasExtension = dcmtInfo.fileName.includes('.');
|
|
59
|
+
baseFileName = hasExtension
|
|
60
|
+
? dcmtInfo.fileName
|
|
61
|
+
: (fileExtension ? `${dcmtInfo.fileName}.${fileExtension}` : dcmtInfo.fileName);
|
|
62
|
+
}
|
|
63
|
+
// Seconda priorità: nome dal backend
|
|
64
|
+
else if (file?.name) {
|
|
65
|
+
baseFileName = file.name;
|
|
66
|
+
}
|
|
67
|
+
// Fallback finale: ID documento con estensione
|
|
68
|
+
else {
|
|
69
|
+
baseFileName = fileExtension ? `${dcmtInfo.DID}.${fileExtension}` : `${dcmtInfo.DID}`;
|
|
70
|
+
}
|
|
42
71
|
}
|
|
43
|
-
// 3. Fallback finale: ID documento con estensione
|
|
44
72
|
else {
|
|
45
|
-
|
|
73
|
+
// Comportamento default: priorità al nome dal backend
|
|
74
|
+
// 1. Priorità massima: nome dal backend
|
|
75
|
+
if (file?.name) {
|
|
76
|
+
baseFileName = file.name;
|
|
77
|
+
}
|
|
78
|
+
// 2. Seconda priorità: nome salvato nel documento
|
|
79
|
+
else if (dcmtInfo.fileName) {
|
|
80
|
+
const hasExtension = dcmtInfo.fileName.includes('.');
|
|
81
|
+
baseFileName = hasExtension
|
|
82
|
+
? dcmtInfo.fileName
|
|
83
|
+
: (fileExtension ? `${dcmtInfo.fileName}.${fileExtension}` : dcmtInfo.fileName);
|
|
84
|
+
}
|
|
85
|
+
// 3. Fallback finale: ID documento con estensione
|
|
86
|
+
else {
|
|
87
|
+
baseFileName = fileExtension ? `${dcmtInfo.DID}.${fileExtension}` : `${dcmtInfo.DID}`;
|
|
88
|
+
}
|
|
46
89
|
}
|
|
47
90
|
// === FASE 2: Gestione duplicati per file con estensioni multiple ===
|
|
48
91
|
const firstDot = baseFileName.indexOf('.');
|
|
@@ -75,7 +118,145 @@ export const useDcmtOperations = () => {
|
|
|
75
118
|
const [waitPanelMaxValueSecondary, setWaitPanelMaxValueSecondary] = useState(0);
|
|
76
119
|
const { OpenFileDialog } = useFileDialog();
|
|
77
120
|
const [selectFileSource, FileSourceDialog] = useFileSourceDialog();
|
|
78
|
-
const
|
|
121
|
+
const copyCompliantDcmtsAsync = async (inputDcmt, onFileDownloaded) => {
|
|
122
|
+
return await _copyCompliantDcmtsAsync(inputDcmt, onFileDownloaded);
|
|
123
|
+
};
|
|
124
|
+
const _copyCompliantDcmtsAsync = async (inputDcmt, onFileDownloaded) => {
|
|
125
|
+
if (inputDcmt === undefined)
|
|
126
|
+
return;
|
|
127
|
+
let returnDcmtFiles = [];
|
|
128
|
+
let returnDcmtInfos = [];
|
|
129
|
+
const rfo = new RetrieveFileOptions();
|
|
130
|
+
rfo.retrieveReason = DcmtOpers.ShowFile;
|
|
131
|
+
let firstBlock = true;
|
|
132
|
+
let maxFileSize = 0;
|
|
133
|
+
let signerInfoDescriptor = undefined;
|
|
134
|
+
if (inputDcmt?.FILEEXT == undefined || inputDcmt.FILEEXT == '') {
|
|
135
|
+
throw new Error('WARNING#Documento di soli metadati');
|
|
136
|
+
}
|
|
137
|
+
let ue = SDK_Globals.tmSession?.NewUpdateEngineByID();
|
|
138
|
+
if (ue) {
|
|
139
|
+
ue.TID = inputDcmt?.TID;
|
|
140
|
+
ue.DID = inputDcmt?.DID;
|
|
141
|
+
//Verifichiamo la nostra firma che nel Lex è sempre CadES
|
|
142
|
+
if (inputDcmt?.FILEEXT && inputDcmt.FILEEXT?.toLowerCase().includes('p7m')) {
|
|
143
|
+
//Verifica firma e recupero informazioni firmatari
|
|
144
|
+
await ue.VerifySignAsync();
|
|
145
|
+
//Recuperiamo le impronte
|
|
146
|
+
signerInfoDescriptor = await ue.GetSignersAsync();
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
//Documenti master
|
|
150
|
+
let dsRes = await SDK_Globals.tmSession?.NewSearchEngine().GetAllMasterDcmtsAsync(inputDcmt?.TID, inputDcmt?.DID);
|
|
151
|
+
if (dsRes == undefined || dsRes.length === 0) {
|
|
152
|
+
throw new Error('Nessun documento master trovato');
|
|
153
|
+
}
|
|
154
|
+
//Cerchiamo quello con modello IdC
|
|
155
|
+
let serachResultIdC = null;
|
|
156
|
+
for (const dtRes of dsRes) {
|
|
157
|
+
let dtdCur = await DcmtTypeListCacheService.GetAsync(dtRes.fromTID);
|
|
158
|
+
if (dtdCur?.templateTID === TemplateTIDs.IDC_DcmtType && dtRes.dcmtsFound && dtRes.dcmtsFound > 0) {
|
|
159
|
+
serachResultIdC = { ...dtRes };
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
if (serachResultIdC == null || serachResultIdC.dcmtsFound !== 1) {
|
|
163
|
+
throw new Error('Nessun IdC correlato al documento');
|
|
164
|
+
}
|
|
165
|
+
if (ue) {
|
|
166
|
+
ue.Metadata_ClearAll();
|
|
167
|
+
ue.TID = serachResultIdC.dtdResult.rows[0][0];
|
|
168
|
+
ue.DID = serachResultIdC.dtdResult.rows[0][1];
|
|
169
|
+
//Verifica dell'IdC
|
|
170
|
+
await ue.VerifySignAsync();
|
|
171
|
+
const signerInfoDescriptorIdC = await ue.GetSignersAsync();
|
|
172
|
+
//Controllo se marcato temporalmente
|
|
173
|
+
if (signerInfoDescriptorIdC) {
|
|
174
|
+
if (signerInfoDescriptorIdC.signers?.filter(s => s.isTimeStamp === true).length === 0) {
|
|
175
|
+
throw new Error('IdC non marcato temporalmente!');
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
else
|
|
179
|
+
throw new Error('IdC non firmato e non marcato temporalmente!');
|
|
180
|
+
//Ricerca dell'impronta SHA256 nel contenuto dell'IdC
|
|
181
|
+
let fileIdC = await SDK_Globals.tmSession?.NewSearchEngine().RetrieveFileAsync(serachResultIdC.dtdResult.rows[0][0], serachResultIdC.dtdResult.rows[0][1], rfo, abortController.signal, (pd) => {
|
|
182
|
+
if (firstBlock) {
|
|
183
|
+
maxFileSize = pd.ProgressBarMaximum ?? 0;
|
|
184
|
+
setWaitPanelMaxValueSecondary(maxFileSize);
|
|
185
|
+
firstBlock = false;
|
|
186
|
+
}
|
|
187
|
+
setWaitPanelValueSecondary(pd.ProgressBarValue);
|
|
188
|
+
setWaitPanelTextSecondary(`Downloading IdC... ${Globalization.getNumberDisplayValue(pd.ProgressBarValue, true)} / ${Globalization.getNumberDisplayValue(maxFileSize, true)}`);
|
|
189
|
+
if (pd.ProgressBarValue === pd.ProgressBarMaximum) {
|
|
190
|
+
setWaitPanelMaxValueSecondary(0);
|
|
191
|
+
setWaitPanelValueSecondary(0);
|
|
192
|
+
setWaitPanelTextSecondary('');
|
|
193
|
+
firstBlock = true;
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
let hashOk = false;
|
|
197
|
+
if (fileIdC) {
|
|
198
|
+
try {
|
|
199
|
+
const contenuto = await fileIdC.text();
|
|
200
|
+
if (contenuto && signerInfoDescriptor?.shA256) {
|
|
201
|
+
hashOk = contenuto.toLocaleUpperCase().includes(signerInfoDescriptor.shA256.toLocaleUpperCase());
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
catch (errDebug) {
|
|
205
|
+
throw new Error(`Errore nella lettura del file IdC: ${errDebug}`);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
if (!hashOk) {
|
|
209
|
+
throw new Error('Impronta non trovata nel file IdC o non corrispondente a quella del documento');
|
|
210
|
+
}
|
|
211
|
+
let file;
|
|
212
|
+
file = await SDK_Globals.tmSession?.NewSearchEngine().RetrieveFileAsync(inputDcmt.TID, inputDcmt.DID, rfo, abortController.signal, (pd) => {
|
|
213
|
+
if (firstBlock) {
|
|
214
|
+
maxFileSize = pd.ProgressBarMaximum ?? 0;
|
|
215
|
+
setWaitPanelMaxValueSecondary(maxFileSize);
|
|
216
|
+
firstBlock = false;
|
|
217
|
+
}
|
|
218
|
+
setWaitPanelValueSecondary(pd.ProgressBarValue);
|
|
219
|
+
setWaitPanelTextSecondary(`Downloading... ${Globalization.getNumberDisplayValue(pd.ProgressBarValue, true)} / ${Globalization.getNumberDisplayValue(maxFileSize, true)}`);
|
|
220
|
+
if (pd.ProgressBarValue === pd.ProgressBarMaximum) {
|
|
221
|
+
setWaitPanelMaxValueSecondary(0);
|
|
222
|
+
setWaitPanelValueSecondary(0);
|
|
223
|
+
setWaitPanelTextSecondary('');
|
|
224
|
+
firstBlock = true;
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
if (file && fileIdC) {
|
|
228
|
+
returnDcmtFiles.push(file);
|
|
229
|
+
returnDcmtInfos.push(inputDcmt);
|
|
230
|
+
returnDcmtFiles.push(fileIdC);
|
|
231
|
+
returnDcmtInfos.push({ ...inputDcmt, fileName: inputDcmt.fileName + "_IdC", FILEEXT: 'TXT.P7M.TSD' });
|
|
232
|
+
}
|
|
233
|
+
onFileDownloaded && await onFileDownloaded(returnDcmtFiles, returnDcmtInfos);
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
const zipGetName = async (operation, tid) => {
|
|
237
|
+
let nameZip = tid ? tid.toString() + ".zip" : operation.toString() + ".zip";
|
|
238
|
+
switch (operation) {
|
|
239
|
+
case DcmtOperationTypes.CopyCompliant:
|
|
240
|
+
nameZip = `Duplicato_Informatico_${tid ?? '1'}`;
|
|
241
|
+
break;
|
|
242
|
+
}
|
|
243
|
+
return nameZip.trim().toLowerCase().endsWith('.zip')
|
|
244
|
+
? nameZip.trim() : nameZip.trim() + '.zip';
|
|
245
|
+
};
|
|
246
|
+
const zipDocuments = async (zipEntries, typeOperation, tid, passwordZip) => {
|
|
247
|
+
if (zipEntries.length > 0) {
|
|
248
|
+
const zipFileName = await zipGetName(typeOperation, tid);
|
|
249
|
+
// Crea il blob ZIP
|
|
250
|
+
const zipBlob = await ZipManager.createZip(zipEntries, {
|
|
251
|
+
compressionLevel: 6,
|
|
252
|
+
password: passwordZip || undefined,
|
|
253
|
+
});
|
|
254
|
+
// Download zip nella cartella Downloads del browser
|
|
255
|
+
ZipManager.downloadBlob(zipBlob, zipFileName);
|
|
256
|
+
ShowAlert({ message: SDKUI_Localizator.ZipCreatedSavedInFolder.replaceParams(zipFileName, "Zip creato con successo"), mode: 'success', duration: 5000, title: SDKUI_Localizator.CompressToZipFile });
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
const _downloadDcmtsAsync = async (inputDcmts, downloadMode = "download", onFileDownloaded, skipConfirmation = false, retrieveOptions, useCache = true, showSuccessAlert = true, useInputFileName = false) => {
|
|
79
260
|
if (inputDcmts === undefined)
|
|
80
261
|
return;
|
|
81
262
|
if (inputDcmts.length <= 0)
|
|
@@ -159,7 +340,8 @@ export const useDcmtOperations = () => {
|
|
|
159
340
|
else {
|
|
160
341
|
const alink2 = document.createElement('a');
|
|
161
342
|
alink2.href = fileURL;
|
|
162
|
-
|
|
343
|
+
// Usa useInputFileName per determinare la priorità del nome file
|
|
344
|
+
alink2.download = getDownloadFileName(file, inputDcmts[i], useInputFileName);
|
|
163
345
|
alink2.target = "_blank";
|
|
164
346
|
alink2.rel = "noreferrer";
|
|
165
347
|
alink2.click();
|
|
@@ -251,11 +433,14 @@ export const useDcmtOperations = () => {
|
|
|
251
433
|
TMExceptionBoxManager.show({ exception: err });
|
|
252
434
|
}
|
|
253
435
|
};
|
|
254
|
-
const downloadDcmtsAsync = async (
|
|
436
|
+
const downloadDcmtsAsync = async (params) => {
|
|
437
|
+
const { inputDcmts, downloadType = DownloadTypes.Attachment, downloadMode = "download", onFileDownloaded, confirmAttachments, skipConfirmation = false, retrieveOptions, useCache = true, showSuccessAlert = true, useInputFileName = false, // Default: usa il nome dal backend
|
|
438
|
+
} = params;
|
|
255
439
|
switch (downloadType) {
|
|
256
|
-
|
|
440
|
+
// Per il download di documenti, passa useInputFileName per controllare la priorità del nome
|
|
441
|
+
case DownloadTypes.Dcmt: return await _downloadDcmtsAsync(inputDcmts, downloadMode, onFileDownloaded, skipConfirmation, retrieveOptions, useCache, showSuccessAlert, useInputFileName);
|
|
257
442
|
case DownloadTypes.Attachment: return await _downloadAttachmentsAsync(inputDcmts, confirmAttachments, showSuccessAlert);
|
|
258
|
-
default: return await _downloadDcmtsAsync(inputDcmts, undefined, undefined, skipConfirmation, retrieveOptions, useCache, showSuccessAlert);
|
|
443
|
+
default: return await _downloadDcmtsAsync(inputDcmts, undefined, undefined, skipConfirmation, retrieveOptions, useCache, showSuccessAlert, useInputFileName);
|
|
259
444
|
}
|
|
260
445
|
};
|
|
261
446
|
const uploadDcmtsAsync = async (inputDcmts, operationTitle, operType, actionAfterOperationAsync) => {
|
|
@@ -481,6 +666,7 @@ export const useDcmtOperations = () => {
|
|
|
481
666
|
await uploadDcmtsAsync(inputDcmts, operationTitle, undefined, actionAfterOperationAsync);
|
|
482
667
|
return;
|
|
483
668
|
}
|
|
669
|
+
let zipEntries = [];
|
|
484
670
|
setShowWaitPanel(true);
|
|
485
671
|
setShowPrimary(true);
|
|
486
672
|
setShowSecondary(false);
|
|
@@ -529,6 +715,23 @@ export const useDcmtOperations = () => {
|
|
|
529
715
|
}
|
|
530
716
|
break;
|
|
531
717
|
}
|
|
718
|
+
case DcmtOperationTypes.CopyCompliant:
|
|
719
|
+
const collectFileForZip = async (file, dcmtInfo) => {
|
|
720
|
+
if (file.length !== dcmtInfo.length) {
|
|
721
|
+
console.warn(`Numero di file (${file.length}) e documenti (${dcmtInfo.length}) non corrispondono. Impossibile associare correttamente i file ai documenti per la creazione dello zip.`);
|
|
722
|
+
return;
|
|
723
|
+
}
|
|
724
|
+
for (let j = 0; j < file.length; j++) {
|
|
725
|
+
let targetFileName = await generateTargetFileName(file[j], dcmtInfo[j], {
|
|
726
|
+
fileNamingMode: 'documentTypeAndDid',
|
|
727
|
+
separatorChar: '_',
|
|
728
|
+
});
|
|
729
|
+
targetFileName = targetFileName.replace(/\.xml\.p7m\.tsd$/i, '_IdC.XML.P7M.TSD');
|
|
730
|
+
zipEntries.push({ filename: targetFileName, data: file[j] });
|
|
731
|
+
}
|
|
732
|
+
};
|
|
733
|
+
await copyCompliantDcmtsAsync(inputDcmts[i], collectFileForZip);
|
|
734
|
+
break;
|
|
532
735
|
case DcmtOperationTypes.CheckFile:
|
|
533
736
|
await SDK_Globals.tmSession?.NewSearchEngine().CheckFileAsync(inputDcmts[i].TID, inputDcmts[i].DID);
|
|
534
737
|
break;
|
|
@@ -581,7 +784,12 @@ export const useDcmtOperations = () => {
|
|
|
581
784
|
result.push({ rowIndex: i, id1: inputDcmts[i].TID, id2: inputDcmts[i].DID, resultType: ResultTypes.SUCCESS });
|
|
582
785
|
}
|
|
583
786
|
catch (ex) {
|
|
584
|
-
|
|
787
|
+
let msg = getExceptionMessage(ex);
|
|
788
|
+
if (msg.startsWith('WARNING#')) {
|
|
789
|
+
result.push({ rowIndex: i, id1: inputDcmts[i].TID, id2: inputDcmts[i].DID, resultType: ResultTypes.WARNING, description: msg.replace('WARNING#', '') });
|
|
790
|
+
}
|
|
791
|
+
else
|
|
792
|
+
result.push({ rowIndex: i, id1: inputDcmts[i].TID, id2: inputDcmts[i].DID, resultType: ResultTypes.ERROR, description: msg });
|
|
585
793
|
const err = ex;
|
|
586
794
|
if (err.name === 'CanceledError') {
|
|
587
795
|
ShowAlert({ message: err.message, mode: 'warning', duration: 3000, title: 'Abort' });
|
|
@@ -589,6 +797,9 @@ export const useDcmtOperations = () => {
|
|
|
589
797
|
}
|
|
590
798
|
setWaitPanelValuePrimary(i + 1);
|
|
591
799
|
}
|
|
800
|
+
if (zipEntries.length > 0) {
|
|
801
|
+
await zipDocuments(zipEntries, dcmtOperationType, inputDcmts[0].TID);
|
|
802
|
+
}
|
|
592
803
|
setWaitPanelMaxValuePrimary(0);
|
|
593
804
|
setWaitPanelValuePrimary(0);
|
|
594
805
|
setWaitPanelTextPrimary('');
|
|
@@ -210,6 +210,14 @@ export const useDocumentOperations = (props) => {
|
|
|
210
210
|
const isDisabledForMultiRow = () => {
|
|
211
211
|
return selectedDcmtInfos.length === 0 || selectedDcmtInfos.every(d => d.TID === undefined || d.DID === undefined);
|
|
212
212
|
};
|
|
213
|
+
const isDisabledForMultiRowCopyCompliant = () => {
|
|
214
|
+
let isNotSeletced = selectedDcmtInfos.length === 0 || selectedDcmtInfos.every(d => d.TID === undefined || d.DID === undefined);
|
|
215
|
+
if (isNotSeletced)
|
|
216
|
+
return true;
|
|
217
|
+
let isOnlyMetadata = selectedDcmtInfos.filter(d => d.FILEEXT === null).length === selectedDcmtInfos.length;
|
|
218
|
+
let isAllNotIsLex = selectedItemsFull.filter(d => d.ISLEX === null).length === selectedDcmtInfos.length;
|
|
219
|
+
return isOnlyMetadata || isAllNotIsLex;
|
|
220
|
+
};
|
|
213
221
|
const onRefreshBlog = async () => {
|
|
214
222
|
await onRefreshBlogForm?.();
|
|
215
223
|
await onRefreshBlogDatagrid?.();
|
|
@@ -475,7 +483,7 @@ export const useDocumentOperations = (props) => {
|
|
|
475
483
|
icon: _jsx(IconDownload, {}),
|
|
476
484
|
operationType: 'multiRow',
|
|
477
485
|
disabled: dtd?.perm?.canRetrieveFile !== AccessLevels.Yes ? true : isDisabledForMultiRow(),
|
|
478
|
-
name: SDKUI_Localizator.DownloadFile, onClick: () => downloadDcmtsAsync(selectedDcmtInfos, DownloadTypes.Dcmt, "download",
|
|
486
|
+
name: SDKUI_Localizator.DownloadFile, onClick: () => downloadDcmtsAsync({ inputDcmts: selectedDcmtInfos, downloadType: DownloadTypes.Dcmt, downloadMode: "download", skipConfirmation: true })
|
|
479
487
|
};
|
|
480
488
|
};
|
|
481
489
|
const downloadXMLAttachmentsMenuItem = () => {
|
|
@@ -484,7 +492,7 @@ export const useDocumentOperations = (props) => {
|
|
|
484
492
|
icon: _jsx(IconDownload, {}),
|
|
485
493
|
operationType: 'singleRow',
|
|
486
494
|
disabled: !isXMLFileExt(selectedDcmtInfos?.[0]?.FILEEXT) ? true : isDisabledForSingleRow(),
|
|
487
|
-
name: SDKUI_Localizator.DownloadXMLAttachments, onClick: () => downloadDcmtsAsync(selectedDcmtInfos, DownloadTypes.Attachment, "download",
|
|
495
|
+
name: SDKUI_Localizator.DownloadXMLAttachments, onClick: () => downloadDcmtsAsync({ inputDcmts: selectedDcmtInfos, downloadType: DownloadTypes.Attachment, downloadMode: "download", confirmAttachments: openConfirmAttachmentsDialog, skipConfirmation: true })
|
|
488
496
|
};
|
|
489
497
|
};
|
|
490
498
|
const duplicateDocumentMenuItem = () => {
|
|
@@ -691,7 +699,7 @@ export const useDocumentOperations = (props) => {
|
|
|
691
699
|
rfo.cvtFormat = FileFormats.PDF;
|
|
692
700
|
rfo.invoiceRetrieveFormat = SDKUI_Globals.userSettings?.searchSettings.invoiceRetrieveFormat;
|
|
693
701
|
rfo.orderRetrieveFormat = SDKUI_Globals.userSettings?.searchSettings.orderRetrieveFormat;
|
|
694
|
-
await downloadDcmtsAsync(selectedDcmtInfos, DownloadTypes.Dcmt, "download", handlePrint,
|
|
702
|
+
await downloadDcmtsAsync({ inputDcmts: selectedDcmtInfos, downloadType: DownloadTypes.Dcmt, downloadMode: "download", onFileDownloaded: handlePrint, skipConfirmation: true, retrieveOptions: rfo, useCache: true, showSuccessAlert: false });
|
|
695
703
|
};
|
|
696
704
|
return {
|
|
697
705
|
id: 'print',
|
|
@@ -807,6 +815,16 @@ export const useDocumentOperations = (props) => {
|
|
|
807
815
|
],
|
|
808
816
|
};
|
|
809
817
|
};
|
|
818
|
+
const copyCompliantMenuItem = () => {
|
|
819
|
+
return {
|
|
820
|
+
id: 'copy-compliant',
|
|
821
|
+
icon: _jsx(IconCopy, {}),
|
|
822
|
+
name: SDKUI_Localizator.CopyCompliant,
|
|
823
|
+
operationType: 'multiRow',
|
|
824
|
+
disabled: isDisabledForMultiRowCopyCompliant(),
|
|
825
|
+
onClick: async () => { await runOperationAsync(selectedDcmtInfos, DcmtOperationTypes.CopyCompliant); }
|
|
826
|
+
};
|
|
827
|
+
};
|
|
810
828
|
const copyToFolderMenuItem = () => {
|
|
811
829
|
return {
|
|
812
830
|
id: 'copy-to-folder',
|
|
@@ -1153,6 +1171,7 @@ export const useDocumentOperations = (props) => {
|
|
|
1153
1171
|
downloadFileMenuItem(),
|
|
1154
1172
|
downloadXMLAttachmentsMenuItem(),
|
|
1155
1173
|
duplicateDocumentMenuItem(),
|
|
1174
|
+
copyCompliantMenuItem(),
|
|
1156
1175
|
batchUpdateMenuItem(),
|
|
1157
1176
|
passToArchive(),
|
|
1158
1177
|
...(selectedDcmtInfos.length > 0 && isPdfEditorAvailable(dtd, selectedDcmtInfos[0]?.FILEEXT) && onOpenPdfEditorRequest ? [pdfEditorMenuItem(onOpenPdfEditorRequest)] : []),
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { JobTypes, ObjectClasses, ProcessDescriptor, DcmtTypeDescriptor } from "@topconsultnpm/sdk-ts";
|
|
2
2
|
export declare class PlatformObjectService {
|
|
3
|
-
static readonly retrieveAllAsync: (objClass: ObjectClasses, refreshCache?: boolean) => Promise<import("@topconsultnpm/sdk-ts").
|
|
4
|
-
static readonly retrieveAsync: (objClass: ObjectClasses, id: number) => Promise<import("@topconsultnpm/sdk-ts").
|
|
3
|
+
static readonly retrieveAllAsync: (objClass: ObjectClasses, refreshCache?: boolean) => Promise<import("@topconsultnpm/sdk-ts").RelationDescriptor[] | import("@topconsultnpm/sdk-ts").AreaDescriptor[] | import("@topconsultnpm/sdk-ts").NotificationDescriptor[] | import("@topconsultnpm/sdk-ts").TaskDescriptor[] | import("@topconsultnpm/sdk-ts").WorkingGroupDescriptor[] | undefined>;
|
|
4
|
+
static readonly retrieveAsync: (objClass: ObjectClasses, id: number) => Promise<import("@topconsultnpm/sdk-ts").RelationDescriptor | import("@topconsultnpm/sdk-ts").AreaDescriptor | import("@topconsultnpm/sdk-ts").BasketTypeDescriptor | import("@topconsultnpm/sdk-ts").NotificationDescriptor | import("@topconsultnpm/sdk-ts").TaskDescriptor | import("@topconsultnpm/sdk-ts").WorkingGroupDescriptor | undefined>;
|
|
5
5
|
private static readonly retrieveAllAdminJobsAsync;
|
|
6
|
-
static readonly retrieveAllAdminAsync: (objClass: ObjectClasses, jobType?: JobTypes) => Promise<import("@topconsultnpm/sdk-ts").UserDescriptor[] |
|
|
6
|
+
static readonly retrieveAllAdminAsync: (objClass: ObjectClasses, jobType?: JobTypes) => Promise<import("@topconsultnpm/sdk-ts").UserDescriptor[] | import("@topconsultnpm/sdk-ts").RelationDescriptor[] | import("@topconsultnpm/sdk-ts").GroupDescriptor[] | DcmtTypeDescriptor[] | import("@topconsultnpm/sdk-ts").AreaDescriptor[] | import("@topconsultnpm/sdk-ts").FEDistillerJobDescriptor[] | import("@topconsultnpm/sdk-ts").DataListDescriptor[] | import("@topconsultnpm/sdk-ts").DiskDescriptor[] | import("@topconsultnpm/sdk-ts").LDAPDescriptor[] | import("@topconsultnpm/sdk-ts").NumeratorDescriptor[] | ProcessDescriptor[] | import("@topconsultnpm/sdk-ts").SAPLoginDescriptor[] | import("@topconsultnpm/sdk-ts").SignCertDescriptor[] | import("@topconsultnpm/sdk-ts").SignServerDescriptor[] | import("@topconsultnpm/sdk-ts").TreeDescriptor[] | import("@topconsultnpm/sdk-ts").TSADescriptor[] | import("@topconsultnpm/sdk-ts").WFDescriptor[] | undefined>;
|
|
7
7
|
private static readonly loadCacheForJobAsync;
|
|
8
8
|
private static readonly retrieveAdminJobAsync;
|
|
9
|
-
static readonly retrieveAdminAsync: (objClass: ObjectClasses, jobType: JobTypes, id: number) => Promise<import("@topconsultnpm/sdk-ts").UserDescriptor | import("@topconsultnpm/sdk-ts").WFDescriptor | DcmtTypeDescriptor | import("@topconsultnpm/sdk-ts").
|
|
9
|
+
static readonly retrieveAdminAsync: (objClass: ObjectClasses, jobType: JobTypes, id: number) => Promise<import("@topconsultnpm/sdk-ts").UserDescriptor | import("@topconsultnpm/sdk-ts").WFDescriptor | DcmtTypeDescriptor | import("@topconsultnpm/sdk-ts").DataListDescriptor | import("@topconsultnpm/sdk-ts").RelationDescriptor | import("@topconsultnpm/sdk-ts").GroupDescriptor | import("@topconsultnpm/sdk-ts").SavedQueryDescriptor | import("@topconsultnpm/sdk-ts").AreaDescriptor | import("@topconsultnpm/sdk-ts").BasketTypeDescriptor | import("@topconsultnpm/sdk-ts").TaskDescriptor | import("@topconsultnpm/sdk-ts").WorkingGroupDescriptor | import("@topconsultnpm/sdk-ts").BarcodeArchiverJobDescriptor | import("@topconsultnpm/sdk-ts").BatchUpdaterJobDescriptor | import("@topconsultnpm/sdk-ts").CassettoDoganaleJobDescriptor | import("@topconsultnpm/sdk-ts").CassettoDoganalePlusJobDescriptor | import("@topconsultnpm/sdk-ts").CassettoDoganaleDistillerJobDescriptor | import("@topconsultnpm/sdk-ts").CassettoFiscaleQueryJobDescriptor | import("@topconsultnpm/sdk-ts").CassettoFiscaleSenderJobDescriptor | import("@topconsultnpm/sdk-ts").CheckSequenceJobDescriptor | import("@topconsultnpm/sdk-ts").COSCheckerJobDescriptor | import("@topconsultnpm/sdk-ts").DcmtConverterJobDescriptor | import("@topconsultnpm/sdk-ts").DcmtCreatorJobDescriptor | import("@topconsultnpm/sdk-ts").DcmtDeleterJobDescriptor | import("@topconsultnpm/sdk-ts").DcmtNoteJobDescriptor | import("@topconsultnpm/sdk-ts").DcmtPrinterJobDescriptor | import("@topconsultnpm/sdk-ts").FEAttacherJobDescriptor | import("@topconsultnpm/sdk-ts").FECreatorTxtJobDescriptor | import("@topconsultnpm/sdk-ts").FEDetacherJobDescriptor | import("@topconsultnpm/sdk-ts").FEDistillerJobDescriptor | import("@topconsultnpm/sdk-ts").FESenderWsJobDescriptor | import("@topconsultnpm/sdk-ts").FESplitterJobDescriptor | import("@topconsultnpm/sdk-ts").FEValidatorJobDescriptor | import("@topconsultnpm/sdk-ts").FileArchiverJobDescriptor | import("@topconsultnpm/sdk-ts").FileCheckerJobDescriptor | import("@topconsultnpm/sdk-ts").FileExecJobDescriptor | import("@topconsultnpm/sdk-ts").FileExportJobDescriptor | import("@topconsultnpm/sdk-ts").FileMoverJobDescriptor | import("@topconsultnpm/sdk-ts").LexJobDescriptor | import("@topconsultnpm/sdk-ts").LinkerJobDescriptor | import("@topconsultnpm/sdk-ts").MailArchiverJobDescriptor | import("@topconsultnpm/sdk-ts").MailQueryJobDescriptor | import("@topconsultnpm/sdk-ts").MailSenderJobDescriptor | import("@topconsultnpm/sdk-ts").MigrationJobDescriptor | import("@topconsultnpm/sdk-ts").OcrSixJobDescriptor | import("@topconsultnpm/sdk-ts").PdDCreatorJobDescriptor | import("@topconsultnpm/sdk-ts").PDFArchiverJobDescriptor | import("@topconsultnpm/sdk-ts").PdVArchiverJobDescriptor | import("@topconsultnpm/sdk-ts").PdVQueryJobDescriptor | import("@topconsultnpm/sdk-ts").PdVSenderJobDescriptor | import("@topconsultnpm/sdk-ts").PeppolQueryJobDescriptor | import("@topconsultnpm/sdk-ts").PeppolSenderJobDescriptor | import("@topconsultnpm/sdk-ts").PostelQueryJobDescriptor | import("@topconsultnpm/sdk-ts").PostelSenderJobDescriptor | import("@topconsultnpm/sdk-ts").ReplicatorJobDescriptor | import("@topconsultnpm/sdk-ts").SAPAlignerJobDescriptor | import("@topconsultnpm/sdk-ts").SAPBarcodeJobDescriptor | import("@topconsultnpm/sdk-ts").SAPDataReaderJobDescriptor | import("@topconsultnpm/sdk-ts").SAPDataWriterJobDescriptor | import("@topconsultnpm/sdk-ts").SignerJobDescriptor | import("@topconsultnpm/sdk-ts").SpoolArchiverJobDescriptor | import("@topconsultnpm/sdk-ts").UpdaterJobDescriptor | import("@topconsultnpm/sdk-ts").DiskDescriptor | import("@topconsultnpm/sdk-ts").LDAPDescriptor | import("@topconsultnpm/sdk-ts").NumeratorDescriptor | ProcessDescriptor | import("@topconsultnpm/sdk-ts").SAPLoginDescriptor | import("@topconsultnpm/sdk-ts").SignCertDescriptor | import("@topconsultnpm/sdk-ts").SignServerDescriptor | import("@topconsultnpm/sdk-ts").TreeDescriptor | import("@topconsultnpm/sdk-ts").TSADescriptor | undefined>;
|
|
10
10
|
private static readonly updateJobAsync;
|
|
11
11
|
static readonly updateAsync: (objClass: ObjectClasses, jobType: JobTypes, d: any, ...args: any[]) => Promise<number | undefined>;
|
|
12
12
|
private static readonly createJobAsync;
|
package/lib/ts/types.d.ts
CHANGED
package/lib/ts/types.js
CHANGED
|
@@ -39,6 +39,7 @@ export var DcmtOperationTypes;
|
|
|
39
39
|
DcmtOperationTypes[DcmtOperationTypes["FreeSearchPurge"] = 13] = "FreeSearchPurge";
|
|
40
40
|
DcmtOperationTypes[DcmtOperationTypes["BatchUpdate"] = 14] = "BatchUpdate";
|
|
41
41
|
DcmtOperationTypes[DcmtOperationTypes["RemoveFromWorkgroup"] = 15] = "RemoveFromWorkgroup";
|
|
42
|
+
DcmtOperationTypes[DcmtOperationTypes["CopyCompliant"] = 16] = "CopyCompliant";
|
|
42
43
|
})(DcmtOperationTypes || (DcmtOperationTypes = {}));
|
|
43
44
|
export var DownloadTypes;
|
|
44
45
|
(function (DownloadTypes) {
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@topconsultnpm/sdkui-react",
|
|
3
|
-
"version": "6.21.0-dev3.
|
|
3
|
+
"version": "6.21.0-dev3.41",
|
|
4
4
|
"description": "",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
7
|
-
"clean": "
|
|
8
|
-
"copy-files": "
|
|
7
|
+
"clean": "node -e \"const fs=require('fs');fs.rmSync('lib',{recursive:true,force:true});fs.mkdirSync('lib')\"",
|
|
8
|
+
"copy-files": "cpx \"src/{assets/*.*,assets/ImageLibrary/*.*,assets/thumbnails/*.*,assets/IconsS4t/*.*,assets/Metadata/*.*,css/tm-sdkui.css}\" lib",
|
|
9
9
|
"tm-build": "npm run clean && tsc && npm run copy-files",
|
|
10
10
|
"tm-watch": "tsc -w",
|
|
11
11
|
"tm-publish": "npm publish --tag latest",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"@types/node": "^24.12.2",
|
|
25
25
|
"@types/react": "^18.3.3",
|
|
26
26
|
"@types/react-dom": "^18.3.3",
|
|
27
|
-
"
|
|
27
|
+
"cpx2": "^9.0.0",
|
|
28
28
|
"esbuild": "^0.25.0",
|
|
29
29
|
"react": "^18.3.1",
|
|
30
30
|
"react-dom": "^18.3.1",
|
|
@@ -40,12 +40,12 @@
|
|
|
40
40
|
"lib"
|
|
41
41
|
],
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@topconsultnpm/sdk-ts": "6.21.0-
|
|
43
|
+
"@topconsultnpm/sdk-ts": "6.21.0-dev3.6",
|
|
44
44
|
"@zip.js/zip.js": "2.8.26",
|
|
45
45
|
"buffer": "^6.0.3",
|
|
46
46
|
"devextreme": "^25.2.6",
|
|
47
|
+
"devextreme-exceljs-fork": "^4.4.10",
|
|
47
48
|
"devextreme-react": "^25.2.6",
|
|
48
|
-
"exceljs": "^4.4.0",
|
|
49
49
|
"htmlparser2": "^10.0.0",
|
|
50
50
|
"pdf-lib": "^1.17.1",
|
|
51
51
|
"react-pdf": "^10.4.1",
|
|
@@ -53,6 +53,12 @@
|
|
|
53
53
|
"styled-components": "^6.1.1"
|
|
54
54
|
},
|
|
55
55
|
"overrides": {
|
|
56
|
-
"esbuild": "^0.25.0"
|
|
56
|
+
"esbuild": "^0.25.0",
|
|
57
|
+
"devextreme-exceljs-fork": {
|
|
58
|
+
"archiver": "^8.0.0"
|
|
59
|
+
},
|
|
60
|
+
"quill-delta": {
|
|
61
|
+
"lodash.isequal": "npm:fast-deep-equal@^3.1.3"
|
|
62
|
+
}
|
|
57
63
|
}
|
|
58
64
|
}
|