@topconsultnpm/sdkui-react 6.21.0-dev2.8 → 6.21.0-dev3.10

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.
Files changed (103) hide show
  1. package/lib/components/NewComponents/ContextMenu/styles.d.ts +4 -4
  2. package/lib/components/NewComponents/FloatingMenuBar/styles.d.ts +2 -2
  3. package/lib/components/base/TMAccordionNew.js +1 -0
  4. package/lib/components/base/TMAreaManager.js +19 -3
  5. package/lib/components/base/TMDataGrid.js +2 -2
  6. package/lib/components/base/TMFileManagerDataGridView.js +4 -4
  7. package/lib/components/base/TMFileManagerThumbnailItems.js +3 -3
  8. package/lib/components/base/TMFileManagerUtils.d.ts +7 -0
  9. package/lib/components/base/TMFileManagerUtils.js +14 -1
  10. package/lib/components/base/TMModal.d.ts +1 -0
  11. package/lib/components/base/TMModal.js +2 -2
  12. package/lib/components/base/TMPanel.d.ts +7 -4
  13. package/lib/components/base/TMPanel.js +58 -26
  14. package/lib/components/base/TMTreeView.js +24 -17
  15. package/lib/components/base/TMWaitPanel.d.ts +3 -1
  16. package/lib/components/base/TMWaitPanel.js +14 -9
  17. package/lib/components/choosers/TMDistinctValues.js +35 -21
  18. package/lib/components/choosers/TMDynDataListItemChooser.js +6 -1
  19. package/lib/components/choosers/TMUserChooser.d.ts +4 -0
  20. package/lib/components/choosers/TMUserChooser.js +7 -5
  21. package/lib/components/editors/TMEditorStyled.d.ts +6 -6
  22. package/lib/components/editors/TMFormulaEditor.d.ts +2 -0
  23. package/lib/components/editors/TMFormulaEditor.js +75 -21
  24. package/lib/components/editors/TMMetadataEditor.js +6 -2
  25. package/lib/components/editors/TMMetadataValues.js +2 -1
  26. package/lib/components/editors/TMRadioButton.js +7 -5
  27. package/lib/components/editors/TMTextBox.d.ts +2 -0
  28. package/lib/components/editors/TMTextBox.js +3 -3
  29. package/lib/components/features/archive/TMArchive.js +1 -1
  30. package/lib/components/features/blog/TMBlogCommentForm.js +5 -2
  31. package/lib/components/features/documents/TMCopyToFolderForm.d.ts +24 -0
  32. package/lib/components/features/documents/TMCopyToFolderForm.js +401 -0
  33. package/lib/components/features/documents/TMDcmtForm.d.ts +1 -0
  34. package/lib/components/features/documents/TMDcmtForm.js +126 -38
  35. package/lib/components/features/documents/TMDcmtFormActionButtons.js +17 -2
  36. package/lib/components/features/documents/TMDcmtIcon.js +1 -1
  37. package/lib/components/features/documents/TMDcmtPreview.d.ts +1 -0
  38. package/lib/components/features/documents/TMDcmtPreview.js +2 -2
  39. package/lib/components/features/documents/TMDcmtTasks.d.ts +1 -0
  40. package/lib/components/features/documents/TMDcmtTasks.js +2 -2
  41. package/lib/components/features/documents/TMDownloadRelationViewerSection.d.ts +23 -0
  42. package/lib/components/features/documents/TMDownloadRelationViewerSection.js +173 -0
  43. package/lib/components/features/documents/TMFileUploader.js +1 -1
  44. package/lib/components/features/documents/TMMasterDetailDcmts.d.ts +2 -0
  45. package/lib/components/features/documents/TMMasterDetailDcmts.js +28 -9
  46. package/lib/components/features/documents/TMMergeToPdfForm.d.ts +24 -0
  47. package/lib/components/features/documents/TMMergeToPdfForm.js +309 -0
  48. package/lib/components/features/documents/TMRelationViewer.d.ts +13 -0
  49. package/lib/components/features/documents/TMRelationViewer.js +80 -6
  50. package/lib/components/features/documents/copyAndMergeDcmtsShared.d.ts +58 -0
  51. package/lib/components/features/documents/copyAndMergeDcmtsShared.js +266 -0
  52. package/lib/components/features/search/SignatureParamsManager.d.ts +70 -0
  53. package/lib/components/features/search/SignatureParamsManager.js +145 -0
  54. package/lib/components/features/search/TMSavedQuerySelector.d.ts +2 -2
  55. package/lib/components/features/search/TMSavedQuerySelector.js +3 -2
  56. package/lib/components/features/search/TMSearch.d.ts +4 -1
  57. package/lib/components/features/search/TMSearch.js +16 -10
  58. package/lib/components/features/search/TMSearchQueryEditor.js +14 -8
  59. package/lib/components/features/search/TMSearchQueryPanel.js +1 -1
  60. package/lib/components/features/search/TMSearchResult.d.ts +2 -0
  61. package/lib/components/features/search/TMSearchResult.js +118 -23
  62. package/lib/components/features/search/TMViewHistoryDcmt.js +1 -1
  63. package/lib/components/features/workflow/diagram/queryDescriptorParser.js +3 -6
  64. package/lib/components/forms/Login/TMLoginForm.d.ts +9 -0
  65. package/lib/components/forms/Login/TMLoginForm.js +61 -0
  66. package/lib/components/forms/TMResultDialog.d.ts +1 -1
  67. package/lib/components/forms/TMResultDialog.js +4 -2
  68. package/lib/components/grids/TMBlogAttachments.js +2 -2
  69. package/lib/components/grids/TMBlogsPost.js +5 -3
  70. package/lib/components/grids/TMBlogsPostUtils.d.ts +1 -0
  71. package/lib/components/grids/TMBlogsPostUtils.js +3 -1
  72. package/lib/components/index.d.ts +1 -0
  73. package/lib/components/index.js +1 -0
  74. package/lib/components/pages/TMPage.js +3 -1
  75. package/lib/components/query/TMQueryEditor.js +1 -1
  76. package/lib/components/viewers/TMTidViewer.js +1 -1
  77. package/lib/helper/MergePdfManager.d.ts +45 -0
  78. package/lib/helper/MergePdfManager.js +148 -0
  79. package/lib/helper/SDKUI_Globals.d.ts +15 -0
  80. package/lib/helper/SDKUI_Globals.js +16 -1
  81. package/lib/helper/SDKUI_Localizator.d.ts +108 -2
  82. package/lib/helper/SDKUI_Localizator.js +1080 -12
  83. package/lib/helper/TMPdfViewer.js +25 -24
  84. package/lib/helper/TMUtils.d.ts +24 -0
  85. package/lib/helper/TMUtils.js +72 -0
  86. package/lib/helper/ZipManager.d.ts +56 -0
  87. package/lib/helper/ZipManager.js +127 -0
  88. package/lib/helper/checkinCheckoutManager.d.ts +4 -3
  89. package/lib/helper/checkinCheckoutManager.js +29 -11
  90. package/lib/helper/index.d.ts +1 -0
  91. package/lib/helper/index.js +1 -0
  92. package/lib/hooks/useCheckInOutOperations.d.ts +4 -3
  93. package/lib/hooks/useDataUserIdItem.js +6 -4
  94. package/lib/hooks/useDcmtOperations.d.ts +26 -2
  95. package/lib/hooks/useDcmtOperations.js +123 -34
  96. package/lib/hooks/useDocumentOperations.d.ts +3 -0
  97. package/lib/hooks/useDocumentOperations.js +235 -26
  98. package/lib/hooks/useForm.js +5 -2
  99. package/lib/hooks/useRelatedDocuments.js +4 -4
  100. package/lib/hooks/useResizeObserver.d.ts +1 -1
  101. package/lib/hooks/useResizeObserver.js +16 -15
  102. package/lib/services/platform_services.d.ts +4 -4
  103. package/package.json +4 -2
