savor-ui 0.3.2 → 0.4.0
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/CHANGELOG.md +45 -0
- package/dist/es/components/index.d.ts +4 -0
- package/dist/es/components/index.mjs +6 -1
- package/dist/es/components/src/alert/alert.d.ts +22 -0
- package/dist/es/components/src/alert/alert.vue.mjs +5 -0
- package/dist/es/components/src/alert/alert.vue_vue_type_script_setup_true_vapor_true_lang.mjs +58 -0
- package/dist/es/components/src/alert/index.d.ts +26 -0
- package/dist/es/components/src/alert/index.mjs +7 -0
- package/dist/es/components/src/alert/types.d.ts +24 -0
- package/dist/es/components/src/cascader/cascader.vue_vue_type_script_setup_true_vapor_true_lang.mjs +93 -82
- package/dist/es/components/src/cascader/index.d.ts +1 -0
- package/dist/es/components/src/cascader/types.d.ts +2 -0
- package/dist/es/components/src/chat-list/chat-list.d.ts +35 -0
- package/dist/es/components/src/chat-list/chat-list.vue.mjs +5 -0
- package/dist/es/components/src/chat-list/chat-list.vue_vue_type_script_setup_true_vapor_true_lang.mjs +55 -0
- package/dist/es/components/src/chat-list/index.d.ts +47 -0
- package/dist/es/components/src/chat-list/index.mjs +7 -0
- package/dist/es/components/src/chat-list/types.d.ts +44 -0
- package/dist/es/components/src/chat-sender/chat-sender.d.ts +26 -0
- package/dist/es/components/src/chat-sender/chat-sender.vue.mjs +5 -0
- package/dist/es/components/src/chat-sender/chat-sender.vue_vue_type_script_setup_true_vapor_true_lang.mjs +92 -0
- package/dist/es/components/src/chat-sender/index.d.ts +27 -0
- package/dist/es/components/src/chat-sender/index.mjs +7 -0
- package/dist/es/components/src/chat-sender/types.d.ts +24 -0
- package/dist/es/components/src/collapse/collapse-item.vue_vue_type_script_setup_true_vapor_true_lang.mjs +2 -2
- package/dist/es/components/src/date-picker/date-picker.vue_vue_type_script_setup_true_vapor_true_lang.mjs +28 -28
- package/dist/es/components/src/datetime-picker/datetime-picker.vue_vue_type_script_setup_true_vapor_true_lang.mjs +28 -28
- package/dist/es/components/src/drawer/drawer.vue_vue_type_script_setup_true_vapor_true_lang.mjs +72 -72
- package/dist/es/components/src/form/form-item.vue_vue_type_script_setup_true_vapor_true_lang.mjs +13 -13
- package/dist/es/components/src/form/use-form-item.d.ts +1 -1
- package/dist/es/components/src/grid/grid-item.vue_vue_type_script_setup_true_vapor_true_lang.mjs +26 -17
- package/dist/es/components/src/grid/grid.vue_vue_type_script_setup_true_vapor_true_lang.mjs +10 -6
- package/dist/es/components/src/grid/types.d.ts +2 -0
- package/dist/es/components/src/input/input.vue_vue_type_script_setup_true_vapor_true_lang.mjs +9 -9
- package/dist/es/components/src/input-number/input-number.vue_vue_type_script_setup_true_vapor_true_lang.mjs +83 -83
- package/dist/es/components/src/input-tag/input-tag.vue_vue_type_script_setup_true_vapor_true_lang.mjs +10 -10
- package/dist/es/components/src/layer/layer.vue_vue_type_script_setup_true_vapor_true_lang.mjs +105 -105
- package/dist/es/components/src/list/index.d.ts +5 -5
- package/dist/es/components/src/list/list.d.ts +3 -3
- package/dist/es/components/src/list/list.vue_vue_type_script_setup_true_vapor_true_lang.mjs +7 -12
- package/dist/es/components/src/list/types.d.ts +7 -5
- package/dist/es/components/src/menu/menu-item.vue_vue_type_script_setup_true_vapor_true_lang.mjs +46 -37
- package/dist/es/components/src/menu/sub-menu.vue_vue_type_script_setup_true_vapor_true_lang.mjs +2 -2
- package/dist/es/components/src/modal/modal.vue_vue_type_script_setup_true_vapor_true_lang.mjs +121 -121
- package/dist/es/components/src/panel/panel.vue_vue_type_script_setup_true_vapor_true_lang.mjs +2 -2
- package/dist/es/components/src/popover/index.d.ts +1 -0
- package/dist/es/components/src/popover/popover.vue_vue_type_script_setup_true_vapor_true_lang.mjs +77 -76
- package/dist/es/components/src/popover/types.d.ts +4 -0
- package/dist/es/components/src/scrollbar/index.d.ts +7 -2
- package/dist/es/components/src/scrollbar/scrollbar.d.ts +5 -2
- package/dist/es/components/src/scrollbar/scrollbar.vue_vue_type_script_setup_true_vapor_true_lang.mjs +131 -96
- package/dist/es/components/src/scrollbar/types.d.ts +15 -1
- package/dist/es/components/src/segmented/segmented.vue_vue_type_script_setup_true_vapor_true_lang.mjs +41 -45
- package/dist/es/components/src/select/select.vue_vue_type_script_setup_true_vapor_true_lang.mjs +9 -9
- package/dist/es/components/src/table/col-group.d.ts +22 -0
- package/dist/es/components/src/table/col-group.vue.mjs +5 -0
- package/dist/es/components/src/table/col-group.vue_vue_type_script_setup_true_vapor_true_lang.mjs +25 -0
- package/dist/es/components/src/table/index.d.ts +18 -41
- package/dist/es/components/src/table/index.mjs +1 -0
- package/dist/es/components/src/table/table-body.d.ts +32 -0
- package/dist/es/components/src/table/table-body.vue.mjs +5 -0
- package/dist/es/components/src/table/table-body.vue_vue_type_script_setup_true_vapor_true_lang.mjs +153 -0
- package/dist/es/components/src/table/table-header.d.ts +23 -0
- package/dist/es/components/src/table/table-header.vue.mjs +5 -0
- package/dist/es/components/src/table/table-header.vue_vue_type_script_setup_true_vapor_true_lang.mjs +80 -0
- package/dist/es/components/src/table/table.d.ts +12 -25
- package/dist/es/components/src/table/table.vue_vue_type_script_setup_true_vapor_true_lang.mjs +167 -380
- package/dist/es/components/src/table/types.d.ts +61 -45
- package/dist/es/components/src/table/types.mjs +4 -0
- package/dist/es/components/src/textarea/textarea.vue_vue_type_script_setup_true_vapor_true_lang.mjs +6 -6
- package/dist/es/components/src/tooltip/index.d.ts +1 -0
- package/dist/es/components/src/tooltip/tooltip.vue_vue_type_script_setup_true_vapor_true_lang.mjs +2 -0
- package/dist/es/components/src/tooltip/types.d.ts +2 -0
- package/dist/es/components/src/transition/index.d.ts +29 -0
- package/dist/es/components/src/transition/index.mjs +7 -0
- package/dist/es/components/src/{_comp/HeightTransition.d.ts → transition/transition-height.d.ts} +0 -4
- package/dist/es/components/src/transition/transition-height.vue.mjs +5 -0
- package/dist/es/components/src/transition/transition-height.vue_vue_type_script_setup_true_vapor_true_lang.mjs +54 -0
- package/dist/es/components/src/transition/transition-opacity.vue.mjs +5 -0
- package/dist/es/components/src/{_comp/OpacityTransition.vue_vue_type_script_setup_true_vapor_true_lang.mjs → transition/transition-opacity.vue_vue_type_script_setup_true_vapor_true_lang.mjs} +2 -2
- package/dist/es/components/src/transition/transition-scale.vue.mjs +5 -0
- package/dist/es/components/src/{_comp/ScaleTransition.vue_vue_type_script_setup_true_vapor_true_lang.mjs → transition/transition-scale.vue_vue_type_script_setup_true_vapor_true_lang.mjs} +2 -2
- package/dist/es/components/src/transition/transition-side.vue.mjs +5 -0
- package/dist/es/components/src/{_comp/SideTransition.vue_vue_type_script_setup_true_vapor_true_lang.mjs → transition/transition-side.vue_vue_type_script_setup_true_vapor_true_lang.mjs} +2 -2
- package/dist/es/components/src/transition/transition-width.d.ts +31 -0
- package/dist/es/components/src/transition/transition-width.vue.mjs +5 -0
- package/dist/es/components/src/transition/transition-width.vue_vue_type_script_setup_true_vapor_true_lang.mjs +54 -0
- package/dist/es/components/src/transition/transition.d.ts +27 -0
- package/dist/es/components/src/transition/transition.vue.mjs +5 -0
- package/dist/es/components/src/transition/transition.vue_vue_type_script_setup_true_vapor_true_lang.mjs +47 -0
- package/dist/es/components/src/transition/types.d.ts +28 -0
- package/dist/es/components/src/tree/index.d.ts +15 -7
- package/dist/es/components/src/tree/node.d.ts +2 -1
- package/dist/es/components/src/tree/node.vue_vue_type_script_setup_true_vapor_true_lang.mjs +27 -29
- package/dist/es/components/src/tree/tree.d.ts +8 -2
- package/dist/es/components/src/tree/tree.vue_vue_type_script_setup_true_vapor_true_lang.mjs +69 -65
- package/dist/es/components/src/tree/types.d.ts +18 -12
- package/dist/es/core/components.mjs +94 -86
- package/dist/es/core/index.mjs +84 -79
- package/dist/es/hooks/src/use-element-size.mjs +7 -38
- package/dist/es/icons/index.d.ts +4 -1
- package/dist/es/icons/index.mjs +3 -0
- package/dist/es/icons/src/loading-stop.d.ts +19 -0
- package/dist/es/icons/src/loading-stop.vue.mjs +11 -0
- package/dist/es/icons/src/send.d.ts +19 -0
- package/dist/es/icons/src/send.vue.mjs +11 -0
- package/dist/es/icons/src/stop.d.ts +19 -0
- package/dist/es/icons/src/stop.vue.mjs +5 -0
- package/dist/es/theme/components/alert.scss +101 -0
- package/dist/es/theme/components/button.scss +21 -4
- package/dist/es/theme/components/cascader.scss +3 -0
- package/dist/es/theme/components/chat-list.scss +134 -0
- package/dist/es/theme/components/chat-sender.scss +123 -0
- package/dist/es/theme/components/index.scss +3 -0
- package/dist/es/theme/components/input.scss +2 -1
- package/dist/es/theme/components/list.scss +7 -0
- package/dist/es/theme/components/menu.scss +14 -1
- package/dist/es/theme/components/scrollbar.scss +61 -7
- package/dist/es/theme/components/table.scss +360 -328
- package/dist/es/theme/components/transition.scss +21 -21
- package/dist/es/theme/components/tree.scss +8 -0
- package/dist/es/utils/src/tool.d.ts +8 -3
- package/dist/es/utils/src/tool.mjs +6 -6
- package/dist/json/vetur-attributes.json +196 -46
- package/dist/json/vetur-tags.json +82 -15
- package/dist/json/web-types.json +432 -75
- package/package.json +1 -1
- package/dist/es/components/src/_comp/HeightTransition.vue.mjs +0 -5
- package/dist/es/components/src/_comp/HeightTransition.vue_vue_type_script_setup_true_vapor_true_lang.mjs +0 -77
- package/dist/es/components/src/_comp/OpacityTransition.vue.mjs +0 -5
- package/dist/es/components/src/_comp/ScaleTransition.vue.mjs +0 -5
- package/dist/es/components/src/_comp/SideTransition.vue.mjs +0 -5
- /package/dist/es/components/src/{_comp/OpacityTransition.d.ts → transition/transition-opacity.d.ts} +0 -0
- /package/dist/es/components/src/{_comp/ScaleTransition.d.ts → transition/transition-scale.d.ts} +0 -0
- /package/dist/es/components/src/{_comp/SideTransition.d.ts → transition/transition-side.d.ts} +0 -0
package/dist/es/components/src/popover/popover.vue_vue_type_script_setup_true_vapor_true_lang.mjs
CHANGED
|
@@ -2,12 +2,12 @@ import { debounce as e } from "../../../utils/src/tool.mjs";
|
|
|
2
2
|
import "../../../utils/index.mjs";
|
|
3
3
|
import { useNamespace as t } from "../../../hooks/src/use-namespace.mjs";
|
|
4
4
|
import { useOutsideClick as n } from "../../../hooks/src/use-outside-click.mjs";
|
|
5
|
-
import { useZIndex as
|
|
5
|
+
import { useZIndex as ee } from "../../../hooks/src/use-zIndex.mjs";
|
|
6
6
|
import "../../../hooks/index.mjs";
|
|
7
|
-
import { VaporTeleport as
|
|
7
|
+
import { VaporTeleport as te, VaporTransition as ne, applyVShow as r, child as i, computed as a, createComponent as o, createDynamicComponent as re, createIf as s, createSlot as c, createTemplateRefSetter as l, defineVaporComponent as u, nextTick as d, onMounted as ie, onUnmounted as ae, ref as f, renderEffect as p, setClass as m, setDynamicEvents as h, setInsertionState as g, setStyle as _, setText as oe, template as v, toDisplayString as se, unref as y, useSlots as b, useTemplateRef as x, watch as S, watchEffect as ce } from "vue";
|
|
8
8
|
import { createPopper as le } from "@popperjs/core";
|
|
9
9
|
//#region ../components/src/popover/popover.vue?vue&type=script&setup=true&vapor=true&lang.ts
|
|
10
|
-
var ue = v(" "), de = v("<div data-popper-arrow>"), fe = v("<div>"), pe = v("<div><div>"), C = /*@__PURE__*/
|
|
10
|
+
var ue = v(" "), de = v("<div data-popper-arrow>"), fe = v("<div>"), pe = v("<div><div>"), C = /*@__PURE__*/ u({
|
|
11
11
|
name: "SPopover",
|
|
12
12
|
__name: "popover",
|
|
13
13
|
props: {
|
|
@@ -21,6 +21,7 @@ var ue = v(" "), de = v("<div data-popper-arrow>"), fe = v("<div>"), pe = v("<di
|
|
|
21
21
|
alignPoint: { type: Boolean },
|
|
22
22
|
offset: {},
|
|
23
23
|
arrowStyle: {},
|
|
24
|
+
disabled: { type: Boolean },
|
|
24
25
|
destroyOnClose: {
|
|
25
26
|
type: Boolean,
|
|
26
27
|
default: !0
|
|
@@ -33,57 +34,57 @@ var ue = v(" "), de = v("<div data-popper-arrow>"), fe = v("<div>"), pe = v("<di
|
|
|
33
34
|
},
|
|
34
35
|
emits: ["change", "click-outside"],
|
|
35
36
|
__multiRoot: !0,
|
|
36
|
-
setup(
|
|
37
|
-
let w =
|
|
37
|
+
setup(u, { expose: v, emit: C }) {
|
|
38
|
+
let w = u, T = C, E = t("popover"), me = b(), D = f(!1), O = f(!1), { nextZIndex: he } = ee(), k = f(), A = x("containerNode"), j = x("wrapperNode"), M = x("contentNode"), N = f(null), ge = () => {
|
|
38
39
|
let e = me.default?.();
|
|
39
40
|
return N.value = e, e;
|
|
40
|
-
},
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
}, P = f(null), F = f({}), I = f({}), L = f({}), R = f(null), z = () => {
|
|
42
|
+
P.value && Object.entries(I.value).forEach(([e, t]) => {
|
|
43
|
+
P.value.removeEventListener(e, t);
|
|
43
44
|
});
|
|
44
|
-
},
|
|
45
|
+
}, B = (e) => e == null ? [] : Array.isArray(e) ? e : [e], V = (e) => {
|
|
45
46
|
if (!e) return null;
|
|
46
47
|
if (e instanceof Node) return e;
|
|
47
48
|
if (e.block instanceof Node) return e.block;
|
|
48
49
|
if (e.el instanceof Node) return e.el;
|
|
49
50
|
if (e.branches) {
|
|
50
|
-
let t = typeof e.activeBranch == "number" ? e.activeBranch : 0, n =
|
|
51
|
+
let t = typeof e.activeBranch == "number" ? e.activeBranch : 0, n = V(e.branches[t] || e.branches[0]);
|
|
51
52
|
if (n) return n;
|
|
52
53
|
}
|
|
53
|
-
for (let t of
|
|
54
|
-
let e =
|
|
54
|
+
for (let t of B(e.children)) {
|
|
55
|
+
let e = V(t);
|
|
55
56
|
if (e) return e;
|
|
56
57
|
}
|
|
57
|
-
for (let t of
|
|
58
|
+
for (let t of B(e.nodes)) {
|
|
58
59
|
if (t instanceof Node) return t;
|
|
59
|
-
let e =
|
|
60
|
+
let e = V(t);
|
|
60
61
|
if (e) return e;
|
|
61
62
|
}
|
|
62
63
|
return null;
|
|
63
64
|
};
|
|
64
65
|
S(N, (e) => {
|
|
65
|
-
if (!e ||
|
|
66
|
+
if (!e || P.value) return;
|
|
66
67
|
let t = null;
|
|
67
|
-
t = e instanceof HTMLElement ? e :
|
|
68
|
-
}, { flush: "post" }),
|
|
69
|
-
if (
|
|
68
|
+
t = e instanceof HTMLElement ? e : V(e), t && t !== P.value && (z(), P.value = t);
|
|
69
|
+
}, { flush: "post" }), ie(() => {
|
|
70
|
+
if (P.value) return;
|
|
70
71
|
let e = N.value;
|
|
71
72
|
if (!e) return;
|
|
72
|
-
let t = e instanceof HTMLElement ? e :
|
|
73
|
-
t && t !==
|
|
74
|
-
}), S(
|
|
75
|
-
e &&
|
|
76
|
-
Object.entries(
|
|
73
|
+
let t = e instanceof HTMLElement ? e : V(e);
|
|
74
|
+
t && t !== P.value && (z(), P.value = t);
|
|
75
|
+
}), S(P, (e) => {
|
|
76
|
+
e && d().then(() => {
|
|
77
|
+
Object.entries(I.value).forEach(([t, n]) => {
|
|
77
78
|
e.addEventListener(t, n);
|
|
78
79
|
});
|
|
79
80
|
});
|
|
80
81
|
}, { flush: "post" });
|
|
81
|
-
let
|
|
82
|
-
if (!M.value || !
|
|
82
|
+
let _e = () => {
|
|
83
|
+
if (!M.value || !P.value) return;
|
|
83
84
|
M.value.style.width = "";
|
|
84
85
|
let e = "";
|
|
85
|
-
typeof w.width == "number" ? (e = `${w.width}px`, M.value.style.width = e) : w.width === "sameWidth" ? (e = `${
|
|
86
|
-
},
|
|
86
|
+
typeof w.width == "number" ? (e = `${w.width}px`, M.value.style.width = e) : w.width === "sameWidth" ? (e = `${P.value.getBoundingClientRect().width}px`, M.value.style.width = e) : w.width === "auto" && (e = "", M.value.style.width = e);
|
|
87
|
+
}, ve = a(() => {
|
|
87
88
|
let e = [0, 0];
|
|
88
89
|
return w.offset ? e = w.offset : w.trigger === "contextmenu" && w.alignPoint ? e = [0, 0] : w.showArrow && (e = [0, 8]), {
|
|
89
90
|
placement: w.placement,
|
|
@@ -109,46 +110,46 @@ var ue = v(" "), de = v("<div data-popper-arrow>"), fe = v("<div>"), pe = v("<di
|
|
|
109
110
|
}
|
|
110
111
|
]
|
|
111
112
|
};
|
|
112
|
-
}),
|
|
113
|
+
}), H = a(() => w.manual ? {
|
|
113
114
|
openDelay: 0,
|
|
114
115
|
closeDelay: 0
|
|
115
116
|
} : {
|
|
116
117
|
openDelay: typeof w.delay == "number" ? w.delay : w.delay[0],
|
|
117
118
|
closeDelay: typeof w.delay == "number" ? 50 : w.delay[1]
|
|
118
|
-
}),
|
|
119
|
-
O.value = !0,
|
|
119
|
+
}), U = null, ye = () => {
|
|
120
|
+
w.disabled || (U &&= (clearTimeout(U), null), O.value = !0, d(() => {
|
|
120
121
|
D.value = !0, T("change", !0);
|
|
121
|
-
});
|
|
122
|
-
},
|
|
123
|
-
D.value = !1,
|
|
124
|
-
w.destroyOnClose && (O.value = !1);
|
|
122
|
+
}));
|
|
123
|
+
}, be = () => {
|
|
124
|
+
D.value = !1, R.value = null, T("change", !1), U && clearTimeout(U), U = setTimeout(() => {
|
|
125
|
+
w.destroyOnClose && (O.value = !1), U = null;
|
|
125
126
|
}, 300);
|
|
126
127
|
}, W = f(null), G = f(null), K = () => {
|
|
127
|
-
W.value?.cancel(), G.value?.cancel(), W.value = e(
|
|
128
|
+
W.value?.cancel(), G.value?.cancel(), W.value = e(ye, H.value.openDelay), G.value = e(be, H.value.closeDelay);
|
|
128
129
|
};
|
|
129
|
-
K(), S(
|
|
130
|
+
K(), S(H, K);
|
|
130
131
|
let q = () => {
|
|
131
132
|
G.value?.cancel(), W.value?.();
|
|
132
133
|
}, J = () => {
|
|
133
134
|
W.value?.cancel(), G.value?.();
|
|
134
135
|
};
|
|
135
136
|
n(A, (e) => {
|
|
136
|
-
|
|
137
|
+
P.value && e.target && typeof P.value.contains == "function" && P.value.contains(e.target) || (D.value && T("click-outside", e), !w.manual && (w.trigger === "hover" || w.trigger === "contextmenu" || w.trigger === "click") && J());
|
|
137
138
|
});
|
|
138
139
|
let Y = null, X = () => {
|
|
139
140
|
Y &&= (Y.destroy(), null);
|
|
140
141
|
}, Z = () => {
|
|
141
|
-
|
|
142
|
+
I.value = {}, F.value = {}, L.value = {}, Q();
|
|
142
143
|
}, Q = () => {
|
|
143
|
-
w.manual || (w.trigger === "hover" && (
|
|
144
|
+
w.manual || (w.trigger === "hover" && (I.value.mouseenter = q, I.value.mouseleave = J, F.value.mouseenter = q, F.value.mouseleave = J), w.trigger === "click" && (I.value.click = () => {
|
|
144
145
|
let e = D.value ? G.value : W.value;
|
|
145
146
|
(D.value ? W.value : G.value)?.cancel(), e?.();
|
|
146
|
-
}), w.trigger === "contextmenu" && (
|
|
147
|
+
}), w.trigger === "contextmenu" && (I.value.click = () => {
|
|
147
148
|
J();
|
|
148
|
-
},
|
|
149
|
+
}, I.value.contextmenu = (e) => {
|
|
149
150
|
D.value && J(), e.preventDefault();
|
|
150
151
|
let t = e;
|
|
151
|
-
|
|
152
|
+
R.value = {
|
|
152
153
|
x: t.clientX,
|
|
153
154
|
y: t.clientY
|
|
154
155
|
}, q();
|
|
@@ -157,71 +158,71 @@ var ue = v(" "), de = v("<div data-popper-arrow>"), fe = v("<div>"), pe = v("<di
|
|
|
157
158
|
ce(() => {
|
|
158
159
|
w.manual || Q();
|
|
159
160
|
});
|
|
160
|
-
let
|
|
161
|
-
X();
|
|
161
|
+
let xe = () => {
|
|
162
|
+
D.value || X();
|
|
162
163
|
};
|
|
163
164
|
S(D, (e) => {
|
|
164
|
-
if (!e || !j.value || !
|
|
165
|
-
k.value = he(),
|
|
166
|
-
let t =
|
|
167
|
-
w.trigger === "contextmenu" && w.alignPoint &&
|
|
165
|
+
if (!e || !j.value || !P.value) return;
|
|
166
|
+
k.value = he(), _e();
|
|
167
|
+
let t = P.value;
|
|
168
|
+
w.trigger === "contextmenu" && w.alignPoint && R.value && (t = { getBoundingClientRect() {
|
|
168
169
|
return {
|
|
169
|
-
top:
|
|
170
|
-
left:
|
|
170
|
+
top: R.value.y,
|
|
171
|
+
left: R.value.x,
|
|
171
172
|
width: 0,
|
|
172
173
|
height: 0,
|
|
173
|
-
right:
|
|
174
|
-
bottom:
|
|
175
|
-
x:
|
|
176
|
-
y:
|
|
174
|
+
right: R.value.x,
|
|
175
|
+
bottom: R.value.y,
|
|
176
|
+
x: R.value.x,
|
|
177
|
+
y: R.value.y,
|
|
177
178
|
toJSON: () => JSON.stringify({
|
|
178
|
-
top:
|
|
179
|
-
left:
|
|
179
|
+
top: R.value.y,
|
|
180
|
+
left: R.value.x,
|
|
180
181
|
width: 0,
|
|
181
182
|
height: 0,
|
|
182
|
-
right:
|
|
183
|
-
bottom:
|
|
184
|
-
x:
|
|
185
|
-
y:
|
|
183
|
+
right: R.value.x,
|
|
184
|
+
bottom: R.value.y,
|
|
185
|
+
x: R.value.x,
|
|
186
|
+
y: R.value.y
|
|
186
187
|
})
|
|
187
188
|
};
|
|
188
|
-
} }), X(), Y = le(t, j.value,
|
|
189
|
+
} }), X(), Y = le(t, j.value, ve.value);
|
|
189
190
|
}, { flush: "post" }), S(() => w.manual, (e) => {
|
|
190
191
|
e ? Z() : Q();
|
|
191
192
|
}), S(() => w.trigger, (e, t) => {
|
|
192
193
|
e !== t && (W.value?.cancel(), D.value = !1, T("change", !1), Z());
|
|
193
194
|
}), ae(() => {
|
|
194
|
-
X(),
|
|
195
|
+
U &&= (clearTimeout(U), null), X(), z();
|
|
195
196
|
}), v({
|
|
196
197
|
show: q,
|
|
197
198
|
hide: J
|
|
198
199
|
});
|
|
199
|
-
let $ =
|
|
200
|
-
return [re(() =>
|
|
201
|
-
disabled: () => !
|
|
202
|
-
to: () =>
|
|
200
|
+
let $ = l();
|
|
201
|
+
return [re(() => ge()), o(te, {
|
|
202
|
+
disabled: () => !u.teleportBody,
|
|
203
|
+
to: () => u.teleport
|
|
203
204
|
}, () => s(() => O.value, () => {
|
|
204
|
-
let e = pe(), t =
|
|
205
|
+
let e = pe(), t = i(e);
|
|
205
206
|
return p(() => {
|
|
206
|
-
let n =
|
|
207
|
-
h(e,
|
|
208
|
-
}), g(t, null, 0), o(
|
|
207
|
+
let n = y(E);
|
|
208
|
+
h(e, F.value), m(e, [n.b()]), m(t, [n.e("wrapper")]), _(t, { zIndex: k.value });
|
|
209
|
+
}), g(t, null, 0), o(ne, {
|
|
209
210
|
name: "popover-fade",
|
|
210
|
-
onAfterLeave: () =>
|
|
211
|
+
onAfterLeave: () => xe,
|
|
211
212
|
persisted: ""
|
|
212
213
|
}, () => {
|
|
213
214
|
let e = fe();
|
|
214
215
|
return p(() => {
|
|
215
|
-
h(e,
|
|
216
|
+
h(e, L.value), m(e, [y(E).e("content")]);
|
|
216
217
|
}), g(e, null, 0), c("content", null, () => {
|
|
217
218
|
let e = ue();
|
|
218
|
-
return p(() => oe(e,
|
|
219
|
-
}), g(e, null, 1), s(() =>
|
|
219
|
+
return p(() => oe(e, se(u.content))), e;
|
|
220
|
+
}), g(e, null, 1), s(() => u.showArrow, () => {
|
|
220
221
|
let e = de();
|
|
221
222
|
return p(() => {
|
|
222
|
-
m(e, [
|
|
223
|
+
m(e, [y(E).e("arrow")]), _(e, u.arrowStyle);
|
|
223
224
|
}), e;
|
|
224
|
-
}),
|
|
225
|
+
}), r(e, () => D.value), $(e, M, null, "contentNode"), e;
|
|
225
226
|
}), $(t, j, null, "wrapperNode"), $(e, A, null, "containerNode"), e;
|
|
226
227
|
}, null, 129))];
|
|
227
228
|
}
|
|
@@ -4,7 +4,7 @@ import { BackTopProps } from '../back-top';
|
|
|
4
4
|
export declare const SScrollbar: ((__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: {
|
|
5
5
|
attrs: any;
|
|
6
6
|
slots: ScrollbarSlots;
|
|
7
|
-
emit:
|
|
7
|
+
emit: ((evt: "scroll", e: Event) => void) & ((evt: "reachedEnd", e: Event, direction: "x" | "y") => void);
|
|
8
8
|
}, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
9
9
|
props: PublicProps & {
|
|
10
10
|
width?: string | number | undefined;
|
|
@@ -15,13 +15,18 @@ export declare const SScrollbar: ((__VLS_props: NonNullable<Awaited<typeof __VLS
|
|
|
15
15
|
id?: string | undefined;
|
|
16
16
|
backtop?: boolean | undefined;
|
|
17
17
|
backtopProps?: BackTopProps | undefined;
|
|
18
|
+
offsetTop?: number | undefined;
|
|
19
|
+
native?: boolean | undefined;
|
|
20
|
+
distance?: number | undefined;
|
|
21
|
+
onScroll?: ((e: Event) => any) | undefined;
|
|
22
|
+
onReachedEnd?: ((e: Event, direction: "x" | "y") => any) | undefined;
|
|
18
23
|
} & (typeof globalThis extends {
|
|
19
24
|
__VLS_PROPS_FALLBACK: infer P;
|
|
20
25
|
} ? P : {});
|
|
21
26
|
expose: (exposed: ShallowUnwrapRef<ScrollbarExpose>) => void;
|
|
22
27
|
attrs: any;
|
|
23
28
|
slots: ScrollbarSlots;
|
|
24
|
-
emit:
|
|
29
|
+
emit: ((evt: "scroll", e: Event) => void) & ((evt: "reachedEnd", e: Event, direction: "x" | "y") => void);
|
|
25
30
|
}>) => VNode & {
|
|
26
31
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
27
32
|
}) & Plugin;
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { ScrollbarExpose, ScrollbarProps, ScrollbarSlots } from './types';
|
|
2
2
|
import { PublicProps, ShallowUnwrapRef, VNode } from 'vue';
|
|
3
3
|
declare const __VLS_export: (__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
4
|
-
props: PublicProps & __VLS_PrettifyLocal<ScrollbarProps
|
|
4
|
+
props: PublicProps & __VLS_PrettifyLocal<ScrollbarProps & {
|
|
5
|
+
onScroll?: ((e: Event) => any) | undefined;
|
|
6
|
+
onReachedEnd?: ((e: Event, direction: "x" | "y") => any) | undefined;
|
|
7
|
+
}> & (typeof globalThis extends {
|
|
5
8
|
__VLS_PROPS_FALLBACK: infer P;
|
|
6
9
|
} ? P : {});
|
|
7
10
|
expose: (exposed: ShallowUnwrapRef<ScrollbarExpose>) => void;
|
|
8
11
|
attrs: any;
|
|
9
12
|
slots: ScrollbarSlots;
|
|
10
|
-
emit:
|
|
13
|
+
emit: ((evt: "scroll", e: Event) => void) & ((evt: "reachedEnd", e: Event, direction: "x" | "y") => void);
|
|
11
14
|
}>) => VNode & {
|
|
12
15
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
13
16
|
};
|
|
@@ -3,11 +3,11 @@ import "../../../utils/index.mjs";
|
|
|
3
3
|
import { useNamespace as t } from "../../../hooks/src/use-namespace.mjs";
|
|
4
4
|
import "../../../hooks/index.mjs";
|
|
5
5
|
import { SBackTop as n } from "../back-top/index.mjs";
|
|
6
|
-
import { applyVShow as r, child as i, createComponent as a, createIf as o, createInvoker as s, createSlot as c, createTemplateRefSetter as
|
|
6
|
+
import { applyVShow as r, child as i, createComponent as a, createIf as o, createInvoker as s, createSlot as c, createTemplateRefSetter as l, defineVaporComponent as u, delegateEvents as d, nextTick as ee, on as f, onMounted as p, onUnmounted as te, ref as m, renderEffect as h, setClass as g, setInsertionState as _, setProp as v, setStyle as y, template as b, unref as x, useId as ne, watch as re } from "vue";
|
|
7
7
|
//#region ../components/src/scrollbar/scrollbar.vue?vue&type=script&setup=true&vapor=true&lang.ts
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
var
|
|
8
|
+
var S = b("<div>"), ie = b("<div><div><div></div></div></div>"), C = b("<div><div><div>"), w = b("<div>", 1);
|
|
9
|
+
d("mousedown");
|
|
10
|
+
var T = /*@__PURE__*/ u({
|
|
11
11
|
name: "SScrollbar",
|
|
12
12
|
__name: "scrollbar",
|
|
13
13
|
props: {
|
|
@@ -18,128 +18,163 @@ var y = /*@__PURE__*/ l({
|
|
|
18
18
|
always: { type: Boolean },
|
|
19
19
|
id: {},
|
|
20
20
|
backtop: { type: Boolean },
|
|
21
|
-
backtopProps: {}
|
|
21
|
+
backtopProps: {},
|
|
22
|
+
offsetTop: { default: 0 },
|
|
23
|
+
native: { type: Boolean },
|
|
24
|
+
distance: { default: 0 }
|
|
22
25
|
},
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
emits: ["scroll", "reachedEnd"],
|
|
27
|
+
setup(u, { expose: d, emit: b }) {
|
|
28
|
+
let T = u, E = b, D = t("scrollbar"), O = "scrollbar_" + ne(), k = m(null), A = m(null), j = m(null), M = m(!1), N = m(0), P = m(20), F = m(!1), I = m(0), L = m(20), R = m(!1), z = m(""), B = 0, V = 0, H = null, U = () => {
|
|
29
|
+
H && clearTimeout(H), H = window.setTimeout(() => {
|
|
30
|
+
W();
|
|
27
31
|
}, 10);
|
|
28
|
-
},
|
|
29
|
-
let e =
|
|
32
|
+
}, W = () => {
|
|
33
|
+
let e = k.value;
|
|
30
34
|
if (!e) return;
|
|
31
35
|
e.offsetHeight;
|
|
32
|
-
let { clientWidth: t, clientHeight: n, scrollWidth: r, scrollHeight: i } = e;
|
|
33
|
-
if (
|
|
36
|
+
let { clientWidth: t, clientHeight: n, scrollWidth: r, scrollHeight: i } = e, a = n - T.offsetTop;
|
|
37
|
+
if (M.value = i > n + 1, M.value) {
|
|
34
38
|
let e = n / i;
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
if (
|
|
39
|
+
P.value = Math.max(20, e * a);
|
|
40
|
+
}
|
|
41
|
+
if (F.value = r > t + 1, F.value) {
|
|
38
42
|
let e = t / r;
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
},
|
|
43
|
-
|
|
43
|
+
L.value = Math.max(20, e * t);
|
|
44
|
+
}
|
|
45
|
+
G();
|
|
46
|
+
}, ae = (e) => {
|
|
47
|
+
G(), E("scroll", e), oe(e);
|
|
48
|
+
}, oe = (e) => {
|
|
49
|
+
let t = k.value;
|
|
50
|
+
if (!t) return;
|
|
51
|
+
let { scrollTop: n, scrollLeft: r, clientWidth: i, clientHeight: a, scrollWidth: o, scrollHeight: s } = t, c = T.distance;
|
|
52
|
+
M.value && n + a >= s - c && E("reachedEnd", e, "y"), F.value && r + i >= o - c && E("reachedEnd", e, "x");
|
|
53
|
+
}, G = () => {
|
|
54
|
+
let e = k.value;
|
|
44
55
|
if (!e) return;
|
|
45
|
-
let { scrollTop: t, scrollLeft: n, clientWidth: r, clientHeight: i, scrollWidth: a, scrollHeight: o } = e;
|
|
46
|
-
if (
|
|
56
|
+
let { scrollTop: t, scrollLeft: n, clientWidth: r, clientHeight: i, scrollWidth: a, scrollHeight: o } = e, s = i - T.offsetTop;
|
|
57
|
+
if (M.value) {
|
|
47
58
|
let e = o - i;
|
|
48
|
-
|
|
59
|
+
N.value = (e <= 0 ? 0 : t / e) * (s - P.value);
|
|
49
60
|
}
|
|
50
|
-
if (
|
|
61
|
+
if (F.value) {
|
|
51
62
|
let e = a - r;
|
|
52
|
-
|
|
63
|
+
I.value = (e <= 0 ? 0 : n / e) * (r - L.value);
|
|
53
64
|
}
|
|
54
|
-
},
|
|
55
|
-
|
|
56
|
-
},
|
|
57
|
-
if (!
|
|
58
|
-
let t =
|
|
59
|
-
if (
|
|
60
|
-
let e = t.clientHeight -
|
|
61
|
-
|
|
65
|
+
}, K = (e, t) => {
|
|
66
|
+
k.value && (t === "y" && !A.value || t === "x" && !j.value || (R.value = !0, z.value = t, B = t === "y" ? e.clientY : e.clientX, V = t === "y" ? N.value : I.value, e.preventDefault(), e.stopPropagation()));
|
|
67
|
+
}, q = (e) => {
|
|
68
|
+
if (!R.value || !z.value || !k.value) return;
|
|
69
|
+
let t = k.value, n = z.value === "y" ? e.clientY - B : e.clientX - B;
|
|
70
|
+
if (z.value === "y") {
|
|
71
|
+
let e = t.clientHeight - T.offsetTop - P.value, r = Math.max(0, Math.min(e, V + n));
|
|
72
|
+
N.value = r, t.scrollTop = (e <= 0 ? 0 : r / e) * (t.scrollHeight - t.clientHeight);
|
|
62
73
|
}
|
|
63
|
-
if (
|
|
64
|
-
let e = t.clientWidth -
|
|
65
|
-
|
|
74
|
+
if (z.value === "x") {
|
|
75
|
+
let e = t.clientWidth - L.value, r = Math.max(0, Math.min(e, V + n));
|
|
76
|
+
I.value = r, t.scrollLeft = (e <= 0 ? 0 : r / e) * (t.scrollWidth - t.clientWidth);
|
|
66
77
|
}
|
|
67
|
-
},
|
|
68
|
-
|
|
69
|
-
},
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
78
|
+
}, J = () => {
|
|
79
|
+
R.value = !1, z.value = "";
|
|
80
|
+
}, Y = m(null), X = m(null);
|
|
81
|
+
p(() => {
|
|
82
|
+
ee(() => {
|
|
83
|
+
W(), U();
|
|
73
84
|
});
|
|
74
|
-
let e =
|
|
75
|
-
e && (
|
|
76
|
-
requestAnimationFrame(
|
|
77
|
-
}),
|
|
78
|
-
requestAnimationFrame(
|
|
79
|
-
}),
|
|
85
|
+
let e = k.value?.parentElement;
|
|
86
|
+
e && (Y.value = new ResizeObserver(() => {
|
|
87
|
+
requestAnimationFrame(U);
|
|
88
|
+
}), Y.value.observe(e)), k.value && (X.value = new MutationObserver(() => {
|
|
89
|
+
requestAnimationFrame(U);
|
|
90
|
+
}), X.value.observe(k.value, {
|
|
80
91
|
childList: !0,
|
|
81
92
|
subtree: !0,
|
|
82
93
|
attributes: !0
|
|
83
|
-
})), document.addEventListener("mousemove",
|
|
84
|
-
}),
|
|
85
|
-
|
|
86
|
-
}),
|
|
87
|
-
() =>
|
|
88
|
-
() =>
|
|
89
|
-
() =>
|
|
90
|
-
() =>
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
+
})), document.addEventListener("mousemove", q), document.addEventListener("mouseup", J);
|
|
95
|
+
}), te(() => {
|
|
96
|
+
H && clearTimeout(H), Y.value?.disconnect(), X.value?.disconnect(), document.removeEventListener("mousemove", q), document.removeEventListener("mouseup", J);
|
|
97
|
+
}), re([
|
|
98
|
+
() => T.width,
|
|
99
|
+
() => T.height,
|
|
100
|
+
() => T.maxHeight,
|
|
101
|
+
() => T.padding,
|
|
102
|
+
() => T.offsetTop
|
|
103
|
+
], U);
|
|
104
|
+
let Z = (e = 0, t = 0, n = !1) => {
|
|
105
|
+
let r = k.value;
|
|
94
106
|
if (!r) return;
|
|
95
107
|
let i = Math.max(0, r.scrollHeight - r.clientHeight), a = Math.max(0, r.scrollWidth - r.clientWidth);
|
|
96
108
|
r.scrollTo({
|
|
97
109
|
top: Math.min(e, i),
|
|
98
110
|
left: Math.min(t, a),
|
|
99
111
|
behavior: n ? "smooth" : "auto"
|
|
100
|
-
}),
|
|
112
|
+
}), G(), requestAnimationFrame(G);
|
|
101
113
|
};
|
|
102
|
-
|
|
103
|
-
scrollTo:
|
|
114
|
+
d({
|
|
115
|
+
scrollTo: Z,
|
|
104
116
|
scrollToEl: (e, t = !0) => {
|
|
105
|
-
let n =
|
|
117
|
+
let n = k.value;
|
|
106
118
|
if (!n) return;
|
|
107
119
|
let r = n.querySelector(`#${e}`);
|
|
108
|
-
r &&
|
|
120
|
+
r && Z(r.offsetTop, 0, t);
|
|
121
|
+
},
|
|
122
|
+
scrollToEnd: (e = "y", t = !0) => {
|
|
123
|
+
let n = k.value;
|
|
124
|
+
n && (e === "y" ? Z(n.scrollHeight, 0, t) : Z(0, n.scrollWidth, t));
|
|
109
125
|
}
|
|
110
126
|
});
|
|
111
|
-
let
|
|
112
|
-
return
|
|
113
|
-
let t =
|
|
114
|
-
|
|
115
|
-
width: n(
|
|
116
|
-
height: n(
|
|
117
|
-
}), m(K, [t.e("content")]), g(K, {
|
|
118
|
-
padding: l.padding,
|
|
119
|
-
maxHeight: n(l.maxHeight)
|
|
120
|
-
}), ae(K, "id", l.id || b);
|
|
121
|
-
}), h(K, null, 0), c(), te(K, "scroll", L), W(K, x, null, "contentRef"), h(G, q, 1), o(() => l.backtop, () => a(v(n), {
|
|
122
|
-
target: () => `#${l.id || b}`,
|
|
123
|
-
$: [() => l.backtopProps]
|
|
124
|
-
}, () => c("backtop", null, null, 4))), W(X, S, null, "thumbYRef"), r(J, () => w.value), J.$evtmousedown = s((e) => R(e, "y")), W($, C, null, "thumbXRef"), r(Z, () => D.value), Z.$evtmousedown = s((e) => R(e, "x")), ie(() => {
|
|
125
|
-
let e = v(y), t = [e.e("track")], n = [e.e("thumb")];
|
|
126
|
-
m(J, [
|
|
127
|
-
e.e("scroll-bar"),
|
|
128
|
-
e.e("y"),
|
|
129
|
-
{ [e.m("always")]: l.always }
|
|
130
|
-
]), m(Y, t), m(X, n), g(X, {
|
|
131
|
-
top: T.value + "px",
|
|
132
|
-
height: E.value + "px"
|
|
133
|
-
}), m(Z, [
|
|
134
|
-
e.e("scroll-bar"),
|
|
135
|
-
e.e("x"),
|
|
136
|
-
{ [e.m("always")]: l.always }
|
|
137
|
-
]), m(Q, t), m($, n), g($, {
|
|
138
|
-
left: O.value + "px",
|
|
139
|
-
width: k.value + "px"
|
|
127
|
+
let Q = l(), $ = w();
|
|
128
|
+
return h(() => {
|
|
129
|
+
let t = x(D), n = x(e);
|
|
130
|
+
g($, [t.b(), t.is("dragging", R.value)]), y($, {
|
|
131
|
+
width: n(u.width),
|
|
132
|
+
height: n(u.height)
|
|
140
133
|
});
|
|
141
|
-
}),
|
|
134
|
+
}), _($, null, 0), o(() => u.native, () => {
|
|
135
|
+
let t = S();
|
|
136
|
+
return h(() => {
|
|
137
|
+
g(t, [x(D).e("content")]), y(t, {
|
|
138
|
+
padding: u.padding,
|
|
139
|
+
maxHeight: x(e)(u.maxHeight)
|
|
140
|
+
}), v(t, "id", u.id || O);
|
|
141
|
+
}), _(t, null, 0), c(), t;
|
|
142
|
+
}, () => {
|
|
143
|
+
let t = S();
|
|
144
|
+
return h(() => {
|
|
145
|
+
g(t, [x(D).e("scroll-content")]), y(t, {
|
|
146
|
+
padding: u.padding,
|
|
147
|
+
maxHeight: x(e)(u.maxHeight)
|
|
148
|
+
}), v(t, "id", u.id || O);
|
|
149
|
+
}), _(t, null, 0), c(), f(t, "scroll", ae), Q(t, k, null, "contentRef"), t;
|
|
150
|
+
}, 261), _($, null, 1), o(() => u.backtop, () => a(x(n), {
|
|
151
|
+
target: () => `#${u.id || O}`,
|
|
152
|
+
$: [() => u.backtopProps]
|
|
153
|
+
}, () => c("backtop", null, null, 4))), _($, null, 2), o(() => !u.native, () => {
|
|
154
|
+
let e = ie(), t = i(e), n = i(t), a = C(), o = i(a), c = i(o);
|
|
155
|
+
return Q(n, A, null, "thumbYRef"), r(e, () => M.value), e.$evtmousedown = s((e) => K(e, "y")), Q(c, j, null, "thumbXRef"), r(a, () => F.value), a.$evtmousedown = s((e) => K(e, "x")), h(() => {
|
|
156
|
+
let r = x(D), i = u.offsetTop, s = [r.e("track")], l = [r.e("thumb")];
|
|
157
|
+
g(e, [
|
|
158
|
+
r.e("scroll-bar"),
|
|
159
|
+
r.e("y"),
|
|
160
|
+
{ [r.m("always")]: u.always }
|
|
161
|
+
]), y(e, {
|
|
162
|
+
top: i ? i + "px" : void 0,
|
|
163
|
+
height: i ? `calc(100% - ${i}px)` : void 0
|
|
164
|
+
}), g(t, s), g(n, l), y(n, {
|
|
165
|
+
top: N.value + "px",
|
|
166
|
+
height: P.value + "px"
|
|
167
|
+
}), g(a, [
|
|
168
|
+
r.e("scroll-bar"),
|
|
169
|
+
r.e("x"),
|
|
170
|
+
{ [r.m("always")]: u.always }
|
|
171
|
+
]), g(o, s), g(c, l), y(c, {
|
|
172
|
+
left: I.value + "px",
|
|
173
|
+
width: L.value + "px"
|
|
174
|
+
});
|
|
175
|
+
}), [e, a];
|
|
176
|
+
}, null, 2), $;
|
|
142
177
|
}
|
|
143
178
|
});
|
|
144
179
|
//#endregion
|
|
145
|
-
export {
|
|
180
|
+
export { T as default };
|
|
@@ -16,6 +16,12 @@ export interface ScrollbarProps {
|
|
|
16
16
|
backtop?: boolean;
|
|
17
17
|
/** 返回顶部按钮属性 */
|
|
18
18
|
backtopProps?: BackTopProps;
|
|
19
|
+
/** 竖向滚动条距顶部偏移 */
|
|
20
|
+
offsetTop?: number;
|
|
21
|
+
/** 是否使用原生滚动条 */
|
|
22
|
+
native?: boolean;
|
|
23
|
+
/** 到达滚动条末尾距离 */
|
|
24
|
+
distance?: number;
|
|
19
25
|
}
|
|
20
26
|
export interface ScrollbarSlots {
|
|
21
27
|
/** 默认 */
|
|
@@ -23,9 +29,17 @@ export interface ScrollbarSlots {
|
|
|
23
29
|
/** 返回顶部按钮 */
|
|
24
30
|
backtop?: () => any;
|
|
25
31
|
}
|
|
32
|
+
export interface ScrollbarEmits {
|
|
33
|
+
/** 滚动事件 */
|
|
34
|
+
scroll: [e: Event];
|
|
35
|
+
/** 到达滚动条末尾事件 */
|
|
36
|
+
reachedEnd: [e: Event, direction: "x" | "y"];
|
|
37
|
+
}
|
|
26
38
|
export interface ScrollbarExpose {
|
|
27
39
|
/** 滚动到指定位置 */
|
|
28
|
-
scrollTo: (top: number, left
|
|
40
|
+
scrollTo: (top: number, left?: number, smooth?: boolean) => void;
|
|
29
41
|
/** 滚动到指定元素 */
|
|
30
42
|
scrollToEl: (id: string, smooth?: boolean) => void;
|
|
43
|
+
/** 滚动到底部或最右边 */
|
|
44
|
+
scrollToEnd: (direction?: "y" | "x", smooth?: boolean) => void;
|
|
31
45
|
}
|