@topconsultnpm/sdkui-react 6.21.0-t2 → 6.21.0-t4
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/NewComponents/ContextMenu/TMContextMenu.js +28 -2
- package/lib/components/NewComponents/ContextMenu/styles.d.ts +4 -4
- package/lib/components/NewComponents/FloatingMenuBar/styles.d.ts +6 -6
- package/lib/components/base/Styled.d.ts +1 -1
- package/lib/components/base/TMAreaManager.js +11 -0
- package/lib/components/base/TMCounterBar.d.ts +2 -2
- package/lib/components/base/TMCounterContainer.d.ts +2 -1
- package/lib/components/base/TMCustomButton.d.ts +1 -1
- package/lib/components/base/TMDataGrid.js +12 -2
- package/lib/components/base/TMDataGridExportForm.d.ts +2 -1
- package/lib/components/base/TMDataGridExportForm.js +19 -8
- package/lib/components/base/TMFileManager.d.ts +2 -1
- package/lib/components/base/TMFileManagerDataGridView.d.ts +2 -1
- package/lib/components/base/TMFileManagerDataGridView.js +4 -4
- package/lib/components/base/TMFileManagerThumbnailItems.d.ts +1 -1
- package/lib/components/base/TMFileManagerThumbnailItems.js +3 -3
- package/lib/components/base/TMFileManagerThumbnailsView.d.ts +1 -1
- package/lib/components/base/TMFileManagerUtils.d.ts +7 -0
- package/lib/components/base/TMFileManagerUtils.js +14 -1
- package/lib/components/base/TMLayout.d.ts +4 -4
- package/lib/components/base/TMList.d.ts +2 -1
- package/lib/components/base/TMListView.d.ts +1 -1
- package/lib/components/base/TMModal.js +2 -2
- package/lib/components/base/TMPopUp.d.ts +1 -0
- package/lib/components/base/TMPopUp.js +59 -2
- package/lib/components/base/TMSpinner.d.ts +5 -2
- package/lib/components/base/TMSpinner.js +33 -6
- package/lib/components/base/TMTab.d.ts +4 -3
- package/lib/components/base/TMTooltip.d.ts +1 -1
- package/lib/components/base/TMTreeView.d.ts +16 -13
- package/lib/components/base/TMTreeView.js +242 -79
- package/lib/components/base/TMUserAvatar.d.ts +2 -1
- package/lib/components/base/TMVilViewer.d.ts +2 -1
- package/lib/components/base/TMWaitPanel.d.ts +5 -2
- package/lib/components/base/TMWaitPanel.js +8 -6
- package/lib/components/choosers/TMDistinctValues.js +1 -1
- package/lib/components/choosers/TMDynDataListItemChooser.d.ts +1 -1
- package/lib/components/choosers/TMDynDataListItemChooser.js +6 -1
- package/lib/components/choosers/TMGroupChooser.js +1 -1
- package/lib/components/choosers/TMInvoiceRetrieveFormats.d.ts +2 -1
- package/lib/components/choosers/TMOrderRetrieveFormats.d.ts +2 -1
- package/lib/components/choosers/TMRelationChooser.d.ts +3 -3
- package/lib/components/choosers/TMUserChooser.d.ts +2 -2
- package/lib/components/editors/TMEditorStyled.d.ts +6 -6
- package/lib/components/editors/TMFormulaEditor.d.ts +2 -1
- package/lib/components/editors/TMFormulaEditor.js +98 -49
- package/lib/components/editors/TMHtmlContentDisplay.d.ts +2 -1
- package/lib/components/editors/TMHtmlEditor.d.ts +2 -1
- package/lib/components/editors/TMMetadataEditor.js +6 -2
- package/lib/components/editors/TMMetadataValues.js +23 -6
- package/lib/components/editors/TMTextBox.d.ts +1 -0
- package/lib/components/editors/TMTextBox.js +2 -1
- package/lib/components/editors/TMTreeDropDown.d.ts +1 -1
- package/lib/components/features/assistant/TMToppyDraggableHelpCenter.d.ts +1 -1
- package/lib/components/features/blog/TMBlogCommentForm.d.ts +2 -1
- package/lib/components/features/blog/TMBlogCommentForm.js +5 -2
- package/lib/components/features/documents/TMCopyToFolderForm.js +46 -24
- package/lib/components/features/documents/TMDcmtForm.d.ts +2 -0
- package/lib/components/features/documents/TMDcmtForm.js +21 -10
- package/lib/components/features/documents/TMDcmtFormActionButtons.d.ts +1 -1
- package/lib/components/features/documents/TMDcmtIcon.d.ts +4 -1
- package/lib/components/features/documents/TMDcmtIcon.js +6 -33
- package/lib/components/features/documents/TMDcmtPreview.d.ts +1 -1
- package/lib/components/features/documents/TMDcmtTasks.d.ts +2 -1
- package/lib/components/features/documents/TMDragDropOverlay.d.ts +1 -1
- package/lib/components/features/documents/TMFileUploader.js +1 -1
- package/lib/components/features/documents/TMMasterDetailDcmts.d.ts +2 -2
- package/lib/components/features/documents/TMMasterDetailDcmts.js +55 -16
- package/lib/components/features/documents/TMMergeToPdfForm.d.ts +2 -3
- package/lib/components/features/documents/TMMergeToPdfForm.js +115 -56
- package/lib/components/features/documents/TMRelationViewer.d.ts +12 -10
- package/lib/components/features/documents/TMRelationViewer.js +405 -95
- package/lib/components/features/documents/copyAndMergeDcmtsShared.d.ts +4 -16
- package/lib/components/features/documents/copyAndMergeDcmtsShared.js +47 -61
- package/lib/components/features/documents/mergePdfUtils.d.ts +52 -0
- package/lib/components/features/documents/mergePdfUtils.js +268 -0
- package/lib/components/features/search/TMDcmtCheckoutInfoForm.d.ts +2 -1
- package/lib/components/features/search/TMMetadataOutputForm.d.ts +18 -0
- package/lib/components/features/search/TMMetadataOutputForm.js +225 -0
- package/lib/components/features/search/TMMetadataSorterForm.d.ts +18 -0
- package/lib/components/features/search/TMMetadataSorterForm.js +243 -0
- package/lib/components/features/search/TMSavedQuerySelector.d.ts +2 -2
- package/lib/components/features/search/TMSearch.d.ts +2 -2
- package/lib/components/features/search/TMSearch.js +2 -2
- package/lib/components/features/search/TMSearchQueryEditor.js +14 -8
- package/lib/components/features/search/TMSearchQueryPanel.js +249 -58
- package/lib/components/features/search/TMSearchResult.d.ts +3 -2
- package/lib/components/features/search/TMSearchResult.js +94 -25
- package/lib/components/features/search/TMSearchResultFloatingActionButton.d.ts +1 -1
- package/lib/components/features/search/TMSignatureInfoContent.d.ts +2 -1
- package/lib/components/features/search/TMViewHistoryDcmt.d.ts +2 -1
- package/lib/components/features/search/TMViewHistoryDcmt.js +1 -1
- package/lib/components/features/search/metadataFormHelper.d.ts +16 -0
- package/lib/components/features/search/metadataFormHelper.js +77 -0
- package/lib/components/features/tasks/TMTaskForm.d.ts +1 -1
- package/lib/components/features/tasks/TMTaskFormUtils.d.ts +10 -10
- package/lib/components/features/tasks/TMTasksAgenda.d.ts +1 -1
- package/lib/components/features/tasks/TMTasksCalendar.d.ts +1 -1
- package/lib/components/features/tasks/TMTasksHeader.d.ts +1 -1
- package/lib/components/features/tasks/TMTasksPanelContent.d.ts +1 -1
- package/lib/components/features/tasks/TMTasksUtilsView.d.ts +5 -5
- package/lib/components/features/tasks/TMTasksView.d.ts +1 -1
- package/lib/components/features/wg/TMWGsCopyMoveForm.d.ts +3 -2
- package/lib/components/features/workflow/TMWorkflowPopup.d.ts +8 -7
- package/lib/components/forms/Login/Chooser.d.ts +2 -2
- package/lib/components/forms/Login/TMLoginForm.js +15 -3
- package/lib/components/forms/TMChooserForm.d.ts +2 -1
- package/lib/components/forms/TMSaveForm.d.ts +4 -4
- package/lib/components/grids/TMBlogAttachments.d.ts +2 -1
- package/lib/components/grids/TMBlogAttachments.js +2 -2
- package/lib/components/grids/TMBlogHeader.d.ts +1 -1
- package/lib/components/grids/TMBlogsPost.d.ts +1 -1
- package/lib/components/grids/TMBlogsPost.js +5 -3
- package/lib/components/grids/TMBlogsPostUtils.d.ts +10 -9
- package/lib/components/grids/TMBlogsPostUtils.js +3 -1
- package/lib/components/grids/TMValidationItemsList.d.ts +2 -1
- package/lib/components/layout/panelManager/TMPanelManagerContainer.d.ts +2 -1
- package/lib/components/layout/panelManager/TMPanelManagerContext.d.ts +2 -2
- package/lib/components/layout/panelManager/TMPanelManagerToolbar.d.ts +1 -1
- package/lib/components/layout/panelManager/TMPanelManagerWithPersistenceProvider.d.ts +2 -2
- package/lib/components/layout/panelManager/TMPanelWrapper.d.ts +2 -2
- package/lib/components/pages/TMPage.d.ts +1 -1
- package/lib/components/settings/SettingsAppearance.d.ts +2 -1
- package/lib/components/sidebar/TMAboutApp.d.ts +2 -1
- package/lib/components/sidebar/TMHeader.d.ts +3 -3
- package/lib/components/viewers/TMDataListItemViewer.d.ts +3 -2
- package/lib/components/viewers/TMDataUserIdItemViewer.d.ts +3 -2
- package/lib/components/viewers/TMMidViewer.d.ts +2 -2
- package/lib/components/viewers/TMTidViewer.d.ts +2 -2
- package/lib/components/viewers/TMTidViewer.js +14 -2
- package/lib/components/wizard/TMWizard.d.ts +1 -0
- package/lib/components/wizard/TMWizard.js +5 -3
- package/lib/helper/Enum_Localizator.js +2 -0
- package/lib/helper/MergePdfManager.d.ts +45 -0
- package/lib/helper/MergePdfManager.js +148 -0
- package/lib/helper/SDKUI_Globals.d.ts +1 -0
- package/lib/helper/SDKUI_Globals.js +3 -1
- package/lib/helper/SDKUI_Localizator.d.ts +40 -0
- package/lib/helper/SDKUI_Localizator.js +412 -12
- package/lib/helper/TMCommandsContextMenu.d.ts +1 -1
- package/lib/helper/TMIcons.d.ts +278 -278
- package/lib/helper/TMPdfViewer.d.ts +2 -1
- package/lib/helper/TMToppyMessage.d.ts +2 -2
- package/lib/helper/TMUtils.d.ts +57 -21
- package/lib/helper/TMUtils.js +159 -1
- package/lib/helper/certificateImportHelper.d.ts +43 -0
- package/lib/helper/certificateImportHelper.js +403 -0
- package/lib/helper/checkinCheckoutManager.d.ts +4 -3
- package/lib/helper/checkinCheckoutManager.js +29 -11
- package/lib/helper/helpers.d.ts +3 -2
- package/lib/helper/helpers.js +10 -0
- package/lib/helper/index.d.ts +1 -0
- package/lib/helper/index.js +1 -0
- package/lib/hooks/useCheckInOutOperations.d.ts +4 -3
- package/lib/hooks/useDataUserIdItem.js +1 -1
- package/lib/hooks/useDcmtOperations.d.ts +20 -2
- package/lib/hooks/useDcmtOperations.js +244 -25
- package/lib/hooks/useDocumentOperations.d.ts +2 -2
- package/lib/hooks/useDocumentOperations.js +52 -13
- package/lib/hooks/useInputDialog.d.ts +2 -1
- package/lib/hooks/useRelatedDocuments.js +4 -4
- package/lib/services/platform_services.d.ts +7 -6
- package/lib/ts/types.d.ts +3 -1
- package/lib/ts/types.js +2 -0
- package/package.json +15 -7
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { MetadataDescriptor } from '@topconsultnpm/sdk-ts';
|
|
2
3
|
import { DcmtInfo } from '../../../ts';
|
|
3
4
|
import { DocumentDownloadSettings, FileNamingMode } from '../../../helper';
|
|
4
5
|
import { IRelatedDcmt } from './TMMasterDetailDcmts';
|
|
@@ -19,19 +20,6 @@ export declare const isDirectoryPickerSupported: () => boolean;
|
|
|
19
20
|
* il file viene restituito senza firma.
|
|
20
21
|
*/
|
|
21
22
|
export declare const isPdfExt: (ext: string | null | undefined) => boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Estrae l'estensione completa da un nome file, gestendo estensioni composite
|
|
24
|
-
* a più livelli come .PDF.P7M, .XML.P7M.TS, etc.
|
|
25
|
-
*
|
|
26
|
-
* Esempi:
|
|
27
|
-
* - "documento.pdf" -> ".pdf"
|
|
28
|
-
* - "DCMT_123.PDF.P7M" -> ".PDF.P7M"
|
|
29
|
-
* - "fattura.xml.p7m" -> ".xml.p7m"
|
|
30
|
-
* - "example.XML.P7M.TS" -> ".XML.P7M.TS"
|
|
31
|
-
* - "file.tar.gz" -> ".gz" (tar.gz non è gestito come firma)
|
|
32
|
-
* - "file" -> ""
|
|
33
|
-
*/
|
|
34
|
-
export declare const getFullFileExtension: (fileName: string, depth?: number) => string;
|
|
35
23
|
/**
|
|
36
24
|
* Estrae il nome base del file (senza estensione completa).
|
|
37
25
|
* Gestisce estensioni composite come .PDF.P7M
|
|
@@ -45,9 +33,9 @@ export declare const fileExists: (dirHandle: FileSystemDirectoryHandle, fileName
|
|
|
45
33
|
export declare const generateUniqueFileName: (dirHandle: FileSystemDirectoryHandle, originalName: string) => Promise<string>;
|
|
46
34
|
/** Recupera il nome leggibile del tipo documento (cache) */
|
|
47
35
|
export declare const getTypeName: (tid: number | undefined) => Promise<string>;
|
|
48
|
-
/** Formatta un valore convertendo le date
|
|
49
|
-
export declare const formatMetadataValue: (value: string) => string;
|
|
50
|
-
/** Recupera i metadati filtrati
|
|
36
|
+
/** Formatta un valore convertendo le date secondo il formato specificato in MetadataDescriptor.format */
|
|
37
|
+
export declare const formatMetadataValue: (value: string, md?: MetadataDescriptor) => string;
|
|
38
|
+
/** Recupera i metadati filtrati usando buildDcmtDisplayName, concatenati con separatorChar */
|
|
51
39
|
export declare const getFilteredMetadata: (tid: number, did: number, separatorChar: string) => Promise<string | null>;
|
|
52
40
|
/** Opzioni di naming necessarie per generare il nome del file di destinazione */
|
|
53
41
|
export interface IFileNamingOptions {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DcmtTypeListCacheService, LayoutModes, SDK_Globals } from '@topconsultnpm/sdk-ts';
|
|
2
|
-
import { searchResultToMetadataValues, DocumentDownloadSettings } from '../../../helper';
|
|
1
|
+
import { DcmtTypeListCacheService, LayoutModes, MetadataDataTypes, MetadataFormats, SDK_Globals } from '@topconsultnpm/sdk-ts';
|
|
2
|
+
import { searchResultToMetadataValues, DocumentDownloadSettings, getFullFileExtension, buildDcmtDisplayName } from '../../../helper';
|
|
3
3
|
import { TMColors } from '../../../utils/theme';
|
|
4
4
|
/** Numero minimo di file PDF necessari per poterli unire in un unico documento. */
|
|
5
5
|
export const MIN_PDF_FOR_MERGE = 2;
|
|
@@ -61,44 +61,6 @@ export const isPdfExt = (ext) => {
|
|
|
61
61
|
const normalized = ext.trim().toLowerCase().replace(/^\./, '');
|
|
62
62
|
return normalized === 'pdf' || normalized === 'pdf.p7m' || normalized === 'pdf.tsd' || normalized === 'pdf.m7m';
|
|
63
63
|
};
|
|
64
|
-
/**
|
|
65
|
-
* Estensioni di firma/marca temporale note che possono avvolgere altre estensioni.
|
|
66
|
-
* Es: file.pdf.p7m, file.xml.p7m, file.docx.p7m, file.xml.p7m.ts
|
|
67
|
-
*/
|
|
68
|
-
const SIGNATURE_EXTENSIONS = new Set(['p7m', 'p7s', 'm7m', 'tsd', 'tsr', 'ts']);
|
|
69
|
-
/** Profondità massima di ricorsione per la ricerca di estensioni composite */
|
|
70
|
-
const MAX_EXTENSION_DEPTH = 5;
|
|
71
|
-
/**
|
|
72
|
-
* Estrae l'estensione completa da un nome file, gestendo estensioni composite
|
|
73
|
-
* a più livelli come .PDF.P7M, .XML.P7M.TS, etc.
|
|
74
|
-
*
|
|
75
|
-
* Esempi:
|
|
76
|
-
* - "documento.pdf" -> ".pdf"
|
|
77
|
-
* - "DCMT_123.PDF.P7M" -> ".PDF.P7M"
|
|
78
|
-
* - "fattura.xml.p7m" -> ".xml.p7m"
|
|
79
|
-
* - "example.XML.P7M.TS" -> ".XML.P7M.TS"
|
|
80
|
-
* - "file.tar.gz" -> ".gz" (tar.gz non è gestito come firma)
|
|
81
|
-
* - "file" -> ""
|
|
82
|
-
*/
|
|
83
|
-
export const getFullFileExtension = (fileName, depth = 0) => {
|
|
84
|
-
if (!fileName || depth > MAX_EXTENSION_DEPTH)
|
|
85
|
-
return '';
|
|
86
|
-
const lastDotIndex = fileName.lastIndexOf('.');
|
|
87
|
-
if (lastDotIndex <= 0)
|
|
88
|
-
return '';
|
|
89
|
-
const lastExtension = fileName.substring(lastDotIndex + 1).toLowerCase();
|
|
90
|
-
// Se l'ultima estensione è una firma/marca, cerca ricorsivamente le estensioni precedenti
|
|
91
|
-
if (SIGNATURE_EXTENSIONS.has(lastExtension)) {
|
|
92
|
-
const nameWithoutLastExt = fileName.substring(0, lastDotIndex);
|
|
93
|
-
const innerExtension = getFullFileExtension(nameWithoutLastExt, depth + 1);
|
|
94
|
-
if (innerExtension) {
|
|
95
|
-
// Concatena l'estensione interna con quella corrente
|
|
96
|
-
return innerExtension + fileName.substring(lastDotIndex);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
// Estensione singola (o estensione base dopo le firme)
|
|
100
|
-
return fileName.substring(lastDotIndex);
|
|
101
|
-
};
|
|
102
64
|
/**
|
|
103
65
|
* Estrae il nome base del file (senza estensione completa).
|
|
104
66
|
* Gestisce estensioni composite come .PDF.P7M
|
|
@@ -120,7 +82,7 @@ export const sanitizeFileName = (fileName, fallbackName, maxLength = 255) => {
|
|
|
120
82
|
const illegalCharsRegex = /[<>:"/\\|?*]/g;
|
|
121
83
|
const controlCharsRegex = /[\x00-\x1F\x7F]/g;
|
|
122
84
|
let sanitized = fileName
|
|
123
|
-
.replace(illegalCharsRegex, '
|
|
85
|
+
.replace(illegalCharsRegex, '-')
|
|
124
86
|
.replace(controlCharsRegex, '')
|
|
125
87
|
.trim();
|
|
126
88
|
sanitized = sanitized.replace(/[. ]+$/, '');
|
|
@@ -184,27 +146,40 @@ export const getTypeName = async (tid) => {
|
|
|
184
146
|
const foundDtd = typeList.find(dtd => dtd.id?.toString() === tid?.toString());
|
|
185
147
|
return foundDtd?.name ?? String(tid);
|
|
186
148
|
};
|
|
187
|
-
/** Formatta un valore convertendo le date
|
|
188
|
-
export const formatMetadataValue = (value) => {
|
|
149
|
+
/** Formatta un valore convertendo le date secondo il formato specificato in MetadataDescriptor.format */
|
|
150
|
+
export const formatMetadataValue = (value, md) => {
|
|
151
|
+
// Formatta come data solo se il MetadataDescriptor indica tipo DateTime
|
|
152
|
+
if (md?.dataType !== MetadataDataTypes.DateTime) {
|
|
153
|
+
return value;
|
|
154
|
+
}
|
|
189
155
|
const date = new Date(value);
|
|
190
|
-
if (
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
return
|
|
202
|
-
|
|
203
|
-
|
|
156
|
+
if (isNaN(date.getTime())) {
|
|
157
|
+
return value;
|
|
158
|
+
}
|
|
159
|
+
const format = md.format?.format;
|
|
160
|
+
const formatCulture = md.format?.formatCulture ?? window.navigator.language;
|
|
161
|
+
switch (format) {
|
|
162
|
+
case MetadataFormats.ShortDate:
|
|
163
|
+
return date.toLocaleString(formatCulture, formatCulture === "it-IT" ? { year: "numeric", month: "2-digit", day: "2-digit" } : { dateStyle: 'short' });
|
|
164
|
+
case MetadataFormats.ShortTime:
|
|
165
|
+
return date.toLocaleString(formatCulture, { timeStyle: 'short' });
|
|
166
|
+
case MetadataFormats.ShortDateLongTime:
|
|
167
|
+
return date.toLocaleString(formatCulture, formatCulture === "it-IT" ? { year: "numeric", month: "2-digit", day: "2-digit", hour: '2-digit', minute: '2-digit', second: '2-digit' } : { dateStyle: 'short', timeStyle: 'medium' }).replace(',', '');
|
|
168
|
+
case MetadataFormats.ShortDateShortTime:
|
|
169
|
+
return date.toLocaleString(formatCulture, formatCulture === "it-IT" ? { year: "numeric", month: "2-digit", day: "2-digit", hour: '2-digit', minute: '2-digit' } : { dateStyle: 'short', timeStyle: 'short' }).replace(',', '');
|
|
170
|
+
case MetadataFormats.LongDate:
|
|
171
|
+
return date.toLocaleString(formatCulture, { weekday: "long", year: "numeric", month: "long", day: "numeric" });
|
|
172
|
+
case MetadataFormats.LongTime:
|
|
173
|
+
return date.toLocaleString(formatCulture, { timeStyle: 'medium' });
|
|
174
|
+
case MetadataFormats.LongDateLongTime:
|
|
175
|
+
return date.toLocaleString(formatCulture, { weekday: "long", year: "numeric", month: "long", day: "numeric", hour: '2-digit', minute: '2-digit', second: '2-digit' });
|
|
176
|
+
case MetadataFormats.LongDateShortTime:
|
|
177
|
+
return date.toLocaleString(formatCulture, { weekday: "long", year: "numeric", month: "long", day: "numeric", hour: '2-digit', minute: '2-digit' });
|
|
178
|
+
default:
|
|
179
|
+
return date.toLocaleString(formatCulture, formatCulture === "it-IT" ? { year: "numeric", month: "2-digit", day: "2-digit" } : { dateStyle: 'short' });
|
|
204
180
|
}
|
|
205
|
-
return value;
|
|
206
181
|
};
|
|
207
|
-
/** Recupera i metadati filtrati
|
|
182
|
+
/** Recupera i metadati filtrati usando buildDcmtDisplayName, concatenati con separatorChar */
|
|
208
183
|
export const getFilteredMetadata = async (tid, did, separatorChar) => {
|
|
209
184
|
const metadata = await SDK_Globals.tmSession?.NewSearchEngine().GetMetadataAsync(tid, did, true);
|
|
210
185
|
if (!metadata)
|
|
@@ -215,8 +190,18 @@ export const getFilteredMetadata = async (tid, did, separatorChar) => {
|
|
|
215
190
|
const dtdWithMetadata = await DcmtTypeListCacheService.GetWithNotGrantedAsync(tid, did, metadata);
|
|
216
191
|
const mdList = dtdWithMetadata?.metadata ?? [];
|
|
217
192
|
const metadataList = searchResultToMetadataValues(tid, dtdResult, rows, mids, mdList, LayoutModes.Update);
|
|
218
|
-
|
|
219
|
-
|
|
193
|
+
// Converte l'array di MetadataValueDescriptorEx in DcmtMetadataMap per buildDcmtDisplayName
|
|
194
|
+
const metadataMap = Object.fromEntries(metadataList.filter(mvd => mvd.md?.name).map(mvd => [mvd.md.name, { md: mvd.md, value: mvd.value }]));
|
|
195
|
+
// Usa buildDcmtDisplayName per ricavare i nomi dei metadati da visualizzare
|
|
196
|
+
const displayKeys = buildDcmtDisplayName(metadataMap);
|
|
197
|
+
if (displayKeys.length === 0)
|
|
198
|
+
return null;
|
|
199
|
+
return displayKeys
|
|
200
|
+
.map(key => {
|
|
201
|
+
const entry = metadataMap[key];
|
|
202
|
+
return entry?.value ? formatMetadataValue(String(entry.value), entry.md) : null;
|
|
203
|
+
})
|
|
204
|
+
.filter(Boolean)
|
|
220
205
|
.join(separatorChar);
|
|
221
206
|
};
|
|
222
207
|
/** Genera il nome file di destinazione in base alle impostazioni di naming */
|
|
@@ -239,6 +224,7 @@ export const generateTargetFileName = async (file, dcmtInfo, options) => {
|
|
|
239
224
|
case 'onlyCustomMetadata': {
|
|
240
225
|
try {
|
|
241
226
|
const filteredMetadata = await getFilteredMetadata(dcmtInfo.TID, dcmtInfo.DID, separatorChar);
|
|
227
|
+
console.log("filteredMetadata for TID:", dcmtInfo.TID, "DID:", dcmtInfo.DID, "is", filteredMetadata);
|
|
242
228
|
if (filteredMetadata) {
|
|
243
229
|
if (fileNamingMode === 'documentTypeAndCustomMetadata') {
|
|
244
230
|
const typeName = await getTypeName(dcmtInfo.TID);
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { DcmtInfo } from '../../../ts';
|
|
2
|
+
import { IRelatedDcmt } from './TMMasterDetailDcmts';
|
|
3
|
+
/** Tipo per gli elementi con chiave e estensione */
|
|
4
|
+
export interface ISelectedItemInfo {
|
|
5
|
+
key: string;
|
|
6
|
+
ext: string | undefined;
|
|
7
|
+
}
|
|
8
|
+
/** Risultato delle statistiche di selezione per il merge PDF */
|
|
9
|
+
export interface IMergePdfSelectionStats {
|
|
10
|
+
/** Elementi con estensioni convertibili in PDF (non nativamente PDF) */
|
|
11
|
+
convertibleSelectedItems: Array<ISelectedItemInfo>;
|
|
12
|
+
/** True se ci sono elementi convertibili selezionati */
|
|
13
|
+
hasConvertibleSelected: boolean;
|
|
14
|
+
/** Elementi che NON sono PDF e NON sono convertibili */
|
|
15
|
+
nonPdfSelectedItems: Array<ISelectedItemInfo>;
|
|
16
|
+
/** True se ci sono elementi non-PDF selezionati */
|
|
17
|
+
hasNonPdfSelected: boolean;
|
|
18
|
+
/** Documenti di soli metadati (senza file allegato) */
|
|
19
|
+
metadataOnlySelectedItems: Array<ISelectedItemInfo>;
|
|
20
|
+
/** True se ci sono documenti di soli metadati selezionati */
|
|
21
|
+
hasMetadataOnlySelected: boolean;
|
|
22
|
+
/** Numero totale di file unibili (PDF nativi + convertibili) */
|
|
23
|
+
mergeableSelectedCount: number;
|
|
24
|
+
/** True se ci sono abbastanza file per il merge (>= MIN_PDF_FOR_MERGE) */
|
|
25
|
+
hasEnoughPdfForMerge: boolean;
|
|
26
|
+
}
|
|
27
|
+
/** Documento di soli metadati: FILEEXT null/undefined oppure FILECOUNT 0 (verrà convertito frontend) */
|
|
28
|
+
export declare const isMetadataOnlyDcmt: (fileExt: string | null | undefined, fileCount: string | number | null | undefined) => boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Calcola tutte le statistiche di selezione necessarie per il merge PDF.
|
|
31
|
+
* Restituisce info su file convertibili, non-PDF e conteggio file unibili.
|
|
32
|
+
*
|
|
33
|
+
* @param selectedDcmtInfos - Lista dei DcmtInfo selezionati (usata se showTMRelationViewer è false)
|
|
34
|
+
* @param selectedItemsFull - Lista completa con FILEEXT e FILECOUNT per check documenti di soli metadati
|
|
35
|
+
* @param selectedItemsRelationViewer - Lista degli IRelatedDcmt selezionati nel RelationViewer
|
|
36
|
+
* @param showTMRelationViewer - Se true, usa selectedItemsRelationViewer, altrimenti selectedDcmtInfos
|
|
37
|
+
*/
|
|
38
|
+
export declare const getMergePdfSelectionStats: (selectedDcmtInfos: Array<DcmtInfo>, selectedItemsFull: Array<any>, selectedItemsRelationViewer: Array<IRelatedDcmt>, showTMRelationViewer: boolean) => IMergePdfSelectionStats;
|
|
39
|
+
export interface IMetadataKeyValue {
|
|
40
|
+
label: string;
|
|
41
|
+
value: string;
|
|
42
|
+
}
|
|
43
|
+
export interface IMetadataPdfResult {
|
|
44
|
+
file: File;
|
|
45
|
+
blob: Blob;
|
|
46
|
+
bytes: Uint8Array;
|
|
47
|
+
}
|
|
48
|
+
/** Crea PDF con metadati documento (header + lista label=valore). Supporta wrapping e paginazione.
|
|
49
|
+
* @param dcmtInfo - Informazioni del documento
|
|
50
|
+
* @param showSystemMetadata - Se true, include i metadati di sistema (mid < 100). Default: false
|
|
51
|
+
*/
|
|
52
|
+
export declare const createMetadataPdfFromDocument: (dcmtInfo: DcmtInfo, showSystemMetadata?: boolean) => Promise<IMetadataPdfResult | null>;
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import { DcmtTypeListCacheService, LayoutModes, MetadataDataTypes, SDK_Globals } from '@topconsultnpm/sdk-ts';
|
|
2
|
+
import { Globalization, isConvertibleToPdfExt, searchResultToMetadataValues } from '../../../helper';
|
|
3
|
+
import { isPdfExt, MIN_PDF_FOR_MERGE } from './copyAndMergeDcmtsShared';
|
|
4
|
+
/** Documento di soli metadati: FILEEXT null/undefined oppure FILECOUNT 0 (verrà convertito frontend) */
|
|
5
|
+
export const isMetadataOnlyDcmt = (fileExt, fileCount) => {
|
|
6
|
+
if (!fileExt)
|
|
7
|
+
return true;
|
|
8
|
+
return Number(fileCount) === 0;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Calcola tutte le statistiche di selezione necessarie per il merge PDF.
|
|
12
|
+
* Restituisce info su file convertibili, non-PDF e conteggio file unibili.
|
|
13
|
+
*
|
|
14
|
+
* @param selectedDcmtInfos - Lista dei DcmtInfo selezionati (usata se showTMRelationViewer è false)
|
|
15
|
+
* @param selectedItemsFull - Lista completa con FILEEXT e FILECOUNT per check documenti di soli metadati
|
|
16
|
+
* @param selectedItemsRelationViewer - Lista degli IRelatedDcmt selezionati nel RelationViewer
|
|
17
|
+
* @param showTMRelationViewer - Se true, usa selectedItemsRelationViewer, altrimenti selectedDcmtInfos
|
|
18
|
+
*/
|
|
19
|
+
export const getMergePdfSelectionStats = (selectedDcmtInfos, selectedItemsFull, selectedItemsRelationViewer, showTMRelationViewer) => {
|
|
20
|
+
// Mappa per lookup veloce di FILECOUNT da selectedItemsFull (usato solo per isMetadataOnly)
|
|
21
|
+
const fileCountMap = new Map(selectedItemsFull.map(d => [`${d.TID}_${d.DID}`, d.FILECOUNT]));
|
|
22
|
+
// Pre-calcolo delle informazioni sui documenti selezionati
|
|
23
|
+
const docs = showTMRelationViewer
|
|
24
|
+
? selectedItemsRelationViewer
|
|
25
|
+
.filter(i => i.isDcmt)
|
|
26
|
+
.map(i => {
|
|
27
|
+
const ext = i.fileExt ?? undefined;
|
|
28
|
+
return {
|
|
29
|
+
key: `${i.tid}_${i.did}`,
|
|
30
|
+
ext,
|
|
31
|
+
isPdf: isPdfExt(ext),
|
|
32
|
+
isConvertible: isConvertibleToPdfExt(ext),
|
|
33
|
+
isMetadataOnly: isMetadataOnlyDcmt(ext, null)
|
|
34
|
+
};
|
|
35
|
+
})
|
|
36
|
+
: selectedDcmtInfos.map(d => {
|
|
37
|
+
const ext = d.FILEEXT ?? undefined;
|
|
38
|
+
const key = `${d.TID}_${d.DID}`;
|
|
39
|
+
const fileCount = fileCountMap.get(key);
|
|
40
|
+
return {
|
|
41
|
+
key,
|
|
42
|
+
ext,
|
|
43
|
+
isPdf: isPdfExt(ext),
|
|
44
|
+
isConvertible: isConvertibleToPdfExt(ext),
|
|
45
|
+
isMetadataOnly: isMetadataOnlyDcmt(ext, fileCount)
|
|
46
|
+
};
|
|
47
|
+
});
|
|
48
|
+
// Elementi convertibili: file con estensione convertibile (esclusi documenti di soli metadati)
|
|
49
|
+
const convertibleSelectedItems = docs
|
|
50
|
+
.filter(i => i.isConvertible && !i.isMetadataOnly)
|
|
51
|
+
.map(i => ({ key: i.key, ext: i.ext }));
|
|
52
|
+
// Elementi NON PDF e NON convertibili (esclusi documenti di soli metadati)
|
|
53
|
+
const nonPdfSelectedItems = docs
|
|
54
|
+
.filter(i => !i.isPdf && !i.isConvertible && !i.isMetadataOnly)
|
|
55
|
+
.map(i => ({ key: i.key, ext: i.ext }));
|
|
56
|
+
// Documenti di soli metadati (senza file allegato)
|
|
57
|
+
const metadataOnlySelectedItems = docs
|
|
58
|
+
.filter(i => i.isMetadataOnly)
|
|
59
|
+
.map(i => ({ key: i.key, ext: i.ext }));
|
|
60
|
+
// Conteggio file unibili: PDF nativi + convertibili + documenti di soli metadati
|
|
61
|
+
const mergeableSelectedCount = docs
|
|
62
|
+
.filter(i => i.isPdf || i.isConvertible || i.isMetadataOnly).length;
|
|
63
|
+
return {
|
|
64
|
+
convertibleSelectedItems,
|
|
65
|
+
hasConvertibleSelected: convertibleSelectedItems.length > 0,
|
|
66
|
+
nonPdfSelectedItems,
|
|
67
|
+
hasNonPdfSelected: nonPdfSelectedItems.length > 0,
|
|
68
|
+
metadataOnlySelectedItems,
|
|
69
|
+
hasMetadataOnlySelected: metadataOnlySelectedItems.length > 0,
|
|
70
|
+
mergeableSelectedCount,
|
|
71
|
+
hasEnoughPdfForMerge: mergeableSelectedCount >= MIN_PDF_FOR_MERGE,
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
// LAZY LOADING pdf-lib
|
|
75
|
+
let pdfLibModule = null;
|
|
76
|
+
const loadPdfLib = async () => {
|
|
77
|
+
if (!pdfLibModule) {
|
|
78
|
+
pdfLibModule = await import('pdf-lib');
|
|
79
|
+
}
|
|
80
|
+
return pdfLibModule;
|
|
81
|
+
};
|
|
82
|
+
// HELPER FUNCTIONS
|
|
83
|
+
/** Ottiene label localizzata del metadato (customName > nameLoc > name) */
|
|
84
|
+
const getMetadataLabel = (md, customName) => {
|
|
85
|
+
if (customName)
|
|
86
|
+
return customName;
|
|
87
|
+
if (!md)
|
|
88
|
+
return '';
|
|
89
|
+
return md.nameLoc || md.name || '';
|
|
90
|
+
};
|
|
91
|
+
/** Formatta valore metadato per PDF (null/undefined -> stringa vuota, datetime -> dd/MM/yyyy HH:mm) */
|
|
92
|
+
const formatMetadataValueForPdf = (value, md) => {
|
|
93
|
+
if (value === undefined || value === null)
|
|
94
|
+
return '';
|
|
95
|
+
// Se il metadato è di tipo DateTime, formatta in modo leggibile usando Globalization
|
|
96
|
+
if (md?.dataType === MetadataDataTypes.DateTime) {
|
|
97
|
+
return Globalization.getDateTimeDisplayValueCompact(value, undefined, md.format?.format);
|
|
98
|
+
}
|
|
99
|
+
return value.toString().trim();
|
|
100
|
+
};
|
|
101
|
+
// ============================================================================
|
|
102
|
+
// CREAZIONE PDF DA METADATI DOCUMENTO
|
|
103
|
+
// ============================================================================
|
|
104
|
+
/** Crea PDF con metadati documento (header + lista label=valore). Supporta wrapping e paginazione.
|
|
105
|
+
* @param dcmtInfo - Informazioni del documento
|
|
106
|
+
* @param showSystemMetadata - Se true, include i metadati di sistema (mid < 100). Default: false
|
|
107
|
+
*/
|
|
108
|
+
export const createMetadataPdfFromDocument = async (dcmtInfo, showSystemMetadata = false) => {
|
|
109
|
+
// Configurazione ottimale per PDF A4
|
|
110
|
+
const pageWidth = 595; // A4 width in points
|
|
111
|
+
const pageHeight = 842; // A4 height in points
|
|
112
|
+
const margin = 50; // Margine confortevole
|
|
113
|
+
const titleFontSize = 14; // Titolo leggibile ma non troppo grande
|
|
114
|
+
const contentFontSize = 10; // Font contenuto ottimale per leggibilità
|
|
115
|
+
try {
|
|
116
|
+
// Recupera i metadati del documento
|
|
117
|
+
const metadata = await SDK_Globals.tmSession?.NewSearchEngine().GetMetadataAsync(dcmtInfo.TID, dcmtInfo.DID, true);
|
|
118
|
+
if (!metadata) {
|
|
119
|
+
console.warn('createMetadataPdfFromDocument: impossibile recuperare i metadati');
|
|
120
|
+
return null;
|
|
121
|
+
}
|
|
122
|
+
const dtdResult = metadata.dtdResult;
|
|
123
|
+
const rows = dtdResult?.rows?.[0] ?? [];
|
|
124
|
+
const mids = metadata.selectMIDs;
|
|
125
|
+
// Recupera il tipo documento con metadati
|
|
126
|
+
const dtdWithMetadata = await DcmtTypeListCacheService.GetWithNotGrantedAsync(dcmtInfo.TID, dcmtInfo.DID, metadata);
|
|
127
|
+
if (!dtdWithMetadata) {
|
|
128
|
+
console.warn('createMetadataPdfFromDocument: impossibile recuperare il tipo documento');
|
|
129
|
+
return null;
|
|
130
|
+
}
|
|
131
|
+
const mdList = dtdWithMetadata.metadata ?? [];
|
|
132
|
+
// Converte i metadati in formato leggibile
|
|
133
|
+
const metadataList = searchResultToMetadataValues(dcmtInfo.TID, dtdResult, rows, mids, mdList, LayoutModes.Update);
|
|
134
|
+
// Ottiene il nome del tipo documento (localizzato se abilitato)
|
|
135
|
+
const dcmtTypeName = dtdWithMetadata.nameLoc || dtdWithMetadata.name || 'Documento';
|
|
136
|
+
// Prepara la lista di metadati chiave-valore
|
|
137
|
+
const metadataKeyValues = metadataList
|
|
138
|
+
.filter(mvd => mvd.md && mvd.mid && mvd.mid > 0) // Filtra solo metadati validi
|
|
139
|
+
.filter(mvd => showSystemMetadata || (mvd.mid && mvd.mid >= 100)) // Filtra metadati di sistema se showSystemMetadata è false
|
|
140
|
+
.map(mvd => ({
|
|
141
|
+
label: getMetadataLabel(mvd.md, mvd.customName),
|
|
142
|
+
value: formatMetadataValueForPdf(mvd.value, mvd.md)
|
|
143
|
+
}))
|
|
144
|
+
.filter(kv => kv.label.length > 0); // Rimuovi metadati senza label
|
|
145
|
+
// Carica pdf-lib on-demand
|
|
146
|
+
const { PDFDocument, StandardFonts, rgb } = await loadPdfLib();
|
|
147
|
+
// Crea il documento PDF
|
|
148
|
+
const pdfDoc = await PDFDocument.create();
|
|
149
|
+
const helveticaFont = await pdfDoc.embedFont(StandardFonts.Helvetica);
|
|
150
|
+
const helveticaBoldFont = await pdfDoc.embedFont(StandardFonts.HelveticaBold);
|
|
151
|
+
// Calcola dimensioni
|
|
152
|
+
const contentWidth = pageWidth - (margin * 2);
|
|
153
|
+
const lineHeight = contentFontSize + 5;
|
|
154
|
+
const titleLineHeight = titleFontSize + 6;
|
|
155
|
+
// Funzione per aggiungere una nuova pagina
|
|
156
|
+
const addPage = () => {
|
|
157
|
+
const page = pdfDoc.addPage([pageWidth, pageHeight]);
|
|
158
|
+
return { page, yPosition: pageHeight - margin };
|
|
159
|
+
};
|
|
160
|
+
// Funzione per calcolare la larghezza del testo
|
|
161
|
+
const getTextWidth = (text, font, size) => {
|
|
162
|
+
try {
|
|
163
|
+
return font.widthOfTextAtSize(text, size);
|
|
164
|
+
}
|
|
165
|
+
catch {
|
|
166
|
+
// Fallback per caratteri non supportati
|
|
167
|
+
return text.length * size * 0.5;
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
// Funzione per spezzare il testo in righe che entrano nella larghezza disponibile
|
|
171
|
+
const wrapText = (text, font, fontSize, maxWidth) => {
|
|
172
|
+
const lines = [];
|
|
173
|
+
const words = text.split(' ');
|
|
174
|
+
let currentLine = '';
|
|
175
|
+
for (const word of words) {
|
|
176
|
+
const testLine = currentLine ? `${currentLine} ${word}` : word;
|
|
177
|
+
const testWidth = getTextWidth(testLine, font, fontSize);
|
|
178
|
+
if (testWidth > maxWidth && currentLine) {
|
|
179
|
+
lines.push(currentLine);
|
|
180
|
+
currentLine = word;
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
currentLine = testLine;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
if (currentLine) {
|
|
187
|
+
lines.push(currentLine);
|
|
188
|
+
}
|
|
189
|
+
// Se una singola parola è troppo lunga, spezzala in più righe (carattere per carattere)
|
|
190
|
+
const result = [];
|
|
191
|
+
for (const line of lines) {
|
|
192
|
+
if (getTextWidth(line, font, fontSize) <= maxWidth) {
|
|
193
|
+
result.push(line);
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
// Spezza la parola/linea troppo lunga carattere per carattere
|
|
197
|
+
let chunk = '';
|
|
198
|
+
for (const char of line) {
|
|
199
|
+
const testChunk = chunk + char;
|
|
200
|
+
if (getTextWidth(testChunk, font, fontSize) > maxWidth && chunk) {
|
|
201
|
+
result.push(chunk);
|
|
202
|
+
chunk = char;
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
chunk = testChunk;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
if (chunk) {
|
|
209
|
+
result.push(chunk);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
return result;
|
|
214
|
+
};
|
|
215
|
+
// Sanitizza testo per Helvetica (solo ASCII)
|
|
216
|
+
const sanitize = (text) => text.replace(/[^\x20-\x7E]/g, '_');
|
|
217
|
+
let { page, yPosition } = addPage();
|
|
218
|
+
// Header (titolo centrato)
|
|
219
|
+
const titleText = sanitize(`${dcmtTypeName}`);
|
|
220
|
+
const titleWidth = getTextWidth(titleText, helveticaBoldFont, titleFontSize);
|
|
221
|
+
const titleX = Math.max(margin, margin + (contentWidth - titleWidth) / 2);
|
|
222
|
+
page.drawText(titleText, { x: titleX, y: yPosition, size: titleFontSize, font: helveticaBoldFont, color: rgb(0, 0, 0) });
|
|
223
|
+
yPosition -= titleLineHeight + 8;
|
|
224
|
+
// Metadati (label in grassetto, valore normale)
|
|
225
|
+
for (const kv of metadataKeyValues) {
|
|
226
|
+
const labelText = sanitize(kv.label) + ': ';
|
|
227
|
+
const labelWidth = getTextWidth(labelText, helveticaBoldFont, contentFontSize);
|
|
228
|
+
const valueMaxWidth = contentWidth - labelWidth;
|
|
229
|
+
const continuationIndent = labelWidth; // Indentazione per righe successive
|
|
230
|
+
// Wrappa il valore
|
|
231
|
+
const valueText = sanitize(kv.value);
|
|
232
|
+
const valueLines = wrapText(valueText, helveticaFont, contentFontSize, valueMaxWidth);
|
|
233
|
+
// Prima riga: label (bold) + primo pezzo di valore
|
|
234
|
+
if (yPosition < margin + lineHeight) {
|
|
235
|
+
({ page, yPosition } = addPage());
|
|
236
|
+
}
|
|
237
|
+
page.drawText(labelText, { x: margin, y: yPosition, size: contentFontSize, font: helveticaBoldFont, color: rgb(0, 0, 0) });
|
|
238
|
+
if (valueLines.length > 0) {
|
|
239
|
+
page.drawText(valueLines[0], { x: margin + labelWidth, y: yPosition, size: contentFontSize, font: helveticaFont, color: rgb(0, 0, 0) });
|
|
240
|
+
}
|
|
241
|
+
yPosition -= lineHeight;
|
|
242
|
+
// Righe successive del valore (indentate)
|
|
243
|
+
for (let i = 1; i < valueLines.length; i++) {
|
|
244
|
+
if (yPosition < margin + lineHeight) {
|
|
245
|
+
({ page, yPosition } = addPage());
|
|
246
|
+
}
|
|
247
|
+
page.drawText(valueLines[i], { x: margin + continuationIndent, y: yPosition, size: contentFontSize, font: helveticaFont, color: rgb(0, 0, 0) });
|
|
248
|
+
yPosition -= lineHeight;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
// Salva il PDF
|
|
252
|
+
const pdfBytes = await pdfDoc.save();
|
|
253
|
+
// Converte in Blob e File
|
|
254
|
+
const pdfBuffer = pdfBytes.buffer.slice(pdfBytes.byteOffset, pdfBytes.byteOffset + pdfBytes.byteLength);
|
|
255
|
+
const blob = new Blob([pdfBuffer], { type: 'application/pdf' });
|
|
256
|
+
const finalFileName = `${dcmtTypeName}_${dcmtInfo.DID}.pdf`;
|
|
257
|
+
const file = new File([blob], finalFileName, { type: 'application/pdf' });
|
|
258
|
+
return {
|
|
259
|
+
file,
|
|
260
|
+
blob,
|
|
261
|
+
bytes: pdfBytes
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
catch (error) {
|
|
265
|
+
console.error('createMetadataPdfFromDocument: errore durante la creazione del PDF', error);
|
|
266
|
+
return null;
|
|
267
|
+
}
|
|
268
|
+
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import { DcmtInfo } from "../../../ts";
|
|
2
3
|
interface TMDcmtCheckoutInfoFormProps {
|
|
3
4
|
dtdName: string;
|
|
4
5
|
selectedDcmtOrFocused: DcmtInfo;
|
|
5
6
|
onClose: () => void;
|
|
6
7
|
}
|
|
7
|
-
declare const TMDcmtCheckoutInfoForm: (props: TMDcmtCheckoutInfoFormProps) =>
|
|
8
|
+
declare const TMDcmtCheckoutInfoForm: (props: TMDcmtCheckoutInfoFormProps) => React.JSX.Element;
|
|
8
9
|
export default TMDcmtCheckoutInfoForm;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { MetadataDescriptor, QueryDescriptor, SelectItem } from "@topconsultnpm/sdk-ts";
|
|
3
|
+
interface TMMetadataOutputFormProps {
|
|
4
|
+
/** QueryDescriptor da cui estrarre i metadati disponibili */
|
|
5
|
+
qd?: QueryDescriptor;
|
|
6
|
+
/** Lista di SelectItem attualmente selezionati */
|
|
7
|
+
selectedSelectItems?: SelectItem[];
|
|
8
|
+
/** Consente di visualizzare i metadati di sistema (es. MID < 150) */
|
|
9
|
+
allowSysMetadata?: boolean;
|
|
10
|
+
/** Funzione predicato per filtrare i metadati (es. solo quelli con permesso canView) */
|
|
11
|
+
filterMetadata?: (value: MetadataDescriptor, index: number, array: MetadataDescriptor[]) => unknown;
|
|
12
|
+
/** Callback chiamata alla chiusura del form */
|
|
13
|
+
onClose: () => void;
|
|
14
|
+
/** Callback chiamata quando l'utente conferma la selezione dei SelectItem */
|
|
15
|
+
onChoose?: (selectItems: SelectItem[] | undefined) => void;
|
|
16
|
+
}
|
|
17
|
+
declare const TMMetadataOutputForm: (props: TMMetadataOutputFormProps) => React.JSX.Element;
|
|
18
|
+
export default TMMetadataOutputForm;
|