@topconsultnpm/sdkui-react 6.21.0-dev1.8 → 6.21.0-dev2.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.
Files changed (78) hide show
  1. package/lib/components/NewComponents/ContextMenu/TMContextMenu.js +2 -2
  2. package/lib/components/NewComponents/ContextMenu/styles.d.ts +43 -19
  3. package/lib/components/NewComponents/FloatingMenuBar/TMFloatingMenuBar.js +1 -1
  4. package/lib/components/NewComponents/FloatingMenuBar/styles.d.ts +79 -27
  5. package/lib/components/base/Styled.d.ts +76 -40
  6. package/lib/components/base/TMAreaManager.js +28 -11
  7. package/lib/components/base/TMFileManagerDataGridView.js +2 -2
  8. package/lib/components/base/TMFileManagerUtils.d.ts +6 -2
  9. package/lib/components/base/TMPanel.js +1 -0
  10. package/lib/components/base/TMTreeView.d.ts +5 -3
  11. package/lib/components/choosers/TMDataListItemChooser.js +56 -2
  12. package/lib/components/choosers/TMDynDataListItemChooser.d.ts +1 -1
  13. package/lib/components/choosers/TMDynDataListItemChooser.js +51 -23
  14. package/lib/components/editors/TMDropDown.js +2 -2
  15. package/lib/components/editors/TMEditorStyled.d.ts +42 -10
  16. package/lib/components/editors/TMFormulaEditor.js +15 -3
  17. package/lib/components/editors/TMMetadataEditor.js +4 -3
  18. package/lib/components/editors/TMMetadataValues.js +1 -1
  19. package/lib/components/features/archive/TMArchive.js +1 -1
  20. package/lib/components/features/documents/TMDcmtBlog.d.ts +1 -0
  21. package/lib/components/features/documents/TMDcmtBlog.js +2 -2
  22. package/lib/components/features/documents/TMDcmtForm.js +49 -21
  23. package/lib/components/features/documents/TMDcmtFormActionButtons.js +244 -60
  24. package/lib/components/features/documents/TMDcmtPreview.d.ts +5 -3
  25. package/lib/components/features/documents/TMDragDropOverlay.js +7 -2
  26. package/lib/components/features/documents/TMFileUploader.js +5 -4
  27. package/lib/components/features/documents/TMMasterDetailDcmts.js +30 -56
  28. package/lib/components/features/documents/TMRelationViewer.js +1 -0
  29. package/lib/components/features/search/TMSavedQuerySelector.js +1 -1
  30. package/lib/components/features/search/TMSearch.js +2 -0
  31. package/lib/components/features/search/TMSearchQueryEditor.js +13 -1
  32. package/lib/components/features/search/TMSearchQueryPanel.d.ts +3 -3
  33. package/lib/components/features/search/TMSearchResult.js +15 -2
  34. package/lib/components/features/search/TMViewHistoryDcmt.js +6 -0
  35. package/lib/components/features/workflow/TMWorkflowPopup.js +3 -0
  36. package/lib/components/features/workflow/diagram/DiagramItemForm.js +5 -1
  37. package/lib/components/features/workflow/diagram/WFDiagram.js +7 -1
  38. package/lib/components/features/workflow/diagram/WorkitemRecipientsEditor.d.ts +1 -1
  39. package/lib/components/features/workflow/diagram/xmlParser.js +13 -14
  40. package/lib/components/forms/Login/ChangePasswordInputs.d.ts +1 -1
  41. package/lib/components/forms/Login/TMLoginForm.js +15 -5
  42. package/lib/components/forms/TMChooserForm.js +25 -2
  43. package/lib/components/grids/TMBlogsPost.js +1 -1
  44. package/lib/components/index.d.ts +1 -0
  45. package/lib/components/index.js +1 -0
  46. package/lib/components/layout/panelManager/TMPanelManagerToolbar.d.ts +5 -2
  47. package/lib/components/pages/TMPage.js +4 -2
  48. package/lib/components/query/TMQueryCountButton.d.ts +11 -0
  49. package/lib/components/query/TMQueryCountButton.js +32 -0
  50. package/lib/components/query/TMQueryEditor.d.ts +10 -6
  51. package/lib/components/query/TMQueryEditor.js +42 -5
  52. package/lib/components/query/TMQuerySummary.js +3 -2
  53. package/lib/components/sidebar/TMCommandsPanel.d.ts +4 -2
  54. package/lib/components/viewers/TMDataListItemViewer.d.ts +2 -1
  55. package/lib/components/viewers/TMDataListItemViewer.js +2 -2
  56. package/lib/components/viewers/TMTidViewer.js +1 -1
  57. package/lib/helper/SDKUI_Globals.d.ts +2 -0
  58. package/lib/helper/SDKUI_Localizator.d.ts +1 -0
  59. package/lib/helper/SDKUI_Localizator.js +10 -0
  60. package/lib/helper/TMPdfViewer.js +143 -86
  61. package/lib/helper/TMUtils.d.ts +4 -9
  62. package/lib/helper/TMUtils.js +12 -74
  63. package/lib/helper/checkinCheckoutManager.d.ts +6 -1
  64. package/lib/helper/checkinCheckoutManager.js +203 -9
  65. package/lib/helper/helpers.js +8 -6
  66. package/lib/hooks/useCheckInOutOperations.d.ts +1 -1
  67. package/lib/hooks/useCheckInOutOperations.js +9 -4
  68. package/lib/hooks/useDcmtOperations.d.ts +1 -0
  69. package/lib/hooks/useDcmtOperations.js +75 -5
  70. package/lib/hooks/useDocumentOperations.js +17 -4
  71. package/lib/hooks/useForm.js +20 -14
  72. package/lib/hooks/useInputDialog.d.ts +2 -0
  73. package/lib/hooks/useInputDialog.js +37 -0
  74. package/lib/hooks/useQueryParametersDialog.js +5 -5
  75. package/lib/services/platform_services.d.ts +1 -1
  76. package/lib/services/platform_services.js +8 -0
  77. package/lib/ts/types.d.ts +1 -0
  78. package/package.json +54 -55
