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