@topconsultnpm/sdkui-react 6.20.0-dev2.9 → 6.20.0-dev3.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.
Files changed (84) hide show
  1. package/lib/components/NewComponents/ContextMenu/styles.d.ts +3 -1
  2. package/lib/components/NewComponents/ContextMenu/styles.js +7 -5
  3. package/lib/components/base/Styled.d.ts +4 -1
  4. package/lib/components/base/Styled.js +11 -3
  5. package/lib/components/base/TMTreeView.d.ts +3 -1
  6. package/lib/components/base/TMTreeView.js +64 -21
  7. package/lib/components/choosers/TMDataListItemEditor.d.ts +11 -0
  8. package/lib/components/choosers/TMDataListItemEditor.js +130 -0
  9. package/lib/components/choosers/TMDataListItemFields.d.ts +11 -0
  10. package/lib/components/choosers/TMDataListItemFields.js +61 -0
  11. package/lib/components/choosers/TMDataListItemPicker.d.ts +1 -0
  12. package/lib/components/choosers/TMDataListItemPicker.js +178 -18
  13. package/lib/components/choosers/TMImageIDChooser.d.ts +16 -0
  14. package/lib/components/choosers/TMImageIDChooser.js +53 -0
  15. package/lib/components/choosers/TMMetadataChooser.js +1 -1
  16. package/lib/components/editors/TMDateBox.js +1 -1
  17. package/lib/components/editors/TMHtmlEditor.js +1 -1
  18. package/lib/components/editors/TMLocalizedTextBox.d.ts +1 -0
  19. package/lib/components/editors/TMLocalizedTextBox.js +3 -3
  20. package/lib/components/editors/TMTextBox.js +9 -10
  21. package/lib/components/features/archive/TMArchive.d.ts +2 -1
  22. package/lib/components/features/archive/TMArchive.js +31 -44
  23. package/lib/components/features/blog/TMBlogCommentForm.d.ts +3 -0
  24. package/lib/components/features/blog/TMBlogCommentForm.js +42 -36
  25. package/lib/components/features/documents/TMDcmtForm.d.ts +3 -1
  26. package/lib/components/features/documents/TMDcmtForm.js +197 -53
  27. package/lib/components/features/documents/TMDcmtTasks.d.ts +3 -1
  28. package/lib/components/features/documents/TMDcmtTasks.js +2 -2
  29. package/lib/components/features/documents/TMFileUploader.d.ts +4 -0
  30. package/lib/components/features/documents/TMFileUploader.js +17 -6
  31. package/lib/components/features/documents/TMMasterDetailDcmts.js +68 -84
  32. package/lib/components/features/documents/TMRelationViewer.d.ts +7 -1
  33. package/lib/components/features/documents/TMRelationViewer.js +395 -78
  34. package/lib/components/features/search/TMSearchResult.d.ts +2 -0
  35. package/lib/components/features/search/TMSearchResult.js +82 -79
  36. package/lib/components/features/search/TMSearchResultsMenuItems.js +2 -2
  37. package/lib/components/features/tasks/TMTaskForm.d.ts +1 -0
  38. package/lib/components/features/tasks/TMTaskForm.js +61 -193
  39. package/lib/components/features/tasks/TMTaskFormUtils.d.ts +80 -0
  40. package/lib/components/features/tasks/TMTaskFormUtils.js +559 -0
  41. package/lib/components/features/tasks/TMTasksUtils.d.ts +3 -1
  42. package/lib/components/features/tasks/TMTasksUtils.js +46 -16
  43. package/lib/components/features/tasks/TMTasksUtilsView.d.ts +0 -7
  44. package/lib/components/features/tasks/TMTasksUtilsView.js +7 -14
  45. package/lib/components/features/tasks/TMTasksView.js +5 -3
  46. package/lib/components/features/workflow/TMWorkflowPopup.d.ts +20 -3
  47. package/lib/components/features/workflow/TMWorkflowPopup.js +14 -92
  48. package/lib/components/features/workflow/diagram/ConnectionComponent.d.ts +1 -0
  49. package/lib/components/features/workflow/diagram/ConnectionComponent.js +6 -2
  50. package/lib/components/features/workflow/diagram/DiagramItemForm.js +1 -1
  51. package/lib/components/features/workflow/diagram/WFDiagram.js +75 -5
  52. package/lib/components/forms/Login/TMLoginForm.js +1 -1
  53. package/lib/components/forms/TMSaveForm.js +61 -13
  54. package/lib/components/grids/TMBlogsPost.js +8 -8
  55. package/lib/components/grids/TMBlogsPostUtils.js +2 -2
  56. package/lib/components/index.d.ts +2 -0
  57. package/lib/components/index.js +2 -0
  58. package/lib/components/pages/TMPage.js +4 -0
  59. package/lib/components/query/TMQueryEditor.d.ts +1 -0
  60. package/lib/components/query/TMQueryEditor.js +2 -2
  61. package/lib/helper/Enum_Localizator.js +5 -0
  62. package/lib/helper/GlobalStyles.js +3 -0
  63. package/lib/helper/SDKUI_Globals.d.ts +8 -0
  64. package/lib/helper/SDKUI_Globals.js +12 -0
  65. package/lib/helper/SDKUI_Localizator.d.ts +19 -3
  66. package/lib/helper/SDKUI_Localizator.js +182 -22
  67. package/lib/helper/TMIcons.d.ts +2 -1
  68. package/lib/helper/TMIcons.js +4 -1
  69. package/lib/helper/TMUtils.d.ts +5 -0
  70. package/lib/helper/TMUtils.js +10 -5
  71. package/lib/helper/helpers.d.ts +6 -2
  72. package/lib/helper/helpers.js +24 -8
  73. package/lib/helper/index.d.ts +1 -0
  74. package/lib/helper/index.js +1 -0
  75. package/lib/helper/queryHelper.js +1 -1
  76. package/lib/hooks/useBetaFeatures.d.ts +1 -0
  77. package/lib/hooks/useBetaFeatures.js +41 -0
  78. package/lib/hooks/useDcmtOperations.js +14 -2
  79. package/lib/hooks/useRelatedDocuments.js +34 -11
  80. package/lib/index.d.ts +1 -0
  81. package/lib/index.js +1 -0
  82. package/lib/services/platform_services.d.ts +1 -1
  83. package/lib/services/platform_services.js +4 -0
  84. package/package.json +2 -2