@@ -0,0 +1,173 @@
1
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
+ import { useCallback, useRef, useState } from 'react';
3
+ import TreeView from 'devextreme-react/tree-view';
4
+ import { LayoutModes } from '@topconsultnpm/sdk-ts';
5
+ import { SDKUI_Localizator } from '../../../helper';
6
+ import { TMColors } from '../../../utils/theme';
7
+ import { TMSplitterLayout } from '../../base/TMLayout';
8
+ import TMRelationViewer from './TMRelationViewer';
9
+ import TMDcmtForm from './TMDcmtForm';
10
+ import { dedupeByTidDid, getDcmtKey, getFloatingLabelStyle, } from './copyAndMergeDcmtsShared';
11
+ /**
12
+ * Sezione condivisa tra TMCopyToFolderForm e TMMergeToPdfForm
13
+ * che mostra l'elenco dei documenti correlati e il tree di selezione
14
+ * per tipo documento / "solo metadati".
15
+ */
16
+ const TMDownloadRelationViewerSection = ({ selectedDcmtInfos, onSelectionChanged, allTasks, getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, handleNavigateToWGs, handleNavigateToDossiers }) => {
17
+ const [focusedItem, setFocusedItem] = useState(null);
18
+ const [selectedItems, setSelectedItems] = useState([]);
19
+ const [allItems, setAllItems] = useState([]);
20
+ const didInitSelectionRef = useRef(false);
21
+ // State for TMDcmtForm modal
22
+ const [isOpenDcmtForm, setIsOpenDcmtForm] = useState(false);
23
+ const [dcmtFormTID, setDcmtFormTID] = useState(undefined);
24
+ const [dcmtFormDID, setDcmtFormDID] = useState(undefined);
25
+ const [dcmtFormTitle, setDcmtFormTitle] = useState('');
26
+ const updateSelection = useCallback((items) => {
27
+ const deduped = dedupeByTidDid(items);
28
+ setSelectedItems(deduped);
29
+ onSelectionChanged(deduped);
30
+ }, [onSelectionChanged]);
31
+ const handleFocusedItemChanged = useCallback((item) => {
32
+ setFocusedItem(item);
33
+ }, []);
34
+ const handleSelectedItemsChanged = useCallback((items) => {
35
+ updateSelection(items);
36
+ }, [updateSelection]);
37
+ const handleAllItemsChanged = useCallback((items) => {
38
+ setAllItems(items);
39
+ if (!didInitSelectionRef.current && items.some(i => i.isDcmt)) {
40
+ didInitSelectionRef.current = true;
41
+ updateSelection(items.filter(i => i.isDcmt));
42
+ }
43
+ }, [updateSelection]);
44
+ const handleDocumentDoubleClick = useCallback((tid, did, name) => {
45
+ setDcmtFormTID(tid);
46
+ setDcmtFormDID(did);
47
+ setDcmtFormTitle(name ?? '');
48
+ setIsOpenDcmtForm(true);
49
+ }, []);
50
+ return (_jsxs("div", { style: {
51
+ position: 'relative',
52
+ height: '100%',
53
+ minHeight: 0,
54
+ display: 'flex',
55
+ flexDirection: 'column',
56
+ boxSizing: 'border-box'
57
+ }, children: [_jsx("div", { style: { flex: 1, minHeight: 0, overflow: 'visible', paddingTop: '10px' }, children: _jsxs(TMSplitterLayout, { direction: 'horizontal', showSeparator: true, separatorSize: 8, separatorColor: 'transparent', separatorActiveColor: 'transparent', overflow: 'visible', min: ["50", "50"], start: ["75%", "25%"], children: [_jsxs("div", { style: {
58
+ position: 'relative',
59
+ height: '100%',
60
+ minHeight: 0,
61
+ overflow: 'visible',
62
+ border: `1px solid ${TMColors.border_normal}`,
63
+ borderRadius: '8px',
64
+ padding: '4px 2px 2px 2px',
65
+ backgroundColor: '#fff',
66
+ boxSizing: 'border-box',
67
+ display: 'flex',
68
+ flexDirection: 'column'
69
+ }, children: [_jsxs("span", { style: getFloatingLabelStyle(), title: `Documenti correlati (${SDKUI_Localizator.Selected}: ${selectedItems.filter(item => item.isDcmt).length})`, children: ["Documenti correlati (", SDKUI_Localizator.Selected, ": ", selectedItems.filter(item => item.isDcmt).length, ")"] }), _jsx("div", { style: { flex: 1, minHeight: 0, overflowX: 'auto', overflowY: 'auto' }, children: _jsx("div", { style: { minWidth: 'max-content', height: '100%' }, children: _jsx(TMRelationViewer, { inputDcmts: selectedDcmtInfos, isForMaster: false, defaultExpandAll: true, showMetadataNames: true, allowMultipleSelection: true, showExpandAllButton: true, focusedItem: focusedItem, selectedItems: selectedItems, onFocusedItemChanged: handleFocusedItemChanged, onSelectedItemsChanged: handleSelectedItemsChanged, onAllItemsChanged: handleAllItemsChanged, onDocumentDoubleClick: handleDocumentDoubleClick }) }) })] }), _jsxs("div", { style: {
70
+ position: 'relative',
71
+ height: '100%',
72
+ minHeight: 0,
73
+ overflow: 'visible',
74
+ border: `1px solid ${TMColors.border_normal}`,
75
+ borderRadius: '8px',
76
+ padding: '4px 2px 2px 2px',
77
+ backgroundColor: '#fff',
78
+ boxSizing: 'border-box',
79
+ display: 'flex',
80
+ flexDirection: 'column'
81
+ }, children: [_jsx("span", { style: getFloatingLabelStyle(), title: "Tipo documento o vista", children: "Tipo documento o vista" }), _jsx("div", { style: { flex: 1, minHeight: 0, overflow: 'auto', padding: '8px', display: 'flex', flexDirection: 'column', gap: '6px' }, children: (() => {
82
+ const dcmtItems = dedupeByTidDid(allItems.filter(item => item.isDcmt));
83
+ const metadataOnlyItems = dcmtItems.filter(item => item.fileExt === null || item.fileExt === undefined);
84
+ const totalDcmts = dcmtItems.length;
85
+ const totalMetadataOnly = metadataOnlyItems.length;
86
+ const selectedDcmtsList = selectedItems.filter(item => item.isDcmt);
87
+ const selectedDcmts = selectedDcmtsList.length;
88
+ const allSelected = totalDcmts > 0 && selectedDcmts === totalDcmts;
89
+ const selectedMetadataOnlyCount = selectedDcmtsList.filter(item => item.fileExt === null || item.fileExt === undefined).length;
90
+ const allMetadataOnlySelected = totalMetadataOnly > 0 && selectedMetadataOnlyCount === totalMetadataOnly;
91
+ // Raggruppa per nome del DcmtTypeDescriptor (campo dtd.name)
92
+ const getDtdName = (item) => item.dtd?.name ?? undefined;
93
+ const dtdGroups = new Map();
94
+ for (const item of dcmtItems) {
95
+ const name = getDtdName(item);
96
+ if (!name)
97
+ continue;
98
+ const arr = dtdGroups.get(name);
99
+ if (arr)
100
+ arr.push(item);
101
+ else
102
+ dtdGroups.set(name, [item]);
103
+ }
104
+ const sortedDtdNames = Array.from(dtdGroups.keys()).sort((a, b) => a.localeCompare(b));
105
+ const selectedKeysSet = new Set(selectedDcmtsList.map(getDcmtKey));
106
+ const dtdGroupInfos = sortedDtdNames.map((name) => {
107
+ const items = dtdGroups.get(name) ?? [];
108
+ const selectedCount = items.filter(it => selectedKeysSet.has(getDcmtKey(it))).length;
109
+ return {
110
+ name,
111
+ items,
112
+ total: items.length,
113
+ allSelected: items.length > 0 && selectedCount === items.length,
114
+ };
115
+ });
116
+ const treeItems = [
117
+ {
118
+ id: 'all',
119
+ text: `Seleziona tutti (${totalDcmts})`,
120
+ expanded: true,
121
+ selected: allSelected,
122
+ items: [
123
+ ...dtdGroupInfos.map((g) => ({
124
+ id: `dtd::${g.name}`,
125
+ text: `${g.name} (${g.total})`,
126
+ selected: g.allSelected,
127
+ })),
128
+ {
129
+ id: 'metadataOnly',
130
+ text: `Documenti di soli metadati (${totalMetadataOnly})`,
131
+ selected: allMetadataOnlySelected,
132
+ },
133
+ ]
134
+ }
135
+ ];
136
+ const handleItemSelectionChanged = (e) => {
137
+ const itemData = e.itemData;
138
+ if (!itemData)
139
+ return;
140
+ if (itemData.id === 'all') {
141
+ updateSelection(itemData.selected ? dcmtItems : []);
142
+ }
143
+ else if (itemData.id === 'metadataOnly') {
144
+ if (itemData.selected) {
145
+ updateSelection([...selectedItems, ...metadataOnlyItems]);
146
+ }
147
+ else {
148
+ const metadataKeys = new Set(metadataOnlyItems.map(getDcmtKey));
149
+ updateSelection(selectedItems.filter(item => !metadataKeys.has(getDcmtKey(item))));
150
+ }
151
+ }
152
+ else if (typeof itemData.id === 'string' && itemData.id.startsWith('dtd::')) {
153
+ const dtdName = itemData.id.substring('dtd::'.length);
154
+ const groupItems = dtdGroups.get(dtdName) ?? [];
155
+ if (itemData.selected) {
156
+ updateSelection([...selectedItems, ...groupItems]);
157
+ }
158
+ else {
159
+ const groupKeys = new Set(groupItems.map(getDcmtKey));
160
+ updateSelection(selectedItems.filter(item => !groupKeys.has(getDcmtKey(item))));
161
+ }
162
+ }
163
+ };
164
+ const dtdSignature = dtdGroupInfos.map(g => `${g.name}:${g.total}:${g.allSelected ? 1 : 0}`).join('|');
165
+ return (_jsx("div", { style: { minWidth: '280px', width: 'max-content', flexShrink: 0 }, children: _jsx(TreeView, { items: treeItems, showCheckBoxesMode: 'normal', selectionMode: 'multiple', selectNodesRecursive: false, selectByClick: true, onItemSelectionChanged: handleItemSelectionChanged }, `tv-${allSelected}-${allMetadataOnlySelected}-${totalDcmts}-${totalMetadataOnly}-${dtdSignature}`) }));
166
+ })() })] })] }, "TMDocumentDownload-relation-horizontal") }), isOpenDcmtForm && dcmtFormTID !== undefined && dcmtFormDID !== undefined && (_jsx(TMDcmtForm, { isModal: true, titleModal: dcmtFormTitle, TID: dcmtFormTID, DID: dcmtFormDID, layoutMode: LayoutModes.Update, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, onClose: () => {
167
+ setIsOpenDcmtForm(false);
168
+ setDcmtFormTID(undefined);
169
+ setDcmtFormDID(undefined);
170
+ setDcmtFormTitle('');
171
+ } }))] }));
172
+ };
173
+ export default TMDownloadRelationViewerSection;
@@ -97,7 +97,7 @@ const TMFileUploader = ({ fromDTD, deviceType = DeviceType.DESKTOP, onClose, onF
97
97
  document.getElementById('fileInput')?.click();
98
98
  }, []);
