@morningfast/platform 0.0.8 → 0.0.10
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/dist/assets/main/style.css +4 -1
- package/dist/chunks/{Login-BcNNVCnZ.js → Login-BivuNuD7.js} +1 -1
- package/dist/chunks/{SystemConfig-CjcXN9Ma.js → SystemConfig-C7yyDmB8.js} +1 -1
- package/dist/chunks/{application-config-CGx7DctK.js → application-config-DLHtmY_2.js} +2 -2
- package/dist/chunks/{config-CKUWu-5b.js → config-Cd-9BYBy.js} +11 -8
- package/dist/chunks/{main-Ln0xOplS.js → main-BRpmAK9d.js} +441 -902
- package/dist/chunks/route-items-DZFRXefX.js +486 -0
- package/dist/index.js +8 -6
- package/dist/main/index.d.ts +3 -0
- package/dist/main/router/route-items.d.ts +15 -0
- package/dist/main.js +6 -4
- package/dist/sub/index.d.ts +2 -0
- package/dist/sub.js +3 -2
- package/package.json +1 -1
- /package/dist/chunks/{Forbidden-gf6y5Zsh.js → Forbidden-Cu2QQ-FY.js} +0 -0
- /package/dist/chunks/{NotFound-D0ybyfbK.js → NotFound-VRL7_aMx.js} +0 -0
- /package/dist/chunks/{_plugin-vue_export-helper-CZc-Y3Wh.js → _plugin-vue_export-helper-DvRHjpsZ.js} +0 -0
- /package/dist/chunks/{sub-DlD5e1ys.js → sub-D7y3UaHp.js} +0 -0
|
@@ -0,0 +1,486 @@
|
|
|
1
|
+
import { t as e } from "./_plugin-vue_export-helper-DvRHjpsZ.js";
|
|
2
|
+
import { n as t, r as n, s as r, t as i } from "./config-Cd-9BYBy.js";
|
|
3
|
+
import { useRoute as a } from "vue-router";
|
|
4
|
+
import { computed as o, createBlock as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, createTextVNode as d, createVNode as f, defineComponent as p, nextTick as m, onBeforeUnmount as h, onMounted as g, openBlock as _, reactive as v, ref as y, resolveComponent as b, toDisplayString as x, unref as S, watch as C, withCtx as w } from "vue";
|
|
5
|
+
import { defineStore as T } from "pinia";
|
|
6
|
+
import { Link as E, RefreshRight as D, WarningFilled as ee } from "@element-plus/icons-vue";
|
|
7
|
+
import { addGlobalUncaughtErrorHandler as O, registerMicroApps as k, start as A } from "qiankun";
|
|
8
|
+
//#region src/main/utils/theme.ts
|
|
9
|
+
var j = "theme-color", M = "theme-mode", N = "theme-position", P = [
|
|
10
|
+
{
|
|
11
|
+
label: "默认蓝",
|
|
12
|
+
value: "#409EFF"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
label: "深蓝色",
|
|
16
|
+
value: "#0960BE"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
label: "靛蓝色",
|
|
20
|
+
value: "#045277"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
label: "天空蓝",
|
|
24
|
+
value: "#78B5FE"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
label: "深绿色",
|
|
28
|
+
value: "#0C522B"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
label: "翡翠绿",
|
|
32
|
+
value: "#009773"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
label: "浅绿色",
|
|
36
|
+
value: "#0BD092"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
label: "紫罗兰",
|
|
40
|
+
value: "#7166F0"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
label: "樱花粉",
|
|
44
|
+
value: "#FFB7C5"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
label: "柠檬黄",
|
|
48
|
+
value: "#EFBD48"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
label: "橙黄色",
|
|
52
|
+
value: "#C1420B"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
label: "玫瑰红",
|
|
56
|
+
value: "#BB1B1B"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
label: "锌色灰",
|
|
60
|
+
value: "#3F3F46"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
label: "中性灰",
|
|
64
|
+
value: "#404040"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
label: "石板灰",
|
|
68
|
+
value: "#344256"
|
|
69
|
+
}
|
|
70
|
+
];
|
|
71
|
+
function F() {
|
|
72
|
+
return localStorage.getItem(j) || "#409EFF";
|
|
73
|
+
}
|
|
74
|
+
function I() {
|
|
75
|
+
let e = localStorage.getItem(M);
|
|
76
|
+
return e === "light" || e === "dark" || e === "system" ? e : "light";
|
|
77
|
+
}
|
|
78
|
+
function te(e) {
|
|
79
|
+
localStorage.setItem(j, e);
|
|
80
|
+
}
|
|
81
|
+
function ne(e) {
|
|
82
|
+
localStorage.setItem(M, e);
|
|
83
|
+
}
|
|
84
|
+
function re() {
|
|
85
|
+
let e = localStorage.getItem(N);
|
|
86
|
+
return e === "none" || e === "header" || e === "sidebar" ? e : "none";
|
|
87
|
+
}
|
|
88
|
+
function ie(e) {
|
|
89
|
+
localStorage.setItem(N, e);
|
|
90
|
+
}
|
|
91
|
+
function ae() {
|
|
92
|
+
return window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
93
|
+
}
|
|
94
|
+
function L(e) {
|
|
95
|
+
return e === "dark" || e === "system" && ae();
|
|
96
|
+
}
|
|
97
|
+
function R(e) {
|
|
98
|
+
let t = L(e);
|
|
99
|
+
document.documentElement.classList.toggle("dark", t), document.documentElement.style.colorScheme = t ? "dark" : "light";
|
|
100
|
+
}
|
|
101
|
+
function z(e) {
|
|
102
|
+
let t = document.documentElement, n = t.classList.contains("dark");
|
|
103
|
+
t.style.setProperty("--el-color-primary", e), t.style.setProperty("--el-color-primary-light-3", H(e, n ? "#000000" : "#ffffff", .3)), t.style.setProperty("--el-color-primary-light-5", H(e, n ? "#000000" : "#ffffff", .5)), t.style.setProperty("--el-color-primary-light-7", H(e, n ? "#000000" : "#ffffff", .7)), t.style.setProperty("--el-color-primary-light-8", H(e, n ? "#000000" : "#ffffff", .8)), t.style.setProperty("--el-color-primary-light-9", H(e, n ? "#000000" : "#ffffff", .9)), t.style.setProperty("--el-color-primary-dark-2", H(e, n ? "#ffffff" : "#000000", .2));
|
|
104
|
+
}
|
|
105
|
+
function oe() {
|
|
106
|
+
R(I()), z(F()), B(re());
|
|
107
|
+
}
|
|
108
|
+
function B(e) {
|
|
109
|
+
document.documentElement.setAttribute("data-theme-position", e);
|
|
110
|
+
}
|
|
111
|
+
function V(e = 50) {
|
|
112
|
+
return new Promise((t) => {
|
|
113
|
+
setTimeout(() => {
|
|
114
|
+
z(F()), t();
|
|
115
|
+
}, e);
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
async function se(e, t) {
|
|
119
|
+
if (!document.startViewTransition) {
|
|
120
|
+
t(), await V();
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
let n = e.clientX, r = e.clientY, i = Math.hypot(Math.max(n, innerWidth - n), Math.max(r, innerHeight - r));
|
|
124
|
+
try {
|
|
125
|
+
document.startViewTransition(() => {
|
|
126
|
+
t();
|
|
127
|
+
}).ready.then(() => {
|
|
128
|
+
let e = 100 * n / innerWidth, t = 100 * r / innerHeight, a = Math.hypot(innerWidth, innerHeight) / Math.SQRT2, o = 100 * i / a, s = [`circle(0% at ${e}% ${t}%)`, `circle(${o}% at ${e}% ${t}%)`], c = document.documentElement.classList.contains("dark");
|
|
129
|
+
document.documentElement.animate({ clipPath: c ? s.reverse() : s }, {
|
|
130
|
+
duration: 400,
|
|
131
|
+
easing: "ease-in",
|
|
132
|
+
fill: "both",
|
|
133
|
+
pseudoElement: c ? "::view-transition-old(root)" : "::view-transition-new(root)"
|
|
134
|
+
});
|
|
135
|
+
}), await V();
|
|
136
|
+
} catch {
|
|
137
|
+
t(), await V();
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
function H(e, t, n) {
|
|
141
|
+
let [r, i, a] = U(e), [o, s, c] = U(t), l = (e, t) => Math.round(e * (1 - n) + t * n);
|
|
142
|
+
return `rgb(${l(r, o)}, ${l(i, s)}, ${l(a, c)})`;
|
|
143
|
+
}
|
|
144
|
+
function U(e) {
|
|
145
|
+
let t = e.replace("#", ""), n = t.length === 3 ? t.split("").map((e) => e + e).join("") : t, r = Number.parseInt(n, 16);
|
|
146
|
+
return [
|
|
147
|
+
r >> 16 & 255,
|
|
148
|
+
r >> 8 & 255,
|
|
149
|
+
r & 255
|
|
150
|
+
];
|
|
151
|
+
}
|
|
152
|
+
//#endregion
|
|
153
|
+
//#region src/main/stores/app.ts
|
|
154
|
+
var W = "sidebar-collapsed", G = "menu-search-placement", K = "layout-mode", q = "top-menu-path", J = T("app", () => {
|
|
155
|
+
let e = y(localStorage.getItem(W) === "true"), t = y(!1), n = y("theme"), r = y(I()), i = y(F()), a = y(re()), s = y(localStorage.getItem(K) || "side"), c = y(localStorage.getItem(G) || "header"), l = y(localStorage.getItem(q) || ""), u = y(!0), d = o(() => L(r.value)), f = o(() => s.value === "top" ? ["header"] : ["header", "sidebar"]), p = o(() => s.value !== "top" && c.value === "sidebar");
|
|
156
|
+
function m() {
|
|
157
|
+
e.value = !e.value;
|
|
158
|
+
}
|
|
159
|
+
function h(t) {
|
|
160
|
+
e.value = t, localStorage.setItem(W, String(e.value));
|
|
161
|
+
}
|
|
162
|
+
function g(e = "theme") {
|
|
163
|
+
n.value = e, t.value = !0;
|
|
164
|
+
}
|
|
165
|
+
function _() {
|
|
166
|
+
t.value = !1;
|
|
167
|
+
}
|
|
168
|
+
function v(e) {
|
|
169
|
+
t.value = e;
|
|
170
|
+
}
|
|
171
|
+
function b(e) {
|
|
172
|
+
r.value = e, ne(e), R(e), z(i.value);
|
|
173
|
+
}
|
|
174
|
+
function x() {
|
|
175
|
+
b(ae() && r.value === "system" || d.value ? "light" : "dark");
|
|
176
|
+
}
|
|
177
|
+
function S(e) {
|
|
178
|
+
i.value = e, te(e), z(e);
|
|
179
|
+
}
|
|
180
|
+
function C(e) {
|
|
181
|
+
a.value = e, ie(e), B(e);
|
|
182
|
+
}
|
|
183
|
+
function w(e) {
|
|
184
|
+
s.value = e, localStorage.setItem(K, e), e === "top" && c.value === "sidebar" && T("header");
|
|
185
|
+
}
|
|
186
|
+
function T(e) {
|
|
187
|
+
let t = s.value === "top" ? "header" : e;
|
|
188
|
+
c.value = t, localStorage.setItem(G, t);
|
|
189
|
+
}
|
|
190
|
+
function E(e) {
|
|
191
|
+
l.value = e, localStorage.setItem(q, e);
|
|
192
|
+
}
|
|
193
|
+
function D() {
|
|
194
|
+
oe();
|
|
195
|
+
}
|
|
196
|
+
return {
|
|
197
|
+
closeSettings: _,
|
|
198
|
+
initializePreferences: D,
|
|
199
|
+
isDark: d,
|
|
200
|
+
layoutMode: s,
|
|
201
|
+
menuSearchPlacement: c,
|
|
202
|
+
menuSearchPlacementOptions: f,
|
|
203
|
+
openSettings: g,
|
|
204
|
+
isSidebarMenuSearch: p,
|
|
205
|
+
settingsActiveTab: n,
|
|
206
|
+
selectedTopMenuPath: l,
|
|
207
|
+
setLayoutMode: w,
|
|
208
|
+
setMenuSearchPlacement: T,
|
|
209
|
+
setSelectedTopMenuPath: E,
|
|
210
|
+
setSettingsVisible: v,
|
|
211
|
+
setSidebarCollapsed: h,
|
|
212
|
+
setThemeColor: S,
|
|
213
|
+
setThemeColorPosition: C,
|
|
214
|
+
setThemeMode: b,
|
|
215
|
+
settingsVisible: t,
|
|
216
|
+
sidebarCollapsed: e,
|
|
217
|
+
shortcutTipVisible: u,
|
|
218
|
+
themeColor: i,
|
|
219
|
+
themeColorPosition: a,
|
|
220
|
+
themeMode: r,
|
|
221
|
+
toggleDarkMode: x,
|
|
222
|
+
toggleSidebar: m
|
|
223
|
+
};
|
|
224
|
+
}), Y = v({}), X = v({});
|
|
225
|
+
function ce() {
|
|
226
|
+
return Y;
|
|
227
|
+
}
|
|
228
|
+
function le(e) {
|
|
229
|
+
return X[e];
|
|
230
|
+
}
|
|
231
|
+
function ue(e) {
|
|
232
|
+
return n(t()).find((t) => e === t.activeRule || e.startsWith(`${t.activeRule}/`));
|
|
233
|
+
}
|
|
234
|
+
function de(e) {
|
|
235
|
+
return Y[e.name] || (Y[e.name] = {
|
|
236
|
+
name: e.name,
|
|
237
|
+
title: e.title,
|
|
238
|
+
entry: e.entry,
|
|
239
|
+
activeRule: e.activeRule,
|
|
240
|
+
status: "idle",
|
|
241
|
+
updatedAt: Date.now()
|
|
242
|
+
}, Y[e.name]);
|
|
243
|
+
}
|
|
244
|
+
function fe(e) {
|
|
245
|
+
ve(e, {
|
|
246
|
+
status: "loading",
|
|
247
|
+
message: void 0
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
function pe(e) {
|
|
251
|
+
ve(e, {
|
|
252
|
+
status: "mounted",
|
|
253
|
+
message: void 0
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
function me(e, t) {
|
|
257
|
+
ye(e, {
|
|
258
|
+
status: "error",
|
|
259
|
+
message: Z(t)
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
function he(e, t) {
|
|
263
|
+
let n = Y[e];
|
|
264
|
+
return n ? (n.status = "error", n.message = Z(t), n.updatedAt = Date.now(), !0) : !1;
|
|
265
|
+
}
|
|
266
|
+
function ge(e, t, n) {
|
|
267
|
+
X[t] = {
|
|
268
|
+
path: t,
|
|
269
|
+
name: e.name,
|
|
270
|
+
title: e.title,
|
|
271
|
+
entry: e.entry,
|
|
272
|
+
activeRule: e.activeRule,
|
|
273
|
+
message: Z(n),
|
|
274
|
+
updatedAt: Date.now()
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
function _e(e) {
|
|
278
|
+
delete X[e];
|
|
279
|
+
}
|
|
280
|
+
function ve(e, t) {
|
|
281
|
+
let n = Y[e];
|
|
282
|
+
n && (n.status = t.status, n.message = t.message, n.updatedAt = Date.now());
|
|
283
|
+
}
|
|
284
|
+
function ye(e, t) {
|
|
285
|
+
let n = de(e);
|
|
286
|
+
n.title = e.title, n.entry = e.entry, n.activeRule = e.activeRule, n.status = t.status, n.message = t.message, n.updatedAt = Date.now();
|
|
287
|
+
}
|
|
288
|
+
function Z(e) {
|
|
289
|
+
let t = be(e);
|
|
290
|
+
return t ? Se(xe(t)) : "子应用入口不可访问、服务未启动,或加载过程中发生异常。";
|
|
291
|
+
}
|
|
292
|
+
function be(e) {
|
|
293
|
+
return e instanceof Error ? e.message : typeof e == "string" ? e : "";
|
|
294
|
+
}
|
|
295
|
+
function xe(e) {
|
|
296
|
+
return e.trim().replace(/^(application ['"][^'"]+['"] died in status [A-Z_]+:\s*)\1+/, "$1");
|
|
297
|
+
}
|
|
298
|
+
function Se(e) {
|
|
299
|
+
let t = e.trim(), n = t.toLowerCase(), r = t.match(/application ['"]([^'"]+)['"]/)?.[1], i = r ? `子应用“${r}”` : "子应用";
|
|
300
|
+
return n.includes("cannot use import statement outside a module") ? `${i}入口已响应,但脚本格式不是 qiankun 当前加载方式可执行的格式。请确认子应用使用 qiankun dev 模式启动,或检查子应用构建配置是否输出 qiankun 需要的入口格式;同时确认主应用配置的入口地址指向子应用 dev server,而不是普通静态文件地址。` : n.includes("unexpected token <") ? `${i}入口返回了 HTML,但 qiankun 正在按脚本解析。请检查入口地址是否填错、子应用服务是否启动,以及访问入口时是否被重定向到了登录页或 404 页面。` : n.includes("failed to fetch") || n.includes("networkerror") || n.includes("load failed") || n.includes("loading source code") || n.includes("loading_source_code") ? `${i}入口资源加载失败。请确认子应用服务已启动、入口地址可直接访问,并检查浏览器控制台是否有跨域、404 或网络连接错误。` : n.includes("application died in status not_mounted") ? `${i}加载后挂载失败。请检查子应用是否正确导出了 qiankun 生命周期,并确认挂载容器和路由基座配置正确。` : t;
|
|
301
|
+
}
|
|
302
|
+
//#endregion
|
|
303
|
+
//#region src/main/micro-apps/types.ts
|
|
304
|
+
var Ce = "morningfast:theme-change", we = !1, Te = !1;
|
|
305
|
+
function Ee() {
|
|
306
|
+
if (we) {
|
|
307
|
+
De();
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
we = !0;
|
|
311
|
+
let e = n(t());
|
|
312
|
+
e.forEach(de), k(e.map((e) => ({
|
|
313
|
+
name: e.name,
|
|
314
|
+
entry: e.entry,
|
|
315
|
+
container: e.container,
|
|
316
|
+
activeRule: e.activeRule,
|
|
317
|
+
props: ke(e)
|
|
318
|
+
})), {
|
|
319
|
+
beforeLoad: [async (e) => {
|
|
320
|
+
_e(window.location.pathname), fe(e.name);
|
|
321
|
+
}],
|
|
322
|
+
afterMount: [async (e) => {
|
|
323
|
+
_e(window.location.pathname), pe(e.name);
|
|
324
|
+
}]
|
|
325
|
+
}), O((t) => {
|
|
326
|
+
let n = t instanceof ErrorEvent ? t.error || t.message : t, r = Oe(n) || Oe(t);
|
|
327
|
+
if (r && he(r, n)) {
|
|
328
|
+
let t = e.find((e) => e.name === r);
|
|
329
|
+
t && ge(t, window.location.pathname, n);
|
|
330
|
+
return;
|
|
331
|
+
}
|
|
332
|
+
e.forEach((e) => {
|
|
333
|
+
(window.location.pathname === e.activeRule || window.location.pathname.startsWith(`${e.activeRule}/`)) && (me(e, n), ge(e, window.location.pathname, n));
|
|
334
|
+
});
|
|
335
|
+
}), De(), Ae();
|
|
336
|
+
}
|
|
337
|
+
function De() {
|
|
338
|
+
Te || document.querySelector("#micro-app-container") && (Te = !0, A({
|
|
339
|
+
prefetch: !1,
|
|
340
|
+
sandbox: { experimentalStyleIsolation: !0 },
|
|
341
|
+
urlRerouteOnly: !0
|
|
342
|
+
}));
|
|
343
|
+
}
|
|
344
|
+
function Oe(e) {
|
|
345
|
+
return (e instanceof Error ? e.message : String(e || "")).match(/application ['"]?([^'"\s]+)['"]?/i)?.[1];
|
|
346
|
+
}
|
|
347
|
+
function ke(e) {
|
|
348
|
+
let t = J();
|
|
349
|
+
return {
|
|
350
|
+
basePath: e.activeRule,
|
|
351
|
+
app: r(e),
|
|
352
|
+
runtime: {
|
|
353
|
+
env: "production",
|
|
354
|
+
apiBaseUrl: "/api"
|
|
355
|
+
},
|
|
356
|
+
theme: Q(t.isDark),
|
|
357
|
+
getRuntimeProps: () => ({ theme: Q(t.isDark) })
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
function Ae() {
|
|
361
|
+
let e = J();
|
|
362
|
+
C(() => [
|
|
363
|
+
e.isDark,
|
|
364
|
+
e.themeColor,
|
|
365
|
+
e.themeColorPosition
|
|
366
|
+
], () => {
|
|
367
|
+
window.setTimeout(() => {
|
|
368
|
+
je(Q(e.isDark));
|
|
369
|
+
}, 0);
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
function je(e) {
|
|
373
|
+
window.dispatchEvent(new CustomEvent(Ce, { detail: e }));
|
|
374
|
+
}
|
|
375
|
+
function Q(e) {
|
|
376
|
+
let t = getComputedStyle(document.documentElement);
|
|
377
|
+
return {
|
|
378
|
+
colorPrimary: $(t, "--el-color-primary", "#409EFF"),
|
|
379
|
+
colorPrimaryLight3: $(t, "--el-color-primary-light-3", "#79bbff"),
|
|
380
|
+
colorPrimaryLight5: $(t, "--el-color-primary-light-5", "#a0cfff"),
|
|
381
|
+
colorPrimaryLight7: $(t, "--el-color-primary-light-7", "#c6e2ff"),
|
|
382
|
+
colorPrimaryLight8: $(t, "--el-color-primary-light-8", "#d9ecff"),
|
|
383
|
+
colorPrimaryLight9: $(t, "--el-color-primary-light-9", "#ecf5ff"),
|
|
384
|
+
colorPrimaryDark2: $(t, "--el-color-primary-dark-2", "#337ecc"),
|
|
385
|
+
mode: e ? "dark" : "light"
|
|
386
|
+
};
|
|
387
|
+
}
|
|
388
|
+
function $(e, t, n) {
|
|
389
|
+
return e.getPropertyValue(t).trim() || n;
|
|
390
|
+
}
|
|
391
|
+
//#endregion
|
|
392
|
+
//#region src/main/pages/micro/MicroAppView.vue?vue&type=script&setup=true&lang.ts
|
|
393
|
+
var Me = { class: "micro-app-page" }, Ne = {
|
|
394
|
+
key: 0,
|
|
395
|
+
class: "micro-app-page__state micro-app-page__state--error"
|
|
396
|
+
}, Pe = { class: "micro-app-page__body" }, Fe = { class: "micro-app-page__desc" }, Ie = { class: "micro-app-page__meta" }, Le = { key: 0 }, Re = { key: 1 }, ze = { key: 2 }, Be = { class: "micro-app-page__actions" }, Ve = ["id"], He = /* @__PURE__ */ e(/* @__PURE__ */ p({
|
|
397
|
+
name: "MicroAppView",
|
|
398
|
+
__name: "MicroAppView",
|
|
399
|
+
setup(e) {
|
|
400
|
+
let t = a(), n = ce(), r = y(""), p = null, v = o(() => ue(t.path)), T = o(() => {
|
|
401
|
+
let e = v.value;
|
|
402
|
+
return e ? n[e.name] : void 0;
|
|
403
|
+
}), O = o(() => le(t.path)), k = o(() => T.value?.title || v.value?.title || O.value?.title || "未知子应用"), A = o(() => T.value?.entry || v.value?.entry || O.value?.entry || "-"), j = o(() => T.value?.message ? T.value.message : O.value?.message ? O.value.message : v.value ? "子应用暂时无法访问,请稍后重试。" : "当前路径没有匹配到子应用配置,请检查应用配置里的路由前缀。"), M = o(() => T.value?.status === "error" || !!O.value || !!r.value || !v.value);
|
|
404
|
+
C(() => t.path, () => {
|
|
405
|
+
m(() => {
|
|
406
|
+
Ee(), N();
|
|
407
|
+
});
|
|
408
|
+
}, { immediate: !0 }), g(() => {
|
|
409
|
+
m(() => {
|
|
410
|
+
Ee(), N();
|
|
411
|
+
});
|
|
412
|
+
}), C(() => T.value?.status, (e) => {
|
|
413
|
+
e === "mounted" && (P(), r.value = "");
|
|
414
|
+
}), h(() => {
|
|
415
|
+
P();
|
|
416
|
+
});
|
|
417
|
+
function N() {
|
|
418
|
+
P(), r.value = "", v.value && (p = window.setTimeout(() => {
|
|
419
|
+
T.value?.status !== "mounted" && (r.value = "子应用暂时无法访问,请稍后重试。");
|
|
420
|
+
}, 15e3));
|
|
421
|
+
}
|
|
422
|
+
function P() {
|
|
423
|
+
p !== null && (window.clearTimeout(p), p = null);
|
|
424
|
+
}
|
|
425
|
+
function F() {
|
|
426
|
+
window.location.reload();
|
|
427
|
+
}
|
|
428
|
+
function I() {
|
|
429
|
+
let e = A.value;
|
|
430
|
+
e && e !== "-" && window.open(e, "_blank", "noopener,noreferrer");
|
|
431
|
+
}
|
|
432
|
+
return (e, t) => {
|
|
433
|
+
let n = b("el-icon"), a = b("el-button");
|
|
434
|
+
return _(), l("div", Me, [M.value ? (_(), l("div", Ne, [f(n, { class: "micro-app-page__icon" }, {
|
|
435
|
+
default: w(() => [f(S(ee))]),
|
|
436
|
+
_: 1
|
|
437
|
+
}), u("div", Pe, [
|
|
438
|
+
t[6] ||= u("p", { class: "micro-app-page__title" }, "子应用加载失败", -1),
|
|
439
|
+
u("p", Fe, x(j.value), 1),
|
|
440
|
+
u("dl", Ie, [
|
|
441
|
+
u("div", null, [t[0] ||= u("dt", null, "应用", -1), u("dd", null, x(k.value), 1)]),
|
|
442
|
+
S(!1) ? (_(), l("div", Le, [t[1] ||= u("dt", null, "入口", -1), u("dd", null, x(A.value), 1)])) : c("", !0),
|
|
443
|
+
T.value?.message ? (_(), l("div", Re, [t[2] ||= u("dt", null, "原因", -1), u("dd", null, x(T.value.message), 1)])) : r.value ? (_(), l("div", ze, [t[3] ||= u("dt", null, "原因", -1), u("dd", null, x(r.value), 1)])) : c("", !0)
|
|
444
|
+
]),
|
|
445
|
+
u("div", Be, [f(a, {
|
|
446
|
+
type: "primary",
|
|
447
|
+
icon: S(D),
|
|
448
|
+
onClick: F
|
|
449
|
+
}, {
|
|
450
|
+
default: w(() => [...t[4] ||= [d("重新加载", -1)]]),
|
|
451
|
+
_: 1
|
|
452
|
+
}, 8, ["icon"]), S(!1) && (T.value?.entry || v.value?.entry) ? (_(), s(a, {
|
|
453
|
+
key: 0,
|
|
454
|
+
icon: S(E),
|
|
455
|
+
onClick: I
|
|
456
|
+
}, {
|
|
457
|
+
default: w(() => [...t[5] ||= [d(" 打开入口 ", -1)]]),
|
|
458
|
+
_: 1
|
|
459
|
+
}, 8, ["icon"])) : c("", !0)])
|
|
460
|
+
])])) : c("", !0), u("section", {
|
|
461
|
+
id: S(i),
|
|
462
|
+
class: "micro-app-page__container"
|
|
463
|
+
}, null, 8, Ve)]);
|
|
464
|
+
};
|
|
465
|
+
}
|
|
466
|
+
}), [["__scopeId", "data-v-eee80378"]]);
|
|
467
|
+
//#endregion
|
|
468
|
+
//#region src/main/router/route-items.ts
|
|
469
|
+
function Ue(e, t) {
|
|
470
|
+
return e.map((e) => We(e, t));
|
|
471
|
+
}
|
|
472
|
+
function We(e, t) {
|
|
473
|
+
let n = {
|
|
474
|
+
path: e.path,
|
|
475
|
+
name: e.name,
|
|
476
|
+
meta: {
|
|
477
|
+
title: e.title,
|
|
478
|
+
icon: e.icon,
|
|
479
|
+
permission: e.permission,
|
|
480
|
+
hidden: e.hidden
|
|
481
|
+
}
|
|
482
|
+
};
|
|
483
|
+
return e.redirect && (n.redirect = e.redirect), e.componentKey && (n.component = t[e.componentKey]), e.microApp && (n.component = He), e.children?.length && (n.children = Ue(e.children, t)), n;
|
|
484
|
+
}
|
|
485
|
+
//#endregion
|
|
486
|
+
export { P as a, se as i, He as n, J as r, Ue as t };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { MICRO_AUTH_EXPIRED_EVENT as e } from "./micro-contract.js";
|
|
2
|
-
import { a as t, c as n,
|
|
3
|
-
import { ApiError as
|
|
4
|
-
import { a as
|
|
5
|
-
import { t as
|
|
6
|
-
import {
|
|
7
|
-
|
|
2
|
+
import { a as t, c as n, i as r, l as i, n as a, o, r as s, s as c, t as l, u } from "./chunks/main-BRpmAK9d.js";
|
|
3
|
+
import { ApiError as d, RequestManager as f, createRequestClient as p, formatErrorMessage as m } from "./request.js";
|
|
4
|
+
import { a as h, i as g, n as _, r as v, t as y } from "./chunks/auth-C3RvRgcW.js";
|
|
5
|
+
import { t as b } from "./chunks/system-BbMsTIBR.js";
|
|
6
|
+
import { n as x, r as S, t as C } from "./chunks/route-items-DZFRXefX.js";
|
|
7
|
+
import { o as w } from "./chunks/config-Cd-9BYBy.js";
|
|
8
|
+
import { a as T, c as E, d as D, i as O, l as k, n as A, o as j, r as M, s as N, t as P, u as F } from "./chunks/sub-D7y3UaHp.js";
|
|
9
|
+
export { d as ApiError, j as DEFAULT_SUB_APP_BASE, r as HOME_TAB_PATH, e as MICRO_AUTH_EXPIRED_EVENT, x as MicroAppView, f as RequestManager, N as SUB_APP_NAME, E as SUB_APP_THEME_CHANGE_EVENT, O as applySubAppTheme, o as configureMorningfastRequestClient, c as createApi, _ as createMockLoginResult, v as createMockUserProfile, s as createMorningfastBaseRoutes, a as createMorningfastRouter, p as createRequestClient, C as createRoutesFromItems, F as createSubAppContext, T as createSubAppRouter, m as formatErrorMessage, n as http, l as mountMorningfastApp, M as mountSubApp, g as normalizeLoginResult, h as normalizeUserProfile, i as requestManager, k as resolveSubAppBasePath, w as setDefaultAppConfigs, u as setupAuthExpiredHandler, D as subAppContextKey, S as useAppStore, y as useAuthStore, P as useRequestClient, A as useSubAppContext, b as useSystemStore, t as useTabsStore };
|
package/dist/main/index.d.ts
CHANGED
|
@@ -2,6 +2,9 @@ export { setupAuthExpiredHandler } from './auth/expired';
|
|
|
2
2
|
export { createMorningfastRouter } from './router';
|
|
3
3
|
export type { CreateMorningfastRouterOptions } from './router';
|
|
4
4
|
export { createMorningfastBaseRoutes } from './router/base-routes';
|
|
5
|
+
export { createRoutesFromItems } from './router/route-items';
|
|
6
|
+
export type { AppRouteItem, RouteItem } from './router/route-items';
|
|
7
|
+
export { setDefaultAppConfigs, type AppConfigItem, } from './micro-apps/config';
|
|
5
8
|
export { mountMorningfastApp } from './app/create-app';
|
|
6
9
|
export { default as MicroAppView } from './pages/micro/MicroAppView.vue';
|
|
7
10
|
export type { MountedMorningfastAppContext, MountMorningfastAppContext, MountMorningfastAppOptions, } from './app/create-app';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { RouteRecordRaw } from 'vue-router';
|
|
2
|
+
export interface AppRouteItem {
|
|
3
|
+
path: string;
|
|
4
|
+
name: string;
|
|
5
|
+
title: string;
|
|
6
|
+
icon?: string;
|
|
7
|
+
permission?: string | string[];
|
|
8
|
+
hidden?: boolean;
|
|
9
|
+
redirect?: string;
|
|
10
|
+
componentKey?: string;
|
|
11
|
+
microApp?: boolean;
|
|
12
|
+
children?: AppRouteItem[];
|
|
13
|
+
}
|
|
14
|
+
export type RouteItem = AppRouteItem;
|
|
15
|
+
export declare function createRoutesFromItems(items: AppRouteItem[], componentMap: Record<string, RouteRecordRaw['component']>): RouteRecordRaw[];
|
package/dist/main.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { a as e, c as t,
|
|
2
|
-
import { a as
|
|
3
|
-
import { t as
|
|
4
|
-
|
|
1
|
+
import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, t as c, u as l } from "./chunks/main-BRpmAK9d.js";
|
|
2
|
+
import { a as u, i as d, n as f, r as p, t as m } from "./chunks/auth-C3RvRgcW.js";
|
|
3
|
+
import { t as h } from "./chunks/system-BbMsTIBR.js";
|
|
4
|
+
import { n as g, r as _, t as v } from "./chunks/route-items-DZFRXefX.js";
|
|
5
|
+
import { o as y } from "./chunks/config-Cd-9BYBy.js";
|
|
6
|
+
export { n as HOME_TAB_PATH, g as MicroAppView, a as configureMorningfastRequestClient, s as createApi, f as createMockLoginResult, p as createMockUserProfile, o as createMorningfastBaseRoutes, i as createMorningfastRouter, v as createRoutesFromItems, t as http, c as mountMorningfastApp, d as normalizeLoginResult, u as normalizeUserProfile, r as requestManager, y as setDefaultAppConfigs, l as setupAuthExpiredHandler, _ as useAppStore, m as useAuthStore, h as useSystemStore, e as useTabsStore };
|
package/dist/sub/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export { mountSubApp } from './app/mount';
|
|
2
2
|
export type { MountSubAppOptions } from './app/mount';
|
|
3
3
|
export { createSubAppRouter } from './router';
|
|
4
|
+
export { createRoutesFromItems } from '../main/router/route-items';
|
|
5
|
+
export type { RouteItem } from '../main/router/route-items';
|
|
4
6
|
export { useRequestClient } from './composables/useRequestClient';
|
|
5
7
|
export { useSubAppContext } from './composables/useSubAppContext';
|
|
6
8
|
export * from './context/sub-app-context';
|
package/dist/sub.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { t as e } from "./chunks/route-items-DZFRXefX.js";
|
|
2
|
+
import { a as t, c as n, d as r, i, l as a, n as o, o as s, r as c, s as l, t as u, u as d } from "./chunks/sub-D7y3UaHp.js";
|
|
3
|
+
export { s as DEFAULT_SUB_APP_BASE, l as SUB_APP_NAME, n as SUB_APP_THEME_CHANGE_EVENT, i as applySubAppTheme, e as createRoutesFromItems, d as createSubAppContext, t as createSubAppRouter, c as mountSubApp, a as resolveSubAppBasePath, r as subAppContextKey, u as useRequestClient, o as useSubAppContext };
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|
/package/dist/chunks/{_plugin-vue_export-helper-CZc-Y3Wh.js → _plugin-vue_export-helper-DvRHjpsZ.js}
RENAMED
|
File without changes
|
|
File without changes
|