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/dist/danx.es.js +748 -746
- package/dist/danx.es.js.map +1 -1
- package/dist/danx.umd.js +4 -4
- package/dist/danx.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Utility/Files/FilePreview.vue +77 -74
package/package.json
CHANGED
|
@@ -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 &&
|
|
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(
|
|
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
|
|
127
|
-
import { computed, ref } from
|
|
128
|
-
import { download } from
|
|
129
|
-
import { ImageIcon, PdfIcon, TrashIcon as RemoveIcon } from
|
|
130
|
-
import { FullScreenCarouselDialog } from
|
|
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([
|
|
132
|
+
const emit = defineEmits(['remove']);
|
|
133
133
|
const props = defineProps({
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
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
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
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
|
-
|
|
179
|
-
|
|
178
|
+
const transcodes = computedImage.value?.transcodes;
|
|
179
|
+
return transcodes?.mp4 || transcodes?.compress || computedImage.value;
|
|
180
180
|
});
|
|
181
181
|
|
|
182
182
|
const mimeType = computed(
|
|
183
|
-
|
|
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
|
-
|
|
190
|
+
return previewFile.value?.blobUrl || previewFile.value?.url;
|
|
191
191
|
});
|
|
192
192
|
const thumbUrl = computed(() => {
|
|
193
|
-
|
|
193
|
+
return computedImage.value?.transcodes?.thumb?.url;
|
|
194
194
|
});
|
|
195
195
|
const isPreviewable = computed(() => {
|
|
196
|
-
|
|
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
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
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
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
216
|
+
position: absolute;
|
|
217
|
+
bottom: 1.5em;
|
|
218
|
+
right: 1em;
|
|
219
|
+
z-index: 1;
|
|
217
220
|
}
|
|
218
221
|
|
|
219
222
|
.play-button {
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
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>
|