99
99
  let content = !uploadedFile ?
100
- _jsxs("div", { style: { display: 'flex', gap: 10, width: '100%', height: '100%' }, children: [_jsx(HiddenInput, { id: "fileInput", type: "file", onChange: handleInputChange }), _jsxs(UploadContainer, { ref: uploaderRef, tabIndex: 0, onDragOver: handleDragOver, onDragLeave: handleDragLeave, onDrop: handleDrop, style: { backgroundColor: dragOver ? '#76b1e6' : 'white' }, onDoubleClick: browseHandler, "$isRequired": isRequired, children: [_jsxs("div", { style: { display: 'flex', gap: '10px', flexDirection: 'column', position: 'absolute', right: 5, top: 5 }, children: [_jsx(TMButton, { btnStyle: 'icon', caption: 'Sfoglia', color: isRequired && !uploadedFile ? 'error' : 'primary', onClick: browseHandler, icon: _jsx(IconFolderOpen, { fontSize: 22 }) }), showScannerIcon && isScannerLicenseConfigured() && onScanRequest && _jsx(TMButton, { btnStyle: 'icon', caption: 'Scanner', color: 'primary', onClick: () => { onScanRequest((file) => { onFileUpload?.(file); }); }, icon: _jsx(IconScanner, { fontSize: 22 }) }), showScannerIcon && isScannerLicenseConfigured() && !onScanRequest && _jsx(TMButton, { btnStyle: 'icon', caption: 'Scanner', color: 'primary', onClick: () => { ShowAlert({ message: SDKUI_Localizator.ScanFeatureUnavailableInThisContext, mode: 'info', duration: 3000, title: 'Scanner' }); }, icon: _jsx(IconScanner, { fontSize: 22 }) })] }), _jsx("p", { style: { fontSize: '1.2rem', fontWeight: 'bold' }, children: deviceType === DeviceType.MOBILE ? 'Clicca per sfogliare il tuo file' : 'Trascina il tuo file o fai doppio click per sfogliarlo' }), isRequired && _jsxs("p", { style: { fontWeight: 'bold' }, children: [" ", SDKUI_Localizator.RequiredField, " "] })] })] }) :
100
+ _jsxs("div", { style: { display: 'flex', gap: 10, width: '100%', height: '100%' }, children: [_jsx(HiddenInput, { id: "fileInput", type: "file", onChange: handleInputChange }), _jsxs(UploadContainer, { ref: uploaderRef, tabIndex: 0, onDragOver: handleDragOver, onDragLeave: handleDragLeave, onDrop: handleDrop, style: { backgroundColor: dragOver ? '#76b1e6' : 'white' }, onDoubleClick: browseHandler, "$isRequired": isRequired, children: [_jsxs("div", { style: { display: 'flex', gap: '10px', flexDirection: 'column', position: 'absolute', right: 5, top: 5 }, children: [_jsx(TMButton, { btnStyle: 'icon', caption: 'Sfoglia', color: isRequired && !uploadedFile ? 'error' : 'primary', onClick: browseHandler, icon: _jsx(IconFolderOpen, { fontSize: 22 }) }), showScannerIcon && isScannerLicenseConfigured() && onScanRequest && _jsx(TMButton, { btnStyle: 'icon', caption: 'Scanner', color: 'primary', onClick: () => { onScanRequest((file) => { onFileUpload?.(file); }); }, icon: _jsx(IconScanner, { fontSize: 22 }) }), showScannerIcon && isScannerLicenseConfigured() && !onScanRequest && _jsx(TMButton, { btnStyle: 'icon', caption: 'Scanner', color: 'primary', onClick: () => { ShowAlert({ message: SDKUI_Localizator.ScanFeatureUnavailableInThisContext, mode: 'info', duration: 3000, title: 'Scanner' }); }, icon: _jsx(IconScanner, { fontSize: 22 }) })] }), _jsx("p", { style: { fontSize: '1.2rem', fontWeight: 'bold' }, children: deviceType === DeviceType.MOBILE ? SDKUI_Localizator.ClickToBrowseFile : SDKUI_Localizator.DragOrDoubleClickToBrowseFile }), isRequired && _jsxs("p", { style: { fontWeight: 'bold' }, children: [" ", SDKUI_Localizator.RequiredField, " "] })] })] }) :
101
101
  _jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: 10, width: '100%', height: '100%' }, children: [_jsxs("div", { style: { backgroundColor: 'white', padding: '5px 10px', borderRadius: 8, display: 'flex', alignItems: 'center', justifyContent: 'space-between', color: TMColors.primaryColor }, children: [_jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: 5 }, children: [_jsx("p", { children: "File name:" }), _jsxs("div", { style: { fontWeight: 'bold' }, children: [fileName, " ", _jsxs("span", { children: [" ", ` (${formatBytes(fileSize)})`, " "] })] })] }), uploadedFile && _jsx(TMButton, { btnStyle: 'icon', color: 'error', caption: 'Pulisci', onClick: () => clearFile(true), icon: _jsx(IconClear, { fontSize: 22 }) })] }), extensionHandler(fileExt) === FileExtensionHandler.READY_TO_SHOW ? _jsx(TMFileViewer, { fileBlob: uploadedFile, isResizingActive: isResizingActive }) :
