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