@topconsultnpm/sdkui-react 6.21.0-dev3.2 → 6.21.0-dev3.4
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/TMMergeToPdfForm.js +1 -1
- package/lib/helper/MergePdfManager.js +7 -4
- package/lib/helper/SDKUI_Globals.js +2 -1
- package/lib/helper/SDKUI_Localizator.d.ts +1 -0
- package/lib/helper/SDKUI_Localizator.js +10 -0
- package/lib/hooks/useRelatedDocuments.js +4 -4
- package/package.json +1 -1
|
@@ -24,7 +24,7 @@ import MergePdfManager from '../../../helper/MergePdfManager';
|
|
|
24
24
|
const TMMergeToPdfForm = ({ mode, selectedDcmtInfos, onClose, showTMRelationViewer, allTasks, getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, handleNavigateToWGs, handleNavigateToDossiers }) => {
|
|
25
25
|
const { abortController, showWaitPanel, waitPanelTitle, showPrimary, waitPanelTextPrimary, waitPanelValuePrimary, waitPanelMaxValuePrimary, showSecondary, waitPanelTextSecondary, waitPanelValueSecondary, waitPanelMaxValueSecondary, downloadDcmtsAsync, } = useDcmtOperations();
|
|
26
26
|
const deviceType = useDeviceType();
|
|
27
|
-
const [pdfFileName, setPdfFileName] = useState(
|
|
27
|
+
const [pdfFileName, setPdfFileName] = useState(`${SDKUI_Localizator.Result.toLowerCase()}.pdf`);
|
|
28
28
|
const [destinationFolder, setDestinationFolder] = useState('Download');
|
|
29
29
|
const [selectedItemsRelationViewer, setSelectedItemsRelationViewer] = useState([]);
|
|
30
30
|
// ---- Stato per il merge PDF (progress bar) ----
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SDKUI_Localizator } from './SDKUI_Localizator';
|
|
1
2
|
// ============================================================================
|
|
2
3
|
// LAZY LOADING - Carica pdf-lib solo quando necessario
|
|
3
4
|
// ============================================================================
|
|
@@ -59,10 +60,11 @@ export class MergePdfManager {
|
|
|
59
60
|
/**
|
|
60
61
|
* Merge -> File - Restituisce un oggetto File
|
|
61
62
|
*/
|
|
62
|
-
static async mergeToFile(files, fileName
|
|
63
|
+
static async mergeToFile(files, fileName, options = {}) {
|
|
63
64
|
try {
|
|
64
65
|
const { blob } = await this.merge(files, options);
|
|
65
|
-
|
|
66
|
+
const finalFileName = fileName || `${SDKUI_Localizator.Result.toLowerCase()}.pdf`;
|
|
67
|
+
return new File([blob], finalFileName, { type: 'application/pdf' });
|
|
66
68
|
}
|
|
67
69
|
catch (error) {
|
|
68
70
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
@@ -72,15 +74,16 @@ export class MergePdfManager {
|
|
|
72
74
|
/**
|
|
73
75
|
* Merge + Download - Unisce e scarica automaticamente
|
|
74
76
|
*/
|
|
75
|
-
static async mergeAndDownload(files, fileName
|
|
77
|
+
static async mergeAndDownload(files, fileName, options = {}) {
|
|
76
78
|
let url = null;
|
|
79
|
+
const finalFileName = fileName || `${SDKUI_Localizator.Result.toLowerCase()}.pdf`;
|
|
77
80
|
try {
|
|
78
81
|
const result = await this.merge(files, options);
|
|
79
82
|
url = URL.createObjectURL(result.blob);
|
|
80
83
|
// Crea link temporaneo per download
|
|
81
84
|
const a = document.createElement('a');
|
|
82
85
|
a.href = url;
|
|
83
|
-
a.download =
|
|
86
|
+
a.download = finalFileName;
|
|
84
87
|
document.body.appendChild(a);
|
|
85
88
|
a.click();
|
|
86
89
|
a.remove();
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { InvoiceRetrieveFormats, LocalStorageService, OrderRetrieveFormats } from "@topconsultnpm/sdk-ts";
|
|
2
2
|
import { FontSize } from "../utils/theme";
|
|
3
|
+
import { SDKUI_Localizator } from "./SDKUI_Localizator";
|
|
3
4
|
export class DocumentDownloadSettings {
|
|
4
5
|
constructor() {
|
|
5
6
|
this.exportMode = 'copy';
|
|
6
7
|
this.destinationFolder = 'Download';
|
|
7
|
-
this.zipFileName = '';
|
|
8
|
+
this.zipFileName = SDKUI_Localizator.Result.toLowerCase() + '.zip';
|
|
8
9
|
this.zipPassword = '';
|
|
9
10
|
this.fileNamingMode = 'documentTypeAndDid';
|
|
10
11
|
this.separatorChar = '_';
|
|
@@ -652,6 +652,7 @@ export declare class SDKUI_Localizator {
|
|
|
652
652
|
static get RenameFile(): "Datei erfolgreich umbenannt" | "File renamed successfully" | "Archivo renombrada exitosamente" | "Fichier renommé avec succès" | "Arquivo renomeada com sucesso" | "File rinominata con successo";
|
|
653
653
|
static get Restore(): "Wiederherstellen" | "Restore" | "Restablecer" | "Restaure" | "Restauração" | "Ripristina";
|
|
654
654
|
static get RestoreComment(): "Kommentar wiederherstellen?" | "Restore the comment?" | "¿Restaurar el comentario?" | "Restaurer le commentaire ?" | "Restaurar o comentário?" | "Ripristinare il commento?";
|
|
655
|
+
static get Result(): string;
|
|
655
656
|
static get ResultDetails(): string;
|
|
656
657
|
static get RestoreDownload(): string;
|
|
657
658
|
static get ResultsPerPage(): string;
|
|
@@ -6499,6 +6499,16 @@ export class SDKUI_Localizator {
|
|
|
6499
6499
|
default: return "Ripristinare il commento?";
|
|
6500
6500
|
}
|
|
6501
6501
|
}
|
|
6502
|
+
static get Result() {
|
|
6503
|
+
switch (this._cultureID) {
|
|
6504
|
+
case CultureIDs.De_DE: return "Ergebnis";
|
|
6505
|
+
case CultureIDs.En_US: return "Result";
|
|
6506
|
+
case CultureIDs.Es_ES: return "Resultado";
|
|
6507
|
+
case CultureIDs.Fr_FR: return "Résultat";
|
|
6508
|
+
case CultureIDs.Pt_PT: return "Resultado";
|
|
6509
|
+
default: return "Risultato";
|
|
6510
|
+
}
|
|
6511
|
+
}
|
|
6502
6512
|
static get ResultDetails() {
|
|
6503
6513
|
switch (this._cultureID) {
|
|
6504
6514
|
case CultureIDs.De_DE: return "Ergebnisdetails";
|
|
@@ -160,10 +160,10 @@ export const useRelatedDocuments = ({ selectedSearchResult, focusedItem, current
|
|
|
160
160
|
setCanArchiveDetailRelation(false);
|
|
161
161
|
return;
|
|
162
162
|
}
|
|
163
|
-
const detailRelations = relations.filter(r => r.detailTID === tid);
|
|
163
|
+
const detailRelations = relations.filter(r => r.detailTID === tid && r.relationType !== RelationTypes.ManyToMany);
|
|
164
164
|
const hasMasterWithAssociations = detailRelations.some(rel => rel.associations && rel.associations.length > 0);
|
|
165
165
|
setCanArchiveMasterRelation(hasMasterWithAssociations);
|
|
166
|
-
const masterRelations = relations.filter(r => r.masterTID === tid);
|
|
166
|
+
const masterRelations = relations.filter(r => r.masterTID === tid && r.relationType !== RelationTypes.ManyToMany);
|
|
167
167
|
const hasDetailWithAssociations = masterRelations.some(rel => rel.associations && rel.associations.length > 0);
|
|
168
168
|
setCanArchiveDetailRelation(hasDetailWithAssociations);
|
|
169
169
|
}
|
|
@@ -196,8 +196,8 @@ export const useRelatedDocuments = ({ selectedSearchResult, focusedItem, current
|
|
|
196
196
|
}, [selectedSearchResult?.fromTID]);
|
|
197
197
|
const filterRelationsByType = (relations, tid, type) => {
|
|
198
198
|
return type === 'detail'
|
|
199
|
-
? relations.filter(r => r.masterTID == tid)
|
|
200
|
-
: relations.filter(r => r.detailTID == tid);
|
|
199
|
+
? relations.filter(r => r.masterTID == tid && r.relationType !== RelationTypes.ManyToMany)
|
|
200
|
+
: relations.filter(r => r.detailTID == tid && r.relationType !== RelationTypes.ManyToMany);
|
|
201
201
|
};
|
|
202
202
|
const filterRelationsWithAssociations = (relations) => {
|
|
203
203
|
return relations.filter(rel => rel.associations && rel.associations.length > 0);
|