quasar-ui-danx 0.3.22 → 0.3.24
Sign up to get free protection for your applications and to get access to all the features.
package/package.json
CHANGED
@@ -30,7 +30,7 @@
|
|
30
30
|
controls
|
31
31
|
>
|
32
32
|
<source
|
33
|
-
:src="file
|
33
|
+
:src="getPreviewUrl(file) + '#t=0.1'"
|
34
34
|
:type="file.mime"
|
35
35
|
>
|
36
36
|
</video>
|
@@ -38,7 +38,7 @@
|
|
38
38
|
<img
|
39
39
|
v-else
|
40
40
|
:alt="file.filename"
|
41
|
-
:src="file
|
41
|
+
:src="getPreviewUrl(file)"
|
42
42
|
>
|
43
43
|
</div>
|
44
44
|
</QCarouselSlide>
|
@@ -56,54 +56,59 @@ import { XIcon as CloseIcon } from "../../../svg";
|
|
56
56
|
|
57
57
|
defineEmits(["close"]);
|
58
58
|
const props = defineProps({
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
59
|
+
files: {
|
60
|
+
type: Array,
|
61
|
+
default: () => []
|
62
|
+
},
|
63
|
+
defaultSlide: {
|
64
|
+
type: String,
|
65
|
+
default: ""
|
66
|
+
}
|
67
67
|
});
|
68
68
|
|
69
69
|
const carousel = ref(null);
|
70
70
|
const currentSlide = ref(props.defaultSlide);
|
71
71
|
function isVideo(file) {
|
72
|
-
|
72
|
+
return file.mime?.startsWith("video");
|
73
73
|
}
|
74
|
+
|
75
|
+
function getPreviewUrl(file) {
|
76
|
+
return file.transcodes?.compress?.url || file.blobUrl || file.url;
|
77
|
+
}
|
78
|
+
|
74
79
|
function getThumbUrl(file) {
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
80
|
+
if (file.thumb) {
|
81
|
+
return file.thumb.url;
|
82
|
+
} else if (isVideo(file)) {
|
83
|
+
// Base64 encode a PlayIcon for the placeholder image
|
84
|
+
return `data:image/svg+xml;base64,${btoa(
|
85
|
+
`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white"><path d="M0 0h24v24H0z" fill="none"/><path d="M8 5v14l11-7z"/></svg>`
|
86
|
+
)}`;
|
87
|
+
} else {
|
88
|
+
return getPreviewUrl(file);
|
89
|
+
}
|
85
90
|
}
|
86
91
|
</script>
|
87
92
|
<style module="cls" lang="scss">
|
88
93
|
.slide-image {
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
94
|
+
width: 100%;
|
95
|
+
height: 100%;
|
96
|
+
background: black;
|
97
|
+
display: flex;
|
98
|
+
justify-content: center;
|
99
|
+
align-items: center;
|
95
100
|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
+
img {
|
102
|
+
max-height: 100%;
|
103
|
+
max-width: 100%;
|
104
|
+
object-fit: contain;
|
105
|
+
}
|
101
106
|
}
|
102
107
|
|
103
108
|
.carousel {
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
109
|
+
:deep(.q-carousel__navigation--bottom) {
|
110
|
+
position: relative;
|
111
|
+
bottom: 8em;
|
112
|
+
}
|
108
113
|
}
|
109
114
|
</style>
|
@@ -27,7 +27,7 @@
|
|
27
27
|
</div>
|
28
28
|
<QImg
|
29
29
|
v-if="thumbUrl || isPreviewable"
|
30
|
-
fit="
|
30
|
+
fit="fill"
|
31
31
|
class="non-selectable max-h-full max-w-full h-full"
|
32
32
|
:src="(thumbUrl || previewUrl) + '#t=0.1'"
|
33
33
|
preload="auto"
|
@@ -122,91 +122,91 @@ import { FullScreenCarouselDialog } from "../Dialogs";
|
|
122
122
|
|
123
123
|
const emit = defineEmits(["remove"]);
|
124
124
|
const props = defineProps({
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
125
|
+
src: {
|
126
|
+
type: String,
|
127
|
+
default: ""
|
128
|
+
},
|
129
|
+
image: {
|
130
|
+
type: Object,
|
131
|
+
default: null
|
132
|
+
},
|
133
|
+
relatedFiles: {
|
134
|
+
type: Array,
|
135
|
+
default: null
|
136
|
+
},
|
137
|
+
missingIcon: {
|
138
|
+
type: [Function, Object],
|
139
|
+
default: ImageIcon
|
140
|
+
},
|
141
|
+
downloadButtonClass: {
|
142
|
+
type: String,
|
143
|
+
default: "bg-blue-600 text-white"
|
144
|
+
},
|
145
|
+
downloadable: Boolean,
|
146
|
+
removable: Boolean,
|
147
|
+
disabled: Boolean,
|
148
|
+
square: Boolean
|
149
149
|
});
|
150
150
|
|
151
151
|
const showPreview = ref(false);
|
152
152
|
const computedImage = computed(() => {
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
153
|
+
if (props.image) {
|
154
|
+
return props.image;
|
155
|
+
} else if (props.src) {
|
156
|
+
return {
|
157
|
+
id: props.src,
|
158
|
+
url: props.src,
|
159
|
+
type: "image/" + props.src.split(".").pop().toLowerCase()
|
160
|
+
};
|
161
|
+
}
|
162
|
+
return null;
|
163
163
|
});
|
164
164
|
const mimeType = computed(
|
165
|
-
|
165
|
+
() => computedImage.value?.type || computedImage.value?.mime || ""
|
166
166
|
);
|
167
|
-
const isImage = computed(() => mimeType.value.match(/^image\//));
|
168
|
-
const isVideo = computed(() => mimeType.value.match(/^video\//));
|
169
|
-
const isPdf = computed(() => mimeType.value.match(/^application\/pdf/));
|
167
|
+
const isImage = computed(() => !!mimeType.value.match(/^image\//));
|
168
|
+
const isVideo = computed(() => !!mimeType.value.match(/^video\//));
|
169
|
+
const isPdf = computed(() => !!mimeType.value.match(/^application\/pdf/));
|
170
170
|
const previewUrl = computed(
|
171
|
-
|
171
|
+
() => computedImage.value?.transcodes?.compress?.url || computedImage.value?.blobUrl || computedImage.value?.url
|
172
172
|
);
|
173
173
|
const thumbUrl = computed(() => {
|
174
|
-
|
174
|
+
return computedImage.value?.transcodes?.thumb?.url;
|
175
175
|
});
|
176
176
|
const isPreviewable = computed(() => {
|
177
|
-
|
177
|
+
return !!thumbUrl.value || isVideo.value || isImage.value;
|
178
178
|
});
|
179
179
|
const isConfirmingRemove = ref(false);
|
180
180
|
function onRemove() {
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
181
|
+
if (!isConfirmingRemove.value) {
|
182
|
+
isConfirmingRemove.value = true;
|
183
|
+
setTimeout(() => {
|
184
|
+
isConfirmingRemove.value = false;
|
185
|
+
}, 2000);
|
186
|
+
} else {
|
187
|
+
emit("remove");
|
188
|
+
}
|
189
189
|
}
|
190
190
|
</script>
|
191
191
|
|
192
192
|
<style module="cls" lang="scss">
|
193
193
|
.action-button {
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
194
|
+
position: absolute;
|
195
|
+
bottom: 1.5em;
|
196
|
+
right: 1em;
|
197
|
+
z-index: 1;
|
198
198
|
}
|
199
199
|
|
200
200
|
.play-button {
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
201
|
+
position: absolute;
|
202
|
+
top: 0;
|
203
|
+
left: 0;
|
204
|
+
display: flex;
|
205
|
+
justify-content: center;
|
206
|
+
align-items: center;
|
207
|
+
width: 100%;
|
208
|
+
height: 100%;
|
209
|
+
pointer-events: none;
|
210
|
+
@apply text-blue-200;
|
211
211
|
}
|
212
212
|
</style>
|