quasar-ui-danx 0.3.53 → 0.3.55

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.53",
3
+ "version": "0.3.55",
4
4
  "author": "Dan <dan@flytedesk.com>",
5
5
  "description": "DanX Vue / Quasar component library",
6
6
  "license": "MIT",
@@ -81,11 +81,11 @@
81
81
 
82
82
  <div class="absolute top-1 right-1 flex items-center justify-between space-x-1">
83
83
  <QBtn
84
- v-if="downloadable && computedImage?.url"
84
+ v-if="downloadable && downloadUrl"
85
85
  size="sm"
86
86
  class="!p-1 opacity-70 hover:opacity-100"
87
87
  :class="downloadButtonClass"
88
- @click.stop="download(computedImage.url)"
88
+ @click.stop="download(downloadUrl)"
89
89
  >
90
90
  <DownloadIcon class="w-4 h-5" />
91
91
  </QBtn>
@@ -123,109 +123,112 @@
123
123
  </template>
124
124
 
125
125
  <script setup>
126
- import { DocumentTextIcon as TextFileIcon, DownloadIcon, PlayIcon } from "@heroicons/vue/outline";
127
- import { computed, ref } from "vue";
128
- import { download } from "../../../helpers";
129
- import { ImageIcon, PdfIcon, TrashIcon as RemoveIcon } from "../../../svg";
130
- import { FullScreenCarouselDialog } from "../Dialogs";
126
+ import { DocumentTextIcon as TextFileIcon, DownloadIcon, PlayIcon } from '@heroicons/vue/outline';
127
+ import { computed, ref } from 'vue';
128
+ import { download } from '../../../helpers';
129
+ import { ImageIcon, PdfIcon, TrashIcon as RemoveIcon } from '../../../svg';
130
+ import { FullScreenCarouselDialog } from '../Dialogs';
131
131
 
132
- const emit = defineEmits(["remove"]);
132
+ const emit = defineEmits(['remove']);
133
133
  const props = defineProps({
134
- src: {
135
- type: String,
136
- default: ""
137
- },
138
- image: {
139
- type: Object,
140
- default: null
141
- },
142
- imageFit: {
143
- type: String,
144
- default: "fill"
145
- },
146
- relatedFiles: {
147
- type: Array,
148
- default: null
149
- },
150
- missingIcon: {
151
- type: [Function, Object],
152
- default: ImageIcon
153
- },
154
- downloadButtonClass: {
155
- type: String,
156
- default: "bg-blue-600 text-white"
157
- },
158
- downloadable: Boolean,
159
- removable: Boolean,
160
- disabled: Boolean,
161
- square: Boolean
134
+ src: {
135
+ type: String,
136
+ default: ''
137
+ },
138
+ image: {
139
+ type: Object,
140
+ default: null
141
+ },
142
+ imageFit: {
143
+ type: String,
144
+ default: 'fill'
145
+ },
146
+ relatedFiles: {
147
+ type: Array,
148
+ default: null
149
+ },
150
+ missingIcon: {
151
+ type: [Function, Object],
152
+ default: ImageIcon
153
+ },
154
+ downloadButtonClass: {
155
+ type: String,
156
+ default: 'bg-blue-600 text-white'
157
+ },
158
+ downloadable: Boolean,
159
+ removable: Boolean,
160
+ disabled: Boolean,
161
+ square: Boolean
162
162
  });
163
163
 
164
164
  const showPreview = ref(false);
165
165
  const computedImage = computed(() => {
166
- if (props.image) {
167
- return props.image;
168
- } else if (props.src) {
169
- return {
170
- id: props.src,
171
- url: props.src,
172
- type: "image/" + props.src.split(".").pop().toLowerCase()
173
- };
174
- }
175
- return null;
166
+ if (props.image) {
167
+ return props.image;
168
+ } else if (props.src) {
169
+ return {
170
+ id: props.src,
171
+ url: props.src,
172
+ type: 'image/' + props.src.split('.').pop().toLowerCase()
173
+ };
174
+ }
175
+ return null;
176
176
  });
177
177
  const previewFile = computed(() => {
178
- const transcodes = computedImage.value?.transcodes;
179
- return transcodes?.mp4 || transcodes?.compress || computedImage.value;
178
+ const transcodes = computedImage.value?.transcodes;
179
+ return transcodes?.mp4 || transcodes?.compress || computedImage.value;
180
180
  });
181
181
 
182
182
  const mimeType = computed(
183
- () => previewFile.value?.type || previewFile.value?.mime || (computedImage.value?.transcodes?.mp4 ? "video/mp4" : "")
183
+ () => previewFile.value?.type || previewFile.value?.mime || (computedImage.value?.transcodes?.mp4 ? 'video/mp4' : '')
184
184
  );
185
185
  const isImage = computed(() => !!mimeType.value.match(/^image\//));
186
186
  const isVideo = computed(() => !!mimeType.value.match(/^video\//));
187
187
  const isPdf = computed(() => !!mimeType.value.match(/^application\/pdf/));
188
188
 
189
189
  const previewUrl = computed(() => {
190
- return previewFile.value?.blobUrl || previewFile.value?.url;
190
+ return previewFile.value?.blobUrl || previewFile.value?.url;
191
191
  });
192
192
  const thumbUrl = computed(() => {
193
- return computedImage.value?.transcodes?.thumb?.url;
193
+ return computedImage.value?.transcodes?.thumb?.url;
194
194
  });
195
195
  const isPreviewable = computed(() => {
196
- return !!thumbUrl.value || isVideo.value || isImage.value;
196
+ return !!thumbUrl.value || isVideo.value || isImage.value;
197
+ });
198
+ const downloadUrl = computed(() => {
199
+ return computedImage.value?.original?.url || computedImage.value?.url;
197
200
  });
198
201
  const isConfirmingRemove = ref(false);
199
202
  function onRemove() {
200
- if (!isConfirmingRemove.value) {
201
- isConfirmingRemove.value = true;
202
- setTimeout(() => {
203
- isConfirmingRemove.value = false;
204
- }, 2000);
205
- } else {
206
- emit("remove");
207
- }
203
+ if (!isConfirmingRemove.value) {
204
+ isConfirmingRemove.value = true;
205
+ setTimeout(() => {
206
+ isConfirmingRemove.value = false;
207
+ }, 2000);
208
+ } else {
209
+ emit('remove');
210
+ }
208
211
  }
209
212
  </script>
210
213
 
211
214
  <style module="cls" lang="scss">
212
215
  .action-button {
213
- position: absolute;
214
- bottom: 1.5em;
215
- right: 1em;
216
- z-index: 1;
216
+ position: absolute;
217
+ bottom: 1.5em;
218
+ right: 1em;
219
+ z-index: 1;
217
220
  }
218
221
 
219
222
  .play-button {
220
- position: absolute;
221
- top: 0;
222
- left: 0;
223
- display: flex;
224
- justify-content: center;
225
- align-items: center;
226
- width: 100%;
227
- height: 100%;
228
- pointer-events: none;
229
- @apply text-blue-200;
223
+ position: absolute;
224
+ top: 0;
225
+ left: 0;
226
+ display: flex;
227
+ justify-content: center;
228
+ align-items: center;
229
+ width: 100%;
230
+ height: 100%;
231
+ pointer-events: none;
232
+ @apply text-blue-200;
230
233
  }
231
234
  </style>