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.
- package/dist/index.css +1 -1
- package/es/components/carousel/use-carousel.js +1 -1
- package/es/components/horizontal-menu/horizontal-menu.vue.d.ts +3 -0
- package/es/components/horizontal-menu/horizontal-menu.vue2.js +93 -73
- package/es/components/horizontal-menu/index.d.ts +18 -0
- package/es/components/input/input.vue2.js +4 -4
- package/es/components/input-tag/composables/use-input-tag.js +1 -1
- package/es/components/menu/menu-item-group.vue2.js +16 -15
- package/es/components/multiple-tabs/style/css.d.ts +1 -0
- package/es/components/multiple-tabs/style/css.js +1 -0
- package/es/components/multiple-tabs/style/index.d.ts +1 -0
- package/es/components/multiple-tabs/style/index.js +1 -0
- package/es/components/multiple-tabs/use/use-tab-dropdown.js +25 -19
- package/es/components/super-form/super-form-item.vue2.js +1 -1
- package/es/hooks/use-z-index/index.js +3 -3
- package/es/package.json.d.ts +1 -1
- package/es/package.json.js +1 -1
- package/es/utils/vue/vnode.js +1 -1
- package/lib/components/horizontal-menu/horizontal-menu.vue.d.ts +3 -0
- package/lib/components/horizontal-menu/horizontal-menu.vue2.cjs +1 -1
- package/lib/components/horizontal-menu/index.d.ts +18 -0
- package/lib/components/input/input.vue2.cjs +1 -1
- package/lib/components/menu/menu-item-group.vue2.cjs +1 -1
- package/lib/components/multiple-tabs/style/css.cjs +1 -1
- package/lib/components/multiple-tabs/style/css.d.ts +1 -0
- package/lib/components/multiple-tabs/style/index.cjs +1 -1
- package/lib/components/multiple-tabs/style/index.d.ts +1 -0
- package/lib/components/multiple-tabs/use/use-tab-dropdown.cjs +1 -1
- package/lib/package.json.cjs +1 -1
- package/lib/package.json.d.ts +1 -1
- package/package.json +4 -4
- package/theme-style/index.css +1 -1
- package/theme-style/src/common/icon.scss +1 -0
- package/theme-style/src/menu.scss +0 -5
- package/theme-style/src/mixins/mixins.scss +0 -50
- package/theme-style/src/multiple-tabs.scss +4 -0
- package/theme-style/vft-menu.css +1 -1
- package/theme-style/vft-multiple-tabs.css +1 -1
- 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 {
|
|
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
|
|
2
|
-
import { useRouterHelper as
|
|
3
|
-
import { isUrl as
|
|
4
|
-
import { VftMenu as
|
|
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
|
|
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
|
|
14
|
-
|
|
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
|
-
}),
|
|
17
|
-
...
|
|
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(
|
|
46
|
-
expose:
|
|
47
|
-
emit:
|
|
58
|
+
setup(t, {
|
|
59
|
+
expose: N,
|
|
60
|
+
emit: A
|
|
48
61
|
}) {
|
|
49
|
-
const
|
|
50
|
-
"grid-template-rows": `repeat(${Math.min(e?.[o]?.[
|
|
51
|
-
})),
|
|
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
|
-
...
|
|
59
|
-
})),
|
|
60
|
-
const
|
|
61
|
-
return
|
|
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:
|
|
78
|
+
route: i,
|
|
66
79
|
title: r,
|
|
67
|
-
disabled:
|
|
80
|
+
disabled: t.openDisabled && d,
|
|
68
81
|
className: a ? "vft-menu-popup-item" : "vft-menu-no-popup-item"
|
|
69
82
|
}), {
|
|
70
|
-
default: a ?
|
|
83
|
+
default: a ? h.menuItem ? () => h.menuItem?.({
|
|
71
84
|
item: e
|
|
72
|
-
}) : null :
|
|
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
|
-
|
|
78
|
-
},
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
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 <
|
|
89
|
-
const
|
|
90
|
-
for (let 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 <
|
|
115
|
+
for (let u = 0; u < n.length; u++)
|
|
96
116
|
y.push([u]);
|
|
97
|
-
return
|
|
98
|
-
index: String(
|
|
99
|
-
key:
|
|
100
|
-
icon:
|
|
101
|
-
showArrow: e.showArrow ??
|
|
102
|
-
disabled:
|
|
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
|
-
...
|
|
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,
|
|
130
|
+
default: () => [H(e?.render ? e?.render : x ? y.map((u, f) => c("div", {
|
|
111
131
|
class: "content-main",
|
|
112
|
-
key:
|
|
113
|
-
}, [u.map((s,
|
|
114
|
-
const C =
|
|
115
|
-
return
|
|
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:
|
|
118
|
-
}, [
|
|
137
|
+
key: $
|
|
138
|
+
}, [c("span", {
|
|
119
139
|
class: C?.length ? "title" : ""
|
|
120
|
-
}, [
|
|
140
|
+
}, [n?.[s]?.[l.value.title]]), C?.length ? c("div", {
|
|
121
141
|
class: "content",
|
|
122
|
-
style:
|
|
123
|
-
}, [C.map((U,
|
|
124
|
-
})])) :
|
|
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
|
|
129
|
-
if (
|
|
148
|
+
async function D(e) {
|
|
149
|
+
if (t.useRouterJump) {
|
|
130
150
|
const {
|
|
131
151
|
go: o
|
|
132
|
-
} =
|
|
133
|
-
let
|
|
134
|
-
e.indexPath.some((
|
|
135
|
-
const r =
|
|
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
|
-
|
|
163
|
+
p("select", e);
|
|
144
164
|
}
|
|
145
|
-
const
|
|
146
|
-
return
|
|
147
|
-
isInSubMenu:
|
|
148
|
-
}), () =>
|
|
149
|
-
ref:
|
|
150
|
-
onSelect:
|
|
151
|
-
onOpen:
|
|
152
|
-
onClose:
|
|
153
|
-
onSubMenuClick:
|
|
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:
|
|
157
|
-
defaultOpeneds:
|
|
176
|
+
defaultActive: t.defaultActive,
|
|
177
|
+
defaultOpeneds: t.defaultOpeneds
|
|
158
178
|
}), {
|
|
159
|
-
default: () => [
|
|
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
|
-
|
|
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 {
|
|
17
|
-
import {
|
|
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 } =
|
|
88
|
+
}), { form: Ce, formItem: F } = at(), { inputId: Y } = nt(we.props, {
|
|
89
89
|
formItemContext: F
|
|
90
|
-
}), ke =
|
|
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,
|
|
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
|
|
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
|
|
11
|
+
const k = n({
|
|
12
12
|
name: "vft-menu-item-group"
|
|
13
|
-
}),
|
|
14
|
-
...
|
|
13
|
+
}), b = /* @__PURE__ */ n({
|
|
14
|
+
...k,
|
|
15
15
|
props: {
|
|
16
16
|
title: {}
|
|
17
17
|
},
|
|
18
|
-
setup(
|
|
19
|
-
const
|
|
20
|
-
return (e,
|
|
21
|
-
class:
|
|
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
|
-
|
|
24
|
-
|
|
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 }) : (
|
|
27
|
-
|
|
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
|
-
|
|
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
|
-
|
|
38
|
+
b as default
|
|
38
39
|
};
|
|
@@ -1,32 +1,33 @@
|
|
|
1
1
|
import { getRouterKeyPath as d } from "@vft/router";
|
|
2
|
-
import { useMultipleTabStore as
|
|
2
|
+
import { useMultipleTabStore as v, useTabs as w } from "@vft/store";
|
|
3
3
|
import "@vft/utils";
|
|
4
|
-
import { reactive as
|
|
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
|
|
9
|
-
const i =
|
|
8
|
+
function W(e, t) {
|
|
9
|
+
const i = M({
|
|
10
10
|
current: null,
|
|
11
11
|
currentIndex: 0
|
|
12
|
-
}), n =
|
|
13
|
-
refreshPage:
|
|
14
|
-
closeAll:
|
|
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:
|
|
21
|
-
|
|
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,
|
|
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: () =>
|
|
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 ||
|
|
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:
|
|
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:
|
|
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:
|
|
66
|
+
disabled: s,
|
|
66
67
|
divider: !0,
|
|
67
|
-
handler: () =>
|
|
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
|
-
(
|
|
88
|
+
(l) => d(l) === d(r)
|
|
83
89
|
);
|
|
84
90
|
i.current = r, i.currentIndex = c;
|
|
85
91
|
};
|
|
86
92
|
}
|
|
87
|
-
return { getDropMenuList:
|
|
93
|
+
return { getDropMenuList: C, handleContextMenu: T };
|
|
88
94
|
}
|
|
89
95
|
export {
|
|
90
|
-
|
|
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,
|
|
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
|
|
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 =
|
|
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 =
|
|
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(
|
package/es/package.json.d.ts
CHANGED
package/es/package.json.js
CHANGED
package/es/utils/vue/vnode.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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"),
|
|
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;
|