@awes-io/ui 2.63.1 → 2.63.2
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 +11 -0
- package/nuxt/index.js +13 -2
- package/nuxt/templates/dayjs.plugin.js +4 -2
- package/package.json +2 -2
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.63.2](https://github.com/awes-io/client/compare/@awes-io/ui@2.63.1...@awes-io/ui@2.63.2) (2023-04-25)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **ui:** dayjs locales mapped to i18n locales ([2b9ddd2](https://github.com/awes-io/client/commit/2b9ddd2e86a30a2fe56f85e72eb6e17e8eb8ad36))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [2.63.1](https://github.com/awes-io/client/compare/@awes-io/ui@2.63.0...@awes-io/ui@2.63.1) (2023-04-25)
|
|
7
18
|
|
|
8
19
|
|
package/nuxt/index.js
CHANGED
|
@@ -12,6 +12,8 @@ import {
|
|
|
12
12
|
} from './awes.config.js'
|
|
13
13
|
import defaultTailwindConfig from '../tailwind.config.js'
|
|
14
14
|
|
|
15
|
+
const DEFAULT_DAYJS_LOCALE = 'en'
|
|
16
|
+
|
|
15
17
|
const configDark = mergeDeepRight(configDefault, dark)
|
|
16
18
|
|
|
17
19
|
export const MODULE_DIR = 'awes-io'
|
|
@@ -42,6 +44,8 @@ const getDayjsLang = (code) => {
|
|
|
42
44
|
return false
|
|
43
45
|
}
|
|
44
46
|
|
|
47
|
+
const getDayjsLocaleNameFromFile = (file) => file.replace('.js', '')
|
|
48
|
+
|
|
45
49
|
async function AwesIoUi() {
|
|
46
50
|
/**
|
|
47
51
|
* Check store existance
|
|
@@ -120,17 +124,24 @@ async function AwesIoUi() {
|
|
|
120
124
|
}
|
|
121
125
|
}
|
|
122
126
|
|
|
127
|
+
const localesMap = {}
|
|
128
|
+
|
|
123
129
|
const dayjsLocaleFiles = this.options.awesIo.lang.locales.reduce(
|
|
124
130
|
(acc, locale) => {
|
|
125
|
-
const
|
|
131
|
+
const _locale = locale.code || locale
|
|
132
|
+
const file = getDayjsLang(_locale)
|
|
133
|
+
|
|
134
|
+
localesMap[_locale] = getDayjsLocaleNameFromFile(file) || DEFAULT_DAYJS_LOCALE
|
|
126
135
|
|
|
127
136
|
return file ? acc.concat(file) : acc
|
|
128
137
|
},
|
|
129
138
|
[]
|
|
130
139
|
)
|
|
131
140
|
|
|
141
|
+
this.options.awesIo.dayjs.localesMap = localesMap
|
|
142
|
+
|
|
132
143
|
this.options.awesIo.dayjs.langs = uniq(dayjsLocaleFiles).map((file) => {
|
|
133
|
-
const name = file
|
|
144
|
+
const name = getDayjsLocaleNameFromFile(file)
|
|
134
145
|
|
|
135
146
|
return { name, variable: 'locale_' + name.replace('-', '_'), file }
|
|
136
147
|
})
|
|
@@ -75,12 +75,14 @@ dayjs.locale('en')
|
|
|
75
75
|
|
|
76
76
|
// dayjs.extend(defaultStringFormat, <%=JSON.stringify(options.dayjs.stringFormat)%>)
|
|
77
77
|
|
|
78
|
+
const localesMap = JSON.parse('<%=JSON.stringify(options.dayjs.localesMap)%>')
|
|
79
|
+
|
|
78
80
|
export default function({ app: { i18n } }, inject) {
|
|
79
81
|
i18n.onLanguageSwitched(async newLocale => {
|
|
80
|
-
dayjs.locale(newLocale)
|
|
82
|
+
dayjs.locale(localesMap[newLocale])
|
|
81
83
|
})
|
|
82
84
|
|
|
83
|
-
dayjs.locale(i18n.locale)
|
|
85
|
+
dayjs.locale(localesMap[i18n.locale])
|
|
84
86
|
|
|
85
87
|
Vue.prototype.$dayjs = dayjs
|
|
86
88
|
inject('dayjs', dayjs)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@awes-io/ui",
|
|
3
|
-
"version": "2.63.
|
|
3
|
+
"version": "2.63.2",
|
|
4
4
|
"description": "User Interface (UI) components",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ui",
|
|
@@ -122,5 +122,5 @@
|
|
|
122
122
|
"vue-template-compiler": "^2.6.10",
|
|
123
123
|
"webfonts-generator": "^0.4.0"
|
|
124
124
|
},
|
|
125
|
-
"gitHead": "
|
|
125
|
+
"gitHead": "d08ca39dcb2fb44ab52209078eace98adbebb81e"
|
|
126
126
|
}
|