@@ -20,6 +20,7 @@ interface ITMSearchResultProps {
20
20
  isVisible?: boolean;
21
21
  openDcmtFormAsModal?: boolean;
22
22
  showSearchResultSidebar?: boolean;
23
+ showDcmtFormSidebar?: boolean;
23
24
  showSelector?: boolean;
24
25
  showToolbarHeader?: boolean;
25
26
  showBackButton?: boolean;
@@ -50,6 +51,7 @@ interface ITMSearchResultProps {
50
51
  showTodoDcmtForm?: boolean;
51
52
  showToppyDraggableHelpCenter?: boolean;
52
53
  toppyHelpCenterUsePortal?: boolean;
54
+ showNoDcmtFoundMessage?: boolean;
53
55
  onReferenceClick?: (ref: ObjectRef) => void;
54
56
  }
55
57
  declare const TMSearchResult: React.FC<ITMSearchResultProps>;
@@ -3,7 +3,7 @@ import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
3
3
  import { SDK_Globals, DataColumnTypes, MetadataDataDomains, DataListViewModes, MetadataFormats, LayoutModes, DcmtTypeListCacheService, SystemMIDsAsNumber, RetrieveFileOptions, DcmtOpers, GeneralRetrieveFormats, AccessLevelsEx, LayoutCacheService, UserListCacheService, AppModules } from '@topconsultnpm/sdk-ts';
4
4
  import styled from 'styled-components';
5
5
  import { getAllFieldSelectedDcmtsOrFocused, getCommandsMenuItems, getSelectedDcmtsOrFocused } from './TMSearchResultsMenuItems';
6
- import { genUniqueId, IconShow, IconBoard, IconDcmtTypeSys, SDKUI_Localizator, IconDelete, IconRefresh, IconMenuVertical, deepCompare, generateUniqueColumnKeys, searchResultDescriptorToSimpleArray, searchResultToMetadataValues, IconSearchCheck, TMImageLibrary, convertSearchResultDescriptorToFileItems, IconCustom, isApprovalWorkflowView, SDKUI_Globals, getMoreInfoTasksForDocument, IconInfo, IconCache, IconPlatform, getSearchToolbarVisibility } from '../../../helper';
6
+ import { genUniqueId, IconShow, IconBoard, IconDcmtTypeSys, SDKUI_Localizator, IconDelete, IconRefresh, IconMenuVertical, deepCompare, generateUniqueColumnKeys, searchResultDescriptorToSimpleArray, searchResultToMetadataValues, IconSearchCheck, TMImageLibrary, convertSearchResultDescriptorToFileItems, IconCustom, isApprovalWorkflowView, SDKUI_Globals, getMoreInfoTasksForDocument, IconPlatform, getSearchToolbarVisibility } from '../../../helper';
7
7
  import { useDcmtOperations } from '../../../hooks/useDcmtOperations';
8
8
  import { useInputAttachmentsDialog, useInputCvtFormatDialog } from '../../../hooks/useInputDialog';
9
9
  import { useRelatedDocuments } from '../../../hooks/useRelatedDocuments';
@@ -36,7 +36,6 @@ import ShowAlert from '../../base/TMAlert';
36
36
  import TMSpinner from '../../base/TMSpinner';
37
37
  import TMChooserForm from '../../forms/TMChooserForm';
38
38
  import TMModal from '../../base/TMModal';
39
- import TMTooltip from '../../base/TMTooltip';
40
39
  import TMSearch from './TMSearch';
41
40
  import TMArchive from '../archive/TMArchive';
42
41
  import TMCustomButton from '../../base/TMCustomButton';
@@ -69,7 +68,7 @@ const orderByName = (array) => {
69
68
  return 1;
70
69
  } return 0; });
71
70
  };
