@morningfast/platform 0.0.11 → 0.0.13

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 (33) hide show
  1. package/dist/assets/main/style.css +2 -5
  2. package/dist/assets/sub/style.css +1 -1
  3. package/dist/chunks/{Login-BKuPkkY9.js → Login-8fZ-l3ST.js} +11 -11
  4. package/dist/chunks/{SystemConfig-DGZUwXWB.js → SystemConfig-Xa8FuNBK.js} +1 -1
  5. package/dist/chunks/{application-config-DLHtmY_2.js → application-config-DpfzdbAa.js} +2 -2
  6. package/dist/chunks/main-CX2uCPdt.js +2841 -0
  7. package/dist/chunks/route-items-DXwaEe0Y.js +21 -0
  8. package/dist/index.d.ts +1 -1
  9. package/dist/index.js +7 -8
  10. package/dist/main/app/AppUpdateDialog.vue.d.ts +14 -0
  11. package/dist/main/app/runtime-config.d.ts +5 -0
  12. package/dist/main/app/update-checker.d.ts +8 -0
  13. package/dist/main/app/update-preferences.d.ts +2 -0
  14. package/dist/main/index.d.ts +2 -0
  15. package/dist/main/layouts/composables/useShortcutLabel.d.ts +1 -1
  16. package/dist/main/router/route-items.d.ts +3 -15
  17. package/dist/main/settings/components/AppearanceSettings.vue.d.ts +3 -0
  18. package/dist/main/settings/components/GeneralSettings.vue.d.ts +3 -0
  19. package/dist/main/settings/components/LayoutSettings.vue.d.ts +3 -0
  20. package/dist/main/settings/components/ShortcutSettings.vue.d.ts +3 -0
  21. package/dist/main/stores/app.d.ts +11 -2
  22. package/dist/main/stores/index.d.ts +1 -0
  23. package/dist/main/stores/shortcut.d.ts +77 -0
  24. package/dist/main/utils/keyboard-shortcut.d.ts +39 -0
  25. package/dist/main.js +5 -6
  26. package/dist/shared/router/route-items.d.ts +15 -0
  27. package/dist/sub/index.d.ts +2 -2
  28. package/dist/sub.js +1 -1
  29. package/package.json +1 -1
  30. package/dist/chunks/main-CA2I4UGE.js +0 -1822
  31. package/dist/chunks/route-items-CIUjZc6w.js +0 -491
  32. /package/dist/chunks/{_plugin-vue_export-helper-DvRHjpsZ.js → _plugin-vue_export-helper-CZc-Y3Wh.js} +0 -0
  33. /package/dist/chunks/{config-Cd-9BYBy.js → config-CJOAan9n.js} +0 -0
