@das-fed/upf-web 6.4.0-hot.2 → 6.4.0-hot.4

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.
@@ -45,30 +45,32 @@ var F = {
45
45
  },
46
46
  v = pinia.createPinia();
47
47
  v.use(S);
48
- var I = "language",
49
- E = vue.reactive({});
48
+ var $ = "language",
49
+ y = vue.reactive({}),
50
+ G = vue.reactive({});
50
51
  vue.reactive({});
51
- vue.reactive({});
52
- var G = commonTools.getUrlParams(location.href, "uiCulture") || "",
53
- T = G || window.localStorage.getItem(I) || window.navigator.language || "zh-CN",
54
- R = vue.ref(T),
55
- J = function J() {
52
+ var T = commonTools.getUrlParams(location.href, "uiCulture") || "",
53
+ J = T || window.localStorage.getItem($) || window.navigator.language || "zh-CN",
54
+ R = vue.ref(J),
55
+ Q = function Q() {
56
56
  var e = document.documentElement;
57
57
  e && e.setAttribute("lang", R.value);
58
58
  },
59
- O = function O() {
59
+ j = function j() {
60
60
  var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
61
61
  var t = arguments.length > 1 ? arguments[1] : undefined;
62
+ console.log("setLangRule===", e, t);
62
63
  var r = {};
63
64
  for (var o in e) for (var a in e[o]) {
64
65
  var _e$o$a;
65
- r[a] || (r[a] = {}), r[a][o] = (_e$o$a = e[o][a]) !== null && _e$o$a !== void 0 ? _e$o$a : "", E[a] || (E[a] = {}), E[a][o] = r[a][o];
66
+ r[a] || (r[a] = {}), r[a][o] = (_e$o$a = e[o][a]) !== null && _e$o$a !== void 0 ? _e$o$a : "", y[a] || (y[a] = {}), y[a][o] = r[a][o];
66
67
  }
68
+ console.log("customLangeData===", y), console.log("globalLangeData===", G);
67
69
  },
68
- Q = function Q(e) {
69
- R.value = e, console.log("currentLang.value===", R.value), J();
70
+ V = function V(e) {
71
+ R.value = e, console.log("currentLang.value===", R.value), Q();
70
72
  },
71
- V = {
73
+ X = {
72
74
  loaded: {},
73
75
  isLoaded: function isLoaded(e, t) {
74
76
  return !!(this.loaded[e] && this.loaded[e][t]);
@@ -80,7 +82,7 @@ var G = commonTools.getUrlParams(location.href, "uiCulture") || "",
80
82
  this.loaded[e] && (delete this.loaded[e][t], Object.keys(this.loaded[e]).length === 0 && delete this.loaded[e]);
81
83
  }
82
84
  },
83
- X = /*#__PURE__*/function () {
85
+ Y = /*#__PURE__*/function () {
84
86
  var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(e, t) {
85
87
  var _ref2, _ref3, _ref4;
86
88
  var f, b, d, r, o, a, c, i, u, _t;
@@ -117,11 +119,11 @@ var G = commonTools.getUrlParams(location.href, "uiCulture") || "",
117
119
  }
118
120
  }, _callee, null, [[1, 4]]);
119
121
  }));
120
- return function X(_x, _x2) {
122
+ return function Y(_x, _x2) {
121
123
  return _ref.apply(this, arguments);
122
124
  };
123
125
  }(),
124
- Y = /*#__PURE__*/function () {
126
+ Z = /*#__PURE__*/function () {
125
127
  var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
126
128
  var e,
127
129
  t,
@@ -135,13 +137,14 @@ var G = commonTools.getUrlParams(location.href, "uiCulture") || "",
135
137
  t = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : "zh-CN";
136
138
  console.log("registerMicroI18nData===", e, t);
137
139
  _context2.p = 1;
140
+ V(t);
138
141
  _context2.n = 2;
139
- return X(e, t);
142
+ return Y(e, t);
140
143
  case 2:
141
144
  r = _context2.v;
142
- r != null && r.frontEnd && _typeof(r.frontEnd) == "object" && Object.keys(r.frontEnd).length && e.forEach(function (o) {
143
- r.frontEnd[o] && _typeof(r.frontEnd[o]) == "object" && Object.keys(r.frontEnd[o]).length ? O(_defineProperty({}, t, r.frontEnd[o])) : console.warn("No front-end i18n data found for app: ".concat(o));
144
- }), r != null && r.dasUiEnd && _typeof(r.dasUiEnd) == "object" && Object.keys(r.dasUiEnd).length && O(_defineProperty({}, t, r.dasUiEnd)), Q(t);
145
+ console.log("i18nData===", r), r != null && r.frontEnd && _typeof(r.frontEnd) == "object" && Object.keys(r.frontEnd).length && e.forEach(function (o) {
146
+ r.frontEnd[o] && _typeof(r.frontEnd[o]) == "object" && Object.keys(r.frontEnd[o]).length ? j(_defineProperty({}, t, r.frontEnd[o])) : console.warn("No front-end i18n data found for app: ".concat(o));
147
+ }), r != null && r.dasUiEnd && _typeof(r.dasUiEnd) == "object" && Object.keys(r.dasUiEnd).length && j(_defineProperty({}, t, r.dasUiEnd));
145
148
  _context2.n = 4;
146
149
  break;
147
150
  case 3:
@@ -153,15 +156,15 @@ var G = commonTools.getUrlParams(location.href, "uiCulture") || "",
153
156
  }
154
157
  }, _callee2, null, [[1, 3]]);
