@mapomodule/uikit 1.0.0-alpha.4 → 1.0.0-alpha.40

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.
Files changed (80) hide show
  1. package/CHANGELOG.md +730 -0
  2. package/components/ConfirmDialog.vue +12 -16
  3. package/components/Detail/Detail.vue +406 -272
  4. package/components/Detail/DetailLangSwitch.vue +7 -2
  5. package/components/DropArea.vue +63 -56
  6. package/components/Form/Form.vue +218 -0
  7. package/components/Form/FormField.vue +213 -0
  8. package/components/Form/FormGroup.vue +146 -0
  9. package/components/Form/FormTabs.vue +188 -0
  10. package/components/Form/defaults.js +91 -0
  11. package/components/Form/fields/ColorField.vue +79 -0
  12. package/components/{fields → Form/fields}/DateField.vue +20 -11
  13. package/components/Form/fields/EnhancedMediaField.vue +224 -0
  14. package/components/Form/fields/FileField.vue +125 -0
  15. package/components/Form/fields/FksField.vue +88 -0
  16. package/components/Form/fields/MediaField.vue +159 -0
  17. package/components/Form/fields/MediaM2mField.vue +149 -0
  18. package/components/Form/fields/Repeater.vue +593 -0
  19. package/components/Form/fields/SeoPreview.vue +89 -0
  20. package/components/Form/fields/wygEditor/defaults.js +25 -0
  21. package/components/{fields/TinyMce → Form/fields/wygEditor}/utils/events.js +0 -0
  22. package/components/{fields/TinyMce → Form/fields/wygEditor}/utils/mapomedia.plugin.js +7 -6
  23. package/components/{fields/TinyMce → Form/fields/wygEditor}/utils/script.injector.js +0 -0
  24. package/components/Form/fields/wygEditor/wygEditor.vue +285 -0
  25. package/components/LangSwitcher.vue +44 -0
  26. package/components/List/List.vue +119 -42
  27. package/components/List/ListActions.vue +60 -21
  28. package/components/List/ListFilters.vue +166 -114
  29. package/components/List/ListHead.vue +30 -12
  30. package/components/List/ListQuickEdit.vue +130 -61
  31. package/components/List/ListTable.vue +292 -80
  32. package/components/Login.vue +17 -7
  33. package/components/LogoutButton.vue +42 -28
  34. package/components/MediaManager/MediaBreadcrumbs.vue +45 -0
  35. package/components/MediaManager/MediaEditor.vue +282 -121
  36. package/components/MediaManager/MediaFolders.vue +169 -116
  37. package/components/MediaManager/MediaGallery.vue +151 -146
  38. package/components/MediaManager/MediaManager.vue +117 -159
  39. package/components/MediaManager/MediaManagerDialog.vue +36 -31
  40. package/components/MediaManager/MediaPreview.vue +203 -0
  41. package/components/MediaManager/MediaUploader.vue +55 -43
  42. package/components/SnackBar.vue +5 -7
  43. package/components/ThemeToggle.vue +13 -0
  44. package/components/layout/Sidebar/Sidebar.vue +61 -30
  45. package/components/layout/Sidebar/SidebarList.vue +19 -15
  46. package/components/layout/Sidebar/SidebarListItem.vue +111 -39
  47. package/components/layout/Sidebar/SidebarProfile.vue +42 -0
  48. package/components/layout/Sidebar/SidebarTitle.vue +45 -0
  49. package/components/layout/Topbar/Topbar.vue +11 -42
  50. package/components/layout/routebuilder.js +3 -3
  51. package/defaults/i18n.js +37 -0
  52. package/defaults/vuetify.js +34 -0
  53. package/layouts/default.vue +33 -18
  54. package/layouts/empty.vue +10 -0
  55. package/module.js +7 -5
  56. package/package.json +6 -4
  57. package/pages/index.vue +19 -18
  58. package/static/{favicon.ico → mapo/favicon.ico} +0 -0
  59. package/static/mapo/tinymce-skins/mapo-dark/content.inline.min.css +7 -0
  60. package/static/mapo/tinymce-skins/mapo-dark/content.min.css +7 -0
  61. package/static/mapo/tinymce-skins/mapo-dark/content.mobile.min.css +7 -0
  62. package/static/mapo/tinymce-skins/mapo-dark/skin.min.css +7 -0
  63. package/static/mapo/tinymce-skins/mapo-dark/skin.mobile.min.css +7 -0
  64. package/static/mapo/tinymce-skins/mapo-light/content.inline.min.css +7 -0
  65. package/static/mapo/tinymce-skins/mapo-light/content.min.css +7 -0
  66. package/static/mapo/tinymce-skins/mapo-light/content.mobile.min.css +7 -0
  67. package/static/mapo/tinymce-skins/mapo-light/skin.min.css +7 -0
  68. package/static/mapo/tinymce-skins/mapo-light/skin.mobile.min.css +7 -0
  69. package/translations/en-US.js +134 -0
  70. package/translations/it-IT.js +136 -0
  71. package/components/Detail/DetailField.vue +0 -129
  72. package/components/Detail/defaults.js +0 -50
  73. package/components/fields/M2mField.vue +0 -95
  74. package/components/fields/MediaField.vue +0 -195
  75. package/components/fields/MediaM2mField.vue +0 -238
  76. package/components/fields/TinyMce/TinyMce.vue +0 -177
  77. package/components/fields/TinyMce/defaults.js +0 -55
  78. package/components/layout/Sidebar/SidebarFooter.vue +0 -75
  79. package/defaults.js +0 -29
  80. package/layouts/error.vue +0 -45
