@topconsultnpm/sdkui-react 6.21.0-dev2.42 → 6.21.0-dev2.44
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/features/documents/TMCopyToFolderForm.js +36 -36
- package/lib/components/features/documents/TMMergeToPdfForm.js +30 -32
- package/lib/helper/SDKUI_Localizator.d.ts +48 -2
- package/lib/helper/SDKUI_Localizator.js +484 -12
- package/lib/hooks/useDocumentOperations.js +5 -5
- package/package.json +1 -1
|
@@ -46,21 +46,21 @@ const TMCopyToFolderForm = ({ mode, selectedDcmtInfos, onClose, showTMRelationVi
|
|
|
46
46
|
const getTitle = () => {
|
|
47
47
|
const count = ` (${selectedDcmtInfos.length})`;
|
|
48
48
|
const modeLabelMap = {
|
|
49
|
-
onlySelected:
|
|
50
|
-
customized:
|
|
49
|
+
onlySelected: SDKUI_Localizator.SelectedDocuments,
|
|
50
|
+
customized: SDKUI_Localizator.SelectedDocumentsAndRelated,
|
|
51
51
|
};
|
|
52
52
|
const modeLabel = modeLabelMap[mode] || modeLabelMap.onlySelected;
|
|
53
|
-
return
|
|
53
|
+
return `${SDKUI_Localizator.CopyToFolder} - ${modeLabel}${count}`;
|
|
54
54
|
};
|
|
55
55
|
const isUsingDefaultDownloads = settings.destinationFolder === 'Download' && !folderHandleRef.current;
|
|
56
56
|
// ---- Validazione ----
|
|
57
57
|
const folderValidationItems = [];
|
|
58
58
|
if (settings.exportMode === 'copy' && !settings.destinationFolder.trim()) {
|
|
59
|
-
folderValidationItems.push(new ValidationItem(ResultTypes.ERROR,
|
|
59
|
+
folderValidationItems.push(new ValidationItem(ResultTypes.ERROR, SDKUI_Localizator.Path, SDKUI_Localizator.RequiredField));
|
|
60
60
|
}
|
|
61
61
|
const zipValidationItems = [];
|
|
62
62
|
if (settings.exportMode === 'zip' && !settings.zipFileName.trim()) {
|
|
63
|
-
zipValidationItems.push(new ValidationItem(ResultTypes.ERROR,
|
|
63
|
+
zipValidationItems.push(new ValidationItem(ResultTypes.ERROR, SDKUI_Localizator.ZipFileName, SDKUI_Localizator.RequiredField));
|
|
64
64
|
}
|
|
65
65
|
const isFormValid = () => {
|
|
66
66
|
if (settings.exportMode === 'copy')
|
|
@@ -89,7 +89,7 @@ const TMCopyToFolderForm = ({ mode, selectedDcmtInfos, onClose, showTMRelationVi
|
|
|
89
89
|
}
|
|
90
90
|
catch (err) {
|
|
91
91
|
if (err.name !== 'AbortError') {
|
|
92
|
-
console.error('
|
|
92
|
+
console.error('Error selecting folder:', err);
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
finally {
|
|
@@ -149,16 +149,16 @@ const TMCopyToFolderForm = ({ mode, selectedDcmtInfos, onClose, showTMRelationVi
|
|
|
149
149
|
// ---- Esecuzione (Copia oppure ZIP) ----
|
|
150
150
|
const run = async () => {
|
|
151
151
|
if (settings.exportMode === 'copy' && folderValidationItems.length > 0) {
|
|
152
|
-
TMMessageBoxManager.show({ message:
|
|
152
|
+
TMMessageBoxManager.show({ message: SDKUI_Localizator.PleaseCorrectErrorsBeforeProceeding, buttons: [ButtonNames.OK] });
|
|
153
153
|
return;
|
|
154
154
|
}
|
|
155
155
|
if (settings.exportMode === 'zip' && zipValidationItems.length > 0) {
|
|
156
|
-
TMMessageBoxManager.show({ message:
|
|
156
|
+
TMMessageBoxManager.show({ message: SDKUI_Localizator.PleaseCorrectErrorsBeforeProceeding, buttons: [ButtonNames.OK] });
|
|
157
157
|
return;
|
|
158
158
|
}
|
|
159
159
|
const dcmtInfosToDownload = getDcmtInfosToDownload(selectedDcmtInfos, selectedItemsRelationViewer, showTMRelationViewer);
|
|
160
160
|
if (dcmtInfosToDownload.length === 0) {
|
|
161
|
-
TMMessageBoxManager.show({ message:
|
|
161
|
+
TMMessageBoxManager.show({ message: SDKUI_Localizator.NoDocumentsSelected, buttons: [ButtonNames.OK] });
|
|
162
162
|
return;
|
|
163
163
|
}
|
|
164
164
|
const retrieveOptions = new RetrieveFileOptions();
|
|
@@ -209,21 +209,24 @@ const TMCopyToFolderForm = ({ mode, selectedDcmtInfos, onClose, showTMRelationVi
|
|
|
209
209
|
const writable = await fileHandle.createWritable();
|
|
210
210
|
await writable.write(zipBlob);
|
|
211
211
|
await writable.close();
|
|
212
|
+
ShowAlert({ message: SDKUI_Localizator.ZipCreatedSavedInFolder.replaceParams(finalZipFileName, folderHandleRef.current.name), mode: 'success', duration: 5000, title: SDKUI_Localizator.CompressToZipFile });
|
|
212
213
|
}
|
|
213
214
|
catch (err) {
|
|
214
|
-
console.error('
|
|
215
|
+
console.error('Error saving ZIP to folder, fallback to standard download:', err);
|
|
215
216
|
// Fallback: download standard del browser
|
|
216
217
|
ZipManager.downloadBlob(zipBlob, zipFileName);
|
|
218
|
+
ShowAlert({ message: SDKUI_Localizator.ZipCreatedSavedInFolder.replaceParams(zipFileName, "Download"), mode: 'success', duration: 5000, title: SDKUI_Localizator.CompressToZipFile });
|
|
217
219
|
}
|
|
218
220
|
}
|
|
219
221
|
else {
|
|
220
222
|
// Se non c'è un handle della cartella: download zip standard del browser
|
|
221
223
|
ZipManager.downloadBlob(zipBlob, zipFileName);
|
|
224
|
+
ShowAlert({ message: SDKUI_Localizator.ZipCreatedSavedInFolder.replaceParams(zipFileName, "Download"), mode: 'success', duration: 5000, title: SDKUI_Localizator.CompressToZipFile });
|
|
222
225
|
}
|
|
223
226
|
}
|
|
224
227
|
}
|
|
225
228
|
else {
|
|
226
|
-
TMMessageBoxManager.show({ message:
|
|
229
|
+
TMMessageBoxManager.show({ message: SDKUI_Localizator.ExportModeNotSupported, buttons: [ButtonNames.OK] });
|
|
227
230
|
return;
|
|
228
231
|
}
|
|
229
232
|
onClose();
|
|
@@ -236,7 +239,7 @@ const TMCopyToFolderForm = ({ mode, selectedDcmtInfos, onClose, showTMRelationVi
|
|
|
236
239
|
const hasChanges = JSON.stringify(settings) !== JSON.stringify(defaults);
|
|
237
240
|
if (hasChanges) {
|
|
238
241
|
setHasSavedLayout(true);
|
|
239
|
-
ShowAlert({ mode: 'success', message:
|
|
242
|
+
ShowAlert({ mode: 'success', message: SDKUI_Localizator.OperationSuccess, title: SDKUI_Localizator.Save, duration: 3000 });
|
|
240
243
|
}
|
|
241
244
|
};
|
|
242
245
|
const removeLayout = () => {
|
|
@@ -245,7 +248,7 @@ const TMCopyToFolderForm = ({ mode, selectedDcmtInfos, onClose, showTMRelationVi
|
|
|
245
248
|
setSettings(defaults);
|
|
246
249
|
folderHandleRef.current = null;
|
|
247
250
|
setHasSavedLayout(false);
|
|
248
|
-
ShowAlert({ mode: 'success', message:
|
|
251
|
+
ShowAlert({ mode: 'success', message: SDKUI_Localizator.OperationSuccess, title: SDKUI_Localizator.Remove, duration: 3000 });
|
|
249
252
|
};
|
|
250
253
|
const isLayoutSameAsSaved = () => {
|
|
251
254
|
const saved = SDKUI_Globals.userSettings.documentDownloadSettings;
|
|
@@ -268,10 +271,7 @@ const TMCopyToFolderForm = ({ mode, selectedDcmtInfos, onClose, showTMRelationVi
|
|
|
268
271
|
display: 'flex',
|
|
269
272
|
flexDirection: 'column',
|
|
270
273
|
boxSizing: 'border-box'
|
|
271
|
-
}, children: [_jsx("span", { style: {
|
|
272
|
-
...getFloatingLabelStyle(),
|
|
273
|
-
fontWeight: 600
|
|
274
|
-
}, children: "Parametri di configurazione" }), _jsxs("div", { style: {
|
|
274
|
+
}, children: [_jsx("span", { style: { ...getFloatingLabelStyle(), fontWeight: 600 }, children: SDKUI_Localizator.ConfigurationParameters }), _jsxs("div", { style: {
|
|
275
275
|
position: 'absolute',
|
|
276
276
|
top: '-8px',
|
|
277
277
|
right: '12px',
|
|
@@ -281,31 +281,31 @@ const TMCopyToFolderForm = ({ mode, selectedDcmtInfos, onClose, showTMRelationVi
|
|
|
281
281
|
backgroundColor: 'white',
|
|
282
282
|
padding: '0 4px',
|
|
283
283
|
zIndex: 1
|
|
284
|
-
}, children: [_jsx(TMButton, { btnStyle: "toolbar", icon: _jsx(IconSave, {}), caption:
|
|
284
|
+
}, children: [_jsx(TMButton, { btnStyle: "toolbar", icon: _jsx(IconSave, {}), caption: SDKUI_Localizator.SaveLayout, color: "success", disabled: isLayoutSameAsSaved(), onClick: saveLayout }), hasSavedLayout && (_jsx(TMButton, { btnStyle: "toolbar", icon: _jsx(IconDelete, {}), caption: SDKUI_Localizator.RemoveLayout, color: "error", onClick: removeLayout }))] }), _jsxs("div", { style: {
|
|
285
285
|
display: 'flex',
|
|
286
286
|
flexDirection: 'column',
|
|
287
287
|
flex: 1,
|
|
288
288
|
overflowY: 'auto',
|
|
289
289
|
minHeight: 0,
|
|
290
290
|
}, children: [_jsx("div", { style: { display: 'flex', justifyContent: 'center', alignItems: 'center' }, children: _jsx(TMRadioButton, { dataSource: [
|
|
291
|
-
{ value: 'copy', display:
|
|
292
|
-
{ value: 'zip', display:
|
|
293
|
-
], value: settings.exportMode, direction: "row", onValueChanged: (value) => updateSettings('exportMode', value) }) }), isDirectoryPickerSupported() ? (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '4px' }, children: [_jsx(TMTextBox, { label:
|
|
291
|
+
{ value: 'copy', display: SDKUI_Localizator.CopyToFolder },
|
|
292
|
+
{ value: 'zip', display: SDKUI_Localizator.CompressToZipFile }
|
|
293
|
+
], value: settings.exportMode, direction: "row", onValueChanged: (value) => updateSettings('exportMode', value) }) }), isDirectoryPickerSupported() ? (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '4px' }, children: [_jsx(TMTextBox, { label: SDKUI_Localizator.Path, value: settings.destinationFolder, validationItems: folderValidationItems, onValueChanged: handleFolderValueChange, readOnly: true, placeHolder: "Download", onClick: handleSelectFolder, buttons: [
|
|
294
294
|
{
|
|
295
295
|
icon: _jsx(IconFolderOpen, {}),
|
|
296
|
-
text:
|
|
296
|
+
text: SDKUI_Localizator.SelectFolder,
|
|
297
297
|
onClick: handleSelectFolder
|
|
298
298
|
},
|
|
299
299
|
...(!isUsingDefaultDownloads ? [{
|
|
300
300
|
icon: _jsx(IconUndo, {}),
|
|
301
|
-
text:
|
|
301
|
+
text: SDKUI_Localizator.RestoreDownload,
|
|
302
302
|
onClick: () => {
|
|
303
303
|
skipSelectFolderRef.current = true;
|
|
304
304
|
updateSettings('destinationFolder', 'Download');
|
|
305
305
|
folderHandleRef.current = null;
|
|
306
306
|
}
|
|
307
307
|
}] : [])
|
|
308
|
-
] }), SDKUI_Globals.userSettings.documentDownloadSettings?.destinationFolder && (_jsxs("span", { style: { fontSize: '0.8rem', color: '#666', fontStyle: 'italic' }, children: ["
|
|
308
|
+
] }), SDKUI_Globals.userSettings.documentDownloadSettings?.destinationFolder && (_jsxs("span", { style: { fontSize: '0.8rem', color: '#666', fontStyle: 'italic' }, children: [SDKUI_Localizator.SavedDestination, ": ", SDKUI_Globals.userSettings.documentDownloadSettings.destinationFolder] }))] })) : (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '4px' }, children: [_jsx("label", { style: { fontSize: '0.9rem', color: '#525252' }, children: SDKUI_Localizator.Path }), _jsxs("div", { style: {
|
|
309
309
|
display: 'flex',
|
|
310
310
|
alignItems: 'center',
|
|
311
311
|
gap: '8px',
|
|
@@ -313,16 +313,16 @@ const TMCopyToFolderForm = ({ mode, selectedDcmtInfos, onClose, showTMRelationVi
|
|
|
313
313
|
border: `1px solid ${TMColors.border_normal}`,
|
|
314
314
|
borderRadius: '5px',
|
|
315
315
|
backgroundColor: '#fafafa',
|
|
316
|
-
}, children: [_jsx(IconFolderOpen, {}), _jsx("span", { style: { fontSize: '0.9rem', color: '#333' }, children: "Download" })] }), _jsx("span", { style: { fontSize: '0.8rem', color: '#888', fontStyle: 'italic' }, children:
|
|
317
|
-
{ value: 'overwrite', display:
|
|
318
|
-
{ value: 'skip', display:
|
|
319
|
-
{ value: 'rename', display:
|
|
320
|
-
], value: settings.fileExistsMode, direction: "row", onValueChanged: (value) => updateSettings('fileExistsMode', value) })] })) })), _jsxs("div", { style: { display: 'flex', alignItems: 'flex-end', gap: '12px', flexWrap: 'wrap' }, children: [_jsx("div", { style: { flex: '0 0 auto', minWidth: '160px' }, children: _jsx(TMDropDown, { label:
|
|
321
|
-
{ value: 'onlyDid', display:
|
|
322
|
-
{ value: 'documentTypeAndDid', display:
|
|
323
|
-
{ value: 'documentTypeAndCustomMetadata', display:
|
|
324
|
-
{ value: 'onlyCustomMetadata', display:
|
|
325
|
-
], onValueChanged: handleFileNamingModeChange }) }), _jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: '8px' }, children: [_jsx("label", { style: { fontSize: '0.9rem', color: '#525252', whiteSpace: 'nowrap' }, children:
|
|
316
|
+
}, children: [_jsx(IconFolderOpen, {}), _jsx("span", { style: { fontSize: '0.9rem', color: '#333' }, children: "Download" })] }), _jsx("span", { style: { fontSize: '0.8rem', color: '#888', fontStyle: 'italic' }, children: SDKUI_Localizator.BrowserDoesNotSupportFolderSelection })] })), settings.exportMode === 'zip' && (_jsxs("div", { style: { display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(220px, 1fr))', gap: '12px' }, children: [_jsx(TMTextBox, { label: SDKUI_Localizator.ZipFileName, value: settings.zipFileName, validationItems: zipValidationItems, autoComplete: "one-time-code", onValueChanged: (e) => updateSettings('zipFileName', e.target.value) }), _jsx(TMTextBox, { label: SDKUI_Localizator.ProtectWithPasswordOptional, value: settings.zipPassword, type: "password", autoComplete: "one-time-code", onValueChanged: (e) => updateSettings('zipPassword', e.target.value) })] })), settings.exportMode === 'copy' && isDirectoryPickerSupported() && (_jsx("div", { style: { display: 'flex', flexDirection: 'column', gap: '4px', marginTop: '8px' }, children: isUsingDefaultDownloads ? (_jsxs("span", { style: { fontSize: '0.8rem', color: '#888', fontStyle: 'italic' }, children: [SDKUI_Localizator.BrowserAutoRenamesDuplicateFilesInDownloadsFolder, "."] })) : (_jsxs("div", { style: { display: 'flex', flexDirection: 'row', alignItems: 'center', gap: '12px', flexWrap: 'wrap' }, children: [_jsx("label", { style: { fontSize: '0.9rem', color: '#525252', fontWeight: 500 }, children: SDKUI_Localizator.IfFileExists }), _jsx(TMRadioButton, { dataSource: [
|
|
317
|
+
{ value: 'overwrite', display: SDKUI_Localizator.CopyAndReplace },
|
|
318
|
+
{ value: 'skip', display: SDKUI_Localizator.DoNotCopy },
|
|
319
|
+
{ value: 'rename', display: SDKUI_Localizator.CopyButRename },
|
|
320
|
+
], value: settings.fileExistsMode, direction: "row", onValueChanged: (value) => updateSettings('fileExistsMode', value) })] })) })), _jsxs("div", { style: { display: 'flex', alignItems: 'flex-end', gap: '12px', flexWrap: 'wrap' }, children: [_jsx("div", { style: { flex: '0 0 auto', minWidth: '160px' }, children: _jsx(TMDropDown, { label: SDKUI_Localizator.UseForFileName, value: settings.fileNamingMode, dataSource: [
|
|
321
|
+
{ value: 'onlyDid', display: SDKUI_Localizator.OnlyDID },
|
|
322
|
+
{ value: 'documentTypeAndDid', display: SDKUI_Localizator.DocumentTypeNameAndDID },
|
|
323
|
+
{ value: 'documentTypeAndCustomMetadata', display: SDKUI_Localizator.DocumentTypeNameAndCustomMetadata },
|
|
324
|
+
{ value: 'onlyCustomMetadata', display: SDKUI_Localizator.OnlyCustomMetadata },
|
|
325
|
+
], onValueChanged: handleFileNamingModeChange }) }), _jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: '8px' }, children: [_jsx("label", { style: { fontSize: '0.9rem', color: '#525252', whiteSpace: 'nowrap' }, children: SDKUI_Localizator.SeparatorCharacter }), _jsx("input", { type: "text", value: settings.separatorChar, maxLength: 1, onChange: handleSeparatorChange, style: {
|
|
326
326
|
width: '32px',
|
|
327
327
|
height: '28px',
|
|
328
328
|
textAlign: 'center',
|
|
@@ -340,7 +340,7 @@ const TMCopyToFolderForm = ({ mode, selectedDcmtInfos, onClose, showTMRelationVi
|
|
|
340
340
|
}, onBlur: (e) => {
|
|
341
341
|
e.target.style.backgroundImage = 'none';
|
|
342
342
|
e.target.style.borderBottom = `1px solid ${TMColors.border_normal}`;
|
|
343
|
-
} })] }), _jsx(TMCheckBox, { label:
|
|
344
|
-
return (_jsx(TMModal, { width: calcResponsiveSizes(deviceType, showTMRelationViewer ? '95%' : '780px', showTMRelationViewer ? '95%' : '780px', '95%'), height: calcResponsiveSizes(deviceType, showTMRelationViewer ? '95%' : '450px', showTMRelationViewer ? '95%' : '450px', '95%'), title: getTitle(), onClose: onClose, showCloseButton: true, children: _jsx(TMLayoutWaitingContainer, { direction: 'vertical', showWaitPanel: showWaitPanel, showWaitPanelPrimary: showPrimary, showWaitPanelSecondary: showSecondary, waitPanelTitle: waitPanelTitle, waitPanelTextPrimary: waitPanelTextPrimary, waitPanelValuePrimary: waitPanelValuePrimary, waitPanelMaxValuePrimary: waitPanelMaxValuePrimary, waitPanelTextSecondary: waitPanelTextSecondary, waitPanelValueSecondary: waitPanelValueSecondary, waitPanelMaxValueSecondary: waitPanelMaxValueSecondary, isCancelable: true, abortController: abortController, children: _jsxs("div", { onContextMenu: (e) => e.preventDefault(), style: { display: 'flex', flexDirection: 'column', padding: '4px 4px 16px 4px', width: '100%', height: '100%', boxSizing: 'border-box', overflow: 'hidden' }, children: [showTMRelationViewer ? (_jsx("div", { style: { flex: 1, minHeight: 0, display: 'flex', flexDirection: 'column' }, children: _jsxs(TMSplitterLayout, { direction: 'vertical', showSeparator: true, separatorSize: 8, separatorColor: 'transparent', separatorActiveColor: 'transparent', overflow: 'hidden', min: SPLITTER_MIN, start: SPLITTER_START_60_40, children: [_jsx(TMDownloadRelationViewerSection, { selectedDcmtInfos: selectedDcmtInfos, onSelectionChanged: setSelectedItemsRelationViewer, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }), configSection] }, "TMCopyToFolder-relation-config") })) : (configSection), _jsx("div", { style: { display: 'flex', justifyContent: 'center', alignItems: 'center', flexShrink: 0, marginTop: '12px' }, children: _jsx(TMButton, { caption:
|
|
343
|
+
} })] }), _jsx(TMCheckBox, { label: SDKUI_Localizator.RemoveSignatureIfPresent, value: settings.removeSignature, onValueChanged: (value) => updateSettings('removeSignature', value) })] }), _jsxs("div", { style: { display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(240px, 1fr))', gap: '12px' }, children: [_jsx(TMInvoiceRetrieveFormats, { width: '100%', label: SDKUI_Localizator.ElectronicInvoice + ' - ' + SDKUI_Localizator.DisplayFormat, onValueChanged: (newValue) => updateSettings('invoiceFormat', newValue), value: settings.invoiceFormat, valueOrig: settings.invoiceFormat }), _jsx(TMOrderRetrieveFormats, { width: '100%', label: SDKUI_Localizator.ElectronicOrder + ' - ' + SDKUI_Localizator.DisplayFormat, value: settings.orderFormat, valueOrig: settings.orderFormat, onValueChanged: (newValue) => updateSettings('orderFormat', newValue) })] })] })] }));
|
|
344
|
+
return (_jsx(TMModal, { width: calcResponsiveSizes(deviceType, showTMRelationViewer ? '95%' : '780px', showTMRelationViewer ? '95%' : '780px', '95%'), height: calcResponsiveSizes(deviceType, showTMRelationViewer ? '95%' : '450px', showTMRelationViewer ? '95%' : '450px', '95%'), title: getTitle(), onClose: onClose, showCloseButton: true, children: _jsx(TMLayoutWaitingContainer, { direction: 'vertical', showWaitPanel: showWaitPanel, showWaitPanelPrimary: showPrimary, showWaitPanelSecondary: showSecondary, waitPanelTitle: waitPanelTitle, waitPanelTextPrimary: waitPanelTextPrimary, waitPanelValuePrimary: waitPanelValuePrimary, waitPanelMaxValuePrimary: waitPanelMaxValuePrimary, waitPanelTextSecondary: waitPanelTextSecondary, waitPanelValueSecondary: waitPanelValueSecondary, waitPanelMaxValueSecondary: waitPanelMaxValueSecondary, isCancelable: true, abortController: abortController, children: _jsxs("div", { onContextMenu: (e) => e.preventDefault(), style: { display: 'flex', flexDirection: 'column', padding: '4px 4px 16px 4px', width: '100%', height: '100%', boxSizing: 'border-box', overflow: 'hidden' }, children: [showTMRelationViewer ? (_jsx("div", { style: { flex: 1, minHeight: 0, display: 'flex', flexDirection: 'column' }, children: _jsxs(TMSplitterLayout, { direction: 'vertical', showSeparator: true, separatorSize: 8, separatorColor: 'transparent', separatorActiveColor: 'transparent', overflow: 'hidden', min: SPLITTER_MIN, start: SPLITTER_START_60_40, children: [_jsx(TMDownloadRelationViewerSection, { selectedDcmtInfos: selectedDcmtInfos, onSelectionChanged: setSelectedItemsRelationViewer, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }), configSection] }, "TMCopyToFolder-relation-config") })) : (configSection), _jsx("div", { style: { display: 'flex', justifyContent: 'center', alignItems: 'center', flexShrink: 0, marginTop: '12px' }, children: _jsx(TMButton, { caption: SDKUI_Localizator.Execute, icon: _jsx(IconPlay, {}), color: 'success', showTooltip: false, disabled: !isFormValid() || (showTMRelationViewer && selectedItemsRelationViewer.filter(i => i.isDcmt).length === 0), onClick: run }) })] }) }) }));
|
|
345
345
|
};
|
|
346
346
|
export default TMCopyToFolderForm;
|
|
@@ -51,7 +51,7 @@ const TMMergeToPdfForm = ({ mode, selectedDcmtInfos, onClose, showTMRelationView
|
|
|
51
51
|
}
|
|
52
52
|
catch (err) {
|
|
53
53
|
if (err.name !== 'AbortError') {
|
|
54
|
-
console.error('
|
|
54
|
+
console.error('Error selecting folder::', err);
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
finally {
|
|
@@ -61,16 +61,16 @@ const TMMergeToPdfForm = ({ mode, selectedDcmtInfos, onClose, showTMRelationView
|
|
|
61
61
|
const getTitle = () => {
|
|
62
62
|
const count = ` (${selectedDcmtInfos.length})`;
|
|
63
63
|
const modeLabelMap = {
|
|
64
|
-
onlySelected:
|
|
65
|
-
customized:
|
|
64
|
+
onlySelected: SDKUI_Localizator.SelectedDocuments,
|
|
65
|
+
customized: SDKUI_Localizator.SelectedDocumentsAndRelated,
|
|
66
66
|
};
|
|
67
67
|
const modeLabel = modeLabelMap[mode] || modeLabelMap.onlySelected;
|
|
68
|
-
return
|
|
68
|
+
return `${SDKUI_Localizator.MergeToPdf} - ${modeLabel}${count}`;
|
|
69
69
|
};
|
|
70
70
|
// ---- Validazione ----
|
|
71
71
|
const pdfValidationItems = [];
|
|
72
72
|
if (!pdfFileName.trim()) {
|
|
73
|
-
pdfValidationItems.push(new ValidationItem(ResultTypes.ERROR,
|
|
73
|
+
pdfValidationItems.push(new ValidationItem(ResultTypes.ERROR, SDKUI_Localizator.PdfFileName, SDKUI_Localizator.RequiredField));
|
|
74
74
|
}
|
|
75
75
|
// ---- Helper per file convertibili in PDF ----
|
|
76
76
|
const isConvertibleToPdfExt = (ext) => {
|
|
@@ -122,21 +122,21 @@ const TMMergeToPdfForm = ({ mode, selectedDcmtInfos, onClose, showTMRelationView
|
|
|
122
122
|
const collectPdfFilesToMerge = async () => {
|
|
123
123
|
const dcmtInfosToDownload = getDcmtInfosToDownload(selectedDcmtInfos, selectedItemsRelationViewer, showTMRelationViewer);
|
|
124
124
|
if (dcmtInfosToDownload.length === 0) {
|
|
125
|
-
TMMessageBoxManager.show({ message:
|
|
125
|
+
TMMessageBoxManager.show({ message: SDKUI_Localizator.NoDcmtSelected, buttons: [ButtonNames.OK] });
|
|
126
126
|
return null;
|
|
127
127
|
}
|
|
128
128
|
const nonPdfKeys = new Set(nonPdfSelectedItems.map(i => i.key));
|
|
129
129
|
const pdfDcmtInfosToDownload = dcmtInfosToDownload.filter(d => !nonPdfKeys.has(`${d.TID}_${d.DID}`));
|
|
130
130
|
if (pdfDcmtInfosToDownload.length === 0) {
|
|
131
131
|
TMMessageBoxManager.show({
|
|
132
|
-
message:
|
|
132
|
+
message: SDKUI_Localizator.NoPdfOrConvertibleFilesAmongSelectedMergeBlocked,
|
|
133
133
|
buttons: [ButtonNames.OK]
|
|
134
134
|
});
|
|
135
135
|
return null;
|
|
136
136
|
}
|
|
137
137
|
if (pdfDcmtInfosToDownload.length < MIN_PDF_FOR_MERGE) {
|
|
138
138
|
TMMessageBoxManager.show({
|
|
139
|
-
message:
|
|
139
|
+
message: SDKUI_Localizator.OnlyOnePdfOrConvertibleFileMergeBlocked.replaceParams(MIN_PDF_FOR_MERGE.toString()),
|
|
140
140
|
buttons: [ButtonNames.OK]
|
|
141
141
|
});
|
|
142
142
|
return null;
|
|
@@ -153,7 +153,7 @@ const TMMergeToPdfForm = ({ mode, selectedDcmtInfos, onClose, showTMRelationView
|
|
|
153
153
|
};
|
|
154
154
|
await downloadDcmtsAsync(pdfDcmtInfosToDownload, DownloadTypes.Dcmt, 'download', collectFileForMerge, undefined, true, rfo, false);
|
|
155
155
|
if (pdfFiles.length === 0) {
|
|
156
|
-
TMMessageBoxManager.show({ message:
|
|
156
|
+
TMMessageBoxManager.show({ message: SDKUI_Localizator.NoFilesAvailableForMerge, buttons: [ButtonNames.OK] });
|
|
157
157
|
return null;
|
|
158
158
|
}
|
|
159
159
|
return pdfFiles;
|
|
@@ -161,11 +161,11 @@ const TMMergeToPdfForm = ({ mode, selectedDcmtInfos, onClose, showTMRelationView
|
|
|
161
161
|
// ---- Esecuzione: scarica i PDF e li unisce ----
|
|
162
162
|
const run = async () => {
|
|
163
163
|
if (pdfValidationItems.length > 0) {
|
|
164
|
-
TMMessageBoxManager.show({ message:
|
|
164
|
+
TMMessageBoxManager.show({ message: SDKUI_Localizator.PleaseCorrectErrorsBeforeProceeding, buttons: [ButtonNames.OK] });
|
|
165
165
|
return;
|
|
166
166
|
}
|
|
167
167
|
if (!mergePdfManager) {
|
|
168
|
-
TMMessageBoxManager.show({ message:
|
|
168
|
+
TMMessageBoxManager.show({ message: SDKUI_Localizator.PdfMergeFeatureNotAvailable, buttons: [ButtonNames.OK] });
|
|
169
169
|
return;
|
|
170
170
|
}
|
|
171
171
|
const pdfFiles = await collectPdfFilesToMerge();
|
|
@@ -180,17 +180,17 @@ const TMMergeToPdfForm = ({ mode, selectedDcmtInfos, onClose, showTMRelationView
|
|
|
180
180
|
const writable = await fileHandle.createWritable();
|
|
181
181
|
await writable.write(mergedFile);
|
|
182
182
|
await writable.close();
|
|
183
|
-
ShowAlert({ message:
|
|
183
|
+
ShowAlert({ message: SDKUI_Localizator.PdfMergedSavedInFolder.replaceParams(folderHandleRef.current.name), mode: 'success', duration: 5000, title: SDKUI_Localizator.MergeToPdf });
|
|
184
184
|
}
|
|
185
185
|
else {
|
|
186
186
|
// Altrimenti usa il download standard del browser
|
|
187
187
|
await mergePdfManager.mergeAndDownload(pdfFiles, finalName);
|
|
188
|
-
ShowAlert({ message:
|
|
188
|
+
ShowAlert({ message: SDKUI_Localizator.PdfMergedSavedInFolder.replaceParams('Download'), mode: 'success', duration: 5000, title: SDKUI_Localizator.MergeToPdf });
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
191
|
catch (err) {
|
|
192
|
-
console.error('
|
|
193
|
-
TMMessageBoxManager.show({ message:
|
|
192
|
+
console.error('Error merging PDF or convertible files:', err);
|
|
193
|
+
TMMessageBoxManager.show({ message: SDKUI_Localizator.PdfMergeError, buttons: [ButtonNames.OK] });
|
|
194
194
|
return;
|
|
195
195
|
}
|
|
196
196
|
onClose();
|
|
@@ -208,29 +208,29 @@ const TMMergeToPdfForm = ({ mode, selectedDcmtInfos, onClose, showTMRelationView
|
|
|
208
208
|
display: 'flex',
|
|
209
209
|
flexDirection: 'column',
|
|
210
210
|
boxSizing: 'border-box'
|
|
211
|
-
}, children: [_jsx("span", { style: getFloatingLabelStyle(), title:
|
|
211
|
+
}, children: [_jsx("span", { style: getFloatingLabelStyle(), title: `${SDKUI_Localizator.ConfigurationParameters} (${SDKUI_Localizator.MergeToPdf})`, children: SDKUI_Localizator.ConfigurationParameters }), _jsxs("div", { style: {
|
|
212
212
|
display: 'flex',
|
|
213
213
|
flexDirection: 'column',
|
|
214
214
|
gap: '12px',
|
|
215
215
|
flex: 1,
|
|
216
216
|
overflowY: 'auto',
|
|
217
217
|
minHeight: 0,
|
|
218
|
-
}, children: [_jsxs("div", { style: { display: 'grid', gridTemplateColumns: isDirectoryPickerSupported() ? '1fr 1fr' : '1fr', gap: '12px' }, children: [isDirectoryPickerSupported() && (_jsx(TMTextBox, { label:
|
|
218
|
+
}, children: [_jsxs("div", { style: { display: 'grid', gridTemplateColumns: isDirectoryPickerSupported() ? '1fr 1fr' : '1fr', gap: '12px' }, children: [isDirectoryPickerSupported() && (_jsx(TMTextBox, { label: SDKUI_Localizator.Path, value: destinationFolder, onValueChanged: handleFolderValueChange, readOnly: true, placeHolder: "Download", onClick: handleSelectFolder, buttons: [
|
|
219
219
|
{
|
|
220
220
|
icon: _jsx(IconFolderOpen, {}),
|
|
221
|
-
text:
|
|
221
|
+
text: SDKUI_Localizator.SelectFolder,
|
|
222
222
|
onClick: handleSelectFolder
|
|
223
223
|
},
|
|
224
224
|
...(!isUsingDefaultDownloads ? [{
|
|
225
225
|
icon: _jsx(IconUndo, {}),
|
|
226
|
-
text:
|
|
226
|
+
text: SDKUI_Localizator.RestoreDownload,
|
|
227
227
|
onClick: () => {
|
|
228
228
|
skipSelectFolderRef.current = true;
|
|
229
229
|
setDestinationFolder('Download');
|
|
230
230
|
folderHandleRef.current = null;
|
|
231
231
|
}
|
|
232
232
|
}] : [])
|
|
233
|
-
] })), _jsx(TMTextBox, { label:
|
|
233
|
+
] })), _jsx(TMTextBox, { label: SDKUI_Localizator.PdfFileName, value: pdfFileName, validationItems: pdfValidationItems, autoComplete: "one-time-code", onValueChanged: (e) => setPdfFileName(e.target.value) })] }), hasConvertibleSelected && (_jsxs("div", { style: {
|
|
234
234
|
display: 'flex',
|
|
235
235
|
flexDirection: 'column',
|
|
236
236
|
gap: '6px',
|
|
@@ -240,14 +240,14 @@ const TMMergeToPdfForm = ({ mode, selectedDcmtInfos, onClose, showTMRelationView
|
|
|
240
240
|
backgroundColor: '#e2f0fd',
|
|
241
241
|
color: '#00527a',
|
|
242
242
|
fontSize: '0.85rem'
|
|
243
|
-
}, children: [_jsx("strong", { children:
|
|
243
|
+
}, children: [_jsx("strong", { children: SDKUI_Localizator.Note }), _jsx("ul", { style: { margin: 0, paddingLeft: '18px', display: 'flex', flexDirection: 'column', gap: '4px' }, children: _jsx("li", { children: (() => {
|
|
244
244
|
const extSet = Array.from(new Set(convertibleSelectedItems.map(i => (i.ext ?? '').toString().trim().toLowerCase().replace(/^\./, '')).filter(e => e.length > 0)));
|
|
245
245
|
const extLabel = extSet.length > 0
|
|
246
246
|
? ` (${extSet.map(e => '.' + e).join(', ')})`
|
|
247
247
|
: '';
|
|
248
248
|
return convertibleSelectedItems.length === 1
|
|
249
|
-
?
|
|
250
|
-
:
|
|
249
|
+
? SDKUI_Localizator.DocumentWillBeConvertedDuringMerge.replaceParams(extLabel)
|
|
250
|
+
: SDKUI_Localizator.DocumentsWillBeConvertedDuringMerge.replaceParams(convertibleSelectedItems.length.toString(), extLabel);
|
|
251
251
|
})() }) })] })), (!hasEnoughPdfForMerge || hasNonPdfSelected || !isDirectoryPickerSupported()) && (_jsxs("div", { style: {
|
|
252
252
|
display: 'flex',
|
|
253
253
|
flexDirection: 'column',
|
|
@@ -258,18 +258,16 @@ const TMMergeToPdfForm = ({ mode, selectedDcmtInfos, onClose, showTMRelationView
|
|
|
258
258
|
backgroundColor: '#fdf5e2',
|
|
259
259
|
color: '#7a5d00',
|
|
260
260
|
fontSize: '0.85rem'
|
|
261
|
-
}, children: [_jsx("strong", { children:
|
|
262
|
-
?
|
|
263
|
-
:
|
|
261
|
+
}, children: [_jsx("strong", { children: SDKUI_Localizator.Warning }), _jsxs("ul", { style: { margin: 0, paddingLeft: '18px', display: 'flex', flexDirection: 'column', gap: '4px' }, children: [!isDirectoryPickerSupported() && (_jsx("li", { children: SDKUI_Localizator.BrowserDoesNotSupportFolderSelection })), !hasEnoughPdfForMerge && (_jsx("li", { children: mergeableSelectedCount === 0
|
|
262
|
+
? SDKUI_Localizator.NoPdfOrConvertibleFilesSelected_Param.replaceParams(MIN_PDF_FOR_MERGE.toString())
|
|
263
|
+
: SDKUI_Localizator.OnlyOnePdfOrConvertibleFileSelected.replaceParams(MIN_PDF_FOR_MERGE.toString()) })), hasNonPdfSelected && (_jsx("li", { children: (() => {
|
|
264
264
|
const extSet = Array.from(new Set(nonPdfSelectedItems.map(i => (i.ext ?? '').toString().trim().toLowerCase().replace(/^\./, '')).filter(e => e.length > 0)));
|
|
265
|
-
const extLabel = extSet.length > 0
|
|
266
|
-
? ` (${extSet.map(e => '.' + e).join(', ')})`
|
|
267
|
-
: '';
|
|
265
|
+
const extLabel = extSet.length > 0 ? ` (${extSet.map(e => '.' + e).join(', ')})` : '';
|
|
268
266
|
return nonPdfSelectedItems.length === 1
|
|
269
|
-
?
|
|
270
|
-
:
|
|
267
|
+
? SDKUI_Localizator.FileNotPdfWillBeExcluded.replaceParams(extLabel)
|
|
268
|
+
: SDKUI_Localizator.FilesNotPdfWillBeExcluded.replaceParams(nonPdfSelectedItems.length.toString(), extLabel);
|
|
271
269
|
})() }))] })] }))] })] }));
|
|
272
|
-
return (_jsx(TMModal, { width: calcResponsiveSizes(deviceType, showTMRelationViewer ? '90%' : '500px', showTMRelationViewer ? '90%' : '500px', '95%'), height: calcResponsiveSizes(deviceType, showTMRelationViewer ? '90%' : '500px', showTMRelationViewer ? '90%' : '500px', showTMRelationViewer ? '95%' : '500px'), title: getTitle(), onClose: onClose, showCloseButton: true, children: _jsx(TMLayoutWaitingContainer, { direction: 'vertical', showWaitPanel: showWaitPanel, showWaitPanelPrimary: showPrimary, showWaitPanelSecondary: showSecondary, waitPanelTitle: waitPanelTitle, waitPanelTextPrimary: waitPanelTextPrimary, waitPanelValuePrimary: waitPanelValuePrimary, waitPanelMaxValuePrimary: waitPanelMaxValuePrimary, waitPanelTextSecondary: waitPanelTextSecondary, waitPanelValueSecondary: waitPanelValueSecondary, waitPanelMaxValueSecondary: waitPanelMaxValueSecondary, isCancelable: true, abortController: abortController, children: _jsxs("div", { onContextMenu: (e) => e.preventDefault(), style: { display: 'flex', flexDirection: 'column', gap: '16px', padding: '16px', width: '100%', height: '100%', boxSizing: 'border-box', overflow: 'hidden' }, children: [showTMRelationViewer ? (_jsx("div", { style: { flex: 1, minHeight: 0, display: 'flex', flexDirection: 'column' }, children: _jsxs(TMSplitterLayout, { direction: 'vertical', showSeparator: true, separatorSize: 8, separatorColor: 'transparent', separatorActiveColor: 'transparent', overflow: 'hidden', min: SPLITTER_MIN, start: SPLITTER_START_70_30, children: [_jsx(TMDownloadRelationViewerSection, { selectedDcmtInfos: selectedDcmtInfos, onSelectionChanged: setSelectedItemsRelationViewer, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }), configSection] }, "TMMergeToPdf-relation-config") })) : (configSection), _jsx("div", { style: { display: 'flex', justifyContent: 'center', alignItems: 'center', gap: '12px', flexShrink: 0 }, children: _jsx(TMButton, { caption: mergeableSelectedCount === 0 ?
|
|
270
|
+
return (_jsx(TMModal, { width: calcResponsiveSizes(deviceType, showTMRelationViewer ? '90%' : '500px', showTMRelationViewer ? '90%' : '500px', '95%'), height: calcResponsiveSizes(deviceType, showTMRelationViewer ? '90%' : '500px', showTMRelationViewer ? '90%' : '500px', showTMRelationViewer ? '95%' : '500px'), title: getTitle(), onClose: onClose, showCloseButton: true, children: _jsx(TMLayoutWaitingContainer, { direction: 'vertical', showWaitPanel: showWaitPanel, showWaitPanelPrimary: showPrimary, showWaitPanelSecondary: showSecondary, waitPanelTitle: waitPanelTitle, waitPanelTextPrimary: waitPanelTextPrimary, waitPanelValuePrimary: waitPanelValuePrimary, waitPanelMaxValuePrimary: waitPanelMaxValuePrimary, waitPanelTextSecondary: waitPanelTextSecondary, waitPanelValueSecondary: waitPanelValueSecondary, waitPanelMaxValueSecondary: waitPanelMaxValueSecondary, isCancelable: true, abortController: abortController, children: _jsxs("div", { onContextMenu: (e) => e.preventDefault(), style: { display: 'flex', flexDirection: 'column', gap: '16px', padding: '16px', width: '100%', height: '100%', boxSizing: 'border-box', overflow: 'hidden' }, children: [showTMRelationViewer ? (_jsx("div", { style: { flex: 1, minHeight: 0, display: 'flex', flexDirection: 'column' }, children: _jsxs(TMSplitterLayout, { direction: 'vertical', showSeparator: true, separatorSize: 8, separatorColor: 'transparent', separatorActiveColor: 'transparent', overflow: 'hidden', min: SPLITTER_MIN, start: SPLITTER_START_70_30, children: [_jsx(TMDownloadRelationViewerSection, { selectedDcmtInfos: selectedDcmtInfos, onSelectionChanged: setSelectedItemsRelationViewer, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }), configSection] }, "TMMergeToPdf-relation-config") })) : (configSection), _jsx("div", { style: { display: 'flex', justifyContent: 'center', alignItems: 'center', gap: '12px', flexShrink: 0 }, children: _jsx(TMButton, { caption: mergeableSelectedCount === 0 ? SDKUI_Localizator.MergeToPdf : SDKUI_Localizator.MergeFilesToPdf.replaceParams(mergeableSelectedCount.toString()), icon: _jsx(IconPlay, {}), color: 'success', showTooltip: false, disabled: !isFormValid()
|
|
273
271
|
|| (showTMRelationViewer && selectedItemsRelationViewer.filter(i => i.isDcmt).length === 0)
|
|
274
272
|
|| !hasEnoughPdfForMerge, onClick: run }) })] }) }) }));
|
|
275
273
|
};
|