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