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