@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.
- package/es5.js +13 -13
- package/{index-Dv9DDevb.js → index-BhEtGWg9.js} +1 -1
- package/index-BhEtGWg9.js.gz +0 -0
- package/{index-D5VSmbe-.js → index-CihmHNMg.js} +1 -1
- package/{index-DTDqZtIi.js → index-ClQkHyu0.js} +115 -117
- package/index-ClQkHyu0.js.gz +0 -0
- package/index.js +1 -1
- package/package.json +6 -6
- package/packages/create-das-web-app/es5.js +87 -87
- package/packages/create-das-web-app/index.js +71 -72
- package/packages/create-das-web-app/index.js.gz +0 -0
- package/packages/i18n/es5.js +18 -18
- package/packages/i18n/index.js +17 -17
- package/packages/i18n/index.js.gz +0 -0
- package/packages/layout/index.js.gz +0 -0
- package/packages/micro-frontend/index.js.gz +0 -0
- package/index-DTDqZtIi.js.gz +0 -0
- package/index-Dv9DDevb.js.gz +0 -0
|
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-
|
|
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.
|
|
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.
|
|
8
|
-
"@das-fed/upf-utils": "6.4.0-hot.
|
|
9
|
-
"@das-fed/upf-web": "6.4.0-hot.
|
|
10
|
-
"@das-fed/upf-web-components": "6.4.0-hot.
|
|
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.
|
|
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
|
|
35
|
-
var r = (
|
|
36
|
-
r && Object.values(r).sort(function (a,
|
|
37
|
-
var _a$index,
|
|
38
|
-
return ((_a$index = a.index) !== null && _a$index !== void 0 ? _a$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
|
-
|
|
47
|
-
|
|
48
|
-
var
|
|
49
|
-
|
|
50
|
-
|
|
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(
|
|
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
|
-
|
|
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
|
|
64
|
-
for (var o in e) for (var
|
|
65
|
-
var _e$o$
|
|
66
|
-
|
|
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
|
|
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,
|
|
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() || {},
|
|
93
|
-
|
|
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:
|
|
99
|
+
baseUrl: c ? n : "/",
|
|
98
100
|
currentLang: t,
|
|
99
101
|
appName: e,
|
|
100
102
|
isPullBack: a,
|
|
101
103
|
fallbackBaseUrl: "/",
|
|
102
|
-
isDasUI:
|
|
104
|
+
isDasUI: o
|
|
103
105
|
});
|
|
104
106
|
case 2:
|
|
105
|
-
|
|
106
|
-
if (!(!
|
|
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,
|
|
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
|
-
|
|
146
|
-
r.frontEnd[
|
|
147
|
-
}), r != null && r.dasUiEnd && _typeof(r.dasUiEnd) == "object" && Object.keys(r.dasUiEnd).length &&
|
|
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
|
|
166
|
-
var t = (_ref6 = (
|
|
167
|
-
r = ((
|
|
168
|
-
var
|
|
169
|
-
var a = Object.values(
|
|
170
|
-
return !!
|
|
171
|
-
}).flat().sort(function (
|
|
172
|
-
var
|
|
173
|
-
return ((
|
|
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
|
-
|
|
176
|
-
(
|
|
177
|
-
var
|
|
178
|
-
var
|
|
179
|
-
return !!
|
|
180
|
-
}).flat().sort(function (
|
|
181
|
-
var
|
|
182
|
-
return ((
|
|
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
|
-
|
|
185
|
-
return _objectSpread(_objectSpread({},
|
|
186
|
-
path: "/".concat(
|
|
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
|
-
}))),
|
|
189
|
-
return !!
|
|
190
|
-
}).filter(function (
|
|
191
|
-
return
|
|
192
|
-
}).filter(function (
|
|
193
|
-
return
|
|
194
|
-
}).filter(function (
|
|
195
|
-
return !
|
|
196
|
-
}).map(function (
|
|
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:
|
|
199
|
-
redirect: "/".concat(
|
|
200
|
-
meta: _objectSpread(_objectSpread({},
|
|
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
|
|
207
|
-
f = [].concat(_toConsumableArray(
|
|
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
|
|
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
|
|
220
|
-
|
|
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(
|
|
229
|
-
var
|
|
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 = ((
|
|
235
|
-
_iterator2 = _createForOfIteratorHelper(
|
|
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
|
-
|
|
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(
|
|
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
|
-
|
|
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
|
-
|
|
309
|
+
v = function v(e, t) {
|
|
310
310
|
return e.map(function (r) {
|
|
311
|
-
var _ref8,
|
|
312
|
-
var
|
|
313
|
-
return
|
|
314
|
-
meta:
|
|
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
|
-
|
|
327
|
+
c = _ref9.component,
|
|
328
328
|
a = _ref9.props,
|
|
329
|
-
|
|
330
|
-
|
|
329
|
+
o = vue.createApp(c || index$1.DasWebLayout, a);
|
|
330
|
+
o.use(F, e), o.use(L);
|
|
331
331
|
var _ref0 = _(e),
|
|
332
|
-
|
|
333
|
-
return
|
|
334
|
-
app:
|
|
335
|
-
router:
|
|
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:
|
|
337
|
+
store: L
|
|
338
338
|
};
|
|
339
339
|
};
|
|
340
340
|
exports.createDasWebApp = le;
|
|
@@ -1,33 +1,34 @@
|
|
|
1
|
-
import { reactive as
|
|
2
|
-
import { initTheme as
|
|
3
|
-
import { DasWebLayout as
|
|
4
|
-
import { createPinia as
|
|
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
|
|
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
|
|
12
|
-
const r = (
|
|
13
|
-
r && Object.values(r).sort((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
|
-
},
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
const T = H(location.href, "uiCulture") || "", J = T || window.localStorage.getItem(
|
|
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
|
-
},
|
|
24
|
+
}, $ = (e = {}, t) => {
|
|
25
|
+
const r = t === "global", c = !r;
|
|
25
26
|
console.log("setLangRule===", e, t);
|
|
26
|
-
const
|
|
27
|
+
const a = {};
|
|
27
28
|
for (const o in e)
|
|
28
|
-
for (const
|
|
29
|
-
|
|
30
|
-
console.log("customLangeData
|
|
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() || {},
|
|
47
|
-
let
|
|
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
|
|
50
|
-
baseUrl:
|
|
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:
|
|
56
|
+
isDasUI: o
|
|
56
57
|
});
|
|
57
|
-
if (!
|
|
58
|
+
if (!i || !(i != null && i.frontEnd))
|
|
58
59
|
throw new Error("Failed to fetch i18n data");
|
|
59
|
-
return
|
|
60
|
-
} catch (
|
|
61
|
-
throw new Error(`registerResources error: ${
|
|
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
|
-
|
|
69
|
-
r.frontEnd[
|
|
70
|
-
}), r != null && r.dasUiEnd && typeof r.dasUiEnd == "object" && Object.keys(r.dasUiEnd).length &&
|
|
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
|
|
76
|
-
const t = ((
|
|
77
|
-
let
|
|
78
|
-
const a = Object.values(
|
|
79
|
-
(
|
|
80
|
-
var
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
...
|
|
84
|
-
),
|
|
85
|
-
...
|
|
86
|
-
path:
|
|
87
|
-
redirect: `/${
|
|
88
|
-
meta: { ...
|
|
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
|
|
93
|
-
...
|
|
94
|
-
...
|
|
95
|
-
...
|
|
96
|
-
], b = z({ history:
|
|
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
|
|
99
|
-
for (const
|
|
100
|
-
|
|
101
|
-
b.beforeEach(async (
|
|
102
|
-
var
|
|
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 = ((
|
|
105
|
-
for (const [h, m] of
|
|
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
|
|
107
|
+
const P = typeof m == "string" ? [m] : m;
|
|
109
108
|
d.markLoaded(g, h);
|
|
110
109
|
try {
|
|
111
|
-
await Z(
|
|
112
|
-
} catch (
|
|
113
|
-
d.markUnloaded(g, h), console.error(`[initRouter] load micro app i18n failed for ${h}:`,
|
|
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
|
-
|
|
119
|
+
s();
|
|
121
120
|
}
|
|
122
121
|
});
|
|
123
122
|
}
|
|
124
123
|
return { router: b };
|
|
125
|
-
},
|
|
126
|
-
const
|
|
127
|
-
return
|
|
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 =
|
|
132
|
-
Promise.all([
|
|
130
|
+
const t = D(!0);
|
|
131
|
+
Promise.all([W(e)]).then(() => {
|
|
133
132
|
t.value = !1;
|
|
134
133
|
});
|
|
135
|
-
const { container: r, component:
|
|
136
|
-
|
|
137
|
-
const { router:
|
|
138
|
-
return
|
|
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
|
|
Binary file
|