@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.
Files changed (49) hide show
  1. package/lib/components/NewComponents/ContextMenu/TMContextMenu.js +3 -3
  2. package/lib/components/NewComponents/ContextMenu/hooks.d.ts +1 -0
  3. package/lib/components/NewComponents/ContextMenu/hooks.js +8 -4
  4. package/lib/components/NewComponents/ContextMenu/styles.d.ts +4 -1
  5. package/lib/components/NewComponents/ContextMenu/styles.js +41 -8
  6. package/lib/components/NewComponents/ContextMenu/types.d.ts +1 -0
  7. package/lib/components/NewComponents/FloatingMenuBar/TMFloatingMenuBar.js +38 -30
  8. package/lib/components/NewComponents/FloatingMenuBar/styles.d.ts +8 -0
  9. package/lib/components/NewComponents/FloatingMenuBar/styles.js +30 -19
  10. package/lib/components/base/TMAccordion.js +2 -2
  11. package/lib/components/base/TMCustomButton.js +0 -1
  12. package/lib/components/base/TMDataGrid.d.ts +2 -2
  13. package/lib/components/base/TMDataGrid.js +16 -5
  14. package/lib/components/editors/TMHtmlEditor.js +1 -1
  15. package/lib/components/editors/TMMetadataValues.js +20 -2
  16. package/lib/components/features/documents/TMDcmtBlog.d.ts +1 -7
  17. package/lib/components/features/documents/TMDcmtBlog.js +29 -2
  18. package/lib/components/features/documents/TMDcmtForm.js +270 -173
  19. package/lib/components/features/documents/TMDcmtPreview.js +100 -33
  20. package/lib/components/features/search/TMDcmtCheckoutInfoForm.d.ts +8 -0
  21. package/lib/components/features/search/{TMSearchResultCheckoutInfoForm.js → TMDcmtCheckoutInfoForm.js} +6 -11
  22. package/lib/components/features/search/TMSearchQueryPanel.js +13 -12
  23. package/lib/components/features/search/TMSearchResult.js +76 -114
  24. package/lib/components/features/search/TMSearchResultsMenuItems.d.ts +1 -1
  25. package/lib/components/features/search/TMSearchResultsMenuItems.js +16 -17
  26. package/lib/components/features/search/TMViewHistoryDcmt.js +1 -1
  27. package/lib/components/forms/Login/TMLoginForm.js +2 -0
  28. package/lib/css/tm-sdkui.css +1 -1
  29. package/lib/helper/SDKUI_Globals.d.ts +13 -14
  30. package/lib/helper/SDKUI_Globals.js +9 -0
  31. package/lib/helper/SDKUI_Localizator.d.ts +8 -0
  32. package/lib/helper/SDKUI_Localizator.js +98 -0
  33. package/lib/helper/TMUtils.d.ts +3 -1
  34. package/lib/helper/TMUtils.js +51 -0
  35. package/lib/helper/checkinCheckoutManager.d.ts +85 -0
  36. package/lib/helper/checkinCheckoutManager.js +348 -0
  37. package/lib/helper/devextremeCustomMessages.d.ts +30 -0
  38. package/lib/helper/devextremeCustomMessages.js +30 -0
  39. package/lib/helper/helpers.js +7 -1
  40. package/lib/helper/index.d.ts +1 -0
  41. package/lib/helper/index.js +1 -0
  42. package/lib/helper/queryHelper.js +29 -0
  43. package/lib/hooks/useCheckInOutOperations.d.ts +28 -0
  44. package/lib/hooks/useCheckInOutOperations.js +223 -0
  45. package/lib/services/platform_services.d.ts +1 -1
  46. package/package.json +12 -10
  47. package/lib/components/features/search/TMSearchResultCheckoutInfoForm.d.ts +0 -8
  48. package/lib/helper/cicoHelper.d.ts +0 -31
  49. package/lib/helper/cicoHelper.js +0 -155
