quasar-ui-danx 0.3.12 → 0.3.21

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quasar-ui-danx",
3
- "version": "0.3.12",
3
+ "version": "0.3.21",
4
4
  "author": "Dan <dan@flytedesk.com>",
5
5
  "description": "DanX Vue / Quasar component library",
6
6
  "license": "MIT",
@@ -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
- "uploading",
32
- "file-progress",
33
- "file-complete",
34
- "complete"
32
+ "uploading",
33
+ "file-progress",
34
+ "file-complete",
35
+ "complete"
35
36
  ]);
36
37
  const props = defineProps({
37
- ...QBtn.props,
38
- text: {
39
- type: String,
40
- default: "Add File"
41
- },
42
- locationWaitMessage: {
43
- type: String,
44
- default: "Waiting for location..."
45
- },
46
- geolocation: Boolean
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
- fileUpload.value.click();
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
- emit("uploading", files);
63
- let fileUpload = new FileUpload(files)
64
- .onProgress(({ file, progress }) => {
65
- file.progress = progress;
66
- emit("file-progress", file);
67
- })
68
- .onComplete(({ file, uploadedFile }) => {
69
- emit("file-complete", { file, uploadedFile });
70
- })
71
- .onAllComplete(() => {
72
- emit("complete", fileUpload.files);
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
- if (props.geolocation) {
76
- await fileUpload.resolveLocation(props.locationWaitMessage);
77
- }
77
+ if (props.geolocation) {
78
+ await fileUpload.resolveLocation(props.locationWaitMessage);
79
+ }
78
80
 
79
- fileUpload.upload();
81
+ fileUpload.upload();
80
82
  }
81
83
  </script>