@topconsultnpm/sdkui-react-beta 6.16.73 → 6.16.75
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.
|
@@ -124,10 +124,27 @@ export const TMFileViewer = ({ fileBlob, isResizingActive }) => {
|
|
|
124
124
|
useEffect(() => {
|
|
125
125
|
const checkIsMobile = () => {
|
|
126
126
|
const userAgent = navigator.userAgent || navigator.vendor || window.opera;
|
|
127
|
-
|
|
127
|
+
// Only detect actual mobile/tablet devices, NOT desktop browsers
|
|
128
|
+
const isMobileDevice =
|
|
129
|
+
// Traditional mobile detection (phones and tablets)
|
|
130
|
+
/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent) ||
|
|
131
|
+
// Additional Android tablet detection (covers tablets in landscape)
|
|
132
|
+
/android.*tablet|android.*mobile/i.test(userAgent) ||
|
|
133
|
+
// Touch-only devices (excludes laptops with touchscreen)
|
|
134
|
+
(('ontouchstart' in window || navigator.maxTouchPoints > 0) &&
|
|
135
|
+
!/Windows NT|Macintosh|Linux/.test(userAgent)) ||
|
|
136
|
+
// Small screen mobile devices only
|
|
137
|
+
(window.screen.width <= 768 && /Mobi|Android/i.test(userAgent));
|
|
128
138
|
setIsMobile(isMobileDevice);
|
|
129
139
|
};
|
|
130
140
|
checkIsMobile();
|
|
141
|
+
// Listen for orientation changes (important for tablets)
|
|
142
|
+
window.addEventListener('orientationchange', checkIsMobile);
|
|
143
|
+
window.addEventListener('resize', checkIsMobile);
|
|
144
|
+
return () => {
|
|
145
|
+
window.removeEventListener('orientationchange', checkIsMobile);
|
|
146
|
+
window.removeEventListener('resize', checkIsMobile);
|
|
147
|
+
};
|
|
131
148
|
}, []);
|
|
132
149
|
useEffect(() => {
|
|
133
150
|
if (fileBlob) {
|
|
@@ -170,7 +187,17 @@ export const TMFileViewer = ({ fileBlob, isResizingActive }) => {
|
|
|
170
187
|
if (fileBlob.type.includes('image')) {
|
|
171
188
|
return (_jsx(ImageViewer, { fileBlob: fileBlob, alt: '' }));
|
|
172
189
|
}
|
|
173
|
-
if (
|
|
190
|
+
// Check if device has limited PDF support (only for mobile/tablet devices)
|
|
191
|
+
const hasLimitedPDFSupport = () => {
|
|
192
|
+
const userAgent = navigator.userAgent || navigator.vendor || window.opera;
|
|
193
|
+
// Only check for actual mobile/tablet devices, NOT desktop browsers
|
|
194
|
+
const isAndroidMobile = /android/i.test(userAgent) && (/mobile|tablet/i.test(userAgent) || window.screen.width <= 1024);
|
|
195
|
+
const isIOSMobile = /iphone|ipad|ipod/i.test(userAgent);
|
|
196
|
+
const isOtherMobile = /webos|blackberry|iemobile|opera mini/i.test(userAgent);
|
|
197
|
+
// Return true only for actual mobile devices, not desktop browsers
|
|
198
|
+
return isMobile && (isAndroidMobile || isIOSMobile || isOtherMobile);
|
|
199
|
+
};
|
|
200
|
+
if (fileType === 'application/pdf' && hasLimitedPDFSupport()) {
|
|
174
201
|
return (_jsxs("div", { style: {
|
|
175
202
|
padding: '40px',
|
|
176
203
|
textAlign: 'center',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from 'react';
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
3
|
import { ResultTypes } from '@topconsultnpm/sdk-ts-beta';
|
|
4
4
|
import { FormModes } from '../../ts/types';
|
|
5
5
|
import { IconArrowDown, IconArrowLeft, IconArrowUp, IconCloseCircle, IconHide, IconSave, IconShow, IconUndo, IconWarning, LocalizeFormModes, SDKUI_Localizator, getColor } from '../../helper';
|
|
@@ -90,6 +90,14 @@ const TMSaveForm = ({ id, formMode = FormModes.Update, showToolbar = true, skipI
|
|
|
90
90
|
}
|
|
91
91
|
});
|
|
92
92
|
};
|
|
93
|
+
useEffect(() => {
|
|
94
|
+
const handleKeyDown = (e) => {
|
|
95
|
+
if (e.key === 'Escape')
|
|
96
|
+
doClose();
|
|
97
|
+
};
|
|
98
|
+
window.addEventListener('keydown', handleKeyDown);
|
|
99
|
+
return () => window.removeEventListener('keydown', handleKeyDown);
|
|
100
|
+
}, [doClose]);
|
|
93
101
|
const warningsCount = validationItems.filter(o => o.ResultType == ResultTypes.WARNING).length;
|
|
94
102
|
const errorsCount = validationItems.filter(o => o.ResultType == ResultTypes.ERROR).length;
|
|
95
103
|
const renderSaveForm = () => {
|