@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/es5.js +2 -2
- package/{packages/main-app-framework/index-CTrEkjBn.js → index-BcEiAZYT.js} +1 -1
- package/index-BcEiAZYT.js.gz +0 -0
- package/{index-BrzqXXoy.js → index-CuxN_o3P.js} +7 -5
- package/index-CuxN_o3P.js.gz +0 -0
- package/{index-DYlUn0zE.js → index-Z2BfbNda.js} +1 -1
- package/index.js +1 -1
- package/package.json +6 -6
- package/packages/create-das-web-app/es5.js +105 -100
- package/packages/create-das-web-app/index.js +87 -83
- package/packages/create-das-web-app/index.js.gz +0 -0
- package/packages/i18n/es5.js +53 -50
- package/packages/i18n/index.js +41 -37
- package/packages/i18n/index.js.gz +0 -0
- package/packages/main-app-framework/es5.js +58 -58
- package/{index-C23JhEM4.js → packages/main-app-framework/index-BotXvTrW.js} +1 -1
- package/packages/main-app-framework/index-BotXvTrW.js.gz +0 -0
- package/packages/main-app-framework/{index-DP_6ucmg.js → index-C8tjINrY.js} +1 -1
- package/packages/main-app-framework/{index-g8fpmsMz.js → index-qZN6TvxI.js} +1334 -1315
- package/packages/main-app-framework/index-qZN6TvxI.js.gz +0 -0
- package/packages/main-app-framework/index.js +1 -1
- package/packages/micro-frontend/index.js.gz +0 -0
- package/index-BrzqXXoy.js.gz +0 -0
- package/index-C23JhEM4.js.gz +0 -0
- package/packages/main-app-framework/index-CTrEkjBn.js.gz +0 -0
- package/packages/main-app-framework/index-g8fpmsMz.js.gz +0 -0
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.3",
|
|
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.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.
|
|
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
|
|
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
|
|
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 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(
|
|
48
|
-
var
|
|
49
|
-
|
|
47
|
+
v.use(S);
|
|
48
|
+
var $ = "language",
|
|
49
|
+
y = vue.reactive({}),
|
|
50
|
+
G = vue.reactive({});
|
|
50
51
|
vue.reactive({});
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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",
|
|
57
|
+
e && e.setAttribute("lang", R.value);
|
|
58
58
|
},
|
|
59
|
-
|
|
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
|
|
64
|
-
var _e$
|
|
65
|
-
r[a] || (r[a] = {}), r[a][
|
|
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
|
-
|
|
69
|
-
|
|
70
|
+
V = function V(e) {
|
|
71
|
+
R.value = e, console.log("currentLang.value===", R.value), Q();
|
|
70
72
|
},
|
|
71
|
-
|
|
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
|
-
|
|
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,
|
|
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() || {},
|
|
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:
|
|
97
|
+
baseUrl: o ? i : "/",
|
|
96
98
|
currentLang: t,
|
|
97
99
|
appName: e,
|
|
98
100
|
isPullBack: a,
|
|
99
101
|
fallbackBaseUrl: "/",
|
|
100
|
-
isDasUI:
|
|
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
|
|
122
|
+
return function Y(_x, _x2) {
|
|
121
123
|
return _ref.apply(this, arguments);
|
|
122
124
|
};
|
|
123
125
|
}(),
|
|
124
|
-
|
|
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
|
|
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 (
|
|
142
|
-
r.frontEnd[
|
|
143
|
-
}), r != null && r.dasUiEnd && _typeof(r.dasUiEnd) == "object" && Object.keys(r.dasUiEnd).length &&
|
|
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
|
|
158
|
+
return function Z() {
|
|
155
159
|
return _ref5.apply(this, arguments);
|
|
156
160
|
};
|
|
157
161
|
}(),
|
|
158
|
-
|
|
162
|
+
_ = function _(e) {
|
|
159
163
|
var _ref6;
|
|
160
|
-
var
|
|
161
|
-
var t = (_ref6 = (
|
|
162
|
-
r = ((
|
|
163
|
-
var
|
|
164
|
-
var a = Object.values(
|
|
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,
|
|
167
|
-
var _l$index,
|
|
168
|
-
return ((_l$index = l.index) !== null && _l$index !== void 0 ? _l$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
|
-
|
|
171
|
-
(
|
|
172
|
-
var
|
|
173
|
-
var
|
|
174
|
-
return !!
|
|
175
|
-
}).flat().sort(function (
|
|
176
|
-
var
|
|
177
|
-
return ((
|
|
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
|
-
|
|
180
|
-
return _objectSpread(_objectSpread({},
|
|
181
|
-
path: "/".concat(l.microAppName).concat(
|
|
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
|
-
}))),
|
|
184
|
-
return !!
|
|
185
|
-
}).filter(function (
|
|
186
|
-
return
|
|
187
|
-
}).filter(function (
|
|
188
|
-
return
|
|
189
|
-
}).filter(function (
|
|
190
|
-
return !
|
|
191
|
-
}).map(function (
|
|
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:
|
|
194
|
-
redirect: "/".concat(l.microAppName).concat(
|
|
195
|
-
meta: _objectSpread(_objectSpread({},
|
|
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 = ((
|
|
202
|
-
f = [].concat(_toConsumableArray(
|
|
203
|
-
|
|
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 =
|
|
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
|
|
215
|
-
|
|
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
|
-
|
|
223
|
-
var _ref7 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(
|
|
224
|
-
var w,
|
|
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
|
-
|
|
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),
|
|
239
|
-
if (!(!
|
|
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(
|
|
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
|
-
|
|
252
|
-
d.markLoaded(
|
|
255
|
+
N = typeof m == "string" ? [m] : m;
|
|
256
|
+
d.markLoaded(g, h);
|
|
253
257
|
_context3.p = 5;
|
|
254
258
|
_context3.n = 6;
|
|
255
|
-
return
|
|
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(
|
|
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
|
-
|
|
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:
|
|
305
|
+
router: b
|
|
301
306
|
};
|
|
302
307
|
},
|
|
303
|
-
|
|
308
|
+
k = function k(e, t) {
|
|
304
309
|
return e.map(function (r) {
|
|
305
|
-
var _ref8,
|
|
306
|
-
var
|
|
307
|
-
return
|
|
308
|
-
meta:
|
|
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
|
-
|
|
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
|
-
|
|
326
|
+
o = _ref9.component,
|
|
322
327
|
a = _ref9.props,
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
var
|
|
326
|
-
i =
|
|
327
|
-
return
|
|
328
|
-
app:
|
|
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 =
|
|
339
|
+
exports.createDasWebApp = le;
|
|
@@ -1,35 +1,36 @@
|
|
|
1
|
-
import { reactive as
|
|
2
|
-
import { initTheme as
|
|
3
|
-
import { DasWebLayout as
|
|
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
|
|
6
|
-
import { createRouter as
|
|
7
|
-
import { getUrlParams as
|
|
8
|
-
import { getConfig as
|
|
9
|
-
const
|
|
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
|
|
12
|
-
const r = (
|
|
13
|
-
r && Object.values(r).sort((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(
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
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",
|
|
25
|
-
},
|
|
23
|
+
e && e.setAttribute("lang", R.value);
|
|
24
|
+
}, j = (e = {}, t) => {
|
|
25
|
+
console.log("setLangRule===", e, t);
|
|
26
26
|
const r = {};
|
|
27
|
-
for (const
|
|
28
|
-
for (const a in e[
|
|
29
|
-
r[a] || (r[a] = {}), r[a][
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
-
},
|
|
44
|
-
var f,
|
|
45
|
-
const r =
|
|
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
|
|
49
|
-
baseUrl:
|
|
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:
|
|
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 (
|
|
60
|
-
throw new Error(`registerResources error: ${
|
|
60
|
+
} catch (p) {
|
|
61
|
+
throw new Error(`registerResources error: ${p}`);
|
|
61
62
|
}
|
|
62
|
-
},
|
|
63
|
+
}, Z = async (e = [], t = "zh-CN") => {
|
|
64
|
+
console.log("registerMicroI18nData===", e, t);
|
|
63
65
|
try {
|
|
64
|
-
const r = await
|
|
65
|
-
r != null && r.frontEnd && typeof r.frontEnd == "object" && Object.keys(r.frontEnd).length && e.forEach((
|
|
66
|
-
r.frontEnd[
|
|
67
|
-
}), r != null && r.dasUiEnd && typeof r.dasUiEnd == "object" && Object.keys(r.dasUiEnd).length &&
|
|
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
|
-
},
|
|
71
|
-
var
|
|
72
|
-
const t = ((
|
|
73
|
-
let
|
|
74
|
-
const a = Object.values(
|
|
75
|
-
(
|
|
76
|
-
var
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
...
|
|
80
|
-
),
|
|
81
|
-
...
|
|
82
|
-
path:
|
|
83
|
-
redirect: `/${l.microAppName}${
|
|
84
|
-
meta: { ...
|
|
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 = ((
|
|
89
|
-
...
|
|
90
|
-
...
|
|
91
|
-
...
|
|
92
|
-
],
|
|
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
|
|
96
|
-
|
|
97
|
-
|
|
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
|
|
101
|
-
for (const [
|
|
102
|
-
if (!
|
|
103
|
-
if (d.isLoaded(
|
|
104
|
-
const
|
|
105
|
-
d.markLoaded(
|
|
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
|
|
108
|
-
} catch {
|
|
109
|
-
d.markUnloaded(
|
|
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
|
-
|
|
119
|
+
n();
|
|
116
120
|
}
|
|
117
121
|
});
|
|
118
122
|
}
|
|
119
|
-
return { router:
|
|
120
|
-
},
|
|
121
|
-
const
|
|
122
|
-
return
|
|
123
|
-
}),
|
|
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([
|
|
131
|
+
Promise.all([B(e)]).then(() => {
|
|
128
132
|
t.value = !1;
|
|
129
133
|
});
|
|
130
|
-
const { container: r, component:
|
|
131
|
-
|
|
132
|
-
const { router: i } =
|
|
133
|
-
return
|
|
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
|
-
|
|
140
|
+
le as createDasWebApp
|
|
137
141
|
};
|
|
Binary file
|