@topconsultnpm/sdkui-react 6.21.0-dev1.5 → 6.21.0-dev1.51

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 (75) hide show
  1. package/lib/components/NewComponents/ContextMenu/TMContextMenu.js +2 -2
  2. package/lib/components/NewComponents/ContextMenu/styles.d.ts +43 -19
  3. package/lib/components/NewComponents/FloatingMenuBar/TMFloatingMenuBar.js +1 -1
  4. package/lib/components/NewComponents/FloatingMenuBar/styles.d.ts +79 -27
  5. package/lib/components/base/Styled.d.ts +76 -40
  6. package/lib/components/base/TMAreaManager.js +28 -11
  7. package/lib/components/base/TMFileManagerDataGridView.js +2 -2
  8. package/lib/components/base/TMFileManagerUtils.d.ts +6 -2
  9. package/lib/components/base/TMPanel.js +1 -0
  10. package/lib/components/base/TMTreeView.d.ts +5 -3
  11. package/lib/components/choosers/TMDataListItemChooser.js +25 -2
  12. package/lib/components/choosers/TMDynDataListItemChooser.d.ts +1 -1
  13. package/lib/components/choosers/TMDynDataListItemChooser.js +50 -23
  14. package/lib/components/choosers/TMUserChooser.js +3 -1
  15. package/lib/components/editors/TMDropDown.js +2 -2
  16. package/lib/components/editors/TMEditorStyled.d.ts +42 -10
  17. package/lib/components/editors/TMFormulaEditor.js +15 -3
  18. package/lib/components/editors/TMMetadataEditor.js +4 -3
  19. package/lib/components/editors/TMMetadataValues.js +1 -1
  20. package/lib/components/features/archive/TMArchive.js +1 -1
  21. package/lib/components/features/documents/TMDcmtBlog.d.ts +1 -0
  22. package/lib/components/features/documents/TMDcmtBlog.js +2 -2
  23. package/lib/components/features/documents/TMDcmtForm.js +11 -7
  24. package/lib/components/features/documents/TMDcmtPreview.d.ts +5 -3
  25. package/lib/components/features/documents/TMDragDropOverlay.js +7 -2
  26. package/lib/components/features/documents/TMFileUploader.js +5 -4
  27. package/lib/components/features/documents/TMMasterDetailDcmts.js +74 -21
  28. package/lib/components/features/documents/TMRelationViewer.d.ts +6 -1
  29. package/lib/components/features/documents/TMRelationViewer.js +44 -7
  30. package/lib/components/features/search/TMSavedQuerySelector.js +1 -1
  31. package/lib/components/features/search/TMSearch.js +2 -0
  32. package/lib/components/features/search/TMSearchQueryEditor.js +13 -1
  33. package/lib/components/features/search/TMSearchQueryPanel.d.ts +3 -3
  34. package/lib/components/features/search/TMSearchResult.js +16 -3
  35. package/lib/components/features/search/TMViewHistoryDcmt.js +6 -0
  36. package/lib/components/features/workflow/diagram/DiagramItemForm.js +5 -1
  37. package/lib/components/features/workflow/diagram/WFDiagram.js +7 -1
  38. package/lib/components/features/workflow/diagram/WorkitemRecipientsEditor.d.ts +1 -1
  39. package/lib/components/features/workflow/diagram/xmlParser.js +13 -14
  40. package/lib/components/forms/Login/ChangePasswordInputs.d.ts +1 -1
  41. package/lib/components/forms/Login/TMLoginForm.js +15 -5
  42. package/lib/components/forms/TMChooserForm.js +25 -2
  43. package/lib/components/grids/TMBlogsPost.js +1 -1
  44. package/lib/components/index.d.ts +1 -0
  45. package/lib/components/index.js +1 -0
  46. package/lib/components/layout/panelManager/TMPanelManagerToolbar.d.ts +5 -2
  47. package/lib/components/pages/TMPage.js +4 -2
  48. package/lib/components/query/TMQueryCountButton.d.ts +11 -0
  49. package/lib/components/query/TMQueryCountButton.js +32 -0
  50. package/lib/components/query/TMQueryEditor.d.ts +10 -6
  51. package/lib/components/query/TMQueryEditor.js +41 -4
  52. package/lib/components/query/TMQuerySummary.js +3 -2
  53. package/lib/components/sidebar/TMCommandsPanel.d.ts +4 -2
  54. package/lib/components/viewers/TMDataListItemViewer.d.ts +2 -1
  55. package/lib/components/viewers/TMDataListItemViewer.js +2 -2
  56. package/lib/helper/SDKUI_Globals.d.ts +2 -0
  57. package/lib/helper/SDKUI_Localizator.d.ts +1 -0
  58. package/lib/helper/SDKUI_Localizator.js +10 -0
  59. package/lib/helper/TMPdfViewer.js +143 -86
  60. package/lib/helper/TMUtils.d.ts +4 -3
  61. package/lib/helper/TMUtils.js +12 -0
  62. package/lib/helper/checkinCheckoutManager.d.ts +7 -2
  63. package/lib/helper/checkinCheckoutManager.js +220 -11
  64. package/lib/hooks/useCheckInOutOperations.d.ts +1 -1
  65. package/lib/hooks/useCheckInOutOperations.js +9 -4
  66. package/lib/hooks/useDcmtOperations.d.ts +1 -0
  67. package/lib/hooks/useDcmtOperations.js +74 -4
  68. package/lib/hooks/useDocumentOperations.js +20 -6
  69. package/lib/hooks/useForm.js +20 -14
  70. package/lib/hooks/useInputDialog.d.ts +2 -0
  71. package/lib/hooks/useInputDialog.js +37 -0
  72. package/lib/hooks/useQueryParametersDialog.js +5 -5
  73. package/lib/services/platform_services.d.ts +1 -1
  74. package/lib/services/platform_services.js +8 -0
  75. package/package.json +54 -55
@@ -1018,8 +1018,8 @@ const TMDcmtForm = ({ TID, DID, groupId, layoutMode = LayoutModes.Update, formMo
1018
1018
  }
1019
1019
  }, [TID, DID, triggerBlogRefresh, onRefreshBlogDatagrid]);
1020
1020
  const checkoutBadge = useMemo(() => {
1021
- const { cicoEnabled, checkoutStatus } = getDcmtCicoStatus(formData, allUsers, fromDTD);
1022
- if (!cicoEnabled || !checkoutStatus.isCheckedOut)
1021
+ const { checkoutStatus } = getDcmtCicoStatus(formData, allUsers, fromDTD);
1022
+ if (!checkoutStatus.isCheckedOut)
1023
1023
  return null;
1024
1024
  return (_jsx(Ribbon, { "$isMobile": isMobile, children: _jsx(TMTooltip, { content: checkoutStatus.editLockTooltipText, position: "right", children: _jsx("span", { children: checkoutStatus.mode === 'editMode' ? SDKUI_Localizator.CheckOut : 'Locked' }) }) }));
1025
1025
  }, [formData, fromDTD, isMobile]);
