@mapomodule/uikit 1.0.0-alpha.2 → 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.
Files changed (31) hide show
  1. package/CHANGELOG.md +115 -0
  2. package/components/Detail/Detail.vue +156 -95
  3. package/components/Detail/DetailField.vue +14 -11
  4. package/components/Detail/defaults.js +6 -1
  5. package/components/DropArea.vue +1 -1
  6. package/components/List/List.vue +100 -40
  7. package/components/List/ListActions.vue +38 -17
  8. package/components/List/ListFilters.vue +127 -113
  9. package/components/List/ListHead.vue +23 -13
  10. package/components/List/ListQuickEdit.vue +14 -5
  11. package/components/List/ListTable.vue +218 -76
  12. package/components/MediaManager/MediaEditor.vue +247 -107
  13. package/components/MediaManager/MediaFolders.vue +122 -38
  14. package/components/MediaManager/MediaGallery.vue +56 -52
  15. package/components/MediaManager/MediaManager.vue +114 -74
  16. package/components/MediaManager/MediaManagerDialog.vue +19 -22
  17. package/components/MediaManager/MediaPreview.vue +180 -0
  18. package/components/MediaManager/MediaUploader.vue +35 -32
  19. package/components/fields/MediaField.vue +12 -2
  20. package/components/fields/SeoPreview.vue +89 -0
  21. package/components/fields/TinyMce/TinyMce.vue +29 -10
  22. package/components/fields/TinyMce/defaults.js +1 -1
  23. package/components/layout/Sidebar/Sidebar.vue +46 -24
  24. package/components/layout/Sidebar/SidebarFooter.vue +41 -46
  25. package/components/layout/Sidebar/SidebarList.vue +12 -14
  26. package/components/layout/Sidebar/SidebarListItem.vue +65 -38
  27. package/components/layout/Topbar/Topbar.vue +3 -36
  28. package/components/layout/routebuilder.js +1 -1
  29. package/layouts/default.vue +3 -14
  30. package/package.json +2 -2
  31. package/pages/index.vue +1 -2
@@ -1,68 +1,60 @@
1
1
  <template>
2
- <div class="sidebar__ender">
3
- <sidebar-list-item
4
- class="sidebar__ender__item"
5
- v-for="(item, i) in routes"
6
- :key="i"
7
- :link="item.link"
8
- :label="item.label"
9
- :childrens="item.childrens"
10
- :icon="item.icon"
11
- />
12
- <logout-button class="sidebar__ender__item sidebar__ender__item--logout" />
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
+ :childrens="item.childrens"
11
+ :icon="item.icon"
12
+ :force-collapse="forceCollapse"
13
+ />
14
+ </v-list>
15
+ <v-divider></v-divider>
16
+ <v-list-item dense class="logout__button" link @click.native="logout">
17
+ <v-list-item-icon>
18
+ <v-icon>mdi-logout</v-icon>
19
+ </v-list-item-icon>
20
+ <v-list-item-title> Logout </v-list-item-title>
21
+ </v-list-item>
13
22
  </div>
14
23
  </template>
15
24
 
16
25
  <style lang="scss" scoped>
