quasar-ui-danx 0.3.12 → 0.3.21
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
@@ -8,12 +8,13 @@
|
|
8
8
|
{{ text }}
|
9
9
|
</slot>
|
10
10
|
|
11
|
+
{{ "accept: " + ((geolocation && cameraOnly) ? "image/*;capture=camera" : undefined) }}
|
11
12
|
<input
|
12
13
|
ref="fileUpload"
|
13
14
|
data-testid="file-upload"
|
14
15
|
type="file"
|
15
|
-
:accept="geolocation ? 'image/*;capture=camera' : undefined"
|
16
|
-
:capture="geolocation ? 'environment' : undefined"
|
16
|
+
:accept="(geolocation && cameraOnly) ? 'image/*;capture=camera' : undefined"
|
17
|
+
:capture="(geolocation && cameraOnly) ? 'environment' : undefined"
|
17
18
|
class="hidden"
|
18
19
|
multiple
|
19
20
|
@change="onAttachFiles"
|
@@ -28,28 +29,29 @@ import { FileUpload } from "../../../../helpers";
|
|
28
29
|
|
29
30
|
defineExpose({ upload });
|
30
31
|
const emit = defineEmits([
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
32
|
+
"uploading",
|
33
|
+
"file-progress",
|
34
|
+
"file-complete",
|
35
|
+
"complete"
|
35
36
|
]);
|
36
37
|
const props = defineProps({
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
38
|
+
...QBtn.props,
|
39
|
+
text: {
|
40
|
+
type: String,
|
41
|
+
default: "Add File"
|
42
|
+
},
|
43
|
+
locationWaitMessage: {
|
44
|
+
type: String,
|
45
|
+
default: "Waiting for location..."
|
46
|
+
},
|
47
|
+
cameraOnly: Boolean,
|
48
|
+
geolocation: Boolean
|
47
49
|
});
|
48
50
|
|
49
51
|
const fileUpload = ref(null);
|
50
52
|
|
51
53
|
function upload() {
|
52
|
-
|
54
|
+
fileUpload.value.click();
|
53
55
|
}
|
54
56
|
|
55
57
|
/**
|
@@ -59,23 +61,23 @@ function upload() {
|
|
59
61
|
* @returns {Promise<void>}
|
60
62
|
*/
|
61
63
|
async function onAttachFiles({ target: { files } }) {
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
64
|
+
emit("uploading", files);
|
65
|
+
let fileUpload = new FileUpload(files)
|
66
|
+
.onProgress(({ file, progress }) => {
|
67
|
+
file.progress = progress;
|
68
|
+
emit("file-progress", file);
|
69
|
+
})
|
70
|
+
.onComplete(({ file, uploadedFile }) => {
|
71
|
+
emit("file-complete", { file, uploadedFile });
|
72
|
+
})
|
73
|
+
.onAllComplete(() => {
|
74
|
+
emit("complete", fileUpload.files);
|
75
|
+
});
|
74
76
|
|
75
|
-
|
76
|
-
|
77
|
-
|
77
|
+
if (props.geolocation) {
|
78
|
+
await fileUpload.resolveLocation(props.locationWaitMessage);
|
79
|
+
}
|
78
80
|
|
79
|
-
|
81
|
+
fileUpload.upload();
|
80
82
|
}
|
81
83
|
</script>
|