@mapomodule/uikit 1.0.0-alpha.5 → 1.0.0-alpha.6

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.
@@ -1,39 +1,36 @@
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"
9
8
  :childrens="item.childrens"
10
9
  :icon="item.icon"
10
+ :force-collapse="forceCollapse"
11
11
  />
12
- </div>
12
+ </v-list>
13
13
  </template>
14
14
 
15
- <style lang="scss" scoped>
16
- .sidebar {
17
- &__list {
18
- display: flex;
19
- flex-direction: column;
20
- }
21
- }
22
- </style>
23
-
24
15
  <script>
25
16
  import { buildRoutes } from "../routebuilder";
26
17
 
27
18
  // @vuese
28
19
  export default {
29
20
  name: "SidebarList",
21
+ props: {
22
+ forceCollapse: {
23
+ type: Boolean,
24
+ default: false
25
+ }
26
+ },
30
27
  data() {
31
28
  return {
32
29
  defaultIcon: ({label}) => `mdi-alpha-${label[0]}-circle`.toLowerCase(),
33
30
  routes: this.routes,
34
31
  };
35
32
  },
36
- mounted: function () {
33
+ mounted() {
37
34
  this.routes = this.buildRoutes(this.$router.options.routes.filter(route => !route.meta || !route.meta.sidebarFooter));
38
35
  },
39
36
  methods: {
@@ -1,36 +1,37 @@
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>
3
+ <v-list-item
4
+ :style="indent"
5
+ :exact-path="expanded"
6
+ @click.native="!link && (expanded = !expanded)"
7
+ link
8
+ :to="link"
9
+ >
10
+ <v-list-item-icon v-if="icon">
11
+ <v-icon>{{ icon }}</v-icon>
12
+ </v-list-item-icon>
13
+ <v-list-item-title>
14
+ {{ label }}
15
+ </v-list-item-title>
6
16
  <v-icon
7
17
  class="expand-icon"
8
18
  v-if="childrens.length"
9
19
  :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"
20
+ @click.native.prevent="link && (expanded = !expanded)"
22
21
  >mdi-chevron-down</v-icon
23
22
  >
24
- </span>
25
- <div v-if="childrens.length && expanded">
23
+ </v-list-item>
24
+
25
+ <div :style="indent" v-if="childrens.length && expanded && !forceCollapse">
26
26
  <SidebarListItem
27
27
  class="sidebar__list__item"
28
28
  v-for="(item, i) in childrens"
29
29
  :key="i"
30
+ :force-collapse="forceCollapse"
30
31
  :link="item.link"
31
32
  :label="item.label"
32
33
  :childrens="item.childrens"
33
- :depth="depth || 0 + 1"
34
+ :depth="(depth || 0) + 1"
34
35
  :icon="item.icon"
35
36
  />
36
37
  </div>
@@ -48,27 +49,6 @@
48
49
  border-radius: 50%;
49
50
  }
50
51
  }
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
- }
67
- &__icon {
68
- margin-right: 0.5rem;
69
- }
70
- }
71
- }
72
52
  </style>
73
53
 
74
54
  <script>
@@ -76,19 +56,22 @@ export default {
76
56
  name: "SidebarListItem",
77
57
  data() {
78
58
  return {
79
- expanded: false,
59
+ expanded: false
80
60
  };
81
61
  },
82
62
  computed: {
83
63
  indent() {
84
- return { marginLeft: `${+this.depth * 10}px` };
64
+ return {
65
+ paddingLeft: `calc(1rem + ${+this.depth * 14}px)`,
66
+ marginLeft: this.depth > 1 && `calc(-1rem - ${(this.depth - 1) * 14}px)`
67
+ };
85
68
  },
86
69
  rotate() {
87
70
  return {
88
71
  transform: this.expanded ? "rotate(180deg)" : "rotate(0deg)",
89
- transition: "transform 225ms cubic-bezier(0.4, 0, 0.2, 1)",
72
+ transition: "transform 225ms cubic-bezier(0.4, 0, 0.2, 1)"
90
73
  };
91
- },
74
+ }
92
75
  },
93
76
  props: {
94
77
  link: String,
@@ -96,6 +79,7 @@ export default {
96
79
  icon: String,
97
80
  childrens: Array,
98
81
  depth: Number,
99
- },
82
+ forceCollapse: Boolean
83
+ }
100
84
  };
101
85
  </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 = (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
@@ -1,9 +1,9 @@
1
1
  <template>
2
- <v-app class="app__wrapper">
2
+ <v-app>
3
3
  <Sidebar />
4
4
  <Topbar :title="title" :drawer="this.$store.getters['mapo/app/drawer']" />
5
5
  <v-main>
6
- <v-container>
6
+ <v-container fluid>
7
7
  <nuxt />
8
8
  <root-components />
9
9
  </v-container>
@@ -11,15 +11,6 @@
11
11
  </v-app>
12
12
  </template>
13
13
 
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
14
 
24
15
  <script>
25
16
  export default {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mapomodule/uikit",
3
- "version": "1.0.0-alpha.5",
3
+ "version": "1.0.0-alpha.6",
4
4
  "license": "MIT",
5
5
  "description": "This is part of Mapo nuxt module. Injects Mapo ui components in the nuxt component discovery system.",
6
6
  "author": "bnznamco <gabriele.baldi.01@gmail.com>",
@@ -13,5 +13,5 @@
13
13
  "publishConfig": {
14
14
  "access": "public"
15
15
  },
16
- "gitHead": "abc5a9d9e50e791de00458de72961c76f3bc7a89"
16
+ "gitHead": "c30717d018606a1393f3a1f680276b1817d1d7a8"
17
17
  }
package/pages/index.vue CHANGED
@@ -20,7 +20,6 @@
20
20
 
21
21
  <style scoped>
22
22
  .mapo-info {
23
- background: #333333;
24
23
  border-radius: 8px;
25
24
  margin: 10px 5%;
26
25
  padding: 10px;