@mapomodule/uikit 1.0.0-alpha.6 → 1.0.0-alpha.7
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 +46 -0
- package/components/Detail/Detail.vue +52 -48
- package/components/DropArea.vue +1 -1
- package/components/List/ListHead.vue +1 -1
- package/components/List/ListTable.vue +22 -6
- package/components/MediaManager/MediaEditor.vue +247 -107
- package/components/MediaManager/MediaFolders.vue +122 -38
- package/components/MediaManager/MediaGallery.vue +56 -52
- package/components/MediaManager/MediaManager.vue +114 -74
- package/components/MediaManager/MediaManagerDialog.vue +19 -22
- package/components/MediaManager/MediaPreview.vue +180 -0
- package/components/MediaManager/MediaUploader.vue +35 -32
- package/components/fields/MediaField.vue +12 -2
- package/components/fields/TinyMce/TinyMce.vue +25 -9
- package/components/layout/Sidebar/SidebarList.vue +2 -1
- package/components/layout/Sidebar/SidebarListItem.vue +53 -10
- package/layouts/default.vue +2 -4
- package/package.json +2 -2
|
@@ -1,104 +1,166 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div v-if="media">
|
|
3
|
-
<
|
|
4
|
-
<
|
|
5
|
-
<v-icon>
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
:
|
|
14
|
-
|
|
3
|
+
<v-container class="px-md-6">
|
|
4
|
+
<div class="img_overlay">
|
|
5
|
+
<v-btn class="img_overlay__button img_overlay__button--back" small icon @click="close">
|
|
6
|
+
<v-icon>mdi-arrow-left</v-icon>
|
|
7
|
+
</v-btn>
|
|
8
|
+
<v-btn class="img_overlay__button img_overlay__button--href" small icon :href="media.file" target="_blank" >
|
|
9
|
+
<v-icon>mdi-open-in-new</v-icon>
|
|
10
|
+
</v-btn>
|
|
11
|
+
</div>
|
|
12
|
+
<MediaPreview
|
|
13
|
+
:media="media"
|
|
14
|
+
height="400"
|
|
15
15
|
contain
|
|
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
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
16
|
+
filename
|
|
17
|
+
media-controls
|
|
18
|
+
class="elevation-2"
|
|
19
|
+
/>
|
|
20
|
+
<v-overlay
|
|
21
|
+
absolute
|
|
22
|
+
v-model="editing"
|
|
23
|
+
@click="editing = false"
|
|
24
|
+
></v-overlay>
|
|
25
|
+
<div class="dialog">
|
|
26
|
+
<div class="dialog__container">
|
|
27
|
+
<v-card flat tile class="dialog__content overflow-y-auto"
|
|
28
|
+
:class="{ 'py-0': !editing }"
|
|
29
|
+
:max-height="editing ? height : '0px'"
|
|
30
|
+
>
|
|
31
|
+
<v-card-text class="flex-grow-0">
|
|
32
|
+
<v-row class="flex-md-row-reverse">
|
|
33
|
+
<v-col md="6" cols="12" class="info-media">
|
|
34
|
+
<table class="text-caption fill-height pb-md-10">
|
|
35
|
+
<tr>
|
|
36
|
+
<td class="pr-3"><b>Filename:</b></td>
|
|
37
|
+
<td>{{ fileName }}</td>
|
|
38
|
+
</tr>
|
|
39
|
+
<tr>
|
|
40
|
+
<td class="pr-3"><b>Mime type:</b></td>
|
|
41
|
+
<td>{{ media.mime_type }}</td>
|
|
42
|
+
</tr>
|
|
43
|
+
<tr>
|
|
44
|
+
<td class="pr-3"><b>Created:</b></td>
|
|
45
|
+
<td>{{ dateCreated }}</td>
|
|
46
|
+
</tr>
|
|
47
|
+
<tr>
|
|
48
|
+
<td class="pr-3"><b>Size:</b></td>
|
|
49
|
+
<td>{{ fileSize }}</td>
|
|
50
|
+
</tr>
|
|
51
|
+
<tr>
|
|
52
|
+
<td class="pr-3"><b>Url:</b></td>
|
|
53
|
+
<td>
|
|
54
|
+
<a :href="media.file" target="_blank">{{ media.file }}</a>
|
|
55
|
+
</td>
|
|
56
|
+
</tr>
|
|
57
|
+
<tr>
|
|
58
|
+
<td class="pr-3"><b>Linked models:</b></td>
|
|
59
|
+
<td>{{ media.liks }}</td>
|
|
60
|
+
</tr>
|
|
61
|
+
</table>
|
|
62
|
+
</v-col>
|
|
63
|
+
<v-col md="6" cols="12">
|
|
64
|
+
<v-row>
|
|
65
|
+
<v-col sm="6" md="12" cols="12">
|
|
66
|
+
<v-text-field
|
|
67
|
+
dense
|
|
68
|
+
v-model="media.name"
|
|
69
|
+
label="Name"
|
|
70
|
+
></v-text-field>
|
|
71
|
+
</v-col>
|
|
72
|
+
<v-col sm="6" md="12" cols="12">
|
|
73
|
+
<v-text-field
|
|
74
|
+
dense
|
|
75
|
+
v-model="media.title"
|
|
76
|
+
label="Title"
|
|
77
|
+
></v-text-field>
|
|
78
|
+
</v-col>
|
|
79
|
+
<v-col sm="6" md="12" cols="12">
|
|
80
|
+
<v-text-field
|
|
81
|
+
dense
|
|
82
|
+
v-model="media.description"
|
|
83
|
+
label="Description"
|
|
84
|
+
></v-text-field>
|
|
85
|
+
</v-col>
|
|
86
|
+
<v-col sm="6" md="12" cols="12">
|
|
87
|
+
<v-text-field
|
|
88
|
+
dense
|
|
89
|
+
v-model="media.alt_text"
|
|
90
|
+
label="Alt name"
|
|
91
|
+
></v-text-field>
|
|
92
|
+
</v-col>
|
|
93
|
+
<v-col sm="6" md="12" cols="12" class="d-flex align-center">
|
|
94
|
+
<div class="d-flex flex-column flex-grow-1">
|
|
95
|
+
<v-file-input
|
|
96
|
+
v-model="newFile"
|
|
97
|
+
:accept="accept"
|
|
98
|
+
label="New file"
|
|
99
|
+
show-size
|
|
100
|
+
dense
|
|
101
|
+
prepend-icon
|
|
102
|
+
></v-file-input>
|
|
103
|
+
<v-checkbox
|
|
104
|
+
v-if="newFile"
|
|
105
|
+
v-model="sameUrl"
|
|
106
|
+
label="Maintain old url"
|
|
107
|
+
class="ma-0"
|
|
108
|
+
hide-details
|
|
109
|
+
dense
|
|
110
|
+
></v-checkbox>
|
|
111
|
+
</div>
|
|
112
|
+
<v-img
|
|
113
|
+
v-if="newFile && newFilePreview"
|
|
114
|
+
:src="newFilePreview"
|
|
115
|
+
aspect-ratio="1"
|
|
116
|
+
min-width="70px"
|
|
117
|
+
max-width="110px"
|
|
118
|
+
class="grey lighten-2 ml-3"
|
|
119
|
+
>
|
|
120
|
+
<template v-slot:placeholder>
|
|
121
|
+
<v-row
|
|
122
|
+
class="fill-height ma-0"
|
|
123
|
+
align="center"
|
|
124
|
+
justify="center"
|
|
125
|
+
>
|
|
126
|
+
<v-progress-circular
|
|
127
|
+
indeterminate
|
|
128
|
+
color="grey lighten-5"
|
|
129
|
+
></v-progress-circular>
|
|
130
|
+
</v-row>
|
|
131
|
+
</template>
|
|
132
|
+
</v-img>
|
|
133
|
+
</v-col>
|
|
134
|
+
</v-row>
|
|
135
|
+
</v-col>
|
|
136
|
+
</v-row>
|
|
137
|
+
</v-card-text>
|
|
138
|
+
</v-card>
|
|
139
|
+
<v-btn
|
|
140
|
+
tile
|
|
141
|
+
depressed
|
|
142
|
+
width="100%"
|
|
143
|
+
:class="{ 'pr-0': editing }"
|
|
144
|
+
@click="editing = !editing"
|
|
145
|
+
>
|
|
146
|
+
<span>Edit</span>
|
|
147
|
+
<v-icon :style="rotate">mdi-chevron-up</v-icon>
|
|
148
|
+
<div class="edit_spacer" :class="{ 'flex-grow-1': editing }"></div>
|
|
149
|
+
<v-btn v-if="editing" text tile color="primary" @click="saveMedia">
|
|
93
150
|
save
|
|
94
151
|
</v-btn>
|
|
95
|
-
<v-btn
|
|
96
|
-
|
|
152
|
+
<v-btn
|
|
153
|
+
v-if="editing"
|
|
154
|
+
text
|
|
155
|
+
tile
|
|
156
|
+
color="error"
|
|
157
|
+
@click.stop="deleteMedia"
|
|
158
|
+
>
|
|
97
159
|
delete
|
|
98
160
|
</v-btn>
|
|
99
|
-
</
|
|
100
|
-
</
|
|
101
|
-
</
|
|
161
|
+
</v-btn>
|
|
162
|
+
</div>
|
|
163
|
+
</div>
|
|
102
164
|
</v-container>
|
|
103
165
|
</div>
|
|
104
166
|
</template>
|
|
@@ -106,6 +168,41 @@
|
|
|
106
168
|
table tr td:nth-child(2) {
|
|
107
169
|
overflow-wrap: anywhere;
|
|
108
170
|
}
|
|
171
|
+
.dialog {
|
|
172
|
+
position: relative;
|
|
173
|
+
height: 56px;
|
|
174
|
+
z-index: 5;
|
|
175
|
+
&__container {
|
|
176
|
+
position: absolute;
|
|
177
|
+
bottom: 0;
|
|
178
|
+
width: 100%;
|
|
179
|
+
}
|
|
180
|
+
&__content {
|
|
181
|
+
transition-property: max-height, padding;
|
|
182
|
+
transition-duration: 0.3s;
|
|
183
|
+
transition-timing-function: ease-out;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
.edit_spacer {
|
|
187
|
+
flex-grow: 0;
|
|
188
|
+
transition: flex-grow 0.3s ease-out;
|
|
189
|
+
}
|
|
190
|
+
.img_overlay {
|
|
191
|
+
position: relative;
|
|
192
|
+
&__button {
|
|
193
|
+
position: absolute;
|
|
194
|
+
z-index: 1;
|
|
195
|
+
color: #333333 !important;
|
|
196
|
+
background: #e0e0e096;
|
|
197
|
+
top: 10px;
|
|
198
|
+
&--back {
|
|
199
|
+
left: 10px;
|
|
200
|
+
}
|
|
201
|
+
&--href {
|
|
202
|
+
right: 10px;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
109
206
|
</style>
|
|
110
207
|
<script>
|
|
111
208
|
import { humanFileSize } from "@mapomodule/utils/helpers/formatters";
|
|
@@ -114,14 +211,17 @@ export default {
|
|
|
114
211
|
name: "MediaEditor",
|
|
115
212
|
data() {
|
|
116
213
|
return {
|
|
117
|
-
media: null
|
|
214
|
+
media: null,
|
|
215
|
+
editing: false,
|
|
216
|
+
newFile: null,
|
|
217
|
+
sameUrl: false,
|
|
118
218
|
};
|
|
119
219
|
},
|
|
120
220
|
props: {
|
|
121
221
|
value: {
|
|
122
222
|
type: Object,
|
|
123
|
-
default: () => null
|
|
124
|
-
}
|
|
223
|
+
default: () => null,
|
|
224
|
+
},
|
|
125
225
|
},
|
|
126
226
|
computed: {
|
|
127
227
|
fileSize() {
|
|
@@ -130,34 +230,74 @@ export default {
|
|
|
130
230
|
dateCreated() {
|
|
131
231
|
return this.media && new Date(this.media.created).toLocaleString();
|
|
132
232
|
},
|
|
133
|
-
extension() {
|
|
134
|
-
return this.media && this.media.file && this.media.file.split(".").pop();
|
|
135
|
-
},
|
|
136
233
|
fileName() {
|
|
137
234
|
return this.media && this.media.file && this.media.file.split("/").pop();
|
|
138
|
-
}
|
|
235
|
+
},
|
|
236
|
+
rotate() {
|
|
237
|
+
return {
|
|
238
|
+
transform: this.editing ? "rotate(180deg)" : "rotate(0deg)",
|
|
239
|
+
transition: "transform .3s cubic-bezier(0.25, 0.8, 0.5, 1)",
|
|
240
|
+
};
|
|
241
|
+
},
|
|
242
|
+
height() {
|
|
243
|
+
switch (this.$vuetify.breakpoint.name) {
|
|
244
|
+
case "xs":
|
|
245
|
+
return "50vh";
|
|
246
|
+
default:
|
|
247
|
+
return 425;
|
|
248
|
+
}
|
|
249
|
+
},
|
|
250
|
+
accept(){
|
|
251
|
+
switch (this.media.mime_type && this.media.mime_type.split("/")[0]) {
|
|
252
|
+
case "image":
|
|
253
|
+
return "image/*"
|
|
254
|
+
case "video":
|
|
255
|
+
return "video/*"
|
|
256
|
+
case "audio":
|
|
257
|
+
return "audio/*"
|
|
258
|
+
default:
|
|
259
|
+
return "*"
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
newFilePreview() {
|
|
263
|
+
return this.newFile.type.startsWith("image/") ? URL.createObjectURL(this.newFile) : null;
|
|
264
|
+
},
|
|
139
265
|
},
|
|
140
266
|
watch: {
|
|
141
267
|
value(val) {
|
|
142
268
|
this.media = val;
|
|
143
|
-
|
|
269
|
+
this.editing = false;
|
|
270
|
+
this.newFile = null;
|
|
271
|
+
this.sameUrl = false;
|
|
272
|
+
},
|
|
144
273
|
},
|
|
145
274
|
methods: {
|
|
146
275
|
saveMedia() {
|
|
147
|
-
|
|
276
|
+
const media = {
|
|
277
|
+
id: this.media.id,
|
|
278
|
+
name: this.media.name,
|
|
279
|
+
title: this.media.title,
|
|
280
|
+
description: this.media.description,
|
|
281
|
+
alt_text: this.media.alt_text,
|
|
282
|
+
file: this.newFile || undefined,
|
|
283
|
+
same_url: (this.newFile && this.sameUrl) || undefined,
|
|
284
|
+
};
|
|
285
|
+
this.newFile = null;
|
|
286
|
+
this.sameUrl = false;
|
|
287
|
+
this.$emit("updateMedia", media);
|
|
148
288
|
},
|
|
149
289
|
deleteMedia() {
|
|
150
290
|
this.$mapo.$confirm
|
|
151
291
|
.open({
|
|
152
292
|
title: "Delete",
|
|
153
293
|
question: "Are you sure you want to delete this media?",
|
|
154
|
-
approveButton: { text: "Delete", attrs: { color: "red" } }
|
|
294
|
+
approveButton: { text: "Delete", attrs: { color: "red" } },
|
|
155
295
|
})
|
|
156
|
-
.then(res => res && this.$emit("deleteMedia", this.media));
|
|
296
|
+
.then((res) => res && this.$emit("deleteMedia", this.media));
|
|
157
297
|
},
|
|
158
298
|
close() {
|
|
159
299
|
this.$emit("input", null);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
300
|
+
},
|
|
301
|
+
},
|
|
162
302
|
};
|
|
163
303
|
</script>
|
|
@@ -1,33 +1,56 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
|
+
<div v-if="parentFolders && parentFolders.length">
|
|
4
|
+
<span class="mx-2 mt-1 d-flex flex-wrap align-center">
|
|
5
|
+
<span class="mb-1">
|
|
6
|
+
<v-icon @click="goToFolder()" small>mdi-home</v-icon></span
|
|
7
|
+
>
|
|
8
|
+
<span class="fpath__button" v-for="(f, i) in parentFolders" :key="i"
|
|
9
|
+
>/<a @click="i !== parentFolders.length - 1 && goToFolder(f)">{{
|
|
10
|
+
f.slug
|
|
11
|
+
}}</a>
|
|
12
|
+
</span>
|
|
13
|
+
</span>
|
|
14
|
+
</div>
|
|
3
15
|
<v-card-actions class="flex-wrap">
|
|
16
|
+
<div v-if="parentFolder" class="d-none d-sm-block">
|
|
17
|
+
<v-btn
|
|
18
|
+
class="px-2"
|
|
19
|
+
tile
|
|
20
|
+
block
|
|
21
|
+
text
|
|
22
|
+
depressed
|
|
23
|
+
@click="goToFolder(updirFolder)"
|
|
24
|
+
>
|
|
25
|
+
<v-icon> mdi-arrow-left </v-icon>
|
|
26
|
+
</v-btn>
|
|
27
|
+
</div>
|
|
4
28
|
<div
|
|
5
29
|
v-for="folder in folders"
|
|
6
30
|
:key="folder.id"
|
|
7
|
-
class="d-flex child-flex
|
|
31
|
+
class="d-flex child-flex"
|
|
32
|
+
:class="{ 'mx-2': expanded }"
|
|
8
33
|
>
|
|
9
|
-
<div>
|
|
34
|
+
<div class="folder_grid d-flex flex-column" :class="{ expanded }">
|
|
10
35
|
<v-icon @click.stop="goToFolder(folder)" :size="expanded ? 100 : 40">
|
|
11
36
|
mdi-folder
|
|
12
37
|
</v-icon>
|
|
13
38
|
|
|
14
39
|
<div>
|
|
15
|
-
<div class="d-flex" :style="hideSlug">
|
|
40
|
+
<div class="d-flex justify-item-center" :style="hideSlug">
|
|
16
41
|
<span class="folder_slug">
|
|
17
|
-
{{ folder.
|
|
42
|
+
{{ folder.title }}
|
|
18
43
|
</span>
|
|
19
44
|
<v-icon
|
|
20
|
-
v-if="expanded"
|
|
21
45
|
size="20"
|
|
22
|
-
class="ma-0 ml-auto"
|
|
46
|
+
class="folder_grid__editicon ma-0 ml-auto"
|
|
23
47
|
@click.stop="createFolder(folder)"
|
|
24
48
|
>mdi-pencil</v-icon
|
|
25
49
|
>
|
|
26
50
|
<v-icon
|
|
27
51
|
size="20"
|
|
28
|
-
class="ma-0"
|
|
52
|
+
class="folder_grid__editicon ma-0"
|
|
29
53
|
@click.stop="deleteFolder(folder)"
|
|
30
|
-
v-if="expanded"
|
|
31
54
|
>mdi-delete</v-icon
|
|
32
55
|
>
|
|
33
56
|
</div>
|
|
@@ -61,6 +84,13 @@
|
|
|
61
84
|
</v-tooltip>
|
|
62
85
|
</div>
|
|
63
86
|
</v-card-actions>
|
|
87
|
+
<v-progress-linear
|
|
88
|
+
:active="loading"
|
|
89
|
+
indeterminate
|
|
90
|
+
height="2"
|
|
91
|
+
></v-progress-linear>
|
|
92
|
+
|
|
93
|
+
<v-divider></v-divider>
|
|
64
94
|
<v-dialog v-model="dialog" max-width="300px">
|
|
65
95
|
<v-card>
|
|
66
96
|
<v-card-title>
|
|
@@ -75,10 +105,6 @@
|
|
|
75
105
|
v-model="folderEdit.title"
|
|
76
106
|
label="Folder name"
|
|
77
107
|
></v-text-field>
|
|
78
|
-
<v-text-field
|
|
79
|
-
v-model="folderEdit.slug"
|
|
80
|
-
label="Folder slug"
|
|
81
|
-
></v-text-field>
|
|
82
108
|
</v-col>
|
|
83
109
|
</v-row>
|
|
84
110
|
</v-container>
|
|
@@ -94,12 +120,42 @@
|
|
|
94
120
|
</div>
|
|
95
121
|
</template>
|
|
96
122
|
<style lang="scss" scoped>
|
|
97
|
-
.
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
123
|
+
.folder_grid {
|
|
124
|
+
.folder_slug {
|
|
125
|
+
width: 65px;
|
|
126
|
+
display: inline-block;
|
|
127
|
+
white-space: nowrap;
|
|
128
|
+
overflow: hidden;
|
|
129
|
+
text-overflow: ellipsis;
|
|
130
|
+
text-align: center;
|
|
131
|
+
line-height: 20px;
|
|
132
|
+
}
|
|
133
|
+
&__editicon {
|
|
134
|
+
display: none;
|
|
135
|
+
}
|
|
136
|
+
&.expanded {
|
|
137
|
+
.folder_slug {
|
|
138
|
+
text-align: left;
|
|
139
|
+
padding-left: 5px;
|
|
140
|
+
}
|
|
141
|
+
.folder_grid__editicon {
|
|
142
|
+
display: block;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.fpath__button {
|
|
148
|
+
padding-left: 7px;
|
|
149
|
+
color: grey;
|
|
150
|
+
a {
|
|
151
|
+
margin-left: 7px;
|
|
152
|
+
}
|
|
153
|
+
&:last-child {
|
|
154
|
+
a {
|
|
155
|
+
color: unset;
|
|
156
|
+
cursor: auto;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
103
159
|
}
|
|
104
160
|
</style>
|
|
105
161
|
|
|
@@ -119,31 +175,15 @@ export default {
|
|
|
119
175
|
]
|
|
120
176
|
};
|
|
121
177
|
},
|
|
122
|
-
computed: {
|
|
123
|
-
rotate() {
|
|
124
|
-
return {
|
|
125
|
-
transform: this.expanded ? "rotate(180deg)" : "rotate(0deg)",
|
|
126
|
-
transition: "transform .3s cubic-bezier(0.25, 0.8, 0.5, 1)"
|
|
127
|
-
};
|
|
128
|
-
},
|
|
129
|
-
hideSlug() {
|
|
130
|
-
return {
|
|
131
|
-
maxWidth: this.expanded ? "105px" : "50px",
|
|
132
|
-
maxHeight: this.expanded ? "24px" : "18px",
|
|
133
|
-
opacity: this.expanded ? 0.8 : 0.8,
|
|
134
|
-
transform: this.expanded ? "scale(1)" : "scale(0.7)",
|
|
135
|
-
transition: "all .3s cubic-bezier(0.25, 0.8, 0.5, 1)"
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
},
|
|
139
178
|
props: {
|
|
179
|
+
loading: Boolean,
|
|
140
180
|
folders: {
|
|
141
181
|
type: Array,
|
|
142
182
|
default: () => []
|
|
143
183
|
},
|
|
144
|
-
|
|
145
|
-
type:
|
|
146
|
-
default: () =>
|
|
184
|
+
parentFolders: {
|
|
185
|
+
type: Array,
|
|
186
|
+
default: () => []
|
|
147
187
|
}
|
|
148
188
|
},
|
|
149
189
|
methods: {
|
|
@@ -167,12 +207,56 @@ export default {
|
|
|
167
207
|
.then(res => res && this.$emit("deleteFolder", folder));
|
|
168
208
|
},
|
|
169
209
|
saveFolder() {
|
|
210
|
+
this.folderEdit.slug = this.slugify(this.folderEdit.title);
|
|
170
211
|
this.$emit("updateFolder", this.folderEdit);
|
|
171
212
|
this.closeEdit();
|
|
172
213
|
},
|
|
173
214
|
closeEdit() {
|
|
174
215
|
this.dialog = false;
|
|
175
216
|
this.folderEdit = {};
|
|
217
|
+
},
|
|
218
|
+
slugify(text) {
|
|
219
|
+
return text
|
|
220
|
+
.toString()
|
|
221
|
+
.toLowerCase()
|
|
222
|
+
.replace(/\s+/g, "-") // Replace spaces with -
|
|
223
|
+
.replace(/[^\w\-]+/g, "") // Remove all non-word chars
|
|
224
|
+
.replace(/\-\-+/g, "-") // Replace multiple - with single -
|
|
225
|
+
.replace(/^-+/, "") // Trim - from start of text
|
|
226
|
+
.replace(/-+$/, ""); // Trim - from end of text
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
computed: {
|
|
230
|
+
rotate() {
|
|
231
|
+
return {
|
|
232
|
+
transform: this.expanded ? "rotate(180deg)" : "rotate(0deg)",
|
|
233
|
+
transition: "transform .3s cubic-bezier(0.25, 0.8, 0.5, 1)"
|
|
234
|
+
};
|
|
235
|
+
},
|
|
236
|
+
hideSlug() {
|
|
237
|
+
return {
|
|
238
|
+
maxWidth: this.expanded ? "105px" : "50px",
|
|
239
|
+
maxHeight: this.expanded ? "24px" : "18px",
|
|
240
|
+
opacity: this.expanded ? 0.8 : 0.8,
|
|
241
|
+
transform: this.expanded ? "scale(1)" : "scale(0.7)",
|
|
242
|
+
transition: "all .3s cubic-bezier(0.25, 0.8, 0.5, 1)"
|
|
243
|
+
};
|
|
244
|
+
},
|
|
245
|
+
parentFolder() {
|
|
246
|
+
return (
|
|
247
|
+
(this.parentFolders &&
|
|
248
|
+
this.parentFolders.length > 0 &&
|
|
249
|
+
this.parentFolders[this.parentFolders.length - 1]) ||
|
|
250
|
+
null
|
|
251
|
+
);
|
|
252
|
+
},
|
|
253
|
+
updirFolder() {
|
|
254
|
+
return (
|
|
255
|
+
(this.parentFolders &&
|
|
256
|
+
this.parentFolders.length > 1 &&
|
|
257
|
+
this.parentFolders[this.parentFolders.length - 2]) ||
|
|
258
|
+
null
|
|
259
|
+
);
|
|
176
260
|
}
|
|
177
261
|
}
|
|
178
262
|
};
|