@mapomodule/uikit 1.0.0-alpha.33 → 1.0.0-alpha.35
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 +34 -0
- package/components/Form/defaults.js +0 -3
- package/components/Form/fields/MediaField.vue +123 -197
- package/components/Form/fields/MediaM2mField.vue +100 -204
- package/components/Form/fields/Repeater.vue +2 -1
- package/components/MediaManager/MediaBreadcrumbs.vue +44 -0
- package/components/MediaManager/MediaEditor.vue +39 -26
- package/components/MediaManager/MediaFolders.vue +156 -150
- package/components/MediaManager/MediaGallery.vue +128 -132
- package/components/MediaManager/MediaManager.vue +77 -171
- package/components/MediaManager/MediaManagerDialog.vue +26 -19
- package/components/MediaManager/MediaPreview.vue +0 -5
- package/components/MediaManager/MediaUploader.vue +3 -9
- package/package.json +3 -3
- package/translations/en-US.js +2 -1
- package/translations/it-IT.js +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,40 @@
|
|
|
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.35](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.34...v1.0.0-alpha.35) (2022-11-11)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* fix mime type filtering for new media manager ([bbd1a9b](https://github.com/lotrekagency/mapo/commit/bbd1a9ba6ef6f17980c9bf534060b3add658fefe))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [1.0.0-alpha.34](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.33...v1.0.0-alpha.34) (2022-11-11)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* fix media dialog reset and selected visualization ([d04e6f2](https://github.com/lotrekagency/mapo/commit/d04e6f2269c059f083a84920befec35e52087857))
|
|
23
|
+
* fix repeater width ([f210aff](https://github.com/lotrekagency/mapo/commit/f210aff38bdd576eb1c7dfa07a1c6a8d0efc5a0d))
|
|
24
|
+
* fix some graphic issues in new media dialogue ([6895dab](https://github.com/lotrekagency/mapo/commit/6895dab303466cbf419a4500dd9fb432997e4c4b))
|
|
25
|
+
* fixed some interface glitch in media manager ([317f550](https://github.com/lotrekagency/mapo/commit/317f55087a741aada769304025294f46cc2a7044))
|
|
26
|
+
* little media manager graphic fixs ([9f9df7e](https://github.com/lotrekagency/mapo/commit/9f9df7e18429ba7905b3d64cfa2ea4dca9827680))
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Features
|
|
30
|
+
|
|
31
|
+
* completely rewritten mediaField ([4b17d18](https://github.com/lotrekagency/mapo/commit/4b17d18c836608eb5f07ed0b42f45bb18cf8b30d))
|
|
32
|
+
* new m2m media field and moved media selection logic to store ([8094375](https://github.com/lotrekagency/mapo/commit/8094375712b7ad7bc10caeec71d8d5e5bca43edc))
|
|
33
|
+
* rewreitten media grids ([3818ca1](https://github.com/lotrekagency/mapo/commit/3818ca17dead56367e21edcf01f6910cb80cee25))
|
|
34
|
+
* rewritten media manager ([de18547](https://github.com/lotrekagency/mapo/commit/de185479bada77ee41786f9925681cdc5630e7fa))
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
6
40
|
# [1.0.0-alpha.33](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.32...v1.0.0-alpha.33) (2022-10-14)
|
|
7
41
|
|
|
8
42
|
|
|
@@ -1,177 +1,125 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
<
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
>
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
<!-- If the media is not avaible, it shows a btn to add new media -->
|
|
51
|
-
<v-card
|
|
52
|
-
v-else-if="!rmAddBtn"
|
|
53
|
-
class="rounded-0"
|
|
54
|
-
v-bind="{
|
|
55
|
-
height,
|
|
56
|
-
width,
|
|
57
|
-
maxWidth,
|
|
58
|
-
maxHeight,
|
|
59
|
-
minWidth,
|
|
60
|
-
minHeight,
|
|
61
|
-
...$attrs,
|
|
62
|
-
}"
|
|
63
|
-
>
|
|
64
|
-
<v-card-title>{{ label }}</v-card-title>
|
|
65
|
-
|
|
66
|
-
<v-card-actions>
|
|
67
|
-
<v-btn tile :disabled="readonly" @click="editing = true" block :min-height="minHeight">
|
|
68
|
-
<v-icon size="80"> mdi-plus-circle-outline </v-icon>
|
|
69
|
-
</v-btn>
|
|
70
|
-
</v-card-actions>
|
|
71
|
-
</v-card>
|
|
72
|
-
|
|
73
|
-
<!-- Shows darkening overlay on image with buttons on top while hovered -->
|
|
74
|
-
<v-overlay opacity="0.3" absolute :value="overlay">
|
|
75
|
-
<v-row>
|
|
76
|
-
<v-col cols="12">
|
|
77
|
-
<h3>{{ label }}</h3>
|
|
78
|
-
</v-col>
|
|
79
|
-
</v-row>
|
|
80
|
-
<v-row>
|
|
81
|
-
<v-col cols="6">
|
|
82
|
-
<v-btn :disabled="readonly" @click="editing = true" fab v-bind="$attrs">
|
|
83
|
-
<v-icon>mdi-pencil</v-icon>
|
|
84
|
-
</v-btn>
|
|
85
|
-
</v-col>
|
|
86
|
-
|
|
87
|
-
<v-col cols="6">
|
|
88
|
-
<v-btn :disabled="readonly" @click="confirmDelete" fab v-bind="$attrs">
|
|
89
|
-
<v-icon>mdi-delete</v-icon>
|
|
90
|
-
</v-btn>
|
|
91
|
-
</v-col>
|
|
92
|
-
</v-row>
|
|
93
|
-
</v-overlay>
|
|
94
|
-
|
|
95
|
-
<!-- Select media dialog -->
|
|
96
|
-
<media-manager-dialog
|
|
97
|
-
v-model="editing"
|
|
98
|
-
select="single"
|
|
99
|
-
v-on:selectionChange="update"
|
|
100
|
-
v-bind="$attrs"
|
|
101
|
-
>
|
|
102
|
-
</media-manager-dialog>
|
|
103
|
-
|
|
104
|
-
</div>
|
|
105
|
-
</v-hover>
|
|
106
|
-
<v-messages
|
|
107
|
-
v-model="errorMessages"
|
|
108
|
-
color="error"
|
|
109
|
-
class="mt-2"
|
|
110
|
-
/>
|
|
111
|
-
</div>
|
|
2
|
+
<media-manager-dialog
|
|
3
|
+
select="single"
|
|
4
|
+
:selected.sync="model"
|
|
5
|
+
v-bind="$attrs"
|
|
6
|
+
>
|
|
7
|
+
<template v-slot:activator="{ on, attrs }">
|
|
8
|
+
<v-text-field
|
|
9
|
+
readonly
|
|
10
|
+
v-bind="{ ...$attrs, ...attrs }"
|
|
11
|
+
v-on="readonly ? undefined : on"
|
|
12
|
+
class="media-field--card rounded-0"
|
|
13
|
+
:class="{ 'media-field--selected': !!model }"
|
|
14
|
+
:value="model ? ' ' : ''"
|
|
15
|
+
>
|
|
16
|
+
<template v-if="model" v-slot:append>
|
|
17
|
+
<MediaPreview
|
|
18
|
+
v-if="model"
|
|
19
|
+
:media="model"
|
|
20
|
+
:video-preview="!model.is_image"
|
|
21
|
+
class="media-field--preview"
|
|
22
|
+
/>
|
|
23
|
+
<div class="media-field--info caption text--secondary">
|
|
24
|
+
<p>
|
|
25
|
+
<b>{{ $t("mapo.fileName") }}:</b> {{ fileName }}
|
|
26
|
+
</p>
|
|
27
|
+
<p>
|
|
28
|
+
<b>{{ $t("mapo.size") }}:</b> {{ fileSize }}
|
|
29
|
+
</p>
|
|
30
|
+
<p>
|
|
31
|
+
<b>{{ $t("mapo.mime") }}:</b> {{ model.mime_type }}
|
|
32
|
+
</p>
|
|
33
|
+
<p>
|
|
34
|
+
<b>{{ $t("mapo.altTag") }}:</b> {{ model.alt_text }}
|
|
35
|
+
</p>
|
|
36
|
+
</div>
|
|
37
|
+
<v-btn
|
|
38
|
+
@click.native="clear"
|
|
39
|
+
class="media-field--info-btn"
|
|
40
|
+
tile
|
|
41
|
+
small
|
|
42
|
+
icon
|
|
43
|
+
><v-icon>mdi-close</v-icon></v-btn
|
|
44
|
+
>
|
|
45
|
+
</template>
|
|
46
|
+
</v-text-field>
|
|
47
|
+
</template>
|
|
48
|
+
</media-manager-dialog>
|
|
112
49
|
</template>
|
|
50
|
+
<style lang="scss">
|
|
51
|
+
.media-field--card.v-text-field > .v-input__control > .v-input__slot {
|
|
52
|
+
input {
|
|
53
|
+
cursor: pointer;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
.media-field--selected {
|
|
57
|
+
.v-text-field__slot {
|
|
58
|
+
position: absolute !important;
|
|
59
|
+
width: 100%;
|
|
60
|
+
height: 100%;
|
|
61
|
+
}
|
|
62
|
+
.v-input__append-inner {
|
|
63
|
+
margin-left: 0 !important;
|
|
64
|
+
width: 100%;
|
|
65
|
+
}
|
|
66
|
+
&.media-field--card.v-text-field > .v-input__control > .v-input__slot {
|
|
67
|
+
cursor: pointer;
|
|
68
|
+
input {
|
|
69
|
+
position: absolute;
|
|
70
|
+
cursor: pointer;
|
|
71
|
+
width: 100%;
|
|
72
|
+
min-height: 100%;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
113
76
|
|
|
114
|
-
|
|
77
|
+
.media-field--preview {
|
|
78
|
+
width: 100px;
|
|
79
|
+
height: 100px;
|
|
80
|
+
border: 1px solid;
|
|
81
|
+
border-color: inherit;
|
|
82
|
+
margin-bottom: 10px;
|
|
83
|
+
margin-right: 12px;
|
|
84
|
+
}
|
|
85
|
+
.media-field--info {
|
|
86
|
+
width: 100%;
|
|
87
|
+
max-width: calc(100% - 112px);
|
|
88
|
+
p {
|
|
89
|
+
margin-bottom: 0;
|
|
90
|
+
overflow: hidden;
|
|
91
|
+
text-overflow: ellipsis;
|
|
92
|
+
white-space: nowrap;
|
|
93
|
+
}
|
|
94
|
+
&-btn {
|
|
95
|
+
position: absolute;
|
|
96
|
+
top: 0;
|
|
97
|
+
right: 0;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
.media-field--add {
|
|
101
|
+
width: 100px;
|
|
102
|
+
margin-bottom: 10px;
|
|
103
|
+
}
|
|
115
104
|
</style>
|
|
116
105
|
|
|
117
106
|
<script>
|
|
107
|
+
import { humanFileSize } from "@mapomodule/utils/helpers/formatters";
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* This component is made to manage media fields for single selection.
|
|
111
|
+
*/
|
|
118
112
|
export default {
|
|
119
|
-
name: "
|
|
113
|
+
name: "MultimediaField",
|
|
120
114
|
data() {
|
|
121
115
|
return {
|
|
122
|
-
|
|
123
|
-
editing: false,
|
|
124
|
-
isHovered: false,
|
|
116
|
+
model: this.value,
|
|
125
117
|
};
|
|
126
118
|
},
|
|
127
|
-
|
|
128
119
|
props: {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
type: String,
|
|
133
|
-
default: () => "",
|
|
134
|
-
},
|
|
135
|
-
errorMessages: {
|
|
136
|
-
type: String | Array,
|
|
137
|
-
default: () => []
|
|
138
|
-
},
|
|
139
|
-
rmAddBtn: {
|
|
140
|
-
type: Boolean,
|
|
141
|
-
default: false,
|
|
142
|
-
},
|
|
143
|
-
//image reflections
|
|
144
|
-
aspectRatio: {
|
|
145
|
-
type: String | Number,
|
|
146
|
-
default: undefined,
|
|
147
|
-
},
|
|
148
|
-
contain: {
|
|
149
|
-
type: Boolean,
|
|
150
|
-
default: false,
|
|
151
|
-
},
|
|
152
|
-
height: {
|
|
153
|
-
type: String | Number,
|
|
154
|
-
default: "100%",
|
|
155
|
-
},
|
|
156
|
-
width: {
|
|
157
|
-
type: String | Number,
|
|
158
|
-
default: "100%",
|
|
159
|
-
},
|
|
160
|
-
maxWidth: {
|
|
161
|
-
type: String | Number,
|
|
162
|
-
default: undefined,
|
|
163
|
-
},
|
|
164
|
-
maxHeight: {
|
|
165
|
-
type: String | Number,
|
|
166
|
-
default: undefined,
|
|
167
|
-
},
|
|
168
|
-
minWidth: {
|
|
169
|
-
type: String | Number,
|
|
170
|
-
default: undefined,
|
|
171
|
-
},
|
|
172
|
-
minHeight: {
|
|
173
|
-
type: String | Number,
|
|
174
|
-
default: 300,
|
|
120
|
+
// V-model property. Color must be hex codified.
|
|
121
|
+
value: {
|
|
122
|
+
type: Object | null,
|
|
175
123
|
},
|
|
176
124
|
// This set the component status to readonly, stopping the user interaction.
|
|
177
125
|
readonly: {
|
|
@@ -179,52 +127,30 @@ export default {
|
|
|
179
127
|
default: false,
|
|
180
128
|
},
|
|
181
129
|
},
|
|
182
|
-
|
|
183
130
|
computed: {
|
|
184
|
-
mediaExists() {
|
|
185
|
-
return !!this.internalValue?.file;
|
|
186
|
-
},
|
|
187
|
-
overlay() {
|
|
188
|
-
return this.isHovered && this.mediaExists;
|
|
189
|
-
},
|
|
190
131
|
fileName() {
|
|
191
|
-
return this.
|
|
132
|
+
return this.model && this.model.file && this.model.file.split("/").pop();
|
|
192
133
|
},
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
methods: {
|
|
196
|
-
update(val) {
|
|
197
|
-
this.internalValue = val;
|
|
134
|
+
dateCreated() {
|
|
135
|
+
return this.model && new Date(this.model.created).toLocaleString();
|
|
198
136
|
},
|
|
199
|
-
|
|
200
|
-
this
|
|
201
|
-
.open({
|
|
202
|
-
title: this.$t("mapo.remove"),
|
|
203
|
-
question: this.$t("mapo.mediaField.confirmRemove"),
|
|
204
|
-
approveButton: { text: this.$t("mapo.remove"), attrs: { color: "red", text: true } }
|
|
205
|
-
})
|
|
206
|
-
.then((res) => (res ? (this.internalValue = null) : null));
|
|
207
|
-
},
|
|
208
|
-
isImage(val) {
|
|
209
|
-
if (!val?.is_image && val?.mime_type.includes("image")) {
|
|
210
|
-
Object.assign(val, { is_image: true });
|
|
211
|
-
}
|
|
137
|
+
fileSize() {
|
|
138
|
+
return this.model && humanFileSize(this.model.size);
|
|
212
139
|
},
|
|
213
140
|
},
|
|
214
|
-
|
|
141
|
+
methods:{
|
|
142
|
+
clear(event){
|
|
143
|
+
event.stopPropagation();
|
|
144
|
+
this.model = null;
|
|
145
|
+
}
|
|
146
|
+
},
|
|
215
147
|
watch: {
|
|
216
148
|
value(val) {
|
|
217
|
-
|
|
218
|
-
this.internalValue = val;
|
|
219
|
-
}
|
|
149
|
+
this.model = val;
|
|
220
150
|
},
|
|
221
|
-
|
|
222
|
-
this.isImage(val)
|
|
151
|
+
model(val) {
|
|
223
152
|
this.$emit("input", val);
|
|
224
153
|
},
|
|
225
154
|
},
|
|
226
|
-
mounted(){
|
|
227
|
-
this.internalValue = this.value
|
|
228
|
-
}
|
|
229
155
|
};
|
|
230
156
|
</script>
|