@topconsultnpm/sdkui-react 6.20.0-test1 → 6.21.0-dev1.2
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/NewComponents/ContextMenu/styles.d.ts +3 -1
- package/lib/components/NewComponents/ContextMenu/styles.js +7 -5
- package/lib/components/NewComponents/FloatingMenuBar/TMFloatingMenuBar.js +7 -1
- package/lib/components/base/Styled.d.ts +4 -1
- package/lib/components/base/Styled.js +11 -3
- package/lib/components/base/TMPanel.js +6 -4
- package/lib/components/base/TMPopUp.js +4 -0
- package/lib/components/base/TMTreeView.d.ts +3 -1
- package/lib/components/base/TMTreeView.js +68 -21
- package/lib/components/base/TMWaitPanel.js +6 -5
- package/lib/components/choosers/TMDataListItemChooser.js +1 -1
- package/lib/components/choosers/TMDataListItemEditor.d.ts +11 -0
- package/lib/components/choosers/TMDataListItemEditor.js +130 -0
- package/lib/components/choosers/TMDataListItemFields.d.ts +11 -0
- package/lib/components/choosers/TMDataListItemFields.js +61 -0
- package/lib/components/choosers/TMDataListItemPicker.d.ts +2 -0
- package/lib/components/choosers/TMDataListItemPicker.js +182 -18
- package/lib/components/choosers/TMDynDataListItemChooser.js +11 -6
- package/lib/components/choosers/TMImageIDChooser.d.ts +16 -0
- package/lib/components/choosers/TMImageIDChooser.js +53 -0
- package/lib/components/choosers/TMMetadataChooser.js +1 -1
- package/lib/components/choosers/TMUserChooser.js +1 -1
- package/lib/components/editors/TMDateBox.js +1 -1
- package/lib/components/editors/TMHtmlEditor.js +1 -1
- package/lib/components/editors/TMLocalizedTextBox.d.ts +1 -0
- package/lib/components/editors/TMLocalizedTextBox.js +3 -3
- package/lib/components/editors/TMMetadataValues.js +203 -41
- package/lib/components/editors/TMTextArea.d.ts +1 -0
- package/lib/components/editors/TMTextArea.js +6 -6
- package/lib/components/editors/TMTextBox.js +9 -10
- package/lib/components/features/archive/TMArchive.d.ts +3 -1
- package/lib/components/features/archive/TMArchive.js +31 -44
- package/lib/components/features/blog/TMBlogCommentForm.d.ts +3 -0
- package/lib/components/features/blog/TMBlogCommentForm.js +42 -36
- package/lib/components/features/documents/TMDcmtBlog.d.ts +1 -0
- package/lib/components/features/documents/TMDcmtBlog.js +2 -1
- package/lib/components/features/documents/TMDcmtForm.d.ts +44 -34
- package/lib/components/features/documents/TMDcmtForm.js +365 -563
- package/lib/components/features/documents/TMDcmtFormActionButtons.d.ts +34 -0
- package/lib/components/features/documents/TMDcmtFormActionButtons.js +124 -0
- package/lib/components/features/documents/TMDcmtPreview.js +66 -13
- package/lib/components/features/documents/TMDcmtTasks.d.ts +3 -1
- package/lib/components/features/documents/TMDcmtTasks.js +2 -2
- package/lib/components/features/documents/TMFileUploader.d.ts +5 -0
- package/lib/components/features/documents/TMFileUploader.js +28 -6
- package/lib/components/features/documents/TMMasterDetailDcmts.js +31 -85
- package/lib/components/features/documents/TMRelationViewer.d.ts +7 -1
- package/lib/components/features/documents/TMRelationViewer.js +497 -111
- package/lib/components/features/search/TMSearch.d.ts +2 -2
- package/lib/components/features/search/TMSearch.js +3 -3
- package/lib/components/features/search/TMSearchQueryPanel.js +6 -6
- package/lib/components/features/search/TMSearchResult.d.ts +28 -25
- package/lib/components/features/search/TMSearchResult.js +445 -562
- package/lib/components/features/search/TMSignatureInfoContent.js +10 -6
- package/lib/components/features/search/TMTreeSelector.js +1 -1
- package/lib/components/features/tasks/TMTaskForm.d.ts +3 -1
- package/lib/components/features/tasks/TMTaskForm.js +61 -193
- package/lib/components/features/tasks/TMTaskFormUtils.d.ts +80 -0
- package/lib/components/features/tasks/TMTaskFormUtils.js +559 -0
- package/lib/components/features/tasks/TMTasksUtils.d.ts +3 -1
- package/lib/components/features/tasks/TMTasksUtils.js +46 -16
- package/lib/components/features/tasks/TMTasksUtilsView.d.ts +0 -7
- package/lib/components/features/tasks/TMTasksUtilsView.js +7 -14
- package/lib/components/features/tasks/TMTasksView.js +5 -3
- package/lib/components/features/workflow/TMWorkflowPopup.d.ts +20 -3
- package/lib/components/features/workflow/TMWorkflowPopup.js +21 -109
- package/lib/components/features/workflow/diagram/ConnectionComponent.d.ts +1 -0
- package/lib/components/features/workflow/diagram/ConnectionComponent.js +6 -2
- package/lib/components/features/workflow/diagram/DiagramItemForm.d.ts +2 -0
- package/lib/components/features/workflow/diagram/DiagramItemForm.js +32 -25
- package/lib/components/features/workflow/diagram/RecipientList.d.ts +3 -1
- package/lib/components/features/workflow/diagram/RecipientList.js +13 -9
- package/lib/components/features/workflow/diagram/WFDiagram.js +102 -5
- package/lib/components/features/workflow/diagram/workflowHelpers.js +31 -19
- package/lib/components/forms/Login/TMLoginForm.js +1 -1
- package/lib/components/forms/TMSaveForm.js +61 -13
- package/lib/components/grids/TMBlogsPost.js +8 -8
- package/lib/components/grids/TMBlogsPostUtils.js +2 -2
- package/lib/components/grids/TMRecentsManager.js +1 -1
- package/lib/components/index.d.ts +2 -0
- package/lib/components/index.js +2 -0
- package/lib/components/layout/panelManager/TMPanelManagerContainer.js +3 -2
- package/lib/components/pages/TMPage.js +4 -0
- package/lib/components/query/TMQueryEditor.d.ts +1 -0
- package/lib/components/query/TMQueryEditor.js +3 -3
- package/lib/components/viewers/TMMidViewer.js +2 -1
- package/lib/components/viewers/TMTidViewer.js +7 -3
- package/lib/helper/Enum_Localizator.js +5 -0
- package/lib/helper/GlobalStyles.js +3 -0
- package/lib/helper/SDKUI_Globals.d.ts +12 -0
- package/lib/helper/SDKUI_Globals.js +21 -1
- package/lib/helper/SDKUI_Localizator.d.ts +31 -7
- package/lib/helper/SDKUI_Localizator.js +286 -46
- package/lib/helper/TMIcons.d.ts +2 -1
- package/lib/helper/TMIcons.js +4 -1
- package/lib/helper/TMUtils.d.ts +33 -41
- package/lib/helper/TMUtils.js +157 -170
- package/lib/helper/checkinCheckoutManager.js +6 -2
- package/lib/helper/helpers.d.ts +6 -2
- package/lib/helper/helpers.js +24 -8
- package/lib/helper/index.d.ts +1 -0
- package/lib/helper/index.js +1 -0
- package/lib/helper/queryHelper.js +1 -1
- package/lib/hooks/useBetaFeatures.d.ts +1 -0
- package/lib/hooks/useBetaFeatures.js +41 -0
- package/lib/hooks/useCheckInOutOperations.d.ts +7 -6
- package/lib/hooks/useCheckInOutOperations.js +9 -16
- package/lib/hooks/useDataUserIdItem.js +2 -2
- package/lib/hooks/useDcmtOperations.d.ts +3 -2
- package/lib/hooks/useDcmtOperations.js +16 -4
- package/lib/hooks/useDocumentOperations.d.ts +139 -0
- package/lib/hooks/useDocumentOperations.js +1275 -0
- package/lib/hooks/useRelatedDocuments.d.ts +1 -1
- package/lib/hooks/useRelatedDocuments.js +64 -42
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/services/platform_services.d.ts +1 -1
- package/lib/services/platform_services.js +4 -0
- package/lib/ts/types.d.ts +5 -1
- package/lib/ts/types.js +1 -0
- package/package.json +55 -55
- package/lib/components/features/search/TMSearchResultsMenuItems.d.ts +0 -11
- package/lib/components/features/search/TMSearchResultsMenuItems.js +0 -770
- package/lib/components/features/search/TMSignSettingsForm.d.ts +0 -9
- package/lib/components/features/search/TMSignSettingsForm.js +0 -621
|
@@ -1,56 +1,37 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
|
-
import { SDK_Globals, DataColumnTypes, MetadataDataDomains, DataListViewModes, MetadataFormats, LayoutModes, DcmtTypeListCacheService, SystemMIDsAsNumber, RetrieveFileOptions, DcmtOpers, GeneralRetrieveFormats, AccessLevelsEx, LayoutCacheService, UserListCacheService } from '@topconsultnpm/sdk-ts';
|
|
4
3
|
import styled from 'styled-components';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
4
|
+
import { LoadIndicator } from 'devextreme-react';
|
|
5
|
+
import { AppModules, DataColumnTypes, DataListViewModes, DcmtTypeListCacheService, LayoutCacheService, LayoutModes, MetadataDataDomains, MetadataFormats, SDK_Globals, SystemMIDsAsNumber, UserListCacheService, } from '@topconsultnpm/sdk-ts';
|
|
6
|
+
import { deepCompare, generateUniqueColumnKeys, genUniqueId, getSearchToolbarVisibility, IconBoard, IconDcmtTypeSys, IconDelete, IconMenuVertical, IconPlatform, IconRefresh, IconSearchCheck, IconShow, isApprovalWorkflowView, searchResultDescriptorToSimpleArray, searchResultToMetadataValues, SDKUI_Globals, SDKUI_Localizator, } from '../../../helper';
|
|
7
|
+
import { getDcmtCicoStatus } from '../../../helper/checkinCheckoutManager';
|
|
8
|
+
import { DcmtOperationTypes, SearchResultContext, } from '../../../ts';
|
|
9
|
+
import { Gutters } from '../../../utils/theme';
|
|
10
|
+
import { useDataListItem } from '../../../hooks/useDataListItem';
|
|
11
|
+
import { useDataUserIdItem } from '../../../hooks/useDataUserIdItem';
|
|
12
|
+
import { getSelectedDcmtsOrFocused, useDocumentOperations } from '../../../hooks/useDocumentOperations';
|
|
13
|
+
import ShowAlert from '../../base/TMAlert';
|
|
14
|
+
import TMAccordionNew from '../../base/TMAccordionNew';
|
|
13
15
|
import TMButton from '../../base/TMButton';
|
|
14
16
|
import TMDataGrid, { TMDataGridPageSize } from '../../base/TMDataGrid';
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
17
|
+
import { DeviceType, useDeviceType } from '../../base/TMDeviceProvider';
|
|
18
|
+
import { TMLayoutItem, TMSplitterLayout } from '../../base/TMLayout';
|
|
19
|
+
import { ButtonNames, TMExceptionBoxManager, TMMessageBoxManager } from '../../base/TMPopUp';
|
|
20
|
+
import TMSpinner from '../../base/TMSpinner';
|
|
21
|
+
import { StyledMultiViewPanel } from '../../base/Styled';
|
|
18
22
|
import { TMLayoutWaitingContainer } from '../../base/TMWaitPanel';
|
|
19
23
|
import TMMetadataValues from '../../editors/TMMetadataValues';
|
|
20
24
|
import TMTidViewer from '../../viewers/TMTidViewer';
|
|
21
|
-
import
|
|
22
|
-
import
|
|
25
|
+
import { TMPanelManagerProvider, useTMPanelManagerContext } from '../../layout/panelManager/TMPanelManagerContext';
|
|
26
|
+
import TMPanelManagerContainer from '../../layout/panelManager/TMPanelManagerContainer';
|
|
23
27
|
import TMContextMenu from '../../NewComponents/ContextMenu/TMContextMenu';
|
|
24
|
-
import
|
|
25
|
-
import TMMasterDetailDcmts from '../documents/TMMasterDetailDcmts';
|
|
26
|
-
import TMBatchUpdateForm from '../../features/documents/TMBatchUpdateForm';
|
|
27
|
-
import TMDcmtForm from '../documents/TMDcmtForm';
|
|
28
|
+
import TMToppyDraggableHelpCenter from '../assistant/TMToppyDraggableHelpCenter';
|
|
28
29
|
import TMDcmtBlog from '../documents/TMDcmtBlog';
|
|
29
30
|
import TMDcmtIcon from '../documents/TMDcmtIcon';
|
|
30
|
-
import
|
|
31
|
-
import
|
|
32
|
-
|
|
33
|
-
import TMDataGridExportForm from '../../base/TMDataGridExportForm';
|
|
31
|
+
import TMDcmtPreview from '../documents/TMDcmtPreview';
|
|
32
|
+
import { WorkFlowOperationButtons } from '../workflow/TMWorkflowPopup';
|
|
33
|
+
// Local
|
|
34
34
|
import TMSearchResultFloatingActionButton from './TMSearchResultFloatingActionButton';
|
|
35
|
-
import ShowAlert from '../../base/TMAlert';
|
|
36
|
-
import TMSpinner from '../../base/TMSpinner';
|
|
37
|
-
import TMChooserForm from '../../forms/TMChooserForm';
|
|
38
|
-
import TMModal from '../../base/TMModal';
|
|
39
|
-
import TMTooltip from '../../base/TMTooltip';
|
|
40
|
-
import TMSearch from './TMSearch';
|
|
41
|
-
import TMArchive from '../archive/TMArchive';
|
|
42
|
-
import TMCustomButton from '../../base/TMCustomButton';
|
|
43
|
-
import TMSignSettingsForm from './TMSignSettingsForm';
|
|
44
|
-
import { getDcmtCicoStatus } from '../../../helper/checkinCheckoutManager';
|
|
45
|
-
import TMViewHistoryDcmt from './TMViewHistoryDcmt';
|
|
46
|
-
import TMBlogCommentForm from '../blog/TMBlogCommentForm';
|
|
47
|
-
import { useCheckInOutOperations } from '../../../hooks/useCheckInOutOperations';
|
|
48
|
-
import { useFloatingBarPinnedItems } from '../../../hooks/useFloatingBarPinnedItems';
|
|
49
|
-
import TMDcmtCheckoutInfoForm from './TMDcmtCheckoutInfoForm';
|
|
50
|
-
import { useDataListItem } from '../../../hooks/useDataListItem';
|
|
51
|
-
import { useDataUserIdItem } from '../../../hooks/useDataUserIdItem';
|
|
52
|
-
import { LoadIndicator } from 'devextreme-react';
|
|
53
|
-
import TMToppyDraggableHelpCenter from '../assistant/TMToppyDraggableHelpCenter';
|
|
54
35
|
let abortControllerLocal = new AbortController();
|
|
55
36
|
//#region Helper Methods
|
|
56
37
|
export const getSearchResultCountersSingleCategory = (searchResults) => {
|
|
@@ -69,75 +50,321 @@ const orderByName = (array) => {
|
|
|
69
50
|
return 1;
|
|
70
51
|
} return 0; });
|
|
71
52
|
};
|
|
72
|
-
const TMSearchResult = ({
|
|
53
|
+
const TMSearchResult = ({
|
|
54
|
+
// Data
|
|
55
|
+
groupId, searchResults = [], context = SearchResultContext.METADATA_SEARCH, title, selectedSearchResultTID, floatingActionConfig, workingGroupContext = undefined,
|
|
56
|
+
// Boolean flags to enable/disable features
|
|
57
|
+
isVisible = true, allowRelations = true, openDcmtFormAsModal = false, showSearchResultSidebar = true, showDcmtFormSidebar = true, showSelector = false, isClosable = false, allowFloatingBar = true, showToolbarHeader = true, showBackButton = true, disableAccordionIfSingleCategory = false, editPdfForm = false, openS4TViewer = false, showTodoDcmtForm = false, showToppyDraggableHelpCenter = true, toppyHelpCenterUsePortal = false, showNoDcmtFoundMessage = true, enablePinIcons = true,
|
|
58
|
+
// Callbacks (optional)
|
|
59
|
+
openInOffice, onRefreshAfterAddDcmtToFavs, onRefreshSearchAsyncDatagrid, onSelectedTIDChanged, onWFOperationCompleted, onClose, onFileOpened, onTaskCreateRequest, openWGsCopyMoveForm, openCommentFormCallback, openAddDocumentForm, onOpenS4TViewerRequest, onOpenPdfEditorRequest, passToArchiveCallback, onReferenceClick,
|
|
60
|
+
// Tasks
|
|
61
|
+
allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback,
|
|
62
|
+
// Navigation
|
|
63
|
+
handleNavigateToWGs, handleNavigateToDossiers, }) => {
|
|
64
|
+
// Ref for the floating bar container (used to position the floating action buttons)
|
|
65
|
+
const floatingBarContainerRef = useRef(null);
|
|
66
|
+
// ID state to force remount of components
|
|
73
67
|
const [id, setID] = useState('');
|
|
74
|
-
|
|
75
|
-
const [showRejectPopup, setShowRejectPopup] = useState(false);
|
|
76
|
-
const [showReAssignPopup, setShowReAssignPopup] = useState(false);
|
|
77
|
-
const [showMoreInfoPopup, setShowMoreInfoPopup] = useState(false);
|
|
78
|
-
const [splitterSize, setSplitterSize] = useState(['100%', '0']);
|
|
79
|
-
const [showFloatingBar, setShowFloatingBar] = useState(true);
|
|
80
|
-
const [lastUpdateSearchTime, setLastUpdateSearchTime] = useState();
|
|
68
|
+
// Document type descriptor of the currently document
|
|
81
69
|
const [fromDTD, setFromDTD] = useState();
|
|
70
|
+
const [currentDcmt, setCurrentDcmt] = useState();
|
|
71
|
+
// State to specify if the details form is open or not
|
|
72
|
+
const [splitterSize, setSplitterSize] = useState(['100%', '0']);
|
|
73
|
+
// State to control the selected search result
|
|
82
74
|
const [selectedSearchResult, setSelectedSearchResult] = useState();
|
|
75
|
+
// State to control the search results to show in the datagrid
|
|
83
76
|
const [currentSearchResults, setCurrentSearchResults] = useState(searchResults || []);
|
|
84
|
-
|
|
85
|
-
const [
|
|
86
|
-
|
|
87
|
-
const [isOpenDcmtForm, setIsOpenDcmtForm] = useState(false);
|
|
88
|
-
const [isOpenBatchUpdate, setIsOpenBatchUpdate] = useState(false);
|
|
89
|
-
const [isOpenSharedArchive, setIsOpenSharedArchive] = useState(false);
|
|
90
|
-
const [visibleItems, setVisibleItems] = useState([]);
|
|
77
|
+
// State to control the metadata values of the currently focused document
|
|
78
|
+
const [currentMetadataValues, setCurrentMetadataValues] = useState([]);
|
|
79
|
+
// Focused item state
|
|
91
80
|
const [focusedItem, setFocusedItem] = useState();
|
|
81
|
+
// Selected items state
|
|
92
82
|
const [selectedItems, setSelectedItems] = useState([]);
|
|
93
|
-
|
|
94
|
-
const [
|
|
95
|
-
|
|
96
|
-
const [
|
|
97
|
-
const [
|
|
98
|
-
// State to control
|
|
99
|
-
const [
|
|
100
|
-
|
|
101
|
-
const [
|
|
83
|
+
// State to control the visible items in the datagrid
|
|
84
|
+
const [visibleItems, setVisibleItems] = useState([]);
|
|
85
|
+
// State to control the columns and dataSource of the datagrid
|
|
86
|
+
const [dataColumnsFromDataGrid, setDataColumnsFromDataGrid] = useState([]);
|
|
87
|
+
const [dataSourceFromDataGrid, setDataSourceFromDataGrid] = useState([]);
|
|
88
|
+
// State to control the selected rows in the datagrid
|
|
89
|
+
const [selectedRowKeysFromDataGrid, setSelectedRowKeysFromDataGrid] = useState([]);
|
|
90
|
+
// Triggers TMDcmtBlog refresh after metadata or workflow changes
|
|
91
|
+
const [refreshBlogTrigger, setRefreshBlogTrigger] = useState(0);
|
|
92
|
+
// Trigger TMDcmtPreview refresh
|
|
93
|
+
const [refreshPreviewTrigger, setRefreshPreviewTrigger] = useState(0);
|
|
94
|
+
// Trigger operationItems refresh (after file substitution, etc.)
|
|
95
|
+
const [refreshOperationsTrigger, setRefreshOperationsTrigger] = useState(0);
|
|
96
|
+
// State to control the refresh of the search result after an operation in the workflow popups
|
|
97
|
+
const [lastUpdateSearchTime, setLastUpdateSearchTime] = useState();
|
|
102
98
|
const [showIndexingInfo, setShowIndexingInfo] = useState(false);
|
|
103
99
|
const [loadingIndexingInfo, setLoadingIndexingInfo] = useState(false);
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
const { openConfirmAttachmentsDialog, ConfirmAttachmentsDialog } = useInputAttachmentsDialog();
|
|
107
|
-
const { abortController, showWaitPanel, waitPanelTitle, showPrimary, waitPanelTextPrimary, waitPanelValuePrimary, waitPanelMaxValuePrimary, showSecondary, waitPanelTextSecondary, waitPanelValueSecondary, waitPanelMaxValueSecondary, downloadDcmtsAsync, runOperationAsync, getDcmtFileAsync } = useDcmtOperations();
|
|
108
|
-
const { showHistory, showHistoryCallback, hideHistoryCallback, showCheckoutInformationForm, commentFormState, hideCommentFormCallback, showCheckoutInformationFormCallback, hideCheckoutInformationFormCallback, copyCheckoutPathToClipboardCallback, handleCheckOutCallback, handleCheckInCallback, refreshPreviewTrigger, showCicoWaitPanel, cicoWaitPanelTitle, showCicoPrimaryProgress, cicoPrimaryProgressText, cicoPrimaryProgressValue, cicoPrimaryProgressMax, } = useCheckInOutOperations();
|
|
109
|
-
const relatedDocuments = useRelatedDocuments({ selectedSearchResult, focusedItem, currentSearchResults });
|
|
110
|
-
const { relatedDcmts, showRelatedDcmtsChooser, archiveType, isOpenDetails, isOpenMaster, isOpenArchiveRelationForm, archiveRelatedDcmtFormTID, archiveRelatedDcmtFormMids, relatedDcmtsChooserDataSource, showPairDcmtsModal, isPairingManyToMany, pairedSearchResults, manyToManyRelations, selectedManyToManyRelation, showManyToManyChooser, manyToManyChooserDataSource, showPairSearchModal, pairSearchModalTargetTID, pairSearchModalParentTID, pairSearchModalParentDID, pairSearchModalRelation, pairSearchModalInputMids, currentTIDHasDetailRelations, currentTIDHasMasterRelations, canArchiveMasterRelation, canArchiveDetailRelation, hasManyToManyRelation, setIsOpenDetails, setIsOpenMaster, setShowRelatedDcmtsChooser, setShowManyToManyChooser, setShowPairDcmtsModal, setShowPairSearchModal, setIsOpenArchiveRelationForm, setArchiveType, setArchiveRelatedDcmtFormTID, setArchiveRelatedDcmtFormMids, pairFloatingActionConfig, pairSearchModalFloatingActionConfig, archiveMasterDocuments, archiveDetailDocuments, pairManyToMany, checkRelatedDcmtsArchiveCapability, checkManyToManyCapability, archiveRelatedDcmtHandler, executeManyToManyPairing, } = relatedDocuments;
|
|
100
|
+
const [indexingInfo, setIndexingInfo] = useState('');
|
|
101
|
+
// State to control the layout of the custom buttons
|
|
111
102
|
const [customButtonsLayout, setCustomButtonsLayout] = useState();
|
|
112
|
-
const [
|
|
103
|
+
const [allUsers, setAllUsers] = useState([]);
|
|
104
|
+
useEffect(() => {
|
|
105
|
+
const fetchAllUsers = async () => {
|
|
106
|
+
const users = await UserListCacheService.GetAllAsync();
|
|
107
|
+
setAllUsers(users ?? []);
|
|
108
|
+
};
|
|
109
|
+
fetchAllUsers();
|
|
110
|
+
}, []);
|
|
111
|
+
const canNavigateHandler = (dir) => {
|
|
112
|
+
if (!focusedItem)
|
|
113
|
+
return false;
|
|
114
|
+
let index = -1;
|
|
115
|
+
if (visibleItems) {
|
|
116
|
+
index = visibleItems.findIndex(item => item.rowIndex === focusedItem.rowIndex);
|
|
117
|
+
}
|
|
118
|
+
switch (dir) {
|
|
119
|
+
case 'next': if (visibleItems && index < visibleItems.length - 1) {
|
|
120
|
+
return true;
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
return false;
|
|
124
|
+
}
|
|
125
|
+
default: if (visibleItems && index > 0) {
|
|
126
|
+
return true;
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
const onNavigateHandler = (dir) => {
|
|
134
|
+
let index = -1;
|
|
135
|
+
if (visibleItems && focusedItem) {
|
|
136
|
+
index = visibleItems.findIndex(item => item.rowIndex === focusedItem.rowIndex);
|
|
137
|
+
}
|
|
138
|
+
switch (dir) {
|
|
139
|
+
case 'next':
|
|
140
|
+
setFocusedItem(visibleItems[index + 1]);
|
|
141
|
+
break;
|
|
142
|
+
default:
|
|
143
|
+
setFocusedItem(visibleItems[index - 1]);
|
|
144
|
+
break;
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
const updateDataColumnsFromDataGrid = useCallback((dataColumns) => {
|
|
148
|
+
setDataColumnsFromDataGrid(dataColumns);
|
|
149
|
+
}, []);
|
|
150
|
+
// Increments trigger counter to force TMDcmtBlog to re-fetch data
|
|
151
|
+
const onRefreshBlogDatagrid = useCallback(async () => {
|
|
152
|
+
setRefreshBlogTrigger(prev => prev + 1);
|
|
153
|
+
}, []);
|
|
154
|
+
// Increments trigger counter to force TMDcmtPreview to re-fetch data
|
|
155
|
+
const onRefreshPreviewDatagrid = useCallback(async () => {
|
|
156
|
+
setRefreshPreviewTrigger(prev => prev + 1);
|
|
157
|
+
}, []);
|
|
158
|
+
// Increments trigger counter to force operationItems to re-calculate
|
|
159
|
+
const onRefreshOperationsDatagrid = useCallback(async () => {
|
|
160
|
+
setRefreshOperationsTrigger(prev => prev + 1);
|
|
161
|
+
}, []);
|
|
162
|
+
const updateDataSourceFromDataGrid = useCallback((dataSource) => {
|
|
163
|
+
setDataSourceFromDataGrid(dataSource);
|
|
164
|
+
}, []);
|
|
165
|
+
const updateSelectedRowKeysFromDataGrid = useCallback((selectedRowKeys) => {
|
|
166
|
+
setSelectedRowKeysFromDataGrid(selectedRowKeys);
|
|
167
|
+
}, []);
|
|
168
|
+
// Reloads metadata for a single document (by TID/DID) and updates or removes its row in the grid
|
|
169
|
+
const refreshFocusedDataRowAsync = async (tid, did, refreshUI, metadataResult) => {
|
|
170
|
+
if (!tid || !did)
|
|
171
|
+
return;
|
|
172
|
+
let currentResult = searchResults.length > 1 ? selectedSearchResult : searchResults[0];
|
|
173
|
+
let currentResultColIndexTID = currentResult?.dtdResult?.columns?.findIndex(o => o.caption == "TID");
|
|
174
|
+
if (currentResultColIndexTID == undefined)
|
|
175
|
+
return;
|
|
176
|
+
let currentResultColIndexDID = currentResult?.dtdResult?.columns?.findIndex(o => o.caption == "DID");
|
|
177
|
+
if (currentResultColIndexDID == undefined)
|
|
178
|
+
return;
|
|
179
|
+
let newDcmt;
|
|
180
|
+
// Se metadataResult è null (non undefined!), significa che GetMetadataAsync è già fallito
|
|
181
|
+
// nel form e l'errore è già stato mostrato all'utente, quindi non ritentiamo
|
|
182
|
+
if (metadataResult === null) {
|
|
183
|
+
newDcmt = undefined;
|
|
184
|
+
}
|
|
185
|
+
// Se metadataResult è un oggetto valido, usiamolo
|
|
186
|
+
else if (metadataResult !== undefined) {
|
|
187
|
+
newDcmt = metadataResult;
|
|
188
|
+
}
|
|
189
|
+
// Altrimenti (metadataResult === undefined), tentiamo di ottenerlo
|
|
190
|
+
else {
|
|
191
|
+
try {
|
|
192
|
+
newDcmt = await SDK_Globals.tmSession?.NewSearchEngine().GetMetadataAsync(tid, did, true);
|
|
193
|
+
}
|
|
194
|
+
catch (error) {
|
|
195
|
+
newDcmt = undefined;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
// Se newDcmt è undefined o non ha righe, significa che il documento non esiste più
|
|
199
|
+
// o non è più accessibile. Rimuovi la riga dal risultato della ricerca
|
|
200
|
+
if (!newDcmt || !newDcmt.dtdResult?.rows?.[0]) {
|
|
201
|
+
if (currentResult?.dtdResult?.rows) {
|
|
202
|
+
// IMPORTANTE: Modifica direttamente l'oggetto originale per mantenere la sincronizzazione
|
|
203
|
+
currentResult.dtdResult.rows = currentResult.dtdResult.rows.filter((row) => !(row[currentResultColIndexTID] == tid?.toString() && row[currentResultColIndexDID] == did?.toString()));
|
|
204
|
+
currentResult.dcmtsReturned = currentResult.dtdResult.rows.length;
|
|
205
|
+
currentResult.dcmtsFound = Math.max(0, (currentResult.dcmtsFound ?? 0) - 1);
|
|
206
|
+
// Se il documento rimosso era quello focalizzato, resetta il focus
|
|
207
|
+
if (focusedItem?.TID === tid && focusedItem?.DID === did) {
|
|
208
|
+
setFocusedItem(undefined);
|
|
209
|
+
setSelectedItems([]);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
// IMPORTANTE: forza l'aggiornamento della griglia
|
|
213
|
+
if (refreshUI)
|
|
214
|
+
setLastUpdateSearchTime(new Date(Date.now()));
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
// Se il documento esiste, aggiorna i valori come prima
|
|
218
|
+
let newDcmtRow = newDcmt.dtdResult.rows[0];
|
|
219
|
+
let currentDcmtRow = currentResult?.dtdResult?.rows?.filter((row) => row[currentResultColIndexTID] == tid?.toString() && row[currentResultColIndexDID] == did?.toString()) ?? [];
|
|
220
|
+
for (const row of currentDcmtRow) {
|
|
221
|
+
let mids = currentResult?.selectMIDs ?? [];
|
|
222
|
+
for (let i = 0; i < mids.length; i++) {
|
|
223
|
+
const mid = mids[i];
|
|
224
|
+
let newDcmtMidIndex = newDcmt?.selectMIDs?.findIndex(o => o == mid) ?? -1;
|
|
225
|
+
if (newDcmtMidIndex >= 0 && row[i] != newDcmtRow[newDcmtMidIndex]) {
|
|
226
|
+
row[i] = newDcmtRow[newDcmtMidIndex];
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
// Aggiorna focusedItem e selectedItems con i nuovi dati
|
|
231
|
+
if (focusedItem?.TID === tid && focusedItem?.DID === did) {
|
|
232
|
+
const updatedFocusedItem = searchResultDescriptorToSimpleArray(currentResult)?.find(item => item.TID === tid && item.DID === did);
|
|
233
|
+
if (updatedFocusedItem) {
|
|
234
|
+
setFocusedItem(updatedFocusedItem);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
if (selectedItems.length > 0) {
|
|
238
|
+
const updatedSelectedItems = selectedItems.map(item => {
|
|
239
|
+
if (item.TID === tid && item.DID === did) {
|
|
240
|
+
const updatedItem = searchResultDescriptorToSimpleArray(currentResult)?.find(dataItem => dataItem.TID === tid && dataItem.DID === did);
|
|
241
|
+
return updatedItem || item;
|
|
242
|
+
}
|
|
243
|
+
return item;
|
|
244
|
+
});
|
|
245
|
+
setSelectedItems(updatedSelectedItems);
|
|
246
|
+
}
|
|
247
|
+
if (refreshUI)
|
|
248
|
+
setLastUpdateSearchTime(new Date(Date.now()));
|
|
249
|
+
};
|
|
250
|
+
// Refreshes metadata for selected documents (or focused one) and triggers grid re-render
|
|
251
|
+
const onRefreshDataRowsAsync = async () => {
|
|
252
|
+
let dcmts = getSelectedDcmtsOrFocused(selectedItems, focusedItem);
|
|
253
|
+
for (const dcmt of dcmts) {
|
|
254
|
+
await refreshFocusedDataRowAsync(dcmt.TID, dcmt.DID);
|
|
255
|
+
}
|
|
256
|
+
setLastUpdateSearchTime(new Date(Date.now()));
|
|
257
|
+
};
|
|
258
|
+
// Callback after document save: refreshes the row with fetched metadata
|
|
259
|
+
const onSavedAsyncCallback = useCallback(async (tid, did, metadataResult) => {
|
|
260
|
+
await refreshFocusedDataRowAsync(tid, did, true, metadataResult);
|
|
261
|
+
}, [refreshFocusedDataRowAsync]);
|
|
262
|
+
const openTaskFormHandler = (onTaskCreated) => {
|
|
263
|
+
if (selectedItems.length > 1)
|
|
264
|
+
return;
|
|
265
|
+
const item = selectedItems.length === 1 ? selectedItems[0] : focusedItem;
|
|
266
|
+
if (item?.TID && item?.DID) {
|
|
267
|
+
const createTaskFromDocumentOrWorkItem = async () => {
|
|
268
|
+
try {
|
|
269
|
+
const dtd = await DcmtTypeListCacheService.GetWithNotGrantedAsync(item.TID, item?.DID);
|
|
270
|
+
if (dtd) {
|
|
271
|
+
const isWorkItem = isApprovalWorkflowView(dtd);
|
|
272
|
+
const name = `${dtd.name ?? '-'} (DID: ${item.DID})`;
|
|
273
|
+
onTaskCreateRequest?.(isWorkItem
|
|
274
|
+
? { workItem: { tid: item.TID, did: item.DID, name } }
|
|
275
|
+
: { document: { tid: item.TID, did: item.DID, name } }, onTaskCreated);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
catch (error) {
|
|
279
|
+
console.error("Error fetching data:", error);
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
createTaskFromDocumentOrWorkItem();
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
const { operationItems, renderFloatingBar, renderDcmtOperations, features } = useDocumentOperations({
|
|
286
|
+
context: context,
|
|
287
|
+
documentData: {
|
|
288
|
+
dtd: fromDTD,
|
|
289
|
+
selectedItems,
|
|
290
|
+
focusedItem,
|
|
291
|
+
currentSearchResults,
|
|
292
|
+
currentMetadataValues,
|
|
293
|
+
allUsers,
|
|
294
|
+
searchResult: selectedSearchResult,
|
|
295
|
+
datagridUtility: {
|
|
296
|
+
visibleItems,
|
|
297
|
+
onRefreshSearchAsyncDatagrid,
|
|
298
|
+
onRefreshDataRowsAsync,
|
|
299
|
+
refreshFocusedDataRowAsync,
|
|
300
|
+
onRefreshBlogDatagrid,
|
|
301
|
+
onRefreshPreviewDatagrid,
|
|
302
|
+
refreshOperationsTrigger,
|
|
303
|
+
onRefreshOperationsDatagrid,
|
|
304
|
+
}
|
|
305
|
+
},
|
|
306
|
+
exportData: {
|
|
307
|
+
dataColumns: dataColumnsFromDataGrid,
|
|
308
|
+
dataSource: dataSourceFromDataGrid,
|
|
309
|
+
selectedRowKeys: selectedRowKeysFromDataGrid,
|
|
310
|
+
},
|
|
311
|
+
uiConfig: {
|
|
312
|
+
floatingBarContainerRef,
|
|
313
|
+
customButtonsLayout,
|
|
314
|
+
workingGroupContext,
|
|
315
|
+
openS4TViewer,
|
|
316
|
+
openDcmtFormAsModal,
|
|
317
|
+
showDcmtFormSidebar,
|
|
318
|
+
allowFloatingBar,
|
|
319
|
+
enablePinIcons,
|
|
320
|
+
allowRelations,
|
|
321
|
+
},
|
|
322
|
+
tasks: {
|
|
323
|
+
allTasks: allTasks,
|
|
324
|
+
getAllTasks: getAllTasks,
|
|
325
|
+
deleteTaskByIdsCallback: deleteTaskByIdsCallback,
|
|
326
|
+
addTaskCallback: addTaskCallback,
|
|
327
|
+
editTaskCallback: editTaskCallback
|
|
328
|
+
},
|
|
329
|
+
callbacks: {
|
|
330
|
+
// Refresh operations (data consistency)
|
|
331
|
+
onSavedAsyncCallback,
|
|
332
|
+
onRefreshAfterAddDcmtToFavs,
|
|
333
|
+
// Workflow operations
|
|
334
|
+
onWFOperationCompleted,
|
|
335
|
+
// Navigation
|
|
336
|
+
canNavigateHandler,
|
|
337
|
+
onNavigateHandler,
|
|
338
|
+
handleNavigateToWGs,
|
|
339
|
+
handleNavigateToDossiers,
|
|
340
|
+
onReferenceClick,
|
|
341
|
+
// Document forms/operations
|
|
342
|
+
openAddDocumentForm,
|
|
343
|
+
openCommentFormCallback,
|
|
344
|
+
onFileOpened,
|
|
345
|
+
passToArchiveCallback,
|
|
346
|
+
openWGsCopyMoveForm,
|
|
347
|
+
onOpenS4TViewerRequest,
|
|
348
|
+
onOpenPdfEditorRequest,
|
|
349
|
+
// Task related
|
|
350
|
+
onTaskCreateRequest,
|
|
351
|
+
openTaskFormHandler,
|
|
352
|
+
},
|
|
353
|
+
});
|
|
354
|
+
const { isOpenDcmtForm, openFormHandler, dcmtFormLayoutMode, onDcmtFormOpenChange, showSearchTMDatagrid, showExportForm, isOpenBatchUpdate, isModifiedBatchUpdate, updateBatchUpdateForm, handleSignApprove, checkoutInfo: { showCicoWaitPanel, cicoWaitPanelTitle, showCicoPrimaryProgress, cicoPrimaryProgressText, cicoPrimaryProgressValue, cicoPrimaryProgressMax, }, dcmtOperations: { abortController, showWaitPanel, showPrimary, waitPanelTitle, waitPanelTextPrimary, waitPanelValuePrimary, waitPanelMaxValuePrimary, showSecondary, waitPanelTextSecondary, waitPanelValueSecondary, waitPanelMaxValueSecondary, downloadDcmtsAsync, runOperationAsync, }, relatedDocumentsInfo: { isOpenDetails, isOpenMaster, checkRelatedDcmtsArchiveCapability, checkManyToManyCapability, }, toppyOperations: { showApprovePopup, showRejectPopup, showReAssignPopup, showMoreInfoPopup, updateShowApprovePopup, updateShowRejectPopup, updateShowReAssignPopup, updateShowMoreInfoPopup } } = features;
|
|
113
355
|
const deviceType = useDeviceType();
|
|
114
356
|
const isMobile = deviceType === DeviceType.MOBILE;
|
|
115
|
-
const { pinnedItemIds, togglePin, setPinnedItemIds } = useFloatingBarPinnedItems();
|
|
116
357
|
const selectedDocs = getSelectedDcmtsOrFocused(selectedItems, focusedItem);
|
|
117
|
-
const allFieldSelectedDocs = useMemo(() => getAllFieldSelectedDcmtsOrFocused(selectedItems, focusedItem), [selectedItems, focusedItem]);
|
|
118
358
|
// Disable the "Sign/Approve" button if:
|
|
119
359
|
// 1. No document or multiple documents are selected, OR
|
|
120
360
|
// 2. Exactly one document is selected but its FILEEXT property is null
|
|
121
361
|
const disableSignApproveDisable = selectedDocs.length !== 1 || (selectedDocs.length === 1 && selectedDocs[0].FILEEXT === null);
|
|
122
362
|
const dcmtsReturned = (searchResults?.length > 1 ? selectedSearchResult?.dcmtsReturned : searchResults[0]?.dcmtsReturned ?? 0);
|
|
123
363
|
const dcmtsFound = (searchResults?.length > 1 ? selectedSearchResult?.dcmtsFound : searchResults[0]?.dcmtsFound ?? 0);
|
|
124
|
-
const [allUsers, setAllUsers] = useState([]);
|
|
125
|
-
// Stato per triggerare il refresh del blog dall'esterno
|
|
126
|
-
const [refreshBlogTrigger, setRefreshBlogTrigger] = useState(0);
|
|
127
|
-
const triggerBlogRefresh = useCallback(async () => {
|
|
128
|
-
setRefreshBlogTrigger(prev => prev + 1);
|
|
129
|
-
}, []);
|
|
130
|
-
useEffect(() => {
|
|
131
|
-
const fetchAllUsers = async () => {
|
|
132
|
-
const users = await UserListCacheService.GetAllAsync();
|
|
133
|
-
setAllUsers(users ?? []);
|
|
134
|
-
};
|
|
135
|
-
fetchAllUsers();
|
|
136
|
-
}, []);
|
|
137
364
|
useEffect(() => { setID(genUniqueId()); }, []);
|
|
138
365
|
useEffect(() => {
|
|
139
366
|
setSelectedItems([]);
|
|
140
|
-
|
|
367
|
+
updateBatchUpdateForm(false);
|
|
141
368
|
setCurrentSearchResults(searchResults);
|
|
142
369
|
if (searchResults.length <= 0) {
|
|
143
370
|
setSelectedSearchResult(undefined);
|
|
@@ -147,7 +374,18 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
|
|
|
147
374
|
setSelectedSearchResult(searchResults[0]);
|
|
148
375
|
return;
|
|
149
376
|
}
|
|
150
|
-
//
|
|
377
|
+
// Se il TID precedentemente selezionato esiste ancora nei nuovi risultati, mantienilo.
|
|
378
|
+
// Questo evita l'errore E1047 in modalità multi-TID: cambiando TID cambiano le colonne
|
|
379
|
+
// e il filtro applicato potrebbe riferire campi non più presenti.
|
|
380
|
+
const prevTID = selectedSearchResult?.fromTID;
|
|
381
|
+
if (prevTID !== undefined) {
|
|
382
|
+
const found = searchResults.find(r => r.fromTID === prevTID);
|
|
383
|
+
if (found) {
|
|
384
|
+
setSelectedSearchResult(found);
|
|
385
|
+
return;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
// Altrimenti seleziona il primo risultato ordinato
|
|
151
389
|
setSelectedSearchResult(orderByName(searchResults)[0]);
|
|
152
390
|
}, [searchResults]);
|
|
153
391
|
useEffect(() => {
|
|
@@ -197,116 +435,6 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
|
|
|
197
435
|
};
|
|
198
436
|
fetchLayout();
|
|
199
437
|
}, [currentMetadataValues]);
|
|
200
|
-
const openFormHandler = (layoutMode) => {
|
|
201
|
-
// Verifica che ci sia un documento selezionato con TID e DID validi
|
|
202
|
-
if (!focusedItem || focusedItem.TID === undefined || focusedItem.DID === undefined) {
|
|
203
|
-
ShowAlert({
|
|
204
|
-
message: SDKUI_Localizator.InvalidDcmt,
|
|
205
|
-
mode: "warning",
|
|
206
|
-
title: layoutMode === LayoutModes.Ark ? SDKUI_Localizator.Archive : SDKUI_Localizator.OpenTheDocument,
|
|
207
|
-
duration: 3000
|
|
208
|
-
});
|
|
209
|
-
return;
|
|
210
|
-
}
|
|
211
|
-
setIsOpenDcmtForm(true);
|
|
212
|
-
setDcmtFormLayoutMode(layoutMode);
|
|
213
|
-
};
|
|
214
|
-
const openSharedArchiveHandler = async () => {
|
|
215
|
-
const dcmts = getSelectedDcmtsOrFocused(selectedItems, focusedItem);
|
|
216
|
-
if (dcmts.length === 0) {
|
|
217
|
-
ShowAlert({ message: "Nessun documento selezionato", mode: "warning", title: 'Archivio Condivisa', duration: 3000 });
|
|
218
|
-
return;
|
|
219
|
-
}
|
|
220
|
-
if (fromDTD?.perm?.canArchive !== AccessLevelsEx.Yes && fromDTD?.perm?.canArchive !== AccessLevelsEx.Mixed) {
|
|
221
|
-
ShowAlert({
|
|
222
|
-
message: "Non hai i permessi per archiviare documenti di questo tipo.",
|
|
223
|
-
mode: 'warning',
|
|
224
|
-
title: 'Archivio Condivisa',
|
|
225
|
-
duration: 5000
|
|
226
|
-
});
|
|
227
|
-
return;
|
|
228
|
-
}
|
|
229
|
-
try {
|
|
230
|
-
const rfo = new RetrieveFileOptions();
|
|
231
|
-
rfo.retrieveReason = DcmtOpers.None;
|
|
232
|
-
rfo.generalRetrieveFormat = GeneralRetrieveFormats.OriginalUnsigned;
|
|
233
|
-
let dcmtFile = await getDcmtFileAsync({ TID: focusedItem?.TID, DID: focusedItem?.DID }, rfo, 'Archiviazione Condivisa', false, true);
|
|
234
|
-
if (dcmtFile) {
|
|
235
|
-
setSharedDcmtFile(dcmtFile?.file);
|
|
236
|
-
}
|
|
237
|
-
setIsOpenSharedArchive(true);
|
|
238
|
-
}
|
|
239
|
-
catch (e) {
|
|
240
|
-
TMExceptionBoxManager.show({ exception: e });
|
|
241
|
-
}
|
|
242
|
-
};
|
|
243
|
-
const showSharedDcmtsHandler = async () => {
|
|
244
|
-
try {
|
|
245
|
-
TMSpinner.show({ description: "Caricamento documenti condivisi..." });
|
|
246
|
-
const se = SDK_Globals.tmSession?.NewSearchEngine();
|
|
247
|
-
const sharedDcmts = await se?.GetSharedDcmtsAsync(getSelectedDcmtsOrFocused(selectedItems, focusedItem)[0].TID, getSelectedDcmtsOrFocused(selectedItems, focusedItem)[0].DID);
|
|
248
|
-
if (sharedDcmts && sharedDcmts.length > 0) {
|
|
249
|
-
setSharedDcmtSearchResults(sharedDcmts);
|
|
250
|
-
}
|
|
251
|
-
else {
|
|
252
|
-
ShowAlert({ message: "Nessun documento condiviso trovato.", mode: "info", title: 'Documenti Condivisi', duration: 5000 });
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
catch (e) {
|
|
256
|
-
TMExceptionBoxManager.show({ exception: e });
|
|
257
|
-
}
|
|
258
|
-
finally {
|
|
259
|
-
TMSpinner.hide();
|
|
260
|
-
}
|
|
261
|
-
};
|
|
262
|
-
const openTaskFormHandler = (onTaskCreated) => {
|
|
263
|
-
if (selectedItems.length > 1)
|
|
264
|
-
return;
|
|
265
|
-
const item = selectedItems.length === 1 ? selectedItems[0] : focusedItem;
|
|
266
|
-
if (item?.TID && item?.DID) {
|
|
267
|
-
const fetchData = async () => {
|
|
268
|
-
try {
|
|
269
|
-
const dtd = await DcmtTypeListCacheService.GetWithNotGrantedAsync(item.TID, item?.DID);
|
|
270
|
-
if (dtd) {
|
|
271
|
-
const isWorkItem = isApprovalWorkflowView(dtd);
|
|
272
|
-
const name = `${dtd.name ?? '-'} (DID: ${item.DID})`;
|
|
273
|
-
onTaskCreateRequest?.(isWorkItem
|
|
274
|
-
? { workItem: { tid: item.TID, did: item.DID, name } }
|
|
275
|
-
: { document: { tid: item.TID, did: item.DID, name } }, onTaskCreated);
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
catch (error) {
|
|
279
|
-
console.error("Error fetching data:", error);
|
|
280
|
-
}
|
|
281
|
-
};
|
|
282
|
-
fetchData();
|
|
283
|
-
}
|
|
284
|
-
};
|
|
285
|
-
const openDetailDcmtsFormHandler = (value) => { setIsOpenDetails(value); };
|
|
286
|
-
const openMasterDcmtsFormHandler = (value) => { setIsOpenMaster(value); };
|
|
287
|
-
const openBatchUpdateFormHandler = (value) => { setIsOpenBatchUpdate(value); };
|
|
288
|
-
const openExportForm = useCallback(() => {
|
|
289
|
-
setShowExportForm(true);
|
|
290
|
-
}, []);
|
|
291
|
-
const onCloseExportForm = useCallback(() => {
|
|
292
|
-
setShowExportForm(false);
|
|
293
|
-
}, []);
|
|
294
|
-
const handleToggleSearch = () => {
|
|
295
|
-
setShowSearch(prev => !prev);
|
|
296
|
-
};
|
|
297
|
-
const openSignSettingsForm = () => {
|
|
298
|
-
setShowSignSettingsForm(true);
|
|
299
|
-
};
|
|
300
|
-
const closeSignSettingsForm = useCallback(() => {
|
|
301
|
-
setShowSignSettingsForm(false);
|
|
302
|
-
}, []);
|
|
303
|
-
const copyCheckoutPathToClipboardOperationCallback = () => {
|
|
304
|
-
const selectedDocs = getSelectedDcmtsOrFocused(selectedItems, focusedItem);
|
|
305
|
-
const firstDoc = selectedDocs?.[0];
|
|
306
|
-
if (!firstDoc)
|
|
307
|
-
return;
|
|
308
|
-
copyCheckoutPathToClipboardCallback(firstDoc, fromDTD?.name ?? SDKUI_Localizator.SearchResult);
|
|
309
|
-
};
|
|
310
438
|
const getTitleHeader = () => {
|
|
311
439
|
let counters = (showSelector && disableAccordionIfSingleCategory && searchResults.length > 1) ? getSearchResultCountersSingleCategory(searchResults) : "";
|
|
312
440
|
if (title)
|
|
@@ -329,18 +457,6 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
|
|
|
329
457
|
}
|
|
330
458
|
return titleHeader + counters;
|
|
331
459
|
};
|
|
332
|
-
const handleSignApprove = () => {
|
|
333
|
-
if (onOpenS4TViewerRequest) {
|
|
334
|
-
onOpenS4TViewerRequest(getSelectedDcmtsOrFocused(selectedItems, focusedItem), onRefreshSearchAsync);
|
|
335
|
-
return;
|
|
336
|
-
}
|
|
337
|
-
ShowAlert({
|
|
338
|
-
message: "Non è stato possibile proseguire con la firma e l'approvazione.",
|
|
339
|
-
mode: "warning",
|
|
340
|
-
duration: 3000,
|
|
341
|
-
title: SDKUI_Localizator.SignatureAndApprove,
|
|
342
|
-
});
|
|
343
|
-
};
|
|
344
460
|
const onBack = () => {
|
|
345
461
|
if (isOpenBatchUpdate && isModifiedBatchUpdate) {
|
|
346
462
|
TMMessageBoxManager.show({
|
|
@@ -354,7 +470,7 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
|
|
|
354
470
|
});
|
|
355
471
|
}
|
|
356
472
|
else if (isOpenDcmtForm) {
|
|
357
|
-
|
|
473
|
+
onDcmtFormOpenChange(false, LayoutModes.Update);
|
|
358
474
|
}
|
|
359
475
|
else {
|
|
360
476
|
if (isMobile && currentSearchResults.length > 1) {
|
|
@@ -364,34 +480,6 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
|
|
|
364
480
|
onClose?.();
|
|
365
481
|
}
|
|
366
482
|
};
|
|
367
|
-
const customButtonMenuItems = () => {
|
|
368
|
-
const customButtonsItems = customButtonsLayout?.customButtons?.filter((customButton) => customButton.isForSearchResult && customButton.isForSearchResult > 0)
|
|
369
|
-
.map((customButton) => ({
|
|
370
|
-
icon: TMImageLibrary({ imageID: customButton.glyphID }),
|
|
371
|
-
name: customButton.title || 'Bottone personalizzato',
|
|
372
|
-
onClick: () => setCustomButton(customButton)
|
|
373
|
-
}));
|
|
374
|
-
return customButtonsItems && customButtonsItems.length > 0 ? {
|
|
375
|
-
icon: _jsx(IconCustom, {}),
|
|
376
|
-
name: SDKUI_Localizator.CustomButtons,
|
|
377
|
-
submenu: customButtonsItems
|
|
378
|
-
} : {};
|
|
379
|
-
};
|
|
380
|
-
const handleCheckOutOperationCallback = async (checkout) => {
|
|
381
|
-
const selectedDocs = getSelectedDcmtsOrFocused(selectedItems, focusedItem);
|
|
382
|
-
const firstDoc = selectedDocs?.[0];
|
|
383
|
-
if (!firstDoc)
|
|
384
|
-
return;
|
|
385
|
-
await handleCheckOutCallback(firstDoc, checkout, fromDTD?.name ?? SDKUI_Localizator.SearchResult, downloadDcmtsAsync, undefined, refreshFocusedDataRowAsync);
|
|
386
|
-
};
|
|
387
|
-
const handleCheckInOperationCallback = async () => {
|
|
388
|
-
const selectedDocs = getSelectedDcmtsOrFocused(selectedItems, focusedItem);
|
|
389
|
-
const firstDoc = selectedDocs?.[0];
|
|
390
|
-
if (!firstDoc)
|
|
391
|
-
return;
|
|
392
|
-
firstDoc.fileName = fromDTD?.name ?? SDKUI_Localizator.SearchResult;
|
|
393
|
-
await handleCheckInCallback(firstDoc, undefined, refreshFocusedDataRowAsync);
|
|
394
|
-
};
|
|
395
483
|
const refreshDataGridAfterRemoveAsync = async () => {
|
|
396
484
|
let index = selectedSearchResult?.dtdResult?.columns?.findIndex(col => col.caption === 'DID');
|
|
397
485
|
let selectedRows = [];
|
|
@@ -444,141 +532,6 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
|
|
|
444
532
|
}
|
|
445
533
|
onSelectedTIDChanged?.(e.fromTID);
|
|
446
534
|
};
|
|
447
|
-
const refreshFocusedDataRowAsync = async (tid, did, refreshUI, metadataResult) => {
|
|
448
|
-
if (!tid || !did)
|
|
449
|
-
return;
|
|
450
|
-
let currentResult = searchResults.length > 1 ? selectedSearchResult : searchResults[0];
|
|
451
|
-
let currentResultColIndexTID = currentResult?.dtdResult?.columns?.findIndex(o => o.caption == "TID");
|
|
452
|
-
if (currentResultColIndexTID == undefined)
|
|
453
|
-
return;
|
|
454
|
-
let currentResultColIndexDID = currentResult?.dtdResult?.columns?.findIndex(o => o.caption == "DID");
|
|
455
|
-
if (currentResultColIndexDID == undefined)
|
|
456
|
-
return;
|
|
457
|
-
let newDcmt;
|
|
458
|
-
// Se metadataResult è null (non undefined!), significa che GetMetadataAsync è già fallito
|
|
459
|
-
// nel form e l'errore è già stato mostrato all'utente, quindi non ritentiamo
|
|
460
|
-
if (metadataResult === null) {
|
|
461
|
-
newDcmt = undefined;
|
|
462
|
-
}
|
|
463
|
-
// Se metadataResult è un oggetto valido, usiamolo
|
|
464
|
-
else if (metadataResult !== undefined) {
|
|
465
|
-
newDcmt = metadataResult;
|
|
466
|
-
}
|
|
467
|
-
// Altrimenti (metadataResult === undefined), tentiamo di ottenerlo
|
|
468
|
-
else {
|
|
469
|
-
try {
|
|
470
|
-
newDcmt = await SDK_Globals.tmSession?.NewSearchEngine().GetMetadataAsync(tid, did, true);
|
|
471
|
-
}
|
|
472
|
-
catch (error) {
|
|
473
|
-
newDcmt = undefined;
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
// Se newDcmt è undefined o non ha righe, significa che il documento non esiste più
|
|
477
|
-
// o non è più accessibile. Rimuovi la riga dal risultato della ricerca
|
|
478
|
-
if (!newDcmt || !newDcmt.dtdResult?.rows?.[0]) {
|
|
479
|
-
if (currentResult?.dtdResult?.rows) {
|
|
480
|
-
// IMPORTANTE: Modifica direttamente l'oggetto originale per mantenere la sincronizzazione
|
|
481
|
-
currentResult.dtdResult.rows = currentResult.dtdResult.rows.filter((row) => !(row[currentResultColIndexTID] == tid?.toString() && row[currentResultColIndexDID] == did?.toString()));
|
|
482
|
-
currentResult.dcmtsReturned = currentResult.dtdResult.rows.length;
|
|
483
|
-
currentResult.dcmtsFound = Math.max(0, (currentResult.dcmtsFound ?? 0) - 1);
|
|
484
|
-
// Se il documento rimosso era quello focalizzato, resetta il focus
|
|
485
|
-
if (focusedItem?.TID === tid && focusedItem?.DID === did) {
|
|
486
|
-
setFocusedItem(undefined);
|
|
487
|
-
setSelectedItems([]);
|
|
488
|
-
}
|
|
489
|
-
}
|
|
490
|
-
// IMPORTANTE: forza l'aggiornamento della griglia
|
|
491
|
-
if (refreshUI)
|
|
492
|
-
setLastUpdateSearchTime(new Date(Date.now()));
|
|
493
|
-
return;
|
|
494
|
-
}
|
|
495
|
-
// Se il documento esiste, aggiorna i valori come prima
|
|
496
|
-
let newDcmtRow = newDcmt.dtdResult.rows[0];
|
|
497
|
-
let currentDcmtRow = currentResult?.dtdResult?.rows?.filter((row) => row[currentResultColIndexTID] == tid?.toString() && row[currentResultColIndexDID] == did?.toString()) ?? [];
|
|
498
|
-
for (const row of currentDcmtRow) {
|
|
499
|
-
let mids = currentResult?.selectMIDs ?? [];
|
|
500
|
-
for (let i = 0; i < mids.length; i++) {
|
|
501
|
-
const mid = mids[i];
|
|
502
|
-
let newDcmtMidIndex = newDcmt?.selectMIDs?.findIndex(o => o == mid) ?? -1;
|
|
503
|
-
if (newDcmtMidIndex >= 0 && row[i] != newDcmtRow[newDcmtMidIndex]) {
|
|
504
|
-
row[i] = newDcmtRow[newDcmtMidIndex];
|
|
505
|
-
}
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
// Aggiorna focusedItem e selectedItems con i nuovi dati
|
|
509
|
-
if (focusedItem?.TID === tid && focusedItem?.DID === did) {
|
|
510
|
-
const updatedFocusedItem = searchResultDescriptorToSimpleArray(currentResult)?.find(item => item.TID === tid && item.DID === did);
|
|
511
|
-
if (updatedFocusedItem) {
|
|
512
|
-
setFocusedItem(updatedFocusedItem);
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
if (selectedItems.length > 0) {
|
|
516
|
-
const updatedSelectedItems = selectedItems.map(item => {
|
|
517
|
-
if (item.TID === tid && item.DID === did) {
|
|
518
|
-
const updatedItem = searchResultDescriptorToSimpleArray(currentResult)?.find(dataItem => dataItem.TID === tid && dataItem.DID === did);
|
|
519
|
-
return updatedItem || item;
|
|
520
|
-
}
|
|
521
|
-
return item;
|
|
522
|
-
});
|
|
523
|
-
setSelectedItems(updatedSelectedItems);
|
|
524
|
-
}
|
|
525
|
-
if (refreshUI)
|
|
526
|
-
setLastUpdateSearchTime(new Date(Date.now()));
|
|
527
|
-
};
|
|
528
|
-
const refreshSelectionDataRowsAsync = async () => {
|
|
529
|
-
let dcmts = getSelectedDcmtsOrFocused(selectedItems, focusedItem);
|
|
530
|
-
for (const dcmt of dcmts) {
|
|
531
|
-
await refreshFocusedDataRowAsync(dcmt.TID, dcmt.DID);
|
|
532
|
-
}
|
|
533
|
-
setLastUpdateSearchTime(new Date(Date.now()));
|
|
534
|
-
};
|
|
535
|
-
const getSelectionDcmtInfo = () => { return getSelectedDcmtsOrFocused(selectedItems, focusedItem); };
|
|
536
|
-
const canNavigateHandler = (dir) => {
|
|
537
|
-
if (!focusedItem)
|
|
538
|
-
return false;
|
|
539
|
-
let index = -1;
|
|
540
|
-
if (visibleItems) {
|
|
541
|
-
index = visibleItems.findIndex(item => item.rowIndex === focusedItem.rowIndex);
|
|
542
|
-
}
|
|
543
|
-
switch (dir) {
|
|
544
|
-
case 'next': if (visibleItems && index < visibleItems.length - 1) {
|
|
545
|
-
return true;
|
|
546
|
-
}
|
|
547
|
-
else {
|
|
548
|
-
return false;
|
|
549
|
-
}
|
|
550
|
-
default: if (visibleItems && index > 0) {
|
|
551
|
-
return true;
|
|
552
|
-
}
|
|
553
|
-
else {
|
|
554
|
-
return false;
|
|
555
|
-
}
|
|
556
|
-
}
|
|
557
|
-
};
|
|
558
|
-
const onNavigateHandler = (dir) => {
|
|
559
|
-
let index = -1;
|
|
560
|
-
if (visibleItems && focusedItem) {
|
|
561
|
-
index = visibleItems.findIndex(item => item.rowIndex === focusedItem.rowIndex);
|
|
562
|
-
}
|
|
563
|
-
switch (dir) {
|
|
564
|
-
case 'next':
|
|
565
|
-
setFocusedItem(visibleItems[index + 1]);
|
|
566
|
-
break;
|
|
567
|
-
default:
|
|
568
|
-
setFocusedItem(visibleItems[index - 1]);
|
|
569
|
-
break;
|
|
570
|
-
}
|
|
571
|
-
};
|
|
572
|
-
const handleAddItem = (tid, did) => {
|
|
573
|
-
let newItem = { TID: tid ?? 0, DID: did ?? 0 };
|
|
574
|
-
setSecondaryMasterDcmts((prevItems) => [...prevItems, newItem]);
|
|
575
|
-
};
|
|
576
|
-
const handleRemoveItem = (tid, did) => {
|
|
577
|
-
setSecondaryMasterDcmts((prevItems) => prevItems.filter(item => item.TID !== tid && item.DID !== did));
|
|
578
|
-
};
|
|
579
|
-
const handleSavedAsyncCallback = useCallback(async (tid, did, metadataResult) => {
|
|
580
|
-
await refreshFocusedDataRowAsync(tid, did, true, metadataResult);
|
|
581
|
-
}, [refreshFocusedDataRowAsync]);
|
|
582
535
|
const showToppyForApprove = useMemo(() => {
|
|
583
536
|
return Boolean(isVisible && fromDTD && isApprovalWorkflowView(fromDTD) && !isOpenDcmtForm && !isOpenDetails && !isOpenMaster);
|
|
584
537
|
}, [isVisible, fromDTD, isOpenDcmtForm, isOpenDetails, isOpenMaster]);
|
|
@@ -599,174 +552,98 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
|
|
|
599
552
|
&& !openS4TViewer
|
|
600
553
|
&& !showTodoDcmtForm);
|
|
601
554
|
}, [showToppyForApprove, showToppyDraggableHelpCenter, selectedDocs, showApprovePopup, showRejectPopup, showReAssignPopup, showMoreInfoPopup, editPdfForm, openS4TViewer, showTodoDcmtForm]);
|
|
602
|
-
const floatingMenuItems = useMemo(() => {
|
|
603
|
-
const baseMenuItems = getCommandsMenuItems(isMobile, fromDTD, allUsers, selectedItems, focusedItem, context, showFloatingBar, workingGroupContext, showSearch, setShowFloatingBar, openFormHandler, openSharedArchiveHandler, showSharedDcmtsHandler, downloadDcmtsAsync, runOperationAsync, onRefreshSearchAsync, refreshSelectionDataRowsAsync, onRefreshAfterAddDcmtToFavs, confirmFormat, openConfirmAttachmentsDialog, openTaskFormHandler, openDetailDcmtsFormHandler, openMasterDcmtsFormHandler, openBatchUpdateFormHandler, openExportForm, handleToggleSearch, handleSignApprove, openSignSettingsForm, handleCheckOutOperationCallback, handleCheckInOperationCallback, showCheckoutInformationFormCallback, showHistoryCallback, copyCheckoutPathToClipboardOperationCallback, openWGsCopyMoveForm, openCommentFormCallback, openEditPdf, openAddDocumentForm, passToArchiveCallback, archiveMasterDocuments, archiveDetailDocuments, currentTIDHasMasterRelations, currentTIDHasDetailRelations, canArchiveMasterRelation, canArchiveDetailRelation, pairManyToMany, hasManyToManyRelation, pinnedItemIds, togglePin);
|
|
604
|
-
const customButtons = customButtonMenuItems();
|
|
605
|
-
return customButtons.name ? baseMenuItems.concat([customButtons]) : baseMenuItems;
|
|
606
|
-
}, [
|
|
607
|
-
isMobile, fromDTD, allUsers, selectedItems, focusedItem, context,
|
|
608
|
-
showFloatingBar, workingGroupContext, showSearch, currentTIDHasMasterRelations,
|
|
609
|
-
currentTIDHasDetailRelations, canArchiveMasterRelation, canArchiveDetailRelation,
|
|
610
|
-
hasManyToManyRelation, customButtonsLayout, pinnedItemIds, togglePin
|
|
611
|
-
]);
|
|
612
555
|
const searchResutlToolbar = _jsxs(_Fragment, { children: [(dcmtsReturned != dcmtsFound) && _jsx("p", { style: { textAlign: 'center', padding: '1px 4px', borderRadius: '3px', display: 'flex' }, children: `${dcmtsReturned}/${dcmtsFound} restituiti` }), context === SearchResultContext.FAVORITES_AND_RECENTS &&
|
|
613
|
-
_jsx("div", { style: { display: 'flex', alignItems: 'center', gap: '5px' }, children: _jsx(TMButton, { btnStyle: 'icon', icon: _jsx(IconDelete, { color: 'white' }), caption: "Rimuovi da " + (selectedSearchResult?.category === "Favorites" ? '"Preferiti"' : '"Recenti"'), disabled: getSelectedDcmtsOrFocused(selectedItems, focusedItem).length <= 0, onClick: removeDcmtFromFavsOrRecents }) }), _jsx(TMButton, { btnStyle: 'icon', icon: _jsx(IconRefresh, { color: 'white' }), caption: SDKUI_Localizator.Refresh, onClick:
|
|
556
|
+
_jsx("div", { style: { display: 'flex', alignItems: 'center', gap: '5px' }, children: _jsx(TMButton, { btnStyle: 'icon', icon: _jsx(IconDelete, { color: 'white' }), caption: "Rimuovi da " + (selectedSearchResult?.category === "Favorites" ? '"Preferiti"' : '"Recenti"'), disabled: getSelectedDcmtsOrFocused(selectedItems, focusedItem).length <= 0, onClick: removeDcmtFromFavsOrRecents }) }), _jsx(TMButton, { btnStyle: 'icon', icon: _jsx(IconRefresh, { color: 'white' }), caption: SDKUI_Localizator.Refresh, onClick: onRefreshSearchAsyncDatagrid }), _jsx(TMContextMenu, { items: operationItems, trigger: "left", children: _jsx(IconMenuVertical, { color: 'white', cursor: 'pointer' }) })] });
|
|
614
557
|
const tmSearchResult = useMemo(() => (!searchResults || searchResults.length <= 0)
|
|
615
|
-
? _jsxs("div", { style: { display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', height: '100%', width: '100%' }, children: [_jsx(IconBoard, { fontSize: 96 }), _jsx("div", { style: { fontSize: "15px", marginTop: "10px" }, children: SDKUI_Localizator.NoDcmtFound }), openAddDocumentForm && _jsx("div", { style: { marginTop: "10px" }, children: _jsx(TMButton, { fontSize: "15px", icon: _jsx("i", { className: 'dx-icon-share' }), caption: SDKUI_Localizator.Share, onClick: openAddDocumentForm }) })] })
|
|
558
|
+
? _jsxs("div", { style: { display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', height: '100%', width: '100%' }, children: [_jsx(IconBoard, { fontSize: 96 }), showNoDcmtFoundMessage && _jsx("div", { style: { fontSize: "15px", marginTop: "10px" }, children: SDKUI_Localizator.NoDcmtFound }), openAddDocumentForm && _jsx("div", { style: { marginTop: "10px" }, children: _jsx(TMButton, { fontSize: "15px", icon: _jsx("i", { className: 'dx-icon-share' }), caption: SDKUI_Localizator.Share, onClick: openAddDocumentForm }) })] })
|
|
616
559
|
:
|
|
617
560
|
_jsxs(_Fragment, { children: [_jsxs(TMLayoutItem, { height: '100%', children: [_jsxs("div", { ref: floatingBarContainerRef, style: { position: 'relative', height: '100%', width: '100%' }, children: [_jsxs(TMSplitterLayout, { direction: 'horizontal', overflow: 'visible', separatorSize: Gutters.getGutters(), separatorActiveColor: 'transparent', separatorColor: 'transparent', min: ['0', '0'], showSeparator: showSelector && deviceType !== DeviceType.MOBILE, start: showSelector ? deviceType !== DeviceType.MOBILE ? ['30%', '70%'] : splitterSize : ['0%', '100%'], children: [showSelector ?
|
|
618
561
|
_jsx(TMLayoutItem, { children: _jsx(TMSearchResultSelector, { searchResults: currentSearchResults, disableAccordionIfSingleCategory: disableAccordionIfSingleCategory, selectedTID: selectedSearchResultTID, selectedSearchResult: selectedSearchResult, autoSelectFirst: !isMobile || currentSearchResults.length === 1, onSelectionChanged: onSearchResultSelectionChanged }) })
|
|
619
562
|
:
|
|
620
|
-
_jsx(_Fragment, {}), _jsx(TMLayoutItem, { children: _jsx(TMSearchResultGrid, {
|
|
621
|
-
|
|
622
|
-
setIsOpenBatchUpdate(false);
|
|
623
|
-
}, onSavedCallbackAsync: async () => {
|
|
624
|
-
setIsOpenBatchUpdate(false);
|
|
625
|
-
setIsModifiedBatchUpdate(false);
|
|
626
|
-
await refreshSelectionDataRowsAsync();
|
|
627
|
-
}, onStatusChanged: (isModified) => { setIsModifiedBatchUpdate(isModified); } }), _jsx(TMToppyDraggableHelpCenter, { usePortal: toppyHelpCenterUsePortal, isVisible: isToppyHelpCenterVisible, content: _jsx("div", { style: { display: 'flex', flexDirection: 'column', gap: '10px' }, children: _jsx(WorkFlowOperationButtons, { deviceType: deviceType, onApprove: () => {
|
|
628
|
-
setShowApprovePopup(true);
|
|
563
|
+
_jsx(_Fragment, {}), _jsx(TMLayoutItem, { children: _jsx(TMSearchResultGrid, { openInOffice: openInOffice, fromDTD: fromDTD, operationItems: operationItems, allUsers: allUsers, inputFocusedItem: focusedItem, inputSelectedItems: selectedItems, showExportForm: showExportForm, onFocusedItemChanged: setFocusedItem, onDownloadDcmtsAsync: async (inputDcmts, downloadType, downloadMode, _y, confirmAttachments) => await downloadDcmtsAsync(inputDcmts, downloadType, downloadMode, onFileOpened, confirmAttachments), lastUpdateSearchTime: lastUpdateSearchTime, searchResult: searchResults.length > 1 ? selectedSearchResult : searchResults[0], onSelectionChanged: (items) => { setSelectedItems(items); }, onDblClick: () => openFormHandler(LayoutModes.Update), showSearchTMDatagrid: showSearchTMDatagrid, onVisibleItemChanged: setVisibleItems, updateDataColumnsFromDataGrid: updateDataColumnsFromDataGrid, updateDataSourceFromDataGrid: updateDataSourceFromDataGrid, updateSelectedRowKeysFromDataGrid: updateSelectedRowKeysFromDataGrid }) })] }), renderFloatingBar] }), _jsx(TMToppyDraggableHelpCenter, { usePortal: toppyHelpCenterUsePortal, isVisible: isToppyHelpCenterVisible, content: _jsx("div", { style: { display: 'flex', flexDirection: 'column', gap: '10px' }, children: _jsx(WorkFlowOperationButtons, { dtd: fromDTD, deviceType: deviceType, onApprove: () => {
|
|
564
|
+
updateShowApprovePopup(true);
|
|
629
565
|
}, onSignApprove: () => {
|
|
630
566
|
handleSignApprove();
|
|
631
567
|
}, onReject: () => {
|
|
632
|
-
|
|
568
|
+
updateShowRejectPopup(true);
|
|
633
569
|
}, onReAssign: () => {
|
|
634
|
-
|
|
570
|
+
updateShowReAssignPopup(true);
|
|
635
571
|
}, onMoreInfo: () => {
|
|
636
|
-
|
|
637
|
-
}, approveDisable: selectedDocs.length === 0, signApproveDisable: disableSignApproveDisable, rejectDisable: selectedDocs.length === 0, reassignDisable: selectedDocs.length === 0, infoDisable: selectedDocs.length !== 1
|
|
638
|
-
_jsx(TMChooserForm, { dataSource: relatedDcmtsChooserDataSource, onChoose: async (selectedRelation) => {
|
|
639
|
-
try {
|
|
640
|
-
setShowRelatedDcmtsChooser(false);
|
|
641
|
-
TMSpinner.show({ description: SDKUI_Localizator.Loading });
|
|
642
|
-
const relation = relatedDcmts?.find(r => r.id === selectedRelation[0]);
|
|
643
|
-
if (!relation || !archiveType)
|
|
644
|
-
return;
|
|
645
|
-
await archiveRelatedDcmtHandler(relation, archiveType);
|
|
646
|
-
}
|
|
647
|
-
catch (error) {
|
|
648
|
-
TMExceptionBoxManager.show({ exception: error });
|
|
649
|
-
}
|
|
650
|
-
finally {
|
|
651
|
-
TMSpinner.hide();
|
|
652
|
-
}
|
|
653
|
-
}, onClose: () => setShowRelatedDcmtsChooser(false), manageUseLocalizedName: false }), showManyToManyChooser &&
|
|
654
|
-
_jsx(TMChooserForm, { dataSource: manyToManyChooserDataSource, onChoose: async (selectedRelation) => {
|
|
655
|
-
try {
|
|
656
|
-
setShowManyToManyChooser(false);
|
|
657
|
-
TMSpinner.show({ description: SDKUI_Localizator.Loading });
|
|
658
|
-
const relation = manyToManyRelations?.find(r => r.id === selectedRelation[0]);
|
|
659
|
-
if (!relation)
|
|
660
|
-
return;
|
|
661
|
-
await executeManyToManyPairing(relation, isPairingManyToMany);
|
|
662
|
-
}
|
|
663
|
-
catch (error) {
|
|
664
|
-
TMExceptionBoxManager.show({ exception: error });
|
|
665
|
-
}
|
|
666
|
-
finally {
|
|
667
|
-
TMSpinner.hide();
|
|
668
|
-
}
|
|
669
|
-
}, onClose: () => setShowManyToManyChooser(false), manageUseLocalizedName: false }), showPairDcmtsModal &&
|
|
670
|
-
_jsx(TMModal, { title: (isPairingManyToMany ? "Abbina" : "Disabbina") + " documenti", onClose: () => setShowPairDcmtsModal(false), width: isMobile ? '90%' : '50%', height: isMobile ? '90%' : '70%', children: _jsx(TMSearchResult, { searchResults: pairedSearchResults, onRefreshAfterAddDcmtToFavs: onRefreshAfterAddDcmtToFavs, onRefreshSearchAsync: onRefreshSearchAsync, onFileOpened: onFileOpened, onTaskCreateRequest: onTaskCreateRequest, openWGsCopyMoveForm: openWGsCopyMoveForm, editPdfForm: editPdfForm, openEditPdf: openEditPdf, openS4TViewer: openS4TViewer, onOpenS4TViewerRequest: onOpenS4TViewerRequest, passToArchiveCallback: passToArchiveCallback, showTodoDcmtForm: showTodoDcmtForm, allowFloatingBar: false, floatingActionConfig: pairFloatingActionConfig, showBackButton: false, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, toppyHelpCenterUsePortal: toppyHelpCenterUsePortal, showToppyDraggableHelpCenter: showToppyDraggableHelpCenter }) }), showPairSearchModal &&
|
|
671
|
-
_jsx(TMModal, { title: "Ricerca documenti", onClose: () => setShowPairSearchModal(false), width: isMobile ? '90%' : '50%', height: isMobile ? '90%' : '70%', children: _jsx(TMSearch, { onlyShowSearchQueryPanel: true, inputTID: pairSearchModalTargetTID, inputMids: pairSearchModalInputMids, floatingActionConfig: pairSearchModalFloatingActionConfig, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }) }), isOpenSharedArchive && _jsx(TMModal, { title: "Archiviazione condivisa", onClose: () => {
|
|
672
|
-
setIsOpenSharedArchive(false);
|
|
673
|
-
}, width: isMobile ? '90%' : '60%', height: isMobile ? '90%' : '80%', children: _jsx(TMArchive, { inputDID: focusedItem?.DID, inputTID: focusedItem?.TID, inputMids: currentMetadataValues.filter(md => md.mid && md.mid > 100).map(md => ({ mid: md.mid, value: md.value ?? '' })), isSharedArchive: true, inputFile: sharedDcmtFile, onSavedAsyncCallback: async (tid, did) => {
|
|
674
|
-
setIsOpenSharedArchive(false);
|
|
675
|
-
await onRefreshSearchAsync?.();
|
|
676
|
-
}, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }) }), sharedDcmtSearchResults.length > 0 &&
|
|
677
|
-
_jsx(TMModal, { title: "Documenti condivisi", onClose: () => {
|
|
678
|
-
setSharedDcmtSearchResults([]);
|
|
679
|
-
}, width: isMobile ? '90%' : '60%', height: isMobile ? '90%' : '80%', children: _jsx(TMSearchResult, { searchResults: sharedDcmtSearchResults, allowFloatingBar: false, showSelector: true, disableAccordionIfSingleCategory: true, showBackButton: isMobile, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }) }), (showCheckoutInformationForm && fromDTD && getSelectedDcmtsOrFocused(selectedItems, focusedItem).length > 0) &&
|
|
680
|
-
_jsx(TMDcmtCheckoutInfoForm, { dtdName: fromDTD.name ?? SDKUI_Localizator.SearchResult, selectedDcmtOrFocused: getSelectedDcmtsOrFocused(selectedItems, focusedItem)[0], onClose: hideCheckoutInformationFormCallback }), (floatingActionConfig && floatingActionConfig.isVisible) && _jsx(TMSearchResultFloatingActionButton, { selectedDcmtsOrFocused: getSelectedDcmtsOrFocused(selectedItems, focusedItem), config: floatingActionConfig })] }), [
|
|
572
|
+
updateShowMoreInfoPopup(true);
|
|
573
|
+
}, approveDisable: selectedDocs.length === 0, signApproveDisable: disableSignApproveDisable, rejectDisable: selectedDocs.length === 0, reassignDisable: selectedDocs.length === 0, infoDisable: selectedDocs.length !== 1 }) }) })] }), (floatingActionConfig && floatingActionConfig.isVisible) && _jsx(TMSearchResultFloatingActionButton, { selectedDcmtsOrFocused: getSelectedDcmtsOrFocused(selectedItems, focusedItem), config: floatingActionConfig })] }), [
|
|
681
574
|
searchResults,
|
|
682
575
|
selectedSearchResult,
|
|
683
576
|
lastUpdateSearchTime,
|
|
684
577
|
focusedItem,
|
|
685
578
|
selectedItems,
|
|
686
579
|
fromDTD,
|
|
687
|
-
currentTIDHasDetailRelations,
|
|
688
|
-
currentTIDHasMasterRelations,
|
|
689
|
-
canArchiveMasterRelation,
|
|
690
|
-
canArchiveDetailRelation,
|
|
691
580
|
showApprovePopup,
|
|
692
581
|
showRejectPopup,
|
|
693
582
|
showReAssignPopup,
|
|
694
|
-
showFloatingBar,
|
|
695
583
|
isOpenBatchUpdate,
|
|
696
584
|
isOpenDetails,
|
|
697
585
|
isOpenMaster,
|
|
698
586
|
isOpenDcmtForm,
|
|
699
|
-
isOpenArchiveRelationForm,
|
|
700
587
|
showToppyForApprove,
|
|
701
588
|
floatingActionConfig,
|
|
702
589
|
disableAccordionIfSingleCategory,
|
|
703
590
|
getTitleHeader,
|
|
704
591
|
openS4TViewer,
|
|
705
|
-
showRelatedDcmtsChooser,
|
|
706
|
-
relatedDcmts,
|
|
707
|
-
setShowRelatedDcmtsChooser,
|
|
708
|
-
relatedDcmtsChooserDataSource,
|
|
709
|
-
showManyToManyChooser,
|
|
710
|
-
manyToManyRelations,
|
|
711
|
-
manyToManyChooserDataSource,
|
|
712
|
-
showPairDcmtsModal,
|
|
713
|
-
isPairingManyToMany,
|
|
714
|
-
pairedSearchResults,
|
|
715
|
-
selectedManyToManyRelation,
|
|
716
|
-
pairFloatingActionConfig,
|
|
717
|
-
hasManyToManyRelation,
|
|
718
|
-
showPairSearchModal,
|
|
719
|
-
pairSearchModalFloatingActionConfig,
|
|
720
|
-
pairSearchModalTargetTID,
|
|
721
|
-
pairSearchModalParentTID,
|
|
722
|
-
pairSearchModalParentDID,
|
|
723
|
-
pairSearchModalRelation,
|
|
724
|
-
pairSearchModalInputMids,
|
|
725
|
-
isOpenSharedArchive,
|
|
726
|
-
sharedDcmtSearchResults,
|
|
727
592
|
showBackButton,
|
|
728
593
|
isMobile,
|
|
729
594
|
currentMetadataValues,
|
|
730
|
-
|
|
731
|
-
onRefreshSearchAsync,
|
|
595
|
+
onRefreshSearchAsyncDatagrid,
|
|
732
596
|
handleNavigateToWGs,
|
|
733
597
|
handleNavigateToDossiers,
|
|
734
|
-
editPdfForm
|
|
598
|
+
editPdfForm,
|
|
599
|
+
showNoDcmtFoundMessage
|
|
735
600
|
]);
|
|
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]);
|
|
601
|
+
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, onRefreshBlogDatagrid]);
|
|
737
602
|
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
|
-
const tmDcmtPreview = useMemo(() => _jsx(TMDcmtPreviewWrapper, { currentDcmt: currentDcmt }
|
|
603
|
+
const tmDcmtPreview = useMemo(() => _jsx(TMDcmtPreviewWrapper, { refreshPreviewTrigger: refreshPreviewTrigger, currentDcmt: currentDcmt }), [currentDcmt, refreshPreviewTrigger]);
|
|
604
|
+
// Auto-fetch indexing info when drawer is open and focusedItem changes
|
|
605
|
+
useEffect(() => {
|
|
606
|
+
if (!focusedItem || !showIndexingInfo)
|
|
607
|
+
return;
|
|
608
|
+
const fetchData = async () => {
|
|
609
|
+
try {
|
|
610
|
+
setLoadingIndexingInfo(true);
|
|
611
|
+
const msg = await SDK_Globals.tmSession?.NewSearchEngine().FreeSearchGetDcmtInfoAsync(focusedItem.TID, focusedItem.DID);
|
|
612
|
+
setIndexingInfo(msg ?? '');
|
|
613
|
+
}
|
|
614
|
+
catch (e) {
|
|
615
|
+
TMExceptionBoxManager.show({ exception: e });
|
|
616
|
+
}
|
|
617
|
+
finally {
|
|
618
|
+
setLoadingIndexingInfo(false);
|
|
619
|
+
}
|
|
620
|
+
};
|
|
621
|
+
fetchData();
|
|
622
|
+
}, [focusedItem, showIndexingInfo]);
|
|
739
623
|
const handleToggleIndexingInfo = async () => {
|
|
740
624
|
if (!focusedItem)
|
|
741
625
|
return;
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
}
|
|
757
|
-
catch (e) {
|
|
758
|
-
TMExceptionBoxManager.show({ exception: e });
|
|
759
|
-
}
|
|
760
|
-
finally {
|
|
761
|
-
setLoadingIndexingInfo(false);
|
|
626
|
+
const newShowState = !showIndexingInfo;
|
|
627
|
+
setShowIndexingInfo(newShowState);
|
|
628
|
+
if (newShowState) {
|
|
629
|
+
try {
|
|
630
|
+
setLoadingIndexingInfo(true);
|
|
631
|
+
const msg = await SDK_Globals.tmSession?.NewSearchEngine().FreeSearchGetDcmtInfoAsync(focusedItem.TID, focusedItem.DID);
|
|
632
|
+
setIndexingInfo(msg ?? '');
|
|
633
|
+
}
|
|
634
|
+
catch (e) {
|
|
635
|
+
TMExceptionBoxManager.show({ exception: e });
|
|
636
|
+
}
|
|
637
|
+
finally {
|
|
638
|
+
setLoadingIndexingInfo(false);
|
|
639
|
+
}
|
|
762
640
|
}
|
|
763
641
|
};
|
|
764
642
|
const tmFullTextSearch = useMemo(() => {
|
|
765
643
|
if (!focusedItem) {
|
|
766
644
|
return (_jsxs(StyledPlaceholder, { children: [" ", _jsx("p", { children: "Seleziona un documento per visualizzare i dettagli della ricerca full-text" }), " "] }));
|
|
767
645
|
}
|
|
768
|
-
|
|
769
|
-
const ftExplanationsColumnIndex = selectedSearchResult?.selectMIDs?.findIndex(mid => mid === 0); //nosonar
|
|
646
|
+
const ftExplanationsColumnIndex = selectedSearchResult?.dtdResult?.columns?.findIndex(col => col.caption === 'FTExplanations');
|
|
770
647
|
if (ftExplanationsColumnIndex === undefined || ftExplanationsColumnIndex < 0) {
|
|
771
648
|
return (_jsxs(StyledPlaceholder, { children: [" ", _jsx("p", { children: "Nessuna info full-text disponibile" }), " "] }));
|
|
772
649
|
}
|
|
@@ -778,23 +655,21 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
|
|
|
778
655
|
if (!ftExplanation) {
|
|
779
656
|
return (_jsxs(StyledPlaceholder, { children: [" ", _jsx("p", { children: "Nessuna info disponibile per questo documento" }), " "] }));
|
|
780
657
|
}
|
|
781
|
-
|
|
782
|
-
|
|
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]);
|
|
658
|
+
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, "..."] }))] }))] })] }));
|
|
659
|
+
}, [selectedSearchResult, focusedItem, indexingInfo, showIndexingInfo, loadingIndexingInfo]);
|
|
785
660
|
const allInitialPanelVisibility = {
|
|
786
661
|
'tmSearchResult': true,
|
|
787
662
|
'tmBlog': false,
|
|
788
663
|
'tmSysMetadata': false,
|
|
664
|
+
'tmFullTextSearch': false,
|
|
789
665
|
'tmDcmtPreview': false,
|
|
790
|
-
// 'tmFullTextSearch': false,
|
|
791
666
|
};
|
|
792
667
|
const initialPanelDimensions = {
|
|
793
668
|
'tmSearchResult': { width: '25%', height: '100%' },
|
|
794
669
|
'tmBlog': { width: '25%', height: '100%' },
|
|
795
670
|
'tmSysMetadata': { width: '25%', height: '100%' },
|
|
671
|
+
'tmFullTextSearch': { width: '25%', height: '100%' },
|
|
796
672
|
'tmDcmtPreview': { width: '25%', height: '100%' },
|
|
797
|
-
// 'tmFullTextSearch': { width: '25%', height: '100%' },
|
|
798
673
|
};
|
|
799
674
|
const initialPanels = useMemo(() => [
|
|
800
675
|
{
|
|
@@ -813,34 +688,34 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
|
|
|
813
688
|
toolbar: searchResutlToolbar
|
|
814
689
|
},
|
|
815
690
|
},
|
|
816
|
-
toolbarOptions: { icon: _jsx(IconSearchCheck, { fontSize: 24 }), visible:
|
|
691
|
+
toolbarOptions: { icon: _jsx(IconSearchCheck, { fontSize: 24 }), visible: getSearchToolbarVisibility(SDK_Globals.tmSession?.SessionDescr?.appModuleID ?? AppModules.SURFER).tmSearchResult, orderNumber: 1, isActive: allInitialPanelVisibility['tmSearchResult'] }
|
|
817
692
|
},
|
|
818
693
|
{
|
|
819
694
|
id: 'tmBlog',
|
|
820
695
|
name: SDKUI_Localizator.BlogCase,
|
|
821
696
|
contentOptions: { component: tmBlog, panelContainer: { title: SDKUI_Localizator.BlogCase, allowMaximize: !isMobile } },
|
|
822
|
-
toolbarOptions: { icon: _jsx(IconBoard, { fontSize: 24 }), visible:
|
|
697
|
+
toolbarOptions: { icon: _jsx(IconBoard, { fontSize: 24 }), visible: getSearchToolbarVisibility(SDK_Globals.tmSession?.SessionDescr?.appModuleID ?? AppModules.SURFER).tmBlog, orderNumber: 2, isActive: allInitialPanelVisibility['tmBlog'] }
|
|
823
698
|
},
|
|
824
699
|
{
|
|
825
700
|
id: 'tmSysMetadata',
|
|
826
701
|
name: SDKUI_Localizator.MetadataSystem,
|
|
827
702
|
contentOptions: { component: tmSysMetadata, panelContainer: { title: SDKUI_Localizator.MetadataSystem, allowMaximize: !isMobile } },
|
|
828
|
-
toolbarOptions: { icon: _jsx(IconDcmtTypeSys, { fontSize: 24 }), visible:
|
|
703
|
+
toolbarOptions: { icon: _jsx(IconDcmtTypeSys, { fontSize: 24 }), visible: getSearchToolbarVisibility(SDK_Globals.tmSession?.SessionDescr?.appModuleID ?? AppModules.SURFER).tmSysMetadata, orderNumber: 3, isActive: allInitialPanelVisibility['tmSysMetadata'] }
|
|
829
704
|
},
|
|
705
|
+
...(context === SearchResultContext.FREE_SEARCH ? [
|
|
706
|
+
{
|
|
707
|
+
id: 'tmFullTextSearch',
|
|
708
|
+
name: SDKUI_Localizator.ResultDetails,
|
|
709
|
+
contentOptions: { component: tmFullTextSearch, panelContainer: { title: SDKUI_Localizator.ResultDetails, allowMaximize: !isMobile } },
|
|
710
|
+
toolbarOptions: { icon: _jsx(IconPlatform, { fontSize: 20 }), visible: getSearchToolbarVisibility(SDK_Globals.tmSession?.SessionDescr?.appModuleID ?? AppModules.SURFER).tmFullTextSearch, orderNumber: 4, isActive: allInitialPanelVisibility['tmFullTextSearch'] }
|
|
711
|
+
}
|
|
712
|
+
] : []),
|
|
830
713
|
{
|
|
831
714
|
id: 'tmDcmtPreview',
|
|
832
715
|
name: SDKUI_Localizator.PreviewDocument,
|
|
833
716
|
contentOptions: { component: tmDcmtPreview },
|
|
834
|
-
toolbarOptions: { icon: _jsx(IconShow, { fontSize: 24 }), visible:
|
|
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
|
-
// ] : [])
|
|
717
|
+
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'] }
|
|
718
|
+
}
|
|
844
719
|
], [tmSearchResult, tmBlog, tmSysMetadata, tmDcmtPreview, tmFullTextSearch, showToolbarHeader, context, isMobile]);
|
|
845
720
|
return (_jsxs(StyledMultiViewPanel, { "$isVisible": isVisible, children: [_jsx(StyledMultiViewPanel, { "$isVisible": !isOpenDcmtForm && !isOpenDetails && !isOpenMaster, style: {
|
|
846
721
|
display: 'flex',
|
|
@@ -852,31 +727,30 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
|
|
|
852
727
|
}, children: _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(TMLayoutWaitingContainer, { direction: 'vertical', showWaitPanel: showCicoWaitPanel, showWaitPanelPrimary: showCicoPrimaryProgress, waitPanelTitle: cicoWaitPanelTitle, waitPanelTextPrimary: cicoPrimaryProgressText, waitPanelValuePrimary: cicoPrimaryProgressValue, waitPanelMaxValuePrimary: cicoPrimaryProgressMax, isCancelable: true, abortController: abortControllerLocal, children: (groupId && groupId.length > 0) ?
|
|
853
728
|
_jsx(TMPanelManagerContainer, { panels: initialPanels, direction: "horizontal", parentId: groupId, showToolbar: showSearchResultSidebar })
|
|
854
729
|
:
|
|
855
|
-
_jsx(TMPanelManagerProvider, { panels: initialPanels, initialVisibility: allInitialPanelVisibility, defaultDimensions: initialPanelDimensions, initialDimensions: initialPanelDimensions, initialMobilePanelId: 'tmSearchResult', children: _jsx(TMPanelManagerContainer, { panels: initialPanels, direction: "horizontal", parentId: groupId, showToolbar: showSearchResultSidebar }) }) }) }) }),
|
|
856
|
-
return (_jsx(StyledModalContainer, { style: { backgroundColor: 'white' }, children: _jsx(TMMasterDetailDcmts, { deviceType: deviceType, inputDcmts: [dcmt], isForMaster: true, allowNavigation: false, onBack: () => handleRemoveItem(dcmt.TID, dcmt.DID), appendMasterDcmts: handleAddItem, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }) }, `${index}-${dcmt.DID}`));
|
|
857
|
-
})] }), _jsx(StyledMultiViewPanel, { "$isVisible": isOpenDcmtForm, children: isOpenDcmtForm && focusedItem?.TID !== undefined && focusedItem?.DID !== undefined && _jsx(TMDcmtForm, { isModal: openDcmtFormAsModal || (dcmtFormLayoutMode === LayoutModes.Ark && focusedItem?.DID), titleModal: fromDTD?.name ?? '', TID: focusedItem.TID, DID: focusedItem.DID, allowButtonsRefs: true, layoutMode: dcmtFormLayoutMode, count: visibleItems.length, itemIndex: visibleItems.findIndex(o => o.rowIndex === focusedItem?.rowIndex) + 1, canNext: canNavigateHandler('next'), canPrev: canNavigateHandler('prev'), onNext: () => onNavigateHandler('next'), onPrev: () => onNavigateHandler('prev'), onClose: () => { setIsOpenDcmtForm(false); }, onWFOperationCompleted: onWFOperationCompleted, onTaskCreateRequest: onTaskCreateRequest, onSavedAsyncCallback: handleSavedAsyncCallback, openS4TViewer: openS4TViewer, onOpenS4TViewerRequest: onOpenS4TViewerRequest, onReferenceClick: onReferenceClick, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, moreInfoTasks: getMoreInfoTasksForDocument(allTasks, focusedItem?.TID, focusedItem?.DID), showDcmtFormSidebar: showSearchResultSidebar }) }), isOpenArchiveRelationForm && _jsx(TMDcmtForm, { isModal: true, titleModal: SDKUI_Localizator.Archive + ' - ' + (archiveType === 'detail' ? SDKUI_Localizator.DcmtsDetail : SDKUI_Localizator.DcmtsMaster), TID: archiveRelatedDcmtFormTID, layoutMode: LayoutModes.Ark, inputMids: archiveRelatedDcmtFormMids, showBackButton: false, allowButtonsRefs: false, onClose: () => {
|
|
858
|
-
setIsOpenArchiveRelationForm(false);
|
|
859
|
-
setArchiveType(undefined);
|
|
860
|
-
setArchiveRelatedDcmtFormTID(undefined);
|
|
861
|
-
setArchiveRelatedDcmtFormMids([]);
|
|
862
|
-
}, onSavedAsyncCallback: async (tid, did, metadataResult) => {
|
|
863
|
-
setIsOpenArchiveRelationForm(false);
|
|
864
|
-
setArchiveType(undefined);
|
|
865
|
-
setArchiveRelatedDcmtFormTID(undefined);
|
|
866
|
-
setArchiveRelatedDcmtFormMids([]);
|
|
867
|
-
await onRefreshSearchAsync?.();
|
|
868
|
-
}, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, showDcmtFormSidebar: showSearchResultSidebar }), (showSignSettingsForm && fromDTD) && _jsx(TMSignSettingsForm, { fromDTD: fromDTD, inputDcmts: allFieldSelectedDocs, onCloseSignSettingsForm: closeSignSettingsForm, onSavedAsyncCallback: handleSavedAsyncCallback }), (showHistory && fromDTD && getSelectedDcmtsOrFocused(selectedItems, focusedItem).length > 0) && _jsx(TMViewHistoryDcmt, { fromDTD: fromDTD, deviceType: deviceType, inputDcmt: getSelectedDcmtsOrFocused(selectedItems, focusedItem)[0], onClose: hideHistoryCallback, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }), (commentFormState.show && getSelectedDcmtsOrFocused(selectedItems, focusedItem).length > 0) && _jsx(TMBlogCommentForm, { context: { engine: 'SearchEngine', object: { tid: getSelectedDcmtsOrFocused(selectedItems, focusedItem)[0].TID, did: getSelectedDcmtsOrFocused(selectedItems, focusedItem)[0].DID } }, onClose: hideCommentFormCallback, refreshCallback: triggerBlogRefresh, participants: [], showAttachmentsSection: true, allArchivedDocumentsFileItems: convertSearchResultDescriptorToFileItems(currentSearchResults ?? []), isCommentRequired: commentFormState.isRequired, removeAndEditAttachment: commentFormState.removeAndEditAttachment, selectedAttachmentDid: [Number(getSelectedDcmtsOrFocused(selectedItems, focusedItem)[0].DID)] })] }));
|
|
730
|
+
_jsx(TMPanelManagerProvider, { panels: initialPanels, initialVisibility: allInitialPanelVisibility, defaultDimensions: initialPanelDimensions, initialDimensions: initialPanelDimensions, initialMobilePanelId: 'tmSearchResult', children: _jsx(TMPanelManagerContainer, { panels: initialPanels, direction: "horizontal", parentId: groupId, showToolbar: showSearchResultSidebar }) }) }) }) }), renderDcmtOperations] }));
|
|
869
731
|
};
|
|
870
732
|
export default TMSearchResult;
|
|
871
|
-
const TMSearchResultGrid = ({ openInOffice, fromDTD, allUsers, inputFocusedItem,
|
|
733
|
+
const TMSearchResultGrid = ({ openInOffice, fromDTD, operationItems, allUsers, inputFocusedItem, allowMultipleSelection = true, showExportForm = false, onFocusedItemChanged, onDownloadDcmtsAsync, onVisibleItemChanged, inputSelectedItems = [], lastUpdateSearchTime, searchResult, onSelectionChanged, onDblClick, showSearchTMDatagrid, updateDataColumnsFromDataGrid, updateDataSourceFromDataGrid, updateSelectedRowKeysFromDataGrid }) => {
|
|
872
734
|
const [dataSource, setDataSource] = useState();
|
|
873
735
|
const [columns, setColumns] = useState([]);
|
|
874
|
-
// State to store selected row keys
|
|
875
736
|
const [selectedRowKeys, setSelectedRowKeys] = useState([]);
|
|
876
737
|
const [focusedItem, setFocusedItem] = useState();
|
|
877
738
|
const [visibleItems, setVisibleItems] = useState([]);
|
|
878
739
|
const [pageSize, setPageSize] = useState(SDKUI_Globals.userSettings.searchSettings?.pageSize ?? TMDataGridPageSize.Large);
|
|
879
740
|
const [isDataGridReady, setIsDataGridReady] = useState(false);
|
|
741
|
+
const dataGridRef = useRef(null);
|
|
742
|
+
// Sincronizza selectedRowKeys con il componente padre ad ogni modifica
|
|
743
|
+
useEffect(() => {
|
|
744
|
+
updateSelectedRowKeysFromDataGrid(selectedRowKeys);
|
|
745
|
+
}, [selectedRowKeys]);
|
|
746
|
+
// Sincronizza columns con il componente padre ad ogni modifica
|
|
747
|
+
useEffect(() => {
|
|
748
|
+
updateDataColumnsFromDataGrid(columns);
|
|
749
|
+
}, [columns]);
|
|
750
|
+
// Sincronizza dataSource con il componente padre ad ogni modifica
|
|
751
|
+
useEffect(() => {
|
|
752
|
+
updateDataSourceFromDataGrid(dataSource ?? []);
|
|
753
|
+
}, [dataSource]);
|
|
880
754
|
const { loadDataListsAsync, renderDataListCell, dataListsCache } = useDataListItem();
|
|
881
755
|
const { loadUsersAsync, renderUserIdViewer, usersCache } = useDataUserIdItem();
|
|
882
756
|
useEffect(() => {
|
|
@@ -913,7 +787,8 @@ const TMSearchResultGrid = ({ openInOffice, fromDTD, allUsers, inputFocusedItem,
|
|
|
913
787
|
const currentDataSource = dataSource ?? [];
|
|
914
788
|
setTimeout(() => {
|
|
915
789
|
// Remove the selected item from the data source by filtering it out.
|
|
916
|
-
|
|
790
|
+
const updatedDataSource = currentDataSource.filter((data) => data.rowIndex !== current.rowIndex);
|
|
791
|
+
setDataSource(updatedDataSource);
|
|
917
792
|
// Clear any selection, focused item, and update callbacks.
|
|
918
793
|
onSelectionChanged?.([]);
|
|
919
794
|
setSelectedRowKeys([]);
|
|
@@ -940,7 +815,8 @@ const TMSearchResultGrid = ({ openInOffice, fromDTD, allUsers, inputFocusedItem,
|
|
|
940
815
|
const currentDataSource = dataSource ?? [];
|
|
941
816
|
setTimeout(() => {
|
|
942
817
|
// Remove all selected items from the data source.
|
|
943
|
-
|
|
818
|
+
const updatedDataSource = currentDataSource.filter((data) => !dcmts.some((d) => d.rowIndex === data.rowIndex));
|
|
819
|
+
setDataSource(updatedDataSource);
|
|
944
820
|
// Clear selections and focus after deletion.
|
|
945
821
|
onSelectionChanged?.([]);
|
|
946
822
|
setSelectedRowKeys([]);
|
|
@@ -1147,6 +1023,19 @@ const TMSearchResultGrid = ({ openInOffice, fromDTD, allUsers, inputFocusedItem,
|
|
|
1147
1023
|
]);
|
|
1148
1024
|
// Genera colonne con cache popolate per garantire headerFilter completi
|
|
1149
1025
|
const cols = generateColumns();
|
|
1026
|
+
// Cancella i filtri SOLO se le colonne sono cambiate (es. cambio TID).
|
|
1027
|
+
// Se le colonne restano le stesse (es. refresh sullo stesso TID), il filtro resta valido.
|
|
1028
|
+
// Previene l'errore E1047 quando il filtro riferisce campi non più presenti nelle nuove colonne.
|
|
1029
|
+
const oldFields = columns.map(c => c.dataField);
|
|
1030
|
+
const newFields = cols.map(c => c.dataField);
|
|
1031
|
+
const columnsChanged = oldFields.length !== newFields.length ||
|
|
1032
|
+
oldFields.some((f, i) => f !== newFields[i]);
|
|
1033
|
+
if (columnsChanged) {
|
|
1034
|
+
const gridInstance = dataGridRef.current?.instance();
|
|
1035
|
+
if (gridInstance) {
|
|
1036
|
+
gridInstance.clearFilter();
|
|
1037
|
+
}
|
|
1038
|
+
}
|
|
1150
1039
|
setColumns(cols);
|
|
1151
1040
|
// Converte i risultati di ricerca in un array semplice per la griglia
|
|
1152
1041
|
let newDataSource = searchResultDescriptorToSimpleArray(searchResult);
|
|
@@ -1223,10 +1112,11 @@ const TMSearchResultGrid = ({ openInOffice, fromDTD, allUsers, inputFocusedItem,
|
|
|
1223
1112
|
if (setVisibleItems === undefined)
|
|
1224
1113
|
return;
|
|
1225
1114
|
const visibleRows = e.component.getVisibleRows();
|
|
1226
|
-
|
|
1115
|
+
const visibleData = visibleRows.map((row) => row.data);
|
|
1116
|
+
setVisibleItems(visibleData);
|
|
1227
1117
|
}, []);
|
|
1228
1118
|
useEffect(() => { onVisibleItemChanged?.(visibleItems); }, [visibleItems]);
|
|
1229
|
-
return _jsxs("div", { style: { width: "100%", height: "100%" }, children: [!isDataGridReady && (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', height: '100%', width: '100%', gap: '10px' }, children: [_jsx(LoadIndicator, { height: 60, width: 60 }), _jsx("div", { children: SDKUI_Localizator.Loading })] })), isDataGridReady && _jsx(TMDataGrid, { id: "tm-search-result", keyExpr: "rowIndex", dataColumns: dataColumns, dataSource: dataSource, repaintChangesOnly: true, selectedRowKeys: selectedRowKeys, focusedRowKey: Number(focusedItem?.rowIndex ?? 0), showSearchPanel:
|
|
1119
|
+
return _jsxs("div", { style: { width: "100%", height: "100%" }, children: [!isDataGridReady && (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', height: '100%', width: '100%', gap: '10px' }, children: [_jsx(LoadIndicator, { height: 60, width: 60 }), _jsx("div", { children: SDKUI_Localizator.Loading })] })), isDataGridReady && _jsx(TMDataGrid, { ref: dataGridRef, id: "tm-search-result", keyExpr: "rowIndex", dataColumns: dataColumns, dataSource: dataSource, repaintChangesOnly: true, selectedRowKeys: selectedRowKeys, focusedRowKey: Number(focusedItem?.rowIndex ?? 0), showSearchPanel: showSearchTMDatagrid, showFilterPanel: true, sorting: { mode: "multiple" }, selection: { mode: allowMultipleSelection ? 'multiple' : 'single' }, pageSize: pageSize, onSelectionChanged: handleSelectionChange, onFocusedRowChanged: handleFocusedRowChange, onRowDblClick: onRowDblClick, onContentReady: onContentReady, showHeaderColumnChooser: true, onKeyDown: onKeyDown, customContextMenuItems: operationItems, counterConfig: { show: true } })] });
|
|
1230
1120
|
};
|
|
1231
1121
|
//#region TMSearchResultSelector
|
|
1232
1122
|
const StyledItemTemplate = styled.div `
|
|
@@ -1258,13 +1148,21 @@ const TMSearchResultSelector = ({ searchResults = [], disableAccordionIfSingleCa
|
|
|
1258
1148
|
sortedCategories.forEach((category) => {
|
|
1259
1149
|
groupedResults[category].sort((a, b) => (a.fromName ?? '').localeCompare(b.fromName ?? ''));
|
|
1260
1150
|
});
|
|
1261
|
-
//
|
|
1262
|
-
//
|
|
1151
|
+
// Sincronizza la selezione interna con quella del parent.
|
|
1152
|
+
// Quando selectedSearchResult è undefined (es. mobile back) resetta.
|
|
1153
|
+
// Quando selectedSearchResult cambia (es. refresh dopo WF operation), cerca il corrispondente
|
|
1154
|
+
// nel nuovo searchResults per aggiornare il reference e mantenere lo stile di selezione.
|
|
1263
1155
|
useEffect(() => {
|
|
1264
1156
|
if (selectedSearchResult === undefined) {
|
|
1265
1157
|
setSelectedResult(undefined);
|
|
1266
1158
|
}
|
|
1267
|
-
|
|
1159
|
+
else {
|
|
1160
|
+
const found = searchResults.find(r => r.fromTID === selectedSearchResult.fromTID);
|
|
1161
|
+
if (found) {
|
|
1162
|
+
setSelectedResult(found);
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1165
|
+
}, [selectedSearchResult, searchResults]);
|
|
1268
1166
|
// Auto-seleziona il primo risultato di ricerca solo se autoSelectFirst è true.
|
|
1269
1167
|
// Su mobile con più risultati, autoSelectFirst è false per permettere all'utente
|
|
1270
1168
|
// di vedere prima la lista dei tipi documento e scegliere manualmente.
|
|
@@ -1312,7 +1210,7 @@ const TMSearchResultSelector = ({ searchResults = [], disableAccordionIfSingleCa
|
|
|
1312
1210
|
default: return category;
|
|
1313
1211
|
}
|
|
1314
1212
|
};
|
|
1315
|
-
const renderItemTemplate = useCallback((data) => (_jsxs("div", { style: { width: '100%', padding: '5px', display: 'flex', alignItems: 'center', justifyContent: 'space-between' }, children: [_jsx(TMTidViewer, { tid: data.fromTID, did: Number(data.dtdResult?.rows?.[0]?.[1]), showIcon: true
|
|
1213
|
+
const renderItemTemplate = useCallback((data) => (_jsxs("div", { style: { width: '100%', padding: '5px', display: 'flex', alignItems: 'center', justifyContent: 'space-between' }, children: [_jsx(TMTidViewer, { tid: data.fromTID, did: Number(data.dtdResult?.rows?.[0]?.[1]), showIcon: true }), _jsx("div", { style: { padding: 3, display: 'flex', alignItems: 'center', justifyContent: 'center', backgroundColor: 'white', color: 'gray', borderRadius: 3 }, children: data.dcmtsReturned })] })), []);
|
|
1316
1214
|
const accordionGroups = useMemo(() => sortedCategories.map((category, index) => ({
|
|
1317
1215
|
id: category,
|
|
1318
1216
|
title: getHeaderTitle(category),
|
|
@@ -1328,10 +1226,10 @@ const TMSearchResultSelector = ({ searchResults = [], disableAccordionIfSingleCa
|
|
|
1328
1226
|
tooltip: 'Numero di tutti documenti'
|
|
1329
1227
|
}
|
|
1330
1228
|
],
|
|
1331
|
-
renderItem: (result, isSelected) => (_jsxs("div", { style: { width: '100%', padding: '5px', display: 'flex', alignItems: 'center', justifyContent: 'space-between' }, children: [_jsx(TMTidViewer, { tid: result.fromTID, did: Number(result.dtdResult?.rows?.[0]?.[1]), showIcon: true
|
|
1229
|
+
renderItem: (result, isSelected) => (_jsxs("div", { style: { width: '100%', padding: '5px', display: 'flex', alignItems: 'center', justifyContent: 'space-between' }, children: [_jsx(TMTidViewer, { tid: result.fromTID, did: Number(result.dtdResult?.rows?.[0]?.[1]), showIcon: true }), _jsx("div", { style: { padding: 3, display: 'flex', alignItems: 'center', justifyContent: 'center', backgroundColor: 'white', color: 'gray', borderRadius: 3 }, children: result.dcmtsReturned })] })),
|
|
1332
1230
|
itemHeight: 40
|
|
1333
1231
|
})), [sortedCategories, groupedResults, searchResults]);
|
|
1334
|
-
const renderCategoryItems = (category) => (_jsx("div", { style: { padding: '5px' }, children: groupedResults[category].map((result, index) => (_jsx(MemoizedStyledItemTemplate, { "$isSelected": selectedResult === result, onClick: () => handleSelect(result), children: renderItemTemplate(result) }, index))) }));
|
|
1232
|
+
const renderCategoryItems = (category) => (_jsx("div", { style: { padding: '5px', height: '100%', overflow: 'auto' }, children: groupedResults[category].map((result, index) => (_jsx(MemoizedStyledItemTemplate, { "$isSelected": selectedResult === result, onClick: () => handleSelect(result), children: renderItemTemplate(result) }, index))) }));
|
|
1335
1233
|
if (disableAccordionIfSingleCategory && sortedCategories.length === 1) {
|
|
1336
1234
|
const category = sortedCategories[0];
|
|
1337
1235
|
return renderCategoryItems(category);
|
|
@@ -1339,11 +1237,11 @@ const TMSearchResultSelector = ({ searchResults = [], disableAccordionIfSingleCa
|
|
|
1339
1237
|
return (_jsx(TMAccordionNew, { groups: accordionGroups, selectedItem: selectedResult, onSelectedItemChange: (result) => handleSelect(result) }));
|
|
1340
1238
|
};
|
|
1341
1239
|
//#endregion TMSearchResultSelector
|
|
1342
|
-
const TMDcmtPreviewWrapper = ({ currentDcmt, isVisible }) => {
|
|
1240
|
+
const TMDcmtPreviewWrapper = ({ refreshPreviewTrigger, currentDcmt, isVisible }) => {
|
|
1343
1241
|
const { setPanelVisibilityById, toggleMaximize, isResizingActive, countVisibleLeafPanels } = useTMPanelManagerContext();
|
|
1344
1242
|
const deviceType = useDeviceType();
|
|
1345
1243
|
const isMobile = deviceType === DeviceType.MOBILE;
|
|
1346
|
-
return (_jsx(TMDcmtPreview, { onClosePanel: (!isMobile && countVisibleLeafPanels() > 1) ? () => setPanelVisibilityById('tmDcmtPreview', false) : undefined, allowMaximize: !isMobile && countVisibleLeafPanels() > 1, onMaximizePanel: (!isMobile && countVisibleLeafPanels() > 1) ? () => toggleMaximize("tmDcmtPreview") : undefined,
|
|
1244
|
+
return (_jsx(TMDcmtPreview, { dcmtData: currentDcmt, onClosePanel: (!isMobile && countVisibleLeafPanels() > 1) ? () => setPanelVisibilityById('tmDcmtPreview', false) : undefined, allowMaximize: !isMobile && countVisibleLeafPanels() > 1, onMaximizePanel: (!isMobile && countVisibleLeafPanels() > 1) ? () => toggleMaximize("tmDcmtPreview") : undefined, isResizingActive: isResizingActive, isVisible: isVisible }, refreshPreviewTrigger));
|
|
1347
1245
|
};
|
|
1348
1246
|
// Styled Components
|
|
1349
1247
|
const StyledPlaceholder = styled.div `
|
|
@@ -1386,11 +1284,6 @@ const StyledIndexingToggle = styled.button `
|
|
|
1386
1284
|
transform: translateY(1px);
|
|
1387
1285
|
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
|
|
1388
1286
|
}
|
|
1389
|
-
|
|
1390
|
-
svg {
|
|
1391
|
-
color: #2196F3;
|
|
1392
|
-
font-size: 18px;
|
|
1393
|
-
}
|
|
1394
1287
|
`;
|
|
1395
1288
|
const StyledLeftContent = styled.div `
|
|
1396
1289
|
display: flex;
|
|
@@ -1402,17 +1295,6 @@ const StyledRightContent = styled.div `
|
|
|
1402
1295
|
align-items: center;
|
|
1403
1296
|
gap: 8px;
|
|
1404
1297
|
`;
|
|
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
1298
|
const StyledChevron = styled.span `
|
|
1417
1299
|
transition: transform 0.2s ease;
|
|
1418
1300
|
transform: ${props => props.$isOpen ? 'rotate(180deg)' : 'rotate(0deg)'};
|
|
@@ -1420,6 +1302,7 @@ const StyledChevron = styled.span `
|
|
|
1420
1302
|
font-size: 12px;
|
|
1421
1303
|
`;
|
|
1422
1304
|
const StyledIndexingInfoBox = styled.div `
|
|
1305
|
+
position: relative;
|
|
1423
1306
|
background: white;
|
|
1424
1307
|
border: 1px solid #e0e0e0;
|
|
1425
1308
|
border-radius: 6px;
|