@das-fed/upf-web 6.4.0-hot.6 → 6.4.0-hot.8

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.
Files changed (42) hide show
  1. package/es5.js +17640 -788
  2. package/esm-map.json +4 -1
  3. package/index-BfS5ZwdE.js +12613 -0
  4. package/index-BfS5ZwdE.js.gz +0 -0
  5. package/{packages/main-app-framework/index-C8tjINrY.js → index-C8iGOlyv.js} +1 -1
  6. package/index-DfI-VZvq.js +93 -0
  7. package/index-DfI-VZvq.js.gz +0 -0
  8. package/index.js +18 -16
  9. package/package.json +7 -6
  10. package/packages/create-das-web-app/es5.js +138 -254
  11. package/packages/create-das-web-app/index.js +67 -122
  12. package/packages/create-das-web-app/index.js.gz +0 -0
  13. package/packages/i18n/es5.js +206 -114
  14. package/packages/i18n/index.js +99 -60
  15. package/packages/i18n/index.js.gz +0 -0
  16. package/packages/main-app-framework/es5.js +14782 -785
  17. package/{index-CihmHNMg.js → packages/main-app-framework/index-4P5L5Fln.js} +1 -1
  18. package/packages/main-app-framework/index-BZpwzi0c.js +93 -0
  19. package/packages/main-app-framework/index-BZpwzi0c.js.gz +0 -0
  20. package/packages/main-app-framework/index-BfSkRApB.js +11147 -0
  21. package/packages/main-app-framework/index-BfSkRApB.js.gz +0 -0
  22. package/packages/main-app-framework/index.js +1 -1
  23. package/packages/main-app-framework/style.css +1 -1
  24. package/packages/main-app-framework/style.css.gz +0 -0
  25. package/style.css +1 -1
  26. package/style.css.gz +0 -0
  27. package/types/i18n/{microI18n.d.ts → getMicroI18nData.d.ts} +1 -2
  28. package/types/i18n/index.d.ts +3 -1
  29. package/types/main-app-framework/init-config/index.d.ts +0 -1
  30. package/types/main-app-framework/init-mframe/hooks/business/use-iot-hooks.d.ts +3 -0
  31. package/types/main-app-framework/init-mframe/hooks/use-layout.d.ts +1 -0
  32. package/types/main-app-framework/init-mframe/index.d.ts +1 -0
  33. package/index-BhEtGWg9.js +0 -87
  34. package/index-BhEtGWg9.js.gz +0 -0
  35. package/index-ClQkHyu0.js +0 -13991
  36. package/index-ClQkHyu0.js.gz +0 -0
  37. package/packages/main-app-framework/index-BotXvTrW.js +0 -87
  38. package/packages/main-app-framework/index-BotXvTrW.js.gz +0 -0
  39. package/packages/main-app-framework/index-qZN6TvxI.js +0 -12524
  40. package/packages/main-app-framework/index-qZN6TvxI.js.gz +0 -0
  41. package/types/main-app-framework/init-config/get-project-config/api.d.ts +0 -5
  42. package/types/main-app-framework/init-config/get-project-config/index.d.ts +0 -1
