@das-fed/upf-web 6.4.0-dev.203 → 6.4.0-dev.204
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 +66 -66
- package/{index-4gY_dDQ-.js → index-B8OU227U.js} +1 -1
- package/index-B8OU227U.js.gz +0 -0
- package/{index-DC6Eay0b.js → index-BDoN_kC5.js} +1 -1
- package/{index-DBJqJe-a.js → index-BTfDckHk.js} +748 -748
- package/index-BTfDckHk.js.gz +0 -0
- package/index.js +1 -1
- package/package.json +6 -6
- package/packages/create-das-web-app/es5.js +117 -117
- package/packages/create-das-web-app/index.js +94 -94
- package/packages/create-das-web-app/index.js.gz +0 -0
- package/packages/layout/index.js.gz +0 -0
- package/packages/micro-frontend/index.js.gz +0 -0
- package/types/i18n/microI18n.d.ts +5 -5
- package/index-4gY_dDQ-.js.gz +0 -0
- package/index-DBJqJe-a.js.gz +0 -0
|
@@ -1,112 +1,112 @@
|
|
|
1
|
-
import { reactive as
|
|
1
|
+
import { reactive as U, ref as O, createApp as B } from "vue";
|
|
2
2
|
import { initTheme as I } from "@das-fed/upf-web/packages/theme/index";
|
|
3
|
-
import { DasWebLayout as
|
|
4
|
-
import { createPinia as
|
|
5
|
-
import
|
|
6
|
-
import { createRouter as
|
|
7
|
-
import { getUrlParams as
|
|
8
|
-
import { getConfig as
|
|
9
|
-
const
|
|
10
|
-
install: (e,
|
|
11
|
-
var
|
|
12
|
-
const r = (
|
|
13
|
-
r && Object.values(r).sort((
|
|
14
|
-
|
|
3
|
+
import { DasWebLayout as D } from "@das-fed/upf-web/packages/layout/index";
|
|
4
|
+
import { createPinia as W } from "pinia";
|
|
5
|
+
import C from "pinia-plugin-persistedstate";
|
|
6
|
+
import { createRouter as M, createWebHistory as S } from "vue-router";
|
|
7
|
+
import { getUrlParams as z, handleI18nData as H } from "@das-fed/upf-utils/common-tools";
|
|
8
|
+
import { getConfig as K } from "@das-fed/upf-utils/config";
|
|
9
|
+
const q = {
|
|
10
|
+
install: (e, t) => {
|
|
11
|
+
var s;
|
|
12
|
+
const r = (s = t == null ? void 0 : t.plugins) == null ? void 0 : s.glob;
|
|
13
|
+
r && Object.values(r).sort((a, o) => (a.index ?? 0) - (o.index ?? 0)).filter((a) => a ? !!(a.default && a.default.install || a.install) : !1).forEach((a) => {
|
|
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
|
-
|
|
22
|
-
const
|
|
17
|
+
}, v = W();
|
|
18
|
+
v.use(C);
|
|
19
|
+
const N = "language", k = U({});
|
|
20
|
+
U({});
|
|
21
|
+
U({});
|
|
22
|
+
const F = z(location.href, "uiCulture") || "", G = F || window.localStorage.getItem(N) || window.navigator.language || "zh-CN", P = O(G), T = () => {
|
|
23
23
|
const e = document.documentElement;
|
|
24
|
-
e && e.setAttribute("lang",
|
|
25
|
-
},
|
|
24
|
+
e && e.setAttribute("lang", P.value);
|
|
25
|
+
}, L = (e = {}, t) => {
|
|
26
26
|
const r = {};
|
|
27
|
-
for (const
|
|
28
|
-
for (const
|
|
29
|
-
r[
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
},
|
|
27
|
+
for (const s in e)
|
|
28
|
+
for (const a in e[s])
|
|
29
|
+
r[a] || (r[a] = {}), r[a][s] = e[s][a] ?? "", k[a] || (k[a] = {}), k[a][s] = r[a][s];
|
|
30
|
+
}, J = (e) => {
|
|
31
|
+
P.value = e, T();
|
|
32
|
+
}, Q = {
|
|
33
33
|
loaded: {},
|
|
34
|
-
isLoaded(e) {
|
|
35
|
-
return !!this.loaded[e];
|
|
34
|
+
isLoaded(e, t) {
|
|
35
|
+
return !!(this.loaded[e] && this.loaded[e][t]);
|
|
36
36
|
},
|
|
37
|
-
markLoaded(e) {
|
|
38
|
-
this.loaded[e] = !0;
|
|
37
|
+
markLoaded(e, t) {
|
|
38
|
+
this.loaded[e] || (this.loaded[e] = {}), this.loaded[e][t] = !0;
|
|
39
39
|
},
|
|
40
|
-
markUnloaded(e) {
|
|
41
|
-
delete this.loaded[e];
|
|
40
|
+
markUnloaded(e, t) {
|
|
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
|
|
45
|
-
const r =
|
|
43
|
+
}, V = async (e, t) => {
|
|
44
|
+
var f, h, d;
|
|
45
|
+
const r = K() || {}, s = ((f = r.i18n) == null ? void 0 : f.fromOss) ?? !0, a = ((h = r.i18n) == null ? void 0 : h.isPullBack) ?? !1, o = ((d = r.i18n) == null ? void 0 : d.isDasUI) ?? !0;
|
|
46
46
|
let i = "/oss/resource/";
|
|
47
47
|
try {
|
|
48
|
-
const
|
|
49
|
-
baseUrl:
|
|
50
|
-
currentLang:
|
|
48
|
+
const u = await H({
|
|
49
|
+
baseUrl: s ? i : "/",
|
|
50
|
+
currentLang: t,
|
|
51
51
|
appName: e,
|
|
52
|
-
isPullBack:
|
|
52
|
+
isPullBack: a,
|
|
53
53
|
fallbackBaseUrl: "/",
|
|
54
|
-
isDasUI:
|
|
54
|
+
isDasUI: o
|
|
55
55
|
});
|
|
56
|
-
if (!
|
|
56
|
+
if (!u || !(u != null && u.frontEnd))
|
|
57
57
|
throw new Error("Failed to fetch i18n data");
|
|
58
|
-
return
|
|
59
|
-
} catch (
|
|
60
|
-
throw new Error(`registerResources error: ${
|
|
58
|
+
return u;
|
|
59
|
+
} catch (g) {
|
|
60
|
+
throw new Error(`registerResources error: ${g}`);
|
|
61
61
|
}
|
|
62
|
-
},
|
|
63
|
-
const n = O(location.href, "uiCulture") || window.localStorage.getItem(P) || window.navigator.language || "zh-CN";
|
|
62
|
+
}, X = async (e = [], t = "zh-CN") => {
|
|
64
63
|
try {
|
|
65
|
-
const r = await
|
|
66
|
-
r != null && r.frontEnd && typeof r.frontEnd == "object" && Object.keys(r.frontEnd).length && e.forEach((
|
|
67
|
-
r.frontEnd[
|
|
68
|
-
}), r != null && r.dasUiEnd && typeof r.dasUiEnd == "object" && Object.keys(r.dasUiEnd).length &&
|
|
64
|
+
const r = await V(e, t);
|
|
65
|
+
r != null && r.frontEnd && typeof r.frontEnd == "object" && Object.keys(r.frontEnd).length && e.forEach((s) => {
|
|
66
|
+
r.frontEnd[s] && typeof r.frontEnd[s] == "object" && Object.keys(r.frontEnd[s]).length && L({ [t]: r.frontEnd[s] });
|
|
67
|
+
}), r != null && r.dasUiEnd && typeof r.dasUiEnd == "object" && Object.keys(r.dasUiEnd).length && L({ [t]: r.dasUiEnd }), J(t);
|
|
69
68
|
} catch {
|
|
70
69
|
}
|
|
71
|
-
},
|
|
72
|
-
var
|
|
73
|
-
const
|
|
74
|
-
let
|
|
75
|
-
const
|
|
76
|
-
(
|
|
77
|
-
var
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
...
|
|
81
|
-
),
|
|
82
|
-
...
|
|
70
|
+
}, Y = (e) => {
|
|
71
|
+
var g, p, u, R, j;
|
|
72
|
+
const t = ((g = e == null ? void 0 : e.router) == null ? void 0 : g.routerBase) ?? "/", r = ((p = e == null ? void 0 : e.router) == null ? void 0 : p.options) || {};
|
|
73
|
+
let s = Object.assign(((u = e == null ? void 0 : e.router) == null ? void 0 : u.glob) || {});
|
|
74
|
+
const a = Object.values(s).filter((l) => !!l).flat().sort((l, n) => (l.index ?? 0) - (n.index ?? 0)), o = [];
|
|
75
|
+
(R = e == null ? void 0 : e.microApps) == null || R.map((l) => {
|
|
76
|
+
var A;
|
|
77
|
+
const n = Object.values(((A = l.router) == null ? void 0 : A.glob) || {}).filter((c) => !!c).flat().sort((c, w) => (c.index ?? 0) - (w.index ?? 0));
|
|
78
|
+
o.push(
|
|
79
|
+
...n.map((c) => ({ ...c, path: `/${l.microAppName}${c.path}` }))
|
|
80
|
+
), o.push(
|
|
81
|
+
...n.filter((c) => !!c.path).filter((c) => c.path !== "").filter((c) => c.path !== "/").filter((c) => !c.path.startsWith(`/${c.microAppName}`)).map((c) => ({
|
|
83
82
|
path: c.path,
|
|
84
|
-
redirect: `/${
|
|
83
|
+
redirect: `/${l.microAppName}${c.path}`,
|
|
85
84
|
meta: { ...c.meta || {}, isMicroAppRouteRedirect: !0 }
|
|
86
85
|
}))
|
|
87
86
|
);
|
|
88
87
|
});
|
|
89
|
-
const i = ((
|
|
90
|
-
...
|
|
91
|
-
...
|
|
92
|
-
...
|
|
93
|
-
],
|
|
94
|
-
if (Array.isArray(e == null ? void 0 : e.microApps) && e.microApps.length &&
|
|
95
|
-
const
|
|
96
|
-
for (const
|
|
97
|
-
|
|
98
|
-
|
|
88
|
+
const i = ((j = e == null ? void 0 : e.router) == null ? void 0 : j.routers) || [], f = [
|
|
89
|
+
...E(a, e),
|
|
90
|
+
...E(i, e),
|
|
91
|
+
...E(o, e)
|
|
92
|
+
], h = M({ history: S(t), routes: f, ...r }), d = Q;
|
|
93
|
+
if (Array.isArray(e == null ? void 0 : e.microApps) && e.microApps.length && d) {
|
|
94
|
+
const l = /* @__PURE__ */ new Map();
|
|
95
|
+
for (const n of e.microApps)
|
|
96
|
+
n != null && n.microAppName && (n != null && n.i18n) && l.set(n.microAppName, n.i18n);
|
|
97
|
+
h.beforeEach(async (n, A, c) => {
|
|
98
|
+
var w;
|
|
99
99
|
try {
|
|
100
|
-
const
|
|
101
|
-
for (const [
|
|
102
|
-
if (!
|
|
103
|
-
if (
|
|
100
|
+
const b = ((w = n.query) == null ? void 0 : w.uiCulture) || window.localStorage.getItem(N) || window.navigator.language || "zh-CN", $ = n.path || "";
|
|
101
|
+
for (const [y, m] of l.entries()) {
|
|
102
|
+
if (!y || !$.toLowerCase().startsWith(`/${y.toLowerCase()}`)) continue;
|
|
103
|
+
if (d.isLoaded(b, y) || !m || !(m != null && m.length)) break;
|
|
104
104
|
const x = typeof m == "string" ? [m] : m;
|
|
105
|
-
|
|
105
|
+
d.markLoaded(b, y);
|
|
106
106
|
try {
|
|
107
|
-
await
|
|
107
|
+
await X(x, b);
|
|
108
108
|
} catch {
|
|
109
|
-
|
|
109
|
+
d.markUnloaded(b, y);
|
|
110
110
|
}
|
|
111
111
|
break;
|
|
112
112
|
}
|
|
@@ -116,22 +116,22 @@ const K = O(location.href, "uiCulture") || "", F = K || window.localStorage.getI
|
|
|
116
116
|
}
|
|
117
117
|
});
|
|
118
118
|
}
|
|
119
|
-
return { router:
|
|
120
|
-
},
|
|
121
|
-
const
|
|
122
|
-
return
|
|
123
|
-
}),
|
|
124
|
-
var
|
|
119
|
+
return { router: h };
|
|
120
|
+
}, E = (e, t) => e.map((r) => {
|
|
121
|
+
const s = r.meta || {};
|
|
122
|
+
return s.keepAlive = s.keepAlive ?? (t == null ? void 0 : t.keepAlive) ?? !0, { ...r, meta: s };
|
|
123
|
+
}), oe = (e) => {
|
|
124
|
+
var f;
|
|
125
125
|
e || (e = {});
|
|
126
|
-
const
|
|
126
|
+
const t = O(!0);
|
|
127
127
|
Promise.all([I(e)]).then(() => {
|
|
128
|
-
|
|
128
|
+
t.value = !1;
|
|
129
129
|
});
|
|
130
|
-
const { container: r, component:
|
|
131
|
-
|
|
132
|
-
const { router: i } =
|
|
133
|
-
return
|
|
130
|
+
const { container: r, component: s, props: a } = (e == null ? void 0 : e.root) || {}, o = B(s || D, a);
|
|
131
|
+
o.use(q, e), o.use(v);
|
|
132
|
+
const { router: i } = Y(e);
|
|
133
|
+
return o.use(i), o.mount(r || "#app"), (f = window.top) != null && f.vueRouter || window.top && (window.top.vueRouter = i), { app: o, router: i, loading: t, store: v };
|
|
134
134
|
};
|
|
135
135
|
export {
|
|
136
|
-
|
|
136
|
+
oe as createDasWebApp
|
|
137
137
|
};
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -4,10 +4,10 @@ import { langType } from './type';
|
|
|
4
4
|
* 内存存储:记录本次页面会话中哪些 micro app 的 i18n 已加载。
|
|
5
5
|
*/
|
|
6
6
|
export declare const microI18nStore: {
|
|
7
|
-
loaded: Record<string, boolean
|
|
8
|
-
isLoaded(name: string): boolean;
|
|
9
|
-
markLoaded(name: string): void;
|
|
10
|
-
markUnloaded(name: string): void;
|
|
7
|
+
loaded: Record<string, Record<string, boolean>>;
|
|
8
|
+
isLoaded(lang: langType, name: string): boolean;
|
|
9
|
+
markLoaded(lang: langType, name: string): void;
|
|
10
|
+
markUnloaded(lang: langType, name: string): void;
|
|
11
11
|
};
|
|
12
12
|
export declare const registerI18nData: (appName: string[], currentLang: langType) => Promise<Record<string, any>>;
|
|
13
|
-
export declare const registerMicroI18nData: (i18nCodes?: string[]) => Promise<void>;
|
|
13
|
+
export declare const registerMicroI18nData: (i18nCodes?: string[], currentLang?: langType) => Promise<void>;
|
package/index-4gY_dDQ-.js.gz
DELETED
|
Binary file
|
package/index-DBJqJe-a.js.gz
DELETED
|
Binary file
|