@morningfast/platform 0.0.12 → 0.0.14
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 +2 -5
- package/dist/chunks/{Login-BKuPkkY9.js → Login-8fZ-l3ST.js} +11 -11
- package/dist/chunks/{SystemConfig-DGZUwXWB.js → SystemConfig-Xa8FuNBK.js} +1 -1
- package/dist/chunks/{application-config-DLHtmY_2.js → application-config-DpfzdbAa.js} +2 -2
- package/dist/chunks/main-CX2uCPdt.js +2841 -0
- package/dist/chunks/route-items-DXwaEe0Y.js +21 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +7 -8
- package/dist/main/app/AppUpdateDialog.vue.d.ts +14 -0
- package/dist/main/app/runtime-config.d.ts +5 -0
- package/dist/main/app/update-checker.d.ts +8 -0
- package/dist/main/app/update-preferences.d.ts +2 -0
- package/dist/main/index.d.ts +2 -0
- package/dist/main/layouts/composables/useShortcutLabel.d.ts +1 -1
- package/dist/main/router/route-items.d.ts +3 -15
- package/dist/main/settings/components/AppearanceSettings.vue.d.ts +3 -0
- package/dist/main/settings/components/GeneralSettings.vue.d.ts +3 -0
- package/dist/main/settings/components/LayoutSettings.vue.d.ts +3 -0
- package/dist/main/settings/components/ShortcutSettings.vue.d.ts +3 -0
- package/dist/main/stores/index.d.ts +1 -0
- package/dist/main/stores/shortcut.d.ts +77 -0
- package/dist/main/utils/keyboard-shortcut.d.ts +39 -0
- package/dist/main.js +5 -6
- package/dist/shared/router/route-items.d.ts +15 -0
- package/dist/sub/index.d.ts +2 -2
- package/dist/sub.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/main-BVdwJu-s.js +0 -1840
- package/dist/chunks/route-items-84k92f3O.js +0 -513
- /package/dist/chunks/{_plugin-vue_export-helper-DvRHjpsZ.js → _plugin-vue_export-helper-CZc-Y3Wh.js} +0 -0
- /package/dist/chunks/{config-Cd-9BYBy.js → config-CJOAan9n.js} +0 -0
|
@@ -0,0 +1,2841 @@
|
|
|
1
|
+
import { clearAuth as e, emitAuthExpired as t, getAccessToken as n, onAuthExpired as r } from "../auth.js";
|
|
2
|
+
import { createRequestClient as i } from "../request.js";
|
|
3
|
+
import { t as a } from "./auth-C3RvRgcW.js";
|
|
4
|
+
import { i as o, n as s, r as c, t as l } from "./system-DZaKDrG6.js";
|
|
5
|
+
import { t as u } from "./_plugin-vue_export-helper-CZc-Y3Wh.js";
|
|
6
|
+
import { n as d, r as f, s as p, t as m } from "./config-CJOAan9n.js";
|
|
7
|
+
import { t as h } from "./route-items-DXwaEe0Y.js";
|
|
8
|
+
import { createRouter as g, createWebHistory as _, useRoute as v, useRouter as y } from "vue-router";
|
|
9
|
+
import b from "nprogress";
|
|
10
|
+
import x, { ElMessage as ee } from "element-plus";
|
|
11
|
+
import { Fragment as S, Teleport as C, Transition as w, TransitionGroup as T, computed as E, createApp as D, createBlock as O, createCommentVNode as k, createElementBlock as A, createElementVNode as j, createTextVNode as M, createVNode as N, defineComponent as P, nextTick as F, normalizeClass as I, normalizeStyle as te, onBeforeUnmount as L, onMounted as ne, onUnmounted as re, openBlock as R, reactive as ie, ref as z, renderList as B, resolveComponent as V, resolveDynamicComponent as H, toDisplayString as U, unref as W, watch as G, watchEffect as ae, withCtx as K, withKeys as oe, withModifiers as q } from "vue";
|
|
12
|
+
import { createPinia as se, defineStore as ce } from "pinia";
|
|
13
|
+
import { MpDrawer as le, MpLoadingService as ue, registerMpFormFieldComponents as de } from "morningfast-plus/components";
|
|
14
|
+
import { ArrowDown as fe, ArrowRight as pe, ArrowUp as me, Back as he, Brush as ge, Close as _e, Connection as ve, DArrowLeft as ye, DArrowRight as be, Document as xe, Expand as Se, Fold as Ce, FolderDelete as we, Grid as Te, House as Ee, Link as De, Monitor as Oe, Moon as ke, Operation as Ae, Refresh as je, RefreshRight as Me, Search as Ne, Setting as Pe, Sunny as Fe, SwitchButton as Ie, TopRight as Le, Upload as Re, User as ze, WarningFilled as Be } from "@element-plus/icons-vue";
|
|
15
|
+
import Ve from "sortablejs";
|
|
16
|
+
import { addGlobalUncaughtErrorHandler as He, registerMicroApps as Ue, start as We } from "qiankun";
|
|
17
|
+
import Ge from "element-plus/es/locale/lang/zh-cn";
|
|
18
|
+
import "element-plus/dist/index.css";
|
|
19
|
+
import "element-plus/theme-chalk/dark/css-vars.css";
|
|
20
|
+
import "nprogress/nprogress.css";
|
|
21
|
+
//#region src/main/auth/expired.ts
|
|
22
|
+
function Ke(t) {
|
|
23
|
+
return r(() => {
|
|
24
|
+
if (e(), t.currentRoute.value.path === "/login") return;
|
|
25
|
+
let n = `${t.currentRoute.value.fullPath || "/"}`;
|
|
26
|
+
t.replace({
|
|
27
|
+
path: "/login",
|
|
28
|
+
query: { redirect: n }
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region src/main/app/runtime-config.ts
|
|
34
|
+
var qe = { apiBaseUrl: "/api" };
|
|
35
|
+
function Je(e) {
|
|
36
|
+
qe = e;
|
|
37
|
+
}
|
|
38
|
+
function Ye() {
|
|
39
|
+
return qe;
|
|
40
|
+
}
|
|
41
|
+
var { http: Xe, createApi: Ze, requestManager: Qe } = i({
|
|
42
|
+
baseURL: Ye().apiBaseUrl,
|
|
43
|
+
getToken: n,
|
|
44
|
+
onError(e) {
|
|
45
|
+
ee.error(e);
|
|
46
|
+
},
|
|
47
|
+
onUnauthorized(e) {
|
|
48
|
+
t({
|
|
49
|
+
source: "main-app",
|
|
50
|
+
reason: "unauthorized",
|
|
51
|
+
code: e.code,
|
|
52
|
+
message: e.message
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
function $e() {
|
|
57
|
+
Xe.defaults.baseURL = Ye().apiBaseUrl;
|
|
58
|
+
}
|
|
59
|
+
//#endregion
|
|
60
|
+
//#region src/main/router/guard.ts
|
|
61
|
+
var et = "/login", tt = "/403";
|
|
62
|
+
function nt(e) {
|
|
63
|
+
e.beforeEach(async (e, t) => {
|
|
64
|
+
b.start(), e.path !== t.path && Qe.setCurrentPage(e.path);
|
|
65
|
+
let n = a(), r = !!e.meta.public;
|
|
66
|
+
if (n.initialized || await n.initAuth(), !n.isAuthenticated && !r) return {
|
|
67
|
+
path: et,
|
|
68
|
+
query: { redirect: e.fullPath }
|
|
69
|
+
};
|
|
70
|
+
if (n.isAuthenticated && e.path === et) return { path: "/" };
|
|
71
|
+
let i = e.meta.permission;
|
|
72
|
+
return rt(i, n.hasPermission) ? !0 : {
|
|
73
|
+
path: tt,
|
|
74
|
+
query: { redirect: e.fullPath }
|
|
75
|
+
};
|
|
76
|
+
}), e.afterEach((e) => {
|
|
77
|
+
l().setRouteTitle(String(e.meta.title ?? "Morningfast UI")), b.done();
|
|
78
|
+
}), e.onError(() => {
|
|
79
|
+
b.done();
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
function rt(e, t) {
|
|
83
|
+
return e ? Array.isArray(e) ? e.every((e) => t(e)) : t(e) : !0;
|
|
84
|
+
}
|
|
85
|
+
//#endregion
|
|
86
|
+
//#region src/main/stores/tabs.ts
|
|
87
|
+
var J = "/dashboard", it = "tabs-state";
|
|
88
|
+
function at() {
|
|
89
|
+
return {
|
|
90
|
+
path: J,
|
|
91
|
+
fullPath: J,
|
|
92
|
+
title: "首页",
|
|
93
|
+
icon: "House"
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
function ot() {
|
|
97
|
+
return {
|
|
98
|
+
tabs: [at()],
|
|
99
|
+
activeTab: J,
|
|
100
|
+
lastActiveTab: ""
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
function st(e) {
|
|
104
|
+
let t = ot();
|
|
105
|
+
if (!e) return t;
|
|
106
|
+
let n = Array.isArray(e.tabs) ? e.tabs.filter(Boolean).map(ct) : [], r = lt([at(), ...n]).sort((e, t) => e.path === "/dashboard" ? -1 : +(t.path === "/dashboard"));
|
|
107
|
+
return {
|
|
108
|
+
tabs: r,
|
|
109
|
+
activeTab: r.some((t) => t.path === e.activeTab) ? String(e.activeTab || "/dashboard") : r[0]?.path || "/dashboard",
|
|
110
|
+
lastActiveTab: r.some((t) => t.path === e.lastActiveTab) ? String(e.lastActiveTab || "") : ""
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
function ct(e) {
|
|
114
|
+
return {
|
|
115
|
+
path: String(e.path || "/dashboard"),
|
|
116
|
+
fullPath: String(e.fullPath || e.path || "/dashboard"),
|
|
117
|
+
title: String(e.title || "未命名页面"),
|
|
118
|
+
icon: e.icon ? String(e.icon) : void 0
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
function lt(e) {
|
|
122
|
+
let t = /* @__PURE__ */ new Set();
|
|
123
|
+
return e.filter((e) => t.has(e.path) ? !1 : (t.add(e.path), !0));
|
|
124
|
+
}
|
|
125
|
+
function ut(e) {
|
|
126
|
+
return {
|
|
127
|
+
tabs: e.tabs.map((e) => ({
|
|
128
|
+
path: e.path,
|
|
129
|
+
fullPath: e.fullPath,
|
|
130
|
+
title: e.title,
|
|
131
|
+
icon: e.icon
|
|
132
|
+
})),
|
|
133
|
+
activeTab: e.activeTab,
|
|
134
|
+
lastActiveTab: e.lastActiveTab
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
var dt = ce("tabs", () => {
|
|
138
|
+
let e = z([at()]), t = z(J), n = z(""), r = z(!1), i = E(() => e.value.map((e) => e.path));
|
|
139
|
+
async function a() {
|
|
140
|
+
r.value && await o(it, ut({
|
|
141
|
+
tabs: e.value,
|
|
142
|
+
activeTab: t.value,
|
|
143
|
+
lastActiveTab: n.value
|
|
144
|
+
}));
|
|
145
|
+
}
|
|
146
|
+
async function l() {
|
|
147
|
+
if (r.value) return;
|
|
148
|
+
let i = st(await s(it, null));
|
|
149
|
+
e.value = i.tabs, t.value = i.activeTab, n.value = i.lastActiveTab, r.value = !0, await a();
|
|
150
|
+
}
|
|
151
|
+
async function u(r) {
|
|
152
|
+
t.value && t.value !== r.path && (n.value = t.value), t.value = r.path;
|
|
153
|
+
let i = e.value.find((e) => e.path === r.path);
|
|
154
|
+
if (i) {
|
|
155
|
+
i.fullPath = r.fullPath, i.title = r.title, i.icon = r.icon, await a();
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
e.value.push(r), b(), await a();
|
|
159
|
+
}
|
|
160
|
+
async function d(t) {
|
|
161
|
+
if (t === "/dashboard") return;
|
|
162
|
+
let r = e.value.findIndex((e) => e.path === t);
|
|
163
|
+
r >= 0 && e.value.splice(r, 1), n.value === t && (n.value = ""), b(), await a();
|
|
164
|
+
}
|
|
165
|
+
async function f(t) {
|
|
166
|
+
e.value = x(t), await a();
|
|
167
|
+
}
|
|
168
|
+
async function p(t) {
|
|
169
|
+
e.value = x(e.value.filter((e) => e.path === t || e.path === "/dashboard")), y(), await a();
|
|
170
|
+
}
|
|
171
|
+
async function m(t) {
|
|
172
|
+
let n = e.value.findIndex((e) => e.path === t);
|
|
173
|
+
n > 0 && (e.value = x(e.value.slice(n)), y(), await a());
|
|
174
|
+
}
|
|
175
|
+
async function h(t) {
|
|
176
|
+
let n = e.value.findIndex((e) => e.path === t);
|
|
177
|
+
n >= 0 && (e.value = x(e.value.slice(0, n + 1)), y(), await a());
|
|
178
|
+
}
|
|
179
|
+
async function g() {
|
|
180
|
+
e.value = [at()], t.value = J, n.value = "", await a();
|
|
181
|
+
}
|
|
182
|
+
async function _() {
|
|
183
|
+
e.value = [], t.value = "", n.value = "", await c(it);
|
|
184
|
+
}
|
|
185
|
+
async function v(e) {
|
|
186
|
+
t.value && t.value !== e && (n.value = t.value), t.value = e, await a();
|
|
187
|
+
}
|
|
188
|
+
function y() {
|
|
189
|
+
n.value && !e.value.some((e) => e.path === n.value) && (n.value = "");
|
|
190
|
+
}
|
|
191
|
+
function b() {
|
|
192
|
+
e.value = x(e.value);
|
|
193
|
+
}
|
|
194
|
+
function x(e) {
|
|
195
|
+
return lt([at(), ...e.filter((e) => e.path !== J)]);
|
|
196
|
+
}
|
|
197
|
+
return {
|
|
198
|
+
activeTab: t,
|
|
199
|
+
closeAllTabs: g,
|
|
200
|
+
closeLeftTabs: m,
|
|
201
|
+
closeOtherTabs: p,
|
|
202
|
+
closeRightTabs: h,
|
|
203
|
+
initializeTabs: l,
|
|
204
|
+
lastActiveTab: n,
|
|
205
|
+
removeTab: d,
|
|
206
|
+
reorderTabs: f,
|
|
207
|
+
resetTabs: _,
|
|
208
|
+
setActiveTab: v,
|
|
209
|
+
syncTab: u,
|
|
210
|
+
tabPaths: i,
|
|
211
|
+
tabs: e
|
|
212
|
+
};
|
|
213
|
+
}), ft = "theme-color", pt = "theme-mode", mt = "theme-position", ht = [
|
|
214
|
+
{
|
|
215
|
+
label: "默认蓝",
|
|
216
|
+
value: "#409EFF"
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
label: "深蓝色",
|
|
220
|
+
value: "#0960BE"
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
label: "靛蓝色",
|
|
224
|
+
value: "#045277"
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
label: "天空蓝",
|
|
228
|
+
value: "#78B5FE"
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
label: "深绿色",
|
|
232
|
+
value: "#0C522B"
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
label: "翡翠绿",
|
|
236
|
+
value: "#009773"
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
label: "浅绿色",
|
|
240
|
+
value: "#0BD092"
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
label: "紫罗兰",
|
|
244
|
+
value: "#7166F0"
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
label: "樱花粉",
|
|
248
|
+
value: "#FFB7C5"
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
label: "柠檬黄",
|
|
252
|
+
value: "#EFBD48"
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
label: "橙黄色",
|
|
256
|
+
value: "#C1420B"
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
label: "玫瑰红",
|
|
260
|
+
value: "#BB1B1B"
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
label: "锌色灰",
|
|
264
|
+
value: "#3F3F46"
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
label: "中性灰",
|
|
268
|
+
value: "#404040"
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
label: "石板灰",
|
|
272
|
+
value: "#344256"
|
|
273
|
+
}
|
|
274
|
+
];
|
|
275
|
+
function gt() {
|
|
276
|
+
return localStorage.getItem(ft) || "#409EFF";
|
|
277
|
+
}
|
|
278
|
+
function _t() {
|
|
279
|
+
let e = localStorage.getItem(pt);
|
|
280
|
+
return e === "light" || e === "dark" || e === "system" ? e : "light";
|
|
281
|
+
}
|
|
282
|
+
function vt(e) {
|
|
283
|
+
localStorage.setItem(ft, e);
|
|
284
|
+
}
|
|
285
|
+
function yt(e) {
|
|
286
|
+
localStorage.setItem(pt, e);
|
|
287
|
+
}
|
|
288
|
+
function bt() {
|
|
289
|
+
let e = localStorage.getItem(mt);
|
|
290
|
+
return e === "none" || e === "header" || e === "sidebar" ? e : "none";
|
|
291
|
+
}
|
|
292
|
+
function xt(e) {
|
|
293
|
+
localStorage.setItem(mt, e);
|
|
294
|
+
}
|
|
295
|
+
function St() {
|
|
296
|
+
return window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
297
|
+
}
|
|
298
|
+
function Ct(e) {
|
|
299
|
+
return e === "dark" || e === "system" && St();
|
|
300
|
+
}
|
|
301
|
+
function wt(e) {
|
|
302
|
+
let t = Ct(e);
|
|
303
|
+
document.documentElement.classList.toggle("dark", t), document.documentElement.style.colorScheme = t ? "dark" : "light";
|
|
304
|
+
}
|
|
305
|
+
function Tt(e) {
|
|
306
|
+
let t = document.documentElement, n = t.classList.contains("dark");
|
|
307
|
+
t.style.setProperty("--el-color-primary", e), t.style.setProperty("--el-color-primary-light-3", Y(e, n ? "#000000" : "#ffffff", .3)), t.style.setProperty("--el-color-primary-light-5", Y(e, n ? "#000000" : "#ffffff", .5)), t.style.setProperty("--el-color-primary-light-7", Y(e, n ? "#000000" : "#ffffff", .7)), t.style.setProperty("--el-color-primary-light-8", Y(e, n ? "#000000" : "#ffffff", .8)), t.style.setProperty("--el-color-primary-light-9", Y(e, n ? "#000000" : "#ffffff", .9)), t.style.setProperty("--el-color-primary-dark-2", Y(e, n ? "#ffffff" : "#000000", .2));
|
|
308
|
+
}
|
|
309
|
+
function Et() {
|
|
310
|
+
wt(_t()), Tt(gt()), Dt(bt());
|
|
311
|
+
}
|
|
312
|
+
function Dt(e) {
|
|
313
|
+
document.documentElement.setAttribute("data-theme-position", e);
|
|
314
|
+
}
|
|
315
|
+
function Ot(e = 50) {
|
|
316
|
+
return new Promise((t) => {
|
|
317
|
+
setTimeout(() => {
|
|
318
|
+
Tt(gt()), t();
|
|
319
|
+
}, e);
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
async function kt(e, t) {
|
|
323
|
+
if (!document.startViewTransition) {
|
|
324
|
+
t(), await Ot();
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
327
|
+
let n = e.clientX, r = e.clientY, i = Math.hypot(Math.max(n, innerWidth - n), Math.max(r, innerHeight - r));
|
|
328
|
+
try {
|
|
329
|
+
document.startViewTransition(() => {
|
|
330
|
+
t();
|
|
331
|
+
}).ready.then(() => {
|
|
332
|
+
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");
|
|
333
|
+
document.documentElement.animate({ clipPath: c ? s.reverse() : s }, {
|
|
334
|
+
duration: 400,
|
|
335
|
+
easing: "ease-in",
|
|
336
|
+
fill: "both",
|
|
337
|
+
pseudoElement: c ? "::view-transition-old(root)" : "::view-transition-new(root)"
|
|
338
|
+
});
|
|
339
|
+
}), await Ot();
|
|
340
|
+
} catch {
|
|
341
|
+
t(), await Ot();
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
function Y(e, t, n) {
|
|
345
|
+
let [r, i, a] = At(e), [o, s, c] = At(t), l = (e, t) => Math.round(e * (1 - n) + t * n);
|
|
346
|
+
return `rgb(${l(r, o)}, ${l(i, s)}, ${l(a, c)})`;
|
|
347
|
+
}
|
|
348
|
+
function At(e) {
|
|
349
|
+
let t = e.replace("#", ""), n = t.length === 3 ? t.split("").map((e) => e + e).join("") : t, r = Number.parseInt(n, 16);
|
|
350
|
+
return [
|
|
351
|
+
r >> 16 & 255,
|
|
352
|
+
r >> 8 & 255,
|
|
353
|
+
r & 255
|
|
354
|
+
];
|
|
355
|
+
}
|
|
356
|
+
//#endregion
|
|
357
|
+
//#region src/main/stores/app.ts
|
|
358
|
+
var jt = "sidebar-collapsed", Mt = "menu-search-placement", Nt = "layout-mode", Pt = "top-menu-path", Ft = "(max-width: 768px)", It = null, X = ce("app", () => {
|
|
359
|
+
let e = z(localStorage.getItem(jt) === "true"), t = z(!1), n = z(Lt()), r = z(!1), i = z("theme"), a = z(_t()), o = z(gt()), s = z(bt()), c = z(zt(localStorage.getItem(Nt))), l = z(localStorage.getItem(Mt) || "header"), u = z(localStorage.getItem(Pt) || ""), d = z(!0), f = E(() => Ct(a.value)), p = E(() => c.value === "top" ? ["header"] : ["header", "sidebar"]), m = E(() => c.value !== "top" && l.value === "sidebar");
|
|
360
|
+
function h() {
|
|
361
|
+
if (n.value) {
|
|
362
|
+
t.value = !t.value;
|
|
363
|
+
return;
|
|
364
|
+
}
|
|
365
|
+
e.value = !e.value;
|
|
366
|
+
}
|
|
367
|
+
function g(t) {
|
|
368
|
+
e.value = t, localStorage.setItem(jt, String(e.value));
|
|
369
|
+
}
|
|
370
|
+
function _() {
|
|
371
|
+
t.value = !1;
|
|
372
|
+
}
|
|
373
|
+
function v(e = "theme") {
|
|
374
|
+
i.value = e, r.value = !0;
|
|
375
|
+
}
|
|
376
|
+
function y() {
|
|
377
|
+
r.value = !1;
|
|
378
|
+
}
|
|
379
|
+
function b(e) {
|
|
380
|
+
r.value = e;
|
|
381
|
+
}
|
|
382
|
+
function x(e) {
|
|
383
|
+
a.value = e, yt(e), wt(e), Tt(o.value);
|
|
384
|
+
}
|
|
385
|
+
function ee() {
|
|
386
|
+
x(St() && a.value === "system" || f.value ? "light" : "dark");
|
|
387
|
+
}
|
|
388
|
+
function S(e) {
|
|
389
|
+
o.value = e, vt(e), Tt(e);
|
|
390
|
+
}
|
|
391
|
+
function C(e) {
|
|
392
|
+
s.value = e, xt(e), Dt(e);
|
|
393
|
+
}
|
|
394
|
+
function w(e) {
|
|
395
|
+
c.value = e, localStorage.setItem(Nt, e), e === "top" && l.value === "sidebar" && T("header");
|
|
396
|
+
}
|
|
397
|
+
function T(e) {
|
|
398
|
+
let t = c.value === "top" ? "header" : e;
|
|
399
|
+
l.value = t, localStorage.setItem(Mt, t);
|
|
400
|
+
}
|
|
401
|
+
function D(e) {
|
|
402
|
+
u.value = e, localStorage.setItem(Pt, e);
|
|
403
|
+
}
|
|
404
|
+
function O() {
|
|
405
|
+
Et(), Rt();
|
|
406
|
+
}
|
|
407
|
+
return {
|
|
408
|
+
closeMobileSidebar: _,
|
|
409
|
+
closeSettings: y,
|
|
410
|
+
initializePreferences: O,
|
|
411
|
+
isDark: f,
|
|
412
|
+
isMobileViewport: n,
|
|
413
|
+
layoutMode: c,
|
|
414
|
+
menuSearchPlacement: l,
|
|
415
|
+
menuSearchPlacementOptions: p,
|
|
416
|
+
mobileSidebarVisible: t,
|
|
417
|
+
openSettings: v,
|
|
418
|
+
isSidebarMenuSearch: m,
|
|
419
|
+
settingsActiveTab: i,
|
|
420
|
+
selectedTopMenuPath: u,
|
|
421
|
+
setLayoutMode: w,
|
|
422
|
+
setMenuSearchPlacement: T,
|
|
423
|
+
setSelectedTopMenuPath: D,
|
|
424
|
+
setSettingsVisible: b,
|
|
425
|
+
setSidebarCollapsed: g,
|
|
426
|
+
setThemeColor: S,
|
|
427
|
+
setThemeColorPosition: C,
|
|
428
|
+
setThemeMode: x,
|
|
429
|
+
settingsVisible: r,
|
|
430
|
+
sidebarCollapsed: e,
|
|
431
|
+
shortcutTipVisible: d,
|
|
432
|
+
themeColor: o,
|
|
433
|
+
themeColorPosition: s,
|
|
434
|
+
themeMode: a,
|
|
435
|
+
toggleDarkMode: ee,
|
|
436
|
+
toggleSidebar: h
|
|
437
|
+
};
|
|
438
|
+
});
|
|
439
|
+
function Lt() {
|
|
440
|
+
return typeof window > "u" ? !1 : window.matchMedia(Ft).matches;
|
|
441
|
+
}
|
|
442
|
+
function Rt() {
|
|
443
|
+
if (typeof window > "u" || It) return;
|
|
444
|
+
let e = window.matchMedia(Ft), t = X(), n = () => {
|
|
445
|
+
t.isMobileViewport = e.matches, e.matches || t.closeMobileSidebar();
|
|
446
|
+
};
|
|
447
|
+
n(), e.addEventListener("change", n), It = () => {
|
|
448
|
+
e.removeEventListener("change", n), It = null;
|
|
449
|
+
};
|
|
450
|
+
}
|
|
451
|
+
function zt(e) {
|
|
452
|
+
return e === "side" || e === "top" || e === "mix" ? e : "default";
|
|
453
|
+
}
|
|
454
|
+
//#endregion
|
|
455
|
+
//#region src/main/stores/shortcut.ts
|
|
456
|
+
var Bt = "shortcut-config", Vt = [
|
|
457
|
+
{
|
|
458
|
+
id: "search",
|
|
459
|
+
name: "全局搜索",
|
|
460
|
+
description: "快速搜索菜单和页面",
|
|
461
|
+
keys: "Ctrl K",
|
|
462
|
+
enabled: !0,
|
|
463
|
+
category: "global"
|
|
464
|
+
},
|
|
465
|
+
{
|
|
466
|
+
id: "toggleMenu",
|
|
467
|
+
name: "折叠菜单",
|
|
468
|
+
description: "展开或收起侧边导航",
|
|
469
|
+
keys: "Ctrl B",
|
|
470
|
+
enabled: !0,
|
|
471
|
+
category: "navigation"
|
|
472
|
+
},
|
|
473
|
+
{
|
|
474
|
+
id: "settings",
|
|
475
|
+
name: "主题设置",
|
|
476
|
+
description: "打开系统偏好设置面板",
|
|
477
|
+
keys: "Ctrl I",
|
|
478
|
+
enabled: !0,
|
|
479
|
+
category: "other"
|
|
480
|
+
}
|
|
481
|
+
], Ht = ce("shortcut", () => {
|
|
482
|
+
let e = z(!0), t = z(Ut()), n = E(() => new Map(t.value.map((e) => [e.id, e])));
|
|
483
|
+
function r() {
|
|
484
|
+
let t = Wt();
|
|
485
|
+
if (t && (typeof t.shortcutEnabled == "boolean" && (e.value = t.shortcutEnabled), Array.isArray(t.shortcuts))) for (let e of t.shortcuts) {
|
|
486
|
+
let t = n.value.get(e.id);
|
|
487
|
+
t && typeof e.enabled == "boolean" && (t.enabled = e.enabled);
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
function i() {
|
|
491
|
+
e.value = !e.value, c();
|
|
492
|
+
}
|
|
493
|
+
function a(e) {
|
|
494
|
+
let t = n.value.get(e);
|
|
495
|
+
t && (t.enabled = !t.enabled, c());
|
|
496
|
+
}
|
|
497
|
+
function o(t) {
|
|
498
|
+
return !!(e.value && n.value.get(t)?.enabled);
|
|
499
|
+
}
|
|
500
|
+
function s(e) {
|
|
501
|
+
return n.value.get(e)?.keys ?? "";
|
|
502
|
+
}
|
|
503
|
+
function c() {
|
|
504
|
+
let n = {
|
|
505
|
+
shortcutEnabled: e.value,
|
|
506
|
+
shortcuts: t.value.map((e) => ({
|
|
507
|
+
id: e.id,
|
|
508
|
+
enabled: e.enabled
|
|
509
|
+
}))
|
|
510
|
+
};
|
|
511
|
+
localStorage.setItem(Bt, JSON.stringify(n));
|
|
512
|
+
}
|
|
513
|
+
return {
|
|
514
|
+
getShortcutKeys: s,
|
|
515
|
+
initShortcuts: r,
|
|
516
|
+
isShortcutEnabled: o,
|
|
517
|
+
shortcutEnabled: e,
|
|
518
|
+
shortcuts: t,
|
|
519
|
+
toggleShortcut: a,
|
|
520
|
+
toggleShortcutEnabled: i
|
|
521
|
+
};
|
|
522
|
+
});
|
|
523
|
+
function Ut() {
|
|
524
|
+
return Vt.map((e) => ({ ...e }));
|
|
525
|
+
}
|
|
526
|
+
function Wt() {
|
|
527
|
+
try {
|
|
528
|
+
let e = localStorage.getItem(Bt);
|
|
529
|
+
return e ? JSON.parse(e) : null;
|
|
530
|
+
} catch {
|
|
531
|
+
return localStorage.removeItem(Bt), null;
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
//#endregion
|
|
535
|
+
//#region src/main/utils/keyboard-shortcut.ts
|
|
536
|
+
var Gt = {
|
|
537
|
+
Ctrl: {
|
|
538
|
+
mac: "Cmd",
|
|
539
|
+
windows: "Ctrl",
|
|
540
|
+
symbol: {
|
|
541
|
+
mac: "⌘",
|
|
542
|
+
windows: "Ctrl"
|
|
543
|
+
}
|
|
544
|
+
},
|
|
545
|
+
Alt: {
|
|
546
|
+
mac: "Option",
|
|
547
|
+
windows: "Alt",
|
|
548
|
+
symbol: {
|
|
549
|
+
mac: "⌥",
|
|
550
|
+
windows: "Alt"
|
|
551
|
+
}
|
|
552
|
+
},
|
|
553
|
+
Shift: {
|
|
554
|
+
mac: "Shift",
|
|
555
|
+
windows: "Shift",
|
|
556
|
+
symbol: {
|
|
557
|
+
mac: "⇧",
|
|
558
|
+
windows: "Shift"
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
};
|
|
562
|
+
function Kt() {
|
|
563
|
+
return typeof navigator > "u" ? !1 : /Mac|iPhone|iPad|iPod/i.test(navigator.platform);
|
|
564
|
+
}
|
|
565
|
+
function qt(e) {
|
|
566
|
+
let t = Kt();
|
|
567
|
+
return e.split(" ").filter(Boolean).map((e) => {
|
|
568
|
+
let n = Xt(e);
|
|
569
|
+
if (!(n in Gt)) return {
|
|
570
|
+
original: n,
|
|
571
|
+
display: n,
|
|
572
|
+
isModifier: !1
|
|
573
|
+
};
|
|
574
|
+
let r = Gt[n];
|
|
575
|
+
return {
|
|
576
|
+
original: n,
|
|
577
|
+
display: t ? r.mac : r.windows,
|
|
578
|
+
symbol: t ? r.symbol.mac : r.symbol.windows,
|
|
579
|
+
isModifier: !0
|
|
580
|
+
};
|
|
581
|
+
});
|
|
582
|
+
}
|
|
583
|
+
function Jt(e, t = {}) {
|
|
584
|
+
let { separator: n = " ", useSymbol: r = !1 } = t;
|
|
585
|
+
return qt(e).map((e) => r && e.symbol ? e.symbol : e.display).join(n);
|
|
586
|
+
}
|
|
587
|
+
function Yt(e, t) {
|
|
588
|
+
let n = qt(t), r = n.find((e) => !e.isModifier);
|
|
589
|
+
if (!r) return !1;
|
|
590
|
+
let i = new Set(n.filter((e) => e.isModifier).map((e) => e.original)), a = Kt() ? e.metaKey : e.ctrlKey, o = e.altKey, s = e.shiftKey;
|
|
591
|
+
return i.has("Ctrl") !== a || i.has("Alt") !== o || i.has("Shift") !== s ? !1 : e.code === `Key${r.original.toUpperCase()}`;
|
|
592
|
+
}
|
|
593
|
+
function Xt(e) {
|
|
594
|
+
let t = e.toLowerCase();
|
|
595
|
+
return t === "ctrl" || t === "cmd" || t === "command" || t === "meta" ? "Ctrl" : t === "alt" || t === "option" ? "Alt" : t === "shift" ? "Shift" : e.length === 1 ? e.toUpperCase() : e.charAt(0).toUpperCase() + e.slice(1);
|
|
596
|
+
}
|
|
597
|
+
//#endregion
|
|
598
|
+
//#region src/main/assets/settings/theme-position-header.svg
|
|
599
|
+
var Zt = "data:image/svg+xml,%3csvg%20viewBox='0%200%2064%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='64'%20height='48'%20rx='3'%20fill='%23c5cede'%20fill-opacity='0.04'/%3e%3crect%20x='4'%20y='4'%20width='56'%20height='7'%20rx='1.5'%20fill='%23409EFF'/%3e%3crect%20x='7'%20y='6.5'%20width='2'%20height='2'%20rx='1'%20fill='white'%20fill-opacity='0.95'/%3e%3crect%20x='11'%20y='7.25'%20width='6'%20height='1.5'%20rx='0.75'%20fill='white'%20fill-opacity='0.75'/%3e%3crect%20x='19'%20y='7.25'%20width='6'%20height='1.5'%20rx='0.75'%20fill='white'%20fill-opacity='0.75'/%3e%3crect%20x='27'%20y='7.25'%20width='6'%20height='1.5'%20rx='0.75'%20fill='white'%20fill-opacity='0.75'/%3e%3crect%20x='4'%20y='13'%20width='56'%20height='31'%20rx='1.5'%20fill='%23c5cede'%20fill-opacity='0.06'/%3e%3crect%20x='8'%20y='18'%20width='17'%20height='4'%20rx='1'%20fill='%23c5cede'%20fill-opacity='0.16'/%3e%3crect%20x='8'%20y='26'%20width='30'%20height='4'%20rx='1'%20fill='%23c5cede'%20fill-opacity='0.12'/%3e%3c/svg%3e", Qt = "data:image/svg+xml,%3csvg%20viewBox='0%200%2064%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='64'%20height='48'%20rx='3'%20fill='%23c5cede'%20fill-opacity='0.04'/%3e%3crect%20x='4'%20y='4'%20width='56'%20height='40'%20rx='2'%20fill='%23c5cede'%20fill-opacity='0.05'/%3e%3crect%20x='7'%20y='7'%20width='50'%20height='5'%20rx='1.5'%20fill='%23c5cede'%20fill-opacity='0.14'/%3e%3crect%20x='7'%20y='16'%20width='22'%20height='4'%20rx='1'%20fill='%23c5cede'%20fill-opacity='0.18'/%3e%3crect%20x='7'%20y='23'%20width='35'%20height='4'%20rx='1'%20fill='%23c5cede'%20fill-opacity='0.12'/%3e%3crect%20x='7'%20y='30'%20width='16'%20height='4'%20rx='1'%20fill='%23c5cede'%20fill-opacity='0.1'/%3e%3crect%20x='45'%20y='18'%20width='12'%20height='16'%20rx='2'%20fill='%23c5cede'%20fill-opacity='0.08'/%3e%3c/svg%3e", $t = "data:image/svg+xml,%3csvg%20viewBox='0%200%2064%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='64'%20height='48'%20rx='3'%20fill='%23c5cede'%20fill-opacity='0.04'/%3e%3crect%20x='4'%20y='4'%20width='11'%20height='40'%20rx='1.5'%20fill='%23409EFF'/%3e%3crect%20x='6.5'%20y='7'%20width='2'%20height='2'%20rx='1'%20fill='white'%20fill-opacity='0.95'/%3e%3crect%20x='6.5'%20y='11'%20width='6'%20height='1.5'%20rx='0.75'%20fill='white'%20fill-opacity='0.75'/%3e%3crect%20x='6.5'%20y='14.5'%20width='6'%20height='1.5'%20rx='0.75'%20fill='white'%20fill-opacity='0.75'/%3e%3crect%20x='6.5'%20y='18'%20width='6'%20height='1.5'%20rx='0.75'%20fill='white'%20fill-opacity='0.75'/%3e%3crect%20x='17'%20y='4'%20width='43'%20height='40'%20rx='1.5'%20fill='%23c5cede'%20fill-opacity='0.06'/%3e%3crect%20x='21'%20y='10'%20width='14'%20height='4'%20rx='1'%20fill='%23c5cede'%20fill-opacity='0.16'/%3e%3crect%20x='21'%20y='18'%20width='24'%20height='4'%20rx='1'%20fill='%23c5cede'%20fill-opacity='0.12'/%3e%3crect%20x='21'%20y='26'%20width='18'%20height='4'%20rx='1'%20fill='%23c5cede'%20fill-opacity='0.1'/%3e%3c/svg%3e", en = ["src", "alt"], tn = /* @__PURE__ */ P({
|
|
600
|
+
__name: "ThemedSvgImage",
|
|
601
|
+
props: {
|
|
602
|
+
src: {},
|
|
603
|
+
primaryColor: {},
|
|
604
|
+
alt: { default: "" }
|
|
605
|
+
},
|
|
606
|
+
setup(e) {
|
|
607
|
+
let t = e, n = /* @__PURE__ */ new Map(), r = z(t.src);
|
|
608
|
+
async function i(e) {
|
|
609
|
+
let t = n.get(e);
|
|
610
|
+
if (t) return t;
|
|
611
|
+
let r = await fetch(e);
|
|
612
|
+
if (!r.ok) throw Error(`Failed to load SVG: ${e}`);
|
|
613
|
+
let i = await r.text();
|
|
614
|
+
return n.set(e, i), i;
|
|
615
|
+
}
|
|
616
|
+
function a(e, t) {
|
|
617
|
+
let n = e.replaceAll("#409EFF", t);
|
|
618
|
+
return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(n)}`;
|
|
619
|
+
}
|
|
620
|
+
return ae((e) => {
|
|
621
|
+
let n = !1, o = t.src, s = t.primaryColor;
|
|
622
|
+
r.value = o, i(o).then((e) => {
|
|
623
|
+
n || (r.value = a(e, s));
|
|
624
|
+
}).catch(() => {
|
|
625
|
+
n || (r.value = o);
|
|
626
|
+
}), e(() => {
|
|
627
|
+
n = !0;
|
|
628
|
+
});
|
|
629
|
+
}), (t, n) => (R(), A("img", {
|
|
630
|
+
src: r.value,
|
|
631
|
+
alt: e.alt
|
|
632
|
+
}, null, 8, en));
|
|
633
|
+
}
|
|
634
|
+
}), nn = { class: "settings-section" }, rn = { class: "settings-mode-grid" }, an = ["onClick"], on = { class: "settings-section" }, sn = {
|
|
635
|
+
key: 0,
|
|
636
|
+
class: "settings-section__header"
|
|
637
|
+
}, cn = {
|
|
638
|
+
key: 1,
|
|
639
|
+
class: "settings-position-grid"
|
|
640
|
+
}, ln = ["onClick"], un = { class: "settings-position-card__label" }, dn = { class: "settings-section" }, fn = { class: "settings-color-grid" }, pn = ["onClick"], mn = { class: "settings-color-card__label" }, hn = { class: "settings-color-card__swatch settings-color-card__swatch--custom" }, gn = /* @__PURE__ */ P({
|
|
641
|
+
__name: "AppearanceSettings",
|
|
642
|
+
setup(e) {
|
|
643
|
+
let t = X(), n = E(() => !ht.some((e) => e.value.toLowerCase() === t.themeColor.toLowerCase())), r = [
|
|
644
|
+
{
|
|
645
|
+
label: "浅色",
|
|
646
|
+
value: "light",
|
|
647
|
+
icon: Fe
|
|
648
|
+
},
|
|
649
|
+
{
|
|
650
|
+
label: "深色",
|
|
651
|
+
value: "dark",
|
|
652
|
+
icon: ke
|
|
653
|
+
},
|
|
654
|
+
{
|
|
655
|
+
label: "跟随系统",
|
|
656
|
+
value: "system",
|
|
657
|
+
icon: Oe
|
|
658
|
+
}
|
|
659
|
+
], i = [
|
|
660
|
+
{
|
|
661
|
+
label: "不应用",
|
|
662
|
+
value: "none",
|
|
663
|
+
previewSrc: Qt
|
|
664
|
+
},
|
|
665
|
+
{
|
|
666
|
+
label: "顶部",
|
|
667
|
+
value: "header",
|
|
668
|
+
previewSrc: Zt
|
|
669
|
+
},
|
|
670
|
+
{
|
|
671
|
+
label: "侧边栏",
|
|
672
|
+
value: "sidebar",
|
|
673
|
+
previewSrc: $t
|
|
674
|
+
}
|
|
675
|
+
];
|
|
676
|
+
function a(e) {
|
|
677
|
+
e && t.setThemeColor(e);
|
|
678
|
+
}
|
|
679
|
+
return (e, o) => {
|
|
680
|
+
let s = V("el-icon"), c = V("el-color-picker");
|
|
681
|
+
return R(), A(S, null, [
|
|
682
|
+
j("div", nn, [o[0] ||= j("div", { class: "settings-section__header" }, [j("span", { class: "settings-section__title" }, "主题模式"), j("span", { class: "settings-section__desc" }, "选择浅色、深色或跟随系统")], -1), j("div", rn, [(R(), A(S, null, B(r, (e) => j("button", {
|
|
683
|
+
key: e.value,
|
|
684
|
+
type: "button",
|
|
685
|
+
class: I(["settings-mode-card", { "is-active": W(t).themeMode === e.value }]),
|
|
686
|
+
onClick: (n) => W(t).setThemeMode(e.value)
|
|
687
|
+
}, [N(s, { size: 20 }, {
|
|
688
|
+
default: K(() => [(R(), O(H(e.icon)))]),
|
|
689
|
+
_: 2
|
|
690
|
+
}, 1024), j("strong", null, U(e.label), 1)], 10, an)), 64))])]),
|
|
691
|
+
j("div", on, [W(t).isDark ? k("", !0) : (R(), A("div", sn, [...o[1] ||= [j("span", { class: "settings-section__title" }, "主题色应用", -1), j("span", { class: "settings-section__desc" }, "选择主题色应用位置", -1)]])), W(t).isDark ? k("", !0) : (R(), A("div", cn, [(R(), A(S, null, B(i, (e) => j("button", {
|
|
692
|
+
key: e.value,
|
|
693
|
+
type: "button",
|
|
694
|
+
class: I(["settings-position-card", { "is-active": W(t).themeColorPosition === e.value }]),
|
|
695
|
+
onClick: (n) => W(t).setThemeColorPosition(e.value)
|
|
696
|
+
}, [N(tn, {
|
|
697
|
+
class: "settings-position-card__preview",
|
|
698
|
+
src: e.previewSrc,
|
|
699
|
+
"primary-color": W(t).themeColor
|
|
700
|
+
}, null, 8, ["src", "primary-color"]), j("span", un, U(e.label), 1)], 10, ln)), 64))]))]),
|
|
701
|
+
j("div", dn, [o[3] ||= j("div", { class: "settings-section__header" }, [j("span", { class: "settings-section__title" }, "主题色"), j("span", { class: "settings-section__desc" }, "选择系统主题颜色")], -1), j("div", fn, [(R(!0), A(S, null, B(W(ht), (e) => (R(), A("button", {
|
|
702
|
+
key: e.value,
|
|
703
|
+
type: "button",
|
|
704
|
+
class: I(["settings-color-card", { "is-active": W(t).themeColor === e.value }]),
|
|
705
|
+
onClick: (n) => W(t).setThemeColor(e.value)
|
|
706
|
+
}, [j("span", {
|
|
707
|
+
class: "settings-color-card__swatch",
|
|
708
|
+
style: te({ backgroundColor: e.value })
|
|
709
|
+
}, null, 4), j("span", mn, U(e.label), 1)], 10, pn))), 128)), j("div", { class: I(["settings-color-card settings-color-card--custom", { "is-active": n.value }]) }, [
|
|
710
|
+
N(c, {
|
|
711
|
+
class: "settings-color-card__picker",
|
|
712
|
+
"model-value": W(t).themeColor,
|
|
713
|
+
"onUpdate:modelValue": a
|
|
714
|
+
}, null, 8, ["model-value"]),
|
|
715
|
+
j("span", hn, [N(s, { size: 18 }, {
|
|
716
|
+
default: K(() => [N(W(ge))]),
|
|
717
|
+
_: 1
|
|
718
|
+
})]),
|
|
719
|
+
o[2] ||= j("span", { class: "settings-color-card__label" }, "自定义", -1)
|
|
720
|
+
], 2)])])
|
|
721
|
+
], 64);
|
|
722
|
+
};
|
|
723
|
+
}
|
|
724
|
+
}), _n = { class: "settings-section" }, vn = { class: "settings-inline-setting settings-inline-setting--compact" }, yn = /* @__PURE__ */ P({
|
|
725
|
+
__name: "GeneralSettings",
|
|
726
|
+
setup(e) {
|
|
727
|
+
let t = z($i(!0));
|
|
728
|
+
function n(e) {
|
|
729
|
+
let n = !!e;
|
|
730
|
+
if (t.value = n, ea(n), n) {
|
|
731
|
+
ha();
|
|
732
|
+
return;
|
|
733
|
+
}
|
|
734
|
+
ma();
|
|
735
|
+
}
|
|
736
|
+
return (e, r) => {
|
|
737
|
+
let i = V("el-switch");
|
|
738
|
+
return R(), A("div", _n, [j("div", vn, [r[0] ||= j("div", null, [j("strong", null, "版本更新检查"), j("p", null, "定时检测新版本并提醒刷新")], -1), N(i, {
|
|
739
|
+
"model-value": t.value,
|
|
740
|
+
"onUpdate:modelValue": n
|
|
741
|
+
}, null, 8, ["model-value"])])]);
|
|
742
|
+
};
|
|
743
|
+
}
|
|
744
|
+
}), bn = "data:image/svg+xml,%3csvg%20viewBox='0%200%2064%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='64'%20height='48'%20rx='3'%20fill='%23c5cede'%20fill-opacity='0.04'/%3e%3crect%20x='4'%20y='4'%20width='11'%20height='40'%20rx='1.5'%20fill='%23409EFF'/%3e%3crect%20x='6.5'%20y='7'%20width='2'%20height='2'%20rx='1'%20fill='white'%20fill-opacity='0.95'/%3e%3crect%20x='6.5'%20y='11'%20width='6'%20height='1.5'%20rx='0.75'%20fill='white'%20fill-opacity='0.75'/%3e%3crect%20x='6.5'%20y='14.5'%20width='6'%20height='1.5'%20rx='0.75'%20fill='white'%20fill-opacity='0.75'/%3e%3crect%20x='6.5'%20y='18'%20width='6'%20height='1.5'%20rx='0.75'%20fill='white'%20fill-opacity='0.75'/%3e%3crect%20x='17'%20y='4'%20width='43'%20height='7'%20rx='1.5'%20fill='%23409EFF'/%3e%3crect%20x='19.5'%20y='7.25'%20width='6'%20height='1.5'%20rx='0.75'%20fill='white'%20fill-opacity='0.75'/%3e%3crect%20x='27.5'%20y='7.25'%20width='6'%20height='1.5'%20rx='0.75'%20fill='white'%20fill-opacity='0.75'/%3e%3crect%20x='35.5'%20y='7.25'%20width='6'%20height='1.5'%20rx='0.75'%20fill='white'%20fill-opacity='0.75'/%3e%3crect%20x='17'%20y='13'%20width='43'%20height='31'%20rx='1.5'%20fill='%23c5cede'%20fill-opacity='0.06'/%3e%3c/svg%3e", xn = "data:image/svg+xml,%3csvg%20viewBox='0%200%2064%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='64'%20height='48'%20rx='3'%20fill='%23c5cede'%20fill-opacity='0.04'/%3e%3crect%20x='4'%20y='4'%20width='11'%20height='40'%20rx='1.5'%20fill='%23409EFF'/%3e%3crect%20x='6.5'%20y='7'%20width='2'%20height='2'%20rx='1'%20fill='white'%20fill-opacity='0.95'/%3e%3crect%20x='6.5'%20y='11'%20width='6'%20height='1.5'%20rx='0.75'%20fill='white'%20fill-opacity='0.75'/%3e%3crect%20x='6.5'%20y='14.5'%20width='6'%20height='1.5'%20rx='0.75'%20fill='white'%20fill-opacity='0.75'/%3e%3crect%20x='6.5'%20y='18'%20width='6'%20height='1.5'%20rx='0.75'%20fill='white'%20fill-opacity='0.75'/%3e%3crect%20x='17'%20y='4'%20width='43'%20height='40'%20rx='1.5'%20fill='%23c5cede'%20fill-opacity='0.06'/%3e%3c/svg%3e", Sn = "data:image/svg+xml,%3csvg%20viewBox='0%200%2064%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='64'%20height='48'%20rx='3'%20fill='%23c5cede'%20fill-opacity='0.04'/%3e%3crect%20x='4'%20y='4'%20width='56'%20height='7'%20rx='1.5'%20fill='%23409EFF'/%3e%3crect%20x='7'%20y='6.5'%20width='2'%20height='2'%20rx='1'%20fill='white'%20fill-opacity='0.95'/%3e%3crect%20x='11'%20y='7.25'%20width='6'%20height='1.5'%20rx='0.75'%20fill='white'%20fill-opacity='0.75'/%3e%3crect%20x='19'%20y='7.25'%20width='6'%20height='1.5'%20rx='0.75'%20fill='white'%20fill-opacity='0.75'/%3e%3crect%20x='27'%20y='7.25'%20width='6'%20height='1.5'%20rx='0.75'%20fill='white'%20fill-opacity='0.75'/%3e%3crect%20x='4'%20y='13'%20width='56'%20height='31'%20rx='1.5'%20fill='%23c5cede'%20fill-opacity='0.06'/%3e%3c/svg%3e", Cn = { class: "settings-section" }, wn = { class: "settings-layout-grid" }, Tn = ["onClick"], En = { class: "settings-layout-card__label" }, Dn = { class: "settings-section" }, On = { class: "settings-inline-setting" }, kn = {
|
|
745
|
+
key: 0,
|
|
746
|
+
class: "settings-section"
|
|
747
|
+
}, An = { class: "settings-menu-search-grid" }, jn = ["onClick"], Mn = /* @__PURE__ */ P({
|
|
748
|
+
__name: "LayoutSettings",
|
|
749
|
+
setup(e) {
|
|
750
|
+
let t = X(), n = [
|
|
751
|
+
{
|
|
752
|
+
label: "默认",
|
|
753
|
+
value: "default",
|
|
754
|
+
previewSrc: Qt
|
|
755
|
+
},
|
|
756
|
+
{
|
|
757
|
+
label: "侧边导航",
|
|
758
|
+
value: "side",
|
|
759
|
+
previewSrc: xn
|
|
760
|
+
},
|
|
761
|
+
{
|
|
762
|
+
label: "顶部导航",
|
|
763
|
+
value: "top",
|
|
764
|
+
previewSrc: Sn
|
|
765
|
+
},
|
|
766
|
+
{
|
|
767
|
+
label: "混合导航",
|
|
768
|
+
value: "mix",
|
|
769
|
+
previewSrc: bn
|
|
770
|
+
}
|
|
771
|
+
], r = [{
|
|
772
|
+
label: "顶部搜索",
|
|
773
|
+
value: "header",
|
|
774
|
+
icon: Ne
|
|
775
|
+
}, {
|
|
776
|
+
label: "侧边搜索",
|
|
777
|
+
value: "sidebar",
|
|
778
|
+
icon: Ae
|
|
779
|
+
}];
|
|
780
|
+
return (e, i) => {
|
|
781
|
+
let a = V("el-switch"), o = V("el-icon");
|
|
782
|
+
return R(), A(S, null, [
|
|
783
|
+
j("div", Cn, [i[0] ||= j("div", { class: "settings-section__header" }, [j("span", { class: "settings-section__title" }, "布局模式"), j("span", { class: "settings-section__desc" }, "切换侧边、顶部或混合导航")], -1), j("div", wn, [(R(), A(S, null, B(n, (e) => j("button", {
|
|
784
|
+
key: e.value,
|
|
785
|
+
type: "button",
|
|
786
|
+
class: I(["settings-layout-card", { "is-active": W(t).layoutMode === e.value }]),
|
|
787
|
+
onClick: (n) => W(t).setLayoutMode(e.value)
|
|
788
|
+
}, [N(tn, {
|
|
789
|
+
class: "settings-layout-card__preview",
|
|
790
|
+
src: e.previewSrc,
|
|
791
|
+
"primary-color": W(t).themeColor
|
|
792
|
+
}, null, 8, ["src", "primary-color"]), j("span", En, U(e.label), 1)], 10, Tn)), 64))])]),
|
|
793
|
+
j("div", Dn, [j("div", On, [i[1] ||= j("div", null, [j("strong", null, "默认折叠侧边栏"), j("p", null, "适合屏幕较窄或想保留更多内容区空间")], -1), N(a, {
|
|
794
|
+
"model-value": W(t).sidebarCollapsed,
|
|
795
|
+
"onUpdate:modelValue": W(t).setSidebarCollapsed
|
|
796
|
+
}, null, 8, ["model-value", "onUpdate:modelValue"])])]),
|
|
797
|
+
W(t).layoutMode === "top" ? k("", !0) : (R(), A("div", kn, [i[2] ||= j("div", { class: "settings-section__header" }, [j("span", { class: "settings-section__title" }, "菜单搜索位置"), j("span", { class: "settings-section__desc" }, "顶部或侧边栏顶部搜索")], -1), j("div", An, [(R(), A(S, null, B(r, (e) => j("button", {
|
|
798
|
+
key: e.value,
|
|
799
|
+
type: "button",
|
|
800
|
+
class: I(["settings-mode-card", { "is-active": W(t).menuSearchPlacement === e.value }]),
|
|
801
|
+
onClick: (n) => W(t).setMenuSearchPlacement(e.value)
|
|
802
|
+
}, [N(o, { size: 20 }, {
|
|
803
|
+
default: K(() => [(R(), O(H(e.icon)))]),
|
|
804
|
+
_: 2
|
|
805
|
+
}, 1024), j("strong", null, U(e.label), 1)], 10, jn)), 64))])]))
|
|
806
|
+
], 64);
|
|
807
|
+
};
|
|
808
|
+
}
|
|
809
|
+
}), Nn = { class: "shortcut-settings" }, Pn = { class: "shortcut-master-switch" }, Fn = { class: "shortcut-group__title" }, In = { class: "shortcut-list" }, Ln = { class: "shortcut-item__copy" }, Rn = { class: "shortcut-item__control" }, zn = ["aria-label"], Bn = /* @__PURE__ */ u(/* @__PURE__ */ P({
|
|
810
|
+
__name: "ShortcutSettings",
|
|
811
|
+
setup(e) {
|
|
812
|
+
let t = Ht(), n = {
|
|
813
|
+
global: "全局",
|
|
814
|
+
navigation: "导航",
|
|
815
|
+
other: "其他"
|
|
816
|
+
}, r = E(() => {
|
|
817
|
+
let e = /* @__PURE__ */ new Map();
|
|
818
|
+
for (let n of t.shortcuts) {
|
|
819
|
+
let t = e.get(n.category) ?? [];
|
|
820
|
+
t.push(n), e.set(n.category, t);
|
|
821
|
+
}
|
|
822
|
+
return Array.from(e.entries()).map(([e, t]) => ({
|
|
823
|
+
category: e,
|
|
824
|
+
label: n[e],
|
|
825
|
+
shortcuts: t
|
|
826
|
+
}));
|
|
827
|
+
});
|
|
828
|
+
return (e, n) => {
|
|
829
|
+
let i = V("el-switch");
|
|
830
|
+
return R(), A("div", Nn, [j("div", Pn, [n[1] ||= j("div", { class: "shortcut-master-switch__copy" }, [j("strong", null, "快捷键"), j("span", null, "启用或停用全部键盘快捷操作")], -1), N(i, {
|
|
831
|
+
"model-value": W(t).shortcutEnabled,
|
|
832
|
+
onChange: n[0] ||= (e) => W(t).toggleShortcutEnabled()
|
|
833
|
+
}, null, 8, ["model-value"])]), (R(!0), A(S, null, B(r.value, (e) => (R(), A("div", {
|
|
834
|
+
key: e.category,
|
|
835
|
+
class: I(["shortcut-group", { "is-disabled": !W(t).shortcutEnabled }])
|
|
836
|
+
}, [j("div", Fn, U(e.label), 1), j("div", In, [(R(!0), A(S, null, B(e.shortcuts, (e) => (R(), A("div", {
|
|
837
|
+
key: e.id,
|
|
838
|
+
class: "shortcut-item"
|
|
839
|
+
}, [j("div", Ln, [j("strong", null, U(e.name), 1), j("span", null, U(e.description), 1)]), j("div", Rn, [j("div", {
|
|
840
|
+
class: "shortcut-keys",
|
|
841
|
+
"aria-label": W(Jt)(e.keys)
|
|
842
|
+
}, [(R(!0), A(S, null, B(W(qt)(e.keys), (t, n) => (R(), A("kbd", {
|
|
843
|
+
key: `${e.id}-${t.original}-${n}`,
|
|
844
|
+
class: "shortcut-key"
|
|
845
|
+
}, U(t.symbol || t.display), 1))), 128))], 8, zn), N(i, {
|
|
846
|
+
"model-value": e.enabled,
|
|
847
|
+
disabled: !W(t).shortcutEnabled,
|
|
848
|
+
onChange: (n) => W(t).toggleShortcut(e.id)
|
|
849
|
+
}, null, 8, [
|
|
850
|
+
"model-value",
|
|
851
|
+
"disabled",
|
|
852
|
+
"onChange"
|
|
853
|
+
])])]))), 128))])], 2))), 128))]);
|
|
854
|
+
};
|
|
855
|
+
}
|
|
856
|
+
}), [["__scopeId", "data-v-2b492d65"]]), Vn = /* @__PURE__ */ P({
|
|
857
|
+
__name: "SystemSettingsDrawer",
|
|
858
|
+
setup(e) {
|
|
859
|
+
let t = X();
|
|
860
|
+
function n(e) {
|
|
861
|
+
e || t.closeSettings();
|
|
862
|
+
}
|
|
863
|
+
return (e, r) => {
|
|
864
|
+
let i = V("el-tab-pane"), a = V("el-tabs");
|
|
865
|
+
return R(), O(W(le), {
|
|
866
|
+
"model-value": W(t).settingsVisible,
|
|
867
|
+
title: "主题设置",
|
|
868
|
+
direction: "rtl",
|
|
869
|
+
size: "380px",
|
|
870
|
+
class: "settings-drawer",
|
|
871
|
+
"show-footer": !1,
|
|
872
|
+
"onUpdate:modelValue": n
|
|
873
|
+
}, {
|
|
874
|
+
default: K(() => [N(a, {
|
|
875
|
+
modelValue: W(t).settingsActiveTab,
|
|
876
|
+
"onUpdate:modelValue": r[0] ||= (e) => W(t).settingsActiveTab = e,
|
|
877
|
+
class: "settings-tabs"
|
|
878
|
+
}, {
|
|
879
|
+
default: K(() => [
|
|
880
|
+
N(i, {
|
|
881
|
+
label: "外观",
|
|
882
|
+
name: "theme"
|
|
883
|
+
}, {
|
|
884
|
+
default: K(() => [N(gn)]),
|
|
885
|
+
_: 1
|
|
886
|
+
}),
|
|
887
|
+
N(i, {
|
|
888
|
+
label: "布局",
|
|
889
|
+
name: "layout"
|
|
890
|
+
}, {
|
|
891
|
+
default: K(() => [N(Mn)]),
|
|
892
|
+
_: 1
|
|
893
|
+
}),
|
|
894
|
+
N(i, {
|
|
895
|
+
label: "通用",
|
|
896
|
+
name: "general"
|
|
897
|
+
}, {
|
|
898
|
+
default: K(() => [N(yn)]),
|
|
899
|
+
_: 1
|
|
900
|
+
}),
|
|
901
|
+
N(i, {
|
|
902
|
+
label: "快捷键",
|
|
903
|
+
name: "shortcut"
|
|
904
|
+
}, {
|
|
905
|
+
default: K(() => [N(Bn)]),
|
|
906
|
+
_: 1
|
|
907
|
+
})
|
|
908
|
+
]),
|
|
909
|
+
_: 1
|
|
910
|
+
}, 8, ["modelValue"])]),
|
|
911
|
+
_: 1
|
|
912
|
+
}, 8, ["model-value"]);
|
|
913
|
+
};
|
|
914
|
+
}
|
|
915
|
+
}), Hn = /* @__PURE__ */ P({
|
|
916
|
+
__name: "AppContentView",
|
|
917
|
+
props: { refreshKey: {} },
|
|
918
|
+
setup(e) {
|
|
919
|
+
return (t, n) => {
|
|
920
|
+
let r = V("router-view"), i = V("el-main");
|
|
921
|
+
return R(), O(i, { class: "app-layout__main" }, {
|
|
922
|
+
default: K(() => [N(r, null, {
|
|
923
|
+
default: K(({ Component: t, route: n }) => [(R(), O(H(t), { key: `${n.fullPath}:${e.refreshKey}` }))]),
|
|
924
|
+
_: 1
|
|
925
|
+
})]),
|
|
926
|
+
_: 1
|
|
927
|
+
});
|
|
928
|
+
};
|
|
929
|
+
}
|
|
930
|
+
}), Un = ["title"], Wn = /* @__PURE__ */ u(/* @__PURE__ */ P({
|
|
931
|
+
__name: "ThemeToggleButton",
|
|
932
|
+
setup(e) {
|
|
933
|
+
let t = X();
|
|
934
|
+
async function n(e) {
|
|
935
|
+
await kt(e, () => {
|
|
936
|
+
t.toggleDarkMode();
|
|
937
|
+
});
|
|
938
|
+
}
|
|
939
|
+
return (e, r) => {
|
|
940
|
+
let i = V("el-icon");
|
|
941
|
+
return R(), A("button", {
|
|
942
|
+
type: "button",
|
|
943
|
+
class: "app-layout__header-tool-btn theme-icon-btn",
|
|
944
|
+
title: W(t).isDark ? "切换浅色模式" : "切换深色模式",
|
|
945
|
+
onClick: n
|
|
946
|
+
}, [N(i, { size: 20 }, {
|
|
947
|
+
default: K(() => [(R(), O(H(W(t).isDark ? W(Fe) : W(ke))))]),
|
|
948
|
+
_: 1
|
|
949
|
+
})], 8, Un);
|
|
950
|
+
};
|
|
951
|
+
}
|
|
952
|
+
}), [["__scopeId", "data-v-73aaf569"]]);
|
|
953
|
+
//#endregion
|
|
954
|
+
//#region src/main/layouts/composables/useAppMenus.ts
|
|
955
|
+
function Gn() {
|
|
956
|
+
let e = v(), t = y(), n = X(), r = a(), i = E(() => Kn(t.options.routes.find((e) => e.path === "/")?.children ?? [], "", r.hasPermission)), o = E(() => i.value), s = E(() => n.isMobileViewport || n.layoutMode !== "mix" ? i.value : i.value.find((e) => e.fullPath === n.selectedTopMenuPath)?.children ?? []), c = E(() => qn(i.value).filter((e) => !e.children?.length)), l = E(() => qn(s.value).filter((e) => !e.children?.length));
|
|
957
|
+
return {
|
|
958
|
+
activeMenu: E(() => e.path),
|
|
959
|
+
activeTopMenuPath: E(() => {
|
|
960
|
+
let t = e.path;
|
|
961
|
+
return o.value.find((e) => t === e.fullPath || t.startsWith(`${e.fullPath}/`))?.fullPath || n.selectedTopMenuPath;
|
|
962
|
+
}),
|
|
963
|
+
allMenus: i,
|
|
964
|
+
flatMenus: c,
|
|
965
|
+
flatSideMenus: l,
|
|
966
|
+
findFirstLeafNode: Jn,
|
|
967
|
+
findFirstLeafPath: Yn,
|
|
968
|
+
sideMenus: s,
|
|
969
|
+
topMenus: o
|
|
970
|
+
};
|
|
971
|
+
}
|
|
972
|
+
function Kn(e, t, n) {
|
|
973
|
+
return e.filter((e) => !e.meta?.hidden && Zn(e, n)).map((e) => {
|
|
974
|
+
let r = $n(e.path, t), i = e.children?.length ? Kn(e.children, r, n) : void 0;
|
|
975
|
+
return {
|
|
976
|
+
path: e.path,
|
|
977
|
+
fullPath: r,
|
|
978
|
+
title: String(e.meta?.title ?? e.name ?? "未命名菜单"),
|
|
979
|
+
icon: e.meta?.icon ? String(e.meta.icon) : void 0,
|
|
980
|
+
children: i
|
|
981
|
+
};
|
|
982
|
+
}).filter((t) => t.children?.length || !Qn(e, t.path));
|
|
983
|
+
}
|
|
984
|
+
function qn(e) {
|
|
985
|
+
return e.flatMap((e) => [e, ...qn(e.children ?? [])]);
|
|
986
|
+
}
|
|
987
|
+
function Jn(e) {
|
|
988
|
+
if (!e.children?.length) return e;
|
|
989
|
+
for (let t of e.children) {
|
|
990
|
+
let e = Jn(t);
|
|
991
|
+
if (e) return e;
|
|
992
|
+
}
|
|
993
|
+
return null;
|
|
994
|
+
}
|
|
995
|
+
function Yn(e, t, n = "") {
|
|
996
|
+
for (let r of e) {
|
|
997
|
+
let e = $n(r.path, n);
|
|
998
|
+
if (e === t) return Xn(r, n);
|
|
999
|
+
if (r.children?.length) {
|
|
1000
|
+
let n = Yn(r.children, t, e);
|
|
1001
|
+
if (n) return n;
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
return null;
|
|
1005
|
+
}
|
|
1006
|
+
function Xn(e, t) {
|
|
1007
|
+
let n = $n(e.path, t);
|
|
1008
|
+
if (e.component) return n;
|
|
1009
|
+
let r = e.children ?? [];
|
|
1010
|
+
for (let e of r) {
|
|
1011
|
+
let t = $n(e.path, n);
|
|
1012
|
+
if (e.component) return t;
|
|
1013
|
+
}
|
|
1014
|
+
for (let e of r) {
|
|
1015
|
+
let t = Xn(e, n);
|
|
1016
|
+
if (t) return t;
|
|
1017
|
+
}
|
|
1018
|
+
return null;
|
|
1019
|
+
}
|
|
1020
|
+
function Zn(e, t) {
|
|
1021
|
+
let n = e.meta?.permission;
|
|
1022
|
+
return n ? Array.isArray(n) ? n.every((e) => t(String(e))) : t(String(n)) : !0;
|
|
1023
|
+
}
|
|
1024
|
+
function Qn(e, t) {
|
|
1025
|
+
let n = e.find((e) => e.path === t);
|
|
1026
|
+
return !!(n?.redirect && !n.component && !n.children?.length);
|
|
1027
|
+
}
|
|
1028
|
+
function $n(e, t) {
|
|
1029
|
+
return e.startsWith("/") ? e : `${t}/${e}`.replace(/\/+/g, "/");
|
|
1030
|
+
}
|
|
1031
|
+
//#endregion
|
|
1032
|
+
//#region src/main/layouts/components/AppBrandLogo.vue?vue&type=script&setup=true&lang.ts
|
|
1033
|
+
var er = ["src", "alt"], tr = ["src", "alt"], nr = /* @__PURE__ */ u(/* @__PURE__ */ P({
|
|
1034
|
+
__name: "AppBrandLogo",
|
|
1035
|
+
props: {
|
|
1036
|
+
src: {},
|
|
1037
|
+
alt: {},
|
|
1038
|
+
textInverted: {
|
|
1039
|
+
type: Boolean,
|
|
1040
|
+
default: !1
|
|
1041
|
+
},
|
|
1042
|
+
width: { default: "158px" },
|
|
1043
|
+
height: { default: "40px" }
|
|
1044
|
+
},
|
|
1045
|
+
setup(e) {
|
|
1046
|
+
let t = e, n = E(() => ({
|
|
1047
|
+
"--app-brand-logo-width": t.width,
|
|
1048
|
+
"--app-brand-logo-height": t.height
|
|
1049
|
+
}));
|
|
1050
|
+
return (t, r) => (R(), A("span", {
|
|
1051
|
+
class: "app-brand-logo",
|
|
1052
|
+
style: te(n.value)
|
|
1053
|
+
}, [j("img", {
|
|
1054
|
+
src: e.src,
|
|
1055
|
+
alt: e.alt,
|
|
1056
|
+
class: I(["app-brand-logo__image", { "is-text-base": e.textInverted }])
|
|
1057
|
+
}, null, 10, er), e.textInverted ? (R(), A("img", {
|
|
1058
|
+
key: 0,
|
|
1059
|
+
src: e.src,
|
|
1060
|
+
alt: e.alt,
|
|
1061
|
+
class: "app-brand-logo__image app-brand-logo__image--text-inverted",
|
|
1062
|
+
"aria-hidden": "true"
|
|
1063
|
+
}, null, 8, tr)) : k("", !0)], 4));
|
|
1064
|
+
}
|
|
1065
|
+
}), [["__scopeId", "data-v-a42b8639"]]), rr = {
|
|
1066
|
+
Connection: ve,
|
|
1067
|
+
Document: xe,
|
|
1068
|
+
Grid: Te,
|
|
1069
|
+
House: Ee,
|
|
1070
|
+
Setting: Pe,
|
|
1071
|
+
Upload: Re,
|
|
1072
|
+
User: ze
|
|
1073
|
+
};
|
|
1074
|
+
function Z(e) {
|
|
1075
|
+
return e ? rr[e] ?? Ee : Ee;
|
|
1076
|
+
}
|
|
1077
|
+
//#endregion
|
|
1078
|
+
//#region src/main/layouts/components/AppHeaderMenuNode.vue
|
|
1079
|
+
var ir = /* @__PURE__ */ P({
|
|
1080
|
+
name: "AppHeaderMenuNode",
|
|
1081
|
+
__name: "AppHeaderMenuNode",
|
|
1082
|
+
props: { node: {} },
|
|
1083
|
+
setup(e) {
|
|
1084
|
+
return (t, n) => {
|
|
1085
|
+
let r = V("el-icon"), i = V("AppHeaderMenuNode", !0), a = V("el-sub-menu"), o = V("el-menu-item");
|
|
1086
|
+
return e.node.children?.length ? (R(), O(a, {
|
|
1087
|
+
key: 0,
|
|
1088
|
+
index: e.node.fullPath
|
|
1089
|
+
}, {
|
|
1090
|
+
title: K(() => [e.node.icon ? (R(), O(r, { key: 0 }, {
|
|
1091
|
+
default: K(() => [(R(), O(H(W(Z)(e.node.icon))))]),
|
|
1092
|
+
_: 1
|
|
1093
|
+
})) : k("", !0), j("span", null, U(e.node.title), 1)]),
|
|
1094
|
+
default: K(() => [(R(!0), A(S, null, B(e.node.children, (e) => (R(), O(i, {
|
|
1095
|
+
key: e.fullPath,
|
|
1096
|
+
node: e
|
|
1097
|
+
}, null, 8, ["node"]))), 128))]),
|
|
1098
|
+
_: 1
|
|
1099
|
+
}, 8, ["index"])) : (R(), O(o, {
|
|
1100
|
+
key: 1,
|
|
1101
|
+
index: e.node.fullPath
|
|
1102
|
+
}, {
|
|
1103
|
+
default: K(() => [e.node.icon ? (R(), O(r, { key: 0 }, {
|
|
1104
|
+
default: K(() => [(R(), O(H(W(Z)(e.node.icon))))]),
|
|
1105
|
+
_: 1
|
|
1106
|
+
})) : k("", !0), j("span", null, U(e.node.title), 1)]),
|
|
1107
|
+
_: 1
|
|
1108
|
+
}, 8, ["index"]));
|
|
1109
|
+
};
|
|
1110
|
+
}
|
|
1111
|
+
}), ar = "data:image/svg+xml,%3csvg%20width='18'%20height='18'%20viewBox='0%200%2018%2018'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M13.5%204.5V8.25C13.5%209.49264%2012.4926%2010.5%2011.25%2010.5H4.5'%20stroke='%23fff'%20stroke-width='1.8'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M7.5%207.5L4.5%2010.5L7.5%2013.5'%20stroke='%23fff'%20stroke-width='1.8'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e", or = { class: "app-menu-search-item__icon" }, sr = { class: "app-menu-search-item__body" }, cr = {
|
|
1112
|
+
key: 0,
|
|
1113
|
+
class: "app-menu-search-item__actions"
|
|
1114
|
+
}, lr = { class: "app-menu-search-item__enter" }, ur = ["src"], dr = /* @__PURE__ */ P({
|
|
1115
|
+
__name: "AppMenuSearchItem",
|
|
1116
|
+
props: {
|
|
1117
|
+
active: { type: Boolean },
|
|
1118
|
+
item: {},
|
|
1119
|
+
removable: { type: Boolean }
|
|
1120
|
+
},
|
|
1121
|
+
emits: [
|
|
1122
|
+
"enter",
|
|
1123
|
+
"remove",
|
|
1124
|
+
"select"
|
|
1125
|
+
],
|
|
1126
|
+
setup(e, { emit: t }) {
|
|
1127
|
+
let n = t;
|
|
1128
|
+
return (t, r) => {
|
|
1129
|
+
let i = V("el-icon");
|
|
1130
|
+
return R(), A("div", {
|
|
1131
|
+
class: I(["app-menu-search-item", { "is-active": e.active }]),
|
|
1132
|
+
onMouseenter: r[4] ||= (t) => n("enter", e.item)
|
|
1133
|
+
}, [j("div", {
|
|
1134
|
+
class: "app-menu-search-item__main",
|
|
1135
|
+
role: "button",
|
|
1136
|
+
tabindex: "0",
|
|
1137
|
+
onClick: r[1] ||= (t) => n("select", e.item),
|
|
1138
|
+
onKeydown: [r[2] ||= oe(q((t) => n("select", e.item), ["prevent"]), ["enter"]), r[3] ||= oe(q((t) => n("select", e.item), ["prevent"]), ["space"])]
|
|
1139
|
+
}, [
|
|
1140
|
+
j("span", or, [N(i, null, {
|
|
1141
|
+
default: K(() => [(R(), O(H(W(Z)(e.item.icon))))]),
|
|
1142
|
+
_: 1
|
|
1143
|
+
})]),
|
|
1144
|
+
j("span", sr, [j("strong", null, U(e.item.title), 1), j("span", null, U(e.item.fullPath), 1)]),
|
|
1145
|
+
N(w, { name: "app-menu-search-actions" }, {
|
|
1146
|
+
default: K(() => [e.active ? (R(), A("span", cr, [j("span", lr, [j("img", {
|
|
1147
|
+
src: W(ar),
|
|
1148
|
+
alt: "",
|
|
1149
|
+
"aria-hidden": "true"
|
|
1150
|
+
}, null, 8, ur)]), e.removable ? (R(), A("button", {
|
|
1151
|
+
key: 0,
|
|
1152
|
+
class: "app-menu-search-item__remove",
|
|
1153
|
+
type: "button",
|
|
1154
|
+
"aria-label": "删除搜索历史",
|
|
1155
|
+
onClick: r[0] ||= q((t) => n("remove", e.item), ["stop"])
|
|
1156
|
+
}, [N(i, null, {
|
|
1157
|
+
default: K(() => [N(W(_e))]),
|
|
1158
|
+
_: 1
|
|
1159
|
+
})])) : k("", !0)])) : k("", !0)]),
|
|
1160
|
+
_: 1
|
|
1161
|
+
})
|
|
1162
|
+
], 32)], 34);
|
|
1163
|
+
};
|
|
1164
|
+
}
|
|
1165
|
+
}), fr = { class: "app-menu-search__control" }, pr = {
|
|
1166
|
+
key: 0,
|
|
1167
|
+
class: "app-menu-search__section"
|
|
1168
|
+
}, mr = {
|
|
1169
|
+
key: 1,
|
|
1170
|
+
class: "app-menu-search__section"
|
|
1171
|
+
}, hr = {
|
|
1172
|
+
key: 2,
|
|
1173
|
+
class: "app-menu-search__empty"
|
|
1174
|
+
}, gr = { class: "app-menu-search__footer" }, _r = "menu-search-history", vr = 8, yr = 70, br = 28, xr = 520, Sr = /* @__PURE__ */ P({
|
|
1175
|
+
__name: "AppMenuSearch",
|
|
1176
|
+
props: { modelValue: { type: Boolean } },
|
|
1177
|
+
emits: ["update:modelValue"],
|
|
1178
|
+
setup(e, { emit: t }) {
|
|
1179
|
+
let n = e, r = t, i = y(), { flatMenus: a } = Gn(), o = z(), s = z(), c = z(""), l = z(0), u = z(null), d = z(ne()), f = E(() => c.value.trim().toLowerCase()), p = E(() => f.value ? a.value.filter((e) => {
|
|
1180
|
+
let t = e.title.toLowerCase(), n = e.fullPath.toLowerCase();
|
|
1181
|
+
return t.includes(f.value) || n.includes(f.value);
|
|
1182
|
+
}) : []), m = E(() => c.value ? p.value : d.value), h = E(() => c.value ? !p.value.length : !d.value.length);
|
|
1183
|
+
G(() => n.modelValue, (e) => {
|
|
1184
|
+
if (!e) {
|
|
1185
|
+
ae();
|
|
1186
|
+
return;
|
|
1187
|
+
}
|
|
1188
|
+
d.value = ne(), c.value = "", u.value = d.value[0] ?? null, l.value = 0, document.body.classList.add("app-menu-search-open"), H(), F(() => {
|
|
1189
|
+
o.value?.focus?.(), s.value?.setScrollTop?.(0);
|
|
1190
|
+
});
|
|
1191
|
+
}), G(p, (e) => {
|
|
1192
|
+
u.value = e[0] ?? null, s.value?.setScrollTop?.(0);
|
|
1193
|
+
}), L(() => {
|
|
1194
|
+
ae();
|
|
1195
|
+
});
|
|
1196
|
+
function g() {
|
|
1197
|
+
r("update:modelValue", !1), ae();
|
|
1198
|
+
}
|
|
1199
|
+
function _(e) {
|
|
1200
|
+
u.value = e;
|
|
1201
|
+
}
|
|
1202
|
+
function v(e) {
|
|
1203
|
+
te(e), g(), i.push(e.fullPath);
|
|
1204
|
+
}
|
|
1205
|
+
function b(e) {
|
|
1206
|
+
let t = d.value.filter((t) => t.fullPath !== e.fullPath);
|
|
1207
|
+
re(t), u.value?.fullPath === e.fullPath && (u.value = t[0] ?? null);
|
|
1208
|
+
}
|
|
1209
|
+
function x() {
|
|
1210
|
+
re([]), u.value = null;
|
|
1211
|
+
}
|
|
1212
|
+
function ee(e) {
|
|
1213
|
+
l.value = e.scrollTop;
|
|
1214
|
+
}
|
|
1215
|
+
function D(e) {
|
|
1216
|
+
if (n.modelValue && !e.isComposing) {
|
|
1217
|
+
if (e.code === "Escape") {
|
|
1218
|
+
e.preventDefault(), g();
|
|
1219
|
+
return;
|
|
1220
|
+
}
|
|
1221
|
+
if (e.code === "Enter" && u.value) {
|
|
1222
|
+
e.preventDefault(), v(u.value);
|
|
1223
|
+
return;
|
|
1224
|
+
}
|
|
1225
|
+
(e.code === "ArrowDown" || e.code === "ArrowUp") && (e.preventDefault(), P(e.code === "ArrowDown" ? 1 : -1));
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
function P(e) {
|
|
1229
|
+
let t = m.value;
|
|
1230
|
+
if (!t.length) return;
|
|
1231
|
+
let n = ie((u.value ? t.findIndex((e) => e.fullPath === u.value?.fullPath) : -1) + e, 0, t.length - 1), r = t[n];
|
|
1232
|
+
r && (u.value = r, I(n));
|
|
1233
|
+
}
|
|
1234
|
+
function I(e) {
|
|
1235
|
+
let t = br + e * yr, n = l.value, r = l.value + xr - yr;
|
|
1236
|
+
t < n ? s.value?.setScrollTop?.(t) : t > r && s.value?.setScrollTop?.(t - xr + yr);
|
|
1237
|
+
}
|
|
1238
|
+
function te(e) {
|
|
1239
|
+
re([e, ...d.value.filter((t) => t.fullPath !== e.fullPath)].slice(0, vr));
|
|
1240
|
+
}
|
|
1241
|
+
function ne() {
|
|
1242
|
+
try {
|
|
1243
|
+
let e = localStorage.getItem(_r);
|
|
1244
|
+
if (!e) return [];
|
|
1245
|
+
let t = JSON.parse(e), n = new Set(a.value.map((e) => e.fullPath));
|
|
1246
|
+
return t.filter((e) => n.has(e.fullPath));
|
|
1247
|
+
} catch {
|
|
1248
|
+
return [];
|
|
1249
|
+
}
|
|
1250
|
+
}
|
|
1251
|
+
function re(e) {
|
|
1252
|
+
if (d.value = e, !e.length) {
|
|
1253
|
+
localStorage.removeItem(_r);
|
|
1254
|
+
return;
|
|
1255
|
+
}
|
|
1256
|
+
localStorage.setItem(_r, JSON.stringify(e));
|
|
1257
|
+
}
|
|
1258
|
+
function ie(e, t, n) {
|
|
1259
|
+
return Math.min(Math.max(e, t), n);
|
|
1260
|
+
}
|
|
1261
|
+
function H() {
|
|
1262
|
+
window.removeEventListener("keydown", D, !0), window.addEventListener("keydown", D, !0);
|
|
1263
|
+
}
|
|
1264
|
+
function ae() {
|
|
1265
|
+
document.body.classList.remove("app-menu-search-open"), window.removeEventListener("keydown", D, !0);
|
|
1266
|
+
}
|
|
1267
|
+
return (t, n) => {
|
|
1268
|
+
let r = V("el-icon"), i = V("el-input"), a = V("el-scrollbar");
|
|
1269
|
+
return R(), O(C, { to: "body" }, [N(w, { name: "app-menu-search-fade" }, {
|
|
1270
|
+
default: K(() => [e.modelValue ? (R(), A("section", {
|
|
1271
|
+
key: 0,
|
|
1272
|
+
class: "app-menu-search",
|
|
1273
|
+
tabindex: "-1",
|
|
1274
|
+
onClick: q(g, ["self"])
|
|
1275
|
+
}, [j("div", {
|
|
1276
|
+
class: "app-menu-search__panel",
|
|
1277
|
+
onClick: n[1] ||= q(() => {}, ["stop"])
|
|
1278
|
+
}, [
|
|
1279
|
+
j("div", fr, [N(i, {
|
|
1280
|
+
ref_key: "searchInputRef",
|
|
1281
|
+
ref: o,
|
|
1282
|
+
modelValue: c.value,
|
|
1283
|
+
"onUpdate:modelValue": n[0] ||= (e) => c.value = e,
|
|
1284
|
+
size: "large",
|
|
1285
|
+
placeholder: "搜索页面名称或路径",
|
|
1286
|
+
clearable: ""
|
|
1287
|
+
}, {
|
|
1288
|
+
prefix: K(() => [N(r, null, {
|
|
1289
|
+
default: K(() => [N(W(Ne))]),
|
|
1290
|
+
_: 1
|
|
1291
|
+
})]),
|
|
1292
|
+
_: 1
|
|
1293
|
+
}, 8, ["modelValue"])]),
|
|
1294
|
+
N(a, {
|
|
1295
|
+
ref_key: "scrollbarRef",
|
|
1296
|
+
ref: s,
|
|
1297
|
+
class: "app-menu-search__scroll",
|
|
1298
|
+
"max-height": "520px",
|
|
1299
|
+
onScroll: ee
|
|
1300
|
+
}, {
|
|
1301
|
+
default: K(() => [
|
|
1302
|
+
p.value.length ? (R(), A("div", pr, [n[2] ||= j("div", { class: "app-menu-search__section-title" }, "页面", -1), N(T, {
|
|
1303
|
+
name: "app-menu-search-list",
|
|
1304
|
+
tag: "div",
|
|
1305
|
+
class: "app-menu-search__list"
|
|
1306
|
+
}, {
|
|
1307
|
+
default: K(() => [(R(!0), A(S, null, B(p.value, (e) => (R(), O(dr, {
|
|
1308
|
+
key: e.fullPath,
|
|
1309
|
+
active: u.value?.fullPath === e.fullPath,
|
|
1310
|
+
item: e,
|
|
1311
|
+
onEnter: _,
|
|
1312
|
+
onSelect: v
|
|
1313
|
+
}, null, 8, ["active", "item"]))), 128))]),
|
|
1314
|
+
_: 1
|
|
1315
|
+
})])) : k("", !0),
|
|
1316
|
+
!c.value && d.value.length ? (R(), A("div", mr, [j("div", { class: "app-menu-search__section-header" }, [n[3] ||= j("div", { class: "app-menu-search__section-title" }, "搜索历史", -1), j("button", {
|
|
1317
|
+
class: "app-menu-search__clear",
|
|
1318
|
+
type: "button",
|
|
1319
|
+
onClick: x
|
|
1320
|
+
}, " 清空 ")]), N(T, {
|
|
1321
|
+
name: "app-menu-search-list",
|
|
1322
|
+
tag: "div",
|
|
1323
|
+
class: "app-menu-search__list"
|
|
1324
|
+
}, {
|
|
1325
|
+
default: K(() => [(R(!0), A(S, null, B(d.value, (e) => (R(), O(dr, {
|
|
1326
|
+
key: e.fullPath,
|
|
1327
|
+
active: u.value?.fullPath === e.fullPath,
|
|
1328
|
+
item: e,
|
|
1329
|
+
removable: "",
|
|
1330
|
+
onEnter: _,
|
|
1331
|
+
onRemove: b,
|
|
1332
|
+
onSelect: v
|
|
1333
|
+
}, null, 8, ["active", "item"]))), 128))]),
|
|
1334
|
+
_: 1
|
|
1335
|
+
})])) : k("", !0),
|
|
1336
|
+
h.value ? (R(), A("div", hr, U(c.value ? "没有匹配的页面" : "没有搜索历史"), 1)) : k("", !0)
|
|
1337
|
+
]),
|
|
1338
|
+
_: 1
|
|
1339
|
+
}, 512),
|
|
1340
|
+
j("div", gr, [
|
|
1341
|
+
n[5] ||= j("span", null, [j("kbd", null, "Enter"), M("选择")], -1),
|
|
1342
|
+
j("span", null, [
|
|
1343
|
+
N(r, null, {
|
|
1344
|
+
default: K(() => [N(W(fe))]),
|
|
1345
|
+
_: 1
|
|
1346
|
+
}),
|
|
1347
|
+
N(r, null, {
|
|
1348
|
+
default: K(() => [N(W(me))]),
|
|
1349
|
+
_: 1
|
|
1350
|
+
}),
|
|
1351
|
+
n[4] ||= M("切换", -1)
|
|
1352
|
+
]),
|
|
1353
|
+
n[6] ||= j("span", null, [j("kbd", null, "Esc"), M("关闭")], -1)
|
|
1354
|
+
])
|
|
1355
|
+
])])) : k("", !0)]),
|
|
1356
|
+
_: 1
|
|
1357
|
+
})]);
|
|
1358
|
+
};
|
|
1359
|
+
}
|
|
1360
|
+
});
|
|
1361
|
+
//#endregion
|
|
1362
|
+
//#region src/main/layouts/composables/useShortcutLabel.ts
|
|
1363
|
+
function Cr() {
|
|
1364
|
+
let e = Ht();
|
|
1365
|
+
return {
|
|
1366
|
+
isMac: E(() => typeof navigator > "u" ? !1 : /Mac|iPhone|iPad|iPod/i.test(navigator.platform)),
|
|
1367
|
+
searchShortcutLabel: E(() => Jt(e.getShortcutKeys("search"), { useSymbol: !0 }))
|
|
1368
|
+
};
|
|
1369
|
+
}
|
|
1370
|
+
//#endregion
|
|
1371
|
+
//#region src/main/layouts/components/AppMenuSearchTrigger.vue?vue&type=script&setup=true&lang.ts
|
|
1372
|
+
var wr = { class: "app-menu-search-trigger__shortcut" }, Tr = /* @__PURE__ */ P({
|
|
1373
|
+
__name: "AppMenuSearchTrigger",
|
|
1374
|
+
props: { layoutMode: {} },
|
|
1375
|
+
emits: ["open"],
|
|
1376
|
+
setup(e, { emit: t }) {
|
|
1377
|
+
let n = t, { searchShortcutLabel: r } = Cr();
|
|
1378
|
+
return (t, i) => {
|
|
1379
|
+
let a = V("el-icon");
|
|
1380
|
+
return R(), A("button", {
|
|
1381
|
+
class: I(["app-menu-search-trigger", `app-menu-search-trigger--${e.layoutMode}`]),
|
|
1382
|
+
type: "button",
|
|
1383
|
+
"aria-label": "搜索页面",
|
|
1384
|
+
onClick: i[0] ||= (e) => n("open")
|
|
1385
|
+
}, [
|
|
1386
|
+
N(a, null, {
|
|
1387
|
+
default: K(() => [N(W(Ne))]),
|
|
1388
|
+
_: 1
|
|
1389
|
+
}),
|
|
1390
|
+
i[1] ||= j("span", { class: "app-menu-search-trigger__text" }, "搜索页面", -1),
|
|
1391
|
+
j("span", wr, U(W(r)), 1)
|
|
1392
|
+
], 2);
|
|
1393
|
+
};
|
|
1394
|
+
}
|
|
1395
|
+
}), Er = { class: "app-layout__header-left" }, Dr = {
|
|
1396
|
+
key: 0,
|
|
1397
|
+
class: "app-layout__header-brand"
|
|
1398
|
+
}, Or = ["title", "aria-label"], kr = { class: "app-layout__header-right" }, Ar = { class: "app-layout__user" }, jr = { class: "app-layout__user-copy" }, Mr = /* @__PURE__ */ P({
|
|
1399
|
+
__name: "AppHeader",
|
|
1400
|
+
props: { breadcrumbItems: {} },
|
|
1401
|
+
setup(e) {
|
|
1402
|
+
let t = e, n = X(), r = a(), i = l(), o = dt(), s = Ht(), c = y(), u = v(), d = z(!1), { activeTopMenuPath: f, findFirstLeafNode: p, findFirstLeafPath: m, topMenus: h } = Gn(), g = E(() => n.themeColorPosition === "header" || n.isDark), _ = E(() => g.value ? i.logoHeader : i.logoExpanded), b = E(() => g.value && _.value === i.logoExpanded);
|
|
1403
|
+
ne(() => {
|
|
1404
|
+
s.initShortcuts(), window.addEventListener("keydown", D, { capture: !0 });
|
|
1405
|
+
}), L(() => {
|
|
1406
|
+
window.removeEventListener("keydown", D, { capture: !0 });
|
|
1407
|
+
});
|
|
1408
|
+
function x(e, n) {
|
|
1409
|
+
if (n !== t.breadcrumbItems.length - 1) return m(c.options.routes, e.path) || e.path || "/";
|
|
1410
|
+
}
|
|
1411
|
+
async function ee() {
|
|
1412
|
+
await o.resetTabs(), n.setSelectedTopMenuPath(""), await r.logout(), c.push("/login");
|
|
1413
|
+
}
|
|
1414
|
+
function C(e) {
|
|
1415
|
+
c.push(e);
|
|
1416
|
+
}
|
|
1417
|
+
function w(e) {
|
|
1418
|
+
let t = h.value.find((t) => t.fullPath === e);
|
|
1419
|
+
if (!t) return;
|
|
1420
|
+
n.setSelectedTopMenuPath(t.fullPath);
|
|
1421
|
+
let r = p(t)?.fullPath || t.fullPath;
|
|
1422
|
+
c.push(r);
|
|
1423
|
+
}
|
|
1424
|
+
function T() {
|
|
1425
|
+
d.value = !0;
|
|
1426
|
+
}
|
|
1427
|
+
function D(e) {
|
|
1428
|
+
e.defaultPrevented || e.repeat || d.value || s.isShortcutEnabled("search") && Yt(e, s.getShortcutKeys("search")) && (e.preventDefault(), T());
|
|
1429
|
+
}
|
|
1430
|
+
return (t, a) => {
|
|
1431
|
+
let o = V("el-icon"), s = V("el-menu"), c = V("el-menu-item"), l = V("el-breadcrumb-item"), p = V("el-breadcrumb"), m = V("el-avatar"), g = V("el-dropdown-item"), v = V("el-dropdown-menu"), y = V("el-dropdown"), E = V("el-header");
|
|
1432
|
+
return R(), A(S, null, [N(E, { class: "app-layout__header" }, {
|
|
1433
|
+
default: K(() => [
|
|
1434
|
+
j("div", Er, [
|
|
1435
|
+
W(n).layoutMode === "default" || W(n).layoutMode === "top" ? (R(), A("div", Dr, [N(nr, {
|
|
1436
|
+
src: _.value,
|
|
1437
|
+
alt: W(i).systemName,
|
|
1438
|
+
"text-inverted": b.value
|
|
1439
|
+
}, null, 8, [
|
|
1440
|
+
"src",
|
|
1441
|
+
"alt",
|
|
1442
|
+
"text-inverted"
|
|
1443
|
+
])])) : k("", !0),
|
|
1444
|
+
W(n).layoutMode !== "top" || W(n).isMobileViewport ? (R(), A("button", {
|
|
1445
|
+
key: 1,
|
|
1446
|
+
type: "button",
|
|
1447
|
+
class: "app-layout__header-tool-btn app-layout__header-tool-btn--collapse",
|
|
1448
|
+
title: W(n).isMobileViewport ? "打开菜单" : W(n).sidebarCollapsed ? "展开侧边栏" : "折叠侧边栏",
|
|
1449
|
+
"aria-label": W(n).isMobileViewport ? "打开菜单" : W(n).sidebarCollapsed ? "展开侧边栏" : "折叠侧边栏",
|
|
1450
|
+
onClick: a[0] ||= (e) => W(n).toggleSidebar()
|
|
1451
|
+
}, [N(o, null, {
|
|
1452
|
+
default: K(() => [(R(), O(H(W(n).sidebarCollapsed && !W(n).isMobileViewport ? W(Se) : W(Ce))))]),
|
|
1453
|
+
_: 1
|
|
1454
|
+
})], 8, Or)) : k("", !0),
|
|
1455
|
+
W(n).layoutMode === "top" && !W(n).isMobileViewport ? (R(), O(s, {
|
|
1456
|
+
key: 2,
|
|
1457
|
+
mode: "horizontal",
|
|
1458
|
+
ellipsis: !1,
|
|
1459
|
+
"default-active": W(u).path,
|
|
1460
|
+
class: "app-layout__header-menu",
|
|
1461
|
+
onSelect: C
|
|
1462
|
+
}, {
|
|
1463
|
+
default: K(() => [(R(!0), A(S, null, B(W(h), (e) => (R(), O(ir, {
|
|
1464
|
+
key: e.fullPath,
|
|
1465
|
+
node: e
|
|
1466
|
+
}, null, 8, ["node"]))), 128))]),
|
|
1467
|
+
_: 1
|
|
1468
|
+
}, 8, ["default-active"])) : W(n).layoutMode === "mix" && !W(n).isMobileViewport ? (R(), O(s, {
|
|
1469
|
+
key: 3,
|
|
1470
|
+
mode: "horizontal",
|
|
1471
|
+
ellipsis: !1,
|
|
1472
|
+
"default-active": W(f),
|
|
1473
|
+
class: "app-layout__header-menu app-layout__header-menu--mix",
|
|
1474
|
+
onSelect: w
|
|
1475
|
+
}, {
|
|
1476
|
+
default: K(() => [(R(!0), A(S, null, B(W(h), (e) => (R(), O(c, {
|
|
1477
|
+
key: e.fullPath,
|
|
1478
|
+
index: e.fullPath
|
|
1479
|
+
}, {
|
|
1480
|
+
default: K(() => [M(U(e.title), 1)]),
|
|
1481
|
+
_: 2
|
|
1482
|
+
}, 1032, ["index"]))), 128))]),
|
|
1483
|
+
_: 1
|
|
1484
|
+
}, 8, ["default-active"])) : k("", !0),
|
|
1485
|
+
W(n).layoutMode === "default" || W(n).layoutMode === "side" ? (R(), O(p, {
|
|
1486
|
+
key: 4,
|
|
1487
|
+
"separator-icon": W(pe)
|
|
1488
|
+
}, {
|
|
1489
|
+
default: K(() => [(R(!0), A(S, null, B(e.breadcrumbItems, (e, t) => (R(), O(l, {
|
|
1490
|
+
key: e.path || String(e.name),
|
|
1491
|
+
to: x(e, t)
|
|
1492
|
+
}, {
|
|
1493
|
+
default: K(() => [M(U(e.meta.title), 1)]),
|
|
1494
|
+
_: 2
|
|
1495
|
+
}, 1032, ["to"]))), 128))]),
|
|
1496
|
+
_: 1
|
|
1497
|
+
}, 8, ["separator-icon"])) : k("", !0)
|
|
1498
|
+
]),
|
|
1499
|
+
W(n).layoutMode !== "mix" && !W(n).isSidebarMenuSearch ? (R(), A("div", {
|
|
1500
|
+
key: 0,
|
|
1501
|
+
class: I(["app-layout__header-search", `app-layout__header-search--${W(n).layoutMode}`])
|
|
1502
|
+
}, [N(Tr, {
|
|
1503
|
+
"layout-mode": W(n).layoutMode,
|
|
1504
|
+
onOpen: T
|
|
1505
|
+
}, null, 8, ["layout-mode"])], 2)) : k("", !0),
|
|
1506
|
+
j("div", kr, [
|
|
1507
|
+
W(n).layoutMode === "mix" && !W(n).isSidebarMenuSearch ? (R(), O(Tr, {
|
|
1508
|
+
key: 0,
|
|
1509
|
+
"layout-mode": W(n).layoutMode,
|
|
1510
|
+
onOpen: T
|
|
1511
|
+
}, null, 8, ["layout-mode"])) : k("", !0),
|
|
1512
|
+
j("button", {
|
|
1513
|
+
type: "button",
|
|
1514
|
+
class: "app-layout__header-tool-btn",
|
|
1515
|
+
title: "主题设置",
|
|
1516
|
+
onClick: a[1] ||= (e) => W(n).openSettings("theme")
|
|
1517
|
+
}, [N(o, {
|
|
1518
|
+
size: 18,
|
|
1519
|
+
class: "app-layout__header-tool-icon"
|
|
1520
|
+
}, {
|
|
1521
|
+
default: K(() => [N(W(ge))]),
|
|
1522
|
+
_: 1
|
|
1523
|
+
})]),
|
|
1524
|
+
N(Wn),
|
|
1525
|
+
N(y, { onCommand: ee }, {
|
|
1526
|
+
dropdown: K(() => [N(v, null, {
|
|
1527
|
+
default: K(() => [N(g, { disabled: "" }, {
|
|
1528
|
+
default: K(() => [N(o, null, {
|
|
1529
|
+
default: K(() => [N(W(Pe))]),
|
|
1530
|
+
_: 1
|
|
1531
|
+
}), a[3] ||= M(" 个人设置 ", -1)]),
|
|
1532
|
+
_: 1
|
|
1533
|
+
}), N(g, { command: "logout" }, {
|
|
1534
|
+
default: K(() => [N(o, null, {
|
|
1535
|
+
default: K(() => [N(W(Ie))]),
|
|
1536
|
+
_: 1
|
|
1537
|
+
}), a[4] ||= M(" 退出登录 ", -1)]),
|
|
1538
|
+
_: 1
|
|
1539
|
+
})]),
|
|
1540
|
+
_: 1
|
|
1541
|
+
})]),
|
|
1542
|
+
default: K(() => [j("div", Ar, [
|
|
1543
|
+
N(m, { size: 32 }, {
|
|
1544
|
+
default: K(() => [M(U(W(r).userName.slice(0, 1)), 1)]),
|
|
1545
|
+
_: 1
|
|
1546
|
+
}),
|
|
1547
|
+
j("div", jr, [j("strong", null, U(W(r).userName), 1), j("span", null, U(W(r).userRoleLabel), 1)]),
|
|
1548
|
+
N(o, null, {
|
|
1549
|
+
default: K(() => [N(W(fe))]),
|
|
1550
|
+
_: 1
|
|
1551
|
+
})
|
|
1552
|
+
])]),
|
|
1553
|
+
_: 1
|
|
1554
|
+
})
|
|
1555
|
+
])
|
|
1556
|
+
]),
|
|
1557
|
+
_: 1
|
|
1558
|
+
}), N(Sr, {
|
|
1559
|
+
modelValue: d.value,
|
|
1560
|
+
"onUpdate:modelValue": a[2] ||= (e) => d.value = e
|
|
1561
|
+
}, null, 8, ["modelValue"])], 64);
|
|
1562
|
+
};
|
|
1563
|
+
}
|
|
1564
|
+
});
|
|
1565
|
+
//#endregion
|
|
1566
|
+
//#region src/main/layouts/utils/menuSearch.ts
|
|
1567
|
+
function Nr(e, t) {
|
|
1568
|
+
let n = t.trim().toLowerCase();
|
|
1569
|
+
if (!n) return [...e];
|
|
1570
|
+
let r = [];
|
|
1571
|
+
for (let t of e) {
|
|
1572
|
+
let e = Nr(t.children ?? [], n);
|
|
1573
|
+
!(Ir(t) && Fr(t, n)) && !e.length || r.push({
|
|
1574
|
+
...t,
|
|
1575
|
+
children: e.length ? e : void 0
|
|
1576
|
+
});
|
|
1577
|
+
}
|
|
1578
|
+
return r;
|
|
1579
|
+
}
|
|
1580
|
+
function Pr(e, t) {
|
|
1581
|
+
let n = Lr(e), r = t.trim();
|
|
1582
|
+
if (!r) return n;
|
|
1583
|
+
let i = Array.from(e), a = e.toLowerCase(), o = r.toLowerCase(), s = a.indexOf(o);
|
|
1584
|
+
return s < 0 ? n : `${Lr(i.slice(0, s).join(""))}<mark class="app-menu-search-highlight">${Lr(i.slice(s, s + r.length).join(""))}</mark>${Lr(i.slice(s + r.length).join(""))}`;
|
|
1585
|
+
}
|
|
1586
|
+
function Fr(e, t) {
|
|
1587
|
+
return e.title.toLowerCase().includes(t);
|
|
1588
|
+
}
|
|
1589
|
+
function Ir(e) {
|
|
1590
|
+
return !e.children?.length;
|
|
1591
|
+
}
|
|
1592
|
+
function Lr(e) {
|
|
1593
|
+
return e.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll("\"", """).replaceAll("'", "'");
|
|
1594
|
+
}
|
|
1595
|
+
//#endregion
|
|
1596
|
+
//#region src/main/layouts/components/AppSidebarSearch.vue?vue&type=script&setup=true&lang.ts
|
|
1597
|
+
var Rr = {
|
|
1598
|
+
key: 0,
|
|
1599
|
+
class: "app-sidebar-search"
|
|
1600
|
+
}, zr = /* @__PURE__ */ P({
|
|
1601
|
+
__name: "AppSidebarSearch",
|
|
1602
|
+
props: {
|
|
1603
|
+
collapsed: { type: Boolean },
|
|
1604
|
+
keyword: {}
|
|
1605
|
+
},
|
|
1606
|
+
emits: ["update:keyword"],
|
|
1607
|
+
setup(e, { emit: t }) {
|
|
1608
|
+
let n = t;
|
|
1609
|
+
return (t, r) => {
|
|
1610
|
+
let i = V("el-icon"), a = V("el-input");
|
|
1611
|
+
return e.collapsed ? k("", !0) : (R(), A("div", Rr, [N(a, {
|
|
1612
|
+
"model-value": e.keyword,
|
|
1613
|
+
placeholder: "搜索菜单",
|
|
1614
|
+
clearable: "",
|
|
1615
|
+
"onUpdate:modelValue": r[0] ||= (e) => n("update:keyword", e)
|
|
1616
|
+
}, {
|
|
1617
|
+
prefix: K(() => [N(i, null, {
|
|
1618
|
+
default: K(() => [N(W(Ne))]),
|
|
1619
|
+
_: 1
|
|
1620
|
+
})]),
|
|
1621
|
+
_: 1
|
|
1622
|
+
}, 8, ["model-value"])]));
|
|
1623
|
+
};
|
|
1624
|
+
}
|
|
1625
|
+
}), Br = ["innerHTML"], Vr = ["innerHTML"], Hr = /* @__PURE__ */ P({
|
|
1626
|
+
name: "AppSidebarNode",
|
|
1627
|
+
__name: "AppSidebarNode",
|
|
1628
|
+
props: {
|
|
1629
|
+
node: {},
|
|
1630
|
+
keyword: {}
|
|
1631
|
+
},
|
|
1632
|
+
setup(e) {
|
|
1633
|
+
let t = e, n = E(() => Pr(t.node.title, t.keyword ?? ""));
|
|
1634
|
+
return (t, r) => {
|
|
1635
|
+
let i = V("el-icon"), a = V("AppSidebarNode", !0), o = V("el-sub-menu"), s = V("el-menu-item");
|
|
1636
|
+
return e.node.children?.length ? (R(), O(o, {
|
|
1637
|
+
key: 0,
|
|
1638
|
+
index: e.node.fullPath
|
|
1639
|
+
}, {
|
|
1640
|
+
title: K(() => [N(i, null, {
|
|
1641
|
+
default: K(() => [(R(), O(H(W(Z)(e.node.icon))))]),
|
|
1642
|
+
_: 1
|
|
1643
|
+
}), j("span", { innerHTML: n.value }, null, 8, Br)]),
|
|
1644
|
+
default: K(() => [(R(!0), A(S, null, B(e.node.children, (t) => (R(), O(a, {
|
|
1645
|
+
key: t.fullPath,
|
|
1646
|
+
node: t,
|
|
1647
|
+
keyword: e.keyword
|
|
1648
|
+
}, null, 8, ["node", "keyword"]))), 128))]),
|
|
1649
|
+
_: 1
|
|
1650
|
+
}, 8, ["index"])) : (R(), O(s, {
|
|
1651
|
+
key: 1,
|
|
1652
|
+
index: e.node.fullPath
|
|
1653
|
+
}, {
|
|
1654
|
+
default: K(() => [e.node.icon ? (R(), O(i, { key: 0 }, {
|
|
1655
|
+
default: K(() => [(R(), O(H(W(Z)(e.node.icon))))]),
|
|
1656
|
+
_: 1
|
|
1657
|
+
})) : k("", !0), j("span", { innerHTML: n.value }, null, 8, Vr)]),
|
|
1658
|
+
_: 1
|
|
1659
|
+
}, 8, ["index"]));
|
|
1660
|
+
};
|
|
1661
|
+
}
|
|
1662
|
+
}), Ur = {
|
|
1663
|
+
key: 0,
|
|
1664
|
+
class: "app-layout__brand"
|
|
1665
|
+
}, Wr = /* @__PURE__ */ P({
|
|
1666
|
+
name: "AppSidebar",
|
|
1667
|
+
__name: "AppSidebar",
|
|
1668
|
+
setup(e) {
|
|
1669
|
+
let t = X(), n = l(), { activeMenu: r, sideMenus: i } = Gn(), a = z(""), o = E(() => t.themeColorPosition === "sidebar" || t.isDark), s = E(() => o.value ? n.logoHeader : n.logoExpanded), c = E(() => o.value && s.value === n.logoExpanded), u = E(() => t.isMobileViewport ? !1 : t.sidebarCollapsed), d = E(() => t.layoutMode !== "top" || t.isMobileViewport), f = E(() => t.isSidebarMenuSearch ? Nr(i.value, a.value) : i.value), p = E(() => !t.isSidebarMenuSearch || !a.value.trim() ? [] : m(f.value));
|
|
1670
|
+
G(() => t.isSidebarMenuSearch, (e) => {
|
|
1671
|
+
e || (a.value = "");
|
|
1672
|
+
});
|
|
1673
|
+
function m(e) {
|
|
1674
|
+
let t = [];
|
|
1675
|
+
for (let n of e) n.children?.length && (t.push(n.fullPath), t.push(...m(n.children)));
|
|
1676
|
+
return t;
|
|
1677
|
+
}
|
|
1678
|
+
return (e, i) => {
|
|
1679
|
+
let o = V("el-menu"), l = V("el-scrollbar"), m = V("el-aside");
|
|
1680
|
+
return d.value ? (R(), O(m, {
|
|
1681
|
+
key: 0,
|
|
1682
|
+
width: u.value ? "72px" : "220px",
|
|
1683
|
+
class: I(["app-layout__aside", {
|
|
1684
|
+
"is-mix-mode": W(t).layoutMode === "mix",
|
|
1685
|
+
"has-brand": W(t).layoutMode !== "default",
|
|
1686
|
+
"is-mobile-open": W(t).mobileSidebarVisible
|
|
1687
|
+
}])
|
|
1688
|
+
}, {
|
|
1689
|
+
default: K(() => [
|
|
1690
|
+
W(t).layoutMode === "default" ? k("", !0) : (R(), A("div", Ur, [N(w, {
|
|
1691
|
+
name: "brand-fade",
|
|
1692
|
+
mode: "out-in"
|
|
1693
|
+
}, {
|
|
1694
|
+
default: K(() => [u.value ? (R(), O(nr, {
|
|
1695
|
+
key: "collapsed",
|
|
1696
|
+
src: W(n).logoCollapsed,
|
|
1697
|
+
alt: W(n).systemName,
|
|
1698
|
+
width: "40px",
|
|
1699
|
+
height: "40px"
|
|
1700
|
+
}, null, 8, ["src", "alt"])) : (R(), O(nr, {
|
|
1701
|
+
key: "expanded",
|
|
1702
|
+
src: s.value,
|
|
1703
|
+
alt: W(n).systemName,
|
|
1704
|
+
"text-inverted": c.value
|
|
1705
|
+
}, null, 8, [
|
|
1706
|
+
"src",
|
|
1707
|
+
"alt",
|
|
1708
|
+
"text-inverted"
|
|
1709
|
+
]))]),
|
|
1710
|
+
_: 1
|
|
1711
|
+
})])),
|
|
1712
|
+
W(t).isSidebarMenuSearch ? (R(), O(zr, {
|
|
1713
|
+
key: 1,
|
|
1714
|
+
collapsed: u.value,
|
|
1715
|
+
keyword: a.value,
|
|
1716
|
+
"onUpdate:keyword": i[0] ||= (e) => a.value = e
|
|
1717
|
+
}, null, 8, ["collapsed", "keyword"])) : k("", !0),
|
|
1718
|
+
N(l, null, {
|
|
1719
|
+
default: K(() => [N(o, {
|
|
1720
|
+
collapse: u.value,
|
|
1721
|
+
"default-active": W(r),
|
|
1722
|
+
"default-openeds": p.value,
|
|
1723
|
+
class: "app-layout__menu",
|
|
1724
|
+
router: "",
|
|
1725
|
+
"unique-opened": "",
|
|
1726
|
+
onSelect: W(t).closeMobileSidebar
|
|
1727
|
+
}, {
|
|
1728
|
+
default: K(() => [(R(!0), A(S, null, B(f.value, (e) => (R(), O(Hr, {
|
|
1729
|
+
key: e.fullPath,
|
|
1730
|
+
node: e,
|
|
1731
|
+
keyword: W(t).isSidebarMenuSearch ? a.value : ""
|
|
1732
|
+
}, null, 8, ["node", "keyword"]))), 128))]),
|
|
1733
|
+
_: 1
|
|
1734
|
+
}, 8, [
|
|
1735
|
+
"collapse",
|
|
1736
|
+
"default-active",
|
|
1737
|
+
"default-openeds",
|
|
1738
|
+
"onSelect"
|
|
1739
|
+
])]),
|
|
1740
|
+
_: 1
|
|
1741
|
+
})
|
|
1742
|
+
]),
|
|
1743
|
+
_: 1
|
|
1744
|
+
}, 8, ["width", "class"])) : k("", !0);
|
|
1745
|
+
};
|
|
1746
|
+
}
|
|
1747
|
+
});
|
|
1748
|
+
//#endregion
|
|
1749
|
+
//#region src/main/composables/useSortable.ts
|
|
1750
|
+
function Gr(e = {}) {
|
|
1751
|
+
let t = z(null);
|
|
1752
|
+
function n() {
|
|
1753
|
+
t.value?.destroy(), t.value = null;
|
|
1754
|
+
}
|
|
1755
|
+
function r(r) {
|
|
1756
|
+
r && (n(), t.value = Ve.create(r, {
|
|
1757
|
+
animation: e.animation ?? 150,
|
|
1758
|
+
chosenClass: e.chosenClass,
|
|
1759
|
+
direction: e.direction,
|
|
1760
|
+
disabled: e.disabled ?? !1,
|
|
1761
|
+
dragClass: e.dragClass,
|
|
1762
|
+
draggable: e.draggable,
|
|
1763
|
+
easing: e.easing,
|
|
1764
|
+
filter: e.filter,
|
|
1765
|
+
ghostClass: e.ghostClass,
|
|
1766
|
+
handle: e.handle,
|
|
1767
|
+
invertSwap: e.invertSwap,
|
|
1768
|
+
onEnd: (t) => {
|
|
1769
|
+
if (e.onEnd) {
|
|
1770
|
+
if (e.onEnd.length >= 2 && t.oldIndex != null && t.newIndex != null) {
|
|
1771
|
+
e.onEnd(t.oldIndex, t.newIndex);
|
|
1772
|
+
return;
|
|
1773
|
+
}
|
|
1774
|
+
e.onEnd();
|
|
1775
|
+
}
|
|
1776
|
+
},
|
|
1777
|
+
onStart: e.onStart,
|
|
1778
|
+
preventOnFilter: e.preventOnFilter,
|
|
1779
|
+
swapThreshold: e.swapThreshold
|
|
1780
|
+
}));
|
|
1781
|
+
}
|
|
1782
|
+
return L(() => {
|
|
1783
|
+
n();
|
|
1784
|
+
}), {
|
|
1785
|
+
destroy: n,
|
|
1786
|
+
init: r,
|
|
1787
|
+
sortableInstance: t
|
|
1788
|
+
};
|
|
1789
|
+
}
|
|
1790
|
+
//#endregion
|
|
1791
|
+
//#region src/main/layouts/components/AppTabsContextMenu.vue?vue&type=script&setup=true&lang.ts
|
|
1792
|
+
var Kr = ["disabled"], qr = ["disabled"], Jr = ["disabled"], Yr = ["disabled"], Xr = ["disabled"], Zr = /* @__PURE__ */ P({
|
|
1793
|
+
__name: "AppTabsContextMenu",
|
|
1794
|
+
props: {
|
|
1795
|
+
hasLeftTabs: { type: Boolean },
|
|
1796
|
+
hasMultipleTabs: { type: Boolean },
|
|
1797
|
+
hasRightTabs: { type: Boolean },
|
|
1798
|
+
hasLastActive: { type: Boolean },
|
|
1799
|
+
isTargetActive: { type: Boolean },
|
|
1800
|
+
isTargetHome: { type: Boolean },
|
|
1801
|
+
visible: { type: Boolean },
|
|
1802
|
+
position: {},
|
|
1803
|
+
targetTab: {}
|
|
1804
|
+
},
|
|
1805
|
+
emits: [
|
|
1806
|
+
"close",
|
|
1807
|
+
"closeAll",
|
|
1808
|
+
"closeLeft",
|
|
1809
|
+
"closeOthers",
|
|
1810
|
+
"closeRight",
|
|
1811
|
+
"closeTab",
|
|
1812
|
+
"openInNewTab",
|
|
1813
|
+
"refresh",
|
|
1814
|
+
"switchPrev"
|
|
1815
|
+
],
|
|
1816
|
+
setup(e, { emit: t }) {
|
|
1817
|
+
let n = e, r = t;
|
|
1818
|
+
function i(e, t = !1) {
|
|
1819
|
+
t || (e(), r("close"));
|
|
1820
|
+
}
|
|
1821
|
+
function a() {
|
|
1822
|
+
n.targetTab && r("refresh", n.targetTab.path);
|
|
1823
|
+
}
|
|
1824
|
+
function o() {
|
|
1825
|
+
r("switchPrev");
|
|
1826
|
+
}
|
|
1827
|
+
function s() {
|
|
1828
|
+
n.targetTab && r("openInNewTab", n.targetTab.fullPath);
|
|
1829
|
+
}
|
|
1830
|
+
function c() {
|
|
1831
|
+
n.targetTab && r("closeTab", n.targetTab.path);
|
|
1832
|
+
}
|
|
1833
|
+
function l() {
|
|
1834
|
+
n.targetTab && r("closeOthers", n.targetTab.path);
|
|
1835
|
+
}
|
|
1836
|
+
function u() {
|
|
1837
|
+
n.targetTab && r("closeLeft", n.targetTab.path);
|
|
1838
|
+
}
|
|
1839
|
+
function d() {
|
|
1840
|
+
n.targetTab && r("closeRight", n.targetTab.path);
|
|
1841
|
+
}
|
|
1842
|
+
return (t, n) => {
|
|
1843
|
+
let f = V("el-icon");
|
|
1844
|
+
return e.visible && e.targetTab ? (R(), A("div", {
|
|
1845
|
+
key: 0,
|
|
1846
|
+
class: "app-tabs-menu",
|
|
1847
|
+
style: te({
|
|
1848
|
+
left: `${e.position.x}px`,
|
|
1849
|
+
top: `${e.position.y}px`
|
|
1850
|
+
}),
|
|
1851
|
+
onMousedown: n[8] ||= q(() => {}, ["stop"]),
|
|
1852
|
+
onContextmenu: n[9] ||= q(() => {}, ["prevent"])
|
|
1853
|
+
}, [
|
|
1854
|
+
j("button", {
|
|
1855
|
+
class: "app-tabs-menu__item",
|
|
1856
|
+
type: "button",
|
|
1857
|
+
onClick: n[0] ||= (e) => i(a)
|
|
1858
|
+
}, [N(f, null, {
|
|
1859
|
+
default: K(() => [N(W(Me))]),
|
|
1860
|
+
_: 1
|
|
1861
|
+
}), n[10] ||= j("span", null, "重新加载", -1)]),
|
|
1862
|
+
j("button", {
|
|
1863
|
+
class: "app-tabs-menu__item",
|
|
1864
|
+
type: "button",
|
|
1865
|
+
disabled: !e.hasLastActive,
|
|
1866
|
+
onClick: n[1] ||= (t) => i(o, !e.hasLastActive)
|
|
1867
|
+
}, [N(f, null, {
|
|
1868
|
+
default: K(() => [N(W(he))]),
|
|
1869
|
+
_: 1
|
|
1870
|
+
}), n[11] ||= j("span", null, "切换上一个页签", -1)], 8, Kr),
|
|
1871
|
+
j("button", {
|
|
1872
|
+
class: "app-tabs-menu__item",
|
|
1873
|
+
type: "button",
|
|
1874
|
+
onClick: n[2] ||= (e) => i(s)
|
|
1875
|
+
}, [N(f, null, {
|
|
1876
|
+
default: K(() => [N(W(Le))]),
|
|
1877
|
+
_: 1
|
|
1878
|
+
}), n[12] ||= j("span", null, "在新窗口打开", -1)]),
|
|
1879
|
+
n[18] ||= j("div", { class: "app-tabs-menu__divider" }, null, -1),
|
|
1880
|
+
j("button", {
|
|
1881
|
+
class: "app-tabs-menu__item",
|
|
1882
|
+
type: "button",
|
|
1883
|
+
disabled: e.isTargetHome,
|
|
1884
|
+
onClick: n[3] ||= (t) => i(c, e.isTargetHome)
|
|
1885
|
+
}, [N(f, null, {
|
|
1886
|
+
default: K(() => [N(W(_e))]),
|
|
1887
|
+
_: 1
|
|
1888
|
+
}), n[13] ||= j("span", null, "关闭当前页签", -1)], 8, qr),
|
|
1889
|
+
j("button", {
|
|
1890
|
+
class: "app-tabs-menu__item",
|
|
1891
|
+
type: "button",
|
|
1892
|
+
disabled: !e.hasMultipleTabs,
|
|
1893
|
+
onClick: n[4] ||= (t) => i(l, !e.hasMultipleTabs)
|
|
1894
|
+
}, [N(f, null, {
|
|
1895
|
+
default: K(() => [N(W(Ae))]),
|
|
1896
|
+
_: 1
|
|
1897
|
+
}), n[14] ||= j("span", null, "关闭其他页签", -1)], 8, Jr),
|
|
1898
|
+
j("button", {
|
|
1899
|
+
class: "app-tabs-menu__item",
|
|
1900
|
+
type: "button",
|
|
1901
|
+
disabled: !e.hasLeftTabs,
|
|
1902
|
+
onClick: n[5] ||= (t) => i(u, !e.hasLeftTabs)
|
|
1903
|
+
}, [N(f, null, {
|
|
1904
|
+
default: K(() => [N(W(ye))]),
|
|
1905
|
+
_: 1
|
|
1906
|
+
}), n[15] ||= j("span", null, "关闭左侧页签", -1)], 8, Yr),
|
|
1907
|
+
j("button", {
|
|
1908
|
+
class: "app-tabs-menu__item",
|
|
1909
|
+
type: "button",
|
|
1910
|
+
disabled: !e.hasRightTabs,
|
|
1911
|
+
onClick: n[6] ||= (t) => i(d, !e.hasRightTabs)
|
|
1912
|
+
}, [N(f, null, {
|
|
1913
|
+
default: K(() => [N(W(be))]),
|
|
1914
|
+
_: 1
|
|
1915
|
+
}), n[16] ||= j("span", null, "关闭右侧页签", -1)], 8, Xr),
|
|
1916
|
+
n[19] ||= j("div", { class: "app-tabs-menu__divider" }, null, -1),
|
|
1917
|
+
j("button", {
|
|
1918
|
+
class: "app-tabs-menu__item",
|
|
1919
|
+
type: "button",
|
|
1920
|
+
onClick: n[7] ||= (e) => i(() => r("closeAll"))
|
|
1921
|
+
}, [N(f, null, {
|
|
1922
|
+
default: K(() => [N(W(we))]),
|
|
1923
|
+
_: 1
|
|
1924
|
+
}), n[17] ||= j("span", null, "关闭全部页签", -1)])
|
|
1925
|
+
], 36)) : k("", !0);
|
|
1926
|
+
};
|
|
1927
|
+
}
|
|
1928
|
+
}), Qr = {
|
|
1929
|
+
key: 0,
|
|
1930
|
+
class: "app-layout__tabs"
|
|
1931
|
+
}, $r = { class: "app-layout__tabs-bar" }, ei = [
|
|
1932
|
+
"data-path",
|
|
1933
|
+
"onClick",
|
|
1934
|
+
"onContextmenu"
|
|
1935
|
+
], ti = { class: "app-layout__tab-label" }, ni = ["onClick"], ri = /* @__PURE__ */ P({
|
|
1936
|
+
__name: "AppTabs",
|
|
1937
|
+
emits: ["refresh"],
|
|
1938
|
+
setup(e, { emit: t }) {
|
|
1939
|
+
let n = t, r = y(), i = dt(), a = z(!1), o = z(!1), s = z(!1), c = z({
|
|
1940
|
+
x: 0,
|
|
1941
|
+
y: 0
|
|
1942
|
+
}), l = z(null), u = z(null), d = E(() => l.value ? i.tabs.findIndex((e) => e.path === l.value?.path) : -1), f = E(() => l.value?.path === i.activeTab), p = E(() => d.value > 0), m = E(() => d.value >= 0 && d.value < i.tabs.length - 1), h = E(() => i.tabs.length > 1), g = E(() => !!(i.lastActiveTab && i.tabPaths.includes(i.lastActiveTab))), { init: _ } = Gr({
|
|
1943
|
+
animation: 150,
|
|
1944
|
+
chosenClass: "sortable-chosen",
|
|
1945
|
+
direction: "horizontal",
|
|
1946
|
+
dragClass: "sortable-drag",
|
|
1947
|
+
draggable: ".app-layout__tab",
|
|
1948
|
+
filter: ".app-layout__tab-close",
|
|
1949
|
+
ghostClass: "sortable-ghost",
|
|
1950
|
+
invertSwap: !1,
|
|
1951
|
+
onEnd: () => {
|
|
1952
|
+
let e = Array.from(u.value?.children ?? []), t = [];
|
|
1953
|
+
e.forEach((e) => {
|
|
1954
|
+
let n = e.dataset.path, r = i.tabs.find((e) => e.path === n);
|
|
1955
|
+
r && t.push(r);
|
|
1956
|
+
}), t.length === i.tabs.length && i.reorderTabs(t), window.setTimeout(() => {
|
|
1957
|
+
a.value = !1, u.value?.classList.remove("dragging");
|
|
1958
|
+
}, 100);
|
|
1959
|
+
},
|
|
1960
|
+
onStart: () => {
|
|
1961
|
+
a.value = !0, u.value?.classList.add("dragging");
|
|
1962
|
+
},
|
|
1963
|
+
preventOnFilter: !0,
|
|
1964
|
+
swapThreshold: .65
|
|
1965
|
+
});
|
|
1966
|
+
async function v(e) {
|
|
1967
|
+
e && (i.setActiveTab(e), await r.push(e), await D());
|
|
1968
|
+
}
|
|
1969
|
+
async function b(e) {
|
|
1970
|
+
if (e === "/dashboard") return;
|
|
1971
|
+
let t = i.tabs.findIndex((t) => t.path === e), n = i.activeTab === e;
|
|
1972
|
+
if (await i.removeTab(e), !n) return;
|
|
1973
|
+
let a = i.tabs[t] ?? i.tabs[t - 1];
|
|
1974
|
+
a ? await v(a.path) : (i.setActiveTab(""), r.push(J));
|
|
1975
|
+
}
|
|
1976
|
+
async function x(e) {
|
|
1977
|
+
i.activeTab !== e && await v(e), o.value = !1, await F(), await D(), o.value = !0, n("refresh"), window.setTimeout(() => {
|
|
1978
|
+
o.value = !1;
|
|
1979
|
+
}, 600);
|
|
1980
|
+
}
|
|
1981
|
+
function ee(e, t) {
|
|
1982
|
+
e.preventDefault(), C(e.clientX, e.clientY, t);
|
|
1983
|
+
}
|
|
1984
|
+
function C(e, t, n) {
|
|
1985
|
+
l.value = n, s.value = !0, c.value = {
|
|
1986
|
+
x: Math.min(e, window.innerWidth - 188),
|
|
1987
|
+
y: Math.min(t, window.innerHeight - 260)
|
|
1988
|
+
};
|
|
1989
|
+
}
|
|
1990
|
+
function w(e) {
|
|
1991
|
+
let t = i.tabs.find((e) => e.path === i.activeTab) ?? i.tabs.at(-1);
|
|
1992
|
+
if (!t) return;
|
|
1993
|
+
let n = e.currentTarget.getBoundingClientRect();
|
|
1994
|
+
C(n.left, n.bottom + 4, t);
|
|
1995
|
+
}
|
|
1996
|
+
function T(e) {
|
|
1997
|
+
!u.value || Math.abs(e.deltaY) <= Math.abs(e.deltaX) || (e.preventDefault(), u.value.scrollLeft += e.deltaY);
|
|
1998
|
+
}
|
|
1999
|
+
async function D() {
|
|
2000
|
+
await F(), await new Promise((e) => window.requestAnimationFrame(() => e(null))), await new Promise((e) => window.requestAnimationFrame(() => e(null)));
|
|
2001
|
+
let e = u.value, t = e?.querySelector(".app-layout__tab.is-active");
|
|
2002
|
+
if (!e || !t) return;
|
|
2003
|
+
t.scrollIntoView({
|
|
2004
|
+
behavior: "smooth",
|
|
2005
|
+
block: "nearest",
|
|
2006
|
+
inline: "center"
|
|
2007
|
+
});
|
|
2008
|
+
let n = Math.max(0, e.scrollWidth - e.clientWidth), r = t.offsetLeft - e.clientWidth / 2 + t.offsetWidth / 2;
|
|
2009
|
+
e.scrollTo({
|
|
2010
|
+
left: Math.min(n, Math.max(0, r)),
|
|
2011
|
+
behavior: "smooth"
|
|
2012
|
+
});
|
|
2013
|
+
}
|
|
2014
|
+
function M() {
|
|
2015
|
+
s.value = !1, l.value = null;
|
|
2016
|
+
}
|
|
2017
|
+
async function P(e) {
|
|
2018
|
+
await i.closeOtherTabs(e), await v(e);
|
|
2019
|
+
}
|
|
2020
|
+
async function te(e) {
|
|
2021
|
+
await i.closeLeftTabs(e), i.tabPaths.includes(i.activeTab) || await v(e);
|
|
2022
|
+
}
|
|
2023
|
+
async function L(e) {
|
|
2024
|
+
await i.closeRightTabs(e), i.tabPaths.includes(i.activeTab) || await v(e);
|
|
2025
|
+
}
|
|
2026
|
+
async function ie() {
|
|
2027
|
+
await i.closeAllTabs(), r.push(J);
|
|
2028
|
+
}
|
|
2029
|
+
function ae() {
|
|
2030
|
+
let e = i.lastActiveTab;
|
|
2031
|
+
!e || !i.tabPaths.includes(e) || v(e);
|
|
2032
|
+
}
|
|
2033
|
+
function oe(e) {
|
|
2034
|
+
window.open(e, "_blank", "noopener,noreferrer");
|
|
2035
|
+
}
|
|
2036
|
+
function se(e) {
|
|
2037
|
+
e.button !== 2 && M();
|
|
2038
|
+
}
|
|
2039
|
+
return ne(() => {
|
|
2040
|
+
document.addEventListener("mousedown", se), _(u.value), D();
|
|
2041
|
+
}), re(() => {
|
|
2042
|
+
document.removeEventListener("mousedown", se);
|
|
2043
|
+
}), G(() => i.tabs.map((e) => e.path).join("|"), () => {
|
|
2044
|
+
a.value || F(() => {
|
|
2045
|
+
_(u.value), D();
|
|
2046
|
+
});
|
|
2047
|
+
}), G(() => i.activeTab, () => {
|
|
2048
|
+
D();
|
|
2049
|
+
}), (e, t) => {
|
|
2050
|
+
let n = V("el-icon");
|
|
2051
|
+
return W(i).tabs.length ? (R(), A("div", Qr, [j("div", $r, [
|
|
2052
|
+
j("div", {
|
|
2053
|
+
ref_key: "tabsScrollRef",
|
|
2054
|
+
ref: u,
|
|
2055
|
+
class: "app-layout__tabs-scroll",
|
|
2056
|
+
onWheel: T
|
|
2057
|
+
}, [(R(!0), A(S, null, B(W(i).tabs, (e) => (R(), A("div", {
|
|
2058
|
+
key: e.path,
|
|
2059
|
+
class: I(["app-layout__tab", { "is-active": W(i).activeTab === e.path }]),
|
|
2060
|
+
"data-path": e.path,
|
|
2061
|
+
onClick: (t) => v(e.fullPath),
|
|
2062
|
+
onContextmenu: (t) => ee(t, e)
|
|
2063
|
+
}, [
|
|
2064
|
+
e.icon ? (R(), O(n, {
|
|
2065
|
+
key: 0,
|
|
2066
|
+
class: "app-layout__tab-icon"
|
|
2067
|
+
}, {
|
|
2068
|
+
default: K(() => [(R(), O(H(W(Z)(e.icon))))]),
|
|
2069
|
+
_: 2
|
|
2070
|
+
}, 1024)) : k("", !0),
|
|
2071
|
+
j("span", ti, U(e.title), 1),
|
|
2072
|
+
e.path === W("/dashboard") ? k("", !0) : (R(), A("button", {
|
|
2073
|
+
key: 1,
|
|
2074
|
+
class: "app-layout__tab-close",
|
|
2075
|
+
type: "button",
|
|
2076
|
+
onClick: q((t) => b(e.path), ["stop"])
|
|
2077
|
+
}, " × ", 8, ni))
|
|
2078
|
+
], 42, ei))), 128))], 544),
|
|
2079
|
+
j("button", {
|
|
2080
|
+
class: "app-layout__tabs-action",
|
|
2081
|
+
type: "button",
|
|
2082
|
+
title: "页签操作",
|
|
2083
|
+
onClick: w
|
|
2084
|
+
}, [N(n, null, {
|
|
2085
|
+
default: K(() => [N(W(fe))]),
|
|
2086
|
+
_: 1
|
|
2087
|
+
})]),
|
|
2088
|
+
j("button", {
|
|
2089
|
+
class: "app-layout__tabs-action",
|
|
2090
|
+
type: "button",
|
|
2091
|
+
title: "刷新当前页签",
|
|
2092
|
+
onClick: t[0] ||= (e) => x(W(i).activeTab)
|
|
2093
|
+
}, [N(n, { class: I({ "is-rotating": o.value }) }, {
|
|
2094
|
+
default: K(() => [N(W(Me))]),
|
|
2095
|
+
_: 1
|
|
2096
|
+
}, 8, ["class"])])
|
|
2097
|
+
]), N(Zr, {
|
|
2098
|
+
visible: s.value,
|
|
2099
|
+
"has-left-tabs": p.value,
|
|
2100
|
+
"has-multiple-tabs": h.value,
|
|
2101
|
+
"has-right-tabs": m.value,
|
|
2102
|
+
"has-last-active": g.value,
|
|
2103
|
+
"is-target-home": l.value?.path === W(J),
|
|
2104
|
+
"is-target-active": f.value,
|
|
2105
|
+
position: c.value,
|
|
2106
|
+
"target-tab": l.value,
|
|
2107
|
+
onClose: M,
|
|
2108
|
+
onCloseAll: ie,
|
|
2109
|
+
onCloseLeft: te,
|
|
2110
|
+
onCloseOthers: P,
|
|
2111
|
+
onCloseRight: L,
|
|
2112
|
+
onCloseTab: b,
|
|
2113
|
+
onOpenInNewTab: oe,
|
|
2114
|
+
onSwitchPrev: ae,
|
|
2115
|
+
onRefresh: x
|
|
2116
|
+
}, null, 8, [
|
|
2117
|
+
"visible",
|
|
2118
|
+
"has-left-tabs",
|
|
2119
|
+
"has-multiple-tabs",
|
|
2120
|
+
"has-right-tabs",
|
|
2121
|
+
"has-last-active",
|
|
2122
|
+
"is-target-home",
|
|
2123
|
+
"is-target-active",
|
|
2124
|
+
"position",
|
|
2125
|
+
"target-tab"
|
|
2126
|
+
])])) : k("", !0);
|
|
2127
|
+
};
|
|
2128
|
+
}
|
|
2129
|
+
}), ii = /* @__PURE__ */ P({
|
|
2130
|
+
__name: "AppLayout",
|
|
2131
|
+
setup(e) {
|
|
2132
|
+
let t = v(), n = dt(), r = X(), i = Ht(), a = z(0), o = E(() => t.matched.filter((e) => e.meta?.title));
|
|
2133
|
+
ne(() => {
|
|
2134
|
+
i.initShortcuts(), window.addEventListener("keydown", l, { capture: !0 });
|
|
2135
|
+
}), L(() => {
|
|
2136
|
+
window.removeEventListener("keydown", l, { capture: !0 });
|
|
2137
|
+
});
|
|
2138
|
+
function s() {
|
|
2139
|
+
a.value += 1;
|
|
2140
|
+
}
|
|
2141
|
+
G(() => t.fullPath, () => {
|
|
2142
|
+
let e = String(t.meta.title ?? "未命名页面"), r = t.meta.icon ? String(t.meta.icon) : void 0;
|
|
2143
|
+
c(), t.meta.public || n.syncTab({
|
|
2144
|
+
path: t.path,
|
|
2145
|
+
fullPath: t.fullPath,
|
|
2146
|
+
title: e,
|
|
2147
|
+
icon: r
|
|
2148
|
+
});
|
|
2149
|
+
}, { immediate: !0 });
|
|
2150
|
+
function c() {
|
|
2151
|
+
let e = t.matched.find((e) => e.path !== "/" && !e.meta?.hidden);
|
|
2152
|
+
if (!e) return;
|
|
2153
|
+
let n = e.path.startsWith("/") ? e.path : `/${e.path}`;
|
|
2154
|
+
r.setSelectedTopMenuPath(n);
|
|
2155
|
+
}
|
|
2156
|
+
function l(e) {
|
|
2157
|
+
if (!(e.defaultPrevented || e.repeat || e.isComposing)) {
|
|
2158
|
+
if (i.isShortcutEnabled("toggleMenu") && Yt(e, i.getShortcutKeys("toggleMenu"))) {
|
|
2159
|
+
e.preventDefault(), r.toggleSidebar();
|
|
2160
|
+
return;
|
|
2161
|
+
}
|
|
2162
|
+
i.isShortcutEnabled("settings") && Yt(e, i.getShortcutKeys("settings")) && (e.preventDefault(), r.setSettingsVisible(!r.settingsVisible));
|
|
2163
|
+
}
|
|
2164
|
+
}
|
|
2165
|
+
return (e, t) => {
|
|
2166
|
+
let n = V("el-container");
|
|
2167
|
+
return R(), A(S, null, [N(n, { class: "app-layout" }, {
|
|
2168
|
+
default: K(() => [
|
|
2169
|
+
N(Wr),
|
|
2170
|
+
N(n, { direction: "vertical" }, {
|
|
2171
|
+
default: K(() => [
|
|
2172
|
+
N(Mr, { "breadcrumb-items": o.value }, null, 8, ["breadcrumb-items"]),
|
|
2173
|
+
N(ri, { onRefresh: s }),
|
|
2174
|
+
N(Hn, { "refresh-key": a.value }, null, 8, ["refresh-key"])
|
|
2175
|
+
]),
|
|
2176
|
+
_: 1
|
|
2177
|
+
}),
|
|
2178
|
+
N(w, { name: "app-mobile-mask" }, {
|
|
2179
|
+
default: K(() => [W(r).mobileSidebarVisible ? (R(), A("button", {
|
|
2180
|
+
key: 0,
|
|
2181
|
+
type: "button",
|
|
2182
|
+
class: "app-layout__mobile-mask",
|
|
2183
|
+
"aria-label": "关闭侧边栏",
|
|
2184
|
+
onClick: t[0] ||= (e) => W(r).closeMobileSidebar()
|
|
2185
|
+
})) : k("", !0)]),
|
|
2186
|
+
_: 1
|
|
2187
|
+
})
|
|
2188
|
+
]),
|
|
2189
|
+
_: 1
|
|
2190
|
+
}), N(Vn)], 64);
|
|
2191
|
+
};
|
|
2192
|
+
}
|
|
2193
|
+
});
|
|
2194
|
+
//#endregion
|
|
2195
|
+
//#region src/main/router/base-routes.ts
|
|
2196
|
+
function ai(e = []) {
|
|
2197
|
+
return [{
|
|
2198
|
+
path: "/login",
|
|
2199
|
+
name: "login",
|
|
2200
|
+
component: () => import("./Login-8fZ-l3ST.js"),
|
|
2201
|
+
meta: {
|
|
2202
|
+
title: "登录",
|
|
2203
|
+
public: !0
|
|
2204
|
+
}
|
|
2205
|
+
}, {
|
|
2206
|
+
path: "/",
|
|
2207
|
+
component: ii,
|
|
2208
|
+
redirect: "/dashboard",
|
|
2209
|
+
children: [
|
|
2210
|
+
{
|
|
2211
|
+
path: "403",
|
|
2212
|
+
name: "forbidden",
|
|
2213
|
+
component: () => import("./Forbidden-Cu2QQ-FY.js"),
|
|
2214
|
+
meta: {
|
|
2215
|
+
title: "暂无权限",
|
|
2216
|
+
public: !0,
|
|
2217
|
+
hidden: !0
|
|
2218
|
+
}
|
|
2219
|
+
},
|
|
2220
|
+
...e,
|
|
2221
|
+
{
|
|
2222
|
+
path: "config",
|
|
2223
|
+
name: "config-center",
|
|
2224
|
+
redirect: "/config/apps",
|
|
2225
|
+
meta: {
|
|
2226
|
+
title: "配置中心",
|
|
2227
|
+
icon: "Setting"
|
|
2228
|
+
},
|
|
2229
|
+
children: [{
|
|
2230
|
+
path: "apps",
|
|
2231
|
+
name: "config-apps",
|
|
2232
|
+
component: () => import("./application-config-DpfzdbAa.js"),
|
|
2233
|
+
meta: {
|
|
2234
|
+
title: "应用配置",
|
|
2235
|
+
icon: "Connection"
|
|
2236
|
+
}
|
|
2237
|
+
}, {
|
|
2238
|
+
path: "system",
|
|
2239
|
+
name: "config-system",
|
|
2240
|
+
component: () => import("./SystemConfig-Xa8FuNBK.js"),
|
|
2241
|
+
meta: {
|
|
2242
|
+
title: "系统配置",
|
|
2243
|
+
icon: "Setting"
|
|
2244
|
+
}
|
|
2245
|
+
}]
|
|
2246
|
+
},
|
|
2247
|
+
{
|
|
2248
|
+
path: ":pathMatch(.*)*",
|
|
2249
|
+
name: "not-found",
|
|
2250
|
+
component: () => import("./NotFound-VRL7_aMx.js"),
|
|
2251
|
+
meta: {
|
|
2252
|
+
title: "页面不存在",
|
|
2253
|
+
public: !0,
|
|
2254
|
+
hidden: !0
|
|
2255
|
+
}
|
|
2256
|
+
}
|
|
2257
|
+
]
|
|
2258
|
+
}];
|
|
2259
|
+
}
|
|
2260
|
+
//#endregion
|
|
2261
|
+
//#region src/main/router/index.ts
|
|
2262
|
+
function oi(e = []) {
|
|
2263
|
+
let t = Array.isArray(e) ? { businessRoutes: e } : e, n = g({
|
|
2264
|
+
history: t.history ?? _("/"),
|
|
2265
|
+
routes: ai(t.businessRoutes ?? []),
|
|
2266
|
+
scrollBehavior: t.scrollBehavior ?? (() => ({ top: 0 }))
|
|
2267
|
+
});
|
|
2268
|
+
return nt(n), t.setupRouter?.(n), n;
|
|
2269
|
+
}
|
|
2270
|
+
//#endregion
|
|
2271
|
+
//#region src/main/micro-apps/status.ts
|
|
2272
|
+
var Q = ie({}), si = ie({});
|
|
2273
|
+
function ci() {
|
|
2274
|
+
return Q;
|
|
2275
|
+
}
|
|
2276
|
+
function li(e) {
|
|
2277
|
+
return si[e];
|
|
2278
|
+
}
|
|
2279
|
+
function ui(e) {
|
|
2280
|
+
return f(d()).find((t) => e === t.activeRule || e.startsWith(`${t.activeRule}/`));
|
|
2281
|
+
}
|
|
2282
|
+
function di(e) {
|
|
2283
|
+
return Q[e.name] || (Q[e.name] = {
|
|
2284
|
+
name: e.name,
|
|
2285
|
+
title: e.title,
|
|
2286
|
+
entry: e.entry,
|
|
2287
|
+
activeRule: e.activeRule,
|
|
2288
|
+
status: "idle",
|
|
2289
|
+
updatedAt: Date.now()
|
|
2290
|
+
}, Q[e.name]);
|
|
2291
|
+
}
|
|
2292
|
+
function fi(e) {
|
|
2293
|
+
vi(e, {
|
|
2294
|
+
status: "loading",
|
|
2295
|
+
message: void 0
|
|
2296
|
+
});
|
|
2297
|
+
}
|
|
2298
|
+
function pi(e) {
|
|
2299
|
+
vi(e, {
|
|
2300
|
+
status: "mounted",
|
|
2301
|
+
message: void 0
|
|
2302
|
+
});
|
|
2303
|
+
}
|
|
2304
|
+
function mi(e, t) {
|
|
2305
|
+
yi(e, {
|
|
2306
|
+
status: "error",
|
|
2307
|
+
message: bi(t)
|
|
2308
|
+
});
|
|
2309
|
+
}
|
|
2310
|
+
function hi(e, t) {
|
|
2311
|
+
let n = Q[e];
|
|
2312
|
+
return n ? (n.status = "error", n.message = bi(t), n.updatedAt = Date.now(), !0) : !1;
|
|
2313
|
+
}
|
|
2314
|
+
function gi(e, t, n) {
|
|
2315
|
+
si[t] = {
|
|
2316
|
+
path: t,
|
|
2317
|
+
name: e.name,
|
|
2318
|
+
title: e.title,
|
|
2319
|
+
entry: e.entry,
|
|
2320
|
+
activeRule: e.activeRule,
|
|
2321
|
+
message: bi(n),
|
|
2322
|
+
updatedAt: Date.now()
|
|
2323
|
+
};
|
|
2324
|
+
}
|
|
2325
|
+
function _i(e) {
|
|
2326
|
+
delete si[e];
|
|
2327
|
+
}
|
|
2328
|
+
function vi(e, t) {
|
|
2329
|
+
let n = Q[e];
|
|
2330
|
+
n && (n.status = t.status, n.message = t.message, n.updatedAt = Date.now());
|
|
2331
|
+
}
|
|
2332
|
+
function yi(e, t) {
|
|
2333
|
+
let n = di(e);
|
|
2334
|
+
n.title = e.title, n.entry = e.entry, n.activeRule = e.activeRule, n.status = t.status, n.message = t.message, n.updatedAt = Date.now();
|
|
2335
|
+
}
|
|
2336
|
+
function bi(e) {
|
|
2337
|
+
let t = xi(e);
|
|
2338
|
+
return t ? Ci(Si(t)) : "子应用入口不可访问、服务未启动,或加载过程中发生异常。";
|
|
2339
|
+
}
|
|
2340
|
+
function xi(e) {
|
|
2341
|
+
return e instanceof Error ? e.message : typeof e == "string" ? e : "";
|
|
2342
|
+
}
|
|
2343
|
+
function Si(e) {
|
|
2344
|
+
return e.trim().replace(/^(application ['"][^'"]+['"] died in status [A-Z_]+:\s*)\1+/, "$1");
|
|
2345
|
+
}
|
|
2346
|
+
function Ci(e) {
|
|
2347
|
+
let t = e.trim(), n = t.toLowerCase(), r = t.match(/application ['"]([^'"]+)['"]/)?.[1], i = r ? `子应用“${r}”` : "子应用";
|
|
2348
|
+
return n.includes("cannot use import statement outside a module") ? `${i}入口已响应,但加载失败。请确认子应用服务已启动,并确认入口地址指向子应用服务。` : 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;
|
|
2349
|
+
}
|
|
2350
|
+
//#endregion
|
|
2351
|
+
//#region src/main/micro-apps/types.ts
|
|
2352
|
+
var wi = "morningfast:theme-change", Ti = !1, Ei = !1;
|
|
2353
|
+
function Di() {
|
|
2354
|
+
if (Ti) {
|
|
2355
|
+
Oi();
|
|
2356
|
+
return;
|
|
2357
|
+
}
|
|
2358
|
+
Ti = !0;
|
|
2359
|
+
let e = f(d());
|
|
2360
|
+
e.forEach(di), Ue(e.map((e) => ({
|
|
2361
|
+
name: e.name,
|
|
2362
|
+
entry: e.entry,
|
|
2363
|
+
container: e.container,
|
|
2364
|
+
activeRule: e.activeRule,
|
|
2365
|
+
props: Ai(e)
|
|
2366
|
+
})), {
|
|
2367
|
+
beforeLoad: [async (e) => {
|
|
2368
|
+
_i(window.location.pathname), fi(e.name);
|
|
2369
|
+
}],
|
|
2370
|
+
afterMount: [async (e) => {
|
|
2371
|
+
_i(window.location.pathname), pi(e.name);
|
|
2372
|
+
}]
|
|
2373
|
+
}), He((t) => {
|
|
2374
|
+
let n = t instanceof ErrorEvent ? t.error || t.message : t, r = ki(n) || ki(t);
|
|
2375
|
+
if (r && hi(r, n)) {
|
|
2376
|
+
let t = e.find((e) => e.name === r);
|
|
2377
|
+
t && gi(t, window.location.pathname, n);
|
|
2378
|
+
return;
|
|
2379
|
+
}
|
|
2380
|
+
e.forEach((e) => {
|
|
2381
|
+
(window.location.pathname === e.activeRule || window.location.pathname.startsWith(`${e.activeRule}/`)) && (mi(e, n), gi(e, window.location.pathname, n));
|
|
2382
|
+
});
|
|
2383
|
+
}), Oi(), ji();
|
|
2384
|
+
}
|
|
2385
|
+
function Oi() {
|
|
2386
|
+
Ei || document.querySelector("#micro-app-container") && (Ei = !0, We({
|
|
2387
|
+
prefetch: !1,
|
|
2388
|
+
sandbox: { experimentalStyleIsolation: !0 },
|
|
2389
|
+
urlRerouteOnly: !0
|
|
2390
|
+
}));
|
|
2391
|
+
}
|
|
2392
|
+
function ki(e) {
|
|
2393
|
+
return (e instanceof Error ? e.message : String(e || "")).match(/application ['"]?([^'"\s]+)['"]?/i)?.[1];
|
|
2394
|
+
}
|
|
2395
|
+
function Ai(e) {
|
|
2396
|
+
let t = X();
|
|
2397
|
+
return {
|
|
2398
|
+
basePath: e.activeRule,
|
|
2399
|
+
app: p(e),
|
|
2400
|
+
runtime: {
|
|
2401
|
+
env: "production",
|
|
2402
|
+
apiBaseUrl: "/api"
|
|
2403
|
+
},
|
|
2404
|
+
theme: Ni(t.isDark),
|
|
2405
|
+
getRuntimeProps: () => ({ theme: Ni(t.isDark) })
|
|
2406
|
+
};
|
|
2407
|
+
}
|
|
2408
|
+
function ji() {
|
|
2409
|
+
let e = X();
|
|
2410
|
+
G(() => [
|
|
2411
|
+
e.isDark,
|
|
2412
|
+
e.themeColor,
|
|
2413
|
+
e.themeColorPosition
|
|
2414
|
+
], () => {
|
|
2415
|
+
window.setTimeout(() => {
|
|
2416
|
+
Mi(Ni(e.isDark));
|
|
2417
|
+
}, 0);
|
|
2418
|
+
});
|
|
2419
|
+
}
|
|
2420
|
+
function Mi(e) {
|
|
2421
|
+
window.dispatchEvent(new CustomEvent(wi, { detail: e }));
|
|
2422
|
+
}
|
|
2423
|
+
function Ni(e) {
|
|
2424
|
+
let t = getComputedStyle(document.documentElement);
|
|
2425
|
+
return {
|
|
2426
|
+
colorPrimary: $(t, "--el-color-primary", "#409EFF"),
|
|
2427
|
+
colorPrimaryLight3: $(t, "--el-color-primary-light-3", "#79bbff"),
|
|
2428
|
+
colorPrimaryLight5: $(t, "--el-color-primary-light-5", "#a0cfff"),
|
|
2429
|
+
colorPrimaryLight7: $(t, "--el-color-primary-light-7", "#c6e2ff"),
|
|
2430
|
+
colorPrimaryLight8: $(t, "--el-color-primary-light-8", "#d9ecff"),
|
|
2431
|
+
colorPrimaryLight9: $(t, "--el-color-primary-light-9", "#ecf5ff"),
|
|
2432
|
+
colorPrimaryDark2: $(t, "--el-color-primary-dark-2", "#337ecc"),
|
|
2433
|
+
mode: e ? "dark" : "light"
|
|
2434
|
+
};
|
|
2435
|
+
}
|
|
2436
|
+
function $(e, t, n) {
|
|
2437
|
+
return e.getPropertyValue(t).trim() || n;
|
|
2438
|
+
}
|
|
2439
|
+
//#endregion
|
|
2440
|
+
//#region src/main/pages/micro/MicroAppView.vue?vue&type=script&setup=true&lang.ts
|
|
2441
|
+
var Pi = { class: "micro-app-page" }, Fi = {
|
|
2442
|
+
key: 0,
|
|
2443
|
+
class: "micro-app-page__state micro-app-page__state--error"
|
|
2444
|
+
}, Ii = { class: "micro-app-page__body" }, Li = { class: "micro-app-page__meta" }, Ri = { key: 0 }, zi = { key: 1 }, Bi = { class: "micro-app-page__actions" }, Vi = ["id"], Hi = /* @__PURE__ */ u(/* @__PURE__ */ P({
|
|
2445
|
+
name: "MicroAppView",
|
|
2446
|
+
__name: "MicroAppView",
|
|
2447
|
+
setup(e) {
|
|
2448
|
+
let t = v(), n = ci(), r = z(""), i = null, a = E(() => ui(t.path)), o = E(() => {
|
|
2449
|
+
let e = a.value;
|
|
2450
|
+
return e ? n[e.name] : void 0;
|
|
2451
|
+
}), s = E(() => li(t.path)), c = E(() => o.value?.title || a.value?.title || s.value?.title || "未知子应用"), l = E(() => o.value?.entry || a.value?.entry || s.value?.entry || "-"), u = E(() => "子应用暂时无法访问,请稍后重试。"), d = E(() => o.value?.status === "error" || !!s.value || !!r.value || !a.value);
|
|
2452
|
+
G(() => t.path, () => {
|
|
2453
|
+
F(() => {
|
|
2454
|
+
Di(), f();
|
|
2455
|
+
});
|
|
2456
|
+
}, { immediate: !0 }), ne(() => {
|
|
2457
|
+
F(() => {
|
|
2458
|
+
Di(), f();
|
|
2459
|
+
});
|
|
2460
|
+
}), G(() => o.value?.status, (e) => {
|
|
2461
|
+
e === "mounted" && (p(), r.value = "");
|
|
2462
|
+
}), L(() => {
|
|
2463
|
+
p();
|
|
2464
|
+
});
|
|
2465
|
+
function f() {
|
|
2466
|
+
p(), r.value = "", a.value && (i = window.setTimeout(() => {
|
|
2467
|
+
o.value?.status !== "mounted" && (r.value = "子应用暂时无法访问,请稍后重试。");
|
|
2468
|
+
}, 15e3));
|
|
2469
|
+
}
|
|
2470
|
+
function p() {
|
|
2471
|
+
i !== null && (window.clearTimeout(i), i = null);
|
|
2472
|
+
}
|
|
2473
|
+
function h() {
|
|
2474
|
+
window.location.reload();
|
|
2475
|
+
}
|
|
2476
|
+
function g() {
|
|
2477
|
+
let e = l.value;
|
|
2478
|
+
e && e !== "-" && window.open(e, "_blank", "noopener,noreferrer");
|
|
2479
|
+
}
|
|
2480
|
+
return (e, t) => {
|
|
2481
|
+
let n = V("el-icon"), r = V("el-button");
|
|
2482
|
+
return R(), A("div", Pi, [d.value ? (R(), A("div", Fi, [N(n, { class: "micro-app-page__icon" }, {
|
|
2483
|
+
default: K(() => [N(W(Be))]),
|
|
2484
|
+
_: 1
|
|
2485
|
+
}), j("div", Ii, [
|
|
2486
|
+
t[5] ||= j("p", { class: "micro-app-page__title" }, "子应用加载失败", -1),
|
|
2487
|
+
j("dl", Li, [
|
|
2488
|
+
j("div", null, [t[0] ||= j("dt", null, "应用", -1), j("dd", null, U(c.value), 1)]),
|
|
2489
|
+
W(!1) ? (R(), A("div", Ri, [t[1] ||= j("dt", null, "入口", -1), j("dd", null, U(l.value), 1)])) : k("", !0),
|
|
2490
|
+
u.value ? (R(), A("div", zi, [t[2] ||= j("dt", null, "原因", -1), j("dd", null, U(u.value), 1)])) : k("", !0)
|
|
2491
|
+
]),
|
|
2492
|
+
j("div", Bi, [N(r, {
|
|
2493
|
+
type: "primary",
|
|
2494
|
+
icon: W(Me),
|
|
2495
|
+
onClick: h
|
|
2496
|
+
}, {
|
|
2497
|
+
default: K(() => [...t[3] ||= [M("重新加载", -1)]]),
|
|
2498
|
+
_: 1
|
|
2499
|
+
}, 8, ["icon"]), W(!1) && (o.value?.entry || a.value?.entry) ? (R(), O(r, {
|
|
2500
|
+
key: 0,
|
|
2501
|
+
icon: W(De),
|
|
2502
|
+
onClick: g
|
|
2503
|
+
}, {
|
|
2504
|
+
default: K(() => [...t[4] ||= [M(" 打开入口 ", -1)]]),
|
|
2505
|
+
_: 1
|
|
2506
|
+
}, 8, ["icon"])) : k("", !0)])
|
|
2507
|
+
])])) : k("", !0), j("section", {
|
|
2508
|
+
id: W(m),
|
|
2509
|
+
class: "micro-app-page__container"
|
|
2510
|
+
}, null, 8, Vi)]);
|
|
2511
|
+
};
|
|
2512
|
+
}
|
|
2513
|
+
}), [["__scopeId", "data-v-944de23f"]]);
|
|
2514
|
+
//#endregion
|
|
2515
|
+
//#region src/main/router/route-items.ts
|
|
2516
|
+
function Ui(e, t) {
|
|
2517
|
+
return h(e, t, (e) => e.microApp ? Hi : void 0);
|
|
2518
|
+
}
|
|
2519
|
+
//#endregion
|
|
2520
|
+
//#region src/main/app/AppUpdateDialog.vue?vue&type=script&setup=true&lang.ts
|
|
2521
|
+
var Wi = {
|
|
2522
|
+
key: 0,
|
|
2523
|
+
class: "app-update-dialog",
|
|
2524
|
+
role: "presentation"
|
|
2525
|
+
}, Gi = {
|
|
2526
|
+
class: "app-update-dialog__panel",
|
|
2527
|
+
role: "dialog",
|
|
2528
|
+
"aria-modal": "true",
|
|
2529
|
+
"aria-labelledby": "app-update-dialog-title"
|
|
2530
|
+
}, Ki = { class: "app-update-dialog__icon" }, qi = { class: "app-update-dialog__content" }, Ji = {
|
|
2531
|
+
key: 0,
|
|
2532
|
+
class: "app-update-dialog__version"
|
|
2533
|
+
}, Yi = {
|
|
2534
|
+
key: 1,
|
|
2535
|
+
class: "app-update-dialog__changelog"
|
|
2536
|
+
}, Xi = { class: "app-update-dialog__actions" }, Zi = /* @__PURE__ */ u(/* @__PURE__ */ P({
|
|
2537
|
+
__name: "AppUpdateDialog",
|
|
2538
|
+
props: {
|
|
2539
|
+
changelog: {},
|
|
2540
|
+
modelValue: { type: Boolean },
|
|
2541
|
+
versionLabel: {}
|
|
2542
|
+
},
|
|
2543
|
+
emits: ["refresh", "remindLater"],
|
|
2544
|
+
setup(e, { emit: t }) {
|
|
2545
|
+
let n = t;
|
|
2546
|
+
function r(e) {
|
|
2547
|
+
if (e === "today") {
|
|
2548
|
+
n("remindLater", i());
|
|
2549
|
+
return;
|
|
2550
|
+
}
|
|
2551
|
+
let t = Number(e);
|
|
2552
|
+
Number.isFinite(t) && t > 0 && n("remindLater", t * 60 * 60 * 1e3);
|
|
2553
|
+
}
|
|
2554
|
+
function i() {
|
|
2555
|
+
let e = /* @__PURE__ */ new Date(), t = new Date(e);
|
|
2556
|
+
return t.setHours(23, 59, 59, 999), Math.max(t.getTime() - e.getTime(), 60 * 1e3);
|
|
2557
|
+
}
|
|
2558
|
+
return (t, i) => {
|
|
2559
|
+
let a = V("el-icon"), o = V("el-button"), s = V("el-dropdown-item"), c = V("el-dropdown-menu"), l = V("el-dropdown");
|
|
2560
|
+
return R(), O(C, { to: "body" }, [N(w, { name: "app-update-dialog-fade" }, {
|
|
2561
|
+
default: K(() => [e.modelValue ? (R(), A("section", Wi, [j("div", Gi, [
|
|
2562
|
+
j("div", Ki, [N(a, null, {
|
|
2563
|
+
default: K(() => [N(W(je))]),
|
|
2564
|
+
_: 1
|
|
2565
|
+
})]),
|
|
2566
|
+
j("div", qi, [
|
|
2567
|
+
i[2] ||= j("h2", { id: "app-update-dialog-title" }, "发现新版本", -1),
|
|
2568
|
+
i[3] ||= j("p", null, "系统已发布更新,刷新后即可使用最新功能和修复。", -1),
|
|
2569
|
+
e.versionLabel ? (R(), A("span", Ji, U(e.versionLabel), 1)) : k("", !0),
|
|
2570
|
+
e.changelog?.length ? (R(), A("div", Yi, [i[1] ||= j("span", null, "更新要点", -1), j("ul", null, [(R(!0), A(S, null, B(e.changelog, (e) => (R(), A("li", { key: e }, U(e), 1))), 128))])])) : k("", !0)
|
|
2571
|
+
]),
|
|
2572
|
+
j("div", Xi, [N(o, {
|
|
2573
|
+
type: "primary",
|
|
2574
|
+
onClick: i[0] ||= (e) => n("refresh")
|
|
2575
|
+
}, {
|
|
2576
|
+
default: K(() => [...i[4] ||= [M("立即更新", -1)]]),
|
|
2577
|
+
_: 1
|
|
2578
|
+
}), N(l, {
|
|
2579
|
+
trigger: "click",
|
|
2580
|
+
teleported: !1,
|
|
2581
|
+
onCommand: r
|
|
2582
|
+
}, {
|
|
2583
|
+
dropdown: K(() => [N(c, null, {
|
|
2584
|
+
default: K(() => [
|
|
2585
|
+
N(s, { command: 1 }, {
|
|
2586
|
+
default: K(() => [...i[6] ||= [M("1 小时后提醒", -1)]]),
|
|
2587
|
+
_: 1
|
|
2588
|
+
}),
|
|
2589
|
+
N(s, { command: 2 }, {
|
|
2590
|
+
default: K(() => [...i[7] ||= [M("2 小时后提醒", -1)]]),
|
|
2591
|
+
_: 1
|
|
2592
|
+
}),
|
|
2593
|
+
N(s, { command: 4 }, {
|
|
2594
|
+
default: K(() => [...i[8] ||= [M("4 小时后提醒", -1)]]),
|
|
2595
|
+
_: 1
|
|
2596
|
+
}),
|
|
2597
|
+
N(s, {
|
|
2598
|
+
divided: "",
|
|
2599
|
+
command: "today"
|
|
2600
|
+
}, {
|
|
2601
|
+
default: K(() => [...i[9] ||= [M("今日不再提醒", -1)]]),
|
|
2602
|
+
_: 1
|
|
2603
|
+
})
|
|
2604
|
+
]),
|
|
2605
|
+
_: 1
|
|
2606
|
+
})]),
|
|
2607
|
+
default: K(() => [N(o, null, {
|
|
2608
|
+
default: K(() => [i[5] ||= M(" 稍后提醒 ", -1), N(a, { class: "el-icon--right" }, {
|
|
2609
|
+
default: K(() => [N(W(fe))]),
|
|
2610
|
+
_: 1
|
|
2611
|
+
})]),
|
|
2612
|
+
_: 1
|
|
2613
|
+
})]),
|
|
2614
|
+
_: 1
|
|
2615
|
+
})])
|
|
2616
|
+
])])) : k("", !0)]),
|
|
2617
|
+
_: 1
|
|
2618
|
+
})]);
|
|
2619
|
+
};
|
|
2620
|
+
}
|
|
2621
|
+
}), [["__scopeId", "data-v-118283a1"]]), Qi = "app-update:check-enabled";
|
|
2622
|
+
function $i(e = !0) {
|
|
2623
|
+
let t = localStorage.getItem(Qi);
|
|
2624
|
+
return t === "true" ? !0 : t === "false" ? !1 : e;
|
|
2625
|
+
}
|
|
2626
|
+
function ea(e) {
|
|
2627
|
+
localStorage.setItem(Qi, String(e));
|
|
2628
|
+
}
|
|
2629
|
+
//#endregion
|
|
2630
|
+
//#region src/main/app/update-checker.ts
|
|
2631
|
+
var ta = "/app-manifest.json", na = 300 * 1e3, ra = "app-update:snooze", ia, aa, oa, sa = "", ca = !1, la = {}, ua, da;
|
|
2632
|
+
function fa(e = {}) {
|
|
2633
|
+
la = {
|
|
2634
|
+
...la,
|
|
2635
|
+
...e
|
|
2636
|
+
}, !(ca || la.enabled === !1 || typeof window > "u" || !$i(!0)) && (ca = !0, !Ta() && pa());
|
|
2637
|
+
}
|
|
2638
|
+
function pa() {
|
|
2639
|
+
ya(), ga(), ia = window.setInterval(() => {
|
|
2640
|
+
ga();
|
|
2641
|
+
}, Sa());
|
|
2642
|
+
}
|
|
2643
|
+
function ma() {
|
|
2644
|
+
ya(), ba(), va(), ca = !1, sa = "";
|
|
2645
|
+
}
|
|
2646
|
+
function ha(e = {}) {
|
|
2647
|
+
ma(), fa({
|
|
2648
|
+
...la,
|
|
2649
|
+
...e
|
|
2650
|
+
});
|
|
2651
|
+
}
|
|
2652
|
+
async function ga() {
|
|
2653
|
+
if (!$i(!0)) {
|
|
2654
|
+
ma();
|
|
2655
|
+
return;
|
|
2656
|
+
}
|
|
2657
|
+
if (Ta()) return;
|
|
2658
|
+
let e = await xa(la.manifestUrl || ta);
|
|
2659
|
+
if (!e?.label) return;
|
|
2660
|
+
if (!oa) {
|
|
2661
|
+
oa = e;
|
|
2662
|
+
return;
|
|
2663
|
+
}
|
|
2664
|
+
let t = Aa(oa, e);
|
|
2665
|
+
!t || t.label === sa || Ca(t.label) || (sa = t.label, _a(t));
|
|
2666
|
+
}
|
|
2667
|
+
function _a(e) {
|
|
2668
|
+
va(), da = document.createElement("div"), document.body.appendChild(da), ua = D(Zi, {
|
|
2669
|
+
changelog: e.changelog,
|
|
2670
|
+
modelValue: !0,
|
|
2671
|
+
versionLabel: Ma(e.displayVersion),
|
|
2672
|
+
onRefresh: () => {
|
|
2673
|
+
window.location.reload();
|
|
2674
|
+
},
|
|
2675
|
+
onRemindLater: (t) => {
|
|
2676
|
+
wa(e.label, t), sa = "", va(), ya(), Ta();
|
|
2677
|
+
}
|
|
2678
|
+
}), ua.use(x, { locale: Ge }), ua.mount(da);
|
|
2679
|
+
}
|
|
2680
|
+
function va() {
|
|
2681
|
+
ua?.unmount(), da?.remove(), ua = void 0, da = void 0;
|
|
2682
|
+
}
|
|
2683
|
+
function ya() {
|
|
2684
|
+
ia !== void 0 && (window.clearInterval(ia), ia = void 0);
|
|
2685
|
+
}
|
|
2686
|
+
function ba() {
|
|
2687
|
+
aa !== void 0 && (window.clearTimeout(aa), aa = void 0);
|
|
2688
|
+
}
|
|
2689
|
+
async function xa(e) {
|
|
2690
|
+
try {
|
|
2691
|
+
let t = new URL(e, window.location.origin);
|
|
2692
|
+
t.searchParams.set("_t", String(Date.now()));
|
|
2693
|
+
let n = await fetch(t, {
|
|
2694
|
+
cache: "no-store",
|
|
2695
|
+
headers: {
|
|
2696
|
+
"Cache-Control": "no-cache",
|
|
2697
|
+
Pragma: "no-cache"
|
|
2698
|
+
}
|
|
2699
|
+
});
|
|
2700
|
+
if (!n.ok) return null;
|
|
2701
|
+
let r = n.headers.get("content-type");
|
|
2702
|
+
return r && !r.includes("application/json") ? null : Oa(await n.json());
|
|
2703
|
+
} catch {
|
|
2704
|
+
return null;
|
|
2705
|
+
}
|
|
2706
|
+
}
|
|
2707
|
+
function Sa() {
|
|
2708
|
+
return Math.max(la.interval ?? na, 30 * 1e3);
|
|
2709
|
+
}
|
|
2710
|
+
function Ca(e) {
|
|
2711
|
+
let t = Ea();
|
|
2712
|
+
return !!(t && t.version === e);
|
|
2713
|
+
}
|
|
2714
|
+
function wa(e, t) {
|
|
2715
|
+
let n = Date.now() + Math.max(t, 60 * 1e3);
|
|
2716
|
+
localStorage.setItem(ra, JSON.stringify({
|
|
2717
|
+
version: e,
|
|
2718
|
+
until: n
|
|
2719
|
+
}));
|
|
2720
|
+
}
|
|
2721
|
+
function Ta() {
|
|
2722
|
+
let e = Ea();
|
|
2723
|
+
return e?.until ? (ya(), ba(), aa = window.setTimeout(() => {
|
|
2724
|
+
aa = void 0, ca && $i(!0) && pa();
|
|
2725
|
+
}, Math.max(e.until - Date.now(), 1e3)), !0) : (ba(), !1);
|
|
2726
|
+
}
|
|
2727
|
+
function Ea() {
|
|
2728
|
+
let e = Da();
|
|
2729
|
+
return !e?.until || e.until <= Date.now() ? null : e;
|
|
2730
|
+
}
|
|
2731
|
+
function Da() {
|
|
2732
|
+
try {
|
|
2733
|
+
let e = localStorage.getItem(ra);
|
|
2734
|
+
return e ? JSON.parse(e) : null;
|
|
2735
|
+
} catch {
|
|
2736
|
+
return localStorage.removeItem(ra), null;
|
|
2737
|
+
}
|
|
2738
|
+
}
|
|
2739
|
+
function Oa(e) {
|
|
2740
|
+
let t = {}, n = {}, r = [], i = ka(e.main);
|
|
2741
|
+
i && (t.main = e.main ?? {}, n.main = i), e.main?.changelog && r.push(...ja(e.main.changelog));
|
|
2742
|
+
for (let [i, a] of Object.entries(e.apps ?? {})) {
|
|
2743
|
+
let e = ka(a);
|
|
2744
|
+
e && (t[i] = a, n[i] = e), a.changelog && r.push(...ja(a.changelog));
|
|
2745
|
+
}
|
|
2746
|
+
return {
|
|
2747
|
+
changelog: r,
|
|
2748
|
+
displayVersion: i,
|
|
2749
|
+
entries: t,
|
|
2750
|
+
label: Object.keys(n).sort().map((e) => `${e}:${n[e]}`).join("|"),
|
|
2751
|
+
versions: n
|
|
2752
|
+
};
|
|
2753
|
+
}
|
|
2754
|
+
function ka(e) {
|
|
2755
|
+
return [e?.version, e?.buildTime].filter(Boolean).join("@");
|
|
2756
|
+
}
|
|
2757
|
+
function Aa(e, t) {
|
|
2758
|
+
let n = Object.entries(t.versions).filter(([t, n]) => e.versions[t] !== n).map(([e]) => [e, t.entries[e]]).filter((e) => !!e[1]), r = Object.keys(e.versions).filter((e) => !t.versions[e]);
|
|
2759
|
+
if (!n.length && !r.length) return null;
|
|
2760
|
+
let i = {};
|
|
2761
|
+
for (let [e] of n) {
|
|
2762
|
+
let n = t.versions[e];
|
|
2763
|
+
n && (i[e] = n);
|
|
2764
|
+
}
|
|
2765
|
+
return {
|
|
2766
|
+
changelog: n.flatMap(([, e]) => ja(e.changelog)),
|
|
2767
|
+
displayVersion: i.main || Object.values(i)[0] || "",
|
|
2768
|
+
entries: Object.fromEntries(n),
|
|
2769
|
+
label: [...n.map(([e]) => `${e}:${t.versions[e]}`), ...r.map((e) => `${e}:removed`)].join("|"),
|
|
2770
|
+
versions: i
|
|
2771
|
+
};
|
|
2772
|
+
}
|
|
2773
|
+
function ja(e) {
|
|
2774
|
+
return Array.isArray(e) ? e.map((e) => String(e).trim()).filter(Boolean) : [];
|
|
2775
|
+
}
|
|
2776
|
+
function Ma(e) {
|
|
2777
|
+
let [t, n] = e.split("@");
|
|
2778
|
+
return t && n ? `版本 ${t} · ${n}` : t || n || "";
|
|
2779
|
+
}
|
|
2780
|
+
//#endregion
|
|
2781
|
+
//#region src/main/directives/index.ts
|
|
2782
|
+
var Na = {
|
|
2783
|
+
mounted(e, t) {
|
|
2784
|
+
Pa(e, t.value);
|
|
2785
|
+
},
|
|
2786
|
+
updated(e, t) {
|
|
2787
|
+
Pa(e, t.value);
|
|
2788
|
+
}
|
|
2789
|
+
};
|
|
2790
|
+
function Pa(e, t) {
|
|
2791
|
+
let n = a(), r = Fa(t), i = typeof t == "object" && !Array.isArray(t) && t.mode || "all", o = typeof t == "object" && !Array.isArray(t) ? !!t.disabled : !1, s = i === "any" ? r.some((e) => n.hasPermission(e)) : r.every((e) => n.hasPermission(e));
|
|
2792
|
+
if (!r.length || s) {
|
|
2793
|
+
e.style.display = "", e.hidden = !1, o && (e.removeAttribute("disabled"), e.classList.remove("is-disabled"));
|
|
2794
|
+
return;
|
|
2795
|
+
}
|
|
2796
|
+
if (o) {
|
|
2797
|
+
e.setAttribute("disabled", "disabled"), e.classList.add("is-disabled");
|
|
2798
|
+
return;
|
|
2799
|
+
}
|
|
2800
|
+
e.style.display = "none", e.hidden = !0;
|
|
2801
|
+
}
|
|
2802
|
+
function Fa(e) {
|
|
2803
|
+
return typeof e == "string" ? e ? [e] : [] : Array.isArray(e) ? e : e.permissions ?? [];
|
|
2804
|
+
}
|
|
2805
|
+
function Ia(e) {
|
|
2806
|
+
e.directive("permission", Na);
|
|
2807
|
+
}
|
|
2808
|
+
//#endregion
|
|
2809
|
+
//#region src/main/app/create-app.ts
|
|
2810
|
+
async function La(e) {
|
|
2811
|
+
Je(e.appConfig), $e();
|
|
2812
|
+
let t = oi({
|
|
2813
|
+
businessRoutes: e.businessRoutes,
|
|
2814
|
+
history: e.routerHistory,
|
|
2815
|
+
scrollBehavior: e.routerScrollBehavior,
|
|
2816
|
+
setupRouter: e.setupRouter
|
|
2817
|
+
}), n = D(e.rootComponent), r = se(), i = {
|
|
2818
|
+
app: n,
|
|
2819
|
+
router: t,
|
|
2820
|
+
pinia: r,
|
|
2821
|
+
http: Xe,
|
|
2822
|
+
requestManager: Qe
|
|
2823
|
+
};
|
|
2824
|
+
de(), n.use(x, { locale: Ge }), n.use(r), n.use(t), Ia(n), Ke(t), await e.setupApp?.(i), await e.beforePlatformInit?.(i);
|
|
2825
|
+
let a = X(r), o = l(r), s = dt(r);
|
|
2826
|
+
a.initializePreferences(), fa(e.appConfig.updateChecker);
|
|
2827
|
+
let c = ue({ fullscreen: !0 });
|
|
2828
|
+
try {
|
|
2829
|
+
await Promise.all([o.initializeSystemConfig(), s.initializeTabs()]);
|
|
2830
|
+
} finally {
|
|
2831
|
+
c.close();
|
|
2832
|
+
}
|
|
2833
|
+
await e.afterPlatformInit?.(i), await e.beforeMount?.(i);
|
|
2834
|
+
let u = n.mount("#app"), d = {
|
|
2835
|
+
...i,
|
|
2836
|
+
vm: u
|
|
2837
|
+
};
|
|
2838
|
+
return await e.afterMount?.(d), n;
|
|
2839
|
+
}
|
|
2840
|
+
//#endregion
|
|
2841
|
+
export { Ze as _, $i as a, Ke as b, Hi as c, Gr as d, Ht as f, $e as g, dt as h, ma as i, oi as l, J as m, ha as n, ea as o, X as p, fa as r, Ui as s, La as t, ai as u, Xe as v, Qe as y };
|