quasar-ui-danx 0.0.11 → 0.0.13

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 (84) hide show
  1. package/dist/index.css +5 -0
  2. package/dist/index.min.css +5 -0
  3. package/dist/index.rtl.css +5 -0
  4. package/dist/index.rtl.min.css +5 -0
  5. package/package.json +6 -1
  6. package/src/components/ActionTable/ActionTable.vue +49 -41
  7. package/src/components/ActionTable/BatchActionMenu.vue +20 -20
  8. package/src/components/ActionTable/EmptyTableState.vue +5 -5
  9. package/src/components/ActionTable/Filters/CollapsableFiltersSidebar.vue +11 -11
  10. package/src/components/ActionTable/Filters/FilterGroupItem.vue +7 -7
  11. package/src/components/ActionTable/Filters/FilterGroupList.vue +29 -29
  12. package/src/components/ActionTable/Filters/FilterListToggle.vue +15 -15
  13. package/src/components/ActionTable/Filters/FilterableField.vue +82 -80
  14. package/src/components/ActionTable/Filters/index.ts +5 -0
  15. package/src/components/ActionTable/Form/Fields/BooleanField.vue +13 -13
  16. package/src/components/ActionTable/Form/Fields/ConfirmPasswordField.vue +11 -11
  17. package/src/components/ActionTable/Form/Fields/DateField.vue +13 -13
  18. package/src/components/ActionTable/Form/Fields/DateRangeField.vue +25 -25
  19. package/src/components/ActionTable/Form/Fields/DateTimeField.vue +21 -21
  20. package/src/components/ActionTable/Form/Fields/DateTimePicker.vue +23 -23
  21. package/src/components/ActionTable/Form/Fields/FileUploadButton.vue +31 -31
  22. package/src/components/ActionTable/Form/Fields/InlineDateTimeField.vue +19 -19
  23. package/src/components/ActionTable/Form/Fields/IntegerField.vue +7 -7
  24. package/src/components/ActionTable/Form/Fields/LabelValueBlock.vue +22 -0
  25. package/src/components/ActionTable/Form/Fields/LabeledInput.vue +19 -19
  26. package/src/components/ActionTable/Form/Fields/MultiFileField.vue +40 -40
  27. package/src/components/ActionTable/Form/Fields/MultiKeywordField.vue +23 -23
  28. package/src/components/ActionTable/Form/Fields/NewPasswordField.vue +10 -10
  29. package/src/components/ActionTable/Form/Fields/NumberField.vue +29 -29
  30. package/src/components/ActionTable/Form/Fields/NumberRangeField.vue +33 -33
  31. package/src/components/ActionTable/Form/Fields/SelectDrawer.vue +36 -36
  32. package/src/components/ActionTable/Form/Fields/SelectField.vue +66 -66
  33. package/src/components/ActionTable/Form/Fields/SelectWithChildrenField.vue +23 -23
  34. package/src/components/ActionTable/Form/Fields/SingleFileField.vue +32 -32
  35. package/src/components/ActionTable/Form/Fields/TextField.vue +36 -36
  36. package/src/components/ActionTable/Form/Fields/WysiwygField.vue +16 -16
  37. package/src/components/ActionTable/Form/Fields/index.ts +23 -23
  38. package/src/components/ActionTable/Form/RenderedForm.vue +27 -25
  39. package/src/components/ActionTable/Form/index.ts +2 -0
  40. package/src/components/ActionTable/TableSummaryRow.vue +33 -33
  41. package/src/components/ActionTable/index.ts +8 -13
  42. package/src/components/ActionTable/listActions.ts +340 -339
  43. package/src/components/ActionTable/listHelpers.ts +74 -0
  44. package/src/components/ActionTable/tableColumns.ts +56 -56
  45. package/src/components/DragAndDrop/HandleDraggable.vue +29 -29
  46. package/src/components/DragAndDrop/ListItemDraggable.vue +10 -10
  47. package/src/components/DragAndDrop/index.ts +0 -1
  48. package/src/components/DragAndDrop/listDragAndDrop.ts +1 -1
  49. package/src/components/Utility/CollapsableSidebar.vue +35 -35
  50. package/src/components/Utility/ContentDrawer.vue +20 -20
  51. package/src/components/Utility/Dialogs/ConfirmDialog.vue +55 -55
  52. package/src/components/Utility/Dialogs/FullScreenDialog.vue +18 -18
  53. package/src/components/Utility/Dialogs/FullscreenCarouselDialog.vue +105 -0
  54. package/src/components/Utility/Dialogs/InfoDialog.vue +10 -10
  55. package/src/components/Utility/Dialogs/InputDialog.vue +13 -13
  56. package/src/components/Utility/ImagePreview.vue +192 -0
  57. package/src/components/Utility/Popover/PopoverMenu.vue +64 -0
  58. package/src/components/Utility/Transitions/StaggeredListTransition.vue +15 -15
  59. package/src/components/Utility/index.ts +11 -9
  60. package/src/components/index.ts +1 -1
  61. package/src/helpers/FileUpload.ts +274 -273
  62. package/src/helpers/compatibility.ts +45 -45
  63. package/src/helpers/date.ts +2 -2
  64. package/src/helpers/download.ts +166 -158
  65. package/src/helpers/downloadPdf.ts +48 -48
  66. package/src/helpers/files.ts +42 -42
  67. package/src/helpers/index.ts +2 -0
  68. package/src/helpers/multiFileUpload.ts +56 -56
  69. package/src/helpers/singleFileUpload.ts +49 -49
  70. package/src/index.esm.js +3 -4
  71. package/src/svg/FilterIcon.svg +7 -0
  72. package/src/svg/ImageIcon.svg +30 -0
  73. package/src/svg/PdfIcon.svg +21 -0
  74. package/src/svg/PercentIcon.svg +13 -0
  75. package/src/svg/TrashIcon.svg +15 -0
  76. package/src/svg/XIcon.svg +18 -0
  77. package/src/svg/index.ts +8 -0
  78. package/src/vendor/tinymce-config.ts +1 -0
  79. package/src/vue-plugin.js +7 -4
  80. package/tsconfig.json +18 -14
  81. package/src/components/ActionTable/tableHelpers.ts +0 -83
  82. package/src/components/DragAndDrop/Icons/index.ts +0 -2
  83. /package/src/{components/DragAndDrop/Icons → svg}/DragHandleDotsIcon.svg +0 -0
  84. /package/src/{components/DragAndDrop/Icons → svg}/DragHandleIcon.svg +0 -0
