@topconsultnpm/sdkui-react-beta 6.14.77 → 6.14.79

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.
@@ -61,7 +61,7 @@ const TMDcmtBlog = ({ tid, did, isVisible }) => {
61
61
  isRefreshEnabled: true,
62
62
  isRestoreEnabled: true,
63
63
  isCreateContextualTask: false
64
- } }) }) }) }), (showCommentForm && tid && did) && _jsx(TMBlogCommentForm, { context: { engine: 'SearchEngine', object: { tid, did } }, onClose: () => setShowCommentForm(false), refreshCallback: () => { fetchDataAsync(tid, did); }, participants: [], showAttachmentsSection: false })] }));
64
+ }, layoutMode: 'chat' }) }) }) }), (showCommentForm && tid && did) && _jsx(TMBlogCommentForm, { context: { engine: 'SearchEngine', object: { tid, did } }, onClose: () => setShowCommentForm(false), refreshCallback: () => { fetchDataAsync(tid, did); }, participants: [], showAttachmentsSection: false })] }));
65
65
  };
66
66
  export default TMDcmtBlog;
67
67
  const StyledContainer = styled.div ` user-select: none; overflow: hidden; background-color: #ffffff; width: calc(100%); height: calc(100%); display: flex; gap: 10px; `;
@@ -10,8 +10,6 @@ interface TMBlogsProps {
10
10
  allData: Array<BlogPost | HomeBlogPost>;
11
11
  /** Optional flag to show extended attachments */
12
12
  showExtendedAttachments?: boolean;
13
- /** Optional view mode for displaying blog posts ('thumbnails' or 'details') */
14
- viewMode?: 'thumbnails' | 'details';
15
13
  /** Optional flag to automatically scroll to the bottom of the list */
16
14
  scrollToBottom?: boolean;
17
15
  /** Optional height of the component (CSS value) */
@@ -3,7 +3,6 @@ import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
3
3
  import { DcmtTypeListCacheService, LayoutModes, ResultTypes, SDK_Globals, WorkingGroupEngine } from "@topconsultnpm/sdk-ts-beta";
4
4
  import { ContextMenu, ScrollView } from 'devextreme-react';
5
5
  import { SDKUI_Localizator, IconAttachment, getExceptionMessage, Globalization, IconBoard } from '../../helper';
6
- import TMDataGrid from '../base/TMDataGrid';
7
6
  import { useDeviceType, DeviceType } from '../base/TMDeviceProvider';
8
7
  import { TMMessageBoxManager, ButtonNames } from '../base/TMPopUp';
9
8
  import TMTooltip from '../base/TMTooltip';
@@ -20,7 +19,7 @@ import TMDcmtForm from '../features/documents/TMDcmtForm';
20
19
  import { TMColors } from '../../utils/theme';
21
20
  let localAbortController = new AbortController();
22
21
  const TMBlogs = (props) => {
23
- const { id, allData, showExtendedAttachments = true, treeFs, draftLatestInfoMap, archivedDocumentMap, updateVisualizedBlogCallback, height, width, scrollToBottom = true, viewMode = 'thumbnails', header, showIconHeader = true, color = colors.PRIMARY_BLUE, handleNavigateToWGs, showId, setShowId, contextMenuParams = {
22
+ const { id, allData, showExtendedAttachments = true, treeFs, draftLatestInfoMap, archivedDocumentMap, updateVisualizedBlogCallback, height, width, scrollToBottom = true, header, showIconHeader = true, color = colors.PRIMARY_BLUE, handleNavigateToWGs, showId, setShowId, contextMenuParams = {
24
23
  isShowHideFilterEnabled: true,
25
24
  isShowHideIDEnaled: true,
26
25
  isCommentEnabled: false,
@@ -37,8 +36,6 @@ const TMBlogs = (props) => {
37
36
  const { abortController, showWaitPanel, waitPanelTitle, showPrimary, waitPanelTextPrimary, waitPanelValuePrimary, waitPanelMaxValuePrimary, showSecondary, waitPanelTextSecondary, waitPanelValueSecondary, waitPanelMaxValueSecondary, downloadDcmtsAsync } = useDcmtOperations();
38
37
  // This avoids unnecessary re-renders by only recalculating when deviceType changes.
39
38
  let isMobile = useMemo(() => { return deviceType === DeviceType.MOBILE; }, [deviceType]);
40
- // State to manage the current rendering mode of the component (either 'thumbnails' or 'details')
41
- const [renderMode, setRenderMode] = useState('thumbnails');
42
39
  // State to store an array of blog posts, which can be either BlogPost or HomeBlogPost type
43
40
  const [blogPosts, setBlogPosts] = useState([]);
44
41
  // State to manage the data source for a tree component
@@ -414,10 +411,6 @@ const TMBlogs = (props) => {
414
411
  if (focusedBlog && focusedBlog.id && filteredBlogs.find(filteredBlog => focusedBlog.id === filteredBlog.id) === undefined)
415
412
  handleFocusedBlog(undefined);
416
413
  }, [allData, appliedGlobalFilters, searchText, postsToShow, currentHeader]);
417
- useEffect(() => {
418
- if (viewMode)
419
- setRenderMode(viewMode);
420
- }, [viewMode]);
421
414
  // Scroll the focused blog post into view
422
415
  useEffect(() => {
423
416
  if (focusedBlog && focusedBlog.id && containerRef.current) {
@@ -441,7 +434,7 @@ const TMBlogs = (props) => {
441
434
  scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
442
435
  }
443
436
  }
444
- }, [blogPosts, viewMode, focusedBlog]);
437
+ }, [blogPosts, focusedBlog]);
445
438
  const attachmentDetails = (attachments, isSelected) => {
446
439
  return _jsx("div", { style: { marginTop: "10px", overflow: "hidden" }, children: attachments.map(attachment => {
447
440
  return AttachmentElement(attachment, treeFs, draftLatestInfoMap, archivedDocumentMap, dcmtTypeDescriptors, isSelected, searchText, color, downloadDcmtsAsync, handleFocusedAttachment, setAnchorEl, contextMenuRef);
@@ -567,100 +560,6 @@ const TMBlogs = (props) => {
567
560
  }, children: renderBlogPostContent(blogPost, index, isOwnComment) }) }, 'blogPostChat-' + id + "-" + blogPost.id)] }, "blog-post-wrapper-" + id + "-" + blogPost.id));
568
561
  }) }) });
