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/dist/danx.es.js +753 -747
- 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 +78 -71
package/package.json
CHANGED
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
</div>
|
|
32
32
|
<QImg
|
|
33
33
|
v-if="thumbUrl || isPreviewable"
|
|
34
|
-
fit="
|
|
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 &&
|
|
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,105 +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
|
-
|
|
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
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
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
|
-
|
|
175
|
-
|
|
178
|
+
const transcodes = computedImage.value?.transcodes;
|
|
179
|
+
return transcodes?.mp4 || transcodes?.compress || computedImage.value;
|
|
176
180
|
});
|
|
177
181
|
|
|
178
182
|
const mimeType = computed(
|
|
179
|
-
|
|
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
|
-
|
|
190
|
+
return previewFile.value?.blobUrl || previewFile.value?.url;
|
|
187
191
|
});
|
|
188
192
|
const thumbUrl = computed(() => {
|
|
189
|
-
|
|
193
|
+
return computedImage.value?.transcodes?.thumb?.url;
|
|
190
194
|
});
|
|
191
195
|
const isPreviewable = computed(() => {
|
|
192
|
-
|
|
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
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
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
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
216
|
+
position: absolute;
|
|
217
|
+
bottom: 1.5em;
|
|
218
|
+
right: 1em;
|
|
219
|
+
z-index: 1;
|
|
213
220
|
}
|
|
214
221
|
|
|
215
222
|
.play-button {
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
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>
|