@topconsultnpm/sdkui-react 6.19.0-dev1.51 → 6.19.0-dev1.53
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/features/blog/TMBlogCommentForm.d.ts +4 -4
- package/lib/components/features/blog/TMBlogCommentForm.js +19 -10
- package/lib/components/features/documents/TMDcmtBlog.js +17 -8
- package/lib/components/grids/TMBlogAttachments.d.ts +42 -0
- package/lib/components/grids/TMBlogAttachments.js +43 -0
- package/lib/components/grids/TMBlogHeader.d.ts +31 -0
- package/lib/components/grids/TMBlogHeader.js +41 -0
- package/lib/components/grids/{TMBlogs.d.ts → TMBlogsPost.d.ts} +39 -58
- package/lib/components/grids/TMBlogsPost.js +628 -0
- package/lib/components/grids/{TMBlogsUtils.d.ts → TMBlogsPostUtils.d.ts} +61 -48
- package/lib/components/grids/{TMBlogsUtils.js → TMBlogsPostUtils.js} +142 -159
- package/lib/components/index.d.ts +3 -1
- package/lib/components/index.js +3 -1
- package/package.json +2 -2
- package/lib/components/grids/TMBlogs.js +0 -721
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { UserDescriptor } from "@topconsultnpm/sdk-ts";
|
|
2
|
-
import { TMBlogContextDescriptor } from '../../grids/TMBlogsUtils';
|
|
1
|
+
import { BlogPost, UserDescriptor } from "@topconsultnpm/sdk-ts";
|
|
3
2
|
import { FileItem } from '../../base/TMFileManagerUtils';
|
|
3
|
+
import { TMBlogContextDescriptor } from '../../grids/TMBlogsPostUtils';
|
|
4
4
|
interface TMBlogCommentFormProps {
|
|
5
5
|
context: TMBlogContextDescriptor;
|
|
6
6
|
participants: Array<UserDescriptor>;
|
|
7
7
|
onClose: () => void;
|
|
8
|
-
refreshCallback: () => Promise<void>;
|
|
9
8
|
showAttachmentsSection?: boolean;
|
|
10
9
|
selectedAttachments?: Array<FileItem>;
|
|
11
10
|
selectedAttachmentDid?: Array<number>;
|
|
12
11
|
allFileItems?: FileItem;
|
|
13
12
|
allArchivedDocumentsFileItems?: Array<FileItem>;
|
|
14
|
-
|
|
13
|
+
onFilterCreated?: (predicate: (post: BlogPost) => boolean) => void;
|
|
14
|
+
refreshCallback?: () => Promise<void>;
|
|
15
15
|
}
|
|
16
16
|
declare const TMBlogCommentForm: (props: TMBlogCommentFormProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
17
|
export default TMBlogCommentForm;
|
|
@@ -29,7 +29,7 @@ const getNonDirectoryFiles = (items, exclude) => {
|
|
|
29
29
|
};
|
|
30
30
|
const TMBlogCommentForm = (props) => {
|
|
31
31
|
const maxLength = 1000;
|
|
32
|
-
const { participants, selectedAttachments, selectedAttachmentDid, allFileItems, allArchivedDocumentsFileItems = [], onClose,
|
|
32
|
+
const { participants, selectedAttachments, selectedAttachmentDid, allFileItems, allArchivedDocumentsFileItems = [], onClose, context, showAttachmentsSection = true, onFilterCreated, refreshCallback } = props;
|
|
33
33
|
// Initialize state with combined array
|
|
34
34
|
const [dataSource, setDataSource] = useState(() => [...getNonDirectoryFiles(allFileItems?.items || [], []), ...allArchivedDocumentsFileItems]);
|
|
35
35
|
const [isEditorEnabled, setIsEditorEnabled] = useState(true);
|
|
@@ -136,23 +136,32 @@ const TMBlogCommentForm = (props) => {
|
|
|
136
136
|
// Create an instance of WorkingGroupEngine to interact with the working group
|
|
137
137
|
const workingGroupEngine = new WorkingGroupEngine(SDK_Globals.tmSession);
|
|
138
138
|
// Call the BlogPostAddAsync method to add the blog post to the working group
|
|
139
|
-
await workingGroupEngine.BlogPostAddAsync(context.object.id, blogPost);
|
|
140
|
-
await refreshCallback();
|
|
141
|
-
|
|
139
|
+
const newBlogPostId = await workingGroupEngine.BlogPostAddAsync(context.object.id, blogPost);
|
|
140
|
+
await refreshCallback?.();
|
|
141
|
+
if (newBlogPostId && onFilterCreated) {
|
|
142
|
+
onFilterCreated(post => post.id === newBlogPostId);
|
|
143
|
+
}
|
|
144
|
+
;
|
|
142
145
|
}
|
|
143
146
|
else if (context.engine === 'SearchEngine') {
|
|
144
147
|
// Create an instance of SearchEngine
|
|
145
148
|
const searchEngine = SDK_Globals.tmSession?.NewSearchEngine();
|
|
146
|
-
await searchEngine.BlogPostAddAsync(context.object.tid, context.object.did, cleanComment);
|
|
147
|
-
await refreshCallback();
|
|
148
|
-
|
|
149
|
+
const newBlogPostId = await searchEngine.BlogPostAddAsync(context.object.tid, context.object.did, cleanComment);
|
|
150
|
+
await refreshCallback?.();
|
|
151
|
+
if (newBlogPostId && onFilterCreated) {
|
|
152
|
+
onFilterCreated(post => post.id === newBlogPostId);
|
|
153
|
+
}
|
|
154
|
+
;
|
|
149
155
|
}
|
|
150
156
|
else if (context.engine === 'DossierEngine' && context.object && context.object.id) {
|
|
151
157
|
// Create an instance of DossierEngine
|
|
152
158
|
const dossierEngine = SDK_Globals.tmSession?.NewDossierEngine();
|
|
153
|
-
await dossierEngine.BlogPostAddAsync(context.object.id, blogPost);
|
|
154
|
-
await refreshCallback();
|
|
155
|
-
|
|
159
|
+
const newBlogPostId = await dossierEngine.BlogPostAddAsync(context.object.id, blogPost);
|
|
160
|
+
await refreshCallback?.();
|
|
161
|
+
if (newBlogPostId && onFilterCreated) {
|
|
162
|
+
onFilterCreated(post => post.id === newBlogPostId);
|
|
163
|
+
}
|
|
164
|
+
;
|
|
156
165
|
}
|
|
157
166
|
}
|
|
158
167
|
catch (e) {
|
|
@@ -4,18 +4,17 @@ import styled from 'styled-components';
|
|
|
4
4
|
import { SDK_Globals } from '@topconsultnpm/sdk-ts';
|
|
5
5
|
import { TMExceptionBoxManager } from '../../base/TMPopUp';
|
|
6
6
|
import TMSpinner from '../../base/TMSpinner';
|
|
7
|
-
import TMBlogs from '../../grids/TMBlogs';
|
|
8
7
|
import { TMNothingToShow } from './TMDcmtPreview';
|
|
9
8
|
import { IconBoard, SDKUI_Localizator } from '../../../helper';
|
|
10
9
|
import TMBlogCommentForm from '../blog/TMBlogCommentForm';
|
|
10
|
+
import TMBlogsPost from '../../grids/TMBlogsPost';
|
|
11
11
|
const TMDcmtBlog = ({ tid, did, isVisible }) => {
|
|
12
12
|
const [blogsDatasource, setBlogsDatasource] = useState([]);
|
|
13
13
|
const [hasLoadedDataOnce, setHasLoadedDataOnce] = useState(false); //traccia se *qualsiasi* dato è stato caricato per la prima volta
|
|
14
14
|
const [lastLoadedDid, setLastLoadedDid] = useState(undefined); // `lastLoadedDid` tiene traccia dell'ultimo `did` per cui abbiamo caricato i dati
|
|
15
15
|
// State to manage show comment form selected file
|
|
16
16
|
const [showCommentForm, setShowCommentForm] = useState(false);
|
|
17
|
-
|
|
18
|
-
const [shouldSelectLastBlog, setShouldSelectLastBlog] = useState(false);
|
|
17
|
+
const [externalBlogPost, setExternalBlogPost] = useState(undefined);
|
|
19
18
|
const showCommentFormCallback = useCallback(() => {
|
|
20
19
|
setShowCommentForm(true);
|
|
21
20
|
}, []);
|
|
@@ -51,14 +50,24 @@ const TMDcmtBlog = ({ tid, did, isVisible }) => {
|
|
|
51
50
|
fetchDataAsync(tid, did);
|
|
52
51
|
}
|
|
53
52
|
}, [tid, did, isVisible, hasLoadedDataOnce, lastLoadedDid]);
|
|
54
|
-
const updateShouldSelectLastBlog = (value) => {
|
|
55
|
-
setShouldSelectLastBlog(value);
|
|
56
|
-
};
|
|
57
53
|
const refreshCallback = async () => {
|
|
58
54
|
await fetchDataAsync(tid, did);
|
|
59
55
|
};
|
|
56
|
+
const resetExternalBlogPost = useCallback(() => {
|
|
57
|
+
setExternalBlogPost(undefined);
|
|
58
|
+
}, []);
|
|
59
|
+
const handleFilterCreated = async (predicate) => {
|
|
60
|
+
await refreshCallback();
|
|
61
|
+
const res = await SDK_Globals.tmSession?.NewSearchEngine().BlogRetrieveAsync(tid, did);
|
|
62
|
+
if (res && res.length > 0) {
|
|
63
|
+
setBlogsDatasource(res ?? []);
|
|
64
|
+
const firstMatchingPost = res.find(predicate);
|
|
65
|
+
if (firstMatchingPost)
|
|
66
|
+
setExternalBlogPost(firstMatchingPost);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
60
69
|
return (_jsxs("div", { style: { width: '100%', height: '100%' }, children: [_jsx(StyledContainer, { children: _jsx(StyledSectionContainer, { style: { position: 'relative' }, children: _jsx(StyledBoardContainer, { children: !did ? _jsx(TMNothingToShow, { text: `${SDKUI_Localizator.NoDcmtSelected}.`, secondText: `${SDKUI_Localizator.BlogCase} - ${SDKUI_Localizator.NotAvailable}`, icon: _jsx(IconBoard, { fontSize: 96 }) }) :
|
|
61
|
-
_jsx(
|
|
70
|
+
_jsx(TMBlogsPost, { context: { engine: 'SearchEngine', object: { tid, did } }, id: "dcmt-blog", displayMode: 'chat', scrollToSelected: true, posts: blogsDatasource, showExtendedAttachments: false, showFloatingCommentButton: true, showCommentFormCallback: showCommentFormCallback, refreshCallback: refreshCallback, contextMenuParams: {
|
|
62
71
|
isShowHideFilterEnabled: true,
|
|
63
72
|
isShowHideIDEnaled: true,
|
|
64
73
|
isCommentEnabled: true,
|
|
@@ -69,7 +78,7 @@ const TMDcmtBlog = ({ tid, did, isVisible }) => {
|
|
|
69
78
|
isRefreshEnabled: true,
|
|
70
79
|
isRestoreEnabled: true,
|
|
71
80
|
isCreateContextualTask: false
|
|
72
|
-
},
|
|
81
|
+
}, externalBlogPost: externalBlogPost, resetExternalBlogPost: resetExternalBlogPost }) }) }) }), (showCommentForm && tid && did) && _jsx(TMBlogCommentForm, { context: { engine: 'SearchEngine', object: { tid, did } }, onClose: () => setShowCommentForm(false), refreshCallback: refreshCallback, participants: [], showAttachmentsSection: false, allArchivedDocumentsFileItems: [], onFilterCreated: handleFilterCreated })] }));
|
|
73
82
|
};
|
|
74
83
|
export default TMDcmtBlog;
|
|
75
84
|
const StyledContainer = styled.div ` user-select: none; overflow: hidden; background-color: #ffffff; width: calc(100%); height: calc(100%); display: flex; gap: 10px; `;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { BlogPostAttachment, DcmtTypeDescriptor } from "@topconsultnpm/sdk-ts";
|
|
2
|
+
import { TMBlogContextDescriptor } from "./TMBlogsPostUtils";
|
|
3
|
+
import { DcmtInfo } from "../../ts";
|
|
4
|
+
import { FileItem } from "../base/TMFileManagerUtils";
|
|
5
|
+
interface TMBlogAttachmentsProps {
|
|
6
|
+
contextMenuParams?: {
|
|
7
|
+
isShowHideFilterEnabled: boolean;
|
|
8
|
+
isShowHideIDEnaled: boolean;
|
|
9
|
+
isCommentEnabled: boolean;
|
|
10
|
+
isDownloadAttachmentEnabled: boolean;
|
|
11
|
+
isViewEditMetadata: boolean;
|
|
12
|
+
isDeleteEnabled: boolean;
|
|
13
|
+
isCopyToClipboardEnabled: boolean;
|
|
14
|
+
isRestoreEnabled: boolean;
|
|
15
|
+
isRefreshEnabled: boolean;
|
|
16
|
+
isCreateContextualTask: boolean;
|
|
17
|
+
};
|
|
18
|
+
layoutMode: "compact" | "extended";
|
|
19
|
+
attachments: Array<BlogPostAttachment>;
|
|
20
|
+
isSelected: boolean;
|
|
21
|
+
searchText: string;
|
|
22
|
+
dcmtTypeDescriptors: Map<number, DcmtTypeDescriptor>;
|
|
23
|
+
treeFs: FileItem | undefined;
|
|
24
|
+
draftLatestInfoMap: Map<number, {
|
|
25
|
+
latestVersion: number;
|
|
26
|
+
folderId: number;
|
|
27
|
+
folderName: string;
|
|
28
|
+
fileExt: string;
|
|
29
|
+
fileSize: string;
|
|
30
|
+
}> | undefined;
|
|
31
|
+
archivedDocumentMap: Map<number, {
|
|
32
|
+
tid: number;
|
|
33
|
+
did: number;
|
|
34
|
+
fileExt: string;
|
|
35
|
+
fileSize: string;
|
|
36
|
+
}> | undefined;
|
|
37
|
+
context?: TMBlogContextDescriptor;
|
|
38
|
+
handleAttachmentFocus: (attachment: DcmtInfo | undefined) => void;
|
|
39
|
+
openDcmtForm: (dcmtInfo: DcmtInfo) => void;
|
|
40
|
+
}
|
|
41
|
+
declare const TMBlogAttachments: (props: TMBlogAttachmentsProps) => import("react/jsx-runtime").JSX.Element;
|
|
42
|
+
export default TMBlogAttachments;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { SDK_Globals } from "@topconsultnpm/sdk-ts";
|
|
3
|
+
import { getAttachmentInfo, lightenColor, removeFileExtension } from "./TMBlogsPostUtils";
|
|
4
|
+
import TMDcmtIcon from "../features/documents/TMDcmtIcon";
|
|
5
|
+
import { IconAttachment } from "../../helper";
|
|
6
|
+
const TMBlogAttachments = (props) => {
|
|
7
|
+
const { attachments, isSelected, searchText, dcmtTypeDescriptors, treeFs, draftLatestInfoMap, archivedDocumentMap, handleAttachmentFocus, openDcmtForm } = props;
|
|
8
|
+
const handleMouseEnter = (e, blogPostAttachment, name, fileExt) => {
|
|
9
|
+
e.currentTarget.style.boxShadow = '0 4px 8px rgba(0, 0, 0, 0.15)';
|
|
10
|
+
e.currentTarget.style.backgroundColor = isSelected ? lightenColor("#135596", 40) : '#cfcfcf';
|
|
11
|
+
const archiveID = SDK_Globals.tmSession?.SessionDescr?.archiveID;
|
|
12
|
+
const fileName = `${removeFileExtension(name)}_${archiveID}_${blogPostAttachment.tid}_${blogPostAttachment.did}.${fileExt}`;
|
|
13
|
+
handleAttachmentFocus({ TID: blogPostAttachment.tid, DID: blogPostAttachment.did, fileName });
|
|
14
|
+
};
|
|
15
|
+
const handleMouseLeave = (e) => {
|
|
16
|
+
e.currentTarget.style.boxShadow = '0 2px 4px rgba(0, 0, 0, 0.1)';
|
|
17
|
+
e.currentTarget.style.backgroundColor = isSelected ? "#135596" : "#ffffff";
|
|
18
|
+
handleAttachmentFocus(undefined);
|
|
19
|
+
};
|
|
20
|
+
const onDoubleClick = (e, blogPostAttachment, name, fileExt) => {
|
|
21
|
+
const archiveID = SDK_Globals.tmSession?.SessionDescr?.archiveID;
|
|
22
|
+
const fileName = `${removeFileExtension(name)}_${archiveID}_${blogPostAttachment.tid}_${blogPostAttachment.did}.${fileExt}`;
|
|
23
|
+
openDcmtForm({ TID: blogPostAttachment.tid, DID: blogPostAttachment.did, fileName });
|
|
24
|
+
};
|
|
25
|
+
return _jsx("div", { style: { width: "100%", marginTop: "5px", overflow: "hidden" }, children: attachments.map((blogPostAttachment) => {
|
|
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: {
|
|
28
|
+
display: 'inline-flex',
|
|
29
|
+
padding: '4px 8px',
|
|
30
|
+
margin: '4px',
|
|
31
|
+
border: '1px solid #ddd',
|
|
32
|
+
borderRadius: '8px',
|
|
33
|
+
boxShadow: '0 2px 4px rgba(0, 0, 0, 0.1)',
|
|
34
|
+
backgroundColor: isSelected ? "#135596" : "#ffffff",
|
|
35
|
+
cursor: "pointer",
|
|
36
|
+
fontSize: '0.9rem',
|
|
37
|
+
color: isSelected ? "#ffffff" : "#000000",
|
|
38
|
+
}, children: _jsxs("div", { style: { alignItems: 'center', display: 'flex' }, children: [(!archivedDocumentsExist && !draftExist) ?
|
|
39
|
+
_jsx(IconAttachment, { style: { marginRight: "5px" } }) :
|
|
40
|
+
_jsx("div", { style: { marginRight: "10px" }, children: _jsx(TMDcmtIcon, { tid: blogPostAttachment.tid, did: blogPostAttachment.did, fileExtension: fileExt, downloadMode: 'openInNewWindow', tooltipContent: tooltipContent }) }), _jsx("span", { style: { whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }, children: nameElement })] }) }, blogPostAttachment.did);
|
|
41
|
+
}) });
|
|
42
|
+
};
|
|
43
|
+
export default TMBlogAttachments;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { BlogPost, HomeBlogPost } from "@topconsultnpm/sdk-ts";
|
|
3
|
+
import { TMBlogsFilterCategoryId, TMBlogsFilterCategoryIdDataSource } from "./TMBlogsPostUtils";
|
|
4
|
+
interface TMBlogHeaderProps {
|
|
5
|
+
/** Visibility of the component */
|
|
6
|
+
isVisible: boolean;
|
|
7
|
+
/** Layout mode of the component */
|
|
8
|
+
layoutMode: "compact" | "extended";
|
|
9
|
+
/** Optional height of the component (CSS value) */
|
|
10
|
+
height: string;
|
|
11
|
+
/** Optional width of the component (CSS value) */
|
|
12
|
+
width: string;
|
|
13
|
+
/** An array of blog posts or home blog posts */
|
|
14
|
+
allPosts: Array<BlogPost | HomeBlogPost>;
|
|
15
|
+
/** Number of posts to show */
|
|
16
|
+
postsToShow: number;
|
|
17
|
+
/** Callback when the number of posts to show changes */
|
|
18
|
+
onPostsToShowChange: (postsToShow: number) => void;
|
|
19
|
+
/** Data source for the tree component */
|
|
20
|
+
categoryIdDataSource: Array<TMBlogsFilterCategoryIdDataSource>;
|
|
21
|
+
/** Currently applied global filters */
|
|
22
|
+
appliedCategoryIdFilters: Array<TMBlogsFilterCategoryId>;
|
|
23
|
+
/** Setter for applied global filters */
|
|
24
|
+
setAppliedCategoryIdFilters: React.Dispatch<React.SetStateAction<Array<TMBlogsFilterCategoryId>>>;
|
|
25
|
+
/** Current search text */
|
|
26
|
+
searchText: string;
|
|
27
|
+
/** Callback when the search text changes */
|
|
28
|
+
onSearchChange: (value: string) => void;
|
|
29
|
+
}
|
|
30
|
+
declare const TMBlogHeader: (props: TMBlogHeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
export default TMBlogHeader;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { SDKUI_Localizator } from "../../helper";
|
|
3
|
+
import TMDropDown from "../editors/TMDropDown";
|
|
4
|
+
import TMTreeDropDown from "../editors/TMTreeDropDown";
|
|
5
|
+
import { TMSearchBar } from "../sidebar/TMHeader";
|
|
6
|
+
const TMBlogHeader = (props) => {
|
|
7
|
+
const { isVisible, layoutMode, height, width, allPosts, postsToShow, onPostsToShowChange, categoryIdDataSource, appliedCategoryIdFilters, setAppliedCategoryIdFilters, searchText, onSearchChange } = props;
|
|
8
|
+
// Data source for the number of posts to display in the UI
|
|
9
|
+
const postsToShowDataSource = [
|
|
10
|
+
{ value: 30, display: SDKUI_Localizator.Latest + ' 30' },
|
|
11
|
+
{ value: 50, display: SDKUI_Localizator.Latest + ' 50' },
|
|
12
|
+
{ value: 100, display: SDKUI_Localizator.Latest + ' 100' },
|
|
13
|
+
{ value: allPosts.length, display: SDKUI_Localizator.All + ` (${allPosts.length})` },
|
|
14
|
+
];
|
|
15
|
+
// Function to handle changes in the filter (number of posts to show)
|
|
16
|
+
const handlePostsToShowChange = (e) => {
|
|
17
|
+
if (!e?.target?.value)
|
|
18
|
+
return;
|
|
19
|
+
const value = e.target.value;
|
|
20
|
+
if (value !== undefined) {
|
|
21
|
+
onPostsToShowChange(Number(value));
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
const containerStyle = {
|
|
25
|
+
display: isVisible ? "flex" : "none",
|
|
26
|
+
height: isVisible ? height : "0px",
|
|
27
|
+
width: isVisible ? width : "0px",
|
|
28
|
+
flexDirection: layoutMode === "extended" ? "row" : "column",
|
|
29
|
+
gap: layoutMode === "extended" ? "8px" : "4px",
|
|
30
|
+
alignItems: layoutMode === "extended" ? "center" : "normal",
|
|
31
|
+
justifyContent: layoutMode === "extended" ? "normal" : "center",
|
|
32
|
+
boxShadow: "0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",
|
|
33
|
+
borderBottom: "2px solid transparent",
|
|
34
|
+
backgroundImage: "linear-gradient(white, white), linear-gradient(270deg, #46B5A2 16%, #3BAABC 34%, #3BAABC 34%, #3681AD 54%, #3368A5 72%, #2F549D 88%, #304F99 100%)",
|
|
35
|
+
backgroundOrigin: "border-box",
|
|
36
|
+
backgroundClip: "padding-box, border-box",
|
|
37
|
+
marginLeft: "4px",
|
|
38
|
+
};
|
|
39
|
+
return _jsxs("div", { style: containerStyle, children: [_jsx("div", { children: _jsx(TMSearchBar, { marginLeft: "0px", maxWidth: "100%", searchValue: searchText, onSearchValueChanged: (value) => onSearchChange(value) }) }), layoutMode === "extended" && _jsx("div", { children: _jsx(TMDropDown, { value: postsToShow, dataSource: postsToShowDataSource, onValueChanged: handlePostsToShowChange, elementStyle: { width: '120px', height: '29px' } }) }), _jsx("div", { children: _jsx(TMTreeDropDown, { dataSource: categoryIdDataSource, values: appliedCategoryIdFilters, setValues: setAppliedCategoryIdFilters, displayExpr: false, isValidKey: () => true, elementStyle: { minWidth: '100%', height: '29px' } }) })] });
|
|
40
|
+
};
|
|
41
|
+
export default TMBlogHeader;
|
|
@@ -1,36 +1,27 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { BlogPost, HomeBlogPost
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
interface
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { BlogPost, HomeBlogPost } from "@topconsultnpm/sdk-ts";
|
|
3
|
+
import { DcmtInfo } from "../../ts";
|
|
4
|
+
import { FileItem } from "../base/TMFileManagerUtils";
|
|
5
|
+
import { TMBlogsPostHeader, TMBlogContextDescriptor } from "./TMBlogsPostUtils";
|
|
6
|
+
interface TMBlogsPostProps {
|
|
7
|
+
/** Flag to indicate whether the component is open */
|
|
8
|
+
scrollToSelected: boolean;
|
|
7
9
|
/** Component Identifier */
|
|
8
10
|
id: string;
|
|
9
11
|
/** An array of blog posts or home blog posts */
|
|
10
|
-
|
|
11
|
-
/** Optional
|
|
12
|
-
|
|
13
|
-
/** Optional flag to automatically scroll to the bottom of the list */
|
|
14
|
-
scrollToBottom?: boolean;
|
|
12
|
+
posts: Array<BlogPost | HomeBlogPost>;
|
|
13
|
+
/** Optional display mode */
|
|
14
|
+
displayMode?: "chat" | "stacked";
|
|
15
15
|
/** Optional height of the component (CSS value) */
|
|
16
16
|
height?: string;
|
|
17
17
|
/** Optional width of the component (CSS value) */
|
|
18
18
|
width?: string;
|
|
19
|
+
/** Optional flag to indicate whether to scroll to bottom on new posts */
|
|
20
|
+
scrollToBottom?: boolean;
|
|
19
21
|
/** Optional header configuration object */
|
|
20
|
-
header?:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
/** Flag to display filter options */
|
|
24
|
-
showFilters: boolean;
|
|
25
|
-
/** Flag to display the search bar */
|
|
26
|
-
showSearchBar: boolean;
|
|
27
|
-
/** Flag to display a dropdown menu for selecting posts */
|
|
28
|
-
showPostsDropDown: boolean;
|
|
29
|
-
};
|
|
30
|
-
/** Optional flag to show an icon in the component */
|
|
31
|
-
showIconHeader?: boolean;
|
|
32
|
-
/** Optional color for customizing the appearance */
|
|
33
|
-
color?: string;
|
|
22
|
+
header?: TMBlogsPostHeader;
|
|
23
|
+
/** Optional flag to show extended attachments */
|
|
24
|
+
showExtendedAttachments?: boolean;
|
|
34
25
|
/** Optional file system tree structure */
|
|
35
26
|
treeFs?: FileItem;
|
|
36
27
|
/** Optional map storing the latest draft information, where the key is the draft ID */
|
|
@@ -48,14 +39,8 @@ interface TMBlogsProps {
|
|
|
48
39
|
fileExt: string;
|
|
49
40
|
fileSize: string;
|
|
50
41
|
}>;
|
|
51
|
-
/**
|
|
52
|
-
|
|
53
|
-
/** Optional callback to handle navigation to working groups */
|
|
54
|
-
handleNavigateToWGs?: (selectedWorkingGroupId: number) => void;
|
|
55
|
-
/** Optional boolean to control the visibility of an ID */
|
|
56
|
-
showId?: boolean;
|
|
57
|
-
/** Optional setter function to update the visibility state of an ID */
|
|
58
|
-
setShowId?: React.Dispatch<React.SetStateAction<boolean>>;
|
|
42
|
+
/** Context descriptor for the blog component */
|
|
43
|
+
context?: TMBlogContextDescriptor;
|
|
59
44
|
/** Optional context menu params */
|
|
60
45
|
contextMenuParams?: {
|
|
61
46
|
isShowHideFilterEnabled: boolean;
|
|
@@ -69,34 +54,30 @@ interface TMBlogsProps {
|
|
|
69
54
|
isRefreshEnabled: boolean;
|
|
70
55
|
isCreateContextualTask: boolean;
|
|
71
56
|
};
|
|
72
|
-
/** Optional
|
|
73
|
-
|
|
74
|
-
/** An array of partecipants */
|
|
75
|
-
participants?: Array<UserDescriptor>;
|
|
76
|
-
/** An array of new blog posts ID */
|
|
77
|
-
newPosts?: Array<IDCount>;
|
|
57
|
+
/** Optional flag to show the floating comment button (default: false) */
|
|
58
|
+
showFloatingCommentButton?: boolean;
|
|
78
59
|
/** Show Comment Form Callback */
|
|
79
|
-
showCommentFormCallback?: () => void;
|
|
60
|
+
showCommentFormCallback?: (dcmt: DcmtInfo | undefined) => void;
|
|
80
61
|
/** Show Task Form Callback */
|
|
81
62
|
showTaskFormCallback?: () => void;
|
|
82
|
-
/** Optional
|
|
83
|
-
|
|
84
|
-
/** Optional
|
|
85
|
-
|
|
86
|
-
/** Optional
|
|
87
|
-
|
|
88
|
-
/** Context descriptor for the blog component */
|
|
89
|
-
context?: TMBlogContextDescriptor;
|
|
90
|
-
/** Optional layout mode */
|
|
91
|
-
layoutMode?: 'stacked' | 'chat';
|
|
92
|
-
/** Optional callback to mark blog as read */
|
|
93
|
-
markBlogAsRead?: (blog: BlogPost | undefined) => Promise<void>;
|
|
94
|
-
/** Flag to indicate whether the blog component should automatically select */
|
|
95
|
-
shouldSelectLastBlog?: boolean;
|
|
96
|
-
/** Updates the flag that determines if the blog component should automatically select the last blog. */
|
|
97
|
-
updateShouldSelectLastBlog?: (value: boolean) => void;
|
|
63
|
+
/** Optional refresh callback */
|
|
64
|
+
refreshCallback?: () => Promise<void>;
|
|
65
|
+
/** Optional boolean to control the visibility of an ID */
|
|
66
|
+
showId?: boolean;
|
|
67
|
+
/** Optional setter function to update the visibility state of an ID */
|
|
68
|
+
setShowId?: React.Dispatch<React.SetStateAction<boolean>>;
|
|
98
69
|
/** Refresh Home Page News Callback */
|
|
99
70
|
refreshHomePageNews?: () => Promise<void>;
|
|
71
|
+
/** Optional callback to handle navigation to working groups */
|
|
72
|
+
handleNavigateToWGs?: (blogPost: BlogPost | HomeBlogPost) => void;
|
|
73
|
+
/** Optional callback to handle navigation to dossiers */
|
|
74
|
+
handleNavigateToDossiers?: (blogPost: BlogPost | HomeBlogPost) => void;
|
|
75
|
+
/** Optional callback to mark blog as read */
|
|
76
|
+
markBlogAsRead?: (blog: BlogPost | undefined) => Promise<void>;
|
|
77
|
+
/** Optional blog post to be externally selected */
|
|
78
|
+
externalBlogPost?: BlogPost;
|
|
79
|
+
/** Optional function to reset the external blog post */
|
|
80
|
+
resetExternalBlogPost?: () => void;
|
|
100
81
|
}
|
|
101
|
-
declare const
|
|
102
|
-
export default
|
|
82
|
+
declare const TMBlogsPost: (props: TMBlogsPostProps) => import("react/jsx-runtime").JSX.Element;
|
|
83
|
+
export default TMBlogsPost;
|