@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,196 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<media-manager-dialog ref="mediaManager"></media-manager-dialog>
|
|
4
|
-
<span v-if="label" class="v-label" :class="{'error--text': errorMessages && errorMessages.length}">{{ label }}:</span>
|
|
5
|
-
<div ref="editorNode">
|
|
6
|
-
<v-skeleton-loader
|
|
7
|
-
type="table-heading, list-item-two-line, list-item-avatar-two-line, list-item-three-lineimage, table-tfoot"
|
|
8
|
-
></v-skeleton-loader>
|
|
9
|
-
</div>
|
|
10
|
-
<div class="mt-2">
|
|
11
|
-
<v-messages :value="errorMessages" color="error"></v-messages>
|
|
12
|
-
</div>
|
|
13
|
-
</div>
|
|
14
|
-
</template>
|
|
15
|
-
|
|
16
|
-
<script>
|
|
17
|
-
import initMapoMedia from "./utils/mapomedia.plugin.js";
|
|
18
|
-
import injectScript from "./utils/script.injector.js";
|
|
19
|
-
import defaults from "./defaults.js";
|
|
20
|
-
import validEvents from "./utils/events.js";
|
|
21
|
-
|
|
22
|
-
/**
|
|
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
|
-
*/
|
|
25
|
-
|
|
26
|
-
export default {
|
|
27
|
-
name: "wygEditor",
|
|
28
|
-
props: {
|
|
29
|
-
// V-model property. Is the content that will populate the wygEditor instance.
|
|
30
|
-
value: {
|
|
31
|
-
type: String,
|
|
32
|
-
default: "",
|
|
33
|
-
},
|
|
34
|
-
// This is the main configuration of wygEditor. If setted will be merged with this component defaults.
|
|
35
|
-
conf: {
|
|
36
|
-
type: Object,
|
|
37
|
-
default: () => ({}),
|
|
38
|
-
},
|
|
39
|
-
// This label will be shown at the top of the editor.
|
|
40
|
-
label: String,
|
|
41
|
-
// This is an array of validation errors that will be displayed under the editor.
|
|
42
|
-
errorMessages: Array,
|
|
43
|
-
// This set the component status to readonly, stopping the user interaction.
|
|
44
|
-
readonly: {
|
|
45
|
-
type: Boolean,
|
|
46
|
-
default: false,
|
|
47
|
-
},
|
|
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
|
-
bindevents: {
|
|
50
|
-
type: Boolean,
|
|
51
|
-
default: false,
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
|
|
55
|
-
data() {
|
|
56
|
-
return {
|
|
57
|
-
editorInstance: null,
|
|
58
|
-
editorContent: "",
|
|
59
|
-
};
|
|
60
|
-
},
|
|
61
|
-
|
|
62
|
-
computed: {
|
|
63
|
-
editor: {
|
|
64
|
-
cache: false,
|
|
65
|
-
get() {
|
|
66
|
-
return this.editorInstance;
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
|
|
71
|
-
mounted() {
|
|
72
|
-
injectScript().then(this.initEditor);
|
|
73
|
-
},
|
|
74
|
-
|
|
75
|
-
methods: {
|
|
76
|
-
initEditor() {
|
|
77
|
-
initMapoMedia(this.insertMediaCallback);
|
|
78
|
-
window.tinymce.init(
|
|
79
|
-
Object.assign(defaults, this.conf, {
|
|
80
|
-
target: this.$refs.editorNode,
|
|
81
|
-
readonly: this.readonly,
|
|
82
|
-
setup: (ctx) => this.setupEditor(ctx),
|
|
83
|
-
})
|
|
84
|
-
);
|
|
85
|
-
},
|
|
86
|
-
setupEditor(editor) {
|
|
87
|
-
this.editorInstance = editor;
|
|
88
|
-
editor.on("init", () => {
|
|
89
|
-
editor.setContent(this.value || "");
|
|
90
|
-
this.emitContent(editor);
|
|
91
|
-
editor.on("change input undo redo keyup", () =>
|
|
92
|
-
this.emitContent(editor)
|
|
93
|
-
);
|
|
94
|
-
});
|
|
95
|
-
this.bindEvents(editor);
|
|
96
|
-
},
|
|
97
|
-
emitContent(editor) {
|
|
98
|
-
this.editorContent = editor.getContent();
|
|
99
|
-
// Fired when the v-model changes
|
|
100
|
-
//@arg Emits the content of the editor
|
|
101
|
-
this.$emit("input", this.editorContent);
|
|
102
|
-
},
|
|
103
|
-
bindEvents(editor) {
|
|
104
|
-
if (this.bindevents) {
|
|
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 [wygEditor Event](https://www.tiny.cloud/docs/advanced/events/).
|
|
107
|
-
editor.on(eventName, (event) => this.$emit(eventName, event));
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
},
|
|
111
|
-
insertMediaCallback: async function () {
|
|
112
|
-
return new Promise((resolve, reject) => {
|
|
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
|
-
})
|
|
136
|
-
.catch((error) => reject(error));
|
|
137
|
-
});
|
|
138
|
-
},
|
|
139
|
-
},
|
|
140
|
-
beforeDestroy() {
|
|
141
|
-
window && window.tinymce && window.tinymce.remove(this.editor);
|
|
142
|
-
},
|
|
143
|
-
watch: {
|
|
144
|
-
value(val) {
|
|
145
|
-
if (this.editor && this.editor.initialized && val !== this.editorContent) {
|
|
146
|
-
this.editorContent = val
|
|
147
|
-
this.editor.setContent(val);
|
|
148
|
-
}
|
|
149
|
-
},
|
|
150
|
-
readonly(val) {
|
|
151
|
-
if (this.editor && this.editor.initialized) {
|
|
152
|
-
this.editor.setMode(val ? "readonly" : "design");
|
|
153
|
-
}
|
|
154
|
-
},
|
|
155
|
-
},
|
|
156
|
-
};
|
|
157
|
-
</script>
|
|
158
|
-
|
|
159
|
-
<style>
|
|
160
|
-
.tox-notifications-container,
|
|
161
|
-
.tox-statusbar__branding {
|
|
162
|
-
display: none;
|
|
163
|
-
}
|
|
164
|
-
.v-label.error--text{
|
|
165
|
-
animation: v-shake 0.6s cubic-bezier(0.25, 0.8, 0.5, 1);
|
|
166
|
-
}
|
|
167
|
-
</style>
|
|
168
|
-
|
|
169
|
-
<docs>
|
|
170
|
-
|
|
171
|
-
### Defaults
|
|
172
|
-
|
|
173
|
-
This is the default [wygEditor configuration](https://www.tiny.cloud/docs/configure/).
|
|
174
|
-
|
|
175
|
-
```js
|
|
176
|
-
{
|
|
177
|
-
plugins: 'mapomedia preview paste importcss searchreplace autolink directionality code visualblocks visualchars fullscreen image link media template codesample table charmap hr pagebreak nonbreaking anchor toc insertdatetime advlist lists wordcount imagetools textpattern noneditable help charmap quickbars emoticons',
|
|
178
|
-
menubar: 'file edit view insert format tools table help',
|
|
179
|
-
toolbar: 'undo redo | bold italic underline strikethrough | fontselect fontsizeselect formatselect | alignleft aligncenter alignright alignjustify | outdent indent | numlist bullist | forecolor backcolor removeformat | pagebreak | charmap emoticons | fullscreen preview | insertfile image mapomedia media template link anchor codesample | ltr rtl',
|
|
180
|
-
toolbar_sticky: true,
|
|
181
|
-
image_advtab: true,
|
|
182
|
-
importcss_append: true,
|
|
183
|
-
template_cdate_format: '[Date Created (CDATE): %m/%d/%Y : %H:%M:%S]',
|
|
184
|
-
template_mdate_format: '[Date Modified (MDATE): %m/%d/%Y : %H:%M:%S]',
|
|
185
|
-
height: 600,
|
|
186
|
-
image_caption: true,
|
|
187
|
-
quickbars_selection_toolbar: 'bold italic | quicklink h2 h3 blockquote quickimage quicktable',
|
|
188
|
-
noneditable_noneditable_class: 'mceNonEditable',
|
|
189
|
-
toolbar_mode: 'sliding',
|
|
190
|
-
contextmenu: 'link image imagetools table',
|
|
191
|
-
skin: useDarkMode ? 'oxide-dark' : 'oxide',
|
|
192
|
-
content_css: useDarkMode ? 'dark' : 'default',
|
|
193
|
-
content_style: 'body { font-family:Helvetica,Arial,sans-serif; font-size:14px }'
|
|
194
|
-
}
|
|
195
|
-
```
|
|
196
|
-
</docs>
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<v-navigation-drawer
|
|
3
|
-
v-model="drawerSetter"
|
|
4
|
-
:mini-variant.sync="miniVariant"
|
|
5
|
-
width="300"
|
|
6
|
-
:clipped="this.$store.getters['mapo/app/clipped']"
|
|
7
|
-
fixed
|
|
8
|
-
app
|
|
9
|
-
>
|
|
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>
|
|
32
|
-
</div>
|
|
33
|
-
</v-navigation-drawer>
|
|
34
|
-
</template>
|
|
35
|
-
|
|
36
|
-
<style lang="scss" scoped>
|
|
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;
|
|
44
|
-
}
|
|
45
|
-
</style>
|
|
46
|
-
|
|
47
|
-
<script>
|
|
48
|
-
// @vuese
|
|
49
|
-
export default {
|
|
50
|
-
name: "Sidebar",
|
|
51
|
-
data() {
|
|
52
|
-
return {
|
|
53
|
-
miniVariant: false
|
|
54
|
-
};
|
|
55
|
-
},
|
|
56
|
-
computed: {
|
|
57
|
-
drawerSetter: {
|
|
58
|
-
get() {
|
|
59
|
-
return this.$store.getters["mapo/app/drawer"];
|
|
60
|
-
},
|
|
61
|
-
set(value) {
|
|
62
|
-
if (this.$store.getters["mapo/app/drawer"] !== value)
|
|
63
|
-
this.$store.dispatch("mapo/app/toggleSidebarDrawer");
|
|
64
|
-
return value;
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
username() {
|
|
68
|
-
return this.$mapo.$auth.user.username;
|
|
69
|
-
},
|
|
70
|
-
avatar() {
|
|
71
|
-
return this.$mapo.$auth.user.avatar;
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
methods: {
|
|
75
|
-
drawerReverse() {
|
|
76
|
-
return (this.drawer = !this.drawer);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
</script>
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
<template>
|
|
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>
|
|
23
|
-
</div>
|
|
24
|
-
</template>
|
|
25
|
-
|
|
26
|
-
<style lang="scss" scoped>
|
|
27
|
-
.logout__button{
|
|
28
|
-
&.theme--light{
|
|
29
|
-
background: #ffffffd6;
|
|
30
|
-
filter: invert(1);
|
|
31
|
-
}
|
|
32
|
-
&.theme--dark{
|
|
33
|
-
background: #121212;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
</style>
|
|
37
|
-
<script>
|
|
38
|
-
import { buildRoutes } from "../routebuilder";
|
|
39
|
-
|
|
40
|
-
// @vuese
|
|
41
|
-
export default {
|
|
42
|
-
name: "SidebarFooter",
|
|
43
|
-
props: {
|
|
44
|
-
forceCollapse: {
|
|
45
|
-
type: Boolean,
|
|
46
|
-
default: false
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
data() {
|
|
50
|
-
return {
|
|
51
|
-
defaultIcon: ({ label }) => `mdi-alpha-${label[0]}-box`.toLowerCase(),
|
|
52
|
-
routes: this.routes
|
|
53
|
-
};
|
|
54
|
-
},
|
|
55
|
-
mounted() {
|
|
56
|
-
this.routes = this.buildRoutes(
|
|
57
|
-
this.$router.options.routes.filter(
|
|
58
|
-
route => route.meta && route.meta.sidebarFooter === true
|
|
59
|
-
)
|
|
60
|
-
);
|
|
61
|
-
},
|
|
62
|
-
methods: {
|
|
63
|
-
buildRoutes(routes) {
|
|
64
|
-
return buildRoutes(routes, this.defaultIcon);
|
|
65
|
-
},
|
|
66
|
-
logout() {
|
|
67
|
-
this.$store.dispatch("mapo/user/logout");
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
</script>
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<v-list dense class="py-0 overflow-y-auto">
|
|
3
|
-
<SidebarListItem
|
|
4
|
-
v-for="(item, i) in routes"
|
|
5
|
-
:key="i"
|
|
6
|
-
:link="item.link"
|
|
7
|
-
:label="item.label"
|
|
8
|
-
:meta="item.meta"
|
|
9
|
-
:childrens="item.childrens"
|
|
10
|
-
:icon="item.icon"
|
|
11
|
-
:force-collapse="forceCollapse"
|
|
12
|
-
spider-menu
|
|
13
|
-
/>
|
|
14
|
-
</v-list>
|
|
15
|
-
</template>
|
|
16
|
-
|
|
17
|
-
<script>
|
|
18
|
-
import { buildRoutes } from "../routebuilder";
|
|
19
|
-
|
|
20
|
-
// @vuese
|
|
21
|
-
export default {
|
|
22
|
-
name: "SidebarList",
|
|
23
|
-
props: {
|
|
24
|
-
forceCollapse: {
|
|
25
|
-
type: Boolean,
|
|
26
|
-
default: false
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
data() {
|
|
30
|
-
return {
|
|
31
|
-
defaultIcon: ({label}) => `mdi-alpha-${label[0]}-box-outline`.toLowerCase(),
|
|
32
|
-
routes: this.routes,
|
|
33
|
-
};
|
|
34
|
-
},
|
|
35
|
-
mounted() {
|
|
36
|
-
this.routes = this.buildRoutes(this.$router.options.routes.filter(route => !route.meta || !route.meta.sidebarFooter));
|
|
37
|
-
},
|
|
38
|
-
methods: {
|
|
39
|
-
buildRoutes(routes) {
|
|
40
|
-
return buildRoutes(routes, this.defaultIcon)
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
</script>
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
<template>
|
|
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>
|
|
17
|
-
<v-icon
|
|
18
|
-
class="expand-icon"
|
|
19
|
-
v-if="childrens.length"
|
|
20
|
-
:style="rotate"
|
|
21
|
-
@click.native.prevent="link && (expanded = !expanded)"
|
|
22
|
-
>mdi-chevron-down</v-icon
|
|
23
|
-
>
|
|
24
|
-
</v-list-item>
|
|
25
|
-
|
|
26
|
-
<div :style="indent" v-if="childrens.length && expanded && !forceCollapse">
|
|
27
|
-
<SidebarListItem
|
|
28
|
-
v-for="(item, i) in childrens"
|
|
29
|
-
:key="i"
|
|
30
|
-
:link="item.link"
|
|
31
|
-
:label="item.label"
|
|
32
|
-
:meta="item.meta"
|
|
33
|
-
:childrens="item.childrens"
|
|
34
|
-
:depth="(depth || 0) + 1"
|
|
35
|
-
:icon="item.icon"
|
|
36
|
-
:force-collapse="forceCollapse"
|
|
37
|
-
:spider-menu="spiderMenu"
|
|
38
|
-
child
|
|
39
|
-
/>
|
|
40
|
-
</div>
|
|
41
|
-
</div>
|
|
42
|
-
</template>
|
|
43
|
-
|
|
44
|
-
<style lang="scss" scoped>
|
|
45
|
-
@import "@mapomodule/uikit/assets/variables.scss";
|
|
46
|
-
|
|
47
|
-
.expand-icon {
|
|
48
|
-
margin: 0 0 0 auto;
|
|
49
|
-
cursor: pointer;
|
|
50
|
-
&:hover {
|
|
51
|
-
background: #f7f7f747;
|
|
52
|
-
border-radius: 50%;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
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;
|
|
77
|
-
}
|
|
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;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
</style>
|
|
91
|
-
|
|
92
|
-
<script>
|
|
93
|
-
export default {
|
|
94
|
-
name: "SidebarListItem",
|
|
95
|
-
data() {
|
|
96
|
-
return {
|
|
97
|
-
expanded: false,
|
|
98
|
-
nestDepth: 14,
|
|
99
|
-
};
|
|
100
|
-
},
|
|
101
|
-
computed: {
|
|
102
|
-
indent() {
|
|
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
|
-
};
|
|
107
|
-
},
|
|
108
|
-
rotate() {
|
|
109
|
-
return {
|
|
110
|
-
transform: this.expanded ? "rotate(180deg)" : "rotate(0deg)",
|
|
111
|
-
transition: "transform 225ms cubic-bezier(0.4, 0, 0.2, 1)",
|
|
112
|
-
};
|
|
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
|
-
},
|
|
131
|
-
},
|
|
132
|
-
props: {
|
|
133
|
-
link: String,
|
|
134
|
-
label: String,
|
|
135
|
-
icon: String,
|
|
136
|
-
childrens: Array,
|
|
137
|
-
meta: Object,
|
|
138
|
-
depth: Number,
|
|
139
|
-
forceCollapse: Boolean,
|
|
140
|
-
child: Boolean,
|
|
141
|
-
spiderMenu: Boolean,
|
|
142
|
-
},
|
|
143
|
-
};
|
|
144
|
-
</script>
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<v-app-bar
|
|
3
|
-
:clipped-left="this.$store.getters['mapo/app/clipped']"
|
|
4
|
-
fixed
|
|
5
|
-
app
|
|
6
|
-
flat
|
|
7
|
-
dense
|
|
8
|
-
>
|
|
9
|
-
<v-app-bar-nav-icon @click.stop="drawerReverse()" />
|
|
10
|
-
<v-toolbar-title v-text="title" />
|
|
11
|
-
</v-app-bar>
|
|
12
|
-
</template>
|
|
13
|
-
|
|
14
|
-
<script>
|
|
15
|
-
|
|
16
|
-
export default {
|
|
17
|
-
name: "Topbar",
|
|
18
|
-
props: {
|
|
19
|
-
title: String
|
|
20
|
-
},
|
|
21
|
-
methods: {
|
|
22
|
-
drawerReverse() {
|
|
23
|
-
this.$store.dispatch("mapo/app/toggleSidebarDrawer");
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
</script>
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
function getDefaultIcon(ctx, defaultIcon) {
|
|
2
|
-
if (defaultIcon instanceof Function) {
|
|
3
|
-
return defaultIcon(ctx)
|
|
4
|
-
}
|
|
5
|
-
return defaultIcon
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
function buildRoutes(routes, defaultIcon) {
|
|
9
|
-
return nestReduce(
|
|
10
|
-
routes
|
|
11
|
-
.filter((e) => !e.meta || !e.meta.sidebarHide)
|
|
12
|
-
.sort((a, b) => a.name.localeCompare(b.name))
|
|
13
|
-
.map((route) => {
|
|
14
|
-
const { meta, path, name } = route
|
|
15
|
-
const label = (route.meta && route.meta.label) || (path.split("/").pop() || "").replaceAll(':', '').replaceAll('-', ' ') || 'home'
|
|
16
|
-
const icon = route.meta && route.meta.icon !== undefined ? route.meta.icon : getDefaultIcon({ route, label }, defaultIcon)
|
|
17
|
-
return { label, icon, meta, name, link: path, relPath: path.slice(1), childrens: [] };
|
|
18
|
-
}),
|
|
19
|
-
defaultIcon
|
|
20
|
-
)
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function nestReduce(array, defaultIcon) {
|
|
24
|
-
return array.reduce((stack, route) => {
|
|
25
|
-
const names = route.relPath.split("/");
|
|
26
|
-
if (names.length === 1) {
|
|
27
|
-
stack.push(route);
|
|
28
|
-
} else {
|
|
29
|
-
const name = names.shift();
|
|
30
|
-
let pIndex = stack.findIndex((el) => el.relPath === name);
|
|
31
|
-
if (pIndex === -1) {
|
|
32
|
-
const label = (route.meta && route.meta.parentLabel) || name
|
|
33
|
-
const icon = (route.meta && route.meta.parentIcon) || getDefaultIcon({ route, label }, defaultIcon)
|
|
34
|
-
stack.push({ name, label, icon, childrens: [] });
|
|
35
|
-
pIndex = stack.length - 1;
|
|
36
|
-
}
|
|
37
|
-
stack[pIndex].childrens.push(
|
|
38
|
-
Object.assign(route, { relPath: names.join('/') })
|
|
39
|
-
);
|
|
40
|
-
stack[pIndex].childrens = nestReduce(stack[pIndex].childrens, defaultIcon);
|
|
41
|
-
}
|
|
42
|
-
return stack;
|
|
43
|
-
}, []);
|
|
44
|
-
}
|
|
45
|
-
module.exports = {
|
|
46
|
-
buildRoutes,
|
|
47
|
-
nestReduce
|
|
48
|
-
}
|
package/defaults.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import colors from 'vuetify/es5/util/colors'
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
customVariables: ['@mapomodule/uikit/assets/variables.scss'],
|
|
5
|
-
theme: {
|
|
6
|
-
dark: true,
|
|
7
|
-
themes: {
|
|
8
|
-
dark: {
|
|
9
|
-
primary: '#309A00',
|
|
10
|
-
accent: colors.grey.darken3,
|
|
11
|
-
secondary: colors.amber.darken3,
|
|
12
|
-
info: colors.teal.lighten1,
|
|
13
|
-
warning: colors.amber.base,
|
|
14
|
-
error: '#FF5252',
|
|
15
|
-
success: colors.green.accent3
|
|
16
|
-
},
|
|
17
|
-
light: {
|
|
18
|
-
primary: '#309A00',
|
|
19
|
-
accent: colors.indigo.accent1,
|
|
20
|
-
secondary: colors.amber.accent2,
|
|
21
|
-
info: colors.teal.lighten1,
|
|
22
|
-
warning: colors.amber.base,
|
|
23
|
-
error: '#FF5252',
|
|
24
|
-
success: colors.green.accent3
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
treeShake: false
|
|
29
|
-
}
|
package/layouts/default.vue
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<v-app>
|
|
3
|
-
<Sidebar />
|
|
4
|
-
<Topbar :title="title" :drawer="this.$store.getters['mapo/app/drawer']" />
|
|
5
|
-
<v-main>
|
|
6
|
-
<nuxt />
|
|
7
|
-
<root-components />
|
|
8
|
-
</v-main>
|
|
9
|
-
</v-app>
|
|
10
|
-
</template>
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
<script>
|
|
14
|
-
export default {
|
|
15
|
-
data() {
|
|
16
|
-
return {
|
|
17
|
-
title: "Pannello"
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
</script>
|