mamba-layout 0.2.0 → 0.3.0
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/dist/layout/BaseLayout.css +1 -1
- package/dist/layout/BaseLayout.vue.js +2 -2
- package/dist/layout/BaseLayout.vue2.js +79 -43
- package/dist/layout/components/LayoutBreadcrumb.vue.d.ts +1 -1
- package/dist/layout/components/UserInfo.vue.js +2 -2
- package/dist/layout/components/UserInfo2.css +1 -1
- package/dist/layout/components/mobile/AppSelectMobile.vue.js +13 -13
- package/dist/layout/components/mobile/AsideBarMobile.css +1 -1
- package/dist/layout/components/mobile/AsideBarMobile.vue.js +3 -3
- package/dist/layout/components/mobile/AsideBarMobile.vue2.js +24 -22
- package/dist/layout/components/mobile/HeaderRightMobile.css +1 -1
- package/dist/layout/components/mobile/HeaderRightMobile.vue.js +1 -1
- package/dist/layout/components/mobile/HeaderRightMobile.vue2.js +17 -19
- package/dist/layout/components/mobile/MobileMenuToggle.css +1 -1
- package/dist/layout/components/mobile/MobileMenuToggle.vue.js +1 -1
- package/dist/layout/components/mobile/MobileMenuToggle.vue2.js +15 -13
- package/dist/layout/hooks/useState.js +56 -55
- package/dist/layout.css +1 -1
- package/dist/layout.es.js +9402 -9491
- package/dist/layout.global.js +30 -30
- package/package.json +1 -1
|
@@ -1,99 +1,100 @@
|
|
|
1
|
-
import { ref as o, onActivated as
|
|
2
|
-
import { useRoute as
|
|
3
|
-
import { createContext as
|
|
4
|
-
import { replaceName as
|
|
5
|
-
import { useSetting as
|
|
6
|
-
const [Q,
|
|
1
|
+
import { ref as o, onActivated as K, onMounted as N, onUnmounted as W, watch as y } from "vue";
|
|
2
|
+
import { useRoute as j } from "vue-router";
|
|
3
|
+
import { createContext as k } from "../../utils/createContext.js";
|
|
4
|
+
import { replaceName as z, tname as B, getRouteLastVisibleParentMenu as D } from "../../utils/repoUtils.js";
|
|
5
|
+
import { useSetting as H } from "./useSetting.js";
|
|
6
|
+
const U = 1024, [Q, V] = k("LayoutRoot");
|
|
7
7
|
function X() {
|
|
8
|
-
const s =
|
|
8
|
+
const s = j(), h = o([]), r = o(), C = o(), u = o(""), i = o(""), L = o(""), m = H(), M = o(!0), I = o(!1), O = o(), v = () => {
|
|
9
9
|
var t;
|
|
10
|
-
return ((t = m.value.menus) == null ? void 0 : t.filter((
|
|
10
|
+
return ((t = m.value.menus) == null ? void 0 : t.filter((d) => {
|
|
11
11
|
var n;
|
|
12
|
-
return ((n =
|
|
12
|
+
return ((n = d.meta) == null ? void 0 : n.appId) == i.value;
|
|
13
13
|
})) || [];
|
|
14
|
-
}, b = (t,
|
|
15
|
-
var
|
|
16
|
-
const l = f ? [...f] : [], p = [],
|
|
14
|
+
}, b = (t, d, n = 0, f) => {
|
|
15
|
+
var x, w, R, E;
|
|
16
|
+
const l = f ? [...f] : [], p = [], P = [];
|
|
17
17
|
for (const e in t) {
|
|
18
18
|
[...l], t[e];
|
|
19
|
-
const a = ((
|
|
20
|
-
a == t[e].path ? p.push({ index: e, item: t[e] }) :
|
|
19
|
+
const a = ((x = s.meta) == null ? void 0 : x.parent) || s.path, c = ((w = t[e].path) == null ? void 0 : w.replace(/\/:(\w+)/g, "/([^/]+)")) || "", $ = new RegExp(`^${c}$`);
|
|
20
|
+
a == t[e].path ? p.push({ index: e, item: t[e] }) : $.test(a) && P.push({ index: e, item: t[e] });
|
|
21
21
|
}
|
|
22
|
-
const g = p.length > 0 ? p :
|
|
22
|
+
const g = p.length > 0 ? p : P;
|
|
23
23
|
if (g.length > 0) {
|
|
24
24
|
const e = g[0], a = [...l];
|
|
25
25
|
a[n] = e.item, r.value = {
|
|
26
26
|
...e.item,
|
|
27
27
|
paths: a.slice(0, n + 1)
|
|
28
|
-
}, i.value = ((R = e.item.meta) == null ? void 0 : R.appId) || "",
|
|
28
|
+
}, i.value = ((R = e.item.meta) == null ? void 0 : R.appId) || "", C.value = d;
|
|
29
29
|
}
|
|
30
30
|
for (const e in t)
|
|
31
|
-
if (t[e].children && ((
|
|
32
|
-
const a = t[e].children || [],
|
|
33
|
-
|
|
31
|
+
if (t[e].children && ((E = t[e].children) != null && E.length)) {
|
|
32
|
+
const a = t[e].children || [], c = [...l];
|
|
33
|
+
c[n] = t[e], b(a, t[e], n + 1, c);
|
|
34
34
|
}
|
|
35
|
-
|
|
35
|
+
L.value = s.meta.parentPath || D(
|
|
36
36
|
s.path.toLowerCase(),
|
|
37
37
|
m.value.menus || []
|
|
38
38
|
) || s.path;
|
|
39
|
-
},
|
|
40
|
-
var f, l, p,
|
|
39
|
+
}, A = () => {
|
|
40
|
+
var f, l, p, P, g, x, w, R, E, e;
|
|
41
41
|
b(m.value.menus || []), i.value || (i.value = ((p = (l = (f = m.value.menus) == null ? void 0 : f.find(
|
|
42
42
|
(a) => {
|
|
43
|
-
var
|
|
44
|
-
return (
|
|
43
|
+
var c;
|
|
44
|
+
return (c = a.path) == null ? void 0 : c.startsWith(u.value);
|
|
45
45
|
}
|
|
46
46
|
)) == null ? void 0 : l.meta) == null ? void 0 : p.appId) || "");
|
|
47
|
-
const t = ((
|
|
48
|
-
|
|
49
|
-
), n = ((
|
|
50
|
-
document.title =
|
|
51
|
-
},
|
|
52
|
-
|
|
47
|
+
const t = ((P = r.value) == null ? void 0 : P.paths) || [], d = z(
|
|
48
|
+
B(((x = (g = r.value) == null ? void 0 : g.meta) == null ? void 0 : x.translations) || {}, "name")
|
|
49
|
+
), n = ((w = r.value) == null ? void 0 : w.path) == ((R = t[1]) == null ? void 0 : R.path) ? "" : z(B(((e = (E = t[1]) == null ? void 0 : E.meta) == null ? void 0 : e.translations) || {}, "name"));
|
|
50
|
+
document.title = d + (n ? ` - ${n}` : "");
|
|
51
|
+
}, T = () => {
|
|
52
|
+
u.value = "/" + (s.path.split("/").filter(Boolean).shift() || ""), A(), h.value = v();
|
|
53
53
|
};
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
T(), K(() => {
|
|
55
|
+
T();
|
|
56
56
|
});
|
|
57
57
|
const S = () => {
|
|
58
|
-
|
|
58
|
+
const t = window.innerWidth < U;
|
|
59
|
+
I.value = t, M.value = !t;
|
|
59
60
|
};
|
|
60
|
-
return S(),
|
|
61
|
+
return S(), N(() => {
|
|
61
62
|
window.addEventListener("resize", S);
|
|
62
|
-
}),
|
|
63
|
+
}), W(() => {
|
|
63
64
|
window.removeEventListener("resize", S);
|
|
64
|
-
}),
|
|
65
|
-
() =>
|
|
66
|
-
() => void (h.value =
|
|
67
|
-
),
|
|
65
|
+
}), y(
|
|
66
|
+
() => u.value,
|
|
67
|
+
() => void (h.value = v())
|
|
68
|
+
), y(
|
|
68
69
|
() => [s.path, m.value.menus],
|
|
69
70
|
() => {
|
|
70
|
-
|
|
71
|
+
L.value = "", r.value = void 0, u.value = "/" + (s.path.split("/").filter(Boolean).shift() || ""), A(), h.value = v(), I.value && (M.value = !1);
|
|
71
72
|
}
|
|
72
|
-
),
|
|
73
|
+
), V({
|
|
73
74
|
menus: h,
|
|
74
75
|
currentEndRoute: r,
|
|
75
|
-
currentTabPath:
|
|
76
|
+
currentTabPath: u,
|
|
76
77
|
currentAppId: i,
|
|
77
|
-
defaultParentActive:
|
|
78
|
-
sideOpen:
|
|
79
|
-
isMobile:
|
|
80
|
-
getMenus:
|
|
81
|
-
currentEndParentRoute:
|
|
78
|
+
defaultParentActive: L,
|
|
79
|
+
sideOpen: M,
|
|
80
|
+
isMobile: I,
|
|
81
|
+
getMenus: v,
|
|
82
|
+
currentEndParentRoute: C
|
|
82
83
|
}), {
|
|
83
84
|
menus: h,
|
|
84
85
|
currentEndRoute: r,
|
|
85
|
-
currentTabPath:
|
|
86
|
+
currentTabPath: u,
|
|
86
87
|
currentAppId: i,
|
|
87
|
-
defaultParentActive:
|
|
88
|
-
sideOpen:
|
|
89
|
-
isMobile:
|
|
90
|
-
getMenus:
|
|
91
|
-
currentEndParentRoute:
|
|
92
|
-
leftScrollRef:
|
|
88
|
+
defaultParentActive: L,
|
|
89
|
+
sideOpen: M,
|
|
90
|
+
isMobile: I,
|
|
91
|
+
getMenus: v,
|
|
92
|
+
currentEndParentRoute: C,
|
|
93
|
+
leftScrollRef: O
|
|
93
94
|
};
|
|
94
95
|
}
|
|
95
96
|
export {
|
|
96
97
|
Q as injectLayoutContext,
|
|
97
|
-
|
|
98
|
+
V as provideLayoutContext,
|
|
98
99
|
X as useStateHook
|
|
99
100
|
};
|