@mapomodule/uikit 1.0.0-alpha.9 → 2.0.0-beta.1
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/README.md +167 -0
- package/dist/index.d.cts +2 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +18 -0
- package/dist/module.d.cts +2 -0
- package/dist/module.d.mts +2 -0
- package/dist/module.d.ts +2 -0
- package/dist/module.json +9 -0
- package/dist/module.mjs +18 -0
- package/dist/types.d.mts +13 -0
- package/package.json +63 -10
- package/src/index.ts +10 -0
- package/src/module.ts +181 -0
- package/src/runtime/assets/main.css +59 -0
- package/src/runtime/components/MapoConfirmDialog.vue +34 -0
- package/src/runtime/components/MapoDetail.vue +861 -0
- package/src/runtime/components/MapoDetailLangSwitch.vue +166 -0
- package/src/runtime/components/MapoList.vue +339 -0
- package/src/runtime/components/MapoListActions.vue +152 -0
- package/src/runtime/components/MapoListFilters.vue +289 -0
- package/src/runtime/components/MapoListHead.vue +12 -0
- package/src/runtime/components/MapoListQuickEdit.vue +163 -0
- package/src/runtime/components/MapoListTable.vue +926 -0
- package/src/runtime/components/MapoListTabs.vue +48 -0
- package/src/runtime/components/MapoLogin.vue +209 -0
- package/src/runtime/components/MapoLogoutButton.vue +46 -0
- package/src/runtime/components/MapoRootComponents.vue +9 -0
- package/src/runtime/components/MapoSidebar.vue +112 -0
- package/src/runtime/components/MapoSidebarList.vue +35 -0
- package/src/runtime/components/MapoSidebarListItem.vue +79 -0
- package/src/runtime/components/MapoSidebarProfile.vue +57 -0
- package/src/runtime/components/MapoSnackBar.vue +42 -0
- package/src/runtime/components/MapoThemeToggle.vue +23 -0
- package/src/runtime/components/MapoTopbar.vue +36 -0
- package/src/runtime/layouts/default.vue +53 -0
- package/src/runtime/layouts/empty.vue +9 -0
- package/src/runtime/page-meta.nuxt.d.ts +45 -0
- package/src/runtime/pages/index.vue +14 -0
- package/src/runtime/pages/login.vue +7 -0
- package/src/runtime/types/list.ts +64 -0
- package/CHANGELOG.md +0 -177
- package/LICENSE.md +0 -20
- package/assets/mixins.scss +0 -22
- package/assets/variables.scss +0 -18
- package/components/ConfirmDialog.vue +0 -152
- package/components/Detail/Detail.vue +0 -566
- package/components/Detail/DetailField.vue +0 -142
- package/components/Detail/DetailLangSwitch.vue +0 -72
- package/components/Detail/defaults.js +0 -57
- package/components/DropArea.vue +0 -250
- package/components/List/List.vue +0 -254
- package/components/List/ListActions.vue +0 -164
- package/components/List/ListFilters.vue +0 -334
- package/components/List/ListHead.vue +0 -67
- package/components/List/ListQuickEdit.vue +0 -302
- package/components/List/ListTable.vue +0 -406
- package/components/List/ListTabs.vue +0 -65
- package/components/Login.vue +0 -124
- package/components/Logo.vue +0 -79
- package/components/LogoutButton.vue +0 -39
- package/components/MediaManager/MediaEditor.vue +0 -309
- package/components/MediaManager/MediaFolders.vue +0 -263
- package/components/MediaManager/MediaGallery.vue +0 -206
- package/components/MediaManager/MediaManager.vue +0 -233
- package/components/MediaManager/MediaManagerDialog.vue +0 -96
- package/components/MediaManager/MediaPreview.vue +0 -180
- package/components/MediaManager/MediaUploader.vue +0 -165
- package/components/RootComponents.vue +0 -25
- package/components/SnackBar.vue +0 -70
- package/components/fields/DateField.vue +0 -74
- package/components/fields/FksField.vue +0 -60
- package/components/fields/MediaField.vue +0 -213
- package/components/fields/MediaM2mField.vue +0 -243
- package/components/fields/SeoPreview.vue +0 -89
- package/components/fields/wygEditor/defaults.js +0 -55
- package/components/fields/wygEditor/utils/events.js +0 -64
- package/components/fields/wygEditor/utils/mapomedia.plugin.js +0 -31
- package/components/fields/wygEditor/utils/script.injector.js +0 -29
- package/components/fields/wygEditor/wygEditor.vue +0 -196
- package/components/layout/Sidebar/Sidebar.vue +0 -80
- package/components/layout/Sidebar/SidebarFooter.vue +0 -71
- package/components/layout/Sidebar/SidebarList.vue +0 -44
- package/components/layout/Sidebar/SidebarListItem.vue +0 -144
- package/components/layout/Topbar/Topbar.vue +0 -27
- package/components/layout/routebuilder.js +0 -48
- package/defaults.js +0 -29
- package/layouts/default.vue +0 -21
- package/layouts/empty.vue +0 -6
- package/layouts/error.vue +0 -45
- package/module.js +0 -78
- package/pages/index.vue +0 -35
- package/pages/login.vue +0 -10
- package/static/favicon.ico +0 -0
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="pa-4">
|
|
3
|
-
<v-row v-if="internalSelection.length && select == 'multi'" class="selection mb-4 grey darken-2">
|
|
4
|
-
<v-col
|
|
5
|
-
v-for="media in internalSelection"
|
|
6
|
-
:key="media.file"
|
|
7
|
-
class="d-flex"
|
|
8
|
-
cols="2"
|
|
9
|
-
sm="1"
|
|
10
|
-
md="1"
|
|
11
|
-
@click.stop="selectMedia(media)"
|
|
12
|
-
>
|
|
13
|
-
<MediaPreview
|
|
14
|
-
:media="media"
|
|
15
|
-
icon-size="20px"
|
|
16
|
-
class="elevation-4 cursor-pointer selection__item"
|
|
17
|
-
/>
|
|
18
|
-
</v-col>
|
|
19
|
-
</v-row>
|
|
20
|
-
<v-row
|
|
21
|
-
v-if="!medias.length"
|
|
22
|
-
class="d-flex flex-column"
|
|
23
|
-
dense
|
|
24
|
-
align="center"
|
|
25
|
-
justify="center"
|
|
26
|
-
>
|
|
27
|
-
<v-icon size="60"> mdi-alert-circle-outline </v-icon>
|
|
28
|
-
<p>No media fund...</p>
|
|
29
|
-
</v-row>
|
|
30
|
-
<v-row v-if="medias.length">
|
|
31
|
-
<v-col
|
|
32
|
-
v-for="media in medias"
|
|
33
|
-
:key="media.file"
|
|
34
|
-
class="img-container"
|
|
35
|
-
cols="6"
|
|
36
|
-
sm="3"
|
|
37
|
-
md="2"
|
|
38
|
-
>
|
|
39
|
-
<v-btn
|
|
40
|
-
@click.stop="editMedia(media)"
|
|
41
|
-
icon
|
|
42
|
-
small
|
|
43
|
-
:ripple="false"
|
|
44
|
-
color="white"
|
|
45
|
-
class="img-container__btn"
|
|
46
|
-
:class="{'d-none': select == 'none'}"
|
|
47
|
-
>
|
|
48
|
-
<v-icon>mdi-circle-edit-outline</v-icon>
|
|
49
|
-
</v-btn>
|
|
50
|
-
<MediaPreview
|
|
51
|
-
class="elevation-4 cursor-pointer"
|
|
52
|
-
:media="media"
|
|
53
|
-
:selected="isSelected(media)"
|
|
54
|
-
@click.native="selectMedia(media)"
|
|
55
|
-
filename
|
|
56
|
-
video-preview
|
|
57
|
-
/>
|
|
58
|
-
</v-col>
|
|
59
|
-
</v-row>
|
|
60
|
-
<v-row>
|
|
61
|
-
<v-col cols="12">
|
|
62
|
-
<v-pagination
|
|
63
|
-
v-if="pages > 1"
|
|
64
|
-
v-model="currentPage"
|
|
65
|
-
:length="pages"
|
|
66
|
-
></v-pagination>
|
|
67
|
-
</v-col>
|
|
68
|
-
</v-row>
|
|
69
|
-
</div>
|
|
70
|
-
</template>
|
|
71
|
-
|
|
72
|
-
<style lang="scss" scoped>
|
|
73
|
-
.cursor-pointer{
|
|
74
|
-
cursor: pointer;
|
|
75
|
-
}
|
|
76
|
-
.img-container {
|
|
77
|
-
display: flex;
|
|
78
|
-
position: relative;
|
|
79
|
-
&__btn {
|
|
80
|
-
position: absolute;
|
|
81
|
-
z-index: 1;
|
|
82
|
-
right: 12px;
|
|
83
|
-
bottom: 12px;
|
|
84
|
-
background: #1e1e1ea1;
|
|
85
|
-
border-radius: 50% 0 0;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
.selection {
|
|
89
|
-
margin: -16px;
|
|
90
|
-
&__confirm {
|
|
91
|
-
margin: auto 0 auto auto;
|
|
92
|
-
display: flex;
|
|
93
|
-
justify-content: center;
|
|
94
|
-
align-content: center;
|
|
95
|
-
height: 100%;
|
|
96
|
-
}
|
|
97
|
-
&__item:hover::before {
|
|
98
|
-
content: "\F0156";
|
|
99
|
-
font: normal normal normal 30px/1 "Material Design Icons";
|
|
100
|
-
width: 100%;
|
|
101
|
-
display: flex;
|
|
102
|
-
justify-content: center;
|
|
103
|
-
align-items: center;
|
|
104
|
-
height: 100%;
|
|
105
|
-
background: #00000082;
|
|
106
|
-
border: solid #ffffff6e 2px;
|
|
107
|
-
color: white;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
.selected {
|
|
111
|
-
&::after {
|
|
112
|
-
content: "";
|
|
113
|
-
background: #56be5057;
|
|
114
|
-
border: solid #5bc853 2px;
|
|
115
|
-
width: 100%;
|
|
116
|
-
height: 100%;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
</style>
|
|
120
|
-
|
|
121
|
-
<script>
|
|
122
|
-
export default {
|
|
123
|
-
name: "MediaGallery",
|
|
124
|
-
data() {
|
|
125
|
-
return {
|
|
126
|
-
internalSelection: [],
|
|
127
|
-
};
|
|
128
|
-
},
|
|
129
|
-
props: {
|
|
130
|
-
medias: {
|
|
131
|
-
type: Array,
|
|
132
|
-
required: true,
|
|
133
|
-
default: () => ({}),
|
|
134
|
-
},
|
|
135
|
-
page: {
|
|
136
|
-
type: Number,
|
|
137
|
-
default: 1,
|
|
138
|
-
},
|
|
139
|
-
pages: {
|
|
140
|
-
type: Number,
|
|
141
|
-
default: 1,
|
|
142
|
-
},
|
|
143
|
-
select: {
|
|
144
|
-
defaut: "none",
|
|
145
|
-
type: String,
|
|
146
|
-
validator(value) {
|
|
147
|
-
return ["none", "single", "multi"].indexOf(value) !== -1;
|
|
148
|
-
},
|
|
149
|
-
},
|
|
150
|
-
selection: {
|
|
151
|
-
type: Array,
|
|
152
|
-
required: false
|
|
153
|
-
},
|
|
154
|
-
},
|
|
155
|
-
watch: {
|
|
156
|
-
selection(value) {
|
|
157
|
-
if (value !== undefined) this.internalSelection = value;
|
|
158
|
-
},
|
|
159
|
-
},
|
|
160
|
-
computed: {
|
|
161
|
-
currentPage: {
|
|
162
|
-
get() {
|
|
163
|
-
return this.page;
|
|
164
|
-
},
|
|
165
|
-
set(val) {
|
|
166
|
-
this.$emit("pageChange", val);
|
|
167
|
-
},
|
|
168
|
-
},
|
|
169
|
-
},
|
|
170
|
-
methods: {
|
|
171
|
-
isSelected(media) {
|
|
172
|
-
return this.internalSelection.findIndex((m) => m.id === media.id) !== -1;
|
|
173
|
-
},
|
|
174
|
-
selectMedia(media) {
|
|
175
|
-
switch (this.select) {
|
|
176
|
-
case "single":
|
|
177
|
-
this.$emit("selectionChange", media);
|
|
178
|
-
this.internalSelection = [media];
|
|
179
|
-
this.$emit("update:selection", this.internalSelection);
|
|
180
|
-
break;
|
|
181
|
-
case "multi":
|
|
182
|
-
const index = this.internalSelection.findIndex(m => m.id === media.id);
|
|
183
|
-
index == -1
|
|
184
|
-
? this.internalSelection.push(media)
|
|
185
|
-
: this.internalSelection.splice(index, 1);
|
|
186
|
-
this.internalSelection = this.internalSelection.slice();
|
|
187
|
-
this.$emit("selectionChange", this.internalSelection);
|
|
188
|
-
this.$emit("update:selection", this.internalSelection);
|
|
189
|
-
break;
|
|
190
|
-
default:
|
|
191
|
-
this.editMedia(media);
|
|
192
|
-
break;
|
|
193
|
-
}
|
|
194
|
-
},
|
|
195
|
-
editMedia(media) {
|
|
196
|
-
this.$emit("editMedia", media);
|
|
197
|
-
},
|
|
198
|
-
fileName(media) {
|
|
199
|
-
return media && media.file && media.file.split("/").pop();
|
|
200
|
-
},
|
|
201
|
-
},
|
|
202
|
-
mounted() {
|
|
203
|
-
if (this.selection !== undefined) this.internalSelection = this.selection;
|
|
204
|
-
},
|
|
205
|
-
};
|
|
206
|
-
</script>
|
|
@@ -1,233 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<v-card elevation="0">
|
|
3
|
-
<v-card-title class="d-flex flex-wrap-reverse pa-0">
|
|
4
|
-
<div>
|
|
5
|
-
<v-tabs v-model="tab" right background-color="transparent">
|
|
6
|
-
<v-tab>Gallery</v-tab>
|
|
7
|
-
<v-tab>Uploader</v-tab>
|
|
8
|
-
</v-tabs>
|
|
9
|
-
</div>
|
|
10
|
-
<v-spacer></v-spacer>
|
|
11
|
-
<v-text-field
|
|
12
|
-
v-show="tab == 0"
|
|
13
|
-
v-model="searchValue"
|
|
14
|
-
@input="
|
|
15
|
-
loadingSearch = true;
|
|
16
|
-
search();
|
|
17
|
-
"
|
|
18
|
-
prepend-inner-icon="mdi-magnify"
|
|
19
|
-
label="Search"
|
|
20
|
-
single-line
|
|
21
|
-
hide-details
|
|
22
|
-
outlined
|
|
23
|
-
dense
|
|
24
|
-
clearable
|
|
25
|
-
:loading="loadingSearch"
|
|
26
|
-
class="mx-2 shrink"
|
|
27
|
-
></v-text-field>
|
|
28
|
-
<v-btn class="ma-2" @click="getRoot" icon>
|
|
29
|
-
<v-icon>mdi-update</v-icon>
|
|
30
|
-
</v-btn>
|
|
31
|
-
</v-card-title>
|
|
32
|
-
<v-card-text class="pa-0">
|
|
33
|
-
<MediaFolders
|
|
34
|
-
v-if="!noFolders"
|
|
35
|
-
v-bind="{ folders, parentFolders, loading }"
|
|
36
|
-
@updateFolder="updateOrCreateFolder($event)"
|
|
37
|
-
@deleteFolder="deleteFolder($event)"
|
|
38
|
-
@goToFolder="
|
|
39
|
-
parentFolder = $event;
|
|
40
|
-
getRoot();
|
|
41
|
-
"
|
|
42
|
-
/>
|
|
43
|
-
<v-tabs-items v-model="tab" class="transparent">
|
|
44
|
-
<v-tab-item>
|
|
45
|
-
<MediaGallery
|
|
46
|
-
v-show="!editMedia"
|
|
47
|
-
v-bind="{ select, page, pages, medias }"
|
|
48
|
-
:selection="$attrs.selection"
|
|
49
|
-
@update:selection="$emit('update:selection', $event)"
|
|
50
|
-
@selectionChange="selectionChange($event)"
|
|
51
|
-
@pageChange="getRoot({ page: $event })"
|
|
52
|
-
@editMedia="openEditor($event)"
|
|
53
|
-
/>
|
|
54
|
-
<MediaEditor
|
|
55
|
-
v-model="editMedia"
|
|
56
|
-
@deleteMedia="deleteMedia($event)"
|
|
57
|
-
@updateMedia="updateMedia($event)"
|
|
58
|
-
/>
|
|
59
|
-
</v-tab-item>
|
|
60
|
-
<v-tab-item>
|
|
61
|
-
<MediaUploader
|
|
62
|
-
v-bind="{ folders, parentFolder }"
|
|
63
|
-
@Upload="
|
|
64
|
-
tab = 0;
|
|
65
|
-
getRoot({ page: 1 });
|
|
66
|
-
"
|
|
67
|
-
/>
|
|
68
|
-
</v-tab-item>
|
|
69
|
-
</v-tabs-items>
|
|
70
|
-
</v-card-text>
|
|
71
|
-
<v-card-actions>
|
|
72
|
-
<!-- Slot to provide custom button actions inside the media manager -->
|
|
73
|
-
<slot name="actions"></slot>
|
|
74
|
-
</v-card-actions>
|
|
75
|
-
</v-card>
|
|
76
|
-
</template>
|
|
77
|
-
|
|
78
|
-
<script>
|
|
79
|
-
import { debounce } from "@mapomodule/utils/helpers/debounce";
|
|
80
|
-
|
|
81
|
-
const initialData = () => ({
|
|
82
|
-
_mediaFolderCrud: null,
|
|
83
|
-
_mediaFileCrud: null,
|
|
84
|
-
medias: [],
|
|
85
|
-
folders: [],
|
|
86
|
-
parentFolders: [],
|
|
87
|
-
page: 1,
|
|
88
|
-
pages: 1,
|
|
89
|
-
tab: 0,
|
|
90
|
-
editMedia: null,
|
|
91
|
-
loading: false,
|
|
92
|
-
searchValue: "",
|
|
93
|
-
loadingSearch: false,
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
export default {
|
|
97
|
-
name: "MediaManager",
|
|
98
|
-
data() {
|
|
99
|
-
return initialData();
|
|
100
|
-
},
|
|
101
|
-
props: {
|
|
102
|
-
select: {
|
|
103
|
-
type: String,
|
|
104
|
-
default: "none",
|
|
105
|
-
validator(val) {
|
|
106
|
-
return ["none", "single", "multi"].indexOf(val) !== -1;
|
|
107
|
-
},
|
|
108
|
-
},
|
|
109
|
-
noFolders: {
|
|
110
|
-
type: Boolean,
|
|
111
|
-
default: false,
|
|
112
|
-
},
|
|
113
|
-
mime: {
|
|
114
|
-
type: String,
|
|
115
|
-
required: false,
|
|
116
|
-
},
|
|
117
|
-
},
|
|
118
|
-
computed: {
|
|
119
|
-
mediaFolderCrud() {
|
|
120
|
-
this._mediaFolderCrud =
|
|
121
|
-
this._mediaFolderCrud || this.$mapo.$api.crud("api/camomilla/media-folders");
|
|
122
|
-
return this._mediaFolderCrud;
|
|
123
|
-
},
|
|
124
|
-
mediaFileCrud() {
|
|
125
|
-
this._mediaFileCrud =
|
|
126
|
-
this._mediaFileCrud || this.$mapo.$api.crud("api/camomilla/media");
|
|
127
|
-
return this._mediaFileCrud;
|
|
128
|
-
},
|
|
129
|
-
parentFolder: {
|
|
130
|
-
get() {
|
|
131
|
-
return (
|
|
132
|
-
(this.parentFolders.length &&
|
|
133
|
-
this.parentFolders[this.parentFolders.length - 1]) ||
|
|
134
|
-
null
|
|
135
|
-
);
|
|
136
|
-
},
|
|
137
|
-
set(val) {
|
|
138
|
-
if (!val || !val.path) {
|
|
139
|
-
this.parentFolders = [];
|
|
140
|
-
} else {
|
|
141
|
-
const index = this.parentFolders.findIndex((f) => f.path == val.path);
|
|
142
|
-
if (index == -1) {
|
|
143
|
-
this.parentFolders.push(val);
|
|
144
|
-
} else {
|
|
145
|
-
this.parentFolders.splice(index + 1, this.parentFolders.length - (index + 1));
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
},
|
|
149
|
-
},
|
|
150
|
-
},
|
|
151
|
-
methods: {
|
|
152
|
-
async getRoot(context) {
|
|
153
|
-
this.loading = true;
|
|
154
|
-
const { page, folder } = context || {};
|
|
155
|
-
const { id } = folder || this.parentFolder || {};
|
|
156
|
-
let response;
|
|
157
|
-
this.page = page || this.page;
|
|
158
|
-
const params = {
|
|
159
|
-
page: this.page,
|
|
160
|
-
search: this.searchValue || undefined,
|
|
161
|
-
fltr: this.mime ? `mime_type=${this.mime}` : undefined,
|
|
162
|
-
};
|
|
163
|
-
if (id) {
|
|
164
|
-
response = await this.mediaFolderCrud.detail(id, {
|
|
165
|
-
params,
|
|
166
|
-
});
|
|
167
|
-
} else {
|
|
168
|
-
response = await this.mediaFolderCrud.list({ params });
|
|
169
|
-
}
|
|
170
|
-
this.processResponse(response);
|
|
171
|
-
this.loading = false;
|
|
172
|
-
this.editMedia = null;
|
|
173
|
-
},
|
|
174
|
-
|
|
175
|
-
updateOrCreateFolder(folder) {
|
|
176
|
-
return this.mediaFolderCrud.updateOrCreate(folder).then(() => this.getRoot());
|
|
177
|
-
},
|
|
178
|
-
|
|
179
|
-
deleteFolder(folder) {
|
|
180
|
-
return this.mediaFolderCrud.delete(folder.id).then(() => this.getRoot());
|
|
181
|
-
},
|
|
182
|
-
|
|
183
|
-
deleteMedia(media) {
|
|
184
|
-
return this.mediaFileCrud.delete(media.id).then(() => {
|
|
185
|
-
(this.editMedia = null), this.getRoot();
|
|
186
|
-
});
|
|
187
|
-
},
|
|
188
|
-
|
|
189
|
-
detailMedia(media_id) {
|
|
190
|
-
return this.mediaFileCrud.detail(media_id);
|
|
191
|
-
},
|
|
192
|
-
|
|
193
|
-
async updateMedia(media) {
|
|
194
|
-
const files = ["file", "objectURL", "thumbnail"];
|
|
195
|
-
const payload = this.$mapo.$api.multipart(media, files);
|
|
196
|
-
const conf = { headers: { "Content-Type": "multipart/form-data" } };
|
|
197
|
-
const res = await this.mediaFileCrud.partialUpdate(media.id, payload, conf)
|
|
198
|
-
if (media.file){
|
|
199
|
-
this.medias = []
|
|
200
|
-
await this.getRoot()
|
|
201
|
-
}
|
|
202
|
-
this.editMedia = res
|
|
203
|
-
this.$mapo.$snack.open({
|
|
204
|
-
message: "File info succesfully updated."
|
|
205
|
-
})
|
|
206
|
-
return res
|
|
207
|
-
},
|
|
208
|
-
processResponse(resp) {
|
|
209
|
-
this.medias = resp?.media?.items || [];
|
|
210
|
-
this.folders = resp?.folders || [];
|
|
211
|
-
this.parentFolder = resp?.parent_folder;
|
|
212
|
-
this.page = resp?.media?.paginator?.page;
|
|
213
|
-
this.pages = resp?.media?.paginator?.pages;
|
|
214
|
-
},
|
|
215
|
-
selectionChange(event) {
|
|
216
|
-
this.$emit("selectionChange", event);
|
|
217
|
-
},
|
|
218
|
-
async openEditor(event) {
|
|
219
|
-
this.editMedia = await this.detailMedia(event.id);
|
|
220
|
-
},
|
|
221
|
-
search: debounce(function () {
|
|
222
|
-
this.getRoot().then(() => (this.loadingSearch = false));
|
|
223
|
-
}, 500),
|
|
224
|
-
reset() {
|
|
225
|
-
Object.assign(this.$data, initialData());
|
|
226
|
-
this.getRoot();
|
|
227
|
-
},
|
|
228
|
-
},
|
|
229
|
-
async fetch() {
|
|
230
|
-
await this.getRoot();
|
|
231
|
-
},
|
|
232
|
-
};
|
|
233
|
-
</script>
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<slot v-bind="{ on, attrs }" name="activator"></slot>
|
|
4
|
-
<v-dialog v-model="dialog" width="800" scrollable>
|
|
5
|
-
<media-manager
|
|
6
|
-
@selectionChange="selectionChange($event)"
|
|
7
|
-
:selection="$attrs.selection"
|
|
8
|
-
@update:selection="$emit('update:selection', $event)"
|
|
9
|
-
v-bind="{ select, noFolders, mime }"
|
|
10
|
-
elevation="0"
|
|
11
|
-
ref="mediaManager"
|
|
12
|
-
>
|
|
13
|
-
<template v-slot:actions>
|
|
14
|
-
<v-spacer></v-spacer>
|
|
15
|
-
<v-btn v-if="select == 'multi'" color="primary" text @click="done">done</v-btn>
|
|
16
|
-
</template>
|
|
17
|
-
</media-manager>
|
|
18
|
-
</v-dialog>
|
|
19
|
-
</div>
|
|
20
|
-
</template>
|
|
21
|
-
<script>
|
|
22
|
-
export default {
|
|
23
|
-
name: "MediaManagerDialog",
|
|
24
|
-
data() {
|
|
25
|
-
return {
|
|
26
|
-
selection: [],
|
|
27
|
-
dialog: false,
|
|
28
|
-
attrs: { ...this.$attrs },
|
|
29
|
-
reset: false,
|
|
30
|
-
on: {
|
|
31
|
-
click: (event) => {
|
|
32
|
-
event.preventDefault();
|
|
33
|
-
event.stopPropagation();
|
|
34
|
-
this.dialog = !this.dialog;
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
};
|
|
38
|
-
},
|
|
39
|
-
props: {
|
|
40
|
-
value: {
|
|
41
|
-
type: Boolean,
|
|
42
|
-
},
|
|
43
|
-
noFolders: {
|
|
44
|
-
type: Boolean,
|
|
45
|
-
default: false,
|
|
46
|
-
},
|
|
47
|
-
select: {
|
|
48
|
-
type: String,
|
|
49
|
-
default: "single",
|
|
50
|
-
validator(val) {
|
|
51
|
-
return ["none", "single", "multi"].indexOf(val) !== -1;
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
mime: {
|
|
55
|
-
type: String,
|
|
56
|
-
required: false
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
watch: {
|
|
60
|
-
value(val) {
|
|
61
|
-
this.dialog = val;
|
|
62
|
-
},
|
|
63
|
-
dialog(val) {
|
|
64
|
-
this.$emit("input", val);
|
|
65
|
-
this.$emit(val ? "open" : "close");
|
|
66
|
-
if (!val && this.reject) {
|
|
67
|
-
this.reject();
|
|
68
|
-
}
|
|
69
|
-
if (val && this.reset) this.$refs.mediaManager.reset();
|
|
70
|
-
this.reset = !val;
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
methods: {
|
|
74
|
-
open() {
|
|
75
|
-
this.dialog = true;
|
|
76
|
-
return new Promise((resolve, reject) => {
|
|
77
|
-
this.resolve = resolve;
|
|
78
|
-
this.reject = reject;
|
|
79
|
-
});
|
|
80
|
-
},
|
|
81
|
-
selectionChange(event) {
|
|
82
|
-
this.selection = event;
|
|
83
|
-
if (this.select == "single") {
|
|
84
|
-
this.done();
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
done() {
|
|
88
|
-
if (this.resolve) {
|
|
89
|
-
this.resolve(this.selection);
|
|
90
|
-
}
|
|
91
|
-
this.dialog = false;
|
|
92
|
-
this.$emit("selectionChange", this.selection);
|
|
93
|
-
},
|
|
94
|
-
},
|
|
95
|
-
};
|
|
96
|
-
</script>
|
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<v-img
|
|
3
|
-
:src="(media.is_image && media.file) || null"
|
|
4
|
-
:lazy-src="(media.is_image && media.thumbnail) || null"
|
|
5
|
-
aspect-ratio="1"
|
|
6
|
-
class="grey lighten-2"
|
|
7
|
-
:class="{
|
|
8
|
-
selected,
|
|
9
|
-
'media-controls': mediaControls,
|
|
10
|
-
'video-preview': videoPreview,
|
|
11
|
-
}"
|
|
12
|
-
v-bind="$attrs"
|
|
13
|
-
v-on="videoListeners"
|
|
14
|
-
>
|
|
15
|
-
<template v-slot:placeholder>
|
|
16
|
-
<v-row class="fill-height ma-0" align="center" justify="center">
|
|
17
|
-
<v-progress-circular
|
|
18
|
-
v-if="media.is_image"
|
|
19
|
-
indeterminate
|
|
20
|
-
color="grey lighten-5"
|
|
21
|
-
></v-progress-circular>
|
|
22
|
-
<div
|
|
23
|
-
class="d-flex justify-center align-center"
|
|
24
|
-
:class="{ playing }"
|
|
25
|
-
style="width: 100%; height: 100%"
|
|
26
|
-
v-else-if="isVideo"
|
|
27
|
-
>
|
|
28
|
-
<video
|
|
29
|
-
:width="$attrs.contain && '100%'"
|
|
30
|
-
height="100%"
|
|
31
|
-
ref="video"
|
|
32
|
-
:controls="mediaControls"
|
|
33
|
-
>
|
|
34
|
-
<source :src="media.file" :type="media.mime_type" />
|
|
35
|
-
</video>
|
|
36
|
-
<v-icon
|
|
37
|
-
v-if="!mediaControls"
|
|
38
|
-
:size="size"
|
|
39
|
-
color="grey darken-4"
|
|
40
|
-
class="grey lighten-2 rounded-circle video-preview-icon"
|
|
41
|
-
>mdi-play</v-icon
|
|
42
|
-
>
|
|
43
|
-
</div>
|
|
44
|
-
<div
|
|
45
|
-
class="
|
|
46
|
-
d-flex
|
|
47
|
-
flex-column
|
|
48
|
-
align-center
|
|
49
|
-
justify-space-between
|
|
50
|
-
fill-height
|
|
51
|
-
"
|
|
52
|
-
style="width: 100%"
|
|
53
|
-
v-else
|
|
54
|
-
>
|
|
55
|
-
<div></div>
|
|
56
|
-
<v-icon :size="size" color="grey darken-2">
|
|
57
|
-
{{ isAudio ? "mdi-headphones" : "mdi-file" }}
|
|
58
|
-
</v-icon>
|
|
59
|
-
<audio v-if="isAudio && mediaControls" controls>
|
|
60
|
-
<source :src="media.file" :type="media.mime_type" />
|
|
61
|
-
</audio>
|
|
62
|
-
<span
|
|
63
|
-
class="grey--text text--darken-3 text-truncate pl-1 pr-8"
|
|
64
|
-
style="width: 100%"
|
|
65
|
-
>{{ (filename && name) || undefined }}</span
|
|
66
|
-
>
|
|
67
|
-
</div>
|
|
68
|
-
</v-row>
|
|
69
|
-
</template>
|
|
70
|
-
</v-img>
|
|
71
|
-
</template>
|
|
72
|
-
|
|
73
|
-
<style lang="scss">
|
|
74
|
-
.v-image.media-controls {
|
|
75
|
-
.v-image__placeholder {
|
|
76
|
-
z-index: 0;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
.v-image.video-preview {
|
|
80
|
-
.v-image__placeholder {
|
|
81
|
-
height: calc(100% + 1px);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
.video-preview-icon.v-icon.v-icon {
|
|
85
|
-
position: absolute;
|
|
86
|
-
opacity: 0.5;
|
|
87
|
-
transition: transform 0.3s ease-out, opacity 0.3s ease-out;
|
|
88
|
-
}
|
|
89
|
-
.playing .video-preview-icon.v-icon.v-icon {
|
|
90
|
-
opacity: 0;
|
|
91
|
-
transform: scale(1.2);
|
|
92
|
-
}
|
|
93
|
-
</style>
|
|
94
|
-
|
|
95
|
-
<script>
|
|
96
|
-
export default {
|
|
97
|
-
data() {
|
|
98
|
-
return {
|
|
99
|
-
playing: false,
|
|
100
|
-
playPromise: null,
|
|
101
|
-
};
|
|
102
|
-
},
|
|
103
|
-
props: {
|
|
104
|
-
media: {
|
|
105
|
-
type: Object,
|
|
106
|
-
default: () => ({}),
|
|
107
|
-
},
|
|
108
|
-
selected: {
|
|
109
|
-
type: Boolean,
|
|
110
|
-
default: false,
|
|
111
|
-
},
|
|
112
|
-
filename: {
|
|
113
|
-
type: Boolean,
|
|
114
|
-
default: false,
|
|
115
|
-
},
|
|
116
|
-
iconSize: {
|
|
117
|
-
type: String || Number,
|
|
118
|
-
default: "70px",
|
|
119
|
-
},
|
|
120
|
-
videoPreview: {
|
|
121
|
-
type: Boolean,
|
|
122
|
-
default: false,
|
|
123
|
-
},
|
|
124
|
-
mediaControls: {
|
|
125
|
-
type: Boolean,
|
|
126
|
-
default: false,
|
|
127
|
-
},
|
|
128
|
-
},
|
|
129
|
-
computed: {
|
|
130
|
-
name() {
|
|
131
|
-
return this.media && this.media.file && this.media.file.split("/").pop();
|
|
132
|
-
},
|
|
133
|
-
size() {
|
|
134
|
-
return (
|
|
135
|
-
(this.iconSize &&
|
|
136
|
-
(typeof this.iconSize == "string"
|
|
137
|
-
? this.iconSize
|
|
138
|
-
: this.iconSize + "px")) ||
|
|
139
|
-
"70px"
|
|
140
|
-
);
|
|
141
|
-
},
|
|
142
|
-
isVideo() {
|
|
143
|
-
return this.media.mime_type && this.media.mime_type.startsWith("video/");
|
|
144
|
-
},
|
|
145
|
-
isAudio() {
|
|
146
|
-
return this.media.mime_type && this.media.mime_type.startsWith("audio/");
|
|
147
|
-
},
|
|
148
|
-
videoListeners() {
|
|
149
|
-
if (this.isVideo && this.videoPreview) {
|
|
150
|
-
return {
|
|
151
|
-
mouseenter: this.startVideoPreview,
|
|
152
|
-
mouseleave: this.stopVideoPreview,
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
},
|
|
156
|
-
},
|
|
157
|
-
methods: {
|
|
158
|
-
startVideoPreview() {
|
|
159
|
-
const video = this.$refs.video;
|
|
160
|
-
if (video && !this.playing) {
|
|
161
|
-
video.loop = true;
|
|
162
|
-
video.muted = true;
|
|
163
|
-
video.currentTime = 1;
|
|
164
|
-
this.playPromise = video.play().then(() => (this.playing = true));
|
|
165
|
-
}
|
|
166
|
-
},
|
|
167
|
-
async stopVideoPreview() {
|
|
168
|
-
if (this.playPromise) {
|
|
169
|
-
await this.playPromise;
|
|
170
|
-
}
|
|
171
|
-
const video = this.$refs.video;
|
|
172
|
-
if (video && this.playing) {
|
|
173
|
-
video.currentTime = 0;
|
|
174
|
-
video.pause();
|
|
175
|
-
this.playing = false;
|
|
176
|
-
}
|
|
177
|
-
},
|
|
178
|
-
},
|
|
179
|
-
};
|
|
180
|
-
</script>
|