@mapomodule/uikit 1.0.0-alpha.45 → 1.0.0-alpha.46
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/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [1.0.0-alpha.46](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.45...v1.0.0-alpha.46) (2023-06-24)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* media manager enhancements ([994a8f0](https://github.com/lotrekagency/mapo/commit/994a8f05207d85b92133ede63b70d5f33750158c))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# [1.0.0-alpha.45](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.44...v1.0.0-alpha.45) (2023-06-10)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @mapomodule/uikit
|
|
@@ -300,13 +300,18 @@ export default {
|
|
|
300
300
|
},
|
|
301
301
|
},
|
|
302
302
|
methods: {
|
|
303
|
-
...mapActions("mapo/media", ["closeEditor", "deleteMedia", "updateMedia"]),
|
|
303
|
+
...mapActions("mapo/media", ["getRoot", "closeEditor", "deleteMedia", "updateMedia"]),
|
|
304
304
|
saveMedia() {
|
|
305
305
|
this.updateMedia({
|
|
306
306
|
...this.media,
|
|
307
307
|
file: this.newFile || undefined,
|
|
308
308
|
same_url: (this.newFile && this.sameUrl) || undefined,
|
|
309
309
|
language_code: this.$i18n.locale,
|
|
310
|
+
}).catch(error => {
|
|
311
|
+
this.$mapo.$snack.open({
|
|
312
|
+
message: error.response?.data?.detail || this.$t("mapo.genericError"),
|
|
313
|
+
color: "error",
|
|
314
|
+
})
|
|
310
315
|
}).finally(() => {
|
|
311
316
|
this.newFile = null;
|
|
312
317
|
this.sameUrl = false;
|
|
@@ -322,7 +327,13 @@ export default {
|
|
|
322
327
|
attrs: { color: "red", text: true },
|
|
323
328
|
},
|
|
324
329
|
})
|
|
325
|
-
.then((res) => res && this.deleteMedia(this.media)
|
|
330
|
+
.then((res) => res && this.deleteMedia(this.media)
|
|
331
|
+
.catch(error =>
|
|
332
|
+
this.$mapo.$snack.open({
|
|
333
|
+
message: error.response?.data?.detail || this.$t("mapo.genericError"),
|
|
334
|
+
color: "error",
|
|
335
|
+
})
|
|
336
|
+
).finally(() => {this.getRoot(); this.closeEditor()}));
|
|
326
337
|
},
|
|
327
338
|
},
|
|
328
339
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
2
|
+
<v-img
|
|
3
3
|
:src="(isImage && media.file) || null"
|
|
4
4
|
:lazy-src="(isImage && media.thumbnail) || null"
|
|
5
5
|
aspect-ratio="1"
|
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
}"
|
|
11
11
|
v-bind="$attrs"
|
|
12
12
|
v-on="videoListeners"
|
|
13
|
+
@mouseover.native="hover = true"
|
|
14
|
+
@mouseleave.native="hover = false; showInfo = false"
|
|
13
15
|
:title="media.title || media.name"
|
|
14
16
|
>
|
|
15
17
|
<template v-slot:placeholder>
|
|
@@ -67,10 +69,54 @@
|
|
|
67
69
|
</div>
|
|
68
70
|
</v-row>
|
|
69
71
|
</template>
|
|
72
|
+
<template>
|
|
73
|
+
<div @click.stop="showInfo=true" class="file-info text-right" :class="{hover, showInfo}">
|
|
74
|
+
<span class="file-name text-truncate">{{ (filename && name) || undefined }}</span>
|
|
75
|
+
<span class="file-details text-caption " :class="{showInfo}">
|
|
76
|
+
<span>{{ dateCreated }}</span><br>
|
|
77
|
+
<span>{{ fileSize }}</span>
|
|
78
|
+
</span>
|
|
79
|
+
</div>
|
|
80
|
+
</template>
|
|
70
81
|
</v-img>
|
|
71
82
|
</template>
|
|
72
83
|
|
|
73
84
|
<style lang="scss">
|
|
85
|
+
.file-info{
|
|
86
|
+
position: absolute;
|
|
87
|
+
bottom: 0;
|
|
88
|
+
padding: 0.2em 1em;
|
|
89
|
+
background: #1f1f1f;
|
|
90
|
+
opacity: 0;
|
|
91
|
+
transition: opacity .5s;
|
|
92
|
+
width: 100%;
|
|
93
|
+
display: block;
|
|
94
|
+
max-height: 80%;
|
|
95
|
+
overflow: auto ;
|
|
96
|
+
&.hover{
|
|
97
|
+
opacity: .7;
|
|
98
|
+
}
|
|
99
|
+
&.showInfo{
|
|
100
|
+
opacity: .9;
|
|
101
|
+
padding: 0.2em 0.5em;
|
|
102
|
+
.file-name{
|
|
103
|
+
font-weight: bold;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
.file-name{
|
|
108
|
+
display: block;
|
|
109
|
+
}
|
|
110
|
+
.file-details{
|
|
111
|
+
max-height: 0;
|
|
112
|
+
overflow: hidden;
|
|
113
|
+
transition: all .5s;
|
|
114
|
+
display: block;
|
|
115
|
+
&.showInfo{
|
|
116
|
+
max-height: 500px;
|
|
117
|
+
overflow: auto;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
74
120
|
.v-image.media-controls {
|
|
75
121
|
.v-image__placeholder {
|
|
76
122
|
z-index: 0;
|
|
@@ -93,6 +139,7 @@
|
|
|
93
139
|
</style>
|
|
94
140
|
|
|
95
141
|
<script>
|
|
142
|
+
import { humanFileSize } from "@mapomodule/utils/helpers/formatters";
|
|
96
143
|
|
|
97
144
|
const extensions = {
|
|
98
145
|
image: ["png", "jpg", "jpeg", "avif", "webp"],
|
|
@@ -105,6 +152,8 @@ export default {
|
|
|
105
152
|
return {
|
|
106
153
|
playing: false,
|
|
107
154
|
playPromise: null,
|
|
155
|
+
hover: false,
|
|
156
|
+
showInfo: false
|
|
108
157
|
};
|
|
109
158
|
},
|
|
110
159
|
props: {
|
|
@@ -151,7 +200,7 @@ export default {
|
|
|
151
200
|
if (this.media?.mime_type)
|
|
152
201
|
return this.media.mime_type.startsWith("video/");
|
|
153
202
|
return extensions.video.includes(this.media?.file?.split(".").pop()?.toLowerCase())
|
|
154
|
-
},
|
|
203
|
+
},
|
|
155
204
|
isAudio() {
|
|
156
205
|
if (this.media?.mime_type)
|
|
157
206
|
return this.media.mime_type.startsWith("audio/");
|
|
@@ -166,6 +215,12 @@ export default {
|
|
|
166
215
|
};
|
|
167
216
|
}
|
|
168
217
|
},
|
|
218
|
+
fileSize() {
|
|
219
|
+
return this.media && humanFileSize(this.media.size);
|
|
220
|
+
},
|
|
221
|
+
dateCreated() {
|
|
222
|
+
return this.media && new Date(this.media.created).toLocaleDateString();
|
|
223
|
+
},
|
|
169
224
|
},
|
|
170
225
|
methods: {
|
|
171
226
|
handleTouch(event){
|
|
@@ -148,6 +148,11 @@ export default {
|
|
|
148
148
|
this.$emit("Upload", (response.length && response) || this.mediaList);
|
|
149
149
|
this.$refs.closeButton.$el.click();
|
|
150
150
|
}
|
|
151
|
+
}).catch(error => {
|
|
152
|
+
this.$mapo.$snack.open({
|
|
153
|
+
message: error.response?.data?.detail || this.$t("mapo.genericError"),
|
|
154
|
+
color: "error",
|
|
155
|
+
})
|
|
151
156
|
});
|
|
152
157
|
},
|
|
153
158
|
uploadMedia(media) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mapomodule/uikit",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.46",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "This is part of Mapo nuxt module. Injects Mapo ui components in the nuxt component discovery system.",
|
|
6
6
|
"author": "bnznamco <gabriele.baldi.01@gmail.com>",
|
|
@@ -15,5 +15,5 @@
|
|
|
15
15
|
"publishConfig": {
|
|
16
16
|
"access": "public"
|
|
17
17
|
},
|
|
18
|
-
"gitHead": "
|
|
18
|
+
"gitHead": "7f8e3b34a2130d54797c52542fdb6a269dbc27ef"
|
|
19
19
|
}
|