@mapomodule/uikit 1.0.0-alpha.5 → 1.0.0-alpha.9
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 +148 -0
- package/components/Detail/Detail.vue +182 -105
- package/components/Detail/DetailField.vue +42 -29
- package/components/Detail/DetailLangSwitch.vue +1 -1
- package/components/Detail/defaults.js +32 -25
- package/components/DropArea.vue +3 -3
- package/components/List/List.vue +77 -42
- package/components/List/ListActions.vue +19 -1
- package/components/List/ListFilters.vue +127 -113
- package/components/List/ListHead.vue +30 -12
- package/components/List/ListQuickEdit.vue +198 -55
- package/components/List/ListTable.vue +138 -58
- package/components/Login.vue +14 -5
- package/components/MediaManager/MediaEditor.vue +253 -107
- package/components/MediaManager/MediaFolders.vue +125 -41
- 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/SnackBar.vue +3 -4
- package/components/fields/DateField.vue +9 -3
- package/components/fields/FksField.vue +60 -0
- package/components/fields/MediaField.vue +24 -6
- package/components/fields/MediaM2mField.vue +8 -3
- package/components/fields/SeoPreview.vue +89 -0
- package/components/fields/{TinyMce → wygEditor}/defaults.js +1 -1
- package/components/fields/{TinyMce → wygEditor}/utils/events.js +0 -0
- package/components/fields/{TinyMce → wygEditor}/utils/mapomedia.plugin.js +0 -0
- package/components/fields/{TinyMce → wygEditor}/utils/script.injector.js +0 -0
- package/components/fields/{TinyMce/TinyMce.vue → wygEditor/wygEditor.vue} +40 -21
- package/components/layout/Sidebar/Sidebar.vue +46 -24
- package/components/layout/Sidebar/SidebarFooter.vue +42 -46
- package/components/layout/Sidebar/SidebarList.vue +13 -14
- package/components/layout/Sidebar/SidebarListItem.vue +81 -38
- package/components/layout/Topbar/Topbar.vue +3 -36
- package/components/layout/routebuilder.js +1 -1
- package/layouts/default.vue +3 -14
- package/package.json +3 -3
- package/pages/index.vue +0 -1
- package/components/fields/M2mField.vue +0 -95
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
3
|
<media-manager-dialog ref="mediaManager"></media-manager-dialog>
|
|
4
|
-
<span v-if="label">{{ label }}:</span>
|
|
4
|
+
<span v-if="label" class="v-label" :class="{'error--text': errorMessages && errorMessages.length}">{{ label }}:</span>
|
|
5
5
|
<div ref="editorNode">
|
|
6
6
|
<v-skeleton-loader
|
|
7
7
|
type="table-heading, list-item-two-line, list-item-avatar-two-line, list-item-three-lineimage, table-tfoot"
|
|
@@ -20,18 +20,18 @@ import defaults from "./defaults.js";
|
|
|
20
20
|
import validEvents from "./utils/events.js";
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
|
-
* This component wraps a [
|
|
23
|
+
* This component wraps a [wygEditor](https://www.tiny.cloud/) instance. With the use of the v-model you can use this component to edit any content you like.
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
26
|
export default {
|
|
27
|
-
name: "
|
|
27
|
+
name: "wygEditor",
|
|
28
28
|
props: {
|
|
29
|
-
// V-model property. Is the content that will populate the
|
|
29
|
+
// V-model property. Is the content that will populate the wygEditor instance.
|
|
30
30
|
value: {
|
|
31
31
|
type: String,
|
|
32
32
|
default: "",
|
|
33
33
|
},
|
|
34
|
-
// This is the main configuration of
|
|
34
|
+
// This is the main configuration of wygEditor. If setted will be merged with this component defaults.
|
|
35
35
|
conf: {
|
|
36
36
|
type: Object,
|
|
37
37
|
default: () => ({}),
|
|
@@ -40,12 +40,12 @@ export default {
|
|
|
40
40
|
label: String,
|
|
41
41
|
// This is an array of validation errors that will be displayed under the editor.
|
|
42
42
|
errorMessages: Array,
|
|
43
|
-
// This set the component status to
|
|
44
|
-
|
|
43
|
+
// This set the component status to readonly, stopping the user interaction.
|
|
44
|
+
readonly: {
|
|
45
45
|
type: Boolean,
|
|
46
46
|
default: false,
|
|
47
47
|
},
|
|
48
|
-
// Use this prop to bind events. If set to true the component will emit every [
|
|
48
|
+
// Use this prop to bind events. If set to true the component will emit every [wygEditor Event](https://www.tiny.cloud/docs/advanced/events/).
|
|
49
49
|
bindevents: {
|
|
50
50
|
type: Boolean,
|
|
51
51
|
default: false,
|
|
@@ -74,11 +74,11 @@ export default {
|
|
|
74
74
|
|
|
75
75
|
methods: {
|
|
76
76
|
initEditor() {
|
|
77
|
-
initMapoMedia(this.
|
|
77
|
+
initMapoMedia(this.insertMediaCallback);
|
|
78
78
|
window.tinymce.init(
|
|
79
79
|
Object.assign(defaults, this.conf, {
|
|
80
80
|
target: this.$refs.editorNode,
|
|
81
|
-
readonly: this.
|
|
81
|
+
readonly: this.readonly,
|
|
82
82
|
setup: (ctx) => this.setupEditor(ctx),
|
|
83
83
|
})
|
|
84
84
|
);
|
|
@@ -103,20 +103,36 @@ export default {
|
|
|
103
103
|
bindEvents(editor) {
|
|
104
104
|
if (this.bindevents) {
|
|
105
105
|
validEvents.forEach((eventName) => {
|
|
106
|
-
// This is a dynamic event emitter. If you activate the bindevents prop, you will be able to listen to every [
|
|
106
|
+
// This is a dynamic event emitter. If you activate the bindevents prop, you will be able to listen to every [wygEditor Event](https://www.tiny.cloud/docs/advanced/events/).
|
|
107
107
|
editor.on(eventName, (event) => this.$emit(eventName, event));
|
|
108
108
|
});
|
|
109
109
|
}
|
|
110
110
|
},
|
|
111
|
-
|
|
111
|
+
insertMediaCallback: async function () {
|
|
112
112
|
return new Promise((resolve, reject) => {
|
|
113
|
-
this.$refs.mediaManager
|
|
114
|
-
.
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
113
|
+
this.$refs.mediaManager.open()
|
|
114
|
+
.then((result) => {
|
|
115
|
+
if (result) {
|
|
116
|
+
let html;
|
|
117
|
+
switch (result.mime_type && result.mime_type.split("/")[0]) {
|
|
118
|
+
case "image":
|
|
119
|
+
html = `<img width="300px" src="${result.file}" alt="${result.alt_text}">`;
|
|
120
|
+
break;
|
|
121
|
+
case "video":
|
|
122
|
+
html = `<video controls><source src="${result.file}" type="${result.mime_type}"></video>`;
|
|
123
|
+
break;
|
|
124
|
+
case "audio":
|
|
125
|
+
html = `<audio controls><source src="${result.file}" type="${result.mime_type}"></audio>`;
|
|
126
|
+
break;
|
|
127
|
+
default:
|
|
128
|
+
html = `<a href="${result.file}" target="_blank">${result.file}</a>`;
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
131
|
+
resolve(html);
|
|
132
|
+
} else {
|
|
133
|
+
reject("No image selected");
|
|
134
|
+
}
|
|
135
|
+
})
|
|
120
136
|
.catch((error) => reject(error));
|
|
121
137
|
});
|
|
122
138
|
},
|
|
@@ -131,7 +147,7 @@ export default {
|
|
|
131
147
|
this.editor.setContent(val);
|
|
132
148
|
}
|
|
133
149
|
},
|
|
134
|
-
|
|
150
|
+
readonly(val) {
|
|
135
151
|
if (this.editor && this.editor.initialized) {
|
|
136
152
|
this.editor.setMode(val ? "readonly" : "design");
|
|
137
153
|
}
|
|
@@ -145,13 +161,16 @@ export default {
|
|
|
145
161
|
.tox-statusbar__branding {
|
|
146
162
|
display: none;
|
|
147
163
|
}
|
|
164
|
+
.v-label.error--text{
|
|
165
|
+
animation: v-shake 0.6s cubic-bezier(0.25, 0.8, 0.5, 1);
|
|
166
|
+
}
|
|
148
167
|
</style>
|
|
149
168
|
|
|
150
169
|
<docs>
|
|
151
170
|
|
|
152
171
|
### Defaults
|
|
153
172
|
|
|
154
|
-
This is the default [
|
|
173
|
+
This is the default [wygEditor configuration](https://www.tiny.cloud/docs/configure/).
|
|
155
174
|
|
|
156
175
|
```js
|
|
157
176
|
{
|
|
@@ -1,58 +1,80 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<v-navigation-drawer
|
|
3
3
|
v-model="drawerSetter"
|
|
4
|
-
:mini-variant="miniVariant"
|
|
4
|
+
:mini-variant.sync="miniVariant"
|
|
5
|
+
width="300"
|
|
5
6
|
:clipped="this.$store.getters['mapo/app/clipped']"
|
|
6
7
|
fixed
|
|
7
8
|
app
|
|
8
9
|
>
|
|
9
|
-
<div class="
|
|
10
|
-
<
|
|
11
|
-
|
|
10
|
+
<div class="menu_container">
|
|
11
|
+
<div>
|
|
12
|
+
<v-list-item>
|
|
13
|
+
<v-list-item-avatar v-if="avatar">
|
|
14
|
+
<v-img :src="avatar"></v-img>
|
|
15
|
+
</v-list-item-avatar>
|
|
16
|
+
<v-list-item-icon v-else>
|
|
17
|
+
<v-icon>mdi-account</v-icon>
|
|
18
|
+
</v-list-item-icon>
|
|
19
|
+
<v-list-item-title>{{
|
|
20
|
+
this.$mapo.$auth.user.username
|
|
21
|
+
}}</v-list-item-title>
|
|
22
|
+
<v-btn icon @click.stop="miniVariant = !miniVariant">
|
|
23
|
+
<v-icon>mdi-chevron-left</v-icon>
|
|
24
|
+
</v-btn>
|
|
25
|
+
</v-list-item>
|
|
26
|
+
<v-divider></v-divider>
|
|
27
|
+
</div>
|
|
28
|
+
<div class="menu_container">
|
|
29
|
+
<SidebarList :force-collapse="miniVariant" />
|
|
30
|
+
<SidebarFooter :force-collapse="miniVariant" />
|
|
31
|
+
</div>
|
|
12
32
|
</div>
|
|
13
33
|
</v-navigation-drawer>
|
|
14
34
|
</template>
|
|
15
35
|
|
|
16
36
|
<style lang="scss" scoped>
|
|
17
|
-
@import
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
// background: $b-1;
|
|
25
|
-
// color: $white;
|
|
26
|
-
}
|
|
37
|
+
@import "@mapomodule/uikit/assets/variables.scss";
|
|
38
|
+
.menu_container {
|
|
39
|
+
display: flex;
|
|
40
|
+
flex-direction: column;
|
|
41
|
+
height: 100%;
|
|
42
|
+
justify-content: space-between;
|
|
43
|
+
flex: 1;
|
|
27
44
|
}
|
|
28
45
|
</style>
|
|
29
46
|
|
|
30
47
|
<script>
|
|
31
|
-
import { mapMutations } from 'vuex'
|
|
32
48
|
// @vuese
|
|
33
49
|
export default {
|
|
34
50
|
name: "Sidebar",
|
|
35
|
-
data
|
|
51
|
+
data() {
|
|
36
52
|
return {
|
|
37
|
-
miniVariant: false
|
|
38
|
-
}
|
|
53
|
+
miniVariant: false
|
|
54
|
+
};
|
|
39
55
|
},
|
|
40
56
|
computed: {
|
|
41
57
|
drawerSetter: {
|
|
42
58
|
get() {
|
|
43
|
-
return this.$store.getters[
|
|
59
|
+
return this.$store.getters["mapo/app/drawer"];
|
|
44
60
|
},
|
|
45
61
|
set(value) {
|
|
46
|
-
if (this.$store.getters[
|
|
62
|
+
if (this.$store.getters["mapo/app/drawer"] !== value)
|
|
47
63
|
this.$store.dispatch("mapo/app/toggleSidebarDrawer");
|
|
48
64
|
return value;
|
|
49
65
|
}
|
|
66
|
+
},
|
|
67
|
+
username() {
|
|
68
|
+
return this.$mapo.$auth.user.username;
|
|
69
|
+
},
|
|
70
|
+
avatar() {
|
|
71
|
+
return this.$mapo.$auth.user.avatar;
|
|
50
72
|
}
|
|
51
73
|
},
|
|
52
74
|
methods: {
|
|
53
|
-
drawerReverse
|
|
54
|
-
return this.drawer = !this.drawer
|
|
55
|
-
}
|
|
75
|
+
drawerReverse() {
|
|
76
|
+
return (this.drawer = !this.drawer);
|
|
77
|
+
}
|
|
56
78
|
}
|
|
57
|
-
}
|
|
79
|
+
};
|
|
58
80
|
</script>
|
|
@@ -1,68 +1,61 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
<div>
|
|
3
|
+
<v-divider></v-divider>
|
|
4
|
+
<v-list dense class="py-0">
|
|
5
|
+
<SidebarListItem
|
|
6
|
+
v-for="(item, i) in routes"
|
|
7
|
+
:key="i"
|
|
8
|
+
:link="item.link"
|
|
9
|
+
:label="item.label"
|
|
10
|
+
:meta="item.meta"
|
|
11
|
+
:childrens="item.childrens"
|
|
12
|
+
:icon="item.icon"
|
|
13
|
+
:force-collapse="forceCollapse"
|
|
14
|
+
/>
|
|
15
|
+
</v-list>
|
|
16
|
+
<v-divider></v-divider>
|
|
17
|
+
<v-list-item dense class="logout__button" link @click.native="logout">
|
|
18
|
+
<v-list-item-icon>
|
|
19
|
+
<v-icon>mdi-logout</v-icon>
|
|
20
|
+
</v-list-item-icon>
|
|
21
|
+
<v-list-item-title> Logout </v-list-item-title>
|
|
22
|
+
</v-list-item>
|
|
13
23
|
</div>
|
|
14
24
|
</template>
|
|
15
25
|
|
|
16
26
|
<style lang="scss" scoped>
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
&__icon {
|
|
25
|
-
font-size: 1rem;
|
|
26
|
-
margin-right: 0.5rem;
|
|
27
|
-
}
|
|
28
|
-
&__item {
|
|
29
|
-
display: block;
|
|
30
|
-
width: 100%;
|
|
31
|
-
text-decoration: none;
|
|
32
|
-
color: white;
|
|
33
|
-
background: $b-2;
|
|
34
|
-
transition: all linear 0.25s;
|
|
35
|
-
border-radius: 0;
|
|
36
|
-
&:hover {
|
|
37
|
-
background: rgba($b-2, 0.25);
|
|
38
|
-
}
|
|
39
|
-
&--logout {
|
|
40
|
-
background: $black !important;
|
|
41
|
-
&:hover {
|
|
42
|
-
background: rgba($black, 0.25) !important;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
27
|
+
.logout__button{
|
|
28
|
+
&.theme--light{
|
|
29
|
+
background: #ffffffd6;
|
|
30
|
+
filter: invert(1);
|
|
31
|
+
}
|
|
32
|
+
&.theme--dark{
|
|
33
|
+
background: #121212;
|
|
46
34
|
}
|
|
47
35
|
}
|
|
48
36
|
</style>
|
|
49
|
-
|
|
50
37
|
<script>
|
|
51
38
|
import { buildRoutes } from "../routebuilder";
|
|
52
39
|
|
|
53
40
|
// @vuese
|
|
54
41
|
export default {
|
|
55
42
|
name: "SidebarFooter",
|
|
43
|
+
props: {
|
|
44
|
+
forceCollapse: {
|
|
45
|
+
type: Boolean,
|
|
46
|
+
default: false
|
|
47
|
+
}
|
|
48
|
+
},
|
|
56
49
|
data() {
|
|
57
50
|
return {
|
|
58
|
-
defaultIcon: ({label}) => `mdi-alpha-${label[0]}-box`.toLowerCase(),
|
|
59
|
-
routes: this.routes
|
|
51
|
+
defaultIcon: ({ label }) => `mdi-alpha-${label[0]}-box`.toLowerCase(),
|
|
52
|
+
routes: this.routes
|
|
60
53
|
};
|
|
61
54
|
},
|
|
62
|
-
mounted
|
|
55
|
+
mounted() {
|
|
63
56
|
this.routes = this.buildRoutes(
|
|
64
57
|
this.$router.options.routes.filter(
|
|
65
|
-
|
|
58
|
+
route => route.meta && route.meta.sidebarFooter === true
|
|
66
59
|
)
|
|
67
60
|
);
|
|
68
61
|
},
|
|
@@ -70,6 +63,9 @@ export default {
|
|
|
70
63
|
buildRoutes(routes) {
|
|
71
64
|
return buildRoutes(routes, this.defaultIcon);
|
|
72
65
|
},
|
|
73
|
-
|
|
66
|
+
logout() {
|
|
67
|
+
this.$store.dispatch("mapo/user/logout");
|
|
68
|
+
}
|
|
69
|
+
}
|
|
74
70
|
};
|
|
75
71
|
</script>
|
|
@@ -1,39 +1,38 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<v-list dense class="py-0 overflow-y-auto">
|
|
3
3
|
<SidebarListItem
|
|
4
|
-
class="sidebar__list__item"
|
|
5
4
|
v-for="(item, i) in routes"
|
|
6
5
|
:key="i"
|
|
7
6
|
:link="item.link"
|
|
8
7
|
:label="item.label"
|
|
8
|
+
:meta="item.meta"
|
|
9
9
|
:childrens="item.childrens"
|
|
10
10
|
:icon="item.icon"
|
|
11
|
+
:force-collapse="forceCollapse"
|
|
12
|
+
spider-menu
|
|
11
13
|
/>
|
|
12
|
-
</
|
|
14
|
+
</v-list>
|
|
13
15
|
</template>
|
|
14
16
|
|
|
15
|
-
<style lang="scss" scoped>
|
|
16
|
-
.sidebar {
|
|
17
|
-
&__list {
|
|
18
|
-
display: flex;
|
|
19
|
-
flex-direction: column;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
</style>
|
|
23
|
-
|
|
24
17
|
<script>
|
|
25
18
|
import { buildRoutes } from "../routebuilder";
|
|
26
19
|
|
|
27
20
|
// @vuese
|
|
28
21
|
export default {
|
|
29
22
|
name: "SidebarList",
|
|
23
|
+
props: {
|
|
24
|
+
forceCollapse: {
|
|
25
|
+
type: Boolean,
|
|
26
|
+
default: false
|
|
27
|
+
}
|
|
28
|
+
},
|
|
30
29
|
data() {
|
|
31
30
|
return {
|
|
32
|
-
defaultIcon: ({label}) => `mdi-alpha-${label[0]}-
|
|
31
|
+
defaultIcon: ({label}) => `mdi-alpha-${label[0]}-box-outline`.toLowerCase(),
|
|
33
32
|
routes: this.routes,
|
|
34
33
|
};
|
|
35
34
|
},
|
|
36
|
-
mounted
|
|
35
|
+
mounted() {
|
|
37
36
|
this.routes = this.buildRoutes(this.$router.options.routes.filter(route => !route.meta || !route.meta.sidebarFooter));
|
|
38
37
|
},
|
|
39
38
|
methods: {
|
|
@@ -1,37 +1,41 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
<div v-if="userCanSee" :class="{ child, expanded, 'spider-menu': spiderMenu }">
|
|
3
|
+
<v-list-item
|
|
4
|
+
:style="indent"
|
|
5
|
+
:exact-path="expanded"
|
|
6
|
+
:input-value="!expanded && !link && activeChild"
|
|
7
|
+
@click.native="!link && (expanded = !expanded)"
|
|
8
|
+
link
|
|
9
|
+
:to="link"
|
|
10
|
+
>
|
|
11
|
+
<v-list-item-icon v-if="icon">
|
|
12
|
+
<v-icon>{{ icon }}</v-icon>
|
|
13
|
+
</v-list-item-icon>
|
|
14
|
+
<v-list-item-title>
|
|
15
|
+
{{ label }}
|
|
16
|
+
</v-list-item-title>
|
|
6
17
|
<v-icon
|
|
7
18
|
class="expand-icon"
|
|
8
19
|
v-if="childrens.length"
|
|
9
20
|
:style="rotate"
|
|
10
|
-
@click.native.prevent="expanded = !expanded"
|
|
11
|
-
>mdi-chevron-down</v-icon
|
|
12
|
-
>
|
|
13
|
-
</NuxtLink>
|
|
14
|
-
<span
|
|
15
|
-
@click.prevent="expanded = !expanded"
|
|
16
|
-
v-if="!link"
|
|
17
|
-
class="sidebar__link"
|
|
18
|
-
>
|
|
19
|
-
<v-icon v-if="icon" class="sidebar__link__icon">{{ icon }}</v-icon>
|
|
20
|
-
{{ label }}
|
|
21
|
-
<v-icon :style="rotate" class="expand-icon" v-if="childrens.length"
|
|
21
|
+
@click.native.prevent="link && (expanded = !expanded)"
|
|
22
22
|
>mdi-chevron-down</v-icon
|
|
23
23
|
>
|
|
24
|
-
</
|
|
25
|
-
|
|
24
|
+
</v-list-item>
|
|
25
|
+
|
|
26
|
+
<div :style="indent" v-if="childrens.length && expanded && !forceCollapse">
|
|
26
27
|
<SidebarListItem
|
|
27
|
-
class="sidebar__list__item"
|
|
28
28
|
v-for="(item, i) in childrens"
|
|
29
29
|
:key="i"
|
|
30
30
|
:link="item.link"
|
|
31
31
|
:label="item.label"
|
|
32
|
+
:meta="item.meta"
|
|
32
33
|
:childrens="item.childrens"
|
|
33
|
-
:depth="depth || 0 + 1"
|
|
34
|
+
:depth="(depth || 0) + 1"
|
|
34
35
|
:icon="item.icon"
|
|
36
|
+
:force-collapse="forceCollapse"
|
|
37
|
+
:spider-menu="spiderMenu"
|
|
38
|
+
child
|
|
35
39
|
/>
|
|
36
40
|
</div>
|
|
37
41
|
</div>
|
|
@@ -48,24 +52,38 @@
|
|
|
48
52
|
border-radius: 50%;
|
|
49
53
|
}
|
|
50
54
|
}
|
|
51
|
-
|
|
52
|
-
.
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
55
|
+
.spider-menu.child {
|
|
56
|
+
.v-list-item__icon {
|
|
57
|
+
&::after {
|
|
58
|
+
content: "";
|
|
59
|
+
position: absolute;
|
|
60
|
+
width: 5px;
|
|
61
|
+
height: 30px;
|
|
62
|
+
top: -9px;
|
|
63
|
+
margin-left: -4px;
|
|
64
|
+
border-bottom: solid 3px #acacac;
|
|
65
|
+
border-left: solid 3px #acacac;
|
|
66
|
+
z-index: -1;
|
|
67
|
+
}
|
|
68
|
+
&::before {
|
|
69
|
+
content: "";
|
|
70
|
+
position: absolute;
|
|
71
|
+
width: 5px;
|
|
72
|
+
height: 10px;
|
|
73
|
+
top: 21px;
|
|
74
|
+
margin-left: -4px;
|
|
75
|
+
border-left: solid 3px #acacac;
|
|
76
|
+
z-index: -1;
|
|
66
77
|
}
|
|
67
|
-
|
|
68
|
-
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
.spider-menu.child:last-child {
|
|
81
|
+
.v-list-item__icon {
|
|
82
|
+
&::before {
|
|
83
|
+
height: 0px;
|
|
84
|
+
}
|
|
85
|
+
&::after {
|
|
86
|
+
border-bottom-left-radius: 3px;
|
|
69
87
|
}
|
|
70
88
|
}
|
|
71
89
|
}
|
|
@@ -77,11 +95,15 @@ export default {
|
|
|
77
95
|
data() {
|
|
78
96
|
return {
|
|
79
97
|
expanded: false,
|
|
98
|
+
nestDepth: 14,
|
|
80
99
|
};
|
|
81
100
|
},
|
|
82
101
|
computed: {
|
|
83
102
|
indent() {
|
|
84
|
-
return {
|
|
103
|
+
return {
|
|
104
|
+
paddingLeft: `calc(1rem + ${+this.depth * this.nestDepth}px)`,
|
|
105
|
+
marginLeft: this.depth > 1 && `calc(-1rem - ${(this.depth - 1) * this.nestDepth}px)`,
|
|
106
|
+
};
|
|
85
107
|
},
|
|
86
108
|
rotate() {
|
|
87
109
|
return {
|
|
@@ -89,13 +111,34 @@ export default {
|
|
|
89
111
|
transition: "transform 225ms cubic-bezier(0.4, 0, 0.2, 1)",
|
|
90
112
|
};
|
|
91
113
|
},
|
|
114
|
+
activeChild() {
|
|
115
|
+
return (this.childrens || []).some((child) => this.$nuxt.$route.path.startsWith(child.link));
|
|
116
|
+
},
|
|
117
|
+
userCanSee() {
|
|
118
|
+
const middleware = this.$mapo.$auth.getRouteMiddlewares({ meta: this.meta })
|
|
119
|
+
if (middleware.includes("permissions")){
|
|
120
|
+
const userInfo = this.$mapo.$auth.user.info
|
|
121
|
+
if (userInfo.is_superuser) return true
|
|
122
|
+
const { model } = this.meta?.permissions || {}
|
|
123
|
+
const userPermission = (userInfo.user_permissions || []).filter(perm => perm.codename.endsWith(model)).map(({ codename }) => codename.replace(`_${model}`, ''))
|
|
124
|
+
return userPermission.includes('view')
|
|
125
|
+
}
|
|
126
|
+
if (middleware.includes("auth")){
|
|
127
|
+
return this.$mapo.$auth.user.isLoggedIn
|
|
128
|
+
}
|
|
129
|
+
return true
|
|
130
|
+
},
|
|
92
131
|
},
|
|
93
132
|
props: {
|
|
94
133
|
link: String,
|
|
95
134
|
label: String,
|
|
96
135
|
icon: String,
|
|
97
136
|
childrens: Array,
|
|
137
|
+
meta: Object,
|
|
98
138
|
depth: Number,
|
|
139
|
+
forceCollapse: Boolean,
|
|
140
|
+
child: Boolean,
|
|
141
|
+
spiderMenu: Boolean,
|
|
99
142
|
},
|
|
100
143
|
};
|
|
101
144
|
</script>
|
|
@@ -5,46 +5,13 @@
|
|
|
5
5
|
app
|
|
6
6
|
flat
|
|
7
7
|
dense
|
|
8
|
-
class="topbar__wrapper"
|
|
9
8
|
>
|
|
10
9
|
<v-app-bar-nav-icon @click.stop="drawerReverse()" />
|
|
11
10
|
<v-toolbar-title v-text="title" />
|
|
12
|
-
<v-spacer />
|
|
13
|
-
|
|
14
|
-
<div class="topbar__user">
|
|
15
|
-
<span class="topbar__user__name">
|
|
16
|
-
Ciao, {{ this.$mapo.$auth.user.username }}
|
|
17
|
-
</span>
|
|
18
|
-
<v-btn
|
|
19
|
-
class="topbar__user__btn"
|
|
20
|
-
icon
|
|
21
|
-
>
|
|
22
|
-
<v-icon>mdi-account</v-icon>
|
|
23
|
-
</v-btn>
|
|
24
|
-
</div>
|
|
25
11
|
</v-app-bar>
|
|
26
12
|
</template>
|
|
27
13
|
|
|
28
|
-
<style lang="scss" scoped>
|
|
29
|
-
@import '@mapomodule/uikit/assets/variables.scss';
|
|
30
|
-
|
|
31
|
-
.topbar {
|
|
32
|
-
&__wrapper {
|
|
33
|
-
// background: $black!important;
|
|
34
|
-
// color: $white;
|
|
35
|
-
}
|
|
36
|
-
&__user {
|
|
37
|
-
display: flex;
|
|
38
|
-
align-items: center;
|
|
39
|
-
&__name {
|
|
40
|
-
margin-right: 0.5rem;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
</style>
|
|
45
|
-
|
|
46
14
|
<script>
|
|
47
|
-
import { mapMutations } from 'vuex'
|
|
48
15
|
|
|
49
16
|
export default {
|
|
50
17
|
name: "Topbar",
|
|
@@ -52,9 +19,9 @@ export default {
|
|
|
52
19
|
title: String
|
|
53
20
|
},
|
|
54
21
|
methods: {
|
|
55
|
-
drawerReverse
|
|
22
|
+
drawerReverse() {
|
|
56
23
|
this.$store.dispatch("mapo/app/toggleSidebarDrawer");
|
|
57
|
-
}
|
|
58
|
-
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
59
26
|
};
|
|
60
27
|
</script>
|
|
@@ -13,7 +13,7 @@ function buildRoutes(routes, defaultIcon) {
|
|
|
13
13
|
.map((route) => {
|
|
14
14
|
const { meta, path, name } = route
|
|
15
15
|
const label = (route.meta && route.meta.label) || (path.split("/").pop() || "").replaceAll(':', '').replaceAll('-', ' ') || 'home'
|
|
16
|
-
const icon =
|
|
16
|
+
const icon = route.meta && route.meta.icon !== undefined ? route.meta.icon : getDefaultIcon({ route, label }, defaultIcon)
|
|
17
17
|
return { label, icon, meta, name, link: path, relPath: path.slice(1), childrens: [] };
|
|
18
18
|
}),
|
|
19
19
|
defaultIcon
|
package/layouts/default.vue
CHANGED
|
@@ -1,25 +1,14 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<v-app
|
|
2
|
+
<v-app>
|
|
3
3
|
<Sidebar />
|
|
4
4
|
<Topbar :title="title" :drawer="this.$store.getters['mapo/app/drawer']" />
|
|
5
5
|
<v-main>
|
|
6
|
-
<
|
|
7
|
-
|
|
8
|
-
<root-components />
|
|
9
|
-
</v-container>
|
|
6
|
+
<nuxt />
|
|
7
|
+
<root-components />
|
|
10
8
|
</v-main>
|
|
11
9
|
</v-app>
|
|
12
10
|
</template>
|
|
13
11
|
|
|
14
|
-
<style lang="scss" scoped>
|
|
15
|
-
@import "@mapomodule/uikit/assets/variables.scss";
|
|
16
|
-
|
|
17
|
-
.app {
|
|
18
|
-
&__wrapper {
|
|
19
|
-
// background: $w-1;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
</style>
|
|
23
12
|
|
|
24
13
|
<script>
|
|
25
14
|
export default {
|