ep-craft 0.1.22 → 0.1.23
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/components/affix/affix.d.ts +19 -19
- package/dist/components/affix/affix.js +61 -53
- package/dist/components/alert/alert.d.ts +71 -17
- package/dist/components/alert/alert.js +99 -43
- package/dist/components/anchor/anchor.d.ts +19 -19
- package/dist/components/anchor/anchor.js +166 -102
- package/dist/components/anchor/constants.d.ts +15 -0
- package/dist/components/anchor/constants.js +4 -0
- package/dist/components/anchor-link/anchor-link.d.ts +1 -1
- package/dist/components/anchor-link/anchor-link.js +39 -26
- package/dist/components/button/EpButton.vue.d.ts +8 -8
- package/dist/components/button/EpButton.vue.js +5 -5
- package/dist/components/button/constants.d.ts +7 -0
- package/dist/components/button/constants.js +6 -0
- package/dist/components/check-tag/EpCheckTag.vue.d.ts +1 -1
- package/dist/components/collapse-transition/index.js +2 -2
- package/dist/components/config-provider/src/constants.js +4 -0
- package/dist/components/config-provider/src/hooks/use-global-config.d.ts +1 -1
- package/dist/components/config-provider/src/hooks/use-global-config.js +24 -0
- package/dist/components/form/src/constants.js +2 -1
- package/dist/components/form/src/hooks/use-form-common-props.d.ts +2 -2
- package/dist/components/form/src/hooks/use-form-common-props.js +17 -0
- package/dist/components/form/src/hooks/use-form-item.js +51 -0
- package/dist/components/icon/index.js +5 -5
- package/dist/components/menu/menu-collapse-transition.vue.js +10 -6
- package/dist/components/menu/menu.d.ts +47 -47
- package/dist/components/menu/menu.js +59 -52
- package/dist/components/menu/use-menu-color.d.ts +2 -0
- package/dist/components/menu/use-menu-color.js +11 -0
- package/dist/components/menu/use-menu-css-var.d.ts +2 -0
- package/dist/components/menu/use-menu-css-var.js +30 -0
- package/dist/components/menu/utils/menu-bar.d.ts +7 -0
- package/dist/components/menu/utils/menu-bar.js +15 -0
- package/dist/components/menu/utils/menu-item.d.ts +9 -0
- package/dist/components/menu/utils/menu-item.js +50 -0
- package/dist/components/menu/utils/submenu.d.ts +11 -0
- package/dist/components/menu/utils/submenu.js +49 -0
- package/dist/components/menu-item/EpMenuItem.vue.js +17 -13
- package/dist/components/menu-item-group/EpMenuItemGroup.vue.js +1 -1
- package/dist/components/popper/src/composables/use-content.d.ts +6 -6
- package/dist/components/popper/src/content.vue.d.ts +6 -6
- package/dist/components/popper/src/popper.d.ts +2 -2
- package/dist/components/radio/constants.d.ts +64 -0
- package/dist/components/radio/constants.js +4 -0
- package/dist/components/radio/radio.d.ts +98 -19
- package/dist/components/radio/radio.js +101 -43
- package/dist/components/radio/use-radio.d.ts +13 -0
- package/dist/components/radio/use-radio.js +43 -0
- package/dist/components/radio-button/radio-button.d.ts +46 -16
- package/dist/components/radio-button/radio-button.js +37 -29
- package/dist/components/radio-group/radio-group.d.ts +142 -28
- package/dist/components/radio-group/radio-group.js +136 -55
- package/dist/components/sub-menu/sub-menu.d.ts +19 -19
- package/dist/components/sub-menu/sub-menu.js +65 -58
- package/dist/components/tab-pane/tab-pane.d.ts +45 -8
- package/dist/components/tab-pane/tab-pane.js +66 -32
- package/dist/components/tabs/composables/use-tab-nav-touch.d.ts +19 -0
- package/dist/components/tabs/composables/use-tab-nav-touch.js +58 -0
- package/dist/components/tabs/constants.d.ts +63 -0
- package/dist/components/tabs/constants.js +4 -0
- package/dist/components/tabs/tab-bar.d.ts +97 -0
- package/dist/components/tabs/tab-bar.vue.d.ts +14 -0
- package/dist/components/tabs/tab-bar.vue.js +80 -0
- package/dist/components/tabs/tab-bar2.vue.js +4 -0
- package/dist/components/tabs/tab-nav.d.ts +295 -0
- package/dist/components/tabs/tab-nav.js +297 -0
- package/dist/components/tabs/tabs.d.ts +71 -28
- package/dist/components/tabs/tabs.js +165 -93
- package/dist/components/tag/EpTag.vue.d.ts +3 -3
- package/dist/components/tag/EpTag.vue.js +3 -3
- package/dist/components/tooltip/index.d.ts +34 -34
- package/dist/components/tooltip/index.js +12 -12
- package/dist/components/tooltip/src/content.vue.d.ts +8 -8
- package/dist/components/tooltip/src/tooltip.d.ts +2 -2
- package/dist/components/tooltip/src/tooltip.vue.d.ts +12 -12
- package/dist/components/tooltip/src/trigger.d.ts +1 -1
- package/dist/constants/event.js +5 -0
- package/dist/directives/click-outside/index.js +49 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/use-deprecated/index.js +25 -0
- package/dist/hooks/use-locale/index.js +24 -0
- package/dist/hooks/use-ordered-children/index.js +53 -0
- package/dist/hooks/use-popper/index.d.ts +6 -6
- package/dist/hooks/use-prop/index.js +11 -0
- package/dist/hooks/use-size/index.d.ts +3 -3
- package/dist/hooks/use-size/index.js +14 -6
- package/dist/hooks/use-wheel/defaults.d.ts +27 -0
- package/dist/hooks/use-wheel/defaults.js +4 -0
- package/dist/hooks/use-wheel/index.d.ts +13 -0
- package/dist/hooks/use-wheel/index.js +26 -0
- package/dist/utils/browser.js +6 -5
- package/dist/utils/dom/aria.js +13 -6
- package/dist/utils/dom/element.js +16 -0
- package/dist/utils/dom/position.js +18 -0
- package/dist/utils/dom/scroll.js +50 -0
- package/dist/utils/dom/style.js +40 -13
- package/dist/utils/easings.js +7 -0
- package/dist/utils/error.js +11 -7
- package/dist/utils/numbers.js +6 -0
- package/dist/utils/objects.js +7 -0
- package/dist/utils/raf.js +6 -0
- package/dist/utils/strings.js +8 -0
- package/dist/utils/throttleByRaf.js +15 -0
- package/dist/utils/types.js +19 -16
- package/dist/utils/typescript.js +4 -0
- package/dist/utils/vue/icon.js +20 -0
- package/dist/utils/vue/vnode.d.ts +4 -4
- package/dist/utils/vue/vnode.js +17 -0
- package/dist/vendored-components.d.ts +6 -3
- package/dist/vendored-components.js +11 -5
- package/package.json +1 -1
|
@@ -1,17 +1,24 @@
|
|
|
1
|
-
import { defineComponent as X, getCurrentInstance as ee, computed as
|
|
2
|
-
import { ElCollapseTransition as ie } from "
|
|
3
|
-
import { ElTooltip as ce } from "
|
|
4
|
-
import { ElIcon as de } from "
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
1
|
+
import { defineComponent as X, getCurrentInstance as ee, computed as n, inject as A, ref as f, reactive as oe, watch as te, provide as ne, onMounted as le, onBeforeUnmount as ae, h as u, Fragment as ue, withDirectives as re, vShow as se, nextTick as pe } from "vue";
|
|
2
|
+
import { ElCollapseTransition as ie } from "../collapse-transition/index.js";
|
|
3
|
+
import { ElTooltip as ce } from "../tooltip/index.js";
|
|
4
|
+
import { ElIcon as de } from "../icon/index.js";
|
|
5
|
+
import { isUndefined as me } from "../../utils/types.js";
|
|
6
|
+
import "lodash-unified";
|
|
7
|
+
import "@vueuse/core";
|
|
8
|
+
import { throwError as F } from "../../utils/error.js";
|
|
9
|
+
import { isString as ve } from "@vue/shared";
|
|
10
|
+
import { focusElement as fe } from "../../utils/dom/aria.js";
|
|
11
|
+
import { iconPropType as I } from "../../utils/vue/icon.js";
|
|
12
|
+
import { buildProps as be, definePropType as he } from "../../utils/vue/props/runtime.js";
|
|
13
|
+
import { useNamespace as U } from "../../hooks/use-namespace/index.js";
|
|
7
14
|
import { ArrowDown as Me, ArrowRight as Ce } from "@element-plus/icons-vue";
|
|
8
15
|
import Ie from "../menu/use-menu.js";
|
|
9
|
-
import { useMenuCssVar as Te } from "
|
|
16
|
+
import { useMenuCssVar as Te } from "../menu/use-menu-css-var.js";
|
|
10
17
|
import { MENU_INJECTION_KEY as xe, SUB_MENU_INJECTION_KEY as R } from "../menu/tokens.js";
|
|
11
|
-
const D = (o,
|
|
12
|
-
const T = setTimeout(o,
|
|
18
|
+
const D = (o, r) => {
|
|
19
|
+
const T = setTimeout(o, r);
|
|
13
20
|
return { stop: () => clearTimeout(T) };
|
|
14
|
-
}, ge =
|
|
21
|
+
}, ge = be({
|
|
15
22
|
/** unique identification */
|
|
16
23
|
index: {
|
|
17
24
|
type: String,
|
|
@@ -25,7 +32,7 @@ const D = (o, s) => {
|
|
|
25
32
|
popperClass: String,
|
|
26
33
|
/** custom style for the popup menu */
|
|
27
34
|
popperStyle: {
|
|
28
|
-
type:
|
|
35
|
+
type: he([String, Object])
|
|
29
36
|
},
|
|
30
37
|
/** whether the sub-menu is disabled */
|
|
31
38
|
disabled: Boolean,
|
|
@@ -52,13 +59,13 @@ const D = (o, s) => {
|
|
|
52
59
|
collapseOpenIcon: {
|
|
53
60
|
type: I
|
|
54
61
|
}
|
|
55
|
-
}), P = "EpSubMenu",
|
|
62
|
+
}), P = "EpSubMenu", De = X({
|
|
56
63
|
name: P,
|
|
57
64
|
props: ge,
|
|
58
|
-
setup(o, { slots:
|
|
65
|
+
setup(o, { slots: r, expose: T }) {
|
|
59
66
|
const x = ee(), { indexPath: b, parentMenu: N } = Ie(
|
|
60
67
|
x,
|
|
61
|
-
|
|
68
|
+
n(() => o.index)
|
|
62
69
|
), p = U("menu"), d = U("sub-menu"), e = A(xe);
|
|
63
70
|
e || F(P, "can not inject root menu");
|
|
64
71
|
const l = A(
|
|
@@ -67,14 +74,14 @@ const D = (o, s) => {
|
|
|
67
74
|
l || F(P, "can not inject sub menu");
|
|
68
75
|
const H = f({}), g = f({});
|
|
69
76
|
let i;
|
|
70
|
-
const k = f(!1), J = f(), z = f(), h =
|
|
77
|
+
const k = f(!1), J = f(), z = f(), h = n(() => l.level === 0), _ = n(
|
|
71
78
|
() => m.value === "horizontal" && h.value ? "bottom-start" : "right-start"
|
|
72
|
-
), S =
|
|
73
|
-
const
|
|
74
|
-
return
|
|
75
|
-
}), K =
|
|
79
|
+
), S = n(() => m.value === "horizontal" && h.value || m.value === "vertical" && !e.props.collapse ? o.expandCloseIcon && o.expandOpenIcon ? c.value ? o.expandOpenIcon : o.expandCloseIcon : Me : o.collapseCloseIcon && o.collapseOpenIcon ? c.value ? o.collapseOpenIcon : o.collapseCloseIcon : Ce), y = n(() => {
|
|
80
|
+
const t = o.teleported;
|
|
81
|
+
return me(t) ? h.value : t;
|
|
82
|
+
}), K = n(
|
|
76
83
|
() => e.props.collapse ? `${p.namespace.value}-zoom-in-left` : `${p.namespace.value}-zoom-in-top`
|
|
77
|
-
), Y =
|
|
84
|
+
), Y = n(
|
|
78
85
|
() => m.value === "horizontal" && h.value ? [
|
|
79
86
|
"bottom-start",
|
|
80
87
|
"bottom-end",
|
|
@@ -92,50 +99,50 @@ const D = (o, s) => {
|
|
|
92
99
|
"top-start",
|
|
93
100
|
"top-end"
|
|
94
101
|
]
|
|
95
|
-
), c =
|
|
102
|
+
), c = n(() => e.openedMenus.includes(o.index)), E = n(
|
|
96
103
|
() => [...Object.values(H.value), ...Object.values(g.value)].some(
|
|
97
|
-
({ active:
|
|
104
|
+
({ active: t }) => t
|
|
98
105
|
)
|
|
99
|
-
), m =
|
|
106
|
+
), m = n(() => e.props.mode), q = n(() => e.props.persistent), M = oe({
|
|
100
107
|
index: o.index,
|
|
101
108
|
indexPath: b,
|
|
102
109
|
active: E
|
|
103
|
-
}), $ = Te(e.props, l.level + 1), L =
|
|
110
|
+
}), $ = Te(e.props, l.level + 1), L = n(
|
|
104
111
|
() => o.popperOffset ?? e.props.popperOffset
|
|
105
|
-
), j =
|
|
112
|
+
), j = n(
|
|
106
113
|
() => o.popperClass ?? e.props.popperClass
|
|
107
|
-
), V =
|
|
114
|
+
), V = n(
|
|
108
115
|
() => o.popperStyle ?? e.props.popperStyle
|
|
109
|
-
), Z =
|
|
116
|
+
), Z = n(
|
|
110
117
|
() => o.showTimeout ?? e.props.showTimeout
|
|
111
|
-
), G =
|
|
118
|
+
), G = n(
|
|
112
119
|
() => o.hideTimeout ?? e.props.hideTimeout
|
|
113
120
|
), Q = () => {
|
|
114
|
-
var
|
|
115
|
-
return (a = (
|
|
116
|
-
}, W = (
|
|
117
|
-
|
|
121
|
+
var t, s, a;
|
|
122
|
+
return (a = (s = (t = z.value) == null ? void 0 : t.popperRef) == null ? void 0 : s.popperInstanceRef) == null ? void 0 : a.destroy();
|
|
123
|
+
}, W = (t) => {
|
|
124
|
+
t || Q();
|
|
118
125
|
}, B = () => {
|
|
119
126
|
e.props.menuTrigger === "hover" && e.props.mode === "horizontal" || e.props.collapse && e.props.mode === "vertical" || o.disabled || e.handleSubMenuClick({
|
|
120
127
|
index: o.index,
|
|
121
128
|
indexPath: b.value,
|
|
122
129
|
active: E.value
|
|
123
130
|
});
|
|
124
|
-
}, C = (
|
|
131
|
+
}, C = (t, s = Z.value) => {
|
|
125
132
|
var a;
|
|
126
|
-
if (
|
|
133
|
+
if (t.type !== "focus") {
|
|
127
134
|
if (e.props.menuTrigger === "click" && e.props.mode === "horizontal" || !e.props.collapse && e.props.mode === "vertical" || o.disabled) {
|
|
128
135
|
l.mouseInChild.value = !0;
|
|
129
136
|
return;
|
|
130
137
|
}
|
|
131
138
|
l.mouseInChild.value = !0, i == null || i(), { stop: i } = D(() => {
|
|
132
139
|
e.openMenu(o.index, b.value);
|
|
133
|
-
},
|
|
134
|
-
|
|
140
|
+
}, s), y.value && ((a = N.value.vnode.el) == null || a.dispatchEvent(new MouseEvent("mouseenter"))), t.type === "mouseenter" && t.target && pe(() => {
|
|
141
|
+
fe(t.target, { preventScroll: !0 });
|
|
135
142
|
});
|
|
136
143
|
}
|
|
137
|
-
}, O = (
|
|
138
|
-
var
|
|
144
|
+
}, O = (t = !1) => {
|
|
145
|
+
var s;
|
|
139
146
|
if (e.props.menuTrigger === "click" && e.props.mode === "horizontal" || !e.props.collapse && e.props.mode === "vertical") {
|
|
140
147
|
l.mouseInChild.value = !1;
|
|
141
148
|
return;
|
|
@@ -143,21 +150,21 @@ const D = (o, s) => {
|
|
|
143
150
|
i == null || i(), l.mouseInChild.value = !1, { stop: i } = D(
|
|
144
151
|
() => !k.value && e.closeMenu(o.index, b.value),
|
|
145
152
|
G.value
|
|
146
|
-
), y.value &&
|
|
153
|
+
), y.value && t && ((s = l.handleMouseleave) == null || s.call(l, !0));
|
|
147
154
|
};
|
|
148
|
-
|
|
155
|
+
te(
|
|
149
156
|
() => e.props.collapse,
|
|
150
|
-
(
|
|
157
|
+
(t) => W(!!t)
|
|
151
158
|
);
|
|
152
159
|
{
|
|
153
|
-
const
|
|
160
|
+
const t = (a) => {
|
|
154
161
|
g.value[a.index] = a;
|
|
155
|
-
},
|
|
162
|
+
}, s = (a) => {
|
|
156
163
|
delete g.value[a.index];
|
|
157
164
|
};
|
|
158
|
-
|
|
159
|
-
addSubMenu:
|
|
160
|
-
removeSubMenu:
|
|
165
|
+
ne(`${R}${x.uid}`, {
|
|
166
|
+
addSubMenu: t,
|
|
167
|
+
removeSubMenu: s,
|
|
161
168
|
handleMouseleave: O,
|
|
162
169
|
mouseInChild: k,
|
|
163
170
|
level: l.level + 1
|
|
@@ -171,8 +178,8 @@ const D = (o, s) => {
|
|
|
171
178
|
l.removeSubMenu(M), e.removeSubMenu(M);
|
|
172
179
|
}), () => {
|
|
173
180
|
var a;
|
|
174
|
-
const
|
|
175
|
-
(a =
|
|
181
|
+
const t = [
|
|
182
|
+
(a = r.title) == null ? void 0 : a.call(r),
|
|
176
183
|
u(
|
|
177
184
|
de,
|
|
178
185
|
{
|
|
@@ -182,10 +189,10 @@ const D = (o, s) => {
|
|
|
182
189
|
}
|
|
183
190
|
},
|
|
184
191
|
{
|
|
185
|
-
default: () =>
|
|
192
|
+
default: () => ve(S.value) ? u(x.appContext.components[S.value]) : u(S.value)
|
|
186
193
|
}
|
|
187
194
|
)
|
|
188
|
-
],
|
|
195
|
+
], s = e.isMenuPopup ? u(
|
|
189
196
|
ce,
|
|
190
197
|
{
|
|
191
198
|
ref: z,
|
|
@@ -229,7 +236,7 @@ const D = (o, s) => {
|
|
|
229
236
|
],
|
|
230
237
|
style: $.value
|
|
231
238
|
},
|
|
232
|
-
[(v =
|
|
239
|
+
[(v = r.default) == null ? void 0 : v.call(r)]
|
|
233
240
|
)
|
|
234
241
|
]
|
|
235
242
|
);
|
|
@@ -240,7 +247,7 @@ const D = (o, s) => {
|
|
|
240
247
|
class: d.e("title"),
|
|
241
248
|
onClick: B
|
|
242
249
|
},
|
|
243
|
-
|
|
250
|
+
t
|
|
244
251
|
)
|
|
245
252
|
}
|
|
246
253
|
) : u(ue, {}, [
|
|
@@ -251,7 +258,7 @@ const D = (o, s) => {
|
|
|
251
258
|
ref: J,
|
|
252
259
|
onClick: B
|
|
253
260
|
},
|
|
254
|
-
|
|
261
|
+
t
|
|
255
262
|
),
|
|
256
263
|
u(
|
|
257
264
|
ie,
|
|
@@ -259,7 +266,7 @@ const D = (o, s) => {
|
|
|
259
266
|
{
|
|
260
267
|
default: () => {
|
|
261
268
|
var v;
|
|
262
|
-
return
|
|
269
|
+
return re(
|
|
263
270
|
u(
|
|
264
271
|
"ul",
|
|
265
272
|
{
|
|
@@ -267,9 +274,9 @@ const D = (o, s) => {
|
|
|
267
274
|
class: [p.b(), p.m("inline")],
|
|
268
275
|
style: $.value
|
|
269
276
|
},
|
|
270
|
-
[(v =
|
|
277
|
+
[(v = r.default) == null ? void 0 : v.call(r)]
|
|
271
278
|
),
|
|
272
|
-
[[
|
|
279
|
+
[[se, c.value]]
|
|
273
280
|
);
|
|
274
281
|
}
|
|
275
282
|
}
|
|
@@ -291,12 +298,12 @@ const D = (o, s) => {
|
|
|
291
298
|
onMouseleave: () => O(),
|
|
292
299
|
onFocus: C
|
|
293
300
|
},
|
|
294
|
-
[
|
|
301
|
+
[s]
|
|
295
302
|
);
|
|
296
303
|
};
|
|
297
304
|
}
|
|
298
305
|
});
|
|
299
306
|
export {
|
|
300
|
-
|
|
307
|
+
De as default,
|
|
301
308
|
ge as subMenuProps
|
|
302
309
|
};
|
|
@@ -1,31 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated Removed after 3.0.0, Use `TabPaneProps` instead.
|
|
3
|
+
*/
|
|
4
|
+
export declare const tabPaneProps: {
|
|
5
|
+
readonly label: import("@element-plus/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
|
|
6
|
+
readonly name: {
|
|
7
|
+
readonly type: import("vue").PropType<import("@element-plus/utils").EpPropMergeType<readonly [StringConstructor, NumberConstructor], unknown, unknown>>;
|
|
8
|
+
readonly required: false;
|
|
9
|
+
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
10
|
+
__epPropKey: true;
|
|
11
|
+
};
|
|
12
|
+
readonly closable: import("@element-plus/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, undefined, boolean>;
|
|
13
|
+
readonly disabled: BooleanConstructor;
|
|
14
|
+
readonly lazy: BooleanConstructor;
|
|
15
|
+
};
|
|
16
|
+
export type TabPaneProps = {
|
|
17
|
+
/**
|
|
18
|
+
* @description title of the tab
|
|
19
|
+
*/
|
|
20
|
+
label?: string;
|
|
21
|
+
/**
|
|
22
|
+
* @description identifier corresponding to the name of Tabs, representing the alias of the tab-pane, the default is ordinal number of the tab-pane in the sequence, e.g. the first tab-pane is '0'
|
|
23
|
+
*/
|
|
24
|
+
name?: string | number;
|
|
25
|
+
/**
|
|
26
|
+
* @description whether Tab is closable
|
|
27
|
+
*/
|
|
28
|
+
closable?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* @description whether Tab is disabled
|
|
31
|
+
*/
|
|
32
|
+
disabled?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* @description whether Tab is lazily rendered
|
|
35
|
+
*/
|
|
36
|
+
lazy?: boolean;
|
|
37
|
+
};
|
|
1
38
|
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
2
|
-
readonly label: import("element-plus/
|
|
39
|
+
readonly label: import("@element-plus/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
|
|
3
40
|
readonly name: {
|
|
4
|
-
readonly type: import("vue").PropType<import("element-plus/
|
|
41
|
+
readonly type: import("vue").PropType<import("@element-plus/utils").EpPropMergeType<readonly [StringConstructor, NumberConstructor], unknown, unknown>>;
|
|
5
42
|
readonly required: false;
|
|
6
43
|
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
7
44
|
__epPropKey: true;
|
|
8
45
|
};
|
|
9
|
-
readonly closable: import("element-plus/
|
|
46
|
+
readonly closable: import("@element-plus/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, undefined, boolean>;
|
|
10
47
|
readonly disabled: BooleanConstructor;
|
|
11
48
|
readonly lazy: BooleanConstructor;
|
|
12
49
|
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
13
50
|
[key: string]: any;
|
|
14
51
|
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
15
|
-
readonly label: import("element-plus/
|
|
52
|
+
readonly label: import("@element-plus/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
|
|
16
53
|
readonly name: {
|
|
17
|
-
readonly type: import("vue").PropType<import("element-plus/
|
|
54
|
+
readonly type: import("vue").PropType<import("@element-plus/utils").EpPropMergeType<readonly [StringConstructor, NumberConstructor], unknown, unknown>>;
|
|
18
55
|
readonly required: false;
|
|
19
56
|
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
20
57
|
__epPropKey: true;
|
|
21
58
|
};
|
|
22
|
-
readonly closable: import("element-plus/
|
|
59
|
+
readonly closable: import("@element-plus/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, undefined, boolean>;
|
|
23
60
|
readonly disabled: BooleanConstructor;
|
|
24
61
|
readonly lazy: BooleanConstructor;
|
|
25
62
|
}>> & Readonly<{}>, {
|
|
26
|
-
readonly label: string;
|
|
27
63
|
readonly disabled: boolean;
|
|
28
|
-
readonly
|
|
64
|
+
readonly label: string;
|
|
65
|
+
readonly closable: import("@element-plus/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
|
|
29
66
|
readonly lazy: boolean;
|
|
30
67
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
31
68
|
export default _default;
|
|
@@ -1,58 +1,92 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { defineComponent as h, getCurrentInstance as N, inject as g, ref as s, computed as o, watch as y, reactive as B, onBeforeUnmount as C, onBeforeUpdate as E, withDirectives as R, h as w, renderSlot as S, vShow as x, createCommentVNode as T } from "vue";
|
|
2
|
+
import "@vue/shared";
|
|
3
|
+
import "lodash-unified";
|
|
4
|
+
import "@vueuse/core";
|
|
5
|
+
import { throwError as $ } from "../../utils/error.js";
|
|
6
|
+
import "@element-plus/icons-vue";
|
|
7
|
+
import { buildProps as z } from "../../utils/vue/props/runtime.js";
|
|
8
|
+
import { useNamespace as I } from "../../hooks/use-namespace/index.js";
|
|
9
|
+
import { tabsRootContextKey as M } from "../tabs/constants.js";
|
|
10
|
+
const O = z({
|
|
11
|
+
/**
|
|
12
|
+
* @description title of the tab
|
|
13
|
+
*/
|
|
14
|
+
label: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: ""
|
|
17
|
+
},
|
|
18
|
+
/**
|
|
19
|
+
* @description identifier corresponding to the name of Tabs, representing the alias of the tab-pane, the default is ordinal number of the tab-pane in the sequence, e.g. the first tab-pane is '0'
|
|
20
|
+
*/
|
|
21
|
+
name: {
|
|
22
|
+
type: [String, Number]
|
|
23
|
+
},
|
|
24
|
+
/**
|
|
25
|
+
* @description whether Tab is closable
|
|
26
|
+
*/
|
|
27
|
+
closable: {
|
|
28
|
+
type: Boolean,
|
|
29
|
+
default: void 0
|
|
30
|
+
},
|
|
31
|
+
/**
|
|
32
|
+
* @description whether Tab is disabled
|
|
33
|
+
*/
|
|
34
|
+
disabled: Boolean,
|
|
35
|
+
/**
|
|
36
|
+
* @description whether Tab is lazily rendered
|
|
37
|
+
*/
|
|
38
|
+
lazy: Boolean
|
|
39
|
+
}), p = "EpTabPane", q = h({
|
|
40
|
+
name: p,
|
|
41
|
+
props: O,
|
|
9
42
|
setup(n, { slots: r }) {
|
|
10
|
-
const u = N(), a =
|
|
11
|
-
a ||
|
|
12
|
-
const
|
|
13
|
-
() => a.currentName.value === (n.name ??
|
|
14
|
-
), d =
|
|
43
|
+
const u = N(), a = g(M);
|
|
44
|
+
a || $(p, "usage: <ep-tabs><ep-tab-pane /></ep-tabs/>");
|
|
45
|
+
const v = I("tab-pane"), c = s(), l = s(), b = o(() => n.closable ?? a.props.closable), t = o(
|
|
46
|
+
() => a.currentName.value === (n.name ?? l.value)
|
|
47
|
+
), d = s(t.value), i = o(() => n.name ?? l.value), f = o(
|
|
15
48
|
() => !n.lazy || d.value || t.value
|
|
16
|
-
),
|
|
49
|
+
), P = () => {
|
|
17
50
|
var e;
|
|
18
|
-
return (e =
|
|
51
|
+
return (e = c.value) == null ? void 0 : e.contains(document.activeElement);
|
|
19
52
|
};
|
|
20
|
-
|
|
53
|
+
y(t, (e) => {
|
|
21
54
|
e && (d.value = !0);
|
|
22
55
|
});
|
|
23
|
-
const m =
|
|
56
|
+
const m = B({
|
|
24
57
|
uid: u.uid,
|
|
25
58
|
getVnode: () => u.vnode,
|
|
26
59
|
slots: r,
|
|
27
60
|
props: n,
|
|
28
|
-
paneName:
|
|
61
|
+
paneName: i,
|
|
29
62
|
active: t,
|
|
30
|
-
index:
|
|
63
|
+
index: l,
|
|
31
64
|
isClosable: b,
|
|
32
|
-
isFocusInsidePane:
|
|
65
|
+
isFocusInsidePane: P
|
|
33
66
|
});
|
|
34
|
-
return a.registerPane(m),
|
|
67
|
+
return a.registerPane(m), C(() => {
|
|
35
68
|
a.unregisterPane(m);
|
|
36
|
-
}),
|
|
69
|
+
}), E(() => {
|
|
37
70
|
var e;
|
|
38
71
|
r.label && ((e = a.nav$.value) == null || e.scheduleRender());
|
|
39
|
-
}), () => f.value ?
|
|
40
|
-
|
|
72
|
+
}), () => f.value ? R(
|
|
73
|
+
w(
|
|
41
74
|
"div",
|
|
42
75
|
{
|
|
43
|
-
id: `pane-${
|
|
44
|
-
ref:
|
|
45
|
-
class:
|
|
76
|
+
id: `pane-${i.value}`,
|
|
77
|
+
ref: c,
|
|
78
|
+
class: v.b(),
|
|
46
79
|
role: "tabpanel",
|
|
47
80
|
"aria-hidden": !t.value,
|
|
48
|
-
"aria-labelledby": `tab-${
|
|
81
|
+
"aria-labelledby": `tab-${i.value}`
|
|
49
82
|
},
|
|
50
|
-
[
|
|
83
|
+
[S(r, "default")]
|
|
51
84
|
),
|
|
52
|
-
[[
|
|
53
|
-
) :
|
|
85
|
+
[[x, t.value]]
|
|
86
|
+
) : T("v-if", !0);
|
|
54
87
|
}
|
|
55
88
|
});
|
|
56
89
|
export {
|
|
57
|
-
|
|
90
|
+
q as default,
|
|
91
|
+
O as tabPaneProps
|
|
58
92
|
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ComputedRef, Ref } from 'vue';
|
|
2
|
+
export interface Scrollable {
|
|
3
|
+
next?: boolean;
|
|
4
|
+
prev?: number;
|
|
5
|
+
}
|
|
6
|
+
interface UseTabNavTouchParams {
|
|
7
|
+
scrollable: Ref<false | Scrollable>;
|
|
8
|
+
navOffset: Ref<number>;
|
|
9
|
+
navSize: ComputedRef<number>;
|
|
10
|
+
navContainerSize: ComputedRef<number>;
|
|
11
|
+
isHorizontal: ComputedRef<boolean>;
|
|
12
|
+
}
|
|
13
|
+
export declare const useTabNavTouch: ({ scrollable, navOffset, navSize, navContainerSize, isHorizontal, }: UseTabNavTouchParams) => {
|
|
14
|
+
isTouchScrolling: Ref<boolean, boolean>;
|
|
15
|
+
handleTouchStart: (event: TouchEvent) => void;
|
|
16
|
+
handleTouchMove: (event: TouchEvent) => void;
|
|
17
|
+
handleTouchEnd: () => void;
|
|
18
|
+
};
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { ref as A, computed as O } from "vue";
|
|
2
|
+
import { isUndefined as S, clamp as g } from "lodash-unified";
|
|
3
|
+
import "@vue/shared";
|
|
4
|
+
import "@vueuse/core";
|
|
5
|
+
import { getClientXY as x } from "../../../utils/dom/position.js";
|
|
6
|
+
import "@element-plus/icons-vue";
|
|
7
|
+
const b = 5, _ = ({
|
|
8
|
+
scrollable: r,
|
|
9
|
+
navOffset: s,
|
|
10
|
+
navSize: T,
|
|
11
|
+
navContainerSize: D,
|
|
12
|
+
isHorizontal: i
|
|
13
|
+
}) => {
|
|
14
|
+
const o = A(!1), l = O(
|
|
15
|
+
() => Math.max(T.value - D.value, 0)
|
|
16
|
+
);
|
|
17
|
+
let e, a;
|
|
18
|
+
const M = (t) => {
|
|
19
|
+
if (!r.value || t.touches.length !== 1) return;
|
|
20
|
+
const { clientX: n, clientY: c } = x(t);
|
|
21
|
+
e = {
|
|
22
|
+
startX: n,
|
|
23
|
+
startY: c,
|
|
24
|
+
startOffset: s.value
|
|
25
|
+
}, a = void 0;
|
|
26
|
+
}, X = (t) => {
|
|
27
|
+
if (!e || !r.value) return;
|
|
28
|
+
if (t.touches.length !== 1) {
|
|
29
|
+
u();
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const { clientX: n, clientY: c } = x(t), f = e.startX - n, h = e.startY - c, m = i.value ? f : h, Y = i.value ? h : f, v = Math.abs(m), d = Math.abs(Y);
|
|
33
|
+
if (S(a)) {
|
|
34
|
+
if (Math.max(v, d) <= b)
|
|
35
|
+
return;
|
|
36
|
+
a = v > d;
|
|
37
|
+
}
|
|
38
|
+
if (!a)
|
|
39
|
+
return;
|
|
40
|
+
const p = g(
|
|
41
|
+
e.startOffset + m,
|
|
42
|
+
0,
|
|
43
|
+
l.value
|
|
44
|
+
);
|
|
45
|
+
l.value <= 0 || p === s.value || !t.cancelable || (t.preventDefault(), o.value = !0, s.value = p);
|
|
46
|
+
}, u = () => {
|
|
47
|
+
e = void 0, a = void 0, o.value = !1;
|
|
48
|
+
};
|
|
49
|
+
return {
|
|
50
|
+
isTouchScrolling: o,
|
|
51
|
+
handleTouchStart: M,
|
|
52
|
+
handleTouchMove: X,
|
|
53
|
+
handleTouchEnd: u
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
export {
|
|
57
|
+
_ as useTabNavTouch
|
|
58
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { ComputedRef, InjectionKey, Ref, Slots, UnwrapRef, VNode } from 'vue';
|
|
2
|
+
import type { TabsProps } from './tabs';
|
|
3
|
+
export type TabPaneName = string | number;
|
|
4
|
+
/**
|
|
5
|
+
* tab-pane 的 props 类型,与 element-plus `tabs/src/tab-pane.ts` 的 `TabPaneProps`
|
|
6
|
+
* 字段保持一致(label/name/closable/disabled/lazy)。tab-pane 本体由任务 7.4
|
|
7
|
+
* 自持后导出自身的 `TabPaneProps`;此处内联字段,避免跨任务引用尚未完成的模块
|
|
8
|
+
* (type-only 不会产生运行时循环依赖)。
|
|
9
|
+
*/
|
|
10
|
+
type TabPaneProps = {
|
|
11
|
+
/**
|
|
12
|
+
* @description title of the tab
|
|
13
|
+
*/
|
|
14
|
+
label?: string;
|
|
15
|
+
/**
|
|
16
|
+
* @description identifier corresponding to the name of Tabs, representing the alias of the tab-pane, the default is ordinal number of the tab-pane in the sequence, e.g. the first tab-pane is '0'
|
|
17
|
+
*/
|
|
18
|
+
name?: string | number;
|
|
19
|
+
/**
|
|
20
|
+
* @description whether Tab is closable
|
|
21
|
+
*/
|
|
22
|
+
closable?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* @description whether Tab is disabled
|
|
25
|
+
*/
|
|
26
|
+
disabled?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* @description whether Tab is lazily rendered
|
|
29
|
+
*/
|
|
30
|
+
lazy?: boolean;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* TabNav 实例在 tabs/tab-pane 处实际消费的方法子集(与 element-plus 的
|
|
34
|
+
* `TabNavInstance` 消费面一致)。TabNav 本体由任务 7.2 产出、7.3 切换 tabs.ts
|
|
35
|
+
* 的 `TabNavInstance` 深引用;此处内联其消费面,使本常量在 7.2/7.3 之前即可
|
|
36
|
+
* 独立类型化(type-only)。
|
|
37
|
+
*/
|
|
38
|
+
interface TabNavInstance {
|
|
39
|
+
removeFocus: () => void;
|
|
40
|
+
focusActiveTab: () => void;
|
|
41
|
+
scrollToActiveTab: () => Promise<void>;
|
|
42
|
+
scheduleRender: () => void;
|
|
43
|
+
}
|
|
44
|
+
export type TabsPaneContext = UnwrapRef<{
|
|
45
|
+
uid: number;
|
|
46
|
+
getVnode: () => VNode;
|
|
47
|
+
slots: Slots;
|
|
48
|
+
props: TabPaneProps;
|
|
49
|
+
paneName: ComputedRef<TabPaneName | undefined>;
|
|
50
|
+
active: ComputedRef<boolean>;
|
|
51
|
+
index: Ref<string | undefined>;
|
|
52
|
+
isClosable: ComputedRef<boolean>;
|
|
53
|
+
isFocusInsidePane: () => boolean | undefined;
|
|
54
|
+
}>;
|
|
55
|
+
export interface TabsRootContext {
|
|
56
|
+
props: TabsProps;
|
|
57
|
+
currentName: Ref<TabPaneName>;
|
|
58
|
+
registerPane: (pane: TabsPaneContext) => void;
|
|
59
|
+
unregisterPane: (pane: TabsPaneContext) => void;
|
|
60
|
+
nav$: Ref<TabNavInstance | undefined>;
|
|
61
|
+
}
|
|
62
|
+
export declare const tabsRootContextKey: InjectionKey<TabsRootContext>;
|
|
63
|
+
export {};
|