@morningfast/platform 1.0.5 → 1.0.7

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