72
- const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, handleNavigateToWGs, handleNavigateToDossiers, context = SearchResultContext.METADATA_SEARCH, isVisible = true, allowRelations = true, openDcmtFormAsModal = false, searchResults = [], showSearchResultSidebar = true, showSelector = false, groupId, title, isClosable = false, allowFloatingBar = true, showToolbarHeader = true, showBackButton = true, selectedSearchResultTID, workingGroupContext = undefined, disableAccordionIfSingleCategory = false, floatingActionConfig, openInOffice, onRefreshAfterAddDcmtToFavs, onRefreshSearchAsync, onSelectedTIDChanged, onWFOperationCompleted, onClose, onFileOpened, onTaskCreateRequest, openWGsCopyMoveForm, editPdfForm = false, openEditPdf, openCommentFormCallback, openAddDocumentForm, openS4TViewer = false, onOpenS4TViewerRequest, passToArchiveCallback, showTodoDcmtForm = false, showToppyDraggableHelpCenter = true, toppyHelpCenterUsePortal = false, onReferenceClick, }) => {
71
+ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, handleNavigateToWGs, handleNavigateToDossiers, context = SearchResultContext.METADATA_SEARCH, isVisible = true, allowRelations = true, openDcmtFormAsModal = false, searchResults = [], showSearchResultSidebar = true, showDcmtFormSidebar = true, showSelector = false, groupId, title, isClosable = false, allowFloatingBar = true, showToolbarHeader = true, showBackButton = true, selectedSearchResultTID, workingGroupContext = undefined, disableAccordionIfSingleCategory = false, floatingActionConfig, openInOffice, onRefreshAfterAddDcmtToFavs, onRefreshSearchAsync, onSelectedTIDChanged, onWFOperationCompleted, onClose, onFileOpened, onTaskCreateRequest, openWGsCopyMoveForm, editPdfForm = false, openEditPdf, openCommentFormCallback, openAddDocumentForm, openS4TViewer = false, onOpenS4TViewerRequest, passToArchiveCallback, showTodoDcmtForm = false, showToppyDraggableHelpCenter = true, toppyHelpCenterUsePortal = false, showNoDcmtFoundMessage = true, onReferenceClick, }) => {
73
72
  const [id, setID] = useState('');
74
73
  const [showApprovePopup, setShowApprovePopup] = useState(false);
75
74
  const [showRejectPopup, setShowRejectPopup] = useState(false);
@@ -98,10 +97,9 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
98
97
  // State to control whether the export form (for exporting to Excel/CSV/txt and others) should be shown
99
98
  const [showExportForm, setShowExportForm] = useState(false);
100
99
  const [showSignSettingsForm, setShowSignSettingsForm] = useState(false);
101
- const [indexingInfoCache, setIndexingInfoCache] = useState(new Map());
102
100
  const [showIndexingInfo, setShowIndexingInfo] = useState(false);
103
101
  const [loadingIndexingInfo, setLoadingIndexingInfo] = useState(false);
104
- const [openedDrawerItems, setOpenedDrawerItems] = useState(new Set());
102
+ const [indexingInfo, setIndexingInfo] = useState('');
105
103
  const floatingBarContainerRef = useRef(null);
106
104
  const [confirmFormat, ConfirmFormatDialog] = useInputCvtFormatDialog();
107
105
  const { openConfirmAttachmentsDialog, ConfirmAttachmentsDialog } = useInputAttachmentsDialog();
@@ -148,7 +146,18 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
148
146
  setSelectedSearchResult(searchResults[0]);
149
147
  return;
150
148
  }
151
- // Seleziona sempre il primo risultato ordinato, sia su mobile che desktop
149
+ // Se il TID precedentemente selezionato esiste ancora nei nuovi risultati, mantienilo.
150
+ // Questo evita l'errore E1047 in modalità multi-TID: cambiando TID cambiano le colonne
151
+ // e il filtro applicato potrebbe riferire campi non più presenti.
152
+ const prevTID = selectedSearchResult?.fromTID;
153
+ if (prevTID !== undefined) {
154
+ const found = searchResults.find(r => r.fromTID === prevTID);
155
+ if (found) {
156
+ setSelectedSearchResult(found);
157
+ return;
158
+ }
159
+ }
160
+ // Altrimenti seleziona il primo risultato ordinato
152
161
  setSelectedSearchResult(orderByName(searchResults)[0]);
153
162
  }, [searchResults]);
154
163
  useEffect(() => {
@@ -613,19 +622,19 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
613
622
  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 &&
614
623
  _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: onRefreshSearchAsync }), _jsx(TMContextMenu, { items: floatingMenuItems, trigger: "left", children: _jsx(IconMenuVertical, { color: 'white', cursor: 'pointer' }) })] });
615
624
  const tmSearchResult = useMemo(() => (!searchResults || searchResults.length <= 0)
616
- ? _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 }) })] })
625
+ ? _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 }) })] })
617
626
  :
618
627
  _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 ?
619
628
  _jsx(TMLayoutItem, { children: _jsx(TMSearchResultSelector, { searchResults: currentSearchResults, disableAccordionIfSingleCategory: disableAccordionIfSingleCategory, selectedTID: selectedSearchResultTID, selectedSearchResult: selectedSearchResult, autoSelectFirst: !isMobile || currentSearchResults.length === 1, onSelectionChanged: onSearchResultSelectionChanged }) })
620
629
  :
621
630
  _jsx(_Fragment, {}), _jsx(TMLayoutItem, { children: _jsx(TMSearchResultGrid, { showSearch: showSearch, fromDTD: fromDTD, allUsers: allUsers, inputFocusedItem: focusedItem, inputSelectedItems: selectedItems, searchResult: searchResults.length > 1 ? selectedSearchResult : searchResults[0], lastUpdateSearchTime: lastUpdateSearchTime, openInOffice: openInOffice, onDblClick: () => openFormHandler(LayoutModes.Update), floatingMenuItems: floatingMenuItems, onSelectionChanged: (items) => { setSelectedItems(items); }, onVisibleItemChanged: setVisibleItems, onFocusedItemChanged: setFocusedItem, onDownloadDcmtsAsync: async (inputDcmts, downloadType, downloadMode, _y, confirmAttachments) => await downloadDcmtsAsync(inputDcmts, downloadType, downloadMode, onFileOpened, confirmAttachments), showExportForm: showExportForm, onCloseExportForm: onCloseExportForm }) })] }), allowFloatingBar && showFloatingBar && deviceType !== DeviceType.MOBILE &&
