@awes-io/ui 2.63.0 → 2.63.1
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 +36 -1
- package/nuxt/templates/dayjs.plugin.js +4 -5
- 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.1](https://github.com/awes-io/client/compare/@awes-io/ui@2.63.0...@awes-io/ui@2.63.1) (2023-04-25)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **ui:** dayjs locales autoload checks locale availability ([270a388](https://github.com/awes-io/client/commit/270a388ff2535d61bcbd91460432e46e4cd9b7f4))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# [2.63.0](https://github.com/awes-io/client/compare/@awes-io/ui@2.62.0...@awes-io/ui@2.63.0) (2023-04-07)
|
|
7
18
|
|
|
8
19
|
|
package/nuxt/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { mergeDeepRight, pick, omit, uniq, endsWith, partition } from 'rambdax'
|
|
2
2
|
import { existsSync, readdirSync, readFileSync, lstatSync } from 'fs'
|
|
3
|
-
import { join, resolve, sep } from 'path'
|
|
3
|
+
import { join, resolve, sep, dirname } from 'path'
|
|
4
4
|
import resolveConfig from 'tailwindcss/resolveConfig'
|
|
5
5
|
import {
|
|
6
6
|
default as configDefault,
|
|
@@ -22,6 +22,26 @@ const fixWindowsPath = (path) =>
|
|
|
22
22
|
.replace(/\\/g, '/')
|
|
23
23
|
.replace(/\/\/+/g, '/')
|
|
24
24
|
|
|
25
|
+
const availableDayjsLocales = readdirSync(
|
|
26
|
+
join(dirname(require.resolve('dayjs')), 'locale')
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
const getDayjsLang = (code) => {
|
|
30
|
+
const fileName = code.toLowerCase() + '.js'
|
|
31
|
+
|
|
32
|
+
if (availableDayjsLocales.includes(fileName)) {
|
|
33
|
+
return fileName
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const shortened = code.toLowerCase().substr(0, 2) + '.js'
|
|
37
|
+
|
|
38
|
+
if (availableDayjsLocales.includes(shortened)) {
|
|
39
|
+
return shortened
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return false
|
|
43
|
+
}
|
|
44
|
+
|
|
25
45
|
async function AwesIoUi() {
|
|
26
46
|
/**
|
|
27
47
|
* Check store existance
|
|
@@ -100,6 +120,21 @@ async function AwesIoUi() {
|
|
|
100
120
|
}
|
|
101
121
|
}
|
|
102
122
|
|
|
123
|
+
const dayjsLocaleFiles = this.options.awesIo.lang.locales.reduce(
|
|
124
|
+
(acc, locale) => {
|
|
125
|
+
const file = getDayjsLang(locale.code || locale)
|
|
126
|
+
|
|
127
|
+
return file ? acc.concat(file) : acc
|
|
128
|
+
},
|
|
129
|
+
[]
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
this.options.awesIo.dayjs.langs = uniq(dayjsLocaleFiles).map((file) => {
|
|
133
|
+
const name = file.replace('.js', '')
|
|
134
|
+
|
|
135
|
+
return { name, variable: 'locale_' + name.replace('-', '_'), file }
|
|
136
|
+
})
|
|
137
|
+
|
|
103
138
|
/**
|
|
104
139
|
* Add font
|
|
105
140
|
*/
|
|
@@ -11,12 +11,11 @@ import <%=name%> from '<%=src%>'
|
|
|
11
11
|
dayjs.extend(<%=name%>, <%=JSON.stringify(options)%>)
|
|
12
12
|
<% }) %>
|
|
13
13
|
|
|
14
|
-
<% if (options.
|
|
15
|
-
<% options.
|
|
16
|
-
const code = locale.code || locale
|
|
14
|
+
<% if (options.dayjs.langs && Array.isArray(options.dayjs.langs)) { %>
|
|
15
|
+
<% options.dayjs.langs.forEach(({ name, variable, file }) => {
|
|
17
16
|
%>
|
|
18
|
-
import
|
|
19
|
-
dayjs.locale('<%=
|
|
17
|
+
import <%=variable%> from 'dayjs/locale/<%=file%>'
|
|
18
|
+
dayjs.locale('<%=name%>', <%=variable%>)
|
|
20
19
|
<% }) %>
|
|
21
20
|
<% } %>
|
|
22
21
|
/* eslint-enable */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@awes-io/ui",
|
|
3
|
-
"version": "2.63.
|
|
3
|
+
"version": "2.63.1",
|
|
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": "cf0fbd1eafb31d7d3f00e09593b6f137c7bd0e16"
|
|
126
126
|
}
|