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

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/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@das-fed/upf-web",
3
- "version": "6.4.0-hot.1",
3
+ "version": "6.4.0-hot.2",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "dependencies": {
7
- "@das-fed/upf-ui": "6.4.0-hot.1",
8
- "@das-fed/upf-utils": "6.4.0-hot.1",
9
- "@das-fed/upf-web": "6.4.0-hot.1",
10
- "@das-fed/upf-web-components": "6.4.0-hot.1",
7
+ "@das-fed/upf-ui": "6.4.0-hot.2",
8
+ "@das-fed/upf-utils": "6.4.0-hot.2",
9
+ "@das-fed/upf-web": "6.4.0-hot.2",
10
+ "@das-fed/upf-web-components": "6.4.0-hot.2",
11
11
  "@microsoft/signalr": "^8.0.7",
12
12
  "@vueuse/core": "^9.13.0",
13
13
  "animate.css": "^4.1.1",
@@ -19,7 +19,7 @@
19
19
  "vue-router": "^4.4.0"
20
20
  },
21
21
  "devDependencies": {
22
- "@das-fed/upf-cli": "6.4.0-hot.1",
22
+ "@das-fed/upf-cli": "6.4.0-hot.2",
23
23
  "@types/crypto-js": "^4.2.2",
24
24
  "@types/lodash": "^4.14.194",
25
25
  "@types/lodash-es": "^4.17.12",
@@ -25,17 +25,17 @@ var vue = require('vue');
25
25
  var index = require('@das-fed/upf-web/packages/theme/index/es5');
26
26
  var index$1 = require('@das-fed/upf-web/packages/layout/index/es5');
27
27
  var pinia = require('pinia');
28
- var C = require('pinia-plugin-persistedstate');
28
+ var S = require('pinia-plugin-persistedstate');
29
29
  var vueRouter = require('vue-router');
30
30
  var commonTools = require('@das-fed/upf-utils/common-tools');
31
31
  var config = require('@das-fed/upf-utils/config');
32
- var q = {
32
+ var F = {
33
33
  install: function install(e, t) {
34
- var s;
35
- var r = (s = t == null ? undefined : t.plugins) == null ? undefined : s.glob;
36
- r && Object.values(r).sort(function (a, o) {
37
- var _a$index, _o$index;
38
- return ((_a$index = a.index) !== null && _a$index !== void 0 ? _a$index : 0) - ((_o$index = o.index) !== null && _o$index !== void 0 ? _o$index : 0);
34
+ var o;
35
+ var r = (o = t == null ? undefined : t.plugins) == null ? undefined : o.glob;
36
+ r && Object.values(r).sort(function (a, c) {
37
+ var _a$index, _c$index;
38
+ return ((_a$index = a.index) !== null && _a$index !== void 0 ? _a$index : 0) - ((_c$index = c.index) !== null && _c$index !== void 0 ? _c$index : 0);
39
39
  }).filter(function (a) {
40
40
  return a ? !!(a["default"] && a["default"].install || a.install) : false;
41
41
  }).forEach(function (a) {
@@ -44,31 +44,31 @@ var q = {
44
44
  }
45
45
  },
46
46
  v = pinia.createPinia();
47
- v.use(C);
48
- var N = "language",
49
- k = vue.reactive({});
47
+ v.use(S);
48
+ var I = "language",
49
+ E = vue.reactive({});
50
50
  vue.reactive({});
51
51
  vue.reactive({});
52
- var F = commonTools.getUrlParams(location.href, "uiCulture") || "",
53
- G = F || window.localStorage.getItem(N) || window.navigator.language || "zh-CN",
54
- P = vue.ref(G),
55
- T = function T() {
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() {
56
56
  var e = document.documentElement;
57
- e && e.setAttribute("lang", P.value);
57
+ e && e.setAttribute("lang", R.value);
58
58
  },
59
- L = function L() {
59
+ O = function O() {
60
60
  var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
61
61
  var t = arguments.length > 1 ? arguments[1] : undefined;
62
62
  var r = {};
63
- for (var s in e) for (var a in e[s]) {
64
- var _e$s$a;
65
- r[a] || (r[a] = {}), r[a][s] = (_e$s$a = e[s][a]) !== null && _e$s$a !== void 0 ? _e$s$a : "", k[a] || (k[a] = {}), k[a][s] = r[a][s];
63
+ for (var o in e) for (var a in e[o]) {
64
+ 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
66
  }
67
67
  },
68
- J = function J(e) {
69
- P.value = e, T();
68
+ Q = function Q(e) {
69
+ R.value = e, console.log("currentLang.value===", R.value), J();
70
70
  },
71
- Q = {
71
+ V = {
72
72
  loaded: {},
73
73
  isLoaded: function isLoaded(e, t) {
74
74
  return !!(this.loaded[e] && this.loaded[e][t]);
@@ -80,24 +80,24 @@ var F = commonTools.getUrlParams(location.href, "uiCulture") || "",
80
80
  this.loaded[e] && (delete this.loaded[e][t], Object.keys(this.loaded[e]).length === 0 && delete this.loaded[e]);
81
81
  }
82
82
  },
83
- V = /*#__PURE__*/function () {
83
+ X = /*#__PURE__*/function () {
84
84
  var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(e, t) {
85
85
  var _ref2, _ref3, _ref4;
86
- var f, h, d, r, s, a, o, i, u, _t;
86
+ var f, b, d, r, o, a, c, i, u, _t;
87
87
  return _regenerator().w(function (_context) {
88
88
  while (1) switch (_context.p = _context.n) {
89
89
  case 0:
90
- r = config.getConfig() || {}, s = (_ref2 = (f = r.i18n) == null ? undefined : f.fromOss) !== null && _ref2 !== void 0 ? _ref2 : true, a = (_ref3 = (h = r.i18n) == null ? undefined : h.isPullBack) !== null && _ref3 !== void 0 ? _ref3 : false, o = (_ref4 = (d = r.i18n) == null ? undefined : d.isDasUI) !== null && _ref4 !== void 0 ? _ref4 : true;
90
+ r = config.getConfig() || {}, o = (_ref2 = (f = r.i18n) == null ? undefined : f.fromOss) !== null && _ref2 !== void 0 ? _ref2 : true, a = (_ref3 = (b = r.i18n) == null ? undefined : b.isPullBack) !== null && _ref3 !== void 0 ? _ref3 : false, c = (_ref4 = (d = r.i18n) == null ? undefined : d.isDasUI) !== null && _ref4 !== void 0 ? _ref4 : true;
91
91
  i = "/oss/resource/";
92
92
  _context.p = 1;
93
93
  _context.n = 2;
94
94
  return commonTools.handleI18nData({
95
- baseUrl: s ? i : "/",
95
+ baseUrl: o ? i : "/",
96
96
  currentLang: t,
97
97
  appName: e,
98
98
  isPullBack: a,
99
99
  fallbackBaseUrl: "/",
100
- isDasUI: o
100
+ isDasUI: c
101
101
  });
102
102
  case 2:
103
103
  u = _context.v;
@@ -117,11 +117,11 @@ var F = commonTools.getUrlParams(location.href, "uiCulture") || "",
117
117
  }
118
118
  }, _callee, null, [[1, 4]]);
119
119
  }));
120
- return function V(_x, _x2) {
120
+ return function X(_x, _x2) {
121
121
  return _ref.apply(this, arguments);
122
122
  };
123
123
  }(),
124
- X = /*#__PURE__*/function () {
124
+ Y = /*#__PURE__*/function () {
125
125
  var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
126
126
  var e,
127
127
  t,
@@ -133,100 +133,102 @@ var F = commonTools.getUrlParams(location.href, "uiCulture") || "",
133
133
  case 0:
134
134
  e = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : [];
135
135
  t = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : "zh-CN";
136
+ console.log("registerMicroI18nData===", e, t);
136
137
  _context2.p = 1;
137
138
  _context2.n = 2;
138
- return V(e, t);
139
+ return X(e, t);
139
140
  case 2:
140
141
  r = _context2.v;
141
- r != null && r.frontEnd && _typeof(r.frontEnd) == "object" && Object.keys(r.frontEnd).length && e.forEach(function (s) {
142
- r.frontEnd[s] && _typeof(r.frontEnd[s]) == "object" && Object.keys(r.frontEnd[s]).length && L(_defineProperty({}, t, r.frontEnd[s]));
143
- }), r != null && r.dasUiEnd && _typeof(r.dasUiEnd) == "object" && Object.keys(r.dasUiEnd).length && L(_defineProperty({}, t, r.dasUiEnd)), J(t);
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);
144
145
  _context2.n = 4;
145
146
  break;
146
147
  case 3:
147
148
  _context2.p = 3;
148
149
  _t2 = _context2.v;
150
+ console.error("registerMicroI18nData error:", _t2);
149
151
  case 4:
150
152
  return _context2.a(2);
151
153
  }
152
154
  }, _callee2, null, [[1, 3]]);
153
155
  }));
154
- return function X() {
156
+ return function Y() {
155
157
  return _ref5.apply(this, arguments);
156
158
  };
157
159
  }(),
158
- Y = function Y(e) {
160
+ Z = function Z(e) {
159
161
  var _ref6;
160
- var g, p, u, R, j;
161
- var t = (_ref6 = (g = e == null ? undefined : e.router) == null ? undefined : g.routerBase) !== null && _ref6 !== void 0 ? _ref6 : "/",
162
- r = ((p = e == null ? undefined : e.router) == null ? undefined : p.options) || {};
163
- var s = Object.assign(((u = e == null ? undefined : e.router) == null ? undefined : u.glob) || {});
164
- var a = Object.values(s).filter(function (l) {
162
+ var p, y, u, j, L;
163
+ 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) || {};
165
+ var o = Object.assign(((u = e == null ? undefined : e.router) == null ? undefined : u.glob) || {});
166
+ var a = Object.values(o).filter(function (l) {
165
167
  return !!l;
166
- }).flat().sort(function (l, n) {
167
- var _l$index, _n$index;
168
- return ((_l$index = l.index) !== null && _l$index !== void 0 ? _l$index : 0) - ((_n$index = n.index) !== null && _n$index !== void 0 ? _n$index : 0);
168
+ }).flat().sort(function (l, s) {
169
+ var _l$index, _s$index;
170
+ 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);
169
171
  }),
170
- o = [];
171
- (R = e == null ? undefined : e.microApps) == null || R.map(function (l) {
172
+ c = [];
173
+ (j = e == null ? undefined : e.microApps) == null || j.map(function (l) {
172
174
  var A;
173
- var n = Object.values(((A = l.router) == null ? undefined : A.glob) || {}).filter(function (c) {
174
- return !!c;
175
- }).flat().sort(function (c, w) {
176
- var _c$index, _w$index;
177
- return ((_c$index = c.index) !== null && _c$index !== void 0 ? _c$index : 0) - ((_w$index = w.index) !== null && _w$index !== void 0 ? _w$index : 0);
175
+ var s = Object.values(((A = l.router) == null ? undefined : A.glob) || {}).filter(function (n) {
176
+ return !!n;
177
+ }).flat().sort(function (n, w) {
178
+ var _n$index, _w$index;
179
+ return ((_n$index = n.index) !== null && _n$index !== void 0 ? _n$index : 0) - ((_w$index = w.index) !== null && _w$index !== void 0 ? _w$index : 0);
178
180
  });
179
- o.push.apply(o, _toConsumableArray(n.map(function (c) {
180
- return _objectSpread(_objectSpread({}, c), {}, {
181
- path: "/".concat(l.microAppName).concat(c.path)
181
+ c.push.apply(c, _toConsumableArray(s.map(function (n) {
182
+ return _objectSpread(_objectSpread({}, n), {}, {
183
+ path: "/".concat(l.microAppName).concat(n.path)
182
184
  });
183
- }))), o.push.apply(o, _toConsumableArray(n.filter(function (c) {
184
- return !!c.path;
185
- }).filter(function (c) {
186
- return c.path !== "";
187
- }).filter(function (c) {
188
- return c.path !== "/";
189
- }).filter(function (c) {
190
- return !c.path.startsWith("/".concat(c.microAppName));
191
- }).map(function (c) {
185
+ }))), c.push.apply(c, _toConsumableArray(s.filter(function (n) {
186
+ return !!n.path;
187
+ }).filter(function (n) {
188
+ return n.path !== "";
189
+ }).filter(function (n) {
190
+ return n.path !== "/";
191
+ }).filter(function (n) {
192
+ return !n.path.startsWith("/".concat(n.microAppName));
193
+ }).map(function (n) {
192
194
  return {
193
- path: c.path,
194
- redirect: "/".concat(l.microAppName).concat(c.path),
195
- meta: _objectSpread(_objectSpread({}, c.meta || {}), {}, {
195
+ path: n.path,
196
+ redirect: "/".concat(l.microAppName).concat(n.path),
197
+ meta: _objectSpread(_objectSpread({}, n.meta || {}), {}, {
196
198
  isMicroAppRouteRedirect: true
197
199
  })
198
200
  };
199
201
  })));
200
202
  });
201
- var i = ((j = e == null ? undefined : e.router) == null ? undefined : j.routers) || [],
202
- f = [].concat(_toConsumableArray(E(a, e)), _toConsumableArray(E(i, e)), _toConsumableArray(E(o, e))),
203
- h = vueRouter.createRouter(_objectSpread({
203
+ var i = ((L = e == null ? undefined : e.router) == null ? undefined : L.routers) || [],
204
+ f = [].concat(_toConsumableArray(k(a, e)), _toConsumableArray(k(i, e)), _toConsumableArray(k(c, e))),
205
+ b = vueRouter.createRouter(_objectSpread({
204
206
  history: vueRouter.createWebHistory(t),
205
207
  routes: f
206
208
  }, r)),
207
- d = Q;
209
+ d = V;
208
210
  if (Array.isArray(e == null ? undefined : e.microApps) && e.microApps.length && d) {
209
211
  var l = /* @__PURE__ */new Map();
210
212
  var _iterator = _createForOfIteratorHelper(e.microApps),
211
213
  _step;
212
214
  try {
213
215
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
214
- var n = _step.value;
215
- n != null && n.microAppName && n != null && n.i18n && l.set(n.microAppName, n.i18n);
216
+ var s = _step.value;
217
+ s != null && s.microAppName && s != null && s.i18n && l.set(s.microAppName, s.i18n);
216
218
  }
217
219
  } catch (err) {
218
220
  _iterator.e(err);
219
221
  } finally {
220
222
  _iterator.f();
221
223
  }
222
- h.beforeEach(/*#__PURE__*/function () {
223
- var _ref7 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(n, A, c) {
224
- var w, b, $, _iterator2, _step2, _step2$value, y, m, x, _t3, _t4, _t5;
224
+ 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;
225
227
  return _regenerator().w(function (_context3) {
226
228
  while (1) switch (_context3.p = _context3.n) {
227
229
  case 0:
228
230
  _context3.p = 0;
229
- b = ((w = n.query) == null ? void 0 : w.uiCulture) || window.localStorage.getItem(N) || window.navigator.language || "zh-CN", $ = n.path || "";
231
+ h = ((w = s.query) == null ? void 0 : w.uiCulture) || window.localStorage.getItem(I) || window.navigator.language || "zh-CN", N = s.path || "";
230
232
  _iterator2 = _createForOfIteratorHelper(l.entries());
231
233
  _context3.p = 1;
232
234
  _iterator2.s();
@@ -235,31 +237,31 @@ var F = commonTools.getUrlParams(location.href, "uiCulture") || "",
235
237
  _context3.n = 10;
236
238
  break;
237
239
  }
238
- _step2$value = _slicedToArray(_step2.value, 2), y = _step2$value[0], m = _step2$value[1];
239
- if (!(!y || !$.toLowerCase().startsWith("/".concat(y.toLowerCase())))) {
240
+ _step2$value = _slicedToArray(_step2.value, 2), g = _step2$value[0], m = _step2$value[1];
241
+ if (!(!g || !N.toLowerCase().startsWith("/".concat(g.toLowerCase())))) {
240
242
  _context3.n = 3;
241
243
  break;
242
244
  }
243
245
  return _context3.a(3, 9);
244
246
  case 3:
245
- if (!(d.isLoaded(b, y) || !m || !(m != null && m.length))) {
247
+ if (!(d.isLoaded(h, g) || !m || !(m != null && m.length))) {
246
248
  _context3.n = 4;
247
249
  break;
248
250
  }
249
251
  return _context3.a(3, 10);
250
252
  case 4:
251
- x = typeof m == "string" ? [m] : m;
252
- d.markLoaded(b, y);
253
+ D = typeof m == "string" ? [m] : m;
254
+ d.markLoaded(h, g);
253
255
  _context3.p = 5;
254
256
  _context3.n = 6;
255
- return X(x, b);
257
+ return Y(D, h);
256
258
  case 6:
257
259
  _context3.n = 8;
258
260
  break;
259
261
  case 7:
260
262
  _context3.p = 7;
261
263
  _t3 = _context3.v;
262
- d.markUnloaded(b, y);
264
+ d.markUnloaded(h, g), console.error("[initRouter] load micro app i18n failed for ".concat(g, ":"), _t3);
263
265
  case 8:
264
266
  return _context3.a(3, 10);
265
267
  case 9:
@@ -282,9 +284,10 @@ var F = commonTools.getUrlParams(location.href, "uiCulture") || "",
282
284
  case 14:
283
285
  _context3.p = 14;
284
286
  _t5 = _context3.v;
287
+ console.error("[initRouter] microApps i18n beforeEach handler error:", _t5);
285
288
  case 15:
286
289
  _context3.p = 15;
287
- c();
290
+ n();
288
291
  return _context3.f(15);
289
292
  case 16:
290
293
  return _context3.a(2);
@@ -297,19 +300,19 @@ var F = commonTools.getUrlParams(location.href, "uiCulture") || "",
297
300
  }());
298
301
  }
299
302
  return {
300
- router: h
303
+ router: b
301
304
  };
302
305
  },
303
- E = function E(e, t) {
306
+ k = function k(e, t) {
304
307
  return e.map(function (r) {
305
- var _ref8, _s$keepAlive;
306
- var s = r.meta || {};
307
- return s.keepAlive = (_ref8 = (_s$keepAlive = s.keepAlive) !== null && _s$keepAlive !== void 0 ? _s$keepAlive : t == null ? undefined : t.keepAlive) !== null && _ref8 !== void 0 ? _ref8 : true, _objectSpread(_objectSpread({}, r), {}, {
308
- meta: s
308
+ var _ref8, _o$keepAlive;
309
+ var o = r.meta || {};
310
+ return o.keepAlive = (_ref8 = (_o$keepAlive = o.keepAlive) !== null && _o$keepAlive !== void 0 ? _o$keepAlive : t == null ? undefined : t.keepAlive) !== null && _ref8 !== void 0 ? _ref8 : true, _objectSpread(_objectSpread({}, r), {}, {
311
+ meta: o
309
312
  });
310
313
  });
311
314
  },
312
- oe = function oe(e) {
315
+ ce = function ce(e) {
313
316
  var f;
314
317
  e || (e = {});
315
318
  var t = vue.ref(true);
@@ -318,17 +321,17 @@ var F = commonTools.getUrlParams(location.href, "uiCulture") || "",
318
321
  });
319
322
  var _ref9 = (e == null ? undefined : e.root) || {},
320
323
  r = _ref9.container,
321
- s = _ref9.component,
324
+ o = _ref9.component,
322
325
  a = _ref9.props,
323
- o = vue.createApp(s || index$1.DasWebLayout, a);
324
- o.use(q, e), o.use(v);
325
- var _Y = Y(e),
326
- i = _Y.router;
327
- return o.use(i), o.mount(r || "#app"), (f = window.top) != null && f.vueRouter || window.top && (window.top.vueRouter = i), {
328
- app: o,
326
+ c = vue.createApp(o || index$1.DasWebLayout, a);
327
+ c.use(F, e), c.use(v);
328
+ var _Z = Z(e),
329
+ i = _Z.router;
330
+ return c.use(i), c.mount(r || "#app"), (f = window.top) != null && f.vueRouter || window.top && (window.top.vueRouter = i), {
331
+ app: c,
329
332
  router: i,
330
333
  loading: t,
331
334
  store: v
332
335
  };
333
336
  };
334
- exports.createDasWebApp = oe;
337
+ exports.createDasWebApp = ce;
@@ -1,35 +1,35 @@
1
- import { reactive as U, ref as O, createApp as B } from "vue";
2
- import { initTheme as I } from "@das-fed/upf-web/packages/theme/index";
3
- import { DasWebLayout as D } from "@das-fed/upf-web/packages/layout/index";
1
+ import { reactive as U, ref as $, createApp as x } from "vue";
2
+ import { initTheme as B } from "@das-fed/upf-web/packages/theme/index";
3
+ import { DasWebLayout as M } from "@das-fed/upf-web/packages/layout/index";
4
4
  import { createPinia as W } from "pinia";
5
- import C from "pinia-plugin-persistedstate";
6
- import { createRouter as M, createWebHistory as S } from "vue-router";
7
- import { getUrlParams as z, handleI18nData as H } from "@das-fed/upf-utils/common-tools";
8
- import { getConfig as K } from "@das-fed/upf-utils/config";
9
- const q = {
5
+ import S from "pinia-plugin-persistedstate";
6
+ import { createRouter as z, createWebHistory as C } from "vue-router";
7
+ import { getUrlParams as H, handleI18nData as K } from "@das-fed/upf-utils/common-tools";
8
+ import { getConfig as q } from "@das-fed/upf-utils/config";
9
+ const F = {
10
10
  install: (e, t) => {
11
- var s;
12
- const r = (s = t == null ? void 0 : t.plugins) == null ? void 0 : s.glob;
13
- r && Object.values(r).sort((a, o) => (a.index ?? 0) - (o.index ?? 0)).filter((a) => a ? !!(a.default && a.default.install || a.install) : !1).forEach((a) => {
11
+ var o;
12
+ const r = (o = t == null ? void 0 : t.plugins) == null ? void 0 : o.glob;
13
+ r && Object.values(r).sort((a, c) => (a.index ?? 0) - (c.index ?? 0)).filter((a) => a ? !!(a.default && a.default.install || a.install) : !1).forEach((a) => {
14
14
  a.default && a.default.install && e.use(a.default, t), a.install && e.use(a, t);
15
15
  });
16
16
  }
17
17
  }, v = W();
18
- v.use(C);
19
- const N = "language", k = U({});
18
+ v.use(S);
19
+ const I = "language", E = U({});
20
20
  U({});
21
21
  U({});
22
- const F = z(location.href, "uiCulture") || "", G = F || window.localStorage.getItem(N) || window.navigator.language || "zh-CN", P = O(G), T = () => {
22
+ const G = H(location.href, "uiCulture") || "", T = G || window.localStorage.getItem(I) || window.navigator.language || "zh-CN", R = $(T), J = () => {
23
23
  const e = document.documentElement;
24
- e && e.setAttribute("lang", P.value);
25
- }, L = (e = {}, t) => {
24
+ e && e.setAttribute("lang", R.value);
25
+ }, O = (e = {}, t) => {
26
26
  const r = {};
27
- for (const s in e)
28
- for (const a in e[s])
29
- r[a] || (r[a] = {}), r[a][s] = e[s][a] ?? "", k[a] || (k[a] = {}), k[a][s] = r[a][s];
30
- }, J = (e) => {
31
- P.value = e, T();
32
- }, Q = {
27
+ for (const o in e)
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 = {
33
33
  loaded: {},
34
34
  isLoaded(e, t) {
35
35
  return !!(this.loaded[e] && this.loaded[e][t]);
@@ -40,98 +40,101 @@ const F = z(location.href, "uiCulture") || "", G = F || window.localStorage.getI
40
40
  markUnloaded(e, t) {
41
41
  this.loaded[e] && (delete this.loaded[e][t], Object.keys(this.loaded[e]).length === 0 && delete this.loaded[e]);
42
42
  }
43
- }, V = async (e, t) => {
44
- var f, h, d;
45
- const r = K() || {}, s = ((f = r.i18n) == null ? void 0 : f.fromOss) ?? !0, a = ((h = r.i18n) == null ? void 0 : h.isPullBack) ?? !1, o = ((d = r.i18n) == null ? void 0 : d.isDasUI) ?? !0;
43
+ }, X = async (e, t) => {
44
+ var f, b, d;
45
+ 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
46
  let i = "/oss/resource/";
47
47
  try {
48
- const u = await H({
49
- baseUrl: s ? i : "/",
48
+ const u = await K({
49
+ baseUrl: o ? i : "/",
50
50
  currentLang: t,
51
51
  appName: e,
52
52
  isPullBack: a,
53
53
  fallbackBaseUrl: "/",
54
- isDasUI: o
54
+ isDasUI: c
55
55
  });
56
56
  if (!u || !(u != null && u.frontEnd))
57
57
  throw new Error("Failed to fetch i18n data");
58
58
  return u;
59
- } catch (g) {
60
- throw new Error(`registerResources error: ${g}`);
59
+ } catch (p) {
60
+ throw new Error(`registerResources error: ${p}`);
61
61
  }
62
- }, X = async (e = [], t = "zh-CN") => {
62
+ }, Y = async (e = [], t = "zh-CN") => {
63
+ console.log("registerMicroI18nData===", e, t);
63
64
  try {
64
- const r = await V(e, t);
65
- r != null && r.frontEnd && typeof r.frontEnd == "object" && Object.keys(r.frontEnd).length && e.forEach((s) => {
66
- r.frontEnd[s] && typeof r.frontEnd[s] == "object" && Object.keys(r.frontEnd[s]).length && L({ [t]: r.frontEnd[s] });
67
- }), r != null && r.dasUiEnd && typeof r.dasUiEnd == "object" && Object.keys(r.dasUiEnd).length && L({ [t]: r.dasUiEnd }), J(t);
68
- } catch {
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);
69
+ } catch (r) {
70
+ console.error("registerMicroI18nData error:", r);
69
71
  }
70
- }, Y = (e) => {
71
- var g, p, u, R, j;
72
- const t = ((g = e == null ? void 0 : e.router) == null ? void 0 : g.routerBase) ?? "/", r = ((p = e == null ? void 0 : e.router) == null ? void 0 : p.options) || {};
73
- let s = Object.assign(((u = e == null ? void 0 : e.router) == null ? void 0 : u.glob) || {});
74
- const a = Object.values(s).filter((l) => !!l).flat().sort((l, n) => (l.index ?? 0) - (n.index ?? 0)), o = [];
75
- (R = e == null ? void 0 : e.microApps) == null || R.map((l) => {
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) || {};
75
+ let o = Object.assign(((u = e == null ? void 0 : e.router) == null ? void 0 : u.glob) || {});
76
+ 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) => {
76
78
  var A;
77
- const n = Object.values(((A = l.router) == null ? void 0 : A.glob) || {}).filter((c) => !!c).flat().sort((c, w) => (c.index ?? 0) - (w.index ?? 0));
78
- o.push(
79
- ...n.map((c) => ({ ...c, path: `/${l.microAppName}${c.path}` }))
80
- ), o.push(
81
- ...n.filter((c) => !!c.path).filter((c) => c.path !== "").filter((c) => c.path !== "/").filter((c) => !c.path.startsWith(`/${c.microAppName}`)).map((c) => ({
82
- path: c.path,
83
- redirect: `/${l.microAppName}${c.path}`,
84
- meta: { ...c.meta || {}, isMicroAppRouteRedirect: !0 }
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));
80
+ c.push(
81
+ ...s.map((n) => ({ ...n, path: `/${l.microAppName}${n.path}` }))
82
+ ), c.push(
83
+ ...s.filter((n) => !!n.path).filter((n) => n.path !== "").filter((n) => n.path !== "/").filter((n) => !n.path.startsWith(`/${n.microAppName}`)).map((n) => ({
84
+ path: n.path,
85
+ redirect: `/${l.microAppName}${n.path}`,
86
+ meta: { ...n.meta || {}, isMicroAppRouteRedirect: !0 }
85
87
  }))
86
88
  );
87
89
  });
88
- const i = ((j = e == null ? void 0 : e.router) == null ? void 0 : j.routers) || [], f = [
89
- ...E(a, e),
90
- ...E(i, e),
91
- ...E(o, e)
92
- ], h = M({ history: S(t), routes: f, ...r }), d = Q;
90
+ const i = ((L = e == null ? void 0 : e.router) == null ? void 0 : L.routers) || [], f = [
91
+ ...k(a, e),
92
+ ...k(i, e),
93
+ ...k(c, e)
94
+ ], b = z({ history: C(t), routes: f, ...r }), d = V;
93
95
  if (Array.isArray(e == null ? void 0 : e.microApps) && e.microApps.length && d) {
94
96
  const l = /* @__PURE__ */ new Map();
95
- for (const n of e.microApps)
96
- n != null && n.microAppName && (n != null && n.i18n) && l.set(n.microAppName, n.i18n);
97
- h.beforeEach(async (n, A, c) => {
97
+ for (const s of e.microApps)
98
+ s != null && s.microAppName && (s != null && s.i18n) && l.set(s.microAppName, s.i18n);
99
+ b.beforeEach(async (s, A, n) => {
98
100
  var w;
99
101
  try {
100
- const b = ((w = n.query) == null ? void 0 : w.uiCulture) || window.localStorage.getItem(N) || window.navigator.language || "zh-CN", $ = n.path || "";
101
- for (const [y, m] of l.entries()) {
102
- if (!y || !$.toLowerCase().startsWith(`/${y.toLowerCase()}`)) continue;
103
- if (d.isLoaded(b, y) || !m || !(m != null && m.length)) break;
104
- const x = typeof m == "string" ? [m] : m;
105
- d.markLoaded(b, y);
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);
106
108
  try {
107
- await X(x, b);
108
- } catch {
109
- d.markUnloaded(b, y);
109
+ await Y(D, h);
110
+ } catch (P) {
111
+ d.markUnloaded(h, g), console.error(`[initRouter] load micro app i18n failed for ${g}:`, P);
110
112
  }
111
113
  break;
112
114
  }
113
- } catch {
115
+ } catch (h) {
116
+ console.error("[initRouter] microApps i18n beforeEach handler error:", h);
114
117
  } finally {
115
- c();
118
+ n();
116
119
  }
117
120
  });
118
121
  }
119
- return { router: h };
120
- }, E = (e, t) => e.map((r) => {
121
- const s = r.meta || {};
122
- return s.keepAlive = s.keepAlive ?? (t == null ? void 0 : t.keepAlive) ?? !0, { ...r, meta: s };
123
- }), oe = (e) => {
122
+ return { router: b };
123
+ }, k = (e, t) => e.map((r) => {
124
+ const o = r.meta || {};
125
+ return o.keepAlive = o.keepAlive ?? (t == null ? void 0 : t.keepAlive) ?? !0, { ...r, meta: o };
126
+ }), ce = (e) => {
124
127
  var f;
125
128
  e || (e = {});
126
- const t = O(!0);
127
- Promise.all([I(e)]).then(() => {
129
+ const t = $(!0);
130
+ Promise.all([B(e)]).then(() => {
128
131
  t.value = !1;
129
132
  });
130
- const { container: r, component: s, props: a } = (e == null ? void 0 : e.root) || {}, o = B(s || D, a);
131
- o.use(q, e), o.use(v);
132
- const { router: i } = Y(e);
133
- return o.use(i), o.mount(r || "#app"), (f = window.top) != null && f.vueRouter || window.top && (window.top.vueRouter = i), { app: o, router: i, loading: t, store: v };
133
+ const { container: r, component: o, props: a } = (e == null ? void 0 : e.root) || {}, c = x(o || M, a);
134
+ c.use(F, e), c.use(v);
135
+ const { router: i } = Z(e);
136
+ 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 };
134
137
  };
135
138
  export {
136
- oe as createDasWebApp
139
+ ce as createDasWebApp
137
140
  };