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

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