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.
Files changed (54) hide show
  1. package/dist/index.css +1 -1
  2. package/es/components/autocomplete/autocomplete.vue.d.ts +2 -2
  3. package/es/components/autocomplete/index.d.ts +6 -6
  4. package/es/components/button/index.d.ts +9 -9
  5. package/es/components/horizontal-menu/horizontal-menu.vue.d.ts +20 -4
  6. package/es/components/horizontal-menu/horizontal-menu.vue2.js +29 -29
  7. package/es/components/horizontal-menu/index.d.ts +20 -4
  8. package/es/components/menu/index.d.ts +28 -7
  9. package/es/components/menu/menu-item-group.vue.d.ts +2 -4
  10. package/es/components/menu/menu-item.vue.d.ts +1 -17
  11. package/es/components/menu/menu.vue.d.ts +3 -28
  12. package/es/components/menu/menu.vue2.js +81 -76
  13. package/es/components/menu/sub-menu.vue.d.ts +1 -19
  14. package/es/components/menu/types.d.ts +64 -0
  15. package/es/components/popconfirm/index.d.ts +15 -15
  16. package/es/components/popconfirm/popconfirm.vue.d.ts +1 -1
  17. package/es/components/select/index.d.ts +4 -4
  18. package/es/components/select/select.vue.d.ts +4 -4
  19. package/es/components/select/useSelect.d.ts +4 -4
  20. package/es/components/side-menu/index.d.ts +55 -4
  21. package/es/components/side-menu/side-menu.vue.d.ts +20 -3
  22. package/es/components/side-menu/side-menu.vue2.js +166 -139
  23. package/es/components/side-menu/types.d.ts +13 -2
  24. package/es/package.json.d.ts +1 -1
  25. package/es/package.json.js +1 -1
  26. package/lib/components/autocomplete/autocomplete.vue.d.ts +2 -2
  27. package/lib/components/autocomplete/index.d.ts +6 -6
  28. package/lib/components/button/index.d.ts +9 -9
  29. package/lib/components/horizontal-menu/horizontal-menu.vue.d.ts +20 -4
  30. package/lib/components/horizontal-menu/horizontal-menu.vue2.cjs +1 -1
  31. package/lib/components/horizontal-menu/index.d.ts +20 -4
  32. package/lib/components/menu/index.d.ts +28 -7
  33. package/lib/components/menu/menu-item-group.vue.d.ts +2 -4
  34. package/lib/components/menu/menu-item.vue.d.ts +1 -17
  35. package/lib/components/menu/menu.vue.d.ts +3 -28
  36. package/lib/components/menu/menu.vue2.cjs +1 -1
  37. package/lib/components/menu/sub-menu.vue.d.ts +1 -19
  38. package/lib/components/menu/types.d.ts +64 -0
  39. package/lib/components/popconfirm/index.d.ts +15 -15
  40. package/lib/components/popconfirm/popconfirm.vue.d.ts +1 -1
  41. package/lib/components/select/index.d.ts +4 -4
  42. package/lib/components/select/select.vue.d.ts +4 -4
  43. package/lib/components/select/useSelect.d.ts +4 -4
  44. package/lib/components/side-menu/index.d.ts +55 -4
  45. package/lib/components/side-menu/side-menu.vue.d.ts +20 -3
  46. package/lib/components/side-menu/side-menu.vue2.cjs +1 -1
  47. package/lib/components/side-menu/types.d.ts +13 -2
  48. package/lib/package.json.cjs +1 -1
  49. package/lib/package.json.d.ts +1 -1
  50. package/package.json +5 -5
  51. package/theme-style/index.css +1 -1
  52. package/theme-style/src/menu.scss +54 -0
  53. package/theme-style/vft-menu.css +1 -1
  54. 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<(string | number)[]>;
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: (val: import("./types").MenuSelectEventData) => void;
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<(string | number)[]>;
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?: ((val: import("./types").MenuSelectEventData) => any) | undefined;
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 { MenuSelectEventData, SideMenuProps } from './types';
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: (val: MenuSelectEventData) => void;
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?: ((val: MenuSelectEventData) => any) | undefined;
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 J, toRefs as ie, useSlots as de, getCurrentInstance as re, ref as h, computed as b, watch as ce, onMounted as pe, nextTick as fe, createVNode as p, h as y, isVNode as me } from "vue";
2
- import { listenerRouteChange as ve, useRouterHelper as he } from "@vft/router";
3
- import { useSortable as ge } from "@vft/use/sortable";
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 { addUnit as q } from "../../utils/helper.js";
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 { VftIcon as ye } from "../icon/index.js";
10
- import { VftMenu as Me, VftSubMenu as Se, VftMenuItem as E } from "../menu/index.js";
11
- import { useNamespace as Oe } from "../../hooks/use-namespace/index.js";
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 Ce } from "./use-drag-line.js";
16
- function xe(g) {
17
- return typeof g == "function" || Object.prototype.toString.call(g) === "[object Object]" && !me(g);
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 _e = J({
19
+ const we = H({
20
20
  name: "vft-side-menu"
21
- }), Le = /* @__PURE__ */ J({
22
- ..._e,
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: L,
92
- emit: P
109
+ expose: J,
110
+ emit: L
93
111
  }) {
94
- const t = g, d = P, {
95
- defaultActive: H,
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
- } = ie(t), u = Oe("side-menu"), r = de(), C = re(), x = h(), a = b(() => ({
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
- })), Z = (e, o = 1 / 0) => {
110
- const l = [], n = (s, i = 0) => {
111
- i >= o || s.forEach((v) => {
112
- v[a.value.children]?.length && (l.push(v[a.value.index]), n(v[a.value.children], i + 1));
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 n(e), l;
133
+ return o(e), l;
116
134
  };
117
- ve(({
135
+ Ce(({
118
136
  route: e
119
137
  }) => {
120
- !e || e.meta?.hideSide && !t.useRouterJump || (x.value = e.path);
138
+ !e || e.meta?.hideSide && !t.useRouterJump || (T.value = e.path);
121
139
  });
122
- const z = (e) => {
123
- const o = e.e;
124
- if (t.autoScrollActiveDom && o) {
125
- const l = j(t.autoScrollActiveDom) ? t.autoScrollActiveDom : 0, n = o.target;
126
- _({
127
- activeDom: n,
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
- d("subMenuOpenClick", e);
132
- }, Y = (e) => {
133
- d("subMenuClick", e);
134
- }, _ = ({
149
+ r("subMenuOpenClick", e);
150
+ }, z = (e) => {
151
+ r("subMenuClick", e);
152
+ }, B = ({
135
153
  activeDom: e = null,
136
- offset: o = 0,
154
+ offset: n = 0,
137
155
  delay: l = 300
138
156
  } = {}) => {
139
- m.value?.menu && setTimeout(() => {
140
- const n = e || document.querySelector(".vft-menu-item.is-active") || document.querySelector(".vft-sub-menu.is-active");
141
- n && (m.value.menu.scrollTop = m.value.menu.scrollTop + (n.getBoundingClientRect().top - m.value.menu.getBoundingClientRect().top) + o);
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
- d("menuItemMouseenter", e);
162
+ r("menuItemMouseenter", e);
145
163
  }, K = (e) => {
146
- d("menuItemMouseleave", e);
147
- }, B = (e, o) => {
148
- const l = e[a.value.path], n = e[a.value.title], s = e?.[a.value.children], i = e?.[a.value.index], v = e?.[a.value.icon], T = !!e?.[a.value.disabled], R = t.disabledJudgeTurnOver ? !T : T, N = i || l || o + n;
149
- return s?.length ? y(
150
- // @ts-ignore
151
- Se,
152
- {
153
- ...e,
154
- popperAppendToBody: !0,
155
- key: N,
156
- index: N,
157
- title: n,
158
- icon: v,
159
- disabled: t.openDisabled && R,
160
- popperClass: u.e("popper")
161
- },
162
- {
163
- default: () => s?.map((c, oe) => {
164
- const O = c[a.value.path], I = c[a.value.index], ae = c[a.value.icon], ue = c[a.value.title], V = !!c[a.value.disabled], se = t.disabledJudgeTurnOver ? !V : V;
165
- return c?.[a.value.children]?.length ? B(c, oe) : (
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(E, {
168
- ...c,
169
- key: I || O,
170
- index: I || O,
171
- route: O,
172
- icon: ae,
173
- title: ue,
174
- disabled: t.openDisabled && se
175
- }, r.menuItem ? () => r.menuItem?.({
176
- item: c
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(E, {
207
+ }) : y(j, {
182
208
  ...e,
183
- key: i || l,
184
- index: i || l,
185
- title: n,
209
+ key: c || l,
210
+ index: c || l,
211
+ title: o,
186
212
  route: l,
187
- icon: v,
188
- disabled: t.openDisabled && R,
213
+ icon: i,
214
+ disabled: t.openDisabled && I,
189
215
  onMouseenter: () => G(e),
190
216
  onMouseleave: () => K(e)
191
- }, r.menuItem ? () => r.menuItem?.({
217
+ }, d.menuItem ? () => d.menuItem?.({
192
218
  item: e,
193
- index: o
219
+ index: n
194
220
  }) : "");
195
- }, m = h(), Q = b(() => ({
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 = C.appContext.config.globalProperties.$router;
201
- async function X(e) {
226
+ })), w = x.appContext.config.globalProperties.$router;
227
+ function ee(e, n) {
202
228
  if (t.useRouterJump) {
203
229
  const {
204
- go: o
205
- } = he(w), l = e.route;
206
- let n = e.route;
207
- e.indexPath.some((i) => be(i)) && (n = e.indexPath.slice(-2).join("/"));
208
- const s = w.getRoutes().filter((i) => i.path === n)?.[0]?.meta?.linkTarget;
209
- o(s ? {
210
- url: l,
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: s
238
+ target: c
213
239
  }
214
- } : l);
240
+ } : o);
215
241
  }
216
- d("select", e);
242
+ r("select", e, n);
217
243
  }
218
- const S = h(), D = h(), k = h(), ee = b(() => ({
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: q(t.width),
248
+ width: O(t.width),
223
249
  height: t.height
224
250
  }));
225
- ce(() => f.value, (e) => {
226
- te.value || (e ? d("update:width", t.collapseWidth) : d("update:width", k.value || t.width), k.value = t.width);
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: te
230
- } = Ce(S, D, C), le = b(() => ({
231
- left: q(t.width)
232
- })), ne = b(() => [u.b(), t.isFixedLeft ? u.m("fixed") : ""]), A = h([]);
233
- return pe(() => {
234
- fe(() => {
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(`.${u.e(t.dragOption?.dragClassName)}`)?.[0], {
237
- initSortable: o
238
- } = ge(e, {
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: n,
243
- newIndex: s
268
+ oldIndex: o,
269
+ newIndex: u
244
270
  } = l;
245
- W(n) || W(s) || n === s || d("dragEnd", n, s);
271
+ q(o) || q(u) || o === u || r("dragEnd", o, u);
246
272
  },
247
273
  ...t.dragOption
248
274
  });
249
- o();
275
+ n();
250
276
  }
251
277
  });
252
- }), L({
278
+ }), J({
253
279
  sideRef: S,
254
- jumpActiveDom: _,
255
- menuRef: m
280
+ jumpActiveDom: B,
281
+ menuRef: v
256
282
  }), () => {
257
283
  let e;
258
- return M.value && (A.value = Z(t.menus, j(M.value) ? M.value : 1 / 0)), p("div", {
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: ee.value
262
- }, [r.top ? p("div", {
263
- class: u.e("top")
264
- }, [r.top()]) : null, y(p(Me, {
265
- ref: m,
266
- onSelect: X,
267
- onOpen: z,
268
- onSubMenuClick: Y,
269
- defaultActive: H?.value || x.value,
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: [u.e("con"), t.dragOption?.dragClassName ? u.e(t.dragOption?.dragClassName) : ""],
273
- style: Q.value,
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: !1
277
- }, xe(e = t.menus.map((o, l) => B(o, l))) ? e : {
302
+ collapseTransition: t.collapseTransition,
303
+ collapseType: t.collapseType
304
+ }, _e(e = t.menus.map((n, l) => _(n, l))) ? e : {
278
305
  default: () => [e]
279
- })), r.bottom ? p("div", {
280
- class: u.e("bottom")
281
- }, [r.bottom()]) : t.showCollapse ? p("div", {
282
- onClick: () => d("update:collapse", !f.value),
283
- class: [u.e("bottom"), u.e("collapse")]
284
- }, [p(ye, {
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, r.default?.(), t.dragWidthCfg ? p("div", {
291
- ref: D,
292
- style: le.value,
293
- class: u.e("drag-bar")
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
- Le as default
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 | number>;
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', val: MenuSelectEventData): void;
110
+ (e: 'select', menuItem: MenuItemClicked, routerResult?: Promise<void | NavigationFailure>): void;
100
111
  /** 子菜单点击事件 */
101
112
  (e: 'subMenuClick', val: any): void;
102
113
  /** 子菜单展开点击事件 */
@@ -1,6 +1,6 @@
1
1
  declare const _default: {
2
2
  "name": "vft",
3
- "version": "0.0.482",
3
+ "version": "0.0.483",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.cjs",
6
6
  "module": "es/index.js",
@@ -1,4 +1,4 @@
1
- const o = "0.0.482";
1
+ const o = "0.0.483";
2
2
  export {
3
3
  o as version
4
4
  };