@topconsultnpm/sdkui-react 6.20.0-dev2.23 → 6.20.0-dev2.24

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.
@@ -3,7 +3,7 @@ import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
3
3
  import { SDK_Globals, DataColumnTypes, MetadataDataDomains, DataListViewModes, MetadataFormats, LayoutModes, DcmtTypeListCacheService, SystemMIDsAsNumber, RetrieveFileOptions, DcmtOpers, GeneralRetrieveFormats, AccessLevelsEx, LayoutCacheService, UserListCacheService, AppModules } from '@topconsultnpm/sdk-ts';
4
4
  import styled from 'styled-components';
5
5
  import { getAllFieldSelectedDcmtsOrFocused, getCommandsMenuItems, getSelectedDcmtsOrFocused } from './TMSearchResultsMenuItems';
6
- import { genUniqueId, IconShow, IconBoard, IconDcmtTypeSys, SDKUI_Localizator, IconDelete, IconRefresh, IconMenuVertical, deepCompare, generateUniqueColumnKeys, searchResultDescriptorToSimpleArray, searchResultToMetadataValues, IconSearchCheck, TMImageLibrary, convertSearchResultDescriptorToFileItems, IconCustom, isApprovalWorkflowView, SDKUI_Globals, getMoreInfoTasksForDocument, IconCache, IconPlatform, getSearchToolbarVisibility } from '../../../helper';
6
+ import { genUniqueId, IconShow, IconBoard, IconDcmtTypeSys, SDKUI_Localizator, IconDelete, IconRefresh, IconMenuVertical, deepCompare, generateUniqueColumnKeys, searchResultDescriptorToSimpleArray, searchResultToMetadataValues, IconSearchCheck, TMImageLibrary, convertSearchResultDescriptorToFileItems, IconCustom, isApprovalWorkflowView, SDKUI_Globals, getMoreInfoTasksForDocument, IconPlatform, getSearchToolbarVisibility } from '../../../helper';
7
7
  import { useDcmtOperations } from '../../../hooks/useDcmtOperations';
8
8
  import { useInputAttachmentsDialog, useInputCvtFormatDialog } from '../../../hooks/useInputDialog';
9
9
  import { useRelatedDocuments } from '../../../hooks/useRelatedDocuments';
@@ -36,7 +36,6 @@ import ShowAlert from '../../base/TMAlert';
36
36
  import TMSpinner from '../../base/TMSpinner';
37
37
  import TMChooserForm from '../../forms/TMChooserForm';
38
38
  import TMModal from '../../base/TMModal';
39
- import TMTooltip from '../../base/TMTooltip';
40
39
  import TMSearch from './TMSearch';
41
40
  import TMArchive from '../archive/TMArchive';
42
41
  import TMCustomButton from '../../base/TMCustomButton';
@@ -98,9 +97,9 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
98
97
  // State to control whether the export form (for exporting to Excel/CSV/txt and others) should be shown
99
98
  const [showExportForm, setShowExportForm] = useState(false);
100
99
  const [showSignSettingsForm, setShowSignSettingsForm] = useState(false);
101
- const [indexingInfoCache, setIndexingInfoCache] = useState(new Map());
102
100
  const [showIndexingInfo, setShowIndexingInfo] = useState(false);
103
101
  const [loadingIndexingInfo, setLoadingIndexingInfo] = useState(false);
102
+ const [indexingInfo, setIndexingInfo] = useState('');
104
103
  const floatingBarContainerRef = useRef(null);
105
104
  const [confirmFormat, ConfirmFormatDialog] = useInputCvtFormatDialog();
106
105
  const { openConfirmAttachmentsDialog, ConfirmAttachmentsDialog } = useInputAttachmentsDialog();
