vft 0.0.469 → 0.0.471

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 (39) hide show
  1. package/dist/index.css +1 -1
  2. package/es/components/carousel/use-carousel.js +1 -1
  3. package/es/components/horizontal-menu/horizontal-menu.vue.d.ts +3 -0
  4. package/es/components/horizontal-menu/horizontal-menu.vue2.js +93 -73
  5. package/es/components/horizontal-menu/index.d.ts +18 -0
  6. package/es/components/input/input.vue2.js +4 -4
  7. package/es/components/input-tag/composables/use-input-tag.js +1 -1
  8. package/es/components/menu/menu-item-group.vue2.js +16 -15
  9. package/es/components/multiple-tabs/style/css.d.ts +1 -0
  10. package/es/components/multiple-tabs/style/css.js +1 -0
  11. package/es/components/multiple-tabs/style/index.d.ts +1 -0
  12. package/es/components/multiple-tabs/style/index.js +1 -0
  13. package/es/components/multiple-tabs/use/use-tab-dropdown.js +25 -19
  14. package/es/components/super-form/super-form-item.vue2.js +1 -1
  15. package/es/hooks/use-z-index/index.js +3 -3
  16. package/es/package.json.d.ts +1 -1
  17. package/es/package.json.js +1 -1
  18. package/es/utils/vue/vnode.js +1 -1
  19. package/lib/components/horizontal-menu/horizontal-menu.vue.d.ts +3 -0
  20. package/lib/components/horizontal-menu/horizontal-menu.vue2.cjs +1 -1
  21. package/lib/components/horizontal-menu/index.d.ts +18 -0
  22. package/lib/components/input/input.vue2.cjs +1 -1
  23. package/lib/components/menu/menu-item-group.vue2.cjs +1 -1
  24. package/lib/components/multiple-tabs/style/css.cjs +1 -1
  25. package/lib/components/multiple-tabs/style/css.d.ts +1 -0
  26. package/lib/components/multiple-tabs/style/index.cjs +1 -1
  27. package/lib/components/multiple-tabs/style/index.d.ts +1 -0
  28. package/lib/components/multiple-tabs/use/use-tab-dropdown.cjs +1 -1
  29. package/lib/package.json.cjs +1 -1
  30. package/lib/package.json.d.ts +1 -1
  31. package/package.json +4 -4
  32. package/theme-style/index.css +1 -1
  33. package/theme-style/src/common/icon.scss +1 -0
  34. package/theme-style/src/menu.scss +0 -5
  35. package/theme-style/src/mixins/mixins.scss +0 -50
  36. package/theme-style/src/multiple-tabs.scss +4 -0
  37. package/theme-style/vft-menu.css +1 -1
  38. package/theme-style/vft-multiple-tabs.css +1 -1
  39. package/web-types.json +1 -1
@@ -11,7 +11,7 @@ import "../../hooks/use-model-toggle/index.js";
11
11
  import { useOrderedChildren as ge } from "../../hooks/use-ordered-children/index.js";
12
12
  import "@popperjs/core";
13
13
  import "../../hooks/use-z-index/index.js";
