@aplus-frontend/ui 0.4.3 → 0.4.5
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 +170 -162
- package/es/src/business/ap-select-layout/select-layout.vue2.mjs +52 -56
- package/es/src/business/ap-summary/ap-summary.vue.d.ts +0 -1
- package/es/src/business/ap-summary/ap-summary.vue2.mjs +36 -35
- package/es/src/business/ap-summary/index.d.ts +0 -3
- package/es/src/business/ap-table-modal/table-modal.vue2.mjs +8 -4
- package/es/src/business/batch-input-group/form-item.vue.d.ts +9 -1
- package/es/src/business/batch-input-group/form-item.vue.mjs +48 -44
- package/es/src/config-provider/hooks/use-namespace.d.ts +1 -1
- package/es/src/config-provider/hooks/use-namespace.mjs +3 -3
- package/es/src/hooks/index.d.ts +2 -0
- package/es/src/hooks/index.mjs +7 -3
- package/es/src/hooks/useManualRef.d.ts +6 -0
- package/es/src/hooks/useManualRef.mjs +27 -0
- package/es/src/hooks/useThrottleRef.d.ts +2 -0
- package/es/src/hooks/useThrottleRef.mjs +31 -0
- package/es/src/index.d.ts +1 -1
- package/es/src/index.mjs +227 -222
- package/es/src/locale/lang/en.mjs +3 -0
- package/es/src/locale/lang/zh-cn.mjs +3 -0
- package/es/src/path-map.mjs +1 -1
- package/es/src/scroll-bar/hooks/use-track.d.ts +30 -0
- package/es/src/scroll-bar/hooks/use-track.mjs +76 -0
- package/es/src/scroll-bar/index.d.ts +5 -0
- package/es/src/scroll-bar/index.mjs +7 -0
- package/es/src/scroll-bar/index.vue.d.ts +53 -0
- package/es/src/scroll-bar/index.vue.mjs +90 -0
- package/es/src/scroll-bar/index.vue2.mjs +4 -0
- package/es/src/scroll-bar/interface.d.ts +66 -0
- package/es/src/scroll-bar/internal.vue.d.ts +22 -0
- package/es/src/scroll-bar/internal.vue.mjs +132 -0
- package/es/src/scroll-bar/internal.vue2.mjs +4 -0
- package/es/src/scroll-bar/style/css.js +1 -0
- package/es/src/scroll-bar/style/index.js +1 -0
- package/es/src/scroll-bar/utils/index.d.ts +29 -0
- package/es/src/scroll-bar/utils/index.mjs +22 -0
- package/lib/index.js +1 -1
- package/lib/src/business/ap-select-layout/select-layout.vue2.js +1 -1
- package/lib/src/business/ap-summary/ap-summary.vue.d.ts +0 -1
- package/lib/src/business/ap-summary/ap-summary.vue2.js +1 -1
- package/lib/src/business/ap-summary/index.d.ts +0 -3
- package/lib/src/business/ap-table-modal/table-modal.vue2.js +1 -1
- package/lib/src/business/batch-input-group/form-item.vue.d.ts +9 -1
- package/lib/src/business/batch-input-group/form-item.vue.js +1 -1
- package/lib/src/config-provider/hooks/use-namespace.d.ts +1 -1
- package/lib/src/config-provider/hooks/use-namespace.js +1 -1
- package/lib/src/hooks/index.d.ts +2 -0
- package/lib/src/hooks/index.js +1 -1
- package/lib/src/hooks/useManualRef.d.ts +6 -0
- package/lib/src/hooks/useManualRef.js +1 -0
- package/lib/src/hooks/useThrottleRef.d.ts +2 -0
- package/lib/src/hooks/useThrottleRef.js +1 -0
- package/lib/src/index.d.ts +1 -1
- package/lib/src/index.js +1 -1
- package/lib/src/locale/lang/en.js +1 -1
- package/lib/src/locale/lang/zh-cn.js +1 -1
- package/lib/src/path-map.js +1 -1
- package/lib/src/scroll-bar/hooks/use-track.d.ts +30 -0
- package/lib/src/scroll-bar/hooks/use-track.js +1 -0
- package/lib/src/scroll-bar/index.d.ts +5 -0
- package/lib/src/scroll-bar/index.js +1 -0
- package/lib/src/scroll-bar/index.vue.d.ts +53 -0
- package/lib/src/scroll-bar/index.vue.js +1 -0
- package/lib/src/scroll-bar/index.vue2.js +1 -0
- package/lib/src/scroll-bar/interface.d.ts +66 -0
- package/lib/src/scroll-bar/internal.vue.d.ts +22 -0
- package/lib/src/scroll-bar/internal.vue.js +1 -0
- package/lib/src/scroll-bar/internal.vue2.js +1 -0
- package/lib/src/scroll-bar/style/css.cjs +1 -0
- package/lib/src/scroll-bar/style/index.cjs +1 -0
- package/lib/src/scroll-bar/utils/index.d.ts +29 -0
- package/lib/src/scroll-bar/utils/index.js +1 -0
- package/package.json +1 -1
- package/theme/index.css +36 -21
- package/theme/index.less +1 -1
- package/theme/scroll-bar/index.css +46 -0
- package/theme/scroll-bar/index.less +62 -0
- package/es/src/ap-scroll-bar/ap-scroll-bar.vue.d.ts +0 -8
- package/es/src/ap-scroll-bar/ap-scroll-bar.vue.mjs +0 -4
- package/es/src/ap-scroll-bar/ap-scroll-bar.vue2.mjs +0 -116
- package/es/src/ap-scroll-bar/index.d.ts +0 -29
- package/es/src/ap-scroll-bar/index.mjs +0 -8
- package/es/src/ap-scroll-bar/interface.d.ts +0 -4
- package/es/src/ap-scroll-bar/style/css.js +0 -1
- package/es/src/ap-scroll-bar/style/index.js +0 -1
- package/lib/src/ap-scroll-bar/ap-scroll-bar.vue.d.ts +0 -8
- package/lib/src/ap-scroll-bar/ap-scroll-bar.vue.js +0 -1
- package/lib/src/ap-scroll-bar/ap-scroll-bar.vue2.js +0 -1
- package/lib/src/ap-scroll-bar/index.d.ts +0 -29
- package/lib/src/ap-scroll-bar/index.js +0 -1
- package/lib/src/ap-scroll-bar/interface.d.ts +0 -4
- package/lib/src/ap-scroll-bar/style/css.cjs +0 -1
- package/lib/src/ap-scroll-bar/style/index.cjs +0 -1
- /package/es/src/{ap-scroll-bar → scroll-bar}/interface.mjs +0 -0
- /package/es/src/{ap-scroll-bar → scroll-bar}/style/css.d.ts +0 -0
- /package/es/src/{ap-scroll-bar → scroll-bar}/style/index.d.ts +0 -0
- /package/lib/src/{ap-scroll-bar → scroll-bar}/interface.js +0 -0
- /package/lib/src/{ap-scroll-bar → scroll-bar}/style/css.d.ts +0 -0
- /package/lib/src/{ap-scroll-bar → scroll-bar}/style/index.d.ts +0 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
@import '../mixins/mixins.less';
|
|
2
|
+
@import '../mixins/config.less';
|
|
3
|
+
|
|
4
|
+
@bar: ~'@{ns}-scroll-bar__bar--disabled';
|
|
5
|
+
@bc: ~'--@{ns}-scroll-bar-bar-color';
|
|
6
|
+
@tc: ~'--@{ns}-scroll-bar-track-color';
|
|
7
|
+
@bw: ~'--@{ns}-scroll-bar-bar-width';
|
|
8
|
+
@tw: ~'--@{ns}-scroll-bar-track-width';
|
|
9
|
+
|
|
10
|
+
.b('scroll-bar', {
|
|
11
|
+
position: relative;
|
|
12
|
+
|
|
13
|
+
&--horizontal {
|
|
14
|
+
width: 100%;
|
|
15
|
+
height: var(@tw, 10px);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
&--vertical {
|
|
19
|
+
width: var(@tw, 10px);
|
|
20
|
+
height: 100%;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&__track {
|
|
24
|
+
position: absolute;
|
|
25
|
+
width: 100%;
|
|
26
|
+
height: 100%;
|
|
27
|
+
top: 0;
|
|
28
|
+
inset-inline-start: 0;
|
|
29
|
+
cursor: pointer;
|
|
30
|
+
background-color: var(@tc, rgb(0 0 0 / 5%));
|
|
31
|
+
&--disabled {
|
|
32
|
+
pointer-events: none;
|
|
33
|
+
background-color: rgb(0 0 0 / 2%);
|
|
34
|
+
}
|
|
35
|
+
&--hidden {
|
|
36
|
+
pointer-events: none;
|
|
37
|
+
background-color: transparent;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&__bar {
|
|
42
|
+
position: absolute;
|
|
43
|
+
border-radius: var(@bw, 8px);
|
|
44
|
+
background-color: var(@bc, #c7c8cc);
|
|
45
|
+
cursor: pointer;
|
|
46
|
+
|
|
47
|
+
&--disabled {
|
|
48
|
+
pointer-events: none;
|
|
49
|
+
box-shadow: none;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
&--horizontal {
|
|
53
|
+
height: var(@bw, 8px);
|
|
54
|
+
top: calc(var(@tw, 10px) - var(@bw, 8px));
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
&--vertical {
|
|
58
|
+
width: var(@bw, 8px);
|
|
59
|
+
left: calc(var(@tw, 10px) / 2 - var(@bw, 8px) / 2);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
});
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ApScrollBarProps } from './interface';
|
|
2
|
-
import { DefineComponent, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
|
|
3
|
-
declare const _default: DefineComponent<ApScrollBarProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ApScrollBarProps> & Readonly<{}>, {
|
|
4
|
-
type: "horizontal" | "vertical";
|
|
5
|
-
}, {}, {}, {}, string, ComponentProvideOptions, false, {
|
|
6
|
-
containerRef: HTMLDivElement;
|
|
7
|
-
}, HTMLDivElement>;
|
|
8
|
-
export default _default;
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { defineComponent as O, ref as a, nextTick as $, onMounted as Q, watch as Z, onUnmounted as ee, openBlock as te, createElementBlock as le, normalizeClass as N, unref as u, normalizeStyle as U, createElementVNode as oe } from "vue";
|
|
2
|
-
import "../config-provider/index.mjs";
|
|
3
|
-
import { Subject as ae, fromEvent as v, map as _, takeUntil as h, throttleTime as X, concatAll as Y, withLatestFrom as ne } from "rxjs";
|
|
4
|
-
import { useNamespace as ce } from "../config-provider/hooks/use-namespace.mjs";
|
|
5
|
-
const ve = /* @__PURE__ */ O({
|
|
6
|
-
__name: "ap-scroll-bar",
|
|
7
|
-
props: {
|
|
8
|
-
target: {},
|
|
9
|
-
type: {
|
|
10
|
-
default: "horizontal"
|
|
11
|
-
}
|
|
12
|
-
},
|
|
13
|
-
setup(j) {
|
|
14
|
-
const o = j, r = a(), H = a(0), T = a(0), p = a(0), d = a(0), g = a(), y = a(), b = a(), W = a(), t = a(), w = a(!1), f = new ae(), z = a();
|
|
15
|
-
let k = 0, B = 0;
|
|
16
|
-
const E = (e) => e / y.value, S = (e) => e * y.value, R = () => {
|
|
17
|
-
if (t.value)
|
|
18
|
-
if (o.type === "horizontal") {
|
|
19
|
-
const e = t.value.scrollWidth, l = t.value.clientWidth;
|
|
20
|
-
w.value = l >= e;
|
|
21
|
-
} else {
|
|
22
|
-
const e = t.value.scrollHeight, l = t.value.clientHeight;
|
|
23
|
-
w.value = l >= e;
|
|
24
|
-
}
|
|
25
|
-
}, L = () => {
|
|
26
|
-
if (t.value && r.value)
|
|
27
|
-
if (o.type === "horizontal") {
|
|
28
|
-
const e = t.value.scrollWidth, l = t.value.clientWidth, n = t.value.scrollLeft, s = r.value.clientWidth;
|
|
29
|
-
g.value = l / e, y.value = s / e, H.value = Math.round(s * g.value), p.value = S(n);
|
|
30
|
-
} else {
|
|
31
|
-
const e = t.value.scrollHeight, l = t.value.clientHeight, n = t.value.scrollTop, s = r.value.clientHeight;
|
|
32
|
-
g.value = l / e, y.value = s / e, T.value = Math.floor(s * g.value), d.value = E(n);
|
|
33
|
-
}
|
|
34
|
-
}, P = () => {
|
|
35
|
-
const e = v(W.value, "mousedown"), l = v(b.value, "mousemove"), n = v(b.value, "mouseup"), s = v(b.value, "selectstart");
|
|
36
|
-
e.pipe(_(() => s.pipe(h(n), h(f), X(16))), Y()).subscribe((c) => c.preventDefault()), e.pipe(_(() => l.pipe(h(n), h(f), X(16))), Y(), ne(e), _(([c, x]) => {
|
|
37
|
-
console.log("move!!!", c);
|
|
38
|
-
const m = c, i = x, C = m.pageX - z.value.left - i.offsetX, M = m.pageY - z.value.top - i.offsetY, J = r.value.clientWidth, K = r.value.clientHeight;
|
|
39
|
-
return {
|
|
40
|
-
x: C > 0 ? Math.min(C, J - H.value) : Math.max(C, 0),
|
|
41
|
-
y: M > 0 ? Math.min(M, K - T.value) : Math.max(M, 0)
|
|
42
|
-
};
|
|
43
|
-
})).subscribe((c) => {
|
|
44
|
-
var x, m;
|
|
45
|
-
if (o.type === "horizontal") {
|
|
46
|
-
const i = E(c.x);
|
|
47
|
-
c.x !== p.value && t.value && ((x = t.value) == null || x.scrollTo({
|
|
48
|
-
left: i
|
|
49
|
-
})), p.value = c.x;
|
|
50
|
-
} else {
|
|
51
|
-
const i = E(c.y);
|
|
52
|
-
c.y !== d.value && t.value && ((m = t.value) == null || m.scrollTo({
|
|
53
|
-
top: i
|
|
54
|
-
})), d.value = c.y;
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
}, q = () => {
|
|
58
|
-
t.value && v(t.value, "scroll").pipe(h(f)).subscribe((l) => {
|
|
59
|
-
var s;
|
|
60
|
-
const n = l.target;
|
|
61
|
-
n && o.type === "horizontal" && (k = n.scrollLeft, p.value = S(k)), n && o.type === "vertical" && B !== ((s = t == null ? void 0 : t.value) == null ? void 0 : s.scrollTop) && (B = n.scrollTop, d.value = S(B));
|
|
62
|
-
});
|
|
63
|
-
}, A = () => {
|
|
64
|
-
v(window, "resize").pipe(h(f)).subscribe(() => {
|
|
65
|
-
R(), $(() => {
|
|
66
|
-
var l;
|
|
67
|
-
z.value = (l = r.value) == null ? void 0 : l.getBoundingClientRect(), L();
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
}, F = () => {
|
|
71
|
-
console.log("targetEle.value", t.value), t.value && W.value && (R(), $(() => {
|
|
72
|
-
var e;
|
|
73
|
-
z.value = (e = r.value) == null ? void 0 : e.getBoundingClientRect(), L(), P(), q(), A();
|
|
74
|
-
}));
|
|
75
|
-
};
|
|
76
|
-
Q(() => {
|
|
77
|
-
Z(() => o.target, () => {
|
|
78
|
-
$(() => {
|
|
79
|
-
var e, l;
|
|
80
|
-
typeof o.target == "string" ? t.value = document.querySelector(o.target) : t.value = (e = o.target) == null ? void 0 : e.call(o), b.value = (l = document.getElementsByTagName("body")) == null ? void 0 : l[0], W.value = document.getElementById("bar"), F();
|
|
81
|
-
});
|
|
82
|
-
}, {
|
|
83
|
-
immediate: !0
|
|
84
|
-
});
|
|
85
|
-
}), ee(() => {
|
|
86
|
-
f.next(0);
|
|
87
|
-
});
|
|
88
|
-
const {
|
|
89
|
-
b: V,
|
|
90
|
-
e: G,
|
|
91
|
-
m: D,
|
|
92
|
-
em: I
|
|
93
|
-
} = ce("ap-scroll-bar");
|
|
94
|
-
return (e, l) => (te(), le("div", {
|
|
95
|
-
ref_key: "containerRef",
|
|
96
|
-
ref: r,
|
|
97
|
-
class: N(`${u(V)()} ${o.type === "horizontal" ? u(D)("horizontal") : u(D)("vertical")}`),
|
|
98
|
-
style: U({
|
|
99
|
-
display: w.value ? "none" : "block"
|
|
100
|
-
})
|
|
101
|
-
}, [oe("div", {
|
|
102
|
-
id: "bar",
|
|
103
|
-
class: N(`${u(G)("bar")} ${o.type === "horizontal" ? u(I)("bar", "horizontal") : u(I)("bar", "vertical")}`),
|
|
104
|
-
style: U(o.type === "horizontal" ? {
|
|
105
|
-
width: `${H.value}px`,
|
|
106
|
-
left: `${p.value}px`
|
|
107
|
-
} : {
|
|
108
|
-
height: `${T.value}px`,
|
|
109
|
-
top: `${d.value}px`
|
|
110
|
-
})
|
|
111
|
-
}, null, 6)], 6));
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
export {
|
|
115
|
-
ve as default
|
|
116
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { CreateComponentPublicInstanceWithMixins, ComponentOptionsMixin, PublicProps, GlobalComponents, GlobalDirectives, ComponentProvideOptions, ComponentOptionsBase, VNodeProps, AllowedComponentProps, ComponentCustomProps, Plugin } from 'vue';
|
|
2
|
-
import { ApScrollBarProps } from './interface';
|
|
3
|
-
export * from './interface';
|
|
4
|
-
declare const ApScrollBar: {
|
|
5
|
-
new (...args: any[]): CreateComponentPublicInstanceWithMixins<Readonly< ApScrollBarProps> & Readonly<{}>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, PublicProps, {
|
|
6
|
-
type: "horizontal" | "vertical";
|
|
7
|
-
}, false, {}, {}, GlobalComponents, GlobalDirectives, string, {
|
|
8
|
-
containerRef: HTMLDivElement;
|
|
9
|
-
}, HTMLDivElement, ComponentProvideOptions, {
|
|
10
|
-
P: {};
|
|
11
|
-
B: {};
|
|
12
|
-
D: {};
|
|
13
|
-
C: {};
|
|
14
|
-
M: {};
|
|
15
|
-
Defaults: {};
|
|
16
|
-
}, Readonly< ApScrollBarProps> & Readonly<{}>, {}, {}, {}, {}, {
|
|
17
|
-
type: "horizontal" | "vertical";
|
|
18
|
-
}>;
|
|
19
|
-
__isFragment?: never;
|
|
20
|
-
__isTeleport?: never;
|
|
21
|
-
__isSuspense?: never;
|
|
22
|
-
} & ComponentOptionsBase<Readonly< ApScrollBarProps> & Readonly<{}>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, {
|
|
23
|
-
type: "horizontal" | "vertical";
|
|
24
|
-
}, {}, string, {}, GlobalComponents, GlobalDirectives, string, ComponentProvideOptions> & VNodeProps & AllowedComponentProps & ComponentCustomProps & ( Plugin & (new (...args: any[]) => {
|
|
25
|
-
$props: {
|
|
26
|
-
onClick?: () => void;
|
|
27
|
-
};
|
|
28
|
-
}));
|
|
29
|
-
export { ApScrollBar };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '@aplus-frontend/ui/theme/ap-scroll-bar/index.css';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '@aplus-frontend/ui/theme/ap-scroll-bar/index.less';
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ApScrollBarProps } from './interface';
|
|
2
|
-
import { DefineComponent, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
|
|
3
|
-
declare const _default: DefineComponent<ApScrollBarProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ApScrollBarProps> & Readonly<{}>, {
|
|
4
|
-
type: "horizontal" | "vertical";
|
|
5
|
-
}, {}, {}, {}, string, ComponentProvideOptions, false, {
|
|
6
|
-
containerRef: HTMLDivElement;
|
|
7
|
-
}, HTMLDivElement>;
|
|
8
|
-
export default _default;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./ap-scroll-bar.vue2.js");exports.default=e.default;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue");require("../config-provider/index.js");const o=require("rxjs"),X=require("../config-provider/hooks/use-namespace.js"),Y=e.defineComponent({__name:"ap-scroll-bar",props:{target:{},type:{default:"horizontal"}},setup($){const a=$,i=e.ref(),z=e.ref(0),T=e.ref(0),v=e.ref(0),f=e.ref(0),d=e.ref(),p=e.ref(),g=e.ref(),x=e.ref(),l=e.ref(),E=e.ref(!1),h=new o.Subject,y=e.ref();let w=0,H=0;const W=t=>t/p.value,k=t=>t*p.value,B=()=>{if(l.value)if(a.type==="horizontal"){const t=l.value.scrollWidth,n=l.value.clientWidth;E.value=n>=t}else{const t=l.value.scrollHeight,n=l.value.clientHeight;E.value=n>=t}},C=()=>{if(l.value&&i.value)if(a.type==="horizontal"){const t=l.value.scrollWidth,n=l.value.clientWidth,r=l.value.scrollLeft,s=i.value.clientWidth;d.value=n/t,p.value=s/t,z.value=Math.round(s*d.value),v.value=k(r)}else{const t=l.value.scrollHeight,n=l.value.clientHeight,r=l.value.scrollTop,s=i.value.clientHeight;d.value=n/t,p.value=s/t,T.value=Math.floor(s*d.value),f.value=W(r)}},R=()=>{const t=o.fromEvent(x.value,"mousedown"),n=o.fromEvent(g.value,"mousemove"),r=o.fromEvent(g.value,"mouseup"),s=o.fromEvent(g.value,"selectstart");t.pipe(o.map(()=>s.pipe(o.takeUntil(r),o.takeUntil(h),o.throttleTime(16))),o.concatAll()).subscribe(c=>c.preventDefault()),t.pipe(o.map(()=>n.pipe(o.takeUntil(r),o.takeUntil(h),o.throttleTime(16))),o.concatAll(),o.withLatestFrom(t),o.map(([c,b])=>{console.log("move!!!",c);const m=c,u=b,S=m.pageX-y.value.left-u.offsetX,M=m.pageY-y.value.top-u.offsetY,I=i.value.clientWidth,P=i.value.clientHeight;return{x:S>0?Math.min(S,I-z.value):Math.max(S,0),y:M>0?Math.min(M,P-T.value):Math.max(M,0)}})).subscribe(c=>{var b,m;if(a.type==="horizontal"){const u=W(c.x);c.x!==v.value&&l.value&&((b=l.value)==null||b.scrollTo({left:u})),v.value=c.x}else{const u=W(c.y);c.y!==f.value&&l.value&&((m=l.value)==null||m.scrollTo({top:u})),f.value=c.y}})},q=()=>{l.value&&o.fromEvent(l.value,"scroll").pipe(o.takeUntil(h)).subscribe(n=>{var s;const r=n.target;r&&a.type==="horizontal"&&(w=r.scrollLeft,v.value=k(w)),r&&a.type==="vertical"&&H!==((s=l==null?void 0:l.value)==null?void 0:s.scrollTop)&&(H=r.scrollTop,f.value=k(H))})},L=()=>{o.fromEvent(window,"resize").pipe(o.takeUntil(h)).subscribe(()=>{B(),e.nextTick(()=>{var n;y.value=(n=i.value)==null?void 0:n.getBoundingClientRect(),C()})})},j=()=>{console.log("targetEle.value",l.value),l.value&&x.value&&(B(),e.nextTick(()=>{var t;y.value=(t=i.value)==null?void 0:t.getBoundingClientRect(),C(),R(),q(),L()}))};e.onMounted(()=>{e.watch(()=>a.target,()=>{e.nextTick(()=>{var t,n;typeof a.target=="string"?l.value=document.querySelector(a.target):l.value=(t=a.target)==null?void 0:t.call(a),g.value=(n=document.getElementsByTagName("body"))==null?void 0:n[0],x.value=document.getElementById("bar"),j()})},{immediate:!0})}),e.onUnmounted(()=>{h.next(0)});const{b:N,e:D,m:_,em:U}=X.useNamespace("ap-scroll-bar");return(t,n)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"containerRef",ref:i,class:e.normalizeClass(`${e.unref(N)()} ${a.type==="horizontal"?e.unref(_)("horizontal"):e.unref(_)("vertical")}`),style:e.normalizeStyle({display:E.value?"none":"block"})},[e.createElementVNode("div",{id:"bar",class:e.normalizeClass(`${e.unref(D)("bar")} ${a.type==="horizontal"?e.unref(U)("bar","horizontal"):e.unref(U)("bar","vertical")}`),style:e.normalizeStyle(a.type==="horizontal"?{width:`${z.value}px`,left:`${v.value}px`}:{height:`${T.value}px`,top:`${f.value}px`})},null,6)],6))}});exports.default=Y;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { CreateComponentPublicInstanceWithMixins, ComponentOptionsMixin, PublicProps, GlobalComponents, GlobalDirectives, ComponentProvideOptions, ComponentOptionsBase, VNodeProps, AllowedComponentProps, ComponentCustomProps, Plugin } from 'vue';
|
|
2
|
-
import { ApScrollBarProps } from './interface';
|
|
3
|
-
export * from './interface';
|
|
4
|
-
declare const ApScrollBar: {
|
|
5
|
-
new (...args: any[]): CreateComponentPublicInstanceWithMixins<Readonly< ApScrollBarProps> & Readonly<{}>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, PublicProps, {
|
|
6
|
-
type: "horizontal" | "vertical";
|
|
7
|
-
}, false, {}, {}, GlobalComponents, GlobalDirectives, string, {
|
|
8
|
-
containerRef: HTMLDivElement;
|
|
9
|
-
}, HTMLDivElement, ComponentProvideOptions, {
|
|
10
|
-
P: {};
|
|
11
|
-
B: {};
|
|
12
|
-
D: {};
|
|
13
|
-
C: {};
|
|
14
|
-
M: {};
|
|
15
|
-
Defaults: {};
|
|
16
|
-
}, Readonly< ApScrollBarProps> & Readonly<{}>, {}, {}, {}, {}, {
|
|
17
|
-
type: "horizontal" | "vertical";
|
|
18
|
-
}>;
|
|
19
|
-
__isFragment?: never;
|
|
20
|
-
__isTeleport?: never;
|
|
21
|
-
__isSuspense?: never;
|
|
22
|
-
} & ComponentOptionsBase<Readonly< ApScrollBarProps> & Readonly<{}>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, {
|
|
23
|
-
type: "horizontal" | "vertical";
|
|
24
|
-
}, {}, string, {}, GlobalComponents, GlobalDirectives, string, ComponentProvideOptions> & VNodeProps & AllowedComponentProps & ComponentCustomProps & ( Plugin & (new (...args: any[]) => {
|
|
25
|
-
$props: {
|
|
26
|
-
onClick?: () => void;
|
|
27
|
-
};
|
|
28
|
-
}));
|
|
29
|
-
export { ApScrollBar };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./interface.js");const e=require("@aplus-frontend/utils");require("./ap-scroll-bar.vue.js");const r=require("./ap-scroll-bar.vue2.js"),t=e.withInstall(r.default);exports.ApScrollBar=t;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '@aplus-frontend/ui/theme/ap-scroll-bar/index.css';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '@aplus-frontend/ui/theme/ap-scroll-bar/index.less';
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|