diginet-core-ui 1.4.36-beta.2 → 1.4.36-beta.3
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.
|
@@ -420,6 +420,7 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referenc
|
|
|
420
420
|
};
|
|
421
421
|
const _onDownload = () => {
|
|
422
422
|
var _ref2;
|
|
423
|
+
console.log('AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA');
|
|
423
424
|
const index = chosenItems[0];
|
|
424
425
|
const file = mountDomain((_ref2 = [...dataState, ...newDataState]) === null || _ref2 === void 0 ? void 0 : _ref2[index]);
|
|
425
426
|
handleDownload(file === null || file === void 0 ? void 0 : file.URL, file === null || file === void 0 ? void 0 : file.FileName, onDownload);
|
|
@@ -1188,7 +1189,7 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referenc
|
|
|
1188
1189
|
const index = chosenItems[0];
|
|
1189
1190
|
const data = mountDomain([...dataState, ...newDataState][index]);
|
|
1190
1191
|
const dataType = getType(data);
|
|
1191
|
-
if (isBase64URL(data === null || data === void 0 ? void 0 : data.URL) &&
|
|
1192
|
+
if (isBase64URL(data === null || data === void 0 ? void 0 : data.URL) && !['image', 'pdf'].includes(dataType)) setShowModal(false);
|
|
1192
1193
|
|
|
1193
1194
|
// let data = oldAttached[index] || allNewAttached.getAll('files')[index-oldAttached.length];
|
|
1194
1195
|
return jsx(ModalSample, {
|
|
@@ -1196,6 +1197,7 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referenc
|
|
|
1196
1197
|
title: data === null || data === void 0 ? void 0 : data.FileName,
|
|
1197
1198
|
onClose: () => setShowModal(false)
|
|
1198
1199
|
}, jsx(Slider, null, jsx(SliderItem, {
|
|
1200
|
+
dataType: dataType,
|
|
1199
1201
|
url: data === null || data === void 0 ? void 0 : data.URL
|
|
1200
1202
|
})));
|
|
1201
1203
|
}, [domain, showModal]);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
2
|
/** @jsx jsx */
|
|
3
3
|
import { css, jsx } from '@emotion/core';
|
|
4
|
-
import CircularProgress from "./..";
|
|
4
|
+
import { CircularProgress } from "./..";
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { forwardRef, memo, useEffect, useImperativeHandle, useRef, useState } from 'react';
|
|
7
7
|
import { animations } from "../../styles/animation";
|
|
@@ -30,6 +30,7 @@ const SliderItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
30
30
|
animation,
|
|
31
31
|
fileName,
|
|
32
32
|
url,
|
|
33
|
+
dataType,
|
|
33
34
|
...props
|
|
34
35
|
}, reference) => {
|
|
35
36
|
const theme = useTheme();
|
|
@@ -79,7 +80,7 @@ const SliderItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
79
80
|
className: IDs.frame,
|
|
80
81
|
css: _FrameCSS,
|
|
81
82
|
frameBorder: 0,
|
|
82
|
-
src: getIframeLink(),
|
|
83
|
+
src: getIframeLink(filePath),
|
|
83
84
|
title: fileName,
|
|
84
85
|
onLoad: iframeLoaded,
|
|
85
86
|
onError: updateIframeSrc
|
|
@@ -133,7 +134,8 @@ const SliderItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
133
134
|
clearInterval(iframeTimeoutId);
|
|
134
135
|
setIframeTimeoutId(null);
|
|
135
136
|
};
|
|
136
|
-
const getIframeLink = () => {
|
|
137
|
+
const getIframeLink = (data = '') => {
|
|
138
|
+
if (dataType === 'pdf' && data && data.indexOf('data:application/') > -1) return data;
|
|
137
139
|
return `https://docs.google.com/gview?url=${url}&embedded=true`;
|
|
138
140
|
};
|
|
139
141
|
const updateIframeSrc = () => {
|
|
@@ -148,6 +150,9 @@ const SliderItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
148
150
|
currentRef.instance = _instance;
|
|
149
151
|
return currentRef;
|
|
150
152
|
});
|
|
153
|
+
const handleGetViewer = () => {
|
|
154
|
+
return dataType === 'pdf' ? dataType : getFileType(url, undefined, false);
|
|
155
|
+
};
|
|
151
156
|
return jsx("div", {
|
|
152
157
|
className: classNames(IDs.itemContainer, active && 'active', animation && 'item-animation'),
|
|
153
158
|
css: ItemContainerCSS,
|
|
@@ -157,7 +162,7 @@ const SliderItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
157
162
|
css: LoadingCSS
|
|
158
163
|
}, jsx(CircularProgress, {
|
|
159
164
|
size: 'xs'
|
|
160
|
-
})), getViewer(url,
|
|
165
|
+
})), getViewer(url, handleGetViewer()));
|
|
161
166
|
}));
|
|
162
167
|
const ItemContainerCSS = css`
|
|
163
168
|
${displayNone};
|