@@ -1,28 +1,63 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useEffect, useState, useRef, useCallback } from "react";
2
+ import { useEffect, useState, useRef, useCallback, Component } from "react";
3
3
  import styled from "styled-components";
4
4
  import { LoadIndicator } from 'devextreme-react/load-indicator';
5
5
  import { IconCloseOutline } from "./TMIcons";
6
6
  import { SDKUI_Localizator } from "./SDKUI_Localizator";
7
7
  import { TMColors } from "../utils/theme";
8
8
  import { TMMessageBoxManager, ButtonNames } from "../components/base/TMPopUp";
9
- // Dynamic imports for optional dependencies
10
- let pdfjs;
11
- let Document;
12
- let Page;
13
- let isReactPdfAvailable = false;
14
- try {
15
- const reactPdf = require('react-pdf');
16
- pdfjs = reactPdf.pdfjs;
17
- Document = reactPdf.Document;
18
- Page = reactPdf.Page;
19
- // Configura il worker PDF.js PRIMA del rendering
20
- pdfjs.GlobalWorkerOptions.workerSrc = `https://unpkg.com/pdfjs-dist@${pdfjs.version}/build/pdf.worker.min.mjs`;
21
- isReactPdfAvailable = true;
22
- }
23
- catch (error) {
24
- // react-pdf not available - will use iframe fallback
25
- // console.warn('react-pdf is not installed. TMPdfViewer will use iframe fallback.');
9
+ import { Document, Page, pdfjs } from "react-pdf";
10
+ let workerStatus = 'pending';
11
+ let workerCheckPromise = null;
12
+ /**
13
+ * Verifica se il worker PDF.js è disponibile e lo configura.
14
+ * La Promise viene creata una sola volta e riutilizzata per tutte le istanze.
15
+ */
16
+ const checkAndConfigureWorker = () => {
17
+ if (workerCheckPromise) {
18
+ return workerCheckPromise;
19
+ }
20
+ workerCheckPromise = new Promise((resolve) => {
21
+ const workerUrl = window.location.origin + "/assets/pdfjs-dist/pdf.worker.min.mjs";
22
+ fetch(workerUrl, { method: 'HEAD' })
23
+ .then(response => {
24
+ if (response.ok) {
25
+ pdfjs.GlobalWorkerOptions.workerSrc = workerUrl;
26
+ workerStatus = 'available';
27
+ resolve(true);
28
+ }
29
+ else {
30
+ console.warn('PDF.js worker not found at:', workerUrl);
31
+ workerStatus = 'unavailable';
32
+ resolve(false);
33
+ }
34
+ })
35
+ .catch(error => {
36
+ console.warn('PDF.js worker check failed:', error);
37
+ workerStatus = 'unavailable';
38
+ resolve(false);
39
+ });
40
+ });
41
+ return workerCheckPromise;
42
+ };
43
+ class PdfErrorBoundary extends Component {
44
+ constructor(props) {
45
+ super(props);
46
+ this.state = { hasError: false };
47
+ }
48
+ static getDerivedStateFromError(_) {
49
+ return { hasError: true };
50
+ }
51
+ componentDidCatch(error, errorInfo) {
52
+ console.warn('PDF rendering error, switching to iframe fallback:', error.message);
53
+ this.props.onError();
54
+ }
55
+ render() {
56
+ if (this.state.hasError) {
57
+ return this.props.fallback;
58
+ }
59
+ return this.props.children;
60
+ }
26
61
  }
27
62
  const PDFViewerContainer = styled.div `
28
63
  width: 100%;
@@ -73,6 +108,24 @@ const TMPdfViewer = (props) => {
73
108
  const [isCheckingPdf, setIsCheckingPdf] = useState(true);
74
109
  const [jsMatches, setJsMatches] = useState([]);
75
110
  const observerRef = useRef(null);
111
+ // Stati per gestione worker PDF.js
112
+ const [workerChecked, setWorkerChecked] = useState(workerStatus !== 'pending');
113
+ const [useIframeFallback, setUseIframeFallback] = useState(workerStatus === 'unavailable');
114
+ // Verifica il worker PDF.js - la Promise è condivisa, quindi la fetch avviene una sola volta
115
+ useEffect(() => {
116
+ if (workerStatus === 'pending') {
117
+ checkAndConfigureWorker().then(available => {
118
+ setWorkerChecked(true);
119
+ if (!available) {
120
+ setUseIframeFallback(true);
121
+ }
122
+ });
123
+ }
124
+ }, []);
125
+ // Handler per errori di react-pdf - fallback su iframe
126
+ const handlePdfError = useCallback(() => {
127
+ setUseIframeFallback(true);
128
+ }, []);
76
129
  useEffect(() => {
77
130
  const checkIsMobile = () => {
78
131
  try {
@@ -269,8 +322,8 @@ const TMPdfViewer = (props) => {
269
322
  }, children: highlightMatch(match.context, match.match) }) })] }, index)))) : (_jsx("div", { style: { textAlign: 'center', padding: '20px', color: '#999' }, children: "Nessun dettaglio disponibile" }))] }))
270
323
  });
271
324
  };
272
- // Mostra loading durante la validazione
273
- if (isCheckingPdf) {
325
+ // Mostra loading durante la validazione del PDF e verifica worker
326
+ if (isCheckingPdf || !workerChecked) {
274
327
  return (_jsx(PDFViewerContainer, { children: _jsxs("div", { style: {
275
328
  display: 'flex',
276
329
  justifyContent: 'center',
@@ -280,22 +333,24 @@ const TMPdfViewer = (props) => {
280
333
  gap: '10px'
281
334
  }, children: [_jsx(LoadIndicator, { height: 60, width: 60 }), _jsx("div", { children: "Validazione PDF in corso..." })] }) }));
282
335
  }
336
+ // Componente iframe per fallback
337
+ const IframeViewer = (_jsx(PDFViewerContainer, { children: _jsx("iframe", { src: `${pdfUrl}#${enableFitToWidth ? 'view=FitH&' : ''}scrollbar=1`, title: title, style: {
338
+ width: '100%',
339
+ height: '100%',
340
+ border: 'none',
341
+ zIndex: 0,
342
+ pointerEvents: isResizingActive === true ? "none" : "auto"
343
+ } }, pdfUrl) }));
283
344
  /**
284
345
  * Usa <iframe> nei seguenti casi:
285
- * 1. react-pdf non è disponibile (libreria non installata)
346
+ * 1. Worker PDF.js non disponibile o in errore (fallback)
286
347
  * 2. Desktop E nessun contenuto JavaScript rilevato (visualizzazione nativa del browser più performante)
287
348
  *
288
349
  * L'iframe sfrutta il visualizzatore PDF nativo del browser, ma non può prevenire
289
350
  * l'esecuzione di JavaScript embedded nel PDF.
290
351
  */
