@vtable-guild/vtable-guild 2.8.0 → 2.8.1
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/dist/core/src/components/VirtualList/VirtualList.d.ts +3 -3
- package/dist/core/src/components/VirtualList/VirtualList.d.ts.map +1 -1
- package/dist/core/src/components/VirtualList/VirtualList.mjs +183 -177
- package/dist/core/src/components/VirtualList/hooks/useChildren.d.ts +2 -2
- package/dist/core/src/components/VirtualList/hooks/useChildren.d.ts.map +1 -1
- package/dist/core/src/components/VirtualList/hooks/useChildren.mjs +12 -12
- package/dist/core/src/components/VirtualList/hooks/useGetSize.d.ts +1 -1
- package/dist/core/src/components/VirtualList/hooks/useGetSize.d.ts.map +1 -1
- package/dist/core/src/components/VirtualList/hooks/useGetSize.mjs +1 -1
- package/dist/core/src/components/VirtualList/hooks/useHeights.d.ts +2 -2
- package/dist/core/src/components/VirtualList/hooks/useHeights.d.ts.map +1 -1
- package/dist/core/src/components/VirtualList/hooks/useHeights.mjs +36 -36
- package/dist/core/src/components/VirtualList/hooks/useMobileTouchMove.d.ts.map +1 -1
- package/dist/core/src/components/VirtualList/hooks/useMobileTouchMove.mjs +11 -11
- package/dist/core/src/components/VirtualList/hooks/useMobileTouchMove.test.d.ts +2 -0
- package/dist/core/src/components/VirtualList/hooks/useMobileTouchMove.test.d.ts.map +1 -0
- package/dist/core/src/components/VirtualList/hooks/useScrollTo.d.ts +1 -1
- package/dist/core/src/components/VirtualList/hooks/useScrollTo.d.ts.map +1 -1
- package/dist/core/src/components/VirtualList/hooks/useScrollTo.mjs +30 -30
- package/dist/index.d.ts +0 -28
- package/dist/index.full.mjs +2441 -2428
- package/dist/table/src/components/Table.d.ts.map +1 -1
- package/dist/table/src/components/Table.mjs +112 -113
- package/dist/table/src/components/VTableSummary.d.ts +15 -75
- package/dist/table/src/components/VTableSummary.d.ts.map +1 -1
- package/dist/table/src/components/VTableSummary.mjs +7 -7
- package/dist/table/src/components/VirtualTableBody.d.ts.map +1 -1
- package/dist/table/src/components/VirtualTableBody.mjs +2 -3
- package/dist/table/src/composables/useExpand.d.ts.map +1 -1
- package/dist/table/src/composables/useExpand.mjs +28 -30
- package/dist/table/src/composables/useSelection.d.ts.map +1 -1
- package/dist/table/src/composables/useSelection.mjs +136 -126
- package/dist/table/src/index.d.ts +8 -87
- package/dist/table/src/index.d.ts.map +1 -1
- package/dist/table/src/index.mjs +12 -12
- package/dist/vtable-guild/src/augment.d.ts +15 -0
- package/dist/vtable-guild/src/augment.d.ts.map +1 -0
- package/dist/vtable-guild/src/index.d.ts +1 -0
- package/dist/vtable-guild/src/index.d.ts.map +1 -1
- package/package.json +4 -3
|
@@ -21,7 +21,7 @@ export interface ListProps {
|
|
|
21
21
|
height?: number;
|
|
22
22
|
itemHeight?: number;
|
|
23
23
|
fullHeight?: boolean;
|
|
24
|
-
itemKey: Key | ((item: any) => Key);
|
|
24
|
+
itemKey: Key | ((item: any, index?: number) => Key);
|
|
25
25
|
component?: string;
|
|
26
26
|
virtual?: boolean;
|
|
27
27
|
direction?: ScrollBarDirectionType;
|
|
@@ -79,7 +79,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
79
79
|
default: boolean;
|
|
80
80
|
};
|
|
81
81
|
itemKey: {
|
|
82
|
-
type: PropType<Key | ((item: any) => Key)>;
|
|
82
|
+
type: PropType<Key | ((item: any, index?: number) => Key)>;
|
|
83
83
|
required: true;
|
|
84
84
|
};
|
|
85
85
|
component: {
|
|
@@ -126,7 +126,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
126
126
|
default: boolean;
|
|
127
127
|
};
|
|
128
128
|
itemKey: {
|
|
129
|
-
type: PropType<Key | ((item: any) => Key)>;
|
|
129
|
+
type: PropType<Key | ((item: any, index?: number) => Key)>;
|
|
130
130
|
required: true;
|
|
131
131
|
};
|
|
132
132
|
component: {
|
|
@@ -1 +1 @@
|
|
|
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,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,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,EAAE,GAAG,GAAG,CAAC,CAAC,IAAI,EAAE,GAAG,KAAK,GAAG,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"VirtualList.d.ts","sourceRoot":"","sources":["../../../../../../core/src/components/VirtualList/VirtualList.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,YAAY,EAAE,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
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import { getSpinSize as
|
|
11
|
-
import { PrefixSums as
|
|
12
|
-
import { defineComponent as
|
|
13
|
-
const
|
|
1
|
+
import Be from "./Filler.mjs";
|
|
2
|
+
import Ce from "./hooks/useChildren.mjs";
|
|
3
|
+
import Te from "./hooks/useFrameWheel.mjs";
|
|
4
|
+
import { useGetSize as we } from "./hooks/useGetSize.mjs";
|
|
5
|
+
import Ie from "./hooks/useHeights.mjs";
|
|
6
|
+
import Ve from "./hooks/useMobileTouchMove.mjs";
|
|
7
|
+
import Ae from "./hooks/useScrollDrag.mjs";
|
|
8
|
+
import We from "./hooks/useScrollTo.mjs";
|
|
9
|
+
import re from "./VirtualScrollBar.mjs";
|
|
10
|
+
import { getSpinSize as ce } from "./utils/scrollbarUtil.mjs";
|
|
11
|
+
import { PrefixSums as ke } from "./utils/PrefixSums.mjs";
|
|
12
|
+
import { defineComponent as Fe, computed as H, watch as x, shallowRef as q, ref as u, unref as De, toRaw as Ke, onBeforeUnmount as Oe, createVNode as P } from "vue";
|
|
13
|
+
const se = [], Pe = {
|
|
14
14
|
overflowY: "auto",
|
|
15
15
|
overflowAnchor: "none"
|
|
16
16
|
};
|
|
17
|
-
function
|
|
17
|
+
function je(t) {
|
|
18
18
|
const m = {};
|
|
19
19
|
for (const h of Object.keys(t))
|
|
20
20
|
h.startsWith("on") || (m[h] = t[h]);
|
|
21
21
|
return m;
|
|
22
22
|
}
|
|
23
|
-
function
|
|
24
|
-
let
|
|
25
|
-
|
|
26
|
-
let
|
|
27
|
-
return
|
|
23
|
+
function Le(t, m, h, $) {
|
|
24
|
+
let z = t.findIndex(h);
|
|
25
|
+
z >= m && (z = 0);
|
|
26
|
+
let M = t.findIndex(h + $ + 1);
|
|
27
|
+
return M >= m && (M = m - 1), M = Math.min(M + 1, m - 1), {
|
|
28
28
|
scrollHeight: t.total,
|
|
29
|
-
start:
|
|
30
|
-
end:
|
|
31
|
-
offset: t.offsetOf(
|
|
29
|
+
start: z,
|
|
30
|
+
end: M,
|
|
31
|
+
offset: t.offsetOf(z)
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
|
-
const
|
|
34
|
+
const pe = /* @__PURE__ */ Fe({
|
|
35
35
|
name: "VirtualList",
|
|
36
36
|
props: {
|
|
37
37
|
prefixCls: {
|
|
@@ -83,276 +83,282 @@ const Qe = /* @__PURE__ */ We({
|
|
|
83
83
|
setup(t, {
|
|
84
84
|
expose: m,
|
|
85
85
|
attrs: h,
|
|
86
|
-
slots:
|
|
86
|
+
slots: $
|
|
87
87
|
}) {
|
|
88
|
-
const
|
|
89
|
-
let
|
|
90
|
-
|
|
91
|
-
|
|
88
|
+
const z = H(() => t.itemHeight);
|
|
89
|
+
let M = t.itemKey;
|
|
90
|
+
x(() => t.itemKey, (e) => {
|
|
91
|
+
M = e;
|
|
92
92
|
});
|
|
93
|
-
const
|
|
94
|
-
const
|
|
95
|
-
return typeof
|
|
96
|
-
}, [
|
|
97
|
-
|
|
98
|
-
|
|
93
|
+
const I = (e, l) => {
|
|
94
|
+
const a = M;
|
|
95
|
+
return typeof a == "function" ? a(e, l) : e?.[a];
|
|
96
|
+
}, [ve, G, B, fe] = Ie(I, void 0, void 0, () => t.disableHeightMeasure), c = q(t?.data || se);
|
|
97
|
+
x(() => t.data, () => {
|
|
98
|
+
c.value = t?.data || se;
|
|
99
99
|
});
|
|
100
|
-
const
|
|
101
|
-
const e =
|
|
102
|
-
return
|
|
103
|
-
}),
|
|
104
|
-
function
|
|
100
|
+
const W = H(() => !!(t.virtual !== !1 && t.height && t.itemHeight)), s = H(() => {
|
|
101
|
+
const e = c.value;
|
|
102
|
+
return W.value && e && (t.itemHeight * e.length > t.height || !!t.scrollWidth);
|
|
103
|
+
}), b = u(), J = u(), Q = u(), j = u(!1), Z = q(), p = q(), r = u(0), n = u(0), E = u(!1), ee = u(0), te = u(0), d = u(t.scrollWidth || 0), o = u(0), v = u(0), S = u(0), C = u(void 0);
|
|
104
|
+
function le(e) {
|
|
105
|
+
const l = o.value - t.height;
|
|
106
|
+
return Math.max(0, Math.min(e, l || 0));
|
|
107
|
+
}
|
|
108
|
+
function T(e) {
|
|
105
109
|
let l;
|
|
106
|
-
typeof e == "function" ? l = e(
|
|
107
|
-
const a =
|
|
108
|
-
|
|
110
|
+
typeof e == "function" ? l = e(r.value) : l = e;
|
|
111
|
+
const a = le(l);
|
|
112
|
+
b.value && (b.value.scrollTop = a), r.value = a;
|
|
109
113
|
}
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
if (!
|
|
113
|
-
|
|
114
|
+
const V = new ke();
|
|
115
|
+
x([s, W, r, c, fe, () => t.height, () => t.itemHeight], ([, , , e, l, , a], i) => {
|
|
116
|
+
if (!i)
|
|
117
|
+
V.markAllDirty();
|
|
114
118
|
else {
|
|
115
|
-
const [, , ,
|
|
116
|
-
e !==
|
|
119
|
+
const [, , , y, U, , O] = i;
|
|
120
|
+
e !== y || a !== O ? V.markAllDirty() : l !== U && V.markDirtyFrom(v.value);
|
|
117
121
|
}
|
|
118
|
-
if (!
|
|
119
|
-
o.value = 0,
|
|
122
|
+
if (!W.value) {
|
|
123
|
+
o.value = 0, v.value = 0, S.value = c.value.length - 1, C.value = void 0;
|
|
120
124
|
return;
|
|
121
125
|
}
|
|
122
126
|
if (!s.value) {
|
|
123
|
-
o.value =
|
|
127
|
+
o.value = J.value?.offsetHeight || 0, v.value = 0, S.value = c.value.length - 1, C.value = void 0;
|
|
124
128
|
return;
|
|
125
129
|
}
|
|
126
130
|
const {
|
|
127
|
-
itemHeight:
|
|
128
|
-
height:
|
|
129
|
-
} = t,
|
|
130
|
-
if (!
|
|
131
|
-
o.value = 0,
|
|
131
|
+
itemHeight: R,
|
|
132
|
+
height: L
|
|
133
|
+
} = t, K = c.value.length;
|
|
134
|
+
if (!K) {
|
|
135
|
+
o.value = 0, v.value = 0, S.value = -1, C.value = 0;
|
|
132
136
|
return;
|
|
133
137
|
}
|
|
134
|
-
if (
|
|
135
|
-
const
|
|
136
|
-
let
|
|
137
|
-
|
|
138
|
+
if (De(B.id) === 0) {
|
|
139
|
+
const y = R, U = L, O = Math.max(0, Math.floor(r.value / y)), ze = O * y;
|
|
140
|
+
let _ = O + Math.ceil(U / y);
|
|
141
|
+
_ = Math.min(_ + 1, K - 1), o.value = K * y, v.value = O, S.value = _, C.value = ze;
|
|
138
142
|
return;
|
|
139
143
|
}
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
const
|
|
143
|
-
o.value =
|
|
144
|
+
const Re = Ke(c.value);
|
|
145
|
+
V.sync(K, (y) => B.get(I(Re[y], y)), R);
|
|
146
|
+
const N = Le(V, K, r.value, L);
|
|
147
|
+
o.value = N.scrollHeight, v.value = N.start, S.value = N.end, C.value = N.offset;
|
|
144
148
|
}, {
|
|
145
149
|
immediate: !0
|
|
146
|
-
}),
|
|
147
|
-
const e =
|
|
150
|
+
}), x(o, () => {
|
|
151
|
+
const e = B.getRecord();
|
|
148
152
|
if (e.size === 1) {
|
|
149
|
-
const l = Array.from(e.keys())[0], a = e.get(l),
|
|
150
|
-
if (
|
|
151
|
-
const
|
|
152
|
-
|
|
153
|
+
const l = Array.from(e.keys())[0], a = e.get(l), i = c.value[v.value];
|
|
154
|
+
if (i && a === void 0 && I(i, v.value) === l) {
|
|
155
|
+
const R = B.get(l) - t.itemHeight;
|
|
156
|
+
T((L) => L + R);
|
|
153
157
|
}
|
|
154
158
|
}
|
|
155
|
-
if (
|
|
159
|
+
if (W.value && t.height) {
|
|
156
160
|
const l = Math.max(0, o.value - t.height);
|
|
157
|
-
|
|
161
|
+
r.value > l && T(l);
|
|
158
162
|
}
|
|
159
|
-
|
|
163
|
+
B.resetRecord();
|
|
160
164
|
});
|
|
161
165
|
const g = u({
|
|
162
166
|
width: 0,
|
|
163
167
|
height: t.height || 0
|
|
164
168
|
});
|
|
165
169
|
let w = null, k = null;
|
|
166
|
-
const
|
|
170
|
+
const he = (e) => {
|
|
167
171
|
k !== e && (w && k && w.unobserve(k), k = e, e && (w || (w = new ResizeObserver((l) => {
|
|
168
172
|
const a = l[0];
|
|
169
173
|
if (a) {
|
|
170
|
-
const
|
|
174
|
+
const i = a.target;
|
|
171
175
|
g.value = {
|
|
172
|
-
width:
|
|
173
|
-
height:
|
|
174
|
-
}, d.value = t.scrollWidth ??
|
|
176
|
+
width: i.offsetWidth,
|
|
177
|
+
height: i.offsetHeight
|
|
178
|
+
}, d.value = t.scrollWidth ?? i.offsetWidth;
|
|
175
179
|
}
|
|
176
180
|
})), w.observe(e)));
|
|
177
181
|
};
|
|
178
182
|
Oe(() => {
|
|
179
183
|
w?.disconnect(), w = null, k = null;
|
|
180
184
|
});
|
|
181
|
-
const
|
|
182
|
-
x:
|
|
183
|
-
y:
|
|
184
|
-
}),
|
|
185
|
+
const f = H(() => t.direction === "rtl"), X = () => ({
|
|
186
|
+
x: f.value ? -n.value : n.value,
|
|
187
|
+
y: r.value
|
|
188
|
+
}), Y = u(X()), F = (e, l = !1) => {
|
|
185
189
|
if (t.onVirtualScroll) {
|
|
186
190
|
const a = {
|
|
187
|
-
|
|
191
|
+
...X(),
|
|
188
192
|
...e
|
|
189
193
|
};
|
|
190
|
-
(l ||
|
|
194
|
+
(l || Y.value.x !== a.x || Y.value.y !== a.y) && (t.onVirtualScroll(a), Y.value = a);
|
|
191
195
|
}
|
|
192
|
-
},
|
|
193
|
-
|
|
194
|
-
|
|
196
|
+
}, A = H(() => Math.max(0, (d.value || 0) - g.value.width)), de = H(() => r.value === 0), ge = H(() => r.value + t.height >= o.value), me = H(() => n.value === 0), Se = H(() => n.value >= A.value), D = (e) => Math.max(0, Math.min(e, A.value));
|
|
197
|
+
x(A, () => {
|
|
198
|
+
n.value = D(n.value), F(void 0, !0);
|
|
195
199
|
}, {
|
|
196
200
|
flush: "post"
|
|
197
201
|
});
|
|
198
|
-
const
|
|
199
|
-
|
|
200
|
-
}, [
|
|
202
|
+
const ae = () => {
|
|
203
|
+
Z.value?.delayHidden(), p.value?.delayHidden();
|
|
204
|
+
}, [ye] = Te(s, de, ge, me, Se, A.value > 0, (e, l) => {
|
|
201
205
|
if (l) {
|
|
202
|
-
const a =
|
|
203
|
-
|
|
204
|
-
x:
|
|
206
|
+
const a = D(f.value ? n.value - e : n.value + e);
|
|
207
|
+
n.value = a, F({
|
|
208
|
+
x: f.value ? -a : a
|
|
205
209
|
});
|
|
206
210
|
} else
|
|
207
|
-
|
|
211
|
+
T((a) => a + e);
|
|
208
212
|
});
|
|
209
|
-
|
|
213
|
+
Ve(s, b, (e, l, a) => {
|
|
210
214
|
if (e) {
|
|
211
|
-
const
|
|
212
|
-
return
|
|
213
|
-
x:
|
|
214
|
-
}), !0;
|
|
215
|
-
} else
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
215
|
+
const i = D(f.value ? n.value - l : n.value + l), R = i !== n.value;
|
|
216
|
+
return n.value = i, F({
|
|
217
|
+
x: f.value ? -i : i
|
|
218
|
+
}), a ? R : !0;
|
|
219
|
+
} else {
|
|
220
|
+
const i = le(r.value + l) !== r.value;
|
|
221
|
+
return T((R) => R + l), a ? i : !0;
|
|
222
|
+
}
|
|
223
|
+
}), Ae(s, b, (e) => {
|
|
224
|
+
T((l) => l + e);
|
|
219
225
|
});
|
|
220
|
-
const
|
|
221
|
-
l ? (
|
|
222
|
-
x:
|
|
223
|
-
})) :
|
|
224
|
-
},
|
|
225
|
-
|
|
226
|
-
},
|
|
227
|
-
|
|
226
|
+
const ie = (e, l) => {
|
|
227
|
+
l ? (n.value = e, F({
|
|
228
|
+
x: f.value ? -e : e
|
|
229
|
+
})) : T(e);
|
|
230
|
+
}, ne = () => {
|
|
231
|
+
E.value = !0;
|
|
232
|
+
}, oe = () => {
|
|
233
|
+
E.value = !1;
|
|
228
234
|
};
|
|
229
|
-
|
|
230
|
-
s.value && t.height && o.value && (
|
|
235
|
+
x([() => t.height, o, s, () => g.value.height], () => {
|
|
236
|
+
s.value && t.height && o.value && (ee.value = ce(g.value.height, o.value));
|
|
231
237
|
}, {
|
|
232
238
|
immediate: !0
|
|
233
|
-
}),
|
|
234
|
-
s.value && d.value && (
|
|
239
|
+
}), x([() => g.value.width, d], () => {
|
|
240
|
+
s.value && d.value && (te.value = ce(g.value.width, d.value));
|
|
235
241
|
}, {
|
|
236
242
|
immediate: !0
|
|
237
|
-
}),
|
|
238
|
-
d.value = e ?? g.value.width,
|
|
243
|
+
}), x(() => t.scrollWidth, (e) => {
|
|
244
|
+
d.value = e ?? g.value.width, n.value = D(n.value);
|
|
239
245
|
}, {
|
|
240
246
|
immediate: !0
|
|
241
247
|
});
|
|
242
|
-
function
|
|
248
|
+
function He(e) {
|
|
243
249
|
const l = e.currentTarget.scrollTop;
|
|
244
|
-
!
|
|
250
|
+
!W.value || !s.value ? r.value = l : l !== r.value && T(l), t.onScroll?.(e), F();
|
|
245
251
|
}
|
|
246
|
-
const [
|
|
247
|
-
const l =
|
|
248
|
-
|
|
249
|
-
},
|
|
252
|
+
const [ue, xe] = We(b, c, B, z, I, () => G(!0), (e) => {
|
|
253
|
+
const l = xe(), a = Math.max(o.value, l) - t.height, i = Math.max(0, Math.min(e, a || 0));
|
|
254
|
+
b.value && (b.value.scrollTop = i), r.value = i;
|
|
255
|
+
}, ae, () => t.disableHeightMeasure);
|
|
250
256
|
m({
|
|
251
|
-
nativeElement:
|
|
252
|
-
getScrollInfo:
|
|
253
|
-
getHorizontalRange: () =>
|
|
257
|
+
nativeElement: Q,
|
|
258
|
+
getScrollInfo: X,
|
|
259
|
+
getHorizontalRange: () => A.value,
|
|
254
260
|
scrollTo: (e) => {
|
|
255
261
|
function l(a) {
|
|
256
262
|
return a && typeof a == "object" && ("left" in a || "top" in a);
|
|
257
263
|
}
|
|
258
|
-
l(e) ? (e.left !== void 0 && (
|
|
264
|
+
l(e) ? (e.left !== void 0 && (n.value = D(e.left)), ue(e.top)) : ue(e);
|
|
259
265
|
}
|
|
260
|
-
}),
|
|
266
|
+
}), x([v, S, c], () => {
|
|
261
267
|
if (t.onVisibleChange) {
|
|
262
|
-
const e =
|
|
263
|
-
t.onVisibleChange(e,
|
|
268
|
+
const e = c.value.slice(v.value, S.value + 1);
|
|
269
|
+
t.onVisibleChange(e, c.value);
|
|
264
270
|
}
|
|
265
271
|
}, {
|
|
266
272
|
flush: "post"
|
|
267
273
|
});
|
|
268
|
-
const
|
|
274
|
+
const Me = we(c, I, B, z), be = Ce(c, v, S, d, n, ve, (e, l, a) => $.default?.({
|
|
269
275
|
item: e,
|
|
270
276
|
index: l,
|
|
271
277
|
...a
|
|
272
278
|
}), {
|
|
273
|
-
getKey:
|
|
279
|
+
getKey: I
|
|
274
280
|
});
|
|
275
281
|
return () => {
|
|
276
282
|
const e = {};
|
|
277
|
-
t.height && (e[t.fullHeight ? "height" : "maxHeight"] = `${t.height}px`, Object.assign(e,
|
|
283
|
+
t.height && (e[t.fullHeight ? "height" : "maxHeight"] = `${t.height}px`, Object.assign(e, Pe), s.value && (e.overflowY = "hidden", A.value > 0 && (e.overflowX = "hidden"), E.value && (e.pointerEvents = "none")));
|
|
278
284
|
const l = t.extraRender?.({
|
|
279
|
-
start:
|
|
285
|
+
start: v.value,
|
|
280
286
|
end: S.value,
|
|
281
287
|
virtual: s.value,
|
|
282
|
-
offsetX:
|
|
283
|
-
offsetY:
|
|
284
|
-
rtl:
|
|
285
|
-
getSize:
|
|
288
|
+
offsetX: n.value,
|
|
289
|
+
offsetY: C.value || 0,
|
|
290
|
+
rtl: f.value,
|
|
291
|
+
getSize: Me
|
|
286
292
|
}), a = t.component;
|
|
287
|
-
return
|
|
288
|
-
ref:
|
|
289
|
-
...
|
|
293
|
+
return P("div", {
|
|
294
|
+
ref: Q,
|
|
295
|
+
...je(h),
|
|
290
296
|
style: {
|
|
291
297
|
position: "relative",
|
|
292
298
|
...h.style
|
|
293
299
|
},
|
|
294
|
-
dir:
|
|
300
|
+
dir: f.value ? "rtl" : void 0,
|
|
295
301
|
class: [t.prefixCls, {
|
|
296
|
-
[`${t.prefixCls}-rtl`]:
|
|
302
|
+
[`${t.prefixCls}-rtl`]: f.value
|
|
297
303
|
}, h.class],
|
|
298
304
|
onMouseenter: () => {
|
|
299
|
-
|
|
305
|
+
j.value = !0;
|
|
300
306
|
},
|
|
301
307
|
onMouseleave: () => {
|
|
302
|
-
|
|
308
|
+
j.value = !1;
|
|
303
309
|
}
|
|
304
|
-
}, [
|
|
310
|
+
}, [P(a, {
|
|
305
311
|
class: [`${t.prefixCls}-holder`, t.holderClass],
|
|
306
312
|
style: e,
|
|
307
|
-
ref: (
|
|
308
|
-
|
|
313
|
+
ref: (i) => {
|
|
314
|
+
b.value = i?.$el ?? i, he(i?.$el ?? i);
|
|
309
315
|
},
|
|
310
|
-
onScroll:
|
|
311
|
-
onWheel:
|
|
312
|
-
onMouseenter:
|
|
316
|
+
onScroll: He,
|
|
317
|
+
onWheel: ye,
|
|
318
|
+
onMouseenter: ae
|
|
313
319
|
}, {
|
|
314
|
-
default: () => [
|
|
320
|
+
default: () => [P(Be, {
|
|
315
321
|
prefixCls: t.prefixCls,
|
|
316
322
|
height: o.value,
|
|
317
|
-
offsetX:
|
|
318
|
-
offsetY:
|
|
323
|
+
offsetX: n.value,
|
|
324
|
+
offsetY: C.value,
|
|
319
325
|
scrollWidth: d.value,
|
|
320
|
-
onInnerResize:
|
|
321
|
-
ref:
|
|
326
|
+
onInnerResize: G,
|
|
327
|
+
ref: J,
|
|
322
328
|
innerProps: t.innerProps,
|
|
323
|
-
rtl:
|
|
329
|
+
rtl: f.value,
|
|
324
330
|
extra: l
|
|
325
331
|
}, {
|
|
326
|
-
default: () => [
|
|
332
|
+
default: () => [be.value]
|
|
327
333
|
})]
|
|
328
|
-
}), s.value && o.value > (t.height || 0) &&
|
|
329
|
-
ref:
|
|
334
|
+
}), s.value && o.value > (t.height || 0) && P(re, {
|
|
335
|
+
ref: Z,
|
|
330
336
|
prefixCls: t.prefixCls,
|
|
331
|
-
scrollOffset:
|
|
337
|
+
scrollOffset: r.value,
|
|
332
338
|
scrollRange: o.value,
|
|
333
|
-
rtl:
|
|
334
|
-
onScroll:
|
|
335
|
-
onStartMove:
|
|
336
|
-
onStopMove:
|
|
337
|
-
spinSize:
|
|
339
|
+
rtl: f.value,
|
|
340
|
+
onScroll: ie,
|
|
341
|
+
onStartMove: ne,
|
|
342
|
+
onStopMove: oe,
|
|
343
|
+
spinSize: ee.value,
|
|
338
344
|
containerSize: g.value.height,
|
|
339
|
-
active:
|
|
345
|
+
active: j.value,
|
|
340
346
|
showScrollBar: t.showScrollBar,
|
|
341
347
|
style: t.styles?.verticalScrollBar,
|
|
342
348
|
thumbStyle: t.styles?.verticalScrollBarThumb
|
|
343
|
-
}), s.value && d.value > g.value.width &&
|
|
344
|
-
ref:
|
|
349
|
+
}), s.value && d.value > g.value.width && P(re, {
|
|
350
|
+
ref: p,
|
|
345
351
|
prefixCls: t.prefixCls,
|
|
346
|
-
scrollOffset:
|
|
352
|
+
scrollOffset: n.value,
|
|
347
353
|
scrollRange: d.value,
|
|
348
|
-
rtl:
|
|
349
|
-
onScroll:
|
|
350
|
-
onStartMove:
|
|
351
|
-
onStopMove:
|
|
352
|
-
spinSize:
|
|
354
|
+
rtl: f.value,
|
|
355
|
+
onScroll: ie,
|
|
356
|
+
onStartMove: ne,
|
|
357
|
+
onStopMove: oe,
|
|
358
|
+
spinSize: te.value,
|
|
353
359
|
containerSize: g.value.width,
|
|
354
360
|
horizontal: !0,
|
|
355
|
-
active:
|
|
361
|
+
active: j.value,
|
|
356
362
|
showScrollBar: t.showScrollBar,
|
|
357
363
|
style: t.styles?.horizontalScrollBar,
|
|
358
364
|
thumbStyle: t.styles?.horizontalScrollBarThumb
|
|
@@ -361,5 +367,5 @@ const Qe = /* @__PURE__ */ We({
|
|
|
361
367
|
}
|
|
362
368
|
});
|
|
363
369
|
export {
|
|
364
|
-
|
|
370
|
+
pe as default
|
|
365
371
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { CSSProperties, Ref, VNode } from 'vue';
|
|
2
2
|
import { Key } from '../interface';
|
|
3
|
-
export default function useChildren(list: Ref<any[]>, startIndex: Ref<number>, endIndex: Ref<number>, scrollWidth: Ref<number>, offsetX: Ref<number>, setNodeRef: (item: any, ele: HTMLElement | null) => void, renderFunc: (item: any, index: number, props: {
|
|
3
|
+
export default function useChildren(list: Ref<any[]>, startIndex: Ref<number>, endIndex: Ref<number>, scrollWidth: Ref<number>, offsetX: Ref<number>, setNodeRef: (item: any, ele: HTMLElement | null, index?: number) => void, renderFunc: (item: any, index: number, props: {
|
|
4
4
|
style: CSSProperties;
|
|
5
5
|
offsetX: number;
|
|
6
6
|
}) => VNode[] | undefined, { getKey }: {
|
|
7
|
-
getKey: (item: any) => Key;
|
|
7
|
+
getKey: (item: any, index?: number) => Key;
|
|
8
8
|
}): import('vue').ComputedRef<VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
9
9
|
[key: string]: any;
|
|
10
10
|
}>[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useChildren.d.ts","sourceRoot":"","sources":["../../../../../../../core/src/components/VirtualList/hooks/useChildren.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,KAAK,CAAA;AACpD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AASvC,MAAM,CAAC,OAAO,UAAU,WAAW,CACjC,IAAI,EAAE,GAAG,CAAC,GAAG,EAAE,CAAC,EAChB,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,EACvB,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,EACrB,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,EACxB,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"useChildren.d.ts","sourceRoot":"","sources":["../../../../../../../core/src/components/VirtualList/hooks/useChildren.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,KAAK,CAAA;AACpD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AASvC,MAAM,CAAC,OAAO,UAAU,WAAW,CACjC,IAAI,EAAE,GAAG,CAAC,GAAG,EAAE,CAAC,EAChB,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,EACvB,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,EACrB,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,EACxB,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,EAGpB,UAAU,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,WAAW,GAAG,IAAI,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,EACxE,UAAU,EAAE,CACV,IAAI,EAAE,GAAG,EACT,KAAK,EAAE,MAAM,EACb,KAAK,EAAE;IAAE,KAAK,EAAE,aAAa,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,KAC7C,KAAK,EAAE,GAAG,SAAS,EACxB,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,GAAG,CAAA;CAAE;;MAyB3D"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { computed as
|
|
3
|
-
function
|
|
1
|
+
import v from "../Item.mjs";
|
|
2
|
+
import { computed as m, createVNode as b, isVNode as y } from "vue";
|
|
3
|
+
function j(e) {
|
|
4
4
|
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !y(e);
|
|
5
5
|
}
|
|
6
|
-
function N(e,
|
|
7
|
-
return
|
|
8
|
-
const o =
|
|
6
|
+
function N(e, n, r, l, c, a, f, { getKey: i }) {
|
|
7
|
+
return m(() => e.value.slice(n.value, r.value + 1).map((t, p) => {
|
|
8
|
+
const o = n.value + p, u = f(t, o, {
|
|
9
9
|
style: { width: `${l.value}px` },
|
|
10
|
-
offsetX:
|
|
11
|
-
}),
|
|
12
|
-
return
|
|
13
|
-
|
|
14
|
-
{ key:
|
|
10
|
+
offsetX: c.value
|
|
11
|
+
}), s = i(t, o);
|
|
12
|
+
return b(
|
|
13
|
+
v,
|
|
14
|
+
{ key: s, setRef: (d) => a(t, d, o) },
|
|
15
15
|
// `renderFunc` 返回的已经是 VNode[],这里**不能再包一层数组**。
|
|
16
16
|
// 包成 [[VNode]] 之后 Vue 的 normalizeSlotValue 会把内层数组转成 Fragment,
|
|
17
17
|
// Item 的 cloneVNode(child, { ref }) 于是把 ref 挂到 Fragment 上——
|
|
@@ -19,7 +19,7 @@ function N(e, u, r, l, n, c, a, { getKey: f }) {
|
|
|
19
19
|
// useHeights.getElement() 拿到 Text 就返回 null,行高**永远测不到**:
|
|
20
20
|
// heights.id 恒为 0,可视区计算一直走估算分支,scrollHeight 恒等于
|
|
21
21
|
// 行数 × itemHeight。行实际比估算高时,末尾几行落在可滚动范围之外。
|
|
22
|
-
|
|
22
|
+
j(u) ? u : { default: () => u ?? [] }
|
|
23
23
|
);
|
|
24
24
|
}));
|
|
25
25
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComputedRef, Ref } from 'vue';
|
|
2
2
|
import { default as CacheMap } from '../utils/CacheMap';
|
|
3
3
|
import { GetSize, Key } from '../interface';
|
|
4
|
-
export declare function useGetSize(mergedData: Ref<any[]>, getKey: (item: any) => Key, heights: CacheMap, itemHeight: ComputedRef<number | undefined>): GetSize;
|
|
4
|
+
export declare function useGetSize(mergedData: Ref<any[]>, getKey: (item: any, index?: number) => Key, heights: CacheMap, itemHeight: ComputedRef<number | undefined>): GetSize;
|
|
5
5
|
//# sourceMappingURL=useGetSize.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGetSize.d.ts","sourceRoot":"","sources":["../../../../../../../core/src/components/VirtualList/hooks/useGetSize.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAA;AAC7C,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AAEhD,wBAAgB,UAAU,CACxB,UAAU,EAAE,GAAG,CAAC,GAAG,EAAE,CAAC,EACtB,MAAM,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,GAAG,
|
|
1
|
+
{"version":3,"file":"useGetSize.d.ts","sourceRoot":"","sources":["../../../../../../../core/src/components/VirtualList/hooks/useGetSize.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAA;AAC7C,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AAEhD,wBAAgB,UAAU,CACxB,UAAU,EAAE,GAAG,CAAC,GAAG,EAAE,CAAC,EACtB,MAAM,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,GAAG,EAC1C,OAAO,EAAE,QAAQ,EACjB,UAAU,EAAE,WAAW,CAAC,MAAM,GAAG,SAAS,CAAC,GAC1C,OAAO,CAqCT"}
|
|
@@ -8,7 +8,7 @@ function k(c, a, v, d) {
|
|
|
8
8
|
if (n === void 0 || i === void 0) {
|
|
9
9
|
const r = c.value.length;
|
|
10
10
|
for (let e = t.length; e < r; e += 1) {
|
|
11
|
-
const s = c.value[e], l = a(s);
|
|
11
|
+
const s = c.value[e], l = a(s, e);
|
|
12
12
|
o.set(l, e);
|
|
13
13
|
const p = v.get(l) ?? d.value ?? 0;
|
|
14
14
|
if (t[e] = (t[e - 1] || 0) + p, l === u && (n = e), l === f && (i = e), n !== void 0 && i !== void 0) break;
|