155
158
  }));
156
- return function Y() {
159
+ return function Z() {
157
160
  return _ref5.apply(this, arguments);
158
161
  };
159
162
  }(),
160
- Z = function Z(e) {
163
+ _ = function _(e) {
161
164
  var _ref6;
162
- var p, y, u, j, L;
165
+ var p, A, u, U, D;
163
166
  var t = (_ref6 = (p = e == null ? undefined : e.router) == null ? undefined : p.routerBase) !== null && _ref6 !== void 0 ? _ref6 : "/",
164
- r = ((y = e == null ? undefined : e.router) == null ? undefined : y.options) || {};
167
+ r = ((A = e == null ? undefined : e.router) == null ? undefined : A.options) || {};
165
168
  var o = Object.assign(((u = e == null ? undefined : e.router) == null ? undefined : u.glob) || {});
166
169
  var a = Object.values(o).filter(function (l) {
167
170
  return !!l;
@@ -170,9 +173,9 @@ var G = commonTools.getUrlParams(location.href, "uiCulture") || "",
170
173
  return ((_l$index = l.index) !== null && _l$index !== void 0 ? _l$index : 0) - ((_s$index = s.index) !== null && _s$index !== void 0 ? _s$index : 0);
171
174
  }),
172
175
  c = [];
173
- (j = e == null ? undefined : e.microApps) == null || j.map(function (l) {
174
- var A;
175
- var s = Object.values(((A = l.router) == null ? undefined : A.glob) || {}).filter(function (n) {
176
+ (U = e == null ? undefined : e.microApps) == null || U.map(function (l) {
177
+ var E;
178
+ var s = Object.values(((E = l.router) == null ? undefined : E.glob) || {}).filter(function (n) {
176
179
  return !!n;
177
180
  }).flat().sort(function (n, w) {
178
181
  var _n$index, _w$index;
@@ -200,13 +203,13 @@ var G = commonTools.getUrlParams(location.href, "uiCulture") || "",
200
203
  };
201
204
  })));
202
205
  });
203
- var i = ((L = e == null ? undefined : e.router) == null ? undefined : L.routers) || [],
206
+ var i = ((D = e == null ? undefined : e.router) == null ? undefined : D.routers) || [],
204
207
  f = [].concat(_toConsumableArray(k(a, e)), _toConsumableArray(k(i, e)), _toConsumableArray(k(c, e))),
205
208
  b = vueRouter.createRouter(_objectSpread({
206
209
  history: vueRouter.createWebHistory(t),
207
210
  routes: f
208
211
  }, r)),
209
- d = V;
212
+ d = X;
210
213
  if (Array.isArray(e == null ? undefined : e.microApps) && e.microApps.length && d) {
211
214
  var l = /* @__PURE__ */new Map();
212
215
  var _iterator = _createForOfIteratorHelper(e.microApps),
@@ -222,13 +225,13 @@ var G = commonTools.getUrlParams(location.href, "uiCulture") || "",
222
225
  _iterator.f();
223
226
  }
224
227
  b.beforeEach(/*#__PURE__*/function () {
225
- var _ref7 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(s, A, n) {
226
- var w, h, N, _iterator2, _step2, _step2$value, g, m, D, _t3, _t4, _t5;
228
+ var _ref7 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(s, E, n) {
229
+ var w, g, I, _iterator2, _step2, _step2$value, h, m, N, _t3, _t4, _t5;
227
230
  return _regenerator().w(function (_context3) {
228
231
  while (1) switch (_context3.p = _context3.n) {
229
232
  case 0:
230
233
  _context3.p = 0;
231
- h = ((w = s.query) == null ? void 0 : w.uiCulture) || window.localStorage.getItem(I) || window.navigator.language || "zh-CN", N = s.path || "";
234
+ g = ((w = s.query) == null ? void 0 : w.uiCulture) || window.localStorage.getItem($) || window.navigator.language || "zh-CN", I = s.path || "";
232
235
  _iterator2 = _createForOfIteratorHelper(l.entries());
233
236
  _context3.p = 1;
234
237
  _iterator2.s();
@@ -237,31 +240,31 @@ var G = commonTools.getUrlParams(location.href, "uiCulture") || "",
237
240
  _context3.n = 10;
238
241
  break;
239
242
  }
240
- _step2$value = _slicedToArray(_step2.value, 2), g = _step2$value[0], m = _step2$value[1];
241
- if (!(!g || !N.toLowerCase().startsWith("/".concat(g.toLowerCase())))) {
243
+ _step2$value = _slicedToArray(_step2.value, 2), h = _step2$value[0], m = _step2$value[1];
244
+ if (!(!h || !I.toLowerCase().startsWith("/".concat(h.toLowerCase())))) {
242
245
  _context3.n = 3;
243
246
  break;
244
247
  }
245
248
  return _context3.a(3, 9);
246
249
  case 3:
247
- if (!(d.isLoaded(h, g) || !m || !(m != null && m.length))) {
250
+ if (!(d.isLoaded(g, h) || !m || !(m != null && m.length))) {
248
251
  _context3.n = 4;
249
252
  break;
250
253
  }
251
254
  return _context3.a(3, 10);
252
255
  case 4:
253
- D = typeof m == "string" ? [m] : m;
254
- d.markLoaded(h, g);
256
+ N = typeof m == "string" ? [m] : m;
257
+ d.markLoaded(g, h);
255
258
  _context3.p = 5;
256
259
  _context3.n = 6;
257
- return Y(D, h);
260
+ return Z(N, g);
258
261
  case 6:
259
262
  _context3.n = 8;
260
263
  break;
261
264
  case 7:
262
265
  _context3.p = 7;
263
266
  _t3 = _context3.v;
264
- d.markUnloaded(h, g), console.error("[initRouter] load micro app i18n failed for ".concat(g, ":"), _t3);
267
+ d.markUnloaded(g, h), console.error("[initRouter] load micro app i18n failed for ".concat(h, ":"), _t3);
265
268
  case 8:
266
269
  return _context3.a(3, 10);
267
270
  case 9:
@@ -312,7 +315,7 @@ var G = commonTools.getUrlParams(location.href, "uiCulture") || "",
312
315
  });
313
316
  });
314
317
  },
315
- ce = function ce(e) {
318
+ le = function le(e) {
316
319
  var f;
317
320
  e || (e = {});
318
321
  var t = vue.ref(true);
@@ -325,8 +328,8 @@ var G = commonTools.getUrlParams(location.href, "uiCulture") || "",
325
328
  a = _ref9.props,
326
329
  c = vue.createApp(o || index$1.DasWebLayout, a);
327
330
  c.use(F, e), c.use(v);
328
- var _Z = Z(e),
329
- i = _Z.router;
331
+ var _ref0 = _(e),
332
+ i = _ref0.router;
330
333
  return c.use(i), c.mount(r || "#app"), (f = window.top) != null && f.vueRouter || window.top && (window.top.vueRouter = i), {
331
334
  app: c,
332
335
  router: i,
@@ -334,4 +337,4 @@ var G = commonTools.getUrlParams(location.href, "uiCulture") || "",
334
337
  store: v
335
338
  };
336
339
  };
337
- exports.createDasWebApp = ce;
340
+ exports.createDasWebApp = le;
@@ -1,4 +1,4 @@
1
- import { reactive as U, ref as $, createApp as x } from "vue";
1
+ import { reactive as L, ref as O, createApp as x } from "vue";
2
2
  import { initTheme as B } from "@das-fed/upf-web/packages/theme/index";
3
3
  import { DasWebLayout as M } from "@das-fed/upf-web/packages/layout/index";
4
4
  import { createPinia as W } from "pinia";
@@ -16,20 +16,21 @@ const F = {
16
16
  }
17
17
  }, v = W();
18
18
  v.use(S);
19
- const I = "language", E = U({});
20
- U({});
21
- U({});
22
- const G = H(location.href, "uiCulture") || "", T = G || window.localStorage.getItem(I) || window.navigator.language || "zh-CN", R = $(T), J = () => {
19
+ const $ = "language", y = L({}), G = L({});
20
+ L({});
21
+ const T = H(location.href, "uiCulture") || "", J = T || window.localStorage.getItem($) || window.navigator.language || "zh-CN", R = O(J), Q = () => {
23
22
  const e = document.documentElement;
24
23
  e && e.setAttribute("lang", R.value);
25
- }, O = (e = {}, t) => {
24
+ }, j = (e = {}, t) => {
25
+ console.log("setLangRule===", e, t);
26
26
  const r = {};
27
27
  for (const o in e)
28
28
  for (const a in e[o])
29
- r[a] || (r[a] = {}), r[a][o] = e[o][a] ?? "", E[a] || (E[a] = {}), E[a][o] = r[a][o];
30
- }, Q = (e) => {
31
- R.value = e, console.log("currentLang.value===", R.value), J();
32
- }, V = {
29
+ r[a] || (r[a] = {}), r[a][o] = e[o][a] ?? "", y[a] || (y[a] = {}), y[a][o] = r[a][o];
30
+ console.log("customLangeData===", y), console.log("globalLangeData===", G);
31
+ }, V = (e) => {
32
+ R.value = e, console.log("currentLang.value===", R.value), Q();
33
+ }, X = {
33
34
  loaded: {},
34
35
  isLoaded(e, t) {
35
36
  return !!(this.loaded[e] && this.loaded[e][t]);
@@ -40,7 +41,7 @@ const G = H(location.href, "uiCulture") || "", T = G || window.localStorage.getI
40
41
  markUnloaded(e, t) {
41
42
  this.loaded[e] && (delete this.loaded[e][t], Object.keys(this.loaded[e]).length === 0 && delete this.loaded[e]);
42
43
  }
43
- }, X = async (e, t) => {
44
+ }, Y = async (e, t) => {
44
45
  var f, b, d;
45
46
  const r = q() || {}, o = ((f = r.i18n) == null ? void 0 : f.fromOss) ?? !0, a = ((b = r.i18n) == null ? void 0 : b.isPullBack) ?? !1, c = ((d = r.i18n) == null ? void 0 : d.isDasUI) ?? !0;
46
47
  let i = "/oss/resource/";
@@ -59,24 +60,25 @@ const G = H(location.href, "uiCulture") || "", T = G || window.localStorage.getI
59
60
  } catch (p) {
60
61
  throw new Error(`registerResources error: ${p}`);
61
62
  }
62
- }, Y = async (e = [], t = "zh-CN") => {
63
+ }, Z = async (e = [], t = "zh-CN") => {
63
64
  console.log("registerMicroI18nData===", e, t);
64
65
  try {
65
- const r = await X(e, t);
66
- r != null && r.frontEnd && typeof r.frontEnd == "object" && Object.keys(r.frontEnd).length && e.forEach((o) => {
67
- r.frontEnd[o] && typeof r.frontEnd[o] == "object" && Object.keys(r.frontEnd[o]).length ? O({ [t]: r.frontEnd[o] }) : console.warn(`No front-end i18n data found for app: ${o}`);
68
- }), r != null && r.dasUiEnd && typeof r.dasUiEnd == "object" && Object.keys(r.dasUiEnd).length && O({ [t]: r.dasUiEnd }), Q(t);
66
+ V(t);
67
+ const r = await Y(e, t);
68
+ console.log("i18nData===", r), r != null && r.frontEnd && typeof r.frontEnd == "object" && Object.keys(r.frontEnd).length && e.forEach((o) => {
69
+ r.frontEnd[o] && typeof r.frontEnd[o] == "object" && Object.keys(r.frontEnd[o]).length ? j({ [t]: r.frontEnd[o] }) : console.warn(`No front-end i18n data found for app: ${o}`);
70
+ }), r != null && r.dasUiEnd && typeof r.dasUiEnd == "object" && Object.keys(r.dasUiEnd).length && j({ [t]: r.dasUiEnd });
69
71
  } catch (r) {
70
72
  console.error("registerMicroI18nData error:", r);
71
73
  }
72
- }, Z = (e) => {
73
- var p, y, u, j, L;
74
- const t = ((p = e == null ? void 0 : e.router) == null ? void 0 : p.routerBase) ?? "/", r = ((y = e == null ? void 0 : e.router) == null ? void 0 : y.options) || {};
74
+ }, _ = (e) => {
75
+ var p, A, u, U, D;
76
+ const t = ((p = e == null ? void 0 : e.router) == null ? void 0 : p.routerBase) ?? "/", r = ((A = e == null ? void 0 : e.router) == null ? void 0 : A.options) || {};
75
77
  let o = Object.assign(((u = e == null ? void 0 : e.router) == null ? void 0 : u.glob) || {});
76
78
  const a = Object.values(o).filter((l) => !!l).flat().sort((l, s) => (l.index ?? 0) - (s.index ?? 0)), c = [];
77
- (j = e == null ? void 0 : e.microApps) == null || j.map((l) => {
78
- var A;
79
- const s = Object.values(((A = l.router) == null ? void 0 : A.glob) || {}).filter((n) => !!n).flat().sort((n, w) => (n.index ?? 0) - (w.index ?? 0));
79
+ (U = e == null ? void 0 : e.microApps) == null || U.map((l) => {
80
+ var E;
81
+ const s = Object.values(((E = l.router) == null ? void 0 : E.glob) || {}).filter((n) => !!n).flat().sort((n, w) => (n.index ?? 0) - (w.index ?? 0));
80
82
  c.push(
81
83
  ...s.map((n) => ({ ...n, path: `/${l.microAppName}${n.path}` }))
82
84
  ), c.push(
@@ -87,33 +89,33 @@ const G = H(location.href, "uiCulture") || "", T = G || window.localStorage.getI
87
89
  }))
88
90
  );
89
91
  });
90
- const i = ((L = e == null ? void 0 : e.router) == null ? void 0 : L.routers) || [], f = [
92
+ const i = ((D = e == null ? void 0 : e.router) == null ? void 0 : D.routers) || [], f = [
91
93
  ...k(a, e),
92
94
  ...k(i, e),
93
95
  ...k(c, e)
94
- ], b = z({ history: C(t), routes: f, ...r }), d = V;
96
+ ], b = z({ history: C(t), routes: f, ...r }), d = X;
95
97
  if (Array.isArray(e == null ? void 0 : e.microApps) && e.microApps.length && d) {
96
98
  const l = /* @__PURE__ */ new Map();
97
99
  for (const s of e.microApps)
98
100
  s != null && s.microAppName && (s != null && s.i18n) && l.set(s.microAppName, s.i18n);
99
- b.beforeEach(async (s, A, n) => {
101
+ b.beforeEach(async (s, E, n) => {
100
102
  var w;
101
103
  try {
102
- const h = ((w = s.query) == null ? void 0 : w.uiCulture) || window.localStorage.getItem(I) || window.navigator.language || "zh-CN", N = s.path || "";
103
- for (const [g, m] of l.entries()) {
104
- if (!g || !N.toLowerCase().startsWith(`/${g.toLowerCase()}`)) continue;
105
- if (d.isLoaded(h, g) || !m || !(m != null && m.length)) break;
106
- const D = typeof m == "string" ? [m] : m;
107
- d.markLoaded(h, g);
104
+ const g = ((w = s.query) == null ? void 0 : w.uiCulture) || window.localStorage.getItem($) || window.navigator.language || "zh-CN", I = s.path || "";
105
+ for (const [h, m] of l.entries()) {
106
+ if (!h || !I.toLowerCase().startsWith(`/${h.toLowerCase()}`)) continue;
107
+ if (d.isLoaded(g, h) || !m || !(m != null && m.length)) break;
108
+ const N = typeof m == "string" ? [m] : m;
109
+ d.markLoaded(g, h);
108
110
  try {
109
- await Y(D, h);
111
+ await Z(N, g);
110
112
  } catch (P) {
111
- d.markUnloaded(h, g), console.error(`[initRouter] load micro app i18n failed for ${g}:`, P);
113
+ d.markUnloaded(g, h), console.error(`[initRouter] load micro app i18n failed for ${h}:`, P);
112
114
  }
113
115
  break;
114
116
  }
115
- } catch (h) {
116
- console.error("[initRouter] microApps i18n beforeEach handler error:", h);
117
+ } catch (g) {
118
+ console.error("[initRouter] microApps i18n beforeEach handler error:", g);
117
119
  } finally {
118
120
  n();
119
121
  }
@@ -123,18 +125,18 @@ const G = H(location.href, "uiCulture") || "", T = G || window.localStorage.getI
123
125
  }, k = (e, t) => e.map((r) => {
124
126
  const o = r.meta || {};
125
127
  return o.keepAlive = o.keepAlive ?? (t == null ? void 0 : t.keepAlive) ?? !0, { ...r, meta: o };
126
- }), ce = (e) => {
128
+ }), le = (e) => {
127
129
  var f;
128
130
  e || (e = {});
129
- const t = $(!0);
131
+ const t = O(!0);
130
132
  Promise.all([B(e)]).then(() => {
131
133
  t.value = !1;
132
134
  });
133
135
  const { container: r, component: o, props: a } = (e == null ? void 0 : e.root) || {}, c = x(o || M, a);
134
136
  c.use(F, e), c.use(v);
135
- const { router: i } = Z(e);
137
+ const { router: i } = _(e);
136
138
  return c.use(i), c.mount(r || "#app"), (f = window.top) != null && f.vueRouter || window.top && (window.top.vueRouter = i), { app: c, router: i, loading: t, store: v };
137
139
  };
138
140
  export {
139
- ce as createDasWebApp
141
+ le as createDasWebApp
140
142
  };
@@ -10,26 +10,28 @@ var vue = require('vue');
10
10
  var commonTools = require('@das-fed/upf-utils/common-tools');
11
11
  var D = "language",
12
12
  i = vue.reactive({}),
13
- c = vue.reactive({}),
13
+ l = vue.reactive({}),
14
14
  m = vue.reactive({}),
15
15
  h = commonTools.getUrlParams(location.href, "uiCulture") || "",
16
16
  j = h || window.localStorage.getItem(D) || window.navigator.language || "zh-CN",
17
- l = vue.ref(j),
17
+ c = vue.ref(j),
18
18
  y = "dasI18n",
19
- g = function g() {
19
+ p = function p() {
20
20
  var t = document.documentElement;
21
- t && t.setAttribute("lang", l.value);
21
+ t && t.setAttribute("lang", c.value);
22
22
  },
23
23
  M = function M() {
24
24
  var t = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
25
25
  var a = arguments.length > 1 ? arguments[1] : undefined;
26
26
  var e = a === "global",
27
- r = !e,
28
- s = {};
27
+ r = !e;
28
+ console.log("setLangRule===", t, a);
29
+ var s = {};
29
30
  for (var o in t) for (var n in t[o]) {
30
31
  var _t$o$n;
31
- s[n] || (s[n] = {}), s[n][o] = (_t$o$n = t[o][n]) !== null && _t$o$n !== void 0 ? _t$o$n : "", e && (c[n] || (c[n] = {}), c[n][o] = s[n][o]), r && (i[n] || (i[n] = {}), i[n][o] = s[n][o]);
32
+ s[n] || (s[n] = {}), s[n][o] = (_t$o$n = t[o][n]) !== null && _t$o$n !== void 0 ? _t$o$n : "", e && (l[n] || (l[n] = {}), l[n][o] = s[n][o]), r && (i[n] || (i[n] = {}), i[n][o] = s[n][o]);
32
33
  }
34
+ console.log("customLangeData===", i), console.log("globalLangeData===", l);
33
35
  },
34
36
  b = function b() {
35
37
  var t = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
@@ -37,11 +39,10 @@ var D = "language",
37
39
  var s;
38
40
  var e = a === "global",
39
41
  r = !e;
40
- for (var o in t) if (e && !c[o] && (c[o] = t[o]), r) {
42
+ for (var o in t) if (e && !l[o] && (l[o] = t[o]), r) {
41
43
  var n = (s = t[o]) != null && s._appCode ? t[o]._appCode.toLowerCase() : "";
42
44
  n && (m[n] || (m[n] = {}), m[n][o] = t[o]), i[o] || (i[o] = t[o]);
43
45
  }
44
- console.log("customLangeData===", i), console.log("globalLangeData===", c);
45
46
  },
46
47
  R = /*#__PURE__*/function () {
47
48
  var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(t) {
@@ -49,7 +50,7 @@ var D = "language",
49
50
  return _regenerator().w(function (_context) {
50
51
  while (1) switch (_context.n) {
51
52
  case 0:
52
- g();
53
+ p();
53
54
  a = window[y];
54
55
  a && b(a, "global");
55
56
  case 1:
@@ -76,13 +77,13 @@ var D = "language",
76
77
  var e = v(location.pathname);
77
78
  var r = (_m$framework = m.framework) !== null && _m$framework !== void 0 ? _m$framework : {},
78
79
  s = (_m$e = m[e]) !== null && _m$e !== void 0 ? _m$e : {},
79
- o = i[t] || c[t] || r[t] || s[t] || t;
80
+ o = i[t] || l[t] || r[t] || s[t] || t;
80
81
  if (o === t) return t;
81
- typeof o == "string" && (o = {
82
+ console.log("customLangeData===222", i), typeof o == "string" && (o = {
82
83
  "zh-CN": o
83
84
  });
84
- var n = o[l.value];
85
- return l.value === "zh-CN" && o["zh-cn"] && !o["zh-CN"] && (n = o["zh-cn"]), a.map(function (f, d) {
85
+ var n = o[c.value];
86
+ return c.value === "zh-CN" && o["zh-cn"] && !o["zh-CN"] && (n = o["zh-cn"]), a.map(function (f, d) {
86
87
  n && (n = n.replace("$".concat(d), f));
87
88
  }), n;
88
89
  });
@@ -95,12 +96,12 @@ var D = "language",
95
96
  return I.apply(void 0, [t].concat(a)).value;
96
97
  },
97
98
  T = function T(t) {
98
- l.value = t, console.log("currentLang.value===", l.value), g();
99
+ c.value = t, console.log("currentLang.value===", c.value), p();
99
100
  },
100
101
  _ = function _() {
101
- return l;
102
+ return c;
102
103
  },
103
- p = {
104
+ g = {
104
105
  "en-US": {
105
106
  ant: function ant() {
106
107
  return Promise.resolve().then(function () {
@@ -269,7 +270,7 @@ var O = /*#__PURE__*/function () {
269
270
  return _regenerator().w(function (_context2) {
270
271
  while (1) switch (_context2.p = _context2.n) {
271
272
  case 0:
272
- a = p[t] || p["zh-CN"];
273
+ a = g[t] || g["zh-CN"];
273
274
  _context2.p = 1;
274
275
  _context2.n = 2;
275
276
  return a.ant();
@@ -292,7 +293,7 @@ var O = /*#__PURE__*/function () {
292
293
  return _ref2.apply(this, arguments);
293
294
  };
294
295
  }();
295
- exports.currentLang = l;
296
+ exports.currentLang = c;
296
297
  exports.customLangeData = i;
297
298
  exports.getDateFormat = x;
298
299
  exports.getI18nRule = A;
@@ -1,24 +1,26 @@
1
1
  import { reactive as u, ref as L, computed as w } from "vue";
2
2
  import { getUrlParams as C } from "@das-fed/upf-utils/common-tools";
3
- const D = "language", i = u({}), c = u({}), m = u({}), h = C(location.href, "uiCulture") || "", j = h || window.localStorage.getItem(D) || window.navigator.language || "zh-CN", l = L(j), y = "dasI18n", g = () => {
3
+ const D = "language", i = u({}), l = u({}), m = u({}), h = C(location.href, "uiCulture") || "", j = h || window.localStorage.getItem(D) || window.navigator.language || "zh-CN", c = L(j), y = "dasI18n", p = () => {
4
4
  const t = document.documentElement;
5
- t && t.setAttribute("lang", l.value);
5
+ t && t.setAttribute("lang", c.value);
6
6
  }, M = (t = {}, a) => {
7
- const e = a === "global", r = !e, s = {};
7
+ const e = a === "global", r = !e;
8
+ console.log("setLangRule===", t, a);
9
+ const s = {};
8
10
  for (const o in t)
9
11
  for (const n in t[o])
10
- s[n] || (s[n] = {}), s[n][o] = t[o][n] ?? "", e && (c[n] || (c[n] = {}), c[n][o] = s[n][o]), r && (i[n] || (i[n] = {}), i[n][o] = s[n][o]);
12
+ s[n] || (s[n] = {}), s[n][o] = t[o][n] ?? "", e && (l[n] || (l[n] = {}), l[n][o] = s[n][o]), r && (i[n] || (i[n] = {}), i[n][o] = s[n][o]);
13
+ console.log("customLangeData===", i), console.log("globalLangeData===", l);
11
14
  }, b = (t = {}, a) => {
12
15
  var s;
13
16
  const e = a === "global", r = !e;
14
17
  for (const o in t)
15
- if (e && !c[o] && (c[o] = t[o]), r) {
18
+ if (e && !l[o] && (l[o] = t[o]), r) {
16
19
  const n = (s = t[o]) != null && s._appCode ? t[o]._appCode.toLowerCase() : "";
17
20
  n && (m[n] || (m[n] = {}), m[n][o] = t[o]), i[o] || (i[o] = t[o]);
18
21
  }
19
- console.log("customLangeData===", i), console.log("globalLangeData===", c);
20
22
  }, R = async (t) => {
21
- g();
23
+ p();
22
24
  const a = window[y];
23
25
  a && b(a, "global");
24
26
  }, v = (t) => {
@@ -27,16 +29,16 @@ const D = "language", i = u({}), c = u({}), m = u({}), h = C(location.href, "uiC
27
29
  return r && r.length >= 3 && (a = r[1] + "/" + r[2]), a ? a.toLowerCase() : "";
28
30
  }, A = (t, ...a) => w(() => {
29
31
  const e = v(location.pathname);
30
- let r = m.framework ?? {}, s = m[e] ?? {}, o = i[t] || c[t] || r[t] || s[t] || t;
32
+ let r = m.framework ?? {}, s = m[e] ?? {}, o = i[t] || l[t] || r[t] || s[t] || t;
31
33
  if (o === t) return t;
32
- typeof o == "string" && (o = { "zh-CN": o });
33
- let n = o[l.value];
34
- return l.value === "zh-CN" && o["zh-cn"] && !o["zh-CN"] && (n = o["zh-cn"]), a.map((f, d) => {
34
+ console.log("customLangeData===222", i), 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) => {
35
37
  n && (n = n.replace(`$${d}`, f));
36
38
  }), n;
37
39
  }), I = A, N = (t, ...a) => I(t, ...a).value, T = (t) => {
38
- l.value = t, console.log("currentLang.value===", l.value), g();
39
- }, _ = () => l, p = {
40
+ c.value = t, console.log("currentLang.value===", c.value), p();
41
+ }, _ = () => c, g = {
40
42
  "en-US": { ant: () => import("ant-design-vue/es/locale/en_US"), dayjs: () => import("dayjs/locale/en") },
41
43
  "zh-CN": { ant: () => import("ant-design-vue/es/locale/zh_CN"), dayjs: () => import("dayjs/locale/zh-cn") },
42
44
  "zh-MO": { ant: () => import("ant-design-vue/es/locale/zh_TW"), dayjs: () => import("dayjs/locale/zh-tw") },
@@ -57,7 +59,7 @@ function x(t, a) {
57
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";
58
60
  }
59
61
  const O = async (t) => {
60
- const a = p[t] || p["zh-CN"];
62
+ const a = g[t] || g["zh-CN"];
61
63
  try {
62
64
  const e = await a.ant();
63
65
  return await a.dayjs(), e.default;
@@ -66,7 +68,7 @@ const O = async (t) => {
66
68
  }
67
69
  };
68
70
  export {
69
- l as currentLang,
71
+ c as currentLang,
70
72
  i as customLangeData,
71
73
  x as getDateFormat,
72
74
  A as getI18nRule,
Binary file
Binary file
Binary file
Binary file
Binary file