@keyblade/pro-components 1.14.2 → 1.14.4
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 +75 -75
- package/package.json +2 -2
package/es/pro-layout/hooks.js
CHANGED
|
@@ -2,54 +2,54 @@ var V = Object.defineProperty, X = Object.defineProperties;
|
|
|
2
2
|
var Y = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var x = Object.getOwnPropertySymbols;
|
|
4
4
|
var Z = Object.prototype.hasOwnProperty, $ = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var J = (
|
|
5
|
+
var J = (c, s, i) => s in c ? V(c, s, { enumerable: !0, configurable: !0, writable: !0, value: i }) : c[s] = i, w = (c, s) => {
|
|
6
6
|
for (var i in s || (s = {}))
|
|
7
|
-
Z.call(s, i) && J(
|
|
7
|
+
Z.call(s, i) && J(c, i, s[i]);
|
|
8
8
|
if (x)
|
|
9
9
|
for (var i of x(s))
|
|
10
|
-
$.call(s, i) && J(
|
|
11
|
-
return
|
|
12
|
-
},
|
|
13
|
-
var L = (
|
|
14
|
-
var
|
|
10
|
+
$.call(s, i) && J(c, i, s[i]);
|
|
11
|
+
return c;
|
|
12
|
+
}, O = (c, s) => X(c, Y(s));
|
|
13
|
+
var L = (c, s, i) => new Promise((K, g) => {
|
|
14
|
+
var p = (r) => {
|
|
15
15
|
try {
|
|
16
|
-
|
|
16
|
+
u(i.next(r));
|
|
17
17
|
} catch (d) {
|
|
18
|
-
|
|
18
|
+
g(d);
|
|
19
19
|
}
|
|
20
|
-
},
|
|
20
|
+
}, M = (r) => {
|
|
21
21
|
try {
|
|
22
|
-
|
|
22
|
+
u(i.throw(r));
|
|
23
23
|
} catch (d) {
|
|
24
|
-
|
|
24
|
+
g(d);
|
|
25
25
|
}
|
|
26
|
-
},
|
|
27
|
-
|
|
26
|
+
}, u = (r) => r.done ? K(r.value) : Promise.resolve(r.value).then(p, M);
|
|
27
|
+
u((i = i.apply(c, s)).next());
|
|
28
28
|
});
|
|
29
|
-
import { ref as v, computed as _, watch as
|
|
29
|
+
import { ref as v, computed as _, watch as A } from "vue";
|
|
30
30
|
import { useRoute as I, useRouter as m } from "vue-router";
|
|
31
|
-
import { ProLayoutMode as
|
|
32
|
-
const te = (
|
|
33
|
-
const s = I(), i = m(),
|
|
34
|
-
const e = [...
|
|
31
|
+
import { ProLayoutMode as E, ProLayoutMenuType as R } from "./enum.js";
|
|
32
|
+
const te = (c) => {
|
|
33
|
+
const s = I(), i = m(), K = v([]), g = v([]), p = v([]), M = v([]), u = v(), r = v([]), d = v({}), k = v([]), f = v([]), P = v([]), T = v([]), y = v([]), b = _(() => {
|
|
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
|
-
l.children = l.children.map((n) =>
|
|
38
|
+
l.children = l.children.map((n) => O(w({}, n), { topMenu: l == null ? void 0 : l.topChildrenMenu }));
|
|
39
39
|
else {
|
|
40
|
-
const n = l.children.find((
|
|
41
|
-
n && (l.topChildrenMenu = n.topMenu, l.children = l.children.map((
|
|
40
|
+
const n = l.children.find((o) => o.topMenu !== void 0);
|
|
41
|
+
n && (l.topChildrenMenu = n.topMenu, l.children = l.children.map((o) => O(w({}, o), { topMenu: n.topMenu })));
|
|
42
42
|
}
|
|
43
43
|
a(l.children);
|
|
44
44
|
}
|
|
45
45
|
});
|
|
46
46
|
};
|
|
47
|
-
return
|
|
47
|
+
return c.layout === E.mix && a(e), e;
|
|
48
48
|
}), W = (e) => {
|
|
49
49
|
var a;
|
|
50
|
-
if (
|
|
51
|
-
|
|
52
|
-
else if (
|
|
50
|
+
if (K.value = [e.name], !(e != null && e.children) || ((a = e == null ? void 0 : e.children) == null ? void 0 : a.length) === 0)
|
|
51
|
+
y.value = [], i == null || i.push({ path: e.path });
|
|
52
|
+
else if (y.value = e.children, e != null && e.redirect)
|
|
53
53
|
if (typeof e.redirect == "string")
|
|
54
54
|
i == null || i.push({ path: e.redirect });
|
|
55
55
|
else if (typeof e.redirect == "function") {
|
|
@@ -58,9 +58,9 @@ const te = (o) => {
|
|
|
58
58
|
} else
|
|
59
59
|
i == null || i.push(e.redirect);
|
|
60
60
|
}, B = (e) => {
|
|
61
|
-
e != null && e.name ? i == null || i.push({ name: e.name }) : i == null || i.push({ path: e.path }),
|
|
61
|
+
e != null && e.name ? i == null || i.push({ name: e.name }) : i == null || i.push({ path: e.path }), g.value = [e.name];
|
|
62
62
|
}, D = (e, a) => L(null, null, function* () {
|
|
63
|
-
if (a != null && a.path && !(
|
|
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;
|
|
@@ -68,38 +68,38 @@ const te = (o) => {
|
|
|
68
68
|
e === R.top ? W(a) : B(a);
|
|
69
69
|
}
|
|
70
70
|
}), H = (e, a) => {
|
|
71
|
-
e === R.top ?
|
|
71
|
+
e === R.top ? p.value = a : M.value = a;
|
|
72
72
|
}, j = () => {
|
|
73
73
|
const e = [], a = (t) => {
|
|
74
74
|
var l;
|
|
75
75
|
for (const n in t) {
|
|
76
|
-
const
|
|
77
|
-
if (
|
|
78
|
-
return e.unshift(
|
|
76
|
+
const o = t[n];
|
|
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
|
};
|
|
82
|
-
a(JSON.parse(JSON.stringify(
|
|
82
|
+
a(JSON.parse(JSON.stringify(b.value))), r.value = e;
|
|
83
83
|
}, q = () => {
|
|
84
84
|
var a, t, l;
|
|
85
|
-
const e = (a =
|
|
86
|
-
|
|
85
|
+
const e = (a = r.value) == null ? void 0 : a.map((n) => ({ path: n == null ? void 0 : n.path, label: n == null ? void 0 : n.title }));
|
|
86
|
+
k.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
|
-
if (!
|
|
89
|
+
if (!u.value || u.value.noAffix) {
|
|
90
90
|
f.value.forEach((n) => {
|
|
91
91
|
n.active = !1;
|
|
92
92
|
});
|
|
93
93
|
return;
|
|
94
94
|
}
|
|
95
|
-
const { name: e, title: a } =
|
|
95
|
+
const { name: e, title: a } = u.value;
|
|
96
96
|
let t = -1;
|
|
97
|
-
f.value.forEach((n,
|
|
98
|
-
n.active = !1, n.name === e && (t =
|
|
97
|
+
f.value.forEach((n, o) => {
|
|
98
|
+
n.active = !1, n.name === e && (t = o);
|
|
99
99
|
});
|
|
100
100
|
const l = {
|
|
101
101
|
name: e,
|
|
102
|
-
parentNames:
|
|
102
|
+
parentNames: r.value.map((n) => n.name),
|
|
103
103
|
title: a != null ? a : e,
|
|
104
104
|
fullPath: s.fullPath,
|
|
105
105
|
active: !0
|
|
@@ -117,8 +117,8 @@ const te = (o) => {
|
|
|
117
117
|
i.push(t.fullPath);
|
|
118
118
|
}, G = (e) => {
|
|
119
119
|
let a = -1, t = -1;
|
|
120
|
-
if (f.value.forEach((n,
|
|
121
|
-
n.name === e && (t =
|
|
120
|
+
if (f.value.forEach((n, o) => {
|
|
121
|
+
n.name === e && (t = o), n.active && (a = o);
|
|
122
122
|
}), a === t) {
|
|
123
123
|
let n;
|
|
124
124
|
t === 0 ? n = f.value[t + 1] : n = f.value[t - 1], n.active = !0, i.push(n.fullPath);
|
|
@@ -127,14 +127,14 @@ const te = (o) => {
|
|
|
127
127
|
U(l[0]);
|
|
128
128
|
}, Q = () => {
|
|
129
129
|
var a;
|
|
130
|
-
if (
|
|
130
|
+
if (c != null && c.disableKeepAlive || (a = s == null ? void 0 : s.meta) != null && a.ignoreCache)
|
|
131
131
|
return;
|
|
132
|
-
const e = new Set(
|
|
133
|
-
|
|
132
|
+
const e = new Set(P.value);
|
|
133
|
+
r.value.forEach((t) => {
|
|
134
134
|
t.name && e.add(t.name);
|
|
135
|
-
}),
|
|
135
|
+
}), P.value = Array.from(e.values());
|
|
136
136
|
}, U = (e) => {
|
|
137
|
-
const a = new Set(
|
|
137
|
+
const a = new Set(P.value);
|
|
138
138
|
e.parentNames.forEach((t) => {
|
|
139
139
|
a.delete(t);
|
|
140
140
|
}), f.value.forEach((t) => {
|
|
@@ -142,48 +142,48 @@ const te = (o) => {
|
|
|
142
142
|
const n = d.value[l];
|
|
143
143
|
n && (n != null && n.ignoreCache || a.add(n.name));
|
|
144
144
|
});
|
|
145
|
-
}),
|
|
145
|
+
}), P.value = Array.from(a.values());
|
|
146
146
|
};
|
|
147
|
-
return
|
|
147
|
+
return A(() => b.value, () => {
|
|
148
148
|
const e = {}, a = (t) => {
|
|
149
149
|
t.forEach((l) => {
|
|
150
150
|
l.children && l.children.length > 0 && a(l.children), delete l.children, e[l.name] = l;
|
|
151
151
|
});
|
|
152
152
|
};
|
|
153
|
-
a(JSON.parse(JSON.stringify(
|
|
154
|
-
}, { immediate: !0 }),
|
|
155
|
-
var e;
|
|
156
|
-
if (
|
|
157
|
-
|
|
158
|
-
else if (
|
|
159
|
-
const
|
|
160
|
-
(
|
|
153
|
+
a(JSON.parse(JSON.stringify(b.value))), d.value = e;
|
|
154
|
+
}, { immediate: !0 }), A(() => [c.layout, b.value], () => {
|
|
155
|
+
var e, a, t;
|
|
156
|
+
if (T.value = [], y.value = [], p.value = [...((e = c.menuProps) == null ? void 0 : e.defaultOpenKeys) || [], ...p.value], M.value = [...((a = c.menuProps) == null ? void 0 : a.defaultOpenKeys) || [], ...M.value], c.layout === E.side)
|
|
157
|
+
y.value = b.value;
|
|
158
|
+
else if (c.layout === E.mix) {
|
|
159
|
+
const l = (t = b.value) == null ? void 0 : t.filter((n) => n.topMenu);
|
|
160
|
+
(l == null ? void 0 : l.length) === 0 ? y.value = b.value : T.value = l;
|
|
161
161
|
}
|
|
162
|
-
}, { immediate: !0 }),
|
|
162
|
+
}, { immediate: !0 }), A(() => s == null ? void 0 : s.name, () => {
|
|
163
163
|
var t, l, n;
|
|
164
164
|
const e = s == null ? void 0 : s.name;
|
|
165
|
-
|
|
166
|
-
const a =
|
|
167
|
-
if (a.length > 0 &&
|
|
168
|
-
const
|
|
169
|
-
|
|
165
|
+
u.value = d.value[e], j();
|
|
166
|
+
const a = r.value.filter((o) => o.topMenu);
|
|
167
|
+
if (a.length > 0 && T.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) || []] : [], g.value = u != null && u.value ? [u.value.name, ...((n = u.value) == null ? void 0 : n.activatedKeys) || []] : [], u.value) {
|
|
168
|
+
const o = r.value.filter((h, C) => C < r.value.length - 1), S = o.filter((h) => h.topMenu).map((h) => h.name), N = o.filter((h) => !h.topMenu).map((h) => h.name);
|
|
169
|
+
u.value.activatedKeys && u.value.activatedKeys.length > 0 && u.value.activatedKeys.forEach((h) => {
|
|
170
170
|
const C = d.value[h];
|
|
171
|
-
C && (C.topMenu ? S.push(h) :
|
|
172
|
-
}),
|
|
171
|
+
C && (C.topMenu ? S.push(h) : N.push(h));
|
|
172
|
+
}), p.value = Array.from(/* @__PURE__ */ new Set([...p.value, ...S])), M.value = Array.from(/* @__PURE__ */ new Set([...M.value, ...N]));
|
|
173
173
|
}
|
|
174
|
-
q(),
|
|
174
|
+
q(), c.hideTabs || z(), Q();
|
|
175
175
|
}, { immediate: !0 }), {
|
|
176
|
-
topMenuItems:
|
|
177
|
-
siderMenuItems:
|
|
178
|
-
topMenuSelectedKeys:
|
|
179
|
-
siderMenuSelectedKeys:
|
|
180
|
-
topMenuOpenKeys:
|
|
181
|
-
siderMenuOpenKeys:
|
|
182
|
-
activeMenuItem:
|
|
176
|
+
topMenuItems: T,
|
|
177
|
+
siderMenuItems: y,
|
|
178
|
+
topMenuSelectedKeys: K,
|
|
179
|
+
siderMenuSelectedKeys: g,
|
|
180
|
+
topMenuOpenKeys: p,
|
|
181
|
+
siderMenuOpenKeys: M,
|
|
182
|
+
activeMenuItem: u,
|
|
183
183
|
menuItemMap: d,
|
|
184
|
-
breadcrumbItems:
|
|
184
|
+
breadcrumbItems: k,
|
|
185
185
|
tabs: f,
|
|
186
|
-
keepAliveInclude:
|
|
186
|
+
keepAliveInclude: P,
|
|
187
187
|
onProMenuItemClick: D,
|
|
188
188
|
onProMenuOpenKeysChange: H,
|
|
189
189
|
onTabClick: F,
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@keyblade/pro-components",
|
|
3
3
|
"description": "KeyBlade Pro Components",
|
|
4
4
|
"author": "yangshuai <704807396@qq.com>",
|
|
5
|
-
"version": "1.14.
|
|
5
|
+
"version": "1.14.4",
|
|
6
6
|
"private": false,
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "es/index.js",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"vue-global-config": "^0.6.3",
|
|
27
27
|
"dayjs": "^1.11.18",
|
|
28
28
|
"es-toolkit": "^1.41.0",
|
|
29
|
-
"@keyblade/one-travel": "^3.0.
|
|
29
|
+
"@keyblade/one-travel": "^3.0.5"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"vue": "^3.4.27",
|