@@ -1238,7 +1238,7 @@ const TMDcmtForm = ({ TID, DID, groupId, layoutMode = LayoutModes.Update, formMo
1238
1238
  },
1239
1239
  {
1240
1240
  id: 'tmDcmtPreview',
1241
- name: SDKUI_Localizator.PreviewDocument,
1241
+ name: layoutMode === LayoutModes.Update ? SDKUI_Localizator.PreviewDocument : SDKUI_Localizator.UploadFile,
1242
1242
  contentOptions: { component: tmDcmtPreview },
1243
1243
  toolbarOptions: {
1244
1244
  icon: _jsx(IconShow, { fontSize: 24 }),
@@ -1421,8 +1421,8 @@ const TMDcmtForm = ({ TID, DID, groupId, layoutMode = LayoutModes.Update, formMo
1421
1421
  position: 'relative',
1422
1422
  overflow: 'hidden'
1423
1423
  }, children: [_jsxs("div", { style: { width: '100%', height: '100%', display: isOpenDetails || isOpenMaster ? 'none' : 'flex' }, children: [isNavigating && _jsx(Spinner, { description: SDKUI_Localizator.Loading, flat: false }), (fromDTD) && _jsx(TMLayoutWaitingContainer, { direction: 'vertical', showWaitPanel: useWaitPanelLocalState ? showWaitPanelLocal : showWaitPanel, showWaitPanelPrimary: useWaitPanelLocalState ? showPrimaryLocal : showPrimary, showWaitPanelSecondary: useWaitPanelLocalState ? showSecondaryLocal : showSecondary, waitPanelTitle: useWaitPanelLocalState ? waitPanelTitleLocal : waitPanelTitle, waitPanelTextPrimary: useWaitPanelLocalState ? waitPanelTextPrimaryLocal : waitPanelTextPrimary, waitPanelValuePrimary: useWaitPanelLocalState ? waitPanelValuePrimaryLocal : waitPanelValuePrimary, waitPanelMaxValuePrimary: useWaitPanelLocalState ? waitPanelMaxValuePrimaryLocal : waitPanelMaxValuePrimary, waitPanelTextSecondary: useWaitPanelLocalState ? waitPanelTextSecondaryLocal : waitPanelTextSecondary, waitPanelValueSecondary: useWaitPanelLocalState ? waitPanelValueSecondaryLocal : waitPanelValueSecondary, waitPanelMaxValueSecondary: useWaitPanelLocalState ? waitPanelMaxValueSecondaryLocal : waitPanelMaxValueSecondary, isCancelable: useWaitPanelLocalState ? dcmtFile ? dcmtFile.size >= 1000000 : false : true, abortController: useWaitPanelLocalState ? abortControllerLocal : abortController, children: _jsxs(TMLayoutWaitingContainer, { direction: 'vertical', showWaitPanel: showCicoWaitPanel, showWaitPanelPrimary: showCicoPrimaryProgress, waitPanelTitle: cicoWaitPanelTitle, waitPanelTextPrimary: cicoPrimaryProgressText, waitPanelValuePrimary: cicoPrimaryProgressValue, waitPanelMaxValuePrimary: cicoPrimaryProgressMax, isCancelable: true, abortController: abortControllerLocal, children: [(groupId && groupId.length > 0)
1424
- ? _jsx(TMPanelManagerContainer, { panels: initialPanels, direction: "horizontal", parentId: groupId, showToolbar: showDcmtFormSidebar })
1425
- : _jsxs(TMPanelManagerWithPersistenceProvider, { panels: initialPanels, initialVisibility: allInitialPanelVisibility, defaultDimensions: defaultPanelDimensions, initialDimensions: defaultPanelDimensions, initialMobilePanelId: 'tmDcmtForm', isPersistenceEnabled: !isMobile ? hasSavedLayout() : false, persistPanelStates: !isMobile ? (state) => persistPanelStates(state) : undefined, persistedPanelStates: getPersistedPanelStates(), children: [_jsx(PanelDisabledStateHandler, { isWFDisabled: isWFDisabled, isSysMetadataDisabled: isSysMetadataDisabled, isBoardDisabled: isBoardDisabled, isDcmtTasksDisabled: isDcmtTasksDisabled }), _jsx(TMPanelManagerContainer, { panels: initialPanels, direction: "horizontal", parentId: groupId, showToolbar: showDcmtFormSidebar })] }), isOpenDistinctValues &&
1424
+ ? _jsxs(_Fragment, { children: [_jsx(PanelDisabledStateHandler, { isWFDisabled: isWFDisabled, isSysMetadataDisabled: isSysMetadataDisabled, isBoardDisabled: isBoardDisabled, isDcmtTasksDisabled: isDcmtTasksDisabled, isPreviewDisabled: isPreviewDisabled }), _jsx(TMPanelManagerContainer, { panels: initialPanels, direction: "horizontal", parentId: groupId, showToolbar: showDcmtFormSidebar })] })
1425
+ : _jsxs(TMPanelManagerWithPersistenceProvider, { panels: initialPanels, initialVisibility: allInitialPanelVisibility, defaultDimensions: defaultPanelDimensions, initialDimensions: defaultPanelDimensions, initialMobilePanelId: 'tmDcmtForm', isPersistenceEnabled: !isMobile ? hasSavedLayout() : false, persistPanelStates: !isMobile ? (state) => persistPanelStates(state) : undefined, persistedPanelStates: getPersistedPanelStates(), children: [_jsx(PanelDisabledStateHandler, { isWFDisabled: isWFDisabled, isSysMetadataDisabled: isSysMetadataDisabled, isBoardDisabled: isBoardDisabled, isDcmtTasksDisabled: isDcmtTasksDisabled, isPreviewDisabled: isPreviewDisabled }), _jsx(TMPanelManagerContainer, { panels: initialPanels, direction: "horizontal", parentId: groupId, showToolbar: showDcmtFormSidebar })] }), isOpenDistinctValues &&
1426
1426
  _jsx(TMDistinctValues, { tid: TID, mid: focusedMetadataValue?.mid, isModal: true, showHeader: false, layoutMode: layoutMode, onClosePanelCallback: () => setIsOpenDistinctValues(false), onSelectionChanged: (e) => {
1427
1427
  if (!e)
1428
1428
  return;
@@ -1512,7 +1512,7 @@ const validateMaxLength = (mvd, value, validationItems) => {
1512
1512
  };
1513
1513
  //#endregion Validation
1514
1514
  // Synchronizes panel visibility and toolbar button disabled states when panels become disabled
1515
- const PanelDisabledStateHandler = ({ isWFDisabled, isSysMetadataDisabled, isBoardDisabled, isDcmtTasksDisabled }) => {
1515
+ const PanelDisabledStateHandler = ({ isWFDisabled, isSysMetadataDisabled, isBoardDisabled, isDcmtTasksDisabled, isPreviewDisabled }) => {
1516
1516
  const { setPanelVisibilityById, setToolbarButtonDisabled, panelVisibility } = useTMPanelManagerContext();
1517
1517
  useEffect(() => {
1518
1518
  // Aggiorna lo stato disabled del bottone toolbar
@@ -1520,6 +1520,7 @@ const PanelDisabledStateHandler = ({ isWFDisabled, isSysMetadataDisabled, isBoar
1520
1520
  setToolbarButtonDisabled('tmBlog', isBoardDisabled);
1521
1521
  setToolbarButtonDisabled('tmWF', isWFDisabled);
1522
1522
  setToolbarButtonDisabled('tmDcmtTasks', isDcmtTasksDisabled);
1523
+ setToolbarButtonDisabled('tmDcmtPreview', isPreviewDisabled);
1523
1524
  // Chiude il pannello solo se è attualmente visibile e deve essere disabilitato
1524
1525
  if (isSysMetadataDisabled && panelVisibility['tmSysMetadata']) {
1525
1526
  setPanelVisibilityById('tmSysMetadata', false);
@@ -1533,7 +1534,10 @@ const PanelDisabledStateHandler = ({ isWFDisabled, isSysMetadataDisabled, isBoar
1533
1534
  if (isDcmtTasksDisabled && panelVisibility['tmDcmtTasks']) {
1534
1535
  setPanelVisibilityById('tmDcmtTasks', false);
1535
1536
  }
1536
- }, [isSysMetadataDisabled, isBoardDisabled, isWFDisabled, isDcmtTasksDisabled, setPanelVisibilityById, setToolbarButtonDisabled, panelVisibility]);
1537
+ if (isPreviewDisabled && panelVisibility['tmDcmtPreview']) {
1538
+ setPanelVisibilityById('tmDcmtPreview', false);
1539
+ }
1540
+ }, [isSysMetadataDisabled, isBoardDisabled, isWFDisabled, isDcmtTasksDisabled, isPreviewDisabled, setPanelVisibilityById, setToolbarButtonDisabled, panelVisibility]);
1537
1541
  return null;
1538
1542
  };
1539
1543
  const TMDcmtPreviewWrapper = ({ refreshPreviewTrigger, fromDTD, currentDcmt, layoutMode, dcmtFile, deviceType, isVisible, onFileUpload, openFileUploaderPdfEditor, enableDragDropOverlay = false, onScanRequest }) => {
@@ -25,7 +25,9 @@ export declare const TMNothingToShow: ({ text, secondText, fileExt, icon }: {
25
25
  fileExt?: string;
26
26
  icon?: any;
27
27
  }) => import("react/jsx-runtime").JSX.Element;
28
- export declare const StyledHeaderIcon: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
28
+ export declare const StyledHeaderIcon: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "$color"> & {
29
29
  $color: string;
30
- }>> & string;
31
- export declare const StyledPanelStatusContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
30
+ }, never> & Partial<Pick<import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "$color"> & {
31
+ $color: string;
32
+ }, never>>> & string;
33
+ export declare const StyledPanelStatusContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
@@ -8,7 +8,10 @@ const TMDragDropOverlay = (props) => {
8
8
  useEffect(() => {
9
9
  const handleWindowDragEnter = (e) => {
10
10
  e.preventDefault();
11
- setDragOver(true);
11
+ // Attiva solo se si trascina un file
12
+ if (e.dataTransfer?.types.includes('Files')) {
13
+ setDragOver(true);
14
+ }
12
15
  };
13
16
  const handleWindowDragOver = (e) => {
14
17
  e.preventDefault();
@@ -60,7 +63,9 @@ const TMDragDropOverlay = (props) => {
60
63
  boxShadow: '0 8px 20px rgba(0,0,0,0.3)',
61
64
  backdropFilter: 'blur(5px)',
62
65
  transition: 'opacity 0.2s, transform 0.2s, background 0.2s',
63
- }, onDragEnter: (e) => { e.preventDefault(); e.stopPropagation(); setDragOver(true); }, onDragOver: (e) => { e.preventDefault(); e.stopPropagation(); setDragOver(true); }, onDragLeave: (e) => {
66
+ }, onDragEnter: (e) => { e.preventDefault(); e.stopPropagation(); if (e.dataTransfer?.types.includes('Files'))
67
+ setDragOver(true); }, onDragOver: (e) => { e.preventDefault(); e.stopPropagation(); if (e.dataTransfer?.types.includes('Files'))
68
+ setDragOver(true); }, onDragLeave: (e) => {
64
69
  e.preventDefault();
65
70
  e.stopPropagation();
66
71
  // Solo se il cursore ha lasciato il div principale
@@ -2,7 +2,6 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
2
2
  import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
3
3
  import styled from 'styled-components';
4
4
  import { IconFolderOpen, IconScanner, SDKUI_Localizator, formatBytes, IconClear, extensionHandler, IconCloseOutline, IconMenuVertical, TMCommandsContextMenu, IconEdit, isPdfEditorAvailable, SDKUI_Globals } from '../../../helper';
5
- import { useBetaFeatures } from '../../../hooks/useBetaFeatures';
6
5
  import usePreventFileDrop from '../../../hooks/usePreventFileDrop';
7
6
  import { FileExtensionHandler } from '../../../ts';
8
7
  import { TMColors } from '../../../utils/theme';
@@ -24,7 +23,6 @@ const isScannerLicenseConfigured = () => {
24
23
  }
25
24
  };
26
25
  const TMFileUploader = ({ fromDTD, deviceType = DeviceType.DESKTOP, onClose, onFileUpload, openFileUploaderPdfEditor, onScanRequest, isRequired = false, defaultBlob = null, isResizingActive, showTMPanel = true, enableDragDropOverlay = false, showScannerIcon = true }) => {
27
- const isBetaFeaturesEnabled = useBetaFeatures();
28
26
  const [dragOver, setDragOver] = useState(false);
29
27
  const [uploadedFile, setUploadedFile] = useState(defaultBlob);
30
28
  const [fileName, setFileName] = useState('');
@@ -54,7 +52,10 @@ const TMFileUploader = ({ fromDTD, deviceType = DeviceType.DESKTOP, onClose, onF
54
52
  };
55
53
  const handleDragOver = (e) => {
56
54
  e.preventDefault();
57
- setDragOver(true);
55
+ // Attiva solo se si trascina un file, non testo selezionato
56
+ if (e.dataTransfer?.types.includes('Files')) {
57
+ setDragOver(true);
58
+ }
58
59
  };
59
60
  const handleDragLeave = () => {
60
61
  setDragOver(false);
@@ -96,7 +97,7 @@ const TMFileUploader = ({ fromDTD, deviceType = DeviceType.DESKTOP, onClose, onF
96
97
  document.getElementById('fileInput')?.click();
97
98
  }, []);
98
99
  let content = !uploadedFile ?
99
- _jsxs("div", { style: { display: 'flex', gap: 10, width: '100%', height: '100%' }, children: [_jsx(HiddenInput, { id: "fileInput", type: "file", onChange: handleInputChange }), _jsxs(UploadContainer, { ref: uploaderRef, tabIndex: 0, onDragOver: handleDragOver, onDragLeave: handleDragLeave, onDrop: handleDrop, style: { backgroundColor: dragOver ? '#76b1e6' : 'white' }, onDoubleClick: browseHandler, "$isRequired": isRequired, children: [_jsxs("div", { style: { display: 'flex', gap: '10px', flexDirection: 'column', position: 'absolute', right: 5, top: 5 }, children: [_jsx(TMButton, { btnStyle: 'icon', caption: 'Sfoglia', color: isRequired && !uploadedFile ? 'error' : 'primary', onClick: browseHandler, icon: _jsx(IconFolderOpen, { fontSize: 22 }) }), isBetaFeaturesEnabled && showScannerIcon && isScannerLicenseConfigured() && onScanRequest && _jsx(TMButton, { btnStyle: 'icon', caption: 'Scanner', color: 'primary', onClick: () => { onScanRequest((file) => { onFileUpload?.(file); }); }, icon: _jsx(IconScanner, { fontSize: 22 }) }), isBetaFeaturesEnabled && showScannerIcon && isScannerLicenseConfigured() && !onScanRequest && _jsx(TMButton, { btnStyle: 'icon', caption: 'Scanner', color: 'primary', onClick: () => { ShowAlert({ message: 'Funzionalità scanner non disponibile in questo contesto.', mode: 'info', duration: 3000, title: 'Scanner' }); }, icon: _jsx(IconScanner, { fontSize: 22 }) })] }), _jsx("p", { style: { fontSize: '1.2rem', fontWeight: 'bold' }, children: deviceType === DeviceType.MOBILE ? 'Clicca per sfogliare il tuo file' : 'Trascina il tuo file o fai doppio click per sfogliarlo' }), isRequired && _jsxs("p", { style: { fontWeight: 'bold' }, children: [" ", SDKUI_Localizator.RequiredField, " "] })] })] }) :
100
+ _jsxs("div", { style: { display: 'flex', gap: 10, width: '100%', height: '100%' }, children: [_jsx(HiddenInput, { id: "fileInput", type: "file", onChange: handleInputChange }), _jsxs(UploadContainer, { ref: uploaderRef, tabIndex: 0, onDragOver: handleDragOver, onDragLeave: handleDragLeave, onDrop: handleDrop, style: { backgroundColor: dragOver ? '#76b1e6' : 'white' }, onDoubleClick: browseHandler, "$isRequired": isRequired, children: [_jsxs("div", { style: { display: 'flex', gap: '10px', flexDirection: 'column', position: 'absolute', right: 5, top: 5 }, children: [_jsx(TMButton, { btnStyle: 'icon', caption: 'Sfoglia', color: isRequired && !uploadedFile ? 'error' : 'primary', onClick: browseHandler, icon: _jsx(IconFolderOpen, { fontSize: 22 }) }), showScannerIcon && isScannerLicenseConfigured() && onScanRequest && _jsx(TMButton, { btnStyle: 'icon', caption: 'Scanner', color: 'primary', onClick: () => { onScanRequest((file) => { onFileUpload?.(file); }); }, icon: _jsx(IconScanner, { fontSize: 22 }) }), showScannerIcon && isScannerLicenseConfigured() && !onScanRequest && _jsx(TMButton, { btnStyle: 'icon', caption: 'Scanner', color: 'primary', onClick: () => { ShowAlert({ message: SDKUI_Localizator.ScanFeatureUnavailableInThisContext, mode: 'info', duration: 3000, title: 'Scanner' }); }, icon: _jsx(IconScanner, { fontSize: 22 }) })] }), _jsx("p", { style: { fontSize: '1.2rem', fontWeight: 'bold' }, children: deviceType === DeviceType.MOBILE ? 'Clicca per sfogliare il tuo file' : 'Trascina il tuo file o fai doppio click per sfogliarlo' }), isRequired && _jsxs("p", { style: { fontWeight: 'bold' }, children: [" ", SDKUI_Localizator.RequiredField, " "] })] })] }) :
100
101
  _jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: 10, width: '100%', height: '100%' }, children: [_jsxs("div", { style: { backgroundColor: 'white', padding: '5px 10px', borderRadius: 8, display: 'flex', alignItems: 'center', justifyContent: 'space-between', color: TMColors.primaryColor }, children: [_jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: 5 }, children: [_jsx("p", { children: "File name:" }), _jsxs("div", { style: { fontWeight: 'bold' }, children: [fileName, " ", _jsxs("span", { children: [" ", ` (${formatBytes(fileSize)})`, " "] })] })] }), uploadedFile && _jsx(TMButton, { btnStyle: 'icon', color: 'error', caption: 'Pulisci', onClick: () => clearFile(true), icon: _jsx(IconClear, { fontSize: 22 }) })] }), extensionHandler(fileExt) === FileExtensionHandler.READY_TO_SHOW ? _jsx(TMFileViewer, { fileBlob: uploadedFile, isResizingActive: isResizingActive }) :
101
102
  _jsx("div", { style: { backgroundColor: '#f6dbdb', padding: '5px 10px', borderRadius: 8, display: 'flex', alignItems: 'center', justifyContent: 'space-between', color: TMColors.error }, children: _jsxs("div", { children: [" ", 'Anteprima non disponibile.', fileExt && _jsx("b", { children: ` (*.${fileExt})` })] }) })] });
102
103
  const innerContent = (_jsxs("div", { style: { width: '100%', height: '100%', padding: '2px', display: 'flex', flexDirection: 'column', gap: 10 }, children: [enableDragDropOverlay && _jsx(TMDragDropOverlay, { handleFile: handleFile, refocusAfterFileInput: refocusAfterFileInput }), content] }));
@@ -1,9 +1,9 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
3
- import { DcmtTypeListCacheService, LayoutModes, SDK_Localizator } from '@topconsultnpm/sdk-ts';
3
+ import { DcmtTypeListCacheService, LayoutModes, SDK_Globals, SDK_Localizator } from '@topconsultnpm/sdk-ts';
4
4
  import TMRelationViewer from './TMRelationViewer';
5
5
  import TMContextMenu from '../../NewComponents/ContextMenu/TMContextMenu';
6
- import { IconMultipleSelection, IconCheckFile, IconDetailDcmts, SDKUI_Localizator, IconMenuVertical, IconDataList, IconPreview, IconSearchCheck, IconBoard, IconDcmtTypeSys, IconShow, getMoreInfoTasksForDocument, isApprovalWorkflowView } from '../../../helper';
6
+ import { IconMultipleSelection, IconCheckFile, IconDetailDcmts, SDKUI_Localizator, IconMenuVertical, IconDataList, IconPreview, IconSearchCheck, IconBoard, IconDcmtTypeSys, IconShow, getMoreInfoTasksForDocument, isApprovalWorkflowView, searchResultToMetadataValues, IconRefresh } from '../../../helper';
7
7
  import { FormModes, SearchResultContext } from '../../../ts';
8
8
  import { TMColors } from '../../../utils/theme';
9
9
  import ShowAlert from '../../base/TMAlert';
@@ -14,7 +14,7 @@ import { TMPanelManagerProvider, useTMPanelManagerContext } from '../../layout/p
14
14
  import TMSearchResult from '../search/TMSearchResult';
15
15
  import TMDcmtForm from './TMDcmtForm';
16
16
  import { TMNothingToShow } from './TMDcmtPreview';
17
- import { Spinner } from '../..';
17
+ import { Spinner, TMButton } from '../..';
18
18
  import { useDocumentOperations } from '../../../hooks/useDocumentOperations';
19
19
  const TMMasterDetailDcmts = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, handleNavigateToWGs, handleNavigateToDossiers, deviceType, inputDcmts, isForMaster, showCurrentDcmtIndicator = true, allowNavigation, canNext, canPrev, onNext, onPrev, onBack, appendMasterDcmts, onTaskCreateRequest, onRefreshAfterAddDcmtToFavs, editPdfForm, openS4TViewer, onOpenS4TViewerRequest, onOpenPdfEditorRequest, datagridUtility, dcmtUtility }) => {
20
20
  const floatingBarContainerRef = useRef(null);
@@ -29,11 +29,55 @@ const TMMasterDetailDcmts = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallba
29
29
  const [contextMenuPosition, setContextMenuPosition] = useState({ x: 0, y: 0 });
30
30
  const [dtdFocused, setDtdFocused] = useState();
31
31
  const [refreshKey, setRefreshKey] = useState(0);
32
- const onRefreshSearch = async () => {
33
- await dcmtUtility?.onRefreshPreviewForm?.();
34
- // forza il refresh del form di dettaglio al salvataggio
35
- setRefreshKey(prev => prev + 1);
32
+ // Separate refresh key for TMFormOrResultWrapper only (doesn't affect tmTreeView)
33
+ const [refreshKeyFormOrResult, setRefreshKeyFormOrResult] = useState(0);
34
+ /** State for transformed focusedItem metadata values (similar to formData in TMDcmtForm) */
35
+ const [focusedItemFormData, setFocusedItemFormData] = useState([]);
36
+ // Trigger operationItems refresh (after file substitution, etc.)
37
+ const [refreshOperationsTrigger, setRefreshOperationsTrigger] = useState(0);
38
+ // Increments trigger counter to force operationItems to re-calculate
39
+ const onRefreshOperationsDatagrid = useCallback(async () => {
40
+ setRefreshOperationsTrigger(prev => prev + 1);
41
+ }, []);
42
+ // Refresh ALL panels (tree view + search results) with fade-out -> update -> fade-in transition
43
+ const onRefreshAllPanels = async () => {
44
+ await dcmtUtility?.onRefreshPreviewForm?.(); // Refresh preview form data
45
+ setFocusedItem(undefined); // Clear focused item to avoid stale references
46
+ setTimeout(async () => {
47
+ setRefreshKey(prev => prev + 1); // Force re-render of tmTreeView
48
+ setRefreshKeyFormOrResult(prev => prev + 1); // Force re-render of TMFormOrResultWrapper
49
+ await onRefreshOperationsDatagrid(); // Refresh operation items
50
+ }, 200); // Wait for fade-out animation
36
51
  };
52
+ useEffect(() => {
53
+ const fetchFocusedItemMetadata = async () => {
54
+ if (!focusedItem?.tid || !focusedItem?.did) {
55
+ setFocusedItemFormData([]);
56
+ return;
57
+ }
58
+ try {
59
+ const tid = focusedItem?.tid;
60
+ const did = focusedItem?.did;
61
+ const metadata = await SDK_Globals.tmSession?.NewSearchEngine().GetMetadataAsync(tid, did, true);
62
+ // Transform metadata to MetadataValueDescriptorEx[] (similar to setMetadataList in TMDcmtForm)
63
+ if (metadata) {
64
+ const dtdResult = metadata.dtdResult;
65
+ const rows = dtdResult?.rows ? dtdResult.rows[0] : [];
66
+ const mids = metadata.selectMIDs;
67
+ // Get DTD with metadata descriptors
68
+ const dtdWithMetadata = await DcmtTypeListCacheService.GetWithNotGrantedAsync(tid, did, metadata);
69
+ const mdList = dtdWithMetadata?.metadata ?? [];
70
+ const metadataList = searchResultToMetadataValues(tid, dtdResult, rows, mids, mdList, LayoutModes.Update);
71
+ setFocusedItemFormData(structuredClone(metadataList));
72
+ }
73
+ }
74
+ catch (error) {
75
+ console.error('Error fetching focusedItem metadata:', error);
76
+ setFocusedItemFormData([]);
77
+ }
78
+ };
79
+ fetchFocusedItemMetadata();
80
+ }, [focusedItem?.tid, focusedItem?.did, refreshOperationsTrigger]);
37
81
  // Load dtdFocused when focusedItem changes
38
82
  useEffect(() => {
39
83
  const loadDtdFocused = async () => {
@@ -83,17 +127,26 @@ const TMMasterDetailDcmts = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallba
83
127
  currentMetadataValues: [],
84
128
  allUsers: [],
85
129
  // searchResult: selectedSearchResult,
86
- datagridUtility,
130
+ datagridUtility: {
131
+ visibleItems: [],
132
+ onRefreshSearchAsyncDatagrid: onRefreshAllPanels,
133
+ onRefreshDataRowsAsync: onRefreshAllPanels,
134
+ refreshFocusedDataRowAsync: onRefreshAllPanels,
135
+ onRefreshBlogDatagrid: onRefreshAllPanels,
136
+ onRefreshPreviewDatagrid: onRefreshAllPanels,
137
+ refreshOperationsTrigger,
138
+ onRefreshOperationsDatagrid,
139
+ },
87
140
  dcmtUtility: {
88
141
  approvalVID: dcmtUtility?.approvalVID,
89
- dcmtDataRowForCicoStatus: dcmtUtility?.dcmtDataRowForCicoStatus,
142
+ dcmtDataRowForCicoStatus: focusedItemFormData, // Passa i metadata trasformati del focusedItem per le operazioni di CICO
90
143
  selectedDcmtSearchResultRelations: dcmtUtility?.selectedDcmtSearchResultRelations,
91
144
  dcmtTIDHasDetailRelations: dcmtUtility?.dcmtTIDHasDetailRelations,
92
145
  dcmtTIDHasMasterRelations: dcmtUtility?.dcmtTIDHasMasterRelations,
93
- updateCurrentDcmt: dcmtUtility?.updateCurrentDcmt,
146
+ updateCurrentDcmt: onRefreshAllPanels,
94
147
  onCloseDcmtForm: dcmtUtility?.onCloseDcmtForm,
95
148
  onRefreshBlogForm: dcmtUtility?.onRefreshBlogForm,
96
- onRefreshPreviewForm: onRefreshSearch,
149
+ onRefreshPreviewForm: onRefreshAllPanels,
97
150
  taskFormDialogComponent: dcmtUtility?.taskFormDialogComponent,
98
151
  s4TViewerDialogComponent: dcmtUtility?.s4TViewerDialogComponent
99
152
  },
@@ -213,7 +266,7 @@ const TMMasterDetailDcmts = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallba
213
266
  }
214
267
  }
215
268
  ];
216
- const toolbar = _jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: '10px' }, children: [allowMultipleSelection && _jsx("p", { style: { color: TMColors.colorHeader, textAlign: 'center', padding: '1px 4px', borderRadius: '3px', display: 'flex' }, children: `${selectedItems.filter(item => item.isDcmt).length} selezionati` }), allowNavigation && canPrev != undefined && _jsx(TMSaveFormButtonPrevious, { btnStyle: 'icon', iconColor: 'white', isModified: false, formMode: FormModes.ReadOnly, canPrev: canPrev, onPrev: onPrev }), allowNavigation && canNext != undefined && _jsx(TMSaveFormButtonNext, { btnStyle: 'icon', iconColor: 'white', isModified: false, formMode: FormModes.ReadOnly, canNext: canNext, onNext: onNext }), _jsx(TMContextMenu, { items: commandsMenuItems, trigger: 'left', children: _jsx(IconMenuVertical, { color: 'white', cursor: 'pointer' }) })] });
269
+ const toolbar = _jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: '10px' }, children: [allowMultipleSelection && _jsx("p", { style: { color: TMColors.colorHeader, textAlign: 'center', padding: '1px 4px', borderRadius: '3px', display: 'flex' }, children: `${selectedItems.filter(item => item.isDcmt).length} selezionati` }), allowNavigation && canPrev != undefined && _jsx(TMSaveFormButtonPrevious, { btnStyle: 'icon', iconColor: 'white', isModified: false, formMode: FormModes.ReadOnly, canPrev: canPrev, onPrev: onPrev }), allowNavigation && canNext != undefined && _jsx(TMSaveFormButtonNext, { btnStyle: 'icon', iconColor: 'white', isModified: false, formMode: FormModes.ReadOnly, canNext: canNext, onNext: onNext }), _jsx(TMButton, { btnStyle: 'icon', icon: _jsx(IconRefresh, { color: 'white' }), caption: SDKUI_Localizator.Refresh, onClick: onRefreshAllPanels }), _jsx(TMContextMenu, { items: commandsMenuItems, trigger: 'left', children: _jsx(IconMenuVertical, { color: 'white', cursor: 'pointer' }) })] });
217
270
  const getTitle = () => isForMaster ? `${SDKUI_Localizator.DcmtsMaster} - ${dtdMaster?.nameLoc}` : SDKUI_Localizator.DcmtsDetail;
218
271
  const isMobile = deviceType === DeviceType.MOBILE;
219
272
  const tmTreeView = useMemo(() => _jsx(_Fragment, { children: !inputDcmts || inputDcmts.length === 0
@@ -225,14 +278,14 @@ const TMMasterDetailDcmts = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallba
225
278
  e.preventDefault();
226
279
  setContextMenuPosition({ x: e.clientX, y: e.clientY });
227
280
  setContextMenuVisible(true);
228
- }, children: [_jsx(TMRelationViewerWrapper, { inputDcmts: inputDcmts, isForMaster: isForMaster, showCurrentDcmtIndicator: showCurrentDcmtIndicator, showZeroDcmts: showZeroDcmts,
281
+ }, children: [_jsx(TMRelationViewerWrapper, { refreshKey: refreshKey, inputDcmts: inputDcmts, isForMaster: isForMaster, showCurrentDcmtIndicator: showCurrentDcmtIndicator, showZeroDcmts: showZeroDcmts,
229
282
  // customItemRender={customItemRender}
230
- allowMultipleSelection: allowMultipleSelection, focusedItem: focusedItem, selectedItems: selectedItems, onFocusedItemChanged: handleFocusedItemChanged, onSelectedItemsChanged: handleSelectedItemsChanged, onNoRelationsFound: handleNoRelationsFound, onItemContextMenu: onItemContextMenu }, refreshKey), _jsx(TMContextMenu, { items: operationItems, externalControl: {
283
+ allowMultipleSelection: allowMultipleSelection, focusedItem: focusedItem, selectedItems: selectedItems, onFocusedItemChanged: handleFocusedItemChanged, onSelectedItemsChanged: handleSelectedItemsChanged, onNoRelationsFound: handleNoRelationsFound, onItemContextMenu: onItemContextMenu, focusedItemFormData: focusedItemFormData }), _jsx(TMContextMenu, { items: operationItems, externalControl: {
231
284
  visible: contextMenuVisible,
232
285
  position: contextMenuPosition,
233
286
  onClose: () => setContextMenuVisible(false)
234
- } })] }) }), [inputDcmts, isForMaster, showCurrentDcmtIndicator, showZeroDcmts, allowMultipleSelection, focusedItem, selectedItems, handleFocusedItemChanged, handleSelectedItemsChanged, handleNoRelationsFound, onItemContextMenu, contextMenuVisible, contextMenuPosition, refreshKey]);
235
- const tmFormOrResult = useMemo(() => _jsx(TMFormOrResultWrapper, { deviceType: deviceType, focusedItem: focusedItem, onTaskCreateRequest: onTaskCreateRequest, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, onRefreshAfterAddDcmtToFavs: onRefreshAfterAddDcmtToFavs, editPdfForm: editPdfForm, openS4TViewer: openS4TViewer, onOpenS4TViewerRequest: onOpenS4TViewerRequest, onOpenPdfEditorRequest: onOpenPdfEditorRequest }, refreshKey), [focusedItem, deviceType, allTasks, handleNavigateToWGs, handleNavigateToDossiers, editPdfForm, openS4TViewer, onOpenS4TViewerRequest, onOpenPdfEditorRequest, onRefreshAfterAddDcmtToFavs, refreshKey]);
287
+ } })] }) }), [inputDcmts, isForMaster, showCurrentDcmtIndicator, showZeroDcmts, allowMultipleSelection, focusedItem, selectedItems, handleFocusedItemChanged, handleSelectedItemsChanged, handleNoRelationsFound, onItemContextMenu, contextMenuVisible, contextMenuPosition, refreshKey, focusedItemFormData]);
288
+ const tmFormOrResult = useMemo(() => _jsx(TMFormOrResultWrapper, { refreshKey: refreshKeyFormOrResult, deviceType: deviceType, focusedItem: focusedItem, onTaskCreateRequest: onTaskCreateRequest, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, onRefreshAfterAddDcmtToFavs: onRefreshAfterAddDcmtToFavs, editPdfForm: editPdfForm, openS4TViewer: openS4TViewer, onOpenS4TViewerRequest: onOpenS4TViewerRequest, onOpenPdfEditorRequest: onOpenPdfEditorRequest, onRefreshSearchResults: onRefreshAllPanels }), [focusedItem, deviceType, allTasks, handleNavigateToWGs, handleNavigateToDossiers, editPdfForm, openS4TViewer, onOpenS4TViewerRequest, onOpenPdfEditorRequest, onRefreshAfterAddDcmtToFavs, refreshKeyFormOrResult]);
236
289
  const initialPanelDimensions = {
237
290
  'tmTreeView': { width: '50%', height: '100%' },
238
291
  'tmFormOrResult': { width: '50%', height: '100%' },
@@ -318,7 +371,7 @@ export default TMMasterDetailDcmts;
318
371
  * - Panel visibility toggling
319
372
  * - Focus delay handling
320
373
  */
321
- const TMRelationViewerWrapper = ({ inputDcmts, isForMaster, showCurrentDcmtIndicator, showZeroDcmts, customItemRender, allowMultipleSelection, focusedItem, selectedItems, onFocusedItemChanged, onSelectedItemsChanged, onNoRelationsFound, onItemContextMenu }) => {
374
+ const TMRelationViewerWrapper = ({ refreshKey, inputDcmts, isForMaster, showCurrentDcmtIndicator, showZeroDcmts, customItemRender, allowMultipleSelection, focusedItem, selectedItems, onFocusedItemChanged, onSelectedItemsChanged, onNoRelationsFound, onItemContextMenu, focusedItemFormData }) => {
322
375
  const { setPanelVisibilityById, setToolbarButtonVisibility } = useTMPanelManagerContext();
323
376
  // Handle focused item changes with panel visibility management
324
377
  const handleFocusedItemChanged = useCallback((item) => {
@@ -349,13 +402,13 @@ const TMRelationViewerWrapper = ({ inputDcmts, isForMaster, showCurrentDcmtIndic
349
402
  onItemContextMenu?.(item, e);
350
403
  }, 100);
351
404
  }, [onItemContextMenu, handleFocusedItemChanged]);
352
- return (_jsx(TMRelationViewer, { inputDcmts: inputDcmts, isForMaster: isForMaster, showCurrentDcmtIndicator: showCurrentDcmtIndicator, initialShowZeroDcmts: showZeroDcmts, customItemRender: customItemRender, allowMultipleSelection: allowMultipleSelection, focusedItem: focusedItem, selectedItems: selectedItems, onFocusedItemChanged: handleFocusedItemChanged, onSelectedItemsChanged: onSelectedItemsChanged, maxDepthLevel: 1, invertMasterNavigation: false, onNoRelationsFound: onNoRelationsFound, onItemContextMenu: onContextMenu }));
405
+ return (_jsx(TMRelationViewer, { inputDcmts: inputDcmts, isForMaster: isForMaster, showCurrentDcmtIndicator: showCurrentDcmtIndicator, initialShowZeroDcmts: showZeroDcmts, customItemRender: customItemRender, allowMultipleSelection: allowMultipleSelection, focusedItem: focusedItem, selectedItems: selectedItems, onFocusedItemChanged: handleFocusedItemChanged, onSelectedItemsChanged: onSelectedItemsChanged, maxDepthLevel: 1, invertMasterNavigation: false, onNoRelationsFound: onNoRelationsFound, onItemContextMenu: onContextMenu, focusedItemFormData: focusedItemFormData }, refreshKey));
353
406
  };
354
- const TMFormOrResultWrapper = ({ deviceType, focusedItem, onTaskCreateRequest, allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, handleNavigateToWGs, handleNavigateToDossiers, onRefreshAfterAddDcmtToFavs, editPdfForm, openS4TViewer, onOpenS4TViewerRequest, onOpenPdfEditorRequest, onRefreshSearchAsyncDatagrid }) => {
407
+ const TMFormOrResultWrapper = ({ refreshKey, deviceType, focusedItem, onTaskCreateRequest, allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, handleNavigateToWGs, handleNavigateToDossiers, onRefreshAfterAddDcmtToFavs, editPdfForm, openS4TViewer, onOpenS4TViewerRequest, onOpenPdfEditorRequest, onRefreshSearchAsyncDatagrid, onRefreshSearchResults }) => {
355
408
  const { setPanelVisibilityById } = useTMPanelManagerContext();
356
409
  return (_jsx(_Fragment, { children: focusedItem?.isDcmt ?
357
410
  _jsx(TMDcmtForm, { groupId: 'tmFormOrResult', TID: focusedItem?.tid, DID: focusedItem.did, allowButtonsRefs: true, isClosable: deviceType !== DeviceType.MOBILE, allowNavigation: false, allowRelations: deviceType !== DeviceType.MOBILE, showDcmtFormSidebar: false, onClose: () => { setPanelVisibilityById('tmTreeView', true); }, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, moreInfoTasks: getMoreInfoTasksForDocument(allTasks, focusedItem?.tid, focusedItem?.did), openS4TViewer: openS4TViewer, onOpenS4TViewerRequest: onOpenS4TViewerRequest, onOpenPdfEditorRequest: onOpenPdfEditorRequest, datagridUtility: {
358
411
  onRefreshSearchAsyncDatagrid,
359
- } }) :
360
- _jsx(TMSearchResult, { groupId: 'tmFormOrResult', isClosable: deviceType !== DeviceType.MOBILE, context: SearchResultContext.METADATA_SEARCH, allowFloatingBar: false, allowRelations: false, openDcmtFormAsModal: true, searchResults: focusedItem?.searchResult ?? [], showSearchResultSidebar: false, showDcmtFormSidebar: false, onTaskCreateRequest: onTaskCreateRequest, onClose: () => { setPanelVisibilityById('tmTreeView', true); }, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, editPdfForm: editPdfForm, onOpenPdfEditorRequest: onOpenPdfEditorRequest, openS4TViewer: openS4TViewer, onOpenS4TViewerRequest: onOpenS4TViewerRequest, enablePinIcons: false, onRefreshAfterAddDcmtToFavs: onRefreshAfterAddDcmtToFavs }) }));
412
+ } }, refreshKey) :
413
+ _jsx(TMSearchResult, { groupId: 'tmFormOrResult', isClosable: deviceType !== DeviceType.MOBILE, context: SearchResultContext.METADATA_SEARCH, allowFloatingBar: false, allowRelations: false, openDcmtFormAsModal: true, searchResults: focusedItem?.searchResult ?? [], showSearchResultSidebar: false, showDcmtFormSidebar: false, onTaskCreateRequest: onTaskCreateRequest, onClose: () => { setPanelVisibilityById('tmTreeView', true); }, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, editPdfForm: editPdfForm, onOpenPdfEditorRequest: onOpenPdfEditorRequest, openS4TViewer: openS4TViewer, onOpenS4TViewerRequest: onOpenS4TViewerRequest, enablePinIcons: false, onRefreshAfterAddDcmtToFavs: onRefreshAfterAddDcmtToFavs, showBackButton: false, onRefreshSearchAsyncDatagrid: onRefreshSearchResults }, refreshKey) }));
361
414
  };
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { DcmtTypeDescriptor, SearchResultDescriptor, DataColumnDescriptor } from "@topconsultnpm/sdk-ts";
3
- import { DcmtInfo } from '../../../ts';
3
+ import { DcmtInfo, MetadataValueDescriptorEx } from '../../../ts';
4
4
  import { ITMTreeItem } from '../../base/TMTreeView';
5
5
  /**
6
6
  * Tree item structure for relations
@@ -104,6 +104,11 @@ export interface TMRelationViewerProps {
104
104
  * Use to show a context menu.
105
105
  */
106
106
  onItemContextMenu?: (item: RelationTreeItem, e: React.MouseEvent) => void;
107
+ /**
108
+ * Metadata values for the focused item
109
+ * (used in master-detail context)
110
+ */
111
+ focusedItemFormData?: MetadataValueDescriptorEx[];
107
112
  }
108
113
  /**
109
114
  * Check if document type has detail relations
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import React, { useCallback, useEffect, useMemo, useState } from 'react';
3
- import { DcmtTypeListCacheService, SDK_Globals, DataColumnTypes, MetadataFormats, SystemMIDs, MetadataDataDomains, RelationCacheService, RelationTypes } from "@topconsultnpm/sdk-ts";
4
- import { genUniqueId, IconFolder, IconBackhandIndexPointingRight, IconCircleInfo } from '../../../helper';
3
+ import { DcmtTypeListCacheService, SDK_Globals, DataColumnTypes, MetadataFormats, SystemMIDs, MetadataDataDomains, RelationCacheService, RelationTypes, UserListCacheService } from "@topconsultnpm/sdk-ts";
4
+ import { genUniqueId, IconFolder, IconBackhandIndexPointingRight, IconCircleInfo, getDcmtCicoStatus } from '../../../helper';
5
5
  import { TMColors } from '../../../utils/theme';
6
6
  import { StyledDivHorizontal, StyledBadge } from '../../base/Styled';
7
7
  import TMTreeView from '../../base/TMTreeView';
@@ -136,7 +136,7 @@ export const searchResultToDataSource = async (searchResult, hideSysMetadata) =>
136
136
  }
137
137
  return output;
138
138
  };
139
- const TMRelationViewer = ({ inputDcmts, isForMaster = false, showCurrentDcmtIndicator = true, allowShowZeroDcmts = true, initialShowZeroDcmts = false, allowedTIDs, allowMultipleSelection = false, focusedItem, selectedItems, onFocusedItemChanged, onSelectedItemsChanged, onDocumentDoubleClick, customItemRender, customDocumentStyle, customMainContainerContent, customDocumentContent, showMetadataNames = false, maxDepthLevel = 2, invertMasterNavigation = true, additionalStaticItems, showMainDocument = true, labelMainContainer, onNoRelationsFound, onItemContextMenu, }) => {
139
+ const TMRelationViewer = ({ inputDcmts, isForMaster = false, showCurrentDcmtIndicator = true, allowShowZeroDcmts = true, initialShowZeroDcmts = false, allowedTIDs, allowMultipleSelection = false, focusedItem, selectedItems, onFocusedItemChanged, onSelectedItemsChanged, onDocumentDoubleClick, customItemRender, customDocumentStyle, customMainContainerContent, customDocumentContent, showMetadataNames = false, maxDepthLevel = 2, invertMasterNavigation = true, additionalStaticItems, showMainDocument = true, labelMainContainer, onNoRelationsFound, onItemContextMenu, focusedItemFormData = [] }) => {
140
140
  // State
141
141
  const [dcmtTypes, setDcmtTypes] = useState([]);
142
142
  const [treeData, setTreeData] = useState([]);
@@ -160,6 +160,16 @@ const TMRelationViewer = ({ inputDcmts, isForMaster = false, showCurrentDcmtIndi
160
160
  const userInteractedWithStaticItemsRef = React.useRef(false);
161
161
  // Ref to track the last inputKey for which we set the focused item
162
162
  const lastFocusedInputRef = React.useRef('');
163
+ // State for all users (used for checkout status display)
164
+ const [allUsers, setAllUsers] = useState([]);
165
+ // Load all users for checkout status resolution
166
+ useEffect(() => {
167
+ const fetchAllUsers = async () => {
168
+ const users = await UserListCacheService.GetAllAsync();
169
+ setAllUsers(users ?? []);
170
+ };
171
+ fetchAllUsers();
172
+ }, []);
163
173
  /**
164
174
  * Generate a stable key from inputDcmts to detect real changes
165
175
  */
@@ -234,6 +244,7 @@ const TMRelationViewer = ({ inputDcmts, isForMaster = false, showCurrentDcmtIndi
234
244
  dcmtDetails.push({
235
245
  tid: tid,
236
246
  did: did,
247
+ dtd: dtd,
237
248
  isLogDel: isLogDel,
238
249
  key: `${tid}_${did}_${searchResult.relationID}_${mTID}_${mDID}_${rowGUID}`,
239
250
  isDcmt: true,
@@ -247,7 +258,7 @@ const TMRelationViewer = ({ inputDcmts, isForMaster = false, showCurrentDcmtIndi
247
258
  expanded: false,
248
259
  hidden: false,
249
260
  name: row?.SYS_Abstract?.value || row?.SYS_SUBJECT?.value || `Documento ${did}`,
250
- fileExt: row?.FILEEXT?.value
261
+ fileExt: row?.FILEEXT?.value,
251
262
  // Note: Recursive loading on expansion is handled by calculateItemsForNode
252
263
  });
253
264
  }
@@ -260,7 +271,7 @@ const TMRelationViewer = ({ inputDcmts, isForMaster = false, showCurrentDcmtIndi
260
271
  console.error('❌ Error loading detail documents:', error);
261
272
  }
262
273
  return items;
263
- }, [allowedTIDs]);
274
+ }, [allowedTIDs, focusedItemFormData, focusedItem?.dtd?.id]);
264
275
  /**
265
276
  * Recursively retrieve master documents
266
277
  */
@@ -319,6 +330,7 @@ const TMRelationViewer = ({ inputDcmts, isForMaster = false, showCurrentDcmtIndi
319
330
  dcmtMasters.push({
320
331
  tid: tid,
321
332
  did: did,
333
+ dtd: dtd,
322
334
  isLogDel: isLogDel,
323
335
  key: `${tid}_${did}_${searchResult.relationID}_${dTID}_${dDID}_${rowGUID}`,
324
336
  isDcmt: true,
@@ -609,12 +621,14 @@ const TMRelationViewer = ({ inputDcmts, isForMaster = false, showCurrentDcmtIndi
609
621
  name: docRow?.SYS_Abstract?.value || docRow?.SYS_SUBJECT?.value || `Documento ${isForMaster ? 'Dettaglio' : 'Master'}`,
610
622
  tid: dcmt.TID,
611
623
  did: dcmt.DID,
624
+ dtd: dtd,
612
625
  isDcmt: true,
613
626
  isContainer: false,
614
627
  expanded: false,
615
628
  isZero: dcmt.DID === 0,
616
629
  isMaster: !isForMaster,
617
630
  isLoaded: true,
631
+ isLogDel: docRow?.ISLOGDEL?.value,
618
632
  hidden: false,
619
633
  values: docRow,
620
634
  searchResult: result ? [result] : [],
@@ -1080,8 +1094,31 @@ const TMRelationViewer = ({ inputDcmts, isForMaster = false, showCurrentDcmtIndi
1080
1094
  const metadataContent = customDocumentContent
1081
1095
  ? customDocumentContent(item, defaultMetadataContent || _jsx(_Fragment, {}))
1082
1096
  : defaultMetadataContent;
1083
- return (_jsxs("div", { onDoubleClick: handleDoubleClick, style: documentStyle, children: [item.did && item.tid && showCurrentDcmtIndicator && inputDcmts?.some(d => d.DID === item.did && d.TID === item.tid) ? _jsx(IconBackhandIndexPointingRight, { fontSize: 22, overflow: 'visible' }) : _jsx(_Fragment, {}), item.values && (_jsx(TMDcmtIcon, { tid: item.values?.TID?.value, did: item.values?.DID?.value, fileExtension: item.values?.FILEEXT?.value, fileCount: item.values?.FILECOUNT?.value, isLexProt: item.values?.IsLexProt?.value, isMail: item.values?.ISMAIL?.value, isShared: item.values?.ISSHARED?.value, isSigned: item.values?.ISSIGNED?.value, downloadMode: 'openInNewWindow' })), metadataContent] }));
1084
- }, [onDocumentDoubleClick, showCurrentDcmtIndicator, inputDcmts, customMainContainerContent, customDocumentStyle, customDocumentContent, showMetadataNames, showMainDocument]);
1097
+ // Calculate checkout status for non-root documents
1098
+ let checkoutStatusIcon = null;
1099
+ if (item.values && item.dtd) {
1100
+ // Convert item.values to flat format expected by getDcmtCicoStatus
1101
+ const flatValues = {};
1102
+ if (item.values) {
1103
+ for (const key of Object.keys(item.values)) {
1104
+ const entry = item.values[key];
1105
+ if (entry?.md?.id && item.tid) {
1106
+ // Create TID_MID key format for metadata
1107
+ flatValues[`${item.tid}_${entry.md.id}`] = entry.value;
1108
+ }
1109
+ // Also add direct key for system properties
1110
+ flatValues[key] = entry?.value;
1111
+ }
1112
+ flatValues.TID = item.tid;
1113
+ flatValues.DID = item.did;
1114
+ }
1115
+ const { checkoutStatus } = getDcmtCicoStatus(flatValues, allUsers, item.dtd);
1116
+ if (checkoutStatus.isCheckedOut && checkoutStatus.icon) {
1117
+ checkoutStatusIcon = checkoutStatus.icon;
1118
+ }
1119
+ }
1120
+ return (_jsxs("div", { onDoubleClick: handleDoubleClick, style: documentStyle, children: [item.did && item.tid && showCurrentDcmtIndicator && inputDcmts?.some(d => d.DID === item.did && d.TID === item.tid) ? _jsx(IconBackhandIndexPointingRight, { fontSize: 22, overflow: 'visible' }) : _jsx(_Fragment, {}), item.values && (_jsx(TMDcmtIcon, { tid: item.values?.TID?.value, did: item.values?.DID?.value, fileExtension: item.values?.FILEEXT?.value, fileCount: item.values?.FILECOUNT?.value, isLexProt: item.values?.IsLexProt?.value, isMail: item.values?.ISMAIL?.value, isShared: item.values?.ISSHARED?.value, isSigned: item.values?.ISSIGNED?.value, downloadMode: 'openInNewWindow' })), checkoutStatusIcon, metadataContent] }));
1121
+ }, [onDocumentDoubleClick, showCurrentDcmtIndicator, inputDcmts, customMainContainerContent, customDocumentStyle, customDocumentContent, showMetadataNames, showMainDocument, focusedItemFormData, focusedItem?.dtd, allUsers]);
1085
1122
  /**
1086
1123
  * Wrapper renderer that handles custom rendering if provided
1087
1124
  */
@@ -201,7 +201,7 @@ const TMSavedQuerySelector = React.memo(({ items, selectedId, allowShowSearch =
201
201
  alignItems: 'center',
202
202
  justifyContent: 'center',
203
203
  minWidth: 0
204
- }, children: [_jsx("p", { style: {
204
+ }, children: [_jsx("p", { title: sqd.name, style: {
205
205
  fontSize: '1rem',
206
206
  fontWeight: sqd.id === 1 ? 600 : 'normal',
207
207
  whiteSpace: 'nowrap',
@@ -53,6 +53,8 @@ const TMSearch = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTask
53
53
  if (inputSqdID) {
54
54
  SavedQueryCacheService.GetAsync(inputSqdID).then(async (resultSqd) => {
55
55
  await setSQDAsync(resultSqd);
56
+ // Mostra la vista Search per visualizzare i filtri della SavedQuery caricata
57
+ setCurrentSearchView(TMSearchViews.Search);
56
58
  });
57
59
  }
58
60
  }, [inputSqdID]);
@@ -148,6 +148,18 @@ const TMSearchWhereItemEditor = React.memo(({ whereItem, queryParamsDynDataList,
148
148
  let dtd = await DcmtTypeListCacheService.GetAsync(whereItem.tid, true);
149
149
  return dtd?.metadata?.find(o => o.id === whereItem.mid);
150
150
  };
151
+ // Rimuove gli apici singoli da valori separati da virgola: 'msegato','plevolella' -> msegato,plevolella
152
+ const stripQuotes = (value) => {
153
+ if (!value || typeof value !== 'string')
154
+ return value;
155
+ return value.split(',').map(item => {
156
+ const trimmed = item.trim();
157
+ if (trimmed.startsWith("'") && trimmed.endsWith("'")) {
158
+ return trimmed.slice(1, -1);
159
+ }
160
+ return trimmed;
161
+ }).join(',');
162
+ };
151
163
  const normalizeValue = (value, isForValue1 = true) => {
152
164
  let newValues = [];
153
165
  let newValue = value;
@@ -161,7 +173,7 @@ const TMSearchWhereItemEditor = React.memo(({ whereItem, queryParamsDynDataList,
161
173
  }
162
174
  onValueChanged?.(newValues);
163
175
  };
164
- return (_jsxs(StyledRowItem, { style: { marginBottom: 0, width: '100%' }, children: [showValue1 && _jsx(TMMetadataEditor, { openChooserBySingleClick: openChooserBySingleClick, isSelected: isSelected, tid: whereItem.tid, mid: whereItem.mid, layoutMode: LayoutModes.None, isEditable: isEditableList, value: whereItem.value1, queryOperator: whereItem.operator, queryParamsDynDataList: queryParamsDynDataList, autoFocus: autoFocus ?? false, containerElement: undefined, onValueChanged: (value) => { normalizeValue(value, true); }, onCascadeRefreshDynDataLists: onCascadeRefreshDynDataLists, onCascadeUpdateMIDs: onCascadeUpdateMIDs, updateIsModalOpen: updateIsModalOpen }), showValue2 && _jsx(TMMetadataEditor, { openChooserBySingleClick: openChooserBySingleClick, isSelected: isSelected, tid: whereItem.tid, mid: whereItem.mid, layoutMode: LayoutModes.None, isEditable: isEditableList, value: whereItem.value2, queryOperator: whereItem.operator, autoFocus: autoFocus ?? false, containerElement: undefined, onValueChanged: (value) => { normalizeValue(value, false); }, updateIsModalOpen: updateIsModalOpen })] }));
176
+ return (_jsxs(StyledRowItem, { style: { marginBottom: 0, width: '100%' }, children: [showValue1 && _jsx(TMMetadataEditor, { openChooserBySingleClick: openChooserBySingleClick, isSelected: isSelected, tid: whereItem.tid, mid: whereItem.mid, layoutMode: LayoutModes.None, isEditable: isEditableList, value: stripQuotes(whereItem.value1), queryOperator: whereItem.operator, queryParamsDynDataList: queryParamsDynDataList, autoFocus: autoFocus ?? false, containerElement: undefined, onValueChanged: (value) => { normalizeValue(value, true); }, onCascadeRefreshDynDataLists: onCascadeRefreshDynDataLists, onCascadeUpdateMIDs: onCascadeUpdateMIDs, updateIsModalOpen: updateIsModalOpen }), showValue2 && _jsx(TMMetadataEditor, { openChooserBySingleClick: openChooserBySingleClick, isSelected: isSelected, tid: whereItem.tid, mid: whereItem.mid, layoutMode: LayoutModes.None, isEditable: isEditableList, value: stripQuotes(whereItem.value2), queryOperator: whereItem.operator, autoFocus: autoFocus ?? false, containerElement: undefined, onValueChanged: (value) => { normalizeValue(value, false); }, updateIsModalOpen: updateIsModalOpen })] }));
165
177
  });
166
178
  const TMSearchWhereItemCard = React.memo(({ index, whereItem, isSelected, queryParamsDynDataList, showEditor, showCompleteMetadataName, showId, isEditableList, onWhereItemChange, onHideEditor, onCascadeRefreshDynDataLists, onCascadeUpdateMIDs, updateIsModalOpen }) => {
167
179
  const [isOpen, setIsOpen] = useState(false);
@@ -25,6 +25,6 @@ interface ITMSearchQueryPanelProps {
25
25
  declare const TMSearchQueryPanel: React.FunctionComponent<ITMSearchQueryPanelProps>;
26
26
  export default TMSearchQueryPanel;
27
27
  export declare const refreshLastSearch: (qd: QueryDescriptor | undefined) => Promise<SearchResultDescriptor[] | undefined>;
28
- export declare const StyledToppyTextContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
29
- export declare const StyledToppyText: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, never>> & string;
30
- export declare const StyledToppyImage: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, never>> & string;
28
+ export declare const StyledToppyTextContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
29
+ export declare const StyledToppyText: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, never> & Partial<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, never>>> & string;
30
+ export declare const StyledToppyImage: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, never> & Partial<Pick<React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, never>>> & string;
@@ -352,7 +352,7 @@ handleNavigateToWGs, handleNavigateToDossiers, }) => {
352
352
  openTaskFormHandler,
353
353
  },
354
354
  });
355
- 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;
355
+ 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, FileSourceDialog, }, relatedDocumentsInfo: { isOpenDetails, isOpenMaster, checkRelatedDcmtsArchiveCapability, checkManyToManyCapability, }, toppyOperations: { showApprovePopup, showRejectPopup, showReAssignPopup, showMoreInfoPopup, updateShowApprovePopup, updateShowRejectPopup, updateShowReAssignPopup, updateShowMoreInfoPopup } } = features;
356
356
  const deviceType = useDeviceType();
357
357
  const isMobile = deviceType === DeviceType.MOBILE;
358
358
  const selectedDocs = getSelectedDcmtsOrFocused(selectedItems, focusedItem);
@@ -658,6 +658,7 @@ handleNavigateToWGs, handleNavigateToDossiers, }) => {
658
658
  }
659
659
  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, "..."] }))] }))] })] }));