291
- if (!isReactPdfAvailable || (!isMobile && !hasUnsafeContent && pdfUrl)) {
292
- return (_jsx(PDFViewerContainer, { children: _jsx("iframe", { src: `${pdfUrl}#${enableFitToWidth ? 'view=FitH&' : ''}scrollbar=1`, title: title, style: {
293
- width: '100%',
294
- height: '100%',
295
- border: 'none',
296
- zIndex: 0,
297
- pointerEvents: isResizingActive === true ? "none" : "auto"
298
- } }, pdfUrl) }));
352
+ if (useIframeFallback || (!isMobile && !hasUnsafeContent && pdfUrl)) {
353
+ return IframeViewer;
299
354
  }
300
355
  /**
301
356
  * Usa react-pdf nei seguenti casi:
@@ -304,70 +359,72 @@ const TMPdfViewer = (props) => {
304
359
  *
305
360
  * react-pdf renderizza il PDF come canvas, prevenendo l'esecuzione di JavaScript embedded,
306
361
  * ma è meno performante dell'iframe nativo su desktop.
362
+ *
363
+ * ErrorBoundary garantisce fallback su iframe in caso di qualsiasi errore runtime.
307
364
  */
308
- return _jsxs(PDFViewerContainer, { style: { display: 'flex', flexDirection: 'column' }, children: [loadedPagesNumber === 0 && totalPagesNumber > 0 && _jsx(LoadingOverlay, { children: _jsxs("div", { style: {
309
- display: 'flex',
310
- justifyContent: 'center',
311
- alignItems: 'center',
312
- flexDirection: 'column',
313
- gap: '10px'
314
- }, children: [_jsx(LoadIndicator, { height: 60, width: 60 }), _jsxs("div", { children: [SDKUI_Localizator.Loading, "..."] })] }) }), _jsx("div", { style: {
315
- display: loadedPagesNumber > 0 && totalPagesNumber > 0 ? 'block' : 'none',
316
- flex: 1,
317
- overflow: 'auto'
318
- }, children: _jsx(Document, { file: pdfBlob, onLoadSuccess: ({ numPages }) => {
319
- setTotalPagesNumber(numPages);
320
- setLoadedPagesNumber(0);
321
- }, loading: _jsxs("div", { style: {
322
- display: 'flex',
323
- justifyContent: 'center',
324
- alignItems: 'center',
325
- height: '100%',
326
- flexDirection: 'column',
327
- gap: '10px'
328
- }, children: [_jsx(LoadIndicator, { height: 60, width: 60 }), _jsxs("div", { children: [SDKUI_Localizator.Loading, "..."] })] }), error: _jsxs("div", { style: {
365
+ return (_jsx(PdfErrorBoundary, { onError: handlePdfError, fallback: IframeViewer, children: _jsxs(PDFViewerContainer, { style: { display: 'flex', flexDirection: 'column' }, children: [loadedPagesNumber === 0 && totalPagesNumber > 0 && _jsx(LoadingOverlay, { children: _jsxs("div", { style: {
329
366
  display: 'flex',
330
367
  justifyContent: 'center',
331
368
  alignItems: 'center',
332
- height: '100%',
333
369
  flexDirection: 'column',
334
370
  gap: '10px'
335
- }, children: [_jsx(IconCloseOutline, { fontSize: 64, color: TMColors.error }), _jsx("div", { children: "Errore nel caricamento del PDF" })] }), children: Array.from(new Array(totalPagesNumber), (el, index) => {
336
- const pageNumber = index + 1;
337
- const shouldRender = visiblePages.has(pageNumber);
338
- return (_jsx("div", { "data-page-number": pageNumber, ref: (el) => {
339
- if (el && observerRef.current) {
340
- observerRef.current.observe(el);
341
- }
342
- }, style: {
343
- minHeight: shouldRender ? 'auto' : '1000px',
371
+ }, children: [_jsx(LoadIndicator, { height: 60, width: 60 }), _jsxs("div", { children: [SDKUI_Localizator.Loading, "..."] })] }) }), _jsx("div", { style: {
372
+ display: loadedPagesNumber > 0 && totalPagesNumber > 0 ? 'block' : 'none',
373
+ flex: 1,
374
+ overflow: 'auto'
375
+ }, children: _jsx(Document, { file: pdfBlob, onLoadSuccess: ({ numPages }) => {
376
+ setTotalPagesNumber(numPages);
377
+ setLoadedPagesNumber(0);
378
+ }, onLoadError: handlePdfError, loading: _jsxs("div", { style: {
344
379
  display: 'flex',
345
380
  justifyContent: 'center',
346
- alignItems: 'center'
347
- }, children: shouldRender && (_jsx(Page, { pageNumber: pageNumber, renderTextLayer: false, renderAnnotationLayer: false, width: Math.min(window.innerWidth - 40, 1200), loading: _jsx("div", { style: { padding: '20px' }, children: _jsx(LoadIndicator, { height: 40, width: 40 }) }), onLoadSuccess: () => {
348
- setLoadedPagesNumber(prev => prev + 1);
349
- } })) }, `page_${pageNumber}`));
350
- }) }) }), hasUnsafeContent && (_jsxs("div", { style: {
351
- display: 'flex',
352
- justifyContent: 'center',
353
- alignItems: 'center',
354
- padding: '12px 20px',
355
- background: '#fff3cd',
356
- borderTop: '2px solid #ffc107',
357
- gap: '8px',
358
- flexShrink: 0
359
- }, children: [_jsxs("span", { style: {
360
- color: '#856404',
361
- whiteSpace: 'nowrap',
362
- overflow: 'hidden',
363
- textOverflow: 'ellipsis',
364
- flex: 1
365
- }, children: [_jsx("strong", { children: "Attenzione:" }), " Questo documento contiene contenuti potenzialmente non sicuri."] }), jsMatches.length > 0 && (_jsx("span", { className: "dx-icon-info", style: {
366
- fontSize: '20px',
367
- color: '#d32f2f',
368
- cursor: 'pointer',
369
- transition: 'color 0.2s',
370
- marginLeft: '4px'
371
- }, onClick: showMatchDetails, title: "Clicca per vedere i dettagli", onMouseEnter: (e) => e.currentTarget.style.color = '#b71c1c', onMouseLeave: (e) => e.currentTarget.style.color = '#d32f2f' }))] }))] });
381
+ alignItems: 'center',
382
+ height: '100%',
383
+ flexDirection: 'column',
384
+ gap: '10px'
385
+ }, children: [_jsx(LoadIndicator, { height: 60, width: 60 }), _jsxs("div", { children: [SDKUI_Localizator.Loading, "..."] })] }), error: _jsxs("div", { style: {
386
+ display: 'flex',
387
+ justifyContent: 'center',
388
+ alignItems: 'center',
389
+ height: '100%',
390
+ flexDirection: 'column',
391
+ gap: '10px'
392
+ }, children: [_jsx(IconCloseOutline, { fontSize: 64, color: TMColors.error }), _jsx("div", { children: "Errore nel caricamento del PDF" })] }), children: Array.from(new Array(totalPagesNumber), (el, index) => {
393
+ const pageNumber = index + 1;
394
+ const shouldRender = visiblePages.has(pageNumber);
395
+ return (_jsx("div", { "data-page-number": pageNumber, ref: (el) => {
396
+ if (el && observerRef.current) {
397
+ observerRef.current.observe(el);
398
+ }
399
+ }, style: {
400
+ minHeight: shouldRender ? 'auto' : '1000px',
401
+ display: 'flex',
402
+ justifyContent: 'center',
403
+ alignItems: 'center'
404
+ }, children: shouldRender && (_jsx(Page, { pageNumber: pageNumber, renderTextLayer: false, renderAnnotationLayer: false, width: Math.min(window.innerWidth - 40, 1200), loading: _jsx("div", { style: { padding: '20px' }, children: _jsx(LoadIndicator, { height: 40, width: 40 }) }), onLoadSuccess: () => {
405
+ setLoadedPagesNumber(prev => prev + 1);
406
+ } })) }, `page_${pageNumber}`));
407
+ }) }) }), hasUnsafeContent && (_jsxs("div", { style: {
408
+ display: 'flex',
409
+ justifyContent: 'center',
410
+ alignItems: 'center',
411
+ padding: '12px 20px',
412
+ background: '#fff3cd',
413
+ borderTop: '2px solid #ffc107',
414
+ gap: '8px',
415
+ flexShrink: 0
416
+ }, children: [_jsxs("span", { style: {
417
+ color: '#856404',
418
+ whiteSpace: 'nowrap',
419
+ overflow: 'hidden',
420
+ textOverflow: 'ellipsis',
421
+ flex: 1
422
+ }, children: [_jsx("strong", { children: "Attenzione:" }), " Questo documento contiene contenuti potenzialmente non sicuri."] }), jsMatches.length > 0 && (_jsx("span", { className: "dx-icon-info", style: {
423
+ fontSize: '20px',
424
+ color: '#d32f2f',
425
+ cursor: 'pointer',
426
+ transition: 'color 0.2s',
427
+ marginLeft: '4px'
428
+ }, onClick: showMatchDetails, title: "Clicca per vedere i dettagli", onMouseEnter: (e) => e.currentTarget.style.color = '#b71c1c', onMouseLeave: (e) => e.currentTarget.style.color = '#d32f2f' }))] }))] }) }));
372
429
  };
