@topconsultnpm/sdkui-react 6.19.0-dev1.43 → 6.19.0-dev1.45
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/features/archive/TMArchive.js +12 -12
- package/lib/components/features/documents/TMDcmtForm.d.ts +3 -1
- package/lib/components/features/documents/TMDcmtForm.js +11 -9
- package/lib/components/features/search/TMSearchQueryPanel.d.ts +1 -1
- package/lib/components/features/search/TMSearchQueryPanel.js +26 -4
- package/lib/components/features/search/TMSearchResult.js +1 -1
- package/lib/components/features/search/TMSearchResultsMenuItems.js +1 -1
- package/package.json +1 -1
|
@@ -30,7 +30,10 @@ const TMArchive = ({ onDcmtTypeSelect = undefined, inputTID, inputFile = null, c
|
|
|
30
30
|
}, [inputTID, mruTIDs]);
|
|
31
31
|
useEffect(() => {
|
|
32
32
|
pendingMidsRef.current = inputMids;
|
|
33
|
-
|
|
33
|
+
if (currentTID && currentTID > 0 && inputMids && inputMids.length > 0) {
|
|
34
|
+
setCurrentInputMids(inputMids);
|
|
35
|
+
}
|
|
36
|
+
}, [inputMids, currentTID]);
|
|
34
37
|
useEffect(() => {
|
|
35
38
|
if (!currentTID || currentTID <= 0) {
|
|
36
39
|
previousTIDRef.current = currentTID;
|
|
@@ -42,20 +45,16 @@ const TMArchive = ({ onDcmtTypeSelect = undefined, inputTID, inputFile = null, c
|
|
|
42
45
|
setFromDTD(dtd);
|
|
43
46
|
});
|
|
44
47
|
if (previousTIDRef.current !== undefined && previousTIDRef.current > 0 && previousTIDRef.current !== currentTID) {
|
|
48
|
+
if (!isSharedArchive) {
|
|
49
|
+
setCurrentInputMids([]);
|
|
50
|
+
}
|
|
45
51
|
if (pendingMidsRef.current && pendingMidsRef.current.length > 0) {
|
|
46
52
|
setCurrentInputMids(pendingMidsRef.current);
|
|
47
53
|
pendingMidsRef.current = null;
|
|
48
54
|
}
|
|
49
|
-
else {
|
|
50
|
-
setCurrentInputMids([]);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
else if (pendingMidsRef.current) {
|
|
54
|
-
setCurrentInputMids(pendingMidsRef.current);
|
|
55
|
-
pendingMidsRef.current = null;
|
|
56
55
|
}
|
|
57
56
|
previousTIDRef.current = currentTID;
|
|
58
|
-
}, [currentTID, onDcmtTypeSelect]);
|
|
57
|
+
}, [currentTID, onDcmtTypeSelect, isSharedArchive]);
|
|
59
58
|
const isMobile = deviceType === DeviceType.MOBILE;
|
|
60
59
|
const tmTreeSelectorElement = useMemo(() => _jsx(TMTreeSelectorWrapper, { isMobile: isMobile, isSharedArchive: isSharedArchive, onSelectedTIDChanged: (tid) => {
|
|
61
60
|
setCurrentTID(tid);
|
|
@@ -73,10 +72,11 @@ const TMArchive = ({ onDcmtTypeSelect = undefined, inputTID, inputFile = null, c
|
|
|
73
72
|
setMruTIDs(newMruTIDS);
|
|
74
73
|
} }), [mruTIDs, currentMruTID, deviceType, isSharedArchive]);
|
|
75
74
|
const tmFormElement = useMemo(() => currentTID ?
|
|
76
|
-
_jsx(TMDcmtForm, { TID: currentTID, DID: inputDID, groupId: 'tmForm', layoutMode: LayoutModes.Ark, onClose: deviceType === DeviceType.MOBILE ? () => setCurrentTID(undefined) : undefined, onSaveRecents: (TIDs) => setMruTIDs(TIDs), showDcmtFormSidebar: false, inputFile: inputFile, connectorFileSave: connectorFileSave, onSavedAsyncCallback: onSavedAsyncCallback, inputMids: currentInputMids, enableDragDropOverlay: enableDragDropOverlay, passToSearch: passToSearch ? (outputMids) => {
|
|
75
|
+
_jsx(TMDcmtForm, { TID: currentTID, DID: currentTID === inputTID ? inputDID : undefined, sharedSourceTID: isSharedArchive ? inputTID : undefined, sharedSourceDID: isSharedArchive ? inputDID : undefined, groupId: 'tmForm', layoutMode: LayoutModes.Ark, onClose: deviceType === DeviceType.MOBILE ? () => setCurrentTID(undefined) : undefined, onSaveRecents: (TIDs) => setMruTIDs(TIDs), showDcmtFormSidebar: false, inputFile: inputFile, connectorFileSave: connectorFileSave, onSavedAsyncCallback: onSavedAsyncCallback, inputMids: currentInputMids, enableDragDropOverlay: enableDragDropOverlay, passToSearch: passToSearch ? (outputMids, tid) => {
|
|
76
|
+
const tidToUse = tid ?? currentTID;
|
|
77
77
|
if (onDcmtTypeSelect)
|
|
78
|
-
onDcmtTypeSelect(
|
|
79
|
-
passToSearch(
|
|
78
|
+
onDcmtTypeSelect(tidToUse);
|
|
79
|
+
passToSearch(tidToUse, outputMids);
|
|
80
80
|
} : undefined, isSharedDcmt: isSharedArchive }, currentTID)
|
|
81
81
|
:
|
|
82
82
|
_jsx(TMPanel, { title: 'Archiviazione', allowMaximize: false, children: _jsxs(TMLayoutContainer, { gap: 30, alignItems: 'center', justifyContent: 'center', children: [_jsx(StyledToppyTextContainer, { children: _jsx(StyledToppyText, { children: SDKUI_Localizator.DcmtTypeSelect }) }), _jsx(StyledToppyImage, { src: Logo, alt: 'Toppy' })] }) }), [currentTID, deviceType, mruTIDs, inputFile, currentInputMids, enableDragDropOverlay, isSharedArchive]);
|
|
@@ -44,8 +44,10 @@ interface ITMDcmtFormProps {
|
|
|
44
44
|
passToSearch?: (outputMids: Array<{
|
|
45
45
|
mid: number;
|
|
46
46
|
value: string;
|
|
47
|
-
}
|
|
47
|
+
}>, tid?: number) => void;
|
|
48
48
|
isSharedDcmt?: boolean;
|
|
49
|
+
sharedSourceTID?: number;
|
|
50
|
+
sharedSourceDID?: number;
|
|
49
51
|
}
|
|
50
52
|
declare const TMDcmtForm: React.FC<ITMDcmtFormProps>;
|
|
51
53
|
export default TMDcmtForm;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import TMDcmtPreview from './TMDcmtPreview';
|
|
4
|
-
import { AccessLevels, ArchiveConstraints, ArchiveEngineByID, DcmtTypeListCacheService, LayoutCacheService, LayoutModes, MetadataDataTypes, ResultTypes, SDK_Globals, SDK_Localizator, SystemMIDsAsNumber, SystemTIDs, Task_States, TemplateTIDs, UpdateEngineByID, ValidationItem, WorkflowCacheService, WorkItemMetadataNames } from '@topconsultnpm/sdk-ts';
|
|
4
|
+
import { AccessLevels, ArchiveConstraints, ArchiveEngineByID, DcmtTypeListCacheService, LayoutCacheService, LayoutModes, MetadataDataTypes, ResultTypes, SDK_Globals, SDK_Localizator, SystemMIDsAsNumber, SystemTIDs, Task_States, TemplateTIDs, TID_DID, UpdateEngineByID, ValidationItem, WorkflowCacheService, WorkItemMetadataNames } from '@topconsultnpm/sdk-ts';
|
|
5
5
|
import { ContextMenu } from 'devextreme-react';
|
|
6
6
|
import { WorkFlowApproveRejectPopUp, WorkFlowMoreInfoPopUp, WorkFlowOperationButtons, WorkFlowReAssignPopUp } from '../workflow/TMWorkflowPopup';
|
|
7
7
|
import { DownloadTypes, FormModes } from '../../../ts';
|
|
@@ -37,7 +37,7 @@ import WFDiagram from '../workflow/diagram/WFDiagram';
|
|
|
37
37
|
import TMTooltip from '../../base/TMTooltip';
|
|
38
38
|
let abortControllerLocal = new AbortController();
|
|
39
39
|
//#endregion
|
|
40
|
-
const TMDcmtForm = ({ showHeader = true, onSaveRecents, layoutMode = LayoutModes.Update, 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, invokedByTodo = false, titleModal, isModal = false, widthModal = "100%", heightModal = "100%", groupId, onWFOperationCompleted, onTaskCompleted, inputFile = null, taskFormDialogComponent, taskMoreInfo, connectorFileSave = undefined, inputMids = [], onOpenS4TViewerRequest, s4TViewerDialogComponent, enableDragDropOverlay = false, passToSearch, isSharedDcmt = false }) => {
|
|
40
|
+
const TMDcmtForm = ({ showHeader = true, onSaveRecents, layoutMode = LayoutModes.Update, 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, invokedByTodo = false, titleModal, isModal = false, widthModal = "100%", heightModal = "100%", groupId, onWFOperationCompleted, onTaskCompleted, inputFile = null, taskFormDialogComponent, taskMoreInfo, connectorFileSave = undefined, inputMids = [], onOpenS4TViewerRequest, s4TViewerDialogComponent, enableDragDropOverlay = false, passToSearch, isSharedDcmt = false, sharedSourceTID, sharedSourceDID }) => {
|
|
41
41
|
const [id, setID] = useState('');
|
|
42
42
|
const [showWaitPanelLocal, setShowWaitPanelLocal] = useState(false);
|
|
43
43
|
const [waitPanelTitleLocal, setWaitPanelTitleLocal] = useState('');
|
|
@@ -291,6 +291,7 @@ const TMDcmtForm = ({ showHeader = true, onSaveRecents, layoutMode = LayoutModes
|
|
|
291
291
|
if (layoutMode !== LayoutModes.Ark)
|
|
292
292
|
return;
|
|
293
293
|
setFocusedMetadataValue(undefined);
|
|
294
|
+
appliedInputMidsRef.current = null;
|
|
294
295
|
}, [fromDTD, layoutMode]);
|
|
295
296
|
useEffect(() => {
|
|
296
297
|
if (!inputMids || inputMids.length === 0)
|
|
@@ -421,8 +422,8 @@ const TMDcmtForm = ({ showHeader = true, onSaveRecents, layoutMode = LayoutModes
|
|
|
421
422
|
const outputMids = formData
|
|
422
423
|
.filter(md => md.mid && md.mid > 100 && md.value && md.value.length > 0)
|
|
423
424
|
.map(md => ({ mid: md.mid, value: md.value }));
|
|
424
|
-
passToSearch(outputMids);
|
|
425
|
-
}, [passToSearch, formData]);
|
|
425
|
+
passToSearch(outputMids, TID);
|
|
426
|
+
}, [passToSearch, formData, TID]);
|
|
426
427
|
const isPreviewDisabled = useMemo(() => layoutMode === LayoutModes.Ark && fromDTD?.archiveConstraint === ArchiveConstraints.OnlyMetadata, [layoutMode, fromDTD?.archiveConstraint]);
|
|
427
428
|
const isBoardDisabled = useMemo(() => layoutMode !== LayoutModes.Update || fromDTD?.hasBlog !== 1, [layoutMode, fromDTD?.hasBlog]);
|
|
428
429
|
const isSysMetadataDisabled = useMemo(() => layoutMode !== LayoutModes.Update, [layoutMode]);
|
|
@@ -615,11 +616,12 @@ const TMDcmtForm = ({ showHeader = true, onSaveRecents, layoutMode = LayoutModes
|
|
|
615
616
|
else {
|
|
616
617
|
ae.ArchivingFile = dcmtFileRef.current;
|
|
617
618
|
}
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
619
|
+
if (isSharedDcmt && sharedSourceTID && sharedSourceDID) {
|
|
620
|
+
const sharedDcmt = new TID_DID();
|
|
621
|
+
sharedDcmt.tid = sharedSourceTID;
|
|
622
|
+
sharedDcmt.did = sharedSourceDID;
|
|
623
|
+
ae.SharedDcmt = sharedDcmt;
|
|
624
|
+
}
|
|
623
625
|
let newDID = await ae.ArchiveAsync(abortControllerLocal.signal, (pd) => {
|
|
624
626
|
if (firstBlock) {
|
|
625
627
|
maxFileSize = pd.ProgressBarMaximum ?? 0;
|
|
@@ -19,7 +19,7 @@ interface ITMSearchQueryPanelProps {
|
|
|
19
19
|
passToArchiveCallback?: (outputMids: Array<{
|
|
20
20
|
mid: number;
|
|
21
21
|
value: string;
|
|
22
|
-
}
|
|
22
|
+
}>, tid?: number) => void;
|
|
23
23
|
}
|
|
24
24
|
declare const TMSearchQueryPanel: React.FunctionComponent<ITMSearchQueryPanelProps>;
|
|
25
25
|
export default TMSearchQueryPanel;
|
|
@@ -52,7 +52,24 @@ const TMSearchQueryPanel = ({ fromDTD, showBackToResultButton, isExpertMode = SD
|
|
|
52
52
|
pendingMidsRef.current = inputMids ?? null;
|
|
53
53
|
}, [inputMids]);
|
|
54
54
|
useEffect(() => {
|
|
55
|
-
if (!
|
|
55
|
+
if (!fromDTD)
|
|
56
|
+
return;
|
|
57
|
+
// Reset appliedInputMidsRef when TID changes so pending mids can be applied to new TID
|
|
58
|
+
appliedInputMidsRef.current = null;
|
|
59
|
+
const initQd = async () => {
|
|
60
|
+
// Only initialize if qd doesn't exist or is for a different TID
|
|
61
|
+
if (!qd || qd.from?.tid !== fromDTD.id) {
|
|
62
|
+
const newQd = await getQD(fromDTD.id, false);
|
|
63
|
+
if (newQd) {
|
|
64
|
+
setQd(newQd);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
initQd();
|
|
69
|
+
}, [fromDTD?.id]);
|
|
70
|
+
// Apply inputMids when qd is ready and matches fromDTD
|
|
71
|
+
useEffect(() => {
|
|
72
|
+
if (!qd || !fromDTD || qd.from?.tid !== fromDTD.id)
|
|
56
73
|
return;
|
|
57
74
|
const midsToApply = pendingMidsRef.current;
|
|
58
75
|
if (!midsToApply || midsToApply.length === 0)
|
|
@@ -67,6 +84,11 @@ const TMSearchQueryPanel = ({ fromDTD, showBackToResultButton, isExpertMode = SD
|
|
|
67
84
|
}) || [];
|
|
68
85
|
midsToApply.forEach(im => {
|
|
69
86
|
const md = fromDTD.metadata?.find(m => m.id === im.mid);
|
|
87
|
+
// Skip MIDs that don't belong to this TID
|
|
88
|
+
if (!md) {
|
|
89
|
+
console.warn(`MID ${im.mid} does not belong to TID ${fromDTD.id}, skipping`);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
70
92
|
const defaultOperator = getDefaultOperator(md?.dataDomain, md?.dataType);
|
|
71
93
|
let existingWi = newWhere.find(wi => wi.mid === im.mid);
|
|
72
94
|
if (existingWi) {
|
|
@@ -85,7 +107,7 @@ const TMSearchQueryPanel = ({ fromDTD, showBackToResultButton, isExpertMode = SD
|
|
|
85
107
|
});
|
|
86
108
|
setQd({ ...qd, where: newWhere });
|
|
87
109
|
setShowAllMdWhere(true);
|
|
88
|
-
}, [qd, fromDTD]);
|
|
110
|
+
}, [qd, fromDTD, inputMids]);
|
|
89
111
|
// Eseguire la ricerca quando shouldSearch è true e qd è definito
|
|
90
112
|
useEffect(() => {
|
|
91
113
|
if (shouldSearch && qd) {
|
|
@@ -200,8 +222,8 @@ const TMSearchQueryPanel = ({ fromDTD, showBackToResultButton, isExpertMode = SD
|
|
|
200
222
|
const outputMids = qd.where
|
|
201
223
|
.filter(wi => wi.mid && wi.value1 && wi.value1.length > 0)
|
|
202
224
|
.map(wi => ({ mid: wi.mid, value: wi.value1 }));
|
|
203
|
-
passToArchiveCallback(outputMids);
|
|
204
|
-
}, [passToArchiveCallback, qd?.where]);
|
|
225
|
+
passToArchiveCallback(outputMids, fromDTD?.id);
|
|
226
|
+
}, [passToArchiveCallback, qd?.where, fromDTD?.id]);
|
|
205
227
|
const handleCloseFiltersConfig = useCallback(() => setShowFiltersConfig(false), []);
|
|
206
228
|
const handleChooseFilters = useCallback((tid_mids) => {
|
|
207
229
|
if (!fromDTD?.metadata)
|
|
@@ -621,7 +621,7 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
|
|
|
621
621
|
await onRefreshSearchAsync?.();
|
|
622
622
|
} }), isOpenSharedArchive && _jsx(TMModal, { title: "Archiviazione condivisa", onClose: () => {
|
|
623
623
|
setIsOpenSharedArchive(false);
|
|
624
|
-
}, width: isMobile ? '90%' : '
|
|
624
|
+
}, width: isMobile ? '90%' : '60%', height: isMobile ? '90%' : '80%', children: _jsx(TMArchive, { inputDID: focusedItem?.DID, inputTID: focusedItem?.TID, inputMids: currentMetadataValues.filter(md => md.mid && md.mid > 100).map(md => ({ mid: md.mid, value: md.value ?? '' })), isSharedArchive: true, inputFile: sharedDcmtFile, onSavedAsyncCallback: async (tid, did) => {
|
|
625
625
|
setIsOpenSharedArchive(false);
|
|
626
626
|
await onRefreshSearchAsync?.();
|
|
627
627
|
} }) })] }));
|
|
@@ -397,7 +397,7 @@ export const getCommandsMenuItems = (isMobile, dtd, selectedItems, focusedItem,
|
|
|
397
397
|
const sharedDcmtsMenuItem = () => {
|
|
398
398
|
return {
|
|
399
399
|
icon: svgToString(_jsx(IconSharedDcmt, {})),
|
|
400
|
-
text: 'Documenti
|
|
400
|
+
text: 'Documenti condivisi',
|
|
401
401
|
operationType: 'multiRow',
|
|
402
402
|
disabled: disabledForMultiRow(selectedItems, focusedItem),
|
|
403
403
|
items: [
|