660
660
  }, [selectedSearchResult, focusedItem, indexingInfo, showIndexingInfo, loadingIndexingInfo]);
661
+ const isBoardDisabled = useMemo(() => fromDTD?.hasBlog !== 1, [fromDTD?.hasBlog]);
661
662
  const allInitialPanelVisibility = {
662
663
  'tmSearchResult': true,
663
664
  'tmBlog': false,
@@ -726,9 +727,9 @@ handleNavigateToWGs, handleNavigateToDossiers, }) => {
726
727
  width: '100%',
727
728
  height: '100%',
728
729
  }, 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) ?
729
- _jsx(TMPanelManagerContainer, { panels: initialPanels, direction: "horizontal", parentId: groupId, showToolbar: showSearchResultSidebar })
730
+ _jsxs(_Fragment, { children: [_jsx(PanelDisabledStateHandler, { isBoardDisabled: isBoardDisabled }), _jsx(TMPanelManagerContainer, { panels: initialPanels, direction: "horizontal", parentId: groupId, showToolbar: showSearchResultSidebar })] })
730
731
  :
731
- _jsx(TMPanelManagerProvider, { panels: initialPanels, initialVisibility: allInitialPanelVisibility, defaultDimensions: initialPanelDimensions, initialDimensions: initialPanelDimensions, initialMobilePanelId: 'tmSearchResult', children: _jsx(TMPanelManagerContainer, { panels: initialPanels, direction: "horizontal", parentId: groupId, showToolbar: showSearchResultSidebar }) }) }) }) }), renderDcmtOperations] }));
732
+ _jsxs(TMPanelManagerProvider, { panels: initialPanels, initialVisibility: allInitialPanelVisibility, defaultDimensions: initialPanelDimensions, initialDimensions: initialPanelDimensions, initialMobilePanelId: 'tmSearchResult', children: [_jsx(PanelDisabledStateHandler, { isBoardDisabled: isBoardDisabled }), _jsx(TMPanelManagerContainer, { panels: initialPanels, direction: "horizontal", parentId: groupId, showToolbar: showSearchResultSidebar })] }) }) }) }), renderDcmtOperations] }));
732
733
  };
