@topconsultnpm/sdkui-react-beta 6.14.121 → 6.14.122

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.
@@ -163,12 +163,21 @@ export const TMFileViewer = ({ fileBlob, isResizingActive }) => {
163
163
  const [blobUrl, setBlobUrl] = useState(undefined);
164
164
  const [fileType, setFileType] = useState(undefined);
165
165
  const [formattedXml, setFormattedXml] = useState(undefined);
166
+ const [isMobile, setIsMobile] = useState(false);
167
+ useEffect(() => {
168
+ const checkIsMobile = () => {
169
+ const userAgent = navigator.userAgent || navigator.vendor || window.opera;
170
+ const isMobileDevice = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent);
171
+ setIsMobile(isMobileDevice);
172
+ };
173
+ checkIsMobile();
174
+ }, []);
166
175
  useEffect(() => {
167
176
  if (fileBlob) {
168
177
  const url = URL.createObjectURL(fileBlob);
169
178
  setBlobUrl(url);
170
179
  setFileType(fileBlob.type);
171
- setFormattedXml(undefined); // Reset XML when blob changes
180
+ setFormattedXml(undefined);
172
181
  if (fileBlob.type.includes("xml")) {
173
182
  fileBlob.text().then((text) => {
174
183
  const parser = new DOMParser();
@@ -204,33 +213,33 @@ export const TMFileViewer = ({ fileBlob, isResizingActive }) => {
204
213
  if (fileBlob.type.includes('image')) {
205
214
  return (_jsx(ImageViewer, { fileBlob: fileBlob, alt: '' }));
206
215
  }
207
- if (fileType === 'application/pdf') {
208
- return (_jsx("div", { style: { width: '100%', height: '100%', position: 'relative' }, children: _jsx("object", { data: blobUrl, type: "application/pdf", width: "100%", height: "100%", style: { border: 'none', pointerEvents: isResizingActive === true ? "none" : "auto" }, children: _jsxs("div", { style: {
209
- padding: '40px',
210
- textAlign: 'center',
211
- display: 'flex',
212
- flexDirection: 'column',
213
- alignItems: 'center',
214
- justifyContent: 'center',
215
- height: '100%',
216
- gap: '20px'
217
- }, children: [_jsx(IconPreview, { fontSize: 96 }), _jsxs("div", { children: [_jsx("h3", { children: SDKUI_Localizator.PDFDocument }), _jsx("p", { children: SDKUI_Localizator.PreviewNotAvailableOnDevice })] }), _jsxs("div", { style: { display: 'flex', gap: '10px', flexWrap: 'wrap', alignItems: 'center', justifyContent: 'center' }, children: [_jsx("a", { href: blobUrl, download: "document.pdf", style: {
218
- minWidth: '180px',
219
- padding: '12px 24px',
220
- backgroundColor: TMColors.primaryColor,
221
- color: 'white',
222
- textDecoration: 'none',
223
- borderRadius: '4px',
224
- display: 'inline-block'
225
- }, children: SDKUI_Localizator.DownloadFile }), _jsx("a", { href: blobUrl, target: "_blank", rel: "noopener noreferrer", style: {
226
- minWidth: '180px',
227
- padding: '12px 24px',
228
- backgroundColor: TMColors.primaryColor,
229
- color: 'white',
230
- textDecoration: 'none',
231
- borderRadius: '4px',
232
- display: 'inline-block'
233
- }, children: SDKUI_Localizator.OpenInNewTab })] })] }) }) }));
216
+ if (fileType === 'application/pdf' && isMobile) {
217
+ return (_jsxs("div", { style: {
218
+ padding: '40px',
219
+ textAlign: 'center',
220
+ display: 'flex',
221
+ flexDirection: 'column',
222
+ alignItems: 'center',
223
+ justifyContent: 'center',
224
+ height: '100%',
225
+ gap: '20px'
226
+ }, children: [_jsx(IconPreview, { fontSize: 96 }), _jsxs("div", { children: [_jsx("h3", { children: SDKUI_Localizator.PDFDocument }), _jsx("p", { children: SDKUI_Localizator.PreviewNotAvailableOnDevice })] }), _jsxs("div", { style: { display: 'flex', gap: '10px', flexWrap: 'wrap', alignItems: 'center', justifyContent: 'center' }, children: [_jsx("a", { href: blobUrl, download: "document.pdf", style: {
227
+ minWidth: '180px',
228
+ padding: '12px 24px',
229
+ backgroundColor: TMColors.primaryColor,
230
+ color: 'white',
231
+ textDecoration: 'none',
232
+ borderRadius: '4px',
233
+ display: 'inline-block'
234
+ }, children: SDKUI_Localizator.DownloadFile }), _jsx("a", { href: blobUrl, target: "_blank", rel: "noopener noreferrer", style: {
235
+ minWidth: '180px',
236
+ padding: '12px 24px',
237
+ backgroundColor: TMColors.primaryColor,
238
+ color: 'white',
239
+ textDecoration: 'none',
240
+ borderRadius: '4px',
241
+ display: 'inline-block'
242
+ }, children: SDKUI_Localizator.OpenInNewTab })] })] }));
234
243
  }
235
244
  return (_jsx("iframe", { srcDoc: fileType?.includes("xml") && formattedXml ? `<html><body>${formattedXml}</body></html>` : undefined, src: !fileType?.includes("xml") || !formattedXml ? blobUrl : undefined, title: "File Viewer", width: "100%", height: "100%", style: { border: 'none', zIndex: 0, pointerEvents: isResizingActive === true ? "none" : "auto" } }));
236
245
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react-beta",
3
- "version": "6.14.121",
3
+ "version": "6.14.122",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",