@topconsultnpm/sdkui-react 6.20.0-dev1.129 → 6.20.0-dev1.130
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 } 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 } 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,6 +36,7 @@ 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';
|
|
39
40
|
import TMSearch from './TMSearch';
|
|
40
41
|
import TMArchive from '../archive/TMArchive';
|
|
41
42
|
import TMCustomButton from '../../base/TMCustomButton';
|
|
@@ -97,6 +98,9 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
|
|
|
97
98
|
// State to control whether the export form (for exporting to Excel/CSV/txt and others) should be shown
|
|
98
99
|
const [showExportForm, setShowExportForm] = useState(false);
|
|
99
100
|
const [showSignSettingsForm, setShowSignSettingsForm] = useState(false);
|
|
101
|
+
const [indexingInfoCache, setIndexingInfoCache] = useState(new Map());
|
|
102
|
+
const [showIndexingInfo, setShowIndexingInfo] = useState(false);
|
|
103
|
+
const [loadingIndexingInfo, setLoadingIndexingInfo] = useState(false);
|
|
100
104
|
const floatingBarContainerRef = useRef(null);
|
|
101
105
|
const [confirmFormat, ConfirmFormatDialog] = useInputCvtFormatDialog();
|
|
102
106
|
const { openConfirmAttachmentsDialog, ConfirmAttachmentsDialog } = useInputAttachmentsDialog();
|
|
@@ -732,17 +736,65 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
|
|
|
732
736
|
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]);
|
|
733
737
|
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]);
|
|
734
738
|
const tmDcmtPreview = useMemo(() => _jsx(TMDcmtPreviewWrapper, { currentDcmt: currentDcmt }, refreshPreviewTrigger), [currentDcmt, refreshPreviewTrigger]);
|
|
739
|
+
const handleToggleIndexingInfo = async () => {
|
|
740
|
+
if (!focusedItem)
|
|
741
|
+
return;
|
|
742
|
+
if (showIndexingInfo) {
|
|
743
|
+
setShowIndexingInfo(false);
|
|
744
|
+
return;
|
|
745
|
+
}
|
|
746
|
+
const cacheKey = `${focusedItem.TID}-${focusedItem.DID}`;
|
|
747
|
+
if (indexingInfoCache.has(cacheKey)) {
|
|
748
|
+
setShowIndexingInfo(true);
|
|
749
|
+
return;
|
|
750
|
+
}
|
|
751
|
+
try {
|
|
752
|
+
setLoadingIndexingInfo(true);
|
|
753
|
+
const msg = await SDK_Globals.tmSession?.NewSearchEngine().FreeSearchGetDcmtInfoAsync(focusedItem.TID, focusedItem.DID);
|
|
754
|
+
setIndexingInfoCache(prev => new Map(prev).set(cacheKey, msg ?? ''));
|
|
755
|
+
setShowIndexingInfo(true);
|
|
756
|
+
}
|
|
757
|
+
catch (e) {
|
|
758
|
+
TMExceptionBoxManager.show({ exception: e });
|
|
759
|
+
}
|
|
760
|
+
finally {
|
|
761
|
+
setLoadingIndexingInfo(false);
|
|
762
|
+
}
|
|
763
|
+
};
|
|
764
|
+
const tmFullTextSearch = useMemo(() => {
|
|
765
|
+
if (!focusedItem) {
|
|
766
|
+
return (_jsxs(StyledPlaceholder, { children: [" ", _jsx("p", { children: "Seleziona un documento per visualizzare i dettagli della ricerca full-text" }), " "] }));
|
|
767
|
+
}
|
|
768
|
+
// const ftExplanationsColumnIndex = selectedSearchResult?.dtdResult?.columns?.findIndex( col => col.caption === 'FTExplanations' );
|
|
769
|
+
const ftExplanationsColumnIndex = selectedSearchResult?.selectMIDs?.findIndex(mid => mid === 0); //nosonar
|
|
770
|
+
if (ftExplanationsColumnIndex === undefined || ftExplanationsColumnIndex < 0) {
|
|
771
|
+
return (_jsxs(StyledPlaceholder, { children: [" ", _jsx("p", { children: "Nessuna info full-text disponibile" }), " "] }));
|
|
772
|
+
}
|
|
773
|
+
const row = selectedSearchResult?.dtdResult?.rows?.[focusedItem.rowIndex];
|
|
774
|
+
if (!row) {
|
|
775
|
+
return (_jsxs(StyledPlaceholder, { children: [" ", _jsx("p", { children: "Documento non trovato" }), " "] }));
|
|
776
|
+
}
|
|
777
|
+
const ftExplanation = row[ftExplanationsColumnIndex];
|
|
778
|
+
if (!ftExplanation) {
|
|
779
|
+
return (_jsxs(StyledPlaceholder, { children: [" ", _jsx("p", { children: "Nessuna info disponibile per questo documento" }), " "] }));
|
|
780
|
+
}
|
|
781
|
+
const cacheKey = `${focusedItem.TID}-${focusedItem.DID}`;
|
|
782
|
+
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 info' : SDKUI_Localizator.IndexingInformation })] }), _jsxs(StyledRightContent, { children: [cachedInfo && (_jsx(TMTooltip, { content: "Da cache", children: _jsx(StyledCachedIcon, { children: _jsx(IconCache, {}) }) })), _jsx(StyledChevron, { "$isOpen": showIndexingInfo, children: "\u25BC" })] })] }), loadingIndexingInfo && (_jsxs("div", { style: { marginTop: '10px', color: '#666' }, children: [SDKUI_Localizator.Loading, "..."] })), showIndexingInfo && cachedInfo && !loadingIndexingInfo && (_jsx(StyledIndexingInfoBox, { children: _jsx("div", { dangerouslySetInnerHTML: { __html: cachedInfo } }) }))] })] }));
|
|
784
|
+
}, [selectedSearchResult, focusedItem, indexingInfoCache, showIndexingInfo, loadingIndexingInfo]);
|
|
735
785
|
const allInitialPanelVisibility = {
|
|
736
786
|
'tmSearchResult': true,
|
|
737
787
|
'tmBlog': false,
|
|
738
788
|
'tmSysMetadata': false,
|
|
739
789
|
'tmDcmtPreview': false,
|
|
790
|
+
// 'tmFullTextSearch': false,
|
|
740
791
|
};
|
|
741
792
|
const initialPanelDimensions = {
|
|
742
793
|
'tmSearchResult': { width: '25%', height: '100%' },
|
|
743
794
|
'tmBlog': { width: '25%', height: '100%' },
|
|
744
795
|
'tmSysMetadata': { width: '25%', height: '100%' },
|
|
745
796
|
'tmDcmtPreview': { width: '25%', height: '100%' },
|
|
797
|
+
// 'tmFullTextSearch': { width: '25%', height: '100%' },
|
|
746
798
|
};
|
|
747
799
|
const initialPanels = useMemo(() => [
|
|
748
800
|
{
|
|
@@ -780,8 +832,16 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
|
|
|
780
832
|
name: SDKUI_Localizator.PreviewDocument,
|
|
781
833
|
contentOptions: { component: tmDcmtPreview },
|
|
782
834
|
toolbarOptions: { icon: _jsx(IconShow, { fontSize: 24 }), visible: true, orderNumber: 4, isActive: allInitialPanelVisibility['tmDcmtPreview'] }
|
|
783
|
-
}
|
|
784
|
-
|
|
835
|
+
},
|
|
836
|
+
// ...(context === SearchResultContext.FREE_SEARCH ? [
|
|
837
|
+
// {
|
|
838
|
+
// id: 'tmFullTextSearch',
|
|
839
|
+
// name: 'Ricerca FullText',
|
|
840
|
+
// contentOptions: { component: tmFullTextSearch, panelContainer: { title: 'Ricerca FullText', allowMaximize: !isMobile } },
|
|
841
|
+
// toolbarOptions: { icon: <IconMenuFullTextSearch fontSize={24} />, visible: true, orderNumber: 5, isActive: allInitialPanelVisibility['tmFullTextSearch'] }
|
|
842
|
+
// }
|
|
843
|
+
// ] : [])
|
|
844
|
+
], [tmSearchResult, tmBlog, tmSysMetadata, tmDcmtPreview, tmFullTextSearch, showToolbarHeader, context, isMobile]);
|
|
785
845
|
return (_jsxs(StyledMultiViewPanel, { "$isVisible": isVisible, children: [_jsx(StyledMultiViewPanel, { "$isVisible": !isOpenDcmtForm && !isOpenDetails && !isOpenMaster, style: {
|
|
786
846
|
display: 'flex',
|
|
787
847
|
flexDirection: isMobile ? 'column' : 'row',
|
|
@@ -1285,3 +1345,101 @@ const TMDcmtPreviewWrapper = ({ currentDcmt, isVisible }) => {
|
|
|
1285
1345
|
const isMobile = deviceType === DeviceType.MOBILE;
|
|
1286
1346
|
return (_jsx(TMDcmtPreview, { onClosePanel: (!isMobile && countVisibleLeafPanels() > 1) ? () => setPanelVisibilityById('tmDcmtPreview', false) : undefined, allowMaximize: !isMobile && countVisibleLeafPanels() > 1, onMaximizePanel: (!isMobile && countVisibleLeafPanels() > 1) ? () => toggleMaximize("tmDcmtPreview") : undefined, dcmtData: currentDcmt, isResizingActive: isResizingActive, isVisible: isVisible }));
|
|
1287
1347
|
};
|
|
1348
|
+
// Styled Components
|
|
1349
|
+
const StyledPlaceholder = styled.div `
|
|
1350
|
+
padding: 20px;
|
|
1351
|
+
text-align: center;
|
|
1352
|
+
color: #888;
|
|
1353
|
+
`;
|
|
1354
|
+
const StyledIndexingInfoSection = styled.div `
|
|
1355
|
+
padding: 15px;
|
|
1356
|
+
border-top: 1px solid #e0e0e0;
|
|
1357
|
+
background: linear-gradient(to bottom, #f9f9f9, #f5f5f5);
|
|
1358
|
+
display: flex;
|
|
1359
|
+
flex-direction: column;
|
|
1360
|
+
gap: 10px;
|
|
1361
|
+
`;
|
|
1362
|
+
const StyledIndexingToggle = styled.button `
|
|
1363
|
+
display: flex;
|
|
1364
|
+
align-items: center;
|
|
1365
|
+
justify-content: space-between;
|
|
1366
|
+
width: 100%;
|
|
1367
|
+
padding: 10px 16px;
|
|
1368
|
+
background: white;
|
|
1369
|
+
border: 1px solid #d0d0d0;
|
|
1370
|
+
border-radius: 6px;
|
|
1371
|
+
cursor: ${props => props.disabled ? 'not-allowed' : 'pointer'};
|
|
1372
|
+
transition: all 0.2s ease;
|
|
1373
|
+
font-size: 14px;
|
|
1374
|
+
font-weight: 500;
|
|
1375
|
+
color: #333;
|
|
1376
|
+
opacity: ${props => props.disabled ? 0.6 : 1};
|
|
1377
|
+
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
|
|
1378
|
+
|
|
1379
|
+
&:hover:not(:disabled) {
|
|
1380
|
+
background: #f8f8f8;
|
|
1381
|
+
border-color: #2196F3;
|
|
1382
|
+
box-shadow: 0 2px 4px rgba(33, 150, 243, 0.2);
|
|
1383
|
+
}
|
|
1384
|
+
|
|
1385
|
+
&:active:not(:disabled) {
|
|
1386
|
+
transform: translateY(1px);
|
|
1387
|
+
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
|
|
1388
|
+
}
|
|
1389
|
+
|
|
1390
|
+
svg {
|
|
1391
|
+
color: #2196F3;
|
|
1392
|
+
font-size: 18px;
|
|
1393
|
+
}
|
|
1394
|
+
`;
|
|
1395
|
+
const StyledLeftContent = styled.div `
|
|
1396
|
+
display: flex;
|
|
1397
|
+
align-items: center;
|
|
1398
|
+
gap: 8px;
|
|
1399
|
+
`;
|
|
1400
|
+
const StyledRightContent = styled.div `
|
|
1401
|
+
display: flex;
|
|
1402
|
+
align-items: center;
|
|
1403
|
+
gap: 8px;
|
|
1404
|
+
`;
|
|
1405
|
+
const StyledCachedIcon = styled.div `
|
|
1406
|
+
display: flex;
|
|
1407
|
+
align-items: center;
|
|
1408
|
+
justify-content: center;
|
|
1409
|
+
color: #4CAF50;
|
|
1410
|
+
font-size: 16px;
|
|
1411
|
+
|
|
1412
|
+
svg {
|
|
1413
|
+
color: #4CAF50;
|
|
1414
|
+
}
|
|
1415
|
+
`;
|
|
1416
|
+
const StyledChevron = styled.span `
|
|
1417
|
+
transition: transform 0.2s ease;
|
|
1418
|
+
transform: ${props => props.$isOpen ? 'rotate(180deg)' : 'rotate(0deg)'};
|
|
1419
|
+
color: #666;
|
|
1420
|
+
font-size: 12px;
|
|
1421
|
+
`;
|
|
1422
|
+
const StyledIndexingInfoBox = styled.div `
|
|
1423
|
+
background: white;
|
|
1424
|
+
border: 1px solid #e0e0e0;
|
|
1425
|
+
border-radius: 6px;
|
|
1426
|
+
padding: 12px;
|
|
1427
|
+
max-height: 200px;
|
|
1428
|
+
overflow: auto;
|
|
1429
|
+
font-family: 'Courier New', monospace;
|
|
1430
|
+
font-size: 12px;
|
|
1431
|
+
color: #333;
|
|
1432
|
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
1433
|
+
animation: slideDown 0.2s ease;
|
|
1434
|
+
|
|
1435
|
+
@keyframes slideDown {
|
|
1436
|
+
from {
|
|
1437
|
+
opacity: 0;
|
|
1438
|
+
transform: translateY(-10px);
|
|
1439
|
+
}
|
|
1440
|
+
to {
|
|
1441
|
+
opacity: 1;
|
|
1442
|
+
transform: translateY(0);
|
|
1443
|
+
}
|
|
1444
|
+
}
|
|
1445
|
+
`;
|