@topconsultnpm/sdkui-react 6.21.0-t1 → 6.21.0-t2

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 (91) hide show
  1. package/lib/components/NewComponents/FloatingMenuBar/styles.d.ts +4 -4
  2. package/lib/components/base/TMAccordionNew.d.ts +1 -0
  3. package/lib/components/base/TMAccordionNew.js +6 -5
  4. package/lib/components/base/TMAreaManager.js +19 -3
  5. package/lib/components/base/TMDataGrid.js +2 -2
  6. package/lib/components/base/TMModal.d.ts +1 -0
  7. package/lib/components/base/TMModal.js +2 -2
  8. package/lib/components/base/TMPanel.d.ts +7 -4
  9. package/lib/components/base/TMPanel.js +58 -26
  10. package/lib/components/base/TMTreeView.js +12 -2
  11. package/lib/components/base/TMWaitPanel.js +7 -4
  12. package/lib/components/choosers/TMDistinctValues.js +35 -21
  13. package/lib/components/choosers/TMUserChooser.d.ts +4 -0
  14. package/lib/components/choosers/TMUserChooser.js +7 -5
  15. package/lib/components/editors/TMDateBox.js +4 -2
  16. package/lib/components/editors/TMFormulaEditor.d.ts +2 -0
  17. package/lib/components/editors/TMFormulaEditor.js +75 -21
  18. package/lib/components/editors/TMMetadataValues.js +2 -1
  19. package/lib/components/editors/TMRadioButton.js +7 -5
  20. package/lib/components/editors/TMTextArea.d.ts +2 -0
  21. package/lib/components/editors/TMTextArea.js +6 -3
  22. package/lib/components/editors/TMTextBox.d.ts +2 -0
  23. package/lib/components/editors/TMTextBox.js +3 -3
  24. package/lib/components/features/archive/TMArchive.js +1 -1
  25. package/lib/components/features/documents/TMCopyToFolderForm.d.ts +24 -0
  26. package/lib/components/features/documents/TMCopyToFolderForm.js +379 -0
  27. package/lib/components/features/documents/TMDcmtForm.d.ts +1 -0
  28. package/lib/components/features/documents/TMDcmtForm.js +147 -45
  29. package/lib/components/features/documents/TMDcmtFormActionButtons.js +259 -60
  30. package/lib/components/features/documents/TMDcmtPreview.d.ts +1 -0
  31. package/lib/components/features/documents/TMDcmtPreview.js +2 -2
  32. package/lib/components/features/documents/TMDcmtTasks.d.ts +1 -0
  33. package/lib/components/features/documents/TMDcmtTasks.js +2 -2
  34. package/lib/components/features/documents/TMDownloadRelationViewerSection.d.ts +23 -0
  35. package/lib/components/features/documents/TMDownloadRelationViewerSection.js +173 -0
  36. package/lib/components/features/documents/TMFileUploader.js +1 -1
  37. package/lib/components/features/documents/TMMasterDetailDcmts.d.ts +4 -0
  38. package/lib/components/features/documents/TMMasterDetailDcmts.js +29 -9
  39. package/lib/components/features/documents/TMMergeToPdfForm.d.ts +26 -0
  40. package/lib/components/features/documents/TMMergeToPdfForm.js +293 -0
  41. package/lib/components/features/documents/TMRelationViewer.d.ts +13 -0
  42. package/lib/components/features/documents/TMRelationViewer.js +75 -6
  43. package/lib/components/features/documents/copyAndMergeDcmtsShared.d.ts +71 -0
  44. package/lib/components/features/documents/copyAndMergeDcmtsShared.js +304 -0
  45. package/lib/components/features/search/SignatureParamsManager.d.ts +70 -0
  46. package/lib/components/features/search/SignatureParamsManager.js +145 -0
  47. package/lib/components/features/search/TMSavedQuerySelector.d.ts +2 -2
  48. package/lib/components/features/search/TMSavedQuerySelector.js +3 -2
  49. package/lib/components/features/search/TMSearch.d.ts +6 -1
  50. package/lib/components/features/search/TMSearch.js +16 -10
  51. package/lib/components/features/search/TMSearchQueryPanel.js +1 -1
  52. package/lib/components/features/search/TMSearchResult.d.ts +4 -0
  53. package/lib/components/features/search/TMSearchResult.js +118 -22
  54. package/lib/components/features/search/TMViewHistoryDcmt.js +1 -2
  55. package/lib/components/features/workflow/TMWorkflowPopup.js +3 -0
  56. package/lib/components/features/workflow/diagram/queryDescriptorParser.js +3 -6
  57. package/lib/components/forms/Login/TMLoginForm.d.ts +9 -0
  58. package/lib/components/forms/Login/TMLoginForm.js +61 -0
  59. package/lib/components/forms/TMResultDialog.d.ts +1 -1
  60. package/lib/components/forms/TMResultDialog.js +4 -2
  61. package/lib/components/grids/TMBlogAttachments.d.ts +1 -0
  62. package/lib/components/grids/TMBlogAttachments.js +38 -12
  63. package/lib/components/grids/TMBlogsPost.js +7 -1
  64. package/lib/components/grids/TMBlogsPostUtils.js +11 -17
  65. package/lib/components/index.d.ts +1 -0
  66. package/lib/components/index.js +1 -0
  67. package/lib/components/pages/TMPage.js +3 -1
  68. package/lib/components/query/TMQueryEditor.js +2 -2
  69. package/lib/components/viewers/TMTidViewer.js +1 -1
  70. package/lib/helper/GlobalStyles.js +6 -0
  71. package/lib/helper/SDKUI_Globals.d.ts +15 -0
  72. package/lib/helper/SDKUI_Globals.js +15 -1
  73. package/lib/helper/SDKUI_Localizator.d.ts +106 -2
  74. package/lib/helper/SDKUI_Localizator.js +1060 -12
  75. package/lib/helper/TMPdfViewer.js +25 -24
  76. package/lib/helper/TMUtils.d.ts +20 -0
  77. package/lib/helper/TMUtils.js +17 -0
  78. package/lib/helper/ZipManager.d.ts +56 -0
  79. package/lib/helper/ZipManager.js +127 -0
  80. package/lib/helper/index.d.ts +1 -0
  81. package/lib/helper/index.js +1 -0
  82. package/lib/hooks/useDataUserIdItem.js +6 -4
  83. package/lib/hooks/useDcmtOperations.d.ts +9 -2
  84. package/lib/hooks/useDcmtOperations.js +78 -35
  85. package/lib/hooks/useDocumentOperations.d.ts +5 -0
  86. package/lib/hooks/useDocumentOperations.js +238 -27
  87. package/lib/hooks/useForm.js +5 -2
  88. package/lib/hooks/useResizeObserver.d.ts +1 -1
  89. package/lib/hooks/useResizeObserver.js +16 -15
  90. package/lib/ts/types.d.ts +1 -0
  91. package/package.json +3 -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,10 @@