373
430
  export default TMPdfViewer;
@@ -23,24 +23,19 @@ interface TabItemProps {
23
23
  $isSelected: boolean;
24
24
  $activeGradient?: string;
25
25
  }
26
- export declare const StyledTabItem: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, TabItemProps>> & string;
27
- export declare const StyledTabIcon: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, TabItemProps>> & string;
28
- export declare const TMCountBadge: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
26
+ export declare const StyledTabItem: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof TabItemProps> & TabItemProps, never> & Partial<Pick<import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof TabItemProps> & TabItemProps, never>>> & string;
27
+ export declare const StyledTabIcon: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, keyof TabItemProps> & TabItemProps, never> & Partial<Pick<import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, keyof TabItemProps> & TabItemProps, never>>> & string;
28
+ export declare const TMCountBadge: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
29
29
  export declare const PDGS_COLORS: {
30
30
  DOSSIER: string;
31
31
  DOCUMENT: string;
32
32
  WORKING_GROUP: string;
33
33
  };
34
34
  export declare const getPdgsIconMap: (fontSize?: number) => Map<PdGs, JSX.Element>;
35
- export type SignatureConfiguration = {
36
- copyright: string;
37
- date: boolean;
38
- location: string;
39
- };
40
- export declare const parseSignatureConfiguration: (did: number, informationSign: string | undefined | null, title: string | undefined | null) => Partial<SignatureConfiguration>;
41
35
  export declare const convertSearchResultDescriptorToFileItems: (documents: Array<SearchResultDescriptor>) => Array<FileItem>;
