@aplus-frontend/ui 0.4.9 → 0.4.11
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/es/index.mjs +42 -36
- package/es/src/ap-field/date/index.vue.mjs +98 -65
- package/es/src/ap-field/date-range/index.vue.mjs +98 -70
- package/es/src/ap-field/hooks/use-date-timezone.d.ts +7 -0
- package/es/src/ap-field/hooks/use-date-timezone.mjs +10 -0
- package/es/src/ap-field/hooks/use-default-presets.d.ts +3 -2
- package/es/src/ap-field/hooks/use-default-presets.mjs +8 -8
- package/es/src/ap-field/interface.d.ts +8 -2
- package/es/src/business/ap-ladder/ApLadder.vue.d.ts +6 -2
- package/es/src/business/ap-ladder/ApLadder.vue2.mjs +118 -95
- package/es/src/business/ap-ladder/index.d.ts +3 -1
- package/es/src/full-screen/index.d.ts +3 -0
- package/es/src/full-screen/index.mjs +2 -0
- package/es/src/full-screen/index.vue.d.ts +43 -0
- package/es/src/full-screen/index.vue.mjs +84 -0
- package/es/src/full-screen/index.vue2.mjs +4 -0
- package/es/src/full-screen/interface.d.ts +50 -0
- package/es/src/full-screen/interface.mjs +1 -0
- package/es/src/full-screen/style/css.d.ts +0 -0
- package/es/src/full-screen/style/css.js +1 -0
- package/es/src/full-screen/style/index.d.ts +0 -0
- package/es/src/full-screen/style/index.js +1 -0
- package/es/src/hooks/index.d.ts +1 -0
- package/es/src/hooks/index.mjs +6 -4
- package/es/src/hooks/useFullScreen.d.ts +8 -0
- package/es/src/hooks/useFullScreen.mjs +50 -0
- package/es/src/index.d.ts +2 -0
- package/es/src/index.mjs +243 -237
- package/es/src/path-map.mjs +3 -1
- package/es/src/portal/index.d.ts +3 -0
- package/es/src/portal/index.mjs +2 -0
- package/es/src/portal/index.vue.d.ts +18 -0
- package/es/src/portal/index.vue.mjs +21 -0
- package/es/src/portal/index.vue2.mjs +4 -0
- package/es/src/portal/interface.d.ts +2 -0
- package/es/src/portal/interface.mjs +1 -0
- package/es/src/portal/style/css.d.ts +1 -0
- package/es/src/portal/style/css.js +1 -0
- package/es/src/portal/style/index.d.ts +1 -0
- package/es/src/portal/style/index.js +1 -0
- package/es/src/scroll-view/hooks/use-scroll-back.d.ts +26 -0
- package/es/src/scroll-view/hooks/use-scroll-back.mjs +37 -0
- package/es/src/scroll-view/hooks/use-scroll-smooth.d.ts +26 -0
- package/es/src/scroll-view/hooks/use-scroll-smooth.mjs +50 -0
- package/es/src/scroll-view/index.vue.d.ts +12 -3
- package/es/src/scroll-view/index.vue.mjs +172 -120
- package/es/src/scroll-view/interface.d.ts +40 -0
- package/es/src/scroll-view/utils/index.d.ts +11 -0
- package/es/src/scroll-view/utils/index.mjs +18 -0
- package/lib/index.js +1 -1
- package/lib/src/ap-field/date/index.vue.js +1 -1
- package/lib/src/ap-field/date-range/index.vue.js +1 -1
- package/lib/src/ap-field/hooks/use-date-timezone.d.ts +7 -0
- package/lib/src/ap-field/hooks/use-date-timezone.js +1 -0
- package/lib/src/ap-field/hooks/use-default-presets.d.ts +3 -2
- package/lib/src/ap-field/hooks/use-default-presets.js +1 -1
- package/lib/src/ap-field/interface.d.ts +8 -2
- package/lib/src/business/ap-ladder/ApLadder.vue.d.ts +6 -2
- package/lib/src/business/ap-ladder/ApLadder.vue2.js +1 -1
- package/lib/src/business/ap-ladder/index.d.ts +3 -1
- package/lib/src/full-screen/index.d.ts +3 -0
- package/lib/src/full-screen/index.js +1 -0
- package/lib/src/full-screen/index.vue.d.ts +43 -0
- package/lib/src/full-screen/index.vue.js +1 -0
- package/lib/src/full-screen/index.vue2.js +1 -0
- package/lib/src/full-screen/interface.d.ts +50 -0
- package/lib/src/full-screen/interface.js +1 -0
- package/lib/src/full-screen/style/css.cjs +1 -0
- package/lib/src/full-screen/style/css.d.ts +0 -0
- package/lib/src/full-screen/style/index.cjs +1 -0
- package/lib/src/full-screen/style/index.d.ts +0 -0
- package/lib/src/hooks/index.d.ts +1 -0
- package/lib/src/hooks/index.js +1 -1
- package/lib/src/hooks/useFullScreen.d.ts +8 -0
- package/lib/src/hooks/useFullScreen.js +1 -0
- package/lib/src/index.d.ts +2 -0
- package/lib/src/index.js +1 -1
- package/lib/src/path-map.js +1 -1
- package/lib/src/portal/index.d.ts +3 -0
- package/lib/src/portal/index.js +1 -0
- package/lib/src/portal/index.vue.d.ts +18 -0
- package/lib/src/portal/index.vue.js +1 -0
- package/lib/src/portal/index.vue2.js +1 -0
- package/lib/src/portal/interface.d.ts +2 -0
- package/lib/src/portal/interface.js +1 -0
- package/lib/src/portal/style/css.cjs +1 -0
- package/lib/src/portal/style/css.d.ts +1 -0
- package/lib/src/portal/style/index.cjs +1 -0
- package/lib/src/portal/style/index.d.ts +1 -0
- package/lib/src/scroll-view/hooks/use-scroll-back.d.ts +26 -0
- package/lib/src/scroll-view/hooks/use-scroll-back.js +1 -0
- package/lib/src/scroll-view/hooks/use-scroll-smooth.d.ts +26 -0
- package/lib/src/scroll-view/hooks/use-scroll-smooth.js +1 -0
- package/lib/src/scroll-view/index.vue.d.ts +12 -3
- package/lib/src/scroll-view/index.vue.js +1 -1
- package/lib/src/scroll-view/interface.d.ts +40 -0
- package/lib/src/scroll-view/utils/index.d.ts +11 -0
- package/lib/src/scroll-view/utils/index.js +1 -0
- package/package.json +3 -3
- package/theme/ap-form/ap-form-item.css +4 -0
- package/theme/ap-form/ap-form-item.less +7 -0
- package/theme/ap-form/index.css +18 -0
- package/theme/ap-form/item-text-group.css +14 -0
- package/theme/ap-form/item-text-group.less +11 -1
- package/theme/ap-form/item-text.css +14 -0
- package/theme/ap-form/search-form.css +4 -0
- package/theme/ap-table/ap-table.css +18 -0
- package/theme/ap-table-modal/index.css +18 -0
- package/theme/editable-table/index.css +18 -0
- package/theme/full-screen/index.css +6 -0
- package/theme/full-screen/index.less +12 -0
- package/theme/index.css +24 -0
- package/theme/index.less +1 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { DefineComponent, TeleportProps, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
|
|
2
|
+
declare function __VLS_template(): {
|
|
3
|
+
attrs: Partial<{}>;
|
|
4
|
+
slots: {
|
|
5
|
+
default?(_: {}): any;
|
|
6
|
+
};
|
|
7
|
+
refs: {};
|
|
8
|
+
rootEl: any;
|
|
9
|
+
};
|
|
10
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
11
|
+
declare const __VLS_component: DefineComponent<Partial< TeleportProps>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<Partial< TeleportProps>> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
12
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
13
|
+
export default _default;
|
|
14
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
15
|
+
new (): {
|
|
16
|
+
$slots: S;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { defineComponent as r, openBlock as n, createBlock as p, Teleport as a, mergeProps as l, renderSlot as s } from "vue";
|
|
2
|
+
const m = /* @__PURE__ */ r({
|
|
3
|
+
name: "Portal",
|
|
4
|
+
__name: "index",
|
|
5
|
+
props: {
|
|
6
|
+
to: {},
|
|
7
|
+
disabled: { type: Boolean },
|
|
8
|
+
defer: { type: Boolean }
|
|
9
|
+
},
|
|
10
|
+
setup(o) {
|
|
11
|
+
const t = o;
|
|
12
|
+
return (e, d) => (n(), p(a, l(t, {
|
|
13
|
+
to: e.to || "body"
|
|
14
|
+
}), [
|
|
15
|
+
s(e.$slots, "default")
|
|
16
|
+
], 16, ["to"]));
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
export {
|
|
20
|
+
m as default
|
|
21
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ScrollBarDirection } from '../../scroll-bar';
|
|
2
|
+
import { Ref } from 'vue';
|
|
3
|
+
type ScrollBackOptions = {
|
|
4
|
+
scrollOffset: {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
};
|
|
8
|
+
maxScrollDistance: {
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
};
|
|
12
|
+
timer?: number;
|
|
13
|
+
onScroll?: (direction: ScrollBarDirection) => void;
|
|
14
|
+
onScrollEnd?: (direction: ScrollBarDirection) => void;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* 在特定的时间内滚动到0
|
|
18
|
+
* @param options
|
|
19
|
+
* @returns
|
|
20
|
+
*/
|
|
21
|
+
declare const useScrollBack: ({ scrollOffset, maxScrollDistance, timer, onScroll, onScrollEnd }: ScrollBackOptions) => {
|
|
22
|
+
start: (direction: ScrollBarDirection) => void;
|
|
23
|
+
stop: () => void;
|
|
24
|
+
isActive: Readonly< Ref<boolean, boolean>>;
|
|
25
|
+
};
|
|
26
|
+
export { useScrollBack };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import "../../scroll-bar/index.mjs";
|
|
2
|
+
import { useRafFn as x } from "@vueuse/core";
|
|
3
|
+
import { ensureRangeValue as u } from "../../scroll-bar/utils/index.mjs";
|
|
4
|
+
const m = {
|
|
5
|
+
horizontal: "x",
|
|
6
|
+
vertical: "y"
|
|
7
|
+
}, p = () => {
|
|
8
|
+
}, M = (e) => 1 - Math.pow(1 - e, 3), y = ({
|
|
9
|
+
scrollOffset: e,
|
|
10
|
+
maxScrollDistance: d,
|
|
11
|
+
timer: l = 500,
|
|
12
|
+
onScroll: n = p,
|
|
13
|
+
onScrollEnd: f = p
|
|
14
|
+
}) => {
|
|
15
|
+
let a, t, i;
|
|
16
|
+
const { pause: r, resume: g, isActive: h } = x(
|
|
17
|
+
() => {
|
|
18
|
+
const o = Date.now(), s = m[t], T = o - a, c = u(T / l, 0, 1), v = M(c);
|
|
19
|
+
c === 1 ? (e[s] = 0, r(), n(t), f(t)) : (e[s] = u(
|
|
20
|
+
i * (1 - v),
|
|
21
|
+
0,
|
|
22
|
+
d[s]
|
|
23
|
+
), n(t));
|
|
24
|
+
},
|
|
25
|
+
{ immediate: !1 }
|
|
26
|
+
);
|
|
27
|
+
function w(o) {
|
|
28
|
+
t = o, a = Date.now(), i = e[m[o]], g();
|
|
29
|
+
}
|
|
30
|
+
function D() {
|
|
31
|
+
r();
|
|
32
|
+
}
|
|
33
|
+
return { start: w, stop: D, isActive: h };
|
|
34
|
+
};
|
|
35
|
+
export {
|
|
36
|
+
y as useScrollBack
|
|
37
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ScrollOffsetType } from '../interface';
|
|
2
|
+
import { Ref } from 'vue';
|
|
3
|
+
type ScrollBackOptions = {
|
|
4
|
+
scrollOffset: {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
};
|
|
8
|
+
maxScrollDistance: {
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
};
|
|
12
|
+
timer?: number;
|
|
13
|
+
onScroll?: (x: boolean, y: boolean) => void;
|
|
14
|
+
onScrollEnd?: (x: boolean, y: boolean) => void;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* 在特定的时间内滚动到0
|
|
18
|
+
* @param options
|
|
19
|
+
* @returns
|
|
20
|
+
*/
|
|
21
|
+
declare const useScrollSmooth: ({ scrollOffset, maxScrollDistance, timer, onScroll, onScrollEnd }: ScrollBackOptions) => {
|
|
22
|
+
start: (target: Partial<ScrollOffsetType>) => void;
|
|
23
|
+
stop: () => void;
|
|
24
|
+
isActive: Readonly< Ref<boolean, boolean>>;
|
|
25
|
+
};
|
|
26
|
+
export { useScrollSmooth };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import "../../scroll-bar/index.mjs";
|
|
2
|
+
import { useRafFn as R } from "@vueuse/core";
|
|
3
|
+
import { isDef as f } from "../../utils/index.mjs";
|
|
4
|
+
import { ensureRangeValue as s } from "../../scroll-bar/utils/index.mjs";
|
|
5
|
+
const g = () => {
|
|
6
|
+
}, b = (i) => 1 - Math.pow(1 - i, 3), V = ({
|
|
7
|
+
scrollOffset: i,
|
|
8
|
+
maxScrollDistance: r,
|
|
9
|
+
timer: l = 500,
|
|
10
|
+
onScroll: u = g,
|
|
11
|
+
onScrollEnd: T = g
|
|
12
|
+
}) => {
|
|
13
|
+
let m, e, t, o, n;
|
|
14
|
+
const { pause: a, resume: w, isActive: p } = R(
|
|
15
|
+
() => {
|
|
16
|
+
const v = Date.now() - m, c = s(v / l, 0, 1), y = b(c);
|
|
17
|
+
c === 1 ? (o && (i.x = t.x), n && (i.y = t.y), a(), u(o, n), T(o, n)) : (o && (t.x > e.x ? i.x = s(
|
|
18
|
+
e.x + (t.x - e.x) * y,
|
|
19
|
+
e.x,
|
|
20
|
+
r.x
|
|
21
|
+
) : i.x = s(
|
|
22
|
+
t.x + (e.x - t.x) * (1 - y),
|
|
23
|
+
0,
|
|
24
|
+
e.x
|
|
25
|
+
)), n && (t.y > e.y ? i.y = s(
|
|
26
|
+
e.y + (t.y - e.y) * y,
|
|
27
|
+
e.y,
|
|
28
|
+
r.y
|
|
29
|
+
) : i.y = s(
|
|
30
|
+
t.y + (e.y - t.y) * (1 - y),
|
|
31
|
+
0,
|
|
32
|
+
e.y
|
|
33
|
+
)), u(o, n));
|
|
34
|
+
},
|
|
35
|
+
{ immediate: !1 }
|
|
36
|
+
);
|
|
37
|
+
function d(x) {
|
|
38
|
+
p.value && a(), m = Date.now(), e = {
|
|
39
|
+
x: i.x,
|
|
40
|
+
y: i.y
|
|
41
|
+
}, t = x, o = f(x.x), n = f(x.y), w();
|
|
42
|
+
}
|
|
43
|
+
function h() {
|
|
44
|
+
a();
|
|
45
|
+
}
|
|
46
|
+
return { start: d, stop: h, isActive: p };
|
|
47
|
+
};
|
|
48
|
+
export {
|
|
49
|
+
V as useScrollSmooth
|
|
50
|
+
};
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import { ScrollViewProps } from './interface';
|
|
1
|
+
import { ScrollOptions, ScrollViewProps } from './interface';
|
|
2
2
|
import { ScrollBarDirection, InternalScrollBarProps } from '../scroll-bar';
|
|
3
|
-
import { CreateComponentPublicInstanceWithMixins, Ref, ComponentOptionsMixin, PublicProps, GlobalComponents, GlobalDirectives, ComponentProvideOptions, DefineComponent } from 'vue';
|
|
3
|
+
import { CreateComponentPublicInstanceWithMixins, Ref, ComponentOptionsMixin, PublicProps, GlobalComponents, GlobalDirectives, ComponentProvideOptions, DefineComponent, ComputedRef } from 'vue';
|
|
4
|
+
declare function scroll(x?: number, y?: number): void;
|
|
5
|
+
declare function scrollTo({ smooth, left, top }: ScrollOptions): void;
|
|
6
|
+
declare function scrollIntoView(element: HTMLElement, position?: 'start' | 'center' | 'end'): void;
|
|
4
7
|
declare function __VLS_template(): {
|
|
5
8
|
attrs: Partial<{}>;
|
|
6
9
|
slots: {
|
|
@@ -89,7 +92,13 @@ declare function __VLS_template(): {
|
|
|
89
92
|
rootEl: HTMLDivElement;
|
|
90
93
|
};
|
|
91
94
|
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
92
|
-
declare const __VLS_component: DefineComponent<ScrollViewProps, {
|
|
95
|
+
declare const __VLS_component: DefineComponent<ScrollViewProps, {
|
|
96
|
+
scrollTop: ComputedRef<number>;
|
|
97
|
+
scrollLeft: ComputedRef<number>;
|
|
98
|
+
scroll: typeof scroll;
|
|
99
|
+
scrollTo: typeof scrollTo;
|
|
100
|
+
scrollIntoView: typeof scrollIntoView;
|
|
101
|
+
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ScrollViewProps> & Readonly<{}>, {
|
|
93
102
|
showXBar: boolean;
|
|
94
103
|
showYBar: boolean;
|
|
95
104
|
xBarProps: {
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as fe, ref as ue, reactive as he, computed as v, unref as l, watchEffect as _, watch as pe, openBlock as P, createElementBlock as ye, normalizeClass as B, normalizeStyle as M, withModifiers as A, createElementVNode as z, renderSlot as me, createBlock as L, mergeProps as O, createCommentVNode as T } from "vue";
|
|
2
2
|
import "../config-provider/index.mjs";
|
|
3
3
|
import "../scroll-bar/index.mjs";
|
|
4
|
-
import { isDef as
|
|
5
|
-
import { ensureRangeValue as
|
|
6
|
-
import
|
|
7
|
-
import { isString as
|
|
8
|
-
import { useElementSize as
|
|
9
|
-
import { wait as
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
12
|
-
|
|
4
|
+
import { isDef as f } from "../utils/index.mjs";
|
|
5
|
+
import { ensureRangeValue as n, getScrollable as k } from "../scroll-bar/utils/index.mjs";
|
|
6
|
+
import de from "./hooks/use-scroll-wrapper.mjs";
|
|
7
|
+
import { isString as j } from "lodash-unified";
|
|
8
|
+
import { useElementSize as F, useRafFn as ve } from "@vueuse/core";
|
|
9
|
+
import { wait as R } from "@aplus-frontend/utils";
|
|
10
|
+
import { useScrollBack as xe } from "./hooks/use-scroll-back.mjs";
|
|
11
|
+
import { useScrollSmooth as Be } from "./hooks/use-scroll-smooth.mjs";
|
|
12
|
+
import { getElementScrollOffset as we } from "./utils/index.mjs";
|
|
13
|
+
import { useNamespace as ge } from "../config-provider/hooks/use-namespace.mjs";
|
|
14
|
+
import H from "../scroll-bar/internal.vue.mjs";
|
|
15
|
+
const Ye = /* @__PURE__ */ fe({
|
|
13
16
|
name: "ScrollView",
|
|
14
17
|
__name: "index",
|
|
15
18
|
props: {
|
|
@@ -22,180 +25,229 @@ const Pe = /* @__PURE__ */ re({
|
|
|
22
25
|
yBarProps: { default: () => ({}) },
|
|
23
26
|
onWheel: {}
|
|
24
27
|
},
|
|
25
|
-
setup(
|
|
26
|
-
const
|
|
28
|
+
setup(I, { expose: q }) {
|
|
29
|
+
const o = I, G = {
|
|
27
30
|
direction: "vertical",
|
|
28
31
|
rate: 1,
|
|
29
32
|
repeat: !0
|
|
30
|
-
}, { b:
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
}, { b: J, e: w, em: W } = ge("scroll-view"), u = ue(), c = he({ x: 30, y: 30 });
|
|
34
|
+
let g = !1;
|
|
35
|
+
const {
|
|
36
|
+
scrollOffset: r,
|
|
37
|
+
maxScrollDistance: i,
|
|
38
|
+
xBarRef: K,
|
|
39
|
+
yBarRef: Q,
|
|
40
|
+
containerRef: s,
|
|
41
|
+
scrollYBar: h,
|
|
42
|
+
scrollXBar: p,
|
|
43
|
+
updateMaxScrollDistance: U
|
|
44
|
+
} = de(), { width: Z, height: ee } = F(u), { width: te, height: re } = F(s), { start: N } = xe({
|
|
45
|
+
scrollOffset: r,
|
|
46
|
+
maxScrollDistance: i,
|
|
47
|
+
onScroll: (t) => {
|
|
48
|
+
t === "horizontal" ? p() : h();
|
|
49
|
+
},
|
|
50
|
+
async onScrollEnd() {
|
|
51
|
+
await R(200), S();
|
|
52
|
+
}
|
|
53
|
+
}), { start: $ } = Be({
|
|
54
|
+
scrollOffset: r,
|
|
55
|
+
maxScrollDistance: i,
|
|
56
|
+
onScroll(t, e) {
|
|
57
|
+
V.value && (y(), g = !0), t && p(), e && h();
|
|
58
|
+
},
|
|
59
|
+
async onScrollEnd() {
|
|
60
|
+
g && (await R(200), S(), g = !1);
|
|
61
|
+
}
|
|
62
|
+
}), { resume: S, pause: y, isActive: V } = ve(
|
|
40
63
|
() => {
|
|
41
|
-
if (!
|
|
42
|
-
|
|
64
|
+
if (!o.autoPlay) {
|
|
65
|
+
y();
|
|
43
66
|
return;
|
|
44
67
|
}
|
|
45
|
-
const
|
|
46
|
-
...
|
|
47
|
-
...
|
|
68
|
+
const t = o.autoPlay === !0 ? {} : o.autoPlay, e = {
|
|
69
|
+
...G,
|
|
70
|
+
...t
|
|
48
71
|
};
|
|
49
|
-
if (
|
|
50
|
-
if (
|
|
51
|
-
|
|
72
|
+
if (e.direction === "horizontal") {
|
|
73
|
+
if (r.x === i.x) {
|
|
74
|
+
y(), e.repeat && N("horizontal");
|
|
52
75
|
return;
|
|
53
76
|
}
|
|
54
|
-
|
|
55
|
-
|
|
77
|
+
r.x = n(
|
|
78
|
+
r.x + e.rate,
|
|
56
79
|
0,
|
|
57
|
-
|
|
58
|
-
),
|
|
80
|
+
i.x
|
|
81
|
+
), p();
|
|
59
82
|
} else {
|
|
60
|
-
if (
|
|
61
|
-
|
|
83
|
+
if (r.y === i.y) {
|
|
84
|
+
y(), e.repeat && N("vertical");
|
|
62
85
|
return;
|
|
63
86
|
}
|
|
64
|
-
|
|
65
|
-
|
|
87
|
+
r.y = n(
|
|
88
|
+
r.y + e.rate,
|
|
66
89
|
0,
|
|
67
|
-
|
|
68
|
-
),
|
|
90
|
+
i.y
|
|
91
|
+
), h();
|
|
69
92
|
}
|
|
70
93
|
},
|
|
71
94
|
{ immediate: !0 }
|
|
72
|
-
),
|
|
73
|
-
width:
|
|
74
|
-
height:
|
|
75
|
-
padding: `${
|
|
95
|
+
), m = v(() => o.showXBar && c.x !== 100), x = v(() => o.showYBar && c.y !== 100), oe = v(() => ({
|
|
96
|
+
width: f(o.width) ? j(o.width) ? o.width : Number.isNaN(o.width) ? void 0 : `${o.width}px` : void 0,
|
|
97
|
+
height: f(o.heigth) ? j(o.heigth) ? o.heigth : Number.isNaN(o.heigth) ? void 0 : `${o.heigth}px` : void 0,
|
|
98
|
+
padding: `${o.xBarProps.trackWidth || 10}px ${o.yBarProps.trackWidth || 10}px`
|
|
76
99
|
}));
|
|
77
|
-
async function
|
|
78
|
-
|
|
100
|
+
async function b() {
|
|
101
|
+
V.value && (y(), await R(500), S());
|
|
79
102
|
}
|
|
80
|
-
async function
|
|
81
|
-
var
|
|
82
|
-
if (
|
|
83
|
-
|
|
103
|
+
async function ae(t) {
|
|
104
|
+
var e;
|
|
105
|
+
if (l(x))
|
|
106
|
+
t.preventDefault(), t.stopPropagation();
|
|
84
107
|
else
|
|
85
108
|
return;
|
|
86
|
-
|
|
87
|
-
|
|
109
|
+
r.y = n(
|
|
110
|
+
r.y + t.deltaY,
|
|
88
111
|
0,
|
|
89
|
-
|
|
90
|
-
),
|
|
112
|
+
i.y
|
|
113
|
+
), h(), (e = o.onWheel) == null || e.call(o, "vertical", r.y), b();
|
|
91
114
|
}
|
|
92
|
-
function
|
|
93
|
-
var
|
|
94
|
-
if (
|
|
95
|
-
|
|
115
|
+
function le(t) {
|
|
116
|
+
var e;
|
|
117
|
+
if (l(m))
|
|
118
|
+
t.preventDefault(), t.stopPropagation();
|
|
96
119
|
else
|
|
97
120
|
return;
|
|
98
|
-
|
|
99
|
-
|
|
121
|
+
r.x = n(
|
|
122
|
+
r.x + t.deltaX,
|
|
100
123
|
0,
|
|
101
|
-
|
|
102
|
-
),
|
|
124
|
+
i.x
|
|
125
|
+
), p(), (e = o.onWheel) == null || e.call(o, "horizontal", r.x), b();
|
|
103
126
|
}
|
|
104
|
-
function
|
|
105
|
-
if (
|
|
106
|
-
const { visibleSize:
|
|
107
|
-
|
|
127
|
+
function E() {
|
|
128
|
+
if (o.showYBar) {
|
|
129
|
+
const { visibleSize: t, totalSize: e } = k(
|
|
130
|
+
s.value,
|
|
108
131
|
"vertical"
|
|
109
132
|
);
|
|
110
|
-
|
|
111
|
-
Math.min(
|
|
133
|
+
c.y = n(
|
|
134
|
+
Math.min(t / (e || 1) * 100)
|
|
112
135
|
);
|
|
113
136
|
}
|
|
114
|
-
if (
|
|
115
|
-
const { visibleSize:
|
|
116
|
-
|
|
137
|
+
if (o.showXBar) {
|
|
138
|
+
const { visibleSize: t, totalSize: e } = k(
|
|
139
|
+
s.value,
|
|
117
140
|
"horizontal"
|
|
118
141
|
);
|
|
119
|
-
|
|
120
|
-
Math.min(
|
|
142
|
+
c.x = n(
|
|
143
|
+
Math.min(t / (e || 1) * 100)
|
|
121
144
|
);
|
|
122
145
|
}
|
|
123
146
|
}
|
|
124
|
-
function
|
|
125
|
-
const
|
|
126
|
-
if (!
|
|
127
|
-
const { visibleSize:
|
|
128
|
-
if (
|
|
129
|
-
const
|
|
130
|
-
if (
|
|
131
|
-
|
|
147
|
+
function X(t, e) {
|
|
148
|
+
const a = l(s), d = l(u);
|
|
149
|
+
if (!a || !d) return;
|
|
150
|
+
const { visibleSize: C, totalSize: D } = k(a, e);
|
|
151
|
+
if (D <= C) return;
|
|
152
|
+
const Y = (D - C) * t / 100, ce = e === "vertical";
|
|
153
|
+
if (b(), ce) {
|
|
154
|
+
r.y = Y;
|
|
132
155
|
return;
|
|
133
156
|
}
|
|
134
|
-
|
|
157
|
+
r.x = Y;
|
|
135
158
|
}
|
|
136
|
-
|
|
159
|
+
_(
|
|
137
160
|
() => {
|
|
138
|
-
|
|
161
|
+
l(s.value) && E();
|
|
139
162
|
},
|
|
140
163
|
{ flush: "post" }
|
|
141
|
-
),
|
|
164
|
+
), pe(
|
|
142
165
|
() => [
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
166
|
+
Z.value,
|
|
167
|
+
ee.value,
|
|
168
|
+
te.value,
|
|
169
|
+
re.value
|
|
147
170
|
],
|
|
148
171
|
() => {
|
|
149
|
-
|
|
172
|
+
E(), U();
|
|
150
173
|
}
|
|
151
|
-
),
|
|
152
|
-
|
|
153
|
-
})
|
|
174
|
+
), _(() => {
|
|
175
|
+
u.value && (u.value.style.transform = `translate3d(-${r.x}px, -${r.y}px, 0px)`);
|
|
176
|
+
});
|
|
177
|
+
function ie(t, e) {
|
|
178
|
+
f(t) && m.value && (r.x = n(t, 0, i.x), p()), f(e) && x.value && (r.y = n(e, 0, i.y), h());
|
|
179
|
+
}
|
|
180
|
+
function ne({ smooth: t, left: e, top: a }) {
|
|
181
|
+
t ? $({ x: e, y: a }) : (f(e) && (r.x = e), f(a) && (r.y = a));
|
|
182
|
+
}
|
|
183
|
+
function se(t, e = "start") {
|
|
184
|
+
const a = we(
|
|
185
|
+
s.value,
|
|
186
|
+
t,
|
|
187
|
+
e
|
|
188
|
+
), d = {};
|
|
189
|
+
m.value && (d.x = n(
|
|
190
|
+
r.x + a.x,
|
|
191
|
+
0,
|
|
192
|
+
i.x
|
|
193
|
+
)), x.value && (d.y = n(
|
|
194
|
+
r.y + a.y,
|
|
195
|
+
0,
|
|
196
|
+
i.y
|
|
197
|
+
)), $(d);
|
|
198
|
+
}
|
|
199
|
+
return q({
|
|
200
|
+
scrollTop: v(() => r.y),
|
|
201
|
+
scrollLeft: v(() => r.x),
|
|
202
|
+
scroll: ie,
|
|
203
|
+
scrollTo: ne,
|
|
204
|
+
scrollIntoView: se
|
|
205
|
+
}), (t, e) => (P(), ye("div", {
|
|
154
206
|
ref_key: "containerRef",
|
|
155
|
-
ref:
|
|
156
|
-
class:
|
|
157
|
-
style:
|
|
207
|
+
ref: s,
|
|
208
|
+
class: B(l(J)()),
|
|
209
|
+
style: M(oe.value),
|
|
158
210
|
onWheel: [
|
|
159
|
-
|
|
160
|
-
|
|
211
|
+
A(ae, ["exact"]),
|
|
212
|
+
A(le, ["shift"])
|
|
161
213
|
]
|
|
162
214
|
}, [
|
|
163
|
-
|
|
215
|
+
z("div", {
|
|
164
216
|
ref_key: "contentRef",
|
|
165
|
-
ref:
|
|
166
|
-
class:
|
|
217
|
+
ref: u,
|
|
218
|
+
class: B(l(w)("content"))
|
|
167
219
|
}, [
|
|
168
|
-
|
|
220
|
+
me(t.$slots, "default")
|
|
169
221
|
], 2),
|
|
170
|
-
|
|
171
|
-
class:
|
|
172
|
-
style:
|
|
222
|
+
z("div", {
|
|
223
|
+
class: B([l(w)("bar-wrapper"), l(W)("bar-wrapper", "vertical")]),
|
|
224
|
+
style: M(`height: calc(100% - ${m.value ? t.xBarProps.trackWidth || 10 : 0}px)`)
|
|
173
225
|
}, [
|
|
174
|
-
|
|
226
|
+
x.value ? (P(), L(l(H), O({
|
|
175
227
|
key: 0,
|
|
176
228
|
ref_key: "yBarRef",
|
|
177
|
-
ref:
|
|
178
|
-
},
|
|
179
|
-
"bar-length":
|
|
180
|
-
onScroll:
|
|
181
|
-
}), null, 16, ["bar-length"])) :
|
|
229
|
+
ref: Q
|
|
230
|
+
}, t.yBarProps, {
|
|
231
|
+
"bar-length": c.y,
|
|
232
|
+
onScroll: e[0] || (e[0] = (a) => X(a, "vertical"))
|
|
233
|
+
}), null, 16, ["bar-length"])) : T("", !0)
|
|
182
234
|
], 6),
|
|
183
|
-
|
|
184
|
-
class:
|
|
235
|
+
z("div", {
|
|
236
|
+
class: B([l(w)("bar-wrapper"), l(W)("bar-wrapper", "horizontal")])
|
|
185
237
|
}, [
|
|
186
|
-
|
|
238
|
+
m.value ? (P(), L(l(H), O({
|
|
187
239
|
key: 0,
|
|
188
240
|
ref_key: "xBarRef",
|
|
189
|
-
ref:
|
|
190
|
-
},
|
|
241
|
+
ref: K
|
|
242
|
+
}, t.xBarProps, {
|
|
191
243
|
direction: "horizontal",
|
|
192
|
-
"bar-length":
|
|
193
|
-
onScroll:
|
|
194
|
-
}), null, 16, ["bar-length"])) :
|
|
244
|
+
"bar-length": c.x,
|
|
245
|
+
onScroll: e[1] || (e[1] = (a) => X(a, "horizontal"))
|
|
246
|
+
}), null, 16, ["bar-length"])) : T("", !0)
|
|
195
247
|
], 2)
|
|
196
248
|
], 38));
|
|
197
249
|
}
|
|
198
250
|
});
|
|
199
251
|
export {
|
|
200
|
-
|
|
252
|
+
Ye as default
|
|
201
253
|
};
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { InternalScrollBarProps, ScrollBarDirection } from '../scroll-bar';
|
|
2
|
+
import { Ref } from 'vue';
|
|
2
3
|
type BarExtraProps = Omit<InternalScrollBarProps, 'direction' | 'scroll' | 'barLength'>;
|
|
4
|
+
export type ScrollOffsetType = {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
};
|
|
3
8
|
export type AutoPlayConfig = {
|
|
4
9
|
/**
|
|
5
10
|
* 自动滚动的方向
|
|
@@ -49,4 +54,39 @@ export interface ScrollViewProps {
|
|
|
49
54
|
*/
|
|
50
55
|
onWheel?: (direction: ScrollBarDirection, offset: number) => void;
|
|
51
56
|
}
|
|
57
|
+
export type ScrollOptions = {
|
|
58
|
+
top?: number;
|
|
59
|
+
left?: number;
|
|
60
|
+
smooth?: boolean;
|
|
61
|
+
};
|
|
62
|
+
export type ScrollViewExpose = {
|
|
63
|
+
/**
|
|
64
|
+
* 当前滚动距离顶部的位置
|
|
65
|
+
*/
|
|
66
|
+
scrollTop: Ref<number>;
|
|
67
|
+
/**
|
|
68
|
+
* 当前滚动距离左侧的位置
|
|
69
|
+
*/
|
|
70
|
+
scrollLeft: Ref<number>;
|
|
71
|
+
/**
|
|
72
|
+
* 滚动到指定位置
|
|
73
|
+
* @param x
|
|
74
|
+
* @param y
|
|
75
|
+
* @returns
|
|
76
|
+
*/
|
|
77
|
+
scroll: (x?: number, y?: number) => void;
|
|
78
|
+
/**
|
|
79
|
+
* 滚动到指定位置(支持指定平滑滚动)
|
|
80
|
+
* @param options
|
|
81
|
+
* @returns
|
|
82
|
+
*/
|
|
83
|
+
scrollTo: (options: ScrollOptions) => void;
|
|
84
|
+
/**
|
|
85
|
+
* 将子元素滚动到可视区域
|
|
86
|
+
* @param element
|
|
87
|
+
* @param position
|
|
88
|
+
* @returns
|
|
89
|
+
*/
|
|
90
|
+
scrollIntoView: (element: Element, position?: 'start' | 'center' | 'end') => void;
|
|
91
|
+
};
|
|
52
92
|
export {};
|