quasar-ui-danx 0.3.40 → 0.3.41
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/dist/danx.es.js +2074 -2062
- package/dist/danx.es.js.map +1 -1
- package/dist/danx.umd.js +4 -4
- package/dist/danx.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ActionTable/Form/Fields/FileUploadButton.vue +27 -2
package/package.json
CHANGED
@@ -24,7 +24,7 @@
|
|
24
24
|
import { PlusIcon } from "@heroicons/vue/outline";
|
25
25
|
import { QBtn } from "quasar";
|
26
26
|
import { ref } from "vue";
|
27
|
-
import { FileUpload } from "../../../../helpers";
|
27
|
+
import { downloadFile, fDateTime, FileUpload, sleep } from "../../../../helpers";
|
28
28
|
|
29
29
|
defineExpose({ upload });
|
30
30
|
const emit = defineEmits([
|
@@ -44,7 +44,12 @@ const props = defineProps({
|
|
44
44
|
default: "Waiting for location..."
|
45
45
|
},
|
46
46
|
cameraOnly: Boolean,
|
47
|
-
geolocation: Boolean
|
47
|
+
geolocation: Boolean,
|
48
|
+
autoDownloadCapture: Boolean,
|
49
|
+
downloadName: {
|
50
|
+
type: String,
|
51
|
+
default: "Upload"
|
52
|
+
}
|
48
53
|
});
|
49
54
|
|
50
55
|
const fileUpload = ref(null);
|
@@ -61,6 +66,10 @@ function upload() {
|
|
61
66
|
*/
|
62
67
|
async function onAttachFiles({ target: { files } }) {
|
63
68
|
console.log("files attached", files);
|
69
|
+
if (props.autoDownloadCapture) {
|
70
|
+
await saveFilesLocally(files);
|
71
|
+
}
|
72
|
+
console.log("uploading files");
|
64
73
|
emit("uploading", files);
|
65
74
|
let fileUpload = new FileUpload(files)
|
66
75
|
.onProgress(({ file, progress }) => {
|
@@ -83,4 +92,20 @@ async function onAttachFiles({ target: { files } }) {
|
|
83
92
|
|
84
93
|
fileUpload.upload();
|
85
94
|
}
|
95
|
+
|
96
|
+
|
97
|
+
async function saveFilesLocally(files) {
|
98
|
+
// Make sure the blob URL is set before saving
|
99
|
+
await sleep(10);
|
100
|
+
|
101
|
+
for (let file of files) {
|
102
|
+
let fileName = props.downloadName + "-" + fDateTime(null, { format: " M-d-yy h:mm a" });
|
103
|
+
if (file.name) {
|
104
|
+
fileName += "__" + file.name;
|
105
|
+
} else {
|
106
|
+
fileName += "." + (file.mime || file.type).split("/").pop() || "jpg";
|
107
|
+
}
|
108
|
+
await downloadFile(file.blobUrl, fileName);
|
109
|
+
}
|
110
|
+
}
|
86
111
|
</script>
|