@morningfast/platform 0.0.6

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