@das-fed/upf-web 6.4.0-dev.216 → 6.4.0-dev.217

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.
@@ -1,29 +1,29 @@
1
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";
2
+ import { handleI18nData as I, getUrlParams as L } from "@das-fed/upf-utils/common-tools";
3
+ import { getConfig as D } from "@das-fed/upf-utils/config";
4
4
  const x = {
5
5
  loaded: {},
6
- isLoaded(t, n) {
7
- return !!(this.loaded[t] && this.loaded[t][n]);
6
+ isLoaded(t, e) {
7
+ return !!(this.loaded[t] && this.loaded[t][e]);
8
8
  },
9
- markLoaded(t, n) {
10
- this.loaded[t] || (this.loaded[t] = {}), this.loaded[t][n] = !0;
9
+ markLoaded(t, e) {
10
+ this.loaded[t] || (this.loaded[t] = {}), this.loaded[t][e] = !0;
11
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]);
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
14
  }
15
- }, U = async (t, n) => {
15
+ }, U = async (t, e) => {
16
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;
17
+ const o = D() || {}, 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
18
  let r = "/oss/resource/";
19
19
  try {
20
20
  const l = await I({
21
21
  baseUrl: a ? r : "/",
22
- currentLang: n,
22
+ currentLang: e,
23
23
  appName: t,
24
24
  isPullBack: s,
25
25
  fallbackBaseUrl: "/",
26
- isDasUI: e
26
+ isDasUI: n
27
27
  });
28
28
  if (!l || !(l != null && l.frontEnd))
29
29
  throw new Error("Failed to fetch i18n data");
@@ -31,42 +31,42 @@ const x = {
31
31
  } catch (h) {
32
32
  throw new Error(`registerResources error: ${h}`);
33
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 = () => {
34
+ }, C = "language", i = p({}), c = p({}), d = p({}), M = L(location.href, "lang") || "", O = M || window.localStorage.getItem(C) || window.navigator.language || "zh-CN", f = b(O), z = "dasI18n", w = () => {
35
35
  const t = document.documentElement;
36
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) => {
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
43
  var s;
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]);
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]);
49
49
  }
50
50
  }, B = async (t) => {
51
- E();
52
- const n = window[z];
53
- n && A(n, "global");
54
- }, N = (t) => {
55
- let n = "";
51
+ w();
52
+ const e = window[z];
53
+ e && A(e, "global");
54
+ }, R = (t) => {
55
+ let e = "";
56
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) => {
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
65
  r && (r = r.replace(`$${u}`, m));
66
66
  }), r;
67
- }), k = R, F = (t, ...n) => k(t, ...n).value, v = (t) => {
68
- f.value = t, E();
69
- }, $ = () => f, y = {
67
+ }), v = k, F = (t, ...e) => v(t, ...e).value, N = (t) => {
68
+ f.value = t, w();
69
+ }, G = () => f, E = {
70
70
  "en-US": { ant: () => import("ant-design-vue/es/locale/en_US"), dayjs: () => import("dayjs/locale/en") },
71
71
  "zh-CN": { ant: () => import("ant-design-vue/es/locale/zh_CN"), dayjs: () => import("dayjs/locale/zh-cn") },
72
72
  "zh-MO": { ant: () => import("ant-design-vue/es/locale/zh_TW"), dayjs: () => import("dayjs/locale/zh-tw") },
@@ -81,43 +81,41 @@ const x = {
81
81
  "nl-NL": { ant: () => import("ant-design-vue/es/locale/nl_NL"), dayjs: () => import("dayjs/locale/nl") },
82
82
  "tr-TR": { ant: () => import("ant-design-vue/es/locale/tr_TR"), dayjs: () => import("dayjs/locale/tr") }
83
83
  };
84
- function G(t, n) {
84
+ function Y(t, e) {
85
85
  var a;
86
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";
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";
88
88
  }
89
- const Y = async (t) => {
90
- const n = y[t] || y["zh-CN"];
89
+ const K = async (t) => {
90
+ const e = E[t] || E["zh-CN"];
91
91
  try {
92
- const o = await n.ant();
93
- return await n.dayjs(), o.default;
94
- } catch (o) {
95
- console.warn(`未找到对应的语言包: ${o}`);
92
+ const o = await e.ant();
93
+ return await e.dayjs(), o.default;
94
+ } catch {
96
95
  }
97
- }, K = async (t = [], n = "zh-CN") => {
96
+ }, $ = async (t = [], e = "zh-CN") => {
98
97
  try {
99
- const o = await U(t, n);
98
+ const o = await U(t, e);
100
99
  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);
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);
102
+ } catch {
105
103
  }
106
104
  };
107
105
  export {
108
106
  f as currentLang,
109
107
  i as customLangeData,
110
- G as getDateFormat,
111
- R as getI18nRule,
112
- $ as getLang,
113
- k as i18n,
108
+ Y as getDateFormat,
109
+ k as getI18nRule,
110
+ G as getLang,
111
+ v as i18n,
114
112
  B as initI18n,
115
113
  C as languageKey,
116
- Y as loadLocale,
114
+ K as loadLocale,
117
115
  x as microI18nStore,
118
- K as registerMicroI18nData,
116
+ $ as registerMicroI18nData,
119
117
  A as setI18nRule,
120
- v as setLang,
121
- w as setLangRule,
118
+ N as setLang,
119
+ y as setLangRule,
122
120
  F as t
123
121
  };
Binary file