@@ -1,58 +1,89 @@
1
1
  <template>
2
2
  <v-navigation-drawer
3
- v-model="drawerSetter"
4
- :mini-variant="miniVariant"
3
+ v-model="drawer"
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="sidebar__core">
10
- <SidebarList />
11
- <SidebarFooter />
10
+ <div class="menu--container">
11
+ <div class="menu--container-top">
12
+ <component v-if="componentExists('MapoSidebarTitleTopSlot')" :is="'MapoSidebarTitleTopSlot'" />
13
+ <component v-if="componentExists('MapoSidebarTitleSlot')" :is="'MapoSidebarTitleSlot'" />
14
+ <SidebarTitle v-else />
15
+ <component v-if="componentExists('MapoSidebarTitleBottomSlot')" :is="'MapoSidebarTitleBottomSlot'" />
16
+ <v-divider></v-divider>
17
+ </div>
18
+ <div class="menu--container-center">
19
+ <component v-if="componentExists('MapoSidebarListTopSlot')" :is="'MapoSidebarListTopSlot'" />
20
+ <component v-if="componentExists('MapoSidebarListSlot')" :is="'MapoSidebarListSlot'" />
21
+ <SidebarList v-else :force-collapse="miniVariant" />
22
+ <component v-if="componentExists('MapoSidebarListBottomSlot')" :is="'MapoSidebarListBottomSlot'" />
23
+ </div>
24
+ <div class="menu--container-bottom">
25
+ <v-divider></v-divider>
26
+ <component v-if="componentExists('MapoSidebarListFooterTopSlot')" :is="'MapoSidebarListFooterTopSlot'" />
27
+ <component v-if="componentExists('MapoSidebarListFooterSlot')" :is="'MapoSidebarListFooterSlot'" />
28
+ <SidebarList v-else footer :force-collapse="miniVariant" />
29
+ <component v-if="componentExists('MapoSidebarListFooterBottomSlot')" :is="'MapoSidebarListFooterBottomSlot'" />
30
+ <v-divider></v-divider>
31
+ <component v-if="componentExists('MapoLogoutButtonTopSlot')" :is="'MapoLogoutButtonTopSlot'" />
32
+ <component v-if="componentExists('MapoLogoutButtonSlot')" :is="'MapoLogoutButtonSlot'" />
33
+ <LogoutButton v-else />
34
+ <component v-if="componentExists('MapoLogoutButtonBottomSlot')" :is="'MapoLogoutButtonBottomSlot'" />
35
+ </div>
12
36
  </div>
13
37
  </v-navigation-drawer>
14
38
  </template>
15
39
 
16
40
  <style lang="scss" scoped>