569
562
  };
570
- const DataGridView = () => {
571
- const gridRef = useRef(null);
572
- const { abortController, showWaitPanel, waitPanelTitle, showPrimary, waitPanelTextPrimary, waitPanelValuePrimary, waitPanelMaxValuePrimary, showSecondary, waitPanelTextSecondary, waitPanelValueSecondary, waitPanelMaxValueSecondary, downloadDcmtsAsync } = useDcmtOperations();
573
- useEffect(() => {
574
- if (gridRef.current && renderMode === 'details') {
575
- const dataGrid = gridRef.current.instance();
576
- dataGrid.repaint(); // Repaint the grid first
577
- }
578
- if (scrollToBottom && gridRef.current) {
579
- const dataGrid = gridRef.current.instance();
580
- const scrollable = dataGrid.getScrollable();
581
- if (scrollable && scrollable.scrollHeight()) {
582
- // Wait for repaint to finish (if repaint causes a reflow/re-rendering of the grid)
583
- setTimeout(() => {
584
- scrollable.scrollTo({ y: scrollable.scrollHeight() });
585
- }, 0); // Use setTimeout with 0 delay to defer scrolling until after repaint
586
- }
587
- }
588
- }, [renderMode, scrollToBottom]); // Ensure to include scrollToBottom in the dependency array
589
- const cellDefaultRender = useCallback((cellData) => {
590
- const blogPost = cellData.data;
591
- const { isDel, isSys } = blogPost;
592
- return _jsx("div", { style: { color: isSys ? colors.RED : colors.BLACK, textDecoration: isDel ? 'line-through' : 'none' }, children: highlightText(cellData.value, searchText, false) });
593
- }, [searchText]);
594
- const cellOwnerRender = useCallback((cellData) => {
595
- const blogPost = cellData.data;
596
- const { isDel, isSys } = blogPost;
597
- return _jsxs("span", { style: { display: 'inline-flex', alignItems: 'center', }, children: [OwnerInitialsBadge(blogPost), _jsx("span", { style: { color: isSys ? colors.RED : colors.BLACK, textDecoration: isDel ? 'line-through' : 'none', display: 'inline-block' }, children: highlightText(cellData.value, searchText, false) })] });
598
- }, [searchText]);
599
- const cellDescriptionRender = useCallback((cellData) => {
600
- const blogPost = cellData.data;
601
- const { isDel, isSys } = blogPost;
602
- return _jsx("span", { style: { color: isSys ? colors.RED : colors.BLACK, textDecoration: isDel ? 'line-through' : 'none' }, children: _jsx(TMHtmlContentDisplay, { markup: blogPost.description ?? '-', searchText: searchText, isSelected: false }) });
603
- }, [searchText]);
604
- const cellClassIdRender = useCallback((cellData) => {
605
- const blogPost = cellData.data;
606
- let textColor = blogPost.isSys ? colors.RED : colors.BLACK;
607
- let iconColor = textColor;
608
- const classID = blogPost.classID;
609
- if (classID) {
610
- if (classID === 'DS')
611
- iconColor = colors.PRIMARY_ORANGE;
612
- if (classID === 'WG')
613
- iconColor = colors.PRIMARY_GREEN;
614
- }
615
- const headerClickCallback = () => {
616
- const id = blogPost.id;
617
- if (handleNavigateToWGs && id && classID === 'WG')
618
- handleNavigateToWGs(id);
619
- };
620
- return IconAndHeaderElement(blogPost, iconColor, false, headerClickCallback, searchText);
621
- }, []);
622
- const cellAttachmentsRender = useCallback((cellData) => {
623
- const data = cellData.data;
624
- const { attachments } = data;
625
- return _jsx("div", { style: { marginTop: "10px", overflow: "hidden" }, children: (attachments && attachments.length > 0) ? attachments.map(attachment => {
626
- return AttachmentElement(attachment, treeFs, draftLatestInfoMap, archivedDocumentMap, dcmtTypeDescriptors, false, searchText, color, downloadDcmtsAsync, handleFocusedAttachment, setAnchorEl, contextMenuRef);
627
- }) : '' });
628
- }, [treeFs, draftLatestInfoMap, dcmtTypeDescriptors, color, searchText]);
629
- const cellDatetimeRender = useCallback((cellData) => {
630
- const data = cellData.data;
631
- const { value } = cellData;
632
- const { isDel, isSys } = data;
633
- const formattedDate = value ? new Date(value).toLocaleString('en-GB', { day: '2-digit', month: '2-digit', year: 'numeric', hour: '2-digit', minute: '2-digit' }) : '';
634
- return _jsx("div", { style: { color: isSys ? colors.RED : colors.BLACK, textDecoration: isDel ? 'line-through' : 'none' }, children: formattedDate });
635
- }, []);
636
- // Handles focus change in the data grid
637
- const onFocusedRowChanged = useCallback((e) => {
638
- if (e.row)
639
- handleFocusedBlog(e.row.data);
640
- }, []);
641
- const onContextMenuPreparing = (e) => {
642
- if (e === undefined)
643
- return;
644
- if (e.target === 'content') {
645
- e.items = e.items || [];
646
- e.items = contextMenuItems;
647
- }
648
- };
649
- const dataColumns = useMemo(() => {
650
- return [
651
- { dataField: "id", caption: "ID", dataType: 'string', visible: localShowId, cellRender: cellDefaultRender },
652
- { dataField: "ownerName", caption: SDKUI_Localizator.Author, dataType: 'string', visible: true, cellRender: cellOwnerRender },
653
- { dataField: "classID", caption: SDKUI_Localizator.Type, dataType: 'string', visible: showIconHeader, cellRender: cellClassIdRender },
654
- { dataField: "description", caption: SDKUI_Localizator.Description, dataType: 'string', visible: true, cellRender: cellDescriptionRender },
655
- { dataField: "creationTime", caption: SDKUI_Localizator.CreationTime, dataType: 'datetime', visible: true, format: 'dd/MM/yyyy HH:mm', cellRender: cellDatetimeRender },
656
- { dataField: "attachments", caption: SDKUI_Localizator.RefersTo, dataType: 'string', visible: true, cellRender: cellAttachmentsRender },
657
- ];
658
- }, [localShowId, showIconHeader, searchText]);
659
- return _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(TMDataGrid, { ref: gridRef, showSearchPanel: false, dataSource: blogPosts ?? [], dataColumns: dataColumns, selection: { mode: 'none' }, focusedRowKey: focusedBlog?.id, onFocusedRowChanged: onFocusedRowChanged, onContextMenuPreparing: onContextMenuPreparing }) });
660
- };
661
- const toggleViewMode = () => {
662
- setRenderMode((prevViewMode) => (prevViewMode === 'details' ? 'thumbnails' : 'details'));
663
- };
664
563
  // Function to handle changes in the search text
