@morningfast/platform 0.0.12 → 0.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/dist/assets/main/style.css +2 -5
  2. package/dist/chunks/{Login-BKuPkkY9.js → Login-8fZ-l3ST.js} +11 -11
  3. package/dist/chunks/{SystemConfig-DGZUwXWB.js → SystemConfig-Xa8FuNBK.js} +1 -1
  4. package/dist/chunks/{application-config-DLHtmY_2.js → application-config-DpfzdbAa.js} +2 -2
  5. package/dist/chunks/main-CX2uCPdt.js +2841 -0
  6. package/dist/chunks/route-items-DXwaEe0Y.js +21 -0
  7. package/dist/index.d.ts +1 -1
  8. package/dist/index.js +7 -8
  9. package/dist/main/app/AppUpdateDialog.vue.d.ts +14 -0
  10. package/dist/main/app/runtime-config.d.ts +5 -0
  11. package/dist/main/app/update-checker.d.ts +8 -0
  12. package/dist/main/app/update-preferences.d.ts +2 -0
  13. package/dist/main/index.d.ts +2 -0
  14. package/dist/main/layouts/composables/useShortcutLabel.d.ts +1 -1
  15. package/dist/main/router/route-items.d.ts +3 -15
  16. package/dist/main/settings/components/AppearanceSettings.vue.d.ts +3 -0
  17. package/dist/main/settings/components/GeneralSettings.vue.d.ts +3 -0
  18. package/dist/main/settings/components/LayoutSettings.vue.d.ts +3 -0
  19. package/dist/main/settings/components/ShortcutSettings.vue.d.ts +3 -0
  20. package/dist/main/stores/index.d.ts +1 -0
  21. package/dist/main/stores/shortcut.d.ts +77 -0
  22. package/dist/main/utils/keyboard-shortcut.d.ts +39 -0
  23. package/dist/main.js +5 -6
  24. package/dist/shared/router/route-items.d.ts +15 -0
  25. package/dist/sub/index.d.ts +2 -2
  26. package/dist/sub.js +1 -1
  27. package/package.json +1 -1
  28. package/dist/chunks/main-BVdwJu-s.js +0 -1840
  29. package/dist/chunks/route-items-84k92f3O.js +0 -513
  30. /package/dist/chunks/{_plugin-vue_export-helper-DvRHjpsZ.js → _plugin-vue_export-helper-CZc-Y3Wh.js} +0 -0
  31. /package/dist/chunks/{config-Cd-9BYBy.js → config-CJOAan9n.js} +0 -0
