@dracul/customize-frontend 2.0.0 → 2.1.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/package.json CHANGED
@@ -1,11 +1,10 @@
1
1
  {
2
2
  "name": "@dracul/customize-frontend",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "vue custom logo, custom theme, custom colors, i18n configuration}",
5
5
  "main": "./src/index.js",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1",
8
- "storybook": "start-storybook -p 6006",
9
8
  "build-storybook": "build-storybook"
10
9
  },
11
10
  "keywords": [
@@ -18,56 +17,21 @@
18
17
  ],
19
18
  "author": "Cristian Incarnato",
20
19
  "license": "MIT",
21
- "gitHead": "7fd7e459f91a3faa7c9c02d758bf64b6e09f2dfc",
20
+ "gitHead": "f1279e46d2f7e2e2d4039f961f102c8841509884",
22
21
  "dependencies": {
23
- "@dracul/common-frontend": "^2.0.0",
24
- "@dracul/user-frontend": "^2.0.0"
22
+ "@dracul/common-frontend": "^2.1.0",
23
+ "@dracul/user-frontend": "^2.1.0"
25
24
  },
26
25
  "peerDependencies": {
27
- "apollo-cache-inmemory": "^1.6.6",
28
- "apollo-client": "^2.6.10",
29
- "apollo-link": "^1.2.14",
30
- "apollo-link-error": "^1.1.13",
31
- "apollo-upload-client": "^13.0.0",
32
- "symbol-observable": "^3.0.0",
33
- "vue": "^2.6.14",
26
+ "material-design-icons-iconfont": "^6.1.0",
27
+ "vue": "^2.7.15",
34
28
  "vue-i18n": "^8.18.1",
35
29
  "vue-router": "^3.5.3",
36
- "vuetify": "^2.6.4",
30
+ "vuetify": "2.7.1",
37
31
  "vuex": "^3.6.2"
38
32
  },
39
33
  "devDependencies": {
40
- "@babel/core": "^7.12.10",
41
- "@storybook/addon-actions": "^6.0.28",
42
- "@storybook/addon-essentials": "^6.0.28",
43
- "@storybook/addon-links": "^6.0.28",
44
- "@storybook/vue": "^6.0.28",
45
- "@vue/cli-plugin-babel": "^4.4.6",
46
- "@vue/cli-plugin-eslint": "^4.4.6",
47
- "@vue/cli-service": "^4.4.6",
48
- "apollo-cache-inmemory": "^1.6.6",
49
- "apollo-client": "^2.6.10",
50
- "apollo-link": "^1.2.14",
51
- "apollo-link-error": "^1.1.13",
52
- "apollo-upload-client": "^13.0.0",
53
- "babel-eslint": "^10.1.0",
54
- "babel-loader": "^8.2.2",
55
- "babel-preset-vue": "^2.0.2",
56
- "eslint": "^6.7.2",
57
- "eslint-plugin-vue": "^6.2.2",
58
- "graphql": "^15.4.0",
59
- "graphql-tag": "^2.11.0",
60
- "material-design-icons-iconfont": "^6.1.0",
61
- "mock-apollo-client": "^0.4.0",
62
- "react-is": "^17.0.1",
63
- "sass": "^1.30.0",
64
- "sass-loader": "^8.0.2",
65
- "symbol-observable": "^3.0.0",
66
- "vue": "^2.6.14",
67
- "vue-i18n": "^8.18.1",
68
- "vue-router": "^3.5.3",
69
- "vue-template-compiler": "^2.6.14",
70
- "vuetify": "^2.6.4",
71
- "vuex": "^3.6.2"
34
+ "sass": "1.32.13",
35
+ "sass-loader": "^8.0.2"
72
36
  }
73
37
  }
