@vtable-guild/vtable-guild 2.4.0 → 2.5.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/css/style.css +9 -0
- package/css/tailwind3-utilities.css +9 -0
- package/dist/core/src/components/VirtualList/VirtualList.d.ts +21 -0
- package/dist/core/src/components/VirtualList/VirtualList.d.ts.map +1 -1
- package/dist/core/src/components/VirtualList/VirtualList.mjs +201 -216
- package/dist/core/src/components/VirtualList/hooks/useHeights.d.ts +7 -1
- package/dist/core/src/components/VirtualList/hooks/useHeights.d.ts.map +1 -1
- package/dist/core/src/components/VirtualList/hooks/useHeights.mjs +29 -27
- package/dist/core/src/components/VirtualList/hooks/useScrollTo.d.ts +3 -1
- package/dist/core/src/components/VirtualList/hooks/useScrollTo.d.ts.map +1 -1
- package/dist/core/src/components/VirtualList/hooks/useScrollTo.mjs +57 -50
- package/dist/core/src/components/VirtualList/index.d.ts +1 -0
- package/dist/core/src/components/VirtualList/index.d.ts.map +1 -1
- package/dist/core/src/components/VirtualList/utils/PrefixSums.d.ts +50 -0
- package/dist/core/src/components/VirtualList/utils/PrefixSums.d.ts.map +1 -0
- package/dist/core/src/components/VirtualList/utils/PrefixSums.mjs +54 -0
- package/dist/core/src/components/VirtualList/utils/PrefixSums.test.d.ts +2 -0
- package/dist/core/src/components/VirtualList/utils/PrefixSums.test.d.ts.map +1 -0
- package/dist/core/src/composables/useTheme.d.ts +1 -1
- package/dist/core/src/composables/useTheme.mjs +5 -5
- package/dist/core/src/index.d.ts +5 -0
- package/dist/core/src/index.d.ts.map +1 -1
- package/dist/core/src/plugin/index.d.ts +1 -1
- package/dist/core/src/utils/props.d.ts +1 -1
- package/dist/core/src/utils/tv.d.ts +2 -2
- package/dist/core/src/utils/types.d.ts +2 -2
- package/dist/css/style.css +9 -0
- package/dist/css/tailwind3-utilities.css +9 -0
- package/dist/index.full.mjs +3614 -3292
- package/dist/index.mjs +32 -30
- package/dist/table/src/components/ColGroup.d.ts.map +1 -1
- package/dist/table/src/components/ColGroup.mjs +11 -8
- package/dist/table/src/components/Table.d.ts +62 -0
- package/dist/table/src/components/Table.d.ts.map +1 -1
- package/dist/table/src/components/Table.mjs +353 -298
- package/dist/table/src/components/TableBody.d.ts.map +1 -1
- package/dist/table/src/components/TableBody.mjs +22 -22
- package/dist/table/src/components/TableCell.d.ts +23 -0
- package/dist/table/src/components/TableCell.d.ts.map +1 -1
- package/dist/table/src/components/TableCell.mjs +50 -39
- package/dist/table/src/components/TableHeaderCell.d.ts.map +1 -1
- package/dist/table/src/components/TableHeaderCell.mjs +172 -169
- package/dist/table/src/components/VTable.vue.mjs +10 -8
- package/dist/table/src/components/VirtualTableBody.d.ts +40 -0
- package/dist/table/src/components/VirtualTableBody.d.ts.map +1 -1
- package/dist/table/src/components/VirtualTableBody.mjs +157 -67
- package/dist/table/src/composables/index.d.ts +4 -0
- package/dist/table/src/composables/index.d.ts.map +1 -1
- package/dist/table/src/composables/useColumnMetrics.d.ts +39 -0
- package/dist/table/src/composables/useColumnMetrics.d.ts.map +1 -0
- package/dist/table/src/composables/useColumnMetrics.mjs +88 -0
- package/dist/table/src/composables/useColumnWindow.d.ts +90 -0
- package/dist/table/src/composables/useColumnWindow.d.ts.map +1 -0
- package/dist/table/src/composables/useColumnWindow.mjs +62 -0
- package/dist/table/src/composables/useColumnWindow.test.d.ts +2 -0
- package/dist/table/src/composables/useColumnWindow.test.d.ts.map +1 -0
- package/dist/table/src/composables/useColumns.d.ts +8 -0
- package/dist/table/src/composables/useColumns.d.ts.map +1 -1
- package/dist/table/src/composables/useColumns.mjs +46 -43
- package/dist/table/src/composables/useSelection.d.ts.map +1 -1
- package/dist/table/src/composables/useSelection.mjs +93 -94
- package/dist/table/src/composables/useVirtual.d.ts +10 -0
- package/dist/table/src/composables/useVirtual.d.ts.map +1 -1
- package/dist/table/src/composables/useVirtual.mjs +15 -11
- package/dist/table/src/index.d.ts +2 -0
- package/dist/table/src/index.d.ts.map +1 -1
- package/dist/table/src/types/table.d.ts +25 -0
- package/dist/table/src/types/table.d.ts.map +1 -1
- package/dist/theme/src/presets/antdv/table.d.ts +3 -0
- package/dist/theme/src/presets/antdv/table.d.ts.map +1 -1
- package/dist/theme/src/presets/antdv/table.mjs +4 -1
- package/package.json +10 -3
- package/dist/core/src/components/VirtualList/hooks/useDiffItem.d.ts +0 -4
- package/dist/core/src/components/VirtualList/hooks/useDiffItem.d.ts.map +0 -1
- package/dist/core/src/components/VirtualList/hooks/useDiffItem.mjs +0 -16
- package/dist/core/src/components/VirtualList/utils/algorithmUtil.d.ts +0 -7
- package/dist/core/src/components/VirtualList/utils/algorithmUtil.d.ts.map +0 -1
- package/dist/core/src/components/VirtualList/utils/algorithmUtil.mjs +0 -22
package/css/style.css
CHANGED
|
@@ -2020,6 +2020,15 @@
|
|
|
2020
2020
|
.disabled\:vtg-text-\[color\:var\(--color-text-disabled\2c \#a8abb2\)\]:disabled {
|
|
2021
2021
|
color: var(--color-text-disabled,#a8abb2)
|
|
2022
2022
|
}
|
|
2023
|
+
.vtg-group\/row:nth-child(even) .group-even\/row\:vtg-bg-\[color\:var\(--vtg-table-row-hover-bg\)\] {
|
|
2024
|
+
background-color: var(--vtg-table-row-hover-bg)
|
|
2025
|
+
}
|
|
2026
|
+
.vtg-group\/row:nth-child(even) .group-even\/row\:vtg-bg-\[color\:var\(--vtg-table-row-selected-bg\)\] {
|
|
2027
|
+
background-color: var(--vtg-table-row-selected-bg)
|
|
2028
|
+
}
|
|
2029
|
+
.vtg-group\/row:nth-child(even) .group-even\/row\:vtg-bg-\[color\:var\(--vtg-table-row-selected-hover-bg\)\] {
|
|
2030
|
+
background-color: var(--vtg-table-row-selected-hover-bg)
|
|
2031
|
+
}
|
|
2023
2032
|
.vtg-group\/row:nth-child(even) .group-even\/row\:vtg-bg-\[color\:var\(--vtg-table-row-striped-bg\)\] {
|
|
2024
2033
|
background-color: var(--vtg-table-row-striped-bg)
|
|
2025
2034
|
}
|
|
@@ -1519,6 +1519,15 @@
|
|
|
1519
1519
|
.disabled\:vtg-text-\[color\:var\(--color-text-disabled\2c \#a8abb2\)\]:disabled {
|
|
1520
1520
|
color: var(--color-text-disabled,#a8abb2)
|
|
1521
1521
|
}
|
|
1522
|
+
.vtg-group\/row:nth-child(even) .group-even\/row\:vtg-bg-\[color\:var\(--vtg-table-row-hover-bg\)\] {
|
|
1523
|
+
background-color: var(--vtg-table-row-hover-bg)
|
|
1524
|
+
}
|
|
1525
|
+
.vtg-group\/row:nth-child(even) .group-even\/row\:vtg-bg-\[color\:var\(--vtg-table-row-selected-bg\)\] {
|
|
1526
|
+
background-color: var(--vtg-table-row-selected-bg)
|
|
1527
|
+
}
|
|
1528
|
+
.vtg-group\/row:nth-child(even) .group-even\/row\:vtg-bg-\[color\:var\(--vtg-table-row-selected-hover-bg\)\] {
|
|
1529
|
+
background-color: var(--vtg-table-row-selected-hover-bg)
|
|
1530
|
+
}
|
|
1522
1531
|
.vtg-group\/row:nth-child(even) .group-even\/row\:vtg-bg-\[color\:var\(--vtg-table-row-striped-bg\)\] {
|
|
1523
1532
|
background-color: var(--vtg-table-row-striped-bg)
|
|
1524
1533
|
}
|
|
@@ -32,12 +32,24 @@ export interface ListProps {
|
|
|
32
32
|
verticalScrollBarThumb?: CSSProperties;
|
|
33
33
|
};
|
|
34
34
|
showScrollBar?: boolean | 'optional' | 'hover';
|
|
35
|
+
/**
|
|
36
|
+
* 定高快路径:调用方保证每一项的实际高度等于 `itemHeight`。
|
|
37
|
+
* 开启后跳过全部 DOM 测量,可视区计算恒为 O(1)(见 useHeights 的 disabled 说明)。
|
|
38
|
+
*/
|
|
39
|
+
disableHeightMeasure?: boolean;
|
|
35
40
|
onScroll?: (e: Event) => void;
|
|
36
41
|
onVirtualScroll?: (info: ScrollInfo) => void;
|
|
37
42
|
onVisibleChange?: (visibleList: any[], fullList: any[]) => void;
|
|
38
43
|
innerProps?: InnerProps;
|
|
39
44
|
extraRender?: (info: ExtraRenderInfo) => VNode;
|
|
40
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* 一次性求可视区(自带位置表构建)。
|
|
48
|
+
*
|
|
49
|
+
* 组件内部**不走这个函数**——它每次调用都会重建整表,正是要避免的开销;
|
|
50
|
+
* 组件持有一个长期存活的 `PrefixSums` 做增量维护。
|
|
51
|
+
* 这里保留导出是为了让「给定各行高度 → 可视区」这条纯逻辑可以被单测直接钉住。
|
|
52
|
+
*/
|
|
41
53
|
export declare function getMeasuredVisibleRange(options: {
|
|
42
54
|
dataLength: number;
|
|
43
55
|
offsetTop: number;
|
|
@@ -85,6 +97,10 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
85
97
|
type: BooleanConstructor;
|
|
86
98
|
default: boolean;
|
|
87
99
|
};
|
|
100
|
+
disableHeightMeasure: {
|
|
101
|
+
type: BooleanConstructor;
|
|
102
|
+
default: boolean;
|
|
103
|
+
};
|
|
88
104
|
onScroll: PropType<(e: Event) => void>;
|
|
89
105
|
onVirtualScroll: PropType<(info: ScrollInfo) => void>;
|
|
90
106
|
onVisibleChange: PropType<(visibleList: any[], fullList: any[]) => void>;
|
|
@@ -127,6 +143,10 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
127
143
|
type: BooleanConstructor;
|
|
128
144
|
default: boolean;
|
|
129
145
|
};
|
|
146
|
+
disableHeightMeasure: {
|
|
147
|
+
type: BooleanConstructor;
|
|
148
|
+
default: boolean;
|
|
149
|
+
};
|
|
130
150
|
onScroll: PropType<(e: Event) => void>;
|
|
131
151
|
onVirtualScroll: PropType<(info: ScrollInfo) => void>;
|
|
132
152
|
onVisibleChange: PropType<(visibleList: any[], fullList: any[]) => void>;
|
|
@@ -138,6 +158,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
138
158
|
fullHeight: boolean;
|
|
139
159
|
component: string;
|
|
140
160
|
virtual: boolean;
|
|
161
|
+
disableHeightMeasure: boolean;
|
|
141
162
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
142
163
|
export default _default;
|
|
143
164
|
//# sourceMappingURL=VirtualList.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VirtualList.d.ts","sourceRoot":"","sources":["../../../../../../core/src/components/VirtualList/VirtualList.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"VirtualList.d.ts","sourceRoot":"","sources":["../../../../../../core/src/components/VirtualList/VirtualList.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAEvD,OAAO,KAAK,EAAE,sBAAsB,EAAgB,MAAM,oBAAoB,CAAA;AAG9E,OAAO,KAAK,EAAE,eAAe,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAY1C,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,KAAK,CAAA;AAQzD,MAAM,WAAW,UAAU;IACzB,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;CACV;AAED,MAAM,MAAM,QAAQ,GAAG,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI,KAAK,IAAI,CAAA;AAEnE,MAAM,WAAW,OAAO;IACtB,aAAa,CAAC,EAAE,cAAc,CAAA;IAC9B,QAAQ,EAAE,QAAQ,CAAA;IAClB,aAAa,EAAE,MAAM,UAAU,CAAA;IAC/B,kBAAkB,EAAE,MAAM,MAAM,CAAA;CACjC;AAED,MAAM,WAAW,SAAS;IACxB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAA;IACZ,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,OAAO,EA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BACjB,QAAQ,CAAC,CAAC,IAAI,EAAE,eAAe,KAAK,KAAK,CAAC;;;;;;;;;AA1BvE,wBAsjBE"}
|
|
@@ -1,56 +1,37 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import Be from "./hooks/useHeights.mjs";
|
|
1
|
+
import Re from "./Filler.mjs";
|
|
2
|
+
import ze from "./hooks/useChildren.mjs";
|
|
3
|
+
import Be from "./hooks/useFrameWheel.mjs";
|
|
4
|
+
import { useGetSize as Ce } from "./hooks/useGetSize.mjs";
|
|
5
|
+
import we from "./hooks/useHeights.mjs";
|
|
7
6
|
import Te from "./hooks/useMobileTouchMove.mjs";
|
|
8
|
-
import
|
|
9
|
-
import
|
|
7
|
+
import Ve from "./hooks/useScrollDrag.mjs";
|
|
8
|
+
import Ie from "./hooks/useScrollTo.mjs";
|
|
10
9
|
import oe from "./VirtualScrollBar.mjs";
|
|
11
|
-
import { getSpinSize as
|
|
12
|
-
import {
|
|
13
|
-
|
|
10
|
+
import { getSpinSize as re } from "./utils/scrollbarUtil.mjs";
|
|
11
|
+
import { PrefixSums as Ae } from "./utils/PrefixSums.mjs";
|
|
12
|
+
import { defineComponent as We, computed as y, watch as b, shallowRef as _, ref as r, unref as ke, toRaw as Fe, onBeforeUnmount as Oe, createVNode as F } from "vue";
|
|
13
|
+
const ue = [], De = {
|
|
14
14
|
overflowY: "auto",
|
|
15
15
|
overflowAnchor: "none"
|
|
16
16
|
};
|
|
17
|
-
function Fe(t) {
|
|
18
|
-
const s = {};
|
|
19
|
-
for (const c of Object.keys(t))
|
|
20
|
-
c.startsWith("on") || (s[c] = t[c]);
|
|
21
|
-
return s;
|
|
22
|
-
}
|
|
23
|
-
function re(t, s) {
|
|
24
|
-
let c = 0, T = t.length - 1, w = t.length;
|
|
25
|
-
for (; c <= T; ) {
|
|
26
|
-
const y = Math.floor((c + T) / 2);
|
|
27
|
-
t[y] >= s ? (w = y, T = y - 1) : c = y + 1;
|
|
28
|
-
}
|
|
29
|
-
return w;
|
|
30
|
-
}
|
|
31
17
|
function Ke(t) {
|
|
32
|
-
const {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
return C >= s && (C = s - 1), C = Math.min(C + 1, s - 1), {
|
|
47
|
-
scrollHeight: L,
|
|
48
|
-
start: b,
|
|
49
|
-
end: C,
|
|
50
|
-
offset: b === 0 ? 0 : f[b - 1]
|
|
18
|
+
const m = {};
|
|
19
|
+
for (const h of Object.keys(t))
|
|
20
|
+
h.startsWith("on") || (m[h] = t[h]);
|
|
21
|
+
return m;
|
|
22
|
+
}
|
|
23
|
+
function Pe(t, m, h, L) {
|
|
24
|
+
let R = t.findIndex(h);
|
|
25
|
+
R >= m && (R = 0);
|
|
26
|
+
let H = t.findIndex(h + L + 1);
|
|
27
|
+
return H >= m && (H = m - 1), H = Math.min(H + 1, m - 1), {
|
|
28
|
+
scrollHeight: t.total,
|
|
29
|
+
start: R,
|
|
30
|
+
end: H,
|
|
31
|
+
offset: t.offsetOf(R)
|
|
51
32
|
};
|
|
52
33
|
}
|
|
53
|
-
const
|
|
34
|
+
const Qe = /* @__PURE__ */ We({
|
|
54
35
|
name: "VirtualList",
|
|
55
36
|
props: {
|
|
56
37
|
prefixCls: {
|
|
@@ -87,6 +68,10 @@ const qe = /* @__PURE__ */ Ie({
|
|
|
87
68
|
type: Boolean,
|
|
88
69
|
default: !0
|
|
89
70
|
},
|
|
71
|
+
disableHeightMeasure: {
|
|
72
|
+
type: Boolean,
|
|
73
|
+
default: !1
|
|
74
|
+
},
|
|
90
75
|
onScroll: Function,
|
|
91
76
|
onVirtualScroll: Function,
|
|
92
77
|
onVisibleChange: Function,
|
|
@@ -95,271 +80,272 @@ const qe = /* @__PURE__ */ Ie({
|
|
|
95
80
|
},
|
|
96
81
|
inheritAttrs: !1,
|
|
97
82
|
setup(t, {
|
|
98
|
-
expose:
|
|
99
|
-
attrs:
|
|
100
|
-
slots:
|
|
83
|
+
expose: m,
|
|
84
|
+
attrs: h,
|
|
85
|
+
slots: L
|
|
101
86
|
}) {
|
|
102
|
-
const
|
|
103
|
-
let
|
|
104
|
-
|
|
105
|
-
|
|
87
|
+
const R = y(() => t.itemHeight);
|
|
88
|
+
let H = t.itemKey;
|
|
89
|
+
b(() => t.itemKey, (e) => {
|
|
90
|
+
H = e;
|
|
106
91
|
});
|
|
107
|
-
const
|
|
108
|
-
const l =
|
|
92
|
+
const V = (e) => {
|
|
93
|
+
const l = H;
|
|
109
94
|
return typeof l == "function" ? l(e) : e?.[l];
|
|
110
|
-
}, [
|
|
111
|
-
|
|
112
|
-
|
|
95
|
+
}, [ce, q, z, se] = we(V, void 0, void 0, () => t.disableHeightMeasure), u = _(t?.data || ue);
|
|
96
|
+
b(() => t.data, () => {
|
|
97
|
+
u.value = t?.data || ue;
|
|
113
98
|
});
|
|
114
|
-
const
|
|
115
|
-
const e =
|
|
116
|
-
return
|
|
117
|
-
}),
|
|
118
|
-
function
|
|
99
|
+
const I = y(() => !!(t.virtual !== !1 && t.height && t.itemHeight)), c = y(() => {
|
|
100
|
+
const e = u.value;
|
|
101
|
+
return I.value && e && (t.itemHeight * e.length > t.height || !!t.scrollWidth);
|
|
102
|
+
}), x = r(), G = r(), J = r(), O = r(!1), Q = _(), Z = _(), s = r(0), n = r(0), N = r(!1), p = r(0), ee = r(0), d = r(t.scrollWidth || 0), o = r(0), f = r(0), S = r(0), B = r(void 0);
|
|
103
|
+
function C(e) {
|
|
119
104
|
let l;
|
|
120
|
-
typeof e == "function" ? l = e(
|
|
121
|
-
const a =
|
|
122
|
-
|
|
105
|
+
typeof e == "function" ? l = e(s.value) : l = e;
|
|
106
|
+
const a = o.value - t.height, i = Math.max(0, Math.min(l, a || 0));
|
|
107
|
+
x.value && (x.value.scrollTop = i), s.value = i;
|
|
123
108
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
109
|
+
const A = new Ae();
|
|
110
|
+
b([c, I, s, u, se, () => t.height], ([, , , e, l], a) => {
|
|
111
|
+
if (!a)
|
|
112
|
+
A.markAllDirty();
|
|
113
|
+
else {
|
|
114
|
+
const [, , , M, X] = a;
|
|
115
|
+
e !== M ? A.markAllDirty() : l !== X && A.markDirtyFrom(f.value);
|
|
116
|
+
}
|
|
117
|
+
if (!I.value) {
|
|
118
|
+
o.value = 0, f.value = 0, S.value = u.value.length - 1, B.value = void 0;
|
|
127
119
|
return;
|
|
128
120
|
}
|
|
129
|
-
if (!
|
|
130
|
-
|
|
121
|
+
if (!c.value) {
|
|
122
|
+
o.value = G.value?.offsetHeight || 0, f.value = 0, S.value = u.value.length - 1, B.value = void 0;
|
|
131
123
|
return;
|
|
132
124
|
}
|
|
133
125
|
const {
|
|
134
|
-
itemHeight:
|
|
135
|
-
height:
|
|
136
|
-
} = t,
|
|
137
|
-
if (!
|
|
138
|
-
|
|
126
|
+
itemHeight: i,
|
|
127
|
+
height: P
|
|
128
|
+
} = t, T = u.value.length;
|
|
129
|
+
if (!T) {
|
|
130
|
+
o.value = 0, f.value = 0, S.value = -1, B.value = 0;
|
|
139
131
|
return;
|
|
140
132
|
}
|
|
141
|
-
if (
|
|
142
|
-
const
|
|
143
|
-
let
|
|
144
|
-
|
|
133
|
+
if (ke(z.id) === 0) {
|
|
134
|
+
const M = i, X = P, Y = Math.max(0, Math.floor(s.value / M)), be = Y * M;
|
|
135
|
+
let U = Y + Math.ceil(X / M);
|
|
136
|
+
U = Math.min(U + 1, T - 1), o.value = T * M, f.value = Y, S.value = U, B.value = be;
|
|
145
137
|
return;
|
|
146
138
|
}
|
|
147
|
-
const
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
itemHeight: e,
|
|
152
|
-
getItemHeight(z) {
|
|
153
|
-
return x.get(f(n[z]));
|
|
154
|
-
}
|
|
155
|
-
});
|
|
156
|
-
r.value = W.scrollHeight, m.value = W.start, H.value = W.end, I.value = W.offset;
|
|
139
|
+
const Me = Fe(u.value);
|
|
140
|
+
A.sync(T, (M) => z.get(V(Me[M])), i);
|
|
141
|
+
const j = Pe(A, T, s.value, P);
|
|
142
|
+
o.value = j.scrollHeight, f.value = j.start, S.value = j.end, B.value = j.offset;
|
|
157
143
|
}, {
|
|
158
144
|
immediate: !0
|
|
159
|
-
}),
|
|
160
|
-
const e =
|
|
145
|
+
}), b(o, () => {
|
|
146
|
+
const e = z.getRecord();
|
|
161
147
|
if (e.size === 1) {
|
|
162
|
-
const l = Array.from(e.keys())[0], a = e.get(l),
|
|
163
|
-
if (
|
|
164
|
-
const
|
|
165
|
-
|
|
148
|
+
const l = Array.from(e.keys())[0], a = e.get(l), i = u.value[f.value];
|
|
149
|
+
if (i && a === void 0 && V(i) === l) {
|
|
150
|
+
const P = z.get(l) - t.itemHeight;
|
|
151
|
+
C((T) => T + P);
|
|
166
152
|
}
|
|
167
153
|
}
|
|
168
|
-
if (
|
|
169
|
-
const l = Math.max(0,
|
|
170
|
-
|
|
154
|
+
if (I.value && t.height) {
|
|
155
|
+
const l = Math.max(0, o.value - t.height);
|
|
156
|
+
s.value > l && C(l);
|
|
171
157
|
}
|
|
172
|
-
|
|
158
|
+
z.resetRecord();
|
|
173
159
|
});
|
|
174
|
-
const
|
|
160
|
+
const g = r({
|
|
175
161
|
width: 0,
|
|
176
162
|
height: t.height || 0
|
|
177
163
|
});
|
|
178
|
-
let
|
|
179
|
-
const
|
|
180
|
-
|
|
164
|
+
let w = null, W = null;
|
|
165
|
+
const ve = (e) => {
|
|
166
|
+
W !== e && (w && W && w.unobserve(W), W = e, e && (w || (w = new ResizeObserver((l) => {
|
|
181
167
|
const a = l[0];
|
|
182
168
|
if (a) {
|
|
183
|
-
const
|
|
184
|
-
|
|
185
|
-
width:
|
|
186
|
-
height:
|
|
187
|
-
},
|
|
169
|
+
const i = a.target;
|
|
170
|
+
g.value = {
|
|
171
|
+
width: i.offsetWidth,
|
|
172
|
+
height: i.offsetHeight
|
|
173
|
+
}, d.value = t.scrollWidth ?? i.offsetWidth;
|
|
188
174
|
}
|
|
189
|
-
})),
|
|
175
|
+
})), w.observe(e)));
|
|
190
176
|
};
|
|
191
|
-
|
|
192
|
-
|
|
177
|
+
Oe(() => {
|
|
178
|
+
w?.disconnect(), w = null, W = null;
|
|
193
179
|
});
|
|
194
|
-
const
|
|
195
|
-
x:
|
|
196
|
-
y:
|
|
197
|
-
}), E =
|
|
180
|
+
const v = y(() => t.direction === "rtl"), $ = () => ({
|
|
181
|
+
x: v.value ? -n.value : n.value,
|
|
182
|
+
y: s.value
|
|
183
|
+
}), E = r($()), D = (e) => {
|
|
198
184
|
if (t.onVirtualScroll) {
|
|
199
185
|
const l = {
|
|
200
|
-
|
|
186
|
+
...$(),
|
|
201
187
|
...e
|
|
202
188
|
};
|
|
203
189
|
(E.value.x !== l.x || E.value.y !== l.y) && (t.onVirtualScroll(l), E.value = l);
|
|
204
190
|
}
|
|
205
|
-
},
|
|
206
|
-
|
|
207
|
-
}, [
|
|
191
|
+
}, k = y(() => Math.max(0, (d.value || 0) - g.value.width)), fe = y(() => s.value === 0), he = y(() => s.value + t.height >= o.value), de = y(() => n.value === 0), ge = y(() => n.value >= k.value), K = (e) => Math.max(0, Math.min(e, k.value)), te = () => {
|
|
192
|
+
Q.value?.delayHidden(), Z.value?.delayHidden();
|
|
193
|
+
}, [me] = Be(c, fe, he, de, ge, k.value > 0, (e, l) => {
|
|
208
194
|
if (l) {
|
|
209
|
-
const a =
|
|
210
|
-
|
|
211
|
-
x:
|
|
195
|
+
const a = K(v.value ? n.value - e : n.value + e);
|
|
196
|
+
n.value = a, D({
|
|
197
|
+
x: v.value ? -a : a
|
|
212
198
|
});
|
|
213
199
|
} else
|
|
214
|
-
|
|
200
|
+
C((a) => a + e);
|
|
215
201
|
});
|
|
216
|
-
Te(
|
|
202
|
+
Te(c, x, (e, l) => {
|
|
217
203
|
if (e) {
|
|
218
|
-
const a =
|
|
219
|
-
return
|
|
220
|
-
x:
|
|
204
|
+
const a = K(v.value ? n.value - l : n.value + l);
|
|
205
|
+
return n.value = a, D({
|
|
206
|
+
x: v.value ? -a : a
|
|
221
207
|
}), !0;
|
|
222
208
|
} else
|
|
223
|
-
return
|
|
224
|
-
}),
|
|
225
|
-
|
|
209
|
+
return C((a) => a + l), !0;
|
|
210
|
+
}), Ve(c, x, (e) => {
|
|
211
|
+
C((l) => l + e);
|
|
226
212
|
});
|
|
227
|
-
const
|
|
228
|
-
l ? (
|
|
229
|
-
x:
|
|
230
|
-
})) :
|
|
231
|
-
},
|
|
232
|
-
|
|
233
|
-
},
|
|
234
|
-
|
|
213
|
+
const le = (e, l) => {
|
|
214
|
+
l ? (n.value = e, D({
|
|
215
|
+
x: v.value ? -e : e
|
|
216
|
+
})) : C(e);
|
|
217
|
+
}, ae = () => {
|
|
218
|
+
N.value = !0;
|
|
219
|
+
}, ie = () => {
|
|
220
|
+
N.value = !1;
|
|
235
221
|
};
|
|
236
|
-
|
|
237
|
-
|
|
222
|
+
b([() => t.height, o, c, () => g.value.height], () => {
|
|
223
|
+
c.value && t.height && o.value && (p.value = re(g.value.height, o.value));
|
|
238
224
|
}, {
|
|
239
225
|
immediate: !0
|
|
240
|
-
}),
|
|
241
|
-
|
|
226
|
+
}), b([() => g.value.width, d], () => {
|
|
227
|
+
c.value && d.value && (ee.value = re(g.value.width, d.value));
|
|
242
228
|
}, {
|
|
243
229
|
immediate: !0
|
|
244
|
-
}),
|
|
245
|
-
|
|
230
|
+
}), b(() => t.scrollWidth, (e) => {
|
|
231
|
+
d.value = e ?? g.value.width, n.value = K(n.value);
|
|
246
232
|
}, {
|
|
247
233
|
immediate: !0
|
|
248
234
|
});
|
|
249
|
-
function
|
|
235
|
+
function Se(e) {
|
|
250
236
|
const l = e.currentTarget.scrollTop;
|
|
251
|
-
!
|
|
237
|
+
!I.value || !c.value ? s.value = l : l !== s.value && C(l), t.onScroll?.(e), D();
|
|
252
238
|
}
|
|
253
|
-
const [
|
|
254
|
-
const l =
|
|
255
|
-
|
|
256
|
-
},
|
|
257
|
-
|
|
258
|
-
nativeElement:
|
|
259
|
-
getScrollInfo:
|
|
260
|
-
getHorizontalRange: () =>
|
|
239
|
+
const [ne, ye] = Ie(x, u, z, R, V, () => q(!0), (e) => {
|
|
240
|
+
const l = ye(), a = Math.max(o.value, l) - t.height, i = Math.max(0, Math.min(e, a || 0));
|
|
241
|
+
x.value && (x.value.scrollTop = i), s.value = i;
|
|
242
|
+
}, te, () => t.disableHeightMeasure);
|
|
243
|
+
m({
|
|
244
|
+
nativeElement: J,
|
|
245
|
+
getScrollInfo: $,
|
|
246
|
+
getHorizontalRange: () => k.value,
|
|
261
247
|
scrollTo: (e) => {
|
|
262
248
|
function l(a) {
|
|
263
249
|
return a && typeof a == "object" && ("left" in a || "top" in a);
|
|
264
250
|
}
|
|
265
|
-
l(e) ? (e.left !== void 0 && (
|
|
251
|
+
l(e) ? (e.left !== void 0 && (n.value = K(e.left)), ne(e.top)) : ne(e);
|
|
266
252
|
}
|
|
267
|
-
}),
|
|
253
|
+
}), b([f, S, u], () => {
|
|
268
254
|
if (t.onVisibleChange) {
|
|
269
|
-
const e =
|
|
270
|
-
t.onVisibleChange(e,
|
|
255
|
+
const e = u.value.slice(f.value, S.value + 1);
|
|
256
|
+
t.onVisibleChange(e, u.value);
|
|
271
257
|
}
|
|
272
258
|
}, {
|
|
273
259
|
flush: "post"
|
|
274
260
|
});
|
|
275
|
-
const
|
|
261
|
+
const He = Ce(u, V, z, R), xe = ze(u, f, S, d, n, ce, (e, l, a) => L.default?.({
|
|
276
262
|
item: e,
|
|
277
263
|
index: l,
|
|
278
264
|
...a
|
|
279
265
|
}), {
|
|
280
|
-
getKey:
|
|
266
|
+
getKey: V
|
|
281
267
|
});
|
|
282
268
|
return () => {
|
|
283
269
|
const e = {};
|
|
284
|
-
t.height && (e[t.fullHeight ? "height" : "maxHeight"] = `${t.height}px`, Object.assign(e,
|
|
270
|
+
t.height && (e[t.fullHeight ? "height" : "maxHeight"] = `${t.height}px`, Object.assign(e, De), c.value && (e.overflowY = "hidden", k.value > 0 && (e.overflowX = "hidden"), N.value && (e.pointerEvents = "none")));
|
|
285
271
|
const l = t.extraRender?.({
|
|
286
|
-
start:
|
|
287
|
-
end:
|
|
288
|
-
virtual:
|
|
289
|
-
offsetX:
|
|
290
|
-
offsetY:
|
|
291
|
-
rtl:
|
|
292
|
-
getSize:
|
|
272
|
+
start: f.value,
|
|
273
|
+
end: S.value,
|
|
274
|
+
virtual: c.value,
|
|
275
|
+
offsetX: n.value,
|
|
276
|
+
offsetY: B.value || 0,
|
|
277
|
+
rtl: v.value,
|
|
278
|
+
getSize: He
|
|
293
279
|
}), a = t.component;
|
|
294
|
-
return
|
|
295
|
-
ref:
|
|
296
|
-
...
|
|
280
|
+
return F("div", {
|
|
281
|
+
ref: J,
|
|
282
|
+
...Ke(h),
|
|
297
283
|
style: {
|
|
298
284
|
position: "relative",
|
|
299
|
-
...
|
|
285
|
+
...h.style
|
|
300
286
|
},
|
|
301
|
-
dir:
|
|
287
|
+
dir: v.value ? "rtl" : void 0,
|
|
302
288
|
class: [t.prefixCls, {
|
|
303
|
-
[`${t.prefixCls}-rtl`]:
|
|
304
|
-
},
|
|
289
|
+
[`${t.prefixCls}-rtl`]: v.value
|
|
290
|
+
}, h.class],
|
|
305
291
|
onMouseenter: () => {
|
|
306
|
-
|
|
292
|
+
O.value = !0;
|
|
307
293
|
},
|
|
308
294
|
onMouseleave: () => {
|
|
309
|
-
|
|
295
|
+
O.value = !1;
|
|
310
296
|
}
|
|
311
|
-
}, [
|
|
297
|
+
}, [F(a, {
|
|
312
298
|
class: `${t.prefixCls}-holder`,
|
|
313
299
|
style: e,
|
|
314
|
-
ref: (
|
|
315
|
-
|
|
300
|
+
ref: (i) => {
|
|
301
|
+
x.value = i?.$el ?? i, ve(i?.$el ?? i);
|
|
316
302
|
},
|
|
317
|
-
onScroll:
|
|
318
|
-
onWheel:
|
|
319
|
-
onMouseenter:
|
|
303
|
+
onScroll: Se,
|
|
304
|
+
onWheel: me,
|
|
305
|
+
onMouseenter: te
|
|
320
306
|
}, {
|
|
321
|
-
default: () => [
|
|
307
|
+
default: () => [F(Re, {
|
|
322
308
|
prefixCls: t.prefixCls,
|
|
323
|
-
height:
|
|
324
|
-
offsetX:
|
|
325
|
-
offsetY:
|
|
326
|
-
scrollWidth:
|
|
327
|
-
onInnerResize:
|
|
328
|
-
ref:
|
|
309
|
+
height: o.value,
|
|
310
|
+
offsetX: n.value,
|
|
311
|
+
offsetY: B.value,
|
|
312
|
+
scrollWidth: d.value,
|
|
313
|
+
onInnerResize: q,
|
|
314
|
+
ref: G,
|
|
329
315
|
innerProps: t.innerProps,
|
|
330
|
-
rtl:
|
|
316
|
+
rtl: v.value,
|
|
331
317
|
extra: l
|
|
332
318
|
}, {
|
|
333
|
-
default: () => [
|
|
319
|
+
default: () => [xe.value]
|
|
334
320
|
})]
|
|
335
|
-
}),
|
|
336
|
-
ref:
|
|
321
|
+
}), c.value && o.value > (t.height || 0) && F(oe, {
|
|
322
|
+
ref: Q,
|
|
337
323
|
prefixCls: t.prefixCls,
|
|
338
|
-
scrollOffset:
|
|
339
|
-
scrollRange:
|
|
340
|
-
rtl:
|
|
341
|
-
onScroll:
|
|
342
|
-
onStartMove:
|
|
343
|
-
onStopMove:
|
|
344
|
-
spinSize:
|
|
345
|
-
containerSize:
|
|
346
|
-
active:
|
|
324
|
+
scrollOffset: s.value,
|
|
325
|
+
scrollRange: o.value,
|
|
326
|
+
rtl: v.value,
|
|
327
|
+
onScroll: le,
|
|
328
|
+
onStartMove: ae,
|
|
329
|
+
onStopMove: ie,
|
|
330
|
+
spinSize: p.value,
|
|
331
|
+
containerSize: g.value.height,
|
|
332
|
+
active: O.value,
|
|
347
333
|
showScrollBar: t.showScrollBar,
|
|
348
334
|
style: t.styles?.verticalScrollBar,
|
|
349
335
|
thumbStyle: t.styles?.verticalScrollBarThumb
|
|
350
|
-
}),
|
|
351
|
-
ref:
|
|
336
|
+
}), c.value && d.value > g.value.width && F(oe, {
|
|
337
|
+
ref: Z,
|
|
352
338
|
prefixCls: t.prefixCls,
|
|
353
|
-
scrollOffset:
|
|
354
|
-
scrollRange:
|
|
355
|
-
rtl:
|
|
356
|
-
onScroll:
|
|
357
|
-
onStartMove:
|
|
358
|
-
onStopMove:
|
|
359
|
-
spinSize:
|
|
360
|
-
containerSize:
|
|
339
|
+
scrollOffset: n.value,
|
|
340
|
+
scrollRange: d.value,
|
|
341
|
+
rtl: v.value,
|
|
342
|
+
onScroll: le,
|
|
343
|
+
onStartMove: ae,
|
|
344
|
+
onStopMove: ie,
|
|
345
|
+
spinSize: ee.value,
|
|
346
|
+
containerSize: g.value.width,
|
|
361
347
|
horizontal: !0,
|
|
362
|
-
active:
|
|
348
|
+
active: O.value,
|
|
363
349
|
showScrollBar: t.showScrollBar,
|
|
364
350
|
style: t.styles?.horizontalScrollBar,
|
|
365
351
|
thumbStyle: t.styles?.horizontalScrollBarThumb
|
|
@@ -368,6 +354,5 @@ const qe = /* @__PURE__ */ Ie({
|
|
|
368
354
|
}
|
|
369
355
|
});
|
|
370
356
|
export {
|
|
371
|
-
|
|
372
|
-
Ke as getMeasuredVisibleRange
|
|
357
|
+
Qe as default
|
|
373
358
|
};
|