vft 0.0.482 → 0.0.483
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/index.css +1 -1
- package/es/components/autocomplete/autocomplete.vue.d.ts +2 -2
- package/es/components/autocomplete/index.d.ts +6 -6
- package/es/components/button/index.d.ts +9 -9
- package/es/components/horizontal-menu/horizontal-menu.vue.d.ts +20 -4
- package/es/components/horizontal-menu/horizontal-menu.vue2.js +29 -29
- package/es/components/horizontal-menu/index.d.ts +20 -4
- package/es/components/menu/index.d.ts +28 -7
- package/es/components/menu/menu-item-group.vue.d.ts +2 -4
- package/es/components/menu/menu-item.vue.d.ts +1 -17
- package/es/components/menu/menu.vue.d.ts +3 -28
- package/es/components/menu/menu.vue2.js +81 -76
- package/es/components/menu/sub-menu.vue.d.ts +1 -19
- package/es/components/menu/types.d.ts +64 -0
- package/es/components/popconfirm/index.d.ts +15 -15
- package/es/components/popconfirm/popconfirm.vue.d.ts +1 -1
- package/es/components/select/index.d.ts +4 -4
- package/es/components/select/select.vue.d.ts +4 -4
- package/es/components/select/useSelect.d.ts +4 -4
- package/es/components/side-menu/index.d.ts +55 -4
- package/es/components/side-menu/side-menu.vue.d.ts +20 -3
- package/es/components/side-menu/side-menu.vue2.js +166 -139
- package/es/components/side-menu/types.d.ts +13 -2
- package/es/package.json.d.ts +1 -1
- package/es/package.json.js +1 -1
- package/lib/components/autocomplete/autocomplete.vue.d.ts +2 -2
- package/lib/components/autocomplete/index.d.ts +6 -6
- package/lib/components/button/index.d.ts +9 -9
- package/lib/components/horizontal-menu/horizontal-menu.vue.d.ts +20 -4
- package/lib/components/horizontal-menu/horizontal-menu.vue2.cjs +1 -1
- package/lib/components/horizontal-menu/index.d.ts +20 -4
- package/lib/components/menu/index.d.ts +28 -7
- package/lib/components/menu/menu-item-group.vue.d.ts +2 -4
- package/lib/components/menu/menu-item.vue.d.ts +1 -17
- package/lib/components/menu/menu.vue.d.ts +3 -28
- package/lib/components/menu/menu.vue2.cjs +1 -1
- package/lib/components/menu/sub-menu.vue.d.ts +1 -19
- package/lib/components/menu/types.d.ts +64 -0
- package/lib/components/popconfirm/index.d.ts +15 -15
- package/lib/components/popconfirm/popconfirm.vue.d.ts +1 -1
- package/lib/components/select/index.d.ts +4 -4
- package/lib/components/select/select.vue.d.ts +4 -4
- package/lib/components/select/useSelect.d.ts +4 -4
- package/lib/components/side-menu/index.d.ts +55 -4
- package/lib/components/side-menu/side-menu.vue.d.ts +20 -3
- package/lib/components/side-menu/side-menu.vue2.cjs +1 -1
- package/lib/components/side-menu/types.d.ts +13 -2
- package/lib/package.json.cjs +1 -1
- package/lib/package.json.d.ts +1 -1
- package/package.json +5 -5
- package/theme-style/index.css +1 -1
- package/theme-style/src/menu.scss +54 -0
- package/theme-style/vft-menu.css +1 -1
- package/web-types.json +1 -1
|
@@ -15,20 +15,31 @@ export declare const VftSideMenu: import("vft/es/utils").SFCWithInstall<import("
|
|
|
15
15
|
type: import("vue").PropType<import("./types").MenuType[]>;
|
|
16
16
|
required: true;
|
|
17
17
|
};
|
|
18
|
+
tooltipCfg: {
|
|
19
|
+
type: import("vue").PropType<Partial<import("vft/es/vft").ToolTipProps>>;
|
|
20
|
+
};
|
|
18
21
|
defaultActive: {
|
|
19
22
|
type: import("vue").PropType<string>;
|
|
20
23
|
};
|
|
21
24
|
defaultOpeneds: {
|
|
22
|
-
type: import("vue").PropType<
|
|
25
|
+
type: import("vue").PropType<string[]>;
|
|
23
26
|
};
|
|
24
27
|
uniqueOpened: {
|
|
25
28
|
type: import("vue").PropType<boolean>;
|
|
26
29
|
default: boolean;
|
|
27
30
|
};
|
|
31
|
+
collapseTransition: {
|
|
32
|
+
type: import("vue").PropType<boolean>;
|
|
33
|
+
default: boolean;
|
|
34
|
+
};
|
|
28
35
|
disableSubMenuAction: {
|
|
29
36
|
type: import("vue").PropType<boolean>;
|
|
30
37
|
default: boolean;
|
|
31
38
|
};
|
|
39
|
+
collapseType: {
|
|
40
|
+
type: import("vue").PropType<"menu-title">;
|
|
41
|
+
default: undefined;
|
|
42
|
+
};
|
|
32
43
|
isFixedLeft: {
|
|
33
44
|
type: import("vue").PropType<boolean>;
|
|
34
45
|
default: boolean;
|
|
@@ -83,6 +94,18 @@ export declare const VftSideMenu: import("vft/es/utils").SFCWithInstall<import("
|
|
|
83
94
|
type: import("vue").PropType<number | boolean>;
|
|
84
95
|
default: boolean;
|
|
85
96
|
};
|
|
97
|
+
enableScroll: {
|
|
98
|
+
type: import("vue").PropType<boolean>;
|
|
99
|
+
default: boolean;
|
|
100
|
+
};
|
|
101
|
+
scrollThreshold: {
|
|
102
|
+
type: import("vue").PropType<number>;
|
|
103
|
+
default: number;
|
|
104
|
+
};
|
|
105
|
+
scrollMaxHeight: {
|
|
106
|
+
type: import("vue").PropType<string | number>;
|
|
107
|
+
default: number;
|
|
108
|
+
};
|
|
86
109
|
}>, {
|
|
87
110
|
sideRef: import("vue").Ref<any, any>;
|
|
88
111
|
jumpActiveDom: ({ activeDom, offset, delay }?: {
|
|
@@ -96,7 +119,7 @@ export declare const VftSideMenu: import("vft/es/utils").SFCWithInstall<import("
|
|
|
96
119
|
"update:width": (val: string | number) => void;
|
|
97
120
|
dragEnd: (oldIndex: import("sortablejs").SortableEvent, newIndex: import("sortablejs").SortableEvent) => void;
|
|
98
121
|
dragWidthEnd: () => void;
|
|
99
|
-
select: (
|
|
122
|
+
select: (menuItem: import("vft/es/vft").MenuItemClicked, routerResult?: Promise<void | import("vue-router").NavigationFailure> | undefined) => void;
|
|
100
123
|
subMenuClick: (val: any) => void;
|
|
101
124
|
subMenuOpenClick: (val: any) => void;
|
|
102
125
|
menuItemMouseenter: (val: any) => void;
|
|
@@ -118,20 +141,31 @@ export declare const VftSideMenu: import("vft/es/utils").SFCWithInstall<import("
|
|
|
118
141
|
type: import("vue").PropType<import("./types").MenuType[]>;
|
|
119
142
|
required: true;
|
|
120
143
|
};
|
|
144
|
+
tooltipCfg: {
|
|
145
|
+
type: import("vue").PropType<Partial<import("vft/es/vft").ToolTipProps>>;
|
|
146
|
+
};
|
|
121
147
|
defaultActive: {
|
|
122
148
|
type: import("vue").PropType<string>;
|
|
123
149
|
};
|
|
124
150
|
defaultOpeneds: {
|
|
125
|
-
type: import("vue").PropType<
|
|
151
|
+
type: import("vue").PropType<string[]>;
|
|
126
152
|
};
|
|
127
153
|
uniqueOpened: {
|
|
128
154
|
type: import("vue").PropType<boolean>;
|
|
129
155
|
default: boolean;
|
|
130
156
|
};
|
|
157
|
+
collapseTransition: {
|
|
158
|
+
type: import("vue").PropType<boolean>;
|
|
159
|
+
default: boolean;
|
|
160
|
+
};
|
|
131
161
|
disableSubMenuAction: {
|
|
132
162
|
type: import("vue").PropType<boolean>;
|
|
133
163
|
default: boolean;
|
|
134
164
|
};
|
|
165
|
+
collapseType: {
|
|
166
|
+
type: import("vue").PropType<"menu-title">;
|
|
167
|
+
default: undefined;
|
|
168
|
+
};
|
|
135
169
|
isFixedLeft: {
|
|
136
170
|
type: import("vue").PropType<boolean>;
|
|
137
171
|
default: boolean;
|
|
@@ -186,8 +220,20 @@ export declare const VftSideMenu: import("vft/es/utils").SFCWithInstall<import("
|
|
|
186
220
|
type: import("vue").PropType<number | boolean>;
|
|
187
221
|
default: boolean;
|
|
188
222
|
};
|
|
223
|
+
enableScroll: {
|
|
224
|
+
type: import("vue").PropType<boolean>;
|
|
225
|
+
default: boolean;
|
|
226
|
+
};
|
|
227
|
+
scrollThreshold: {
|
|
228
|
+
type: import("vue").PropType<number>;
|
|
229
|
+
default: number;
|
|
230
|
+
};
|
|
231
|
+
scrollMaxHeight: {
|
|
232
|
+
type: import("vue").PropType<string | number>;
|
|
233
|
+
default: number;
|
|
234
|
+
};
|
|
189
235
|
}>> & Readonly<{
|
|
190
|
-
onSelect?: ((
|
|
236
|
+
onSelect?: ((menuItem: import("vft/es/vft").MenuItemClicked, routerResult?: Promise<void | import("vue-router").NavigationFailure> | undefined) => any) | undefined;
|
|
191
237
|
"onUpdate:collapse"?: ((val: boolean) => any) | undefined;
|
|
192
238
|
"onUpdate:width"?: ((val: string | number) => any) | undefined;
|
|
193
239
|
onDragEnd?: ((oldIndex: import("sortablejs").SortableEvent, newIndex: import("sortablejs").SortableEvent) => any) | undefined;
|
|
@@ -201,7 +247,9 @@ export declare const VftSideMenu: import("vft/es/utils").SFCWithInstall<import("
|
|
|
201
247
|
width: string | number;
|
|
202
248
|
collapse: boolean;
|
|
203
249
|
uniqueOpened: boolean;
|
|
250
|
+
collapseTransition: boolean;
|
|
204
251
|
disableSubMenuAction: boolean;
|
|
252
|
+
collapseType: "menu-title";
|
|
205
253
|
isFixedLeft: boolean;
|
|
206
254
|
collapseWidth: string | number;
|
|
207
255
|
menuTopBottomHeight: number;
|
|
@@ -215,6 +263,9 @@ export declare const VftSideMenu: import("vft/es/utils").SFCWithInstall<import("
|
|
|
215
263
|
openMenuCollapse: boolean;
|
|
216
264
|
disabledJudgeTurnOver: boolean;
|
|
217
265
|
defaultOpenedsLevel: number | boolean;
|
|
266
|
+
enableScroll: boolean;
|
|
267
|
+
scrollThreshold: number;
|
|
268
|
+
scrollMaxHeight: string | number;
|
|
218
269
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>> & Record<string, any>;
|
|
219
270
|
export default VftSideMenu;
|
|
220
271
|
export * from './types';
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import type { MenuItemClicked } from 'vft/es/components/menu';
|
|
1
2
|
import type { SortableEvent } from 'sortablejs';
|
|
2
|
-
import type {
|
|
3
|
+
import type { NavigationFailure } from 'vue-router';
|
|
4
|
+
import type { SideMenuProps } from './types';
|
|
3
5
|
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<SideMenuProps>, {
|
|
4
6
|
isFixedLeft: boolean;
|
|
5
7
|
autoScrollActiveDom: boolean;
|
|
@@ -16,6 +18,11 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
16
18
|
useRouterJump: boolean;
|
|
17
19
|
disableSubMenuAction: boolean;
|
|
18
20
|
defaultOpenedsLevel: boolean;
|
|
21
|
+
enableScroll: boolean;
|
|
22
|
+
scrollThreshold: number;
|
|
23
|
+
scrollMaxHeight: number;
|
|
24
|
+
collapseTransition: boolean;
|
|
25
|
+
collapseType: undefined;
|
|
19
26
|
}>>, {
|
|
20
27
|
sideRef: import("vue").Ref<any, any>;
|
|
21
28
|
jumpActiveDom: ({ activeDom, offset, delay }?: {
|
|
@@ -29,7 +36,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
29
36
|
"update:width": (val: string | number) => void;
|
|
30
37
|
dragEnd: (oldIndex: SortableEvent, newIndex: SortableEvent) => void;
|
|
31
38
|
dragWidthEnd: () => void;
|
|
32
|
-
select: (
|
|
39
|
+
select: (menuItem: MenuItemClicked, routerResult?: Promise<void | NavigationFailure> | undefined) => void;
|
|
33
40
|
subMenuClick: (val: any) => void;
|
|
34
41
|
subMenuOpenClick: (val: any) => void;
|
|
35
42
|
menuItemMouseenter: (val: any) => void;
|
|
@@ -50,8 +57,13 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
50
57
|
useRouterJump: boolean;
|
|
51
58
|
disableSubMenuAction: boolean;
|
|
52
59
|
defaultOpenedsLevel: boolean;
|
|
60
|
+
enableScroll: boolean;
|
|
61
|
+
scrollThreshold: number;
|
|
62
|
+
scrollMaxHeight: number;
|
|
63
|
+
collapseTransition: boolean;
|
|
64
|
+
collapseType: undefined;
|
|
53
65
|
}>>> & Readonly<{
|
|
54
|
-
onSelect?: ((
|
|
66
|
+
onSelect?: ((menuItem: MenuItemClicked, routerResult?: Promise<void | NavigationFailure> | undefined) => any) | undefined;
|
|
55
67
|
"onUpdate:collapse"?: ((val: boolean) => any) | undefined;
|
|
56
68
|
"onUpdate:width"?: ((val: string | number) => any) | undefined;
|
|
57
69
|
onDragEnd?: ((oldIndex: SortableEvent, newIndex: SortableEvent) => any) | undefined;
|
|
@@ -65,7 +77,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
65
77
|
width: string | number;
|
|
66
78
|
collapse: boolean;
|
|
67
79
|
uniqueOpened: boolean;
|
|
80
|
+
collapseTransition: boolean;
|
|
68
81
|
disableSubMenuAction: boolean;
|
|
82
|
+
collapseType: "menu-title";
|
|
69
83
|
isFixedLeft: boolean;
|
|
70
84
|
collapseWidth: string | number;
|
|
71
85
|
menuTopBottomHeight: number;
|
|
@@ -79,6 +93,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
79
93
|
openMenuCollapse: boolean;
|
|
80
94
|
disabledJudgeTurnOver: boolean;
|
|
81
95
|
defaultOpenedsLevel: number | boolean;
|
|
96
|
+
enableScroll: boolean;
|
|
97
|
+
scrollThreshold: number;
|
|
98
|
+
scrollMaxHeight: string | number;
|
|
82
99
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
83
100
|
export default _default;
|
|
84
101
|
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { isNullOrUndefined as W, isNumber as j, isUrl as be } from "@vft/utils";
|
|
1
|
+
import { defineComponent as H, toRefs as de, useSlots as ce, getCurrentInstance as pe, ref as h, computed as b, watch as fe, onMounted as me, nextTick as ve, createVNode as m, h as y, isVNode as he } from "vue";
|
|
2
|
+
import { VftIcon as ge } from "../icon/index.js";
|
|
3
|
+
import { VftMenu as be, VftSubMenu as ye, VftMenuItem as j, VftMenuItemGroup as Me } from "../menu/index.js";
|
|
5
4
|
import "@vueuse/core";
|
|
6
|
-
import {
|
|
5
|
+
import { isNullOrUndefined as q, isNumber as E, isUrl as Se } from "@vft/utils";
|
|
6
|
+
import { addUnit as O } from "../../utils/helper.js";
|
|
7
7
|
import "lodash-es";
|
|
8
8
|
import "../form/index.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { useNamespace as
|
|
9
|
+
import { listenerRouteChange as Ce, useRouterHelper as Oe } from "@vft/router";
|
|
10
|
+
import { useSortable as xe } from "@vft/use/sortable";
|
|
11
|
+
import { useNamespace as Te } from "../../hooks/use-namespace/index.js";
|
|
12
12
|
import "../../hooks/use-model-toggle/index.js";
|
|
13
13
|
import "@popperjs/core";
|
|
14
14
|
import "../../hooks/use-z-index/index.js";
|
|
15
|
-
import { useDragLine as
|
|
16
|
-
function
|
|
17
|
-
return typeof g == "function" || Object.prototype.toString.call(g) === "[object Object]" && !
|
|
15
|
+
import { useDragLine as Be } from "./use-drag-line.js";
|
|
16
|
+
function _e(g) {
|
|
17
|
+
return typeof g == "function" || Object.prototype.toString.call(g) === "[object Object]" && !he(g);
|
|
18
18
|
}
|
|
19
|
-
const
|
|
19
|
+
const we = H({
|
|
20
20
|
name: "vft-side-menu"
|
|
21
|
-
}),
|
|
22
|
-
...
|
|
21
|
+
}), Ue = /* @__PURE__ */ H({
|
|
22
|
+
...we,
|
|
23
23
|
props: {
|
|
24
24
|
isFixedLeft: {
|
|
25
25
|
type: Boolean,
|
|
@@ -84,21 +84,39 @@ const _e = J({
|
|
|
84
84
|
disableSubMenuAction: {
|
|
85
85
|
type: Boolean,
|
|
86
86
|
default: !1
|
|
87
|
-
}
|
|
87
|
+
},
|
|
88
|
+
enableScroll: {
|
|
89
|
+
type: Boolean,
|
|
90
|
+
default: !0
|
|
91
|
+
},
|
|
92
|
+
scrollThreshold: {
|
|
93
|
+
default: 10
|
|
94
|
+
},
|
|
95
|
+
scrollMaxHeight: {
|
|
96
|
+
default: 500
|
|
97
|
+
},
|
|
98
|
+
collapseTransition: {
|
|
99
|
+
type: Boolean,
|
|
100
|
+
default: !1
|
|
101
|
+
},
|
|
102
|
+
collapseType: {
|
|
103
|
+
default: void 0
|
|
104
|
+
},
|
|
105
|
+
tooltipCfg: {}
|
|
88
106
|
},
|
|
89
107
|
emits: ["update:collapse", "update:width", "dragEnd", "dragWidthEnd", "select", "subMenuClick", "subMenuOpenClick", "menuItemMouseenter", "menuItemMouseleave"],
|
|
90
108
|
setup(g, {
|
|
91
|
-
expose:
|
|
92
|
-
emit:
|
|
109
|
+
expose: J,
|
|
110
|
+
emit: L
|
|
93
111
|
}) {
|
|
94
|
-
const t = g,
|
|
95
|
-
defaultActive:
|
|
112
|
+
const t = g, r = L, {
|
|
113
|
+
defaultActive: P,
|
|
96
114
|
collapse: f,
|
|
97
115
|
uniqueOpened: U,
|
|
98
116
|
defaultOpeneds: $,
|
|
99
117
|
openMenuCollapse: F,
|
|
100
118
|
defaultOpenedsLevel: M
|
|
101
|
-
} =
|
|
119
|
+
} = de(t), s = Te("side-menu"), d = ce(), x = pe(), T = h(), a = b(() => ({
|
|
102
120
|
path: "path",
|
|
103
121
|
children: "children",
|
|
104
122
|
title: "title",
|
|
@@ -106,195 +124,204 @@ const _e = J({
|
|
|
106
124
|
icon: "icon",
|
|
107
125
|
disabled: "disabled",
|
|
108
126
|
...t.attrMapping
|
|
109
|
-
})),
|
|
110
|
-
const l = [],
|
|
111
|
-
|
|
112
|
-
|
|
127
|
+
})), Y = (e, n = 1 / 0) => {
|
|
128
|
+
const l = [], o = (u, c = 0) => {
|
|
129
|
+
c >= n || u.forEach((i) => {
|
|
130
|
+
i[a.value.children]?.length && (l.push(i[a.value.index]), o(i[a.value.children], c + 1));
|
|
113
131
|
});
|
|
114
132
|
};
|
|
115
|
-
return
|
|
133
|
+
return o(e), l;
|
|
116
134
|
};
|
|
117
|
-
|
|
135
|
+
Ce(({
|
|
118
136
|
route: e
|
|
119
137
|
}) => {
|
|
120
|
-
!e || e.meta?.hideSide && !t.useRouterJump || (
|
|
138
|
+
!e || e.meta?.hideSide && !t.useRouterJump || (T.value = e.path);
|
|
121
139
|
});
|
|
122
|
-
const
|
|
123
|
-
const
|
|
124
|
-
if (t.autoScrollActiveDom &&
|
|
125
|
-
const l =
|
|
126
|
-
|
|
127
|
-
activeDom:
|
|
140
|
+
const Z = (e) => {
|
|
141
|
+
const n = e.e;
|
|
142
|
+
if (t.autoScrollActiveDom && n) {
|
|
143
|
+
const l = E(t.autoScrollActiveDom) ? t.autoScrollActiveDom : 0, o = n.target;
|
|
144
|
+
B({
|
|
145
|
+
activeDom: o,
|
|
128
146
|
offset: l
|
|
129
147
|
});
|
|
130
148
|
}
|
|
131
|
-
|
|
132
|
-
},
|
|
133
|
-
|
|
134
|
-
},
|
|
149
|
+
r("subMenuOpenClick", e);
|
|
150
|
+
}, z = (e) => {
|
|
151
|
+
r("subMenuClick", e);
|
|
152
|
+
}, B = ({
|
|
135
153
|
activeDom: e = null,
|
|
136
|
-
offset:
|
|
154
|
+
offset: n = 0,
|
|
137
155
|
delay: l = 300
|
|
138
156
|
} = {}) => {
|
|
139
|
-
|
|
140
|
-
const
|
|
141
|
-
|
|
157
|
+
v.value?.menu && setTimeout(() => {
|
|
158
|
+
const o = e || document.querySelector(".vft-menu-item.is-active") || document.querySelector(".vft-sub-menu.is-active");
|
|
159
|
+
o && (v.value.menu.scrollTop = v.value.menu.scrollTop + (o.getBoundingClientRect().top - v.value.menu.getBoundingClientRect().top) + n);
|
|
142
160
|
}, l);
|
|
143
161
|
}, G = (e) => {
|
|
144
|
-
|
|
162
|
+
r("menuItemMouseenter", e);
|
|
145
163
|
}, K = (e) => {
|
|
146
|
-
|
|
147
|
-
},
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
164
|
+
r("menuItemMouseleave", e);
|
|
165
|
+
}, Q = (e, n) => !t.enableScroll || !e ? e : f.value && n > t.scrollThreshold ? y(Me, {
|
|
166
|
+
style: {
|
|
167
|
+
maxHeight: O(t.scrollMaxHeight),
|
|
168
|
+
overflowY: "auto"
|
|
169
|
+
}
|
|
170
|
+
}, () => e) : e, _ = (e, n) => {
|
|
171
|
+
const l = e[a.value.path], o = e[a.value.title], u = e?.[a.value.children], c = e?.[a.value.index], i = e?.[a.value.icon], R = !!e?.[a.value.disabled], I = t.disabledJudgeTurnOver ? !R : R, N = c || l || n + o;
|
|
172
|
+
return u?.length ? y(ye, {
|
|
173
|
+
...e,
|
|
174
|
+
popperAppendToBody: !0,
|
|
175
|
+
key: N,
|
|
176
|
+
index: N,
|
|
177
|
+
title: o,
|
|
178
|
+
icon: i,
|
|
179
|
+
disabled: t.openDisabled && I,
|
|
180
|
+
popperClass: s.e("popper"),
|
|
181
|
+
toolTipCfg: {
|
|
182
|
+
placement: "right",
|
|
183
|
+
"fallback-placements": ["right-start", "right"],
|
|
184
|
+
...t.tooltipCfg
|
|
185
|
+
}
|
|
186
|
+
}, {
|
|
187
|
+
default: () => {
|
|
188
|
+
const ae = u?.map((p, ue) => {
|
|
189
|
+
const C = p[a.value.path], V = p[a.value.index], se = p[a.value.icon], ie = p[a.value.title], W = !!p[a.value.disabled], re = t.disabledJudgeTurnOver ? !W : W;
|
|
190
|
+
return p?.[a.value.children]?.length ? _(p, ue) : (
|
|
166
191
|
// @ts-ignore
|
|
167
|
-
y(
|
|
168
|
-
...
|
|
169
|
-
key:
|
|
170
|
-
index:
|
|
171
|
-
route:
|
|
172
|
-
icon:
|
|
173
|
-
title:
|
|
174
|
-
disabled: t.openDisabled &&
|
|
175
|
-
},
|
|
176
|
-
item:
|
|
192
|
+
y(j, {
|
|
193
|
+
...p,
|
|
194
|
+
key: V || C,
|
|
195
|
+
index: V || C,
|
|
196
|
+
route: C,
|
|
197
|
+
icon: se,
|
|
198
|
+
title: ie,
|
|
199
|
+
disabled: t.openDisabled && re
|
|
200
|
+
}, d.menuItem ? () => d.menuItem?.({
|
|
201
|
+
item: p
|
|
177
202
|
}) : "")
|
|
178
203
|
);
|
|
179
|
-
})
|
|
204
|
+
});
|
|
205
|
+
return Q(ae, u?.length || 0);
|
|
180
206
|
}
|
|
181
|
-
) : y(
|
|
207
|
+
}) : y(j, {
|
|
182
208
|
...e,
|
|
183
|
-
key:
|
|
184
|
-
index:
|
|
185
|
-
title:
|
|
209
|
+
key: c || l,
|
|
210
|
+
index: c || l,
|
|
211
|
+
title: o,
|
|
186
212
|
route: l,
|
|
187
|
-
icon:
|
|
188
|
-
disabled: t.openDisabled &&
|
|
213
|
+
icon: i,
|
|
214
|
+
disabled: t.openDisabled && I,
|
|
189
215
|
onMouseenter: () => G(e),
|
|
190
216
|
onMouseleave: () => K(e)
|
|
191
|
-
},
|
|
217
|
+
}, d.menuItem ? () => d.menuItem?.({
|
|
192
218
|
item: e,
|
|
193
|
-
index:
|
|
219
|
+
index: n
|
|
194
220
|
}) : "");
|
|
195
|
-
},
|
|
221
|
+
}, v = h(), X = b(() => ({
|
|
196
222
|
...t.collapseWidth === 0 && f.value ? {
|
|
197
223
|
width: 0
|
|
198
224
|
} : {},
|
|
199
225
|
height: `calc(100% - ${t.menuTopBottomHeight}px)`
|
|
200
|
-
})), w =
|
|
201
|
-
|
|
226
|
+
})), w = x.appContext.config.globalProperties.$router;
|
|
227
|
+
function ee(e, n) {
|
|
202
228
|
if (t.useRouterJump) {
|
|
203
229
|
const {
|
|
204
|
-
go:
|
|
205
|
-
} =
|
|
206
|
-
let
|
|
207
|
-
e.indexPath.some((i) =>
|
|
208
|
-
const
|
|
209
|
-
|
|
210
|
-
url:
|
|
230
|
+
go: l
|
|
231
|
+
} = Oe(w), o = e.route;
|
|
232
|
+
let u = e.route;
|
|
233
|
+
e.indexPath.some((i) => Se(i)) && (u = e.indexPath.slice(-2).join("/"));
|
|
234
|
+
const c = w.getRoutes().filter((i) => i.path === u)?.[0]?.meta?.linkTarget;
|
|
235
|
+
l(c ? {
|
|
236
|
+
url: o,
|
|
211
237
|
winOpenOpt: {
|
|
212
|
-
target:
|
|
238
|
+
target: c
|
|
213
239
|
}
|
|
214
|
-
} :
|
|
240
|
+
} : o);
|
|
215
241
|
}
|
|
216
|
-
|
|
242
|
+
r("select", e, n);
|
|
217
243
|
}
|
|
218
|
-
const S = h(),
|
|
244
|
+
const S = h(), k = h(), D = h(), te = b(() => ({
|
|
219
245
|
...t.collapseWidth === 0 && f.value ? {
|
|
220
246
|
borderRight: "none"
|
|
221
247
|
} : {},
|
|
222
|
-
width:
|
|
248
|
+
width: O(t.width),
|
|
223
249
|
height: t.height
|
|
224
250
|
}));
|
|
225
|
-
|
|
226
|
-
|
|
251
|
+
fe(() => f.value, (e) => {
|
|
252
|
+
le.value || (e ? r("update:width", t.collapseWidth) : r("update:width", D.value || t.width), D.value = t.width);
|
|
227
253
|
});
|
|
228
254
|
const {
|
|
229
|
-
isDraging:
|
|
230
|
-
} =
|
|
231
|
-
left:
|
|
232
|
-
})), ne = b(() => [
|
|
233
|
-
return
|
|
234
|
-
|
|
255
|
+
isDraging: le
|
|
256
|
+
} = Be(S, k, x), oe = b(() => ({
|
|
257
|
+
left: O(t.width)
|
|
258
|
+
})), ne = b(() => [s.b(), t.isFixedLeft ? s.m("fixed") : ""]), A = h([]);
|
|
259
|
+
return me(() => {
|
|
260
|
+
ve(() => {
|
|
235
261
|
if (t.dragOption?.dragClassName) {
|
|
236
|
-
const e = document.querySelectorAll(`.${
|
|
237
|
-
initSortable:
|
|
238
|
-
} =
|
|
262
|
+
const e = document.querySelectorAll(`.${s.e(t.dragOption?.dragClassName)}`)?.[0], {
|
|
263
|
+
initSortable: n
|
|
264
|
+
} = xe(e, {
|
|
239
265
|
draggable: ".vft-menu-item",
|
|
240
266
|
onEnd: (l) => {
|
|
241
267
|
const {
|
|
242
|
-
oldIndex:
|
|
243
|
-
newIndex:
|
|
268
|
+
oldIndex: o,
|
|
269
|
+
newIndex: u
|
|
244
270
|
} = l;
|
|
245
|
-
|
|
271
|
+
q(o) || q(u) || o === u || r("dragEnd", o, u);
|
|
246
272
|
},
|
|
247
273
|
...t.dragOption
|
|
248
274
|
});
|
|
249
|
-
|
|
275
|
+
n();
|
|
250
276
|
}
|
|
251
277
|
});
|
|
252
|
-
}),
|
|
278
|
+
}), J({
|
|
253
279
|
sideRef: S,
|
|
254
|
-
jumpActiveDom:
|
|
255
|
-
menuRef:
|
|
280
|
+
jumpActiveDom: B,
|
|
281
|
+
menuRef: v
|
|
256
282
|
}), () => {
|
|
257
283
|
let e;
|
|
258
|
-
return M.value && (A.value =
|
|
284
|
+
return M.value && (A.value = Y(t.menus, E(M.value) ? M.value : 1 / 0)), m("div", {
|
|
259
285
|
ref: S,
|
|
260
286
|
class: ne.value,
|
|
261
|
-
style:
|
|
262
|
-
}, [
|
|
263
|
-
class:
|
|
264
|
-
}, [
|
|
265
|
-
ref:
|
|
266
|
-
onSelect:
|
|
267
|
-
onOpen:
|
|
268
|
-
onSubMenuClick:
|
|
269
|
-
defaultActive:
|
|
287
|
+
style: te.value
|
|
288
|
+
}, [d.top ? m("div", {
|
|
289
|
+
class: s.e("top")
|
|
290
|
+
}, [d.top()]) : null, y(m(be, {
|
|
291
|
+
ref: v,
|
|
292
|
+
onSelect: ee,
|
|
293
|
+
onOpen: Z,
|
|
294
|
+
onSubMenuClick: z,
|
|
295
|
+
defaultActive: P?.value || T.value,
|
|
270
296
|
defaultOpeneds: $?.value || A.value,
|
|
271
297
|
disableSubMenuAction: t.disableSubMenuAction,
|
|
272
|
-
class: [
|
|
273
|
-
style:
|
|
298
|
+
class: [s.e("con"), t.dragOption?.dragClassName ? s.e(t.dragOption?.dragClassName) : ""],
|
|
299
|
+
style: X.value,
|
|
274
300
|
collapse: F.value ? f.value : !1,
|
|
275
301
|
uniqueOpened: U.value,
|
|
276
|
-
collapseTransition:
|
|
277
|
-
|
|
302
|
+
collapseTransition: t.collapseTransition,
|
|
303
|
+
collapseType: t.collapseType
|
|
304
|
+
}, _e(e = t.menus.map((n, l) => _(n, l))) ? e : {
|
|
278
305
|
default: () => [e]
|
|
279
|
-
})),
|
|
280
|
-
class:
|
|
281
|
-
}, [
|
|
282
|
-
onClick: () =>
|
|
283
|
-
class: [
|
|
284
|
-
}, [
|
|
306
|
+
})), d.bottom ? m("div", {
|
|
307
|
+
class: s.e("bottom")
|
|
308
|
+
}, [d.bottom()]) : t.showCollapse ? m("div", {
|
|
309
|
+
onClick: () => r("update:collapse", !f.value),
|
|
310
|
+
class: [s.e("bottom"), s.e("collapse")]
|
|
311
|
+
}, [m(ge, {
|
|
285
312
|
style: {
|
|
286
313
|
transform: f.value ? "rotateY(180deg)" : ""
|
|
287
314
|
},
|
|
288
315
|
size: 20,
|
|
289
316
|
icon: "icon-sidebar-collapse"
|
|
290
|
-
}, null)]) : null,
|
|
291
|
-
ref:
|
|
292
|
-
style:
|
|
293
|
-
class:
|
|
317
|
+
}, null)]) : null, d.default?.(), t.dragWidthCfg ? m("div", {
|
|
318
|
+
ref: k,
|
|
319
|
+
style: oe.value,
|
|
320
|
+
class: s.e("drag-bar")
|
|
294
321
|
}, null) : null]);
|
|
295
322
|
};
|
|
296
323
|
}
|
|
297
324
|
});
|
|
298
325
|
export {
|
|
299
|
-
|
|
326
|
+
Ue as default
|
|
300
327
|
};
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import type { MenuItemClicked } from 'vft/es/components/menu';
|
|
2
|
+
import type { ToolTipProps } from 'vft/es/components/tooltip';
|
|
1
3
|
import type Sortable from 'sortablejs';
|
|
2
4
|
import type { SortableEvent } from 'sortablejs';
|
|
5
|
+
import type { NavigationFailure } from 'vue-router';
|
|
3
6
|
/** 菜单项类型 */
|
|
4
7
|
export type MenuType = {
|
|
5
8
|
/** 子菜单列表 */
|
|
@@ -72,11 +75,19 @@ export interface SideMenuProps {
|
|
|
72
75
|
/** 默认选中的菜单索引 */
|
|
73
76
|
defaultActive?: string;
|
|
74
77
|
/** 默认展开的子菜单索引数组 */
|
|
75
|
-
defaultOpeneds?: Array<string
|
|
78
|
+
defaultOpeneds?: Array<string>;
|
|
76
79
|
/** 默认展开的层级深度 */
|
|
77
80
|
defaultOpenedsLevel?: number | boolean;
|
|
78
81
|
/** 禁用子菜单的展开收缩行为 */
|
|
79
82
|
disableSubMenuAction?: boolean;
|
|
83
|
+
enableScroll?: boolean;
|
|
84
|
+
scrollThreshold?: number;
|
|
85
|
+
scrollMaxHeight?: string | number;
|
|
86
|
+
/** 是否开启折叠动画 */
|
|
87
|
+
collapseTransition?: boolean;
|
|
88
|
+
/** 收缩类型 */
|
|
89
|
+
collapseType?: 'menu-title';
|
|
90
|
+
tooltipCfg?: Partial<ToolTipProps>;
|
|
80
91
|
}
|
|
81
92
|
/** 菜单选中事件参数 */
|
|
82
93
|
export interface MenuSelectEventData {
|
|
@@ -96,7 +107,7 @@ export interface SideMenuEmits {
|
|
|
96
107
|
/** 拖拽宽度结束事件 */
|
|
97
108
|
(e: 'dragWidthEnd'): void;
|
|
98
109
|
/** 菜单选中事件 */
|
|
99
|
-
(e: 'select',
|
|
110
|
+
(e: 'select', menuItem: MenuItemClicked, routerResult?: Promise<void | NavigationFailure>): void;
|
|
100
111
|
/** 子菜单点击事件 */
|
|
101
112
|
(e: 'subMenuClick', val: any): void;
|
|
102
113
|
/** 子菜单展开点击事件 */
|
package/es/package.json.d.ts
CHANGED
package/es/package.json.js
CHANGED