nextia 8.0.1 → 8.0.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/package.json +1 -1
- package/src/lib/fx.js +2 -0
- package/src/lib/ui.js +19 -21
package/package.json
CHANGED
package/src/lib/fx.js
CHANGED
package/src/lib/ui.js
CHANGED
|
@@ -22,25 +22,24 @@ function Link({ children, href, value = {}, ...props }) {
|
|
|
22
22
|
function I18n({ value, args = [] }) {
|
|
23
23
|
const { context, i18n } = useCx()
|
|
24
24
|
|
|
25
|
-
if (i18n)
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return text
|
|
40
|
-
} catch {
|
|
41
|
-
console.error(`Error in [il8n] => ${value}`)
|
|
42
|
-
return value
|
|
25
|
+
if (!i18n) return null
|
|
26
|
+
|
|
27
|
+
try {
|
|
28
|
+
let text = value.split('.').reduce((ac, el) => ac[el], i18n)
|
|
29
|
+
|
|
30
|
+
text = text[i18n.locales.indexOf(context.state?.i18n || i18n.defaultLocale)]
|
|
31
|
+
|
|
32
|
+
if (args) {
|
|
33
|
+
text = text.replace(
|
|
34
|
+
/([{}])\\1|[{](.*?)(?:!(.+?))?[}]/g,
|
|
35
|
+
(match, _literal, number) => args[number] || match
|
|
36
|
+
)
|
|
43
37
|
}
|
|
38
|
+
|
|
39
|
+
return text
|
|
40
|
+
} catch {
|
|
41
|
+
console.error(`Error in [il8n] => ${value}`)
|
|
42
|
+
return value
|
|
44
43
|
}
|
|
45
44
|
}
|
|
46
45
|
|
|
@@ -64,9 +63,8 @@ function Icon({
|
|
|
64
63
|
const ref = useRef()
|
|
65
64
|
|
|
66
65
|
useEffect(() => {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
66
|
+
const el = icons?.getElementById(id)
|
|
67
|
+
if (ref.current && el) ref.current.innerHTML = el.innerHTML
|
|
70
68
|
}, [id, icons])
|
|
71
69
|
|
|
72
70
|
return createElement('svg', {
|