@lumal/core 0.0.1-beta
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.
- package/LICENSE +21 -0
- package/README.md +16 -0
- package/dist/LumalThemeSettingsPanel-BFkZzwEW.js +685 -0
- package/dist/LumalThemeSettingsPanel-C6aPhgUX.cjs +1 -0
- package/dist/_plugin-vue_export-helper-B3ysoDQm.js +8 -0
- package/dist/_plugin-vue_export-helper-BTmtiIyf.cjs +1 -0
- package/dist/auth.cjs +1 -0
- package/dist/auth.js +127 -0
- package/dist/components-DJiHYQQB.cjs +2 -0
- package/dist/components-DYmKh-eF.js +2206 -0
- package/dist/components.cjs +1 -0
- package/dist/components.js +3 -0
- package/dist/composables-C4twj5Ov.cjs +1 -0
- package/dist/composables-C9EuCUjj.js +130 -0
- package/dist/composables.cjs +1 -0
- package/dist/composables.js +148 -0
- package/dist/core.css +2 -0
- package/dist/dictionary-B7tsaVqB.js +19 -0
- package/dist/dictionary-ClEWtQCU.cjs +1 -0
- package/dist/dictionary.cjs +1 -0
- package/dist/dictionary.js +3 -0
- package/dist/directive-D-fB5qbY.js +16 -0
- package/dist/directive-DSVr7QvO.cjs +1 -0
- package/dist/directives.cjs +1 -0
- package/dist/directives.js +11 -0
- package/dist/index.cjs +1 -0
- package/dist/index.js +88 -0
- package/dist/layout-C8H9wuQa.js +2075 -0
- package/dist/layout-ZnyG9X3N.cjs +1 -0
- package/dist/layout.cjs +1 -0
- package/dist/layout.js +2 -0
- package/dist/permission-6sXtjGMS.cjs +1 -0
- package/dist/permission-CCkqvnWg.js +104 -0
- package/dist/permission.cjs +1 -0
- package/dist/permission.js +3 -0
- package/dist/request.cjs +1 -0
- package/dist/request.js +277 -0
- package/dist/router.cjs +1 -0
- package/dist/router.js +510 -0
- package/dist/src/app/createLumalAdmin.d.ts +4 -0
- package/dist/src/app/createLumalAdmin.d.ts.map +1 -0
- package/dist/src/app/default-components.d.ts +4 -0
- package/dist/src/app/default-components.d.ts.map +1 -0
- package/dist/src/app/index.d.ts +3 -0
- package/dist/src/app/index.d.ts.map +1 -0
- package/dist/src/app/types.d.ts +41 -0
- package/dist/src/app/types.d.ts.map +1 -0
- package/dist/src/auth/adapter.d.ts +3 -0
- package/dist/src/auth/adapter.d.ts.map +1 -0
- package/dist/src/auth/createAuthSession.d.ts +8 -0
- package/dist/src/auth/createAuthSession.d.ts.map +1 -0
- package/dist/src/auth/index.d.ts +8 -0
- package/dist/src/auth/index.d.ts.map +1 -0
- package/dist/src/auth/redirect.d.ts +8 -0
- package/dist/src/auth/redirect.d.ts.map +1 -0
- package/dist/src/auth/session-expired.d.ts +5 -0
- package/dist/src/auth/session-expired.d.ts.map +1 -0
- package/dist/src/auth/session.d.ts +10 -0
- package/dist/src/auth/session.d.ts.map +1 -0
- package/dist/src/auth/storage.d.ts +7 -0
- package/dist/src/auth/storage.d.ts.map +1 -0
- package/dist/src/auth/types.d.ts +68 -0
- package/dist/src/auth/types.d.ts.map +1 -0
- package/dist/src/components/crud-table/LumalCrudEditor.vue.d.ts +41 -0
- package/dist/src/components/crud-table/LumalCrudEditor.vue.d.ts.map +1 -0
- package/dist/src/components/crud-table/LumalCrudTable.vue.d.ts +151 -0
- package/dist/src/components/crud-table/LumalCrudTable.vue.d.ts.map +1 -0
- package/dist/src/components/crud-table/index.d.ts +4 -0
- package/dist/src/components/crud-table/index.d.ts.map +1 -0
- package/dist/src/components/crud-table/schema.d.ts +4 -0
- package/dist/src/components/crud-table/schema.d.ts.map +1 -0
- package/dist/src/components/crud-table/types.d.ts +165 -0
- package/dist/src/components/crud-table/types.d.ts.map +1 -0
- package/dist/src/components/crud-table/useCrudData.d.ts +20 -0
- package/dist/src/components/crud-table/useCrudData.d.ts.map +1 -0
- package/dist/src/components/crud-table/useCrudDialog.d.ts +19 -0
- package/dist/src/components/crud-table/useCrudDialog.d.ts.map +1 -0
- package/dist/src/components/crud-table/useCrudQuery.d.ts +18 -0
- package/dist/src/components/crud-table/useCrudQuery.d.ts.map +1 -0
- package/dist/src/components/crud-table/useCrudSelection.d.ts +9 -0
- package/dist/src/components/crud-table/useCrudSelection.d.ts.map +1 -0
- package/dist/src/components/info-table/LumalInfoTable.vue.d.ts +12 -0
- package/dist/src/components/info-table/LumalInfoTable.vue.d.ts.map +1 -0
- package/dist/src/components/info-table/index.d.ts +3 -0
- package/dist/src/components/info-table/index.d.ts.map +1 -0
- package/dist/src/components/info-table/types.d.ts +15 -0
- package/dist/src/components/info-table/types.d.ts.map +1 -0
- package/dist/src/components/page/LumalPage.vue.d.ts +36 -0
- package/dist/src/components/page/LumalPage.vue.d.ts.map +1 -0
- package/dist/src/components/page/index.d.ts +2 -0
- package/dist/src/components/page/index.d.ts.map +1 -0
- package/dist/src/components/page-layout/LumalPageLayout.vue.d.ts +38 -0
- package/dist/src/components/page-layout/LumalPageLayout.vue.d.ts.map +1 -0
- package/dist/src/components/page-layout/index.d.ts +3 -0
- package/dist/src/components/page-layout/index.d.ts.map +1 -0
- package/dist/src/components/page-layout/types.d.ts +9 -0
- package/dist/src/components/page-layout/types.d.ts.map +1 -0
- package/dist/src/components/pagination/LumalPagination.vue.d.ts +31 -0
- package/dist/src/components/pagination/LumalPagination.vue.d.ts.map +1 -0
- package/dist/src/components/pagination/index.d.ts +3 -0
- package/dist/src/components/pagination/index.d.ts.map +1 -0
- package/dist/src/components/pagination/types.d.ts +5 -0
- package/dist/src/components/pagination/types.d.ts.map +1 -0
- package/dist/src/components/schema-form/LumalSchemaForm.vue.d.ts +78 -0
- package/dist/src/components/schema-form/LumalSchemaForm.vue.d.ts.map +1 -0
- package/dist/src/components/schema-form/index.d.ts +4 -0
- package/dist/src/components/schema-form/index.d.ts.map +1 -0
- package/dist/src/components/schema-form/normalize.d.ts +11 -0
- package/dist/src/components/schema-form/normalize.d.ts.map +1 -0
- package/dist/src/components/schema-form/types.d.ts +103 -0
- package/dist/src/components/schema-form/types.d.ts.map +1 -0
- package/dist/src/components/schema-form/types.type-test.d.ts +2 -0
- package/dist/src/components/schema-form/types.type-test.d.ts.map +1 -0
- package/dist/src/components/schema-table/LumalSchemaTable.vue.d.ts +108 -0
- package/dist/src/components/schema-table/LumalSchemaTable.vue.d.ts.map +1 -0
- package/dist/src/components/schema-table/LumalSchemaTableCell.vue.d.ts +8 -0
- package/dist/src/components/schema-table/LumalSchemaTableCell.vue.d.ts.map +1 -0
- package/dist/src/components/schema-table/cell.d.ts +13 -0
- package/dist/src/components/schema-table/cell.d.ts.map +1 -0
- package/dist/src/components/schema-table/index.d.ts +6 -0
- package/dist/src/components/schema-table/index.d.ts.map +1 -0
- package/dist/src/components/schema-table/normalize.d.ts +8 -0
- package/dist/src/components/schema-table/normalize.d.ts.map +1 -0
- package/dist/src/components/schema-table/types.d.ts +66 -0
- package/dist/src/components/schema-table/types.d.ts.map +1 -0
- package/dist/src/components/schema-table/types.type-test.d.ts +2 -0
- package/dist/src/components/schema-table/types.type-test.d.ts.map +1 -0
- package/dist/src/composables/index.d.ts +11 -0
- package/dist/src/composables/index.d.ts.map +1 -0
- package/dist/src/composables/useConfirmAction.d.ts +21 -0
- package/dist/src/composables/useConfirmAction.d.ts.map +1 -0
- package/dist/src/composables/useFullscreen.d.ts +14 -0
- package/dist/src/composables/useFullscreen.d.ts.map +1 -0
- package/dist/src/composables/usePagination.d.ts +36 -0
- package/dist/src/composables/usePagination.d.ts.map +1 -0
- package/dist/src/composables/usePersistentState.d.ts +9 -0
- package/dist/src/composables/usePersistentState.d.ts.map +1 -0
- package/dist/src/composables/useSelection.d.ts +20 -0
- package/dist/src/composables/useSelection.d.ts.map +1 -0
- package/dist/src/dictionary/composables.d.ts +15 -0
- package/dist/src/dictionary/composables.d.ts.map +1 -0
- package/dist/src/dictionary/context.d.ts +10 -0
- package/dist/src/dictionary/context.d.ts.map +1 -0
- package/dist/src/dictionary/fetcher.d.ts +4 -0
- package/dist/src/dictionary/fetcher.d.ts.map +1 -0
- package/dist/src/dictionary/index.d.ts +8 -0
- package/dist/src/dictionary/index.d.ts.map +1 -0
- package/dist/src/dictionary/normalize.d.ts +5 -0
- package/dist/src/dictionary/normalize.d.ts.map +1 -0
- package/dist/src/dictionary/store.d.ts +4 -0
- package/dist/src/dictionary/store.d.ts.map +1 -0
- package/dist/src/dictionary/types.d.ts +53 -0
- package/dist/src/dictionary/types.d.ts.map +1 -0
- package/dist/src/directives/index.d.ts +16 -0
- package/dist/src/directives/index.d.ts.map +1 -0
- package/dist/src/exports/components.d.ts +16 -0
- package/dist/src/exports/components.d.ts.map +1 -0
- package/dist/src/index.d.ts +6 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/layout/LumalBreadcrumb.vue.d.ts +28 -0
- package/dist/src/layout/LumalBreadcrumb.vue.d.ts.map +1 -0
- package/dist/src/layout/LumalContent.vue.d.ts +18 -0
- package/dist/src/layout/LumalContent.vue.d.ts.map +1 -0
- package/dist/src/layout/LumalGlobalSearch.vue.d.ts +25 -0
- package/dist/src/layout/LumalGlobalSearch.vue.d.ts.map +1 -0
- package/dist/src/layout/LumalHeader.vue.d.ts +43 -0
- package/dist/src/layout/LumalHeader.vue.d.ts.map +1 -0
- package/dist/src/layout/LumalLayout.vue.d.ts +98 -0
- package/dist/src/layout/LumalLayout.vue.d.ts.map +1 -0
- package/dist/src/layout/LumalMenuBadge.vue.d.ts +16 -0
- package/dist/src/layout/LumalMenuBadge.vue.d.ts.map +1 -0
- package/dist/src/layout/LumalRouterView.vue.d.ts +24 -0
- package/dist/src/layout/LumalRouterView.vue.d.ts.map +1 -0
- package/dist/src/layout/LumalSidebar.vue.d.ts +29 -0
- package/dist/src/layout/LumalSidebar.vue.d.ts.map +1 -0
- package/dist/src/layout/LumalSidebarMenuItem.vue.d.ts +16 -0
- package/dist/src/layout/LumalSidebarMenuItem.vue.d.ts.map +1 -0
- package/dist/src/layout/LumalTabs.vue.d.ts +76 -0
- package/dist/src/layout/LumalTabs.vue.d.ts.map +1 -0
- package/dist/src/layout/LumalTopNav.vue.d.ts +27 -0
- package/dist/src/layout/LumalTopNav.vue.d.ts.map +1 -0
- package/dist/src/layout/LumalTopNavMenuItem.vue.d.ts +15 -0
- package/dist/src/layout/LumalTopNavMenuItem.vue.d.ts.map +1 -0
- package/dist/src/layout/index.d.ts +18 -0
- package/dist/src/layout/index.d.ts.map +1 -0
- package/dist/src/layout/state/menu-layout.d.ts +35 -0
- package/dist/src/layout/state/menu-layout.d.ts.map +1 -0
- package/dist/src/layout/state/tab-storage.d.ts +51 -0
- package/dist/src/layout/state/tab-storage.d.ts.map +1 -0
- package/dist/src/layout/state/tab-strategy.d.ts +73 -0
- package/dist/src/layout/state/tab-strategy.d.ts.map +1 -0
- package/dist/src/layout/types.d.ts +29 -0
- package/dist/src/layout/types.d.ts.map +1 -0
- package/dist/src/permission/LumalAccessControl.vue.d.ts +26 -0
- package/dist/src/permission/LumalAccessControl.vue.d.ts.map +1 -0
- package/dist/src/permission/context.d.ts +6 -0
- package/dist/src/permission/context.d.ts.map +1 -0
- package/dist/src/permission/directive.d.ts +3 -0
- package/dist/src/permission/directive.d.ts.map +1 -0
- package/dist/src/permission/guard.d.ts +4 -0
- package/dist/src/permission/guard.d.ts.map +1 -0
- package/dist/src/permission/helpers.d.ts +4 -0
- package/dist/src/permission/helpers.d.ts.map +1 -0
- package/dist/src/permission/index.d.ts +8 -0
- package/dist/src/permission/index.d.ts.map +1 -0
- package/dist/src/permission/store.d.ts +4 -0
- package/dist/src/permission/store.d.ts.map +1 -0
- package/dist/src/permission/types.d.ts +67 -0
- package/dist/src/permission/types.d.ts.map +1 -0
- package/dist/src/request/cache.d.ts +8 -0
- package/dist/src/request/cache.d.ts.map +1 -0
- package/dist/src/request/client.d.ts +4 -0
- package/dist/src/request/client.d.ts.map +1 -0
- package/dist/src/request/error.d.ts +19 -0
- package/dist/src/request/error.d.ts.map +1 -0
- package/dist/src/request/index.d.ts +8 -0
- package/dist/src/request/index.d.ts.map +1 -0
- package/dist/src/request/standard.d.ts +61 -0
- package/dist/src/request/standard.d.ts.map +1 -0
- package/dist/src/request/types.d.ts +102 -0
- package/dist/src/request/types.d.ts.map +1 -0
- package/dist/src/router/index.d.ts +36 -0
- package/dist/src/router/index.d.ts.map +1 -0
- package/dist/src/router/types.d.ts +231 -0
- package/dist/src/router/types.d.ts.map +1 -0
- package/dist/src/theme/LumalThemeSettingsPanel.vue.d.ts +33 -0
- package/dist/src/theme/LumalThemeSettingsPanel.vue.d.ts.map +1 -0
- package/dist/src/theme/dom.d.ts +6 -0
- package/dist/src/theme/dom.d.ts.map +1 -0
- package/dist/src/theme/index.d.ts +11 -0
- package/dist/src/theme/index.d.ts.map +1 -0
- package/dist/src/theme/preferences-store.d.ts +4 -0
- package/dist/src/theme/preferences-store.d.ts.map +1 -0
- package/dist/src/theme/preferences.d.ts +18 -0
- package/dist/src/theme/preferences.d.ts.map +1 -0
- package/dist/src/theme/store.d.ts +3 -0
- package/dist/src/theme/store.d.ts.map +1 -0
- package/dist/src/theme/theme-color-presets.d.ts +13 -0
- package/dist/src/theme/theme-color-presets.d.ts.map +1 -0
- package/dist/src/theme/tokens.d.ts +5 -0
- package/dist/src/theme/tokens.d.ts.map +1 -0
- package/dist/src/theme/types.d.ts +103 -0
- package/dist/src/theme/types.d.ts.map +1 -0
- package/dist/src/utils/clone.d.ts +12 -0
- package/dist/src/utils/clone.d.ts.map +1 -0
- package/dist/src/utils/color.d.ts +6 -0
- package/dist/src/utils/color.d.ts.map +1 -0
- package/dist/src/utils/display.d.ts +10 -0
- package/dist/src/utils/display.d.ts.map +1 -0
- package/dist/src/utils/download.d.ts +10 -0
- package/dist/src/utils/download.d.ts.map +1 -0
- package/dist/src/utils/index.d.ts +12 -0
- package/dist/src/utils/index.d.ts.map +1 -0
- package/dist/src/utils/object.d.ts +6 -0
- package/dist/src/utils/object.d.ts.map +1 -0
- package/dist/src/utils/path.d.ts +6 -0
- package/dist/src/utils/path.d.ts.map +1 -0
- package/dist/src/utils/query.d.ts +9 -0
- package/dist/src/utils/query.d.ts.map +1 -0
- package/dist/src/utils/storage.d.ts +7 -0
- package/dist/src/utils/storage.d.ts.map +1 -0
- package/dist/src/utils/types.d.ts +13 -0
- package/dist/src/utils/types.d.ts.map +1 -0
- package/dist/src/utils/with-install.d.ts +11 -0
- package/dist/src/utils/with-install.d.ts.map +1 -0
- package/dist/theme.cjs +1 -0
- package/dist/theme.js +187 -0
- package/dist/utils.cjs +1 -0
- package/dist/utils.js +130 -0
- package/package.json +124 -0
- package/theme-chalk/index.scss +70 -0
|
@@ -0,0 +1,2075 @@
|
|
|
1
|
+
import { t as e } from "./_plugin-vue_export-helper-B3ysoDQm.js";
|
|
2
|
+
import { Fragment as t, KeepAlive as n, Teleport as r, Transition as i, TransitionGroup as a, computed as o, createBlock as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, createSlots as d, createVNode as f, defineComponent as p, inject as m, mergeModels as h, mergeProps as g, nextTick as _, normalizeClass as v, normalizeStyle as y, onBeforeUnmount as ee, onMounted as te, openBlock as b, ref as x, renderList as S, renderSlot as C, resolveComponent as w, resolveDynamicComponent as T, shallowRef as E, toDisplayString as D, unref as O, useId as k, useModel as ne, useTemplateRef as A, vModelText as j, vShow as re, watch as M, withCtx as N, withDirectives as ie, withModifiers as ae } from "vue";
|
|
3
|
+
import { LumalIcon as P } from "@lumal/icons-vue";
|
|
4
|
+
import { ElAside as F, ElButton as I, ElContainer as L, ElHeader as oe, ElMain as se, ElMenu as ce, ElMenuItem as R, ElScrollbar as z, ElSubMenu as B } from "element-plus";
|
|
5
|
+
import { RouterView as le, routeLocationKey as ue, routerKey as de } from "vue-router";
|
|
6
|
+
import fe from "sortablejs";
|
|
7
|
+
//#region src/layout/state/menu-layout.ts
|
|
8
|
+
function V(e, t) {
|
|
9
|
+
return e.hidden ? !1 : e.path === t ? !0 : e.children?.some((e) => V(e, t)) ?? !1;
|
|
10
|
+
}
|
|
11
|
+
function H(e, t) {
|
|
12
|
+
for (let n of e) {
|
|
13
|
+
if (n.hidden) continue;
|
|
14
|
+
if (n.path === t) return n;
|
|
15
|
+
let e = H(n.children ?? [], t);
|
|
16
|
+
if (e) return e;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function U(e, t) {
|
|
20
|
+
for (let n of e) {
|
|
21
|
+
if (n.hidden) continue;
|
|
22
|
+
if (n.path === t) return [n];
|
|
23
|
+
let e = U(n.children ?? [], t);
|
|
24
|
+
if (e.length > 0) return [n, ...e];
|
|
25
|
+
}
|
|
26
|
+
return [];
|
|
27
|
+
}
|
|
28
|
+
function pe(e) {
|
|
29
|
+
if (!e) return "";
|
|
30
|
+
if (e.redirect) return e.redirect;
|
|
31
|
+
let t = e.children?.filter((e) => !e.hidden) ?? [];
|
|
32
|
+
return t.length === 0 ? e.path : pe(t[0]);
|
|
33
|
+
}
|
|
34
|
+
function me(e, t) {
|
|
35
|
+
return e.find((e) => V(e, t))?.path ?? "";
|
|
36
|
+
}
|
|
37
|
+
function he(e) {
|
|
38
|
+
let { activeTopMenuPath: t = "", layout: n } = e, r = e.menus.filter((e) => !e.hidden);
|
|
39
|
+
return n === "sidebar-nav" ? {
|
|
40
|
+
sidebarMenus: r,
|
|
41
|
+
topMenus: []
|
|
42
|
+
} : n === "top-nav" ? {
|
|
43
|
+
sidebarMenus: [],
|
|
44
|
+
topMenus: r
|
|
45
|
+
} : {
|
|
46
|
+
sidebarMenus: (r.find((e) => e.path === t) ?? r.find((e) => V(e, t)))?.children?.filter((e) => !e.hidden) ?? [],
|
|
47
|
+
topMenus: r
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
//#endregion
|
|
51
|
+
//#region src/layout/LumalBreadcrumb.vue?vue&type=script&setup=true&lang.ts
|
|
52
|
+
var W = {
|
|
53
|
+
key: 0,
|
|
54
|
+
class: "lumal-breadcrumb",
|
|
55
|
+
"aria-label": "面包屑"
|
|
56
|
+
}, ge = { class: "lumal-breadcrumb__list" }, G = {
|
|
57
|
+
key: 1,
|
|
58
|
+
class: "lumal-breadcrumb__current",
|
|
59
|
+
"aria-current": "page"
|
|
60
|
+
}, _e = ["onClick"], K = /*#__PURE__*/ e(/* @__PURE__ */ p({
|
|
61
|
+
__name: "LumalBreadcrumb",
|
|
62
|
+
props: {
|
|
63
|
+
activeMenuPath: { default: "" },
|
|
64
|
+
activePath: { default: "" },
|
|
65
|
+
hideOnlyOne: {
|
|
66
|
+
type: Boolean,
|
|
67
|
+
default: !1
|
|
68
|
+
},
|
|
69
|
+
homePath: { default: "" },
|
|
70
|
+
homeTitle: { default: "首页" },
|
|
71
|
+
menus: { default: () => [] },
|
|
72
|
+
showHome: {
|
|
73
|
+
type: Boolean,
|
|
74
|
+
default: !0
|
|
75
|
+
},
|
|
76
|
+
showIcon: {
|
|
77
|
+
type: Boolean,
|
|
78
|
+
default: !0
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
emits: ["select"],
|
|
82
|
+
setup(e, { emit: n }) {
|
|
83
|
+
let r = e, i = n, a = m(ue, void 0);
|
|
84
|
+
function d(e) {
|
|
85
|
+
return {
|
|
86
|
+
icon: e.icon,
|
|
87
|
+
path: e.path,
|
|
88
|
+
title: e.title
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
let f = o(() => {
|
|
92
|
+
let e = a?.matched ?? [];
|
|
93
|
+
return e.flatMap((t, n) => {
|
|
94
|
+
let r = typeof t.meta.title == "string" ? t.meta.title.trim() : "";
|
|
95
|
+
if (!r || t.meta.hideInBreadcrumb === !0) return [];
|
|
96
|
+
let i = n === e.length - 1;
|
|
97
|
+
return [{
|
|
98
|
+
icon: typeof t.meta.icon == "string" ? t.meta.icon : void 0,
|
|
99
|
+
path: i ? a?.path ?? t.path : t.path,
|
|
100
|
+
title: r
|
|
101
|
+
}];
|
|
102
|
+
});
|
|
103
|
+
}), p = o(() => {
|
|
104
|
+
let e = U(r.menus, r.activePath), t = (e.length > 0 ? e : U(r.menus, r.activeMenuPath)).map(d), n = typeof a?.meta.title == "string" ? a.meta.title : "", i = typeof a?.meta.icon == "string" ? a.meta.icon : void 0, o = a?.meta.hideInBreadcrumb === !0;
|
|
105
|
+
return o && t.at(-1)?.path === r.activePath && t.pop(), n && !o && r.activePath && r.activePath === a?.path && !t.some((e) => e.path === r.activePath) && t.push({
|
|
106
|
+
icon: i,
|
|
107
|
+
path: r.activePath,
|
|
108
|
+
title: n
|
|
109
|
+
}), t;
|
|
110
|
+
}), h = o(() => f.value.length > 0 ? f.value : p.value), g = o(() => {
|
|
111
|
+
let e = r.homePath ? U(r.menus, r.homePath).at(-1) : void 0, t = r.menus.find((e) => !e.hidden), n = r.homePath || pe(t);
|
|
112
|
+
if (n) return {
|
|
113
|
+
icon: e?.icon ?? t?.icon,
|
|
114
|
+
path: n,
|
|
115
|
+
title: e?.title ?? r.homeTitle
|
|
116
|
+
};
|
|
117
|
+
}), _ = o(() => {
|
|
118
|
+
let e = [...h.value], t = g.value;
|
|
119
|
+
return r.showHome && t && !e.some((e) => e.path === t.path) && e.unshift(t), e;
|
|
120
|
+
}), v = o(() => _.value.length > 0 && !(r.hideOnlyOne && h.value.length <= 1));
|
|
121
|
+
return (n, r) => v.value ? (b(), l("nav", W, [u("ol", ge, [(b(!0), l(t, null, S(_.value, (t, n) => (b(), l("li", {
|
|
122
|
+
key: `${t.path}:${n}`,
|
|
123
|
+
class: "lumal-breadcrumb__item"
|
|
124
|
+
}, [n > 0 ? (b(), s(O(P), {
|
|
125
|
+
key: 0,
|
|
126
|
+
class: "lumal-breadcrumb__separator",
|
|
127
|
+
name: "lumal:chevron-right",
|
|
128
|
+
size: 14
|
|
129
|
+
})) : c("", !0), n === _.value.length - 1 ? (b(), l("span", G, [e.showIcon && t.icon ? (b(), s(O(P), {
|
|
130
|
+
key: 0,
|
|
131
|
+
name: t.icon,
|
|
132
|
+
size: 15
|
|
133
|
+
}, null, 8, ["name"])) : c("", !0), u("span", null, D(t.title), 1)])) : (b(), l("button", {
|
|
134
|
+
key: 2,
|
|
135
|
+
class: "lumal-breadcrumb__link",
|
|
136
|
+
type: "button",
|
|
137
|
+
onClick: (e) => i("select", t.path)
|
|
138
|
+
}, [e.showIcon && t.icon ? (b(), s(O(P), {
|
|
139
|
+
key: 0,
|
|
140
|
+
name: t.icon,
|
|
141
|
+
size: 15
|
|
142
|
+
}, null, 8, ["name"])) : c("", !0), u("span", null, D(t.title), 1)], 8, _e))]))), 128))])])) : c("", !0);
|
|
143
|
+
}
|
|
144
|
+
}), [["__scopeId", "data-v-53a036d9"]]), ve = /*#__PURE__*/ e(/* @__PURE__ */ p({
|
|
145
|
+
__name: "LumalContent",
|
|
146
|
+
setup(e, { expose: t }) {
|
|
147
|
+
let n = A("contentRef");
|
|
148
|
+
return t({
|
|
149
|
+
getContentElement: () => n.value?.$el,
|
|
150
|
+
getContentInstance: () => n.value
|
|
151
|
+
}), (e, t) => (b(), s(O(se), {
|
|
152
|
+
ref_key: "contentRef",
|
|
153
|
+
ref: n,
|
|
154
|
+
class: "lumal-content"
|
|
155
|
+
}, {
|
|
156
|
+
default: N(() => [C(e.$slots, "default", {}, void 0, !0)]),
|
|
157
|
+
_: 3
|
|
158
|
+
}, 512));
|
|
159
|
+
}
|
|
160
|
+
}), [["__scopeId", "data-v-50b337c5"]]), ye = { class: "lumal-global-search" }, q = { key: 0 }, J = ["aria-labelledby"], be = { class: "lumal-global-search__header" }, Y = ["id"], xe = { class: "lumal-global-search__input-wrap" }, X = [
|
|
161
|
+
"aria-activedescendant",
|
|
162
|
+
"aria-controls",
|
|
163
|
+
"placeholder"
|
|
164
|
+
], Z = ["id"], Se = ["id", "aria-selected"], Ce = ["onMouseenter", "onClick"], we = {
|
|
165
|
+
key: 0,
|
|
166
|
+
class: "lumal-global-search__empty",
|
|
167
|
+
role: "status"
|
|
168
|
+
}, Te = "<svg viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><circle cx=\"11\" cy=\"11\" r=\"7\" stroke=\"currentColor\" stroke-width=\"1.8\"/><path d=\"m16.2 16.2 4 4\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\"/></svg>", Ee = /*#__PURE__*/ e(/* @__PURE__ */ p({
|
|
169
|
+
__name: "LumalGlobalSearch",
|
|
170
|
+
props: {
|
|
171
|
+
maxResults: { default: 12 },
|
|
172
|
+
menus: { default: () => [] },
|
|
173
|
+
placeholder: { default: "搜索菜单" },
|
|
174
|
+
shortcut: {
|
|
175
|
+
type: Boolean,
|
|
176
|
+
default: !0
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
emits: ["select"],
|
|
180
|
+
setup(e, { expose: n, emit: i }) {
|
|
181
|
+
let a = e, d = i, p = `lumal-global-search-${k()}`, m = A("inputRef"), h = A("triggerRef"), g = x(!1), y = x(""), C = x(0);
|
|
182
|
+
function w(e, t = []) {
|
|
183
|
+
return e.flatMap((e) => {
|
|
184
|
+
if (e.hidden) return [];
|
|
185
|
+
let n = [...t, e.title];
|
|
186
|
+
return [{
|
|
187
|
+
item: e,
|
|
188
|
+
trail: n
|
|
189
|
+
}, ...w(e.children ?? [], n)];
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
let T = o(() => w(a.menus)), E = o(() => {
|
|
193
|
+
let e = y.value.trim().toLocaleLowerCase();
|
|
194
|
+
return (e ? T.value.filter(({ item: t, trail: n }) => `${n.join(" ")} ${t.path}`.toLocaleLowerCase().includes(e)) : T.value).slice(0, Math.max(1, a.maxResults));
|
|
195
|
+
}), ne = o(() => E.value[C.value] ? `${p}-option-${C.value}` : void 0);
|
|
196
|
+
function re() {
|
|
197
|
+
g.value = !0, y.value = "", C.value = 0, _(() => m.value?.focus());
|
|
198
|
+
}
|
|
199
|
+
function N(e = !0) {
|
|
200
|
+
g.value = !1, e && _(() => h.value?.focus());
|
|
201
|
+
}
|
|
202
|
+
function F(e) {
|
|
203
|
+
e && (d("select", e.item.path, e.item), N());
|
|
204
|
+
}
|
|
205
|
+
function I(e) {
|
|
206
|
+
if (e.key === "Escape") {
|
|
207
|
+
e.preventDefault(), N();
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
if (E.value.length !== 0) {
|
|
211
|
+
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
212
|
+
e.preventDefault();
|
|
213
|
+
let t = e.key === "ArrowDown" ? 1 : -1;
|
|
214
|
+
C.value = (C.value + t + E.value.length) % E.value.length;
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
e.key === "Enter" && (e.preventDefault(), F(E.value[C.value]));
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
function L(e) {
|
|
221
|
+
!a.shortcut || e.altKey || e.shiftKey || e.key.toLocaleLowerCase() !== "k" || !e.ctrlKey && !e.metaKey || (e.preventDefault(), g.value ? N(!1) : re());
|
|
222
|
+
}
|
|
223
|
+
return M(E, () => {
|
|
224
|
+
C.value = 0;
|
|
225
|
+
}), te(() => {
|
|
226
|
+
window.addEventListener("keydown", L);
|
|
227
|
+
}), ee(() => {
|
|
228
|
+
window.removeEventListener("keydown", L);
|
|
229
|
+
}), n({
|
|
230
|
+
close: N,
|
|
231
|
+
open: re
|
|
232
|
+
}), (n, i) => (b(), l("div", ye, [u("button", {
|
|
233
|
+
ref_key: "triggerRef",
|
|
234
|
+
ref: h,
|
|
235
|
+
class: "lumal-global-search__trigger",
|
|
236
|
+
type: "button",
|
|
237
|
+
"aria-label": "打开全局搜索",
|
|
238
|
+
title: "全局搜索",
|
|
239
|
+
onClick: re
|
|
240
|
+
}, [
|
|
241
|
+
f(O(P), {
|
|
242
|
+
icon: Te,
|
|
243
|
+
size: 17
|
|
244
|
+
}),
|
|
245
|
+
i[3] ||= u("span", { class: "lumal-global-search__trigger-label" }, "搜索", -1),
|
|
246
|
+
e.shortcut ? (b(), l("kbd", q, "Ctrl K")) : c("", !0)
|
|
247
|
+
], 512), (b(), s(r, { to: "body" }, [g.value ? (b(), l("div", {
|
|
248
|
+
key: 0,
|
|
249
|
+
class: "lumal-global-search__backdrop",
|
|
250
|
+
onMousedown: i[2] ||= ae((e) => N(), ["self"])
|
|
251
|
+
}, [u("section", {
|
|
252
|
+
class: "lumal-global-search__dialog",
|
|
253
|
+
role: "dialog",
|
|
254
|
+
"aria-modal": "true",
|
|
255
|
+
"aria-labelledby": `${p}-title`
|
|
256
|
+
}, [
|
|
257
|
+
u("header", be, [u("h2", { id: `${p}-title` }, " 全局搜索 ", 8, Y), u("button", {
|
|
258
|
+
type: "button",
|
|
259
|
+
"aria-label": "关闭全局搜索",
|
|
260
|
+
title: "关闭",
|
|
261
|
+
onClick: i[0] ||= (e) => N()
|
|
262
|
+
}, [f(O(P), {
|
|
263
|
+
name: "lumal:close",
|
|
264
|
+
size: 17
|
|
265
|
+
})])]),
|
|
266
|
+
u("label", xe, [
|
|
267
|
+
i[4] ||= u("span", { class: "lumal-global-search__sr-only" }, "搜索菜单", -1),
|
|
268
|
+
f(O(P), {
|
|
269
|
+
icon: Te,
|
|
270
|
+
size: 18
|
|
271
|
+
}),
|
|
272
|
+
ie(u("input", {
|
|
273
|
+
ref_key: "inputRef",
|
|
274
|
+
ref: m,
|
|
275
|
+
"onUpdate:modelValue": i[1] ||= (e) => y.value = e,
|
|
276
|
+
role: "combobox",
|
|
277
|
+
autocomplete: "off",
|
|
278
|
+
"aria-activedescendant": ne.value,
|
|
279
|
+
"aria-autocomplete": "list",
|
|
280
|
+
"aria-controls": `${p}-results`,
|
|
281
|
+
"aria-expanded": "true",
|
|
282
|
+
placeholder: e.placeholder,
|
|
283
|
+
onKeydown: I
|
|
284
|
+
}, null, 40, X), [[j, y.value]])
|
|
285
|
+
]),
|
|
286
|
+
u("ul", {
|
|
287
|
+
id: `${p}-results`,
|
|
288
|
+
class: "lumal-global-search__results",
|
|
289
|
+
role: "listbox"
|
|
290
|
+
}, [(b(!0), l(t, null, S(E.value, (e, t) => (b(), l("li", {
|
|
291
|
+
id: `${p}-option-${t}`,
|
|
292
|
+
key: e.item.path,
|
|
293
|
+
role: "option",
|
|
294
|
+
"aria-selected": t === C.value
|
|
295
|
+
}, [u("button", {
|
|
296
|
+
type: "button",
|
|
297
|
+
class: v({ "is-active": t === C.value }),
|
|
298
|
+
onMouseenter: (e) => C.value = t,
|
|
299
|
+
onClick: (t) => F(e)
|
|
300
|
+
}, [
|
|
301
|
+
e.item.icon ? (b(), s(O(P), {
|
|
302
|
+
key: 0,
|
|
303
|
+
name: e.item.icon,
|
|
304
|
+
size: 18
|
|
305
|
+
}, null, 8, ["name"])) : c("", !0),
|
|
306
|
+
u("span", null, [u("strong", null, D(e.item.title), 1), u("small", null, D(e.trail.join(" / ")), 1)]),
|
|
307
|
+
u("code", null, D(e.item.path), 1)
|
|
308
|
+
], 42, Ce)], 8, Se))), 128))], 8, Z),
|
|
309
|
+
E.value.length === 0 ? (b(), l("p", we, " 未找到匹配菜单,请尝试其他关键词 ")) : c("", !0)
|
|
310
|
+
], 8, J)], 32)) : c("", !0)]))]));
|
|
311
|
+
}
|
|
312
|
+
}), [["__scopeId", "data-v-a433539f"]]), De = { class: "lumal-header__left" }, Oe = {
|
|
313
|
+
key: 0,
|
|
314
|
+
class: "lumal-header__title"
|
|
315
|
+
}, ke = {
|
|
316
|
+
key: 0,
|
|
317
|
+
class: "lumal-header__breadcrumb"
|
|
318
|
+
}, Q = {
|
|
319
|
+
key: 1,
|
|
320
|
+
class: "lumal-header__navigation",
|
|
321
|
+
"aria-label": "主导航"
|
|
322
|
+
}, Ae = {
|
|
323
|
+
key: 2,
|
|
324
|
+
class: "lumal-header__actions"
|
|
325
|
+
}, je = /*#__PURE__*/ e(/* @__PURE__ */ p({
|
|
326
|
+
__name: "LumalHeader",
|
|
327
|
+
props: {
|
|
328
|
+
title: {},
|
|
329
|
+
collapsed: {
|
|
330
|
+
type: Boolean,
|
|
331
|
+
default: !1
|
|
332
|
+
},
|
|
333
|
+
height: { default: "50px" },
|
|
334
|
+
mobileOnlyToggle: {
|
|
335
|
+
type: Boolean,
|
|
336
|
+
default: !1
|
|
337
|
+
},
|
|
338
|
+
sidebarEnabled: {
|
|
339
|
+
type: Boolean,
|
|
340
|
+
default: !0
|
|
341
|
+
},
|
|
342
|
+
toggleAfterTitle: {
|
|
343
|
+
type: Boolean,
|
|
344
|
+
default: !1
|
|
345
|
+
}
|
|
346
|
+
},
|
|
347
|
+
emits: ["toggleCollapse"],
|
|
348
|
+
setup(e, { expose: t, emit: n }) {
|
|
349
|
+
let r = e, i = n, a = A("headerRef"), d = o(() => r.collapsed ? "展开侧边栏" : "收起侧边栏");
|
|
350
|
+
function f() {
|
|
351
|
+
i("toggleCollapse");
|
|
352
|
+
}
|
|
353
|
+
return t({
|
|
354
|
+
getHeaderElement: () => a.value?.$el,
|
|
355
|
+
getHeaderInstance: () => a.value
|
|
356
|
+
}), (t, n) => (b(), s(O(oe), {
|
|
357
|
+
ref_key: "headerRef",
|
|
358
|
+
ref: a,
|
|
359
|
+
class: "lumal-header",
|
|
360
|
+
height: e.height
|
|
361
|
+
}, {
|
|
362
|
+
default: N(() => [
|
|
363
|
+
u("div", De, [C(t.$slots, "logo", {}, () => [e.title ? (b(), l("span", Oe, D(e.title), 1)) : c("", !0)], !0), e.sidebarEnabled ? (b(), s(O(I), {
|
|
364
|
+
key: 0,
|
|
365
|
+
class: v(["lumal-header__toggle", {
|
|
366
|
+
"is-after-title": e.toggleAfterTitle,
|
|
367
|
+
"is-mobile-only": e.mobileOnlyToggle
|
|
368
|
+
}]),
|
|
369
|
+
text: "",
|
|
370
|
+
"aria-label": d.value,
|
|
371
|
+
"data-action": "toggle-sidebar",
|
|
372
|
+
onClick: f
|
|
373
|
+
}, {
|
|
374
|
+
default: N(() => [...n[0] ||= [u("svg", {
|
|
375
|
+
"aria-hidden": "true",
|
|
376
|
+
viewBox: "0 0 24 24"
|
|
377
|
+
}, [u("path", { d: "M4 7h16M4 12h16M4 17h16" })], -1)]]),
|
|
378
|
+
_: 1
|
|
379
|
+
}, 8, ["class", "aria-label"])) : c("", !0)]),
|
|
380
|
+
t.$slots.breadcrumb ? (b(), l("div", ke, [C(t.$slots, "breadcrumb", {}, void 0, !0)])) : c("", !0),
|
|
381
|
+
t.$slots.navigation ? (b(), l("nav", Q, [C(t.$slots, "navigation", {}, void 0, !0)])) : c("", !0),
|
|
382
|
+
t.$slots.actions ? (b(), l("div", Ae, [C(t.$slots, "actions", {}, void 0, !0)])) : c("", !0)
|
|
383
|
+
]),
|
|
384
|
+
_: 3
|
|
385
|
+
}, 8, ["height"]));
|
|
386
|
+
}
|
|
387
|
+
}), [["__scopeId", "data-v-e9574860"]]), Me = ["aria-label"], Ne = {
|
|
388
|
+
key: 0,
|
|
389
|
+
"aria-hidden": "true"
|
|
390
|
+
}, $ = /*#__PURE__*/ e(/* @__PURE__ */ p({
|
|
391
|
+
__name: "LumalMenuBadge",
|
|
392
|
+
props: {
|
|
393
|
+
badge: { default: "" },
|
|
394
|
+
label: { default: "菜单" },
|
|
395
|
+
tone: { default: "primary" },
|
|
396
|
+
type: { default: "text" }
|
|
397
|
+
},
|
|
398
|
+
setup(e) {
|
|
399
|
+
let t = e, n = o(() => t.type === "dot" || t.badge === 0 || !!t.badge), r = o(() => t.type === "dot" ? `${t.label}有新内容` : `${t.label}:${t.badge}`);
|
|
400
|
+
return (t, i) => n.value ? (b(), l("span", {
|
|
401
|
+
key: 0,
|
|
402
|
+
class: v(["lumal-menu-badge", [`is-${e.tone}`, { "is-dot": e.type === "dot" }]]),
|
|
403
|
+
role: "status",
|
|
404
|
+
"aria-label": r.value
|
|
405
|
+
}, [e.type === "text" ? (b(), l("span", Ne, D(e.badge), 1)) : c("", !0)], 10, Me)) : c("", !0);
|
|
406
|
+
}
|
|
407
|
+
}), [["__scopeId", "data-v-0ca73e4b"]]), Pe = {
|
|
408
|
+
key: 0,
|
|
409
|
+
class: "lumal-sidebar-menu-item__icon",
|
|
410
|
+
"aria-hidden": "true"
|
|
411
|
+
}, Fe = { class: "lumal-sidebar-menu-item__label" }, Ie = { class: "lumal-sidebar-menu-item__title" }, Le = {
|
|
412
|
+
key: 1,
|
|
413
|
+
class: "lumal-sidebar-menu-item__external",
|
|
414
|
+
"aria-hidden": "true"
|
|
415
|
+
}, Re = ["title"], ze = {
|
|
416
|
+
key: 0,
|
|
417
|
+
class: "lumal-sidebar-menu-item__icon",
|
|
418
|
+
"aria-hidden": "true"
|
|
419
|
+
}, Be = { class: "lumal-sidebar-menu-item__label" }, Ve = { class: "lumal-sidebar-menu-item__title" }, He = {
|
|
420
|
+
key: 0,
|
|
421
|
+
class: "lumal-sidebar-menu-item__icon",
|
|
422
|
+
"aria-hidden": "true"
|
|
423
|
+
}, Ue = { class: "lumal-sidebar-menu-item__label" }, We = { class: "lumal-sidebar-menu-item__title" }, Ge = {
|
|
424
|
+
key: 1,
|
|
425
|
+
class: "lumal-sidebar-menu-item__external",
|
|
426
|
+
"aria-hidden": "true"
|
|
427
|
+
}, Ke = /*#__PURE__*/ e(/* @__PURE__ */ p({
|
|
428
|
+
__name: "LumalSidebarMenuItem",
|
|
429
|
+
props: {
|
|
430
|
+
activePath: {},
|
|
431
|
+
collapsed: { type: Boolean },
|
|
432
|
+
depth: {},
|
|
433
|
+
item: {}
|
|
434
|
+
},
|
|
435
|
+
emits: ["select"],
|
|
436
|
+
setup(e, { emit: n }) {
|
|
437
|
+
let r = e, i = n, a = o(() => r.item.children?.filter((e) => !e.hidden) ?? []), d = o(() => a.value.length > 0), p = o(() => !!r.item.externalLink && r.item.externalTarget !== "_self");
|
|
438
|
+
function m(e) {
|
|
439
|
+
i("select", e);
|
|
440
|
+
}
|
|
441
|
+
return (n, r) => {
|
|
442
|
+
let i = w("LumalSidebarMenuItem", !0);
|
|
443
|
+
return d.value ? (b(), s(O(B), {
|
|
444
|
+
key: 0,
|
|
445
|
+
class: "lumal-sidebar-menu-item",
|
|
446
|
+
index: e.item.path,
|
|
447
|
+
title: e.collapsed ? e.item.title : void 0
|
|
448
|
+
}, {
|
|
449
|
+
title: N(() => [
|
|
450
|
+
e.item.icon ? (b(), l("i", Pe, [f(O(P), {
|
|
451
|
+
name: e.item.icon,
|
|
452
|
+
size: 16
|
|
453
|
+
}, null, 8, ["name"])])) : c("", !0),
|
|
454
|
+
u("span", Fe, [u("span", Ie, D(e.item.title), 1), f($, {
|
|
455
|
+
badge: e.item.badge,
|
|
456
|
+
label: e.item.title,
|
|
457
|
+
tone: e.item.badgeTone,
|
|
458
|
+
type: e.item.badgeType
|
|
459
|
+
}, null, 8, [
|
|
460
|
+
"badge",
|
|
461
|
+
"label",
|
|
462
|
+
"tone",
|
|
463
|
+
"type"
|
|
464
|
+
])]),
|
|
465
|
+
e.item.externalLink ? (b(), l("span", Le, "↗")) : c("", !0)
|
|
466
|
+
]),
|
|
467
|
+
default: N(() => [(b(!0), l(t, null, S(a.value, (t) => (b(), s(i, {
|
|
468
|
+
key: t.path,
|
|
469
|
+
item: t,
|
|
470
|
+
"active-path": e.activePath,
|
|
471
|
+
collapsed: e.collapsed,
|
|
472
|
+
depth: (e.depth ?? 0) + 1,
|
|
473
|
+
onSelect: m
|
|
474
|
+
}, null, 8, [
|
|
475
|
+
"item",
|
|
476
|
+
"active-path",
|
|
477
|
+
"collapsed",
|
|
478
|
+
"depth"
|
|
479
|
+
]))), 128))]),
|
|
480
|
+
_: 1
|
|
481
|
+
}, 8, ["index", "title"])) : p.value ? (b(), l("li", {
|
|
482
|
+
key: 1,
|
|
483
|
+
class: "el-menu-item lumal-sidebar-menu-item lumal-sidebar-menu-item--external",
|
|
484
|
+
role: "menuitem",
|
|
485
|
+
tabindex: "-1",
|
|
486
|
+
title: e.collapsed ? e.item.title : void 0,
|
|
487
|
+
onClick: r[0] ||= (t) => m(e.item.path)
|
|
488
|
+
}, [
|
|
489
|
+
e.item.icon ? (b(), l("i", ze, [f(O(P), {
|
|
490
|
+
name: e.item.icon,
|
|
491
|
+
size: 16
|
|
492
|
+
}, null, 8, ["name"])])) : c("", !0),
|
|
493
|
+
u("span", Be, [u("span", Ve, D(e.item.title), 1), f($, {
|
|
494
|
+
badge: e.item.badge,
|
|
495
|
+
label: e.item.title,
|
|
496
|
+
tone: e.item.badgeTone,
|
|
497
|
+
type: e.item.badgeType
|
|
498
|
+
}, null, 8, [
|
|
499
|
+
"badge",
|
|
500
|
+
"label",
|
|
501
|
+
"tone",
|
|
502
|
+
"type"
|
|
503
|
+
])]),
|
|
504
|
+
r[2] ||= u("span", {
|
|
505
|
+
class: "lumal-sidebar-menu-item__external",
|
|
506
|
+
"aria-hidden": "true"
|
|
507
|
+
}, "↗", -1)
|
|
508
|
+
], 8, Re)) : (b(), s(O(R), {
|
|
509
|
+
key: 2,
|
|
510
|
+
class: "lumal-sidebar-menu-item",
|
|
511
|
+
index: e.item.path,
|
|
512
|
+
title: e.collapsed ? e.item.title : void 0,
|
|
513
|
+
onClick: r[1] ||= (t) => m(e.item.path)
|
|
514
|
+
}, {
|
|
515
|
+
default: N(() => [
|
|
516
|
+
e.item.icon ? (b(), l("i", He, [f(O(P), {
|
|
517
|
+
name: e.item.icon,
|
|
518
|
+
size: 16
|
|
519
|
+
}, null, 8, ["name"])])) : c("", !0),
|
|
520
|
+
u("span", Ue, [u("span", We, D(e.item.title), 1), f($, {
|
|
521
|
+
badge: e.item.badge,
|
|
522
|
+
label: e.item.title,
|
|
523
|
+
tone: e.item.badgeTone,
|
|
524
|
+
type: e.item.badgeType
|
|
525
|
+
}, null, 8, [
|
|
526
|
+
"badge",
|
|
527
|
+
"label",
|
|
528
|
+
"tone",
|
|
529
|
+
"type"
|
|
530
|
+
])]),
|
|
531
|
+
e.item.externalLink ? (b(), l("span", Ge, "↗")) : c("", !0)
|
|
532
|
+
]),
|
|
533
|
+
_: 1
|
|
534
|
+
}, 8, ["index", "title"]));
|
|
535
|
+
};
|
|
536
|
+
}
|
|
537
|
+
}), [["__scopeId", "data-v-a5f8c946"]]), qe = /*#__PURE__*/ e(/* @__PURE__ */ p({
|
|
538
|
+
__name: "LumalSidebar",
|
|
539
|
+
props: {
|
|
540
|
+
menus: { default: () => [] },
|
|
541
|
+
activePath: { default: "" },
|
|
542
|
+
ariaLabel: { default: "侧边导航" },
|
|
543
|
+
collapsed: {
|
|
544
|
+
type: Boolean,
|
|
545
|
+
default: !1
|
|
546
|
+
},
|
|
547
|
+
width: { default: "280px" },
|
|
548
|
+
collapsedWidth: { default: "64px" }
|
|
549
|
+
},
|
|
550
|
+
emits: ["select"],
|
|
551
|
+
setup(e, { expose: n, emit: r }) {
|
|
552
|
+
let i = e, a = r, c = A("asideRef"), u = o(() => i.collapsed ? i.collapsedWidth : i.width);
|
|
553
|
+
function d(e) {
|
|
554
|
+
a("select", e);
|
|
555
|
+
}
|
|
556
|
+
return n({
|
|
557
|
+
getAsideElement: () => c.value?.$el,
|
|
558
|
+
getAsideInstance: () => c.value
|
|
559
|
+
}), (n, r) => (b(), s(O(F), {
|
|
560
|
+
ref_key: "asideRef",
|
|
561
|
+
ref: c,
|
|
562
|
+
class: "lumal-sidebar",
|
|
563
|
+
width: u.value,
|
|
564
|
+
"aria-label": e.ariaLabel
|
|
565
|
+
}, {
|
|
566
|
+
default: N(() => [f(O(z), { class: "lumal-sidebar__scrollbar" }, {
|
|
567
|
+
default: N(() => [f(O(ce), {
|
|
568
|
+
class: "lumal-sidebar__menu",
|
|
569
|
+
collapse: e.collapsed,
|
|
570
|
+
"default-active": e.activePath
|
|
571
|
+
}, {
|
|
572
|
+
default: N(() => [(b(!0), l(t, null, S(e.menus.filter((e) => !e.hidden), (t) => (b(), s(Ke, {
|
|
573
|
+
key: t.path,
|
|
574
|
+
item: t,
|
|
575
|
+
"active-path": e.activePath,
|
|
576
|
+
collapsed: e.collapsed,
|
|
577
|
+
depth: 0,
|
|
578
|
+
onSelect: d
|
|
579
|
+
}, null, 8, [
|
|
580
|
+
"item",
|
|
581
|
+
"active-path",
|
|
582
|
+
"collapsed"
|
|
583
|
+
]))), 128))]),
|
|
584
|
+
_: 1
|
|
585
|
+
}, 8, ["collapse", "default-active"])]),
|
|
586
|
+
_: 1
|
|
587
|
+
})]),
|
|
588
|
+
_: 1
|
|
589
|
+
}, 8, ["width", "aria-label"]));
|
|
590
|
+
}
|
|
591
|
+
}), [["__scopeId", "data-v-59a9bda5"]]), Je = ["disabled"], Ye = ["onContextmenu"], Xe = [
|
|
592
|
+
"aria-selected",
|
|
593
|
+
"tabindex",
|
|
594
|
+
"onClick",
|
|
595
|
+
"onKeydown",
|
|
596
|
+
"onMousedown"
|
|
597
|
+
], Ze = ["title"], Qe = ["aria-label", "onClick"], $e = ["disabled"], et = ["disabled"], tt = ["aria-expanded"], nt = ["aria-label"], rt = ["disabled"], it = ["disabled"], at = ["disabled"], ot = ["disabled"], st = ["disabled"], ct = ["disabled"], lt = ["disabled"], ut = ["disabled"], dt = ["disabled"], ft = 192, pt = 220, mt = /*#__PURE__*/ e(/* @__PURE__ */ p({
|
|
598
|
+
__name: "LumalTabs",
|
|
599
|
+
props: /*@__PURE__*/ h({
|
|
600
|
+
activePath: { default: "" },
|
|
601
|
+
draggable: {
|
|
602
|
+
type: Boolean,
|
|
603
|
+
default: !0
|
|
604
|
+
},
|
|
605
|
+
fullscreenTarget: { default: "[data-layout-fullscreen-target]" },
|
|
606
|
+
middleClickToClose: {
|
|
607
|
+
type: Boolean,
|
|
608
|
+
default: !0
|
|
609
|
+
},
|
|
610
|
+
showIcon: {
|
|
611
|
+
type: Boolean,
|
|
612
|
+
default: !0
|
|
613
|
+
},
|
|
614
|
+
showMaximize: {
|
|
615
|
+
type: Boolean,
|
|
616
|
+
default: !0
|
|
617
|
+
},
|
|
618
|
+
showMore: {
|
|
619
|
+
type: Boolean,
|
|
620
|
+
default: !0
|
|
621
|
+
},
|
|
622
|
+
showRefresh: {
|
|
623
|
+
type: Boolean,
|
|
624
|
+
default: !0
|
|
625
|
+
},
|
|
626
|
+
styleType: { default: "chrome" },
|
|
627
|
+
tabs: { default: () => [] },
|
|
628
|
+
visible: {
|
|
629
|
+
type: Boolean,
|
|
630
|
+
default: !0
|
|
631
|
+
},
|
|
632
|
+
wheelable: {
|
|
633
|
+
type: Boolean,
|
|
634
|
+
default: !0
|
|
635
|
+
},
|
|
636
|
+
standaloneMaximize: {
|
|
637
|
+
type: Boolean,
|
|
638
|
+
default: !1
|
|
639
|
+
}
|
|
640
|
+
}, {
|
|
641
|
+
activePath: { default: "" },
|
|
642
|
+
activePathModifiers: {}
|
|
643
|
+
}),
|
|
644
|
+
emits: /*@__PURE__*/ h([
|
|
645
|
+
"change",
|
|
646
|
+
"closeAll",
|
|
647
|
+
"closeLeft",
|
|
648
|
+
"closeOthers",
|
|
649
|
+
"closeRight",
|
|
650
|
+
"maximize",
|
|
651
|
+
"newWindow",
|
|
652
|
+
"pin",
|
|
653
|
+
"refresh",
|
|
654
|
+
"remove",
|
|
655
|
+
"reorder"
|
|
656
|
+
], ["update:activePath"]),
|
|
657
|
+
setup(e, { expose: n, emit: i }) {
|
|
658
|
+
let d = e, p = i, m = ne(e, "activePath"), h = A("tabsViewportRef"), g = E({
|
|
659
|
+
path: "",
|
|
660
|
+
style: {},
|
|
661
|
+
visible: !1
|
|
662
|
+
}), x = E({
|
|
663
|
+
path: "",
|
|
664
|
+
style: {},
|
|
665
|
+
visible: !1
|
|
666
|
+
}), C = E(!1), w = E(!1), T = E(!0), k = E(!1), j, F, I = null, L = o(() => g.value.visible ? g.value : x.value), oe = o(() => L.value.path), se = o(() => typeof window > "u" || typeof window.matchMedia != "function" || !window.matchMedia("(max-width: 768px)").matches), ce = o(() => d.draggable && se.value), R = o(() => d.tabs.some((e) => e.closable !== !1 && e.pinned !== !0));
|
|
667
|
+
function z(e) {
|
|
668
|
+
return d.tabs.length > 1 && d.tabs.some((t) => t.path === e && t.closable !== !1 && t.pinned !== !0);
|
|
669
|
+
}
|
|
670
|
+
function B(e, t) {
|
|
671
|
+
let n = d.tabs.findIndex((t) => t.path === e);
|
|
672
|
+
return (t === "left" ? d.tabs.slice(0, n) : d.tabs.slice(n + 1)).some((e) => e.closable !== !1 && e.pinned !== !0);
|
|
673
|
+
}
|
|
674
|
+
function le(e) {
|
|
675
|
+
return d.tabs.some((t) => t.path !== e && t.closable !== !1 && t.pinned !== !0);
|
|
676
|
+
}
|
|
677
|
+
function ue(e) {
|
|
678
|
+
return e === m.value;
|
|
679
|
+
}
|
|
680
|
+
function de(e) {
|
|
681
|
+
let t = d.tabs.find((t) => t.path === e);
|
|
682
|
+
return !!t && t.pinned !== !0 && t.closable !== !1;
|
|
683
|
+
}
|
|
684
|
+
function V(e) {
|
|
685
|
+
let t = d.tabs.find((t) => t.path === e);
|
|
686
|
+
return !!t && t.pinned === !0 && t.closable !== !1;
|
|
687
|
+
}
|
|
688
|
+
function H(e) {
|
|
689
|
+
let t = oe.value;
|
|
690
|
+
return e === "close" ? !z(t) : e === "close-left" || e === "close-right" ? !t || !ue(t) || !B(t, e === "close-left" ? "left" : "right") : e === "close-others" ? !t || !ue(t) || !le(t) : e === "close-all" ? !R.value : e === "refresh" ? !t || !ue(t) : e === "pin" ? !de(t) && !V(t) : e === "new-window" && !t;
|
|
691
|
+
}
|
|
692
|
+
function U(e) {
|
|
693
|
+
return V(e) ? "取消固定" : "固定";
|
|
694
|
+
}
|
|
695
|
+
function pe() {
|
|
696
|
+
return C.value ? "还原" : "内容最大化";
|
|
697
|
+
}
|
|
698
|
+
function me(e) {
|
|
699
|
+
e !== m.value && (m.value = e, p("change", e));
|
|
700
|
+
}
|
|
701
|
+
function he(e) {
|
|
702
|
+
z(e) && p("remove", e);
|
|
703
|
+
}
|
|
704
|
+
function W(e) {
|
|
705
|
+
e && ue(e) && p("refresh", e);
|
|
706
|
+
}
|
|
707
|
+
function ge(e, t) {
|
|
708
|
+
e.button !== 1 || !d.middleClickToClose || !z(t.path) || (e.preventDefault(), p("remove", t.path));
|
|
709
|
+
}
|
|
710
|
+
function G(e, t) {
|
|
711
|
+
if (![
|
|
712
|
+
"ArrowLeft",
|
|
713
|
+
"ArrowRight",
|
|
714
|
+
"End",
|
|
715
|
+
"Home"
|
|
716
|
+
].includes(e.key) || d.tabs.length === 0) return;
|
|
717
|
+
e.preventDefault();
|
|
718
|
+
let n = e.key === "Home" ? 0 : e.key === "End" ? d.tabs.length - 1 : e.key === "ArrowLeft" ? (t - 1 + d.tabs.length) % d.tabs.length : (t + 1) % d.tabs.length, r = d.tabs[n];
|
|
719
|
+
r && (me(r.path), _(() => {
|
|
720
|
+
h.value?.querySelectorAll("[role=\"tab\"]").item(n).focus();
|
|
721
|
+
}));
|
|
722
|
+
}
|
|
723
|
+
function _e(e, t) {
|
|
724
|
+
return {
|
|
725
|
+
left: `${Math.max(8, Math.min(e, window.innerWidth - ft - 8))}px`,
|
|
726
|
+
top: `${Math.max(8, Math.min(t, window.innerHeight - pt - 8))}px`
|
|
727
|
+
};
|
|
728
|
+
}
|
|
729
|
+
function K() {
|
|
730
|
+
g.value = {
|
|
731
|
+
...g.value,
|
|
732
|
+
visible: !1
|
|
733
|
+
}, x.value = {
|
|
734
|
+
...x.value,
|
|
735
|
+
visible: !1
|
|
736
|
+
};
|
|
737
|
+
}
|
|
738
|
+
function ve(e, t) {
|
|
739
|
+
e.preventDefault(), e.stopPropagation(), I = e.currentTarget, g.value = {
|
|
740
|
+
path: t,
|
|
741
|
+
style: _e(e.clientX, e.clientY),
|
|
742
|
+
visible: !0
|
|
743
|
+
}, x.value = {
|
|
744
|
+
...x.value,
|
|
745
|
+
visible: !1
|
|
746
|
+
};
|
|
747
|
+
}
|
|
748
|
+
function ye(e) {
|
|
749
|
+
e.preventDefault(), e.stopPropagation();
|
|
750
|
+
let t = m.value || d.tabs[0]?.path || "";
|
|
751
|
+
I = e.currentTarget, x.value = {
|
|
752
|
+
path: t,
|
|
753
|
+
style: _e(e.clientX, e.clientY),
|
|
754
|
+
visible: !0
|
|
755
|
+
}, g.value = {
|
|
756
|
+
...g.value,
|
|
757
|
+
visible: !1
|
|
758
|
+
};
|
|
759
|
+
}
|
|
760
|
+
function q() {
|
|
761
|
+
I && document.body.contains(I) && (I.focus(), I = null);
|
|
762
|
+
}
|
|
763
|
+
function J(e) {
|
|
764
|
+
if (H(e)) return;
|
|
765
|
+
let t = oe.value;
|
|
766
|
+
K(), e === "close" ? p("remove", t) : e === "close-left" ? p("closeLeft", t) : e === "close-right" ? p("closeRight", t) : e === "close-others" ? p("closeOthers", t) : e === "close-all" ? p("closeAll") : e === "refresh" ? p("refresh", t) : e === "pin" ? p("pin", t, !V(t)) : e === "new-window" ? p("newWindow", t) : e === "maximize" && Te(), _(q);
|
|
767
|
+
}
|
|
768
|
+
function be(e) {
|
|
769
|
+
if (e.key === "Escape") {
|
|
770
|
+
e.preventDefault(), K(), _(q);
|
|
771
|
+
return;
|
|
772
|
+
}
|
|
773
|
+
let t = Array.from(document.querySelectorAll("[data-menu-active=\"true\"] [role=\"menuitem\"]:not(:disabled)"));
|
|
774
|
+
if (t.length !== 0 && (e.key === "ArrowDown" || e.key === "ArrowUp" || e.key === "Home" || e.key === "End")) {
|
|
775
|
+
e.preventDefault();
|
|
776
|
+
let n = t.findIndex((e) => e === document.activeElement), r;
|
|
777
|
+
r = e.key === "ArrowDown" ? n === -1 ? 0 : (n + 1) % t.length : e.key === "ArrowUp" ? n === -1 ? t.length - 1 : (n - 1 + t.length) % t.length : e.key === "Home" ? 0 : t.length - 1, t[r]?.focus();
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
function Y() {
|
|
781
|
+
let e = h.value;
|
|
782
|
+
e && (w.value = e.scrollWidth > e.clientWidth + 1, T.value = e.scrollLeft <= 1, k.value = e.scrollLeft + e.clientWidth >= e.scrollWidth - 1);
|
|
783
|
+
}
|
|
784
|
+
function xe() {
|
|
785
|
+
return window.matchMedia?.("(prefers-reduced-motion: reduce)").matches ? "auto" : "smooth";
|
|
786
|
+
}
|
|
787
|
+
function X(e) {
|
|
788
|
+
let t = h.value;
|
|
789
|
+
t && t.scrollBy({
|
|
790
|
+
behavior: xe(),
|
|
791
|
+
left: (e === "left" ? -1 : 1) * Math.max(160, t.clientWidth - 120)
|
|
792
|
+
});
|
|
793
|
+
}
|
|
794
|
+
function Z(e) {
|
|
795
|
+
if (!d.wheelable) return;
|
|
796
|
+
let t = h.value;
|
|
797
|
+
!t || !w.value || (e.preventDefault(), t.scrollBy({ left: Math.abs(e.deltaY) > Math.abs(e.deltaX) ? e.deltaY : e.deltaX }));
|
|
798
|
+
}
|
|
799
|
+
async function Se() {
|
|
800
|
+
await _(), (h.value?.querySelector("[role=\"tab\"][aria-selected=\"true\"]"))?.scrollIntoView({
|
|
801
|
+
behavior: xe(),
|
|
802
|
+
block: "nearest",
|
|
803
|
+
inline: "nearest"
|
|
804
|
+
}), Y();
|
|
805
|
+
}
|
|
806
|
+
function Ce() {
|
|
807
|
+
let e = h.value?.querySelector(".lumal-tabs__list");
|
|
808
|
+
if (!e || !ce.value) {
|
|
809
|
+
we();
|
|
810
|
+
return;
|
|
811
|
+
}
|
|
812
|
+
F && F.el === e || (we(), F = fe.create(e, {
|
|
813
|
+
animation: 160,
|
|
814
|
+
draggable: ".lumal-tabs__item",
|
|
815
|
+
filter: ".is-not-draggable",
|
|
816
|
+
ghostClass: "lumal-tabs__item--ghost",
|
|
817
|
+
chosenClass: "lumal-tabs__item--chosen",
|
|
818
|
+
onEnd: (e) => {
|
|
819
|
+
if (e.oldIndex === void 0 || e.newIndex === void 0 || e.oldIndex === e.newIndex) return;
|
|
820
|
+
let t = d.tabs[e.oldIndex]?.path, n = d.tabs[e.newIndex]?.path;
|
|
821
|
+
!t || !n || p("reorder", t, n);
|
|
822
|
+
}
|
|
823
|
+
}));
|
|
824
|
+
}
|
|
825
|
+
function we() {
|
|
826
|
+
F?.destroy(), F = void 0;
|
|
827
|
+
}
|
|
828
|
+
M(ce, (e) => {
|
|
829
|
+
e ? _(Ce) : we();
|
|
830
|
+
});
|
|
831
|
+
function Te() {
|
|
832
|
+
if (d.standaloneMaximize) {
|
|
833
|
+
Ee();
|
|
834
|
+
return;
|
|
835
|
+
}
|
|
836
|
+
C.value = !C.value, p("maximize", C.value);
|
|
837
|
+
}
|
|
838
|
+
async function Ee() {
|
|
839
|
+
let e = document.querySelector(d.fullscreenTarget);
|
|
840
|
+
e instanceof HTMLElement && (document.fullscreenElement ? await document.exitFullscreen?.() : await e.requestFullscreen?.());
|
|
841
|
+
}
|
|
842
|
+
function De() {
|
|
843
|
+
C.value = !!document.fullscreenElement && d.standaloneMaximize, d.standaloneMaximize && p("maximize", C.value);
|
|
844
|
+
}
|
|
845
|
+
function Oe(e) {
|
|
846
|
+
d.standaloneMaximize || (C.value = e);
|
|
847
|
+
}
|
|
848
|
+
n({
|
|
849
|
+
getTabsElement: () => h.value,
|
|
850
|
+
refreshCurrent: () => W(m.value),
|
|
851
|
+
scrollTabs: X,
|
|
852
|
+
toggleFullscreen: Te,
|
|
853
|
+
setMaximized: Oe
|
|
854
|
+
}), M(() => [d.activePath, d.tabs.length], () => void Se(), { flush: "post" }), M(() => d.tabs, () => void _(Y), { flush: "post" });
|
|
855
|
+
function ke(e) {
|
|
856
|
+
let t = e.target;
|
|
857
|
+
t && (t.closest?.(".lumal-tabs-context-menu") || t.closest?.("[data-tab-menu-trigger]") || K());
|
|
858
|
+
}
|
|
859
|
+
function Q(e) {
|
|
860
|
+
e.key === "Escape" && L.value.visible && (e.preventDefault(), K(), _(q));
|
|
861
|
+
}
|
|
862
|
+
return te(() => {
|
|
863
|
+
document.addEventListener("click", ke), document.addEventListener("fullscreenchange", De), document.addEventListener("keydown", Q), Y(), typeof ResizeObserver < "u" && h.value && (j = new ResizeObserver(Y), j.observe(h.value)), ce.value && _(Ce);
|
|
864
|
+
}), ee(() => {
|
|
865
|
+
document.removeEventListener("click", ke), document.removeEventListener("fullscreenchange", De), document.removeEventListener("keydown", Q), j?.disconnect(), we();
|
|
866
|
+
}), (n, i) => e.visible && e.tabs.length ? (b(), l("div", {
|
|
867
|
+
key: 0,
|
|
868
|
+
class: v(["lumal-tabs", [`is-style-${e.styleType}`]])
|
|
869
|
+
}, [
|
|
870
|
+
ie(u("button", {
|
|
871
|
+
class: "lumal-tabs__tool",
|
|
872
|
+
type: "button",
|
|
873
|
+
"aria-label": "向左滚动标签",
|
|
874
|
+
disabled: T.value,
|
|
875
|
+
onClick: i[0] ||= (e) => X("left")
|
|
876
|
+
}, [f(O(P), {
|
|
877
|
+
name: "lumal:chevron-left",
|
|
878
|
+
size: 16
|
|
879
|
+
})], 8, Je), [[re, w.value]]),
|
|
880
|
+
u("div", {
|
|
881
|
+
ref_key: "tabsViewportRef",
|
|
882
|
+
ref: h,
|
|
883
|
+
class: "lumal-tabs__viewport",
|
|
884
|
+
onScroll: Y,
|
|
885
|
+
onWheel: Z
|
|
886
|
+
}, [f(a, {
|
|
887
|
+
name: "lumal-tab",
|
|
888
|
+
tag: "div",
|
|
889
|
+
class: "lumal-tabs__list",
|
|
890
|
+
role: "tablist",
|
|
891
|
+
"aria-label": "页面标签"
|
|
892
|
+
}, {
|
|
893
|
+
default: N(() => [(b(!0), l(t, null, S(e.tabs, (t, n) => (b(), l("div", {
|
|
894
|
+
key: t.path,
|
|
895
|
+
class: v(["lumal-tabs__item", {
|
|
896
|
+
"is-active": t.path === m.value,
|
|
897
|
+
"is-pinned": t.pinned === !0,
|
|
898
|
+
"is-not-draggable": t.pinned === !0 || !ce.value
|
|
899
|
+
}]),
|
|
900
|
+
onContextmenu: (e) => ve(e, t.path)
|
|
901
|
+
}, [u("button", {
|
|
902
|
+
class: "lumal-tabs__tab",
|
|
903
|
+
type: "button",
|
|
904
|
+
role: "tab",
|
|
905
|
+
"aria-selected": t.path === m.value,
|
|
906
|
+
tabindex: t.path === m.value ? 0 : -1,
|
|
907
|
+
onClick: (e) => me(t.path),
|
|
908
|
+
onKeydown: (e) => G(e, n),
|
|
909
|
+
onMousedown: (e) => ge(e, t)
|
|
910
|
+
}, [t.pinned === !0 ? (b(), s(O(P), {
|
|
911
|
+
key: 0,
|
|
912
|
+
class: "lumal-tabs__pin",
|
|
913
|
+
name: "lumal:pin",
|
|
914
|
+
size: 14
|
|
915
|
+
})) : e.showIcon && t.icon ? (b(), s(O(P), {
|
|
916
|
+
key: 1,
|
|
917
|
+
name: t.icon,
|
|
918
|
+
size: 14
|
|
919
|
+
}, null, 8, ["name"])) : c("", !0), u("span", {
|
|
920
|
+
class: "lumal-tabs__label",
|
|
921
|
+
title: t.title
|
|
922
|
+
}, D(t.title), 9, Ze)], 40, Xe), z(t.path) ? (b(), l("button", {
|
|
923
|
+
key: 0,
|
|
924
|
+
class: "lumal-tabs__close",
|
|
925
|
+
type: "button",
|
|
926
|
+
"aria-label": `关闭${t.title}`,
|
|
927
|
+
onClick: (e) => he(t.path)
|
|
928
|
+
}, [f(O(P), {
|
|
929
|
+
name: "lumal:close",
|
|
930
|
+
size: 14
|
|
931
|
+
})], 8, Qe)) : c("", !0)], 42, Ye))), 128))]),
|
|
932
|
+
_: 1
|
|
933
|
+
})], 544),
|
|
934
|
+
ie(u("button", {
|
|
935
|
+
class: "lumal-tabs__tool",
|
|
936
|
+
type: "button",
|
|
937
|
+
"aria-label": "向右滚动标签",
|
|
938
|
+
disabled: k.value,
|
|
939
|
+
onClick: i[1] ||= (e) => X("right")
|
|
940
|
+
}, [f(O(P), {
|
|
941
|
+
name: "lumal:chevron-right",
|
|
942
|
+
size: 16
|
|
943
|
+
})], 8, $e), [[re, w.value]]),
|
|
944
|
+
e.showRefresh ? (b(), l("button", {
|
|
945
|
+
key: 0,
|
|
946
|
+
class: "lumal-tabs__tool lumal-tabs__tool--refresh",
|
|
947
|
+
type: "button",
|
|
948
|
+
"aria-label": "刷新当前页面",
|
|
949
|
+
"data-action": "refresh-current-tab",
|
|
950
|
+
disabled: !m.value,
|
|
951
|
+
onClick: i[2] ||= (e) => W(m.value)
|
|
952
|
+
}, [f(O(P), {
|
|
953
|
+
name: "lumal:refresh",
|
|
954
|
+
size: 16
|
|
955
|
+
})], 8, et)) : c("", !0),
|
|
956
|
+
e.showMore ? (b(), l("button", {
|
|
957
|
+
key: 1,
|
|
958
|
+
class: "lumal-tabs__tool",
|
|
959
|
+
type: "button",
|
|
960
|
+
"aria-label": "更多操作",
|
|
961
|
+
"aria-haspopup": "menu",
|
|
962
|
+
"aria-expanded": x.value.visible,
|
|
963
|
+
"data-tab-menu-trigger": "",
|
|
964
|
+
onClick: i[3] ||= (e) => ye(e)
|
|
965
|
+
}, [f(O(P), {
|
|
966
|
+
name: "lumal:more",
|
|
967
|
+
size: 16
|
|
968
|
+
})], 8, tt)) : c("", !0),
|
|
969
|
+
e.showMaximize ? (b(), l("button", {
|
|
970
|
+
key: 2,
|
|
971
|
+
class: "lumal-tabs__tool lumal-tabs__tool--maximize",
|
|
972
|
+
type: "button",
|
|
973
|
+
"aria-label": C.value ? "退出内容最大化" : "内容最大化",
|
|
974
|
+
"data-action": "maximize-content",
|
|
975
|
+
onClick: Te
|
|
976
|
+
}, [f(O(P), {
|
|
977
|
+
name: C.value ? "lumal:restore" : "lumal:maximize",
|
|
978
|
+
size: 16
|
|
979
|
+
}, null, 8, ["name"])], 8, nt)) : c("", !0),
|
|
980
|
+
(b(), s(r, { to: "body" }, [g.value.visible || x.value.visible ? (b(), l("div", {
|
|
981
|
+
key: 0,
|
|
982
|
+
class: "lumal-tabs-context-menu",
|
|
983
|
+
role: "menu",
|
|
984
|
+
"data-menu-active": !0,
|
|
985
|
+
style: y(L.value.style),
|
|
986
|
+
onClick: i[13] ||= ae(() => {}, ["stop"]),
|
|
987
|
+
onKeydown: be
|
|
988
|
+
}, [
|
|
989
|
+
u("button", {
|
|
990
|
+
type: "button",
|
|
991
|
+
role: "menuitem",
|
|
992
|
+
disabled: H("refresh"),
|
|
993
|
+
onClick: i[4] ||= (e) => J("refresh")
|
|
994
|
+
}, [f(O(P), {
|
|
995
|
+
name: "lumal:refresh",
|
|
996
|
+
size: 14
|
|
997
|
+
}), i[14] ||= u("span", null, "重新加载", -1)], 8, rt),
|
|
998
|
+
u("button", {
|
|
999
|
+
type: "button",
|
|
1000
|
+
role: "menuitem",
|
|
1001
|
+
disabled: H("pin"),
|
|
1002
|
+
onClick: i[5] ||= (e) => J("pin")
|
|
1003
|
+
}, [f(O(P), {
|
|
1004
|
+
name: V(oe.value) ? "lumal:pin-off" : "lumal:pin",
|
|
1005
|
+
size: 14
|
|
1006
|
+
}, null, 8, ["name"]), u("span", null, D(U(oe.value)), 1)], 8, it),
|
|
1007
|
+
u("button", {
|
|
1008
|
+
type: "button",
|
|
1009
|
+
role: "menuitem",
|
|
1010
|
+
disabled: H("maximize"),
|
|
1011
|
+
onClick: i[6] ||= (e) => J("maximize")
|
|
1012
|
+
}, [f(O(P), {
|
|
1013
|
+
name: C.value ? "lumal:restore" : "lumal:maximize",
|
|
1014
|
+
size: 14
|
|
1015
|
+
}, null, 8, ["name"]), u("span", null, D(pe()), 1)], 8, at),
|
|
1016
|
+
u("button", {
|
|
1017
|
+
type: "button",
|
|
1018
|
+
role: "menuitem",
|
|
1019
|
+
disabled: H("new-window"),
|
|
1020
|
+
onClick: i[7] ||= (e) => J("new-window")
|
|
1021
|
+
}, [f(O(P), {
|
|
1022
|
+
name: "lumal:external-link",
|
|
1023
|
+
size: 14
|
|
1024
|
+
}), i[15] ||= u("span", null, "在新窗口打开", -1)], 8, ot),
|
|
1025
|
+
i[21] ||= u("span", { class: "lumal-tabs-context-menu__divider" }, null, -1),
|
|
1026
|
+
u("button", {
|
|
1027
|
+
type: "button",
|
|
1028
|
+
role: "menuitem",
|
|
1029
|
+
disabled: H("close"),
|
|
1030
|
+
onClick: i[8] ||= (e) => J("close")
|
|
1031
|
+
}, [f(O(P), {
|
|
1032
|
+
name: "lumal:close",
|
|
1033
|
+
size: 14
|
|
1034
|
+
}), i[16] ||= u("span", null, "关闭", -1)], 8, st),
|
|
1035
|
+
u("button", {
|
|
1036
|
+
type: "button",
|
|
1037
|
+
role: "menuitem",
|
|
1038
|
+
disabled: H("close-left"),
|
|
1039
|
+
onClick: i[9] ||= (e) => J("close-left")
|
|
1040
|
+
}, [f(O(P), {
|
|
1041
|
+
name: "lumal:chevron-left",
|
|
1042
|
+
size: 14
|
|
1043
|
+
}), i[17] ||= u("span", null, "关闭左侧", -1)], 8, ct),
|
|
1044
|
+
u("button", {
|
|
1045
|
+
type: "button",
|
|
1046
|
+
role: "menuitem",
|
|
1047
|
+
disabled: H("close-right"),
|
|
1048
|
+
onClick: i[10] ||= (e) => J("close-right")
|
|
1049
|
+
}, [f(O(P), {
|
|
1050
|
+
name: "lumal:chevron-right",
|
|
1051
|
+
size: 14
|
|
1052
|
+
}), i[18] ||= u("span", null, "关闭右侧", -1)], 8, lt),
|
|
1053
|
+
u("button", {
|
|
1054
|
+
type: "button",
|
|
1055
|
+
role: "menuitem",
|
|
1056
|
+
disabled: H("close-others"),
|
|
1057
|
+
onClick: i[11] ||= (e) => J("close-others")
|
|
1058
|
+
}, [f(O(P), {
|
|
1059
|
+
name: "lumal:close",
|
|
1060
|
+
size: 14
|
|
1061
|
+
}), i[19] ||= u("span", null, "关闭其他", -1)], 8, ut),
|
|
1062
|
+
u("button", {
|
|
1063
|
+
type: "button",
|
|
1064
|
+
role: "menuitem",
|
|
1065
|
+
disabled: H("close-all"),
|
|
1066
|
+
onClick: i[12] ||= (e) => J("close-all")
|
|
1067
|
+
}, [f(O(P), {
|
|
1068
|
+
name: "lumal:close",
|
|
1069
|
+
size: 14
|
|
1070
|
+
}), i[20] ||= u("span", null, "关闭全部", -1)], 8, dt)
|
|
1071
|
+
], 36)) : c("", !0)]))
|
|
1072
|
+
], 2)) : c("", !0);
|
|
1073
|
+
}
|
|
1074
|
+
}), [["__scopeId", "data-v-e1921025"]]), ht = { class: "lumal-top-nav-menu-item__label" }, gt = {
|
|
1075
|
+
key: 1,
|
|
1076
|
+
class: "lumal-top-nav-menu-item__external",
|
|
1077
|
+
"aria-hidden": "true"
|
|
1078
|
+
}, _t = { class: "lumal-top-nav-menu-item__label" }, vt = { class: "lumal-top-nav-menu-item__label" }, yt = {
|
|
1079
|
+
key: 1,
|
|
1080
|
+
class: "lumal-top-nav-menu-item__external",
|
|
1081
|
+
"aria-hidden": "true"
|
|
1082
|
+
}, bt = /*#__PURE__*/ e(/* @__PURE__ */ p({
|
|
1083
|
+
__name: "LumalTopNavMenuItem",
|
|
1084
|
+
props: {
|
|
1085
|
+
activePath: { default: "" },
|
|
1086
|
+
item: {}
|
|
1087
|
+
},
|
|
1088
|
+
emits: ["select"],
|
|
1089
|
+
setup(e, { emit: n }) {
|
|
1090
|
+
let r = e, i = n, a = o(() => r.item.children?.filter((e) => !e.hidden) ?? []), d = o(() => !!r.item.externalLink && r.item.externalTarget !== "_self"), p = o(() => !!r.activePath && V(r.item, r.activePath));
|
|
1091
|
+
function m(e) {
|
|
1092
|
+
i("select", e);
|
|
1093
|
+
}
|
|
1094
|
+
return (n, r) => {
|
|
1095
|
+
let i = w("LumalTopNavMenuItem", !0);
|
|
1096
|
+
return a.value.length ? (b(), s(O(B), {
|
|
1097
|
+
key: 0,
|
|
1098
|
+
index: e.item.path,
|
|
1099
|
+
class: v({ "is-active": p.value })
|
|
1100
|
+
}, {
|
|
1101
|
+
title: N(() => [
|
|
1102
|
+
e.item.icon ? (b(), s(O(P), {
|
|
1103
|
+
key: 0,
|
|
1104
|
+
name: e.item.icon,
|
|
1105
|
+
size: 16
|
|
1106
|
+
}, null, 8, ["name"])) : c("", !0),
|
|
1107
|
+
u("span", ht, [u("span", null, D(e.item.title), 1), f($, {
|
|
1108
|
+
badge: e.item.badge,
|
|
1109
|
+
label: e.item.title,
|
|
1110
|
+
tone: e.item.badgeTone,
|
|
1111
|
+
type: e.item.badgeType
|
|
1112
|
+
}, null, 8, [
|
|
1113
|
+
"badge",
|
|
1114
|
+
"label",
|
|
1115
|
+
"tone",
|
|
1116
|
+
"type"
|
|
1117
|
+
])]),
|
|
1118
|
+
e.item.externalLink ? (b(), l("span", gt, "↗")) : c("", !0)
|
|
1119
|
+
]),
|
|
1120
|
+
default: N(() => [(b(!0), l(t, null, S(a.value, (t) => (b(), s(i, {
|
|
1121
|
+
key: t.path,
|
|
1122
|
+
item: t,
|
|
1123
|
+
"active-path": e.activePath,
|
|
1124
|
+
onSelect: m
|
|
1125
|
+
}, null, 8, ["item", "active-path"]))), 128))]),
|
|
1126
|
+
_: 1
|
|
1127
|
+
}, 8, ["index", "class"])) : d.value ? (b(), l("li", {
|
|
1128
|
+
key: 1,
|
|
1129
|
+
class: v(["el-menu-item lumal-top-nav-menu-item--external", { "is-active": p.value }]),
|
|
1130
|
+
role: "menuitem",
|
|
1131
|
+
tabindex: "-1",
|
|
1132
|
+
onClick: r[0] ||= (t) => m(e.item.path)
|
|
1133
|
+
}, [
|
|
1134
|
+
e.item.icon ? (b(), s(O(P), {
|
|
1135
|
+
key: 0,
|
|
1136
|
+
name: e.item.icon,
|
|
1137
|
+
size: 16
|
|
1138
|
+
}, null, 8, ["name"])) : c("", !0),
|
|
1139
|
+
u("span", _t, [u("span", null, D(e.item.title), 1), f($, {
|
|
1140
|
+
badge: e.item.badge,
|
|
1141
|
+
label: e.item.title,
|
|
1142
|
+
tone: e.item.badgeTone,
|
|
1143
|
+
type: e.item.badgeType
|
|
1144
|
+
}, null, 8, [
|
|
1145
|
+
"badge",
|
|
1146
|
+
"label",
|
|
1147
|
+
"tone",
|
|
1148
|
+
"type"
|
|
1149
|
+
])]),
|
|
1150
|
+
r[2] ||= u("span", {
|
|
1151
|
+
class: "lumal-top-nav-menu-item__external",
|
|
1152
|
+
"aria-hidden": "true"
|
|
1153
|
+
}, "↗", -1)
|
|
1154
|
+
], 2)) : (b(), s(O(R), {
|
|
1155
|
+
key: 2,
|
|
1156
|
+
index: e.item.path,
|
|
1157
|
+
class: v({ "is-active": p.value }),
|
|
1158
|
+
onClick: r[1] ||= (t) => m(e.item.path)
|
|
1159
|
+
}, {
|
|
1160
|
+
default: N(() => [
|
|
1161
|
+
e.item.icon ? (b(), s(O(P), {
|
|
1162
|
+
key: 0,
|
|
1163
|
+
name: e.item.icon,
|
|
1164
|
+
size: 16
|
|
1165
|
+
}, null, 8, ["name"])) : c("", !0),
|
|
1166
|
+
u("span", vt, [u("span", null, D(e.item.title), 1), f($, {
|
|
1167
|
+
badge: e.item.badge,
|
|
1168
|
+
label: e.item.title,
|
|
1169
|
+
tone: e.item.badgeTone,
|
|
1170
|
+
type: e.item.badgeType
|
|
1171
|
+
}, null, 8, [
|
|
1172
|
+
"badge",
|
|
1173
|
+
"label",
|
|
1174
|
+
"tone",
|
|
1175
|
+
"type"
|
|
1176
|
+
])]),
|
|
1177
|
+
e.item.externalLink ? (b(), l("span", yt, "↗")) : c("", !0)
|
|
1178
|
+
]),
|
|
1179
|
+
_: 1
|
|
1180
|
+
}, 8, ["index", "class"]));
|
|
1181
|
+
};
|
|
1182
|
+
}
|
|
1183
|
+
}), [["__scopeId", "data-v-f78b5b43"]]), xt = { class: "lumal-top-nav__label" }, St = {
|
|
1184
|
+
key: 1,
|
|
1185
|
+
class: "lumal-top-nav__external",
|
|
1186
|
+
"aria-hidden": "true"
|
|
1187
|
+
}, Ct = /*#__PURE__*/ e(/* @__PURE__ */ p({
|
|
1188
|
+
__name: "LumalTopNav",
|
|
1189
|
+
props: {
|
|
1190
|
+
activePath: { default: "" },
|
|
1191
|
+
align: { default: "left" },
|
|
1192
|
+
maxWidth: { default: "100%" },
|
|
1193
|
+
menus: { default: () => [] },
|
|
1194
|
+
mode: { default: "tree" }
|
|
1195
|
+
},
|
|
1196
|
+
emits: ["select"],
|
|
1197
|
+
setup(e, { expose: n, emit: r }) {
|
|
1198
|
+
let i = e, a = r, d = A("menuRef"), p = o(() => i.menus.filter((e) => !e.hidden));
|
|
1199
|
+
function m(e) {
|
|
1200
|
+
return !!e.externalLink && e.externalTarget !== "_self";
|
|
1201
|
+
}
|
|
1202
|
+
function h(e) {
|
|
1203
|
+
return i.activePath ? i.mode === "flat" ? e.path === i.activePath : V(e, i.activePath) : !1;
|
|
1204
|
+
}
|
|
1205
|
+
function _(e) {
|
|
1206
|
+
let t = h(e);
|
|
1207
|
+
return m(e) ? {
|
|
1208
|
+
class: [
|
|
1209
|
+
"el-menu-item",
|
|
1210
|
+
"lumal-top-nav__external-item",
|
|
1211
|
+
{ "is-active": t }
|
|
1212
|
+
],
|
|
1213
|
+
role: "menuitem",
|
|
1214
|
+
tabindex: -1
|
|
1215
|
+
} : {
|
|
1216
|
+
class: { "is-active": t },
|
|
1217
|
+
index: e.path
|
|
1218
|
+
};
|
|
1219
|
+
}
|
|
1220
|
+
let ee = o(() => ({ "--lumal-top-nav-max-width": typeof i.maxWidth == "number" ? `${i.maxWidth}px` : i.maxWidth }));
|
|
1221
|
+
function te(e) {
|
|
1222
|
+
a("select", e);
|
|
1223
|
+
}
|
|
1224
|
+
return n({
|
|
1225
|
+
getMenuElement: () => d.value?.$el,
|
|
1226
|
+
getMenuInstance: () => d.value
|
|
1227
|
+
}), (n, r) => (b(), s(O(ce), {
|
|
1228
|
+
key: `top-nav:${e.mode}:${e.activePath}`,
|
|
1229
|
+
ref_key: "menuRef",
|
|
1230
|
+
ref: d,
|
|
1231
|
+
class: v(["lumal-top-nav", `is-align-${e.align}`]),
|
|
1232
|
+
mode: "horizontal",
|
|
1233
|
+
"default-active": e.activePath,
|
|
1234
|
+
ellipsis: !0,
|
|
1235
|
+
style: y(ee.value)
|
|
1236
|
+
}, {
|
|
1237
|
+
default: N(() => [(b(!0), l(t, null, S(e.mode === "tree" ? p.value : [], (t) => (b(), s(bt, {
|
|
1238
|
+
key: `tree:${t.path}`,
|
|
1239
|
+
item: t,
|
|
1240
|
+
"active-path": e.activePath,
|
|
1241
|
+
onSelect: te
|
|
1242
|
+
}, null, 8, ["item", "active-path"]))), 128)), (b(!0), l(t, null, S(e.mode === "flat" ? p.value : [], (e) => (b(), s(T(m(e) ? "li" : O(R)), g({ key: `flat:${e.path}` }, { ref_for: !0 }, _(e), { onClick: (t) => te(e.path) }), {
|
|
1243
|
+
default: N(() => [
|
|
1244
|
+
e.icon ? (b(), s(O(P), {
|
|
1245
|
+
key: 0,
|
|
1246
|
+
name: e.icon,
|
|
1247
|
+
size: 16
|
|
1248
|
+
}, null, 8, ["name"])) : c("", !0),
|
|
1249
|
+
u("span", xt, [u("span", null, D(e.title), 1), f($, {
|
|
1250
|
+
badge: e.badge,
|
|
1251
|
+
label: e.title,
|
|
1252
|
+
tone: e.badgeTone,
|
|
1253
|
+
type: e.badgeType
|
|
1254
|
+
}, null, 8, [
|
|
1255
|
+
"badge",
|
|
1256
|
+
"label",
|
|
1257
|
+
"tone",
|
|
1258
|
+
"type"
|
|
1259
|
+
])]),
|
|
1260
|
+
e.externalLink ? (b(), l("span", St, "↗")) : c("", !0)
|
|
1261
|
+
]),
|
|
1262
|
+
_: 2
|
|
1263
|
+
}, 1040, ["onClick"]))), 128))]),
|
|
1264
|
+
_: 1
|
|
1265
|
+
}, 8, [
|
|
1266
|
+
"class",
|
|
1267
|
+
"default-active",
|
|
1268
|
+
"style"
|
|
1269
|
+
]));
|
|
1270
|
+
}
|
|
1271
|
+
}), [["__scopeId", "data-v-1c664f72"]]), wt = 1, Tt = 50;
|
|
1272
|
+
function Et(e) {
|
|
1273
|
+
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
1274
|
+
}
|
|
1275
|
+
function Dt(e) {
|
|
1276
|
+
return Et(e) ? typeof e.path == "string" && typeof e.title == "string" : !1;
|
|
1277
|
+
}
|
|
1278
|
+
function Ot(e) {
|
|
1279
|
+
let t = Math.max(1, e.maxHistory ?? 50), n = e.history.slice(0, t);
|
|
1280
|
+
return {
|
|
1281
|
+
v: 1,
|
|
1282
|
+
tabs: e.tabs.map((e) => ({
|
|
1283
|
+
closable: e.closable,
|
|
1284
|
+
icon: e.icon,
|
|
1285
|
+
path: e.path,
|
|
1286
|
+
pinned: e.pinned === !0,
|
|
1287
|
+
title: e.title
|
|
1288
|
+
})),
|
|
1289
|
+
history: n
|
|
1290
|
+
};
|
|
1291
|
+
}
|
|
1292
|
+
function kt(e) {
|
|
1293
|
+
if (!e) return;
|
|
1294
|
+
let t;
|
|
1295
|
+
try {
|
|
1296
|
+
t = JSON.parse(e);
|
|
1297
|
+
} catch {
|
|
1298
|
+
return;
|
|
1299
|
+
}
|
|
1300
|
+
return !Et(t) || t.v !== 1 || !Array.isArray(t.tabs) || !Array.isArray(t.history) || !t.history.every((e) => typeof e == "string") ? void 0 : {
|
|
1301
|
+
v: 1,
|
|
1302
|
+
tabs: t.tabs.filter(Dt),
|
|
1303
|
+
history: t.history
|
|
1304
|
+
};
|
|
1305
|
+
}
|
|
1306
|
+
function At(e, t, n) {
|
|
1307
|
+
try {
|
|
1308
|
+
return e.setItem(t, JSON.stringify(n)), !0;
|
|
1309
|
+
} catch {
|
|
1310
|
+
return !1;
|
|
1311
|
+
}
|
|
1312
|
+
}
|
|
1313
|
+
function jt(e, t) {
|
|
1314
|
+
let n = null;
|
|
1315
|
+
try {
|
|
1316
|
+
n = e.getItem(t);
|
|
1317
|
+
} catch {
|
|
1318
|
+
return;
|
|
1319
|
+
}
|
|
1320
|
+
let r = kt(n);
|
|
1321
|
+
if (n) {
|
|
1322
|
+
if (!r) {
|
|
1323
|
+
try {
|
|
1324
|
+
e.removeItem(t);
|
|
1325
|
+
} catch {}
|
|
1326
|
+
return;
|
|
1327
|
+
}
|
|
1328
|
+
return r;
|
|
1329
|
+
}
|
|
1330
|
+
}
|
|
1331
|
+
function Mt(e, t) {
|
|
1332
|
+
try {
|
|
1333
|
+
e.removeItem(t);
|
|
1334
|
+
} catch {}
|
|
1335
|
+
}
|
|
1336
|
+
function Nt(e, t) {
|
|
1337
|
+
let n = t.fixedTabs.map((e) => ({
|
|
1338
|
+
...e,
|
|
1339
|
+
pinned: !0,
|
|
1340
|
+
closable: !1
|
|
1341
|
+
})), r = new Set(n.map((e) => e.path)), i = t.isValidPath ?? (() => !0), a = [];
|
|
1342
|
+
if (e) for (let n of e.tabs) {
|
|
1343
|
+
if (!n.path || !i(n.path) || r.has(n.path)) continue;
|
|
1344
|
+
let e = t.resolveTab?.(n.path) ?? {};
|
|
1345
|
+
a.push({
|
|
1346
|
+
closable: n.closable !== !1,
|
|
1347
|
+
icon: n.icon,
|
|
1348
|
+
path: n.path,
|
|
1349
|
+
pinned: n.pinned === !0,
|
|
1350
|
+
title: n.title,
|
|
1351
|
+
...e
|
|
1352
|
+
});
|
|
1353
|
+
}
|
|
1354
|
+
let o = [...n, ...a];
|
|
1355
|
+
if (t.currentPath) {
|
|
1356
|
+
let e = t.resolveTab?.(t.currentPath) ?? {}, n = {
|
|
1357
|
+
closable: !0,
|
|
1358
|
+
icon: e.icon,
|
|
1359
|
+
path: t.currentPath,
|
|
1360
|
+
pinned: !1,
|
|
1361
|
+
title: e.title ?? t.currentTab?.title ?? t.currentPath,
|
|
1362
|
+
...t.currentTab ?? {},
|
|
1363
|
+
...e
|
|
1364
|
+
};
|
|
1365
|
+
r.has(t.currentPath) || o.some((e) => e.path === t.currentPath) || (o = [...o, n]);
|
|
1366
|
+
}
|
|
1367
|
+
o = [...o].sort((e, t) => {
|
|
1368
|
+
let n = +(e.pinned === !0);
|
|
1369
|
+
return +(t.pinned === !0) - n;
|
|
1370
|
+
});
|
|
1371
|
+
let s = e?.history ?? [];
|
|
1372
|
+
return {
|
|
1373
|
+
tabs: o,
|
|
1374
|
+
history: s
|
|
1375
|
+
};
|
|
1376
|
+
}
|
|
1377
|
+
//#endregion
|
|
1378
|
+
//#region src/layout/state/tab-strategy.ts
|
|
1379
|
+
function Pt(e) {
|
|
1380
|
+
return [...e].sort((e, t) => {
|
|
1381
|
+
let n = +(e.pinned === !0);
|
|
1382
|
+
return +(t.pinned === !0) - n;
|
|
1383
|
+
});
|
|
1384
|
+
}
|
|
1385
|
+
function Ft(e, t, n = {}) {
|
|
1386
|
+
let r = e.some((e) => e.path === t.path) ? [...e] : [...e, t], i = n.maxCount ?? 0;
|
|
1387
|
+
if (i <= 0 || r.length <= i) return r;
|
|
1388
|
+
let a = [...r];
|
|
1389
|
+
for (; a.length > i;) {
|
|
1390
|
+
let e = a.findIndex((e) => e.closable !== !1 && e.pinned !== !0 && e.path !== t.path);
|
|
1391
|
+
if (e === -1) break;
|
|
1392
|
+
a.splice(e, 1);
|
|
1393
|
+
}
|
|
1394
|
+
return a;
|
|
1395
|
+
}
|
|
1396
|
+
function It(e, t, n) {
|
|
1397
|
+
if (t <= 0 || e.length <= t) return [...e];
|
|
1398
|
+
let r = [...e];
|
|
1399
|
+
for (; r.length > t;) {
|
|
1400
|
+
let e = r.findIndex((e) => e.closable !== !1 && e.pinned !== !0 && e.path !== n);
|
|
1401
|
+
if (e === -1) break;
|
|
1402
|
+
r.splice(e, 1);
|
|
1403
|
+
}
|
|
1404
|
+
return r;
|
|
1405
|
+
}
|
|
1406
|
+
function Lt(e, t) {
|
|
1407
|
+
return e.filter((e) => !(e.path === t && e.closable !== !1 && e.pinned !== !0));
|
|
1408
|
+
}
|
|
1409
|
+
function Rt(e, t) {
|
|
1410
|
+
let n = e.findIndex((e) => e.path === t);
|
|
1411
|
+
return n <= 0 ? [...e] : e.filter((e, t) => t >= n || e.closable === !1 || e.pinned === !0);
|
|
1412
|
+
}
|
|
1413
|
+
function zt(e, t) {
|
|
1414
|
+
let n = e.findIndex((e) => e.path === t);
|
|
1415
|
+
return n === -1 || n >= e.length - 1 ? [...e] : e.filter((e, t) => t <= n || e.closable === !1 || e.pinned === !0);
|
|
1416
|
+
}
|
|
1417
|
+
function Bt(e, t) {
|
|
1418
|
+
return e.filter((e) => e.path === t || e.closable === !1 || e.pinned === !0);
|
|
1419
|
+
}
|
|
1420
|
+
function Vt(e) {
|
|
1421
|
+
let t = e.filter((e) => e.closable === !1 || e.pinned === !0);
|
|
1422
|
+
return t.length > 0 ? t : e.length > 0 ? [e[0]] : [];
|
|
1423
|
+
}
|
|
1424
|
+
function Ht(e, t) {
|
|
1425
|
+
let n = !1, r = e.map((e) => e.path === t ? (n = !0, {
|
|
1426
|
+
...e,
|
|
1427
|
+
pinned: !0
|
|
1428
|
+
}) : e);
|
|
1429
|
+
return n ? Pt(r) : r;
|
|
1430
|
+
}
|
|
1431
|
+
function Ut(e, t) {
|
|
1432
|
+
return e.map((e) => e.path === t && e.closable !== !1 ? {
|
|
1433
|
+
...e,
|
|
1434
|
+
pinned: !1
|
|
1435
|
+
} : e);
|
|
1436
|
+
}
|
|
1437
|
+
function Wt(e) {
|
|
1438
|
+
return e.closable === !1;
|
|
1439
|
+
}
|
|
1440
|
+
function Gt(e) {
|
|
1441
|
+
return e.pinned === !0 && e.closable !== !1;
|
|
1442
|
+
}
|
|
1443
|
+
function Kt(e) {
|
|
1444
|
+
return e.pinned !== !0 && e.closable !== !1;
|
|
1445
|
+
}
|
|
1446
|
+
var qt = 50;
|
|
1447
|
+
function Jt(e, t, n = {}) {
|
|
1448
|
+
if (!t) return [...e];
|
|
1449
|
+
let r = n.maxCount ?? qt;
|
|
1450
|
+
return [t, ...e.filter((e) => e !== t)].slice(0, Math.max(1, r));
|
|
1451
|
+
}
|
|
1452
|
+
function Yt(e, t, n = [], r = {}) {
|
|
1453
|
+
if (e.length === 0) return "";
|
|
1454
|
+
if (r.useHistory && n.length > 0) {
|
|
1455
|
+
let r = new Set(e.map((e) => e.path));
|
|
1456
|
+
for (let e of n) if (e !== t && r.has(e)) return e;
|
|
1457
|
+
}
|
|
1458
|
+
let i = r.priorClosedIndex ?? -1;
|
|
1459
|
+
if (i >= 0) {
|
|
1460
|
+
let t = e[i];
|
|
1461
|
+
if (t) return t.path;
|
|
1462
|
+
let n = e[i - 1];
|
|
1463
|
+
if (n) return n.path;
|
|
1464
|
+
}
|
|
1465
|
+
return e[0]?.path ?? "";
|
|
1466
|
+
}
|
|
1467
|
+
function Xt(e, t, n) {
|
|
1468
|
+
let r = e.findIndex((e) => e.path === t), i = e.findIndex((e) => e.path === n);
|
|
1469
|
+
if (r === -1 || i === -1 || r === i || e[r].pinned === !0 != (e[i].pinned === !0)) return [...e];
|
|
1470
|
+
let a = [...e], [o] = a.splice(r, 1);
|
|
1471
|
+
return o && a.splice(i, 0, o), a;
|
|
1472
|
+
}
|
|
1473
|
+
function Zt(e, t = {}) {
|
|
1474
|
+
return t.enable === !1 ? [] : e.map((e) => e.path);
|
|
1475
|
+
}
|
|
1476
|
+
//#endregion
|
|
1477
|
+
//#region src/layout/LumalLayout.vue
|
|
1478
|
+
var Qt = /*#__PURE__*/ e(/* @__PURE__ */ p({
|
|
1479
|
+
__name: "LumalLayout",
|
|
1480
|
+
props: /*@__PURE__*/ h({
|
|
1481
|
+
title: {},
|
|
1482
|
+
menus: { default: () => [] },
|
|
1483
|
+
preferences: {},
|
|
1484
|
+
tabs: { default: () => [] },
|
|
1485
|
+
activeMenuPath: { default: "" },
|
|
1486
|
+
activeTabPath: { default: "" },
|
|
1487
|
+
routeDriven: {
|
|
1488
|
+
type: Boolean,
|
|
1489
|
+
default: !1
|
|
1490
|
+
},
|
|
1491
|
+
routeTabFilter: {},
|
|
1492
|
+
routeTabResolver: {},
|
|
1493
|
+
tabFallbackPath: { default: "" },
|
|
1494
|
+
tabMaxCount: {},
|
|
1495
|
+
fixedTabs: { default: () => [] },
|
|
1496
|
+
headerHeight: { default: "50px" },
|
|
1497
|
+
showHeader: {
|
|
1498
|
+
type: Boolean,
|
|
1499
|
+
default: !0
|
|
1500
|
+
},
|
|
1501
|
+
tabStorageKey: { default: "" },
|
|
1502
|
+
isValidTabPath: {},
|
|
1503
|
+
resolveTabUrl: {}
|
|
1504
|
+
}, {
|
|
1505
|
+
activeTabPath: {},
|
|
1506
|
+
activeTabPathModifiers: {}
|
|
1507
|
+
}),
|
|
1508
|
+
emits: /*@__PURE__*/ h([
|
|
1509
|
+
"menuSelect",
|
|
1510
|
+
"topMenuSelect",
|
|
1511
|
+
"toggleSidebar",
|
|
1512
|
+
"tabChange",
|
|
1513
|
+
"tabCloseAll",
|
|
1514
|
+
"tabCloseLeft",
|
|
1515
|
+
"tabCloseOthers",
|
|
1516
|
+
"tabCloseRight",
|
|
1517
|
+
"tabRefresh",
|
|
1518
|
+
"tabRemove",
|
|
1519
|
+
"tabPin",
|
|
1520
|
+
"tabReorder",
|
|
1521
|
+
"tabMaximize",
|
|
1522
|
+
"tabNewWindow"
|
|
1523
|
+
], ["update:activeTabPath"]),
|
|
1524
|
+
setup(e, { expose: t, emit: n }) {
|
|
1525
|
+
let r = e, a = n, u = ne(e, "activeTabPath"), p = m(ue, void 0), h = m(de, void 0), g = A("layoutRef"), _ = A("tabsRef"), y = E(!1), x = E(!1), S = E(!1), w = E([]), T = E(""), D = E([]), k = o(() => r.tabMaxCount ?? r.preferences.tabbar.maxCount), j;
|
|
1526
|
+
function ae(e) {
|
|
1527
|
+
return e.meta.layout !== "public" && e.meta.hideInTab !== !0 && !!e.meta.title;
|
|
1528
|
+
}
|
|
1529
|
+
function P(e) {
|
|
1530
|
+
let t = typeof e.meta.title == "string" ? e.meta.title : void 0;
|
|
1531
|
+
if (t) return {
|
|
1532
|
+
closable: e.meta.affixTab !== !0,
|
|
1533
|
+
icon: typeof e.meta.icon == "string" ? e.meta.icon : void 0,
|
|
1534
|
+
path: e.path,
|
|
1535
|
+
title: t
|
|
1536
|
+
};
|
|
1537
|
+
}
|
|
1538
|
+
function F() {
|
|
1539
|
+
return r.fixedTabs.map((e) => ({
|
|
1540
|
+
...e,
|
|
1541
|
+
closable: !1,
|
|
1542
|
+
pinned: !0
|
|
1543
|
+
}));
|
|
1544
|
+
}
|
|
1545
|
+
function I(e) {
|
|
1546
|
+
return {
|
|
1547
|
+
closable: e.closable !== !1,
|
|
1548
|
+
icon: e.icon,
|
|
1549
|
+
path: e.path,
|
|
1550
|
+
pinned: e.pinned === !0,
|
|
1551
|
+
title: e.title
|
|
1552
|
+
};
|
|
1553
|
+
}
|
|
1554
|
+
function oe() {
|
|
1555
|
+
if (r.isValidTabPath) return r.isValidTabPath;
|
|
1556
|
+
if (!(!h || !r.routeDriven)) return (e) => {
|
|
1557
|
+
try {
|
|
1558
|
+
let t = h.resolve(e)?.matched ?? [], n = t[t.length - 1];
|
|
1559
|
+
return n ? n.meta?.layout !== "public" && n.meta?.hideInTab !== !0 : !1;
|
|
1560
|
+
} catch {
|
|
1561
|
+
return !1;
|
|
1562
|
+
}
|
|
1563
|
+
};
|
|
1564
|
+
}
|
|
1565
|
+
function se(e) {
|
|
1566
|
+
if (!(!h || !r.routeDriven)) try {
|
|
1567
|
+
let t = h.resolve(e)?.matched ?? [], n = t[t.length - 1], r = typeof n?.meta?.title == "string" ? n.meta.title : void 0, i = typeof n?.meta?.icon == "string" ? n.meta.icon : void 0;
|
|
1568
|
+
return !r && !i ? void 0 : {
|
|
1569
|
+
icon: i,
|
|
1570
|
+
title: r
|
|
1571
|
+
};
|
|
1572
|
+
} catch {
|
|
1573
|
+
return;
|
|
1574
|
+
}
|
|
1575
|
+
}
|
|
1576
|
+
function ce(e) {
|
|
1577
|
+
if (!r.routeDriven || !(r.routeTabFilter ?? ae)(e)) return;
|
|
1578
|
+
let t = (r.routeTabResolver ?? P)(e);
|
|
1579
|
+
if (!t) return;
|
|
1580
|
+
let n = F(), i = new Set(n.map((e) => e.path)), a = w.value.filter((e) => !i.has(e.path)), o = Ft([...n, ...a], t, { maxCount: k.value });
|
|
1581
|
+
w.value = o, r.preferences.tabbar.visitHistory && (D.value = Jt(D.value, e.path)), Q();
|
|
1582
|
+
}
|
|
1583
|
+
function R(e) {
|
|
1584
|
+
r.routeDriven && h && e && e !== p?.path && h.push(e);
|
|
1585
|
+
}
|
|
1586
|
+
function z(e) {
|
|
1587
|
+
return r.tabFallbackPath ? r.tabFallbackPath : e[0]?.path ?? "";
|
|
1588
|
+
}
|
|
1589
|
+
let B = o({
|
|
1590
|
+
get: () => r.routeDriven ? p?.path ?? r.activeTabPath : u.value ?? r.activeTabPath,
|
|
1591
|
+
set: (e) => {
|
|
1592
|
+
r.routeDriven ? R(e) : u.value = e;
|
|
1593
|
+
}
|
|
1594
|
+
}), le = o(() => r.routeDriven ? w.value : r.tabs), fe = o(() => le.value.length > 0), V = o(() => r.preferences.sidebar.collapsed), U = o(() => typeof p?.meta.activeMenu == "string" ? p.meta.activeMenu : ""), W = o(() => {
|
|
1595
|
+
let e = p?.path || B.value, t = U.value;
|
|
1596
|
+
return t && H(r.menus, t) ? t : e && H(r.menus, e) ? e : r.activeMenuPath && H(r.menus, r.activeMenuPath) ? r.activeMenuPath : r.activeMenuPath || e;
|
|
1597
|
+
}), ge = o(() => p?.path || B.value || W.value), G = o(() => ({
|
|
1598
|
+
enable: r.preferences.breadcrumb?.enable ?? !0,
|
|
1599
|
+
hideOnlyOne: r.preferences.breadcrumb?.hideOnlyOne ?? !1,
|
|
1600
|
+
showHome: r.preferences.breadcrumb?.showHome ?? !0,
|
|
1601
|
+
showIcon: r.preferences.breadcrumb?.showIcon ?? !0
|
|
1602
|
+
})), _e = o(() => r.preferences.header.globalSearch ?? !0), ye = o(() => r.preferences.shortcutKeys?.globalSearch ?? !0), q = o(() => me(r.menus, W.value)), J = o(() => r.preferences.app.layout === "mixed-nav" && r.preferences.sidebar.enable), be = o(() => J.value ? r.menus.find((e) => !e.hidden && e.path === T.value)?.path ?? q.value : q.value), Y = o(() => {
|
|
1603
|
+
let e = he({
|
|
1604
|
+
activeTopMenuPath: be.value,
|
|
1605
|
+
layout: r.preferences.app.layout,
|
|
1606
|
+
menus: r.menus
|
|
1607
|
+
});
|
|
1608
|
+
return {
|
|
1609
|
+
...e,
|
|
1610
|
+
sidebarMenus: r.preferences.sidebar.enable ? e.sidebarMenus : []
|
|
1611
|
+
};
|
|
1612
|
+
}), xe = o(() => Y.value.sidebarMenus), X = o(() => Y.value.topMenus), Z = o(() => xe.value.length > 0), Se = o(() => X.value.length > 0), Ce = o(() => G.value.enable && Z.value && !Se.value), we = o(() => J.value ? "flat" : "tree"), Te = o(() => we.value === "tree" ? W.value : be.value), De = o(() => Se.value ? X.value : xe.value), Oe = o(() => De.value.some((e) => !e.hidden));
|
|
1613
|
+
M(() => [
|
|
1614
|
+
p?.fullPath,
|
|
1615
|
+
W.value,
|
|
1616
|
+
r.menus,
|
|
1617
|
+
r.preferences.app.layout,
|
|
1618
|
+
r.preferences.sidebar.enable
|
|
1619
|
+
], () => {
|
|
1620
|
+
T.value = q.value;
|
|
1621
|
+
}, { immediate: !0 }), M(() => [
|
|
1622
|
+
r.preferences.app.dynamicTitle ?? !0,
|
|
1623
|
+
p?.meta.title,
|
|
1624
|
+
r.title
|
|
1625
|
+
], ([e, t, n]) => {
|
|
1626
|
+
if (typeof document > "u") return;
|
|
1627
|
+
let r = typeof t == "string" ? t.trim() : "", i = n?.trim() ?? "";
|
|
1628
|
+
if (!e) {
|
|
1629
|
+
document.title = i;
|
|
1630
|
+
return;
|
|
1631
|
+
}
|
|
1632
|
+
!r && !i || (document.title = r && i && r !== i ? `${r} - ${i}` : r || i);
|
|
1633
|
+
}, { immediate: !0 });
|
|
1634
|
+
function ke() {
|
|
1635
|
+
if (!(!r.tabStorageKey || !r.preferences.tabbar.persist) && !(typeof sessionStorage > "u")) return {
|
|
1636
|
+
getItem: sessionStorage.getItem.bind(sessionStorage),
|
|
1637
|
+
removeItem: sessionStorage.removeItem.bind(sessionStorage),
|
|
1638
|
+
setItem: sessionStorage.setItem.bind(sessionStorage)
|
|
1639
|
+
};
|
|
1640
|
+
}
|
|
1641
|
+
function Q() {
|
|
1642
|
+
let e = ke();
|
|
1643
|
+
if (!e || !r.tabStorageKey || !r.routeDriven) return;
|
|
1644
|
+
let t = Ot({
|
|
1645
|
+
tabs: w.value.map(I),
|
|
1646
|
+
history: D.value
|
|
1647
|
+
});
|
|
1648
|
+
At(e, r.tabStorageKey, t);
|
|
1649
|
+
}
|
|
1650
|
+
function Ae() {
|
|
1651
|
+
let e = ke();
|
|
1652
|
+
!e || !r.tabStorageKey || Mt(e, r.tabStorageKey);
|
|
1653
|
+
}
|
|
1654
|
+
function Me() {
|
|
1655
|
+
if (!r.routeDriven) return;
|
|
1656
|
+
let e = ke();
|
|
1657
|
+
if (!e || !r.tabStorageKey) return;
|
|
1658
|
+
let t = jt(e, r.tabStorageKey), n = p?.path ?? "", i = Nt(t, {
|
|
1659
|
+
currentPath: n,
|
|
1660
|
+
currentTab: p ? (r.routeTabResolver ?? P)(p) : void 0,
|
|
1661
|
+
fixedTabs: F(),
|
|
1662
|
+
isValidPath: oe(),
|
|
1663
|
+
resolveTab: se
|
|
1664
|
+
});
|
|
1665
|
+
w.value = i.tabs, r.preferences.tabbar.visitHistory ? (n && i.history.unshift(n), D.value = Jt(i.history, n || "")) : D.value = [];
|
|
1666
|
+
}
|
|
1667
|
+
function Ne(e) {
|
|
1668
|
+
y.value = e?.matches ?? j?.matches ?? !1, y.value && (x.value = !1);
|
|
1669
|
+
}
|
|
1670
|
+
te(() => {
|
|
1671
|
+
typeof window > "u" || typeof window.matchMedia != "function" || (j = window.matchMedia("(max-width: 768px)"), Ne(), j.addEventListener?.("change", Ne));
|
|
1672
|
+
}), ee(() => {
|
|
1673
|
+
j?.removeEventListener?.("change", Ne);
|
|
1674
|
+
}), M(() => [
|
|
1675
|
+
r.routeDriven,
|
|
1676
|
+
k.value,
|
|
1677
|
+
r.fixedTabs
|
|
1678
|
+
], () => {
|
|
1679
|
+
if (!r.routeDriven) {
|
|
1680
|
+
w.value = [];
|
|
1681
|
+
return;
|
|
1682
|
+
}
|
|
1683
|
+
let e = F(), t = new Set(e.map((e) => e.path)), n = [...e];
|
|
1684
|
+
for (let e of w.value.filter((e) => !t.has(e.path))) n = Ft(n, e, { maxCount: k.value });
|
|
1685
|
+
w.value = It(Pt(n), k.value, B.value), Q();
|
|
1686
|
+
}, {
|
|
1687
|
+
deep: !0,
|
|
1688
|
+
immediate: !0
|
|
1689
|
+
}), M(() => p?.fullPath, () => {
|
|
1690
|
+
p && ce(p);
|
|
1691
|
+
}, { immediate: !0 }), M(() => [
|
|
1692
|
+
r.routeDriven,
|
|
1693
|
+
r.tabStorageKey,
|
|
1694
|
+
r.preferences.tabbar.persist
|
|
1695
|
+
], (e, t) => {
|
|
1696
|
+
let n = e[0], r = e[2], i = t?.[1] && t?.[2];
|
|
1697
|
+
n && r && !i && Me(), !r && i && Ae();
|
|
1698
|
+
}, { immediate: !1 }), ee(() => {
|
|
1699
|
+
Q();
|
|
1700
|
+
});
|
|
1701
|
+
function $() {
|
|
1702
|
+
if (y.value) {
|
|
1703
|
+
x.value = !x.value;
|
|
1704
|
+
return;
|
|
1705
|
+
}
|
|
1706
|
+
a("toggleSidebar");
|
|
1707
|
+
}
|
|
1708
|
+
function Pe(e) {
|
|
1709
|
+
x.value = !1, a("menuSelect", e);
|
|
1710
|
+
}
|
|
1711
|
+
function Fe(e) {
|
|
1712
|
+
let t = H(r.menus, e), n = t?.children?.filter((e) => !e.hidden) ?? [], i = !!t?.externalLink && t?.externalTarget !== "_self";
|
|
1713
|
+
J.value && t && (n.length > 0 || !i) && (T.value = t.path), a("topMenuSelect", e), !(J.value && n.length > 0 && !r.preferences.sidebar.autoActivateChild) && Pe(pe(t) || e);
|
|
1714
|
+
}
|
|
1715
|
+
function Ie(e) {
|
|
1716
|
+
Pe(pe(H(r.menus, e)) || e);
|
|
1717
|
+
}
|
|
1718
|
+
function Le(e) {
|
|
1719
|
+
a("tabChange", e);
|
|
1720
|
+
}
|
|
1721
|
+
function Re(e) {
|
|
1722
|
+
if (r.routeDriven) {
|
|
1723
|
+
let t = w.value.findIndex((t) => t.path === e), n = Lt(w.value, e);
|
|
1724
|
+
if (w.value = n, B.value === e) {
|
|
1725
|
+
let i = r.preferences.tabbar.visitHistory;
|
|
1726
|
+
R(Yt(n, e, D.value, {
|
|
1727
|
+
useHistory: i,
|
|
1728
|
+
priorClosedIndex: t
|
|
1729
|
+
}) || z(n));
|
|
1730
|
+
}
|
|
1731
|
+
Q();
|
|
1732
|
+
}
|
|
1733
|
+
a("tabRemove", e);
|
|
1734
|
+
}
|
|
1735
|
+
function ze(e) {
|
|
1736
|
+
r.routeDriven && (w.value = Rt(w.value, e), R(e), Q()), a("tabCloseLeft", e);
|
|
1737
|
+
}
|
|
1738
|
+
function Be(e) {
|
|
1739
|
+
r.routeDriven && (w.value = zt(w.value, e), R(e), Q()), a("tabCloseRight", e);
|
|
1740
|
+
}
|
|
1741
|
+
function Ve(e) {
|
|
1742
|
+
r.routeDriven && (w.value = Bt(w.value, e), R(e), Q()), a("tabCloseOthers", e);
|
|
1743
|
+
}
|
|
1744
|
+
function He() {
|
|
1745
|
+
r.routeDriven && (w.value = Vt(w.value), R(z(w.value)), Q()), a("tabCloseAll");
|
|
1746
|
+
}
|
|
1747
|
+
function Ue(e, t) {
|
|
1748
|
+
r.routeDriven && (w.value = t ? Ht(w.value, e) : Ut(w.value, e), Q()), a("tabPin", e, t);
|
|
1749
|
+
}
|
|
1750
|
+
function We(e, t) {
|
|
1751
|
+
r.routeDriven && (w.value = Xt(w.value, e, t), Q()), a("tabReorder", e, t);
|
|
1752
|
+
}
|
|
1753
|
+
function Ge(e) {
|
|
1754
|
+
let t = r.resolveTabUrl ? r.resolveTabUrl(e) : (() => {
|
|
1755
|
+
if (h) try {
|
|
1756
|
+
return h.resolve(e)?.fullPath ?? e;
|
|
1757
|
+
} catch {
|
|
1758
|
+
return e;
|
|
1759
|
+
}
|
|
1760
|
+
return e;
|
|
1761
|
+
})();
|
|
1762
|
+
window.open(t, "_blank", "noopener,noreferrer"), a("tabNewWindow", e);
|
|
1763
|
+
}
|
|
1764
|
+
function Ke(e) {
|
|
1765
|
+
S.value = e, a("tabMaximize", e);
|
|
1766
|
+
}
|
|
1767
|
+
function Je(e) {
|
|
1768
|
+
e.key === "Escape" && S.value && (e.preventDefault(), _.value?.setMaximized(!1), a("tabMaximize", !1));
|
|
1769
|
+
}
|
|
1770
|
+
return M(S, (e) => {
|
|
1771
|
+
typeof document > "u" || (e ? document.addEventListener("keydown", Je) : document.removeEventListener("keydown", Je));
|
|
1772
|
+
}), ee(() => {
|
|
1773
|
+
typeof document < "u" && document.removeEventListener("keydown", Je);
|
|
1774
|
+
}), t({
|
|
1775
|
+
getLayoutElement: () => g.value?.$el,
|
|
1776
|
+
getLayoutInstance: () => g.value,
|
|
1777
|
+
getTabs: () => [...le.value],
|
|
1778
|
+
getVisitHistory: () => [...D.value],
|
|
1779
|
+
resetTabs: () => {
|
|
1780
|
+
w.value = Vt(w.value), D.value = [], R(z(w.value)), Q();
|
|
1781
|
+
},
|
|
1782
|
+
resetTabSnapshot: () => {
|
|
1783
|
+
Ae();
|
|
1784
|
+
}
|
|
1785
|
+
}), (t, n) => (b(), s(O(L), {
|
|
1786
|
+
ref_key: "layoutRef",
|
|
1787
|
+
ref: g,
|
|
1788
|
+
class: v(["lumal-layout", {
|
|
1789
|
+
"is-sidebar-collapsed": V.value,
|
|
1790
|
+
"is-sidebar-hidden": !Z.value,
|
|
1791
|
+
"is-mobile-menu-hidden": !x.value,
|
|
1792
|
+
"is-content-maximized": S.value
|
|
1793
|
+
}]),
|
|
1794
|
+
"data-layout": e.preferences.app.layout,
|
|
1795
|
+
direction: "vertical"
|
|
1796
|
+
}, {
|
|
1797
|
+
default: N(() => [e.showHeader ? ie((b(), s(je, {
|
|
1798
|
+
key: 0,
|
|
1799
|
+
title: e.title,
|
|
1800
|
+
collapsed: y.value ? !x.value : V.value,
|
|
1801
|
+
height: e.headerHeight,
|
|
1802
|
+
"mobile-only-toggle": !Z.value && Se.value,
|
|
1803
|
+
"sidebar-enabled": Z.value || Se.value,
|
|
1804
|
+
"toggle-after-title": Z.value && !y.value,
|
|
1805
|
+
onToggleCollapse: $
|
|
1806
|
+
}, d({ _: 2 }, [
|
|
1807
|
+
t.$slots.logo ? {
|
|
1808
|
+
name: "logo",
|
|
1809
|
+
fn: N(() => [C(t.$slots, "logo", {}, void 0, !0)]),
|
|
1810
|
+
key: "0"
|
|
1811
|
+
} : void 0,
|
|
1812
|
+
Se.value ? {
|
|
1813
|
+
name: "navigation",
|
|
1814
|
+
fn: N(() => [f(Ct, {
|
|
1815
|
+
menus: X.value,
|
|
1816
|
+
"active-path": Te.value,
|
|
1817
|
+
align: e.preferences.header.menuAlign,
|
|
1818
|
+
"max-width": e.preferences.header.menuMaxWidth,
|
|
1819
|
+
mode: we.value,
|
|
1820
|
+
onSelect: Fe
|
|
1821
|
+
}, null, 8, [
|
|
1822
|
+
"menus",
|
|
1823
|
+
"active-path",
|
|
1824
|
+
"align",
|
|
1825
|
+
"max-width",
|
|
1826
|
+
"mode"
|
|
1827
|
+
])]),
|
|
1828
|
+
key: "1"
|
|
1829
|
+
} : void 0,
|
|
1830
|
+
Ce.value ? {
|
|
1831
|
+
name: "breadcrumb",
|
|
1832
|
+
fn: N(() => [f(K, {
|
|
1833
|
+
class: "lumal-layout__header-breadcrumb",
|
|
1834
|
+
"active-menu-path": W.value,
|
|
1835
|
+
"active-path": ge.value,
|
|
1836
|
+
"hide-only-one": G.value.hideOnlyOne,
|
|
1837
|
+
menus: e.menus,
|
|
1838
|
+
"show-home": G.value.showHome,
|
|
1839
|
+
"show-icon": G.value.showIcon,
|
|
1840
|
+
onSelect: Ie
|
|
1841
|
+
}, null, 8, [
|
|
1842
|
+
"active-menu-path",
|
|
1843
|
+
"active-path",
|
|
1844
|
+
"hide-only-one",
|
|
1845
|
+
"menus",
|
|
1846
|
+
"show-home",
|
|
1847
|
+
"show-icon"
|
|
1848
|
+
])]),
|
|
1849
|
+
key: "2"
|
|
1850
|
+
} : void 0,
|
|
1851
|
+
_e.value || t.$slots.headerActions ? {
|
|
1852
|
+
name: "actions",
|
|
1853
|
+
fn: N(() => [_e.value ? (b(), s(Ee, {
|
|
1854
|
+
key: 0,
|
|
1855
|
+
menus: e.menus,
|
|
1856
|
+
shortcut: ye.value,
|
|
1857
|
+
onSelect: Ie
|
|
1858
|
+
}, null, 8, ["menus", "shortcut"])) : c("", !0), C(t.$slots, "headerActions", {}, void 0, !0)]),
|
|
1859
|
+
key: "3"
|
|
1860
|
+
} : void 0
|
|
1861
|
+
]), 1032, [
|
|
1862
|
+
"title",
|
|
1863
|
+
"collapsed",
|
|
1864
|
+
"height",
|
|
1865
|
+
"mobile-only-toggle",
|
|
1866
|
+
"sidebar-enabled",
|
|
1867
|
+
"toggle-after-title"
|
|
1868
|
+
])), [[re, !S.value]]) : c("", !0), f(O(L), { class: "lumal-layout__body" }, {
|
|
1869
|
+
default: N(() => [
|
|
1870
|
+
Oe.value && !S.value ? (b(), l("button", {
|
|
1871
|
+
key: 0,
|
|
1872
|
+
class: "lumal-layout__sidebar-scrim",
|
|
1873
|
+
type: "button",
|
|
1874
|
+
"aria-label": "关闭侧边栏",
|
|
1875
|
+
onClick: n[0] ||= (e) => x.value = !1
|
|
1876
|
+
})) : c("", !0),
|
|
1877
|
+
S.value ? c("", !0) : (b(), s(i, {
|
|
1878
|
+
key: 1,
|
|
1879
|
+
name: "lumal-layout-sidebar",
|
|
1880
|
+
appear: ""
|
|
1881
|
+
}, {
|
|
1882
|
+
default: N(() => [Z.value ? (b(), s(qe, {
|
|
1883
|
+
key: 0,
|
|
1884
|
+
class: "lumal-layout__desktop-sidebar",
|
|
1885
|
+
"aria-label": "主菜单",
|
|
1886
|
+
menus: xe.value,
|
|
1887
|
+
"active-path": W.value,
|
|
1888
|
+
collapsed: V.value,
|
|
1889
|
+
width: `${e.preferences.sidebar.width}px`,
|
|
1890
|
+
"collapsed-width": "64px",
|
|
1891
|
+
onSelect: Pe
|
|
1892
|
+
}, null, 8, [
|
|
1893
|
+
"menus",
|
|
1894
|
+
"active-path",
|
|
1895
|
+
"collapsed",
|
|
1896
|
+
"width"
|
|
1897
|
+
])) : c("", !0)]),
|
|
1898
|
+
_: 1
|
|
1899
|
+
})),
|
|
1900
|
+
Oe.value && !S.value ? (b(), s(qe, {
|
|
1901
|
+
key: 2,
|
|
1902
|
+
class: "lumal-layout__mobile-sidebar",
|
|
1903
|
+
"aria-label": "移动菜单",
|
|
1904
|
+
"aria-hidden": !x.value,
|
|
1905
|
+
inert: !x.value || void 0,
|
|
1906
|
+
menus: De.value,
|
|
1907
|
+
"active-path": W.value,
|
|
1908
|
+
collapsed: !1,
|
|
1909
|
+
width: `${e.preferences.sidebar.width}px`,
|
|
1910
|
+
"collapsed-width": "64px",
|
|
1911
|
+
onSelect: Pe
|
|
1912
|
+
}, null, 8, [
|
|
1913
|
+
"aria-hidden",
|
|
1914
|
+
"inert",
|
|
1915
|
+
"menus",
|
|
1916
|
+
"active-path",
|
|
1917
|
+
"width"
|
|
1918
|
+
])) : c("", !0),
|
|
1919
|
+
f(O(L), {
|
|
1920
|
+
class: "lumal-layout__main",
|
|
1921
|
+
direction: "vertical",
|
|
1922
|
+
"data-layout-fullscreen-target": ""
|
|
1923
|
+
}, {
|
|
1924
|
+
default: N(() => [
|
|
1925
|
+
G.value.enable && !Ce.value && !S.value ? (b(), s(K, {
|
|
1926
|
+
key: 0,
|
|
1927
|
+
"active-menu-path": W.value,
|
|
1928
|
+
"active-path": ge.value,
|
|
1929
|
+
"hide-only-one": G.value.hideOnlyOne,
|
|
1930
|
+
menus: e.menus,
|
|
1931
|
+
"show-home": G.value.showHome,
|
|
1932
|
+
"show-icon": G.value.showIcon,
|
|
1933
|
+
onSelect: Ie
|
|
1934
|
+
}, null, 8, [
|
|
1935
|
+
"active-menu-path",
|
|
1936
|
+
"active-path",
|
|
1937
|
+
"hide-only-one",
|
|
1938
|
+
"menus",
|
|
1939
|
+
"show-home",
|
|
1940
|
+
"show-icon"
|
|
1941
|
+
])) : c("", !0),
|
|
1942
|
+
fe.value && e.preferences.tabbar.enable ? (b(), s(mt, {
|
|
1943
|
+
key: 1,
|
|
1944
|
+
ref_key: "tabsRef",
|
|
1945
|
+
ref: _,
|
|
1946
|
+
"active-path": B.value,
|
|
1947
|
+
"onUpdate:activePath": n[1] ||= (e) => B.value = e,
|
|
1948
|
+
tabs: le.value,
|
|
1949
|
+
"show-icon": e.preferences.tabbar.showIcon,
|
|
1950
|
+
"show-maximize": e.preferences.tabbar.showMaximize,
|
|
1951
|
+
"show-more": e.preferences.tabbar.showMore,
|
|
1952
|
+
"show-refresh": e.preferences.tabbar.showRefresh,
|
|
1953
|
+
draggable: e.preferences.tabbar.draggable,
|
|
1954
|
+
wheelable: e.preferences.tabbar.wheelable,
|
|
1955
|
+
"middle-click-to-close": e.preferences.tabbar.middleClickToClose,
|
|
1956
|
+
"style-type": e.preferences.tabbar.styleType,
|
|
1957
|
+
onChange: Le,
|
|
1958
|
+
onCloseAll: He,
|
|
1959
|
+
onCloseLeft: ze,
|
|
1960
|
+
onCloseOthers: Ve,
|
|
1961
|
+
onCloseRight: Be,
|
|
1962
|
+
onMaximize: Ke,
|
|
1963
|
+
onNewWindow: Ge,
|
|
1964
|
+
onPin: Ue,
|
|
1965
|
+
onRefresh: n[2] ||= (e) => a("tabRefresh", e),
|
|
1966
|
+
onRemove: Re,
|
|
1967
|
+
onReorder: We
|
|
1968
|
+
}, null, 8, [
|
|
1969
|
+
"active-path",
|
|
1970
|
+
"tabs",
|
|
1971
|
+
"show-icon",
|
|
1972
|
+
"show-maximize",
|
|
1973
|
+
"show-more",
|
|
1974
|
+
"show-refresh",
|
|
1975
|
+
"draggable",
|
|
1976
|
+
"wheelable",
|
|
1977
|
+
"middle-click-to-close",
|
|
1978
|
+
"style-type"
|
|
1979
|
+
])) : c("", !0),
|
|
1980
|
+
f(ve, null, {
|
|
1981
|
+
default: N(() => [C(t.$slots, "default", {}, void 0, !0)]),
|
|
1982
|
+
_: 3
|
|
1983
|
+
})
|
|
1984
|
+
]),
|
|
1985
|
+
_: 3
|
|
1986
|
+
})
|
|
1987
|
+
]),
|
|
1988
|
+
_: 3
|
|
1989
|
+
})]),
|
|
1990
|
+
_: 3
|
|
1991
|
+
}, 8, ["data-layout", "class"]));
|
|
1992
|
+
}
|
|
1993
|
+
}), [["__scopeId", "data-v-c4a60970"]]), $t = {
|
|
1994
|
+
key: 0,
|
|
1995
|
+
class: "lumal-router-view__progress",
|
|
1996
|
+
"aria-hidden": "true"
|
|
1997
|
+
}, en = {
|
|
1998
|
+
key: 1,
|
|
1999
|
+
class: "lumal-router-view__loading",
|
|
2000
|
+
"aria-hidden": "true"
|
|
2001
|
+
}, tn = /*#__PURE__*/ e(/* @__PURE__ */ p({
|
|
2002
|
+
__name: "LumalRouterView",
|
|
2003
|
+
props: {
|
|
2004
|
+
viewKey: { default: "default" },
|
|
2005
|
+
transition: {
|
|
2006
|
+
type: Boolean,
|
|
2007
|
+
default: !1
|
|
2008
|
+
},
|
|
2009
|
+
transitionName: { default: "fade-side" },
|
|
2010
|
+
progress: {
|
|
2011
|
+
type: Boolean,
|
|
2012
|
+
default: !1
|
|
2013
|
+
},
|
|
2014
|
+
loading: {
|
|
2015
|
+
type: Boolean,
|
|
2016
|
+
default: !1
|
|
2017
|
+
},
|
|
2018
|
+
cache: {
|
|
2019
|
+
type: Boolean,
|
|
2020
|
+
default: !1
|
|
2021
|
+
},
|
|
2022
|
+
cacheMax: { default: 0 }
|
|
2023
|
+
},
|
|
2024
|
+
setup(e, { expose: t }) {
|
|
2025
|
+
let r = e, a = A("routerViewRef"), d = E(!1), p = E(!1), m = /* @__PURE__ */ new Set([r.viewKey]), h = o(() => r.cacheMax > 0 ? r.cacheMax : void 0), g = o(() => r.transition ? r.transitionName : void 0), _;
|
|
2026
|
+
function v() {
|
|
2027
|
+
_ &&= (clearTimeout(_), void 0);
|
|
2028
|
+
}
|
|
2029
|
+
function y(e) {
|
|
2030
|
+
return r.cache && m.has(e);
|
|
2031
|
+
}
|
|
2032
|
+
function te(e) {
|
|
2033
|
+
d.value = !1, p.value = !1, m.add(e), _ = void 0;
|
|
2034
|
+
}
|
|
2035
|
+
function x(e) {
|
|
2036
|
+
if (v(), d.value = r.progress && !y(e), p.value = r.loading && !y(e), !d.value && !p.value) {
|
|
2037
|
+
m.add(e);
|
|
2038
|
+
return;
|
|
2039
|
+
}
|
|
2040
|
+
_ = setTimeout(te, 520, e);
|
|
2041
|
+
}
|
|
2042
|
+
return M(() => r.viewKey, (e, t) => {
|
|
2043
|
+
t !== void 0 && x(e);
|
|
2044
|
+
}), ee(() => {
|
|
2045
|
+
v();
|
|
2046
|
+
}), t({ getRouterViewElement: () => a.value }), (t, r) => (b(), l("div", {
|
|
2047
|
+
ref_key: "routerViewRef",
|
|
2048
|
+
ref: a,
|
|
2049
|
+
class: "lumal-router-view"
|
|
2050
|
+
}, [
|
|
2051
|
+
d.value ? (b(), l("div", $t, [...r[0] ||= [u("span", { class: "lumal-router-view__progress-bar" }, null, -1)]])) : c("", !0),
|
|
2052
|
+
f(O(le), null, {
|
|
2053
|
+
default: N(({ Component: t }) => [g.value ? (b(), s(i, {
|
|
2054
|
+
key: 0,
|
|
2055
|
+
appear: "",
|
|
2056
|
+
mode: "out-in",
|
|
2057
|
+
name: g.value
|
|
2058
|
+
}, {
|
|
2059
|
+
default: N(() => [e.cache ? (b(), s(n, {
|
|
2060
|
+
key: 0,
|
|
2061
|
+
max: h.value
|
|
2062
|
+
}, [(b(), s(T(t), { key: e.viewKey }))], 1032, ["max"])) : (b(), s(T(t), { key: e.viewKey }))]),
|
|
2063
|
+
_: 2
|
|
2064
|
+
}, 1032, ["name"])) : e.cache ? (b(), s(n, {
|
|
2065
|
+
key: 1,
|
|
2066
|
+
max: h.value
|
|
2067
|
+
}, [(b(), s(T(t), { key: e.viewKey }))], 1032, ["max"])) : (b(), s(T(t), { key: e.viewKey }))]),
|
|
2068
|
+
_: 1
|
|
2069
|
+
}),
|
|
2070
|
+
p.value ? (b(), l("div", en, [...r[1] ||= [u("span", { class: "lumal-router-view__loading-dot" }, null, -1)]])) : c("", !0)
|
|
2071
|
+
], 512));
|
|
2072
|
+
}
|
|
2073
|
+
}), [["__scopeId", "data-v-3ad5cc30"]]);
|
|
2074
|
+
//#endregion
|
|
2075
|
+
export { qe as A, he as B, kt as C, At as D, Ot as E, H as F, U as I, V as L, Ee as M, ve as N, Ct as O, K as P, me as R, Mt as S, Nt as T, Yt as _, Gt as a, Tt as b, Bt as c, zt as d, Wt as f, Zt as g, Xt as h, Kt as i, je as j, mt as k, Lt as l, Jt as m, Qt as n, It as o, Ht as p, Ft as r, Vt as s, tn as t, Rt as u, Pt as v, jt as w, wt as x, Ut as y, pe as z };
|