quasar-ui-danx 0.3.36 → 0.3.38

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quasar-ui-danx",
3
- "version": "0.3.36",
3
+ "version": "0.3.38",
4
4
  "author": "Dan <dan@flytedesk.com>",
5
5
  "description": "DanX Vue / Quasar component library",
6
6
  "license": "MIT",
@@ -60,6 +60,7 @@ function upload() {
60
60
  * @returns {Promise<void>}
61
61
  */
62
62
  async function onAttachFiles({ target: { files } }) {
63
+ console.log("files attached", files);
63
64
  emit("uploading", files);
64
65
  let fileUpload = new FileUpload(files)
65
66
  .onProgress(({ file, progress }) => {
@@ -73,6 +74,9 @@ async function onAttachFiles({ target: { files } }) {
73
74
  emit("complete", fileUpload.files);
74
75
  });
75
76
 
77
+ console.log("created fileUpload", fileUpload);
78
+
79
+ debugger;
76
80
  if (props.geolocation) {
77
81
  await fileUpload.resolveLocation(props.locationWaitMessage);
78
82
  }
@@ -268,7 +268,7 @@ export class FileUpload {
268
268
  * Start uploading all files
269
269
  */
270
270
  async upload() {
271
- console.log && console.log("FileUploader@upload()", this.fileUploads, this.options);
271
+ console.log && console.log("FileUploader@upload():", this.fileUploads, this.options);
272
272
  for (const fileUpload of this.fileUploads) {
273
273
  const mimeType = fileUpload.file.mimeType || fileUpload.file.type;
274
274
  const presignedUrl = this.options.presignedUploadUrl(this.options.directory, fileUpload.file.name, mimeType);
@@ -305,6 +305,8 @@ export class FileUpload {
305
305
  // Set all the callbacks on the XHR requests
306
306
  this.setXhrCallbacks();
307
307
 
308
+ console.log && console.log("FileUploader@upload():", "sending uploads");
309
+
308
310
  // Send all the XHR file uploads
309
311
  for (const fileUpload of this.fileUploads) {
310
312
  fileUpload.xhr.send(fileUpload.body);
@@ -114,58 +114,49 @@ export function download(data, strFileName, strMimeType) {
114
114
  }
115
115
 
116
116
  function saver(url, winMode) {
117
+ // Detect Chrome on iPhone (or any iOS device using WebKit)
118
+ const isIOSChrome =
119
+ /CriOS/.test(navigator.userAgent) && /iP(hone|od|ad)/.test(navigator.platform);
120
+
121
+ if (isIOSChrome) {
122
+ window.open(url, "_blank");
123
+
124
+ return true;
125
+ }
126
+
117
127
  if ("download" in anchor) {
118
- // html5 A[download]
128
+ // HTML5 A[download]
119
129
  anchor.href = url;
120
130
  anchor.setAttribute("download", fileName);
121
- anchor.className = "download-js-link";
122
- anchor.innerHTML = "downloading...";
123
131
  anchor.style.display = "none";
124
- anchor.target = "_blank";
125
132
  document.body.appendChild(anchor);
126
- setTimeout(function () {
133
+
134
+ setTimeout(() => {
127
135
  anchor.click();
128
136
  document.body.removeChild(anchor);
137
+
129
138
  if (winMode === true) {
130
- setTimeout(function () {
131
- self.URL.revokeObjectURL(anchor.href);
139
+ setTimeout(() => {
140
+ URL.revokeObjectURL(anchor.href); // Release the Object URL
132
141
  }, 250);
133
142
  }
134
- }, 66);
135
- return true;
136
- }
143
+ }, 0);
137
144
 
138
- // handle non-a[download] safari as best we can:
139
- if (
140
- /(Version)\/(\d+)\.(\d+)(?:\.(\d+))?.*Safari\//.test(navigator.userAgent)
141
- ) {
142
- url = url.replace(/^data:([\w/\-+]+)/, defaultMime);
143
- if (!window.open(url)) {
144
- // popup blocked, offer direct download:
145
- if (
146
- confirm(
147
- "Displaying New Document\n\nUse Save As... to download, then click back to return to this page."
148
- )
149
- ) {
150
- location.href = url;
151
- }
152
- }
153
145
  return true;
154
146
  }
155
147
 
156
- // do iframe dataURL download (old ch+FF):
157
- var f = document.createElement("iframe");
158
- document.body.appendChild(f);
148
+ // General fallback for unsupported browsers
149
+ const fallbackIframe = document.createElement("iframe");
150
+ fallbackIframe.style.display = "none";
151
+ fallbackIframe.src = url;
152
+ document.body.appendChild(fallbackIframe);
159
153
 
160
- if (!winMode) {
161
- // force a mime that will download:
162
- url = "data:" + url.replace(/^data:([\w/\-+]+)/, defaultMime);
163
- }
164
- f.src = url;
165
- setTimeout(function () {
166
- document.body.removeChild(f);
167
- }, 333);
168
- } // end saver
154
+ setTimeout(() => {
155
+ document.body.removeChild(fallbackIframe);
156
+ }, 5000); // Clean up iframe after 5 seconds
157
+
158
+ return true;
159
+ }
169
160
 
170
161
  // @ts-ignore
171
162
  if (navigator.msSaveBlob) {