@topconsultnpm/sdkui-react 6.20.0-dev1.18 → 6.20.0-dev1.19
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 +187 -0
- package/lib/components/NewComponents/ContextMenu/hooks.d.ts +12 -0
- package/lib/components/NewComponents/ContextMenu/hooks.js +52 -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 +30 -0
- package/lib/components/NewComponents/ContextMenu/styles.js +337 -0
- package/lib/components/NewComponents/ContextMenu/types.d.ts +26 -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 +370 -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 +38 -0
- package/lib/components/NewComponents/FloatingMenuBar/styles.js +266 -0
- package/lib/components/NewComponents/FloatingMenuBar/types.d.ts +30 -0
- package/lib/components/NewComponents/FloatingMenuBar/types.js +1 -0
- package/lib/components/NewComponents/Notification/Notification.d.ts +4 -0
- package/lib/components/NewComponents/Notification/Notification.js +60 -0
- package/lib/components/NewComponents/Notification/NotificationContainer.d.ts +8 -0
- package/lib/components/NewComponents/Notification/NotificationContainer.js +33 -0
- package/lib/components/NewComponents/Notification/index.d.ts +2 -0
- package/lib/components/NewComponents/Notification/index.js +2 -0
- package/lib/components/NewComponents/Notification/styles.d.ts +21 -0
- package/lib/components/NewComponents/Notification/styles.js +180 -0
- package/lib/components/NewComponents/Notification/types.d.ts +18 -0
- package/lib/components/NewComponents/Notification/types.js +1 -0
- package/lib/components/features/documents/TMDcmtForm.js +117 -67
- package/lib/components/features/documents/TMDcmtPreview.js +36 -3
- package/lib/helper/checkinCheckoutManager.d.ts +1 -0
- package/lib/helper/checkinCheckoutManager.js +5 -3
- package/package.json +1 -1
|
@@ -15,9 +15,25 @@ import { TMSaveFormButtonPrevious, TMSaveFormButtonNext } from '../../forms/TMSa
|
|
|
15
15
|
import { StyledAnimatedComponentOpacity } from '../../base/Styled';
|
|
16
16
|
import TMPanel from '../../base/TMPanel';
|
|
17
17
|
import TMTooltip from '../../base/TMTooltip';
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
pdfjs
|
|
18
|
+
let Document = null;
|
|
19
|
+
let Page = null;
|
|
20
|
+
let pdfjs = null;
|
|
21
|
+
let isPdfLibraryLoaded = false;
|
|
22
|
+
const loadPdfLibrary = async () => {
|
|
23
|
+
if (isPdfLibraryLoaded)
|
|
24
|
+
return;
|
|
25
|
+
try {
|
|
26
|
+
const reactPdf = await import('react-pdf');
|
|
27
|
+
Document = reactPdf.Document;
|
|
28
|
+
Page = reactPdf.Page;
|
|
29
|
+
pdfjs = reactPdf.pdfjs;
|
|
30
|
+
pdfjs.GlobalWorkerOptions.workerSrc = require('pdfjs-dist/build/pdf.worker.mjs');
|
|
31
|
+
isPdfLibraryLoaded = true;
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
console.error('Failed to load react-pdf library:', error);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
21
37
|
const ErrorContent = ({ error, isAbortError, onRetry }) => {
|
|
22
38
|
if (isAbortError) {
|
|
23
39
|
return (_jsx(StyledAnimatedComponentOpacity, { style: { width: '100%', height: '100%' }, children: _jsxs(StyledPanelStatusContainer, { children: [_jsx(IconCloseOutline, { fontSize: 92, color: TMColors.error }), _jsxs(StyledPreviewNotAvailable, { children: [_jsx("div", { children: error }), _jsx("div", { children: SDKUI_Localizator.PreviewNotAvailable })] }), _jsx(TMButton, { caption: SDKUI_Localizator.TryAgain, onClick: onRetry, showTooltip: false })] }) }));
|
|
@@ -141,6 +157,7 @@ export const TMFileViewer = ({ fileBlob, isResizingActive }) => {
|
|
|
141
157
|
const [formattedXml, setFormattedXml] = useState(undefined);
|
|
142
158
|
const [isMobile, setIsMobile] = useState(false);
|
|
143
159
|
const [numPages, setNumPages] = useState(0);
|
|
160
|
+
const [pdfLibraryLoading, setPdfLibraryLoading] = useState(false);
|
|
144
161
|
useEffect(() => {
|
|
145
162
|
const checkIsMobile = () => {
|
|
146
163
|
const userAgent = navigator.userAgent || navigator.vendor || window.opera;
|
|
@@ -166,6 +183,12 @@ export const TMFileViewer = ({ fileBlob, isResizingActive }) => {
|
|
|
166
183
|
window.removeEventListener('resize', checkIsMobile);
|
|
167
184
|
};
|
|
168
185
|
}, []);
|
|
186
|
+
useEffect(() => {
|
|
187
|
+
if (isMobile && fileType === 'application/pdf' && !isPdfLibraryLoaded && !pdfLibraryLoading) {
|
|
188
|
+
setPdfLibraryLoading(true);
|
|
189
|
+
loadPdfLibrary().finally(() => setPdfLibraryLoading(false));
|
|
190
|
+
}
|
|
191
|
+
}, [isMobile, fileType, pdfLibraryLoading]);
|
|
169
192
|
useEffect(() => {
|
|
170
193
|
if (fileBlob) {
|
|
171
194
|
setFileType(fileBlob.type);
|
|
@@ -227,6 +250,16 @@ export const TMFileViewer = ({ fileBlob, isResizingActive }) => {
|
|
|
227
250
|
return (_jsx(ImageViewer, { fileBlob: fileBlob, alt: '' }));
|
|
228
251
|
}
|
|
229
252
|
if (fileType === 'application/pdf' && isMobile) {
|
|
253
|
+
if (!isPdfLibraryLoaded || pdfLibraryLoading || !Document || !Page) {
|
|
254
|
+
return (_jsxs("div", { style: {
|
|
255
|
+
display: 'flex',
|
|
256
|
+
justifyContent: 'center',
|
|
257
|
+
alignItems: 'center',
|
|
258
|
+
height: '100%',
|
|
259
|
+
flexDirection: 'column',
|
|
260
|
+
gap: '10px'
|
|
261
|
+
}, children: [_jsx(IconPreview, { fontSize: 64 }), _jsxs("div", { children: [SDKUI_Localizator.Loading, "..."] })] }));
|
|
262
|
+
}
|
|
230
263
|
return (_jsx(PDFViewerContainer, { children: _jsx(Document, { file: blobUrl, onLoadSuccess: ({ numPages }) => setNumPages(numPages), loading: _jsxs("div", { style: {
|
|
231
264
|
display: 'flex',
|
|
232
265
|
justifyContent: 'center',
|
|
@@ -241,7 +241,7 @@ export const getDcmtCicoStatus = (dcmt, allUsers, dtd) => {
|
|
|
241
241
|
if (dcmt === undefined || dtd === undefined) {
|
|
242
242
|
return {
|
|
243
243
|
cicoEnabled: false,
|
|
244
|
-
checkoutStatus: { isCheckedOut: false, mode: '', version: 1, icon: null }
|
|
244
|
+
checkoutStatus: { isCheckedOut: false, mode: '', version: 1, icon: null, editLockTooltipText: null }
|
|
245
245
|
};
|
|
246
246
|
}
|
|
247
247
|
// ========================================================================
|
|
@@ -312,7 +312,8 @@ export const getDcmtCicoStatus = (dcmt, allUsers, dtd) => {
|
|
|
312
312
|
isCheckedOut: false,
|
|
313
313
|
mode: '',
|
|
314
314
|
version: version,
|
|
315
|
-
icon: null
|
|
315
|
+
icon: null,
|
|
316
|
+
editLockTooltipText: null
|
|
316
317
|
};
|
|
317
318
|
// Verifica se il documento è effettivamente in stato di checkout
|
|
318
319
|
if (userID && checkoutUserId && !isNaN(checkoutUserId) && checkoutUserId > 0) {
|
|
@@ -332,7 +333,8 @@ export const getDcmtCicoStatus = (dcmt, allUsers, dtd) => {
|
|
|
332
333
|
isCheckedOut: true,
|
|
333
334
|
mode: mode,
|
|
334
335
|
icon: icon,
|
|
335
|
-
version: version
|
|
336
|
+
version: version,
|
|
337
|
+
editLockTooltipText: editLockTooltipText
|
|
336
338
|
};
|
|
337
339
|
}
|
|
338
340
|
// ========================================================================
|