@@ -0,0 +1,53 @@
1
+ <template>
2
+ <v-tooltip bottom>
3
+ <template v-slot:activator="{on, attrs}">
4
+ <div v-on="on"
5
+ v-bind="attrs"
6
+ >
7
+ <v-switch
8
+ :dense="dense"
9
+ v-model="dark"
10
+ :color="color"
11
+ hide-details
12
+ :prepend-icon="showIcon ? icon : null"
13
+ :label="showLabel ? getLabel : null"
14
+ ></v-switch>
15
+
16
+ </div>
17
+ </template>
18
+ <span>{{ getLabel }}</span>
19
+ </v-tooltip>
20
+
21
+ </template>
22
+
23
+ <script>
24
+ export default {
25
+ name: "DarkMode",
26
+ props: {
27
+ label: {type: String, default: 'customization.darkMode'},
28
+ color: {type: String, default: 'green'},
29
+ dense: {type: Boolean, default: true},
30
+ icon: {type: String, default: 'dark_mode'},
31
+ showIcon: {type: Boolean, default: true},
32
+ showLabel: {type: Boolean, default: false},
33
+ },
34
+ computed: {
35
+ dark: {
36
+ get() {
37
+ return this.$vuetify.theme.dark
38
+ },
39
+ set(val) {
40
+ this.$store.commit('darkMode', val)
41
+ this.$vuetify.theme.dark = val
42
+ }
43
+ },
44
+ getLabel() {
45
+ return this.$te(this.label) ? this.$t(this.label) : this.label
46
+ }
47
+ }
48
+ }
49
+ </script>
50
+
51
+ <style scoped>
52
+
53
+ </style>
@@ -0,0 +1,4 @@
1
+ import DarkMode from "./DarkMode";
2
+
3
+ export {DarkMode}
4
+ export default DarkMode
@@ -1,20 +1,23 @@
1
1
  <template>
2
2
 
3
- <router-link to="/">
4
- <v-toolbar-title class="onPrimary--text ml-2">
5
- <b>{{getLogo.title}}</b>
6
- </v-toolbar-title>
7
- </router-link>
3
+ <router-link to="/" class="text-decoration-none">
4
+ <v-toolbar-title class="ml-2" :class="color">
5
+ <b>{{ getLogo.title }}</b>
6
+ </v-toolbar-title>
7
+ </router-link>
8
8
 
9
9
  </template>
10
10
 
11
11
  <script>
12
- import {mapGetters} from 'vuex'
12
+ import {mapGetters} from 'vuex'
13
13
 
