@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.
Files changed (33) hide show
  1. package/lib/components/NewComponents/ContextMenu/TMContextMenu.d.ts +4 -0
  2. package/lib/components/NewComponents/ContextMenu/TMContextMenu.js +187 -0
  3. package/lib/components/NewComponents/ContextMenu/hooks.d.ts +12 -0
  4. package/lib/components/NewComponents/ContextMenu/hooks.js +52 -0
  5. package/lib/components/NewComponents/ContextMenu/index.d.ts +2 -0
  6. package/lib/components/NewComponents/ContextMenu/index.js +1 -0
  7. package/lib/components/NewComponents/ContextMenu/styles.d.ts +30 -0
  8. package/lib/components/NewComponents/ContextMenu/styles.js +337 -0
  9. package/lib/components/NewComponents/ContextMenu/types.d.ts +26 -0
  10. package/lib/components/NewComponents/ContextMenu/types.js +1 -0
  11. package/lib/components/NewComponents/FloatingMenuBar/TMFloatingMenuBar.d.ts +4 -0
  12. package/lib/components/NewComponents/FloatingMenuBar/TMFloatingMenuBar.js +370 -0
  13. package/lib/components/NewComponents/FloatingMenuBar/index.d.ts +2 -0
  14. package/lib/components/NewComponents/FloatingMenuBar/index.js +2 -0
  15. package/lib/components/NewComponents/FloatingMenuBar/styles.d.ts +38 -0
  16. package/lib/components/NewComponents/FloatingMenuBar/styles.js +266 -0
  17. package/lib/components/NewComponents/FloatingMenuBar/types.d.ts +30 -0
  18. package/lib/components/NewComponents/FloatingMenuBar/types.js +1 -0
  19. package/lib/components/NewComponents/Notification/Notification.d.ts +4 -0
  20. package/lib/components/NewComponents/Notification/Notification.js +60 -0
  21. package/lib/components/NewComponents/Notification/NotificationContainer.d.ts +8 -0
  22. package/lib/components/NewComponents/Notification/NotificationContainer.js +33 -0
  23. package/lib/components/NewComponents/Notification/index.d.ts +2 -0
  24. package/lib/components/NewComponents/Notification/index.js +2 -0
  25. package/lib/components/NewComponents/Notification/styles.d.ts +21 -0
  26. package/lib/components/NewComponents/Notification/styles.js +180 -0
  27. package/lib/components/NewComponents/Notification/types.d.ts +18 -0
  28. package/lib/components/NewComponents/Notification/types.js +1 -0
  29. package/lib/components/features/documents/TMDcmtForm.js +117 -67
  30. package/lib/components/features/documents/TMDcmtPreview.js +36 -3
  31. package/lib/helper/checkinCheckoutManager.d.ts +1 -0
  32. package/lib/helper/checkinCheckoutManager.js +5 -3
  33. 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
- import { Document, Page, pdfjs } from 'react-pdf';
19
- // Configure PDF.js worker
20
- pdfjs.GlobalWorkerOptions.workerSrc = `https://unpkg.com/pdfjs-dist@${pdfjs.version}/build/pdf.worker.min.mjs`;
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',
@@ -27,6 +27,7 @@ interface CheckoutStatusResult {
27
27
  mode: 'editMode' | 'lockMode' | '';
28
28
  version: number;
29
29
  icon: React.ReactNode | null;
30
+ editLockTooltipText: React.ReactNode | null;
30
31
  }
31
32
  export type DownloadSource = {
32
33
  type: 'fileItem';
@@ -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
  // ========================================================================
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react",
3
- "version": "6.20.0-dev1.18",
3
+ "version": "6.20.0-dev1.19",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",