@topconsultnpm/sdkui-react 6.20.0-test1 → 6.21.0-dev1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/NewComponents/ContextMenu/styles.d.ts +3 -1
- package/lib/components/NewComponents/ContextMenu/styles.js +7 -5
- package/lib/components/NewComponents/FloatingMenuBar/TMFloatingMenuBar.js +7 -1
- package/lib/components/base/Styled.d.ts +4 -1
- package/lib/components/base/Styled.js +11 -3
- package/lib/components/base/TMPanel.js +6 -4
- package/lib/components/base/TMPopUp.js +4 -0
- package/lib/components/base/TMTreeView.d.ts +3 -1
- package/lib/components/base/TMTreeView.js +68 -21
- package/lib/components/base/TMWaitPanel.js +6 -5
- package/lib/components/choosers/TMDataListItemChooser.js +1 -1
- package/lib/components/choosers/TMDataListItemEditor.d.ts +11 -0
- package/lib/components/choosers/TMDataListItemEditor.js +130 -0
- package/lib/components/choosers/TMDataListItemFields.d.ts +11 -0
- package/lib/components/choosers/TMDataListItemFields.js +61 -0
- package/lib/components/choosers/TMDataListItemPicker.d.ts +2 -0
- package/lib/components/choosers/TMDataListItemPicker.js +182 -18
- package/lib/components/choosers/TMDynDataListItemChooser.js +11 -6
- package/lib/components/choosers/TMImageIDChooser.d.ts +16 -0
- package/lib/components/choosers/TMImageIDChooser.js +53 -0
- package/lib/components/choosers/TMMetadataChooser.js +1 -1
- package/lib/components/choosers/TMUserChooser.js +1 -1
- package/lib/components/editors/TMDateBox.js +1 -1
- package/lib/components/editors/TMHtmlEditor.js +1 -1
- package/lib/components/editors/TMLocalizedTextBox.d.ts +1 -0
- package/lib/components/editors/TMLocalizedTextBox.js +3 -3
- package/lib/components/editors/TMMetadataValues.js +203 -41
- package/lib/components/editors/TMTextArea.d.ts +1 -0
- package/lib/components/editors/TMTextArea.js +6 -6
- package/lib/components/editors/TMTextBox.js +9 -10
- package/lib/components/features/archive/TMArchive.d.ts +3 -1
- package/lib/components/features/archive/TMArchive.js +31 -44
- package/lib/components/features/blog/TMBlogCommentForm.d.ts +3 -0
- package/lib/components/features/blog/TMBlogCommentForm.js +42 -36
- package/lib/components/features/documents/TMDcmtBlog.d.ts +1 -0
- package/lib/components/features/documents/TMDcmtBlog.js +2 -1
- package/lib/components/features/documents/TMDcmtForm.d.ts +44 -34
- package/lib/components/features/documents/TMDcmtForm.js +365 -563
- package/lib/components/features/documents/TMDcmtFormActionButtons.d.ts +34 -0
- package/lib/components/features/documents/TMDcmtFormActionButtons.js +124 -0
- package/lib/components/features/documents/TMDcmtPreview.js +66 -13
- package/lib/components/features/documents/TMDcmtTasks.d.ts +3 -1
- package/lib/components/features/documents/TMDcmtTasks.js +2 -2
- package/lib/components/features/documents/TMFileUploader.d.ts +5 -0
- package/lib/components/features/documents/TMFileUploader.js +28 -6
- package/lib/components/features/documents/TMMasterDetailDcmts.js +31 -85
- package/lib/components/features/documents/TMRelationViewer.d.ts +7 -1
- package/lib/components/features/documents/TMRelationViewer.js +497 -111
- package/lib/components/features/search/TMSearch.d.ts +2 -2
- package/lib/components/features/search/TMSearch.js +3 -3
- package/lib/components/features/search/TMSearchQueryPanel.js +6 -6
- package/lib/components/features/search/TMSearchResult.d.ts +28 -25
- package/lib/components/features/search/TMSearchResult.js +445 -562
- package/lib/components/features/search/TMSignatureInfoContent.js +10 -6
- package/lib/components/features/search/TMTreeSelector.js +1 -1
- package/lib/components/features/tasks/TMTaskForm.d.ts +3 -1
- package/lib/components/features/tasks/TMTaskForm.js +61 -193
- package/lib/components/features/tasks/TMTaskFormUtils.d.ts +80 -0
- package/lib/components/features/tasks/TMTaskFormUtils.js +559 -0
- package/lib/components/features/tasks/TMTasksUtils.d.ts +3 -1
- package/lib/components/features/tasks/TMTasksUtils.js +46 -16
- package/lib/components/features/tasks/TMTasksUtilsView.d.ts +0 -7
- package/lib/components/features/tasks/TMTasksUtilsView.js +7 -14
- package/lib/components/features/tasks/TMTasksView.js +5 -3
- package/lib/components/features/workflow/TMWorkflowPopup.d.ts +20 -3
- package/lib/components/features/workflow/TMWorkflowPopup.js +21 -109
- package/lib/components/features/workflow/diagram/ConnectionComponent.d.ts +1 -0
- package/lib/components/features/workflow/diagram/ConnectionComponent.js +6 -2
- package/lib/components/features/workflow/diagram/DiagramItemForm.d.ts +2 -0
- package/lib/components/features/workflow/diagram/DiagramItemForm.js +32 -25
- package/lib/components/features/workflow/diagram/RecipientList.d.ts +3 -1
- package/lib/components/features/workflow/diagram/RecipientList.js +13 -9
- package/lib/components/features/workflow/diagram/WFDiagram.js +102 -5
- package/lib/components/features/workflow/diagram/workflowHelpers.js +31 -19
- package/lib/components/forms/Login/TMLoginForm.js +1 -1
- package/lib/components/forms/TMSaveForm.js +61 -13
- package/lib/components/grids/TMBlogsPost.js +8 -8
- package/lib/components/grids/TMBlogsPostUtils.js +2 -2
- package/lib/components/grids/TMRecentsManager.js +1 -1
- package/lib/components/index.d.ts +2 -0
- package/lib/components/index.js +2 -0
- package/lib/components/layout/panelManager/TMPanelManagerContainer.js +3 -2
- package/lib/components/pages/TMPage.js +4 -0
- package/lib/components/query/TMQueryEditor.d.ts +1 -0
- package/lib/components/query/TMQueryEditor.js +3 -3
- package/lib/components/viewers/TMMidViewer.js +2 -1
- package/lib/components/viewers/TMTidViewer.js +7 -3
- package/lib/helper/Enum_Localizator.js +5 -0
- package/lib/helper/GlobalStyles.js +3 -0
- package/lib/helper/SDKUI_Globals.d.ts +12 -0
- package/lib/helper/SDKUI_Globals.js +21 -1
- package/lib/helper/SDKUI_Localizator.d.ts +31 -7
- package/lib/helper/SDKUI_Localizator.js +286 -46
- package/lib/helper/TMIcons.d.ts +2 -1
- package/lib/helper/TMIcons.js +4 -1
- package/lib/helper/TMUtils.d.ts +33 -41
- package/lib/helper/TMUtils.js +157 -170
- package/lib/helper/checkinCheckoutManager.js +6 -2
- package/lib/helper/helpers.d.ts +6 -2
- package/lib/helper/helpers.js +24 -8
- package/lib/helper/index.d.ts +1 -0
- package/lib/helper/index.js +1 -0
- package/lib/helper/queryHelper.js +1 -1
- package/lib/hooks/useBetaFeatures.d.ts +1 -0
- package/lib/hooks/useBetaFeatures.js +41 -0
- package/lib/hooks/useCheckInOutOperations.d.ts +7 -6
- package/lib/hooks/useCheckInOutOperations.js +9 -16
- package/lib/hooks/useDataUserIdItem.js +2 -2
- package/lib/hooks/useDcmtOperations.d.ts +3 -2
- package/lib/hooks/useDcmtOperations.js +16 -4
- package/lib/hooks/useDocumentOperations.d.ts +139 -0
- package/lib/hooks/useDocumentOperations.js +1275 -0
- package/lib/hooks/useRelatedDocuments.d.ts +1 -1
- package/lib/hooks/useRelatedDocuments.js +64 -42
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/services/platform_services.d.ts +1 -1
- package/lib/services/platform_services.js +4 -0
- package/lib/ts/types.d.ts +5 -1
- package/lib/ts/types.js +1 -0
- package/package.json +55 -55
- package/lib/components/features/search/TMSearchResultsMenuItems.d.ts +0 -11
- package/lib/components/features/search/TMSearchResultsMenuItems.js +0 -770
- package/lib/components/features/search/TMSignSettingsForm.d.ts +0 -9
- package/lib/components/features/search/TMSignSettingsForm.js +0 -621
package/lib/helper/TMUtils.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import styled from "styled-components";
|
|
3
3
|
import { TMTooltip } from '../components';
|
|
4
4
|
import { IconCADossier, IconKey, IconMenuCAWorkingGroups } from './TMIcons';
|
|
5
|
-
import { DataListCacheService, MetadataDataDomains, PdGs } from '@topconsultnpm/sdk-ts';
|
|
5
|
+
import { AppModules, DataListCacheService, LicenseModuleStatus, MetadataDataDomains, PdGs, SDK_Globals } from '@topconsultnpm/sdk-ts';
|
|
6
6
|
import { SDKUI_Localizator } from './SDKUI_Localizator';
|
|
7
7
|
const StyledIconFileContainer = styled.div `
|
|
8
8
|
height: 22px;
|
|
@@ -178,6 +178,15 @@ export const isCreateCertificateEnabled = (widgetsString) => {
|
|
|
178
178
|
export const isPdfEditorEnabled = (widgetsString) => {
|
|
179
179
|
return isWidgetEnabled(PDF_EDITOR_ID, widgetsString);
|
|
180
180
|
};
|
|
181
|
+
/** Verifica se l'editor PDF è disponibile: richiede file PDF, licenza attiva e widget abilitato sul tipo documento. */
|
|
182
|
+
export const isPdfEditorAvailable = (fromDTD, ext) => {
|
|
183
|
+
if (fromDTD === undefined || !fromDTD.widgets || !ext)
|
|
184
|
+
return false;
|
|
185
|
+
if (ext.toLowerCase() !== "pdf")
|
|
186
|
+
return false;
|
|
187
|
+
const isPdfEditorLicensed = SDK_Globals?.license?.dcmtArchiveLicenses?.[0]?.siX_60007?.status === LicenseModuleStatus.Licensed;
|
|
188
|
+
return isPdfEditorLicensed && isPdfEditorEnabled(fromDTD.widgets);
|
|
189
|
+
};
|
|
181
190
|
export const StyledTabItem = styled.div `
|
|
182
191
|
display: flex;
|
|
183
192
|
align-items: center;
|
|
@@ -185,8 +194,9 @@ export const StyledTabItem = styled.div `
|
|
|
185
194
|
border-radius: 8px;
|
|
186
195
|
font-weight: ${({ $isSelected }) => ($isSelected ? 'bold' : 'normal')};
|
|
187
196
|
color: ${({ $isSelected }) => ($isSelected ? '#fff' : '#000')};
|
|
188
|
-
background: ${({ $isSelected }) => $isSelected
|
|
189
|
-
?
|
|
197
|
+
background: ${({ $isSelected, $activeGradient }) => $isSelected
|
|
198
|
+
? ($activeGradient ??
|
|
199
|
+
'linear-gradient(270deg, #46B5A2 16%, #3BAABC 34%, #3BAABC 34%, #3681AD 54%, #3368A5 72%, #2F549D 88%, #304F99 100%)')
|
|
190
200
|
: 'transparent'};
|
|
191
201
|
transition: background-color 0.2s ease;
|
|
192
202
|
font-size: 1rem;
|
|
@@ -201,186 +211,93 @@ export const StyledTabIcon = styled.i `
|
|
|
201
211
|
transition: color 0.2s ease;
|
|
202
212
|
`;
|
|
203
213
|
export const TMCountBadge = styled.div ` background-color: #ff5252; color: white; border-radius: 999px; margin-left: 8px; font-size: 0.7rem; line-height: 1; min-height: 20px; min-width: 20px; display: flex ; align-items: center; justify-content: center; `;
|
|
214
|
+
export const PDGS_COLORS = {
|
|
215
|
+
DOSSIER: '#e65b00',
|
|
216
|
+
DOCUMENT: '#b38600',
|
|
217
|
+
WORKING_GROUP: '#009700',
|
|
218
|
+
};
|
|
204
219
|
export const getPdgsIconMap = (fontSize = 20) => {
|
|
205
220
|
return new Map([
|
|
206
221
|
[PdGs.None, _jsx("span", {}, "PdGs-None")],
|
|
207
|
-
[PdGs.CF, _jsx(IconCADossier, { color:
|
|
208
|
-
[PdGs.DT, _jsx("i", { style: { fontSize, color:
|
|
222
|
+
[PdGs.CF, _jsx(IconCADossier, { color: PDGS_COLORS.DOSSIER, fontSize: 28 }, "PdGs-CF")],
|
|
223
|
+
[PdGs.DT, _jsx("i", { style: { fontSize, color: PDGS_COLORS.DOCUMENT }, className: "dx-icon-file" }, "PdGs-DT")],
|
|
209
224
|
[PdGs.WF, _jsx("i", { style: { fontSize }, className: "dx-icon-box" }, "PdGs-WF")],
|
|
210
|
-
[PdGs.WG, _jsx(IconMenuCAWorkingGroups, { color:
|
|
225
|
+
[PdGs.WG, _jsx(IconMenuCAWorkingGroups, { color: PDGS_COLORS.WORKING_GROUP, fontSize: 28 }, "PdGs-WG")],
|
|
211
226
|
]);
|
|
212
227
|
};
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
*
|
|
230
|
-
* // 2. "All" - Tutti i campi attivi con valori di default
|
|
231
|
-
* parseSignatureConfiguration(1, "All", "Mario", "Rossi", "Doc1")
|
|
232
|
-
*
|
|
233
|
-
* // 3. "None" - Nessun campo attivo
|
|
234
|
-
* parseSignatureConfiguration(1, "None", "Mario", "Rossi", "Doc1")
|
|
235
|
-
*
|
|
236
|
-
* // 4. Formato con valori espliciti: Key=Value
|
|
237
|
-
* parseSignatureConfiguration(1, "Date=Yes,SignerBy=Mario,Location=Milano,Copyright=TopConsult", ...)
|
|
238
|
-
*
|
|
239
|
-
* // 5. Formato chiavi semplici (attiva i default): key1,key2,key3
|
|
240
|
-
* parseSignatureConfiguration(1, "date,signerby,location", "Mario", "Rossi", "Doc1")
|
|
241
|
-
*
|
|
242
|
-
* // 6. Formato misto
|
|
243
|
-
* parseSignatureConfiguration(1, "date,SignerBy=Yes,Location=Roma", "Mario", "Rossi", "Doc1")
|
|
244
|
-
*/
|
|
245
|
-
export const parseSignatureConfiguration = (did, informationSign, firstName, lastName, title) => {
|
|
246
|
-
try {
|
|
247
|
-
// Rimuove spazi dalla stringa di input mantenendo il case originale
|
|
248
|
-
const signatureSign = informationSign?.trim();
|
|
249
|
-
// Definisce i valori di default per ciascun campo
|
|
250
|
-
const defaultLocationValue = SDKUI_Localizator.Torino;
|
|
251
|
-
const defaultCopyrightValue = "Sign4Top";
|
|
252
|
-
const defaultSignerByValue = `${firstName ?? ''} ${lastName ?? ''}`.trim() || '';
|
|
253
|
-
// Configurazione di default: solo data attiva
|
|
254
|
-
const defaultInfo = {
|
|
255
|
-
allowDate: true,
|
|
256
|
-
allowSignerBy: false,
|
|
257
|
-
signerByValue: defaultSignerByValue,
|
|
258
|
-
allowLocation: false,
|
|
259
|
-
locationValue: defaultLocationValue,
|
|
260
|
-
allowCopyright: false,
|
|
261
|
-
copyrightValue: defaultCopyrightValue
|
|
262
|
-
};
|
|
263
|
-
// Se la stringa è vuota o non definita, ritorna la configurazione di default
|
|
264
|
-
if (!signatureSign || signatureSign.length === 0) {
|
|
265
|
-
return defaultInfo;
|
|
266
|
-
}
|
|
267
|
-
// Caso speciale: "all" attiva tutti i campi con valori di default
|
|
268
|
-
if (signatureSign.toLowerCase() === "all") {
|
|
269
|
-
return {
|
|
270
|
-
allowDate: true,
|
|
271
|
-
allowSignerBy: true,
|
|
272
|
-
signerByValue: defaultSignerByValue,
|
|
273
|
-
allowLocation: true,
|
|
274
|
-
locationValue: defaultLocationValue,
|
|
275
|
-
allowCopyright: true,
|
|
276
|
-
copyrightValue: defaultCopyrightValue
|
|
277
|
-
};
|
|
228
|
+
export const parseSignatureConfiguration = (did, informationSign, title) => {
|
|
229
|
+
const signatureSign = informationSign?.trim() || "";
|
|
230
|
+
if (!signatureSign)
|
|
231
|
+
return {};
|
|
232
|
+
const infoParts = signatureSign.split(',').map(part => part.trim()).filter(Boolean);
|
|
233
|
+
const allowedKeys = ["copyright", "date", "location"];
|
|
234
|
+
const allowedDateValues = ["no", "yes", "true", "false", ""];
|
|
235
|
+
const invalidKeys = [];
|
|
236
|
+
const invalidDateValues = [];
|
|
237
|
+
for (const part of infoParts) {
|
|
238
|
+
const [key, ...valueParts] = part.split("=");
|
|
239
|
+
const currentKey = key.trim().toLowerCase();
|
|
240
|
+
const rawValue = valueParts.join("=").trim();
|
|
241
|
+
const currentValue = rawValue.replace(/^["']|["']$/g, "").toLowerCase();
|
|
242
|
+
if (!allowedKeys.includes(currentKey)) {
|
|
243
|
+
invalidKeys.push(key.trim());
|
|
278
244
|
}
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
return {
|
|
282
|
-
allowDate: false,
|
|
283
|
-
allowSignerBy: false,
|
|
284
|
-
signerByValue: defaultSignerByValue,
|
|
285
|
-
allowLocation: false,
|
|
286
|
-
locationValue: defaultLocationValue,
|
|
287
|
-
allowCopyright: false,
|
|
288
|
-
copyrightValue: defaultCopyrightValue
|
|
289
|
-
};
|
|
245
|
+
else if (currentKey === "date" && !allowedDateValues.includes(currentValue)) {
|
|
246
|
+
invalidDateValues.push(rawValue);
|
|
290
247
|
}
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
248
|
+
}
|
|
249
|
+
if (invalidKeys.length > 0) {
|
|
250
|
+
throw new Error(`${invalidKeys.length > 1 ? 'I parametri' : 'Il parametro'} "${invalidKeys.join('", "')}" non ${invalidKeys.length > 1 ? 'sono riconosciuti' : 'è riconosciuto'} nel campo "informationSign" per il documento "${title || did}". ` +
|
|
251
|
+
`I parametri ammessi sono: ${allowedKeys.join(", ")}. ` +
|
|
252
|
+
`Il valore attuale del campo è "${informationSign}"`);
|
|
253
|
+
}
|
|
254
|
+
if (invalidDateValues.length > 0) {
|
|
255
|
+
throw new Error(`${invalidDateValues.length > 1 ? 'I valori' : 'Il valore'} "${invalidDateValues.join('", "')}" non ${invalidDateValues.length > 1 ? 'sono validi' : 'è valido'} per il parametro "date" nel campo "informationSign" per il documento "${title || did}". ` +
|
|
256
|
+
`I valori ammessi per "date" sono: ${allowedDateValues.filter(v => v).join(", ")}. ` +
|
|
257
|
+
`Il valore attuale del campo è "${informationSign}"`);
|
|
258
|
+
}
|
|
259
|
+
// DEFAULT
|
|
260
|
+
let result = {
|
|
261
|
+
copyright: "",
|
|
262
|
+
date: false,
|
|
263
|
+
location: ""
|
|
264
|
+
};
|
|
265
|
+
const parseBooleanOrValue = (value) => {
|
|
266
|
+
const valueLower = value.toLowerCase();
|
|
267
|
+
if (valueLower === "no" || valueLower === "false")
|
|
268
|
+
return { enabled: false };
|
|
269
|
+
if (valueLower === "yes" || valueLower === "true" || !value)
|
|
270
|
+
return { enabled: true };
|
|
271
|
+
return { enabled: true, customValue: value };
|
|
272
|
+
};
|
|
273
|
+
for (const part of infoParts) {
|
|
274
|
+
const [key, ...valueParts] = part.split("=");
|
|
275
|
+
const currentKey = key.trim().toLowerCase();
|
|
276
|
+
const rawValue = valueParts.join("=").trim();
|
|
277
|
+
const currentValue = rawValue.replace(/^["']|["']$/g, "");
|
|
278
|
+
switch (currentKey) {
|
|
279
|
+
case "date": {
|
|
280
|
+
const parsed = parseBooleanOrValue(currentValue);
|
|
281
|
+
result.date = parsed.enabled;
|
|
282
|
+
break;
|
|
302
283
|
}
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
}
|
|
310
|
-
// Clone della configurazione di default per la modifica
|
|
311
|
-
const info = { ...defaultInfo };
|
|
312
|
-
// Itera su ogni parte della configurazione
|
|
313
|
-
for (const part of infoParts) {
|
|
314
|
-
const [key, ...valueParts] = part.split("=");
|
|
315
|
-
const currentKey = key.trim().toLowerCase();
|
|
316
|
-
// Ricostruisce il valore nel caso contenga "=" al suo interno
|
|
317
|
-
const rawValue = valueParts.join("=").trim();
|
|
318
|
-
// Rimuove le virgolette dall'inizio e dalla fine del valore
|
|
319
|
-
const currentValue = rawValue.replace(/^["']|["']$/g, "");
|
|
320
|
-
// Helper per gestire i valori booleani e custom
|
|
321
|
-
const parseBooleanOrValue = (value) => {
|
|
322
|
-
const valueLower = value.toLowerCase();
|
|
323
|
-
if (valueLower === "no" || valueLower === "false")
|
|
324
|
-
return { enabled: false };
|
|
325
|
-
if (valueLower === "yes" || valueLower === "true" || !value)
|
|
326
|
-
return { enabled: true };
|
|
327
|
-
return { enabled: true, customValue: value };
|
|
328
|
-
};
|
|
329
|
-
// Processa ciascuna chiave in base al tipo
|
|
330
|
-
if (part.includes("=")) {
|
|
331
|
-
// Formato: Key=Value
|
|
332
|
-
switch (currentKey) {
|
|
333
|
-
case "date":
|
|
334
|
-
// Data supporta solo Yes/No/True/False
|
|
335
|
-
const dateLower = currentValue.toLowerCase();
|
|
336
|
-
info.allowDate = dateLower === "yes" || dateLower === "true";
|
|
337
|
-
break;
|
|
338
|
-
case "signerby": {
|
|
339
|
-
const parsed = parseBooleanOrValue(currentValue);
|
|
340
|
-
info.allowSignerBy = parsed.enabled;
|
|
341
|
-
info.signerByValue = parsed.customValue || defaultSignerByValue;
|
|
342
|
-
break;
|
|
343
|
-
}
|
|
344
|
-
case "location": {
|
|
345
|
-
const parsed = parseBooleanOrValue(currentValue);
|
|
346
|
-
info.allowLocation = parsed.enabled;
|
|
347
|
-
info.locationValue = parsed.customValue || defaultLocationValue;
|
|
348
|
-
break;
|
|
349
|
-
}
|
|
350
|
-
case "copyright": {
|
|
351
|
-
const parsed = parseBooleanOrValue(currentValue);
|
|
352
|
-
info.allowCopyright = parsed.enabled;
|
|
353
|
-
info.copyrightValue = parsed.customValue || defaultCopyrightValue;
|
|
354
|
-
break;
|
|
355
|
-
}
|
|
356
|
-
}
|
|
284
|
+
case "location": {
|
|
285
|
+
const parsed = parseBooleanOrValue(currentValue);
|
|
286
|
+
result.location = parsed.enabled
|
|
287
|
+
? parsed.customValue || ""
|
|
288
|
+
: "";
|
|
289
|
+
break;
|
|
357
290
|
}
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
case "signerby":
|
|
365
|
-
info.allowSignerBy = true;
|
|
366
|
-
info.signerByValue = defaultSignerByValue;
|
|
367
|
-
break;
|
|
368
|
-
case "location":
|
|
369
|
-
info.allowLocation = true;
|
|
370
|
-
info.locationValue = defaultLocationValue;
|
|
371
|
-
break;
|
|
372
|
-
case "copyright":
|
|
373
|
-
info.allowCopyright = true;
|
|
374
|
-
info.copyrightValue = defaultCopyrightValue;
|
|
375
|
-
break;
|
|
376
|
-
}
|
|
291
|
+
case "copyright": {
|
|
292
|
+
const parsed = parseBooleanOrValue(currentValue);
|
|
293
|
+
result.copyright = parsed.enabled
|
|
294
|
+
? parsed.customValue || ""
|
|
295
|
+
: "";
|
|
296
|
+
break;
|
|
377
297
|
}
|
|
378
298
|
}
|
|
379
|
-
return info;
|
|
380
|
-
}
|
|
381
|
-
catch (error) {
|
|
382
|
-
throw error;
|
|
383
299
|
}
|
|
300
|
+
return result;
|
|
384
301
|
};
|
|
385
302
|
export const convertSearchResultDescriptorToFileItems = (documents) => {
|
|
386
303
|
const fileItems = [];
|
|
@@ -433,3 +350,73 @@ export const convertSearchResultDescriptorToFileItems = (documents) => {
|
|
|
433
350
|
});
|
|
434
351
|
return fileItems;
|
|
435
352
|
};
|
|
353
|
+
export const getAppModuleGradient = (appModuleID) => {
|
|
354
|
+
switch (appModuleID) {
|
|
355
|
+
case AppModules.SURFER:
|
|
356
|
+
return 'linear-gradient(270deg, #46B5A2 16%, #3BAABC 34%, #3BAABC 34%, #3681AD 54%, #3368A5 72%, #2F549D 88%, #304F99 100%)';
|
|
357
|
+
case AppModules.DESIGNER:
|
|
358
|
+
return 'linear-gradient(270deg, #A06A8E 16%, #885C77 34%, #6F4C5F 54%, #5A3446 72%, #482234 100%);';
|
|
359
|
+
case AppModules.ORCHESTRATOR:
|
|
360
|
+
return 'linear-gradient(270deg, #46B5A2 16%, #3BAA8A 34%, #2F8F6F 54%, #277A5A 72%, #216948 88%, #1d6f42 100%)';
|
|
361
|
+
default:
|
|
362
|
+
return 'linear-gradient(270deg, #46B5A2 16%, #3BAABC 34%, #3BAABC 34%, #3681AD 54%, #3368A5 72%, #2F549D 88%, #304F99 100%)';
|
|
363
|
+
}
|
|
364
|
+
};
|
|
365
|
+
export const getPanelManagerToolbarColor = (appModuleID) => {
|
|
366
|
+
switch (appModuleID) {
|
|
367
|
+
case AppModules.SURFER:
|
|
368
|
+
return 'transparent linear-gradient(90deg, #CCE0F4 0%, #7EC1E7 14%, #39A6DB 28%, #1E9CD7 35%, #0075BE 78%, #005B97 99%) 0% 0% no-repeat padding-box';
|
|
369
|
+
case AppModules.DESIGNER:
|
|
370
|
+
return '#482234';
|
|
371
|
+
case AppModules.ORCHESTRATOR:
|
|
372
|
+
return '#1d6f42';
|
|
373
|
+
default:
|
|
374
|
+
return 'transparent linear-gradient(90deg, #CCE0F4 0%, #7EC1E7 14%, #39A6DB 28%, #1E9CD7 35%, #0075BE 78%, #005B97 99%) 0% 0% no-repeat padding-box';
|
|
375
|
+
}
|
|
376
|
+
};
|
|
377
|
+
export const getSearchToolbarVisibility = (appModuleID) => {
|
|
378
|
+
switch (appModuleID) {
|
|
379
|
+
case AppModules.SURFER:
|
|
380
|
+
return {
|
|
381
|
+
tmSearchResult: true,
|
|
382
|
+
tmBlog: true,
|
|
383
|
+
tmSysMetadata: true,
|
|
384
|
+
tmDcmtPreview: true,
|
|
385
|
+
tmFullTextSearch: true,
|
|
386
|
+
};
|
|
387
|
+
case AppModules.DESIGNER:
|
|
388
|
+
case AppModules.ORCHESTRATOR:
|
|
389
|
+
default:
|
|
390
|
+
return {
|
|
391
|
+
tmSearchResult: true,
|
|
392
|
+
tmBlog: false,
|
|
393
|
+
tmSysMetadata: false,
|
|
394
|
+
tmDcmtPreview: false,
|
|
395
|
+
tmFullTextSearch: false,
|
|
396
|
+
};
|
|
397
|
+
}
|
|
398
|
+
};
|
|
399
|
+
export const getDcmtFormToolbarVisibility = (appModuleID) => {
|
|
400
|
+
switch (appModuleID) {
|
|
401
|
+
case AppModules.SURFER:
|
|
402
|
+
return {
|
|
403
|
+
tmDcmtForm: true,
|
|
404
|
+
tmBlog: true,
|
|
405
|
+
tmSysMetadata: true,
|
|
406
|
+
tmDcmtPreview: true,
|
|
407
|
+
tmWF: true,
|
|
408
|
+
tmDcmtTasks: true,
|
|
409
|
+
};
|
|
410
|
+
case AppModules.DESIGNER:
|
|
411
|
+
case AppModules.ORCHESTRATOR:
|
|
412
|
+
default:
|
|
413
|
+
return {
|
|
414
|
+
tmDcmtForm: true,
|
|
415
|
+
tmBlog: false,
|
|
416
|
+
tmSysMetadata: true,
|
|
417
|
+
tmDcmtPreview: true,
|
|
418
|
+
tmWF: false,
|
|
419
|
+
tmDcmtTasks: false,
|
|
420
|
+
};
|
|
421
|
+
}
|
|
422
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { AccessLevels, CICO_MetadataNames, SDK_Globals, SystemMIDsAsNumber } from "@topconsultnpm/sdk-ts";
|
|
3
3
|
import TMTooltip from "../components/base/TMTooltip";
|
|
4
|
-
import { Globalization, SDKUI_Globals, SDKUI_Localizator } from "./index";
|
|
4
|
+
import { dcmtsFileCachePreview, Globalization, removeDcmtsFileCache, SDKUI_Globals, SDKUI_Localizator } from "./index";
|
|
5
5
|
import { DownloadTypes } from "../ts/types";
|
|
6
6
|
const findCheckOutUserName = (users, checkoutUserId) => {
|
|
7
7
|
let checkOutUser = users.find(user => user.id === checkoutUserId);
|
|
@@ -67,11 +67,15 @@ export const cicoDownloadFilesCallback = async (sources, checkout, downloadDcmts
|
|
|
67
67
|
const newItem = { TID: tid.toString(), DID: did.toString(), checkoutFolder: "", checkoutName: fileName };
|
|
68
68
|
updateCicoCheckoutStorageItem(newItem, source.type, "addOrUpdate");
|
|
69
69
|
}
|
|
70
|
+
const cacheKey = `${tid}-${did}`;
|
|
71
|
+
if (dcmtsFileCachePreview.has(cacheKey))
|
|
72
|
+
removeDcmtsFileCache(cacheKey);
|
|
70
73
|
files.push({ TID: tid, DID: did, FILEEXT: ext, fileName });
|
|
71
74
|
}
|
|
72
75
|
});
|
|
73
|
-
if (files.length > 0)
|
|
76
|
+
if (files.length > 0) {
|
|
74
77
|
await downloadDcmtsAsync(files, DownloadTypes.Dcmt, "download");
|
|
78
|
+
}
|
|
75
79
|
};
|
|
76
80
|
export const updateCicoCheckoutStorageItem = (item, type, action = "addOrUpdate") => {
|
|
77
81
|
// Select the appropriate array based on type
|
package/lib/helper/helpers.d.ts
CHANGED
|
@@ -2,12 +2,16 @@ import { Colors as ColorsType } from "../components/base/TMEditorBase";
|
|
|
2
2
|
import { DeviceType } from "../components";
|
|
3
3
|
import { AppModules, DataColumnDescriptor, DcmtTypeDescriptor, ITopMediaSession, MetadataDescriptor, QueryDescriptor, SearchResultDescriptor, TaskDescriptor } from "@topconsultnpm/sdk-ts";
|
|
4
4
|
import { FileExtensionHandler, FormModes, moduleTypes } from "../ts";
|
|
5
|
+
declare const calcResponsiveSizes: (deviceType: DeviceType | undefined, desktopSize: string, tabletSize: string, mobileSize: string) => string;
|
|
6
|
+
declare const taskModalSizes: (deviceType: DeviceType | undefined, formMode: FormModes) => {
|
|
7
|
+
width: string;
|
|
8
|
+
height: string;
|
|
9
|
+
};
|
|
5
10
|
declare const TABLET_WIDTH = 1024;
|
|
6
11
|
declare const MOBILE_WIDTH = 640;
|
|
7
12
|
declare const calcResponsiveDirection: (deviceType: DeviceType, desktopDir: "horizontal" | "vertical", tabletDir: "horizontal" | "vertical", mobileDir: "horizontal" | "vertical") => "horizontal" | "vertical";
|
|
8
13
|
declare const openApps: (appModule: AppModules, tmSession: ITopMediaSession, appRoutes?: any[]) => Promise<void>;
|
|
9
14
|
export declare const setSDK_GlobalsInfoAsync: (tms: ITopMediaSession | undefined) => Promise<ITopMediaSession | undefined>;
|
|
10
|
-
declare const calcResponsiveSizes: (deviceType: DeviceType | undefined, desktopSize: string, tabletSize: string, mobileSize: string) => string;
|
|
11
15
|
declare const getColor: (color: ColorsType) => string;
|
|
12
16
|
/**
|
|
13
17
|
* Genera un Universally Unique Identifier (UUID) versione 4.
|
|
@@ -44,7 +48,7 @@ export declare const canPrev: (visibleItems: any[], selectedItems: any[]) => boo
|
|
|
44
48
|
export declare const getPrev: (visibleItems: any[], selectedItems: any[]) => any;
|
|
45
49
|
export declare const calcSaveFormTitle: (rootTitle: string | undefined, formMode: FormModes, updateId: number | undefined, pathKeys: string[] | undefined) => string;
|
|
46
50
|
export declare function calcIsModified(formData: any, formDataOrig: any): boolean;
|
|
47
|
-
export { openApps, calcResponsiveDirection, calcResponsiveSizes, getColor, genUniqueId, makeID, MOBILE_WIDTH, TABLET_WIDTH };
|
|
51
|
+
export { openApps, calcResponsiveDirection, calcResponsiveSizes, taskModalSizes, getColor, genUniqueId, makeID, MOBILE_WIDTH, TABLET_WIDTH };
|
|
48
52
|
export declare function moduleVersion(module: moduleTypes): string;
|
|
49
53
|
export declare function buildtype(module: moduleTypes): string;
|
|
50
54
|
export declare const highlightText: (text: string, searchValue: string) => JSX.Element;
|
package/lib/helper/helpers.js
CHANGED
|
@@ -7,6 +7,28 @@ import { buildTypes, FileExtensionHandler, FormModes, moduleTypes } from "../ts"
|
|
|
7
7
|
import { SDKUI_Localizator } from "./SDKUI_Localizator";
|
|
8
8
|
import ReactDOMServer from "react-dom/server";
|
|
9
9
|
import { DeepCompareHelper } from "./DeepCompareHelper";
|
|
10
|
+
const calcResponsiveSizes = (deviceType, desktopSize, tabletSize, mobileSize) => {
|
|
11
|
+
if (deviceType === DeviceType.DESKTOP)
|
|
12
|
+
return desktopSize;
|
|
13
|
+
if (deviceType === DeviceType.TABLET)
|
|
14
|
+
return tabletSize;
|
|
15
|
+
return mobileSize;
|
|
16
|
+
};
|
|
17
|
+
const taskModalSizes = (deviceType, formMode) => {
|
|
18
|
+
switch (formMode) {
|
|
19
|
+
case FormModes.Create:
|
|
20
|
+
case FormModes.Duplicate:
|
|
21
|
+
return {
|
|
22
|
+
width: calcResponsiveSizes(deviceType, '500px', '90%', '95%'),
|
|
23
|
+
height: calcResponsiveSizes(deviceType, '600px', '90%', '95%'),
|
|
24
|
+
};
|
|
25
|
+
default:
|
|
26
|
+
return {
|
|
27
|
+
width: calcResponsiveSizes(deviceType, '670px', '90%', '95%'),
|
|
28
|
+
height: calcResponsiveSizes(deviceType, '770px', '90%', '95%'),
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
};
|
|
10
32
|
//#region Responsive Helpers
|
|
11
33
|
const TABLET_WIDTH = 1024;
|
|
12
34
|
const MOBILE_WIDTH = 640;
|
|
@@ -50,13 +72,6 @@ export const setSDK_GlobalsInfoAsync = async (tms) => {
|
|
|
50
72
|
return undefined;
|
|
51
73
|
}
|
|
52
74
|
};
|
|
53
|
-
const calcResponsiveSizes = (deviceType, desktopSize, tabletSize, mobileSize) => {
|
|
54
|
-
if (deviceType === DeviceType.DESKTOP)
|
|
55
|
-
return desktopSize;
|
|
56
|
-
if (deviceType === DeviceType.TABLET)
|
|
57
|
-
return tabletSize;
|
|
58
|
-
return mobileSize;
|
|
59
|
-
};
|
|
60
75
|
//#endregion
|
|
61
76
|
const getColor = (color) => {
|
|
62
77
|
let c = '';
|
|
@@ -540,6 +555,7 @@ export const getMoreInfoTasksForDocument = (allTasks, TID, DID) => {
|
|
|
540
555
|
return [];
|
|
541
556
|
return allTasks.filter(task => isTaskMoreInfo(task.name) &&
|
|
542
557
|
task.state !== Task_States.Completed &&
|
|
558
|
+
task.state !== Task_States.Closed &&
|
|
543
559
|
task.iD1?.toString() === TID.toString() &&
|
|
544
560
|
task.iD2?.toString() === DID.toString());
|
|
545
561
|
};
|
|
@@ -616,7 +632,7 @@ export function calcIsModified(formData, formDataOrig) {
|
|
|
616
632
|
return JSON.stringify(formData) !== JSON.stringify(formDataOrig);
|
|
617
633
|
}
|
|
618
634
|
//#endregion
|
|
619
|
-
export { openApps, calcResponsiveDirection, calcResponsiveSizes, getColor, genUniqueId, makeID, MOBILE_WIDTH, TABLET_WIDTH };
|
|
635
|
+
export { openApps, calcResponsiveDirection, calcResponsiveSizes, taskModalSizes, getColor, genUniqueId, makeID, MOBILE_WIDTH, TABLET_WIDTH };
|
|
620
636
|
export function moduleVersion(module) {
|
|
621
637
|
switch (module) {
|
|
622
638
|
case moduleTypes.SDK: return SDK_Globals.sdkVersion ?? '0.0.0';
|
package/lib/helper/index.d.ts
CHANGED
package/lib/helper/index.js
CHANGED
|
@@ -49,7 +49,7 @@ export const IsParametricQuery = (qd) => {
|
|
|
49
49
|
return false;
|
|
50
50
|
};
|
|
51
51
|
export const addHiddenSelectItem = (select, tid, mid) => {
|
|
52
|
-
if (select.findIndex(o => o.mid == mid) >= 0)
|
|
52
|
+
if (select.findIndex(o => o.tid == tid && o.mid == mid) >= 0)
|
|
53
53
|
return;
|
|
54
54
|
let si = new SelectItem();
|
|
55
55
|
si.tid = tid;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useBetaFeatures: () => boolean;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { useEffect, useMemo } from 'react';
|
|
2
|
+
import { SDK_Globals } from '@topconsultnpm/sdk-ts';
|
|
3
|
+
import { SDKUI_Globals } from '../helper';
|
|
4
|
+
import { ShowAlert } from '../components';
|
|
5
|
+
export const useBetaFeatures = () => {
|
|
6
|
+
const tmSession = SDK_Globals.tmSession;
|
|
7
|
+
const archiveId = tmSession?.SessionDescr?.archiveID;
|
|
8
|
+
const userId = tmSession?.SessionDescr?.userID;
|
|
9
|
+
const isBetaFeaturesEnabled = useMemo(() => {
|
|
10
|
+
return SDKUI_Globals.userSettings.devSettings?.betaFeatures === 1;
|
|
11
|
+
}, [archiveId, userId]);
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
const handleBetaFeaturesShortcut = (e) => {
|
|
14
|
+
if (e.ctrlKey && e.altKey && e.key.toLowerCase() === 'y') {
|
|
15
|
+
e.preventDefault();
|
|
16
|
+
e.stopPropagation();
|
|
17
|
+
e.stopImmediatePropagation();
|
|
18
|
+
const currentValue = SDKUI_Globals.userSettings.devSettings?.betaFeatures;
|
|
19
|
+
const isCurrentlyEnabled = currentValue === 1;
|
|
20
|
+
if (isCurrentlyEnabled) {
|
|
21
|
+
SDKUI_Globals.userSettings.devSettings = undefined;
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
SDKUI_Globals.userSettings.devSettings = { betaFeatures: 1 };
|
|
25
|
+
}
|
|
26
|
+
const status = isCurrentlyEnabled ? 'disabilitato' : 'abilitato';
|
|
27
|
+
ShowAlert({
|
|
28
|
+
message: `Beta features ${status}! Saranno ${status === 'abilitato' ? 'disponibili' : 'nascoste'} al prossimo login.`,
|
|
29
|
+
mode: 'info',
|
|
30
|
+
duration: 5000,
|
|
31
|
+
title: 'Beta Features'
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
globalThis.addEventListener('keydown', handleBetaFeaturesShortcut);
|
|
36
|
+
return () => {
|
|
37
|
+
globalThis.removeEventListener('keydown', handleBetaFeaturesShortcut);
|
|
38
|
+
};
|
|
39
|
+
}, []);
|
|
40
|
+
return isBetaFeaturesEnabled;
|
|
41
|
+
};
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { DcmtInfo, DownloadModes, DownloadTypes } from '../ts';
|
|
2
2
|
import { FileDescriptor, SearchResultDescriptor } from '@topconsultnpm/sdk-ts';
|
|
3
|
-
interface
|
|
3
|
+
export interface UseCheckInOutOperationsProps {
|
|
4
|
+
onRefreshPreview: () => Promise<void>;
|
|
5
|
+
}
|
|
6
|
+
export interface UseCheckInOutOperationsReturn {
|
|
4
7
|
showHistory: boolean;
|
|
5
8
|
showHistoryCallback: () => void;
|
|
6
9
|
hideHistoryCallback: () => void;
|
|
@@ -14,9 +17,8 @@ interface UseCheckInOutOperationsReturn {
|
|
|
14
17
|
};
|
|
15
18
|
hideCommentFormCallback: () => void;
|
|
16
19
|
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>,
|
|
18
|
-
handleCheckInCallback: (dcmt: DcmtInfo,
|
|
19
|
-
refreshPreviewTrigger: number;
|
|
20
|
+
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>, onRefreshAsync?: (tid: number | undefined, did: number | undefined, refreshUI?: boolean, metadataResult?: SearchResultDescriptor | null) => Promise<void>) => Promise<void>;
|
|
21
|
+
handleCheckInCallback: (dcmt: DcmtInfo, onRefreshAsync?: (tid: number | undefined, did: number | undefined, refreshUI?: boolean, metadataResult?: SearchResultDescriptor | null) => Promise<void>) => Promise<void>;
|
|
20
22
|
showCicoWaitPanel: boolean;
|
|
21
23
|
cicoWaitPanelTitle: string;
|
|
22
24
|
showCicoPrimaryProgress: boolean;
|
|
@@ -24,5 +26,4 @@ interface UseCheckInOutOperationsReturn {
|
|
|
24
26
|
cicoPrimaryProgressValue: number;
|
|
25
27
|
cicoPrimaryProgressMax: number;
|
|
26
28
|
}
|
|
27
|
-
export declare const useCheckInOutOperations: () => UseCheckInOutOperationsReturn;
|
|
28
|
-
export {};
|
|
29
|
+
export declare const useCheckInOutOperations: (props: UseCheckInOutOperationsProps) => UseCheckInOutOperationsReturn;
|