@das-fed/upf-web 6.4.0-dev.201 → 6.4.0-dev.202
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/es5.js +44 -44
- package/esm-map.json +13 -14
- package/{index-DpqH658a.js → index-B3QSTHl8.js} +1 -1
- package/{index-Dda2lRZV.js → index-DvcXHpcr.js} +1 -1
- package/index-DvcXHpcr.js.gz +0 -0
- package/{index-BJ0qSbnM.js → index-L0ZWbpXA.js} +485 -484
- package/index-L0ZWbpXA.js.gz +0 -0
- package/index.js +16 -17
- package/package.json +6 -6
- package/packages/create-das-web-app/es5.js +4 -4
- package/packages/create-das-web-app/index.js +1 -1
- package/packages/create-das-web-app/index.js.gz +0 -0
- package/packages/i18n/es5.js +187 -112
- package/packages/i18n/index.js +86 -56
- package/packages/i18n/index.js.gz +0 -0
- package/types/i18n/index.d.ts +2 -1
- package/types/i18n/register.d.ts +1 -2
- package/types/index.d.ts +0 -1
- package/index-BJ0qSbnM.js.gz +0 -0
- package/index-Dda2lRZV.js.gz +0 -0
package/packages/i18n/index.js
CHANGED
|
@@ -1,41 +1,61 @@
|
|
|
1
|
-
import { reactive as p, ref as
|
|
2
|
-
import { getUrlParams as
|
|
3
|
-
|
|
1
|
+
import { reactive as p, ref as L, computed as C } from "vue";
|
|
2
|
+
import { handleI18nData as M, getUrlParams as w } from "@das-fed/upf-utils/common-tools";
|
|
3
|
+
import { getConfig as I } from "@das-fed/upf-utils/config";
|
|
4
|
+
const k = async (t, n) => {
|
|
5
|
+
var m, u, b;
|
|
6
|
+
const a = I() || {}, o = ((m = a.i18n) == null ? void 0 : m.fromOss) ?? !0, s = ((u = a.i18n) == null ? void 0 : u.isPullBack) ?? !0, e = ((b = a.i18n) == null ? void 0 : b.isDasUI) ?? !0;
|
|
7
|
+
let r = "/oss/resource/";
|
|
8
|
+
try {
|
|
9
|
+
const l = await M({
|
|
10
|
+
baseUrl: o ? r : "/",
|
|
11
|
+
currentLang: n,
|
|
12
|
+
appName: t,
|
|
13
|
+
isPullBack: s,
|
|
14
|
+
fallbackBaseUrl: "/",
|
|
15
|
+
isDasUI: e
|
|
16
|
+
});
|
|
17
|
+
if (!l || !(l != null && l.frontEnd))
|
|
18
|
+
throw new Error("Failed to fetch i18n data");
|
|
19
|
+
return l;
|
|
20
|
+
} catch (h) {
|
|
21
|
+
throw new Error(`registerResources error: ${h}`);
|
|
22
|
+
}
|
|
23
|
+
}, j = "language", c = p({}), i = p({}), f = p({}), U = w(location.href, "uiCulture") || "", D = U || window.localStorage.getItem(j) || window.navigator.language || "zh-CN", g = L(D), O = "dasI18n", E = () => {
|
|
4
24
|
const t = document.documentElement;
|
|
5
|
-
t && t.setAttribute("lang",
|
|
6
|
-
},
|
|
7
|
-
const
|
|
8
|
-
for (const
|
|
9
|
-
for (const
|
|
10
|
-
|
|
11
|
-
},
|
|
12
|
-
var
|
|
13
|
-
const
|
|
14
|
-
for (const
|
|
15
|
-
if (
|
|
16
|
-
const
|
|
17
|
-
|
|
25
|
+
t && t.setAttribute("lang", g.value);
|
|
26
|
+
}, d = (t = {}, n) => {
|
|
27
|
+
const a = n === "global", o = !a, s = {};
|
|
28
|
+
for (const e in t)
|
|
29
|
+
for (const r in t[e])
|
|
30
|
+
s[r] || (s[r] = {}), s[r][e] = t[e][r] ?? "", a && (i[r] || (i[r] = {}), i[r][e] = s[r][e]), o && (c[r] || (c[r] = {}), c[r][e] = s[r][e]);
|
|
31
|
+
}, z = (t = {}, n) => {
|
|
32
|
+
var s;
|
|
33
|
+
const a = n === "global", o = !a;
|
|
34
|
+
for (const e in t)
|
|
35
|
+
if (a && !i[e] && (i[e] = t[e]), o) {
|
|
36
|
+
const r = (s = t[e]) != null && s._appCode ? t[e]._appCode.toLowerCase() : "";
|
|
37
|
+
r && (f[r] || (f[r] = {}), f[r][e] = t[e]), c[e] || (c[e] = t[e]);
|
|
18
38
|
}
|
|
19
|
-
},
|
|
20
|
-
|
|
21
|
-
const
|
|
22
|
-
|
|
39
|
+
}, x = async (t) => {
|
|
40
|
+
E();
|
|
41
|
+
const n = window[O];
|
|
42
|
+
n && z(n, "global");
|
|
23
43
|
}, A = (t) => {
|
|
24
|
-
let
|
|
25
|
-
const
|
|
26
|
-
return
|
|
27
|
-
},
|
|
28
|
-
const
|
|
29
|
-
let
|
|
30
|
-
if (
|
|
31
|
-
typeof
|
|
32
|
-
let
|
|
33
|
-
return
|
|
34
|
-
|
|
35
|
-
}),
|
|
36
|
-
}),
|
|
37
|
-
|
|
38
|
-
},
|
|
44
|
+
let n = "";
|
|
45
|
+
const a = /\/([^\/]+)\/([^\/]+)\//, o = t.match(a);
|
|
46
|
+
return o && o.length >= 3 && (n = o[1] + "/" + o[2]), n ? n.toLowerCase() : "";
|
|
47
|
+
}, v = (t, ...n) => C(() => {
|
|
48
|
+
const a = A(location.pathname);
|
|
49
|
+
let o = f.framework ?? {}, s = f[a] ?? {}, e = c[t] || i[t] || o[t] || s[t] || t;
|
|
50
|
+
if (e === t) return t;
|
|
51
|
+
typeof e == "string" && (e = { "zh-CN": e });
|
|
52
|
+
let r = e[g.value];
|
|
53
|
+
return g.value === "zh-CN" && e["zh-cn"] && !e["zh-CN"] && (r = e["zh-cn"]), n.map((m, u) => {
|
|
54
|
+
r && (r = r.replace(`$${u}`, m));
|
|
55
|
+
}), r;
|
|
56
|
+
}), N = v, B = (t, ...n) => N(t, ...n).value, R = (t) => {
|
|
57
|
+
g.value = t, E();
|
|
58
|
+
}, F = () => g, y = {
|
|
39
59
|
"en-US": { ant: () => import("ant-design-vue/es/locale/en_US"), dayjs: () => import("dayjs/locale/en") },
|
|
40
60
|
"zh-CN": { ant: () => import("ant-design-vue/es/locale/zh_CN"), dayjs: () => import("dayjs/locale/zh-cn") },
|
|
41
61
|
"zh-MO": { ant: () => import("ant-design-vue/es/locale/zh_TW"), dayjs: () => import("dayjs/locale/zh-tw") },
|
|
@@ -50,31 +70,41 @@ const h = "language", s = p({}), c = p({}), l = p({}), j = L(location.href, "uiC
|
|
|
50
70
|
"nl-NL": { ant: () => import("ant-design-vue/es/locale/nl_NL"), dayjs: () => import("dayjs/locale/nl") },
|
|
51
71
|
"tr-TR": { ant: () => import("ant-design-vue/es/locale/tr_TR"), dayjs: () => import("dayjs/locale/tr") }
|
|
52
72
|
};
|
|
53
|
-
function
|
|
54
|
-
var
|
|
55
|
-
const
|
|
56
|
-
return
|
|
73
|
+
function G(t, n) {
|
|
74
|
+
var o;
|
|
75
|
+
const a = window.DATE_FORMAT_MAP;
|
|
76
|
+
return a && a[t] && a[t][n] ? a[t][n] : ((o = window.DATE_FORMAT_MAP[t]) == null ? void 0 : o[n]) || "YYYY-MM-DD";
|
|
57
77
|
}
|
|
58
|
-
const
|
|
59
|
-
const
|
|
78
|
+
const Y = async (t) => {
|
|
79
|
+
const n = y[t] || y["zh-CN"];
|
|
80
|
+
try {
|
|
81
|
+
const a = await n.ant();
|
|
82
|
+
return await n.dayjs(), a.default;
|
|
83
|
+
} catch {
|
|
84
|
+
}
|
|
85
|
+
}, K = async (t) => {
|
|
86
|
+
const n = w(location.href, "uiCulture") || window.localStorage.getItem(j) || window.navigator.language || "zh-CN", a = (t == null ? void 0 : t.i18n) || [];
|
|
60
87
|
try {
|
|
61
|
-
const
|
|
62
|
-
|
|
88
|
+
const o = await k(a, n);
|
|
89
|
+
o != null && o.frontEnd && typeof o.frontEnd == "object" && Object.keys(o.frontEnd).length && a.forEach((s) => {
|
|
90
|
+
o.frontEnd[s] && typeof o.frontEnd[s] == "object" && Object.keys(o.frontEnd[s]).length && d({ [n]: o.frontEnd[s] });
|
|
91
|
+
}), o != null && o.backMsg && typeof o.backMsg == "object" && Object.keys(o.backMsg).length && o.backMsg.aiot && typeof o.backMsg.aiot == "object" && Object.keys(o.backMsg.aiot).length && d({ [n]: o.backMsg.aiot }), o != null && o.dasUiEnd && typeof o.dasUiEnd == "object" && Object.keys(o.dasUiEnd).length && d({ [n]: o.dasUiEnd }), R(n);
|
|
63
92
|
} catch {
|
|
64
93
|
}
|
|
65
94
|
};
|
|
66
95
|
export {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
96
|
+
g as currentLang,
|
|
97
|
+
c as customLangeData,
|
|
98
|
+
G as getDateFormat,
|
|
99
|
+
v as getI18nRule,
|
|
100
|
+
F as getLang,
|
|
101
|
+
N as i18n,
|
|
102
|
+
x as initI18n,
|
|
103
|
+
j as languageKey,
|
|
104
|
+
Y as loadLocale,
|
|
105
|
+
K as registerMicroI18nData,
|
|
106
|
+
z as setI18nRule,
|
|
107
|
+
R as setLang,
|
|
108
|
+
d as setLangRule,
|
|
109
|
+
B as t
|
|
80
110
|
};
|
|
Binary file
|
package/types/i18n/index.d.ts
CHANGED
|
@@ -25,4 +25,5 @@ declare const setLang: (lang: langType) => void;
|
|
|
25
25
|
declare const getLang: () => import('vue').Ref<any, any>;
|
|
26
26
|
export declare function getDateFormat(type: 'month' | 'date' | 'datetime' | 'time', lang: string): string;
|
|
27
27
|
declare const loadLocale: (lang: string) => unknown;
|
|
28
|
-
|
|
28
|
+
declare const registerMicroI18nData: (opt?: any) => any;
|
|
29
|
+
export { languageKey, initI18n, setI18nRule, getI18nRule, i18n, t, setLang, getLang, currentLang, setLangRule, customLangeData, loadLocale, registerMicroI18nData, };
|
package/types/i18n/register.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { langType } from './type';
|
|
2
2
|
|
|
3
|
-
export declare const registerI18nData: (appName: string[], currentLang: langType
|
|
4
|
-
export declare const registerMicroI18nData: (opt?: any) => void;
|
|
3
|
+
export declare const registerI18nData: (appName: string[], currentLang: langType) => Promise<Record<string, any>>;
|
package/types/index.d.ts
CHANGED
package/index-BJ0qSbnM.js.gz
DELETED
|
Binary file
|
package/index-Dda2lRZV.js.gz
DELETED
|
Binary file
|