quasar-ui-danx 0.3.52 → 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.52",
3
+ "version": "0.3.55",
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
  </div>
32
32
  <QImg
33
33
  v-if="thumbUrl || isPreviewable"
34
- fit="fill"
34
+ :fit="imageFit"
35
35
  class="non-selectable max-h-full max-w-full h-full"
36
36
  :src="(thumbUrl || previewUrl) + '#t=0.1'"
37
37
  preload="auto"
@@ -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,105 +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
- relatedFiles: {
143
- type: Array,
144
- default: null
145
- },
146
- missingIcon: {
147
- type: [Function, Object],
148
- default: ImageIcon
149
- },
150
- downloadButtonClass: {
151
- type: String,
152
- default: "bg-blue-600 text-white"
153
- },
154
- downloadable: Boolean,
155
- removable: Boolean,
156
- disabled: Boolean,
157
- 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
158
162
  });
159
163
 
160
164
  const showPreview = ref(false);
161
165
  const computedImage = computed(() => {
162
- if (props.image) {
163
- return props.image;
164
- } else if (props.src) {
165
- return {
166
- id: props.src,
167
- url: props.src,
168
- type: "image/" + props.src.split(".").pop().toLowerCase()
169
- };
170
- }
171
- 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;
172
176
  });
173
177
  const previewFile = computed(() => {
174
- const transcodes = computedImage.value?.transcodes;
175
- return transcodes?.mp4 || transcodes?.compress || computedImage.value;
178
+ const transcodes = computedImage.value?.transcodes;
179
+ return transcodes?.mp4 || transcodes?.compress || computedImage.value;
176
180
  });
177
181
 
178
182
  const mimeType = computed(
179
- () => 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' : '')
180
184
  );
181
185
  const isImage = computed(() => !!mimeType.value.match(/^image\//));
182
186
  const isVideo = computed(() => !!mimeType.value.match(/^video\//));
183
187
  const isPdf = computed(() => !!mimeType.value.match(/^application\/pdf/));
184
188
 
185
189
  const previewUrl = computed(() => {
186
- return previewFile.value?.blobUrl || previewFile.value?.url;
190
+ return previewFile.value?.blobUrl || previewFile.value?.url;
187
191
  });
188
192
  const thumbUrl = computed(() => {
189
- return computedImage.value?.transcodes?.thumb?.url;
193
+ return computedImage.value?.transcodes?.thumb?.url;
190
194
  });
191
195
  const isPreviewable = computed(() => {
192
- 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;
193
200
  });
194
201
  const isConfirmingRemove = ref(false);
195
202
  function onRemove() {
196
- if (!isConfirmingRemove.value) {
197
- isConfirmingRemove.value = true;
198
- setTimeout(() => {
199
- isConfirmingRemove.value = false;
200
- }, 2000);
201
- } else {
202
- emit("remove");
203
- }
203
+ if (!isConfirmingRemove.value) {
204
+ isConfirmingRemove.value = true;
205
+ setTimeout(() => {
206
+ isConfirmingRemove.value = false;
207
+ }, 2000);
208
+ } else {
209
+ emit('remove');
210
+ }
204
211
  }
205
212
  </script>
206
213
 
207
214
  <style module="cls" lang="scss">
208
215
  .action-button {
209
- position: absolute;
210
- bottom: 1.5em;
211
- right: 1em;
212
- z-index: 1;
216
+ position: absolute;
217
+ bottom: 1.5em;
218
+ right: 1em;
219
+ z-index: 1;
213
220
  }
214
221
 
215
222
  .play-button {
216
- position: absolute;
217
- top: 0;
218
- left: 0;
219
- display: flex;
220
- justify-content: center;
221
- align-items: center;
222
- width: 100%;
223
- height: 100%;
224
- pointer-events: none;
225
- @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;
226
233
  }
227
234
  </style>