@@ -1,1840 +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 { a as u, i as d, r as f } from "./route-items-84k92f3O.js";
6
- import { t as p } from "./_plugin-vue_export-helper-DvRHjpsZ.js";
7
- import { createRouter as m, createWebHistory as h, useRoute as g, useRouter as _ } from "vue-router";
8
- import v from "nprogress";
9
- import y, { ElMessage as b } from "element-plus";
10
- import { Fragment as x, Teleport as S, Transition as C, TransitionGroup as w, computed as T, createApp as E, createBlock as D, createCommentVNode as O, createElementBlock as k, createElementVNode as A, createTextVNode as j, createVNode as M, defineComponent as N, nextTick as P, normalizeClass as F, normalizeStyle as I, onBeforeUnmount as ee, onMounted as te, onUnmounted as ne, openBlock as L, ref as R, renderList as z, resolveComponent as B, resolveDynamicComponent as V, toDisplayString as H, unref as U, watch as W, watchEffect as G, withCtx as K, withKeys as re, withModifiers as q } from "vue";
11
- import { createPinia as ie, defineStore as J } from "pinia";
12
- import { ArrowDown as ae, ArrowRight as oe, ArrowUp as se, Back as ce, Brush as le, Close as ue, Connection as de, DArrowLeft as fe, DArrowRight as pe, Expand as me, Fold as he, FolderDelete as ge, House as _e, Monitor as ve, Moon as ye, Operation as be, RefreshRight as xe, Search as Y, Setting as Se, Sunny as Ce, SwitchButton as we, TopRight as Te, User as Ee } from "@element-plus/icons-vue";
13
- import { MpDrawer as De, MpLoadingService as Oe, registerMpFormFieldComponents as ke } from "morningfast-plus/components";
14
- import Ae from "sortablejs";
15
- import je from "element-plus/es/locale/lang/zh-cn";
16
- import "element-plus/dist/index.css";
17
- import "element-plus/theme-chalk/dark/css-vars.css";
18
- import "nprogress/nprogress.css";
19
- //#region src/main/auth/expired.ts
20
- function Me(t) {
21
- return r(() => {
22
- if (e(), t.currentRoute.value.path === "/login") return;
23
- let n = `${t.currentRoute.value.fullPath || "/"}`;
24
- t.replace({
25
- path: "/login",
26
- query: { redirect: n }
27
- });
28
- });
29
- }
30
- //#endregion
31
- //#region src/main/app/runtime-config.ts
32
- var Ne = { apiBaseUrl: "/api" };
33
- function Pe(e) {
34
- Ne = e;
35
- }
36
- function Fe() {
37
- return Ne;
38
- }
39
- var { http: Ie, createApi: Le, requestManager: Re } = i({
40
- baseURL: Fe().apiBaseUrl,
41
- getToken: n,
42
- onError(e) {
43
- b.error(e);
44
- },
45
- onUnauthorized(e) {
46
- t({
47
- source: "main-app",
48
- reason: "unauthorized",
49
- code: e.code,
50
- message: e.message
51
- });
52
- }
53
- });
54
- function ze() {
55
- Ie.defaults.baseURL = Fe().apiBaseUrl;
56
- }
57
- //#endregion
58
- //#region src/main/router/guard.ts
59
- var Be = "/login", Ve = "/403";
60
- function He(e) {
61
- e.beforeEach(async (e, t) => {
62
- v.start(), e.path !== t.path && Re.setCurrentPage(e.path);
63
- let n = a(), r = !!e.meta.public;
64
- if (n.initialized || await n.initAuth(), !n.isAuthenticated && !r) return {
65
- path: Be,
66
- query: { redirect: e.fullPath }
67
- };
68
- if (n.isAuthenticated && e.path === Be) return { path: "/" };
69
- let i = e.meta.permission;
70
- return Ue(i, n.hasPermission) ? !0 : {
71
- path: Ve,
72
- query: { redirect: e.fullPath }
73
- };
74
- }), e.afterEach((e) => {
75
- l().setRouteTitle(String(e.meta.title ?? "Morningfast UI")), v.done();
76
- }), e.onError(() => {
77
- v.done();
78
- });
79
- }
80
- function Ue(e, t) {
81
- return e ? Array.isArray(e) ? e.every((e) => t(e)) : t(e) : !0;
82
- }
83
- //#endregion
84
- //#region src/main/stores/tabs.ts
85
- var X = "/dashboard", We = "tabs-state";
86
- function Z() {
87
- return {
88
- path: X,
89
- fullPath: X,
90
- title: "首页",
91
- icon: "House"
92
- };
93
- }
94
- function Ge() {
95
- return {
96
- tabs: [Z()],
97
- activeTab: X,
98
- lastActiveTab: ""
99
- };
100
- }
101
- function Ke(e) {
102
- let t = Ge();
103
- if (!e) return t;
104
- let n = Array.isArray(e.tabs) ? e.tabs.filter(Boolean).map(qe) : [], r = Je([Z(), ...n]).sort((e, t) => e.path === "/dashboard" ? -1 : +(t.path === "/dashboard"));
105
- return {
106
- tabs: r,
107
- activeTab: r.some((t) => t.path === e.activeTab) ? String(e.activeTab || "/dashboard") : r[0]?.path || "/dashboard",
108
- lastActiveTab: r.some((t) => t.path === e.lastActiveTab) ? String(e.lastActiveTab || "") : ""
109
- };
110
- }
111
- function qe(e) {
112
- return {
113
- path: String(e.path || "/dashboard"),
114
- fullPath: String(e.fullPath || e.path || "/dashboard"),
115
- title: String(e.title || "未命名页面"),
116
- icon: e.icon ? String(e.icon) : void 0
117
- };
118
- }
119
- function Je(e) {
120
- let t = /* @__PURE__ */ new Set();
121
- return e.filter((e) => t.has(e.path) ? !1 : (t.add(e.path), !0));
122
- }
123
- function Ye(e) {
124
- return {
125
- tabs: e.tabs.map((e) => ({
126
- path: e.path,
127
- fullPath: e.fullPath,
128
- title: e.title,
129
- icon: e.icon
130
- })),
131
- activeTab: e.activeTab,
132
- lastActiveTab: e.lastActiveTab
133
- };
134
- }
135
- var Q = J("tabs", () => {
136
- let e = R([Z()]), t = R(X), n = R(""), r = R(!1), i = T(() => e.value.map((e) => e.path));
137
- async function a() {
138
- r.value && await o(We, Ye({
139
- tabs: e.value,
140
- activeTab: t.value,
141
- lastActiveTab: n.value
142
- }));
143
- }
144
- async function l() {
145
- if (r.value) return;
146
- let i = Ke(await s(We, null));
147
- e.value = i.tabs, t.value = i.activeTab, n.value = i.lastActiveTab, r.value = !0, await a();
148
- }
149
- async function u(r) {
150
- t.value && t.value !== r.path && (n.value = t.value), t.value = r.path;
151
- let i = e.value.find((e) => e.path === r.path);
152
- if (i) {
153
- i.fullPath = r.fullPath, i.title = r.title, i.icon = r.icon, await a();
154
- return;
155
- }
156
- e.value.push(r), b(), await a();
157
- }
158
- async function d(t) {
159
- if (t === "/dashboard") return;
160
- let r = e.value.findIndex((e) => e.path === t);
161
- r >= 0 && e.value.splice(r, 1), n.value === t && (n.value = ""), b(), await a();
162
- }
163
- async function f(t) {
164
- e.value = x(t), await a();
165
- }
166
- async function p(t) {
167
- e.value = x(e.value.filter((e) => e.path === t || e.path === "/dashboard")), y(), await a();
168
- }
169
- async function m(t) {
170
- let n = e.value.findIndex((e) => e.path === t);
171
- n > 0 && (e.value = x(e.value.slice(n)), y(), await a());
172
- }
173
- async function h(t) {
174
- let n = e.value.findIndex((e) => e.path === t);
175
- n >= 0 && (e.value = x(e.value.slice(0, n + 1)), y(), await a());
176
- }
177
- async function g() {
178
- e.value = [Z()], t.value = X, n.value = "", await a();
179
- }
180
- async function _() {
181
- e.value = [], t.value = "", n.value = "", await c(We);
182
- }
183
- async function v(e) {
184
- t.value && t.value !== e && (n.value = t.value), t.value = e, await a();
185
- }
186
- function y() {
187
- n.value && !e.value.some((e) => e.path === n.value) && (n.value = "");
188
- }
189
- function b() {
190
- e.value = x(e.value);
191
- }
192
- function x(e) {
193
- return Je([Z(), ...e.filter((e) => e.path !== X)]);
194
- }
195
- return {
196
- activeTab: t,
197
- closeAllTabs: g,
198
- closeLeftTabs: m,
199
- closeOtherTabs: p,
200
- closeRightTabs: h,
201
- initializeTabs: l,
202
- lastActiveTab: n,
203
- removeTab: d,
204
- reorderTabs: f,
205
- resetTabs: _,
206
- setActiveTab: v,
207
- syncTab: u,
208
- tabPaths: i,
209
- tabs: e
210
- };
211
- }), Xe = ["src", "alt"], Ze = /* @__PURE__ */ N({
212
- __name: "ThemedSvgImage",
213
- props: {
214
- src: {},
215
- primaryColor: {},
216
- alt: { default: "" }
217
- },
218
- setup(e) {
219
- let t = e, n = /* @__PURE__ */ new Map(), r = R(t.src);
220
- async function i(e) {
221
- let t = n.get(e);
222
- if (t) return t;
223
- let r = await fetch(e);
224
- if (!r.ok) throw Error(`Failed to load SVG: ${e}`);
225
- let i = await r.text();
226
- return n.set(e, i), i;
227
- }
228
- function a(e, t) {
229
- let n = e.replaceAll("#409EFF", t);
230
- return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(n)}`;
231
- }
232
- return G((e) => {
233
- let n = !1, o = t.src, s = t.primaryColor;
234
- r.value = o, i(o).then((e) => {
235
- n || (r.value = a(e, s));
236
- }).catch(() => {
237
- n || (r.value = o);
238
- }), e(() => {
239
- n = !0;
240
- });
241
- }), (t, n) => (L(), k("img", {
242
- src: r.value,
243
- alt: e.alt
244
- }, null, 8, Xe));
245
- }
246
- }), Qe = "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", $e = "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", et = "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", tt = "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", nt = "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", rt = "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", it = { class: "settings-section" }, at = { class: "settings-mode-grid" }, ot = ["onClick"], st = { class: "settings-section" }, ct = {
247
- key: 0,
248
- class: "settings-section__header"
249
- }, lt = {
250
- key: 1,
251
- class: "settings-position-grid"
252
- }, ut = ["onClick"], dt = { class: "settings-position-card__label" }, ft = { class: "settings-section" }, pt = { class: "settings-color-grid" }, mt = ["onClick"], ht = { class: "settings-color-card__label" }, gt = { class: "settings-color-card__swatch settings-color-card__swatch--custom" }, _t = { class: "settings-section" }, vt = { class: "settings-layout-grid" }, yt = ["onClick"], bt = { class: "settings-layout-card__label" }, xt = { class: "settings-section" }, St = { class: "settings-inline-setting" }, Ct = {
253
- key: 0,
254
- class: "settings-section"
255
- }, wt = { class: "settings-menu-search-grid" }, Tt = ["onClick"], Et = { class: "settings-placeholder" }, Dt = { class: "settings-placeholder" }, Ot = /* @__PURE__ */ N({
256
- __name: "SystemSettingsDrawer",
257
- setup(e) {
258
- let t = f(), n = T(() => !u.some((e) => e.value.toLowerCase() === t.themeColor.toLowerCase())), r = [
259
- {
260
- label: "浅色",
261
- value: "light",
262
- icon: Ce
263
- },
264
- {
265
- label: "深色",
266
- value: "dark",
267
- icon: ye
268
- },
269
- {
270
- label: "跟随系统",
271
- value: "system",
272
- icon: ve
273
- }
274
- ], i = [
275
- {
276
- label: "不应用",
277
- value: "none",
278
- previewSrc: nt
279
- },
280
- {
281
- label: "顶部",
282
- value: "header",
283
- previewSrc: tt
284
- },
285
- {
286
- label: "侧边栏",
287
- value: "sidebar",
288
- previewSrc: rt
289
- }
290
- ], a = [
291
- {
292
- label: "默认",
293
- value: "default",
294
- previewSrc: nt
295
- },
296
- {
297
- label: "侧边导航",
298
- value: "side",
299
- previewSrc: $e
300
- },
301
- {
302
- label: "顶部导航",
303
- value: "top",
304
- previewSrc: et
305
- },
306
- {
307
- label: "混合导航",
308
- value: "mix",
309
- previewSrc: Qe
310
- }
311
- ], o = [{
312
- label: "顶部搜索",
313
- value: "header",
314
- icon: Y
315
- }, {
316
- label: "侧边搜索",
317
- value: "sidebar",
318
- icon: be
319
- }];
320
- function s(e) {
321
- e && t.setThemeColor(e);
322
- }
323
- function c(e) {
324
- e || t.closeSettings();
325
- }
326
- return (e, l) => {
327
- let d = B("el-icon"), f = B("el-color-picker"), p = B("el-tab-pane"), m = B("el-switch"), h = B("el-empty"), g = B("el-tabs");
328
- return L(), D(U(De), {
329
- "model-value": U(t).settingsVisible,
330
- title: "主题设置",
331
- direction: "rtl",
332
- size: "380px",
333
- class: "settings-drawer",
334
- "show-footer": !1,
335
- "onUpdate:modelValue": c
336
- }, {
337
- default: K(() => [M(g, {
338
- modelValue: U(t).settingsActiveTab,
339
- "onUpdate:modelValue": l[0] ||= (e) => U(t).settingsActiveTab = e,
340
- class: "settings-tabs"
341
- }, {
342
- default: K(() => [
343
- M(p, {
344
- label: "外观",
345
- name: "theme"
346
- }, {
347
- default: K(() => [
348
- A("div", it, [l[1] ||= A("div", { class: "settings-section__header" }, [A("span", { class: "settings-section__title" }, "主题模式"), A("span", { class: "settings-section__desc" }, "选择浅色、深色或跟随系统")], -1), A("div", at, [(L(), k(x, null, z(r, (e) => A("button", {
349
- key: e.value,
350
- type: "button",
351
- class: F(["settings-mode-card", { "is-active": U(t).themeMode === e.value }]),
352
- onClick: (n) => U(t).setThemeMode(e.value)
353
- }, [M(d, { size: 20 }, {
354
- default: K(() => [(L(), D(V(e.icon)))]),
355
- _: 2
356
- }, 1024), A("strong", null, H(e.label), 1)], 10, ot)), 64))])]),
357
- A("div", st, [U(t).isDark ? O("", !0) : (L(), k("div", ct, [...l[2] ||= [A("span", { class: "settings-section__title" }, "主题色应用", -1), A("span", { class: "settings-section__desc" }, "选择主题色应用位置", -1)]])), U(t).isDark ? O("", !0) : (L(), k("div", lt, [(L(), k(x, null, z(i, (e) => A("button", {
358
- key: e.value,
359
- type: "button",
360
- class: F(["settings-position-card", { "is-active": U(t).themeColorPosition === e.value }]),
361
- onClick: (n) => U(t).setThemeColorPosition(e.value)
362
- }, [M(Ze, {
363
- class: "settings-position-card__preview",
364
- src: e.previewSrc,
365
- "primary-color": U(t).themeColor
366
- }, null, 8, ["src", "primary-color"]), A("span", dt, H(e.label), 1)], 10, ut)), 64))]))]),
367
- A("div", ft, [l[4] ||= A("div", { class: "settings-section__header" }, [A("span", { class: "settings-section__title" }, "主题色"), A("span", { class: "settings-section__desc" }, "选择系统主题颜色")], -1), A("div", pt, [(L(!0), k(x, null, z(U(u), (e) => (L(), k("button", {
368
- key: e.value,
369
- type: "button",
370
- class: F(["settings-color-card", { "is-active": U(t).themeColor === e.value }]),
371
- onClick: (n) => U(t).setThemeColor(e.value)
372
- }, [A("span", {
373
- class: "settings-color-card__swatch",
374
- style: I({ backgroundColor: e.value })
375
- }, null, 4), A("span", ht, H(e.label), 1)], 10, mt))), 128)), A("div", { class: F(["settings-color-card settings-color-card--custom", { "is-active": n.value }]) }, [
376
- M(f, {
377
- class: "settings-color-card__picker",
378
- "model-value": U(t).themeColor,
379
- "onUpdate:modelValue": s
380
- }, null, 8, ["model-value"]),
381
- A("span", gt, [M(d, { size: 18 }, {
382
- default: K(() => [M(U(le))]),
383
- _: 1
384
- })]),
385
- l[3] ||= A("span", { class: "settings-color-card__label" }, "自定义", -1)
386
- ], 2)])])
387
- ]),
388
- _: 1
389
- }),
390
- M(p, {
391
- label: "布局",
392
- name: "layout"
393
- }, {
394
- default: K(() => [
395
- A("div", _t, [l[5] ||= A("div", { class: "settings-section__header" }, [A("span", { class: "settings-section__title" }, "布局模式"), A("span", { class: "settings-section__desc" }, "切换侧边、顶部或混合导航")], -1), A("div", vt, [(L(), k(x, null, z(a, (e) => A("button", {
396
- key: e.value,
397
- type: "button",
398
- class: F(["settings-layout-card", { "is-active": U(t).layoutMode === e.value }]),
399
- onClick: (n) => U(t).setLayoutMode(e.value)
400
- }, [M(Ze, {
401
- class: "settings-layout-card__preview",
402
- src: e.previewSrc,
403
- "primary-color": U(t).themeColor
404
- }, null, 8, ["src", "primary-color"]), A("span", bt, H(e.label), 1)], 10, yt)), 64))])]),
405
- A("div", xt, [A("div", St, [l[6] ||= A("div", null, [A("strong", null, "默认折叠侧边栏"), A("p", null, "适合屏幕较窄或想保留更多内容区空间")], -1), M(m, {
406
- "model-value": U(t).sidebarCollapsed,
407
- "onUpdate:modelValue": U(t).setSidebarCollapsed
408
- }, null, 8, ["model-value", "onUpdate:modelValue"])])]),
409
- U(t).layoutMode === "top" ? O("", !0) : (L(), k("div", Ct, [l[7] ||= A("div", { class: "settings-section__header" }, [A("span", { class: "settings-section__title" }, "菜单搜索位置"), A("span", { class: "settings-section__desc" }, "顶部或侧边栏顶部搜索")], -1), A("div", wt, [(L(), k(x, null, z(o, (e) => A("button", {
410
- key: e.value,
411
- type: "button",
412
- class: F(["settings-mode-card", { "is-active": U(t).menuSearchPlacement === e.value }]),
413
- onClick: (n) => U(t).setMenuSearchPlacement(e.value)
414
- }, [M(d, { size: 20 }, {
415
- default: K(() => [(L(), D(V(e.icon)))]),
416
- _: 2
417
- }, 1024), A("strong", null, H(e.label), 1)], 10, Tt)), 64))])]))
418
- ]),
419
- _: 1
420
- }),
421
- M(p, {
422
- label: "快捷键",
423
- name: "shortcut"
424
- }, {
425
- default: K(() => [A("div", Et, [M(h, { description: "快捷键配置稍后接入,这里先预留入口。" })])]),
426
- _: 1
427
- }),
428
- M(p, {
429
- label: "通用",
430
- name: "general"
431
- }, {
432
- default: K(() => [A("div", Dt, [M(h, { description: "通用设置稍后扩展,这里先保留结构。" })])]),
433
- _: 1
434
- })
435
- ]),
436
- _: 1
437
- }, 8, ["modelValue"])]),
438
- _: 1
439
- }, 8, ["model-value"]);
440
- };
441
- }
442
- }), kt = /* @__PURE__ */ N({
443
- __name: "AppContentView",
444
- props: { refreshKey: {} },
445
- setup(e) {
446
- return (t, n) => {
447
- let r = B("router-view"), i = B("el-main");
448
- return L(), D(i, { class: "app-layout__main" }, {
449
- default: K(() => [M(r, null, {
450
- default: K(({ Component: t, route: n }) => [(L(), D(V(t), { key: `${n.fullPath}:${e.refreshKey}` }))]),
451
- _: 1
452
- })]),
453
- _: 1
454
- });
455
- };
456
- }
457
- }), At = ["title"], jt = /* @__PURE__ */ p(/* @__PURE__ */ N({
458
- __name: "ThemeToggleButton",
459
- setup(e) {
460
- let t = f();
461
- async function n(e) {
462
- await d(e, () => {
463
- t.toggleDarkMode();
464
- });
465
- }
466
- return (e, r) => {
467
- let i = B("el-icon");
468
- return L(), k("button", {
469
- type: "button",
470
- class: "app-layout__header-tool-btn theme-icon-btn",
471
- title: U(t).isDark ? "切换浅色模式" : "切换深色模式",
472
- onClick: n
473
- }, [M(i, { size: 20 }, {
474
- default: K(() => [(L(), D(V(U(t).isDark ? U(Ce) : U(ye))))]),
475
- _: 1
476
- })], 8, At);
477
- };
478
- }
479
- }), [["__scopeId", "data-v-73aaf569"]]);
480
- //#endregion
481
- //#region src/main/layouts/composables/useAppMenus.ts
482
- function Mt() {
483
- let e = g(), t = _(), n = f(), r = a(), i = T(() => Nt(t.options.routes.find((e) => e.path === "/")?.children ?? [], "", r.hasPermission)), o = T(() => i.value), s = T(() => n.isMobileViewport || n.layoutMode !== "mix" ? i.value : i.value.find((e) => e.fullPath === n.selectedTopMenuPath)?.children ?? []), c = T(() => Pt(i.value).filter((e) => !e.children?.length)), l = T(() => Pt(s.value).filter((e) => !e.children?.length));
484
- return {
485
- activeMenu: T(() => e.path),
486
- activeTopMenuPath: T(() => {
487
- let t = e.path;
488
- return o.value.find((e) => t === e.fullPath || t.startsWith(`${e.fullPath}/`))?.fullPath || n.selectedTopMenuPath;
489
- }),
490
- allMenus: i,
491
- flatMenus: c,
492
- flatSideMenus: l,
493
- findFirstLeafNode: Ft,
494
- findFirstLeafPath: It,
495
- sideMenus: s,
496
- topMenus: o
497
- };
498
- }
499
- function Nt(e, t, n) {
500
- return e.filter((e) => !e.meta?.hidden && Rt(e, n)).map((e) => {
501
- let r = Bt(e.path, t), i = e.children?.length ? Nt(e.children, r, n) : void 0;
502
- return {
503
- path: e.path,
504
- fullPath: r,
505
- title: String(e.meta?.title ?? e.name ?? "未命名菜单"),
506
- icon: e.meta?.icon ? String(e.meta.icon) : void 0,
507
- children: i
508
- };
509
- }).filter((t) => t.children?.length || !zt(e, t.path));
510
- }
511
- function Pt(e) {
512
- return e.flatMap((e) => [e, ...Pt(e.children ?? [])]);
513
- }
514
- function Ft(e) {
515
- if (!e.children?.length) return e;
516
- for (let t of e.children) {
517
- let e = Ft(t);
518
- if (e) return e;
519
- }
520
- return null;
521
- }
522
- function It(e, t, n = "") {
523
- for (let r of e) {
524
- let e = Bt(r.path, n);
525
- if (e === t) return Lt(r, n);
526
- if (r.children?.length) {
527
- let n = It(r.children, t, e);
528
- if (n) return n;
529
- }
530
- }
531
- return null;
532
- }
533
- function Lt(e, t) {
534
- let n = Bt(e.path, t);
535
- if (e.component) return n;
536
- let r = e.children ?? [];
537
- for (let e of r) {
538
- let t = Bt(e.path, n);
539
- if (e.component) return t;
540
- }
541
- for (let e of r) {
542
- let t = Lt(e, n);
543
- if (t) return t;
544
- }
545
- return null;
546
- }
547
- function Rt(e, t) {
548
- let n = e.meta?.permission;
549
- return n ? Array.isArray(n) ? n.every((e) => t(String(e))) : t(String(n)) : !0;
550
- }
551
- function zt(e, t) {
552
- let n = e.find((e) => e.path === t);
553
- return !!(n?.redirect && !n.component && !n.children?.length);
554
- }
555
- function Bt(e, t) {
556
- return e.startsWith("/") ? e : `${t}/${e}`.replace(/\/+/g, "/");
557
- }
558
- //#endregion
559
- //#region src/main/layouts/components/AppBrandLogo.vue?vue&type=script&setup=true&lang.ts
560
- var Vt = ["src", "alt"], Ht = ["src", "alt"], Ut = /* @__PURE__ */ p(/* @__PURE__ */ N({
561
- __name: "AppBrandLogo",
562
- props: {
563
- src: {},
564
- alt: {},
565
- textInverted: {
566
- type: Boolean,
567
- default: !1
568
- },
569
- width: { default: "158px" },
570
- height: { default: "40px" }
571
- },
572
- setup(e) {
573
- let t = e, n = T(() => ({
574
- "--app-brand-logo-width": t.width,
575
- "--app-brand-logo-height": t.height
576
- }));
577
- return (t, r) => (L(), k("span", {
578
- class: "app-brand-logo",
579
- style: I(n.value)
580
- }, [A("img", {
581
- src: e.src,
582
- alt: e.alt,
583
- class: F(["app-brand-logo__image", { "is-text-base": e.textInverted }])
584
- }, null, 10, Vt), e.textInverted ? (L(), k("img", {
585
- key: 0,
586
- src: e.src,
587
- alt: e.alt,
588
- class: "app-brand-logo__image app-brand-logo__image--text-inverted",
589
- "aria-hidden": "true"
590
- }, null, 8, Ht)) : O("", !0)], 4));
591
- }
592
- }), [["__scopeId", "data-v-a42b8639"]]), Wt = {
593
- Connection: de,
594
- House: _e,
595
- Setting: Se,
596
- User: Ee
597
- };
598
- function $(e) {
599
- return e ? Wt[e] ?? _e : _e;
600
- }
601
- //#endregion
602
- //#region src/main/layouts/components/AppHeaderMenuNode.vue
603
- var Gt = /* @__PURE__ */ N({
604
- name: "AppHeaderMenuNode",
605
- __name: "AppHeaderMenuNode",
606
- props: { node: {} },
607
- setup(e) {
608
- return (t, n) => {
609
- let r = B("el-icon"), i = B("AppHeaderMenuNode", !0), a = B("el-sub-menu"), o = B("el-menu-item");
610
- return e.node.children?.length ? (L(), D(a, {
611
- key: 0,
612
- index: e.node.fullPath
613
- }, {
614
- title: K(() => [e.node.icon ? (L(), D(r, { key: 0 }, {
615
- default: K(() => [(L(), D(V(U($)(e.node.icon))))]),
616
- _: 1
617
- })) : O("", !0), A("span", null, H(e.node.title), 1)]),
618
- default: K(() => [(L(!0), k(x, null, z(e.node.children, (e) => (L(), D(i, {
619
- key: e.fullPath,
620
- node: e
621
- }, null, 8, ["node"]))), 128))]),
622
- _: 1
623
- }, 8, ["index"])) : (L(), D(o, {
624
- key: 1,
625
- index: e.node.fullPath
626
- }, {
627
- default: K(() => [e.node.icon ? (L(), D(r, { key: 0 }, {
628
- default: K(() => [(L(), D(V(U($)(e.node.icon))))]),
629
- _: 1
630
- })) : O("", !0), A("span", null, H(e.node.title), 1)]),
631
- _: 1
632
- }, 8, ["index"]));
633
- };
634
- }
635
- }), Kt = "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", qt = { class: "app-menu-search-item__icon" }, Jt = { class: "app-menu-search-item__body" }, Yt = {
636
- key: 0,
637
- class: "app-menu-search-item__actions"
638
- }, Xt = { class: "app-menu-search-item__enter" }, Zt = ["src"], Qt = /* @__PURE__ */ N({
639
- __name: "AppMenuSearchItem",
640
- props: {
641
- active: { type: Boolean },
642
- item: {},
643
- removable: { type: Boolean }
644
- },
645
- emits: [
646
- "enter",
647
- "remove",
648
- "select"
649
- ],
650
- setup(e, { emit: t }) {
651
- let n = t;
652
- return (t, r) => {
653
- let i = B("el-icon");
654
- return L(), k("div", {
655
- class: F(["app-menu-search-item", { "is-active": e.active }]),
656
- onMouseenter: r[4] ||= (t) => n("enter", e.item)
657
- }, [A("div", {
658
- class: "app-menu-search-item__main",
659
- role: "button",
660
- tabindex: "0",
661
- onClick: r[1] ||= (t) => n("select", e.item),
662
- onKeydown: [r[2] ||= re(q((t) => n("select", e.item), ["prevent"]), ["enter"]), r[3] ||= re(q((t) => n("select", e.item), ["prevent"]), ["space"])]
663
- }, [
664
- A("span", qt, [M(i, null, {
665
- default: K(() => [(L(), D(V(U($)(e.item.icon))))]),
666
- _: 1
667
- })]),
668
- A("span", Jt, [A("strong", null, H(e.item.title), 1), A("span", null, H(e.item.fullPath), 1)]),
669
- M(C, { name: "app-menu-search-actions" }, {
670
- default: K(() => [e.active ? (L(), k("span", Yt, [A("span", Xt, [A("img", {
671
- src: U(Kt),
672
- alt: "",
673
- "aria-hidden": "true"
674
- }, null, 8, Zt)]), e.removable ? (L(), k("button", {
675
- key: 0,
676
- class: "app-menu-search-item__remove",
677
- type: "button",
678
- "aria-label": "删除搜索历史",
679
- onClick: r[0] ||= q((t) => n("remove", e.item), ["stop"])
680
- }, [M(i, null, {
681
- default: K(() => [M(U(ue))]),
682
- _: 1
683
- })])) : O("", !0)])) : O("", !0)]),
684
- _: 1
685
- })
686
- ], 32)], 34);
687
- };
688
- }
689
- }), $t = { class: "app-menu-search__control" }, en = {
690
- key: 0,
691
- class: "app-menu-search__section"
692
- }, tn = {
693
- key: 1,
694
- class: "app-menu-search__section"
695
- }, nn = {
696
- key: 2,
697
- class: "app-menu-search__empty"
698
- }, rn = { class: "app-menu-search__footer" }, an = "menu-search-history", on = 8, sn = 70, cn = 28, ln = 520, un = /* @__PURE__ */ N({
699
- __name: "AppMenuSearch",
700
- props: { modelValue: { type: Boolean } },
701
- emits: ["update:modelValue"],
702
- setup(e, { emit: t }) {
703
- let n = e, r = t, i = _(), { flatMenus: a } = Mt(), o = R(), s = R(), c = R(""), l = R(0), u = R(null), d = R(V()), f = T(() => c.value.trim().toLowerCase()), p = T(() => f.value ? a.value.filter((e) => {
704
- let t = e.title.toLowerCase(), n = e.fullPath.toLowerCase();
705
- return t.includes(f.value) || n.includes(f.value);
706
- }) : []), m = T(() => c.value ? p.value : d.value), h = T(() => c.value ? !p.value.length : !d.value.length);
707
- W(() => n.modelValue, (e) => {
708
- if (!e) {
709
- J();
710
- return;
711
- }
712
- d.value = V(), c.value = "", u.value = d.value[0] ?? null, l.value = 0, document.body.classList.add("app-menu-search-open"), ie(), P(() => {
713
- o.value?.focus?.(), s.value?.setScrollTop?.(0);
714
- });
715
- }), W(p, (e) => {
716
- u.value = e[0] ?? null, s.value?.setScrollTop?.(0);
717
- }), ee(() => {
718
- J();
719
- });
720
- function g() {
721
- r("update:modelValue", !1), J();
722
- }
723
- function v(e) {
724
- u.value = e;
725
- }
726
- function y(e) {
727
- ne(e), g(), i.push(e.fullPath);
728
- }
729
- function b(e) {
730
- let t = d.value.filter((t) => t.fullPath !== e.fullPath);
731
- G(t), u.value?.fullPath === e.fullPath && (u.value = t[0] ?? null);
732
- }
733
- function E() {
734
- G([]), u.value = null;
735
- }
736
- function N(e) {
737
- l.value = e.scrollTop;
738
- }
739
- function F(e) {
740
- if (n.modelValue && !e.isComposing) {
741
- if (e.code === "Escape") {
742
- e.preventDefault(), g();
743
- return;
744
- }
745
- if (e.code === "Enter" && u.value) {
746
- e.preventDefault(), y(u.value);
747
- return;
748
- }
749
- (e.code === "ArrowDown" || e.code === "ArrowUp") && (e.preventDefault(), I(e.code === "ArrowDown" ? 1 : -1));
750
- }
751
- }
752
- function I(e) {
753
- let t = m.value;
754
- if (!t.length) return;
755
- let n = re((u.value ? t.findIndex((e) => e.fullPath === u.value?.fullPath) : -1) + e, 0, t.length - 1), r = t[n];
756
- r && (u.value = r, te(n));
757
- }
758
- function te(e) {
759
- let t = cn + e * sn, n = l.value, r = l.value + ln - sn;
760
- t < n ? s.value?.setScrollTop?.(t) : t > r && s.value?.setScrollTop?.(t - ln + sn);
761
- }
762
- function ne(e) {
763
- G([e, ...d.value.filter((t) => t.fullPath !== e.fullPath)].slice(0, on));
764
- }
765
- function V() {
766
- try {
767
- let e = localStorage.getItem(an);
768
- if (!e) return [];
769
- let t = JSON.parse(e), n = new Set(a.value.map((e) => e.fullPath));
770
- return t.filter((e) => n.has(e.fullPath));
771
- } catch {
772
- return [];
773
- }
774
- }
775
- function G(e) {
776
- if (d.value = e, !e.length) {
777
- localStorage.removeItem(an);
778
- return;
779
- }
780
- localStorage.setItem(an, JSON.stringify(e));
781
- }
782
- function re(e, t, n) {
783
- return Math.min(Math.max(e, t), n);
784
- }
785
- function ie() {
786
- window.removeEventListener("keydown", F, !0), window.addEventListener("keydown", F, !0);
787
- }
788
- function J() {
789
- document.body.classList.remove("app-menu-search-open"), window.removeEventListener("keydown", F, !0);
790
- }
791
- return (t, n) => {
792
- let r = B("el-icon"), i = B("el-input"), a = B("el-scrollbar");
793
- return L(), D(S, { to: "body" }, [M(C, { name: "app-menu-search-fade" }, {
794
- default: K(() => [e.modelValue ? (L(), k("section", {
795
- key: 0,
796
- class: "app-menu-search",
797
- tabindex: "-1",
798
- onClick: q(g, ["self"])
799
- }, [A("div", {
800
- class: "app-menu-search__panel",
801
- onClick: n[1] ||= q(() => {}, ["stop"])
802
- }, [
803
- A("div", $t, [M(i, {
804
- ref_key: "searchInputRef",
805
- ref: o,
806
- modelValue: c.value,
807
- "onUpdate:modelValue": n[0] ||= (e) => c.value = e,
808
- size: "large",
809
- placeholder: "搜索页面名称或路径",
810
- clearable: ""
811
- }, {
812
- prefix: K(() => [M(r, null, {
813
- default: K(() => [M(U(Y))]),
814
- _: 1
815
- })]),
816
- _: 1
817
- }, 8, ["modelValue"])]),
818
- M(a, {
819
- ref_key: "scrollbarRef",
820
- ref: s,
821
- class: "app-menu-search__scroll",
822
- "max-height": "520px",
823
- onScroll: N
824
- }, {
825
- default: K(() => [
826
- p.value.length ? (L(), k("div", en, [n[2] ||= A("div", { class: "app-menu-search__section-title" }, "页面", -1), M(w, {
827
- name: "app-menu-search-list",
828
- tag: "div",
829
- class: "app-menu-search__list"
830
- }, {
831
- default: K(() => [(L(!0), k(x, null, z(p.value, (e) => (L(), D(Qt, {
832
- key: e.fullPath,
833
- active: u.value?.fullPath === e.fullPath,
834
- item: e,
835
- onEnter: v,
836
- onSelect: y
837
- }, null, 8, ["active", "item"]))), 128))]),
838
- _: 1
839
- })])) : O("", !0),
840
- !c.value && d.value.length ? (L(), k("div", tn, [A("div", { class: "app-menu-search__section-header" }, [n[3] ||= A("div", { class: "app-menu-search__section-title" }, "搜索历史", -1), A("button", {
841
- class: "app-menu-search__clear",
842
- type: "button",
843
- onClick: E
844
- }, " 清空 ")]), M(w, {
845
- name: "app-menu-search-list",
846
- tag: "div",
847
- class: "app-menu-search__list"
848
- }, {
849
- default: K(() => [(L(!0), k(x, null, z(d.value, (e) => (L(), D(Qt, {
850
- key: e.fullPath,
851
- active: u.value?.fullPath === e.fullPath,
852
- item: e,
853
- removable: "",
854
- onEnter: v,
855
- onRemove: b,
856
- onSelect: y
857
- }, null, 8, ["active", "item"]))), 128))]),
858
- _: 1
859
- })])) : O("", !0),
860
- h.value ? (L(), k("div", nn, H(c.value ? "没有匹配的页面" : "没有搜索历史"), 1)) : O("", !0)
861
- ]),
862
- _: 1
863
- }, 512),
864
- A("div", rn, [
865
- n[5] ||= A("span", null, [A("kbd", null, "Enter"), j("选择")], -1),
866
- A("span", null, [
867
- M(r, null, {
868
- default: K(() => [M(U(ae))]),
869
- _: 1
870
- }),
871
- M(r, null, {
872
- default: K(() => [M(U(se))]),
873
- _: 1
874
- }),
875
- n[4] ||= j("切换", -1)
876
- ]),
877
- n[6] ||= A("span", null, [A("kbd", null, "Esc"), j("关闭")], -1)
878
- ])
879
- ])])) : O("", !0)]),
880
- _: 1
881
- })]);
882
- };
883
- }
884
- });
885
- //#endregion
886
- //#region src/main/layouts/composables/useShortcutLabel.ts
887
- function dn() {
888
- let e = T(() => typeof navigator > "u" ? !1 : /Mac|iPhone|iPad|iPod/i.test(navigator.platform));
889
- return {
890
- isMac: e,
891
- searchShortcutLabel: T(() => e.value ? "⌘ K" : "Ctrl K")
892
- };
893
- }
894
- //#endregion
895
- //#region src/main/layouts/components/AppMenuSearchTrigger.vue?vue&type=script&setup=true&lang.ts
896
- var fn = { class: "app-menu-search-trigger__shortcut" }, pn = /* @__PURE__ */ N({
897
- __name: "AppMenuSearchTrigger",
898
- props: { layoutMode: {} },
899
- emits: ["open"],
900
- setup(e, { emit: t }) {
901
- let n = t, { searchShortcutLabel: r } = dn();
902
- return (t, i) => {
903
- let a = B("el-icon");
904
- return L(), k("button", {
905
- class: F(["app-menu-search-trigger", `app-menu-search-trigger--${e.layoutMode}`]),
906
- type: "button",
907
- "aria-label": "搜索页面",
908
- onClick: i[0] ||= (e) => n("open")
909
- }, [
910
- M(a, null, {
911
- default: K(() => [M(U(Y))]),
912
- _: 1
913
- }),
914
- i[1] ||= A("span", { class: "app-menu-search-trigger__text" }, "搜索页面", -1),
915
- A("span", fn, H(U(r)), 1)
916
- ], 2);
917
- };
918
- }
919
- }), mn = { class: "app-layout__header-left" }, hn = {
920
- key: 0,
921
- class: "app-layout__header-brand"
922
- }, gn = ["title", "aria-label"], _n = { class: "app-layout__header-right" }, vn = { class: "app-layout__user" }, yn = { class: "app-layout__user-copy" }, bn = /* @__PURE__ */ N({
923
- __name: "AppHeader",
924
- props: { breadcrumbItems: {} },
925
- setup(e) {
926
- let t = e, n = f(), r = a(), i = l(), o = Q(), s = _(), c = g(), u = R(!1), { activeTopMenuPath: d, findFirstLeafNode: p, findFirstLeafPath: m, topMenus: h } = Mt(), v = T(() => n.themeColorPosition === "header" || n.isDark), y = T(() => v.value ? i.logoHeader : i.logoExpanded), b = T(() => v.value && y.value === i.logoExpanded);
927
- te(() => {
928
- window.addEventListener("keydown", P, { capture: !0 });
929
- }), ee(() => {
930
- window.removeEventListener("keydown", P, { capture: !0 });
931
- });
932
- function S(e, n) {
933
- if (n !== t.breadcrumbItems.length - 1) return m(s.options.routes, e.path) || e.path || "/";
934
- }
935
- async function C() {
936
- await o.resetTabs(), n.setSelectedTopMenuPath(""), await r.logout(), s.push("/login");
937
- }
938
- function w(e) {
939
- s.push(e);
940
- }
941
- function E(e) {
942
- let t = h.value.find((t) => t.fullPath === e);
943
- if (!t) return;
944
- n.setSelectedTopMenuPath(t.fullPath);
945
- let r = p(t)?.fullPath || t.fullPath;
946
- s.push(r);
947
- }
948
- function N() {
949
- u.value = !0;
950
- }
951
- function P(e) {
952
- e.defaultPrevented || e.repeat || u.value || !(/Mac|iPhone|iPad|iPod/i.test(navigator.platform) ? e.metaKey : e.ctrlKey) || e.code !== "KeyK" || (e.preventDefault(), N());
953
- }
954
- return (t, a) => {
955
- let o = B("el-icon"), s = B("el-menu"), l = B("el-menu-item"), f = B("el-breadcrumb-item"), p = B("el-breadcrumb"), m = B("el-avatar"), g = B("el-dropdown-item"), _ = B("el-dropdown-menu"), v = B("el-dropdown"), T = B("el-header");
956
- return L(), k(x, null, [M(T, { class: "app-layout__header" }, {
957
- default: K(() => [
958
- A("div", mn, [
959
- U(n).layoutMode === "default" || U(n).layoutMode === "top" ? (L(), k("div", hn, [M(Ut, {
960
- src: y.value,
961
- alt: U(i).systemName,
962
- "text-inverted": b.value
963
- }, null, 8, [
964
- "src",
965
- "alt",
966
- "text-inverted"
967
- ])])) : O("", !0),
968
- U(n).layoutMode !== "top" || U(n).isMobileViewport ? (L(), k("button", {
969
- key: 1,
970
- type: "button",
971
- class: "app-layout__header-tool-btn app-layout__header-tool-btn--collapse",
972
- title: U(n).isMobileViewport ? "打开菜单" : U(n).sidebarCollapsed ? "展开侧边栏" : "折叠侧边栏",
973
- "aria-label": U(n).isMobileViewport ? "打开菜单" : U(n).sidebarCollapsed ? "展开侧边栏" : "折叠侧边栏",
974
- onClick: a[0] ||= (e) => U(n).toggleSidebar()
975
- }, [M(o, null, {
976
- default: K(() => [(L(), D(V(U(n).sidebarCollapsed && !U(n).isMobileViewport ? U(me) : U(he))))]),
977
- _: 1
978
- })], 8, gn)) : O("", !0),
979
- U(n).layoutMode === "top" && !U(n).isMobileViewport ? (L(), D(s, {
980
- key: 2,
981
- mode: "horizontal",
982
- ellipsis: !1,
983
- "default-active": U(c).path,
984
- class: "app-layout__header-menu",
985
- onSelect: w
986
- }, {
987
- default: K(() => [(L(!0), k(x, null, z(U(h), (e) => (L(), D(Gt, {
988
- key: e.fullPath,
989
- node: e
990
- }, null, 8, ["node"]))), 128))]),
991
- _: 1
992
- }, 8, ["default-active"])) : U(n).layoutMode === "mix" && !U(n).isMobileViewport ? (L(), D(s, {
993
- key: 3,
994
- mode: "horizontal",
995
- ellipsis: !1,
996
- "default-active": U(d),
997
- class: "app-layout__header-menu app-layout__header-menu--mix",
998
- onSelect: E
999
- }, {
1000
- default: K(() => [(L(!0), k(x, null, z(U(h), (e) => (L(), D(l, {
1001
- key: e.fullPath,
1002
- index: e.fullPath
1003
- }, {
1004
- default: K(() => [j(H(e.title), 1)]),
1005
- _: 2
1006
- }, 1032, ["index"]))), 128))]),
1007
- _: 1
1008
- }, 8, ["default-active"])) : O("", !0),
1009
- U(n).layoutMode === "default" || U(n).layoutMode === "side" ? (L(), D(p, {
1010
- key: 4,
1011
- "separator-icon": U(oe)
1012
- }, {
1013
- default: K(() => [(L(!0), k(x, null, z(e.breadcrumbItems, (e, t) => (L(), D(f, {
1014
- key: e.path || String(e.name),
1015
- to: S(e, t)
1016
- }, {
1017
- default: K(() => [j(H(e.meta.title), 1)]),
1018
- _: 2
1019
- }, 1032, ["to"]))), 128))]),
1020
- _: 1
1021
- }, 8, ["separator-icon"])) : O("", !0)
1022
- ]),
1023
- U(n).layoutMode !== "mix" && !U(n).isSidebarMenuSearch ? (L(), k("div", {
1024
- key: 0,
1025
- class: F(["app-layout__header-search", `app-layout__header-search--${U(n).layoutMode}`])
1026
- }, [M(pn, {
1027
- "layout-mode": U(n).layoutMode,
1028
- onOpen: N
1029
- }, null, 8, ["layout-mode"])], 2)) : O("", !0),
1030
- A("div", _n, [
1031
- U(n).layoutMode === "mix" && !U(n).isSidebarMenuSearch ? (L(), D(pn, {
1032
- key: 0,
1033
- "layout-mode": U(n).layoutMode,
1034
- onOpen: N
1035
- }, null, 8, ["layout-mode"])) : O("", !0),
1036
- A("button", {
1037
- type: "button",
1038
- class: "app-layout__header-tool-btn",
1039
- title: "主题设置",
1040
- onClick: a[1] ||= (e) => U(n).openSettings("theme")
1041
- }, [M(o, {
1042
- size: 18,
1043
- class: "app-layout__header-tool-icon"
1044
- }, {
1045
- default: K(() => [M(U(le))]),
1046
- _: 1
1047
- })]),
1048
- M(jt),
1049
- M(v, { onCommand: C }, {
1050
- dropdown: K(() => [M(_, null, {
1051
- default: K(() => [M(g, { disabled: "" }, {
1052
- default: K(() => [M(o, null, {
1053
- default: K(() => [M(U(Se))]),
1054
- _: 1
1055
- }), a[3] ||= j(" 个人设置 ", -1)]),
1056
- _: 1
1057
- }), M(g, { command: "logout" }, {
1058
- default: K(() => [M(o, null, {
1059
- default: K(() => [M(U(we))]),
1060
- _: 1
1061
- }), a[4] ||= j(" 退出登录 ", -1)]),
1062
- _: 1
1063
- })]),
1064
- _: 1
1065
- })]),
1066
- default: K(() => [A("div", vn, [
1067
- M(m, { size: 32 }, {
1068
- default: K(() => [j(H(U(r).userName.slice(0, 1)), 1)]),
1069
- _: 1
1070
- }),
1071
- A("div", yn, [A("strong", null, H(U(r).userName), 1), A("span", null, H(U(r).userRoleLabel), 1)]),
1072
- M(o, null, {
1073
- default: K(() => [M(U(ae))]),
1074
- _: 1
1075
- })
1076
- ])]),
1077
- _: 1
1078
- })
1079
- ])
1080
- ]),
1081
- _: 1
1082
- }), M(un, {
1083
- modelValue: u.value,
1084
- "onUpdate:modelValue": a[2] ||= (e) => u.value = e
1085
- }, null, 8, ["modelValue"])], 64);
1086
- };
1087
- }
1088
- });
1089
- //#endregion
1090
- //#region src/main/layouts/utils/menuSearch.ts
1091
- function xn(e, t) {
1092
- let n = t.trim().toLowerCase();
1093
- if (!n) return [...e];
1094
- let r = [];
1095
- for (let t of e) {
1096
- let e = xn(t.children ?? [], n);
1097
- !(wn(t) && Cn(t, n)) && !e.length || r.push({
1098
- ...t,
1099
- children: e.length ? e : void 0
1100
- });
1101
- }
1102
- return r;
1103
- }
1104
- function Sn(e, t) {
1105
- let n = Tn(e), r = t.trim();
1106
- if (!r) return n;
1107
- let i = Array.from(e), a = e.toLowerCase(), o = r.toLowerCase(), s = a.indexOf(o);
1108
- return s < 0 ? n : `${Tn(i.slice(0, s).join(""))}<mark class="app-menu-search-highlight">${Tn(i.slice(s, s + r.length).join(""))}</mark>${Tn(i.slice(s + r.length).join(""))}`;
1109
- }
1110
- function Cn(e, t) {
1111
- return e.title.toLowerCase().includes(t);
1112
- }
1113
- function wn(e) {
1114
- return !e.children?.length;
1115
- }
1116
- function Tn(e) {
1117
- return e.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll("\"", "&quot;").replaceAll("'", "&#39;");
1118
- }
1119
- //#endregion
1120
- //#region src/main/layouts/components/AppSidebarSearch.vue?vue&type=script&setup=true&lang.ts
1121
- var En = {
1122
- key: 0,
1123
- class: "app-sidebar-search"
1124
- }, Dn = /* @__PURE__ */ N({
1125
- __name: "AppSidebarSearch",
1126
- props: {
1127
- collapsed: { type: Boolean },
1128
- keyword: {}
1129
- },
1130
- emits: ["update:keyword"],
1131
- setup(e, { emit: t }) {
1132
- let n = t;
1133
- return (t, r) => {
1134
- let i = B("el-icon"), a = B("el-input");
1135
- return e.collapsed ? O("", !0) : (L(), k("div", En, [M(a, {
1136
- "model-value": e.keyword,
1137
- placeholder: "搜索菜单",
1138
- clearable: "",
1139
- "onUpdate:modelValue": r[0] ||= (e) => n("update:keyword", e)
1140
- }, {
1141
- prefix: K(() => [M(i, null, {
1142
- default: K(() => [M(U(Y))]),
1143
- _: 1
1144
- })]),
1145
- _: 1
1146
- }, 8, ["model-value"])]));
1147
- };
1148
- }
1149
- }), On = ["innerHTML"], kn = ["innerHTML"], An = /* @__PURE__ */ N({
1150
- name: "AppSidebarNode",
1151
- __name: "AppSidebarNode",
1152
- props: {
1153
- node: {},
1154
- keyword: {}
1155
- },
1156
- setup(e) {
1157
- let t = e, n = T(() => Sn(t.node.title, t.keyword ?? ""));
1158
- return (t, r) => {
1159
- let i = B("el-icon"), a = B("AppSidebarNode", !0), o = B("el-sub-menu"), s = B("el-menu-item");
1160
- return e.node.children?.length ? (L(), D(o, {
1161
- key: 0,
1162
- index: e.node.fullPath
1163
- }, {
1164
- title: K(() => [M(i, null, {
1165
- default: K(() => [(L(), D(V(U($)(e.node.icon))))]),
1166
- _: 1
1167
- }), A("span", { innerHTML: n.value }, null, 8, On)]),
1168
- default: K(() => [(L(!0), k(x, null, z(e.node.children, (t) => (L(), D(a, {
1169
- key: t.fullPath,
1170
- node: t,
1171
- keyword: e.keyword
1172
- }, null, 8, ["node", "keyword"]))), 128))]),
1173
- _: 1
1174
- }, 8, ["index"])) : (L(), D(s, {
1175
- key: 1,
1176
- index: e.node.fullPath
1177
- }, {
1178
- default: K(() => [A("span", { innerHTML: n.value }, null, 8, kn)]),
1179
- _: 1
1180
- }, 8, ["index"]));
1181
- };
1182
- }
1183
- }), jn = {
1184
- key: 0,
1185
- class: "app-layout__brand"
1186
- }, Mn = /* @__PURE__ */ N({
1187
- name: "AppSidebar",
1188
- __name: "AppSidebar",
1189
- setup(e) {
1190
- let t = f(), n = l(), { activeMenu: r, sideMenus: i } = Mt(), a = R(""), o = T(() => t.themeColorPosition === "sidebar" || t.isDark), s = T(() => o.value ? n.logoHeader : n.logoExpanded), c = T(() => o.value && s.value === n.logoExpanded), u = T(() => t.isMobileViewport ? !1 : t.sidebarCollapsed), d = T(() => t.layoutMode !== "top" || t.isMobileViewport), p = T(() => t.isSidebarMenuSearch ? xn(i.value, a.value) : i.value), m = T(() => !t.isSidebarMenuSearch || !a.value.trim() ? [] : h(p.value));
1191
- W(() => t.isSidebarMenuSearch, (e) => {
1192
- e || (a.value = "");
1193
- });
1194
- function h(e) {
1195
- let t = [];
1196
- for (let n of e) n.children?.length && (t.push(n.fullPath), t.push(...h(n.children)));
1197
- return t;
1198
- }
1199
- return (e, i) => {
1200
- let o = B("el-menu"), l = B("el-scrollbar"), f = B("el-aside");
1201
- return d.value ? (L(), D(f, {
1202
- key: 0,
1203
- width: u.value ? "72px" : "220px",
1204
- class: F(["app-layout__aside", {
1205
- "is-mix-mode": U(t).layoutMode === "mix",
1206
- "has-brand": U(t).layoutMode !== "default",
1207
- "is-mobile-open": U(t).mobileSidebarVisible
1208
- }])
1209
- }, {
1210
- default: K(() => [
1211
- U(t).layoutMode === "default" ? O("", !0) : (L(), k("div", jn, [M(C, {
1212
- name: "brand-fade",
1213
- mode: "out-in"
1214
- }, {
1215
- default: K(() => [u.value ? (L(), D(Ut, {
1216
- key: "collapsed",
1217
- src: U(n).logoCollapsed,
1218
- alt: U(n).systemName,
1219
- width: "40px",
1220
- height: "40px"
1221
- }, null, 8, ["src", "alt"])) : (L(), D(Ut, {
1222
- key: "expanded",
1223
- src: s.value,
1224
- alt: U(n).systemName,
1225
- "text-inverted": c.value
1226
- }, null, 8, [
1227
- "src",
1228
- "alt",
1229
- "text-inverted"
1230
- ]))]),
1231
- _: 1
1232
- })])),
1233
- U(t).isSidebarMenuSearch ? (L(), D(Dn, {
1234
- key: 1,
1235
- collapsed: u.value,
1236
- keyword: a.value,
1237
- "onUpdate:keyword": i[0] ||= (e) => a.value = e
1238
- }, null, 8, ["collapsed", "keyword"])) : O("", !0),
1239
- M(l, null, {
1240
- default: K(() => [M(o, {
1241
- collapse: u.value,
1242
- "default-active": U(r),
1243
- "default-openeds": m.value,
1244
- class: "app-layout__menu",
1245
- router: "",
1246
- "unique-opened": "",
1247
- onSelect: U(t).closeMobileSidebar
1248
- }, {
1249
- default: K(() => [(L(!0), k(x, null, z(p.value, (e) => (L(), D(An, {
1250
- key: e.fullPath,
1251
- node: e,
1252
- keyword: U(t).isSidebarMenuSearch ? a.value : ""
1253
- }, null, 8, ["node", "keyword"]))), 128))]),
1254
- _: 1
1255
- }, 8, [
1256
- "collapse",
1257
- "default-active",
1258
- "default-openeds",
1259
- "onSelect"
1260
- ])]),
1261
- _: 1
1262
- })
1263
- ]),
1264
- _: 1
1265
- }, 8, ["width", "class"])) : O("", !0);
1266
- };
1267
- }
1268
- });
1269
- //#endregion
1270
- //#region src/main/composables/useSortable.ts
1271
- function Nn(e = {}) {
1272
- let t = R(null);
1273
- function n() {
1274
- t.value?.destroy(), t.value = null;
1275
- }
1276
- function r(r) {
1277
- r && (n(), t.value = Ae.create(r, {
1278
- animation: e.animation ?? 150,
1279
- chosenClass: e.chosenClass,
1280
- direction: e.direction,
1281
- disabled: e.disabled ?? !1,
1282
- dragClass: e.dragClass,
1283
- draggable: e.draggable,
1284
- easing: e.easing,
1285
- filter: e.filter,
1286
- ghostClass: e.ghostClass,
1287
- handle: e.handle,
1288
- invertSwap: e.invertSwap,
1289
- onEnd: (t) => {
1290
- if (e.onEnd) {
1291
- if (e.onEnd.length >= 2 && t.oldIndex != null && t.newIndex != null) {
1292
- e.onEnd(t.oldIndex, t.newIndex);
1293
- return;
1294
- }
1295
- e.onEnd();
1296
- }
1297
- },
1298
- onStart: e.onStart,
1299
- preventOnFilter: e.preventOnFilter,
1300
- swapThreshold: e.swapThreshold
1301
- }));
1302
- }
1303
- return ee(() => {
1304
- n();
1305
- }), {
1306
- destroy: n,
1307
- init: r,
1308
- sortableInstance: t
1309
- };
1310
- }
1311
- //#endregion
1312
- //#region src/main/layouts/components/AppTabsContextMenu.vue?vue&type=script&setup=true&lang.ts
1313
- var Pn = ["disabled"], Fn = ["disabled"], In = ["disabled"], Ln = ["disabled"], Rn = ["disabled"], zn = /* @__PURE__ */ N({
1314
- __name: "AppTabsContextMenu",
1315
- props: {
1316
- hasLeftTabs: { type: Boolean },
1317
- hasMultipleTabs: { type: Boolean },
1318
- hasRightTabs: { type: Boolean },
1319
- hasLastActive: { type: Boolean },
1320
- isTargetActive: { type: Boolean },
1321
- isTargetHome: { type: Boolean },
1322
- visible: { type: Boolean },
1323
- position: {},
1324
- targetTab: {}
1325
- },
1326
- emits: [
1327
- "close",
1328
- "closeAll",
1329
- "closeLeft",
1330
- "closeOthers",
1331
- "closeRight",
1332
- "closeTab",
1333
- "openInNewTab",
1334
- "refresh",
1335
- "switchPrev"
1336
- ],
1337
- setup(e, { emit: t }) {
1338
- let n = e, r = t;
1339
- function i(e, t = !1) {
1340
- t || (e(), r("close"));
1341
- }
1342
- function a() {
1343
- n.targetTab && r("refresh", n.targetTab.path);
1344
- }
1345
- function o() {
1346
- r("switchPrev");
1347
- }
1348
- function s() {
1349
- n.targetTab && r("openInNewTab", n.targetTab.fullPath);
1350
- }
1351
- function c() {
1352
- n.targetTab && r("closeTab", n.targetTab.path);
1353
- }
1354
- function l() {
1355
- n.targetTab && r("closeOthers", n.targetTab.path);
1356
- }
1357
- function u() {
1358
- n.targetTab && r("closeLeft", n.targetTab.path);
1359
- }
1360
- function d() {
1361
- n.targetTab && r("closeRight", n.targetTab.path);
1362
- }
1363
- return (t, n) => {
1364
- let f = B("el-icon");
1365
- return e.visible && e.targetTab ? (L(), k("div", {
1366
- key: 0,
1367
- class: "app-tabs-menu",
1368
- style: I({
1369
- left: `${e.position.x}px`,
1370
- top: `${e.position.y}px`
1371
- }),
1372
- onMousedown: n[8] ||= q(() => {}, ["stop"]),
1373
- onContextmenu: n[9] ||= q(() => {}, ["prevent"])
1374
- }, [
1375
- A("button", {
1376
- class: "app-tabs-menu__item",
1377
- type: "button",
1378
- onClick: n[0] ||= (e) => i(a)
1379
- }, [M(f, null, {
1380
- default: K(() => [M(U(xe))]),
1381
- _: 1
1382
- }), n[10] ||= A("span", null, "重新加载", -1)]),
1383
- A("button", {
1384
- class: "app-tabs-menu__item",
1385
- type: "button",
1386
- disabled: !e.hasLastActive,
1387
- onClick: n[1] ||= (t) => i(o, !e.hasLastActive)
1388
- }, [M(f, null, {
1389
- default: K(() => [M(U(ce))]),
1390
- _: 1
1391
- }), n[11] ||= A("span", null, "切换上一个页签", -1)], 8, Pn),
1392
- A("button", {
1393
- class: "app-tabs-menu__item",
1394
- type: "button",
1395
- onClick: n[2] ||= (e) => i(s)
1396
- }, [M(f, null, {
1397
- default: K(() => [M(U(Te))]),
1398
- _: 1
1399
- }), n[12] ||= A("span", null, "在新窗口打开", -1)]),
1400
- n[18] ||= A("div", { class: "app-tabs-menu__divider" }, null, -1),
1401
- A("button", {
1402
- class: "app-tabs-menu__item",
1403
- type: "button",
1404
- disabled: e.isTargetHome,
1405
- onClick: n[3] ||= (t) => i(c, e.isTargetHome)
1406
- }, [M(f, null, {
1407
- default: K(() => [M(U(ue))]),
1408
- _: 1
1409
- }), n[13] ||= A("span", null, "关闭当前页签", -1)], 8, Fn),
1410
- A("button", {
1411
- class: "app-tabs-menu__item",
1412
- type: "button",
1413
- disabled: !e.hasMultipleTabs,
1414
- onClick: n[4] ||= (t) => i(l, !e.hasMultipleTabs)
1415
- }, [M(f, null, {
1416
- default: K(() => [M(U(be))]),
1417
- _: 1
1418
- }), n[14] ||= A("span", null, "关闭其他页签", -1)], 8, In),
1419
- A("button", {
1420
- class: "app-tabs-menu__item",
1421
- type: "button",
1422
- disabled: !e.hasLeftTabs,
1423
- onClick: n[5] ||= (t) => i(u, !e.hasLeftTabs)
1424
- }, [M(f, null, {
1425
- default: K(() => [M(U(fe))]),
1426
- _: 1
1427
- }), n[15] ||= A("span", null, "关闭左侧页签", -1)], 8, Ln),
1428
- A("button", {
1429
- class: "app-tabs-menu__item",
1430
- type: "button",
1431
- disabled: !e.hasRightTabs,
1432
- onClick: n[6] ||= (t) => i(d, !e.hasRightTabs)
1433
- }, [M(f, null, {
1434
- default: K(() => [M(U(pe))]),
1435
- _: 1
1436
- }), n[16] ||= A("span", null, "关闭右侧页签", -1)], 8, Rn),
1437
- n[19] ||= A("div", { class: "app-tabs-menu__divider" }, null, -1),
1438
- A("button", {
1439
- class: "app-tabs-menu__item",
1440
- type: "button",
1441
- onClick: n[7] ||= (e) => i(() => r("closeAll"))
1442
- }, [M(f, null, {
1443
- default: K(() => [M(U(ge))]),
1444
- _: 1
1445
- }), n[17] ||= A("span", null, "关闭全部页签", -1)])
1446
- ], 36)) : O("", !0);
1447
- };
1448
- }
1449
- }), Bn = {
1450
- key: 0,
1451
- class: "app-layout__tabs"
1452
- }, Vn = { class: "app-layout__tabs-bar" }, Hn = [
1453
- "data-path",
1454
- "onClick",
1455
- "onContextmenu"
1456
- ], Un = { class: "app-layout__tab-label" }, Wn = ["onClick"], Gn = /* @__PURE__ */ N({
1457
- __name: "AppTabs",
1458
- emits: ["refresh"],
1459
- setup(e, { emit: t }) {
1460
- let n = t, r = _(), i = Q(), a = R(!1), o = R(!1), s = R(!1), c = R({
1461
- x: 0,
1462
- y: 0
1463
- }), l = R(null), u = R(null), d = T(() => l.value ? i.tabs.findIndex((e) => e.path === l.value?.path) : -1), f = T(() => l.value?.path === i.activeTab), p = T(() => d.value > 0), m = T(() => d.value >= 0 && d.value < i.tabs.length - 1), h = T(() => i.tabs.length > 1), g = T(() => !!(i.lastActiveTab && i.tabPaths.includes(i.lastActiveTab))), { init: v } = Nn({
1464
- animation: 150,
1465
- chosenClass: "sortable-chosen",
1466
- direction: "horizontal",
1467
- dragClass: "sortable-drag",
1468
- draggable: ".app-layout__tab",
1469
- filter: ".app-layout__tab-close",
1470
- ghostClass: "sortable-ghost",
1471
- invertSwap: !1,
1472
- onEnd: () => {
1473
- let e = Array.from(u.value?.children ?? []), t = [];
1474
- e.forEach((e) => {
1475
- let n = e.dataset.path, r = i.tabs.find((e) => e.path === n);
1476
- r && t.push(r);
1477
- }), t.length === i.tabs.length && i.reorderTabs(t), window.setTimeout(() => {
1478
- a.value = !1, u.value?.classList.remove("dragging");
1479
- }, 100);
1480
- },
1481
- onStart: () => {
1482
- a.value = !0, u.value?.classList.add("dragging");
1483
- },
1484
- preventOnFilter: !0,
1485
- swapThreshold: .65
1486
- });
1487
- async function y(e) {
1488
- e && (i.setActiveTab(e), await r.push(e), await N());
1489
- }
1490
- async function b(e) {
1491
- if (e === "/dashboard") return;
1492
- let t = i.tabs.findIndex((t) => t.path === e), n = i.activeTab === e;
1493
- if (await i.removeTab(e), !n) return;
1494
- let a = i.tabs[t] ?? i.tabs[t - 1];
1495
- a ? await y(a.path) : (i.setActiveTab(""), r.push(X));
1496
- }
1497
- async function S(e) {
1498
- i.activeTab !== e && await y(e), o.value = !1, await P(), await N(), o.value = !0, n("refresh"), window.setTimeout(() => {
1499
- o.value = !1;
1500
- }, 600);
1501
- }
1502
- function C(e, t) {
1503
- e.preventDefault(), w(e.clientX, e.clientY, t);
1504
- }
1505
- function w(e, t, n) {
1506
- l.value = n, s.value = !0, c.value = {
1507
- x: Math.min(e, window.innerWidth - 188),
1508
- y: Math.min(t, window.innerHeight - 260)
1509
- };
1510
- }
1511
- function E(e) {
1512
- let t = i.tabs.find((e) => e.path === i.activeTab) ?? i.tabs.at(-1);
1513
- if (!t) return;
1514
- let n = e.currentTarget.getBoundingClientRect();
1515
- w(n.left, n.bottom + 4, t);
1516
- }
1517
- function j(e) {
1518
- !u.value || Math.abs(e.deltaY) <= Math.abs(e.deltaX) || (e.preventDefault(), u.value.scrollLeft += e.deltaY);
1519
- }
1520
- async function N() {
1521
- await P(), await new Promise((e) => window.requestAnimationFrame(() => e(null))), await new Promise((e) => window.requestAnimationFrame(() => e(null)));
1522
- let e = u.value, t = e?.querySelector(".app-layout__tab.is-active");
1523
- if (!e || !t) return;
1524
- t.scrollIntoView({
1525
- behavior: "smooth",
1526
- block: "nearest",
1527
- inline: "center"
1528
- });
1529
- let n = Math.max(0, e.scrollWidth - e.clientWidth), r = t.offsetLeft - e.clientWidth / 2 + t.offsetWidth / 2;
1530
- e.scrollTo({
1531
- left: Math.min(n, Math.max(0, r)),
1532
- behavior: "smooth"
1533
- });
1534
- }
1535
- function I() {
1536
- s.value = !1, l.value = null;
1537
- }
1538
- async function ee(e) {
1539
- await i.closeOtherTabs(e), await y(e);
1540
- }
1541
- async function G(e) {
1542
- await i.closeLeftTabs(e), i.tabPaths.includes(i.activeTab) || await y(e);
1543
- }
1544
- async function re(e) {
1545
- await i.closeRightTabs(e), i.tabPaths.includes(i.activeTab) || await y(e);
1546
- }
1547
- async function ie() {
1548
- await i.closeAllTabs(), r.push(X);
1549
- }
1550
- function J() {
1551
- let e = i.lastActiveTab;
1552
- !e || !i.tabPaths.includes(e) || y(e);
1553
- }
1554
- function oe(e) {
1555
- window.open(e, "_blank", "noopener,noreferrer");
1556
- }
1557
- function se(e) {
1558
- e.button !== 2 && I();
1559
- }
1560
- return te(() => {
1561
- document.addEventListener("mousedown", se), v(u.value), N();
1562
- }), ne(() => {
1563
- document.removeEventListener("mousedown", se);
1564
- }), W(() => i.tabs.map((e) => e.path).join("|"), () => {
1565
- a.value || P(() => {
1566
- v(u.value), N();
1567
- });
1568
- }), W(() => i.activeTab, () => {
1569
- N();
1570
- }), (e, t) => {
1571
- let n = B("el-icon");
1572
- return U(i).tabs.length ? (L(), k("div", Bn, [A("div", Vn, [
1573
- A("div", {
1574
- ref_key: "tabsScrollRef",
1575
- ref: u,
1576
- class: "app-layout__tabs-scroll",
1577
- onWheel: j
1578
- }, [(L(!0), k(x, null, z(U(i).tabs, (e) => (L(), k("div", {
1579
- key: e.path,
1580
- class: F(["app-layout__tab", { "is-active": U(i).activeTab === e.path }]),
1581
- "data-path": e.path,
1582
- onClick: (t) => y(e.fullPath),
1583
- onContextmenu: (t) => C(t, e)
1584
- }, [
1585
- e.icon ? (L(), D(n, {
1586
- key: 0,
1587
- class: "app-layout__tab-icon"
1588
- }, {
1589
- default: K(() => [(L(), D(V(U($)(e.icon))))]),
1590
- _: 2
1591
- }, 1024)) : O("", !0),
1592
- A("span", Un, H(e.title), 1),
1593
- e.path === U("/dashboard") ? O("", !0) : (L(), k("button", {
1594
- key: 1,
1595
- class: "app-layout__tab-close",
1596
- type: "button",
1597
- onClick: q((t) => b(e.path), ["stop"])
1598
- }, " × ", 8, Wn))
1599
- ], 42, Hn))), 128))], 544),
1600
- A("button", {
1601
- class: "app-layout__tabs-action",
1602
- type: "button",
1603
- title: "页签操作",
1604
- onClick: E
1605
- }, [M(n, null, {
1606
- default: K(() => [M(U(ae))]),
1607
- _: 1
1608
- })]),
1609
- A("button", {
1610
- class: "app-layout__tabs-action",
1611
- type: "button",
1612
- title: "刷新当前页签",
1613
- onClick: t[0] ||= (e) => S(U(i).activeTab)
1614
- }, [M(n, { class: F({ "is-rotating": o.value }) }, {
1615
- default: K(() => [M(U(xe))]),
1616
- _: 1
1617
- }, 8, ["class"])])
1618
- ]), M(zn, {
1619
- visible: s.value,
1620
- "has-left-tabs": p.value,
1621
- "has-multiple-tabs": h.value,
1622
- "has-right-tabs": m.value,
1623
- "has-last-active": g.value,
1624
- "is-target-home": l.value?.path === U(X),
1625
- "is-target-active": f.value,
1626
- position: c.value,
1627
- "target-tab": l.value,
1628
- onClose: I,
1629
- onCloseAll: ie,
1630
- onCloseLeft: G,
1631
- onCloseOthers: ee,
1632
- onCloseRight: re,
1633
- onCloseTab: b,
1634
- onOpenInNewTab: oe,
1635
- onSwitchPrev: J,
1636
- onRefresh: S
1637
- }, null, 8, [
1638
- "visible",
1639
- "has-left-tabs",
1640
- "has-multiple-tabs",
1641
- "has-right-tabs",
1642
- "has-last-active",
1643
- "is-target-home",
1644
- "is-target-active",
1645
- "position",
1646
- "target-tab"
1647
- ])])) : O("", !0);
1648
- };
1649
- }
1650
- }), Kn = /* @__PURE__ */ N({
1651
- __name: "AppLayout",
1652
- setup(e) {
1653
- let t = g(), n = Q(), r = f(), i = R(0), a = T(() => t.matched.filter((e) => e.meta?.title));
1654
- function o() {
1655
- i.value += 1;
1656
- }
1657
- W(() => t.fullPath, () => {
1658
- let e = String(t.meta.title ?? "未命名页面"), r = t.meta.icon ? String(t.meta.icon) : void 0;
1659
- s(), t.meta.public || n.syncTab({
1660
- path: t.path,
1661
- fullPath: t.fullPath,
1662
- title: e,
1663
- icon: r
1664
- });
1665
- }, { immediate: !0 });
1666
- function s() {
1667
- let e = t.matched.find((e) => e.path !== "/" && !e.meta?.hidden);
1668
- if (!e) return;
1669
- let n = e.path.startsWith("/") ? e.path : `/${e.path}`;
1670
- r.setSelectedTopMenuPath(n);
1671
- }
1672
- return (e, t) => {
1673
- let n = B("el-container");
1674
- return L(), k(x, null, [M(n, { class: "app-layout" }, {
1675
- default: K(() => [
1676
- M(Mn),
1677
- M(n, { direction: "vertical" }, {
1678
- default: K(() => [
1679
- M(bn, { "breadcrumb-items": a.value }, null, 8, ["breadcrumb-items"]),
1680
- M(Gn, { onRefresh: o }),
1681
- M(kt, { "refresh-key": i.value }, null, 8, ["refresh-key"])
1682
- ]),
1683
- _: 1
1684
- }),
1685
- M(C, { name: "app-mobile-mask" }, {
1686
- default: K(() => [U(r).mobileSidebarVisible ? (L(), k("button", {
1687
- key: 0,
1688
- type: "button",
1689
- class: "app-layout__mobile-mask",
1690
- "aria-label": "关闭侧边栏",
1691
- onClick: t[0] ||= (e) => U(r).closeMobileSidebar()
1692
- })) : O("", !0)]),
1693
- _: 1
1694
- })
1695
- ]),
1696
- _: 1
1697
- }), M(Ot)], 64);
1698
- };
1699
- }
1700
- });
1701
- //#endregion
1702
- //#region src/main/router/base-routes.ts
1703
- function qn(e = []) {
1704
- return [{
1705
- path: "/login",
1706
- name: "login",
1707
- component: () => import("./Login-BKuPkkY9.js"),
1708
- meta: {
1709
- title: "登录",
1710
- public: !0
1711
- }
1712
- }, {
1713
- path: "/",
1714
- component: Kn,
1715
- redirect: "/dashboard",
1716
- children: [
1717
- {
1718
- path: "403",
1719
- name: "forbidden",
1720
- component: () => import("./Forbidden-Cu2QQ-FY.js"),
1721
- meta: {
1722
- title: "暂无权限",
1723
- public: !0,
1724
- hidden: !0
1725
- }
1726
- },
1727
- ...e,
1728
- {
1729
- path: "config",
1730
- name: "config-center",
1731
- redirect: "/config/apps",
1732
- meta: {
1733
- title: "配置中心",
1734
- icon: "Setting"
1735
- },
1736
- children: [{
1737
- path: "apps",
1738
- name: "config-apps",
1739
- component: () => import("./application-config-DLHtmY_2.js"),
1740
- meta: {
1741
- title: "应用配置",
1742
- icon: "Connection"
1743
- }
1744
- }, {
1745
- path: "system",
1746
- name: "config-system",
1747
- component: () => import("./SystemConfig-DGZUwXWB.js"),
1748
- meta: {
1749
- title: "系统配置",
1750
- icon: "Setting"
1751
- }
1752
- }]
1753
- },
1754
- {
1755
- path: ":pathMatch(.*)*",
1756
- name: "not-found",
1757
- component: () => import("./NotFound-VRL7_aMx.js"),
1758
- meta: {
1759
- title: "页面不存在",
1760
- public: !0,
1761
- hidden: !0
1762
- }
1763
- }
1764
- ]
1765
- }];
1766
- }
1767
- //#endregion
1768
- //#region src/main/router/index.ts
1769
- function Jn(e = []) {
1770
- let t = Array.isArray(e) ? { businessRoutes: e } : e, n = m({
1771
- history: t.history ?? h("/"),
1772
- routes: qn(t.businessRoutes ?? []),
1773
- scrollBehavior: t.scrollBehavior ?? (() => ({ top: 0 }))
1774
- });
1775
- return He(n), t.setupRouter?.(n), n;
1776
- }
1777
- //#endregion
1778
- //#region src/main/directives/index.ts
1779
- var Yn = {
1780
- mounted(e, t) {
1781
- Xn(e, t.value);
1782
- },
1783
- updated(e, t) {
1784
- Xn(e, t.value);
1785
- }
1786
- };
1787
- function Xn(e, t) {
1788
- let n = a(), r = Zn(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));
1789
- if (!r.length || s) {
1790
- e.style.display = "", e.hidden = !1, o && (e.removeAttribute("disabled"), e.classList.remove("is-disabled"));
1791
- return;
1792
- }
1793
- if (o) {
1794
- e.setAttribute("disabled", "disabled"), e.classList.add("is-disabled");
1795
- return;
1796
- }
1797
- e.style.display = "none", e.hidden = !0;
1798
- }
1799
- function Zn(e) {
1800
- return typeof e == "string" ? e ? [e] : [] : Array.isArray(e) ? e : e.permissions ?? [];
1801
- }
1802
- function Qn(e) {
1803
- e.directive("permission", Yn);
1804
- }
1805
- //#endregion
1806
- //#region src/main/app/create-app.ts
1807
- async function $n(e) {
1808
- Pe(e.appConfig), ze();
1809
- let t = Jn({
1810
- businessRoutes: e.businessRoutes,
1811
- history: e.routerHistory,
1812
- scrollBehavior: e.routerScrollBehavior,
1813
- setupRouter: e.setupRouter
1814
- }), n = E(e.rootComponent), r = ie(), i = {
1815
- app: n,
1816
- router: t,
1817
- pinia: r,
1818
- http: Ie,
1819
- requestManager: Re
1820
- };
1821
- ke(), n.use(y, { locale: je }), n.use(r), n.use(t), Qn(n), Me(t), await e.setupApp?.(i), await e.beforePlatformInit?.(i);
1822
- let a = f(r), o = l(r), s = Q(r), c = Oe({ fullscreen: !0 });
1823
- try {
1824
- await Promise.all([
1825
- a.initializePreferences(),
1826
- o.initializeSystemConfig(),
1827
- s.initializeTabs()
1828
- ]);
1829
- } finally {
1830
- c.close();
1831
- }
1832
- await e.afterPlatformInit?.(i), await e.beforeMount?.(i);
1833
- let u = n.mount("#app"), d = {
1834
- ...i,
1835
- vm: u
1836
- };
1837
- return await e.afterMount?.(d), n;
1838
- }
1839
- //#endregion
1840
- export { X as a, Le as c, Me as d, Nn as i, Ie as l, Jn as n, Q as o, qn as r, ze as s, $n as t, Re as u };