622
- _jsx(TMFloatingMenuBar, { containerRef: floatingBarContainerRef, contextMenuItems: floatingMenuItems, isConstrained: true, defaultPosition: { x: 1, y: 88 }, defaultPinnedItems: ['rel-det', 'rel-mst', 'dl'], defaultOrientation: 'horizontal', hasContextMenu: false, pinnedItemIds: pinnedItemIds, onPinChange: setPinnedItemIds })] }), showApprovePopup && _jsx(WorkFlowApproveRejectPopUp, { deviceType: deviceType, onCompleted: onWFOperationCompleted, selectedItems: getSelectedDcmtsOrFocused(selectedItems, focusedItem), isReject: 0, onClose: () => setShowApprovePopup(false) }), showRejectPopup && _jsx(WorkFlowApproveRejectPopUp, { deviceType: deviceType, onCompleted: onWFOperationCompleted, selectedItems: getSelectedDcmtsOrFocused(selectedItems, focusedItem), isReject: 1, onClose: () => setShowRejectPopup(false) }), showReAssignPopup && _jsx(WorkFlowReAssignPopUp, { deviceType: deviceType, onCompleted: onWFOperationCompleted, selectedItems: getSelectedDcmtsOrFocused(selectedItems, focusedItem), onClose: () => setShowReAssignPopup(false) }), showMoreInfoPopup && _jsx(WorkFlowMoreInfoPopUp, { TID: focusedItem?.TID, DID: focusedItem?.DID, deviceType: deviceType, onCompleted: onWFOperationCompleted, onClose: () => setShowMoreInfoPopup(false) }), isOpenBatchUpdate && _jsx(TMBatchUpdateForm, { isModal: true, titleModal: `${SDKUI_Localizator.BatchUpdate} (${getSelectionDcmtInfo().length} documenti selezionati)`, inputDcmts: getSelectionDcmtInfo(), TID: focusedItem ? focusedItem?.TID : selectedItems[0]?.TID, DID: focusedItem ? focusedItem?.DID : selectedItems[0]?.DID, onBack: () => {
631
+ _jsx(TMFloatingMenuBar, { containerRef: floatingBarContainerRef, contextMenuItems: floatingMenuItems, isConstrained: true, defaultPosition: { x: 1, y: 88 }, defaultPinnedItems: ['rel-det', 'rel-mst', 'dl'], defaultOrientation: 'horizontal', hasContextMenu: false, pinnedItemIds: pinnedItemIds, onPinChange: setPinnedItemIds })] }), showApprovePopup && _jsx(WorkFlowApproveRejectPopUp, { deviceType: deviceType, onCompleted: onWFOperationCompleted, selectedItems: getSelectedDcmtsOrFocused(selectedItems, focusedItem), isReject: 0, onClose: () => setShowApprovePopup(false) }), showRejectPopup && _jsx(WorkFlowApproveRejectPopUp, { deviceType: deviceType, onCompleted: onWFOperationCompleted, selectedItems: getSelectedDcmtsOrFocused(selectedItems, focusedItem), isReject: 1, onClose: () => setShowRejectPopup(false) }), showReAssignPopup && _jsx(WorkFlowReAssignPopUp, { deviceType: deviceType, onCompleted: onWFOperationCompleted, selectedItems: getSelectedDcmtsOrFocused(selectedItems, focusedItem), onClose: () => setShowReAssignPopup(false) }), showMoreInfoPopup && _jsx(WorkFlowMoreInfoPopUp, { fromDTD: fromDTD, TID: focusedItem?.TID, DID: focusedItem?.DID, deviceType: deviceType, onCompleted: onWFOperationCompleted, onClose: () => setShowMoreInfoPopup(false), getAllTasks: getAllTasks, triggerBlogRefresh: triggerBlogRefresh }), isOpenBatchUpdate && _jsx(TMBatchUpdateForm, { isModal: true, titleModal: `${SDKUI_Localizator.BatchUpdate} (${getSelectionDcmtInfo().length} documenti selezionati)`, inputDcmts: getSelectionDcmtInfo(), TID: focusedItem ? focusedItem?.TID : selectedItems[0]?.TID, DID: focusedItem ? focusedItem?.DID : selectedItems[0]?.DID, onBack: () => {
623
632
  setIsOpenBatchUpdate(false);
624
633
  }, onSavedCallbackAsync: async () => {
625
634
  setIsOpenBatchUpdate(false);
626
635
  setIsModifiedBatchUpdate(false);
627
636
  await refreshSelectionDataRowsAsync();
628
- }, 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: () => {
637
+ }, onStatusChanged: (isModified) => { setIsModifiedBatchUpdate(isModified); } }), _jsx(TMToppyDraggableHelpCenter, { usePortal: toppyHelpCenterUsePortal, isVisible: isToppyHelpCenterVisible, content: _jsx("div", { style: { display: 'flex', flexDirection: 'column', gap: '10px' }, children: _jsx(WorkFlowOperationButtons, { dtd: fromDTD, deviceType: deviceType, onApprove: () => {
629
638
  setShowApprovePopup(true);
630
639
  }, onSignApprove: () => {
631
640
  handleSignApprove();
@@ -635,7 +644,7 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
635
644
  setShowReAssignPopup(true);
636
645
  }, onMoreInfo: () => {
637
646
  setShowMoreInfoPopup(true);
638
- }, approveDisable: selectedDocs.length === 0, signApproveDisable: disableSignApproveDisable, rejectDisable: selectedDocs.length === 0, reassignDisable: selectedDocs.length === 0, infoDisable: selectedDocs.length !== 1, dtd: fromDTD }) }) })] }), _jsx(ConfirmFormatDialog, {}), _jsx(ConfirmAttachmentsDialog, {}), customButton && _jsx(TMCustomButton, { button: customButton, formData: currentMetadataValues, selectedItems: selectedItems, onClose: () => setCustomButton(undefined) }), showRelatedDcmtsChooser &&
647
+ }, approveDisable: selectedDocs.length === 0, signApproveDisable: disableSignApproveDisable, rejectDisable: selectedDocs.length === 0, reassignDisable: selectedDocs.length === 0, infoDisable: selectedDocs.length !== 1 }) }) })] }), _jsx(ConfirmFormatDialog, {}), _jsx(ConfirmAttachmentsDialog, {}), customButton && _jsx(TMCustomButton, { button: customButton, formData: currentMetadataValues, selectedItems: selectedItems, onClose: () => setCustomButton(undefined) }), showRelatedDcmtsChooser &&
639
648
  _jsx(TMChooserForm, { dataSource: relatedDcmtsChooserDataSource, onChoose: async (selectedRelation) => {
640
649
  try {
641
650
  setShowRelatedDcmtsChooser(false);
@@ -732,37 +741,41 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
732
741
  onRefreshSearchAsync,
733
742
  handleNavigateToWGs,
734
743
  handleNavigateToDossiers,
735
- editPdfForm
744
+ editPdfForm,
745
+ showNoDcmtFoundMessage
736
746
  ]);
737
747
  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]);
