@topconsultnpm/sdkui-react 6.20.0-dev1.5 → 6.20.0-dev1.50
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/TMContextMenu.d.ts +4 -0
- package/lib/components/NewComponents/ContextMenu/TMContextMenu.js +302 -0
- package/lib/components/NewComponents/ContextMenu/hooks.d.ts +13 -0
- package/lib/components/NewComponents/ContextMenu/hooks.js +61 -0
- package/lib/components/NewComponents/ContextMenu/index.d.ts +2 -0
- package/lib/components/NewComponents/ContextMenu/index.js +1 -0
- package/lib/components/NewComponents/ContextMenu/styles.d.ts +31 -0
- package/lib/components/NewComponents/ContextMenu/styles.js +336 -0
- package/lib/components/NewComponents/ContextMenu/types.d.ts +38 -0
- package/lib/components/NewComponents/ContextMenu/types.js +1 -0
- package/lib/components/NewComponents/FloatingMenuBar/TMFloatingMenuBar.d.ts +4 -0
- package/lib/components/NewComponents/FloatingMenuBar/TMFloatingMenuBar.js +686 -0
- package/lib/components/NewComponents/FloatingMenuBar/index.d.ts +2 -0
- package/lib/components/NewComponents/FloatingMenuBar/index.js +2 -0
- package/lib/components/NewComponents/FloatingMenuBar/styles.d.ts +47 -0
- package/lib/components/NewComponents/FloatingMenuBar/styles.js +346 -0
- package/lib/components/NewComponents/FloatingMenuBar/types.d.ts +28 -0
- package/lib/components/NewComponents/FloatingMenuBar/types.js +1 -0
- package/lib/components/base/TMCustomButton.js +61 -17
- package/lib/components/base/TMDataGrid.d.ts +7 -4
- package/lib/components/base/TMDataGrid.js +112 -11
- package/lib/components/choosers/TMMetadataChooser.js +8 -1
- package/lib/components/editors/TMMetadataValues.js +23 -5
- package/lib/components/features/documents/TMDcmtForm.d.ts +13 -1
- package/lib/components/features/documents/TMDcmtForm.js +385 -193
- package/lib/components/features/documents/TMDcmtPreview.js +37 -66
- package/lib/components/features/documents/TMMasterDetailDcmts.js +1 -1
- package/lib/components/features/search/TMDcmtCheckoutInfoForm.d.ts +8 -0
- package/lib/components/features/search/{TMSearchResultCheckoutInfoForm.js → TMDcmtCheckoutInfoForm.js} +5 -10
- package/lib/components/features/search/TMSearch.js +30 -5
- package/lib/components/features/search/TMSearchQueryPanel.js +13 -12
- package/lib/components/features/search/TMSearchResult.js +58 -208
- package/lib/components/features/search/TMSearchResultsMenuItems.d.ts +3 -3
- package/lib/components/features/search/TMSearchResultsMenuItems.js +205 -169
- package/lib/components/features/search/TMSignSettingsForm.js +1 -1
- package/lib/components/features/search/TMSignatureInfoContent.d.ts +6 -0
- package/lib/components/features/search/TMSignatureInfoContent.js +140 -0
- package/lib/components/features/search/TMViewHistoryDcmt.js +1 -1
- package/lib/components/features/tasks/TMTasksView.js +2 -2
- package/lib/components/features/workflow/diagram/WFDiagram.js +2 -2
- package/lib/components/forms/Login/LoginValidatorService.d.ts +2 -0
- package/lib/components/forms/Login/LoginValidatorService.js +7 -2
- package/lib/components/forms/Login/TMLoginForm.js +34 -6
- package/lib/components/forms/TMChooserForm.js +1 -1
- package/lib/components/index.d.ts +1 -0
- package/lib/components/index.js +1 -0
- package/lib/css/tm-sdkui.css +1 -1
- package/lib/helper/SDKUI_Globals.d.ts +17 -0
- package/lib/helper/SDKUI_Globals.js +9 -0
- package/lib/helper/SDKUI_Localizator.d.ts +2 -1
- package/lib/helper/SDKUI_Localizator.js +11 -1
- package/lib/helper/TMIcons.d.ts +1 -0
- package/lib/helper/TMIcons.js +3 -0
- package/lib/helper/TMPdfViewer.d.ts +8 -0
- package/lib/helper/TMPdfViewer.js +187 -0
- package/lib/helper/checkinCheckoutManager.d.ts +32 -2
- package/lib/helper/checkinCheckoutManager.js +115 -38
- package/lib/helper/devextremeCustomMessages.d.ts +30 -0
- package/lib/helper/devextremeCustomMessages.js +30 -0
- package/lib/helper/helpers.d.ts +2 -1
- package/lib/helper/helpers.js +12 -2
- package/lib/helper/index.d.ts +1 -0
- package/lib/helper/index.js +1 -0
- package/lib/helper/queryHelper.js +29 -0
- package/lib/hooks/useCheckInOutOperations.d.ts +28 -0
- package/lib/hooks/useCheckInOutOperations.js +223 -0
- package/lib/hooks/useWorkflowApprove.d.ts +4 -0
- package/lib/hooks/useWorkflowApprove.js +14 -1
- package/package.json +5 -2
- package/lib/components/features/search/TMSearchResultCheckoutInfoForm.d.ts +0 -8
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState, useRef, useCallback } from "react";
|
|
3
|
+
import styled from "styled-components";
|
|
4
|
+
import { LoadIndicator } from 'devextreme-react/load-indicator';
|
|
5
|
+
import { IconCloseOutline } from "./TMIcons";
|
|
6
|
+
import { SDKUI_Localizator } from "./SDKUI_Localizator";
|
|
7
|
+
import { TMColors } from "../utils/theme";
|
|
8
|
+
// Dynamic imports for optional dependencies
|
|
9
|
+
let pdfjs;
|
|
10
|
+
let Document;
|
|
11
|
+
let Page;
|
|
12
|
+
let isReactPdfAvailable = false;
|
|
13
|
+
try {
|
|
14
|
+
const reactPdf = require('react-pdf');
|
|
15
|
+
pdfjs = reactPdf.pdfjs;
|
|
16
|
+
Document = reactPdf.Document;
|
|
17
|
+
Page = reactPdf.Page;
|
|
18
|
+
// Configura il worker PDF.js PRIMA del rendering
|
|
19
|
+
pdfjs.GlobalWorkerOptions.workerSrc = `https://unpkg.com/pdfjs-dist@${pdfjs.version}/build/pdf.worker.min.mjs`;
|
|
20
|
+
isReactPdfAvailable = true;
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
// react-pdf not available - will use iframe fallback
|
|
24
|
+
// console.warn('react-pdf is not installed. TMPdfViewer will use iframe fallback.');
|
|
25
|
+
}
|
|
26
|
+
const PDFViewerContainer = styled.div `
|
|
27
|
+
width: 100%;
|
|
28
|
+
height: 100%;
|
|
29
|
+
overflow-y: auto;
|
|
30
|
+
overflow-x: hidden;
|
|
31
|
+
background-color: #f5f5f5;
|
|
32
|
+
position: relative;
|
|
33
|
+
|
|
34
|
+
.react-pdf__Document {
|
|
35
|
+
display: flex;
|
|
36
|
+
flex-direction: column;
|
|
37
|
+
align-items: center;
|
|
38
|
+
gap: 10px;
|
|
39
|
+
padding: 10px 0;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.react-pdf__Page {
|
|
43
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|
44
|
+
margin: 0 auto;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.react-pdf__Page__canvas {
|
|
48
|
+
max-width: 100%;
|
|
49
|
+
height: auto !important;
|
|
50
|
+
}
|
|
51
|
+
`;
|
|
52
|
+
const LoadingOverlay = styled.div `
|
|
53
|
+
position: absolute;
|
|
54
|
+
top: 0;
|
|
55
|
+
left: 0;
|
|
56
|
+
width: 100%;
|
|
57
|
+
height: 100%;
|
|
58
|
+
background-color: rgba(245, 245, 245, 0.95);
|
|
59
|
+
display: flex;
|
|
60
|
+
justify-content: center;
|
|
61
|
+
align-items: center;
|
|
62
|
+
z-index: 1000;
|
|
63
|
+
`;
|
|
64
|
+
const TMPdfViewer = (props) => {
|
|
65
|
+
const { pdfBlob, title = "Anteprima PDF", isResizingActive, enableFitToWidth = false } = props;
|
|
66
|
+
const [isMobile, setIsMobile] = useState(false);
|
|
67
|
+
const [totalPagesNumber, setTotalPagesNumber] = useState(0);
|
|
68
|
+
const [loadedPagesNumber, setLoadedPagesNumber] = useState(0);
|
|
69
|
+
const [visiblePages, setVisiblePages] = useState(new Set([1]));
|
|
70
|
+
const [pdfUrl, setPdfUrl] = useState("");
|
|
71
|
+
const observerRef = useRef(null);
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
const checkIsMobile = () => {
|
|
74
|
+
const userAgent = navigator.userAgent || navigator.vendor || window.opera;
|
|
75
|
+
// Detect actual mobile/tablet devices
|
|
76
|
+
const isMobileDevice =
|
|
77
|
+
// User agent detection (phones and tablets)
|
|
78
|
+
/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent) ||
|
|
79
|
+
// Media query for touch devices with coarse pointer (more reliable than screen width)
|
|
80
|
+
(window.matchMedia?.('(hover: none) and (pointer: coarse)').matches ?? false) ||
|
|
81
|
+
// Touch-capable devices excluding desktop OS
|
|
82
|
+
(navigator.maxTouchPoints > 1 && !/Win|Mac|Linux x86_64/i.test(userAgent));
|
|
83
|
+
setIsMobile(isMobileDevice);
|
|
84
|
+
};
|
|
85
|
+
checkIsMobile();
|
|
86
|
+
// Create URL for iframe
|
|
87
|
+
const url = URL.createObjectURL(pdfBlob);
|
|
88
|
+
setPdfUrl(url);
|
|
89
|
+
return () => {
|
|
90
|
+
if (url) {
|
|
91
|
+
URL.revokeObjectURL(url);
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
}, [pdfBlob]);
|
|
95
|
+
/**
|
|
96
|
+
* Callback per l'Intersection Observer che gestisce il lazy loading delle pagine PDF.
|
|
97
|
+
* Viene chiamato ogni volta che una pagina entra o esce dal viewport (area visibile).
|
|
98
|
+
*
|
|
99
|
+
* - Monitora quando gli elementi (pagine) diventano visibili
|
|
100
|
+
* - Aggiunge il numero di pagina al Set delle pagine visibili quando entra nel viewport
|
|
101
|
+
* - Il rootMargin di 500px carica le pagine prima che siano effettivamente visibili (preloading)
|
|
102
|
+
*/
|
|
103
|
+
const pageObserverCallback = useCallback((entries) => {
|
|
104
|
+
entries.forEach(entry => {
|
|
105
|
+
const pageNum = parseInt(entry.target.getAttribute('data-page-number') || '0');
|
|
106
|
+
if (entry.isIntersecting) {
|
|
107
|
+
// Aggiunge la pagina al Set di quelle da renderizzare
|
|
108
|
+
setVisiblePages(prev => new Set([...prev, pageNum]));
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
}, []);
|
|
112
|
+
/**
|
|
113
|
+
* Crea e configura l'Intersection Observer per il lazy loading.
|
|
114
|
+
*
|
|
115
|
+
* Configurazione:
|
|
116
|
+
* - root: null → osserva rispetto al viewport del browser
|
|
117
|
+
* - rootMargin: '500px' → inizia il caricamento 500px prima che la pagina sia visibile (buffer)
|
|
118
|
+
* - threshold: 0.01 → trigger quando anche solo l'1% dell'elemento è visibile
|
|
119
|
+
*
|
|
120
|
+
* Benefici:
|
|
121
|
+
* - Non blocca l'UI durante il rendering
|
|
122
|
+
* - Carica solo le pagine necessarie
|
|
123
|
+
* - Migliora le performance su PDF con molte pagine
|
|
124
|
+
*/
|
|
125
|
+
useEffect(() => {
|
|
126
|
+
observerRef.current = new IntersectionObserver(pageObserverCallback, {
|
|
127
|
+
root: null,
|
|
128
|
+
rootMargin: '500px',
|
|
129
|
+
threshold: 0.01
|
|
130
|
+
});
|
|
131
|
+
return () => {
|
|
132
|
+
// Cleanup: disconnette l'observer quando il componente viene smontato
|
|
133
|
+
observerRef.current?.disconnect();
|
|
134
|
+
};
|
|
135
|
+
}, [pageObserverCallback]);
|
|
136
|
+
// Use iframe se react-pdf non è disponibile O se è desktop
|
|
137
|
+
if (!isReactPdfAvailable || (!isMobile && pdfUrl)) {
|
|
138
|
+
return (_jsx(PDFViewerContainer, { children: _jsx("iframe", { src: `${pdfUrl}#${enableFitToWidth ? 'view=FitH&' : ''}scrollbar=1`, title: title, style: {
|
|
139
|
+
width: '100%',
|
|
140
|
+
height: '100%',
|
|
141
|
+
border: 'none',
|
|
142
|
+
zIndex: 0,
|
|
143
|
+
pointerEvents: isResizingActive === true ? "none" : "auto"
|
|
144
|
+
} }, pdfUrl) }));
|
|
145
|
+
}
|
|
146
|
+
// Usa react-pdf solo per mobile e solo se disponibile
|
|
147
|
+
return _jsxs(PDFViewerContainer, { children: [loadedPagesNumber === 0 && totalPagesNumber > 0 && _jsx(LoadingOverlay, { children: _jsxs("div", { style: {
|
|
148
|
+
display: 'flex',
|
|
149
|
+
justifyContent: 'center',
|
|
150
|
+
alignItems: 'center',
|
|
151
|
+
flexDirection: 'column',
|
|
152
|
+
gap: '10px'
|
|
153
|
+
}, children: [_jsx(LoadIndicator, { height: 60, width: 60 }), _jsxs("div", { children: [SDKUI_Localizator.Loading, "..."] })] }) }), _jsx("div", { style: { display: loadedPagesNumber > 0 && totalPagesNumber > 0 ? 'block' : 'none' }, children: _jsx(Document, { file: pdfBlob, onLoadSuccess: ({ numPages }) => {
|
|
154
|
+
setTotalPagesNumber(numPages);
|
|
155
|
+
setLoadedPagesNumber(0);
|
|
156
|
+
}, loading: _jsxs("div", { style: {
|
|
157
|
+
display: 'flex',
|
|
158
|
+
justifyContent: 'center',
|
|
159
|
+
alignItems: 'center',
|
|
160
|
+
height: '100%',
|
|
161
|
+
flexDirection: 'column',
|
|
162
|
+
gap: '10px'
|
|
163
|
+
}, children: [_jsx(LoadIndicator, { height: 60, width: 60 }), _jsxs("div", { children: [SDKUI_Localizator.Loading, "..."] })] }), error: _jsxs("div", { style: {
|
|
164
|
+
display: 'flex',
|
|
165
|
+
justifyContent: 'center',
|
|
166
|
+
alignItems: 'center',
|
|
167
|
+
height: '100%',
|
|
168
|
+
flexDirection: 'column',
|
|
169
|
+
gap: '10px'
|
|
170
|
+
}, children: [_jsx(IconCloseOutline, { fontSize: 64, color: TMColors.error }), _jsx("div", { children: "Errore nel caricamento del PDF" })] }), children: Array.from(new Array(totalPagesNumber), (el, index) => {
|
|
171
|
+
const pageNumber = index + 1;
|
|
172
|
+
const shouldRender = visiblePages.has(pageNumber);
|
|
173
|
+
return (_jsx("div", { "data-page-number": pageNumber, ref: (el) => {
|
|
174
|
+
if (el && observerRef.current) {
|
|
175
|
+
observerRef.current.observe(el);
|
|
176
|
+
}
|
|
177
|
+
}, style: {
|
|
178
|
+
minHeight: shouldRender ? 'auto' : '1000px',
|
|
179
|
+
display: 'flex',
|
|
180
|
+
justifyContent: 'center',
|
|
181
|
+
alignItems: 'center'
|
|
182
|
+
}, 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: () => {
|
|
183
|
+
setLoadedPagesNumber(prev => prev + 1);
|
|
184
|
+
} })) }, `page_${pageNumber}`));
|
|
185
|
+
}) }) })] });
|
|
186
|
+
};
|
|
187
|
+
export default TMPdfViewer;
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { DcmtTypeDescriptor, FileDescriptor, UserDescriptor } from "@topconsultnpm/sdk-ts";
|
|
2
|
+
import { AccessLevels, DcmtTypeDescriptor, FileDescriptor, UserDescriptor } from "@topconsultnpm/sdk-ts";
|
|
3
3
|
import { DcmtInfo, DownloadModes, DownloadTypes } from "../ts/types";
|
|
4
4
|
import { FileItem } from "../components";
|
|
5
5
|
/**
|
|
6
6
|
* Check-in/Check-out Manager
|
|
7
7
|
* Questo modulo gestisce tutte le operazioni di check-in e check-out
|
|
8
8
|
* dei documenti e delle bozze dei gruppi di lavoro.
|
|
9
|
+
*
|
|
10
|
+
* Operazioni gestite:
|
|
11
|
+
* - Generazione nomi file per download e checkout con timestamp e identificatori univoci
|
|
12
|
+
* - Download di documenti in modalità checkout
|
|
13
|
+
* - Gestione dello storage locale delle informazioni di checkout (aggiunta, aggiornamento, rimozione)
|
|
14
|
+
* - Validazione dei nomi file secondo le convenzioni di naming CICO
|
|
15
|
+
* - Rendering dell'interfaccia utente per conferma check-in con visualizzazione anomalie
|
|
16
|
+
* - Determinazione dello stato di check-out dei documenti (editMode/lockMode)
|
|
17
|
+
* - Verifica permessi e abilitazione funzionalità CICO per tipo documento
|
|
9
18
|
*/
|
|
10
19
|
export interface CheckoutInfo {
|
|
11
20
|
DID: string;
|
|
@@ -18,6 +27,7 @@ interface CheckoutStatusResult {
|
|
|
18
27
|
mode: 'editMode' | 'lockMode' | '';
|
|
19
28
|
version: number;
|
|
20
29
|
icon: React.ReactNode | null;
|
|
30
|
+
editLockTooltipText: React.ReactNode | null;
|
|
21
31
|
}
|
|
22
32
|
export type DownloadSource = {
|
|
23
33
|
type: 'fileItem';
|
|
@@ -29,7 +39,7 @@ export type DownloadSource = {
|
|
|
29
39
|
};
|
|
30
40
|
export declare const getCicoDownloadFileName: (source: DownloadSource, checkout: boolean, withTimestampAndExt: boolean) => string;
|
|
31
41
|
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>;
|
|
32
|
-
export declare const
|
|
42
|
+
export declare const updateCicoCheckoutStorageItem: (item: CheckoutInfo, type: "fileItem" | "dcmtInfo", action?: "addOrUpdate" | "remove") => void;
|
|
33
43
|
export declare const validateCicoFileName: (source: DownloadSource, fileName: string) => FileNameValidation;
|
|
34
44
|
type ValidationResult = {
|
|
35
45
|
expected: string | number | undefined;
|
|
@@ -48,6 +58,26 @@ type FileNameValidation = {
|
|
|
48
58
|
validationResults?: FileNameValidationItems;
|
|
49
59
|
};
|
|
50
60
|
export declare const renderCicoCheckInContent: (source: DownloadSource, selectedFilename: File, isValid: boolean, validationItems: FileNameValidationItems | undefined, color?: string) => React.ReactNode;
|
|
61
|
+
interface CheckInCheckOutDcmtInfo {
|
|
62
|
+
CICO: number;
|
|
63
|
+
CanCICO: AccessLevels;
|
|
64
|
+
CanDelChronology: AccessLevels;
|
|
65
|
+
UserID_MID: number;
|
|
66
|
+
Date_MID: number;
|
|
67
|
+
Ver_MID: number;
|
|
68
|
+
UserID_CanViewOrUpdate: AccessLevels;
|
|
69
|
+
Date_CanViewOrUpdate: AccessLevels;
|
|
70
|
+
Ver_CanViewOrUpdate: AccessLevels;
|
|
71
|
+
}
|
|
72
|
+
export declare const getDcmtCicoInfo: (dtd: DcmtTypeDescriptor | undefined) => CheckInCheckOutDcmtInfo;
|
|
73
|
+
/**
|
|
74
|
+
* Determina lo stato di check-in/check-out di un documento
|
|
75
|
+
*
|
|
76
|
+
* @param dcmt - Il documento in formato array (MetadataValueDescriptorEx[]) o oggetto piatto
|
|
77
|
+
* @param allUsers - Lista di tutti gli utenti per risolvere i nomi
|
|
78
|
+
* @param dtd - Descrittore del tipo documento contenente le definizioni dei metadati CICO
|
|
79
|
+
* @returns Oggetto con cicoEnabled (se CICO è abilitato) e checkoutStatus (dettagli dello stato)
|
|
80
|
+
*/
|
|
51
81
|
export declare const getDcmtCicoStatus: (dcmt: any, allUsers: Array<UserDescriptor>, dtd: DcmtTypeDescriptor | undefined) => {
|
|
52
82
|
cicoEnabled: boolean;
|
|
53
83
|
checkoutStatus: CheckoutStatusResult;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
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";
|
|
2
|
+
import { AccessLevels, CICO_MetadataNames, SDK_Globals, SystemMIDsAsNumber } from "@topconsultnpm/sdk-ts";
|
|
3
3
|
import TMTooltip from "../components/base/TMTooltip";
|
|
4
4
|
import { Globalization, SDKUI_Globals, SDKUI_Localizator } from "./index";
|
|
5
5
|
import { DownloadTypes } from "../ts/types";
|
|
@@ -64,13 +64,8 @@ export const cicoDownloadFilesCallback = async (sources, checkout, downloadDcmts
|
|
|
64
64
|
if (tid && did && ext) {
|
|
65
65
|
let fileName = getCicoDownloadFileName(source, checkout, true);
|
|
66
66
|
if (checkout) {
|
|
67
|
-
const newItem = {
|
|
68
|
-
|
|
69
|
-
DID: did.toString(),
|
|
70
|
-
checkoutFolder: "",
|
|
71
|
-
checkoutName: fileName
|
|
72
|
-
};
|
|
73
|
-
updateCheckoutItem(newItem, source.type, "addOrUpdate");
|
|
67
|
+
const newItem = { TID: tid.toString(), DID: did.toString(), checkoutFolder: "", checkoutName: fileName };
|
|
68
|
+
updateCicoCheckoutStorageItem(newItem, source.type, "addOrUpdate");
|
|
74
69
|
}
|
|
75
70
|
files.push({ TID: tid, DID: did, FILEEXT: ext, fileName });
|
|
76
71
|
}
|
|
@@ -78,7 +73,7 @@ export const cicoDownloadFilesCallback = async (sources, checkout, downloadDcmts
|
|
|
78
73
|
if (files.length > 0)
|
|
79
74
|
await downloadDcmtsAsync(files, DownloadTypes.Dcmt, "download");
|
|
80
75
|
};
|
|
81
|
-
export const
|
|
76
|
+
export const updateCicoCheckoutStorageItem = (item, type, action = "addOrUpdate") => {
|
|
82
77
|
// Select the appropriate array based on type
|
|
83
78
|
const currentItems = type === 'dcmtInfo' ? [...SDKUI_Globals.userSettings.dcmtCheckoutInfo] : [...SDKUI_Globals.userSettings.wgDraftCheckoutInfo];
|
|
84
79
|
// Find the index of an existing item that has the same TID and DID as the new item
|
|
@@ -196,7 +191,7 @@ export const renderCicoCheckInContent = (source, selectedFilename, isValid, vali
|
|
|
196
191
|
const fileName = source.type === 'fileItem' ? source.fileItem.name : (source.dcmtInfo.fileName ?? SDKUI_Localizator.SearchResult);
|
|
197
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 })] })] });
|
|
198
193
|
};
|
|
199
|
-
const getDcmtCicoInfo = (dtd) => {
|
|
194
|
+
export const getDcmtCicoInfo = (dtd) => {
|
|
200
195
|
const cico = {
|
|
201
196
|
CICO: 0,
|
|
202
197
|
CanCICO: AccessLevels.No,
|
|
@@ -215,57 +210,139 @@ const getDcmtCicoInfo = (dtd) => {
|
|
|
215
210
|
cico.CanDelChronology = dtd.perm?.canDelChron ?? AccessLevels.No;
|
|
216
211
|
const mdCheckout = dtd.metadata?.find(md => md.name === CICO_MetadataNames.CICO_CheckoutUserID);
|
|
217
212
|
if (mdCheckout) {
|
|
218
|
-
cico.UserID_MID = mdCheckout.
|
|
213
|
+
cico.UserID_MID = mdCheckout.id;
|
|
219
214
|
cico.UserID_CanViewOrUpdate = (mdCheckout.perm?.canView == AccessLevels.Yes || mdCheckout.perm?.canUpdate == AccessLevels.Yes) ? AccessLevels.Yes : AccessLevels.No;
|
|
220
215
|
}
|
|
221
216
|
const mdDate = dtd.metadata?.find(md => md.name === CICO_MetadataNames.CICO_CheckoutDate);
|
|
222
217
|
if (mdDate) {
|
|
223
|
-
cico.Date_MID = mdDate.
|
|
218
|
+
cico.Date_MID = mdDate.id;
|
|
224
219
|
cico.Date_CanViewOrUpdate = (mdDate.perm?.canView == AccessLevels.Yes || mdDate.perm?.canUpdate == AccessLevels.Yes) ? AccessLevels.Yes : AccessLevels.No;
|
|
225
220
|
}
|
|
226
221
|
const mdVer = dtd.metadata?.find(md => md.name === CICO_MetadataNames.CICO_Version);
|
|
227
222
|
if (mdVer) {
|
|
228
|
-
cico.Ver_MID = mdVer.
|
|
223
|
+
cico.Ver_MID = mdVer.id;
|
|
229
224
|
cico.Ver_CanViewOrUpdate = (mdVer.perm?.canView == AccessLevels.Yes || mdVer.perm?.canUpdate == AccessLevels.Yes) ? AccessLevels.Yes : AccessLevels.No;
|
|
230
225
|
}
|
|
231
226
|
return cico;
|
|
232
227
|
};
|
|
228
|
+
/**
|
|
229
|
+
* Determina lo stato di check-in/check-out di un documento
|
|
230
|
+
*
|
|
231
|
+
* @param dcmt - Il documento in formato array (MetadataValueDescriptorEx[]) o oggetto piatto
|
|
232
|
+
* @param allUsers - Lista di tutti gli utenti per risolvere i nomi
|
|
233
|
+
* @param dtd - Descrittore del tipo documento contenente le definizioni dei metadati CICO
|
|
234
|
+
* @returns Oggetto con cicoEnabled (se CICO è abilitato) e checkoutStatus (dettagli dello stato)
|
|
235
|
+
*/
|
|
233
236
|
export const getDcmtCicoStatus = (dcmt, allUsers, dtd) => {
|
|
237
|
+
// ========================================================================
|
|
238
|
+
// VALIDAZIONE PARAMETRI
|
|
239
|
+
// ========================================================================
|
|
240
|
+
// Se i parametri essenziali non sono forniti, ritorna stato di default
|
|
234
241
|
if (dcmt === undefined || dtd === undefined) {
|
|
235
242
|
return {
|
|
236
243
|
cicoEnabled: false,
|
|
237
|
-
checkoutStatus: { isCheckedOut: false, mode: '', version: 1, icon: null }
|
|
244
|
+
checkoutStatus: { isCheckedOut: false, mode: '', version: 1, icon: null, editLockTooltipText: null }
|
|
238
245
|
};
|
|
239
246
|
}
|
|
247
|
+
// ========================================================================
|
|
248
|
+
// ESTRAZIONE INFORMAZIONI CICO DAL DTD
|
|
249
|
+
// ========================================================================
|
|
250
|
+
// Recupera le configurazioni e permessi CICO dal tipo documento
|
|
240
251
|
const cicoInfo = getDcmtCicoInfo(dtd);
|
|
241
|
-
const CICO_CheckoutUserID_Meta = dtd?.metadata?.find(md => md.name === CICO_MetadataNames.CICO_CheckoutUserID);
|
|
242
|
-
const CICO_CheckoutDate_Meta = dtd?.metadata?.find(md => md.name === CICO_MetadataNames.CICO_CheckoutDate);
|
|
243
|
-
const CICO_Version_Meta = dtd?.metadata?.find(md => md.name === CICO_MetadataNames.CICO_Version);
|
|
244
|
-
const keyVersion = dcmt.TID + "_" + (CICO_Version_Meta?.id ?? 0);
|
|
245
|
-
const versionRaw = CICO_Version_Meta?.id ? dcmt[keyVersion] : undefined;
|
|
246
|
-
const version = (versionRaw != null && !isNaN(Number(versionRaw))) ? Number(versionRaw) : 1;
|
|
247
|
-
let checkoutStatus = { isCheckedOut: false, mode: '', version: version, icon: null, };
|
|
248
252
|
const userID = SDK_Globals.tmSession?.SessionDescr?.userID;
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
253
|
+
// Variabili comuni per entrambi i formati di documento
|
|
254
|
+
let checkoutUserId;
|
|
255
|
+
let checkoutDate;
|
|
256
|
+
let version = 1;
|
|
257
|
+
let fileExt;
|
|
258
|
+
// ========================================================================
|
|
259
|
+
// CASO 1: Documento come Array di MetadataValueDescriptorEx
|
|
260
|
+
// ========================================================================
|
|
261
|
+
// Questo formato viene utilizzato quando il documento proviene da query
|
|
262
|
+
// o liste dove ogni metadato è un oggetto separato con proprietà 'md' e 'value'
|
|
263
|
+
if (Array.isArray(dcmt) && dcmt.length > 0 && dcmt[0]?.md !== undefined) {
|
|
264
|
+
const dcmtsArray = dcmt;
|
|
265
|
+
// Estrai l'ID dell'utente che ha effettuato il checkout
|
|
266
|
+
const checkoutUserIdProperty = dcmtsArray.find((item) => item.md?.name === CICO_MetadataNames.CICO_CheckoutUserID);
|
|
267
|
+
const checkoutUserIdValue = checkoutUserIdProperty?.value;
|
|
268
|
+
checkoutUserId = checkoutUserIdValue ? Number(checkoutUserIdValue) : undefined;
|
|
269
|
+
// Estrai la data di checkout
|
|
270
|
+
const checkoutDateProperty = dcmtsArray.find((item) => item.md?.name === CICO_MetadataNames.CICO_CheckoutDate);
|
|
271
|
+
checkoutDate = checkoutDateProperty?.value;
|
|
272
|
+
// Estrai la versione del documento
|
|
273
|
+
const versionProperty = dcmtsArray.find((item) => item.md?.name === CICO_MetadataNames.CICO_Version);
|
|
274
|
+
const versionRaw = versionProperty?.value;
|
|
275
|
+
version = (versionRaw != null && !isNaN(Number(versionRaw))) ? Number(versionRaw) : 1;
|
|
276
|
+
const fileExtProperty = dcmtsArray.find((item) => item.mid === SystemMIDsAsNumber.FileExt);
|
|
277
|
+
fileExt = fileExtProperty?.value ? fileExtProperty.value.toString() : null;
|
|
278
|
+
}
|
|
279
|
+
// ========================================================================
|
|
280
|
+
// CASO 2: Documento come Oggetto Piatto (formato standard)
|
|
281
|
+
// ========================================================================
|
|
282
|
+
// Questo formato viene utilizzato quando il documento ha proprietà dirette
|
|
283
|
+
// nel formato chiave-valore: TID, DID, e "TID_MetadataID" per i metadati
|
|
284
|
+
else {
|
|
285
|
+
// Trova i metadati CICO nel descrittore del tipo documento
|
|
286
|
+
const CICO_CheckoutUserID_Meta = dtd.metadata?.find(md => md.name === CICO_MetadataNames.CICO_CheckoutUserID);
|
|
287
|
+
const CICO_CheckoutDate_Meta = dtd.metadata?.find(md => md.name === CICO_MetadataNames.CICO_CheckoutDate);
|
|
288
|
+
const CICO_Version_Meta = dtd.metadata?.find(md => md.name === CICO_MetadataNames.CICO_Version);
|
|
289
|
+
fileExt = dcmt.FILEEXT ? dcmt.FILEEXT.toString() : null;
|
|
290
|
+
// Estrai l'ID dell'utente che ha effettuato il checkout
|
|
291
|
+
if (CICO_CheckoutUserID_Meta?.id) {
|
|
292
|
+
const keyUserID = dcmt.TID + "_" + CICO_CheckoutUserID_Meta.id;
|
|
293
|
+
const checkoutUserIdValue = dcmt[keyUserID];
|
|
294
|
+
checkoutUserId = checkoutUserIdValue ? Number(checkoutUserIdValue) : undefined;
|
|
295
|
+
}
|
|
296
|
+
// Estrai la data di checkout
|
|
297
|
+
if (CICO_CheckoutDate_Meta?.id) {
|
|
298
|
+
const keyDate = dcmt.TID + "_" + CICO_CheckoutDate_Meta.id;
|
|
299
|
+
checkoutDate = dcmt[keyDate];
|
|
300
|
+
}
|
|
301
|
+
// Estrai la versione del documento
|
|
302
|
+
if (CICO_Version_Meta?.id) {
|
|
303
|
+
const keyVersion = dcmt.TID + "_" + CICO_Version_Meta.id;
|
|
304
|
+
const versionRaw = dcmt[keyVersion];
|
|
305
|
+
version = (versionRaw != null && !isNaN(Number(versionRaw))) ? Number(versionRaw) : 1;
|
|
265
306
|
}
|
|
266
307
|
}
|
|
308
|
+
// ========================================================================
|
|
309
|
+
// COSTRUZIONE DELLO STATO DI CHECKOUT
|
|
310
|
+
// ========================================================================
|
|
311
|
+
let checkoutStatus = {
|
|
312
|
+
isCheckedOut: false,
|
|
313
|
+
mode: '',
|
|
314
|
+
version: version,
|
|
315
|
+
icon: null,
|
|
316
|
+
editLockTooltipText: null
|
|
317
|
+
};
|
|
318
|
+
// Verifica se il documento è effettivamente in stato di checkout
|
|
319
|
+
if (userID && checkoutUserId && !isNaN(checkoutUserId) && checkoutUserId > 0) {
|
|
320
|
+
// Determina la modalità in base all'utente:
|
|
321
|
+
// - editMode: l'utente corrente può modificare (è lui che ha fatto il checkout)
|
|
322
|
+
// - lockMode: il documento è bloccato da un altro utente
|
|
323
|
+
const mode = (userID === checkoutUserId) ? 'editMode' : 'lockMode';
|
|
324
|
+
// ====================================================================
|
|
325
|
+
// COSTRUZIONE DEL TOOLTIP INFORMATIVO
|
|
326
|
+
// ====================================================================
|
|
327
|
+
const editLockTooltipText = (_jsxs(_Fragment, { children: [_jsxs("div", { style: { textAlign: "center" }, children: [mode === 'editMode' && (_jsxs(_Fragment, { children: [_jsx("i", { style: { fontSize: "18px", color: colors.MEDIUM_GREEN, fontWeight: "bold" }, className: "dx-icon-edit" }), SDKUI_Localizator.CurrentUserExtract] })), mode === 'lockMode' && (_jsxs(_Fragment, { children: [_jsx("i", { style: { fontSize: "18px", color: colors.MEDIUM_GREEN, fontWeight: "bold" }, className: "dx-icon-lock" }), SDKUI_Localizator.ExtractedFromOtherUser] }))] }), _jsx("hr", {}), _jsxs("div", { style: { textAlign: "left" }, children: [_jsxs("ul", { children: [_jsxs("li", { children: ["- ", _jsx("span", { style: { fontWeight: 'bold' }, children: SDKUI_Localizator.ExtractedBy }), ": ", findCheckOutUserName(allUsers, checkoutUserId), " (ID: ", checkoutUserId, ")"] }), _jsxs("li", { children: ["- ", _jsx("span", { style: { fontWeight: 'bold' }, children: SDKUI_Localizator.ExtractedOn }), ": ", Globalization.getDateTimeDisplayValue(checkoutDate?.toString())] })] }), _jsx("hr", {}), _jsx("ul", { children: _jsxs("li", { children: ["- ", _jsx("span", { style: { fontWeight: 'bold' }, children: SDKUI_Localizator.Version }), ": ", version] }) })] })] }));
|
|
328
|
+
// Crea l'icona con tooltip appropriata alla modalità
|
|
329
|
+
const icon = mode === 'editMode'
|
|
330
|
+
? _jsx(TMTooltip, { content: editLockTooltipText, children: _jsx("i", { style: { fontSize: "18px", color: colors.MEDIUM_GREEN, fontWeight: "bold" }, className: "dx-icon-edit" }) })
|
|
331
|
+
: _jsx(TMTooltip, { content: editLockTooltipText, children: _jsx("i", { style: { fontSize: "18px", color: colors.MEDIUM_GREEN, fontWeight: "bold" }, className: "dx-icon-lock" }) });
|
|
332
|
+
checkoutStatus = {
|
|
333
|
+
isCheckedOut: true,
|
|
334
|
+
mode: mode,
|
|
335
|
+
icon: icon,
|
|
336
|
+
version: version,
|
|
337
|
+
editLockTooltipText: editLockTooltipText
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
// ========================================================================
|
|
341
|
+
// RESTITUZIONE RISULTATO FINALE
|
|
342
|
+
// ========================================================================
|
|
267
343
|
return {
|
|
268
|
-
|
|
344
|
+
// CICO è abilitato se configurato nel DTD e l'utente ha i permessi
|
|
345
|
+
cicoEnabled: cicoInfo.CICO === 1 && cicoInfo.CanCICO === AccessLevels.Yes && fileExt !== null && fileExt !== '',
|
|
269
346
|
checkoutStatus: checkoutStatus
|
|
270
347
|
};
|
|
271
348
|
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom DevExtreme localization messages
|
|
3
|
+
* Contains missing translations for DevExtreme components
|
|
4
|
+
*/
|
|
5
|
+
export declare const devextremeCustomMessages: {
|
|
6
|
+
de: {
|
|
7
|
+
"dxDataGrid-moveColumnToTheRight": string;
|
|
8
|
+
"dxDataGrid-moveColumnToTheLeft": string;
|
|
9
|
+
};
|
|
10
|
+
en: {
|
|
11
|
+
"dxDataGrid-moveColumnToTheRight": string;
|
|
12
|
+
"dxDataGrid-moveColumnToTheLeft": string;
|
|
13
|
+
};
|
|
14
|
+
es: {
|
|
15
|
+
"dxDataGrid-moveColumnToTheRight": string;
|
|
16
|
+
"dxDataGrid-moveColumnToTheLeft": string;
|
|
17
|
+
};
|
|
18
|
+
fr: {
|
|
19
|
+
"dxDataGrid-moveColumnToTheRight": string;
|
|
20
|
+
"dxDataGrid-moveColumnToTheLeft": string;
|
|
21
|
+
};
|
|
22
|
+
it: {
|
|
23
|
+
"dxDataGrid-moveColumnToTheRight": string;
|
|
24
|
+
"dxDataGrid-moveColumnToTheLeft": string;
|
|
25
|
+
};
|
|
26
|
+
pt: {
|
|
27
|
+
"dxDataGrid-moveColumnToTheRight": string;
|
|
28
|
+
"dxDataGrid-moveColumnToTheLeft": string;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom DevExtreme localization messages
|
|
3
|
+
* Contains missing translations for DevExtreme components
|
|
4
|
+
*/
|
|
5
|
+
export const devextremeCustomMessages = {
|
|
6
|
+
"de": {
|
|
7
|
+
"dxDataGrid-moveColumnToTheRight": "Nach rechts verschieben",
|
|
8
|
+
"dxDataGrid-moveColumnToTheLeft": "Nach links verschieben"
|
|
9
|
+
},
|
|
10
|
+
"en": {
|
|
11
|
+
"dxDataGrid-moveColumnToTheRight": "Move to the right",
|
|
12
|
+
"dxDataGrid-moveColumnToTheLeft": "Move to the left"
|
|
13
|
+
},
|
|
14
|
+
"es": {
|
|
15
|
+
"dxDataGrid-moveColumnToTheRight": "Mover a la derecha",
|
|
16
|
+
"dxDataGrid-moveColumnToTheLeft": "Mover a la izquierda"
|
|
17
|
+
},
|
|
18
|
+
"fr": {
|
|
19
|
+
"dxDataGrid-moveColumnToTheRight": "Déplacer vers la droite",
|
|
20
|
+
"dxDataGrid-moveColumnToTheLeft": "Déplacer vers la gauche"
|
|
21
|
+
},
|
|
22
|
+
"it": {
|
|
23
|
+
"dxDataGrid-moveColumnToTheRight": "Sposta a destra",
|
|
24
|
+
"dxDataGrid-moveColumnToTheLeft": "Sposta a sinistra"
|
|
25
|
+
},
|
|
26
|
+
"pt": {
|
|
27
|
+
"dxDataGrid-moveColumnToTheRight": "Mover para a direita",
|
|
28
|
+
"dxDataGrid-moveColumnToTheLeft": "Mover para a esquerda"
|
|
29
|
+
}
|
|
30
|
+
};
|
package/lib/helper/helpers.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Colors as ColorsType } from "../components/base/TMEditorBase";
|
|
2
2
|
import { DeviceType } from "../components";
|
|
3
|
-
import { AppModules, DataColumnDescriptor, ITopMediaSession, MetadataDescriptor, QueryDescriptor, SearchResultDescriptor } from "@topconsultnpm/sdk-ts";
|
|
3
|
+
import { AppModules, DataColumnDescriptor, DcmtTypeDescriptor, ITopMediaSession, MetadataDescriptor, QueryDescriptor, SearchResultDescriptor } from "@topconsultnpm/sdk-ts";
|
|
4
4
|
import { FileExtensionHandler, FormModes, moduleTypes } from "../ts";
|
|
5
5
|
declare const TABLET_WIDTH = 1024;
|
|
6
6
|
declare const MOBILE_WIDTH = 640;
|
|
@@ -89,3 +89,4 @@ export declare class AreaHelper {
|
|
|
89
89
|
static ExtractAreaInfo_1(areaPath: string): AreaValues;
|
|
90
90
|
static ExtractAreaInfo_2(areaPath: string, extractFileName: boolean): AreaValues;
|
|
91
91
|
}
|
|
92
|
+
export declare const isApprovalWorkflowView: (dtd: DcmtTypeDescriptor) => boolean;
|
package/lib/helper/helpers.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Colors } from "../utils/theme";
|
|
3
3
|
import { ButtonNames, DeviceType, TMExceptionBoxManager, TMMessageBoxManager, TMSpinner } from "../components";
|
|
4
|
-
import { AccessLevels, MetadataDataDomains, MetadataDataTypes, MetadataDescriptor, MetadataFormatDescriptor, MetadataFormats, MetadataPermission, SDK_Globals, SetGlobalsInfoAsync, SystemMIDs, SystemMIDsAsNumber, TopMediaServer } from "@topconsultnpm/sdk-ts";
|
|
4
|
+
import { AccessLevels, MetadataDataDomains, MetadataDataTypes, MetadataDescriptor, MetadataFormatDescriptor, MetadataFormats, MetadataPermission, SDK_Globals, SetGlobalsInfoAsync, SystemMIDs, SystemMIDsAsNumber, TopMediaServer, WorkItemMetadataNames } from "@topconsultnpm/sdk-ts";
|
|
5
5
|
import { Buffer } from 'buffer';
|
|
6
6
|
import { buildTypes, FileExtensionHandler, FormModes, moduleTypes } from "../ts";
|
|
7
7
|
import { SDKUI_Localizator } from "./SDKUI_Localizator";
|
|
@@ -664,7 +664,13 @@ export const renderHighlightedText = (text, searchText, isSelected) => {
|
|
|
664
664
|
return text.split(regex).map((part, index) => regex.test(part) ? (_jsx("span", { style: { backgroundColor: isSelected ? '#6c9023' : 'yellow' }, children: part }, index)) : (part));
|
|
665
665
|
};
|
|
666
666
|
export function versionAndBuildtypeInfo(module) {
|
|
667
|
-
|
|
667
|
+
switch (module) {
|
|
668
|
+
case moduleTypes.SDK:
|
|
669
|
+
case moduleTypes.SDKUI:
|
|
670
|
+
return moduleVersion(module).replace("-hotfix", "+hotfix");
|
|
671
|
+
default:
|
|
672
|
+
return moduleVersion(module);
|
|
673
|
+
}
|
|
668
674
|
}
|
|
669
675
|
export const getListMaxItems = (deviceType) => { return deviceType === DeviceType.MOBILE ? 8 : 12; };
|
|
670
676
|
export const svgToString = (icon) => {
|
|
@@ -850,3 +856,7 @@ export class AreaHelper {
|
|
|
850
856
|
}
|
|
851
857
|
AreaHelper.AreaPathPrefix = "tmarea:\\\\";
|
|
852
858
|
AreaHelper.AreaFolderNamePrefix = "AID_";
|
|
859
|
+
export const isApprovalWorkflowView = (dtd) => {
|
|
860
|
+
return Boolean(dtd?.isView &&
|
|
861
|
+
dtd.metadata?.some(data => data.name === WorkItemMetadataNames.WI_DID));
|
|
862
|
+
};
|
package/lib/helper/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export * from './queryHelper';
|
|
|
9
9
|
export * from './TMUtils';
|
|
10
10
|
export * from './TMCommandsContextMenu';
|
|
11
11
|
export * from './TMConditionalWrapper';
|
|
12
|
+
export * from './TMPdfViewer';
|
|
12
13
|
export * from './TMToppyMessage';
|
|
13
14
|
export * from './GlobalStyles';
|
|
14
15
|
export * from './checkinCheckoutManager';
|
package/lib/helper/index.js
CHANGED
|
@@ -9,6 +9,7 @@ export * from './queryHelper';
|
|
|
9
9
|
export * from './TMUtils';
|
|
10
10
|
export * from './TMCommandsContextMenu';
|
|
11
11
|
export * from './TMConditionalWrapper';
|
|
12
|
+
export * from './TMPdfViewer';
|
|
12
13
|
export * from './TMToppyMessage';
|
|
13
14
|
export * from './GlobalStyles';
|
|
14
15
|
export * from './checkinCheckoutManager';
|
|
@@ -2,6 +2,7 @@ import { AccessLevels, MetadataDataDomains, DcmtTypeListCacheService, SystemMIDs
|
|
|
2
2
|
import { DateDisplayTypes, Globalization } from './Globalization';
|
|
3
3
|
import { ChronologyMIDs, DraftsMIDs, MetadataValueDescriptorEx } from '../ts';
|
|
4
4
|
import { SDKUI_Localizator } from './SDKUI_Localizator';
|
|
5
|
+
import { getDcmtCicoInfo } from './checkinCheckoutManager';
|
|
5
6
|
export const getTIDsByQd = (qd) => {
|
|
6
7
|
let tids = [];
|
|
7
8
|
qd?.from?.tid && tids.push({ tid: qd.from?.tid, alias: undefined });
|
|
@@ -82,6 +83,22 @@ export const prepareQdForSearchAsync = async (qdInput, removeWhereItemNoValue) =
|
|
|
82
83
|
addHiddenSelectItem(qd.select, fromTID, SystemMIDsAsNumber.IsMail);
|
|
83
84
|
addHiddenSelectItem(qd.select, fromTID, SystemMIDsAsNumber.IsSigned);
|
|
84
85
|
addHiddenSelectItem(qd.select, fromTID, SystemMIDsAsNumber.IsShared);
|
|
86
|
+
const dtd = await DcmtTypeListCacheService.GetAsync(fromTID);
|
|
87
|
+
if (dtd) {
|
|
88
|
+
const cicoInfo = getDcmtCicoInfo(dtd);
|
|
89
|
+
const canCICO = cicoInfo.CICO === 1 && cicoInfo.CanCICO === AccessLevels.Yes;
|
|
90
|
+
if (canCICO) {
|
|
91
|
+
if (!qd.select.find(o => o.mid == cicoInfo.UserID_MID) && cicoInfo.UserID_CanViewOrUpdate == AccessLevels.Yes) {
|
|
92
|
+
addHiddenSelectItem(qd.select, fromTID, cicoInfo.UserID_MID);
|
|
93
|
+
}
|
|
94
|
+
if (!qd.select.find(o => o.mid == cicoInfo.Date_MID) && cicoInfo.Date_CanViewOrUpdate == AccessLevels.Yes) {
|
|
95
|
+
addHiddenSelectItem(qd.select, fromTID, cicoInfo.Date_MID);
|
|
96
|
+
}
|
|
97
|
+
if (!qd.select.find(o => o.mid == cicoInfo.Ver_MID) && cicoInfo.Ver_CanViewOrUpdate == AccessLevels.Yes) {
|
|
98
|
+
addHiddenSelectItem(qd.select, fromTID, cicoInfo.Ver_MID);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
85
102
|
if (qd.orderBy && qd.orderBy.length <= 0) {
|
|
86
103
|
let obi = new OrderByItem();
|
|
87
104
|
obi.tid = fromTID;
|
|
@@ -311,6 +328,18 @@ export const searchResultToMetadataValues = (tid, dtd, rows, mids, metadata, lay
|
|
|
311
328
|
mvd.customName = SDKUI_Localizator.Author;
|
|
312
329
|
mvd.isReadOnly = true;
|
|
313
330
|
break;
|
|
331
|
+
case ChronologyMIDs.CheckInTime:
|
|
332
|
+
mvd.customName = SDKUI_Localizator.LastUpdateTime;
|
|
333
|
+
mvd.isReadOnly = true;
|
|
334
|
+
break;
|
|
335
|
+
case SystemMIDsAsNumber.FileExt:
|
|
336
|
+
mvd.customName = SDKUI_Localizator.Extension;
|
|
337
|
+
mvd.isReadOnly = true;
|
|
338
|
+
break;
|
|
339
|
+
case SystemMIDsAsNumber.FileSize:
|
|
340
|
+
mvd.customName = SDKUI_Localizator.File_Size;
|
|
341
|
+
mvd.isReadOnly = true;
|
|
342
|
+
break;
|
|
314
343
|
}
|
|
315
344
|
}
|
|
316
345
|
return mvd;
|