@topconsultnpm/sdkui-react 6.20.0-dev2.12 → 6.20.0-dev2.14

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.
@@ -9,7 +9,6 @@ import TMChooserForm from '../forms/TMChooserForm';
9
9
  import { TMColors } from '../../utils/theme';
10
10
  import TMTooltip from '../base/TMTooltip';
11
11
  import { FormulaHelper } from '../editors/TMFormulaEditor';
12
- import { TMExceptionBoxManager } from '../base/TMPopUp';
13
12
  const TMDynDataListItemChooser = ({ tid, md, width = '100%', titleForm, openChooserBySingleClick, readOnly, layoutMode = LayoutModes.None, queryParamsDynDataList, buttons = [], backgroundColor, showBorder = true, elementStyle, allowMultipleSelection, values, isModifiedWhen, label, placeHolder, validationItems = [], icon, labelColor, showClearButton, onValueChanged, onCascadeRefreshDynDataLists, onCascadeUpdateMIDs, updateIsModalOpen }) => {
14
13
  const [showChooser, setShowChooser] = useState(false);
15
14
  const [dynDl, setDynDl] = useState();
@@ -31,9 +30,7 @@ const TMDynDataListItemChooser = ({ tid, md, width = '100%', titleForm, openChoo
31
30
  setDynDl(d);
32
31
  if (!IsParametricQuery(d?.qd) && !dataSource) {
33
32
  setDataSource(undefined);
34
- loadData()
35
- .then((result) => { setDataSource(result); })
36
- .catch((err) => { TMExceptionBoxManager.show({ exception: err }); });
33
+ loadData().then((result) => { setDataSource(result); });
37
34
  }
38
35
  }, [md]);
39
36
  useEffect(() => {
@@ -45,13 +42,12 @@ const TMDynDataListItemChooser = ({ tid, md, width = '100%', titleForm, openChoo
45
42
  setDataSource(undefined);
46
43
  return;
47
44
  }
48
- loadData()
49
- .then((result) => { setDataSource(result); })
50
- .catch((err) => { TMExceptionBoxManager.show({ exception: err }); });
45
+ loadData().then((result) => {
46
+ setDataSource(result);
47
+ });
51
48
  }, [queryParamsDynDataList, dynDl]);
52
49
  const loadData = async () => {
53
- return await SDK_Globals.tmSession?.NewSearchEngine().GetDynDataListValuesAsync(tid, md?.id, layoutMode, queryParamsDynDataList ?? [])
54
- .catch((err) => { throw err; });
50
+ return await SDK_Globals.tmSession?.NewSearchEngine().GetDynDataListValuesAsync(tid, md?.id, layoutMode, queryParamsDynDataList ?? []);
55
51
  };
56
52
  const getDescription = () => {
57
53
  if (!Array.isArray(values))
@@ -156,8 +152,7 @@ export const TMDynDataListItemChooserForm = (props) => {
156
152
  if (refreshCache)
157
153
  DataListCacheService.RemoveAll();
158
154
  TMSpinner.show({ description: `${SDKUI_Localizator.Loading} - ${SDK_Localizator.DataList} ...` });
159
- let result = await SDK_Globals.tmSession?.NewSearchEngine().GetDynDataListValuesAsync(props.TID, props.MID, props.layoutMode, [])
160
- .catch((err) => { TMSpinner.hide(); TMExceptionBoxManager.show({ exception: err }); });
155
+ let result = await SDK_Globals.tmSession?.NewSearchEngine().GetDynDataListValuesAsync(props.TID, props.MID, props.layoutMode, []);
161
156
  TMSpinner.hide();
162
157
  return result ? searchResultDescriptorToSimpleArray(result) ?? [] : [];
163
158
  };
@@ -14,7 +14,6 @@ import { ChronologyMIDs, DraftsMIDs, DSAttachsMIDs } from "../../ts";
14
14
  import { TMNothingToShow } from "../features/documents/TMDcmtPreview";
15
15
  import TMAccordion from "../base/TMAccordion";
16
16
  import TabPanel, { Item } from 'devextreme-react/tab-panel';
17
- import { TMExceptionBoxManager } from "../base/TMPopUp";
18
17
  export var ShowCheckBoxesMode;
19
18
  (function (ShowCheckBoxesMode) {
20
19
  ShowCheckBoxesMode[ShowCheckBoxesMode["Never"] = 0] = "Never";
@@ -166,8 +165,7 @@ const TMMetadataValues = ({ showCheckBoxes = ShowCheckBoxesMode.Never, checkPerm
166
165
  if (!d)
167
166
  return;
168
167
  let toBeRefreshed = [];
169
- let dynDlDataSource = await SDK_Globals.tmSession?.NewSearchEngine().GetDynDataListValuesAsync(tid, mid, layoutMode, qParams)
170
- .catch((err) => { TMExceptionBoxManager.show({ exception: err }); });
168
+ let dynDlDataSource = await SDK_Globals.tmSession?.NewSearchEngine().GetDynDataListValuesAsync(tid, mid, layoutMode, qParams);
171
169
  if (!d.onValueChanged_DynDataListsToBeRefreshed)
172
170
  return;
173
171
  let row = dynDlDataSource?.dtdResult?.rows?.filter(o => o[d.selectItemForValue ?? 0] == value);
@@ -123,10 +123,6 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
123
123
  const [refreshBlogTrigger, setRefreshBlogTrigger] = useState(0);
124
124
  const [wfError, setWfError] = useState(null);
125
125
  const [metadataDcmtOrigin, setMetadataDcmtOrigin] = useState(null);
126
- const isReadOnlyOriginCallback = useCallback((fromTID) => {
127
- return layoutMode !== LayoutModes.Ark && layoutMode !== LayoutModes.ArkFromBasket && layoutMode !== LayoutModes.ArkFromFile && layoutMode !== LayoutModes.ArkFromMail
128
- && fromTID?.toString() !== TID?.toString();
129
- }, [layoutMode, TID]);
130
126
  const triggerBlogRefresh = useCallback(async () => {
131
127
  setRefreshBlogTrigger(prev => prev + 1);
132
128
  }, []);
@@ -198,7 +194,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
198
194
  let dtd = res?.dtdResult;
199
195
  let rows = dtd.rows ? dtd.rows[0] : [];
200
196
  let mids = res?.selectMIDs;
201
- let metadataList = searchResultToMetadataValues(TID, dtd, rows, mids, mdList, layoutMode, isReadOnlyOriginCallback(origin.fromTID));
197
+ let metadataList = searchResultToMetadataValues(TID, dtd, rows, mids, mdList, layoutMode, origin.fromTID?.toString() !== TID?.toString());
202
198
  if (archived) {
203
199
  // Usa setFormData con funzione callback per accedere allo stato precedente
204
200
  // invece di dipendere da formDataOrig nell'array di dipendenze
@@ -286,7 +282,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
286
282
  }
287
283
  else {
288
284
  const renderedMetadata = dtd?.metadata?.filter((metadata) => handleArchiveVisibility(metadata)) ?? [];
289
- const metadataList = searchResultToMetadataValues(dtd?.id, undefined, [], [], renderedMetadata, layoutMode, isReadOnlyOriginCallback(metadataDcmtOrigin?.fromTID));
285
+ const metadataList = searchResultToMetadataValues(dtd?.id, undefined, [], [], renderedMetadata, layoutMode, metadataDcmtOrigin?.fromTID?.toString() !== TID?.toString());
290
286
  setFormDataOrig(structuredClone(metadataList));
291
287
  setFormData(structuredClone(metadataList));
292
288
  formDataOrigRef.current = structuredClone(metadataList);
@@ -301,7 +297,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
301
297
  setIsInitialLoading(false);
302
298
  setIsNavigating(false);
303
299
  }
304
- }, [TID, DID, layoutMode, inputFile, setMetadataList, handleReset, allowButtonsRefs, isReadOnlyOriginCallback, metadataDcmtOrigin?.fromTID]);
300
+ }, [TID, DID, layoutMode, inputFile, setMetadataList, handleReset, allowButtonsRefs, metadataDcmtOrigin?.fromTID]);
305
301
  const createChange = useCallback((mid, metadataType, modifiedValue) => {
306
302
  return { mid, metadataType, modifiedValue };
307
303
  }, []);
@@ -1220,7 +1216,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
1220
1216
  }, [formData, fromDTD, isMobile]);
1221
1217
  const tmDcmtForm = useMemo(() => {
1222
1218
  return _jsxs(_Fragment, { children: [checkoutBadge && _jsx("div", { style: { padding: '10px', display: 'flex', justifyContent: 'center' }, children: checkoutBadge }), metadataValuesSource.length > 0 &&
1223
- _jsxs(StyledToolbarCardContainer, { children: [_jsx(TMMetadataValues, { TID: TID, metadataValues: metadataValuesSource, metadataValuesOrig: metadataValuesSourceOrig, isExpertMode: isExpertMode, isOpenDistinctValues: isOpenDistinctValues, openChooserBySingleClick: !isOpenDistinctValues, selectedMID: focusedMetadataValue?.mid, isReadOnly: formMode === FormModes.ReadOnly, layoutMode: layoutMode, deviceType: deviceType, validationItems: validationItems, inputMids: inputMids, layout: layout, isReadOnlyOrigin: isReadOnlyOriginCallback(metadataDcmtOrigin?.fromTID), onFocusedItemChanged: (item) => { (item?.mid !== focusedMetadataValue?.mid) && setFocusedMetadataValue(item); }, onValueChanged: (newItems) => {
1219
+ _jsxs(StyledToolbarCardContainer, { children: [_jsx(TMMetadataValues, { TID: TID, metadataValues: metadataValuesSource, metadataValuesOrig: metadataValuesSourceOrig, isExpertMode: isExpertMode, isOpenDistinctValues: isOpenDistinctValues, openChooserBySingleClick: !isOpenDistinctValues, selectedMID: focusedMetadataValue?.mid, isReadOnly: formMode === FormModes.ReadOnly, layoutMode: layoutMode, deviceType: deviceType, validationItems: validationItems, inputMids: inputMids, layout: layout, isReadOnlyOrigin: metadataDcmtOrigin?.fromTID?.toString() !== TID?.toString(), onFocusedItemChanged: (item) => { (item?.mid !== focusedMetadataValue?.mid) && setFocusedMetadataValue(item); }, onValueChanged: (newItems) => {
1224
1220
  setFormData((prevItems) => prevItems.map((item) => {
1225
1221
  const newItem = newItems.find((newItem) => newItem.tid === item.tid && newItem.mid === item.mid);
1226
1222
  return newItem ? { ...item, ...newItem } : item;
@@ -1266,8 +1262,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
1266
1262
  handleConfirmAction,
1267
1263
  handleUndo,
1268
1264
  handleClearForm,
1269
- isReadOnlyOriginCallback,
1270
- metadataDcmtOrigin?.fromTID,
1265
+ metadataDcmtOrigin
1271
1266
  ]);
1272
1267
  const tmBlog = useMemo(() => _jsx(TMDcmtBlog, { tid: TID, did: DID, allTasks: allTasks, fetchBlogDataTrigger: refreshBlogTrigger, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }), [TID, DID, allTasks, refreshBlogTrigger, handleNavigateToWGs, handleNavigateToDossiers]);
1273
1268
  const tmSysMetadata = useMemo(() => _jsx(TMMetadataValues, { layoutMode: layoutMode, openChooserBySingleClick: !isOpenDistinctValues, TID: TID, isReadOnly: true, deviceType: deviceType, metadataValues: formData.filter(o => (o.mid != undefined && o.mid <= 100)), metadataValuesOrig: formData.filter(o => (o.mid != undefined && o.mid <= 100)), validationItems: [], inputMids: inputMids }), [TID, layoutMode, formData, deviceType, inputMids]);
@@ -1389,7 +1384,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
1389
1384
  const { assignedToMe, assignedByMe } = getDcmtTasksCounter(TID, DID, allTasks);
1390
1385
  let titleDcmtFormPanel = fromDTD?.nameLoc ?? "";
1391
1386
  // Caso: Il documento proviene da un'origine esterna
1392
- if (isReadOnlyOriginCallback(metadataDcmtOrigin?.fromTID)) {
1387
+ if (metadataDcmtOrigin?.fromTID?.toString() !== TID?.toString()) {
1393
1388
  titleDcmtFormPanel = (_jsxs("div", { style: { display: 'inline-flex', alignItems: 'center', gap: '4px' }, children: [_jsx(TMTooltip, { content: _jsxs("div", { style: { textAlign: 'left' }, children: [_jsx("p", { children: "Questo documento proviene da un'altra origine e non pu\u00F2 essere modificato." }), _jsx("hr", {}), _jsxs("p", { children: [_jsx("strong", { children: "TID corrente:" }), " ", TID?.toString()] }), _jsxs("p", { children: [_jsx("strong", { children: "Nome corrente:" }), " ", fromDTD?.nameLoc] }), _jsx("hr", {}), _jsxs("p", { children: [_jsx("strong", { children: "TID origine:" }), " ", metadataDcmtOrigin?.fromTID?.toString()] }), _jsxs("p", { children: [_jsx("strong", { children: "Nome origine:" }), " ", metadataDcmtOrigin?.fromName] })] }), children: _jsx(IconLock, { fontSize: 16, style: { alignSelf: 'center' } }) }), metadataDcmtOrigin?.fromName] }));
1394
1389
  }
1395
1390
  const panels = [
@@ -1473,7 +1468,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
1473
1468
  },
1474
1469
  ];
1475
1470
  return panels;
1476
- }, [fromDTD, showBackButton, tmDcmtForm, tmBlog, tmSysMetadata, tmDcmtPreview, tmWF, tmDcmtTasks, isPreviewDisabled, isSysMetadataDisabled, isBoardDisabled, isWFDisabled, inputFile, isClosable, allTasks, DID, TID, isReadOnlyOriginCallback, metadataDcmtOrigin?.fromTID]);
1471
+ }, [fromDTD, showBackButton, tmDcmtForm, tmBlog, tmSysMetadata, tmDcmtPreview, tmWF, tmDcmtTasks, isPreviewDisabled, isSysMetadataDisabled, isBoardDisabled, isWFDisabled, inputFile, isClosable, allTasks, DID, TID, metadataDcmtOrigin?.fromTID]);
1477
1472
  // Retrieves the current document form setting based on the normalized TID
1478
1473
  const getCurrentDcmtFormSetting = () => {
1479
1474
  const settings = SDKUI_Globals.userSettings.dcmtFormSettings;
@@ -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, 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, IconInfo, IconCache, 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';
@@ -101,6 +101,7 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
101
101
  const [indexingInfoCache, setIndexingInfoCache] = useState(new Map());
102
102
  const [showIndexingInfo, setShowIndexingInfo] = useState(false);
103
103
  const [loadingIndexingInfo, setLoadingIndexingInfo] = useState(false);
104
+ const [openedDrawerItems, setOpenedDrawerItems] = useState(new Set());
104
105
  const floatingBarContainerRef = useRef(null);
105
106
  const [confirmFormat, ConfirmFormatDialog] = useInputCvtFormatDialog();
106
107
  const { openConfirmAttachmentsDialog, ConfirmAttachmentsDialog } = useInputAttachmentsDialog();
@@ -736,47 +737,38 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
736
737
  const tmBlog = useMemo(() => _jsx(TMDcmtBlog, { tid: focusedItem?.TID, did: focusedItem?.DID, fetchBlogDataTrigger: refreshBlogTrigger, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }), [focusedItem, allTasks, refreshBlogTrigger, handleNavigateToWGs, handleNavigateToDossiers]);
737
738
  const tmSysMetadata = useMemo(() => _jsx(TMMetadataValues, { layoutMode: LayoutModes.Update, openChooserBySingleClick: true, TID: focusedItem?.TID, isReadOnly: true, deviceType: deviceType, metadataValues: currentMetadataValues.filter(o => (o.mid != undefined && o.mid <= 100)), metadataValuesOrig: currentMetadataValues.filter(o => (o.mid != undefined && o.mid <= 100)), validationItems: [] }), [focusedItem, currentMetadataValues, deviceType]);
738
739
  const tmDcmtPreview = useMemo(() => _jsx(TMDcmtPreviewWrapper, { currentDcmt: currentDcmt }, refreshPreviewTrigger), [currentDcmt, refreshPreviewTrigger]);
739
- // Auto-fetch indexing info when drawer is open and focusedItem changes
740
740
  useEffect(() => {
741
- if (!focusedItem || !showIndexingInfo)
741
+ if (!focusedItem)
742
742
  return;
743
743
  const cacheKey = `${focusedItem.TID}-${focusedItem.DID}`;
744
- if (!indexingInfoCache.has(cacheKey)) {
745
- const fetchData = async () => {
746
- try {
747
- setLoadingIndexingInfo(true);
748
- const msg = await SDK_Globals.tmSession?.NewSearchEngine().FreeSearchGetDcmtInfoAsync(focusedItem.TID, focusedItem.DID);
749
- setIndexingInfoCache(prev => new Map(prev).set(cacheKey, msg ?? ''));
750
- }
751
- catch (e) {
752
- TMExceptionBoxManager.show({ exception: e });
753
- }
754
- finally {
755
- setLoadingIndexingInfo(false);
756
- }
757
- };
758
- fetchData();
759
- }
760
- }, [focusedItem, showIndexingInfo]);
744
+ setShowIndexingInfo(openedDrawerItems.has(cacheKey));
745
+ }, [focusedItem, openedDrawerItems]);
761
746
  const handleToggleIndexingInfo = async () => {
762
747
  if (!focusedItem)
763
748
  return;
764
- const newShowState = !showIndexingInfo;
765
- setShowIndexingInfo(newShowState);
766
- if (newShowState) {
767
- const cacheKey = `${focusedItem.TID}-${focusedItem.DID}`;
768
- if (!indexingInfoCache.has(cacheKey)) {
769
- try {
770
- setLoadingIndexingInfo(true);
771
- const msg = await SDK_Globals.tmSession?.NewSearchEngine().FreeSearchGetDcmtInfoAsync(focusedItem.TID, focusedItem.DID);
772
- setIndexingInfoCache(prev => new Map(prev).set(cacheKey, msg ?? ''));
773
- }
774
- catch (e) {
775
- TMExceptionBoxManager.show({ exception: e });
776
- }
777
- finally {
778
- setLoadingIndexingInfo(false);
779
- }
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)) {
762
+ try {
763
+ setLoadingIndexingInfo(true);
764
+ const msg = await SDK_Globals.tmSession?.NewSearchEngine().FreeSearchGetDcmtInfoAsync(focusedItem.TID, focusedItem.DID);
765
+ setIndexingInfoCache(prev => new Map(prev).set(cacheKey, msg ?? ''));
766
+ }
767
+ catch (e) {
768
+ TMExceptionBoxManager.show({ exception: e });
769
+ }
770
+ finally {
771
+ setLoadingIndexingInfo(false);
780
772
  }
781
773
  }
782
774
  };
@@ -814,21 +806,21 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
814
806
  }
815
807
  const cacheKey = `${focusedItem.TID}-${focusedItem.DID}`;
816
808
  const cachedInfo = indexingInfoCache.get(cacheKey);
817
- 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("span", { children: SDKUI_Localizator.IndexingInformation }), cachedInfo && (_jsx(TMTooltip, { content: "Da cache", children: _jsx(StyledCachedIcon, { children: _jsx(IconCache, { fontSize: 13 }) }) }))] }), _jsxs(StyledRightContent, { children: [cachedInfo && (_jsx(TMTooltip, { content: "Aggiorna", children: _jsx(StyledRefreshIcon, { onClick: (e) => { e.stopPropagation(); handleRefreshIndexingInfo(); }, children: _jsx(IconRefresh, {}) }) })), _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, "..."] }))] }))] })] }));
818
- }, [selectedSearchResult, focusedItem, indexingInfoCache, showIndexingInfo, loadingIndexingInfo, handleRefreshIndexingInfo]);
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]);
819
811
  const allInitialPanelVisibility = {
820
812
  'tmSearchResult': true,
821
813
  'tmBlog': false,
822
814
  'tmSysMetadata': false,
823
- 'tmFullTextSearch': false,
824
815
  'tmDcmtPreview': false,
816
+ 'tmFullTextSearch': false,
825
817
  };