738
748
  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]);
739
749
  const tmDcmtPreview = useMemo(() => _jsx(TMDcmtPreviewWrapper, { currentDcmt: currentDcmt }, refreshPreviewTrigger), [currentDcmt, refreshPreviewTrigger]);
750
+ // Auto-fetch indexing info when drawer is open and focusedItem changes
740
751
  useEffect(() => {
741
- if (!focusedItem)
752
+ if (!focusedItem || !showIndexingInfo)
742
753
  return;
743
- const cacheKey = `${focusedItem.TID}-${focusedItem.DID}`;
744
- setShowIndexingInfo(openedDrawerItems.has(cacheKey));
745
- }, [focusedItem, openedDrawerItems]);
754
+ const fetchData = async () => {
755
+ try {
756
+ setLoadingIndexingInfo(true);
757
+ const msg = await SDK_Globals.tmSession?.NewSearchEngine().FreeSearchGetDcmtInfoAsync(focusedItem.TID, focusedItem.DID);
758
+ setIndexingInfo(msg ?? '');
759
+ }
760
+ catch (e) {
761
+ TMExceptionBoxManager.show({ exception: e });
762
+ }
763
+ finally {
764
+ setLoadingIndexingInfo(false);
765
+ }
766
+ };
767
+ fetchData();
768
+ }, [focusedItem, showIndexingInfo]);
746
769
  const handleToggleIndexingInfo = async () => {
747
770
  if (!focusedItem)
748
771
  return;
749
- const cacheKey = `${focusedItem.TID}-${focusedItem.DID}`;
750
- if (showIndexingInfo) {
751
- setOpenedDrawerItems(prev => {
752
- const newSet = new Set(prev);
753
- newSet.delete(cacheKey);
754
- return newSet;
755
- });
756
- setShowIndexingInfo(false);
757
- return;
758
- }
759
- setOpenedDrawerItems(prev => new Set(prev).add(cacheKey));
760
- setShowIndexingInfo(true);
761
- if (!indexingInfoCache.has(cacheKey)) {
772
+ const newShowState = !showIndexingInfo;
773
+ setShowIndexingInfo(newShowState);
774
+ if (newShowState) {
762
775
  try {
763
776
  setLoadingIndexingInfo(true);
764
777
  const msg = await SDK_Globals.tmSession?.NewSearchEngine().FreeSearchGetDcmtInfoAsync(focusedItem.TID, focusedItem.DID);
765
- setIndexingInfoCache(prev => new Map(prev).set(cacheKey, msg ?? ''));
778
+ setIndexingInfo(msg ?? '');
766
779
  }
767
780
  catch (e) {
768
781
  TMExceptionBoxManager.show({ exception: e });
@@ -772,22 +785,6 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
772
785
  }
773
786
  }
774
787
  };
775
- const handleRefreshIndexingInfo = async () => {
776
- if (!focusedItem)
777
- return;
778
- const cacheKey = `${focusedItem.TID}-${focusedItem.DID}`;
779
- try {
780
- setLoadingIndexingInfo(true);
781
- const msg = await SDK_Globals.tmSession?.NewSearchEngine().FreeSearchGetDcmtInfoAsync(focusedItem.TID, focusedItem.DID);
782
- setIndexingInfoCache(prev => new Map(prev).set(cacheKey, msg ?? ''));
783
- }
784
- catch (e) {
785
- TMExceptionBoxManager.show({ exception: e });
786
- }
787
- finally {
788
- setLoadingIndexingInfo(false);
789
- }
790
- };
791
788
  const tmFullTextSearch = useMemo(() => {
792
789
  if (!focusedItem) {
793
790
  return (_jsxs(StyledPlaceholder, { children: [" ", _jsx("p", { children: "Seleziona un documento per visualizzare i dettagli della ricerca full-text" }), " "] }));
@@ -804,23 +801,21 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
804
801
  if (!ftExplanation) {
805
802
  return (_jsxs(StyledPlaceholder, { children: [" ", _jsx("p", { children: "Nessuna info disponibile per questo documento" }), " "] }));
806
803
  }
807
- const cacheKey = `${focusedItem.TID}-${focusedItem.DID}`;
808
- const cachedInfo = indexingInfoCache.get(cacheKey);
809
- return (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', height: '100%', overflow: 'hidden', width: '100%' }, children: [_jsx("div", { style: { padding: '10px', overflow: 'auto', flex: 1 }, children: _jsx("div", { dangerouslySetInnerHTML: { __html: ftExplanation } }) }), _jsxs(StyledIndexingInfoSection, { children: [_jsxs(StyledIndexingToggle, { onClick: handleToggleIndexingInfo, disabled: loadingIndexingInfo, children: [_jsxs(StyledLeftContent, { children: [_jsx(IconInfo, {}), _jsx("span", { children: showIndexingInfo ? 'Nascondi' : SDKUI_Localizator.IndexingInformation })] }), _jsxs(StyledRightContent, { children: [cachedInfo && (_jsxs(_Fragment, { children: [_jsx(TMTooltip, { content: "Aggiorna", children: _jsx(StyledRefreshIcon, { onClick: (e) => { e.stopPropagation(); handleRefreshIndexingInfo(); }, children: _jsx(IconRefresh, {}) }) }), _jsx(TMTooltip, { content: "Da cache", children: _jsx(StyledCachedIcon, { children: _jsx(IconCache, {}) }) })] })), _jsx(StyledChevron, { "$isOpen": showIndexingInfo, children: "\u25BC" })] })] }), loadingIndexingInfo && !cachedInfo && (_jsxs("div", { style: { marginTop: '10px', color: '#666' }, children: [SDKUI_Localizator.Loading, "..."] })), showIndexingInfo && cachedInfo && (_jsxs(StyledIndexingInfoBox, { children: [_jsx("div", { dangerouslySetInnerHTML: { __html: cachedInfo } }), loadingIndexingInfo && (_jsxs("div", { style: { position: 'absolute', top: '50%', left: '50%', transform: 'translate(-50%, -50%)', background: 'rgba(255, 255, 255, 0.9)', padding: '10px', borderRadius: '4px', boxShadow: '0 2px 8px rgba(0,0,0,0.15)' }, children: [SDKUI_Localizator.Loading, "..."] }))] }))] })] }));
810
- }, [selectedSearchResult, focusedItem, indexingInfoCache, showIndexingInfo, loadingIndexingInfo]);
804
+ 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, "..."] }))] }))] })] }));
805
+ }, [selectedSearchResult, focusedItem, indexingInfo, showIndexingInfo, loadingIndexingInfo]);
811
806
  const allInitialPanelVisibility = {
812
807
  'tmSearchResult': true,
813
808
  'tmBlog': false,
814
809
  'tmSysMetadata': false,
815
- 'tmDcmtPreview': false,
816
810
  'tmFullTextSearch': false,
811
+ 'tmDcmtPreview': false,
817
812
  };
