@topconsultnpm/sdkui-react 6.21.0-dev2.42 → 6.21.0-dev2.43
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 +33 -36
- package/lib/components/features/documents/TMMergeToPdfForm.js +30 -32
- package/lib/helper/SDKUI_Localizator.d.ts +47 -2
- package/lib/helper/SDKUI_Localizator.js +474 -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();
|
|
@@ -211,7 +211,7 @@ const TMCopyToFolderForm = ({ mode, selectedDcmtInfos, onClose, showTMRelationVi
|
|
|
211
211
|
await writable.close();
|
|
212
212
|
}
|
|
213
213
|
catch (err) {
|
|
214
|
-
console.error('
|
|
214
|
+
console.error('Error saving ZIP to folder, fallback to standard download:', err);
|
|
215
215
|
// Fallback: download standard del browser
|
|
216
216
|
ZipManager.downloadBlob(zipBlob, zipFileName);
|
|
217
217
|
}
|
|
@@ -223,7 +223,7 @@ const TMCopyToFolderForm = ({ mode, selectedDcmtInfos, onClose, showTMRelationVi
|
|
|
223
223
|
}
|
|
224
224
|
}
|
|
225
225
|
else {
|
|
226
|
-
TMMessageBoxManager.show({ message:
|
|
226
|
+
TMMessageBoxManager.show({ message: SDKUI_Localizator.ExportModeNotSupported, buttons: [ButtonNames.OK] });
|
|
227
227
|
return;
|
|
228
228
|
}
|
|
229
229
|
onClose();
|
|
@@ -236,7 +236,7 @@ const TMCopyToFolderForm = ({ mode, selectedDcmtInfos, onClose, showTMRelationVi
|
|
|
236
236
|
const hasChanges = JSON.stringify(settings) !== JSON.stringify(defaults);
|
|
237
237
|
if (hasChanges) {
|
|
238
238
|
setHasSavedLayout(true);
|
|
239
|
-
ShowAlert({ mode: 'success', message:
|
|
239
|
+
ShowAlert({ mode: 'success', message: SDKUI_Localizator.OperationSuccess, title: SDKUI_Localizator.Save, duration: 3000 });
|
|
240
240
|
}
|
|
241
241
|
};
|
|
242
242
|
const removeLayout = () => {
|
|
@@ -245,7 +245,7 @@ const TMCopyToFolderForm = ({ mode, selectedDcmtInfos, onClose, showTMRelationVi
|
|
|
245
245
|
setSettings(defaults);
|
|
246
246
|
folderHandleRef.current = null;
|
|
247
247
|
setHasSavedLayout(false);
|
|
248
|
-
ShowAlert({ mode: 'success', message:
|
|
248
|
+
ShowAlert({ mode: 'success', message: SDKUI_Localizator.OperationSuccess, title: SDKUI_Localizator.Remove, duration: 3000 });
|
|
249
249
|
};
|
|
250
250
|
const isLayoutSameAsSaved = () => {
|
|
251
251
|
const saved = SDKUI_Globals.userSettings.documentDownloadSettings;
|
|
@@ -268,10 +268,7 @@ const TMCopyToFolderForm = ({ mode, selectedDcmtInfos, onClose, showTMRelationVi
|
|
|
268
268
|
display: 'flex',
|
|
269
269
|
flexDirection: 'column',
|
|
270
270
|
boxSizing: 'border-box'
|
|
271
|
-
}, children: [_jsx("span", { style: {
|
|
272
|
-
...getFloatingLabelStyle(),
|
|
273
|
-
fontWeight: 600
|
|
274
|
-
}, children: "Parametri di configurazione" }), _jsxs("div", { style: {
|
|
271
|
+
}, children: [_jsx("span", { style: { ...getFloatingLabelStyle(), fontWeight: 600 }, children: SDKUI_Localizator.ConfigurationParameters }), _jsxs("div", { style: {
|
|
275
272
|
position: 'absolute',
|
|
276
273
|
top: '-8px',
|
|
277
274
|
right: '12px',
|
|
@@ -281,31 +278,31 @@ const TMCopyToFolderForm = ({ mode, selectedDcmtInfos, onClose, showTMRelationVi
|
|
|
281
278
|
backgroundColor: 'white',
|
|
282
279
|
padding: '0 4px',
|
|
283
280
|
zIndex: 1
|
|
284
|
-
}, children: [_jsx(TMButton, { btnStyle: "toolbar", icon: _jsx(IconSave, {}), caption:
|
|
281
|
+
}, 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
282
|
display: 'flex',
|
|
286
283
|
flexDirection: 'column',
|
|
287
284
|
flex: 1,
|
|
288
285
|
overflowY: 'auto',
|
|
289
286
|
minHeight: 0,
|
|
290
287
|
}, 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:
|
|
288
|
+
{ value: 'copy', display: SDKUI_Localizator.CopyToFolder },
|
|
289
|
+
{ value: 'zip', display: SDKUI_Localizator.CompressToZipFile }
|
|
290
|
+
], 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
291
|
{
|
|
295
292
|
icon: _jsx(IconFolderOpen, {}),
|
|
296
|
-
text:
|
|
293
|
+
text: SDKUI_Localizator.SelectFolder,
|
|
297
294
|
onClick: handleSelectFolder
|
|
298
295
|
},
|
|
299
296
|
...(!isUsingDefaultDownloads ? [{
|
|
300
297
|
icon: _jsx(IconUndo, {}),
|
|
301
|
-
text:
|
|
298
|
+
text: SDKUI_Localizator.RestoreDownload,
|
|
302
299
|
onClick: () => {
|
|
303
300
|
skipSelectFolderRef.current = true;
|
|
304
301
|
updateSettings('destinationFolder', 'Download');
|
|
305
302
|
folderHandleRef.current = null;
|
|
306
303
|
}
|
|
307
304
|
}] : [])
|
|
308
|
-
] }), SDKUI_Globals.userSettings.documentDownloadSettings?.destinationFolder && (_jsxs("span", { style: { fontSize: '0.8rem', color: '#666', fontStyle: 'italic' }, children: ["
|
|
305
|
+
] }), 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
306
|
display: 'flex',
|
|
310
307
|
alignItems: 'center',
|
|
311
308
|
gap: '8px',
|
|
@@ -313,16 +310,16 @@ const TMCopyToFolderForm = ({ mode, selectedDcmtInfos, onClose, showTMRelationVi
|
|
|
313
310
|
border: `1px solid ${TMColors.border_normal}`,
|
|
314
311
|
borderRadius: '5px',
|
|
315
312
|
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:
|
|
313
|
+
}, 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: [
|
|
314
|
+
{ value: 'overwrite', display: SDKUI_Localizator.CopyAndReplace },
|
|
315
|
+
{ value: 'skip', display: SDKUI_Localizator.DoNotCopy },
|
|
316
|
+
{ value: 'rename', display: SDKUI_Localizator.CopyButRename },
|
|
317
|
+
], 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: [
|
|
318
|
+
{ value: 'onlyDid', display: SDKUI_Localizator.OnlyDID },
|
|
319
|
+
{ value: 'documentTypeAndDid', display: SDKUI_Localizator.DocumentTypeNameAndDID },
|
|
320
|
+
{ value: 'documentTypeAndCustomMetadata', display: SDKUI_Localizator.DocumentTypeNameAndCustomMetadata },
|
|
321
|
+
{ value: 'onlyCustomMetadata', display: SDKUI_Localizator.OnlyCustomMetadata },
|
|
322
|
+
], 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
323
|
width: '32px',
|
|
327
324
|
height: '28px',
|
|
328
325
|
textAlign: 'center',
|
|
@@ -340,7 +337,7 @@ const TMCopyToFolderForm = ({ mode, selectedDcmtInfos, onClose, showTMRelationVi
|
|
|
340
337
|
}, onBlur: (e) => {
|
|
341
338
|
e.target.style.backgroundImage = 'none';
|
|
342
339
|
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:
|
|
340
|
+
} })] }), _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) })] })] })] }));
|
|
341
|
+
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
342
|
};
|
|
346
343
|
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: 3000, 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: 3000, 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
|
};
|