eztech-core-components 1.0.11 → 1.0.13
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/comps/CoreFiles.vue +17 -13
- package/comps/CoreTableImage.vue +1 -1
- package/comps/CoreUploadImage.vue +5 -5
- package/package.json +1 -1
- package/readme.md +1 -0
package/comps/CoreFiles.vue
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
>
|
|
10
10
|
<img
|
|
11
11
|
v-if="value"
|
|
12
|
-
:src="`/api${permittedPath}/${value?._id}?tid=${value?.tid}`"
|
|
12
|
+
:src="value?.public_link || `/api${permittedPath}/${value?._id}?tid=${value?.tid}`"
|
|
13
13
|
class="h-full w-full rounded object-cover object-center cursor-zoom-in"
|
|
14
14
|
@click="currentFullImage = value"
|
|
15
15
|
>
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
<img
|
|
43
43
|
v-if="['image', 'icon'].includes(fileType)"
|
|
44
44
|
class="w-20 h-20 object-contain max-h-full max-w-full border-r rounded-l image-rounded-l cursor-zoom-in"
|
|
45
|
-
:src="image.url || `/api${permittedPath}/${image?._id}?tid=${image.tid}`"
|
|
45
|
+
:src="image.url || image?.public_link || `/api${permittedPath}/${image?._id}?tid=${image.tid}`"
|
|
46
46
|
@click="currentFullImage = image"
|
|
47
47
|
>
|
|
48
48
|
<div v-else class="text-lg py-3 pl-3">
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
<div class="w-full py-1">
|
|
61
61
|
<a
|
|
62
62
|
class="hover:underline"
|
|
63
|
-
:href="`/api${permittedPath}/${image?._id}?tid=${image.tid}`"
|
|
63
|
+
:href="image?.public_link || `/api${permittedPath}/${image?._id}?tid=${image.tid}`"
|
|
64
64
|
target="_blank"
|
|
65
65
|
>
|
|
66
66
|
<span>{{ image.originalname }}</span>
|
|
@@ -155,7 +155,7 @@
|
|
|
155
155
|
<div v-if="currentFullImage" class="fixed h-screen w-screen bg-black z-50 left-0 top-0 flex flex-row">
|
|
156
156
|
<div class="flex-1 flex items-center justify-center relative">
|
|
157
157
|
<img
|
|
158
|
-
:src="currentFullImage?.url || `/api${permittedPath}/${currentFullImage._id}?tid=${currentFullImage.tid}`"
|
|
158
|
+
:src="currentFullImage?.url || currentFullImage?.public_link || `/api${permittedPath}/${currentFullImage._id}?tid=${currentFullImage.tid}`"
|
|
159
159
|
class="object-contain border rounded max-h-screen"
|
|
160
160
|
>
|
|
161
161
|
<div class="absolute top-3 right-3">
|
|
@@ -166,7 +166,7 @@
|
|
|
166
166
|
<img
|
|
167
167
|
v-for="image in images"
|
|
168
168
|
:key="`full_image_${image?._id}`"
|
|
169
|
-
:src="image?.url || `/api${permittedPath}/${image?._id}?tid=${image?.tid}`"
|
|
169
|
+
:src="image?.url || image?.public_link || `/api${permittedPath}/${image?._id}?tid=${image?.tid}`"
|
|
170
170
|
:class="['w-36 h-36 object-contain border rounded cursor-zoom-in', { 'border-black border-2': currentFullImage._id === image?._id }]"
|
|
171
171
|
@click="currentFullImage = image"
|
|
172
172
|
>
|
|
@@ -198,6 +198,7 @@ const resizeImage = ({ file, maxSize }) => {
|
|
|
198
198
|
const canvas = document.createElement('canvas')
|
|
199
199
|
const resize = () => {
|
|
200
200
|
let { width, height } = image
|
|
201
|
+
|
|
201
202
|
if (width > height) {
|
|
202
203
|
if (width > maxSize) {
|
|
203
204
|
height *= maxSize / width
|
|
@@ -209,8 +210,10 @@ const resizeImage = ({ file, maxSize }) => {
|
|
|
209
210
|
}
|
|
210
211
|
canvas.width = width
|
|
211
212
|
canvas.height = height
|
|
212
|
-
canvas.getContext('2d')
|
|
213
|
-
|
|
213
|
+
const ctx = canvas.getContext('2d')
|
|
214
|
+
ctx.clearRect(0, 0, width, height)
|
|
215
|
+
ctx.drawImage(image, 0, 0, width, height)
|
|
216
|
+
const dataUrl = canvas.toDataURL('image/png')
|
|
214
217
|
return dataURItoBlob(dataUrl, file.name)
|
|
215
218
|
}
|
|
216
219
|
return new Promise((ok, no) => {
|
|
@@ -219,11 +222,12 @@ const resizeImage = ({ file, maxSize }) => {
|
|
|
219
222
|
return
|
|
220
223
|
}
|
|
221
224
|
reader.onload = (readerEvent) => {
|
|
222
|
-
image.onload = () =>
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
225
|
+
image.onload = () =>
|
|
226
|
+
ok({
|
|
227
|
+
resizedImage: resize(),
|
|
228
|
+
width: image.width,
|
|
229
|
+
height: image.height
|
|
230
|
+
})
|
|
227
231
|
image.src = readerEvent.target.result
|
|
228
232
|
}
|
|
229
233
|
reader.readAsDataURL(file)
|
|
@@ -337,7 +341,7 @@ export default {
|
|
|
337
341
|
this.set_pdf_url({ title: 'Файл харах', url: `${this.permittedPath}/${item._id}?tid=${item.tid}` })
|
|
338
342
|
} else {
|
|
339
343
|
const link = document.createElement('a')
|
|
340
|
-
link.href = `/api${this.permittedPath}/${item._id}?tid=${item.tid}`
|
|
344
|
+
link.href = item.public_link || `/api${this.permittedPath}/${item._id}?tid=${item.tid}`
|
|
341
345
|
link.setAttribute('download', `${item.orignalname}`)
|
|
342
346
|
document.body.appendChild(link)
|
|
343
347
|
link.click()
|
package/comps/CoreTableImage.vue
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
'rounded': !hideBorder,
|
|
30
30
|
'rounded-full': circle
|
|
31
31
|
}]"
|
|
32
|
-
:src="`/api/file/thumbnail/${image?._id}?tid=${image?.tid}`"
|
|
32
|
+
:src="image?.public_link || `/api/file/thumbnail/${image?._id}?tid=${image?.tid}`"
|
|
33
33
|
>
|
|
34
34
|
</div>
|
|
35
35
|
<div v-if="images.length > 1" class="font-bold text-gray-500">
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
<div v-else-if="value">
|
|
9
9
|
<img
|
|
10
10
|
v-if="fileType === 'image'"
|
|
11
|
-
:src="`/api${permittedPath}/${value?._id}?tid=${value?.tid}`"
|
|
11
|
+
:src="value?.public_link || `/api${permittedPath}/${value?._id}?tid=${value?.tid}`"
|
|
12
12
|
class="h-full w-full rounded object-cover object-top cursor-zoom-in"
|
|
13
13
|
@click="currentFullImage = (value?._id || value)"
|
|
14
14
|
>
|
|
15
|
-
<a v-else :href="`/api${permittedPath}/${value?._id}?tid=${value?._id}`" target="_blank">
|
|
15
|
+
<a v-else :href="value?.public_link || `/api${permittedPath}/${value?._id}?tid=${value?._id}`" target="_blank">
|
|
16
16
|
{{ value?.originalname || `/api${permittedPath}/${value?._id}` }} <span class="text-xs font-bold">{{ formatFileSize(value?.size) }}</span>
|
|
17
17
|
</a>
|
|
18
18
|
</div>
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
>
|
|
39
39
|
<img
|
|
40
40
|
v-if="value"
|
|
41
|
-
:src="`/api${permittedPath}/${value?._id}?tid=${value?.tid}`"
|
|
41
|
+
:src="value?.public_link || `/api${permittedPath}/${value?._id}?tid=${value?.tid}`"
|
|
42
42
|
class="h-full w-full rounded object-cover object-center cursor-zoom-in"
|
|
43
43
|
@click="currentFullImage = value"
|
|
44
44
|
>
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
<img
|
|
72
72
|
v-if="['image', 'icon'].includes(fileType)"
|
|
73
73
|
class="w-20 h-20 object-contain max-h-full max-w-full border-r rounded-l image-rounded-l cursor-zoom-in"
|
|
74
|
-
:src="`/api${permittedPath}/${image._id}?tid=${image.tid}`"
|
|
74
|
+
:src="image?.public_link || `/api${permittedPath}/${image._id}?tid=${image.tid}`"
|
|
75
75
|
@click="currentFullImage = image"
|
|
76
76
|
>
|
|
77
77
|
<div class="flex-1 flex flex-row items-center overflow-hidden text-sm">
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
</div>
|
|
81
81
|
<a
|
|
82
82
|
class="hover:underline"
|
|
83
|
-
:href="`/api${permittedPath}/${image._id}?tid=${image.tid}`"
|
|
83
|
+
:href="image?.public_link || `/api${permittedPath}/${image._id}?tid=${image.tid}`"
|
|
84
84
|
target="_blank"
|
|
85
85
|
>
|
|
86
86
|
{{ image.originalname }}
|
package/package.json
CHANGED
package/readme.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
test
|