@topconsultnpm/sdkui-react 6.20.0 → 6.21.0-dev1.3
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/FloatingMenuBar/TMFloatingMenuBar.js +7 -1
- package/lib/components/base/TMTreeView.d.ts +2 -1
- package/lib/components/base/TMTreeView.js +8 -3
- package/lib/components/base/TMWaitPanel.js +6 -5
- package/lib/components/features/archive/TMArchive.d.ts +1 -1
- package/lib/components/features/archive/TMArchive.js +2 -2
- package/lib/components/features/documents/TMDcmtBlog.d.ts +1 -0
- package/lib/components/features/documents/TMDcmtBlog.js +2 -1
- package/lib/components/features/documents/TMDcmtForm.d.ts +42 -34
- package/lib/components/features/documents/TMDcmtForm.js +280 -639
- package/lib/components/features/documents/TMDcmtFormActionButtons.d.ts +34 -0
- package/lib/components/features/documents/TMDcmtFormActionButtons.js +124 -0
- package/lib/components/features/documents/TMMasterDetailDcmts.d.ts +27 -2
- package/lib/components/features/documents/TMMasterDetailDcmts.js +160 -18
- package/lib/components/features/documents/TMRelationViewer.d.ts +6 -0
- package/lib/components/features/documents/TMRelationViewer.js +7 -5
- package/lib/components/features/search/TMSearch.d.ts +2 -2
- package/lib/components/features/search/TMSearch.js +3 -3
- package/lib/components/features/search/TMSearchResult.d.ts +27 -26
- package/lib/components/features/search/TMSearchResult.js +349 -486
- package/lib/components/features/tasks/TMTaskForm.d.ts +2 -1
- package/lib/components/features/tasks/TMTaskForm.js +2 -2
- package/lib/helper/checkinCheckoutManager.js +6 -2
- package/lib/hooks/useCheckInOutOperations.d.ts +7 -6
- package/lib/hooks/useCheckInOutOperations.js +9 -16
- package/lib/hooks/useDcmtOperations.d.ts +3 -2
- package/lib/hooks/useDcmtOperations.js +2 -2
- package/lib/hooks/useDocumentOperations.d.ts +139 -0
- package/lib/hooks/useDocumentOperations.js +1309 -0
- package/lib/hooks/useRelatedDocuments.d.ts +1 -1
- package/lib/ts/types.d.ts +2 -1
- package/lib/ts/types.js +1 -0
- package/package.json +55 -55
- package/lib/components/features/search/TMSearchResultsMenuItems.d.ts +0 -11
- package/lib/components/features/search/TMSearchResultsMenuItems.js +0 -758
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { DcmtTypeDescriptor, TaskDescriptor, ObjectRef } from "@topconsultnpm/sdk-ts";
|
|
3
|
+
import { IWorkItemData } from "../../../ts";
|
|
4
|
+
import { DeviceType } from "../../base/TMDeviceProvider";
|
|
5
|
+
interface TMDcmtFormActionButtonsProps {
|
|
6
|
+
showToppyForApprove: boolean;
|
|
7
|
+
workItems: Array<IWorkItemData>;
|
|
8
|
+
deviceType: DeviceType | undefined;
|
|
9
|
+
isMobile: boolean;
|
|
10
|
+
handleSignApprove: () => void;
|
|
11
|
+
updateShowApprovePopup: (value: boolean) => void;
|
|
12
|
+
updateShowRejectPopup: (value: boolean) => void;
|
|
13
|
+
updateShowReAssignPopup: (value: boolean) => void;
|
|
14
|
+
updateShowMoreInfoPopup: (value: boolean) => void;
|
|
15
|
+
fromDTD: DcmtTypeDescriptor | undefined;
|
|
16
|
+
showToppyForCompleteMoreInfo: boolean;
|
|
17
|
+
moreInfoTasks?: Array<TaskDescriptor>;
|
|
18
|
+
setShowCommentForm: React.Dispatch<React.SetStateAction<boolean>>;
|
|
19
|
+
showToppyForReferences: boolean;
|
|
20
|
+
dcmtReferences: ObjectRef[] | undefined;
|
|
21
|
+
referenceActionMap: {
|
|
22
|
+
Dossier: {
|
|
23
|
+
label: string;
|
|
24
|
+
};
|
|
25
|
+
WorkingGroup: {
|
|
26
|
+
label: string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
handleNavigateToReference: (ref: ObjectRef) => void;
|
|
30
|
+
setShowMoreInfoTaskPopup: React.Dispatch<React.SetStateAction<boolean>>;
|
|
31
|
+
setShowMoreInfoTaskTask: React.Dispatch<React.SetStateAction<TaskDescriptor | undefined>>;
|
|
32
|
+
}
|
|
33
|
+
declare const TMDcmtFormActionButtons: (props: TMDcmtFormActionButtonsProps) => import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
export default TMDcmtFormActionButtons;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo, useRef } from "react";
|
|
3
|
+
import { ObjectClasses, SDK_Globals } from "@topconsultnpm/sdk-ts";
|
|
4
|
+
import { TASK_MORE_INFO_PREFIX_NAME, SDKUI_Localizator, PDGS_COLORS } from "../../../helper";
|
|
5
|
+
import { TMColors } from "../../../utils/theme";
|
|
6
|
+
import { ReferencesContainer, StyledReferenceButton } from "../../base/Styled";
|
|
7
|
+
import TMButton from "../../base/TMButton";
|
|
8
|
+
import TMTooltip from "../../base/TMTooltip";
|
|
9
|
+
import { WorkFlowOperationButtons } from "../workflow/TMWorkflowPopup";
|
|
10
|
+
const TMDcmtFormActionButtons = (props) => {
|
|
11
|
+
const { showToppyForApprove, workItems, deviceType, isMobile, handleSignApprove, updateShowApprovePopup, updateShowRejectPopup, updateShowReAssignPopup, updateShowMoreInfoPopup, fromDTD, showToppyForCompleteMoreInfo, moreInfoTasks, setShowCommentForm, showToppyForReferences, dcmtReferences, referenceActionMap, handleNavigateToReference, setShowMoreInfoTaskPopup, setShowMoreInfoTaskTask } = props;
|
|
12
|
+
const tasksNumber = useMemo(() => moreInfoTasks?.length ?? 0, [moreInfoTasks]);
|
|
13
|
+
const currentTask = useMemo(() => {
|
|
14
|
+
if (!moreInfoTasks || moreInfoTasks.length === 0)
|
|
15
|
+
return null;
|
|
16
|
+
if (moreInfoTasks.length === 1)
|
|
17
|
+
return moreInfoTasks[0];
|
|
18
|
+
// If there are multiple tasks, we cannot determine which one is relevant, so we return null
|
|
19
|
+
return null;
|
|
20
|
+
}, [moreInfoTasks]);
|
|
21
|
+
const { hasMoreInfo, hasApprove, hasReferences } = useMemo(() => {
|
|
22
|
+
const referencesExist = showToppyForReferences && dcmtReferences?.some(ref => ref.objClass === ObjectClasses.Dossier || ref.objClass === ObjectClasses.WorkingGroup);
|
|
23
|
+
return {
|
|
24
|
+
hasMoreInfo: Boolean(showToppyForCompleteMoreInfo),
|
|
25
|
+
hasApprove: Boolean(showToppyForApprove),
|
|
26
|
+
hasReferences: Boolean(referencesExist)
|
|
27
|
+
};
|
|
28
|
+
}, [
|
|
29
|
+
showToppyForCompleteMoreInfo,
|
|
30
|
+
showToppyForApprove,
|
|
31
|
+
showToppyForReferences,
|
|
32
|
+
dcmtReferences
|
|
33
|
+
]);
|
|
34
|
+
const Divider = () => (_jsx("div", { style: { height: '1px', width: '100%', background: 'linear-gradient(to right, transparent, rgba(255,255,255,0.4), transparent)', margin: '3px 0', opacity: 0.8, } }));
|
|
35
|
+
return _jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '10px' }, children: [hasMoreInfo && (tasksNumber === 1 ? (_jsx("div", { style: { display: 'flex', gap: "10px", flexDirection: 'column', alignItems: 'center' }, children: _jsx("div", { style: {
|
|
36
|
+
padding: '10px',
|
|
37
|
+
color: '#FFFFFF',
|
|
38
|
+
maxWidth: '240px',
|
|
39
|
+
background: 'linear-gradient(135deg, #1E90FF 0%, #0077BE 60%, #00509E 100%)',
|
|
40
|
+
border: '1px solid rgba(255,255,255,0.15)',
|
|
41
|
+
boxShadow: '0 8px 20px rgba(0, 0, 50, 0.4)',
|
|
42
|
+
backdropFilter: 'blur(6px)',
|
|
43
|
+
display: 'flex',
|
|
44
|
+
flexDirection: 'column',
|
|
45
|
+
alignItems: 'center',
|
|
46
|
+
textAlign: 'center',
|
|
47
|
+
gap: '10px',
|
|
48
|
+
cursor: 'default',
|
|
49
|
+
}, children: (() => {
|
|
50
|
+
const userID = SDK_Globals.tmSession?.SessionDescr?.userID;
|
|
51
|
+
const isSender = currentTask?.fromID !== undefined && currentTask.fromID === userID;
|
|
52
|
+
const isRecipient = currentTask?.toID !== undefined && currentTask.toID === userID;
|
|
53
|
+
const truncate = (str, maxLength) => str && str.length > maxLength ? str.substring(0, maxLength) + '...' : str;
|
|
54
|
+
const senderNameTruncated = currentTask?.fromName ? truncate(currentTask.fromName, 30) : 'N/A';
|
|
55
|
+
const recipientNameTruncated = currentTask?.toName ? truncate(currentTask.toName, 30) : 'N/A';
|
|
56
|
+
const taskNameTrunc = currentTask?.name ? truncate(currentTask.name.replace(TASK_MORE_INFO_PREFIX_NAME ?? '', ''), 30) : 'N/A';
|
|
57
|
+
return (_jsxs(_Fragment, { children: [(isSender && !isRecipient) && (_jsx(TaskLink, { messagePrefix: `Hai richiesto maggiori informazioni a "${recipientNameTruncated}" tramite l'attività`, name: currentTask.name ?? 'N/A', taskNameTrunc: taskNameTrunc ?? 'N/A', description: currentTask.description ?? 'N/A', currentTask: currentTask, setShowMoreInfoTaskPopup: setShowMoreInfoTaskPopup, setShowMoreInfoTaskTask: setShowMoreInfoTaskTask })), (isRecipient && !isSender) && (_jsxs("div", { style: {
|
|
58
|
+
display: 'flex',
|
|
59
|
+
flexDirection: 'column',
|
|
60
|
+
alignItems: 'center',
|
|
61
|
+
gap: '10px'
|
|
62
|
+
}, children: [_jsx(TaskLink, { messagePrefix: `"${senderNameTruncated}" ti ha richiesto maggiori informazioni tramite l'attività`, name: currentTask.name ?? 'N/A', taskNameTrunc: taskNameTrunc ?? 'N/A', description: currentTask.description ?? 'N/A', currentTask: currentTask, setShowMoreInfoTaskPopup: setShowMoreInfoTaskPopup, setShowMoreInfoTaskTask: setShowMoreInfoTaskTask }), _jsx(TMButton, { btnStyle: isMobile ? 'toolbar' : 'advanced', showTooltip: isMobile, icon: _jsx("span", { className: "dx-icon-chat" }), caption: SDKUI_Localizator.CommentAndComplete, width: "180px", disabled: false, onClick: () => setShowCommentForm(true), onMouseDown: e => e.stopPropagation(), advancedColor: TMColors.success, color: "success" })] }))] }));
|
|
63
|
+
})() }) })) : (_jsx("div", { style: {
|
|
64
|
+
padding: '10px',
|
|
65
|
+
color: '#FFFFFF',
|
|
66
|
+
maxWidth: '240px',
|
|
67
|
+
background: 'linear-gradient(135deg, #1E90FF 0%, #0077BE 60%, #00509E 100%)',
|
|
68
|
+
border: '1px solid rgba(255,255,255,0.15)',
|
|
69
|
+
boxShadow: '0 8px 20px rgba(0, 0, 50, 0.4)',
|
|
70
|
+
backdropFilter: 'blur(6px)',
|
|
71
|
+
display: 'flex',
|
|
72
|
+
flexDirection: 'column',
|
|
73
|
+
alignItems: 'center',
|
|
74
|
+
textAlign: 'center',
|
|
75
|
+
gap: '10px',
|
|
76
|
+
cursor: 'default',
|
|
77
|
+
}, children: `Ci sono ${moreInfoTasks?.length ?? 0} richieste di maggiori informazioni. ${SDKUI_Localizator.ManageFromTaskPanel}` }))), hasMoreInfo && hasApprove && _jsx(Divider, {}), hasApprove && (workItems.length === 1 ?
|
|
78
|
+
_jsx(WorkFlowOperationButtons, { dtd: fromDTD, deviceType: deviceType, onApprove: () => updateShowApprovePopup(true), onSignApprove: handleSignApprove, onReject: () => updateShowRejectPopup(true), onReAssign: () => updateShowReAssignPopup(true), onMoreInfo: () => updateShowMoreInfoPopup(true) })
|
|
79
|
+
:
|
|
80
|
+
_jsxs("div", { style: { padding: 10, color: 'white', maxWidth: '180px', borderRadius: 10, background: '#1B1464 0% 0% no-repeat padding-box', border: '1px solid #FFFFFF' }, children: [`Questo documento è associato a ${workItems.length} workitem.`, _jsx("br", {}), `Per approvare, vai alla pagina "Approvazione workflow".`] })), (hasApprove && hasReferences) || (hasMoreInfo && !hasApprove && hasReferences) ? (_jsx(Divider, {})) : null, hasReferences && (_jsx(ReferencesContainer, { children: dcmtReferences?.filter(ref => ref.objClass === ObjectClasses.Dossier || ref.objClass === ObjectClasses.WorkingGroup)
|
|
81
|
+
.map((ref, index) => {
|
|
82
|
+
const mapEntry = referenceActionMap[String(ref.objClass)];
|
|
83
|
+
const label = mapEntry?.label ?? 'Vai a riferimento';
|
|
84
|
+
let backgroundColor;
|
|
85
|
+
switch (ref.objClass) {
|
|
86
|
+
case ObjectClasses.WorkingGroup:
|
|
87
|
+
backgroundColor = PDGS_COLORS.WORKING_GROUP;
|
|
88
|
+
break;
|
|
89
|
+
case ObjectClasses.Dossier:
|
|
90
|
+
backgroundColor = PDGS_COLORS.DOSSIER;
|
|
91
|
+
break;
|
|
92
|
+
case ObjectClasses.Document:
|
|
93
|
+
backgroundColor = PDGS_COLORS.DOCUMENT;
|
|
94
|
+
break;
|
|
95
|
+
default:
|
|
96
|
+
backgroundColor = "#C2388B";
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
return (_jsxs(StyledReferenceButton, { onClick: () => handleNavigateToReference(ref), onDoubleClick: (e) => { e.preventDefault(); e.stopPropagation(); }, "$bgColor": backgroundColor, children: [_jsx("span", { children: label }), _jsx("span", { children: `"${ref.objName}"` })] }, `ref-${index}-${ref.objID}`));
|
|
100
|
+
}) }))] });
|
|
101
|
+
};
|
|
102
|
+
export default TMDcmtFormActionButtons;
|
|
103
|
+
const TaskLink = (props) => {
|
|
104
|
+
const { messagePrefix, name, taskNameTrunc, description, currentTask, setShowMoreInfoTaskPopup, setShowMoreInfoTaskTask } = props;
|
|
105
|
+
const mouseMoved = useRef(false);
|
|
106
|
+
const handleMouseDown = () => {
|
|
107
|
+
mouseMoved.current = false;
|
|
108
|
+
};
|
|
109
|
+
const handleMouseMove = () => {
|
|
110
|
+
mouseMoved.current = true;
|
|
111
|
+
};
|
|
112
|
+
return (_jsx(_Fragment, { children: _jsx("div", { style: { display: 'inline-flex', alignItems: 'center', gap: '4px' }, children: _jsxs("div", { onMouseDown: handleMouseDown, onMouseMove: handleMouseMove, style: { display: 'inline' }, children: [messagePrefix, ' "', _jsx("span", { style: {
|
|
113
|
+
cursor: 'pointer',
|
|
114
|
+
fontWeight: 500,
|
|
115
|
+
textDecoration: 'none',
|
|
116
|
+
transition: 'text-decoration 0.2s',
|
|
117
|
+
}, onClick: () => {
|
|
118
|
+
setShowMoreInfoTaskPopup(true);
|
|
119
|
+
setShowMoreInfoTaskTask(currentTask);
|
|
120
|
+
}, onMouseEnter: e => e.currentTarget.style.textDecoration = 'underline', onMouseLeave: e => e.currentTarget.style.textDecoration = 'none', children: taskNameTrunc }), '" ', _jsx(TMTooltip, { parentStyle: { display: 'inline' }, childStyle: { display: 'inline' }, content: _jsxs("div", { style: { whiteSpace: 'pre-line', textAlign: 'left' }, children: [_jsxs("div", { children: [_jsx("b", { children: SDKUI_Localizator.Name }), ": ", name] }), _jsxs("div", { children: [_jsx("b", { children: SDKUI_Localizator.Description }), ": ", description] })] }), children: _jsx("i", { className: "dx-icon dx-icon-info", onClick: () => {
|
|
121
|
+
setShowMoreInfoTaskPopup(true);
|
|
122
|
+
setShowMoreInfoTaskTask(currentTask);
|
|
123
|
+
}, style: { fontSize: '16px', lineHeight: 1, cursor: 'pointer' } }) })] }) }) }));
|
|
124
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { HomeBlogPost, TaskDescriptor } from '@topconsultnpm/sdk-ts';
|
|
3
|
-
import { DcmtInfo, TaskContext } from '../../../ts';
|
|
2
|
+
import { HomeBlogPost, SearchResultDescriptor, TaskDescriptor } from '@topconsultnpm/sdk-ts';
|
|
3
|
+
import { DcmtInfo, TaskContext, MetadataValueDescriptorEx } from '../../../ts';
|
|
4
4
|
import { DeviceContextProps } from '../../base/TMDeviceProvider';
|
|
5
5
|
interface ITMMasterDetailDcmtsProps extends DeviceContextProps {
|
|
6
6
|
allTasks?: Array<TaskDescriptor>;
|
|
@@ -21,6 +21,31 @@ interface ITMMasterDetailDcmtsProps extends DeviceContextProps {
|
|
|
21
21
|
onBack?: () => void;
|
|
22
22
|
appendMasterDcmts?: (tid: number | undefined, did: number | undefined) => void;
|
|
23
23
|
onTaskCreateRequest?: (taskContext: TaskContext, onTaskCreated?: (task?: TaskDescriptor) => void) => void;
|
|
24
|
+
onRefreshAfterAddDcmtToFavs?: () => void;
|
|
25
|
+
editPdfForm?: boolean;
|
|
26
|
+
openS4TViewer?: boolean;
|
|
27
|
+
onOpenS4TViewerRequest?: (dcmtInfo: Array<DcmtInfo>, refreshDocumentPreview?: (() => Promise<void>)) => void;
|
|
28
|
+
onOpenPdfEditorRequest?: ((dcmtInfo: Array<DcmtInfo>, refreshDocumentPreview?: () => Promise<void>) => void);
|
|
29
|
+
datagridUtility?: {
|
|
30
|
+
onRefreshSearchAsyncDatagrid?: () => Promise<void>;
|
|
31
|
+
onRefreshDataRowsAsync?: (() => Promise<void>);
|
|
32
|
+
refreshFocusedDataRowAsync?: (tid: number | undefined, did: number | undefined, refreshUI?: boolean, metadataResult?: SearchResultDescriptor | null) => Promise<void>;
|
|
33
|
+
onRefreshBlogDatagrid?: () => Promise<void>;
|
|
34
|
+
onRefreshPreviewDatagrid?: () => Promise<void>;
|
|
35
|
+
};
|
|
36
|
+
dcmtUtility?: {
|
|
37
|
+
approvalVID?: number;
|
|
38
|
+
dcmtDataRowForCicoStatus?: Array<MetadataValueDescriptorEx> | any;
|
|
39
|
+
selectedDcmtSearchResultRelations?: SearchResultDescriptor;
|
|
40
|
+
dcmtTIDHasDetailRelations?: boolean;
|
|
41
|
+
dcmtTIDHasMasterRelations?: boolean;
|
|
42
|
+
updateCurrentDcmt?: () => Promise<void>;
|
|
43
|
+
onCloseDcmtForm?: () => void;
|
|
44
|
+
onRefreshBlogForm?: () => Promise<void>;
|
|
45
|
+
onRefreshPreviewForm?: () => Promise<void>;
|
|
46
|
+
taskFormDialogComponent?: React.ReactNode;
|
|
47
|
+
s4TViewerDialogComponent?: React.ReactNode;
|
|
48
|
+
};
|
|
24
49
|
}
|
|
25
50
|
declare const TMMasterDetailDcmts: React.FC<ITMMasterDetailDcmtsProps>;
|
|
26
51
|
export default TMMasterDetailDcmts;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
3
|
-
import { DcmtTypeListCacheService, SDK_Localizator } from '@topconsultnpm/sdk-ts';
|
|
2
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
|
+
import { DcmtTypeListCacheService, LayoutModes, 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 } from '../../../helper';
|
|
6
|
+
import { IconMultipleSelection, IconCheckFile, IconDetailDcmts, SDKUI_Localizator, IconMenuVertical, IconDataList, IconPreview, IconSearchCheck, IconBoard, IconDcmtTypeSys, IconShow, getMoreInfoTasksForDocument, isApprovalWorkflowView } from '../../../helper';
|
|
7
7
|
import { FormModes, SearchResultContext } from '../../../ts';
|
|
8
8
|
import { TMColors } from '../../../utils/theme';
|
|
9
9
|
import ShowAlert from '../../base/TMAlert';
|
|
@@ -15,7 +15,9 @@ import TMSearchResult from '../search/TMSearchResult';
|
|
|
15
15
|
import TMDcmtForm from './TMDcmtForm';
|
|
16
16
|
import { TMNothingToShow } from './TMDcmtPreview';
|
|
17
17
|
import { Spinner } 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 }) => {
|
|
20
|
+
const floatingBarContainerRef = useRef(null);
|
|
19
21
|
const [focusedItem, setFocusedItem] = useState();
|
|
20
22
|
const [selectedItems, setSelectedItems] = useState([]);
|
|
21
23
|
const [showZeroDcmts, setShowZeroDcmts] = useState(false);
|
|
@@ -23,6 +25,121 @@ const TMMasterDetailDcmts = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallba
|
|
|
23
25
|
const [dtdMaster, setDtdMaster] = useState();
|
|
24
26
|
const [noRelationsOnFirstLoad, setNoRelationsOnFirstLoad] = useState(false);
|
|
25
27
|
const [isCheckingFirstLoad, setIsCheckingFirstLoad] = useState(true);
|
|
28
|
+
const [contextMenuVisible, setContextMenuVisible] = useState(false);
|
|
29
|
+
const [contextMenuPosition, setContextMenuPosition] = useState({ x: 0, y: 0 });
|
|
30
|
+
const [dtdFocused, setDtdFocused] = useState();
|
|
31
|
+
const [refreshKey, setRefreshKey] = useState(0);
|
|
32
|
+
const onRefreshSearch = async () => {
|
|
33
|
+
await dcmtUtility?.onRefreshPreviewForm?.();
|
|
34
|
+
// forza il refresh del form di dettaglio al salvataggio
|
|
35
|
+
setRefreshKey(prev => prev + 1);
|
|
36
|
+
};
|
|
37
|
+
// Load dtdFocused when focusedItem changes
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
const loadDtdFocused = async () => {
|
|
40
|
+
if (!focusedItem?.tid) {
|
|
41
|
+
setDtdFocused(undefined);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const dtd = await DcmtTypeListCacheService.GetAsync(focusedItem.tid);
|
|
45
|
+
setDtdFocused(dtd);
|
|
46
|
+
};
|
|
47
|
+
loadDtdFocused();
|
|
48
|
+
}, [focusedItem?.tid]);
|
|
49
|
+
const openTaskFormHandler = (onTaskCreated) => {
|
|
50
|
+
if (selectedItems.length > 1)
|
|
51
|
+
return;
|
|
52
|
+
const item = selectedItems.length === 1 ? selectedItems[0] : focusedItem;
|
|
53
|
+
if (item && item.tid && item.did) {
|
|
54
|
+
const createTaskFromDocumentOrWorkItem = async () => {
|
|
55
|
+
try {
|
|
56
|
+
const dtd = await DcmtTypeListCacheService.GetWithNotGrantedAsync(item.tid, item?.did);
|
|
57
|
+
if (dtd) {
|
|
58
|
+
const isWorkItem = isApprovalWorkflowView(dtd);
|
|
59
|
+
if (item.tid === undefined || item.did === undefined) {
|
|
60
|
+
console.error("TID or DID is undefined for the selected item.");
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
const name = `${dtd.name ?? '-'} (DID: ${item.did})`;
|
|
64
|
+
onTaskCreateRequest?.(isWorkItem
|
|
65
|
+
? { workItem: { tid: item.tid, did: item.did, name } }
|
|
66
|
+
: { document: { tid: item.tid, did: item.did, name } }, onTaskCreated);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
console.error("Error fetching data:", error);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
createTaskFromDocumentOrWorkItem();
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
const { operationItems, renderFloatingBar, renderDcmtOperations, features } = useDocumentOperations({
|
|
77
|
+
context: SearchResultContext.MASTER_DETAIL,
|
|
78
|
+
documentData: {
|
|
79
|
+
dtd: dtdFocused,
|
|
80
|
+
selectedItems: selectedItems ? selectedItems.map(item => ({ TID: item.tid, DID: item.did, FILEEXT: item.fileExt })) : [],
|
|
81
|
+
focusedItem: focusedItem ? { TID: focusedItem.tid, DID: focusedItem.did, FILEEXT: focusedItem.fileExt } : undefined,
|
|
82
|
+
currentSearchResults: [],
|
|
83
|
+
currentMetadataValues: [],
|
|
84
|
+
allUsers: [],
|
|
85
|
+
// searchResult: selectedSearchResult,
|
|
86
|
+
datagridUtility,
|
|
87
|
+
dcmtUtility: {
|
|
88
|
+
approvalVID: dcmtUtility?.approvalVID,
|
|
89
|
+
dcmtDataRowForCicoStatus: dcmtUtility?.dcmtDataRowForCicoStatus,
|
|
90
|
+
selectedDcmtSearchResultRelations: dcmtUtility?.selectedDcmtSearchResultRelations,
|
|
91
|
+
dcmtTIDHasDetailRelations: dcmtUtility?.dcmtTIDHasDetailRelations,
|
|
92
|
+
dcmtTIDHasMasterRelations: dcmtUtility?.dcmtTIDHasMasterRelations,
|
|
93
|
+
updateCurrentDcmt: dcmtUtility?.updateCurrentDcmt,
|
|
94
|
+
onCloseDcmtForm: dcmtUtility?.onCloseDcmtForm,
|
|
95
|
+
onRefreshBlogForm: dcmtUtility?.onRefreshBlogForm,
|
|
96
|
+
onRefreshPreviewForm: onRefreshSearch,
|
|
97
|
+
taskFormDialogComponent: dcmtUtility?.taskFormDialogComponent,
|
|
98
|
+
s4TViewerDialogComponent: dcmtUtility?.s4TViewerDialogComponent
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
uiConfig: {
|
|
102
|
+
floatingBarContainerRef,
|
|
103
|
+
openS4TViewer,
|
|
104
|
+
showDcmtFormSidebar: true,
|
|
105
|
+
openDcmtFormAsModal: true,
|
|
106
|
+
allowFloatingBar: false,
|
|
107
|
+
enablePinIcons: false,
|
|
108
|
+
allowRelations: true,
|
|
109
|
+
inputDcmtFormLayoutMode: LayoutModes.Update,
|
|
110
|
+
},
|
|
111
|
+
tasks: {
|
|
112
|
+
allTasks: allTasks,
|
|
113
|
+
getAllTasks: getAllTasks,
|
|
114
|
+
deleteTaskByIdsCallback: deleteTaskByIdsCallback,
|
|
115
|
+
addTaskCallback: addTaskCallback,
|
|
116
|
+
editTaskCallback: editTaskCallback
|
|
117
|
+
},
|
|
118
|
+
callbacks: {
|
|
119
|
+
// Refresh operations (data consistency)
|
|
120
|
+
/* onSavedAsyncCallback, */
|
|
121
|
+
// Workflow operations
|
|
122
|
+
/* onWFOperationCompleted, */
|
|
123
|
+
// Navigation
|
|
124
|
+
/* canNavigateHandler,
|
|
125
|
+
onNavigateHandler, */
|
|
126
|
+
handleNavigateToWGs,
|
|
127
|
+
handleNavigateToDossiers,
|
|
128
|
+
/* onReferenceClick, */
|
|
129
|
+
// Document forms/operations
|
|
130
|
+
/* openAddDocumentForm,
|
|
131
|
+
openCommentFormCallback,
|
|
132
|
+
onFileOpened,
|
|
133
|
+
passToArchiveCallback,
|
|
134
|
+
openWGsCopyMoveForm, */
|
|
135
|
+
onOpenS4TViewerRequest,
|
|
136
|
+
onOpenPdfEditorRequest,
|
|
137
|
+
// Task related
|
|
138
|
+
onTaskCreateRequest,
|
|
139
|
+
openTaskFormHandler,
|
|
140
|
+
onRefreshAfterAddDcmtToFavs,
|
|
141
|
+
},
|
|
142
|
+
});
|
|
26
143
|
// Load dtdMaster when inputDcmts changes
|
|
27
144
|
useEffect(() => {
|
|
28
145
|
const loadDtdMaster = async () => {
|
|
@@ -53,6 +170,12 @@ const TMMasterDetailDcmts = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallba
|
|
|
53
170
|
setNoRelationsOnFirstLoad(true);
|
|
54
171
|
}
|
|
55
172
|
}, [isCheckingFirstLoad]);
|
|
173
|
+
const onItemContextMenu = useCallback((item, e) => {
|
|
174
|
+
if (!item.isDcmt)
|
|
175
|
+
return; // Show context menu only for document items
|
|
176
|
+
setContextMenuPosition({ x: e.clientX, y: e.clientY });
|
|
177
|
+
setContextMenuVisible(true);
|
|
178
|
+
}, []);
|
|
56
179
|
// Show warning alert and navigate back when no relations found on first load
|
|
57
180
|
useEffect(() => {
|
|
58
181
|
if (noRelationsOnFirstLoad) {
|
|
@@ -97,10 +220,19 @@ const TMMasterDetailDcmts = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallba
|
|
|
97
220
|
?
|
|
98
221
|
_jsx(TMNothingToShow, { text: getTitle(), secondText: SDKUI_Localizator.NoDataToDisplay, icon: isForMaster ? _jsx(IconDetailDcmts, { fontSize: 96, transform: 'scale(-1, 1)' }) : _jsx(IconDetailDcmts, { fontSize: 96 }) })
|
|
99
222
|
:
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
223
|
+
_jsxs("div", { ref: floatingBarContainerRef, style: { width: "100%", height: "100%" }, onContextMenu: (e) => {
|
|
224
|
+
// Mostra context menu anche sullo spazio bianco (quando non si clicca su un item)
|
|
225
|
+
e.preventDefault();
|
|
226
|
+
setContextMenuPosition({ x: e.clientX, y: e.clientY });
|
|
227
|
+
setContextMenuVisible(true);
|
|
228
|
+
}, children: [_jsx(TMRelationViewerWrapper, { inputDcmts: inputDcmts, isForMaster: isForMaster, showCurrentDcmtIndicator: showCurrentDcmtIndicator, showZeroDcmts: showZeroDcmts,
|
|
229
|
+
// customItemRender={customItemRender}
|
|
230
|
+
allowMultipleSelection: allowMultipleSelection, focusedItem: focusedItem, selectedItems: selectedItems, onFocusedItemChanged: handleFocusedItemChanged, onSelectedItemsChanged: handleSelectedItemsChanged, onNoRelationsFound: handleNoRelationsFound, onItemContextMenu: onItemContextMenu }, refreshKey), _jsx(TMContextMenu, { items: operationItems, externalControl: {
|
|
231
|
+
visible: contextMenuVisible,
|
|
232
|
+
position: contextMenuPosition,
|
|
233
|
+
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 }, refreshKey), [focusedItem, deviceType, allTasks, handleNavigateToWGs, handleNavigateToDossiers, editPdfForm, openS4TViewer, onOpenS4TViewerRequest, onOpenPdfEditorRequest, onRefreshAfterAddDcmtToFavs, refreshKey]);
|
|
104
236
|
const initialPanelDimensions = {
|
|
105
237
|
'tmTreeView': { width: '50%', height: '100%' },
|
|
106
238
|
'tmFormOrResult': { width: '50%', height: '100%' },
|
|
@@ -177,7 +309,7 @@ const TMMasterDetailDcmts = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallba
|
|
|
177
309
|
toolbarOptions: { icon: _jsx(IconSearchCheck, { fontSize: 24 }), visible: false, orderNumber: 2, isActive: allInitialPanelVisibility['tmFormOrResult'] }
|
|
178
310
|
}
|
|
179
311
|
], [tmTreeView, tmFormOrResult, focusedItem?.isDcmt, dtdMaster]);
|
|
180
|
-
return (_jsxs("div", { style: { width: '100%', height: '100%', position: 'relative' }, children: [isCheckingFirstLoad && (_jsx(Spinner, { description: SDKUI_Localizator.Loading, flat: true })),
|
|
312
|
+
return (_jsxs("div", { style: { width: '100%', height: '100%', position: 'relative' }, children: [isCheckingFirstLoad && (_jsx(Spinner, { description: SDKUI_Localizator.Loading, flat: true })), _jsxs("div", { style: isCheckingFirstLoad ? { position: 'absolute', width: 0, height: 0, overflow: 'hidden', opacity: 0, pointerEvents: 'none' } : { width: '100%', height: '100%' }, children: [_jsx(TMPanelManagerProvider, { panels: initialPanels, initialVisibility: allInitialPanelVisibility, defaultDimensions: initialPanelDimensions, initialDimensions: initialPanelDimensions, initialMobilePanelId: 'tmTreeView', children: _jsx(TMPanelManagerContainer, { panels: initialPanels, direction: "horizontal", showToolbar: true }) }), renderDcmtOperations, renderFloatingBar] })] }));
|
|
181
313
|
};
|
|
182
314
|
export default TMMasterDetailDcmts;
|
|
183
315
|
/**
|
|
@@ -186,7 +318,7 @@ export default TMMasterDetailDcmts;
|
|
|
186
318
|
* - Panel visibility toggling
|
|
187
319
|
* - Focus delay handling
|
|
188
320
|
*/
|
|
189
|
-
const TMRelationViewerWrapper = ({ inputDcmts, isForMaster, showCurrentDcmtIndicator, showZeroDcmts, customItemRender, allowMultipleSelection, focusedItem, selectedItems, onFocusedItemChanged, onSelectedItemsChanged, onNoRelationsFound }) => {
|
|
321
|
+
const TMRelationViewerWrapper = ({ inputDcmts, isForMaster, showCurrentDcmtIndicator, showZeroDcmts, customItemRender, allowMultipleSelection, focusedItem, selectedItems, onFocusedItemChanged, onSelectedItemsChanged, onNoRelationsFound, onItemContextMenu }) => {
|
|
190
322
|
const { setPanelVisibilityById, setToolbarButtonVisibility } = useTMPanelManagerContext();
|
|
191
323
|
// Handle focused item changes with panel visibility management
|
|
192
324
|
const handleFocusedItemChanged = useCallback((item) => {
|
|
@@ -205,15 +337,25 @@ const TMRelationViewerWrapper = ({ inputDcmts, isForMaster, showCurrentDcmtIndic
|
|
|
205
337
|
setToolbarButtonVisibility('tmDcmtForm', false);
|
|
206
338
|
}
|
|
207
339
|
}, [onFocusedItemChanged, setPanelVisibilityById, setToolbarButtonVisibility]);
|
|
208
|
-
|
|
340
|
+
const onContextMenu = useCallback((item, e) => {
|
|
341
|
+
// Ferma la propagazione per evitare che l'evento arrivi al div contenitore
|
|
342
|
+
// (che ha il suo handler per il context menu sullo spazio bianco)
|
|
343
|
+
e.stopPropagation();
|
|
344
|
+
handleFocusedItemChanged(item);
|
|
345
|
+
// Il setTimeout è necessario per permettere a React di completare il re-render
|
|
346
|
+
// dopo il cambio di focus (handleFocusedItemChanged aggiorna stato e visibilità pannelli).
|
|
347
|
+
// Senza il delay, il context menu potrebbe mostrare opzioni basate sul vecchio stato.
|
|
348
|
+
setTimeout(() => {
|
|
349
|
+
onItemContextMenu?.(item, e);
|
|
350
|
+
}, 100);
|
|
351
|
+
}, [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 }));
|
|
209
353
|
};
|
|
210
|
-
const TMFormOrResultWrapper = ({ deviceType, focusedItem, onTaskCreateRequest, allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, handleNavigateToWGs, handleNavigateToDossiers }) => {
|
|
354
|
+
const TMFormOrResultWrapper = ({ deviceType, focusedItem, onTaskCreateRequest, allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, handleNavigateToWGs, handleNavigateToDossiers, onRefreshAfterAddDcmtToFavs, editPdfForm, openS4TViewer, onOpenS4TViewerRequest, onOpenPdfEditorRequest, onRefreshSearchAsyncDatagrid }) => {
|
|
211
355
|
const { setPanelVisibilityById } = useTMPanelManagerContext();
|
|
212
356
|
return (_jsx(_Fragment, { children: focusedItem?.isDcmt ?
|
|
213
|
-
_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: () => {
|
|
214
|
-
|
|
215
|
-
}
|
|
216
|
-
_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: () => {
|
|
217
|
-
setPanelVisibilityById('tmTreeView', true);
|
|
218
|
-
}, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }) }));
|
|
357
|
+
_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
|
+
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 }) }));
|
|
219
361
|
};
|
|
@@ -22,6 +22,7 @@ export interface RelationTreeItem extends ITMTreeItem {
|
|
|
22
22
|
values?: any;
|
|
23
23
|
searchResult?: SearchResultDescriptor[];
|
|
24
24
|
itemsCount?: number;
|
|
25
|
+
fileExt?: string;
|
|
25
26
|
}
|
|
26
27
|
/**
|
|
27
28
|
* Props for TMRelationViewer component
|
|
@@ -98,6 +99,11 @@ export interface TMRelationViewerProps {
|
|
|
98
99
|
* Useful to notify parent component that there are no correlated documents to display.
|
|
99
100
|
*/
|
|
100
101
|
onNoRelationsFound?: () => void;
|
|
102
|
+
/**
|
|
103
|
+
* Callback invoked when user right-clicks on a tree item.
|
|
104
|
+
* Use to show a context menu.
|
|
105
|
+
*/
|
|
106
|
+
onItemContextMenu?: (item: RelationTreeItem, e: React.MouseEvent) => void;
|
|
101
107
|
}
|
|
102
108
|
/**
|
|
103
109
|
* Check if document type has detail relations
|
|
@@ -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, }) => {
|
|
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, }) => {
|
|
140
140
|
// State
|
|
141
141
|
const [dcmtTypes, setDcmtTypes] = useState([]);
|
|
142
142
|
const [treeData, setTreeData] = useState([]);
|
|
@@ -246,7 +246,8 @@ const TMRelationViewer = ({ inputDcmts, isForMaster = false, showCurrentDcmtIndi
|
|
|
246
246
|
// Children will be loaded lazily by calculateItemsForNode when expanded
|
|
247
247
|
expanded: false,
|
|
248
248
|
hidden: false,
|
|
249
|
-
name: row?.SYS_Abstract?.value || row?.SYS_SUBJECT?.value || `Documento ${did}
|
|
249
|
+
name: row?.SYS_Abstract?.value || row?.SYS_SUBJECT?.value || `Documento ${did}`,
|
|
250
|
+
fileExt: row?.FILEEXT?.value
|
|
250
251
|
// Note: Recursive loading on expansion is handled by calculateItemsForNode
|
|
251
252
|
});
|
|
252
253
|
}
|
|
@@ -375,7 +376,7 @@ const TMRelationViewer = ({ inputDcmts, isForMaster = false, showCurrentDcmtIndi
|
|
|
375
376
|
isContainer: false,
|
|
376
377
|
isDcmt: false,
|
|
377
378
|
isInfoMessage: true,
|
|
378
|
-
isExpandible: false
|
|
379
|
+
isExpandible: false,
|
|
379
380
|
},
|
|
380
381
|
...filteredChildren
|
|
381
382
|
];
|
|
@@ -618,7 +619,8 @@ const TMRelationViewer = ({ inputDcmts, isForMaster = false, showCurrentDcmtIndi
|
|
|
618
619
|
values: docRow,
|
|
619
620
|
searchResult: result ? [result] : [],
|
|
620
621
|
items: relatedDocs,
|
|
621
|
-
itemsCount: relatedDocs.length
|
|
622
|
+
itemsCount: relatedDocs.length,
|
|
623
|
+
fileExt: docRow?.FILEEXT?.value
|
|
622
624
|
};
|
|
623
625
|
// Check if a type container for this TID already exists in the tree
|
|
624
626
|
const existingContainer = tree.find(c => c.tid === dcmt.TID && c.isContainer);
|
|
@@ -1130,7 +1132,7 @@ const TMRelationViewer = ({ inputDcmts, isForMaster = false, showCurrentDcmtIndi
|
|
|
1130
1132
|
return null;
|
|
1131
1133
|
return _jsx("div", { style: { padding: '20px', textAlign: 'center', color: '#666' }, children: "Nessuna relazione disponibile." });
|
|
1132
1134
|
}
|
|
1133
|
-
return (_jsxs(_Fragment, { children: [_jsx(TMTreeView, { dataSource: mergedTreeData, itemRender: finalItemRender, calculateItemsForNode: calculateItemsForNode, onDataChanged: handleDataChanged, focusedItem: focusedItem, onFocusedItemChanged: handleFocusedItemChanged, allowMultipleSelection: allowMultipleSelection, selectedItems: selectedItems, itemsPerPage: 100, onSelectionChanged: handleSelectedItemsChanged }), showExpansionWaitPanel && (_jsx(TMWaitPanel, { title: isForMaster ? 'Caricamento documenti master' : 'Caricamento documenti dettaglio', showPrimary: true, textPrimary: expansionWaitPanelText, valuePrimary: expansionWaitPanelValue, maxValuePrimary: expansionWaitPanelMaxValue, isCancelable: true, abortController: expansionAbortController, onAbortClick: (abortController) => {
|
|
1135
|
+
return (_jsxs(_Fragment, { children: [_jsx(TMTreeView, { dataSource: mergedTreeData, itemRender: finalItemRender, calculateItemsForNode: calculateItemsForNode, onDataChanged: handleDataChanged, focusedItem: focusedItem, onFocusedItemChanged: handleFocusedItemChanged, allowMultipleSelection: allowMultipleSelection, selectedItems: selectedItems, itemsPerPage: 100, onSelectionChanged: handleSelectedItemsChanged, onItemContextMenu: onItemContextMenu }), showExpansionWaitPanel && (_jsx(TMWaitPanel, { title: isForMaster ? 'Caricamento documenti master' : 'Caricamento documenti dettaglio', showPrimary: true, textPrimary: expansionWaitPanelText, valuePrimary: expansionWaitPanelValue, maxValuePrimary: expansionWaitPanelMaxValue, isCancelable: true, abortController: expansionAbortController, onAbortClick: (abortController) => {
|
|
1134
1136
|
setTimeout(() => {
|
|
1135
1137
|
abortController?.abort();
|
|
1136
1138
|
}, 100);
|
|
@@ -24,9 +24,9 @@ interface ITMSearchProps {
|
|
|
24
24
|
onTaskCreateRequest?: (taskContext: TaskContext, onTaskCreated?: (task?: TaskDescriptor) => void) => void;
|
|
25
25
|
openWGsCopyMoveForm?: (mode: "copyToWgDraft" | "copyToWgArchivedDoc", dcmtTypeDescriptor: DcmtTypeDescriptor, documents: Array<DcmtInfo>) => void;
|
|
26
26
|
editPdfForm?: boolean;
|
|
27
|
-
openEditPdf?: (documents: Array<DcmtInfo>) => void;
|
|
28
27
|
openS4TViewer?: boolean;
|
|
29
|
-
onOpenS4TViewerRequest?: (dcmtInfo: Array<DcmtInfo>,
|
|
28
|
+
onOpenS4TViewerRequest?: (dcmtInfo: Array<DcmtInfo>, refreshDocumentPreview?: (() => Promise<void>)) => void;
|
|
29
|
+
onOpenPdfEditorRequest?: ((dcmtInfo: Array<DcmtInfo>, refreshDocumentPreview?: () => Promise<void>) => void);
|
|
30
30
|
showTodoDcmtForm?: boolean;
|
|
31
31
|
showToppyDraggableHelpCenter?: boolean;
|
|
32
32
|
toppyHelpCenterUsePortal?: boolean;
|
|
@@ -19,7 +19,7 @@ var TMSearchViews;
|
|
|
19
19
|
TMSearchViews[TMSearchViews["Search"] = 0] = "Search";
|
|
20
20
|
TMSearchViews[TMSearchViews["Result"] = 1] = "Result";
|
|
21
21
|
})(TMSearchViews || (TMSearchViews = {}));
|
|
22
|
-
const TMSearch = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, handleNavigateToWGs, handleNavigateToDossiers, openInOffice, isVisible, inputTID, inputSqdID, inputMids, isExpertMode = SDKUI_Globals.userSettings.advancedSettings.expertMode === 1, floatingActionConfig, onFileOpened, onRefreshAfterAddDcmtToFavs, onTaskCreateRequest, openWGsCopyMoveForm,
|
|
22
|
+
const TMSearch = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, handleNavigateToWGs, handleNavigateToDossiers, openInOffice, isVisible, inputTID, inputSqdID, inputMids, isExpertMode = SDKUI_Globals.userSettings.advancedSettings.expertMode === 1, floatingActionConfig, onFileOpened, onRefreshAfterAddDcmtToFavs, onTaskCreateRequest, openWGsCopyMoveForm, editPdfForm = false, openS4TViewer, onOpenS4TViewerRequest, onOpenPdfEditorRequest, showTodoDcmtForm, showToppyDraggableHelpCenter = true, toppyHelpCenterUsePortal = false, passToArchiveCallback, onCurrentTIDChangedCallback, onlyShowSearchQueryPanel, onReferenceClick }) => {
|
|
23
23
|
const [allSQDs, setAllSQDs] = useState([]);
|
|
24
24
|
const [filteredByTIDSQDs, setFilteredByTIDSQDs] = useState([]);
|
|
25
25
|
const [currentSQD, setCurrentSQD] = useState();
|
|
@@ -144,7 +144,7 @@ const TMSearch = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTask
|
|
|
144
144
|
if (sqdToBeSet)
|
|
145
145
|
await setSqdAsync?.(sqdToBeSet);
|
|
146
146
|
}, []);
|
|
147
|
-
const
|
|
147
|
+
const onRefreshSearchAsyncDatagrid = async () => {
|
|
148
148
|
try {
|
|
149
149
|
if (lastQdSearched) {
|
|
150
150
|
lastQdSearched.maxDcmtsToBeReturned = maxDcmtsToBeReturned;
|
|
@@ -258,7 +258,7 @@ const TMSearch = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTask
|
|
|
258
258
|
toolbarOptions: { icon: _jsx(IconSavedQuery, { fontSize: 24 }), visible: true, orderNumber: 4, isActive: allInitialPanelVisibility['TMSavedQuerySelector'] }
|
|
259
259
|
}
|
|
260
260
|
], [tmTreeSelectorElement, showSearchResults, tmRecentsManagerElement, tmSearchQueryPanelElement, tmSavedQuerySelectorElement, fromDTD, mruTIDs]);
|
|
261
|
-
return (_jsxs(_Fragment, { children: [showSearchResults ? _jsx(StyledMultiViewPanel, { "$isVisible": currentSearchView === TMSearchViews.Search, children: _jsx(TMPanelManagerWithPersistenceProvider, { panels: initialPanels, initialVisibility: allInitialPanelVisibility, defaultDimensions: initialPanelDimensions, initialDimensions: initialPanelDimensions, initialMobilePanelId: 'TMRecentsManager', isPersistenceEnabled: !isMobile ? hasSavedLayout() : false, persistPanelStates: !isMobile ? (state) => persistPanelStates(state) : undefined, persistedPanelStates: getPersistedPanelStates(), children: _jsx(TMPanelManagerContainer, { panels: initialPanels, direction: "horizontal", showToolbar: true, minPanelSizePx: !isMobile ? 250 : 150 }) }) }) : tmSearchQueryPanelElement, showSearchResults && _jsx(TMSearchResult, { isVisible: isVisible && currentSearchView === TMSearchViews.Result, context: SearchResultContext.METADATA_SEARCH, searchResults: searchResult, floatingActionConfig: floatingActionConfig, onRefreshAfterAddDcmtToFavs: onRefreshAfterAddDcmtToFavs, openInOffice: openInOffice,
|
|
261
|
+
return (_jsxs(_Fragment, { children: [showSearchResults ? _jsx(StyledMultiViewPanel, { "$isVisible": currentSearchView === TMSearchViews.Search, children: _jsx(TMPanelManagerWithPersistenceProvider, { panels: initialPanels, initialVisibility: allInitialPanelVisibility, defaultDimensions: initialPanelDimensions, initialDimensions: initialPanelDimensions, initialMobilePanelId: 'TMRecentsManager', isPersistenceEnabled: !isMobile ? hasSavedLayout() : false, persistPanelStates: !isMobile ? (state) => persistPanelStates(state) : undefined, persistedPanelStates: getPersistedPanelStates(), children: _jsx(TMPanelManagerContainer, { panels: initialPanels, direction: "horizontal", showToolbar: true, minPanelSizePx: !isMobile ? 250 : 150 }) }) }) : tmSearchQueryPanelElement, showSearchResults && _jsx(TMSearchResult, { isVisible: isVisible && currentSearchView === TMSearchViews.Result, context: SearchResultContext.METADATA_SEARCH, searchResults: searchResult, floatingActionConfig: floatingActionConfig, onRefreshAfterAddDcmtToFavs: onRefreshAfterAddDcmtToFavs, openInOffice: openInOffice, onRefreshSearchAsyncDatagrid: onRefreshSearchAsyncDatagrid, onClose: () => { onlyShowSearchQueryPanel ? setShowSearchResults(false) : setCurrentSearchView(TMSearchViews.Search); }, onFileOpened: onFileOpened, onTaskCreateRequest: onTaskCreateRequest, openWGsCopyMoveForm: openWGsCopyMoveForm, editPdfForm: editPdfForm, onOpenPdfEditorRequest: onOpenPdfEditorRequest, openS4TViewer: openS4TViewer, onOpenS4TViewerRequest: onOpenS4TViewerRequest, passToArchiveCallback: passToArchiveCallback, onSelectedTIDChanged: onCurrentTIDChangedCallback, showTodoDcmtForm: showTodoDcmtForm, showToppyDraggableHelpCenter: showToppyDraggableHelpCenter, toppyHelpCenterUsePortal: toppyHelpCenterUsePortal, onReferenceClick: onReferenceClick, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers })] }));
|
|
262
262
|
};
|
|
263
263
|
export default TMSearch;
|
|
264
264
|
const TMTreeSelectorWrapper = ({ isMobile, onSelectedTIDChanged }) => {
|