@topconsultnpm/sdkui-react 6.21.0-dev2.7 → 6.21.0-dev2.9
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.
|
@@ -19,6 +19,18 @@ const TMDcmtFormActionButtons = (props) => {
|
|
|
19
19
|
return null;
|
|
20
20
|
return moreInfoTasks[0];
|
|
21
21
|
}, [moreInfoTasks]);
|
|
22
|
+
// Verifica se la More Info Card sarà effettivamente renderizzata (non null)
|
|
23
|
+
const isMoreInfoCardVisible = useMemo(() => {
|
|
24
|
+
if (!firstTask)
|
|
25
|
+
return false;
|
|
26
|
+
const userID = SDK_Globals.tmSession?.SessionDescr?.userID;
|
|
27
|
+
const isSender = firstTask?.fromID !== undefined && firstTask.fromID === userID;
|
|
28
|
+
const isRecipient = firstTask?.toID !== undefined && firstTask.toID === userID;
|
|
29
|
+
// Caso 4: L'utente è sia mittente che destinatario - la card non viene renderizzata
|
|
30
|
+
if (isSender && isRecipient)
|
|
31
|
+
return false;
|
|
32
|
+
return true;
|
|
33
|
+
}, [firstTask]);
|
|
22
34
|
const { hasMoreInfo, hasApprove, hasReferences } = useMemo(() => {
|
|
23
35
|
const referencesExist = showToppyForReferences && dcmtReferences?.some(ref => ref.objClass === ObjectClasses.Dossier || ref.objClass === ObjectClasses.WorkingGroup);
|
|
24
36
|
return {
|
|
@@ -56,6 +68,9 @@ const TMDcmtFormActionButtons = (props) => {
|
|
|
56
68
|
const senderNameTruncated = task?.fromName ? truncate(task.fromName, 30) : 'N/A';
|
|
57
69
|
const recipientNameTruncated = task?.toName ? truncate(task.toName, 30) : 'N/A';
|
|
58
70
|
const taskNameTrunc = task?.name ? truncate(task.name.replace(TASK_MORE_INFO_PREFIX_NAME ?? '', ''), 30) : 'N/A';
|
|
71
|
+
// Caso 4: L'utente è sia mittente che destinatario - non renderizzare nulla
|
|
72
|
+
if (isSender && isRecipient)
|
|
73
|
+
return null;
|
|
59
74
|
return (_jsxs("div", { style: { position: 'relative', display: 'flex' }, children: [_jsxs("div", { style: {
|
|
60
75
|
padding: '10px',
|
|
61
76
|
color: '#FFFFFF',
|
|
@@ -156,10 +171,10 @@ const TMDcmtFormActionButtons = (props) => {
|
|
|
156
171
|
e.currentTarget.style.transform = 'translateY(-50%)';
|
|
157
172
|
}, children: formatBadgeCount(othersCount) }))] }));
|
|
158
173
|
};
|
|
159
|
-
return (_jsxs(_Fragment, { children: [_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '10px' }, children: [hasMoreInfo && firstTask && (_jsx("div", { style: { display: 'flex', gap: "10px", flexDirection: 'column', alignItems: 'center', paddingRight: tasksNumber > 1 ? '36px' : '0' }, children: renderMoreInfoCard(firstTask, tasksNumber > 1) })), hasMoreInfo && hasApprove && _jsx(Divider, {}), hasApprove && (workItems.length === 1 ?
|
|
174
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '10px' }, children: [hasMoreInfo && firstTask && isMoreInfoCardVisible && (_jsx("div", { style: { display: 'flex', gap: "10px", flexDirection: 'column', alignItems: 'center', paddingRight: tasksNumber > 1 ? '36px' : '0' }, children: renderMoreInfoCard(firstTask, tasksNumber > 1) })), hasMoreInfo && isMoreInfoCardVisible && hasApprove && _jsx(Divider, {}), hasApprove && (workItems.length === 1 ?
|
|
160
175
|
_jsx(WorkFlowOperationButtons, { dtd: fromDTD, deviceType: deviceType, onApprove: () => updateShowApprovePopup(true), onSignApprove: handleSignApprove, onReject: () => updateShowRejectPopup(true), onReAssign: () => updateShowReAssignPopup(true), onMoreInfo: () => updateShowMoreInfoPopup(true) })
|
|
161
176
|
:
|
|
162
|
-
_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 && (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '10px', alignItems: 'center' }, children: [dossierRefs.length > 0 && (_jsx("div", { style: { paddingRight: dossierRefs.length > 1 ? '36px' : '0' }, children: renderReferenceCard(dossierRefs[0], dossierRefs, dossierRefs.length > 1, () => setShowAllDossiersModal(true)) })), workingGroupRefs.length > 0 && (_jsx("div", { style: { paddingRight: workingGroupRefs.length > 1 ? '36px' : '0' }, children: renderReferenceCard(workingGroupRefs[0], workingGroupRefs, workingGroupRefs.length > 1, () => setShowAllWorkingGroupsModal(true)) }))] }))] }), showAllMoreInfoModal && moreInfoTasks && moreInfoTasks.length > 1 && (_jsx(TMModal, { title: `Altre richieste maggiori informazioni (${moreInfoTasks.length - 1})`, onClose: () => setShowAllMoreInfoModal(false), width: calcResponsiveSizes(deviceType, '450px', '450px', '95%'), height: 'auto', children: _jsx("div", { style: {
|
|
177
|
+
_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 && isMoreInfoCardVisible && !hasApprove && hasReferences) ? (_jsx(Divider, {})) : null, hasReferences && (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '10px', alignItems: 'center' }, children: [dossierRefs.length > 0 && (_jsx("div", { style: { paddingRight: dossierRefs.length > 1 ? '36px' : '0' }, children: renderReferenceCard(dossierRefs[0], dossierRefs, dossierRefs.length > 1, () => setShowAllDossiersModal(true)) })), workingGroupRefs.length > 0 && (_jsx("div", { style: { paddingRight: workingGroupRefs.length > 1 ? '36px' : '0' }, children: renderReferenceCard(workingGroupRefs[0], workingGroupRefs, workingGroupRefs.length > 1, () => setShowAllWorkingGroupsModal(true)) }))] }))] }), showAllMoreInfoModal && moreInfoTasks && moreInfoTasks.length > 1 && (_jsx(TMModal, { title: `Altre richieste maggiori informazioni (${moreInfoTasks.length - 1})`, onClose: () => setShowAllMoreInfoModal(false), width: calcResponsiveSizes(deviceType, '450px', '450px', '95%'), height: 'auto', children: _jsx("div", { style: {
|
|
163
178
|
display: 'flex',
|
|
164
179
|
flexDirection: 'column',
|
|
165
180
|
gap: '8px',
|
|
@@ -5,6 +5,7 @@ interface TMBlogAttachmentsProps {
|
|
|
5
5
|
layoutMode: "compact" | "extended";
|
|
6
6
|
attachments: Array<BlogPostAttachment>;
|
|
7
7
|
isSelected: boolean;
|
|
8
|
+
isLoading?: boolean;
|
|
8
9
|
searchText: string;
|
|
9
10
|
dcmtTypeDescriptors: Map<number, DcmtTypeDescriptor>;
|
|
10
11
|
treeFs: FileItem | undefined;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { SDK_Globals } from "@topconsultnpm/sdk-ts";
|
|
3
3
|
import { getAttachmentInfo, lightenColor, removeFileExtension } from "./TMBlogsPostUtils";
|
|
4
4
|
import TMDcmtIcon from "../features/documents/TMDcmtIcon";
|
|
5
5
|
import { IconAttachment } from "../../helper";
|
|
6
6
|
const TMBlogAttachments = (props) => {
|
|
7
|
-
const { layoutMode, attachments, isSelected, searchText, dcmtTypeDescriptors, treeFs, draftLatestInfoMap, archivedDocumentMap, handleAttachmentFocus, openDcmtForm } = props;
|
|
7
|
+
const { layoutMode, attachments, isSelected, isLoading = false, searchText, dcmtTypeDescriptors, treeFs, draftLatestInfoMap, archivedDocumentMap, handleAttachmentFocus, openDcmtForm } = props;
|
|
8
8
|
const handleMouseEnter = (e, blogPostAttachment, name, fileExt) => {
|
|
9
9
|
e.currentTarget.style.boxShadow = '0 4px 8px rgba(0, 0, 0, 0.15)';
|
|
10
10
|
e.currentTarget.style.backgroundColor = isSelected ? lightenColor("#135596", 40) : '#cfcfcf';
|
|
@@ -24,7 +24,7 @@ const TMBlogAttachments = (props) => {
|
|
|
24
24
|
};
|
|
25
25
|
return _jsx("div", { style: { width: "100%", marginTop: "5px", overflow: "hidden" }, children: attachments.map((blogPostAttachment, index) => {
|
|
26
26
|
const { name, nameElement, tooltipContent, fileExt, archivedDocumentsExist, draftExist } = getAttachmentInfo(blogPostAttachment, treeFs, draftLatestInfoMap, archivedDocumentMap, dcmtTypeDescriptors, isSelected, searchText);
|
|
27
|
-
return _jsx("div", { onDoubleClick: (e) => onDoubleClick(e, blogPostAttachment, name, fileExt), onMouseEnter: (e) => handleMouseEnter(e, blogPostAttachment, name, fileExt), onMouseLeave: (e) => handleMouseLeave(e), style: {
|
|
27
|
+
return _jsx("div", { onDoubleClick: (e) => !isLoading && onDoubleClick(e, blogPostAttachment, name, fileExt), onMouseEnter: (e) => !isLoading && handleMouseEnter(e, blogPostAttachment, name, fileExt), onMouseLeave: (e) => !isLoading && handleMouseLeave(e), style: {
|
|
28
28
|
display: layoutMode === "extended" ? "inline-flex" : "flex",
|
|
29
29
|
padding: '4px 8px',
|
|
30
30
|
margin: '4px',
|
|
@@ -32,17 +32,43 @@ const TMBlogAttachments = (props) => {
|
|
|
32
32
|
borderRadius: '8px',
|
|
33
33
|
boxShadow: '0 2px 4px rgba(0, 0, 0, 0.1)',
|
|
34
34
|
backgroundColor: isSelected ? "#135596" : "#ffffff",
|
|
35
|
-
cursor: "pointer",
|
|
35
|
+
cursor: isLoading ? "default" : "pointer",
|
|
36
36
|
fontSize: '0.9rem',
|
|
37
37
|
color: isSelected ? "#ffffff" : "#000000",
|
|
38
|
-
}, children:
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
38
|
+
}, children: _jsx("div", { style: { alignItems: 'center', display: 'flex', minWidth: 0 }, children: isLoading ? (_jsxs(_Fragment, { children: [_jsx("div", { style: {
|
|
39
|
+
width: '16px',
|
|
40
|
+
height: '16px',
|
|
41
|
+
marginRight: '8px',
|
|
42
|
+
border: '2px solid #ddd',
|
|
43
|
+
borderTop: `2px solid ${isSelected ? '#fff' : '#135596'}`,
|
|
44
|
+
borderRadius: '50%',
|
|
45
|
+
animation: 'spin 1s linear infinite',
|
|
46
|
+
flexShrink: 0,
|
|
47
|
+
} }), _jsx("span", { style: {
|
|
48
|
+
background: isSelected ? 'rgba(255,255,255,0.3)' : 'linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%)',
|
|
49
|
+
backgroundSize: '200% 100%',
|
|
50
|
+
animation: 'shimmer 1.5s infinite',
|
|
51
|
+
borderRadius: '4px',
|
|
52
|
+
width: '120px',
|
|
53
|
+
height: '14px',
|
|
54
|
+
display: 'inline-block',
|
|
55
|
+
} }), _jsx("style", { children: `
|
|
56
|
+
@keyframes spin {
|
|
57
|
+
0% { transform: rotate(0deg); }
|
|
58
|
+
100% { transform: rotate(360deg); }
|
|
59
|
+
}
|
|
60
|
+
@keyframes shimmer {
|
|
61
|
+
0% { background-position: -200% 0; }
|
|
62
|
+
100% { background-position: 200% 0; }
|
|
63
|
+
}
|
|
64
|
+
` })] })) : (_jsxs(_Fragment, { children: [(!archivedDocumentsExist && !draftExist) ?
|
|
65
|
+
_jsx(IconAttachment, { style: { marginRight: "5px", flexShrink: 0 } }) :
|
|
66
|
+
_jsx("div", { style: { marginRight: "10px", flexShrink: 0 }, children: _jsx(TMDcmtIcon, { tid: blogPostAttachment.tid, did: blogPostAttachment.did, fileExtension: fileExt, downloadMode: 'openInNewWindow', tooltipContent: tooltipContent }) }), _jsx("span", { title: layoutMode === 'compact' ? name + " (DID: " + blogPostAttachment.did + ")" : undefined, style: {
|
|
67
|
+
whiteSpace: 'nowrap',
|
|
68
|
+
overflow: 'hidden',
|
|
69
|
+
textOverflow: 'ellipsis',
|
|
70
|
+
minWidth: 0,
|
|
71
|
+
}, children: nameElement })] })) }) }, blogPostAttachment.did + "_" + index);
|
|
46
72
|
}) });
|
|
47
73
|
};
|
|
48
74
|
export default TMBlogAttachments;
|
|
@@ -48,6 +48,7 @@ const TMBlogsPost = (props) => {
|
|
|
48
48
|
const [firstUnreadPost, setFirstUnreadPost] = useState(undefined);
|
|
49
49
|
// State to manage the focused file
|
|
50
50
|
const [dcmtTypeDescriptors, setDcmtTypeDescriptors] = useState(new Map());
|
|
51
|
+
const [descriptorsLoaded, setDescriptorsLoaded] = useState(false);
|
|
51
52
|
const [currentHeader, setCurrentHeader] = useState(header);
|
|
52
53
|
const [isHeaderHidden, setIsHeaderHidden] = useState(isHeaderFullyHidden(currentHeader));
|
|
53
54
|
const [localShowId, setLocalShowId] = useState(false);
|
|
@@ -147,8 +148,13 @@ const TMBlogsPost = (props) => {
|
|
|
147
148
|
useEffect(() => {
|
|
148
149
|
(async () => {
|
|
149
150
|
if (showExtendedAttachments) {
|
|
151
|
+
setDescriptorsLoaded(false);
|
|
150
152
|
const descriptors = await getDcmtTypeDescriptor(posts);
|
|
151
153
|
setDcmtTypeDescriptors(descriptors);
|
|
154
|
+
setDescriptorsLoaded(true);
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
setDescriptorsLoaded(true);
|
|
152
158
|
}
|
|
153
159
|
const publishedBlogssLength = posts.filter(newsFeed => newsFeed.isSys !== 1 && newsFeed.isDel !== 1).length;
|
|
154
160
|
const systemBlogsLength = posts.filter(newsFeed => newsFeed.isSys === 1).length;
|
|
@@ -679,7 +685,7 @@ const TMBlogsPost = (props) => {
|
|
|
679
685
|
textDecoration: blogPost.isDel ? 'line-through' : 'none',
|
|
680
686
|
boxShadow: isFocused ? "0 4px 12px rgba(19, 85, 150, 0.6)" : "none",
|
|
681
687
|
cursor: 'pointer',
|
|
682
|
-
}, children: [_jsx(BlogPostTitle, { displayMode: displayMode, layoutMode: layoutMode, blogPost: blogPost, isSelected: isSelected, isOwnComment: isOwnComment, searchText: searchText, isSys: isSys, isHomeBlogPost: isHomeBlogPost, showId: localShowId, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }), isNew && _jsx(NewBadge, { layoutMode: layoutMode }), _jsx("div", { style: { fontSize: '1rem', color: "#000", marginTop: "10px", overflow: "hidden" }, children: _jsx(TMHtmlContentDisplay, { markup: blogPost.description ?? '-', searchText: searchText, isSelected: isSelected }) }), showExtendedAttachments && blogPost.attachments && blogPost.attachments.length > 0 && (_jsx(TMBlogAttachments, { attachments: blogPost.attachments, layoutMode: layoutMode, isSelected: isSelected, searchText: searchText, dcmtTypeDescriptors: dcmtTypeDescriptors, treeFs: treeFs, draftLatestInfoMap: draftLatestInfoMap, archivedDocumentMap: archivedDocumentMap, handleAttachmentFocus: handleFocusedAttachment, openDcmtForm: openDcmtForm }))] }, `${id}-blogpost-${blogPost.id}`) })] }, "blog-post-wrapper-" + id + "-" + blogPost.id);
|
|
688
|
+
}, children: [_jsx(BlogPostTitle, { displayMode: displayMode, layoutMode: layoutMode, blogPost: blogPost, isSelected: isSelected, isOwnComment: isOwnComment, searchText: searchText, isSys: isSys, isHomeBlogPost: isHomeBlogPost, showId: localShowId, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }), isNew && _jsx(NewBadge, { layoutMode: layoutMode }), _jsx("div", { style: { fontSize: '1rem', color: "#000", marginTop: "10px", overflow: "hidden" }, children: _jsx(TMHtmlContentDisplay, { markup: blogPost.description ?? '-', searchText: searchText, isSelected: isSelected }) }), showExtendedAttachments && blogPost.attachments && blogPost.attachments.length > 0 && (_jsx(TMBlogAttachments, { attachments: blogPost.attachments, layoutMode: layoutMode, isSelected: isSelected, isLoading: !descriptorsLoaded, searchText: searchText, dcmtTypeDescriptors: dcmtTypeDescriptors, treeFs: treeFs, draftLatestInfoMap: draftLatestInfoMap, archivedDocumentMap: archivedDocumentMap, handleAttachmentFocus: handleFocusedAttachment, openDcmtForm: openDcmtForm }))] }, `${id}-blogpost-${blogPost.id}`) })] }, "blog-post-wrapper-" + id + "-" + blogPost.id);
|
|
683
689
|
}), _jsx("div", { ref: bottomRef })] }), _jsx(TMContextMenu, { items: menuItems, target: `#${id}-blogs-wrapper`, externalControl: {
|
|
684
690
|
visible: menuVisible,
|
|
685
691
|
position: menuPosition,
|