react-window 2.4.1 → 2.5.1
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 +44 -0
- package/dist/react-window.cjs +1 -1
- package/dist/react-window.cjs.map +1 -1
- package/dist/react-window.d.ts +209 -6
- package/dist/react-window.js +1181 -799
- package/dist/react-window.js.map +1 -1
- package/package.json +4 -4
package/dist/react-window.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { useLayoutEffect as
|
|
4
|
-
const
|
|
5
|
-
function
|
|
2
|
+
import { jsx as ue } from "react/jsx-runtime";
|
|
3
|
+
import { useLayoutEffect as _e, useEffect as le, useState as C, useSyncExternalStore as Be, useMemo as q, useRef as P, useCallback as X, memo as Le, useImperativeHandle as Me, createElement as he, Fragment as be } from "react";
|
|
4
|
+
const B = typeof window < "u" ? _e : le;
|
|
5
|
+
function Ae(e) {
|
|
6
6
|
let t = e;
|
|
7
7
|
for (; t; ) {
|
|
8
8
|
if (t.dir)
|
|
@@ -11,30 +11,30 @@ function we(e) {
|
|
|
11
11
|
}
|
|
12
12
|
return !1;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
15
|
-
const [
|
|
16
|
-
return
|
|
17
|
-
t ? o(t === "rtl") : e && o(
|
|
18
|
-
}, [t, e]),
|
|
14
|
+
function Ee(e, t) {
|
|
15
|
+
const [r, o] = C(t === "rtl");
|
|
16
|
+
return B(() => {
|
|
17
|
+
t ? o(t === "rtl") : e && o(Ae(e));
|
|
18
|
+
}, [t, e]), r;
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function Pe() {
|
|
21
21
|
return () => {
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
-
function
|
|
25
|
-
return
|
|
26
|
-
|
|
24
|
+
function We() {
|
|
25
|
+
return Be(
|
|
26
|
+
Pe,
|
|
27
27
|
() => !1,
|
|
28
28
|
() => !0
|
|
29
29
|
);
|
|
30
30
|
}
|
|
31
|
-
function
|
|
31
|
+
function Z(e) {
|
|
32
32
|
return e?.ownerDocument.defaultView ?? window;
|
|
33
33
|
}
|
|
34
|
-
function
|
|
35
|
-
return
|
|
34
|
+
function we(e) {
|
|
35
|
+
return Z(e).ResizeObserver ?? (typeof ResizeObserver < "u" ? ResizeObserver : void 0);
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function me(e) {
|
|
38
38
|
if (e !== void 0)
|
|
39
39
|
switch (typeof e) {
|
|
40
40
|
case "number":
|
|
@@ -46,172 +46,258 @@ function de(e) {
|
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
function
|
|
49
|
+
function De({
|
|
50
50
|
box: e,
|
|
51
51
|
defaultHeight: t,
|
|
52
|
-
defaultWidth:
|
|
52
|
+
defaultWidth: r,
|
|
53
53
|
disabled: o,
|
|
54
|
-
element:
|
|
55
|
-
mode:
|
|
56
|
-
style:
|
|
54
|
+
element: s,
|
|
55
|
+
mode: i,
|
|
56
|
+
style: n
|
|
57
57
|
}) {
|
|
58
|
-
const { styleHeight:
|
|
58
|
+
const { styleHeight: d, styleWidth: v } = q(
|
|
59
59
|
() => ({
|
|
60
|
-
styleHeight:
|
|
61
|
-
styleWidth:
|
|
60
|
+
styleHeight: me(n?.height),
|
|
61
|
+
styleWidth: me(n?.width)
|
|
62
62
|
}),
|
|
63
|
-
[
|
|
64
|
-
), [
|
|
63
|
+
[n?.height, n?.width]
|
|
64
|
+
), [h, f] = C({
|
|
65
65
|
height: t,
|
|
66
|
-
width:
|
|
67
|
-
}),
|
|
68
|
-
return
|
|
69
|
-
if (
|
|
66
|
+
width: r
|
|
67
|
+
}), u = o || i === "only-height" && d !== void 0 || i === "only-width" && v !== void 0 || d !== void 0 && v !== void 0;
|
|
68
|
+
return B(() => {
|
|
69
|
+
if (s === null || u)
|
|
70
70
|
return;
|
|
71
|
-
const
|
|
72
|
-
if (!
|
|
71
|
+
const a = we(s);
|
|
72
|
+
if (!a)
|
|
73
73
|
return;
|
|
74
|
-
const
|
|
75
|
-
for (const
|
|
76
|
-
const { contentRect:
|
|
77
|
-
|
|
78
|
-
height:
|
|
79
|
-
width:
|
|
74
|
+
const c = new a((l) => {
|
|
75
|
+
for (const p of l) {
|
|
76
|
+
const { contentRect: b, target: S } = p;
|
|
77
|
+
s === S && f((w) => w.height === b.height && w.width === b.width ? w : {
|
|
78
|
+
height: b.height,
|
|
79
|
+
width: b.width
|
|
80
80
|
});
|
|
81
81
|
}
|
|
82
82
|
});
|
|
83
|
-
return
|
|
84
|
-
|
|
83
|
+
return c.observe(s, { box: e }), () => {
|
|
84
|
+
c?.unobserve(s);
|
|
85
85
|
};
|
|
86
|
-
}, [e,
|
|
86
|
+
}, [e, u, s, d, v]), q(
|
|
87
87
|
() => ({
|
|
88
|
-
height:
|
|
89
|
-
width:
|
|
88
|
+
height: d ?? h.height,
|
|
89
|
+
width: v ?? h.width
|
|
90
90
|
}),
|
|
91
|
-
[
|
|
91
|
+
[h, d, v]
|
|
92
92
|
);
|
|
93
93
|
}
|
|
94
|
-
function
|
|
95
|
-
const t =
|
|
94
|
+
function ie(e) {
|
|
95
|
+
const t = P(() => {
|
|
96
96
|
throw new Error("Cannot call an event handler while rendering.");
|
|
97
97
|
});
|
|
98
|
-
return
|
|
98
|
+
return B(() => {
|
|
99
99
|
t.current = e;
|
|
100
|
-
}, [e]),
|
|
100
|
+
}, [e]), X((...r) => t.current?.(...r), [t]);
|
|
101
101
|
}
|
|
102
|
-
const
|
|
103
|
-
function
|
|
104
|
-
let
|
|
105
|
-
if (
|
|
106
|
-
const o = t.createElement("div"),
|
|
107
|
-
|
|
108
|
-
const
|
|
109
|
-
|
|
102
|
+
const xe = /* @__PURE__ */ new WeakMap();
|
|
103
|
+
function Ue(e = !1, t = document) {
|
|
104
|
+
let r = xe.get(t);
|
|
105
|
+
if (r === void 0 || e) {
|
|
106
|
+
const o = t.createElement("div"), s = o.style;
|
|
107
|
+
s.width = "50px", s.height = "50px", s.overflow = "scroll", s.direction = "rtl";
|
|
108
|
+
const i = t.createElement("div"), n = i.style;
|
|
109
|
+
n.width = "100px", n.height = "100px", o.appendChild(i), t.body.appendChild(o), o.scrollLeft > 0 ? r = "positive-descending" : (o.scrollLeft = 1, o.scrollLeft === 0 ? r = "negative" : r = "positive-ascending"), t.body.removeChild(o), xe.set(t, r);
|
|
110
110
|
}
|
|
111
|
-
return
|
|
111
|
+
return r;
|
|
112
112
|
}
|
|
113
|
-
function
|
|
113
|
+
function ne({
|
|
114
114
|
containerElement: e,
|
|
115
115
|
direction: t,
|
|
116
|
-
isRtl:
|
|
116
|
+
isRtl: r,
|
|
117
117
|
scrollOffset: o
|
|
118
118
|
}) {
|
|
119
|
-
if (t === "horizontal" &&
|
|
120
|
-
switch (
|
|
119
|
+
if (t === "horizontal" && r)
|
|
120
|
+
switch (Ue(!1, e?.ownerDocument ?? document)) {
|
|
121
121
|
case "negative":
|
|
122
122
|
return -o;
|
|
123
123
|
case "positive-descending": {
|
|
124
124
|
if (e) {
|
|
125
|
-
const { clientWidth:
|
|
126
|
-
return
|
|
125
|
+
const { clientWidth: s, scrollWidth: i } = e;
|
|
126
|
+
return i - s - o;
|
|
127
127
|
}
|
|
128
128
|
break;
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
return o;
|
|
132
132
|
}
|
|
133
|
-
function
|
|
133
|
+
function Ce({
|
|
134
|
+
container: e,
|
|
135
|
+
element: t,
|
|
136
|
+
onChange: r
|
|
137
|
+
}) {
|
|
138
|
+
const o = Z(t), s = we(t), i = o.MutationObserver ?? (typeof MutationObserver < "u" ? MutationObserver : void 0), n = s ? new s(r) : void 0, d = (u) => !u.isConnected || (u.compareDocumentPosition(t) & Node.DOCUMENT_POSITION_FOLLOWING) !== 0, v = i ? new i((u) => {
|
|
139
|
+
u.some(
|
|
140
|
+
(c) => Array.from(c.addedNodes).some(d) || // Removed nodes preceded the element if the node after them still does (or contains the element)
|
|
141
|
+
c.removedNodes.length > 0 && c.nextSibling !== null && d(c.nextSibling)
|
|
142
|
+
) && (f(), r());
|
|
143
|
+
}) : void 0, h = /* @__PURE__ */ new Set(), f = () => {
|
|
144
|
+
for (const a of h)
|
|
145
|
+
n?.unobserve(a);
|
|
146
|
+
h.clear(), v?.disconnect();
|
|
147
|
+
let u = t;
|
|
148
|
+
for (; u !== e; ) {
|
|
149
|
+
const a = u.parentElement;
|
|
150
|
+
if (a === null)
|
|
151
|
+
break;
|
|
152
|
+
if (n)
|
|
153
|
+
for (let c = u.previousElementSibling; c !== null; c = c.previousElementSibling)
|
|
154
|
+
h.add(c), n.observe(c);
|
|
155
|
+
v?.observe(a, { childList: !0 }), u = a;
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
return f(), () => {
|
|
159
|
+
n?.disconnect(), v?.disconnect();
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
function ce(e) {
|
|
163
|
+
return e.window === e;
|
|
164
|
+
}
|
|
165
|
+
function $e(e, t) {
|
|
166
|
+
return t === "window" ? e ? Z(e) : null : t ?? null;
|
|
167
|
+
}
|
|
168
|
+
function de(e, t) {
|
|
169
|
+
return ce(e) ? t === "vertical" ? e.scrollY : e.scrollX : t === "vertical" ? e.scrollTop : e.scrollLeft;
|
|
170
|
+
}
|
|
171
|
+
function je(e, t) {
|
|
172
|
+
const r = ce(e) ? e.document.scrollingElement ?? e.document.documentElement : e;
|
|
173
|
+
return t === "vertical" ? r.scrollHeight - r.clientHeight : r.scrollWidth - r.clientWidth;
|
|
174
|
+
}
|
|
175
|
+
function ae(e, t) {
|
|
176
|
+
e && typeof e.scrollTo == "function" && e.scrollTo(t);
|
|
177
|
+
}
|
|
178
|
+
function qe(e, t) {
|
|
179
|
+
const { overflowX: r, overflowY: o } = Z(e).getComputedStyle(e), s = t === "vertical" ? o : r;
|
|
180
|
+
return s === "visible" || s === "clip" ? !1 : t === "vertical" ? e.scrollHeight - e.clientHeight > 1 : e.scrollWidth - e.clientWidth > 1;
|
|
181
|
+
}
|
|
182
|
+
function Oe({
|
|
183
|
+
containerElement: e,
|
|
184
|
+
direction: t,
|
|
185
|
+
isRtl: r,
|
|
186
|
+
scrollTarget: o
|
|
187
|
+
}) {
|
|
188
|
+
const s = t === "vertical";
|
|
189
|
+
let i, n;
|
|
190
|
+
if (ce(o)) {
|
|
191
|
+
const { documentElement: w } = o.document;
|
|
192
|
+
i = 0, n = s ? w.clientHeight : w.clientWidth;
|
|
193
|
+
} else {
|
|
194
|
+
const w = o.getBoundingClientRect();
|
|
195
|
+
i = s ? w.top + o.clientTop : w.left + o.clientLeft, n = s ? o.clientHeight : o.clientWidth;
|
|
196
|
+
}
|
|
197
|
+
const d = i + n, v = e.getBoundingClientRect(), h = s ? v.top + e.clientTop : v.left + e.clientLeft, f = s ? e.clientHeight : e.clientWidth, u = h + f, a = ne({
|
|
198
|
+
containerElement: e,
|
|
199
|
+
direction: t,
|
|
200
|
+
isRtl: r,
|
|
201
|
+
scrollOffset: s ? e.scrollTop : e.scrollLeft
|
|
202
|
+
}), l = !s && r ? u - d : i - h, p = l + n, b = Math.max(0, l), S = Math.min(f, p);
|
|
203
|
+
return {
|
|
204
|
+
offset: a + b,
|
|
205
|
+
size: Math.max(0, S - b),
|
|
206
|
+
viewportOffset: a + l,
|
|
207
|
+
viewportSize: n
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
function Ie({
|
|
211
|
+
direction: e,
|
|
212
|
+
isRtl: t,
|
|
213
|
+
scrollTarget: r,
|
|
214
|
+
viewportSize: o
|
|
215
|
+
}) {
|
|
216
|
+
const s = ce(r) ? r.document.documentElement : r, i = Z(s).getComputedStyle(s), n = (h) => {
|
|
217
|
+
const f = parseFloat(h ?? "");
|
|
218
|
+
return !Number.isFinite(f) || f < 0 ? 0 : h.endsWith("px") ? f : h.endsWith("%") ? f * o / 100 : 0;
|
|
219
|
+
};
|
|
220
|
+
if (e === "vertical")
|
|
221
|
+
return {
|
|
222
|
+
end: n(i.scrollPaddingBottom),
|
|
223
|
+
start: n(i.scrollPaddingTop)
|
|
224
|
+
};
|
|
225
|
+
const d = n(i.scrollPaddingLeft), v = n(i.scrollPaddingRight);
|
|
226
|
+
return t ? { end: d, start: v } : { end: v, start: d };
|
|
227
|
+
}
|
|
228
|
+
function Y(e, t = "Assertion error") {
|
|
134
229
|
if (!e)
|
|
135
230
|
throw console.error(t), Error(t);
|
|
136
231
|
}
|
|
137
|
-
function
|
|
232
|
+
function se(e, t) {
|
|
138
233
|
if (e === t)
|
|
139
234
|
return !0;
|
|
140
|
-
if (!!e != !!t || (
|
|
235
|
+
if (!!e != !!t || (Y(e !== void 0), Y(t !== void 0), Object.keys(e).length !== Object.keys(t).length))
|
|
141
236
|
return !1;
|
|
142
|
-
for (const
|
|
143
|
-
if (!Object.hasOwn(t,
|
|
237
|
+
for (const r in e)
|
|
238
|
+
if (!Object.hasOwn(t, r) || !Object.is(t[r], e[r]))
|
|
144
239
|
return !1;
|
|
145
240
|
return !0;
|
|
146
241
|
}
|
|
147
|
-
function
|
|
242
|
+
function Ve({
|
|
148
243
|
cachedBounds: e,
|
|
149
244
|
itemCount: t,
|
|
150
|
-
itemSize:
|
|
245
|
+
itemSize: r
|
|
151
246
|
}) {
|
|
152
247
|
if (t === 0)
|
|
153
248
|
return 0;
|
|
154
|
-
if (typeof
|
|
155
|
-
return t *
|
|
249
|
+
if (typeof r == "number")
|
|
250
|
+
return t * r;
|
|
156
251
|
{
|
|
157
252
|
const o = e.get(
|
|
158
253
|
e.size === 0 ? 0 : e.size - 1
|
|
159
254
|
);
|
|
160
|
-
|
|
161
|
-
const
|
|
162
|
-
return t *
|
|
255
|
+
Y(o !== void 0, "Unexpected bounds cache miss");
|
|
256
|
+
const s = (o.scrollOffset + o.size) / e.size;
|
|
257
|
+
return t * s;
|
|
163
258
|
}
|
|
164
259
|
}
|
|
165
|
-
function
|
|
260
|
+
function Se({
|
|
166
261
|
align: e,
|
|
167
262
|
cachedBounds: t,
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
263
|
+
clamp: r = !0,
|
|
264
|
+
index: o,
|
|
265
|
+
itemCount: s,
|
|
266
|
+
itemSize: i,
|
|
171
267
|
containerScrollOffset: n,
|
|
172
|
-
containerSize:
|
|
268
|
+
containerSize: d
|
|
173
269
|
}) {
|
|
174
|
-
if (
|
|
175
|
-
throw RangeError(`Invalid index specified: ${
|
|
176
|
-
cause: `Index ${
|
|
270
|
+
if (o < 0 || o >= s)
|
|
271
|
+
throw RangeError(`Invalid index specified: ${o}`, {
|
|
272
|
+
cause: `Index ${o} is not within the range of 0 - ${s - 1}`
|
|
177
273
|
});
|
|
178
|
-
const
|
|
274
|
+
const v = t.get(o), h = Ve({
|
|
179
275
|
cachedBounds: t,
|
|
180
|
-
itemCount:
|
|
181
|
-
itemSize:
|
|
182
|
-
}), v = Math.max(
|
|
183
|
-
0,
|
|
184
|
-
Math.min(a - i, l.scrollOffset)
|
|
185
|
-
), f = Math.max(
|
|
186
|
-
0,
|
|
187
|
-
l.scrollOffset - i + l.size
|
|
188
|
-
), c = l.size > i ? n >= l.scrollOffset && n <= f : n >= f && n <= l.scrollOffset;
|
|
276
|
+
itemCount: s,
|
|
277
|
+
itemSize: i
|
|
278
|
+
}), f = (l) => r ? Math.max(0, Math.min(h - d, l)) : l, u = f(v.scrollOffset), a = r ? Math.max(0, v.scrollOffset - d + v.size) : v.scrollOffset - d + v.size, c = v.size > d ? n >= v.scrollOffset && n <= a : n >= a && n <= v.scrollOffset;
|
|
189
279
|
switch (e === "smart" && (e = c ? "auto" : "center"), e) {
|
|
190
280
|
case "start":
|
|
191
|
-
return
|
|
281
|
+
return u;
|
|
192
282
|
case "end":
|
|
193
|
-
return
|
|
283
|
+
return a;
|
|
194
284
|
case "center":
|
|
195
|
-
return
|
|
196
|
-
|
|
197
|
-
Math.min(
|
|
198
|
-
a - i,
|
|
199
|
-
l.scrollOffset + l.size / 2 - i / 2
|
|
200
|
-
)
|
|
285
|
+
return f(
|
|
286
|
+
v.scrollOffset + v.size / 2 - d / 2
|
|
201
287
|
);
|
|
202
288
|
case "auto":
|
|
203
289
|
default:
|
|
204
|
-
return c ? n : n <
|
|
290
|
+
return c ? n : n < a ? a : u;
|
|
205
291
|
}
|
|
206
292
|
}
|
|
207
|
-
function
|
|
293
|
+
function fe({
|
|
208
294
|
cachedBounds: e,
|
|
209
295
|
containerScrollOffset: t,
|
|
210
|
-
containerSize:
|
|
296
|
+
containerSize: r,
|
|
211
297
|
itemCount: o,
|
|
212
|
-
overscanCount:
|
|
298
|
+
overscanCount: s
|
|
213
299
|
}) {
|
|
214
|
-
const
|
|
300
|
+
const i = o - 1;
|
|
215
301
|
if (o === 0)
|
|
216
302
|
return {
|
|
217
303
|
startIndexVisible: 0,
|
|
@@ -219,1027 +305,1323 @@ function ce({
|
|
|
219
305
|
startIndexOverscan: 0,
|
|
220
306
|
stopIndexOverscan: -1
|
|
221
307
|
};
|
|
222
|
-
let
|
|
223
|
-
const { itemSize:
|
|
224
|
-
if (
|
|
225
|
-
|
|
308
|
+
let n, d;
|
|
309
|
+
const { itemSize: v } = e;
|
|
310
|
+
if (v !== void 0)
|
|
311
|
+
v > 0 ? (n = Math.max(
|
|
226
312
|
0,
|
|
227
|
-
Math.min(
|
|
228
|
-
),
|
|
229
|
-
|
|
313
|
+
Math.min(i, Math.floor(t / v))
|
|
314
|
+
), d = Math.max(
|
|
315
|
+
n,
|
|
230
316
|
Math.min(
|
|
231
|
-
|
|
232
|
-
Math.ceil((t +
|
|
317
|
+
i,
|
|
318
|
+
Math.ceil((t + r) / v) - 1
|
|
233
319
|
)
|
|
234
|
-
)) : (
|
|
320
|
+
)) : (n = 0, d = 0);
|
|
235
321
|
else {
|
|
236
|
-
let
|
|
237
|
-
for (;
|
|
238
|
-
const
|
|
239
|
-
|
|
322
|
+
let h = 0, f = Math.min(i, Math.max(0, e.size - 1));
|
|
323
|
+
for (; h < f; ) {
|
|
324
|
+
const u = Math.floor((h + f) / 2), a = e.get(u);
|
|
325
|
+
a.scrollOffset + a.size > t ? f = u : h = u + 1;
|
|
240
326
|
}
|
|
241
|
-
for (;
|
|
242
|
-
const
|
|
243
|
-
if (
|
|
244
|
-
|
|
327
|
+
for (; h < i; ) {
|
|
328
|
+
const u = e.get(h);
|
|
329
|
+
if (u.scrollOffset + u.size > t) break;
|
|
330
|
+
h++;
|
|
245
331
|
}
|
|
246
|
-
for (
|
|
247
|
-
const
|
|
248
|
-
if (
|
|
332
|
+
for (n = h, d = h; d < i; ) {
|
|
333
|
+
const u = e.get(d);
|
|
334
|
+
if (u.scrollOffset + u.size >= t + r)
|
|
249
335
|
break;
|
|
250
|
-
|
|
336
|
+
d++;
|
|
251
337
|
}
|
|
252
338
|
}
|
|
253
339
|
return {
|
|
254
|
-
startIndexVisible:
|
|
255
|
-
stopIndexVisible:
|
|
256
|
-
startIndexOverscan: Math.max(0,
|
|
257
|
-
stopIndexOverscan: Math.min(
|
|
340
|
+
startIndexVisible: n,
|
|
341
|
+
stopIndexVisible: d,
|
|
342
|
+
startIndexOverscan: Math.max(0, n - s),
|
|
343
|
+
stopIndexOverscan: Math.min(i, d + s)
|
|
258
344
|
};
|
|
259
345
|
}
|
|
260
|
-
function
|
|
346
|
+
function Ge({
|
|
261
347
|
itemCount: e,
|
|
262
348
|
itemProps: t,
|
|
263
|
-
itemSize:
|
|
349
|
+
itemSize: r
|
|
264
350
|
}) {
|
|
265
351
|
const o = /* @__PURE__ */ new Map();
|
|
266
352
|
return {
|
|
267
|
-
itemSize: typeof
|
|
268
|
-
get(
|
|
269
|
-
if (
|
|
270
|
-
return
|
|
271
|
-
for (; o.size - 1 <
|
|
272
|
-
const
|
|
273
|
-
if (
|
|
274
|
-
o.set(
|
|
275
|
-
size:
|
|
353
|
+
itemSize: typeof r == "number" ? r : void 0,
|
|
354
|
+
get(s) {
|
|
355
|
+
if (Y(s < e, `Invalid index ${s}`), typeof r == "number")
|
|
356
|
+
return Y(s >= 0, `Invalid index ${s}`), { size: r, scrollOffset: s * r };
|
|
357
|
+
for (; o.size - 1 < s; ) {
|
|
358
|
+
const n = o.size, d = r(n, t);
|
|
359
|
+
if (n === 0)
|
|
360
|
+
o.set(n, {
|
|
361
|
+
size: d,
|
|
276
362
|
scrollOffset: 0
|
|
277
363
|
});
|
|
278
364
|
else {
|
|
279
|
-
const
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
`Unexpected bounds cache miss for index ${
|
|
283
|
-
), o.set(
|
|
284
|
-
scrollOffset:
|
|
285
|
-
size:
|
|
365
|
+
const v = o.get(n - 1);
|
|
366
|
+
Y(
|
|
367
|
+
v !== void 0,
|
|
368
|
+
`Unexpected bounds cache miss for index ${s}`
|
|
369
|
+
), o.set(n, {
|
|
370
|
+
scrollOffset: v.scrollOffset + v.size,
|
|
371
|
+
size: d
|
|
286
372
|
});
|
|
287
373
|
}
|
|
288
374
|
}
|
|
289
|
-
const
|
|
290
|
-
return
|
|
291
|
-
|
|
292
|
-
`Unexpected bounds cache miss for index ${
|
|
293
|
-
),
|
|
375
|
+
const i = o.get(s);
|
|
376
|
+
return Y(
|
|
377
|
+
i !== void 0,
|
|
378
|
+
`Unexpected bounds cache miss for index ${s}`
|
|
379
|
+
), i;
|
|
294
380
|
},
|
|
295
|
-
set(
|
|
296
|
-
o.set(
|
|
381
|
+
set(s, i) {
|
|
382
|
+
o.set(s, i);
|
|
297
383
|
},
|
|
298
384
|
get size() {
|
|
299
385
|
return o.size;
|
|
300
386
|
}
|
|
301
387
|
};
|
|
302
388
|
}
|
|
303
|
-
function
|
|
389
|
+
function Xe({
|
|
304
390
|
itemCount: e,
|
|
305
391
|
itemProps: t,
|
|
306
|
-
itemSize:
|
|
392
|
+
itemSize: r
|
|
307
393
|
}) {
|
|
308
|
-
return
|
|
309
|
-
() =>
|
|
394
|
+
return q(
|
|
395
|
+
() => Ge({
|
|
310
396
|
itemCount: e,
|
|
311
397
|
itemProps: t,
|
|
312
|
-
itemSize:
|
|
398
|
+
itemSize: r
|
|
313
399
|
}),
|
|
314
|
-
[e, t,
|
|
400
|
+
[e, t, r]
|
|
315
401
|
);
|
|
316
402
|
}
|
|
317
|
-
function
|
|
403
|
+
function Ye({
|
|
318
404
|
containerSize: e,
|
|
319
405
|
itemSize: t
|
|
320
406
|
}) {
|
|
321
|
-
let
|
|
407
|
+
let r;
|
|
322
408
|
switch (typeof t) {
|
|
323
409
|
case "string": {
|
|
324
|
-
|
|
410
|
+
Y(
|
|
325
411
|
t.endsWith("%"),
|
|
326
412
|
`Invalid item size: "${t}"; string values must be percentages (e.g. "100%")`
|
|
327
|
-
),
|
|
413
|
+
), Y(
|
|
328
414
|
e !== void 0,
|
|
329
415
|
"Container size must be defined if a percentage item size is specified"
|
|
330
|
-
),
|
|
416
|
+
), r = e * parseFloat(t) / 100;
|
|
331
417
|
break;
|
|
332
418
|
}
|
|
333
419
|
default: {
|
|
334
|
-
|
|
420
|
+
r = t;
|
|
335
421
|
break;
|
|
336
422
|
}
|
|
337
423
|
}
|
|
338
|
-
return typeof
|
|
424
|
+
return typeof r == "number" && !(Number.isFinite(r) && r > 0) && (r = 0), r;
|
|
339
425
|
}
|
|
340
|
-
function
|
|
426
|
+
function pe({
|
|
341
427
|
containerElement: e,
|
|
342
428
|
containerStyle: t,
|
|
343
|
-
defaultContainerSize:
|
|
429
|
+
defaultContainerSize: r = 0,
|
|
344
430
|
defaultScrollOffset: o = 0,
|
|
345
|
-
direction:
|
|
346
|
-
isRtl:
|
|
347
|
-
itemCount:
|
|
348
|
-
itemProps:
|
|
349
|
-
itemSize:
|
|
350
|
-
onResize:
|
|
351
|
-
overscanCount: f
|
|
431
|
+
direction: s,
|
|
432
|
+
isRtl: i = !1,
|
|
433
|
+
itemCount: n,
|
|
434
|
+
itemProps: d,
|
|
435
|
+
itemSize: v,
|
|
436
|
+
onResize: h,
|
|
437
|
+
overscanCount: f,
|
|
438
|
+
scrollElement: u
|
|
352
439
|
}) {
|
|
353
|
-
const { height:
|
|
354
|
-
defaultHeight:
|
|
355
|
-
defaultWidth:
|
|
440
|
+
const a = u !== void 0, c = a ? $e(e, u) : e, { height: l = r, width: p = r } = De({
|
|
441
|
+
defaultHeight: s === "vertical" ? r : void 0,
|
|
442
|
+
defaultWidth: s === "horizontal" ? r : void 0,
|
|
356
443
|
element: e,
|
|
357
|
-
mode:
|
|
444
|
+
mode: s === "vertical" ? "only-height" : "only-width",
|
|
358
445
|
style: t
|
|
359
|
-
}),
|
|
446
|
+
}), b = P({
|
|
360
447
|
height: 0,
|
|
361
448
|
width: 0
|
|
362
|
-
}),
|
|
363
|
-
|
|
364
|
-
if (typeof
|
|
365
|
-
const
|
|
366
|
-
(
|
|
449
|
+
}), [S, w] = C(r), m = a ? S : s === "vertical" ? l : p, T = Ye({ containerSize: m, itemSize: v });
|
|
450
|
+
B(() => {
|
|
451
|
+
if (typeof h == "function") {
|
|
452
|
+
const z = b.current;
|
|
453
|
+
(z.height !== l || z.width !== p) && (h({ height: l, width: p }, { ...z }), z.height = l, z.width = p);
|
|
367
454
|
}
|
|
368
|
-
}, [
|
|
369
|
-
const
|
|
370
|
-
itemCount:
|
|
371
|
-
itemProps:
|
|
372
|
-
itemSize:
|
|
373
|
-
}),
|
|
374
|
-
() =>
|
|
375
|
-
),
|
|
376
|
-
(
|
|
377
|
-
[
|
|
378
|
-
), [
|
|
379
|
-
() =>
|
|
380
|
-
cachedBounds:
|
|
381
|
-
containerScrollOffset:
|
|
382
|
-
containerSize:
|
|
383
|
-
itemCount:
|
|
455
|
+
}, [l, h, p]);
|
|
456
|
+
const g = Xe({
|
|
457
|
+
itemCount: n,
|
|
458
|
+
itemProps: d,
|
|
459
|
+
itemSize: T
|
|
460
|
+
}), J = We(), [k] = C(
|
|
461
|
+
() => J || a ? 0 : o
|
|
462
|
+
), E = X(
|
|
463
|
+
(z) => g.get(z),
|
|
464
|
+
[g]
|
|
465
|
+
), [L, $] = C(
|
|
466
|
+
() => fe({
|
|
467
|
+
cachedBounds: g,
|
|
468
|
+
containerScrollOffset: k,
|
|
469
|
+
containerSize: m,
|
|
470
|
+
itemCount: n,
|
|
384
471
|
overscanCount: f
|
|
385
472
|
})
|
|
386
473
|
), {
|
|
387
|
-
startIndexVisible:
|
|
388
|
-
startIndexOverscan:
|
|
389
|
-
stopIndexVisible:
|
|
390
|
-
stopIndexOverscan:
|
|
474
|
+
startIndexVisible: _,
|
|
475
|
+
startIndexOverscan: Q,
|
|
476
|
+
stopIndexVisible: te,
|
|
477
|
+
stopIndexOverscan: R
|
|
391
478
|
} = {
|
|
392
|
-
startIndexVisible: Math.min(
|
|
393
|
-
startIndexOverscan: Math.min(
|
|
394
|
-
stopIndexVisible: Math.min(
|
|
395
|
-
stopIndexOverscan: Math.min(
|
|
396
|
-
},
|
|
397
|
-
() =>
|
|
398
|
-
cachedBounds:
|
|
399
|
-
itemCount:
|
|
400
|
-
itemSize:
|
|
479
|
+
startIndexVisible: Math.min(n - 1, L.startIndexVisible),
|
|
480
|
+
startIndexOverscan: Math.min(n - 1, L.startIndexOverscan),
|
|
481
|
+
stopIndexVisible: Math.min(n - 1, L.stopIndexVisible),
|
|
482
|
+
stopIndexOverscan: Math.min(n - 1, L.stopIndexOverscan)
|
|
483
|
+
}, O = X(
|
|
484
|
+
() => Ve({
|
|
485
|
+
cachedBounds: g,
|
|
486
|
+
itemCount: n,
|
|
487
|
+
itemSize: T
|
|
401
488
|
}),
|
|
402
|
-
[
|
|
403
|
-
),
|
|
404
|
-
(
|
|
405
|
-
const
|
|
489
|
+
[g, n, T]
|
|
490
|
+
), H = X(
|
|
491
|
+
(z) => {
|
|
492
|
+
const x = ne({
|
|
406
493
|
containerElement: e,
|
|
407
|
-
direction:
|
|
408
|
-
isRtl:
|
|
409
|
-
scrollOffset:
|
|
494
|
+
direction: s,
|
|
495
|
+
isRtl: i,
|
|
496
|
+
scrollOffset: z
|
|
410
497
|
});
|
|
411
|
-
return
|
|
412
|
-
cachedBounds:
|
|
413
|
-
containerScrollOffset:
|
|
414
|
-
containerSize:
|
|
415
|
-
itemCount:
|
|
498
|
+
return fe({
|
|
499
|
+
cachedBounds: g,
|
|
500
|
+
containerScrollOffset: x,
|
|
501
|
+
containerSize: m,
|
|
502
|
+
itemCount: n,
|
|
416
503
|
overscanCount: f
|
|
417
504
|
});
|
|
418
505
|
},
|
|
419
506
|
[
|
|
420
|
-
|
|
507
|
+
g,
|
|
421
508
|
e,
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
n,
|
|
509
|
+
m,
|
|
510
|
+
s,
|
|
425
511
|
i,
|
|
512
|
+
n,
|
|
426
513
|
f
|
|
427
514
|
]
|
|
428
|
-
),
|
|
429
|
-
|
|
430
|
-
if (!e ||
|
|
515
|
+
), I = P(!1);
|
|
516
|
+
B(() => {
|
|
517
|
+
if (!e || n === 0 || a || I.current || (I.current = !0, o <= 0))
|
|
431
518
|
return;
|
|
432
|
-
const
|
|
433
|
-
if (
|
|
519
|
+
const z = s === "horizontal" && Ae(e);
|
|
520
|
+
if (ne({
|
|
434
521
|
containerElement: e,
|
|
435
|
-
direction:
|
|
436
|
-
isRtl:
|
|
437
|
-
scrollOffset:
|
|
522
|
+
direction: s,
|
|
523
|
+
isRtl: z,
|
|
524
|
+
scrollOffset: s === "vertical" ? e.scrollTop : e.scrollLeft
|
|
438
525
|
}) !== 0)
|
|
439
526
|
return;
|
|
440
|
-
const
|
|
527
|
+
const A = ne({
|
|
441
528
|
containerElement: e,
|
|
442
|
-
direction:
|
|
443
|
-
isRtl:
|
|
529
|
+
direction: s,
|
|
530
|
+
isRtl: z,
|
|
444
531
|
scrollOffset: o
|
|
445
532
|
});
|
|
446
533
|
typeof e.scrollTo == "function" ? e.scrollTo({
|
|
447
534
|
behavior: "instant",
|
|
448
|
-
[
|
|
449
|
-
}) :
|
|
450
|
-
}, [e,
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
535
|
+
[s === "vertical" ? "top" : "left"]: A
|
|
536
|
+
}) : s === "vertical" ? e.scrollTop = A : e.scrollLeft = A;
|
|
537
|
+
}, [e, n]), B(() => {
|
|
538
|
+
if (a && e && c)
|
|
539
|
+
return;
|
|
540
|
+
const z = e && !a ? H(
|
|
541
|
+
s === "vertical" ? e.scrollTop : e.scrollLeft
|
|
542
|
+
) : fe({
|
|
543
|
+
cachedBounds: g,
|
|
544
|
+
containerScrollOffset: k,
|
|
545
|
+
containerSize: m,
|
|
546
|
+
itemCount: n,
|
|
458
547
|
overscanCount: f
|
|
459
548
|
});
|
|
460
|
-
|
|
549
|
+
$((x) => se(z, x) ? x : z);
|
|
461
550
|
}, [
|
|
462
|
-
h,
|
|
463
|
-
e,
|
|
464
|
-
d,
|
|
465
|
-
r,
|
|
466
|
-
q,
|
|
467
551
|
g,
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
552
|
+
e,
|
|
553
|
+
m,
|
|
554
|
+
s,
|
|
555
|
+
H,
|
|
556
|
+
k,
|
|
557
|
+
a,
|
|
558
|
+
n,
|
|
559
|
+
f,
|
|
560
|
+
c
|
|
561
|
+
]), B(() => {
|
|
562
|
+
if (!e || a)
|
|
472
563
|
return;
|
|
473
|
-
const
|
|
474
|
-
|
|
475
|
-
const { scrollLeft:
|
|
564
|
+
const z = () => {
|
|
565
|
+
$((x) => {
|
|
566
|
+
const { scrollLeft: A, scrollTop: N } = e, W = ne({
|
|
476
567
|
containerElement: e,
|
|
477
|
-
direction:
|
|
478
|
-
isRtl:
|
|
479
|
-
scrollOffset:
|
|
480
|
-
}),
|
|
481
|
-
cachedBounds:
|
|
482
|
-
containerScrollOffset:
|
|
483
|
-
containerSize:
|
|
484
|
-
itemCount:
|
|
568
|
+
direction: s,
|
|
569
|
+
isRtl: i,
|
|
570
|
+
scrollOffset: s === "vertical" ? N : A
|
|
571
|
+
}), D = fe({
|
|
572
|
+
cachedBounds: g,
|
|
573
|
+
containerScrollOffset: W,
|
|
574
|
+
containerSize: m,
|
|
575
|
+
itemCount: n,
|
|
485
576
|
overscanCount: f
|
|
486
577
|
});
|
|
487
|
-
return
|
|
578
|
+
return se(D, x) ? x : D;
|
|
488
579
|
});
|
|
489
580
|
};
|
|
490
|
-
return e.addEventListener("scroll",
|
|
491
|
-
e.removeEventListener("scroll",
|
|
581
|
+
return e.addEventListener("scroll", z), () => {
|
|
582
|
+
e.removeEventListener("scroll", z);
|
|
492
583
|
};
|
|
493
584
|
}, [
|
|
494
|
-
|
|
585
|
+
g,
|
|
495
586
|
e,
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
n,
|
|
587
|
+
m,
|
|
588
|
+
s,
|
|
499
589
|
i,
|
|
590
|
+
a,
|
|
591
|
+
n,
|
|
500
592
|
f
|
|
501
593
|
]);
|
|
502
|
-
const
|
|
594
|
+
const K = ie(() => {
|
|
595
|
+
if (!e || !c)
|
|
596
|
+
return;
|
|
597
|
+
const { offset: z, size: x, viewportSize: A } = Oe({
|
|
598
|
+
containerElement: e,
|
|
599
|
+
direction: s,
|
|
600
|
+
isRtl: i,
|
|
601
|
+
scrollTarget: c
|
|
602
|
+
});
|
|
603
|
+
w(A);
|
|
604
|
+
const N = fe({
|
|
605
|
+
cachedBounds: g,
|
|
606
|
+
containerScrollOffset: z,
|
|
607
|
+
containerSize: x,
|
|
608
|
+
itemCount: n,
|
|
609
|
+
overscanCount: f
|
|
610
|
+
});
|
|
611
|
+
$((W) => se(N, W) ? W : N);
|
|
612
|
+
});
|
|
613
|
+
B(() => {
|
|
614
|
+
a && K();
|
|
615
|
+
}), B(() => {
|
|
616
|
+
if (!a || !e || !c)
|
|
617
|
+
return;
|
|
618
|
+
const z = Z(e), x = () => K();
|
|
619
|
+
c.addEventListener("scroll", x, { passive: !0 }), e.addEventListener("scroll", x, { passive: !0 }), z.addEventListener("resize", x);
|
|
620
|
+
let A;
|
|
621
|
+
const N = we(e);
|
|
622
|
+
N && !ce(c) && (A = new N(x), A.observe(c));
|
|
623
|
+
const W = Ce({
|
|
624
|
+
container: ce(c) ? c.document.documentElement : c,
|
|
625
|
+
element: e,
|
|
626
|
+
onChange: x
|
|
627
|
+
});
|
|
628
|
+
return () => {
|
|
629
|
+
c.removeEventListener("scroll", x), e.removeEventListener("scroll", x), z.removeEventListener("resize", x), A?.disconnect(), W();
|
|
630
|
+
};
|
|
631
|
+
}, [
|
|
632
|
+
e,
|
|
633
|
+
a,
|
|
634
|
+
c,
|
|
635
|
+
K
|
|
636
|
+
]);
|
|
637
|
+
const re = ie(
|
|
503
638
|
({
|
|
504
|
-
align:
|
|
505
|
-
|
|
506
|
-
index: y
|
|
639
|
+
align: z = "auto",
|
|
640
|
+
index: x
|
|
507
641
|
}) => {
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
642
|
+
const A = ({
|
|
643
|
+
clamp: V,
|
|
644
|
+
containerScrollOffset: F,
|
|
645
|
+
containerSize: M,
|
|
646
|
+
padding: y
|
|
647
|
+
}) => {
|
|
648
|
+
if (y.start === 0 && y.end === 0)
|
|
649
|
+
return Se({
|
|
650
|
+
align: z,
|
|
651
|
+
cachedBounds: g,
|
|
652
|
+
clamp: V,
|
|
653
|
+
containerScrollOffset: F,
|
|
654
|
+
containerSize: M,
|
|
655
|
+
index: x,
|
|
656
|
+
itemCount: n,
|
|
657
|
+
itemSize: T
|
|
658
|
+
});
|
|
659
|
+
const U = Se({
|
|
660
|
+
align: z,
|
|
661
|
+
cachedBounds: g,
|
|
662
|
+
clamp: !1,
|
|
663
|
+
containerScrollOffset: F + y.start,
|
|
664
|
+
containerSize: Math.max(
|
|
665
|
+
0,
|
|
666
|
+
M - y.start - y.end
|
|
667
|
+
),
|
|
668
|
+
index: x,
|
|
669
|
+
itemCount: n,
|
|
670
|
+
itemSize: T
|
|
671
|
+
}) - y.start;
|
|
672
|
+
return V ? Math.max(0, Math.min(O() - M, U)) : U;
|
|
673
|
+
};
|
|
674
|
+
if (a && e && c && !qe(e, s)) {
|
|
675
|
+
const { viewportOffset: V, viewportSize: F } = Oe({
|
|
512
676
|
containerElement: e,
|
|
513
|
-
direction:
|
|
514
|
-
isRtl:
|
|
515
|
-
|
|
677
|
+
direction: s,
|
|
678
|
+
isRtl: i,
|
|
679
|
+
scrollTarget: c
|
|
680
|
+
}), y = A({
|
|
681
|
+
clamp: !1,
|
|
682
|
+
containerScrollOffset: V,
|
|
683
|
+
containerSize: F,
|
|
684
|
+
padding: Ie({
|
|
685
|
+
direction: s,
|
|
686
|
+
isRtl: i,
|
|
687
|
+
scrollTarget: c,
|
|
688
|
+
viewportSize: F
|
|
689
|
+
})
|
|
690
|
+
}) - V, U = s === "horizontal" && i ? -y : y;
|
|
691
|
+
return {
|
|
692
|
+
scrollOffset: de(c, s) + U,
|
|
693
|
+
scrollTarget: c
|
|
694
|
+
};
|
|
695
|
+
}
|
|
696
|
+
const N = e ? s === "vertical" ? e.scrollTop : e.scrollLeft : 0, W = a && e ? s === "vertical" ? e.clientHeight : e.clientWidth : m;
|
|
697
|
+
let D = A({
|
|
698
|
+
clamp: !0,
|
|
699
|
+
containerScrollOffset: ne({
|
|
700
|
+
containerElement: e,
|
|
701
|
+
direction: s,
|
|
702
|
+
isRtl: i,
|
|
703
|
+
scrollOffset: N
|
|
516
704
|
}),
|
|
517
|
-
containerSize:
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
705
|
+
containerSize: W,
|
|
706
|
+
padding: e ? Ie({
|
|
707
|
+
direction: s,
|
|
708
|
+
isRtl: i,
|
|
709
|
+
scrollTarget: e,
|
|
710
|
+
viewportSize: W
|
|
711
|
+
}) : { end: 0, start: 0 }
|
|
521
712
|
});
|
|
522
|
-
if (e) {
|
|
523
|
-
if (
|
|
713
|
+
if (e && (!a || c)) {
|
|
714
|
+
if (D = ne({
|
|
524
715
|
containerElement: e,
|
|
525
|
-
direction:
|
|
526
|
-
isRtl:
|
|
527
|
-
scrollOffset:
|
|
528
|
-
}), typeof e.scrollTo != "function") {
|
|
529
|
-
const
|
|
530
|
-
|
|
716
|
+
direction: s,
|
|
717
|
+
isRtl: i,
|
|
718
|
+
scrollOffset: D
|
|
719
|
+
}), !a && typeof e.scrollTo != "function") {
|
|
720
|
+
const V = H(D);
|
|
721
|
+
se(L, V) || $(V);
|
|
531
722
|
}
|
|
532
|
-
return
|
|
723
|
+
return { scrollOffset: D, scrollTarget: e };
|
|
533
724
|
}
|
|
534
725
|
}
|
|
535
726
|
);
|
|
536
727
|
return {
|
|
537
|
-
getCellBounds:
|
|
538
|
-
getEstimatedSize:
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
728
|
+
getCellBounds: E,
|
|
729
|
+
getEstimatedSize: O,
|
|
730
|
+
getScrollPositionForIndex: re,
|
|
731
|
+
scrollTarget: c,
|
|
732
|
+
startIndexOverscan: Q,
|
|
733
|
+
startIndexVisible: _,
|
|
734
|
+
stopIndexOverscan: R,
|
|
735
|
+
stopIndexVisible: te
|
|
544
736
|
};
|
|
545
737
|
}
|
|
546
|
-
function
|
|
547
|
-
const [t,
|
|
548
|
-
return
|
|
738
|
+
function Fe(e) {
|
|
739
|
+
const [t, r] = C(e);
|
|
740
|
+
return se(t, e) ? t : (r(e), e);
|
|
549
741
|
}
|
|
550
|
-
function
|
|
742
|
+
function He(e, t) {
|
|
551
743
|
const {
|
|
552
|
-
ariaAttributes:
|
|
744
|
+
ariaAttributes: r,
|
|
553
745
|
style: o,
|
|
554
|
-
...
|
|
746
|
+
...s
|
|
555
747
|
} = e, {
|
|
556
|
-
ariaAttributes:
|
|
557
|
-
style:
|
|
558
|
-
...
|
|
748
|
+
ariaAttributes: i,
|
|
749
|
+
style: n,
|
|
750
|
+
...d
|
|
559
751
|
} = t;
|
|
560
|
-
return
|
|
752
|
+
return se(r, i) && se(o, n) && se(s, d);
|
|
561
753
|
}
|
|
562
|
-
function
|
|
754
|
+
function rt({
|
|
563
755
|
cellComponent: e,
|
|
564
756
|
cellProps: t,
|
|
565
|
-
children:
|
|
757
|
+
children: r,
|
|
566
758
|
className: o,
|
|
567
|
-
columnCount:
|
|
568
|
-
columnKey:
|
|
569
|
-
columnWidth:
|
|
570
|
-
defaultHeight:
|
|
571
|
-
defaultScrollLeft:
|
|
572
|
-
defaultScrollTop:
|
|
759
|
+
columnCount: s,
|
|
760
|
+
columnKey: i,
|
|
761
|
+
columnWidth: n,
|
|
762
|
+
defaultHeight: d = 0,
|
|
763
|
+
defaultScrollLeft: v = 0,
|
|
764
|
+
defaultScrollTop: h = 0,
|
|
573
765
|
defaultWidth: f = 0,
|
|
574
|
-
dir:
|
|
575
|
-
gridRef:
|
|
576
|
-
onCellsRendered:
|
|
577
|
-
onResize:
|
|
578
|
-
overscanCount:
|
|
579
|
-
rowCount:
|
|
580
|
-
rowHeight:
|
|
581
|
-
rowKey:
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
766
|
+
dir: u,
|
|
767
|
+
gridRef: a,
|
|
768
|
+
onCellsRendered: c,
|
|
769
|
+
onResize: l,
|
|
770
|
+
overscanCount: p = 3,
|
|
771
|
+
rowCount: b,
|
|
772
|
+
rowHeight: S,
|
|
773
|
+
rowKey: w,
|
|
774
|
+
scrollElement: m,
|
|
775
|
+
style: T,
|
|
776
|
+
tagName: g = "div",
|
|
777
|
+
...J
|
|
585
778
|
}) {
|
|
586
|
-
const
|
|
587
|
-
() =>
|
|
779
|
+
const k = Fe(t), E = q(
|
|
780
|
+
() => Le(e, He),
|
|
588
781
|
[e]
|
|
589
|
-
), [
|
|
590
|
-
getCellBounds:
|
|
591
|
-
getEstimatedSize:
|
|
592
|
-
startIndexOverscan:
|
|
593
|
-
startIndexVisible:
|
|
594
|
-
|
|
595
|
-
stopIndexOverscan:
|
|
596
|
-
stopIndexVisible:
|
|
597
|
-
} =
|
|
598
|
-
containerElement:
|
|
599
|
-
containerStyle:
|
|
782
|
+
), [L, $] = C(null), _ = Ee(L, u), {
|
|
783
|
+
getCellBounds: Q,
|
|
784
|
+
getEstimatedSize: te,
|
|
785
|
+
startIndexOverscan: R,
|
|
786
|
+
startIndexVisible: O,
|
|
787
|
+
getScrollPositionForIndex: H,
|
|
788
|
+
stopIndexOverscan: I,
|
|
789
|
+
stopIndexVisible: K
|
|
790
|
+
} = pe({
|
|
791
|
+
containerElement: L,
|
|
792
|
+
containerStyle: T,
|
|
600
793
|
defaultContainerSize: f,
|
|
601
|
-
defaultScrollOffset:
|
|
794
|
+
defaultScrollOffset: v,
|
|
602
795
|
direction: "horizontal",
|
|
603
|
-
isRtl:
|
|
604
|
-
itemCount:
|
|
605
|
-
itemProps:
|
|
606
|
-
itemSize:
|
|
607
|
-
onResize:
|
|
608
|
-
overscanCount:
|
|
796
|
+
isRtl: _,
|
|
797
|
+
itemCount: s,
|
|
798
|
+
itemProps: k,
|
|
799
|
+
itemSize: n,
|
|
800
|
+
onResize: l,
|
|
801
|
+
overscanCount: p,
|
|
802
|
+
scrollElement: m
|
|
609
803
|
}), {
|
|
610
|
-
getCellBounds:
|
|
611
|
-
getEstimatedSize:
|
|
612
|
-
startIndexOverscan:
|
|
613
|
-
startIndexVisible:
|
|
614
|
-
|
|
615
|
-
stopIndexOverscan:
|
|
616
|
-
stopIndexVisible:
|
|
617
|
-
} =
|
|
618
|
-
containerElement:
|
|
619
|
-
containerStyle:
|
|
620
|
-
defaultContainerSize:
|
|
621
|
-
defaultScrollOffset:
|
|
804
|
+
getCellBounds: re,
|
|
805
|
+
getEstimatedSize: z,
|
|
806
|
+
startIndexOverscan: x,
|
|
807
|
+
startIndexVisible: A,
|
|
808
|
+
getScrollPositionForIndex: N,
|
|
809
|
+
stopIndexOverscan: W,
|
|
810
|
+
stopIndexVisible: D
|
|
811
|
+
} = pe({
|
|
812
|
+
containerElement: L,
|
|
813
|
+
containerStyle: T,
|
|
814
|
+
defaultContainerSize: d,
|
|
815
|
+
defaultScrollOffset: h,
|
|
622
816
|
direction: "vertical",
|
|
623
|
-
itemCount:
|
|
624
|
-
itemProps:
|
|
625
|
-
itemSize:
|
|
626
|
-
onResize:
|
|
627
|
-
overscanCount:
|
|
817
|
+
itemCount: b,
|
|
818
|
+
itemProps: k,
|
|
819
|
+
itemSize: S,
|
|
820
|
+
onResize: l,
|
|
821
|
+
overscanCount: p,
|
|
822
|
+
scrollElement: m
|
|
628
823
|
});
|
|
629
|
-
|
|
630
|
-
|
|
824
|
+
Me(
|
|
825
|
+
a,
|
|
631
826
|
() => ({
|
|
632
827
|
get element() {
|
|
633
|
-
return
|
|
828
|
+
return L;
|
|
634
829
|
},
|
|
635
830
|
scrollToCell({
|
|
636
|
-
behavior:
|
|
637
|
-
columnAlign:
|
|
638
|
-
columnIndex:
|
|
639
|
-
rowAlign:
|
|
640
|
-
rowIndex:
|
|
831
|
+
behavior: M = "auto",
|
|
832
|
+
columnAlign: y = "auto",
|
|
833
|
+
columnIndex: U,
|
|
834
|
+
rowAlign: j = "auto",
|
|
835
|
+
rowIndex: ee
|
|
641
836
|
}) {
|
|
642
|
-
const
|
|
643
|
-
align:
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
containerScrollOffset: I?.scrollTop ?? 0,
|
|
649
|
-
index: B
|
|
650
|
-
});
|
|
651
|
-
typeof I?.scrollTo == "function" && I.scrollTo({
|
|
652
|
-
behavior: F,
|
|
653
|
-
left: se,
|
|
654
|
-
top: Se
|
|
837
|
+
const G = H({
|
|
838
|
+
align: y,
|
|
839
|
+
index: U
|
|
840
|
+
}), oe = N({
|
|
841
|
+
align: j,
|
|
842
|
+
index: ee
|
|
655
843
|
});
|
|
844
|
+
G && oe && G.scrollTarget === oe.scrollTarget ? ae(oe.scrollTarget, {
|
|
845
|
+
behavior: M,
|
|
846
|
+
left: G.scrollOffset,
|
|
847
|
+
top: oe.scrollOffset
|
|
848
|
+
}) : (G && ae(G.scrollTarget, {
|
|
849
|
+
behavior: M,
|
|
850
|
+
left: G.scrollOffset
|
|
851
|
+
}), oe && ae(oe.scrollTarget, {
|
|
852
|
+
behavior: M,
|
|
853
|
+
top: oe.scrollOffset
|
|
854
|
+
}));
|
|
656
855
|
},
|
|
657
856
|
scrollToColumn({
|
|
658
|
-
align:
|
|
659
|
-
behavior:
|
|
660
|
-
index:
|
|
857
|
+
align: M = "auto",
|
|
858
|
+
behavior: y = "auto",
|
|
859
|
+
index: U
|
|
661
860
|
}) {
|
|
662
|
-
const
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
});
|
|
667
|
-
typeof I?.scrollTo == "function" && I.scrollTo({
|
|
668
|
-
behavior: S,
|
|
669
|
-
left: Y
|
|
861
|
+
const j = H({ align: M, index: U });
|
|
862
|
+
j && ae(j.scrollTarget, {
|
|
863
|
+
behavior: y,
|
|
864
|
+
left: j.scrollOffset
|
|
670
865
|
});
|
|
671
866
|
},
|
|
672
867
|
scrollToRow({
|
|
673
|
-
align:
|
|
674
|
-
behavior:
|
|
675
|
-
index:
|
|
868
|
+
align: M = "auto",
|
|
869
|
+
behavior: y = "auto",
|
|
870
|
+
index: U
|
|
676
871
|
}) {
|
|
677
|
-
const
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
});
|
|
682
|
-
typeof I?.scrollTo == "function" && I.scrollTo({
|
|
683
|
-
behavior: S,
|
|
684
|
-
top: Y
|
|
872
|
+
const j = N({ align: M, index: U });
|
|
873
|
+
j && ae(j.scrollTarget, {
|
|
874
|
+
behavior: y,
|
|
875
|
+
top: j.scrollOffset
|
|
685
876
|
});
|
|
686
877
|
}
|
|
687
878
|
}),
|
|
688
|
-
[
|
|
689
|
-
),
|
|
690
|
-
|
|
879
|
+
[L, H, N]
|
|
880
|
+
), le(() => {
|
|
881
|
+
R >= 0 && I >= 0 && x >= 0 && W >= 0 && c && c(
|
|
691
882
|
{
|
|
692
|
-
columnStartIndex:
|
|
693
|
-
columnStopIndex:
|
|
694
|
-
rowStartIndex:
|
|
695
|
-
rowStopIndex:
|
|
883
|
+
columnStartIndex: O,
|
|
884
|
+
columnStopIndex: K,
|
|
885
|
+
rowStartIndex: A,
|
|
886
|
+
rowStopIndex: D
|
|
696
887
|
},
|
|
697
888
|
{
|
|
698
|
-
columnStartIndex:
|
|
699
|
-
columnStopIndex:
|
|
700
|
-
rowStartIndex:
|
|
701
|
-
rowStopIndex:
|
|
889
|
+
columnStartIndex: R,
|
|
890
|
+
columnStopIndex: I,
|
|
891
|
+
rowStartIndex: x,
|
|
892
|
+
rowStopIndex: W
|
|
702
893
|
}
|
|
703
894
|
);
|
|
704
895
|
}, [
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
896
|
+
c,
|
|
897
|
+
R,
|
|
898
|
+
O,
|
|
899
|
+
I,
|
|
900
|
+
K,
|
|
901
|
+
x,
|
|
902
|
+
A,
|
|
903
|
+
W,
|
|
904
|
+
D
|
|
714
905
|
]);
|
|
715
|
-
const
|
|
716
|
-
const
|
|
717
|
-
if (
|
|
718
|
-
for (let
|
|
719
|
-
const
|
|
720
|
-
for (let
|
|
721
|
-
const
|
|
722
|
-
|
|
723
|
-
/* @__PURE__ */
|
|
724
|
-
|
|
906
|
+
const V = q(() => {
|
|
907
|
+
const M = [];
|
|
908
|
+
if (s > 0 && b > 0)
|
|
909
|
+
for (let y = x; y <= W; y++) {
|
|
910
|
+
const U = re(y), j = [];
|
|
911
|
+
for (let ee = R; ee <= I; ee++) {
|
|
912
|
+
const G = Q(ee);
|
|
913
|
+
j.push(
|
|
914
|
+
/* @__PURE__ */ he(
|
|
915
|
+
E,
|
|
725
916
|
{
|
|
726
|
-
...
|
|
917
|
+
...k,
|
|
727
918
|
ariaAttributes: {
|
|
728
|
-
"aria-colindex":
|
|
919
|
+
"aria-colindex": ee + 1,
|
|
729
920
|
role: "gridcell"
|
|
730
921
|
},
|
|
731
|
-
columnIndex:
|
|
732
|
-
key:
|
|
733
|
-
columnIndex:
|
|
734
|
-
data:
|
|
735
|
-
rowIndex:
|
|
736
|
-
}) :
|
|
737
|
-
rowIndex:
|
|
922
|
+
columnIndex: ee,
|
|
923
|
+
key: i ? i({
|
|
924
|
+
columnIndex: ee,
|
|
925
|
+
data: k,
|
|
926
|
+
rowIndex: y
|
|
927
|
+
}) : ee,
|
|
928
|
+
rowIndex: y,
|
|
738
929
|
style: {
|
|
739
930
|
position: "absolute",
|
|
740
|
-
left:
|
|
741
|
-
right:
|
|
742
|
-
transform: `translate(${
|
|
743
|
-
height:
|
|
744
|
-
width:
|
|
931
|
+
left: _ ? void 0 : 0,
|
|
932
|
+
right: _ ? 0 : void 0,
|
|
933
|
+
transform: `translate(${_ ? -G.scrollOffset : G.scrollOffset}px, ${U.scrollOffset}px)`,
|
|
934
|
+
height: U.size,
|
|
935
|
+
width: G.size
|
|
745
936
|
}
|
|
746
937
|
}
|
|
747
938
|
)
|
|
748
939
|
);
|
|
749
940
|
}
|
|
750
|
-
|
|
751
|
-
/* @__PURE__ */
|
|
941
|
+
M.push(
|
|
942
|
+
/* @__PURE__ */ ue(
|
|
752
943
|
"div",
|
|
753
944
|
{
|
|
754
945
|
role: "row",
|
|
755
|
-
"aria-rowindex":
|
|
756
|
-
children:
|
|
946
|
+
"aria-rowindex": y + 1,
|
|
947
|
+
children: j
|
|
757
948
|
},
|
|
758
|
-
|
|
759
|
-
data:
|
|
760
|
-
rowIndex:
|
|
761
|
-
}) :
|
|
949
|
+
w ? w({
|
|
950
|
+
data: k,
|
|
951
|
+
rowIndex: y
|
|
952
|
+
}) : y
|
|
762
953
|
)
|
|
763
954
|
);
|
|
764
955
|
}
|
|
765
|
-
return
|
|
956
|
+
return M;
|
|
766
957
|
}, [
|
|
767
|
-
j,
|
|
768
|
-
L,
|
|
769
|
-
r,
|
|
770
|
-
n,
|
|
771
|
-
m,
|
|
772
|
-
y,
|
|
773
|
-
q,
|
|
774
958
|
E,
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
959
|
+
k,
|
|
960
|
+
s,
|
|
961
|
+
i,
|
|
962
|
+
R,
|
|
963
|
+
I,
|
|
964
|
+
Q,
|
|
965
|
+
re,
|
|
966
|
+
_,
|
|
967
|
+
b,
|
|
968
|
+
w,
|
|
969
|
+
x,
|
|
970
|
+
W
|
|
971
|
+
]), F = /* @__PURE__ */ ue(
|
|
781
972
|
"div",
|
|
782
973
|
{
|
|
783
974
|
"aria-hidden": !0,
|
|
784
975
|
style: {
|
|
785
|
-
height:
|
|
786
|
-
width:
|
|
976
|
+
height: z(),
|
|
977
|
+
width: te(),
|
|
787
978
|
zIndex: -1
|
|
788
979
|
}
|
|
789
980
|
}
|
|
790
981
|
);
|
|
791
|
-
return
|
|
792
|
-
|
|
982
|
+
return he(
|
|
983
|
+
g,
|
|
793
984
|
{
|
|
794
|
-
"aria-colcount":
|
|
795
|
-
"aria-rowcount":
|
|
985
|
+
"aria-colcount": s,
|
|
986
|
+
"aria-rowcount": b,
|
|
796
987
|
role: "grid",
|
|
797
|
-
...
|
|
988
|
+
...J,
|
|
798
989
|
className: o,
|
|
799
|
-
dir:
|
|
800
|
-
ref:
|
|
990
|
+
dir: u,
|
|
991
|
+
ref: $,
|
|
801
992
|
style: {
|
|
802
993
|
position: "relative",
|
|
803
|
-
|
|
804
|
-
|
|
994
|
+
// Grids that scroll with an outer element render at their full height,
|
|
995
|
+
// and at their full width unless constrained by their parent (in which case columns scroll within the grid)
|
|
996
|
+
...m === void 0 && {
|
|
997
|
+
maxHeight: "100%",
|
|
998
|
+
maxWidth: "100%"
|
|
999
|
+
},
|
|
805
1000
|
flexGrow: 1,
|
|
806
1001
|
overflow: "auto",
|
|
807
|
-
...
|
|
1002
|
+
...T
|
|
808
1003
|
}
|
|
809
1004
|
},
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
1005
|
+
V,
|
|
1006
|
+
r,
|
|
1007
|
+
F
|
|
813
1008
|
);
|
|
814
1009
|
}
|
|
815
|
-
const
|
|
816
|
-
function
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
enabled: s = !0
|
|
820
|
-
}) {
|
|
821
|
-
const o = ee(e);
|
|
822
|
-
ie(() => {
|
|
823
|
-
if (!s || !t)
|
|
824
|
-
return;
|
|
825
|
-
const r = ae(t);
|
|
826
|
-
let n = r.requestAnimationFrame(() => {
|
|
827
|
-
n = r.requestAnimationFrame(o);
|
|
828
|
-
});
|
|
829
|
-
return () => {
|
|
830
|
-
r.cancelAnimationFrame(n);
|
|
831
|
-
};
|
|
832
|
-
}, [t, s, o]);
|
|
1010
|
+
const ot = C, nt = P, ke = "data-react-window-index", Ze = "data-index";
|
|
1011
|
+
function ge(e) {
|
|
1012
|
+
const t = e.getAttribute(ke) ?? e.getAttribute(Ze);
|
|
1013
|
+
return t !== null && /^\d+$/.test(t) ? Number(t) : void 0;
|
|
833
1014
|
}
|
|
834
|
-
|
|
835
|
-
|
|
1015
|
+
const Je = 1e3, ze = 500;
|
|
1016
|
+
function Qe(e) {
|
|
1017
|
+
return 1 - Math.pow(1 - e, 3);
|
|
836
1018
|
}
|
|
837
|
-
function
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
1019
|
+
function Ne({
|
|
1020
|
+
direction: e,
|
|
1021
|
+
element: t,
|
|
1022
|
+
getCellBounds: r,
|
|
1023
|
+
isDynamicSize: o,
|
|
1024
|
+
itemCount: s,
|
|
1025
|
+
itemElements: i,
|
|
1026
|
+
scrollTarget: n,
|
|
1027
|
+
getScrollPositionForIndex: d
|
|
844
1028
|
}) {
|
|
845
|
-
const
|
|
1029
|
+
const v = e === "vertical", h = P(null), f = P(
|
|
846
1030
|
void 0
|
|
847
|
-
),
|
|
848
|
-
|
|
849
|
-
}),
|
|
850
|
-
const
|
|
851
|
-
|
|
852
|
-
id:
|
|
853
|
-
view:
|
|
1031
|
+
), u = ie(() => {
|
|
1032
|
+
h.current = null, f.current !== void 0 && (f.current.view.cancelAnimationFrame(f.current.id), f.current = void 0);
|
|
1033
|
+
}), a = ie(() => {
|
|
1034
|
+
const l = Z(t);
|
|
1035
|
+
f.current = {
|
|
1036
|
+
id: l.requestAnimationFrame(c),
|
|
1037
|
+
view: l
|
|
854
1038
|
};
|
|
855
|
-
}),
|
|
856
|
-
|
|
857
|
-
const
|
|
858
|
-
if (!
|
|
859
|
-
|
|
860
|
-
|
|
1039
|
+
}), c = ie(() => {
|
|
1040
|
+
f.current = void 0;
|
|
1041
|
+
const l = h.current;
|
|
1042
|
+
if (!l) return;
|
|
1043
|
+
const p = performance.now();
|
|
1044
|
+
if (!t || !o || l.index >= s || l.animation !== void 0 && p >= l.animation.deadline) {
|
|
1045
|
+
u();
|
|
861
1046
|
return;
|
|
862
1047
|
}
|
|
863
|
-
const
|
|
864
|
-
align:
|
|
865
|
-
|
|
866
|
-
index: c.index
|
|
1048
|
+
const b = d({
|
|
1049
|
+
align: l.align,
|
|
1050
|
+
index: l.index
|
|
867
1051
|
});
|
|
868
|
-
if (
|
|
869
|
-
const
|
|
1052
|
+
if (b !== void 0) {
|
|
1053
|
+
const { scrollOffset: S, scrollTarget: w } = b, m = Math.max(
|
|
870
1054
|
0,
|
|
871
|
-
Math.min(
|
|
1055
|
+
Math.min(S, je(w, e))
|
|
872
1056
|
);
|
|
873
|
-
if (
|
|
874
|
-
|
|
1057
|
+
if (l.animation === void 0) {
|
|
1058
|
+
const g = l.smooth ? ze : 0;
|
|
1059
|
+
l.animation = {
|
|
1060
|
+
deadline: p + g + Je,
|
|
1061
|
+
startOffset: de(w, e),
|
|
1062
|
+
startTime: p
|
|
1063
|
+
};
|
|
1064
|
+
}
|
|
1065
|
+
const T = l.smooth ? (p - l.animation.startTime) / ze : 1;
|
|
1066
|
+
if (T < 1) {
|
|
1067
|
+
const { startOffset: g } = l.animation;
|
|
1068
|
+
l.stableFrames = 0, w.scrollTo({
|
|
1069
|
+
behavior: "instant",
|
|
1070
|
+
[v ? "top" : "left"]: g + (m - g) * Qe(T)
|
|
1071
|
+
});
|
|
1072
|
+
} else if (Math.abs(m - de(w, e)) > 1)
|
|
1073
|
+
l.stableFrames = 0, w.scrollTo({
|
|
1074
|
+
behavior: "instant",
|
|
1075
|
+
[v ? "top" : "left"]: m
|
|
1076
|
+
});
|
|
875
1077
|
else {
|
|
876
|
-
const
|
|
877
|
-
if (!(
|
|
878
|
-
(
|
|
879
|
-
) &&
|
|
880
|
-
const
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
1078
|
+
const g = i.current;
|
|
1079
|
+
if (!(g.some(
|
|
1080
|
+
(E) => ge(E) === l.index
|
|
1081
|
+
) && g.every((E) => {
|
|
1082
|
+
const L = ge(E);
|
|
1083
|
+
if (L === void 0 || L >= s)
|
|
1084
|
+
return !0;
|
|
1085
|
+
const $ = v ? E.offsetHeight : E.offsetWidth;
|
|
1086
|
+
return Math.abs(r(L).size - $) <= 1;
|
|
884
1087
|
})))
|
|
885
|
-
|
|
886
|
-
else if (++
|
|
887
|
-
|
|
1088
|
+
l.stableFrames = 0;
|
|
1089
|
+
else if (++l.stableFrames >= 2) {
|
|
1090
|
+
u();
|
|
888
1091
|
return;
|
|
889
1092
|
}
|
|
890
1093
|
}
|
|
891
1094
|
}
|
|
892
|
-
|
|
1095
|
+
a();
|
|
893
1096
|
});
|
|
894
|
-
return
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
1097
|
+
return B(() => {
|
|
1098
|
+
const l = n ?? t;
|
|
1099
|
+
if (!l) return;
|
|
1100
|
+
const p = (b) => {
|
|
1101
|
+
switch (b.key) {
|
|
898
1102
|
case "ArrowUp":
|
|
899
1103
|
case "ArrowDown":
|
|
1104
|
+
case "ArrowLeft":
|
|
1105
|
+
case "ArrowRight":
|
|
900
1106
|
case "PageUp":
|
|
901
1107
|
case "PageDown":
|
|
902
1108
|
case "Home":
|
|
903
1109
|
case "End":
|
|
904
1110
|
case " ":
|
|
905
|
-
|
|
1111
|
+
u();
|
|
906
1112
|
}
|
|
907
1113
|
};
|
|
908
|
-
return
|
|
909
|
-
|
|
1114
|
+
return l.addEventListener("wheel", u, { passive: !0 }), l.addEventListener("touchstart", u, { passive: !0 }), l.addEventListener("pointerdown", u), l.addEventListener("keydown", p), () => {
|
|
1115
|
+
u(), l.removeEventListener("wheel", u), l.removeEventListener("touchstart", u), l.removeEventListener("pointerdown", u), l.removeEventListener("keydown", p);
|
|
910
1116
|
};
|
|
911
|
-
}, [
|
|
1117
|
+
}, [u, t, n]), X(
|
|
912
1118
|
({
|
|
913
|
-
align:
|
|
914
|
-
behavior:
|
|
915
|
-
index:
|
|
1119
|
+
align: l = "auto",
|
|
1120
|
+
behavior: p = "auto",
|
|
1121
|
+
index: b
|
|
916
1122
|
}) => {
|
|
917
|
-
|
|
918
|
-
align: "auto",
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
1123
|
+
if (o && l === "smart") {
|
|
1124
|
+
const w = d({ align: "auto", index: b });
|
|
1125
|
+
l = w === void 0 || w.scrollOffset === de(w.scrollTarget, e) ? "auto" : "center";
|
|
1126
|
+
}
|
|
1127
|
+
const S = d({ align: l, index: b });
|
|
1128
|
+
if (u(), S && typeof S.scrollTarget.scrollTo == "function") {
|
|
1129
|
+
const { scrollOffset: w, scrollTarget: m } = S;
|
|
1130
|
+
if (o) {
|
|
1131
|
+
const T = p === "smooth" && t?.ownerDocument.visibilityState !== "hidden";
|
|
1132
|
+
if (h.current = {
|
|
1133
|
+
align: l,
|
|
1134
|
+
index: b,
|
|
1135
|
+
smooth: T,
|
|
1136
|
+
stableFrames: 0
|
|
1137
|
+
}, a(), T)
|
|
1138
|
+
return;
|
|
1139
|
+
}
|
|
1140
|
+
m.scrollTo({
|
|
1141
|
+
behavior: o ? "instant" : p,
|
|
1142
|
+
[v ? "top" : "left"]: w
|
|
1143
|
+
});
|
|
1144
|
+
}
|
|
936
1145
|
},
|
|
937
1146
|
[
|
|
938
|
-
|
|
1147
|
+
u,
|
|
939
1148
|
e,
|
|
940
|
-
|
|
1149
|
+
t,
|
|
1150
|
+
o,
|
|
941
1151
|
v,
|
|
942
|
-
|
|
1152
|
+
a,
|
|
1153
|
+
d
|
|
943
1154
|
]
|
|
944
1155
|
);
|
|
945
1156
|
}
|
|
946
|
-
|
|
947
|
-
|
|
1157
|
+
function Ke({
|
|
1158
|
+
callback: e,
|
|
1159
|
+
element: t,
|
|
1160
|
+
enabled: r = !0
|
|
1161
|
+
}) {
|
|
1162
|
+
const o = ie(e);
|
|
1163
|
+
le(() => {
|
|
1164
|
+
if (!r || !t)
|
|
1165
|
+
return;
|
|
1166
|
+
const s = Z(t);
|
|
1167
|
+
let i = s.requestAnimationFrame(() => {
|
|
1168
|
+
i = s.requestAnimationFrame(o);
|
|
1169
|
+
});
|
|
1170
|
+
return () => {
|
|
1171
|
+
s.cancelAnimationFrame(i);
|
|
1172
|
+
};
|
|
1173
|
+
}, [t, r, o]);
|
|
1174
|
+
}
|
|
1175
|
+
function ve(e) {
|
|
1176
|
+
return e != null && typeof e == "object" && "getAverageRowHeight" in e && typeof e.getAverageRowHeight == "function";
|
|
1177
|
+
}
|
|
1178
|
+
const ye = "data-react-window-sizer";
|
|
1179
|
+
function it({
|
|
948
1180
|
children: e,
|
|
949
1181
|
className: t,
|
|
950
|
-
defaultHeight:
|
|
1182
|
+
defaultHeight: r = 0,
|
|
951
1183
|
defaultScrollOffset: o = 0,
|
|
952
|
-
listRef:
|
|
953
|
-
onResize:
|
|
954
|
-
onRowsRendered:
|
|
955
|
-
overscanCount:
|
|
956
|
-
rowComponent:
|
|
957
|
-
rowCount:
|
|
1184
|
+
listRef: s,
|
|
1185
|
+
onResize: i,
|
|
1186
|
+
onRowsRendered: n,
|
|
1187
|
+
overscanCount: d = 3,
|
|
1188
|
+
rowComponent: v,
|
|
1189
|
+
rowCount: h,
|
|
958
1190
|
rowHeight: f,
|
|
959
|
-
rowKey:
|
|
960
|
-
rowProps:
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
1191
|
+
rowKey: u,
|
|
1192
|
+
rowProps: a,
|
|
1193
|
+
scrollElement: c,
|
|
1194
|
+
tagName: l = "div",
|
|
1195
|
+
style: p,
|
|
1196
|
+
...b
|
|
964
1197
|
}) {
|
|
965
|
-
const
|
|
966
|
-
() =>
|
|
967
|
-
[
|
|
968
|
-
), [
|
|
969
|
-
() =>
|
|
970
|
-
),
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
}, [
|
|
974
|
-
callback: () =>
|
|
975
|
-
element:
|
|
976
|
-
enabled:
|
|
1198
|
+
const S = Fe(a), w = q(
|
|
1199
|
+
() => Le(v, He),
|
|
1200
|
+
[v]
|
|
1201
|
+
), [m, T] = C(null), g = ve(f), J = q(() => g ? (V) => f.getRowHeight(V) ?? f.getAverageRowHeight() : f, [g, f]), k = We(), [E, L] = C(
|
|
1202
|
+
() => k && g
|
|
1203
|
+
), $ = P(f);
|
|
1204
|
+
B(() => {
|
|
1205
|
+
E && $.current !== f && L(!1);
|
|
1206
|
+
}, [E, f]), Ke({
|
|
1207
|
+
callback: () => L(!1),
|
|
1208
|
+
element: m,
|
|
1209
|
+
enabled: E
|
|
977
1210
|
});
|
|
978
1211
|
const {
|
|
979
|
-
getCellBounds:
|
|
980
|
-
getEstimatedSize:
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
1212
|
+
getCellBounds: _,
|
|
1213
|
+
getEstimatedSize: Q,
|
|
1214
|
+
scrollTarget: te,
|
|
1215
|
+
getScrollPositionForIndex: R,
|
|
1216
|
+
startIndexOverscan: O,
|
|
1217
|
+
startIndexVisible: H,
|
|
1218
|
+
stopIndexOverscan: I,
|
|
1219
|
+
stopIndexVisible: K
|
|
1220
|
+
} = pe({
|
|
1221
|
+
containerElement: m,
|
|
1222
|
+
containerStyle: p,
|
|
1223
|
+
defaultContainerSize: r,
|
|
990
1224
|
defaultScrollOffset: o,
|
|
991
1225
|
direction: "vertical",
|
|
992
|
-
itemCount:
|
|
993
|
-
itemProps:
|
|
994
|
-
itemSize:
|
|
995
|
-
onResize:
|
|
996
|
-
overscanCount:
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1226
|
+
itemCount: h,
|
|
1227
|
+
itemProps: S,
|
|
1228
|
+
itemSize: J,
|
|
1229
|
+
onResize: i,
|
|
1230
|
+
overscanCount: d,
|
|
1231
|
+
scrollElement: c
|
|
1232
|
+
}), re = P([]), z = Ne({
|
|
1233
|
+
direction: "vertical",
|
|
1234
|
+
element: m,
|
|
1235
|
+
getCellBounds: _,
|
|
1236
|
+
isDynamicSize: g,
|
|
1237
|
+
itemCount: h,
|
|
1238
|
+
itemElements: re,
|
|
1239
|
+
scrollTarget: te,
|
|
1240
|
+
getScrollPositionForIndex: R
|
|
1004
1241
|
});
|
|
1005
|
-
|
|
1006
|
-
|
|
1242
|
+
Me(
|
|
1243
|
+
s,
|
|
1007
1244
|
() => ({
|
|
1008
1245
|
get element() {
|
|
1009
|
-
return
|
|
1246
|
+
return m;
|
|
1010
1247
|
},
|
|
1011
|
-
scrollToRow:
|
|
1248
|
+
scrollToRow: z
|
|
1012
1249
|
}),
|
|
1013
|
-
[
|
|
1014
|
-
),
|
|
1015
|
-
if (!
|
|
1250
|
+
[m, z]
|
|
1251
|
+
), B(() => {
|
|
1252
|
+
if (!m)
|
|
1016
1253
|
return;
|
|
1017
|
-
const
|
|
1254
|
+
const V = Array.from(m.children).slice(
|
|
1018
1255
|
0,
|
|
1019
|
-
|
|
1020
|
-
).filter((
|
|
1021
|
-
if (
|
|
1256
|
+
O < 0 ? 0 : I - O + 1
|
|
1257
|
+
).filter((F, M) => {
|
|
1258
|
+
if (F.hasAttribute(ye))
|
|
1022
1259
|
return !1;
|
|
1023
|
-
const
|
|
1024
|
-
return
|
|
1260
|
+
const y = `${O + M}`;
|
|
1261
|
+
return F.setAttribute(ke, y), !0;
|
|
1025
1262
|
});
|
|
1026
|
-
if (
|
|
1027
|
-
return f.observeRowElements(
|
|
1263
|
+
if (re.current = V, g)
|
|
1264
|
+
return f.observeRowElements(V);
|
|
1028
1265
|
}, [
|
|
1029
|
-
|
|
1266
|
+
w,
|
|
1267
|
+
m,
|
|
1030
1268
|
g,
|
|
1031
|
-
z,
|
|
1032
|
-
v,
|
|
1033
|
-
f,
|
|
1034
|
-
c,
|
|
1035
1269
|
h,
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1270
|
+
f,
|
|
1271
|
+
u,
|
|
1272
|
+
S,
|
|
1273
|
+
O,
|
|
1274
|
+
I
|
|
1275
|
+
]), le(() => {
|
|
1276
|
+
O >= 0 && I >= 0 && n && n(
|
|
1040
1277
|
{
|
|
1041
|
-
startIndex:
|
|
1042
|
-
stopIndex:
|
|
1278
|
+
startIndex: H,
|
|
1279
|
+
stopIndex: K
|
|
1043
1280
|
},
|
|
1044
1281
|
{
|
|
1045
|
-
startIndex:
|
|
1046
|
-
stopIndex:
|
|
1282
|
+
startIndex: O,
|
|
1283
|
+
stopIndex: I
|
|
1047
1284
|
}
|
|
1048
1285
|
);
|
|
1049
1286
|
}, [
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1287
|
+
n,
|
|
1288
|
+
O,
|
|
1289
|
+
H,
|
|
1290
|
+
I,
|
|
1291
|
+
K
|
|
1055
1292
|
]);
|
|
1056
|
-
const
|
|
1057
|
-
const
|
|
1058
|
-
if (
|
|
1059
|
-
for (let
|
|
1060
|
-
const
|
|
1061
|
-
|
|
1062
|
-
/* @__PURE__ */
|
|
1063
|
-
|
|
1293
|
+
const x = E && g && O === 0, A = q(() => {
|
|
1294
|
+
const V = [];
|
|
1295
|
+
if (h > 0)
|
|
1296
|
+
for (let F = O; F <= I; F++) {
|
|
1297
|
+
const M = _(F);
|
|
1298
|
+
V.push(
|
|
1299
|
+
/* @__PURE__ */ he(
|
|
1300
|
+
w,
|
|
1064
1301
|
{
|
|
1065
|
-
...
|
|
1302
|
+
...S,
|
|
1066
1303
|
ariaAttributes: {
|
|
1067
|
-
"aria-posinset":
|
|
1068
|
-
"aria-setsize":
|
|
1304
|
+
"aria-posinset": F + 1,
|
|
1305
|
+
"aria-setsize": h,
|
|
1069
1306
|
role: "listitem"
|
|
1070
1307
|
},
|
|
1071
|
-
key:
|
|
1072
|
-
index:
|
|
1073
|
-
style:
|
|
1308
|
+
key: u ? u(F, S) : F,
|
|
1309
|
+
index: F,
|
|
1310
|
+
style: x ? { width: "100%" } : {
|
|
1074
1311
|
position: "absolute",
|
|
1075
1312
|
left: 0,
|
|
1076
|
-
transform: `translateY(${
|
|
1313
|
+
transform: `translateY(${M.scrollOffset}px)`,
|
|
1077
1314
|
// In case of dynamic row heights, don't specify a height style
|
|
1078
1315
|
// otherwise a default/estimated height would mask the actual height
|
|
1079
|
-
height:
|
|
1316
|
+
height: g ? void 0 : M.size,
|
|
1080
1317
|
width: "100%"
|
|
1081
1318
|
}
|
|
1082
1319
|
}
|
|
1083
1320
|
)
|
|
1084
1321
|
);
|
|
1085
1322
|
}
|
|
1086
|
-
return
|
|
1323
|
+
return V;
|
|
1087
1324
|
}, [
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
v,
|
|
1093
|
-
c,
|
|
1325
|
+
w,
|
|
1326
|
+
_,
|
|
1327
|
+
g,
|
|
1328
|
+
x,
|
|
1094
1329
|
h,
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1330
|
+
u,
|
|
1331
|
+
S,
|
|
1332
|
+
O,
|
|
1333
|
+
I
|
|
1334
|
+
]), N = /* @__PURE__ */ ue(
|
|
1098
1335
|
"div",
|
|
1099
1336
|
{
|
|
1100
1337
|
"aria-hidden": !0,
|
|
1101
|
-
[
|
|
1338
|
+
[ye]: "",
|
|
1102
1339
|
style: {
|
|
1103
1340
|
// Rows rendered in flow layout already take up space
|
|
1104
|
-
position:
|
|
1105
|
-
top:
|
|
1106
|
-
height:
|
|
1341
|
+
position: x ? "absolute" : void 0,
|
|
1342
|
+
top: x ? 0 : void 0,
|
|
1343
|
+
height: Q(),
|
|
1107
1344
|
width: "100%",
|
|
1108
1345
|
zIndex: -1
|
|
1109
1346
|
}
|
|
1110
1347
|
},
|
|
1111
1348
|
"sizer"
|
|
1112
|
-
),
|
|
1113
|
-
return
|
|
1114
|
-
|
|
1349
|
+
), W = /* @__PURE__ */ ue(be, { children: e }, "children"), D = /* @__PURE__ */ ue(be, { children: A }, "rows");
|
|
1350
|
+
return he(
|
|
1351
|
+
l,
|
|
1115
1352
|
{
|
|
1116
1353
|
role: "list",
|
|
1117
|
-
...
|
|
1354
|
+
...b,
|
|
1118
1355
|
className: t,
|
|
1119
|
-
ref:
|
|
1356
|
+
ref: T,
|
|
1120
1357
|
style: {
|
|
1121
1358
|
position: "relative",
|
|
1122
|
-
maxHeight: "100%",
|
|
1123
1359
|
flexGrow: 1,
|
|
1124
|
-
|
|
1125
|
-
...
|
|
1360
|
+
// Lists that scroll with an outer element render at their full height (and must not clip sticky rows)
|
|
1361
|
+
...c === void 0 && {
|
|
1362
|
+
maxHeight: "100%",
|
|
1363
|
+
overflowY: "auto"
|
|
1364
|
+
},
|
|
1365
|
+
...p
|
|
1126
1366
|
}
|
|
1127
1367
|
},
|
|
1128
|
-
...
|
|
1129
|
-
|
|
1368
|
+
...x ? [W, D] : [D, W],
|
|
1369
|
+
N
|
|
1130
1370
|
);
|
|
1131
1371
|
}
|
|
1132
|
-
function
|
|
1372
|
+
function Re(e) {
|
|
1133
1373
|
const t = /* @__PURE__ */ new Map();
|
|
1134
|
-
return e !== void 0 && e.forEach((
|
|
1135
|
-
Number.isFinite(
|
|
1374
|
+
return e !== void 0 && e.forEach((r, o) => {
|
|
1375
|
+
Number.isFinite(r) && r > 0 && t.set(o, r);
|
|
1136
1376
|
}), t;
|
|
1137
1377
|
}
|
|
1138
|
-
function
|
|
1378
|
+
function lt({
|
|
1139
1379
|
defaultRowHeight: e,
|
|
1140
1380
|
initialRowHeights: t,
|
|
1141
|
-
key:
|
|
1381
|
+
key: r
|
|
1142
1382
|
}) {
|
|
1143
|
-
const [o,
|
|
1144
|
-
key:
|
|
1145
|
-
map:
|
|
1383
|
+
const [o, s] = C(() => ({
|
|
1384
|
+
key: r,
|
|
1385
|
+
map: Re(t)
|
|
1146
1386
|
}));
|
|
1147
|
-
o.key !==
|
|
1148
|
-
key:
|
|
1149
|
-
map:
|
|
1387
|
+
o.key !== r && s({
|
|
1388
|
+
key: r,
|
|
1389
|
+
map: Re(t)
|
|
1150
1390
|
});
|
|
1151
|
-
const { map:
|
|
1152
|
-
let
|
|
1153
|
-
return
|
|
1154
|
-
|
|
1155
|
-
}),
|
|
1156
|
-
}, [e,
|
|
1157
|
-
(
|
|
1158
|
-
const
|
|
1159
|
-
return
|
|
1391
|
+
const { map: i } = o, n = X(() => {
|
|
1392
|
+
let a = 0;
|
|
1393
|
+
return i.forEach((c) => {
|
|
1394
|
+
a += c;
|
|
1395
|
+
}), a === 0 ? e : a / i.size;
|
|
1396
|
+
}, [e, i]), d = X(
|
|
1397
|
+
(a) => {
|
|
1398
|
+
const c = i.get(a);
|
|
1399
|
+
return c !== void 0 ? c : e;
|
|
1160
1400
|
},
|
|
1161
|
-
[e,
|
|
1162
|
-
),
|
|
1163
|
-
|
|
1164
|
-
if (
|
|
1165
|
-
return
|
|
1166
|
-
const
|
|
1167
|
-
return
|
|
1168
|
-
...
|
|
1169
|
-
map:
|
|
1401
|
+
[e, i]
|
|
1402
|
+
), v = X((a, c) => {
|
|
1403
|
+
s((l) => {
|
|
1404
|
+
if (l.map.get(a) === c)
|
|
1405
|
+
return l;
|
|
1406
|
+
const p = new Map(l.map);
|
|
1407
|
+
return p.set(a, c), {
|
|
1408
|
+
...l,
|
|
1409
|
+
map: p
|
|
1170
1410
|
};
|
|
1171
1411
|
});
|
|
1172
|
-
}, []),
|
|
1173
|
-
(
|
|
1174
|
-
|
|
1175
|
-
const { borderBoxSize:
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
);
|
|
1180
|
-
const O = parseInt(h), { blockSize: g } = d[0];
|
|
1181
|
-
g && a(O, g);
|
|
1412
|
+
}, []), h = ie(
|
|
1413
|
+
(a) => {
|
|
1414
|
+
a.length !== 0 && a.forEach((c) => {
|
|
1415
|
+
const { borderBoxSize: l, target: p } = c, b = ge(p);
|
|
1416
|
+
if (b === void 0)
|
|
1417
|
+
return;
|
|
1418
|
+
const { blockSize: S } = l[0];
|
|
1419
|
+
S && v(b, S);
|
|
1182
1420
|
});
|
|
1183
1421
|
}
|
|
1184
|
-
), f =
|
|
1185
|
-
|
|
1422
|
+
), f = P(null);
|
|
1423
|
+
le(
|
|
1186
1424
|
() => () => {
|
|
1187
1425
|
f.current?.resizeObserver.disconnect(), f.current = null;
|
|
1188
1426
|
},
|
|
1189
1427
|
[]
|
|
1190
1428
|
);
|
|
1191
|
-
const
|
|
1192
|
-
(
|
|
1193
|
-
const
|
|
1194
|
-
return
|
|
1195
|
-
const
|
|
1196
|
-
if (f.current?.view !==
|
|
1429
|
+
const u = X(
|
|
1430
|
+
(a) => {
|
|
1431
|
+
const c = [];
|
|
1432
|
+
return a.forEach((l) => {
|
|
1433
|
+
const p = Z(l);
|
|
1434
|
+
if (f.current?.view !== p) {
|
|
1197
1435
|
f.current?.resizeObserver.disconnect();
|
|
1198
|
-
const
|
|
1199
|
-
f.current =
|
|
1200
|
-
resizeObserver: new
|
|
1201
|
-
view:
|
|
1436
|
+
const S = we(l);
|
|
1437
|
+
f.current = S ? {
|
|
1438
|
+
resizeObserver: new S(h),
|
|
1439
|
+
view: p
|
|
1202
1440
|
} : null;
|
|
1203
1441
|
}
|
|
1204
|
-
const
|
|
1205
|
-
|
|
1442
|
+
const b = f.current?.resizeObserver;
|
|
1443
|
+
b && (b.observe(l), c.push([l, b]));
|
|
1206
1444
|
}), () => {
|
|
1207
|
-
|
|
1208
|
-
([
|
|
1445
|
+
c.forEach(
|
|
1446
|
+
([l, p]) => p.unobserve(l)
|
|
1209
1447
|
);
|
|
1210
1448
|
};
|
|
1211
1449
|
},
|
|
1212
|
-
[
|
|
1450
|
+
[h]
|
|
1213
1451
|
);
|
|
1214
|
-
return
|
|
1452
|
+
return q(
|
|
1215
1453
|
() => ({
|
|
1216
|
-
getAverageRowHeight:
|
|
1217
|
-
getRowHeight:
|
|
1218
|
-
setRowHeight:
|
|
1219
|
-
observeRowElements:
|
|
1454
|
+
getAverageRowHeight: n,
|
|
1455
|
+
getRowHeight: d,
|
|
1456
|
+
setRowHeight: v,
|
|
1457
|
+
observeRowElements: u
|
|
1220
1458
|
}),
|
|
1221
|
-
[
|
|
1459
|
+
[n, d, v, u]
|
|
1460
|
+
);
|
|
1461
|
+
}
|
|
1462
|
+
const ct = C, at = P, et = {};
|
|
1463
|
+
function ft({
|
|
1464
|
+
count: e,
|
|
1465
|
+
defaultScrollOffset: t = 0,
|
|
1466
|
+
defaultSize: r = 0,
|
|
1467
|
+
dir: o,
|
|
1468
|
+
direction: s = "vertical",
|
|
1469
|
+
element: i,
|
|
1470
|
+
itemSize: n,
|
|
1471
|
+
onItemsRendered: d,
|
|
1472
|
+
overscanCount: v = 3,
|
|
1473
|
+
scrollElement: h
|
|
1474
|
+
}) {
|
|
1475
|
+
const f = ve(n);
|
|
1476
|
+
Y(
|
|
1477
|
+
!f || s === "vertical",
|
|
1478
|
+
"Dynamic item sizes are only supported for vertical content"
|
|
1222
1479
|
);
|
|
1480
|
+
const u = q(() => ve(n) ? (R) => n.getRowHeight(R) ?? n.getAverageRowHeight() : n, [n]), a = Ee(i, o), {
|
|
1481
|
+
getCellBounds: c,
|
|
1482
|
+
getEstimatedSize: l,
|
|
1483
|
+
scrollTarget: p,
|
|
1484
|
+
getScrollPositionForIndex: b,
|
|
1485
|
+
startIndexOverscan: S,
|
|
1486
|
+
startIndexVisible: w,
|
|
1487
|
+
stopIndexOverscan: m,
|
|
1488
|
+
stopIndexVisible: T
|
|
1489
|
+
} = pe({
|
|
1490
|
+
containerElement: i,
|
|
1491
|
+
defaultContainerSize: r,
|
|
1492
|
+
defaultScrollOffset: t,
|
|
1493
|
+
direction: s,
|
|
1494
|
+
isRtl: s === "horizontal" && a,
|
|
1495
|
+
itemCount: e,
|
|
1496
|
+
itemProps: et,
|
|
1497
|
+
itemSize: u,
|
|
1498
|
+
onResize: void 0,
|
|
1499
|
+
overscanCount: v,
|
|
1500
|
+
scrollElement: h
|
|
1501
|
+
}), g = P(/* @__PURE__ */ new Set()), J = P(/* @__PURE__ */ new WeakSet()), k = P([]), E = P({ dynamicRowHeight: null, unobserve: /* @__PURE__ */ new Map() }), L = X((R) => {
|
|
1502
|
+
R !== null && g.current.add(R);
|
|
1503
|
+
}, []), $ = i;
|
|
1504
|
+
B(() => {
|
|
1505
|
+
const R = g.current, O = E.current, H = ve(n) ? n : null;
|
|
1506
|
+
O.dynamicRowHeight?.observeRowElements !== H?.observeRowElements && (O.unobserve.forEach((I) => I()), O.unobserve.clear()), O.dynamicRowHeight = H, R.forEach((I) => {
|
|
1507
|
+
if (!I.isConnected)
|
|
1508
|
+
R.delete(I), O.unobserve.get(I)?.(), O.unobserve.delete(I);
|
|
1509
|
+
else if (H && // Like List, measure items once the element has mounted
|
|
1510
|
+
// (e.g. so the dynamic row height cache has finished mounting too)
|
|
1511
|
+
$ !== null && !O.unobserve.has(I)) {
|
|
1512
|
+
if (ge(I) === void 0) {
|
|
1513
|
+
J.current.has(I) || (J.current.add(I), console.warn(
|
|
1514
|
+
"useVirtualizer: Items passed to measureElement must specify their index with a data-index attribute",
|
|
1515
|
+
I
|
|
1516
|
+
));
|
|
1517
|
+
return;
|
|
1518
|
+
}
|
|
1519
|
+
O.unobserve.set(
|
|
1520
|
+
I,
|
|
1521
|
+
H.observeRowElements([I])
|
|
1522
|
+
);
|
|
1523
|
+
}
|
|
1524
|
+
}), k.current = Array.from(R);
|
|
1525
|
+
}), le(() => {
|
|
1526
|
+
const R = E.current;
|
|
1527
|
+
return () => {
|
|
1528
|
+
R.unobserve.forEach((O) => O()), R.unobserve.clear(), R.dynamicRowHeight = null;
|
|
1529
|
+
};
|
|
1530
|
+
}, []);
|
|
1531
|
+
const _ = Ne({
|
|
1532
|
+
direction: s,
|
|
1533
|
+
element: i,
|
|
1534
|
+
getCellBounds: c,
|
|
1535
|
+
isDynamicSize: f,
|
|
1536
|
+
itemCount: e,
|
|
1537
|
+
itemElements: k,
|
|
1538
|
+
scrollTarget: p,
|
|
1539
|
+
getScrollPositionForIndex: b
|
|
1540
|
+
});
|
|
1541
|
+
le(() => {
|
|
1542
|
+
S >= 0 && m >= 0 && d && d(
|
|
1543
|
+
{ startIndex: w, stopIndex: T },
|
|
1544
|
+
{ startIndex: S, stopIndex: m }
|
|
1545
|
+
);
|
|
1546
|
+
}, [
|
|
1547
|
+
d,
|
|
1548
|
+
S,
|
|
1549
|
+
w,
|
|
1550
|
+
m,
|
|
1551
|
+
T
|
|
1552
|
+
]);
|
|
1553
|
+
const Q = q(() => {
|
|
1554
|
+
const R = [];
|
|
1555
|
+
if (e > 0)
|
|
1556
|
+
for (let O = S; O <= m; O++) {
|
|
1557
|
+
const { scrollOffset: H, size: I } = c(O);
|
|
1558
|
+
R.push({ index: O, offset: H, size: I });
|
|
1559
|
+
}
|
|
1560
|
+
return R;
|
|
1561
|
+
}, [e, c, S, m]), te = l();
|
|
1562
|
+
return q(
|
|
1563
|
+
() => ({
|
|
1564
|
+
items: Q,
|
|
1565
|
+
measureElement: L,
|
|
1566
|
+
scrollToIndex: _,
|
|
1567
|
+
totalSize: te,
|
|
1568
|
+
visibleRange: {
|
|
1569
|
+
startIndex: w,
|
|
1570
|
+
stopIndex: T
|
|
1571
|
+
}
|
|
1572
|
+
}),
|
|
1573
|
+
[
|
|
1574
|
+
Q,
|
|
1575
|
+
L,
|
|
1576
|
+
_,
|
|
1577
|
+
w,
|
|
1578
|
+
T,
|
|
1579
|
+
te
|
|
1580
|
+
]
|
|
1581
|
+
);
|
|
1582
|
+
}
|
|
1583
|
+
function ut(e, {
|
|
1584
|
+
delay: t = 150
|
|
1585
|
+
} = {}) {
|
|
1586
|
+
const [r, o] = C(!1);
|
|
1587
|
+
return B(() => {
|
|
1588
|
+
if (!e)
|
|
1589
|
+
return;
|
|
1590
|
+
const s = e === "window" ? window : Z(e), i = e === "window" ? s : e, n = "onscrollend" in s;
|
|
1591
|
+
let d, v = 0;
|
|
1592
|
+
const h = () => {
|
|
1593
|
+
performance.now() - v >= t ? (d = void 0, o(!1)) : d = s.requestAnimationFrame(h);
|
|
1594
|
+
}, f = () => {
|
|
1595
|
+
o(!0), n || (v = performance.now(), d === void 0 && (d = s.requestAnimationFrame(h)));
|
|
1596
|
+
}, u = () => {
|
|
1597
|
+
o(!1);
|
|
1598
|
+
};
|
|
1599
|
+
return i.addEventListener("scroll", f, { passive: !0 }), n && i.addEventListener("scrollend", u), () => {
|
|
1600
|
+
i.removeEventListener("scroll", f), i.removeEventListener("scrollend", u), d !== void 0 && s.cancelAnimationFrame(d), o(!1);
|
|
1601
|
+
};
|
|
1602
|
+
}, [t, e]), r;
|
|
1223
1603
|
}
|
|
1224
|
-
const
|
|
1225
|
-
function
|
|
1604
|
+
const Te = /* @__PURE__ */ new WeakMap();
|
|
1605
|
+
function dt(e = !1, t = typeof document < "u" ? document : void 0) {
|
|
1226
1606
|
if (t === void 0)
|
|
1227
1607
|
return 0;
|
|
1228
|
-
let
|
|
1229
|
-
if (
|
|
1230
|
-
const o = t.createElement("div"),
|
|
1231
|
-
|
|
1608
|
+
let r = Te.get(t);
|
|
1609
|
+
if (r === void 0 || e) {
|
|
1610
|
+
const o = t.createElement("div"), s = o.style;
|
|
1611
|
+
s.width = "50px", s.height = "50px", s.overflow = "scroll", t.body.appendChild(o), r = o.offsetWidth - o.clientWidth, t.body.removeChild(o), Te.set(t, r);
|
|
1232
1612
|
}
|
|
1233
|
-
return
|
|
1613
|
+
return r;
|
|
1234
1614
|
}
|
|
1235
1615
|
export {
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1616
|
+
rt as Grid,
|
|
1617
|
+
it as List,
|
|
1618
|
+
dt as getScrollbarSize,
|
|
1619
|
+
lt as useDynamicRowHeight,
|
|
1620
|
+
ot as useGridCallbackRef,
|
|
1621
|
+
nt as useGridRef,
|
|
1622
|
+
ut as useIsScrolling,
|
|
1623
|
+
ct as useListCallbackRef,
|
|
1624
|
+
at as useListRef,
|
|
1625
|
+
ft as useVirtualizer
|
|
1244
1626
|
};
|
|
1245
1627
|
//# sourceMappingURL=react-window.js.map
|