@topconsultnpm/sdkui-react 6.19.0 → 6.20.0-dev1.10
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/TMAccordion.js +2 -2
- package/lib/components/editors/TMHtmlEditor.js +1 -1
- package/lib/components/editors/TMMetadataValues.js +16 -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 +12 -29
- package/lib/components/features/documents/TMDcmtPreview.js +93 -64
- package/lib/components/features/search/TMSearchResult.js +158 -47
- package/lib/components/features/search/TMSearchResultCheckoutInfoForm.js +4 -9
- package/lib/components/features/search/TMSearchResultsMenuItems.d.ts +1 -1
- package/lib/components/features/search/TMSearchResultsMenuItems.js +16 -16
- package/lib/components/features/search/{TMViewHistoryDcmtForm.d.ts → TMViewHistoryDcmt.d.ts} +3 -3
- package/lib/components/features/search/{TMViewHistoryDcmtForm.js → TMViewHistoryDcmt.js} +83 -13
- package/lib/helper/SDKUI_Globals.d.ts +3 -14
- package/lib/helper/SDKUI_Localizator.d.ts +7 -0
- package/lib/helper/SDKUI_Localizator.js +88 -0
- package/lib/helper/TMUtils.d.ts +3 -1
- package/lib/helper/TMUtils.js +51 -0
- package/lib/helper/checkinCheckoutManager.d.ts +55 -0
- package/lib/helper/checkinCheckoutManager.js +266 -0
- package/lib/helper/helpers.js +6 -1
- package/lib/helper/index.d.ts +1 -0
- package/lib/helper/index.js +1 -0
- package/lib/helper/queryHelper.js +13 -1
- package/lib/services/platform_services.d.ts +1 -1
- package/package.json +52 -52
- package/lib/helper/cicoHelper.d.ts +0 -31
- package/lib/helper/cicoHelper.js +0 -155
|
@@ -0,0 +1,266 @@
|
|
|
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";
|
|
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
|
+
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.fromMID;
|
|
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.fromMID;
|
|
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.fromMID;
|
|
224
|
+
cico.Ver_CanViewOrUpdate = (mdVer.perm?.canView == AccessLevels.Yes || mdVer.perm?.canUpdate == AccessLevels.Yes) ? AccessLevels.Yes : AccessLevels.No;
|
|
225
|
+
}
|
|
226
|
+
return cico;
|
|
227
|
+
};
|
|
228
|
+
export const getDcmtCicoStatus = (dcmt, allUsers, dtd) => {
|
|
229
|
+
if (dcmt === undefined || dtd === undefined) {
|
|
230
|
+
return {
|
|
231
|
+
cicoEnabled: false,
|
|
232
|
+
checkoutStatus: { isCheckedOut: false, mode: '', version: 1, icon: null }
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
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
|
+
const userID = SDK_Globals.tmSession?.SessionDescr?.userID;
|
|
244
|
+
if (dcmt && CICO_CheckoutUserID_Meta?.id) {
|
|
245
|
+
const keyUserID = dcmt.TID + "_" + CICO_CheckoutUserID_Meta.id;
|
|
246
|
+
const checkoutUserIdValue = dcmt[keyUserID];
|
|
247
|
+
const checkoutUserId = Number(checkoutUserIdValue);
|
|
248
|
+
if (userID && checkoutUserIdValue && !isNaN(checkoutUserId) && checkoutUserId > 0) {
|
|
249
|
+
// editMode: l'utente corrente è quello che ha fatto il checkout
|
|
250
|
+
// lockMode: un altro utente ha fatto il checkout
|
|
251
|
+
const mode = (userID && userID === checkoutUserId) ? 'editMode' : 'lockMode';
|
|
252
|
+
// Recupera i dati aggiuntivi per il tooltip
|
|
253
|
+
const keyDate = dcmt.TID + "_" + (CICO_CheckoutDate_Meta?.id ?? 0);
|
|
254
|
+
const checkoutDate = CICO_CheckoutDate_Meta?.id ? dcmt[keyDate] : undefined;
|
|
255
|
+
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] }) })] })] });
|
|
256
|
+
const icon = mode === 'editMode'
|
|
257
|
+
? _jsx(TMTooltip, { content: editLockTooltipText, children: _jsx("i", { style: { fontSize: "18px", color: colors.MEDIUM_GREEN, fontWeight: "bold" }, className: "dx-icon-edit" }) })
|
|
258
|
+
: _jsx(TMTooltip, { content: editLockTooltipText, children: _jsx("i", { style: { fontSize: "18px", color: colors.MEDIUM_GREEN, fontWeight: "bold" }, className: "dx-icon-lock" }) });
|
|
259
|
+
checkoutStatus = { isCheckedOut: true, mode: mode, icon: icon, version: version };
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
return {
|
|
263
|
+
cicoEnabled: cicoInfo.CICO === 1 && cicoInfo.CanCICO === AccessLevels.Yes,
|
|
264
|
+
checkoutStatus: checkoutStatus
|
|
265
|
+
};
|
|
266
|
+
};
|
package/lib/helper/helpers.js
CHANGED
|
@@ -38,7 +38,12 @@ const openApps = async (appModule, tmSession, appRoutes) => {
|
|
|
38
38
|
};
|
|
39
39
|
export const setSDK_GlobalsInfoAsync = async (tms) => {
|
|
40
40
|
try {
|
|
41
|
-
|
|
41
|
+
const result = await SetGlobalsInfoAsync(tms);
|
|
42
|
+
if (result?.SessionDescr?.userID && result?.SessionDescr?.archiveID) {
|
|
43
|
+
const { UserSettings } = await import('./SDKUI_Globals');
|
|
44
|
+
UserSettings.LoadSettings(result.SessionDescr.userID, result.SessionDescr.archiveID);
|
|
45
|
+
}
|
|
46
|
+
return result;
|
|
42
47
|
}
|
|
43
48
|
catch (e) {
|
|
44
49
|
TMExceptionBoxManager.show({ exception: e.message });
|
package/lib/helper/index.d.ts
CHANGED
package/lib/helper/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AccessLevels, MetadataDataDomains, DcmtTypeListCacheService, SystemMIDsAsNumber, MetadataDataTypes, QueryDescriptor, QueryFunctions, SelectItem, SelectItemVisibilities, FromItem, LayoutModes, QueryOperators, SavedQueryDescriptor, SearchEngine, WhereItem, OrderByItem, SDK_Globals, AppModules, SystemTIDs, WorkItemMetadataNames, PlatformObjectValidator } from '@topconsultnpm/sdk-ts';
|
|
2
2
|
import { DateDisplayTypes, Globalization } from './Globalization';
|
|
3
|
-
import { DraftsMIDs, MetadataValueDescriptorEx } from '../ts';
|
|
3
|
+
import { ChronologyMIDs, DraftsMIDs, MetadataValueDescriptorEx } from '../ts';
|
|
4
4
|
import { SDKUI_Localizator } from './SDKUI_Localizator';
|
|
5
5
|
export const getTIDsByQd = (qd) => {
|
|
6
6
|
let tids = [];
|
|
@@ -301,6 +301,18 @@ export const searchResultToMetadataValues = (tid, dtd, rows, mids, metadata, lay
|
|
|
301
301
|
break;
|
|
302
302
|
}
|
|
303
303
|
}
|
|
304
|
+
if (tid === SystemTIDs.Chronology) {
|
|
305
|
+
switch (mvd.mid) {
|
|
306
|
+
case ChronologyMIDs.Ver:
|
|
307
|
+
mvd.customName = SDKUI_Localizator.Version;
|
|
308
|
+
mvd.isReadOnly = true;
|
|
309
|
+
break;
|
|
310
|
+
case ChronologyMIDs.AuthorID:
|
|
311
|
+
mvd.customName = SDKUI_Localizator.Author;
|
|
312
|
+
mvd.isReadOnly = true;
|
|
313
|
+
break;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
304
316
|
return mvd;
|
|
305
317
|
};
|
|
306
318
|
metadata.forEach(md => {
|
|
@@ -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,54 +1,54 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
2
|
+
"name": "@topconsultnpm/sdkui-react",
|
|
3
|
+
"version": "6.20.0-dev1.10",
|
|
4
|
+
"description": "",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
7
|
+
"clean": "powershell Remove-Item lib/ -recurse",
|
|
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 && tsc && npm run copy-files",
|
|
10
|
+
"tm-watch": "tsc -w",
|
|
11
|
+
"tm-publish": "npm publish --tag latest",
|
|
12
|
+
"storybook": "storybook dev -p 6006",
|
|
13
|
+
"build-storybook": "storybook build"
|
|
14
|
+
},
|
|
15
|
+
"author": "TopConsult",
|
|
16
|
+
"license": "ISC",
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@chromatic-com/storybook": "^4.1.3",
|
|
19
|
+
"@storybook/addon-docs": "^10.1.0",
|
|
20
|
+
"@storybook/addon-onboarding": "^10.1.0",
|
|
21
|
+
"@storybook/react-vite": "^10.1.0",
|
|
22
|
+
"@types/htmlparser2": "^3.10.7",
|
|
23
|
+
"@types/node": "^20.2.5",
|
|
24
|
+
"@types/react": "^18.3.3",
|
|
25
|
+
"@types/react-dom": "^18.3.3",
|
|
26
|
+
"copyfiles": "^2.4.1",
|
|
27
|
+
"esbuild": "^0.25.0",
|
|
28
|
+
"react": "^18.3.1",
|
|
29
|
+
"react-dom": "^18.3.1",
|
|
30
|
+
"storybook": "^10.1.0",
|
|
31
|
+
"typescript": "^5.9.3",
|
|
32
|
+
"vite": "^6.1.1"
|
|
33
|
+
},
|
|
34
|
+
"main": "dist/cjs/index.js",
|
|
35
|
+
"types": "./index.d.ts",
|
|
36
|
+
"module": "lib/esm/index.js",
|
|
37
|
+
"files": [
|
|
38
|
+
"dist",
|
|
39
|
+
"lib"
|
|
40
|
+
],
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@topconsultnpm/sdk-ts": "6.20.0-dev1.1",
|
|
43
|
+
"buffer": "^6.0.3",
|
|
44
|
+
"devextreme": "25.1.7",
|
|
45
|
+
"devextreme-react": "25.1.7",
|
|
46
|
+
"exceljs": "^4.4.0",
|
|
47
|
+
"htmlparser2": "^10.0.0",
|
|
48
|
+
"react-router-dom": "^6.15.0",
|
|
49
|
+
"styled-components": "^6.1.1"
|
|
50
|
+
},
|
|
51
|
+
"overrides": {
|
|
52
|
+
"esbuild": "^0.25.0"
|
|
53
|
+
}
|
|
54
54
|
}
|
|
@@ -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>;
|