@@ -740,23 +739,20 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
740
739
  useEffect(() => {
741
740
  if (!focusedItem || !showIndexingInfo)
742
741
  return;
743
- const cacheKey = `${focusedItem.TID}-${focusedItem.DID}`;
744
- if (!indexingInfoCache.has(cacheKey)) {
745
- const fetchData = async () => {
746
- try {
747
- setLoadingIndexingInfo(true);
748
- const msg = await SDK_Globals.tmSession?.NewSearchEngine().FreeSearchGetDcmtInfoAsync(focusedItem.TID, focusedItem.DID);
749
- setIndexingInfoCache(prev => new Map(prev).set(cacheKey, msg ?? ''));
750
- }
751
- catch (e) {
752
- TMExceptionBoxManager.show({ exception: e });
753
- }
754
- finally {
755
- setLoadingIndexingInfo(false);
756
- }
757
- };
758
- fetchData();
759
- }
742
+ const fetchData = async () => {
743
+ try {
744
+ setLoadingIndexingInfo(true);
745
+ const msg = await SDK_Globals.tmSession?.NewSearchEngine().FreeSearchGetDcmtInfoAsync(focusedItem.TID, focusedItem.DID);
746
+ setIndexingInfo(msg ?? '');
747
+ }
748
+ catch (e) {
749
+ TMExceptionBoxManager.show({ exception: e });
750
+ }
751
+ finally {
752
+ setLoadingIndexingInfo(false);
753
+ }
754
+ };
755
+ fetchData();
760
756
  }, [focusedItem, showIndexingInfo]);
