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