1
1
  import React from 'react';
2
2
  import { HomeBlogPost, SearchResultDescriptor, TaskDescriptor } from '@topconsultnpm/sdk-ts';
3
+ import { RelationTreeItem } from './TMRelationViewer';
4
+ import { MergePdfManagerType } from '../../../helper';
3
5
  import { DcmtInfo, TaskContext, MetadataValueDescriptorEx } from '../../../ts';
4
6
  import { DeviceContextProps } from '../../base/TMDeviceProvider';
7
+ export type IRelatedDcmt = RelationTreeItem;
5
8
  interface ITMMasterDetailDcmtsProps extends DeviceContextProps {
6
9
  allTasks?: Array<TaskDescriptor>;
7
10
  getAllTasks?: () => Promise<void>;
@@ -26,6 +29,7 @@ interface ITMMasterDetailDcmtsProps extends DeviceContextProps {
26
29
  openS4TViewer?: boolean;
27
30
  onOpenS4TViewerRequest?: (dcmtInfo: Array<DcmtInfo>, refreshDocumentPreview?: (() => Promise<void>)) => void;
28
31
  onOpenPdfEditorRequest?: ((dcmtInfo: Array<DcmtInfo>, refreshDocumentPreview?: () => Promise<void>) => void);
32
+ mergePdfManager?: MergePdfManagerType;
29
33
  datagridUtility?: {
30
34
  onRefreshSearchAsyncDatagrid?: () => Promise<void>;
31
35
  onRefreshDataRowsAsync?: (() => 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, mergePdfManager }) => {
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,
@@ -192,6 +211,7 @@ const TMMasterDetailDcmts = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallba
192
211
  openTaskFormHandler,
193
212
  onRefreshAfterAddDcmtToFavs,
194
213
  },
214
+ mergePdfManager: mergePdfManager
195
215
  });