102
102
  _jsx("div", { style: { backgroundColor: '#f6dbdb', padding: '5px 10px', borderRadius: 8, display: 'flex', alignItems: 'center', justifyContent: 'space-between', color: TMColors.error }, children: _jsxs("div", { children: [" ", 'Anteprima non disponibile.', fileExt && _jsx("b", { children: ` (*.${fileExt})` })] }) })] });
103
103
  const innerContent = (_jsxs("div", { style: { width: '100%', height: '100%', padding: '2px', display: 'flex', flexDirection: 'column', gap: 10 }, children: [enableDragDropOverlay && _jsx(TMDragDropOverlay, { handleFile: handleFile, refocusAfterFileInput: refocusAfterFileInput }), content] }));
@@ -1,7 +1,9 @@
1
1
  import React from 'react';
2
2
  import { HomeBlogPost, SearchResultDescriptor, TaskDescriptor } from '@topconsultnpm/sdk-ts';
3
+ import { RelationTreeItem } from './TMRelationViewer';
3
4
  import { DcmtInfo, TaskContext, MetadataValueDescriptorEx } from '../../../ts';
4
5
  import { DeviceContextProps } from '../../base/TMDeviceProvider';
6
+ export type IRelatedDcmt = RelationTreeItem;
5
7
  interface ITMMasterDetailDcmtsProps extends DeviceContextProps {
6
8
  allTasks?: Array<TaskDescriptor>;
7
9
  getAllTasks?: () => Promise<void>;
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
3
- import { DcmtTypeListCacheService, LayoutModes, SDK_Globals, SDK_Localizator } from '@topconsultnpm/sdk-ts';
3
+ import { DcmtTypeListCacheService, LayoutModes, ObjectClasses, SDK_Globals, SDK_Localizator } from '@topconsultnpm/sdk-ts';
4
4
  import TMRelationViewer from './TMRelationViewer';
5
5
  import TMContextMenu from '../../NewComponents/ContextMenu/TMContextMenu';
6
6
  import { IconMultipleSelection, IconCheckFile, IconDetailDcmts, SDKUI_Localizator, IconMenuVertical, IconDataList, IconPreview, IconSearchCheck, IconBoard, IconDcmtTypeSys, IconShow, getMoreInfoTasksForDocument, isApprovalWorkflowView, searchResultToMetadataValues, IconRefresh } from '../../../helper';
@@ -16,7 +16,7 @@ import TMDcmtForm from './TMDcmtForm';
16
16
  import { TMNothingToShow } from './TMDcmtPreview';
17
17
  import { Spinner, TMButton } from '../..';
18
18
  import { useDocumentOperations } from '../../../hooks/useDocumentOperations';
19
- const TMMasterDetailDcmts = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, handleNavigateToWGs, handleNavigateToDossiers, deviceType, inputDcmts, isForMaster, showCurrentDcmtIndicator = true, allowNavigation, canNext, canPrev, onNext, onPrev, onBack, appendMasterDcmts, onTaskCreateRequest, onRefreshAfterAddDcmtToFavs, editPdfForm, openS4TViewer, onOpenS4TViewerRequest, onOpenPdfEditorRequest, datagridUtility, dcmtUtility }) => {
19
+ const TMMasterDetailDcmts = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, handleNavigateToWGs, handleNavigateToDossiers, deviceType, inputDcmts, isForMaster, showCurrentDcmtIndicator = true, allowNavigation, canNext, canPrev, onNext, onPrev, onBack, appendMasterDcmts, onTaskCreateRequest, onRefreshAfterAddDcmtToFavs, editPdfForm, openS4TViewer, onOpenS4TViewerRequest, onOpenPdfEditorRequest, datagridUtility, dcmtUtility, }) => {
20
20
  const floatingBarContainerRef = useRef(null);
21
21
  const [focusedItem, setFocusedItem] = useState();
22
22
  const [selectedItems, setSelectedItems] = useState([]);
@@ -117,7 +117,26 @@ const TMMasterDetailDcmts = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallba
117
117
  createTaskFromDocumentOrWorkItem();
118
118
  }