17
- @import '@mapomodule/uikit/assets/variables.scss';
18
-
19
- .sidebar {
20
- &__core {
21
- display: flex;
22
- flex-direction: column;
23
- height: 100%;
24
- // background: $b-1;
25
- // color: $white;
41
+ .menu--container {
42
+ display: flex;
43
+ flex-direction: column;
44
+ height: 100%;
45
+ &-top{
46
+ justify-self: flex-start;
47
+ }
48
+ &-center{
49
+ flex: 1;
50
+ }
51
+ &-bottom{
52
+ justify-self: flex-end;
26
53
  }
27
54
  }
28
55
  </style>
29
56
 
30
57
  <script>
31
- import { mapMutations } from 'vuex'
32
58
  // @vuese
33
59
  export default {
34
60
  name: "Sidebar",
35
- data () {
36
- return {
37
- miniVariant: false,
38
- }
39
- },
40
61
  computed: {
41
- drawerSetter: {
62
+ drawer: {
42
63
  get() {
43
- return this.$store.getters['mapo/app/drawer'];
64
+ return this.$store.getters["mapo/app/drawer"];
44
65
  },
45
66
  set(value) {
46
- if (this.$store.getters['mapo/app/drawer'] !== value)
67
+ if (this.$store.getters["mapo/app/drawer"] !== value)
47
68
  this.$store.dispatch("mapo/app/toggleSidebarDrawer");
48
69
  return value;
49
- }
50
- }
51
- },
52
- methods: {
53
- drawerReverse () {
54
- return this.drawer = !this.drawer
70
+ },
55
71
  },
72
+ miniVariant: {
73
+ get() {
74
+ return this.$store.getters["mapo/app/minivariant"];
75
+ },
76
+ set(value) {
77
+ if (this.$store.getters["mapo/app/minivariant"] !== value)
78
+ this.$store.dispatch("mapo/app/toggleSidebarMinivariant");
79
+ return value;
80
+ },
81
+ },
82
+ },
83
+ methods:{
84
+ componentExists(name){
85
+ return name in this.$options.components;
86
+ }
56
87
  }
57
- }
88
+ };
58
89
  </script>
@@ -1,40 +1,44 @@
1
1
  <template>
2
- <div class="sidebar__list">
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="spiderMenu"
11
13
  />
12
- </div>
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
+ footer: Boolean,
25
+ forceCollapse: Boolean,
26
+ spiderMenu: {
27
+ type: Boolean,
28
+ default() {
29
+ const { spiderMenu } = this.$mapo.$options?.ui?.sidebar || {};
30
+ return spiderMenu == undefined ? true : spiderMenu;
31
+ }
32
+ }
33
+ },
30
34
  data() {
31
35
  return {
32
- defaultIcon: ({label}) => `mdi-alpha-${label[0]}-circle`.toLowerCase(),
36
+ defaultIcon: ({label}) => `mdi-alpha-${label[0]}-box-${ this.footer ? '' : 'outline'}`.toLowerCase(),
33
37
  routes: this.routes,
34
38
  };
35
39
  },
