@topconsultnpm/sdkui-react 6.20.0-dev2.2 → 6.20.0-dev2.4
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 } 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, IconInfo, IconCache } 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, IconInfo, IconCache, IconPlatform } from '../../../helper';
|
|
7
7
|
import { useDcmtOperations } from '../../../hooks/useDcmtOperations';
|
|
8
8
|
import { useInputAttachmentsDialog, useInputCvtFormatDialog } from '../../../hooks/useInputDialog';
|
|
9
9
|
import { useRelatedDocuments } from '../../../hooks/useRelatedDocuments';
|
|
@@ -101,6 +101,7 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
|
|
|
101
101
|
const [indexingInfoCache, setIndexingInfoCache] = useState(new Map());
|
|
102
102
|
const [showIndexingInfo, setShowIndexingInfo] = useState(false);
|
|
103
103
|
const [loadingIndexingInfo, setLoadingIndexingInfo] = useState(false);
|
|
104
|
+
const [openedDrawerItems, setOpenedDrawerItems] = useState(new Set());
|
|
104
105
|
const floatingBarContainerRef = useRef(null);
|
|
105
106
|
const [confirmFormat, ConfirmFormatDialog] = useInputCvtFormatDialog();
|
|
106
107
|
const { openConfirmAttachmentsDialog, ConfirmAttachmentsDialog } = useInputAttachmentsDialog();
|
|
@@ -736,23 +737,49 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
|
|
|
736
737
|
const tmBlog = useMemo(() => _jsx(TMDcmtBlog, { tid: focusedItem?.TID, did: focusedItem?.DID, fetchBlogDataTrigger: refreshBlogTrigger, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }), [focusedItem, allTasks, refreshBlogTrigger, handleNavigateToWGs, handleNavigateToDossiers]);
|
|
737
738
|
const tmSysMetadata = useMemo(() => _jsx(TMMetadataValues, { layoutMode: LayoutModes.Update, openChooserBySingleClick: true, TID: focusedItem?.TID, isReadOnly: true, deviceType: deviceType, metadataValues: currentMetadataValues.filter(o => (o.mid != undefined && o.mid <= 100)), metadataValuesOrig: currentMetadataValues.filter(o => (o.mid != undefined && o.mid <= 100)), validationItems: [] }), [focusedItem, currentMetadataValues, deviceType]);
|
|
738
739
|
const tmDcmtPreview = useMemo(() => _jsx(TMDcmtPreviewWrapper, { currentDcmt: currentDcmt }, refreshPreviewTrigger), [currentDcmt, refreshPreviewTrigger]);
|
|
740
|
+
useEffect(() => {
|
|
741
|
+
if (!focusedItem)
|
|
742
|
+
return;
|
|
743
|
+
const cacheKey = `${focusedItem.TID}-${focusedItem.DID}`;
|
|
744
|
+
setShowIndexingInfo(openedDrawerItems.has(cacheKey));
|
|
745
|
+
}, [focusedItem, openedDrawerItems]);
|
|
739
746
|
const handleToggleIndexingInfo = async () => {
|
|
740
747
|
if (!focusedItem)
|
|
741
748
|
return;
|
|
749
|
+
const cacheKey = `${focusedItem.TID}-${focusedItem.DID}`;
|
|
742
750
|
if (showIndexingInfo) {
|
|
751
|
+
setOpenedDrawerItems(prev => {
|
|
752
|
+
const newSet = new Set(prev);
|
|
753
|
+
newSet.delete(cacheKey);
|
|
754
|
+
return newSet;
|
|
755
|
+
});
|
|
743
756
|
setShowIndexingInfo(false);
|
|
744
757
|
return;
|
|
745
758
|
}
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
759
|
+
setOpenedDrawerItems(prev => new Set(prev).add(cacheKey));
|
|
760
|
+
setShowIndexingInfo(true);
|
|
761
|
+
if (!indexingInfoCache.has(cacheKey)) {
|
|
762
|
+
try {
|
|
763
|
+
setLoadingIndexingInfo(true);
|
|
764
|
+
const msg = await SDK_Globals.tmSession?.NewSearchEngine().FreeSearchGetDcmtInfoAsync(focusedItem.TID, focusedItem.DID);
|
|
765
|
+
setIndexingInfoCache(prev => new Map(prev).set(cacheKey, msg ?? ''));
|
|
766
|
+
}
|
|
767
|
+
catch (e) {
|
|
768
|
+
TMExceptionBoxManager.show({ exception: e });
|
|
769
|
+
}
|
|
770
|
+
finally {
|
|
771
|
+
setLoadingIndexingInfo(false);
|
|
772
|
+
}
|
|
750
773
|
}
|
|
774
|
+
};
|
|
775
|
+
const handleRefreshIndexingInfo = async () => {
|
|
776
|
+
if (!focusedItem)
|
|
777
|
+
return;
|
|
778
|
+
const cacheKey = `${focusedItem.TID}-${focusedItem.DID}`;
|
|
751
779
|
try {
|
|
752
780
|
setLoadingIndexingInfo(true);
|
|
753
781
|
const msg = await SDK_Globals.tmSession?.NewSearchEngine().FreeSearchGetDcmtInfoAsync(focusedItem.TID, focusedItem.DID);
|
|
754
782
|
setIndexingInfoCache(prev => new Map(prev).set(cacheKey, msg ?? ''));
|
|
755
|
-
setShowIndexingInfo(true);
|
|
756
783
|
}
|
|
757
784
|
catch (e) {
|
|
758
785
|
TMExceptionBoxManager.show({ exception: e });
|
|
@@ -780,21 +807,21 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
|
|
|
780
807
|
}
|
|
781
808
|
const cacheKey = `${focusedItem.TID}-${focusedItem.DID}`;
|
|
782
809
|
const cachedInfo = indexingInfoCache.get(cacheKey);
|
|
783
|
-
return (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', height: '100%', overflow: 'hidden' }, 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(IconInfo, {}), _jsx("span", { children: showIndexingInfo ? 'Nascondi
|
|
810
|
+
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(IconInfo, {}), _jsx("span", { children: showIndexingInfo ? 'Nascondi' : SDKUI_Localizator.IndexingInformation })] }), _jsxs(StyledRightContent, { children: [cachedInfo && (_jsxs(_Fragment, { children: [_jsx(TMTooltip, { content: "Aggiorna", children: _jsx(StyledRefreshIcon, { onClick: (e) => { e.stopPropagation(); handleRefreshIndexingInfo(); }, children: _jsx(IconRefresh, {}) }) }), _jsx(TMTooltip, { content: "Da cache", children: _jsx(StyledCachedIcon, { children: _jsx(IconCache, {}) }) })] })), _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, "..."] }))] }))] })] }));
|
|
784
811
|
}, [selectedSearchResult, focusedItem, indexingInfoCache, showIndexingInfo, loadingIndexingInfo]);
|
|
785
812
|
const allInitialPanelVisibility = {
|
|
786
813
|
'tmSearchResult': true,
|
|
787
814
|
'tmBlog': false,
|
|
788
815
|
'tmSysMetadata': false,
|
|
789
816
|
'tmDcmtPreview': false,
|
|
790
|
-
|
|
817
|
+
'tmFullTextSearch': false,
|
|
791
818
|
};
|
|
792
819
|
const initialPanelDimensions = {
|
|
793
820
|
'tmSearchResult': { width: '25%', height: '100%' },
|
|
794
821
|
'tmBlog': { width: '25%', height: '100%' },
|
|
795
822
|
'tmSysMetadata': { width: '25%', height: '100%' },
|
|
796
823
|
'tmDcmtPreview': { width: '25%', height: '100%' },
|
|
797
|
-
|
|
824
|
+
'tmFullTextSearch': { width: '25%', height: '100%' },
|
|
798
825
|
};
|
|
799
826
|
const initialPanels = useMemo(() => [
|
|
800
827
|
{
|
|
@@ -833,14 +860,14 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
|
|
|
833
860
|
contentOptions: { component: tmDcmtPreview },
|
|
834
861
|
toolbarOptions: { icon: _jsx(IconShow, { fontSize: 24 }), visible: true, orderNumber: 4, isActive: allInitialPanelVisibility['tmDcmtPreview'] }
|
|
835
862
|
},
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
863
|
+
...(context === SearchResultContext.FREE_SEARCH ? [
|
|
864
|
+
{
|
|
865
|
+
id: 'tmFullTextSearch',
|
|
866
|
+
name: SDKUI_Localizator.ResultDetails,
|
|
867
|
+
contentOptions: { component: tmFullTextSearch, panelContainer: { title: SDKUI_Localizator.ResultDetails, allowMaximize: !isMobile } },
|
|
868
|
+
toolbarOptions: { icon: _jsx(IconPlatform, { fontSize: 20 }), visible: true, orderNumber: 5, isActive: allInitialPanelVisibility['tmFullTextSearch'] }
|
|
869
|
+
}
|
|
870
|
+
] : [])
|
|
844
871
|
], [tmSearchResult, tmBlog, tmSysMetadata, tmDcmtPreview, tmFullTextSearch, showToolbarHeader, context, isMobile]);
|
|
845
872
|
return (_jsxs(StyledMultiViewPanel, { "$isVisible": isVisible, children: [_jsx(StyledMultiViewPanel, { "$isVisible": !isOpenDcmtForm && !isOpenDetails && !isOpenMaster, style: {
|
|
846
873
|
display: 'flex',
|
|
@@ -1408,10 +1435,14 @@ const StyledCachedIcon = styled.div `
|
|
|
1408
1435
|
justify-content: center;
|
|
1409
1436
|
color: #4CAF50;
|
|
1410
1437
|
font-size: 16px;
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1438
|
+
`;
|
|
1439
|
+
const StyledRefreshIcon = styled.div `
|
|
1440
|
+
display: flex;
|
|
1441
|
+
align-items: center;
|
|
1442
|
+
justify-content: center;
|
|
1443
|
+
font-size: 16px;
|
|
1444
|
+
cursor: pointer;
|
|
1445
|
+
transition: transform 0.2s ease;
|
|
1415
1446
|
`;
|
|
1416
1447
|
const StyledChevron = styled.span `
|
|
1417
1448
|
transition: transform 0.2s ease;
|
|
@@ -1420,6 +1451,7 @@ const StyledChevron = styled.span `
|
|
|
1420
1451
|
font-size: 12px;
|
|
1421
1452
|
`;
|
|
1422
1453
|
const StyledIndexingInfoBox = styled.div `
|
|
1454
|
+
position: relative;
|
|
1423
1455
|
background: white;
|
|
1424
1456
|
border: 1px solid #e0e0e0;
|
|
1425
1457
|
border-radius: 6px;
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@topconsultnpm/sdkui-react",
|
|
3
|
-
"version": "6.20.0-dev2.
|
|
3
|
+
"version": "6.20.0-dev2.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"scripts": {
|
|
6
|
-
"test": "echo \"Error: no test specified\"
|
|
6
|
+
"test": "echo \"Error: no test specified\" \u0026\u0026 exit 1",
|
|
7
7
|
"clean": "powershell Remove-Item lib/ -recurse",
|
|
8
8
|
"copy-files": "copyfiles -u 1 src/assets/*.* src/assets/ImageLibrary/*.* src/assets/thumbnails/*.* src/assets/IconsS4t/*.* src/assets/Metadata/*.* src/css/tm-sdkui.css lib/",
|
|
9
|
-
"tm-build": "npm run clean
|
|
9
|
+
"tm-build": "npm run clean \u0026\u0026 tsc \u0026\u0026 npm run copy-files",
|
|
10
10
|
"tm-watch": "tsc -w",
|
|
11
11
|
"tm-publish": "npm publish --tag latest",
|
|
12
12
|
"tm-publish_wl": "npm publish",
|
|
@@ -40,18 +40,18 @@
|
|
|
40
40
|
"lib"
|
|
41
41
|
],
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"
|
|
43
|
+
"react-router-dom": "^6.15.0",
|
|
44
|
+
"react-pdf": "^10.3.0",
|
|
45
|
+
"htmlparser2": "^10.0.0",
|
|
44
46
|
"buffer": "^6.0.3",
|
|
45
|
-
"
|
|
46
|
-
"devextreme-react": "25.2.4",
|
|
47
|
+
"@topconsultnpm/sdk-ts": "6.20.0-test1",
|
|
47
48
|
"exceljs": "^4.4.0",
|
|
48
|
-
"
|
|
49
|
+
"devextreme": "25.2.4",
|
|
50
|
+
"styled-components": "^6.1.1",
|
|
49
51
|
"pdfjs-dist": "5.4.296",
|
|
50
|
-
"react
|
|
51
|
-
"react-router-dom": "^6.15.0",
|
|
52
|
-
"styled-components": "^6.1.1"
|
|
52
|
+
"devextreme-react": "25.2.4"
|
|
53
53
|
},
|
|
54
54
|
"overrides": {
|
|
55
55
|
"esbuild": "^0.25.0"
|
|
56
56
|
}
|
|
57
|
-
}
|
|
57
|
+
}
|