119
119
  };
120
- const { operationItems, renderFloatingBar, renderDcmtOperations, features } = useDocumentOperations({
120
+ const handleNavigateToReference = useCallback((ref) => {
121
+ switch (ref.objClass) {
122
+ case ObjectClasses.Dossier:
123
+ if (handleNavigateToDossiers && ref.objID)
124
+ handleNavigateToDossiers(ref.objID);
125
+ else
126
+ console.log("Dossier reference missing objID");
127
+ break;
128
+ case ObjectClasses.WorkingGroup:
129
+ if (handleNavigateToWGs && ref.objID)
130
+ handleNavigateToWGs(ref.objID);
131
+ else
132
+ console.log("Working Group reference missing objID");
133
+ break;
134
+ // Handle other object types as needed
135
+ default:
136
+ console.warn(`Unhandled object type: ${ref.objClass}`);
137
+ }
138
+ }, [handleNavigateToDossiers, handleNavigateToWGs]);
139
+ const { operationItems, renderFloatingBar, renderDcmtOperations, features, } = useDocumentOperations({
121
140
  context: SearchResultContext.MASTER_DETAIL,
122
141
  documentData: {
123
142
  dtd: dtdFocused,
@@ -178,7 +197,7 @@ const TMMasterDetailDcmts = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallba
178
197
  onNavigateHandler, */
179
198
  handleNavigateToWGs,
180
199
  handleNavigateToDossiers,
181
- /* onReferenceClick, */
200
+ onReferenceClick: handleNavigateToReference,
182
201
  // Document forms/operations
183
202
  /* openAddDocumentForm,
184
203
  openCommentFormCallback,
@@ -285,7 +304,7 @@ const TMMasterDetailDcmts = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallba
285
304
  position: contextMenuPosition,
286
305
  onClose: () => setContextMenuVisible(false)
287
306
  } })] }) }), [inputDcmts, isForMaster, showCurrentDcmtIndicator, showZeroDcmts, allowMultipleSelection, focusedItem, selectedItems, handleFocusedItemChanged, handleSelectedItemsChanged, handleNoRelationsFound, onItemContextMenu, contextMenuVisible, contextMenuPosition, refreshKey, focusedItemFormData]);
288
- const tmFormOrResult = useMemo(() => _jsx(TMFormOrResultWrapper, { refreshKey: refreshKeyFormOrResult, deviceType: deviceType, focusedItem: focusedItem, onTaskCreateRequest: onTaskCreateRequest, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, onRefreshAfterAddDcmtToFavs: onRefreshAfterAddDcmtToFavs, editPdfForm: editPdfForm, openS4TViewer: openS4TViewer, onOpenS4TViewerRequest: onOpenS4TViewerRequest, onOpenPdfEditorRequest: onOpenPdfEditorRequest, onRefreshSearchResults: onRefreshAllPanels }), [focusedItem, deviceType, allTasks, handleNavigateToWGs, handleNavigateToDossiers, editPdfForm, openS4TViewer, onOpenS4TViewerRequest, onOpenPdfEditorRequest, onRefreshAfterAddDcmtToFavs, refreshKeyFormOrResult]);
307
+ const tmFormOrResult = useMemo(() => _jsx(TMFormOrResultWrapper, { refreshKey: refreshKeyFormOrResult, deviceType: deviceType, focusedItem: focusedItem, onTaskCreateRequest: onTaskCreateRequest, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, handleNavigateToReference: handleNavigateToReference, onRefreshAfterAddDcmtToFavs: onRefreshAfterAddDcmtToFavs, editPdfForm: editPdfForm, openS4TViewer: openS4TViewer, onOpenS4TViewerRequest: onOpenS4TViewerRequest, onOpenPdfEditorRequest: onOpenPdfEditorRequest, onRefreshSearchResults: onRefreshAllPanels }), [focusedItem, deviceType, allTasks, handleNavigateToWGs, handleNavigateToDossiers, handleNavigateToReference, editPdfForm, openS4TViewer, onOpenS4TViewerRequest, onOpenPdfEditorRequest, onRefreshAfterAddDcmtToFavs, refreshKeyFormOrResult]);
289
308
  const initialPanelDimensions = {
290
309
  'tmTreeView': { width: '50%', height: '100%' },
291
310
  'tmFormOrResult': { width: '50%', height: '100%' },
@@ -402,13 +421,13 @@ const TMRelationViewerWrapper = ({ refreshKey, inputDcmts, isForMaster, showCurr
402
421
  onItemContextMenu?.(item, e);
403
422
  }, 100);
404
423
  }, [onItemContextMenu, handleFocusedItemChanged]);
405
- return (_jsx(TMRelationViewer, { inputDcmts: inputDcmts, isForMaster: isForMaster, showCurrentDcmtIndicator: showCurrentDcmtIndicator, initialShowZeroDcmts: showZeroDcmts, customItemRender: customItemRender, allowMultipleSelection: allowMultipleSelection, focusedItem: focusedItem, selectedItems: selectedItems, onFocusedItemChanged: handleFocusedItemChanged, onSelectedItemsChanged: onSelectedItemsChanged, maxDepthLevel: 1, invertMasterNavigation: false, onNoRelationsFound: onNoRelationsFound, onItemContextMenu: onContextMenu, focusedItemFormData: focusedItemFormData }, refreshKey));
424
+ return (_jsx(TMRelationViewer, { inputDcmts: inputDcmts, isForMaster: isForMaster, showCurrentDcmtIndicator: showCurrentDcmtIndicator, initialShowZeroDcmts: showZeroDcmts, customItemRender: customItemRender, allowMultipleSelection: allowMultipleSelection, focusedItem: focusedItem, selectedItems: selectedItems, onFocusedItemChanged: handleFocusedItemChanged, onSelectedItemsChanged: onSelectedItemsChanged, maxDepthLevel: 1, invertMasterNavigation: false, showExpandAllButton: true, onNoRelationsFound: onNoRelationsFound, onItemContextMenu: onContextMenu, focusedItemFormData: focusedItemFormData }, refreshKey));
406
425
  };
407
- const TMFormOrResultWrapper = ({ refreshKey, deviceType, focusedItem, onTaskCreateRequest, allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, handleNavigateToWGs, handleNavigateToDossiers, onRefreshAfterAddDcmtToFavs, editPdfForm, openS4TViewer, onOpenS4TViewerRequest, onOpenPdfEditorRequest, onRefreshSearchAsyncDatagrid, onRefreshSearchResults }) => {
426
+ const TMFormOrResultWrapper = ({ refreshKey, deviceType, focusedItem, onTaskCreateRequest, allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, handleNavigateToWGs, handleNavigateToDossiers, onRefreshAfterAddDcmtToFavs, editPdfForm, openS4TViewer, onOpenS4TViewerRequest, onOpenPdfEditorRequest, onRefreshSearchAsyncDatagrid, onRefreshSearchResults, handleNavigateToReference }) => {
408
427
  const { setPanelVisibilityById } = useTMPanelManagerContext();
409
428
  return (_jsx(_Fragment, { children: focusedItem?.isDcmt ?
410
- _jsx(TMDcmtForm, { groupId: 'tmFormOrResult', TID: focusedItem?.tid, DID: focusedItem.did, allowButtonsRefs: true, isClosable: deviceType !== DeviceType.MOBILE, allowNavigation: false, allowRelations: deviceType !== DeviceType.MOBILE, showDcmtFormSidebar: false, onClose: () => { setPanelVisibilityById('tmTreeView', true); }, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, moreInfoTasks: getMoreInfoTasksForDocument(allTasks, focusedItem?.tid, focusedItem?.did), openS4TViewer: openS4TViewer, onOpenS4TViewerRequest: onOpenS4TViewerRequest, onOpenPdfEditorRequest: onOpenPdfEditorRequest, datagridUtility: {
429
+ _jsx(TMDcmtForm, { groupId: 'tmFormOrResult', TID: focusedItem?.tid, DID: focusedItem.did, allowButtonsRefs: true, isClosable: deviceType !== DeviceType.MOBILE, allowNavigation: false, allowRelations: deviceType !== DeviceType.MOBILE, showDcmtFormSidebar: false, onClose: () => { setPanelVisibilityById('tmTreeView', true); }, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, onReferenceClick: handleNavigateToReference, moreInfoTasks: getMoreInfoTasksForDocument(allTasks, focusedItem?.tid, focusedItem?.did), openS4TViewer: openS4TViewer, onOpenS4TViewerRequest: onOpenS4TViewerRequest, onOpenPdfEditorRequest: onOpenPdfEditorRequest, datagridUtility: {
411
430
  onRefreshSearchAsyncDatagrid,
412
431
  } }, refreshKey) :
413
- _jsx(TMSearchResult, { groupId: 'tmFormOrResult', isClosable: deviceType !== DeviceType.MOBILE, context: SearchResultContext.METADATA_SEARCH, allowFloatingBar: false, allowRelations: false, openDcmtFormAsModal: true, searchResults: focusedItem?.searchResult ?? [], showSearchResultSidebar: false, showDcmtFormSidebar: false, onTaskCreateRequest: onTaskCreateRequest, onClose: () => { setPanelVisibilityById('tmTreeView', true); }, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, editPdfForm: editPdfForm, onOpenPdfEditorRequest: onOpenPdfEditorRequest, openS4TViewer: openS4TViewer, onOpenS4TViewerRequest: onOpenS4TViewerRequest, enablePinIcons: false, onRefreshAfterAddDcmtToFavs: onRefreshAfterAddDcmtToFavs, showBackButton: false, onRefreshSearchAsyncDatagrid: onRefreshSearchResults }, refreshKey) }));
432
+ _jsx(TMSearchResult, { groupId: 'tmFormOrResult', isClosable: deviceType !== DeviceType.MOBILE, context: SearchResultContext.METADATA_SEARCH, allowFloatingBar: false, allowRelations: false, openDcmtFormAsModal: true, searchResults: focusedItem?.searchResult ?? [], showSearchResultSidebar: false, showDcmtFormSidebar: false, onTaskCreateRequest: onTaskCreateRequest, onClose: () => { setPanelVisibilityById('tmTreeView', true); }, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, editPdfForm: editPdfForm, onOpenPdfEditorRequest: onOpenPdfEditorRequest, openS4TViewer: openS4TViewer, onOpenS4TViewerRequest: onOpenS4TViewerRequest, enablePinIcons: false, onRefreshAfterAddDcmtToFavs: onRefreshAfterAddDcmtToFavs, showBackButton: false, onRefreshSearchAsyncDatagrid: onRefreshSearchResults, onReferenceClick: handleNavigateToReference }, refreshKey) }));
414
433
  };
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ import { DcmtInfo } from '../../../ts';
3
+ import { HomeBlogPost, TaskDescriptor } from '@topconsultnpm/sdk-ts';
4
+ import { TMCopyToFolderMode } from '../../../hooks/useDocumentOperations';
5
+ interface ITMMergeToPdfFormProps {
6
+ mode: TMCopyToFolderMode;
7
+ selectedDcmtInfos: Array<DcmtInfo>;
8
+ onClose: () => void;
9
+ showTMRelationViewer: boolean;
10
+ allTasks?: Array<TaskDescriptor>;
11
+ getAllTasks?: () => Promise<void>;
12
+ deleteTaskByIdsCallback?: (deletedTaskIds: Array<number>) => Promise<void>;
13
+ addTaskCallback?: (task: TaskDescriptor) => Promise<void>;
14
+ editTaskCallback?: (task: TaskDescriptor) => Promise<void>;
15
+ handleNavigateToWGs?: (value: HomeBlogPost | number) => Promise<void>;
16
+ handleNavigateToDossiers?: (value: HomeBlogPost | number) => Promise<void>;
17
+ }
18
+ /**
19
+ * Form per l'unione di più documenti PDF in un singolo file.
20
+ * Condivide TMDownloadRelationViewerSection e gli helper in copyAndMergeDcmtsShared
21
+ * con TMCopyToFolderForm.
22
+ */
23
+ declare const TMMergeToPdfForm: React.FC<ITMMergeToPdfFormProps>;
24
+ export default TMMergeToPdfForm;