@@ -0,0 +1,348 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { AccessLevels, CICO_MetadataNames, SDK_Globals, SystemMIDsAsNumber } 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
+ const findCheckOutUserName = (users, checkoutUserId) => {
7
+ let checkOutUser = users.find(user => user.id === checkoutUserId);
8
+ return checkOutUser ? checkOutUser.name : '-';
9
+ };
10
+ const colors = {
11
+ MEDIUM_GREEN: "#28a745",
12
+ };
13
+ export const getCicoDownloadFileName = (source, checkout, withTimestampAndExt) => {
14
+ const archiveID = SDK_Globals.tmSession?.SessionDescr?.archiveID;
15
+ if (!archiveID)
16
+ return '';
17
+ let baseName;
18
+ let tid;
19
+ let did;
20
+ let ext;
21
+ if (source.type === 'fileItem') {
22
+ // fileItem source
23
+ const { name, tid: tidValue, did: didValue, ext: extValue } = source.fileItem;
24
+ baseName = name.includes('.') ? name.substring(0, name.lastIndexOf('.')) : name;
25
+ tid = Number(tidValue);
26
+ did = Number(didValue);
27
+ ext = extValue;
28
+ }
29
+ else {
30
+ // dcmtInfo source
31
+ const { dcmtInfo, originalFileName } = source;
32
+ const { TID, DID, FILEEXT } = dcmtInfo;
33
+ baseName = originalFileName.includes('.') ? originalFileName.substring(0, originalFileName.lastIndexOf('.')) : originalFileName;
34
+ tid = TID;
35
+ did = DID;
36
+ ext = FILEEXT;
37
+ }
38
+ const fileIdentifier = `${archiveID}~${baseName}~${tid}~${did}`;
39
+ const extension = withTimestampAndExt && ext ? `.${ext}` : '';
40
+ let timestamp = '';
41
+ if (checkout && withTimestampAndExt) {
42
+ const now = new Date();
43
+ const pad = (n) => n.toString().padStart(2, '0');
44
+ timestamp = `~${now.getFullYear()}${pad(now.getMonth() + 1)}${pad(now.getDate())}${pad(now.getHours())}${pad(now.getMinutes())}${pad(now.getSeconds())}`;
45
+ }
46
+ return `${checkout ? 'checkout~' : ''}${fileIdentifier}${timestamp}${extension}`;
47
+ };
48
+ export const cicoDownloadFilesCallback = async (sources, checkout, downloadDcmtsAsync) => {
49
+ const files = [];
50
+ sources.forEach(source => {
51
+ let tid;
52
+ let did;
53
+ let ext;
54
+ if (source.type === 'fileItem') {
55
+ tid = Number(source.fileItem.tid);
56
+ did = Number(source.fileItem.did);
57
+ ext = source.fileItem.ext;
58
+ }
59
+ else {
60
+ tid = source.dcmtInfo.TID;
61
+ did = source.dcmtInfo.DID;
62
+ ext = source.dcmtInfo.FILEEXT;
63
+ }
64
+ if (tid && did && ext) {
65
+ let fileName = getCicoDownloadFileName(source, checkout, true);
66
+ if (checkout) {
67
+ const newItem = { TID: tid.toString(), DID: did.toString(), checkoutFolder: "", checkoutName: fileName };
68
+ updateCicoCheckoutStorageItem(newItem, source.type, "addOrUpdate");
69
+ }
70
+ files.push({ TID: tid, DID: did, FILEEXT: ext, fileName });
71
+ }
72
+ });
73
+ if (files.length > 0)
74
+ await downloadDcmtsAsync(files, DownloadTypes.Dcmt, "download");
75
+ };
76
+ export const updateCicoCheckoutStorageItem = (item, type, action = "addOrUpdate") => {
77
+ // Select the appropriate array based on type
78
+ const currentItems = type === 'dcmtInfo' ? [...SDKUI_Globals.userSettings.dcmtCheckoutInfo] : [...SDKUI_Globals.userSettings.wgDraftCheckoutInfo];
79
+ // Find the index of an existing item that has the same TID and DID as the new item
80
+ const index = currentItems.findIndex(i => i.TID === item.TID && i.DID === item.DID);
81
+ // If the action is to add a new item or update an existing one
82
+ if (action === "addOrUpdate") {
83
+ if (index >= 0) {
84
+ // If the item exists, overwrite it with the new values
85
+ currentItems[index] = item;
86
+ }
87
+ else {
88
+ // If the item does not exist, push it into the array
89
+ currentItems.push(item);
90
+ }
91
+ }
92
+ else if (action === "remove" && index >= 0) {
93
+ // If the action is to remove an item, remove it from the array
94
+ currentItems.splice(index, 1);
95
+ }
96
+ // Update the global array with the modified copy
97
+ if (type === 'dcmtInfo') {
98
+ SDKUI_Globals.userSettings.dcmtCheckoutInfo = currentItems;
99
+ }
100
+ else {
101
+ SDKUI_Globals.userSettings.wgDraftCheckoutInfo = currentItems;
102
+ }
103
+ };
104
+ export const validateCicoFileName = (source, fileName) => {
105
+ const archiveID = SDK_Globals.tmSession?.SessionDescr?.archiveID;
106
+ let baseName;
107
+ let tid;
108
+ let did;
109
+ let ext;
110
+ if (source.type === 'fileItem') {
111
+ // fileItem source
112
+ const { name: originalName, tid: tidValue, did: didValue, ext: extValue } = source.fileItem;
113
+ baseName = originalName.includes('.') ? originalName.substring(0, originalName.lastIndexOf('.')) : originalName;
114
+ tid = Number(tidValue);
115
+ did = Number(didValue);
116
+ ext = extValue;
117
+ }
118
+ else {
119
+ // dcmtInfo source
120
+ const { dcmtInfo, originalFileName } = source;
121
+ const { TID, DID, FILEEXT } = dcmtInfo;
122
+ baseName = originalFileName.includes('.') ? originalFileName.substring(0, originalFileName.lastIndexOf('.')) : originalFileName;
123
+ tid = TID;
124
+ did = DID;
125
+ ext = FILEEXT;
126
+ }
127
+ // Ensure originalName has the extension
128
+ const normalizedExt = ext?.toLowerCase() ?? '';
129
+ const name = baseName.toLowerCase().endsWith(`.${normalizedExt}`) ? baseName : `${baseName}.${normalizedExt}`;
130
+ let fileNameToValidate = fileName;
131
+ const fileExtensionCheck = fileNameToValidate.split('.').pop() ?? '';
132
+ // Remove extension part
133
+ fileNameToValidate = fileNameToValidate.slice(0, -fileExtensionCheck.length - 1);
134
+ // Check and remove 'checkout~' prefix if present
135
+ const hasCheckoutPrefix = fileNameToValidate.startsWith('checkout~');
136
+ if (hasCheckoutPrefix) {
137
+ fileNameToValidate = fileNameToValidate.replace(/^checkout~/, '');
138
+ }
139
+ // Split the remaining string by underscores (~)
140
+ const parts = fileNameToValidate.split('~');
141
+ if (parts.length !== 5) {
142
+ return {
143
+ isValid: false,
144
+ };
145
+ }
146
+ // Extract components starting from the end
147
+ const archiveCheck = parts[0];
148
+ const nameCheck = parts[1];
149
+ const tidCheck = parts[2];
150
+ const didCheck = parts[3];
151
+ // Validation checks
152
+ const expectedFullName = `${nameCheck}.${fileExtensionCheck}`.toLowerCase();
153
+ const isValidName = expectedFullName === name.toLowerCase();
154
+ const isValidDid = didCheck ? did.toString() === parseInt(didCheck, 10).toString() : false;
155
+ const isValidTid = tidCheck ? tid.toString() === parseInt(tidCheck, 10).toString() : false;
156
+ const isValidArchive = archiveCheck ? archiveCheck === archiveID : false;
157
+ const isValidExt = ext ? ext.toLowerCase() === fileExtensionCheck.toLowerCase() : false;
158
+ // Return validation results as an object
159
+ return {
160
+ isValid: !!(isValidName && isValidArchive && isValidDid && isValidTid && isValidExt),
161
+ validationResults: {
162
+ archiveID: {
163
+ expected: archiveID,
164
+ current: archiveCheck,
165
+ isValid: isValidArchive
166
+ },
167
+ name: {
168
+ expected: name.toLowerCase(),
169
+ current: expectedFullName,
170
+ isValid: isValidName
171
+ },
172
+ did: {
173
+ expected: did?.toString(),
174
+ current: didCheck,
175
+ isValid: isValidDid
176
+ },
177
+ tid: {
178
+ expected: tid.toString(),
179
+ current: tidCheck,
180
+ isValid: isValidTid
181
+ },
182
+ fileExtension: {
183
+ expected: ext?.toLowerCase(),
184
+ current: fileExtensionCheck.toLowerCase(),
185
+ isValid: isValidExt
186
+ }
187
+ }
188
+ };
189
+ };
190
+ export const renderCicoCheckInContent = (source, selectedFilename, isValid, validationItems, color = "#996300") => {
191
+ const fileName = source.type === 'fileItem' ? source.fileItem.name : (source.dcmtInfo.fileName ?? SDKUI_Localizator.SearchResult);
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
+ };
194
+ export const getDcmtCicoInfo = (dtd) => {
195
+ const cico = {
196
+ CICO: 0,
197
+ CanCICO: AccessLevels.No,
198
+ CanDelChronology: AccessLevels.No,
199
+ UserID_MID: 0,
200
+ Date_MID: 0,
201
+ Ver_MID: 0,
202
+ UserID_CanViewOrUpdate: AccessLevels.No,
203
+ Date_CanViewOrUpdate: AccessLevels.No,
204
+ Ver_CanViewOrUpdate: AccessLevels.No,
205
+ };
206
+ if (dtd === undefined)
207
+ return cico;
208
+ cico.CICO = dtd.cico ?? 0;
209
+ cico.CanCICO = dtd.perm?.canCICO ?? AccessLevels.No;
210
+ cico.CanDelChronology = dtd.perm?.canDelChron ?? AccessLevels.No;
211
+ const mdCheckout = dtd.metadata?.find(md => md.name === CICO_MetadataNames.CICO_CheckoutUserID);
212
+ if (mdCheckout) {
213
+ cico.UserID_MID = mdCheckout.id;
214
+ cico.UserID_CanViewOrUpdate = (mdCheckout.perm?.canView == AccessLevels.Yes || mdCheckout.perm?.canUpdate == AccessLevels.Yes) ? AccessLevels.Yes : AccessLevels.No;
215
+ }
216
+ const mdDate = dtd.metadata?.find(md => md.name === CICO_MetadataNames.CICO_CheckoutDate);
217
+ if (mdDate) {
218
+ cico.Date_MID = mdDate.id;
219
+ cico.Date_CanViewOrUpdate = (mdDate.perm?.canView == AccessLevels.Yes || mdDate.perm?.canUpdate == AccessLevels.Yes) ? AccessLevels.Yes : AccessLevels.No;
220
+ }
221
+ const mdVer = dtd.metadata?.find(md => md.name === CICO_MetadataNames.CICO_Version);
222
+ if (mdVer) {
223
+ cico.Ver_MID = mdVer.id;
224
+ cico.Ver_CanViewOrUpdate = (mdVer.perm?.canView == AccessLevels.Yes || mdVer.perm?.canUpdate == AccessLevels.Yes) ? AccessLevels.Yes : AccessLevels.No;
225
+ }
226
+ return cico;
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
+ */
236
+ export const getDcmtCicoStatus = (dcmt, allUsers, dtd) => {
237
+ // ========================================================================
238
+ // VALIDAZIONE PARAMETRI
239
+ // ========================================================================
240
+ // Se i parametri essenziali non sono forniti, ritorna stato di default
241
+ if (dcmt === undefined || dtd === undefined) {
242
+ return {
243
+ cicoEnabled: false,
244
+ checkoutStatus: { isCheckedOut: false, mode: '', version: 1, icon: null, editLockTooltipText: null }
245
+ };
246
+ }
247
+ // ========================================================================
248
+ // ESTRAZIONE INFORMAZIONI CICO DAL DTD
249
+ // ========================================================================
250
+ // Recupera le configurazioni e permessi CICO dal tipo documento
251
+ const cicoInfo = getDcmtCicoInfo(dtd);
252
+ const userID = SDK_Globals.tmSession?.SessionDescr?.userID;
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;
306
+ }
307
+ }
308
+ // ========================================================================
309
+ // COSTRUZIONE DELLO STATO DI CHECKOUT
310
+ // ========================================================================
311
+ let checkoutStatus = {
312
+ isCheckedOut: false,
313
+ mode: '',
314
+ version: version,
315
+ icon: null,
316
+ editLockTooltipText: null
317
+ };
318
+ // Verifica se il documento è effettivamente in stato di checkout
319
+ if (userID && checkoutUserId && !isNaN(checkoutUserId) && checkoutUserId > 0) {
320
+ // Determina la modalità in base all'utente:
321
+ // - editMode: l'utente corrente può modificare (è lui che ha fatto il checkout)
322
+ // - lockMode: il documento è bloccato da un altro utente
323
+ const mode = (userID === checkoutUserId) ? 'editMode' : 'lockMode';
324
+ // ====================================================================
325
+ // COSTRUZIONE DEL TOOLTIP INFORMATIVO
326
+ // ====================================================================
327
+ 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] }) })] })] }));
328
+ // Crea l'icona con tooltip appropriata alla modalità
329
+ const icon = mode === 'editMode'
330
+ ? _jsx(TMTooltip, { content: editLockTooltipText, children: _jsx("i", { style: { fontSize: "18px", color: colors.MEDIUM_GREEN, fontWeight: "bold" }, className: "dx-icon-edit" }) })
331
+ : _jsx(TMTooltip, { content: editLockTooltipText, children: _jsx("i", { style: { fontSize: "18px", color: colors.MEDIUM_GREEN, fontWeight: "bold" }, className: "dx-icon-lock" }) });
332
+ checkoutStatus = {
333
+ isCheckedOut: true,
334
+ mode: mode,
335
+ icon: icon,
336
+ version: version,
337
+ editLockTooltipText: editLockTooltipText
338
+ };
339
+ }
340
+ // ========================================================================
341
+ // RESTITUZIONE RISULTATO FINALE
342
+ // ========================================================================
343
+ return {
344
+ // CICO è abilitato se configurato nel DTD e l'utente ha i permessi
345
+ cicoEnabled: cicoInfo.CICO === 1 && cicoInfo.CanCICO === AccessLevels.Yes && fileExt !== null && fileExt !== '',
346
+ checkoutStatus: checkoutStatus
347
+ };
348
+ };
@@ -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
+ };
@@ -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
- return moduleVersion(module);
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) => {
@@ -11,3 +11,4 @@ export * from './TMCommandsContextMenu';
11
11
  export * from './TMConditionalWrapper';
12
12
  export * from './TMToppyMessage';
13
13
  export * from './GlobalStyles';
14
+ export * from './checkinCheckoutManager';
@@ -11,3 +11,4 @@ export * from './TMCommandsContextMenu';
11
11
  export * from './TMConditionalWrapper';
12
12
  export * from './TMToppyMessage';
13
13
  export * from './GlobalStyles';
14
+ export * from './checkinCheckoutManager';
@@ -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;
@@ -311,6 +328,18 @@ export const searchResultToMetadataValues = (tid, dtd, rows, mids, metadata, lay
311
328
  mvd.customName = SDKUI_Localizator.Author;
312
329
  mvd.isReadOnly = true;
313
330
  break;
331
+ case ChronologyMIDs.CheckInTime:
332
+ mvd.customName = SDKUI_Localizator.LastUpdateTime;
333
+ mvd.isReadOnly = true;
334
+ break;
335
+ case SystemMIDsAsNumber.FileExt:
336
+ mvd.customName = SDKUI_Localizator.Extension;
337
+ mvd.isReadOnly = true;
338
+ break;
339
+ case SystemMIDsAsNumber.FileSize:
340
+ mvd.customName = SDKUI_Localizator.File_Size;
341
+ mvd.isReadOnly = true;
342
+ break;
314
343
  }
315
344
  }
316
345
  return mvd;
@@ -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 {};