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

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