17
- @import "@mapomodule/uikit/assets/variables.scss";
18
-
19
- .sidebar {
20
- &__ender {
21
- margin-top: auto;
22
- display: flex;
23
- flex-direction: column;
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
- }
26
+ .logout__button{
27
+ &.theme--light{
28
+ background: #ffffffd6;
29
+ filter: invert(1);
30
+ }
31
+ &.theme--dark{
32
+ background: #121212;
46
33
  }
47
34
  }
48
35
  </style>
49
-
50
36
  <script>
51
37
  import { buildRoutes } from "../routebuilder";
52
38
 
53
39
  // @vuese
54
40
  export default {
55
41
  name: "SidebarFooter",
42
+ props: {
43
+ forceCollapse: {
44
+ type: Boolean,
45
+ default: false
46
+ }
47
+ },
56
48
  data() {
57
49
  return {
58
- defaultIcon: ({label}) => `mdi-alpha-${label[0]}-box`.toLowerCase(),
59
- routes: this.routes,
50
+ defaultIcon: ({ label }) => `mdi-alpha-${label[0]}-box`.toLowerCase(),
51
+ routes: this.routes
60
52
  };
61
53
  },
62
- mounted: function () {
54
+ mounted() {
63
55
  this.routes = this.buildRoutes(
64
56
  this.$router.options.routes.filter(
65
- (route) => route.meta && route.meta.sidebarFooter === true
57
+ route => route.meta && route.meta.sidebarFooter === true
66
58
  )
67
59
  );
68
60
  },
@@ -70,6 +62,9 @@ export default {
70
62
  buildRoutes(routes) {
71
63
  return buildRoutes(routes, this.defaultIcon);
72
64
  },
73
- },
65
+ logout() {
66
+ this.$store.dispatch("mapo/user/logout");
67
+ }
68
+ }
74
69
  };
75
70
  </script>
@@ -1,39 +1,37 @@
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
+ spider-menu
11
12
  />
12
- </div>
13
+ </v-list>
13
14
  </template>
14
15
 
15
- <style lang="scss" scoped>
16
- .sidebar {
17
- &__list {
18
- display: flex;
19
- flex-direction: column;
20
- }
21
- }
22
- </style>
23
-
24
16
  <script>
25
17
  import { buildRoutes } from "../routebuilder";
26
18
 
27
19
  // @vuese
28
20
  export default {
29
21
  name: "SidebarList",
22
+ props: {
23
+ forceCollapse: {
24
+ type: Boolean,
25
+ default: false
26
+ }
27
+ },
30
28
  data() {
31
29
  return {
32
- defaultIcon: ({label}) => `mdi-alpha-${label[0]}-circle`.toLowerCase(),
30
+ defaultIcon: ({label}) => `mdi-alpha-${label[0]}-box-outline`.toLowerCase(),
33
31
  routes: this.routes,
34
32
  };
35
33
  },
36
- mounted: function () {
34
+ mounted() {
37
35
  this.routes = this.buildRoutes(this.$router.options.routes.filter(route => !route.meta || !route.meta.sidebarFooter));
38
36
  },
39
37
  methods: {
@@ -1,37 +1,40 @@
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 :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
- </span>
25
- <div v-if="childrens.length && expanded">
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
32
  :childrens="item.childrens"
33
- :depth="depth || 0 + 1"
33
+ :depth="(depth || 0) + 1"
34
34
  :icon="item.icon"
35
+ :force-collapse="forceCollapse"
36
+ :spider-menu="spiderMenu"
37
+ child
35
38
  />
36
39
  </div>
37
40
  </div>
@@ -48,24 +51,38 @@
48
51
  border-radius: 50%;
49
52
  }
50
53
  }
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);
54
+ .spider-menu.child {
55
+ .v-list-item__icon {
56
+ &::after {
57
+ content: "";
58
+ position: absolute;
59
+ width: 5px;
60
+ height: 30px;
61
+ top: -9px;
62
+ margin-left: -4px;
63
+ border-bottom: solid 3px #acacac;
64
+ border-left: solid 3px #acacac;
65
+ z-index: -1;
66
66
  }
67
- &__icon {
68
- margin-right: 0.5rem;
67
+ &::before {
68
+ content: "";
69
+ position: absolute;
70
+ width: 5px;
71
+ height: 10px;
72
+ top: 21px;
73
+ margin-left: -4px;
74
+ border-left: solid 3px #acacac;
75
+ z-index: -1;
76
+ }
77
+ }
78
+ }
79
+ .spider-menu.child:last-child {
80
+ .v-list-item__icon {
81
+ &::before {
82
+ height: 0px;
83
+ }
84
+ &::after {
85
+ border-bottom-left-radius: 3px;
69
86
  }
70
87
  }
71
88
  }
@@ -77,11 +94,15 @@ export default {
77
94
  data() {
78
95
  return {
79
96
  expanded: false,
97
+ nestDepth: 14,
80
98
  };
81
99
  },
82
100
  computed: {
83
101
  indent() {
84
- return { marginLeft: `${+this.depth * 10}px` };
102
+ return {
103
+ paddingLeft: `calc(1rem + ${+this.depth * this.nestDepth}px)`,
104
+ marginLeft: this.depth > 1 && `calc(-1rem - ${(this.depth - 1) * this.nestDepth}px)`,
105
+ };
85
106
  },
86
107
  rotate() {
87
108
  return {
@@ -89,6 +110,9 @@ export default {
89
110
  transition: "transform 225ms cubic-bezier(0.4, 0, 0.2, 1)",
90
111
  };
91
112
  },
113
+ activeChild() {
114
+ return (this.childrens || []).some((child) => this.$nuxt.$route.path.startsWith(child.link));
115
+ },
92
116
  },
93
117
  props: {
94
118
  link: String,
@@ -96,6 +120,9 @@ export default {
96
120
  icon: String,
97
121
  childrens: Array,
98
122
  depth: Number,
123
+ forceCollapse: Boolean,
124
+ child: Boolean,
125
+ spiderMenu: Boolean,
99
126
  },
100
127
  };
101
128
  </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,25 +1,14 @@
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>
7
- <nuxt />
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 {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mapomodule/uikit",
3
- "version": "1.0.0-alpha.2",
3
+ "version": "1.0.0-alpha.7",
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": "0e0250444e8db547df4a3b3e70364880fde8f36b"
16
+ "gitHead": "bdfb81790a70aa1c8ddfde78c8f9ba7345f7ba64"
17
17
  }
package/pages/index.vue CHANGED
@@ -20,14 +20,13 @@
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;
27
26
  }
28
27
  </style>
29
28
  <script>
30
- import { version } from "@mapomodule/core/package.json";
29
+ import { version } from "mapomodule/package.json";
31
30
  export default {
32
31
  data: () => ({
33
32
  version: version