@topconsultnpm/sdkui-react 6.20.0-dev1.2 → 6.20.0-dev1.21
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/ContextMenu/TMContextMenu.js +3 -3
- package/lib/components/NewComponents/ContextMenu/hooks.d.ts +1 -0
- package/lib/components/NewComponents/ContextMenu/hooks.js +8 -4
- package/lib/components/NewComponents/ContextMenu/styles.d.ts +4 -1
- package/lib/components/NewComponents/ContextMenu/styles.js +41 -8
- package/lib/components/NewComponents/ContextMenu/types.d.ts +1 -0
- package/lib/components/NewComponents/FloatingMenuBar/TMFloatingMenuBar.js +38 -30
- package/lib/components/NewComponents/FloatingMenuBar/styles.d.ts +8 -0
- package/lib/components/NewComponents/FloatingMenuBar/styles.js +30 -19
- package/lib/components/base/TMAccordion.js +2 -2
- package/lib/components/base/TMCustomButton.js +0 -1
- package/lib/components/base/TMDataGrid.d.ts +2 -2
- package/lib/components/base/TMDataGrid.js +16 -5
- package/lib/components/editors/TMHtmlEditor.js +1 -1
- package/lib/components/editors/TMMetadataValues.js +20 -2
- package/lib/components/features/documents/TMDcmtBlog.d.ts +1 -7
- package/lib/components/features/documents/TMDcmtBlog.js +29 -2
- package/lib/components/features/documents/TMDcmtForm.js +270 -173
- package/lib/components/features/documents/TMDcmtPreview.js +100 -33
- package/lib/components/features/search/TMDcmtCheckoutInfoForm.d.ts +8 -0
- package/lib/components/features/search/{TMSearchResultCheckoutInfoForm.js → TMDcmtCheckoutInfoForm.js} +6 -11
- package/lib/components/features/search/TMSearchQueryPanel.js +13 -12
- package/lib/components/features/search/TMSearchResult.js +76 -114
- package/lib/components/features/search/TMSearchResultsMenuItems.d.ts +1 -1
- package/lib/components/features/search/TMSearchResultsMenuItems.js +16 -17
- package/lib/components/features/search/TMViewHistoryDcmt.js +1 -1
- package/lib/components/forms/Login/TMLoginForm.js +2 -0
- package/lib/css/tm-sdkui.css +1 -1
- package/lib/helper/SDKUI_Globals.d.ts +13 -14
- package/lib/helper/SDKUI_Globals.js +9 -0
- package/lib/helper/SDKUI_Localizator.d.ts +8 -0
- package/lib/helper/SDKUI_Localizator.js +98 -0
- package/lib/helper/TMUtils.d.ts +3 -1
- package/lib/helper/TMUtils.js +51 -0
- package/lib/helper/checkinCheckoutManager.d.ts +85 -0
- package/lib/helper/checkinCheckoutManager.js +348 -0
- package/lib/helper/devextremeCustomMessages.d.ts +30 -0
- package/lib/helper/devextremeCustomMessages.js +30 -0
- package/lib/helper/helpers.js +7 -1
- package/lib/helper/index.d.ts +1 -0
- package/lib/helper/index.js +1 -0
- package/lib/helper/queryHelper.js +29 -0
- package/lib/hooks/useCheckInOutOperations.d.ts +28 -0
- package/lib/hooks/useCheckInOutOperations.js +223 -0
- package/lib/services/platform_services.d.ts +1 -1
- package/package.json +12 -10
- package/lib/components/features/search/TMSearchResultCheckoutInfoForm.d.ts +0 -8
- package/lib/helper/cicoHelper.d.ts +0 -31
- package/lib/helper/cicoHelper.js +0 -155
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { useCallback, useState } from 'react';
|
|
2
|
+
import { cicoDownloadFilesCallback, dcmtsFileCachePreview, getCicoDownloadFileName, getExceptionMessage, removeDcmtsFileCache, renderCicoCheckInContent, SDKUI_Globals, SDKUI_Localizator, updateCicoCheckoutStorageItem, validateCicoFileName } from '../helper';
|
|
3
|
+
import { ButtonNames, ShowAlert, TMMessageBoxManager, TMResultManager } from '../components';
|
|
4
|
+
import { ResultTypes, SDK_Globals } from '@topconsultnpm/sdk-ts';
|
|
5
|
+
let abortController = new AbortController();
|
|
6
|
+
export const useCheckInOutOperations = () => {
|
|
7
|
+
const [showHistory, setShowHistory] = useState(false);
|
|
8
|
+
// State to manage show history selected file
|
|
9
|
+
const [showCheckoutInformationForm, setShowCheckoutInformationForm] = useState(false);
|
|
10
|
+
// Stato per triggerare il refresh della preview dall'esterno
|
|
11
|
+
const [refreshPreviewTrigger, setRefreshPreviewTrigger] = useState(0);
|
|
12
|
+
// State to manage comment form
|
|
13
|
+
const [commentFormState, setCommentFormState] = useState({
|
|
14
|
+
removeAndEditAttachment: true,
|
|
15
|
+
show: false,
|
|
16
|
+
isRequired: false
|
|
17
|
+
});
|
|
18
|
+
// State variable to control the visibility of the wait panel
|
|
19
|
+
const [showCicoWaitPanel, setShowCicoWaitPanel] = useState(false);
|
|
20
|
+
// State variable to store the title of the wait panel
|
|
21
|
+
const [cicoWaitPanelTitle, setCicoWaitPanelTitle] = useState('');
|
|
22
|
+
// State variable to control the visibility of the primary section of the wait panel
|
|
23
|
+
const [showCicoPrimaryProgress, setShowCicoPrimaryProgress] = useState(false);
|
|
24
|
+
// State variable to store the primary text of the wait panel
|
|
25
|
+
const [cicoPrimaryProgressText, setCicoPrimaryProgressText] = useState('');
|
|
26
|
+
// State variable to track the current value of the primary progress indicator in the wait panel
|
|
27
|
+
const [cicoPrimaryProgressValue, setCicoPrimaryProgressValue] = useState(0);
|
|
28
|
+
// State variable to define the maximum value for the primary progress indicator in the wait panel
|
|
29
|
+
const [cicoPrimaryProgressMax, setCicoPrimaryProgressMax] = useState(0);
|
|
30
|
+
const showHistoryCallback = useCallback(() => {
|
|
31
|
+
setShowHistory(true);
|
|
32
|
+
}, []);
|
|
33
|
+
const hideHistoryCallback = useCallback(() => {
|
|
34
|
+
setShowHistory(false);
|
|
35
|
+
}, []);
|
|
36
|
+
const showCheckoutInformationFormCallback = useCallback(() => {
|
|
37
|
+
setShowCheckoutInformationForm(true);
|
|
38
|
+
}, []);
|
|
39
|
+
const hideCheckoutInformationFormCallback = useCallback(() => {
|
|
40
|
+
setShowCheckoutInformationForm(false);
|
|
41
|
+
}, []);
|
|
42
|
+
const triggerPreviewRefresh = useCallback(() => {
|
|
43
|
+
setRefreshPreviewTrigger(prev => prev + 1);
|
|
44
|
+
}, []);
|
|
45
|
+
const hideCommentFormCallback = useCallback(() => {
|
|
46
|
+
setCommentFormState(prev => ({ ...prev, show: false }));
|
|
47
|
+
}, []);
|
|
48
|
+
const copyCheckoutPathToClipboardCallback = (dcmt, filename) => {
|
|
49
|
+
const defaultCheckInOutFolder = SDKUI_Globals.userSettings.defaultCheckInOutFolder ?? "Download";
|
|
50
|
+
const wGSDraftCheckoutItemCurrentItems = [...SDKUI_Globals.userSettings.dcmtCheckoutInfo];
|
|
51
|
+
const existingItem = wGSDraftCheckoutItemCurrentItems.find((item) => item.TID === dcmt.TID.toString() && item.DID === dcmt.DID.toString());
|
|
52
|
+
const folder = existingItem && existingItem.checkoutFolder && existingItem.checkoutFolder !== "" ? existingItem.checkoutFolder : defaultCheckInOutFolder;
|
|
53
|
+
const name = existingItem?.checkoutName ?? getCicoDownloadFileName({ type: 'dcmtInfo', dcmtInfo: dcmt, originalFileName: filename }, true, false);
|
|
54
|
+
const textToCopy = folder ? `${folder}\\${name}` : name;
|
|
55
|
+
navigator.clipboard.writeText(textToCopy)
|
|
56
|
+
.then(() => {
|
|
57
|
+
ShowAlert({ message: SDKUI_Localizator.OperationSuccess, mode: 'success', duration: 5000, title: SDKUI_Localizator.CopyToClipboard });
|
|
58
|
+
})
|
|
59
|
+
.catch(err => {
|
|
60
|
+
ShowAlert({ message: err, mode: 'error', duration: 5000, title: SDKUI_Localizator.OperationResult });
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
const handleCheckOutCallback = async (dcmt, checkout, filename, downloadDcmtsAsync, refreshMetadataAsync, refreshFocusedDataRowAsync) => {
|
|
64
|
+
if (!dcmt)
|
|
65
|
+
throw new Error("Document info is required");
|
|
66
|
+
const title = checkout ? 'Check out' : SDKUI_Localizator.CancelCheckOut;
|
|
67
|
+
const msg = checkout ? SDKUI_Localizator.ExecuteCheckOutQuestion : SDKUI_Localizator.ExecuteCancelCheckOutQuestion;
|
|
68
|
+
TMMessageBoxManager.show({
|
|
69
|
+
title: title,
|
|
70
|
+
message: msg,
|
|
71
|
+
buttons: [ButtonNames.YES, ButtonNames.NO],
|
|
72
|
+
onButtonClick: async (e) => {
|
|
73
|
+
if (e !== ButtonNames.YES)
|
|
74
|
+
return;
|
|
75
|
+
let result = [];
|
|
76
|
+
try {
|
|
77
|
+
setCicoWaitPanelTitle(title);
|
|
78
|
+
setShowCicoWaitPanel(true);
|
|
79
|
+
setShowCicoPrimaryProgress(true);
|
|
80
|
+
abortController = new AbortController();
|
|
81
|
+
const ue = SDK_Globals.tmSession?.NewUpdateEngineByID();
|
|
82
|
+
if (!ue)
|
|
83
|
+
throw new Error("Update Engine not available");
|
|
84
|
+
ue.TID = dcmt.TID;
|
|
85
|
+
ue.DID = dcmt.DID;
|
|
86
|
+
if (checkout) {
|
|
87
|
+
await ue.CheckOutAsync()
|
|
88
|
+
.then(async () => {
|
|
89
|
+
await cicoDownloadFilesCallback([{ type: 'dcmtInfo', dcmtInfo: dcmt, originalFileName: filename }], true, downloadDcmtsAsync);
|
|
90
|
+
result.push({ rowIndex: 1, id1: dcmt.TID, id2: dcmt.DID, description: SDKUI_Localizator.UpdateCompletedSuccessfully, resultType: ResultTypes.SUCCESS });
|
|
91
|
+
await refreshMetadataAsync?.();
|
|
92
|
+
await refreshFocusedDataRowAsync?.(dcmt.TID, dcmt.DID, true);
|
|
93
|
+
})
|
|
94
|
+
.catch((error) => {
|
|
95
|
+
result.push({ rowIndex: 1, id1: dcmt.TID, id2: dcmt.DID, resultType: ResultTypes.ERROR, description: getExceptionMessage(error) });
|
|
96
|
+
throw error;
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
await ue.UndoCheckOutAsync()
|
|
101
|
+
.then(async () => {
|
|
102
|
+
result.push({ rowIndex: 1, id1: dcmt.TID, id2: dcmt.DID, description: SDKUI_Localizator.UpdateCompletedSuccessfully, resultType: ResultTypes.SUCCESS });
|
|
103
|
+
// Remove the corresponding draft checkout item
|
|
104
|
+
updateCicoCheckoutStorageItem({ TID: dcmt.TID.toString(), DID: dcmt.DID.toString(), checkoutFolder: "", checkoutName: "" }, "dcmtInfo", "remove");
|
|
105
|
+
await refreshMetadataAsync?.();
|
|
106
|
+
await refreshFocusedDataRowAsync?.(dcmt.TID, dcmt.DID, true);
|
|
107
|
+
})
|
|
108
|
+
.catch((error) => {
|
|
109
|
+
result.push({ rowIndex: 0, id1: dcmt.TID, id2: dcmt.DID, resultType: ResultTypes.ERROR, description: getExceptionMessage(error) });
|
|
110
|
+
throw error;
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
catch (error) {
|
|
115
|
+
result.push({ rowIndex: 1, id1: dcmt.TID, id2: dcmt.DID, resultType: ResultTypes.ERROR, description: getExceptionMessage(error) });
|
|
116
|
+
}
|
|
117
|
+
finally {
|
|
118
|
+
setCicoPrimaryProgressText('');
|
|
119
|
+
setCicoPrimaryProgressMax(0);
|
|
120
|
+
setCicoPrimaryProgressValue(0);
|
|
121
|
+
setShowCicoWaitPanel(false);
|
|
122
|
+
TMResultManager.show(result, title, "ID", undefined);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
};
|
|
127
|
+
const triggerCommentOnFileAdd = (addedFiles) => {
|
|
128
|
+
if (addedFiles.length > 0) {
|
|
129
|
+
setCommentFormState({
|
|
130
|
+
show: true,
|
|
131
|
+
isRequired: true,
|
|
132
|
+
removeAndEditAttachment: false
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
const handleCheckInCallback = async (dcmt, refreshMetadataAsync, refreshFocusedDataRowAsync) => {
|
|
137
|
+
if (!dcmt)
|
|
138
|
+
throw new Error("Document info is required");
|
|
139
|
+
// Create a new file input element
|
|
140
|
+
const input = document.createElement("input");
|
|
141
|
+
// Set the input type to "file" to allow file selection
|
|
142
|
+
input.type = "file";
|
|
143
|
+
// Set the accepted file types (e.g., images, PDFs, etc.)
|
|
144
|
+
input.accept = "*/*";
|
|
145
|
+
// Enable the input to accept one file at once
|
|
146
|
+
input.multiple = false;
|
|
147
|
+
// Add an event listener for when the file selection changes
|
|
148
|
+
input.addEventListener('change', async (event) => {
|
|
149
|
+
const fileInput = event.target;
|
|
150
|
+
if (!fileInput.files || fileInput.files.length === 0)
|
|
151
|
+
return;
|
|
152
|
+
const file = fileInput.files[0];
|
|
153
|
+
const validateFileName = validateCicoFileName({ type: 'dcmtInfo', dcmtInfo: dcmt, originalFileName: dcmt.fileName ?? SDKUI_Localizator.SearchResult }, file.name);
|
|
154
|
+
TMMessageBoxManager.show({
|
|
155
|
+
resizable: true,
|
|
156
|
+
buttons: [ButtonNames.YES, ButtonNames.NO],
|
|
157
|
+
message: renderCicoCheckInContent({ type: 'dcmtInfo', dcmtInfo: dcmt, originalFileName: dcmt.fileName ?? SDKUI_Localizator.SearchResult }, file, validateFileName.isValid, validateFileName.validationResults),
|
|
158
|
+
title: "Check in",
|
|
159
|
+
onButtonClick: async (e) => {
|
|
160
|
+
if (e !== ButtonNames.YES)
|
|
161
|
+
return;
|
|
162
|
+
setCicoWaitPanelTitle('Check in');
|
|
163
|
+
setShowCicoWaitPanel(true);
|
|
164
|
+
setShowCicoPrimaryProgress(true);
|
|
165
|
+
abortController = new AbortController();
|
|
166
|
+
let result = [];
|
|
167
|
+
let i = 0;
|
|
168
|
+
if (dcmt.TID && dcmt.DID) {
|
|
169
|
+
try {
|
|
170
|
+
const ue = SDK_Globals.tmSession?.NewUpdateEngineByID();
|
|
171
|
+
if (ue) {
|
|
172
|
+
ue.TID = dcmt.TID;
|
|
173
|
+
ue.DID = dcmt.DID;
|
|
174
|
+
await ue.CheckInAsync(file, "", abortController.signal);
|
|
175
|
+
// Remove the corresponding draft checkout item
|
|
176
|
+
updateCicoCheckoutStorageItem({ TID: dcmt.TID.toString(), DID: dcmt.DID.toString(), checkoutFolder: "", checkoutName: "" }, "dcmtInfo", "remove");
|
|
177
|
+
result.push({ rowIndex: i, id1: dcmt.DID, id2: dcmt.DID, description: SDKUI_Localizator.UpdateCompletedSuccessfully, resultType: ResultTypes.SUCCESS });
|
|
178
|
+
await refreshMetadataAsync?.();
|
|
179
|
+
await refreshFocusedDataRowAsync?.(dcmt.TID, dcmt.DID, true);
|
|
180
|
+
const cacheKey = `${dcmt.TID}-${dcmt.DID}`;
|
|
181
|
+
if (dcmtsFileCachePreview.has(cacheKey))
|
|
182
|
+
removeDcmtsFileCache(cacheKey);
|
|
183
|
+
triggerPreviewRefresh();
|
|
184
|
+
triggerCommentOnFileAdd([dcmt.DID]);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
catch (err) {
|
|
188
|
+
result.push({ rowIndex: i, id1: i, id2: i, resultType: ResultTypes.ERROR, description: getExceptionMessage(err) });
|
|
189
|
+
}
|
|
190
|
+
finally {
|
|
191
|
+
setCicoPrimaryProgressText('');
|
|
192
|
+
setCicoPrimaryProgressMax(0);
|
|
193
|
+
setCicoPrimaryProgressValue(0);
|
|
194
|
+
setShowCicoWaitPanel(false);
|
|
195
|
+
TMResultManager.show(result, 'Check in', "ID", undefined, SDKUI_Localizator.CheckInSuccessMessage, 6000);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
});
|
|
200
|
+
});
|
|
201
|
+
input.click();
|
|
202
|
+
};
|
|
203
|
+
return {
|
|
204
|
+
showHistory,
|
|
205
|
+
showHistoryCallback,
|
|
206
|
+
hideHistoryCallback,
|
|
207
|
+
showCheckoutInformationForm,
|
|
208
|
+
showCheckoutInformationFormCallback,
|
|
209
|
+
hideCheckoutInformationFormCallback,
|
|
210
|
+
commentFormState,
|
|
211
|
+
hideCommentFormCallback,
|
|
212
|
+
copyCheckoutPathToClipboardCallback,
|
|
213
|
+
handleCheckOutCallback,
|
|
214
|
+
handleCheckInCallback,
|
|
215
|
+
refreshPreviewTrigger,
|
|
216
|
+
showCicoWaitPanel,
|
|
217
|
+
cicoWaitPanelTitle,
|
|
218
|
+
showCicoPrimaryProgress,
|
|
219
|
+
cicoPrimaryProgressText,
|
|
220
|
+
cicoPrimaryProgressValue,
|
|
221
|
+
cicoPrimaryProgressMax,
|
|
222
|
+
};
|
|
223
|
+
};
|
|
@@ -6,7 +6,7 @@ export declare class PlatformObjectService {
|
|
|
6
6
|
static readonly retrieveAllAdminAsync: (objClass: ObjectClasses, jobType?: JobTypes) => Promise<import("@topconsultnpm/sdk-ts").UserDescriptor[] | DcmtTypeDescriptor[] | import("@topconsultnpm/sdk-ts").AreaDescriptor[] | import("@topconsultnpm/sdk-ts").RelationDescriptor[] | import("@topconsultnpm/sdk-ts").FEDistillerJobDescriptor[] | import("@topconsultnpm/sdk-ts").DataListDescriptor[] | import("@topconsultnpm/sdk-ts").DiskDescriptor[] | import("@topconsultnpm/sdk-ts").GroupDescriptor[] | import("@topconsultnpm/sdk-ts").LDAPDescriptor[] | import("@topconsultnpm/sdk-ts").NumeratorDescriptor[] | ProcessDescriptor[] | import("@topconsultnpm/sdk-ts").SAPLoginDescriptor[] | import("@topconsultnpm/sdk-ts").SignCertDescriptor[] | import("@topconsultnpm/sdk-ts").SignServerDescriptor[] | import("@topconsultnpm/sdk-ts").TreeDescriptor[] | import("@topconsultnpm/sdk-ts").TSADescriptor[] | import("@topconsultnpm/sdk-ts").WFDescriptor[] | undefined>;
|
|
7
7
|
private static readonly loadCacheForJobAsync;
|
|
8
8
|
private static readonly retrieveAdminJobAsync;
|
|
9
|
-
static readonly retrieveAdminAsync: (objClass: ObjectClasses, jobType: JobTypes, id: number) => Promise<import("@topconsultnpm/sdk-ts").UserDescriptor | import("@topconsultnpm/sdk-ts").MailSenderJobDescriptor |
|
|
9
|
+
static readonly retrieveAdminAsync: (objClass: ObjectClasses, jobType: JobTypes, id: number) => Promise<import("@topconsultnpm/sdk-ts").UserDescriptor | DcmtTypeDescriptor | import("@topconsultnpm/sdk-ts").MailSenderJobDescriptor | import("@topconsultnpm/sdk-ts").SavedQueryDescriptor | import("@topconsultnpm/sdk-ts").DataListDescriptor | import("@topconsultnpm/sdk-ts").AreaDescriptor | import("@topconsultnpm/sdk-ts").BasketTypeDescriptor | import("@topconsultnpm/sdk-ts").RelationDescriptor | import("@topconsultnpm/sdk-ts").TaskDescriptor | import("@topconsultnpm/sdk-ts").WorkingGroupDescriptor | import("@topconsultnpm/sdk-ts").BarcodeArchiverJobDescriptor | import("@topconsultnpm/sdk-ts").BatchUpdaterJobDescriptor | import("@topconsultnpm/sdk-ts").CassettoDoganaleJobDescriptor | import("@topconsultnpm/sdk-ts").CassettoDoganalePlusJobDescriptor | import("@topconsultnpm/sdk-ts").CassettoFiscaleQueryJobDescriptor | import("@topconsultnpm/sdk-ts").CassettoFiscaleSenderJobDescriptor | import("@topconsultnpm/sdk-ts").CheckSequenceJobDescriptor | import("@topconsultnpm/sdk-ts").COSCheckerJobDescriptor | import("@topconsultnpm/sdk-ts").DcmtConverterJobDescriptor | import("@topconsultnpm/sdk-ts").DcmtDeleterJobDescriptor | import("@topconsultnpm/sdk-ts").DcmtNoteJobDescriptor | import("@topconsultnpm/sdk-ts").DcmtPrinterJobDescriptor | import("@topconsultnpm/sdk-ts").FEAttacherJobDescriptor | import("@topconsultnpm/sdk-ts").FECreatorTxtJobDescriptor | import("@topconsultnpm/sdk-ts").FEDetacherJobDescriptor | import("@topconsultnpm/sdk-ts").FEDistillerJobDescriptor | import("@topconsultnpm/sdk-ts").FESenderWsJobDescriptor | import("@topconsultnpm/sdk-ts").FESplitterJobDescriptor | import("@topconsultnpm/sdk-ts").FEValidatorJobDescriptor | import("@topconsultnpm/sdk-ts").FileArchiverJobDescriptor | import("@topconsultnpm/sdk-ts").FileCheckerJobDescriptor | import("@topconsultnpm/sdk-ts").FileExecJobDescriptor | import("@topconsultnpm/sdk-ts").FileExportJobDescriptor | import("@topconsultnpm/sdk-ts").FileMoverJobDescriptor | import("@topconsultnpm/sdk-ts").LexJobDescriptor | import("@topconsultnpm/sdk-ts").LinkerJobDescriptor | import("@topconsultnpm/sdk-ts").MailArchiverJobDescriptor | import("@topconsultnpm/sdk-ts").MailQueryJobDescriptor | import("@topconsultnpm/sdk-ts").MigrationJobDescriptor | import("@topconsultnpm/sdk-ts").PdDCreatorJobDescriptor | import("@topconsultnpm/sdk-ts").PDFArchiverJobDescriptor | import("@topconsultnpm/sdk-ts").PdVArchiverJobDescriptor | import("@topconsultnpm/sdk-ts").PdVQueryJobDescriptor | import("@topconsultnpm/sdk-ts").PdVSenderJobDescriptor | import("@topconsultnpm/sdk-ts").PeppolQueryJobDescriptor | import("@topconsultnpm/sdk-ts").PeppolSenderJobDescriptor | import("@topconsultnpm/sdk-ts").PostelQueryJobDescriptor | import("@topconsultnpm/sdk-ts").PostelSenderJobDescriptor | import("@topconsultnpm/sdk-ts").ReplicatorJobDescriptor | import("@topconsultnpm/sdk-ts").SAPAlignerJobDescriptor | import("@topconsultnpm/sdk-ts").SAPBarcodeJobDescriptor | import("@topconsultnpm/sdk-ts").SAPDataReaderJobDescriptor | import("@topconsultnpm/sdk-ts").SAPDataWriterJobDescriptor | import("@topconsultnpm/sdk-ts").SignerJobDescriptor | import("@topconsultnpm/sdk-ts").SpoolArchiverJobDescriptor | import("@topconsultnpm/sdk-ts").UpdaterJobDescriptor | import("@topconsultnpm/sdk-ts").DiskDescriptor | import("@topconsultnpm/sdk-ts").GroupDescriptor | import("@topconsultnpm/sdk-ts").LDAPDescriptor | import("@topconsultnpm/sdk-ts").NumeratorDescriptor | ProcessDescriptor | import("@topconsultnpm/sdk-ts").SAPLoginDescriptor | import("@topconsultnpm/sdk-ts").SignCertDescriptor | import("@topconsultnpm/sdk-ts").SignServerDescriptor | import("@topconsultnpm/sdk-ts").TreeDescriptor | import("@topconsultnpm/sdk-ts").TSADescriptor | import("@topconsultnpm/sdk-ts").WFDescriptor | undefined>;
|
|
10
10
|
private static readonly updateJobAsync;
|
|
11
11
|
static readonly updateAsync: (objClass: ObjectClasses, jobType: JobTypes, d: any, ...args: any[]) => Promise<number | undefined>;
|
|
12
12
|
private static readonly createJobAsync;
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@topconsultnpm/sdkui-react",
|
|
3
|
-
"version": "6.20.0-dev1.
|
|
3
|
+
"version": "6.20.0-dev1.21",
|
|
4
4
|
"description": "",
|
|
5
5
|
"scripts": {
|
|
6
|
-
"test": "echo \"Error: no test specified\"
|
|
6
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
7
7
|
"clean": "powershell Remove-Item lib/ -recurse",
|
|
8
8
|
"copy-files": "copyfiles -u 1 src/assets/*.* src/assets/ImageLibrary/*.* src/assets/thumbnails/*.* src/assets/IconsS4t/*.* src/assets/Metadata/*.* src/css/tm-sdkui.css lib/",
|
|
9
|
-
"tm-build": "npm run clean
|
|
9
|
+
"tm-build": "npm run clean && tsc && npm run copy-files",
|
|
10
10
|
"tm-watch": "tsc -w",
|
|
11
11
|
"tm-publish": "npm publish --tag latest",
|
|
12
12
|
"storybook": "storybook dev -p 6006",
|
|
@@ -39,16 +39,18 @@
|
|
|
39
39
|
"lib"
|
|
40
40
|
],
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"
|
|
43
|
-
"htmlparser2": "^10.0.0",
|
|
42
|
+
"@topconsultnpm/sdk-ts": "6.20.0-dev1.2",
|
|
44
43
|
"buffer": "^6.0.3",
|
|
45
|
-
"@topconsultnpm/sdk-ts": "^6.20.0-dev1.1",
|
|
46
|
-
"exceljs": "^4.4.0",
|
|
47
44
|
"devextreme": "25.1.7",
|
|
48
|
-
"
|
|
49
|
-
"
|
|
45
|
+
"devextreme-react": "25.1.7",
|
|
46
|
+
"exceljs": "^4.4.0",
|
|
47
|
+
"htmlparser2": "^10.0.0",
|
|
48
|
+
"pdfjs-dist": "^5.4.530",
|
|
49
|
+
"react-pdf": "^10.3.0",
|
|
50
|
+
"react-router-dom": "^6.15.0",
|
|
51
|
+
"styled-components": "^6.1.1"
|
|
50
52
|
},
|
|
51
53
|
"overrides": {
|
|
52
54
|
"esbuild": "^0.25.0"
|
|
53
55
|
}
|
|
54
|
-
}
|
|
56
|
+
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { DcmtInfo } from "../../../ts";
|
|
2
|
-
interface TMSearchResultCheckoutInfoFormProps {
|
|
3
|
-
dtdName: string;
|
|
4
|
-
selectedDcmtOrFocused: DcmtInfo;
|
|
5
|
-
onClose: () => void;
|
|
6
|
-
}
|
|
7
|
-
declare const TMSearchResultCheckoutInfoForm: (props: TMSearchResultCheckoutInfoFormProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
export default TMSearchResultCheckoutInfoForm;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { AccessLevels, DcmtTypeDescriptor, FileDescriptor, UserDescriptor } from "@topconsultnpm/sdk-ts";
|
|
3
|
-
import { DcmtCheckoutInfo } from "./index";
|
|
4
|
-
import { DcmtInfo, DownloadModes, DownloadTypes } from "../ts/types";
|
|
5
|
-
export interface CheckInCheckOutInfo {
|
|
6
|
-
CICO: number;
|
|
7
|
-
CanCICO: AccessLevels;
|
|
8
|
-
CanDelChronology: AccessLevels;
|
|
9
|
-
UserID_MID: number;
|
|
10
|
-
Date_MID: number;
|
|
11
|
-
Ver_MID: number;
|
|
12
|
-
UserID_CanViewOrUpdate: AccessLevels;
|
|
13
|
-
Date_CanViewOrUpdate: AccessLevels;
|
|
14
|
-
Ver_CanViewOrUpdate: AccessLevels;
|
|
15
|
-
}
|
|
16
|
-
export declare const colors: {
|
|
17
|
-
MEDIUM_GREEN: string;
|
|
18
|
-
};
|
|
19
|
-
export interface CheckoutStatusResult {
|
|
20
|
-
isCheckedOut: boolean;
|
|
21
|
-
mode: 'editMode' | 'lockMode' | '';
|
|
22
|
-
version: number;
|
|
23
|
-
icon: React.ReactNode | null;
|
|
24
|
-
}
|
|
25
|
-
export declare const cicoIsEnabled: (dcmt: any, allUsers: Array<UserDescriptor>, dtd: DcmtTypeDescriptor | undefined) => {
|
|
26
|
-
cicoEnabled: boolean;
|
|
27
|
-
checkoutStatus: CheckoutStatusResult;
|
|
28
|
-
};
|
|
29
|
-
export declare const getCicoDownloadFileName: (originalFileName: string, fileItem: DcmtInfo | undefined, checkout: boolean, withTimestampAndExt: boolean) => string;
|
|
30
|
-
export declare const updateDcmtCheckoutItem: (item: DcmtCheckoutInfo, action?: "addOrUpdate" | "remove") => void;
|
|
31
|
-
export declare const downloadFilesCallback: (originalFileName: string, dcmt: Array<DcmtInfo>, checkout: boolean, downloadDcmtsAsync: (inputDcmts: Array<DcmtInfo> | undefined, downloadType?: DownloadTypes, downloadMode?: DownloadModes, onFileDownloaded?: (dcmtFile: File) => void, confirmAttachments?: (list: FileDescriptor[]) => Promise<string[] | undefined>, skipConfirmation?: boolean) => Promise<void>) => Promise<void>;
|
package/lib/helper/cicoHelper.js
DELETED
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { AccessLevels, CICO_MetadataNames, SDK_Globals } from "@topconsultnpm/sdk-ts";
|
|
3
|
-
import TMTooltip from "../components/base/TMTooltip";
|
|
4
|
-
import { Globalization, SDKUI_Globals, SDKUI_Localizator } from "./index";
|
|
5
|
-
import { DownloadTypes } from "../ts/types";
|
|
6
|
-
export const colors = {
|
|
7
|
-
MEDIUM_GREEN: "#28a745",
|
|
8
|
-
};
|
|
9
|
-
const getCicoInfo = (dtd) => {
|
|
10
|
-
const cico = {
|
|
11
|
-
CICO: 0,
|
|
12
|
-
CanCICO: AccessLevels.No,
|
|
13
|
-
CanDelChronology: AccessLevels.No,
|
|
14
|
-
UserID_MID: 0,
|
|
15
|
-
Date_MID: 0,
|
|
16
|
-
Ver_MID: 0,
|
|
17
|
-
UserID_CanViewOrUpdate: AccessLevels.No,
|
|
18
|
-
Date_CanViewOrUpdate: AccessLevels.No,
|
|
19
|
-
Ver_CanViewOrUpdate: AccessLevels.No,
|
|
20
|
-
};
|
|
21
|
-
if (dtd === undefined)
|
|
22
|
-
return cico;
|
|
23
|
-
cico.CICO = dtd.cico ?? 0;
|
|
24
|
-
cico.CanCICO = dtd.perm?.canCICO ?? AccessLevels.No;
|
|
25
|
-
cico.CanDelChronology = dtd.perm?.canDelChron ?? AccessLevels.No;
|
|
26
|
-
const mdCheckout = dtd.metadata?.find(md => md.name === CICO_MetadataNames.CICO_CheckoutUserID);
|
|
27
|
-
if (mdCheckout) {
|
|
28
|
-
cico.UserID_MID = mdCheckout.fromMID;
|
|
29
|
-
cico.UserID_CanViewOrUpdate = (mdCheckout.perm?.canView == AccessLevels.Yes || mdCheckout.perm?.canUpdate == AccessLevels.Yes) ? AccessLevels.Yes : AccessLevels.No;
|
|
30
|
-
}
|
|
31
|
-
const mdDate = dtd.metadata?.find(md => md.name === CICO_MetadataNames.CICO_CheckoutDate);
|
|
32
|
-
if (mdDate) {
|
|
33
|
-
cico.Date_MID = mdDate.fromMID;
|
|
34
|
-
cico.Date_CanViewOrUpdate = (mdDate.perm?.canView == AccessLevels.Yes || mdDate.perm?.canUpdate == AccessLevels.Yes) ? AccessLevels.Yes : AccessLevels.No;
|
|
35
|
-
}
|
|
36
|
-
const mdVer = dtd.metadata?.find(md => md.name === CICO_MetadataNames.CICO_Version);
|
|
37
|
-
if (mdVer) {
|
|
38
|
-
cico.Ver_MID = mdVer.fromMID;
|
|
39
|
-
cico.Ver_CanViewOrUpdate = (mdVer.perm?.canView == AccessLevels.Yes || mdVer.perm?.canUpdate == AccessLevels.Yes) ? AccessLevels.Yes : AccessLevels.No;
|
|
40
|
-
}
|
|
41
|
-
return cico;
|
|
42
|
-
};
|
|
43
|
-
const findCheckOutUserName = (allUsers, checkoutUserId) => {
|
|
44
|
-
let checkOutUser = allUsers.find(user => user.id === checkoutUserId);
|
|
45
|
-
return checkOutUser ? checkOutUser.name : '-';
|
|
46
|
-
};
|
|
47
|
-
export const cicoIsEnabled = (dcmt, allUsers, dtd) => {
|
|
48
|
-
if (dcmt === undefined || dtd === undefined) {
|
|
49
|
-
return {
|
|
50
|
-
cicoEnabled: false,
|
|
51
|
-
checkoutStatus: { isCheckedOut: false, mode: '', version: 1, icon: null }
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
const cicoInfo = getCicoInfo(dtd);
|
|
55
|
-
const CICO_CheckoutUserID_Meta = dtd?.metadata?.find(md => md.name === CICO_MetadataNames.CICO_CheckoutUserID);
|
|
56
|
-
const CICO_CheckoutDate_Meta = dtd?.metadata?.find(md => md.name === CICO_MetadataNames.CICO_CheckoutDate);
|
|
57
|
-
const CICO_Version_Meta = dtd?.metadata?.find(md => md.name === CICO_MetadataNames.CICO_Version);
|
|
58
|
-
const keyVersion = dcmt.TID + "_" + (CICO_Version_Meta?.id ?? 0);
|
|
59
|
-
const versionRaw = CICO_Version_Meta?.id ? dcmt[keyVersion] : undefined;
|
|
60
|
-
const version = (versionRaw != null && !isNaN(Number(versionRaw))) ? Number(versionRaw) : 1;
|
|
61
|
-
let checkoutStatus = { isCheckedOut: false, mode: '', version: version, icon: null, };
|
|
62
|
-
const userID = SDK_Globals.tmSession?.SessionDescr?.userID;
|
|
63
|
-
if (dcmt && CICO_CheckoutUserID_Meta?.id) {
|
|
64
|
-
const keyUserID = dcmt.TID + "_" + CICO_CheckoutUserID_Meta.id;
|
|
65
|
-
const checkoutUserIdValue = dcmt[keyUserID];
|
|
66
|
-
const checkoutUserId = Number(checkoutUserIdValue);
|
|
67
|
-
if (userID && checkoutUserIdValue && !isNaN(checkoutUserId) && checkoutUserId > 0) {
|
|
68
|
-
// editMode: l'utente corrente è quello che ha fatto il checkout
|
|
69
|
-
// lockMode: un altro utente ha fatto il checkout
|
|
70
|
-
const mode = (userID && userID === checkoutUserId) ? 'editMode' : 'lockMode';
|
|
71
|
-
// Recupera i dati aggiuntivi per il tooltip
|
|
72
|
-
const keyDate = dcmt.TID + "_" + (CICO_CheckoutDate_Meta?.id ?? 0);
|
|
73
|
-
const checkoutDate = CICO_CheckoutDate_Meta?.id ? dcmt[keyDate] : undefined;
|
|
74
|
-
const editLockTooltipText = _jsxs(_Fragment, { children: [_jsxs("div", { style: { textAlign: "center" }, children: [mode === 'editMode' && (_jsxs(_Fragment, { children: [_jsx("i", { style: { fontSize: "18px", color: colors.MEDIUM_GREEN, fontWeight: "bold" }, className: "dx-icon-edit" }), SDKUI_Localizator.CurrentUserExtract] })), mode === 'lockMode' && (_jsxs(_Fragment, { children: [_jsx("i", { style: { fontSize: "18px", color: colors.MEDIUM_GREEN, fontWeight: "bold" }, className: "dx-icon-lock" }), SDKUI_Localizator.ExtractedFromOtherUser] }))] }), _jsx("hr", {}), _jsxs("div", { style: { textAlign: "left" }, children: [_jsxs("ul", { children: [_jsxs("li", { children: ["- ", _jsx("span", { style: { fontWeight: 'bold' }, children: SDKUI_Localizator.ExtractedBy }), ": ", findCheckOutUserName(allUsers, checkoutUserId), " (ID: ", checkoutUserId, ")"] }), _jsxs("li", { children: ["- ", _jsx("span", { style: { fontWeight: 'bold' }, children: SDKUI_Localizator.ExtractedOn }), ": ", Globalization.getDateTimeDisplayValue(checkoutDate?.toString())] })] }), _jsx("hr", {}), _jsx("ul", { children: _jsxs("li", { children: ["- ", _jsx("span", { style: { fontWeight: 'bold' }, children: SDKUI_Localizator.Version }), ": ", version ?? 1] }) })] })] });
|
|
75
|
-
const icon = mode === 'editMode'
|
|
76
|
-
? _jsx(TMTooltip, { content: editLockTooltipText, children: _jsx("i", { style: { fontSize: "18px", color: colors.MEDIUM_GREEN, fontWeight: "bold" }, className: "dx-icon-edit" }) })
|
|
77
|
-
: _jsx(TMTooltip, { content: editLockTooltipText, children: _jsx("i", { style: { fontSize: "18px", color: colors.MEDIUM_GREEN, fontWeight: "bold" }, className: "dx-icon-lock" }) });
|
|
78
|
-
checkoutStatus = { isCheckedOut: true, mode: mode, icon: icon, version: version };
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
return {
|
|
82
|
-
cicoEnabled: cicoInfo.CICO === 1 && cicoInfo.CanCICO === AccessLevels.Yes,
|
|
83
|
-
checkoutStatus: checkoutStatus
|
|
84
|
-
};
|
|
85
|
-
};
|
|
86
|
-
export const getCicoDownloadFileName = (originalFileName, fileItem, checkout, withTimestampAndExt) => {
|
|
87
|
-
// If no fileItem is provided, return an empty string immediately
|
|
88
|
-
if (fileItem === undefined)
|
|
89
|
-
return '';
|
|
90
|
-
// Retrieve the archiveID from the global session object
|
|
91
|
-
const archiveID = SDK_Globals.tmSession?.SessionDescr?.archiveID;
|
|
92
|
-
// Destructure the fileItem object into properties
|
|
93
|
-
const { DID, TID, FILEEXT } = fileItem;
|
|
94
|
-
// Determine the base name of the file (without its extension)
|
|
95
|
-
// If the file name contains '.', only take the substring before the last dot
|
|
96
|
-
const baseName = originalFileName.includes('.') ? originalFileName.substring(0, originalFileName.lastIndexOf('.')) : originalFileName;
|
|
97
|
-
// Construct a unique identifier for the file combining archiveID, baseName, tid, and did.
|
|
98
|
-
const fileIdentifier = `${archiveID}~${baseName}~${TID}~${DID}`;
|
|
99
|
-
// Determine the extension to append to the file name
|
|
100
|
-
const extension = withTimestampAndExt && FILEEXT ? `.${FILEEXT}` : '';
|
|
101
|
-
// Initialize an empty string for the timestamp (to be appended if needed)
|
|
102
|
-
let timestamp = '';
|
|
103
|
-
// If this is a checkout and timestamps should be added, generate a formatted timestamp
|
|
104
|
-
if (checkout && withTimestampAndExt) {
|
|
105
|
-
const now = new Date();
|
|
106
|
-
const pad = (n) => n.toString().padStart(2, '0');
|
|
107
|
-
// Format the timestamp as YYYYMMDDHHMMSS and prefix with '~'
|
|
108
|
-
timestamp = `~${now.getFullYear()}${pad(now.getMonth() + 1)}${pad(now.getDate())}${pad(now.getHours())}${pad(now.getMinutes())}${pad(now.getSeconds())}`;
|
|
109
|
-
}
|
|
110
|
-
// Construct and return the final file name: [archiveID]~[name]~[tid]~[did]~[timestamp].[extension]
|
|
111
|
-
return `${checkout ? 'checkout~' : ''}${fileIdentifier}${timestamp}${extension}`;
|
|
112
|
-
};
|
|
113
|
-
export const updateDcmtCheckoutItem = (item, action = "addOrUpdate") => {
|
|
114
|
-
// Make a shallow copy of the global draft checkout items array to avoid direct mutation
|
|
115
|
-
const currentItems = [...SDKUI_Globals.userSettings.dcmtCheckoutInfo];
|
|
116
|
-
// Find the index of an existing item that has the same TID and DID as the new item
|
|
117
|
-
const index = currentItems.findIndex(i => i.TID === item.TID && i.DID === item.DID);
|
|
118
|
-
// If the action is to add a new item or update an existing one
|
|
119
|
-
if (action === "addOrUpdate") {
|
|
120
|
-
if (index >= 0) {
|
|
121
|
-
// If the item exists, overwrite it with the new values
|
|
122
|
-
currentItems[index] = item;
|
|
123
|
-
}
|
|
124
|
-
else {
|
|
125
|
-
// If the item does not exist, push it into the array
|
|
126
|
-
currentItems.push(item);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
else if (action === "remove" && index >= 0) { // If the action is to remove an item
|
|
130
|
-
// Remove the item from the array
|
|
131
|
-
currentItems.splice(index, 1);
|
|
132
|
-
}
|
|
133
|
-
// Update the global array with the modified copy
|
|
134
|
-
SDKUI_Globals.userSettings.dcmtCheckoutInfo = currentItems;
|
|
135
|
-
};
|
|
136
|
-
export const downloadFilesCallback = async (originalFileName, dcmt, checkout, downloadDcmtsAsync) => {
|
|
137
|
-
const files = [];
|
|
138
|
-
dcmt.forEach(file => {
|
|
139
|
-
if (file.TID && file.DID && file.FILEEXT) {
|
|
140
|
-
let fileName = getCicoDownloadFileName(originalFileName, file, checkout, true);
|
|
141
|
-
if (checkout) {
|
|
142
|
-
const newItem = {
|
|
143
|
-
TID: file.TID.toString(),
|
|
144
|
-
DID: file.DID.toString(),
|
|
145
|
-
checkoutFolder: "",
|
|
146
|
-
checkoutName: fileName
|
|
147
|
-
};
|
|
148
|
-
updateDcmtCheckoutItem(newItem, "addOrUpdate");
|
|
149
|
-
}
|
|
150
|
-
files.push({ TID: file.TID, DID: file.DID, FILEEXT: file.FILEEXT, fileName });
|
|
151
|
-
}
|
|
152
|
-
});
|
|
153
|
-
if (files.length > 0)
|
|
154
|
-
await downloadDcmtsAsync(files, DownloadTypes.Dcmt, "download");
|
|
155
|
-
};
|