@mapomodule/uikit 1.0.0-alpha.24 → 1.0.0-alpha.27
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 +50 -0
- package/components/ConfirmDialog.vue +1 -0
- package/components/Detail/Detail.vue +7 -1
- package/components/Form/FormField.vue +3 -0
- package/components/Form/defaults.js +6 -1
- package/components/Form/fields/ColorField.vue +76 -0
- package/components/Form/fields/EnhancedMediaField.vue +224 -0
- package/components/Form/fields/FksField.vue +1 -1
- package/components/Form/fields/MediaField.vue +7 -1
- package/components/LogoutButton.vue +0 -1
- package/components/MediaManager/MediaPreview.vue +1 -0
- package/components/MediaManager/MediaUploader.vue +1 -1
- package/defaults/i18n.js +37 -0
- package/defaults/vuetify.js +33 -0
- package/module.js +3 -9
- package/package.json +2 -2
- package/defaults.js +0 -75
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,56 @@
|
|
|
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
|
+
# [1.0.0-alpha.27](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.26...v1.0.0-alpha.27) (2022-08-25)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **colorfield:** return string in colorfield ([3acbd5c](https://github.com/lotrekagency/mapo/commit/3acbd5caa6555835c168718303f1ca555e8efc75))
|
|
12
|
+
* **detail:** added force option to languages ([8ed4b69](https://github.com/lotrekagency/mapo/commit/8ed4b69f746b136755cbda17cdab176632869cdf))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* **fields:** added color field ([ead7448](https://github.com/lotrekagency/mapo/commit/ead744861be2c9c24ea2911e68c8b4d1259cab15))
|
|
18
|
+
* **mediapreview:** added title tag to medias ([d063162](https://github.com/lotrekagency/mapo/commit/d063162036a4294fbd3c5ed347dfde78061a1f33))
|
|
19
|
+
* implemented enhanced media compomentent ([fe336e1](https://github.com/lotrekagency/mapo/commit/fe336e170d42a67562c8e4abfa387b806e7c7a6a))
|
|
20
|
+
* implemented media preview through MediaPreview component ([575c285](https://github.com/lotrekagency/mapo/commit/575c2853eb774ca4c635ce099302a429cc479be5))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
# [1.0.0-alpha.26](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.25...v1.0.0-alpha.26) (2022-08-11)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Bug Fixes
|
|
30
|
+
|
|
31
|
+
* correct langDir path on i18n defaults ([100239f](https://github.com/lotrekagency/mapo/commit/100239fb11b268baa67e6549a0a68e98348e8301))
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
# [1.0.0-alpha.25](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.24...v1.0.0-alpha.25) (2022-08-02)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
### Bug Fixes
|
|
41
|
+
|
|
42
|
+
* fix detail field language list ([1d290e6](https://github.com/lotrekagency/mapo/commit/1d290e69c180fe31c97dfb45e2c1afcdcb569f1d))
|
|
43
|
+
* fix mediauploader typo ([67e7e4e](https://github.com/lotrekagency/mapo/commit/67e7e4e8e2214580c99331d7c21eef551edf08cc))
|
|
44
|
+
* fixed bug on preview image ([f2878ee](https://github.com/lotrekagency/mapo/commit/f2878ee5d60bc74cab49ee0c055ace22f7d37076))
|
|
45
|
+
* removed some accidental trash from previous commit ([4a85da4](https://github.com/lotrekagency/mapo/commit/4a85da419bddaadfe6a08afa5f71fe5e76e346f7))
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
### Features
|
|
49
|
+
|
|
50
|
+
* **i18n:** move i18n config to mapo defaults to enable mixed merges of user and mapo options. ([2190aa9](https://github.com/lotrekagency/mapo/commit/2190aa9ebf106d811a64e27502d3a45b75a3e9af))
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
6
56
|
# [1.0.0-alpha.24](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.23...v1.0.0-alpha.24) (2022-07-22)
|
|
7
57
|
|
|
8
58
|
|
|
@@ -186,6 +186,11 @@ export default {
|
|
|
186
186
|
type: Array,
|
|
187
187
|
default: () => []
|
|
188
188
|
},
|
|
189
|
+
// Forces use of languages passed as prop, instead of those loaded with model
|
|
190
|
+
forceLanguages: {
|
|
191
|
+
type: Boolean,
|
|
192
|
+
default: false
|
|
193
|
+
},
|
|
189
194
|
// The url of the endpoint to which the payload is to be sent. From this url a complete crud (See [this.$mapo.$api.crud](/core/#$api.crud)) will be created.
|
|
190
195
|
endpoint: {
|
|
191
196
|
type: String,
|
|
@@ -320,7 +325,7 @@ export default {
|
|
|
320
325
|
return !Object.keys(this.model).length;
|
|
321
326
|
},
|
|
322
327
|
langs() {
|
|
323
|
-
return this.modelLanguages.length ? this.modelLanguages : this.languages;
|
|
328
|
+
return (!this.forceLanguages && (this.modelLanguages || []).length) ? this.modelLanguages : this.languages;
|
|
324
329
|
},
|
|
325
330
|
slotBindings() {
|
|
326
331
|
return {
|
|
@@ -410,6 +415,7 @@ Here the list of the FieldConfiguration type association.
|
|
|
410
415
|
- `file` ==> [file-field](/components/Form/fields/FileField/),
|
|
411
416
|
- `editor` ==> [wyg-editor](/components/Form/fields/wygEditor/wygEditor/),
|
|
412
417
|
- `media` ==> [media-field](/components/Form/fields/MediaField/),
|
|
418
|
+
- `enhancedMedia` ==> [enhanced-media-field](/components/Form/fields/EnhancedMediaField/),
|
|
413
419
|
- `mediaList` ==> [media-m2m-field](/components/Form/fields/MediaM2mField/)
|
|
414
420
|
- `m2m` or `fks` ==> [fks-field](/components/Form/fields/FksField/),
|
|
415
421
|
- `repeater` ==> [repeater](/components/Form/fields/Repeater/),
|
|
@@ -26,6 +26,8 @@ import DateField from "@mapomodule/uikit/components/Form/fields/DateField.vue";
|
|
|
26
26
|
import FksField from "@mapomodule/uikit/components/Form/fields/FksField.vue";
|
|
27
27
|
import MediaM2mField from "@mapomodule/uikit/components/Form/fields/MediaM2mField.vue";
|
|
28
28
|
import MediaField from "@mapomodule/uikit/components/Form/fields/MediaField.vue";
|
|
29
|
+
import EnhancedMediaField from "@mapomodule/uikit/components/Form/fields/EnhancedMediaField.vue";
|
|
30
|
+
|
|
29
31
|
import SeoPreview from "@mapomodule/uikit/components/Form/fields/SeoPreview.vue";
|
|
30
32
|
import FileField from "@mapomodule/uikit/components/Form/fields/FileField.vue";
|
|
31
33
|
import Repeater from "@mapomodule/uikit/components/Form/fields/Repeater.vue"
|
|
@@ -46,6 +48,7 @@ export default {
|
|
|
46
48
|
FksField,
|
|
47
49
|
MediaM2mField,
|
|
48
50
|
MediaField,
|
|
51
|
+
EnhancedMediaField,
|
|
49
52
|
SeoPreview,
|
|
50
53
|
FileField,
|
|
51
54
|
Repeater,
|
|
@@ -8,11 +8,13 @@ const mapping = {
|
|
|
8
8
|
file: "FileField",
|
|
9
9
|
editor: "wygEditor",
|
|
10
10
|
media: "MediaField",
|
|
11
|
+
enhancedMedia: "EnhancedMediaField",
|
|
11
12
|
fks: "FksField",
|
|
12
13
|
m2m: "FksField",
|
|
13
14
|
mediaList: "MediaM2mField",
|
|
14
15
|
seoPreview: "SeoPreview",
|
|
15
16
|
repeater: "Repeater",
|
|
17
|
+
color: "ColorField"
|
|
16
18
|
}
|
|
17
19
|
|
|
18
20
|
const props = {
|
|
@@ -23,6 +25,9 @@ const props = {
|
|
|
23
25
|
MediaField: {
|
|
24
26
|
outlined: false
|
|
25
27
|
},
|
|
28
|
+
EnhancedMediaField: {
|
|
29
|
+
outlined: false
|
|
30
|
+
},
|
|
26
31
|
vSwitch: {
|
|
27
32
|
inset: true,
|
|
28
33
|
ripple: false
|
|
@@ -55,4 +60,4 @@ const accessor = {
|
|
|
55
60
|
}
|
|
56
61
|
export default {
|
|
57
62
|
mapping, props, accessor
|
|
58
|
-
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<v-menu
|
|
4
|
+
v-model="menu"
|
|
5
|
+
:close-on-content-click="false"
|
|
6
|
+
transition="scale-transition"
|
|
7
|
+
offset-y
|
|
8
|
+
min-width="auto"
|
|
9
|
+
>
|
|
10
|
+
<template v-slot:activator="{ on, attrs }">
|
|
11
|
+
<v-text-field
|
|
12
|
+
v-model="model"
|
|
13
|
+
readonly
|
|
14
|
+
v-bind="{ ...$attrs, ...attrs }"
|
|
15
|
+
v-on="readonly ? undefined : on"
|
|
16
|
+
class="rounded-0"
|
|
17
|
+
>
|
|
18
|
+
<template v-slot:prepend-inner>
|
|
19
|
+
<div class="color-picker-inner-icon" :style="`background-color: ${model}`"></div>
|
|
20
|
+
</template>
|
|
21
|
+
</v-text-field>
|
|
22
|
+
</template>
|
|
23
|
+
<v-card>
|
|
24
|
+
<v-color-picker
|
|
25
|
+
v-model="model"
|
|
26
|
+
mode="hexa"
|
|
27
|
+
hide-mode-switch
|
|
28
|
+
v-bind="$attrs"
|
|
29
|
+
v-on="$listeners"
|
|
30
|
+
></v-color-picker>
|
|
31
|
+
</v-card>
|
|
32
|
+
</v-menu>
|
|
33
|
+
</div>
|
|
34
|
+
</template>
|
|
35
|
+
|
|
36
|
+
<style scoped>
|
|
37
|
+
.color-picker-inner-icon {
|
|
38
|
+
width: 20px;
|
|
39
|
+
height: 20px;
|
|
40
|
+
border-radius: 20px;
|
|
41
|
+
}
|
|
42
|
+
</style>
|
|
43
|
+
|
|
44
|
+
<script>
|
|
45
|
+
/**
|
|
46
|
+
* This component wraps vuetify's color picker as a Mapo field.
|
|
47
|
+
*/
|
|
48
|
+
export default {
|
|
49
|
+
name: "ColorField",
|
|
50
|
+
data() {
|
|
51
|
+
return {
|
|
52
|
+
model: this.value || "",
|
|
53
|
+
menu: null,
|
|
54
|
+
};
|
|
55
|
+
},
|
|
56
|
+
props: {
|
|
57
|
+
// V-model property. Color must be hex codified.
|
|
58
|
+
value: {
|
|
59
|
+
type: String,
|
|
60
|
+
},
|
|
61
|
+
// This set the component status to readonly, stopping the user interaction.
|
|
62
|
+
readonly: {
|
|
63
|
+
type: Boolean,
|
|
64
|
+
default: false,
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
watch: {
|
|
68
|
+
value(val) {
|
|
69
|
+
this.model = val || "";
|
|
70
|
+
},
|
|
71
|
+
model(val) {
|
|
72
|
+
this.$emit("input", val);
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
</script>
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<v-text-field
|
|
4
|
+
v-if="title"
|
|
5
|
+
v-model="title"
|
|
6
|
+
class="mb-n8 pb-0"
|
|
7
|
+
solo
|
|
8
|
+
readonly
|
|
9
|
+
v-bind="$attrs"
|
|
10
|
+
></v-text-field>
|
|
11
|
+
|
|
12
|
+
<!-- If the media is not avaible, it shows a btn to add new media -->
|
|
13
|
+
<v-card
|
|
14
|
+
class="rounded-0"
|
|
15
|
+
v-bind="{
|
|
16
|
+
height,
|
|
17
|
+
width,
|
|
18
|
+
maxWidth,
|
|
19
|
+
maxHeight,
|
|
20
|
+
minWidth,
|
|
21
|
+
minHeight,
|
|
22
|
+
...$attrs,
|
|
23
|
+
}"
|
|
24
|
+
>
|
|
25
|
+
<MediaPreview
|
|
26
|
+
class="media-preview"
|
|
27
|
+
:key="childKey"
|
|
28
|
+
v-if="mediaExists"
|
|
29
|
+
:media="internalValue"
|
|
30
|
+
:video-preview="internalValue.is_image ? false : true"
|
|
31
|
+
/>
|
|
32
|
+
|
|
33
|
+
<v-card-title>{{ label }}</v-card-title>
|
|
34
|
+
<v-card-text v-show="internalValue">
|
|
35
|
+
<h4>{{ $t("mapo.fileName") }}:</h4>
|
|
36
|
+
{{ fileName }}
|
|
37
|
+
<h4>{{ $t("mapo.created") }}:</h4>
|
|
38
|
+
{{ fileInfo.created }}
|
|
39
|
+
</v-card-text>
|
|
40
|
+
<v-card-actions>
|
|
41
|
+
<template v-if="!internalValue && !rmAddBtn">
|
|
42
|
+
<v-btn
|
|
43
|
+
tile
|
|
44
|
+
:disabled="readonly"
|
|
45
|
+
@click="editing = true"
|
|
46
|
+
block
|
|
47
|
+
:min-height="minHeight"
|
|
48
|
+
>
|
|
49
|
+
<v-icon size="80"> mdi-plus-circle-outline </v-icon>
|
|
50
|
+
</v-btn>
|
|
51
|
+
</template>
|
|
52
|
+
<template v-else>
|
|
53
|
+
<v-row >
|
|
54
|
+
<v-col align="center">
|
|
55
|
+
<v-btn
|
|
56
|
+
:disabled="readonly"
|
|
57
|
+
@click="editing = true"
|
|
58
|
+
block
|
|
59
|
+
>
|
|
60
|
+
<v-icon>mdi-pencil</v-icon>
|
|
61
|
+
</v-btn>
|
|
62
|
+
</v-col>
|
|
63
|
+
<v-col align="center">
|
|
64
|
+
<v-btn
|
|
65
|
+
:disabled="readonly"
|
|
66
|
+
@click="confirmDelete"
|
|
67
|
+
color="error"
|
|
68
|
+
block
|
|
69
|
+
>
|
|
70
|
+
<v-icon>mdi-delete</v-icon>
|
|
71
|
+
</v-btn>
|
|
72
|
+
</v-col>
|
|
73
|
+
</v-row>
|
|
74
|
+
</template>
|
|
75
|
+
</v-card-actions>
|
|
76
|
+
</v-card>
|
|
77
|
+
<!-- Select media dialog -->
|
|
78
|
+
<media-manager-dialog
|
|
79
|
+
v-model="editing"
|
|
80
|
+
select="single"
|
|
81
|
+
v-on:selectionChange="update"
|
|
82
|
+
v-bind="$attrs"
|
|
83
|
+
>
|
|
84
|
+
</media-manager-dialog>
|
|
85
|
+
|
|
86
|
+
<v-messages v-model="errorMessages" color="error" class="mt-2" />
|
|
87
|
+
</div>
|
|
88
|
+
</template>
|
|
89
|
+
|
|
90
|
+
<style scoped>
|
|
91
|
+
.media-preview {
|
|
92
|
+
cursor: pointer;
|
|
93
|
+
}
|
|
94
|
+
</style>
|
|
95
|
+
|
|
96
|
+
<script>
|
|
97
|
+
export default {
|
|
98
|
+
name: "EnhancedMediaField",
|
|
99
|
+
data() {
|
|
100
|
+
return {
|
|
101
|
+
internalValue: null,
|
|
102
|
+
editing: false,
|
|
103
|
+
childKey: 0,
|
|
104
|
+
};
|
|
105
|
+
},
|
|
106
|
+
|
|
107
|
+
props: {
|
|
108
|
+
value: Object,
|
|
109
|
+
label: String,
|
|
110
|
+
title: {
|
|
111
|
+
type: String,
|
|
112
|
+
default: () => "",
|
|
113
|
+
},
|
|
114
|
+
errorMessages: {
|
|
115
|
+
type: String | Array,
|
|
116
|
+
default: () => [],
|
|
117
|
+
},
|
|
118
|
+
rmAddBtn: {
|
|
119
|
+
type: Boolean,
|
|
120
|
+
default: false,
|
|
121
|
+
},
|
|
122
|
+
//image reflections
|
|
123
|
+
aspectRatio: {
|
|
124
|
+
type: String | Number,
|
|
125
|
+
default: undefined,
|
|
126
|
+
},
|
|
127
|
+
contain: {
|
|
128
|
+
type: Boolean,
|
|
129
|
+
default: false,
|
|
130
|
+
},
|
|
131
|
+
height: {
|
|
132
|
+
type: String | Number,
|
|
133
|
+
default: "100%",
|
|
134
|
+
},
|
|
135
|
+
width: {
|
|
136
|
+
type: String | Number,
|
|
137
|
+
default: "100%",
|
|
138
|
+
},
|
|
139
|
+
maxWidth: {
|
|
140
|
+
type: String | Number,
|
|
141
|
+
default: undefined,
|
|
142
|
+
},
|
|
143
|
+
maxHeight: {
|
|
144
|
+
type: String | Number,
|
|
145
|
+
default: undefined,
|
|
146
|
+
},
|
|
147
|
+
minWidth: {
|
|
148
|
+
type: String | Number,
|
|
149
|
+
default: undefined,
|
|
150
|
+
},
|
|
151
|
+
minHeight: {
|
|
152
|
+
type: String | Number,
|
|
153
|
+
default: 300,
|
|
154
|
+
},
|
|
155
|
+
// This set the component status to readonly, stopping the user interaction.
|
|
156
|
+
readonly: {
|
|
157
|
+
type: Boolean,
|
|
158
|
+
default: false,
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
|
|
162
|
+
computed: {
|
|
163
|
+
mediaExists() {
|
|
164
|
+
return !!this.internalValue?.file;
|
|
165
|
+
},
|
|
166
|
+
fileInfo() {
|
|
167
|
+
return {
|
|
168
|
+
title: this.internalValue?.title,
|
|
169
|
+
created: new Date(this.internalValue?.created).toLocaleDateString(
|
|
170
|
+
this.internalValue?.language_code
|
|
171
|
+
),
|
|
172
|
+
};
|
|
173
|
+
},
|
|
174
|
+
fileName() {
|
|
175
|
+
return (
|
|
176
|
+
this.internalValue &&
|
|
177
|
+
this.internalValue.file &&
|
|
178
|
+
this.internalValue.file.split("/").pop()
|
|
179
|
+
);
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
|
|
183
|
+
methods: {
|
|
184
|
+
update(val) {
|
|
185
|
+
this.updateChild();
|
|
186
|
+
this.internalValue = val;
|
|
187
|
+
},
|
|
188
|
+
confirmDelete() {
|
|
189
|
+
this.$mapo.$confirm
|
|
190
|
+
.open({
|
|
191
|
+
title: this.$t("mapo.remove"),
|
|
192
|
+
question: this.$t("mapo.mediaField.confirmRemove"),
|
|
193
|
+
approveButton: {
|
|
194
|
+
text: this.$t("mapo.remove"),
|
|
195
|
+
attrs: { color: "red", text: true },
|
|
196
|
+
},
|
|
197
|
+
})
|
|
198
|
+
.then((res) => (res ? (this.internalValue = null) : null));
|
|
199
|
+
},
|
|
200
|
+
updateChild() {
|
|
201
|
+
this.childKey += 1;
|
|
202
|
+
},
|
|
203
|
+
isImage(val) {
|
|
204
|
+
if (!val?.is_image && val?.mime_type.includes("image")) {
|
|
205
|
+
Object.assign(val, { is_image: true });
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
},
|
|
209
|
+
watch: {
|
|
210
|
+
value(val) {
|
|
211
|
+
if (val !== this.internalValue) {
|
|
212
|
+
this.internalValue = val;
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
internalValue(val) {
|
|
216
|
+
this.isImage(val);
|
|
217
|
+
this.$emit("input", val);
|
|
218
|
+
},
|
|
219
|
+
},
|
|
220
|
+
mounted() {
|
|
221
|
+
this.internalValue = this.value;
|
|
222
|
+
},
|
|
223
|
+
};
|
|
224
|
+
</script>
|
|
@@ -205,6 +205,11 @@ export default {
|
|
|
205
205
|
})
|
|
206
206
|
.then((res) => (res ? (this.internalValue = null) : null));
|
|
207
207
|
},
|
|
208
|
+
isImage(val) {
|
|
209
|
+
if (!val?.is_image && val?.mime_type.includes("image")) {
|
|
210
|
+
Object.assign(val, { is_image: true });
|
|
211
|
+
}
|
|
212
|
+
},
|
|
208
213
|
},
|
|
209
214
|
|
|
210
215
|
watch: {
|
|
@@ -214,11 +219,12 @@ export default {
|
|
|
214
219
|
}
|
|
215
220
|
},
|
|
216
221
|
internalValue(val) {
|
|
222
|
+
this.isImage(val)
|
|
217
223
|
this.$emit("input", val);
|
|
218
224
|
},
|
|
219
225
|
},
|
|
220
226
|
mounted(){
|
|
221
|
-
this.internalValue = this.
|
|
227
|
+
this.internalValue = this.value
|
|
222
228
|
}
|
|
223
229
|
};
|
|
224
230
|
</script>
|
package/defaults/i18n.js
ADDED
|
@@ -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,33 @@
|
|
|
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
|
+
dark: true,
|
|
8
|
+
themes: {
|
|
9
|
+
dark: {
|
|
10
|
+
primary: "#51beaa",
|
|
11
|
+
accent: colors.grey.darken3,
|
|
12
|
+
secondary: colors.amber.darken3,
|
|
13
|
+
info: colors.teal.lighten1,
|
|
14
|
+
warning: colors.amber.base,
|
|
15
|
+
error: "#FF5252",
|
|
16
|
+
success: colors.green.accent3,
|
|
17
|
+
},
|
|
18
|
+
light: {
|
|
19
|
+
primary: "#51beaa",
|
|
20
|
+
accent: colors.indigo.accent1,
|
|
21
|
+
secondary: colors.amber.accent2,
|
|
22
|
+
info: colors.teal.lighten1,
|
|
23
|
+
warning: colors.amber.base,
|
|
24
|
+
error: "#FF5252",
|
|
25
|
+
success: colors.green.accent3,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
lang: {
|
|
30
|
+
locales: { en, it },
|
|
31
|
+
},
|
|
32
|
+
treeShake: false,
|
|
33
|
+
};
|
package/module.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { createRoutes } from '@nuxt/utils'
|
|
2
2
|
import serveStatic from 'serve-static'
|
|
3
3
|
import path from 'path'
|
|
4
|
-
import mapoDefaults from './defaults'
|
|
5
4
|
import Glob from 'glob'
|
|
6
5
|
import pify from 'pify'
|
|
7
6
|
const glob = pify(Glob)
|
|
@@ -20,15 +19,10 @@ export default async function (moduleOptions) {
|
|
|
20
19
|
const userModuleOptions = Object.keys(moduleOptions).length === 0 ? (this.options['mapo'] || {}) : moduleOptions
|
|
21
20
|
|
|
22
21
|
// INJECT VUETIFY MODULE
|
|
23
|
-
this.requireModule(['@nuxtjs/vuetify', {
|
|
24
|
-
|
|
25
|
-
lang: userModuleOptions.vuetify?.lang || mapoDefaults.vuetify.lang
|
|
26
|
-
}]);
|
|
22
|
+
this.requireModule(['@nuxtjs/vuetify', (this.options && this.options.vuetify) || userModuleOptions.vuetify || {}]);
|
|
23
|
+
|
|
27
24
|
// INJECT I18N MODULE
|
|
28
|
-
this.requireModule(['@nuxtjs/i18n', {
|
|
29
|
-
...((this.options && this.options.i18n) || userModuleOptions.i18n || mapoDefaults.i18n || {}),
|
|
30
|
-
onBeforeLanguageSwitch: userModuleOptions.i18n?.onBeforeLanguageSwitch || mapoDefaults.i18n.onBeforeLanguageSwitch
|
|
31
|
-
}]);
|
|
25
|
+
this.requireModule(['@nuxtjs/i18n', (this.options && this.options.i18n) || userModuleOptions.i18n || {},]);
|
|
32
26
|
|
|
33
27
|
// INJECT ALL LAYOUTS
|
|
34
28
|
const layouts = (await resolver.resolveRelative(__dirname, 'layouts')).map(({ src }) => src)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mapomodule/uikit",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.27",
|
|
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>",
|
|
@@ -15,5 +15,5 @@
|
|
|
15
15
|
"publishConfig": {
|
|
16
16
|
"access": "public"
|
|
17
17
|
},
|
|
18
|
-
"gitHead": "
|
|
18
|
+
"gitHead": "d028345c7ee4cdf43dac3e68d27d4b9f1ad4198c"
|
|
19
19
|
}
|
package/defaults.js
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import colors from "vuetify/es5/util/colors";
|
|
2
|
-
import { it, en } from "vuetify/lib/locale";
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
vuetify: {
|
|
6
|
-
customVariables: ["@mapomodule/uikit/assets/variables.scss"],
|
|
7
|
-
theme: {
|
|
8
|
-
dark: true,
|
|
9
|
-
themes: {
|
|
10
|
-
dark: {
|
|
11
|
-
primary: "#51beaa",
|
|
12
|
-
accent: colors.grey.darken3,
|
|
13
|
-
secondary: colors.amber.darken3,
|
|
14
|
-
info: colors.teal.lighten1,
|
|
15
|
-
warning: colors.amber.base,
|
|
16
|
-
error: "#FF5252",
|
|
17
|
-
success: colors.green.accent3,
|
|
18
|
-
},
|
|
19
|
-
light: {
|
|
20
|
-
primary: "#51beaa",
|
|
21
|
-
accent: colors.indigo.accent1,
|
|
22
|
-
secondary: colors.amber.accent2,
|
|
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: false,
|
|
34
|
-
},
|
|
35
|
-
i18n: {
|
|
36
|
-
detectBrowserLanguage: {
|
|
37
|
-
useCookie: true,
|
|
38
|
-
cookieKey: "i18n_redirected",
|
|
39
|
-
redirectOn: "root",
|
|
40
|
-
},
|
|
41
|
-
locales: [
|
|
42
|
-
{
|
|
43
|
-
code: "en",
|
|
44
|
-
name: "English",
|
|
45
|
-
file: "en-US.js",
|
|
46
|
-
iso: "en-US",
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
code: "it",
|
|
50
|
-
name: "Italiano",
|
|
51
|
-
file: "it-IT.js",
|
|
52
|
-
iso: "it-IT",
|
|
53
|
-
},
|
|
54
|
-
],
|
|
55
|
-
lazy: true,
|
|
56
|
-
langDir: __dirname + "/translations/",
|
|
57
|
-
defaultLocale: "en",
|
|
58
|
-
strategy: "no_prefix",
|
|
59
|
-
onBeforeLanguageSwitch: (
|
|
60
|
-
oldLocale,
|
|
61
|
-
newLocale,
|
|
62
|
-
isInitialSetup,
|
|
63
|
-
context
|
|
64
|
-
) => {
|
|
65
|
-
const locale =
|
|
66
|
-
context.i18n.locales.find((l) => l.code === newLocale) || {};
|
|
67
|
-
const isRTL = locale.dir === "rtl";
|
|
68
|
-
if (isInitialSetup) {
|
|
69
|
-
context.app.vuetify.preset.rtl = isRTL;
|
|
70
|
-
}
|
|
71
|
-
context.app.vuetify.framework.lang.current = locale.iso ? locale.iso.split("-")[0] : locale.code;
|
|
72
|
-
context.app.vuetify.framework.rtl = isRTL;
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
};
|