@topconsultnpm/sdkui-react 6.21.0-dev2.9 → 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/base/TMAccordionNew.js +1 -0
- package/lib/components/base/TMAreaManager.js +19 -3
- package/lib/components/base/TMDataGrid.js +2 -2
- package/lib/components/base/TMModal.d.ts +1 -0
- package/lib/components/base/TMModal.js +2 -2
- package/lib/components/base/TMPanel.d.ts +7 -4
- package/lib/components/base/TMPanel.js +58 -26
- package/lib/components/base/TMTreeView.js +12 -2
- package/lib/components/base/TMWaitPanel.d.ts +3 -1
- package/lib/components/base/TMWaitPanel.js +14 -9
- package/lib/components/choosers/TMDistinctValues.js +35 -21
- package/lib/components/choosers/TMDynDataListItemChooser.js +31 -3
- package/lib/components/choosers/TMUserChooser.d.ts +4 -0
- package/lib/components/choosers/TMUserChooser.js +7 -5
- package/lib/components/editors/TMFormulaEditor.d.ts +2 -0
- package/lib/components/editors/TMFormulaEditor.js +75 -21
- package/lib/components/editors/TMMetadataValues.js +2 -1
- package/lib/components/editors/TMRadioButton.js +7 -5
- package/lib/components/editors/TMTextBox.d.ts +2 -0
- package/lib/components/editors/TMTextBox.js +3 -3
- package/lib/components/features/archive/TMArchive.js +1 -1
- package/lib/components/features/documents/TMCopyToFolderForm.d.ts +24 -0
- package/lib/components/features/documents/TMCopyToFolderForm.js +401 -0
- package/lib/components/features/documents/TMDcmtForm.d.ts +1 -0
- package/lib/components/features/documents/TMDcmtForm.js +126 -38
- package/lib/components/features/documents/TMDcmtPreview.d.ts +1 -0
- package/lib/components/features/documents/TMDcmtPreview.js +2 -2
- package/lib/components/features/documents/TMDcmtTasks.d.ts +1 -0
- package/lib/components/features/documents/TMDcmtTasks.js +2 -2
- package/lib/components/features/documents/TMDownloadRelationViewerSection.d.ts +23 -0
- package/lib/components/features/documents/TMDownloadRelationViewerSection.js +173 -0
- package/lib/components/features/documents/TMFileUploader.js +1 -1
- package/lib/components/features/documents/TMMasterDetailDcmts.d.ts +2 -0
- package/lib/components/features/documents/TMMasterDetailDcmts.js +28 -9
- package/lib/components/features/documents/TMMergeToPdfForm.d.ts +24 -0
- package/lib/components/features/documents/TMMergeToPdfForm.js +309 -0
- package/lib/components/features/documents/TMRelationViewer.d.ts +13 -0
- package/lib/components/features/documents/TMRelationViewer.js +75 -6
- package/lib/components/features/documents/copyAndMergeDcmtsShared.d.ts +71 -0
- package/lib/components/features/documents/copyAndMergeDcmtsShared.js +304 -0
- package/lib/components/features/search/SignatureParamsManager.d.ts +70 -0
- package/lib/components/features/search/SignatureParamsManager.js +145 -0
- package/lib/components/features/search/TMSavedQuerySelector.d.ts +2 -2
- package/lib/components/features/search/TMSavedQuerySelector.js +3 -2
- package/lib/components/features/search/TMSearch.d.ts +4 -1
- package/lib/components/features/search/TMSearch.js +16 -10
- package/lib/components/features/search/TMSearchQueryPanel.js +1 -1
- package/lib/components/features/search/TMSearchResult.d.ts +2 -0
- package/lib/components/features/search/TMSearchResult.js +117 -22
- package/lib/components/features/workflow/diagram/queryDescriptorParser.js +3 -6
- package/lib/components/forms/Login/TMLoginForm.d.ts +9 -0
- package/lib/components/forms/Login/TMLoginForm.js +61 -0
- package/lib/components/forms/TMResultDialog.d.ts +1 -1
- package/lib/components/forms/TMResultDialog.js +4 -2
- package/lib/components/index.d.ts +1 -0
- package/lib/components/index.js +1 -0
- package/lib/components/pages/TMPage.js +3 -1
- package/lib/components/query/TMQueryEditor.js +1 -1
- package/lib/components/viewers/TMTidViewer.js +1 -1
- package/lib/helper/MergePdfManager.d.ts +45 -0
- package/lib/helper/MergePdfManager.js +148 -0
- package/lib/helper/SDKUI_Globals.d.ts +15 -0
- package/lib/helper/SDKUI_Globals.js +16 -1
- package/lib/helper/SDKUI_Localizator.d.ts +108 -2
- package/lib/helper/SDKUI_Localizator.js +1080 -12
- package/lib/helper/TMPdfViewer.js +25 -24
- package/lib/helper/TMUtils.d.ts +1 -0
- package/lib/helper/TMUtils.js +17 -0
- package/lib/helper/ZipManager.d.ts +56 -0
- package/lib/helper/ZipManager.js +127 -0
- package/lib/helper/index.d.ts +1 -0
- package/lib/helper/index.js +1 -0
- package/lib/hooks/useDataUserIdItem.js +6 -4
- package/lib/hooks/useDcmtOperations.d.ts +9 -2
- package/lib/hooks/useDcmtOperations.js +77 -34
- package/lib/hooks/useDocumentOperations.d.ts +3 -0
- package/lib/hooks/useDocumentOperations.js +233 -24
- package/lib/hooks/useForm.js +5 -2
- package/lib/hooks/useResizeObserver.d.ts +1 -1
- package/lib/hooks/useResizeObserver.js +16 -15
- package/package.json +4 -2
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/** Risultato del merge PDF */
|
|
2
|
+
export interface MergePdfResult {
|
|
3
|
+
bytes: Uint8Array;
|
|
4
|
+
blob: Blob;
|
|
5
|
+
pageCount: number;
|
|
6
|
+
}
|
|
7
|
+
/** Risultato con Base64 incluso */
|
|
8
|
+
export interface MergePdfResultWithBase64 extends MergePdfResult {
|
|
9
|
+
base64: string;
|
|
10
|
+
}
|
|
11
|
+
/** Opzioni per il merge */
|
|
12
|
+
export interface MergePdfOptions {
|
|
13
|
+
fileName?: string;
|
|
14
|
+
onProgress?: (current: number, total: number, file: File) => void;
|
|
15
|
+
}
|
|
16
|
+
export declare class MergePdfManager {
|
|
17
|
+
/**
|
|
18
|
+
* Merge principale - Unisce array di File PDF in uno solo
|
|
19
|
+
*/
|
|
20
|
+
static merge(files: File[], options?: MergePdfOptions): Promise<MergePdfResult>;
|
|
21
|
+
/**
|
|
22
|
+
* Merge -> File - Restituisce un oggetto File
|
|
23
|
+
*/
|
|
24
|
+
static mergeToFile(files: File[], fileName?: string, options?: MergePdfOptions): Promise<File>;
|
|
25
|
+
/**
|
|
26
|
+
* Merge + Download - Unisce e scarica automaticamente
|
|
27
|
+
*/
|
|
28
|
+
static mergeAndDownload(files: File[], fileName?: string, options?: MergePdfOptions): Promise<MergePdfResult>;
|
|
29
|
+
/**
|
|
30
|
+
* Blob -> Base64 - Converte un Blob in stringa Base64
|
|
31
|
+
*/
|
|
32
|
+
static blobToBase64(blob: Blob): Promise<string>;
|
|
33
|
+
/**
|
|
34
|
+
* Merge -> Base64 - Unisce e restituisce anche la stringa Base64
|
|
35
|
+
*/
|
|
36
|
+
static mergeToBase64(files: File[], options?: MergePdfOptions): Promise<MergePdfResultWithBase64>;
|
|
37
|
+
/**
|
|
38
|
+
* Merge per Preview - Restituisce solo base64 e pageCount per anteprima
|
|
39
|
+
*/
|
|
40
|
+
static mergeForPreview(files: File[], options?: MergePdfOptions): Promise<{
|
|
41
|
+
base64: string;
|
|
42
|
+
pageCount: number;
|
|
43
|
+
}>;
|
|
44
|
+
}
|
|
45
|
+
export default MergePdfManager;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { SDKUI_Localizator } from './SDKUI_Localizator';
|
|
2
|
+
// ============================================================================
|
|
3
|
+
// LAZY LOADING - Carica pdf-lib solo quando necessario
|
|
4
|
+
// ============================================================================
|
|
5
|
+
let pdfLibLoaded = false;
|
|
6
|
+
const loadPdfLib = async () => {
|
|
7
|
+
const module = await import('pdf-lib');
|
|
8
|
+
pdfLibLoaded = true;
|
|
9
|
+
return module;
|
|
10
|
+
};
|
|
11
|
+
// ============================================================================
|
|
12
|
+
// MERGE PDF MANAGER - Utility per unire PDF lato client
|
|
13
|
+
// ============================================================================
|
|
14
|
+
export class MergePdfManager {
|
|
15
|
+
/**
|
|
16
|
+
* Merge principale - Unisce array di File PDF in uno solo
|
|
17
|
+
*/
|
|
18
|
+
static async merge(files, options = {}) {
|
|
19
|
+
if (!files?.length) {
|
|
20
|
+
throw new Error('MergePdfManager.merge: nessun file fornito.');
|
|
21
|
+
}
|
|
22
|
+
try {
|
|
23
|
+
// Carica pdf-lib on-demand
|
|
24
|
+
const { PDFDocument } = await loadPdfLib();
|
|
25
|
+
const mergedPdf = await PDFDocument.create();
|
|
26
|
+
let totalPages = 0;
|
|
27
|
+
// Itera su ogni file e copia le pagine nel documento finale
|
|
28
|
+
for (let i = 0; i < files.length; i++) {
|
|
29
|
+
const file = files[i];
|
|
30
|
+
try {
|
|
31
|
+
const buffer = await file.arrayBuffer();
|
|
32
|
+
const pdf = await PDFDocument.load(buffer);
|
|
33
|
+
// Copia tutte le pagine dal PDF sorgente
|
|
34
|
+
const pages = await mergedPdf.copyPages(pdf, pdf.getPageIndices());
|
|
35
|
+
pages.forEach(page => mergedPdf.addPage(page));
|
|
36
|
+
totalPages += pages.length;
|
|
37
|
+
// Notifica progresso
|
|
38
|
+
options.onProgress?.(i + 1, files.length, file);
|
|
39
|
+
}
|
|
40
|
+
catch (fileError) {
|
|
41
|
+
const errorMessage = fileError instanceof Error ? fileError.message : String(fileError);
|
|
42
|
+
throw new Error(`Errore processamento file "${file.name}" (${i}): ${errorMessage}`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
if (totalPages === 0) {
|
|
46
|
+
throw new Error('Nessuna pagina valida trovata.');
|
|
47
|
+
}
|
|
48
|
+
// Salva il PDF unito
|
|
49
|
+
const outBytes = await mergedPdf.save();
|
|
50
|
+
// Converte Uint8Array in ArrayBuffer per il Blob
|
|
51
|
+
const pdfBuffer = outBytes.buffer.slice(outBytes.byteOffset, outBytes.byteOffset + outBytes.byteLength);
|
|
52
|
+
const blob = new Blob([pdfBuffer], { type: 'application/pdf' });
|
|
53
|
+
return { bytes: outBytes, blob, pageCount: totalPages };
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
57
|
+
throw new Error(`MergePdfManager.merge: ${errorMessage}`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Merge -> File - Restituisce un oggetto File
|
|
62
|
+
*/
|
|
63
|
+
static async mergeToFile(files, fileName, options = {}) {
|
|
64
|
+
try {
|
|
65
|
+
const { blob } = await this.merge(files, options);
|
|
66
|
+
const finalFileName = fileName || `${SDKUI_Localizator.Result.toLowerCase()}.pdf`;
|
|
67
|
+
return new File([blob], finalFileName, { type: 'application/pdf' });
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
71
|
+
throw new Error(`MergePdfManager.mergeToFile: ${errorMessage}`);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Merge + Download - Unisce e scarica automaticamente
|
|
76
|
+
*/
|
|
77
|
+
static async mergeAndDownload(files, fileName, options = {}) {
|
|
78
|
+
let url = null;
|
|
79
|
+
const finalFileName = fileName || `${SDKUI_Localizator.Result.toLowerCase()}.pdf`;
|
|
80
|
+
try {
|
|
81
|
+
const result = await this.merge(files, options);
|
|
82
|
+
url = URL.createObjectURL(result.blob);
|
|
83
|
+
// Crea link temporaneo per download
|
|
84
|
+
const a = document.createElement('a');
|
|
85
|
+
a.href = url;
|
|
86
|
+
a.download = finalFileName;
|
|
87
|
+
document.body.appendChild(a);
|
|
88
|
+
a.click();
|
|
89
|
+
a.remove();
|
|
90
|
+
return result;
|
|
91
|
+
}
|
|
92
|
+
catch (error) {
|
|
93
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
94
|
+
throw new Error(`MergePdfManager.mergeAndDownload: ${errorMessage}`);
|
|
95
|
+
}
|
|
96
|
+
finally {
|
|
97
|
+
// Rilascia URL dopo un breve delay
|
|
98
|
+
if (url)
|
|
99
|
+
setTimeout(() => URL.revokeObjectURL(url), 1000);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Blob -> Base64 - Converte un Blob in stringa Base64
|
|
104
|
+
*/
|
|
105
|
+
static blobToBase64(blob) {
|
|
106
|
+
return new Promise((resolve, reject) => {
|
|
107
|
+
const reader = new FileReader();
|
|
108
|
+
reader.onloadend = () => {
|
|
109
|
+
if (typeof reader.result === 'string') {
|
|
110
|
+
resolve(reader.result);
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
reject(new Error('Impossibile convertire il blob in base64.'));
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
reader.onerror = () => reject(new Error('Errore durante la lettura del blob.'));
|
|
117
|
+
reader.readAsDataURL(blob);
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Merge -> Base64 - Unisce e restituisce anche la stringa Base64
|
|
122
|
+
*/
|
|
123
|
+
static async mergeToBase64(files, options = {}) {
|
|
124
|
+
try {
|
|
125
|
+
const result = await this.merge(files, options);
|
|
126
|
+
const base64 = await this.blobToBase64(result.blob);
|
|
127
|
+
return { ...result, base64 };
|
|
128
|
+
}
|
|
129
|
+
catch (error) {
|
|
130
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
131
|
+
throw new Error(`MergePdfManager.mergeToBase64: ${errorMessage}`);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Merge per Preview - Restituisce solo base64 e pageCount per anteprima
|
|
136
|
+
*/
|
|
137
|
+
static async mergeForPreview(files, options = {}) {
|
|
138
|
+
try {
|
|
139
|
+
const result = await this.mergeToBase64(files, options);
|
|
140
|
+
return { base64: result.base64, pageCount: result.pageCount };
|
|
141
|
+
}
|
|
142
|
+
catch (error) {
|
|
143
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
144
|
+
throw new Error(`MergePdfManager.mergeForPreview: ${errorMessage}`);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
export default MergePdfManager;
|
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
import { InvoiceRetrieveFormats, ObjectClasses, OrderRetrieveFormats } from "@topconsultnpm/sdk-ts";
|
|
2
2
|
import { CheckoutInfo } from "./checkinCheckoutManager";
|
|
3
|
+
export type FileNamingMode = 'onlyDid' | 'documentTypeAndDid' | 'documentTypeAndCustomMetadata' | 'onlyCustomMetadata';
|
|
4
|
+
export type FileExistsMode = 'overwrite' | 'skip' | 'rename';
|
|
5
|
+
export declare class DocumentDownloadSettings {
|
|
6
|
+
exportMode: 'copy' | 'zip';
|
|
7
|
+
destinationFolder: string;
|
|
8
|
+
zipFileName: string;
|
|
9
|
+
zipPassword: string;
|
|
10
|
+
fileNamingMode: FileNamingMode;
|
|
11
|
+
separatorChar: string;
|
|
12
|
+
invoiceFormat: InvoiceRetrieveFormats;
|
|
13
|
+
orderFormat: OrderRetrieveFormats;
|
|
14
|
+
fileExistsMode: FileExistsMode;
|
|
15
|
+
removeSignature: boolean;
|
|
16
|
+
}
|
|
3
17
|
export declare const dcmtsFileCacheDownload: Map<string, File>;
|
|
4
18
|
export declare const dcmtsFileCachePreview: Map<string, File>;
|
|
5
19
|
export declare const CACHE_SIZE_LIMIT = 10;
|
|
@@ -22,6 +36,7 @@ export declare class UserSettings {
|
|
|
22
36
|
wgDraftCheckoutInfo: CheckoutInfo[];
|
|
23
37
|
dcmtCheckoutInfo: CheckoutInfo[];
|
|
24
38
|
defaultCheckInOutFolder: string;
|
|
39
|
+
documentDownloadSettings: DocumentDownloadSettings;
|
|
25
40
|
constructor(skipCssUpdate?: boolean);
|
|
26
41
|
/** Load settings from local storage or other sources */
|
|
27
42
|
static LoadSettings(userID: number | undefined, archiveID: string | undefined): UserSettings;
|
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
import { InvoiceRetrieveFormats, LocalStorageService, OrderRetrieveFormats } from "@topconsultnpm/sdk-ts";
|
|
2
2
|
import { FontSize } from "../utils/theme";
|
|
3
|
-
|
|
3
|
+
import { SDKUI_Localizator } from "./SDKUI_Localizator";
|
|
4
|
+
export class DocumentDownloadSettings {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.exportMode = 'copy';
|
|
7
|
+
this.destinationFolder = 'Download';
|
|
8
|
+
this.zipFileName = SDKUI_Localizator.Result.toLowerCase() + '.zip';
|
|
9
|
+
this.zipPassword = '';
|
|
10
|
+
this.fileNamingMode = 'documentTypeAndDid';
|
|
11
|
+
this.separatorChar = '_';
|
|
12
|
+
this.invoiceFormat = InvoiceRetrieveFormats.ASW_HTML;
|
|
13
|
+
this.orderFormat = OrderRetrieveFormats.NSO_HTML;
|
|
14
|
+
this.fileExistsMode = 'overwrite';
|
|
15
|
+
this.removeSignature = false;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
4
18
|
export const dcmtsFileCacheDownload = new Map();
|
|
5
19
|
export const dcmtsFileCachePreview = new Map();
|
|
6
20
|
export const CACHE_SIZE_LIMIT = 10;
|
|
@@ -24,6 +38,7 @@ export class UserSettings {
|
|
|
24
38
|
this.wgDraftCheckoutInfo = [];
|
|
25
39
|
this.dcmtCheckoutInfo = [];
|
|
26
40
|
this.defaultCheckInOutFolder = DEFAULT_CHECK_IN_OUT_FOLDER;
|
|
41
|
+
this.documentDownloadSettings = new DocumentDownloadSettings();
|
|
27
42
|
this.themeSettings = new ThemeSettings(skipCssUpdate);
|
|
28
43
|
}
|
|
29
44
|
/** Load settings from local storage or other sources */
|