@topconsultnpm/sdkui-react 6.20.0-dev1.14 → 6.20.0-dev1.16
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/base/TMCustomButton.js +0 -1
- package/lib/components/base/TMDataGrid.d.ts +2 -2
- package/lib/components/base/TMDataGrid.js +15 -4
- package/lib/components/features/documents/TMDcmtForm.js +146 -63
- package/lib/components/features/search/TMDcmtCheckoutInfoForm.d.ts +8 -0
- package/lib/components/features/search/{TMSearchResultCheckoutInfoForm.js → TMDcmtCheckoutInfoForm.js} +2 -2
- package/lib/components/features/search/TMSearchResult.js +21 -195
- package/lib/components/features/search/TMSearchResultsMenuItems.d.ts +1 -1
- package/lib/components/features/search/TMSearchResultsMenuItems.js +3 -3
- package/lib/components/forms/Login/TMLoginForm.js +2 -0
- package/lib/helper/SDKUI_Localizator.d.ts +1 -0
- package/lib/helper/SDKUI_Localizator.js +10 -0
- package/lib/helper/checkinCheckoutManager.d.ts +30 -1
- package/lib/helper/checkinCheckoutManager.js +109 -29
- 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/queryHelper.js +17 -0
- package/lib/hooks/useCheckInOutOperations.d.ts +28 -0
- package/lib/hooks/useCheckInOutOperations.js +223 -0
- package/package.json +1 -1
- package/lib/components/NewComponents/ContextMenu/TMContextMenu.d.ts +0 -4
- package/lib/components/NewComponents/ContextMenu/TMContextMenu.js +0 -187
- package/lib/components/NewComponents/ContextMenu/hooks.d.ts +0 -11
- package/lib/components/NewComponents/ContextMenu/hooks.js +0 -48
- package/lib/components/NewComponents/ContextMenu/index.d.ts +0 -2
- package/lib/components/NewComponents/ContextMenu/index.js +0 -1
- package/lib/components/NewComponents/ContextMenu/styles.d.ts +0 -27
- package/lib/components/NewComponents/ContextMenu/styles.js +0 -308
- package/lib/components/NewComponents/ContextMenu/types.d.ts +0 -26
- package/lib/components/NewComponents/ContextMenu/types.js +0 -1
- package/lib/components/NewComponents/FloatingMenuBar/TMFloatingMenuBar.d.ts +0 -4
- package/lib/components/NewComponents/FloatingMenuBar/TMFloatingMenuBar.js +0 -370
- package/lib/components/NewComponents/FloatingMenuBar/index.d.ts +0 -2
- package/lib/components/NewComponents/FloatingMenuBar/index.js +0 -2
- package/lib/components/NewComponents/FloatingMenuBar/styles.d.ts +0 -38
- package/lib/components/NewComponents/FloatingMenuBar/styles.js +0 -267
- package/lib/components/NewComponents/FloatingMenuBar/types.d.ts +0 -30
- package/lib/components/NewComponents/FloatingMenuBar/types.js +0 -1
- package/lib/components/NewComponents/Notification/Notification.d.ts +0 -4
- package/lib/components/NewComponents/Notification/Notification.js +0 -60
- package/lib/components/NewComponents/Notification/NotificationContainer.d.ts +0 -8
- package/lib/components/NewComponents/Notification/NotificationContainer.js +0 -33
- package/lib/components/NewComponents/Notification/index.d.ts +0 -2
- package/lib/components/NewComponents/Notification/index.js +0 -2
- package/lib/components/NewComponents/Notification/styles.d.ts +0 -21
- package/lib/components/NewComponents/Notification/styles.js +0 -180
- package/lib/components/NewComponents/Notification/types.d.ts +0 -18
- package/lib/components/NewComponents/Notification/types.js +0 -1
- package/lib/components/features/search/TMSearchResultCheckoutInfoForm.d.ts +0 -8
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { AccessLevels, CICO_MetadataNames, SDK_Globals } from "@topconsultnpm/sdk-ts";
|
|
2
|
+
import { AccessLevels, CICO_MetadataNames, SDK_Globals, SystemMIDsAsNumber } from "@topconsultnpm/sdk-ts";
|
|
3
3
|
import TMTooltip from "../components/base/TMTooltip";
|
|
4
4
|
import { Globalization, SDKUI_Globals, SDKUI_Localizator } from "./index";
|
|
5
5
|
import { DownloadTypes } from "../ts/types";
|
|
@@ -191,7 +191,7 @@ export const renderCicoCheckInContent = (source, selectedFilename, isValid, vali
|
|
|
191
191
|
const fileName = source.type === 'fileItem' ? source.fileItem.name : (source.dcmtInfo.fileName ?? SDKUI_Localizator.SearchResult);
|
|
192
192
|
return _jsxs("div", { style: { width: "100%", height: "100%" }, children: [SDKUI_Localizator.CheckInElementConfirm.replaceParams(fileName), !isValid && _jsxs("div", { style: { width: "100%", height: "100%", marginTop: '15px' }, children: [_jsxs("div", { style: { display: 'flex', flexDirection: 'column' }, children: [_jsx("div", { style: { fontSize: '12px', color, marginBottom: '12px' }, children: SDKUI_Localizator.ElementNameConventionError }), _jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '6px' }, children: [_jsxs("div", { style: { color }, children: [_jsx("strong", { style: { color }, children: SDKUI_Localizator.Expected }), ":", ' ', _jsx("span", { style: { fontStyle: 'italic' }, children: getCicoDownloadFileName(source, true, false) })] }), _jsxs("div", { style: { color }, children: [_jsx("strong", { style: { color }, children: SDKUI_Localizator.SelectedSingular }), ":", ' ', _jsx("span", { style: { fontStyle: 'italic' }, children: selectedFilename.name })] })] })] }), validationItems && Object.entries(validationItems).filter(([_, value]) => !value.isValid).length > 0 && (_jsxs("div", { style: { width: "100%", height: "100%", marginTop: '15px' }, children: [_jsx("hr", {}), _jsxs("table", { style: { width: "100%", borderCollapse: "collapse", color }, children: [_jsx("caption", { style: { textAlign: "center", fontWeight: "bold", marginBottom: "5px" }, children: SDKUI_Localizator.Anomalies }), _jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { style: { textAlign: "left", borderBottom: "1px solid #eee" }, children: SDKUI_Localizator.Value }), _jsx("th", { style: { textAlign: "left", borderBottom: "1px solid #eee" }, children: SDKUI_Localizator.Expected }), _jsx("th", { style: { textAlign: "left", borderBottom: "1px solid #eee" }, children: SDKUI_Localizator.Current })] }) }), _jsx("tbody", { children: Object.entries(validationItems).filter(([_, value]) => !value.isValid).map(([key, result]) => (_jsxs("tr", { children: [_jsx("td", { style: { borderBottom: "1px solid #eee" }, children: _jsx("strong", { style: { textTransform: "capitalize" }, children: key }) }), _jsxs("td", { style: { borderBottom: "1px solid #eee" }, children: [" ", result.expected || "-"] }), _jsxs("td", { style: { borderBottom: "1px solid #eee" }, children: [" ", result.current || "-"] })] }, key))) })] }), _jsx("hr", {})] })), _jsx("div", { style: { fontSize: '12px', marginTop: '15px', marginBottom: '15px' }, children: SDKUI_Localizator.ProceedAnyway })] })] });
|
|
193
193
|
};
|
|
194
|
-
const getDcmtCicoInfo = (dtd) => {
|
|
194
|
+
export const getDcmtCicoInfo = (dtd) => {
|
|
195
195
|
const cico = {
|
|
196
196
|
CICO: 0,
|
|
197
197
|
CanCICO: AccessLevels.No,
|
|
@@ -210,57 +210,137 @@ const getDcmtCicoInfo = (dtd) => {
|
|
|
210
210
|
cico.CanDelChronology = dtd.perm?.canDelChron ?? AccessLevels.No;
|
|
211
211
|
const mdCheckout = dtd.metadata?.find(md => md.name === CICO_MetadataNames.CICO_CheckoutUserID);
|
|
212
212
|
if (mdCheckout) {
|
|
213
|
-
cico.UserID_MID = mdCheckout.
|
|
213
|
+
cico.UserID_MID = mdCheckout.id;
|
|
214
214
|
cico.UserID_CanViewOrUpdate = (mdCheckout.perm?.canView == AccessLevels.Yes || mdCheckout.perm?.canUpdate == AccessLevels.Yes) ? AccessLevels.Yes : AccessLevels.No;
|
|
215
215
|
}
|
|
216
216
|
const mdDate = dtd.metadata?.find(md => md.name === CICO_MetadataNames.CICO_CheckoutDate);
|
|
217
217
|
if (mdDate) {
|
|
218
|
-
cico.Date_MID = mdDate.
|
|
218
|
+
cico.Date_MID = mdDate.id;
|
|
219
219
|
cico.Date_CanViewOrUpdate = (mdDate.perm?.canView == AccessLevels.Yes || mdDate.perm?.canUpdate == AccessLevels.Yes) ? AccessLevels.Yes : AccessLevels.No;
|
|
220
220
|
}
|
|
221
221
|
const mdVer = dtd.metadata?.find(md => md.name === CICO_MetadataNames.CICO_Version);
|
|
222
222
|
if (mdVer) {
|
|
223
|
-
cico.Ver_MID = mdVer.
|
|
223
|
+
cico.Ver_MID = mdVer.id;
|
|
224
224
|
cico.Ver_CanViewOrUpdate = (mdVer.perm?.canView == AccessLevels.Yes || mdVer.perm?.canUpdate == AccessLevels.Yes) ? AccessLevels.Yes : AccessLevels.No;
|
|
225
225
|
}
|
|
226
226
|
return cico;
|
|
227
227
|
};
|
|
228
|
+
/**
|
|
229
|
+
* Determina lo stato di check-in/check-out di un documento
|
|
230
|
+
*
|
|
231
|
+
* @param dcmt - Il documento in formato array (MetadataValueDescriptorEx[]) o oggetto piatto
|
|
232
|
+
* @param allUsers - Lista di tutti gli utenti per risolvere i nomi
|
|
233
|
+
* @param dtd - Descrittore del tipo documento contenente le definizioni dei metadati CICO
|
|
234
|
+
* @returns Oggetto con cicoEnabled (se CICO è abilitato) e checkoutStatus (dettagli dello stato)
|
|
235
|
+
*/
|
|
228
236
|
export const getDcmtCicoStatus = (dcmt, allUsers, dtd) => {
|
|
237
|
+
// ========================================================================
|
|
238
|
+
// VALIDAZIONE PARAMETRI
|
|
239
|
+
// ========================================================================
|
|
240
|
+
// Se i parametri essenziali non sono forniti, ritorna stato di default
|
|
229
241
|
if (dcmt === undefined || dtd === undefined) {
|
|
230
242
|
return {
|
|
231
243
|
cicoEnabled: false,
|
|
232
244
|
checkoutStatus: { isCheckedOut: false, mode: '', version: 1, icon: null }
|
|
233
245
|
};
|
|
234
246
|
}
|
|
247
|
+
// ========================================================================
|
|
248
|
+
// ESTRAZIONE INFORMAZIONI CICO DAL DTD
|
|
249
|
+
// ========================================================================
|
|
250
|
+
// Recupera le configurazioni e permessi CICO dal tipo documento
|
|
235
251
|
const cicoInfo = getDcmtCicoInfo(dtd);
|
|
236
|
-
const CICO_CheckoutUserID_Meta = dtd?.metadata?.find(md => md.name === CICO_MetadataNames.CICO_CheckoutUserID);
|
|
237
|
-
const CICO_CheckoutDate_Meta = dtd?.metadata?.find(md => md.name === CICO_MetadataNames.CICO_CheckoutDate);
|
|
238
|
-
const CICO_Version_Meta = dtd?.metadata?.find(md => md.name === CICO_MetadataNames.CICO_Version);
|
|
239
|
-
const keyVersion = dcmt.TID + "_" + (CICO_Version_Meta?.id ?? 0);
|
|
240
|
-
const versionRaw = CICO_Version_Meta?.id ? dcmt[keyVersion] : undefined;
|
|
241
|
-
const version = (versionRaw != null && !isNaN(Number(versionRaw))) ? Number(versionRaw) : 1;
|
|
242
|
-
let checkoutStatus = { isCheckedOut: false, mode: '', version: version, icon: null, };
|
|
243
252
|
const userID = SDK_Globals.tmSession?.SessionDescr?.userID;
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
253
|
+
// Variabili comuni per entrambi i formati di documento
|
|
254
|
+
let checkoutUserId;
|
|
255
|
+
let checkoutDate;
|
|
256
|
+
let version = 1;
|
|
257
|
+
let fileExt;
|
|
258
|
+
// ========================================================================
|
|
259
|
+
// CASO 1: Documento come Array di MetadataValueDescriptorEx
|
|
260
|
+
// ========================================================================
|
|
261
|
+
// Questo formato viene utilizzato quando il documento proviene da query
|
|
262
|
+
// o liste dove ogni metadato è un oggetto separato con proprietà 'md' e 'value'
|
|
263
|
+
if (Array.isArray(dcmt) && dcmt.length > 0 && dcmt[0]?.md !== undefined) {
|
|
264
|
+
const dcmtsArray = dcmt;
|
|
265
|
+
// Estrai l'ID dell'utente che ha effettuato il checkout
|
|
266
|
+
const checkoutUserIdProperty = dcmtsArray.find((item) => item.md?.name === CICO_MetadataNames.CICO_CheckoutUserID);
|
|
267
|
+
const checkoutUserIdValue = checkoutUserIdProperty?.value;
|
|
268
|
+
checkoutUserId = checkoutUserIdValue ? Number(checkoutUserIdValue) : undefined;
|
|
269
|
+
// Estrai la data di checkout
|
|
270
|
+
const checkoutDateProperty = dcmtsArray.find((item) => item.md?.name === CICO_MetadataNames.CICO_CheckoutDate);
|
|
271
|
+
checkoutDate = checkoutDateProperty?.value;
|
|
272
|
+
// Estrai la versione del documento
|
|
273
|
+
const versionProperty = dcmtsArray.find((item) => item.md?.name === CICO_MetadataNames.CICO_Version);
|
|
274
|
+
const versionRaw = versionProperty?.value;
|
|
275
|
+
version = (versionRaw != null && !isNaN(Number(versionRaw))) ? Number(versionRaw) : 1;
|
|
276
|
+
const fileExtProperty = dcmtsArray.find((item) => item.mid === SystemMIDsAsNumber.FileExt);
|
|
277
|
+
fileExt = fileExtProperty?.value ? fileExtProperty.value.toString() : null;
|
|
278
|
+
}
|
|
279
|
+
// ========================================================================
|
|
280
|
+
// CASO 2: Documento come Oggetto Piatto (formato standard)
|
|
281
|
+
// ========================================================================
|
|
282
|
+
// Questo formato viene utilizzato quando il documento ha proprietà dirette
|
|
283
|
+
// nel formato chiave-valore: TID, DID, e "TID_MetadataID" per i metadati
|
|
284
|
+
else {
|
|
285
|
+
// Trova i metadati CICO nel descrittore del tipo documento
|
|
286
|
+
const CICO_CheckoutUserID_Meta = dtd.metadata?.find(md => md.name === CICO_MetadataNames.CICO_CheckoutUserID);
|
|
287
|
+
const CICO_CheckoutDate_Meta = dtd.metadata?.find(md => md.name === CICO_MetadataNames.CICO_CheckoutDate);
|
|
288
|
+
const CICO_Version_Meta = dtd.metadata?.find(md => md.name === CICO_MetadataNames.CICO_Version);
|
|
289
|
+
fileExt = dcmt.FILEEXT ? dcmt.FILEEXT.toString() : null;
|
|
290
|
+
// Estrai l'ID dell'utente che ha effettuato il checkout
|
|
291
|
+
if (CICO_CheckoutUserID_Meta?.id) {
|
|
292
|
+
const keyUserID = dcmt.TID + "_" + CICO_CheckoutUserID_Meta.id;
|
|
293
|
+
const checkoutUserIdValue = dcmt[keyUserID];
|
|
294
|
+
checkoutUserId = checkoutUserIdValue ? Number(checkoutUserIdValue) : undefined;
|
|
295
|
+
}
|
|
296
|
+
// Estrai la data di checkout
|
|
297
|
+
if (CICO_CheckoutDate_Meta?.id) {
|
|
298
|
+
const keyDate = dcmt.TID + "_" + CICO_CheckoutDate_Meta.id;
|
|
299
|
+
checkoutDate = dcmt[keyDate];
|
|
300
|
+
}
|
|
301
|
+
// Estrai la versione del documento
|
|
302
|
+
if (CICO_Version_Meta?.id) {
|
|
303
|
+
const keyVersion = dcmt.TID + "_" + CICO_Version_Meta.id;
|
|
304
|
+
const versionRaw = dcmt[keyVersion];
|
|
305
|
+
version = (versionRaw != null && !isNaN(Number(versionRaw))) ? Number(versionRaw) : 1;
|
|
260
306
|
}
|
|
261
307
|
}
|
|
308
|
+
// ========================================================================
|
|
309
|
+
// COSTRUZIONE DELLO STATO DI CHECKOUT
|
|
310
|
+
// ========================================================================
|
|
311
|
+
let checkoutStatus = {
|
|
312
|
+
isCheckedOut: false,
|
|
313
|
+
mode: '',
|
|
314
|
+
version: version,
|
|
315
|
+
icon: null
|
|
316
|
+
};
|
|
317
|
+
// Verifica se il documento è effettivamente in stato di checkout
|
|
318
|
+
if (userID && checkoutUserId && !isNaN(checkoutUserId) && checkoutUserId > 0) {
|
|
319
|
+
// Determina la modalità in base all'utente:
|
|
320
|
+
// - editMode: l'utente corrente può modificare (è lui che ha fatto il checkout)
|
|
321
|
+
// - lockMode: il documento è bloccato da un altro utente
|
|
322
|
+
const mode = (userID === checkoutUserId) ? 'editMode' : 'lockMode';
|
|
323
|
+
// ====================================================================
|
|
324
|
+
// COSTRUZIONE DEL TOOLTIP INFORMATIVO
|
|
325
|
+
// ====================================================================
|
|
326
|
+
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] }) })] })] }));
|
|
327
|
+
// Crea l'icona con tooltip appropriata alla modalità
|
|
328
|
+
const icon = mode === 'editMode'
|
|
329
|
+
? _jsx(TMTooltip, { content: editLockTooltipText, children: _jsx("i", { style: { fontSize: "18px", color: colors.MEDIUM_GREEN, fontWeight: "bold" }, className: "dx-icon-edit" }) })
|
|
330
|
+
: _jsx(TMTooltip, { content: editLockTooltipText, children: _jsx("i", { style: { fontSize: "18px", color: colors.MEDIUM_GREEN, fontWeight: "bold" }, className: "dx-icon-lock" }) });
|
|
331
|
+
checkoutStatus = {
|
|
332
|
+
isCheckedOut: true,
|
|
333
|
+
mode: mode,
|
|
334
|
+
icon: icon,
|
|
335
|
+
version: version
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
// ========================================================================
|
|
339
|
+
// RESTITUZIONE RISULTATO FINALE
|
|
340
|
+
// ========================================================================
|
|
262
341
|
return {
|
|
263
|
-
|
|
342
|
+
// CICO è abilitato se configurato nel DTD e l'utente ha i permessi
|
|
343
|
+
cicoEnabled: cicoInfo.CICO === 1 && cicoInfo.CanCICO === AccessLevels.Yes && fileExt !== null && fileExt !== '',
|
|
264
344
|
checkoutStatus: checkoutStatus
|
|
265
345
|
};
|
|
266
346
|
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom DevExtreme localization messages
|
|
3
|
+
* Contains missing translations for DevExtreme components
|
|
4
|
+
*/
|
|
5
|
+
export declare const devextremeCustomMessages: {
|
|
6
|
+
de: {
|
|
7
|
+
"dxDataGrid-moveColumnToTheRight": string;
|
|
8
|
+
"dxDataGrid-moveColumnToTheLeft": string;
|
|
9
|
+
};
|
|
10
|
+
en: {
|
|
11
|
+
"dxDataGrid-moveColumnToTheRight": string;
|
|
12
|
+
"dxDataGrid-moveColumnToTheLeft": string;
|
|
13
|
+
};
|
|
14
|
+
es: {
|
|
15
|
+
"dxDataGrid-moveColumnToTheRight": string;
|
|
16
|
+
"dxDataGrid-moveColumnToTheLeft": string;
|
|
17
|
+
};
|
|
18
|
+
fr: {
|
|
19
|
+
"dxDataGrid-moveColumnToTheRight": string;
|
|
20
|
+
"dxDataGrid-moveColumnToTheLeft": string;
|
|
21
|
+
};
|
|
22
|
+
it: {
|
|
23
|
+
"dxDataGrid-moveColumnToTheRight": string;
|
|
24
|
+
"dxDataGrid-moveColumnToTheLeft": string;
|
|
25
|
+
};
|
|
26
|
+
pt: {
|
|
27
|
+
"dxDataGrid-moveColumnToTheRight": string;
|
|
28
|
+
"dxDataGrid-moveColumnToTheLeft": string;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom DevExtreme localization messages
|
|
3
|
+
* Contains missing translations for DevExtreme components
|
|
4
|
+
*/
|
|
5
|
+
export const devextremeCustomMessages = {
|
|
6
|
+
"de": {
|
|
7
|
+
"dxDataGrid-moveColumnToTheRight": "Nach rechts verschieben",
|
|
8
|
+
"dxDataGrid-moveColumnToTheLeft": "Nach links verschieben"
|
|
9
|
+
},
|
|
10
|
+
"en": {
|
|
11
|
+
"dxDataGrid-moveColumnToTheRight": "Move to the right",
|
|
12
|
+
"dxDataGrid-moveColumnToTheLeft": "Move to the left"
|
|
13
|
+
},
|
|
14
|
+
"es": {
|
|
15
|
+
"dxDataGrid-moveColumnToTheRight": "Mover a la derecha",
|
|
16
|
+
"dxDataGrid-moveColumnToTheLeft": "Mover a la izquierda"
|
|
17
|
+
},
|
|
18
|
+
"fr": {
|
|
19
|
+
"dxDataGrid-moveColumnToTheRight": "Déplacer vers la droite",
|
|
20
|
+
"dxDataGrid-moveColumnToTheLeft": "Déplacer vers la gauche"
|
|
21
|
+
},
|
|
22
|
+
"it": {
|
|
23
|
+
"dxDataGrid-moveColumnToTheRight": "Sposta a destra",
|
|
24
|
+
"dxDataGrid-moveColumnToTheLeft": "Sposta a sinistra"
|
|
25
|
+
},
|
|
26
|
+
"pt": {
|
|
27
|
+
"dxDataGrid-moveColumnToTheRight": "Mover para a direita",
|
|
28
|
+
"dxDataGrid-moveColumnToTheLeft": "Mover para a esquerda"
|
|
29
|
+
}
|
|
30
|
+
};
|
package/lib/helper/helpers.js
CHANGED
|
@@ -664,7 +664,13 @@ export const renderHighlightedText = (text, searchText, isSelected) => {
|
|
|
664
664
|
return text.split(regex).map((part, index) => regex.test(part) ? (_jsx("span", { style: { backgroundColor: isSelected ? '#6c9023' : 'yellow' }, children: part }, index)) : (part));
|
|
665
665
|
};
|
|
666
666
|
export function versionAndBuildtypeInfo(module) {
|
|
667
|
-
|
|
667
|
+
switch (module) {
|
|
668
|
+
case moduleTypes.SDK:
|
|
669
|
+
case moduleTypes.SDKUI:
|
|
670
|
+
return moduleVersion(module).replace("-hotfix", "+hotfix");
|
|
671
|
+
default:
|
|
672
|
+
return moduleVersion(module);
|
|
673
|
+
}
|
|
668
674
|
}
|
|
669
675
|
export const getListMaxItems = (deviceType) => { return deviceType === DeviceType.MOBILE ? 8 : 12; };
|
|
670
676
|
export const svgToString = (icon) => {
|
|
@@ -2,6 +2,7 @@ import { AccessLevels, MetadataDataDomains, DcmtTypeListCacheService, SystemMIDs
|
|
|
2
2
|
import { DateDisplayTypes, Globalization } from './Globalization';
|
|
3
3
|
import { ChronologyMIDs, DraftsMIDs, MetadataValueDescriptorEx } from '../ts';
|
|
4
4
|
import { SDKUI_Localizator } from './SDKUI_Localizator';
|
|
5
|
+
import { getDcmtCicoInfo } from './checkinCheckoutManager';
|
|
5
6
|
export const getTIDsByQd = (qd) => {
|
|
6
7
|
let tids = [];
|
|
7
8
|
qd?.from?.tid && tids.push({ tid: qd.from?.tid, alias: undefined });
|
|
@@ -82,6 +83,22 @@ export const prepareQdForSearchAsync = async (qdInput, removeWhereItemNoValue) =
|
|
|
82
83
|
addHiddenSelectItem(qd.select, fromTID, SystemMIDsAsNumber.IsMail);
|
|
83
84
|
addHiddenSelectItem(qd.select, fromTID, SystemMIDsAsNumber.IsSigned);
|
|
84
85
|
addHiddenSelectItem(qd.select, fromTID, SystemMIDsAsNumber.IsShared);
|
|
86
|
+
const dtd = await DcmtTypeListCacheService.GetAsync(fromTID);
|
|
87
|
+
if (dtd) {
|
|
88
|
+
const cicoInfo = getDcmtCicoInfo(dtd);
|
|
89
|
+
const canCICO = cicoInfo.CICO === 1 && cicoInfo.CanCICO === AccessLevels.Yes;
|
|
90
|
+
if (canCICO) {
|
|
91
|
+
if (!qd.select.find(o => o.mid == cicoInfo.UserID_MID) && cicoInfo.UserID_CanViewOrUpdate == AccessLevels.Yes) {
|
|
92
|
+
addHiddenSelectItem(qd.select, fromTID, cicoInfo.UserID_MID);
|
|
93
|
+
}
|
|
94
|
+
if (!qd.select.find(o => o.mid == cicoInfo.Date_MID) && cicoInfo.Date_CanViewOrUpdate == AccessLevels.Yes) {
|
|
95
|
+
addHiddenSelectItem(qd.select, fromTID, cicoInfo.Date_MID);
|
|
96
|
+
}
|
|
97
|
+
if (!qd.select.find(o => o.mid == cicoInfo.Ver_MID) && cicoInfo.Ver_CanViewOrUpdate == AccessLevels.Yes) {
|
|
98
|
+
addHiddenSelectItem(qd.select, fromTID, cicoInfo.Ver_MID);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
85
102
|
if (qd.orderBy && qd.orderBy.length <= 0) {
|
|
86
103
|
let obi = new OrderByItem();
|
|
87
104
|
obi.tid = fromTID;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { DcmtInfo, DownloadModes, DownloadTypes } from '../ts';
|
|
2
|
+
import { FileDescriptor, SearchResultDescriptor } from '@topconsultnpm/sdk-ts';
|
|
3
|
+
interface UseCheckInOutOperationsReturn {
|
|
4
|
+
showHistory: boolean;
|
|
5
|
+
showHistoryCallback: () => void;
|
|
6
|
+
hideHistoryCallback: () => void;
|
|
7
|
+
showCheckoutInformationForm: boolean;
|
|
8
|
+
showCheckoutInformationFormCallback: () => void;
|
|
9
|
+
hideCheckoutInformationFormCallback: () => void;
|
|
10
|
+
commentFormState: {
|
|
11
|
+
removeAndEditAttachment: boolean;
|
|
12
|
+
show: boolean;
|
|
13
|
+
isRequired: boolean;
|
|
14
|
+
};
|
|
15
|
+
hideCommentFormCallback: () => void;
|
|
16
|
+
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>, refreshCurrentDcmt?: () => Promise<void>, refreshFocusedDataRowAsync?: (tid: number | undefined, did: number | undefined, refreshUI?: boolean, metadataResult?: SearchResultDescriptor | null) => Promise<void>) => Promise<void>;
|
|
18
|
+
handleCheckInCallback: (dcmt: DcmtInfo, refreshCurrentDcmt?: () => Promise<void>, refreshFocusedDataRowAsync?: (tid: number | undefined, did: number | undefined, refreshUI?: boolean, metadataResult?: SearchResultDescriptor | null) => Promise<void>) => Promise<void>;
|
|
19
|
+
refreshPreviewTrigger: number;
|
|
20
|
+
showCicoWaitPanel: boolean;
|
|
21
|
+
cicoWaitPanelTitle: string;
|
|
22
|
+
showCicoPrimaryProgress: boolean;
|
|
23
|
+
cicoPrimaryProgressText: string;
|
|
24
|
+
cicoPrimaryProgressValue: number;
|
|
25
|
+
cicoPrimaryProgressMax: number;
|
|
26
|
+
}
|
|
27
|
+
export declare const useCheckInOutOperations: () => UseCheckInOutOperationsReturn;
|
|
28
|
+
export {};
|
|
@@ -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
|
+
};
|
package/package.json
CHANGED