@vtable-guild/vtable-guild 2.4.1 → 2.6.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 +12 -0
- package/css/tailwind3-utilities.css +12 -0
- package/dist/core/src/components/VTableGuildConfigProvider.d.ts.map +1 -1
- package/dist/core/src/components/VTableGuildConfigProvider.mjs +17 -12
- 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 +9 -1
- package/dist/core/src/composables/useTheme.d.ts.map +1 -1
- package/dist/core/src/composables/useTheme.mjs +83 -60
- package/dist/core/src/index.d.ts +9 -0
- package/dist/core/src/index.d.ts.map +1 -1
- package/dist/core/src/plugin/index.d.ts.map +1 -1
- package/dist/core/src/plugin/index.mjs +4 -3
- package/dist/core/src/utils/types.d.ts +3 -0
- package/dist/core/src/utils/types.d.ts.map +1 -1
- package/dist/css/style.css +12 -0
- package/dist/css/tailwind3-utilities.css +12 -0
- package/dist/index.full.mjs +3450 -3006
- package/dist/index.mjs +41 -37
- 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 +68 -6
- package/dist/table/src/components/Table.d.ts.map +1 -1
- package/dist/table/src/components/Table.mjs +361 -297
- package/dist/table/src/components/TableBody.d.ts.map +1 -1
- package/dist/table/src/components/TableBody.mjs +38 -37
- 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 +85 -60
- package/dist/table/src/components/TableHeaderCell.d.ts.map +1 -1
- package/dist/table/src/components/TableHeaderCell.mjs +177 -174
- package/dist/table/src/components/VTable.vue.mjs +10 -8
- package/dist/table/src/components/VTableCompatClass.test.d.ts +2 -0
- package/dist/table/src/components/VTableCompatClass.test.d.ts.map +1 -0
- 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 +158 -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/useFixedColumnStyle.d.ts.map +1 -1
- package/dist/table/src/composables/useFixedColumnStyle.mjs +12 -11
- 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/context.d.ts +7 -0
- package/dist/table/src/context.d.ts.map +1 -1
- 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/table/src/utils/compat.d.ts +9 -0
- package/dist/table/src/utils/compat.d.ts.map +1 -0
- package/dist/table/src/utils/compat.mjs +28 -0
- package/dist/theme/src/compat/antdv-table.d.ts +4 -0
- package/dist/theme/src/compat/antdv-table.d.ts.map +1 -0
- package/dist/theme/src/compat/antdv-table.mjs +51 -0
- package/dist/theme/src/index.d.ts +2 -0
- package/dist/theme/src/index.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 +1 -1
- 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
|
@@ -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
|
};
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { default as CacheMap } from '../utils/CacheMap';
|
|
2
2
|
import { Key } from '../interface';
|
|
3
3
|
import { ref } from 'vue';
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* @param disabled 定高快路径开关。返回 true 时**完全不测量**:
|
|
6
|
+
* 不注册 ResizeObserver、不读 offsetHeight/getComputedStyle、不写 CacheMap。
|
|
7
|
+
* 于是 `heights.id` 恒为 0,VirtualList 的可视区计算永远走 O(1) 的估算分支,
|
|
8
|
+
* 不再每次滚动重建整表前缀和。代价是行高必须真的等于声明值(调用方负责校验)。
|
|
9
|
+
*/
|
|
10
|
+
export default function useHeights(getKey: (item: any) => Key, onItemAdd?: (item: any) => void, onItemRemove?: (item: any) => void, disabled?: () => boolean): [
|
|
5
11
|
setInstanceRef: (item: any, instance: HTMLElement | null) => void,
|
|
6
12
|
collectHeight: (sync?: boolean) => void,
|
|
7
13
|
heights: CacheMap,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useHeights.d.ts","sourceRoot":"","sources":["../../../../../../../core/src/components/VirtualList/hooks/useHeights.ts"],"names":[],"mappings":"AACA,OAAO,QAAQ,MAAM,mBAAmB,CAAA;AACxC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AACvC,OAAO,EAAwB,GAAG,EAAE,MAAM,KAAK,CAAA;AAa/C,MAAM,CAAC,OAAO,UAAU,UAAU,CAChC,MAAM,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,GAAG,EAC1B,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,EAC/B,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,
|
|
1
|
+
{"version":3,"file":"useHeights.d.ts","sourceRoot":"","sources":["../../../../../../../core/src/components/VirtualList/hooks/useHeights.ts"],"names":[],"mappings":"AACA,OAAO,QAAQ,MAAM,mBAAmB,CAAA;AACxC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AACvC,OAAO,EAAwB,GAAG,EAAE,MAAM,KAAK,CAAA;AAa/C;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,CAChC,MAAM,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,GAAG,EAC1B,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,EAC/B,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,EAClC,QAAQ,CAAC,EAAE,MAAM,OAAO,GACvB;IACD,cAAc,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI;IACjE,aAAa,EAAE,CAAC,IAAI,CAAC,EAAE,OAAO,KAAK,IAAI;IACvC,OAAO,EAAE,QAAQ;IACjB,WAAW,EAAE,UAAU,CAAC,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC;CAC5C,CA8FA"}
|