@king-one/antdv 1.0.22 → 1.0.24
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 +12 -0
- package/dist/es/components/base/style/index.mjs +1 -2
- package/dist/es/components/collapse-transtion/hooks/use-collapse-transtion.mjs +43 -110
- package/dist/es/components/collapse-transtion/index.mjs +11 -10
- package/dist/es/components/collapse-transtion/src/collapse-transtion.vue.mjs +4 -6
- package/dist/es/components/collapse-transtion/src/collapse-transtion.vue2.mjs +21 -27
- package/dist/es/components/collapse-transtion/src/types.mjs +5 -5
- package/dist/es/components/collapse-transtion/style/index.mjs +2 -3
- package/dist/es/components/form/component/form.mjs +4 -4
- package/dist/es/components/form/component/form.vue.mjs +4 -6
- package/dist/es/components/form/component/form.vue2.mjs +14 -19
- package/dist/es/components/form/index.mjs +10 -9
- package/dist/es/components/index.mjs +14 -10
- package/dist/es/components/pro-dialog/hooks/useProDialog.mjs +27 -42
- package/dist/es/components/pro-dialog/index.mjs +12 -11
- package/dist/es/components/pro-dialog/src/pro-dialog.vue.mjs +4 -6
- package/dist/es/components/pro-dialog/src/pro-dialog.vue2.mjs +18 -35
- package/dist/es/components/pro-dialog/src/types.mjs +6 -7
- package/dist/es/components/scale-virtual-list/component/scale-virtual-list.vue.mjs +4 -0
- package/dist/es/components/scale-virtual-list/component/scale-virtual-list.vue2.mjs +63 -0
- package/dist/es/components/scale-virtual-list/component/types.mjs +1 -0
- package/dist/es/components/scale-virtual-list/hooks/useVirtualList.mjs +156 -0
- package/dist/es/components/scale-virtual-list/index.mjs +10 -0
- package/dist/es/components/scale-virtual-list/style/index.mjs +2 -0
- package/dist/es/components/scroll-bar/index.mjs +9 -9
- package/dist/es/components/scroll-bar/src/scroll-bar.mjs +141 -358
- package/dist/es/components/scroll-bar/src/types.mjs +4 -4
- package/dist/es/components/utils/install.mjs +14 -14
- package/dist/es/components/virtual-list/index.mjs +10 -9
- package/dist/es/components/virtual-list/src/types.mjs +5 -5
- package/dist/es/components/virtual-list/src/virtual-list.vue.mjs +4 -6
- package/dist/es/components/virtual-list/src/virtual-list.vue2.mjs +74 -87
- package/dist/es/hooks/use-namespace/index.mjs +43 -72
- package/dist/es/index.mjs +30 -16
- package/dist/es/installer.mjs +12 -12
- package/dist/lib/components/base/style/index.js +1 -5
- package/dist/lib/components/collapse-transtion/hooks/use-collapse-transtion.js +1 -136
- package/dist/lib/components/collapse-transtion/index.js +1 -16
- package/dist/lib/components/collapse-transtion/src/collapse-transtion.vue.js +1 -10
- package/dist/lib/components/collapse-transtion/src/collapse-transtion.vue2.js +1 -34
- package/dist/lib/components/collapse-transtion/src/types.js +1 -11
- package/dist/lib/components/collapse-transtion/style/index.js +1 -6
- package/dist/lib/components/form/component/form.js +1 -13
- package/dist/lib/components/form/component/form.vue.js +1 -10
- package/dist/lib/components/form/component/form.vue2.js +1 -30
- package/dist/lib/components/form/index.js +1 -15
- package/dist/lib/components/index.js +1 -25
- package/dist/lib/components/pro-dialog/hooks/useProDialog.js +1 -52
- package/dist/lib/components/pro-dialog/index.js +1 -19
- package/dist/lib/components/pro-dialog/src/pro-dialog.vue.js +1 -10
- package/dist/lib/components/pro-dialog/src/pro-dialog.vue2.js +1 -42
- package/dist/lib/components/pro-dialog/src/types.js +1 -11
- package/dist/lib/components/scale-virtual-list/component/scale-virtual-list.vue.js +1 -0
- package/dist/lib/components/scale-virtual-list/component/scale-virtual-list.vue2.js +1 -0
- package/dist/lib/components/scale-virtual-list/component/types.js +1 -0
- package/dist/lib/components/scale-virtual-list/hooks/useVirtualList.js +1 -0
- package/dist/lib/components/scale-virtual-list/index.js +1 -0
- package/dist/lib/components/scale-virtual-list/style/index.js +1 -0
- package/dist/lib/components/scroll-bar/index.js +1 -15
- package/dist/lib/components/scroll-bar/src/scroll-bar.js +1 -390
- package/dist/lib/components/scroll-bar/src/types.js +1 -11
- package/dist/lib/components/utils/install.js +1 -22
- package/dist/lib/components/virtual-list/index.js +1 -15
- package/dist/lib/components/virtual-list/src/types.js +1 -32
- package/dist/lib/components/virtual-list/src/virtual-list.vue.js +1 -10
- package/dist/lib/components/virtual-list/src/virtual-list.vue2.js +1 -104
- package/dist/lib/hooks/use-namespace/index.js +1 -83
- package/dist/lib/index.js +1 -30
- package/dist/lib/installer.js +1 -19
- package/dist/theme-chalk/index.css +1 -1
- package/dist/theme-chalk/scale-virtual-list.css +1 -0
- package/dist/{es → types}/components/collapse-transtion/hooks/use-collapse-transtion.d.ts +2 -2
- package/dist/types/components/collapse-transtion/index.d.ts +41 -0
- package/dist/types/components/collapse-transtion/src/collapse-transtion.vue.d.ts +27 -0
- package/dist/{es → types}/components/collapse-transtion/src/types.d.ts +1 -1
- package/dist/{lib → types}/components/form/component/form.d.ts +2 -2
- package/dist/types/components/form/component/form.vue.d.ts +32 -0
- package/dist/types/components/form/index.d.ts +50 -0
- package/dist/{lib → types}/components/index.d.ts +2 -0
- package/dist/{lib → types}/components/pro-dialog/hooks/useProDialog.d.ts +2 -1
- package/dist/types/components/pro-dialog/index.d.ts +26 -0
- package/dist/types/components/pro-dialog/src/pro-dialog.vue.d.ts +24 -0
- package/dist/types/components/pro-dialog/src/types.d.ts +7 -0
- package/dist/types/components/scale-virtual-list/component/scale-virtual-list.vue.d.ts +28 -0
- package/dist/types/components/scale-virtual-list/component/types.d.ts +11 -0
- package/dist/types/components/scale-virtual-list/hooks/useVirtualList.d.ts +70 -0
- package/dist/types/components/scale-virtual-list/index.d.ts +67 -0
- package/dist/types/components/scroll-bar/index.d.ts +36 -0
- package/dist/types/components/scroll-bar/src/scroll-bar.d.ts +34 -0
- package/dist/{es → types}/components/scroll-bar/src/types.d.ts +1 -1
- package/dist/{lib → types}/components/utils/install.d.ts +1 -1
- package/dist/types/components/utils/tool.d.ts +1 -0
- package/dist/types/components/virtual-list/index.d.ts +163 -0
- package/dist/{es → types}/components/virtual-list/src/types.d.ts +2 -2
- package/dist/types/components/virtual-list/src/virtual-list.vue.d.ts +364 -0
- package/dist/{es → types}/index.d.ts +1 -1
- package/dist/{lib → types}/installer.d.ts +1 -1
- package/package.json +8 -3
- package/dist/cdn/index.cdn.js +0 -16
- package/dist/cdn/index.cdn.js.map +0 -1
- package/dist/cdn/index.cdn.mjs +0 -16
- package/dist/cdn/index.cdn.mjs.map +0 -1
- package/dist/cdn/index.css +0 -1
- package/dist/es/components/base/style/index.mjs.map +0 -1
- package/dist/es/components/collapse-transtion/hooks/use-collapse-transtion.mjs.map +0 -1
- package/dist/es/components/collapse-transtion/index.d.ts +0 -29
- package/dist/es/components/collapse-transtion/index.mjs.map +0 -1
- package/dist/es/components/collapse-transtion/src/collapse-transtion.vue.d.ts +0 -27
- package/dist/es/components/collapse-transtion/src/collapse-transtion.vue.mjs.map +0 -1
- package/dist/es/components/collapse-transtion/src/collapse-transtion.vue2.mjs.map +0 -1
- package/dist/es/components/collapse-transtion/src/types.mjs.map +0 -1
- package/dist/es/components/collapse-transtion/style/index.mjs.map +0 -1
- package/dist/es/components/form/component/form.d.ts +0 -10
- package/dist/es/components/form/component/form.mjs.map +0 -1
- package/dist/es/components/form/component/form.vue.d.ts +0 -16
- package/dist/es/components/form/component/form.vue.mjs.map +0 -1
- package/dist/es/components/form/component/form.vue2.mjs.map +0 -1
- package/dist/es/components/form/index.d.ts +0 -17
- package/dist/es/components/form/index.mjs.map +0 -1
- package/dist/es/components/form-item/component/form-item.vue.d.ts +0 -24
- package/dist/es/components/form-item/component/form-item.vue.mjs +0 -6
- package/dist/es/components/form-item/component/form-item.vue.mjs.map +0 -1
- package/dist/es/components/form-item/component/form-item.vue2.mjs +0 -128
- package/dist/es/components/form-item/component/form-item.vue2.mjs.map +0 -1
- package/dist/es/components/form-item/index.d.ts +0 -0
- package/dist/es/components/form-item/index.mjs +0 -2
- package/dist/es/components/form-item/index.mjs.map +0 -1
- package/dist/es/components/index.d.ts +0 -4
- package/dist/es/components/index.mjs.map +0 -1
- package/dist/es/components/pro-dialog/hooks/useProDialog.d.ts +0 -13
- package/dist/es/components/pro-dialog/hooks/useProDialog.mjs.map +0 -1
- package/dist/es/components/pro-dialog/index.d.ts +0 -1542
- package/dist/es/components/pro-dialog/index.mjs.map +0 -1
- package/dist/es/components/pro-dialog/src/pro-dialog.vue.d.ts +0 -1539
- package/dist/es/components/pro-dialog/src/pro-dialog.vue.mjs.map +0 -1
- package/dist/es/components/pro-dialog/src/pro-dialog.vue2.mjs.map +0 -1
- package/dist/es/components/pro-dialog/src/types.d.ts +0 -6
- package/dist/es/components/pro-dialog/src/types.mjs.map +0 -1
- package/dist/es/components/pro-dialog/style/index.mjs +0 -3
- package/dist/es/components/pro-dialog/style/index.mjs.map +0 -1
- package/dist/es/components/scroll-bar/index.d.ts +0 -35
- package/dist/es/components/scroll-bar/index.mjs.map +0 -1
- package/dist/es/components/scroll-bar/src/scroll-bar.d.ts +0 -33
- package/dist/es/components/scroll-bar/src/scroll-bar.mjs.map +0 -1
- package/dist/es/components/scroll-bar/src/types.mjs.map +0 -1
- package/dist/es/components/scroll-bar/style/index.mjs +0 -3
- package/dist/es/components/scroll-bar/style/index.mjs.map +0 -1
- package/dist/es/components/utils/install.d.ts +0 -7
- package/dist/es/components/utils/install.mjs.map +0 -1
- package/dist/es/components/virtual-list/index.d.ts +0 -312
- package/dist/es/components/virtual-list/index.mjs.map +0 -1
- package/dist/es/components/virtual-list/src/types.mjs.map +0 -1
- package/dist/es/components/virtual-list/src/virtual-list.vue.d.ts +0 -312
- package/dist/es/components/virtual-list/src/virtual-list.vue.mjs.map +0 -1
- package/dist/es/components/virtual-list/src/virtual-list.vue2.mjs.map +0 -1
- package/dist/es/hooks/use-namespace/index.d.ts +0 -23
- package/dist/es/hooks/use-namespace/index.mjs.map +0 -1
- package/dist/es/index.mjs.map +0 -1
- package/dist/es/installer.d.ts +0 -6
- package/dist/es/installer.mjs.map +0 -1
- package/dist/lib/components/base/style/index.js.map +0 -1
- package/dist/lib/components/collapse-transtion/hooks/use-collapse-transtion.d.ts +0 -12
- package/dist/lib/components/collapse-transtion/hooks/use-collapse-transtion.js.map +0 -1
- package/dist/lib/components/collapse-transtion/index.d.ts +0 -29
- package/dist/lib/components/collapse-transtion/index.js.map +0 -1
- package/dist/lib/components/collapse-transtion/src/collapse-transtion.vue.d.ts +0 -27
- package/dist/lib/components/collapse-transtion/src/collapse-transtion.vue.js.map +0 -1
- package/dist/lib/components/collapse-transtion/src/collapse-transtion.vue2.js.map +0 -1
- package/dist/lib/components/collapse-transtion/src/types.d.ts +0 -8
- package/dist/lib/components/collapse-transtion/src/types.js.map +0 -1
- package/dist/lib/components/collapse-transtion/style/index.js.map +0 -1
- package/dist/lib/components/form/component/form.js.map +0 -1
- package/dist/lib/components/form/component/form.vue.d.ts +0 -16
- package/dist/lib/components/form/component/form.vue.js.map +0 -1
- package/dist/lib/components/form/component/form.vue2.js.map +0 -1
- package/dist/lib/components/form/index.d.ts +0 -17
- package/dist/lib/components/form/index.js.map +0 -1
- package/dist/lib/components/form-item/component/form-item.vue.d.ts +0 -24
- package/dist/lib/components/form-item/component/form-item.vue.js +0 -10
- package/dist/lib/components/form-item/component/form-item.vue.js.map +0 -1
- package/dist/lib/components/form-item/component/form-item.vue2.js +0 -132
- package/dist/lib/components/form-item/component/form-item.vue2.js.map +0 -1
- package/dist/lib/components/form-item/index.d.ts +0 -0
- package/dist/lib/components/form-item/index.js +0 -3
- package/dist/lib/components/form-item/index.js.map +0 -1
- package/dist/lib/components/index.js.map +0 -1
- package/dist/lib/components/pro-dialog/hooks/useProDialog.js.map +0 -1
- package/dist/lib/components/pro-dialog/index.d.ts +0 -1542
- package/dist/lib/components/pro-dialog/index.js.map +0 -1
- package/dist/lib/components/pro-dialog/src/pro-dialog.vue.d.ts +0 -1539
- package/dist/lib/components/pro-dialog/src/pro-dialog.vue.js.map +0 -1
- package/dist/lib/components/pro-dialog/src/pro-dialog.vue2.js.map +0 -1
- package/dist/lib/components/pro-dialog/src/types.d.ts +0 -6
- package/dist/lib/components/pro-dialog/src/types.js.map +0 -1
- package/dist/lib/components/pro-dialog/style/index.js +0 -6
- package/dist/lib/components/pro-dialog/style/index.js.map +0 -1
- package/dist/lib/components/scroll-bar/index.d.ts +0 -35
- package/dist/lib/components/scroll-bar/index.js.map +0 -1
- package/dist/lib/components/scroll-bar/src/scroll-bar.d.ts +0 -33
- package/dist/lib/components/scroll-bar/src/scroll-bar.js.map +0 -1
- package/dist/lib/components/scroll-bar/src/types.d.ts +0 -7
- package/dist/lib/components/scroll-bar/src/types.js.map +0 -1
- package/dist/lib/components/scroll-bar/style/index.js +0 -6
- package/dist/lib/components/scroll-bar/style/index.js.map +0 -1
- package/dist/lib/components/utils/install.js.map +0 -1
- package/dist/lib/components/virtual-list/index.d.ts +0 -312
- package/dist/lib/components/virtual-list/index.js.map +0 -1
- package/dist/lib/components/virtual-list/src/types.d.ts +0 -39
- package/dist/lib/components/virtual-list/src/types.js.map +0 -1
- package/dist/lib/components/virtual-list/src/virtual-list.vue.d.ts +0 -312
- package/dist/lib/components/virtual-list/src/virtual-list.vue.js.map +0 -1
- package/dist/lib/components/virtual-list/src/virtual-list.vue2.js.map +0 -1
- package/dist/lib/hooks/use-namespace/index.d.ts +0 -23
- package/dist/lib/hooks/use-namespace/index.js.map +0 -1
- package/dist/lib/index.d.ts +0 -3
- package/dist/lib/index.js.map +0 -1
- package/dist/lib/installer.js.map +0 -1
|
@@ -1,386 +1,169 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { VResizeObserver } from
|
|
3
|
-
import { off, on } from
|
|
4
|
-
import { defaultNamespace } from
|
|
5
|
-
import { scrollbarProps } from
|
|
6
|
-
|
|
7
|
-
function _isSlot(s) {
|
|
8
|
-
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
9
|
-
}
|
|
10
|
-
var ScrollBar = /* @__PURE__ */ defineComponent({
|
|
1
|
+
import { defineComponent as ae, onMounted as ce, ref as a, computed as c } from "vue";
|
|
2
|
+
import { VResizeObserver as j } from "vueuc";
|
|
3
|
+
import { off as g, on as z } from "evtd";
|
|
4
|
+
import { defaultNamespace as u } from "../../../hooks/use-namespace/index.mjs";
|
|
5
|
+
import { scrollbarProps as ie } from "./types.mjs";
|
|
6
|
+
const ve = ae({
|
|
11
7
|
name: "KScrollbar",
|
|
12
|
-
props:
|
|
13
|
-
inheritAttrs:
|
|
14
|
-
setup(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
sync();
|
|
8
|
+
props: ie,
|
|
9
|
+
inheritAttrs: !1,
|
|
10
|
+
setup(l) {
|
|
11
|
+
ce(() => {
|
|
12
|
+
l.container || d();
|
|
18
13
|
});
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
});
|
|
39
|
-
const mergedContainerRef = computed(() => {
|
|
40
|
-
var _a;
|
|
41
|
-
return ((_a = props.container) == null ? void 0 : _a.call(props)) || containerRef.value;
|
|
42
|
-
});
|
|
43
|
-
const containerScrollTopRef = ref(0);
|
|
44
|
-
const containerScrollLeftRef = ref(0);
|
|
45
|
-
const needYBarRef = computed(() => {
|
|
46
|
-
const {
|
|
47
|
-
value: containerHeight
|
|
48
|
-
} = containerHeightRef;
|
|
49
|
-
const {
|
|
50
|
-
value: contentHeight
|
|
51
|
-
} = contentHeightRef;
|
|
52
|
-
return containerHeight !== null && contentHeight !== null && contentHeight > containerHeight;
|
|
53
|
-
});
|
|
54
|
-
const yBarSizeRef = computed(() => {
|
|
55
|
-
const {
|
|
56
|
-
value: containerHeight
|
|
57
|
-
} = containerHeightRef;
|
|
58
|
-
const {
|
|
59
|
-
value: contentHeight
|
|
60
|
-
} = contentHeightRef;
|
|
61
|
-
const {
|
|
62
|
-
value: yRailSize
|
|
63
|
-
} = yRailSizeRef;
|
|
64
|
-
if (containerHeight === null || contentHeight === null || yRailSize === null) {
|
|
65
|
-
return 0;
|
|
66
|
-
} else {
|
|
67
|
-
return Math.min(containerHeight, yRailSize * containerHeight / contentHeight + 5 * 1.5);
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
const yBarSizePxRef = computed(() => {
|
|
71
|
-
return `${yBarSizeRef.value}px`;
|
|
72
|
-
});
|
|
73
|
-
const yBarTopRef = computed(() => {
|
|
74
|
-
const {
|
|
75
|
-
value: containerHeight
|
|
76
|
-
} = containerHeightRef;
|
|
77
|
-
const {
|
|
78
|
-
value: containerScrollTop
|
|
79
|
-
} = containerScrollTopRef;
|
|
80
|
-
const {
|
|
81
|
-
value: contentHeight
|
|
82
|
-
} = contentHeightRef;
|
|
83
|
-
const {
|
|
84
|
-
value: yRailSize
|
|
85
|
-
} = yRailSizeRef;
|
|
86
|
-
if (containerHeight === null || contentHeight === null || yRailSize === null) {
|
|
14
|
+
const y = () => {
|
|
15
|
+
d();
|
|
16
|
+
}, M = () => {
|
|
17
|
+
d();
|
|
18
|
+
}, w = a(null), h = a(null), T = a(null), v = a(null), s = a(null), R = a(null), f = a(null), m = a(null), P = a(null), b = a(null), k = c(() => {
|
|
19
|
+
var e;
|
|
20
|
+
return ((e = l.content) == null ? void 0 : e.call(l)) || w.value;
|
|
21
|
+
}), x = c(() => {
|
|
22
|
+
var e;
|
|
23
|
+
return ((e = l.container) == null ? void 0 : e.call(l)) || h.value;
|
|
24
|
+
}), X = a(0), Y = a(0), q = c(() => {
|
|
25
|
+
const { value: e } = f, { value: t } = s;
|
|
26
|
+
return e !== null && t !== null && t > e;
|
|
27
|
+
}), C = c(() => {
|
|
28
|
+
const { value: e } = f, { value: t } = s, { value: n } = P;
|
|
29
|
+
return e === null || t === null || n === null ? 0 : Math.min(e, n * e / t + 5 * 1.5);
|
|
30
|
+
}), F = c(() => `${C.value}px`), G = c(() => {
|
|
31
|
+
const { value: e } = f, { value: t } = X, { value: n } = s, { value: r } = P;
|
|
32
|
+
if (e === null || n === null || r === null)
|
|
87
33
|
return 0;
|
|
88
|
-
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
return containerScrollTop / heightDiff * (yRailSize - yBarSizeRef.value);
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
const yBarTopPxRef = computed(() => {
|
|
95
|
-
return `${yBarTopRef.value}px`;
|
|
96
|
-
});
|
|
97
|
-
let yBarPressed = false;
|
|
98
|
-
let memoYTop = 0;
|
|
99
|
-
let memoMouseY = 0;
|
|
100
|
-
let yBarVanishTimerId;
|
|
101
|
-
let xBarVanishTimerId;
|
|
102
|
-
const handleYScrollMouseMove = (e) => {
|
|
103
|
-
if (!yBarPressed) return;
|
|
104
|
-
if (xBarVanishTimerId !== void 0) {
|
|
105
|
-
window.clearTimeout(xBarVanishTimerId);
|
|
106
|
-
}
|
|
107
|
-
if (yBarVanishTimerId !== void 0) {
|
|
108
|
-
window.clearTimeout(yBarVanishTimerId);
|
|
109
|
-
}
|
|
110
|
-
const {
|
|
111
|
-
value: containerHeight
|
|
112
|
-
} = containerHeightRef;
|
|
113
|
-
const {
|
|
114
|
-
value: contentHeight
|
|
115
|
-
} = contentHeightRef;
|
|
116
|
-
const {
|
|
117
|
-
value: yBarSize
|
|
118
|
-
} = yBarSizeRef;
|
|
119
|
-
if (containerHeight === null || contentHeight === null) return;
|
|
120
|
-
const dY = e.clientY - memoMouseY;
|
|
121
|
-
const dScrollTop = dY * (contentHeight - containerHeight) / (containerHeight - yBarSize);
|
|
122
|
-
const toScrollTopUpperBound = contentHeight - containerHeight;
|
|
123
|
-
let toScrollTop = memoYTop + dScrollTop;
|
|
124
|
-
toScrollTop = Math.min(toScrollTopUpperBound, toScrollTop);
|
|
125
|
-
toScrollTop = Math.max(toScrollTop, 0);
|
|
126
|
-
const {
|
|
127
|
-
value: container
|
|
128
|
-
} = mergedContainerRef;
|
|
129
|
-
if (container) {
|
|
130
|
-
container.scrollTop = toScrollTop;
|
|
34
|
+
{
|
|
35
|
+
const o = n - e;
|
|
36
|
+
return o ? t / o * (r - C.value) : 0;
|
|
131
37
|
}
|
|
38
|
+
}), J = c(() => `${G.value}px`);
|
|
39
|
+
let E = !1, D = 0, U = 0, B, p;
|
|
40
|
+
const _ = (e) => {
|
|
41
|
+
if (!E)
|
|
42
|
+
return;
|
|
43
|
+
p !== void 0 && window.clearTimeout(p), B !== void 0 && window.clearTimeout(B);
|
|
44
|
+
const { value: t } = f, { value: n } = s, { value: r } = C;
|
|
45
|
+
if (t === null || n === null)
|
|
46
|
+
return;
|
|
47
|
+
const W = (e.clientY - U) * (n - t) / (t - r), $ = n - t;
|
|
48
|
+
let i = D + W;
|
|
49
|
+
i = Math.min($, i), i = Math.max(i, 0);
|
|
50
|
+
const { value: S } = x;
|
|
51
|
+
S && (S.scrollTop = i);
|
|
52
|
+
}, N = (e) => {
|
|
53
|
+
e.preventDefault(), e.stopPropagation(), g("mousemove", window, _, !0), g("mouseup", window, N, !0), E = !1, d();
|
|
54
|
+
}, Q = (e) => {
|
|
55
|
+
e.preventDefault(), e.stopPropagation(), z("mousemove", window, _, !0), z("mouseup", window, N, !0), D = X.value, U = e.clientY, E = !0;
|
|
132
56
|
};
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
e
|
|
136
|
-
off("mousemove", window, handleYScrollMouseMove, true);
|
|
137
|
-
off("mouseup", window, handleYScrollMouseUp, true);
|
|
138
|
-
yBarPressed = false;
|
|
139
|
-
sync();
|
|
140
|
-
};
|
|
141
|
-
const handleYScrollMouseDown = (e) => {
|
|
142
|
-
e.preventDefault();
|
|
143
|
-
e.stopPropagation();
|
|
144
|
-
on("mousemove", window, handleYScrollMouseMove, true);
|
|
145
|
-
on("mouseup", window, handleYScrollMouseUp, true);
|
|
146
|
-
memoYTop = containerScrollTopRef.value;
|
|
147
|
-
memoMouseY = e.clientY;
|
|
148
|
-
yBarPressed = true;
|
|
149
|
-
};
|
|
150
|
-
function handleScroll(e) {
|
|
151
|
-
const {
|
|
152
|
-
onScroll
|
|
153
|
-
} = props;
|
|
154
|
-
if (onScroll) onScroll(e);
|
|
155
|
-
syncScrollState();
|
|
57
|
+
function Z(e) {
|
|
58
|
+
const { onScroll: t } = l;
|
|
59
|
+
t && t(e), O();
|
|
156
60
|
}
|
|
157
|
-
const
|
|
158
|
-
const {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
const {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
const xBarSizeRef = computed(() => {
|
|
167
|
-
const {
|
|
168
|
-
value: containerWidth
|
|
169
|
-
} = containerWidthRef;
|
|
170
|
-
const {
|
|
171
|
-
value: contentWidth
|
|
172
|
-
} = contentWidthRef;
|
|
173
|
-
const {
|
|
174
|
-
value: xRailSize
|
|
175
|
-
} = xRailSizeRef;
|
|
176
|
-
if (containerWidth === null || contentWidth === null || xRailSize === null) {
|
|
61
|
+
const ee = c(() => {
|
|
62
|
+
const { value: e } = m, { value: t } = R;
|
|
63
|
+
return e !== null && t !== null && t > e;
|
|
64
|
+
}), H = c(() => {
|
|
65
|
+
const { value: e } = m, { value: t } = R, { value: n } = b;
|
|
66
|
+
return e === null || t === null || n === null ? 0 : n * e / t + 5 * 1.5;
|
|
67
|
+
}), te = c(() => `${H.value}px`), ne = c(() => {
|
|
68
|
+
const { value: e } = m, { value: t } = Y, { value: n } = R, { value: r } = b;
|
|
69
|
+
if (e === null || n === null || r === null)
|
|
177
70
|
return 0;
|
|
178
|
-
|
|
179
|
-
|
|
71
|
+
{
|
|
72
|
+
const o = n - e;
|
|
73
|
+
return o ? t / o * (r - H.value) : 0;
|
|
180
74
|
}
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
} = xRailSizeRef;
|
|
198
|
-
if (containerWidth === null || contentWidth === null || xRailSize === null) {
|
|
199
|
-
return 0;
|
|
200
|
-
} else {
|
|
201
|
-
const widthDiff = contentWidth - containerWidth;
|
|
202
|
-
if (!widthDiff) return 0;
|
|
203
|
-
return containerScrollLeft / widthDiff * (xRailSize - xBarSizeRef.value);
|
|
204
|
-
}
|
|
205
|
-
});
|
|
206
|
-
const xBarLeftPxRef = computed(() => {
|
|
207
|
-
return `${xBarLeftRef.value}px`;
|
|
208
|
-
});
|
|
209
|
-
let xBarPressed = false;
|
|
210
|
-
let memoXLeft = 0;
|
|
211
|
-
let memoMouseX = 0;
|
|
212
|
-
const handleXScrollMouseMove = (e) => {
|
|
213
|
-
if (!xBarPressed) return;
|
|
214
|
-
if (xBarVanishTimerId !== void 0) {
|
|
215
|
-
window.clearTimeout(xBarVanishTimerId);
|
|
216
|
-
}
|
|
217
|
-
if (yBarVanishTimerId !== void 0) {
|
|
218
|
-
window.clearTimeout(yBarVanishTimerId);
|
|
219
|
-
}
|
|
220
|
-
const {
|
|
221
|
-
value: containerWidth
|
|
222
|
-
} = containerWidthRef;
|
|
223
|
-
const {
|
|
224
|
-
value: contentWidth
|
|
225
|
-
} = contentWidthRef;
|
|
226
|
-
const {
|
|
227
|
-
value: xBarSize
|
|
228
|
-
} = xBarSizeRef;
|
|
229
|
-
if (containerWidth === null || contentWidth === null) return;
|
|
230
|
-
const dX = e.clientX - memoMouseX;
|
|
231
|
-
const dScrollLeft = dX * (contentWidth - containerWidth) / (containerWidth - xBarSize);
|
|
232
|
-
const toScrollLeftUpperBound = contentWidth - containerWidth;
|
|
233
|
-
let toScrollLeft = memoXLeft + dScrollLeft;
|
|
234
|
-
toScrollLeft = Math.min(toScrollLeftUpperBound, toScrollLeft);
|
|
235
|
-
toScrollLeft = Math.max(toScrollLeft, 0);
|
|
236
|
-
const {
|
|
237
|
-
value: container
|
|
238
|
-
} = mergedContainerRef;
|
|
239
|
-
if (container) {
|
|
240
|
-
container.scrollLeft = toScrollLeft;
|
|
241
|
-
}
|
|
242
|
-
};
|
|
243
|
-
const handleXScrollMouseUp = (e) => {
|
|
244
|
-
e.preventDefault();
|
|
245
|
-
e.stopPropagation();
|
|
246
|
-
off("mousemove", window, handleXScrollMouseMove, true);
|
|
247
|
-
off("mouseup", window, handleXScrollMouseUp, true);
|
|
248
|
-
xBarPressed = false;
|
|
249
|
-
sync();
|
|
75
|
+
}), le = c(() => `${ne.value}px`);
|
|
76
|
+
let L = !1, V = 0, I = 0;
|
|
77
|
+
const A = (e) => {
|
|
78
|
+
if (!L)
|
|
79
|
+
return;
|
|
80
|
+
p !== void 0 && window.clearTimeout(p), B !== void 0 && window.clearTimeout(B);
|
|
81
|
+
const { value: t } = m, { value: n } = R, { value: r } = H;
|
|
82
|
+
if (t === null || n === null)
|
|
83
|
+
return;
|
|
84
|
+
const W = (e.clientX - I) * (n - t) / (t - r), $ = n - t;
|
|
85
|
+
let i = V + W;
|
|
86
|
+
i = Math.min($, i), i = Math.max(i, 0);
|
|
87
|
+
const { value: S } = x;
|
|
88
|
+
S && (S.scrollLeft = i);
|
|
89
|
+
}, K = (e) => {
|
|
90
|
+
e.preventDefault(), e.stopPropagation(), g("mousemove", window, A, !0), g("mouseup", window, K, !0), L = !1, d();
|
|
250
91
|
};
|
|
251
|
-
function
|
|
252
|
-
e.preventDefault();
|
|
253
|
-
e.stopPropagation();
|
|
254
|
-
xBarPressed = true;
|
|
255
|
-
on("mousemove", window, handleXScrollMouseMove, true);
|
|
256
|
-
on("mouseup", window, handleXScrollMouseUp, true);
|
|
257
|
-
memoXLeft = containerScrollLeftRef.value;
|
|
258
|
-
memoMouseX = e.clientX;
|
|
92
|
+
function oe(e) {
|
|
93
|
+
e.preventDefault(), e.stopPropagation(), L = !0, z("mousemove", window, A, !0), z("mouseup", window, K, !0), V = Y.value, I = e.clientX;
|
|
259
94
|
}
|
|
260
|
-
function
|
|
261
|
-
const {
|
|
262
|
-
|
|
263
|
-
} = mergedContainerRef;
|
|
264
|
-
if (container) {
|
|
265
|
-
containerScrollTopRef.value = container.scrollTop;
|
|
266
|
-
containerScrollLeftRef.value = container.scrollLeft;
|
|
267
|
-
}
|
|
95
|
+
function O() {
|
|
96
|
+
const { value: e } = x;
|
|
97
|
+
e && (X.value = e.scrollTop, Y.value = e.scrollLeft);
|
|
268
98
|
}
|
|
269
|
-
const
|
|
270
|
-
const {
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
const contentClient = content.getBoundingClientRect();
|
|
275
|
-
contentHeightRef.value = contentClient.height;
|
|
276
|
-
contentWidthRef.value = contentClient.width;
|
|
277
|
-
}
|
|
278
|
-
const {
|
|
279
|
-
value: container
|
|
280
|
-
} = mergedContainerRef;
|
|
281
|
-
if (container) {
|
|
282
|
-
const containerClient = container.getBoundingClientRect();
|
|
283
|
-
containerHeightRef.value = containerClient.height;
|
|
284
|
-
containerWidthRef.value = containerClient.width;
|
|
99
|
+
const re = () => {
|
|
100
|
+
const { value: e } = k;
|
|
101
|
+
if (e) {
|
|
102
|
+
const o = e.getBoundingClientRect();
|
|
103
|
+
s.value = o.height, R.value = o.width;
|
|
285
104
|
}
|
|
286
|
-
const {
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
yRailSizeRef.value = yRailEl.offsetHeight;
|
|
291
|
-
}
|
|
292
|
-
const {
|
|
293
|
-
value: xRailEl
|
|
294
|
-
} = xRailRef;
|
|
295
|
-
if (xRailEl) {
|
|
296
|
-
xRailSizeRef.value = xRailEl.offsetWidth;
|
|
105
|
+
const { value: t } = x;
|
|
106
|
+
if (t) {
|
|
107
|
+
const o = t.getBoundingClientRect();
|
|
108
|
+
f.value = o.height, m.value = o.width;
|
|
297
109
|
}
|
|
110
|
+
const { value: n } = T;
|
|
111
|
+
n && (P.value = n.offsetHeight);
|
|
112
|
+
const { value: r } = v;
|
|
113
|
+
r && (b.value = r.offsetWidth);
|
|
298
114
|
};
|
|
299
|
-
function
|
|
300
|
-
|
|
301
|
-
syncScrollState();
|
|
115
|
+
function d() {
|
|
116
|
+
re(), O();
|
|
302
117
|
}
|
|
303
118
|
return {
|
|
304
|
-
sync,
|
|
305
|
-
handleContentResize,
|
|
306
|
-
handleContainerResize,
|
|
307
|
-
contentRef,
|
|
308
|
-
yRailRef,
|
|
309
|
-
xRailRef,
|
|
310
|
-
containerRef,
|
|
311
|
-
contentHeightRef,
|
|
312
|
-
containerHeightRef,
|
|
313
|
-
needYBarRef,
|
|
314
|
-
needXBarRef,
|
|
315
|
-
yBarSizePxRef,
|
|
316
|
-
handleYScrollMouseDown,
|
|
317
|
-
handleXScrollMouseDown,
|
|
318
|
-
yBarTopPxRef,
|
|
319
|
-
handleScroll,
|
|
320
|
-
xBarSizePxRef,
|
|
321
|
-
xBarLeftPxRef
|
|
119
|
+
sync: d,
|
|
120
|
+
handleContentResize: y,
|
|
121
|
+
handleContainerResize: M,
|
|
122
|
+
contentRef: w,
|
|
123
|
+
yRailRef: T,
|
|
124
|
+
xRailRef: v,
|
|
125
|
+
containerRef: h,
|
|
126
|
+
contentHeightRef: s,
|
|
127
|
+
containerHeightRef: f,
|
|
128
|
+
needYBarRef: q,
|
|
129
|
+
needXBarRef: ee,
|
|
130
|
+
yBarSizePxRef: F,
|
|
131
|
+
handleYScrollMouseDown: Q,
|
|
132
|
+
handleXScrollMouseDown: oe,
|
|
133
|
+
yBarTopPxRef: J,
|
|
134
|
+
handleScroll: Z,
|
|
135
|
+
xBarSizePxRef: te,
|
|
136
|
+
xBarLeftPxRef: le
|
|
322
137
|
};
|
|
323
138
|
},
|
|
324
139
|
render() {
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
const createXBar = () => {
|
|
331
|
-
return createVNode("div", {
|
|
332
|
-
"class": `${defaultNamespace}-scrollbar-rail ${defaultNamespace}-scrollbar-rail--horizontal`,
|
|
333
|
-
"ref": "xRailRef"
|
|
334
|
-
}, [this.needXBarRef && createVNode("div", {
|
|
335
|
-
"class": `${defaultNamespace}-scrollbar-rail__scrollbar--horizontal`,
|
|
336
|
-
"style": {
|
|
140
|
+
const { $slots: l, xScrollable: y } = this, M = () => /* @__PURE__ */ React.createElement("div", { class: `${u}-scrollbar-rail ${u}-scrollbar-rail--horizontal`, ref: "xRailRef" }, this.needXBarRef && /* @__PURE__ */ React.createElement(
|
|
141
|
+
"div",
|
|
142
|
+
{
|
|
143
|
+
class: `${u}-scrollbar-rail__scrollbar--horizontal`,
|
|
144
|
+
style: {
|
|
337
145
|
width: this.xBarSizePxRef,
|
|
338
146
|
left: this.xBarLeftPxRef
|
|
339
147
|
},
|
|
340
|
-
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
}, [this.needYBarRef && createVNode("div", {
|
|
348
|
-
"class": `${defaultNamespace}-scrollbar-rail__scrollbar--vertical`,
|
|
349
|
-
"style": {
|
|
148
|
+
onMousedown: this.handleXScrollMouseDown
|
|
149
|
+
}
|
|
150
|
+
)), w = () => /* @__PURE__ */ React.createElement("div", { class: `${u}-scrollbar-rail ${u}-scrollbar-rail--vertical`, ref: "yRailRef" }, this.needYBarRef && /* @__PURE__ */ React.createElement(
|
|
151
|
+
"div",
|
|
152
|
+
{
|
|
153
|
+
class: `${u}-scrollbar-rail__scrollbar--vertical`,
|
|
154
|
+
style: {
|
|
350
155
|
height: this.yBarSizePxRef,
|
|
351
156
|
top: this.yBarTopPxRef
|
|
352
157
|
},
|
|
353
|
-
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
return createVNode("div", mergeProps({
|
|
359
|
-
"class": `${defaultNamespace}-scrollbar`
|
|
360
|
-
}, this.$attrs), [this.container ? (_a = $slots.default) == null ? void 0 : _a.call($slots) : createVNode("div", {
|
|
361
|
-
"class": `${defaultNamespace}-scrollbar-container`,
|
|
362
|
-
"onScroll": this.handleScroll,
|
|
363
|
-
"ref": "containerRef"
|
|
364
|
-
}, [createVNode(VResizeObserver, {
|
|
365
|
-
"onResize": this.handleContentResize
|
|
366
|
-
}, {
|
|
367
|
-
default: () => {
|
|
368
|
-
var _a2;
|
|
369
|
-
return [createVNode("div", {
|
|
370
|
-
"ref": "contentRef",
|
|
371
|
-
"class": `${defaultNamespace}-scrollbar-content`
|
|
372
|
-
}, [(_a2 = $slots.default) == null ? void 0 : _a2.call($slots)])];
|
|
373
|
-
}
|
|
374
|
-
})]), createYBar(), xScrollable && createXBar()]);
|
|
158
|
+
onMousedown: this.handleYScrollMouseDown
|
|
159
|
+
}
|
|
160
|
+
)), h = () => {
|
|
161
|
+
var v, s;
|
|
162
|
+
return /* @__PURE__ */ React.createElement("div", { class: `${u}-scrollbar`, ...this.$attrs }, this.container ? (v = l.default) == null ? void 0 : v.call(l) : /* @__PURE__ */ React.createElement("div", { class: `${u}-scrollbar-container`, onScroll: this.handleScroll, ref: "containerRef" }, /* @__PURE__ */ React.createElement(j, { onResize: this.handleContentResize }, /* @__PURE__ */ React.createElement("div", { ref: "contentRef", class: `${u}-scrollbar-content` }, (s = l.default) == null ? void 0 : s.call(l)))), w(), y && M());
|
|
375
163
|
};
|
|
376
|
-
|
|
377
|
-
"onResize": this.handleContainerResize
|
|
378
|
-
}, _isSlot(_slot = createChildren()) ? _slot : {
|
|
379
|
-
default: () => [_slot]
|
|
380
|
-
});
|
|
381
|
-
return createBarNode;
|
|
164
|
+
return this.container ? h() : /* @__PURE__ */ React.createElement(j, { onResize: this.handleContainerResize }, h());
|
|
382
165
|
}
|
|
383
166
|
});
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
167
|
+
export {
|
|
168
|
+
ve as default
|
|
169
|
+
};
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
const
|
|
2
|
-
function
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
};
|
|
7
|
-
return main;
|
|
1
|
+
const i = "K";
|
|
2
|
+
function c(t) {
|
|
3
|
+
return t.install = (n) => {
|
|
4
|
+
const e = t;
|
|
5
|
+
n.component(i + e.name, e);
|
|
6
|
+
}, t;
|
|
8
7
|
}
|
|
9
|
-
function
|
|
8
|
+
function l(t, n) {
|
|
10
9
|
return {
|
|
11
|
-
install: (
|
|
12
|
-
|
|
10
|
+
install: (e) => {
|
|
11
|
+
e.directive(n, t);
|
|
13
12
|
},
|
|
14
|
-
directive:
|
|
13
|
+
directive: t
|
|
15
14
|
};
|
|
16
15
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
export {
|
|
17
|
+
c as withInstall,
|
|
18
|
+
l as withInstallDirectives
|
|
19
|
+
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { withInstall } from
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { withInstall as t } from "../utils/install.mjs";
|
|
2
|
+
import "./src/virtual-list.vue.mjs";
|
|
3
|
+
import { virtualListProps as f } from "./src/types.mjs";
|
|
4
|
+
import r from "./src/virtual-list.vue2.mjs";
|
|
5
|
+
const s = t(r);
|
|
6
|
+
export {
|
|
7
|
+
s as KVirtualList,
|
|
8
|
+
s as default,
|
|
9
|
+
f as virtualListProps
|
|
10
|
+
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
const
|
|
1
|
+
const e = {
|
|
2
2
|
items: {
|
|
3
3
|
type: Array,
|
|
4
4
|
default: () => []
|
|
5
5
|
},
|
|
6
6
|
itemSize: {
|
|
7
7
|
type: Number,
|
|
8
|
-
required:
|
|
8
|
+
required: !0
|
|
9
9
|
},
|
|
10
10
|
itemResizable: Boolean,
|
|
11
11
|
paddingTop: {
|
|
@@ -25,6 +25,6 @@ const virtualListProps = {
|
|
|
25
25
|
onWheel: Function,
|
|
26
26
|
onResize: Function
|
|
27
27
|
};
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
export {
|
|
29
|
+
e as virtualListProps
|
|
30
|
+
};
|