@awes-io/ui 2.144.3 → 2.144.5
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 +23 -0
- package/components/3_organisms/AwSearch.vue +8 -2
- package/nuxt/index.js +14 -3
- package/nuxt/templates/lang.plugin.js +45 -10
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,29 @@
|
|
|
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.144.5](https://github.com/awes-io/client/compare/@awes-io/ui@2.144.4...@awes-io/ui@2.144.5) (2026-03-24)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **dayjs:** replace cnr locale to dayjs format ([9f48e97](https://github.com/awes-io/client/commit/9f48e978d08ef21829e7b2eca8b7a3f2b6d1992c))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [2.144.4](https://github.com/awes-io/client/compare/@awes-io/ui@2.144.3...@awes-io/ui@2.144.4) (2026-03-05)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* **aw-search:** react only on search param change ([b260651](https://github.com/awes-io/client/commit/b260651d822f71a01b93f793c4ef4477fc280dae))
|
|
23
|
+
* **lang:** browser lang detection improved to handle extended locales ([1be916e](https://github.com/awes-io/client/commit/1be916e92303c8cb84896c2907a6726c1acd9493))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
6
29
|
## [2.144.3](https://github.com/awes-io/client/compare/@awes-io/ui@2.144.2...@awes-io/ui@2.144.3) (2026-02-24)
|
|
7
30
|
|
|
8
31
|
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
|
|
30
30
|
<script>
|
|
31
31
|
import { cleanRouteQuery } from '@AwUtils/router'
|
|
32
|
-
import { pick } from 'rambdax'
|
|
32
|
+
import { pick, pathOr } from 'rambdax'
|
|
33
33
|
|
|
34
34
|
const INPUT_ELEMENTS = ['input', 'textarea']
|
|
35
35
|
|
|
@@ -96,7 +96,13 @@ export default {
|
|
|
96
96
|
|
|
97
97
|
'$route.query': {
|
|
98
98
|
immediate: true,
|
|
99
|
-
handler(query) {
|
|
99
|
+
handler(query, oldQuery) {
|
|
100
|
+
if (
|
|
101
|
+
pathOr('', this.param, oldQuery) ===
|
|
102
|
+
pathOr('', this.param, query)
|
|
103
|
+
)
|
|
104
|
+
return
|
|
105
|
+
|
|
100
106
|
clearTimeout(this._tm)
|
|
101
107
|
this.text = query[this.param] || ''
|
|
102
108
|
}
|
package/nuxt/index.js
CHANGED
|
@@ -29,14 +29,25 @@ const availableDayjsLocales = readdirSync(
|
|
|
29
29
|
join(dirname(require.resolve('dayjs')), 'locale')
|
|
30
30
|
)
|
|
31
31
|
|
|
32
|
+
const dayjsReplaceMap = {
|
|
33
|
+
cnr: 'me',
|
|
34
|
+
'cnr-me': 'me'
|
|
35
|
+
}
|
|
36
|
+
|
|
32
37
|
const getDayjsLang = (code) => {
|
|
33
|
-
|
|
38
|
+
let needle = code.toLowerCase().split('-')[0]
|
|
39
|
+
|
|
40
|
+
if (dayjsReplaceMap[needle]) {
|
|
41
|
+
needle = dayjsReplaceMap[needle]
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const fileName = needle + '.js'
|
|
34
45
|
|
|
35
46
|
if (availableDayjsLocales.includes(fileName)) {
|
|
36
47
|
return fileName
|
|
37
48
|
}
|
|
38
49
|
|
|
39
|
-
const shortened =
|
|
50
|
+
const shortened = needle.split('-')[0] + '.js'
|
|
40
51
|
|
|
41
52
|
if (availableDayjsLocales.includes(shortened)) {
|
|
42
53
|
return shortened
|
|
@@ -45,7 +56,7 @@ const getDayjsLang = (code) => {
|
|
|
45
56
|
return false
|
|
46
57
|
}
|
|
47
58
|
|
|
48
|
-
const getDayjsLocaleNameFromFile = (file) => file.replace('.js', '')
|
|
59
|
+
const getDayjsLocaleNameFromFile = (file) => file && file.replace('.js', '')
|
|
49
60
|
|
|
50
61
|
async function AwesIoUi() {
|
|
51
62
|
/**
|
|
@@ -39,6 +39,42 @@ const langCookie = langOptions.langCookie
|
|
|
39
39
|
|
|
40
40
|
const toLocale = (lang = '') => lang.slice(0, 2).toLowerCase()
|
|
41
41
|
|
|
42
|
+
const findRelevantLocale = (localeCodes, browserLanguages) => {
|
|
43
|
+
const normalizedCodes = localeCodes.map((code) => code.toLowerCase())
|
|
44
|
+
|
|
45
|
+
const tryLocale = (lang) => {
|
|
46
|
+
if (!lang) return null
|
|
47
|
+
|
|
48
|
+
const lower = lang.toLowerCase()
|
|
49
|
+
const exactIndex = normalizedCodes.indexOf(lower)
|
|
50
|
+
|
|
51
|
+
if (exactIndex !== -1) {
|
|
52
|
+
return localeCodes[exactIndex]
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const base = toLocale(lang)
|
|
56
|
+
if (!base) return null
|
|
57
|
+
|
|
58
|
+
const baseIndex = normalizedCodes.findIndex((code) => code.startsWith(base))
|
|
59
|
+
|
|
60
|
+
if (baseIndex !== -1) {
|
|
61
|
+
return localeCodes[baseIndex]
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return null
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
for (const lang of browserLanguages) {
|
|
68
|
+
const match = tryLocale(lang)
|
|
69
|
+
|
|
70
|
+
if (match) {
|
|
71
|
+
return match
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return null
|
|
76
|
+
}
|
|
77
|
+
|
|
42
78
|
const i18nOptions = mergeDeepRight(
|
|
43
79
|
{
|
|
44
80
|
formatFallbackMessages: true,
|
|
@@ -98,19 +134,18 @@ export default async ({ app, $axios }) => {
|
|
|
98
134
|
return remove
|
|
99
135
|
}
|
|
100
136
|
|
|
101
|
-
|
|
102
|
-
* Detect browser language
|
|
103
|
-
*/
|
|
104
|
-
let _browserLang = toLocale(navigator.language)
|
|
137
|
+
const browserLanguages = []
|
|
105
138
|
|
|
106
|
-
if (
|
|
107
|
-
|
|
108
|
-
navigator.languages.find(locale =>
|
|
109
|
-
localeCodes.includes(toLocale(locale))
|
|
110
|
-
)
|
|
111
|
-
)
|
|
139
|
+
if (navigator.language) {
|
|
140
|
+
browserLanguages.push(navigator.language)
|
|
112
141
|
}
|
|
113
142
|
|
|
143
|
+
if (Array.isArray(navigator.languages)) {
|
|
144
|
+
browserLanguages.push(...navigator.languages)
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const _browserLang = findRelevantLocale(localeCodes, browserLanguages)
|
|
148
|
+
|
|
114
149
|
/**
|
|
115
150
|
* Restore saved lang
|
|
116
151
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@awes-io/ui",
|
|
3
|
-
"version": "2.144.
|
|
3
|
+
"version": "2.144.5",
|
|
4
4
|
"description": "User Interface (UI) components",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ui",
|
|
@@ -116,5 +116,5 @@
|
|
|
116
116
|
"peerDependencies": {
|
|
117
117
|
"nuxt": "^2.18.1"
|
|
118
118
|
},
|
|
119
|
-
"gitHead": "
|
|
119
|
+
"gitHead": "0fa90b1b7fa53692c8012ba25fcdd57ad9a3ca51"
|
|
120
120
|
}
|