42
36
  export declare const getAppModuleGradient: (appModuleID: AppModules) => string;
43
37
  export declare const getPanelManagerToolbarColor: (appModuleID: AppModules) => string;
38
+ export declare const getFileManagerFolderColor: (appModuleID: AppModules) => string;
44
39
  type SearchToolbarVisibility = {
45
40
  tmSearchResult: boolean;
46
41
  tmBlog: boolean;
@@ -225,80 +225,6 @@ export const getPdgsIconMap = (fontSize = 20) => {
225
225
  [PdGs.WG, _jsx(IconMenuCAWorkingGroups, { color: PDGS_COLORS.WORKING_GROUP, fontSize: 28 }, "PdGs-WG")],
226
226
  ]);
227
227
  };
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());
244
- }
245
- else if (currentKey === "date" && !allowedDateValues.includes(currentValue)) {
246
- invalidDateValues.push(rawValue);
247
- }
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;
283
- }
284
- case "location": {
285
- const parsed = parseBooleanOrValue(currentValue);
286
- result.location = parsed.enabled
287
- ? parsed.customValue || ""
288
- : "";
289
- break;
290
- }
291
- case "copyright": {
292
- const parsed = parseBooleanOrValue(currentValue);
293
- result.copyright = parsed.enabled
294
- ? parsed.customValue || ""
295
- : "";
296
- break;
297
- }
298
- }
299
- }
300
- return result;
301
- };
302
228
  export const convertSearchResultDescriptorToFileItems = (documents) => {
303
229
  const fileItems = [];
304
230
  documents.forEach((doc, docIndex) => {
@@ -374,6 +300,18 @@ export const getPanelManagerToolbarColor = (appModuleID) => {
374
300
  return 'transparent linear-gradient(90deg, #CCE0F4 0%, #7EC1E7 14%, #39A6DB 28%, #1E9CD7 35%, #0075BE 78%, #005B97 99%) 0% 0% no-repeat padding-box';
375
301
  }
376
302
  };
303
+ export const getFileManagerFolderColor = (appModuleID) => {
304
+ switch (appModuleID) {
305
+ case AppModules.SURFER:
306
+ return '#2559a5';
307
+ case AppModules.DESIGNER:
308
+ return '#482234';
309
+ case AppModules.ORCHESTRATOR:
310
+ return '#1d6f42';
311
+ default:
312
+ return '#2559a5';
313
+ }
314
+ };
377
315
  export const getSearchToolbarVisibility = (appModuleID) => {
378
316
  switch (appModuleID) {
379
317
  case AppModules.SURFER:
@@ -28,6 +28,10 @@ export interface CheckoutStatusResult {
28
28
  version: number;
29
29
  icon: React.ReactNode | null;
30
30
  editLockTooltipText: React.ReactNode | null;
31
+ checkoutUserId: number | undefined;
32
+ checkoutDate: any;
33
+ fileExt: string | null;
34
+ isMetadata: boolean;
31
35
  }
32
36
  export type DownloadSource = {
33
37
  type: 'fileItem';
@@ -40,7 +44,7 @@ export type DownloadSource = {
40
44
  export declare const getCicoDownloadFileName: (source: DownloadSource, checkout: boolean, withTimestampAndExt: boolean) => string;
41
45
  export declare const cicoDownloadFilesCallback: (sources: Array<DownloadSource>, 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>;
42
46
  export declare const updateCicoCheckoutStorageItem: (item: CheckoutInfo, type: "fileItem" | "dcmtInfo", action?: "addOrUpdate" | "remove") => void;
43
- export declare const validateCicoFileName: (source: DownloadSource, fileName: string) => FileNameValidation;
47
+ export declare const validateCicoFileName: (source: DownloadSource, fileName: string, checkoutDate?: string | null) => FileNameValidation;
44
48
  type ValidationResult = {
45
49
  expected: string | number | undefined;
46
50
  current: string | number | undefined;
@@ -52,6 +56,7 @@ type FileNameValidationItems = {
52
56
  did: ValidationResult;
53
57
  tid: ValidationResult;
54
58
  fileExtension: ValidationResult;
59
+ checkoutDate?: ValidationResult;
55
60
  };
56
61
  type FileNameValidation = {
57
62
  isValid: boolean;