@morningfast/platform 1.0.4 → 1.0.6

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