14
- import { carouselContextKey as Se, CAROUSEL_ITEM_NAME as H } from "./constants.js";
14
+ import { CAROUSEL_ITEM_NAME as H, carouselContextKey as Se } from "./constants.js";
15
15
  const L = 300, ze = (t, O, M) => {
16
16
  const {
17
17
  children: o,
@@ -14,6 +14,9 @@ export interface HorizontalMenuProps {
14
14
  defaultActive?: string;
15
15
  defaultOpeneds?: Array<string | number>;
16
16
  menuOptions?: Partial<MenuProps>;
17
+ enableScroll?: boolean;
18
+ scrollThreshold?: number;
19
+ scrollMaxHeight?: string;
17
20
  }
18
21
  declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<HorizontalMenuProps>>, {
19
22
  isInSubMenu: import("vue").ComputedRef<any>;
@@ -1,20 +1,23 @@
1
- import { defineComponent as I, computed as w, getCurrentInstance as F, useSlots as G, ref as K, createVNode as i, mergeProps as O } from "vue";
2
- import { useRouterHelper as Q } from "@vft/router";
3
- import { isUrl as W } from "@vft/utils";
4
- import { VftMenu as X, VftSubMenu as Y, VftMenuItem as Z } from "../menu/index.js";
1
+ import { defineComponent as I, computed as S, getCurrentInstance as Y, useSlots as q, ref as F, createVNode as c, mergeProps as w, createTextVNode as K, isVNode as Q } from "vue";
2
+ import { useRouterHelper as X } from "@vft/router";
3
+ import { isUrl as Z } from "@vft/utils";
4
+ import { VftMenu as _, VftSubMenu as ee, VftMenuItem as te, VftMenuItemGroup as ne } from "../menu/index.js";
5
5
  import "@vueuse/core";
6
6
  import "../config-provider/hooks/use-global-config.js";
7
7
  import "lodash-es";
8
8
  import "../form/index.js";
9
- import { useNamespace as _ } from "../../hooks/use-namespace/index.js";
9
+ import { useNamespace as le } from "../../hooks/use-namespace/index.js";
10
10
  import "../../hooks/use-model-toggle/index.js";
11
11
  import "@popperjs/core";
12
12
  import "../../hooks/use-z-index/index.js";
13
- import { MenuTypeEnum as ee } from "./constants.js";
14
- const ne = I({
13
+ import { MenuTypeEnum as oe } from "./constants.js";
14
+ function ue(t) {
15
+ return typeof t == "function" || Object.prototype.toString.call(t) === "[object Object]" && !Q(t);
16
+ }
17
+ const ae = I({
15
18
  name: "vft-horizontal-menu"
16
- }), he = /* @__PURE__ */ I({
17
- ...ne,
19
+ }), xe = /* @__PURE__ */ I({
20
+ ...ae,
18
21
  props: {
19
22
  menus: {},
20
23
  attrMapping: {},
@@ -39,100 +42,117 @@ const ne = I({
39
42
  },
40
43
  defaultActive: {},
41
44
  defaultOpeneds: {},
42
- menuOptions: {}
45
+ menuOptions: {},
46
+ enableScroll: {
47
+ type: Boolean,
48
+ default: !0
49
+ },
50
+ scrollThreshold: {
51
+ default: 10
52
+ },
53
+ scrollMaxHeight: {
54
+ default: "400px"
55
+ }
43
56
  },
44
57
  emits: ["open", "close", "select", "sub-menu-click"],
45
- setup(n, {
46
- expose: L,
47
- emit: N
58
+ setup(t, {
59
+ expose: N,
60
+ emit: A
48
61
  }) {
49
- const f = N, b = _("horizontal-menu"), V = w(() => (e, o, a) => ({
50
- "grid-template-rows": `repeat(${Math.min(e?.[o]?.[t.value.children]?.length || 0, Number(a || n.maxRowLength ? a || n.maxRowLength : e?.[o]?.[t.value.children]?.length))}, auto)`
51
- })), t = w(() => ({
62
+ const p = A, b = le("horizontal-menu"), L = S(() => (e, o, a) => ({
63
+ "grid-template-rows": `repeat(${Math.min(e?.[o]?.[l.value.children]?.length || 0, Number(a || t.maxRowLength ? a || t.maxRowLength : e?.[o]?.[l.value.children]?.length))}, auto)`
64
+ })), l = S(() => ({
52
65
  path: "path",
53
66
  children: "children",
54
67
  title: "title",
55
68
  index: "path",
56
69
  icon: "icon",
57
70
  disabled: "disabled",
58
- ...n.attrMapping
59
- })), J = F(), m = G(), T = K(), k = J.appContext.config.globalProperties.$router, v = (e, o, a) => {
60
- const c = e[t.value.path], r = e[t.value.title], l = e?.[t.value.index], M = e?.[t.value.icon], h = !!e?.[t.value.disabled], d = n.disabledJudgeTurnOver ? !h : h, g = l || c || o + r;
61
- return i(Z, O(e, {
71
+ ...t.attrMapping
72
+ })), B = Y(), h = q(), O = F(), T = B.appContext.config.globalProperties.$router, v = (e, o, a) => {
73
+ const i = e[l.value.path], r = e[l.value.title], n = e?.[l.value.index], M = e?.[l.value.icon], m = !!e?.[l.value.disabled], d = t.disabledJudgeTurnOver ? !m : m, g = n || i || o + r;
74
+ return c(te, w(e, {
62
75
  key: g,
63
76
  index: String(g),
64
77
  icon: M,
65
- route: c,
78
+ route: i,
66
79
  title: r,
67
- disabled: n.openDisabled && d,
80
+ disabled: t.openDisabled && d,
68
81
  className: a ? "vft-menu-popup-item" : "vft-menu-no-popup-item"
69
82
  }), {
70
- default: a ? m.menuItem ? () => m.menuItem?.({
83
+ default: a ? h.menuItem ? () => h.menuItem?.({
71
84
  item: e
72
- }) : null : m.menuTopItem ? () => m.menuTopItem?.({
85
+ }) : null : h.menuTopItem ? () => h.menuTopItem?.({
73
86
  item: e
74
87
  }) : null
75
88
  });
89
+ }, J = (e) => {
90
+ p("open", e);
91
+ }, j = (e) => {
92
+ p("close", e);
76
93
  }, z = (e) => {
77
- f("open", e);
78
- }, B = (e) => {
79
- f("close", e);
80
- }, D = (e) => {
81
- f("sub-menu-click", e);
82
- }, S = (e, o, a) => {
83
- const c = e[t.value.path], r = e[t.value.title], l = e?.[t.value.children], M = e?.[t.value.index], h = e?.[t.value.icon], d = e?.menuOrder, g = e?.maxRowLength, R = !!e?.[t.value.disabled], $ = n.disabledJudgeTurnOver ? !R : R, A = M || c || o + r, x = e.type === ee.TILE;
94
+ p("sub-menu-click", e);
95
+ }, H = (e, o) => !t.enableScroll || !e ? e : o > t.scrollThreshold ? c(ne, {
96
+ style: {
97
+ maxHeight: t.scrollMaxHeight,
98
+ overflowY: "auto"
99
+ }
100
+ }, ue(e) ? e : {
101
+ default: () => [e]
102
+ }) : e, k = (e, o, a) => {
103
+ const i = e[l.value.path], r = e[l.value.title], n = e?.[l.value.children], M = e?.[l.value.index], m = e?.[l.value.icon], d = e?.menuOrder, g = e?.maxRowLength, R = !!e?.[l.value.disabled], E = t.disabledJudgeTurnOver ? !R : R, V = M || i || o + r, x = e.type === oe.TILE;
84
104
  let y = [];
85
105
  if (x)
86
106
  if (d) {
87
107
  const u = d.flat();
88
- if (u?.length < l.length) {
89
- const p = Math.max.apply(null, u);
90
- for (let s = p + 1; s < l.length; s++)
108
+ if (u?.length < n.length) {
109
+ const f = Math.max.apply(null, u);
110
+ for (let s = f + 1; s < n.length; s++)
91
111
  d.push([s]);
92
112
  }
93
113
  y = d;
94
114
  } else
95
- for (let u = 0; u < l.length; u++)
115
+ for (let u = 0; u < n.length; u++)
96
116
  y.push([u]);
97
- return l?.length || e?.render ? i(Y, O(n.subMenuCfg, e, {
98
- index: String(A),
99
- key: A,
100
- icon: h,
101
- showArrow: e.showArrow ?? n.subMenuCfg.showArrow,
102
- disabled: n.openDisabled && $,
117
+ return n?.length || e?.render ? c(ee, w(t.subMenuCfg, e, {
118
+ index: String(V),
119
+ key: V,
120
+ icon: m,
121
+ showArrow: e.showArrow ?? t.subMenuCfg.showArrow,
122
+ disabled: t.openDisabled && E,
103
123
  toolTipCfg: {
104
- ...n.subMenuCfg.toolTipCfg || {},
124
+ ...t.subMenuCfg.toolTipCfg || {},
105
125
  ...e.subMenuCfg?.toolTipCfg || {}
106
126
  },
107
127
  teleported: !1,
108
128
  "popper-class": [x ? b.e("tile") : "", b.e("normal")]
109
129
  }), {
110
- default: () => [e?.render ? e?.render : x ? y.map((u, p) => i("div", {
130
+ default: () => [H(e?.render ? e?.render : x ? y.map((u, f) => c("div", {
111
131
  class: "content-main",
112
- key: p
113
- }, [u.map((s, j) => {
114
- const C = l?.[s]?.[t.value.children], H = l?.[s]?.maxRowLength;
115
- return l?.length ? i("div", {
132
+ key: f
133
+ }, [u.map((s, $) => {
134
+ const C = n?.[s]?.[l.value.children], G = n?.[s]?.maxRowLength;
135
+ return n?.length ? c("div", {
116
136
  class: "content-col",
117
- key: j
118
- }, [i("span", {
137
+ key: $
138
+ }, [c("span", {
119
139
  class: C?.length ? "title" : ""
120
- }, [l?.[s]?.[t.value.title]]), C?.length ? i("div", {
140
+ }, [n?.[s]?.[l.value.title]]), C?.length ? c("div", {
121
141
  class: "content",
122
- style: V.value(l, s, H || g)
123
- }, [C.map((U, q) => v(U, q, !0))]) : null]) : null;
124
- })])) : l.map((u, p) => u[t.value.children]?.length ? S(u, p, !0) : v(u, p, !0))],
142
+ style: L.value(n, s, G || g)
143
+ }, [C.map((U, W) => v(U, W, !0))]) : null]) : null;
144
+ })])) : n.map((u, f) => u[l.value.children]?.length ? k(u, f, !0) : v(u, f, !0)), n?.length || 0)],
125
145
  title: () => r
126
146
  }) : v(e, o, a);
127
147
  };
128
- async function P(e) {
129
- if (n.useRouterJump) {
148
+ async function D(e) {
149
+ if (t.useRouterJump) {
130
150
  const {
131
151
  go: o
132
- } = Q(k), a = e.route;
133
- let c = e.route;
134
- e.indexPath.some((l) => W(l)) && (c = e.indexPath.slice(-2).join("/"));
135
- const r = k.getRoutes().filter((l) => l.path === c)?.[0]?.meta?.linkTarget;
152
+ } = X(T), a = e.route;
153
+ let i = e.route;
154
+ e.indexPath.some((n) => Z(n)) && (i = e.indexPath.slice(-2).join("/"));
155
+ const r = T.getRoutes().filter((n) => n.path === i)?.[0]?.meta?.linkTarget;
136
156
  o(r ? {
137
157
  url: a,
138
158
  winOpenOpt: {
@@ -140,26 +160,26 @@ const ne = I({
140
160
  }
141
161
  } : a);
142
162
  }
143
- f("select", e);
163
+ p("select", e);
144
164
  }
145
- const E = w(() => T.value?.inSubMenu);
146
- return L({
147
- isInSubMenu: E
148
- }), () => i(X, O(n.menuOptions, {
149
- ref: T,
150
- onSelect: P,
151
- onOpen: z,
152
- onClose: B,
153
- onSubMenuClick: D,
165
+ const P = S(() => O.value?.inSubMenu);
166
+ return N({
167
+ isInSubMenu: P
168
+ }), () => c(_, w(t.menuOptions, {
169
+ ref: O,
170
+ onSelect: D,
171
+ onOpen: J,
172
+ onClose: j,
173
+ onSubMenuClick: z,
154
174
  mode: "horizontal",
155
175
  class: b.b(),
156
- defaultActive: n.defaultActive,
157
- defaultOpeneds: n.defaultOpeneds
176
+ defaultActive: t.defaultActive,
177
+ defaultOpeneds: t.defaultOpeneds
158
178
  }), {
159
- default: () => [n.menus?.length ? n.menus.map((e, o) => S(e, o, !1)) : null]
179
+ default: () => [t.menus?.length ? t.menus.map((e, o) => k(e, o, !1)) : null, K("·")]
160
180
  });
161
181
  }
162
182
  });
163
183
  export {
164
- he as default
184
+ xe as default
165
185
  };
@@ -32,6 +32,15 @@ export declare const VftHorizontalMenu: import("vft/es/utils").SFCWithInstall<im
32
32
  menuOptions: {
33
33
  type: import("vue").PropType<Partial<import("vft/es/vft").MenuProps>>;
34
34
  };
35
+ enableScroll: {
36
+ type: import("vue").PropType<boolean>;
37
+ };
38
+ scrollThreshold: {
39
+ type: import("vue").PropType<number>;
40
+ };
41
+ scrollMaxHeight: {
42
+ type: import("vue").PropType<string>;
43
+ };
35
44
  }>, {
36
45
  isInSubMenu: import("vue").ComputedRef<any>;
37
46
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
@@ -76,6 +85,15 @@ export declare const VftHorizontalMenu: import("vft/es/utils").SFCWithInstall<im
76
85
  menuOptions: {
77
86
  type: import("vue").PropType<Partial<import("vft/es/vft").MenuProps>>;
78
87
  };
88
+ enableScroll: {
89
+ type: import("vue").PropType<boolean>;
90
+ };
91
+ scrollThreshold: {
92
+ type: import("vue").PropType<number>;
93
+ };
94
+ scrollMaxHeight: {
95
+ type: import("vue").PropType<string>;
96
+ };
79
97
  }>> & Readonly<{
80
98
  onSelect?: ((val: {
81
99
  route: string;
@@ -13,8 +13,8 @@ import "../../hooks/use-z-index/index.js";
13
13
  import { UPDATE_MODEL_EVENT as Q } from "@vft/constants";
14
14
  import { useAttrs as Ze, useCursor as _e } from "@vft/use";
15
15
  import { calcTextareaHeight as he } from "./utils.js";
16
- import { useFormItem as et, useFormItemInputId as tt } from "../form/hooks/use-form-item.js";
17
- import { useFormSize as at, useFormDisabled as nt } from "../form/hooks/use-form-common-props.js";
16
+ import { useFormSize as et, useFormDisabled as tt } from "../form/hooks/use-form-common-props.js";
17
+ import { useFormItem as at, useFormItemInputId as nt } from "../form/hooks/use-form-item.js";
18
18
  const ot = ["role"], lt = ["id", "type", "disabled", "formatter", "parser", "readonly", "autocomplete", "tabindex", "aria-label", "placeholder", "form"], st = ["id", "tabindex", "disabled", "readonly", "autocomplete", "aria-label", "placeholder", "form"], It = /* @__PURE__ */ Oe({
19
19
  __name: "input",
20
20
  props: {
@@ -85,9 +85,9 @@ const ot = ["role"], lt = ["id", "type", "disabled", "formatter", "parser", "rea
85
85
  n.is("focus", v.value)
86
86
  ]), d = Ze({
87
87
  excludeKeys: l(() => Object.keys(X.value))
88
- }), { form: Ce, formItem: F } = et(), { inputId: Y } = tt(we.props, {
88
+ }), { form: Ce, formItem: F } = at(), { inputId: Y } = nt(we.props, {
89
89
  formItemContext: F
90
- }), ke = at(), x = nt(), n = ye("input"), Z = ye("textarea"), M = H(), p = H(), v = S(!1), N = S(!1), C = S(!1), K = S(!1), _ = S(), O = H(e.inputStyle), k = l(() => M.value || p.value), T = l(() => G(e.prefixIcon, "icon", { size: 16 })), ee = l(() => G(e.suffixIcon, "icon", { size: 16 })), Ie = l(() => G(e.clearIcon, "icon", {
90
+ }), ke = et(), x = tt(), n = ye("input"), Z = ye("textarea"), M = H(), p = H(), v = S(!1), N = S(!1), C = S(!1), K = S(!1), _ = S(), O = H(e.inputStyle), k = l(() => M.value || p.value), T = l(() => G(e.prefixIcon, "icon", { size: 16 })), ee = l(() => G(e.suffixIcon, "icon", { size: 16 })), Ie = l(() => G(e.clearIcon, "icon", {
91
91
  icon: "icon-circle-close",
92
92
  size: 16
93
93
  })), te = l(() => Ce?.statusIcon ?? !1), I = l(() => F?.validateState || ""), ae = l(
@@ -1,6 +1,6 @@
1
1
  import { shallowRef as B, ref as L, computed as c, watch as G } from "vue";
2
2
  import { EVENT_CODE as g } from "../../../constants/aria.js";
3
- import { CHANGE_EVENT as i, UPDATE_MODEL_EVENT as d, INPUT_EVENT as H } from "../../../constants/event.js";
3
+ import { CHANGE_EVENT as i, INPUT_EVENT as H, UPDATE_MODEL_EVENT as d } from "../../../constants/event.js";
4
4
  import "@vueuse/core";
5
5
  import { isUndefined as K } from "@vft/utils";
6
6
  import { debugWarn as C } from "../../../utils/error.js";
@@ -1,4 +1,4 @@
1
- import { defineComponent as n, createElementBlock as o, openBlock as r, normalizeClass as l, unref as i, createElementVNode as m, renderSlot as s, Fragment as a, createTextVNode as u, toDisplayString as c } from "vue";
1
+ import { defineComponent as n, createElementBlock as t, openBlock as o, normalizeClass as i, unref as m, createCommentVNode as a, createElementVNode as p, renderSlot as s, Fragment as u, createTextVNode as c, toDisplayString as d } from "vue";
2
2
  import "@vueuse/core";
3
3
  import "@vft/utils";
4
4
  import "../config-provider/hooks/use-global-config.js";
@@ -8,31 +8,32 @@ import { useNamespace as f } from "../../hooks/use-namespace/index.js";
8
8
  import "../../hooks/use-model-toggle/index.js";
9
9
  import "@popperjs/core";
10
10
  import "../../hooks/use-z-index/index.js";
11
- const d = n({
11
+ const k = n({
12
12
  name: "vft-menu-item-group"
13
- }), V = /* @__PURE__ */ n({
14
- ...d,
13
+ }), b = /* @__PURE__ */ n({
14
+ ...k,
15
15
  props: {
16
16
  title: {}
17
17
  },
18
- setup(p) {
19
- const t = f("menu-item-group");
20
- return (e, _) => (r(), o("li", {
21
- class: l(i(t).b())
18
+ setup(r) {
19
+ const l = f("menu-item-group");
20
+ return (e, g) => (o(), t("li", {
21
+ class: i(m(l).b())
22
22
  }, [
23
- m("div", {
24
- class: l(i(t).e("title"))
23
+ r.title || e.$slots.title ? (o(), t("div", {
24
+ key: 0,
25
+ class: i(m(l).e("title"))
25
26
  }, [
26
- e.$slots.title ? s(e.$slots, "title", { key: 1 }) : (r(), o(a, { key: 0 }, [
27
- u(c(p.title), 1)
27
+ e.$slots.title ? s(e.$slots, "title", { key: 1 }) : (o(), t(u, { key: 0 }, [
28
+ c(d(r.title), 1)
28
29
  ], 64))
29
- ], 2),
30
- m("ul", null, [
30
+ ], 2)) : a("", !0),
31
+ p("ul", null, [
31
32
  s(e.$slots, "default")
32
33
  ])
33
34
  ], 2));
34
35
  }
35
36
  });
36
37
  export {
37
- V as default
38
+ b as default
38
39
  };
@@ -1,2 +1,3 @@
1
1
  import 'vft/theme-style/vft-multiple-tabs.css';
2
2
  import 'vft/es/components/tabs/style/css';
3
+ import 'vft/es/components/icon/style/css';
@@ -1,3 +1,4 @@
1
1
  import "vft/theme-style/base.css";
2
2
  import "vft/theme-style/vft-multiple-tabs.css";
3
3
  import "vft/theme-style/vft-tabs.css";
4
+ import "vft/theme-style/vft-icon.css";
@@ -1,2 +1,3 @@
1
1
  import 'vft/theme-style/src/multiple-tabs.scss';
2
2
  import 'vft/es/components/tabs/style';
3
+ import 'vft/es/components/icon/style';
@@ -1,3 +1,4 @@
1
1
  import "vft/theme-style/src/base.scss";
2
2
  import "vft/theme-style/src/multiple-tabs.scss";
3
3
  import "vft/theme-style/src/tabs.scss";
4
+ import "vft/theme-style/src/icon.scss";
@@ -1,32 +1,33 @@
1
1
  import { getRouterKeyPath as d } from "@vft/router";
2
- import { useMultipleTabStore as D, useTabs as v } from "@vft/store";
2
+ import { useMultipleTabStore as v, useTabs as w } from "@vft/store";
3
3
  import "@vft/utils";
4
- import { reactive as w, computed as M } from "vue";
4
+ import { reactive as M, computed as P } from "vue";
5
5
  import "../../context-menu/context-menu.vue2.js";
6
6
  import "../../icon/index.js";
7
7
  import "vue-router";
8
- function K(e, t) {
9
- const i = w({
8
+ function W(e, t) {
9
+ const i = M({
10
10
  current: null,
11
11
  currentIndex: 0
12
- }), n = D(), {
13
- refreshPage: g,
14
- closeAll: a,
12
+ }), n = v(), {
13
+ refreshPage: a,
14
+ closeAll: g,
15
15
  close: u,
16
16
  closeLeft: h,
17
17
  closeOther: f,
18
18
  closeRight: p,
19
19
  newWinTab: x,
20
- fullScreen: b
21
- } = v(), L = M(() => {
20
+ fullScreen: L,
21
+ alonePage: b
22
+ } = w(), C = P(() => {
22
23
  if (!e)
23
24
  return;
24
- const { meta: r } = e, o = i.currentIndex, c = o === 0 || o <= t, s = n.getTabList.length <= t || o === n.getTabList.length - 1 && n.getLastDragEndIndex >= 0, C = n.getTabList.length === t || n.getTabList.length === t + 1 && o === t, l = n.getTabList.length === t;
25
+ const { meta: r } = e, o = i.currentIndex, c = o === 0 || o <= t, l = n.getTabList.length <= t || o === n.getTabList.length - 1 && n.getLastDragEndIndex >= 0, D = n.getTabList.length === t || n.getTabList.length === t + 1 && o === t, s = n.getTabList.length === t;
25
26
  return [
26
27
  {
27
28
  iconCfg: { icon: "icon-refresh-right" },
28
29
  text: "刷新",
29
- handler: () => g(e)
30
+ handler: () => a(e)
30
31
  },
31
32
  {
32
33
  iconCfg: { icon: "icon-new-tab" },
@@ -37,7 +38,7 @@ function K(e, t) {
37
38
  {
38
39
  iconCfg: { icon: "icon-close-tab" },
39
40
  text: "关闭标签页",
40
- disabled: !!r?.affix || l,
41
+ disabled: !!r?.affix || s,
41
42
  handler: () => u(e)
42
43
  },
43
44
  {
@@ -49,26 +50,31 @@ function K(e, t) {
49
50
  {
50
51
  iconCfg: { icon: "icon-arrow-close-right" },
51
52
  text: "关闭右侧标签页",
52
- disabled: s,
53
+ disabled: l,
53
54
  divider: !0,
54
55
  handler: () => p(e)
55
56
  },
56
57
  {
57
58
  iconCfg: { icon: "icon-close-box-multiple-outline" },
58
59
  text: "关闭其它标签页",
59
- disabled: C,
60
+ disabled: D,
60
61
  handler: () => f(e)
61
62
  },
62
63
  {
63
64
  iconCfg: { icon: "icon-vector-square-delete" },
64
65
  text: "关闭所有标签页",
65
- disabled: l,
66
+ disabled: s,
66
67
  divider: !0,
67
- handler: () => a()
68
+ handler: () => g()
68
69
  },
69
70
  {
70
71
  iconCfg: { icon: "icon-full-screen" },
71
72
  text: "全屏",
73
+ handler: () => L(e)
74
+ },
75
+ {
76
+ iconCfg: { icon: "icon-separate" },
77
+ text: "独立页面",
72
78
  handler: () => b(e)
73
79
  }
74
80
  ];
@@ -79,13 +85,13 @@ function K(e, t) {
79
85
  return;
80
86
  o?.preventDefault();
81
87
  const c = n.getTabList.findIndex(
82
- (s) => d(s) === d(r)
88
+ (l) => d(l) === d(r)
83
89
  );
84
90
  i.current = r, i.currentIndex = c;
85
91
  };
86
92
  }
87
- return { getDropMenuList: L, handleContextMenu: T };
93
+ return { getDropMenuList: C, handleContextMenu: T };
88
94
  }
89
95
  export {
90
- K as useTabDropdown
96
+ W as useTabDropdown
91
97
  };
@@ -1,4 +1,4 @@
1
- import { defineComponent as X, computed as j, ref as re, unref as c, useSlots as oe, createVNode as a, mergeProps as q, withDirectives as ie, vShow as ne, createTextVNode as O, isVNode as le, resolveComponent as N } from "vue";
1
+ import { defineComponent as X, computed as j, ref as re, unref as c, useSlots as oe, createVNode as a, mergeProps as q, withDirectives as ie, vShow as ne, isVNode as le, createTextVNode as O, resolveComponent as N } from "vue";
2
2
  import "../alert/index.js";
3
3
  import "../avatar/index.js";
4
4
  import "../avatar-stack/index.js";
@@ -2,14 +2,14 @@ import "@vueuse/core";
2
2
  import { isNumber as m, isClient as p } from "@vft/utils";
3
3
  import { debugWarn as l } from "../../utils/error.js";
4
4
  import "../../components/config-provider/hooks/use-global-config.js";
5
- import { getCurrentInstance as i, inject as e, computed as c, unref as v, ref as Z } from "vue";
5
+ import { ref as v, getCurrentInstance as i, inject as e, computed as c, unref as Z } from "vue";
6
6
  import "lodash-es";
7
7
  import "../../components/form/index.js";
8
8
  const s = {
9
9
  current: 0
10
- }, u = Z(0), f = 2e3, d = Symbol("vftZIndexContextKey"), y = Symbol("zIndexContextKey"), K = (I) => {
10
+ }, u = v(0), f = 2e3, d = Symbol("vftZIndexContextKey"), y = Symbol("zIndexContextKey"), K = (I) => {
11
11
  const n = i() ? e(d, s) : s, x = I || (i() ? e(y, void 0) : void 0), t = c(() => {
12
- const r = v(x);
12
+ const r = Z(x);
13
13
  return m(r) ? r : f;
14
14
  }), o = c(() => t.value + u.value), a = () => (n.current++, u.value = n.current, o.value);
15
15
  return !p && !e(d) && l(
@@ -1,6 +1,6 @@
1
1
  declare const _default: {
2
2
  "name": "vft",
3
- "version": "0.0.469",
3
+ "version": "0.0.471",
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.469";
1
+ const o = "0.0.471";
2
2
  export {
3
3
  o as version
4
4
  };
@@ -1,4 +1,4 @@
1
- import { hasOwn as m, camelize as N, isArray as E } from "@vft/utils";
1
+ import { isArray as E, hasOwn as m, camelize as N } from "@vft/utils";
2
2
  import { isVNode as o, Fragment as S, Comment as A, Text as s, createCommentVNode as L, createBlock as _, openBlock as C } from "vue";
3
3
  import { debugWarn as O } from "../error.js";
4
4
  const R = "utils/vue/vnode";
@@ -14,6 +14,9 @@ export interface HorizontalMenuProps {
14
14
  defaultActive?: string;
15
15
  defaultOpeneds?: Array<string | number>;
16
16
  menuOptions?: Partial<MenuProps>;
17
+ enableScroll?: boolean;
18
+ scrollThreshold?: number;
19
+ scrollMaxHeight?: string;
17
20
  }
18
21
  declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<HorizontalMenuProps>>, {
19
22
  isInSubMenu: import("vue").ComputedRef<any>;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("vue"),H=require("@vft/router"),U=require("@vft/utils"),O=require("../menu/index.cjs");require("@vueuse/core");require("../config-provider/hooks/use-global-config.cjs");require("lodash-es");require("../form/index.cjs");const F=require("../../hooks/use-namespace/index.cjs");require("../../hooks/use-model-toggle/index.cjs");require("@popperjs/core");require("../../hooks/use-z-index/index.cjs");const G=require("./constants.cjs"),K=n.defineComponent({name:"vft-horizontal-menu"}),Q=n.defineComponent({...K,props:{menus:{},attrMapping:{},openDisabled:{type:Boolean,default:!1},disabledJudgeTurnOver:{type:Boolean,default:!1},subMenuCfg:{default:()=>({})},useRouterJump:{type:Boolean,default:!1},maxRowLength:{type:[Boolean,Number],default:8},defaultActive:{},defaultOpeneds:{},menuOptions:{}},emits:["open","close","select","sub-menu-click"],setup(t,{expose:N,emit:V}){const p=V,v=F.useNamespace("horizontal-menu"),R=n.computed(()=>(e,o,a)=>({"grid-template-rows":`repeat(${Math.min(e?.[o]?.[l.value.children]?.length||0,Number(a||t.maxRowLength?a||t.maxRowLength:e?.[o]?.[l.value.children]?.length))}, auto)`})),l=n.computed(()=>({path:"path",children:"children",title:"title",index:"path",icon:"icon",disabled:"disabled",...t.attrMapping})),A=n.getCurrentInstance(),g=n.useSlots(),w=n.ref(),S=A.appContext.config.globalProperties.$router,b=(e,o,a)=>{const i=e[l.value.path],s=e[l.value.title],u=e?.[l.value.index],M=e?.[l.value.icon],h=!!e?.[l.value.disabled],d=t.disabledJudgeTurnOver?!h:h,m=u||i||o+s;return n.createVNode(O.VftMenuItem,n.mergeProps(e,{key:m,index:String(m),icon:M,route:i,title:s,disabled:t.openDisabled&&d,className:a?"vft-menu-popup-item":"vft-menu-no-popup-item"}),{default:a?g.menuItem?()=>g.menuItem?.({item:e}):null:g.menuTopItem?()=>g.menuTopItem?.({item:e}):null})},I=e=>{p("open",e)},L=e=>{p("close",e)},P=e=>{p("sub-menu-click",e)},T=(e,o,a)=>{const i=e[l.value.path],s=e[l.value.title],u=e?.[l.value.children],M=e?.[l.value.index],h=e?.[l.value.icon],d=e?.menuOrder,m=e?.maxRowLength,q=!!e?.[l.value.disabled],B=t.disabledJudgeTurnOver?!q:q,k=M||i||o+s,x=e.type===G.MenuTypeEnum.TILE;let y=[];if(x)if(d){const r=d.flat();if(r?.length<u.length){const f=Math.max.apply(null,r);for(let c=f+1;c<u.length;c++)d.push([c])}y=d}else for(let r=0;r<u.length;r++)y.push([r]);return u?.length||e?.render?n.createVNode(O.VftSubMenu,n.mergeProps(t.subMenuCfg,e,{index:String(k),key:k,icon:h,showArrow:e.showArrow??t.subMenuCfg.showArrow,disabled:t.openDisabled&&B,toolTipCfg:{...t.subMenuCfg.toolTipCfg||{},...e.subMenuCfg?.toolTipCfg||{}},teleported:!1,"popper-class":[x?v.e("tile"):"",v.e("normal")]}),{default:()=>[e?.render?e?.render:x?y.map((r,f)=>n.createVNode("div",{class:"content-main",key:f},[r.map((c,D)=>{const C=u?.[c]?.[l.value.children],$=u?.[c]?.maxRowLength;return u?.length?n.createVNode("div",{class:"content-col",key:D},[n.createVNode("span",{class:C?.length?"title":""},[u?.[c]?.[l.value.title]]),C?.length?n.createVNode("div",{class:"content",style:R.value(u,c,$||m)},[C.map((j,E)=>b(j,E,!0))]):null]):null})])):u.map((r,f)=>r[l.value.children]?.length?T(r,f,!0):b(r,f,!0))],title:()=>s}):b(e,o,a)};async function J(e){if(t.useRouterJump){const{go:o}=H.useRouterHelper(S),a=e.route;let i=e.route;e.indexPath.some(u=>U.isUrl(u))&&(i=e.indexPath.slice(-2).join("/"));const s=S.getRoutes().filter(u=>u.path===i)?.[0]?.meta?.linkTarget;o(s?{url:a,winOpenOpt:{target:s}}:a)}p("select",e)}const z=n.computed(()=>w.value?.inSubMenu);return N({isInSubMenu:z}),()=>n.createVNode(O.VftMenu,n.mergeProps(t.menuOptions,{ref:w,onSelect:J,onOpen:I,onClose:L,onSubMenuClick:P,mode:"horizontal",class:v.b(),defaultActive:t.defaultActive,defaultOpeneds:t.defaultOpeneds}),{default:()=>[t.menus?.length?t.menus.map((e,o)=>T(e,o,!1)):null]})}});exports.default=Q;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("vue"),G=require("@vft/router"),U=require("@vft/utils"),b=require("../menu/index.cjs");require("@vueuse/core");require("../config-provider/hooks/use-global-config.cjs");require("lodash-es");require("../form/index.cjs");const W=require("../../hooks/use-namespace/index.cjs");require("../../hooks/use-model-toggle/index.cjs");require("@popperjs/core");require("../../hooks/use-z-index/index.cjs");const Y=require("./constants.cjs");function F(t){return typeof t=="function"||Object.prototype.toString.call(t)==="[object Object]"&&!n.isVNode(t)}const K=n.defineComponent({name:"vft-horizontal-menu"}),Q=n.defineComponent({...K,props:{menus:{},attrMapping:{},openDisabled:{type:Boolean,default:!1},disabledJudgeTurnOver:{type:Boolean,default:!1},subMenuCfg:{default:()=>({})},useRouterJump:{type:Boolean,default:!1},maxRowLength:{type:[Boolean,Number],default:8},defaultActive:{},defaultOpeneds:{},menuOptions:{},enableScroll:{type:Boolean,default:!0},scrollThreshold:{default:10},scrollMaxHeight:{default:"400px"}},emits:["open","close","select","sub-menu-click"],setup(t,{expose:q,emit:k}){const g=k,v=W.useNamespace("horizontal-menu"),R=n.computed(()=>(e,u,a)=>({"grid-template-rows":`repeat(${Math.min(e?.[u]?.[o.value.children]?.length||0,Number(a||t.maxRowLength?a||t.maxRowLength:e?.[u]?.[o.value.children]?.length))}, auto)`})),o=n.computed(()=>({path:"path",children:"children",title:"title",index:"path",icon:"icon",disabled:"disabled",...t.attrMapping})),I=n.getCurrentInstance(),h=n.useSlots(),O=n.ref(),T=I.appContext.config.globalProperties.$router,M=(e,u,a)=>{const i=e[o.value.path],s=e[o.value.title],l=e?.[o.value.index],x=e?.[o.value.icon],p=!!e?.[o.value.disabled],d=t.disabledJudgeTurnOver?!p:p,m=l||i||u+s;return n.createVNode(b.VftMenuItem,n.mergeProps(e,{key:m,index:String(m),icon:x,route:i,title:s,disabled:t.openDisabled&&d,className:a?"vft-menu-popup-item":"vft-menu-no-popup-item"}),{default:a?h.menuItem?()=>h.menuItem?.({item:e}):null:h.menuTopItem?()=>h.menuTopItem?.({item:e}):null})},A=e=>{g("open",e)},L=e=>{g("close",e)},B=e=>{g("sub-menu-click",e)},P=(e,u)=>!t.enableScroll||!e?e:u>t.scrollThreshold?n.createVNode(b.VftMenuItemGroup,{style:{maxHeight:t.scrollMaxHeight,overflowY:"auto"}},F(e)?e:{default:()=>[e]}):e,w=(e,u,a)=>{const i=e[o.value.path],s=e[o.value.title],l=e?.[o.value.children],x=e?.[o.value.index],p=e?.[o.value.icon],d=e?.menuOrder,m=e?.maxRowLength,V=!!e?.[o.value.disabled],z=t.disabledJudgeTurnOver?!V:V,N=x||i||u+s,y=e.type===Y.MenuTypeEnum.TILE;let S=[];if(y)if(d){const r=d.flat();if(r?.length<l.length){const f=Math.max.apply(null,r);for(let c=f+1;c<l.length;c++)d.push([c])}S=d}else for(let r=0;r<l.length;r++)S.push([r]);return l?.length||e?.render?n.createVNode(b.VftSubMenu,n.mergeProps(t.subMenuCfg,e,{index:String(N),key:N,icon:p,showArrow:e.showArrow??t.subMenuCfg.showArrow,disabled:t.openDisabled&&z,toolTipCfg:{...t.subMenuCfg.toolTipCfg||{},...e.subMenuCfg?.toolTipCfg||{}},teleported:!1,"popper-class":[y?v.e("tile"):"",v.e("normal")]}),{default:()=>[P(e?.render?e?.render:y?S.map((r,f)=>n.createVNode("div",{class:"content-main",key:f},[r.map((c,H)=>{const C=l?.[c]?.[o.value.children],D=l?.[c]?.maxRowLength;return l?.length?n.createVNode("div",{class:"content-col",key:H},[n.createVNode("span",{class:C?.length?"title":""},[l?.[c]?.[o.value.title]]),C?.length?n.createVNode("div",{class:"content",style:R.value(l,c,D||m)},[C.map(($,E)=>M($,E,!0))]):null]):null})])):l.map((r,f)=>r[o.value.children]?.length?w(r,f,!0):M(r,f,!0)),l?.length||0)],title:()=>s}):M(e,u,a)};async function j(e){if(t.useRouterJump){const{go:u}=G.useRouterHelper(T),a=e.route;let i=e.route;e.indexPath.some(l=>U.isUrl(l))&&(i=e.indexPath.slice(-2).join("/"));const s=T.getRoutes().filter(l=>l.path===i)?.[0]?.meta?.linkTarget;u(s?{url:a,winOpenOpt:{target:s}}:a)}g("select",e)}const J=n.computed(()=>O.value?.inSubMenu);return q({isInSubMenu:J}),()=>n.createVNode(b.VftMenu,n.mergeProps(t.menuOptions,{ref:O,onSelect:j,onOpen:A,onClose:L,onSubMenuClick:B,mode:"horizontal",class:v.b(),defaultActive:t.defaultActive,defaultOpeneds:t.defaultOpeneds}),{default:()=>[t.menus?.length?t.menus.map((e,u)=>w(e,u,!1)):null,n.createTextVNode("·")]})}});exports.default=Q;
@@ -32,6 +32,15 @@ export declare const VftHorizontalMenu: import("vft/es/utils").SFCWithInstall<im
32
32
  menuOptions: {
33
33
  type: import("vue").PropType<Partial<import("vft/es/vft").MenuProps>>;
34
34
  };
35
+ enableScroll: {
36
+ type: import("vue").PropType<boolean>;
37
+ };
38
+ scrollThreshold: {
39
+ type: import("vue").PropType<number>;
40
+ };
41
+ scrollMaxHeight: {
42
+ type: import("vue").PropType<string>;
43
+ };
35
44
  }>, {
36
45
  isInSubMenu: import("vue").ComputedRef<any>;
37
46
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
@@ -76,6 +85,15 @@ export declare const VftHorizontalMenu: import("vft/es/utils").SFCWithInstall<im
76
85
  menuOptions: {
77
86
  type: import("vue").PropType<Partial<import("vft/es/vft").MenuProps>>;
78
87
  };
88
+ enableScroll: {
89
+ type: import("vue").PropType<boolean>;
90
+ };
91
+ scrollThreshold: {
92
+ type: import("vue").PropType<number>;
93
+ };
94
+ scrollMaxHeight: {
95
+ type: import("vue").PropType<string>;
96
+ };
79
97
  }>> & Readonly<{
80
98
  onSelect?: ((val: {
81
99
  route: string;