@topconsultnpm/sdkui-react 6.20.0-dev1.3 → 6.20.0-dev1.30

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 (64) 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 +41 -5
  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 +268 -168
  19. package/lib/components/features/documents/TMDcmtPreview.js +37 -66
  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 +74 -111
  24. package/lib/components/features/search/TMSearchResultsMenuItems.d.ts +1 -1
  25. package/lib/components/features/search/TMSearchResultsMenuItems.js +26 -43
  26. package/lib/components/features/search/TMSignatureInfoContent.d.ts +6 -0
  27. package/lib/components/features/search/TMSignatureInfoContent.js +140 -0
  28. package/lib/components/forms/Login/LoginValidatorService.d.ts +2 -0
  29. package/lib/components/forms/Login/LoginValidatorService.js +7 -2
  30. package/lib/components/forms/Login/TMLoginForm.js +34 -6
  31. package/lib/css/tm-sdkui.css +1 -1
  32. package/lib/helper/SDKUI_Globals.d.ts +13 -14
  33. package/lib/helper/SDKUI_Globals.js +9 -0
  34. package/lib/helper/SDKUI_Localizator.d.ts +8 -0
  35. package/lib/helper/SDKUI_Localizator.js +98 -0
  36. package/lib/helper/TMPdfViewer.d.ts +8 -0
  37. package/lib/helper/TMPdfViewer.js +187 -0
  38. package/lib/helper/TMUtils.d.ts +3 -1
  39. package/lib/helper/TMUtils.js +51 -0
  40. package/lib/helper/checkinCheckoutManager.d.ts +85 -0
  41. package/lib/helper/checkinCheckoutManager.js +348 -0
  42. package/lib/helper/devextremeCustomMessages.d.ts +30 -0
  43. package/lib/helper/devextremeCustomMessages.js +30 -0
  44. package/lib/helper/helpers.js +7 -1
  45. package/lib/helper/index.d.ts +2 -0
  46. package/lib/helper/index.js +2 -0
  47. package/lib/helper/queryHelper.js +29 -0
  48. package/lib/hooks/useCheckInOutOperations.d.ts +28 -0
  49. package/lib/hooks/useCheckInOutOperations.js +223 -0
  50. package/lib/services/platform_services.d.ts +1 -1
  51. package/package.json +5 -2
  52. package/lib/components/NewComponents/Notification/Notification.d.ts +0 -4
  53. package/lib/components/NewComponents/Notification/Notification.js +0 -60
  54. package/lib/components/NewComponents/Notification/NotificationContainer.d.ts +0 -8
  55. package/lib/components/NewComponents/Notification/NotificationContainer.js +0 -33
  56. package/lib/components/NewComponents/Notification/index.d.ts +0 -2
  57. package/lib/components/NewComponents/Notification/index.js +0 -2
  58. package/lib/components/NewComponents/Notification/styles.d.ts +0 -21
  59. package/lib/components/NewComponents/Notification/styles.js +0 -180
  60. package/lib/components/NewComponents/Notification/types.d.ts +0 -18
  61. package/lib/components/NewComponents/Notification/types.js +0 -1
  62. package/lib/components/features/search/TMSearchResultCheckoutInfoForm.d.ts +0 -8
  63. package/lib/helper/cicoHelper.d.ts +0 -31
  64. package/lib/helper/cicoHelper.js +0 -155
@@ -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>;
@@ -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
- };