@@ -1,1822 +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-CIUjZc6w.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 q, withModifiers as J } from "vue";
11
- import { createPinia as re, defineStore as Y } from "pinia";
12
- import { ArrowDown as ie, ArrowRight as ae, ArrowUp as oe, Back as se, Brush as ce, Close as le, Connection as ue, DArrowLeft as de, DArrowRight as fe, Expand as pe, Fold as me, FolderDelete as he, House as ge, Monitor as _e, Moon as ve, Operation as ye, RefreshRight as be, Search as xe, 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 = Y("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: ve
268
- },
269
- {
270
- label: "跟随系统",
271
- value: "system",
272
- icon: _e
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: xe
315
- }, {
316
- label: "侧边搜索",
317
- value: "sidebar",
318
- icon: ye
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(ce))]),
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(ve))))]),
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.layoutMode === "mix" ? i.value.find((e) => e.fullPath === n.selectedTopMenuPath)?.children ?? [] : i.value), 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: ue,
594
- House: ge,
595
- Setting: Se,
596
- User: Ee
597
- };
598
- function $(e) {
599
- return e ? Wt[e] ?? ge : ge;
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] ||= q(J((t) => n("select", e.item), ["prevent"]), ["enter"]), r[3] ||= q(J((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] ||= J((t) => n("remove", e.item), ["stop"])
680
- }, [M(i, null, {
681
- default: K(() => [M(U(le))]),
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
- Y();
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"), re(), 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
- Y();
719
- });
720
- function g() {
721
- r("update:modelValue", !1), Y();
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 = q((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 q(e, t, n) {
783
- return Math.min(Math.max(e, t), n);
784
- }
785
- function re() {
786
- window.removeEventListener("keydown", F, !0), window.addEventListener("keydown", F, !0);
787
- }
788
- function Y() {
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: J(g, ["self"])
799
- }, [A("div", {
800
- class: "app-menu-search__panel",
801
- onClick: n[1] ||= J(() => {}, ["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(xe))]),
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(ie))]),
869
- _: 1
870
- }),
871
- M(r, null, {
872
- default: K(() => [M(U(oe))]),
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(xe))]),
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 = { class: "app-layout__header-right" }, _n = { class: "app-layout__user" }, vn = { class: "app-layout__user-copy" }, yn = /* @__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" ? O("", !0) : (L(), k("button", {
969
- key: 1,
970
- type: "button",
971
- class: "app-layout__header-tool-btn app-layout__header-tool-btn--collapse",
972
- onClick: a[0] ||= (e) => U(n).toggleSidebar()
973
- }, [M(o, null, {
974
- default: K(() => [(L(), D(V(U(n).sidebarCollapsed ? U(pe) : U(me))))]),
975
- _: 1
976
- })])),
977
- U(n).layoutMode === "top" ? (L(), D(s, {
978
- key: 2,
979
- mode: "horizontal",
980
- ellipsis: !1,
981
- "default-active": U(c).path,
982
- class: "app-layout__header-menu",
983
- onSelect: w
984
- }, {
985
- default: K(() => [(L(!0), k(x, null, z(U(h), (e) => (L(), D(Gt, {
986
- key: e.fullPath,
987
- node: e
988
- }, null, 8, ["node"]))), 128))]),
989
- _: 1
990
- }, 8, ["default-active"])) : U(n).layoutMode === "mix" ? (L(), D(s, {
991
- key: 3,
992
- mode: "horizontal",
993
- ellipsis: !1,
994
- "default-active": U(d),
995
- class: "app-layout__header-menu app-layout__header-menu--mix",
996
- onSelect: E
997
- }, {
998
- default: K(() => [(L(!0), k(x, null, z(U(h), (e) => (L(), D(l, {
999
- key: e.fullPath,
1000
- index: e.fullPath
1001
- }, {
1002
- default: K(() => [j(H(e.title), 1)]),
1003
- _: 2
1004
- }, 1032, ["index"]))), 128))]),
1005
- _: 1
1006
- }, 8, ["default-active"])) : O("", !0),
1007
- U(n).layoutMode === "default" || U(n).layoutMode === "side" ? (L(), D(p, {
1008
- key: 4,
1009
- "separator-icon": U(ae)
1010
- }, {
1011
- default: K(() => [(L(!0), k(x, null, z(e.breadcrumbItems, (e, t) => (L(), D(f, {
1012
- key: e.path || String(e.name),
1013
- to: S(e, t)
1014
- }, {
1015
- default: K(() => [j(H(e.meta.title), 1)]),
1016
- _: 2
1017
- }, 1032, ["to"]))), 128))]),
1018
- _: 1
1019
- }, 8, ["separator-icon"])) : O("", !0)
1020
- ]),
1021
- U(n).layoutMode !== "mix" && !U(n).isSidebarMenuSearch ? (L(), k("div", {
1022
- key: 0,
1023
- class: F(["app-layout__header-search", `app-layout__header-search--${U(n).layoutMode}`])
1024
- }, [M(pn, {
1025
- "layout-mode": U(n).layoutMode,
1026
- onOpen: N
1027
- }, null, 8, ["layout-mode"])], 2)) : O("", !0),
1028
- A("div", gn, [
1029
- U(n).layoutMode === "mix" && !U(n).isSidebarMenuSearch ? (L(), D(pn, {
1030
- key: 0,
1031
- "layout-mode": U(n).layoutMode,
1032
- onOpen: N
1033
- }, null, 8, ["layout-mode"])) : O("", !0),
1034
- A("button", {
1035
- type: "button",
1036
- class: "app-layout__header-tool-btn",
1037
- title: "主题设置",
1038
- onClick: a[1] ||= (e) => U(n).openSettings("theme")
1039
- }, [M(o, {
1040
- size: 18,
1041
- class: "app-layout__header-tool-icon"
1042
- }, {
1043
- default: K(() => [M(U(ce))]),
1044
- _: 1
1045
- })]),
1046
- M(jt),
1047
- M(v, { onCommand: C }, {
1048
- dropdown: K(() => [M(_, null, {
1049
- default: K(() => [M(g, { disabled: "" }, {
1050
- default: K(() => [M(o, null, {
1051
- default: K(() => [M(U(Se))]),
1052
- _: 1
1053
- }), a[3] ||= j(" 个人设置 ", -1)]),
1054
- _: 1
1055
- }), M(g, { command: "logout" }, {
1056
- default: K(() => [M(o, null, {
1057
- default: K(() => [M(U(we))]),
1058
- _: 1
1059
- }), a[4] ||= j(" 退出登录 ", -1)]),
1060
- _: 1
1061
- })]),
1062
- _: 1
1063
- })]),
1064
- default: K(() => [A("div", _n, [
1065
- M(m, { size: 32 }, {
1066
- default: K(() => [j(H(U(r).userName.slice(0, 1)), 1)]),
1067
- _: 1
1068
- }),
1069
- A("div", vn, [A("strong", null, H(U(r).userName), 1), A("span", null, H(U(r).userRoleLabel), 1)]),
1070
- M(o, null, {
1071
- default: K(() => [M(U(ie))]),
1072
- _: 1
1073
- })
1074
- ])]),
1075
- _: 1
1076
- })
1077
- ])
1078
- ]),
1079
- _: 1
1080
- }), M(un, {
1081
- modelValue: u.value,
1082
- "onUpdate:modelValue": a[2] ||= (e) => u.value = e
1083
- }, null, 8, ["modelValue"])], 64);
1084
- };
1085
- }
1086
- });
1087
- //#endregion
1088
- //#region src/main/layouts/utils/menuSearch.ts
1089
- function bn(e, t) {
1090
- let n = t.trim().toLowerCase();
1091
- if (!n) return [...e];
1092
- let r = [];
1093
- for (let t of e) {
1094
- let e = bn(t.children ?? [], n);
1095
- !(Cn(t) && Sn(t, n)) && !e.length || r.push({
1096
- ...t,
1097
- children: e.length ? e : void 0
1098
- });
1099
- }
1100
- return r;
1101
- }
1102
- function xn(e, t) {
1103
- let n = wn(e), r = t.trim();
1104
- if (!r) return n;
1105
- let i = Array.from(e), a = e.toLowerCase(), o = r.toLowerCase(), s = a.indexOf(o);
1106
- return s < 0 ? n : `${wn(i.slice(0, s).join(""))}<mark class="app-menu-search-highlight">${wn(i.slice(s, s + r.length).join(""))}</mark>${wn(i.slice(s + r.length).join(""))}`;
1107
- }
1108
- function Sn(e, t) {
1109
- return e.title.toLowerCase().includes(t);
1110
- }
1111
- function Cn(e) {
1112
- return !e.children?.length;
1113
- }
1114
- function wn(e) {
1115
- return e.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll("\"", "&quot;").replaceAll("'", "&#39;");
1116
- }
1117
- //#endregion
1118
- //#region src/main/layouts/components/AppSidebarSearch.vue?vue&type=script&setup=true&lang.ts
1119
- var Tn = {
1120
- key: 0,
1121
- class: "app-sidebar-search"
1122
- }, En = /* @__PURE__ */ N({
1123
- __name: "AppSidebarSearch",
1124
- props: {
1125
- collapsed: { type: Boolean },
1126
- keyword: {}
1127
- },
1128
- emits: ["update:keyword"],
1129
- setup(e, { emit: t }) {
1130
- let n = t;
1131
- return (t, r) => {
1132
- let i = B("el-icon"), a = B("el-input");
1133
- return e.collapsed ? O("", !0) : (L(), k("div", Tn, [M(a, {
1134
- "model-value": e.keyword,
1135
- placeholder: "搜索菜单",
1136
- clearable: "",
1137
- "onUpdate:modelValue": r[0] ||= (e) => n("update:keyword", e)
1138
- }, {
1139
- prefix: K(() => [M(i, null, {
1140
- default: K(() => [M(U(xe))]),
1141
- _: 1
1142
- })]),
1143
- _: 1
1144
- }, 8, ["model-value"])]));
1145
- };
1146
- }
1147
- }), Dn = ["innerHTML"], On = ["innerHTML"], kn = /* @__PURE__ */ N({
1148
- name: "AppSidebarNode",
1149
- __name: "AppSidebarNode",
1150
- props: {
1151
- node: {},
1152
- keyword: {}
1153
- },
1154
- setup(e) {
1155
- let t = e, n = T(() => xn(t.node.title, t.keyword ?? ""));
1156
- return (t, r) => {
1157
- let i = B("el-icon"), a = B("AppSidebarNode", !0), o = B("el-sub-menu"), s = B("el-menu-item");
1158
- return e.node.children?.length ? (L(), D(o, {
1159
- key: 0,
1160
- index: e.node.fullPath
1161
- }, {
1162
- title: K(() => [M(i, null, {
1163
- default: K(() => [(L(), D(V(U($)(e.node.icon))))]),
1164
- _: 1
1165
- }), A("span", { innerHTML: n.value }, null, 8, Dn)]),
1166
- default: K(() => [(L(!0), k(x, null, z(e.node.children, (t) => (L(), D(a, {
1167
- key: t.fullPath,
1168
- node: t,
1169
- keyword: e.keyword
1170
- }, null, 8, ["node", "keyword"]))), 128))]),
1171
- _: 1
1172
- }, 8, ["index"])) : (L(), D(s, {
1173
- key: 1,
1174
- index: e.node.fullPath
1175
- }, {
1176
- default: K(() => [A("span", { innerHTML: n.value }, null, 8, On)]),
1177
- _: 1
1178
- }, 8, ["index"]));
1179
- };
1180
- }
1181
- }), An = {
1182
- key: 0,
1183
- class: "app-layout__brand"
1184
- }, jn = /* @__PURE__ */ N({
1185
- name: "AppSidebar",
1186
- __name: "AppSidebar",
1187
- setup(e) {
1188
- 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.isSidebarMenuSearch ? bn(i.value, a.value) : i.value), d = T(() => !t.isSidebarMenuSearch || !a.value.trim() ? [] : p(u.value));
1189
- W(() => t.isSidebarMenuSearch, (e) => {
1190
- e || (a.value = "");
1191
- });
1192
- function p(e) {
1193
- let t = [];
1194
- for (let n of e) n.children?.length && (t.push(n.fullPath), t.push(...p(n.children)));
1195
- return t;
1196
- }
1197
- return (e, i) => {
1198
- let o = B("el-menu"), l = B("el-scrollbar"), f = B("el-aside");
1199
- return U(t).layoutMode === "top" ? O("", !0) : (L(), D(f, {
1200
- key: 0,
1201
- width: U(t).sidebarCollapsed ? "72px" : "220px",
1202
- class: F(["app-layout__aside", {
1203
- "is-mix-mode": U(t).layoutMode === "mix",
1204
- "has-brand": U(t).layoutMode !== "default"
1205
- }])
1206
- }, {
1207
- default: K(() => [
1208
- U(t).layoutMode === "default" ? O("", !0) : (L(), k("div", An, [M(C, {
1209
- name: "brand-fade",
1210
- mode: "out-in"
1211
- }, {
1212
- default: K(() => [U(t).sidebarCollapsed ? (L(), D(Ut, {
1213
- key: "collapsed",
1214
- src: U(n).logoCollapsed,
1215
- alt: U(n).systemName,
1216
- width: "40px",
1217
- height: "40px"
1218
- }, null, 8, ["src", "alt"])) : (L(), D(Ut, {
1219
- key: "expanded",
1220
- src: s.value,
1221
- alt: U(n).systemName,
1222
- "text-inverted": c.value
1223
- }, null, 8, [
1224
- "src",
1225
- "alt",
1226
- "text-inverted"
1227
- ]))]),
1228
- _: 1
1229
- })])),
1230
- U(t).isSidebarMenuSearch ? (L(), D(En, {
1231
- key: 1,
1232
- collapsed: U(t).sidebarCollapsed,
1233
- keyword: a.value,
1234
- "onUpdate:keyword": i[0] ||= (e) => a.value = e
1235
- }, null, 8, ["collapsed", "keyword"])) : O("", !0),
1236
- M(l, null, {
1237
- default: K(() => [M(o, {
1238
- collapse: U(t).sidebarCollapsed,
1239
- "default-active": U(r),
1240
- "default-openeds": d.value,
1241
- class: "app-layout__menu",
1242
- router: "",
1243
- "unique-opened": ""
1244
- }, {
1245
- default: K(() => [(L(!0), k(x, null, z(u.value, (e) => (L(), D(kn, {
1246
- key: e.fullPath,
1247
- node: e,
1248
- keyword: U(t).isSidebarMenuSearch ? a.value : ""
1249
- }, null, 8, ["node", "keyword"]))), 128))]),
1250
- _: 1
1251
- }, 8, [
1252
- "collapse",
1253
- "default-active",
1254
- "default-openeds"
1255
- ])]),
1256
- _: 1
1257
- })
1258
- ]),
1259
- _: 1
1260
- }, 8, ["width", "class"]));
1261
- };
1262
- }
1263
- });
1264
- //#endregion
1265
- //#region src/main/composables/useSortable.ts
1266
- function Mn(e = {}) {
1267
- let t = R(null);
1268
- function n() {
1269
- t.value?.destroy(), t.value = null;
1270
- }
1271
- function r(r) {
1272
- r && (n(), t.value = Ae.create(r, {
1273
- animation: e.animation ?? 150,
1274
- chosenClass: e.chosenClass,
1275
- direction: e.direction,
1276
- disabled: e.disabled ?? !1,
1277
- dragClass: e.dragClass,
1278
- draggable: e.draggable,
1279
- easing: e.easing,
1280
- filter: e.filter,
1281
- ghostClass: e.ghostClass,
1282
- handle: e.handle,
1283
- invertSwap: e.invertSwap,
1284
- onEnd: (t) => {
1285
- if (e.onEnd) {
1286
- if (e.onEnd.length >= 2 && t.oldIndex != null && t.newIndex != null) {
1287
- e.onEnd(t.oldIndex, t.newIndex);
1288
- return;
1289
- }
1290
- e.onEnd();
1291
- }
1292
- },
1293
- onStart: e.onStart,
1294
- preventOnFilter: e.preventOnFilter,
1295
- swapThreshold: e.swapThreshold
1296
- }));
1297
- }
1298
- return ee(() => {
1299
- n();
1300
- }), {
1301
- destroy: n,
1302
- init: r,
1303
- sortableInstance: t
1304
- };
1305
- }
1306
- //#endregion
1307
- //#region src/main/layouts/components/AppTabsContextMenu.vue?vue&type=script&setup=true&lang.ts
1308
- var Nn = ["disabled"], Pn = ["disabled"], Fn = ["disabled"], In = ["disabled"], Ln = ["disabled"], Rn = /* @__PURE__ */ N({
1309
- __name: "AppTabsContextMenu",
1310
- props: {
1311
- hasLeftTabs: { type: Boolean },
1312
- hasMultipleTabs: { type: Boolean },
1313
- hasRightTabs: { type: Boolean },
1314
- hasLastActive: { type: Boolean },
1315
- isTargetActive: { type: Boolean },
1316
- isTargetHome: { type: Boolean },
1317
- visible: { type: Boolean },
1318
- position: {},
1319
- targetTab: {}
1320
- },
1321
- emits: [
1322
- "close",
1323
- "closeAll",
1324
- "closeLeft",
1325
- "closeOthers",
1326
- "closeRight",
1327
- "closeTab",
1328
- "openInNewTab",
1329
- "refresh",
1330
- "switchPrev"
1331
- ],
1332
- setup(e, { emit: t }) {
1333
- let n = e, r = t;
1334
- function i(e, t = !1) {
1335
- t || (e(), r("close"));
1336
- }
1337
- function a() {
1338
- n.targetTab && r("refresh", n.targetTab.path);
1339
- }
1340
- function o() {
1341
- r("switchPrev");
1342
- }
1343
- function s() {
1344
- n.targetTab && r("openInNewTab", n.targetTab.fullPath);
1345
- }
1346
- function c() {
1347
- n.targetTab && r("closeTab", n.targetTab.path);
1348
- }
1349
- function l() {
1350
- n.targetTab && r("closeOthers", n.targetTab.path);
1351
- }
1352
- function u() {
1353
- n.targetTab && r("closeLeft", n.targetTab.path);
1354
- }
1355
- function d() {
1356
- n.targetTab && r("closeRight", n.targetTab.path);
1357
- }
1358
- return (t, n) => {
1359
- let f = B("el-icon");
1360
- return e.visible && e.targetTab ? (L(), k("div", {
1361
- key: 0,
1362
- class: "app-tabs-menu",
1363
- style: I({
1364
- left: `${e.position.x}px`,
1365
- top: `${e.position.y}px`
1366
- }),
1367
- onMousedown: n[8] ||= J(() => {}, ["stop"]),
1368
- onContextmenu: n[9] ||= J(() => {}, ["prevent"])
1369
- }, [
1370
- A("button", {
1371
- class: "app-tabs-menu__item",
1372
- type: "button",
1373
- onClick: n[0] ||= (e) => i(a)
1374
- }, [M(f, null, {
1375
- default: K(() => [M(U(be))]),
1376
- _: 1
1377
- }), n[10] ||= A("span", null, "重新加载", -1)]),
1378
- A("button", {
1379
- class: "app-tabs-menu__item",
1380
- type: "button",
1381
- disabled: !e.hasLastActive,
1382
- onClick: n[1] ||= (t) => i(o, !e.hasLastActive)
1383
- }, [M(f, null, {
1384
- default: K(() => [M(U(se))]),
1385
- _: 1
1386
- }), n[11] ||= A("span", null, "切换上一个页签", -1)], 8, Nn),
1387
- A("button", {
1388
- class: "app-tabs-menu__item",
1389
- type: "button",
1390
- onClick: n[2] ||= (e) => i(s)
1391
- }, [M(f, null, {
1392
- default: K(() => [M(U(Te))]),
1393
- _: 1
1394
- }), n[12] ||= A("span", null, "在新窗口打开", -1)]),
1395
- n[18] ||= A("div", { class: "app-tabs-menu__divider" }, null, -1),
1396
- A("button", {
1397
- class: "app-tabs-menu__item",
1398
- type: "button",
1399
- disabled: e.isTargetHome,
1400
- onClick: n[3] ||= (t) => i(c, e.isTargetHome)
1401
- }, [M(f, null, {
1402
- default: K(() => [M(U(le))]),
1403
- _: 1
1404
- }), n[13] ||= A("span", null, "关闭当前页签", -1)], 8, Pn),
1405
- A("button", {
1406
- class: "app-tabs-menu__item",
1407
- type: "button",
1408
- disabled: !e.hasMultipleTabs,
1409
- onClick: n[4] ||= (t) => i(l, !e.hasMultipleTabs)
1410
- }, [M(f, null, {
1411
- default: K(() => [M(U(ye))]),
1412
- _: 1
1413
- }), n[14] ||= A("span", null, "关闭其他页签", -1)], 8, Fn),
1414
- A("button", {
1415
- class: "app-tabs-menu__item",
1416
- type: "button",
1417
- disabled: !e.hasLeftTabs,
1418
- onClick: n[5] ||= (t) => i(u, !e.hasLeftTabs)
1419
- }, [M(f, null, {
1420
- default: K(() => [M(U(de))]),
1421
- _: 1
1422
- }), n[15] ||= A("span", null, "关闭左侧页签", -1)], 8, In),
1423
- A("button", {
1424
- class: "app-tabs-menu__item",
1425
- type: "button",
1426
- disabled: !e.hasRightTabs,
1427
- onClick: n[6] ||= (t) => i(d, !e.hasRightTabs)
1428
- }, [M(f, null, {
1429
- default: K(() => [M(U(fe))]),
1430
- _: 1
1431
- }), n[16] ||= A("span", null, "关闭右侧页签", -1)], 8, Ln),
1432
- n[19] ||= A("div", { class: "app-tabs-menu__divider" }, null, -1),
1433
- A("button", {
1434
- class: "app-tabs-menu__item",
1435
- type: "button",
1436
- onClick: n[7] ||= (e) => i(() => r("closeAll"))
1437
- }, [M(f, null, {
1438
- default: K(() => [M(U(he))]),
1439
- _: 1
1440
- }), n[17] ||= A("span", null, "关闭全部页签", -1)])
1441
- ], 36)) : O("", !0);
1442
- };
1443
- }
1444
- }), zn = {
1445
- key: 0,
1446
- class: "app-layout__tabs"
1447
- }, Bn = { class: "app-layout__tabs-bar" }, Vn = [
1448
- "data-path",
1449
- "onClick",
1450
- "onContextmenu"
1451
- ], Hn = { class: "app-layout__tab-label" }, Un = ["onClick"], Wn = /* @__PURE__ */ N({
1452
- __name: "AppTabs",
1453
- emits: ["refresh"],
1454
- setup(e, { emit: t }) {
1455
- let n = t, r = _(), i = Q(), a = R(!1), o = R(!1), s = R(!1), c = R({
1456
- x: 0,
1457
- y: 0
1458
- }), 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 } = Mn({
1459
- animation: 150,
1460
- chosenClass: "sortable-chosen",
1461
- direction: "horizontal",
1462
- dragClass: "sortable-drag",
1463
- draggable: ".app-layout__tab",
1464
- filter: ".app-layout__tab-close",
1465
- ghostClass: "sortable-ghost",
1466
- invertSwap: !1,
1467
- onEnd: () => {
1468
- let e = Array.from(u.value?.children ?? []), t = [];
1469
- e.forEach((e) => {
1470
- let n = e.dataset.path, r = i.tabs.find((e) => e.path === n);
1471
- r && t.push(r);
1472
- }), t.length === i.tabs.length && i.reorderTabs(t), window.setTimeout(() => {
1473
- a.value = !1, u.value?.classList.remove("dragging");
1474
- }, 100);
1475
- },
1476
- onStart: () => {
1477
- a.value = !0, u.value?.classList.add("dragging");
1478
- },
1479
- preventOnFilter: !0,
1480
- swapThreshold: .65
1481
- });
1482
- async function y(e) {
1483
- e && (i.setActiveTab(e), await r.push(e), await N());
1484
- }
1485
- async function b(e) {
1486
- if (e === "/dashboard") return;
1487
- let t = i.tabs.findIndex((t) => t.path === e), n = i.activeTab === e;
1488
- if (await i.removeTab(e), !n) return;
1489
- let a = i.tabs[t] ?? i.tabs[t - 1];
1490
- a ? await y(a.path) : (i.setActiveTab(""), r.push(X));
1491
- }
1492
- async function S(e) {
1493
- i.activeTab !== e && await y(e), o.value = !1, await P(), await N(), o.value = !0, n("refresh"), window.setTimeout(() => {
1494
- o.value = !1;
1495
- }, 600);
1496
- }
1497
- function C(e, t) {
1498
- e.preventDefault(), w(e.clientX, e.clientY, t);
1499
- }
1500
- function w(e, t, n) {
1501
- l.value = n, s.value = !0, c.value = {
1502
- x: Math.min(e, window.innerWidth - 188),
1503
- y: Math.min(t, window.innerHeight - 260)
1504
- };
1505
- }
1506
- function E(e) {
1507
- let t = i.tabs.find((e) => e.path === i.activeTab) ?? i.tabs.at(-1);
1508
- if (!t) return;
1509
- let n = e.currentTarget.getBoundingClientRect();
1510
- w(n.left, n.bottom + 4, t);
1511
- }
1512
- function j(e) {
1513
- !u.value || Math.abs(e.deltaY) <= Math.abs(e.deltaX) || (e.preventDefault(), u.value.scrollLeft += e.deltaY);
1514
- }
1515
- async function N() {
1516
- await P(), await new Promise((e) => window.requestAnimationFrame(() => e(null))), await new Promise((e) => window.requestAnimationFrame(() => e(null)));
1517
- let e = u.value, t = e?.querySelector(".app-layout__tab.is-active");
1518
- if (!e || !t) return;
1519
- t.scrollIntoView({
1520
- behavior: "smooth",
1521
- block: "nearest",
1522
- inline: "center"
1523
- });
1524
- let n = Math.max(0, e.scrollWidth - e.clientWidth), r = t.offsetLeft - e.clientWidth / 2 + t.offsetWidth / 2;
1525
- e.scrollTo({
1526
- left: Math.min(n, Math.max(0, r)),
1527
- behavior: "smooth"
1528
- });
1529
- }
1530
- function I() {
1531
- s.value = !1, l.value = null;
1532
- }
1533
- async function ee(e) {
1534
- await i.closeOtherTabs(e), await y(e);
1535
- }
1536
- async function G(e) {
1537
- await i.closeLeftTabs(e), i.tabPaths.includes(i.activeTab) || await y(e);
1538
- }
1539
- async function q(e) {
1540
- await i.closeRightTabs(e), i.tabPaths.includes(i.activeTab) || await y(e);
1541
- }
1542
- async function re() {
1543
- await i.closeAllTabs(), r.push(X);
1544
- }
1545
- function Y() {
1546
- let e = i.lastActiveTab;
1547
- !e || !i.tabPaths.includes(e) || y(e);
1548
- }
1549
- function ae(e) {
1550
- window.open(e, "_blank", "noopener,noreferrer");
1551
- }
1552
- function oe(e) {
1553
- e.button !== 2 && I();
1554
- }
1555
- return te(() => {
1556
- document.addEventListener("mousedown", oe), v(u.value), N();
1557
- }), ne(() => {
1558
- document.removeEventListener("mousedown", oe);
1559
- }), W(() => i.tabs.map((e) => e.path).join("|"), () => {
1560
- a.value || P(() => {
1561
- v(u.value), N();
1562
- });
1563
- }), W(() => i.activeTab, () => {
1564
- N();
1565
- }), (e, t) => {
1566
- let n = B("el-icon");
1567
- return U(i).tabs.length ? (L(), k("div", zn, [A("div", Bn, [
1568
- A("div", {
1569
- ref_key: "tabsScrollRef",
1570
- ref: u,
1571
- class: "app-layout__tabs-scroll",
1572
- onWheel: j
1573
- }, [(L(!0), k(x, null, z(U(i).tabs, (e) => (L(), k("div", {
1574
- key: e.path,
1575
- class: F(["app-layout__tab", { "is-active": U(i).activeTab === e.path }]),
1576
- "data-path": e.path,
1577
- onClick: (t) => y(e.fullPath),
1578
- onContextmenu: (t) => C(t, e)
1579
- }, [
1580
- e.icon ? (L(), D(n, {
1581
- key: 0,
1582
- class: "app-layout__tab-icon"
1583
- }, {
1584
- default: K(() => [(L(), D(V(U($)(e.icon))))]),
1585
- _: 2
1586
- }, 1024)) : O("", !0),
1587
- A("span", Hn, H(e.title), 1),
1588
- e.path === U("/dashboard") ? O("", !0) : (L(), k("button", {
1589
- key: 1,
1590
- class: "app-layout__tab-close",
1591
- type: "button",
1592
- onClick: J((t) => b(e.path), ["stop"])
1593
- }, " × ", 8, Un))
1594
- ], 42, Vn))), 128))], 544),
1595
- A("button", {
1596
- class: "app-layout__tabs-action",
1597
- type: "button",
1598
- title: "页签操作",
1599
- onClick: E
1600
- }, [M(n, null, {
1601
- default: K(() => [M(U(ie))]),
1602
- _: 1
1603
- })]),
1604
- A("button", {
1605
- class: "app-layout__tabs-action",
1606
- type: "button",
1607
- title: "刷新当前页签",
1608
- onClick: t[0] ||= (e) => S(U(i).activeTab)
1609
- }, [M(n, { class: F({ "is-rotating": o.value }) }, {
1610
- default: K(() => [M(U(be))]),
1611
- _: 1
1612
- }, 8, ["class"])])
1613
- ]), M(Rn, {
1614
- visible: s.value,
1615
- "has-left-tabs": p.value,
1616
- "has-multiple-tabs": h.value,
1617
- "has-right-tabs": m.value,
1618
- "has-last-active": g.value,
1619
- "is-target-home": l.value?.path === U(X),
1620
- "is-target-active": f.value,
1621
- position: c.value,
1622
- "target-tab": l.value,
1623
- onClose: I,
1624
- onCloseAll: re,
1625
- onCloseLeft: G,
1626
- onCloseOthers: ee,
1627
- onCloseRight: q,
1628
- onCloseTab: b,
1629
- onOpenInNewTab: ae,
1630
- onSwitchPrev: Y,
1631
- onRefresh: S
1632
- }, null, 8, [
1633
- "visible",
1634
- "has-left-tabs",
1635
- "has-multiple-tabs",
1636
- "has-right-tabs",
1637
- "has-last-active",
1638
- "is-target-home",
1639
- "is-target-active",
1640
- "position",
1641
- "target-tab"
1642
- ])])) : O("", !0);
1643
- };
1644
- }
1645
- }), Gn = /* @__PURE__ */ N({
1646
- __name: "AppLayout",
1647
- setup(e) {
1648
- let t = g(), n = Q(), r = f(), i = R(0), a = T(() => t.matched.filter((e) => e.meta?.title));
1649
- function o() {
1650
- i.value += 1;
1651
- }
1652
- W(() => t.fullPath, () => {
1653
- let e = String(t.meta.title ?? "未命名页面"), r = t.meta.icon ? String(t.meta.icon) : void 0;
1654
- s(), t.meta.public || n.syncTab({
1655
- path: t.path,
1656
- fullPath: t.fullPath,
1657
- title: e,
1658
- icon: r
1659
- });
1660
- }, { immediate: !0 });
1661
- function s() {
1662
- let e = t.matched.find((e) => e.path !== "/" && !e.meta?.hidden);
1663
- if (!e) return;
1664
- let n = e.path.startsWith("/") ? e.path : `/${e.path}`;
1665
- r.setSelectedTopMenuPath(n);
1666
- }
1667
- return (e, t) => {
1668
- let n = B("el-container");
1669
- return L(), k(x, null, [M(n, { class: "app-layout" }, {
1670
- default: K(() => [M(jn), M(n, { direction: "vertical" }, {
1671
- default: K(() => [
1672
- M(yn, { "breadcrumb-items": a.value }, null, 8, ["breadcrumb-items"]),
1673
- M(Wn, { onRefresh: o }),
1674
- M(kt, { "refresh-key": i.value }, null, 8, ["refresh-key"])
1675
- ]),
1676
- _: 1
1677
- })]),
1678
- _: 1
1679
- }), M(Ot)], 64);
1680
- };
1681
- }
1682
- });
1683
- //#endregion
1684
- //#region src/main/router/base-routes.ts
1685
- function Kn(e = []) {
1686
- return [{
1687
- path: "/login",
1688
- name: "login",
1689
- component: () => import("./Login-BKuPkkY9.js"),
1690
- meta: {
1691
- title: "登录",
1692
- public: !0
1693
- }
1694
- }, {
1695
- path: "/",
1696
- component: Gn,
1697
- redirect: "/dashboard",
1698
- children: [
1699
- {
1700
- path: "403",
1701
- name: "forbidden",
1702
- component: () => import("./Forbidden-Cu2QQ-FY.js"),
1703
- meta: {
1704
- title: "暂无权限",
1705
- public: !0,
1706
- hidden: !0
1707
- }
1708
- },
1709
- ...e,
1710
- {
1711
- path: "config",
1712
- name: "config-center",
1713
- redirect: "/config/apps",
1714
- meta: {
1715
- title: "配置中心",
1716
- icon: "Setting"
1717
- },
1718
- children: [{
1719
- path: "apps",
1720
- name: "config-apps",
1721
- component: () => import("./application-config-DLHtmY_2.js"),
1722
- meta: {
1723
- title: "应用配置",
1724
- icon: "Connection"
1725
- }
1726
- }, {
1727
- path: "system",
1728
- name: "config-system",
1729
- component: () => import("./SystemConfig-DGZUwXWB.js"),
1730
- meta: {
1731
- title: "系统配置",
1732
- icon: "Setting"
1733
- }
1734
- }]
1735
- },
1736
- {
1737
- path: ":pathMatch(.*)*",
1738
- name: "not-found",
1739
- component: () => import("./NotFound-VRL7_aMx.js"),
1740
- meta: {
1741
- title: "页面不存在",
1742
- public: !0,
1743
- hidden: !0
1744
- }
1745
- }
1746
- ]
1747
- }];
1748
- }
1749
- //#endregion
1750
- //#region src/main/router/index.ts
1751
- function qn(e = []) {
1752
- let t = Array.isArray(e) ? { businessRoutes: e } : e, n = m({
1753
- history: t.history ?? h("/"),
1754
- routes: Kn(t.businessRoutes ?? []),
1755
- scrollBehavior: t.scrollBehavior ?? (() => ({ top: 0 }))
1756
- });
1757
- return He(n), t.setupRouter?.(n), n;
1758
- }
1759
- //#endregion
1760
- //#region src/main/directives/index.ts
1761
- var Jn = {
1762
- mounted(e, t) {
1763
- Yn(e, t.value);
1764
- },
1765
- updated(e, t) {
1766
- Yn(e, t.value);
1767
- }
1768
- };
1769
- function Yn(e, t) {
1770
- let n = a(), r = Xn(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));
1771
- if (!r.length || s) {
1772
- e.style.display = "", e.hidden = !1, o && (e.removeAttribute("disabled"), e.classList.remove("is-disabled"));
1773
- return;
1774
- }
1775
- if (o) {
1776
- e.setAttribute("disabled", "disabled"), e.classList.add("is-disabled");
1777
- return;
1778
- }
1779
- e.style.display = "none", e.hidden = !0;
1780
- }
1781
- function Xn(e) {
1782
- return typeof e == "string" ? e ? [e] : [] : Array.isArray(e) ? e : e.permissions ?? [];
1783
- }
1784
- function Zn(e) {
1785
- e.directive("permission", Jn);
1786
- }
1787
- //#endregion
1788
- //#region src/main/app/create-app.ts
1789
- async function Qn(e) {
1790
- Pe(e.appConfig), ze();
1791
- let t = qn({
1792
- businessRoutes: e.businessRoutes,
1793
- history: e.routerHistory,
1794
- scrollBehavior: e.routerScrollBehavior,
1795
- setupRouter: e.setupRouter
1796
- }), n = E(e.rootComponent), r = re(), i = {
1797
- app: n,
1798
- router: t,
1799
- pinia: r,
1800
- http: Ie,
1801
- requestManager: Re
1802
- };
1803
- ke(), n.use(y, { locale: je }), n.use(r), n.use(t), Zn(n), Me(t), await e.setupApp?.(i), await e.beforePlatformInit?.(i);
1804
- let a = f(r), o = l(r), s = Q(r), c = Oe({ fullscreen: !0 });
1805
- try {
1806
- await Promise.all([
1807
- a.initializePreferences(),
1808
- o.initializeSystemConfig(),
1809
- s.initializeTabs()
1810
- ]);
1811
- } finally {
1812
- c.close();
1813
- }
1814
- await e.afterPlatformInit?.(i), await e.beforeMount?.(i);
1815
- let u = n.mount("#app"), d = {
1816
- ...i,
1817
- vm: u
1818
- };
1819
- return await e.afterMount?.(d), n;
1820
- }
1821
- //#endregion
1822
- export { X as a, Le as c, Me as d, Mn as i, Ie as l, qn as n, Q as o, Kn as r, ze as s, Qn as t, Re as u };