196
216
  // Load dtdMaster when inputDcmts changes
197
217
  useEffect(() => {
@@ -285,7 +305,7 @@ const TMMasterDetailDcmts = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallba
285
305
  position: contextMenuPosition,
286
306
  onClose: () => setContextMenuVisible(false)
287
307
  } })] }) }), [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]);
308
+ 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, mergePdfManager: mergePdfManager }), [focusedItem, deviceType, allTasks, handleNavigateToWGs, handleNavigateToDossiers, handleNavigateToReference, editPdfForm, openS4TViewer, onOpenS4TViewerRequest, onOpenPdfEditorRequest, onRefreshAfterAddDcmtToFavs, refreshKeyFormOrResult]);
289
309
  const initialPanelDimensions = {
290
310
  'tmTreeView': { width: '50%', height: '100%' },
291
311
  'tmFormOrResult': { width: '50%', height: '100%' },
@@ -402,13 +422,13 @@ const TMRelationViewerWrapper = ({ refreshKey, inputDcmts, isForMaster, showCurr
402
422
  onItemContextMenu?.(item, e);
403
423
  }, 100);
404
424
  }, [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));
425
+ 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
426
  };
407
- const TMFormOrResultWrapper = ({ refreshKey, deviceType, focusedItem, onTaskCreateRequest, allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, handleNavigateToWGs, handleNavigateToDossiers, onRefreshAfterAddDcmtToFavs, editPdfForm, openS4TViewer, onOpenS4TViewerRequest, onOpenPdfEditorRequest, onRefreshSearchAsyncDatagrid, onRefreshSearchResults }) => {
427
+ const TMFormOrResultWrapper = ({ refreshKey, deviceType, focusedItem, onTaskCreateRequest, allTasks = [], mergePdfManager, getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, handleNavigateToWGs, handleNavigateToDossiers, onRefreshAfterAddDcmtToFavs, editPdfForm, openS4TViewer, onOpenS4TViewerRequest, onOpenPdfEditorRequest, onRefreshSearchAsyncDatagrid, onRefreshSearchResults, handleNavigateToReference }) => {
408
428
  const { setPanelVisibilityById } = useTMPanelManagerContext();
409
429
  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: {
430
+ _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
431
  onRefreshSearchAsyncDatagrid,
412
432
  } }, 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) }));
433
+ _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, mergePdfManager: mergePdfManager, onReferenceClick: handleNavigateToReference }, refreshKey) }));
414
434
  };
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+ import { DcmtInfo } from '../../../ts';
3
+ import { MergePdfManagerType } from '../../../helper';
4
+ import { HomeBlogPost, TaskDescriptor } from '@topconsultnpm/sdk-ts';
5
+ import { TMCopyToFolderMode } from '../../../hooks/useDocumentOperations';
6
+ interface ITMMergeToPdfFormProps {
7
+ mode: TMCopyToFolderMode;
8
+ selectedDcmtInfos: Array<DcmtInfo>;
9
+ onClose: () => void;
10
+ showTMRelationViewer: boolean;
11
+ mergePdfManager?: MergePdfManagerType;
12
+ allTasks?: Array<TaskDescriptor>;
13
+ getAllTasks?: () => Promise<void>;
14
+ deleteTaskByIdsCallback?: (deletedTaskIds: Array<number>) => Promise<void>;
15
+ addTaskCallback?: (task: TaskDescriptor) => Promise<void>;
16
+ editTaskCallback?: (task: TaskDescriptor) => Promise<void>;
17
+ handleNavigateToWGs?: (value: HomeBlogPost | number) => Promise<void>;
18
+ handleNavigateToDossiers?: (value: HomeBlogPost | number) => Promise<void>;
19
+ }
20
+ /**
21
+ * Form per l'unione di più documenti PDF in un singolo file.
22
+ * Condivide TMDownloadRelationViewerSection e gli helper in copyAndMergeDcmtsShared
23
+ * con TMCopyToFolderForm.
24
+ */
25
+ declare const TMMergeToPdfForm: React.FC<ITMMergeToPdfFormProps>;
26
+ export default TMMergeToPdfForm;