@das-fed/upf-web 6.4.0-dev.202 → 6.4.0-dev.204
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 +93 -93
- package/esm-map.json +11 -12
- package/{index-DvcXHpcr.js → index-B8OU227U.js} +1 -1
- package/index-B8OU227U.js.gz +0 -0
- package/{index-B3QSTHl8.js → index-BDoN_kC5.js} +1 -1
- package/{index-L0ZWbpXA.js → index-BTfDckHk.js} +1868 -1833
- package/index-BTfDckHk.js.gz +0 -0
- package/index.js +13 -14
- package/package.json +6 -6
- package/packages/create-das-web-app/es5.js +298 -85
- package/packages/create-das-web-app/index.js +126 -48
- package/packages/create-das-web-app/index.js.gz +0 -0
- package/packages/i18n/es5.js +112 -187
- package/packages/i18n/index.js +56 -86
- package/packages/i18n/index.js.gz +0 -0
- package/types/i18n/index.d.ts +1 -2
- package/types/i18n/microI18n.d.ts +13 -0
- package/index-DvcXHpcr.js.gz +0 -0
- package/index-L0ZWbpXA.js.gz +0 -0
- package/types/i18n/register.d.ts +0 -3
package/packages/i18n/index.js
CHANGED
|
@@ -1,61 +1,41 @@
|
|
|
1
|
-
import { reactive as p, ref as
|
|
2
|
-
import {
|
|
3
|
-
|
|
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 = () => {
|
|
1
|
+
import { reactive as p, ref as w, computed as C } from "vue";
|
|
2
|
+
import { getUrlParams as L } from "@das-fed/upf-utils/common-tools";
|
|
3
|
+
const h = "language", s = p({}), c = p({}), l = p({}), j = L(location.href, "uiCulture") || "", y = j || window.localStorage.getItem(h) || window.navigator.language || "zh-CN", m = w(y), D = "dasI18n", g = () => {
|
|
24
4
|
const t = document.documentElement;
|
|
25
|
-
t && t.setAttribute("lang",
|
|
26
|
-
},
|
|
27
|
-
const
|
|
28
|
-
for (const
|
|
29
|
-
for (const
|
|
30
|
-
|
|
31
|
-
},
|
|
32
|
-
var
|
|
33
|
-
const
|
|
34
|
-
for (const
|
|
35
|
-
if (
|
|
36
|
-
const
|
|
37
|
-
|
|
5
|
+
t && t.setAttribute("lang", m.value);
|
|
6
|
+
}, v = (t = {}, a) => {
|
|
7
|
+
const r = a === "global", e = !r, i = {};
|
|
8
|
+
for (const o in t)
|
|
9
|
+
for (const n in t[o])
|
|
10
|
+
i[n] || (i[n] = {}), i[n][o] = t[o][n] ?? "", r && (c[n] || (c[n] = {}), c[n][o] = i[n][o]), e && (s[n] || (s[n] = {}), s[n][o] = i[n][o]);
|
|
11
|
+
}, b = (t = {}, a) => {
|
|
12
|
+
var i;
|
|
13
|
+
const r = a === "global", e = !r;
|
|
14
|
+
for (const o in t)
|
|
15
|
+
if (r && !c[o] && (c[o] = t[o]), e) {
|
|
16
|
+
const n = (i = t[o]) != null && i._appCode ? t[o]._appCode.toLowerCase() : "";
|
|
17
|
+
n && (l[n] || (l[n] = {}), l[n][o] = t[o]), s[o] || (s[o] = t[o]);
|
|
38
18
|
}
|
|
39
|
-
},
|
|
40
|
-
|
|
41
|
-
const
|
|
42
|
-
|
|
19
|
+
}, R = async (t) => {
|
|
20
|
+
g();
|
|
21
|
+
const a = window[D];
|
|
22
|
+
a && b(a, "global");
|
|
43
23
|
}, A = (t) => {
|
|
44
|
-
let
|
|
45
|
-
const
|
|
46
|
-
return
|
|
47
|
-
},
|
|
48
|
-
const
|
|
49
|
-
let
|
|
50
|
-
if (
|
|
51
|
-
typeof
|
|
52
|
-
let
|
|
53
|
-
return
|
|
54
|
-
|
|
55
|
-
}),
|
|
56
|
-
}),
|
|
57
|
-
|
|
58
|
-
},
|
|
24
|
+
let a = "";
|
|
25
|
+
const r = /\/([^\/]+)\/([^\/]+)\//, e = t.match(r);
|
|
26
|
+
return e && e.length >= 3 && (a = e[1] + "/" + e[2]), a ? a.toLowerCase() : "";
|
|
27
|
+
}, I = (t, ...a) => C(() => {
|
|
28
|
+
const r = A(location.pathname);
|
|
29
|
+
let e = l.framework ?? {}, i = l[r] ?? {}, o = s[t] || c[t] || e[t] || i[t] || t;
|
|
30
|
+
if (o === t) return t;
|
|
31
|
+
typeof o == "string" && (o = { "zh-CN": o });
|
|
32
|
+
let n = o[m.value];
|
|
33
|
+
return m.value === "zh-CN" && o["zh-cn"] && !o["zh-CN"] && (n = o["zh-cn"]), a.map((f, d) => {
|
|
34
|
+
n && (n = n.replace(`$${d}`, f));
|
|
35
|
+
}), n;
|
|
36
|
+
}), z = I, N = (t, ...a) => z(t, ...a).value, T = (t) => {
|
|
37
|
+
m.value = t, g();
|
|
38
|
+
}, _ = () => m, u = {
|
|
59
39
|
"en-US": { ant: () => import("ant-design-vue/es/locale/en_US"), dayjs: () => import("dayjs/locale/en") },
|
|
60
40
|
"zh-CN": { ant: () => import("ant-design-vue/es/locale/zh_CN"), dayjs: () => import("dayjs/locale/zh-cn") },
|
|
61
41
|
"zh-MO": { ant: () => import("ant-design-vue/es/locale/zh_TW"), dayjs: () => import("dayjs/locale/zh-tw") },
|
|
@@ -70,41 +50,31 @@ const k = async (t, n) => {
|
|
|
70
50
|
"nl-NL": { ant: () => import("ant-design-vue/es/locale/nl_NL"), dayjs: () => import("dayjs/locale/nl") },
|
|
71
51
|
"tr-TR": { ant: () => import("ant-design-vue/es/locale/tr_TR"), dayjs: () => import("dayjs/locale/tr") }
|
|
72
52
|
};
|
|
73
|
-
function
|
|
74
|
-
var
|
|
75
|
-
const
|
|
76
|
-
return
|
|
53
|
+
function x(t, a) {
|
|
54
|
+
var e;
|
|
55
|
+
const r = window.DATE_FORMAT_MAP;
|
|
56
|
+
return r && r[t] && r[t][a] ? r[t][a] : ((e = window.DATE_FORMAT_MAP[t]) == null ? void 0 : e[a]) || "YYYY-MM-DD";
|
|
77
57
|
}
|
|
78
|
-
const
|
|
79
|
-
const
|
|
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) || [];
|
|
58
|
+
const O = async (t) => {
|
|
59
|
+
const a = u[t] || u["zh-CN"];
|
|
87
60
|
try {
|
|
88
|
-
const
|
|
89
|
-
|
|
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);
|
|
61
|
+
const r = await a.ant();
|
|
62
|
+
return await a.dayjs(), r.default;
|
|
92
63
|
} catch {
|
|
93
64
|
}
|
|
94
65
|
};
|
|
95
66
|
export {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
B as t
|
|
67
|
+
m as currentLang,
|
|
68
|
+
s as customLangeData,
|
|
69
|
+
x as getDateFormat,
|
|
70
|
+
I as getI18nRule,
|
|
71
|
+
_ as getLang,
|
|
72
|
+
z as i18n,
|
|
73
|
+
R as initI18n,
|
|
74
|
+
h as languageKey,
|
|
75
|
+
O as loadLocale,
|
|
76
|
+
b as setI18nRule,
|
|
77
|
+
T as setLang,
|
|
78
|
+
v as setLangRule,
|
|
79
|
+
N as t
|
|
110
80
|
};
|
|
Binary file
|
package/types/i18n/index.d.ts
CHANGED
|
@@ -25,5 +25,4 @@ 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
|
-
|
|
29
|
-
export { languageKey, initI18n, setI18nRule, getI18nRule, i18n, t, setLang, getLang, currentLang, setLangRule, customLangeData, loadLocale, registerMicroI18nData, };
|
|
28
|
+
export { languageKey, initI18n, setI18nRule, getI18nRule, i18n, t, setLang, getLang, currentLang, setLangRule, customLangeData, loadLocale, };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { langType } from './type';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 内存存储:记录本次页面会话中哪些 micro app 的 i18n 已加载。
|
|
5
|
+
*/
|
|
6
|
+
export declare const microI18nStore: {
|
|
7
|
+
loaded: Record<string, Record<string, boolean>>;
|
|
8
|
+
isLoaded(lang: langType, name: string): boolean;
|
|
9
|
+
markLoaded(lang: langType, name: string): void;
|
|
10
|
+
markUnloaded(lang: langType, name: string): void;
|
|
11
|
+
};
|
|
12
|
+
export declare const registerI18nData: (appName: string[], currentLang: langType) => Promise<Record<string, any>>;
|
|
13
|
+
export declare const registerMicroI18nData: (i18nCodes?: string[], currentLang?: langType) => Promise<void>;
|
package/index-DvcXHpcr.js.gz
DELETED
|
Binary file
|
package/index-L0ZWbpXA.js.gz
DELETED
|
Binary file
|
package/types/i18n/register.d.ts
DELETED