733
734
  export default TMSearchResult;
734
735
  const TMSearchResultGrid = ({ openInOffice, fromDTD, operationItems, allUsers, inputFocusedItem, allowMultipleSelection = true, showExportForm = false, onFocusedItemChanged, onDownloadDcmtsAsync, onVisibleItemChanged, inputSelectedItems = [], lastUpdateSearchTime, searchResult, onSelectionChanged, onDblClick, showSearchTMDatagrid, updateDataColumnsFromDataGrid, updateDataSourceFromDataGrid, updateSelectedRowKeysFromDataGrid }) => {
@@ -1238,6 +1239,18 @@ const TMSearchResultSelector = ({ searchResults = [], disableAccordionIfSingleCa
1238
1239
  return (_jsx(TMAccordionNew, { groups: accordionGroups, selectedItem: selectedResult, onSelectedItemChange: (result) => handleSelect(result) }));
1239
1240
  };
1240
1241
  //#endregion TMSearchResultSelector
1242
+ const PanelDisabledStateHandler = ({ isBoardDisabled }) => {
1243
+ const { setPanelVisibilityById, setToolbarButtonDisabled, panelVisibility } = useTMPanelManagerContext();
1244
+ useEffect(() => {
1245
+ // Aggiorna lo stato disabled del bottone toolbar
1246
+ setToolbarButtonDisabled('tmBlog', isBoardDisabled);
1247
+ // Chiude il pannello solo se è attualmente visibile e deve essere disabilitato
1248
+ if (isBoardDisabled && panelVisibility['tmBlog']) {
1249
+ setPanelVisibilityById('tmBlog', false);
1250
+ }
1251
+ }, [isBoardDisabled, setPanelVisibilityById, setToolbarButtonDisabled, panelVisibility]);
1252
+ return null;
1253
+ };
1241
1254
  const TMDcmtPreviewWrapper = ({ refreshPreviewTrigger, currentDcmt, isVisible }) => {
1242
1255
  const { setPanelVisibilityById, toggleMaximize, isResizingActive, countVisibleLeafPanels } = useTMPanelManagerContext();
1243
1256
  const deviceType = useDeviceType();