@topconsultnpm/sdkui-react 6.21.0-t3 → 6.21.0-t5
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 +23 -18
- package/lib/components/base/TMPopUp.js +3 -3
- package/lib/components/base/TMTreeView.d.ts +16 -13
- package/lib/components/base/TMTreeView.js +230 -64
- package/lib/components/choosers/TMDistinctValues.js +1 -1
- package/lib/components/editors/TMTextBox.d.ts +1 -0
- package/lib/components/editors/TMTextBox.js +2 -1
- package/lib/components/features/documents/TMDcmtForm.d.ts +2 -0
- package/lib/components/features/documents/TMDcmtForm.js +2 -1
- package/lib/components/features/documents/TMDcmtIcon.d.ts +3 -1
- package/lib/components/features/documents/TMDcmtIcon.js +5 -32
- 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 +169 -14
- package/lib/components/features/documents/TMMergeToPdfForm.d.ts +2 -1
- package/lib/components/features/documents/TMMergeToPdfForm.js +95 -49
- package/lib/components/features/documents/TMRelationViewer.d.ts +15 -10
- package/lib/components/features/documents/TMRelationViewer.js +533 -179
- package/lib/components/features/documents/copyAndMergeDcmtsShared.d.ts +4 -3
- package/lib/components/features/documents/copyAndMergeDcmtsShared.js +46 -23
- package/lib/components/features/documents/mergePdfUtils.d.ts +52 -0
- package/lib/components/features/documents/mergePdfUtils.js +278 -0
- package/lib/components/features/search/TMSearch.d.ts +2 -0
- package/lib/components/features/search/TMSearch.js +2 -2
- package/lib/components/features/search/TMSearchResult.d.ts +2 -0
- package/lib/components/features/search/TMSearchResult.js +58 -9
- package/lib/components/features/workflow/diagram/xmlParser.js +2 -1
- package/lib/components/viewers/TMTidViewer.js +14 -2
- package/lib/helper/Enum_Localizator.js +1 -0
- package/lib/helper/SDKUI_Globals.d.ts +1 -0
- package/lib/helper/SDKUI_Globals.js +1 -0
- package/lib/helper/SDKUI_Localizator.d.ts +34 -0
- package/lib/helper/SDKUI_Localizator.js +352 -12
- package/lib/helper/TMIcons.d.ts +1 -0
- package/lib/helper/TMIcons.js +3 -0
- package/lib/helper/TMUtils.d.ts +33 -1
- package/lib/helper/TMUtils.js +104 -1
- package/lib/helper/certificateImportHelper.d.ts +43 -0
- package/lib/helper/certificateImportHelper.js +403 -0
- package/lib/helper/helpers.d.ts +3 -0
- package/lib/helper/helpers.js +29 -1
- package/lib/helper/index.d.ts +1 -0
- package/lib/helper/index.js +1 -0
- package/lib/hooks/useDcmtOperations.d.ts +2 -1
- package/lib/hooks/useDcmtOperations.js +10 -2
- package/lib/hooks/useDocumentOperations.d.ts +2 -0
- package/lib/hooks/useDocumentOperations.js +28 -6
- package/lib/services/platform_services.d.ts +1 -1
- package/lib/ts/types.d.ts +2 -1
- package/lib/ts/types.js +1 -0
- package/package.json +3 -4
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useRef, useState } from 'react';
|
|
3
3
|
import { DownloadTypes } from '../../../ts';
|
|
4
|
-
import { calcResponsiveSizes, IconFolderOpen, IconPlay, IconUndo,
|
|
4
|
+
import { calcResponsiveSizes, getExceptionMessage, IconFolderOpen, IconPlay, IconUndo, SDKUI_Globals, SDKUI_Localizator, } from '../../../helper';
|
|
5
5
|
import { DcmtOpers, FileFormats, GeneralRetrieveFormats, ResultTypes, RetrieveFileOptions, ValidationItem, } from '@topconsultnpm/sdk-ts';
|
|
6
6
|
import TMModal from '../../base/TMModal';
|
|
7
7
|
import { useDeviceType } from '../../base/TMDeviceProvider';
|
|
@@ -12,16 +12,19 @@ import { TMLayoutWaitingContainer } from '../../base/TMWaitPanel';
|
|
|
12
12
|
import { TMSplitterLayout } from '../../base/TMLayout';
|
|
13
13
|
import { TMColors } from '../../../utils/theme';
|
|
14
14
|
import TMDownloadRelationViewerSection from './TMDownloadRelationViewerSection';
|
|
15
|
-
import { getDcmtInfosToDownload, getFloatingLabelStyle, isDirectoryPickerSupported,
|
|
15
|
+
import { getDcmtInfosToDownload, getFloatingLabelStyle, isDirectoryPickerSupported, MIN_PDF_FOR_MERGE, } from './copyAndMergeDcmtsShared';
|
|
16
|
+
import { createMetadataPdfFromDocument, getMergePdfSelectionStats, isMetadataOnlyDcmt } from './mergePdfUtils';
|
|
16
17
|
import ShowAlert from '../../base/TMAlert';
|
|
17
18
|
import TMTooltip from '../../base/TMTooltip';
|
|
18
19
|
import MergePdfManager from '../../../helper/MergePdfManager';
|
|
20
|
+
import { TMResultManager } from '../../forms/TMResultDialog';
|
|
19
21
|
/**
|
|
20
22
|
* Form per l'unione di più documenti PDF in un singolo file.
|
|
21
23
|
* Condivide TMDownloadRelationViewerSection e gli helper in copyAndMergeDcmtsShared
|
|
22
24
|
* con TMCopyToFolderForm.
|
|
23
25
|
*/
|
|
24
|
-
const TMMergeToPdfForm = (
|
|
26
|
+
const TMMergeToPdfForm = (props) => {
|
|
27
|
+
const { mode, selectedDcmtInfos, selectedItemsFull, onClose, showTMRelationViewer, allTasks, getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, handleNavigateToWGs, handleNavigateToDossiers } = props;
|
|
25
28
|
const { abortController, showWaitPanel, waitPanelTitle, showPrimary, waitPanelTextPrimary, waitPanelValuePrimary, waitPanelMaxValuePrimary, showSecondary, waitPanelTextSecondary, waitPanelValueSecondary, waitPanelMaxValueSecondary, downloadDcmtsAsync, } = useDcmtOperations();
|
|
26
29
|
const deviceType = useDeviceType();
|
|
27
30
|
const [pdfFileName, setPdfFileName] = useState(`${SDKUI_Localizator.Result.toLowerCase()}.pdf`);
|
|
@@ -79,36 +82,7 @@ const TMMergeToPdfForm = ({ mode, selectedDcmtInfos, onClose, showTMRelationView
|
|
|
79
82
|
pdfValidationItems.push(new ValidationItem(ResultTypes.ERROR, SDKUI_Localizator.PdfFileName, SDKUI_Localizator.RequiredField));
|
|
80
83
|
}
|
|
81
84
|
// ---- Statistiche selezione PDF / convertibili / non-PDF ----
|
|
82
|
-
const convertibleSelectedItems = (
|
|
83
|
-
if (showTMRelationViewer) {
|
|
84
|
-
return selectedItemsRelationViewer
|
|
85
|
-
.filter(i => i.isDcmt && isConvertibleToPdfExt(i.fileExt))
|
|
86
|
-
.map(i => ({ key: `${i.tid}_${i.did}`, ext: i.fileExt ?? undefined }));
|
|
87
|
-
}
|
|
88
|
-
return selectedDcmtInfos
|
|
89
|
-
.filter(d => isConvertibleToPdfExt(d.FILEEXT))
|
|
90
|
-
.map(d => ({ key: `${d.TID}_${d.DID}`, ext: d.FILEEXT }));
|
|
91
|
-
})();
|
|
92
|
-
const hasConvertibleSelected = convertibleSelectedItems.length > 0;
|
|
93
|
-
const nonPdfSelectedItems = (() => {
|
|
94
|
-
if (showTMRelationViewer) {
|
|
95
|
-
return selectedItemsRelationViewer
|
|
96
|
-
.filter(i => i.isDcmt && !isPdfExt(i.fileExt) && !isConvertibleToPdfExt(i.fileExt))
|
|
97
|
-
.map(i => ({ key: `${i.tid}_${i.did}`, ext: i.fileExt ?? undefined }));
|
|
98
|
-
}
|
|
99
|
-
return selectedDcmtInfos
|
|
100
|
-
.filter(d => !isPdfExt(d.FILEEXT) && !isConvertibleToPdfExt(d.FILEEXT))
|
|
101
|
-
.map(d => ({ key: `${d.TID}_${d.DID}`, ext: d.FILEEXT }));
|
|
102
|
-
})();
|
|
103
|
-
const hasNonPdfSelected = nonPdfSelectedItems.length > 0;
|
|
104
|
-
// Conteggio file unibili: PDF nativi + file convertibili
|
|
105
|
-
const mergeableSelectedCount = (() => {
|
|
106
|
-
if (showTMRelationViewer) {
|
|
107
|
-
return selectedItemsRelationViewer.filter(i => i.isDcmt && (isPdfExt(i.fileExt) || isConvertibleToPdfExt(i.fileExt))).length;
|
|
108
|
-
}
|
|
109
|
-
return selectedDcmtInfos.filter(d => isPdfExt(d.FILEEXT) || isConvertibleToPdfExt(d.FILEEXT)).length;
|
|
110
|
-
})();
|
|
111
|
-
const hasEnoughPdfForMerge = mergeableSelectedCount >= MIN_PDF_FOR_MERGE;
|
|
85
|
+
const { convertibleSelectedItems, hasConvertibleSelected, nonPdfSelectedItems, hasNonPdfSelected, metadataOnlySelectedItems, hasMetadataOnlySelected, mergeableSelectedCount, hasEnoughPdfForMerge, } = getMergePdfSelectionStats(selectedDcmtInfos, selectedItemsFull, selectedItemsRelationViewer, showTMRelationViewer);
|
|
112
86
|
const isFormValid = () => pdfValidationItems.length === 0;
|
|
113
87
|
// ---- Recupero dei file PDF da unire (condiviso tra Esegui e Anteprima) ----
|
|
114
88
|
const collectPdfFilesToMerge = async () => {
|
|
@@ -126,24 +100,91 @@ const TMMergeToPdfForm = ({ mode, selectedDcmtInfos, onClose, showTMRelationView
|
|
|
126
100
|
});
|
|
127
101
|
return null;
|
|
128
102
|
}
|
|
129
|
-
|
|
103
|
+
// Permetti merge anche con 1 solo file se convertibile o metadata-only
|
|
104
|
+
if (!hasEnoughPdfForMerge) {
|
|
130
105
|
TMMessageBoxManager.show({
|
|
131
106
|
message: SDKUI_Localizator.OnlyOnePdfOrConvertibleFileMergeBlocked.replaceParams(MIN_PDF_FOR_MERGE.toString()),
|
|
132
107
|
buttons: [ButtonNames.OK]
|
|
133
108
|
});
|
|
134
109
|
return null;
|
|
135
110
|
}
|
|
111
|
+
// Mappa per lookup veloce di FILECOUNT e FILEEXT
|
|
112
|
+
const fileInfoMap = new Map(showTMRelationViewer
|
|
113
|
+
? selectedItemsRelationViewer.map(d => [`${d.tid}_${d.did}`, { fileExt: d.fileExt ?? null, fileCount: d.fileCount ?? null }])
|
|
114
|
+
: selectedItemsFull.map(d => [`${d.TID}_${d.DID}`, { fileExt: d.FILEEXT, fileCount: d.FILECOUNT }]));
|
|
115
|
+
// Mappa per i risultati: mantiene l'ordine originale
|
|
116
|
+
const pdfFilesMap = new Map();
|
|
117
|
+
// Identifica documenti di soli metadati e documenti con file
|
|
118
|
+
const metadataOnlyDcmts = [];
|
|
119
|
+
const dcmtsWithFile = [];
|
|
120
|
+
for (const dcmt of pdfDcmtInfosToDownload) {
|
|
121
|
+
const key = `${dcmt.TID}_${dcmt.DID}`;
|
|
122
|
+
const info = fileInfoMap.get(key);
|
|
123
|
+
if (isMetadataOnlyDcmt(info?.fileExt, info?.fileCount)) {
|
|
124
|
+
metadataOnlyDcmts.push(dcmt);
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
dcmtsWithFile.push(dcmt);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
// Per i documenti di soli metadati, genera PDF con createMetadataPdfFromDocument
|
|
131
|
+
// Raccoglie gli errori come downloadDcmtsAsync
|
|
132
|
+
const metadataConversionResults = [];
|
|
133
|
+
if (metadataOnlyDcmts.length > 0) {
|
|
134
|
+
setIsMergingPdf(true);
|
|
135
|
+
setMergeProgressMax(metadataOnlyDcmts.length);
|
|
136
|
+
setMergeProgressValue(0);
|
|
137
|
+
setMergeProgressText('Creazione PDF metadati...');
|
|
138
|
+
for (let i = 0; i < metadataOnlyDcmts.length; i++) {
|
|
139
|
+
const dcmt = metadataOnlyDcmts[i];
|
|
140
|
+
try {
|
|
141
|
+
setMergeProgressValue(i);
|
|
142
|
+
setMergeProgressText(`Creazione PDF metadati... (${i + 1}/${metadataOnlyDcmts.length})`);
|
|
143
|
+
const conversionResult = await createMetadataPdfFromDocument(dcmt);
|
|
144
|
+
if (conversionResult) {
|
|
145
|
+
pdfFilesMap.set(`${dcmt.TID}_${dcmt.DID}`, conversionResult.file);
|
|
146
|
+
metadataConversionResults.push({ rowIndex: i, id1: dcmt.TID, id2: dcmt.DID, resultType: ResultTypes.SUCCESS });
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
// createMetadataPdfFromDocument ha restituito null (errore interno loggato)
|
|
150
|
+
metadataConversionResults.push({ rowIndex: i, id1: dcmt.TID, id2: dcmt.DID, resultType: ResultTypes.ERROR, description: 'Creazione PDF metadati fallita' });
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
catch (error) {
|
|
154
|
+
console.error(`Errore creazione PDF metadati per TID=${dcmt.TID}, DID=${dcmt.DID}`, error);
|
|
155
|
+
metadataConversionResults.push({ rowIndex: i, id1: dcmt.TID, id2: dcmt.DID, resultType: ResultTypes.ERROR, description: getExceptionMessage(error) });
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
setMergeProgressValue(metadataOnlyDcmts.length);
|
|
159
|
+
setIsMergingPdf(false);
|
|
160
|
+
// Mostra riepilogo errori se presenti (come downloadDcmtsAsync)
|
|
161
|
+
const hasErrors = metadataConversionResults.some(r => r.resultType === ResultTypes.ERROR);
|
|
162
|
+
if (hasErrors) {
|
|
163
|
+
TMResultManager.show(metadataConversionResults, 'Conversione PDF metadati', 'TID', 'DID', undefined, undefined, false);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
// Per i documenti con file, usa il download normale
|
|
167
|
+
if (dcmtsWithFile.length > 0) {
|
|
168
|
+
const rfo = new RetrieveFileOptions();
|
|
169
|
+
rfo.retrieveReason = DcmtOpers.None;
|
|
170
|
+
rfo.generalRetrieveFormat = GeneralRetrieveFormats.OriginalUnsigned;
|
|
171
|
+
rfo.cvtFormat = FileFormats.PDF;
|
|
172
|
+
rfo.invoiceRetrieveFormat = SDKUI_Globals.userSettings?.searchSettings.invoiceRetrieveFormat;
|
|
173
|
+
rfo.orderRetrieveFormat = SDKUI_Globals.userSettings?.searchSettings.orderRetrieveFormat;
|
|
174
|
+
const collectFileForMerge = async (file, dcmtInfo) => {
|
|
175
|
+
pdfFilesMap.set(`${dcmtInfo.TID}_${dcmtInfo.DID}`, file);
|
|
176
|
+
};
|
|
177
|
+
await downloadDcmtsAsync({ inputDcmts: dcmtsWithFile, downloadType: DownloadTypes.Dcmt, downloadMode: 'download', onFileDownloaded: collectFileForMerge, skipConfirmation: true, retrieveOptions: rfo, useCache: false });
|
|
178
|
+
}
|
|
179
|
+
// Ricostruisci l'array pdfFiles nell'ordine originale di selezione
|
|
136
180
|
const pdfFiles = [];
|
|
137
|
-
const
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
pdfFiles.push(file);
|
|
145
|
-
};
|
|
146
|
-
await downloadDcmtsAsync({ inputDcmts: pdfDcmtInfosToDownload, downloadType: DownloadTypes.Dcmt, downloadMode: 'download', onFileDownloaded: collectFileForMerge, skipConfirmation: true, retrieveOptions: rfo, useCache: false });
|
|
181
|
+
for (const dcmt of pdfDcmtInfosToDownload) {
|
|
182
|
+
const key = `${dcmt.TID}_${dcmt.DID}`;
|
|
183
|
+
const file = pdfFilesMap.get(key);
|
|
184
|
+
if (file) {
|
|
185
|
+
pdfFiles.push(file);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
147
188
|
if (pdfFiles.length === 0) {
|
|
148
189
|
TMMessageBoxManager.show({ message: SDKUI_Localizator.NoFilesAvailableForMerge, buttons: [ButtonNames.OK] });
|
|
149
190
|
return null;
|
|
@@ -244,7 +285,7 @@ const TMMergeToPdfForm = ({ mode, selectedDcmtInfos, onClose, showTMRelationView
|
|
|
244
285
|
width: 'max-content',
|
|
245
286
|
backgroundColor: TMColors.default_background,
|
|
246
287
|
zIndex: 1,
|
|
247
|
-
}, 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 || !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) && (_jsxs("div", { style: {
|
|
248
289
|
display: 'flex',
|
|
249
290
|
flexDirection: 'column',
|
|
250
291
|
gap: '6px',
|
|
@@ -264,14 +305,19 @@ const TMMergeToPdfForm = ({ mode, selectedDcmtInfos, onClose, showTMRelationView
|
|
|
264
305
|
borderBottom: '1px solid #e0e0e0',
|
|
265
306
|
paddingBottom: '6px',
|
|
266
307
|
marginBottom: '2px'
|
|
267
|
-
}, children: SDKUI_Localizator.NotesAndWarnings }), _jsxs("ul", { style: { margin: 0, paddingLeft: '18px', display: 'flex', flexDirection: 'column', gap: '4px' }, children: [hasConvertibleSelected && (_jsx("li", { style: { color: '#00527a' }, children: (() => {
|
|
268
|
-
|
|
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
|
+
// Combina convertibili + metadataOnly
|
|
310
|
+
const allConvertible = [...convertibleSelectedItems, ...metadataOnlySelectedItems];
|
|
311
|
+
const extSet = Array.from(new Set([
|
|
312
|
+
...convertibleSelectedItems.map(i => (i.ext ?? '').toString().trim().toLowerCase().replace(/^\./, '')).filter(e => e.length > 0),
|
|
313
|
+
...(hasMetadataOnlySelected ? ['metadati'] : [])
|
|
314
|
+
]));
|
|
269
315
|
const extLabel = extSet.length > 0
|
|
270
316
|
? ` (${extSet.map(e => '.' + e).join(', ')})`
|
|
271
317
|
: '';
|
|
272
|
-
return
|
|
318
|
+
return allConvertible.length === 1
|
|
273
319
|
? SDKUI_Localizator.DocumentWillBeConvertedDuringMerge.replaceParams(extLabel)
|
|
274
|
-
: SDKUI_Localizator.DocumentsWillBeConvertedDuringMerge.replaceParams(
|
|
320
|
+
: SDKUI_Localizator.DocumentsWillBeConvertedDuringMerge.replaceParams(allConvertible.length.toString(), extLabel);
|
|
275
321
|
})() })), !hasEnoughPdfForMerge && (_jsx("li", { style: { color: '#7a5d00' }, children: mergeableSelectedCount === 0
|
|
276
322
|
? SDKUI_Localizator.NoPdfOrConvertibleFilesSelected_Param.replaceParams(MIN_PDF_FOR_MERGE.toString())
|
|
277
323
|
: SDKUI_Localizator.OnlyOnePdfOrConvertibleFileSelected.replaceParams(MIN_PDF_FOR_MERGE.toString()) })), hasNonPdfSelected && (_jsx("li", { style: { color: '#7a5d00' }, children: (() => {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { DcmtTypeDescriptor, SearchResultDescriptor, DataColumnDescriptor } from "@topconsultnpm/sdk-ts";
|
|
3
|
+
import { DcmtMetadataMap } from '../../../helper';
|
|
3
4
|
import { DcmtInfo, MetadataValueDescriptorEx } from '../../../ts';
|
|
4
5
|
import { ITMTreeItem } from '../../base/TMTreeView';
|
|
5
6
|
/**
|
|
@@ -19,10 +20,11 @@ export interface RelationTreeItem extends ITMTreeItem {
|
|
|
19
20
|
isSeparator?: boolean;
|
|
20
21
|
isInfoMessage?: boolean;
|
|
21
22
|
isLogDel?: number;
|
|
22
|
-
values?:
|
|
23
|
+
values?: DcmtMetadataMap;
|
|
23
24
|
searchResult?: SearchResultDescriptor[];
|
|
24
25
|
itemsCount?: number;
|
|
25
26
|
fileExt?: string;
|
|
27
|
+
fileCount?: number;
|
|
26
28
|
}
|
|
27
29
|
/**
|
|
28
30
|
* Props for TMRelationViewer component
|
|
@@ -72,7 +74,10 @@ export interface TMRelationViewerProps {
|
|
|
72
74
|
* Value rendering respects DataDomain (uses TMDataListItemViewer for lists, TMDataUserIdItemViewer for users, etc.)
|
|
73
75
|
*/
|
|
74
76
|
showMetadataNames?: boolean;
|
|
75
|
-
/**
|
|
77
|
+
/**
|
|
78
|
+
* Maximum depth level for recursive loading (default: 2).
|
|
79
|
+
* Use 0 for unlimited depth (expand as much as possible).
|
|
80
|
+
*/
|
|
76
81
|
maxDepthLevel?: number;
|
|
77
82
|
/**
|
|
78
83
|
* If true (default), when isForMaster=true shows: detail doc → master docs as children (inverted navigation)
|
|
@@ -122,6 +127,11 @@ export interface TMRelationViewerProps {
|
|
|
122
127
|
* (root container + first document + first correlation folder).
|
|
123
128
|
*/
|
|
124
129
|
defaultExpandAll?: boolean;
|
|
130
|
+
/**
|
|
131
|
+
* Callback invoked when loading state changes.
|
|
132
|
+
* Useful to disable interactions (like context menu) during loading.
|
|
133
|
+
*/
|
|
134
|
+
onLoadingStateChanged?: (isLoading: boolean) => void;
|
|
125
135
|
}
|
|
126
136
|
/**
|
|
127
137
|
* Check if document type has detail relations
|
|
@@ -131,21 +141,16 @@ export declare const hasDetailRelations: (mTID: number | undefined) => Promise<b
|
|
|
131
141
|
* Check if document type has master relations
|
|
132
142
|
*/
|
|
133
143
|
export declare const hasMasterRelations: (dTID: number | undefined) => Promise<boolean>;
|
|
134
|
-
/**
|
|
135
|
-
* Get metadata keys excluding system metadata
|
|
136
|
-
*/
|
|
137
|
-
export declare const getMetadataKeys: (obj: any) => string[];
|
|
138
|
-
/**
|
|
139
|
-
* Get display value keys for a document (max 5, prioritize SYS_Abstract)
|
|
140
|
-
*/
|
|
141
|
-
export declare const getDcmtDisplayValue: (obj: any) => string[];
|
|
142
144
|
/**
|
|
143
145
|
* Get display value formatted by column type
|
|
144
146
|
*/
|
|
145
147
|
export declare const getDisplayValueByColumn: (col: DataColumnDescriptor | undefined, value: any) => any;
|
|
146
148
|
/**
|
|
147
149
|
* Convert SearchResultDescriptor to structured data source with metadata
|
|
150
|
+
* For each document, fetches complete metadata using GetMetadataAsync to ensure
|
|
151
|
+
* all metadata properties (isSpecialSearchOutput, permissions, etc.) are available
|
|
148
152
|
*/
|
|
149
153
|
export declare const searchResultToDataSource: (searchResult: SearchResultDescriptor | undefined, hideSysMetadata?: boolean) => Promise<any[]>;
|
|
154
|
+
export declare const DEFAULT_RELATION_EXPAND_LEVEL = 4;
|
|
150
155
|
declare const TMRelationViewer: React.FC<TMRelationViewerProps>;
|
|
151
156
|
export default TMRelationViewer;
|