818
813
  const initialPanelDimensions = {
819
814
  'tmSearchResult': { width: '25%', height: '100%' },
820
815
  'tmBlog': { width: '25%', height: '100%' },
821
816
  'tmSysMetadata': { width: '25%', height: '100%' },
822
- 'tmDcmtPreview': { width: '25%', height: '100%' },
823
817
  'tmFullTextSearch': { width: '25%', height: '100%' },
818
+ 'tmDcmtPreview': { width: '25%', height: '100%' },
824
819
  };
825
820
  const initialPanels = useMemo(() => [
826
821
  {
@@ -853,20 +848,20 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
853
848
  contentOptions: { component: tmSysMetadata, panelContainer: { title: SDKUI_Localizator.MetadataSystem, allowMaximize: !isMobile } },
854
849
  toolbarOptions: { icon: _jsx(IconDcmtTypeSys, { fontSize: 24 }), visible: getSearchToolbarVisibility(SDK_Globals.tmSession?.SessionDescr?.appModuleID ?? AppModules.SURFER).tmSysMetadata, orderNumber: 3, isActive: allInitialPanelVisibility['tmSysMetadata'] }
855
850
  },
856
- {
857
- id: 'tmDcmtPreview',
858
- name: SDKUI_Localizator.PreviewDocument,
859
- contentOptions: { component: tmDcmtPreview },
860
- toolbarOptions: { icon: _jsx(IconShow, { fontSize: 24 }), visible: getSearchToolbarVisibility(SDK_Globals.tmSession?.SessionDescr?.appModuleID ?? AppModules.SURFER).tmDcmtPreview, orderNumber: 4, isActive: allInitialPanelVisibility['tmDcmtPreview'] }
861
- },
862
851
  ...(context === SearchResultContext.FREE_SEARCH ? [
863
852
  {
864
853
  id: 'tmFullTextSearch',
865
854
  name: SDKUI_Localizator.ResultDetails,
866
855
  contentOptions: { component: tmFullTextSearch, panelContainer: { title: SDKUI_Localizator.ResultDetails, allowMaximize: !isMobile } },
867
- toolbarOptions: { icon: _jsx(IconPlatform, { fontSize: 20 }), visible: getSearchToolbarVisibility(SDK_Globals.tmSession?.SessionDescr?.appModuleID ?? AppModules.SURFER).tmFullTextSearch, orderNumber: 5, isActive: allInitialPanelVisibility['tmFullTextSearch'] }
856
+ toolbarOptions: { icon: _jsx(IconPlatform, { fontSize: 20 }), visible: getSearchToolbarVisibility(SDK_Globals.tmSession?.SessionDescr?.appModuleID ?? AppModules.SURFER).tmFullTextSearch, orderNumber: 4, isActive: allInitialPanelVisibility['tmFullTextSearch'] }
868
857
  }
869
- ] : [])
858
+ ] : []),
859
+ {
860
+ id: 'tmDcmtPreview',
861
+ name: SDKUI_Localizator.PreviewDocument,
862
+ contentOptions: { component: tmDcmtPreview },
863
+ 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'] }
864
+ }
870
865
  ], [tmSearchResult, tmBlog, tmSysMetadata, tmDcmtPreview, tmFullTextSearch, showToolbarHeader, context, isMobile]);