14
- export default {
15
- name: "TitleToolbar",
16
- computed: {
17
- ...mapGetters(['getLogo'])
18
- }
19
- }
20
- </script>
14
+ export default {
15
+ name: "TitleToolbar",
16
+ props: {
17
+ color: {type: String, default: 'onAppBar--text'}
18
+ },
19
+ computed: {
20
+ ...mapGetters(['getLogo'])
21
+ }
22
+ }
23
+ </script>
@@ -4,13 +4,21 @@ const messages = {
4
4
  title: 'Customization',
5
5
  preview: 'Preview',
6
6
  applyButton: 'Apply',
7
+ darkMode: 'Dark mode',
7
8
  colors: {
8
9
  title: 'Colors',
9
- subtitle: 'Platform color settings',
10
+ lightTitle: 'Light Theme Colors',
11
+ lightSubtitle: 'Platform light theme color settings',
12
+ darkTitle: 'Dark Theme Colors',
13
+ darkSubtitle: 'Platform dark theme color settings',
10
14
  primary: 'Primary',
11
15
  onPrimary: 'On Primary',
12
16
  secondary: 'Secondary',
13
17
  onSecondary: 'On Secondary',
18
+ background: 'Background',
19
+ appBar: 'AppBar',
20
+ onAppBar: 'On AppBar',
21
+
14
22
 
15
23
  },
16
24
  lang: {
@@ -53,13 +61,20 @@ const messages = {
53
61
  title: 'Personalización',
54
62
  preview: 'Vista previa',
55
63
  applyButton: 'Aplicar',
64
+ darkMode: 'Modo oscuro',
56
65
  colors: {
57
66
  title: 'Colores',
58
- subtitle: 'Configuracion de los colores de la plataforma',
67
+ lightTitle: 'Tema Claro',
68
+ lightSubtitle: 'Configuración de colores en tema claro',
69
+ darkTitle: 'Tema Oscuro',
70
+ darkSubtitle: 'Configuración de colores en tema oscuro',
59
71
  primary: 'Primario',
60
72
  onPrimary: 'En Primario',
61
73
  secondary: 'Secundario',
62
74
  onSecondary: 'En Secundario',
75
+ background: 'Fondo',
76
+ appBar: 'AppBar',
77
+ onAppBar: 'En AppBar',
63
78
  },
64
79
  lang: {
65
80
  title: 'Idioma',
@@ -100,13 +115,20 @@ const messages = {
100
115
  title: 'Costumização',
101
116
  preview: 'Vista prévia',
102
117
  applyButton: 'Aplique',
118
+ darkMode: 'Dark mode',
103
119
  colors: {
104
- title: 'Cores',
105
- subtitle: 'Configurações de cores da plataforma',
120
+ title: 'Colors',
121
+ lightTitle: 'Luz do tema',
122
+ lightSubtitle: 'Configurações de cores luz do tema',
123
+ darkTitle: 'Tema Escuro',
124
+ darkSubtitle: 'Configuración de cores tema escuro',
106
125
  primary: 'Primário',
107
126
  onPrimary: 'No primário',
108
127
  secondary: 'Secundário',
109
128
  onSecondary: 'No secundário',
129
+ background: 'Fondo',
130
+ appBar: 'AppBar',
131
+ onAppBar: 'On AppBar',
110
132
  },
111
133
  lang: {
112
134
  title: 'Linguagem',
package/src/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import CustomConfigPage from "./pages/CustomConfigPage/CustomConfigPage";
2
2
  import LogoToolbar from "./components/LogoToolbar";
3
+ import DarkMode from "./components/DarkMode";
3
4
  import TitleToolbar from "./components/TitleToolbar";
4
5
  import LogoPreview from "./components/LogoPreview";
5
6
  import LanguageCombobox from "./components/LanguageCombobox";
@@ -13,6 +14,7 @@ export {
13
14
  CustomConfigPage,
14
15
  //Components
15
16
  LogoToolbar,
17
+ DarkMode,
16
18
  TitleToolbar,
17
19
  LogoPreview,
18
20
  LanguageCombobox,
@@ -0,0 +1,32 @@
1
+ <template>
2
+ <v-card class="pa-3" :style="{backgroundColor: background}">
3
+ <v-card-title class="mb-3 justify-center" :style="{background: appBar, color: onAppBar}">
4
+ <div v-t="'customization.preview'"></div>
5
+ </v-card-title>
6
+ <v-card-text class="text-center px-3">
7
+ <v-row>
8
+ <v-col cols="6" :style="{backgroundColor: primary, color: onPrimary}">
9
+ {{ $t('customization.colors.primary') }}
10
+ </v-col>
11
+ <v-col cols="6" :style="{backgroundColor: secondary, color: onSecondary}">
12
+ {{ $t('customization.colors.secondary') }}
13
+ </v-col>
14
+ </v-row>
15
+
16
+ </v-card-text>
17
+ </v-card>
18
+ </template>
19
+ <script>
20
+ export default {
21
+ name: 'colors-preview',
22
+ props: {
23
+ background: {type: String},
24
+ appBar: {type: String},
25
+ onAppBar: {type: String},
26
+ primary: {type: String},
27
+ onPrimary: {type: String},
28
+ secondary: {type: String},
29
+ onSecondary: {type: String},
30
+ }
31
+ }
32
+ </script>
@@ -1,124 +1,249 @@
1
1
  <template>
2
- <v-card outlined>
3
- <v-card-title>
4
- <div v-t="'customization.colors.title'"></div>
5
- <br>
6
- </v-card-title>
7
- <v-card-subtitle v-t="'customization.colors.subtitle'">
8
- </v-card-subtitle>
9
- <v-card-text class="pb-0 ">
2
+ <v-container fluid>
3
+ <v-card v-if="formColors.lightTheme" outlined>
4
+ <v-card-title>
5
+ <div v-t="'customization.colors.lightTitle'"></div>
6
+ <br>
7
+ </v-card-title>
8
+ <v-card-subtitle v-t="'customization.colors.lightSubtitle'">
9
+ </v-card-subtitle>
10
+ <v-card-text class="pb-0 ">
11
+
12
+ <v-row>
13
+ <v-col cols="12" sm="7">
14
+
15
+
16
+ <v-form ref="colorsForm" autocomplete="off" @submit.prevent="$emit('save')">
17
+
18
+ <v-row>
19
+ <v-col cols="12" sm="4" md="4" class="pb-0">
20
+ <color-input v-model="formColors.lightTheme.background"
21
+ :label="$t('customization.colors.background')"
22
+ color="secondary"
23
+ :rules="[rules.required]"
24
+ />
25
+ </v-col>
26
+
27
+ <v-col cols="12" sm="4" md="4" class="pb-0">
28
+ <color-input v-model="formColors.lightTheme.appBar"
29
+ :label="$t('customization.colors.appBar')"
30
+ color="secondary"
31
+ :rules="[rules.required]"
32
+ />
33
+ </v-col>
34
+
35
+ <v-col cols="12" sm="4" md="4" class="pb-0">
36
+ <color-input v-model="formColors.lightTheme.onAppBar"
37
+ :label="$t('customization.colors.onAppBar')"
38
+ color="secondary"
39
+ :rules="[rules.required]"
40
+ />
41
+ </v-col>
42
+
43
+ <v-col cols="12" sm="4" md="3" class="pb-0">
44
+ <color-input v-model="formColors.lightTheme.primary"
45
+ :label="$t('customization.colors.primary')"
46
+ color="secondary"
47
+ :rules="[rules.required]"
48
+ />
49
+ </v-col>
50
+
51
+ <v-col cols="12" sm="4" md="3">
52
+ <color-input v-model="formColors.lightTheme.onPrimary"
53
+ :label="$t('customization.colors.onPrimary')"
54
+ color="secondary"
55
+ :rules="[rules.required]"
56
+ />
57
+ </v-col>
58
+
59
+ <v-col cols="12" sm="4" md="3">
60
+ <color-input v-model="formColors.lightTheme.secondary"
61
+ :label="$t('customization.colors.secondary')"
62
+ color="secondary"
63
+ :rules="[rules.required]"
64
+ />
65
+ </v-col>
66
+
67
+ <v-col cols="12" sm="4" md="3">
68
+ <color-input v-model="formColors.lightTheme.onSecondary"
69
+ :label="$t('customization.colors.onSecondary')"
70
+ color="secondary"
71
+ :rules="[rules.required]"
72
+ />
73
+ </v-col>
74
+
75
+ </v-row>
76
+ </v-form>
77
+ </v-col>
78
+
79
+ <v-col cols="12" sm="5">
80
+ <colors-preview
81
+ :background="formColors.lightTheme.background"
82
+ :app-bar="formColors.lightTheme.appBar"
83
+ :on-app-bar="formColors.lightTheme.onAppBar"
84
+ :primary="formColors.lightTheme.primary"
85
+ :on-primary="formColors.lightTheme.onPrimary"
86
+ :secondary="formColors.lightTheme.secondary"
87
+ :on-secondary="formColors.lightTheme.onSecondary"
88
+
89
+ />
90
+ </v-col>
91
+
92
+ </v-row>
93
+
94
+ </v-card-text>
95
+
96
+
97
+ </v-card>
98
+
99
+
100
+ <v-card v-if="formColors.darkTheme" outlined class="mt-3">
101
+ <v-card-title>
102
+ <div v-t="'customization.colors.darkTitle'"></div>
103
+ <br>
104
+ </v-card-title>
105
+ <v-card-subtitle v-t="'customization.colors.darkSubtitle'">
106
+ </v-card-subtitle>
107
+ <v-card-text class="pb-0 ">
108
+ <v-row>
109
+ <v-col cols="12" sm="7">
10
110
  <v-form ref="colorsForm" autocomplete="off" @submit.prevent="$emit('save')">
11
111
 
12
- <v-row>
13
- <v-col cols="12" sm="6" md="3" class="pb-0">
14
- <color-input v-model="formColors.primary"
15
- :label="$t('customization.colors.primary')"
16
- color="secondary"
17
- :rules="[rules.required]"
18
- />
19
- </v-col>
20
-
21
- <v-col cols="12" sm="6" md="3">
22
- <color-input v-model="formColors.onPrimary"
23
- :label="$t('customization.colors.onPrimary')"
24
- color="secondary"
25
- :rules="[rules.required]"
26
- />
27
- </v-col>
28
-
29
- <v-col cols="12" sm="6" md="3">
30
- <color-input v-model="formColors.secondary"
31
- :label="$t('customization.colors.secondary')"
32
- color="secondary"
33
- :rules="[rules.required]"
34
- />
35
- </v-col>
36
-
37
- <v-col cols="12" sm="6" md="3">
38
- <color-input v-model="formColors.onSecondary"
39
- :label="$t('customization.colors.onSecondary')"
40
- color="secondary"
41
- :rules="[rules.required]"
42
- />
43
- </v-col>
44
-
45
- </v-row>
46
- </v-form>
112
+ <v-row>
113
+ <v-col cols="12" sm="4" md="4" class="pb-0">
114
+ <color-input v-model="formColors.darkTheme.background"
115
+ :label="$t('customization.colors.background')"
116
+ color="secondary"
117
+ :rules="[rules.required]"
118
+ />
119
+ </v-col>
47
120
 
48
- </v-card-text>
49
-
50
- <v-card-text class="pt-0 ">
51
- <v-row justify="center" align-content="center">
52
- <v-col cols="12" md="4" lg="4">
53
- <v-card>
54
- <v-card-title>
55
- <div v-t="'customization.preview'"></div>
56
- </v-card-title>
57
- <v-card-text class="text-center">
58
- <v-row>
59
- <v-col cols="6" :style="getStyleColor('primary','onPrimary')">
60
- {{$t('customization.colors.primary')}}
61
- </v-col>
62
- <v-col cols="6" :style="getStyleColor('secondary','onSecondary')">
63
- {{$t('customization.colors.secondary')}}
64
- </v-col>
65
- </v-row>
66
-
67
- </v-card-text>
68
- </v-card>
121
+ <v-col cols="12" sm="4" md="4" class="pb-0">
122
+ <color-input v-model="formColors.darkTheme.appBar"
123
+ :label="$t('customization.colors.appBar')"
124
+ color="secondary"
125
+ :rules="[rules.required]"
126
+ />
69
127
  </v-col>
70
- </v-row>
71
- </v-card-text>
72
128
 
73
- <v-divider></v-divider>
129
+ <v-col cols="12" sm="4" md="4" class="pb-0">
130
+ <color-input v-model="formColors.darkTheme.onAppBar"
131
+ :label="$t('customization.colors.onAppBar')"
132
+ color="secondary"
133
+ :rules="[rules.required]"
134
+ />
135
+ </v-col>
136
+
137
+ <v-col cols="12" sm="4" md="3" class="pb-0">
138
+ <color-input v-model="formColors.darkTheme.primary"
139
+ :label="$t('customization.colors.primary')"
140
+ color="secondary"
141
+ :rules="[rules.required]"
142
+ />
143
+ </v-col>
144
+
145
+ <v-col cols="12" sm="4" md="3">
146
+ <color-input v-model="formColors.darkTheme.onPrimary"
147
+ :label="$t('customization.colors.onPrimary')"
148
+ color="secondary"
149
+ :rules="[rules.required]"
150
+ />
151
+ </v-col>
152
+
153
+ <v-col cols="12" sm="4" md="3">
154
+ <color-input v-model="formColors.darkTheme.secondary"
155
+ :label="$t('customization.colors.secondary')"
156
+ color="secondary"
157
+ :rules="[rules.required]"
158
+ />
159
+ </v-col>
160
+
161
+ <v-col cols="12" sm="4" md="3">
162
+ <color-input v-model="formColors.darkTheme.onSecondary"
163
+ :label="$t('customization.colors.onSecondary')"
164
+ color="secondary"
165
+ :rules="[rules.required]"
166
+ />
167
+ </v-col>
168
+
169
+ </v-row>
170
+ </v-form>
171
+ </v-col>
172
+
173
+
174
+ <v-col cols="12" sm="5">
175
+ <colors-preview
176
+ :background="formColors.darkTheme.background"
177
+ :app-bar="formColors.darkTheme.appBar"
178
+ :on-app-bar="formColors.darkTheme.onAppBar"
179
+ :primary="formColors.darkTheme.primary"
180
+ :on-primary="formColors.darkTheme.onPrimary"
181
+ :secondary="formColors.darkTheme.secondary"
182
+ :on-secondary="formColors.darkTheme.onSecondary"
183
+
184
+ />
185
+ </v-col>
186
+
187
+ </v-row>
188
+
189
+
190
+
191
+ </v-card-text>
192
+
74
193
 
75
- <v-card-actions>
76
- <v-btn @click="saveColors" text color="blue darken-4" v-t="'customization.applyButton'"></v-btn>
77
- </v-card-actions>
78
194
 
79
195
  </v-card>
196
+
197
+ <v-card outlined class="mt-4">
198
+ <v-card-actions>
199
+ <v-spacer></v-spacer>
200
+ <v-btn @click="saveColors" large color="primary onPrimary--text" v-t="'customization.applyButton'"></v-btn>
201
+ </v-card-actions>
202
+ </v-card>
203
+ </v-container>
80
204
  </template>
81
205
  <script>
82
- import ColorInput from "./ColorInput"
83
- import CustomizationProvider from "../../../../providers/CustomizationProvider";
84
- import {ClientError} from "@dracul/user-frontend";
85
- import {mapMutations} from "vuex";
86
-
87
- export default {
88
- name: 'customization-colors',
89
- components: {ColorInput},
90
- props: {
91
- formColors: {},
92
- },
93
- methods: {
94
- ...mapMutations([
95
- 'setColors'
96
- ]),
97
- saveColors() {
98
- if (this.$refs.colorsForm.validate()) {
99
- CustomizationProvider.updateColors(this.formColors).then(r => {
100
- this.setColors(r.data.colorsUpdate)
101
- }
102
- ).catch(error => {
103
- let clientError = new ClientError(error)
104
- this.inputErrors = clientError.inputErrors
105
- this.errorMessage = clientError.showMessage
106
- })
107
- }
108
- },
109
- },
110
- computed: {
111
- getStyleColor() {
112
- return (color, onColor) => "background-color: " + this.formColors[color] + "; color: " + this.formColors[onColor]
113
- },
114
- },
115
- data() {
116
- return {
117
- inputErrors: [],
118
- rules: {
119
- required: value => !!value || 'Requerido'
120
- },
206
+ import ColorInput from "./ColorInput"
207
+ import CustomizationProvider from "../../../../providers/CustomizationProvider";
208
+ import {ClientError} from "@dracul/user-frontend";
209
+ import {mapMutations} from "vuex";
210
+ import ColorsPreview from "./ColorsPreview";
211
+
212
+ export default {
213
+ name: 'customization-colors',
214
+ components: {ColorsPreview, ColorInput},
215
+ props: {
216
+ formColors: {},
217
+ },
218
+ methods: {
219
+ ...mapMutations([
220
+ 'setColors'
221
+ ]),
222
+ saveColors() {
223
+ if (this.$refs.colorsForm.validate()) {
224
+ CustomizationProvider.updateColors(this.formColors).then(r => {
225
+ this.setColors(r.data.colorsUpdate)
121
226
  }
122
- }
227
+ ).catch(error => {
228
+ let clientError = new ClientError(error)
229
+ this.inputErrors = clientError.inputErrors
230
+ this.errorMessage = clientError.showMessage
231
+ })
232
+ }
233
+ },
234
+ },
235
+ computed: {
236
+ getStyleColor() {
237
+ return (theme, color, onColor) => "background-color: " + this.formColors[theme][color] + "; color: " + this.formColors[theme][onColor]
238
+ },
239
+ },
240
+ data() {
241
+ return {
242
+ inputErrors: [],
243
+ rules: {
244
+ required: value => !!value || 'Requerido'
245
+ },
123
246
  }
247
+ }
248
+ }
124
249
  </script>