826
818
  const initialPanelDimensions = {
827
819
  'tmSearchResult': { width: '25%', height: '100%' },
828
820
  'tmBlog': { width: '25%', height: '100%' },
829
821
  'tmSysMetadata': { width: '25%', height: '100%' },
830
- 'tmFullTextSearch': { width: '25%', height: '100%' },
831
822
  'tmDcmtPreview': { width: '25%', height: '100%' },
823
+ 'tmFullTextSearch': { width: '25%', height: '100%' },
832
824
  };
833
825
  const initialPanels = useMemo(() => [
834
826
  {
@@ -861,6 +853,12 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
861
853
  contentOptions: { component: tmSysMetadata, panelContainer: { title: SDKUI_Localizator.MetadataSystem, allowMaximize: !isMobile } },
862
854
  toolbarOptions: { icon: _jsx(IconDcmtTypeSys, { fontSize: 24 }), visible: getSearchToolbarVisibility(SDK_Globals.tmSession?.SessionDescr?.appModuleID ?? AppModules.SURFER).tmSysMetadata, orderNumber: 3, isActive: allInitialPanelVisibility['tmSysMetadata'] }
863
855
  },
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
+ },
864
862
  ...(context === SearchResultContext.FREE_SEARCH ? [
865
863
  {
866
864
  id: 'tmFullTextSearch',
@@ -868,13 +866,7 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
868
866
  contentOptions: { component: tmFullTextSearch, panelContainer: { title: SDKUI_Localizator.ResultDetails, allowMaximize: !isMobile } },
869
867
  toolbarOptions: { icon: _jsx(IconPlatform, { fontSize: 20 }), visible: getSearchToolbarVisibility(SDK_Globals.tmSession?.SessionDescr?.appModuleID ?? AppModules.SURFER).tmFullTextSearch, orderNumber: 5, isActive: allInitialPanelVisibility['tmFullTextSearch'] }
870
868
  }
871
- ] : []),
872
- {
873
- id: 'tmDcmtPreview',
874
- name: SDKUI_Localizator.PreviewDocument,
875
- contentOptions: { component: tmDcmtPreview },
876
- toolbarOptions: { icon: _jsx(IconShow, { fontSize: 24 }), visible: getSearchToolbarVisibility(SDK_Globals.tmSession?.SessionDescr?.appModuleID ?? AppModules.SURFER).tmDcmtPreview, orderNumber: 4, isActive: allInitialPanelVisibility['tmDcmtPreview'] }
877
- }
869
+ ] : [])
878
870
  ], [tmSearchResult, tmBlog, tmSysMetadata, tmDcmtPreview, tmFullTextSearch, showToolbarHeader, context, isMobile]);
