@topconsultnpm/sdkui-react 6.20.0-dev2.1 → 6.20.0-dev2.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/choosers/TMDynDataListItemChooser.js +11 -6
- package/lib/components/editors/TMMetadataValues.js +3 -1
- package/lib/components/features/documents/TMDcmtForm.js +20 -15
- package/lib/components/features/documents/TMDcmtPreview.js +66 -13
- package/lib/components/features/search/TMSearchResult.js +72 -39
- package/lib/components/layout/panelManager/TMPanelManagerContainer.js +3 -2
- package/lib/helper/TMUtils.d.ts +18 -0
- package/lib/helper/TMUtils.js +58 -0
- package/lib/ts/types.d.ts +3 -0
- package/package.json +11 -11
|
@@ -9,6 +9,7 @@ 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';
|
|
12
13
|
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 }) => {
|
|
13
14
|
const [showChooser, setShowChooser] = useState(false);
|
|
14
15
|
const [dynDl, setDynDl] = useState();
|
|
@@ -30,7 +31,9 @@ const TMDynDataListItemChooser = ({ tid, md, width = '100%', titleForm, openChoo
|
|
|
30
31
|
setDynDl(d);
|
|
31
32
|
if (!IsParametricQuery(d?.qd) && !dataSource) {
|
|
32
33
|
setDataSource(undefined);
|
|
33
|
-
loadData()
|
|
34
|
+
loadData()
|
|
35
|
+
.then((result) => { setDataSource(result); })
|
|
36
|
+
.catch((err) => { TMExceptionBoxManager.show({ exception: err }); });
|
|
34
37
|
}
|
|
35
38
|
}, [md]);
|
|
36
39
|
useEffect(() => {
|
|
@@ -42,12 +45,13 @@ const TMDynDataListItemChooser = ({ tid, md, width = '100%', titleForm, openChoo
|
|
|
42
45
|
setDataSource(undefined);
|
|
43
46
|
return;
|
|
44
47
|
}
|
|
45
|
-
loadData()
|
|
46
|
-
setDataSource(result);
|
|
47
|
-
|
|
48
|
+
loadData()
|
|
49
|
+
.then((result) => { setDataSource(result); })
|
|
50
|
+
.catch((err) => { TMExceptionBoxManager.show({ exception: err }); });
|
|
48
51
|
}, [queryParamsDynDataList, dynDl]);
|
|
49
52
|
const loadData = async () => {
|
|
50
|
-
return await SDK_Globals.tmSession?.NewSearchEngine().GetDynDataListValuesAsync(tid, md?.id, layoutMode, queryParamsDynDataList ?? [])
|
|
53
|
+
return await SDK_Globals.tmSession?.NewSearchEngine().GetDynDataListValuesAsync(tid, md?.id, layoutMode, queryParamsDynDataList ?? [])
|
|
54
|
+
.catch((err) => { throw err; });
|
|
51
55
|
};
|
|
52
56
|
const getDescription = () => {
|
|
53
57
|
if (!Array.isArray(values))
|
|
@@ -152,7 +156,8 @@ export const TMDynDataListItemChooserForm = (props) => {
|
|
|
152
156
|
if (refreshCache)
|
|
153
157
|
DataListCacheService.RemoveAll();
|
|
154
158
|
TMSpinner.show({ description: `${SDKUI_Localizator.Loading} - ${SDK_Localizator.DataList} ...` });
|
|
155
|
-
let result = await SDK_Globals.tmSession?.NewSearchEngine().GetDynDataListValuesAsync(props.TID, props.MID, props.layoutMode, [])
|
|
159
|
+
let result = await SDK_Globals.tmSession?.NewSearchEngine().GetDynDataListValuesAsync(props.TID, props.MID, props.layoutMode, [])
|
|
160
|
+
.catch((err) => { TMSpinner.hide(); TMExceptionBoxManager.show({ exception: err }); });
|
|
156
161
|
TMSpinner.hide();
|
|
157
162
|
return result ? searchResultDescriptorToSimpleArray(result) ?? [] : [];
|
|
158
163
|
};
|
|
@@ -14,6 +14,7 @@ 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";
|
|
17
18
|
export var ShowCheckBoxesMode;
|
|
18
19
|
(function (ShowCheckBoxesMode) {
|
|
19
20
|
ShowCheckBoxesMode[ShowCheckBoxesMode["Never"] = 0] = "Never";
|
|
@@ -165,7 +166,8 @@ const TMMetadataValues = ({ showCheckBoxes = ShowCheckBoxesMode.Never, checkPerm
|
|
|
165
166
|
if (!d)
|
|
166
167
|
return;
|
|
167
168
|
let toBeRefreshed = [];
|
|
168
|
-
let dynDlDataSource = await SDK_Globals.tmSession?.NewSearchEngine().GetDynDataListValuesAsync(tid, mid, layoutMode, qParams)
|
|
169
|
+
let dynDlDataSource = await SDK_Globals.tmSession?.NewSearchEngine().GetDynDataListValuesAsync(tid, mid, layoutMode, qParams)
|
|
170
|
+
.catch((err) => { TMExceptionBoxManager.show({ exception: err }); });
|
|
169
171
|
if (!d.onValueChanged_DynDataListsToBeRefreshed)
|
|
170
172
|
return;
|
|
171
173
|
let row = dynDlDataSource?.dtdResult?.rows?.filter(o => o[d.selectItemForValue ?? 0] == value);
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import TMDcmtPreview from './TMDcmtPreview';
|
|
4
|
-
import { AccessLevels, ArchiveConstraints, ArchiveEngineByID, DcmtTypeListCacheService, LayoutCacheService, LayoutModes, MetadataDataTypes, ObjectClasses, ResultTypes, SDK_Globals, SDK_Localizator, SystemMIDsAsNumber, SystemTIDs, Task_States, TID_DID, UpdateEngineByID, UserListCacheService, ValidationItem, WorkflowCacheService, WorkItemMetadataNames } from '@topconsultnpm/sdk-ts';
|
|
4
|
+
import { AccessLevels, AppModules, ArchiveConstraints, ArchiveEngineByID, DcmtTypeListCacheService, LayoutCacheService, LayoutModes, MetadataDataTypes, ObjectClasses, ResultTypes, SDK_Globals, SDK_Localizator, SystemMIDsAsNumber, SystemTIDs, Task_States, TID_DID, UpdateEngineByID, UserListCacheService, ValidationItem, WorkflowCacheService, WorkItemMetadataNames } from '@topconsultnpm/sdk-ts';
|
|
5
5
|
import { WorkFlowApproveRejectPopUp, WorkFlowMoreInfoPopUp, WorkFlowOperationButtons, WorkFlowReAssignPopUp } from '../workflow/TMWorkflowPopup';
|
|
6
6
|
import { DownloadTypes, FormModes, DcmtOperationTypes } from '../../../ts';
|
|
7
7
|
import { DeviceType, useDeviceType } from '../../base/TMDeviceProvider';
|
|
8
8
|
import { useDcmtOperations } from '../../../hooks/useDcmtOperations';
|
|
9
9
|
import { useRelatedDocuments } from '../../../hooks/useRelatedDocuments';
|
|
10
10
|
import { getWorkItemSetIDAsync, handleArchiveVisibility, searchResultToMetadataValues } from '../../../helper/queryHelper';
|
|
11
|
-
import { genUniqueId, IconShow, SDKUI_Localizator, updateMruTids, IconBoard, IconDcmtTypeSys, IconDetailDcmts, IconDownload, calcIsModified, IconMenuVertical, Globalization, getListMaxItems, getSystemMetadata, IconBoxArchiveIn, IconClear, IconUndo, SDKUI_Globals, IconPreview, isTaskMoreInfo, IconWorkflow, IconSearch, deepCompare, IconCheck, IconActivity, TMImageLibrary, IconStar, IconRelation, IconInfo, IconArchiveDoc, IconDelete, IconPair, IconUnpair, IconArchiveMaster, IconArchiveDetail, getExceptionMessage, isApprovalWorkflowView, getDcmtCicoStatus, IconFileDots, IconCustom, buildWorkItemsFromWFCtrl, IconLock } from '../../../helper';
|
|
11
|
+
import { genUniqueId, IconShow, SDKUI_Localizator, updateMruTids, IconBoard, IconDcmtTypeSys, IconDetailDcmts, IconDownload, calcIsModified, IconMenuVertical, Globalization, getListMaxItems, getSystemMetadata, IconBoxArchiveIn, IconClear, IconUndo, SDKUI_Globals, IconPreview, isTaskMoreInfo, IconWorkflow, IconSearch, deepCompare, IconCheck, IconActivity, TMImageLibrary, IconStar, IconRelation, IconInfo, IconArchiveDoc, IconDelete, IconPair, IconUnpair, IconArchiveMaster, IconArchiveDetail, getExceptionMessage, isApprovalWorkflowView, getDcmtCicoStatus, IconFileDots, IconCustom, buildWorkItemsFromWFCtrl, IconLock, getDcmtFormToolbarVisibility } from '../../../helper';
|
|
12
12
|
import { hasDetailRelations, hasMasterRelations, isXMLFileExt } from '../../../helper/dcmtsHelper';
|
|
13
13
|
import { Gutters, TMColors } from '../../../utils/theme';
|
|
14
14
|
import { StyledFormButtonsContainer, StyledLoadingContainer, StyledModalContainer, StyledReferenceButton, StyledSpinner, StyledToolbarCardContainer } from '../../base/Styled';
|
|
@@ -123,6 +123,10 @@ 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]);
|
|
126
130
|
const triggerBlogRefresh = useCallback(async () => {
|
|
127
131
|
setRefreshBlogTrigger(prev => prev + 1);
|
|
128
132
|
}, []);
|
|
@@ -194,7 +198,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
194
198
|
let dtd = res?.dtdResult;
|
|
195
199
|
let rows = dtd.rows ? dtd.rows[0] : [];
|
|
196
200
|
let mids = res?.selectMIDs;
|
|
197
|
-
let metadataList = searchResultToMetadataValues(TID, dtd, rows, mids, mdList, layoutMode, origin.fromTID
|
|
201
|
+
let metadataList = searchResultToMetadataValues(TID, dtd, rows, mids, mdList, layoutMode, isReadOnlyOriginCallback(origin.fromTID));
|
|
198
202
|
if (archived) {
|
|
199
203
|
// Usa setFormData con funzione callback per accedere allo stato precedente
|
|
200
204
|
// invece di dipendere da formDataOrig nell'array di dipendenze
|
|
@@ -282,7 +286,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
282
286
|
}
|
|
283
287
|
else {
|
|
284
288
|
const renderedMetadata = dtd?.metadata?.filter((metadata) => handleArchiveVisibility(metadata)) ?? [];
|
|
285
|
-
const metadataList = searchResultToMetadataValues(dtd?.id, undefined, [], [], renderedMetadata, layoutMode, metadataDcmtOrigin?.fromTID
|
|
289
|
+
const metadataList = searchResultToMetadataValues(dtd?.id, undefined, [], [], renderedMetadata, layoutMode, isReadOnlyOriginCallback(metadataDcmtOrigin?.fromTID));
|
|
286
290
|
setFormDataOrig(structuredClone(metadataList));
|
|
287
291
|
setFormData(structuredClone(metadataList));
|
|
288
292
|
formDataOrigRef.current = structuredClone(metadataList);
|
|
@@ -297,7 +301,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
297
301
|
setIsInitialLoading(false);
|
|
298
302
|
setIsNavigating(false);
|
|
299
303
|
}
|
|
300
|
-
}, [TID, DID, layoutMode, inputFile, setMetadataList, handleReset, allowButtonsRefs, metadataDcmtOrigin?.fromTID]);
|
|
304
|
+
}, [TID, DID, layoutMode, inputFile, setMetadataList, handleReset, allowButtonsRefs, isReadOnlyOriginCallback, metadataDcmtOrigin?.fromTID]);
|
|
301
305
|
const createChange = useCallback((mid, metadataType, modifiedValue) => {
|
|
302
306
|
return { mid, metadataType, modifiedValue };
|
|
303
307
|
}, []);
|
|
@@ -1216,7 +1220,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
1216
1220
|
}, [formData, fromDTD, isMobile]);
|
|
1217
1221
|
const tmDcmtForm = useMemo(() => {
|
|
1218
1222
|
return _jsxs(_Fragment, { children: [checkoutBadge && _jsx("div", { style: { padding: '10px', display: 'flex', justifyContent: 'center' }, children: checkoutBadge }), metadataValuesSource.length > 0 &&
|
|
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
|
|
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) => {
|
|
1220
1224
|
setFormData((prevItems) => prevItems.map((item) => {
|
|
1221
1225
|
const newItem = newItems.find((newItem) => newItem.tid === item.tid && newItem.mid === item.mid);
|
|
1222
1226
|
return newItem ? { ...item, ...newItem } : item;
|
|
@@ -1262,7 +1266,8 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
1262
1266
|
handleConfirmAction,
|
|
1263
1267
|
handleUndo,
|
|
1264
1268
|
handleClearForm,
|
|
1265
|
-
|
|
1269
|
+
isReadOnlyOriginCallback,
|
|
1270
|
+
metadataDcmtOrigin?.fromTID,
|
|
1266
1271
|
]);
|
|
1267
1272
|
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]);
|
|
1268
1273
|
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]);
|
|
@@ -1384,7 +1389,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
1384
1389
|
const { assignedToMe, assignedByMe } = getDcmtTasksCounter(TID, DID, allTasks);
|
|
1385
1390
|
let titleDcmtFormPanel = fromDTD?.nameLoc ?? "";
|
|
1386
1391
|
// Caso: Il documento proviene da un'origine esterna
|
|
1387
|
-
if (metadataDcmtOrigin?.fromTID
|
|
1392
|
+
if (isReadOnlyOriginCallback(metadataDcmtOrigin?.fromTID)) {
|
|
1388
1393
|
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] }));
|
|
1389
1394
|
}
|
|
1390
1395
|
const panels = [
|
|
@@ -1405,7 +1410,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
1405
1410
|
},
|
|
1406
1411
|
toolbarOptions: {
|
|
1407
1412
|
icon: _jsx(IconPreview, { fontSize: 24 }),
|
|
1408
|
-
visible:
|
|
1413
|
+
visible: getDcmtFormToolbarVisibility(SDK_Globals.tmSession?.SessionDescr?.appModuleID ?? AppModules.SURFER).tmDcmtForm,
|
|
1409
1414
|
orderNumber: 1,
|
|
1410
1415
|
isActive: allInitialPanelVisibility['tmDcmtForm']
|
|
1411
1416
|
}
|
|
@@ -1416,7 +1421,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
1416
1421
|
contentOptions: { component: tmBlog, panelContainer: { title: SDKUI_Localizator.BlogCase, allowMaximize: !isMobile } },
|
|
1417
1422
|
toolbarOptions: {
|
|
1418
1423
|
icon: _jsx(IconBoard, { fontSize: 24 }),
|
|
1419
|
-
visible:
|
|
1424
|
+
visible: getDcmtFormToolbarVisibility(SDK_Globals.tmSession?.SessionDescr?.appModuleID ?? AppModules.SURFER).tmBlog,
|
|
1420
1425
|
disabled: isBoardDisabled,
|
|
1421
1426
|
orderNumber: 2,
|
|
1422
1427
|
isActive: allInitialPanelVisibility['tmBlog']
|
|
@@ -1426,13 +1431,13 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
1426
1431
|
id: 'tmSysMetadata',
|
|
1427
1432
|
name: SDKUI_Localizator.MetadataSystem,
|
|
1428
1433
|
contentOptions: { component: tmSysMetadata, panelContainer: { title: SDKUI_Localizator.MetadataSystem, allowMaximize: !isMobile } },
|
|
1429
|
-
toolbarOptions: { icon: _jsx(IconDcmtTypeSys, { fontSize: 24 }), visible:
|
|
1434
|
+
toolbarOptions: { icon: _jsx(IconDcmtTypeSys, { fontSize: 24 }), visible: getDcmtFormToolbarVisibility(SDK_Globals.tmSession?.SessionDescr?.appModuleID ?? AppModules.SURFER).tmSysMetadata, disabled: isSysMetadataDisabled, orderNumber: 3, isActive: allInitialPanelVisibility['tmSysMetadata'] }
|
|
1430
1435
|
},
|
|
1431
1436
|
{
|
|
1432
1437
|
id: 'tmDcmtPreview',
|
|
1433
1438
|
name: SDKUI_Localizator.PreviewDocument,
|
|
1434
1439
|
contentOptions: { component: tmDcmtPreview },
|
|
1435
|
-
toolbarOptions: { icon: _jsx(IconShow, { fontSize: 24 }), disabled: isPreviewDisabled, visible:
|
|
1440
|
+
toolbarOptions: { icon: _jsx(IconShow, { fontSize: 24 }), disabled: isPreviewDisabled, visible: getDcmtFormToolbarVisibility(SDK_Globals.tmSession?.SessionDescr?.appModuleID ?? AppModules.SURFER).tmDcmtPreview, orderNumber: 4, isActive: allInitialPanelVisibility['tmDcmtPreview'] }
|
|
1436
1441
|
},
|
|
1437
1442
|
{
|
|
1438
1443
|
id: 'tmWF',
|
|
@@ -1445,7 +1450,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
1445
1450
|
},
|
|
1446
1451
|
toolbarOptions: {
|
|
1447
1452
|
icon: _jsx(IconWorkflow, { fontSize: 24 }),
|
|
1448
|
-
visible:
|
|
1453
|
+
visible: getDcmtFormToolbarVisibility(SDK_Globals.tmSession?.SessionDescr?.appModuleID ?? AppModules.SURFER).tmWF,
|
|
1449
1454
|
disabled: isWFDisabled,
|
|
1450
1455
|
orderNumber: 5,
|
|
1451
1456
|
isActive: allInitialPanelVisibility['tmWF']
|
|
@@ -1459,7 +1464,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
1459
1464
|
},
|
|
1460
1465
|
toolbarOptions: {
|
|
1461
1466
|
icon: _jsx(IconActivity, { fontSize: 24 }),
|
|
1462
|
-
visible: layoutMode !== LayoutModes.Ark,
|
|
1467
|
+
visible: layoutMode !== LayoutModes.Ark && getDcmtFormToolbarVisibility(SDK_Globals.tmSession?.SessionDescr?.appModuleID ?? AppModules.SURFER).tmDcmtTasks,
|
|
1463
1468
|
orderNumber: 6,
|
|
1464
1469
|
isActive: allInitialPanelVisibility['tmDcmtTasks'],
|
|
1465
1470
|
count: assignedToMe + assignedByMe,
|
|
@@ -1468,7 +1473,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
1468
1473
|
},
|
|
1469
1474
|
];
|
|
1470
1475
|
return panels;
|
|
1471
|
-
}, [fromDTD, showBackButton, tmDcmtForm, tmBlog, tmSysMetadata, tmDcmtPreview, tmWF, tmDcmtTasks, isPreviewDisabled, isSysMetadataDisabled, isBoardDisabled, isWFDisabled, inputFile, isClosable, allTasks, DID, TID, metadataDcmtOrigin?.fromTID]);
|
|
1476
|
+
}, [fromDTD, showBackButton, tmDcmtForm, tmBlog, tmSysMetadata, tmDcmtPreview, tmWF, tmDcmtTasks, isPreviewDisabled, isSysMetadataDisabled, isBoardDisabled, isWFDisabled, inputFile, isClosable, allTasks, DID, TID, isReadOnlyOriginCallback, metadataDcmtOrigin?.fromTID]);
|
|
1472
1477
|
// Retrieves the current document form setting based on the normalized TID
|
|
1473
1478
|
const getCurrentDcmtFormSetting = () => {
|
|
1474
1479
|
const settings = SDKUI_Globals.userSettings.dcmtFormSettings;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
|
-
import { RetrieveFileOptions, DcmtOpers, GeneralRetrieveFormats, FileFormats } from '@topconsultnpm/sdk-ts';
|
|
5
|
-
import { extensionHandler, sleep, getExceptionMessage, formatBytes, IconMenuVertical, IconCloseCircle, IconClear, IconCloseOutline, IconPreview, SDKUI_Globals, IconZoomOutLinear, IconZoomInLinear, IconPrintOutline, SDKUI_Localizator, IconRefresh, IconCache } from '../../../helper';
|
|
4
|
+
import { RetrieveFileOptions, DcmtOpers, GeneralRetrieveFormats, FileFormats, SDK_Globals } from '@topconsultnpm/sdk-ts';
|
|
5
|
+
import { extensionHandler, sleep, getExceptionMessage, formatBytes, IconMenuVertical, IconCloseCircle, IconClear, IconCloseOutline, IconPreview, SDKUI_Globals, IconZoomOutLinear, IconZoomInLinear, IconPrintOutline, SDKUI_Localizator, IconRefresh, IconCache, dcmtsFileCachePreview, CACHE_SIZE_LIMIT } from '../../../helper';
|
|
6
6
|
import { useDcmtOperations } from '../../../hooks/useDcmtOperations';
|
|
7
7
|
import { FileExtensionHandler, FormModes } from '../../../ts';
|
|
8
8
|
import { TMColors } from '../../../utils/theme';
|
|
@@ -29,7 +29,15 @@ const TMDcmtPreview = ({ dcmtData, isResizingActive, isVisible, canNext, canPrev
|
|
|
29
29
|
const [error, setError] = useState('');
|
|
30
30
|
const [isAbortError, setIsAbortError] = useState(false);
|
|
31
31
|
const { abortController, showWaitPanel, waitPanelTitle, showPrimary, waitPanelTextPrimary, waitPanelValuePrimary, waitPanelMaxValuePrimary, showSecondary, waitPanelTextSecondary, waitPanelValueSecondary, waitPanelMaxValueSecondary, getDcmtFileAsync, clearDcmtsFileCache, removeDcmtsFileCache, isDcmtFileInCache } = useDcmtOperations();
|
|
32
|
-
const
|
|
32
|
+
const isBasketMode = !!(dcmtData?.btid !== undefined && dcmtData?.bid !== undefined && dcmtData?.bfid !== undefined);
|
|
33
|
+
const getCacheKey = () => {
|
|
34
|
+
if (!dcmtData)
|
|
35
|
+
return '00';
|
|
36
|
+
if (isBasketMode)
|
|
37
|
+
return `basket-${dcmtData.btid}-${dcmtData.bid}-${dcmtData.bfid}`;
|
|
38
|
+
return `${dcmtData.tid}-${dcmtData.did}`;
|
|
39
|
+
};
|
|
40
|
+
const cacheKey = getCacheKey();
|
|
33
41
|
const [hasLoadedDataOnce, setHasLoadedDataOnce] = useState(false);
|
|
34
42
|
const [lastLoadedDid, setLastLoadedDid] = useState(undefined);
|
|
35
43
|
useEffect(() => {
|
|
@@ -41,10 +49,10 @@ const TMDcmtPreview = ({ dcmtData, isResizingActive, isVisible, canNext, canPrev
|
|
|
41
49
|
setShowPreview(false);
|
|
42
50
|
return;
|
|
43
51
|
}
|
|
44
|
-
const currentCacheKey = `${dcmtData.tid}-${dcmtData.did}`;
|
|
52
|
+
const currentCacheKey = isBasketMode ? `basket-${dcmtData.btid}-${dcmtData.bid}-${dcmtData.bfid}` : `${dcmtData.tid}-${dcmtData.did}`;
|
|
45
53
|
const shouldFetch = isVisible && (!hasLoadedDataOnce || currentCacheKey !== lastLoadedDid);
|
|
46
54
|
if (isDcmtFileInCache(currentCacheKey)) {
|
|
47
|
-
loadDocumentWithCache();
|
|
55
|
+
isBasketMode ? loadBasketFile() : loadDocumentWithCache();
|
|
48
56
|
setShowPreview(true);
|
|
49
57
|
return;
|
|
50
58
|
}
|
|
@@ -52,7 +60,11 @@ const TMDcmtPreview = ({ dcmtData, isResizingActive, isVisible, canNext, canPrev
|
|
|
52
60
|
setDcmtBlob(undefined);
|
|
53
61
|
setError('');
|
|
54
62
|
setIsAbortError(false);
|
|
55
|
-
if (
|
|
63
|
+
if (isBasketMode) {
|
|
64
|
+
loadBasketFile();
|
|
65
|
+
setShowPreview(true);
|
|
66
|
+
}
|
|
67
|
+
else if ((extensionHandler(dcmtData.fileExt) !== FileExtensionHandler.NONE) && ((dcmtData.fileSize ?? 0) <= (SDKUI_Globals.userSettings.searchSettings.previewThreshold * 1024))) {
|
|
56
68
|
loadDocumentWithCache();
|
|
57
69
|
setShowPreview(true);
|
|
58
70
|
}
|
|
@@ -63,6 +75,47 @@ const TMDcmtPreview = ({ dcmtData, isResizingActive, isVisible, canNext, canPrev
|
|
|
63
75
|
setLastLoadedDid(currentCacheKey);
|
|
64
76
|
}
|
|
65
77
|
}, [dcmtData?.did, isVisible, hasLoadedDataOnce, lastLoadedDid]);
|
|
78
|
+
const loadBasketFile = async () => {
|
|
79
|
+
try {
|
|
80
|
+
// Check cache first
|
|
81
|
+
if (dcmtsFileCachePreview.has(cacheKey)) {
|
|
82
|
+
setDcmtBlob(dcmtsFileCachePreview.get(cacheKey));
|
|
83
|
+
setIsFromCache(true);
|
|
84
|
+
setError('');
|
|
85
|
+
setIsAbortError(false);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
await sleep(300);
|
|
89
|
+
const basketEngine = SDK_Globals.tmSession?.NewBasketEngine();
|
|
90
|
+
const cvtFormat = extensionHandler(dcmtData?.fileExt) === FileExtensionHandler.CONVERTIBLE ? FileFormats.PDF : FileFormats.None;
|
|
91
|
+
const file = await basketEngine?.RetrieveFileAsync(dcmtData?.btid, dcmtData?.bid, dcmtData?.bfid, cvtFormat, abortController.signal);
|
|
92
|
+
// Store in cache
|
|
93
|
+
if (file) {
|
|
94
|
+
if (dcmtsFileCachePreview.size >= CACHE_SIZE_LIMIT) {
|
|
95
|
+
const oldestKey = dcmtsFileCachePreview.keys().next().value;
|
|
96
|
+
dcmtsFileCachePreview.delete(oldestKey);
|
|
97
|
+
}
|
|
98
|
+
dcmtsFileCachePreview.set(cacheKey, file);
|
|
99
|
+
}
|
|
100
|
+
setDcmtBlob(file);
|
|
101
|
+
setIsFromCache(false);
|
|
102
|
+
setError('');
|
|
103
|
+
setIsAbortError(false);
|
|
104
|
+
}
|
|
105
|
+
catch (ex) {
|
|
106
|
+
const err = ex;
|
|
107
|
+
if (err.name === 'CanceledError') {
|
|
108
|
+
setError('Operazione annullata.');
|
|
109
|
+
setIsAbortError(true);
|
|
110
|
+
ShowAlert({ message: err.message, mode: 'warning', duration: 3000, title: 'Abort' });
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
setError(getExceptionMessage(ex));
|
|
114
|
+
setIsAbortError(false);
|
|
115
|
+
TMExceptionBoxManager.show({ exception: ex });
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
};
|
|
66
119
|
const loadDocumentWithCache = async () => {
|
|
67
120
|
const rfo = new RetrieveFileOptions();
|
|
68
121
|
rfo.retrieveReason = DcmtOpers.None;
|
|
@@ -94,7 +147,7 @@ const TMDcmtPreview = ({ dcmtData, isResizingActive, isVisible, canNext, canPrev
|
|
|
94
147
|
};
|
|
95
148
|
const titleHandler = () => {
|
|
96
149
|
let title = 'Anteprima ';
|
|
97
|
-
if (!dcmtData?.did)
|
|
150
|
+
if (!dcmtData?.did && !isBasketMode)
|
|
98
151
|
return title;
|
|
99
152
|
let extensionInfo;
|
|
100
153
|
if (dcmtData.fileExt !== null) {
|
|
@@ -120,7 +173,7 @@ const TMDcmtPreview = ({ dcmtData, isResizingActive, isVisible, canNext, canPrev
|
|
|
120
173
|
setIsAbortError(false);
|
|
121
174
|
setDcmtBlob(undefined);
|
|
122
175
|
try {
|
|
123
|
-
await loadDocumentWithCache();
|
|
176
|
+
isBasketMode ? await loadBasketFile() : await loadDocumentWithCache();
|
|
124
177
|
}
|
|
125
178
|
catch (error) {
|
|
126
179
|
console.error('Error reopening document:', error);
|
|
@@ -132,7 +185,7 @@ const TMDcmtPreview = ({ dcmtData, isResizingActive, isVisible, canNext, canPrev
|
|
|
132
185
|
], [cacheKey, removeDcmtsFileCache, clearDcmtsFileCache, setIsFromCache]);
|
|
133
186
|
return (_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(TMPanel, { padding: '0', title: titleHandler(), onClose: onClosePanel, allowMaximize: allowMaximize, onMaximize: onMaximizePanel, onHeaderDoubleClick: onMaximizePanel, toolbar: _jsxs("div", { style: { width: 'max-content', display: 'flex', alignItems: 'center', gap: '10px' }, children: [onPrev && _jsx(TMSaveFormButtonPrevious, { btnStyle: 'icon', isModified: false, formMode: FormModes.ReadOnly, canPrev: canPrev, onPrev: onPrev }), onNext && _jsx(TMSaveFormButtonNext, { btnStyle: 'icon', isModified: false, formMode: FormModes.ReadOnly, canNext: canNext, onNext: onNext }), _jsx(StyledHeaderIcon, { "$color": TMColors.primaryColor, children: _jsx(ContextMenu, { items: cacheMenuItems, trigger: "left", children: _jsx(IconMenuVertical, {}) }) }), _jsx(StyledHeaderIcon, { onClick: reOpenDcmt, "$color": TMColors.primaryColor, children: _jsx(TMTooltip, { content: SDKUI_Localizator.ReopenDocument, children: _jsx(IconRefresh, {}) }) })] }), children: error
|
|
134
187
|
? _jsx(ErrorContent, { error: error, isAbortError: isAbortError, onRetry: reOpenDcmt })
|
|
135
|
-
: renderedPreview(dcmtData?.tid, dcmtData?.did, dcmtData?.fileExt, dcmtData?.fileSize, dcmtData?.fileCount, extensionHandler(dcmtData?.fileExt), showPreview, isResizingActive, () => { loadDocumentWithCache(); setShowPreview(true); }, dcmtBlob) }) }));
|
|
188
|
+
: renderedPreview(dcmtData?.tid, dcmtData?.did, dcmtData?.fileExt, dcmtData?.fileSize, dcmtData?.fileCount, extensionHandler(dcmtData?.fileExt), showPreview, isResizingActive, () => { isBasketMode ? loadBasketFile() : loadDocumentWithCache(); setShowPreview(true); }, dcmtBlob, isBasketMode) }) }));
|
|
136
189
|
};
|
|
137
190
|
export default TMDcmtPreview;
|
|
138
191
|
export const TMFileViewer = ({ fileBlob, isResizingActive }) => {
|
|
@@ -382,13 +435,13 @@ const ImageViewer = ({ fileBlob, alt = 'Image', className }) => {
|
|
|
382
435
|
export const TMNothingToShow = ({ text = '', secondText, fileExt, icon = _jsx(IconPreview, { fontSize: 96 }) }) => {
|
|
383
436
|
return (_jsx(StyledAnimatedComponentOpacity, { style: { width: '100%', height: '100%' }, children: _jsxs(StyledPanelStatusContainer, { children: [icon, _jsxs(StyledPreviewNotAvailable, { children: [text && _jsx("div", { children: text }), _jsxs("div", { children: [" ", secondText ?? SDKUI_Localizator.PreviewNotAvailable, fileExt && _jsx("b", { children: ` (*.${fileExt})` })] })] })] }) }));
|
|
384
437
|
};
|
|
385
|
-
const renderedPreview = (tid, did, fileExt, fileSize, fileCount, extHandler, showPreview, isResizingActive, onDownloadShowPreviewClick, dcmtBlob) => {
|
|
386
|
-
if (!did)
|
|
438
|
+
const renderedPreview = (tid, did, fileExt, fileSize, fileCount, extHandler, showPreview, isResizingActive, onDownloadShowPreviewClick, dcmtBlob, isBasketMode) => {
|
|
439
|
+
if (!isBasketMode && !did)
|
|
387
440
|
return _jsx(TMNothingToShow, { text: `${SDKUI_Localizator.NoDcmtSelected}.` });
|
|
388
|
-
if (fileCount == 0) {
|
|
441
|
+
if (!isBasketMode && fileCount == 0) {
|
|
389
442
|
return _jsx(TMNothingToShow, { text: SDKUI_Localizator.MetadataOnlyDocument });
|
|
390
443
|
}
|
|
391
|
-
if (fileExt && extHandler === FileExtensionHandler.NONE) {
|
|
444
|
+
if (!isBasketMode && fileExt && extHandler === FileExtensionHandler.NONE) {
|
|
392
445
|
return _jsx(TMNothingToShow, { fileExt: fileExt });
|
|
393
446
|
}
|
|
394
447
|
if (showPreview) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
|
-
import { SDK_Globals, DataColumnTypes, MetadataDataDomains, DataListViewModes, MetadataFormats, LayoutModes, DcmtTypeListCacheService, SystemMIDsAsNumber, RetrieveFileOptions, DcmtOpers, GeneralRetrieveFormats, AccessLevelsEx, LayoutCacheService, UserListCacheService } from '@topconsultnpm/sdk-ts';
|
|
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,
|
|
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';
|
|
7
7
|
import { useDcmtOperations } from '../../../hooks/useDcmtOperations';
|
|
8
8
|
import { useInputAttachmentsDialog, useInputCvtFormatDialog } from '../../../hooks/useInputDialog';
|
|
9
9
|
import { useRelatedDocuments } from '../../../hooks/useRelatedDocuments';
|
|
@@ -736,23 +736,58 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
|
|
|
736
736
|
const tmBlog = useMemo(() => _jsx(TMDcmtBlog, { tid: focusedItem?.TID, did: focusedItem?.DID, fetchBlogDataTrigger: refreshBlogTrigger, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }), [focusedItem, allTasks, refreshBlogTrigger, handleNavigateToWGs, handleNavigateToDossiers]);
|
|
737
737
|
const tmSysMetadata = useMemo(() => _jsx(TMMetadataValues, { layoutMode: LayoutModes.Update, openChooserBySingleClick: true, TID: focusedItem?.TID, isReadOnly: true, deviceType: deviceType, metadataValues: currentMetadataValues.filter(o => (o.mid != undefined && o.mid <= 100)), metadataValuesOrig: currentMetadataValues.filter(o => (o.mid != undefined && o.mid <= 100)), validationItems: [] }), [focusedItem, currentMetadataValues, deviceType]);
|
|
738
738
|
const tmDcmtPreview = useMemo(() => _jsx(TMDcmtPreviewWrapper, { currentDcmt: currentDcmt }, refreshPreviewTrigger), [currentDcmt, refreshPreviewTrigger]);
|
|
739
|
+
// Auto-fetch indexing info when drawer is open and focusedItem changes
|
|
740
|
+
useEffect(() => {
|
|
741
|
+
if (!focusedItem || !showIndexingInfo)
|
|
742
|
+
return;
|
|
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]);
|
|
739
761
|
const handleToggleIndexingInfo = async () => {
|
|
740
762
|
if (!focusedItem)
|
|
741
763
|
return;
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
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
|
+
}
|
|
780
|
+
}
|
|
745
781
|
}
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
782
|
+
};
|
|
783
|
+
const handleRefreshIndexingInfo = async () => {
|
|
784
|
+
if (!focusedItem)
|
|
749
785
|
return;
|
|
750
|
-
}
|
|
786
|
+
const cacheKey = `${focusedItem.TID}-${focusedItem.DID}`;
|
|
751
787
|
try {
|
|
752
788
|
setLoadingIndexingInfo(true);
|
|
753
789
|
const msg = await SDK_Globals.tmSession?.NewSearchEngine().FreeSearchGetDcmtInfoAsync(focusedItem.TID, focusedItem.DID);
|
|
754
790
|
setIndexingInfoCache(prev => new Map(prev).set(cacheKey, msg ?? ''));
|
|
755
|
-
setShowIndexingInfo(true);
|
|
756
791
|
}
|
|
757
792
|
catch (e) {
|
|
758
793
|
TMExceptionBoxManager.show({ exception: e });
|
|
@@ -765,8 +800,7 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
|
|
|
765
800
|
if (!focusedItem) {
|
|
766
801
|
return (_jsxs(StyledPlaceholder, { children: [" ", _jsx("p", { children: "Seleziona un documento per visualizzare i dettagli della ricerca full-text" }), " "] }));
|
|
767
802
|
}
|
|
768
|
-
|
|
769
|
-
const ftExplanationsColumnIndex = selectedSearchResult?.selectMIDs?.findIndex(mid => mid === 0); //nosonar
|
|
803
|
+
const ftExplanationsColumnIndex = selectedSearchResult?.dtdResult?.columns?.findIndex(col => col.caption === 'FTExplanations');
|
|
770
804
|
if (ftExplanationsColumnIndex === undefined || ftExplanationsColumnIndex < 0) {
|
|
771
805
|
return (_jsxs(StyledPlaceholder, { children: [" ", _jsx("p", { children: "Nessuna info full-text disponibile" }), " "] }));
|
|
772
806
|
}
|
|
@@ -780,21 +814,21 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
|
|
|
780
814
|
}
|
|
781
815
|
const cacheKey = `${focusedItem.TID}-${focusedItem.DID}`;
|
|
782
816
|
const cachedInfo = indexingInfoCache.get(cacheKey);
|
|
783
|
-
return (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', height: '100%', overflow: 'hidden' }, children: [_jsx("div", { style: { padding: '10px', overflow: 'auto', flex: 1 }, children: _jsx("div", { dangerouslySetInnerHTML: { __html: ftExplanation } }) }), _jsxs(StyledIndexingInfoSection, { children: [_jsxs(StyledIndexingToggle, { onClick: handleToggleIndexingInfo, disabled: loadingIndexingInfo, children: [_jsxs(StyledLeftContent, { children: [_jsx(
|
|
784
|
-
}, [selectedSearchResult, focusedItem, indexingInfoCache, showIndexingInfo, loadingIndexingInfo]);
|
|
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]);
|
|
785
819
|
const allInitialPanelVisibility = {
|
|
786
820
|
'tmSearchResult': true,
|
|
787
821
|
'tmBlog': false,
|
|
788
822
|
'tmSysMetadata': false,
|
|
823
|
+
'tmFullTextSearch': false,
|
|
789
824
|
'tmDcmtPreview': false,
|
|
790
|
-
// 'tmFullTextSearch': false,
|
|
791
825
|
};
|
|
792
826
|
const initialPanelDimensions = {
|
|
793
827
|
'tmSearchResult': { width: '25%', height: '100%' },
|
|
794
828
|
'tmBlog': { width: '25%', height: '100%' },
|
|
795
829
|
'tmSysMetadata': { width: '25%', height: '100%' },
|
|
830
|
+
'tmFullTextSearch': { width: '25%', height: '100%' },
|
|
796
831
|
'tmDcmtPreview': { width: '25%', height: '100%' },
|
|
797
|
-
// 'tmFullTextSearch': { width: '25%', height: '100%' },
|
|
798
832
|
};
|
|
799
833
|
const initialPanels = useMemo(() => [
|
|
800
834
|
{
|
|
@@ -813,34 +847,34 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
|
|
|
813
847
|
toolbar: searchResutlToolbar
|
|
814
848
|
},
|
|
815
849
|
},
|
|
816
|
-
toolbarOptions: { icon: _jsx(IconSearchCheck, { fontSize: 24 }), visible:
|
|
850
|
+
toolbarOptions: { icon: _jsx(IconSearchCheck, { fontSize: 24 }), visible: getSearchToolbarVisibility(SDK_Globals.tmSession?.SessionDescr?.appModuleID ?? AppModules.SURFER).tmSearchResult, orderNumber: 1, isActive: allInitialPanelVisibility['tmSearchResult'] }
|
|
817
851
|
},
|
|
818
852
|
{
|
|
819
853
|
id: 'tmBlog',
|
|
820
854
|
name: SDKUI_Localizator.BlogCase,
|
|
821
855
|
contentOptions: { component: tmBlog, panelContainer: { title: SDKUI_Localizator.BlogCase, allowMaximize: !isMobile } },
|
|
822
|
-
toolbarOptions: { icon: _jsx(IconBoard, { fontSize: 24 }), visible:
|
|
856
|
+
toolbarOptions: { icon: _jsx(IconBoard, { fontSize: 24 }), visible: getSearchToolbarVisibility(SDK_Globals.tmSession?.SessionDescr?.appModuleID ?? AppModules.SURFER).tmBlog, orderNumber: 2, isActive: allInitialPanelVisibility['tmBlog'] }
|
|
823
857
|
},
|
|
824
858
|
{
|
|
825
859
|
id: 'tmSysMetadata',
|
|
826
860
|
name: SDKUI_Localizator.MetadataSystem,
|
|
827
861
|
contentOptions: { component: tmSysMetadata, panelContainer: { title: SDKUI_Localizator.MetadataSystem, allowMaximize: !isMobile } },
|
|
828
|
-
toolbarOptions: { icon: _jsx(IconDcmtTypeSys, { fontSize: 24 }), visible:
|
|
862
|
+
toolbarOptions: { icon: _jsx(IconDcmtTypeSys, { fontSize: 24 }), visible: getSearchToolbarVisibility(SDK_Globals.tmSession?.SessionDescr?.appModuleID ?? AppModules.SURFER).tmSysMetadata, orderNumber: 3, isActive: allInitialPanelVisibility['tmSysMetadata'] }
|
|
829
863
|
},
|
|
864
|
+
...(context === SearchResultContext.FREE_SEARCH ? [
|
|
865
|
+
{
|
|
866
|
+
id: 'tmFullTextSearch',
|
|
867
|
+
name: SDKUI_Localizator.ResultDetails,
|
|
868
|
+
contentOptions: { component: tmFullTextSearch, panelContainer: { title: SDKUI_Localizator.ResultDetails, allowMaximize: !isMobile } },
|
|
869
|
+
toolbarOptions: { icon: _jsx(IconPlatform, { fontSize: 20 }), visible: getSearchToolbarVisibility(SDK_Globals.tmSession?.SessionDescr?.appModuleID ?? AppModules.SURFER).tmFullTextSearch, orderNumber: 5, isActive: allInitialPanelVisibility['tmFullTextSearch'] }
|
|
870
|
+
}
|
|
871
|
+
] : []),
|
|
830
872
|
{
|
|
831
873
|
id: 'tmDcmtPreview',
|
|
832
874
|
name: SDKUI_Localizator.PreviewDocument,
|
|
833
875
|
contentOptions: { component: tmDcmtPreview },
|
|
834
|
-
toolbarOptions: { icon: _jsx(IconShow, { fontSize: 24 }), visible:
|
|
835
|
-
}
|
|
836
|
-
// ...(context === SearchResultContext.FREE_SEARCH ? [
|
|
837
|
-
// {
|
|
838
|
-
// id: 'tmFullTextSearch',
|
|
839
|
-
// name: 'Ricerca FullText',
|
|
840
|
-
// contentOptions: { component: tmFullTextSearch, panelContainer: { title: 'Ricerca FullText', allowMaximize: !isMobile } },
|
|
841
|
-
// toolbarOptions: { icon: <IconMenuFullTextSearch fontSize={24} />, visible: true, orderNumber: 5, isActive: allInitialPanelVisibility['tmFullTextSearch'] }
|
|
842
|
-
// }
|
|
843
|
-
// ] : [])
|
|
876
|
+
toolbarOptions: { icon: _jsx(IconShow, { fontSize: 24 }), visible: getSearchToolbarVisibility(SDK_Globals.tmSession?.SessionDescr?.appModuleID ?? AppModules.SURFER).tmDcmtPreview, orderNumber: 4, isActive: allInitialPanelVisibility['tmDcmtPreview'] }
|
|
877
|
+
}
|
|
844
878
|
], [tmSearchResult, tmBlog, tmSysMetadata, tmDcmtPreview, tmFullTextSearch, showToolbarHeader, context, isMobile]);
|
|
845
879
|
return (_jsxs(StyledMultiViewPanel, { "$isVisible": isVisible, children: [_jsx(StyledMultiViewPanel, { "$isVisible": !isOpenDcmtForm && !isOpenDetails && !isOpenMaster, style: {
|
|
846
880
|
display: 'flex',
|
|
@@ -1386,11 +1420,6 @@ const StyledIndexingToggle = styled.button `
|
|
|
1386
1420
|
transform: translateY(1px);
|
|
1387
1421
|
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
|
|
1388
1422
|
}
|
|
1389
|
-
|
|
1390
|
-
svg {
|
|
1391
|
-
color: #2196F3;
|
|
1392
|
-
font-size: 18px;
|
|
1393
|
-
}
|
|
1394
1423
|
`;
|
|
1395
1424
|
const StyledLeftContent = styled.div `
|
|
1396
1425
|
display: flex;
|
|
@@ -1406,12 +1435,15 @@ const StyledCachedIcon = styled.div `
|
|
|
1406
1435
|
display: flex;
|
|
1407
1436
|
align-items: center;
|
|
1408
1437
|
justify-content: center;
|
|
1409
|
-
color: #4CAF50;
|
|
1410
1438
|
font-size: 16px;
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1439
|
+
`;
|
|
1440
|
+
const StyledRefreshIcon = styled.div `
|
|
1441
|
+
display: flex;
|
|
1442
|
+
align-items: center;
|
|
1443
|
+
justify-content: center;
|
|
1444
|
+
font-size: 16px;
|
|
1445
|
+
cursor: pointer;
|
|
1446
|
+
transition: transform 0.2s ease;
|
|
1415
1447
|
`;
|
|
1416
1448
|
const StyledChevron = styled.span `
|
|
1417
1449
|
transition: transform 0.2s ease;
|
|
@@ -1420,6 +1452,7 @@ const StyledChevron = styled.span `
|
|
|
1420
1452
|
font-size: 12px;
|
|
1421
1453
|
`;
|
|
1422
1454
|
const StyledIndexingInfoBox = styled.div `
|
|
1455
|
+
position: relative;
|
|
1423
1456
|
background: white;
|
|
1424
1457
|
border: 1px solid #e0e0e0;
|
|
1425
1458
|
border-radius: 6px;
|
|
@@ -4,9 +4,10 @@ import styled from 'styled-components';
|
|
|
4
4
|
import { useTMPanelManagerContext } from './TMPanelManagerContext';
|
|
5
5
|
import TMPanelWrapper from './TMPanelWrapper';
|
|
6
6
|
import TMPanelManagerToolbar from './TMPanelManagerToolbar';
|
|
7
|
-
import { IconInfo, SDKUI_Localizator } from '../../../helper';
|
|
7
|
+
import { getPanelManagerToolbarColor, IconInfo, SDKUI_Localizator } from '../../../helper';
|
|
8
8
|
import { DeviceType, useDeviceType } from '../../base/TMDeviceProvider';
|
|
9
9
|
import { Gutters } from '../../../utils/theme';
|
|
10
|
+
import { AppModules, SDK_Globals } from '@topconsultnpm/sdk-ts';
|
|
10
11
|
// Styled Component per il contenitore principale di PanelContainer
|
|
11
12
|
const StyledPanelContainerWrapper = styled.div `
|
|
12
13
|
display: ${props => (props.$hasVisiblePanels ? 'flex' : 'none')};
|
|
@@ -206,7 +207,7 @@ const TMPanelManagerContainer = (props) => {
|
|
|
206
207
|
alignItems: 'center',
|
|
207
208
|
width: isMobile ? '100%' : '50px',
|
|
208
209
|
height: isMobile ? '50px' : 'max-content',
|
|
209
|
-
background:
|
|
210
|
+
background: getPanelManagerToolbarColor(SDK_Globals.tmSession?.SessionDescr?.appModuleID ?? AppModules.SURFER),
|
|
210
211
|
borderRadius: isMobile ? '10px' : '10px 0px 0px 10px',
|
|
211
212
|
padding: '10px',
|
|
212
213
|
gap: '10px'
|
package/lib/helper/TMUtils.d.ts
CHANGED
|
@@ -67,4 +67,22 @@ export declare const parseSignatureConfiguration: (did: number, informationSign:
|
|
|
67
67
|
};
|
|
68
68
|
export declare const convertSearchResultDescriptorToFileItems: (documents: Array<SearchResultDescriptor>) => Array<FileItem>;
|
|
69
69
|
export declare const getAppModuleGradient: (appModuleID: AppModules) => string;
|
|
70
|
+
export declare const getPanelManagerToolbarColor: (appModuleID: AppModules) => string;
|
|
71
|
+
type SearchToolbarVisibility = {
|
|
72
|
+
tmSearchResult: boolean;
|
|
73
|
+
tmBlog: boolean;
|
|
74
|
+
tmSysMetadata: boolean;
|
|
75
|
+
tmDcmtPreview: boolean;
|
|
76
|
+
tmFullTextSearch: boolean;
|
|
77
|
+
};
|
|
78
|
+
export declare const getSearchToolbarVisibility: (appModuleID: AppModules) => SearchToolbarVisibility;
|
|
79
|
+
type DcmtFormToolbarVisibility = {
|
|
80
|
+
tmDcmtForm: boolean;
|
|
81
|
+
tmBlog: boolean;
|
|
82
|
+
tmSysMetadata: boolean;
|
|
83
|
+
tmDcmtPreview: boolean;
|
|
84
|
+
tmWF: boolean;
|
|
85
|
+
tmDcmtTasks: boolean;
|
|
86
|
+
};
|
|
87
|
+
export declare const getDcmtFormToolbarVisibility: (appModuleID: AppModules) => DcmtFormToolbarVisibility;
|
|
70
88
|
export {};
|
package/lib/helper/TMUtils.js
CHANGED
|
@@ -445,3 +445,61 @@ export const getAppModuleGradient = (appModuleID) => {
|
|
|
445
445
|
return 'linear-gradient(270deg, #46B5A2 16%, #3BAABC 34%, #3BAABC 34%, #3681AD 54%, #3368A5 72%, #2F549D 88%, #304F99 100%)';
|
|
446
446
|
}
|
|
447
447
|
};
|
|
448
|
+
export const getPanelManagerToolbarColor = (appModuleID) => {
|
|
449
|
+
switch (appModuleID) {
|
|
450
|
+
case AppModules.SURFER:
|
|
451
|
+
return 'transparent linear-gradient(90deg, #CCE0F4 0%, #7EC1E7 14%, #39A6DB 28%, #1E9CD7 35%, #0075BE 78%, #005B97 99%) 0% 0% no-repeat padding-box';
|
|
452
|
+
case AppModules.DESIGNER:
|
|
453
|
+
return '#482234';
|
|
454
|
+
case AppModules.ORCHESTRATOR:
|
|
455
|
+
return '#1d6f42';
|
|
456
|
+
default:
|
|
457
|
+
return 'transparent linear-gradient(90deg, #CCE0F4 0%, #7EC1E7 14%, #39A6DB 28%, #1E9CD7 35%, #0075BE 78%, #005B97 99%) 0% 0% no-repeat padding-box';
|
|
458
|
+
}
|
|
459
|
+
};
|
|
460
|
+
export const getSearchToolbarVisibility = (appModuleID) => {
|
|
461
|
+
switch (appModuleID) {
|
|
462
|
+
case AppModules.SURFER:
|
|
463
|
+
return {
|
|
464
|
+
tmSearchResult: true,
|
|
465
|
+
tmBlog: true,
|
|
466
|
+
tmSysMetadata: true,
|
|
467
|
+
tmDcmtPreview: true,
|
|
468
|
+
tmFullTextSearch: true,
|
|
469
|
+
};
|
|
470
|
+
case AppModules.DESIGNER:
|
|
471
|
+
case AppModules.ORCHESTRATOR:
|
|
472
|
+
default:
|
|
473
|
+
return {
|
|
474
|
+
tmSearchResult: true,
|
|
475
|
+
tmBlog: false,
|
|
476
|
+
tmSysMetadata: true,
|
|
477
|
+
tmDcmtPreview: true,
|
|
478
|
+
tmFullTextSearch: false,
|
|
479
|
+
};
|
|
480
|
+
}
|
|
481
|
+
};
|
|
482
|
+
export const getDcmtFormToolbarVisibility = (appModuleID) => {
|
|
483
|
+
switch (appModuleID) {
|
|
484
|
+
case AppModules.SURFER:
|
|
485
|
+
return {
|
|
486
|
+
tmDcmtForm: true,
|
|
487
|
+
tmBlog: true,
|
|
488
|
+
tmSysMetadata: true,
|
|
489
|
+
tmDcmtPreview: true,
|
|
490
|
+
tmWF: true,
|
|
491
|
+
tmDcmtTasks: true,
|
|
492
|
+
};
|
|
493
|
+
case AppModules.DESIGNER:
|
|
494
|
+
case AppModules.ORCHESTRATOR:
|
|
495
|
+
default:
|
|
496
|
+
return {
|
|
497
|
+
tmDcmtForm: true,
|
|
498
|
+
tmBlog: false,
|
|
499
|
+
tmSysMetadata: true,
|
|
500
|
+
tmDcmtPreview: true,
|
|
501
|
+
tmWF: false,
|
|
502
|
+
tmDcmtTasks: false,
|
|
503
|
+
};
|
|
504
|
+
}
|
|
505
|
+
};
|
package/lib/ts/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@topconsultnpm/sdkui-react",
|
|
3
|
-
"version": "6.20.0-dev2.
|
|
3
|
+
"version": "6.20.0-dev2.11",
|
|
4
4
|
"description": "",
|
|
5
5
|
"scripts": {
|
|
6
|
-
"test": "echo \"Error: no test specified\"
|
|
6
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
7
7
|
"clean": "powershell Remove-Item lib/ -recurse",
|
|
8
8
|
"copy-files": "copyfiles -u 1 src/assets/*.* src/assets/ImageLibrary/*.* src/assets/thumbnails/*.* src/assets/IconsS4t/*.* src/assets/Metadata/*.* src/css/tm-sdkui.css lib/",
|
|
9
|
-
"tm-build": "npm run clean
|
|
9
|
+
"tm-build": "npm run clean && tsc && npm run copy-files",
|
|
10
10
|
"tm-watch": "tsc -w",
|
|
11
11
|
"tm-publish": "npm publish --tag latest",
|
|
12
12
|
"tm-publish_wl": "npm publish",
|
|
@@ -40,18 +40,18 @@
|
|
|
40
40
|
"lib"
|
|
41
41
|
],
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"
|
|
44
|
-
"react-pdf": "^10.3.0",
|
|
45
|
-
"htmlparser2": "^10.0.0",
|
|
43
|
+
"@topconsultnpm/sdk-ts": "6.20.0-dev2.2",
|
|
46
44
|
"buffer": "^6.0.3",
|
|
47
|
-
"@topconsultnpm/sdk-ts": "6.20.0-test1",
|
|
48
|
-
"exceljs": "^4.4.0",
|
|
49
45
|
"devextreme": "25.2.4",
|
|
50
|
-
"
|
|
46
|
+
"devextreme-react": "25.2.4",
|
|
47
|
+
"exceljs": "^4.4.0",
|
|
48
|
+
"htmlparser2": "^10.0.0",
|
|
51
49
|
"pdfjs-dist": "5.4.296",
|
|
52
|
-
"
|
|
50
|
+
"react-pdf": "^10.3.0",
|
|
51
|
+
"react-router-dom": "^6.15.0",
|
|
52
|
+
"styled-components": "^6.1.1"
|
|
53
53
|
},
|
|
54
54
|
"overrides": {
|
|
55
55
|
"esbuild": "^0.25.0"
|
|
56
56
|
}
|
|
57
|
-
}
|
|
57
|
+
}
|