@topconsultnpm/sdkui-react 6.22.0-dev1.2 → 6.22.0-dev1.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/features/documents/TMMergeToPdfForm.js +21 -13
- package/lib/components/features/documents/mergePdfUtils.d.ts +4 -0
- package/lib/components/features/documents/mergePdfUtils.js +6 -0
- package/lib/helper/SDKUI_Localizator.d.ts +3 -0
- package/lib/helper/SDKUI_Localizator.js +42 -12
- package/package.json +1 -1
|
@@ -82,7 +82,7 @@ const TMMergeToPdfForm = (props) => {
|
|
|
82
82
|
pdfValidationItems.push(new ValidationItem(ResultTypes.ERROR, SDKUI_Localizator.PdfFileName, SDKUI_Localizator.RequiredField));
|
|
83
83
|
}
|
|
84
84
|
// ---- Statistiche selezione PDF / convertibili / non-PDF ----
|
|
85
|
-
const { convertibleSelectedItems, hasConvertibleSelected, nonPdfSelectedItems, hasNonPdfSelected, metadataOnlySelectedItems, hasMetadataOnlySelected, mergeableSelectedCount, hasEnoughPdfForMerge, } = getMergePdfSelectionStats(selectedDcmtInfos, selectedItemsFull, selectedItemsRelationViewer, showTMRelationViewer);
|
|
85
|
+
const { convertibleSelectedItems, hasConvertibleSelected, nonPdfSelectedItems, hasNonPdfSelected, metadataOnlySelectedItems, hasMetadataOnlySelected, pdfSelectedItems, hasPdfSelected, mergeableSelectedCount, hasEnoughPdfForMerge, } = getMergePdfSelectionStats(selectedDcmtInfos, selectedItemsFull, selectedItemsRelationViewer, showTMRelationViewer);
|
|
86
86
|
const isFormValid = () => pdfValidationItems.length === 0;
|
|
87
87
|
// ---- Recupero dei file PDF da unire (condiviso tra Esegui e Anteprima) ----
|
|
88
88
|
const collectPdfFilesToMerge = async () => {
|
|
@@ -285,7 +285,7 @@ const TMMergeToPdfForm = (props) => {
|
|
|
285
285
|
width: 'max-content',
|
|
286
286
|
backgroundColor: TMColors.default_background,
|
|
287
287
|
zIndex: 1,
|
|
288
|
-
}, children: SDKUI_Localizator.Path }), _jsxs("div", { style: { border: `1px solid ${TMColors.border_normal}`, borderRadius: '5px', padding: '4px 10px 4px 13px', display: 'flex', alignItems: 'center', gap: '8px', backgroundColor: '#fafafa' }, children: [_jsx(IconFolderOpen, {}), _jsx("span", { style: { fontSize: '0.9rem', color: '#333' }, children: "Download" })] }), _jsx("span", { style: { fontSize: '0.8rem', color: '#888', fontStyle: 'italic', marginTop: '4px', display: 'block' }, children: SDKUI_Localizator.BrowserDoesNotSupportFolderSelection })] }) })), _jsx("div", { style: { flex: '1.5 1 420px', minWidth: '350px', width: '100%' }, children: _jsx(TMTextBox, { label: SDKUI_Localizator.PdfFileName, value: pdfFileName, validationItems: pdfValidationItems, autoComplete: "one-time-code", onValueChanged: (e) => setPdfFileName(e.target.value) }) })] }), (hasConvertibleSelected || hasMetadataOnlySelected || !hasEnoughPdfForMerge || hasNonPdfSelected) && (_jsxs("div", { style: {
|
|
288
|
+
}, children: SDKUI_Localizator.Path }), _jsxs("div", { style: { border: `1px solid ${TMColors.border_normal}`, borderRadius: '5px', padding: '4px 10px 4px 13px', display: 'flex', alignItems: 'center', gap: '8px', backgroundColor: '#fafafa' }, children: [_jsx(IconFolderOpen, {}), _jsx("span", { style: { fontSize: '0.9rem', color: '#333' }, children: "Download" })] }), _jsx("span", { style: { fontSize: '0.8rem', color: '#888', fontStyle: 'italic', marginTop: '4px', display: 'block' }, children: SDKUI_Localizator.BrowserDoesNotSupportFolderSelection })] }) })), _jsx("div", { style: { flex: '1.5 1 420px', minWidth: '350px', width: '100%' }, children: _jsx(TMTextBox, { label: SDKUI_Localizator.PdfFileName, value: pdfFileName, validationItems: pdfValidationItems, autoComplete: "one-time-code", onValueChanged: (e) => setPdfFileName(e.target.value) }) })] }), (hasConvertibleSelected || hasMetadataOnlySelected || !hasEnoughPdfForMerge || hasNonPdfSelected || hasPdfSelected) && (_jsxs("div", { style: {
|
|
289
289
|
display: 'flex',
|
|
290
290
|
flexDirection: 'column',
|
|
291
291
|
gap: '6px',
|
|
@@ -308,17 +308,25 @@ const TMMergeToPdfForm = (props) => {
|
|
|
308
308
|
}, children: SDKUI_Localizator.NotesAndWarnings }), _jsxs("ul", { style: { margin: 0, paddingLeft: '18px', display: 'flex', flexDirection: 'column', gap: '4px' }, children: [(hasConvertibleSelected || hasMetadataOnlySelected) && (_jsx("li", { style: { color: '#00527a' }, children: (() => {
|
|
309
309
|
// Combina convertibili + metadataOnly
|
|
310
310
|
const allConvertible = [...convertibleSelectedItems, ...metadataOnlySelectedItems];
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
311
|
+
// Conta le occorrenze per ogni estensione
|
|
312
|
+
const extCounts = new Map();
|
|
313
|
+
convertibleSelectedItems.forEach(i => {
|
|
314
|
+
const ext = (i.ext ?? '').toString().trim().toLowerCase().replace(/^\./, '');
|
|
315
|
+
if (ext.length > 0) {
|
|
316
|
+
extCounts.set(ext, (extCounts.get(ext) || 0) + 1);
|
|
317
|
+
}
|
|
318
|
+
});
|
|
319
|
+
if (hasMetadataOnlySelected) {
|
|
320
|
+
extCounts.set('metadati', metadataOnlySelectedItems.length);
|
|
321
|
+
}
|
|
322
|
+
// Genera label per tooltip: "3 xml, 2 doc, 1 metadati"
|
|
323
|
+
const extLabel = Array.from(extCounts.entries()).map(([ext, count]) => `${count} ${ext}`).join(', ');
|
|
324
|
+
return (_jsxs("span", { style: { display: 'inline-flex', alignItems: 'center', gap: '6px' }, children: [_jsx("span", { children: allConvertible.length === 1
|
|
325
|
+
? SDKUI_Localizator.DocumentWillBeConvertedDuringMerge
|
|
326
|
+
: SDKUI_Localizator.DocumentsWillBeConvertedDuringMerge.replaceParams(allConvertible.length.toString()) }), extLabel && (_jsx(TMTooltip, { content: _jsxs("div", { style: { minWidth: 180, padding: "10px 12px", borderRadius: 8 }, children: [_jsxs("div", { style: { textAlign: "center", fontWeight: 600, fontSize: 13, marginBottom: 10, paddingBottom: 8, borderBottom: "1px solid rgba(255,255,255,0.15)" }, children: [SDKUI_Localizator.ConversionDetails, " (", Array.from(extCounts.values()).reduce((a, b) => a + b, 0), ")"] }), _jsx("div", { style: { display: "flex", flexDirection: "column", gap: 4, maxHeight: 150, overflowY: "auto" }, children: Array.from(extCounts.entries()).sort((a, b) => a[0].localeCompare(b[0])).map(([ext, count]) => (_jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", padding: "4px 8px", background: "rgba(255,255,255,0.08)", borderRadius: 4 }, children: [_jsx("span", { style: { fontSize: 11, fontWeight: 500, textTransform: "uppercase" }, children: ext }), _jsx("span", { style: { display: "inline-flex", alignItems: "center", justifyContent: "center", minWidth: 24, height: 24, padding: "0 6px", background: "transparent", border: "2px solid #4caf50", borderRadius: 12, fontSize: 11, fontWeight: 600, lineHeight: 1 }, children: count > 99 ? '99+' : count })] }, ext))) })] }), children: _jsx("span", { style: { display: 'inline-flex', alignItems: 'center', cursor: 'help' }, children: _jsx("i", { className: "dx-icon-info", style: { fontSize: '16px', color: '#00527a' } }) }) }))] }));
|
|
327
|
+
})() })), hasPdfSelected && (_jsx("li", { style: { color: '#00527a' }, children: pdfSelectedItems.length === 1
|
|
328
|
+
? SDKUI_Localizator.DocumentAlreadyInPdfNoConversionNeeded
|
|
329
|
+
: SDKUI_Localizator.DocumentsAlreadyInPdfNoConversionNeeded.replaceParams(pdfSelectedItems.length.toString()) })), !hasEnoughPdfForMerge && (_jsx("li", { style: { color: '#7a5d00' }, children: mergeableSelectedCount === 0
|
|
322
330
|
? SDKUI_Localizator.NoPdfOrConvertibleFilesSelected_Param.replaceParams(MIN_PDF_FOR_MERGE.toString())
|
|
323
331
|
: SDKUI_Localizator.OnlyOnePdfOrConvertibleFileSelected.replaceParams(MIN_PDF_FOR_MERGE.toString()) })), hasNonPdfSelected && (_jsx("li", { style: { color: '#7a5d00' }, children: (() => {
|
|
324
332
|
const extSet = Array.from(new Set(nonPdfSelectedItems.map(i => (i.ext ?? '').toString().trim().toLowerCase().replace(/^\./, '')).filter(e => e.length > 0)));
|
|
@@ -19,6 +19,10 @@ export interface IMergePdfSelectionStats {
|
|
|
19
19
|
metadataOnlySelectedItems: Array<ISelectedItemInfo>;
|
|
20
20
|
/** True se ci sono documenti di soli metadati selezionati */
|
|
21
21
|
hasMetadataOnlySelected: boolean;
|
|
22
|
+
/** Elementi già in formato PDF (non richiedono conversione) */
|
|
23
|
+
pdfSelectedItems: Array<ISelectedItemInfo>;
|
|
24
|
+
/** True se ci sono elementi già in PDF selezionati */
|
|
25
|
+
hasPdfSelected: boolean;
|
|
22
26
|
/** Numero totale di file unibili (PDF nativi + convertibili) */
|
|
23
27
|
mergeableSelectedCount: number;
|
|
24
28
|
/** True se ci sono abbastanza file per il merge (>= MIN_PDF_FOR_MERGE) */
|
|
@@ -65,6 +65,10 @@ export const getMergePdfSelectionStats = (selectedDcmtInfos, selectedItemsFull,
|
|
|
65
65
|
const metadataOnlySelectedItems = docs
|
|
66
66
|
.filter(i => i.isMetadataOnly)
|
|
67
67
|
.map(i => ({ key: i.key, ext: i.ext }));
|
|
68
|
+
// Elementi già in formato PDF (non richiedono conversione)
|
|
69
|
+
const pdfSelectedItems = docs
|
|
70
|
+
.filter(i => i.isPdf && !i.isMetadataOnly)
|
|
71
|
+
.map(i => ({ key: i.key, ext: i.ext }));
|
|
68
72
|
// Conteggio file unibili: PDF nativi + convertibili + documenti di soli metadati
|
|
69
73
|
const mergeableSelectedCount = docs
|
|
70
74
|
.filter(i => i.isPdf || i.isConvertible || i.isMetadataOnly).length;
|
|
@@ -75,6 +79,8 @@ export const getMergePdfSelectionStats = (selectedDcmtInfos, selectedItemsFull,
|
|
|
75
79
|
hasNonPdfSelected: nonPdfSelectedItems.length > 0,
|
|
76
80
|
metadataOnlySelectedItems,
|
|
77
81
|
hasMetadataOnlySelected: metadataOnlySelectedItems.length > 0,
|
|
82
|
+
pdfSelectedItems,
|
|
83
|
+
hasPdfSelected: pdfSelectedItems.length > 0,
|
|
78
84
|
mergeableSelectedCount,
|
|
79
85
|
// Merge possibile se: >= 2 file unibili OPPURE >= 1 file convertibile/metadata-only (verrà trasformato in PDF)
|
|
80
86
|
hasEnoughPdfForMerge: mergeableSelectedCount >= MIN_PDF_FOR_MERGE ||
|
|
@@ -226,6 +226,9 @@ export declare class SDKUI_Localizator {
|
|
|
226
226
|
static get DocumentTypeNameAndCustomMetadata(): string;
|
|
227
227
|
static get DocumentWillBeConvertedDuringMerge(): string;
|
|
228
228
|
static get DocumentsWillBeConvertedDuringMerge(): string;
|
|
229
|
+
static get DocumentAlreadyInPdfNoConversionNeeded(): string;
|
|
230
|
+
static get DocumentsAlreadyInPdfNoConversionNeeded(): string;
|
|
231
|
+
static get ConversionDetails(): string;
|
|
229
232
|
static get Domain(): "Domäne" | "Domain" | "Dominio" | "Domaine";
|
|
230
233
|
static get DoNotCopy(): string;
|
|
231
234
|
static get Dossier(): "Übung" | "Dossier" | "Expediente" | "Pratique" | "Prática" | "Pratica";
|
|
@@ -2191,22 +2191,52 @@ export class SDKUI_Localizator {
|
|
|
2191
2191
|
}
|
|
2192
2192
|
static get DocumentWillBeConvertedDuringMerge() {
|
|
2193
2193
|
switch (this._cultureID) {
|
|
2194
|
-
case CultureIDs.De_DE: return "Ein Dokument
|
|
2195
|
-
case CultureIDs.En_US: return "One document
|
|
2196
|
-
case CultureIDs.Es_ES: return "Un documento
|
|
2197
|
-
case CultureIDs.Fr_FR: return "Un document
|
|
2198
|
-
case CultureIDs.Pt_PT: return "Um documento
|
|
2199
|
-
default: return "Un documento
|
|
2194
|
+
case CultureIDs.De_DE: return "Ein Dokument wird während der Zusammenführung in PDF konvertiert";
|
|
2195
|
+
case CultureIDs.En_US: return "One document will be converted to PDF during the merge";
|
|
2196
|
+
case CultureIDs.Es_ES: return "Un documento se convertirá a PDF durante la unión";
|
|
2197
|
+
case CultureIDs.Fr_FR: return "Un document sera converti en PDF lors de la fusion";
|
|
2198
|
+
case CultureIDs.Pt_PT: return "Um documento será convertido em PDF durante a fusão";
|
|
2199
|
+
default: return "Un documento verrà convertito in PDF durante l'unione";
|
|
2200
2200
|
}
|
|
2201
2201
|
}
|
|
2202
2202
|
static get DocumentsWillBeConvertedDuringMerge() {
|
|
2203
2203
|
switch (this._cultureID) {
|
|
2204
|
-
case CultureIDs.De_DE: return "{{0}} Dokumente
|
|
2205
|
-
case CultureIDs.En_US: return "{{0}} documents
|
|
2206
|
-
case CultureIDs.Es_ES: return "{{0}} documentos
|
|
2207
|
-
case CultureIDs.Fr_FR: return "{{0}} documents
|
|
2208
|
-
case CultureIDs.Pt_PT: return "{{0}} documentos
|
|
2209
|
-
default: return "{{0}} documenti
|
|
2204
|
+
case CultureIDs.De_DE: return "{{0}} Dokumente werden während der Zusammenführung in PDF konvertiert";
|
|
2205
|
+
case CultureIDs.En_US: return "{{0}} documents will be converted to PDF during the merge";
|
|
2206
|
+
case CultureIDs.Es_ES: return "{{0}} documentos se convertirán a PDF durante la unión";
|
|
2207
|
+
case CultureIDs.Fr_FR: return "{{0}} documents seront convertis en PDF lors de la fusion";
|
|
2208
|
+
case CultureIDs.Pt_PT: return "{{0}} documentos serão convertidos em PDF durante a fusão";
|
|
2209
|
+
default: return "{{0}} documenti verranno convertiti in PDF durante l'unione";
|
|
2210
|
+
}
|
|
2211
|
+
}
|
|
2212
|
+
static get DocumentAlreadyInPdfNoConversionNeeded() {
|
|
2213
|
+
switch (this._cultureID) {
|
|
2214
|
+
case CultureIDs.De_DE: return "Ein Dokument ist bereits im PDF-Format und erfordert keine Konvertierung";
|
|
2215
|
+
case CultureIDs.En_US: return "One document is already in PDF format and does not require conversion";
|
|
2216
|
+
case CultureIDs.Es_ES: return "Un documento ya está en formato PDF y no requiere conversión";
|
|
2217
|
+
case CultureIDs.Fr_FR: return "Un document est déjà au format PDF et ne nécessite pas de conversion";
|
|
2218
|
+
case CultureIDs.Pt_PT: return "Um documento já está em formato PDF e não requer conversão";
|
|
2219
|
+
default: return "Un documento è già in formato PDF e non richiede conversione";
|
|
2220
|
+
}
|
|
2221
|
+
}
|
|
2222
|
+
static get DocumentsAlreadyInPdfNoConversionNeeded() {
|
|
2223
|
+
switch (this._cultureID) {
|
|
2224
|
+
case CultureIDs.De_DE: return "{{0}} Dokumente sind bereits im PDF-Format und erfordern keine Konvertierung";
|
|
2225
|
+
case CultureIDs.En_US: return "{{0}} documents are already in PDF format and do not require conversion";
|
|
2226
|
+
case CultureIDs.Es_ES: return "{{0}} documentos ya están en formato PDF y no requieren conversión";
|
|
2227
|
+
case CultureIDs.Fr_FR: return "{{0}} documents sont déjà au format PDF et ne nécessitent pas de conversion";
|
|
2228
|
+
case CultureIDs.Pt_PT: return "{{0}} documentos já estão em formato PDF e não requerem conversão";
|
|
2229
|
+
default: return "{{0}} documenti sono già in formato PDF e non richiedono conversione";
|
|
2230
|
+
}
|
|
2231
|
+
}
|
|
2232
|
+
static get ConversionDetails() {
|
|
2233
|
+
switch (this._cultureID) {
|
|
2234
|
+
case CultureIDs.De_DE: return "Konvertierungsdetails";
|
|
2235
|
+
case CultureIDs.En_US: return "Conversion details";
|
|
2236
|
+
case CultureIDs.Es_ES: return "Detalles de conversión";
|
|
2237
|
+
case CultureIDs.Fr_FR: return "Détails de conversion";
|
|
2238
|
+
case CultureIDs.Pt_PT: return "Detalhes da conversão";
|
|
2239
|
+
default: return "Dettaglio conversioni";
|
|
2210
2240
|
}
|
|
2211
2241
|
}
|
|
2212
2242
|
static get Domain() {
|