@@ -1,44 +1,72 @@
1
- import { reactive as g, ref as L, computed as w } from "vue";
2
- import { getUrlParams as D } from "@das-fed/upf-utils/common-tools";
3
- const C = "language", l = g({}), i = g({}), m = g({}), h = D(location.href, "uiCulture") || "", j = h || window.localStorage.getItem(C) || window.navigator.language || "zh-CN", c = L(j), b = "dasI18n", p = () => {
1
+ import { reactive as p, ref as b, computed as j } from "vue";
2
+ import { handleI18nData as I, getUrlParams as D } from "@das-fed/upf-utils/common-tools";
3
+ import { getConfig as L } from "@das-fed/upf-utils/config";
4
+ const x = {
5
+ loaded: {},
6
+ isLoaded(t, n) {
7
+ return !!(this.loaded[t] && this.loaded[t][n]);
8
+ },
9
+ markLoaded(t, n) {
10
+ this.loaded[t] || (this.loaded[t] = {}), this.loaded[t][n] = !0;
11
+ },
12
+ markUnloaded(t, n) {
13
+ this.loaded[t] && (delete this.loaded[t][n], Object.keys(this.loaded[t]).length === 0 && delete this.loaded[t]);
14
+ }
15
+ }, U = async (t, n) => {
16
+ var m, u, g;
17
+ const o = L() || {}, a = ((m = o.i18n) == null ? void 0 : m.fromOss) ?? !0, s = ((u = o.i18n) == null ? void 0 : u.isPullBack) ?? !1, e = ((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: n,
23
+ appName: t,
24
+ isPullBack: s,
25
+ fallbackBaseUrl: "/",
26
+ isDasUI: e
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
+ }, C = "language", i = p({}), c = p({}), d = p({}), M = D(location.href, "lang") || "", O = M || window.localStorage.getItem(C) || window.navigator.language || "zh-CN", f = b(O), z = "dasI18n", E = () => {
4
35
  const t = document.documentElement;
5
- t && t.setAttribute("lang", c.value);
6
- }, M = (t = {}, a) => {
7
- const e = a === "global", r = !e;
8
- console.log("setLangRule===", t, a);
9
- const s = {};
10
- for (const o in t)
11
- for (const n in t[o])
12
- s[n] || (s[n] = {}), s[n][o] = t[o][n] ?? "", e && (i[n] || (i[n] = {}), i[n][o] = s[n][o]), r && (l[n] || (l[n] = {}, console.log(`${l[n]}为空,重新设置为{}`)), l[n][o] = s[n][o]);
13
- console.log("customLangeData===注入", l), console.log("globalLangeData===注入", i);
14
- }, y = (t = {}, a) => {
36
+ t && t.setAttribute("lang", f.value);
37
+ }, w = (t = {}, n) => {
38
+ const o = n === "global", a = !o, s = {};
39
+ for (const e in t)
40
+ for (const r in t[e])
41
+ s[r] || (s[r] = {}), s[r][e] = t[e][r] ?? "", o && (c[r] || (c[r] = {}), c[r][e] = s[r][e]), a && (i[r] || (i[r] = {}), i[r][e] = s[r][e]);
42
+ }, A = (t = {}, n) => {
15
43
  var s;
16
- const e = a === "global", r = !e;
17
- for (const o in t)
18
- if (e && !i[o] && (i[o] = t[o]), r) {
19
- const n = (s = t[o]) != null && s._appCode ? t[o]._appCode.toLowerCase() : "";
20
- n && (m[n] || (m[n] = {}), m[n][o] = t[o]), l[o] || (l[o] = t[o]);
44
+ const o = n === "global", a = !o;
45
+ for (const e in t)
46
+ if (o && !c[e] && (c[e] = t[e]), a) {
47
+ const r = (s = t[e]) != null && s._appCode ? t[e]._appCode.toLowerCase() : "";
48
+ r && (d[r] || (d[r] = {}), d[r][e] = t[e]), i[e] || (i[e] = t[e]);
21
49
  }
22
- }, R = async (t) => {
23
- p();
24
- const a = window[b];
25
- a && y(a, "global");
26
- }, v = (t) => {
27
- let a = "";
28
- const e = /\/([^\/]+)\/([^\/]+)\//, r = t.match(e);
29
- return r && r.length >= 3 && (a = r[1] + "/" + r[2]), a ? a.toLowerCase() : "";
30
- }, A = (t, ...a) => w(() => {
31
- const e = v(location.pathname);
32
- let r = m.framework ?? {}, s = m[e] ?? {}, o = l[t] || i[t] || r[t] || s[t] || t;
33
- if (o === t) return t;
34
- console.log("customLangeData===获取时", l, l[t]), console.log("globalLangeData===获取时", i, i[t]), typeof o == "string" && (o = { "zh-CN": o });
35
- let n = o[c.value];
36
- return c.value === "zh-CN" && o["zh-cn"] && !o["zh-CN"] && (n = o["zh-cn"]), a.map((f, d) => {
37
- n && (n = n.replace(`$${d}`, f));
38
- }), n;
39
- }), I = A, N = (t, ...a) => I(t, ...a).value, T = (t) => {
40
- c.value = t, console.log("currentLang.value===", c.value), p();
41
- }, _ = () => c, u = {
50
+ }, B = async (t) => {
51
+ E();
52
+ const n = window[z];
53
+ n && A(n, "global");
54
+ }, N = (t) => {
55
+ let n = "";
56
+ const o = /\/([^\/]+)\/([^\/]+)\//, a = t.match(o);
57
+ return a && a.length >= 3 && (n = a[1] + "/" + a[2]), n ? n.toLowerCase() : "";
58
+ }, R = (t, ...n) => j(() => {
59
+ const o = N(location.pathname);
60
+ let a = d.framework ?? {}, s = d[o] ?? {}, e = i[t] || c[t] || a[t] || s[t] || t;
61
+ if (e === t) return t;
62
+ typeof e == "string" && (e = { "zh-CN": e });
63
+ let r = e[f.value];
64
+ return f.value === "zh-CN" && e["zh-cn"] && !e["zh-CN"] && (r = e["zh-cn"]), n.map((m, u) => {
65
+ r && (r = r.replace(`$${u}`, m));
66
+ }), r;
67
+ }), k = R, F = (t, ...n) => k(t, ...n).value, v = (t) => {
68
+ f.value = t, E();
69
+ }, $ = () => f, y = {
42
70
  "en-US": { ant: () => import("ant-design-vue/es/locale/en_US"), dayjs: () => import("dayjs/locale/en") },
43
71
  "zh-CN": { ant: () => import("ant-design-vue/es/locale/zh_CN"), dayjs: () => import("dayjs/locale/zh-cn") },
44
72
  "zh-MO": { ant: () => import("ant-design-vue/es/locale/zh_TW"), dayjs: () => import("dayjs/locale/zh-tw") },
@@ -53,32 +81,43 @@ const C = "language", l = g({}), i = g({}), m = g({}), h = D(location.href, "uiC
53
81
  "nl-NL": { ant: () => import("ant-design-vue/es/locale/nl_NL"), dayjs: () => import("dayjs/locale/nl") },
54
82
  "tr-TR": { ant: () => import("ant-design-vue/es/locale/tr_TR"), dayjs: () => import("dayjs/locale/tr") }
55
83
  };
56
- function x(t, a) {
57
- var r;
58
- const e = window.DATE_FORMAT_MAP;
59
- return e && e[t] && e[t][a] ? e[t][a] : ((r = window.DATE_FORMAT_MAP[t]) == null ? void 0 : r[a]) || "YYYY-MM-DD";
84
+ function G(t, n) {
85
+ var a;
86
+ const o = window.DATE_FORMAT_MAP;
87
+ return o && o[t] && o[t][n] ? o[t][n] : ((a = window.DATE_FORMAT_MAP[t]) == null ? void 0 : a[n]) || "YYYY-MM-DD";
60
88
  }
61
- const O = async (t) => {
62
- const a = u[t] || u["zh-CN"];
89
+ const Y = async (t) => {
90
+ const n = y[t] || y["zh-CN"];
91
+ try {
92
+ const o = await n.ant();
93
+ return await n.dayjs(), o.default;
94
+ } catch (o) {
95
+ console.warn(`未找到对应的语言包: ${o}`);
96
+ }
97
+ }, K = async (t = [], n = "zh-CN") => {
63
98
  try {
64
- const e = await a.ant();
65
- return await a.dayjs(), e.default;
66
- } catch (e) {
67
- console.warn(`未找到对应的语言包: ${e}`);
99
+ const o = await U(t, n);
100
+ o != null && o.frontEnd && typeof o.frontEnd == "object" && Object.keys(o.frontEnd).length && t.forEach((a) => {
101
+ o.frontEnd[a] && typeof o.frontEnd[a] == "object" && Object.keys(o.frontEnd[a]).length ? w({ [n]: o.frontEnd[a] }) : console.warn(`No front-end i18n data found for app: ${a}`);
102
+ }), o != null && o.dasUiEnd && typeof o.dasUiEnd == "object" && Object.keys(o.dasUiEnd).length && w({ [n]: o.dasUiEnd }), v(n);
103
+ } catch (o) {
104
+ console.error("registerMicroI18nData error:", o);
68
105
  }
69
106
  };
70
107
  export {
71
- c as currentLang,
72
- l as customLangeData,
73
- x as getDateFormat,
74
- A as getI18nRule,
75
- _ as getLang,
76
- I as i18n,
77
- R as initI18n,
108
+ f as currentLang,
109
+ i as customLangeData,
110
+ G as getDateFormat,
111
+ R as getI18nRule,
112
+ $ as getLang,
113
+ k as i18n,
114
+ B as initI18n,
78
115
  C as languageKey,
79
- O as loadLocale,
80
- y as setI18nRule,
81
- T as setLang,
82
- M as setLangRule,
83
- N as t
116
+ Y as loadLocale,
117
+ x as microI18nStore,
118
+ K as registerMicroI18nData,
119
+ A as setI18nRule,
120
+ v as setLang,
121
+ w as setLangRule,
122
+ F as t
84
123
  };
Binary file