zova-core 5.1.85 → 5.1.87
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/dist/bean/resource/locale/type.d.ts +1 -0
- package/dist/bean/resource/locale/type.d.ts.map +1 -1
- package/dist/core/component/locale.d.ts +1 -1
- package/dist/core/component/locale.d.ts.map +1 -1
- package/dist/core/sys/util.d.ts +1 -0
- package/dist/core/sys/util.d.ts.map +1 -1
- package/dist/index.js +16 -3
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/bean/resource/locale/type.ts +1 -0
- package/src/core/component/locale.ts +10 -3
- package/src/core/sys/util.ts +6 -0
package/package.json
CHANGED
|
@@ -26,14 +26,17 @@ export class AppLocale extends BeanSimple {
|
|
|
26
26
|
|
|
27
27
|
get current(): keyof ILocaleRecord {
|
|
28
28
|
let locale = this[SymbolLocaleCurrent].value;
|
|
29
|
-
|
|
29
|
+
// always parse locale from cookie
|
|
30
|
+
// if (!locale && this._cookieEnabled()) {
|
|
31
|
+
if (!locale) {
|
|
30
32
|
locale = this.metaCookie.getItem(this.sys.config.locale.storeKey);
|
|
31
33
|
}
|
|
32
34
|
if (!locale) locale = this.sys.config.locale.default;
|
|
33
35
|
return locale as keyof ILocaleRecord;
|
|
34
36
|
}
|
|
35
37
|
|
|
36
|
-
set current(value: keyof ILocaleRecord) {
|
|
38
|
+
set current(value: keyof ILocaleRecord | '' | undefined) {
|
|
39
|
+
if (!value) value = this.sys.config.locale.default;
|
|
37
40
|
if (this[SymbolLocaleCurrent].value === value) return;
|
|
38
41
|
this[SymbolLocaleCurrent].value = value;
|
|
39
42
|
if (this._cookieEnabled()) {
|
|
@@ -47,7 +50,11 @@ export class AppLocale extends BeanSimple {
|
|
|
47
50
|
|
|
48
51
|
get tz(): string {
|
|
49
52
|
let tz = this[SymbolTzCurrent].value;
|
|
50
|
-
|
|
53
|
+
// always parse tz from cookie
|
|
54
|
+
// if (!tz && this._cookieEnabled()) {
|
|
55
|
+
if (!tz) {
|
|
56
|
+
tz = this.metaCookie.getItem(this.sys.config.tz.storeKey);
|
|
57
|
+
}
|
|
51
58
|
if (!tz) tz = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
52
59
|
return tz;
|
|
53
60
|
}
|
package/src/core/sys/util.ts
CHANGED
|
@@ -263,3 +263,9 @@ export function throwErrorComponentUnmounted() {
|
|
|
263
263
|
error.code = 600;
|
|
264
264
|
throw error;
|
|
265
265
|
}
|
|
266
|
+
|
|
267
|
+
export function ssr_load_local(key, defaultValue?) {
|
|
268
|
+
const __ssr_local = localStorage.getItem(key);
|
|
269
|
+
const value = __ssr_local ? JSON.parse(__ssr_local) : undefined;
|
|
270
|
+
return value ?? defaultValue;
|
|
271
|
+
}
|