@topconsultnpm/sdkui-react 6.20.0-dev1.99 → 6.20.0-dev2.10
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/assets/headergradient.svg +87 -0
- package/lib/components/NewComponents/ContextMenu/TMContextMenu.js +56 -18
- package/lib/components/NewComponents/ContextMenu/styles.js +13 -34
- package/lib/components/NewComponents/ContextMenu/types.d.ts +8 -2
- package/lib/components/NewComponents/FloatingMenuBar/TMFloatingMenuBar.js +315 -271
- package/lib/components/NewComponents/FloatingMenuBar/styles.d.ts +4 -0
- package/lib/components/NewComponents/FloatingMenuBar/styles.js +6 -2
- package/lib/components/NewComponents/FloatingMenuBar/types.d.ts +7 -4
- package/lib/components/base/TMButton.js +6 -0
- package/lib/components/base/TMClosableList.js +4 -0
- package/lib/components/base/TMDropDownMenu.js +2 -0
- package/lib/components/base/TMListView.js +1 -1
- package/lib/components/base/TMPanel.d.ts +1 -1
- package/lib/components/base/TMPanel.js +9 -5
- package/lib/components/base/TMPopUp.js +6 -0
- package/lib/components/base/TMToolbarCard.js +2 -0
- package/lib/components/base/TMTreeView.d.ts +2 -1
- package/lib/components/base/TMTreeView.js +33 -26
- package/lib/components/choosers/TMDataListItemChooser.d.ts +2 -0
- package/lib/components/choosers/TMDataListItemChooser.js +8 -2
- package/lib/components/choosers/TMDcmtTypeChooser.d.ts +1 -0
- package/lib/components/choosers/TMDcmtTypeChooser.js +11 -3
- package/lib/components/choosers/TMDistinctValues.js +2 -2
- package/lib/components/choosers/TMDynDataListItemChooser.d.ts +2 -0
- package/lib/components/choosers/TMDynDataListItemChooser.js +19 -8
- package/lib/components/choosers/TMMetadataChooser.d.ts +2 -0
- package/lib/components/choosers/TMMetadataChooser.js +11 -3
- package/lib/components/choosers/TMUserChooser.d.ts +2 -0
- package/lib/components/choosers/TMUserChooser.js +8 -2
- package/lib/components/editors/TMCheckBox.js +2 -0
- package/lib/components/editors/TMDateBox.js +18 -9
- package/lib/components/editors/TMEditorStyled.js +7 -0
- package/lib/components/editors/TMLocalizedTextBox.d.ts +3 -1
- package/lib/components/editors/TMLocalizedTextBox.js +16 -14
- package/lib/components/editors/TMMetadataEditor.d.ts +1 -0
- package/lib/components/editors/TMMetadataEditor.js +4 -4
- package/lib/components/editors/TMMetadataTextBox.d.ts +9 -0
- package/lib/components/editors/TMMetadataTextBox.js +92 -0
- package/lib/components/editors/TMMetadataValues.d.ts +2 -0
- package/lib/components/editors/TMMetadataValues.js +6 -4
- package/lib/components/editors/TMRadioButton.js +2 -0
- package/lib/components/editors/TMTextBox.d.ts +1 -1
- package/lib/components/editors/TMTextBox.js +23 -1
- package/lib/components/editors/TMTextExpression.js +6 -91
- package/lib/components/features/assistant/TMToppyDraggableHelpCenter.js +2 -0
- package/lib/components/features/documents/TMDcmtBlog.js +1 -1
- package/lib/components/features/documents/TMDcmtForm.js +126 -88
- package/lib/components/features/documents/TMDcmtPreview.js +92 -42
- package/lib/components/features/search/TMSearch.js +5 -1
- package/lib/components/features/search/TMSearchQueryEditor.d.ts +1 -0
- package/lib/components/features/search/TMSearchQueryEditor.js +10 -10
- package/lib/components/features/search/TMSearchQueryPanel.js +24 -10
- package/lib/components/features/search/TMSearchResult.js +198 -13
- package/lib/components/features/search/TMSearchResultsMenuItems.d.ts +1 -1
- package/lib/components/features/search/TMSearchResultsMenuItems.js +24 -4
- package/lib/components/features/search/TMViewHistoryDcmt.js +45 -50
- package/lib/components/features/tasks/TMTaskForm.js +55 -24
- package/lib/components/features/tasks/TMTasksUtils.js +14 -1
- package/lib/components/features/workflow/TMWorkflowPopup.js +5 -4
- package/lib/components/features/workflow/diagram/DiagramItemComponent.js +2 -0
- package/lib/components/features/workflow/diagram/DiagramItemForm.js +1 -1
- package/lib/components/features/workflow/diagram/WFDiagram.js +1 -1
- package/lib/components/forms/Login/TMLoginForm.js +1 -1
- package/lib/components/grids/TMValidationItemsList.js +6 -0
- package/lib/components/index.d.ts +1 -0
- package/lib/components/index.js +1 -0
- package/lib/components/layout/panelManager/TMPanelManagerContainer.js +3 -2
- package/lib/components/layout/panelManager/TMPanelManagerContext.js +13 -5
- package/lib/components/query/TMQueryEditor.d.ts +4 -0
- package/lib/components/query/TMQueryEditor.js +14 -10
- package/lib/components/sidebar/TMHeader.js +11 -7
- package/lib/components/sidebar/TMSidebar.d.ts +0 -1
- package/lib/components/sidebar/TMSidebar.js +16 -44
- package/lib/components/sidebar/TMSidebarItem.js +36 -17
- package/lib/helper/SDKUI_Globals.d.ts +3 -0
- package/lib/helper/SDKUI_Globals.js +6 -3
- package/lib/helper/SDKUI_Localizator.d.ts +4 -16
- package/lib/helper/SDKUI_Localizator.js +37 -157
- package/lib/helper/TMIcons.d.ts +1 -0
- package/lib/helper/TMIcons.js +3 -0
- package/lib/helper/TMToppyMessage.js +4 -0
- package/lib/helper/TMUtils.d.ts +20 -1
- package/lib/helper/TMUtils.js +71 -1
- package/lib/helper/helpers.d.ts +27 -1
- package/lib/helper/helpers.js +107 -1
- package/lib/helper/queryHelper.d.ts +1 -1
- package/lib/helper/queryHelper.js +24 -1
- package/lib/hooks/useFloatingBarPinnedItems.d.ts +11 -0
- package/lib/hooks/useFloatingBarPinnedItems.js +54 -0
- package/lib/hooks/useMetadataExpression.d.ts +19 -0
- package/lib/hooks/useMetadataExpression.js +99 -0
- package/lib/ts/types.d.ts +3 -0
- package/package.json +55 -55
|
@@ -87,6 +87,6 @@ const TMDcmtBlog = ({ tid, did, isVisible, fetchBlogDataTrigger, allTasks = [],
|
|
|
87
87
|
}, externalBlogPost: externalBlogPost, resetExternalBlogPost: resetExternalBlogPost, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, afterTaskSaved: refreshCallback }) }) }) }), (showCommentForm && tid && did) && _jsx(TMBlogCommentForm, { context: { engine: 'SearchEngine', object: { tid, did } }, onClose: () => setShowCommentForm(false), refreshCallback: refreshCallback, participants: [], showAttachmentsSection: false, allArchivedDocumentsFileItems: [], onFilterCreated: handleFilterCreated })] }));
|
|
88
88
|
};
|
|
89
89
|
export default TMDcmtBlog;
|
|
90
|
-
const StyledContainer = styled.div ` user-select: none; overflow: hidden; background-color: #ffffff; width: calc(100%); height: calc(100%); display: flex; gap: 10px; `;
|
|
90
|
+
const StyledContainer = styled.div ` user-select: none; -webkit-touch-callout: none; -webkit-user-select: none; overflow: hidden; background-color: #ffffff; width: calc(100%); height: calc(100%); display: flex; gap: 10px; `;
|
|
91
91
|
const StyledSectionContainer = styled.div ` width: 100%; height: 100%; display:flex; flex-direction: column; `;
|
|
92
92
|
const StyledBoardContainer = styled.div `width: 100%; height: 100%;`;
|
|
@@ -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 } 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';
|
|
@@ -38,7 +38,7 @@ import WFDiagram from '../workflow/diagram/WFDiagram';
|
|
|
38
38
|
import TMTooltip from '../../base/TMTooltip';
|
|
39
39
|
import TMDcmtTasks from './TMDcmtTasks';
|
|
40
40
|
import TMToppyMessage from '../../../helper/TMToppyMessage';
|
|
41
|
-
import { getTaskAssignedToMe } from '../tasks/TMTasksUtils';
|
|
41
|
+
import { getTaskAssignedByMe, getTaskAssignedToMe } from '../tasks/TMTasksUtils';
|
|
42
42
|
import TMCustomButton from '../../base/TMCustomButton';
|
|
43
43
|
import { useCheckInOutOperations } from '../../../hooks/useCheckInOutOperations';
|
|
44
44
|
import TMViewHistoryDcmt from '../search/TMViewHistoryDcmt';
|
|
@@ -62,6 +62,7 @@ export var InvocationContext;
|
|
|
62
62
|
// Aggiungi qui altri contesti futuri secondo necessità
|
|
63
63
|
})(InvocationContext || (InvocationContext = {}));
|
|
64
64
|
let abortControllerLocal = new AbortController();
|
|
65
|
+
;
|
|
65
66
|
//#endregion
|
|
66
67
|
const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, handleNavigateToWGs, handleNavigateToDossiers, showHeader = true, onSaveRecents, layoutMode = LayoutModes.Update, showBackButton = true, onClose, onSavedAsyncCallback, TID, DID, formMode = FormModes.Update, canNext, canPrev, count, itemIndex, onNext, onPrev, allowNavigation = true, allowRelations = true, isClosable = false, isExpertMode = SDKUI_Globals.userSettings.advancedSettings.expertMode === 1, showDcmtFormSidebar = true, invocationContext = InvocationContext.Default, titleModal, isModal = false, widthModal = "100%", heightModal = "100%", groupId, onWFOperationCompleted, onTaskCompleted, onTaskCreateRequest, inputFile = null, taskFormDialogComponent, moreInfoTasks, connectorFileSave = undefined, inputMids = [], openS4TViewer = false, onOpenS4TViewerRequest, s4TViewerDialogComponent, enableDragDropOverlay = false, passToSearch, isSharedDcmt = false, sharedSourceTID, sharedSourceDID, allowButtonsRefs = false, onReferenceClick, }) => {
|
|
67
68
|
const { showHistory, showHistoryCallback, hideHistoryCallback, showCheckoutInformationForm, commentFormState, hideCommentFormCallback, showCheckoutInformationFormCallback, hideCheckoutInformationFormCallback, copyCheckoutPathToClipboardCallback, handleCheckOutCallback, handleCheckInCallback, refreshPreviewTrigger, showCicoWaitPanel, cicoWaitPanelTitle, showCicoPrimaryProgress, cicoPrimaryProgressText, cicoPrimaryProgressValue, cicoPrimaryProgressMax, } = useCheckInOutOperations();
|
|
@@ -121,6 +122,11 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
121
122
|
// Stato per triggerare il refresh del blog dall'esterno
|
|
122
123
|
const [refreshBlogTrigger, setRefreshBlogTrigger] = useState(0);
|
|
123
124
|
const [wfError, setWfError] = useState(null);
|
|
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]);
|
|
124
130
|
const triggerBlogRefresh = useCallback(async () => {
|
|
125
131
|
setRefreshBlogTrigger(prev => prev + 1);
|
|
126
132
|
}, []);
|
|
@@ -188,10 +194,11 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
188
194
|
return;
|
|
189
195
|
TMSpinner.show({ description: 'Loading Metadata...' });
|
|
190
196
|
let res = getMetadataResult ?? await SDK_Globals.tmSession?.NewSearchEngine().GetMetadataAsync(TID, did, true);
|
|
197
|
+
const origin = { fromName: res?.fromName, fromTID: res?.fromTID };
|
|
191
198
|
let dtd = res?.dtdResult;
|
|
192
199
|
let rows = dtd.rows ? dtd.rows[0] : [];
|
|
193
200
|
let mids = res?.selectMIDs;
|
|
194
|
-
let metadataList = searchResultToMetadataValues(TID, dtd, rows, mids, mdList, layoutMode);
|
|
201
|
+
let metadataList = searchResultToMetadataValues(TID, dtd, rows, mids, mdList, layoutMode, isReadOnlyOriginCallback(origin.fromTID));
|
|
195
202
|
if (archived) {
|
|
196
203
|
// Usa setFormData con funzione callback per accedere allo stato precedente
|
|
197
204
|
// invece di dipendere da formDataOrig nell'array di dipendenze
|
|
@@ -217,6 +224,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
217
224
|
});
|
|
218
225
|
return;
|
|
219
226
|
}
|
|
227
|
+
setMetadataDcmtOrigin(origin);
|
|
220
228
|
setFormDataOrig(structuredClone(metadataList));
|
|
221
229
|
setFormData(structuredClone(metadataList));
|
|
222
230
|
// Sincronizza il ref con i dati caricati per evitare stale closure in handleSave
|
|
@@ -278,7 +286,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
278
286
|
}
|
|
279
287
|
else {
|
|
280
288
|
const renderedMetadata = dtd?.metadata?.filter((metadata) => handleArchiveVisibility(metadata)) ?? [];
|
|
281
|
-
const metadataList = searchResultToMetadataValues(dtd?.id, undefined, [], [], renderedMetadata, layoutMode);
|
|
289
|
+
const metadataList = searchResultToMetadataValues(dtd?.id, undefined, [], [], renderedMetadata, layoutMode, isReadOnlyOriginCallback(metadataDcmtOrigin?.fromTID));
|
|
282
290
|
setFormDataOrig(structuredClone(metadataList));
|
|
283
291
|
setFormData(structuredClone(metadataList));
|
|
284
292
|
formDataOrigRef.current = structuredClone(metadataList);
|
|
@@ -293,7 +301,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
293
301
|
setIsInitialLoading(false);
|
|
294
302
|
setIsNavigating(false);
|
|
295
303
|
}
|
|
296
|
-
}, [TID, DID, layoutMode, inputFile, setMetadataList, handleReset, allowButtonsRefs]);
|
|
304
|
+
}, [TID, DID, layoutMode, inputFile, setMetadataList, handleReset, allowButtonsRefs, isReadOnlyOriginCallback, metadataDcmtOrigin?.fromTID]);
|
|
297
305
|
const createChange = useCallback((mid, metadataType, modifiedValue) => {
|
|
298
306
|
return { mid, metadataType, modifiedValue };
|
|
299
307
|
}, []);
|
|
@@ -1212,7 +1220,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
1212
1220
|
}, [formData, fromDTD, isMobile]);
|
|
1213
1221
|
const tmDcmtForm = useMemo(() => {
|
|
1214
1222
|
return _jsxs(_Fragment, { children: [checkoutBadge && _jsx("div", { style: { padding: '10px', display: 'flex', justifyContent: 'center' }, children: checkoutBadge }), metadataValuesSource.length > 0 &&
|
|
1215
|
-
_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, onFocusedItemChanged: (item) => { (item?.mid !== focusedMetadataValue?.mid) && setFocusedMetadataValue(item); }, onValueChanged: (newItems) => {
|
|
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) => {
|
|
1216
1224
|
setFormData((prevItems) => prevItems.map((item) => {
|
|
1217
1225
|
const newItem = newItems.find((newItem) => newItem.tid === item.tid && newItem.mid === item.mid);
|
|
1218
1226
|
return newItem ? { ...item, ...newItem } : item;
|
|
@@ -1257,7 +1265,9 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
1257
1265
|
showAll,
|
|
1258
1266
|
handleConfirmAction,
|
|
1259
1267
|
handleUndo,
|
|
1260
|
-
handleClearForm
|
|
1268
|
+
handleClearForm,
|
|
1269
|
+
isReadOnlyOriginCallback,
|
|
1270
|
+
metadataDcmtOrigin?.fromTID,
|
|
1261
1271
|
]);
|
|
1262
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]);
|
|
1263
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]);
|
|
@@ -1353,89 +1363,117 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
1353
1363
|
'tmWF': false,
|
|
1354
1364
|
'tmDcmtTasks': false,
|
|
1355
1365
|
};
|
|
1356
|
-
const
|
|
1357
|
-
{
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1366
|
+
const getDcmtTasksCounter = (TID, DID, allTasks) => {
|
|
1367
|
+
if (!TID || !DID || !allTasks || allTasks.length === 0) {
|
|
1368
|
+
return {
|
|
1369
|
+
assignedToMe: 0,
|
|
1370
|
+
assignedByMe: 0
|
|
1371
|
+
};
|
|
1372
|
+
}
|
|
1373
|
+
try {
|
|
1374
|
+
const assignedToMe = getTaskAssignedToMe(allTasks).filter(task => task.iD1?.toString() === TID.toString() && task.iD2?.toString() === DID.toString() && task.state !== Task_States.Completed).length ?? 0;
|
|
1375
|
+
const assignedByMe = getTaskAssignedByMe(allTasks).filter(task => task.iD1?.toString() === TID.toString() && task.iD2?.toString() === DID.toString() && task.state !== Task_States.Completed).length ?? 0;
|
|
1376
|
+
return {
|
|
1377
|
+
assignedToMe,
|
|
1378
|
+
assignedByMe
|
|
1379
|
+
};
|
|
1380
|
+
}
|
|
1381
|
+
catch (error) {
|
|
1382
|
+
return {
|
|
1383
|
+
assignedToMe: 0,
|
|
1384
|
+
assignedByMe: 0
|
|
1385
|
+
};
|
|
1386
|
+
}
|
|
1387
|
+
};
|
|
1388
|
+
const initialPanels = useMemo(() => {
|
|
1389
|
+
const { assignedToMe, assignedByMe } = getDcmtTasksCounter(TID, DID, allTasks);
|
|
1390
|
+
let titleDcmtFormPanel = fromDTD?.nameLoc ?? "";
|
|
1391
|
+
// Caso: Il documento proviene da un'origine esterna
|
|
1392
|
+
if (isReadOnlyOriginCallback(metadataDcmtOrigin?.fromTID)) {
|
|
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] }));
|
|
1394
|
+
}
|
|
1395
|
+
const panels = [
|
|
1396
|
+
{
|
|
1397
|
+
id: 'tmDcmtForm',
|
|
1398
|
+
name: SDK_Localizator.Metadatas,
|
|
1399
|
+
contentOptions: {
|
|
1400
|
+
component: tmDcmtForm,
|
|
1401
|
+
isClosable: isClosable,
|
|
1402
|
+
panelContainer: {
|
|
1403
|
+
showHeader: showHeader,
|
|
1404
|
+
title: titleDcmtFormPanel,
|
|
1405
|
+
allowMaximize: !isMobile,
|
|
1406
|
+
onBack: showBackButton ? (isClosable && deviceType !== DeviceType.MOBILE) ? undefined : handleClose : undefined,
|
|
1407
|
+
onClose: isClosable ? () => { } : undefined,
|
|
1408
|
+
toolbar: allowNavigation ? formToolbar : _jsx(_Fragment, {})
|
|
1409
|
+
},
|
|
1370
1410
|
},
|
|
1411
|
+
toolbarOptions: {
|
|
1412
|
+
icon: _jsx(IconPreview, { fontSize: 24 }),
|
|
1413
|
+
visible: getDcmtFormToolbarVisibility(SDK_Globals.tmSession?.SessionDescr?.appModuleID ?? AppModules.SURFER).tmDcmtForm,
|
|
1414
|
+
orderNumber: 1,
|
|
1415
|
+
isActive: allInitialPanelVisibility['tmDcmtForm']
|
|
1416
|
+
}
|
|
1371
1417
|
},
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
contentOptions: { component: tmBlog, panelContainer: { title: SDKUI_Localizator.BlogCase, allowMaximize: !isMobile } },
|
|
1383
|
-
toolbarOptions: {
|
|
1384
|
-
icon: _jsx(IconBoard, { fontSize: 24 }),
|
|
1385
|
-
visible: true,
|
|
1386
|
-
disabled: isBoardDisabled,
|
|
1387
|
-
orderNumber: 2,
|
|
1388
|
-
isActive: allInitialPanelVisibility['tmBlog']
|
|
1389
|
-
}
|
|
1390
|
-
},
|
|
1391
|
-
{
|
|
1392
|
-
id: 'tmSysMetadata',
|
|
1393
|
-
name: SDKUI_Localizator.MetadataSystem,
|
|
1394
|
-
contentOptions: { component: tmSysMetadata, panelContainer: { title: SDKUI_Localizator.MetadataSystem, allowMaximize: !isMobile } },
|
|
1395
|
-
toolbarOptions: { icon: _jsx(IconDcmtTypeSys, { fontSize: 24 }), visible: true, disabled: isSysMetadataDisabled, orderNumber: 3, isActive: allInitialPanelVisibility['tmSysMetadata'] }
|
|
1396
|
-
},
|
|
1397
|
-
{
|
|
1398
|
-
id: 'tmDcmtPreview',
|
|
1399
|
-
name: SDKUI_Localizator.PreviewDocument,
|
|
1400
|
-
contentOptions: { component: tmDcmtPreview },
|
|
1401
|
-
toolbarOptions: { icon: _jsx(IconShow, { fontSize: 24 }), disabled: isPreviewDisabled, visible: true, orderNumber: 4, isActive: allInitialPanelVisibility['tmDcmtPreview'] }
|
|
1402
|
-
},
|
|
1403
|
-
{
|
|
1404
|
-
id: 'tmWF',
|
|
1405
|
-
name: "Workflow",
|
|
1406
|
-
contentOptions: {
|
|
1407
|
-
component: tmWF,
|
|
1408
|
-
panelContainer: {
|
|
1409
|
-
title: "Workflow", allowMaximize: !isMobile
|
|
1418
|
+
{
|
|
1419
|
+
id: 'tmBlog',
|
|
1420
|
+
name: SDKUI_Localizator.BlogCase,
|
|
1421
|
+
contentOptions: { component: tmBlog, panelContainer: { title: SDKUI_Localizator.BlogCase, allowMaximize: !isMobile } },
|
|
1422
|
+
toolbarOptions: {
|
|
1423
|
+
icon: _jsx(IconBoard, { fontSize: 24 }),
|
|
1424
|
+
visible: getDcmtFormToolbarVisibility(SDK_Globals.tmSession?.SessionDescr?.appModuleID ?? AppModules.SURFER).tmBlog,
|
|
1425
|
+
disabled: isBoardDisabled,
|
|
1426
|
+
orderNumber: 2,
|
|
1427
|
+
isActive: allInitialPanelVisibility['tmBlog']
|
|
1410
1428
|
}
|
|
1411
1429
|
},
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
orderNumber:
|
|
1417
|
-
isActive: allInitialPanelVisibility['tmWF']
|
|
1418
|
-
}
|
|
1419
|
-
},
|
|
1420
|
-
{
|
|
1421
|
-
id: 'tmDcmtTasks',
|
|
1422
|
-
name: SDKUI_Localizator.Widget_Activities,
|
|
1423
|
-
contentOptions: {
|
|
1424
|
-
component: tmDcmtTasks,
|
|
1430
|
+
{
|
|
1431
|
+
id: 'tmSysMetadata',
|
|
1432
|
+
name: SDKUI_Localizator.MetadataSystem,
|
|
1433
|
+
contentOptions: { component: tmSysMetadata, panelContainer: { title: SDKUI_Localizator.MetadataSystem, allowMaximize: !isMobile } },
|
|
1434
|
+
toolbarOptions: { icon: _jsx(IconDcmtTypeSys, { fontSize: 24 }), visible: getDcmtFormToolbarVisibility(SDK_Globals.tmSession?.SessionDescr?.appModuleID ?? AppModules.SURFER).tmSysMetadata, disabled: isSysMetadataDisabled, orderNumber: 3, isActive: allInitialPanelVisibility['tmSysMetadata'] }
|
|
1425
1435
|
},
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
isActive: allInitialPanelVisibility['
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1436
|
+
{
|
|
1437
|
+
id: 'tmDcmtPreview',
|
|
1438
|
+
name: SDKUI_Localizator.PreviewDocument,
|
|
1439
|
+
contentOptions: { component: tmDcmtPreview },
|
|
1440
|
+
toolbarOptions: { icon: _jsx(IconShow, { fontSize: 24 }), disabled: isPreviewDisabled, visible: getDcmtFormToolbarVisibility(SDK_Globals.tmSession?.SessionDescr?.appModuleID ?? AppModules.SURFER).tmDcmtPreview, orderNumber: 4, isActive: allInitialPanelVisibility['tmDcmtPreview'] }
|
|
1441
|
+
},
|
|
1442
|
+
{
|
|
1443
|
+
id: 'tmWF',
|
|
1444
|
+
name: "Workflow",
|
|
1445
|
+
contentOptions: {
|
|
1446
|
+
component: tmWF,
|
|
1447
|
+
panelContainer: {
|
|
1448
|
+
title: "Workflow", allowMaximize: !isMobile
|
|
1449
|
+
}
|
|
1450
|
+
},
|
|
1451
|
+
toolbarOptions: {
|
|
1452
|
+
icon: _jsx(IconWorkflow, { fontSize: 24 }),
|
|
1453
|
+
visible: getDcmtFormToolbarVisibility(SDK_Globals.tmSession?.SessionDescr?.appModuleID ?? AppModules.SURFER).tmWF,
|
|
1454
|
+
disabled: isWFDisabled,
|
|
1455
|
+
orderNumber: 5,
|
|
1456
|
+
isActive: allInitialPanelVisibility['tmWF']
|
|
1457
|
+
}
|
|
1458
|
+
},
|
|
1459
|
+
{
|
|
1460
|
+
id: 'tmDcmtTasks',
|
|
1461
|
+
name: SDKUI_Localizator.Widget_Activities,
|
|
1462
|
+
contentOptions: {
|
|
1463
|
+
component: tmDcmtTasks,
|
|
1464
|
+
},
|
|
1465
|
+
toolbarOptions: {
|
|
1466
|
+
icon: _jsx(IconActivity, { fontSize: 24 }),
|
|
1467
|
+
visible: layoutMode !== LayoutModes.Ark && getDcmtFormToolbarVisibility(SDK_Globals.tmSession?.SessionDescr?.appModuleID ?? AppModules.SURFER).tmDcmtTasks,
|
|
1468
|
+
orderNumber: 6,
|
|
1469
|
+
isActive: allInitialPanelVisibility['tmDcmtTasks'],
|
|
1470
|
+
count: assignedToMe + assignedByMe,
|
|
1471
|
+
tooltip: _jsx("div", { children: assignedToMe + assignedByMe === 0 ? (SDKUI_Localizator.Widget_Activities) : (_jsxs("div", { children: [_jsx("div", { style: { textAlign: 'center', fontWeight: 'bold' }, children: SDKUI_Localizator.Widget_Activities }), _jsxs("div", { style: { textAlign: 'left' }, children: [_jsxs("div", { children: [SDKUI_Localizator.AssignedToMe, ": ", assignedToMe] }), _jsxs("div", { children: [SDKUI_Localizator.AssignedByMe, ": ", assignedByMe] })] })] })) })
|
|
1472
|
+
}
|
|
1473
|
+
},
|
|
1474
|
+
];
|
|
1475
|
+
return panels;
|
|
1476
|
+
}, [fromDTD, showBackButton, tmDcmtForm, tmBlog, tmSysMetadata, tmDcmtPreview, tmWF, tmDcmtTasks, isPreviewDisabled, isSysMetadataDisabled, isBoardDisabled, isWFDisabled, inputFile, isClosable, allTasks, DID, TID, isReadOnlyOriginCallback, metadataDcmtOrigin?.fromTID]);
|
|
1439
1477
|
// Retrieves the current document form setting based on the normalized TID
|
|
1440
1478
|
const getCurrentDcmtFormSetting = () => {
|
|
1441
1479
|
const settings = SDKUI_Globals.userSettings.dcmtFormSettings;
|
|
@@ -1530,8 +1568,8 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
1530
1568
|
}, [onReferenceClick]);
|
|
1531
1569
|
// Mapping for objClass specific label/action. Easy to extend for future objClass types.
|
|
1532
1570
|
const referenceActionMap = useMemo(() => ({
|
|
1533
|
-
[ObjectClasses.Dossier]: { label:
|
|
1534
|
-
[ObjectClasses.WorkingGroup]: { label:
|
|
1571
|
+
[ObjectClasses.Dossier]: { label: SDKUI_Localizator.GoToDossier },
|
|
1572
|
+
[ObjectClasses.WorkingGroup]: { label: SDKUI_Localizator.GoToWorkgroup },
|
|
1535
1573
|
// add other ObjectClasses here as needed
|
|
1536
1574
|
}), []);
|
|
1537
1575
|
const renderDcmtForm = () => {
|
|
@@ -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 } 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) {
|
|
@@ -107,8 +160,9 @@ const TMDcmtPreview = ({ dcmtData, isResizingActive, isVisible, canNext, canPrev
|
|
|
107
160
|
extensionInfo = '';
|
|
108
161
|
title += extensionInfo;
|
|
109
162
|
title += dcmtData.fileSize && dcmtData.fileSize > 0 ? formatBytes(dcmtData.fileSize) + ')' : '';
|
|
110
|
-
|
|
111
|
-
|
|
163
|
+
const isCached = isDcmtFileInCache(cacheKey) && isFromCache;
|
|
164
|
+
if (isCached) {
|
|
165
|
+
return (_jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: '3px' }, children: [title, _jsx(TMTooltip, { content: "da cache", children: _jsx(IconCache, { fontSize: 13 }) })] }));
|
|
112
166
|
}
|
|
113
167
|
return title;
|
|
114
168
|
};
|
|
@@ -119,7 +173,7 @@ const TMDcmtPreview = ({ dcmtData, isResizingActive, isVisible, canNext, canPrev
|
|
|
119
173
|
setIsAbortError(false);
|
|
120
174
|
setDcmtBlob(undefined);
|
|
121
175
|
try {
|
|
122
|
-
await loadDocumentWithCache();
|
|
176
|
+
isBasketMode ? await loadBasketFile() : await loadDocumentWithCache();
|
|
123
177
|
}
|
|
124
178
|
catch (error) {
|
|
125
179
|
console.error('Error reopening document:', error);
|
|
@@ -131,7 +185,7 @@ const TMDcmtPreview = ({ dcmtData, isResizingActive, isVisible, canNext, canPrev
|
|
|
131
185
|
], [cacheKey, removeDcmtsFileCache, clearDcmtsFileCache, setIsFromCache]);
|
|
132
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
|
|
133
187
|
? _jsx(ErrorContent, { error: error, isAbortError: isAbortError, onRetry: reOpenDcmt })
|
|
134
|
-
: 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) }) }));
|
|
135
189
|
};
|
|
136
190
|
export default TMDcmtPreview;
|
|
137
191
|
export const TMFileViewer = ({ fileBlob, isResizingActive }) => {
|
|
@@ -340,32 +394,28 @@ const ImageViewer = ({ fileBlob, alt = 'Image', className }) => {
|
|
|
340
394
|
const doc = iframe.contentWindow?.document;
|
|
341
395
|
if (!doc)
|
|
342
396
|
return;
|
|
343
|
-
doc.
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
<
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
</body>
|
|
366
|
-
</html>
|
|
367
|
-
`);
|
|
368
|
-
doc.close();
|
|
397
|
+
doc.documentElement.innerHTML = `
|
|
398
|
+
<head>
|
|
399
|
+
<title>Print Image</title>
|
|
400
|
+
<style>
|
|
401
|
+
body, html {
|
|
402
|
+
margin: 0;
|
|
403
|
+
padding: 0;
|
|
404
|
+
height: 100%;
|
|
405
|
+
display: flex;
|
|
406
|
+
justify-content: center;
|
|
407
|
+
align-items: center;
|
|
408
|
+
}
|
|
409
|
+
img {
|
|
410
|
+
max-width: 100%;
|
|
411
|
+
max-height: 100%;
|
|
412
|
+
}
|
|
413
|
+
</style>
|
|
414
|
+
</head>
|
|
415
|
+
<body>
|
|
416
|
+
<img src="${dataUrl}" onload="setTimeout(() => { window.print(); window.close(); }, 100);" />
|
|
417
|
+
</body>
|
|
418
|
+
`;
|
|
369
419
|
iframe.contentWindow?.addEventListener('afterprint', () => {
|
|
370
420
|
document.body.removeChild(iframe);
|
|
371
421
|
});
|
|
@@ -385,13 +435,13 @@ const ImageViewer = ({ fileBlob, alt = 'Image', className }) => {
|
|
|
385
435
|
export const TMNothingToShow = ({ text = '', secondText, fileExt, icon = _jsx(IconPreview, { fontSize: 96 }) }) => {
|
|
386
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})` })] })] })] }) }));
|
|
387
437
|
};
|
|
388
|
-
const renderedPreview = (tid, did, fileExt, fileSize, fileCount, extHandler, showPreview, isResizingActive, onDownloadShowPreviewClick, dcmtBlob) => {
|
|
389
|
-
if (!did)
|
|
438
|
+
const renderedPreview = (tid, did, fileExt, fileSize, fileCount, extHandler, showPreview, isResizingActive, onDownloadShowPreviewClick, dcmtBlob, isBasketMode) => {
|
|
439
|
+
if (!isBasketMode && !did)
|
|
390
440
|
return _jsx(TMNothingToShow, { text: `${SDKUI_Localizator.NoDcmtSelected}.` });
|
|
391
|
-
if (fileCount == 0) {
|
|
441
|
+
if (!isBasketMode && fileCount == 0) {
|
|
392
442
|
return _jsx(TMNothingToShow, { text: SDKUI_Localizator.MetadataOnlyDocument });
|
|
393
443
|
}
|
|
394
|
-
if (fileExt && extHandler === FileExtensionHandler.NONE) {
|
|
444
|
+
if (!isBasketMode && fileExt && extHandler === FileExtensionHandler.NONE) {
|
|
395
445
|
return _jsx(TMNothingToShow, { fileExt: fileExt });
|
|
396
446
|
}
|
|
397
447
|
if (showPreview) {
|
|
@@ -404,7 +454,7 @@ const StyledPreviewContainer = styled.div `display: flex; justify-content: cente
|
|
|
404
454
|
export const StyledHeaderIcon = styled.div ` color: ${props => props.$color}; cursor: pointer; display: flex; align-items: center; justify-content: center; &:hover{ color: white ; transition: 200ms ease; } `;
|
|
405
455
|
export const StyledPanelStatusContainer = styled.div ` width: 100%; height: 100%; padding: 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; `;
|
|
406
456
|
const StyledPreviewNotAvailable = styled.div ` display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; `;
|
|
407
|
-
const ImageContainer = styled.div ` width: calc(100% - 20px); height: 100%; left:10px; position: absolute; top:50px; overflow: hidden; background: #f5f5f5; touch-action: none; user-select: none; cursor: ${({ $cursor }) => $cursor ?? 'default'}; `;
|
|
457
|
+
const ImageContainer = styled.div ` width: calc(100% - 20px); height: 100%; left:10px; position: absolute; top:50px; overflow: hidden; background: #f5f5f5; touch-action: none; user-select: none; -webkit-touch-callout: none; -webkit-user-select: none; cursor: ${({ $cursor }) => $cursor ?? 'default'}; `;
|
|
408
458
|
const TopToolbar = styled.div ` position: absolute; top: 0; width: 100%; height: 40px; background-color: #e4e4e4; display: flex; justify-content: center; align-items: center; z-index: 10; `;
|
|
409
459
|
const ToolbarCenter = styled.div ` display: flex; align-items: center; gap: 12px;`;
|
|
410
460
|
const ToolbarIconButton = styled.button ` background: #f0f0f0; border: none; color: #313131; font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; height: 32px; width: 32px; padding: 0; border-radius: 50px; &:hover{ background-color: #c4c4c4; } &:disabled { color: #c2c2c2; cursor: not-allowed; } `;
|
|
@@ -133,8 +133,12 @@ const TMSearch = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTask
|
|
|
133
133
|
setCurrentMruTID(0);
|
|
134
134
|
};
|
|
135
135
|
const onSQDItemClick = useCallback(async (sqd, setSqdAsync) => {
|
|
136
|
+
// Forza ricaricamento completo se la query è già selezionata
|
|
137
|
+
if (sqd.id === currentSQD?.id) {
|
|
138
|
+
await setSqdAsync(undefined);
|
|
139
|
+
}
|
|
136
140
|
await setSqdAsync(sqd);
|
|
137
|
-
}, []);
|
|
141
|
+
}, [currentSQD]);
|
|
138
142
|
const onSQDDeleted = useCallback(async (sqd, sqdToBeSet, setSqdAsync) => {
|
|
139
143
|
await loadDataSQDsAsync(true, sqd.masterTID);
|
|
140
144
|
if (sqdToBeSet)
|
|
@@ -10,6 +10,7 @@ interface ITMSearchQueryEditorProps {
|
|
|
10
10
|
onQdChanged?: (qd: QueryDescriptor) => void;
|
|
11
11
|
onAdvancedMenuClick?: (e: AdvancedMenuClickEventArgs) => void;
|
|
12
12
|
onFocusedMetadataChanged?: (tid_mid: TID_MID | undefined) => void;
|
|
13
|
+
updateIsModalOpen?: (isOpen: boolean) => void;
|
|
13
14
|
}
|
|
14
15
|
declare const _default: React.NamedExoticComponent<ITMSearchQueryEditorProps>;
|
|
15
16
|
export default _default;
|