@topconsultnpm/sdkui-react 6.20.0 → 6.21.0-dev1.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/NewComponents/FloatingMenuBar/TMFloatingMenuBar.js +7 -1
- package/lib/components/base/TMTreeView.d.ts +2 -1
- package/lib/components/base/TMTreeView.js +8 -3
- package/lib/components/base/TMWaitPanel.js +6 -5
- package/lib/components/choosers/TMUserChooser.js +3 -1
- package/lib/components/features/archive/TMArchive.d.ts +1 -1
- package/lib/components/features/archive/TMArchive.js +2 -2
- package/lib/components/features/documents/TMDcmtBlog.d.ts +1 -0
- package/lib/components/features/documents/TMDcmtBlog.js +2 -1
- package/lib/components/features/documents/TMDcmtForm.d.ts +42 -34
- package/lib/components/features/documents/TMDcmtForm.js +282 -641
- package/lib/components/features/documents/TMDcmtFormActionButtons.d.ts +34 -0
- package/lib/components/features/documents/TMDcmtFormActionButtons.js +124 -0
- package/lib/components/features/documents/TMFileUploader.d.ts +1 -1
- package/lib/components/features/documents/TMFileUploader.js +3 -3
- package/lib/components/features/documents/TMMasterDetailDcmts.d.ts +27 -2
- package/lib/components/features/documents/TMMasterDetailDcmts.js +239 -18
- package/lib/components/features/documents/TMRelationViewer.d.ts +12 -1
- package/lib/components/features/documents/TMRelationViewer.js +48 -10
- package/lib/components/features/search/TMSavedQuerySelector.js +1 -1
- package/lib/components/features/search/TMSearch.d.ts +3 -2
- package/lib/components/features/search/TMSearch.js +3 -3
- package/lib/components/features/search/TMSearchResult.d.ts +28 -26
- package/lib/components/features/search/TMSearchResult.js +364 -487
- package/lib/components/features/search/TMViewHistoryDcmt.js +6 -0
- package/lib/components/features/tasks/TMTaskForm.d.ts +2 -1
- package/lib/components/features/tasks/TMTaskForm.js +2 -2
- package/lib/helper/checkinCheckoutManager.d.ts +1 -1
- package/lib/helper/checkinCheckoutManager.js +25 -6
- package/lib/hooks/useCheckInOutOperations.d.ts +7 -6
- package/lib/hooks/useCheckInOutOperations.js +9 -16
- package/lib/hooks/useDcmtOperations.d.ts +3 -2
- package/lib/hooks/useDcmtOperations.js +2 -2
- package/lib/hooks/useDocumentOperations.d.ts +140 -0
- package/lib/hooks/useDocumentOperations.js +1307 -0
- package/lib/hooks/useRelatedDocuments.d.ts +1 -1
- package/lib/ts/types.d.ts +2 -1
- package/lib/ts/types.js +1 -0
- package/package.json +2 -2
- package/lib/components/features/search/TMSearchResultsMenuItems.d.ts +0 -11
- package/lib/components/features/search/TMSearchResultsMenuItems.js +0 -758
|
@@ -87,6 +87,12 @@ const TMViewHistoryDcmt = (props) => {
|
|
|
87
87
|
IsSigned: row.IsSigned ? row.IsSigned.toString() === '1' : false,
|
|
88
88
|
};
|
|
89
89
|
});
|
|
90
|
+
// Sort by LastUpdateTime ascending
|
|
91
|
+
historyFileItems.sort((a, b) => {
|
|
92
|
+
const dateA = a.LastUpdateTime ? new Date(a.LastUpdateTime).getTime() : 0;
|
|
93
|
+
const dateB = b.LastUpdateTime ? new Date(b.LastUpdateTime).getTime() : 0;
|
|
94
|
+
return dateA - dateB;
|
|
95
|
+
});
|
|
90
96
|
return historyFileItems;
|
|
91
97
|
}
|
|
92
98
|
return [];
|
|
@@ -32,7 +32,8 @@ export interface TMTaskFormProps {
|
|
|
32
32
|
width?: string;
|
|
33
33
|
height?: string;
|
|
34
34
|
usersList?: Array<UserDescriptor>;
|
|
35
|
-
onOpenS4TViewerRequest?: (dcmtInfo: Array<DcmtInfo>,
|
|
35
|
+
onOpenS4TViewerRequest?: (dcmtInfo: Array<DcmtInfo>, refreshDocumentPreview?: (() => Promise<void>)) => void;
|
|
36
|
+
onOpenPdfEditorRequest?: (dcmtInfo: Array<DcmtInfo>, refreshDocumentPreview?: () => Promise<void>) => void;
|
|
36
37
|
s4TViewerDialogComponent?: React.ReactNode;
|
|
37
38
|
}
|
|
38
39
|
declare const TMTaskForm: (props: TMTaskFormProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -18,7 +18,7 @@ const TMTaskForm = (props) => {
|
|
|
18
18
|
const { refreshWorkflowApprove } = useWorkflowApprove();
|
|
19
19
|
const validator = async (taskDescriptor) => { return await taskValidatorAsync(taskDescriptor, requestMoreInfo); };
|
|
20
20
|
// Destructure the props object to extract individual properties
|
|
21
|
-
const { id, title, isModal, formMode, requestMoreInfo = false, visualizedTasks, editTaskCallback, currentTask, setCurrentTask, isContextualCreate = false, selectedRowKeys, handleFocusedRowKeyChange, onStatusChanged, onSaved, onClose, onCancel, taskContext, startDate, endDate, showBackButton = true, hasNavigation = true, width = "100%", height = "100%", usersList, onOpenS4TViewerRequest, s4TViewerDialogComponent, allTasks, getAllTasks, deleteTaskByIdsCallback, addTaskCallback, handleNavigateToWGs, handleNavigateToDossiers } = props;
|
|
21
|
+
const { id, title, isModal, formMode, requestMoreInfo = false, visualizedTasks, editTaskCallback, currentTask, setCurrentTask, isContextualCreate = false, selectedRowKeys, handleFocusedRowKeyChange, onStatusChanged, onSaved, onClose, onCancel, taskContext, startDate, endDate, showBackButton = true, hasNavigation = true, width = "100%", height = "100%", usersList, onOpenS4TViewerRequest, onOpenPdfEditorRequest, s4TViewerDialogComponent, allTasks, getAllTasks, deleteTaskByIdsCallback, addTaskCallback, handleNavigateToWGs, handleNavigateToDossiers } = props;
|
|
22
22
|
const sfo = new SaveFormOptions();
|
|
23
23
|
sfo.objClass = ObjectClasses.Task;
|
|
24
24
|
const customizeFormData = (task) => {
|
|
@@ -305,6 +305,6 @@ const TMTaskForm = (props) => {
|
|
|
305
305
|
justifyContent: 'flex-end',
|
|
306
306
|
alignItems: 'center'
|
|
307
307
|
}, children: _jsx(TaskFormAssignmentNoticeBadge, { task: formData, users: users, requestMoreInfo: requestMoreInfo }) })), (showDcmtForm && formData?.iD1 && formData?.iD2) &&
|
|
308
|
-
_jsx(TMDcmtForm, { titleModal: formData.iD1Name ?? '-', isModal: true, TID: formData.iD1, DID: formData.iD2, allowButtonsRefs: true, moreInfoTasks: getMoreInfoTasksForDocument(allTasks, formData?.iD1, formData?.iD2), onWFOperationCompleted: refreshWorkflowApprove, onTaskCompleted: onTaskCompleted, onClose: () => { setShowDcmtForm(false); }, onOpenS4TViewerRequest: onOpenS4TViewerRequest, s4TViewerDialogComponent: s4TViewerDialogComponent, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, onReferenceClick: handleNavigateToReference })] }), formData && showChangeStateForm && _jsx(TMChangeStateForm, { formData: formData, formDataOrig: formDataOrig, handleShowChangeStateForm: handleShowChangeStateForm, setFormData: setFormData })] }) }));
|
|
308
|
+
_jsx(TMDcmtForm, { titleModal: formData.iD1Name ?? '-', isModal: true, TID: formData.iD1, DID: formData.iD2, allowButtonsRefs: true, moreInfoTasks: getMoreInfoTasksForDocument(allTasks, formData?.iD1, formData?.iD2), onWFOperationCompleted: refreshWorkflowApprove, onTaskCompleted: onTaskCompleted, onClose: () => { setShowDcmtForm(false); }, onOpenS4TViewerRequest: onOpenS4TViewerRequest, onOpenPdfEditorRequest: onOpenPdfEditorRequest, s4TViewerDialogComponent: s4TViewerDialogComponent, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, onReferenceClick: handleNavigateToReference })] }), formData && showChangeStateForm && _jsx(TMChangeStateForm, { formData: formData, formDataOrig: formDataOrig, handleShowChangeStateForm: handleShowChangeStateForm, setFormData: setFormData })] }) }));
|
|
309
309
|
};
|
|
310
310
|
export default TMTaskForm;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { AccessLevels, CICO_MetadataNames, SDK_Globals, SystemMIDsAsNumber } from "@topconsultnpm/sdk-ts";
|
|
3
3
|
import TMTooltip from "../components/base/TMTooltip";
|
|
4
|
-
import { Globalization, SDKUI_Globals, SDKUI_Localizator } from "./index";
|
|
4
|
+
import { dcmtsFileCachePreview, Globalization, removeDcmtsFileCache, SDKUI_Globals, SDKUI_Localizator } from "./index";
|
|
5
5
|
import { DownloadTypes } from "../ts/types";
|
|
6
6
|
const findCheckOutUserName = (users, checkoutUserId) => {
|
|
7
7
|
let checkOutUser = users.find(user => user.id === checkoutUserId);
|
|
@@ -67,11 +67,15 @@ export const cicoDownloadFilesCallback = async (sources, checkout, downloadDcmts
|
|
|
67
67
|
const newItem = { TID: tid.toString(), DID: did.toString(), checkoutFolder: "", checkoutName: fileName };
|
|
68
68
|
updateCicoCheckoutStorageItem(newItem, source.type, "addOrUpdate");
|
|
69
69
|
}
|
|
70
|
+
const cacheKey = `${tid}-${did}`;
|
|
71
|
+
if (dcmtsFileCachePreview.has(cacheKey))
|
|
72
|
+
removeDcmtsFileCache(cacheKey);
|
|
70
73
|
files.push({ TID: tid, DID: did, FILEEXT: ext, fileName });
|
|
71
74
|
}
|
|
72
75
|
});
|
|
73
|
-
if (files.length > 0)
|
|
76
|
+
if (files.length > 0) {
|
|
74
77
|
await downloadDcmtsAsync(files, DownloadTypes.Dcmt, "download");
|
|
78
|
+
}
|
|
75
79
|
};
|
|
76
80
|
export const updateCicoCheckoutStorageItem = (item, type, action = "addOrUpdate") => {
|
|
77
81
|
// Select the appropriate array based on type
|
|
@@ -255,13 +259,15 @@ export const getDcmtCicoStatus = (dcmt, allUsers, dtd) => {
|
|
|
255
259
|
let checkoutDate;
|
|
256
260
|
let version = 1;
|
|
257
261
|
let fileExt;
|
|
262
|
+
let isMetadata = false;
|
|
258
263
|
// ========================================================================
|
|
259
|
-
// CASO 1: Documento come Array di MetadataValueDescriptorEx
|
|
264
|
+
// CASO 1: Documento come Array di MetadataValueDescriptorEx: Form del documento
|
|
260
265
|
// ========================================================================
|
|
261
266
|
// Questo formato viene utilizzato quando il documento proviene da query
|
|
262
267
|
// o liste dove ogni metadato è un oggetto separato con proprietà 'md' e 'value'
|
|
263
268
|
if (Array.isArray(dcmt) && dcmt.length > 0 && dcmt[0]?.md !== undefined) {
|
|
264
269
|
const dcmtsArray = dcmt;
|
|
270
|
+
console.log("dcmtsArray:", dcmtsArray);
|
|
265
271
|
// Estrai l'ID dell'utente che ha effettuato il checkout
|
|
266
272
|
const checkoutUserIdProperty = dcmtsArray.find((item) => item.md?.name === CICO_MetadataNames.CICO_CheckoutUserID);
|
|
267
273
|
const checkoutUserIdValue = checkoutUserIdProperty?.value;
|
|
@@ -275,9 +281,11 @@ export const getDcmtCicoStatus = (dcmt, allUsers, dtd) => {
|
|
|
275
281
|
version = (versionRaw != null && !isNaN(Number(versionRaw))) ? Number(versionRaw) : 1;
|
|
276
282
|
const fileExtProperty = dcmtsArray.find((item) => item.mid === SystemMIDsAsNumber.FileExt);
|
|
277
283
|
fileExt = fileExtProperty?.value ? fileExtProperty.value.toString() : null;
|
|
284
|
+
const fileCountProperty = dcmtsArray.find((item) => item.mid === SystemMIDsAsNumber.FileCount);
|
|
285
|
+
isMetadata = !(fileCountProperty?.value && Number(fileCountProperty.value) > 0);
|
|
278
286
|
}
|
|
279
287
|
// ========================================================================
|
|
280
|
-
// CASO 2: Documento come Oggetto Piatto (formato standard)
|
|
288
|
+
// CASO 2: Documento come Oggetto Piatto (formato standard): Risultato della ricerca
|
|
281
289
|
// ========================================================================
|
|
282
290
|
// Questo formato viene utilizzato quando il documento ha proprietà dirette
|
|
283
291
|
// nel formato chiave-valore: TID, DID, e "TID_MetadataID" per i metadati
|
|
@@ -286,6 +294,8 @@ export const getDcmtCicoStatus = (dcmt, allUsers, dtd) => {
|
|
|
286
294
|
const CICO_CheckoutUserID_Meta = dtd.metadata?.find(md => md.name === CICO_MetadataNames.CICO_CheckoutUserID);
|
|
287
295
|
const CICO_CheckoutDate_Meta = dtd.metadata?.find(md => md.name === CICO_MetadataNames.CICO_CheckoutDate);
|
|
288
296
|
const CICO_Version_Meta = dtd.metadata?.find(md => md.name === CICO_MetadataNames.CICO_Version);
|
|
297
|
+
const fileCountValue = dcmt.FILECOUNT != null ? Number(dcmt.FILECOUNT) : NaN;
|
|
298
|
+
isMetadata = isNaN(fileCountValue) || fileCountValue <= 0;
|
|
289
299
|
fileExt = dcmt.FILEEXT ? dcmt.FILEEXT.toString() : null;
|
|
290
300
|
// Estrai l'ID dell'utente che ha effettuato il checkout
|
|
291
301
|
if (CICO_CheckoutUserID_Meta?.id) {
|
|
@@ -306,6 +316,15 @@ export const getDcmtCicoStatus = (dcmt, allUsers, dtd) => {
|
|
|
306
316
|
}
|
|
307
317
|
}
|
|
308
318
|
// ========================================================================
|
|
319
|
+
// EARLY RETURN: Documento di soli metadati (senza file)
|
|
320
|
+
// ========================================================================
|
|
321
|
+
if (isMetadata) {
|
|
322
|
+
return {
|
|
323
|
+
cicoEnabled: false,
|
|
324
|
+
checkoutStatus: { isCheckedOut: false, mode: '', version: 1, icon: null, editLockTooltipText: null }
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
// ========================================================================
|
|
309
328
|
// COSTRUZIONE DELLO STATO DI CHECKOUT
|
|
310
329
|
// ========================================================================
|
|
311
330
|
let checkoutStatus = {
|
|
@@ -341,8 +360,8 @@ export const getDcmtCicoStatus = (dcmt, allUsers, dtd) => {
|
|
|
341
360
|
// RESTITUZIONE RISULTATO FINALE
|
|
342
361
|
// ========================================================================
|
|
343
362
|
return {
|
|
344
|
-
// CICO è abilitato se configurato nel DTD
|
|
345
|
-
cicoEnabled: cicoInfo.CICO === 1 && cicoInfo.CanCICO === AccessLevels.Yes && fileExt !== null && fileExt !== '',
|
|
363
|
+
// CICO è abilitato se configurato nel DTD, l'utente ha i permessi e il documento non è di soli metadati
|
|
364
|
+
cicoEnabled: cicoInfo.CICO === 1 && cicoInfo.CanCICO === AccessLevels.Yes && fileExt !== null && fileExt !== '' && !isMetadata,
|
|
346
365
|
checkoutStatus: checkoutStatus
|
|
347
366
|
};
|
|
348
367
|
};
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { DcmtInfo, DownloadModes, DownloadTypes } from '../ts';
|
|
2
2
|
import { FileDescriptor, SearchResultDescriptor } from '@topconsultnpm/sdk-ts';
|
|
3
|
-
interface
|
|
3
|
+
export interface UseCheckInOutOperationsProps {
|
|
4
|
+
onRefreshPreview: () => Promise<void>;
|
|
5
|
+
}
|
|
6
|
+
export interface UseCheckInOutOperationsReturn {
|
|
4
7
|
showHistory: boolean;
|
|
5
8
|
showHistoryCallback: () => void;
|
|
6
9
|
hideHistoryCallback: () => void;
|
|
@@ -14,9 +17,8 @@ interface UseCheckInOutOperationsReturn {
|
|
|
14
17
|
};
|
|
15
18
|
hideCommentFormCallback: () => void;
|
|
16
19
|
copyCheckoutPathToClipboardCallback: (dcmt: DcmtInfo, filename: string) => void;
|
|
17
|
-
handleCheckOutCallback: (dcmt: DcmtInfo, checkout: boolean, filename: string, downloadDcmtsAsync: (inputDcmts: Array<DcmtInfo> | undefined, downloadType?: DownloadTypes, downloadMode?: DownloadModes, onFileDownloaded?: (dcmtFile: File) => void, confirmAttachments?: (list: FileDescriptor[]) => Promise<string[] | undefined>, skipConfirmation?: boolean) => Promise<void>,
|
|
18
|
-
handleCheckInCallback: (dcmt: DcmtInfo,
|
|
19
|
-
refreshPreviewTrigger: number;
|
|
20
|
+
handleCheckOutCallback: (dcmt: DcmtInfo, checkout: boolean, filename: string, downloadDcmtsAsync: (inputDcmts: Array<DcmtInfo> | undefined, downloadType?: DownloadTypes, downloadMode?: DownloadModes, onFileDownloaded?: (dcmtFile: File) => void, confirmAttachments?: (list: FileDescriptor[]) => Promise<string[] | undefined>, skipConfirmation?: boolean) => Promise<void>, onRefreshAsync?: (tid: number | undefined, did: number | undefined, refreshUI?: boolean, metadataResult?: SearchResultDescriptor | null) => Promise<void>) => Promise<void>;
|
|
21
|
+
handleCheckInCallback: (dcmt: DcmtInfo, onRefreshAsync?: (tid: number | undefined, did: number | undefined, refreshUI?: boolean, metadataResult?: SearchResultDescriptor | null) => Promise<void>) => Promise<void>;
|
|
20
22
|
showCicoWaitPanel: boolean;
|
|
21
23
|
cicoWaitPanelTitle: string;
|
|
22
24
|
showCicoPrimaryProgress: boolean;
|
|
@@ -24,5 +26,4 @@ interface UseCheckInOutOperationsReturn {
|
|
|
24
26
|
cicoPrimaryProgressValue: number;
|
|
25
27
|
cicoPrimaryProgressMax: number;
|
|
26
28
|
}
|
|
27
|
-
export declare const useCheckInOutOperations: () => UseCheckInOutOperationsReturn;
|
|
28
|
-
export {};
|
|
29
|
+
export declare const useCheckInOutOperations: (props: UseCheckInOutOperationsProps) => UseCheckInOutOperationsReturn;
|
|
@@ -3,12 +3,11 @@ import { cicoDownloadFilesCallback, dcmtsFileCachePreview, getCicoDownloadFileNa
|
|
|
3
3
|
import { ButtonNames, ShowAlert, TMMessageBoxManager, TMResultManager } from '../components';
|
|
4
4
|
import { ResultTypes, SDK_Globals } from '@topconsultnpm/sdk-ts';
|
|
5
5
|
let abortController = new AbortController();
|
|
6
|
-
export const useCheckInOutOperations = () => {
|
|
6
|
+
export const useCheckInOutOperations = (props) => {
|
|
7
|
+
const { onRefreshPreview } = props;
|
|
7
8
|
const [showHistory, setShowHistory] = useState(false);
|
|
8
9
|
// State to manage show history selected file
|
|
9
10
|
const [showCheckoutInformationForm, setShowCheckoutInformationForm] = useState(false);
|
|
10
|
-
// Stato per triggerare il refresh della preview dall'esterno
|
|
11
|
-
const [refreshPreviewTrigger, setRefreshPreviewTrigger] = useState(0);
|
|
12
11
|
// State to manage comment form
|
|
13
12
|
const [commentFormState, setCommentFormState] = useState({
|
|
14
13
|
removeAndEditAttachment: true,
|
|
@@ -39,9 +38,6 @@ export const useCheckInOutOperations = () => {
|
|
|
39
38
|
const hideCheckoutInformationFormCallback = useCallback(() => {
|
|
40
39
|
setShowCheckoutInformationForm(false);
|
|
41
40
|
}, []);
|
|
42
|
-
const triggerPreviewRefresh = useCallback(() => {
|
|
43
|
-
setRefreshPreviewTrigger(prev => prev + 1);
|
|
44
|
-
}, []);
|
|
45
41
|
const hideCommentFormCallback = useCallback(() => {
|
|
46
42
|
setCommentFormState(prev => ({ ...prev, show: false }));
|
|
47
43
|
}, []);
|
|
@@ -60,7 +56,7 @@ export const useCheckInOutOperations = () => {
|
|
|
60
56
|
ShowAlert({ message: err, mode: 'error', duration: 5000, title: SDKUI_Localizator.OperationResult });
|
|
61
57
|
});
|
|
62
58
|
};
|
|
63
|
-
const handleCheckOutCallback = async (dcmt, checkout, filename, downloadDcmtsAsync,
|
|
59
|
+
const handleCheckOutCallback = async (dcmt, checkout, filename, downloadDcmtsAsync, onRefreshAsync) => {
|
|
64
60
|
if (!dcmt)
|
|
65
61
|
throw new Error("Document info is required");
|
|
66
62
|
const title = checkout ? 'Check out' : SDKUI_Localizator.CancelCheckOut;
|
|
@@ -88,8 +84,7 @@ export const useCheckInOutOperations = () => {
|
|
|
88
84
|
.then(async () => {
|
|
89
85
|
await cicoDownloadFilesCallback([{ type: 'dcmtInfo', dcmtInfo: dcmt, originalFileName: filename }], true, downloadDcmtsAsync);
|
|
90
86
|
result.push({ rowIndex: 1, id1: dcmt.TID, id2: dcmt.DID, description: SDKUI_Localizator.UpdateCompletedSuccessfully, resultType: ResultTypes.SUCCESS });
|
|
91
|
-
await
|
|
92
|
-
await refreshFocusedDataRowAsync?.(dcmt.TID, dcmt.DID, true);
|
|
87
|
+
await onRefreshAsync?.(dcmt.TID, dcmt.DID, true);
|
|
93
88
|
})
|
|
94
89
|
.catch((error) => {
|
|
95
90
|
result.push({ rowIndex: 1, id1: dcmt.TID, id2: dcmt.DID, resultType: ResultTypes.ERROR, description: getExceptionMessage(error) });
|
|
@@ -102,8 +97,7 @@ export const useCheckInOutOperations = () => {
|
|
|
102
97
|
result.push({ rowIndex: 1, id1: dcmt.TID, id2: dcmt.DID, description: SDKUI_Localizator.UpdateCompletedSuccessfully, resultType: ResultTypes.SUCCESS });
|
|
103
98
|
// Remove the corresponding draft checkout item
|
|
104
99
|
updateCicoCheckoutStorageItem({ TID: dcmt.TID.toString(), DID: dcmt.DID.toString(), checkoutFolder: "", checkoutName: "" }, "dcmtInfo", "remove");
|
|
105
|
-
await
|
|
106
|
-
await refreshFocusedDataRowAsync?.(dcmt.TID, dcmt.DID, true);
|
|
100
|
+
await onRefreshAsync?.(dcmt.TID, dcmt.DID, true);
|
|
107
101
|
})
|
|
108
102
|
.catch((error) => {
|
|
109
103
|
result.push({ rowIndex: 0, id1: dcmt.TID, id2: dcmt.DID, resultType: ResultTypes.ERROR, description: getExceptionMessage(error) });
|
|
@@ -133,7 +127,7 @@ export const useCheckInOutOperations = () => {
|
|
|
133
127
|
});
|
|
134
128
|
}
|
|
135
129
|
};
|
|
136
|
-
const handleCheckInCallback = async (dcmt,
|
|
130
|
+
const handleCheckInCallback = async (dcmt, onRefreshAsync) => {
|
|
137
131
|
if (!dcmt)
|
|
138
132
|
throw new Error("Document info is required");
|
|
139
133
|
// Create a new file input element
|
|
@@ -175,12 +169,12 @@ export const useCheckInOutOperations = () => {
|
|
|
175
169
|
// Remove the corresponding draft checkout item
|
|
176
170
|
updateCicoCheckoutStorageItem({ TID: dcmt.TID.toString(), DID: dcmt.DID.toString(), checkoutFolder: "", checkoutName: "" }, "dcmtInfo", "remove");
|
|
177
171
|
result.push({ rowIndex: i, id1: dcmt.DID, id2: dcmt.DID, description: SDKUI_Localizator.UpdateCompletedSuccessfully, resultType: ResultTypes.SUCCESS });
|
|
178
|
-
await
|
|
179
|
-
|
|
172
|
+
await onRefreshAsync?.(dcmt.TID, dcmt.DID, true);
|
|
173
|
+
// remove file from preview cache to force refresh with the new checked-in file
|
|
180
174
|
const cacheKey = `${dcmt.TID}-${dcmt.DID}`;
|
|
181
175
|
if (dcmtsFileCachePreview.has(cacheKey))
|
|
182
176
|
removeDcmtsFileCache(cacheKey);
|
|
183
|
-
|
|
177
|
+
await onRefreshPreview();
|
|
184
178
|
triggerCommentOnFileAdd([dcmt.DID]);
|
|
185
179
|
}
|
|
186
180
|
}
|
|
@@ -212,7 +206,6 @@ export const useCheckInOutOperations = () => {
|
|
|
212
206
|
copyCheckoutPathToClipboardCallback,
|
|
213
207
|
handleCheckOutCallback,
|
|
214
208
|
handleCheckInCallback,
|
|
215
|
-
refreshPreviewTrigger,
|
|
216
209
|
showCicoWaitPanel,
|
|
217
210
|
cicoWaitPanelTitle,
|
|
218
211
|
showCicoPrimaryProgress,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RetrieveFileOptions, FileDescriptor } from '@topconsultnpm/sdk-ts';
|
|
2
2
|
import { DcmtInfo, DcmtOperationTypes, DownloadModes, DownloadTypes } from '../ts';
|
|
3
|
-
export
|
|
3
|
+
export interface UseDcmtOperationsReturn {
|
|
4
4
|
abortController: AbortController;
|
|
5
5
|
showWaitPanel: boolean;
|
|
6
6
|
showPrimary: boolean;
|
|
@@ -21,4 +21,5 @@ export declare function useDcmtOperations(): {
|
|
|
21
21
|
removeDcmtsFileCache: (key: string) => void;
|
|
22
22
|
isDcmtFileInCache: (key: string) => boolean;
|
|
23
23
|
runOperationAsync: (inputDcmts: DcmtInfo[] | undefined, dcmtOperationType: DcmtOperationTypes, actionAfterOperationAsync?: () => Promise<void>) => Promise<void>;
|
|
24
|
-
}
|
|
24
|
+
}
|
|
25
|
+
export declare const useDcmtOperations: () => UseDcmtOperationsReturn;
|
|
@@ -20,7 +20,7 @@ const getDownloadFileName = (fileName) => {
|
|
|
20
20
|
return fileName;
|
|
21
21
|
return `${fileName.slice(0, firstDot)}(${count})${fileName.slice(firstDot)}`;
|
|
22
22
|
};
|
|
23
|
-
export
|
|
23
|
+
export const useDcmtOperations = () => {
|
|
24
24
|
const [showWaitPanel, setShowWaitPanel] = useState(false);
|
|
25
25
|
const [waitPanelTitle, setWaitPanelTitle] = useState('');
|
|
26
26
|
const [showPrimary, setShowPrimary] = useState(false);
|
|
@@ -495,4 +495,4 @@ export function useDcmtOperations() {
|
|
|
495
495
|
abortController, showWaitPanel, showPrimary, waitPanelTitle, waitPanelTextPrimary, waitPanelValuePrimary, waitPanelMaxValuePrimary, showSecondary, waitPanelTextSecondary, waitPanelValueSecondary, waitPanelMaxValueSecondary,
|
|
496
496
|
downloadDcmtsAsync, getDcmtFileAsync, clearDcmtsFileCache, removeDcmtsFileCache, isDcmtFileInCache, runOperationAsync
|
|
497
497
|
};
|
|
498
|
-
}
|
|
498
|
+
};
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import React, { RefObject } from "react";
|
|
2
|
+
import { DcmtTypeDescriptor, FileFormats, HomeBlogPost, LayoutDescriptor, LayoutModes, ObjectRef, SearchResultDescriptor, TaskDescriptor, UserDescriptor, WorkingGroupDescriptor } from "@topconsultnpm/sdk-ts";
|
|
3
|
+
import { IColumnProps } from "devextreme-react/cjs/data-grid";
|
|
4
|
+
import { TMContextMenuItemProps } from '../components/NewComponents/ContextMenu/types';
|
|
5
|
+
import { DcmtInfo, MetadataValueDescriptorEx, SearchResultContext, TaskContext } from "../ts";
|
|
6
|
+
import { UseCheckInOutOperationsReturn } from "./useCheckInOutOperations";
|
|
7
|
+
import { UseDcmtOperationsReturn } from "./useDcmtOperations";
|
|
8
|
+
import { UseRelatedDocumentsReturn } from "./useRelatedDocuments";
|
|
9
|
+
export interface DocumentDataProps {
|
|
10
|
+
dtd: DcmtTypeDescriptor | undefined;
|
|
11
|
+
selectedItems: Array<any>;
|
|
12
|
+
focusedItem: any;
|
|
13
|
+
currentSearchResults: Array<SearchResultDescriptor>;
|
|
14
|
+
currentMetadataValues: Array<MetadataValueDescriptorEx>;
|
|
15
|
+
allUsers?: Array<UserDescriptor>;
|
|
16
|
+
searchResult?: SearchResultDescriptor;
|
|
17
|
+
datagridUtility?: {
|
|
18
|
+
visibleItems?: any[];
|
|
19
|
+
onRefreshSearchAsyncDatagrid?: () => Promise<void>;
|
|
20
|
+
onRefreshDataRowsAsync?: (() => Promise<void>);
|
|
21
|
+
refreshFocusedDataRowAsync?: (tid: number | undefined, did: number | undefined, refreshUI?: boolean, metadataResult?: SearchResultDescriptor | null) => Promise<void>;
|
|
22
|
+
onRefreshBlogDatagrid?: () => Promise<void>;
|
|
23
|
+
onRefreshPreviewDatagrid?: () => Promise<void>;
|
|
24
|
+
refreshOperationsTrigger?: number;
|
|
25
|
+
onRefreshOperationsDatagrid?: () => Promise<void>;
|
|
26
|
+
};
|
|
27
|
+
dcmtUtility?: {
|
|
28
|
+
approvalVID?: number;
|
|
29
|
+
dcmtDataRowForCicoStatus?: Array<MetadataValueDescriptorEx> | any;
|
|
30
|
+
selectedDcmtSearchResultRelations?: SearchResultDescriptor;
|
|
31
|
+
dcmtTIDHasDetailRelations?: boolean;
|
|
32
|
+
dcmtTIDHasMasterRelations?: boolean;
|
|
33
|
+
updateCurrentDcmt?: () => Promise<void>;
|
|
34
|
+
onCloseDcmtForm?: () => void;
|
|
35
|
+
onRefreshBlogForm?: () => Promise<void>;
|
|
36
|
+
onRefreshPreviewForm?: () => Promise<void>;
|
|
37
|
+
taskFormDialogComponent?: React.ReactNode;
|
|
38
|
+
s4TViewerDialogComponent?: React.ReactNode;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export interface ExportDataProps {
|
|
42
|
+
dataColumns?: Array<IColumnProps>;
|
|
43
|
+
dataSource?: Array<any>;
|
|
44
|
+
selectedRowKeys?: Array<number>;
|
|
45
|
+
}
|
|
46
|
+
export interface UIConfigProps {
|
|
47
|
+
floatingBarContainerRef?: RefObject<HTMLElement | null>;
|
|
48
|
+
customButtonsLayout?: LayoutDescriptor;
|
|
49
|
+
workingGroupContext?: WorkingGroupDescriptor;
|
|
50
|
+
allowFloatingBar?: boolean;
|
|
51
|
+
enablePinIcons?: boolean;
|
|
52
|
+
openDcmtFormAsModal?: boolean;
|
|
53
|
+
showDcmtFormSidebar?: boolean;
|
|
54
|
+
allowRelations?: boolean;
|
|
55
|
+
openS4TViewer?: boolean;
|
|
56
|
+
editPdfForm?: boolean;
|
|
57
|
+
showTodoDcmtForm?: boolean;
|
|
58
|
+
showToppyDraggableHelpCenter?: boolean;
|
|
59
|
+
toppyHelpCenterUsePortal?: boolean;
|
|
60
|
+
inputDcmtFormLayoutMode?: LayoutModes;
|
|
61
|
+
}
|
|
62
|
+
export interface TasksProps {
|
|
63
|
+
allTasks?: Array<TaskDescriptor>;
|
|
64
|
+
getAllTasks?: () => Promise<void>;
|
|
65
|
+
deleteTaskByIdsCallback?: (deletedTaskIds: Array<number>) => Promise<void>;
|
|
66
|
+
addTaskCallback?: (task: TaskDescriptor) => Promise<void>;
|
|
67
|
+
editTaskCallback?: (task: TaskDescriptor) => Promise<void>;
|
|
68
|
+
}
|
|
69
|
+
export interface OperationCallbacks {
|
|
70
|
+
onRefreshSearchAsync?: (() => Promise<void>);
|
|
71
|
+
onSavedAsyncCallback?: (tid: number | undefined, did: number | undefined, metadataResult?: SearchResultDescriptor | null) => Promise<void>;
|
|
72
|
+
onRefreshAfterAddDcmtToFavs?: () => void;
|
|
73
|
+
onWFOperationCompleted?: () => Promise<void>;
|
|
74
|
+
canNavigateHandler?: (dir: "next" | "prev") => boolean;
|
|
75
|
+
onNavigateHandler?: (dir: "next" | "prev") => void;
|
|
76
|
+
handleNavigateToWGs?: (value: HomeBlogPost | number) => Promise<void>;
|
|
77
|
+
handleNavigateToDossiers?: (value: HomeBlogPost | number) => Promise<void>;
|
|
78
|
+
onReferenceClick?: (ref: ObjectRef) => void;
|
|
79
|
+
openAddDocumentForm?: () => void;
|
|
80
|
+
openCommentFormCallback?: ((documents: Array<DcmtInfo>) => void);
|
|
81
|
+
onFileOpened?: (blob: File | undefined) => void;
|
|
82
|
+
passToArchiveCallback?: (outputMids: Array<{
|
|
83
|
+
mid: number;
|
|
84
|
+
value: string;
|
|
85
|
+
}>, tid?: number) => void;
|
|
86
|
+
openWGsCopyMoveForm?: (mode: "copyToWgDraft" | "copyToWgArchivedDoc", dcmtTypeDescriptor: DcmtTypeDescriptor, documents: Array<DcmtInfo>) => void;
|
|
87
|
+
onOpenS4TViewerRequest?: (dcmtInfo: Array<DcmtInfo>, refreshDocumentPreview?: () => Promise<void>) => void;
|
|
88
|
+
onOpenPdfEditorRequest?: (dcmtInfo: Array<DcmtInfo>, refreshDocumentPreview?: () => Promise<void>) => void;
|
|
89
|
+
openFileUploaderPdfEditor?: (fromDTD?: DcmtTypeDescriptor, file?: File | null, handleFile?: (file: File) => void) => void;
|
|
90
|
+
onTaskCreateRequest?: (taskContext: TaskContext, onTaskCreated?: (task?: TaskDescriptor) => void) => void;
|
|
91
|
+
openTaskFormHandler?: (onTaskCreated?: (task?: TaskDescriptor) => void) => void;
|
|
92
|
+
}
|
|
93
|
+
interface UseDocumentOperationsProps {
|
|
94
|
+
context: SearchResultContext;
|
|
95
|
+
documentData: DocumentDataProps;
|
|
96
|
+
uiConfig: UIConfigProps;
|
|
97
|
+
tasks: TasksProps;
|
|
98
|
+
callbacks: OperationCallbacks;
|
|
99
|
+
exportData?: ExportDataProps;
|
|
100
|
+
}
|
|
101
|
+
export interface UseDocumentOperationsResult {
|
|
102
|
+
operationItems: Array<TMContextMenuItemProps>;
|
|
103
|
+
renderFloatingBar: React.ReactNode;
|
|
104
|
+
renderDcmtOperations: React.ReactNode;
|
|
105
|
+
features: {
|
|
106
|
+
isOpenDcmtForm: boolean;
|
|
107
|
+
openFormHandler: (layoutMode: LayoutModes) => void;
|
|
108
|
+
dcmtFormLayoutMode: LayoutModes;
|
|
109
|
+
onDcmtFormOpenChange: (isOpen: boolean, layoutMode: LayoutModes) => void;
|
|
110
|
+
isOpenBatchUpdate: boolean;
|
|
111
|
+
isModifiedBatchUpdate: boolean;
|
|
112
|
+
updateBatchUpdateForm: (value: boolean) => void;
|
|
113
|
+
handleSignApprove: () => void;
|
|
114
|
+
showSearchTMDatagrid: boolean;
|
|
115
|
+
showExportForm: boolean;
|
|
116
|
+
checkoutInfo: UseCheckInOutOperationsReturn;
|
|
117
|
+
relatedDocumentsInfo: UseRelatedDocumentsReturn;
|
|
118
|
+
dcmtOperations: UseDcmtOperationsReturn;
|
|
119
|
+
toppyOperations: {
|
|
120
|
+
showApprovePopup: boolean;
|
|
121
|
+
showRejectPopup: boolean;
|
|
122
|
+
showReAssignPopup: boolean;
|
|
123
|
+
showMoreInfoPopup: boolean;
|
|
124
|
+
updateShowApprovePopup: (value: boolean) => void;
|
|
125
|
+
updateShowRejectPopup: (value: boolean) => void;
|
|
126
|
+
updateShowReAssignPopup: (value: boolean) => void;
|
|
127
|
+
updateShowMoreInfoPopup: (value: boolean) => void;
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
export interface ExportData {
|
|
132
|
+
dataColumns?: Array<IColumnProps>;
|
|
133
|
+
dataSource?: Array<any>;
|
|
134
|
+
selectedRowKeys?: Array<number>;
|
|
135
|
+
searchResult?: SearchResultDescriptor;
|
|
136
|
+
}
|
|
137
|
+
export declare const getSelectedDcmtsOrFocused: (selectedItems: Array<any>, focusedItem: any, fileFormat?: FileFormats) => DcmtInfo[];
|
|
138
|
+
export declare const getAllFieldSelectedDcmtsOrFocused: (selectedItems: Array<any>, focusedItem: any, fileFormat?: FileFormats) => any[];
|
|
139
|
+
export declare const useDocumentOperations: (props: UseDocumentOperationsProps) => UseDocumentOperationsResult;
|
|
140
|
+
export {};
|