quasar-ui-danx 0.3.33 → 0.3.34

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.33",
3
+ "version": "0.3.34",
4
4
  "author": "Dan <dan@flytedesk.com>",
5
5
  "description": "DanX Vue / Quasar component library",
6
6
  "license": "MIT",
@@ -31,7 +31,7 @@
31
31
  >
32
32
  <source
33
33
  :src="getPreviewUrl(file) + '#t=0.1'"
34
- :type="file.mime"
34
+ :type="getPreviewFileMime(file)"
35
35
  >
36
36
  </video>
37
37
  </template>
@@ -72,9 +72,16 @@ function isVideo(file) {
72
72
  return file.mime?.startsWith("video");
73
73
  }
74
74
 
75
+ function getPreviewFile(file) {
76
+ return file.transcodes?.mp4 || file.transcodes?.compress || file;
77
+ }
78
+ function getPreviewFileMime(file) {
79
+ return getPreviewFile(file).mime || (isVideo(file) ? "video/mp4" : "");
80
+ }
81
+
75
82
  function getPreviewUrl(file) {
76
- const transcodes = file?.transcodes;
77
- return transcodes?.mp4?.url || transcodes?.compress?.url || file.blobUrl || file.url;
83
+ file = getPreviewFile(file);
84
+ return file.blobUrl || file.url;
78
85
  }
79
86
 
80
87
  function getThumbUrl(file) {
@@ -161,20 +161,20 @@ const computedImage = computed(() => {
161
161
  }
162
162
  return null;
163
163
  });
164
+ const previewFile = computed(() => {
165
+ const transcodes = computedImage.value?.transcodes;
166
+ return transcodes?.mp4 || transcodes?.compress || computedImage.value;
167
+ });
168
+
164
169
  const mimeType = computed(
165
- () => computedImage.value?.type || computedImage.value?.mime || ""
170
+ () => previewFile.value?.type || previewFile.value?.mime || (computedImage.value?.transcodes?.mp4 ? "video/mp4" : "")
166
171
  );
167
172
  const isImage = computed(() => !!mimeType.value.match(/^image\//));
168
173
  const isVideo = computed(() => !!mimeType.value.match(/^video\//));
169
174
  const isPdf = computed(() => !!mimeType.value.match(/^application\/pdf/));
170
- const previewUrl = computed(() => {
171
- const transcodes = computedImage.value?.transcodes;
172
-
173
- if (isVideo.value && transcodes?.mp4?.url) {
174
- return transcodes.mp4.url;
175
- }
176
175
 
177
- return transcodes?.compress?.url || computedImage.value?.blobUrl || computedImage.value?.url;
176
+ const previewUrl = computed(() => {
177
+ return previewFile.value?.blobUrl || previewFile.value?.url;
178
178
  });
179
179
  const thumbUrl = computed(() => {
180
180
  return computedImage.value?.transcodes?.thumb?.url;