@awes-io/ui 2.35.0 → 2.36.0
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
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [2.36.0](https://github.com/awes-io/client/compare/@awes-io/ui@2.35.0...@awes-io/ui@2.36.0) (2021-12-10)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* logo switching added ([e5e7328](https://github.com/awes-io/client/commit/e5e732812e9acb5c3a6c810d9a7346affa422988))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# [2.35.0](https://github.com/awes-io/client/compare/@awes-io/ui@2.34.2...@awes-io/ui@2.35.0) (2021-12-04)
|
|
7
18
|
|
|
8
19
|
|
|
@@ -27,23 +27,14 @@
|
|
|
27
27
|
</template>
|
|
28
28
|
|
|
29
29
|
<script>
|
|
30
|
+
import { mapGetters } from 'vuex'
|
|
30
31
|
import { pathOr } from 'rambdax'
|
|
31
32
|
|
|
32
33
|
export default {
|
|
33
34
|
name: 'AwLayoutCenter',
|
|
34
35
|
|
|
35
36
|
computed: {
|
|
36
|
-
|
|
37
|
-
return this.$store.getters['awesIo/isDarkTheme']
|
|
38
|
-
},
|
|
39
|
-
|
|
40
|
-
logo() {
|
|
41
|
-
return pathOr(
|
|
42
|
-
null,
|
|
43
|
-
['$awes', '_config', this.isDark ? 'dark' : 'default', 'logo'],
|
|
44
|
-
this
|
|
45
|
-
)
|
|
46
|
-
},
|
|
37
|
+
...mapGetters('awesIo', ['isDarkTheme', 'logo']),
|
|
47
38
|
|
|
48
39
|
background() {
|
|
49
40
|
const { src, ...background } = pathOr(
|
|
@@ -51,7 +42,7 @@ export default {
|
|
|
51
42
|
[
|
|
52
43
|
'$awes',
|
|
53
44
|
'_config',
|
|
54
|
-
this.
|
|
45
|
+
this.isDarkTheme ? 'dark' : 'default',
|
|
55
46
|
'background'
|
|
56
47
|
],
|
|
57
48
|
this
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<template functional>
|
|
2
|
+
<NLink
|
|
3
|
+
to="/"
|
|
4
|
+
class="aw-layout-logo"
|
|
5
|
+
:class="[data.class, data.staticClass]"
|
|
6
|
+
>
|
|
7
|
+
<img v-if="props.logo" v-bind="props.logo" />
|
|
8
|
+
</NLink>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script>
|
|
12
|
+
export default {
|
|
13
|
+
name: 'AwLayoutLogo'
|
|
14
|
+
}
|
|
15
|
+
</script>
|
|
@@ -5,10 +5,12 @@
|
|
|
5
5
|
'aw-layout-menu--no-submenu': hideAside || !hasSubmenu
|
|
6
6
|
}"
|
|
7
7
|
>
|
|
8
|
-
<slot name="logo"
|
|
9
|
-
<
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
<slot name="logo">
|
|
9
|
+
<Component
|
|
10
|
+
:is="logoComponent.is"
|
|
11
|
+
v-bind="logoComponent.props"
|
|
12
|
+
class="aw-layout-menu__logo"
|
|
13
|
+
/>
|
|
12
14
|
</slot>
|
|
13
15
|
|
|
14
16
|
<div class="aw-layout-menu__menu">
|
|
@@ -62,6 +64,7 @@
|
|
|
62
64
|
import { mapGetters } from 'vuex'
|
|
63
65
|
import { pathOr, viewOr, lensProp, omit } from 'rambdax'
|
|
64
66
|
import AwMenuItemIcon from '@AwLayouts/_AwMenuItemIcon.vue'
|
|
67
|
+
import AwLayoutLogo from '@AwLayouts/_AwLayoutLogo.vue'
|
|
65
68
|
import AwUserMenu from '@AwLayouts/_AwUserMenu.vue'
|
|
66
69
|
import AwNav from '@AwLayouts/_AwNav.vue'
|
|
67
70
|
|
|
@@ -70,6 +73,7 @@ export default {
|
|
|
70
73
|
|
|
71
74
|
components: {
|
|
72
75
|
AwMenuItemIcon,
|
|
76
|
+
AwLayoutLogo,
|
|
73
77
|
AwUserMenu,
|
|
74
78
|
AwNav
|
|
75
79
|
},
|
|
@@ -85,7 +89,7 @@ export default {
|
|
|
85
89
|
},
|
|
86
90
|
|
|
87
91
|
computed: {
|
|
88
|
-
...mapGetters('awesIo', ['user', '
|
|
92
|
+
...mapGetters('awesIo', ['user', 'logoComponent']),
|
|
89
93
|
|
|
90
94
|
mainMenu() {
|
|
91
95
|
return viewOr([], lensProp('mainMenu'), this.layoutProvider)
|
|
@@ -115,14 +119,6 @@ export default {
|
|
|
115
119
|
this.activeMenu
|
|
116
120
|
)
|
|
117
121
|
: ''
|
|
118
|
-
},
|
|
119
|
-
|
|
120
|
-
logo() {
|
|
121
|
-
return pathOr(
|
|
122
|
-
null,
|
|
123
|
-
['_config', this.isDarkTheme ? 'dark' : 'default', 'logo'],
|
|
124
|
-
this.$awes
|
|
125
|
-
)
|
|
126
122
|
}
|
|
127
123
|
},
|
|
128
124
|
|
|
@@ -6,6 +6,12 @@ export default ({ store, app }) => {
|
|
|
6
6
|
*/
|
|
7
7
|
if (!store.hasModule('awesIo')) {
|
|
8
8
|
store.registerModule('awesIo', storeModule)
|
|
9
|
+
|
|
10
|
+
// Set default logo
|
|
11
|
+
store.commit('awesIo/SET_LOGO', {
|
|
12
|
+
default: JSON.parse('<%= JSON.stringify(options.default.logo) %>'),
|
|
13
|
+
dark: JSON.parse('<%= JSON.stringify(options.dark.logo) %>')
|
|
14
|
+
})
|
|
9
15
|
}
|
|
10
16
|
|
|
11
17
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@awes-io/ui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.36.0",
|
|
4
4
|
"description": "User Interface (UI) components",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ui",
|
|
@@ -124,5 +124,5 @@
|
|
|
124
124
|
"vue-template-compiler": "^2.6.10",
|
|
125
125
|
"webfonts-generator": "^0.4.0"
|
|
126
126
|
},
|
|
127
|
-
"gitHead": "
|
|
127
|
+
"gitHead": "3ac5dc679b50b56efa3b57c967cd37b2c2eba154"
|
|
128
128
|
}
|
package/store/awesIo.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Vue from 'vue'
|
|
2
|
-
import { pathOr, pick, isType } from 'rambdax'
|
|
2
|
+
import { pathOr, pick, isType, mergeDeepRight } from 'rambdax'
|
|
3
3
|
|
|
4
4
|
const castArray = (val) => (Array.isArray(val) ? val : [])
|
|
5
5
|
|
|
@@ -20,6 +20,11 @@ export const state = () => ({
|
|
|
20
20
|
|
|
21
21
|
profileUrl: null,
|
|
22
22
|
|
|
23
|
+
logo: {
|
|
24
|
+
default: { src: '' },
|
|
25
|
+
dark: { src: '' }
|
|
26
|
+
},
|
|
27
|
+
|
|
23
28
|
menus: {
|
|
24
29
|
main: [],
|
|
25
30
|
secondary: [],
|
|
@@ -83,7 +88,22 @@ export const getters = {
|
|
|
83
88
|
}
|
|
84
89
|
},
|
|
85
90
|
|
|
86
|
-
isDarkTheme: pathOr(false, 'isDarkTheme')
|
|
91
|
+
isDarkTheme: pathOr(false, 'isDarkTheme'),
|
|
92
|
+
|
|
93
|
+
logo(state, getters) {
|
|
94
|
+
return getters.isDarkTheme ? state.logo.dark : state.logo.default
|
|
95
|
+
},
|
|
96
|
+
|
|
97
|
+
logoComponent(state, getters) {
|
|
98
|
+
const logoComponent = pathOr(null, 'logo.component', state)
|
|
99
|
+
|
|
100
|
+
return logoComponent && logoComponent.is
|
|
101
|
+
? logoComponent
|
|
102
|
+
: {
|
|
103
|
+
is: 'AwLayoutLogo',
|
|
104
|
+
props: { logo: getters.logo }
|
|
105
|
+
}
|
|
106
|
+
}
|
|
87
107
|
}
|
|
88
108
|
|
|
89
109
|
export const mutations = {
|
|
@@ -127,6 +147,26 @@ export const mutations = {
|
|
|
127
147
|
|
|
128
148
|
TOGGLE_MOBILE_MENU(state, status = !state.mobileMenuOpened) {
|
|
129
149
|
state.mobileMenuOpened = Boolean(status)
|
|
150
|
+
},
|
|
151
|
+
|
|
152
|
+
SET_LOGO(state, logo) {
|
|
153
|
+
if (typeof logo === 'string') {
|
|
154
|
+
state.logo = mergeDeepRight(state.logo, {
|
|
155
|
+
default: { src: logo },
|
|
156
|
+
dark: { src: logo }
|
|
157
|
+
})
|
|
158
|
+
} else if (typeof logo === 'object' && logo !== null) {
|
|
159
|
+
const _logo = {}
|
|
160
|
+
_logo.default = pathOr(state.logo.default, 'default', logo)
|
|
161
|
+
_logo.dark = pathOr(
|
|
162
|
+
pathOr(state.logo.dark, 'default', logo),
|
|
163
|
+
'dark',
|
|
164
|
+
logo
|
|
165
|
+
)
|
|
166
|
+
_logo.component = pathOr(state.logo.component, 'component', logo)
|
|
167
|
+
|
|
168
|
+
state.logo = _logo
|
|
169
|
+
}
|
|
130
170
|
}
|
|
131
171
|
}
|
|
132
172
|
|