665
564
  const handleSearchChange = (value) => {
666
565
  handleFocusedBlog(undefined);
@@ -709,7 +608,7 @@ const TMBlogs = (props) => {
709
608
  minWidth: isMobile ? '90px' : '120px',
710
609
  width: isMobile ? '90px' : '150px',
711
610
  height: '29px',
712
- } }))] }) }) })), _jsxs("div", { style: { height: `calc(100% - ${currentHeader && !isHeaderHidden ? '50px' : '0px'})`, width: "100%", overflow: 'auto', display: 'block' }, onContextMenu: onContextMenu, children: [_jsx("div", { style: { display: renderMode === 'thumbnails' ? 'block' : 'none', width: "100%", height: "100%" }, children: ThumbnailView() }), _jsx("div", { style: { display: renderMode === 'details' ? 'block' : 'none', width: "100%", height: "100%" }, children: DataGridView() }), anchorEl && _jsx(ContextMenu, { ref: contextMenuRef, dataSource: contextMenuItems, target: anchorEl, onHiding: closeContextMenu })] }), (showDcmtForm && focusedAttachment && focusedAttachment.TID && focusedAttachment.DID) && _jsx(TMDcmtForm, { TID: Number(focusedAttachment.TID), DID: Number(focusedAttachment.DID), layoutMode: LayoutModes.Update, onClose: onCloseDcmtForm, isClosable: true, titleModal: SDKUI_Localizator.Attachment + ": " + focusedAttachment.fileName, isModal: true, widthModal: "95%", heightModal: "95%" }), (showFloatingCommentButton && showCommentFormCallback) && _jsx("button", { style: {
611
+ } }))] }) }) })), _jsxs("div", { style: { height: `calc(100% - ${currentHeader && !isHeaderHidden ? '50px' : '0px'})`, width: "100%", overflow: 'auto', display: 'block' }, onContextMenu: onContextMenu, children: [_jsx("div", { style: { width: "100%", height: "100%" }, children: ThumbnailView() }), anchorEl && _jsx(ContextMenu, { ref: contextMenuRef, dataSource: contextMenuItems, target: anchorEl, onHiding: closeContextMenu })] }), (showDcmtForm && focusedAttachment && focusedAttachment.TID && focusedAttachment.DID) && _jsx(TMDcmtForm, { TID: Number(focusedAttachment.TID), DID: Number(focusedAttachment.DID), layoutMode: LayoutModes.Update, onClose: onCloseDcmtForm, isClosable: true, titleModal: SDKUI_Localizator.Attachment + ": " + focusedAttachment.fileName, isModal: true, widthModal: "95%", heightModal: "95%" }), (showFloatingCommentButton && showCommentFormCallback) && _jsx("button", { style: {
713
612
  position: 'absolute',
714
613
  bottom: '20px',
715
614
  right: '20px',
@@ -726,14 +625,17 @@ const TMBlogs = (props) => {
726
625
  display: 'flex',
727
626
  justifyContent: 'center',
728
627
  alignItems: 'center',
628
+ opacity: 0.3,
729
629
  }, onMouseEnter: (e) => {
730
630
  e.currentTarget.style.backgroundColor = '#D94A9F';
731
631
  e.currentTarget.style.transform = 'scale(1.1)';
732
632
  e.currentTarget.style.boxShadow = '0 4px 12px rgba(37, 89, 165, 0.6)';
633
+ e.currentTarget.style.opacity = '1';
733
634
  }, onMouseLeave: (e) => {
734
635
  e.currentTarget.style.backgroundColor = "#C2388B";
735
636
  e.currentTarget.style.transform = 'scale(1)';
736
637
  e.currentTarget.style.boxShadow = '0 2px 6px rgba(0,0,0,0.2)';
638
+ e.currentTarget.style.opacity = '0.3';
737
639
  }, onClick: () => { showCommentFormCallback(); }, children: _jsx(TMTooltip, { content: SDKUI_Localizator.AddNewComment, children: _jsx("i", { className: "dx-icon-chat", style: { fontSize: !isMobile ? '30px' : '25px' } }) }) })] }) });
738
640
  };
739
641
  export default TMBlogs;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react-beta",
3
- "version": "6.14.77",
3
+ "version": "6.14.79",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",