@onehat/ui 0.3.325 → 0.3.326
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/package.json
CHANGED
|
@@ -6,7 +6,7 @@ const downloadWithFetch = (url, options = {}, win = null) => {
|
|
|
6
6
|
if (!win) {
|
|
7
7
|
const
|
|
8
8
|
winName = 'Download',
|
|
9
|
-
opts = '
|
|
9
|
+
opts = 'location=0,menubar=0,scrollbars=0';
|
|
10
10
|
win = window.open('', winName, opts);
|
|
11
11
|
}
|
|
12
12
|
|
|
@@ -25,11 +25,13 @@ import Xmark from '../../Components/Icons/Xmark.js'
|
|
|
25
25
|
import withAlert from '../../Components/Hoc/withAlert.js';
|
|
26
26
|
import withData from '../../Components/Hoc/withData.js';
|
|
27
27
|
import downloadInBackground from '../../Functions/downloadInBackground.js';
|
|
28
|
+
import downloadWithFetch from '../../Functions/downloadWithFetch.js';
|
|
28
29
|
import _ from 'lodash';
|
|
29
30
|
|
|
30
31
|
const
|
|
31
32
|
EXPANDED_MAX = 100,
|
|
32
|
-
COLLAPSED_MAX = 4
|
|
33
|
+
COLLAPSED_MAX = 4,
|
|
34
|
+
isPwa = !!window?.navigator?.standalone;
|
|
33
35
|
|
|
34
36
|
function FileCardCustom(props) {
|
|
35
37
|
const
|
|
@@ -187,6 +189,13 @@ function AttachmentsElement(props) {
|
|
|
187
189
|
doDelete(id);
|
|
188
190
|
}
|
|
189
191
|
},
|
|
192
|
+
onDownload = (id, url) => {
|
|
193
|
+
if (isPwa) {
|
|
194
|
+
downloadWithFetch(url);
|
|
195
|
+
} else {
|
|
196
|
+
downloadInBackground(url);
|
|
197
|
+
}
|
|
198
|
+
},
|
|
190
199
|
doDelete = (id) => {
|
|
191
200
|
Repository.deleteById(id);
|
|
192
201
|
Repository.save();
|
|
@@ -282,6 +291,7 @@ function AttachmentsElement(props) {
|
|
|
282
291
|
<FileMosaic
|
|
283
292
|
{...file}
|
|
284
293
|
backgroundBlurImage={false}
|
|
294
|
+
onDownload={onDownload}
|
|
285
295
|
{..._fileMosaic}
|
|
286
296
|
/>}
|
|
287
297
|
{!useFileMosaic &&
|