@keyblade/pro-components 1.15.0-alpha.4 → 1.15.0-alpha.5
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/es/pro-layout/hooks.js +38 -38
- package/package.json +1 -1
package/es/pro-layout/hooks.js
CHANGED
|
@@ -10,42 +10,42 @@ var J = (c, s, n) => s in c ? V(c, s, { enumerable: !0, configurable: !0, writab
|
|
|
10
10
|
$.call(s, n) && J(c, n, s[n]);
|
|
11
11
|
return c;
|
|
12
12
|
}, A = (c, s) => X(c, Y(s));
|
|
13
|
-
var
|
|
13
|
+
var W = (c, s, n) => new Promise((K, P) => {
|
|
14
14
|
var p = (f) => {
|
|
15
15
|
try {
|
|
16
|
-
|
|
16
|
+
u(n.next(f));
|
|
17
17
|
} catch (d) {
|
|
18
|
-
|
|
18
|
+
P(d);
|
|
19
19
|
}
|
|
20
20
|
}, M = (f) => {
|
|
21
21
|
try {
|
|
22
|
-
|
|
22
|
+
u(n.throw(f));
|
|
23
23
|
} catch (d) {
|
|
24
|
-
|
|
24
|
+
P(d);
|
|
25
25
|
}
|
|
26
|
-
},
|
|
27
|
-
|
|
26
|
+
}, u = (f) => f.done ? K(f.value) : Promise.resolve(f.value).then(p, M);
|
|
27
|
+
u((n = n.apply(c, s)).next());
|
|
28
28
|
});
|
|
29
29
|
import { ref as v, computed as _, watch as E } from "vue";
|
|
30
30
|
import { useRoute as I, useRouter as m } from "vue-router";
|
|
31
|
-
import { ProLayoutMode as k, ProLayoutMenuType as
|
|
31
|
+
import { ProLayoutMode as k, ProLayoutMenuType as D } from "./enum.js";
|
|
32
32
|
const ne = (c) => {
|
|
33
|
-
const s = I(), n = m(), K = v([]),
|
|
33
|
+
const s = I(), n = m(), K = v([]), P = v([]), p = v([]), M = v([]), u = v(), f = v([]), d = v({}), N = v([]), h = v([]), T = v([]), S = v([]), y = v([]), g = _(() => {
|
|
34
34
|
const e = [...c.menuItems], a = (t) => {
|
|
35
35
|
t.forEach((l) => {
|
|
36
36
|
if (l != null && l.children && l.children.length > 0) {
|
|
37
37
|
if ((l == null ? void 0 : l.topChildrenMenu) !== void 0)
|
|
38
38
|
l.children = l.children.map((i) => A(O({}, i), { topMenu: l == null ? void 0 : l.topChildrenMenu }));
|
|
39
39
|
else {
|
|
40
|
-
const i = l.children.find((
|
|
41
|
-
i && (l.topChildrenMenu = i.topMenu, l.children = l.children.map((
|
|
40
|
+
const i = l.children.find((o) => o.topMenu !== void 0);
|
|
41
|
+
i && (l.topChildrenMenu = i.topMenu, l.children = l.children.map((o) => A(O({}, o), { topMenu: i.topMenu })));
|
|
42
42
|
}
|
|
43
43
|
a(l.children);
|
|
44
44
|
}
|
|
45
45
|
});
|
|
46
46
|
};
|
|
47
47
|
return c.layout === k.mix && a(e), e;
|
|
48
|
-
}),
|
|
48
|
+
}), L = (e) => {
|
|
49
49
|
var a;
|
|
50
50
|
if (K.value = [e.name], !(e != null && e.children) || ((a = e == null ? void 0 : e.children) == null ? void 0 : a.length) === 0)
|
|
51
51
|
y.value = [], n == null || n.push({ path: e.path });
|
|
@@ -57,25 +57,25 @@ const ne = (c) => {
|
|
|
57
57
|
n == null || n.push(t);
|
|
58
58
|
} else
|
|
59
59
|
n == null || n.push(e.redirect);
|
|
60
|
-
},
|
|
61
|
-
e != null && e.name ? n == null || n.push({ name: e.name }) : n == null || n.push({ path: e.path }),
|
|
62
|
-
}, B = (e, a) =>
|
|
60
|
+
}, R = (e) => {
|
|
61
|
+
e != null && e.name ? n == null || n.push({ name: e.name }) : n == null || n.push({ path: e.path }), P.value = [e.name];
|
|
62
|
+
}, B = (e, a) => W(null, null, function* () {
|
|
63
63
|
if (a != null && a.path && !(c != null && c.onMenuItemClick && !(yield c.onMenuItemClick(a)))) {
|
|
64
64
|
if (a.path.startsWith("http") || a.path.startsWith("https")) {
|
|
65
65
|
window.open(a.path);
|
|
66
66
|
return;
|
|
67
67
|
}
|
|
68
|
-
e ===
|
|
68
|
+
e === D.top ? L(a) : R(a);
|
|
69
69
|
}
|
|
70
70
|
}), H = (e, a) => {
|
|
71
|
-
e ===
|
|
71
|
+
e === D.top ? p.value = a : M.value = a;
|
|
72
72
|
}, j = () => {
|
|
73
73
|
const e = [], a = (t) => {
|
|
74
74
|
var l;
|
|
75
75
|
for (const i in t) {
|
|
76
|
-
const
|
|
77
|
-
if (
|
|
78
|
-
return e.unshift(
|
|
76
|
+
const o = t[i];
|
|
77
|
+
if (o.name === ((l = u == null ? void 0 : u.value) == null ? void 0 : l.name) || o.children && o.children.length > 0 && a(o.children))
|
|
78
|
+
return e.unshift(o), !0;
|
|
79
79
|
}
|
|
80
80
|
return !1;
|
|
81
81
|
};
|
|
@@ -83,36 +83,36 @@ const ne = (c) => {
|
|
|
83
83
|
}, q = () => {
|
|
84
84
|
var a, t, l;
|
|
85
85
|
const e = (a = f.value) == null ? void 0 : a.map((i) => ({ path: i == null ? void 0 : i.path, label: i == null ? void 0 : i.title }));
|
|
86
|
-
N.value = (t =
|
|
86
|
+
N.value = (t = u.value) != null && t.breadcrumbs ? (l = u.value) == null ? void 0 : l.breadcrumbs : e.length !== 0 ? e : [];
|
|
87
87
|
};
|
|
88
88
|
function z() {
|
|
89
|
-
var
|
|
90
|
-
if (!
|
|
89
|
+
var b, C;
|
|
90
|
+
if (!u.value || u.value.noAffix) {
|
|
91
91
|
h.value.forEach((r) => {
|
|
92
92
|
r.active = !1;
|
|
93
93
|
});
|
|
94
94
|
return;
|
|
95
95
|
}
|
|
96
|
-
const { name: e, title: a } =
|
|
96
|
+
const { name: e, title: a } = u.value;
|
|
97
97
|
h.value.forEach((r) => {
|
|
98
98
|
r.active = !1;
|
|
99
99
|
});
|
|
100
|
-
const t = (
|
|
100
|
+
const t = (b = s.meta) == null ? void 0 : b.getTitle, l = typeof t == "function" ? t(s) : void 0, i = {
|
|
101
101
|
name: e,
|
|
102
102
|
parentNames: f.value.map((r) => r.name),
|
|
103
103
|
title: (C = l != null ? l : a) != null ? C : e,
|
|
104
104
|
fullPath: s.fullPath,
|
|
105
105
|
active: !0
|
|
106
|
-
},
|
|
107
|
-
|
|
106
|
+
}, o = h.value.findIndex((r) => r.fullPath.startsWith(s.path));
|
|
107
|
+
o >= 0 ? (h.value[o].active = !0, h.value[o].fullPath = s.fullPath) : h.value.push(i);
|
|
108
108
|
}
|
|
109
109
|
const F = (e) => {
|
|
110
110
|
const a = h.value.find((t) => t.fullPath === e);
|
|
111
111
|
a && n.push(a.fullPath);
|
|
112
112
|
}, G = (e) => {
|
|
113
113
|
let a = -1, t = -1;
|
|
114
|
-
if (h.value.forEach((i,
|
|
115
|
-
i.fullPath === e && (t =
|
|
114
|
+
if (h.value.forEach((i, o) => {
|
|
115
|
+
i.fullPath === e && (t = o), i.active && (a = o);
|
|
116
116
|
}), t === -1) return;
|
|
117
117
|
if (a === t) {
|
|
118
118
|
let i;
|
|
@@ -157,24 +157,24 @@ const ne = (c) => {
|
|
|
157
157
|
}, { immediate: !0 }), E(() => [s == null ? void 0 : s.name, s == null ? void 0 : s.fullPath], () => {
|
|
158
158
|
var t, l, i;
|
|
159
159
|
const e = s == null ? void 0 : s.name;
|
|
160
|
-
|
|
161
|
-
const a = f.value.filter((
|
|
162
|
-
if (a.length > 0 && S.value.length > 0 && (y.value = ((t = a[a.length - 1]) == null ? void 0 : t.children) || []), K.value =
|
|
163
|
-
const
|
|
164
|
-
|
|
160
|
+
u.value = d.value[e], j();
|
|
161
|
+
const a = f.value.filter((o) => o.topMenu);
|
|
162
|
+
if (a.length > 0 && S.value.length > 0 && (y.value = ((t = a[a.length - 1]) == null ? void 0 : t.children) || []), K.value = u != null && u.value ? [...a.map((o) => o.name), ...((l = u.value) == null ? void 0 : l.activatedKeys) || []] : [], P.value = u != null && u.value ? [u.value.name, ...((i = u.value) == null ? void 0 : i.activatedKeys) || []] : [], u.value) {
|
|
163
|
+
const o = f.value.filter((r, w) => w < f.value.length - 1), b = o.filter((r) => r.topMenu).map((r) => r.name), C = o.filter((r) => !r.topMenu).map((r) => r.name);
|
|
164
|
+
u.value.activatedKeys && u.value.activatedKeys.length > 0 && u.value.activatedKeys.forEach((r) => {
|
|
165
165
|
const w = d.value[r];
|
|
166
|
-
w && (w.topMenu ?
|
|
167
|
-
}), p.value = Array.from(/* @__PURE__ */ new Set([...p.value, ...
|
|
166
|
+
w && (w.topMenu ? b.push(r) : C.push(r));
|
|
167
|
+
}), p.value = Array.from(/* @__PURE__ */ new Set([...p.value, ...b])), M.value = Array.from(/* @__PURE__ */ new Set([...M.value, ...C]));
|
|
168
168
|
}
|
|
169
169
|
q(), c.hideTabs || z(), Q();
|
|
170
170
|
}, { immediate: !0 }), {
|
|
171
171
|
topMenuItems: S,
|
|
172
172
|
siderMenuItems: y,
|
|
173
173
|
topMenuSelectedKeys: K,
|
|
174
|
-
siderMenuSelectedKeys:
|
|
174
|
+
siderMenuSelectedKeys: P,
|
|
175
175
|
topMenuOpenKeys: p,
|
|
176
176
|
siderMenuOpenKeys: M,
|
|
177
|
-
activeMenuItem:
|
|
177
|
+
activeMenuItem: u,
|
|
178
178
|
menuItemMap: d,
|
|
179
179
|
breadcrumbItems: N,
|
|
180
180
|
tabs: h,
|
package/package.json
CHANGED