871
866
  return (_jsxs(StyledMultiViewPanel, { "$isVisible": isVisible, children: [_jsx(StyledMultiViewPanel, { "$isVisible": !isOpenDcmtForm && !isOpenDetails && !isOpenMaster, style: {
872
867
  display: 'flex',
@@ -880,7 +875,7 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
880
875
  :
881
876
  _jsx(TMPanelManagerProvider, { panels: initialPanels, initialVisibility: allInitialPanelVisibility, defaultDimensions: initialPanelDimensions, initialDimensions: initialPanelDimensions, initialMobilePanelId: 'tmSearchResult', children: _jsx(TMPanelManagerContainer, { panels: initialPanels, direction: "horizontal", parentId: groupId, showToolbar: showSearchResultSidebar }) }) }) }) }), _jsx(StyledMultiViewPanel, { "$isVisible": isOpenDetails, children: isOpenDetails && _jsx(TMMasterDetailDcmts, { deviceType: deviceType, isForMaster: false, inputDcmts: getSelectionDcmtInfo(), allowNavigation: focusedItem && selectedItems.length <= 0, canNext: canNavigateHandler('next'), canPrev: canNavigateHandler('prev'), onNext: () => onNavigateHandler('next'), onPrev: () => onNavigateHandler('prev'), onBack: () => setIsOpenDetails(false), allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }) }), _jsxs(StyledMultiViewPanel, { "$isVisible": isOpenMaster, children: [isOpenMaster && _jsx(TMMasterDetailDcmts, { deviceType: deviceType, inputDcmts: getSelectionDcmtInfo(), isForMaster: true, allowNavigation: focusedItem && selectedItems.length <= 0, canNext: canNavigateHandler('next'), canPrev: canNavigateHandler('prev'), onNext: () => onNavigateHandler('next'), onPrev: () => onNavigateHandler('prev'), onBack: () => setIsOpenMaster(false), appendMasterDcmts: handleAddItem, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }), secondaryMasterDcmts.length > 0 && secondaryMasterDcmts.map((dcmt, index) => {
882
877
  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}`));
883
- })] }), _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: () => {
878
+ })] }), _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: showDcmtFormSidebar }) }), 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: () => {
884
879
  setIsOpenArchiveRelationForm(false);
885
880
  setArchiveType(undefined);
886
881
  setArchiveRelatedDcmtFormTID(undefined);
@@ -891,7 +886,7 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
891
886
  setArchiveRelatedDcmtFormTID(undefined);
892
887
  setArchiveRelatedDcmtFormMids([]);
893
888
  await onRefreshSearchAsync?.();
894
- }, 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)] })] }));
889
+ }, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, showDcmtFormSidebar: showDcmtFormSidebar }), (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)] })] }));
895
890
  };
896
891
  export default TMSearchResult;
897
892
  const TMSearchResultGrid = ({ openInOffice, fromDTD, allUsers, inputFocusedItem, showSearch, allowMultipleSelection = true, showExportForm = false, onCloseExportForm, onFocusedItemChanged, onDownloadDcmtsAsync, onVisibleItemChanged, inputSelectedItems = [], lastUpdateSearchTime, searchResult, floatingMenuItems, onSelectionChanged, onDblClick }) => {
@@ -903,6 +898,7 @@ const TMSearchResultGrid = ({ openInOffice, fromDTD, allUsers, inputFocusedItem,
903
898
  const [visibleItems, setVisibleItems] = useState([]);
904
899
  const [pageSize, setPageSize] = useState(SDKUI_Globals.userSettings.searchSettings?.pageSize ?? TMDataGridPageSize.Large);
905
900
  const [isDataGridReady, setIsDataGridReady] = useState(false);
901
+ const dataGridRef = useRef(null);
906
902
  const { loadDataListsAsync, renderDataListCell, dataListsCache } = useDataListItem();
907
903
  const { loadUsersAsync, renderUserIdViewer, usersCache } = useDataUserIdItem();
908
904
  useEffect(() => {
@@ -1173,6 +1169,19 @@ const TMSearchResultGrid = ({ openInOffice, fromDTD, allUsers, inputFocusedItem,
1173
1169
  ]);
1174
1170
  // Genera colonne con cache popolate per garantire headerFilter completi
1175
1171
  const cols = generateColumns();
1172
+ // Cancella i filtri SOLO se le colonne sono cambiate (es. cambio TID).
1173
+ // Se le colonne restano le stesse (es. refresh sullo stesso TID), il filtro resta valido.
1174
+ // Previene l'errore E1047 quando il filtro riferisce campi non più presenti nelle nuove colonne.
1175
+ const oldFields = columns.map(c => c.dataField);
1176
+ const newFields = cols.map(c => c.dataField);
1177
+ const columnsChanged = oldFields.length !== newFields.length ||
1178
+ oldFields.some((f, i) => f !== newFields[i]);
1179
+ if (columnsChanged) {
1180
+ const gridInstance = dataGridRef.current?.instance();
1181
+ if (gridInstance) {
1182
+ gridInstance.clearFilter();
1183
+ }
1184
+ }
1176
1185
  setColumns(cols);
1177
1186
  // Converte i risultati di ricerca in un array semplice per la griglia
1178
1187
  let newDataSource = searchResultDescriptorToSimpleArray(searchResult);
@@ -1252,7 +1261,7 @@ const TMSearchResultGrid = ({ openInOffice, fromDTD, allUsers, inputFocusedItem,
1252
1261
  setVisibleItems(visibleRows.map((row) => { return row.data; }));
1253
1262
  }, []);
1254
1263
  useEffect(() => { onVisibleItemChanged?.(visibleItems); }, [visibleItems]);
1255
- 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: showSearch, 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: floatingMenuItems, counterConfig: { show: true } }), (showExportForm && searchResult && onCloseExportForm) && _jsx(TMDataGridExportForm, { dataColumns: dataColumns, dataSource: dataSource, selectedRowKeys: selectedRowKeys, onCloseExportForm: onCloseExportForm, searchResult: searchResult })] });
1264
+ 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: showSearch, 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: floatingMenuItems, counterConfig: { show: true } }), (showExportForm && searchResult && onCloseExportForm) && _jsx(TMDataGridExportForm, { dataColumns: dataColumns, dataSource: dataSource, selectedRowKeys: selectedRowKeys, onCloseExportForm: onCloseExportForm, searchResult: searchResult })] });
1256
1265
  };
1257
1266
  //#region TMSearchResultSelector
1258
1267
  const StyledItemTemplate = styled.div `
@@ -1284,13 +1293,21 @@ const TMSearchResultSelector = ({ searchResults = [], disableAccordionIfSingleCa
1284
1293
  sortedCategories.forEach((category) => {
1285
1294
  groupedResults[category].sort((a, b) => (a.fromName ?? '').localeCompare(b.fromName ?? ''));
1286
1295
  });
1287
- // Reset internal selection when parent sets selectedSearchResult to undefined
1288
- // (this happens on mobile when clicking back to return to the list)
1296
+ // Sincronizza la selezione interna con quella del parent.
1297
+ // Quando selectedSearchResult è undefined (es. mobile back) resetta.
1298
+ // Quando selectedSearchResult cambia (es. refresh dopo WF operation), cerca il corrispondente
1299
+ // nel nuovo searchResults per aggiornare il reference e mantenere lo stile di selezione.
1289
1300
  useEffect(() => {
1290
1301
  if (selectedSearchResult === undefined) {
1291
1302
  setSelectedResult(undefined);
1292
1303
  }
1293
- }, [selectedSearchResult]);
1304
+ else {
1305
+ const found = searchResults.find(r => r.fromTID === selectedSearchResult.fromTID);
1306
+ if (found) {
1307
+ setSelectedResult(found);
1308
+ }
1309
+ }
1310
+ }, [selectedSearchResult, searchResults]);
1294
1311
  // Auto-seleziona il primo risultato di ricerca solo se autoSelectFirst è true.
1295
1312
  // Su mobile con più risultati, autoSelectFirst è false per permettere all'utente
1296
1313
  // di vedere prima la lista dei tipi documento e scegliere manualmente.
@@ -1423,20 +1440,6 @@ const StyledRightContent = styled.div `
1423
1440
  align-items: center;
1424
1441
  gap: 8px;
1425
1442
  `;
1426
- const StyledCachedIcon = styled.div `
1427
- display: flex;
1428
- align-items: center;
1429
- justify-content: center;
1430
- font-size: 16px;
1431
- `;
1432
- const StyledRefreshIcon = styled.div `
1433
- display: flex;
1434
- align-items: center;
1435
- justify-content: center;
1436
- font-size: 16px;
1437
- cursor: pointer;
1438
- transition: transform 0.2s ease;
1439
- `;
1440
1443
  const StyledChevron = styled.span `
1441
1444
  transition: transform 0.2s ease;
1442
1445
  transform: ${props => props.$isOpen ? 'rotate(180deg)' : 'rotate(0deg)'};
@@ -254,10 +254,10 @@ export const getCommandsMenuItems = (isMobile, dtd, allUsers, selectedItems, foc
254
254
  const passToArchive = () => {
255
255
  return {
256
256
  id: 'p2a',
257
- icon: _jsx(IconMenuCAArchive, { fontSize: 16, viewBox: '11 11.5 26 27', strokeWidth: 2, color: 'black' }),
257
+ icon: _jsx(IconMenuCAArchive, { fontSize: 16, viewBox: '11 11.5 26 27', strokeWidth: 2 }),
258
258
  name: SDKUI_Localizator.PassToArchive,
259
259
  operationType: 'singleRow',
260
- disabled: disabledForSingleRow(selectedItems, focusedItem),
260
+ disabled: dtd?.perm?.canArchive !== AccessLevelsEx.Yes && dtd?.perm?.canArchive !== AccessLevelsEx.Mixed ? true : disabledForSingleRow(selectedItems, focusedItem),
261
261
  onClick: async () => {
262
262
  try {
263
263
  const item = selectedItems.length === 1 ? selectedItems[0] : focusedItem;
@@ -13,6 +13,7 @@ export interface TMTaskFormProps {
13
13
  title: string;
14
14
  isModal: boolean;
15
15
  formMode: FormModes;
16
+ requestMoreInfo?: boolean;
16
17
  visualizedTasks: Array<TaskDescriptor>;
17
18
  currentTask: TaskDescriptor | null;
18
19
  setCurrentTask?: React.Dispatch<React.SetStateAction<TaskDescriptor | null>>;