vue-virtual-flow 0.0.8 → 0.0.9
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/README.md +5 -2
- package/README.vi.md +4 -0
- package/dist/vue-virtual-flow.cjs +1 -1
- package/dist/vue-virtual-flow.js +1029 -1014
- package/package.json +1 -1
package/dist/vue-virtual-flow.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { watch as ie, defineComponent as Oe, ref as
|
|
1
|
+
import { watch as ie, defineComponent as Oe, ref as j, computed as n, nextTick as C, onMounted as Ae, onUpdated as Xe, onBeforeUnmount as Ce, openBlock as I, createElementBlock as $, normalizeStyle as N, createElementVNode as Ge, renderSlot as ce, createTextVNode as Ve, createCommentVNode as ze, Fragment as Re, renderList as De, unref as c, normalizeClass as Ye, toDisplayString as je } from "vue";
|
|
2
2
|
function tt(l) {
|
|
3
3
|
return typeof l == "string" || typeof l == "number" || typeof l == "symbol";
|
|
4
4
|
}
|
|
5
|
-
function Ze(l,
|
|
6
|
-
const x = l[
|
|
5
|
+
function Ze(l, P) {
|
|
6
|
+
const x = l[P];
|
|
7
7
|
return tt(x) ? x : void 0;
|
|
8
8
|
}
|
|
9
9
|
function lt(l) {
|
|
10
10
|
return Ze(l, "id") ?? Ze(l, "key");
|
|
11
11
|
}
|
|
12
|
-
function
|
|
13
|
-
function
|
|
14
|
-
const
|
|
15
|
-
if (typeof
|
|
16
|
-
return
|
|
12
|
+
function Pe(l) {
|
|
13
|
+
function P(e, p) {
|
|
14
|
+
const f = l.itemKey();
|
|
15
|
+
if (typeof f == "function")
|
|
16
|
+
return f(e, p);
|
|
17
17
|
if (e !== null && typeof e == "object") {
|
|
18
|
-
if (
|
|
19
|
-
const o = Ze(e,
|
|
18
|
+
if (f !== void 0) {
|
|
19
|
+
const o = Ze(e, f);
|
|
20
20
|
if (o !== void 0) return o;
|
|
21
21
|
}
|
|
22
22
|
const r = lt(e);
|
|
23
23
|
if (r !== void 0) return r;
|
|
24
24
|
}
|
|
25
|
-
return
|
|
25
|
+
return p;
|
|
26
26
|
}
|
|
27
27
|
function x() {
|
|
28
28
|
}
|
|
@@ -30,56 +30,56 @@ function De(l) {
|
|
|
30
30
|
() => [l.itemKey(), l.items()],
|
|
31
31
|
x,
|
|
32
32
|
{ immediate: !0 }
|
|
33
|
-
), { getItemKey:
|
|
33
|
+
), { getItemKey: P };
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function Fe(l) {
|
|
36
36
|
return l === "fill" ? "100%" : typeof l == "number" ? `${l}px` : l;
|
|
37
37
|
}
|
|
38
38
|
function Ue(l) {
|
|
39
|
-
return (
|
|
39
|
+
return (P, x) => {
|
|
40
40
|
typeof x == "string" && (x === "fill" || x.trim().endsWith("%"));
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
43
|
function at(l) {
|
|
44
|
-
const
|
|
45
|
-
let
|
|
44
|
+
const P = Float64Array.from(l), x = P.length, e = new Float64Array(x + 1);
|
|
45
|
+
let p = 0;
|
|
46
46
|
for (let r = 1; r <= x; r += 1) {
|
|
47
|
-
const o =
|
|
48
|
-
|
|
49
|
-
const
|
|
50
|
-
|
|
47
|
+
const o = P[r - 1];
|
|
48
|
+
p += o, e[r] += o;
|
|
49
|
+
const m = r + (r & -r);
|
|
50
|
+
m <= x && (e[m] += e[r]);
|
|
51
51
|
}
|
|
52
|
-
let
|
|
53
|
-
for (;
|
|
52
|
+
let f = 1;
|
|
53
|
+
for (; f * 2 <= x; ) f *= 2;
|
|
54
54
|
return {
|
|
55
55
|
length: x,
|
|
56
56
|
get total() {
|
|
57
|
-
return
|
|
57
|
+
return p;
|
|
58
58
|
},
|
|
59
59
|
getSize(r) {
|
|
60
|
-
return
|
|
60
|
+
return P[r];
|
|
61
61
|
},
|
|
62
62
|
getOffset(r) {
|
|
63
63
|
let o = 0;
|
|
64
|
-
for (let
|
|
65
|
-
o += e[
|
|
64
|
+
for (let m = r; m > 0; m -= m & -m)
|
|
65
|
+
o += e[m];
|
|
66
66
|
return o;
|
|
67
67
|
},
|
|
68
68
|
setSize(r, o) {
|
|
69
|
-
const
|
|
70
|
-
if (
|
|
71
|
-
|
|
72
|
-
for (let
|
|
73
|
-
e[
|
|
69
|
+
const m = o - P[r];
|
|
70
|
+
if (m !== 0) {
|
|
71
|
+
P[r] = o, p += m;
|
|
72
|
+
for (let A = r + 1; A <= x; A += A & -A)
|
|
73
|
+
e[A] += m;
|
|
74
74
|
}
|
|
75
75
|
},
|
|
76
76
|
findIndex(r) {
|
|
77
77
|
if (x === 0 || r <= 0) return 0;
|
|
78
|
-
if (r >=
|
|
79
|
-
let o = 0,
|
|
80
|
-
for (let
|
|
81
|
-
const
|
|
82
|
-
|
|
78
|
+
if (r >= p) return x - 1;
|
|
79
|
+
let o = 0, m = 0;
|
|
80
|
+
for (let A = f; A > 0; A = Math.floor(A / 2)) {
|
|
81
|
+
const O = o + A;
|
|
82
|
+
O <= x && m + e[O] <= r && (o = O, m += e[O]);
|
|
83
83
|
}
|
|
84
84
|
return Math.min(o, x - 1);
|
|
85
85
|
}
|
|
@@ -109,310 +109,310 @@ const ot = ["aria-label"], nt = {
|
|
|
109
109
|
loadOlderThreshold: { default: 120 }
|
|
110
110
|
},
|
|
111
111
|
emits: ["scroll", "loadOlder", "bottomChange"],
|
|
112
|
-
setup(l, { expose:
|
|
113
|
-
const e = l,
|
|
114
|
-
let
|
|
115
|
-
const
|
|
112
|
+
setup(l, { expose: P, emit: x }) {
|
|
113
|
+
const e = l, p = x, f = j(), r = j(0), o = j(0), m = j(0), A = j(0), O = j(!0), U = /* @__PURE__ */ new Map(), q = /* @__PURE__ */ new Map(), V = /* @__PURE__ */ new Set();
|
|
114
|
+
let D, w, k = -1, E = !1, F = !1, W = !1, ne, Z = 0, H = !1, ae = 0, R, J, Y, le = 0;
|
|
115
|
+
const se = Ue(), { getItemKey: me } = Pe({
|
|
116
116
|
componentName: "ChatVirtualScroll",
|
|
117
117
|
items: () => e.items,
|
|
118
118
|
itemKey: () => e.itemKey
|
|
119
|
-
}),
|
|
119
|
+
}), de = n(
|
|
120
120
|
() => Number.isFinite(e.estimatedItemSize) ? Math.max(1, e.estimatedItemSize) : 48
|
|
121
|
-
),
|
|
121
|
+
), ue = n(() => Math.max(0, Math.floor(e.overscan))), we = n(
|
|
122
122
|
() => e.size !== void 0 && Number.isFinite(e.size) && e.size > 0 ? Math.max(1, Math.floor(e.size)) : void 0
|
|
123
|
-
),
|
|
124
|
-
const i = e.items.map((
|
|
123
|
+
), G = n(() => m.value > 0 ? m.value : typeof e.height == "number" ? Math.max(0, e.height) : de.value), u = n(() => {
|
|
124
|
+
const i = e.items.map((h, M) => me(h, M));
|
|
125
125
|
return {
|
|
126
126
|
keys: i,
|
|
127
|
-
indexes: new Map(i.map((
|
|
128
|
-
sizes: at(i.map((
|
|
127
|
+
indexes: new Map(i.map((h, M) => [h, M])),
|
|
128
|
+
sizes: at(i.map((h) => U.get(h) ?? de.value))
|
|
129
129
|
};
|
|
130
|
-
}),
|
|
131
|
-
function
|
|
132
|
-
return Math.max(0, i -
|
|
130
|
+
}), d = n(() => (A.value, { sizes: u.value.sizes, total: u.value.sizes.total }));
|
|
131
|
+
function z(i = d.value.total) {
|
|
132
|
+
return Math.max(0, i - G.value);
|
|
133
133
|
}
|
|
134
|
-
function
|
|
135
|
-
return
|
|
134
|
+
function Q(i) {
|
|
135
|
+
return d.value.sizes.findIndex(i);
|
|
136
136
|
}
|
|
137
|
-
r.value = e.initialScroll === "bottom" ?
|
|
138
|
-
const
|
|
137
|
+
r.value = e.initialScroll === "bottom" ? z() : 0;
|
|
138
|
+
const he = n(() => {
|
|
139
139
|
if (e.items.length === 0) return { start: 0, end: 0 };
|
|
140
|
-
const i =
|
|
140
|
+
const i = Q(r.value), h = Q(r.value + G.value) + 1, M = Math.max(0, i - ue.value), K = Math.min(
|
|
141
141
|
e.items.length,
|
|
142
|
-
|
|
143
|
-
),
|
|
144
|
-
if (
|
|
145
|
-
const
|
|
146
|
-
let
|
|
147
|
-
const $e = Math.min(Se,
|
|
148
|
-
return
|
|
149
|
-
}),
|
|
150
|
-
() => e.items.slice(
|
|
151
|
-
const M =
|
|
142
|
+
h + ue.value
|
|
143
|
+
), pe = we.value;
|
|
144
|
+
if (pe === void 0 || K - M <= pe) return { start: M, end: K };
|
|
145
|
+
const xe = Math.max(0, pe - (h - i)), Te = i - M, Se = K - h;
|
|
146
|
+
let Ee = Math.min(Te, Math.ceil(xe / 2));
|
|
147
|
+
const $e = Math.min(Se, xe - Ee);
|
|
148
|
+
return Ee = Math.min(Te, xe - $e), { start: i - Ee, end: h + $e };
|
|
149
|
+
}), y = n(() => he.value.start), L = n(() => he.value.end), B = n(
|
|
150
|
+
() => e.items.slice(y.value, L.value).map((i, h) => {
|
|
151
|
+
const M = y.value + h;
|
|
152
152
|
return {
|
|
153
153
|
item: i,
|
|
154
154
|
index: M,
|
|
155
|
-
key:
|
|
156
|
-
bottom: Math.max(
|
|
155
|
+
key: me(i, M),
|
|
156
|
+
bottom: Math.max(d.value.total, G.value) - d.value.sizes.getOffset(M + 1) + o.value
|
|
157
157
|
};
|
|
158
158
|
})
|
|
159
|
-
),
|
|
160
|
-
height:
|
|
159
|
+
), te = n(() => ({
|
|
160
|
+
height: Fe(e.height)
|
|
161
161
|
}));
|
|
162
|
-
function oe(i =
|
|
163
|
-
var
|
|
164
|
-
const
|
|
165
|
-
return Math.max(0, Math.min(
|
|
162
|
+
function oe(i = d.value.total) {
|
|
163
|
+
var K;
|
|
164
|
+
const h = z(i), M = Math.min(0, ((K = f.value) == null ? void 0 : K.scrollTop) ?? 0);
|
|
165
|
+
return Math.max(0, Math.min(h, h + M + Z));
|
|
166
166
|
}
|
|
167
167
|
function re(i = !1) {
|
|
168
|
-
if (
|
|
169
|
-
|
|
170
|
-
const
|
|
171
|
-
o.value = 0,
|
|
172
|
-
if (M !==
|
|
173
|
-
|
|
174
|
-
const
|
|
175
|
-
!
|
|
168
|
+
if (H || (W || Y) && !i || Z === 0) return;
|
|
169
|
+
H = !0;
|
|
170
|
+
const h = le, M = ++ae;
|
|
171
|
+
o.value = 0, C(() => {
|
|
172
|
+
if (M !== ae) return;
|
|
173
|
+
H = !1;
|
|
174
|
+
const K = f.value;
|
|
175
|
+
!K || h !== le || Z === 0 || (Z = 0, K.scrollTop = Math.min(0, r.value - z()), J = K.scrollTop, r.value = oe(), b(), ve());
|
|
176
176
|
});
|
|
177
177
|
}
|
|
178
|
-
function
|
|
179
|
-
const
|
|
180
|
-
if (
|
|
181
|
-
if (
|
|
182
|
-
|
|
178
|
+
function ye(i) {
|
|
179
|
+
const h = f.value;
|
|
180
|
+
if (h) {
|
|
181
|
+
if (Z += i, r.value = oe(), Z === 0 || z() === 0) {
|
|
182
|
+
Z = 0, o.value = 0;
|
|
183
183
|
return;
|
|
184
184
|
}
|
|
185
|
-
(
|
|
185
|
+
(W || Y) && !H ? (o.value = Z, h.scrollTop >= -1 && re(!0)) : re();
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
188
|
function _() {
|
|
189
189
|
clearTimeout(ne), ne = void 0;
|
|
190
190
|
}
|
|
191
|
-
function
|
|
192
|
-
if (
|
|
193
|
-
_(),
|
|
194
|
-
const i =
|
|
195
|
-
if (
|
|
191
|
+
function ee() {
|
|
192
|
+
if (F) return;
|
|
193
|
+
_(), W = !1;
|
|
194
|
+
const i = Y;
|
|
195
|
+
if (Y = void 0, i) {
|
|
196
196
|
i();
|
|
197
197
|
return;
|
|
198
198
|
}
|
|
199
199
|
r.value = oe(), re();
|
|
200
200
|
}
|
|
201
201
|
function s() {
|
|
202
|
-
_(), (
|
|
202
|
+
_(), (W || Y) && !F && (ne = setTimeout(ee, 150));
|
|
203
203
|
}
|
|
204
204
|
function t() {
|
|
205
|
-
R = void 0,
|
|
205
|
+
R = void 0, Y = void 0;
|
|
206
206
|
}
|
|
207
207
|
function a() {
|
|
208
|
-
t(), _(),
|
|
208
|
+
t(), _(), F = !0, W = !0, o.value = Z;
|
|
209
209
|
}
|
|
210
|
-
function
|
|
211
|
-
|
|
210
|
+
function g(i) {
|
|
211
|
+
F = i.touches.length > 0, s();
|
|
212
212
|
}
|
|
213
213
|
function b() {
|
|
214
|
-
const i =
|
|
214
|
+
const i = f.value;
|
|
215
215
|
if (!i) return;
|
|
216
216
|
const M = Math.max(
|
|
217
217
|
0,
|
|
218
|
-
|
|
218
|
+
d.value.total - oe() - i.clientHeight
|
|
219
219
|
) <= Math.max(0, e.bottomThreshold);
|
|
220
|
-
M !==
|
|
220
|
+
M !== O.value && (O.value = M, E && p("bottomChange", M));
|
|
221
221
|
}
|
|
222
|
-
function
|
|
222
|
+
function Me() {
|
|
223
223
|
var i;
|
|
224
|
-
|
|
225
|
-
b(),
|
|
224
|
+
m.value = ((i = f.value) == null ? void 0 : i.clientHeight) ?? 0, E && (r.value = oe()), se(f.value, e.height), C(() => {
|
|
225
|
+
b(), ve();
|
|
226
226
|
});
|
|
227
227
|
}
|
|
228
|
-
function
|
|
229
|
-
var i,
|
|
230
|
-
R &&
|
|
228
|
+
function ge() {
|
|
229
|
+
var i, h;
|
|
230
|
+
R && J !== void 0 && Math.abs((((i = f.value) == null ? void 0 : i.scrollTop) ?? 0) - J) > 1 && t(), r.value = oe(), Z !== 0 && (((h = f.value) == null ? void 0 : h.scrollTop) ?? 0) >= -1 && re(!0), s(), b(), p("scroll", {
|
|
231
231
|
scrollTop: r.value,
|
|
232
|
-
startIndex:
|
|
233
|
-
endIndex:
|
|
234
|
-
}),
|
|
235
|
-
}
|
|
236
|
-
function
|
|
237
|
-
const i =
|
|
238
|
-
!
|
|
239
|
-
}
|
|
240
|
-
function
|
|
241
|
-
const
|
|
242
|
-
if (
|
|
243
|
-
const M = Array.isArray(
|
|
232
|
+
startIndex: y.value,
|
|
233
|
+
endIndex: L.value
|
|
234
|
+
}), ve();
|
|
235
|
+
}
|
|
236
|
+
function ve() {
|
|
237
|
+
const i = f.value;
|
|
238
|
+
!E || !i || !e.hasOlder || e.loadingOlder || k === e.items.length || oe() <= Math.max(0, e.loadOlderThreshold) && (k = e.items.length, p("loadOlder"));
|
|
239
|
+
}
|
|
240
|
+
function Le(i) {
|
|
241
|
+
const h = i.borderBoxSize;
|
|
242
|
+
if (h) {
|
|
243
|
+
const M = Array.isArray(h) ? h[0] : h;
|
|
244
244
|
if (M != null && M.blockSize) return M.blockSize;
|
|
245
245
|
}
|
|
246
246
|
return i.contentRect.height;
|
|
247
247
|
}
|
|
248
248
|
function ke(i) {
|
|
249
|
-
const
|
|
249
|
+
const h = d.value.total, M = oe(), K = !W && !Y && O.value && e.stickToBottom && (E || e.initialScroll === "bottom"), pe = Q(M + G.value - 1), xe = !K && M <= 0;
|
|
250
250
|
let Te = 0, Se = !1;
|
|
251
|
-
for (const { key:
|
|
252
|
-
if (!Number.isFinite(
|
|
253
|
-
const _e =
|
|
251
|
+
for (const { key: Je, height: We } of i) {
|
|
252
|
+
if (!Number.isFinite(We) || We <= 0) continue;
|
|
253
|
+
const _e = u.value.indexes.get(Je);
|
|
254
254
|
if (_e === void 0) continue;
|
|
255
|
-
const
|
|
256
|
-
|
|
255
|
+
const Qe = d.value.sizes.getSize(_e);
|
|
256
|
+
U.set(Je, We), !(Math.abs(Qe - We) < 0.5) && (_e <= pe && (Te += We - Qe), d.value.sizes.setSize(_e, We), Se = !0);
|
|
257
257
|
}
|
|
258
258
|
if (!Se) return;
|
|
259
|
-
|
|
260
|
-
const
|
|
261
|
-
|
|
259
|
+
A.value += 1;
|
|
260
|
+
const Ee = z() - z(h), $e = R && u.value.indexes.get(R.key), Ne = $e !== void 0 && R ? Ie($e, R.align) : K ? z() : xe ? 0 : M + Te;
|
|
261
|
+
ye(Ne - M - Ee), C(b);
|
|
262
262
|
}
|
|
263
|
-
function
|
|
264
|
-
const
|
|
263
|
+
function v(i) {
|
|
264
|
+
const h = [];
|
|
265
265
|
for (const M of i) {
|
|
266
|
-
const
|
|
267
|
-
|
|
266
|
+
const K = q.get(M.target);
|
|
267
|
+
K !== void 0 && h.push({ key: K, height: Le(M) });
|
|
268
268
|
}
|
|
269
|
-
ke(
|
|
269
|
+
ke(h);
|
|
270
270
|
}
|
|
271
271
|
function S() {
|
|
272
272
|
const i = [];
|
|
273
|
-
for (const
|
|
274
|
-
const M =
|
|
275
|
-
M !== void 0 &&
|
|
273
|
+
for (const h of V) {
|
|
274
|
+
const M = q.get(h);
|
|
275
|
+
M !== void 0 && h.isConnected && i.push({ key: M, height: h.getBoundingClientRect().height });
|
|
276
276
|
}
|
|
277
277
|
V.clear(), ke(i);
|
|
278
278
|
}
|
|
279
|
-
function T(i,
|
|
280
|
-
i instanceof HTMLElement &&
|
|
279
|
+
function T(i, h) {
|
|
280
|
+
i instanceof HTMLElement && q.get(i) !== h && (q.set(i, h), U.has(h) || V.add(i), w == null || w.observe(i));
|
|
281
281
|
}
|
|
282
282
|
function fe() {
|
|
283
|
-
for (const [i] of
|
|
284
|
-
i.isConnected || (
|
|
285
|
-
}
|
|
286
|
-
function
|
|
287
|
-
const
|
|
288
|
-
if (!
|
|
289
|
-
const
|
|
290
|
-
|
|
291
|
-
const Se =
|
|
292
|
-
|
|
293
|
-
const
|
|
294
|
-
|
|
283
|
+
for (const [i] of q)
|
|
284
|
+
i.isConnected || (w == null || w.unobserve(i), q.delete(i), V.delete(i));
|
|
285
|
+
}
|
|
286
|
+
function X(i, h, M = !1) {
|
|
287
|
+
const K = f.value;
|
|
288
|
+
if (!K) return;
|
|
289
|
+
const pe = oe(), xe = o.value !== 0, Te = ++le;
|
|
290
|
+
ae += 1, H = !1, R = void 0;
|
|
291
|
+
const Se = h.behavior ?? "auto";
|
|
292
|
+
Y = Se === "smooth" ? () => be(i) : void 0, Z = 0, o.value = 0, W = !1, _(), Se === "auto" && (r.value = i);
|
|
293
|
+
const Ee = () => {
|
|
294
|
+
f.value !== K || Te !== le || (xe && Se !== "auto" && (K.scrollTop = pe - z()), M && Se === "auto" ? K.scrollTop = i - z() : K.scrollTo({ ...h, top: i - z(), behavior: Se }), J = K.scrollTop, Se === "auto" ? r.value = oe() : s(), C(b));
|
|
295
295
|
};
|
|
296
|
-
|
|
296
|
+
xe ? C(Ee) : Ee();
|
|
297
297
|
}
|
|
298
|
-
function be(i,
|
|
299
|
-
const M =
|
|
298
|
+
function be(i, h = {}) {
|
|
299
|
+
const M = f.value;
|
|
300
300
|
if (!M) return;
|
|
301
|
-
const
|
|
301
|
+
const K = Math.max(0, d.value.total - M.clientHeight), pe = Math.min(
|
|
302
302
|
Math.max(0, Number.isFinite(i) ? i : 0),
|
|
303
|
-
|
|
303
|
+
K
|
|
304
304
|
);
|
|
305
|
-
|
|
305
|
+
X(pe, h);
|
|
306
306
|
}
|
|
307
|
-
function Ie(i,
|
|
308
|
-
const M =
|
|
309
|
-
let
|
|
310
|
-
return
|
|
307
|
+
function Ie(i, h) {
|
|
308
|
+
const M = d.value.sizes.getSize(i);
|
|
309
|
+
let K = d.value.sizes.getOffset(i);
|
|
310
|
+
return h === "center" ? K -= (G.value - M) / 2 : h === "end" && (K -= G.value - M), Math.max(0, Math.min(K, z()));
|
|
311
311
|
}
|
|
312
|
-
function Be(i,
|
|
313
|
-
if (!
|
|
312
|
+
function Be(i, h = {}) {
|
|
313
|
+
if (!f.value || e.items.length === 0) return;
|
|
314
314
|
const M = Math.min(
|
|
315
315
|
e.items.length - 1,
|
|
316
316
|
Math.max(0, Math.floor(Number.isFinite(i) ? i : 0))
|
|
317
|
-
), { align:
|
|
318
|
-
|
|
319
|
-
const
|
|
320
|
-
|
|
321
|
-
const Te =
|
|
322
|
-
Te !== void 0 && Be(Te, { align:
|
|
323
|
-
} : R = { key:
|
|
317
|
+
), { align: K = "start", ...pe } = h;
|
|
318
|
+
X(Ie(M, K), pe);
|
|
319
|
+
const xe = u.value.keys[M];
|
|
320
|
+
h.behavior === "smooth" ? Y = () => {
|
|
321
|
+
const Te = u.value.indexes.get(xe);
|
|
322
|
+
Te !== void 0 && Be(Te, { align: K });
|
|
323
|
+
} : R = { key: xe, align: K };
|
|
324
324
|
}
|
|
325
325
|
function Ke(i = "auto") {
|
|
326
|
-
|
|
326
|
+
X(0, { behavior: i });
|
|
327
327
|
}
|
|
328
|
-
function
|
|
329
|
-
const
|
|
330
|
-
if (!
|
|
331
|
-
const M = Math.max(0,
|
|
332
|
-
|
|
328
|
+
function He(i = "auto") {
|
|
329
|
+
const h = f.value;
|
|
330
|
+
if (!h) return;
|
|
331
|
+
const M = Math.max(0, d.value.total - h.clientHeight);
|
|
332
|
+
X(M, { behavior: i }, !0), i === "smooth" && (Y = () => He());
|
|
333
333
|
}
|
|
334
334
|
return ie(
|
|
335
|
-
|
|
336
|
-
async (i,
|
|
337
|
-
const M =
|
|
338
|
-
for (const $e of
|
|
339
|
-
i.indexes.has($e) ||
|
|
335
|
+
u,
|
|
336
|
+
async (i, h) => {
|
|
337
|
+
const M = h.sizes.total, K = oe(M), pe = !W && !Y && O.value && e.stickToBottom, xe = h.sizes.findIndex(K + G.value - 1), Te = h.keys[xe], Se = Te === void 0 ? void 0 : i.indexes.get(Te), Ee = z() - z(M);
|
|
338
|
+
for (const $e of U.keys())
|
|
339
|
+
i.indexes.has($e) || U.delete($e);
|
|
340
340
|
if (i.keys.length === 0 || Se === void 0) {
|
|
341
|
-
|
|
342
|
-
const $e = r.value, Ne =
|
|
343
|
-
await
|
|
341
|
+
Z = 0, o.value = 0, r.value = pe ? z() : Math.min(K, z());
|
|
342
|
+
const $e = r.value, Ne = le;
|
|
343
|
+
await C(), Ne === le && u.value === i && X($e, {}, !0);
|
|
344
344
|
} else {
|
|
345
|
-
const $e = i.sizes.getOffset(Se + 1) -
|
|
346
|
-
|
|
345
|
+
const $e = i.sizes.getOffset(Se + 1) - h.sizes.getOffset(xe + 1), Ne = pe ? z() : K + $e;
|
|
346
|
+
ye(Ne - K - Ee), await C();
|
|
347
347
|
}
|
|
348
|
-
|
|
348
|
+
f.value && (r.value = oe(), b(), ve());
|
|
349
349
|
}
|
|
350
350
|
), ie(
|
|
351
351
|
() => [e.hasOlder, e.loadingOlder],
|
|
352
352
|
async ([i]) => {
|
|
353
|
-
i || (
|
|
353
|
+
i || (k = -1), await C(), ve();
|
|
354
354
|
}
|
|
355
|
-
),
|
|
356
|
-
if (
|
|
357
|
-
|
|
358
|
-
for (const [i] of
|
|
359
|
-
|
|
355
|
+
), Ae(() => {
|
|
356
|
+
if (Me(), f.value && (f.value.scrollTop = e.initialScroll === "bottom" ? 0 : -z(), r.value = oe()), S(), typeof ResizeObserver < "u") {
|
|
357
|
+
D = new ResizeObserver(Me), w = new ResizeObserver(v), f.value && D.observe(f.value);
|
|
358
|
+
for (const [i] of q)
|
|
359
|
+
w.observe(i);
|
|
360
360
|
}
|
|
361
|
-
|
|
362
|
-
|
|
361
|
+
C(() => {
|
|
362
|
+
E = !0, b(), ve();
|
|
363
363
|
});
|
|
364
|
-
}),
|
|
364
|
+
}), Xe(() => {
|
|
365
365
|
fe(), S();
|
|
366
|
-
}),
|
|
367
|
-
|
|
368
|
-
}),
|
|
369
|
-
isAtBottom:
|
|
366
|
+
}), Ce(() => {
|
|
367
|
+
E = !1, _(), t(), Z = 0, le += 1, ae += 1, D && (D.disconnect(), D = void 0), w && (w.disconnect(), w = void 0), q.clear(), V.clear();
|
|
368
|
+
}), P({
|
|
369
|
+
isAtBottom: O,
|
|
370
370
|
scrollTo: be,
|
|
371
371
|
scrollToIndex: Be,
|
|
372
372
|
scrollToTop: Ke,
|
|
373
|
-
scrollToBottom:
|
|
374
|
-
}), (i,
|
|
373
|
+
scrollToBottom: He
|
|
374
|
+
}), (i, h) => (I(), $("div", {
|
|
375
375
|
ref_key: "viewport",
|
|
376
|
-
ref:
|
|
376
|
+
ref: f,
|
|
377
377
|
class: "vue-chat-virtual-scroll",
|
|
378
|
-
style: N(
|
|
378
|
+
style: N(te.value),
|
|
379
379
|
role: "log",
|
|
380
380
|
"aria-label": l.ariaLabel,
|
|
381
381
|
"aria-live": "polite",
|
|
382
382
|
tabindex: "0",
|
|
383
|
-
onScrollPassive:
|
|
384
|
-
onScrollendPassive:
|
|
383
|
+
onScrollPassive: ge,
|
|
384
|
+
onScrollendPassive: ee,
|
|
385
385
|
onPointerdownPassive: t,
|
|
386
386
|
onWheelPassive: t,
|
|
387
387
|
onKeydown: t,
|
|
388
388
|
onTouchstartPassive: a,
|
|
389
|
-
onTouchendPassive:
|
|
390
|
-
onTouchcancelPassive:
|
|
389
|
+
onTouchendPassive: g,
|
|
390
|
+
onTouchcancelPassive: g
|
|
391
391
|
}, [
|
|
392
|
-
|
|
392
|
+
Ge("div", {
|
|
393
393
|
class: "vue-chat-virtual-scroll__spacer",
|
|
394
|
-
style: N({ height: `${Math.max(
|
|
394
|
+
style: N({ height: `${Math.max(G.value, d.value.total + o.value)}px` })
|
|
395
395
|
}, [
|
|
396
396
|
l.loadingOlder ? (I(), $("div", nt, [
|
|
397
|
-
|
|
397
|
+
Ge("div", null, [
|
|
398
398
|
ce(i.$slots, "loadingOlder", {}, () => [
|
|
399
|
-
|
|
399
|
+
h[0] || (h[0] = Ve("Loading older messages…", -1))
|
|
400
400
|
])
|
|
401
401
|
])
|
|
402
402
|
])) : ze("", !0),
|
|
403
|
-
(I(!0), $(
|
|
404
|
-
key:
|
|
403
|
+
(I(!0), $(Re, null, De(B.value, ({ item: M, index: K, key: pe, bottom: xe }) => (I(), $("div", {
|
|
404
|
+
key: pe,
|
|
405
405
|
ref_for: !0,
|
|
406
|
-
ref: (Te) => T(Te,
|
|
406
|
+
ref: (Te) => T(Te, pe),
|
|
407
407
|
class: "vue-chat-virtual-scroll__item",
|
|
408
|
-
style: N({ transform: `translateY(${-
|
|
408
|
+
style: N({ transform: `translateY(${-xe}px)` }),
|
|
409
409
|
role: "article",
|
|
410
|
-
"aria-posinset":
|
|
410
|
+
"aria-posinset": K + 1,
|
|
411
411
|
"aria-setsize": l.items.length
|
|
412
412
|
}, [
|
|
413
413
|
ce(i.$slots, "default", {
|
|
414
414
|
item: M,
|
|
415
|
-
index:
|
|
415
|
+
index: K
|
|
416
416
|
})
|
|
417
417
|
], 12, it))), 128)),
|
|
418
418
|
l.items.length ? ze("", !0) : ce(i.$slots, "empty", {}, void 0, void 0, 1)
|
|
@@ -421,61 +421,61 @@ const ot = ["aria-label"], nt = {
|
|
|
421
421
|
}
|
|
422
422
|
});
|
|
423
423
|
function qe(l) {
|
|
424
|
-
const
|
|
425
|
-
() => l.refreshing() ||
|
|
424
|
+
const P = j(), x = j(0), e = j(!1), p = j(!1), f = n(() => Math.max(1, l.threshold())), r = n(
|
|
425
|
+
() => l.refreshing() || p.value ? f.value : x.value
|
|
426
426
|
), o = n(
|
|
427
|
-
() => Math.min(1, x.value /
|
|
428
|
-
),
|
|
429
|
-
function
|
|
430
|
-
|
|
427
|
+
() => Math.min(1, x.value / f.value)
|
|
428
|
+
), m = n(() => l.refreshing() || p.value ? "Refreshing…" : o.value >= 1 ? "Release to refresh" : "Pull to refresh");
|
|
429
|
+
function A() {
|
|
430
|
+
P.value = void 0, e.value = !1, x.value = 0;
|
|
431
431
|
}
|
|
432
|
-
function
|
|
433
|
-
var
|
|
434
|
-
const
|
|
435
|
-
!l.enabled() || l.refreshing() ||
|
|
432
|
+
function O(V) {
|
|
433
|
+
var k;
|
|
434
|
+
const D = V.currentTarget, w = ((k = l.scrollTop) == null ? void 0 : k.call(l)) ?? D.scrollTop;
|
|
435
|
+
!l.enabled() || l.refreshing() || w > 0 || V.touches.length !== 1 || (P.value = V.touches[0].clientY, e.value = !0);
|
|
436
436
|
}
|
|
437
|
-
function
|
|
438
|
-
var
|
|
439
|
-
if (
|
|
440
|
-
const
|
|
441
|
-
if ((((
|
|
442
|
-
|
|
437
|
+
function U(V) {
|
|
438
|
+
var E;
|
|
439
|
+
if (P.value === void 0 || !e.value) return;
|
|
440
|
+
const D = V.currentTarget;
|
|
441
|
+
if ((((E = l.scrollTop) == null ? void 0 : E.call(l)) ?? D.scrollTop) > 0 || V.touches.length !== 1) {
|
|
442
|
+
A();
|
|
443
443
|
return;
|
|
444
444
|
}
|
|
445
|
-
const
|
|
446
|
-
if (
|
|
445
|
+
const k = V.touches[0].clientY - P.value;
|
|
446
|
+
if (k <= 0) {
|
|
447
447
|
x.value = 0;
|
|
448
448
|
return;
|
|
449
449
|
}
|
|
450
|
-
V.preventDefault(), x.value = Math.min(
|
|
450
|
+
V.preventDefault(), x.value = Math.min(k * 0.5, f.value * 2);
|
|
451
451
|
}
|
|
452
|
-
function
|
|
453
|
-
if (
|
|
454
|
-
const V = x.value >=
|
|
455
|
-
if (
|
|
452
|
+
function q() {
|
|
453
|
+
if (P.value === void 0) return;
|
|
454
|
+
const V = x.value >= f.value && l.enabled() && !l.refreshing();
|
|
455
|
+
if (P.value = void 0, e.value = !1, !V) {
|
|
456
456
|
x.value = 0;
|
|
457
457
|
return;
|
|
458
458
|
}
|
|
459
|
-
x.value =
|
|
460
|
-
l.refreshing() || (
|
|
459
|
+
x.value = f.value, p.value = !0, l.onRefresh(), C(() => {
|
|
460
|
+
l.refreshing() || (p.value = !1, x.value = 0);
|
|
461
461
|
});
|
|
462
462
|
}
|
|
463
463
|
return ie(
|
|
464
464
|
() => l.refreshing(),
|
|
465
|
-
(V,
|
|
466
|
-
V ? (
|
|
465
|
+
(V, D) => {
|
|
466
|
+
V ? (p.value = !1, x.value = f.value) : D && (p.value = !1, x.value = 0);
|
|
467
467
|
}
|
|
468
468
|
), {
|
|
469
469
|
pulling: e,
|
|
470
470
|
pullDistance: x,
|
|
471
471
|
pullOffset: r,
|
|
472
472
|
pullProgress: o,
|
|
473
|
-
refreshMessage:
|
|
474
|
-
refreshThreshold:
|
|
475
|
-
handleTouchStart:
|
|
476
|
-
handleTouchMove:
|
|
477
|
-
handleTouchEnd:
|
|
478
|
-
handleTouchCancel:
|
|
473
|
+
refreshMessage: m,
|
|
474
|
+
refreshThreshold: f,
|
|
475
|
+
handleTouchStart: O,
|
|
476
|
+
handleTouchMove: U,
|
|
477
|
+
handleTouchEnd: q,
|
|
478
|
+
handleTouchCancel: A
|
|
479
479
|
};
|
|
480
480
|
}
|
|
481
481
|
const rt = ["aria-label"], ut = ["aria-posinset", "aria-setsize"], et = /* @__PURE__ */ Oe({
|
|
@@ -497,39 +497,39 @@ const rt = ["aria-label"], ut = ["aria-posinset", "aria-setsize"], et = /* @__PU
|
|
|
497
497
|
pullRefreshThreshold: { default: 64 }
|
|
498
498
|
},
|
|
499
499
|
emits: ["scroll", "loadMore", "refresh"],
|
|
500
|
-
setup(l, { expose:
|
|
501
|
-
const e = l,
|
|
502
|
-
pulling:
|
|
500
|
+
setup(l, { expose: P, emit: x }) {
|
|
501
|
+
const e = l, p = x, {
|
|
502
|
+
pulling: f,
|
|
503
503
|
pullDistance: r,
|
|
504
504
|
pullOffset: o,
|
|
505
|
-
pullProgress:
|
|
506
|
-
refreshMessage:
|
|
507
|
-
refreshThreshold:
|
|
508
|
-
handleTouchStart:
|
|
509
|
-
handleTouchMove:
|
|
505
|
+
pullProgress: m,
|
|
506
|
+
refreshMessage: A,
|
|
507
|
+
refreshThreshold: O,
|
|
508
|
+
handleTouchStart: U,
|
|
509
|
+
handleTouchMove: q,
|
|
510
510
|
handleTouchEnd: V,
|
|
511
|
-
handleTouchCancel:
|
|
511
|
+
handleTouchCancel: D
|
|
512
512
|
} = qe({
|
|
513
513
|
enabled: () => e.pullToRefresh,
|
|
514
514
|
refreshing: () => e.refreshing,
|
|
515
515
|
threshold: () => e.pullRefreshThreshold,
|
|
516
|
-
onRefresh: () =>
|
|
517
|
-
}),
|
|
518
|
-
let
|
|
519
|
-
const R = Ue(), { getItemKey:
|
|
516
|
+
onRefresh: () => p("refresh")
|
|
517
|
+
}), w = j(), k = j(0), E = j(0), F = j(0), W = /* @__PURE__ */ new Map(), ne = /* @__PURE__ */ new Map();
|
|
518
|
+
let Z, H, ae = -1;
|
|
519
|
+
const R = Ue(), { getItemKey: J } = Pe({
|
|
520
520
|
componentName: "DynamicVirtualScroll",
|
|
521
521
|
items: () => e.items,
|
|
522
522
|
itemKey: () => e.itemKey
|
|
523
|
-
}),
|
|
523
|
+
}), Y = n(
|
|
524
524
|
() => Math.max(1, e.estimatedItemSize)
|
|
525
|
-
),
|
|
526
|
-
() => Math.max(1, e.loadingItemSize ??
|
|
527
|
-
),
|
|
528
|
-
|
|
525
|
+
), le = n(
|
|
526
|
+
() => Math.max(1, e.loadingItemSize ?? Y.value)
|
|
527
|
+
), se = n(() => Math.max(0, Math.floor(e.overscan))), me = n(() => E.value > 0 ? E.value : typeof e.height == "number" ? Math.max(0, e.height) : Y.value), de = n(() => {
|
|
528
|
+
F.value;
|
|
529
529
|
const s = new Array(e.items.length + 1), t = new Array(e.items.length);
|
|
530
530
|
s[0] = 0;
|
|
531
531
|
for (let a = 0; a < e.items.length; a += 1) {
|
|
532
|
-
const
|
|
532
|
+
const g = J(e.items[a], a), b = W.get(g) ?? Y.value;
|
|
533
533
|
t[a] = b, s[a + 1] = s[a] + b;
|
|
534
534
|
}
|
|
535
535
|
return {
|
|
@@ -537,66 +537,66 @@ const rt = ["aria-label"], ut = ["aria-posinset", "aria-setsize"], et = /* @__PU
|
|
|
537
537
|
sizes: t,
|
|
538
538
|
total: s[e.items.length] ?? 0
|
|
539
539
|
};
|
|
540
|
-
}),
|
|
541
|
-
() =>
|
|
542
|
-
),
|
|
540
|
+
}), ue = n(
|
|
541
|
+
() => de.value.total + (e.loading ? le.value : 0)
|
|
542
|
+
), we = n(() => {
|
|
543
543
|
const s = /* @__PURE__ */ new Map();
|
|
544
544
|
return e.items.forEach((t, a) => {
|
|
545
|
-
s.set(
|
|
545
|
+
s.set(J(t, a), a);
|
|
546
546
|
}), s;
|
|
547
547
|
});
|
|
548
|
-
function
|
|
548
|
+
function G(s) {
|
|
549
549
|
if (e.items.length === 0) return 0;
|
|
550
|
-
const t =
|
|
551
|
-
let a = 0,
|
|
552
|
-
for (; a <
|
|
553
|
-
const b = Math.floor((a +
|
|
554
|
-
t[b + 1] <= s ? a = b + 1 :
|
|
550
|
+
const t = de.value.offsets;
|
|
551
|
+
let a = 0, g = e.items.length;
|
|
552
|
+
for (; a < g; ) {
|
|
553
|
+
const b = Math.floor((a + g) / 2);
|
|
554
|
+
t[b + 1] <= s ? a = b + 1 : g = b;
|
|
555
555
|
}
|
|
556
556
|
return Math.min(a, e.items.length - 1);
|
|
557
557
|
}
|
|
558
|
-
const
|
|
558
|
+
const u = n(
|
|
559
559
|
() => Math.max(
|
|
560
560
|
0,
|
|
561
|
-
|
|
561
|
+
G(k.value) - se.value
|
|
562
562
|
)
|
|
563
|
-
),
|
|
563
|
+
), d = n(() => {
|
|
564
564
|
if (e.items.length === 0) return 0;
|
|
565
|
-
const s =
|
|
565
|
+
const s = G(k.value + me.value) + 1;
|
|
566
566
|
return Math.min(
|
|
567
567
|
e.items.length,
|
|
568
|
-
s +
|
|
568
|
+
s + se.value
|
|
569
569
|
);
|
|
570
|
-
}),
|
|
571
|
-
() => e.items.slice(
|
|
572
|
-
const a =
|
|
570
|
+
}), z = n(
|
|
571
|
+
() => e.items.slice(u.value, d.value).map((s, t) => {
|
|
572
|
+
const a = u.value + t;
|
|
573
573
|
return {
|
|
574
574
|
item: s,
|
|
575
575
|
index: a,
|
|
576
|
-
key:
|
|
577
|
-
top:
|
|
576
|
+
key: J(s, a),
|
|
577
|
+
top: de.value.offsets[a]
|
|
578
578
|
};
|
|
579
579
|
})
|
|
580
|
-
),
|
|
581
|
-
height:
|
|
580
|
+
), Q = n(() => ({
|
|
581
|
+
height: Fe(e.height)
|
|
582
582
|
}));
|
|
583
|
-
function
|
|
583
|
+
function he() {
|
|
584
584
|
var s;
|
|
585
|
-
|
|
586
|
-
}
|
|
587
|
-
function
|
|
588
|
-
|
|
589
|
-
scrollTop:
|
|
590
|
-
startIndex:
|
|
591
|
-
endIndex:
|
|
592
|
-
}),
|
|
593
|
-
}
|
|
594
|
-
function
|
|
595
|
-
const s =
|
|
596
|
-
if (!s || !e.hasMore || e.loading ||
|
|
585
|
+
E.value = ((s = w.value) == null ? void 0 : s.clientHeight) ?? 0, R(w.value, e.height), C(L);
|
|
586
|
+
}
|
|
587
|
+
function y(s) {
|
|
588
|
+
k.value = s.currentTarget.scrollTop, p("scroll", {
|
|
589
|
+
scrollTop: k.value,
|
|
590
|
+
startIndex: u.value,
|
|
591
|
+
endIndex: d.value
|
|
592
|
+
}), L();
|
|
593
|
+
}
|
|
594
|
+
function L() {
|
|
595
|
+
const s = w.value;
|
|
596
|
+
if (!s || !e.hasMore || e.loading || ae === e.items.length)
|
|
597
597
|
return;
|
|
598
598
|
const t = Math.max(0, e.loadMoreThreshold);
|
|
599
|
-
|
|
599
|
+
ue.value - s.scrollTop - s.clientHeight <= t && (ae = e.items.length, p("loadMore"));
|
|
600
600
|
}
|
|
601
601
|
function B(s) {
|
|
602
602
|
const t = s.borderBoxSize;
|
|
@@ -606,164 +606,164 @@ const rt = ["aria-label"], ut = ["aria-posinset", "aria-setsize"], et = /* @__PU
|
|
|
606
606
|
}
|
|
607
607
|
return s.contentRect.height;
|
|
608
608
|
}
|
|
609
|
-
function
|
|
610
|
-
const t =
|
|
611
|
-
let a = 0,
|
|
609
|
+
function te(s) {
|
|
610
|
+
const t = de.value;
|
|
611
|
+
let a = 0, g = !1;
|
|
612
612
|
for (const b of s) {
|
|
613
|
-
const
|
|
614
|
-
if (
|
|
615
|
-
const
|
|
616
|
-
if (Math.abs(
|
|
617
|
-
const ke =
|
|
618
|
-
ke !== void 0 && t.offsets[ke + 1] <=
|
|
613
|
+
const Me = b.target, ge = ne.get(Me), ve = B(b);
|
|
614
|
+
if (ge === void 0 || ve <= 0) continue;
|
|
615
|
+
const Le = W.get(ge) ?? Y.value;
|
|
616
|
+
if (Math.abs(Le - ve) < 0.5) continue;
|
|
617
|
+
const ke = we.value.get(ge);
|
|
618
|
+
ke !== void 0 && t.offsets[ke + 1] <= k.value && (a += ve - Le), W.set(ge, ve), g = !0;
|
|
619
619
|
}
|
|
620
|
-
|
|
621
|
-
const b =
|
|
622
|
-
b && (b.scrollTop += a,
|
|
620
|
+
g && (F.value += 1, C(L), a !== 0 && C(() => {
|
|
621
|
+
const b = w.value;
|
|
622
|
+
b && (b.scrollTop += a, k.value = b.scrollTop);
|
|
623
623
|
}));
|
|
624
624
|
}
|
|
625
625
|
function oe(s, t) {
|
|
626
|
-
s instanceof HTMLElement && (ne.set(s, t),
|
|
626
|
+
s instanceof HTMLElement && (ne.set(s, t), H == null || H.observe(s));
|
|
627
627
|
}
|
|
628
628
|
function re() {
|
|
629
629
|
for (const [s] of ne)
|
|
630
|
-
s.isConnected || (
|
|
630
|
+
s.isConnected || (H == null || H.unobserve(s), ne.delete(s));
|
|
631
631
|
}
|
|
632
|
-
function
|
|
633
|
-
const a =
|
|
632
|
+
function ye(s, t = {}) {
|
|
633
|
+
const a = w.value;
|
|
634
634
|
if (!a) return;
|
|
635
|
-
const
|
|
635
|
+
const g = Math.max(0, ue.value - a.clientHeight), b = Math.min(
|
|
636
636
|
Math.max(0, Number.isFinite(s) ? s : 0),
|
|
637
|
-
|
|
638
|
-
),
|
|
639
|
-
|
|
637
|
+
g
|
|
638
|
+
), Me = t.behavior ?? "auto";
|
|
639
|
+
Me === "auto" && (k.value = b), a.scrollTo({ ...t, top: b, behavior: Me });
|
|
640
640
|
}
|
|
641
641
|
function _(s, t = {}) {
|
|
642
|
-
const a =
|
|
642
|
+
const a = w.value;
|
|
643
643
|
if (!a || e.items.length === 0) return;
|
|
644
|
-
const
|
|
644
|
+
const g = Math.min(
|
|
645
645
|
e.items.length - 1,
|
|
646
646
|
Math.max(0, Math.floor(s))
|
|
647
|
-
), { align: b = "start", ...
|
|
648
|
-
let
|
|
649
|
-
const
|
|
650
|
-
b === "center" ?
|
|
651
|
-
const
|
|
647
|
+
), { align: b = "start", ...Me } = t;
|
|
648
|
+
let ge = de.value.offsets[g];
|
|
649
|
+
const ve = de.value.sizes[g];
|
|
650
|
+
b === "center" ? ge -= (a.clientHeight - ve) / 2 : b === "end" && (ge -= a.clientHeight - ve);
|
|
651
|
+
const Le = Math.max(
|
|
652
652
|
0,
|
|
653
|
-
Math.min(
|
|
654
|
-
), ke =
|
|
655
|
-
ke === "auto" && (
|
|
656
|
-
...
|
|
657
|
-
top:
|
|
653
|
+
Math.min(ge, ue.value - a.clientHeight)
|
|
654
|
+
), ke = Me.behavior ?? "auto";
|
|
655
|
+
ke === "auto" && (k.value = Le), a.scrollTo({
|
|
656
|
+
...Me,
|
|
657
|
+
top: Le,
|
|
658
658
|
behavior: ke
|
|
659
659
|
});
|
|
660
660
|
}
|
|
661
|
-
function
|
|
661
|
+
function ee(s = "auto") {
|
|
662
662
|
var t;
|
|
663
|
-
(t =
|
|
663
|
+
(t = w.value) == null || t.scrollTo({ top: 0, behavior: s });
|
|
664
664
|
}
|
|
665
665
|
return ie(
|
|
666
666
|
() => e.itemKey,
|
|
667
667
|
() => {
|
|
668
|
-
|
|
668
|
+
W.clear(), F.value += 1;
|
|
669
669
|
}
|
|
670
670
|
), ie(
|
|
671
671
|
() => e.items.length,
|
|
672
672
|
async () => {
|
|
673
673
|
const s = new Set(
|
|
674
|
-
e.items.map((
|
|
674
|
+
e.items.map((g, b) => J(g, b))
|
|
675
675
|
);
|
|
676
|
-
for (const
|
|
677
|
-
s.has(
|
|
678
|
-
|
|
679
|
-
const t =
|
|
676
|
+
for (const g of W.keys())
|
|
677
|
+
s.has(g) || W.delete(g);
|
|
678
|
+
F.value += 1, await C();
|
|
679
|
+
const t = w.value;
|
|
680
680
|
if (!t) return;
|
|
681
|
-
const a = Math.max(0,
|
|
682
|
-
t.scrollTop > a && (t.scrollTop = a,
|
|
681
|
+
const a = Math.max(0, ue.value - t.clientHeight);
|
|
682
|
+
t.scrollTop > a && (t.scrollTop = a, k.value = a), L();
|
|
683
683
|
}
|
|
684
684
|
), ie(
|
|
685
685
|
() => [e.hasMore, e.loading],
|
|
686
686
|
async ([s]) => {
|
|
687
|
-
s || (
|
|
687
|
+
s || (ae = -1), await C(), L();
|
|
688
688
|
}
|
|
689
|
-
),
|
|
690
|
-
if (
|
|
691
|
-
|
|
689
|
+
), Ae(() => {
|
|
690
|
+
if (he(), typeof ResizeObserver < "u") {
|
|
691
|
+
Z = new ResizeObserver(he), H = new ResizeObserver(te), w.value && Z.observe(w.value);
|
|
692
692
|
for (const [s] of ne)
|
|
693
|
-
|
|
693
|
+
H.observe(s);
|
|
694
694
|
}
|
|
695
|
-
|
|
696
|
-
}),
|
|
697
|
-
|
|
698
|
-
}),
|
|
699
|
-
scrollTo:
|
|
695
|
+
C(L);
|
|
696
|
+
}), Xe(re), Ce(() => {
|
|
697
|
+
Z && (Z.disconnect(), Z = void 0), H && (H.disconnect(), H = void 0), ne.clear();
|
|
698
|
+
}), P({
|
|
699
|
+
scrollTo: ye,
|
|
700
700
|
scrollToIndex: _,
|
|
701
|
-
scrollToTop:
|
|
701
|
+
scrollToTop: ee
|
|
702
702
|
}), (s, t) => (I(), $("div", {
|
|
703
703
|
ref_key: "viewport",
|
|
704
|
-
ref:
|
|
705
|
-
class:
|
|
706
|
-
style: N(
|
|
704
|
+
ref: w,
|
|
705
|
+
class: Ye(["vue-dynamic-virtual-scroll", { "vue-dynamic-virtual-scroll--pulling": c(f) }]),
|
|
706
|
+
style: N(Q.value),
|
|
707
707
|
role: "list",
|
|
708
708
|
"aria-label": l.ariaLabel,
|
|
709
709
|
tabindex: "0",
|
|
710
|
-
onScrollPassive:
|
|
710
|
+
onScrollPassive: y,
|
|
711
711
|
onTouchstartPassive: t[0] || (t[0] = //@ts-ignore
|
|
712
|
-
(...a) =>
|
|
712
|
+
(...a) => c(U) && c(U)(...a)),
|
|
713
713
|
onTouchmove: t[1] || (t[1] = //@ts-ignore
|
|
714
|
-
(...a) =>
|
|
714
|
+
(...a) => c(q) && c(q)(...a)),
|
|
715
715
|
onTouchend: t[2] || (t[2] = //@ts-ignore
|
|
716
|
-
(...a) =>
|
|
716
|
+
(...a) => c(V) && c(V)(...a)),
|
|
717
717
|
onTouchcancel: t[3] || (t[3] = //@ts-ignore
|
|
718
|
-
(...a) =>
|
|
718
|
+
(...a) => c(D) && c(D)(...a))
|
|
719
719
|
}, [
|
|
720
720
|
l.pullToRefresh || l.refreshing ? (I(), $("div", {
|
|
721
721
|
key: 0,
|
|
722
722
|
class: "vue-dynamic-virtual-scroll__refresh",
|
|
723
723
|
style: N({
|
|
724
|
-
height: `${
|
|
725
|
-
transform: `translateY(${
|
|
724
|
+
height: `${c(O)}px`,
|
|
725
|
+
transform: `translateY(${c(o) - c(O)}px)`
|
|
726
726
|
}),
|
|
727
727
|
role: "status",
|
|
728
728
|
"aria-live": "polite"
|
|
729
729
|
}, [
|
|
730
730
|
ce(s.$slots, "refresh", {
|
|
731
|
-
pullDistance:
|
|
732
|
-
progress:
|
|
731
|
+
pullDistance: c(r),
|
|
732
|
+
progress: c(m),
|
|
733
733
|
refreshing: l.refreshing
|
|
734
734
|
}, () => [
|
|
735
|
-
Ve(
|
|
735
|
+
Ve(je(c(A)), 1)
|
|
736
736
|
])
|
|
737
737
|
], 4)) : ze("", !0),
|
|
738
738
|
l.items.length || l.loading ? (I(), $("div", {
|
|
739
739
|
key: 1,
|
|
740
740
|
class: "vue-dynamic-virtual-scroll__spacer",
|
|
741
741
|
style: N({
|
|
742
|
-
height: `${
|
|
743
|
-
transform: `translateY(${
|
|
742
|
+
height: `${ue.value}px`,
|
|
743
|
+
transform: `translateY(${c(o)}px)`
|
|
744
744
|
})
|
|
745
745
|
}, [
|
|
746
|
-
(I(!0), $(
|
|
746
|
+
(I(!0), $(Re, null, De(z.value, ({ item: a, index: g, key: b, top: Me }) => (I(), $("div", {
|
|
747
747
|
key: b,
|
|
748
748
|
ref_for: !0,
|
|
749
|
-
ref: (
|
|
749
|
+
ref: (ge) => oe(ge, b),
|
|
750
750
|
class: "vue-dynamic-virtual-scroll__item",
|
|
751
|
-
style: N({ transform: `translateY(${
|
|
751
|
+
style: N({ transform: `translateY(${Me}px)` }),
|
|
752
752
|
role: "listitem",
|
|
753
|
-
"aria-posinset":
|
|
753
|
+
"aria-posinset": g + 1,
|
|
754
754
|
"aria-setsize": l.items.length
|
|
755
755
|
}, [
|
|
756
756
|
ce(s.$slots, "default", {
|
|
757
757
|
item: a,
|
|
758
|
-
index:
|
|
758
|
+
index: g
|
|
759
759
|
})
|
|
760
760
|
], 12, ut))), 128)),
|
|
761
761
|
l.loading ? (I(), $("div", {
|
|
762
762
|
key: 0,
|
|
763
763
|
class: "vue-dynamic-virtual-scroll__loading",
|
|
764
764
|
style: N({
|
|
765
|
-
height: `${
|
|
766
|
-
transform: `translateY(${
|
|
765
|
+
height: `${le.value}px`,
|
|
766
|
+
transform: `translateY(${de.value.total}px)`
|
|
767
767
|
}),
|
|
768
768
|
role: "status",
|
|
769
769
|
"aria-live": "polite"
|
|
@@ -775,16 +775,16 @@ const rt = ["aria-label"], ut = ["aria-posinset", "aria-setsize"], et = /* @__PU
|
|
|
775
775
|
], 4)) : (I(), $("div", {
|
|
776
776
|
key: 2,
|
|
777
777
|
class: "vue-dynamic-virtual-scroll__empty",
|
|
778
|
-
style: N({ transform: `translateY(${
|
|
778
|
+
style: N({ transform: `translateY(${c(o)}px)` })
|
|
779
779
|
}, [
|
|
780
780
|
ce(s.$slots, "empty")
|
|
781
781
|
], 4))
|
|
782
782
|
], 46, rt));
|
|
783
783
|
}
|
|
784
|
-
}), ct = ["aria-label"], dt = ["aria-current", "aria-posinset", "aria-setsize"],
|
|
784
|
+
}), ct = ["aria-label"], dt = ["aria-current", "aria-posinset", "aria-setsize"], ft = {
|
|
785
785
|
key: 1,
|
|
786
786
|
class: "vue-short-media-feed__empty"
|
|
787
|
-
},
|
|
787
|
+
}, vt = 36, ht = 700, mt = /* @__PURE__ */ Oe({
|
|
788
788
|
name: "ShortMediaFeed",
|
|
789
789
|
__name: "ShortMediaFeed",
|
|
790
790
|
props: {
|
|
@@ -799,87 +799,101 @@ const rt = ["aria-label"], ut = ["aria-posinset", "aria-setsize"], et = /* @__PU
|
|
|
799
799
|
loadMoreThreshold: { default: 2 }
|
|
800
800
|
},
|
|
801
801
|
emits: ["update:activeIndex", "change", "reachStart", "reachEnd", "loadMore"],
|
|
802
|
-
setup(l, { expose:
|
|
803
|
-
const e = l,
|
|
804
|
-
let
|
|
805
|
-
const
|
|
802
|
+
setup(l, { expose: P, emit: x }) {
|
|
803
|
+
const e = l, p = x, f = j(), r = j(0), o = j(R(e.activeIndex));
|
|
804
|
+
let m, A = -1, O = 0, U = !1, q;
|
|
805
|
+
const V = Ue(), { getItemKey: D } = Pe({
|
|
806
806
|
componentName: "ShortMediaFeed",
|
|
807
807
|
items: () => e.items,
|
|
808
808
|
itemKey: () => e.itemKey
|
|
809
|
-
}),
|
|
809
|
+
}), w = n(
|
|
810
810
|
() => Math.max(0, Math.floor(e.buffer))
|
|
811
|
-
),
|
|
811
|
+
), k = n(
|
|
812
812
|
() => Math.max(
|
|
813
813
|
0,
|
|
814
814
|
Math.floor(
|
|
815
815
|
Number.isFinite(e.loadMoreThreshold) ? e.loadMoreThreshold : 0
|
|
816
816
|
)
|
|
817
817
|
)
|
|
818
|
-
),
|
|
819
|
-
() => Math.max(0, o.value -
|
|
820
|
-
),
|
|
818
|
+
), E = n(() => r.value > 0 ? r.value : typeof e.height == "number" ? Math.max(1, e.height) : 0), F = n(
|
|
819
|
+
() => Math.max(0, o.value - w.value)
|
|
820
|
+
), W = n(
|
|
821
821
|
() => Math.min(
|
|
822
822
|
e.items.length,
|
|
823
|
-
o.value +
|
|
823
|
+
o.value + w.value + 1
|
|
824
824
|
)
|
|
825
|
-
),
|
|
826
|
-
() => e.items.slice(
|
|
827
|
-
item:
|
|
828
|
-
index:
|
|
825
|
+
), ne = n(
|
|
826
|
+
() => e.items.slice(F.value, W.value).map((u, d) => ({
|
|
827
|
+
item: u,
|
|
828
|
+
index: F.value + d
|
|
829
829
|
}))
|
|
830
|
-
),
|
|
831
|
-
() => (e.items.length -
|
|
832
|
-
),
|
|
833
|
-
height:
|
|
830
|
+
), Z = n(() => F.value * E.value), H = n(
|
|
831
|
+
() => (e.items.length - W.value) * E.value
|
|
832
|
+
), ae = n(() => ({
|
|
833
|
+
height: Fe(e.height)
|
|
834
834
|
}));
|
|
835
|
-
function
|
|
835
|
+
function R(u) {
|
|
836
836
|
return e.items.length === 0 ? 0 : Math.min(
|
|
837
837
|
e.items.length - 1,
|
|
838
|
-
Math.max(0, Math.floor(Number.isFinite(
|
|
838
|
+
Math.max(0, Math.floor(Number.isFinite(u) ? u : 0))
|
|
839
839
|
);
|
|
840
840
|
}
|
|
841
|
-
function
|
|
842
|
-
if (!e.hasMore || e.loading ||
|
|
841
|
+
function J() {
|
|
842
|
+
if (!e.hasMore || e.loading || A === e.items.length)
|
|
843
843
|
return;
|
|
844
|
-
(e.items.length === 0 ? 0 : e.items.length - 1 - o.value) <=
|
|
844
|
+
(e.items.length === 0 ? 0 : e.items.length - 1 - o.value) <= k.value && (A = e.items.length, p("loadMore"));
|
|
845
845
|
}
|
|
846
|
-
function
|
|
847
|
-
const
|
|
848
|
-
|
|
849
|
-
index:
|
|
850
|
-
item: e.items[
|
|
851
|
-
}),
|
|
846
|
+
function Y(u) {
|
|
847
|
+
const d = R(u);
|
|
848
|
+
d === o.value || e.items.length === 0 || (o.value = d, p("update:activeIndex", d), p("change", {
|
|
849
|
+
index: d,
|
|
850
|
+
item: e.items[d]
|
|
851
|
+
}), d === 0 && p("reachStart"), d === e.items.length - 1 && p("reachEnd"), J());
|
|
852
852
|
}
|
|
853
|
-
function
|
|
854
|
-
const
|
|
855
|
-
|
|
853
|
+
function le(u, d = {}) {
|
|
854
|
+
const z = f.value;
|
|
855
|
+
z && (typeof z.scrollTo == "function" ? z.scrollTo({ ...d, top: u }) : z.scrollTop = u);
|
|
856
856
|
}
|
|
857
|
-
function
|
|
857
|
+
function se(u, d = {}) {
|
|
858
858
|
if (e.items.length === 0) return;
|
|
859
|
-
const
|
|
860
|
-
|
|
861
|
-
}
|
|
862
|
-
function
|
|
863
|
-
if (
|
|
864
|
-
const
|
|
865
|
-
|
|
866
|
-
}
|
|
867
|
-
function
|
|
868
|
-
let
|
|
869
|
-
|
|
870
|
-
}
|
|
871
|
-
function ue() {
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
859
|
+
const z = R(u);
|
|
860
|
+
Y(z), le(z * E.value, d);
|
|
861
|
+
}
|
|
862
|
+
function me(u) {
|
|
863
|
+
if (E.value <= 0) return;
|
|
864
|
+
const d = u.currentTarget.scrollTop;
|
|
865
|
+
Y(Math.round(d / E.value));
|
|
866
|
+
}
|
|
867
|
+
function de(u) {
|
|
868
|
+
let d;
|
|
869
|
+
u.key === "ArrowDown" || u.key === "PageDown" ? d = o.value + 1 : u.key === "ArrowUp" || u.key === "PageUp" ? d = o.value - 1 : u.key === "Home" ? d = 0 : u.key === "End" && (d = e.items.length - 1), d !== void 0 && (u.preventDefault(), se(d, { behavior: "smooth" }));
|
|
870
|
+
}
|
|
871
|
+
function ue(u) {
|
|
872
|
+
return u.deltaMode === WheelEvent.DOM_DELTA_LINE ? u.deltaY * 16 : u.deltaMode === WheelEvent.DOM_DELTA_PAGE ? u.deltaY * (E.value || 1) : u.deltaY;
|
|
873
|
+
}
|
|
874
|
+
function we(u) {
|
|
875
|
+
if (u.ctrlKey || Math.abs(u.deltaX) > Math.abs(u.deltaY) || e.items.length === 0 || E.value <= 0 || (u.preventDefault(), U)) return;
|
|
876
|
+
const d = ue(u);
|
|
877
|
+
if (d * O < 0 && (O = 0), O += d, Math.abs(O) < vt) return;
|
|
878
|
+
const z = O > 0 ? 1 : -1;
|
|
879
|
+
O = 0;
|
|
880
|
+
const Q = o.value + z;
|
|
881
|
+
Q < 0 || Q >= e.items.length || (U = !0, se(Q, { behavior: "smooth" }), q = setTimeout(() => {
|
|
882
|
+
U = !1;
|
|
883
|
+
}, ht));
|
|
884
|
+
}
|
|
885
|
+
function G() {
|
|
886
|
+
var d;
|
|
887
|
+
const u = ((d = f.value) == null ? void 0 : d.clientHeight) ?? 0;
|
|
888
|
+
V(f.value, e.height), !(u <= 0 || u === r.value) && (r.value = u, C(() => {
|
|
889
|
+
le(o.value * u);
|
|
876
890
|
}));
|
|
877
891
|
}
|
|
878
892
|
return ie(
|
|
879
893
|
() => e.activeIndex,
|
|
880
|
-
async (
|
|
881
|
-
const
|
|
882
|
-
|
|
894
|
+
async (u) => {
|
|
895
|
+
const d = R(u);
|
|
896
|
+
d !== o.value && (o.value = d, await C(), le(d * E.value), J());
|
|
883
897
|
}
|
|
884
898
|
), ie(
|
|
885
899
|
() => [
|
|
@@ -887,67 +901,68 @@ const rt = ["aria-label"], ut = ["aria-posinset", "aria-setsize"], et = /* @__PU
|
|
|
887
901
|
e.loading,
|
|
888
902
|
e.loadMoreThreshold
|
|
889
903
|
],
|
|
890
|
-
async ([
|
|
891
|
-
|
|
904
|
+
async ([u]) => {
|
|
905
|
+
u || (A = -1), await C(), J();
|
|
892
906
|
}
|
|
893
907
|
), ie(
|
|
894
908
|
() => e.items.length,
|
|
895
909
|
async () => {
|
|
896
|
-
const
|
|
897
|
-
e.items.length === 0 ? o.value !== 0 && (o.value = 0,
|
|
910
|
+
const u = R(o.value);
|
|
911
|
+
e.items.length === 0 ? o.value !== 0 && (o.value = 0, p("update:activeIndex", 0)) : Y(u), await C(), le(u * E.value), J();
|
|
898
912
|
}
|
|
899
|
-
),
|
|
900
|
-
|
|
901
|
-
}),
|
|
902
|
-
|
|
903
|
-
}),
|
|
904
|
-
scrollToIndex:
|
|
905
|
-
}), (
|
|
913
|
+
), Ae(async () => {
|
|
914
|
+
G(), typeof ResizeObserver < "u" && f.value && (m = new ResizeObserver(G), m.observe(f.value)), await C(), le(o.value * E.value), J();
|
|
915
|
+
}), Ce(() => {
|
|
916
|
+
m && (m.disconnect(), m = void 0), q && (clearTimeout(q), q = void 0);
|
|
917
|
+
}), P({
|
|
918
|
+
scrollToIndex: se
|
|
919
|
+
}), (u, d) => (I(), $("div", {
|
|
906
920
|
ref_key: "viewport",
|
|
907
|
-
ref:
|
|
921
|
+
ref: f,
|
|
908
922
|
class: "vue-short-media-feed",
|
|
909
|
-
style: N(
|
|
923
|
+
style: N(ae.value),
|
|
910
924
|
role: "list",
|
|
911
925
|
"aria-orientation": "vertical",
|
|
912
926
|
"aria-label": l.ariaLabel,
|
|
913
927
|
tabindex: "0",
|
|
914
|
-
onScrollPassive:
|
|
915
|
-
|
|
928
|
+
onScrollPassive: me,
|
|
929
|
+
onWheel: we,
|
|
930
|
+
onKeydown: de
|
|
916
931
|
}, [
|
|
917
|
-
l.items.length ? (I(), $(
|
|
918
|
-
|
|
932
|
+
l.items.length ? (I(), $(Re, { key: 0 }, [
|
|
933
|
+
Z.value > 0 ? (I(), $("div", {
|
|
919
934
|
key: 0,
|
|
920
935
|
class: "vue-short-media-feed__spacer",
|
|
921
|
-
style: N({ height: `${
|
|
936
|
+
style: N({ height: `${Z.value}px` }),
|
|
922
937
|
"aria-hidden": "true"
|
|
923
938
|
}, null, 4)) : ze("", !0),
|
|
924
|
-
(I(!0), $(
|
|
925
|
-
key:
|
|
939
|
+
(I(!0), $(Re, null, De(ne.value, ({ item: z, index: Q }) => (I(), $("div", {
|
|
940
|
+
key: c(D)(z, Q),
|
|
926
941
|
class: "vue-short-media-feed__item",
|
|
927
|
-
style: N({ height: `${
|
|
942
|
+
style: N({ height: `${E.value}px` }),
|
|
928
943
|
role: "listitem",
|
|
929
|
-
"aria-current":
|
|
930
|
-
"aria-posinset":
|
|
944
|
+
"aria-current": Q === o.value ? "true" : void 0,
|
|
945
|
+
"aria-posinset": Q + 1,
|
|
931
946
|
"aria-setsize": l.items.length
|
|
932
947
|
}, [
|
|
933
|
-
ce(
|
|
934
|
-
item:
|
|
935
|
-
index:
|
|
936
|
-
active:
|
|
948
|
+
ce(u.$slots, "default", {
|
|
949
|
+
item: z,
|
|
950
|
+
index: Q,
|
|
951
|
+
active: Q === o.value
|
|
937
952
|
})
|
|
938
953
|
], 12, dt))), 128)),
|
|
939
|
-
|
|
954
|
+
H.value > 0 ? (I(), $("div", {
|
|
940
955
|
key: 1,
|
|
941
956
|
class: "vue-short-media-feed__spacer",
|
|
942
|
-
style: N({ height: `${
|
|
957
|
+
style: N({ height: `${H.value}px` }),
|
|
943
958
|
"aria-hidden": "true"
|
|
944
959
|
}, null, 4)) : ze("", !0)
|
|
945
|
-
], 64)) : (I(), $("div",
|
|
946
|
-
ce(
|
|
960
|
+
], 64)) : (I(), $("div", ft, [
|
|
961
|
+
ce(u.$slots, "empty")
|
|
947
962
|
]))
|
|
948
963
|
], 44, ct));
|
|
949
964
|
}
|
|
950
|
-
}),
|
|
965
|
+
}), gt = ["aria-label"], pt = /* @__PURE__ */ Oe({
|
|
951
966
|
__name: "SkeletonLoader",
|
|
952
967
|
props: {
|
|
953
968
|
width: { default: "100%" },
|
|
@@ -957,37 +972,37 @@ const rt = ["aria-label"], ut = ["aria-posinset", "aria-setsize"], et = /* @__PU
|
|
|
957
972
|
ariaLabel: { default: "Loading…" }
|
|
958
973
|
},
|
|
959
974
|
setup(l) {
|
|
960
|
-
const
|
|
961
|
-
function x(
|
|
962
|
-
return typeof
|
|
975
|
+
const P = l;
|
|
976
|
+
function x(p) {
|
|
977
|
+
return typeof p == "number" ? `${Math.max(0, p)}px` : p;
|
|
963
978
|
}
|
|
964
979
|
const e = n(() => ({
|
|
965
|
-
width: x(
|
|
966
|
-
height: x(
|
|
980
|
+
width: x(P.width),
|
|
981
|
+
height: x(P.height)
|
|
967
982
|
}));
|
|
968
|
-
return (
|
|
969
|
-
class:
|
|
983
|
+
return (p, f) => (I(), $("div", {
|
|
984
|
+
class: Ye(["vue-skeleton-loader", [
|
|
970
985
|
`vue-skeleton-loader--${l.variant}`,
|
|
971
986
|
{ "vue-skeleton-loader--animated": l.animated }
|
|
972
987
|
]]),
|
|
973
988
|
style: N(e.value),
|
|
974
989
|
role: "status",
|
|
975
990
|
"aria-label": l.ariaLabel
|
|
976
|
-
}, null, 14,
|
|
991
|
+
}, null, 14, gt));
|
|
977
992
|
}
|
|
978
|
-
}),
|
|
993
|
+
}), yt = (l, P) => {
|
|
979
994
|
const x = l.__vccOpts || l;
|
|
980
|
-
for (const [e,
|
|
981
|
-
x[e] =
|
|
995
|
+
for (const [e, p] of P)
|
|
996
|
+
x[e] = p;
|
|
982
997
|
return x;
|
|
983
|
-
},
|
|
998
|
+
}, Mt = /* @__PURE__ */ yt(pt, [["__scopeId", "data-v-fc92f61f"]]), xt = ["aria-label"], wt = {
|
|
984
999
|
key: 0,
|
|
985
1000
|
class: "vue-virtual-carousel__track",
|
|
986
1001
|
role: "list"
|
|
987
|
-
},
|
|
1002
|
+
}, Tt = ["aria-label", "aria-current"], bt = {
|
|
988
1003
|
key: 1,
|
|
989
1004
|
class: "vue-virtual-carousel__empty"
|
|
990
|
-
},
|
|
1005
|
+
}, St = /* @__PURE__ */ Oe({
|
|
991
1006
|
name: "VirtualCarousel",
|
|
992
1007
|
__name: "VirtualCarousel",
|
|
993
1008
|
props: {
|
|
@@ -1010,211 +1025,211 @@ const rt = ["aria-label"], ut = ["aria-posinset", "aria-setsize"], et = /* @__PU
|
|
|
1010
1025
|
responsive: { default: void 0 }
|
|
1011
1026
|
},
|
|
1012
1027
|
emits: ["update:activeIndex", "change", "reachStart", "reachEnd", "loadMore"],
|
|
1013
|
-
setup(l, { expose:
|
|
1014
|
-
const e = l,
|
|
1015
|
-
let
|
|
1016
|
-
const V =
|
|
1028
|
+
setup(l, { expose: P, emit: x }) {
|
|
1029
|
+
const e = l, p = x, f = j(), r = j(0), o = j(0);
|
|
1030
|
+
let m, A = -1, O, U, q = !1;
|
|
1031
|
+
const V = j(!1), { getItemKey: D } = Pe({
|
|
1017
1032
|
componentName: "VirtualCarousel",
|
|
1018
1033
|
items: () => e.items,
|
|
1019
1034
|
itemKey: () => e.itemKey
|
|
1020
|
-
}),
|
|
1035
|
+
}), w = n(() => Math.max(0, r.value)), k = n(() => {
|
|
1021
1036
|
if (!e.responsive || e.responsive.length === 0)
|
|
1022
1037
|
return {
|
|
1023
1038
|
slidesPerView: e.slidesPerView,
|
|
1024
1039
|
slidesToScroll: e.slidesToScroll,
|
|
1025
1040
|
gap: e.gap
|
|
1026
1041
|
};
|
|
1027
|
-
const t =
|
|
1028
|
-
(
|
|
1042
|
+
const t = w.value, a = [...e.responsive].sort(
|
|
1043
|
+
(g, b) => b.breakpoint - g.breakpoint
|
|
1029
1044
|
);
|
|
1030
|
-
for (const
|
|
1031
|
-
if (t >=
|
|
1045
|
+
for (const g of a)
|
|
1046
|
+
if (t >= g.breakpoint)
|
|
1032
1047
|
return {
|
|
1033
|
-
slidesPerView:
|
|
1034
|
-
slidesToScroll:
|
|
1035
|
-
gap:
|
|
1048
|
+
slidesPerView: g.slidesPerView ?? e.slidesPerView,
|
|
1049
|
+
slidesToScroll: g.slidesToScroll ?? e.slidesToScroll,
|
|
1050
|
+
gap: g.gap ?? e.gap
|
|
1036
1051
|
};
|
|
1037
1052
|
return {
|
|
1038
1053
|
slidesPerView: e.slidesPerView,
|
|
1039
1054
|
slidesToScroll: e.slidesToScroll,
|
|
1040
1055
|
gap: e.gap
|
|
1041
1056
|
};
|
|
1042
|
-
}),
|
|
1057
|
+
}), E = n(
|
|
1043
1058
|
() => Math.max(
|
|
1044
1059
|
1,
|
|
1045
1060
|
Math.floor(
|
|
1046
|
-
Number.isFinite(
|
|
1061
|
+
Number.isFinite(k.value.slidesPerView) ? k.value.slidesPerView : 1
|
|
1047
1062
|
)
|
|
1048
1063
|
)
|
|
1049
|
-
),
|
|
1064
|
+
), F = n(
|
|
1050
1065
|
() => Math.max(
|
|
1051
1066
|
1,
|
|
1052
1067
|
Math.floor(
|
|
1053
|
-
Number.isFinite(
|
|
1068
|
+
Number.isFinite(k.value.slidesToScroll) ? k.value.slidesToScroll : 1
|
|
1054
1069
|
)
|
|
1055
1070
|
)
|
|
1056
|
-
),
|
|
1057
|
-
() => Math.max(0, Number.isFinite(
|
|
1071
|
+
), W = n(
|
|
1072
|
+
() => Math.max(0, Number.isFinite(k.value.gap) ? k.value.gap : 0)
|
|
1058
1073
|
), ne = n(
|
|
1059
1074
|
() => Math.max(
|
|
1060
1075
|
0,
|
|
1061
1076
|
Math.floor(Number.isFinite(e.buffer) ? e.buffer : 0)
|
|
1062
1077
|
)
|
|
1063
|
-
),
|
|
1078
|
+
), Z = n(
|
|
1064
1079
|
() => Math.max(
|
|
1065
1080
|
0,
|
|
1066
1081
|
Math.floor(
|
|
1067
1082
|
Number.isFinite(e.loadMoreThreshold) ? e.loadMoreThreshold : 0
|
|
1068
1083
|
)
|
|
1069
1084
|
)
|
|
1070
|
-
),
|
|
1071
|
-
if (
|
|
1072
|
-
const t = (
|
|
1085
|
+
), H = n(() => Number.isFinite(e.autoplayDelay) ? Math.max(1, e.autoplayDelay) : 3e3), ae = n(() => {
|
|
1086
|
+
if (w.value <= 0) return 0;
|
|
1087
|
+
const t = (E.value - 1) * W.value;
|
|
1073
1088
|
return Math.max(
|
|
1074
1089
|
1,
|
|
1075
|
-
(
|
|
1090
|
+
(w.value - t) / E.value
|
|
1076
1091
|
);
|
|
1077
|
-
}), R = n(() =>
|
|
1092
|
+
}), R = n(() => ae.value + W.value), J = n(
|
|
1078
1093
|
() => Math.max(
|
|
1079
1094
|
0,
|
|
1080
|
-
e.items.length -
|
|
1095
|
+
e.items.length - E.value
|
|
1081
1096
|
)
|
|
1082
|
-
),
|
|
1097
|
+
), Y = n(
|
|
1083
1098
|
() => Math.max(0, o.value - ne.value)
|
|
1084
|
-
),
|
|
1099
|
+
), le = n(
|
|
1085
1100
|
() => Math.min(
|
|
1086
1101
|
e.items.length,
|
|
1087
|
-
o.value +
|
|
1102
|
+
o.value + E.value + ne.value
|
|
1088
1103
|
)
|
|
1089
|
-
),
|
|
1090
|
-
() => e.items.slice(
|
|
1104
|
+
), se = n(
|
|
1105
|
+
() => e.items.slice(Y.value, le.value).map((t, a) => ({
|
|
1091
1106
|
item: t,
|
|
1092
|
-
index:
|
|
1107
|
+
index: Y.value + a
|
|
1093
1108
|
}))
|
|
1094
|
-
),
|
|
1095
|
-
() =>
|
|
1096
|
-
),
|
|
1109
|
+
), me = n(() => e.items.length === 0 ? 0 : e.items.length * ae.value + (e.items.length - 1) * W.value), de = n(
|
|
1110
|
+
() => Y.value * R.value
|
|
1111
|
+
), ue = n(
|
|
1097
1112
|
() => Math.max(
|
|
1098
1113
|
0,
|
|
1099
|
-
|
|
1114
|
+
me.value - le.value * R.value
|
|
1100
1115
|
)
|
|
1101
|
-
),
|
|
1102
|
-
height:
|
|
1116
|
+
), we = n(() => ({
|
|
1117
|
+
height: Fe(e.height)
|
|
1103
1118
|
}));
|
|
1104
|
-
function
|
|
1119
|
+
function G(t) {
|
|
1105
1120
|
return Math.min(
|
|
1106
|
-
|
|
1121
|
+
J.value,
|
|
1107
1122
|
Math.max(0, Math.floor(Number.isFinite(t) ? t : 0))
|
|
1108
1123
|
);
|
|
1109
1124
|
}
|
|
1110
|
-
o.value =
|
|
1111
|
-
function
|
|
1125
|
+
o.value = G(e.activeIndex);
|
|
1126
|
+
function u(t) {
|
|
1112
1127
|
return t >= o.value && t < Math.min(
|
|
1113
1128
|
e.items.length,
|
|
1114
|
-
o.value +
|
|
1129
|
+
o.value + E.value
|
|
1115
1130
|
);
|
|
1116
1131
|
}
|
|
1117
|
-
function
|
|
1118
|
-
if (!e.hasMore || e.loading ||
|
|
1132
|
+
function d() {
|
|
1133
|
+
if (!e.hasMore || e.loading || A === e.items.length)
|
|
1119
1134
|
return;
|
|
1120
1135
|
const t = e.items.length === 0 ? -1 : Math.min(
|
|
1121
1136
|
e.items.length - 1,
|
|
1122
|
-
o.value +
|
|
1137
|
+
o.value + E.value - 1
|
|
1123
1138
|
);
|
|
1124
|
-
e.items.length - 1 - t <=
|
|
1139
|
+
e.items.length - 1 - t <= Z.value && (A = e.items.length, p("loadMore"));
|
|
1125
1140
|
}
|
|
1126
|
-
function
|
|
1127
|
-
const a =
|
|
1128
|
-
a === o.value || e.items.length === 0 || (o.value = a,
|
|
1141
|
+
function z(t) {
|
|
1142
|
+
const a = G(t);
|
|
1143
|
+
a === o.value || e.items.length === 0 || (o.value = a, p("update:activeIndex", a), p("change", {
|
|
1129
1144
|
index: a,
|
|
1130
1145
|
item: e.items[a]
|
|
1131
|
-
}), a === 0 &&
|
|
1146
|
+
}), a === 0 && p("reachStart"), a === J.value && p("reachEnd"), d(), e.autoplay && !V.value && B());
|
|
1132
1147
|
}
|
|
1133
|
-
function
|
|
1134
|
-
const
|
|
1135
|
-
|
|
1148
|
+
function Q(t, a = {}) {
|
|
1149
|
+
const g = f.value;
|
|
1150
|
+
g && (typeof g.scrollTo == "function" ? g.scrollTo({ ...a, left: t }) : g.scrollLeft = t);
|
|
1136
1151
|
}
|
|
1137
|
-
function
|
|
1152
|
+
function he(t, a = {}) {
|
|
1138
1153
|
if (e.items.length === 0 || R.value <= 0) return;
|
|
1139
|
-
const
|
|
1140
|
-
|
|
1154
|
+
const g = G(t);
|
|
1155
|
+
U = a.behavior === "smooth" ? g : void 0, z(g), Q(g * R.value, {
|
|
1141
1156
|
...a,
|
|
1142
1157
|
behavior: a.behavior
|
|
1143
1158
|
});
|
|
1144
1159
|
}
|
|
1145
|
-
function
|
|
1146
|
-
|
|
1147
|
-
o.value +
|
|
1160
|
+
function y(t = "smooth") {
|
|
1161
|
+
he(
|
|
1162
|
+
o.value + F.value,
|
|
1148
1163
|
{ behavior: t }
|
|
1149
1164
|
);
|
|
1150
1165
|
}
|
|
1151
|
-
function
|
|
1152
|
-
|
|
1153
|
-
o.value -
|
|
1166
|
+
function L(t = "smooth") {
|
|
1167
|
+
he(
|
|
1168
|
+
o.value - F.value,
|
|
1154
1169
|
{ behavior: t }
|
|
1155
1170
|
);
|
|
1156
1171
|
}
|
|
1157
1172
|
function B() {
|
|
1158
|
-
|
|
1159
|
-
o.value >=
|
|
1160
|
-
},
|
|
1173
|
+
te(), !(!e.autoplay || e.items.length === 0) && (O = setTimeout(() => {
|
|
1174
|
+
o.value >= J.value ? e.autoplayLoop ? he(0, { behavior: "smooth" }) : te() : y("smooth");
|
|
1175
|
+
}, H.value));
|
|
1161
1176
|
}
|
|
1162
|
-
function
|
|
1163
|
-
|
|
1177
|
+
function te() {
|
|
1178
|
+
O !== void 0 && (clearTimeout(O), O = void 0);
|
|
1164
1179
|
}
|
|
1165
1180
|
function oe() {
|
|
1166
|
-
V.value = !0, e.pauseOnHover &&
|
|
1181
|
+
V.value = !0, e.pauseOnHover && te();
|
|
1167
1182
|
}
|
|
1168
1183
|
function re() {
|
|
1169
1184
|
V.value = !1, e.autoplay && B();
|
|
1170
1185
|
}
|
|
1171
|
-
function
|
|
1172
|
-
|
|
1186
|
+
function ye() {
|
|
1187
|
+
U = void 0;
|
|
1173
1188
|
}
|
|
1174
1189
|
function _(t) {
|
|
1175
|
-
if (R.value <= 0 ||
|
|
1190
|
+
if (R.value <= 0 || q) return;
|
|
1176
1191
|
const a = t.currentTarget.scrollLeft;
|
|
1177
|
-
if (
|
|
1178
|
-
const
|
|
1179
|
-
if (Math.abs(a -
|
|
1180
|
-
|
|
1192
|
+
if (U !== void 0) {
|
|
1193
|
+
const g = U * R.value;
|
|
1194
|
+
if (Math.abs(a - g) > 1) return;
|
|
1195
|
+
U = void 0;
|
|
1181
1196
|
}
|
|
1182
|
-
|
|
1197
|
+
z(Math.round(a / R.value));
|
|
1183
1198
|
}
|
|
1184
|
-
function
|
|
1185
|
-
t.key === "ArrowRight" || t.key === "PageDown" ? (t.preventDefault(),
|
|
1199
|
+
function ee(t) {
|
|
1200
|
+
t.key === "ArrowRight" || t.key === "PageDown" ? (t.preventDefault(), y()) : t.key === "ArrowLeft" || t.key === "PageUp" ? (t.preventDefault(), L()) : t.key === "Home" ? (t.preventDefault(), he(0, { behavior: "smooth" })) : t.key === "End" && (t.preventDefault(), he(J.value, { behavior: "auto" }));
|
|
1186
1201
|
}
|
|
1187
1202
|
function s() {
|
|
1188
1203
|
var a;
|
|
1189
|
-
const t = ((a =
|
|
1190
|
-
t <= 0 || t === r.value || (
|
|
1191
|
-
const
|
|
1192
|
-
|
|
1204
|
+
const t = ((a = f.value) == null ? void 0 : a.clientWidth) ?? 0;
|
|
1205
|
+
t <= 0 || t === r.value || (q = !0, r.value = t, C(() => {
|
|
1206
|
+
const g = G(o.value);
|
|
1207
|
+
Q(g * R.value), q = !1;
|
|
1193
1208
|
}));
|
|
1194
1209
|
}
|
|
1195
1210
|
return ie(
|
|
1196
1211
|
() => e.activeIndex,
|
|
1197
1212
|
async (t) => {
|
|
1198
|
-
const a =
|
|
1199
|
-
a !== o.value && (
|
|
1213
|
+
const a = G(t);
|
|
1214
|
+
a !== o.value && (ye(), o.value = a, await C(), Q(a * R.value), d());
|
|
1200
1215
|
}
|
|
1201
1216
|
), ie(
|
|
1202
1217
|
() => [
|
|
1203
1218
|
e.items.length,
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1219
|
+
k.value.slidesPerView,
|
|
1220
|
+
k.value.gap,
|
|
1221
|
+
k.value.slidesToScroll
|
|
1207
1222
|
],
|
|
1208
1223
|
async () => {
|
|
1209
|
-
const t =
|
|
1210
|
-
e.items.length === 0 ? o.value !== 0 && (o.value = 0,
|
|
1224
|
+
const t = G(o.value);
|
|
1225
|
+
e.items.length === 0 ? o.value !== 0 && (o.value = 0, p("update:activeIndex", 0)) : z(t), await C(), Q(t * R.value), d(), e.autoplay && e.items.length > 0 && !V.value && B();
|
|
1211
1226
|
}
|
|
1212
1227
|
), ie(
|
|
1213
1228
|
() => e.responsive,
|
|
1214
1229
|
() => {
|
|
1215
|
-
|
|
1216
|
-
const t =
|
|
1217
|
-
|
|
1230
|
+
C(() => {
|
|
1231
|
+
const t = G(o.value);
|
|
1232
|
+
Q(t * R.value);
|
|
1218
1233
|
});
|
|
1219
1234
|
},
|
|
1220
1235
|
{ deep: !0 }
|
|
@@ -1225,12 +1240,12 @@ const rt = ["aria-label"], ut = ["aria-posinset", "aria-setsize"], et = /* @__PU
|
|
|
1225
1240
|
e.loadMoreThreshold
|
|
1226
1241
|
],
|
|
1227
1242
|
async ([t]) => {
|
|
1228
|
-
t || (
|
|
1243
|
+
t || (A = -1), await C(), d();
|
|
1229
1244
|
}
|
|
1230
1245
|
), ie(
|
|
1231
1246
|
() => e.autoplay,
|
|
1232
1247
|
(t) => {
|
|
1233
|
-
t && !V.value ? B() :
|
|
1248
|
+
t && !V.value ? B() : te();
|
|
1234
1249
|
}
|
|
1235
1250
|
), ie(
|
|
1236
1251
|
() => e.autoplayDelay,
|
|
@@ -1240,52 +1255,52 @@ const rt = ["aria-label"], ut = ["aria-posinset", "aria-setsize"], et = /* @__PU
|
|
|
1240
1255
|
), ie(
|
|
1241
1256
|
() => e.autoplayLoop,
|
|
1242
1257
|
(t) => {
|
|
1243
|
-
!e.autoplay || V.value || (!t && o.value >=
|
|
1258
|
+
!e.autoplay || V.value || (!t && o.value >= J.value ? te() : B());
|
|
1244
1259
|
}
|
|
1245
1260
|
), ie(
|
|
1246
1261
|
() => e.pauseOnHover,
|
|
1247
1262
|
(t) => {
|
|
1248
|
-
t && V.value ?
|
|
1263
|
+
t && V.value ? te() : !t && e.autoplay && B();
|
|
1249
1264
|
}
|
|
1250
|
-
),
|
|
1251
|
-
s(), typeof ResizeObserver < "u" &&
|
|
1252
|
-
}),
|
|
1253
|
-
|
|
1254
|
-
}),
|
|
1255
|
-
next:
|
|
1256
|
-
previous:
|
|
1257
|
-
scrollToIndex:
|
|
1265
|
+
), Ae(async () => {
|
|
1266
|
+
s(), typeof ResizeObserver < "u" && f.value && (m = new ResizeObserver(s), m.observe(f.value)), await C(), Q(o.value * R.value), d(), e.autoplay && B();
|
|
1267
|
+
}), Ce(() => {
|
|
1268
|
+
m && (m.disconnect(), m = void 0), te();
|
|
1269
|
+
}), P({
|
|
1270
|
+
next: y,
|
|
1271
|
+
previous: L,
|
|
1272
|
+
scrollToIndex: he,
|
|
1258
1273
|
startAutoplay: B,
|
|
1259
|
-
stopAutoplay:
|
|
1274
|
+
stopAutoplay: te
|
|
1260
1275
|
}), (t, a) => (I(), $("div", {
|
|
1261
1276
|
ref_key: "viewport",
|
|
1262
|
-
ref:
|
|
1277
|
+
ref: f,
|
|
1263
1278
|
class: "vue-virtual-carousel",
|
|
1264
|
-
style: N(
|
|
1279
|
+
style: N(we.value),
|
|
1265
1280
|
role: "region",
|
|
1266
1281
|
"aria-roledescription": "carousel",
|
|
1267
1282
|
"aria-label": l.ariaLabel,
|
|
1268
1283
|
tabindex: "0",
|
|
1269
1284
|
onScrollPassive: _,
|
|
1270
|
-
onPointerdown:
|
|
1271
|
-
onWheelPassive:
|
|
1272
|
-
onKeydown:
|
|
1285
|
+
onPointerdown: ye,
|
|
1286
|
+
onWheelPassive: ye,
|
|
1287
|
+
onKeydown: ee,
|
|
1273
1288
|
onMouseenter: oe,
|
|
1274
1289
|
onMouseleave: re
|
|
1275
1290
|
}, [
|
|
1276
|
-
l.items.length ? (I(), $("div",
|
|
1277
|
-
|
|
1291
|
+
l.items.length ? (I(), $("div", wt, [
|
|
1292
|
+
de.value > 0 ? (I(), $("div", {
|
|
1278
1293
|
key: 0,
|
|
1279
1294
|
class: "vue-virtual-carousel__spacer",
|
|
1280
|
-
style: N({ flexBasis: `${
|
|
1295
|
+
style: N({ flexBasis: `${de.value}px` }),
|
|
1281
1296
|
"aria-hidden": "true"
|
|
1282
1297
|
}, null, 4)) : ze("", !0),
|
|
1283
|
-
(I(!0), $(
|
|
1284
|
-
key:
|
|
1298
|
+
(I(!0), $(Re, null, De(se.value, ({ item: g, index: b }) => (I(), $("div", {
|
|
1299
|
+
key: c(D)(g, b),
|
|
1285
1300
|
class: "vue-virtual-carousel__item",
|
|
1286
1301
|
style: N({
|
|
1287
|
-
flexBasis: `${
|
|
1288
|
-
marginRight: b < l.items.length - 1 ? `${
|
|
1302
|
+
flexBasis: `${ae.value}px`,
|
|
1303
|
+
marginRight: b < l.items.length - 1 ? `${W.value}px` : "0px"
|
|
1289
1304
|
}),
|
|
1290
1305
|
role: "listitem",
|
|
1291
1306
|
"aria-roledescription": "slide",
|
|
@@ -1293,24 +1308,24 @@ const rt = ["aria-label"], ut = ["aria-posinset", "aria-setsize"], et = /* @__PU
|
|
|
1293
1308
|
"aria-current": b === o.value ? "true" : void 0
|
|
1294
1309
|
}, [
|
|
1295
1310
|
ce(t.$slots, "default", {
|
|
1296
|
-
item:
|
|
1311
|
+
item: g,
|
|
1297
1312
|
index: b,
|
|
1298
1313
|
active: b === o.value,
|
|
1299
|
-
visible:
|
|
1314
|
+
visible: u(b)
|
|
1300
1315
|
})
|
|
1301
|
-
], 12,
|
|
1302
|
-
|
|
1316
|
+
], 12, Tt))), 128)),
|
|
1317
|
+
ue.value > 0 ? (I(), $("div", {
|
|
1303
1318
|
key: 1,
|
|
1304
1319
|
class: "vue-virtual-carousel__spacer",
|
|
1305
|
-
style: N({ flexBasis: `${
|
|
1320
|
+
style: N({ flexBasis: `${ue.value}px` }),
|
|
1306
1321
|
"aria-hidden": "true"
|
|
1307
1322
|
}, null, 4)) : ze("", !0)
|
|
1308
|
-
])) : (I(), $("div",
|
|
1323
|
+
])) : (I(), $("div", bt, [
|
|
1309
1324
|
ce(t.$slots, "empty")
|
|
1310
1325
|
]))
|
|
1311
|
-
], 44,
|
|
1326
|
+
], 44, xt));
|
|
1312
1327
|
}
|
|
1313
|
-
}),
|
|
1328
|
+
}), zt = ["aria-label"], It = ["aria-posinset", "aria-setsize"], $t = /* @__PURE__ */ Oe({
|
|
1314
1329
|
name: "VirtualScroll",
|
|
1315
1330
|
__name: "VirtualScroll",
|
|
1316
1331
|
props: {
|
|
@@ -1329,210 +1344,210 @@ const rt = ["aria-label"], ut = ["aria-posinset", "aria-setsize"], et = /* @__PU
|
|
|
1329
1344
|
pullRefreshThreshold: { default: 64 }
|
|
1330
1345
|
},
|
|
1331
1346
|
emits: ["scroll", "loadMore", "refresh"],
|
|
1332
|
-
setup(l, { expose:
|
|
1333
|
-
const e = l,
|
|
1334
|
-
pulling:
|
|
1347
|
+
setup(l, { expose: P, emit: x }) {
|
|
1348
|
+
const e = l, p = x, {
|
|
1349
|
+
pulling: f,
|
|
1335
1350
|
pullDistance: r,
|
|
1336
1351
|
pullOffset: o,
|
|
1337
|
-
pullProgress:
|
|
1338
|
-
refreshMessage:
|
|
1339
|
-
refreshThreshold:
|
|
1340
|
-
handleTouchStart:
|
|
1341
|
-
handleTouchMove:
|
|
1352
|
+
pullProgress: m,
|
|
1353
|
+
refreshMessage: A,
|
|
1354
|
+
refreshThreshold: O,
|
|
1355
|
+
handleTouchStart: U,
|
|
1356
|
+
handleTouchMove: q,
|
|
1342
1357
|
handleTouchEnd: V,
|
|
1343
|
-
handleTouchCancel:
|
|
1358
|
+
handleTouchCancel: D
|
|
1344
1359
|
} = qe({
|
|
1345
1360
|
enabled: () => e.pullToRefresh,
|
|
1346
1361
|
refreshing: () => e.refreshing,
|
|
1347
1362
|
threshold: () => e.pullRefreshThreshold,
|
|
1348
|
-
onRefresh: () =>
|
|
1349
|
-
}),
|
|
1350
|
-
let
|
|
1351
|
-
const ne = Ue(), { getItemKey:
|
|
1363
|
+
onRefresh: () => p("refresh")
|
|
1364
|
+
}), w = j(), k = j(0), E = j(0);
|
|
1365
|
+
let F, W = -1;
|
|
1366
|
+
const ne = Ue(), { getItemKey: Z } = Pe({
|
|
1352
1367
|
componentName: "VirtualScroll",
|
|
1353
1368
|
items: () => e.items,
|
|
1354
1369
|
itemKey: () => e.itemKey
|
|
1355
|
-
}),
|
|
1356
|
-
() => e.items.length *
|
|
1357
|
-
),
|
|
1358
|
-
() => Math.max(1, e.loadingItemSize ??
|
|
1359
|
-
),
|
|
1360
|
-
() => R.value + (e.loading ?
|
|
1361
|
-
),
|
|
1370
|
+
}), H = n(() => Math.max(1, e.itemSize)), ae = n(() => Math.max(0, Math.floor(e.overscan))), R = n(
|
|
1371
|
+
() => e.items.length * H.value
|
|
1372
|
+
), J = n(
|
|
1373
|
+
() => Math.max(1, e.loadingItemSize ?? H.value)
|
|
1374
|
+
), Y = n(
|
|
1375
|
+
() => R.value + (e.loading ? J.value : 0)
|
|
1376
|
+
), le = n(() => E.value > 0 ? E.value : typeof e.height == "number" ? e.height : 0), se = n(
|
|
1362
1377
|
() => Math.max(
|
|
1363
1378
|
0,
|
|
1364
|
-
Math.floor(
|
|
1379
|
+
Math.floor(k.value / H.value) - ae.value
|
|
1365
1380
|
)
|
|
1366
|
-
),
|
|
1367
|
-
const
|
|
1368
|
-
(
|
|
1381
|
+
), me = n(() => {
|
|
1382
|
+
const y = Math.ceil(
|
|
1383
|
+
(k.value + le.value) / H.value
|
|
1369
1384
|
);
|
|
1370
1385
|
return Math.min(
|
|
1371
1386
|
e.items.length,
|
|
1372
|
-
|
|
1387
|
+
y + ae.value
|
|
1373
1388
|
);
|
|
1374
|
-
}),
|
|
1375
|
-
() => e.items.slice(
|
|
1376
|
-
item:
|
|
1377
|
-
index:
|
|
1389
|
+
}), de = n(
|
|
1390
|
+
() => e.items.slice(se.value, me.value).map((y, L) => ({
|
|
1391
|
+
item: y,
|
|
1392
|
+
index: se.value + L
|
|
1378
1393
|
}))
|
|
1379
|
-
),
|
|
1380
|
-
height:
|
|
1381
|
-
})),
|
|
1382
|
-
transform: `translateY(${
|
|
1394
|
+
), ue = n(() => ({
|
|
1395
|
+
height: Fe(e.height)
|
|
1396
|
+
})), we = n(() => ({
|
|
1397
|
+
transform: `translateY(${se.value * H.value}px)`
|
|
1383
1398
|
}));
|
|
1384
|
-
function
|
|
1385
|
-
var
|
|
1386
|
-
|
|
1387
|
-
}
|
|
1388
|
-
function
|
|
1389
|
-
|
|
1390
|
-
scrollTop:
|
|
1391
|
-
startIndex:
|
|
1392
|
-
endIndex:
|
|
1393
|
-
}),
|
|
1394
|
-
}
|
|
1395
|
-
function
|
|
1396
|
-
const
|
|
1397
|
-
if (!
|
|
1399
|
+
function G() {
|
|
1400
|
+
var y;
|
|
1401
|
+
E.value = ((y = w.value) == null ? void 0 : y.clientHeight) ?? 0, ne(w.value, e.height), C(d);
|
|
1402
|
+
}
|
|
1403
|
+
function u(y) {
|
|
1404
|
+
k.value = y.currentTarget.scrollTop, p("scroll", {
|
|
1405
|
+
scrollTop: k.value,
|
|
1406
|
+
startIndex: se.value,
|
|
1407
|
+
endIndex: me.value
|
|
1408
|
+
}), d();
|
|
1409
|
+
}
|
|
1410
|
+
function d() {
|
|
1411
|
+
const y = w.value;
|
|
1412
|
+
if (!y || !e.hasMore || e.loading || W === e.items.length)
|
|
1398
1413
|
return;
|
|
1399
|
-
const
|
|
1400
|
-
|
|
1414
|
+
const L = Math.max(0, e.loadMoreThreshold);
|
|
1415
|
+
Y.value - y.scrollTop - y.clientHeight <= L && (W = e.items.length, p("loadMore"));
|
|
1401
1416
|
}
|
|
1402
|
-
function
|
|
1403
|
-
const B =
|
|
1417
|
+
function z(y, L = {}) {
|
|
1418
|
+
const B = w.value;
|
|
1404
1419
|
if (!B) return;
|
|
1405
|
-
const
|
|
1406
|
-
Math.max(0, Number.isFinite(
|
|
1407
|
-
|
|
1408
|
-
), re =
|
|
1409
|
-
re === "auto" && (
|
|
1410
|
-
}
|
|
1411
|
-
function
|
|
1412
|
-
const B =
|
|
1420
|
+
const te = Math.max(0, Y.value - B.clientHeight), oe = Math.min(
|
|
1421
|
+
Math.max(0, Number.isFinite(y) ? y : 0),
|
|
1422
|
+
te
|
|
1423
|
+
), re = L.behavior ?? "auto";
|
|
1424
|
+
re === "auto" && (k.value = oe), B.scrollTo({ ...L, top: oe, behavior: re });
|
|
1425
|
+
}
|
|
1426
|
+
function Q(y, L = {}) {
|
|
1427
|
+
const B = w.value;
|
|
1413
1428
|
if (!B || e.items.length === 0) return;
|
|
1414
|
-
const
|
|
1429
|
+
const te = Math.min(
|
|
1415
1430
|
e.items.length - 1,
|
|
1416
|
-
Math.max(0, Math.floor(
|
|
1417
|
-
), { align: oe = "start", ...re } =
|
|
1418
|
-
let
|
|
1419
|
-
oe === "center" ?
|
|
1431
|
+
Math.max(0, Math.floor(y))
|
|
1432
|
+
), { align: oe = "start", ...re } = L;
|
|
1433
|
+
let ye = te * H.value;
|
|
1434
|
+
oe === "center" ? ye -= (B.clientHeight - H.value) / 2 : oe === "end" && (ye -= B.clientHeight - H.value), B.scrollTo({
|
|
1420
1435
|
...re,
|
|
1421
|
-
top: Math.max(0, Math.min(
|
|
1436
|
+
top: Math.max(0, Math.min(ye, Y.value - B.clientHeight))
|
|
1422
1437
|
});
|
|
1423
1438
|
}
|
|
1424
|
-
function
|
|
1425
|
-
var
|
|
1426
|
-
(
|
|
1439
|
+
function he(y = "auto") {
|
|
1440
|
+
var L;
|
|
1441
|
+
(L = w.value) == null || L.scrollTo({ top: 0, behavior: y });
|
|
1427
1442
|
}
|
|
1428
1443
|
return ie(
|
|
1429
1444
|
() => [e.items.length, e.itemSize],
|
|
1430
1445
|
async () => {
|
|
1431
|
-
await
|
|
1432
|
-
const
|
|
1433
|
-
if (!
|
|
1434
|
-
const
|
|
1435
|
-
|
|
1446
|
+
await C();
|
|
1447
|
+
const y = w.value;
|
|
1448
|
+
if (!y) return;
|
|
1449
|
+
const L = Math.max(0, Y.value - y.clientHeight);
|
|
1450
|
+
y.scrollTop > L && (y.scrollTop = L, k.value = L), d();
|
|
1436
1451
|
}
|
|
1437
1452
|
), ie(
|
|
1438
1453
|
() => [e.hasMore, e.loading],
|
|
1439
|
-
async ([
|
|
1440
|
-
|
|
1454
|
+
async ([y]) => {
|
|
1455
|
+
y || (W = -1), await C(), d();
|
|
1441
1456
|
}
|
|
1442
|
-
),
|
|
1443
|
-
|
|
1444
|
-
}),
|
|
1445
|
-
|
|
1446
|
-
}),
|
|
1447
|
-
scrollTo:
|
|
1448
|
-
scrollToIndex:
|
|
1449
|
-
scrollToTop:
|
|
1450
|
-
}), (
|
|
1457
|
+
), Ae(() => {
|
|
1458
|
+
G(), typeof ResizeObserver < "u" && w.value && (F = new ResizeObserver(G), F.observe(w.value)), C(d);
|
|
1459
|
+
}), Ce(() => {
|
|
1460
|
+
F && (F.disconnect(), F = void 0);
|
|
1461
|
+
}), P({
|
|
1462
|
+
scrollTo: z,
|
|
1463
|
+
scrollToIndex: Q,
|
|
1464
|
+
scrollToTop: he
|
|
1465
|
+
}), (y, L) => (I(), $("div", {
|
|
1451
1466
|
ref_key: "viewport",
|
|
1452
|
-
ref:
|
|
1453
|
-
class:
|
|
1454
|
-
style: N(
|
|
1467
|
+
ref: w,
|
|
1468
|
+
class: Ye(["vue-virtual-scroll", { "vue-virtual-scroll--pulling": c(f) }]),
|
|
1469
|
+
style: N(ue.value),
|
|
1455
1470
|
role: "list",
|
|
1456
1471
|
"aria-label": l.ariaLabel,
|
|
1457
1472
|
tabindex: "0",
|
|
1458
|
-
onScrollPassive:
|
|
1459
|
-
onTouchstartPassive:
|
|
1460
|
-
(...B) =>
|
|
1461
|
-
onTouchmove:
|
|
1462
|
-
(...B) =>
|
|
1463
|
-
onTouchend:
|
|
1464
|
-
(...B) =>
|
|
1465
|
-
onTouchcancel:
|
|
1466
|
-
(...B) =>
|
|
1473
|
+
onScrollPassive: u,
|
|
1474
|
+
onTouchstartPassive: L[0] || (L[0] = //@ts-ignore
|
|
1475
|
+
(...B) => c(U) && c(U)(...B)),
|
|
1476
|
+
onTouchmove: L[1] || (L[1] = //@ts-ignore
|
|
1477
|
+
(...B) => c(q) && c(q)(...B)),
|
|
1478
|
+
onTouchend: L[2] || (L[2] = //@ts-ignore
|
|
1479
|
+
(...B) => c(V) && c(V)(...B)),
|
|
1480
|
+
onTouchcancel: L[3] || (L[3] = //@ts-ignore
|
|
1481
|
+
(...B) => c(D) && c(D)(...B))
|
|
1467
1482
|
}, [
|
|
1468
1483
|
l.pullToRefresh || l.refreshing ? (I(), $("div", {
|
|
1469
1484
|
key: 0,
|
|
1470
1485
|
class: "vue-virtual-scroll__refresh",
|
|
1471
1486
|
style: N({
|
|
1472
|
-
height: `${
|
|
1473
|
-
transform: `translateY(${
|
|
1487
|
+
height: `${c(O)}px`,
|
|
1488
|
+
transform: `translateY(${c(o) - c(O)}px)`
|
|
1474
1489
|
}),
|
|
1475
1490
|
role: "status",
|
|
1476
1491
|
"aria-live": "polite"
|
|
1477
1492
|
}, [
|
|
1478
|
-
ce(
|
|
1479
|
-
pullDistance:
|
|
1480
|
-
progress:
|
|
1493
|
+
ce(y.$slots, "refresh", {
|
|
1494
|
+
pullDistance: c(r),
|
|
1495
|
+
progress: c(m),
|
|
1481
1496
|
refreshing: l.refreshing
|
|
1482
1497
|
}, () => [
|
|
1483
|
-
Ve(
|
|
1498
|
+
Ve(je(c(A)), 1)
|
|
1484
1499
|
])
|
|
1485
1500
|
], 4)) : ze("", !0),
|
|
1486
1501
|
l.items.length || l.loading ? (I(), $("div", {
|
|
1487
1502
|
key: 1,
|
|
1488
1503
|
class: "vue-virtual-scroll__spacer",
|
|
1489
1504
|
style: N({
|
|
1490
|
-
height: `${
|
|
1491
|
-
transform: `translateY(${
|
|
1505
|
+
height: `${Y.value}px`,
|
|
1506
|
+
transform: `translateY(${c(o)}px)`
|
|
1492
1507
|
})
|
|
1493
1508
|
}, [
|
|
1494
|
-
|
|
1509
|
+
Ge("div", {
|
|
1495
1510
|
class: "vue-virtual-scroll__content",
|
|
1496
|
-
style: N(
|
|
1511
|
+
style: N(we.value)
|
|
1497
1512
|
}, [
|
|
1498
|
-
(I(!0), $(
|
|
1499
|
-
key:
|
|
1513
|
+
(I(!0), $(Re, null, De(de.value, ({ item: B, index: te }) => (I(), $("div", {
|
|
1514
|
+
key: c(Z)(B, te),
|
|
1500
1515
|
class: "vue-virtual-scroll__item",
|
|
1501
|
-
style: N({ height: `${
|
|
1516
|
+
style: N({ height: `${H.value}px` }),
|
|
1502
1517
|
role: "listitem",
|
|
1503
|
-
"aria-posinset":
|
|
1518
|
+
"aria-posinset": te + 1,
|
|
1504
1519
|
"aria-setsize": l.items.length
|
|
1505
1520
|
}, [
|
|
1506
|
-
ce(
|
|
1521
|
+
ce(y.$slots, "default", {
|
|
1507
1522
|
item: B,
|
|
1508
|
-
index:
|
|
1523
|
+
index: te
|
|
1509
1524
|
})
|
|
1510
|
-
], 12,
|
|
1525
|
+
], 12, It))), 128))
|
|
1511
1526
|
], 4),
|
|
1512
1527
|
l.loading ? (I(), $("div", {
|
|
1513
1528
|
key: 0,
|
|
1514
1529
|
class: "vue-virtual-scroll__loading",
|
|
1515
1530
|
style: N({
|
|
1516
|
-
height: `${
|
|
1531
|
+
height: `${J.value}px`,
|
|
1517
1532
|
transform: `translateY(${R.value}px)`
|
|
1518
1533
|
}),
|
|
1519
1534
|
role: "status",
|
|
1520
1535
|
"aria-live": "polite"
|
|
1521
1536
|
}, [
|
|
1522
|
-
ce(
|
|
1523
|
-
|
|
1537
|
+
ce(y.$slots, "loading", {}, () => [
|
|
1538
|
+
L[4] || (L[4] = Ve("Loading more…", -1))
|
|
1524
1539
|
])
|
|
1525
1540
|
], 4)) : ze("", !0)
|
|
1526
1541
|
], 4)) : (I(), $("div", {
|
|
1527
1542
|
key: 2,
|
|
1528
1543
|
class: "vue-virtual-scroll__empty",
|
|
1529
|
-
style: N({ transform: `translateY(${
|
|
1544
|
+
style: N({ transform: `translateY(${c(o)}px)` })
|
|
1530
1545
|
}, [
|
|
1531
|
-
ce(
|
|
1546
|
+
ce(y.$slots, "empty")
|
|
1532
1547
|
], 4))
|
|
1533
|
-
], 46,
|
|
1548
|
+
], 46, zt));
|
|
1534
1549
|
}
|
|
1535
|
-
}),
|
|
1550
|
+
}), kt = ["aria-label"], Et = ["aria-posinset", "aria-setsize"], Lt = /* @__PURE__ */ Oe({
|
|
1536
1551
|
name: "WindowDynamicVirtualScroll",
|
|
1537
1552
|
__name: "WindowDynamicVirtualScroll",
|
|
1538
1553
|
props: {
|
|
@@ -1550,329 +1565,329 @@ const rt = ["aria-label"], ut = ["aria-posinset", "aria-setsize"], et = /* @__PU
|
|
|
1550
1565
|
pullRefreshThreshold: { default: 64 }
|
|
1551
1566
|
},
|
|
1552
1567
|
emits: ["scroll", "loadMore", "refresh"],
|
|
1553
|
-
setup(l, { expose:
|
|
1554
|
-
const e = l,
|
|
1555
|
-
let V,
|
|
1556
|
-
const { getItemKey: ne } =
|
|
1568
|
+
setup(l, { expose: P, emit: x }) {
|
|
1569
|
+
const e = l, p = x, f = j(), r = j(0), o = j(0), m = j(0), A = j(0), O = /* @__PURE__ */ new Map(), U = /* @__PURE__ */ new Map(), q = /* @__PURE__ */ new Map();
|
|
1570
|
+
let V, D, w, k, E = !1, F = !1, W = -1;
|
|
1571
|
+
const { getItemKey: ne } = Pe({
|
|
1557
1572
|
componentName: "WindowDynamicVirtualScroll",
|
|
1558
1573
|
items: () => e.items,
|
|
1559
1574
|
itemKey: () => e.itemKey
|
|
1560
1575
|
});
|
|
1561
|
-
function
|
|
1576
|
+
function Z(v) {
|
|
1562
1577
|
return typeof window.requestAnimationFrame == "function" ? {
|
|
1563
|
-
id: window.requestAnimationFrame(
|
|
1578
|
+
id: window.requestAnimationFrame(v),
|
|
1564
1579
|
type: "animation"
|
|
1565
1580
|
} : {
|
|
1566
|
-
id: window.setTimeout(
|
|
1581
|
+
id: window.setTimeout(v, 0),
|
|
1567
1582
|
type: "timeout"
|
|
1568
1583
|
};
|
|
1569
1584
|
}
|
|
1570
|
-
function
|
|
1571
|
-
|
|
1585
|
+
function H(v) {
|
|
1586
|
+
v && (v.type === "animation" ? window.cancelAnimationFrame(v.id) : window.clearTimeout(v.id));
|
|
1572
1587
|
}
|
|
1573
1588
|
const {
|
|
1574
|
-
pulling:
|
|
1589
|
+
pulling: ae,
|
|
1575
1590
|
pullDistance: R,
|
|
1576
|
-
pullOffset:
|
|
1577
|
-
pullProgress:
|
|
1578
|
-
refreshMessage:
|
|
1579
|
-
refreshThreshold:
|
|
1580
|
-
handleTouchStart:
|
|
1581
|
-
handleTouchMove:
|
|
1582
|
-
handleTouchEnd:
|
|
1583
|
-
handleTouchCancel:
|
|
1591
|
+
pullOffset: J,
|
|
1592
|
+
pullProgress: Y,
|
|
1593
|
+
refreshMessage: le,
|
|
1594
|
+
refreshThreshold: se,
|
|
1595
|
+
handleTouchStart: me,
|
|
1596
|
+
handleTouchMove: de,
|
|
1597
|
+
handleTouchEnd: ue,
|
|
1598
|
+
handleTouchCancel: we
|
|
1584
1599
|
} = qe({
|
|
1585
1600
|
enabled: () => e.pullToRefresh,
|
|
1586
1601
|
refreshing: () => e.refreshing,
|
|
1587
1602
|
threshold: () => e.pullRefreshThreshold,
|
|
1588
|
-
onRefresh: () =>
|
|
1603
|
+
onRefresh: () => p("refresh"),
|
|
1589
1604
|
scrollTop: () => typeof window > "u" ? 0 : Math.max(0, window.scrollY)
|
|
1590
|
-
}),
|
|
1605
|
+
}), G = n(
|
|
1591
1606
|
() => Math.max(1, e.estimatedItemSize)
|
|
1592
|
-
),
|
|
1593
|
-
() => Math.max(1, e.loadingItemSize ??
|
|
1594
|
-
),
|
|
1595
|
-
|
|
1596
|
-
const
|
|
1597
|
-
|
|
1607
|
+
), u = n(
|
|
1608
|
+
() => Math.max(1, e.loadingItemSize ?? G.value)
|
|
1609
|
+
), d = n(() => Math.max(0, Math.floor(e.overscan))), z = n(() => {
|
|
1610
|
+
A.value;
|
|
1611
|
+
const v = new Array(e.items.length + 1), S = new Array(e.items.length);
|
|
1612
|
+
v[0] = 0;
|
|
1598
1613
|
for (let T = 0; T < e.items.length; T += 1) {
|
|
1599
|
-
const fe = ne(e.items[T], T),
|
|
1600
|
-
S[T] =
|
|
1614
|
+
const fe = ne(e.items[T], T), X = O.get(fe) ?? G.value;
|
|
1615
|
+
S[T] = X, v[T + 1] = v[T] + X;
|
|
1601
1616
|
}
|
|
1602
1617
|
return {
|
|
1603
|
-
offsets:
|
|
1618
|
+
offsets: v,
|
|
1604
1619
|
sizes: S,
|
|
1605
|
-
total:
|
|
1620
|
+
total: v[e.items.length] ?? 0
|
|
1606
1621
|
};
|
|
1607
|
-
}),
|
|
1608
|
-
() =>
|
|
1609
|
-
),
|
|
1610
|
-
const
|
|
1622
|
+
}), Q = n(
|
|
1623
|
+
() => z.value.total + (e.loading ? u.value : 0)
|
|
1624
|
+
), he = n(() => {
|
|
1625
|
+
const v = /* @__PURE__ */ new Map();
|
|
1611
1626
|
return e.items.forEach((S, T) => {
|
|
1612
|
-
|
|
1613
|
-
}),
|
|
1614
|
-
}),
|
|
1615
|
-
() => Math.max(0, r.value -
|
|
1627
|
+
v.set(ne(S, T), T);
|
|
1628
|
+
}), v;
|
|
1629
|
+
}), y = n(
|
|
1630
|
+
() => Math.max(0, r.value - m.value)
|
|
1616
1631
|
);
|
|
1617
|
-
function
|
|
1632
|
+
function L(v) {
|
|
1618
1633
|
if (e.items.length === 0) return 0;
|
|
1619
|
-
const S =
|
|
1634
|
+
const S = z.value.offsets;
|
|
1620
1635
|
let T = 0, fe = e.items.length;
|
|
1621
1636
|
for (; T < fe; ) {
|
|
1622
|
-
const
|
|
1623
|
-
S[
|
|
1637
|
+
const X = Math.floor((T + fe) / 2);
|
|
1638
|
+
S[X + 1] <= v ? T = X + 1 : fe = X;
|
|
1624
1639
|
}
|
|
1625
1640
|
return Math.min(T, e.items.length - 1);
|
|
1626
1641
|
}
|
|
1627
1642
|
const B = n(
|
|
1628
1643
|
() => Math.max(
|
|
1629
1644
|
0,
|
|
1630
|
-
|
|
1645
|
+
L(y.value) - d.value
|
|
1631
1646
|
)
|
|
1632
|
-
),
|
|
1647
|
+
), te = n(() => {
|
|
1633
1648
|
if (e.items.length === 0) return 0;
|
|
1634
|
-
const
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
), T =
|
|
1649
|
+
const v = r.value + o.value - m.value, S = Math.max(
|
|
1650
|
+
G.value,
|
|
1651
|
+
v
|
|
1652
|
+
), T = L(S) + 1;
|
|
1638
1653
|
return Math.min(
|
|
1639
1654
|
e.items.length,
|
|
1640
|
-
T +
|
|
1655
|
+
T + d.value
|
|
1641
1656
|
);
|
|
1642
1657
|
}), oe = n(
|
|
1643
|
-
() => e.items.slice(B.value,
|
|
1658
|
+
() => e.items.slice(B.value, te.value).map((v, S) => {
|
|
1644
1659
|
const T = B.value + S;
|
|
1645
1660
|
return {
|
|
1646
|
-
item:
|
|
1661
|
+
item: v,
|
|
1647
1662
|
index: T,
|
|
1648
|
-
key: ne(
|
|
1649
|
-
top:
|
|
1663
|
+
key: ne(v, T),
|
|
1664
|
+
top: z.value.offsets[T]
|
|
1650
1665
|
};
|
|
1651
1666
|
})
|
|
1652
1667
|
);
|
|
1653
1668
|
function re() {
|
|
1654
|
-
typeof window > "u" || (r.value = Math.max(0, window.scrollY), o.value = window.innerHeight,
|
|
1669
|
+
typeof window > "u" || (r.value = Math.max(0, window.scrollY), o.value = window.innerHeight, f.value && (m.value = f.value.getBoundingClientRect().top + r.value));
|
|
1655
1670
|
}
|
|
1656
|
-
function
|
|
1657
|
-
|
|
1658
|
-
scrollTop:
|
|
1671
|
+
function ye() {
|
|
1672
|
+
p("scroll", {
|
|
1673
|
+
scrollTop: y.value,
|
|
1659
1674
|
startIndex: B.value,
|
|
1660
|
-
endIndex:
|
|
1675
|
+
endIndex: te.value
|
|
1661
1676
|
});
|
|
1662
1677
|
}
|
|
1663
|
-
function _(
|
|
1664
|
-
|
|
1665
|
-
|
|
1678
|
+
function _(v = !1) {
|
|
1679
|
+
F && (E || (E = v), !w && (w = Z(() => {
|
|
1680
|
+
w = void 0, re(), E && (E = !1, ye()), t();
|
|
1666
1681
|
})));
|
|
1667
1682
|
}
|
|
1668
|
-
function
|
|
1683
|
+
function ee() {
|
|
1669
1684
|
_(!0);
|
|
1670
1685
|
}
|
|
1671
1686
|
function s() {
|
|
1672
1687
|
_();
|
|
1673
1688
|
}
|
|
1674
1689
|
function t() {
|
|
1675
|
-
if (typeof window > "u" || !e.hasMore || e.loading ||
|
|
1690
|
+
if (typeof window > "u" || !e.hasMore || e.loading || W === e.items.length)
|
|
1676
1691
|
return;
|
|
1677
|
-
const
|
|
1678
|
-
S - T <=
|
|
1692
|
+
const v = Math.max(0, e.loadMoreThreshold), S = m.value + Q.value, T = r.value + o.value;
|
|
1693
|
+
S - T <= v && (W = e.items.length, p("loadMore"));
|
|
1679
1694
|
}
|
|
1680
|
-
function a(
|
|
1681
|
-
const S =
|
|
1695
|
+
function a(v) {
|
|
1696
|
+
const S = v.borderBoxSize;
|
|
1682
1697
|
if (S) {
|
|
1683
1698
|
const T = Array.isArray(S) ? S[0] : S;
|
|
1684
1699
|
if (T != null && T.blockSize) return T.blockSize;
|
|
1685
1700
|
}
|
|
1686
|
-
return
|
|
1701
|
+
return v.contentRect.height;
|
|
1687
1702
|
}
|
|
1688
|
-
function
|
|
1689
|
-
const S =
|
|
1703
|
+
function g(v) {
|
|
1704
|
+
const S = z.value;
|
|
1690
1705
|
let T = 0, fe = !1;
|
|
1691
|
-
for (const
|
|
1692
|
-
const be =
|
|
1706
|
+
for (const X of v) {
|
|
1707
|
+
const be = X.target, Ie = U.get(be), Be = a(X);
|
|
1693
1708
|
if (Ie === void 0 || Be <= 0) continue;
|
|
1694
|
-
const Ke =
|
|
1709
|
+
const Ke = O.get(Ie) ?? G.value;
|
|
1695
1710
|
if (Math.abs(Ke - Be) < 0.5) continue;
|
|
1696
|
-
const
|
|
1697
|
-
|
|
1711
|
+
const He = he.value.get(Ie);
|
|
1712
|
+
He !== void 0 && S.offsets[He + 1] <= y.value && (T += Be - Ke), O.set(Ie, Be), fe = !0;
|
|
1698
1713
|
}
|
|
1699
|
-
fe && (
|
|
1700
|
-
if (
|
|
1714
|
+
fe && (A.value += 1, C(() => {
|
|
1715
|
+
if (F) {
|
|
1701
1716
|
if (T !== 0 && typeof window < "u") {
|
|
1702
|
-
const
|
|
1717
|
+
const X = Math.max(
|
|
1703
1718
|
0,
|
|
1704
1719
|
r.value + T
|
|
1705
1720
|
);
|
|
1706
|
-
r.value =
|
|
1721
|
+
r.value = X, window.scrollTo({ top: X, behavior: "auto" });
|
|
1707
1722
|
}
|
|
1708
1723
|
re(), t();
|
|
1709
1724
|
}
|
|
1710
1725
|
}));
|
|
1711
1726
|
}
|
|
1712
|
-
function b(
|
|
1713
|
-
if (
|
|
1714
|
-
for (const S of
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
const S = Array.from(
|
|
1719
|
-
|
|
1727
|
+
function b(v) {
|
|
1728
|
+
if (F) {
|
|
1729
|
+
for (const S of v)
|
|
1730
|
+
q.set(S.target, S);
|
|
1731
|
+
k || (k = Z(() => {
|
|
1732
|
+
k = void 0;
|
|
1733
|
+
const S = Array.from(q.values());
|
|
1734
|
+
q.clear(), g(S);
|
|
1720
1735
|
}));
|
|
1721
1736
|
}
|
|
1722
1737
|
}
|
|
1723
|
-
function
|
|
1724
|
-
|
|
1738
|
+
function Me(v, S) {
|
|
1739
|
+
v instanceof HTMLElement && (U.set(v, S), D == null || D.observe(v));
|
|
1725
1740
|
}
|
|
1726
|
-
function
|
|
1727
|
-
for (const [
|
|
1728
|
-
|
|
1741
|
+
function ge() {
|
|
1742
|
+
for (const [v] of U)
|
|
1743
|
+
v.isConnected || (D == null || D.unobserve(v), U.delete(v));
|
|
1729
1744
|
}
|
|
1730
|
-
function
|
|
1745
|
+
function ve(v, S = {}) {
|
|
1731
1746
|
if (typeof window > "u") return;
|
|
1732
1747
|
re();
|
|
1733
|
-
const T = Math.max(0,
|
|
1734
|
-
Math.max(0, Number.isFinite(
|
|
1748
|
+
const T = Math.max(0, Q.value - o.value), fe = Math.min(
|
|
1749
|
+
Math.max(0, Number.isFinite(v) ? v : 0),
|
|
1735
1750
|
T
|
|
1736
|
-
),
|
|
1737
|
-
be === "auto" && (r.value =
|
|
1751
|
+
), X = Math.max(0, m.value + fe), be = S.behavior ?? "auto";
|
|
1752
|
+
be === "auto" && (r.value = X), window.scrollTo({ ...S, top: X, behavior: be });
|
|
1738
1753
|
}
|
|
1739
|
-
function
|
|
1754
|
+
function Le(v, S = {}) {
|
|
1740
1755
|
if (typeof window > "u" || e.items.length === 0) return;
|
|
1741
1756
|
re();
|
|
1742
1757
|
const T = Math.min(
|
|
1743
1758
|
e.items.length - 1,
|
|
1744
|
-
Math.max(0, Math.floor(
|
|
1745
|
-
), { align: fe = "start", ...
|
|
1746
|
-
let Ie =
|
|
1759
|
+
Math.max(0, Math.floor(v))
|
|
1760
|
+
), { align: fe = "start", ...X } = S, be = z.value.sizes[T];
|
|
1761
|
+
let Ie = m.value + z.value.offsets[T];
|
|
1747
1762
|
fe === "center" ? Ie -= (o.value - be) / 2 : fe === "end" && (Ie -= o.value - be);
|
|
1748
1763
|
const Be = Math.max(
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
), Ke = Math.max(0, Math.min(Ie, Be)),
|
|
1752
|
-
|
|
1753
|
-
...
|
|
1764
|
+
m.value,
|
|
1765
|
+
m.value + Q.value - o.value
|
|
1766
|
+
), Ke = Math.max(0, Math.min(Ie, Be)), He = X.behavior ?? "auto";
|
|
1767
|
+
He === "auto" && (r.value = Ke), window.scrollTo({
|
|
1768
|
+
...X,
|
|
1754
1769
|
top: Ke,
|
|
1755
|
-
behavior:
|
|
1770
|
+
behavior: He
|
|
1756
1771
|
});
|
|
1757
1772
|
}
|
|
1758
|
-
function ke(
|
|
1759
|
-
typeof window > "u" || (re(), window.scrollTo({ top: Math.max(0,
|
|
1773
|
+
function ke(v = "auto") {
|
|
1774
|
+
typeof window > "u" || (re(), window.scrollTo({ top: Math.max(0, m.value), behavior: v }));
|
|
1760
1775
|
}
|
|
1761
1776
|
return ie(
|
|
1762
1777
|
() => e.itemKey,
|
|
1763
1778
|
() => {
|
|
1764
|
-
|
|
1779
|
+
O.clear(), A.value += 1, W = -1;
|
|
1765
1780
|
}
|
|
1766
1781
|
), ie(
|
|
1767
|
-
() => e.items.map((
|
|
1768
|
-
async (
|
|
1769
|
-
const T =
|
|
1770
|
-
for (const
|
|
1771
|
-
fe.has(
|
|
1772
|
-
T && (
|
|
1782
|
+
() => e.items.map((v, S) => ne(v, S)),
|
|
1783
|
+
async (v, S) => {
|
|
1784
|
+
const T = v.length !== S.length || v.some((X, be) => X !== S[be]), fe = new Set(v);
|
|
1785
|
+
for (const X of O.keys())
|
|
1786
|
+
fe.has(X) || O.delete(X);
|
|
1787
|
+
T && (W = -1), A.value += 1, await C(), F && (re(), t());
|
|
1773
1788
|
}
|
|
1774
1789
|
), ie(
|
|
1775
1790
|
() => [e.hasMore, e.loading],
|
|
1776
|
-
async ([
|
|
1777
|
-
|
|
1791
|
+
async ([v]) => {
|
|
1792
|
+
v || (W = -1), await C(), F && (re(), t());
|
|
1778
1793
|
}
|
|
1779
|
-
),
|
|
1780
|
-
if (
|
|
1794
|
+
), Ae(() => {
|
|
1795
|
+
if (F = !0, re(), window.addEventListener("scroll", ee, { passive: !0 }), window.addEventListener("resize", s, { passive: !0 }), typeof ResizeObserver < "u") {
|
|
1781
1796
|
V = new ResizeObserver(() => {
|
|
1782
1797
|
_();
|
|
1783
|
-
}),
|
|
1784
|
-
for (const [
|
|
1785
|
-
|
|
1798
|
+
}), D = new ResizeObserver(b), f.value && V.observe(f.value);
|
|
1799
|
+
for (const [v] of U)
|
|
1800
|
+
D.observe(v);
|
|
1786
1801
|
}
|
|
1787
|
-
|
|
1788
|
-
|
|
1802
|
+
C(() => {
|
|
1803
|
+
F && t();
|
|
1789
1804
|
});
|
|
1790
|
-
}),
|
|
1791
|
-
|
|
1792
|
-
}),
|
|
1793
|
-
scrollTo:
|
|
1794
|
-
scrollToIndex:
|
|
1805
|
+
}), Xe(ge), Ce(() => {
|
|
1806
|
+
F = !1, window.removeEventListener("scroll", ee), window.removeEventListener("resize", s), H(w), H(k), w = void 0, k = void 0, E = !1, q.clear(), V && (V.disconnect(), V = void 0), D && (D.disconnect(), D = void 0), U.clear();
|
|
1807
|
+
}), P({
|
|
1808
|
+
scrollTo: ve,
|
|
1809
|
+
scrollToIndex: Le,
|
|
1795
1810
|
scrollToTop: ke
|
|
1796
|
-
}), (
|
|
1811
|
+
}), (v, S) => (I(), $("div", {
|
|
1797
1812
|
ref_key: "root",
|
|
1798
|
-
ref:
|
|
1799
|
-
class:
|
|
1813
|
+
ref: f,
|
|
1814
|
+
class: Ye(["vue-window-dynamic-virtual-scroll", { "vue-window-dynamic-virtual-scroll--pulling": c(ae) }]),
|
|
1800
1815
|
role: "list",
|
|
1801
1816
|
"aria-label": l.ariaLabel,
|
|
1802
1817
|
onTouchstartPassive: S[0] || (S[0] = //@ts-ignore
|
|
1803
|
-
(...T) =>
|
|
1818
|
+
(...T) => c(me) && c(me)(...T)),
|
|
1804
1819
|
onTouchmove: S[1] || (S[1] = //@ts-ignore
|
|
1805
|
-
(...T) =>
|
|
1820
|
+
(...T) => c(de) && c(de)(...T)),
|
|
1806
1821
|
onTouchend: S[2] || (S[2] = //@ts-ignore
|
|
1807
|
-
(...T) =>
|
|
1822
|
+
(...T) => c(ue) && c(ue)(...T)),
|
|
1808
1823
|
onTouchcancel: S[3] || (S[3] = //@ts-ignore
|
|
1809
|
-
(...T) =>
|
|
1824
|
+
(...T) => c(we) && c(we)(...T))
|
|
1810
1825
|
}, [
|
|
1811
1826
|
l.pullToRefresh || l.refreshing ? (I(), $("div", {
|
|
1812
1827
|
key: 0,
|
|
1813
1828
|
class: "vue-window-dynamic-virtual-scroll__refresh",
|
|
1814
1829
|
style: N({
|
|
1815
|
-
height: `${
|
|
1816
|
-
transform: `translateY(${
|
|
1830
|
+
height: `${c(se)}px`,
|
|
1831
|
+
transform: `translateY(${c(J) - c(se)}px)`
|
|
1817
1832
|
}),
|
|
1818
1833
|
role: "status",
|
|
1819
1834
|
"aria-live": "polite"
|
|
1820
1835
|
}, [
|
|
1821
|
-
ce(
|
|
1822
|
-
pullDistance:
|
|
1823
|
-
progress:
|
|
1836
|
+
ce(v.$slots, "refresh", {
|
|
1837
|
+
pullDistance: c(R),
|
|
1838
|
+
progress: c(Y),
|
|
1824
1839
|
refreshing: l.refreshing
|
|
1825
1840
|
}, () => [
|
|
1826
|
-
Ve(
|
|
1841
|
+
Ve(je(c(le)), 1)
|
|
1827
1842
|
])
|
|
1828
1843
|
], 4)) : ze("", !0),
|
|
1829
1844
|
l.items.length || l.loading ? (I(), $("div", {
|
|
1830
1845
|
key: 1,
|
|
1831
1846
|
class: "vue-window-dynamic-virtual-scroll__spacer",
|
|
1832
1847
|
style: N({
|
|
1833
|
-
height: `${
|
|
1834
|
-
transform: `translateY(${
|
|
1848
|
+
height: `${Q.value}px`,
|
|
1849
|
+
transform: `translateY(${c(J)}px)`
|
|
1835
1850
|
})
|
|
1836
1851
|
}, [
|
|
1837
|
-
(I(!0), $(
|
|
1838
|
-
key:
|
|
1852
|
+
(I(!0), $(Re, null, De(oe.value, ({ item: T, index: fe, key: X, top: be }) => (I(), $("div", {
|
|
1853
|
+
key: X,
|
|
1839
1854
|
ref_for: !0,
|
|
1840
|
-
ref: (Ie) =>
|
|
1855
|
+
ref: (Ie) => Me(Ie, X),
|
|
1841
1856
|
class: "vue-window-dynamic-virtual-scroll__item",
|
|
1842
1857
|
style: N({ transform: `translateY(${be}px)` }),
|
|
1843
1858
|
role: "listitem",
|
|
1844
1859
|
"aria-posinset": fe + 1,
|
|
1845
1860
|
"aria-setsize": l.items.length
|
|
1846
1861
|
}, [
|
|
1847
|
-
ce(
|
|
1862
|
+
ce(v.$slots, "default", {
|
|
1848
1863
|
item: T,
|
|
1849
1864
|
index: fe
|
|
1850
1865
|
})
|
|
1851
|
-
], 12,
|
|
1866
|
+
], 12, Et))), 128)),
|
|
1852
1867
|
l.loading ? (I(), $("div", {
|
|
1853
1868
|
key: 0,
|
|
1854
1869
|
class: "vue-window-dynamic-virtual-scroll__loading",
|
|
1855
1870
|
style: N({
|
|
1856
|
-
height: `${
|
|
1857
|
-
transform: `translateY(${
|
|
1871
|
+
height: `${u.value}px`,
|
|
1872
|
+
transform: `translateY(${z.value.total}px)`
|
|
1858
1873
|
}),
|
|
1859
1874
|
role: "status",
|
|
1860
1875
|
"aria-live": "polite"
|
|
1861
1876
|
}, [
|
|
1862
|
-
ce(
|
|
1877
|
+
ce(v.$slots, "loading", {}, () => [
|
|
1863
1878
|
S[4] || (S[4] = Ve("Loading more…", -1))
|
|
1864
1879
|
])
|
|
1865
1880
|
], 4)) : ze("", !0)
|
|
1866
1881
|
], 4)) : (I(), $("div", {
|
|
1867
1882
|
key: 2,
|
|
1868
1883
|
class: "vue-window-dynamic-virtual-scroll__empty",
|
|
1869
|
-
style: N({ transform: `translateY(${
|
|
1884
|
+
style: N({ transform: `translateY(${c(J)}px)` })
|
|
1870
1885
|
}, [
|
|
1871
|
-
ce(
|
|
1886
|
+
ce(v.$slots, "empty")
|
|
1872
1887
|
], 4))
|
|
1873
|
-
], 42,
|
|
1888
|
+
], 42, kt));
|
|
1874
1889
|
}
|
|
1875
|
-
}),
|
|
1890
|
+
}), Bt = ["aria-label"], Vt = ["aria-posinset", "aria-setsize"], Ht = /* @__PURE__ */ Oe({
|
|
1876
1891
|
name: "WindowGirdVirtualScroll",
|
|
1877
1892
|
__name: "WindowGirdVirtualScroll",
|
|
1878
1893
|
props: {
|
|
@@ -1892,131 +1907,131 @@ const rt = ["aria-label"], ut = ["aria-posinset", "aria-setsize"], et = /* @__PU
|
|
|
1892
1907
|
pullRefreshThreshold: { default: 64 }
|
|
1893
1908
|
},
|
|
1894
1909
|
emits: ["scroll", "loadMore", "refresh"],
|
|
1895
|
-
setup(l, { expose:
|
|
1896
|
-
const e = l,
|
|
1897
|
-
let
|
|
1898
|
-
const { getItemKey:
|
|
1910
|
+
setup(l, { expose: P, emit: x }) {
|
|
1911
|
+
const e = l, p = x, f = j(), r = j(0), o = j(0), m = j(0);
|
|
1912
|
+
let A, O = -1;
|
|
1913
|
+
const { getItemKey: U } = Pe({
|
|
1899
1914
|
componentName: "WindowGirdVirtualScroll",
|
|
1900
1915
|
items: () => e.items,
|
|
1901
1916
|
itemKey: () => e.itemKey
|
|
1902
1917
|
}), {
|
|
1903
|
-
pulling:
|
|
1918
|
+
pulling: q,
|
|
1904
1919
|
pullDistance: V,
|
|
1905
|
-
pullOffset:
|
|
1906
|
-
pullProgress:
|
|
1907
|
-
refreshMessage:
|
|
1908
|
-
refreshThreshold:
|
|
1909
|
-
handleTouchStart:
|
|
1910
|
-
handleTouchMove:
|
|
1920
|
+
pullOffset: D,
|
|
1921
|
+
pullProgress: w,
|
|
1922
|
+
refreshMessage: k,
|
|
1923
|
+
refreshThreshold: E,
|
|
1924
|
+
handleTouchStart: F,
|
|
1925
|
+
handleTouchMove: W,
|
|
1911
1926
|
handleTouchEnd: ne,
|
|
1912
|
-
handleTouchCancel:
|
|
1927
|
+
handleTouchCancel: Z
|
|
1913
1928
|
} = qe({
|
|
1914
1929
|
enabled: () => e.pullToRefresh,
|
|
1915
1930
|
refreshing: () => e.refreshing,
|
|
1916
1931
|
threshold: () => e.pullRefreshThreshold,
|
|
1917
|
-
onRefresh: () =>
|
|
1932
|
+
onRefresh: () => p("refresh"),
|
|
1918
1933
|
scrollTop: () => typeof window > "u" ? 0 : Math.max(0, window.scrollY)
|
|
1919
|
-
}),
|
|
1934
|
+
}), H = n(() => Math.max(1, e.itemSize)), ae = n(
|
|
1920
1935
|
() => Math.max(1, Math.floor(e.columns))
|
|
1921
|
-
), R = n(() => Math.max(0, e.gap)),
|
|
1922
|
-
() => Math.max(1, e.loadingItemSize ??
|
|
1936
|
+
), R = n(() => Math.max(0, e.gap)), J = n(() => Math.max(0, Math.floor(e.overscan))), Y = n(
|
|
1937
|
+
() => Math.max(1, e.loadingItemSize ?? H.value)
|
|
1938
|
+
), le = n(
|
|
1939
|
+
() => H.value + R.value
|
|
1923
1940
|
), se = n(
|
|
1924
|
-
() =>
|
|
1941
|
+
() => Math.ceil(e.items.length / ae.value)
|
|
1942
|
+
), me = n(() => se.value === 0 ? 0 : se.value * H.value + (se.value - 1) * R.value), de = n(
|
|
1943
|
+
() => me.value + (e.items.length ? R.value : 0)
|
|
1925
1944
|
), ue = n(
|
|
1926
|
-
() =>
|
|
1927
|
-
),
|
|
1928
|
-
() =>
|
|
1929
|
-
),
|
|
1930
|
-
() => y.value + (e.loading ? G.value + (e.items.length ? R.value : 0) : 0)
|
|
1931
|
-
), he = n(
|
|
1932
|
-
() => Math.max(0, r.value - f.value)
|
|
1933
|
-
), ee = n(
|
|
1945
|
+
() => me.value + (e.loading ? Y.value + (e.items.length ? R.value : 0) : 0)
|
|
1946
|
+
), we = n(
|
|
1947
|
+
() => Math.max(0, r.value - m.value)
|
|
1948
|
+
), G = n(
|
|
1934
1949
|
() => Math.max(
|
|
1935
1950
|
0,
|
|
1936
|
-
Math.floor(
|
|
1951
|
+
Math.floor(we.value / le.value) - J.value
|
|
1937
1952
|
)
|
|
1938
|
-
),
|
|
1939
|
-
if (
|
|
1953
|
+
), u = n(() => {
|
|
1954
|
+
if (se.value === 0) return 0;
|
|
1940
1955
|
const _ = Math.max(
|
|
1941
|
-
|
|
1942
|
-
r.value + o.value -
|
|
1943
|
-
),
|
|
1944
|
-
(_ + R.value) /
|
|
1956
|
+
H.value,
|
|
1957
|
+
r.value + o.value - m.value
|
|
1958
|
+
), ee = Math.ceil(
|
|
1959
|
+
(_ + R.value) / le.value
|
|
1945
1960
|
);
|
|
1946
1961
|
return Math.min(
|
|
1947
|
-
|
|
1948
|
-
|
|
1962
|
+
se.value,
|
|
1963
|
+
ee + J.value
|
|
1949
1964
|
);
|
|
1950
|
-
}),
|
|
1951
|
-
() => Math.min(e.items.length,
|
|
1952
|
-
),
|
|
1953
|
-
() => Math.min(e.items.length,
|
|
1954
|
-
),
|
|
1955
|
-
() => e.items.slice(
|
|
1956
|
-
const s =
|
|
1965
|
+
}), d = n(
|
|
1966
|
+
() => Math.min(e.items.length, G.value * ae.value)
|
|
1967
|
+
), z = n(
|
|
1968
|
+
() => Math.min(e.items.length, u.value * ae.value)
|
|
1969
|
+
), Q = n(
|
|
1970
|
+
() => e.items.slice(d.value, z.value).map((_, ee) => {
|
|
1971
|
+
const s = d.value + ee;
|
|
1957
1972
|
return {
|
|
1958
1973
|
item: _,
|
|
1959
1974
|
index: s,
|
|
1960
|
-
key:
|
|
1961
|
-
rowIndex: Math.floor(s /
|
|
1962
|
-
columnIndex: s %
|
|
1975
|
+
key: U(_, s),
|
|
1976
|
+
rowIndex: Math.floor(s / ae.value),
|
|
1977
|
+
columnIndex: s % ae.value
|
|
1963
1978
|
};
|
|
1964
1979
|
})
|
|
1965
|
-
),
|
|
1966
|
-
gridTemplateColumns: `repeat(${
|
|
1980
|
+
), he = n(() => ({
|
|
1981
|
+
gridTemplateColumns: `repeat(${ae.value}, minmax(0, 1fr))`,
|
|
1967
1982
|
columnGap: `${R.value}px`,
|
|
1968
1983
|
rowGap: `${R.value}px`,
|
|
1969
|
-
transform: `translateY(${
|
|
1984
|
+
transform: `translateY(${G.value * le.value}px)`
|
|
1970
1985
|
}));
|
|
1971
|
-
function
|
|
1972
|
-
typeof window > "u" || (r.value = Math.max(0, window.scrollY), o.value = window.innerHeight,
|
|
1973
|
-
}
|
|
1974
|
-
function
|
|
1975
|
-
|
|
1976
|
-
scrollTop:
|
|
1977
|
-
startIndex:
|
|
1978
|
-
endIndex:
|
|
1986
|
+
function y() {
|
|
1987
|
+
typeof window > "u" || (r.value = Math.max(0, window.scrollY), o.value = window.innerHeight, f.value && (m.value = f.value.getBoundingClientRect().top + r.value));
|
|
1988
|
+
}
|
|
1989
|
+
function L() {
|
|
1990
|
+
p("scroll", {
|
|
1991
|
+
scrollTop: we.value,
|
|
1992
|
+
startIndex: d.value,
|
|
1993
|
+
endIndex: z.value
|
|
1979
1994
|
});
|
|
1980
1995
|
}
|
|
1981
1996
|
function B() {
|
|
1982
|
-
|
|
1997
|
+
y(), L(), te();
|
|
1983
1998
|
}
|
|
1984
|
-
function
|
|
1985
|
-
if (typeof window > "u" || !e.hasMore || e.loading ||
|
|
1999
|
+
function te() {
|
|
2000
|
+
if (typeof window > "u" || !e.hasMore || e.loading || O === e.items.length)
|
|
1986
2001
|
return;
|
|
1987
|
-
const _ = Math.max(0, e.loadMoreThreshold),
|
|
1988
|
-
|
|
2002
|
+
const _ = Math.max(0, e.loadMoreThreshold), ee = m.value + ue.value, s = r.value + o.value;
|
|
2003
|
+
ee - s <= _ && (O = e.items.length, p("loadMore"));
|
|
1989
2004
|
}
|
|
1990
|
-
function oe(_,
|
|
2005
|
+
function oe(_, ee = {}) {
|
|
1991
2006
|
if (typeof window > "u") return;
|
|
1992
|
-
|
|
1993
|
-
const s = Math.max(0,
|
|
2007
|
+
y();
|
|
2008
|
+
const s = Math.max(0, ue.value - o.value), t = Math.min(
|
|
1994
2009
|
Math.max(0, Number.isFinite(_) ? _ : 0),
|
|
1995
2010
|
s
|
|
1996
|
-
), a = Math.max(0,
|
|
1997
|
-
|
|
2011
|
+
), a = Math.max(0, m.value + t), g = ee.behavior ?? "auto";
|
|
2012
|
+
g === "auto" && (r.value = a), window.scrollTo({ ...ee, top: a, behavior: g });
|
|
1998
2013
|
}
|
|
1999
|
-
function re(_,
|
|
2014
|
+
function re(_, ee = {}) {
|
|
2000
2015
|
if (typeof window > "u" || e.items.length === 0) return;
|
|
2001
|
-
|
|
2016
|
+
y();
|
|
2002
2017
|
const s = Math.min(
|
|
2003
2018
|
e.items.length - 1,
|
|
2004
2019
|
Math.max(0, Math.floor(_))
|
|
2005
|
-
), t = Math.floor(s /
|
|
2006
|
-
let b =
|
|
2007
|
-
a === "center" ? b -= (o.value -
|
|
2008
|
-
const
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
),
|
|
2012
|
-
|
|
2013
|
-
...
|
|
2014
|
-
top:
|
|
2015
|
-
behavior:
|
|
2020
|
+
), t = Math.floor(s / ae.value), { align: a = "start", ...g } = ee;
|
|
2021
|
+
let b = m.value + t * le.value;
|
|
2022
|
+
a === "center" ? b -= (o.value - H.value) / 2 : a === "end" && (b -= o.value - H.value);
|
|
2023
|
+
const Me = Math.max(
|
|
2024
|
+
m.value,
|
|
2025
|
+
m.value + ue.value - o.value
|
|
2026
|
+
), ge = Math.max(0, Math.min(b, Me)), ve = g.behavior ?? "auto";
|
|
2027
|
+
ve === "auto" && (r.value = ge), window.scrollTo({
|
|
2028
|
+
...g,
|
|
2029
|
+
top: ge,
|
|
2030
|
+
behavior: ve
|
|
2016
2031
|
});
|
|
2017
2032
|
}
|
|
2018
|
-
function
|
|
2019
|
-
typeof window > "u" || (
|
|
2033
|
+
function ye(_ = "auto") {
|
|
2034
|
+
typeof window > "u" || (y(), window.scrollTo({ top: Math.max(0, m.value), behavior: _ }));
|
|
2020
2035
|
}
|
|
2021
2036
|
return ie(
|
|
2022
2037
|
() => [
|
|
@@ -2026,72 +2041,72 @@ const rt = ["aria-label"], ut = ["aria-posinset", "aria-setsize"], et = /* @__PU
|
|
|
2026
2041
|
e.gap
|
|
2027
2042
|
],
|
|
2028
2043
|
async () => {
|
|
2029
|
-
await
|
|
2044
|
+
await C(), y(), te();
|
|
2030
2045
|
}
|
|
2031
2046
|
), ie(
|
|
2032
2047
|
() => [e.hasMore, e.loading],
|
|
2033
2048
|
async ([_]) => {
|
|
2034
|
-
_ || (
|
|
2049
|
+
_ || (O = -1), await C(), y(), te();
|
|
2035
2050
|
}
|
|
2036
|
-
),
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
}),
|
|
2040
|
-
}),
|
|
2041
|
-
window.removeEventListener("scroll", B), window.removeEventListener("resize", B),
|
|
2042
|
-
}),
|
|
2051
|
+
), Ae(() => {
|
|
2052
|
+
y(), window.addEventListener("scroll", B, { passive: !0 }), window.addEventListener("resize", B, { passive: !0 }), typeof ResizeObserver < "u" && (A = new ResizeObserver(() => {
|
|
2053
|
+
y(), te();
|
|
2054
|
+
}), f.value && A.observe(f.value)), C(te);
|
|
2055
|
+
}), Ce(() => {
|
|
2056
|
+
window.removeEventListener("scroll", B), window.removeEventListener("resize", B), A && (A.disconnect(), A = void 0);
|
|
2057
|
+
}), P({
|
|
2043
2058
|
scrollTo: oe,
|
|
2044
2059
|
scrollToIndex: re,
|
|
2045
|
-
scrollToTop:
|
|
2046
|
-
}), (_,
|
|
2060
|
+
scrollToTop: ye
|
|
2061
|
+
}), (_, ee) => (I(), $("div", {
|
|
2047
2062
|
ref_key: "root",
|
|
2048
|
-
ref:
|
|
2049
|
-
class:
|
|
2063
|
+
ref: f,
|
|
2064
|
+
class: Ye(["vue-window-gird-virtual-scroll", { "vue-window-gird-virtual-scroll--pulling": c(q) }]),
|
|
2050
2065
|
role: "list",
|
|
2051
2066
|
"aria-label": l.ariaLabel,
|
|
2052
|
-
onTouchstartPassive:
|
|
2053
|
-
(...s) =>
|
|
2054
|
-
onTouchmove:
|
|
2055
|
-
(...s) =>
|
|
2056
|
-
onTouchend:
|
|
2057
|
-
(...s) =>
|
|
2058
|
-
onTouchcancel:
|
|
2059
|
-
(...s) =>
|
|
2067
|
+
onTouchstartPassive: ee[0] || (ee[0] = //@ts-ignore
|
|
2068
|
+
(...s) => c(F) && c(F)(...s)),
|
|
2069
|
+
onTouchmove: ee[1] || (ee[1] = //@ts-ignore
|
|
2070
|
+
(...s) => c(W) && c(W)(...s)),
|
|
2071
|
+
onTouchend: ee[2] || (ee[2] = //@ts-ignore
|
|
2072
|
+
(...s) => c(ne) && c(ne)(...s)),
|
|
2073
|
+
onTouchcancel: ee[3] || (ee[3] = //@ts-ignore
|
|
2074
|
+
(...s) => c(Z) && c(Z)(...s))
|
|
2060
2075
|
}, [
|
|
2061
2076
|
l.pullToRefresh || l.refreshing ? (I(), $("div", {
|
|
2062
2077
|
key: 0,
|
|
2063
2078
|
class: "vue-window-gird-virtual-scroll__refresh",
|
|
2064
2079
|
style: N({
|
|
2065
|
-
height: `${
|
|
2066
|
-
transform: `translateY(${
|
|
2080
|
+
height: `${c(E)}px`,
|
|
2081
|
+
transform: `translateY(${c(D) - c(E)}px)`
|
|
2067
2082
|
}),
|
|
2068
2083
|
role: "status",
|
|
2069
2084
|
"aria-live": "polite"
|
|
2070
2085
|
}, [
|
|
2071
2086
|
ce(_.$slots, "refresh", {
|
|
2072
|
-
pullDistance:
|
|
2073
|
-
progress:
|
|
2087
|
+
pullDistance: c(V),
|
|
2088
|
+
progress: c(w),
|
|
2074
2089
|
refreshing: l.refreshing
|
|
2075
2090
|
}, () => [
|
|
2076
|
-
Ve(
|
|
2091
|
+
Ve(je(c(k)), 1)
|
|
2077
2092
|
])
|
|
2078
2093
|
], 4)) : ze("", !0),
|
|
2079
2094
|
l.items.length || l.loading ? (I(), $("div", {
|
|
2080
2095
|
key: 1,
|
|
2081
2096
|
class: "vue-window-gird-virtual-scroll__spacer",
|
|
2082
2097
|
style: N({
|
|
2083
|
-
height: `${
|
|
2084
|
-
transform: `translateY(${
|
|
2098
|
+
height: `${ue.value}px`,
|
|
2099
|
+
transform: `translateY(${c(D)}px)`
|
|
2085
2100
|
})
|
|
2086
2101
|
}, [
|
|
2087
|
-
|
|
2102
|
+
Ge("div", {
|
|
2088
2103
|
class: "vue-window-gird-virtual-scroll__content",
|
|
2089
|
-
style: N(
|
|
2104
|
+
style: N(he.value)
|
|
2090
2105
|
}, [
|
|
2091
|
-
(I(!0), $(
|
|
2106
|
+
(I(!0), $(Re, null, De(Q.value, ({ item: s, index: t, key: a, rowIndex: g, columnIndex: b }) => (I(), $("div", {
|
|
2092
2107
|
key: a,
|
|
2093
2108
|
class: "vue-window-gird-virtual-scroll__item",
|
|
2094
|
-
style: N({ height: `${
|
|
2109
|
+
style: N({ height: `${H.value}px` }),
|
|
2095
2110
|
role: "listitem",
|
|
2096
2111
|
"aria-posinset": t + 1,
|
|
2097
2112
|
"aria-setsize": l.items.length
|
|
@@ -2099,55 +2114,55 @@ const rt = ["aria-label"], ut = ["aria-posinset", "aria-setsize"], et = /* @__PU
|
|
|
2099
2114
|
ce(_.$slots, "default", {
|
|
2100
2115
|
item: s,
|
|
2101
2116
|
index: t,
|
|
2102
|
-
rowIndex:
|
|
2117
|
+
rowIndex: g,
|
|
2103
2118
|
columnIndex: b
|
|
2104
2119
|
})
|
|
2105
|
-
], 12,
|
|
2120
|
+
], 12, Vt))), 128))
|
|
2106
2121
|
], 4),
|
|
2107
2122
|
l.loading ? (I(), $("div", {
|
|
2108
2123
|
key: 0,
|
|
2109
2124
|
class: "vue-window-gird-virtual-scroll__loading",
|
|
2110
2125
|
style: N({
|
|
2111
|
-
height: `${
|
|
2112
|
-
transform: `translateY(${
|
|
2126
|
+
height: `${Y.value}px`,
|
|
2127
|
+
transform: `translateY(${de.value}px)`
|
|
2113
2128
|
}),
|
|
2114
2129
|
role: "status",
|
|
2115
2130
|
"aria-live": "polite"
|
|
2116
2131
|
}, [
|
|
2117
2132
|
ce(_.$slots, "loading", {}, () => [
|
|
2118
|
-
|
|
2133
|
+
ee[4] || (ee[4] = Ve("Loading more…", -1))
|
|
2119
2134
|
])
|
|
2120
2135
|
], 4)) : ze("", !0)
|
|
2121
2136
|
], 4)) : (I(), $("div", {
|
|
2122
2137
|
key: 2,
|
|
2123
2138
|
class: "vue-window-gird-virtual-scroll__empty",
|
|
2124
|
-
style: N({ transform: `translateY(${
|
|
2139
|
+
style: N({ transform: `translateY(${c(D)}px)` })
|
|
2125
2140
|
}, [
|
|
2126
2141
|
ce(_.$slots, "empty")
|
|
2127
2142
|
], 4))
|
|
2128
|
-
], 42,
|
|
2143
|
+
], 42, Bt));
|
|
2129
2144
|
}
|
|
2130
|
-
}),
|
|
2145
|
+
}), Rt = et, Kt = {
|
|
2131
2146
|
install(l) {
|
|
2132
|
-
l.component("ChatVirtualScroll", st), l.component("DynamicVirtualScroll", et), l.component("ShortMediaFeed",
|
|
2147
|
+
l.component("ChatVirtualScroll", st), l.component("DynamicVirtualScroll", et), l.component("ShortMediaFeed", mt), l.component("SkeletonLoader", Mt), l.component("VirtualCarousel", St), l.component("VirtualList", Rt), l.component("VirtualScroll", $t), l.component(
|
|
2133
2148
|
"WindowDynamicVirtualScroll",
|
|
2134
|
-
|
|
2149
|
+
Lt
|
|
2135
2150
|
), l.component(
|
|
2136
2151
|
"WindowGirdVirtualScroll",
|
|
2137
|
-
|
|
2152
|
+
Ht
|
|
2138
2153
|
);
|
|
2139
2154
|
}
|
|
2140
2155
|
};
|
|
2141
2156
|
export {
|
|
2142
2157
|
st as ChatVirtualScroll,
|
|
2143
2158
|
et as DynamicVirtualScroll,
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2159
|
+
mt as ShortMediaFeed,
|
|
2160
|
+
Mt as SkeletonLoader,
|
|
2161
|
+
St as VirtualCarousel,
|
|
2162
|
+
Rt as VirtualList,
|
|
2163
|
+
$t as VirtualScroll,
|
|
2164
|
+
Kt as VueVirtualScroll,
|
|
2165
|
+
Lt as WindowDynamicVirtualScroll,
|
|
2166
|
+
Ht as WindowGirdVirtualScroll,
|
|
2167
|
+
Kt as default
|
|
2153
2168
|
};
|