@mapomodule/uikit 1.0.0-alpha.43 → 1.0.0-alpha.44
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 +37 -0
- package/components/ConfirmDialog.vue +49 -24
- package/components/Detail/Detail.vue +6 -1
- package/components/Detail/DetailLangSwitch.vue +2 -0
- package/components/Form/FormField.vue +5 -4
- package/components/MediaManager/MediaEditor.vue +43 -85
- package/components/MediaManager/MediaFileChanger.vue +78 -0
- package/components/MediaManager/MediaFolders.vue +59 -4
- package/components/MediaManager/MediaGallery.vue +87 -13
- package/components/MediaManager/MediaManager.vue +10 -2
- package/components/MediaManager/MediaUploader.vue +0 -6
- package/components/MenuManager/MenuManager.vue +327 -0
- package/components/MenuManager/MenuNodeEditor.vue +255 -0
- package/components/MenuManager/MenuTreeview.vue +206 -0
- package/components/MenuManager/MenuTreeviewNode.vue +190 -0
- package/package.json +3 -4
- package/translations/en-US.js +35 -3
- package/translations/it-IT.js +35 -2
- package/LICENSE.md +0 -20
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,43 @@
|
|
|
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.44](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.43...v1.0.0-alpha.44) (2023-06-10)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* added bottom padding to menu treeview draggable ([6c10dcb](https://github.com/lotrekagency/mapo/commit/6c10dcbd9c5be34cba448692e39ee61494205e61))
|
|
12
|
+
* added missing tranlations to detail component ([c099319](https://github.com/lotrekagency/mapo/commit/c09931963b5f6c9425bb905b958b13ed44df3b06))
|
|
13
|
+
* better double clik node edit catcher ([78ec053](https://github.com/lotrekagency/mapo/commit/78ec053be801f6da49019c1bd371948a1eaf3a15))
|
|
14
|
+
* fix media edit folder typo ([aba1d15](https://github.com/lotrekagency/mapo/commit/aba1d15807edcb10941e3b051e75d20c86e6670e))
|
|
15
|
+
* fix search value update in media manager ([c38b530](https://github.com/lotrekagency/mapo/commit/c38b5304bec5438bfa74b1fed9fe083457189fc1))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* add click callback to menuNode breadcrums to help navigation ([0b73718](https://github.com/lotrekagency/mapo/commit/0b73718402a306c66a20e04e7d77201a53a16875))
|
|
21
|
+
* added css classes and translations to menu-manager ([e1f46c0](https://github.com/lotrekagency/mapo/commit/e1f46c0347ad3cd56bb44ecec810692daf57aad2))
|
|
22
|
+
* added del keyboard input to delete menu nodes ([6d376a0](https://github.com/lotrekagency/mapo/commit/6d376a05e932921d3f78eee008bd09c9ebe9a0cf))
|
|
23
|
+
* added delete selected to media manager ([060eaed](https://github.com/lotrekagency/mapo/commit/060eaedccc6f5761e995a889a749f3643494eb2f))
|
|
24
|
+
* added empty placeholder for menu treeview ([f40dfc3](https://github.com/lotrekagency/mapo/commit/f40dfc36e6a80f6f2f532d1580b59a5ed5e686f6))
|
|
25
|
+
* added keyboard inputs for confirm dialog ([e9e4058](https://github.com/lotrekagency/mapo/commit/e9e4058020ce240a7f4877e384931a02da8a69bd))
|
|
26
|
+
* added media editor translation fields ([87ed691](https://github.com/lotrekagency/mapo/commit/87ed691da08d6e06ff0f960d5e6592ace349cce6))
|
|
27
|
+
* added MenuManager component ([25107a9](https://github.com/lotrekagency/mapo/commit/25107a9cbfd75fcacf485163b96a793fe788cb4b))
|
|
28
|
+
* added old value to onChange in formField ([b53c86e](https://github.com/lotrekagency/mapo/commit/b53c86e392aee9a197df56c5c99c943ecb3895b9))
|
|
29
|
+
* added readonly props to detail component ([4c8c79f](https://github.com/lotrekagency/mapo/commit/4c8c79fc41839f7e8398d6adc9a6191306c54742))
|
|
30
|
+
* added slots to menu editor component to sobstitute the entire form ([239727c](https://github.com/lotrekagency/mapo/commit/239727cc1da9938511bac551b5a91f6c94b39539))
|
|
31
|
+
* added title field in menu node editor ([bd62662](https://github.com/lotrekagency/mapo/commit/bd62662d4afb85b46a8f7185203b916aab8fe713))
|
|
32
|
+
* added type folders to media manager ([63cd551](https://github.com/lotrekagency/mapo/commit/63cd551d33278e0e23a52d3ac234f58dbe56eb91))
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
### Performance Improvements
|
|
36
|
+
|
|
37
|
+
* EXPERIMENTAL: use Vue.set in setpointed and directly manipulate js object in FormField ([1c384e9](https://github.com/lotrekagency/mapo/commit/1c384e9d7c922b0e876512de874a3f9832ac30f1))
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
6
43
|
# [1.0.0-alpha.43](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.42...v1.0.0-alpha.43) (2023-02-02)
|
|
7
44
|
|
|
8
45
|
|
|
@@ -2,14 +2,22 @@
|
|
|
2
2
|
<div>
|
|
3
3
|
<!-- Activator slot, this follows the logics of <a href="https://vuetifyjs.com/en/api/v-dialog/#api-slots" target="__blank">vuetify activator</a>.-->
|
|
4
4
|
<slot v-bind="{ on, attrs: options.attrs }" name="activator"></slot>
|
|
5
|
-
<v-dialog
|
|
5
|
+
<v-dialog
|
|
6
|
+
@keydown="onKeyDown"
|
|
7
|
+
v-model="dialog"
|
|
8
|
+
v-bind="{ width: 350, ...options.attrs }"
|
|
9
|
+
>
|
|
6
10
|
<v-card v-bind="options.attrs">
|
|
7
11
|
<v-card-title>{{ options.title }}</v-card-title>
|
|
8
12
|
<v-card-text class="headline">{{ options.question }}</v-card-text>
|
|
9
13
|
<v-card-actions>
|
|
10
14
|
<v-spacer></v-spacer>
|
|
11
|
-
<v-btn v-bind="dismissAttrs" @click="close">{{
|
|
12
|
-
|
|
15
|
+
<v-btn v-bind="dismissAttrs" ref="close" @click="close">{{
|
|
16
|
+
dismissTxt
|
|
17
|
+
}}</v-btn>
|
|
18
|
+
<v-btn @click="accept" ref="accept" v-bind="approveAttrs">{{
|
|
19
|
+
approveTxt
|
|
20
|
+
}}</v-btn>
|
|
13
21
|
</v-card-actions>
|
|
14
22
|
</v-card>
|
|
15
23
|
</v-dialog>
|
|
@@ -33,24 +41,30 @@ export default {
|
|
|
33
41
|
options: {
|
|
34
42
|
title: this.title || this.$t("mapo.confirm"),
|
|
35
43
|
question: this.question || this.$t("mapo.confirmDialog.areYouSure"),
|
|
36
|
-
dismissButton: this.dismissButton || {
|
|
37
|
-
|
|
38
|
-
|
|
44
|
+
dismissButton: this.dismissButton || {
|
|
45
|
+
text: this.$t("mapo.cancel"),
|
|
46
|
+
attrs: { text: true },
|
|
47
|
+
},
|
|
48
|
+
approveButton: this.approveButton || {
|
|
49
|
+
text: this.$t("mapo.ok"),
|
|
50
|
+
attrs: { color: "primary", text: true },
|
|
51
|
+
},
|
|
52
|
+
attrs: { ...this.$attrs },
|
|
39
53
|
},
|
|
40
54
|
on: {
|
|
41
|
-
click: event => {
|
|
55
|
+
click: (event) => {
|
|
42
56
|
event.preventDefault();
|
|
43
57
|
event.stopPropagation();
|
|
44
58
|
this.dialog = !this.dialog;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
59
|
+
},
|
|
60
|
+
},
|
|
47
61
|
};
|
|
48
62
|
},
|
|
49
63
|
props: {
|
|
50
64
|
// v-model boolean that controll the status of the dialog (opened/closed)
|
|
51
65
|
value: {
|
|
52
66
|
type: Boolean,
|
|
53
|
-
default: false
|
|
67
|
+
default: false,
|
|
54
68
|
},
|
|
55
69
|
// The text in the body of the dialog.
|
|
56
70
|
question: {
|
|
@@ -69,7 +83,7 @@ export default {
|
|
|
69
83
|
approveButton: {
|
|
70
84
|
// `{ text: String, attrs: Object }`
|
|
71
85
|
type: Object,
|
|
72
|
-
}
|
|
86
|
+
},
|
|
73
87
|
},
|
|
74
88
|
computed: {
|
|
75
89
|
approveTxt() {
|
|
@@ -83,7 +97,7 @@ export default {
|
|
|
83
97
|
},
|
|
84
98
|
dismissAttrs() {
|
|
85
99
|
return this.options.dismissButton?.attrs || {};
|
|
86
|
-
}
|
|
100
|
+
},
|
|
87
101
|
},
|
|
88
102
|
watch: {
|
|
89
103
|
value(val) {
|
|
@@ -95,23 +109,26 @@ export default {
|
|
|
95
109
|
this.$emit("input", val);
|
|
96
110
|
if (val) {
|
|
97
111
|
// Fired when the dialog opens
|
|
98
|
-
this.$emit("open")
|
|
112
|
+
this.$emit("open");
|
|
113
|
+
this.$nextTick(() =>
|
|
114
|
+
this.$nextTick(() => this.$refs.accept.$el.focus())
|
|
115
|
+
);
|
|
99
116
|
} else {
|
|
100
117
|
// Fired when the dialog closes
|
|
101
|
-
this.$emit("close")
|
|
118
|
+
this.$emit("close");
|
|
102
119
|
}
|
|
103
120
|
if (!val && this.resolve) {
|
|
104
121
|
this.resolve(null);
|
|
105
122
|
}
|
|
106
|
-
}
|
|
123
|
+
},
|
|
107
124
|
},
|
|
108
125
|
methods: {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
126
|
+
/**
|
|
127
|
+
* @vuese
|
|
128
|
+
* This open the Confirm dialog component showing to the user a question. Returns a promise with the user response.
|
|
129
|
+
* See [this.$mapo.$confirm.open](/core/#confirm)
|
|
130
|
+
* @arg The payload containing the information to show to the user in the confirm dialog.
|
|
131
|
+
*/
|
|
115
132
|
open(options) {
|
|
116
133
|
this.optionsBk = { ...this.options };
|
|
117
134
|
this.options = { ...this.options, ...options };
|
|
@@ -141,8 +158,16 @@ export default {
|
|
|
141
158
|
}
|
|
142
159
|
this.dialog = false;
|
|
143
160
|
this.response = false;
|
|
144
|
-
setTimeout(() => this.options = { ...this.optionsBk }, 300);
|
|
145
|
-
}
|
|
146
|
-
|
|
161
|
+
setTimeout(() => (this.options = { ...this.optionsBk }), 300);
|
|
162
|
+
},
|
|
163
|
+
onKeyDown({ keyCode }) {
|
|
164
|
+
switch (keyCode) {
|
|
165
|
+
case 39:
|
|
166
|
+
return this.$refs.accept.$el.focus();
|
|
167
|
+
case 37:
|
|
168
|
+
return this.$refs.close.$el.focus();
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
},
|
|
147
172
|
};
|
|
148
173
|
</script>
|
|
@@ -127,6 +127,7 @@
|
|
|
127
127
|
:errors="errors"
|
|
128
128
|
:fields="sideFields"
|
|
129
129
|
:moreSlotBindings="slotBindings"
|
|
130
|
+
:readonly="isReadonly"
|
|
130
131
|
>
|
|
131
132
|
<template v-for="(_, slot) in $slots" :slot="slot">
|
|
132
133
|
<!-- @vuese-ignore -->
|
|
@@ -280,6 +281,8 @@ export default {
|
|
|
280
281
|
return ["auto", "force", "disable"].indexOf(value) !== -1;
|
|
281
282
|
},
|
|
282
283
|
},
|
|
284
|
+
// This forces the detail page to be readonly.
|
|
285
|
+
readonly: Boolean
|
|
283
286
|
},
|
|
284
287
|
methods: {
|
|
285
288
|
back() {
|
|
@@ -318,7 +321,7 @@ export default {
|
|
|
318
321
|
deleteItem() {
|
|
319
322
|
this.$mapo.$confirm
|
|
320
323
|
.open({
|
|
321
|
-
title: "
|
|
324
|
+
title: this.$t("mapo.delete"),
|
|
322
325
|
question: this.$t("mapo.confirmDelete"),
|
|
323
326
|
approveButton: {
|
|
324
327
|
text: this.$t("mapo.delete"),
|
|
@@ -427,12 +430,14 @@ export default {
|
|
|
427
430
|
return async () => method(...args);
|
|
428
431
|
},
|
|
429
432
|
isReadonly() {
|
|
433
|
+
if (this.readonly) return this.readonly;
|
|
430
434
|
if (this.$mapo.$auth.routeMiddlewares.includes("permissions")) {
|
|
431
435
|
return !this.$mapo.$auth.user.permissions.includes(this.isNew ? "add" : "change");
|
|
432
436
|
}
|
|
433
437
|
return !!this.buttonClicked;
|
|
434
438
|
},
|
|
435
439
|
canDelete() {
|
|
440
|
+
if (this.readonly) return false;
|
|
436
441
|
if (this.$mapo.$auth.routeMiddlewares.includes("permissions")) {
|
|
437
442
|
return this.$mapo.$auth.user.permissions.includes("delete");
|
|
438
443
|
}
|
|
@@ -33,6 +33,7 @@ export default {
|
|
|
33
33
|
type: Array,
|
|
34
34
|
default() { return this.$mapo.$options?.content?.languages || []; }
|
|
35
35
|
},
|
|
36
|
+
noRouteChange: Boolean,
|
|
36
37
|
// An object representing all the errors of all fields. This component will find errors in each language and will display a little dot in the tab if there are any errors.
|
|
37
38
|
errors: Object,
|
|
38
39
|
},
|
|
@@ -54,6 +55,7 @@ export default {
|
|
|
54
55
|
},
|
|
55
56
|
methods: {
|
|
56
57
|
saveQparams() {
|
|
58
|
+
if (this.noRouteChange) return;
|
|
57
59
|
const { lang } = this.$route.query;
|
|
58
60
|
if (lang !== this.currentLang) {
|
|
59
61
|
this.$router.replace({
|
|
@@ -76,12 +76,13 @@ export default {
|
|
|
76
76
|
this.setValue(...args);
|
|
77
77
|
}, 300),
|
|
78
78
|
setValue(val) {
|
|
79
|
-
const
|
|
80
|
-
setPointed(
|
|
79
|
+
const old = this.extractValue(this.value);
|
|
80
|
+
setPointed(this.value, this.kpointed, this.accessor.set({ model: this.value, val }));
|
|
81
81
|
if (typeof this.conf.onChange == "function")
|
|
82
82
|
this.conf.onChange({
|
|
83
83
|
val,
|
|
84
|
-
|
|
84
|
+
old,
|
|
85
|
+
model: this.value,
|
|
85
86
|
currentLang: this.currentLang,
|
|
86
87
|
languages: this.langs,
|
|
87
88
|
conf: this.conf,
|
|
@@ -90,7 +91,7 @@ export default {
|
|
|
90
91
|
|
|
91
92
|
// Fired when the v-model changes.
|
|
92
93
|
// @arg Emits the entire payload modified.
|
|
93
|
-
this.$emit("input",
|
|
94
|
+
this.$emit("input", this.value);
|
|
94
95
|
},
|
|
95
96
|
extractValue(val = this.value) {
|
|
96
97
|
return this.accessor.get({
|
|
@@ -86,82 +86,24 @@
|
|
|
86
86
|
</v-col>
|
|
87
87
|
<v-col md="6" cols="12">
|
|
88
88
|
<v-row>
|
|
89
|
-
<v-col
|
|
90
|
-
<
|
|
91
|
-
|
|
92
|
-
v-model="
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
></v-text-field>
|
|
96
|
-
</v-col>
|
|
97
|
-
<v-col sm="6" md="12" cols="12">
|
|
98
|
-
<v-text-field
|
|
99
|
-
dense
|
|
100
|
-
v-model="media.title"
|
|
101
|
-
:label="$t('mapo.titleTag')"
|
|
102
|
-
:readonly="!canEdit"
|
|
103
|
-
></v-text-field>
|
|
104
|
-
</v-col>
|
|
105
|
-
<v-col sm="6" md="12" cols="12">
|
|
106
|
-
<v-text-field
|
|
107
|
-
dense
|
|
108
|
-
v-model="media.description"
|
|
109
|
-
:label="$t('mapo.description')"
|
|
110
|
-
:readonly="!canEdit"
|
|
111
|
-
></v-text-field>
|
|
112
|
-
</v-col>
|
|
113
|
-
<v-col sm="6" md="12" cols="12">
|
|
114
|
-
<v-text-field
|
|
115
|
-
dense
|
|
116
|
-
v-model="media.alt_text"
|
|
117
|
-
:label="$t('mapo.altTag')"
|
|
118
|
-
:readonly="!canEdit"
|
|
119
|
-
></v-text-field>
|
|
120
|
-
</v-col>
|
|
121
|
-
<v-col
|
|
122
|
-
sm="6"
|
|
123
|
-
md="12"
|
|
124
|
-
cols="12"
|
|
125
|
-
class="d-flex align-center"
|
|
126
|
-
v-if="canEdit"
|
|
127
|
-
>
|
|
128
|
-
<div class="d-flex flex-column flex-grow-1">
|
|
129
|
-
<v-file-input
|
|
130
|
-
v-model="newFile"
|
|
131
|
-
:accept="accept"
|
|
132
|
-
:label="$t('mapo.mediaEditor.changeFile')"
|
|
133
|
-
show-size
|
|
134
|
-
dense
|
|
135
|
-
prepend-icon
|
|
136
|
-
></v-file-input>
|
|
137
|
-
<v-checkbox
|
|
138
|
-
v-if="newFile"
|
|
139
|
-
v-model="sameUrl"
|
|
140
|
-
:label="$t('mapo.mediaEditor.maintainOldUrl')"
|
|
141
|
-
class="ma-0"
|
|
142
|
-
hide-details
|
|
143
|
-
dense
|
|
144
|
-
></v-checkbox>
|
|
145
|
-
</div>
|
|
146
|
-
<v-img
|
|
147
|
-
v-if="newFile && newFilePreview"
|
|
148
|
-
:src="newFilePreview"
|
|
149
|
-
aspect-ratio="1"
|
|
150
|
-
min-width="70px"
|
|
151
|
-
max-width="110px"
|
|
152
|
-
class="grey lighten-2 ml-3"
|
|
153
|
-
>
|
|
154
|
-
<template v-slot:placeholder>
|
|
155
|
-
<v-row class="fill-height ma-0" align="center" justify="center">
|
|
156
|
-
<v-progress-circular
|
|
157
|
-
indeterminate
|
|
158
|
-
color="grey lighten-5"
|
|
159
|
-
></v-progress-circular>
|
|
160
|
-
</v-row>
|
|
161
|
-
</template>
|
|
162
|
-
</v-img>
|
|
89
|
+
<v-col cols="12">
|
|
90
|
+
<DetailLangSwitch
|
|
91
|
+
:langs="languages"
|
|
92
|
+
v-model="currentLang"
|
|
93
|
+
no-route-change
|
|
94
|
+
/>
|
|
163
95
|
</v-col>
|
|
164
96
|
</v-row>
|
|
97
|
+
<Form
|
|
98
|
+
v-model="media"
|
|
99
|
+
class="menu-node-editor--form"
|
|
100
|
+
:currentLang="currentLang"
|
|
101
|
+
:languages="languages"
|
|
102
|
+
:fields="fields"
|
|
103
|
+
:moreSlotBindings="slotBindings"
|
|
104
|
+
:readonly="!canEdit"
|
|
105
|
+
/>
|
|
106
|
+
<MediaFileChanger class="mt-6" :file.sync="newFile" :maintain-url.sync="sameUrl" :accept="accept" />
|
|
165
107
|
</v-col>
|
|
166
108
|
</v-row>
|
|
167
109
|
</v-card-text>
|
|
@@ -269,8 +211,17 @@ export default {
|
|
|
269
211
|
editing: false,
|
|
270
212
|
newFile: null,
|
|
271
213
|
sameUrl: false,
|
|
214
|
+
currentLang: this.$i18n.locale,
|
|
272
215
|
};
|
|
273
216
|
},
|
|
217
|
+
props: {
|
|
218
|
+
languages: {
|
|
219
|
+
type: Array,
|
|
220
|
+
default() {
|
|
221
|
+
return this.$mapo.$options?.content?.languages || [];
|
|
222
|
+
},
|
|
223
|
+
},
|
|
224
|
+
},
|
|
274
225
|
computed: {
|
|
275
226
|
...mapGetters("mapo/media", ["editMedia"]),
|
|
276
227
|
fileSize() {
|
|
@@ -296,6 +247,22 @@ export default {
|
|
|
296
247
|
return 425;
|
|
297
248
|
}
|
|
298
249
|
},
|
|
250
|
+
fields() {
|
|
251
|
+
return [
|
|
252
|
+
{ value: "title", label: this.$t('mapo.titleTag'), attrs: { dense: true } },
|
|
253
|
+
{ value: "description", label: this.$t('mapo.description'), attrs: { dense: true } },
|
|
254
|
+
{ value: "alt_text", label: this.$t('mapo.altTag'), attrs: { dense: true } },
|
|
255
|
+
]
|
|
256
|
+
},
|
|
257
|
+
slotBindings() {
|
|
258
|
+
return {
|
|
259
|
+
model: this.media,
|
|
260
|
+
currentLang: this.lang,
|
|
261
|
+
langs: this.languages,
|
|
262
|
+
fields: this.fields,
|
|
263
|
+
readonly: !this.canEdit,
|
|
264
|
+
};
|
|
265
|
+
},
|
|
299
266
|
accept() {
|
|
300
267
|
switch (this.media.mime_type && this.media.mime_type.split("/")[0]) {
|
|
301
268
|
case "image":
|
|
@@ -308,11 +275,6 @@ export default {
|
|
|
308
275
|
return "*";
|
|
309
276
|
}
|
|
310
277
|
},
|
|
311
|
-
newFilePreview() {
|
|
312
|
-
return this.newFile.type.startsWith("image/")
|
|
313
|
-
? URL.createObjectURL(this.newFile)
|
|
314
|
-
: null;
|
|
315
|
-
},
|
|
316
278
|
permissionsModel() {
|
|
317
279
|
return this.$mapo.$options?.medias?.permissionsModel || "media";
|
|
318
280
|
},
|
|
@@ -341,15 +303,11 @@ export default {
|
|
|
341
303
|
...mapActions("mapo/media", ["closeEditor", "deleteMedia", "updateMedia"]),
|
|
342
304
|
saveMedia() {
|
|
343
305
|
this.updateMedia({
|
|
344
|
-
|
|
345
|
-
name: this.media.name,
|
|
346
|
-
title: this.media.title,
|
|
347
|
-
description: this.media.description,
|
|
348
|
-
alt_text: this.media.alt_text,
|
|
306
|
+
...this.media,
|
|
349
307
|
file: this.newFile || undefined,
|
|
350
308
|
same_url: (this.newFile && this.sameUrl) || undefined,
|
|
351
309
|
language_code: this.$i18n.locale,
|
|
352
|
-
}).
|
|
310
|
+
}).finally(() => {
|
|
353
311
|
this.newFile = null;
|
|
354
312
|
this.sameUrl = false;
|
|
355
313
|
});
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<div class="d-flex flex-column flex-grow-1">
|
|
4
|
+
<v-file-input
|
|
5
|
+
v-model="newFile"
|
|
6
|
+
:accept="accept"
|
|
7
|
+
:label="$t('mapo.mediaEditor.changeFile')"
|
|
8
|
+
show-size
|
|
9
|
+
dense
|
|
10
|
+
prepend-icon
|
|
11
|
+
outlined
|
|
12
|
+
class="rounded-0"
|
|
13
|
+
></v-file-input>
|
|
14
|
+
<v-checkbox
|
|
15
|
+
v-if="newFile"
|
|
16
|
+
v-model="sameUrl"
|
|
17
|
+
:label="$t('mapo.mediaEditor.maintainOldUrl')"
|
|
18
|
+
class="ma-0"
|
|
19
|
+
hide-details
|
|
20
|
+
dense
|
|
21
|
+
></v-checkbox>
|
|
22
|
+
</div>
|
|
23
|
+
<v-img
|
|
24
|
+
v-if="newFile && newFilePreview"
|
|
25
|
+
:src="newFilePreview"
|
|
26
|
+
aspect-ratio="1"
|
|
27
|
+
min-width="70px"
|
|
28
|
+
max-width="110px"
|
|
29
|
+
class="grey lighten-2 ml-3"
|
|
30
|
+
>
|
|
31
|
+
<template v-slot:placeholder>
|
|
32
|
+
<v-row class="fill-height ma-0" align="center" justify="center">
|
|
33
|
+
<v-progress-circular
|
|
34
|
+
indeterminate
|
|
35
|
+
color="grey lighten-5"
|
|
36
|
+
></v-progress-circular>
|
|
37
|
+
</v-row>
|
|
38
|
+
</template>
|
|
39
|
+
</v-img>
|
|
40
|
+
</div>
|
|
41
|
+
</template>
|
|
42
|
+
|
|
43
|
+
<script>
|
|
44
|
+
export default {
|
|
45
|
+
data() {
|
|
46
|
+
return {
|
|
47
|
+
newFile: null,
|
|
48
|
+
sameUrl: false,
|
|
49
|
+
};
|
|
50
|
+
},
|
|
51
|
+
props: {
|
|
52
|
+
accept: String,
|
|
53
|
+
file: {},
|
|
54
|
+
maintainUrl: Boolean,
|
|
55
|
+
},
|
|
56
|
+
watch: {
|
|
57
|
+
newFile(val) {
|
|
58
|
+
this.$emit("update:file", val);
|
|
59
|
+
},
|
|
60
|
+
file(val) {
|
|
61
|
+
this.newFile = val;
|
|
62
|
+
},
|
|
63
|
+
sameUrl(val) {
|
|
64
|
+
this.$emit("update:maintainUrl", val);
|
|
65
|
+
},
|
|
66
|
+
maintainUrl(val) {
|
|
67
|
+
this.sameUrl = val;
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
computed: {
|
|
71
|
+
newFilePreview() {
|
|
72
|
+
return this.newFile?.type?.startsWith("image/")
|
|
73
|
+
? URL.createObjectURL(this.newFile)
|
|
74
|
+
: null;
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
</script>
|
|
@@ -26,8 +26,21 @@
|
|
|
26
26
|
}}</v-list-item-title>
|
|
27
27
|
</v-list-item>
|
|
28
28
|
<v-divider></v-divider>
|
|
29
|
+
<v-list-item
|
|
30
|
+
v-for="conf in mimeFolders"
|
|
31
|
+
:key="conf.mime"
|
|
32
|
+
:input-value="searchMime == conf.mime"
|
|
33
|
+
dense
|
|
34
|
+
@click.stop="setSearchMime(conf.mime)"
|
|
35
|
+
>
|
|
36
|
+
<v-list-item-icon>
|
|
37
|
+
<v-icon>{{ conf.icon }}</v-icon>
|
|
38
|
+
</v-list-item-icon>
|
|
39
|
+
<v-list-item-title>{{ conf.label }}</v-list-item-title>
|
|
40
|
+
</v-list-item>
|
|
41
|
+
<v-divider></v-divider>
|
|
29
42
|
</template>
|
|
30
|
-
<template v-if="parentFolder" v-slot:append>
|
|
43
|
+
<template v-if="parentFolder || searchMime" v-slot:append>
|
|
31
44
|
<v-divider></v-divider>
|
|
32
45
|
<v-list-item
|
|
33
46
|
class="py-1"
|
|
@@ -50,7 +63,7 @@
|
|
|
50
63
|
@click.stop="getRoot({ folder })"
|
|
51
64
|
>
|
|
52
65
|
<v-list-item-icon dense>
|
|
53
|
-
<v-icon>mdi-folder
|
|
66
|
+
<v-icon>mdi-folder</v-icon>
|
|
54
67
|
</v-list-item-icon>
|
|
55
68
|
<v-list-item-content dense>
|
|
56
69
|
<v-list-item-title v-text="folder.title"></v-list-item-title>
|
|
@@ -105,7 +118,10 @@
|
|
|
105
118
|
$t("mapo.cancel")
|
|
106
119
|
}}</v-btn>
|
|
107
120
|
<v-btn color="primary" text @click="saveFolder">{{
|
|
108
|
-
|
|
121
|
+
folderEdit.id
|
|
122
|
+
? $t("mapo.save")
|
|
123
|
+
: $t("mapo.create")
|
|
124
|
+
|
|
109
125
|
}}</v-btn>
|
|
110
126
|
</v-card-actions>
|
|
111
127
|
</v-card>
|
|
@@ -127,7 +143,6 @@
|
|
|
127
143
|
}
|
|
128
144
|
|
|
129
145
|
.media-folders--empty {
|
|
130
|
-
height: 100%;
|
|
131
146
|
display: flex;
|
|
132
147
|
flex-direction: column;
|
|
133
148
|
align-content: center;
|
|
@@ -170,8 +185,10 @@ export default {
|
|
|
170
185
|
expanded: false,
|
|
171
186
|
dialog: false,
|
|
172
187
|
folderEdit: {},
|
|
188
|
+
searchMime: false,
|
|
173
189
|
};
|
|
174
190
|
},
|
|
191
|
+
props: { mime: { type: String, default: "" } },
|
|
175
192
|
methods: {
|
|
176
193
|
...mapActions("mapo/media", [
|
|
177
194
|
"getRoot",
|
|
@@ -207,6 +224,20 @@ export default {
|
|
|
207
224
|
this.folderEdit = {};
|
|
208
225
|
},
|
|
209
226
|
slugify,
|
|
227
|
+
setSearchMime(mime) {
|
|
228
|
+
this.searchMime = mime;
|
|
229
|
+
this.getRoot({ mime, all: true });
|
|
230
|
+
},
|
|
231
|
+
},
|
|
232
|
+
mounted() {
|
|
233
|
+
this.storeUnsubscribe = this.$store.subscribeAction((action) => {
|
|
234
|
+
if ((action.type = "mapo/media/getRoot" && !action.payload?.mime)) {
|
|
235
|
+
this.searchMime = null;
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
},
|
|
239
|
+
destroyed() {
|
|
240
|
+
if (this.storeUnsubscribe) this.storeUnsubscribe();
|
|
210
241
|
},
|
|
211
242
|
computed: {
|
|
212
243
|
...mapGetters("mapo/media", [
|
|
@@ -227,6 +258,30 @@ export default {
|
|
|
227
258
|
expandOnHover: !this.isMobile,
|
|
228
259
|
};
|
|
229
260
|
},
|
|
261
|
+
mimeFolders() {
|
|
262
|
+
return [
|
|
263
|
+
{
|
|
264
|
+
mime: "image/*",
|
|
265
|
+
label: this.$t("mapo.mediaFolders.imageFolder"),
|
|
266
|
+
icon: "mdi-folder-image",
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
mime: "video/*",
|
|
270
|
+
label: this.$t("mapo.mediaFolders.videoFolder"),
|
|
271
|
+
icon: "mdi-folder-play",
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
mime: "audio/*",
|
|
275
|
+
label: this.$t("mapo.mediaFolders.audioFolder"),
|
|
276
|
+
icon: "mdi-folder-music",
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
mime: "application/*",
|
|
280
|
+
label: this.$t("mapo.mediaFolders.docFolder"),
|
|
281
|
+
icon: "mdi-folder-text",
|
|
282
|
+
},
|
|
283
|
+
].filter(({ mime }) => !this.mime || mime == this.mime);
|
|
284
|
+
},
|
|
230
285
|
},
|
|
231
286
|
};
|
|
232
287
|
</script>
|