@topconsultnpm/sdkui-react 6.21.0-dev3.2 → 6.21.0-dev3.3
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/choosers/TMDynDataListItemChooser.js +31 -3
- 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/package.json +1 -1
|
@@ -58,8 +58,24 @@ const TMDynDataListItemChooser = ({ tid, md, width = '100%', titleForm, openChoo
|
|
|
58
58
|
return "";
|
|
59
59
|
if (!dynDl)
|
|
60
60
|
return value;
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
const searchValue = value.toLowerCase();
|
|
62
|
+
const matchingRow = dataSource?.dtdResult?.rows?.find(o => {
|
|
63
|
+
const rowValue = o[dynDl.selectItemForValue ?? 0]?.toString();
|
|
64
|
+
if (!rowValue)
|
|
65
|
+
return false;
|
|
66
|
+
if (rowValue.toLowerCase() === searchValue)
|
|
67
|
+
return true;
|
|
68
|
+
const rowFirstPart = rowValue.split(', ')?.[0]?.toLowerCase();
|
|
69
|
+
return rowFirstPart === searchValue;
|
|
70
|
+
});
|
|
71
|
+
if (!matchingRow)
|
|
72
|
+
return value;
|
|
73
|
+
const descValue = matchingRow[dynDl.selectItemForDescription ?? 0]?.toString();
|
|
74
|
+
// Se value e description sono nella stessa colonna, estrai solo la parte descrizione
|
|
75
|
+
if ((dynDl.selectItemForDescription ?? 0) === (dynDl.selectItemForValue ?? 0) && descValue?.includes(', ')) {
|
|
76
|
+
return descValue.split(', ').slice(1).join(', '); // "01, Gennaio" → "Gennaio"
|
|
77
|
+
}
|
|
78
|
+
return descValue ?? value;
|
|
63
79
|
};
|
|
64
80
|
const getDescriptions = (maxItems = 3) => {
|
|
65
81
|
if (!Array.isArray(values))
|
|
@@ -79,7 +95,19 @@ const TMDynDataListItemChooser = ({ tid, md, width = '100%', titleForm, openChoo
|
|
|
79
95
|
return null;
|
|
80
96
|
if (!dynDl)
|
|
81
97
|
return null;
|
|
82
|
-
|
|
98
|
+
const searchValue = values?.[0]?.toString().toLowerCase();
|
|
99
|
+
const matchingRow = dataSource?.dtdResult?.rows?.find(o => {
|
|
100
|
+
const rowValue = o[dynDl.selectItemForValue ?? 0]?.toString();
|
|
101
|
+
if (!rowValue)
|
|
102
|
+
return false;
|
|
103
|
+
// Prima prova match esatto
|
|
104
|
+
if (rowValue.toLowerCase() === searchValue)
|
|
105
|
+
return true;
|
|
106
|
+
// Poi prova match sulla prima parte (se il valore è nel formato "codice, descrizione")
|
|
107
|
+
const rowFirstPart = rowValue.split(', ')?.[0]?.toLowerCase();
|
|
108
|
+
return rowFirstPart === searchValue;
|
|
109
|
+
});
|
|
110
|
+
const description = matchingRow?.[dynDl.selectItemForDescription ?? 0];
|
|
83
111
|
return description ? null :
|
|
84
112
|
_jsx(TMTooltip, { content: SDKUI_Localizator.ValueNotPresent, children: _jsx(IconWarning, { color: TMColors.warning }) });
|
|
85
113
|
};
|
|
@@ -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";
|