36
- mounted: function () {
37
- this.routes = this.buildRoutes(this.$router.options.routes.filter(route => !route.meta || !route.meta.sidebarFooter));
40
+ mounted() {
41
+ this.routes = this.buildRoutes(this.$router.options.routes.filter(({ meta }) => !!meta?.sidebarFooter == this.footer));
38
42
  },
39
43
  methods: {
40
44
  buildRoutes(routes) {
@@ -1,37 +1,41 @@
1
1
  <template>
2
- <div :style="indent" class="sidebar__link__wrapper">
3
- <NuxtLink v-if="link" class="sidebar__link" :to="link">
4
- <v-icon v-if="icon" class="sidebar__link__icon">{{ icon }}</v-icon>
5
- {{ label }}
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.translate ? $t(label.translate) : 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"
21
+ @click.native.prevent="link && (expanded = !expanded)"
11
22
  >mdi-chevron-down</v-icon
12
23
  >
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"
22
- >mdi-chevron-down</v-icon
23
- >
24
- </span>
25
- <div v-if="childrens.length && expanded">
24
+ </v-list-item>
25
+
26
+ <div class="child-menu" :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>
@@ -40,6 +44,17 @@
40
44
  <style lang="scss" scoped>
41
45
  @import "@mapomodule/uikit/assets/variables.scss";
42
46
 
47
+ .v-list-item::after{
48
+ content: '';
49
+ position: absolute;
50
+ background: rgba(0, 0, 0, 0.2);
51
+ height: 100%;
52
+ width: 4px;
53
+ left: 0;
54
+ }
55
+ .v-list-item.v-list-item--active::after{
56
+ background: var(--v-primary-base);
57
+ }
43
58
  .expand-icon {
44
59
  margin: 0 0 0 auto;
45
60
  cursor: pointer;
@@ -48,24 +63,56 @@
48
63
  border-radius: 50%;
49
64
  }
50
65
  }
51
-
52
- .sidebar {
53
- &__link {
54
- display: flex;
55
- align-items: center;
56
- justify-content: flex-start;
57
- width: 100%;
58
- padding: 0.5rem 1rem;
59
- text-decoration: none;
60
- color: $white;
61
- background: rgba(0, 0, 0, 0);
62
- transition: all linear 0.25s;
63
- text-transform: capitalize;
64
- &:hover {
65
- background: rgba(0, 0, 0, 0.25);
66
+ .spider-menu.child {
67
+ .v-list-item__icon {
68
+ &::after {
69
+ content: "";
70
+ position: absolute;
71
+ width: 5px;
72
+ height: 30px;
73
+ top: -9px;
74
+ margin-left: -4px;
75
+ border-bottom: solid 3px #acacac;
76
+ border-left: solid 3px #acacac;
77
+ z-index: -1;
78
+ }
79
+ &::before {
80
+ content: "";
81
+ position: absolute;
82
+ width: 5px;
83
+ height: 10px;
84
+ top: 21px;
85
+ margin-left: -4px;
86
+ border-left: solid 3px #acacac;
87
+ z-index: -1;
88
+ }
89
+ }
90
+ .child-menu {
91
+ position: relative;
92
+ &::after {
93
+ content: "";
94
+ position: absolute;
95
+ width: 0px;
96
+ height: 100%;
97
+ top: -9px;
98
+ margin-left: -4px;
99
+ border-left: solid 3px #acacac;
100
+ z-index: -1;
101
+ }
102
+ }
103
+ }
104
+ .spider-menu.child:last-child {
105
+ .v-list-item__icon {
106
+ &::before {
107
+ height: 0px;
108
+ }
109
+ &::after {
110
+ border-bottom-left-radius: 3px;
66
111
  }
67
- &__icon {
68
- margin-right: 0.5rem;
112
+ }
113
+ .child-menu{
114
+ &::after {
115
+ height: 0px;
69
116
  }
70
117
  }
71
118
  }
@@ -77,11 +124,15 @@ export default {
77
124
  data() {
78
125
  return {
79
126
  expanded: false,
127
+ nestDepth: 14,
80
128
  };
81
129
  },
82
130
  computed: {
83
131
  indent() {
84
- return { marginLeft: `${+this.depth * 10}px` };
132
+ return {
133
+ paddingLeft: `calc(1rem + ${+this.depth * this.nestDepth}px)`,
134
+ marginLeft: this.depth > 1 && `calc(-1rem - ${(this.depth - 1) * this.nestDepth}px)`,
135
+ };
85
136
  },
86
137
  rotate() {
87
138
  return {
@@ -89,13 +140,34 @@ export default {
89
140
  transition: "transform 225ms cubic-bezier(0.4, 0, 0.2, 1)",
90
141
  };
91
142
  },
143
+ activeChild() {
144
+ return (this.childrens || []).some((child) => this.$nuxt.$route.path.startsWith(child.link));
145
+ },
146
+ userCanSee() {
147
+ const middleware = this.$mapo.$auth.getRouteMiddlewares({ meta: this.meta })
148
+ if (middleware.includes("permissions")){
149
+ const userInfo = this.$mapo.$auth.user.info
150
+ if (userInfo.is_superuser) return true
151
+ const { model } = this.meta?.permissions || {}
152
+ const userPermission = (userInfo.user_permissions || []).filter(perm => perm.codename.endsWith(model)).map(({ codename }) => codename.replace(`_${model}`, ''))
153
+ return userPermission.includes('view')
154
+ }
155
+ if (middleware.includes("auth")){
156
+ return this.$mapo.$auth.user.isLoggedIn
157
+ }
158
+ return true
159
+ },
92
160
  },
93
161
  props: {
94
162
  link: String,
95
- label: String,
163
+ label: String | Object,
96
164
  icon: String,
97
165
  childrens: Array,
166
+ meta: Object,
98
167
  depth: Number,
168
+ forceCollapse: Boolean,
169
+ child: Boolean,
170
+ spiderMenu: Boolean,
99
171
  },
100
172
  };
101
173
  </script>
@@ -0,0 +1,42 @@
1
+ <template>
2
+ <v-list-item>
3
+ <v-list-item-avatar v-if="avatar">
4
+ <v-img :src="avatar"></v-img>
5
+ </v-list-item-avatar>
6
+ <v-list-item-icon v-else>
7
+ <v-icon>mdi-account</v-icon>
8
+ </v-list-item-icon>
9
+ <v-list-item-title>
10
+ <span v-if="isLoggedIn">
11
+ {{ username }}
12
+ </span>
13
+ <NuxtLink v-else to="/login">{{ $t("mapo.login") }}</NuxtLink>
14
+ </v-list-item-title>
15
+ <v-btn icon @click.stop="toggleMiniVariant">
16
+ <v-icon>mdi-chevron-left</v-icon>
17
+ </v-btn>
18
+ </v-list-item>
19
+ </template>
20
+
21
+
22
+ <script>
23
+ // @vuese
24
+ export default {
25
+ computed: {
26
+ username() {
27
+ return this.isLoggedIn ? this.$mapo.$auth.user.username : "";
28
+ },
29
+ avatar() {
30
+ return this.$mapo.$auth.user.avatar;
31
+ },
32
+ isLoggedIn() {
33
+ return this.$mapo.$auth.user.isLoggedIn;
34
+ },
35
+ },
36
+ methods: {
37
+ toggleMiniVariant() {
38
+ this.$store.dispatch("mapo/app/toggleSidebarMinivariant");
39
+ },
40
+ },
41
+ };
42
+ </script>
@@ -0,0 +1,45 @@
1
+ <template>
2
+ <v-list-item class="sidebar-title--container">
3
+ <v-list-item-avatar class="sidebar-title--logo" v-if="logo">
4
+ <v-img :src="logo"></v-img>
5
+ </v-list-item-avatar>
6
+ <v-list-item-icon v-else>
7
+ <v-icon color="secondary">mdi-artstation</v-icon>
8
+ </v-list-item-icon>
9
+ <v-list-item-title>
10
+ <b>{{title}}</b>
11
+ </v-list-item-title>
12
+ <v-btn icon @click.stop="toggleMiniVariant">
13
+ <v-icon>mdi-chevron-left</v-icon>
14
+ </v-btn>
15
+ </v-list-item>
16
+ </template>
17
+
18
+ <style lang="scss">
19
+ .sidebar-title--container{
20
+ background: var(--v-primary-base);
21
+ color: var(--v-secondary-base);
22
+ }
23
+ .sidebar-title--logo{
24
+ left: -8px;
25
+ }
26
+ </style>
27
+
28
+ <script>
29
+ // @vuese
30
+ export default {
31
+ computed:{
32
+ title(){
33
+ return this.$mapo.$options?.ui?.panelName || "BACKOFFICE"
34
+ },
35
+ logo(){
36
+ return this.$mapo.$options?.ui?.panelLogo
37
+ }
38
+ },
39
+ methods: {
40
+ toggleMiniVariant() {
41
+ this.$store.dispatch("mapo/app/toggleSidebarMinivariant");
42
+ },
43
+ },
44
+ };
45
+ </script>
@@ -5,56 +5,25 @@
5
5
  app
6
6
  flat
7
7
  dense
8
- class="topbar__wrapper"
9
8
  >
10
- <v-app-bar-nav-icon @click.stop="drawerReverse()" />
11
- <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>
9
+ <component v-if="componentExists('MapoTopBarLeftSlot')" :is="'MapoTopBarLeftSlot'" />
10
+ <component v-if="componentExists('MapoTopBarToggleIconSlot')" :is="'MapoTopBarToggleIconSlot'" :toggleSidebarDrawer="toggleSidebarDrawer" />
11
+ <v-app-bar-nav-icon v-else @click.stop="toggleSidebarDrawer" />
12
+ <component v-if="componentExists('MapoTopBarTitleSlot')" :is="'MapoTopBarTitleSlot'"/>
13
+ <v-spacer></v-spacer>
14
+ <component v-if="componentExists('MapoTopBarRightSlot')" :is="'MapoTopBarRightSlot'"/>
25
15
  </v-app-bar>
26
16
  </template>
27
17
 
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
18
  <script>
47
- import { mapMutations } from 'vuex'
48
-
19
+ import { mapActions } from 'vuex';
49
20
  export default {
50
21
  name: "Topbar",
51
- props: {
52
- title: String
53
- },
54
22
  methods: {
55
- drawerReverse () {
56
- this.$store.dispatch("mapo/app/toggleSidebarDrawer");
57
- },
23
+ ...mapActions("mapo/app", ["toggleSidebarDrawer"]),
24
+ componentExists(name){
25
+ return name in this.$options.components;
26
+ }
58
27
  },
59
28
  };
60
29
  </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 = (route.meta && route.meta.icon) || getDefaultIcon({ route, label }, defaultIcon)
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
@@ -22,7 +22,7 @@ function buildRoutes(routes, defaultIcon) {
22
22
 
23
23
  function nestReduce(array, defaultIcon) {
24
24
  return array.reduce((stack, route) => {
25
- const names = route.relPath.split("/");
25
+ const names = (route.relPath || "").split("/");
26
26
  if (names.length === 1) {
27
27
  stack.push(route);
28
28
  } else {
@@ -31,7 +31,7 @@ function nestReduce(array, defaultIcon) {
31
31
  if (pIndex === -1) {
32
32
  const label = (route.meta && route.meta.parentLabel) || name
33
33
  const icon = (route.meta && route.meta.parentIcon) || getDefaultIcon({ route, label }, defaultIcon)
34
- stack.push({ name, label, icon, childrens: [] });
34
+ stack.push({ name, label, icon, relPath: name, childrens: [] });
35
35
  pIndex = stack.length - 1;
36
36
  }
37
37
  stack[pIndex].childrens.push(
@@ -0,0 +1,37 @@
1
+ export default {
2
+ detectBrowserLanguage: {
3
+ useCookie: true,
4
+ cookieKey: "i18n_redirected",
5
+ redirectOn: "root",
6
+ },
7
+ locales: [
8
+ {
9
+ code: "en",
10
+ name: "English",
11
+ file: "en-US.js",
12
+ iso: "en-US",
13
+ },
14
+ {
15
+ code: "it",
16
+ name: "Italiano",
17
+ file: "it-IT.js",
18
+ iso: "it-IT",
19
+ },
20
+ ],
21
+ lazy: true,
22
+ langDir: __dirname + "/../translations/",
23
+ defaultLocale: "en",
24
+ strategy: "no_prefix",
25
+ onBeforeLanguageSwitch: (oldLocale, newLocale, isInitialSetup, context) => {
26
+ const locale =
27
+ context.i18n.locales.find((l) => l.code === newLocale) || {};
28
+ const isRTL = locale.dir === "rtl";
29
+ if (isInitialSetup) {
30
+ context.app.vuetify.preset.rtl = isRTL;
31
+ }
32
+ context.app.vuetify.framework.lang.current = locale.iso
33
+ ? locale.iso.split("-")[0]
34
+ : locale.code;
35
+ context.app.vuetify.framework.rtl = isRTL;
36
+ },
37
+ };
@@ -0,0 +1,34 @@
1
+ import colors from "vuetify/es5/util/colors";
2
+ import { it, en } from "vuetify/lib/locale";
3
+
4
+ export default {
5
+ customVariables: ["@mapomodule/uikit/assets/variables.scss"],
6
+ theme: {
7
+ options: { customProperties: true },
8
+ dark: true,
9
+ themes: {
10
+ dark: {
11
+ primary: colors.lime.darken2,
12
+ secondary: colors.lightGreen.darken4,
13
+ secondary: colors.lightGreen.darken4,
14
+ info: colors.teal.lighten1,
15
+ warning: colors.amber.base,
16
+ error: "#FF5252",
17
+ success: colors.green.accent3,
18
+ },
19
+ light: {
20
+ primary: colors.lime.darken2,
21
+ accent: colors.lightGreen.accent4,
22
+ secondary: colors.lightGreen.darken4,
23
+ info: colors.teal.lighten1,
24
+ warning: colors.amber.base,
25
+ error: "#FF5252",
26
+ success: colors.green.accent3,
27
+ },
28
+ },
29
+ },
30
+ lang: {
31
+ locales: { en, it },
32
+ },
33
+ treeShake: true,
34
+ };