879
871
  return (_jsxs(StyledMultiViewPanel, { "$isVisible": isVisible, children: [_jsx(StyledMultiViewPanel, { "$isVisible": !isOpenDcmtForm && !isOpenDetails && !isOpenMaster, style: {
880
872
  display: 'flex',
@@ -225,6 +225,9 @@ export const useRelatedDocuments = ({ selectedSearchResult, focusedItem, current
225
225
  const filterRelationsWithAssociations = (relations) => {
226
226
  return relations.filter(rel => rel.associations && rel.associations.length > 0);
227
227
  };
228
+ const getRelatedDcmt = async (relation, type) => {
229
+ return await DcmtTypeListCacheService.GetAsync(type === 'detail' ? relation.detailTID : relation.masterTID);
230
+ };
228
231
  const showNoRelationsAlert = (type) => {
229
232
  ShowAlert({
230
233
  message: type === 'detail'
@@ -279,26 +282,6 @@ export const useRelatedDocuments = ({ selectedSearchResult, focusedItem, current
279
282
  TMExceptionBoxManager.show({ exception: error });
280
283
  }
281
284
  }, [mapAssociationsToMids]);
282
- const filterRelationsByPermission = async (relations, type) => {
283
- const dataSourcePromises = relations.map(async (rel) => {
284
- const targetTID = type === 'detail' ? rel.detailTID : rel.masterTID;
285
- const dtd = await DcmtTypeListCacheService.GetWithNotGrantedAsync(targetTID, undefined);
286
- const hasPermission = dtd?.perm?.canArchive === AccessLevelsEx.Yes || dtd?.perm?.canArchive === AccessLevelsEx.Mixed;
287
- return { id: rel?.id, name: dtd?.name, hasPermission, relation: rel };
288
- });
289
- const allResults = await Promise.all(dataSourcePromises);
290
- return allResults.filter(r => r.hasPermission);
291
- };
292
- const showNoPermissionAlert = (type) => {
293
- ShowAlert({
294
- message: type === 'detail'
295
- ? SDKUI_Localizator.YouDoNotHavePermissionsToArchiveDetailDocumentsOfThisType
296
- : SDKUI_Localizator.YouDoNotHavePermissionsToArchiveMasterDocumentsOfThisType,
297
- mode: 'warning',
298
- title: type === 'detail' ? SDKUI_Localizator.DcmtsDetail : SDKUI_Localizator.DcmtsMaster,
299
- duration: 5000
300
- });
301
- };
302
285
  const archiveRelatedDocuments = useCallback(async (tid, type) => {
303
286
  try {
304
287
  TMSpinner.show({ description: SDKUI_Localizator.Loading });
@@ -317,20 +300,14 @@ export const useRelatedDocuments = ({ selectedSearchResult, focusedItem, current
317
300
  }
318
301
  setRelatedDcmts(withAssociations);
319
302
  if (withAssociations.length > 1) {
320
- const permittedResults = await filterRelationsByPermission(withAssociations, type);
321
- if (permittedResults.length === 0) {
322
- showNoPermissionAlert(type);
323
- return;
324
- }
325
- if (permittedResults.length === 1) {
326
- await archiveRelatedDcmtHandler(permittedResults[0].relation, type);
327
- }
328
- else {
329
- const dataSource = permittedResults.map(r => ({ id: r.id, name: r.name }));
330
- setRelatedDcmtsChooserDataSource(dataSource);
331
- setArchiveType(type);
332
- setShowRelatedDcmtsChooser(true);
333
- }
303
+ const dataSourcePromises = withAssociations.map(async (rel) => {
304
+ const relatedDcmt = await getRelatedDcmt(rel, type);
305
+ return { id: rel?.id, name: relatedDcmt?.name };
306
+ });
307
+ const dataSource = await Promise.all(dataSourcePromises);
308
+ setRelatedDcmtsChooserDataSource(dataSource);
309
+ setArchiveType(type);
310
+ setShowRelatedDcmtsChooser(true);
334
311
  }
335
312
  else {
336
313
  await archiveRelatedDcmtHandler(withAssociations[0], type);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react",
3
- "version": "6.20.0-dev2.12",
3
+ "version": "6.20.0-dev2.14",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",