@mapomodule/uikit 1.0.0-alpha.4 → 1.0.0-alpha.41
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 +749 -0
- package/components/ConfirmDialog.vue +12 -16
- package/components/Detail/Detail.vue +406 -272
- package/components/Detail/DetailLangSwitch.vue +7 -2
- package/components/DropArea.vue +63 -56
- package/components/Form/Form.vue +218 -0
- package/components/Form/FormField.vue +213 -0
- package/components/Form/FormGroup.vue +146 -0
- package/components/Form/FormTabs.vue +188 -0
- package/components/Form/defaults.js +91 -0
- package/components/Form/fields/ColorField.vue +79 -0
- package/components/{fields → Form/fields}/DateField.vue +20 -11
- package/components/Form/fields/EnhancedMediaField.vue +224 -0
- package/components/Form/fields/FileField.vue +125 -0
- package/components/Form/fields/FksField.vue +88 -0
- package/components/Form/fields/MediaField.vue +159 -0
- package/components/Form/fields/MediaM2mField.vue +149 -0
- package/components/Form/fields/Repeater.vue +593 -0
- package/components/Form/fields/SeoPreview.vue +89 -0
- package/components/Form/fields/wygEditor/defaults.js +25 -0
- package/components/{fields/TinyMce → Form/fields/wygEditor}/utils/events.js +0 -0
- package/components/{fields/TinyMce → Form/fields/wygEditor}/utils/mapomedia.plugin.js +7 -6
- package/components/{fields/TinyMce → Form/fields/wygEditor}/utils/script.injector.js +0 -0
- package/components/Form/fields/wygEditor/wygEditor.vue +285 -0
- package/components/LangSwitcher.vue +44 -0
- package/components/List/List.vue +119 -42
- package/components/List/ListActions.vue +60 -21
- package/components/List/ListFilters.vue +166 -114
- package/components/List/ListHead.vue +30 -12
- package/components/List/ListQuickEdit.vue +130 -61
- package/components/List/ListTable.vue +292 -80
- package/components/Login.vue +17 -7
- package/components/LogoutButton.vue +43 -28
- package/components/MediaManager/MediaBreadcrumbs.vue +45 -0
- package/components/MediaManager/MediaEditor.vue +330 -122
- package/components/MediaManager/MediaFolders.vue +169 -116
- package/components/MediaManager/MediaGallery.vue +151 -146
- package/components/MediaManager/MediaManager.vue +117 -159
- package/components/MediaManager/MediaManagerDialog.vue +36 -31
- package/components/MediaManager/MediaPreview.vue +203 -0
- package/components/MediaManager/MediaUploader.vue +55 -43
- package/components/SnackBar.vue +5 -7
- package/components/ThemeToggle.vue +13 -0
- package/components/layout/Sidebar/Sidebar.vue +61 -30
- package/components/layout/Sidebar/SidebarList.vue +19 -15
- package/components/layout/Sidebar/SidebarListItem.vue +122 -38
- package/components/layout/Sidebar/SidebarProfile.vue +42 -0
- package/components/layout/Sidebar/SidebarTitle.vue +45 -0
- package/components/layout/Topbar/Topbar.vue +11 -42
- package/components/layout/routebuilder.js +3 -3
- package/defaults/i18n.js +37 -0
- package/defaults/vuetify.js +34 -0
- package/layouts/default.vue +33 -18
- package/layouts/empty.vue +10 -0
- package/module.js +7 -5
- package/package.json +6 -4
- package/pages/index.vue +19 -18
- package/static/{favicon.ico → mapo/favicon.ico} +0 -0
- package/static/mapo/tinymce-skins/mapo-dark/content.inline.min.css +7 -0
- package/static/mapo/tinymce-skins/mapo-dark/content.min.css +7 -0
- package/static/mapo/tinymce-skins/mapo-dark/content.mobile.min.css +7 -0
- package/static/mapo/tinymce-skins/mapo-dark/skin.min.css +7 -0
- package/static/mapo/tinymce-skins/mapo-dark/skin.mobile.min.css +7 -0
- package/static/mapo/tinymce-skins/mapo-light/content.inline.min.css +7 -0
- package/static/mapo/tinymce-skins/mapo-light/content.min.css +7 -0
- package/static/mapo/tinymce-skins/mapo-light/content.mobile.min.css +7 -0
- package/static/mapo/tinymce-skins/mapo-light/skin.min.css +7 -0
- package/static/mapo/tinymce-skins/mapo-light/skin.mobile.min.css +7 -0
- package/translations/en-US.js +135 -0
- package/translations/it-IT.js +137 -0
- package/components/Detail/DetailField.vue +0 -129
- package/components/Detail/defaults.js +0 -50
- package/components/fields/M2mField.vue +0 -95
- package/components/fields/MediaField.vue +0 -195
- package/components/fields/MediaM2mField.vue +0 -238
- package/components/fields/TinyMce/TinyMce.vue +0 -177
- package/components/fields/TinyMce/defaults.js +0 -55
- package/components/layout/Sidebar/SidebarFooter.vue +0 -75
- package/defaults.js +0 -29
- package/layouts/error.vue +0 -45
|
@@ -1,130 +1,158 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="
|
|
3
|
-
<v-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
:lazy-src="media.thumbnail"
|
|
16
|
-
aspect-ratio="1"
|
|
17
|
-
class="grey lighten-2 elevation-4 selection__item"
|
|
18
|
-
>
|
|
19
|
-
<template v-slot:placeholder>
|
|
20
|
-
<v-row class="fill-height ma-0" align="center" justify="center">
|
|
21
|
-
<v-progress-circular
|
|
22
|
-
indeterminate
|
|
23
|
-
color="grey lighten-5"
|
|
24
|
-
></v-progress-circular>
|
|
25
|
-
</v-row>
|
|
26
|
-
</template>
|
|
27
|
-
</v-img>
|
|
28
|
-
</v-col>
|
|
29
|
-
</v-row>
|
|
30
|
-
<v-row
|
|
31
|
-
v-if="!medias.length"
|
|
32
|
-
class="d-flex flex-column"
|
|
33
|
-
dense
|
|
34
|
-
align="center"
|
|
35
|
-
justify="center"
|
|
36
|
-
>
|
|
37
|
-
<v-icon size="60"> mdi-alert-circle-outline </v-icon>
|
|
38
|
-
<p>No media fund...</p>
|
|
39
|
-
</v-row>
|
|
40
|
-
<v-row v-if="medias.length">
|
|
41
|
-
<v-col
|
|
2
|
+
<div class="media-gallery--wrapper">
|
|
3
|
+
<draggable v-model="draggableSelection" animation="150" v-if="selection && selection.length && selectMode == 'multi'" class="media-gallery--selection grey darken-2">
|
|
4
|
+
<MediaPreview
|
|
5
|
+
v-for="media in selection"
|
|
6
|
+
:key="media.file"
|
|
7
|
+
@click.native.stop="select(media)"
|
|
8
|
+
:media="media"
|
|
9
|
+
icon-size="20px"
|
|
10
|
+
class="elevation-4 media-gallery--selection-item"
|
|
11
|
+
/>
|
|
12
|
+
</draggable>
|
|
13
|
+
<div ref="masonry" class="media-gallery--masonry" v-if="medias.length">
|
|
14
|
+
<div
|
|
42
15
|
v-for="media in medias"
|
|
43
16
|
:key="media.file"
|
|
44
|
-
class="
|
|
45
|
-
cols="6"
|
|
46
|
-
sm="3"
|
|
47
|
-
md="2"
|
|
17
|
+
class="media-gallery--card"
|
|
48
18
|
>
|
|
49
19
|
<v-btn
|
|
50
|
-
@click.stop="
|
|
20
|
+
@click.stop="openEditor(media)"
|
|
51
21
|
icon
|
|
52
22
|
small
|
|
53
23
|
:ripple="false"
|
|
54
24
|
color="white"
|
|
55
|
-
class="
|
|
25
|
+
class="media-gallery--card-btn"
|
|
26
|
+
:class="{'d-none': selectMode == 'none'}"
|
|
56
27
|
>
|
|
57
28
|
<v-icon>mdi-circle-edit-outline</v-icon>
|
|
58
29
|
</v-btn>
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
:
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
v-model="currentPage"
|
|
84
|
-
:length="pages"
|
|
85
|
-
></v-pagination>
|
|
86
|
-
</v-col>
|
|
87
|
-
</v-row>
|
|
30
|
+
<MediaPreview
|
|
31
|
+
class="elevation-4 cursor-pointer"
|
|
32
|
+
:media="media"
|
|
33
|
+
:class="{ 'media-gallery--selected': isSelected(media)}"
|
|
34
|
+
@click.native="select(media)"
|
|
35
|
+
filename
|
|
36
|
+
video-preview
|
|
37
|
+
/>
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
<div class="media-gallery--loading" v-else-if="loading">
|
|
41
|
+
<v-icon size="30">mdi-timer-sand</v-icon>
|
|
42
|
+
{{ $t('mapo.fetchingData') }}
|
|
43
|
+
</div>
|
|
44
|
+
<div class="media-gallery--empty" v-else>
|
|
45
|
+
<v-icon size="60"> mdi-image-off-outline </v-icon>
|
|
46
|
+
<p>{{ $t("mapo.mediaGallery.noMediaFound") }}</p>
|
|
47
|
+
</div>
|
|
48
|
+
<v-pagination
|
|
49
|
+
class="mt-2"
|
|
50
|
+
v-if="pages > 1"
|
|
51
|
+
v-model="currentPage"
|
|
52
|
+
:length="pages"
|
|
53
|
+
></v-pagination>
|
|
88
54
|
</div>
|
|
89
55
|
</template>
|
|
90
56
|
|
|
91
|
-
<style lang="scss"
|
|
92
|
-
.
|
|
57
|
+
<style lang="scss">
|
|
58
|
+
.cursor-pointer{
|
|
59
|
+
cursor: pointer;
|
|
60
|
+
}
|
|
61
|
+
.media-gallery--card {
|
|
93
62
|
display: flex;
|
|
94
63
|
position: relative;
|
|
95
|
-
|
|
64
|
+
&-btn {
|
|
96
65
|
position: absolute;
|
|
97
66
|
z-index: 1;
|
|
98
|
-
right:
|
|
99
|
-
bottom:
|
|
67
|
+
right: 0;
|
|
68
|
+
bottom: 0;
|
|
100
69
|
background: #1e1e1ea1;
|
|
101
70
|
border-radius: 50% 0 0;
|
|
102
71
|
}
|
|
103
72
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
73
|
+
|
|
74
|
+
.media-gallery--wrapper{
|
|
75
|
+
height: 100%;
|
|
76
|
+
display: flex;
|
|
77
|
+
flex-direction: column;
|
|
78
|
+
justify-content: space-between;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
$wcol: calc(100% / 6 - 12px);
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
.media-gallery--masonry {
|
|
85
|
+
width: 100%;
|
|
86
|
+
padding: 10px;
|
|
87
|
+
overflow-y: auto;
|
|
88
|
+
overflow-x: hidden;
|
|
89
|
+
display: grid;
|
|
90
|
+
grid-template-columns: $wcol $wcol $wcol $wcol $wcol $wcol;
|
|
91
|
+
grid-template-rows: auto auto auto ;
|
|
92
|
+
column-gap: 12px;
|
|
93
|
+
row-gap: 12px;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
@media (max-width: 960px) {
|
|
97
|
+
$wcol: calc(100% / 3 - 12px);
|
|
98
|
+
.media-gallery--masonry{
|
|
99
|
+
grid-template-columns: $wcol $wcol $wcol;
|
|
114
100
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
align-items: center;
|
|
122
|
-
height: 100%;
|
|
123
|
-
background: #00000082;
|
|
124
|
-
border: solid #ffffff6e 2px;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
@media (max-width: 600px) {
|
|
104
|
+
$wcol: calc(100% / 2 - 6px);
|
|
105
|
+
.media-gallery--masonry{
|
|
106
|
+
grid-template-columns: $wcol $wcol;
|
|
125
107
|
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.media-gallery--empty{
|
|
111
|
+
height: 100%;
|
|
112
|
+
display: flex;
|
|
113
|
+
flex-direction: column;
|
|
114
|
+
align-content: center;
|
|
115
|
+
justify-content: center;
|
|
116
|
+
text-align: center;
|
|
117
|
+
}
|
|
118
|
+
.media-gallery--loading{
|
|
119
|
+
height: 100%;
|
|
120
|
+
display: flex;
|
|
121
|
+
flex-direction: column;
|
|
122
|
+
align-items: center;
|
|
123
|
+
justify-content: center;
|
|
124
|
+
text-align: center;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.media-gallery--selection {
|
|
128
|
+
min-height: 60px;
|
|
129
|
+
display: flex;
|
|
130
|
+
overflow-x: auto;
|
|
131
|
+
overflow-y: hidden;
|
|
132
|
+
|
|
133
|
+
margin-bottom: 10px;
|
|
134
|
+
&-item{
|
|
135
|
+
width: 50px;
|
|
136
|
+
height: 50px;
|
|
137
|
+
flex-grow: 0;
|
|
138
|
+
margin: 5px;
|
|
139
|
+
cursor: pointer;
|
|
140
|
+
&:hover::before {
|
|
141
|
+
content: "\F0156";
|
|
142
|
+
font: normal normal normal 30px/1 "Material Design Icons";
|
|
143
|
+
width: 100%;
|
|
144
|
+
display: flex;
|
|
145
|
+
justify-content: center;
|
|
146
|
+
align-items: center;
|
|
147
|
+
height: 100%;
|
|
148
|
+
background: #00000082;
|
|
149
|
+
border: solid #ffffff6e 2px;
|
|
150
|
+
color: white;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
126
154
|
}
|
|
127
|
-
.selected {
|
|
155
|
+
.media-gallery--selected {
|
|
128
156
|
&::after {
|
|
129
157
|
content: "";
|
|
130
158
|
background: #56be5057;
|
|
@@ -133,69 +161,46 @@
|
|
|
133
161
|
height: 100%;
|
|
134
162
|
}
|
|
135
163
|
}
|
|
136
|
-
.theme--light .selection {
|
|
137
|
-
box-shadow: inset 5px 5px 10px #e3e3e3, inset -5px -5px 10px #e3e3e3;
|
|
138
|
-
}
|
|
139
164
|
</style>
|
|
140
165
|
|
|
141
166
|
<script>
|
|
167
|
+
import { mapGetters, mapActions } from "vuex"
|
|
168
|
+
import draggable from "vuedraggable";
|
|
169
|
+
|
|
142
170
|
export default {
|
|
143
171
|
name: "MediaGallery",
|
|
144
|
-
|
|
145
|
-
return {
|
|
146
|
-
selection: [],
|
|
147
|
-
};
|
|
148
|
-
},
|
|
149
|
-
props: {
|
|
150
|
-
medias: {
|
|
151
|
-
type: Array,
|
|
152
|
-
required: true,
|
|
153
|
-
default: () => ({}),
|
|
154
|
-
},
|
|
155
|
-
page: {
|
|
156
|
-
type: Number,
|
|
157
|
-
default: 1,
|
|
158
|
-
},
|
|
159
|
-
pages: {
|
|
160
|
-
type: Number,
|
|
161
|
-
default: 1,
|
|
162
|
-
},
|
|
163
|
-
select: {
|
|
164
|
-
defaut: "none",
|
|
165
|
-
type: String,
|
|
166
|
-
validator(value) {
|
|
167
|
-
return ["none", "single", "multi"].indexOf(value) !== -1;
|
|
168
|
-
},
|
|
169
|
-
},
|
|
170
|
-
},
|
|
172
|
+
components: { draggable },
|
|
171
173
|
computed: {
|
|
174
|
+
...mapGetters("mapo/media", ["page", "pages", "medias", "selection", "selectMode", "loading"]),
|
|
175
|
+
draggableSelection: {
|
|
176
|
+
get() { return this.selection; },
|
|
177
|
+
set(val) { this.setSelection(val); }
|
|
178
|
+
},
|
|
172
179
|
currentPage: {
|
|
173
180
|
get() {
|
|
174
181
|
return this.page;
|
|
175
182
|
},
|
|
176
183
|
set(val) {
|
|
177
|
-
this
|
|
184
|
+
this.getRoot({ page: val }).then(() => {
|
|
185
|
+
this.$refs.masonry?.scrollTo({ top: 0, behavior: "smooth" })
|
|
186
|
+
})
|
|
178
187
|
},
|
|
179
188
|
},
|
|
180
189
|
},
|
|
181
190
|
methods: {
|
|
191
|
+
...mapActions("mapo/media", ["getRoot", "openEditor", "select", "setSelection"]),
|
|
182
192
|
isSelected(media) {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
index == -1
|
|
191
|
-
? this.selection.push(media)
|
|
192
|
-
: this.selection.splice(index, 1);
|
|
193
|
-
this.selection = this.selection.slice();
|
|
194
|
-
this.$emit("selectionChange", this.selection);
|
|
193
|
+
switch (this.selectMode) {
|
|
194
|
+
case "multi":
|
|
195
|
+
return this.selection.findIndex((m) => m.id === media.id) !== -1;
|
|
196
|
+
case "single":
|
|
197
|
+
return this.selection?.id === media.id;
|
|
198
|
+
default:
|
|
199
|
+
return false;
|
|
195
200
|
}
|
|
196
201
|
},
|
|
197
|
-
|
|
198
|
-
|
|
202
|
+
fileName(media) {
|
|
203
|
+
return media && media.file && media.file.split("/").pop();
|
|
199
204
|
},
|
|
200
205
|
},
|
|
201
206
|
};
|
|
@@ -1,193 +1,151 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
<div class="media-manager--wrapper">
|
|
3
|
+
<MediaFolders v-show="!editMedia" v-if="!noFolders" />
|
|
4
|
+
<v-card elevation="0" class="media-manager--v-card" :class="{ transparent: !fillBackgroud, editing:editMedia }">
|
|
5
|
+
<v-card-title class="d-flex flex-wrap pa-0">
|
|
6
|
+
<div class="d-flex flex-grow-1">
|
|
7
|
+
<v-tabs v-model="tab" background-color="transparent" :show-arrows="false">
|
|
8
|
+
<v-tab>{{ $t("mapo.mediaManager.gallery") }}</v-tab>
|
|
9
|
+
<v-tab>{{ $t("mapo.mediaManager.uploader") }}</v-tab>
|
|
10
|
+
</v-tabs>
|
|
11
|
+
<v-spacer></v-spacer>
|
|
12
|
+
<v-btn v-show="$vuetify.breakpoint.xs" class="ma-2 ml-auto" @click="getRoot" icon>
|
|
6
13
|
<v-icon>mdi-update</v-icon>
|
|
7
14
|
</v-btn>
|
|
8
|
-
<v-btn
|
|
9
|
-
v-if="parentFolder"
|
|
10
|
-
class="ma-2"
|
|
11
|
-
@click="getRoot({ folder: { id: parentFolder.updir } })"
|
|
12
|
-
icon
|
|
13
|
-
>
|
|
14
|
-
<v-icon>mdi-arrow-left</v-icon>
|
|
15
|
-
</v-btn>
|
|
16
|
-
<span class="ma-2 d-flex align-center">{{
|
|
17
|
-
parentFolder ? parentFolder.path : "/"
|
|
18
|
-
}}</span>
|
|
19
15
|
</div>
|
|
20
|
-
<
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
</div>
|
|
28
|
-
|
|
29
|
-
<div v-if="!editMedia">
|
|
30
|
-
<MediaFolders
|
|
31
|
-
v-if="!noFolders"
|
|
32
|
-
v-bind="{ folders, parentFolder }"
|
|
33
|
-
@updateFolder="updateOrCreateFolder($event)"
|
|
34
|
-
@deleteFolder="deleteFolder($event)"
|
|
35
|
-
@goToFolder="
|
|
36
|
-
parentFolder = $event;
|
|
37
|
-
getRoot();
|
|
16
|
+
<div class="d-flex ma-auto mr-0 pb-2 pb-sm-0" :style="$vuetify.breakpoint.xs ? 'width: 100%' : ''">
|
|
17
|
+
<v-text-field
|
|
18
|
+
v-show="!editMedia && tab == 0"
|
|
19
|
+
v-model="searchValue"
|
|
20
|
+
@input="
|
|
21
|
+
loadingSearch = true;
|
|
22
|
+
search();
|
|
38
23
|
"
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
24
|
+
prepend-inner-icon="mdi-magnify"
|
|
25
|
+
:label="$t('mapo.search')"
|
|
26
|
+
single-line
|
|
27
|
+
hide-details
|
|
28
|
+
outlined
|
|
29
|
+
dense
|
|
30
|
+
clearable
|
|
31
|
+
:loading="loadingSearch"
|
|
32
|
+
class="mx-2 mt-2 rounded-0"
|
|
33
|
+
></v-text-field>
|
|
34
|
+
<v-btn v-show="!$vuetify.breakpoint.xs" class="ma-2 ml-0" @click="getRoot" icon>
|
|
35
|
+
<v-icon>mdi-update</v-icon>
|
|
36
|
+
</v-btn>
|
|
37
|
+
</div>
|
|
38
|
+
</v-card-title>
|
|
39
|
+
<v-progress-linear v-if="loading" indeterminate></v-progress-linear>
|
|
40
|
+
<MediaBreadcrumbs/>
|
|
41
|
+
<v-card-text class="media-manager--card-text pa-0">
|
|
42
|
+
<v-tabs-items touchless v-model="tab" class="transparent fill-height">
|
|
43
|
+
<v-tab-item class="fill-height">
|
|
44
|
+
<MediaGallery v-show="!editMedia"/>
|
|
45
|
+
<MediaEditor/>
|
|
50
46
|
</v-tab-item>
|
|
51
|
-
<v-tab-item>
|
|
47
|
+
<v-tab-item class="fill-height">
|
|
52
48
|
<MediaUploader
|
|
53
|
-
|
|
54
|
-
|
|
49
|
+
@Upload="
|
|
50
|
+
tab = 0;
|
|
51
|
+
getRoot({ page: 1 });
|
|
52
|
+
"
|
|
55
53
|
/>
|
|
56
54
|
</v-tab-item>
|
|
57
55
|
</v-tabs-items>
|
|
58
|
-
</
|
|
59
|
-
<
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
/>
|
|
56
|
+
</v-card-text>
|
|
57
|
+
<v-card-actions class="pa-0">
|
|
58
|
+
<!-- Slot to provide custom button actions inside the media manager -->
|
|
59
|
+
<slot name="actions"></slot>
|
|
60
|
+
</v-card-actions>
|
|
64
61
|
</v-card>
|
|
62
|
+
</div>
|
|
63
|
+
|
|
65
64
|
</template>
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
<style lang="scss">
|
|
66
|
+
.v-card.media-manager--v-card{
|
|
67
|
+
display: flex;
|
|
68
|
+
flex-direction: column;
|
|
69
|
+
flex-grow: 1;
|
|
70
|
+
border-radius: 0px;
|
|
71
|
+
max-width: calc(100% - 56px);
|
|
72
|
+
&.editing{
|
|
73
|
+
max-width: 100%;
|
|
74
|
+
}
|
|
75
|
+
@media (max-width: 600px){
|
|
76
|
+
max-width: 100%;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
.v-slide-group__next--disabled, .v-slide-group__prev--disabled{
|
|
80
|
+
display: none !important;
|
|
81
|
+
}
|
|
82
|
+
.media-manager--card-text{
|
|
83
|
+
max-height: calc(100vh - 100px);
|
|
84
|
+
min-height: 400px;
|
|
85
|
+
flex-grow: 1;
|
|
86
|
+
@media (max-width: 600px){
|
|
87
|
+
max-height: calc(100vh - 195px);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
.v-dialog .media-manager--card-text{
|
|
91
|
+
max-height: calc(100vh - 300px);
|
|
92
|
+
}
|
|
93
|
+
.media-manager--wrapper{
|
|
94
|
+
display: flex;
|
|
95
|
+
height: inherit;
|
|
96
|
+
flex-direction: column-reverse;
|
|
97
|
+
position: relative;
|
|
98
|
+
justify-content: flex-end;
|
|
99
|
+
@media (min-width: 600px){
|
|
100
|
+
flex-direction: row;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
68
103
|
</style>
|
|
69
104
|
|
|
70
105
|
<script>
|
|
71
|
-
import
|
|
106
|
+
import { debounce } from "@mapomodule/utils/helpers/debounce";
|
|
107
|
+
import { mapGetters, mapActions } from "vuex"
|
|
108
|
+
|
|
109
|
+
|
|
72
110
|
export default {
|
|
73
111
|
name: "MediaManager",
|
|
74
|
-
|
|
75
|
-
data() {
|
|
112
|
+
data(){
|
|
76
113
|
return {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
parentFolder: null,
|
|
82
|
-
page: 1,
|
|
83
|
-
pages: 1,
|
|
84
|
-
tab: null,
|
|
85
|
-
editMedia: null,
|
|
86
|
-
};
|
|
114
|
+
tab: 0,
|
|
115
|
+
searchValue: "",
|
|
116
|
+
loadingSearch: false,
|
|
117
|
+
}
|
|
87
118
|
},
|
|
88
119
|
props: {
|
|
89
|
-
select: {
|
|
90
|
-
type: String,
|
|
91
|
-
default: "none",
|
|
92
|
-
validator(val) {
|
|
93
|
-
return ["none", "single", "multi"].indexOf(val) !== -1;
|
|
94
|
-
},
|
|
95
|
-
},
|
|
96
120
|
noFolders: {
|
|
97
121
|
type: Boolean,
|
|
98
122
|
default: false,
|
|
99
123
|
},
|
|
100
|
-
|
|
101
|
-
type:
|
|
102
|
-
|
|
103
|
-
},
|
|
104
|
-
dark: {
|
|
105
|
-
type: Boolean,
|
|
106
|
-
default: false,
|
|
107
|
-
},
|
|
108
|
-
elevation: {
|
|
109
|
-
type: Number | String,
|
|
110
|
-
default: undefined,
|
|
124
|
+
mime: {
|
|
125
|
+
type: String,
|
|
126
|
+
required: false,
|
|
111
127
|
},
|
|
128
|
+
fillBackgroud: Boolean
|
|
112
129
|
},
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
this.
|
|
116
|
-
this.
|
|
117
|
-
|
|
118
|
-
return this._mediaFolderCrud;
|
|
119
|
-
},
|
|
120
|
-
mediaFileCrud() {
|
|
121
|
-
this._mediaFileCrud =
|
|
122
|
-
this._mediaFileCrud || this.$mapo.$api.crud("api/camomilla/media");
|
|
123
|
-
return this._mediaFileCrud;
|
|
124
|
-
},
|
|
130
|
+
watch: {
|
|
131
|
+
'$i18n.locale': async function(locale) {
|
|
132
|
+
if (this.editMedia)
|
|
133
|
+
this.openEditor(this.editMedia);
|
|
134
|
+
}
|
|
125
135
|
},
|
|
136
|
+
computed: mapGetters("mapo/media", ["parentFolder", "medias", "folders", "parentFolders", "page", "pages", "loading", "editMedia" ]),
|
|
126
137
|
methods: {
|
|
127
|
-
getRoot
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
this.page = page || this.page;
|
|
132
|
-
const params = { page: this.page };
|
|
133
|
-
if (id) {
|
|
134
|
-
response = await this.mediaFolderCrud.detail(id, {
|
|
135
|
-
params,
|
|
136
|
-
});
|
|
137
|
-
} else {
|
|
138
|
-
response = await this.mediaFolderCrud.list({ params });
|
|
139
|
-
}
|
|
140
|
-
this.processResponse(response);
|
|
141
|
-
},
|
|
142
|
-
|
|
143
|
-
updateOrCreateFolder(folder) {
|
|
144
|
-
return this.mediaFolderCrud
|
|
145
|
-
.updateOrCreate(folder)
|
|
146
|
-
.then(() => this.getRoot());
|
|
147
|
-
},
|
|
148
|
-
|
|
149
|
-
deleteFolder(folder) {
|
|
150
|
-
return this.mediaFolderCrud.delete(folder.id).then(() => this.getRoot());
|
|
151
|
-
},
|
|
152
|
-
|
|
153
|
-
deleteMedia(media) {
|
|
154
|
-
return this.mediaFileCrud.delete(media.id).then(() => {
|
|
155
|
-
(this.editMedia = null), this.getRoot();
|
|
156
|
-
});
|
|
157
|
-
},
|
|
158
|
-
|
|
159
|
-
detailMedia(media_id) {
|
|
160
|
-
return this.mediaFileCrud.detail(media_id);
|
|
161
|
-
},
|
|
162
|
-
|
|
163
|
-
updateMedia(media) {
|
|
164
|
-
const files = ["file", "objectURL", "thumbnail"];
|
|
165
|
-
const payload = this.$mapo.$api.multipart(media, files);
|
|
166
|
-
const conf = { headers: { "Content-Type": "multipart/form-data" } };
|
|
167
|
-
return this.mediaFileCrud
|
|
168
|
-
.partialUpdate(media.id, payload, conf)
|
|
169
|
-
.then(() =>
|
|
170
|
-
this.$mapo.$snack.open({
|
|
171
|
-
message: "file info succesfully updated.",
|
|
172
|
-
})
|
|
173
|
-
);
|
|
174
|
-
},
|
|
175
|
-
processResponse(resp) {
|
|
176
|
-
this.medias = resp?.media?.items || [];
|
|
177
|
-
this.folders = resp?.folders || [];
|
|
178
|
-
this.parentFolder = resp?.parent_folder;
|
|
179
|
-
this.page = resp?.media?.paginator?.page;
|
|
180
|
-
this.pages = resp?.media?.paginator?.pages;
|
|
181
|
-
},
|
|
182
|
-
selectionChange(event) {
|
|
183
|
-
this.$emit("selectionChange", event);
|
|
184
|
-
},
|
|
185
|
-
async openEditor(event) {
|
|
186
|
-
this.editMedia = await this.detailMedia(event.id);
|
|
187
|
-
},
|
|
138
|
+
...mapActions("mapo/media", ["getRoot", "openEditor", "updateMedia", "updateOrCreateFolder", "deleteFolder", "deleteMedia", "reset"]),
|
|
139
|
+
search: debounce(function () {
|
|
140
|
+
this.getRoot({search: this.searchValue}).then(() => (this.loadingSearch = false));
|
|
141
|
+
}, 500),
|
|
188
142
|
},
|
|
189
143
|
async fetch() {
|
|
144
|
+
this.$store.commit("mapo/media/SET_MIME_TYPE", this.mime || null);
|
|
190
145
|
await this.getRoot();
|
|
191
146
|
},
|
|
147
|
+
destroyed(){
|
|
148
|
+
this.reset();
|
|
149
|
+
}
|
|
192
150
|
};
|
|
193
151
|
</script>
|