761
757
  const handleToggleIndexingInfo = async () => {
762
758
  if (!focusedItem)
@@ -764,36 +760,17 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
764
760
  const newShowState = !showIndexingInfo;
765
761
  setShowIndexingInfo(newShowState);
766
762
  if (newShowState) {
767
- const cacheKey = `${focusedItem.TID}-${focusedItem.DID}`;
768
- if (!indexingInfoCache.has(cacheKey)) {
769
- try {
770
- setLoadingIndexingInfo(true);
771
- const msg = await SDK_Globals.tmSession?.NewSearchEngine().FreeSearchGetDcmtInfoAsync(focusedItem.TID, focusedItem.DID);
772
- setIndexingInfoCache(prev => new Map(prev).set(cacheKey, msg ?? ''));
773
- }
774
- catch (e) {
775
- TMExceptionBoxManager.show({ exception: e });
776
- }
777
- finally {
778
- setLoadingIndexingInfo(false);
779
- }
763
+ try {
764
+ setLoadingIndexingInfo(true);
765
+ const msg = await SDK_Globals.tmSession?.NewSearchEngine().FreeSearchGetDcmtInfoAsync(focusedItem.TID, focusedItem.DID);
766
+ setIndexingInfo(msg ?? '');
767
+ }
768
+ catch (e) {
769
+ TMExceptionBoxManager.show({ exception: e });
770
+ }
771
+ finally {
772
+ setLoadingIndexingInfo(false);
780
773
  }
781
- }
782
- };
783
- const handleRefreshIndexingInfo = async () => {
784
- if (!focusedItem)
785
- return;
786
- const cacheKey = `${focusedItem.TID}-${focusedItem.DID}`;
787
- try {
788
- setLoadingIndexingInfo(true);
789
- const msg = await SDK_Globals.tmSession?.NewSearchEngine().FreeSearchGetDcmtInfoAsync(focusedItem.TID, focusedItem.DID);
790
- setIndexingInfoCache(prev => new Map(prev).set(cacheKey, msg ?? ''));
791
- }
792
- catch (e) {
793
- TMExceptionBoxManager.show({ exception: e });
794
- }
795
- finally {
796
- setLoadingIndexingInfo(false);
797
774
  }
798
775
  };
799
776
  const tmFullTextSearch = useMemo(() => {
@@ -812,10 +789,8 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
812
789
  if (!ftExplanation) {
813
790
  return (_jsxs(StyledPlaceholder, { children: [" ", _jsx("p", { children: "Nessuna info disponibile per questo documento" }), " "] }));
814
791
  }
815
- const cacheKey = `${focusedItem.TID}-${focusedItem.DID}`;
816
- const cachedInfo = indexingInfoCache.get(cacheKey);
817
- return (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', height: '100%', overflow: 'hidden', width: '100%' }, children: [_jsx("div", { style: { padding: '10px', overflow: 'auto', flex: 1 }, children: _jsx("div", { dangerouslySetInnerHTML: { __html: ftExplanation } }) }), _jsxs(StyledIndexingInfoSection, { children: [_jsxs(StyledIndexingToggle, { onClick: handleToggleIndexingInfo, disabled: loadingIndexingInfo, children: [_jsxs(StyledLeftContent, { children: [_jsx("span", { children: SDKUI_Localizator.IndexingInformation }), cachedInfo && (_jsx(TMTooltip, { content: "Da cache", children: _jsx(StyledCachedIcon, { children: _jsx(IconCache, { fontSize: 13 }) }) }))] }), _jsxs(StyledRightContent, { children: [cachedInfo && (_jsx(TMTooltip, { content: "Aggiorna", children: _jsx(StyledRefreshIcon, { onClick: (e) => { e.stopPropagation(); handleRefreshIndexingInfo(); }, children: _jsx(IconRefresh, {}) }) })), _jsx(StyledChevron, { "$isOpen": showIndexingInfo, children: "\u25BC" })] })] }), loadingIndexingInfo && !cachedInfo && (_jsxs("div", { style: { marginTop: '10px', color: '#666' }, children: [SDKUI_Localizator.Loading, "..."] })), showIndexingInfo && cachedInfo && (_jsxs(StyledIndexingInfoBox, { children: [_jsx("div", { dangerouslySetInnerHTML: { __html: cachedInfo } }), loadingIndexingInfo && (_jsxs("div", { style: { position: 'absolute', top: '50%', left: '50%', transform: 'translate(-50%, -50%)', background: 'rgba(255, 255, 255, 0.9)', padding: '10px', borderRadius: '4px', boxShadow: '0 2px 8px rgba(0,0,0,0.15)' }, children: [SDKUI_Localizator.Loading, "..."] }))] }))] })] }));
818
- }, [selectedSearchResult, focusedItem, indexingInfoCache, showIndexingInfo, loadingIndexingInfo, handleRefreshIndexingInfo]);
792
+ return (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', height: '100%', overflow: 'hidden', width: '100%' }, children: [_jsx("div", { style: { padding: '10px', overflow: 'auto', flex: 1 }, children: _jsx("div", { dangerouslySetInnerHTML: { __html: ftExplanation } }) }), _jsxs(StyledIndexingInfoSection, { children: [_jsxs(StyledIndexingToggle, { onClick: handleToggleIndexingInfo, disabled: loadingIndexingInfo, children: [_jsx(StyledLeftContent, { children: _jsx("span", { children: SDKUI_Localizator.IndexingInformation }) }), _jsx(StyledRightContent, { children: _jsx(StyledChevron, { "$isOpen": showIndexingInfo, children: "\u25BC" }) })] }), showIndexingInfo && indexingInfo && (_jsxs(StyledIndexingInfoBox, { children: [_jsx("div", { dangerouslySetInnerHTML: { __html: indexingInfo } }), loadingIndexingInfo && (_jsxs("div", { style: { position: 'absolute', top: '50%', left: '50%', transform: 'translate(-50%, -50%)', background: 'rgba(255, 255, 255, 0.9)', padding: '10px', borderRadius: '4px', boxShadow: '0 2px 8px rgba(0,0,0,0.15)' }, children: [SDKUI_Localizator.Loading, "..."] }))] }))] })] }));
793
+ }, [selectedSearchResult, focusedItem, indexingInfo, showIndexingInfo, loadingIndexingInfo]);
819
794
  const allInitialPanelVisibility = {
820
795
  'tmSearchResult': true,
821
796
  'tmBlog': false,
@@ -861,12 +836,6 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
861
836
  contentOptions: { component: tmSysMetadata, panelContainer: { title: SDKUI_Localizator.MetadataSystem, allowMaximize: !isMobile } },
862
837
  toolbarOptions: { icon: _jsx(IconDcmtTypeSys, { fontSize: 24 }), visible: getSearchToolbarVisibility(SDK_Globals.tmSession?.SessionDescr?.appModuleID ?? AppModules.SURFER).tmSysMetadata, orderNumber: 3, isActive: allInitialPanelVisibility['tmSysMetadata'] }
863
838
  },
864
- {
865
- id: 'tmDcmtPreview',
866
- name: SDKUI_Localizator.PreviewDocument,
867
- contentOptions: { component: tmDcmtPreview },
868
- toolbarOptions: { icon: _jsx(IconShow, { fontSize: 24 }), visible: getSearchToolbarVisibility(SDK_Globals.tmSession?.SessionDescr?.appModuleID ?? AppModules.SURFER).tmDcmtPreview, orderNumber: context === SearchResultContext.FREE_SEARCH ? 5 : 4, isActive: allInitialPanelVisibility['tmDcmtPreview'] }
869
- },
870
839
  ...(context === SearchResultContext.FREE_SEARCH ? [
871
840
  {
872
841
  id: 'tmFullTextSearch',
@@ -874,7 +843,13 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
874
843
  contentOptions: { component: tmFullTextSearch, panelContainer: { title: SDKUI_Localizator.ResultDetails, allowMaximize: !isMobile } },
875
844
  toolbarOptions: { icon: _jsx(IconPlatform, { fontSize: 20 }), visible: getSearchToolbarVisibility(SDK_Globals.tmSession?.SessionDescr?.appModuleID ?? AppModules.SURFER).tmFullTextSearch, orderNumber: 4, isActive: allInitialPanelVisibility['tmFullTextSearch'] }
876
845
  }
877
- ] : [])
846
+ ] : []),
847
+ {
848
+ id: 'tmDcmtPreview',
849
+ name: SDKUI_Localizator.PreviewDocument,
850
+ contentOptions: { component: tmDcmtPreview },
851
+ toolbarOptions: { icon: _jsx(IconShow, { fontSize: 24 }), visible: getSearchToolbarVisibility(SDK_Globals.tmSession?.SessionDescr?.appModuleID ?? AppModules.SURFER).tmDcmtPreview, orderNumber: context === SearchResultContext.FREE_SEARCH ? 5 : 4, isActive: allInitialPanelVisibility['tmDcmtPreview'] }
852
+ }
878
853
  ], [tmSearchResult, tmBlog, tmSysMetadata, tmDcmtPreview, tmFullTextSearch, showToolbarHeader, context, isMobile]);
879
854
  return (_jsxs(StyledMultiViewPanel, { "$isVisible": isVisible, children: [_jsx(StyledMultiViewPanel, { "$isVisible": !isOpenDcmtForm && !isOpenDetails && !isOpenMaster, style: {
880
855
  display: 'flex',
@@ -1431,20 +1406,6 @@ const StyledRightContent = styled.div `
1431
1406
  align-items: center;
1432
1407
  gap: 8px;
1433
1408
  `;
1434
- const StyledCachedIcon = styled.div `
1435
- display: flex;
1436
- align-items: center;
1437
- justify-content: center;
1438
- font-size: 16px;
1439
- `;
1440
- const StyledRefreshIcon = styled.div `
1441
- display: flex;
1442
- align-items: center;
1443
- justify-content: center;
1444
- font-size: 16px;
1445
- cursor: pointer;
1446
- transition: transform 0.2s ease;
1447
- `;
1448
1409
  const StyledChevron = styled.span `
1449
1410
  transition: transform 0.2s ease;
1450
1411
  transform: ${props => props.$isOpen ? 'rotate(180deg)' : 'rotate(0deg)'};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react",
3
- "version": "6.20.0-dev2.23",
3
+ "version": "6.20.0-dev2.24",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",