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