vft 0.0.53 → 0.0.55
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/attributes.json +1 -0
- package/dist/index.css +1 -1
- package/es/component.js +0 -2
- package/es/components/back-top/back-top.vue2.js +4 -3
- package/es/components/context-menu/context-menu.vue2.js +46 -41
- package/es/components/icon-text/icon-text.vue2.js +31 -24
- package/es/components/md-container/md-container.vue2.js +74 -68
- package/es/components/md-container/use/useCopyCode.js +3 -3
- package/es/components/menu/menu-item.vue2.js +4 -3
- package/es/components/menu/sub-menu.vue2.js +4 -3
- package/es/components/multiple-tabs/multiple-tabs.vue2.js +34 -36
- package/es/components/multiple-tabs/tab-content.vue2.js +18 -84
- package/es/components/result/result.vue2.js +4 -3
- package/es/components/search/search.vue2.js +4 -3
- package/es/components/side-menu/side-menu.vue2.js +3 -2
- package/es/components/tabs/index.d.ts +8 -8
- package/es/components/tabs/tab-nav.vue.d.ts +6 -7
- package/es/components/tabs/tab-nav.vue2.js +42 -38
- package/es/components/tabs/tabs.vue.d.ts +9 -9
- package/es/components/tabs/tabs.vue2.js +43 -48
- package/es/package.json.js +1 -1
- package/global.d.ts +28 -3
- package/lib/components/back-top/back-top.vue2.cjs +1 -1
- package/lib/components/context-menu/context-menu.vue2.cjs +1 -1
- package/lib/components/icon-text/icon-text.vue2.cjs +1 -1
- package/lib/components/md-container/md-container.vue2.cjs +1 -1
- package/lib/components/md-container/use/useCopyCode.cjs +1 -1
- package/lib/components/menu/menu-item.vue2.cjs +1 -1
- package/lib/components/menu/sub-menu.vue2.cjs +1 -1
- package/lib/components/multiple-tabs/multiple-tabs.vue2.cjs +1 -1
- package/lib/components/multiple-tabs/tab-content.vue2.cjs +1 -1
- package/lib/components/result/result.vue2.cjs +1 -1
- package/lib/components/search/search.vue2.cjs +1 -1
- package/lib/components/side-menu/side-menu.vue2.cjs +1 -1
- package/lib/components/tabs/index.d.ts +8 -8
- package/lib/components/tabs/tab-nav.vue.d.ts +6 -7
- package/lib/components/tabs/tab-nav.vue2.cjs +1 -1
- package/lib/components/tabs/tabs.vue.d.ts +9 -9
- package/lib/components/tabs/tabs.vue2.cjs +1 -1
- package/lib/package.json.cjs +1 -1
- package/package.json +6 -1
- package/tags.json +1 -0
- package/theme-style/dark/css-vars.css +1 -1
- package/theme-style/index.css +1 -1
- package/theme-style/src/button.scss +1 -2
- package/theme-style/src/common/var.scss +19 -20
- package/theme-style/src/context-menu.scss +12 -0
- package/theme-style/src/dark/css-vars.scss +26 -0
- package/theme-style/src/dark/var.scss +61 -17
- package/theme-style/src/icon-text.scss +2 -0
- package/theme-style/src/logo.scss +1 -1
- package/theme-style/src/md/table.scss +5 -0
- package/theme-style/src/md-container.scss +42 -2
- package/theme-style/src/menu.scss +3 -3
- package/theme-style/src/side-menu.scss +2 -2
- package/theme-style/src/tabs.scss +70 -70
- package/theme-style/vft-button.css +1 -1
- package/theme-style/vft-context-menu.css +1 -0
- package/theme-style/vft-footer-layout.css +1 -1
- package/theme-style/vft-header-layout.css +1 -1
- package/theme-style/vft-icon-text.css +1 -1
- package/theme-style/vft-logo.css +1 -1
- package/theme-style/vft-md-container.css +1 -1
- package/theme-style/vft-menu.css +1 -1
- package/theme-style/vft-multiple-tabs.css +1 -1
- package/theme-style/vft-side-menu.css +1 -1
- package/theme-style/vft-tabs.css +1 -1
- package/web-types.json +1 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { defineComponent as P, ref as
|
|
1
|
+
import { defineComponent as P, ref as b, computed as h, watchEffect as E, unref as r, openBlock as x, createElementBlock as R, normalizeClass as H, normalizeStyle as K, createVNode as S, withCtx as _, Fragment as F, renderList as U, createBlock as $ } from "vue";
|
|
2
2
|
import { useRouterHelper as j, getRouterKeyPath as c, listenerRouteChange as q } from "@vft/router";
|
|
3
3
|
import { useMultipleTabStore as G, useTabs as J } from "@vft/store";
|
|
4
4
|
import { useRefs as L } from "@vft/use";
|
|
5
5
|
import "@vft/utils";
|
|
6
6
|
import "lodash";
|
|
7
7
|
import "@vueuse/core";
|
|
8
|
-
import { generateCssVars as
|
|
8
|
+
import { generateCssVars as C } from "../../utils/ns-cover.js";
|
|
9
9
|
import O from "hotkeys-js";
|
|
10
10
|
import { useRouter as Q, onBeforeRouteLeave as W } from "vue-router";
|
|
11
11
|
import { useNamespace as X } from "../../hooks/use-namespace/index.js";
|
|
@@ -24,6 +24,7 @@ import "../collapse-transition/index.js";
|
|
|
24
24
|
import "../tooltip/index.js";
|
|
25
25
|
import "../popover/index.js";
|
|
26
26
|
import "../menu/index.js";
|
|
27
|
+
import "../context-menu/context-menu.vue2.js";
|
|
27
28
|
import { initAffixTabs as tt, useTabsDrag as et } from "./use/use-multiple-tabs.js";
|
|
28
29
|
import "../header-layout/index.js";
|
|
29
30
|
import "../footer-layout/index.js";
|
|
@@ -78,7 +79,7 @@ const M = (
|
|
|
78
79
|
X("multiple-tabs")
|
|
79
80
|
), rt = P({
|
|
80
81
|
name: M.b()
|
|
81
|
-
}),
|
|
82
|
+
}), Pe = /* @__PURE__ */ P({
|
|
82
83
|
...rt,
|
|
83
84
|
props: {
|
|
84
85
|
tabsStyle: null,
|
|
@@ -88,7 +89,7 @@ const M = (
|
|
|
88
89
|
setup(f) {
|
|
89
90
|
const i = tt();
|
|
90
91
|
f.canDrag && et(i);
|
|
91
|
-
const u = G(), n =
|
|
92
|
+
const u = G(), n = b(""), a = b(0), d = b(), v = Q(), { go: g } = j(), s = h(() => u.getTabList.filter((t) => {
|
|
92
93
|
var e;
|
|
93
94
|
return !((e = t.meta) != null && e.hideTab);
|
|
94
95
|
}));
|
|
@@ -101,52 +102,51 @@ const M = (
|
|
|
101
102
|
}), W(() => {
|
|
102
103
|
d.value = r(v.currentRoute);
|
|
103
104
|
}), q((t) => {
|
|
104
|
-
var
|
|
105
|
-
if (!t || (
|
|
105
|
+
var T;
|
|
106
|
+
if (!t || (T = t.meta) != null && T.hasTokenToRoot)
|
|
106
107
|
return;
|
|
107
|
-
const { meta: e = {} } = t, { currentActivePath: o, hideTab: m } = e,
|
|
108
|
-
if (n.value !==
|
|
109
|
-
let
|
|
110
|
-
|
|
108
|
+
const { meta: e = {} } = t, { currentActivePath: o, hideTab: m } = e, p = m ? o : null, l = c(t);
|
|
109
|
+
if (n.value !== l && (n.value = l), p) {
|
|
110
|
+
let y = v.getRoutes().find((D) => D.path === o);
|
|
111
|
+
y && u.addTab(y, r(d), a.value, t);
|
|
111
112
|
} else
|
|
112
113
|
u.addTab(r(t), r(d), a.value);
|
|
113
114
|
});
|
|
114
115
|
function k(t) {
|
|
115
|
-
var m,
|
|
116
|
+
var m, p;
|
|
116
117
|
if (n.value === t.paneName)
|
|
117
118
|
return;
|
|
118
119
|
const e = s.value[t.attrs.index];
|
|
119
120
|
n.value = t.paneName;
|
|
120
|
-
const o = (
|
|
121
|
+
const o = (p = (m = e == null ? void 0 : e.meta) == null ? void 0 : m.hideActiveRoute) == null ? void 0 : p.fullPath;
|
|
121
122
|
g(o || e.fullPath || e.path);
|
|
122
123
|
}
|
|
123
124
|
function B(t) {
|
|
124
125
|
u.closeTabByKey(t, v);
|
|
125
126
|
}
|
|
126
|
-
const [
|
|
127
|
-
function
|
|
127
|
+
const [N, I] = L();
|
|
128
|
+
function V(t) {
|
|
128
129
|
const e = t.pane.attrs.index, o = t.event;
|
|
129
|
-
|
|
130
|
+
N.value[e].handleContext(o);
|
|
130
131
|
}
|
|
131
|
-
const
|
|
132
|
+
const w = h(() => ({ ...C({
|
|
132
133
|
padding: "4px 0 0",
|
|
134
|
+
"border-bottom": "none",
|
|
133
135
|
"header-height": "26px",
|
|
134
|
-
"item-color": "#5C5C5C",
|
|
135
|
-
"item-bg-color": "#f8f8f8",
|
|
136
136
|
"font-size": "13px",
|
|
137
137
|
"item-padding": "0 10px",
|
|
138
138
|
"close-icon-left": "8px",
|
|
139
139
|
"item-distance": "10px",
|
|
140
140
|
"item-max-width": "348px",
|
|
141
141
|
"scroll-padding": "0 20px",
|
|
142
|
-
"header-margin": "0 0 0 8px"
|
|
142
|
+
"header-margin": "0 0 0 8px",
|
|
143
|
+
"item-border": "none"
|
|
143
144
|
}, "tabs"), ...f.tabsStyle })), { closeCurrent: A } = J();
|
|
144
145
|
O("command+e, ctrl+e", function() {
|
|
145
146
|
return A(), !1;
|
|
146
147
|
});
|
|
147
|
-
const z =
|
|
148
|
-
...
|
|
149
|
-
border: "1px solid #dcdfe6",
|
|
148
|
+
const z = h(() => ({
|
|
149
|
+
...C({
|
|
150
150
|
"sub-item-height": "40px",
|
|
151
151
|
"item-min-width": "150px"
|
|
152
152
|
}, "menu"),
|
|
@@ -154,34 +154,32 @@ const M = (
|
|
|
154
154
|
}));
|
|
155
155
|
return (t, e) => (x(), R("div", {
|
|
156
156
|
class: H(r(M).b()),
|
|
157
|
-
style: K(r(
|
|
157
|
+
style: K(r(w))
|
|
158
158
|
}, [
|
|
159
|
-
|
|
159
|
+
S(r(Y), {
|
|
160
160
|
"model-value": n.value,
|
|
161
161
|
"onUpdate:modelValue": e[0] || (e[0] = (o) => n.value = o),
|
|
162
|
-
type: "card",
|
|
163
162
|
onTabClick: k,
|
|
164
163
|
onTabRemove: B,
|
|
165
|
-
onTabContextMenu:
|
|
166
|
-
closeIconCfg: { color: "white" }
|
|
164
|
+
onTabContextMenu: V
|
|
167
165
|
}, {
|
|
168
|
-
default:
|
|
166
|
+
default: _(() => [
|
|
169
167
|
(x(!0), R(F, null, U(r(s), (o, m) => {
|
|
170
|
-
var
|
|
168
|
+
var p;
|
|
171
169
|
return x(), $(r(Z), {
|
|
172
170
|
key: r(c)(o) + m,
|
|
173
|
-
closable: !((
|
|
171
|
+
closable: !((p = o.meta) != null && p.affix),
|
|
174
172
|
index: m,
|
|
175
173
|
name: r(c)(o)
|
|
176
174
|
}, {
|
|
177
|
-
label:
|
|
178
|
-
var
|
|
175
|
+
label: _(() => {
|
|
176
|
+
var l;
|
|
179
177
|
return [
|
|
180
|
-
|
|
178
|
+
S(ot, {
|
|
181
179
|
contextMenuStyle: r(z),
|
|
182
|
-
affixNum: (
|
|
180
|
+
affixNum: (l = r(i)) == null ? void 0 : l.length,
|
|
183
181
|
ref_for: !0,
|
|
184
|
-
ref: r(
|
|
182
|
+
ref: r(I)(m),
|
|
185
183
|
tabItem: o
|
|
186
184
|
}, null, 8, ["contextMenuStyle", "affixNum", "tabItem"])
|
|
187
185
|
];
|
|
@@ -196,5 +194,5 @@ const M = (
|
|
|
196
194
|
}
|
|
197
195
|
});
|
|
198
196
|
export {
|
|
199
|
-
|
|
197
|
+
Pe as default
|
|
200
198
|
};
|
|
@@ -1,102 +1,36 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as r, computed as c, openBlock as s, createElementBlock as f, unref as m, withModifiers as x, toDisplayString as p } from "vue";
|
|
2
2
|
import "@vft/utils";
|
|
3
|
+
import "../context-menu/context-menu.vue2.js";
|
|
4
|
+
import { useContextMenu as b } from "../context-menu/useContextMenu.js";
|
|
5
|
+
import { useTabDropdown as d } from "./use/use-tab-dropdown.js";
|
|
3
6
|
import "@vft/use";
|
|
4
|
-
import "../divider/index.js";
|
|
5
|
-
import "../icon/index.js";
|
|
6
|
-
import "../avatar/index.js";
|
|
7
|
-
import "../empty/index.js";
|
|
8
|
-
import "../result/index.js";
|
|
9
|
-
import "../tabs/index.js";
|
|
10
|
-
import "../popper/index.js";
|
|
11
|
-
import "../collapse-transition/index.js";
|
|
12
|
-
import "../tooltip/index.js";
|
|
13
|
-
import "../popover/index.js";
|
|
14
|
-
import "../menu/index.js";
|
|
15
|
-
import "./multiple-tabs.vue2.js";
|
|
16
|
-
import { useTabDropdown as b } from "./use/use-tab-dropdown.js";
|
|
17
7
|
import "vue-router";
|
|
18
8
|
import "@vft/store";
|
|
19
|
-
|
|
20
|
-
import "../footer-layout/index.js";
|
|
21
|
-
import "../iframe-layout/index.js";
|
|
22
|
-
import "../router-view-content/index.js";
|
|
23
|
-
import "../logo/index.js";
|
|
24
|
-
import "../back-top/index.js";
|
|
25
|
-
import "../config-provider/index.js";
|
|
26
|
-
import "../descriptions/index.js";
|
|
27
|
-
import "../full-screen/index.js";
|
|
28
|
-
import "../icon-text/index.js";
|
|
29
|
-
import "../image/index.js";
|
|
30
|
-
import "../input/index.js";
|
|
31
|
-
import "../link/index.js";
|
|
32
|
-
import "../pagination/index.js";
|
|
33
|
-
import "../tag/index.js";
|
|
34
|
-
import "../side-menu/index.js";
|
|
35
|
-
import "../qrcode/index.js";
|
|
36
|
-
import "../overlay/index.js";
|
|
37
|
-
import "../clamp/index.js";
|
|
38
|
-
import "../clamp-toggle/index.js";
|
|
39
|
-
import "../page-wrapper/index.js";
|
|
40
|
-
import "../exception/index.js";
|
|
41
|
-
import "../search/index.js";
|
|
42
|
-
import "../form/index.js";
|
|
43
|
-
import "../button/index.js";
|
|
44
|
-
import "../checkbox/index.js";
|
|
45
|
-
import "../radio/index.js";
|
|
46
|
-
import "../switch/index.js";
|
|
47
|
-
import "../color-picker/index.js";
|
|
48
|
-
import "../scrollbar/index.js";
|
|
49
|
-
import "../dropdown/index.js";
|
|
50
|
-
import "../virtual-list/components/fixed-size-list.js";
|
|
51
|
-
import "../virtual-list/components/dynamic-size-list.js";
|
|
52
|
-
import "../virtual-list/components/fixed-size-grid.js";
|
|
53
|
-
import "../virtual-list/components/dynamic-size-grid.js";
|
|
54
|
-
import "../virtual-list/props.js";
|
|
55
|
-
import "../select-v2/index.js";
|
|
56
|
-
import "../verify-code/index.js";
|
|
57
|
-
import "../table/index.js";
|
|
58
|
-
import "../image-viewer/index.js";
|
|
59
|
-
import "../md-container/index.js";
|
|
60
|
-
import "../md-comment/index.js";
|
|
61
|
-
import "../md-tabs/index.js";
|
|
62
|
-
import "../md-vue-playground/index.js";
|
|
63
|
-
import "../md-code-demo/index.js";
|
|
64
|
-
import "../md-code-tabs/index.js";
|
|
65
|
-
import "../message/index.js";
|
|
66
|
-
import "../config-provider/hooks/use-global-config.js";
|
|
67
|
-
import "@popperjs/core";
|
|
68
|
-
import "lodash";
|
|
69
|
-
import "../../hooks/use-z-index/index.js";
|
|
70
|
-
import "@vueuse/core";
|
|
71
|
-
import "../../utils/ns-cover.js";
|
|
72
|
-
import "@vue/reactivity";
|
|
73
|
-
import "@vue/shared";
|
|
74
|
-
import { useContextMenu as d } from "../context-menu/useContextMenu.js";
|
|
75
|
-
const C = ["title", "onContextmenu"], Ht = /* @__PURE__ */ l({
|
|
9
|
+
const C = ["title", "onContextmenu"], w = /* @__PURE__ */ r({
|
|
76
10
|
__name: "tab-content",
|
|
77
11
|
props: {
|
|
78
12
|
tabItem: null,
|
|
79
13
|
affixNum: null,
|
|
80
14
|
contextMenuStyle: null
|
|
81
15
|
},
|
|
82
|
-
setup(t, { expose:
|
|
83
|
-
const [
|
|
84
|
-
function
|
|
85
|
-
|
|
86
|
-
event:
|
|
16
|
+
setup(t, { expose: i }) {
|
|
17
|
+
const [a] = b(), n = c(() => t.tabItem.meta && t.tabItem.meta.title), { getDropMenuList: l, handleContextMenu: u } = d(t.tabItem, t.affixNum);
|
|
18
|
+
function o(e) {
|
|
19
|
+
u(t.tabItem)(e), a({
|
|
20
|
+
event: e,
|
|
87
21
|
styles: t.contextMenuStyle,
|
|
88
|
-
items:
|
|
22
|
+
items: l.value
|
|
89
23
|
});
|
|
90
24
|
}
|
|
91
|
-
return
|
|
92
|
-
handleContext:
|
|
93
|
-
}), (
|
|
94
|
-
title:
|
|
25
|
+
return i({
|
|
26
|
+
handleContext: o
|
|
27
|
+
}), (e, M) => (s(), f("span", {
|
|
28
|
+
title: m(n),
|
|
95
29
|
class: "vft-multiple-tabs__title",
|
|
96
|
-
onContextmenu:
|
|
97
|
-
},
|
|
30
|
+
onContextmenu: x(o, ["stop"])
|
|
31
|
+
}, p(m(n)), 41, C));
|
|
98
32
|
}
|
|
99
33
|
});
|
|
100
34
|
export {
|
|
101
|
-
|
|
35
|
+
w as default
|
|
102
36
|
};
|
|
@@ -19,10 +19,11 @@ import "../collapse-transition/index.js";
|
|
|
19
19
|
import "../tooltip/index.js";
|
|
20
20
|
import "../popover/index.js";
|
|
21
21
|
import "../menu/index.js";
|
|
22
|
-
import "
|
|
22
|
+
import "../context-menu/context-menu.vue2.js";
|
|
23
23
|
import "../multiple-tabs/multiple-tabs.vue2.js";
|
|
24
24
|
import "@vft/router";
|
|
25
25
|
import "@vft/store";
|
|
26
|
+
import "@vft/use";
|
|
26
27
|
import "vue-router";
|
|
27
28
|
import "../header-layout/index.js";
|
|
28
29
|
import "../footer-layout/index.js";
|
|
@@ -76,7 +77,7 @@ const i = (
|
|
|
76
77
|
x("result")
|
|
77
78
|
), I = l({
|
|
78
79
|
name: i.b()
|
|
79
|
-
}),
|
|
80
|
+
}), Jt = /* @__PURE__ */ l({
|
|
80
81
|
...I,
|
|
81
82
|
props: {
|
|
82
83
|
title: null,
|
|
@@ -115,5 +116,5 @@ const i = (
|
|
|
115
116
|
}
|
|
116
117
|
});
|
|
117
118
|
export {
|
|
118
|
-
|
|
119
|
+
Jt as default
|
|
119
120
|
};
|
|
@@ -12,9 +12,10 @@ import "../collapse-transition/index.js";
|
|
|
12
12
|
import "../tooltip/index.js";
|
|
13
13
|
import { VftPopover as L } from "../popover/index.js";
|
|
14
14
|
import "../menu/index.js";
|
|
15
|
-
import "
|
|
15
|
+
import "../context-menu/context-menu.vue2.js";
|
|
16
16
|
import "../multiple-tabs/multiple-tabs.vue2.js";
|
|
17
17
|
import "@vft/store";
|
|
18
|
+
import "@vft/use";
|
|
18
19
|
import "vue-router";
|
|
19
20
|
import "../header-layout/index.js";
|
|
20
21
|
import "../footer-layout/index.js";
|
|
@@ -76,7 +77,7 @@ const u = (
|
|
|
76
77
|
W("search")
|
|
77
78
|
), U = C({
|
|
78
79
|
name: u.b()
|
|
79
|
-
}),
|
|
80
|
+
}), ao = /* @__PURE__ */ C({
|
|
80
81
|
...U,
|
|
81
82
|
props: {
|
|
82
83
|
modelValue: { default: "" },
|
|
@@ -204,5 +205,5 @@ const u = (
|
|
|
204
205
|
}
|
|
205
206
|
});
|
|
206
207
|
export {
|
|
207
|
-
|
|
208
|
+
ao as default
|
|
208
209
|
};
|
|
@@ -21,6 +21,7 @@ import "../collapse-transition/index.js";
|
|
|
21
21
|
import "../tooltip/index.js";
|
|
22
22
|
import "../popover/index.js";
|
|
23
23
|
import { VftMenu as J, VftSubMenu as K, VftMenuItem as b } from "../menu/index.js";
|
|
24
|
+
import "../context-menu/context-menu.vue2.js";
|
|
24
25
|
import "../multiple-tabs/multiple-tabs.vue2.js";
|
|
25
26
|
import "@vft/store";
|
|
26
27
|
import { useRouter as L } from "vue-router";
|
|
@@ -76,7 +77,7 @@ const l = (
|
|
|
76
77
|
D("side-menu")
|
|
77
78
|
), Q = k({
|
|
78
79
|
name: l.b()
|
|
79
|
-
}),
|
|
80
|
+
}), ge = /* @__PURE__ */ k({
|
|
80
81
|
...Q,
|
|
81
82
|
props: {
|
|
82
83
|
menus: null,
|
|
@@ -248,5 +249,5 @@ const l = (
|
|
|
248
249
|
}
|
|
249
250
|
});
|
|
250
251
|
export {
|
|
251
|
-
|
|
252
|
+
ge as default
|
|
252
253
|
};
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
export declare const VftTabs: import("vft/es/utils").SFCWithInstall<import("vue").DefineComponent<{
|
|
2
|
-
type: {
|
|
3
|
-
type: import("vue").PropType<import("./types").TabsType | undefined>;
|
|
4
|
-
required: false;
|
|
5
|
-
};
|
|
6
2
|
closable: {
|
|
7
3
|
type: import("vue").PropType<boolean | undefined>;
|
|
8
4
|
required: false;
|
|
@@ -31,6 +27,10 @@ export declare const VftTabs: import("vft/es/utils").SFCWithInstall<import("vue"
|
|
|
31
27
|
type: import("vue").PropType<boolean | undefined>;
|
|
32
28
|
required: false;
|
|
33
29
|
};
|
|
30
|
+
showBar: {
|
|
31
|
+
type: import("vue").PropType<boolean | undefined>;
|
|
32
|
+
required: false;
|
|
33
|
+
};
|
|
34
34
|
closeIconCfg: {
|
|
35
35
|
type: import("vue").PropType<import("..").IconProps | undefined>;
|
|
36
36
|
required: false;
|
|
@@ -92,10 +92,6 @@ export declare const VftTabs: import("vft/es/utils").SFCWithInstall<import("vue"
|
|
|
92
92
|
tabRemove: (name: string | number) => boolean;
|
|
93
93
|
tabAdd: () => true;
|
|
94
94
|
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
95
|
-
type: {
|
|
96
|
-
type: import("vue").PropType<import("./types").TabsType | undefined>;
|
|
97
|
-
required: false;
|
|
98
|
-
};
|
|
99
95
|
closable: {
|
|
100
96
|
type: import("vue").PropType<boolean | undefined>;
|
|
101
97
|
required: false;
|
|
@@ -124,6 +120,10 @@ export declare const VftTabs: import("vft/es/utils").SFCWithInstall<import("vue"
|
|
|
124
120
|
type: import("vue").PropType<boolean | undefined>;
|
|
125
121
|
required: false;
|
|
126
122
|
};
|
|
123
|
+
showBar: {
|
|
124
|
+
type: import("vue").PropType<boolean | undefined>;
|
|
125
|
+
required: false;
|
|
126
|
+
};
|
|
127
127
|
closeIconCfg: {
|
|
128
128
|
type: import("vue").PropType<import("..").IconProps | undefined>;
|
|
129
129
|
required: false;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { PropType as __PropType } from 'vue';
|
|
2
2
|
import { type IconProps } from 'vft/es/components';
|
|
3
|
-
import type { TabsType } from './types';
|
|
4
3
|
declare const _sfc_main: import("vue").DefineComponent<{
|
|
5
4
|
panes: {
|
|
6
5
|
type: __PropType<{
|
|
@@ -31,11 +30,11 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
31
30
|
type: __PropType<boolean | undefined>;
|
|
32
31
|
required: false;
|
|
33
32
|
};
|
|
34
|
-
|
|
35
|
-
type: __PropType<
|
|
33
|
+
stretch: {
|
|
34
|
+
type: __PropType<boolean | undefined>;
|
|
36
35
|
required: false;
|
|
37
36
|
};
|
|
38
|
-
|
|
37
|
+
showBar: {
|
|
39
38
|
type: __PropType<boolean | undefined>;
|
|
40
39
|
required: false;
|
|
41
40
|
};
|
|
@@ -88,11 +87,11 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
88
87
|
type: __PropType<boolean | undefined>;
|
|
89
88
|
required: false;
|
|
90
89
|
};
|
|
91
|
-
|
|
92
|
-
type: __PropType<
|
|
90
|
+
stretch: {
|
|
91
|
+
type: __PropType<boolean | undefined>;
|
|
93
92
|
required: false;
|
|
94
93
|
};
|
|
95
|
-
|
|
94
|
+
showBar: {
|
|
96
95
|
type: __PropType<boolean | undefined>;
|
|
97
96
|
required: false;
|
|
98
97
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { defineComponent as E, getCurrentInstance as Z, inject as _, ref as g, computed as I, watch as O, onMounted as tt, onUpdated as ot, createVNode as s, nextTick as et } from "vue";
|
|
2
|
-
import { capitalize as
|
|
2
|
+
import { capitalize as $ } from "@vft/utils";
|
|
3
3
|
import { throwError as it } from "../../utils/error.js";
|
|
4
4
|
import "lodash";
|
|
5
5
|
import { useDocumentVisibility as nt, useWindowFocus as lt, useResizeObserver as at } from "@vueuse/core";
|
|
6
6
|
import "../../utils/ns-cover.js";
|
|
7
7
|
import "../divider/index.js";
|
|
8
|
-
import { VftIcon as
|
|
8
|
+
import { VftIcon as B } from "../icon/index.js";
|
|
9
9
|
import "../avatar/index.js";
|
|
10
10
|
import "../empty/index.js";
|
|
11
11
|
import "../result/index.js";
|
|
@@ -15,10 +15,11 @@ import "../collapse-transition/index.js";
|
|
|
15
15
|
import "../tooltip/index.js";
|
|
16
16
|
import "../popover/index.js";
|
|
17
17
|
import "../menu/index.js";
|
|
18
|
-
import "
|
|
18
|
+
import "../context-menu/context-menu.vue2.js";
|
|
19
19
|
import "../multiple-tabs/multiple-tabs.vue2.js";
|
|
20
20
|
import "@vft/router";
|
|
21
21
|
import "@vft/store";
|
|
22
|
+
import "@vft/use";
|
|
22
23
|
import "vue-router";
|
|
23
24
|
import "../header-layout/index.js";
|
|
24
25
|
import "../footer-layout/index.js";
|
|
@@ -72,7 +73,7 @@ import "@popperjs/core";
|
|
|
72
73
|
import "../../hooks/use-z-index/index.js";
|
|
73
74
|
import "@vue/reactivity";
|
|
74
75
|
import "@vue/shared";
|
|
75
|
-
import { EVENT_CODE as
|
|
76
|
+
import { EVENT_CODE as T } from "@vft/constants";
|
|
76
77
|
import { TabsRootContextKey as rt } from "./types.js";
|
|
77
78
|
import st from "./tab-bar.vue2.js";
|
|
78
79
|
const V = (
|
|
@@ -80,7 +81,7 @@ const V = (
|
|
|
80
81
|
K("tab-nav")
|
|
81
82
|
), ct = E({
|
|
82
83
|
name: V.b()
|
|
83
|
-
}),
|
|
84
|
+
}), Fo = /* @__PURE__ */ E({
|
|
84
85
|
...ct,
|
|
85
86
|
props: {
|
|
86
87
|
panes: null,
|
|
@@ -90,10 +91,13 @@ const V = (
|
|
|
90
91
|
addable: {
|
|
91
92
|
type: Boolean
|
|
92
93
|
},
|
|
93
|
-
type: null,
|
|
94
94
|
stretch: {
|
|
95
95
|
type: Boolean
|
|
96
96
|
},
|
|
97
|
+
showBar: {
|
|
98
|
+
type: Boolean,
|
|
99
|
+
default: !1
|
|
100
|
+
},
|
|
97
101
|
closeIconCfg: null,
|
|
98
102
|
addIconCfg: null,
|
|
99
103
|
arrowLeftIconCfg: null,
|
|
@@ -102,38 +106,38 @@ const V = (
|
|
|
102
106
|
emits: ["tabClick", "tabRemove", "tabAdd", "tabContextmenu"],
|
|
103
107
|
setup(n, {
|
|
104
108
|
expose: D,
|
|
105
|
-
emit:
|
|
109
|
+
emit: h
|
|
106
110
|
}) {
|
|
107
111
|
var A;
|
|
108
112
|
const M = Z(), d = _(rt);
|
|
109
113
|
d || it(V.b(), "<vft-tabs><tab-nav /></vft-tabs>");
|
|
110
|
-
const e = K("tabs"), q = nt(), H = lt(),
|
|
114
|
+
const e = K("tabs"), q = nt(), H = lt(), y = g(), v = g(), C = g(), m = g(!1), f = g(0), k = g(!1), x = g(!0), w = I(() => ["top", "bottom"].includes(d.props.tabPosition) ? "width" : "height"), W = I(() => ({
|
|
111
115
|
transform: `translate${w.value === "width" ? "X" : "Y"}(-${f.value}px)`
|
|
112
116
|
})), j = () => {
|
|
113
117
|
if (!v.value)
|
|
114
118
|
return;
|
|
115
|
-
const o = v.value[`offset${
|
|
119
|
+
const o = v.value[`offset${$(w.value)}`], t = f.value;
|
|
116
120
|
t && (f.value = t > o ? t - o : 0);
|
|
117
121
|
}, U = () => {
|
|
118
|
-
if (!v.value || !
|
|
122
|
+
if (!v.value || !C.value)
|
|
119
123
|
return;
|
|
120
|
-
const o =
|
|
124
|
+
const o = C.value[`offset${$(w.value)}`], t = v.value[`offset${$(w.value)}`], i = f.value;
|
|
121
125
|
o - i <= t || (f.value = o - i > t * 2 ? i + t : o - t);
|
|
122
126
|
}, R = async () => {
|
|
123
|
-
const o =
|
|
124
|
-
if (!m.value ||
|
|
127
|
+
const o = C.value;
|
|
128
|
+
if (!m.value || !y.value || !v.value || !o)
|
|
125
129
|
return;
|
|
126
130
|
await et();
|
|
127
|
-
const t =
|
|
131
|
+
const t = y.value.querySelector(".is-active");
|
|
128
132
|
if (!t)
|
|
129
133
|
return;
|
|
130
134
|
const i = v.value, b = ["top", "bottom"].includes(d.props.tabPosition), r = t.getBoundingClientRect(), l = i.getBoundingClientRect(), u = b ? o.offsetWidth - l.width : o.offsetHeight - l.height, c = f.value;
|
|
131
135
|
let a = c;
|
|
132
136
|
b ? (r.left < l.left && (a = c - (l.left - r.left)), r.right > l.right && (a = c + r.right - l.right)) : (r.top < l.top && (a = c - (l.top - r.top)), r.bottom > l.bottom && (a = c + (r.bottom - l.bottom))), a = Math.max(a, 0), f.value = Math.min(a, u);
|
|
133
137
|
}, z = () => {
|
|
134
|
-
if (!
|
|
138
|
+
if (!C.value || !v.value)
|
|
135
139
|
return;
|
|
136
|
-
const o =
|
|
140
|
+
const o = C.value[`offset${$(w.value)}`], t = v.value[`offset${$(w.value)}`], i = f.value;
|
|
137
141
|
t < o ? (m.value = m.value || {}, m.value.prev = i, m.value.next = i + t < o, o - i < t && (f.value = o - t)) : (m.value = !1, i > 0 && (f.value = 0));
|
|
138
142
|
}, X = (o) => {
|
|
139
143
|
const t = o.code, {
|
|
@@ -141,22 +145,22 @@ const V = (
|
|
|
141
145
|
down: b,
|
|
142
146
|
left: r,
|
|
143
147
|
right: l
|
|
144
|
-
} =
|
|
148
|
+
} = T;
|
|
145
149
|
if (![i, b, r, l].includes(t))
|
|
146
150
|
return;
|
|
147
151
|
const u = Array.from(o.currentTarget.querySelectorAll("[role=tab]:not(.is-disabled)")), c = u.indexOf(o.target);
|
|
148
152
|
let a;
|
|
149
153
|
t === r || t === i ? c === 0 ? a = u.length - 1 : a = c - 1 : c < u.length - 1 ? a = c + 1 : a = 0, u[a].focus(), u[a].click(), P();
|
|
150
154
|
}, P = () => {
|
|
151
|
-
x.value && (
|
|
152
|
-
},
|
|
155
|
+
x.value && (k.value = !0);
|
|
156
|
+
}, S = () => k.value = !1;
|
|
153
157
|
O(q, (o) => {
|
|
154
158
|
o === "hidden" ? x.value = !1 : o === "visible" && setTimeout(() => x.value = !0, 50);
|
|
155
159
|
}), O(H, (o) => {
|
|
156
160
|
o ? setTimeout(() => x.value = !0, 50) : x.value = !1;
|
|
157
|
-
}), at(
|
|
161
|
+
}), at(y, z), tt(() => setTimeout(() => R(), 0)), ot(() => z()), D({
|
|
158
162
|
scrollToActiveTab: R,
|
|
159
|
-
removeFocus:
|
|
163
|
+
removeFocus: S
|
|
160
164
|
}), O(() => n.panes, () => M.update(), {
|
|
161
165
|
flush: "post"
|
|
162
166
|
});
|
|
@@ -165,10 +169,10 @@ const V = (
|
|
|
165
169
|
return m.value ? [s("span", {
|
|
166
170
|
class: [e.e("nav-prev"), e.is("disabled", !m.value.prev)],
|
|
167
171
|
onClick: j
|
|
168
|
-
}, [(o = n.arrowLeftIconCfg) != null && o.icon ? s(
|
|
172
|
+
}, [(o = n.arrowLeftIconCfg) != null && o.icon ? s(B, n.arrowLeftIconCfg, null) : null]), s("span", {
|
|
169
173
|
class: [e.e("nav-next"), e.is("disabled", !m.value.next)],
|
|
170
174
|
onClick: U
|
|
171
|
-
}, [(t = n.arrowRightIconCfg) != null && t.icon ? s(
|
|
175
|
+
}, [(t = n.arrowRightIconCfg) != null && t.icon ? s(B, n.arrowRightIconCfg, null) : null])] : null;
|
|
172
176
|
}), G = I(() => {
|
|
173
177
|
var o;
|
|
174
178
|
return (o = n.panes) == null ? void 0 : o.map((t, i) => {
|
|
@@ -177,11 +181,11 @@ const V = (
|
|
|
177
181
|
t.index = `${i}`;
|
|
178
182
|
const c = u ? s("span", {
|
|
179
183
|
class: "is-icon-close",
|
|
180
|
-
onClick: (p) =>
|
|
181
|
-
}, [(N = n.closeIconCfg) != null && N.icon ? s(
|
|
184
|
+
onClick: (p) => h("tabRemove", t, p)
|
|
185
|
+
}, [(N = n.closeIconCfg) != null && N.icon ? s(B, n.closeIconCfg, null) : null]) : null, a = ((L = (F = t.slots).label) == null ? void 0 : L.call(F)) || t.props.label, Q = !r && t.active ? 0 : -1;
|
|
182
186
|
return s("div", {
|
|
183
187
|
ref: `tab-${b}`,
|
|
184
|
-
class: [e.e("item"), e.is(d.props.tabPosition), e.is("active", t.active), e.is("disabled", r), e.is("closable", u), e.is("focus",
|
|
188
|
+
class: [e.e("item"), e.is(d.props.tabPosition), e.is("active", t.active), e.is("disabled", r), e.is("closable", u), e.is("focus", k.value)],
|
|
185
189
|
id: `tab-${l}`,
|
|
186
190
|
key: `tab-${b}`,
|
|
187
191
|
"aria-controls": `pane-${l}`,
|
|
@@ -189,47 +193,47 @@ const V = (
|
|
|
189
193
|
"aria-selected": t.active,
|
|
190
194
|
tabindex: Q,
|
|
191
195
|
onFocus: () => P(),
|
|
192
|
-
onBlur: () =>
|
|
196
|
+
onBlur: () => S(),
|
|
193
197
|
onClick: (p) => {
|
|
194
|
-
|
|
198
|
+
S(), h("tabClick", t, l, p);
|
|
195
199
|
},
|
|
196
200
|
onContextmenu: (p) => {
|
|
197
|
-
p.preventDefault(),
|
|
201
|
+
p.preventDefault(), h("tabContextmenu", {
|
|
198
202
|
pane: t,
|
|
199
203
|
index: i,
|
|
200
204
|
event: p
|
|
201
205
|
});
|
|
202
206
|
},
|
|
203
207
|
onKeydown: (p) => {
|
|
204
|
-
u && (p.code ===
|
|
208
|
+
u && (p.code === T.delete || p.code === T.backspace) && h("tabRemove", t, p);
|
|
205
209
|
}
|
|
206
210
|
}, [a, c]);
|
|
207
211
|
});
|
|
208
212
|
}), J = n.editable || n.addable ? s("span", {
|
|
209
213
|
class: e.e("new-tab"),
|
|
210
214
|
tabindex: "0",
|
|
211
|
-
onClick: () =>
|
|
215
|
+
onClick: () => h("tabAdd"),
|
|
212
216
|
onKeydown: (o) => {
|
|
213
|
-
o.code ===
|
|
217
|
+
o.code === T.enter && h("tabAdd");
|
|
214
218
|
}
|
|
215
|
-
}, [(A = n.addIconCfg) != null && A.icon ? s(
|
|
219
|
+
}, [(A = n.addIconCfg) != null && A.icon ? s(B, n.addIconCfg, null) : null]) : null;
|
|
216
220
|
return () => s("div", {
|
|
217
|
-
ref:
|
|
221
|
+
ref: y,
|
|
218
222
|
class: [e.e("nav-wrap"), e.is("scrollable", !!m.value), e.is(d.props.tabPosition)]
|
|
219
223
|
}, [Y.value, s("div", {
|
|
220
224
|
class: e.e("nav-scroll"),
|
|
221
225
|
ref: v
|
|
222
226
|
}, [s("div", {
|
|
223
227
|
class: [e.e("nav"), e.is(d.props.tabPosition), e.is("stretch", n.stretch && ["top", "bottom"].includes(d.props.tabPosition))],
|
|
224
|
-
ref:
|
|
228
|
+
ref: C,
|
|
225
229
|
style: W.value,
|
|
226
230
|
role: "tablist",
|
|
227
231
|
onKeydown: X
|
|
228
|
-
}, [n.
|
|
232
|
+
}, [n.showBar ? s(st, {
|
|
229
233
|
tabs: [...n.panes]
|
|
230
|
-
}, null), G.value]), J])]);
|
|
234
|
+
}, null) : null, G.value]), J])]);
|
|
231
235
|
}
|
|
232
236
|
});
|
|
233
237
|
export {
|
|
234
|
-
|
|
238
|
+
Fo as default
|
|
235
239
|
};
|