@topconsultnpm/sdkui-react 6.21.0-dev1.5 → 6.21.0-dev1.50
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 +2 -2
- package/lib/components/NewComponents/FloatingMenuBar/TMFloatingMenuBar.js +1 -1
- package/lib/components/base/TMAreaManager.js +28 -11
- package/lib/components/base/TMFileManagerDataGridView.js +2 -2
- package/lib/components/base/TMPanel.js +1 -0
- package/lib/components/choosers/TMDataListItemChooser.js +25 -2
- package/lib/components/choosers/TMDynDataListItemChooser.d.ts +1 -1
- package/lib/components/choosers/TMDynDataListItemChooser.js +50 -23
- package/lib/components/choosers/TMUserChooser.js +3 -1
- package/lib/components/editors/TMFormulaEditor.js +15 -3
- package/lib/components/editors/TMMetadataEditor.js +4 -3
- package/lib/components/editors/TMMetadataValues.js +1 -1
- package/lib/components/features/archive/TMArchive.js +1 -1
- package/lib/components/features/documents/TMDcmtBlog.d.ts +1 -0
- package/lib/components/features/documents/TMDcmtBlog.js +2 -2
- package/lib/components/features/documents/TMDcmtForm.js +11 -7
- package/lib/components/features/documents/TMDragDropOverlay.js +7 -2
- package/lib/components/features/documents/TMFileUploader.js +5 -4
- package/lib/components/features/documents/TMMasterDetailDcmts.js +74 -21
- package/lib/components/features/documents/TMRelationViewer.d.ts +6 -1
- package/lib/components/features/documents/TMRelationViewer.js +44 -7
- package/lib/components/features/search/TMSavedQuerySelector.js +1 -1
- package/lib/components/features/search/TMSearch.js +2 -0
- package/lib/components/features/search/TMSearchQueryEditor.js +13 -1
- package/lib/components/features/search/TMSearchResult.js +16 -3
- package/lib/components/features/search/TMViewHistoryDcmt.js +6 -0
- package/lib/components/features/workflow/diagram/DiagramItemForm.js +5 -1
- package/lib/components/features/workflow/diagram/WFDiagram.js +7 -1
- package/lib/components/features/workflow/diagram/xmlParser.js +13 -14
- package/lib/components/forms/Login/TMLoginForm.js +15 -5
- package/lib/components/forms/TMChooserForm.js +25 -2
- package/lib/components/grids/TMBlogsPost.js +1 -1
- package/lib/components/index.d.ts +1 -0
- package/lib/components/index.js +1 -0
- package/lib/components/pages/TMPage.js +4 -2
- package/lib/components/query/TMQueryCountButton.d.ts +11 -0
- package/lib/components/query/TMQueryCountButton.js +32 -0
- package/lib/components/query/TMQueryEditor.js +41 -4
- package/lib/components/query/TMQuerySummary.js +3 -2
- package/lib/components/viewers/TMDataListItemViewer.d.ts +2 -1
- package/lib/components/viewers/TMDataListItemViewer.js +2 -2
- package/lib/helper/SDKUI_Globals.d.ts +2 -0
- package/lib/helper/SDKUI_Localizator.d.ts +1 -0
- package/lib/helper/SDKUI_Localizator.js +10 -0
- package/lib/helper/TMPdfViewer.js +143 -86
- package/lib/helper/TMUtils.d.ts +1 -0
- package/lib/helper/TMUtils.js +12 -0
- package/lib/helper/checkinCheckoutManager.d.ts +7 -2
- package/lib/helper/checkinCheckoutManager.js +220 -11
- package/lib/hooks/useCheckInOutOperations.d.ts +1 -1
- package/lib/hooks/useCheckInOutOperations.js +9 -4
- package/lib/hooks/useDcmtOperations.d.ts +1 -0
- package/lib/hooks/useDcmtOperations.js +74 -4
- package/lib/hooks/useDocumentOperations.js +20 -6
- package/lib/hooks/useForm.js +20 -14
- package/lib/hooks/useInputDialog.d.ts +2 -0
- package/lib/hooks/useInputDialog.js +37 -0
- package/lib/hooks/useQueryParametersDialog.js +5 -5
- package/lib/services/platform_services.d.ts +1 -1
- package/lib/services/platform_services.js +8 -0
- package/package.json +54 -55
|
@@ -2,7 +2,6 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
2
2
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
import { IconFolderOpen, IconScanner, SDKUI_Localizator, formatBytes, IconClear, extensionHandler, IconCloseOutline, IconMenuVertical, TMCommandsContextMenu, IconEdit, isPdfEditorAvailable, SDKUI_Globals } from '../../../helper';
|
|
5
|
-
import { useBetaFeatures } from '../../../hooks/useBetaFeatures';
|
|
6
5
|
import usePreventFileDrop from '../../../hooks/usePreventFileDrop';
|
|
7
6
|
import { FileExtensionHandler } from '../../../ts';
|
|
8
7
|
import { TMColors } from '../../../utils/theme';
|
|
@@ -24,7 +23,6 @@ const isScannerLicenseConfigured = () => {
|
|
|
24
23
|
}
|
|
25
24
|
};
|
|
26
25
|
const TMFileUploader = ({ fromDTD, deviceType = DeviceType.DESKTOP, onClose, onFileUpload, openFileUploaderPdfEditor, onScanRequest, isRequired = false, defaultBlob = null, isResizingActive, showTMPanel = true, enableDragDropOverlay = false, showScannerIcon = true }) => {
|
|
27
|
-
const isBetaFeaturesEnabled = useBetaFeatures();
|
|
28
26
|
const [dragOver, setDragOver] = useState(false);
|
|
29
27
|
const [uploadedFile, setUploadedFile] = useState(defaultBlob);
|
|
30
28
|
const [fileName, setFileName] = useState('');
|
|
@@ -54,7 +52,10 @@ const TMFileUploader = ({ fromDTD, deviceType = DeviceType.DESKTOP, onClose, onF
|
|
|
54
52
|
};
|
|
55
53
|
const handleDragOver = (e) => {
|
|
56
54
|
e.preventDefault();
|
|
57
|
-
|
|
55
|
+
// Attiva solo se si trascina un file, non testo selezionato
|
|
56
|
+
if (e.dataTransfer?.types.includes('Files')) {
|
|
57
|
+
setDragOver(true);
|
|
58
|
+
}
|
|
58
59
|
};
|
|
59
60
|
const handleDragLeave = () => {
|
|
60
61
|
setDragOver(false);
|
|
@@ -96,7 +97,7 @@ const TMFileUploader = ({ fromDTD, deviceType = DeviceType.DESKTOP, onClose, onF
|
|
|
96
97
|
document.getElementById('fileInput')?.click();
|
|
97
98
|
}, []);
|
|
98
99
|
let content = !uploadedFile ?
|
|
99
|
-
_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 }) }),
|
|
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
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 }) :
|
|
101
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})` })] }) })] });
|
|
102
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,9 +1,9 @@
|
|
|
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_Localizator } from '@topconsultnpm/sdk-ts';
|
|
3
|
+
import { DcmtTypeListCacheService, LayoutModes, SDK_Globals, SDK_Localizator } from '@topconsultnpm/sdk-ts';
|
|
4
4
|
import TMRelationViewer from './TMRelationViewer';
|
|
5
5
|
import TMContextMenu from '../../NewComponents/ContextMenu/TMContextMenu';
|
|
6
|
-
import { IconMultipleSelection, IconCheckFile, IconDetailDcmts, SDKUI_Localizator, IconMenuVertical, IconDataList, IconPreview, IconSearchCheck, IconBoard, IconDcmtTypeSys, IconShow, getMoreInfoTasksForDocument, isApprovalWorkflowView } from '../../../helper';
|
|
6
|
+
import { IconMultipleSelection, IconCheckFile, IconDetailDcmts, SDKUI_Localizator, IconMenuVertical, IconDataList, IconPreview, IconSearchCheck, IconBoard, IconDcmtTypeSys, IconShow, getMoreInfoTasksForDocument, isApprovalWorkflowView, searchResultToMetadataValues, IconRefresh } from '../../../helper';
|
|
7
7
|
import { FormModes, SearchResultContext } from '../../../ts';
|
|
8
8
|
import { TMColors } from '../../../utils/theme';
|
|
9
9
|
import ShowAlert from '../../base/TMAlert';
|
|
@@ -14,7 +14,7 @@ import { TMPanelManagerProvider, useTMPanelManagerContext } from '../../layout/p
|
|
|
14
14
|
import TMSearchResult from '../search/TMSearchResult';
|
|
15
15
|
import TMDcmtForm from './TMDcmtForm';
|
|
16
16
|
import { TMNothingToShow } from './TMDcmtPreview';
|
|
17
|
-
import { Spinner } from '../..';
|
|
17
|
+
import { Spinner, TMButton } from '../..';
|
|
18
18
|
import { useDocumentOperations } from '../../../hooks/useDocumentOperations';
|
|
19
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);
|
|
@@ -29,11 +29,55 @@ const TMMasterDetailDcmts = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallba
|
|
|
29
29
|
const [contextMenuPosition, setContextMenuPosition] = useState({ x: 0, y: 0 });
|
|
30
30
|
const [dtdFocused, setDtdFocused] = useState();
|
|
31
31
|
const [refreshKey, setRefreshKey] = useState(0);
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
// Separate refresh key for TMFormOrResultWrapper only (doesn't affect tmTreeView)
|
|
33
|
+
const [refreshKeyFormOrResult, setRefreshKeyFormOrResult] = useState(0);
|
|
34
|
+
/** State for transformed focusedItem metadata values (similar to formData in TMDcmtForm) */
|
|
35
|
+
const [focusedItemFormData, setFocusedItemFormData] = useState([]);
|
|
36
|
+
// Trigger operationItems refresh (after file substitution, etc.)
|
|
37
|
+
const [refreshOperationsTrigger, setRefreshOperationsTrigger] = useState(0);
|
|
38
|
+
// Increments trigger counter to force operationItems to re-calculate
|
|
39
|
+
const onRefreshOperationsDatagrid = useCallback(async () => {
|
|
40
|
+
setRefreshOperationsTrigger(prev => prev + 1);
|
|
41
|
+
}, []);
|
|
42
|
+
// Refresh ALL panels (tree view + search results) with fade-out -> update -> fade-in transition
|
|
43
|
+
const onRefreshAllPanels = async () => {
|
|
44
|
+
await dcmtUtility?.onRefreshPreviewForm?.(); // Refresh preview form data
|
|
45
|
+
setFocusedItem(undefined); // Clear focused item to avoid stale references
|
|
46
|
+
setTimeout(async () => {
|
|
47
|
+
setRefreshKey(prev => prev + 1); // Force re-render of tmTreeView
|
|
48
|
+
setRefreshKeyFormOrResult(prev => prev + 1); // Force re-render of TMFormOrResultWrapper
|
|
49
|
+
await onRefreshOperationsDatagrid(); // Refresh operation items
|
|
50
|
+
}, 200); // Wait for fade-out animation
|
|
36
51
|
};
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
const fetchFocusedItemMetadata = async () => {
|
|
54
|
+
if (!focusedItem?.tid || !focusedItem?.did) {
|
|
55
|
+
setFocusedItemFormData([]);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
try {
|
|
59
|
+
const tid = focusedItem?.tid;
|
|
60
|
+
const did = focusedItem?.did;
|
|
61
|
+
const metadata = await SDK_Globals.tmSession?.NewSearchEngine().GetMetadataAsync(tid, did, true);
|
|
62
|
+
// Transform metadata to MetadataValueDescriptorEx[] (similar to setMetadataList in TMDcmtForm)
|
|
63
|
+
if (metadata) {
|
|
64
|
+
const dtdResult = metadata.dtdResult;
|
|
65
|
+
const rows = dtdResult?.rows ? dtdResult.rows[0] : [];
|
|
66
|
+
const mids = metadata.selectMIDs;
|
|
67
|
+
// Get DTD with metadata descriptors
|
|
68
|
+
const dtdWithMetadata = await DcmtTypeListCacheService.GetWithNotGrantedAsync(tid, did, metadata);
|
|
69
|
+
const mdList = dtdWithMetadata?.metadata ?? [];
|
|
70
|
+
const metadataList = searchResultToMetadataValues(tid, dtdResult, rows, mids, mdList, LayoutModes.Update);
|
|
71
|
+
setFocusedItemFormData(structuredClone(metadataList));
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
console.error('Error fetching focusedItem metadata:', error);
|
|
76
|
+
setFocusedItemFormData([]);
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
fetchFocusedItemMetadata();
|
|
80
|
+
}, [focusedItem?.tid, focusedItem?.did, refreshOperationsTrigger]);
|
|
37
81
|
// Load dtdFocused when focusedItem changes
|
|
38
82
|
useEffect(() => {
|
|
39
83
|
const loadDtdFocused = async () => {
|
|
@@ -83,17 +127,26 @@ const TMMasterDetailDcmts = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallba
|
|
|
83
127
|
currentMetadataValues: [],
|
|
84
128
|
allUsers: [],
|
|
85
129
|
// searchResult: selectedSearchResult,
|
|
86
|
-
datagridUtility
|
|
130
|
+
datagridUtility: {
|
|
131
|
+
visibleItems: [],
|
|
132
|
+
onRefreshSearchAsyncDatagrid: onRefreshAllPanels,
|
|
133
|
+
onRefreshDataRowsAsync: onRefreshAllPanels,
|
|
134
|
+
refreshFocusedDataRowAsync: onRefreshAllPanels,
|
|
135
|
+
onRefreshBlogDatagrid: onRefreshAllPanels,
|
|
136
|
+
onRefreshPreviewDatagrid: onRefreshAllPanels,
|
|
137
|
+
refreshOperationsTrigger,
|
|
138
|
+
onRefreshOperationsDatagrid,
|
|
139
|
+
},
|
|
87
140
|
dcmtUtility: {
|
|
88
141
|
approvalVID: dcmtUtility?.approvalVID,
|
|
89
|
-
dcmtDataRowForCicoStatus:
|
|
142
|
+
dcmtDataRowForCicoStatus: focusedItemFormData, // Passa i metadata trasformati del focusedItem per le operazioni di CICO
|
|
90
143
|
selectedDcmtSearchResultRelations: dcmtUtility?.selectedDcmtSearchResultRelations,
|
|
91
144
|
dcmtTIDHasDetailRelations: dcmtUtility?.dcmtTIDHasDetailRelations,
|
|
92
145
|
dcmtTIDHasMasterRelations: dcmtUtility?.dcmtTIDHasMasterRelations,
|
|
93
|
-
updateCurrentDcmt:
|
|
146
|
+
updateCurrentDcmt: onRefreshAllPanels,
|
|
94
147
|
onCloseDcmtForm: dcmtUtility?.onCloseDcmtForm,
|
|
95
148
|
onRefreshBlogForm: dcmtUtility?.onRefreshBlogForm,
|
|
96
|
-
onRefreshPreviewForm:
|
|
149
|
+
onRefreshPreviewForm: onRefreshAllPanels,
|
|
97
150
|
taskFormDialogComponent: dcmtUtility?.taskFormDialogComponent,
|
|
98
151
|
s4TViewerDialogComponent: dcmtUtility?.s4TViewerDialogComponent
|
|
99
152
|
},
|
|
@@ -213,7 +266,7 @@ const TMMasterDetailDcmts = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallba
|
|
|
213
266
|
}
|
|
214
267
|
}
|
|
215
268
|
];
|
|
216
|
-
const toolbar = _jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: '10px' }, children: [allowMultipleSelection && _jsx("p", { style: { color: TMColors.colorHeader, textAlign: 'center', padding: '1px 4px', borderRadius: '3px', display: 'flex' }, children: `${selectedItems.filter(item => item.isDcmt).length} selezionati` }), allowNavigation && canPrev != undefined && _jsx(TMSaveFormButtonPrevious, { btnStyle: 'icon', iconColor: 'white', isModified: false, formMode: FormModes.ReadOnly, canPrev: canPrev, onPrev: onPrev }), allowNavigation && canNext != undefined && _jsx(TMSaveFormButtonNext, { btnStyle: 'icon', iconColor: 'white', isModified: false, formMode: FormModes.ReadOnly, canNext: canNext, onNext: onNext }), _jsx(TMContextMenu, { items: commandsMenuItems, trigger: 'left', children: _jsx(IconMenuVertical, { color: 'white', cursor: 'pointer' }) })] });
|
|
269
|
+
const toolbar = _jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: '10px' }, children: [allowMultipleSelection && _jsx("p", { style: { color: TMColors.colorHeader, textAlign: 'center', padding: '1px 4px', borderRadius: '3px', display: 'flex' }, children: `${selectedItems.filter(item => item.isDcmt).length} selezionati` }), allowNavigation && canPrev != undefined && _jsx(TMSaveFormButtonPrevious, { btnStyle: 'icon', iconColor: 'white', isModified: false, formMode: FormModes.ReadOnly, canPrev: canPrev, onPrev: onPrev }), allowNavigation && canNext != undefined && _jsx(TMSaveFormButtonNext, { btnStyle: 'icon', iconColor: 'white', isModified: false, formMode: FormModes.ReadOnly, canNext: canNext, onNext: onNext }), _jsx(TMButton, { btnStyle: 'icon', icon: _jsx(IconRefresh, { color: 'white' }), caption: SDKUI_Localizator.Refresh, onClick: onRefreshAllPanels }), _jsx(TMContextMenu, { items: commandsMenuItems, trigger: 'left', children: _jsx(IconMenuVertical, { color: 'white', cursor: 'pointer' }) })] });
|
|
217
270
|
const getTitle = () => isForMaster ? `${SDKUI_Localizator.DcmtsMaster} - ${dtdMaster?.nameLoc}` : SDKUI_Localizator.DcmtsDetail;
|
|
218
271
|
const isMobile = deviceType === DeviceType.MOBILE;
|
|
219
272
|
const tmTreeView = useMemo(() => _jsx(_Fragment, { children: !inputDcmts || inputDcmts.length === 0
|
|
@@ -225,14 +278,14 @@ const TMMasterDetailDcmts = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallba
|
|
|
225
278
|
e.preventDefault();
|
|
226
279
|
setContextMenuPosition({ x: e.clientX, y: e.clientY });
|
|
227
280
|
setContextMenuVisible(true);
|
|
228
|
-
}, children: [_jsx(TMRelationViewerWrapper, { inputDcmts: inputDcmts, isForMaster: isForMaster, showCurrentDcmtIndicator: showCurrentDcmtIndicator, showZeroDcmts: showZeroDcmts,
|
|
281
|
+
}, children: [_jsx(TMRelationViewerWrapper, { refreshKey: refreshKey, inputDcmts: inputDcmts, isForMaster: isForMaster, showCurrentDcmtIndicator: showCurrentDcmtIndicator, showZeroDcmts: showZeroDcmts,
|
|
229
282
|
// customItemRender={customItemRender}
|
|
230
|
-
allowMultipleSelection: allowMultipleSelection, focusedItem: focusedItem, selectedItems: selectedItems, onFocusedItemChanged: handleFocusedItemChanged, onSelectedItemsChanged: handleSelectedItemsChanged, onNoRelationsFound: handleNoRelationsFound, onItemContextMenu: onItemContextMenu }
|
|
283
|
+
allowMultipleSelection: allowMultipleSelection, focusedItem: focusedItem, selectedItems: selectedItems, onFocusedItemChanged: handleFocusedItemChanged, onSelectedItemsChanged: handleSelectedItemsChanged, onNoRelationsFound: handleNoRelationsFound, onItemContextMenu: onItemContextMenu, focusedItemFormData: focusedItemFormData }), _jsx(TMContextMenu, { items: operationItems, externalControl: {
|
|
231
284
|
visible: contextMenuVisible,
|
|
232
285
|
position: contextMenuPosition,
|
|
233
286
|
onClose: () => setContextMenuVisible(false)
|
|
234
|
-
} })] }) }), [inputDcmts, isForMaster, showCurrentDcmtIndicator, showZeroDcmts, allowMultipleSelection, focusedItem, selectedItems, handleFocusedItemChanged, handleSelectedItemsChanged, handleNoRelationsFound, onItemContextMenu, contextMenuVisible, contextMenuPosition, refreshKey]);
|
|
235
|
-
const tmFormOrResult = useMemo(() => _jsx(TMFormOrResultWrapper, { 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 }
|
|
287
|
+
} })] }) }), [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]);
|
|
236
289
|
const initialPanelDimensions = {
|
|
237
290
|
'tmTreeView': { width: '50%', height: '100%' },
|
|
238
291
|
'tmFormOrResult': { width: '50%', height: '100%' },
|
|
@@ -318,7 +371,7 @@ export default TMMasterDetailDcmts;
|
|
|
318
371
|
* - Panel visibility toggling
|
|
319
372
|
* - Focus delay handling
|
|
320
373
|
*/
|
|
321
|
-
const TMRelationViewerWrapper = ({ inputDcmts, isForMaster, showCurrentDcmtIndicator, showZeroDcmts, customItemRender, allowMultipleSelection, focusedItem, selectedItems, onFocusedItemChanged, onSelectedItemsChanged, onNoRelationsFound, onItemContextMenu }) => {
|
|
374
|
+
const TMRelationViewerWrapper = ({ refreshKey, inputDcmts, isForMaster, showCurrentDcmtIndicator, showZeroDcmts, customItemRender, allowMultipleSelection, focusedItem, selectedItems, onFocusedItemChanged, onSelectedItemsChanged, onNoRelationsFound, onItemContextMenu, focusedItemFormData }) => {
|
|
322
375
|
const { setPanelVisibilityById, setToolbarButtonVisibility } = useTMPanelManagerContext();
|
|
323
376
|
// Handle focused item changes with panel visibility management
|
|
324
377
|
const handleFocusedItemChanged = useCallback((item) => {
|
|
@@ -349,13 +402,13 @@ const TMRelationViewerWrapper = ({ inputDcmts, isForMaster, showCurrentDcmtIndic
|
|
|
349
402
|
onItemContextMenu?.(item, e);
|
|
350
403
|
}, 100);
|
|
351
404
|
}, [onItemContextMenu, handleFocusedItemChanged]);
|
|
352
|
-
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 }));
|
|
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));
|
|
353
406
|
};
|
|
354
|
-
const TMFormOrResultWrapper = ({ deviceType, focusedItem, onTaskCreateRequest, allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, handleNavigateToWGs, handleNavigateToDossiers, onRefreshAfterAddDcmtToFavs, editPdfForm, openS4TViewer, onOpenS4TViewerRequest, onOpenPdfEditorRequest, onRefreshSearchAsyncDatagrid }) => {
|
|
407
|
+
const TMFormOrResultWrapper = ({ refreshKey, deviceType, focusedItem, onTaskCreateRequest, allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, handleNavigateToWGs, handleNavigateToDossiers, onRefreshAfterAddDcmtToFavs, editPdfForm, openS4TViewer, onOpenS4TViewerRequest, onOpenPdfEditorRequest, onRefreshSearchAsyncDatagrid, onRefreshSearchResults }) => {
|
|
355
408
|
const { setPanelVisibilityById } = useTMPanelManagerContext();
|
|
356
409
|
return (_jsx(_Fragment, { children: focusedItem?.isDcmt ?
|
|
357
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: {
|
|
358
411
|
onRefreshSearchAsyncDatagrid,
|
|
359
|
-
} }) :
|
|
360
|
-
_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 }) }));
|
|
412
|
+
} }, 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) }));
|
|
361
414
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { DcmtTypeDescriptor, SearchResultDescriptor, DataColumnDescriptor } from "@topconsultnpm/sdk-ts";
|
|
3
|
-
import { DcmtInfo } from '../../../ts';
|
|
3
|
+
import { DcmtInfo, MetadataValueDescriptorEx } from '../../../ts';
|
|
4
4
|
import { ITMTreeItem } from '../../base/TMTreeView';
|
|
5
5
|
/**
|
|
6
6
|
* Tree item structure for relations
|
|
@@ -104,6 +104,11 @@ export interface TMRelationViewerProps {
|
|
|
104
104
|
* Use to show a context menu.
|
|
105
105
|
*/
|
|
106
106
|
onItemContextMenu?: (item: RelationTreeItem, e: React.MouseEvent) => void;
|
|
107
|
+
/**
|
|
108
|
+
* Metadata values for the focused item
|
|
109
|
+
* (used in master-detail context)
|
|
110
|
+
*/
|
|
111
|
+
focusedItemFormData?: MetadataValueDescriptorEx[];
|
|
107
112
|
}
|
|
108
113
|
/**
|
|
109
114
|
* Check if document type has detail relations
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
3
|
-
import { DcmtTypeListCacheService, SDK_Globals, DataColumnTypes, MetadataFormats, SystemMIDs, MetadataDataDomains, RelationCacheService, RelationTypes } from "@topconsultnpm/sdk-ts";
|
|
4
|
-
import { genUniqueId, IconFolder, IconBackhandIndexPointingRight, IconCircleInfo } from '../../../helper';
|
|
3
|
+
import { DcmtTypeListCacheService, SDK_Globals, DataColumnTypes, MetadataFormats, SystemMIDs, MetadataDataDomains, RelationCacheService, RelationTypes, UserListCacheService } from "@topconsultnpm/sdk-ts";
|
|
4
|
+
import { genUniqueId, IconFolder, IconBackhandIndexPointingRight, IconCircleInfo, getDcmtCicoStatus } from '../../../helper';
|
|
5
5
|
import { TMColors } from '../../../utils/theme';
|
|
6
6
|
import { StyledDivHorizontal, StyledBadge } from '../../base/Styled';
|
|
7
7
|
import TMTreeView from '../../base/TMTreeView';
|
|
@@ -136,7 +136,7 @@ export const searchResultToDataSource = async (searchResult, hideSysMetadata) =>
|
|
|
136
136
|
}
|
|
137
137
|
return output;
|
|
138
138
|
};
|
|
139
|
-
const TMRelationViewer = ({ inputDcmts, isForMaster = false, showCurrentDcmtIndicator = true, allowShowZeroDcmts = true, initialShowZeroDcmts = false, allowedTIDs, allowMultipleSelection = false, focusedItem, selectedItems, onFocusedItemChanged, onSelectedItemsChanged, onDocumentDoubleClick, customItemRender, customDocumentStyle, customMainContainerContent, customDocumentContent, showMetadataNames = false, maxDepthLevel = 2, invertMasterNavigation = true, additionalStaticItems, showMainDocument = true, labelMainContainer, onNoRelationsFound, onItemContextMenu, }) => {
|
|
139
|
+
const TMRelationViewer = ({ inputDcmts, isForMaster = false, showCurrentDcmtIndicator = true, allowShowZeroDcmts = true, initialShowZeroDcmts = false, allowedTIDs, allowMultipleSelection = false, focusedItem, selectedItems, onFocusedItemChanged, onSelectedItemsChanged, onDocumentDoubleClick, customItemRender, customDocumentStyle, customMainContainerContent, customDocumentContent, showMetadataNames = false, maxDepthLevel = 2, invertMasterNavigation = true, additionalStaticItems, showMainDocument = true, labelMainContainer, onNoRelationsFound, onItemContextMenu, focusedItemFormData = [] }) => {
|
|
140
140
|
// State
|
|
141
141
|
const [dcmtTypes, setDcmtTypes] = useState([]);
|
|
142
142
|
const [treeData, setTreeData] = useState([]);
|
|
@@ -160,6 +160,16 @@ const TMRelationViewer = ({ inputDcmts, isForMaster = false, showCurrentDcmtIndi
|
|
|
160
160
|
const userInteractedWithStaticItemsRef = React.useRef(false);
|
|
161
161
|
// Ref to track the last inputKey for which we set the focused item
|
|
162
162
|
const lastFocusedInputRef = React.useRef('');
|
|
163
|
+
// State for all users (used for checkout status display)
|
|
164
|
+
const [allUsers, setAllUsers] = useState([]);
|
|
165
|
+
// Load all users for checkout status resolution
|
|
166
|
+
useEffect(() => {
|
|
167
|
+
const fetchAllUsers = async () => {
|
|
168
|
+
const users = await UserListCacheService.GetAllAsync();
|
|
169
|
+
setAllUsers(users ?? []);
|
|
170
|
+
};
|
|
171
|
+
fetchAllUsers();
|
|
172
|
+
}, []);
|
|
163
173
|
/**
|
|
164
174
|
* Generate a stable key from inputDcmts to detect real changes
|
|
165
175
|
*/
|
|
@@ -234,6 +244,7 @@ const TMRelationViewer = ({ inputDcmts, isForMaster = false, showCurrentDcmtIndi
|
|
|
234
244
|
dcmtDetails.push({
|
|
235
245
|
tid: tid,
|
|
236
246
|
did: did,
|
|
247
|
+
dtd: dtd,
|
|
237
248
|
isLogDel: isLogDel,
|
|
238
249
|
key: `${tid}_${did}_${searchResult.relationID}_${mTID}_${mDID}_${rowGUID}`,
|
|
239
250
|
isDcmt: true,
|
|
@@ -247,7 +258,7 @@ const TMRelationViewer = ({ inputDcmts, isForMaster = false, showCurrentDcmtIndi
|
|
|
247
258
|
expanded: false,
|
|
248
259
|
hidden: false,
|
|
249
260
|
name: row?.SYS_Abstract?.value || row?.SYS_SUBJECT?.value || `Documento ${did}`,
|
|
250
|
-
fileExt: row?.FILEEXT?.value
|
|
261
|
+
fileExt: row?.FILEEXT?.value,
|
|
251
262
|
// Note: Recursive loading on expansion is handled by calculateItemsForNode
|
|
252
263
|
});
|
|
253
264
|
}
|
|
@@ -260,7 +271,7 @@ const TMRelationViewer = ({ inputDcmts, isForMaster = false, showCurrentDcmtIndi
|
|
|
260
271
|
console.error('❌ Error loading detail documents:', error);
|
|
261
272
|
}
|
|
262
273
|
return items;
|
|
263
|
-
}, [allowedTIDs]);
|
|
274
|
+
}, [allowedTIDs, focusedItemFormData, focusedItem?.dtd?.id]);
|
|
264
275
|
/**
|
|
265
276
|
* Recursively retrieve master documents
|
|
266
277
|
*/
|
|
@@ -319,6 +330,7 @@ const TMRelationViewer = ({ inputDcmts, isForMaster = false, showCurrentDcmtIndi
|
|
|
319
330
|
dcmtMasters.push({
|
|
320
331
|
tid: tid,
|
|
321
332
|
did: did,
|
|
333
|
+
dtd: dtd,
|
|
322
334
|
isLogDel: isLogDel,
|
|
323
335
|
key: `${tid}_${did}_${searchResult.relationID}_${dTID}_${dDID}_${rowGUID}`,
|
|
324
336
|
isDcmt: true,
|
|
@@ -609,12 +621,14 @@ const TMRelationViewer = ({ inputDcmts, isForMaster = false, showCurrentDcmtIndi
|
|
|
609
621
|
name: docRow?.SYS_Abstract?.value || docRow?.SYS_SUBJECT?.value || `Documento ${isForMaster ? 'Dettaglio' : 'Master'}`,
|
|
610
622
|
tid: dcmt.TID,
|
|
611
623
|
did: dcmt.DID,
|
|
624
|
+
dtd: dtd,
|
|
612
625
|
isDcmt: true,
|
|
613
626
|
isContainer: false,
|
|
614
627
|
expanded: false,
|
|
615
628
|
isZero: dcmt.DID === 0,
|
|
616
629
|
isMaster: !isForMaster,
|
|
617
630
|
isLoaded: true,
|
|
631
|
+
isLogDel: docRow?.ISLOGDEL?.value,
|
|
618
632
|
hidden: false,
|
|
619
633
|
values: docRow,
|
|
620
634
|
searchResult: result ? [result] : [],
|
|
@@ -1080,8 +1094,31 @@ const TMRelationViewer = ({ inputDcmts, isForMaster = false, showCurrentDcmtIndi
|
|
|
1080
1094
|
const metadataContent = customDocumentContent
|
|
1081
1095
|
? customDocumentContent(item, defaultMetadataContent || _jsx(_Fragment, {}))
|
|
1082
1096
|
: defaultMetadataContent;
|
|
1083
|
-
|
|
1084
|
-
|
|
1097
|
+
// Calculate checkout status for non-root documents
|
|
1098
|
+
let checkoutStatusIcon = null;
|
|
1099
|
+
if (item.values && item.dtd) {
|
|
1100
|
+
// Convert item.values to flat format expected by getDcmtCicoStatus
|
|
1101
|
+
const flatValues = {};
|
|
1102
|
+
if (item.values) {
|
|
1103
|
+
for (const key of Object.keys(item.values)) {
|
|
1104
|
+
const entry = item.values[key];
|
|
1105
|
+
if (entry?.md?.id && item.tid) {
|
|
1106
|
+
// Create TID_MID key format for metadata
|
|
1107
|
+
flatValues[`${item.tid}_${entry.md.id}`] = entry.value;
|
|
1108
|
+
}
|
|
1109
|
+
// Also add direct key for system properties
|
|
1110
|
+
flatValues[key] = entry?.value;
|
|
1111
|
+
}
|
|
1112
|
+
flatValues.TID = item.tid;
|
|
1113
|
+
flatValues.DID = item.did;
|
|
1114
|
+
}
|
|
1115
|
+
const { checkoutStatus } = getDcmtCicoStatus(flatValues, allUsers, item.dtd);
|
|
1116
|
+
if (checkoutStatus.isCheckedOut && checkoutStatus.icon) {
|
|
1117
|
+
checkoutStatusIcon = checkoutStatus.icon;
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
1120
|
+
return (_jsxs("div", { onDoubleClick: handleDoubleClick, style: documentStyle, children: [item.did && item.tid && showCurrentDcmtIndicator && inputDcmts?.some(d => d.DID === item.did && d.TID === item.tid) ? _jsx(IconBackhandIndexPointingRight, { fontSize: 22, overflow: 'visible' }) : _jsx(_Fragment, {}), item.values && (_jsx(TMDcmtIcon, { tid: item.values?.TID?.value, did: item.values?.DID?.value, fileExtension: item.values?.FILEEXT?.value, fileCount: item.values?.FILECOUNT?.value, isLexProt: item.values?.IsLexProt?.value, isMail: item.values?.ISMAIL?.value, isShared: item.values?.ISSHARED?.value, isSigned: item.values?.ISSIGNED?.value, downloadMode: 'openInNewWindow' })), checkoutStatusIcon, metadataContent] }));
|
|
1121
|
+
}, [onDocumentDoubleClick, showCurrentDcmtIndicator, inputDcmts, customMainContainerContent, customDocumentStyle, customDocumentContent, showMetadataNames, showMainDocument, focusedItemFormData, focusedItem?.dtd, allUsers]);
|
|
1085
1122
|
/**
|
|
1086
1123
|
* Wrapper renderer that handles custom rendering if provided
|
|
1087
1124
|
*/
|
|
@@ -201,7 +201,7 @@ const TMSavedQuerySelector = React.memo(({ items, selectedId, allowShowSearch =
|
|
|
201
201
|
alignItems: 'center',
|
|
202
202
|
justifyContent: 'center',
|
|
203
203
|
minWidth: 0
|
|
204
|
-
}, children: [_jsx("p", { style: {
|
|
204
|
+
}, children: [_jsx("p", { title: sqd.name, style: {
|
|
205
205
|
fontSize: '1rem',
|
|
206
206
|
fontWeight: sqd.id === 1 ? 600 : 'normal',
|
|
207
207
|
whiteSpace: 'nowrap',
|
|
@@ -53,6 +53,8 @@ const TMSearch = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTask
|
|
|
53
53
|
if (inputSqdID) {
|
|
54
54
|
SavedQueryCacheService.GetAsync(inputSqdID).then(async (resultSqd) => {
|
|
55
55
|
await setSQDAsync(resultSqd);
|
|
56
|
+
// Mostra la vista Search per visualizzare i filtri della SavedQuery caricata
|
|
57
|
+
setCurrentSearchView(TMSearchViews.Search);
|
|
56
58
|
});
|
|
57
59
|
}
|
|
58
60
|
}, [inputSqdID]);
|
|
@@ -148,6 +148,18 @@ const TMSearchWhereItemEditor = React.memo(({ whereItem, queryParamsDynDataList,
|
|
|
148
148
|
let dtd = await DcmtTypeListCacheService.GetAsync(whereItem.tid, true);
|
|
149
149
|
return dtd?.metadata?.find(o => o.id === whereItem.mid);
|
|
150
150
|
};
|
|
151
|
+
// Rimuove gli apici singoli da valori separati da virgola: 'msegato','plevolella' -> msegato,plevolella
|
|
152
|
+
const stripQuotes = (value) => {
|
|
153
|
+
if (!value || typeof value !== 'string')
|
|
154
|
+
return value;
|
|
155
|
+
return value.split(',').map(item => {
|
|
156
|
+
const trimmed = item.trim();
|
|
157
|
+
if (trimmed.startsWith("'") && trimmed.endsWith("'")) {
|
|
158
|
+
return trimmed.slice(1, -1);
|
|
159
|
+
}
|
|
160
|
+
return trimmed;
|
|
161
|
+
}).join(',');
|
|
162
|
+
};
|
|
151
163
|
const normalizeValue = (value, isForValue1 = true) => {
|
|
152
164
|
let newValues = [];
|
|
153
165
|
let newValue = value;
|
|
@@ -161,7 +173,7 @@ const TMSearchWhereItemEditor = React.memo(({ whereItem, queryParamsDynDataList,
|
|
|
161
173
|
}
|
|
162
174
|
onValueChanged?.(newValues);
|
|
163
175
|
};
|
|
164
|
-
return (_jsxs(StyledRowItem, { style: { marginBottom: 0, width: '100%' }, children: [showValue1 && _jsx(TMMetadataEditor, { openChooserBySingleClick: openChooserBySingleClick, isSelected: isSelected, tid: whereItem.tid, mid: whereItem.mid, layoutMode: LayoutModes.None, isEditable: isEditableList, value: whereItem.value1, queryOperator: whereItem.operator, queryParamsDynDataList: queryParamsDynDataList, autoFocus: autoFocus ?? false, containerElement: undefined, onValueChanged: (value) => { normalizeValue(value, true); }, onCascadeRefreshDynDataLists: onCascadeRefreshDynDataLists, onCascadeUpdateMIDs: onCascadeUpdateMIDs, updateIsModalOpen: updateIsModalOpen }), showValue2 && _jsx(TMMetadataEditor, { openChooserBySingleClick: openChooserBySingleClick, isSelected: isSelected, tid: whereItem.tid, mid: whereItem.mid, layoutMode: LayoutModes.None, isEditable: isEditableList, value: whereItem.value2, queryOperator: whereItem.operator, autoFocus: autoFocus ?? false, containerElement: undefined, onValueChanged: (value) => { normalizeValue(value, false); }, updateIsModalOpen: updateIsModalOpen })] }));
|
|
176
|
+
return (_jsxs(StyledRowItem, { style: { marginBottom: 0, width: '100%' }, children: [showValue1 && _jsx(TMMetadataEditor, { openChooserBySingleClick: openChooserBySingleClick, isSelected: isSelected, tid: whereItem.tid, mid: whereItem.mid, layoutMode: LayoutModes.None, isEditable: isEditableList, value: stripQuotes(whereItem.value1), queryOperator: whereItem.operator, queryParamsDynDataList: queryParamsDynDataList, autoFocus: autoFocus ?? false, containerElement: undefined, onValueChanged: (value) => { normalizeValue(value, true); }, onCascadeRefreshDynDataLists: onCascadeRefreshDynDataLists, onCascadeUpdateMIDs: onCascadeUpdateMIDs, updateIsModalOpen: updateIsModalOpen }), showValue2 && _jsx(TMMetadataEditor, { openChooserBySingleClick: openChooserBySingleClick, isSelected: isSelected, tid: whereItem.tid, mid: whereItem.mid, layoutMode: LayoutModes.None, isEditable: isEditableList, value: stripQuotes(whereItem.value2), queryOperator: whereItem.operator, autoFocus: autoFocus ?? false, containerElement: undefined, onValueChanged: (value) => { normalizeValue(value, false); }, updateIsModalOpen: updateIsModalOpen })] }));
|
|
165
177
|
});
|
|
166
178
|
const TMSearchWhereItemCard = React.memo(({ index, whereItem, isSelected, queryParamsDynDataList, showEditor, showCompleteMetadataName, showId, isEditableList, onWhereItemChange, onHideEditor, onCascadeRefreshDynDataLists, onCascadeUpdateMIDs, updateIsModalOpen }) => {
|
|
167
179
|
const [isOpen, setIsOpen] = useState(false);
|
|
@@ -352,7 +352,7 @@ handleNavigateToWGs, handleNavigateToDossiers, }) => {
|
|
|
352
352
|
openTaskFormHandler,
|
|
353
353
|
},
|
|
354
354
|
});
|
|
355
|
-
const { isOpenDcmtForm, openFormHandler, dcmtFormLayoutMode, onDcmtFormOpenChange, showSearchTMDatagrid, showExportForm, isOpenBatchUpdate, isModifiedBatchUpdate, updateBatchUpdateForm, handleSignApprove, checkoutInfo: { showCicoWaitPanel, cicoWaitPanelTitle, showCicoPrimaryProgress, cicoPrimaryProgressText, cicoPrimaryProgressValue, cicoPrimaryProgressMax, }, dcmtOperations: { abortController, showWaitPanel, showPrimary, waitPanelTitle, waitPanelTextPrimary, waitPanelValuePrimary, waitPanelMaxValuePrimary, showSecondary, waitPanelTextSecondary, waitPanelValueSecondary, waitPanelMaxValueSecondary, downloadDcmtsAsync, runOperationAsync, }, relatedDocumentsInfo: { isOpenDetails, isOpenMaster, checkRelatedDcmtsArchiveCapability, checkManyToManyCapability, }, toppyOperations: { showApprovePopup, showRejectPopup, showReAssignPopup, showMoreInfoPopup, updateShowApprovePopup, updateShowRejectPopup, updateShowReAssignPopup, updateShowMoreInfoPopup } } = features;
|
|
355
|
+
const { isOpenDcmtForm, openFormHandler, dcmtFormLayoutMode, onDcmtFormOpenChange, showSearchTMDatagrid, showExportForm, isOpenBatchUpdate, isModifiedBatchUpdate, updateBatchUpdateForm, handleSignApprove, checkoutInfo: { showCicoWaitPanel, cicoWaitPanelTitle, showCicoPrimaryProgress, cicoPrimaryProgressText, cicoPrimaryProgressValue, cicoPrimaryProgressMax, }, dcmtOperations: { abortController, showWaitPanel, showPrimary, waitPanelTitle, waitPanelTextPrimary, waitPanelValuePrimary, waitPanelMaxValuePrimary, showSecondary, waitPanelTextSecondary, waitPanelValueSecondary, waitPanelMaxValueSecondary, downloadDcmtsAsync, runOperationAsync, FileSourceDialog, }, relatedDocumentsInfo: { isOpenDetails, isOpenMaster, checkRelatedDcmtsArchiveCapability, checkManyToManyCapability, }, toppyOperations: { showApprovePopup, showRejectPopup, showReAssignPopup, showMoreInfoPopup, updateShowApprovePopup, updateShowRejectPopup, updateShowReAssignPopup, updateShowMoreInfoPopup } } = features;
|
|
356
356
|
const deviceType = useDeviceType();
|
|
357
357
|
const isMobile = deviceType === DeviceType.MOBILE;
|
|
358
358
|
const selectedDocs = getSelectedDcmtsOrFocused(selectedItems, focusedItem);
|
|
@@ -658,6 +658,7 @@ handleNavigateToWGs, handleNavigateToDossiers, }) => {
|
|
|
658
658
|
}
|
|
659
659
|
return (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', height: '100%', overflow: 'hidden', width: '100%' }, children: [_jsx("div", { style: { padding: '10px', overflow: 'auto', flex: 1 }, children: _jsx("div", { dangerouslySetInnerHTML: { __html: ftExplanation } }) }), _jsxs(StyledIndexingInfoSection, { children: [_jsxs(StyledIndexingToggle, { onClick: handleToggleIndexingInfo, disabled: loadingIndexingInfo, children: [_jsx(StyledLeftContent, { children: _jsx("span", { children: SDKUI_Localizator.IndexingInformation }) }), _jsx(StyledRightContent, { children: _jsx(StyledChevron, { "$isOpen": showIndexingInfo, children: "\u25BC" }) })] }), showIndexingInfo && indexingInfo && (_jsxs(StyledIndexingInfoBox, { children: [_jsx("div", { dangerouslySetInnerHTML: { __html: indexingInfo } }), loadingIndexingInfo && (_jsxs("div", { style: { position: 'absolute', top: '50%', left: '50%', transform: 'translate(-50%, -50%)', background: 'rgba(255, 255, 255, 0.9)', padding: '10px', borderRadius: '4px', boxShadow: '0 2px 8px rgba(0,0,0,0.15)' }, children: [SDKUI_Localizator.Loading, "..."] }))] }))] })] }));
|
|
660
660
|
}, [selectedSearchResult, focusedItem, indexingInfo, showIndexingInfo, loadingIndexingInfo]);
|
|
661
|
+
const isBoardDisabled = useMemo(() => fromDTD?.hasBlog !== 1, [fromDTD?.hasBlog]);
|
|
661
662
|
const allInitialPanelVisibility = {
|
|
662
663
|
'tmSearchResult': true,
|
|
663
664
|
'tmBlog': false,
|
|
@@ -726,9 +727,9 @@ handleNavigateToWGs, handleNavigateToDossiers, }) => {
|
|
|
726
727
|
width: '100%',
|
|
727
728
|
height: '100%',
|
|
728
729
|
}, children: _jsx(TMLayoutWaitingContainer, { direction: 'vertical', showWaitPanel: showWaitPanel, showWaitPanelPrimary: showPrimary, showWaitPanelSecondary: showSecondary, waitPanelTitle: waitPanelTitle, waitPanelTextPrimary: waitPanelTextPrimary, waitPanelValuePrimary: waitPanelValuePrimary, waitPanelMaxValuePrimary: waitPanelMaxValuePrimary, waitPanelTextSecondary: waitPanelTextSecondary, waitPanelValueSecondary: waitPanelValueSecondary, waitPanelMaxValueSecondary: waitPanelMaxValueSecondary, isCancelable: true, abortController: abortController, children: _jsx(TMLayoutWaitingContainer, { direction: 'vertical', showWaitPanel: showCicoWaitPanel, showWaitPanelPrimary: showCicoPrimaryProgress, waitPanelTitle: cicoWaitPanelTitle, waitPanelTextPrimary: cicoPrimaryProgressText, waitPanelValuePrimary: cicoPrimaryProgressValue, waitPanelMaxValuePrimary: cicoPrimaryProgressMax, isCancelable: true, abortController: abortControllerLocal, children: (groupId && groupId.length > 0) ?
|
|
729
|
-
_jsx(TMPanelManagerContainer, { panels: initialPanels, direction: "horizontal", parentId: groupId, showToolbar: showSearchResultSidebar })
|
|
730
|
+
_jsxs(_Fragment, { children: [_jsx(PanelDisabledStateHandler, { isBoardDisabled: isBoardDisabled }), _jsx(TMPanelManagerContainer, { panels: initialPanels, direction: "horizontal", parentId: groupId, showToolbar: showSearchResultSidebar })] })
|
|
730
731
|
:
|
|
731
|
-
|
|
732
|
+
_jsxs(TMPanelManagerProvider, { panels: initialPanels, initialVisibility: allInitialPanelVisibility, defaultDimensions: initialPanelDimensions, initialDimensions: initialPanelDimensions, initialMobilePanelId: 'tmSearchResult', children: [_jsx(PanelDisabledStateHandler, { isBoardDisabled: isBoardDisabled }), _jsx(TMPanelManagerContainer, { panels: initialPanels, direction: "horizontal", parentId: groupId, showToolbar: showSearchResultSidebar })] }) }) }) }), renderDcmtOperations] }));
|
|
732
733
|
};
|
|
733
734
|
export default TMSearchResult;
|
|
734
735
|
const TMSearchResultGrid = ({ openInOffice, fromDTD, operationItems, allUsers, inputFocusedItem, allowMultipleSelection = true, showExportForm = false, onFocusedItemChanged, onDownloadDcmtsAsync, onVisibleItemChanged, inputSelectedItems = [], lastUpdateSearchTime, searchResult, onSelectionChanged, onDblClick, showSearchTMDatagrid, updateDataColumnsFromDataGrid, updateDataSourceFromDataGrid, updateSelectedRowKeysFromDataGrid }) => {
|
|
@@ -1238,6 +1239,18 @@ const TMSearchResultSelector = ({ searchResults = [], disableAccordionIfSingleCa
|
|
|
1238
1239
|
return (_jsx(TMAccordionNew, { groups: accordionGroups, selectedItem: selectedResult, onSelectedItemChange: (result) => handleSelect(result) }));
|
|
1239
1240
|
};
|
|
1240
1241
|
//#endregion TMSearchResultSelector
|
|
1242
|
+
const PanelDisabledStateHandler = ({ isBoardDisabled }) => {
|
|
1243
|
+
const { setPanelVisibilityById, setToolbarButtonDisabled, panelVisibility } = useTMPanelManagerContext();
|
|
1244
|
+
useEffect(() => {
|
|
1245
|
+
// Aggiorna lo stato disabled del bottone toolbar
|
|
1246
|
+
setToolbarButtonDisabled('tmBlog', isBoardDisabled);
|
|
1247
|
+
// Chiude il pannello solo se è attualmente visibile e deve essere disabilitato
|
|
1248
|
+
if (isBoardDisabled && panelVisibility['tmBlog']) {
|
|
1249
|
+
setPanelVisibilityById('tmBlog', false);
|
|
1250
|
+
}
|
|
1251
|
+
}, [isBoardDisabled, setPanelVisibilityById, setToolbarButtonDisabled, panelVisibility]);
|
|
1252
|
+
return null;
|
|
1253
|
+
};
|
|
1241
1254
|
const TMDcmtPreviewWrapper = ({ refreshPreviewTrigger, currentDcmt, isVisible }) => {
|
|
1242
1255
|
const { setPanelVisibilityById, toggleMaximize, isResizingActive, countVisibleLeafPanels } = useTMPanelManagerContext();
|
|
1243
1256
|
const deviceType = useDeviceType();
|
|
@@ -87,6 +87,12 @@ const TMViewHistoryDcmt = (props) => {
|
|
|
87
87
|
IsSigned: row.IsSigned ? row.IsSigned.toString() === '1' : false,
|
|
88
88
|
};
|
|
89
89
|
});
|
|
90
|
+
// Sort by LastUpdateTime ascending
|
|
91
|
+
historyFileItems.sort((a, b) => {
|
|
92
|
+
const dateA = a.LastUpdateTime ? new Date(a.LastUpdateTime).getTime() : 0;
|
|
93
|
+
const dateB = b.LastUpdateTime ? new Date(b.LastUpdateTime).getTime() : 0;
|
|
94
|
+
return dateA - dateB;
|
|
95
|
+
});
|
|
90
96
|
return historyFileItems;
|
|
91
97
|
}
|
|
92
98
|
return [];
|
|
@@ -70,7 +70,11 @@ const ButtonsContainer = styled.div `
|
|
|
70
70
|
`;
|
|
71
71
|
const SET_RULE_DATASOURCE = [
|
|
72
72
|
{ value: WorkItemSetRules.Ands_AND_Ors, display: "Ands_AND_Ors" },
|
|
73
|
-
{ value: WorkItemSetRules.Ands_OR_Ors, display: "Ands_OR_Ors" }
|
|
73
|
+
{ value: WorkItemSetRules.Ands_OR_Ors, display: "Ands_OR_Ors" },
|
|
74
|
+
{ value: WorkItemSetRules.Ands_AND_Ors_AssignModeOrs, display: "Ands_AND_Ors_AssignModeOrs" },
|
|
75
|
+
{ value: WorkItemSetRules.Ands_OR_Ors_AssignModeOrs, display: "Ands_OR_Ors_AssignModeOrs" },
|
|
76
|
+
{ value: WorkItemSetRules.Ands_AND_Ors_WaitForAllAnds, display: "Ands_AND_Ors_WaitForAllAnds" },
|
|
77
|
+
{ value: WorkItemSetRules.Ands_OR_Ors_WaitForAllAnds, display: "Ands_OR_Ors_WaitForAllAnds" }
|
|
74
78
|
];
|
|
75
79
|
const SEVERITY_DATASOURCE = [
|
|
76
80
|
{ value: Severities.Critical, display: "Critical" },
|
|
@@ -341,6 +341,7 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, allowEdit = true, onDiagram
|
|
|
341
341
|
const isUndoingRedoing = useRef(false);
|
|
342
342
|
const initialDiagramRef = useRef(null);
|
|
343
343
|
const notifiedXmlRef = useRef(null);
|
|
344
|
+
const serializationGenRef = useRef(0);
|
|
344
345
|
const svgRef = useRef(null);
|
|
345
346
|
const containerRef = useRef(null);
|
|
346
347
|
const [isDrawingConnection, setIsDrawingConnection] = useState(false);
|
|
@@ -430,10 +431,15 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, allowEdit = true, onDiagram
|
|
|
430
431
|
setHistoryIndex(newHistory.length);
|
|
431
432
|
}
|
|
432
433
|
setWfDiagram(newDiagram);
|
|
434
|
+
const currentGen = ++serializationGenRef.current;
|
|
433
435
|
(async () => {
|
|
434
436
|
try {
|
|
435
437
|
// await è necessario per attendere il risultato stringa
|
|
436
438
|
const newXml = await serializeWfDiagramToXml(newDiagram);
|
|
439
|
+
// Ignora serializzazioni obsolete: se nel frattempo è partita una nuova serializzazione,
|
|
440
|
+
// questa è vecchia e non deve sovrascrivere il risultato più recente.
|
|
441
|
+
if (currentGen !== serializationGenRef.current)
|
|
442
|
+
return;
|
|
437
443
|
notifiedXmlRef.current = newXml;
|
|
438
444
|
// Chiama il callback per notificare TMWFEditor
|
|
439
445
|
// L'invio dell'XML al genitore avviene solo a serializzazione completata.
|
|
@@ -449,7 +455,7 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, allowEdit = true, onDiagram
|
|
|
449
455
|
catch (e) {
|
|
450
456
|
TMExceptionBoxManager.show({ exception: e });
|
|
451
457
|
}
|
|
452
|
-
}, [wfDiagramHistory, historyIndex, isUndoingRedoing, setWfDiagramHistory, setHistoryIndex, setWfDiagram, isReadOnly]);
|
|
458
|
+
}, [wfDiagramHistory, historyIndex, isUndoingRedoing, setWfDiagramHistory, setHistoryIndex, setWfDiagram, isReadOnly, onDiagramChange]);
|
|
453
459
|
const handleUndo = useCallback(() => {
|
|
454
460
|
if (isReadOnly)
|
|
455
461
|
return;
|
|
@@ -67,14 +67,13 @@ export const getSeveritiesNumber = (severity) => {
|
|
|
67
67
|
};
|
|
68
68
|
export const getWorkItemSetRulesNumber = (setRule) => {
|
|
69
69
|
switch (setRule) {
|
|
70
|
-
case WorkItemSetRules.Ands_AND_Ors:
|
|
71
|
-
|
|
72
|
-
case WorkItemSetRules.
|
|
73
|
-
|
|
74
|
-
case WorkItemSetRules.
|
|
75
|
-
|
|
76
|
-
default:
|
|
77
|
-
return 0;
|
|
70
|
+
case WorkItemSetRules.Ands_AND_Ors: return 0;
|
|
71
|
+
case WorkItemSetRules.Ands_OR_Ors: return 1;
|
|
72
|
+
case WorkItemSetRules.Ands_AND_Ors_AssignModeOrs: return 2;
|
|
73
|
+
case WorkItemSetRules.Ands_OR_Ors_AssignModeOrs: return 3;
|
|
74
|
+
case WorkItemSetRules.Ands_AND_Ors_WaitForAllAnds: return 4;
|
|
75
|
+
case WorkItemSetRules.Ands_OR_Ors_WaitForAllAnds: return 5;
|
|
76
|
+
default: return 0;
|
|
78
77
|
}
|
|
79
78
|
};
|
|
80
79
|
export const getWFAppTypesNumber = (appType) => {
|
|
@@ -147,12 +146,12 @@ const mapSeverity = (severityValue) => {
|
|
|
147
146
|
// Funzione helper per mappare i valori numerici di WorkItemSetRules
|
|
148
147
|
const mapWorkItemSetRules = (ruleValue) => {
|
|
149
148
|
switch (ruleValue) {
|
|
150
|
-
case 0:
|
|
151
|
-
|
|
152
|
-
case
|
|
153
|
-
|
|
154
|
-
case
|
|
155
|
-
|
|
149
|
+
case 0: return WorkItemSetRules.Ands_AND_Ors;
|
|
150
|
+
case 1: return WorkItemSetRules.Ands_OR_Ors;
|
|
151
|
+
case 2: return WorkItemSetRules.Ands_AND_Ors_AssignModeOrs;
|
|
152
|
+
case 3: return WorkItemSetRules.Ands_OR_Ors_AssignModeOrs;
|
|
153
|
+
case 4: return WorkItemSetRules.Ands_AND_Ors_WaitForAllAnds;
|
|
154
|
+
case 5: return WorkItemSetRules.Ands_OR_Ors_WaitForAllAnds;
|
|
156
155
|
default:
|
|
157
156
|
console.warn(`Valore WorkItemSetRules sconosciuto: ${ruleValue}. Ritorno WorkItemSetRules.Ands_AND_Ors.`);
|
|
158
157
|
return WorkItemSetRules.Ands_AND_Ors;
|