@@ -9,184 +9,192 @@
9
9
 
10
10
  /* eslint-disable */
11
11
  export function download(data, strFileName, strMimeType) {
12
- var self = window;
13
- // this script is only for browsers anyway...
14
-
15
- var defaultMime = "application/octet-stream";
16
- // this default mime also triggers iframe downloads
17
-
18
- var mimeType = strMimeType || defaultMime;
19
-
20
- var payload = data;
21
-
22
- var url = !strFileName && !strMimeType && payload;
23
-
24
- var anchor = document.createElement("a");
25
-
26
- var toString = function(a) {
27
- return String(a);
28
- };
29
-
30
- var myBlob = self.Blob || self.MozBlob || self.WebKitBlob || toString;
31
-
32
- var fileName = strFileName || "download";
33
-
34
- var blob;
35
-
36
- var reader;
37
- myBlob = myBlob.call ? myBlob.bind(self) : Blob;
38
-
39
- if (String(this) === "true") {
40
- // reverse arguments, allowing download.bind(true, "text/xml", "export.xml") to act as a callback
41
- payload = [payload, mimeType];
42
- mimeType = payload[0];
43
- payload = payload[1];
44
- }
45
-
46
- if (url && url.length < 2048) {
47
- // if no filename and no mime, assume a url was passed as the only argument
48
- fileName = url.split("/").pop().split("?")[0];
49
- anchor.href = url; // assign href prop to temp anchor
50
-
51
- // if the browser determines that it's a potentially valid url path:
52
- if (
53
- anchor.href.indexOf(url) !== -1 ||
54
- anchor.href.indexOf(encodeURI(url)) !== -1 ||
55
- anchor.href === encodeURI(url)
56
- ) {
57
- var ajax = new XMLHttpRequest();
58
- ajax.open("GET", url + "?no-cache=" + Date.now(), true);
59
- ajax.responseType = "blob";
60
- ajax.onload = function(e) {
61
- download(e.target.response, fileName, defaultMime);
62
- };
63
- ajax.onerror = function(e) {
64
- // As a fallback, just open the request in a new tab
65
- window.open(url, "_blank").focus();
66
- };
67
- setTimeout(function() {
68
- ajax.send();
69
- }, 0); // allows setting custom ajax headers using the return:
70
- return ajax;
71
- } else {
72
- throw new Error("Invalid URL given, cannot download file: " + url);
73
- }
74
- } // end if url?
12
+ var self = window;
13
+ // this script is only for browsers anyway...
75
14
 
76
- // go ahead and download dataURLs right away
77
- if (/^data:[\w+-]+\/[\w+-]+[,;]/.test(payload)) {
78
- if (payload.length > 1024 * 1024 * 1.999 && myBlob !== toString) {
79
- payload = dataUrlToBlob(payload);
80
- mimeType = payload.type || defaultMime;
81
- } else {
82
- return navigator.msSaveBlob // IE10 can't do a[download], only Blobs:
83
- ? navigator.msSaveBlob(dataUrlToBlob(payload), fileName)
84
- : saver(payload); // everyone else can save dataURLs un-processed
85
- }
86
- } // end if dataURL passed?
15
+ var defaultMime = "application/octet-stream";
16
+ // this default mime also triggers iframe downloads
87
17
 
88
- blob =
89
- payload instanceof myBlob
90
- ? payload
91
- : new myBlob([payload], { type: mimeType });
18
+ var mimeType = strMimeType || defaultMime;
92
19
 
93
- function dataUrlToBlob(strUrl) {
94
- var parts = strUrl.split(/[:;,]/);
20
+ var payload = data;
95
21
 
96
- var type = parts[1];
22
+ var url = !strFileName && !strMimeType && payload;
97
23
 
98
- var decoder = parts[2] === "base64" ? atob : decodeURIComponent;
24
+ var anchor = document.createElement("a");
99
25
 
100
- var binData = decoder(parts.pop());
26
+ var toString = function (a) {
27
+ return String(a);
28
+ };
29
+
30
+ // @ts-ignore
31
+ var myBlob = self.Blob || self.MozBlob || self.WebKitBlob || toString;
101
32
 
102
- var mx = binData.length;
33
+ var fileName = strFileName || "download";
103
34
 
104
- var i = 0;
35
+ var blob;
105
36
 
106
- var uiArr = new Uint8Array(mx);
37
+ var reader;
38
+ myBlob = myBlob.call ? myBlob.bind(self) : Blob;
107
39
 
108
- for (i; i < mx; ++i) uiArr[i] = binData.charCodeAt(i);
40
+ if (String(this) === "true") {
41
+ // reverse arguments, allowing download.bind(true, "text/xml", "export.xml") to act as a callback
42
+ payload = [payload, mimeType];
43
+ mimeType = payload[0];
44
+ payload = payload[1];
45
+ }
109
46
 
110
- return new myBlob([uiArr], { type: type });
111
- }
47
+ if (url && url.length < 2048) {
48
+ // if no filename and no mime, assume a url was passed as the only argument
49
+ fileName = url.split("/").pop().split("?")[0];
50
+ anchor.href = url; // assign href prop to temp anchor
112
51
 
113
- function saver(url, winMode) {
114
- if ("download" in anchor) {
115
- // html5 A[download]
116
- anchor.href = url;
117
- anchor.setAttribute("download", fileName);
118
- anchor.className = "download-js-link";
119
- anchor.innerHTML = "downloading...";
120
- anchor.style.display = "none";
121
- document.body.appendChild(anchor);
122
- setTimeout(function() {
123
- anchor.click();
124
- document.body.removeChild(anchor);
125
- if (winMode === true) {
126
- setTimeout(function() {
127
- self.URL.revokeObjectURL(anchor.href);
128
- }, 250);
52
+ // if the browser determines that it's a potentially valid url path:
53
+ if (
54
+ anchor.href.indexOf(url) !== -1 ||
55
+ anchor.href.indexOf(encodeURI(url)) !== -1 ||
56
+ anchor.href === encodeURI(url)
57
+ ) {
58
+ var ajax = new XMLHttpRequest();
59
+ ajax.open("GET", url + "?no-cache=" + Date.now(), true);
60
+ ajax.responseType = "blob";
61
+ ajax.onload = function (e) {
62
+ // @ts-ignore
63
+ download(e.target.response, fileName, defaultMime);
64
+ };
65
+ ajax.onerror = function (e) {
66
+ // As a fallback, just open the request in a new tab
67
+ window.open(url, "_blank").focus();
68
+ };
69
+ setTimeout(function () {
70
+ ajax.send();
71
+ }, 0); // allows setting custom ajax headers using the return:
72
+ return ajax;
73
+ } else {
74
+ throw new Error("Invalid URL given, cannot download file: " + url);
75
+ }
76
+ } // end if url?
77
+
78
+ // go ahead and download dataURLs right away
79
+ if (/^data:[\w+-]+\/[\w+-]+[,;]/.test(payload)) {
80
+ if (payload.length > 1024 * 1024 * 1.999 && myBlob !== toString) {
81
+ payload = dataUrlToBlob(payload);
82
+ mimeType = payload.type || defaultMime;
83
+ } else {
84
+ // IE10 can't do a[download], only Blobs
85
+ // everyone else can save dataURLs un-processed
86
+ // @ts-ignore
87
+ return navigator.msSaveBlob ? navigator.msSaveBlob(dataUrlToBlob(payload), fileName) : saver(payload);
129
88
  }
130
- }, 66);
131
- return true;
89
+ } // end if dataURL passed?
90
+
91
+ blob =
92
+ payload instanceof myBlob
93
+ ? payload
94
+ : new myBlob([payload], { type: mimeType });
95
+
96
+ function dataUrlToBlob(strUrl) {
97
+ var parts = strUrl.split(/[:;,]/);
98
+
99
+ var type = parts[1];
100
+
101
+ var decoder = parts[2] === "base64" ? atob : decodeURIComponent;
102
+
103
+ var binData = decoder(parts.pop());
104
+
105
+ var mx = binData.length;
106
+
107
+ var i = 0;
108
+
109
+ var uiArr = new Uint8Array(mx);
110
+
111
+ for (i; i < mx; ++i) uiArr[i] = binData.charCodeAt(i);
112
+
113
+ return new myBlob([uiArr], { type: type });
132
114
  }
133
115
 
134
- // handle non-a[download] safari as best we can:
135
- if (
136
- /(Version)\/(\d+)\.(\d+)(?:\.(\d+))?.*Safari\//.test(navigator.userAgent)
137
- ) {
138
- url = url.replace(/^data:([\w/\-+]+)/, defaultMime);
139
- if (!window.open(url)) {
140
- // popup blocked, offer direct download:
116
+ function saver(url, winMode) {
117
+ if ("download" in anchor) {
118
+ // html5 A[download]
119
+ anchor.href = url;
120
+ anchor.setAttribute("download", fileName);
121
+ anchor.className = "download-js-link";
122
+ anchor.innerHTML = "downloading...";
123
+ anchor.style.display = "none";
124
+ document.body.appendChild(anchor);
125
+ setTimeout(function () {
126
+ anchor.click();
127
+ document.body.removeChild(anchor);
128
+ if (winMode === true) {
129
+ setTimeout(function () {
130
+ self.URL.revokeObjectURL(anchor.href);
131
+ }, 250);
132
+ }
133
+ }, 66);
134
+ return true;
135
+ }
136
+
137
+ // handle non-a[download] safari as best we can:
141
138
  if (
142
- confirm(
143
- "Displaying New Document\n\nUse Save As... to download, then click back to return to this page."
144
- )
139
+ /(Version)\/(\d+)\.(\d+)(?:\.(\d+))?.*Safari\//.test(navigator.userAgent)
145
140
  ) {
146
- location.href = url;
141
+ url = url.replace(/^data:([\w/\-+]+)/, defaultMime);
142
+ if (!window.open(url)) {
143
+ // popup blocked, offer direct download:
144
+ if (
145
+ confirm(
146
+ "Displaying New Document\n\nUse Save As... to download, then click back to return to this page."
147
+ )
148
+ ) {
149
+ location.href = url;
150
+ }
151
+ }
152
+ return true;
147
153
  }
148
- }
149
- return true;
150
- }
151
154
 
152
- // do iframe dataURL download (old ch+FF):
153
- var f = document.createElement("iframe");
154
- document.body.appendChild(f);
155
+ // do iframe dataURL download (old ch+FF):
156
+ var f = document.createElement("iframe");
157
+ document.body.appendChild(f);
155
158
 
156
- if (!winMode) {
157
- // force a mime that will download:
158
- url = "data:" + url.replace(/^data:([\w/\-+]+)/, defaultMime);
159
- }
160
- f.src = url;
161
- setTimeout(function() {
162
- document.body.removeChild(f);
163
- }, 333);
164
- } // end saver
165
-
166
- if (navigator.msSaveBlob) {
167
- // IE10+ : (has Blob, but not a[download] or URL)
168
- return navigator.msSaveBlob(blob, fileName);
169
- }
170
-
171
- if (self.URL) {
172
- // simple fast and modern way using Blob and URL:
173
- saver(self.URL.createObjectURL(blob), true);
174
- } else {
175
- // handle non-Blob()+non-URL browsers:
176
- if (typeof blob === "string" || blob.constructor === toString) {
177
- try {
178
- return saver("data:" + mimeType + ";base64," + self.btoa(blob));
179
- } catch (y) {
180
- return saver("data:" + mimeType + "," + encodeURIComponent(blob));
181
- }
159
+ if (!winMode) {
160
+ // force a mime that will download:
161
+ url = "data:" + url.replace(/^data:([\w/\-+]+)/, defaultMime);
162
+ }
163
+ f.src = url;
164
+ setTimeout(function () {
165
+ document.body.removeChild(f);
166
+ }, 333);
167
+ } // end saver
168
+
169
+ // @ts-ignore
170
+ if (navigator.msSaveBlob) {
171
+ // IE10+ : (has Blob, but not a[download] or URL)
172
+ // @ts-ignore
173
+ return navigator.msSaveBlob(blob, fileName);
182
174
  }
183
175
 
184
- // Blob but not URL support:
185
- reader = new FileReader();
186
- reader.onload = function(e) {
187
- saver(this.result);
188
- };
189
- reader.readAsDataURL(blob);
190
- }
191
- return true;
176
+ if (self.URL) {
177
+ // simple fast and modern way using Blob and URL:
178
+ saver(self.URL.createObjectURL(blob), true);
179
+ } else {
180
+ // handle non-Blob()+non-URL browsers:
181
+ if (typeof blob === "string" || blob.constructor === toString) {
182
+ try {
183
+ // @ts-ignore
184
+ return saver("data:" + mimeType + ";base64," + self.btoa(blob));
185
+ } catch (y) {
186
+ // @ts-ignore
187
+ return saver("data:" + mimeType + "," + encodeURIComponent(blob));
188
+ }
189
+ }
190
+
191
+ // Blob but not URL support:
192
+ reader = new FileReader();
193
+ reader.onload = function (e) {
194
+ // @ts-ignore
195
+ saver(this.result);
196
+ };
197
+ reader.readAsDataURL(blob);
198
+ }
199
+ return true;
192
200
  }
@@ -1,4 +1,4 @@
1
- import { download } from "danx/src/helpers/download";
1
+ import { download } from "@ui/helpers/download";
2
2
 
3
3
  /**
4
4
  * Asynchronously load a file from the URL and trigger a download in the browser
@@ -9,42 +9,42 @@ import { download } from "danx/src/helpers/download";
9
9
  * @returns {Promise<void>}
10
10
  */
11
11
  export async function downloadFile(url, filename = "", postParams = null) {
12
- let fetchOptions = undefined;
12
+ let fetchOptions = undefined;
13
13
 
14
- if (postParams) {
15
- fetchOptions = {
16
- method: "POST",
17
- "Content-Type": "application/json",
18
- body: JSON.stringify(postParams)
19
- };
20
- }
14
+ if (postParams) {
15
+ fetchOptions = {
16
+ method: "POST",
17
+ "Content-Type": "application/json",
18
+ body: JSON.stringify(postParams)
19
+ };
20
+ }
21
21
 
22
- const response = await fetch(url, fetchOptions);
22
+ const response = await fetch(url, fetchOptions);
23
23
 
24
- if (!response.ok) {
25
- throw Error("File download failed: invalid response from server");
26
- }
24
+ if (!response.ok) {
25
+ throw Error("File download failed: invalid response from server");
26
+ }
27
27
 
28
- let errorMessage;
28
+ let errorMessage;
29
29
 
30
- // Handle a JSON response (which indicates an error occurred)
31
- try {
32
- // @ts-expect-error data is defined on response
33
- const jsonResponse = JSON.parse(new TextDecoder().decode(response.data));
34
- console.error("Error downloading file:", jsonResponse);
35
- errorMessage = jsonResponse.message;
36
- if (jsonResponse.errors) {
37
- errorMessage = jsonResponse.errors[0].message;
30
+ // Handle a JSON response (which indicates an error occurred)
31
+ try {
32
+ // @ts-expect-error data is defined on response
33
+ const jsonResponse = JSON.parse(new TextDecoder().decode(response.data));
34
+ console.error("Error downloading file:", jsonResponse);
35
+ errorMessage = jsonResponse.message;
36
+ if (jsonResponse.errors) {
37
+ errorMessage = jsonResponse.errors[0].message;
38
+ }
39
+ } catch (e) {
40
+ // we expect an error thrown for invalid JSON when the response is a file
38
41
  }
39
- } catch (e) {
40
- // we expect an error thrown for invalid JSON when the response is a file
41
- }
42
42
 
43
- if (errorMessage) {
44
- throw new Error("Failed to download file: " + errorMessage);
45
- }
43
+ if (errorMessage) {
44
+ throw new Error("Failed to download file: " + errorMessage);
45
+ }
46
46
 
47
- await downloadFileResponse(response, filename);
47
+ await downloadFileResponse(response, filename);
48
48
  }
49
49
 
50
50
  /**
@@ -54,24 +54,24 @@ export async function downloadFile(url, filename = "", postParams = null) {
54
54
  * @param filename
55
55
  */
56
56
  export async function downloadFileResponse(response, filename = "") {
57
- const contentDisposition = getResponseHeader(
58
- response,
59
- "content-disposition",
60
- ""
61
- );
57
+ const contentDisposition = getResponseHeader(
58
+ response,
59
+ "content-disposition",
60
+ ""
61
+ );
62
62
 
63
- const contentType = getResponseHeader(response, "content-type", "");
63
+ const contentType = getResponseHeader(response, "content-type", "");
64
64
 
65
- const match = contentDisposition.match(/filename="([^"]+)"/);
65
+ const match = contentDisposition.match(/filename="([^"]+)"/);
66
66
 
67
- filename = filename || (match && match[1]) || "download.pdf";
67
+ filename = filename || (match && match[1]) || "download.pdf";
68
68
 
69
- let data = response.data;
70
- if (!data) {
71
- data = await response.blob();
72
- }
69
+ let data = response.data;
70
+ if (!data) {
71
+ data = await response.blob();
72
+ }
73
73
 
74
- download(data, filename, contentType);
74
+ download(data, filename, contentType);
75
75
  }
76
76
 
77
77
  /**
@@ -82,11 +82,11 @@ export async function downloadFileResponse(response, filename = "") {
82
82
  * @returns {*}
83
83
  */
84
84
  export function getResponseHeader(response, header, defaultValue) {
85
- if (response.headers) {
86
- if (typeof response.headers.get === "function") {
87
- return response.headers.get(header) || defaultValue;
88
- } else {
89
- return response.headers[header] || defaultValue;
85
+ if (response.headers) {
86
+ if (typeof response.headers.get === "function") {
87
+ return response.headers.get(header) || defaultValue;
88
+ } else {
89
+ return response.headers[header] || defaultValue;
90
+ }
90
91
  }
91
- }
92
92
  }
@@ -1,52 +1,52 @@
1
- import { FlashMessages, useCompatibility } from "danx/src/helpers";
1
+ import { FlashMessages, useCompatibility } from "@ui/helpers";
2
2
  import ExifReader from "exifreader";
3
3
 
4
4
  export async function resolveFileLocation(file, waitMessage = null) {
5
- if (file.location) {
6
- return file.location;
7
- }
8
-
9
- try {
10
- const tags = await ExifReader.load(file.blobUrl || file.url, {
11
- expanded: true
12
- });
13
- if (tags.gps) {
14
- return {
15
- latitude: tags.gps.Latitude,
16
- longitude: tags.gps.Longitude
17
- };
5
+ if (file.location) {
6
+ return file.location;
18
7
  }
19
8
 
20
- const { waitForLocation, location } = useCompatibility();
9
+ try {
10
+ const tags = await ExifReader.load(file.blobUrl || file.url, {
11
+ expanded: true
12
+ });
13
+ if (tags.gps) {
14
+ return {
15
+ latitude: tags.gps.Latitude,
16
+ longitude: tags.gps.Longitude
17
+ };
18
+ }
19
+
20
+ const { waitForLocation, location } = useCompatibility();
21
21
 
22
- // Show a waiting for location message if we have not returned within 1 second
23
- if (waitMessage) {
24
- setTimeout(() => {
25
- if (!location.value && waitMessage) {
26
- FlashMessages.warning(waitMessage);
22
+ // Show a waiting for location message if we have not returned within 1 second
23
+ if (waitMessage) {
24
+ setTimeout(() => {
25
+ if (!location.value && waitMessage) {
26
+ FlashMessages.warning(waitMessage);
27
+ }
28
+ }, 1000);
27
29
  }
28
- }, 1000);
29
- }
30
30
 
31
- // Wait for the browser to return the location (https only as http will not return a location)
32
- if (window.location.protocol === "https:") {
33
- await waitForLocation();
34
- }
35
- // Ignore the wait message if we already returned
36
- waitMessage = false;
37
- if (!location.value) {
38
- return null;
39
- }
31
+ // Wait for the browser to return the location (https only as http will not return a location)
32
+ if (window.location.protocol === "https:") {
33
+ await waitForLocation();
34
+ }
35
+ // Ignore the wait message if we already returned
36
+ waitMessage = false;
37
+ if (!location.value) {
38
+ return null;
39
+ }
40
40
 
41
- return {
42
- latitude: location.value.latitude,
43
- longitude: location.value.longitude,
44
- accuracy: location.value.accuracy,
45
- altitude: location.value.altitude,
46
- altitudeAccuracy: location.value.altitudeAccuracy
47
- };
48
- } catch (error) {
49
- console.error(error);
50
- return null;
51
- }
41
+ return {
42
+ latitude: location.value.latitude,
43
+ longitude: location.value.longitude,
44
+ accuracy: location.value.accuracy,
45
+ altitude: location.value.altitude,
46
+ altitudeAccuracy: location.value.altitudeAccuracy
47
+ };
48
+ } catch (error) {
49
+ console.error(error);
50
+ return null;
51
+ }
52
52
  }
@@ -1,8 +1,10 @@
1
1
  export * from "./array";
2
2
  export * from "./compatibility";
3
+ export * from "./download";
3
4
  export * from "./files";
4
5
  export * from "./FileUpload";
5
6
  export * from "./FlashMessages";
7
+ export * from "./formats";
6
8
  export * from "./http";
7
9
  export * from "./multiFileUpload";
8
10
  export * from "./singleFileUpload";